From e768ebec3d67fb6dfd66ed6cb41ccb39f634ad19 Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Thu, 15 Aug 2024 15:39:42 +0800 Subject: [PATCH 01/89] docs(library/pickle.po): editing, up to line 212 --- library/pickle.po | 59 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/library/pickle.po b/library/pickle.po index 532f1f1884..f73c09164b 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -2,6 +2,7 @@ # This file is distributed under the same license as the Python package. # # Translators: +# Skylull, 2024 msgid "" msgstr "" "Project-Id-Version: Python 3.12\n" @@ -25,6 +26,14 @@ msgstr ":mod:`!pickle` --- Python 物件序列化" msgid "**Source code:** :source:`Lib/pickle.py`" msgstr "**原始碼:**\\ :source:`Lib/pickle.py`" +# Skylull: 我對 `pickle` 的命名原因進行了簡單的搜尋,只找到一則討論 +# https://stackoverflow.com/questions/27324986/pickles-why-are-they-called- +# that +# 其中表示這名字很可能只是為了隨便找一個p開頭的單字、或原始開發人員的內部玩笑造成的約定俗成。也有人表示醃製黃瓜(pickle- +# ing)的目標就是保存和存放,所以取了這個名字。 +# 無論如何似乎沒有一個定論。 +# 因為不確定是否與醃漬的這個梗有關,我暫時選擇使用 `封裝` 與 `拆封` 作為譯文,大致保存那個把東西處裡後裝起來的感覺但又不至於太奇怪。 +# 唯一需要擔心的是是否有與 `encapsulation` (封裝,網路協定名詞)或 `package`(封包,網路協定名詞)搞混的可能。 #: ../../library/pickle.rst:22 msgid "" "The :mod:`pickle` module implements binary protocols for serializing and de-" @@ -36,10 +45,17 @@ msgid "" "\"serialization\", \"marshalling,\" [#]_ or \"flattening\"; however, to " "avoid confusion, the terms used here are \"pickling\" and \"unpickling\"." msgstr "" +":mod:`pickle` 模組實作的是一個在二進位層級上對 Python 物件進行序列化" +"(serialize)或去序列化(de-serialize)。*\"Pickling\"* 用於專門指摘將一個 " +"Python 物件轉換為一個二進位串流的過程,*\"unpickling\"* 則相反,指的是將一個" +"(來自 :term:`binary file` 或 :term:`bytes-like object` 的)二進位串流轉換回 " +"Python 物件的過程。Pickling(和 unpickling)的過程也可能被稱作 " +"\"serialization\", \"marshalling,\" [#]_ 或 \"flattening\"。不過,為了避免混" +"淆,本文件將統一稱作封裝(pickling)、拆封(unpickling)。" #: ../../library/pickle.rst:33 msgid "The ``pickle`` module **is not secure**. Only unpickle data you trust." -msgstr "" +msgstr "``pickle`` 模組**並不安全**,切記只拆封你信任的資料。" #: ../../library/pickle.rst:35 msgid "" @@ -47,18 +63,22 @@ msgid "" "arbitrary code during unpickling**. Never unpickle data that could have come " "from an untrusted source, or that could have been tampered with." msgstr "" +"pickle 封包是有可能被建立來在拆封的時候**執行任意惡意程式碼**的。絕對不要拆封" +"任何你無法信任其來源、或可能被修改過的 pickle 封包。" #: ../../library/pickle.rst:39 msgid "" "Consider signing data with :mod:`hmac` if you need to ensure that it has not " "been tampered with." -msgstr "" +msgstr "建議你可以使用 :mod:`hmac` 模組來簽署這個封包,以確保其未被修改過。" #: ../../library/pickle.rst:42 msgid "" "Safer serialization formats such as :mod:`json` may be more appropriate if " "you are processing untrusted data. See :ref:`comparison-with-json`." msgstr "" +"如果你在處理不受信任的資料,其他比較安全的序列化格式(例如 :mod:`json`)可能" +"會更適合。請參照 See :ref:`comparison-with-json` 的說明。" #: ../../library/pickle.rst:47 msgid "Relationship to other Python modules" @@ -75,12 +95,15 @@ msgid "" "Python objects. :mod:`marshal` exists primarily to support Python's :file:`." "pyc` files." msgstr "" +"Python 有另一個比較原始的序列化模組叫 :mod:`marshal`,不過其設計目的是為了支" +"援 Python 的預編譯功能 :file:`.pyc` 運作。總地來說,沒事不要用 :mod:" +"`marshal`。" #: ../../library/pickle.rst:57 msgid "" "The :mod:`pickle` module differs from :mod:`marshal` in several significant " "ways:" -msgstr "" +msgstr ":mod:`pickle` 和 :mod:`marshal` 有幾個明顯不同的地方:" #: ../../library/pickle.rst:59 msgid "" @@ -88,6 +111,8 @@ msgid "" "serialized, so that later references to the same object won't be serialized " "again. :mod:`marshal` doesn't do this." msgstr "" +":mod:`pickle` 會記住哪些物件已經被序列化過了,稍後再次參照到這個物件的時候才" +"不會進行重複的序列化。:mod:`marshal` 沒有這個功能。" #: ../../library/pickle.rst:63 msgid "" @@ -101,6 +126,11 @@ msgid "" "Shared objects remain shared, which can be very important for mutable " "objects." msgstr "" +"這對遞迴物件和物件共用都有影響。遞迴物件是指包含自我參照的物件。這些情況在 " +"marshal 模組中不會被處理,若嘗試使用 marshal 處理遞迴物件會導致 Python 直譯器" +"崩潰。物件共用發生在序列化的物件階層中,不同位置對同一物件有多個參照時。:mod:" +"`pickle` 只會儲存這個被參照的物件一次,並確保所有其他參照指向這個主要的版本。" +"共用的物件會保持共用,這對於可變(mutable)物件來說非常重要。" #: ../../library/pickle.rst:72 msgid "" @@ -109,6 +139,9 @@ msgid "" "transparently, however the class definition must be importable and live in " "the same module as when the object was stored." msgstr "" +":mod:`marshal` 無法序列化使用者自訂的類別和的實例。:mod:`pickle` 則可以讓使用" +"者儲存並還原自訂的類別實例,前提是儲存時該類別的定義存在於與要被儲存的物件所" +"在的模組中、且可以被引入(import)。" #: ../../library/pickle.rst:77 msgid "" @@ -122,6 +155,11 @@ msgid "" "differences if your data is crossing that unique breaking change language " "boundary." msgstr "" +":mod:`marshal` 序列化格式無法保證能在不同版本的 Python 之間移植。因為其主要的" +"作用是支援 :file:`.pyc` 檔案的運作,Python 的實作人員會在需要時實作無法前向相" +"容的序列化方式。但只要選擇了相容的 pickle 協定,且處理了 Python 2 和 Python " +"3 之間的資料類型差異,:mod:`pickle` 序列化協定能保證在不同 Python 版本間的相" +"容性。" #: ../../library/pickle.rst:90 msgid "Comparison with ``json``" @@ -132,6 +170,8 @@ msgid "" "There are fundamental differences between the pickle protocols and `JSON " "(JavaScript Object Notation) `_:" msgstr "" +"pickle 協定和 `JSON (JavaScript Object Notation) `_ 有一些" +"根本上的不同:" #: ../../library/pickle.rst:95 msgid "" @@ -139,17 +179,25 @@ msgid "" "of the time it is then encoded to ``utf-8``), while pickle is a binary " "serialization format;" msgstr "" +"JSON 以文字形式作為序列化的輸出(輸出 unicode 文字,但大多數又會被編碼為 " +"``UTF-8``),而 pickle 則是以二進位形式作為序列化的輸出;" #: ../../library/pickle.rst:99 msgid "JSON is human-readable, while pickle is not;" -msgstr "JSON 是人類可讀的,而 pickle 不是;" +msgstr "JSON 是人類可讀的,而 pickle 則無法;" #: ../../library/pickle.rst:101 msgid "" "JSON is interoperable and widely used outside of the Python ecosystem, while " "pickle is Python-specific;" msgstr "" +"JSON 具有高互通性(interoperability)且在 Python 以外的環境也被大量利用,但 " +"pickle 只能在 Python 內使用。" +# Skylull: introspection, introspection facilities +# https://zh.wikipedia.org/wiki/%E5%86%85%E7%9C%81_(%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%A7%91%E5%AD%A6) +# https://book.pythontips.com/en/latest/object_introspection.html +# https://www.geeksforgeeks.org/code-introspection-in-python/ #: ../../library/pickle.rst:104 msgid "" "JSON, by default, can only represent a subset of the Python built-in types, " @@ -158,6 +206,9 @@ msgid "" "introspection facilities; complex cases can be tackled by implementing :ref:" "`specific object APIs `);" msgstr "" +"預設狀態下的 JSON 只能紀錄一小部份的 Python 內建型別,且無法紀錄自訂類別;但" +"透過 Python 的自省功能,pickle 可以紀錄絕大多數的 Python 型別(其他比較複雜的" +"狀況也可以透過實作 :ref:`specific object APIs ` 來解決);" #: ../../library/pickle.rst:110 msgid "" From 9c6ac561e1d7e1353c9bb47df6a6fa40e5da6b36 Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Fri, 16 Aug 2024 00:23:06 +0800 Subject: [PATCH 02/89] docs(library/pickle.po): editing, up to line 362 --- library/pickle.po | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/library/pickle.po b/library/pickle.po index f73c09164b..c91b3e39f8 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -215,16 +215,20 @@ msgid "" "Unlike pickle, deserializing untrusted JSON does not in itself create an " "arbitrary code execution vulnerability." msgstr "" +"去序列化不安全的 JSON 不會產生任意程式執行的風險,但去序列化不安全的 pickle " +"會。" #: ../../library/pickle.rst:114 msgid "" "The :mod:`json` module: a standard library module allowing JSON " "serialization and deserialization." msgstr "" +":mod:`json` module: 是標準函式庫的一部分,可讓使用者進行 JSON 的序列化與去序" +"列化。" #: ../../library/pickle.rst:121 msgid "Data stream format" -msgstr "" +msgstr "資料串流格式" #: ../../library/pickle.rst:126 msgid "" @@ -234,6 +238,9 @@ msgid "" "that non-Python programs may not be able to reconstruct pickled Python " "objects." msgstr "" +":mod:`pickle` 使用的資料格式是針對 Python 而設計的。好處是他不會受到外部標準" +"(像是 JSON 或 XDR,而 XDR 無法紀錄指標共用)的限制;不過這也代表其他不是 " +"Python 的程式可能無法重建 pickle 封裝的 Python 物件。" #: ../../library/pickle.rst:131 msgid "" @@ -241,6 +248,8 @@ msgid "" "representation. If you need optimal size characteristics, you can " "efficiently :doc:`compress ` pickled data." msgstr "" +"以預設設定來說,:mod:`pickle` 使用相對緊湊的二進位形式來儲存資料。如果你需要" +"盡可能地縮小檔案大小,你可以\\\\ :doc:`壓縮 `\\\\ 封裝的資料。" #: ../../library/pickle.rst:135 msgid "" @@ -248,6 +257,8 @@ msgid "" "generated by :mod:`pickle`. :mod:`pickletools` source code has extensive " "comments about opcodes used by pickle protocols." msgstr "" +":mod:`pickletools` 含有工具可分析 :mod:`pickle` 所產生的資料流。:mod:" +"`pickletools` 的源始碼詳細地記載了所有 pickle 協定的操作碼(opcode)。" #: ../../library/pickle.rst:139 msgid "" @@ -255,18 +266,21 @@ msgid "" "The higher the protocol used, the more recent the version of Python needed " "to read the pickle produced." msgstr "" +"截至目前為止,共有六種不同版本的協定可用於封裝 pickle。數字越大版本代表你需" +"要使用越新的 Python 版本來拆封相應的 pickle 封裝。" #: ../../library/pickle.rst:143 msgid "" "Protocol version 0 is the original \"human-readable\" protocol and is " "backwards compatible with earlier versions of Python." msgstr "" +"版本 0 的協定是最初「人類可讀」的版本,且可以向前支援早期版本的 Python。" #: ../../library/pickle.rst:146 msgid "" "Protocol version 1 is an old binary format which is also compatible with " "earlier versions of Python." -msgstr "" +msgstr "版本 1 的協定使用舊的二進位格式,一樣能向前支援早期版本的 Python。" #: ../../library/pickle.rst:149 msgid "" @@ -274,6 +288,9 @@ msgid "" "efficient pickling of :term:`new-style classes `. Refer " "to :pep:`307` for information about improvements brought by protocol 2." msgstr "" +"版本 2 的協定在 Python 2.3 中初次被引入。其可提供更高效率的 :term:`new-style " +"classes ` 封裝過程。請參閱 :pep:`307` 以了解版本 2 帶來的改" +"進。" #: ../../library/pickle.rst:153 msgid "" @@ -281,6 +298,8 @@ msgid "" "class:`bytes` objects and cannot be unpickled by Python 2.x. This was the " "default protocol in Python 3.0--3.7." msgstr "" +"版本 3 的協定在 Python 3.0 被新增。現在能支援封裝 :class:`bytes` 的物件且無法" +"被 2.x 版本的 Python 拆封。在 3.0~3.7 的 Python 預設使用 3 版協定。" #: ../../library/pickle.rst:157 msgid "" @@ -289,6 +308,9 @@ msgid "" "optimizations. It is the default protocol starting with Python 3.8. Refer " "to :pep:`3154` for information about improvements brought by protocol 4." msgstr "" +"版本 4 的協定在 Python 3.4 被新增。現在能支援超大物件的封裝、更多種型別的物件" +"以及針對部份資料格式的儲存進行最佳化。從 Python 3.8 起,預設使用第 4 版協定。" +"請參閱 :pep:`3154` 以了解第 4 版協定改進的細節。" #: ../../library/pickle.rst:163 msgid "" @@ -310,6 +332,12 @@ msgid "" "database. The :mod:`shelve` module provides a simple interface to pickle " "and unpickle objects on DBM-style database files." msgstr "" +"資料序列化是一個比資料持久化更早期的概念;雖然 :mod:`pickle` 可以讀寫檔案物" +"件,但它並不處理命名持久物件的問題,也不處理對持久物件並行存取,一個更棘手的" +"問題。:mod:`pickle` 模組可以將複雜物件轉換成位元組串流,也可以將位元組串流轉" +"換回具有相同原始內部結構的物件。對這些位元組串流最明顯的處理方式大概是將它們" +"寫入檔案中,但也可能將它們透過網路傳送或儲存在一個資料庫中。:mod:`shelve` 模" +"組提供了一個簡單的介面來在 DBM 風格的資料庫檔案中進行物件的封裝和拆封的操作。" #: ../../library/pickle.rst:181 msgid "Module Interface" @@ -323,6 +351,10 @@ msgid "" "de-serialization, you can create a :class:`Pickler` or an :class:`Unpickler` " "object, respectively." msgstr "" +"想要序列化一個物件,你只需要呼叫 :func:`dumps` 函數。而當你想要去序列化一個資" +"料流時,你只需要呼叫 :func:`loads` 即可。不過,若你希望能各自對序列化和去序列" +"化的過程中有更多的掌控度,你可以自訂一個 :class:`Pickler` 或 :class:" +"`Unpickler` 物件。" #: ../../library/pickle.rst:188 msgid "The :mod:`pickle` module provides the following constants:" From 8b9479ffbde0a4adf35ec526c7a1cb1e78289b2f Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Mon, 19 Aug 2024 17:54:46 +0800 Subject: [PATCH 03/89] docs(library/pickle.po): editing, up to line 375. --- library/pickle.po | 3092 ++++++++++++++++++++++----------------------- 1 file changed, 1542 insertions(+), 1550 deletions(-) diff --git a/library/pickle.po b/library/pickle.po index c91b3e39f8..95f0a47a95 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -1,1550 +1,1542 @@ -# Copyright (C) 2001-2024, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -# Skylull, 2024 -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" -"PO-Revision-Date: 2018-05-23 16:07+0000\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../../library/pickle.rst:2 -msgid ":mod:`!pickle` --- Python object serialization" -msgstr ":mod:`!pickle` --- Python 物件序列化" - -#: ../../library/pickle.rst:10 -msgid "**Source code:** :source:`Lib/pickle.py`" -msgstr "**原始碼:**\\ :source:`Lib/pickle.py`" - -# Skylull: 我對 `pickle` 的命名原因進行了簡單的搜尋,只找到一則討論 -# https://stackoverflow.com/questions/27324986/pickles-why-are-they-called- -# that -# 其中表示這名字很可能只是為了隨便找一個p開頭的單字、或原始開發人員的內部玩笑造成的約定俗成。也有人表示醃製黃瓜(pickle- -# ing)的目標就是保存和存放,所以取了這個名字。 -# 無論如何似乎沒有一個定論。 -# 因為不確定是否與醃漬的這個梗有關,我暫時選擇使用 `封裝` 與 `拆封` 作為譯文,大致保存那個把東西處裡後裝起來的感覺但又不至於太奇怪。 -# 唯一需要擔心的是是否有與 `encapsulation` (封裝,網路協定名詞)或 `package`(封包,網路協定名詞)搞混的可能。 -#: ../../library/pickle.rst:22 -msgid "" -"The :mod:`pickle` module implements binary protocols for serializing and de-" -"serializing a Python object structure. *\"Pickling\"* is the process " -"whereby a Python object hierarchy is converted into a byte stream, and " -"*\"unpickling\"* is the inverse operation, whereby a byte stream (from a :" -"term:`binary file` or :term:`bytes-like object`) is converted back into an " -"object hierarchy. Pickling (and unpickling) is alternatively known as " -"\"serialization\", \"marshalling,\" [#]_ or \"flattening\"; however, to " -"avoid confusion, the terms used here are \"pickling\" and \"unpickling\"." -msgstr "" -":mod:`pickle` 模組實作的是一個在二進位層級上對 Python 物件進行序列化" -"(serialize)或去序列化(de-serialize)。*\"Pickling\"* 用於專門指摘將一個 " -"Python 物件轉換為一個二進位串流的過程,*\"unpickling\"* 則相反,指的是將一個" -"(來自 :term:`binary file` 或 :term:`bytes-like object` 的)二進位串流轉換回 " -"Python 物件的過程。Pickling(和 unpickling)的過程也可能被稱作 " -"\"serialization\", \"marshalling,\" [#]_ 或 \"flattening\"。不過,為了避免混" -"淆,本文件將統一稱作封裝(pickling)、拆封(unpickling)。" - -#: ../../library/pickle.rst:33 -msgid "The ``pickle`` module **is not secure**. Only unpickle data you trust." -msgstr "``pickle`` 模組**並不安全**,切記只拆封你信任的資料。" - -#: ../../library/pickle.rst:35 -msgid "" -"It is possible to construct malicious pickle data which will **execute " -"arbitrary code during unpickling**. Never unpickle data that could have come " -"from an untrusted source, or that could have been tampered with." -msgstr "" -"pickle 封包是有可能被建立來在拆封的時候**執行任意惡意程式碼**的。絕對不要拆封" -"任何你無法信任其來源、或可能被修改過的 pickle 封包。" - -#: ../../library/pickle.rst:39 -msgid "" -"Consider signing data with :mod:`hmac` if you need to ensure that it has not " -"been tampered with." -msgstr "建議你可以使用 :mod:`hmac` 模組來簽署這個封包,以確保其未被修改過。" - -#: ../../library/pickle.rst:42 -msgid "" -"Safer serialization formats such as :mod:`json` may be more appropriate if " -"you are processing untrusted data. See :ref:`comparison-with-json`." -msgstr "" -"如果你在處理不受信任的資料,其他比較安全的序列化格式(例如 :mod:`json`)可能" -"會更適合。請參照 See :ref:`comparison-with-json` 的說明。" - -#: ../../library/pickle.rst:47 -msgid "Relationship to other Python modules" -msgstr "和其他 Python 模組的關係" - -#: ../../library/pickle.rst:50 -msgid "Comparison with ``marshal``" -msgstr "和 ``marshal`` 的比較" - -#: ../../library/pickle.rst:52 -msgid "" -"Python has a more primitive serialization module called :mod:`marshal`, but " -"in general :mod:`pickle` should always be the preferred way to serialize " -"Python objects. :mod:`marshal` exists primarily to support Python's :file:`." -"pyc` files." -msgstr "" -"Python 有另一個比較原始的序列化模組叫 :mod:`marshal`,不過其設計目的是為了支" -"援 Python 的預編譯功能 :file:`.pyc` 運作。總地來說,沒事不要用 :mod:" -"`marshal`。" - -#: ../../library/pickle.rst:57 -msgid "" -"The :mod:`pickle` module differs from :mod:`marshal` in several significant " -"ways:" -msgstr ":mod:`pickle` 和 :mod:`marshal` 有幾個明顯不同的地方:" - -#: ../../library/pickle.rst:59 -msgid "" -"The :mod:`pickle` module keeps track of the objects it has already " -"serialized, so that later references to the same object won't be serialized " -"again. :mod:`marshal` doesn't do this." -msgstr "" -":mod:`pickle` 會記住哪些物件已經被序列化過了,稍後再次參照到這個物件的時候才" -"不會進行重複的序列化。:mod:`marshal` 沒有這個功能。" - -#: ../../library/pickle.rst:63 -msgid "" -"This has implications both for recursive objects and object sharing. " -"Recursive objects are objects that contain references to themselves. These " -"are not handled by marshal, and in fact, attempting to marshal recursive " -"objects will crash your Python interpreter. Object sharing happens when " -"there are multiple references to the same object in different places in the " -"object hierarchy being serialized. :mod:`pickle` stores such objects only " -"once, and ensures that all other references point to the master copy. " -"Shared objects remain shared, which can be very important for mutable " -"objects." -msgstr "" -"這對遞迴物件和物件共用都有影響。遞迴物件是指包含自我參照的物件。這些情況在 " -"marshal 模組中不會被處理,若嘗試使用 marshal 處理遞迴物件會導致 Python 直譯器" -"崩潰。物件共用發生在序列化的物件階層中,不同位置對同一物件有多個參照時。:mod:" -"`pickle` 只會儲存這個被參照的物件一次,並確保所有其他參照指向這個主要的版本。" -"共用的物件會保持共用,這對於可變(mutable)物件來說非常重要。" - -#: ../../library/pickle.rst:72 -msgid "" -":mod:`marshal` cannot be used to serialize user-defined classes and their " -"instances. :mod:`pickle` can save and restore class instances " -"transparently, however the class definition must be importable and live in " -"the same module as when the object was stored." -msgstr "" -":mod:`marshal` 無法序列化使用者自訂的類別和的實例。:mod:`pickle` 則可以讓使用" -"者儲存並還原自訂的類別實例,前提是儲存時該類別的定義存在於與要被儲存的物件所" -"在的模組中、且可以被引入(import)。" - -#: ../../library/pickle.rst:77 -msgid "" -"The :mod:`marshal` serialization format is not guaranteed to be portable " -"across Python versions. Because its primary job in life is to support :file:" -"`.pyc` files, the Python implementers reserve the right to change the " -"serialization format in non-backwards compatible ways should the need arise. " -"The :mod:`pickle` serialization format is guaranteed to be backwards " -"compatible across Python releases provided a compatible pickle protocol is " -"chosen and pickling and unpickling code deals with Python 2 to Python 3 type " -"differences if your data is crossing that unique breaking change language " -"boundary." -msgstr "" -":mod:`marshal` 序列化格式無法保證能在不同版本的 Python 之間移植。因為其主要的" -"作用是支援 :file:`.pyc` 檔案的運作,Python 的實作人員會在需要時實作無法前向相" -"容的序列化方式。但只要選擇了相容的 pickle 協定,且處理了 Python 2 和 Python " -"3 之間的資料類型差異,:mod:`pickle` 序列化協定能保證在不同 Python 版本間的相" -"容性。" - -#: ../../library/pickle.rst:90 -msgid "Comparison with ``json``" -msgstr "和 ``json`` 的比較" - -#: ../../library/pickle.rst:92 -msgid "" -"There are fundamental differences between the pickle protocols and `JSON " -"(JavaScript Object Notation) `_:" -msgstr "" -"pickle 協定和 `JSON (JavaScript Object Notation) `_ 有一些" -"根本上的不同:" - -#: ../../library/pickle.rst:95 -msgid "" -"JSON is a text serialization format (it outputs unicode text, although most " -"of the time it is then encoded to ``utf-8``), while pickle is a binary " -"serialization format;" -msgstr "" -"JSON 以文字形式作為序列化的輸出(輸出 unicode 文字,但大多數又會被編碼為 " -"``UTF-8``),而 pickle 則是以二進位形式作為序列化的輸出;" - -#: ../../library/pickle.rst:99 -msgid "JSON is human-readable, while pickle is not;" -msgstr "JSON 是人類可讀的,而 pickle 則無法;" - -#: ../../library/pickle.rst:101 -msgid "" -"JSON is interoperable and widely used outside of the Python ecosystem, while " -"pickle is Python-specific;" -msgstr "" -"JSON 具有高互通性(interoperability)且在 Python 以外的環境也被大量利用,但 " -"pickle 只能在 Python 內使用。" - -# Skylull: introspection, introspection facilities -# https://zh.wikipedia.org/wiki/%E5%86%85%E7%9C%81_(%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%A7%91%E5%AD%A6) -# https://book.pythontips.com/en/latest/object_introspection.html -# https://www.geeksforgeeks.org/code-introspection-in-python/ -#: ../../library/pickle.rst:104 -msgid "" -"JSON, by default, can only represent a subset of the Python built-in types, " -"and no custom classes; pickle can represent an extremely large number of " -"Python types (many of them automatically, by clever usage of Python's " -"introspection facilities; complex cases can be tackled by implementing :ref:" -"`specific object APIs `);" -msgstr "" -"預設狀態下的 JSON 只能紀錄一小部份的 Python 內建型別,且無法紀錄自訂類別;但" -"透過 Python 的自省功能,pickle 可以紀錄絕大多數的 Python 型別(其他比較複雜的" -"狀況也可以透過實作 :ref:`specific object APIs ` 來解決);" - -#: ../../library/pickle.rst:110 -msgid "" -"Unlike pickle, deserializing untrusted JSON does not in itself create an " -"arbitrary code execution vulnerability." -msgstr "" -"去序列化不安全的 JSON 不會產生任意程式執行的風險,但去序列化不安全的 pickle " -"會。" - -#: ../../library/pickle.rst:114 -msgid "" -"The :mod:`json` module: a standard library module allowing JSON " -"serialization and deserialization." -msgstr "" -":mod:`json` module: 是標準函式庫的一部分,可讓使用者進行 JSON 的序列化與去序" -"列化。" - -#: ../../library/pickle.rst:121 -msgid "Data stream format" -msgstr "資料串流格式" - -#: ../../library/pickle.rst:126 -msgid "" -"The data format used by :mod:`pickle` is Python-specific. This has the " -"advantage that there are no restrictions imposed by external standards such " -"as JSON or XDR (which can't represent pointer sharing); however it means " -"that non-Python programs may not be able to reconstruct pickled Python " -"objects." -msgstr "" -":mod:`pickle` 使用的資料格式是針對 Python 而設計的。好處是他不會受到外部標準" -"(像是 JSON 或 XDR,而 XDR 無法紀錄指標共用)的限制;不過這也代表其他不是 " -"Python 的程式可能無法重建 pickle 封裝的 Python 物件。" - -#: ../../library/pickle.rst:131 -msgid "" -"By default, the :mod:`pickle` data format uses a relatively compact binary " -"representation. If you need optimal size characteristics, you can " -"efficiently :doc:`compress ` pickled data." -msgstr "" -"以預設設定來說,:mod:`pickle` 使用相對緊湊的二進位形式來儲存資料。如果你需要" -"盡可能地縮小檔案大小,你可以\\\\ :doc:`壓縮 `\\\\ 封裝的資料。" - -#: ../../library/pickle.rst:135 -msgid "" -"The module :mod:`pickletools` contains tools for analyzing data streams " -"generated by :mod:`pickle`. :mod:`pickletools` source code has extensive " -"comments about opcodes used by pickle protocols." -msgstr "" -":mod:`pickletools` 含有工具可分析 :mod:`pickle` 所產生的資料流。:mod:" -"`pickletools` 的源始碼詳細地記載了所有 pickle 協定的操作碼(opcode)。" - -#: ../../library/pickle.rst:139 -msgid "" -"There are currently 6 different protocols which can be used for pickling. " -"The higher the protocol used, the more recent the version of Python needed " -"to read the pickle produced." -msgstr "" -"截至目前為止,共有六種不同版本的協定可用於封裝 pickle。數字越大版本代表你需" -"要使用越新的 Python 版本來拆封相應的 pickle 封裝。" - -#: ../../library/pickle.rst:143 -msgid "" -"Protocol version 0 is the original \"human-readable\" protocol and is " -"backwards compatible with earlier versions of Python." -msgstr "" -"版本 0 的協定是最初「人類可讀」的版本,且可以向前支援早期版本的 Python。" - -#: ../../library/pickle.rst:146 -msgid "" -"Protocol version 1 is an old binary format which is also compatible with " -"earlier versions of Python." -msgstr "版本 1 的協定使用舊的二進位格式,一樣能向前支援早期版本的 Python。" - -#: ../../library/pickle.rst:149 -msgid "" -"Protocol version 2 was introduced in Python 2.3. It provides much more " -"efficient pickling of :term:`new-style classes `. Refer " -"to :pep:`307` for information about improvements brought by protocol 2." -msgstr "" -"版本 2 的協定在 Python 2.3 中初次被引入。其可提供更高效率的 :term:`new-style " -"classes ` 封裝過程。請參閱 :pep:`307` 以了解版本 2 帶來的改" -"進。" - -#: ../../library/pickle.rst:153 -msgid "" -"Protocol version 3 was added in Python 3.0. It has explicit support for :" -"class:`bytes` objects and cannot be unpickled by Python 2.x. This was the " -"default protocol in Python 3.0--3.7." -msgstr "" -"版本 3 的協定在 Python 3.0 被新增。現在能支援封裝 :class:`bytes` 的物件且無法" -"被 2.x 版本的 Python 拆封。在 3.0~3.7 的 Python 預設使用 3 版協定。" - -#: ../../library/pickle.rst:157 -msgid "" -"Protocol version 4 was added in Python 3.4. It adds support for very large " -"objects, pickling more kinds of objects, and some data format " -"optimizations. It is the default protocol starting with Python 3.8. Refer " -"to :pep:`3154` for information about improvements brought by protocol 4." -msgstr "" -"版本 4 的協定在 Python 3.4 被新增。現在能支援超大物件的封裝、更多種型別的物件" -"以及針對部份資料格式的儲存進行最佳化。從 Python 3.8 起,預設使用第 4 版協定。" -"請參閱 :pep:`3154` 以了解第 4 版協定改進的細節。" - -#: ../../library/pickle.rst:163 -msgid "" -"Protocol version 5 was added in Python 3.8. It adds support for out-of-band " -"data and speedup for in-band data. Refer to :pep:`574` for information " -"about improvements brought by protocol 5." -msgstr "" - -#: ../../library/pickle.rst:168 -msgid "" -"Serialization is a more primitive notion than persistence; although :mod:" -"`pickle` reads and writes file objects, it does not handle the issue of " -"naming persistent objects, nor the (even more complicated) issue of " -"concurrent access to persistent objects. The :mod:`pickle` module can " -"transform a complex object into a byte stream and it can transform the byte " -"stream into an object with the same internal structure. Perhaps the most " -"obvious thing to do with these byte streams is to write them onto a file, " -"but it is also conceivable to send them across a network or store them in a " -"database. The :mod:`shelve` module provides a simple interface to pickle " -"and unpickle objects on DBM-style database files." -msgstr "" -"資料序列化是一個比資料持久化更早期的概念;雖然 :mod:`pickle` 可以讀寫檔案物" -"件,但它並不處理命名持久物件的問題,也不處理對持久物件並行存取,一個更棘手的" -"問題。:mod:`pickle` 模組可以將複雜物件轉換成位元組串流,也可以將位元組串流轉" -"換回具有相同原始內部結構的物件。對這些位元組串流最明顯的處理方式大概是將它們" -"寫入檔案中,但也可能將它們透過網路傳送或儲存在一個資料庫中。:mod:`shelve` 模" -"組提供了一個簡單的介面來在 DBM 風格的資料庫檔案中進行物件的封裝和拆封的操作。" - -#: ../../library/pickle.rst:181 -msgid "Module Interface" -msgstr "模組介面" - -#: ../../library/pickle.rst:183 -msgid "" -"To serialize an object hierarchy, you simply call the :func:`dumps` " -"function. Similarly, to de-serialize a data stream, you call the :func:" -"`loads` function. However, if you want more control over serialization and " -"de-serialization, you can create a :class:`Pickler` or an :class:`Unpickler` " -"object, respectively." -msgstr "" -"想要序列化一個物件,你只需要呼叫 :func:`dumps` 函數。而當你想要去序列化一個資" -"料流時,你只需要呼叫 :func:`loads` 即可。不過,若你希望能各自對序列化和去序列" -"化的過程中有更多的掌控度,你可以自訂一個 :class:`Pickler` 或 :class:" -"`Unpickler` 物件。" - -#: ../../library/pickle.rst:188 -msgid "The :mod:`pickle` module provides the following constants:" -msgstr ":mod:`pickle` 模組提供以下常數:" - -#: ../../library/pickle.rst:193 -msgid "" -"An integer, the highest :ref:`protocol version ` " -"available. This value can be passed as a *protocol* value to functions :" -"func:`dump` and :func:`dumps` as well as the :class:`Pickler` constructor." -msgstr "" - -#: ../../library/pickle.rst:200 -msgid "" -"An integer, the default :ref:`protocol version ` used for " -"pickling. May be less than :data:`HIGHEST_PROTOCOL`. Currently the default " -"protocol is 4, first introduced in Python 3.4 and incompatible with previous " -"versions." -msgstr "" - -#: ../../library/pickle.rst:207 -msgid "The default protocol is 3." -msgstr "預設協定為 3。" - -#: ../../library/pickle.rst:211 -msgid "The default protocol is 4." -msgstr "預設協定為 4。" - -#: ../../library/pickle.rst:213 -msgid "" -"The :mod:`pickle` module provides the following functions to make the " -"pickling process more convenient:" -msgstr "" - -#: ../../library/pickle.rst:218 -msgid "" -"Write the pickled representation of the object *obj* to the open :term:`file " -"object` *file*. This is equivalent to ``Pickler(file, protocol).dump(obj)``." -msgstr "" - -#: ../../library/pickle.rst:222 -msgid "" -"Arguments *file*, *protocol*, *fix_imports* and *buffer_callback* have the " -"same meaning as in the :class:`Pickler` constructor." -msgstr "" - -#: ../../library/pickle.rst:225 ../../library/pickle.rst:236 -#: ../../library/pickle.rst:328 -msgid "The *buffer_callback* argument was added." -msgstr "新增 *buffer_callback* 引數。" - -#: ../../library/pickle.rst:230 -msgid "" -"Return the pickled representation of the object *obj* as a :class:`bytes` " -"object, instead of writing it to a file." -msgstr "" - -#: ../../library/pickle.rst:233 -msgid "" -"Arguments *protocol*, *fix_imports* and *buffer_callback* have the same " -"meaning as in the :class:`Pickler` constructor." -msgstr "" - -#: ../../library/pickle.rst:241 -msgid "" -"Read the pickled representation of an object from the open :term:`file " -"object` *file* and return the reconstituted object hierarchy specified " -"therein. This is equivalent to ``Unpickler(file).load()``." -msgstr "" - -#: ../../library/pickle.rst:245 ../../library/pickle.rst:260 -msgid "" -"The protocol version of the pickle is detected automatically, so no protocol " -"argument is needed. Bytes past the pickled representation of the object are " -"ignored." -msgstr "" - -#: ../../library/pickle.rst:249 -msgid "" -"Arguments *file*, *fix_imports*, *encoding*, *errors*, *strict* and " -"*buffers* have the same meaning as in the :class:`Unpickler` constructor." -msgstr "" - -#: ../../library/pickle.rst:252 ../../library/pickle.rst:267 -#: ../../library/pickle.rst:429 -msgid "The *buffers* argument was added." -msgstr "新增 *buffer* 引數。" - -#: ../../library/pickle.rst:257 -msgid "" -"Return the reconstituted object hierarchy of the pickled representation " -"*data* of an object. *data* must be a :term:`bytes-like object`." -msgstr "" - -#: ../../library/pickle.rst:264 -msgid "" -"Arguments *fix_imports*, *encoding*, *errors*, *strict* and *buffers* have " -"the same meaning as in the :class:`Unpickler` constructor." -msgstr "" - -#: ../../library/pickle.rst:271 -msgid "The :mod:`pickle` module defines three exceptions:" -msgstr "" - -#: ../../library/pickle.rst:275 -msgid "" -"Common base class for the other pickling exceptions. It inherits from :exc:" -"`Exception`." -msgstr "" - -#: ../../library/pickle.rst:280 -msgid "" -"Error raised when an unpicklable object is encountered by :class:`Pickler`. " -"It inherits from :exc:`PickleError`." -msgstr "" - -#: ../../library/pickle.rst:283 -msgid "" -"Refer to :ref:`pickle-picklable` to learn what kinds of objects can be " -"pickled." -msgstr "" - -#: ../../library/pickle.rst:288 -msgid "" -"Error raised when there is a problem unpickling an object, such as a data " -"corruption or a security violation. It inherits from :exc:`PickleError`." -msgstr "" - -#: ../../library/pickle.rst:291 -msgid "" -"Note that other exceptions may also be raised during unpickling, including " -"(but not necessarily limited to) AttributeError, EOFError, ImportError, and " -"IndexError." -msgstr "" - -#: ../../library/pickle.rst:296 -msgid "" -"The :mod:`pickle` module exports three classes, :class:`Pickler`, :class:" -"`Unpickler` and :class:`PickleBuffer`:" -msgstr "" - -#: ../../library/pickle.rst:301 -msgid "This takes a binary file for writing a pickle data stream." -msgstr "" - -#: ../../library/pickle.rst:303 -msgid "" -"The optional *protocol* argument, an integer, tells the pickler to use the " -"given protocol; supported protocols are 0 to :data:`HIGHEST_PROTOCOL`. If " -"not specified, the default is :data:`DEFAULT_PROTOCOL`. If a negative " -"number is specified, :data:`HIGHEST_PROTOCOL` is selected." -msgstr "" - -#: ../../library/pickle.rst:308 -msgid "" -"The *file* argument must have a write() method that accepts a single bytes " -"argument. It can thus be an on-disk file opened for binary writing, an :" -"class:`io.BytesIO` instance, or any other custom object that meets this " -"interface." -msgstr "" - -#: ../../library/pickle.rst:313 -msgid "" -"If *fix_imports* is true and *protocol* is less than 3, pickle will try to " -"map the new Python 3 names to the old module names used in Python 2, so that " -"the pickle data stream is readable with Python 2." -msgstr "" - -#: ../../library/pickle.rst:317 -msgid "" -"If *buffer_callback* is ``None`` (the default), buffer views are serialized " -"into *file* as part of the pickle stream." -msgstr "" - -#: ../../library/pickle.rst:320 -msgid "" -"If *buffer_callback* is not ``None``, then it can be called any number of " -"times with a buffer view. If the callback returns a false value (such as " -"``None``), the given buffer is :ref:`out-of-band `; otherwise " -"the buffer is serialized in-band, i.e. inside the pickle stream." -msgstr "" - -#: ../../library/pickle.rst:325 -msgid "" -"It is an error if *buffer_callback* is not ``None`` and *protocol* is " -"``None`` or smaller than 5." -msgstr "" - -#: ../../library/pickle.rst:333 -msgid "" -"Write the pickled representation of *obj* to the open file object given in " -"the constructor." -msgstr "" - -#: ../../library/pickle.rst:338 -msgid "Do nothing by default. This exists so a subclass can override it." -msgstr "" - -#: ../../library/pickle.rst:340 -msgid "" -"If :meth:`persistent_id` returns ``None``, *obj* is pickled as usual. Any " -"other value causes :class:`Pickler` to emit the returned value as a " -"persistent ID for *obj*. The meaning of this persistent ID should be " -"defined by :meth:`Unpickler.persistent_load`. Note that the value returned " -"by :meth:`persistent_id` cannot itself have a persistent ID." -msgstr "" - -#: ../../library/pickle.rst:346 ../../library/pickle.rst:447 -msgid "See :ref:`pickle-persistent` for details and examples of uses." -msgstr "關於細節與用法範例請見 :ref:`pickle-persistent`。" - -#: ../../library/pickle.rst:350 -msgid "" -"A pickler object's dispatch table is a registry of *reduction functions* of " -"the kind which can be declared using :func:`copyreg.pickle`. It is a " -"mapping whose keys are classes and whose values are reduction functions. A " -"reduction function takes a single argument of the associated class and " -"should conform to the same interface as a :meth:`~object.__reduce__` method." -msgstr "" - -#: ../../library/pickle.rst:358 -msgid "" -"By default, a pickler object will not have a :attr:`dispatch_table` " -"attribute, and it will instead use the global dispatch table managed by the :" -"mod:`copyreg` module. However, to customize the pickling for a specific " -"pickler object one can set the :attr:`dispatch_table` attribute to a dict-" -"like object. Alternatively, if a subclass of :class:`Pickler` has a :attr:" -"`dispatch_table` attribute then this will be used as the default dispatch " -"table for instances of that class." -msgstr "" - -#: ../../library/pickle.rst:367 -msgid "See :ref:`pickle-dispatch` for usage examples." -msgstr "關於用法範例請見 :ref:`pickle-dispatch`。" - -#: ../../library/pickle.rst:373 -msgid "" -"Special reducer that can be defined in :class:`Pickler` subclasses. This " -"method has priority over any reducer in the :attr:`dispatch_table`. It " -"should conform to the same interface as a :meth:`~object.__reduce__` method, " -"and can optionally return :data:`NotImplemented` to fallback on :attr:" -"`dispatch_table`-registered reducers to pickle ``obj``." -msgstr "" - -#: ../../library/pickle.rst:379 -msgid "For a detailed example, see :ref:`reducer_override`." -msgstr "" - -#: ../../library/pickle.rst:385 -msgid "" -"Deprecated. Enable fast mode if set to a true value. The fast mode disables " -"the usage of memo, therefore speeding the pickling process by not generating " -"superfluous PUT opcodes. It should not be used with self-referential " -"objects, doing otherwise will cause :class:`Pickler` to recurse infinitely." -msgstr "" - -#: ../../library/pickle.rst:391 -msgid "Use :func:`pickletools.optimize` if you need more compact pickles." -msgstr "" - -#: ../../library/pickle.rst:396 -msgid "This takes a binary file for reading a pickle data stream." -msgstr "" - -#: ../../library/pickle.rst:398 -msgid "" -"The protocol version of the pickle is detected automatically, so no protocol " -"argument is needed." -msgstr "" - -#: ../../library/pickle.rst:401 -msgid "" -"The argument *file* must have three methods, a read() method that takes an " -"integer argument, a readinto() method that takes a buffer argument and a " -"readline() method that requires no arguments, as in the :class:`io." -"BufferedIOBase` interface. Thus *file* can be an on-disk file opened for " -"binary reading, an :class:`io.BytesIO` object, or any other custom object " -"that meets this interface." -msgstr "" - -#: ../../library/pickle.rst:408 -msgid "" -"The optional arguments *fix_imports*, *encoding* and *errors* are used to " -"control compatibility support for pickle stream generated by Python 2. If " -"*fix_imports* is true, pickle will try to map the old Python 2 names to the " -"new names used in Python 3. The *encoding* and *errors* tell pickle how to " -"decode 8-bit string instances pickled by Python 2; these default to 'ASCII' " -"and 'strict', respectively. The *encoding* can be 'bytes' to read these 8-" -"bit string instances as bytes objects. Using ``encoding='latin1'`` is " -"required for unpickling NumPy arrays and instances of :class:`~datetime." -"datetime`, :class:`~datetime.date` and :class:`~datetime.time` pickled by " -"Python 2." -msgstr "" - -#: ../../library/pickle.rst:419 -msgid "" -"If *buffers* is ``None`` (the default), then all data necessary for " -"deserialization must be contained in the pickle stream. This means that the " -"*buffer_callback* argument was ``None`` when a :class:`Pickler` was " -"instantiated (or when :func:`dump` or :func:`dumps` was called)." -msgstr "" - -#: ../../library/pickle.rst:424 -msgid "" -"If *buffers* is not ``None``, it should be an iterable of buffer-enabled " -"objects that is consumed each time the pickle stream references an :ref:`out-" -"of-band ` buffer view. Such buffers have been given in order to " -"the *buffer_callback* of a Pickler object." -msgstr "" - -#: ../../library/pickle.rst:434 -msgid "" -"Read the pickled representation of an object from the open file object given " -"in the constructor, and return the reconstituted object hierarchy specified " -"therein. Bytes past the pickled representation of the object are ignored." -msgstr "" - -#: ../../library/pickle.rst:441 -msgid "Raise an :exc:`UnpicklingError` by default." -msgstr "" - -#: ../../library/pickle.rst:443 -msgid "" -"If defined, :meth:`persistent_load` should return the object specified by " -"the persistent ID *pid*. If an invalid persistent ID is encountered, an :" -"exc:`UnpicklingError` should be raised." -msgstr "" - -#: ../../library/pickle.rst:451 -msgid "" -"Import *module* if necessary and return the object called *name* from it, " -"where the *module* and *name* arguments are :class:`str` objects. Note, " -"unlike its name suggests, :meth:`find_class` is also used for finding " -"functions." -msgstr "" - -#: ../../library/pickle.rst:456 -msgid "" -"Subclasses may override this to gain control over what type of objects and " -"how they can be loaded, potentially reducing security risks. Refer to :ref:" -"`pickle-restrict` for details." -msgstr "" - -#: ../../library/pickle.rst:460 -msgid "" -"Raises an :ref:`auditing event ` ``pickle.find_class`` with " -"arguments ``module``, ``name``." -msgstr "" -"引發一個附帶引數 ``module``、``name`` 的\\ :ref:`稽核事件 ` " -"``pickle.find_class``。" - -#: ../../library/pickle.rst:464 -msgid "" -"A wrapper for a buffer representing picklable data. *buffer* must be a :ref:" -"`buffer-providing ` object, such as a :term:`bytes-like " -"object` or a N-dimensional array." -msgstr "" - -#: ../../library/pickle.rst:468 -msgid "" -":class:`PickleBuffer` is itself a buffer provider, therefore it is possible " -"to pass it to other APIs expecting a buffer-providing object, such as :class:" -"`memoryview`." -msgstr "" - -#: ../../library/pickle.rst:472 -msgid "" -":class:`PickleBuffer` objects can only be serialized using pickle protocol 5 " -"or higher. They are eligible for :ref:`out-of-band serialization `." -msgstr "" - -#: ../../library/pickle.rst:480 -msgid "" -"Return a :class:`memoryview` of the memory area underlying this buffer. The " -"returned object is a one-dimensional, C-contiguous memoryview with format " -"``B`` (unsigned bytes). :exc:`BufferError` is raised if the buffer is " -"neither C- nor Fortran-contiguous." -msgstr "" - -#: ../../library/pickle.rst:487 -msgid "Release the underlying buffer exposed by the PickleBuffer object." -msgstr "" - -#: ../../library/pickle.rst:493 -msgid "What can be pickled and unpickled?" -msgstr "" - -#: ../../library/pickle.rst:495 -msgid "The following types can be pickled:" -msgstr "" - -#: ../../library/pickle.rst:497 -msgid "" -"built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, and :data:" -"`NotImplemented`);" -msgstr "" - -#: ../../library/pickle.rst:500 -msgid "integers, floating-point numbers, complex numbers;" -msgstr "" - -#: ../../library/pickle.rst:502 -msgid "strings, bytes, bytearrays;" -msgstr "" - -#: ../../library/pickle.rst:504 -msgid "" -"tuples, lists, sets, and dictionaries containing only picklable objects;" -msgstr "" - -#: ../../library/pickle.rst:506 -msgid "" -"functions (built-in and user-defined) accessible from the top level of a " -"module (using :keyword:`def`, not :keyword:`lambda`);" -msgstr "" - -#: ../../library/pickle.rst:509 -msgid "classes accessible from the top level of a module;" -msgstr "" - -#: ../../library/pickle.rst:511 -msgid "" -"instances of such classes whose the result of calling :meth:`~object." -"__getstate__` is picklable (see section :ref:`pickle-inst` for details)." -msgstr "" - -#: ../../library/pickle.rst:514 -msgid "" -"Attempts to pickle unpicklable objects will raise the :exc:`PicklingError` " -"exception; when this happens, an unspecified number of bytes may have " -"already been written to the underlying file. Trying to pickle a highly " -"recursive data structure may exceed the maximum recursion depth, a :exc:" -"`RecursionError` will be raised in this case. You can carefully raise this " -"limit with :func:`sys.setrecursionlimit`." -msgstr "" - -#: ../../library/pickle.rst:521 -msgid "" -"Note that functions (built-in and user-defined) are pickled by fully :term:" -"`qualified name`, not by value. [#]_ This means that only the function name " -"is pickled, along with the name of the containing module and classes. " -"Neither the function's code, nor any of its function attributes are " -"pickled. Thus the defining module must be importable in the unpickling " -"environment, and the module must contain the named object, otherwise an " -"exception will be raised. [#]_" -msgstr "" - -#: ../../library/pickle.rst:528 -msgid "" -"Similarly, classes are pickled by fully qualified name, so the same " -"restrictions in the unpickling environment apply. Note that none of the " -"class's code or data is pickled, so in the following example the class " -"attribute ``attr`` is not restored in the unpickling environment::" -msgstr "" - -#: ../../library/pickle.rst:538 -msgid "" -"These restrictions are why picklable functions and classes must be defined " -"at the top level of a module." -msgstr "" - -#: ../../library/pickle.rst:541 -msgid "" -"Similarly, when class instances are pickled, their class's code and data are " -"not pickled along with them. Only the instance data are pickled. This is " -"done on purpose, so you can fix bugs in a class or add methods to the class " -"and still load objects that were created with an earlier version of the " -"class. If you plan to have long-lived objects that will see many versions " -"of a class, it may be worthwhile to put a version number in the objects so " -"that suitable conversions can be made by the class's :meth:`~object." -"__setstate__` method." -msgstr "" - -#: ../../library/pickle.rst:553 -msgid "Pickling Class Instances" -msgstr "" - -#: ../../library/pickle.rst:557 -msgid "" -"In this section, we describe the general mechanisms available to you to " -"define, customize, and control how class instances are pickled and unpickled." -msgstr "" - -#: ../../library/pickle.rst:560 -msgid "" -"In most cases, no additional code is needed to make instances picklable. By " -"default, pickle will retrieve the class and the attributes of an instance " -"via introspection. When a class instance is unpickled, its :meth:`~object." -"__init__` method is usually *not* invoked. The default behaviour first " -"creates an uninitialized instance and then restores the saved attributes. " -"The following code shows an implementation of this behaviour::" -msgstr "" - -#: ../../library/pickle.rst:575 -msgid "" -"Classes can alter the default behaviour by providing one or several special " -"methods:" -msgstr "" - -#: ../../library/pickle.rst:580 -msgid "" -"In protocols 2 and newer, classes that implements the :meth:" -"`__getnewargs_ex__` method can dictate the values passed to the :meth:" -"`__new__` method upon unpickling. The method must return a pair ``(args, " -"kwargs)`` where *args* is a tuple of positional arguments and *kwargs* a " -"dictionary of named arguments for constructing the object. Those will be " -"passed to the :meth:`__new__` method upon unpickling." -msgstr "" - -#: ../../library/pickle.rst:588 -msgid "" -"You should implement this method if the :meth:`__new__` method of your class " -"requires keyword-only arguments. Otherwise, it is recommended for " -"compatibility to implement :meth:`__getnewargs__`." -msgstr "" - -#: ../../library/pickle.rst:592 -msgid ":meth:`__getnewargs_ex__` is now used in protocols 2 and 3." -msgstr "" - -#: ../../library/pickle.rst:598 -msgid "" -"This method serves a similar purpose as :meth:`__getnewargs_ex__`, but " -"supports only positional arguments. It must return a tuple of arguments " -"``args`` which will be passed to the :meth:`__new__` method upon unpickling." -msgstr "" - -#: ../../library/pickle.rst:602 -msgid "" -":meth:`__getnewargs__` will not be called if :meth:`__getnewargs_ex__` is " -"defined." -msgstr "" - -#: ../../library/pickle.rst:605 -msgid "" -"Before Python 3.6, :meth:`__getnewargs__` was called instead of :meth:" -"`__getnewargs_ex__` in protocols 2 and 3." -msgstr "" - -#: ../../library/pickle.rst:612 -msgid "" -"Classes can further influence how their instances are pickled by overriding " -"the method :meth:`__getstate__`. It is called and the returned object is " -"pickled as the contents for the instance, instead of a default state. There " -"are several cases:" -msgstr "" - -#: ../../library/pickle.rst:617 -msgid "" -"For a class that has no instance :attr:`~object.__dict__` and no :attr:" -"`~object.__slots__`, the default state is ``None``." -msgstr "" - -#: ../../library/pickle.rst:620 -msgid "" -"For a class that has an instance :attr:`~object.__dict__` and no :attr:" -"`~object.__slots__`, the default state is ``self.__dict__``." -msgstr "" - -#: ../../library/pickle.rst:623 -msgid "" -"For a class that has an instance :attr:`~object.__dict__` and :attr:`~object." -"__slots__`, the default state is a tuple consisting of two dictionaries: " -"``self.__dict__``, and a dictionary mapping slot names to slot values. Only " -"slots that have a value are included in the latter." -msgstr "" - -#: ../../library/pickle.rst:629 -msgid "" -"For a class that has :attr:`~object.__slots__` and no instance :attr:" -"`~object.__dict__`, the default state is a tuple whose first item is " -"``None`` and whose second item is a dictionary mapping slot names to slot " -"values described in the previous bullet." -msgstr "" - -#: ../../library/pickle.rst:634 -msgid "" -"Added the default implementation of the ``__getstate__()`` method in the :" -"class:`object` class." -msgstr "" - -#: ../../library/pickle.rst:641 -msgid "" -"Upon unpickling, if the class defines :meth:`__setstate__`, it is called " -"with the unpickled state. In that case, there is no requirement for the " -"state object to be a dictionary. Otherwise, the pickled state must be a " -"dictionary and its items are assigned to the new instance's dictionary." -msgstr "" - -#: ../../library/pickle.rst:648 -msgid "" -"If :meth:`__reduce__` returns a state with value ``None`` at pickling, the :" -"meth:`__setstate__` method will not be called upon unpickling." -msgstr "" - -#: ../../library/pickle.rst:652 -msgid "" -"Refer to the section :ref:`pickle-state` for more information about how to " -"use the methods :meth:`~object.__getstate__` and :meth:`~object." -"__setstate__`." -msgstr "" - -#: ../../library/pickle.rst:657 -msgid "" -"At unpickling time, some methods like :meth:`~object.__getattr__`, :meth:" -"`~object.__getattribute__`, or :meth:`~object.__setattr__` may be called " -"upon the instance. In case those methods rely on some internal invariant " -"being true, the type should implement :meth:`~object.__new__` to establish " -"such an invariant, as :meth:`~object.__init__` is not called when unpickling " -"an instance." -msgstr "" - -#: ../../library/pickle.rst:666 -msgid "" -"As we shall see, pickle does not use directly the methods described above. " -"In fact, these methods are part of the copy protocol which implements the :" -"meth:`~object.__reduce__` special method. The copy protocol provides a " -"unified interface for retrieving the data necessary for pickling and copying " -"objects. [#]_" -msgstr "" - -#: ../../library/pickle.rst:672 -msgid "" -"Although powerful, implementing :meth:`~object.__reduce__` directly in your " -"classes is error prone. For this reason, class designers should use the " -"high-level interface (i.e., :meth:`~object.__getnewargs_ex__`, :meth:" -"`~object.__getstate__` and :meth:`~object.__setstate__`) whenever possible. " -"We will show, however, cases where using :meth:`!__reduce__` is the only " -"option or leads to more efficient pickling or both." -msgstr "" - -#: ../../library/pickle.rst:681 -msgid "" -"The interface is currently defined as follows. The :meth:`__reduce__` " -"method takes no argument and shall return either a string or preferably a " -"tuple (the returned object is often referred to as the \"reduce value\")." -msgstr "" - -#: ../../library/pickle.rst:685 -msgid "" -"If a string is returned, the string should be interpreted as the name of a " -"global variable. It should be the object's local name relative to its " -"module; the pickle module searches the module namespace to determine the " -"object's module. This behaviour is typically useful for singletons." -msgstr "" - -#: ../../library/pickle.rst:690 -msgid "" -"When a tuple is returned, it must be between two and six items long. " -"Optional items can either be omitted, or ``None`` can be provided as their " -"value. The semantics of each item are in order:" -msgstr "" - -#: ../../library/pickle.rst:696 -msgid "" -"A callable object that will be called to create the initial version of the " -"object." -msgstr "" - -#: ../../library/pickle.rst:699 -msgid "" -"A tuple of arguments for the callable object. An empty tuple must be given " -"if the callable does not accept any argument." -msgstr "" - -#: ../../library/pickle.rst:702 -msgid "" -"Optionally, the object's state, which will be passed to the object's :meth:" -"`__setstate__` method as previously described. If the object has no such " -"method then, the value must be a dictionary and it will be added to the " -"object's :attr:`~object.__dict__` attribute." -msgstr "" - -#: ../../library/pickle.rst:707 -msgid "" -"Optionally, an iterator (and not a sequence) yielding successive items. " -"These items will be appended to the object either using ``obj.append(item)`` " -"or, in batch, using ``obj.extend(list_of_items)``. This is primarily used " -"for list subclasses, but may be used by other classes as long as they have :" -"ref:`append and extend methods ` with the appropriate " -"signature. (Whether :meth:`!append` or :meth:`!extend` is used depends on " -"which pickle protocol version is used as well as the number of items to " -"append, so both must be supported.)" -msgstr "" - -#: ../../library/pickle.rst:717 -msgid "" -"Optionally, an iterator (not a sequence) yielding successive key-value " -"pairs. These items will be stored to the object using ``obj[key] = " -"value``. This is primarily used for dictionary subclasses, but may be used " -"by other classes as long as they implement :meth:`__setitem__`." -msgstr "" - -#: ../../library/pickle.rst:722 -msgid "" -"Optionally, a callable with a ``(obj, state)`` signature. This callable " -"allows the user to programmatically control the state-updating behavior of a " -"specific object, instead of using ``obj``'s static :meth:`__setstate__` " -"method. If not ``None``, this callable will have priority over ``obj``'s :" -"meth:`__setstate__`." -msgstr "" - -#: ../../library/pickle.rst:728 -msgid "The optional sixth tuple item, ``(obj, state)``, was added." -msgstr "" - -#: ../../library/pickle.rst:734 -msgid "" -"Alternatively, a :meth:`__reduce_ex__` method may be defined. The only " -"difference is this method should take a single integer argument, the " -"protocol version. When defined, pickle will prefer it over the :meth:" -"`__reduce__` method. In addition, :meth:`__reduce__` automatically becomes " -"a synonym for the extended version. The main use for this method is to " -"provide backwards-compatible reduce values for older Python releases." -msgstr "" - -#: ../../library/pickle.rst:746 -msgid "Persistence of External Objects" -msgstr "" - -#: ../../library/pickle.rst:752 -msgid "" -"For the benefit of object persistence, the :mod:`pickle` module supports the " -"notion of a reference to an object outside the pickled data stream. Such " -"objects are referenced by a persistent ID, which should be either a string " -"of alphanumeric characters (for protocol 0) [#]_ or just an arbitrary object " -"(for any newer protocol)." -msgstr "" - -#: ../../library/pickle.rst:758 -msgid "" -"The resolution of such persistent IDs is not defined by the :mod:`pickle` " -"module; it will delegate this resolution to the user-defined methods on the " -"pickler and unpickler, :meth:`~Pickler.persistent_id` and :meth:`~Unpickler." -"persistent_load` respectively." -msgstr "" - -#: ../../library/pickle.rst:763 -msgid "" -"To pickle objects that have an external persistent ID, the pickler must have " -"a custom :meth:`~Pickler.persistent_id` method that takes an object as an " -"argument and returns either ``None`` or the persistent ID for that object. " -"When ``None`` is returned, the pickler simply pickles the object as normal. " -"When a persistent ID string is returned, the pickler will pickle that " -"object, along with a marker so that the unpickler will recognize it as a " -"persistent ID." -msgstr "" - -#: ../../library/pickle.rst:770 -msgid "" -"To unpickle external objects, the unpickler must have a custom :meth:" -"`~Unpickler.persistent_load` method that takes a persistent ID object and " -"returns the referenced object." -msgstr "" - -#: ../../library/pickle.rst:774 -msgid "" -"Here is a comprehensive example presenting how persistent ID can be used to " -"pickle external objects by reference." -msgstr "" - -#: ../../library/pickle.rst:782 -msgid "Dispatch Tables" -msgstr "" - -#: ../../library/pickle.rst:784 -msgid "" -"If one wants to customize pickling of some classes without disturbing any " -"other code which depends on pickling, then one can create a pickler with a " -"private dispatch table." -msgstr "" - -#: ../../library/pickle.rst:788 -msgid "" -"The global dispatch table managed by the :mod:`copyreg` module is available " -"as :data:`!copyreg.dispatch_table`. Therefore, one may choose to use a " -"modified copy of :data:`!copyreg.dispatch_table` as a private dispatch table." -msgstr "" - -#: ../../library/pickle.rst:793 -msgid "For example ::" -msgstr "舉例來說: ::" - -#: ../../library/pickle.rst:800 -msgid "" -"creates an instance of :class:`pickle.Pickler` with a private dispatch table " -"which handles the ``SomeClass`` class specially. Alternatively, the code ::" -msgstr "" - -#: ../../library/pickle.rst:810 -msgid "" -"does the same but all instances of ``MyPickler`` will by default share the " -"private dispatch table. On the other hand, the code ::" -msgstr "" - -#: ../../library/pickle.rst:817 -msgid "" -"modifies the global dispatch table shared by all users of the :mod:`copyreg` " -"module." -msgstr "" - -#: ../../library/pickle.rst:822 -msgid "Handling Stateful Objects" -msgstr "" - -#: ../../library/pickle.rst:828 -msgid "" -"Here's an example that shows how to modify pickling behavior for a class. " -"The :class:`!TextReader` class below opens a text file, and returns the line " -"number and line contents each time its :meth:`!readline` method is called. " -"If a :class:`!TextReader` instance is pickled, all attributes *except* the " -"file object member are saved. When the instance is unpickled, the file is " -"reopened, and reading resumes from the last location. The :meth:`!" -"__setstate__` and :meth:`!__getstate__` methods are used to implement this " -"behavior. ::" -msgstr "" - -#: ../../library/pickle.rst:874 -msgid "A sample usage might be something like this::" -msgstr "" - -#: ../../library/pickle.rst:888 -msgid "Custom Reduction for Types, Functions, and Other Objects" -msgstr "" - -#: ../../library/pickle.rst:892 -msgid "" -"Sometimes, :attr:`~Pickler.dispatch_table` may not be flexible enough. In " -"particular we may want to customize pickling based on another criterion than " -"the object's type, or we may want to customize the pickling of functions and " -"classes." -msgstr "" - -#: ../../library/pickle.rst:897 -msgid "" -"For those cases, it is possible to subclass from the :class:`Pickler` class " -"and implement a :meth:`~Pickler.reducer_override` method. This method can " -"return an arbitrary reduction tuple (see :meth:`~object.__reduce__`). It can " -"alternatively return :data:`NotImplemented` to fallback to the traditional " -"behavior." -msgstr "" - -#: ../../library/pickle.rst:902 -msgid "" -"If both the :attr:`~Pickler.dispatch_table` and :meth:`~Pickler." -"reducer_override` are defined, then :meth:`~Pickler.reducer_override` method " -"takes priority." -msgstr "" - -#: ../../library/pickle.rst:907 -msgid "" -"For performance reasons, :meth:`~Pickler.reducer_override` may not be called " -"for the following objects: ``None``, ``True``, ``False``, and exact " -"instances of :class:`int`, :class:`float`, :class:`bytes`, :class:`str`, :" -"class:`dict`, :class:`set`, :class:`frozenset`, :class:`list` and :class:" -"`tuple`." -msgstr "" - -#: ../../library/pickle.rst:913 -msgid "" -"Here is a simple example where we allow pickling and reconstructing a given " -"class::" -msgstr "" - -#: ../../library/pickle.rst:948 -msgid "Out-of-band Buffers" -msgstr "" - -#: ../../library/pickle.rst:952 -msgid "" -"In some contexts, the :mod:`pickle` module is used to transfer massive " -"amounts of data. Therefore, it can be important to minimize the number of " -"memory copies, to preserve performance and resource consumption. However, " -"normal operation of the :mod:`pickle` module, as it transforms a graph-like " -"structure of objects into a sequential stream of bytes, intrinsically " -"involves copying data to and from the pickle stream." -msgstr "" - -#: ../../library/pickle.rst:959 -msgid "" -"This constraint can be eschewed if both the *provider* (the implementation " -"of the object types to be transferred) and the *consumer* (the " -"implementation of the communications system) support the out-of-band " -"transfer facilities provided by pickle protocol 5 and higher." -msgstr "" - -#: ../../library/pickle.rst:965 -msgid "Provider API" -msgstr "" - -#: ../../library/pickle.rst:967 -msgid "" -"The large data objects to be pickled must implement a :meth:`~object." -"__reduce_ex__` method specialized for protocol 5 and higher, which returns " -"a :class:`PickleBuffer` instance (instead of e.g. a :class:`bytes` object) " -"for any large data." -msgstr "" - -#: ../../library/pickle.rst:972 -msgid "" -"A :class:`PickleBuffer` object *signals* that the underlying buffer is " -"eligible for out-of-band data transfer. Those objects remain compatible " -"with normal usage of the :mod:`pickle` module. However, consumers can also " -"opt-in to tell :mod:`pickle` that they will handle those buffers by " -"themselves." -msgstr "" - -#: ../../library/pickle.rst:979 -msgid "Consumer API" -msgstr "" - -#: ../../library/pickle.rst:981 -msgid "" -"A communications system can enable custom handling of the :class:" -"`PickleBuffer` objects generated when serializing an object graph." -msgstr "" - -#: ../../library/pickle.rst:984 -msgid "" -"On the sending side, it needs to pass a *buffer_callback* argument to :class:" -"`Pickler` (or to the :func:`dump` or :func:`dumps` function), which will be " -"called with each :class:`PickleBuffer` generated while pickling the object " -"graph. Buffers accumulated by the *buffer_callback* will not see their data " -"copied into the pickle stream, only a cheap marker will be inserted." -msgstr "" - -#: ../../library/pickle.rst:991 -msgid "" -"On the receiving side, it needs to pass a *buffers* argument to :class:" -"`Unpickler` (or to the :func:`load` or :func:`loads` function), which is an " -"iterable of the buffers which were passed to *buffer_callback*. That " -"iterable should produce buffers in the same order as they were passed to " -"*buffer_callback*. Those buffers will provide the data expected by the " -"reconstructors of the objects whose pickling produced the original :class:" -"`PickleBuffer` objects." -msgstr "" - -#: ../../library/pickle.rst:999 -msgid "" -"Between the sending side and the receiving side, the communications system " -"is free to implement its own transfer mechanism for out-of-band buffers. " -"Potential optimizations include the use of shared memory or datatype-" -"dependent compression." -msgstr "" - -#: ../../library/pickle.rst:1005 -msgid "Example" -msgstr "範例" - -#: ../../library/pickle.rst:1007 -msgid "" -"Here is a trivial example where we implement a :class:`bytearray` subclass " -"able to participate in out-of-band buffer pickling::" -msgstr "" - -#: ../../library/pickle.rst:1031 -msgid "" -"The reconstructor (the ``_reconstruct`` class method) returns the buffer's " -"providing object if it has the right type. This is an easy way to simulate " -"zero-copy behaviour on this toy example." -msgstr "" - -#: ../../library/pickle.rst:1035 -msgid "" -"On the consumer side, we can pickle those objects the usual way, which when " -"unserialized will give us a copy of the original object::" -msgstr "" - -#: ../../library/pickle.rst:1044 -msgid "" -"But if we pass a *buffer_callback* and then give back the accumulated " -"buffers when unserializing, we are able to get back the original object::" -msgstr "" - -#: ../../library/pickle.rst:1054 -msgid "" -"This example is limited by the fact that :class:`bytearray` allocates its " -"own memory: you cannot create a :class:`bytearray` instance that is backed " -"by another object's memory. However, third-party datatypes such as NumPy " -"arrays do not have this limitation, and allow use of zero-copy pickling (or " -"making as few copies as possible) when transferring between distinct " -"processes or systems." -msgstr "" - -#: ../../library/pickle.rst:1061 -msgid ":pep:`574` -- Pickle protocol 5 with out-of-band data" -msgstr "" - -#: ../../library/pickle.rst:1067 -msgid "Restricting Globals" -msgstr "" - -#: ../../library/pickle.rst:1072 -msgid "" -"By default, unpickling will import any class or function that it finds in " -"the pickle data. For many applications, this behaviour is unacceptable as " -"it permits the unpickler to import and invoke arbitrary code. Just consider " -"what this hand-crafted pickle data stream does when loaded::" -msgstr "" - -#: ../../library/pickle.rst:1082 -msgid "" -"In this example, the unpickler imports the :func:`os.system` function and " -"then apply the string argument \"echo hello world\". Although this example " -"is inoffensive, it is not difficult to imagine one that could damage your " -"system." -msgstr "" - -#: ../../library/pickle.rst:1086 -msgid "" -"For this reason, you may want to control what gets unpickled by customizing :" -"meth:`Unpickler.find_class`. Unlike its name suggests, :meth:`Unpickler." -"find_class` is called whenever a global (i.e., a class or a function) is " -"requested. Thus it is possible to either completely forbid globals or " -"restrict them to a safe subset." -msgstr "" - -#: ../../library/pickle.rst:1092 -msgid "" -"Here is an example of an unpickler allowing only few safe classes from the :" -"mod:`builtins` module to be loaded::" -msgstr "" - -#: ../../library/pickle.rst:1121 -msgid "A sample usage of our unpickler working as intended::" -msgstr "" - -#: ../../library/pickle.rst:1140 -msgid "" -"As our examples shows, you have to be careful with what you allow to be " -"unpickled. Therefore if security is a concern, you may want to consider " -"alternatives such as the marshalling API in :mod:`xmlrpc.client` or third-" -"party solutions." -msgstr "" - -#: ../../library/pickle.rst:1147 -msgid "Performance" -msgstr "" - -#: ../../library/pickle.rst:1149 -msgid "" -"Recent versions of the pickle protocol (from protocol 2 and upwards) feature " -"efficient binary encodings for several common features and built-in types. " -"Also, the :mod:`pickle` module has a transparent optimizer written in C." -msgstr "" - -#: ../../library/pickle.rst:1157 -msgid "Examples" -msgstr "範例" - -#: ../../library/pickle.rst:1159 -msgid "" -"For the simplest code, use the :func:`dump` and :func:`load` functions. ::" -msgstr "" - -#: ../../library/pickle.rst:1175 -msgid "The following example reads the resulting pickled data. ::" -msgstr "" - -#: ../../library/pickle.rst:1191 -msgid "Module :mod:`copyreg`" -msgstr ":mod:`copyreg` 模組" - -#: ../../library/pickle.rst:1192 -msgid "Pickle interface constructor registration for extension types." -msgstr "" - -#: ../../library/pickle.rst:1194 -msgid "Module :mod:`pickletools`" -msgstr ":mod:`pickletools` 模組" - -#: ../../library/pickle.rst:1195 -msgid "Tools for working with and analyzing pickled data." -msgstr "" - -#: ../../library/pickle.rst:1197 -msgid "Module :mod:`shelve`" -msgstr ":mod:`shelve` 模組" - -#: ../../library/pickle.rst:1198 -msgid "Indexed databases of objects; uses :mod:`pickle`." -msgstr "" - -#: ../../library/pickle.rst:1200 -msgid "Module :mod:`copy`" -msgstr ":mod:`copy` 模組" - -#: ../../library/pickle.rst:1201 -msgid "Shallow and deep object copying." -msgstr "" - -#: ../../library/pickle.rst:1203 -msgid "Module :mod:`marshal`" -msgstr ":mod:`marshal` 模組" - -#: ../../library/pickle.rst:1204 -msgid "High-performance serialization of built-in types." -msgstr "" - -#: ../../library/pickle.rst:1208 -msgid "Footnotes" -msgstr "註解" - -#: ../../library/pickle.rst:1209 -msgid "Don't confuse this with the :mod:`marshal` module" -msgstr "" - -#: ../../library/pickle.rst:1211 -msgid "" -"This is why :keyword:`lambda` functions cannot be pickled: all :keyword:`!" -"lambda` functions share the same name: ````." -msgstr "" - -#: ../../library/pickle.rst:1214 -msgid "" -"The exception raised will likely be an :exc:`ImportError` or an :exc:" -"`AttributeError` but it could be something else." -msgstr "" - -#: ../../library/pickle.rst:1217 -msgid "" -"The :mod:`copy` module uses this protocol for shallow and deep copying " -"operations." -msgstr "" - -#: ../../library/pickle.rst:1220 -msgid "" -"The limitation on alphanumeric characters is due to the fact that persistent " -"IDs in protocol 0 are delimited by the newline character. Therefore if any " -"kind of newline characters occurs in persistent IDs, the resulting pickled " -"data will become unreadable." -msgstr "" - -#: ../../library/pickle.rst:12 -msgid "persistence" -msgstr "persistence(持續性)" - -#: ../../library/pickle.rst:12 -msgid "persistent" -msgstr "persistent(持續)" - -#: ../../library/pickle.rst:12 -msgid "objects" -msgstr "objects(物件)" - -#: ../../library/pickle.rst:12 -msgid "serializing" -msgstr "serializing(序列化)" - -#: ../../library/pickle.rst:12 -msgid "marshalling" -msgstr "marshalling" - -#: ../../library/pickle.rst:12 -msgid "flattening" -msgstr "flattening(攤平)" - -#: ../../library/pickle.rst:12 -msgid "pickling" -msgstr "pickling" - -#: ../../library/pickle.rst:123 -msgid "External Data Representation" -msgstr "External Data Representation(外部資料表示法)" - -#: ../../library/pickle.rst:664 -msgid "copy" -msgstr "copy(複製)" - -#: ../../library/pickle.rst:664 -msgid "protocol" -msgstr "protocol(協定)" - -#: ../../library/pickle.rst:748 -msgid "persistent_id (pickle protocol)" -msgstr "persistent_id(pickle 協定)" - -#: ../../library/pickle.rst:748 -msgid "persistent_load (pickle protocol)" -msgstr "persistent_load(pickle 協定)" - -#: ../../library/pickle.rst:824 -msgid "__getstate__() (copy protocol)" -msgstr "__getstate__()(copy 協定)" - -#: ../../library/pickle.rst:824 -msgid "__setstate__() (copy protocol)" -msgstr "__setstate__()(copy 協定)" - -#: ../../library/pickle.rst:1069 -msgid "find_class() (pickle protocol)" -msgstr "find_class()(pickle 協定)" +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +# Translators: +# Skylull, 2024 +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"PO-Revision-Date: 2018-05-23 16:07+0000\n" +"Last-Translator: Adrian Liaw \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: ../../library/pickle.rst:2 +msgid ":mod:`!pickle` --- Python object serialization" +msgstr ":mod:`!pickle` --- Python 物件序列化" + +#: ../../library/pickle.rst:10 +msgid "**Source code:** :source:`Lib/pickle.py`" +msgstr "**原始碼:**\\ :source:`Lib/pickle.py`" + +# Skylull: 我對 `pickle` 的命名原因進行了簡單的搜尋,只找到一則討論 +# https://stackoverflow.com/questions/27324986/pickles-why-are-they-called- +# that +# 其中表示這名字很可能只是為了隨便找一個p開頭的單字、或原始開發人員的內部玩笑造成的約定俗成。也有人表示醃製黃瓜(pickle- +# ing)的目標就是保存和存放,所以取了這個名字。 +# 無論如何似乎沒有一個定論。 +# 因為不確定是否與醃漬的這個梗有關,我暫時選擇使用 `封裝` 與 `拆封` 作為譯文,大致保存那個把東西處裡後裝起來的感覺但又不至於太奇怪。 +# 唯一需要擔心的是是否有與 `encapsulation` (封裝,網路協定名詞)或 `package`(封包,網路協定名詞)搞混的可能。 +#: ../../library/pickle.rst:22 +msgid "" +"The :mod:`pickle` module implements binary protocols for serializing and de-" +"serializing a Python object structure. *\"Pickling\"* is the process " +"whereby a Python object hierarchy is converted into a byte stream, and " +"*\"unpickling\"* is the inverse operation, whereby a byte stream (from a " +":term:`binary file` or :term:`bytes-like object`) is converted back into an " +"object hierarchy. Pickling (and unpickling) is alternatively known as " +"\"serialization\", \"marshalling,\" [#]_ or \"flattening\"; however, to " +"avoid confusion, the terms used here are \"pickling\" and \"unpickling\"." +msgstr "" +":mod:`pickle` 模組實作的是一個在二進位層級上對 Python 物件進行序列化(serialize)或去序列化(de-" +"serialize)。*\"Pickling\"* 用於專門指摘將一個 Python 物件轉換為一個二進位串流的過程,*\"unpickling\"* " +"則相反,指的是將一個(來自 :term:`binary file` 或 :term:`bytes-like object` 的)二進位串流轉換回 " +"Python 物件的過程。Pickling(和 unpickling)的過程也可能被稱作 \"serialization\", " +"\"marshalling,\" [#]_ 或 " +"\"flattening\"。不過,為了避免混淆,本文件將統一稱作封裝(pickling)、拆封(unpickling)。" + +#: ../../library/pickle.rst:33 +msgid "The ``pickle`` module **is not secure**. Only unpickle data you trust." +msgstr "``pickle`` 模組**並不安全**,切記只拆封你信任的資料。" + +#: ../../library/pickle.rst:35 +msgid "" +"It is possible to construct malicious pickle data which will **execute " +"arbitrary code during unpickling**. Never unpickle data that could have come" +" from an untrusted source, or that could have been tampered with." +msgstr "" +"pickle 封包是有可能被建立來在拆封的時候**執行任意惡意程式碼**的。絕對不要拆封任何你無法信任其來源、或可能被修改過的 pickle 封包。" + +#: ../../library/pickle.rst:39 +msgid "" +"Consider signing data with :mod:`hmac` if you need to ensure that it has not" +" been tampered with." +msgstr "建議你可以使用 :mod:`hmac` 模組來簽署這個封包,以確保其未被修改過。" + +#: ../../library/pickle.rst:42 +msgid "" +"Safer serialization formats such as :mod:`json` may be more appropriate if " +"you are processing untrusted data. See :ref:`comparison-with-json`." +msgstr "" +"如果你在處理不受信任的資料,其他比較安全的序列化格式(例如 :mod:`json`)可能會更適合。請參照 See :ref:`comparison-" +"with-json` 的說明。" + +#: ../../library/pickle.rst:47 +msgid "Relationship to other Python modules" +msgstr "和其他 Python 模組的關係" + +#: ../../library/pickle.rst:50 +msgid "Comparison with ``marshal``" +msgstr "和 ``marshal`` 的比較" + +#: ../../library/pickle.rst:52 +msgid "" +"Python has a more primitive serialization module called :mod:`marshal`, but " +"in general :mod:`pickle` should always be the preferred way to serialize " +"Python objects. :mod:`marshal` exists primarily to support Python's " +":file:`.pyc` files." +msgstr "" +"Python 有另一個比較原始的序列化模組叫 :mod:`marshal`,不過其設計目的是為了支援 Python 的預編譯功能 " +":file:`.pyc` 運作。總地來說,沒事不要用 :mod:`marshal`。" + +#: ../../library/pickle.rst:57 +msgid "" +"The :mod:`pickle` module differs from :mod:`marshal` in several significant " +"ways:" +msgstr ":mod:`pickle` 和 :mod:`marshal` 有幾個明顯不同的地方:" + +#: ../../library/pickle.rst:59 +msgid "" +"The :mod:`pickle` module keeps track of the objects it has already " +"serialized, so that later references to the same object won't be serialized " +"again. :mod:`marshal` doesn't do this." +msgstr "" +":mod:`pickle` 會記住哪些物件已經被序列化過了,稍後再次參照到這個物件的時候才不會進行重複的序列化。:mod:`marshal` " +"沒有這個功能。" + +#: ../../library/pickle.rst:63 +msgid "" +"This has implications both for recursive objects and object sharing. " +"Recursive objects are objects that contain references to themselves. These " +"are not handled by marshal, and in fact, attempting to marshal recursive " +"objects will crash your Python interpreter. Object sharing happens when " +"there are multiple references to the same object in different places in the " +"object hierarchy being serialized. :mod:`pickle` stores such objects only " +"once, and ensures that all other references point to the master copy. " +"Shared objects remain shared, which can be very important for mutable " +"objects." +msgstr "" +"這對遞迴物件和物件共用都有影響。遞迴物件是指包含自我參照的物件。這些情況在 marshal 模組中不會被處理,若嘗試使用 marshal " +"處理遞迴物件會導致 Python 直譯器崩潰。物件共用發生在序列化的物件階層中,不同位置對同一物件有多個參照時。:mod:`pickle` " +"只會儲存這個被參照的物件一次,並確保所有其他參照指向這個主要的版本。共用的物件會保持共用,這對於可變(mutable)物件來說非常重要。" + +#: ../../library/pickle.rst:72 +msgid "" +":mod:`marshal` cannot be used to serialize user-defined classes and their " +"instances. :mod:`pickle` can save and restore class instances " +"transparently, however the class definition must be importable and live in " +"the same module as when the object was stored." +msgstr "" +":mod:`marshal` 無法序列化使用者自訂的類別和的實例。:mod:`pickle` " +"則可以讓使用者儲存並還原自訂的類別實例,前提是儲存時該類別的定義存在於與要被儲存的物件所在的模組中、且可以被引入(import)。" + +#: ../../library/pickle.rst:77 +msgid "" +"The :mod:`marshal` serialization format is not guaranteed to be portable " +"across Python versions. Because its primary job in life is to support " +":file:`.pyc` files, the Python implementers reserve the right to change the " +"serialization format in non-backwards compatible ways should the need arise." +" The :mod:`pickle` serialization format is guaranteed to be backwards " +"compatible across Python releases provided a compatible pickle protocol is " +"chosen and pickling and unpickling code deals with Python 2 to Python 3 type" +" differences if your data is crossing that unique breaking change language " +"boundary." +msgstr "" +":mod:`marshal` 序列化格式無法保證能在不同版本的 Python 之間移植。因為其主要的作用是支援 :file:`.pyc` " +"檔案的運作,Python 的實作人員會在需要時實作無法前向相容的序列化方式。但只要選擇了相容的 pickle 協定,且處理了 Python 2 和 " +"Python 3 之間的資料類型差異,:mod:`pickle` 序列化協定能保證在不同 Python 版本間的相容性。" + +#: ../../library/pickle.rst:90 +msgid "Comparison with ``json``" +msgstr "和 ``json`` 的比較" + +#: ../../library/pickle.rst:92 +msgid "" +"There are fundamental differences between the pickle protocols and `JSON " +"(JavaScript Object Notation) `_:" +msgstr "" +"pickle 協定和 `JSON (JavaScript Object Notation) `_ " +"有一些根本上的不同:" + +#: ../../library/pickle.rst:95 +msgid "" +"JSON is a text serialization format (it outputs unicode text, although most " +"of the time it is then encoded to ``utf-8``), while pickle is a binary " +"serialization format;" +msgstr "" +"JSON 以文字形式作為序列化的輸出(輸出 unicode 文字,但大多數又會被編碼為 ``UTF-8``),而 pickle " +"則是以二進位形式作為序列化的輸出;" + +#: ../../library/pickle.rst:99 +msgid "JSON is human-readable, while pickle is not;" +msgstr "JSON 是人類可讀的,而 pickle 則無法;" + +#: ../../library/pickle.rst:101 +msgid "" +"JSON is interoperable and widely used outside of the Python ecosystem, while" +" pickle is Python-specific;" +msgstr "" +"JSON 具有高互通性(interoperability)且在 Python 以外的環境也被大量利用,但 pickle 只能在 Python 內使用。" + +# Skylull: introspection, introspection facilities +# https://zh.wikipedia.org/wiki/%E5%86%85%E7%9C%81_(%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%A7%91%E5%AD%A6) +# https://book.pythontips.com/en/latest/object_introspection.html +# https://www.geeksforgeeks.org/code-introspection-in-python/ +#: ../../library/pickle.rst:104 +msgid "" +"JSON, by default, can only represent a subset of the Python built-in types, " +"and no custom classes; pickle can represent an extremely large number of " +"Python types (many of them automatically, by clever usage of Python's " +"introspection facilities; complex cases can be tackled by implementing " +":ref:`specific object APIs `);" +msgstr "" +"預設狀態下的 JSON 只能紀錄一小部份的 Python 內建型別,且無法紀錄自訂類別;但透過 Python 的自省功能,pickle " +"可以紀錄絕大多數的 Python 型別(其他比較複雜的狀況也可以透過實作 :ref:`specific object APIs ` 來解決);" + +#: ../../library/pickle.rst:110 +msgid "" +"Unlike pickle, deserializing untrusted JSON does not in itself create an " +"arbitrary code execution vulnerability." +msgstr "去序列化不安全的 JSON 不會產生任意程式執行的風險,但去序列化不安全的 pickle 會。" + +#: ../../library/pickle.rst:114 +msgid "" +"The :mod:`json` module: a standard library module allowing JSON " +"serialization and deserialization." +msgstr ":mod:`json` module: 是標準函式庫的一部分,可讓使用者進行 JSON 的序列化與去序列化。" + +#: ../../library/pickle.rst:121 +msgid "Data stream format" +msgstr "資料串流格式" + +#: ../../library/pickle.rst:126 +msgid "" +"The data format used by :mod:`pickle` is Python-specific. This has the " +"advantage that there are no restrictions imposed by external standards such " +"as JSON or XDR (which can't represent pointer sharing); however it means " +"that non-Python programs may not be able to reconstruct pickled Python " +"objects." +msgstr "" +":mod:`pickle` 使用的資料格式是針對 Python 而設計的。好處是他不會受到外部標準(像是 JSON 或 XDR,而 XDR " +"無法紀錄指標共用)的限制;不過這也代表其他不是 Python 的程式可能無法重建 pickle 封裝的 Python 物件。" + +#: ../../library/pickle.rst:131 +msgid "" +"By default, the :mod:`pickle` data format uses a relatively compact binary " +"representation. If you need optimal size characteristics, you can " +"efficiently :doc:`compress ` pickled data." +msgstr "" +"以預設設定來說,:mod:`pickle` 使用相對緊湊的二進位形式來儲存資料。如果你需要盡可能地縮小檔案大小,你可以\\\\ :doc:`壓縮 " +"`\\\\ 封裝的資料。" + +#: ../../library/pickle.rst:135 +msgid "" +"The module :mod:`pickletools` contains tools for analyzing data streams " +"generated by :mod:`pickle`. :mod:`pickletools` source code has extensive " +"comments about opcodes used by pickle protocols." +msgstr "" +":mod:`pickletools` 含有工具可分析 :mod:`pickle` 所產生的資料流。:mod:`pickletools` " +"的源始碼詳細地記載了所有 pickle 協定的操作碼(opcode)。" + +#: ../../library/pickle.rst:139 +msgid "" +"There are currently 6 different protocols which can be used for pickling. " +"The higher the protocol used, the more recent the version of Python needed " +"to read the pickle produced." +msgstr "" +"截至目前為止,共有六種不同版本的協定可用於封裝 pickle。數字越大版本代表你需要使用越新的 Python 版本來拆封相應的 pickle 封裝。" + +#: ../../library/pickle.rst:143 +msgid "" +"Protocol version 0 is the original \"human-readable\" protocol and is " +"backwards compatible with earlier versions of Python." +msgstr "版本 0 的協定是最初「人類可讀」的版本,且可以向前支援早期版本的 Python。" + +#: ../../library/pickle.rst:146 +msgid "" +"Protocol version 1 is an old binary format which is also compatible with " +"earlier versions of Python." +msgstr "版本 1 的協定使用舊的二進位格式,一樣能向前支援早期版本的 Python。" + +#: ../../library/pickle.rst:149 +msgid "" +"Protocol version 2 was introduced in Python 2.3. It provides much more " +"efficient pickling of :term:`new-style classes `. Refer to" +" :pep:`307` for information about improvements brought by protocol 2." +msgstr "" +"版本 2 的協定在 Python 2.3 中初次被引入。其可提供更高效率的 :term:`new-style classes ` 封裝過程。請參閱 :pep:`307` 以了解版本 2 帶來的改進。" + +#: ../../library/pickle.rst:153 +msgid "" +"Protocol version 3 was added in Python 3.0. It has explicit support for " +":class:`bytes` objects and cannot be unpickled by Python 2.x. This was the " +"default protocol in Python 3.0--3.7." +msgstr "" +"版本 3 的協定在 Python 3.0 被新增。現在能支援封裝 :class:`bytes` 的物件且無法被 2.x 版本的 Python 拆封。在 " +"3.0~3.7 的 Python 預設使用 3 版協定。" + +#: ../../library/pickle.rst:157 +msgid "" +"Protocol version 4 was added in Python 3.4. It adds support for very large " +"objects, pickling more kinds of objects, and some data format optimizations." +" It is the default protocol starting with Python 3.8. Refer to :pep:`3154` " +"for information about improvements brought by protocol 4." +msgstr "" +"版本 4 的協定在 Python 3.4 被新增。現在能支援超大物件的封裝、更多種型別的物件以及針對部份資料格式的儲存進行最佳化。從 Python " +"3.8 起,預設使用第 4 版協定。請參閱 :pep:`3154` 以了解第 4 版協定改進的細節。" + +#: ../../library/pickle.rst:163 +msgid "" +"Protocol version 5 was added in Python 3.8. It adds support for out-of-band" +" data and speedup for in-band data. Refer to :pep:`574` for information " +"about improvements brought by protocol 5." +msgstr "" +"版本 5 的協定在 Python 3.8 被新增。現在能支援帶外資料(Out-of-band data)並加速帶內資料的處理速度。請參閱 " +":pep:`574` 以了解第 5 版協定改進的細節。" + +#: ../../library/pickle.rst:168 +msgid "" +"Serialization is a more primitive notion than persistence; although " +":mod:`pickle` reads and writes file objects, it does not handle the issue of" +" naming persistent objects, nor the (even more complicated) issue of " +"concurrent access to persistent objects. The :mod:`pickle` module can " +"transform a complex object into a byte stream and it can transform the byte " +"stream into an object with the same internal structure. Perhaps the most " +"obvious thing to do with these byte streams is to write them onto a file, " +"but it is also conceivable to send them across a network or store them in a " +"database. The :mod:`shelve` module provides a simple interface to pickle " +"and unpickle objects on DBM-style database files." +msgstr "" +"資料序列化是一個比資料持久化更早出現的概念;雖然 :mod:`pickle` " +"可以讀寫檔案物件,但它並不處理命名持久物件的問題,也不處理對持久物件的並行存取、一個更棘手的問題。:mod:`pickle` " +"模組可以將複雜物件轉換成位元組串流,也可以將位元組串流轉換回具有相同原始內部結構的物件。對這些位元組串流最常見的處理方式是將它們寫入檔案中,但也可以將它們透過網路傳送或儲存在一個資料庫中。:mod:`shelve`" +" 模組提供了一個簡單的介面來讓使用者在 DBM 風格的資料庫檔案中對物件進行封裝和拆封的操作。" + +#: ../../library/pickle.rst:181 +msgid "Module Interface" +msgstr "模組介面" + +#: ../../library/pickle.rst:183 +msgid "" +"To serialize an object hierarchy, you simply call the :func:`dumps` " +"function. Similarly, to de-serialize a data stream, you call the " +":func:`loads` function. However, if you want more control over serialization" +" and de-serialization, you can create a :class:`Pickler` or an " +":class:`Unpickler` object, respectively." +msgstr "" +"想要序列化一個物件,你只需要呼叫 :func:`dumps` 函數。而當你想要去序列化一個資料流時,你只需要呼叫 :func:`loads` " +"即可。不過,若你希望能各自對序列化和去序列化的過程中有更多的掌控度,你可以自訂一個 :class:`Pickler` 或 " +":class:`Unpickler` 物件。" + +#: ../../library/pickle.rst:188 +msgid "The :mod:`pickle` module provides the following constants:" +msgstr ":mod:`pickle` 模組提供以下常數:" + +#: ../../library/pickle.rst:193 +msgid "" +"An integer, the highest :ref:`protocol version ` " +"available. This value can be passed as a *protocol* value to functions " +":func:`dump` and :func:`dumps` as well as the :class:`Pickler` constructor." +msgstr "" +"一個整數,表示可使用的最高\\\\ :ref:`協定版本 `。這個值可作為 *protocol* 的數值傳給 " +":func:`dump` 和 :func:`dumps` 函數以及 :class:`Pickler` 建構式。" + +#: ../../library/pickle.rst:200 +msgid "" +"An integer, the default :ref:`protocol version ` used for " +"pickling. May be less than :data:`HIGHEST_PROTOCOL`. Currently the default" +" protocol is 4, first introduced in Python 3.4 and incompatible with " +"previous versions." +msgstr "" +"一個整數,指示用於序列化的預設\\\\ :ref:`協定版本 `。有可能小於 " +":data:`HIGHEST_PROTOCOL`。目前的預設協定版本為 4,是在 Python 3.4 中首次引入的,且與先前版本不相容。" + +#: ../../library/pickle.rst:207 +msgid "The default protocol is 3." +msgstr "預設協定版本為 3。" + +#: ../../library/pickle.rst:211 +msgid "The default protocol is 4." +msgstr "預設協定版本為 4。" + +#: ../../library/pickle.rst:213 +msgid "" +"The :mod:`pickle` module provides the following functions to make the " +"pickling process more convenient:" +msgstr ":mod:`pickle` 模組提供下列函數來簡化封裝的過程:" + +#: ../../library/pickle.rst:218 +msgid "" +"Write the pickled representation of the object *obj* to the open :term:`file" +" object` *file*. This is equivalent to ``Pickler(file, " +"protocol).dump(obj)``." +msgstr "" + +#: ../../library/pickle.rst:222 +msgid "" +"Arguments *file*, *protocol*, *fix_imports* and *buffer_callback* have the " +"same meaning as in the :class:`Pickler` constructor." +msgstr "" + +#: ../../library/pickle.rst:225 ../../library/pickle.rst:236 +#: ../../library/pickle.rst:328 +msgid "The *buffer_callback* argument was added." +msgstr "新增 *buffer_callback* 引數。" + +#: ../../library/pickle.rst:230 +msgid "" +"Return the pickled representation of the object *obj* as a :class:`bytes` " +"object, instead of writing it to a file." +msgstr "" + +#: ../../library/pickle.rst:233 +msgid "" +"Arguments *protocol*, *fix_imports* and *buffer_callback* have the same " +"meaning as in the :class:`Pickler` constructor." +msgstr "" + +#: ../../library/pickle.rst:241 +msgid "" +"Read the pickled representation of an object from the open :term:`file " +"object` *file* and return the reconstituted object hierarchy specified " +"therein. This is equivalent to ``Unpickler(file).load()``." +msgstr "" + +#: ../../library/pickle.rst:245 ../../library/pickle.rst:260 +msgid "" +"The protocol version of the pickle is detected automatically, so no protocol" +" argument is needed. Bytes past the pickled representation of the object " +"are ignored." +msgstr "" + +#: ../../library/pickle.rst:249 +msgid "" +"Arguments *file*, *fix_imports*, *encoding*, *errors*, *strict* and " +"*buffers* have the same meaning as in the :class:`Unpickler` constructor." +msgstr "" + +#: ../../library/pickle.rst:252 ../../library/pickle.rst:267 +#: ../../library/pickle.rst:429 +msgid "The *buffers* argument was added." +msgstr "新增 *buffer* 引數。" + +#: ../../library/pickle.rst:257 +msgid "" +"Return the reconstituted object hierarchy of the pickled representation " +"*data* of an object. *data* must be a :term:`bytes-like object`." +msgstr "" + +#: ../../library/pickle.rst:264 +msgid "" +"Arguments *fix_imports*, *encoding*, *errors*, *strict* and *buffers* have " +"the same meaning as in the :class:`Unpickler` constructor." +msgstr "" + +#: ../../library/pickle.rst:271 +msgid "The :mod:`pickle` module defines three exceptions:" +msgstr "" + +#: ../../library/pickle.rst:275 +msgid "" +"Common base class for the other pickling exceptions. It inherits from " +":exc:`Exception`." +msgstr "" + +#: ../../library/pickle.rst:280 +msgid "" +"Error raised when an unpicklable object is encountered by :class:`Pickler`. " +"It inherits from :exc:`PickleError`." +msgstr "" + +#: ../../library/pickle.rst:283 +msgid "" +"Refer to :ref:`pickle-picklable` to learn what kinds of objects can be " +"pickled." +msgstr "" + +#: ../../library/pickle.rst:288 +msgid "" +"Error raised when there is a problem unpickling an object, such as a data " +"corruption or a security violation. It inherits from :exc:`PickleError`." +msgstr "" + +#: ../../library/pickle.rst:291 +msgid "" +"Note that other exceptions may also be raised during unpickling, including " +"(but not necessarily limited to) AttributeError, EOFError, ImportError, and " +"IndexError." +msgstr "" + +#: ../../library/pickle.rst:296 +msgid "" +"The :mod:`pickle` module exports three classes, :class:`Pickler`, " +":class:`Unpickler` and :class:`PickleBuffer`:" +msgstr "" + +#: ../../library/pickle.rst:301 +msgid "This takes a binary file for writing a pickle data stream." +msgstr "" + +#: ../../library/pickle.rst:303 +msgid "" +"The optional *protocol* argument, an integer, tells the pickler to use the " +"given protocol; supported protocols are 0 to :data:`HIGHEST_PROTOCOL`. If " +"not specified, the default is :data:`DEFAULT_PROTOCOL`. If a negative " +"number is specified, :data:`HIGHEST_PROTOCOL` is selected." +msgstr "" + +#: ../../library/pickle.rst:308 +msgid "" +"The *file* argument must have a write() method that accepts a single bytes " +"argument. It can thus be an on-disk file opened for binary writing, an " +":class:`io.BytesIO` instance, or any other custom object that meets this " +"interface." +msgstr "" + +#: ../../library/pickle.rst:313 +msgid "" +"If *fix_imports* is true and *protocol* is less than 3, pickle will try to " +"map the new Python 3 names to the old module names used in Python 2, so that" +" the pickle data stream is readable with Python 2." +msgstr "" + +#: ../../library/pickle.rst:317 +msgid "" +"If *buffer_callback* is ``None`` (the default), buffer views are serialized " +"into *file* as part of the pickle stream." +msgstr "" + +#: ../../library/pickle.rst:320 +msgid "" +"If *buffer_callback* is not ``None``, then it can be called any number of " +"times with a buffer view. If the callback returns a false value (such as " +"``None``), the given buffer is :ref:`out-of-band `; otherwise " +"the buffer is serialized in-band, i.e. inside the pickle stream." +msgstr "" + +#: ../../library/pickle.rst:325 +msgid "" +"It is an error if *buffer_callback* is not ``None`` and *protocol* is " +"``None`` or smaller than 5." +msgstr "" + +#: ../../library/pickle.rst:333 +msgid "" +"Write the pickled representation of *obj* to the open file object given in " +"the constructor." +msgstr "" + +#: ../../library/pickle.rst:338 +msgid "Do nothing by default. This exists so a subclass can override it." +msgstr "" + +#: ../../library/pickle.rst:340 +msgid "" +"If :meth:`persistent_id` returns ``None``, *obj* is pickled as usual. Any " +"other value causes :class:`Pickler` to emit the returned value as a " +"persistent ID for *obj*. The meaning of this persistent ID should be " +"defined by :meth:`Unpickler.persistent_load`. Note that the value returned " +"by :meth:`persistent_id` cannot itself have a persistent ID." +msgstr "" + +#: ../../library/pickle.rst:346 ../../library/pickle.rst:447 +msgid "See :ref:`pickle-persistent` for details and examples of uses." +msgstr "關於細節與用法範例請見 :ref:`pickle-persistent`。" + +#: ../../library/pickle.rst:350 +msgid "" +"A pickler object's dispatch table is a registry of *reduction functions* of " +"the kind which can be declared using :func:`copyreg.pickle`. It is a " +"mapping whose keys are classes and whose values are reduction functions. A " +"reduction function takes a single argument of the associated class and " +"should conform to the same interface as a :meth:`~object.__reduce__` method." +msgstr "" + +#: ../../library/pickle.rst:358 +msgid "" +"By default, a pickler object will not have a :attr:`dispatch_table` " +"attribute, and it will instead use the global dispatch table managed by the " +":mod:`copyreg` module. However, to customize the pickling for a specific " +"pickler object one can set the :attr:`dispatch_table` attribute to a dict-" +"like object. Alternatively, if a subclass of :class:`Pickler` has a " +":attr:`dispatch_table` attribute then this will be used as the default " +"dispatch table for instances of that class." +msgstr "" + +#: ../../library/pickle.rst:367 +msgid "See :ref:`pickle-dispatch` for usage examples." +msgstr "關於用法範例請見 :ref:`pickle-dispatch`。" + +#: ../../library/pickle.rst:373 +msgid "" +"Special reducer that can be defined in :class:`Pickler` subclasses. This " +"method has priority over any reducer in the :attr:`dispatch_table`. It " +"should conform to the same interface as a :meth:`~object.__reduce__` method," +" and can optionally return :data:`NotImplemented` to fallback on " +":attr:`dispatch_table`-registered reducers to pickle ``obj``." +msgstr "" + +#: ../../library/pickle.rst:379 +msgid "For a detailed example, see :ref:`reducer_override`." +msgstr "" + +#: ../../library/pickle.rst:385 +msgid "" +"Deprecated. Enable fast mode if set to a true value. The fast mode disables" +" the usage of memo, therefore speeding the pickling process by not " +"generating superfluous PUT opcodes. It should not be used with self-" +"referential objects, doing otherwise will cause :class:`Pickler` to recurse " +"infinitely." +msgstr "" + +#: ../../library/pickle.rst:391 +msgid "Use :func:`pickletools.optimize` if you need more compact pickles." +msgstr "" + +#: ../../library/pickle.rst:396 +msgid "This takes a binary file for reading a pickle data stream." +msgstr "" + +#: ../../library/pickle.rst:398 +msgid "" +"The protocol version of the pickle is detected automatically, so no protocol" +" argument is needed." +msgstr "" + +#: ../../library/pickle.rst:401 +msgid "" +"The argument *file* must have three methods, a read() method that takes an " +"integer argument, a readinto() method that takes a buffer argument and a " +"readline() method that requires no arguments, as in the " +":class:`io.BufferedIOBase` interface. Thus *file* can be an on-disk file " +"opened for binary reading, an :class:`io.BytesIO` object, or any other " +"custom object that meets this interface." +msgstr "" + +#: ../../library/pickle.rst:408 +msgid "" +"The optional arguments *fix_imports*, *encoding* and *errors* are used to " +"control compatibility support for pickle stream generated by Python 2. If " +"*fix_imports* is true, pickle will try to map the old Python 2 names to the " +"new names used in Python 3. The *encoding* and *errors* tell pickle how to " +"decode 8-bit string instances pickled by Python 2; these default to 'ASCII' " +"and 'strict', respectively. The *encoding* can be 'bytes' to read these " +"8-bit string instances as bytes objects. Using ``encoding='latin1'`` is " +"required for unpickling NumPy arrays and instances of " +":class:`~datetime.datetime`, :class:`~datetime.date` and " +":class:`~datetime.time` pickled by Python 2." +msgstr "" + +#: ../../library/pickle.rst:419 +msgid "" +"If *buffers* is ``None`` (the default), then all data necessary for " +"deserialization must be contained in the pickle stream. This means that the" +" *buffer_callback* argument was ``None`` when a :class:`Pickler` was " +"instantiated (or when :func:`dump` or :func:`dumps` was called)." +msgstr "" + +#: ../../library/pickle.rst:424 +msgid "" +"If *buffers* is not ``None``, it should be an iterable of buffer-enabled " +"objects that is consumed each time the pickle stream references an " +":ref:`out-of-band ` buffer view. Such buffers have been given " +"in order to the *buffer_callback* of a Pickler object." +msgstr "" + +#: ../../library/pickle.rst:434 +msgid "" +"Read the pickled representation of an object from the open file object given" +" in the constructor, and return the reconstituted object hierarchy specified" +" therein. Bytes past the pickled representation of the object are ignored." +msgstr "" + +#: ../../library/pickle.rst:441 +msgid "Raise an :exc:`UnpicklingError` by default." +msgstr "" + +#: ../../library/pickle.rst:443 +msgid "" +"If defined, :meth:`persistent_load` should return the object specified by " +"the persistent ID *pid*. If an invalid persistent ID is encountered, an " +":exc:`UnpicklingError` should be raised." +msgstr "" + +#: ../../library/pickle.rst:451 +msgid "" +"Import *module* if necessary and return the object called *name* from it, " +"where the *module* and *name* arguments are :class:`str` objects. Note, " +"unlike its name suggests, :meth:`find_class` is also used for finding " +"functions." +msgstr "" + +#: ../../library/pickle.rst:456 +msgid "" +"Subclasses may override this to gain control over what type of objects and " +"how they can be loaded, potentially reducing security risks. Refer to " +":ref:`pickle-restrict` for details." +msgstr "" + +#: ../../library/pickle.rst:460 +msgid "" +"Raises an :ref:`auditing event ` ``pickle.find_class`` with " +"arguments ``module``, ``name``." +msgstr "" +"引發一個附帶引數 ``module``、``name`` 的\\ :ref:`稽核事件 ` " +"``pickle.find_class``。" + +#: ../../library/pickle.rst:464 +msgid "" +"A wrapper for a buffer representing picklable data. *buffer* must be a " +":ref:`buffer-providing ` object, such as a :term:`bytes-like " +"object` or a N-dimensional array." +msgstr "" + +#: ../../library/pickle.rst:468 +msgid "" +":class:`PickleBuffer` is itself a buffer provider, therefore it is possible " +"to pass it to other APIs expecting a buffer-providing object, such as " +":class:`memoryview`." +msgstr "" + +#: ../../library/pickle.rst:472 +msgid "" +":class:`PickleBuffer` objects can only be serialized using pickle protocol 5" +" or higher. They are eligible for :ref:`out-of-band serialization `." +msgstr "" + +#: ../../library/pickle.rst:480 +msgid "" +"Return a :class:`memoryview` of the memory area underlying this buffer. The " +"returned object is a one-dimensional, C-contiguous memoryview with format " +"``B`` (unsigned bytes). :exc:`BufferError` is raised if the buffer is " +"neither C- nor Fortran-contiguous." +msgstr "" + +#: ../../library/pickle.rst:487 +msgid "Release the underlying buffer exposed by the PickleBuffer object." +msgstr "" + +#: ../../library/pickle.rst:493 +msgid "What can be pickled and unpickled?" +msgstr "" + +#: ../../library/pickle.rst:495 +msgid "The following types can be pickled:" +msgstr "" + +#: ../../library/pickle.rst:497 +msgid "" +"built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, and " +":data:`NotImplemented`);" +msgstr "" + +#: ../../library/pickle.rst:500 +msgid "integers, floating-point numbers, complex numbers;" +msgstr "" + +#: ../../library/pickle.rst:502 +msgid "strings, bytes, bytearrays;" +msgstr "" + +#: ../../library/pickle.rst:504 +msgid "" +"tuples, lists, sets, and dictionaries containing only picklable objects;" +msgstr "" + +#: ../../library/pickle.rst:506 +msgid "" +"functions (built-in and user-defined) accessible from the top level of a " +"module (using :keyword:`def`, not :keyword:`lambda`);" +msgstr "" + +#: ../../library/pickle.rst:509 +msgid "classes accessible from the top level of a module;" +msgstr "" + +#: ../../library/pickle.rst:511 +msgid "" +"instances of such classes whose the result of calling " +":meth:`~object.__getstate__` is picklable (see section :ref:`pickle-inst` " +"for details)." +msgstr "" + +#: ../../library/pickle.rst:514 +msgid "" +"Attempts to pickle unpicklable objects will raise the :exc:`PicklingError` " +"exception; when this happens, an unspecified number of bytes may have " +"already been written to the underlying file. Trying to pickle a highly " +"recursive data structure may exceed the maximum recursion depth, a " +":exc:`RecursionError` will be raised in this case. You can carefully raise " +"this limit with :func:`sys.setrecursionlimit`." +msgstr "" + +#: ../../library/pickle.rst:521 +msgid "" +"Note that functions (built-in and user-defined) are pickled by fully " +":term:`qualified name`, not by value. [#]_ This means that only the " +"function name is pickled, along with the name of the containing module and " +"classes. Neither the function's code, nor any of its function attributes " +"are pickled. Thus the defining module must be importable in the unpickling " +"environment, and the module must contain the named object, otherwise an " +"exception will be raised. [#]_" +msgstr "" + +#: ../../library/pickle.rst:528 +msgid "" +"Similarly, classes are pickled by fully qualified name, so the same " +"restrictions in the unpickling environment apply. Note that none of the " +"class's code or data is pickled, so in the following example the class " +"attribute ``attr`` is not restored in the unpickling environment::" +msgstr "" + +#: ../../library/pickle.rst:538 +msgid "" +"These restrictions are why picklable functions and classes must be defined " +"at the top level of a module." +msgstr "" + +#: ../../library/pickle.rst:541 +msgid "" +"Similarly, when class instances are pickled, their class's code and data are" +" not pickled along with them. Only the instance data are pickled. This is " +"done on purpose, so you can fix bugs in a class or add methods to the class " +"and still load objects that were created with an earlier version of the " +"class. If you plan to have long-lived objects that will see many versions " +"of a class, it may be worthwhile to put a version number in the objects so " +"that suitable conversions can be made by the class's " +":meth:`~object.__setstate__` method." +msgstr "" + +#: ../../library/pickle.rst:553 +msgid "Pickling Class Instances" +msgstr "" + +#: ../../library/pickle.rst:557 +msgid "" +"In this section, we describe the general mechanisms available to you to " +"define, customize, and control how class instances are pickled and " +"unpickled." +msgstr "" + +#: ../../library/pickle.rst:560 +msgid "" +"In most cases, no additional code is needed to make instances picklable. By" +" default, pickle will retrieve the class and the attributes of an instance " +"via introspection. When a class instance is unpickled, its " +":meth:`~object.__init__` method is usually *not* invoked. The default " +"behaviour first creates an uninitialized instance and then restores the " +"saved attributes. The following code shows an implementation of this " +"behaviour::" +msgstr "" + +#: ../../library/pickle.rst:575 +msgid "" +"Classes can alter the default behaviour by providing one or several special " +"methods:" +msgstr "" + +#: ../../library/pickle.rst:580 +msgid "" +"In protocols 2 and newer, classes that implements the " +":meth:`__getnewargs_ex__` method can dictate the values passed to the " +":meth:`__new__` method upon unpickling. The method must return a pair " +"``(args, kwargs)`` where *args* is a tuple of positional arguments and " +"*kwargs* a dictionary of named arguments for constructing the object. Those" +" will be passed to the :meth:`__new__` method upon unpickling." +msgstr "" + +#: ../../library/pickle.rst:588 +msgid "" +"You should implement this method if the :meth:`__new__` method of your class" +" requires keyword-only arguments. Otherwise, it is recommended for " +"compatibility to implement :meth:`__getnewargs__`." +msgstr "" + +#: ../../library/pickle.rst:592 +msgid ":meth:`__getnewargs_ex__` is now used in protocols 2 and 3." +msgstr "" + +#: ../../library/pickle.rst:598 +msgid "" +"This method serves a similar purpose as :meth:`__getnewargs_ex__`, but " +"supports only positional arguments. It must return a tuple of arguments " +"``args`` which will be passed to the :meth:`__new__` method upon unpickling." +msgstr "" + +#: ../../library/pickle.rst:602 +msgid "" +":meth:`__getnewargs__` will not be called if :meth:`__getnewargs_ex__` is " +"defined." +msgstr "" + +#: ../../library/pickle.rst:605 +msgid "" +"Before Python 3.6, :meth:`__getnewargs__` was called instead of " +":meth:`__getnewargs_ex__` in protocols 2 and 3." +msgstr "" + +#: ../../library/pickle.rst:612 +msgid "" +"Classes can further influence how their instances are pickled by overriding " +"the method :meth:`__getstate__`. It is called and the returned object is " +"pickled as the contents for the instance, instead of a default state. There " +"are several cases:" +msgstr "" + +#: ../../library/pickle.rst:617 +msgid "" +"For a class that has no instance :attr:`~object.__dict__` and no " +":attr:`~object.__slots__`, the default state is ``None``." +msgstr "" + +#: ../../library/pickle.rst:620 +msgid "" +"For a class that has an instance :attr:`~object.__dict__` and no " +":attr:`~object.__slots__`, the default state is ``self.__dict__``." +msgstr "" + +#: ../../library/pickle.rst:623 +msgid "" +"For a class that has an instance :attr:`~object.__dict__` and " +":attr:`~object.__slots__`, the default state is a tuple consisting of two " +"dictionaries: ``self.__dict__``, and a dictionary mapping slot names to " +"slot values. Only slots that have a value are included in the latter." +msgstr "" + +#: ../../library/pickle.rst:629 +msgid "" +"For a class that has :attr:`~object.__slots__` and no instance " +":attr:`~object.__dict__`, the default state is a tuple whose first item is " +"``None`` and whose second item is a dictionary mapping slot names to slot " +"values described in the previous bullet." +msgstr "" + +#: ../../library/pickle.rst:634 +msgid "" +"Added the default implementation of the ``__getstate__()`` method in the " +":class:`object` class." +msgstr "" + +#: ../../library/pickle.rst:641 +msgid "" +"Upon unpickling, if the class defines :meth:`__setstate__`, it is called " +"with the unpickled state. In that case, there is no requirement for the " +"state object to be a dictionary. Otherwise, the pickled state must be a " +"dictionary and its items are assigned to the new instance's dictionary." +msgstr "" + +#: ../../library/pickle.rst:648 +msgid "" +"If :meth:`__reduce__` returns a state with value ``None`` at pickling, the " +":meth:`__setstate__` method will not be called upon unpickling." +msgstr "" + +#: ../../library/pickle.rst:652 +msgid "" +"Refer to the section :ref:`pickle-state` for more information about how to " +"use the methods :meth:`~object.__getstate__` and " +":meth:`~object.__setstate__`." +msgstr "" + +#: ../../library/pickle.rst:657 +msgid "" +"At unpickling time, some methods like :meth:`~object.__getattr__`, " +":meth:`~object.__getattribute__`, or :meth:`~object.__setattr__` may be " +"called upon the instance. In case those methods rely on some internal " +"invariant being true, the type should implement :meth:`~object.__new__` to " +"establish such an invariant, as :meth:`~object.__init__` is not called when " +"unpickling an instance." +msgstr "" + +#: ../../library/pickle.rst:666 +msgid "" +"As we shall see, pickle does not use directly the methods described above. " +"In fact, these methods are part of the copy protocol which implements the " +":meth:`~object.__reduce__` special method. The copy protocol provides a " +"unified interface for retrieving the data necessary for pickling and copying" +" objects. [#]_" +msgstr "" + +#: ../../library/pickle.rst:672 +msgid "" +"Although powerful, implementing :meth:`~object.__reduce__` directly in your " +"classes is error prone. For this reason, class designers should use the " +"high-level interface (i.e., :meth:`~object.__getnewargs_ex__`, " +":meth:`~object.__getstate__` and :meth:`~object.__setstate__`) whenever " +"possible. We will show, however, cases where using :meth:`!__reduce__` is " +"the only option or leads to more efficient pickling or both." +msgstr "" + +#: ../../library/pickle.rst:681 +msgid "" +"The interface is currently defined as follows. The :meth:`__reduce__` " +"method takes no argument and shall return either a string or preferably a " +"tuple (the returned object is often referred to as the \"reduce value\")." +msgstr "" + +#: ../../library/pickle.rst:685 +msgid "" +"If a string is returned, the string should be interpreted as the name of a " +"global variable. It should be the object's local name relative to its " +"module; the pickle module searches the module namespace to determine the " +"object's module. This behaviour is typically useful for singletons." +msgstr "" + +#: ../../library/pickle.rst:690 +msgid "" +"When a tuple is returned, it must be between two and six items long. " +"Optional items can either be omitted, or ``None`` can be provided as their " +"value. The semantics of each item are in order:" +msgstr "" + +#: ../../library/pickle.rst:696 +msgid "" +"A callable object that will be called to create the initial version of the " +"object." +msgstr "" + +#: ../../library/pickle.rst:699 +msgid "" +"A tuple of arguments for the callable object. An empty tuple must be given " +"if the callable does not accept any argument." +msgstr "" + +#: ../../library/pickle.rst:702 +msgid "" +"Optionally, the object's state, which will be passed to the object's " +":meth:`__setstate__` method as previously described. If the object has no " +"such method then, the value must be a dictionary and it will be added to the" +" object's :attr:`~object.__dict__` attribute." +msgstr "" + +#: ../../library/pickle.rst:707 +msgid "" +"Optionally, an iterator (and not a sequence) yielding successive items. " +"These items will be appended to the object either using ``obj.append(item)``" +" or, in batch, using ``obj.extend(list_of_items)``. This is primarily used " +"for list subclasses, but may be used by other classes as long as they have " +":ref:`append and extend methods ` with the appropriate " +"signature. (Whether :meth:`!append` or :meth:`!extend` is used depends on " +"which pickle protocol version is used as well as the number of items to " +"append, so both must be supported.)" +msgstr "" + +#: ../../library/pickle.rst:717 +msgid "" +"Optionally, an iterator (not a sequence) yielding successive key-value " +"pairs. These items will be stored to the object using ``obj[key] = value``." +" This is primarily used for dictionary subclasses, but may be used by other" +" classes as long as they implement :meth:`__setitem__`." +msgstr "" + +#: ../../library/pickle.rst:722 +msgid "" +"Optionally, a callable with a ``(obj, state)`` signature. This callable " +"allows the user to programmatically control the state-updating behavior of a" +" specific object, instead of using ``obj``'s static :meth:`__setstate__` " +"method. If not ``None``, this callable will have priority over ``obj``'s " +":meth:`__setstate__`." +msgstr "" + +#: ../../library/pickle.rst:728 +msgid "The optional sixth tuple item, ``(obj, state)``, was added." +msgstr "" + +#: ../../library/pickle.rst:734 +msgid "" +"Alternatively, a :meth:`__reduce_ex__` method may be defined. The only " +"difference is this method should take a single integer argument, the " +"protocol version. When defined, pickle will prefer it over the " +":meth:`__reduce__` method. In addition, :meth:`__reduce__` automatically " +"becomes a synonym for the extended version. The main use for this method is" +" to provide backwards-compatible reduce values for older Python releases." +msgstr "" + +#: ../../library/pickle.rst:746 +msgid "Persistence of External Objects" +msgstr "" + +#: ../../library/pickle.rst:752 +msgid "" +"For the benefit of object persistence, the :mod:`pickle` module supports the" +" notion of a reference to an object outside the pickled data stream. Such " +"objects are referenced by a persistent ID, which should be either a string " +"of alphanumeric characters (for protocol 0) [#]_ or just an arbitrary object" +" (for any newer protocol)." +msgstr "" + +#: ../../library/pickle.rst:758 +msgid "" +"The resolution of such persistent IDs is not defined by the :mod:`pickle` " +"module; it will delegate this resolution to the user-defined methods on the " +"pickler and unpickler, :meth:`~Pickler.persistent_id` and " +":meth:`~Unpickler.persistent_load` respectively." +msgstr "" + +#: ../../library/pickle.rst:763 +msgid "" +"To pickle objects that have an external persistent ID, the pickler must have" +" a custom :meth:`~Pickler.persistent_id` method that takes an object as an " +"argument and returns either ``None`` or the persistent ID for that object. " +"When ``None`` is returned, the pickler simply pickles the object as normal. " +"When a persistent ID string is returned, the pickler will pickle that " +"object, along with a marker so that the unpickler will recognize it as a " +"persistent ID." +msgstr "" + +#: ../../library/pickle.rst:770 +msgid "" +"To unpickle external objects, the unpickler must have a custom " +":meth:`~Unpickler.persistent_load` method that takes a persistent ID object " +"and returns the referenced object." +msgstr "" + +#: ../../library/pickle.rst:774 +msgid "" +"Here is a comprehensive example presenting how persistent ID can be used to " +"pickle external objects by reference." +msgstr "" + +#: ../../library/pickle.rst:782 +msgid "Dispatch Tables" +msgstr "" + +#: ../../library/pickle.rst:784 +msgid "" +"If one wants to customize pickling of some classes without disturbing any " +"other code which depends on pickling, then one can create a pickler with a " +"private dispatch table." +msgstr "" + +#: ../../library/pickle.rst:788 +msgid "" +"The global dispatch table managed by the :mod:`copyreg` module is available " +"as :data:`!copyreg.dispatch_table`. Therefore, one may choose to use a " +"modified copy of :data:`!copyreg.dispatch_table` as a private dispatch " +"table." +msgstr "" + +#: ../../library/pickle.rst:793 +msgid "For example ::" +msgstr "舉例來說: ::" + +#: ../../library/pickle.rst:800 +msgid "" +"creates an instance of :class:`pickle.Pickler` with a private dispatch table" +" which handles the ``SomeClass`` class specially. Alternatively, the code " +"::" +msgstr "" + +#: ../../library/pickle.rst:810 +msgid "" +"does the same but all instances of ``MyPickler`` will by default share the " +"private dispatch table. On the other hand, the code ::" +msgstr "" + +#: ../../library/pickle.rst:817 +msgid "" +"modifies the global dispatch table shared by all users of the :mod:`copyreg`" +" module." +msgstr "" + +#: ../../library/pickle.rst:822 +msgid "Handling Stateful Objects" +msgstr "" + +#: ../../library/pickle.rst:828 +msgid "" +"Here's an example that shows how to modify pickling behavior for a class. " +"The :class:`!TextReader` class below opens a text file, and returns the line" +" number and line contents each time its :meth:`!readline` method is called. " +"If a :class:`!TextReader` instance is pickled, all attributes *except* the " +"file object member are saved. When the instance is unpickled, the file is " +"reopened, and reading resumes from the last location. The " +":meth:`!__setstate__` and :meth:`!__getstate__` methods are used to " +"implement this behavior. ::" +msgstr "" + +#: ../../library/pickle.rst:874 +msgid "A sample usage might be something like this::" +msgstr "" + +#: ../../library/pickle.rst:888 +msgid "Custom Reduction for Types, Functions, and Other Objects" +msgstr "" + +#: ../../library/pickle.rst:892 +msgid "" +"Sometimes, :attr:`~Pickler.dispatch_table` may not be flexible enough. In " +"particular we may want to customize pickling based on another criterion than" +" the object's type, or we may want to customize the pickling of functions " +"and classes." +msgstr "" + +#: ../../library/pickle.rst:897 +msgid "" +"For those cases, it is possible to subclass from the :class:`Pickler` class " +"and implement a :meth:`~Pickler.reducer_override` method. This method can " +"return an arbitrary reduction tuple (see :meth:`~object.__reduce__`). It can" +" alternatively return :data:`NotImplemented` to fallback to the traditional " +"behavior." +msgstr "" + +#: ../../library/pickle.rst:902 +msgid "" +"If both the :attr:`~Pickler.dispatch_table` and " +":meth:`~Pickler.reducer_override` are defined, then " +":meth:`~Pickler.reducer_override` method takes priority." +msgstr "" + +#: ../../library/pickle.rst:907 +msgid "" +"For performance reasons, :meth:`~Pickler.reducer_override` may not be called" +" for the following objects: ``None``, ``True``, ``False``, and exact " +"instances of :class:`int`, :class:`float`, :class:`bytes`, :class:`str`, " +":class:`dict`, :class:`set`, :class:`frozenset`, :class:`list` and " +":class:`tuple`." +msgstr "" + +#: ../../library/pickle.rst:913 +msgid "" +"Here is a simple example where we allow pickling and reconstructing a given " +"class::" +msgstr "" + +#: ../../library/pickle.rst:948 +msgid "Out-of-band Buffers" +msgstr "" + +#: ../../library/pickle.rst:952 +msgid "" +"In some contexts, the :mod:`pickle` module is used to transfer massive " +"amounts of data. Therefore, it can be important to minimize the number of " +"memory copies, to preserve performance and resource consumption. However, " +"normal operation of the :mod:`pickle` module, as it transforms a graph-like " +"structure of objects into a sequential stream of bytes, intrinsically " +"involves copying data to and from the pickle stream." +msgstr "" + +#: ../../library/pickle.rst:959 +msgid "" +"This constraint can be eschewed if both the *provider* (the implementation " +"of the object types to be transferred) and the *consumer* (the " +"implementation of the communications system) support the out-of-band " +"transfer facilities provided by pickle protocol 5 and higher." +msgstr "" + +#: ../../library/pickle.rst:965 +msgid "Provider API" +msgstr "" + +#: ../../library/pickle.rst:967 +msgid "" +"The large data objects to be pickled must implement a " +":meth:`~object.__reduce_ex__` method specialized for protocol 5 and higher, " +"which returns a :class:`PickleBuffer` instance (instead of e.g. a " +":class:`bytes` object) for any large data." +msgstr "" + +#: ../../library/pickle.rst:972 +msgid "" +"A :class:`PickleBuffer` object *signals* that the underlying buffer is " +"eligible for out-of-band data transfer. Those objects remain compatible " +"with normal usage of the :mod:`pickle` module. However, consumers can also " +"opt-in to tell :mod:`pickle` that they will handle those buffers by " +"themselves." +msgstr "" + +#: ../../library/pickle.rst:979 +msgid "Consumer API" +msgstr "" + +#: ../../library/pickle.rst:981 +msgid "" +"A communications system can enable custom handling of the " +":class:`PickleBuffer` objects generated when serializing an object graph." +msgstr "" + +#: ../../library/pickle.rst:984 +msgid "" +"On the sending side, it needs to pass a *buffer_callback* argument to " +":class:`Pickler` (or to the :func:`dump` or :func:`dumps` function), which " +"will be called with each :class:`PickleBuffer` generated while pickling the " +"object graph. Buffers accumulated by the *buffer_callback* will not see " +"their data copied into the pickle stream, only a cheap marker will be " +"inserted." +msgstr "" + +#: ../../library/pickle.rst:991 +msgid "" +"On the receiving side, it needs to pass a *buffers* argument to " +":class:`Unpickler` (or to the :func:`load` or :func:`loads` function), which" +" is an iterable of the buffers which were passed to *buffer_callback*. That " +"iterable should produce buffers in the same order as they were passed to " +"*buffer_callback*. Those buffers will provide the data expected by the " +"reconstructors of the objects whose pickling produced the original " +":class:`PickleBuffer` objects." +msgstr "" + +#: ../../library/pickle.rst:999 +msgid "" +"Between the sending side and the receiving side, the communications system " +"is free to implement its own transfer mechanism for out-of-band buffers. " +"Potential optimizations include the use of shared memory or datatype-" +"dependent compression." +msgstr "" + +#: ../../library/pickle.rst:1005 +msgid "Example" +msgstr "範例" + +#: ../../library/pickle.rst:1007 +msgid "" +"Here is a trivial example where we implement a :class:`bytearray` subclass " +"able to participate in out-of-band buffer pickling::" +msgstr "" + +#: ../../library/pickle.rst:1031 +msgid "" +"The reconstructor (the ``_reconstruct`` class method) returns the buffer's " +"providing object if it has the right type. This is an easy way to simulate " +"zero-copy behaviour on this toy example." +msgstr "" + +#: ../../library/pickle.rst:1035 +msgid "" +"On the consumer side, we can pickle those objects the usual way, which when " +"unserialized will give us a copy of the original object::" +msgstr "" + +#: ../../library/pickle.rst:1044 +msgid "" +"But if we pass a *buffer_callback* and then give back the accumulated " +"buffers when unserializing, we are able to get back the original object::" +msgstr "" + +#: ../../library/pickle.rst:1054 +msgid "" +"This example is limited by the fact that :class:`bytearray` allocates its " +"own memory: you cannot create a :class:`bytearray` instance that is backed " +"by another object's memory. However, third-party datatypes such as NumPy " +"arrays do not have this limitation, and allow use of zero-copy pickling (or " +"making as few copies as possible) when transferring between distinct " +"processes or systems." +msgstr "" + +#: ../../library/pickle.rst:1061 +msgid ":pep:`574` -- Pickle protocol 5 with out-of-band data" +msgstr "" + +#: ../../library/pickle.rst:1067 +msgid "Restricting Globals" +msgstr "" + +#: ../../library/pickle.rst:1072 +msgid "" +"By default, unpickling will import any class or function that it finds in " +"the pickle data. For many applications, this behaviour is unacceptable as " +"it permits the unpickler to import and invoke arbitrary code. Just consider" +" what this hand-crafted pickle data stream does when loaded::" +msgstr "" + +#: ../../library/pickle.rst:1082 +msgid "" +"In this example, the unpickler imports the :func:`os.system` function and " +"then apply the string argument \"echo hello world\". Although this example " +"is inoffensive, it is not difficult to imagine one that could damage your " +"system." +msgstr "" + +#: ../../library/pickle.rst:1086 +msgid "" +"For this reason, you may want to control what gets unpickled by customizing " +":meth:`Unpickler.find_class`. Unlike its name suggests, " +":meth:`Unpickler.find_class` is called whenever a global (i.e., a class or a" +" function) is requested. Thus it is possible to either completely forbid " +"globals or restrict them to a safe subset." +msgstr "" + +#: ../../library/pickle.rst:1092 +msgid "" +"Here is an example of an unpickler allowing only few safe classes from the " +":mod:`builtins` module to be loaded::" +msgstr "" + +#: ../../library/pickle.rst:1121 +msgid "A sample usage of our unpickler working as intended::" +msgstr "" + +#: ../../library/pickle.rst:1140 +msgid "" +"As our examples shows, you have to be careful with what you allow to be " +"unpickled. Therefore if security is a concern, you may want to consider " +"alternatives such as the marshalling API in :mod:`xmlrpc.client` or third-" +"party solutions." +msgstr "" + +#: ../../library/pickle.rst:1147 +msgid "Performance" +msgstr "" + +#: ../../library/pickle.rst:1149 +msgid "" +"Recent versions of the pickle protocol (from protocol 2 and upwards) feature" +" efficient binary encodings for several common features and built-in types. " +"Also, the :mod:`pickle` module has a transparent optimizer written in C." +msgstr "" + +#: ../../library/pickle.rst:1157 +msgid "Examples" +msgstr "範例" + +#: ../../library/pickle.rst:1159 +msgid "" +"For the simplest code, use the :func:`dump` and :func:`load` functions. ::" +msgstr "" + +#: ../../library/pickle.rst:1175 +msgid "The following example reads the resulting pickled data. ::" +msgstr "" + +#: ../../library/pickle.rst:1191 +msgid "Module :mod:`copyreg`" +msgstr ":mod:`copyreg` 模組" + +#: ../../library/pickle.rst:1192 +msgid "Pickle interface constructor registration for extension types." +msgstr "" + +#: ../../library/pickle.rst:1194 +msgid "Module :mod:`pickletools`" +msgstr ":mod:`pickletools` 模組" + +#: ../../library/pickle.rst:1195 +msgid "Tools for working with and analyzing pickled data." +msgstr "" + +#: ../../library/pickle.rst:1197 +msgid "Module :mod:`shelve`" +msgstr ":mod:`shelve` 模組" + +#: ../../library/pickle.rst:1198 +msgid "Indexed databases of objects; uses :mod:`pickle`." +msgstr "" + +#: ../../library/pickle.rst:1200 +msgid "Module :mod:`copy`" +msgstr ":mod:`copy` 模組" + +#: ../../library/pickle.rst:1201 +msgid "Shallow and deep object copying." +msgstr "" + +#: ../../library/pickle.rst:1203 +msgid "Module :mod:`marshal`" +msgstr ":mod:`marshal` 模組" + +#: ../../library/pickle.rst:1204 +msgid "High-performance serialization of built-in types." +msgstr "" + +#: ../../library/pickle.rst:1208 +msgid "Footnotes" +msgstr "註解" + +#: ../../library/pickle.rst:1209 +msgid "Don't confuse this with the :mod:`marshal` module" +msgstr "" + +#: ../../library/pickle.rst:1211 +msgid "" +"This is why :keyword:`lambda` functions cannot be pickled: all " +":keyword:`!lambda` functions share the same name: ````." +msgstr "" + +#: ../../library/pickle.rst:1214 +msgid "" +"The exception raised will likely be an :exc:`ImportError` or an " +":exc:`AttributeError` but it could be something else." +msgstr "" + +#: ../../library/pickle.rst:1217 +msgid "" +"The :mod:`copy` module uses this protocol for shallow and deep copying " +"operations." +msgstr "" + +#: ../../library/pickle.rst:1220 +msgid "" +"The limitation on alphanumeric characters is due to the fact that persistent" +" IDs in protocol 0 are delimited by the newline character. Therefore if any" +" kind of newline characters occurs in persistent IDs, the resulting pickled " +"data will become unreadable." +msgstr "" + +#: ../../library/pickle.rst:12 +msgid "persistence" +msgstr "persistence(持續性)" + +#: ../../library/pickle.rst:12 +msgid "persistent" +msgstr "persistent(持續)" + +#: ../../library/pickle.rst:12 +msgid "objects" +msgstr "objects(物件)" + +#: ../../library/pickle.rst:12 +msgid "serializing" +msgstr "serializing(序列化)" + +#: ../../library/pickle.rst:12 +msgid "marshalling" +msgstr "marshalling" + +#: ../../library/pickle.rst:12 +msgid "flattening" +msgstr "flattening(攤平)" + +#: ../../library/pickle.rst:12 +msgid "pickling" +msgstr "pickling" + +#: ../../library/pickle.rst:123 +msgid "External Data Representation" +msgstr "External Data Representation(外部資料表示法)" + +#: ../../library/pickle.rst:664 +msgid "copy" +msgstr "copy(複製)" + +#: ../../library/pickle.rst:664 +msgid "protocol" +msgstr "protocol(協定)" + +#: ../../library/pickle.rst:748 +msgid "persistent_id (pickle protocol)" +msgstr "persistent_id(pickle 協定)" + +#: ../../library/pickle.rst:748 +msgid "persistent_load (pickle protocol)" +msgstr "persistent_load(pickle 協定)" + +#: ../../library/pickle.rst:824 +msgid "__getstate__() (copy protocol)" +msgstr "__getstate__()(copy 協定)" + +#: ../../library/pickle.rst:824 +msgid "__setstate__() (copy protocol)" +msgstr "__setstate__()(copy 協定)" + +#: ../../library/pickle.rst:1069 +msgid "find_class() (pickle protocol)" +msgstr "find_class()(pickle 協定)" From de36d132e1e97439d76a4fafc157fbb402469f8f Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Wed, 21 Aug 2024 00:09:01 +0800 Subject: [PATCH 04/89] docs(library/pickle.po): editing, up to line 462 --- library/pickle.po | 3114 +++++++++++++++++++++++---------------------- 1 file changed, 1572 insertions(+), 1542 deletions(-) diff --git a/library/pickle.po b/library/pickle.po index 95f0a47a95..8c05090630 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -1,1542 +1,1572 @@ -# Copyright (C) 2001-2024, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -# Skylull, 2024 -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" -"PO-Revision-Date: 2018-05-23 16:07+0000\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../../library/pickle.rst:2 -msgid ":mod:`!pickle` --- Python object serialization" -msgstr ":mod:`!pickle` --- Python 物件序列化" - -#: ../../library/pickle.rst:10 -msgid "**Source code:** :source:`Lib/pickle.py`" -msgstr "**原始碼:**\\ :source:`Lib/pickle.py`" - -# Skylull: 我對 `pickle` 的命名原因進行了簡單的搜尋,只找到一則討論 -# https://stackoverflow.com/questions/27324986/pickles-why-are-they-called- -# that -# 其中表示這名字很可能只是為了隨便找一個p開頭的單字、或原始開發人員的內部玩笑造成的約定俗成。也有人表示醃製黃瓜(pickle- -# ing)的目標就是保存和存放,所以取了這個名字。 -# 無論如何似乎沒有一個定論。 -# 因為不確定是否與醃漬的這個梗有關,我暫時選擇使用 `封裝` 與 `拆封` 作為譯文,大致保存那個把東西處裡後裝起來的感覺但又不至於太奇怪。 -# 唯一需要擔心的是是否有與 `encapsulation` (封裝,網路協定名詞)或 `package`(封包,網路協定名詞)搞混的可能。 -#: ../../library/pickle.rst:22 -msgid "" -"The :mod:`pickle` module implements binary protocols for serializing and de-" -"serializing a Python object structure. *\"Pickling\"* is the process " -"whereby a Python object hierarchy is converted into a byte stream, and " -"*\"unpickling\"* is the inverse operation, whereby a byte stream (from a " -":term:`binary file` or :term:`bytes-like object`) is converted back into an " -"object hierarchy. Pickling (and unpickling) is alternatively known as " -"\"serialization\", \"marshalling,\" [#]_ or \"flattening\"; however, to " -"avoid confusion, the terms used here are \"pickling\" and \"unpickling\"." -msgstr "" -":mod:`pickle` 模組實作的是一個在二進位層級上對 Python 物件進行序列化(serialize)或去序列化(de-" -"serialize)。*\"Pickling\"* 用於專門指摘將一個 Python 物件轉換為一個二進位串流的過程,*\"unpickling\"* " -"則相反,指的是將一個(來自 :term:`binary file` 或 :term:`bytes-like object` 的)二進位串流轉換回 " -"Python 物件的過程。Pickling(和 unpickling)的過程也可能被稱作 \"serialization\", " -"\"marshalling,\" [#]_ 或 " -"\"flattening\"。不過,為了避免混淆,本文件將統一稱作封裝(pickling)、拆封(unpickling)。" - -#: ../../library/pickle.rst:33 -msgid "The ``pickle`` module **is not secure**. Only unpickle data you trust." -msgstr "``pickle`` 模組**並不安全**,切記只拆封你信任的資料。" - -#: ../../library/pickle.rst:35 -msgid "" -"It is possible to construct malicious pickle data which will **execute " -"arbitrary code during unpickling**. Never unpickle data that could have come" -" from an untrusted source, or that could have been tampered with." -msgstr "" -"pickle 封包是有可能被建立來在拆封的時候**執行任意惡意程式碼**的。絕對不要拆封任何你無法信任其來源、或可能被修改過的 pickle 封包。" - -#: ../../library/pickle.rst:39 -msgid "" -"Consider signing data with :mod:`hmac` if you need to ensure that it has not" -" been tampered with." -msgstr "建議你可以使用 :mod:`hmac` 模組來簽署這個封包,以確保其未被修改過。" - -#: ../../library/pickle.rst:42 -msgid "" -"Safer serialization formats such as :mod:`json` may be more appropriate if " -"you are processing untrusted data. See :ref:`comparison-with-json`." -msgstr "" -"如果你在處理不受信任的資料,其他比較安全的序列化格式(例如 :mod:`json`)可能會更適合。請參照 See :ref:`comparison-" -"with-json` 的說明。" - -#: ../../library/pickle.rst:47 -msgid "Relationship to other Python modules" -msgstr "和其他 Python 模組的關係" - -#: ../../library/pickle.rst:50 -msgid "Comparison with ``marshal``" -msgstr "和 ``marshal`` 的比較" - -#: ../../library/pickle.rst:52 -msgid "" -"Python has a more primitive serialization module called :mod:`marshal`, but " -"in general :mod:`pickle` should always be the preferred way to serialize " -"Python objects. :mod:`marshal` exists primarily to support Python's " -":file:`.pyc` files." -msgstr "" -"Python 有另一個比較原始的序列化模組叫 :mod:`marshal`,不過其設計目的是為了支援 Python 的預編譯功能 " -":file:`.pyc` 運作。總地來說,沒事不要用 :mod:`marshal`。" - -#: ../../library/pickle.rst:57 -msgid "" -"The :mod:`pickle` module differs from :mod:`marshal` in several significant " -"ways:" -msgstr ":mod:`pickle` 和 :mod:`marshal` 有幾個明顯不同的地方:" - -#: ../../library/pickle.rst:59 -msgid "" -"The :mod:`pickle` module keeps track of the objects it has already " -"serialized, so that later references to the same object won't be serialized " -"again. :mod:`marshal` doesn't do this." -msgstr "" -":mod:`pickle` 會記住哪些物件已經被序列化過了,稍後再次參照到這個物件的時候才不會進行重複的序列化。:mod:`marshal` " -"沒有這個功能。" - -#: ../../library/pickle.rst:63 -msgid "" -"This has implications both for recursive objects and object sharing. " -"Recursive objects are objects that contain references to themselves. These " -"are not handled by marshal, and in fact, attempting to marshal recursive " -"objects will crash your Python interpreter. Object sharing happens when " -"there are multiple references to the same object in different places in the " -"object hierarchy being serialized. :mod:`pickle` stores such objects only " -"once, and ensures that all other references point to the master copy. " -"Shared objects remain shared, which can be very important for mutable " -"objects." -msgstr "" -"這對遞迴物件和物件共用都有影響。遞迴物件是指包含自我參照的物件。這些情況在 marshal 模組中不會被處理,若嘗試使用 marshal " -"處理遞迴物件會導致 Python 直譯器崩潰。物件共用發生在序列化的物件階層中,不同位置對同一物件有多個參照時。:mod:`pickle` " -"只會儲存這個被參照的物件一次,並確保所有其他參照指向這個主要的版本。共用的物件會保持共用,這對於可變(mutable)物件來說非常重要。" - -#: ../../library/pickle.rst:72 -msgid "" -":mod:`marshal` cannot be used to serialize user-defined classes and their " -"instances. :mod:`pickle` can save and restore class instances " -"transparently, however the class definition must be importable and live in " -"the same module as when the object was stored." -msgstr "" -":mod:`marshal` 無法序列化使用者自訂的類別和的實例。:mod:`pickle` " -"則可以讓使用者儲存並還原自訂的類別實例,前提是儲存時該類別的定義存在於與要被儲存的物件所在的模組中、且可以被引入(import)。" - -#: ../../library/pickle.rst:77 -msgid "" -"The :mod:`marshal` serialization format is not guaranteed to be portable " -"across Python versions. Because its primary job in life is to support " -":file:`.pyc` files, the Python implementers reserve the right to change the " -"serialization format in non-backwards compatible ways should the need arise." -" The :mod:`pickle` serialization format is guaranteed to be backwards " -"compatible across Python releases provided a compatible pickle protocol is " -"chosen and pickling and unpickling code deals with Python 2 to Python 3 type" -" differences if your data is crossing that unique breaking change language " -"boundary." -msgstr "" -":mod:`marshal` 序列化格式無法保證能在不同版本的 Python 之間移植。因為其主要的作用是支援 :file:`.pyc` " -"檔案的運作,Python 的實作人員會在需要時實作無法前向相容的序列化方式。但只要選擇了相容的 pickle 協定,且處理了 Python 2 和 " -"Python 3 之間的資料類型差異,:mod:`pickle` 序列化協定能保證在不同 Python 版本間的相容性。" - -#: ../../library/pickle.rst:90 -msgid "Comparison with ``json``" -msgstr "和 ``json`` 的比較" - -#: ../../library/pickle.rst:92 -msgid "" -"There are fundamental differences between the pickle protocols and `JSON " -"(JavaScript Object Notation) `_:" -msgstr "" -"pickle 協定和 `JSON (JavaScript Object Notation) `_ " -"有一些根本上的不同:" - -#: ../../library/pickle.rst:95 -msgid "" -"JSON is a text serialization format (it outputs unicode text, although most " -"of the time it is then encoded to ``utf-8``), while pickle is a binary " -"serialization format;" -msgstr "" -"JSON 以文字形式作為序列化的輸出(輸出 unicode 文字,但大多數又會被編碼為 ``UTF-8``),而 pickle " -"則是以二進位形式作為序列化的輸出;" - -#: ../../library/pickle.rst:99 -msgid "JSON is human-readable, while pickle is not;" -msgstr "JSON 是人類可讀的,而 pickle 則無法;" - -#: ../../library/pickle.rst:101 -msgid "" -"JSON is interoperable and widely used outside of the Python ecosystem, while" -" pickle is Python-specific;" -msgstr "" -"JSON 具有高互通性(interoperability)且在 Python 以外的環境也被大量利用,但 pickle 只能在 Python 內使用。" - -# Skylull: introspection, introspection facilities -# https://zh.wikipedia.org/wiki/%E5%86%85%E7%9C%81_(%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%A7%91%E5%AD%A6) -# https://book.pythontips.com/en/latest/object_introspection.html -# https://www.geeksforgeeks.org/code-introspection-in-python/ -#: ../../library/pickle.rst:104 -msgid "" -"JSON, by default, can only represent a subset of the Python built-in types, " -"and no custom classes; pickle can represent an extremely large number of " -"Python types (many of them automatically, by clever usage of Python's " -"introspection facilities; complex cases can be tackled by implementing " -":ref:`specific object APIs `);" -msgstr "" -"預設狀態下的 JSON 只能紀錄一小部份的 Python 內建型別,且無法紀錄自訂類別;但透過 Python 的自省功能,pickle " -"可以紀錄絕大多數的 Python 型別(其他比較複雜的狀況也可以透過實作 :ref:`specific object APIs ` 來解決);" - -#: ../../library/pickle.rst:110 -msgid "" -"Unlike pickle, deserializing untrusted JSON does not in itself create an " -"arbitrary code execution vulnerability." -msgstr "去序列化不安全的 JSON 不會產生任意程式執行的風險,但去序列化不安全的 pickle 會。" - -#: ../../library/pickle.rst:114 -msgid "" -"The :mod:`json` module: a standard library module allowing JSON " -"serialization and deserialization." -msgstr ":mod:`json` module: 是標準函式庫的一部分,可讓使用者進行 JSON 的序列化與去序列化。" - -#: ../../library/pickle.rst:121 -msgid "Data stream format" -msgstr "資料串流格式" - -#: ../../library/pickle.rst:126 -msgid "" -"The data format used by :mod:`pickle` is Python-specific. This has the " -"advantage that there are no restrictions imposed by external standards such " -"as JSON or XDR (which can't represent pointer sharing); however it means " -"that non-Python programs may not be able to reconstruct pickled Python " -"objects." -msgstr "" -":mod:`pickle` 使用的資料格式是針對 Python 而設計的。好處是他不會受到外部標準(像是 JSON 或 XDR,而 XDR " -"無法紀錄指標共用)的限制;不過這也代表其他不是 Python 的程式可能無法重建 pickle 封裝的 Python 物件。" - -#: ../../library/pickle.rst:131 -msgid "" -"By default, the :mod:`pickle` data format uses a relatively compact binary " -"representation. If you need optimal size characteristics, you can " -"efficiently :doc:`compress ` pickled data." -msgstr "" -"以預設設定來說,:mod:`pickle` 使用相對緊湊的二進位形式來儲存資料。如果你需要盡可能地縮小檔案大小,你可以\\\\ :doc:`壓縮 " -"`\\\\ 封裝的資料。" - -#: ../../library/pickle.rst:135 -msgid "" -"The module :mod:`pickletools` contains tools for analyzing data streams " -"generated by :mod:`pickle`. :mod:`pickletools` source code has extensive " -"comments about opcodes used by pickle protocols." -msgstr "" -":mod:`pickletools` 含有工具可分析 :mod:`pickle` 所產生的資料流。:mod:`pickletools` " -"的源始碼詳細地記載了所有 pickle 協定的操作碼(opcode)。" - -#: ../../library/pickle.rst:139 -msgid "" -"There are currently 6 different protocols which can be used for pickling. " -"The higher the protocol used, the more recent the version of Python needed " -"to read the pickle produced." -msgstr "" -"截至目前為止,共有六種不同版本的協定可用於封裝 pickle。數字越大版本代表你需要使用越新的 Python 版本來拆封相應的 pickle 封裝。" - -#: ../../library/pickle.rst:143 -msgid "" -"Protocol version 0 is the original \"human-readable\" protocol and is " -"backwards compatible with earlier versions of Python." -msgstr "版本 0 的協定是最初「人類可讀」的版本,且可以向前支援早期版本的 Python。" - -#: ../../library/pickle.rst:146 -msgid "" -"Protocol version 1 is an old binary format which is also compatible with " -"earlier versions of Python." -msgstr "版本 1 的協定使用舊的二進位格式,一樣能向前支援早期版本的 Python。" - -#: ../../library/pickle.rst:149 -msgid "" -"Protocol version 2 was introduced in Python 2.3. It provides much more " -"efficient pickling of :term:`new-style classes `. Refer to" -" :pep:`307` for information about improvements brought by protocol 2." -msgstr "" -"版本 2 的協定在 Python 2.3 中初次被引入。其可提供更高效率的 :term:`new-style classes ` 封裝過程。請參閱 :pep:`307` 以了解版本 2 帶來的改進。" - -#: ../../library/pickle.rst:153 -msgid "" -"Protocol version 3 was added in Python 3.0. It has explicit support for " -":class:`bytes` objects and cannot be unpickled by Python 2.x. This was the " -"default protocol in Python 3.0--3.7." -msgstr "" -"版本 3 的協定在 Python 3.0 被新增。現在能支援封裝 :class:`bytes` 的物件且無法被 2.x 版本的 Python 拆封。在 " -"3.0~3.7 的 Python 預設使用 3 版協定。" - -#: ../../library/pickle.rst:157 -msgid "" -"Protocol version 4 was added in Python 3.4. It adds support for very large " -"objects, pickling more kinds of objects, and some data format optimizations." -" It is the default protocol starting with Python 3.8. Refer to :pep:`3154` " -"for information about improvements brought by protocol 4." -msgstr "" -"版本 4 的協定在 Python 3.4 被新增。現在能支援超大物件的封裝、更多種型別的物件以及針對部份資料格式的儲存進行最佳化。從 Python " -"3.8 起,預設使用第 4 版協定。請參閱 :pep:`3154` 以了解第 4 版協定改進的細節。" - -#: ../../library/pickle.rst:163 -msgid "" -"Protocol version 5 was added in Python 3.8. It adds support for out-of-band" -" data and speedup for in-band data. Refer to :pep:`574` for information " -"about improvements brought by protocol 5." -msgstr "" -"版本 5 的協定在 Python 3.8 被新增。現在能支援帶外資料(Out-of-band data)並加速帶內資料的處理速度。請參閱 " -":pep:`574` 以了解第 5 版協定改進的細節。" - -#: ../../library/pickle.rst:168 -msgid "" -"Serialization is a more primitive notion than persistence; although " -":mod:`pickle` reads and writes file objects, it does not handle the issue of" -" naming persistent objects, nor the (even more complicated) issue of " -"concurrent access to persistent objects. The :mod:`pickle` module can " -"transform a complex object into a byte stream and it can transform the byte " -"stream into an object with the same internal structure. Perhaps the most " -"obvious thing to do with these byte streams is to write them onto a file, " -"but it is also conceivable to send them across a network or store them in a " -"database. The :mod:`shelve` module provides a simple interface to pickle " -"and unpickle objects on DBM-style database files." -msgstr "" -"資料序列化是一個比資料持久化更早出現的概念;雖然 :mod:`pickle` " -"可以讀寫檔案物件,但它並不處理命名持久物件的問題,也不處理對持久物件的並行存取、一個更棘手的問題。:mod:`pickle` " -"模組可以將複雜物件轉換成位元組串流,也可以將位元組串流轉換回具有相同原始內部結構的物件。對這些位元組串流最常見的處理方式是將它們寫入檔案中,但也可以將它們透過網路傳送或儲存在一個資料庫中。:mod:`shelve`" -" 模組提供了一個簡單的介面來讓使用者在 DBM 風格的資料庫檔案中對物件進行封裝和拆封的操作。" - -#: ../../library/pickle.rst:181 -msgid "Module Interface" -msgstr "模組介面" - -#: ../../library/pickle.rst:183 -msgid "" -"To serialize an object hierarchy, you simply call the :func:`dumps` " -"function. Similarly, to de-serialize a data stream, you call the " -":func:`loads` function. However, if you want more control over serialization" -" and de-serialization, you can create a :class:`Pickler` or an " -":class:`Unpickler` object, respectively." -msgstr "" -"想要序列化一個物件,你只需要呼叫 :func:`dumps` 函數。而當你想要去序列化一個資料流時,你只需要呼叫 :func:`loads` " -"即可。不過,若你希望能各自對序列化和去序列化的過程中有更多的掌控度,你可以自訂一個 :class:`Pickler` 或 " -":class:`Unpickler` 物件。" - -#: ../../library/pickle.rst:188 -msgid "The :mod:`pickle` module provides the following constants:" -msgstr ":mod:`pickle` 模組提供以下常數:" - -#: ../../library/pickle.rst:193 -msgid "" -"An integer, the highest :ref:`protocol version ` " -"available. This value can be passed as a *protocol* value to functions " -":func:`dump` and :func:`dumps` as well as the :class:`Pickler` constructor." -msgstr "" -"一個整數,表示可使用的最高\\\\ :ref:`協定版本 `。這個值可作為 *protocol* 的數值傳給 " -":func:`dump` 和 :func:`dumps` 函數以及 :class:`Pickler` 建構式。" - -#: ../../library/pickle.rst:200 -msgid "" -"An integer, the default :ref:`protocol version ` used for " -"pickling. May be less than :data:`HIGHEST_PROTOCOL`. Currently the default" -" protocol is 4, first introduced in Python 3.4 and incompatible with " -"previous versions." -msgstr "" -"一個整數,指示用於序列化的預設\\\\ :ref:`協定版本 `。有可能小於 " -":data:`HIGHEST_PROTOCOL`。目前的預設協定版本為 4,是在 Python 3.4 中首次引入的,且與先前版本不相容。" - -#: ../../library/pickle.rst:207 -msgid "The default protocol is 3." -msgstr "預設協定版本為 3。" - -#: ../../library/pickle.rst:211 -msgid "The default protocol is 4." -msgstr "預設協定版本為 4。" - -#: ../../library/pickle.rst:213 -msgid "" -"The :mod:`pickle` module provides the following functions to make the " -"pickling process more convenient:" -msgstr ":mod:`pickle` 模組提供下列函數來簡化封裝的過程:" - -#: ../../library/pickle.rst:218 -msgid "" -"Write the pickled representation of the object *obj* to the open :term:`file" -" object` *file*. This is equivalent to ``Pickler(file, " -"protocol).dump(obj)``." -msgstr "" - -#: ../../library/pickle.rst:222 -msgid "" -"Arguments *file*, *protocol*, *fix_imports* and *buffer_callback* have the " -"same meaning as in the :class:`Pickler` constructor." -msgstr "" - -#: ../../library/pickle.rst:225 ../../library/pickle.rst:236 -#: ../../library/pickle.rst:328 -msgid "The *buffer_callback* argument was added." -msgstr "新增 *buffer_callback* 引數。" - -#: ../../library/pickle.rst:230 -msgid "" -"Return the pickled representation of the object *obj* as a :class:`bytes` " -"object, instead of writing it to a file." -msgstr "" - -#: ../../library/pickle.rst:233 -msgid "" -"Arguments *protocol*, *fix_imports* and *buffer_callback* have the same " -"meaning as in the :class:`Pickler` constructor." -msgstr "" - -#: ../../library/pickle.rst:241 -msgid "" -"Read the pickled representation of an object from the open :term:`file " -"object` *file* and return the reconstituted object hierarchy specified " -"therein. This is equivalent to ``Unpickler(file).load()``." -msgstr "" - -#: ../../library/pickle.rst:245 ../../library/pickle.rst:260 -msgid "" -"The protocol version of the pickle is detected automatically, so no protocol" -" argument is needed. Bytes past the pickled representation of the object " -"are ignored." -msgstr "" - -#: ../../library/pickle.rst:249 -msgid "" -"Arguments *file*, *fix_imports*, *encoding*, *errors*, *strict* and " -"*buffers* have the same meaning as in the :class:`Unpickler` constructor." -msgstr "" - -#: ../../library/pickle.rst:252 ../../library/pickle.rst:267 -#: ../../library/pickle.rst:429 -msgid "The *buffers* argument was added." -msgstr "新增 *buffer* 引數。" - -#: ../../library/pickle.rst:257 -msgid "" -"Return the reconstituted object hierarchy of the pickled representation " -"*data* of an object. *data* must be a :term:`bytes-like object`." -msgstr "" - -#: ../../library/pickle.rst:264 -msgid "" -"Arguments *fix_imports*, *encoding*, *errors*, *strict* and *buffers* have " -"the same meaning as in the :class:`Unpickler` constructor." -msgstr "" - -#: ../../library/pickle.rst:271 -msgid "The :mod:`pickle` module defines three exceptions:" -msgstr "" - -#: ../../library/pickle.rst:275 -msgid "" -"Common base class for the other pickling exceptions. It inherits from " -":exc:`Exception`." -msgstr "" - -#: ../../library/pickle.rst:280 -msgid "" -"Error raised when an unpicklable object is encountered by :class:`Pickler`. " -"It inherits from :exc:`PickleError`." -msgstr "" - -#: ../../library/pickle.rst:283 -msgid "" -"Refer to :ref:`pickle-picklable` to learn what kinds of objects can be " -"pickled." -msgstr "" - -#: ../../library/pickle.rst:288 -msgid "" -"Error raised when there is a problem unpickling an object, such as a data " -"corruption or a security violation. It inherits from :exc:`PickleError`." -msgstr "" - -#: ../../library/pickle.rst:291 -msgid "" -"Note that other exceptions may also be raised during unpickling, including " -"(but not necessarily limited to) AttributeError, EOFError, ImportError, and " -"IndexError." -msgstr "" - -#: ../../library/pickle.rst:296 -msgid "" -"The :mod:`pickle` module exports three classes, :class:`Pickler`, " -":class:`Unpickler` and :class:`PickleBuffer`:" -msgstr "" - -#: ../../library/pickle.rst:301 -msgid "This takes a binary file for writing a pickle data stream." -msgstr "" - -#: ../../library/pickle.rst:303 -msgid "" -"The optional *protocol* argument, an integer, tells the pickler to use the " -"given protocol; supported protocols are 0 to :data:`HIGHEST_PROTOCOL`. If " -"not specified, the default is :data:`DEFAULT_PROTOCOL`. If a negative " -"number is specified, :data:`HIGHEST_PROTOCOL` is selected." -msgstr "" - -#: ../../library/pickle.rst:308 -msgid "" -"The *file* argument must have a write() method that accepts a single bytes " -"argument. It can thus be an on-disk file opened for binary writing, an " -":class:`io.BytesIO` instance, or any other custom object that meets this " -"interface." -msgstr "" - -#: ../../library/pickle.rst:313 -msgid "" -"If *fix_imports* is true and *protocol* is less than 3, pickle will try to " -"map the new Python 3 names to the old module names used in Python 2, so that" -" the pickle data stream is readable with Python 2." -msgstr "" - -#: ../../library/pickle.rst:317 -msgid "" -"If *buffer_callback* is ``None`` (the default), buffer views are serialized " -"into *file* as part of the pickle stream." -msgstr "" - -#: ../../library/pickle.rst:320 -msgid "" -"If *buffer_callback* is not ``None``, then it can be called any number of " -"times with a buffer view. If the callback returns a false value (such as " -"``None``), the given buffer is :ref:`out-of-band `; otherwise " -"the buffer is serialized in-band, i.e. inside the pickle stream." -msgstr "" - -#: ../../library/pickle.rst:325 -msgid "" -"It is an error if *buffer_callback* is not ``None`` and *protocol* is " -"``None`` or smaller than 5." -msgstr "" - -#: ../../library/pickle.rst:333 -msgid "" -"Write the pickled representation of *obj* to the open file object given in " -"the constructor." -msgstr "" - -#: ../../library/pickle.rst:338 -msgid "Do nothing by default. This exists so a subclass can override it." -msgstr "" - -#: ../../library/pickle.rst:340 -msgid "" -"If :meth:`persistent_id` returns ``None``, *obj* is pickled as usual. Any " -"other value causes :class:`Pickler` to emit the returned value as a " -"persistent ID for *obj*. The meaning of this persistent ID should be " -"defined by :meth:`Unpickler.persistent_load`. Note that the value returned " -"by :meth:`persistent_id` cannot itself have a persistent ID." -msgstr "" - -#: ../../library/pickle.rst:346 ../../library/pickle.rst:447 -msgid "See :ref:`pickle-persistent` for details and examples of uses." -msgstr "關於細節與用法範例請見 :ref:`pickle-persistent`。" - -#: ../../library/pickle.rst:350 -msgid "" -"A pickler object's dispatch table is a registry of *reduction functions* of " -"the kind which can be declared using :func:`copyreg.pickle`. It is a " -"mapping whose keys are classes and whose values are reduction functions. A " -"reduction function takes a single argument of the associated class and " -"should conform to the same interface as a :meth:`~object.__reduce__` method." -msgstr "" - -#: ../../library/pickle.rst:358 -msgid "" -"By default, a pickler object will not have a :attr:`dispatch_table` " -"attribute, and it will instead use the global dispatch table managed by the " -":mod:`copyreg` module. However, to customize the pickling for a specific " -"pickler object one can set the :attr:`dispatch_table` attribute to a dict-" -"like object. Alternatively, if a subclass of :class:`Pickler` has a " -":attr:`dispatch_table` attribute then this will be used as the default " -"dispatch table for instances of that class." -msgstr "" - -#: ../../library/pickle.rst:367 -msgid "See :ref:`pickle-dispatch` for usage examples." -msgstr "關於用法範例請見 :ref:`pickle-dispatch`。" - -#: ../../library/pickle.rst:373 -msgid "" -"Special reducer that can be defined in :class:`Pickler` subclasses. This " -"method has priority over any reducer in the :attr:`dispatch_table`. It " -"should conform to the same interface as a :meth:`~object.__reduce__` method," -" and can optionally return :data:`NotImplemented` to fallback on " -":attr:`dispatch_table`-registered reducers to pickle ``obj``." -msgstr "" - -#: ../../library/pickle.rst:379 -msgid "For a detailed example, see :ref:`reducer_override`." -msgstr "" - -#: ../../library/pickle.rst:385 -msgid "" -"Deprecated. Enable fast mode if set to a true value. The fast mode disables" -" the usage of memo, therefore speeding the pickling process by not " -"generating superfluous PUT opcodes. It should not be used with self-" -"referential objects, doing otherwise will cause :class:`Pickler` to recurse " -"infinitely." -msgstr "" - -#: ../../library/pickle.rst:391 -msgid "Use :func:`pickletools.optimize` if you need more compact pickles." -msgstr "" - -#: ../../library/pickle.rst:396 -msgid "This takes a binary file for reading a pickle data stream." -msgstr "" - -#: ../../library/pickle.rst:398 -msgid "" -"The protocol version of the pickle is detected automatically, so no protocol" -" argument is needed." -msgstr "" - -#: ../../library/pickle.rst:401 -msgid "" -"The argument *file* must have three methods, a read() method that takes an " -"integer argument, a readinto() method that takes a buffer argument and a " -"readline() method that requires no arguments, as in the " -":class:`io.BufferedIOBase` interface. Thus *file* can be an on-disk file " -"opened for binary reading, an :class:`io.BytesIO` object, or any other " -"custom object that meets this interface." -msgstr "" - -#: ../../library/pickle.rst:408 -msgid "" -"The optional arguments *fix_imports*, *encoding* and *errors* are used to " -"control compatibility support for pickle stream generated by Python 2. If " -"*fix_imports* is true, pickle will try to map the old Python 2 names to the " -"new names used in Python 3. The *encoding* and *errors* tell pickle how to " -"decode 8-bit string instances pickled by Python 2; these default to 'ASCII' " -"and 'strict', respectively. The *encoding* can be 'bytes' to read these " -"8-bit string instances as bytes objects. Using ``encoding='latin1'`` is " -"required for unpickling NumPy arrays and instances of " -":class:`~datetime.datetime`, :class:`~datetime.date` and " -":class:`~datetime.time` pickled by Python 2." -msgstr "" - -#: ../../library/pickle.rst:419 -msgid "" -"If *buffers* is ``None`` (the default), then all data necessary for " -"deserialization must be contained in the pickle stream. This means that the" -" *buffer_callback* argument was ``None`` when a :class:`Pickler` was " -"instantiated (or when :func:`dump` or :func:`dumps` was called)." -msgstr "" - -#: ../../library/pickle.rst:424 -msgid "" -"If *buffers* is not ``None``, it should be an iterable of buffer-enabled " -"objects that is consumed each time the pickle stream references an " -":ref:`out-of-band ` buffer view. Such buffers have been given " -"in order to the *buffer_callback* of a Pickler object." -msgstr "" - -#: ../../library/pickle.rst:434 -msgid "" -"Read the pickled representation of an object from the open file object given" -" in the constructor, and return the reconstituted object hierarchy specified" -" therein. Bytes past the pickled representation of the object are ignored." -msgstr "" - -#: ../../library/pickle.rst:441 -msgid "Raise an :exc:`UnpicklingError` by default." -msgstr "" - -#: ../../library/pickle.rst:443 -msgid "" -"If defined, :meth:`persistent_load` should return the object specified by " -"the persistent ID *pid*. If an invalid persistent ID is encountered, an " -":exc:`UnpicklingError` should be raised." -msgstr "" - -#: ../../library/pickle.rst:451 -msgid "" -"Import *module* if necessary and return the object called *name* from it, " -"where the *module* and *name* arguments are :class:`str` objects. Note, " -"unlike its name suggests, :meth:`find_class` is also used for finding " -"functions." -msgstr "" - -#: ../../library/pickle.rst:456 -msgid "" -"Subclasses may override this to gain control over what type of objects and " -"how they can be loaded, potentially reducing security risks. Refer to " -":ref:`pickle-restrict` for details." -msgstr "" - -#: ../../library/pickle.rst:460 -msgid "" -"Raises an :ref:`auditing event ` ``pickle.find_class`` with " -"arguments ``module``, ``name``." -msgstr "" -"引發一個附帶引數 ``module``、``name`` 的\\ :ref:`稽核事件 ` " -"``pickle.find_class``。" - -#: ../../library/pickle.rst:464 -msgid "" -"A wrapper for a buffer representing picklable data. *buffer* must be a " -":ref:`buffer-providing ` object, such as a :term:`bytes-like " -"object` or a N-dimensional array." -msgstr "" - -#: ../../library/pickle.rst:468 -msgid "" -":class:`PickleBuffer` is itself a buffer provider, therefore it is possible " -"to pass it to other APIs expecting a buffer-providing object, such as " -":class:`memoryview`." -msgstr "" - -#: ../../library/pickle.rst:472 -msgid "" -":class:`PickleBuffer` objects can only be serialized using pickle protocol 5" -" or higher. They are eligible for :ref:`out-of-band serialization `." -msgstr "" - -#: ../../library/pickle.rst:480 -msgid "" -"Return a :class:`memoryview` of the memory area underlying this buffer. The " -"returned object is a one-dimensional, C-contiguous memoryview with format " -"``B`` (unsigned bytes). :exc:`BufferError` is raised if the buffer is " -"neither C- nor Fortran-contiguous." -msgstr "" - -#: ../../library/pickle.rst:487 -msgid "Release the underlying buffer exposed by the PickleBuffer object." -msgstr "" - -#: ../../library/pickle.rst:493 -msgid "What can be pickled and unpickled?" -msgstr "" - -#: ../../library/pickle.rst:495 -msgid "The following types can be pickled:" -msgstr "" - -#: ../../library/pickle.rst:497 -msgid "" -"built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, and " -":data:`NotImplemented`);" -msgstr "" - -#: ../../library/pickle.rst:500 -msgid "integers, floating-point numbers, complex numbers;" -msgstr "" - -#: ../../library/pickle.rst:502 -msgid "strings, bytes, bytearrays;" -msgstr "" - -#: ../../library/pickle.rst:504 -msgid "" -"tuples, lists, sets, and dictionaries containing only picklable objects;" -msgstr "" - -#: ../../library/pickle.rst:506 -msgid "" -"functions (built-in and user-defined) accessible from the top level of a " -"module (using :keyword:`def`, not :keyword:`lambda`);" -msgstr "" - -#: ../../library/pickle.rst:509 -msgid "classes accessible from the top level of a module;" -msgstr "" - -#: ../../library/pickle.rst:511 -msgid "" -"instances of such classes whose the result of calling " -":meth:`~object.__getstate__` is picklable (see section :ref:`pickle-inst` " -"for details)." -msgstr "" - -#: ../../library/pickle.rst:514 -msgid "" -"Attempts to pickle unpicklable objects will raise the :exc:`PicklingError` " -"exception; when this happens, an unspecified number of bytes may have " -"already been written to the underlying file. Trying to pickle a highly " -"recursive data structure may exceed the maximum recursion depth, a " -":exc:`RecursionError` will be raised in this case. You can carefully raise " -"this limit with :func:`sys.setrecursionlimit`." -msgstr "" - -#: ../../library/pickle.rst:521 -msgid "" -"Note that functions (built-in and user-defined) are pickled by fully " -":term:`qualified name`, not by value. [#]_ This means that only the " -"function name is pickled, along with the name of the containing module and " -"classes. Neither the function's code, nor any of its function attributes " -"are pickled. Thus the defining module must be importable in the unpickling " -"environment, and the module must contain the named object, otherwise an " -"exception will be raised. [#]_" -msgstr "" - -#: ../../library/pickle.rst:528 -msgid "" -"Similarly, classes are pickled by fully qualified name, so the same " -"restrictions in the unpickling environment apply. Note that none of the " -"class's code or data is pickled, so in the following example the class " -"attribute ``attr`` is not restored in the unpickling environment::" -msgstr "" - -#: ../../library/pickle.rst:538 -msgid "" -"These restrictions are why picklable functions and classes must be defined " -"at the top level of a module." -msgstr "" - -#: ../../library/pickle.rst:541 -msgid "" -"Similarly, when class instances are pickled, their class's code and data are" -" not pickled along with them. Only the instance data are pickled. This is " -"done on purpose, so you can fix bugs in a class or add methods to the class " -"and still load objects that were created with an earlier version of the " -"class. If you plan to have long-lived objects that will see many versions " -"of a class, it may be worthwhile to put a version number in the objects so " -"that suitable conversions can be made by the class's " -":meth:`~object.__setstate__` method." -msgstr "" - -#: ../../library/pickle.rst:553 -msgid "Pickling Class Instances" -msgstr "" - -#: ../../library/pickle.rst:557 -msgid "" -"In this section, we describe the general mechanisms available to you to " -"define, customize, and control how class instances are pickled and " -"unpickled." -msgstr "" - -#: ../../library/pickle.rst:560 -msgid "" -"In most cases, no additional code is needed to make instances picklable. By" -" default, pickle will retrieve the class and the attributes of an instance " -"via introspection. When a class instance is unpickled, its " -":meth:`~object.__init__` method is usually *not* invoked. The default " -"behaviour first creates an uninitialized instance and then restores the " -"saved attributes. The following code shows an implementation of this " -"behaviour::" -msgstr "" - -#: ../../library/pickle.rst:575 -msgid "" -"Classes can alter the default behaviour by providing one or several special " -"methods:" -msgstr "" - -#: ../../library/pickle.rst:580 -msgid "" -"In protocols 2 and newer, classes that implements the " -":meth:`__getnewargs_ex__` method can dictate the values passed to the " -":meth:`__new__` method upon unpickling. The method must return a pair " -"``(args, kwargs)`` where *args* is a tuple of positional arguments and " -"*kwargs* a dictionary of named arguments for constructing the object. Those" -" will be passed to the :meth:`__new__` method upon unpickling." -msgstr "" - -#: ../../library/pickle.rst:588 -msgid "" -"You should implement this method if the :meth:`__new__` method of your class" -" requires keyword-only arguments. Otherwise, it is recommended for " -"compatibility to implement :meth:`__getnewargs__`." -msgstr "" - -#: ../../library/pickle.rst:592 -msgid ":meth:`__getnewargs_ex__` is now used in protocols 2 and 3." -msgstr "" - -#: ../../library/pickle.rst:598 -msgid "" -"This method serves a similar purpose as :meth:`__getnewargs_ex__`, but " -"supports only positional arguments. It must return a tuple of arguments " -"``args`` which will be passed to the :meth:`__new__` method upon unpickling." -msgstr "" - -#: ../../library/pickle.rst:602 -msgid "" -":meth:`__getnewargs__` will not be called if :meth:`__getnewargs_ex__` is " -"defined." -msgstr "" - -#: ../../library/pickle.rst:605 -msgid "" -"Before Python 3.6, :meth:`__getnewargs__` was called instead of " -":meth:`__getnewargs_ex__` in protocols 2 and 3." -msgstr "" - -#: ../../library/pickle.rst:612 -msgid "" -"Classes can further influence how their instances are pickled by overriding " -"the method :meth:`__getstate__`. It is called and the returned object is " -"pickled as the contents for the instance, instead of a default state. There " -"are several cases:" -msgstr "" - -#: ../../library/pickle.rst:617 -msgid "" -"For a class that has no instance :attr:`~object.__dict__` and no " -":attr:`~object.__slots__`, the default state is ``None``." -msgstr "" - -#: ../../library/pickle.rst:620 -msgid "" -"For a class that has an instance :attr:`~object.__dict__` and no " -":attr:`~object.__slots__`, the default state is ``self.__dict__``." -msgstr "" - -#: ../../library/pickle.rst:623 -msgid "" -"For a class that has an instance :attr:`~object.__dict__` and " -":attr:`~object.__slots__`, the default state is a tuple consisting of two " -"dictionaries: ``self.__dict__``, and a dictionary mapping slot names to " -"slot values. Only slots that have a value are included in the latter." -msgstr "" - -#: ../../library/pickle.rst:629 -msgid "" -"For a class that has :attr:`~object.__slots__` and no instance " -":attr:`~object.__dict__`, the default state is a tuple whose first item is " -"``None`` and whose second item is a dictionary mapping slot names to slot " -"values described in the previous bullet." -msgstr "" - -#: ../../library/pickle.rst:634 -msgid "" -"Added the default implementation of the ``__getstate__()`` method in the " -":class:`object` class." -msgstr "" - -#: ../../library/pickle.rst:641 -msgid "" -"Upon unpickling, if the class defines :meth:`__setstate__`, it is called " -"with the unpickled state. In that case, there is no requirement for the " -"state object to be a dictionary. Otherwise, the pickled state must be a " -"dictionary and its items are assigned to the new instance's dictionary." -msgstr "" - -#: ../../library/pickle.rst:648 -msgid "" -"If :meth:`__reduce__` returns a state with value ``None`` at pickling, the " -":meth:`__setstate__` method will not be called upon unpickling." -msgstr "" - -#: ../../library/pickle.rst:652 -msgid "" -"Refer to the section :ref:`pickle-state` for more information about how to " -"use the methods :meth:`~object.__getstate__` and " -":meth:`~object.__setstate__`." -msgstr "" - -#: ../../library/pickle.rst:657 -msgid "" -"At unpickling time, some methods like :meth:`~object.__getattr__`, " -":meth:`~object.__getattribute__`, or :meth:`~object.__setattr__` may be " -"called upon the instance. In case those methods rely on some internal " -"invariant being true, the type should implement :meth:`~object.__new__` to " -"establish such an invariant, as :meth:`~object.__init__` is not called when " -"unpickling an instance." -msgstr "" - -#: ../../library/pickle.rst:666 -msgid "" -"As we shall see, pickle does not use directly the methods described above. " -"In fact, these methods are part of the copy protocol which implements the " -":meth:`~object.__reduce__` special method. The copy protocol provides a " -"unified interface for retrieving the data necessary for pickling and copying" -" objects. [#]_" -msgstr "" - -#: ../../library/pickle.rst:672 -msgid "" -"Although powerful, implementing :meth:`~object.__reduce__` directly in your " -"classes is error prone. For this reason, class designers should use the " -"high-level interface (i.e., :meth:`~object.__getnewargs_ex__`, " -":meth:`~object.__getstate__` and :meth:`~object.__setstate__`) whenever " -"possible. We will show, however, cases where using :meth:`!__reduce__` is " -"the only option or leads to more efficient pickling or both." -msgstr "" - -#: ../../library/pickle.rst:681 -msgid "" -"The interface is currently defined as follows. The :meth:`__reduce__` " -"method takes no argument and shall return either a string or preferably a " -"tuple (the returned object is often referred to as the \"reduce value\")." -msgstr "" - -#: ../../library/pickle.rst:685 -msgid "" -"If a string is returned, the string should be interpreted as the name of a " -"global variable. It should be the object's local name relative to its " -"module; the pickle module searches the module namespace to determine the " -"object's module. This behaviour is typically useful for singletons." -msgstr "" - -#: ../../library/pickle.rst:690 -msgid "" -"When a tuple is returned, it must be between two and six items long. " -"Optional items can either be omitted, or ``None`` can be provided as their " -"value. The semantics of each item are in order:" -msgstr "" - -#: ../../library/pickle.rst:696 -msgid "" -"A callable object that will be called to create the initial version of the " -"object." -msgstr "" - -#: ../../library/pickle.rst:699 -msgid "" -"A tuple of arguments for the callable object. An empty tuple must be given " -"if the callable does not accept any argument." -msgstr "" - -#: ../../library/pickle.rst:702 -msgid "" -"Optionally, the object's state, which will be passed to the object's " -":meth:`__setstate__` method as previously described. If the object has no " -"such method then, the value must be a dictionary and it will be added to the" -" object's :attr:`~object.__dict__` attribute." -msgstr "" - -#: ../../library/pickle.rst:707 -msgid "" -"Optionally, an iterator (and not a sequence) yielding successive items. " -"These items will be appended to the object either using ``obj.append(item)``" -" or, in batch, using ``obj.extend(list_of_items)``. This is primarily used " -"for list subclasses, but may be used by other classes as long as they have " -":ref:`append and extend methods ` with the appropriate " -"signature. (Whether :meth:`!append` or :meth:`!extend` is used depends on " -"which pickle protocol version is used as well as the number of items to " -"append, so both must be supported.)" -msgstr "" - -#: ../../library/pickle.rst:717 -msgid "" -"Optionally, an iterator (not a sequence) yielding successive key-value " -"pairs. These items will be stored to the object using ``obj[key] = value``." -" This is primarily used for dictionary subclasses, but may be used by other" -" classes as long as they implement :meth:`__setitem__`." -msgstr "" - -#: ../../library/pickle.rst:722 -msgid "" -"Optionally, a callable with a ``(obj, state)`` signature. This callable " -"allows the user to programmatically control the state-updating behavior of a" -" specific object, instead of using ``obj``'s static :meth:`__setstate__` " -"method. If not ``None``, this callable will have priority over ``obj``'s " -":meth:`__setstate__`." -msgstr "" - -#: ../../library/pickle.rst:728 -msgid "The optional sixth tuple item, ``(obj, state)``, was added." -msgstr "" - -#: ../../library/pickle.rst:734 -msgid "" -"Alternatively, a :meth:`__reduce_ex__` method may be defined. The only " -"difference is this method should take a single integer argument, the " -"protocol version. When defined, pickle will prefer it over the " -":meth:`__reduce__` method. In addition, :meth:`__reduce__` automatically " -"becomes a synonym for the extended version. The main use for this method is" -" to provide backwards-compatible reduce values for older Python releases." -msgstr "" - -#: ../../library/pickle.rst:746 -msgid "Persistence of External Objects" -msgstr "" - -#: ../../library/pickle.rst:752 -msgid "" -"For the benefit of object persistence, the :mod:`pickle` module supports the" -" notion of a reference to an object outside the pickled data stream. Such " -"objects are referenced by a persistent ID, which should be either a string " -"of alphanumeric characters (for protocol 0) [#]_ or just an arbitrary object" -" (for any newer protocol)." -msgstr "" - -#: ../../library/pickle.rst:758 -msgid "" -"The resolution of such persistent IDs is not defined by the :mod:`pickle` " -"module; it will delegate this resolution to the user-defined methods on the " -"pickler and unpickler, :meth:`~Pickler.persistent_id` and " -":meth:`~Unpickler.persistent_load` respectively." -msgstr "" - -#: ../../library/pickle.rst:763 -msgid "" -"To pickle objects that have an external persistent ID, the pickler must have" -" a custom :meth:`~Pickler.persistent_id` method that takes an object as an " -"argument and returns either ``None`` or the persistent ID for that object. " -"When ``None`` is returned, the pickler simply pickles the object as normal. " -"When a persistent ID string is returned, the pickler will pickle that " -"object, along with a marker so that the unpickler will recognize it as a " -"persistent ID." -msgstr "" - -#: ../../library/pickle.rst:770 -msgid "" -"To unpickle external objects, the unpickler must have a custom " -":meth:`~Unpickler.persistent_load` method that takes a persistent ID object " -"and returns the referenced object." -msgstr "" - -#: ../../library/pickle.rst:774 -msgid "" -"Here is a comprehensive example presenting how persistent ID can be used to " -"pickle external objects by reference." -msgstr "" - -#: ../../library/pickle.rst:782 -msgid "Dispatch Tables" -msgstr "" - -#: ../../library/pickle.rst:784 -msgid "" -"If one wants to customize pickling of some classes without disturbing any " -"other code which depends on pickling, then one can create a pickler with a " -"private dispatch table." -msgstr "" - -#: ../../library/pickle.rst:788 -msgid "" -"The global dispatch table managed by the :mod:`copyreg` module is available " -"as :data:`!copyreg.dispatch_table`. Therefore, one may choose to use a " -"modified copy of :data:`!copyreg.dispatch_table` as a private dispatch " -"table." -msgstr "" - -#: ../../library/pickle.rst:793 -msgid "For example ::" -msgstr "舉例來說: ::" - -#: ../../library/pickle.rst:800 -msgid "" -"creates an instance of :class:`pickle.Pickler` with a private dispatch table" -" which handles the ``SomeClass`` class specially. Alternatively, the code " -"::" -msgstr "" - -#: ../../library/pickle.rst:810 -msgid "" -"does the same but all instances of ``MyPickler`` will by default share the " -"private dispatch table. On the other hand, the code ::" -msgstr "" - -#: ../../library/pickle.rst:817 -msgid "" -"modifies the global dispatch table shared by all users of the :mod:`copyreg`" -" module." -msgstr "" - -#: ../../library/pickle.rst:822 -msgid "Handling Stateful Objects" -msgstr "" - -#: ../../library/pickle.rst:828 -msgid "" -"Here's an example that shows how to modify pickling behavior for a class. " -"The :class:`!TextReader` class below opens a text file, and returns the line" -" number and line contents each time its :meth:`!readline` method is called. " -"If a :class:`!TextReader` instance is pickled, all attributes *except* the " -"file object member are saved. When the instance is unpickled, the file is " -"reopened, and reading resumes from the last location. The " -":meth:`!__setstate__` and :meth:`!__getstate__` methods are used to " -"implement this behavior. ::" -msgstr "" - -#: ../../library/pickle.rst:874 -msgid "A sample usage might be something like this::" -msgstr "" - -#: ../../library/pickle.rst:888 -msgid "Custom Reduction for Types, Functions, and Other Objects" -msgstr "" - -#: ../../library/pickle.rst:892 -msgid "" -"Sometimes, :attr:`~Pickler.dispatch_table` may not be flexible enough. In " -"particular we may want to customize pickling based on another criterion than" -" the object's type, or we may want to customize the pickling of functions " -"and classes." -msgstr "" - -#: ../../library/pickle.rst:897 -msgid "" -"For those cases, it is possible to subclass from the :class:`Pickler` class " -"and implement a :meth:`~Pickler.reducer_override` method. This method can " -"return an arbitrary reduction tuple (see :meth:`~object.__reduce__`). It can" -" alternatively return :data:`NotImplemented` to fallback to the traditional " -"behavior." -msgstr "" - -#: ../../library/pickle.rst:902 -msgid "" -"If both the :attr:`~Pickler.dispatch_table` and " -":meth:`~Pickler.reducer_override` are defined, then " -":meth:`~Pickler.reducer_override` method takes priority." -msgstr "" - -#: ../../library/pickle.rst:907 -msgid "" -"For performance reasons, :meth:`~Pickler.reducer_override` may not be called" -" for the following objects: ``None``, ``True``, ``False``, and exact " -"instances of :class:`int`, :class:`float`, :class:`bytes`, :class:`str`, " -":class:`dict`, :class:`set`, :class:`frozenset`, :class:`list` and " -":class:`tuple`." -msgstr "" - -#: ../../library/pickle.rst:913 -msgid "" -"Here is a simple example where we allow pickling and reconstructing a given " -"class::" -msgstr "" - -#: ../../library/pickle.rst:948 -msgid "Out-of-band Buffers" -msgstr "" - -#: ../../library/pickle.rst:952 -msgid "" -"In some contexts, the :mod:`pickle` module is used to transfer massive " -"amounts of data. Therefore, it can be important to minimize the number of " -"memory copies, to preserve performance and resource consumption. However, " -"normal operation of the :mod:`pickle` module, as it transforms a graph-like " -"structure of objects into a sequential stream of bytes, intrinsically " -"involves copying data to and from the pickle stream." -msgstr "" - -#: ../../library/pickle.rst:959 -msgid "" -"This constraint can be eschewed if both the *provider* (the implementation " -"of the object types to be transferred) and the *consumer* (the " -"implementation of the communications system) support the out-of-band " -"transfer facilities provided by pickle protocol 5 and higher." -msgstr "" - -#: ../../library/pickle.rst:965 -msgid "Provider API" -msgstr "" - -#: ../../library/pickle.rst:967 -msgid "" -"The large data objects to be pickled must implement a " -":meth:`~object.__reduce_ex__` method specialized for protocol 5 and higher, " -"which returns a :class:`PickleBuffer` instance (instead of e.g. a " -":class:`bytes` object) for any large data." -msgstr "" - -#: ../../library/pickle.rst:972 -msgid "" -"A :class:`PickleBuffer` object *signals* that the underlying buffer is " -"eligible for out-of-band data transfer. Those objects remain compatible " -"with normal usage of the :mod:`pickle` module. However, consumers can also " -"opt-in to tell :mod:`pickle` that they will handle those buffers by " -"themselves." -msgstr "" - -#: ../../library/pickle.rst:979 -msgid "Consumer API" -msgstr "" - -#: ../../library/pickle.rst:981 -msgid "" -"A communications system can enable custom handling of the " -":class:`PickleBuffer` objects generated when serializing an object graph." -msgstr "" - -#: ../../library/pickle.rst:984 -msgid "" -"On the sending side, it needs to pass a *buffer_callback* argument to " -":class:`Pickler` (or to the :func:`dump` or :func:`dumps` function), which " -"will be called with each :class:`PickleBuffer` generated while pickling the " -"object graph. Buffers accumulated by the *buffer_callback* will not see " -"their data copied into the pickle stream, only a cheap marker will be " -"inserted." -msgstr "" - -#: ../../library/pickle.rst:991 -msgid "" -"On the receiving side, it needs to pass a *buffers* argument to " -":class:`Unpickler` (or to the :func:`load` or :func:`loads` function), which" -" is an iterable of the buffers which were passed to *buffer_callback*. That " -"iterable should produce buffers in the same order as they were passed to " -"*buffer_callback*. Those buffers will provide the data expected by the " -"reconstructors of the objects whose pickling produced the original " -":class:`PickleBuffer` objects." -msgstr "" - -#: ../../library/pickle.rst:999 -msgid "" -"Between the sending side and the receiving side, the communications system " -"is free to implement its own transfer mechanism for out-of-band buffers. " -"Potential optimizations include the use of shared memory or datatype-" -"dependent compression." -msgstr "" - -#: ../../library/pickle.rst:1005 -msgid "Example" -msgstr "範例" - -#: ../../library/pickle.rst:1007 -msgid "" -"Here is a trivial example where we implement a :class:`bytearray` subclass " -"able to participate in out-of-band buffer pickling::" -msgstr "" - -#: ../../library/pickle.rst:1031 -msgid "" -"The reconstructor (the ``_reconstruct`` class method) returns the buffer's " -"providing object if it has the right type. This is an easy way to simulate " -"zero-copy behaviour on this toy example." -msgstr "" - -#: ../../library/pickle.rst:1035 -msgid "" -"On the consumer side, we can pickle those objects the usual way, which when " -"unserialized will give us a copy of the original object::" -msgstr "" - -#: ../../library/pickle.rst:1044 -msgid "" -"But if we pass a *buffer_callback* and then give back the accumulated " -"buffers when unserializing, we are able to get back the original object::" -msgstr "" - -#: ../../library/pickle.rst:1054 -msgid "" -"This example is limited by the fact that :class:`bytearray` allocates its " -"own memory: you cannot create a :class:`bytearray` instance that is backed " -"by another object's memory. However, third-party datatypes such as NumPy " -"arrays do not have this limitation, and allow use of zero-copy pickling (or " -"making as few copies as possible) when transferring between distinct " -"processes or systems." -msgstr "" - -#: ../../library/pickle.rst:1061 -msgid ":pep:`574` -- Pickle protocol 5 with out-of-band data" -msgstr "" - -#: ../../library/pickle.rst:1067 -msgid "Restricting Globals" -msgstr "" - -#: ../../library/pickle.rst:1072 -msgid "" -"By default, unpickling will import any class or function that it finds in " -"the pickle data. For many applications, this behaviour is unacceptable as " -"it permits the unpickler to import and invoke arbitrary code. Just consider" -" what this hand-crafted pickle data stream does when loaded::" -msgstr "" - -#: ../../library/pickle.rst:1082 -msgid "" -"In this example, the unpickler imports the :func:`os.system` function and " -"then apply the string argument \"echo hello world\". Although this example " -"is inoffensive, it is not difficult to imagine one that could damage your " -"system." -msgstr "" - -#: ../../library/pickle.rst:1086 -msgid "" -"For this reason, you may want to control what gets unpickled by customizing " -":meth:`Unpickler.find_class`. Unlike its name suggests, " -":meth:`Unpickler.find_class` is called whenever a global (i.e., a class or a" -" function) is requested. Thus it is possible to either completely forbid " -"globals or restrict them to a safe subset." -msgstr "" - -#: ../../library/pickle.rst:1092 -msgid "" -"Here is an example of an unpickler allowing only few safe classes from the " -":mod:`builtins` module to be loaded::" -msgstr "" - -#: ../../library/pickle.rst:1121 -msgid "A sample usage of our unpickler working as intended::" -msgstr "" - -#: ../../library/pickle.rst:1140 -msgid "" -"As our examples shows, you have to be careful with what you allow to be " -"unpickled. Therefore if security is a concern, you may want to consider " -"alternatives such as the marshalling API in :mod:`xmlrpc.client` or third-" -"party solutions." -msgstr "" - -#: ../../library/pickle.rst:1147 -msgid "Performance" -msgstr "" - -#: ../../library/pickle.rst:1149 -msgid "" -"Recent versions of the pickle protocol (from protocol 2 and upwards) feature" -" efficient binary encodings for several common features and built-in types. " -"Also, the :mod:`pickle` module has a transparent optimizer written in C." -msgstr "" - -#: ../../library/pickle.rst:1157 -msgid "Examples" -msgstr "範例" - -#: ../../library/pickle.rst:1159 -msgid "" -"For the simplest code, use the :func:`dump` and :func:`load` functions. ::" -msgstr "" - -#: ../../library/pickle.rst:1175 -msgid "The following example reads the resulting pickled data. ::" -msgstr "" - -#: ../../library/pickle.rst:1191 -msgid "Module :mod:`copyreg`" -msgstr ":mod:`copyreg` 模組" - -#: ../../library/pickle.rst:1192 -msgid "Pickle interface constructor registration for extension types." -msgstr "" - -#: ../../library/pickle.rst:1194 -msgid "Module :mod:`pickletools`" -msgstr ":mod:`pickletools` 模組" - -#: ../../library/pickle.rst:1195 -msgid "Tools for working with and analyzing pickled data." -msgstr "" - -#: ../../library/pickle.rst:1197 -msgid "Module :mod:`shelve`" -msgstr ":mod:`shelve` 模組" - -#: ../../library/pickle.rst:1198 -msgid "Indexed databases of objects; uses :mod:`pickle`." -msgstr "" - -#: ../../library/pickle.rst:1200 -msgid "Module :mod:`copy`" -msgstr ":mod:`copy` 模組" - -#: ../../library/pickle.rst:1201 -msgid "Shallow and deep object copying." -msgstr "" - -#: ../../library/pickle.rst:1203 -msgid "Module :mod:`marshal`" -msgstr ":mod:`marshal` 模組" - -#: ../../library/pickle.rst:1204 -msgid "High-performance serialization of built-in types." -msgstr "" - -#: ../../library/pickle.rst:1208 -msgid "Footnotes" -msgstr "註解" - -#: ../../library/pickle.rst:1209 -msgid "Don't confuse this with the :mod:`marshal` module" -msgstr "" - -#: ../../library/pickle.rst:1211 -msgid "" -"This is why :keyword:`lambda` functions cannot be pickled: all " -":keyword:`!lambda` functions share the same name: ````." -msgstr "" - -#: ../../library/pickle.rst:1214 -msgid "" -"The exception raised will likely be an :exc:`ImportError` or an " -":exc:`AttributeError` but it could be something else." -msgstr "" - -#: ../../library/pickle.rst:1217 -msgid "" -"The :mod:`copy` module uses this protocol for shallow and deep copying " -"operations." -msgstr "" - -#: ../../library/pickle.rst:1220 -msgid "" -"The limitation on alphanumeric characters is due to the fact that persistent" -" IDs in protocol 0 are delimited by the newline character. Therefore if any" -" kind of newline characters occurs in persistent IDs, the resulting pickled " -"data will become unreadable." -msgstr "" - -#: ../../library/pickle.rst:12 -msgid "persistence" -msgstr "persistence(持續性)" - -#: ../../library/pickle.rst:12 -msgid "persistent" -msgstr "persistent(持續)" - -#: ../../library/pickle.rst:12 -msgid "objects" -msgstr "objects(物件)" - -#: ../../library/pickle.rst:12 -msgid "serializing" -msgstr "serializing(序列化)" - -#: ../../library/pickle.rst:12 -msgid "marshalling" -msgstr "marshalling" - -#: ../../library/pickle.rst:12 -msgid "flattening" -msgstr "flattening(攤平)" - -#: ../../library/pickle.rst:12 -msgid "pickling" -msgstr "pickling" - -#: ../../library/pickle.rst:123 -msgid "External Data Representation" -msgstr "External Data Representation(外部資料表示法)" - -#: ../../library/pickle.rst:664 -msgid "copy" -msgstr "copy(複製)" - -#: ../../library/pickle.rst:664 -msgid "protocol" -msgstr "protocol(協定)" - -#: ../../library/pickle.rst:748 -msgid "persistent_id (pickle protocol)" -msgstr "persistent_id(pickle 協定)" - -#: ../../library/pickle.rst:748 -msgid "persistent_load (pickle protocol)" -msgstr "persistent_load(pickle 協定)" - -#: ../../library/pickle.rst:824 -msgid "__getstate__() (copy protocol)" -msgstr "__getstate__()(copy 協定)" - -#: ../../library/pickle.rst:824 -msgid "__setstate__() (copy protocol)" -msgstr "__setstate__()(copy 協定)" - -#: ../../library/pickle.rst:1069 -msgid "find_class() (pickle protocol)" -msgstr "find_class()(pickle 協定)" +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +# Translators: +# Skylull, 2024 +msgid "" +msgstr "" +"Project-Id-Version: Python 3.12\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"PO-Revision-Date: 2018-05-23 16:07+0000\n" +"Last-Translator: Adrian Liaw \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: ../../library/pickle.rst:2 +msgid ":mod:`!pickle` --- Python object serialization" +msgstr ":mod:`!pickle` --- Python 物件序列化" + +#: ../../library/pickle.rst:10 +msgid "**Source code:** :source:`Lib/pickle.py`" +msgstr "**原始碼:**\\ :source:`Lib/pickle.py`" + +# Skylull: 我對 `pickle` 的命名原因進行了簡單的搜尋,只找到一則討論 +# https://stackoverflow.com/questions/27324986/pickles-why-are-they-called- +# that +# 其中表示這名字很可能只是為了隨便找一個p開頭的單字、或原始開發人員的內部玩笑造成的約定俗成。也有人表示醃製黃瓜(pickle- +# ing)的目標就是保存和存放,所以取了這個名字。 +# 無論如何似乎沒有一個定論。 +# 因為不確定是否與醃漬的這個梗有關,我暫時選擇使用 `封裝` 與 `拆封` 作為譯文,大致保存那個把東西處裡後裝起來的感覺但又不至於太奇怪。 +# 唯一需要擔心的是是否有與 `encapsulation` (封裝,網路協定名詞)或 `package`(封包,網路協定名詞)搞混的可能。 +#: ../../library/pickle.rst:22 +msgid "" +"The :mod:`pickle` module implements binary protocols for serializing and de-" +"serializing a Python object structure. *\"Pickling\"* is the process " +"whereby a Python object hierarchy is converted into a byte stream, and " +"*\"unpickling\"* is the inverse operation, whereby a byte stream (from a :" +"term:`binary file` or :term:`bytes-like object`) is converted back into an " +"object hierarchy. Pickling (and unpickling) is alternatively known as " +"\"serialization\", \"marshalling,\" [#]_ or \"flattening\"; however, to " +"avoid confusion, the terms used here are \"pickling\" and \"unpickling\"." +msgstr "" +":mod:`pickle` 模組實作的是一個在二進位層級上對 Python 物件進行序列化" +"(serialize)或去序列化(de-serialize)。*\"Pickling\"* 用於專門指摘將一個 " +"Python 物件轉換為一個二進位串流的過程,*\"unpickling\"* 則相反,指的是將一個" +"(來自 :term:`binary file` 或 :term:`bytes-like object` 的)二進位串流轉換回 " +"Python 物件的過程。Pickling(和 unpickling)的過程也可能被稱作 " +"\"serialization\", \"marshalling,\" [#]_ 或 \"flattening\"。不過,為了避免混" +"淆,本文件將統一稱作封裝(pickling)、拆封(unpickling)。" + +#: ../../library/pickle.rst:33 +msgid "The ``pickle`` module **is not secure**. Only unpickle data you trust." +msgstr "``pickle`` 模組**並不安全**,切記只拆封你信任的資料。" + +#: ../../library/pickle.rst:35 +msgid "" +"It is possible to construct malicious pickle data which will **execute " +"arbitrary code during unpickling**. Never unpickle data that could have come " +"from an untrusted source, or that could have been tampered with." +msgstr "" +"pickle 封包是有可能被建立來在拆封的時候**執行任意惡意程式碼**的。絕對不要拆封" +"任何你無法信任其來源、或可能被修改過的 pickle 封包。" + +#: ../../library/pickle.rst:39 +msgid "" +"Consider signing data with :mod:`hmac` if you need to ensure that it has not " +"been tampered with." +msgstr "建議你可以使用 :mod:`hmac` 模組來簽署這個封包,以確保其未被修改過。" + +#: ../../library/pickle.rst:42 +msgid "" +"Safer serialization formats such as :mod:`json` may be more appropriate if " +"you are processing untrusted data. See :ref:`comparison-with-json`." +msgstr "" +"如果你在處理不受信任的資料,其他比較安全的序列化格式(例如 :mod:`json`)可能" +"會更適合。請參照 See :ref:`comparison-with-json` 的說明。" + +#: ../../library/pickle.rst:47 +msgid "Relationship to other Python modules" +msgstr "和其他 Python 模組的關係" + +#: ../../library/pickle.rst:50 +msgid "Comparison with ``marshal``" +msgstr "和 ``marshal`` 的比較" + +#: ../../library/pickle.rst:52 +msgid "" +"Python has a more primitive serialization module called :mod:`marshal`, but " +"in general :mod:`pickle` should always be the preferred way to serialize " +"Python objects. :mod:`marshal` exists primarily to support Python's :file:`." +"pyc` files." +msgstr "" +"Python 有另一個比較原始的序列化模組叫 :mod:`marshal`,不過其設計目的是為了支" +"援 Python 的預編譯功能 :file:`.pyc` 運作。總地來說,沒事不要用 :mod:" +"`marshal`。" + +#: ../../library/pickle.rst:57 +msgid "" +"The :mod:`pickle` module differs from :mod:`marshal` in several significant " +"ways:" +msgstr ":mod:`pickle` 和 :mod:`marshal` 有幾個明顯不同的地方:" + +#: ../../library/pickle.rst:59 +msgid "" +"The :mod:`pickle` module keeps track of the objects it has already " +"serialized, so that later references to the same object won't be serialized " +"again. :mod:`marshal` doesn't do this." +msgstr "" +":mod:`pickle` 會記住哪些物件已經被序列化過了,稍後再次參照到這個物件的時候才" +"不會進行重複的序列化。:mod:`marshal` 沒有這個功能。" + +#: ../../library/pickle.rst:63 +msgid "" +"This has implications both for recursive objects and object sharing. " +"Recursive objects are objects that contain references to themselves. These " +"are not handled by marshal, and in fact, attempting to marshal recursive " +"objects will crash your Python interpreter. Object sharing happens when " +"there are multiple references to the same object in different places in the " +"object hierarchy being serialized. :mod:`pickle` stores such objects only " +"once, and ensures that all other references point to the master copy. " +"Shared objects remain shared, which can be very important for mutable " +"objects." +msgstr "" +"這對遞迴物件和物件共用都有影響。遞迴物件是指包含自我參照的物件。這些情況在 " +"marshal 模組中不會被處理,若嘗試使用 marshal 處理遞迴物件會導致 Python 直譯器" +"崩潰。物件共用發生在序列化的物件階層中,不同位置對同一物件有多個參照時。:mod:" +"`pickle` 只會儲存這個被參照的物件一次,並確保所有其他參照指向這個主要的版本。" +"共用的物件會保持共用,這對於可變(mutable)物件來說非常重要。" + +#: ../../library/pickle.rst:72 +msgid "" +":mod:`marshal` cannot be used to serialize user-defined classes and their " +"instances. :mod:`pickle` can save and restore class instances " +"transparently, however the class definition must be importable and live in " +"the same module as when the object was stored." +msgstr "" +":mod:`marshal` 無法序列化使用者自訂的類別和的實例。:mod:`pickle` 則可以讓使用" +"者儲存並還原自訂的類別實例,前提是儲存時該類別的定義存在於與要被儲存的物件所" +"在的模組中、且可以被引入(import)。" + +#: ../../library/pickle.rst:77 +msgid "" +"The :mod:`marshal` serialization format is not guaranteed to be portable " +"across Python versions. Because its primary job in life is to support :file:" +"`.pyc` files, the Python implementers reserve the right to change the " +"serialization format in non-backwards compatible ways should the need arise. " +"The :mod:`pickle` serialization format is guaranteed to be backwards " +"compatible across Python releases provided a compatible pickle protocol is " +"chosen and pickling and unpickling code deals with Python 2 to Python 3 type " +"differences if your data is crossing that unique breaking change language " +"boundary." +msgstr "" +":mod:`marshal` 序列化格式無法保證能在不同版本的 Python 之間移植。因為其主要的" +"作用是支援 :file:`.pyc` 檔案的運作,Python 的實作人員會在需要時實作無法前向相" +"容的序列化方式。但只要選擇了相容的 pickle 協定,且處理了 Python 2 和 Python " +"3 之間的資料類型差異,:mod:`pickle` 序列化協定能保證在不同 Python 版本間的相" +"容性。" + +#: ../../library/pickle.rst:90 +msgid "Comparison with ``json``" +msgstr "和 ``json`` 的比較" + +#: ../../library/pickle.rst:92 +msgid "" +"There are fundamental differences between the pickle protocols and `JSON " +"(JavaScript Object Notation) `_:" +msgstr "" +"pickle 協定和 `JSON (JavaScript Object Notation) `_ 有一些" +"根本上的不同:" + +#: ../../library/pickle.rst:95 +msgid "" +"JSON is a text serialization format (it outputs unicode text, although most " +"of the time it is then encoded to ``utf-8``), while pickle is a binary " +"serialization format;" +msgstr "" +"JSON 以文字形式作為序列化的輸出(輸出 unicode 文字,但大多數又會被編碼為 " +"``UTF-8``),而 pickle 則是以二進位形式作為序列化的輸出;" + +#: ../../library/pickle.rst:99 +msgid "JSON is human-readable, while pickle is not;" +msgstr "JSON 是人類可讀的,而 pickle 則無法;" + +#: ../../library/pickle.rst:101 +msgid "" +"JSON is interoperable and widely used outside of the Python ecosystem, while " +"pickle is Python-specific;" +msgstr "" +"JSON 具有高互通性(interoperability)且在 Python 以外的環境也被大量利用,但 " +"pickle 只能在 Python 內使用。" + +# Skylull: introspection, introspection facilities +# https://zh.wikipedia.org/wiki/%E5%86%85%E7%9C%81_(%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%A7%91%E5%AD%A6) +# https://book.pythontips.com/en/latest/object_introspection.html +# https://www.geeksforgeeks.org/code-introspection-in-python/ +#: ../../library/pickle.rst:104 +msgid "" +"JSON, by default, can only represent a subset of the Python built-in types, " +"and no custom classes; pickle can represent an extremely large number of " +"Python types (many of them automatically, by clever usage of Python's " +"introspection facilities; complex cases can be tackled by implementing :ref:" +"`specific object APIs `);" +msgstr "" +"預設狀態下的 JSON 只能紀錄一小部份的 Python 內建型別,且無法紀錄自訂類別;但" +"透過 Python 的自省功能,pickle 可以紀錄絕大多數的 Python 型別(其他比較複雜的" +"狀況也可以透過實作 :ref:`specific object APIs ` 來解決);" + +#: ../../library/pickle.rst:110 +msgid "" +"Unlike pickle, deserializing untrusted JSON does not in itself create an " +"arbitrary code execution vulnerability." +msgstr "" +"去序列化不安全的 JSON 不會產生任意程式執行的風險,但去序列化不安全的 pickle " +"會。" + +#: ../../library/pickle.rst:114 +msgid "" +"The :mod:`json` module: a standard library module allowing JSON " +"serialization and deserialization." +msgstr "" +":mod:`json` module: 是標準函式庫的一部分,可讓使用者進行 JSON 的序列化與去序" +"列化。" + +#: ../../library/pickle.rst:121 +msgid "Data stream format" +msgstr "資料串流格式" + +#: ../../library/pickle.rst:126 +msgid "" +"The data format used by :mod:`pickle` is Python-specific. This has the " +"advantage that there are no restrictions imposed by external standards such " +"as JSON or XDR (which can't represent pointer sharing); however it means " +"that non-Python programs may not be able to reconstruct pickled Python " +"objects." +msgstr "" +":mod:`pickle` 使用的資料格式是針對 Python 而設計的。好處是他不會受到外部標準" +"(像是 JSON 或 XDR,而 XDR 無法紀錄指標共用)的限制;不過這也代表其他不是 " +"Python 的程式可能無法重建 pickle 封裝的 Python 物件。" + +#: ../../library/pickle.rst:131 +msgid "" +"By default, the :mod:`pickle` data format uses a relatively compact binary " +"representation. If you need optimal size characteristics, you can " +"efficiently :doc:`compress ` pickled data." +msgstr "" +"以預設設定來說,:mod:`pickle` 使用相對緊湊的二進位形式來儲存資料。如果你需要" +"盡可能地縮小檔案大小,你可以\\\\ :doc:`壓縮 `\\\\ 封裝的資料。" + +#: ../../library/pickle.rst:135 +msgid "" +"The module :mod:`pickletools` contains tools for analyzing data streams " +"generated by :mod:`pickle`. :mod:`pickletools` source code has extensive " +"comments about opcodes used by pickle protocols." +msgstr "" +":mod:`pickletools` 含有工具可分析 :mod:`pickle` 所產生的資料流。:mod:" +"`pickletools` 的源始碼詳細地記載了所有 pickle 協定的操作碼(opcode)。" + +#: ../../library/pickle.rst:139 +msgid "" +"There are currently 6 different protocols which can be used for pickling. " +"The higher the protocol used, the more recent the version of Python needed " +"to read the pickle produced." +msgstr "" +"截至目前為止,共有六種不同版本的協定可用於封裝 pickle。數字越大版本代表你需" +"要使用越新的 Python 版本來拆封相應的 pickle 封裝。" + +#: ../../library/pickle.rst:143 +msgid "" +"Protocol version 0 is the original \"human-readable\" protocol and is " +"backwards compatible with earlier versions of Python." +msgstr "" +"版本 0 的協定是最初「人類可讀」的版本,且可以向前支援早期版本的 Python。" + +#: ../../library/pickle.rst:146 +msgid "" +"Protocol version 1 is an old binary format which is also compatible with " +"earlier versions of Python." +msgstr "版本 1 的協定使用舊的二進位格式,一樣能向前支援早期版本的 Python。" + +#: ../../library/pickle.rst:149 +msgid "" +"Protocol version 2 was introduced in Python 2.3. It provides much more " +"efficient pickling of :term:`new-style classes `. Refer " +"to :pep:`307` for information about improvements brought by protocol 2." +msgstr "" +"版本 2 的協定在 Python 2.3 中初次被引入。其可提供更高效率的 :term:`new-style " +"classes ` 封裝過程。請參閱 :pep:`307` 以了解版本 2 帶來的改" +"進。" + +#: ../../library/pickle.rst:153 +msgid "" +"Protocol version 3 was added in Python 3.0. It has explicit support for :" +"class:`bytes` objects and cannot be unpickled by Python 2.x. This was the " +"default protocol in Python 3.0--3.7." +msgstr "" +"版本 3 的協定在 Python 3.0 被新增。現在能支援封裝 :class:`bytes` 的物件且無法" +"被 2.x 版本的 Python 拆封。在 3.0~3.7 的 Python 預設使用 3 版協定。" + +#: ../../library/pickle.rst:157 +msgid "" +"Protocol version 4 was added in Python 3.4. It adds support for very large " +"objects, pickling more kinds of objects, and some data format " +"optimizations. It is the default protocol starting with Python 3.8. Refer " +"to :pep:`3154` for information about improvements brought by protocol 4." +msgstr "" +"版本 4 的協定在 Python 3.4 被新增。現在能支援超大物件的封裝、更多種型別的物件" +"以及針對部份資料格式的儲存進行最佳化。從 Python 3.8 起,預設使用第 4 版協定。" +"請參閱 :pep:`3154` 以了解第 4 版協定改進的細節。" + +#: ../../library/pickle.rst:163 +msgid "" +"Protocol version 5 was added in Python 3.8. It adds support for out-of-band " +"data and speedup for in-band data. Refer to :pep:`574` for information " +"about improvements brought by protocol 5." +msgstr "" +"版本 5 的協定在 Python 3.8 被新增。現在能支援帶外資料(Out-of-band data)並加" +"速帶內資料的處理速度。請參閱 :pep:`574` 以了解第 5 版協定改進的細節。" + +#: ../../library/pickle.rst:168 +msgid "" +"Serialization is a more primitive notion than persistence; although :mod:" +"`pickle` reads and writes file objects, it does not handle the issue of " +"naming persistent objects, nor the (even more complicated) issue of " +"concurrent access to persistent objects. The :mod:`pickle` module can " +"transform a complex object into a byte stream and it can transform the byte " +"stream into an object with the same internal structure. Perhaps the most " +"obvious thing to do with these byte streams is to write them onto a file, " +"but it is also conceivable to send them across a network or store them in a " +"database. The :mod:`shelve` module provides a simple interface to pickle " +"and unpickle objects on DBM-style database files." +msgstr "" +"資料序列化是一個比資料持久化更早出現的概念;雖然 :mod:`pickle` 可以讀寫檔案物" +"件,但它並不處理命名持久物件的問題,也不處理對持久物件的並行存取、一個更棘手" +"的問題。:mod:`pickle` 模組可以將複雜物件轉換成位元組串流,也可以將位元組串流" +"轉換回具有相同原始內部結構的物件。對這些位元組串流最常見的處理方式是將它們寫" +"入檔案中,但也可以將它們透過網路傳送或儲存在一個資料庫中。:mod:`shelve` 模組" +"提供了一個簡單的介面來讓使用者在 DBM 風格的資料庫檔案中對物件進行封裝和拆封的" +"操作。" + +#: ../../library/pickle.rst:181 +msgid "Module Interface" +msgstr "模組介面" + +#: ../../library/pickle.rst:183 +msgid "" +"To serialize an object hierarchy, you simply call the :func:`dumps` " +"function. Similarly, to de-serialize a data stream, you call the :func:" +"`loads` function. However, if you want more control over serialization and " +"de-serialization, you can create a :class:`Pickler` or an :class:`Unpickler` " +"object, respectively." +msgstr "" +"想要序列化一個物件,你只需要呼叫 :func:`dumps` 函數。而當你想要去序列化一個資" +"料流時,你只需要呼叫 :func:`loads` 即可。不過,若你希望能各自對序列化和去序列" +"化的過程中有更多的掌控度,你可以自訂一個 :class:`Pickler` 或 :class:" +"`Unpickler` 物件。" + +#: ../../library/pickle.rst:188 +msgid "The :mod:`pickle` module provides the following constants:" +msgstr ":mod:`pickle` 模組提供以下常數:" + +#: ../../library/pickle.rst:193 +msgid "" +"An integer, the highest :ref:`protocol version ` " +"available. This value can be passed as a *protocol* value to functions :" +"func:`dump` and :func:`dumps` as well as the :class:`Pickler` constructor." +msgstr "" +"一個整數,表示可使用的最高\\ :ref:`協定版本 `。這個值可作" +"為 *protocol* 的數值傳給 :func:`dump` 和 :func:`dumps` 函數以及 :class:" +"`Pickler` 建構式。" + +#: ../../library/pickle.rst:200 +msgid "" +"An integer, the default :ref:`protocol version ` used for " +"pickling. May be less than :data:`HIGHEST_PROTOCOL`. Currently the default " +"protocol is 4, first introduced in Python 3.4 and incompatible with previous " +"versions." +msgstr "" +"一個整數,指示用於序列化的預設\\ :ref:`協定版本 `。有可能小" +"於 :data:`HIGHEST_PROTOCOL`。目前的預設協定版本為 4,是在 Python 3.4 中首次引" +"入的,且與先前版本不相容。" + +#: ../../library/pickle.rst:207 +msgid "The default protocol is 3." +msgstr "預設協定版本為 3。" + +#: ../../library/pickle.rst:211 +msgid "The default protocol is 4." +msgstr "預設協定版本為 4。" + +#: ../../library/pickle.rst:213 +msgid "" +"The :mod:`pickle` module provides the following functions to make the " +"pickling process more convenient:" +msgstr ":mod:`pickle` 模組提供下列函數來簡化封裝的過程:" + +#: ../../library/pickle.rst:218 +msgid "" +"Write the pickled representation of the object *obj* to the open :term:`file " +"object` *file*. This is equivalent to ``Pickler(file, protocol).dump(obj)``." +msgstr "" +"將被封裝成 pickle 形式的 *obj* 寫入到已開啟的\\\\ term:`檔案物件 ` *file*。這等效於\\\\ ``Pickler(file, protocol).dump(obj)``。" + +#: ../../library/pickle.rst:222 +msgid "" +"Arguments *file*, *protocol*, *fix_imports* and *buffer_callback* have the " +"same meaning as in the :class:`Pickler` constructor." +msgstr "" +"引數 *file*、*protocol*、*fix_imports* 和 *buffer_callback* 的意義與 :class:" +"`Pickler` 建構式中的相同。" + +#: ../../library/pickle.rst:225 ../../library/pickle.rst:236 +#: ../../library/pickle.rst:328 +msgid "The *buffer_callback* argument was added." +msgstr "新增 *buffer_callback* 引數。" + +#: ../../library/pickle.rst:230 +msgid "" +"Return the pickled representation of the object *obj* as a :class:`bytes` " +"object, instead of writing it to a file." +msgstr "" +"將被封裝為 pickle 形式的 *obj* 以 :class:`bytes` 類別回傳,而非寫入進檔案。" + +#: ../../library/pickle.rst:233 +msgid "" +"Arguments *protocol*, *fix_imports* and *buffer_callback* have the same " +"meaning as in the :class:`Pickler` constructor." +msgstr "" +"引數 *protocol*、*fix_imports* 和 *buffer_callback* 的意義和 :class:" +"`Pickler` 建構式中的相同。" + +#: ../../library/pickle.rst:241 +msgid "" +"Read the pickled representation of an object from the open :term:`file " +"object` *file* and return the reconstituted object hierarchy specified " +"therein. This is equivalent to ``Unpickler(file).load()``." +msgstr "" +"從已開啟的 :term:`檔案物件 ` *file* 中讀取已序列化的物件,並傳回" +"其重建後的物件階層。這相當於呼叫 ``Unpickler(file).load()``。" + +#: ../../library/pickle.rst:245 ../../library/pickle.rst:260 +msgid "" +"The protocol version of the pickle is detected automatically, so no protocol " +"argument is needed. Bytes past the pickled representation of the object are " +"ignored." +msgstr "" +"模組會自動偵測 pickle 封包所使用的協定版本,所以無須另外指定。超出 pickle 封" +"包表示範圍的位元組將被忽略。" + +#: ../../library/pickle.rst:249 +msgid "" +"Arguments *file*, *fix_imports*, *encoding*, *errors*, *strict* and " +"*buffers* have the same meaning as in the :class:`Unpickler` constructor." +msgstr "" +"引數 *file*、*fix_imports*、*encoding*、*errors*、*strict* 和 *buffers* 的意" +"義和 :class:`Unpickler` 建構式中的相同。" + +#: ../../library/pickle.rst:252 ../../library/pickle.rst:267 +#: ../../library/pickle.rst:429 +msgid "The *buffers* argument was added." +msgstr "新增 *buffer* 引數。" + +#: ../../library/pickle.rst:257 +msgid "" +"Return the reconstituted object hierarchy of the pickled representation " +"*data* of an object. *data* must be a :term:`bytes-like object`." +msgstr "" + +#: ../../library/pickle.rst:264 +msgid "" +"Arguments *fix_imports*, *encoding*, *errors*, *strict* and *buffers* have " +"the same meaning as in the :class:`Unpickler` constructor." +msgstr "" + +#: ../../library/pickle.rst:271 +msgid "The :mod:`pickle` module defines three exceptions:" +msgstr "" + +#: ../../library/pickle.rst:275 +msgid "" +"Common base class for the other pickling exceptions. It inherits from :exc:" +"`Exception`." +msgstr "" + +#: ../../library/pickle.rst:280 +msgid "" +"Error raised when an unpicklable object is encountered by :class:`Pickler`. " +"It inherits from :exc:`PickleError`." +msgstr "" + +#: ../../library/pickle.rst:283 +msgid "" +"Refer to :ref:`pickle-picklable` to learn what kinds of objects can be " +"pickled." +msgstr "" + +#: ../../library/pickle.rst:288 +msgid "" +"Error raised when there is a problem unpickling an object, such as a data " +"corruption or a security violation. It inherits from :exc:`PickleError`." +msgstr "" + +#: ../../library/pickle.rst:291 +msgid "" +"Note that other exceptions may also be raised during unpickling, including " +"(but not necessarily limited to) AttributeError, EOFError, ImportError, and " +"IndexError." +msgstr "" + +#: ../../library/pickle.rst:296 +msgid "" +"The :mod:`pickle` module exports three classes, :class:`Pickler`, :class:" +"`Unpickler` and :class:`PickleBuffer`:" +msgstr "" + +#: ../../library/pickle.rst:301 +msgid "This takes a binary file for writing a pickle data stream." +msgstr "" + +#: ../../library/pickle.rst:303 +msgid "" +"The optional *protocol* argument, an integer, tells the pickler to use the " +"given protocol; supported protocols are 0 to :data:`HIGHEST_PROTOCOL`. If " +"not specified, the default is :data:`DEFAULT_PROTOCOL`. If a negative " +"number is specified, :data:`HIGHEST_PROTOCOL` is selected." +msgstr "" + +#: ../../library/pickle.rst:308 +msgid "" +"The *file* argument must have a write() method that accepts a single bytes " +"argument. It can thus be an on-disk file opened for binary writing, an :" +"class:`io.BytesIO` instance, or any other custom object that meets this " +"interface." +msgstr "" + +#: ../../library/pickle.rst:313 +msgid "" +"If *fix_imports* is true and *protocol* is less than 3, pickle will try to " +"map the new Python 3 names to the old module names used in Python 2, so that " +"the pickle data stream is readable with Python 2." +msgstr "" + +#: ../../library/pickle.rst:317 +msgid "" +"If *buffer_callback* is ``None`` (the default), buffer views are serialized " +"into *file* as part of the pickle stream." +msgstr "" + +#: ../../library/pickle.rst:320 +msgid "" +"If *buffer_callback* is not ``None``, then it can be called any number of " +"times with a buffer view. If the callback returns a false value (such as " +"``None``), the given buffer is :ref:`out-of-band `; otherwise " +"the buffer is serialized in-band, i.e. inside the pickle stream." +msgstr "" + +#: ../../library/pickle.rst:325 +msgid "" +"It is an error if *buffer_callback* is not ``None`` and *protocol* is " +"``None`` or smaller than 5." +msgstr "" + +#: ../../library/pickle.rst:333 +msgid "" +"Write the pickled representation of *obj* to the open file object given in " +"the constructor." +msgstr "" + +#: ../../library/pickle.rst:338 +msgid "Do nothing by default. This exists so a subclass can override it." +msgstr "" + +#: ../../library/pickle.rst:340 +msgid "" +"If :meth:`persistent_id` returns ``None``, *obj* is pickled as usual. Any " +"other value causes :class:`Pickler` to emit the returned value as a " +"persistent ID for *obj*. The meaning of this persistent ID should be " +"defined by :meth:`Unpickler.persistent_load`. Note that the value returned " +"by :meth:`persistent_id` cannot itself have a persistent ID." +msgstr "" + +#: ../../library/pickle.rst:346 ../../library/pickle.rst:447 +msgid "See :ref:`pickle-persistent` for details and examples of uses." +msgstr "關於細節與用法範例請見 :ref:`pickle-persistent`。" + +#: ../../library/pickle.rst:350 +msgid "" +"A pickler object's dispatch table is a registry of *reduction functions* of " +"the kind which can be declared using :func:`copyreg.pickle`. It is a " +"mapping whose keys are classes and whose values are reduction functions. A " +"reduction function takes a single argument of the associated class and " +"should conform to the same interface as a :meth:`~object.__reduce__` method." +msgstr "" + +#: ../../library/pickle.rst:358 +msgid "" +"By default, a pickler object will not have a :attr:`dispatch_table` " +"attribute, and it will instead use the global dispatch table managed by the :" +"mod:`copyreg` module. However, to customize the pickling for a specific " +"pickler object one can set the :attr:`dispatch_table` attribute to a dict-" +"like object. Alternatively, if a subclass of :class:`Pickler` has a :attr:" +"`dispatch_table` attribute then this will be used as the default dispatch " +"table for instances of that class." +msgstr "" + +#: ../../library/pickle.rst:367 +msgid "See :ref:`pickle-dispatch` for usage examples." +msgstr "關於用法範例請見 :ref:`pickle-dispatch`。" + +#: ../../library/pickle.rst:373 +msgid "" +"Special reducer that can be defined in :class:`Pickler` subclasses. This " +"method has priority over any reducer in the :attr:`dispatch_table`. It " +"should conform to the same interface as a :meth:`~object.__reduce__` method, " +"and can optionally return :data:`NotImplemented` to fallback on :attr:" +"`dispatch_table`-registered reducers to pickle ``obj``." +msgstr "" + +#: ../../library/pickle.rst:379 +msgid "For a detailed example, see :ref:`reducer_override`." +msgstr "" + +#: ../../library/pickle.rst:385 +msgid "" +"Deprecated. Enable fast mode if set to a true value. The fast mode disables " +"the usage of memo, therefore speeding the pickling process by not generating " +"superfluous PUT opcodes. It should not be used with self-referential " +"objects, doing otherwise will cause :class:`Pickler` to recurse infinitely." +msgstr "" + +#: ../../library/pickle.rst:391 +msgid "Use :func:`pickletools.optimize` if you need more compact pickles." +msgstr "" + +#: ../../library/pickle.rst:396 +msgid "This takes a binary file for reading a pickle data stream." +msgstr "" + +#: ../../library/pickle.rst:398 +msgid "" +"The protocol version of the pickle is detected automatically, so no protocol " +"argument is needed." +msgstr "" + +#: ../../library/pickle.rst:401 +msgid "" +"The argument *file* must have three methods, a read() method that takes an " +"integer argument, a readinto() method that takes a buffer argument and a " +"readline() method that requires no arguments, as in the :class:`io." +"BufferedIOBase` interface. Thus *file* can be an on-disk file opened for " +"binary reading, an :class:`io.BytesIO` object, or any other custom object " +"that meets this interface." +msgstr "" + +#: ../../library/pickle.rst:408 +msgid "" +"The optional arguments *fix_imports*, *encoding* and *errors* are used to " +"control compatibility support for pickle stream generated by Python 2. If " +"*fix_imports* is true, pickle will try to map the old Python 2 names to the " +"new names used in Python 3. The *encoding* and *errors* tell pickle how to " +"decode 8-bit string instances pickled by Python 2; these default to 'ASCII' " +"and 'strict', respectively. The *encoding* can be 'bytes' to read these 8-" +"bit string instances as bytes objects. Using ``encoding='latin1'`` is " +"required for unpickling NumPy arrays and instances of :class:`~datetime." +"datetime`, :class:`~datetime.date` and :class:`~datetime.time` pickled by " +"Python 2." +msgstr "" + +#: ../../library/pickle.rst:419 +msgid "" +"If *buffers* is ``None`` (the default), then all data necessary for " +"deserialization must be contained in the pickle stream. This means that the " +"*buffer_callback* argument was ``None`` when a :class:`Pickler` was " +"instantiated (or when :func:`dump` or :func:`dumps` was called)." +msgstr "" + +#: ../../library/pickle.rst:424 +msgid "" +"If *buffers* is not ``None``, it should be an iterable of buffer-enabled " +"objects that is consumed each time the pickle stream references an :ref:`out-" +"of-band ` buffer view. Such buffers have been given in order to " +"the *buffer_callback* of a Pickler object." +msgstr "" + +#: ../../library/pickle.rst:434 +msgid "" +"Read the pickled representation of an object from the open file object given " +"in the constructor, and return the reconstituted object hierarchy specified " +"therein. Bytes past the pickled representation of the object are ignored." +msgstr "" + +#: ../../library/pickle.rst:441 +msgid "Raise an :exc:`UnpicklingError` by default." +msgstr "" + +#: ../../library/pickle.rst:443 +msgid "" +"If defined, :meth:`persistent_load` should return the object specified by " +"the persistent ID *pid*. If an invalid persistent ID is encountered, an :" +"exc:`UnpicklingError` should be raised." +msgstr "" + +#: ../../library/pickle.rst:451 +msgid "" +"Import *module* if necessary and return the object called *name* from it, " +"where the *module* and *name* arguments are :class:`str` objects. Note, " +"unlike its name suggests, :meth:`find_class` is also used for finding " +"functions." +msgstr "" + +#: ../../library/pickle.rst:456 +msgid "" +"Subclasses may override this to gain control over what type of objects and " +"how they can be loaded, potentially reducing security risks. Refer to :ref:" +"`pickle-restrict` for details." +msgstr "" + +#: ../../library/pickle.rst:460 +msgid "" +"Raises an :ref:`auditing event ` ``pickle.find_class`` with " +"arguments ``module``, ``name``." +msgstr "" +"引發一個附帶引數 ``module``、``name`` 的\\ :ref:`稽核事件 ` " +"``pickle.find_class``。" + +#: ../../library/pickle.rst:464 +msgid "" +"A wrapper for a buffer representing picklable data. *buffer* must be a :ref:" +"`buffer-providing ` object, such as a :term:`bytes-like " +"object` or a N-dimensional array." +msgstr "" + +#: ../../library/pickle.rst:468 +msgid "" +":class:`PickleBuffer` is itself a buffer provider, therefore it is possible " +"to pass it to other APIs expecting a buffer-providing object, such as :class:" +"`memoryview`." +msgstr "" + +#: ../../library/pickle.rst:472 +msgid "" +":class:`PickleBuffer` objects can only be serialized using pickle protocol 5 " +"or higher. They are eligible for :ref:`out-of-band serialization `." +msgstr "" + +#: ../../library/pickle.rst:480 +msgid "" +"Return a :class:`memoryview` of the memory area underlying this buffer. The " +"returned object is a one-dimensional, C-contiguous memoryview with format " +"``B`` (unsigned bytes). :exc:`BufferError` is raised if the buffer is " +"neither C- nor Fortran-contiguous." +msgstr "" + +#: ../../library/pickle.rst:487 +msgid "Release the underlying buffer exposed by the PickleBuffer object." +msgstr "" + +#: ../../library/pickle.rst:493 +msgid "What can be pickled and unpickled?" +msgstr "" + +#: ../../library/pickle.rst:495 +msgid "The following types can be pickled:" +msgstr "" + +#: ../../library/pickle.rst:497 +msgid "" +"built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, and :data:" +"`NotImplemented`);" +msgstr "" + +#: ../../library/pickle.rst:500 +msgid "integers, floating-point numbers, complex numbers;" +msgstr "" + +#: ../../library/pickle.rst:502 +msgid "strings, bytes, bytearrays;" +msgstr "" + +#: ../../library/pickle.rst:504 +msgid "" +"tuples, lists, sets, and dictionaries containing only picklable objects;" +msgstr "" + +#: ../../library/pickle.rst:506 +msgid "" +"functions (built-in and user-defined) accessible from the top level of a " +"module (using :keyword:`def`, not :keyword:`lambda`);" +msgstr "" + +#: ../../library/pickle.rst:509 +msgid "classes accessible from the top level of a module;" +msgstr "" + +#: ../../library/pickle.rst:511 +msgid "" +"instances of such classes whose the result of calling :meth:`~object." +"__getstate__` is picklable (see section :ref:`pickle-inst` for details)." +msgstr "" + +#: ../../library/pickle.rst:514 +msgid "" +"Attempts to pickle unpicklable objects will raise the :exc:`PicklingError` " +"exception; when this happens, an unspecified number of bytes may have " +"already been written to the underlying file. Trying to pickle a highly " +"recursive data structure may exceed the maximum recursion depth, a :exc:" +"`RecursionError` will be raised in this case. You can carefully raise this " +"limit with :func:`sys.setrecursionlimit`." +msgstr "" + +#: ../../library/pickle.rst:521 +msgid "" +"Note that functions (built-in and user-defined) are pickled by fully :term:" +"`qualified name`, not by value. [#]_ This means that only the function name " +"is pickled, along with the name of the containing module and classes. " +"Neither the function's code, nor any of its function attributes are " +"pickled. Thus the defining module must be importable in the unpickling " +"environment, and the module must contain the named object, otherwise an " +"exception will be raised. [#]_" +msgstr "" + +#: ../../library/pickle.rst:528 +msgid "" +"Similarly, classes are pickled by fully qualified name, so the same " +"restrictions in the unpickling environment apply. Note that none of the " +"class's code or data is pickled, so in the following example the class " +"attribute ``attr`` is not restored in the unpickling environment::" +msgstr "" + +#: ../../library/pickle.rst:538 +msgid "" +"These restrictions are why picklable functions and classes must be defined " +"at the top level of a module." +msgstr "" + +#: ../../library/pickle.rst:541 +msgid "" +"Similarly, when class instances are pickled, their class's code and data are " +"not pickled along with them. Only the instance data are pickled. This is " +"done on purpose, so you can fix bugs in a class or add methods to the class " +"and still load objects that were created with an earlier version of the " +"class. If you plan to have long-lived objects that will see many versions " +"of a class, it may be worthwhile to put a version number in the objects so " +"that suitable conversions can be made by the class's :meth:`~object." +"__setstate__` method." +msgstr "" + +#: ../../library/pickle.rst:553 +msgid "Pickling Class Instances" +msgstr "" + +#: ../../library/pickle.rst:557 +msgid "" +"In this section, we describe the general mechanisms available to you to " +"define, customize, and control how class instances are pickled and unpickled." +msgstr "" + +#: ../../library/pickle.rst:560 +msgid "" +"In most cases, no additional code is needed to make instances picklable. By " +"default, pickle will retrieve the class and the attributes of an instance " +"via introspection. When a class instance is unpickled, its :meth:`~object." +"__init__` method is usually *not* invoked. The default behaviour first " +"creates an uninitialized instance and then restores the saved attributes. " +"The following code shows an implementation of this behaviour::" +msgstr "" + +#: ../../library/pickle.rst:575 +msgid "" +"Classes can alter the default behaviour by providing one or several special " +"methods:" +msgstr "" + +#: ../../library/pickle.rst:580 +msgid "" +"In protocols 2 and newer, classes that implements the :meth:" +"`__getnewargs_ex__` method can dictate the values passed to the :meth:" +"`__new__` method upon unpickling. The method must return a pair ``(args, " +"kwargs)`` where *args* is a tuple of positional arguments and *kwargs* a " +"dictionary of named arguments for constructing the object. Those will be " +"passed to the :meth:`__new__` method upon unpickling." +msgstr "" + +#: ../../library/pickle.rst:588 +msgid "" +"You should implement this method if the :meth:`__new__` method of your class " +"requires keyword-only arguments. Otherwise, it is recommended for " +"compatibility to implement :meth:`__getnewargs__`." +msgstr "" + +#: ../../library/pickle.rst:592 +msgid ":meth:`__getnewargs_ex__` is now used in protocols 2 and 3." +msgstr "" + +#: ../../library/pickle.rst:598 +msgid "" +"This method serves a similar purpose as :meth:`__getnewargs_ex__`, but " +"supports only positional arguments. It must return a tuple of arguments " +"``args`` which will be passed to the :meth:`__new__` method upon unpickling." +msgstr "" + +#: ../../library/pickle.rst:602 +msgid "" +":meth:`__getnewargs__` will not be called if :meth:`__getnewargs_ex__` is " +"defined." +msgstr "" + +#: ../../library/pickle.rst:605 +msgid "" +"Before Python 3.6, :meth:`__getnewargs__` was called instead of :meth:" +"`__getnewargs_ex__` in protocols 2 and 3." +msgstr "" + +#: ../../library/pickle.rst:612 +msgid "" +"Classes can further influence how their instances are pickled by overriding " +"the method :meth:`__getstate__`. It is called and the returned object is " +"pickled as the contents for the instance, instead of a default state. There " +"are several cases:" +msgstr "" + +#: ../../library/pickle.rst:617 +msgid "" +"For a class that has no instance :attr:`~object.__dict__` and no :attr:" +"`~object.__slots__`, the default state is ``None``." +msgstr "" + +#: ../../library/pickle.rst:620 +msgid "" +"For a class that has an instance :attr:`~object.__dict__` and no :attr:" +"`~object.__slots__`, the default state is ``self.__dict__``." +msgstr "" + +#: ../../library/pickle.rst:623 +msgid "" +"For a class that has an instance :attr:`~object.__dict__` and :attr:`~object." +"__slots__`, the default state is a tuple consisting of two dictionaries: " +"``self.__dict__``, and a dictionary mapping slot names to slot values. Only " +"slots that have a value are included in the latter." +msgstr "" + +#: ../../library/pickle.rst:629 +msgid "" +"For a class that has :attr:`~object.__slots__` and no instance :attr:" +"`~object.__dict__`, the default state is a tuple whose first item is " +"``None`` and whose second item is a dictionary mapping slot names to slot " +"values described in the previous bullet." +msgstr "" + +#: ../../library/pickle.rst:634 +msgid "" +"Added the default implementation of the ``__getstate__()`` method in the :" +"class:`object` class." +msgstr "" + +#: ../../library/pickle.rst:641 +msgid "" +"Upon unpickling, if the class defines :meth:`__setstate__`, it is called " +"with the unpickled state. In that case, there is no requirement for the " +"state object to be a dictionary. Otherwise, the pickled state must be a " +"dictionary and its items are assigned to the new instance's dictionary." +msgstr "" + +#: ../../library/pickle.rst:648 +msgid "" +"If :meth:`__reduce__` returns a state with value ``None`` at pickling, the :" +"meth:`__setstate__` method will not be called upon unpickling." +msgstr "" + +#: ../../library/pickle.rst:652 +msgid "" +"Refer to the section :ref:`pickle-state` for more information about how to " +"use the methods :meth:`~object.__getstate__` and :meth:`~object." +"__setstate__`." +msgstr "" + +#: ../../library/pickle.rst:657 +msgid "" +"At unpickling time, some methods like :meth:`~object.__getattr__`, :meth:" +"`~object.__getattribute__`, or :meth:`~object.__setattr__` may be called " +"upon the instance. In case those methods rely on some internal invariant " +"being true, the type should implement :meth:`~object.__new__` to establish " +"such an invariant, as :meth:`~object.__init__` is not called when unpickling " +"an instance." +msgstr "" + +#: ../../library/pickle.rst:666 +msgid "" +"As we shall see, pickle does not use directly the methods described above. " +"In fact, these methods are part of the copy protocol which implements the :" +"meth:`~object.__reduce__` special method. The copy protocol provides a " +"unified interface for retrieving the data necessary for pickling and copying " +"objects. [#]_" +msgstr "" + +#: ../../library/pickle.rst:672 +msgid "" +"Although powerful, implementing :meth:`~object.__reduce__` directly in your " +"classes is error prone. For this reason, class designers should use the " +"high-level interface (i.e., :meth:`~object.__getnewargs_ex__`, :meth:" +"`~object.__getstate__` and :meth:`~object.__setstate__`) whenever possible. " +"We will show, however, cases where using :meth:`!__reduce__` is the only " +"option or leads to more efficient pickling or both." +msgstr "" + +#: ../../library/pickle.rst:681 +msgid "" +"The interface is currently defined as follows. The :meth:`__reduce__` " +"method takes no argument and shall return either a string or preferably a " +"tuple (the returned object is often referred to as the \"reduce value\")." +msgstr "" + +#: ../../library/pickle.rst:685 +msgid "" +"If a string is returned, the string should be interpreted as the name of a " +"global variable. It should be the object's local name relative to its " +"module; the pickle module searches the module namespace to determine the " +"object's module. This behaviour is typically useful for singletons." +msgstr "" + +#: ../../library/pickle.rst:690 +msgid "" +"When a tuple is returned, it must be between two and six items long. " +"Optional items can either be omitted, or ``None`` can be provided as their " +"value. The semantics of each item are in order:" +msgstr "" + +#: ../../library/pickle.rst:696 +msgid "" +"A callable object that will be called to create the initial version of the " +"object." +msgstr "" + +#: ../../library/pickle.rst:699 +msgid "" +"A tuple of arguments for the callable object. An empty tuple must be given " +"if the callable does not accept any argument." +msgstr "" + +#: ../../library/pickle.rst:702 +msgid "" +"Optionally, the object's state, which will be passed to the object's :meth:" +"`__setstate__` method as previously described. If the object has no such " +"method then, the value must be a dictionary and it will be added to the " +"object's :attr:`~object.__dict__` attribute." +msgstr "" + +#: ../../library/pickle.rst:707 +msgid "" +"Optionally, an iterator (and not a sequence) yielding successive items. " +"These items will be appended to the object either using ``obj.append(item)`` " +"or, in batch, using ``obj.extend(list_of_items)``. This is primarily used " +"for list subclasses, but may be used by other classes as long as they have :" +"ref:`append and extend methods ` with the appropriate " +"signature. (Whether :meth:`!append` or :meth:`!extend` is used depends on " +"which pickle protocol version is used as well as the number of items to " +"append, so both must be supported.)" +msgstr "" + +#: ../../library/pickle.rst:717 +msgid "" +"Optionally, an iterator (not a sequence) yielding successive key-value " +"pairs. These items will be stored to the object using ``obj[key] = " +"value``. This is primarily used for dictionary subclasses, but may be used " +"by other classes as long as they implement :meth:`__setitem__`." +msgstr "" + +#: ../../library/pickle.rst:722 +msgid "" +"Optionally, a callable with a ``(obj, state)`` signature. This callable " +"allows the user to programmatically control the state-updating behavior of a " +"specific object, instead of using ``obj``'s static :meth:`__setstate__` " +"method. If not ``None``, this callable will have priority over ``obj``'s :" +"meth:`__setstate__`." +msgstr "" + +#: ../../library/pickle.rst:728 +msgid "The optional sixth tuple item, ``(obj, state)``, was added." +msgstr "" + +#: ../../library/pickle.rst:734 +msgid "" +"Alternatively, a :meth:`__reduce_ex__` method may be defined. The only " +"difference is this method should take a single integer argument, the " +"protocol version. When defined, pickle will prefer it over the :meth:" +"`__reduce__` method. In addition, :meth:`__reduce__` automatically becomes " +"a synonym for the extended version. The main use for this method is to " +"provide backwards-compatible reduce values for older Python releases." +msgstr "" + +#: ../../library/pickle.rst:746 +msgid "Persistence of External Objects" +msgstr "" + +#: ../../library/pickle.rst:752 +msgid "" +"For the benefit of object persistence, the :mod:`pickle` module supports the " +"notion of a reference to an object outside the pickled data stream. Such " +"objects are referenced by a persistent ID, which should be either a string " +"of alphanumeric characters (for protocol 0) [#]_ or just an arbitrary object " +"(for any newer protocol)." +msgstr "" + +#: ../../library/pickle.rst:758 +msgid "" +"The resolution of such persistent IDs is not defined by the :mod:`pickle` " +"module; it will delegate this resolution to the user-defined methods on the " +"pickler and unpickler, :meth:`~Pickler.persistent_id` and :meth:`~Unpickler." +"persistent_load` respectively." +msgstr "" + +#: ../../library/pickle.rst:763 +msgid "" +"To pickle objects that have an external persistent ID, the pickler must have " +"a custom :meth:`~Pickler.persistent_id` method that takes an object as an " +"argument and returns either ``None`` or the persistent ID for that object. " +"When ``None`` is returned, the pickler simply pickles the object as normal. " +"When a persistent ID string is returned, the pickler will pickle that " +"object, along with a marker so that the unpickler will recognize it as a " +"persistent ID." +msgstr "" + +#: ../../library/pickle.rst:770 +msgid "" +"To unpickle external objects, the unpickler must have a custom :meth:" +"`~Unpickler.persistent_load` method that takes a persistent ID object and " +"returns the referenced object." +msgstr "" + +#: ../../library/pickle.rst:774 +msgid "" +"Here is a comprehensive example presenting how persistent ID can be used to " +"pickle external objects by reference." +msgstr "" + +#: ../../library/pickle.rst:782 +msgid "Dispatch Tables" +msgstr "" + +#: ../../library/pickle.rst:784 +msgid "" +"If one wants to customize pickling of some classes without disturbing any " +"other code which depends on pickling, then one can create a pickler with a " +"private dispatch table." +msgstr "" + +#: ../../library/pickle.rst:788 +msgid "" +"The global dispatch table managed by the :mod:`copyreg` module is available " +"as :data:`!copyreg.dispatch_table`. Therefore, one may choose to use a " +"modified copy of :data:`!copyreg.dispatch_table` as a private dispatch table." +msgstr "" + +#: ../../library/pickle.rst:793 +msgid "For example ::" +msgstr "舉例來說: ::" + +#: ../../library/pickle.rst:800 +msgid "" +"creates an instance of :class:`pickle.Pickler` with a private dispatch table " +"which handles the ``SomeClass`` class specially. Alternatively, the code ::" +msgstr "" + +#: ../../library/pickle.rst:810 +msgid "" +"does the same but all instances of ``MyPickler`` will by default share the " +"private dispatch table. On the other hand, the code ::" +msgstr "" + +#: ../../library/pickle.rst:817 +msgid "" +"modifies the global dispatch table shared by all users of the :mod:`copyreg` " +"module." +msgstr "" + +#: ../../library/pickle.rst:822 +msgid "Handling Stateful Objects" +msgstr "" + +#: ../../library/pickle.rst:828 +msgid "" +"Here's an example that shows how to modify pickling behavior for a class. " +"The :class:`!TextReader` class below opens a text file, and returns the line " +"number and line contents each time its :meth:`!readline` method is called. " +"If a :class:`!TextReader` instance is pickled, all attributes *except* the " +"file object member are saved. When the instance is unpickled, the file is " +"reopened, and reading resumes from the last location. The :meth:`!" +"__setstate__` and :meth:`!__getstate__` methods are used to implement this " +"behavior. ::" +msgstr "" + +#: ../../library/pickle.rst:874 +msgid "A sample usage might be something like this::" +msgstr "" + +#: ../../library/pickle.rst:888 +msgid "Custom Reduction for Types, Functions, and Other Objects" +msgstr "" + +#: ../../library/pickle.rst:892 +msgid "" +"Sometimes, :attr:`~Pickler.dispatch_table` may not be flexible enough. In " +"particular we may want to customize pickling based on another criterion than " +"the object's type, or we may want to customize the pickling of functions and " +"classes." +msgstr "" + +#: ../../library/pickle.rst:897 +msgid "" +"For those cases, it is possible to subclass from the :class:`Pickler` class " +"and implement a :meth:`~Pickler.reducer_override` method. This method can " +"return an arbitrary reduction tuple (see :meth:`~object.__reduce__`). It can " +"alternatively return :data:`NotImplemented` to fallback to the traditional " +"behavior." +msgstr "" + +#: ../../library/pickle.rst:902 +msgid "" +"If both the :attr:`~Pickler.dispatch_table` and :meth:`~Pickler." +"reducer_override` are defined, then :meth:`~Pickler.reducer_override` method " +"takes priority." +msgstr "" + +#: ../../library/pickle.rst:907 +msgid "" +"For performance reasons, :meth:`~Pickler.reducer_override` may not be called " +"for the following objects: ``None``, ``True``, ``False``, and exact " +"instances of :class:`int`, :class:`float`, :class:`bytes`, :class:`str`, :" +"class:`dict`, :class:`set`, :class:`frozenset`, :class:`list` and :class:" +"`tuple`." +msgstr "" + +#: ../../library/pickle.rst:913 +msgid "" +"Here is a simple example where we allow pickling and reconstructing a given " +"class::" +msgstr "" + +#: ../../library/pickle.rst:948 +msgid "Out-of-band Buffers" +msgstr "" + +#: ../../library/pickle.rst:952 +msgid "" +"In some contexts, the :mod:`pickle` module is used to transfer massive " +"amounts of data. Therefore, it can be important to minimize the number of " +"memory copies, to preserve performance and resource consumption. However, " +"normal operation of the :mod:`pickle` module, as it transforms a graph-like " +"structure of objects into a sequential stream of bytes, intrinsically " +"involves copying data to and from the pickle stream." +msgstr "" + +#: ../../library/pickle.rst:959 +msgid "" +"This constraint can be eschewed if both the *provider* (the implementation " +"of the object types to be transferred) and the *consumer* (the " +"implementation of the communications system) support the out-of-band " +"transfer facilities provided by pickle protocol 5 and higher." +msgstr "" + +#: ../../library/pickle.rst:965 +msgid "Provider API" +msgstr "" + +#: ../../library/pickle.rst:967 +msgid "" +"The large data objects to be pickled must implement a :meth:`~object." +"__reduce_ex__` method specialized for protocol 5 and higher, which returns " +"a :class:`PickleBuffer` instance (instead of e.g. a :class:`bytes` object) " +"for any large data." +msgstr "" + +#: ../../library/pickle.rst:972 +msgid "" +"A :class:`PickleBuffer` object *signals* that the underlying buffer is " +"eligible for out-of-band data transfer. Those objects remain compatible " +"with normal usage of the :mod:`pickle` module. However, consumers can also " +"opt-in to tell :mod:`pickle` that they will handle those buffers by " +"themselves." +msgstr "" + +#: ../../library/pickle.rst:979 +msgid "Consumer API" +msgstr "" + +#: ../../library/pickle.rst:981 +msgid "" +"A communications system can enable custom handling of the :class:" +"`PickleBuffer` objects generated when serializing an object graph." +msgstr "" + +#: ../../library/pickle.rst:984 +msgid "" +"On the sending side, it needs to pass a *buffer_callback* argument to :class:" +"`Pickler` (or to the :func:`dump` or :func:`dumps` function), which will be " +"called with each :class:`PickleBuffer` generated while pickling the object " +"graph. Buffers accumulated by the *buffer_callback* will not see their data " +"copied into the pickle stream, only a cheap marker will be inserted." +msgstr "" + +#: ../../library/pickle.rst:991 +msgid "" +"On the receiving side, it needs to pass a *buffers* argument to :class:" +"`Unpickler` (or to the :func:`load` or :func:`loads` function), which is an " +"iterable of the buffers which were passed to *buffer_callback*. That " +"iterable should produce buffers in the same order as they were passed to " +"*buffer_callback*. Those buffers will provide the data expected by the " +"reconstructors of the objects whose pickling produced the original :class:" +"`PickleBuffer` objects." +msgstr "" + +#: ../../library/pickle.rst:999 +msgid "" +"Between the sending side and the receiving side, the communications system " +"is free to implement its own transfer mechanism for out-of-band buffers. " +"Potential optimizations include the use of shared memory or datatype-" +"dependent compression." +msgstr "" + +#: ../../library/pickle.rst:1005 +msgid "Example" +msgstr "範例" + +#: ../../library/pickle.rst:1007 +msgid "" +"Here is a trivial example where we implement a :class:`bytearray` subclass " +"able to participate in out-of-band buffer pickling::" +msgstr "" + +#: ../../library/pickle.rst:1031 +msgid "" +"The reconstructor (the ``_reconstruct`` class method) returns the buffer's " +"providing object if it has the right type. This is an easy way to simulate " +"zero-copy behaviour on this toy example." +msgstr "" + +#: ../../library/pickle.rst:1035 +msgid "" +"On the consumer side, we can pickle those objects the usual way, which when " +"unserialized will give us a copy of the original object::" +msgstr "" + +#: ../../library/pickle.rst:1044 +msgid "" +"But if we pass a *buffer_callback* and then give back the accumulated " +"buffers when unserializing, we are able to get back the original object::" +msgstr "" + +#: ../../library/pickle.rst:1054 +msgid "" +"This example is limited by the fact that :class:`bytearray` allocates its " +"own memory: you cannot create a :class:`bytearray` instance that is backed " +"by another object's memory. However, third-party datatypes such as NumPy " +"arrays do not have this limitation, and allow use of zero-copy pickling (or " +"making as few copies as possible) when transferring between distinct " +"processes or systems." +msgstr "" + +#: ../../library/pickle.rst:1061 +msgid ":pep:`574` -- Pickle protocol 5 with out-of-band data" +msgstr "" + +#: ../../library/pickle.rst:1067 +msgid "Restricting Globals" +msgstr "" + +#: ../../library/pickle.rst:1072 +msgid "" +"By default, unpickling will import any class or function that it finds in " +"the pickle data. For many applications, this behaviour is unacceptable as " +"it permits the unpickler to import and invoke arbitrary code. Just consider " +"what this hand-crafted pickle data stream does when loaded::" +msgstr "" + +#: ../../library/pickle.rst:1082 +msgid "" +"In this example, the unpickler imports the :func:`os.system` function and " +"then apply the string argument \"echo hello world\". Although this example " +"is inoffensive, it is not difficult to imagine one that could damage your " +"system." +msgstr "" + +#: ../../library/pickle.rst:1086 +msgid "" +"For this reason, you may want to control what gets unpickled by customizing :" +"meth:`Unpickler.find_class`. Unlike its name suggests, :meth:`Unpickler." +"find_class` is called whenever a global (i.e., a class or a function) is " +"requested. Thus it is possible to either completely forbid globals or " +"restrict them to a safe subset." +msgstr "" + +#: ../../library/pickle.rst:1092 +msgid "" +"Here is an example of an unpickler allowing only few safe classes from the :" +"mod:`builtins` module to be loaded::" +msgstr "" + +#: ../../library/pickle.rst:1121 +msgid "A sample usage of our unpickler working as intended::" +msgstr "" + +#: ../../library/pickle.rst:1140 +msgid "" +"As our examples shows, you have to be careful with what you allow to be " +"unpickled. Therefore if security is a concern, you may want to consider " +"alternatives such as the marshalling API in :mod:`xmlrpc.client` or third-" +"party solutions." +msgstr "" + +#: ../../library/pickle.rst:1147 +msgid "Performance" +msgstr "" + +#: ../../library/pickle.rst:1149 +msgid "" +"Recent versions of the pickle protocol (from protocol 2 and upwards) feature " +"efficient binary encodings for several common features and built-in types. " +"Also, the :mod:`pickle` module has a transparent optimizer written in C." +msgstr "" + +#: ../../library/pickle.rst:1157 +msgid "Examples" +msgstr "範例" + +#: ../../library/pickle.rst:1159 +msgid "" +"For the simplest code, use the :func:`dump` and :func:`load` functions. ::" +msgstr "" + +#: ../../library/pickle.rst:1175 +msgid "The following example reads the resulting pickled data. ::" +msgstr "" + +#: ../../library/pickle.rst:1191 +msgid "Module :mod:`copyreg`" +msgstr ":mod:`copyreg` 模組" + +#: ../../library/pickle.rst:1192 +msgid "Pickle interface constructor registration for extension types." +msgstr "" + +#: ../../library/pickle.rst:1194 +msgid "Module :mod:`pickletools`" +msgstr ":mod:`pickletools` 模組" + +#: ../../library/pickle.rst:1195 +msgid "Tools for working with and analyzing pickled data." +msgstr "" + +#: ../../library/pickle.rst:1197 +msgid "Module :mod:`shelve`" +msgstr ":mod:`shelve` 模組" + +#: ../../library/pickle.rst:1198 +msgid "Indexed databases of objects; uses :mod:`pickle`." +msgstr "" + +#: ../../library/pickle.rst:1200 +msgid "Module :mod:`copy`" +msgstr ":mod:`copy` 模組" + +#: ../../library/pickle.rst:1201 +msgid "Shallow and deep object copying." +msgstr "" + +#: ../../library/pickle.rst:1203 +msgid "Module :mod:`marshal`" +msgstr ":mod:`marshal` 模組" + +#: ../../library/pickle.rst:1204 +msgid "High-performance serialization of built-in types." +msgstr "" + +#: ../../library/pickle.rst:1208 +msgid "Footnotes" +msgstr "註解" + +#: ../../library/pickle.rst:1209 +msgid "Don't confuse this with the :mod:`marshal` module" +msgstr "" + +#: ../../library/pickle.rst:1211 +msgid "" +"This is why :keyword:`lambda` functions cannot be pickled: all :keyword:`!" +"lambda` functions share the same name: ````." +msgstr "" + +#: ../../library/pickle.rst:1214 +msgid "" +"The exception raised will likely be an :exc:`ImportError` or an :exc:" +"`AttributeError` but it could be something else." +msgstr "" + +#: ../../library/pickle.rst:1217 +msgid "" +"The :mod:`copy` module uses this protocol for shallow and deep copying " +"operations." +msgstr "" + +#: ../../library/pickle.rst:1220 +msgid "" +"The limitation on alphanumeric characters is due to the fact that persistent " +"IDs in protocol 0 are delimited by the newline character. Therefore if any " +"kind of newline characters occurs in persistent IDs, the resulting pickled " +"data will become unreadable." +msgstr "" + +#: ../../library/pickle.rst:12 +msgid "persistence" +msgstr "persistence(持續性)" + +#: ../../library/pickle.rst:12 +msgid "persistent" +msgstr "persistent(持續)" + +#: ../../library/pickle.rst:12 +msgid "objects" +msgstr "objects(物件)" + +#: ../../library/pickle.rst:12 +msgid "serializing" +msgstr "serializing(序列化)" + +#: ../../library/pickle.rst:12 +msgid "marshalling" +msgstr "marshalling" + +#: ../../library/pickle.rst:12 +msgid "flattening" +msgstr "flattening(攤平)" + +#: ../../library/pickle.rst:12 +msgid "pickling" +msgstr "pickling" + +#: ../../library/pickle.rst:123 +msgid "External Data Representation" +msgstr "External Data Representation(外部資料表示法)" + +#: ../../library/pickle.rst:664 +msgid "copy" +msgstr "copy(複製)" + +#: ../../library/pickle.rst:664 +msgid "protocol" +msgstr "protocol(協定)" + +#: ../../library/pickle.rst:748 +msgid "persistent_id (pickle protocol)" +msgstr "persistent_id(pickle 協定)" + +#: ../../library/pickle.rst:748 +msgid "persistent_load (pickle protocol)" +msgstr "persistent_load(pickle 協定)" + +#: ../../library/pickle.rst:824 +msgid "__getstate__() (copy protocol)" +msgstr "__getstate__()(copy 協定)" + +#: ../../library/pickle.rst:824 +msgid "__setstate__() (copy protocol)" +msgstr "__setstate__()(copy 協定)" + +#: ../../library/pickle.rst:1069 +msgid "find_class() (pickle protocol)" +msgstr "find_class()(pickle 協定)" From cce719e0815985c8d39d2c615a6b0887eb7dff63 Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Thu, 22 Aug 2024 00:34:46 +0800 Subject: [PATCH 05/89] docs(library/pickle.po): editing, up to line 525 --- library/pickle.po | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/library/pickle.po b/library/pickle.po index 8c05090630..e88ad44209 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -470,40 +470,49 @@ msgid "" "Return the reconstituted object hierarchy of the pickled representation " "*data* of an object. *data* must be a :term:`bytes-like object`." msgstr "" +"回傳從 *data* 的 pickle 封包重建後的物件階層。*data* 必須是一個 :term:`bytes-" +"like object`。" #: ../../library/pickle.rst:264 msgid "" "Arguments *fix_imports*, *encoding*, *errors*, *strict* and *buffers* have " "the same meaning as in the :class:`Unpickler` constructor." msgstr "" +"引數 *fix_imports*、*encoding*、*errors*、*strict* 和 *buffers* 的意義與 :" +"class:`Unpickler` 建構式所用的相同。" #: ../../library/pickle.rst:271 msgid "The :mod:`pickle` module defines three exceptions:" -msgstr "" +msgstr ":mod:`pickle` 模組定義了以下三種例外:" #: ../../library/pickle.rst:275 msgid "" "Common base class for the other pickling exceptions. It inherits from :exc:" "`Exception`." msgstr "" +"繼承 :exc:`Exception` 類別。一個在封裝或拆封時遭遇其他例外時通用的基底類別。" #: ../../library/pickle.rst:280 msgid "" "Error raised when an unpicklable object is encountered by :class:`Pickler`. " "It inherits from :exc:`PickleError`." msgstr "" +"當 :class:`Pickler` 遭遇無法封裝物件時會引發的例外。繼承 :exc:`PickleError` " +"類別。" #: ../../library/pickle.rst:283 msgid "" "Refer to :ref:`pickle-picklable` to learn what kinds of objects can be " "pickled." -msgstr "" +msgstr "請參閱 :ref:`pickle-picklable` 以了解哪些物件是可以被封裝的。" #: ../../library/pickle.rst:288 msgid "" "Error raised when there is a problem unpickling an object, such as a data " "corruption or a security violation. It inherits from :exc:`PickleError`." msgstr "" +"拆封物件時遇到問題(如資料毀損或違反安全性原則等)所引發的意外。繼承自 :exc:" +"`PickleError` 類別。" #: ../../library/pickle.rst:291 msgid "" @@ -511,6 +520,8 @@ msgid "" "(but not necessarily limited to) AttributeError, EOFError, ImportError, and " "IndexError." msgstr "" +"拆封的時候還是可能會遭遇其他不在此列的例外(例如:AttributeError、EOFError、" +"ImportError、或 IndexError),請注意。" #: ../../library/pickle.rst:296 msgid "" From 8fd17f0895bee0495a0cfdc9a6b5355a57f86166 Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Fri, 23 Aug 2024 01:46:55 +0800 Subject: [PATCH 06/89] docs(library/pickle.po): editing, up to line 627 --- library/pickle.po | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/library/pickle.po b/library/pickle.po index e88ad44209..fdd7607b46 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -528,10 +528,12 @@ msgid "" "The :mod:`pickle` module exports three classes, :class:`Pickler`, :class:" "`Unpickler` and :class:`PickleBuffer`:" msgstr "" +"引入模組 :mod:`pickle` 時會帶來三個類別::class:`Pickler`、:class:" +"`Unpickler` 和 :class:`PickleBuffer`:" #: ../../library/pickle.rst:301 msgid "This takes a binary file for writing a pickle data stream." -msgstr "" +msgstr "接受一個用以寫入 pickle 資料流的二進位檔案。" #: ../../library/pickle.rst:303 msgid "" @@ -540,6 +542,9 @@ msgid "" "not specified, the default is :data:`DEFAULT_PROTOCOL`. If a negative " "number is specified, :data:`HIGHEST_PROTOCOL` is selected." msgstr "" +"可選引數 *protocol* 接受整數,用來要求封裝器(pickler)使用指定的協定;支援" +"從 0 版起到 :data:`HIGHEST_PROTOCOL` 版的協定。如未指定,則預設為 :data:" +"`DEFAULT_PROTOCOL`。若指定了負數,則視為選擇 :data:`HIGHEST_PROTOCOL`。" #: ../../library/pickle.rst:308 msgid "" @@ -548,6 +553,9 @@ msgid "" "class:`io.BytesIO` instance, or any other custom object that meets this " "interface." msgstr "" +"傳予引數 *file* 的物件必須支援可寫入單一位元組的 write() 方法。只要滿足此條" +"件,傳入的物件可以是一個硬碟上二進位檔案、一個 :class:`io.BytesIO` 實例或任何" +"其他滿足這個介面要求的物件。" #: ../../library/pickle.rst:313 msgid "" @@ -555,12 +563,18 @@ msgid "" "map the new Python 3 names to the old module names used in Python 2, so that " "the pickle data stream is readable with Python 2." msgstr "" +"若 *fix_imports* 設為 true 且 *protocol* 版本小於 3,本模組會嘗試將 Python 3 " +"的新模組名稱轉換為 Python 2 所支援的舊名,以讓 Python 2 能正確地讀取此資料" +"流。" +# SkyLull: 以下幾個關於 buffer_callback 的翻譯需要進一步的校對。何謂out-of-band? buffer view 應作何翻譯? #: ../../library/pickle.rst:317 msgid "" "If *buffer_callback* is ``None`` (the default), buffer views are serialized " "into *file* as part of the pickle stream." msgstr "" +"如果 *buffer_callback* 是 ``None`` (預設值),緩衝區的視圖會作為 pickle 封裝" +"串流的一部分被序列化進 *file* 中。" #: ../../library/pickle.rst:320 msgid "" @@ -569,22 +583,30 @@ msgid "" "``None``), the given buffer is :ref:`out-of-band `; otherwise " "the buffer is serialized in-band, i.e. inside the pickle stream." msgstr "" +"如果 *buffer_callback* 不是 ``None``,則它可以被多次呼叫並傳遞一個緩衝區的視" +"圖。如果回呼函數回傳一個假值(例如 ``None``),則所給的緩衝區將被視為 :ref:`" +"帶外資料 `;否則,該緩衝區將被視為 pickle 串流的帶內資料被序列" +"化。" #: ../../library/pickle.rst:325 msgid "" "It is an error if *buffer_callback* is not ``None`` and *protocol* is " "``None`` or smaller than 5." msgstr "" +"如果 *buffer_callback* 不是 ``None`` 且 *protocol* 是 ``None`` 或小於 5 則會" +"報錯。" #: ../../library/pickle.rst:333 msgid "" "Write the pickled representation of *obj* to the open file object given in " "the constructor." -msgstr "" +msgstr "將已封裝(pickled)的 *obj* 寫入已在建構式中開啟的對應檔案。" #: ../../library/pickle.rst:338 msgid "Do nothing by default. This exists so a subclass can override it." msgstr "" +"預設不進行任何動作。這是一種抽象方法,用於讓後續繼承這個類別的物件可以覆寫本" +"方法函數。" #: ../../library/pickle.rst:340 msgid "" @@ -594,6 +616,10 @@ msgid "" "defined by :meth:`Unpickler.persistent_load`. Note that the value returned " "by :meth:`persistent_id` cannot itself have a persistent ID." msgstr "" +"如果 :meth:`persistent_id` 回傳 ``None``,則 *obj* 會照一般的方式進行封裝" +"(pickling)。若回傳其他值,則 :class:`Pickler` 會將該值作為 *obj* 的永久識別" +"碼回傳。此永久識別碼的意義應由 :meth:`Unpickler.persistent_load` 定義。請注" +"意 :meth:`persistent_id` 回傳的值本身不能擁有自己的永久識別碼。" #: ../../library/pickle.rst:346 ../../library/pickle.rst:447 msgid "See :ref:`pickle-persistent` for details and examples of uses." From b87ff2c37217cf55031537c2148133a317af33d2 Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Sat, 24 Aug 2024 17:50:15 +0800 Subject: [PATCH 07/89] docs(library/pickle.po): editing, up to line 778 --- library/pickle.po | 78 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 65 insertions(+), 13 deletions(-) diff --git a/library/pickle.po b/library/pickle.po index fdd7607b46..102d770848 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -194,7 +194,9 @@ msgstr "" "JSON 具有高互通性(interoperability)且在 Python 以外的環境也被大量利用,但 " "pickle 只能在 Python 內使用。" -# Skylull: introspection, introspection facilities +# Skylull: [t] +# introspection -> 自省 +# introspection facilities -> 自省措施 # https://zh.wikipedia.org/wiki/%E5%86%85%E7%9C%81_(%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%A7%91%E5%AD%A6) # https://book.pythontips.com/en/latest/object_introspection.html # https://www.geeksforgeeks.org/code-introspection-in-python/ @@ -207,7 +209,7 @@ msgid "" "`specific object APIs `);" msgstr "" "預設狀態下的 JSON 只能紀錄一小部份的 Python 內建型別,且無法紀錄自訂類別;但" -"透過 Python 的自省功能,pickle 可以紀錄絕大多數的 Python 型別(其他比較複雜的" +"透過 Python 的自省措施,pickle 可以紀錄絕大多數的 Python 型別(其他比較複雜的" "狀況也可以透過實作 :ref:`specific object APIs ` 來解決);" #: ../../library/pickle.rst:110 @@ -321,6 +323,13 @@ msgstr "" "版本 5 的協定在 Python 3.8 被新增。現在能支援帶外資料(Out-of-band data)並加" "速帶內資料的處理速度。請參閱 :pep:`574` 以了解第 5 版協定改進的細節。" +# SkyLull: [t] +# persistent -> 持久 +# data persistent -> 資料持久化 +# https://zh.wikipedia.org/zh- +# tw/%E5%8F%AF%E6%8C%81%E4%B9%85%E5%8C%96%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84 +# https://1fly2sky.wordpress.com/2016/04/05/%E6%8C%81%E4%B9%85%E5%B1%A4data- +# persistence-layer/ #: ../../library/pickle.rst:168 msgid "" "Serialization is a more primitive notion than persistence; although :mod:" @@ -354,7 +363,7 @@ msgid "" "de-serialization, you can create a :class:`Pickler` or an :class:`Unpickler` " "object, respectively." msgstr "" -"想要序列化一個物件,你只需要呼叫 :func:`dumps` 函數。而當你想要去序列化一個資" +"想要序列化一個物件,你只需要呼叫 :func:`dumps` 函式。而當你想要去序列化一個資" "料流時,你只需要呼叫 :func:`loads` 即可。不過,若你希望能各自對序列化和去序列" "化的過程中有更多的掌控度,你可以自訂一個 :class:`Pickler` 或 :class:" "`Unpickler` 物件。" @@ -370,7 +379,7 @@ msgid "" "func:`dump` and :func:`dumps` as well as the :class:`Pickler` constructor." msgstr "" "一個整數,表示可使用的最高\\ :ref:`協定版本 `。這個值可作" -"為 *protocol* 的數值傳給 :func:`dump` 和 :func:`dumps` 函數以及 :class:" +"為 *protocol* 的數值傳給 :func:`dump` 和 :func:`dumps` 函式以及 :class:" "`Pickler` 建構式。" #: ../../library/pickle.rst:200 @@ -396,7 +405,7 @@ msgstr "預設協定版本為 4。" msgid "" "The :mod:`pickle` module provides the following functions to make the " "pickling process more convenient:" -msgstr ":mod:`pickle` 模組提供下列函數來簡化封裝的過程:" +msgstr ":mod:`pickle` 模組提供下列函式來簡化封裝的過程:" #: ../../library/pickle.rst:218 msgid "" @@ -567,7 +576,10 @@ msgstr "" "的新模組名稱轉換為 Python 2 所支援的舊名,以讓 Python 2 能正確地讀取此資料" "流。" -# SkyLull: 以下幾個關於 buffer_callback 的翻譯需要進一步的校對。何謂out-of-band? buffer view 應作何翻譯? +# SkyLull: 以下幾個關於 buffer_callback 的翻譯需要進一步的校對。何謂out-of-band? buffer view +# 應作何翻譯? +# out-of-band 目前參考 https://kb.synology.com/zh- +# tw/DSM/tutorial/Quick_Start_OOB_Management `帶外管理` 譯作 `帶外` #: ../../library/pickle.rst:317 msgid "" "If *buffer_callback* is ``None`` (the default), buffer views are serialized " @@ -583,8 +595,8 @@ msgid "" "``None``), the given buffer is :ref:`out-of-band `; otherwise " "the buffer is serialized in-band, i.e. inside the pickle stream." msgstr "" -"如果 *buffer_callback* 不是 ``None``,則它可以被多次呼叫並傳遞一個緩衝區的視" -"圖。如果回呼函數回傳一個假值(例如 ``None``),則所給的緩衝區將被視為 :ref:`" +"如果 *buffer_callback* 不是 ``None``,則它可以被多次呼叫並回傳一個緩衝區的視" +"圖。如果回呼函式回傳一個假值(例如 ``None``),則所給的緩衝區將被視為 :ref:`" "帶外資料 `;否則,該緩衝區將被視為 pickle 串流的帶內資料被序列" "化。" @@ -606,7 +618,7 @@ msgstr "將已封裝(pickled)的 *obj* 寫入已在建構式中開啟的對 msgid "Do nothing by default. This exists so a subclass can override it." msgstr "" "預設不進行任何動作。這是一種抽象方法,用於讓後續繼承這個類別的物件可以覆寫本" -"方法函數。" +"方法函式。" #: ../../library/pickle.rst:340 msgid "" @@ -625,6 +637,13 @@ msgstr "" msgid "See :ref:`pickle-persistent` for details and examples of uses." msgstr "關於細節與用法範例請見 :ref:`pickle-persistent`。" +# SkyLull: [t] +# dispatch table -> 調度表 +# https://zh.wiktionary.org/zh-hant/dispatch_table +# reduce -> 縮減 +# reduction function -> 縮減函式 +# 這個是指reduce()函式類型的運算,類似sql的aggregation類型運算,故參閱以下內文,譯為縮減 +# https://support.google.com/docs/answer/12657238?hl=zh-Hant #: ../../library/pickle.rst:350 msgid "" "A pickler object's dispatch table is a registry of *reduction functions* of " @@ -633,6 +652,10 @@ msgid "" "reduction function takes a single argument of the associated class and " "should conform to the same interface as a :meth:`~object.__reduce__` method." msgstr "" +"封裝器(pickler)物件含有的的調度表是一個 *縮減函式* (reduction function)的" +"註冊表,可以使用 :func:`copyreg.pickle` 來宣告這類縮減函式。它是一個以類別為" +"鍵、還原函式為值的映射表。縮減函式應準備接收一個對應類別的引數,並應遵循與 :" +"meth:`~object.__reduce__` 方法相同的介面。" #: ../../library/pickle.rst:358 msgid "" @@ -644,6 +667,11 @@ msgid "" "`dispatch_table` attribute then this will be used as the default dispatch " "table for instances of that class." msgstr "" +"預設情況下,封裝器(pickler)物件不會有 :attr:`dispatch_table` 屬性,而是會使" +"用由 :mod:`copyreg` 模組管理的全域調度表。不過,若要自訂某個封裝器(pickler)" +"物件的序列化行為,可以將 :attr:`dispatch_table` 屬性設置為類字典物件。另外," +"如果 :class:`Pickler` 的子類別具有 :attr:`dispatch_table` 屬性,那麼這個屬性" +"將作為該子類別實例的預設調度表。" #: ../../library/pickle.rst:367 msgid "See :ref:`pickle-dispatch` for usage examples." @@ -657,10 +685,12 @@ msgid "" "and can optionally return :data:`NotImplemented` to fallback on :attr:" "`dispatch_table`-registered reducers to pickle ``obj``." msgstr "" +"傳 :data:`NotImplemented` 以退回(fallback)並改為使用 :attr:" +"`dispatch_table` 中登錄的縮減方法來封裝 ``obj``。" #: ../../library/pickle.rst:379 msgid "For a detailed example, see :ref:`reducer_override`." -msgstr "" +msgstr "請查閱 :ref:`reducer_override` 來參考其他較詳細的範例。" #: ../../library/pickle.rst:385 msgid "" @@ -669,20 +699,23 @@ msgid "" "superfluous PUT opcodes. It should not be used with self-referential " "objects, doing otherwise will cause :class:`Pickler` to recurse infinitely." msgstr "" +"已棄用。如果設置為 true,將啟用快速模式。快速模式會停用備忘(memo),因此能透" +"過不產生多餘的 PUT 操作碼(OpCode)來加速封裝過程。它不應被用於自我參照物件," +"否則將導致 :class:`Pickler` 陷入無限遞迴。" #: ../../library/pickle.rst:391 msgid "Use :func:`pickletools.optimize` if you need more compact pickles." -msgstr "" +msgstr "使用 :func:`pickletools.optimize` 以獲得更緊湊的 pickle 輸出。" #: ../../library/pickle.rst:396 msgid "This takes a binary file for reading a pickle data stream." -msgstr "" +msgstr "這個物件接受一個二進位檔案 *file* 來從中讀取 pickle 資料流。" #: ../../library/pickle.rst:398 msgid "" "The protocol version of the pickle is detected automatically, so no protocol " "argument is needed." -msgstr "" +msgstr "協定版本號會被自動偵測,所以不需要在這邊手動輸入。" #: ../../library/pickle.rst:401 msgid "" @@ -693,6 +726,10 @@ msgid "" "binary reading, an :class:`io.BytesIO` object, or any other custom object " "that meets this interface." msgstr "" +"參數 *file* 必須擁有三個方法,分別是接受整數作為引數的 read() 方法、接受緩衝" +"區作為引數的 readinto() 方法以及不需要引數的 readline() 方法,如同在 :class:" +"`io.BufferedIOBase` 的介面一樣。因此,*file* 可以是一個以二進位讀取模式開啟的" +"檔案、一個 :class:`io.BytesIO` 物件、或任何符合此介面的自訂物件。" #: ../../library/pickle.rst:408 msgid "" @@ -707,6 +744,14 @@ msgid "" "datetime`, :class:`~datetime.date` and :class:`~datetime.time` pickled by " "Python 2." msgstr "" +"可選引數 *fix_imports*,*encoding* 和 *errors* 用來控制 Python 2 pickle 資料" +"的相容性支援。如果 *fix_imports* 為 true,則 pickle 模組會嘗試將舊的 Python " +"2 模組名稱映射到 Python 3 中使用的新名稱。*encoding* 和 *errors* 告訴 pickle " +"模組如何解碼由 Python 2 pickle 封裝的 8 位元字串實例;*encoding* 和 *errors* " +"預設分別為 'ASCII' 和 'strict'。*encoding* 可以設定為 'bytes' 以將這些 8 位元" +"字串實例讀為位元組物件。而由 Python 2 封裝的 NumPy 陣列、:class:`~datetime." +"datetime`、:class:`~datetime.date` 和 :class:`~datetime.time` 的實例則必須使" +"用 ``encoding='latin1'`` 來拆封。" #: ../../library/pickle.rst:419 msgid "" @@ -715,6 +760,9 @@ msgid "" "*buffer_callback* argument was ``None`` when a :class:`Pickler` was " "instantiated (or when :func:`dump` or :func:`dumps` was called)." msgstr "" +"如果 *buffers* 是 ``None``(預設值),那麼去序列化所需的所有資料都必須已經包" +"含在 pickle 串流中。這意味著當初在建立對應的 :class:`Pickler` 時(或在呼叫 :" +"func:`dump` 或 :func:`dumps` 時)*buffer_callback* 引數必須為 ``None``。" #: ../../library/pickle.rst:424 msgid "" @@ -723,6 +771,10 @@ msgid "" "of-band ` buffer view. Such buffers have been given in order to " "the *buffer_callback* of a Pickler object." msgstr "" +"如果 *buffers* 不是 ``None``,則其應該是一個可疊代物件,內含數個支援緩衝區的" +"物件,並且每當 pickle 串流引用一個 :ref:`帶外 ` 緩衝區視圖時將會" +"被照順序消耗。這些緩衝資料當初建立時應已按照順序給定予 Pickler 物件中的 " +"*buffer_callback*。" #: ../../library/pickle.rst:434 msgid "" From 853b0957f517a7d2667c6812a4d317a9abbd9a6c Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Fri, 30 Aug 2024 06:37:31 +0800 Subject: [PATCH 08/89] docs(library/pickle.po): editing, up to line 994 --- library/pickle.po | 70 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 9 deletions(-) diff --git a/library/pickle.po b/library/pickle.po index 102d770848..ba3da23a4f 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -782,10 +782,12 @@ msgid "" "in the constructor, and return the reconstituted object hierarchy specified " "therein. Bytes past the pickled representation of the object are ignored." msgstr "" +"開啟先前被傳入建構子的檔案,從中讀取一個被 pickle 封裝的物件,並回傳重建完成" +"的物件階層。超過 pickle 表示範圍的位元組會被忽略。" #: ../../library/pickle.rst:441 msgid "Raise an :exc:`UnpicklingError` by default." -msgstr "" +msgstr "預設會拋出 :exc:`UnpicklingError` 例外。" #: ../../library/pickle.rst:443 msgid "" @@ -793,6 +795,8 @@ msgid "" "the persistent ID *pid*. If an invalid persistent ID is encountered, an :" "exc:`UnpicklingError` should be raised." msgstr "" +"若有定義 :meth:`persistent_load`,則其將回傳符合持久化識別碼 `pid` 的物件。如" +"果遭遇了無效的持久化識別碼,則會引發 :exc:`UnpicklingError`。" #: ../../library/pickle.rst:451 msgid "" @@ -801,6 +805,9 @@ msgid "" "unlike its name suggests, :meth:`find_class` is also used for finding " "functions." msgstr "" +"如有需要將引入 *module* ,並從中返回名為 *name* 的物件,這裡的 *module* 和 " +"*name* 引數接受的輸入是 :class:`str` 物件。注意,雖然名稱上看起來不像,但 :" +"meth:`find_class` 亦可被用於尋找其他函式。" #: ../../library/pickle.rst:456 msgid "" @@ -808,6 +815,8 @@ msgid "" "how they can be loaded, potentially reducing security risks. Refer to :ref:" "`pickle-restrict` for details." msgstr "" +"子類別可以覆寫此方法以控制可以載入哪些類型的物件、以及如何載入它們,從而潛在" +"地降低安全性風險。詳情請參考 :ref:`pickle-restrict`。" #: ../../library/pickle.rst:460 msgid "" @@ -817,12 +826,18 @@ msgstr "" "引發一個附帶引數 ``module``、``name`` 的\\ :ref:`稽核事件 ` " "``pickle.find_class``。" +# SkyLull: [T] +# 參見 #729 +# wrapper -> 包裝器 #: ../../library/pickle.rst:464 msgid "" "A wrapper for a buffer representing picklable data. *buffer* must be a :ref:" "`buffer-providing ` object, such as a :term:`bytes-like " "object` or a N-dimensional array." msgstr "" +"一個表示了含有可封裝數據緩衝區的包裝函數(wrapper function)。*buffer* 必須是" +"一個 :ref:`提供緩衝區 ` 的物件,例如一個 :term:`類位元組物件" +"(bytes-like object)` 或 N 維陣列。" #: ../../library/pickle.rst:468 msgid "" @@ -830,6 +845,8 @@ msgid "" "to pass it to other APIs expecting a buffer-providing object, such as :class:" "`memoryview`." msgstr "" +":class:`PickleBuffer` 本身就是一個提供緩衝區的物件,所以是能夠將其提供給其它" +"「預期收到含有緩衝物件的 API」的,比如 :class:`memoryview`。" #: ../../library/pickle.rst:472 msgid "" @@ -837,7 +854,12 @@ msgid "" "or higher. They are eligible for :ref:`out-of-band serialization `." msgstr "" +":class:`PickleBuffer` 物件僅能由 5 版或以上的 pickle 協定進行封裝。該物件亦能" +"被作為帶外資料來進行:ref:`帶外資料序列化 `" +# SkyLull: [T] oh boy... 好多術語... +# format B: https://learn.microsoft.com/zh-tw/dotnet/standard/base-types/standard-numeric-format-strings#BFormatString +# C-contiguous, Fortran-contiguous: https://stackoverflow.com/a/26999092 #: ../../library/pickle.rst:480 msgid "" "Return a :class:`memoryview` of the memory area underlying this buffer. The " @@ -845,53 +867,63 @@ msgid "" "``B`` (unsigned bytes). :exc:`BufferError` is raised if the buffer is " "neither C- nor Fortran-contiguous." msgstr "" +"返回此緩衝區底層記憶體區域的 :class:`memoryview`。被返回的物件是一個(在 C 語" +"言的 formatter 格式中)以 ``B`` (unsigned bytes) 二進位格式儲存、一維且列連續" +"(C-contiguous)的 memoryview。如果緩衝區既不是列連續(C-contiguous)也不是行" +"連續(Fortran-contiguous)的,則會引發 :exc:`BufferError`。" #: ../../library/pickle.rst:487 msgid "Release the underlying buffer exposed by the PickleBuffer object." -msgstr "" +msgstr "釋放 PickleBuffer 物件現正曝光中的緩衝區。" #: ../../library/pickle.rst:493 msgid "What can be pickled and unpickled?" -msgstr "" +msgstr "哪些物件能或不能被封裝、拆封?" #: ../../library/pickle.rst:495 msgid "The following types can be pickled:" -msgstr "" +msgstr "下列型別可以被封裝:" #: ../../library/pickle.rst:497 msgid "" "built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, and :data:" "`NotImplemented`);" msgstr "" +"內建常數(``None``、``True``、``False``、``Ellipsis`` 和 :data:" +"`NotImplemented`);" #: ../../library/pickle.rst:500 msgid "integers, floating-point numbers, complex numbers;" -msgstr "" +msgstr "整數、浮點數和複數;" #: ../../library/pickle.rst:502 msgid "strings, bytes, bytearrays;" -msgstr "" +msgstr "字串、位元組物件、位元組陣列;" #: ../../library/pickle.rst:504 msgid "" "tuples, lists, sets, and dictionaries containing only picklable objects;" -msgstr "" +msgstr "元組(tuple)、串列(list)、集合(set)和僅含有可封裝物件的字典;" #: ../../library/pickle.rst:506 msgid "" "functions (built-in and user-defined) accessible from the top level of a " "module (using :keyword:`def`, not :keyword:`lambda`);" msgstr "" +"在模組最表面的層級就能被存取的函式(內建或自訂的皆可,不過僅限使用 :keyword:" +"`def` 定義的函式,:keyword:`lambda` 函式不適用);" #: ../../library/pickle.rst:509 msgid "classes accessible from the top level of a module;" -msgstr "" +msgstr "在模組最表面的層級就能被存取的類別;" #: ../../library/pickle.rst:511 msgid "" "instances of such classes whose the result of calling :meth:`~object." "__getstate__` is picklable (see section :ref:`pickle-inst` for details)." msgstr "" +"實例,只要在呼叫了 :meth:`~object.__getstate__` 後其回傳值全都是可封裝物件。" +"(詳情請參閱 :ref:`pickle-inst`)。" #: ../../library/pickle.rst:514 msgid "" @@ -902,7 +934,14 @@ msgid "" "`RecursionError` will be raised in this case. You can carefully raise this " "limit with :func:`sys.setrecursionlimit`." msgstr "" +"嘗試封裝無法封裝的物件會引發 :exc:`PicklingError` 例外;注意當這種情況發生" +"時,可能已經有未知數量的位元組已被寫入到檔案。嘗試封裝深度遞迴的資料結構可能" +"會導致其超出最大遞迴深度,在這種情況下會引發 :exc:`RecursionError` 例外。你可" +"以(小心地)使用 :func:`sys.setrecursionlimit` 來提高此上限。" +# SkyLull: [T] +# 請見官方術語表 +# qualified name -> 限定名稱 #: ../../library/pickle.rst:521 msgid "" "Note that functions (built-in and user-defined) are pickled by fully :term:" @@ -913,6 +952,11 @@ msgid "" "environment, and the module must contain the named object, otherwise an " "exception will be raised. [#]_" msgstr "" +"請注意,函式(內建及自訂兩者皆是)是依據完整的 :term:`限定名稱 ` 來封裝,而非依其值。[#]_ 這意味著封裝時只有函式名稱、所屬的模組和所屬" +"的類別名稱會被封裝。函式本身的程式碼及其附帶的任何屬性均不會被封裝。因此,在" +"拆封該物件的環境中,定義此函式的模組必須可被引入,且該模組必須包含具此命名之" +"物件,否則將引發例外。 [#]_" #: ../../library/pickle.rst:528 msgid "" @@ -921,12 +965,15 @@ msgid "" "class's code or data is pickled, so in the following example the class " "attribute ``attr`` is not restored in the unpickling environment::" msgstr "" +"同樣情況,類別是依照其完整限定名稱來進行封裝,因此在進行拆封的環境中會具有同" +"上的限制。類別中的程式碼或資料皆不會被封裝,因此在以下範例中,注意到類別屬性 " +"``attr`` 在拆封的環境中不會被還原::" #: ../../library/pickle.rst:538 msgid "" "These restrictions are why picklable functions and classes must be defined " "at the top level of a module." -msgstr "" +msgstr "這些限制就是可封裝的函式和類別必須被定義在模組頂層的原因。" #: ../../library/pickle.rst:541 msgid "" @@ -939,6 +986,11 @@ msgid "" "that suitable conversions can be made by the class's :meth:`~object." "__setstate__` method." msgstr "" +"同樣地,當類別實例被封裝時,它所屬類別具有的程式碼和資料不會被一起封裝。只有" +"實例資料本身會被封裝。這是有意而為的,因為如此你才可以在類別中修正錯誤或新增" +"其他方法,且於此同時仍能夠載入使用較早期版本的類別所建立的物件實例。如果您預" +"計將有長期存在的物件、且該物件將經歷許多版本的更替,你可以在物件中存放一個版" +"本號,以便未來能透過 :meth:`~object.__setstate__` 方法來進行適當的版本轉換。" #: ../../library/pickle.rst:553 msgid "Pickling Class Instances" From 148a7546bfa4c55b7d66bbbf87aa2f947b967f8f Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Fri, 6 Sep 2024 17:34:01 +0800 Subject: [PATCH 09/89] docs(library/pickle.po): editing, up to line 1178 --- library/pickle.po | 63 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/library/pickle.po b/library/pickle.po index 22467f56d4..360d337efa 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -96,7 +96,7 @@ msgid "" "pyc` files." msgstr "" "Python 有另一個比較原始的序列化模組叫 :mod:`marshal`,不過其設計目的是為了支" -"援 Python 的預編譯功能 :file:`.pyc` 運作。總地來說,沒事不要用 :mod:" +"援 Python 的預編譯功能 :file:`.pyc` 的運作。總地來說,沒事不要用 :mod:" "`marshal`。" #: ../../library/pickle.rst:57 @@ -194,7 +194,7 @@ msgstr "" "JSON 具有高互通性(interoperability)且在 Python 以外的環境也被大量利用,但 " "pickle 只能在 Python 內使用。" -# Skylull: [t] +# Skylull: [T] # introspection -> 自省 # introspection facilities -> 自省措施 # https://zh.wikipedia.org/wiki/%E5%86%85%E7%9C%81_(%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%A7%91%E5%AD%A6) @@ -323,7 +323,7 @@ msgstr "" "版本 5 的協定在 Python 3.8 被新增。現在能支援帶外資料(Out-of-band data)並加" "速帶內資料的處理速度。請參閱 :pep:`574` 以了解第 5 版協定改進的細節。" -# SkyLull: [t] +# SkyLull: [T] # persistent -> 持久 # data persistent -> 資料持久化 # https://zh.wikipedia.org/zh- @@ -637,7 +637,7 @@ msgstr "" msgid "See :ref:`pickle-persistent` for details and examples of uses." msgstr "關於細節與用法範例請見 :ref:`pickle-persistent`。" -# SkyLull: [t] +# SkyLull: [T] # dispatch table -> 調度表 # https://zh.wiktionary.org/zh-hant/dispatch_table # reduce -> 縮減 @@ -857,8 +857,9 @@ msgstr "" ":class:`PickleBuffer` 物件僅能由 5 版或以上的 pickle 協定進行封裝。該物件亦能" "被作為帶外資料來進行:ref:`帶外資料序列化 `" -# SkyLull: [T] oh boy... 好多術語... -# format B: https://learn.microsoft.com/zh-tw/dotnet/standard/base-types/standard-numeric-format-strings#BFormatString +# SkyLull: oh boy... 好多術語... +# format B: https://learn.microsoft.com/zh-tw/dotnet/standard/base- +# types/standard-numeric-format-strings#BFormatString # C-contiguous, Fortran-contiguous: https://stackoverflow.com/a/26999092 #: ../../library/pickle.rst:480 msgid "" @@ -994,13 +995,15 @@ msgstr "" #: ../../library/pickle.rst:553 msgid "Pickling Class Instances" -msgstr "" +msgstr "Pickling 類別實例" #: ../../library/pickle.rst:557 msgid "" "In this section, we describe the general mechanisms available to you to " "define, customize, and control how class instances are pickled and unpickled." msgstr "" +"在這一個章節,我們會講述如何封裝或拆封一個物件實例的相關機制,以方便你進行自" +"訂。" #: ../../library/pickle.rst:560 msgid "" @@ -1011,12 +1014,17 @@ msgid "" "creates an uninitialized instance and then restores the saved attributes. " "The following code shows an implementation of this behaviour::" msgstr "" +"大部分的實例不需要額外的程式碼就已經是可封裝的了。在這樣的預設狀況中,pickle " +"模組透過自省機制來取得類別及其實例的屬性。當類別實例被拆封時,其 :meth:" +"`~object.__init__` 方法通常*不會*被呼叫。預設行為首先會建立一個未初始化的實" +"例,然後還原紀錄中的屬性。以下程式碼的實作展示了前述行為::" #: ../../library/pickle.rst:575 msgid "" "Classes can alter the default behaviour by providing one or several special " "methods:" msgstr "" +"被封裝的目標類別可以提供一個或數個下列特殊方法來改變 pickle 的預設行為:" #: ../../library/pickle.rst:580 msgid "" @@ -1027,6 +1035,10 @@ msgid "" "dictionary of named arguments for constructing the object. Those will be " "passed to the :meth:`__new__` method upon unpickling." msgstr "" +"在第 2 版協定或更新的版本中,有實作 :meth:`__getnewargs_ex__` 方法的類別,可" +"以決定在拆封時要傳遞給 :meth:`__new__` 方法的值。該方法必須回傳一個 ``(args, " +"kwargs)`` 的組合,其中 *args* 是一個位置引數的元組(tuple),*kwargs* 是一個" +"用於建構物件的命名引數字典。這些資訊將在拆封時傳遞給 :meth:`__new__` 方法。" #: ../../library/pickle.rst:588 msgid "" @@ -1034,10 +1046,12 @@ msgid "" "requires keyword-only arguments. Otherwise, it is recommended for " "compatibility to implement :meth:`__getnewargs__`." msgstr "" +"如果目標類別的方法 :meth:`__new__` 需要僅限關鍵字的參數時,你應該實作此方法。" +"否則,為了提高相容性,建議你改為實作 :meth:`__getnewargs__`。" #: ../../library/pickle.rst:592 msgid ":meth:`__getnewargs_ex__` is now used in protocols 2 and 3." -msgstr "" +msgstr "在第 2、3 版的協定中現在改為使用 :meth:`__getnewargs_ex__`。" #: ../../library/pickle.rst:598 msgid "" @@ -1045,18 +1059,24 @@ msgid "" "supports only positional arguments. It must return a tuple of arguments " "``args`` which will be passed to the :meth:`__new__` method upon unpickling." msgstr "" +"此方法與 :meth:`__getnewargs_ex__` 的目的一樣,但僅支援位置參數。它必須回傳一" +"個由傳入引數所組成的元組(tuple)``args``,這些引數會在拆封時傳遞給 :meth:" +"`__new__` 方法。" #: ../../library/pickle.rst:602 msgid "" ":meth:`__getnewargs__` will not be called if :meth:`__getnewargs_ex__` is " "defined." msgstr "" +"當有定義 :meth:`__getnewargs_ex__` 的時候便不會呼叫 :meth:`__getnewargs__`。" #: ../../library/pickle.rst:605 msgid "" "Before Python 3.6, :meth:`__getnewargs__` was called instead of :meth:" "`__getnewargs_ex__` in protocols 2 and 3." msgstr "" +"在 Python 3.6 之前、版本 2 和版本 3 的協定中,會呼叫 :meth:`__getnewargs__` " +"而非 :meth:`__getnewargs_ex__`。" #: ../../library/pickle.rst:612 msgid "" @@ -1065,18 +1085,25 @@ msgid "" "pickled as the contents for the instance, instead of a default state. There " "are several cases:" msgstr "" +"目標類別可以透過覆寫方法 :meth:`__getstate__` 進一步影響其實例被封裝的方式。" +"封裝時,呼叫該方法所返回的物件將作為該實例的內容被封裝、而非一個預設狀態。以" +"下列出幾種預設狀態:" #: ../../library/pickle.rst:617 msgid "" "For a class that has no instance :attr:`~object.__dict__` and no :attr:" "`~object.__slots__`, the default state is ``None``." msgstr "" +"沒有 :attr:`~object.__dict__` 和 :attr:`~object.__slots__` 實例的類別,其預設" +"狀態為 ``None``。" #: ../../library/pickle.rst:620 msgid "" "For a class that has an instance :attr:`~object.__dict__` and no :attr:" "`~object.__slots__`, the default state is ``self.__dict__``." msgstr "" +"有 :attr:`~object.__dict__` 實例、但沒有 :attr:`~object.__slots__` 實例的類" +"別,其預設狀態為 ``self.__dict__``。" #: ../../library/pickle.rst:623 msgid "" @@ -1085,6 +1112,10 @@ msgid "" "``self.__dict__``, and a dictionary mapping slot names to slot values. Only " "slots that have a value are included in the latter." msgstr "" +"有 :attr:`~object.__dict__` 和 :attr:`~object.__slots__` 實例的類別,其預設狀" +"態是一個含有兩個字典的元組(tuple),該二字典分別為 ``self.__dict__`` 本身," +"和紀錄欄位(slot)名稱和值對應關係的字典(只有含有值的欄位(slot)會被紀錄其" +"中)。" #: ../../library/pickle.rst:629 msgid "" @@ -1093,12 +1124,15 @@ msgid "" "``None`` and whose second item is a dictionary mapping slot names to slot " "values described in the previous bullet." msgstr "" +"沒有 :attr:`~object.__dict__` 但有 :attr:`~object.__slots__` 實例的類別,其預" +"設狀態是一個二元組(tuple),元組中的第一個值是 ``None``,第二個值則是紀錄欄" +"位(slot)名稱和值對應關係的字典(與前一項提到的字典是同一個)。" #: ../../library/pickle.rst:634 msgid "" "Added the default implementation of the ``__getstate__()`` method in the :" "class:`object` class." -msgstr "" +msgstr "在 :class:`object` 類別中增加預設的 ``__getstate__()`` 實作。" #: ../../library/pickle.rst:641 msgid "" @@ -1107,12 +1141,17 @@ msgid "" "state object to be a dictionary. Otherwise, the pickled state must be a " "dictionary and its items are assigned to the new instance's dictionary." msgstr "" +"在拆封時,如果類別定義了 :meth:`__setstate__`,則會使用拆封後的狀態呼叫它。在" +"這種情況下,紀錄狀態的物件不需要是字典(dictionary)。否則,封裝時的狀態紀錄" +"必須是一個字典,其紀錄的項目將被賦值給新實例的字典。" #: ../../library/pickle.rst:648 msgid "" "If :meth:`__reduce__` returns a state with value ``None`` at pickling, the :" "meth:`__setstate__` method will not be called upon unpickling." msgstr "" +"如果 :meth:`__reduce__` 在封裝時返回了 ``None`` 狀態,則拆封時就不會去呼叫 :" +"meth:`__setstate__`。" #: ../../library/pickle.rst:652 msgid "" @@ -1120,6 +1159,8 @@ msgid "" "use the methods :meth:`~object.__getstate__` and :meth:`~object." "__setstate__`." msgstr "" +"參閱 :ref:`pickle-state` 以了解 :meth:`~object.__getstate__` 和 :meth:" +"`~object.__setstate__` 的使用方法。" #: ../../library/pickle.rst:657 msgid "" @@ -1130,6 +1171,10 @@ msgid "" "such an invariant, as :meth:`~object.__init__` is not called when unpickling " "an instance." msgstr "" +"在拆封時,某些方法如 :meth:`~object.__getattr__`、:meth:`~object." +"__getattribute__` 或 :meth:`~object.__setattr__` 可能會在建立實例時被呼叫。如" +"果這些方法依賴了某些實例內部的不變性,則應實作 :meth:`~object.__new__` 以建立" +"此不變性,因為在拆封實例時不會呼叫 :meth:`~object.__init__`。" #: ../../library/pickle.rst:666 msgid "" From 080d0aad713ac4fe79d54a193ee6c347d6b63bed Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Fri, 13 Sep 2024 20:19:13 +0800 Subject: [PATCH 10/89] docs(library/pickle.po): editing, up to line 1288 --- library/pickle.po | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/library/pickle.po b/library/pickle.po index 360d337efa..e11ae8cc2f 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -1184,6 +1184,9 @@ msgid "" "unified interface for retrieving the data necessary for pickling and copying " "objects. [#]_" msgstr "" +"如稍後所演示,pickle 並不直接使用上述方法。這些方法實際上是實作了 :meth:" +"`~object.__reduce__` 特殊方法的拷貝協定(copy protocol)。拷貝協定提供了統一" +"的介面,以檢索進行封裝及複製物件時所需的資料。 [#]_" #: ../../library/pickle.rst:672 msgid "" @@ -1194,6 +1197,11 @@ msgid "" "We will show, however, cases where using :meth:`!__reduce__` is the only " "option or leads to more efficient pickling or both." msgstr "" +"直接在類別中實作 :meth:`~object.__reduce__` 雖然功能強大但卻容易導致出錯。因" +"此,設計類別者應盡可能使用高階介面(例如,:meth:`~object." +"__getnewargs_ex__`、:meth:`~object.__getstate__` 和 :meth:`~object." +"__setstate__`)。不過,我們也將展示一些特例狀況,在這些狀況中,使用 :meth:`!" +"__reduce__` 可能是唯一的選擇、是更有效率的封裝方法或二者兼備。" #: ../../library/pickle.rst:681 msgid "" @@ -1201,6 +1209,8 @@ msgid "" "method takes no argument and shall return either a string or preferably a " "tuple (the returned object is often referred to as the \"reduce value\")." msgstr "" +"目前的介面定義如下。 :meth:`__reduce__` 方法不接受引數,且應回傳一個字串或一" +"個元組(元組一般而言是較佳的選擇;所回傳的物件通常稱為「縮減值」)。" #: ../../library/pickle.rst:685 msgid "" @@ -1209,6 +1219,9 @@ msgid "" "module; the pickle module searches the module namespace to determine the " "object's module. This behaviour is typically useful for singletons." msgstr "" +"如果回傳的是字串,該字串應被解讀為一個全域變數的名稱。它應是該物件相對其所在" +"模組的本地名稱;pickle 模組會在模組命名空間中尋找,以確定該物件所在的模組。這" +"種行為通常對於單例物件特別有用。" #: ../../library/pickle.rst:690 msgid "" @@ -1216,18 +1229,22 @@ msgid "" "Optional items can either be omitted, or ``None`` can be provided as their " "value. The semantics of each item are in order:" msgstr "" +"當返回一個元組時,其長度必須介於兩至六項元素之間。可選項可以被省略,或者其值" +"可以被設為 ``None``。各項物件的語意依序為:" #: ../../library/pickle.rst:696 msgid "" "A callable object that will be called to create the initial version of the " "object." -msgstr "" +msgstr "一個將會被呼叫來創建初始版本物件的可呼叫物件。" #: ../../library/pickle.rst:699 msgid "" "A tuple of arguments for the callable object. An empty tuple must be given " "if the callable does not accept any argument." msgstr "" +"一個用於傳遞引數給前述物件的元組。如果前述物件不接受引數輸入,則你仍應在這裡" +"給定一個空元組。" #: ../../library/pickle.rst:702 msgid "" @@ -1236,6 +1253,9 @@ msgid "" "method then, the value must be a dictionary and it will be added to the " "object's :attr:`~object.__dict__` attribute." msgstr "" +"可選項。物件狀態。如前所述,會被傳遞給該物件的 :meth:`__setstate__` 方法。如" +"果該物件沒有實作此方法,則本值必須是一個字典,且其將會被新增到物件的 :attr:" +"`~object.__dict__` 屬性中。" #: ../../library/pickle.rst:707 msgid "" @@ -1248,6 +1268,12 @@ msgid "" "which pickle protocol version is used as well as the number of items to " "append, so both must be supported.)" msgstr "" +"可選項。一個用來提供連續項目的疊代器(而非序列)。這些項目將個別透過 ``obj." +"append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被附加到" +"物件中。主要用於串列(list)子類別,但只要其他類別具有相應的 :ref:`append 和 " +"extend 方法 `就也可以使用。 (如何選擇使用 :meth:`!append` " +"或 :meth:`!extend` 方法將取決於所選用的 pickle 協定版本以及要附加的項目數量," +"因此必須同時支援這兩種方法。)" #: ../../library/pickle.rst:717 msgid "" @@ -1256,6 +1282,9 @@ msgid "" "value``. This is primarily used for dictionary subclasses, but may be used " "by other classes as long as they implement :meth:`__setitem__`." msgstr "" +"可選項。一個產生連續鍵值對的疊代器(不是序列)。這些項目將以 ``obj[key] = " +"value`` 方式被儲存到物件中。主要用於字典(dictionary)子類別,但只要有實現" +"了 :meth:`__setitem__` 的其他類別也可以使用。" #: ../../library/pickle.rst:722 msgid "" From 765ce6f5db9647666ab9eb41ba77887b39e22683 Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Sun, 15 Sep 2024 21:12:33 +0800 Subject: [PATCH 11/89] docs(library/pickle.po): editing, up to line 1600 --- library/pickle.po | 124 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 118 insertions(+), 6 deletions(-) diff --git a/library/pickle.po b/library/pickle.po index 7e628ddd84..dc7fbff4e5 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -1287,6 +1287,9 @@ msgstr "" "果該物件沒有實作此方法,則本值必須是一個字典,且其將會被新增到物件的 :attr:" "`~object.__dict__` 屬性中。" +# SkyLull: [T] +# signature: https://stackoverflow.com/questions/72788932/what-is-a-function- +# signature -> 輸入特徵 #: ../../library/pickle.rst:707 msgid "" "Optionally, an iterator (and not a sequence) yielding successive items. " @@ -1301,9 +1304,9 @@ msgstr "" "可選項。一個用來提供連續項目的疊代器(而非序列)。這些項目將個別透過 ``obj." "append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被附加到" "物件中。主要用於串列(list)子類別,但只要其他類別具有相應的 :ref:`append 和 " -"extend 方法 `就也可以使用。 (如何選擇使用 :meth:`!append` " -"或 :meth:`!extend` 方法將取決於所選用的 pickle 協定版本以及要附加的項目數量," -"因此必須同時支援這兩種方法。)" +"extend 方法 `和相同的輸入特徵(signature)就也可以使用。 " +"(如何選擇使用 :meth:`!append` 或 :meth:`!extend` 方法將取決於所選用的 " +"pickle 協定版本以及要附加的項目數量,因此必須同時支援這兩種方法。)" #: ../../library/pickle.rst:717 msgid "" @@ -1324,10 +1327,14 @@ msgid "" "method. If not ``None``, this callable will have priority over ``obj``'s :" "meth:`__setstate__`." msgstr "" +"可選項。一個具有 ``(obj, state)`` 輸入特徵(signature)的可呼叫物件。該物件允" +"許使用者以可編寫的邏輯,而不是物件 ``obj`` 預設的 :meth:`__setstate__` 靜態方" +"法去控制特定物件的狀態更新方式。如果這個物件不是 ``None``,這個物件的呼叫優先" +"權將優於物件 ``obj`` 的 :meth:`__setstate__`。" #: ../../library/pickle.rst:728 msgid "The optional sixth tuple item, ``(obj, state)``, was added." -msgstr "" +msgstr "加入第六個可選項(一個 ``(obj, state)`` 元組)。" #: ../../library/pickle.rst:734 msgid "" @@ -1338,10 +1345,14 @@ msgid "" "a synonym for the extended version. The main use for this method is to " "provide backwards-compatible reduce values for older Python releases." msgstr "" +"另外,你也可以定義一個 :meth:`__reduce_ex__` 方法。唯一的不同的地方是此方法只" +"接受協定版本(整數)作為參數。當有定義本方法時,pickle 會優先調用它而不是 :" +"meth:`__reduce__` 。此外,呼叫 :meth:`__reduce__` 時也會自動變成呼叫這個變體" +"版本。此方法主要是為了向後相容的舊的 Python 版本而存在。" #: ../../library/pickle.rst:746 msgid "Persistence of External Objects" -msgstr "" +msgstr "外部物件持久化" #: ../../library/pickle.rst:752 msgid "" @@ -1351,6 +1362,10 @@ msgid "" "of alphanumeric characters (for protocol 0) [#]_ or just an arbitrary object " "(for any newer protocol)." msgstr "" +"為了方便物件持久化,:mod:`pickle` 模組支援對被封裝資料串流以外的物件參照。被" +"參照的物件是透過一個持久化 ID 來參照的,這個 ID 應該要是字母數字字元" +"(alphanumeric)組成的字串(協定 0) [#]_ 或者是任意的物件(任何較新的協" +"定)。" #: ../../library/pickle.rst:758 msgid "" @@ -1359,6 +1374,9 @@ msgid "" "pickler and unpickler, :meth:`~Pickler.persistent_id` and :meth:`~Unpickler." "persistent_load` respectively." msgstr "" +":mod:`pickle` 沒有定義要如何解決或分派這個持久化 ID 的問題;故其處理方式有賴" +"使用者自行定義在封裝器(pickler)以及拆封器(unpickler)中。方法的名稱各自" +"為 :meth:`~Pickler.persistent_id` 和 :meth:`~Unpickler.persistent_load`。" #: ../../library/pickle.rst:763 msgid "" @@ -1370,6 +1388,11 @@ msgid "" "object, along with a marker so that the unpickler will recognize it as a " "persistent ID." msgstr "" +"要封裝具有外部持久化 ID 的物件,封裝器(pickler)必須擁有一個自訂的方法 :" +"meth:`~Pickler.persistent_id`,這個方法將接收一個物件作為參數,並回傳 `None` " +"或該物件的持久化 ID。當回傳 `None` 時,封裝器會正常地封裝該物件。當回傳一個持" +"久化 ID 字串時,封裝器會封裝該物件並加上一個標記,讓拆封器(unpikler)能識別" +"它是一個持久化 ID。" #: ../../library/pickle.rst:770 msgid "" @@ -1377,12 +1400,15 @@ msgid "" "`~Unpickler.persistent_load` method that takes a persistent ID object and " "returns the referenced object." msgstr "" +"要拆封外部物件,拆封器(unpickler)必須有一個自訂的 :meth:`~Unpickler." +"persistent_load` 方法,該方法應接受一個持久化 ID 物件,並回傳相對應的物件。" #: ../../library/pickle.rst:774 msgid "" "Here is a comprehensive example presenting how persistent ID can be used to " "pickle external objects by reference." msgstr "" +"以下是一個完整的範例,用以說明如何使用持久化 ID 來封裝具外部參照的物件。" #: ../../library/pickle.rst:777 msgid "" @@ -1481,10 +1507,96 @@ msgid "" "if __name__ == '__main__':\n" " main()\n" msgstr "" +"# 展示如何使用持久化 ID 來封裝外部物件的簡單範例\n" +"\n" +"import pickle\n" +"import sqlite3\n" +"from collections import namedtuple\n" +"\n" +"# 代表資料庫中紀錄的一個簡易類別\n" +"MemoRecord = namedtuple(\"MemoRecord\", \"key, task\")\n" +"\n" +"class DBPickler(pickle.Pickler):\n" +"\n" +" def persistent_id(self, obj):\n" +" # 我們派發出一個持久 ID,而不是像一般類別實例那樣封裝 MemoRecord。\n" +" if isinstance(obj, MemoRecord):\n" +" # 我們的持久 ID 就是一個元組,裡面包含一個標籤和一個鍵,指向資料" +"庫中的特定紀錄。\n" +" return (\"MemoRecord\", obj.key)\n" +" else:\n" +" # 如果 obj 沒有持久 ID,則返回 None。這表示 obj 像平常那樣封裝即" +"可。\n" +" return None\n" +"\n" +"\n" +"class DBUnpickler(pickle.Unpickler):\n" +"\n" +" def __init__(self, file, connection):\n" +" super().__init__(file)\n" +" self.connection = connection\n" +"\n" +" def persistent_load(self, pid):\n" +" # 每當遇到持久 ID 時,此方法都會被呼叫。\n" +" # pid 是 DBPickler 所回傳的元組。\n" +" cursor = self.connection.cursor()\n" +" type_tag, key_id = pid\n" +" if type_tag == \"MemoRecord\":\n" +" # 從資料庫中抓取所引用的紀錄並返回。\n" +" cursor.execute(\"SELECT * FROM memos WHERE key=?\", " +"(str(key_id),))\n" +" key, task = cursor.fetchone()\n" +" return MemoRecord(key, task)\n" +" else:\n" +" # 如果無法返回正確的物件,則必須拋出錯誤。\n" +" # 否則 unpickler 會誤認為 None 是持久 ID 所引用的物件。\n" +" raise pickle.UnpicklingError(\"unsupported persistent object\")\n" +"\n" +"\n" +"def main():\n" +" import io\n" +" import pprint\n" +"\n" +" # 初始化資料庫。\n" +" conn = sqlite3.connect(\":memory:\")\n" +" cursor = conn.cursor()\n" +" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task " +"TEXT)\")\n" +" tasks = (\n" +" 'give food to fish',\n" +" 'prepare group meeting',\n" +" 'fight with a zebra',\n" +" )\n" +" for task in tasks:\n" +" cursor.execute(\"INSERT INTO memos VALUES(NULL, ?)\", (task,))\n" +"\n" +" # 抓取要封裝的紀錄。\n" +" cursor.execute(\"SELECT * FROM memos\")\n" +" memos = [MemoRecord(key, task) for key, task in cursor]\n" +" # 使用我們自訂的 DBPickler 來保存紀錄。\n" +" file = io.BytesIO()\n" +" DBPickler(file).dump(memos)\n" +"\n" +" print(\"被封裝的紀錄:\")\n" +" pprint.pprint(memos)\n" +"\n" +" # 更新一筆紀錄(測試用)。\n" +" cursor.execute(\"UPDATE memos SET task='learn italian' WHERE key=1\")\n" +"\n" +" # 從 pickle 資料流中載入紀錄。\n" +" file.seek(0)\n" +" memos = DBUnpickler(file, conn).load()\n" +"\n" +" print(\"已拆封的紀錄:\")\n" +" pprint.pprint(memos)\n" +"\n" +"\n" +"if __name__ == '__main__':\n" +" main()\n" #: ../../library/pickle.rst:782 msgid "Dispatch Tables" -msgstr "" +msgstr "分派表" #: ../../library/pickle.rst:784 msgid "" From 285a7ab31e88c7646348f12db4910bbae20769d5 Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Thu, 19 Sep 2024 14:41:16 +0800 Subject: [PATCH 12/89] docs(library/pickle.po): editing, up to line 1982 --- library/pickle.po | 121 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 112 insertions(+), 9 deletions(-) diff --git a/library/pickle.po b/library/pickle.po index dc7fbff4e5..8d833b4006 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -1596,7 +1596,7 @@ msgstr "" #: ../../library/pickle.rst:782 msgid "Dispatch Tables" -msgstr "分派表" +msgstr "調度表" #: ../../library/pickle.rst:784 msgid "" @@ -1604,6 +1604,8 @@ msgid "" "other code which depends on pickling, then one can create a pickler with a " "private dispatch table." msgstr "" +"如果你希望在不干擾其他物件正常封裝的前提下建立一個針對特定物件的封裝器,你可" +"建立一個有私密調度表的封裝器。" #: ../../library/pickle.rst:788 msgid "" @@ -1611,6 +1613,9 @@ msgid "" "as :data:`!copyreg.dispatch_table`. Therefore, one may choose to use a " "modified copy of :data:`!copyreg.dispatch_table` as a private dispatch table." msgstr "" +"由 :mod:`copyreg` 模組管理的全域調度表可以 :data:`!copyreg.dispatch_table` 呼" +"叫。你可以透過這個方式來基於原始 :data:`!copyreg.dispatch_table` 創建一個修改" +"過的版本,作為你的專屬用途的調度表。" #: ../../library/pickle.rst:793 msgid "For example ::" @@ -1633,6 +1638,8 @@ msgid "" "creates an instance of :class:`pickle.Pickler` with a private dispatch table " "which handles the ``SomeClass`` class specially. Alternatively, the code ::" msgstr "" +"建立了一個 :class:`pickle.Pickler`,其中含有專門處裡 ``SomeClass`` 類別的專屬" +"調度表。此外,你也可以寫作:::" #: ../../library/pickle.rst:804 msgid "" @@ -1653,6 +1660,8 @@ msgid "" "does the same but all instances of ``MyPickler`` will by default share the " "private dispatch table. On the other hand, the code ::" msgstr "" +"這樣可產生相似的結果,唯一不同的是往後所有 ``MyPickler`` 預設都會使用這個專屬" +"調度表。最後,如果將程式寫為:::" #: ../../library/pickle.rst:813 msgid "" @@ -1668,11 +1677,11 @@ msgstr "" msgid "" "modifies the global dispatch table shared by all users of the :mod:`copyreg` " "module." -msgstr "" +msgstr "則會改變 :mod:`copyreg` 模組內建、所有使用者共通的調度表。" #: ../../library/pickle.rst:822 msgid "Handling Stateful Objects" -msgstr "" +msgstr "處裡紀錄大量狀態的物件" #: ../../library/pickle.rst:828 msgid "" @@ -1685,6 +1694,12 @@ msgid "" "__setstate__` and :meth:`!__getstate__` methods are used to implement this " "behavior. ::" msgstr "" +"以下的範例展示了如何修改針對特定類別封裝時的行為。下面的 :class:`!" +"TextReader` 類別會開啟一個文字檔案,並在每次呼叫其 :meth:`!readline` 方法時返" +"回當前行編號與該行內容。如果 :class:`!TextReader` 實例被封裝,所有*除了檔案物" +"件之外*的屬性成員都會被保存。在該實例被拆封時,檔案將被重新開啟,並從上次的位" +"置繼續讀取。這個行為的達成是透過 :meth:`!__setstate__` 和 :meth:`!" +"__getstate__` 方法來實作的。::" #: ../../library/pickle.rst:836 msgid "" @@ -1725,10 +1740,45 @@ msgid "" " # Finally, save the file.\n" " self.file = file" msgstr "" +"class TextReader:\n" +" \"\"\"列出文字檔案中的行並對其進行編號。\"\"\"\n" +"\n" +" def __init__(self, filename):\n" +" self.filename = filename\n" +" self.file = open(filename)\n" +" self.lineno = 0\n" +"\n" +" def readline(self):\n" +" self.lineno += 1\n" +" line = self.file.readline()\n" +" if not line:\n" +" return None\n" +" if line.endswith('\\n'):\n" +" line = line[:-1]\n" +" return \"%i: %s\" % (self.lineno, line)\n" +"\n" +" def __getstate__(self):\n" +" # 從 self.__dict__ 中複製物件的狀態。包含了所有的實例屬性。\n" +" # 使用 dict.copy() 方法以避免修改原始狀態。\n" +" state = self.__dict__.copy()\n" +" # 移除不可封裝的項目。\n" +" del state['file']\n" +" return state\n" +"\n" +" def __setstate__(self, state):\n" +" # 恢復實例屬性(即 filename 和 lineno)。\n" +" self.__dict__.update(state)\n" +" # 恢復到先前開啟了檔案的狀態。為此,我們需要重新開啟它並一直讀取到行" +"數編號相同。\n" +" file = open(self.filename)\n" +" for _ in range(self.lineno):\n" +" file.readline()\n" +" # 存檔。\n" +" self.file = file" #: ../../library/pickle.rst:874 msgid "A sample usage might be something like this::" -msgstr "" +msgstr "可以這樣實際使用:::" #: ../../library/pickle.rst:876 msgid "" @@ -1752,7 +1802,7 @@ msgstr "" #: ../../library/pickle.rst:888 msgid "Custom Reduction for Types, Functions, and Other Objects" -msgstr "" +msgstr "針對型別、函數或特定物件定製縮減函數" #: ../../library/pickle.rst:892 msgid "" @@ -1761,6 +1811,9 @@ msgid "" "the object's type, or we may want to customize the pickling of functions and " "classes." msgstr "" +"有時候,:attr:`~Pickler.dispatch_table` 的彈性空間可能不夠。尤其當我們想要使" +"用型別以外的方式來判斷如何使用自訂封裝、或者我們想要自訂特定函式和類別的封裝" +"方法時。" #: ../../library/pickle.rst:897 msgid "" @@ -1770,6 +1823,9 @@ msgid "" "alternatively return :data:`NotImplemented` to fallback to the traditional " "behavior." msgstr "" +"如果是這樣的話,可以繼承 :class:`Pickler` 類別並實作一個 :meth:`~Pickler." +"reducer_override` 方法。此方法可以回傳任意的縮減元組(參閱 :meth:`~object." +"__reduce__`)、也可以回傳 :data:`NotImplemented` 以回退至原始的行為。" #: ../../library/pickle.rst:902 msgid "" @@ -1777,6 +1833,8 @@ msgid "" "reducer_override` are defined, then :meth:`~Pickler.reducer_override` method " "takes priority." msgstr "" +"如果 :attr:`~Pickler.dispatch_table` 和 :meth:`~Pickler.reducer_override` 都" +"被定義了的話,:meth:`~Pickler.reducer_override` 的優先度較高。" #: ../../library/pickle.rst:907 msgid "" @@ -1786,12 +1844,16 @@ msgid "" "class:`dict`, :class:`set`, :class:`frozenset`, :class:`list` and :class:" "`tuple`." msgstr "" +"出於效能考量,處裡以下物件可能不會呼叫 :meth:`~Pickler.reducer_override`:" +"``None``、``True``、``False``,以及 :class:`int`、:class:`float`、:class:" +"`bytes`、:class:`str`、:class:`dict`、:class:`set`、:class:`frozenset`、:" +"class:`list` 和 :class:`tuple` 的實例。" #: ../../library/pickle.rst:913 msgid "" "Here is a simple example where we allow pickling and reconstructing a given " "class::" -msgstr "" +msgstr "以下是一個簡單的例子,我們示範如何允許封裝和重建給定的類別:::" #: ../../library/pickle.rst:916 msgid "" @@ -1823,10 +1885,37 @@ msgid "" "assert unpickled_class.__name__ == \"MyClass\"\n" "assert unpickled_class.my_attribute == 1" msgstr "" +"import io\n" +"import pickle\n" +"\n" +"class MyClass:\n" +" my_attribute = 1\n" +"\n" +"class MyPickler(pickle.Pickler):\n" +" def reducer_override(self, obj):\n" +" \"\"\"MyClass 的自訂縮減函數。\"\"\"\n" +" if getattr(obj, \"__name__\", None) == \"MyClass\":\n" +" return type, (obj.__name__, obj.__bases__,\n" +" {'my_attribute': obj.my_attribute})\n" +" else:\n" +" # 遭遇其他物件,則使用一般的縮減方式\n" +" return NotImplemented\n" +"\n" +"f = io.BytesIO()\n" +"p = MyPickler(f)\n" +"p.dump(MyClass)\n" +"\n" +"del MyClass\n" +"\n" +"unpickled_class = pickle.loads(f.getvalue())\n" +"\n" +"assert isinstance(unpickled_class, type)\n" +"assert unpickled_class.__name__ == \"MyClass\"\n" +"assert unpickled_class.my_attribute == 1\n" #: ../../library/pickle.rst:948 msgid "Out-of-band Buffers" -msgstr "" +msgstr "帶外(Out-of-band)資料緩衝區" #: ../../library/pickle.rst:952 msgid "" @@ -1837,6 +1926,10 @@ msgid "" "structure of objects into a sequential stream of bytes, intrinsically " "involves copying data to and from the pickle stream." msgstr "" +":mod:`pickle` 模組會被用於用於傳輸龐大的資料。此時,將複製記憶體的次數降到最" +"低以保持效能變得很重要。然而,:mod:`pickle` 模組的正常操作過程中,當它將物件" +"的圖狀結構(graph-like structure)轉換為連續的位元組串流時,本質上就涉及將資" +"料複製到封裝流以及從封裝流複製資料。" #: ../../library/pickle.rst:959 msgid "" @@ -1845,10 +1938,12 @@ msgid "" "implementation of the communications system) support the out-of-band " "transfer facilities provided by pickle protocol 5 and higher." msgstr "" +"如果*供給者*(被傳遞物件的型別的實作)與*消費者*(資訊交換系統的實作)都支援" +"由 pickle 協定 5 或更高版本提供的帶外傳輸功能,則可以避免此一先天限制。" #: ../../library/pickle.rst:965 msgid "Provider API" -msgstr "" +msgstr "供給者 API" #: ../../library/pickle.rst:967 msgid "" @@ -1857,6 +1952,9 @@ msgid "" "a :class:`PickleBuffer` instance (instead of e.g. a :class:`bytes` object) " "for any large data." msgstr "" +"要封裝的大型資料物件,則必須實作一個針對 5 版協定及以上的 :meth:`~object." +"__reduce_ex__` 方法,該方法應返回一個 :class:`PickleBuffer` 實例來處理任何大" +"型資料(而非返回如 :class:`bytes` 物件)。" #: ../../library/pickle.rst:972 msgid "" @@ -1866,16 +1964,21 @@ msgid "" "opt-in to tell :mod:`pickle` that they will handle those buffers by " "themselves." msgstr "" +"一個 :class:`PickleBuffer` 物件*指示*了當下底層的緩衝區狀態適合進行帶外資料傳" +"輸。這些物件仍然相容 :mod:`pickle` 模組的一般使用方式。消費者程式也可以選擇介" +"入,指示 :mod:`pickle` 他們將自行處理這些緩衝區。" #: ../../library/pickle.rst:979 msgid "Consumer API" -msgstr "" +msgstr "消費者 API" #: ../../library/pickle.rst:981 msgid "" "A communications system can enable custom handling of the :class:" "`PickleBuffer` objects generated when serializing an object graph." msgstr "" +"一個資訊交換系統可以決定要自行處裡序列化物件圖時產生的 :class:`PickleBuffer` " +"物件。" #: ../../library/pickle.rst:984 msgid "" From d5a337bcec996abc184dffafb367d1cb5616113d Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Mon, 23 Sep 2024 07:50:33 +0800 Subject: [PATCH 13/89] chore: change project id to 3.13 globally (#961) * chore: change project id to 3.13 globally * chore: change python version to 3.13 --- .github/workflows/deploy-gh-page.yml | 2 +- ...sync-cpython.yml => py313-sync-cpython.yml} | 14 +++++++------- Makefile | 2 +- README.rst | 8 ++++---- about.po | 2 +- bugs.po | 2 +- c-api/abstract.po | 2 +- c-api/allocation.po | 2 +- c-api/apiabiversion.po | 2 +- c-api/arg.po | 2 +- c-api/bool.po | 2 +- c-api/buffer.po | 2 +- c-api/bytearray.po | 2 +- c-api/bytes.po | 2 +- c-api/call.po | 2 +- c-api/capsule.po | 2 +- c-api/cell.po | 2 +- c-api/code.po | 2 +- c-api/codec.po | 2 +- c-api/complex.po | 2 +- c-api/concrete.po | 2 +- c-api/contextvars.po | 2 +- c-api/conversion.po | 2 +- c-api/coro.po | 2 +- c-api/datetime.po | 2 +- c-api/descriptor.po | 2 +- c-api/dict.po | 2 +- c-api/exceptions.po | 2 +- c-api/file.po | 2 +- c-api/float.po | 2 +- c-api/frame.po | 2 +- c-api/function.po | 2 +- c-api/gcsupport.po | 2 +- c-api/gen.po | 2 +- c-api/hash.po | 2 +- c-api/import.po | 2 +- c-api/index.po | 2 +- c-api/init.po | 2 +- c-api/init_config.po | 2 +- c-api/intro.po | 2 +- c-api/iter.po | 2 +- c-api/iterator.po | 2 +- c-api/list.po | 2 +- c-api/long.po | 2 +- c-api/mapping.po | 2 +- c-api/marshal.po | 2 +- c-api/memory.po | 2 +- c-api/memoryview.po | 2 +- c-api/method.po | 2 +- c-api/module.po | 2 +- c-api/none.po | 2 +- c-api/number.po | 2 +- c-api/objbuffer.po | 2 +- c-api/object.po | 2 +- c-api/objimpl.po | 2 +- c-api/perfmaps.po | 6 +++--- c-api/refcounting.po | 2 +- c-api/reflection.po | 2 +- c-api/sequence.po | 2 +- c-api/set.po | 2 +- c-api/slice.po | 2 +- c-api/stable.po | 2 +- c-api/structures.po | 2 +- c-api/sys.po | 2 +- c-api/tuple.po | 2 +- c-api/type.po | 2 +- c-api/typehints.po | 2 +- c-api/typeobj.po | 2 +- c-api/unicode.po | 2 +- c-api/utilities.po | 2 +- c-api/veryhigh.po | 2 +- c-api/weakref.po | 2 +- contents.po | 2 +- copyright.po | 2 +- deprecations/c-api-pending-removal-in-3.14.po | 2 +- deprecations/c-api-pending-removal-in-3.15.po | 2 +- .../c-api-pending-removal-in-future.po | 2 +- deprecations/index.po | 2 +- deprecations/pending-removal-in-3.13.po | 2 +- deprecations/pending-removal-in-3.14.po | 2 +- deprecations/pending-removal-in-3.15.po | 2 +- deprecations/pending-removal-in-3.16.po | 2 +- deprecations/pending-removal-in-future.po | 2 +- distributing/index.po | 2 +- extending/building.po | 2 +- extending/embedding.po | 2 +- extending/extending.po | 2 +- extending/index.po | 2 +- extending/newtypes.po | 2 +- extending/newtypes_tutorial.po | 2 +- extending/windows.po | 2 +- faq/design.po | 2 +- faq/extending.po | 2 +- faq/general.po | 2 +- faq/gui.po | 2 +- faq/index.po | 2 +- faq/installed.po | 2 +- faq/library.po | 2 +- faq/programming.po | 2 +- faq/windows.po | 2 +- glossary.po | 2 +- howto/annotations.po | 2 +- howto/argparse.po | 2 +- howto/clinic.po | 2 +- howto/cporting.po | 2 +- howto/curses.po | 2 +- howto/descriptor.po | 2 +- howto/enum.po | 2 +- howto/functional.po | 2 +- howto/gdb_helpers.po | 2 +- howto/index.po | 2 +- howto/instrumentation.po | 2 +- howto/ipaddress.po | 2 +- howto/isolating-extensions.po | 2 +- howto/logging-cookbook.po | 2 +- howto/logging.po | 2 +- howto/mro.po | 2 +- howto/perf_profiling.po | 2 +- howto/pyporting.po | 2 +- howto/regex.po | 2 +- howto/sorting.po | 2 +- howto/unicode.po | 2 +- howto/urllib2.po | 2 +- includes/wasm-notavail.po | 2 +- installing/index.po | 2 +- library/2to3.po | 2 +- library/__future__.po | 2 +- library/__main__.po | 2 +- library/_thread.po | 2 +- library/abc.po | 2 +- library/aifc.po | 2 +- library/allos.po | 2 +- library/archiving.po | 2 +- library/argparse.po | 2 +- library/array.po | 2 +- library/ast.po | 2 +- library/asyncio-api-index.po | 2 +- library/asyncio-dev.po | 2 +- library/asyncio-eventloop.po | 2 +- library/asyncio-exceptions.po | 2 +- library/asyncio-extending.po | 2 +- library/asyncio-future.po | 2 +- library/asyncio-llapi-index.po | 2 +- library/asyncio-platforms.po | 2 +- library/asyncio-policy.po | 2 +- library/asyncio-protocol.po | 2 +- library/asyncio-queue.po | 2 +- library/asyncio-runner.po | 2 +- library/asyncio-stream.po | 2 +- library/asyncio-subprocess.po | 2 +- library/asyncio-sync.po | 2 +- library/asyncio-task.po | 2 +- library/asyncio.po | 2 +- library/atexit.po | 2 +- library/audioop.po | 2 +- library/audit_events.po | 2 +- library/base64.po | 2 +- library/bdb.po | 2 +- library/binary.po | 2 +- library/binascii.po | 2 +- library/bisect.po | 2 +- library/builtins.po | 2 +- library/bz2.po | 2 +- library/calendar.po | 2 +- library/cgi.po | 2 +- library/cgitb.po | 2 +- library/chunk.po | 2 +- library/cmath.po | 2 +- library/cmd.po | 2 +- library/cmdline.po | 2 +- library/code.po | 2 +- library/codecs.po | 2 +- library/codeop.po | 2 +- library/collections.abc.po | 2 +- library/collections.po | 2 +- library/colorsys.po | 2 +- library/compileall.po | 2 +- library/concurrency.po | 2 +- library/concurrent.futures.po | 2 +- library/concurrent.po | 2 +- library/configparser.po | 2 +- library/constants.po | 2 +- library/contextlib.po | 2 +- library/contextvars.po | 2 +- library/copy.po | 2 +- library/copyreg.po | 2 +- library/crypt.po | 2 +- library/crypto.po | 2 +- library/csv.po | 2 +- library/ctypes.po | 2 +- library/curses.ascii.po | 2 +- library/curses.panel.po | 2 +- library/curses.po | 2 +- library/custominterp.po | 2 +- library/dataclasses.po | 2 +- library/datatypes.po | 2 +- library/datetime.po | 2 +- library/dbm.po | 2 +- library/debug.po | 2 +- library/decimal.po | 2 +- library/development.po | 2 +- library/devmode.po | 2 +- library/dialog.po | 2 +- library/difflib.po | 2 +- library/dis.po | 2 +- library/distribution.po | 2 +- library/doctest.po | 2 +- library/email.charset.po | 2 +- library/email.compat32-message.po | 2 +- library/email.contentmanager.po | 2 +- library/email.encoders.po | 2 +- library/email.errors.po | 2 +- library/email.examples.po | 2 +- library/email.generator.po | 2 +- library/email.header.po | 2 +- library/email.headerregistry.po | 2 +- library/email.iterators.po | 2 +- library/email.message.po | 2 +- library/email.mime.po | 2 +- library/email.parser.po | 2 +- library/email.po | 2 +- library/email.policy.po | 2 +- library/email.utils.po | 2 +- library/ensurepip.po | 2 +- library/enum.po | 2 +- library/errno.po | 2 +- library/exceptions.po | 2 +- library/faulthandler.po | 2 +- library/fcntl.po | 2 +- library/filecmp.po | 2 +- library/fileformats.po | 2 +- library/fileinput.po | 2 +- library/filesys.po | 2 +- library/fnmatch.po | 2 +- library/fractions.po | 2 +- library/frameworks.po | 2 +- library/ftplib.po | 2 +- library/functional.po | 2 +- library/functions.po | 2 +- library/functools.po | 2 +- library/gc.po | 2 +- library/getopt.po | 2 +- library/getpass.po | 2 +- library/gettext.po | 2 +- library/glob.po | 2 +- library/graphlib.po | 2 +- library/grp.po | 2 +- library/gzip.po | 2 +- library/hashlib.po | 2 +- library/heapq.po | 2 +- library/hmac.po | 2 +- library/html.entities.po | 2 +- library/html.parser.po | 2 +- library/html.po | 2 +- library/http.client.po | 2 +- library/http.cookiejar.po | 2 +- library/http.cookies.po | 2 +- library/http.po | 2 +- library/http.server.po | 2 +- library/i18n.po | 2 +- library/idle.po | 2 +- library/imaplib.po | 2 +- library/imghdr.po | 2 +- library/importlib.metadata.po | 2 +- library/importlib.po | 2 +- library/importlib.resources.abc.po | 2 +- library/importlib.resources.po | 2 +- library/index.po | 2 +- library/inspect.po | 2 +- library/internet.po | 2 +- library/intro.po | 2 +- library/io.po | 2 +- library/ipaddress.po | 2 +- library/ipc.po | 2 +- library/itertools.po | 2 +- library/json.po | 2 +- library/keyword.po | 2 +- library/language.po | 2 +- library/linecache.po | 2 +- library/locale.po | 2 +- library/logging.config.po | 2 +- library/logging.handlers.po | 2 +- library/logging.po | 2 +- library/lzma.po | 2 +- library/mailbox.po | 2 +- library/mailcap.po | 2 +- library/markup.po | 2 +- library/marshal.po | 2 +- library/math.po | 2 +- library/mimetypes.po | 2 +- library/mm.po | 2 +- library/mmap.po | 2 +- library/modulefinder.po | 2 +- library/modules.po | 2 +- library/msilib.po | 2 +- library/msvcrt.po | 2 +- library/multiprocessing.po | 2 +- library/multiprocessing.shared_memory.po | 2 +- library/netdata.po | 2 +- library/netrc.po | 2 +- library/nis.po | 2 +- library/nntplib.po | 2 +- library/numbers.po | 2 +- library/numeric.po | 2 +- library/operator.po | 2 +- library/optparse.po | 2 +- library/os.path.po | 2 +- library/os.po | 2 +- library/ossaudiodev.po | 2 +- library/pathlib.po | 2 +- library/pdb.po | 2 +- library/persistence.po | 2 +- library/pickle.po | 2 +- library/pickletools.po | 2 +- library/pipes.po | 2 +- library/pkgutil.po | 2 +- library/platform.po | 2 +- library/plistlib.po | 2 +- library/poplib.po | 2 +- library/posix.po | 2 +- library/pprint.po | 2 +- library/profile.po | 2 +- library/pty.po | 2 +- library/pwd.po | 2 +- library/py_compile.po | 2 +- library/pyclbr.po | 2 +- library/pydoc.po | 2 +- library/pyexpat.po | 2 +- library/python.po | 2 +- library/queue.po | 2 +- library/quopri.po | 2 +- library/random.po | 2 +- library/re.po | 2 +- library/readline.po | 2 +- library/reprlib.po | 2 +- library/resource.po | 2 +- library/rlcompleter.po | 2 +- library/runpy.po | 2 +- library/sched.po | 2 +- library/secrets.po | 2 +- library/security_warnings.po | 2 +- library/select.po | 2 +- library/selectors.po | 2 +- library/shelve.po | 2 +- library/shlex.po | 2 +- library/shutil.po | 2 +- library/signal.po | 2 +- library/site.po | 2 +- library/smtplib.po | 2 +- library/sndhdr.po | 2 +- library/socket.po | 2 +- library/socketserver.po | 2 +- library/spwd.po | 2 +- library/sqlite3.po | 2 +- library/ssl.po | 2 +- library/stat.po | 2 +- library/statistics.po | 2 +- library/stdtypes.po | 8 ++++---- library/string.po | 2 +- library/stringprep.po | 2 +- library/struct.po | 2 +- library/subprocess.po | 2 +- library/sunau.po | 2 +- library/superseded.po | 2 +- library/symtable.po | 2 +- library/sys.monitoring.po | 2 +- library/sys.po | 2 +- library/sys_path_init.po | 2 +- library/sysconfig.po | 2 +- library/syslog.po | 2 +- library/tabnanny.po | 2 +- library/tarfile.po | 2 +- library/telnetlib.po | 2 +- library/tempfile.po | 2 +- library/termios.po | 2 +- library/test.po | 2 +- library/text.po | 2 +- library/textwrap.po | 2 +- library/threading.po | 2 +- library/time.po | 2 +- library/timeit.po | 2 +- library/tk.po | 2 +- library/tkinter.colorchooser.po | 2 +- library/tkinter.dnd.po | 2 +- library/tkinter.font.po | 2 +- library/tkinter.messagebox.po | 2 +- library/tkinter.po | 2 +- library/tkinter.scrolledtext.po | 2 +- library/tkinter.tix.po | 2 +- library/tkinter.ttk.po | 2 +- library/token.po | 2 +- library/tokenize.po | 2 +- library/tomllib.po | 2 +- library/trace.po | 2 +- library/traceback.po | 2 +- library/tracemalloc.po | 2 +- library/tty.po | 2 +- library/turtle.po | 2 +- library/types.po | 2 +- library/typing.po | 2 +- library/unicodedata.po | 2 +- library/unittest.mock-examples.po | 2 +- library/unittest.mock.po | 2 +- library/unittest.po | 2 +- library/unix.po | 2 +- library/urllib.error.po | 2 +- library/urllib.parse.po | 2 +- library/urllib.po | 2 +- library/urllib.request.po | 2 +- library/urllib.robotparser.po | 2 +- library/uu.po | 2 +- library/uuid.po | 2 +- library/venv.po | 2 +- library/warnings.po | 2 +- library/wave.po | 2 +- library/weakref.po | 2 +- library/webbrowser.po | 2 +- library/windows.po | 2 +- library/winreg.po | 2 +- library/winsound.po | 2 +- library/wsgiref.po | 2 +- library/xdrlib.po | 2 +- library/xml.dom.minidom.po | 2 +- library/xml.dom.po | 2 +- library/xml.dom.pulldom.po | 2 +- library/xml.etree.elementtree.po | 2 +- library/xml.po | 2 +- library/xml.sax.handler.po | 2 +- library/xml.sax.po | 2 +- library/xml.sax.reader.po | 2 +- library/xml.sax.utils.po | 2 +- library/xmlrpc.client.po | 2 +- library/xmlrpc.po | 2 +- library/xmlrpc.server.po | 2 +- library/zipapp.po | 2 +- library/zipfile.po | 2 +- library/zipimport.po | 2 +- library/zlib.po | 2 +- library/zoneinfo.po | 2 +- license.po | 2 +- reference/compound_stmts.po | 2 +- reference/datamodel.po | 2 +- reference/executionmodel.po | 2 +- reference/expressions.po | 2 +- reference/grammar.po | 2 +- reference/import.po | 2 +- reference/index.po | 2 +- reference/introduction.po | 2 +- reference/lexical_analysis.po | 2 +- reference/simple_stmts.po | 2 +- reference/toplevel_components.po | 2 +- sphinx.po | 2 +- tutorial/appendix.po | 2 +- tutorial/appetite.po | 2 +- tutorial/classes.po | 2 +- tutorial/controlflow.po | 2 +- tutorial/datastructures.po | 2 +- tutorial/errors.po | 2 +- tutorial/floatingpoint.po | 2 +- tutorial/index.po | 2 +- tutorial/inputoutput.po | 2 +- tutorial/interactive.po | 2 +- tutorial/interpreter.po | 2 +- tutorial/introduction.po | 2 +- tutorial/modules.po | 2 +- tutorial/stdlib.po | 2 +- tutorial/stdlib2.po | 2 +- tutorial/venv.po | 2 +- tutorial/whatnow.po | 2 +- using/cmdline.po | 2 +- using/configure.po | 2 +- using/editors.po | 2 +- using/index.po | 2 +- using/mac.po | 2 +- using/unix.po | 2 +- using/windows.po | 2 +- whatsnew/2.0.po | 2 +- whatsnew/2.1.po | 2 +- whatsnew/2.2.po | 2 +- whatsnew/2.3.po | 2 +- whatsnew/2.4.po | 2 +- whatsnew/2.5.po | 2 +- whatsnew/2.6.po | 2 +- whatsnew/2.7.po | 18 +++++++++--------- whatsnew/3.0.po | 2 +- whatsnew/3.1.po | 2 +- whatsnew/3.10.po | 2 +- whatsnew/3.11.po | 2 +- whatsnew/3.12.po | 2 +- whatsnew/3.2.po | 2 +- whatsnew/3.3.po | 2 +- whatsnew/3.4.po | 2 +- whatsnew/3.5.po | 2 +- whatsnew/3.6.po | 2 +- whatsnew/3.7.po | 2 +- whatsnew/3.8.po | 2 +- whatsnew/3.9.po | 2 +- whatsnew/changelog.po | 2 +- whatsnew/index.po | 2 +- 499 files changed, 521 insertions(+), 521 deletions(-) rename .github/workflows/{py312-sync-cpython.yml => py313-sync-cpython.yml} (90%) diff --git a/.github/workflows/deploy-gh-page.yml b/.github/workflows/deploy-gh-page.yml index 38d9e70fa1..e06e7a4581 100644 --- a/.github/workflows/deploy-gh-page.yml +++ b/.github/workflows/deploy-gh-page.yml @@ -3,7 +3,7 @@ name: deploy-gh-page on: push: branches: - - "3.12" + - "3.13" jobs: cd: diff --git a/.github/workflows/py312-sync-cpython.yml b/.github/workflows/py313-sync-cpython.yml similarity index 90% rename from .github/workflows/py312-sync-cpython.yml rename to .github/workflows/py313-sync-cpython.yml index f10378c019..9305dbc4b2 100644 --- a/.github/workflows/py312-sync-cpython.yml +++ b/.github/workflows/py313-sync-cpython.yml @@ -1,9 +1,9 @@ -name: python-3.12-sync-with-cpython +name: python-3.13-sync-with-cpython on: push: branches: - - "3.12" + - "3.13" schedule: - cron: "0 0 * * *" @@ -11,8 +11,8 @@ jobs: sync: runs-on: ubuntu-latest env: - VERSION: "3.12" - BRANCH: "cron/sync/3.12" + VERSION: "3.13" + BRANCH: "cron/sync/3.13" steps: - uses: actions/checkout@v4 with: @@ -50,15 +50,15 @@ jobs: base: ${{ env.VERSION }} branch: ${{ env.BRANCH }} delete-branch: false - title: 'Sync with CPython ${{ env.VERSION }}' + title: "Sync with CPython ${{ env.VERSION }}" body: | Sync with CPython ${{ env.VERSION }} draft: true labels: | sync-cpython automation - + - name: Check outputs run: | echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" - echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" \ No newline at end of file + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" diff --git a/Makefile b/Makefile index b1793e0908..db5116d478 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ endef export PRINT_HELP_PYSCRIPT # End of python section CPYTHON_CLONE := ../cpython -VERSION := $(or $(VERSION), 3.12) +VERSION := $(or $(VERSION), 3.13) SPHINX_CONF := $(CPYTHON_CLONE)/Doc/conf.py LANGUAGE := zh_TW LC_MESSAGES := $(CPYTHON_CLONE)/Doc/locales/$(LANGUAGE)/LC_MESSAGES diff --git a/README.rst b/README.rst index 385d4ee165..c239b4a89a 100644 --- a/README.rst +++ b/README.rst @@ -6,7 +6,7 @@ Python 官方說明文件臺灣繁體中文翻譯計畫 :target: https://discord.gg/44XheGXhWH :alt: Join Chat on Discord -這是 Python 3.12 官方說明文件的臺灣繁體中文(zh_TW)翻譯。 +這是 Python 3.13 官方說明文件的臺灣繁體中文(zh_TW)翻譯。 翻譯之前,請務必詳讀並同意\ `授權與 License`_。參與方式請參考\ `參與翻譯`_。 @@ -132,13 +132,13 @@ the PSF for inclusion in the documentation. 接著在 terminal 裡按照以下步驟: -1. 基於最新版本的 ``upstream/3.12`` 開啟一個 branch,現在假設我們想要翻譯 library/math.po \ +1. 基於最新版本的 ``upstream/3.13`` 開啟一個 branch,現在假設我們想要翻譯 library/math.po \ 所以把這個 branch 叫做 ``library/math``: .. code-block:: bash git fetch upstream - git checkout -b library/math upstream/3.12 + git checkout -b library/math upstream/3.13 2. 接著就可以開始翻譯(翻譯時可參考\ `翻譯守則`_),你可以手動開啟 Poedit 應用程式再選 \ library/math.po 檔案打開 @@ -222,7 +222,7 @@ the PSF for inclusion in the documentation. - 從 upstream(我們的主要 GitHub repo)做 fetch 的動作 - 對 origin(你的 fork)做 push -- 永遠不對 ``3.12`` branch 進行修改,請保持讓這個 branch 唯讀,可以避免掉很多問題。 +- 永遠不對 ``3.13`` branch 進行修改,請保持讓這個 branch 唯讀,可以避免掉很多問題。 要翻譯哪些東西 -------------- diff --git a/about.po b/about.po index 4b90148fd5..34c5041570 100644 --- a/about.po +++ b/about.po @@ -12,7 +12,7 @@ # hsiao yi , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-08-05 00:19+0000\n" "PO-Revision-Date: 2022-05-12 00:11+0800\n" diff --git a/bugs.po b/bugs.po index b040a99bb9..2837ebfc0a 100644 --- a/bugs.po +++ b/bugs.po @@ -11,7 +11,7 @@ # Steven Hsu , 2021-2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-04-18 19:45+0000\n" "PO-Revision-Date: 2022-08-31 12:34+0800\n" diff --git a/c-api/abstract.po b/c-api/abstract.po index e2ef911a82..87e9a0091e 100644 --- a/c-api/abstract.po +++ b/c-api/abstract.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2021-12-09 21:20+0800\n" diff --git a/c-api/allocation.po b/c-api/allocation.po index f167bb99fa..c4605012ef 100644 --- a/c-api/allocation.po +++ b/c-api/allocation.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-08-09 00:03+0000\n" "PO-Revision-Date: 2022-10-16 15:35+0800\n" diff --git a/c-api/apiabiversion.po b/c-api/apiabiversion.po index 62558d43f5..8b589303e8 100644 --- a/c-api/apiabiversion.po +++ b/c-api/apiabiversion.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 00:03+0000\n" "PO-Revision-Date: 2022-01-24 22:34+0800\n" diff --git a/c-api/arg.po b/c-api/arg.po index a8487118c9..df6661d53c 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2022-10-16 03:21+0800\n" diff --git a/c-api/bool.po b/c-api/bool.po index d90772c4a7..f2308a6333 100644 --- a/c-api/bool.po +++ b/c-api/bool.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 10:36+0000\n" "PO-Revision-Date: 2021-12-09 20:47+0800\n" diff --git a/c-api/buffer.po b/c-api/buffer.po index 7d80cf51b9..fa0c60391b 100644 --- a/c-api/buffer.po +++ b/c-api/buffer.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 14:30+0000\n" diff --git a/c-api/bytearray.po b/c-api/bytearray.po index b99829a933..57d7d62324 100644 --- a/c-api/bytearray.po +++ b/c-api/bytearray.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-04 00:03+0000\n" "PO-Revision-Date: 2023-08-12 11:42+0800\n" diff --git a/c-api/bytes.po b/c-api/bytes.po index e70159eeb0..01f9c4fc17 100644 --- a/c-api/bytes.po +++ b/c-api/bytes.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-12-26 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:04+0000\n" diff --git a/c-api/call.po b/c-api/call.po index 481a78e876..114ae44a44 100644 --- a/c-api/call.po +++ b/c-api/call.po @@ -6,7 +6,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2022-10-16 03:20+0800\n" diff --git a/c-api/capsule.po b/c-api/capsule.po index 7ce4bb7a23..42a0ea59ac 100644 --- a/c-api/capsule.po +++ b/c-api/capsule.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 14:30+0000\n" diff --git a/c-api/cell.po b/c-api/cell.po index 2f91c7b625..26beccfb9a 100644 --- a/c-api/cell.po +++ b/c-api/cell.po @@ -9,7 +9,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-10 00:04+0000\n" "PO-Revision-Date: 2022-10-16 15:33+0800\n" diff --git a/c-api/code.po b/c-api/code.po index c127f837d6..e9b00a5092 100644 --- a/c-api/code.po +++ b/c-api/code.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/c-api/codec.po b/c-api/codec.po index 68de1f7702..3cd05b00bc 100644 --- a/c-api/codec.po +++ b/c-api/codec.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 00:03+0000\n" "PO-Revision-Date: 2023-07-24 17:51+0000\n" diff --git a/c-api/complex.po b/c-api/complex.po index 8d905e1455..aadd5c049e 100644 --- a/c-api/complex.po +++ b/c-api/complex.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/c-api/concrete.po b/c-api/concrete.po index 4db03592ba..cafd42eadc 100644 --- a/c-api/concrete.po +++ b/c-api/concrete.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-09 00:15+0000\n" "PO-Revision-Date: 2022-11-13 20:37+0800\n" diff --git a/c-api/contextvars.po b/c-api/contextvars.po index 1f5674b054..8e7184e42d 100644 --- a/c-api/contextvars.po +++ b/c-api/contextvars.po @@ -3,7 +3,7 @@ # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" diff --git a/c-api/conversion.po b/c-api/conversion.po index d7c2b52620..a8c2e00699 100644 --- a/c-api/conversion.po +++ b/c-api/conversion.po @@ -7,7 +7,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-01-27 00:03+0000\n" "PO-Revision-Date: 2023-12-11 18:26+0000\n" diff --git a/c-api/coro.po b/c-api/coro.po index 5d375aa714..1a5f027a6d 100644 --- a/c-api/coro.po +++ b/c-api/coro.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-13 00:11+0000\n" "PO-Revision-Date: 2021-12-09 21:15+0800\n" diff --git a/c-api/datetime.po b/c-api/datetime.po index e2e8158f5d..aca575f97c 100644 --- a/c-api/datetime.po +++ b/c-api/datetime.po @@ -8,7 +8,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-08-22 00:03+0000\n" "PO-Revision-Date: 2023-07-01 04:14+0800\n" diff --git a/c-api/descriptor.po b/c-api/descriptor.po index 4a8d94a8d2..314623827e 100644 --- a/c-api/descriptor.po +++ b/c-api/descriptor.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-10-26 16:47+0000\n" "PO-Revision-Date: 2021-12-09 20:56+0800\n" diff --git a/c-api/dict.po b/c-api/dict.po index e696336c09..446c91328a 100644 --- a/c-api/dict.po +++ b/c-api/dict.po @@ -7,7 +7,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/c-api/exceptions.po b/c-api/exceptions.po index 9c9a07f5a1..82db6b2566 100644 --- a/c-api/exceptions.po +++ b/c-api/exceptions.po @@ -6,7 +6,7 @@ # Ching-Lung Chuang, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 14:05+0000\n" diff --git a/c-api/file.po b/c-api/file.po index 4a1d1c1e24..869e229878 100644 --- a/c-api/file.po +++ b/c-api/file.po @@ -7,7 +7,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-04 00:03+0000\n" "PO-Revision-Date: 2023-04-24 20:38+0800\n" diff --git a/c-api/float.po b/c-api/float.po index df086b405b..b2e2875073 100644 --- a/c-api/float.po +++ b/c-api/float.po @@ -7,7 +7,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/c-api/frame.po b/c-api/frame.po index c7c3384f27..289f01ebb1 100644 --- a/c-api/frame.po +++ b/c-api/frame.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-12-06 00:03+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/c-api/function.po b/c-api/function.po index fd946abcb3..c9e9a6c79f 100644 --- a/c-api/function.po +++ b/c-api/function.po @@ -8,7 +8,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-12-13 00:03+0000\n" "PO-Revision-Date: 2022-11-12 15:45+0800\n" diff --git a/c-api/gcsupport.po b/c-api/gcsupport.po index e52f8c9b5d..51c11e9884 100644 --- a/c-api/gcsupport.po +++ b/c-api/gcsupport.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 14:31+0000\n" diff --git a/c-api/gen.po b/c-api/gen.po index 400aa9f691..a1d498d11c 100644 --- a/c-api/gen.po +++ b/c-api/gen.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-13 00:11+0000\n" "PO-Revision-Date: 2022-10-16 15:33+0800\n" diff --git a/c-api/hash.po b/c-api/hash.po index 543ff1d4b4..dc6a9c0d0d 100644 --- a/c-api/hash.po +++ b/c-api/hash.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-02-18 00:03+0000\n" "PO-Revision-Date: 2024-04-30 00:20+0800\n" diff --git a/c-api/import.po b/c-api/import.po index 340d9ccd66..965a7f170f 100644 --- a/c-api/import.po +++ b/c-api/import.po @@ -6,7 +6,7 @@ # Ching-Lung Chuang, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" diff --git a/c-api/index.po b/c-api/index.po index d1aa91e806..7e0a7df309 100644 --- a/c-api/index.po +++ b/c-api/index.po @@ -8,7 +8,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2021-07-05 21:11+0800\n" diff --git a/c-api/init.po b/c-api/init.po index 8f5da7b89d..455a041f48 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -6,7 +6,7 @@ # Adrian Liaw , 2018 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" diff --git a/c-api/init_config.po b/c-api/init_config.po index b2ac9bf415..d26579f04a 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-07 03:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/c-api/intro.po b/c-api/intro.po index 5432552e14..bbea4a82b0 100644 --- a/c-api/intro.po +++ b/c-api/intro.po @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2023-04-25 18:01+0800\n" diff --git a/c-api/iter.po b/c-api/iter.po index 8b674435cc..ac90b9dc26 100644 --- a/c-api/iter.po +++ b/c-api/iter.po @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2023-07-01 03:44+0800\n" diff --git a/c-api/iterator.po b/c-api/iterator.po index fe68f1fa77..3675b02e9a 100644 --- a/c-api/iterator.po +++ b/c-api/iterator.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-24 00:03+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/c-api/list.po b/c-api/list.po index ed430f77a6..3f36448343 100644 --- a/c-api/list.po +++ b/c-api/list.po @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-09 00:15+0000\n" "PO-Revision-Date: 2023-08-24 00:55+0800\n" diff --git a/c-api/long.po b/c-api/long.po index dc269967a2..32a9ac0039 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -5,7 +5,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-06 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" diff --git a/c-api/mapping.po b/c-api/mapping.po index aa99402ad8..6541506687 100644 --- a/c-api/mapping.po +++ b/c-api/mapping.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-09-03 00:03+0000\n" "PO-Revision-Date: 2024-05-11 14:32+0800\n" diff --git a/c-api/marshal.po b/c-api/marshal.po index 536fc0744c..3e1eb7377f 100644 --- a/c-api/marshal.po +++ b/c-api/marshal.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" diff --git a/c-api/memory.po b/c-api/memory.po index 27c22cf58f..caff2b4129 100644 --- a/c-api/memory.po +++ b/c-api/memory.po @@ -6,7 +6,7 @@ # Ching-Lung Chuang, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" diff --git a/c-api/memoryview.po b/c-api/memoryview.po index 25b6abf571..0221f2b2b8 100644 --- a/c-api/memoryview.po +++ b/c-api/memoryview.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-01-30 00:03+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/c-api/method.po b/c-api/method.po index 749218e03a..1583723816 100644 --- a/c-api/method.po +++ b/c-api/method.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-24 00:03+0000\n" "PO-Revision-Date: 2022-01-24 22:22+0800\n" diff --git a/c-api/module.po b/c-api/module.po index a5f3d840f4..3c990d4f27 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -5,7 +5,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" diff --git a/c-api/none.po b/c-api/none.po index a4dc2654ef..2d9800c5f1 100644 --- a/c-api/none.po +++ b/c-api/none.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" diff --git a/c-api/number.po b/c-api/number.po index d058488140..83e14a4b31 100644 --- a/c-api/number.po +++ b/c-api/number.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" diff --git a/c-api/objbuffer.po b/c-api/objbuffer.po index 8b850ef948..c12f1984bb 100644 --- a/c-api/objbuffer.po +++ b/c-api/objbuffer.po @@ -7,7 +7,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-20 18:08+0800\n" "PO-Revision-Date: 2023-07-01 04:33+0800\n" diff --git a/c-api/object.po b/c-api/object.po index eb0e3cc2c1..e0f8e16f9f 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" diff --git a/c-api/objimpl.po b/c-api/objimpl.po index 7ae527d6fb..0958041469 100644 --- a/c-api/objimpl.po +++ b/c-api/objimpl.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/c-api/perfmaps.po b/c-api/perfmaps.po index f46aea6a4b..6c8314aa43 100644 --- a/c-api/perfmaps.po +++ b/c-api/perfmaps.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-17 17:39+0800\n" "PO-Revision-Date: 2024-05-11 14:42+0800\n" @@ -45,8 +45,8 @@ msgid "" "In Python, these helper APIs can be used by libraries and features that rely " "on generating machine code on the fly." msgstr "" -"在 Python 中,這些輔助 API 可以被依賴於運行期間 (on the fly) 產生機器碼的函式庫和" -"功能所使用。" +"在 Python 中,這些輔助 API 可以被依賴於運行期間 (on the fly) 產生機器碼的函式" +"庫和功能所使用。" #: ../../c-api/perfmaps.rst:19 msgid "" diff --git a/c-api/refcounting.po b/c-api/refcounting.po index 301f66bcb9..a2ff320cd7 100644 --- a/c-api/refcounting.po +++ b/c-api/refcounting.po @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2023-08-06 14:19+0800\n" diff --git a/c-api/reflection.po b/c-api/reflection.po index 38e3cc09e9..b07264941d 100644 --- a/c-api/reflection.po +++ b/c-api/reflection.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/c-api/sequence.po b/c-api/sequence.po index c321e9b980..edb70e4c6f 100644 --- a/c-api/sequence.po +++ b/c-api/sequence.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-24 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" diff --git a/c-api/set.po b/c-api/set.po index 0a6f16c6ba..e094b1ee32 100644 --- a/c-api/set.po +++ b/c-api/set.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-11-27 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" diff --git a/c-api/slice.po b/c-api/slice.po index 4c70f299c0..b747809cd1 100644 --- a/c-api/slice.po +++ b/c-api/slice.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" diff --git a/c-api/stable.po b/c-api/stable.po index 3bd34e00be..919634426e 100644 --- a/c-api/stable.po +++ b/c-api/stable.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-01-19 00:03+0000\n" "PO-Revision-Date: 2023-01-24 21:07+0800\n" diff --git a/c-api/structures.po b/c-api/structures.po index e46450f6bc..db16244b8f 100644 --- a/c-api/structures.po +++ b/c-api/structures.po @@ -5,7 +5,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" diff --git a/c-api/sys.po b/c-api/sys.po index 8508ebc7fe..9cb3befea9 100644 --- a/c-api/sys.po +++ b/c-api/sys.po @@ -8,7 +8,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-04 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" diff --git a/c-api/tuple.po b/c-api/tuple.po index 0d201d62fa..311e813a55 100644 --- a/c-api/tuple.po +++ b/c-api/tuple.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-28 13:20+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/c-api/type.po b/c-api/type.po index 9cfbf0a947..a5480ec94c 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-10-14 00:03+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/c-api/typehints.po b/c-api/typehints.po index 6849cd7da0..c90a8f7b3c 100644 --- a/c-api/typehints.po +++ b/c-api/typehints.po @@ -6,7 +6,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2022-10-16 16:16+0800\n" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index e9a2f100ef..77ee43ce9e 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:33+0000\n" diff --git a/c-api/unicode.po b/c-api/unicode.po index 666d51aa2a..65f3f6325b 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -7,7 +7,7 @@ # Liang-Bo Wang , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" diff --git a/c-api/utilities.po b/c-api/utilities.po index 71b6b1c0b7..4775a245ec 100644 --- a/c-api/utilities.po +++ b/c-api/utilities.po @@ -8,7 +8,7 @@ # Phil Lin , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2022-01-31 17:38+0800\n" diff --git a/c-api/veryhigh.po b/c-api/veryhigh.po index 10005e654d..7f42392eaf 100644 --- a/c-api/veryhigh.po +++ b/c-api/veryhigh.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-02-12 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" diff --git a/c-api/weakref.po b/c-api/weakref.po index 9217888102..5e805fe78e 100644 --- a/c-api/weakref.po +++ b/c-api/weakref.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-27 00:03+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/contents.po b/contents.po index 6a7a4c49cb..3312166d6f 100644 --- a/contents.po +++ b/contents.po @@ -7,7 +7,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/copyright.po b/copyright.po index add619c6e3..27acc6692d 100644 --- a/copyright.po +++ b/copyright.po @@ -9,7 +9,7 @@ # meowmeowcat , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-01-10 00:17+0000\n" "PO-Revision-Date: 2021-06-25 20:17+0800\n" diff --git a/deprecations/c-api-pending-removal-in-3.14.po b/deprecations/c-api-pending-removal-in-3.14.po index a8d1a702cf..acd9ed6272 100644 --- a/deprecations/c-api-pending-removal-in-3.14.po +++ b/deprecations/c-api-pending-removal-in-3.14.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-17 00:03+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/deprecations/c-api-pending-removal-in-3.15.po b/deprecations/c-api-pending-removal-in-3.15.po index f9978c5575..48eda9c242 100644 --- a/deprecations/c-api-pending-removal-in-3.15.po +++ b/deprecations/c-api-pending-removal-in-3.15.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-17 00:03+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/deprecations/c-api-pending-removal-in-future.po b/deprecations/c-api-pending-removal-in-future.po index 3dc787ba8d..28b6ce87dc 100644 --- a/deprecations/c-api-pending-removal-in-future.po +++ b/deprecations/c-api-pending-removal-in-future.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-17 00:03+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/deprecations/index.po b/deprecations/index.po index 96ef5f4c93..a60a074bcb 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -5,7 +5,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-30 18:24+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/deprecations/pending-removal-in-3.13.po b/deprecations/pending-removal-in-3.13.po index 75c25c93be..f737520746 100644 --- a/deprecations/pending-removal-in-3.13.po +++ b/deprecations/pending-removal-in-3.13.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-30 18:24+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/deprecations/pending-removal-in-3.14.po b/deprecations/pending-removal-in-3.14.po index 85e1f5f2be..2b0e1acbc9 100644 --- a/deprecations/pending-removal-in-3.14.po +++ b/deprecations/pending-removal-in-3.14.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-17 00:03+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index de1de43e01..56ae2ea588 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-30 18:24+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/deprecations/pending-removal-in-3.16.po b/deprecations/pending-removal-in-3.16.po index 3e33cc33de..184a9c07c8 100644 --- a/deprecations/pending-removal-in-3.16.po +++ b/deprecations/pending-removal-in-3.16.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-26 00:03+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/deprecations/pending-removal-in-future.po b/deprecations/pending-removal-in-future.po index fa52b56e5c..fd4cd109a1 100644 --- a/deprecations/pending-removal-in-future.po +++ b/deprecations/pending-removal-in-future.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-26 18:24+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/distributing/index.po b/distributing/index.po index c21b18ddd6..6ef90c29d0 100644 --- a/distributing/index.po +++ b/distributing/index.po @@ -7,7 +7,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-08-18 00:03+0000\n" "PO-Revision-Date: 2021-07-04 18:06+0800\n" diff --git a/extending/building.po b/extending/building.po index 8a2a5ced44..1e0c34fe84 100644 --- a/extending/building.po +++ b/extending/building.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 14:09+0000\n" diff --git a/extending/embedding.po b/extending/embedding.po index d49f76b779..51c96c2554 100644 --- a/extending/embedding.po +++ b/extending/embedding.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:09+0000\n" diff --git a/extending/extending.po b/extending/extending.po index 24afb86878..249b400169 100644 --- a/extending/extending.po +++ b/extending/extending.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:34+0000\n" diff --git a/extending/index.po b/extending/index.po index 51fce044dc..2518825082 100644 --- a/extending/index.po +++ b/extending/index.po @@ -6,7 +6,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-04-18 00:04+0000\n" "PO-Revision-Date: 2021-07-06 22:18+0800\n" diff --git a/extending/newtypes.po b/extending/newtypes.po index 9a479f42c9..bf29295701 100644 --- a/extending/newtypes.po +++ b/extending/newtypes.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:34+0000\n" diff --git a/extending/newtypes_tutorial.po b/extending/newtypes_tutorial.po index 676dd1c7d3..d0a96394d1 100644 --- a/extending/newtypes_tutorial.po +++ b/extending/newtypes_tutorial.po @@ -2,7 +2,7 @@ # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" diff --git a/extending/windows.po b/extending/windows.po index 41856183ab..a85d0b62fa 100644 --- a/extending/windows.po +++ b/extending/windows.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/faq/design.po b/faq/design.po index 8a3f22dcfc..24856df300 100644 --- a/faq/design.po +++ b/faq/design.po @@ -7,7 +7,7 @@ # Steven Hsu , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2023-08-31 11:34+0800\n" diff --git a/faq/extending.po b/faq/extending.po index 8f84a4ad13..f55f34caaf 100644 --- a/faq/extending.po +++ b/faq/extending.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-02-18 13:08+0800\n" diff --git a/faq/general.po b/faq/general.po index a43f9d3e8b..9f53ddf567 100644 --- a/faq/general.po +++ b/faq/general.po @@ -8,7 +8,7 @@ # Steven Hsu , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2023-06-23 16:56+0800\n" diff --git a/faq/gui.po b/faq/gui.po index c3f53a6d87..46fba489b2 100644 --- a/faq/gui.po +++ b/faq/gui.po @@ -7,7 +7,7 @@ # Steven Hsu, 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-09-05 00:04+0000\n" "PO-Revision-Date: 2022-07-02 17:41+0800\n" diff --git a/faq/index.po b/faq/index.po index 2d73109e45..37bec95316 100644 --- a/faq/index.po +++ b/faq/index.po @@ -6,7 +6,7 @@ # Adrian Liaw , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/faq/installed.po b/faq/installed.po index 557def12ef..260bb53d3c 100644 --- a/faq/installed.po +++ b/faq/installed.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-24 00:11+0000\n" "PO-Revision-Date: 2021-12-09 21:50+0800\n" diff --git a/faq/library.po b/faq/library.po index 8a15890b33..8ed007828e 100644 --- a/faq/library.po +++ b/faq/library.po @@ -6,7 +6,7 @@ # Ching-Lung Chuang, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-02-18 13:22+0800\n" diff --git a/faq/programming.po b/faq/programming.po index c7022e1471..7d5dde418c 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -7,7 +7,7 @@ # hsiao yi , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-04-25 14:17+0800\n" diff --git a/faq/windows.po b/faq/windows.po index a4fa46fa95..a0659bea13 100644 --- a/faq/windows.po +++ b/faq/windows.po @@ -7,7 +7,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2022-11-09 17:25+0800\n" diff --git a/glossary.po b/glossary.po index 80c6a07207..3f5dd3d9d9 100644 --- a/glossary.po +++ b/glossary.po @@ -6,7 +6,7 @@ # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-07 03:11+0800\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" diff --git a/howto/annotations.po b/howto/annotations.po index 0135a78029..c4450542af 100644 --- a/howto/annotations.po +++ b/howto/annotations.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2023-11-08 23:11+0800\n" diff --git a/howto/argparse.po b/howto/argparse.po index 21c4f4cd19..c8731127a1 100644 --- a/howto/argparse.po +++ b/howto/argparse.po @@ -10,7 +10,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-12-11 17:33+0800\n" diff --git a/howto/clinic.po b/howto/clinic.po index c039a32a4c..4deac0b429 100644 --- a/howto/clinic.po +++ b/howto/clinic.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-10-13 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" diff --git a/howto/cporting.po b/howto/cporting.po index 2735f9fcc3..97bd67e1da 100644 --- a/howto/cporting.po +++ b/howto/cporting.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-20 18:08+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" diff --git a/howto/curses.po b/howto/curses.po index 8679624e6d..d28b8e7fb1 100644 --- a/howto/curses.po +++ b/howto/curses.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" diff --git a/howto/descriptor.po b/howto/descriptor.po index b15d02417c..09c6f7afd2 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -5,7 +5,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" diff --git a/howto/enum.po b/howto/enum.po index e3434cb185..17361c7a2b 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/howto/functional.po b/howto/functional.po index b615ce6e3c..4ba6c8302d 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -5,7 +5,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" diff --git a/howto/gdb_helpers.po b/howto/gdb_helpers.po index b838b7cb85..67e53cc2e0 100644 --- a/howto/gdb_helpers.po +++ b/howto/gdb_helpers.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-12 00:04+0000\n" "PO-Revision-Date: 2024-05-11 14:42+0800\n" diff --git a/howto/index.po b/howto/index.po index 04346d9db9..8d63eba8e0 100644 --- a/howto/index.po +++ b/howto/index.po @@ -6,7 +6,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2021-07-05 12:45+0800\n" diff --git a/howto/instrumentation.po b/howto/instrumentation.po index a09a97c9c3..570f39bb25 100644 --- a/howto/instrumentation.po +++ b/howto/instrumentation.po @@ -5,7 +5,7 @@ # Matt Wang msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-08-17 22:17+0800\n" diff --git a/howto/ipaddress.po b/howto/ipaddress.po index 2e0e5b2546..69bef65056 100644 --- a/howto/ipaddress.po +++ b/howto/ipaddress.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-07-20 16:09+0800\n" diff --git a/howto/isolating-extensions.po b/howto/isolating-extensions.po index 87030d9e45..b77676fcb3 100644 --- a/howto/isolating-extensions.po +++ b/howto/isolating-extensions.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index dace5941c5..9b489b58c4 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" diff --git a/howto/logging.po b/howto/logging.po index f254457fed..c3a2fde401 100644 --- a/howto/logging.po +++ b/howto/logging.po @@ -6,7 +6,7 @@ # 文俊 高 , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-07 03:11+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" diff --git a/howto/mro.po b/howto/mro.po index e5b77714fe..816adb559d 100644 --- a/howto/mro.po +++ b/howto/mro.po @@ -5,7 +5,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/howto/perf_profiling.po b/howto/perf_profiling.po index 88ead417c7..7005f65a62 100644 --- a/howto/perf_profiling.po +++ b/howto/perf_profiling.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-12-09 17:39+0800\n" diff --git a/howto/pyporting.po b/howto/pyporting.po index 4184ecf0de..61899804cc 100644 --- a/howto/pyporting.po +++ b/howto/pyporting.po @@ -6,7 +6,7 @@ # jerrychen , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-31 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" diff --git a/howto/regex.po b/howto/regex.po index ab0e03dec1..825d7f2aff 100644 --- a/howto/regex.po +++ b/howto/regex.po @@ -6,7 +6,7 @@ # Kai-han Chang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" diff --git a/howto/sorting.po b/howto/sorting.po index cf6833970c..f8846e6300 100644 --- a/howto/sorting.po +++ b/howto/sorting.po @@ -5,7 +5,7 @@ # Ching-Lung Chuang, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-08-12 15:09+0800\n" diff --git a/howto/unicode.po b/howto/unicode.po index eaeca2e421..b7b29e8cd1 100644 --- a/howto/unicode.po +++ b/howto/unicode.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" diff --git a/howto/urllib2.po b/howto/urllib2.po index a625f8a466..4e79e88dd9 100644 --- a/howto/urllib2.po +++ b/howto/urllib2.po @@ -5,7 +5,7 @@ # Phate , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-06-27 09:36+0800\n" diff --git a/includes/wasm-notavail.po b/includes/wasm-notavail.po index e08d6b73d8..0dad50cab5 100644 --- a/includes/wasm-notavail.po +++ b/includes/wasm-notavail.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-02-13 00:17+0000\n" "PO-Revision-Date: 2022-10-16 07:40+0800\n" diff --git a/installing/index.po b/installing/index.po index 322ff93627..30e461df88 100644 --- a/installing/index.po +++ b/installing/index.po @@ -8,7 +8,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-06-27 09:37+0800\n" diff --git a/library/2to3.po b/library/2to3.po index 407aa22b5b..1b1272de37 100644 --- a/library/2to3.po +++ b/library/2to3.po @@ -6,7 +6,7 @@ # jerrychen , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" diff --git a/library/__future__.po b/library/__future__.po index 5e55c54fc2..6c9b5f80bd 100644 --- a/library/__future__.po +++ b/library/__future__.po @@ -5,7 +5,7 @@ # Matt Wang , 2023-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-02-06 02:12+0000\n" diff --git a/library/__main__.po b/library/__main__.po index 6bf15fc1e9..ff81f21bf6 100644 --- a/library/__main__.po +++ b/library/__main__.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-12-21 14:49+0800\n" diff --git a/library/_thread.po b/library/_thread.po index e2b4e567be..c491b6a257 100644 --- a/library/_thread.po +++ b/library/_thread.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/abc.po b/library/abc.po index a28e811d5a..e6231cfde5 100644 --- a/library/abc.po +++ b/library/abc.po @@ -7,7 +7,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2022-11-16 03:29+0800\n" diff --git a/library/aifc.po b/library/aifc.po index c7c6c1d8af..e5750661b5 100644 --- a/library/aifc.po +++ b/library/aifc.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" "PO-Revision-Date: 2022-05-22 01:57+0800\n" diff --git a/library/allos.po b/library/allos.po index cad1734fed..59c9cddfde 100644 --- a/library/allos.po +++ b/library/allos.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2022-02-15 17:54+0800\n" diff --git a/library/archiving.po b/library/archiving.po index d54de5aacc..c42e38f29a 100644 --- a/library/archiving.po +++ b/library/archiving.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2023-02-18 14:22+0800\n" diff --git a/library/argparse.po b/library/argparse.po index e6458432b6..dae329691f 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" diff --git a/library/array.po b/library/array.po index 9fb7774db1..c45d79a1f8 100644 --- a/library/array.po +++ b/library/array.po @@ -8,7 +8,7 @@ # Benson Chen , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2021-11-23 18:40+0800\n" diff --git a/library/ast.po b/library/ast.po index c58533b4e9..ab82cd210a 100644 --- a/library/ast.po +++ b/library/ast.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" diff --git a/library/asyncio-api-index.po b/library/asyncio-api-index.po index a69cf76a68..1530baa6c8 100644 --- a/library/asyncio-api-index.po +++ b/library/asyncio-api-index.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-10-31 08:13+0000\n" "PO-Revision-Date: 2022-01-27 21:25+0800\n" diff --git a/library/asyncio-dev.po b/library/asyncio-dev.po index 97a689f12a..7362cbb454 100644 --- a/library/asyncio-dev.po +++ b/library/asyncio-dev.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-02-18 14:17+0800\n" diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index 80d65813b7..eb903e4cdf 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-02-20 12:36+0800\n" diff --git a/library/asyncio-exceptions.po b/library/asyncio-exceptions.po index edf7cb0316..e08327656e 100644 --- a/library/asyncio-exceptions.po +++ b/library/asyncio-exceptions.po @@ -6,7 +6,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-06 00:19+0000\n" "PO-Revision-Date: 2022-01-31 21:41+0800\n" diff --git a/library/asyncio-extending.po b/library/asyncio-extending.po index 630ff63a24..506947aa5f 100644 --- a/library/asyncio-extending.po +++ b/library/asyncio-extending.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 10:36+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/asyncio-future.po b/library/asyncio-future.po index fb7a7be464..b208eeee6a 100644 --- a/library/asyncio-future.po +++ b/library/asyncio-future.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-01-25 01:29+0800\n" diff --git a/library/asyncio-llapi-index.po b/library/asyncio-llapi-index.po index 8cd2352ae1..ad64842802 100644 --- a/library/asyncio-llapi-index.po +++ b/library/asyncio-llapi-index.po @@ -6,7 +6,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-10-11 17:13+0000\n" "PO-Revision-Date: 2023-10-12 11:27+0800\n" diff --git a/library/asyncio-platforms.po b/library/asyncio-platforms.po index 9d39d00beb..cc9f8570c6 100644 --- a/library/asyncio-platforms.po +++ b/library/asyncio-platforms.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-01-17 11:37+0800\n" diff --git a/library/asyncio-policy.po b/library/asyncio-policy.po index 3902da6867..78b1176d70 100644 --- a/library/asyncio-policy.po +++ b/library/asyncio-policy.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/asyncio-protocol.po b/library/asyncio-protocol.po index 58e37add6f..682e411440 100644 --- a/library/asyncio-protocol.po +++ b/library/asyncio-protocol.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" diff --git a/library/asyncio-queue.po b/library/asyncio-queue.po index 09bf4b429e..9fdc258a29 100644 --- a/library/asyncio-queue.po +++ b/library/asyncio-queue.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-02-20 18:34+0800\n" diff --git a/library/asyncio-runner.po b/library/asyncio-runner.po index 40885e75a9..374d66b0e3 100644 --- a/library/asyncio-runner.po +++ b/library/asyncio-runner.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/asyncio-stream.po b/library/asyncio-stream.po index a64d70e90e..524e90c944 100644 --- a/library/asyncio-stream.po +++ b/library/asyncio-stream.po @@ -6,7 +6,7 @@ # Matt Wang , 2022-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-10-31 16:28+0800\n" diff --git a/library/asyncio-subprocess.po b/library/asyncio-subprocess.po index 363fa836b1..a3ffe6d7bf 100644 --- a/library/asyncio-subprocess.po +++ b/library/asyncio-subprocess.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" diff --git a/library/asyncio-sync.po b/library/asyncio-sync.po index f7a90d4efe..04f6aea38c 100644 --- a/library/asyncio-sync.po +++ b/library/asyncio-sync.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-02-09 19:27+0800\n" diff --git a/library/asyncio-task.po b/library/asyncio-task.po index 60e5050715..d58e8d737e 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" diff --git a/library/asyncio.po b/library/asyncio.po index 6fd394fb11..83f26e4982 100644 --- a/library/asyncio.po +++ b/library/asyncio.po @@ -7,7 +7,7 @@ # Leo Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2021-11-23 12:40+0800\n" diff --git a/library/atexit.po b/library/atexit.po index de07b4ee11..d671623db5 100644 --- a/library/atexit.po +++ b/library/atexit.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2016-01-31 07:13+0000\n" diff --git a/library/audioop.po b/library/audioop.po index c835baaa18..4de310eb6f 100644 --- a/library/audioop.po +++ b/library/audioop.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-05-22 02:00+0800\n" diff --git a/library/audit_events.po b/library/audit_events.po index 935f0dbc57..46114bbe00 100644 --- a/library/audit_events.po +++ b/library/audit_events.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-03-06 00:03+0000\n" "PO-Revision-Date: 2021-12-06 21:50+0800\n" diff --git a/library/base64.po b/library/base64.po index d386fecf1f..7c399a80fe 100644 --- a/library/base64.po +++ b/library/base64.po @@ -6,7 +6,7 @@ # Inndy, 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-29 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" diff --git a/library/bdb.po b/library/bdb.po index dc99fb79d8..65abd710d1 100644 --- a/library/bdb.po +++ b/library/bdb.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" diff --git a/library/binary.po b/library/binary.po index edeb5839ed..5c36e1bf9c 100644 --- a/library/binary.po +++ b/library/binary.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/binascii.po b/library/binascii.po index ecfcd38b8d..ac5a3facbf 100644 --- a/library/binascii.po +++ b/library/binascii.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" diff --git a/library/bisect.po b/library/bisect.po index d5aae2fa8c..6e3bcf9931 100644 --- a/library/bisect.po +++ b/library/bisect.po @@ -8,7 +8,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-08-01 12:53+0800\n" diff --git a/library/builtins.po b/library/builtins.po index ef5628bb84..d2a6cc577f 100644 --- a/library/builtins.po +++ b/library/builtins.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-02-15 20:55+0800\n" diff --git a/library/bz2.po b/library/bz2.po index 94b9f0a99f..9f4e9f5ee2 100644 --- a/library/bz2.po +++ b/library/bz2.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" diff --git a/library/calendar.po b/library/calendar.po index 7ed55e4591..65de226b31 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" diff --git a/library/cgi.po b/library/cgi.po index fcea153eae..8f7890bfa5 100644 --- a/library/cgi.po +++ b/library/cgi.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-05-22 02:01+0800\n" diff --git a/library/cgitb.po b/library/cgitb.po index e297a5cfee..e608145917 100644 --- a/library/cgitb.po +++ b/library/cgitb.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-05-22 02:02+0800\n" diff --git a/library/chunk.po b/library/chunk.po index 23d9a59322..96bf1cfea3 100644 --- a/library/chunk.po +++ b/library/chunk.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" "PO-Revision-Date: 2022-05-22 02:03+0800\n" diff --git a/library/cmath.po b/library/cmath.po index ae115ae058..40159235bf 100644 --- a/library/cmath.po +++ b/library/cmath.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-03-14 09:26+0800\n" diff --git a/library/cmd.po b/library/cmd.po index 5a014217df..79408d6293 100644 --- a/library/cmd.po +++ b/library/cmd.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" diff --git a/library/cmdline.po b/library/cmdline.po index 5f894724f8..7a8f563111 100644 --- a/library/cmdline.po +++ b/library/cmdline.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-10-12 00:03+0000\n" "PO-Revision-Date: 2023-10-14 16:03+0800\n" diff --git a/library/code.po b/library/code.po index 2e2f496e04..e779167cf9 100644 --- a/library/code.po +++ b/library/code.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" diff --git a/library/codecs.po b/library/codecs.po index fe49b0fa68..4bef52ddb0 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" diff --git a/library/codeop.po b/library/codeop.po index bdb19c3cca..a495574e00 100644 --- a/library/codeop.po +++ b/library/codeop.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2016-11-19 00:28+0000\n" diff --git a/library/collections.abc.po b/library/collections.abc.po index 7d3b69e86f..0012205941 100644 --- a/library/collections.abc.po +++ b/library/collections.abc.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-07 03:11+0800\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" diff --git a/library/collections.po b/library/collections.po index 6ec399fe02..a10d9492cf 100644 --- a/library/collections.po +++ b/library/collections.po @@ -8,7 +8,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-01-22 21:42+0800\n" diff --git a/library/colorsys.po b/library/colorsys.po index 2cc404f6b8..3bf0334312 100644 --- a/library/colorsys.po +++ b/library/colorsys.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-02-15 20:58+0800\n" diff --git a/library/compileall.po b/library/compileall.po index c21e67b18b..16383e7652 100644 --- a/library/compileall.po +++ b/library/compileall.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" diff --git a/library/concurrency.po b/library/concurrency.po index 51f96db2f4..fc7278d186 100644 --- a/library/concurrency.po +++ b/library/concurrency.po @@ -6,7 +6,7 @@ # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-13 00:11+0000\n" "PO-Revision-Date: 2021-11-23 13:36+0800\n" diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index d9a8e7b4a3..4b25e089b3 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -5,7 +5,7 @@ # Matt Wang , 2023-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-01-24 03:33+0800\n" diff --git a/library/concurrent.po b/library/concurrent.po index bfa5989eb2..43635439de 100644 --- a/library/concurrent.po +++ b/library/concurrent.po @@ -6,7 +6,7 @@ # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 10:36+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/configparser.po b/library/configparser.po index 47e50b76fd..a5139db278 100644 --- a/library/configparser.po +++ b/library/configparser.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" diff --git a/library/constants.po b/library/constants.po index 4c7fe0034e..9fd1624475 100644 --- a/library/constants.po +++ b/library/constants.po @@ -7,7 +7,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-07 03:11+0800\n" "PO-Revision-Date: 2021-11-19 23:36+0800\n" diff --git a/library/contextlib.po b/library/contextlib.po index be7d46b7e0..5785f5506e 100644 --- a/library/contextlib.po +++ b/library/contextlib.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" diff --git a/library/contextvars.po b/library/contextvars.po index 97e1b5cfd8..11e024b8ff 100644 --- a/library/contextvars.po +++ b/library/contextvars.po @@ -3,7 +3,7 @@ # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-11 21:40+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" diff --git a/library/copy.po b/library/copy.po index df91a7a329..166c566389 100644 --- a/library/copy.po +++ b/library/copy.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-01-20 18:49+0800\n" diff --git a/library/copyreg.po b/library/copyreg.po index dfcce84f49..d0f8976f36 100644 --- a/library/copyreg.po +++ b/library/copyreg.po @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2023-12-29 00:29+0000\n" diff --git a/library/crypt.po b/library/crypt.po index ac517bce84..4f37bcb814 100644 --- a/library/crypt.po +++ b/library/crypt.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" diff --git a/library/crypto.po b/library/crypto.po index e033e505e4..cfbe820b88 100644 --- a/library/crypto.po +++ b/library/crypto.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-09 00:15+0000\n" "PO-Revision-Date: 2022-02-15 18:06+0800\n" diff --git a/library/csv.po b/library/csv.po index eeed223b19..05f0cd536c 100644 --- a/library/csv.po +++ b/library/csv.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-11-08 15:06+0800\n" diff --git a/library/ctypes.po b/library/ctypes.po index 44e245a243..ab06366040 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-14 00:04+0000\n" "PO-Revision-Date: 2023-04-26 02:59+0800\n" diff --git a/library/curses.ascii.po b/library/curses.ascii.po index a57da1b4cd..9c57ae467b 100644 --- a/library/curses.ascii.po +++ b/library/curses.ascii.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" diff --git a/library/curses.panel.po b/library/curses.panel.po index 056c06f519..728c5cee24 100644 --- a/library/curses.panel.po +++ b/library/curses.panel.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" diff --git a/library/curses.po b/library/curses.po index bb5c9bc23c..91641a8133 100644 --- a/library/curses.po +++ b/library/curses.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-27 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" diff --git a/library/custominterp.po b/library/custominterp.po index c3d74e02e4..8d39942bdf 100644 --- a/library/custominterp.po +++ b/library/custominterp.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-07-06 00:17+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/dataclasses.po b/library/dataclasses.po index 3cfb596bad..42efc54a27 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -2,7 +2,7 @@ # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-02-11 15:02+0800\n" diff --git a/library/datatypes.po b/library/datatypes.po index 03aca0edd2..82edc28c58 100644 --- a/library/datatypes.po +++ b/library/datatypes.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-20 18:08+0800\n" "PO-Revision-Date: 2022-02-11 12:12+0800\n" diff --git a/library/datetime.po b/library/datetime.po index cb850b9d8b..f6c272b6dd 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-07 03:11+0800\n" "PO-Revision-Date: 2023-08-07 10:20+0800\n" diff --git a/library/dbm.po b/library/dbm.po index 0fb484fbbd..baa011d56e 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -5,7 +5,7 @@ # jerrychen , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" diff --git a/library/debug.po b/library/debug.po index df784f61d1..e6d1cd5339 100644 --- a/library/debug.po +++ b/library/debug.po @@ -6,7 +6,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-20 18:08+0800\n" "PO-Revision-Date: 2021-12-08 00:47+0800\n" diff --git a/library/decimal.po b/library/decimal.po index aae7de001e..0ab719a400 100644 --- a/library/decimal.po +++ b/library/decimal.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" diff --git a/library/development.po b/library/development.po index b993383ee9..99e5b0b6c7 100644 --- a/library/development.po +++ b/library/development.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-20 18:08+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/library/devmode.po b/library/devmode.po index 5449742012..d624765024 100644 --- a/library/devmode.po +++ b/library/devmode.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2024-05-03 02:14+0800\n" diff --git a/library/dialog.po b/library/dialog.po index dbe0255950..3460865467 100644 --- a/library/dialog.po +++ b/library/dialog.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-13 00:11+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/difflib.po b/library/difflib.po index b426822ce8..f637faac83 100644 --- a/library/difflib.po +++ b/library/difflib.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2016-11-19 00:29+0000\n" diff --git a/library/dis.po b/library/dis.po index 8892ecafa3..e8e917efaa 100644 --- a/library/dis.po +++ b/library/dis.po @@ -5,7 +5,7 @@ # splasky Chang , 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-07-27 16:55+0800\n" diff --git a/library/distribution.po b/library/distribution.po index 290a362914..16f1ff1073 100644 --- a/library/distribution.po +++ b/library/distribution.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" diff --git a/library/doctest.po b/library/doctest.po index 869c6cfb34..a85b869990 100644 --- a/library/doctest.po +++ b/library/doctest.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" diff --git a/library/email.charset.po b/library/email.charset.po index 4800e31096..ccca6d4771 100644 --- a/library/email.charset.po +++ b/library/email.charset.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" diff --git a/library/email.compat32-message.po b/library/email.compat32-message.po index adb3d3208e..3d8265d6fc 100644 --- a/library/email.compat32-message.po +++ b/library/email.compat32-message.po @@ -2,7 +2,7 @@ # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" diff --git a/library/email.contentmanager.po b/library/email.contentmanager.po index 7462046454..2c155e66b3 100644 --- a/library/email.contentmanager.po +++ b/library/email.contentmanager.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" diff --git a/library/email.encoders.po b/library/email.encoders.po index b30b4da3e9..851f162ded 100644 --- a/library/email.encoders.po +++ b/library/email.encoders.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 10:36+0000\n" "PO-Revision-Date: 2024-05-03 03:44+0000\n" diff --git a/library/email.errors.po b/library/email.errors.po index b9ac58c595..4e9e91bc1f 100644 --- a/library/email.errors.po +++ b/library/email.errors.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-07 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" diff --git a/library/email.examples.po b/library/email.examples.po index fb1ded2ecc..31933d8dcb 100644 --- a/library/email.examples.po +++ b/library/email.examples.po @@ -3,7 +3,7 @@ # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" diff --git a/library/email.generator.po b/library/email.generator.po index b0ae12d0f7..97e310ce13 100644 --- a/library/email.generator.po +++ b/library/email.generator.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" diff --git a/library/email.header.po b/library/email.header.po index 1e9c38a9c8..ab91339aba 100644 --- a/library/email.header.po +++ b/library/email.header.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" diff --git a/library/email.headerregistry.po b/library/email.headerregistry.po index 4fedfdee9a..a55e5e9a83 100644 --- a/library/email.headerregistry.po +++ b/library/email.headerregistry.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" diff --git a/library/email.iterators.po b/library/email.iterators.po index 4b12cddefb..71843281fb 100644 --- a/library/email.iterators.po +++ b/library/email.iterators.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2016-11-19 00:30+0000\n" diff --git a/library/email.message.po b/library/email.message.po index 8d8317321b..49155f42d7 100644 --- a/library/email.message.po +++ b/library/email.message.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" diff --git a/library/email.mime.po b/library/email.mime.po index 1f45a7bcc2..2cd526c301 100644 --- a/library/email.mime.po +++ b/library/email.mime.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:00+0000\n" diff --git a/library/email.parser.po b/library/email.parser.po index ff3c7597c1..69565e928d 100644 --- a/library/email.parser.po +++ b/library/email.parser.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" diff --git a/library/email.po b/library/email.po index 1592968c73..583f0d7880 100644 --- a/library/email.po +++ b/library/email.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" diff --git a/library/email.policy.po b/library/email.policy.po index fecb843622..20f6c5e82b 100644 --- a/library/email.policy.po +++ b/library/email.policy.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" diff --git a/library/email.utils.po b/library/email.utils.po index 81afcaf3dd..eb6c4dec6b 100644 --- a/library/email.utils.po +++ b/library/email.utils.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-07 03:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/ensurepip.po b/library/ensurepip.po index 151641a7b2..4a991ef370 100644 --- a/library/ensurepip.po +++ b/library/ensurepip.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" diff --git a/library/enum.po b/library/enum.po index caa8b89d13..b98379c42b 100644 --- a/library/enum.po +++ b/library/enum.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-09-11 14:08+0800\n" diff --git a/library/errno.po b/library/errno.po index 6316d82767..8a2c10f4e4 100644 --- a/library/errno.po +++ b/library/errno.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/exceptions.po b/library/exceptions.po index 9ef5f376f1..f24969ec8e 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" "PO-Revision-Date: 2024-09-17 09:18+0800\n" diff --git a/library/faulthandler.po b/library/faulthandler.po index 290364ae87..202d723b3c 100644 --- a/library/faulthandler.po +++ b/library/faulthandler.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" diff --git a/library/fcntl.po b/library/fcntl.po index 38455cb763..283b9f5887 100644 --- a/library/fcntl.po +++ b/library/fcntl.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/library/filecmp.po b/library/filecmp.po index 4d635d6e80..c93d892b11 100644 --- a/library/filecmp.po +++ b/library/filecmp.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/fileformats.po b/library/fileformats.po index 567de48562..3168a73efa 100644 --- a/library/fileformats.po +++ b/library/fileformats.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/library/fileinput.po b/library/fileinput.po index c54fab2cc5..92b59172fd 100644 --- a/library/fileinput.po +++ b/library/fileinput.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" diff --git a/library/filesys.po b/library/filesys.po index e682fe6090..039d7bf996 100644 --- a/library/filesys.po +++ b/library/filesys.po @@ -7,7 +7,7 @@ # Allen Wu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-04-18 00:04+0000\n" "PO-Revision-Date: 2021-11-22 20:13+0800\n" diff --git a/library/fnmatch.po b/library/fnmatch.po index 3f51f72882..345fd99a0a 100644 --- a/library/fnmatch.po +++ b/library/fnmatch.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" diff --git a/library/fractions.po b/library/fractions.po index 82a4c8225e..91b33f2a86 100644 --- a/library/fractions.po +++ b/library/fractions.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2016-01-31 07:18+0000\n" diff --git a/library/frameworks.po b/library/frameworks.po index 7fd9ab13c2..5dce9895aa 100644 --- a/library/frameworks.po +++ b/library/frameworks.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/library/ftplib.po b/library/ftplib.po index 3042e7310a..cc4d59a8b2 100644 --- a/library/ftplib.po +++ b/library/ftplib.po @@ -5,7 +5,7 @@ # Matt Wang , 2023-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2023-04-26 19:44+0800\n" diff --git a/library/functional.po b/library/functional.po index 9c3ef0e55d..d8cea9f862 100644 --- a/library/functional.po +++ b/library/functional.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/library/functions.po b/library/functions.po index 94c87764ac..a330e5f3a0 100644 --- a/library/functions.po +++ b/library/functions.po @@ -8,7 +8,7 @@ # Steven Hsu , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-07 03:11+0800\n" "PO-Revision-Date: 2024-05-06 17:06+0800\n" diff --git a/library/functools.po b/library/functools.po index 8fc6a31c22..202b2bf7b8 100644 --- a/library/functools.po +++ b/library/functools.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2024-05-11 16:02+0800\n" diff --git a/library/gc.po b/library/gc.po index ac05411f77..df8e9d8b1f 100644 --- a/library/gc.po +++ b/library/gc.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2023-04-24 21:25+0800\n" diff --git a/library/getopt.po b/library/getopt.po index 01b5b5326d..20967fec5b 100644 --- a/library/getopt.po +++ b/library/getopt.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2016-01-31 07:19+0000\n" diff --git a/library/getpass.po b/library/getpass.po index 16b7ea0454..aab3b473f7 100644 --- a/library/getpass.po +++ b/library/getpass.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-30 18:24+0000\n" "PO-Revision-Date: 2022-02-11 12:04+0800\n" diff --git a/library/gettext.po b/library/gettext.po index 88431c49e5..c7634d5d75 100644 --- a/library/gettext.po +++ b/library/gettext.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" diff --git a/library/glob.po b/library/glob.po index 5b2a4cde1e..6c0281c504 100644 --- a/library/glob.po +++ b/library/glob.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-01-24 01:21+0800\n" diff --git a/library/graphlib.po b/library/graphlib.po index 4ee16bd428..8e8f8e4479 100644 --- a/library/graphlib.po +++ b/library/graphlib.po @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-01-04 16:35+0800\n" diff --git a/library/grp.po b/library/grp.po index f035088276..25d2f0707b 100644 --- a/library/grp.po +++ b/library/grp.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" diff --git a/library/gzip.po b/library/gzip.po index 8e7285d25a..c5f0496a55 100644 --- a/library/gzip.po +++ b/library/gzip.po @@ -5,7 +5,7 @@ # Adrian Liaw , 2018 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" diff --git a/library/hashlib.po b/library/hashlib.po index 9d2a0e698b..aacf8a8a13 100644 --- a/library/hashlib.po +++ b/library/hashlib.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2024-05-11 16:03+0800\n" diff --git a/library/heapq.po b/library/heapq.po index 41ee95e112..859f7606c5 100644 --- a/library/heapq.po +++ b/library/heapq.po @@ -6,7 +6,7 @@ # 周 忠毅 , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-07-01 18:20+0800\n" diff --git a/library/hmac.po b/library/hmac.po index 6dea034e07..96c143d75c 100644 --- a/library/hmac.po +++ b/library/hmac.po @@ -7,7 +7,7 @@ # Phil Lin , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-03-30 00:16+0800\n" diff --git a/library/html.entities.po b/library/html.entities.po index 369e99c012..1131e507aa 100644 --- a/library/html.entities.po +++ b/library/html.entities.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-06-27 09:38+0800\n" diff --git a/library/html.parser.po b/library/html.parser.po index 69c985c715..f8c640799e 100644 --- a/library/html.parser.po +++ b/library/html.parser.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-05-04 22:54+0800\n" diff --git a/library/html.po b/library/html.po index 8fe70f0764..5da95baaf8 100644 --- a/library/html.po +++ b/library/html.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/http.client.po b/library/http.client.po index 04fdaaf61f..29447588c4 100644 --- a/library/http.client.po +++ b/library/http.client.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" diff --git a/library/http.cookiejar.po b/library/http.cookiejar.po index f8330d7865..1df6769663 100644 --- a/library/http.cookiejar.po +++ b/library/http.cookiejar.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2016-11-19 00:31+0000\n" diff --git a/library/http.cookies.po b/library/http.cookies.po index 543c129b71..4bd8b76059 100644 --- a/library/http.cookies.po +++ b/library/http.cookies.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2016-11-19 00:31+0000\n" diff --git a/library/http.po b/library/http.po index d1d4167712..cbda6c4b7b 100644 --- a/library/http.po +++ b/library/http.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" diff --git a/library/http.server.po b/library/http.server.po index 43a4f4373b..a937e86760 100644 --- a/library/http.server.po +++ b/library/http.server.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" diff --git a/library/i18n.po b/library/i18n.po index fbe9aeab54..c05c2ed1c1 100644 --- a/library/i18n.po +++ b/library/i18n.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/library/idle.po b/library/idle.po index 4a2afd926f..66d6e0817f 100644 --- a/library/idle.po +++ b/library/idle.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" diff --git a/library/imaplib.po b/library/imaplib.po index 4da8c1fd8e..aa703fb268 100644 --- a/library/imaplib.po +++ b/library/imaplib.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" diff --git a/library/imghdr.po b/library/imghdr.po index 49e98cc3d2..f190c8b9c3 100644 --- a/library/imghdr.po +++ b/library/imghdr.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-05-22 02:06+0800\n" diff --git a/library/importlib.metadata.po b/library/importlib.metadata.po index 8e935b37f9..0002790bd9 100644 --- a/library/importlib.metadata.po +++ b/library/importlib.metadata.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/importlib.po b/library/importlib.po index e6be299e9b..558737fc77 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" diff --git a/library/importlib.resources.abc.po b/library/importlib.resources.abc.po index 640cb5446c..5439f00156 100644 --- a/library/importlib.resources.abc.po +++ b/library/importlib.resources.abc.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/importlib.resources.po b/library/importlib.resources.po index 46564377c8..f1e63a27fc 100644 --- a/library/importlib.resources.po +++ b/library/importlib.resources.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/index.po b/library/index.po index 483e6ba1ad..35406943a5 100644 --- a/library/index.po +++ b/library/index.po @@ -9,7 +9,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-11-10 00:19+0000\n" "PO-Revision-Date: 2021-07-04 22:55+0800\n" diff --git a/library/inspect.po b/library/inspect.po index c1c479ae2a..d7fc210c67 100644 --- a/library/inspect.po +++ b/library/inspect.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-13 00:04+0000\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" diff --git a/library/internet.po b/library/internet.po index ff55f254eb..7df27a1a2a 100644 --- a/library/internet.po +++ b/library/internet.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-09 00:15+0000\n" "PO-Revision-Date: 2023-08-15 22:14+0800\n" diff --git a/library/intro.po b/library/intro.po index 40887bae06..9488b2750e 100644 --- a/library/intro.po +++ b/library/intro.po @@ -9,7 +9,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2021-10-26 17:01+0800\n" diff --git a/library/io.po b/library/io.po index 391cdc6d14..feecd18d50 100644 --- a/library/io.po +++ b/library/io.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-12-08 00:08+0800\n" diff --git a/library/ipaddress.po b/library/ipaddress.po index eeea4cc3cb..60917b30e7 100644 --- a/library/ipaddress.po +++ b/library/ipaddress.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" diff --git a/library/ipc.po b/library/ipc.po index f024e94b8e..ed4490bb62 100644 --- a/library/ipc.po +++ b/library/ipc.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-09-20 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/itertools.po b/library/itertools.po index 5cc34e8bb9..0a2e3042f7 100644 --- a/library/itertools.po +++ b/library/itertools.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-08-16 15:01+0800\n" diff --git a/library/json.po b/library/json.po index c8aba2819d..1a8f841146 100644 --- a/library/json.po +++ b/library/json.po @@ -6,7 +6,7 @@ # SkyLull , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2023-08-05 15:25+0800\n" diff --git a/library/keyword.po b/library/keyword.po index 4149814c03..975d58fd62 100644 --- a/library/keyword.po +++ b/library/keyword.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-01-18 14:55+0800\n" diff --git a/library/language.po b/library/language.po index 510a4a95c4..fd197d5ad7 100644 --- a/library/language.po +++ b/library/language.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/linecache.po b/library/linecache.po index 0c5de2752c..167947f253 100644 --- a/library/linecache.po +++ b/library/linecache.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" diff --git a/library/locale.po b/library/locale.po index f93026190b..08d6cb5caa 100644 --- a/library/locale.po +++ b/library/locale.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" diff --git a/library/logging.config.po b/library/logging.config.po index f4eb6e8a94..44221e3ded 100644 --- a/library/logging.config.po +++ b/library/logging.config.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" diff --git a/library/logging.handlers.po b/library/logging.handlers.po index 1294781f56..c735ab982e 100644 --- a/library/logging.handlers.po +++ b/library/logging.handlers.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" diff --git a/library/logging.po b/library/logging.po index 2f1dc52536..453999600b 100644 --- a/library/logging.po +++ b/library/logging.po @@ -5,7 +5,7 @@ # Andy Dai , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-09 14:12+0800\n" "PO-Revision-Date: 2024-03-28 22:40+0800\n" diff --git a/library/lzma.po b/library/lzma.po index 627058b090..df86fd296f 100644 --- a/library/lzma.po +++ b/library/lzma.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" diff --git a/library/mailbox.po b/library/mailbox.po index e547f70c08..76156c2730 100644 --- a/library/mailbox.po +++ b/library/mailbox.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" diff --git a/library/mailcap.po b/library/mailcap.po index f18c8968f3..6b778d0178 100644 --- a/library/mailcap.po +++ b/library/mailcap.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/markup.po b/library/markup.po index 63aaa070ba..6804f0d603 100644 --- a/library/markup.po +++ b/library/markup.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/marshal.po b/library/marshal.po index 6470b60402..73bcfc85e3 100644 --- a/library/marshal.po +++ b/library/marshal.po @@ -7,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-04 00:03+0000\n" "PO-Revision-Date: 2023-04-24 21:28+0800\n" diff --git a/library/math.po b/library/math.po index 2f104cc3be..015702b2c3 100644 --- a/library/math.po +++ b/library/math.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2024-04-26 15:15+0800\n" diff --git a/library/mimetypes.po b/library/mimetypes.po index 450acc839c..cb222c36a1 100644 --- a/library/mimetypes.po +++ b/library/mimetypes.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2016-11-19 00:32+0000\n" diff --git a/library/mm.po b/library/mm.po index e3d6db2942..eefa2312a6 100644 --- a/library/mm.po +++ b/library/mm.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2022-01-18 14:54+0800\n" diff --git a/library/mmap.po b/library/mmap.po index 0a218bd00d..b36417a293 100644 --- a/library/mmap.po +++ b/library/mmap.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" diff --git a/library/modulefinder.po b/library/modulefinder.po index 70909e4390..e4f1f62d68 100644 --- a/library/modulefinder.po +++ b/library/modulefinder.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2024-05-11 14:42+0800\n" diff --git a/library/modules.po b/library/modules.po index f1928e20b0..147e11b561 100644 --- a/library/modules.po +++ b/library/modules.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" diff --git a/library/msilib.po b/library/msilib.po index 66e0e47ca3..f7d0ed3c2a 100644 --- a/library/msilib.po +++ b/library/msilib.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" diff --git a/library/msvcrt.po b/library/msvcrt.po index 4edb26438d..c3a4747dc1 100644 --- a/library/msvcrt.po +++ b/library/msvcrt.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-04 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" diff --git a/library/multiprocessing.po b/library/multiprocessing.po index c7910516ec..e935849511 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" diff --git a/library/multiprocessing.shared_memory.po b/library/multiprocessing.shared_memory.po index 36e1c95d50..ba28f82048 100644 --- a/library/multiprocessing.shared_memory.po +++ b/library/multiprocessing.shared_memory.po @@ -5,7 +5,7 @@ # Matt Wang , 2023-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-12-11 00:03+0800\n" diff --git a/library/netdata.po b/library/netdata.po index 8f8a8899d5..079730d3d7 100644 --- a/library/netdata.po +++ b/library/netdata.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-10-26 16:47+0000\n" "PO-Revision-Date: 2023-01-23 23:33+0800\n" diff --git a/library/netrc.po b/library/netrc.po index 31020039ae..81fdb294b8 100644 --- a/library/netrc.po +++ b/library/netrc.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" diff --git a/library/nis.po b/library/nis.po index 02a77493b4..4f16e11b08 100644 --- a/library/nis.po +++ b/library/nis.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" "PO-Revision-Date: 2016-11-19 00:32+0000\n" diff --git a/library/nntplib.po b/library/nntplib.po index f416460fef..d0720d6f85 100644 --- a/library/nntplib.po +++ b/library/nntplib.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" diff --git a/library/numbers.po b/library/numbers.po index a02472878e..221858c2e6 100644 --- a/library/numbers.po +++ b/library/numbers.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-11-16 04:57+0800\n" diff --git a/library/numeric.po b/library/numeric.po index 85a8f226d0..f95652f63e 100644 --- a/library/numeric.po +++ b/library/numeric.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" diff --git a/library/operator.po b/library/operator.po index fd491feb8e..3df309831a 100644 --- a/library/operator.po +++ b/library/operator.po @@ -7,7 +7,7 @@ # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2023-02-18 14:49+0800\n" diff --git a/library/optparse.po b/library/optparse.po index f0154d0c34..60c0664fed 100644 --- a/library/optparse.po +++ b/library/optparse.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" diff --git a/library/os.path.po b/library/os.path.po index 50436d3391..a84dfbd3d8 100644 --- a/library/os.path.po +++ b/library/os.path.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-07-13 14:06+0800\n" diff --git a/library/os.po b/library/os.po index 3b3f140719..3e78aff562 100644 --- a/library/os.po +++ b/library/os.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-04-29 15:24+0800\n" diff --git a/library/ossaudiodev.po b/library/ossaudiodev.po index 7caa453007..4daa2201eb 100644 --- a/library/ossaudiodev.po +++ b/library/ossaudiodev.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-05-22 02:10+0800\n" diff --git a/library/pathlib.po b/library/pathlib.po index 88307bb77b..08d2f54ae4 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-02-29 20:49+0800\n" diff --git a/library/pdb.po b/library/pdb.po index fc65e4555f..152baf4aca 100644 --- a/library/pdb.po +++ b/library/pdb.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" diff --git a/library/persistence.po b/library/persistence.po index 9e69ecf5d2..b655269a25 100644 --- a/library/persistence.po +++ b/library/persistence.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/pickle.po b/library/pickle.po index ba40da6e5c..091777c3d3 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" diff --git a/library/pickletools.po b/library/pickletools.po index 15a4442979..d3bd0aee93 100644 --- a/library/pickletools.po +++ b/library/pickletools.po @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" diff --git a/library/pipes.po b/library/pipes.po index 0f7dfc2aad..67d5298f5b 100644 --- a/library/pipes.po +++ b/library/pipes.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-05-22 02:11+0800\n" diff --git a/library/pkgutil.po b/library/pkgutil.po index 8c6aba317d..c8a23bee35 100644 --- a/library/pkgutil.po +++ b/library/pkgutil.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2024-03-08 16:07+0000\n" diff --git a/library/platform.po b/library/platform.po index 2e904a0cc5..cd50812c59 100644 --- a/library/platform.po +++ b/library/platform.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2022-06-11 14:03+0800\n" diff --git a/library/plistlib.po b/library/plistlib.po index 82762c0f61..5f182c6e90 100644 --- a/library/plistlib.po +++ b/library/plistlib.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2016-01-31 07:27+0000\n" diff --git a/library/poplib.po b/library/poplib.po index 3f678ffc37..7e4a2dde67 100644 --- a/library/poplib.po +++ b/library/poplib.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" diff --git a/library/posix.po b/library/posix.po index 8b09e8308c..394ad55dc8 100644 --- a/library/posix.po +++ b/library/posix.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-01-24 00:05+0800\n" diff --git a/library/pprint.po b/library/pprint.po index 35796365bc..ce89afcb1b 100644 --- a/library/pprint.po +++ b/library/pprint.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" diff --git a/library/profile.po b/library/profile.po index 6a90bdd428..2c93bffa6c 100644 --- a/library/profile.po +++ b/library/profile.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" diff --git a/library/pty.po b/library/pty.po index 508bddc8ea..f609bfc794 100644 --- a/library/pty.po +++ b/library/pty.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2016-11-19 00:33+0000\n" diff --git a/library/pwd.po b/library/pwd.po index b9ddcdd639..688e42e08f 100644 --- a/library/pwd.po +++ b/library/pwd.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2023-05-20 16:08+0800\n" diff --git a/library/py_compile.po b/library/py_compile.po index 285dff5332..19828595ae 100644 --- a/library/py_compile.po +++ b/library/py_compile.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" diff --git a/library/pyclbr.po b/library/pyclbr.po index 9a31c04cd0..c55eccfc78 100644 --- a/library/pyclbr.po +++ b/library/pyclbr.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" diff --git a/library/pydoc.po b/library/pydoc.po index 1b3de1fd42..405db7041e 100644 --- a/library/pydoc.po +++ b/library/pydoc.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/pyexpat.po b/library/pyexpat.po index c589eba9f1..b5d6eca3f3 100644 --- a/library/pyexpat.po +++ b/library/pyexpat.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" diff --git a/library/python.po b/library/python.po index 0380edcd9b..804cb269c0 100644 --- a/library/python.po +++ b/library/python.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/queue.po b/library/queue.po index 914fef0b6c..0787568472 100644 --- a/library/queue.po +++ b/library/queue.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-09-27 00:12+0800\n" diff --git a/library/quopri.po b/library/quopri.po index 5799070e46..f4dccd0e0d 100644 --- a/library/quopri.po +++ b/library/quopri.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2023-07-01 14:59+0800\n" diff --git a/library/random.po b/library/random.po index dccebf8953..c647b731dd 100644 --- a/library/random.po +++ b/library/random.po @@ -5,7 +5,7 @@ # Allen Wu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-01-23 22:47+0800\n" diff --git a/library/re.po b/library/re.po index 6e8abfb216..5f3d918f57 100644 --- a/library/re.po +++ b/library/re.po @@ -6,7 +6,7 @@ # Leo Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-07 03:11+0800\n" "PO-Revision-Date: 2023-09-16 14:49+0800\n" diff --git a/library/readline.po b/library/readline.po index a23e1af6e2..1fed428ff6 100644 --- a/library/readline.po +++ b/library/readline.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" diff --git a/library/reprlib.po b/library/reprlib.po index c68a714b13..ee82176131 100644 --- a/library/reprlib.po +++ b/library/reprlib.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/resource.po b/library/resource.po index 633d41c179..e87a2dccbe 100644 --- a/library/resource.po +++ b/library/resource.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" diff --git a/library/rlcompleter.po b/library/rlcompleter.po index f6ae409d9b..c40e220e6e 100644 --- a/library/rlcompleter.po +++ b/library/rlcompleter.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/runpy.po b/library/runpy.po index b59ef48a03..8d10dcc661 100644 --- a/library/runpy.po +++ b/library/runpy.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2016-11-19 00:33+0000\n" diff --git a/library/sched.po b/library/sched.po index 1349a730a5..3e6f6d458d 100644 --- a/library/sched.po +++ b/library/sched.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-05-09 16:09+0000\n" diff --git a/library/secrets.po b/library/secrets.po index 703330aac0..26688ee0ce 100644 --- a/library/secrets.po +++ b/library/secrets.po @@ -5,7 +5,7 @@ # bonzo , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-09 14:12+0800\n" "PO-Revision-Date: 2022-11-30 13:42+0800\n" diff --git a/library/security_warnings.po b/library/security_warnings.po index 8a2bfa8fe4..76240d9dcf 100644 --- a/library/security_warnings.po +++ b/library/security_warnings.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-09 00:15+0000\n" "PO-Revision-Date: 2023-08-21 02:41+0000\n" diff --git a/library/select.po b/library/select.po index 3d28e0dd46..bf240e3708 100644 --- a/library/select.po +++ b/library/select.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" diff --git a/library/selectors.po b/library/selectors.po index add677babc..c627e1d333 100644 --- a/library/selectors.po +++ b/library/selectors.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" diff --git a/library/shelve.po b/library/shelve.po index bef4196535..868c1e555e 100644 --- a/library/shelve.po +++ b/library/shelve.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" diff --git a/library/shlex.po b/library/shlex.po index 1994b4f5db..d1c7a7333d 100644 --- a/library/shlex.po +++ b/library/shlex.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" diff --git a/library/shutil.po b/library/shutil.po index 0868a4ac29..a9177fabbc 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" diff --git a/library/signal.po b/library/signal.po index 0b09d2bc20..0533ccb814 100644 --- a/library/signal.po +++ b/library/signal.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" diff --git a/library/site.po b/library/site.po index 5b00bd3bbc..a38f3ab8d0 100644 --- a/library/site.po +++ b/library/site.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-07 03:11+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" diff --git a/library/smtplib.po b/library/smtplib.po index 91addd80b5..b023cde473 100644 --- a/library/smtplib.po +++ b/library/smtplib.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" diff --git a/library/sndhdr.po b/library/sndhdr.po index 62e9d90ce2..13eead7a74 100644 --- a/library/sndhdr.po +++ b/library/sndhdr.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2022-06-11 15:40+0800\n" diff --git a/library/socket.po b/library/socket.po index 68340d8baf..71021479c9 100644 --- a/library/socket.po +++ b/library/socket.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" diff --git a/library/socketserver.po b/library/socketserver.po index d14e7bda2c..b2355fec4b 100644 --- a/library/socketserver.po +++ b/library/socketserver.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" diff --git a/library/spwd.po b/library/spwd.po index 9a726f2c09..3a1dae13ce 100644 --- a/library/spwd.po +++ b/library/spwd.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" "PO-Revision-Date: 2022-05-22 02:14+0800\n" diff --git a/library/sqlite3.po b/library/sqlite3.po index 4f0b8b2d0c..1c2b2b0449 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" diff --git a/library/ssl.po b/library/ssl.po index 95d08ef7f3..3f6db0b048 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2024-08-28 00:43+0800\n" diff --git a/library/stat.po b/library/stat.po index e0d8fce823..a186ac2d47 100644 --- a/library/stat.po +++ b/library/stat.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2016-11-19 00:34+0000\n" diff --git a/library/statistics.po b/library/statistics.po index 94309c5a09..b2eb33b837 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -5,7 +5,7 @@ # KentHsu , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-07-22 21:15+0800\n" diff --git a/library/stdtypes.po b/library/stdtypes.po index 9689fb6885..6230b680d2 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -7,7 +7,7 @@ # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" @@ -7659,9 +7659,9 @@ msgstr "" #: ../../library/stdtypes.rst:5296 msgid "" -"Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." +"Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" #: ../../library/stdtypes.rst:5304 diff --git a/library/string.po b/library/string.po index 0f15f60e61..acd1fea713 100644 --- a/library/string.po +++ b/library/string.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-03-10 15:57+0800\n" diff --git a/library/stringprep.po b/library/stringprep.po index 6f7ee577b7..7999df6a59 100644 --- a/library/stringprep.po +++ b/library/stringprep.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2016-11-19 00:34+0000\n" diff --git a/library/struct.po b/library/struct.po index ccc6400608..4ba997ca45 100644 --- a/library/struct.po +++ b/library/struct.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" diff --git a/library/subprocess.po b/library/subprocess.po index 3250c5378d..4367fb0ff2 100644 --- a/library/subprocess.po +++ b/library/subprocess.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" diff --git a/library/sunau.po b/library/sunau.po index 1a7f604acb..c4917b1d20 100644 --- a/library/sunau.po +++ b/library/sunau.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" diff --git a/library/superseded.po b/library/superseded.po index 81bdaff9d0..d8e34d57c6 100644 --- a/library/superseded.po +++ b/library/superseded.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2022-02-15 20:45+0800\n" diff --git a/library/symtable.po b/library/symtable.po index fb4abb8401..a4dfc937f9 100644 --- a/library/symtable.po +++ b/library/symtable.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/sys.monitoring.po b/library/sys.monitoring.po index b77818bc27..7845ea8083 100644 --- a/library/sys.monitoring.po +++ b/library/sys.monitoring.po @@ -5,7 +5,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/sys.po b/library/sys.po index aaa348c462..e82894aa18 100644 --- a/library/sys.po +++ b/library/sys.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2023-04-26 02:54+0800\n" diff --git a/library/sys_path_init.po b/library/sys_path_init.po index d71020ccda..53ad456c13 100644 --- a/library/sys_path_init.po +++ b/library/sys_path_init.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/sysconfig.po b/library/sysconfig.po index 0fc713e9d1..10ce77971d 100644 --- a/library/sysconfig.po +++ b/library/sysconfig.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" diff --git a/library/syslog.po b/library/syslog.po index 51d5c2be48..40f2b0a829 100644 --- a/library/syslog.po +++ b/library/syslog.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/tabnanny.po b/library/tabnanny.po index 18b3dbbf2a..0ed61a596b 100644 --- a/library/tabnanny.po +++ b/library/tabnanny.po @@ -7,7 +7,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-11-17 21:19+0800\n" diff --git a/library/tarfile.po b/library/tarfile.po index 05905efced..a624f2c74e 100644 --- a/library/tarfile.po +++ b/library/tarfile.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" diff --git a/library/telnetlib.po b/library/telnetlib.po index c5ee1769d3..20603a5420 100644 --- a/library/telnetlib.po +++ b/library/telnetlib.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-05-22 02:15+0800\n" diff --git a/library/tempfile.po b/library/tempfile.po index 4a3088d1d0..1263ef9a43 100644 --- a/library/tempfile.po +++ b/library/tempfile.po @@ -6,7 +6,7 @@ # Matt Wang , 2021-2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-06-12 15:17+0800\n" diff --git a/library/termios.po b/library/termios.po index b0123afdc3..d801678336 100644 --- a/library/termios.po +++ b/library/termios.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" diff --git a/library/test.po b/library/test.po index 79851fd564..81011e2c7f 100644 --- a/library/test.po +++ b/library/test.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" diff --git a/library/text.po b/library/text.po index d1455bb8d7..4170b9d6b2 100644 --- a/library/text.po +++ b/library/text.po @@ -7,7 +7,7 @@ # Jordan Su , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2021-10-17 22:18+0800\n" diff --git a/library/textwrap.po b/library/textwrap.po index b705c13901..659303b7f8 100644 --- a/library/textwrap.po +++ b/library/textwrap.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/threading.po b/library/threading.po index 9409ef71ff..9b75b44677 100644 --- a/library/threading.po +++ b/library/threading.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" diff --git a/library/time.po b/library/time.po index 1262f3248e..5c2bb1a36f 100644 --- a/library/time.po +++ b/library/time.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2024-08-14 16:05+0800\n" diff --git a/library/timeit.po b/library/timeit.po index 9f039857c6..b7a9d153b8 100644 --- a/library/timeit.po +++ b/library/timeit.po @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-05-20 13:21+0800\n" diff --git a/library/tk.po b/library/tk.po index 184e8e98a4..492b8d11eb 100644 --- a/library/tk.po +++ b/library/tk.po @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-09 00:15+0000\n" "PO-Revision-Date: 2023-06-24 17:09+0800\n" diff --git a/library/tkinter.colorchooser.po b/library/tkinter.colorchooser.po index b154b07475..f85fe7c89d 100644 --- a/library/tkinter.colorchooser.po +++ b/library/tkinter.colorchooser.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2024-02-15 12:16+0800\n" diff --git a/library/tkinter.dnd.po b/library/tkinter.dnd.po index cddc3334f6..0425c9d7de 100644 --- a/library/tkinter.dnd.po +++ b/library/tkinter.dnd.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/tkinter.font.po b/library/tkinter.font.po index 9be214ecf3..5560f48175 100644 --- a/library/tkinter.font.po +++ b/library/tkinter.font.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2024-02-15 23:09+0800\n" diff --git a/library/tkinter.messagebox.po b/library/tkinter.messagebox.po index a66422680a..c6ba507cf3 100644 --- a/library/tkinter.messagebox.po +++ b/library/tkinter.messagebox.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2024-02-22 15:59+0800\n" diff --git a/library/tkinter.po b/library/tkinter.po index 6e6844eb52..772fb19175 100644 --- a/library/tkinter.po +++ b/library/tkinter.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" diff --git a/library/tkinter.scrolledtext.po b/library/tkinter.scrolledtext.po index 820167e086..4076832764 100644 --- a/library/tkinter.scrolledtext.po +++ b/library/tkinter.scrolledtext.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2016-11-19 00:35+0000\n" diff --git a/library/tkinter.tix.po b/library/tkinter.tix.po index a8cd31502b..ad862d5ec0 100644 --- a/library/tkinter.tix.po +++ b/library/tkinter.tix.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-10-01 14:35+0800\n" diff --git a/library/tkinter.ttk.po b/library/tkinter.ttk.po index 572a9b9cf0..2497bc1d7a 100644 --- a/library/tkinter.ttk.po +++ b/library/tkinter.ttk.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" diff --git a/library/token.po b/library/token.po index c1ca41b9e8..063d07f920 100644 --- a/library/token.po +++ b/library/token.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-30 18:24+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" diff --git a/library/tokenize.po b/library/tokenize.po index 29113c47b9..32d1dd0754 100644 --- a/library/tokenize.po +++ b/library/tokenize.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" diff --git a/library/tomllib.po b/library/tomllib.po index 9f0fda8290..e2c41e707a 100644 --- a/library/tomllib.po +++ b/library/tomllib.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-11 21:40+0800\n" "PO-Revision-Date: 2022-11-18 01:56+0800\n" diff --git a/library/trace.po b/library/trace.po index 6d8c7bc01b..8b5970193c 100644 --- a/library/trace.po +++ b/library/trace.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" diff --git a/library/traceback.po b/library/traceback.po index 850a2f458f..aacd761710 100644 --- a/library/traceback.po +++ b/library/traceback.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" diff --git a/library/tracemalloc.po b/library/tracemalloc.po index 7ca51be507..8ce369cc18 100644 --- a/library/tracemalloc.po +++ b/library/tracemalloc.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" diff --git a/library/tty.po b/library/tty.po index 24e56b4d40..56c833a6f6 100644 --- a/library/tty.po +++ b/library/tty.po @@ -7,7 +7,7 @@ # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2021-12-17 17:00+0800\n" diff --git a/library/turtle.po b/library/turtle.po index ef4f54f410..64b4995071 100644 --- a/library/turtle.po +++ b/library/turtle.po @@ -5,7 +5,7 @@ # Renyuan Lyu , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" diff --git a/library/types.po b/library/types.po index 6e9918622d..66e2125f0b 100644 --- a/library/types.po +++ b/library/types.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" diff --git a/library/typing.po b/library/typing.po index 9f336ece63..774bc2e9d1 100644 --- a/library/typing.po +++ b/library/typing.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2024-07-11 11:12+0800\n" diff --git a/library/unicodedata.po b/library/unicodedata.po index 083fb902ed..7905b56fa6 100644 --- a/library/unicodedata.po +++ b/library/unicodedata.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" diff --git a/library/unittest.mock-examples.po b/library/unittest.mock-examples.po index 4ae1f6722f..5dd01545b7 100644 --- a/library/unittest.mock-examples.po +++ b/library/unittest.mock-examples.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-05-06 08:22+0800\n" diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 92c5b8dab9..80a2302135 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-02-19 21:27+0800\n" diff --git a/library/unittest.po b/library/unittest.po index 391ec57ab9..07a29017bd 100644 --- a/library/unittest.po +++ b/library/unittest.po @@ -7,7 +7,7 @@ # Jason , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-10-16 06:03+0800\n" diff --git a/library/unix.po b/library/unix.po index b9fe32495a..be71ea3e66 100644 --- a/library/unix.po +++ b/library/unix.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2022-02-15 18:42+0800\n" diff --git a/library/urllib.error.po b/library/urllib.error.po index 6b18c50684..550aa37d83 100644 --- a/library/urllib.error.po +++ b/library/urllib.error.po @@ -7,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-06-11 15:34+0800\n" diff --git a/library/urllib.parse.po b/library/urllib.parse.po index 24dc952196..b16410cf2d 100644 --- a/library/urllib.parse.po +++ b/library/urllib.parse.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" diff --git a/library/urllib.po b/library/urllib.po index 13e4e2714d..858dce4dac 100644 --- a/library/urllib.po +++ b/library/urllib.po @@ -8,7 +8,7 @@ # Phil Lin , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-01-31 18:04+0800\n" diff --git a/library/urllib.request.po b/library/urllib.request.po index 2b623d0a97..74cd6963ad 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -5,7 +5,7 @@ # Adrian Liaw , 2018 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2022-04-21 17:59+0800\n" diff --git a/library/urllib.robotparser.po b/library/urllib.robotparser.po index 209f618cbf..0d17e17856 100644 --- a/library/urllib.robotparser.po +++ b/library/urllib.robotparser.po @@ -6,7 +6,7 @@ # Phil Lin , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-01-27 13:40+0800\n" diff --git a/library/uu.po b/library/uu.po index 55c9f76f32..13affdd5a7 100644 --- a/library/uu.po +++ b/library/uu.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" "PO-Revision-Date: 2022-05-22 02:22+0800\n" diff --git a/library/uuid.po b/library/uuid.po index 1f2ff6001f..e3274d2fbf 100644 --- a/library/uuid.po +++ b/library/uuid.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" diff --git a/library/venv.po b/library/venv.po index 0935137cd3..03b0c5a9ed 100644 --- a/library/venv.po +++ b/library/venv.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-07-09 15:09+0800\n" diff --git a/library/warnings.po b/library/warnings.po index 5cf7ea7164..80ad7756fe 100644 --- a/library/warnings.po +++ b/library/warnings.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" diff --git a/library/wave.po b/library/wave.po index c253f6a628..37c5e0856c 100644 --- a/library/wave.po +++ b/library/wave.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" diff --git a/library/weakref.po b/library/weakref.po index 385046692e..3325dd9142 100644 --- a/library/weakref.po +++ b/library/weakref.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2024-05-22 20:58+0800\n" diff --git a/library/webbrowser.po b/library/webbrowser.po index 4c9edc0779..08cb5281b3 100644 --- a/library/webbrowser.po +++ b/library/webbrowser.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" diff --git a/library/windows.po b/library/windows.po index 4b7ffa47a2..a77a8f584e 100644 --- a/library/windows.po +++ b/library/windows.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2022-02-15 18:37+0800\n" diff --git a/library/winreg.po b/library/winreg.po index 2c8efc2b62..fa46e096f8 100644 --- a/library/winreg.po +++ b/library/winreg.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" diff --git a/library/winsound.po b/library/winsound.po index d165f66948..f51aa90496 100644 --- a/library/winsound.po +++ b/library/winsound.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" diff --git a/library/wsgiref.po b/library/wsgiref.po index 10a9cc8840..4cbbe03d50 100644 --- a/library/wsgiref.po +++ b/library/wsgiref.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2023-12-09 21:29+0800\n" diff --git a/library/xdrlib.po b/library/xdrlib.po index d12417b3a1..ca29ccbfd4 100644 --- a/library/xdrlib.po +++ b/library/xdrlib.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2016-01-31 07:33+0000\n" diff --git a/library/xml.dom.minidom.po b/library/xml.dom.minidom.po index 74a2c571ac..edf87d6176 100644 --- a/library/xml.dom.minidom.po +++ b/library/xml.dom.minidom.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" diff --git a/library/xml.dom.po b/library/xml.dom.po index b2f8e62c4d..650d019f11 100644 --- a/library/xml.dom.po +++ b/library/xml.dom.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/xml.dom.pulldom.po b/library/xml.dom.pulldom.po index bc6feb6f8a..736f1f62c2 100644 --- a/library/xml.dom.pulldom.po +++ b/library/xml.dom.pulldom.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/xml.etree.elementtree.po b/library/xml.etree.elementtree.po index a844301b14..f13b797352 100644 --- a/library/xml.etree.elementtree.po +++ b/library/xml.etree.elementtree.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-21 00:04+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/xml.po b/library/xml.po index 09721a17e1..d23f35acd4 100644 --- a/library/xml.po +++ b/library/xml.po @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-04-18 00:04+0000\n" "PO-Revision-Date: 2023-08-21 02:16+0000\n" diff --git a/library/xml.sax.handler.po b/library/xml.sax.handler.po index ca9c9cb7ba..fdc38671c3 100644 --- a/library/xml.sax.handler.po +++ b/library/xml.sax.handler.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2016-11-19 00:36+0000\n" diff --git a/library/xml.sax.po b/library/xml.sax.po index 4a89f1ed1d..2e824867ca 100644 --- a/library/xml.sax.po +++ b/library/xml.sax.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2016-11-19 00:36+0000\n" diff --git a/library/xml.sax.reader.po b/library/xml.sax.reader.po index 7f8fc189b2..7ec2580467 100644 --- a/library/xml.sax.reader.po +++ b/library/xml.sax.reader.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/xml.sax.utils.po b/library/xml.sax.utils.po index 87dd0585ea..12044fcbee 100644 --- a/library/xml.sax.utils.po +++ b/library/xml.sax.utils.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/xmlrpc.client.po b/library/xmlrpc.client.po index 31112ab712..c84684df77 100644 --- a/library/xmlrpc.client.po +++ b/library/xmlrpc.client.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/xmlrpc.po b/library/xmlrpc.po index e744806400..15a6dc34eb 100644 --- a/library/xmlrpc.po +++ b/library/xmlrpc.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 10:36+0000\n" "PO-Revision-Date: 2022-02-16 01:58+0800\n" diff --git a/library/xmlrpc.server.po b/library/xmlrpc.server.po index 44d4e5413d..6d9d2a3716 100644 --- a/library/xmlrpc.server.po +++ b/library/xmlrpc.server.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/zipapp.po b/library/zipapp.po index bdb7de3d4a..02fc69d0ea 100644 --- a/library/zipapp.po +++ b/library/zipapp.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/zipfile.po b/library/zipfile.po index 4133e1f7be..18fa2bfe2f 100644 --- a/library/zipfile.po +++ b/library/zipfile.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/zipimport.po b/library/zipimport.po index 014ed2cc28..b57334f240 100644 --- a/library/zipimport.po +++ b/library/zipimport.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" diff --git a/library/zlib.po b/library/zlib.po index 5ba7b2b7c1..d2c292664d 100644 --- a/library/zlib.po +++ b/library/zlib.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-12-28 20:58+0800\n" diff --git a/library/zoneinfo.po b/library/zoneinfo.po index c047aa4c67..f2782f72e7 100644 --- a/library/zoneinfo.po +++ b/library/zoneinfo.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/license.po b/license.po index 71b188355c..2024e8c7e0 100644 --- a/license.po +++ b/license.po @@ -6,7 +6,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-06-27 09:40+0800\n" diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index 18c53a33ea..84bb0863bb 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" diff --git a/reference/datamodel.po b/reference/datamodel.po index 88092c9db3..6126e7c52e 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-07 03:11+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" diff --git a/reference/executionmodel.po b/reference/executionmodel.po index ce819e1bf8..06fb5bc862 100644 --- a/reference/executionmodel.po +++ b/reference/executionmodel.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" diff --git a/reference/expressions.po b/reference/expressions.po index 0b2d0e7ca2..63c3f2e842 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" diff --git a/reference/grammar.po b/reference/grammar.po index 4d05834640..1a40b9af23 100644 --- a/reference/grammar.po +++ b/reference/grammar.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" diff --git a/reference/import.po b/reference/import.po index d2ff9eadab..9a98a69bd1 100644 --- a/reference/import.po +++ b/reference/import.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" diff --git a/reference/index.po b/reference/index.po index 5f843e0bd9..9f265f75e9 100644 --- a/reference/index.po +++ b/reference/index.po @@ -6,7 +6,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2021-07-06 22:07+0800\n" diff --git a/reference/introduction.po b/reference/introduction.po index 39a65f1e47..65f31bc1f5 100644 --- a/reference/introduction.po +++ b/reference/introduction.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" diff --git a/reference/lexical_analysis.po b/reference/lexical_analysis.po index f849a461eb..2a956d7cbb 100644 --- a/reference/lexical_analysis.po +++ b/reference/lexical_analysis.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-07 03:11+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" diff --git a/reference/simple_stmts.po b/reference/simple_stmts.po index 59b0e04ecf..b29815534b 100644 --- a/reference/simple_stmts.po +++ b/reference/simple_stmts.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" diff --git a/reference/toplevel_components.po b/reference/toplevel_components.po index 83d92d67a5..11726a155b 100644 --- a/reference/toplevel_components.po +++ b/reference/toplevel_components.po @@ -7,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-09 00:15+0000\n" "PO-Revision-Date: 2022-12-01 01:37+0800\n" diff --git a/sphinx.po b/sphinx.po index c3d4944366..e5ef4f9b2f 100644 --- a/sphinx.po +++ b/sphinx.po @@ -6,7 +6,7 @@ # Steven Hsu , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-17 00:03+0000\n" "PO-Revision-Date: 2023-03-15 10:19+0800\n" diff --git a/tutorial/appendix.po b/tutorial/appendix.po index a97d68dc37..8d7a25481d 100644 --- a/tutorial/appendix.po +++ b/tutorial/appendix.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2021-07-05 14:35+0800\n" diff --git a/tutorial/appetite.po b/tutorial/appetite.po index 520d0ba0af..42d5ffb0b0 100644 --- a/tutorial/appetite.po +++ b/tutorial/appetite.po @@ -7,7 +7,7 @@ # Liang-Bo Wang , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-24 00:11+0000\n" "PO-Revision-Date: 2021-10-03 17:39+0800\n" diff --git a/tutorial/classes.po b/tutorial/classes.po index d22456afc1..f102da185e 100644 --- a/tutorial/classes.po +++ b/tutorial/classes.po @@ -6,7 +6,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-12-26 23:12+0800\n" diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index f4ec564dcb..58684f4aa7 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -9,7 +9,7 @@ # Steven Hsu , 2021-2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-07-24 14:52+0800\n" diff --git a/tutorial/datastructures.po b/tutorial/datastructures.po index 74a00983dc..27fcb13025 100644 --- a/tutorial/datastructures.po +++ b/tutorial/datastructures.po @@ -10,7 +10,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-01-22 21:43+0800\n" diff --git a/tutorial/errors.po b/tutorial/errors.po index 31349d7ea7..6e4e0d9bd0 100644 --- a/tutorial/errors.po +++ b/tutorial/errors.po @@ -7,7 +7,7 @@ # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-10-24 14:54+0800\n" diff --git a/tutorial/floatingpoint.po b/tutorial/floatingpoint.po index 29a235e1b5..dc13c64d29 100644 --- a/tutorial/floatingpoint.po +++ b/tutorial/floatingpoint.po @@ -8,7 +8,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-06-22 14:43+0800\n" diff --git a/tutorial/index.po b/tutorial/index.po index 8dd27a3e5c..47eb0a648b 100644 --- a/tutorial/index.po +++ b/tutorial/index.po @@ -8,7 +8,7 @@ # woodrow-shen , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-10-26 16:47+0000\n" "PO-Revision-Date: 2018-06-17 11:39+0000\n" diff --git a/tutorial/inputoutput.po b/tutorial/inputoutput.po index 7043a1f50b..3fbc7a6674 100644 --- a/tutorial/inputoutput.po +++ b/tutorial/inputoutput.po @@ -7,7 +7,7 @@ # Steven Hsu , 2021-2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-10-05 10:26+0800\n" diff --git a/tutorial/interactive.po b/tutorial/interactive.po index f95e9e3326..c7d64f4e81 100644 --- a/tutorial/interactive.po +++ b/tutorial/interactive.po @@ -6,7 +6,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 10:36+0000\n" "PO-Revision-Date: 2021-06-28 20:45+0800\n" diff --git a/tutorial/interpreter.po b/tutorial/interpreter.po index 3c01c492de..55b6dc2444 100644 --- a/tutorial/interpreter.po +++ b/tutorial/interpreter.po @@ -6,7 +6,7 @@ # Liang-Bo Wang , 2015-2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2021-05-18 16:28+0800\n" diff --git a/tutorial/introduction.po b/tutorial/introduction.po index 76a4aae9d1..436e18af6b 100644 --- a/tutorial/introduction.po +++ b/tutorial/introduction.po @@ -7,7 +7,7 @@ # Steven Hsu , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-10-16 03:20+0800\n" diff --git a/tutorial/modules.po b/tutorial/modules.po index 3255c53bbd..02d752fd55 100644 --- a/tutorial/modules.po +++ b/tutorial/modules.po @@ -8,7 +8,7 @@ # Phil Lin , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-10-23 20:30+0800\n" diff --git a/tutorial/stdlib.po b/tutorial/stdlib.po index 2e2b32d7d9..c02c7c82b5 100644 --- a/tutorial/stdlib.po +++ b/tutorial/stdlib.po @@ -12,7 +12,7 @@ # Phil Lin , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2022-01-31 18:14+0800\n" diff --git a/tutorial/stdlib2.po b/tutorial/stdlib2.po index c44790758d..d766cd5038 100644 --- a/tutorial/stdlib2.po +++ b/tutorial/stdlib2.po @@ -7,7 +7,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2021-06-19 14:24+0800\n" diff --git a/tutorial/venv.po b/tutorial/venv.po index d925307f4a..408392a22a 100644 --- a/tutorial/venv.po +++ b/tutorial/venv.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2022-10-16 05:35+0800\n" diff --git a/tutorial/whatnow.po b/tutorial/whatnow.po index 4b5d65878b..d963db60c2 100644 --- a/tutorial/whatnow.po +++ b/tutorial/whatnow.po @@ -7,7 +7,7 @@ # meowmeowcat , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-10-16 05:37+0800\n" diff --git a/using/cmdline.po b/using/cmdline.po index cda8562f83..2c892a596a 100644 --- a/using/cmdline.po +++ b/using/cmdline.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" diff --git a/using/configure.po b/using/configure.po index 7221de2974..143bb3ba26 100644 --- a/using/configure.po +++ b/using/configure.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/using/editors.po b/using/editors.po index 81a486b644..d066d58ae3 100644 --- a/using/editors.po +++ b/using/editors.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-13 00:11+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/using/index.po b/using/index.po index 85a426479f..f702f15a0e 100644 --- a/using/index.po +++ b/using/index.po @@ -6,7 +6,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2021-07-06 22:21+0800\n" diff --git a/using/mac.po b/using/mac.po index 1b95fa62ab..b54ac6db04 100644 --- a/using/mac.po +++ b/using/mac.po @@ -8,7 +8,7 @@ # Matt Wang , 2022, 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2022-08-31 22:26+0800\n" diff --git a/using/unix.po b/using/unix.po index c779d1f25a..ebbda0b865 100644 --- a/using/unix.po +++ b/using/unix.po @@ -5,7 +5,7 @@ # Matt Wang , 2022-2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2023-03-27 12:40+0800\n" diff --git a/using/windows.po b/using/windows.po index a4ef897ace..020e5d495d 100644 --- a/using/windows.po +++ b/using/windows.po @@ -6,7 +6,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" diff --git a/whatsnew/2.0.po b/whatsnew/2.0.po index 55883349f0..384912a37d 100644 --- a/whatsnew/2.0.po +++ b/whatsnew/2.0.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" diff --git a/whatsnew/2.1.po b/whatsnew/2.1.po index 3816f61629..bdb865bf96 100644 --- a/whatsnew/2.1.po +++ b/whatsnew/2.1.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" diff --git a/whatsnew/2.2.po b/whatsnew/2.2.po index 2c65027bdb..337bc0870a 100644 --- a/whatsnew/2.2.po +++ b/whatsnew/2.2.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" diff --git a/whatsnew/2.3.po b/whatsnew/2.3.po index 6a73cca3a9..4a8043f37b 100644 --- a/whatsnew/2.3.po +++ b/whatsnew/2.3.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" diff --git a/whatsnew/2.4.po b/whatsnew/2.4.po index 9d7402235f..8b3940987f 100644 --- a/whatsnew/2.4.po +++ b/whatsnew/2.4.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" diff --git a/whatsnew/2.5.po b/whatsnew/2.5.po index 0b4e4b0f12..dc403b9f06 100644 --- a/whatsnew/2.5.po +++ b/whatsnew/2.5.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" diff --git a/whatsnew/2.6.po b/whatsnew/2.6.po index c67c96b179..6b2ee814c8 100644 --- a/whatsnew/2.6.po +++ b/whatsnew/2.6.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" diff --git a/whatsnew/2.7.po b/whatsnew/2.7.po index aea3c54582..b68b58db3d 100644 --- a/whatsnew/2.7.po +++ b/whatsnew/2.7.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" @@ -2846,14 +2846,14 @@ msgid "" "ElementTree's code for converting trees to a string has been significantly " "reworked, making it roughly twice as fast in many cases. The :meth:" "`ElementTree.write() ` and :meth:" -"`Element.write` methods now have a *method* parameter that can be " -"\"xml\" (the default), \"html\", or \"text\". HTML mode will output empty " -"elements as ```` instead of ````, and text mode will " -"skip over elements and only output the text chunks. If you set the :attr:" -"`~xml.etree.ElementTree.Element.tag` attribute of an element to ``None`` but " -"leave its children in place, the element will be omitted when the tree is " -"written out, so you don't need to do more extensive rearrangement to remove " -"a single element." +"`Element.write` methods now have a *method* parameter that can be \"xml\" " +"(the default), \"html\", or \"text\". HTML mode will output empty elements " +"as ```` instead of ````, and text mode will skip over " +"elements and only output the text chunks. If you set the :attr:`~xml.etree." +"ElementTree.Element.tag` attribute of an element to ``None`` but leave its " +"children in place, the element will be omitted when the tree is written out, " +"so you don't need to do more extensive rearrangement to remove a single " +"element." msgstr "" #: ../../whatsnew/2.7.rst:2044 diff --git a/whatsnew/3.0.po b/whatsnew/3.0.po index 20529c8163..3fc6bc2be0 100644 --- a/whatsnew/3.0.po +++ b/whatsnew/3.0.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" diff --git a/whatsnew/3.1.po b/whatsnew/3.1.po index 0413b313f6..718005d5bf 100644 --- a/whatsnew/3.1.po +++ b/whatsnew/3.1.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index 1ecb0935a0..22899a7637 100644 --- a/whatsnew/3.10.po +++ b/whatsnew/3.10.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2023-06-26 03:02+0800\n" diff --git a/whatsnew/3.11.po b/whatsnew/3.11.po index 17357fa657..4584c32ee1 100644 --- a/whatsnew/3.11.po +++ b/whatsnew/3.11.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2023-05-28 18:21+0800\n" diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index 955e445748..3c8eb123d2 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/whatsnew/3.2.po b/whatsnew/3.2.po index ca1a3a0fc5..096eab1ab1 100644 --- a/whatsnew/3.2.po +++ b/whatsnew/3.2.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" diff --git a/whatsnew/3.3.po b/whatsnew/3.3.po index 70e66733d1..227ebf5acf 100644 --- a/whatsnew/3.3.po +++ b/whatsnew/3.3.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index 8e82dabafa..8d0fff2e57 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index 8607e5e9b6..334f9a4baf 100644 --- a/whatsnew/3.5.po +++ b/whatsnew/3.5.po @@ -6,7 +6,7 @@ # Noah Chen , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index 67826bcc28..e8e6ac0774 100644 --- a/whatsnew/3.6.po +++ b/whatsnew/3.6.po @@ -2,7 +2,7 @@ # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index 3e1f2a8b2a..3d7002fd00 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -2,7 +2,7 @@ # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-18 00:04+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" diff --git a/whatsnew/3.8.po b/whatsnew/3.8.po index a3348ccd25..1ec080c04d 100644 --- a/whatsnew/3.8.po +++ b/whatsnew/3.8.po @@ -5,7 +5,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-19 00:04+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/whatsnew/3.9.po b/whatsnew/3.9.po index bef7fc358a..668cc5e06d 100644 --- a/whatsnew/3.9.po +++ b/whatsnew/3.9.po @@ -5,7 +5,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/whatsnew/changelog.po b/whatsnew/changelog.po index 57e5decb8d..62347d8849 100644 --- a/whatsnew/changelog.po +++ b/whatsnew/changelog.po @@ -7,7 +7,7 @@ # Noah Chen , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2018-05-23 16:21+0000\n" diff --git a/whatsnew/index.po b/whatsnew/index.po index 919f5dd09e..750ee6edc1 100644 --- a/whatsnew/index.po +++ b/whatsnew/index.po @@ -7,7 +7,7 @@ # Steven Hsu , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-04-16 00:03+0000\n" "PO-Revision-Date: 2022-07-07 11:37+0800\n" From 014a3f16b929bd58feb433554f2f6b9ea26df538 Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Mon, 23 Sep 2024 09:19:59 +0800 Subject: [PATCH 14/89] chore: pull 3.12-3.13 diff into the project (#962) --- c-api/arg.po | 259 +- c-api/bool.po | 25 +- c-api/bytes.po | 20 +- c-api/call.po | 195 +- c-api/code.po | 108 +- c-api/complex.po | 43 +- c-api/dict.po | 189 +- c-api/exceptions.po | 723 +-- c-api/file.po | 22 +- c-api/frame.po | 29 +- c-api/hash.po | 60 +- c-api/import.po | 137 +- c-api/init.po | 1304 +++-- c-api/init_config.po | 902 ++-- c-api/intro.po | 22 +- c-api/list.po | 91 +- c-api/long.po | 349 +- c-api/mapping.po | 76 +- c-api/memory.po | 230 +- c-api/module.po | 212 +- c-api/monitoring.po | 168 + c-api/none.po | 7 +- c-api/object.po | 370 +- c-api/refcounting.po | 121 +- c-api/reflection.po | 82 +- c-api/slice.po | 7 +- c-api/structures.po | 22 +- c-api/sys.po | 148 +- c-api/time.po | 167 + c-api/tuple.po | 74 +- c-api/type.po | 149 +- c-api/typeobj.po | 978 ++-- c-api/unicode.po | 724 +-- c-api/weakref.po | 65 +- copyright.po | 5 +- deprecations/c-api-pending-removal-in-3.15.po | 11 +- deprecations/index.po | 420 +- deprecations/pending-removal-in-3.13.po | 78 +- deprecations/pending-removal-in-3.15.po | 9 +- deprecations/pending-removal-in-future.po | 96 +- extending/embedding.po | 155 +- extending/extending.po | 382 +- extending/newtypes.po | 4 +- extending/newtypes_tutorial.po | 295 +- faq/design.po | 16 +- faq/general.po | 7 +- faq/gui.po | 48 +- faq/library.po | 377 +- faq/programming.po | 9 +- glossary.po | 923 ++-- howto/descriptor.po | 286 +- howto/enum.po | 745 +-- howto/free-threading-extensions.po | 451 ++ howto/functional.po | 502 +- howto/index.po | 116 +- howto/logging-cookbook.po | 11 +- howto/logging.po | 506 +- howto/perf_profiling.po | 108 +- howto/timerfd.po | 285 + library/_thread.po | 55 +- library/argparse.po | 593 +- library/array.po | 222 +- library/ast.po | 1178 ++-- library/asyncio-eventloop.po | 646 ++- library/asyncio-protocol.po | 229 +- library/asyncio-queue.po | 92 +- library/asyncio-runner.po | 64 +- library/asyncio-stream.po | 114 +- library/asyncio-sync.po | 102 +- library/asyncio-task.po | 523 +- library/asyncio.po | 32 +- library/base64.po | 46 +- library/bdb.po | 78 +- library/binascii.po | 97 +- library/bz2.po | 94 +- library/calendar.po | 31 +- library/cmd.po | 99 +- library/cmdline.po | 41 +- library/code.po | 74 +- library/codecs.po | 542 +- library/collections.po | 149 +- library/compileall.po | 12 +- library/concurrent.futures.po | 170 +- library/configparser.po | 386 +- library/contextvars.po | 14 +- library/copy.po | 96 +- library/crypto.po | 6 +- library/ctypes.po | 773 +-- library/curses.po | 978 ++-- library/dataclasses.po | 140 +- library/datetime.po | 1026 ++-- library/dbm.po | 260 +- library/development.po | 7 +- library/dis.po | 1109 ++-- library/doctest.po | 397 +- library/email.examples.po | 18 +- library/email.generator.po | 8 +- library/email.po | 23 +- library/ensurepip.po | 16 +- library/enum.po | 405 +- library/exceptions.po | 284 +- library/fcntl.po | 113 +- library/filecmp.po | 56 +- library/fractions.po | 81 +- library/ftplib.po | 12 +- library/functions.po | 815 +-- library/functools.po | 117 +- library/gc.po | 244 +- library/getopt.po | 66 +- library/getpass.po | 17 +- library/glob.po | 118 +- library/grp.po | 14 +- library/gzip.po | 129 +- library/hashlib.po | 216 +- library/http.client.po | 10 +- library/http.cookiejar.po | 5 +- library/http.po | 381 +- library/http.server.po | 43 +- library/imaplib.po | 12 +- library/importlib.metadata.po | 231 +- library/importlib.po | 189 +- library/importlib.resources.po | 258 +- library/inspect.po | 546 +- library/intro.po | 67 +- library/ipaddress.po | 240 +- library/itertools.po | 203 +- library/json.po | 331 +- library/locale.po | 88 +- library/logging.config.po | 105 +- library/logging.po | 241 +- library/lzma.po | 194 +- library/mailbox.po | 726 +-- library/marshal.po | 104 +- library/math.po | 250 +- library/mimetypes.po | 108 +- library/mmap.po | 152 +- library/msvcrt.po | 167 +- library/multiprocessing.po | 875 +-- library/multiprocessing.shared_memory.po | 170 +- library/optparse.po | 1020 ++-- library/os.path.po | 232 +- library/os.po | 2415 +++++---- library/pathlib.po | 1432 +++-- library/pdb.po | 351 +- library/pickle.po | 349 +- library/platform.po | 168 +- library/plistlib.po | 76 +- library/poplib.po | 10 +- library/profile.po | 220 +- library/pwd.po | 53 +- library/queue.po | 114 +- library/random.po | 323 +- library/re.po | 402 +- library/readline.po | 135 +- library/resource.po | 5 +- library/runpy.po | 47 +- library/secrets.po | 4 +- library/security_warnings.po | 33 +- library/select.po | 13 +- library/selectors.po | 10 +- library/shutil.po | 255 +- library/signal.po | 8 +- library/site.po | 124 +- library/smtplib.po | 10 +- library/socket.po | 651 +-- library/socketserver.po | 10 +- library/sqlite3.po | 868 +-- library/ssl.po | 1266 +++-- library/stat.po | 64 +- library/statistics.po | 715 +-- library/stdtypes.po | 1732 +++--- library/struct.po | 414 +- library/subprocess.po | 274 +- library/superseded.po | 8 +- library/symtable.po | 184 +- library/sys.monitoring.po | 135 +- library/sys.po | 962 ++-- library/sys_path_init.po | 9 +- library/sysconfig.po | 5 +- library/syslog.po | 54 +- library/tarfile.po | 447 +- library/test.po | 372 +- library/threading.po | 456 +- library/time.po | 476 +- library/tk.po | 9 +- library/tkinter.po | 509 +- library/tkinter.ttk.po | 145 +- library/token.po | 14 +- library/tomllib.po | 9 +- library/trace.po | 19 +- library/traceback.po | 188 +- library/turtle.po | 1229 ++--- library/types.po | 63 +- library/typing.po | 1821 ++++--- library/unicodedata.po | 12 +- library/unittest.mock-examples.po | 128 +- library/unittest.mock.po | 871 +-- library/unittest.po | 372 +- library/urllib.parse.po | 367 +- library/urllib.request.po | 624 +-- library/venv.po | 209 +- library/warnings.po | 75 +- library/wave.po | 60 +- library/webbrowser.po | 283 +- library/wsgiref.po | 26 +- library/xml.etree.elementtree.po | 299 +- library/xmlrpc.client.po | 13 +- library/xmlrpc.server.po | 10 +- library/zipfile.po | 417 +- library/zipimport.po | 68 +- library/zoneinfo.po | 10 +- license.po | 194 +- reference/compound_stmts.po | 176 +- reference/datamodel.po | 1222 +++-- reference/executionmodel.po | 92 +- reference/expressions.po | 880 +-- reference/grammar.po | 126 +- reference/introduction.po | 6 +- reference/lexical_analysis.po | 9 +- sphinx.po | 82 +- tutorial/appendix.po | 78 +- tutorial/interpreter.po | 28 +- tutorial/stdlib.po | 6 +- tutorial/stdlib2.po | 4 +- using/cmdline.po | 624 ++- using/configure.po | 1206 +++-- using/ios.po | 565 ++ using/mac.po | 50 +- using/windows.po | 618 ++- whatsnew/2.0.po | 10 +- whatsnew/2.3.po | 4 +- whatsnew/2.4.po | 31 +- whatsnew/2.5.po | 14 +- whatsnew/2.6.po | 23 +- whatsnew/2.7.po | 85 +- whatsnew/3.0.po | 7 +- whatsnew/3.1.po | 4 +- whatsnew/3.10.po | 7 +- whatsnew/3.11.po | 96 +- whatsnew/3.12.po | 1180 ++-- whatsnew/3.13.po | 4787 +++++++++++++++++ whatsnew/3.2.po | 16 +- whatsnew/3.3.po | 14 +- whatsnew/3.4.po | 991 ++-- whatsnew/3.5.po | 19 +- whatsnew/3.6.po | 20 +- whatsnew/3.7.po | 43 +- whatsnew/3.8.po | 10 +- whatsnew/3.9.po | 39 +- whatsnew/index.po | 4 +- 250 files changed, 42724 insertions(+), 28253 deletions(-) create mode 100644 c-api/monitoring.po create mode 100644 c-api/time.po create mode 100644 howto/free-threading-extensions.po create mode 100644 howto/timerfd.po create mode 100644 using/ios.po create mode 100644 whatsnew/3.13.po diff --git a/c-api/arg.po b/c-api/arg.po index df6661d53c..f62175c411 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-10-16 03:21+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -55,25 +55,33 @@ msgid "" "brackets is the type of the C variable(s) whose address should be passed." msgstr "" -#: ../../c-api/arg.rst:31 +#: ../../c-api/arg.rst:33 msgid "Strings and buffers" msgstr "" -#: ../../c-api/arg.rst:33 +#: ../../c-api/arg.rst:37 +msgid "" +"On Python 3.12 and older, the macro :c:macro:`!PY_SSIZE_T_CLEAN` must be " +"defined before including :file:`Python.h` to use all ``#`` variants of " +"formats (``s#``, ``y#``, etc.) explained below. This is not necessary on " +"Python 3.13 and later." +msgstr "" + +#: ../../c-api/arg.rst:42 msgid "" "These formats allow accessing an object as a contiguous chunk of memory. You " "don't have to provide raw storage for the returned unicode or bytes area." msgstr "" -#: ../../c-api/arg.rst:37 +#: ../../c-api/arg.rst:46 msgid "Unless otherwise stated, buffers are not NUL-terminated." msgstr "" -#: ../../c-api/arg.rst:39 +#: ../../c-api/arg.rst:48 msgid "There are three ways strings and buffers can be converted to C:" msgstr "" -#: ../../c-api/arg.rst:41 +#: ../../c-api/arg.rst:50 msgid "" "Formats such as ``y*`` and ``s*`` fill a :c:type:`Py_buffer` structure. This " "locks the underlying buffer so that the caller can subsequently use the " @@ -83,14 +91,14 @@ msgid "" "data (or in any early abort case)." msgstr "" -#: ../../c-api/arg.rst:48 +#: ../../c-api/arg.rst:57 msgid "" "The ``es``, ``es#``, ``et`` and ``et#`` formats allocate the result buffer. " "**You have to call** :c:func:`PyMem_Free` after you have finished processing " "the data (or in any early abort case)." msgstr "" -#: ../../c-api/arg.rst:54 +#: ../../c-api/arg.rst:63 msgid "" "Other formats take a :class:`str` or a read-only :term:`bytes-like object`, " "such as :class:`bytes`, and provide a ``const char *`` pointer to its " @@ -99,7 +107,7 @@ msgid "" "won't have to release any memory yourself." msgstr "" -#: ../../c-api/arg.rst:61 +#: ../../c-api/arg.rst:70 msgid "" "To ensure that the underlying buffer may be safely borrowed, the object's :c:" "member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. This " @@ -107,22 +115,13 @@ msgid "" "read-only objects such as :class:`memoryview` of :class:`bytes`." msgstr "" -#: ../../c-api/arg.rst:67 +#: ../../c-api/arg.rst:76 msgid "" "Besides this ``bf_releasebuffer`` requirement, there is no check to verify " "whether the input object is immutable (e.g. whether it would honor a request " "for a writable buffer, or whether another thread can mutate the data)." msgstr "" -#: ../../c-api/arg.rst:73 -msgid "" -"For all ``#`` variants of formats (``s#``, ``y#``, etc.), the macro :c:macro:" -"`PY_SSIZE_T_CLEAN` must be defined before including :file:`Python.h`. On " -"Python 3.9 and older, the type of the length argument is :c:type:" -"`Py_ssize_t` if the :c:macro:`PY_SSIZE_T_CLEAN` macro is defined, or int " -"otherwise." -msgstr "" - #: ../../c-api/arg.rst:80 msgid "``s`` (:class:`str`) [const char \\*]" msgstr "``s`` (:class:`str`) [const char \\*]" @@ -178,7 +177,7 @@ msgid "" "encoding." msgstr "" -#: ../../c-api/arg.rst:113 ../../c-api/arg.rst:546 +#: ../../c-api/arg.rst:113 ../../c-api/arg.rst:581 msgid "``z`` (:class:`str` or ``None``) [const char \\*]" msgstr "``z``\\ (:class:`str` 或 ``None``)[const char \\*]" @@ -427,7 +426,7 @@ msgid "" "c:expr:`unsigned char`." msgstr "" -#: ../../c-api/arg.rst:236 ../../c-api/arg.rst:580 +#: ../../c-api/arg.rst:236 ../../c-api/arg.rst:615 msgid "``B`` (:class:`int`) [unsigned char]" msgstr "``B`` (:class:`int`) [unsigned char]" @@ -437,7 +436,7 @@ msgid "" "a C :c:expr:`unsigned char`." msgstr "" -#: ../../c-api/arg.rst:240 ../../c-api/arg.rst:574 +#: ../../c-api/arg.rst:240 ../../c-api/arg.rst:609 msgid "``h`` (:class:`int`) [short int]" msgstr "``h`` (:class:`int`) [short int]" @@ -445,7 +444,7 @@ msgstr "``h`` (:class:`int`) [short int]" msgid "Convert a Python integer to a C :c:expr:`short int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`short int`。" -#: ../../c-api/arg.rst:243 ../../c-api/arg.rst:583 +#: ../../c-api/arg.rst:243 ../../c-api/arg.rst:618 msgid "``H`` (:class:`int`) [unsigned short int]" msgstr "``H`` (:class:`int`) [unsigned short int]" @@ -457,7 +456,7 @@ msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned short int`,轉換過程無溢位檢" "查。" -#: ../../c-api/arg.rst:247 ../../c-api/arg.rst:568 +#: ../../c-api/arg.rst:247 ../../c-api/arg.rst:603 msgid "``i`` (:class:`int`) [int]" msgstr "``i`` (:class:`int`) [int]" @@ -465,7 +464,7 @@ msgstr "``i`` (:class:`int`) [int]" msgid "Convert a Python integer to a plain C :c:expr:`int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`int`。" -#: ../../c-api/arg.rst:250 ../../c-api/arg.rst:586 +#: ../../c-api/arg.rst:250 ../../c-api/arg.rst:621 msgid "``I`` (:class:`int`) [unsigned int]" msgstr "``I`` (:class:`int`) [unsigned int]" @@ -476,7 +475,7 @@ msgid "" msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned int`,轉換過程無溢位檢查。" -#: ../../c-api/arg.rst:254 ../../c-api/arg.rst:577 +#: ../../c-api/arg.rst:254 ../../c-api/arg.rst:612 msgid "``l`` (:class:`int`) [long int]" msgstr "``l`` (:class:`int`) [long int]" @@ -484,7 +483,7 @@ msgstr "``l`` (:class:`int`) [long int]" msgid "Convert a Python integer to a C :c:expr:`long int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`long int`。" -#: ../../c-api/arg.rst:257 ../../c-api/arg.rst:589 +#: ../../c-api/arg.rst:257 ../../c-api/arg.rst:624 msgid "``k`` (:class:`int`) [unsigned long]" msgstr "``k`` (:class:`int`) [unsigned long]" @@ -495,7 +494,7 @@ msgid "" msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned long`,轉換過程無溢位檢查。" -#: ../../c-api/arg.rst:261 ../../c-api/arg.rst:592 +#: ../../c-api/arg.rst:261 ../../c-api/arg.rst:627 msgid "``L`` (:class:`int`) [long long]" msgstr "``L`` (:class:`int`) [long long]" @@ -503,7 +502,7 @@ msgstr "``L`` (:class:`int`) [long long]" msgid "Convert a Python integer to a C :c:expr:`long long`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`long long`。" -#: ../../c-api/arg.rst:264 ../../c-api/arg.rst:595 +#: ../../c-api/arg.rst:264 ../../c-api/arg.rst:630 msgid "``K`` (:class:`int`) [unsigned long long]" msgstr "``K`` (:class:`int`) [unsigned long long]" @@ -515,7 +514,7 @@ msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned long long`,轉換過程無溢位檢" "查。" -#: ../../c-api/arg.rst:268 ../../c-api/arg.rst:598 +#: ../../c-api/arg.rst:268 ../../c-api/arg.rst:633 msgid "``n`` (:class:`int`) [:c:type:`Py_ssize_t`]" msgstr "``n`` (:class:`int`) [:c:type:`Py_ssize_t`]" @@ -537,7 +536,7 @@ msgstr "" msgid "Allow :class:`bytearray` objects." msgstr "允許 :class:`bytearray` 物件。" -#: ../../c-api/arg.rst:278 ../../c-api/arg.rst:605 +#: ../../c-api/arg.rst:278 ../../c-api/arg.rst:640 msgid "``C`` (:class:`str` of length 1) [int]" msgstr "``C``\\ (長度為 1 的 :class:`str`)[int]" @@ -547,7 +546,7 @@ msgid "" "1, to a C :c:expr:`int`." msgstr "" -#: ../../c-api/arg.rst:282 ../../c-api/arg.rst:612 +#: ../../c-api/arg.rst:282 ../../c-api/arg.rst:647 msgid "``f`` (:class:`float`) [float]" msgstr "``f`` (:class:`float`) [float]" @@ -555,7 +554,7 @@ msgstr "``f`` (:class:`float`) [float]" msgid "Convert a Python floating-point number to a C :c:expr:`float`." msgstr "將一個 Python 浮點數轉換成 C 的 :c:type::c:expr:`float`。" -#: ../../c-api/arg.rst:285 ../../c-api/arg.rst:609 +#: ../../c-api/arg.rst:285 ../../c-api/arg.rst:644 msgid "``d`` (:class:`float`) [double]" msgstr "``d`` (:class:`float`) [double]" @@ -575,7 +574,7 @@ msgstr "將一個 Python 複數轉換成 C 的 :c:type:`Py_complex` 結構。" msgid "Other objects" msgstr "其他物件" -#: ../../c-api/arg.rst:294 ../../c-api/arg.rst:618 +#: ../../c-api/arg.rst:294 ../../c-api/arg.rst:653 msgid "``O`` (object) [PyObject \\*]" msgstr "``O``\\ (物件)[PyObject \\*]" @@ -600,7 +599,7 @@ msgid "" "required type, :exc:`TypeError` is raised." msgstr "" -#: ../../c-api/arg.rst:310 ../../c-api/arg.rst:636 +#: ../../c-api/arg.rst:310 ../../c-api/arg.rst:671 msgid "``O&`` (object) [*converter*, *anything*]" msgstr "``O&``\\ (物件)[*converter*, *anything*]" @@ -652,7 +651,7 @@ msgid "" "how Python tests values for truth." msgstr "" -#: ../../c-api/arg.rst:342 ../../c-api/arg.rst:642 +#: ../../c-api/arg.rst:342 ../../c-api/arg.rst:677 msgid "``(items)`` (:class:`tuple`) [*matching-items*]" msgstr "``(items)`` (:class:`tuple`) [*matching-items*]" @@ -772,43 +771,72 @@ msgstr "" #: ../../c-api/arg.rst:418 msgid "" "Parse the parameters of a function that takes both positional and keyword " -"parameters into local variables. The *keywords* argument is a ``NULL``-" -"terminated array of keyword parameter names. Empty names denote :ref:" -"`positional-only parameters `. Returns true on " -"success; on failure, it returns false and raises the appropriate exception." +"parameters into local variables. The *keywords* argument is a ``NULL``-" +"terminated array of keyword parameter names specified as null-terminated " +"ASCII or UTF-8 encoded C strings. Empty names denote :ref:`positional-only " +"parameters `. Returns true on success; on " +"failure, it returns false and raises the appropriate exception." +msgstr "" + +#: ../../c-api/arg.rst:429 +msgid "" +"The *keywords* parameter declaration is :c:expr:`char * const *` in C and :c:" +"expr:`const char * const *` in C++. This can be overridden with the :c:macro:" +"`PY_CXX_CONST` macro." msgstr "" -#: ../../c-api/arg.rst:425 +#: ../../c-api/arg.rst:433 msgid "" "Added support for :ref:`positional-only parameters `." msgstr "" -#: ../../c-api/arg.rst:432 +#: ../../c-api/arg.rst:437 +msgid "" +"The *keywords* parameter has now type :c:expr:`char * const *` in C and :c:" +"expr:`const char * const *` in C++, instead of :c:expr:`char **`. Added " +"support for non-ASCII keyword parameter names." +msgstr "" + +#: ../../c-api/arg.rst:446 msgid "" "Identical to :c:func:`PyArg_ParseTupleAndKeywords`, except that it accepts a " "va_list rather than a variable number of arguments." msgstr "" -#: ../../c-api/arg.rst:438 +#: ../../c-api/arg.rst:452 msgid "" "Ensure that the keys in the keywords argument dictionary are strings. This " "is only needed if :c:func:`PyArg_ParseTupleAndKeywords` is not used, since " "the latter already does this check." msgstr "" -#: ../../c-api/arg.rst:448 +#: ../../c-api/arg.rst:461 +msgid "" +"Parse the parameter of a function that takes a single positional parameter " +"into a local variable. Returns true on success; on failure, it returns " +"false and raises the appropriate exception." +msgstr "" + +#: ../../c-api/arg.rst:465 +msgid "Example::" +msgstr "" + +#: ../../c-api/arg.rst:467 msgid "" -"Function used to deconstruct the argument lists of \"old-style\" functions " -"--- these are functions which use the :const:`METH_OLDARGS` parameter " -"parsing method, which has been removed in Python 3. This is not recommended " -"for use in parameter parsing in new code, and most code in the standard " -"interpreter has been modified to no longer use this for that purpose. It " -"does remain a convenient way to decompose other tuples, however, and may " -"continue to be used for that purpose." +"// Function using METH_O calling convention\n" +"static PyObject*\n" +"my_function(PyObject *module, PyObject *arg)\n" +"{\n" +" int value;\n" +" if (!PyArg_Parse(arg, \"i:my_function\", &value)) {\n" +" return NULL;\n" +" }\n" +" // ... use value ...\n" +"}" msgstr "" -#: ../../c-api/arg.rst:459 +#: ../../c-api/arg.rst:481 msgid "" "A simpler form of parameter retrieval which does not use a format string to " "specify the types of the arguments. Functions which use this method to " @@ -826,13 +854,13 @@ msgid "" "if there was a failure." msgstr "" -#: ../../c-api/arg.rst:474 +#: ../../c-api/arg.rst:496 msgid "" "This is an example of the use of this function, taken from the sources for " "the :mod:`!_weakref` helper module for weak references::" msgstr "" -#: ../../c-api/arg.rst:477 +#: ../../c-api/arg.rst:499 msgid "" "static PyObject *\n" "weakref_ref(PyObject *self, PyObject *args)\n" @@ -860,21 +888,30 @@ msgstr "" " return result;\n" "}" -#: ../../c-api/arg.rst:490 +#: ../../c-api/arg.rst:512 msgid "" "The call to :c:func:`PyArg_UnpackTuple` in this example is entirely " "equivalent to this call to :c:func:`PyArg_ParseTuple`::" msgstr "" -#: ../../c-api/arg.rst:493 +#: ../../c-api/arg.rst:515 msgid "PyArg_ParseTuple(args, \"O|O:ref\", &object, &callback)" msgstr "PyArg_ParseTuple(args, \"O|O:ref\", &object, &callback)" -#: ../../c-api/arg.rst:498 +#: ../../c-api/arg.rst:519 +msgid "" +"The value to be inserted, if any, before :c:expr:`char * const *` in the " +"*keywords* parameter declaration of :c:func:`PyArg_ParseTupleAndKeywords` " +"and :c:func:`PyArg_VaParseTupleAndKeywords`. Default empty for C and " +"``const`` for C++ (:c:expr:`const char * const *`). To override, define it " +"to the desired value before including :file:`Python.h`." +msgstr "" + +#: ../../c-api/arg.rst:533 msgid "Building values" msgstr "" -#: ../../c-api/arg.rst:502 +#: ../../c-api/arg.rst:537 msgid "" "Create a new value based on a format string similar to those accepted by the " "``PyArg_Parse*`` family of functions and a sequence of values. Returns the " @@ -882,7 +919,7 @@ msgid "" "``NULL`` is returned." msgstr "" -#: ../../c-api/arg.rst:507 +#: ../../c-api/arg.rst:542 msgid "" ":c:func:`Py_BuildValue` does not always build a tuple. It builds a tuple " "only if its format string contains two or more format units. If the format " @@ -891,7 +928,7 @@ msgid "" "it to return a tuple of size 0 or one, parenthesize the format string." msgstr "" -#: ../../c-api/arg.rst:513 +#: ../../c-api/arg.rst:548 msgid "" "When memory buffers are passed as parameters to supply data to build " "objects, as for the ``s`` and ``s#`` formats, the required data is copied. " @@ -902,7 +939,7 @@ msgid "" "`Py_BuildValue` returns." msgstr "" -#: ../../c-api/arg.rst:521 +#: ../../c-api/arg.rst:556 msgid "" "In the following description, the quoted form is the format unit; the entry " "in (round) parentheses is the Python object type that the format unit will " @@ -910,155 +947,155 @@ msgid "" "be passed." msgstr "" -#: ../../c-api/arg.rst:525 +#: ../../c-api/arg.rst:560 msgid "" "The characters space, tab, colon and comma are ignored in format strings " "(but not within format units such as ``s#``). This can be used to make long " "format strings a tad more readable." msgstr "" -#: ../../c-api/arg.rst:529 +#: ../../c-api/arg.rst:564 msgid "``s`` (:class:`str` or ``None``) [const char \\*]" msgstr "``s``\\ (:class:`str` 或 ``None``)[const char \\*]" -#: ../../c-api/arg.rst:530 +#: ../../c-api/arg.rst:565 msgid "" "Convert a null-terminated C string to a Python :class:`str` object using " "``'utf-8'`` encoding. If the C string pointer is ``NULL``, ``None`` is used." msgstr "" -#: ../../c-api/arg.rst:533 +#: ../../c-api/arg.rst:568 msgid "" "``s#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" "``s#``\\ (:class:`str` 或 ``None``)[const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:534 +#: ../../c-api/arg.rst:569 msgid "" "Convert a C string and its length to a Python :class:`str` object using " "``'utf-8'`` encoding. If the C string pointer is ``NULL``, the length is " "ignored and ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:538 +#: ../../c-api/arg.rst:573 msgid "``y`` (:class:`bytes`) [const char \\*]" msgstr "``y`` (:class:`bytes`) [const char \\*]" -#: ../../c-api/arg.rst:539 +#: ../../c-api/arg.rst:574 msgid "" "This converts a C string to a Python :class:`bytes` object. If the C string " "pointer is ``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:542 +#: ../../c-api/arg.rst:577 msgid "``y#`` (:class:`bytes`) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "``y#`` (:class:`bytes`) [const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:543 +#: ../../c-api/arg.rst:578 msgid "" "This converts a C string and its lengths to a Python object. If the C " "string pointer is ``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:547 ../../c-api/arg.rst:563 +#: ../../c-api/arg.rst:582 ../../c-api/arg.rst:598 msgid "Same as ``s``." msgstr "和 ``s`` 相同。" -#: ../../c-api/arg.rst:549 +#: ../../c-api/arg.rst:584 msgid "" "``z#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" "``z#``\\ (:class:`str` 或 ``None``)[const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:550 ../../c-api/arg.rst:566 +#: ../../c-api/arg.rst:585 ../../c-api/arg.rst:601 msgid "Same as ``s#``." msgstr "和 ``s#`` 相同。" -#: ../../c-api/arg.rst:552 +#: ../../c-api/arg.rst:587 msgid "``u`` (:class:`str`) [const wchar_t \\*]" msgstr "``u`` (:class:`str`) [const wchar_t \\*]" -#: ../../c-api/arg.rst:553 +#: ../../c-api/arg.rst:588 msgid "" "Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or " "UCS-4) data to a Python Unicode object. If the Unicode buffer pointer is " "``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:557 +#: ../../c-api/arg.rst:592 msgid "``u#`` (:class:`str`) [const wchar_t \\*, :c:type:`Py_ssize_t`]" msgstr "``u#`` (:class:`str`) [const wchar_t \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:558 +#: ../../c-api/arg.rst:593 msgid "" "Convert a Unicode (UTF-16 or UCS-4) data buffer and its length to a Python " "Unicode object. If the Unicode buffer pointer is ``NULL``, the length is " "ignored and ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:562 +#: ../../c-api/arg.rst:597 msgid "``U`` (:class:`str` or ``None``) [const char \\*]" msgstr "``U``\\ (:class:`str` 或 ``None``)[const char \\*]" -#: ../../c-api/arg.rst:565 +#: ../../c-api/arg.rst:600 msgid "" "``U#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" "``U#``\\ (:class:`str` 或 ``None``)[const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:569 +#: ../../c-api/arg.rst:604 msgid "Convert a plain C :c:expr:`int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:571 +#: ../../c-api/arg.rst:606 msgid "``b`` (:class:`int`) [char]" msgstr "``b`` (:class:`int`) [char]" -#: ../../c-api/arg.rst:572 +#: ../../c-api/arg.rst:607 msgid "Convert a plain C :c:expr:`char` to a Python integer object." msgstr "將一個 C 的 :c:expr:`char` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:575 +#: ../../c-api/arg.rst:610 msgid "Convert a plain C :c:expr:`short int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`short int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:578 +#: ../../c-api/arg.rst:613 msgid "Convert a C :c:expr:`long int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`long int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:581 +#: ../../c-api/arg.rst:616 msgid "Convert a C :c:expr:`unsigned char` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned char` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:584 +#: ../../c-api/arg.rst:619 msgid "Convert a C :c:expr:`unsigned short int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned short int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:587 +#: ../../c-api/arg.rst:622 msgid "Convert a C :c:expr:`unsigned int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:590 +#: ../../c-api/arg.rst:625 msgid "Convert a C :c:expr:`unsigned long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:593 +#: ../../c-api/arg.rst:628 msgid "Convert a C :c:expr:`long long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`long long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:596 +#: ../../c-api/arg.rst:631 msgid "Convert a C :c:expr:`unsigned long long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned long long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:599 +#: ../../c-api/arg.rst:634 msgid "Convert a C :c:type:`Py_ssize_t` to a Python integer." msgstr "將一個 C 的 :c:type:`Py_ssize_t` 轉換成 Python 整數。" -#: ../../c-api/arg.rst:601 +#: ../../c-api/arg.rst:636 msgid "``c`` (:class:`bytes` of length 1) [char]" msgstr "``c``\\ (長度為 1 的 :class:`bytes`)[char]" -#: ../../c-api/arg.rst:602 +#: ../../c-api/arg.rst:637 msgid "" "Convert a C :c:expr:`int` representing a byte to a Python :class:`bytes` " "object of length 1." @@ -1066,7 +1103,7 @@ msgstr "" "將一個 C 中代表一個位元組的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" "`bytes`。" -#: ../../c-api/arg.rst:606 +#: ../../c-api/arg.rst:641 msgid "" "Convert a C :c:expr:`int` representing a character to Python :class:`str` " "object of length 1." @@ -1074,23 +1111,23 @@ msgstr "" "將一個 C 中代表一個字元的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" "`str`。" -#: ../../c-api/arg.rst:610 +#: ../../c-api/arg.rst:645 msgid "Convert a C :c:expr:`double` to a Python floating-point number." msgstr "將一個 C 的 :c:expr:`double` 轉換成 Python 浮點數。" -#: ../../c-api/arg.rst:613 +#: ../../c-api/arg.rst:648 msgid "Convert a C :c:expr:`float` to a Python floating-point number." msgstr "將一個 C 的 :c:expr:`float` 轉換成 Python 浮點數。" -#: ../../c-api/arg.rst:615 +#: ../../c-api/arg.rst:650 msgid "``D`` (:class:`complex`) [Py_complex \\*]" msgstr "``D`` (:class:`complex`) [Py_complex \\*]" -#: ../../c-api/arg.rst:616 +#: ../../c-api/arg.rst:651 msgid "Convert a C :c:type:`Py_complex` structure to a Python complex number." msgstr "將一個 C 的 :c:type:`Py_complex` 結構轉換成 Python 複數。" -#: ../../c-api/arg.rst:619 +#: ../../c-api/arg.rst:654 msgid "" "Pass a Python object untouched but create a new :term:`strong reference` to " "it (i.e. its reference count is incremented by one). If the object passed in " @@ -1100,26 +1137,26 @@ msgid "" "no exception has been raised yet, :exc:`SystemError` is set." msgstr "" -#: ../../c-api/arg.rst:628 +#: ../../c-api/arg.rst:663 msgid "``S`` (object) [PyObject \\*]" msgstr "``S``\\ (物件)[PyObject \\*]" -#: ../../c-api/arg.rst:629 +#: ../../c-api/arg.rst:664 msgid "Same as ``O``." msgstr "和 ``O`` 相同。" -#: ../../c-api/arg.rst:631 +#: ../../c-api/arg.rst:666 msgid "``N`` (object) [PyObject \\*]" msgstr "``N``\\ (物件)[PyObject \\*]" -#: ../../c-api/arg.rst:632 +#: ../../c-api/arg.rst:667 msgid "" "Same as ``O``, except it doesn't create a new :term:`strong reference`. " "Useful when the object is created by a call to an object constructor in the " "argument list." msgstr "" -#: ../../c-api/arg.rst:637 +#: ../../c-api/arg.rst:672 msgid "" "Convert *anything* to a Python object through a *converter* function. The " "function is called with *anything* (which should be compatible with :c:expr:" @@ -1127,40 +1164,40 @@ msgid "" "``NULL`` if an error occurred." msgstr "" -#: ../../c-api/arg.rst:643 +#: ../../c-api/arg.rst:678 msgid "" "Convert a sequence of C values to a Python tuple with the same number of " "items." msgstr "" -#: ../../c-api/arg.rst:645 +#: ../../c-api/arg.rst:680 msgid "``[items]`` (:class:`list`) [*matching-items*]" msgstr "``[items]`` (:class:`list`) [*matching-items*]" -#: ../../c-api/arg.rst:646 +#: ../../c-api/arg.rst:681 msgid "" "Convert a sequence of C values to a Python list with the same number of " "items." msgstr "" -#: ../../c-api/arg.rst:648 +#: ../../c-api/arg.rst:683 msgid "``{items}`` (:class:`dict`) [*matching-items*]" msgstr "``{items}`` (:class:`dict`) [*matching-items*]" -#: ../../c-api/arg.rst:649 +#: ../../c-api/arg.rst:684 msgid "" "Convert a sequence of C values to a Python dictionary. Each pair of " "consecutive C values adds one item to the dictionary, serving as key and " "value, respectively." msgstr "" -#: ../../c-api/arg.rst:653 +#: ../../c-api/arg.rst:688 msgid "" "If there is an error in the format string, the :exc:`SystemError` exception " "is set and ``NULL`` returned." msgstr "" -#: ../../c-api/arg.rst:658 +#: ../../c-api/arg.rst:693 msgid "" "Identical to :c:func:`Py_BuildValue`, except that it accepts a va_list " "rather than a variable number of arguments." diff --git a/c-api/bool.po b/c-api/bool.po index f2308a6333..9a057a6678 100644 --- a/c-api/bool.po +++ b/c-api/bool.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-29 10:36+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-12-09 20:47+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -52,27 +52,26 @@ msgstr "" #: ../../c-api/bool.rst:28 msgid "" -"The Python ``False`` object. This object has no methods and is `immortal " -"`_." +"The Python ``False`` object. This object has no methods and is :term:" +"`immortal`." msgstr "" -"Python 的 ``False`` 物件。此物件沒有任何方法且為\\ `不滅的 (immortal) " -"`_。" +"Python 的 ``False`` 物件。此物件沒有任何方法且為\\ :term:`不滅的 (immortal) " +"`。" #: ../../c-api/bool.rst:31 -msgid ":c:data:`Py_False` is immortal." -msgstr ":c:data:`Py_False` 為不滅的。" +msgid ":c:data:`Py_False` is :term:`immortal`." +msgstr ":c:data:`Py_False` 為\\ :term:`不滅的 `。" #: ../../c-api/bool.rst:37 msgid "" -"The Python ``True`` object. This object has no methods and is `immortal " -"`_." +"The Python ``True`` object. This object has no methods and is :term:" +"`immortal`." msgstr "" -"Python 的 ``True`` 物件。此物件沒有任何方法且為\\ `不滅的 (immortal) " -"`_。" +"Python 的 ``True`` 物件。此物件沒有任何方法且為\\ :term:`不滅的 `。" #: ../../c-api/bool.rst:40 -msgid ":c:data:`Py_True` is immortal." -msgstr ":c:data:`Py_True` 為不滅的。" +msgid ":c:data:`Py_True` is :term:`immortal`." +msgstr ":c:data:`Py_True` 為\\ :term:`不滅的 `。" #: ../../c-api/bool.rst:46 msgid "Return :c:data:`Py_False` from a function." diff --git a/c-api/bytes.po b/c-api/bytes.po index 01f9c4fc17..4cb4ac8545 100644 --- a/c-api/bytes.po +++ b/c-api/bytes.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-12-26 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -316,16 +316,14 @@ msgstr "" #: ../../c-api/bytes.rst:194 msgid "" -"A way to resize a bytes object even though it is \"immutable\". Only use " -"this to build up a brand new bytes object; don't use this if the bytes may " -"already be known in other parts of the code. It is an error to call this " -"function if the refcount on the input bytes object is not one. Pass the " -"address of an existing bytes object as an lvalue (it may be written into), " -"and the new size desired. On success, *\\*bytes* holds the resized bytes " -"object and ``0`` is returned; the address in *\\*bytes* may differ from its " -"input value. If the reallocation fails, the original bytes object at " -"*\\*bytes* is deallocated, *\\*bytes* is set to ``NULL``, :exc:`MemoryError` " -"is set, and ``-1`` is returned." +"Resize a bytes object. *newsize* will be the new length of the bytes object. " +"You can think of it as creating a new bytes object and destroying the old " +"one, only more efficiently. Pass the address of an existing bytes object as " +"an lvalue (it may be written into), and the new size desired. On success, " +"*\\*bytes* holds the resized bytes object and ``0`` is returned; the address " +"in *\\*bytes* may differ from its input value. If the reallocation fails, " +"the original bytes object at *\\*bytes* is deallocated, *\\*bytes* is set to " +"``NULL``, :exc:`MemoryError` is set, and ``-1`` is returned." msgstr "" #: ../../c-api/bytes.rst:11 diff --git a/c-api/call.po b/c-api/call.po index 114ae44a44..4f635027c2 100644 --- a/c-api/call.po +++ b/c-api/call.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-10-16 03:20+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -227,30 +227,11 @@ msgstr "" "要呼叫一個實作了 vectorcall 的物件,請就像其他可呼叫物件一樣使用\\ :ref:`呼" "叫 API` 中的函式。:c:func:`PyObject_Vectorcall` 通常是最有效率的。" -#: ../../c-api/call.rst:120 -msgid "" -"In CPython 3.8, the vectorcall API and related functions were available " -"provisionally under names with a leading underscore: " -"``_PyObject_Vectorcall``, ``_Py_TPFLAGS_HAVE_VECTORCALL``, " -"``_PyObject_VectorcallMethod``, ``_PyVectorcall_Function``, " -"``_PyObject_CallOneArg``, ``_PyObject_CallMethodNoArgs``, " -"``_PyObject_CallMethodOneArg``. Additionally, ``PyObject_VectorcallDict`` " -"was available as ``_PyObject_FastCallDict``. The old names are still defined " -"as aliases of the new, non-underscored names." -msgstr "" -"在 CPython 3.8 中,vectorcall API 和相關函式暫定以帶開頭底線的名稱提供:" -"``_PyObject_Vectorcall``、``_Py_TPFLAGS_HAVE_VECTORCALL``、" -"``_PyObject_VectorcallMethod``、``_PyVectorcall_Function``、" -"``_PyObject_CallOneArg``、``_PyObject_CallMethodNoArgs``、" -"``_PyObject_CallMethodOneArg``。此外,``PyObject_VectorcallDict`` 也以 " -"``_PyObject_FastCallDict`` 名稱提供。這些舊名稱仍有被定義,做為不帶底線的新名" -"稱的別名。" - -#: ../../c-api/call.rst:132 +#: ../../c-api/call.rst:119 msgid "Recursion Control" msgstr "遞迴控制" -#: ../../c-api/call.rst:134 +#: ../../c-api/call.rst:121 msgid "" "When using *tp_call*, callees do not need to worry about :ref:`recursion " "`: CPython uses :c:func:`Py_EnterRecursiveCall` and :c:func:" @@ -260,7 +241,7 @@ msgstr "" "使用 *tp_call* 的呼叫會使用 :c:func:`Py_EnterRecursiveCall` 和 :c:func:" "`Py_LeaveRecursiveCall`。" -#: ../../c-api/call.rst:139 +#: ../../c-api/call.rst:126 msgid "" "For efficiency, this is not the case for calls done using vectorcall: the " "callee should use *Py_EnterRecursiveCall* and *Py_LeaveRecursiveCall* if " @@ -269,27 +250,27 @@ msgstr "" "為保證效率,這不適用於使用 vectorcall 的呼叫:被呼叫方在需要時應當使用 " "*Py_EnterRecursiveCall* 和 *Py_LeaveRecursiveCall*。" -#: ../../c-api/call.rst:145 +#: ../../c-api/call.rst:132 msgid "Vectorcall Support API" msgstr "Vectorcall 支援 API" -#: ../../c-api/call.rst:149 +#: ../../c-api/call.rst:136 msgid "" "Given a vectorcall *nargsf* argument, return the actual number of arguments. " "Currently equivalent to::" msgstr "給定一個 vectorcall *nargsf* 引數,回傳引數的實際數量。目前等同於: ::" -#: ../../c-api/call.rst:153 +#: ../../c-api/call.rst:140 msgid "(Py_ssize_t)(nargsf & ~PY_VECTORCALL_ARGUMENTS_OFFSET)" msgstr "(Py_ssize_t)(nargsf & ~PY_VECTORCALL_ARGUMENTS_OFFSET)" -#: ../../c-api/call.rst:155 +#: ../../c-api/call.rst:142 msgid "" "However, the function ``PyVectorcall_NARGS`` should be used to allow for " "future extensions." msgstr "然而,應使用 ``PyVectorcall_NARGS`` 函式以便將來需要擴充。" -#: ../../c-api/call.rst:162 +#: ../../c-api/call.rst:149 msgid "" "If *op* does not support the vectorcall protocol (either because the type " "does not or because the specific instance does not), return *NULL*. " @@ -300,7 +281,7 @@ msgstr "" "*NULL*。否則,回傳儲存在 *op* 中的 vectorcall 函式指標。這個函式不會引發例" "外。" -#: ../../c-api/call.rst:167 +#: ../../c-api/call.rst:154 msgid "" "This is mostly useful to check whether or not *op* supports vectorcall, " "which can be done by checking ``PyVectorcall_Function(op) != NULL``." @@ -308,7 +289,7 @@ msgstr "" "這大多在檢查 *op* 是否支援 vectorcall 時能派上用場,可以透過檢查 " "``PyVectorcall_Function(op) != NULL`` 來達成。" -#: ../../c-api/call.rst:174 +#: ../../c-api/call.rst:161 msgid "" "Call *callable*'s :c:type:`vectorcallfunc` with positional and keyword " "arguments given in a tuple and dict, respectively." @@ -316,7 +297,7 @@ msgstr "" "呼叫 *callable* 的 :c:type:`vectorcallfunc`,其位置引數和關鍵字引數分別以 " "tuple 和 dict 格式給定。" -#: ../../c-api/call.rst:177 +#: ../../c-api/call.rst:164 msgid "" "This is a specialized function, intended to be put in the :c:member:" "`~PyTypeObject.tp_call` slot or be used in an implementation of ``tp_call``. " @@ -327,11 +308,11 @@ msgstr "" "用於 ``tp_call`` 的實作。它不會檢查 :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` 旗" "標並且它不會退回 (fall back) 使用 ``tp_call``。" -#: ../../c-api/call.rst:188 +#: ../../c-api/call.rst:175 msgid "Object Calling API" msgstr "物件呼叫 API" -#: ../../c-api/call.rst:190 +#: ../../c-api/call.rst:177 msgid "" "Various functions are available for calling a Python object. Each converts " "its arguments to a convention supported by the called object – either " @@ -342,133 +323,133 @@ msgstr "" "的慣用形式 – 可以是 *tp_call* 或 vectorcall。為了儘可能減少轉換的進行,請選擇" "一個適合你所擁有資料格式的函式。" -#: ../../c-api/call.rst:196 +#: ../../c-api/call.rst:183 msgid "" "The following table summarizes the available functions; please see " "individual documentation for details." msgstr "下表總結了可用的函式;請參閱各個說明文件以瞭解詳情。" -#: ../../c-api/call.rst:200 +#: ../../c-api/call.rst:187 msgid "Function" msgstr "函式" -#: ../../c-api/call.rst:200 +#: ../../c-api/call.rst:187 msgid "callable" msgstr "callable" -#: ../../c-api/call.rst:200 +#: ../../c-api/call.rst:187 msgid "args" msgstr "args" -#: ../../c-api/call.rst:200 +#: ../../c-api/call.rst:187 msgid "kwargs" msgstr "kwargs" -#: ../../c-api/call.rst:202 +#: ../../c-api/call.rst:189 msgid ":c:func:`PyObject_Call`" msgstr ":c:func:`PyObject_Call`" -#: ../../c-api/call.rst:202 ../../c-api/call.rst:204 ../../c-api/call.rst:206 -#: ../../c-api/call.rst:208 ../../c-api/call.rst:210 ../../c-api/call.rst:214 -#: ../../c-api/call.rst:222 ../../c-api/call.rst:224 +#: ../../c-api/call.rst:189 ../../c-api/call.rst:191 ../../c-api/call.rst:193 +#: ../../c-api/call.rst:195 ../../c-api/call.rst:197 ../../c-api/call.rst:201 +#: ../../c-api/call.rst:209 ../../c-api/call.rst:211 msgid "``PyObject *``" msgstr "``PyObject *``" -#: ../../c-api/call.rst:202 +#: ../../c-api/call.rst:189 msgid "tuple" msgstr "tuple" -#: ../../c-api/call.rst:202 ../../c-api/call.rst:224 +#: ../../c-api/call.rst:189 ../../c-api/call.rst:211 msgid "dict/``NULL``" msgstr "dict/``NULL``" -#: ../../c-api/call.rst:204 +#: ../../c-api/call.rst:191 msgid ":c:func:`PyObject_CallNoArgs`" msgstr ":c:func:`PyObject_CallNoArgs`" -#: ../../c-api/call.rst:204 ../../c-api/call.rst:206 ../../c-api/call.rst:208 -#: ../../c-api/call.rst:210 ../../c-api/call.rst:212 ../../c-api/call.rst:214 -#: ../../c-api/call.rst:216 ../../c-api/call.rst:218 ../../c-api/call.rst:220 +#: ../../c-api/call.rst:191 ../../c-api/call.rst:193 ../../c-api/call.rst:195 +#: ../../c-api/call.rst:197 ../../c-api/call.rst:199 ../../c-api/call.rst:201 +#: ../../c-api/call.rst:203 ../../c-api/call.rst:205 ../../c-api/call.rst:207 msgid "---" msgstr "---" -#: ../../c-api/call.rst:206 +#: ../../c-api/call.rst:193 msgid ":c:func:`PyObject_CallOneArg`" msgstr ":c:func:`PyObject_CallOneArg`" -#: ../../c-api/call.rst:206 ../../c-api/call.rst:220 +#: ../../c-api/call.rst:193 ../../c-api/call.rst:207 msgid "1 object" msgstr "一個物件" -#: ../../c-api/call.rst:208 +#: ../../c-api/call.rst:195 msgid ":c:func:`PyObject_CallObject`" msgstr ":c:func:`PyObject_CallObject`" -#: ../../c-api/call.rst:208 +#: ../../c-api/call.rst:195 msgid "tuple/``NULL``" msgstr "tuple/``NULL``" -#: ../../c-api/call.rst:210 +#: ../../c-api/call.rst:197 msgid ":c:func:`PyObject_CallFunction`" msgstr ":c:func:`PyObject_CallFunction`" -#: ../../c-api/call.rst:210 ../../c-api/call.rst:212 +#: ../../c-api/call.rst:197 ../../c-api/call.rst:199 msgid "format" msgstr "format" -#: ../../c-api/call.rst:212 +#: ../../c-api/call.rst:199 msgid ":c:func:`PyObject_CallMethod`" msgstr ":c:func:`PyObject_CallMethod`" -#: ../../c-api/call.rst:212 +#: ../../c-api/call.rst:199 msgid "obj + ``char*``" msgstr "物件 + ``char*``" -#: ../../c-api/call.rst:214 +#: ../../c-api/call.rst:201 msgid ":c:func:`PyObject_CallFunctionObjArgs`" msgstr ":c:func:`PyObject_CallFunctionObjArgs`" -#: ../../c-api/call.rst:214 ../../c-api/call.rst:216 +#: ../../c-api/call.rst:201 ../../c-api/call.rst:203 msgid "variadic" msgstr "可變引數" -#: ../../c-api/call.rst:216 +#: ../../c-api/call.rst:203 msgid ":c:func:`PyObject_CallMethodObjArgs`" msgstr ":c:func:`PyObject_CallMethodObjArgs`" -#: ../../c-api/call.rst:216 ../../c-api/call.rst:218 ../../c-api/call.rst:220 +#: ../../c-api/call.rst:203 ../../c-api/call.rst:205 ../../c-api/call.rst:207 msgid "obj + name" msgstr "物件 + 名稱" -#: ../../c-api/call.rst:218 +#: ../../c-api/call.rst:205 msgid ":c:func:`PyObject_CallMethodNoArgs`" msgstr ":c:func:`PyObject_CallMethodNoArgs`" -#: ../../c-api/call.rst:220 +#: ../../c-api/call.rst:207 msgid ":c:func:`PyObject_CallMethodOneArg`" msgstr ":c:func:`PyObject_CallMethodOneArg`" -#: ../../c-api/call.rst:222 +#: ../../c-api/call.rst:209 msgid ":c:func:`PyObject_Vectorcall`" msgstr ":c:func:`PyObject_Vectorcall`" -#: ../../c-api/call.rst:222 ../../c-api/call.rst:224 ../../c-api/call.rst:226 +#: ../../c-api/call.rst:209 ../../c-api/call.rst:211 ../../c-api/call.rst:213 msgid "vectorcall" msgstr "vectorcall" -#: ../../c-api/call.rst:224 +#: ../../c-api/call.rst:211 msgid ":c:func:`PyObject_VectorcallDict`" msgstr ":c:func:`PyObject_VectorcallDict`" -#: ../../c-api/call.rst:226 +#: ../../c-api/call.rst:213 msgid ":c:func:`PyObject_VectorcallMethod`" msgstr ":c:func:`PyObject_VectorcallMethod`" -#: ../../c-api/call.rst:226 +#: ../../c-api/call.rst:213 msgid "arg + name" msgstr "引數 + 名稱" -#: ../../c-api/call.rst:232 +#: ../../c-api/call.rst:219 msgid "" "Call a callable Python object *callable*, with arguments given by the tuple " "*args*, and named arguments given by the dictionary *kwargs*." @@ -476,7 +457,7 @@ msgstr "" "呼叫一個可呼叫的 Python 物件 *callable*,附帶由 tuple *args* 所給定的引數及由" "字典 *kwargs* 所給定的關鍵字引數。" -#: ../../c-api/call.rst:235 +#: ../../c-api/call.rst:222 msgid "" "*args* must not be *NULL*; use an empty tuple if no arguments are needed. If " "no named arguments are needed, *kwargs* can be *NULL*." @@ -484,22 +465,22 @@ msgstr "" "*args* 必須不為 *NULL*;如果不需要引數,請使用一個空 tuple。如果不需要關鍵字" "引數,則 *kwargs* 可以為 *NULL*。" -#: ../../c-api/call.rst:238 ../../c-api/call.rst:250 ../../c-api/call.rst:261 -#: ../../c-api/call.rst:272 ../../c-api/call.rst:284 ../../c-api/call.rst:304 -#: ../../c-api/call.rst:323 ../../c-api/call.rst:337 ../../c-api/call.rst:346 -#: ../../c-api/call.rst:358 ../../c-api/call.rst:371 ../../c-api/call.rst:405 +#: ../../c-api/call.rst:225 ../../c-api/call.rst:237 ../../c-api/call.rst:248 +#: ../../c-api/call.rst:259 ../../c-api/call.rst:271 ../../c-api/call.rst:291 +#: ../../c-api/call.rst:310 ../../c-api/call.rst:324 ../../c-api/call.rst:333 +#: ../../c-api/call.rst:345 ../../c-api/call.rst:358 ../../c-api/call.rst:392 msgid "" "Return the result of the call on success, or raise an exception and return " "*NULL* on failure." msgstr "成功時回傳結果,或在失敗時引發一個例外並回傳 *NULL*。" -#: ../../c-api/call.rst:241 +#: ../../c-api/call.rst:228 msgid "" "This is the equivalent of the Python expression: ``callable(*args, " "**kwargs)``." msgstr "這等價於 Python 運算式 ``callable(*args, **kwargs)``。" -#: ../../c-api/call.rst:247 +#: ../../c-api/call.rst:234 msgid "" "Call a callable Python object *callable* without any arguments. It is the " "most efficient way to call a callable Python object without any argument." @@ -507,7 +488,7 @@ msgstr "" "呼叫一個可呼叫的 Python 物件 *callable* 並不附帶任何引數。這是不帶引數呼叫 " "Python 可呼叫物件的最有效方式。" -#: ../../c-api/call.rst:258 +#: ../../c-api/call.rst:245 msgid "" "Call a callable Python object *callable* with exactly 1 positional argument " "*arg* and no keyword arguments." @@ -515,7 +496,7 @@ msgstr "" "呼叫一個可呼叫的 Python 物件 *callable* 並附帶正好一個位置引數 *arg* 而沒有關" "鍵字引數。" -#: ../../c-api/call.rst:269 +#: ../../c-api/call.rst:256 msgid "" "Call a callable Python object *callable*, with arguments given by the tuple " "*args*. If no arguments are needed, then *args* can be *NULL*." @@ -523,11 +504,11 @@ msgstr "" "呼叫一個可呼叫的 Python 物件 *callable*,附帶由 tuple *args* 所給定的引數。如" "果不需要傳入引數,則 *args* 可以為 *NULL*。" -#: ../../c-api/call.rst:275 ../../c-api/call.rst:287 +#: ../../c-api/call.rst:262 ../../c-api/call.rst:274 msgid "This is the equivalent of the Python expression: ``callable(*args)``." msgstr "這等價於 Python 運算式 ``callable(*args)``。" -#: ../../c-api/call.rst:280 +#: ../../c-api/call.rst:267 msgid "" "Call a callable Python object *callable*, with a variable number of C " "arguments. The C arguments are described using a :c:func:`Py_BuildValue` " @@ -538,7 +519,7 @@ msgstr "" "用 :c:func:`Py_BuildValue` 風格的格式字串來描述。格式可以為 *NULL*,表示沒有" "提供任何引數。" -#: ../../c-api/call.rst:289 +#: ../../c-api/call.rst:276 msgid "" "Note that if you only pass :c:expr:`PyObject *` args, :c:func:" "`PyObject_CallFunctionObjArgs` is a faster alternative." @@ -546,11 +527,11 @@ msgstr "" "注意,如果你只傳入 :c:expr:`PyObject *` 引數,則 :c:func:" "`PyObject_CallFunctionObjArgs` 是另一個更快速的選擇。" -#: ../../c-api/call.rst:292 +#: ../../c-api/call.rst:279 msgid "The type of *format* was changed from ``char *``." msgstr "這個 *format* 的型別已從 ``char *`` 更改。" -#: ../../c-api/call.rst:298 +#: ../../c-api/call.rst:285 msgid "" "Call the method named *name* of object *obj* with a variable number of C " "arguments. The C arguments are described by a :c:func:`Py_BuildValue` " @@ -559,17 +540,17 @@ msgstr "" "呼叫 *obj* 物件中名為 *name* 的 method 並附帶數量可變的 C 引數。這些 C 引數" "由 :c:func:`Py_BuildValue` 格式字串來描述,並應當生成一個 tuple。" -#: ../../c-api/call.rst:302 +#: ../../c-api/call.rst:289 msgid "The format can be *NULL*, indicating that no arguments are provided." msgstr "格式可以為 *NULL*,表示沒有提供任何引數。" -#: ../../c-api/call.rst:307 +#: ../../c-api/call.rst:294 msgid "" "This is the equivalent of the Python expression: ``obj.name(arg1, " "arg2, ...)``." msgstr "這等價於 Python 運算式 ``obj.name(arg1, arg2, ...)``。" -#: ../../c-api/call.rst:310 +#: ../../c-api/call.rst:297 msgid "" "Note that if you only pass :c:expr:`PyObject *` args, :c:func:" "`PyObject_CallMethodObjArgs` is a faster alternative." @@ -577,11 +558,11 @@ msgstr "" "注意,如果你只傳入 :c:expr:`PyObject *` 引數,則 :c:func:" "`PyObject_CallMethodObjArgs` 是另一個更快速的選擇。" -#: ../../c-api/call.rst:313 +#: ../../c-api/call.rst:300 msgid "The types of *name* and *format* were changed from ``char *``." msgstr "*name* 和 *format* 的型別已從 ``char *`` 更改。" -#: ../../c-api/call.rst:319 +#: ../../c-api/call.rst:306 msgid "" "Call a callable Python object *callable*, with a variable number of :c:expr:" "`PyObject *` arguments. The arguments are provided as a variable number of " @@ -590,13 +571,13 @@ msgstr "" "呼叫一個可呼叫的 Python 物件 *callable*,附帶數量可變的 :c:expr:`PyObject *` " "引數。這些引數是以位置在 *NULL* 後面、數量可變的參數來提供。" -#: ../../c-api/call.rst:326 +#: ../../c-api/call.rst:313 msgid "" "This is the equivalent of the Python expression: ``callable(arg1, " "arg2, ...)``." msgstr "這等價於 Python 運算式 ``callable(arg1, arg2, ...)``。" -#: ../../c-api/call.rst:332 +#: ../../c-api/call.rst:319 msgid "" "Call a method of the Python object *obj*, where the name of the method is " "given as a Python string object in *name*. It is called with a variable " @@ -607,7 +588,7 @@ msgstr "" "Python 字串物件給定。被呼叫時會附帶數量可變的 :c:expr:`PyObject *` 引數。這些" "引數是以位置在 *NULL* 後面、且數量可變的參數來提供。" -#: ../../c-api/call.rst:343 +#: ../../c-api/call.rst:330 msgid "" "Call a method of the Python object *obj* without arguments, where the name " "of the method is given as a Python string object in *name*." @@ -615,7 +596,7 @@ msgstr "" "不附帶任何引數地呼叫 Python 物件 *obj* 中的一個 method,其中 method 名稱由 " "*name* 中的 Python 字串物件給定。" -#: ../../c-api/call.rst:354 +#: ../../c-api/call.rst:341 msgid "" "Call a method of the Python object *obj* with a single positional argument " "*arg*, where the name of the method is given as a Python string object in " @@ -624,7 +605,7 @@ msgstr "" "附帶一個位置引數 *arg* 地呼叫 Python 物件 *obj* 中的一個 method,其中 method " "名稱由 *name* 中的 Python 字串物件給定。" -#: ../../c-api/call.rst:366 +#: ../../c-api/call.rst:353 msgid "" "Call a callable Python object *callable*. The arguments are the same as for :" "c:type:`vectorcallfunc`. If *callable* supports vectorcall_, this directly " @@ -634,7 +615,7 @@ msgstr "" "的相同。如果 *callable* 支援 vectorcall_,則它會直接呼叫存放在 *callable* 中" "的 vectorcall 函式。" -#: ../../c-api/call.rst:378 +#: ../../c-api/call.rst:365 msgid "" "Call *callable* with positional arguments passed exactly as in the " "vectorcall_ protocol, but with keyword arguments passed as a dictionary " @@ -643,7 +624,7 @@ msgstr "" "附帶與在 vectorcall_ 協定中傳入的相同位置引數來呼叫 *callable*,但會加上以字" "典 *kwdict* 格式傳入的關鍵字引數。*args* 陣列將只包含位置引數。" -#: ../../c-api/call.rst:382 +#: ../../c-api/call.rst:369 msgid "" "Regardless of which protocol is used internally, a conversion of arguments " "needs to be done. Therefore, this function should only be used if the caller " @@ -653,7 +634,7 @@ msgstr "" "無論內部使用了哪一種協定,都會需要進行引數的轉換。因此,此函式應該只有在呼叫" "方已經擁有一個要作為關鍵字引數的字典、但沒有作為位置引數的 tuple 時才被使用。" -#: ../../c-api/call.rst:392 +#: ../../c-api/call.rst:379 msgid "" "Call a method using the vectorcall calling convention. The name of the " "method is given as a Python string *name*. The object whose method is called " @@ -671,7 +652,7 @@ msgstr "" "加上 :c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`。關鍵字引數可以像在 :c:func:" "`PyObject_Vectorcall` 中一樣被傳入。" -#: ../../c-api/call.rst:401 +#: ../../c-api/call.rst:388 msgid "" "If the object has the :c:macro:`Py_TPFLAGS_METHOD_DESCRIPTOR` feature, this " "will call the unbound method object with the full *args* vector as arguments." @@ -679,14 +660,32 @@ msgstr "" "如果物件具有 :c:macro:`Py_TPFLAGS_METHOD_DESCRIPTOR` 特性,這將以完整的 " "*args* 向量作為引數來呼叫 unbound method(未繫結方法)物件。" -#: ../../c-api/call.rst:412 +#: ../../c-api/call.rst:399 msgid "Call Support API" msgstr "呼叫支援 API" -#: ../../c-api/call.rst:416 +#: ../../c-api/call.rst:403 msgid "" "Determine if the object *o* is callable. Return ``1`` if the object is " "callable and ``0`` otherwise. This function always succeeds." msgstr "" "判定物件 *o* 是否為可呼叫的。如果物件是可呼叫物件則回傳 ``1``,其他情況回傳 " "``0``。這個函式不會呼叫失敗。" + +#~ msgid "" +#~ "In CPython 3.8, the vectorcall API and related functions were available " +#~ "provisionally under names with a leading underscore: " +#~ "``_PyObject_Vectorcall``, ``_Py_TPFLAGS_HAVE_VECTORCALL``, " +#~ "``_PyObject_VectorcallMethod``, ``_PyVectorcall_Function``, " +#~ "``_PyObject_CallOneArg``, ``_PyObject_CallMethodNoArgs``, " +#~ "``_PyObject_CallMethodOneArg``. Additionally, ``PyObject_VectorcallDict`` " +#~ "was available as ``_PyObject_FastCallDict``. The old names are still " +#~ "defined as aliases of the new, non-underscored names." +#~ msgstr "" +#~ "在 CPython 3.8 中,vectorcall API 和相關函式暫定以帶開頭底線的名稱提供:" +#~ "``_PyObject_Vectorcall``、``_Py_TPFLAGS_HAVE_VECTORCALL``、" +#~ "``_PyObject_VectorcallMethod``、``_PyVectorcall_Function``、" +#~ "``_PyObject_CallOneArg``、``_PyObject_CallMethodNoArgs``、" +#~ "``_PyObject_CallMethodOneArg``。此外,``PyObject_VectorcallDict`` 也以 " +#~ "``_PyObject_FastCallDict`` 名稱提供。這些舊名稱仍有被定義,做為不帶底線的" +#~ "新名稱的別名。" diff --git a/c-api/code.po b/c-api/code.po index e9b00a5092..c653263f0a 100644 --- a/c-api/code.po +++ b/c-api/code.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -57,107 +57,115 @@ msgstr "" #: ../../c-api/code.rst:43 msgid "" +"Renamed from ``PyCode_GetFirstFree`` as part of :ref:`unstable-c-api`. The " +"old name is deprecated, but will remain available until the signature " +"changes again." +msgstr "" + +#: ../../c-api/code.rst:49 +msgid "" "Return a new code object. If you need a dummy code object to create a " "frame, use :c:func:`PyCode_NewEmpty` instead." msgstr "" -#: ../../c-api/code.rst:46 +#: ../../c-api/code.rst:52 msgid "" "Since the definition of the bytecode changes often, calling :c:func:" "`PyUnstable_Code_New` directly can bind you to a precise Python version." msgstr "" -#: ../../c-api/code.rst:49 +#: ../../c-api/code.rst:55 msgid "" "The many arguments of this function are inter-dependent in complex ways, " "meaning that subtle changes to values are likely to result in incorrect " "execution or VM crashes. Use this function only with extreme care." msgstr "" -#: ../../c-api/code.rst:53 +#: ../../c-api/code.rst:59 msgid "Added ``qualname`` and ``exceptiontable`` parameters." msgstr "新增 ``qualname`` 和 ``exceptiontable`` 參數。" -#: ../../c-api/code.rst:60 +#: ../../c-api/code.rst:66 msgid "" "Renamed from ``PyCode_New`` as part of :ref:`unstable-c-api`. The old name " "is deprecated, but will remain available until the signature changes again." msgstr "" -#: ../../c-api/code.rst:66 +#: ../../c-api/code.rst:72 msgid "" "Similar to :c:func:`PyUnstable_Code_New`, but with an extra " "\"posonlyargcount\" for positional-only arguments. The same caveats that " "apply to ``PyUnstable_Code_New`` also apply to this function." msgstr "" -#: ../../c-api/code.rst:71 +#: ../../c-api/code.rst:77 msgid "as ``PyCode_NewWithPosOnlyArgs``" msgstr "" -#: ../../c-api/code.rst:73 +#: ../../c-api/code.rst:79 msgid "Added ``qualname`` and ``exceptiontable`` parameters." msgstr "新增 ``qualname`` 和 ``exceptiontable`` 參數。" -#: ../../c-api/code.rst:78 +#: ../../c-api/code.rst:84 msgid "" "Renamed to ``PyUnstable_Code_NewWithPosOnlyArgs``. The old name is " "deprecated, but will remain available until the signature changes again." msgstr "" -#: ../../c-api/code.rst:84 +#: ../../c-api/code.rst:90 msgid "" "Return a new empty code object with the specified filename, function name, " "and first line number. The resulting code object will raise an ``Exception`` " "if executed." msgstr "" -#: ../../c-api/code.rst:90 +#: ../../c-api/code.rst:96 msgid "" "Return the line number of the instruction that occurs on or before " "``byte_offset`` and ends after it. If you just need the line number of a " "frame, use :c:func:`PyFrame_GetLineNumber` instead." msgstr "" -#: ../../c-api/code.rst:93 +#: ../../c-api/code.rst:99 msgid "" -"For efficiently iterating over the line numbers in a code object, use :pep:" -"`the API described in PEP 626 <0626#out-of-process-debuggers-and-profilers>`." +"For efficiently iterating over the line numbers in a code object, use `the " +"API described in PEP 626 `_." msgstr "" -#: ../../c-api/code.rst:98 +#: ../../c-api/code.rst:104 msgid "" "Sets the passed ``int`` pointers to the source code line and column numbers " "for the instruction at ``byte_offset``. Sets the value to ``0`` when " "information is not available for any particular element." msgstr "" -#: ../../c-api/code.rst:102 +#: ../../c-api/code.rst:108 msgid "Returns ``1`` if the function succeeds and 0 otherwise." msgstr "" -#: ../../c-api/code.rst:108 +#: ../../c-api/code.rst:114 msgid "" "Equivalent to the Python code ``getattr(co, 'co_code')``. Returns a strong " "reference to a :c:type:`PyBytesObject` representing the bytecode in a code " "object. On error, ``NULL`` is returned and an exception is raised." msgstr "" -#: ../../c-api/code.rst:113 +#: ../../c-api/code.rst:119 msgid "" "This ``PyBytesObject`` may be created on-demand by the interpreter and does " "not necessarily represent the bytecode actually executed by CPython. The " "primary use case for this function is debuggers and profilers." msgstr "" -#: ../../c-api/code.rst:121 +#: ../../c-api/code.rst:127 msgid "" "Equivalent to the Python code ``getattr(co, 'co_varnames')``. Returns a new " "reference to a :c:type:`PyTupleObject` containing the names of the local " "variables. On error, ``NULL`` is returned and an exception is raised." msgstr "" -#: ../../c-api/code.rst:130 +#: ../../c-api/code.rst:136 msgid "" "Equivalent to the Python code ``getattr(co, 'co_cellvars')``. Returns a new " "reference to a :c:type:`PyTupleObject` containing the names of the local " @@ -165,14 +173,14 @@ msgid "" "returned and an exception is raised." msgstr "" -#: ../../c-api/code.rst:139 +#: ../../c-api/code.rst:145 msgid "" "Equivalent to the Python code ``getattr(co, 'co_freevars')``. Returns a new " "reference to a :c:type:`PyTupleObject` containing the names of the free " "variables. On error, ``NULL`` is returned and an exception is raised." msgstr "" -#: ../../c-api/code.rst:147 +#: ../../c-api/code.rst:153 msgid "" "Register *callback* as a code object watcher for the current interpreter. " "Return an ID which may be passed to :c:func:`PyCode_ClearWatcher`. In case " @@ -180,7 +188,7 @@ msgid "" "exception." msgstr "" -#: ../../c-api/code.rst:156 +#: ../../c-api/code.rst:162 msgid "" "Clear watcher identified by *watcher_id* previously returned from :c:func:" "`PyCode_AddWatcher` for the current interpreter. Return ``0`` on success, or " @@ -188,17 +196,17 @@ msgid "" "never registered.)" msgstr "" -#: ../../c-api/code.rst:165 +#: ../../c-api/code.rst:171 msgid "" "Enumeration of possible code object watcher events: - " "``PY_CODE_EVENT_CREATE`` - ``PY_CODE_EVENT_DESTROY``" msgstr "" -#: ../../c-api/code.rst:173 +#: ../../c-api/code.rst:179 msgid "Type of a code object watcher callback function." msgstr "" -#: ../../c-api/code.rst:175 +#: ../../c-api/code.rst:181 msgid "" "If *event* is ``PY_CODE_EVENT_CREATE``, then the callback is invoked after " "`co` has been fully initialized. Otherwise, the callback is invoked before " @@ -206,7 +214,7 @@ msgid "" "inspected." msgstr "" -#: ../../c-api/code.rst:180 +#: ../../c-api/code.rst:186 msgid "" "If *event* is ``PY_CODE_EVENT_DESTROY``, taking a reference in the callback " "to the about-to-be-destroyed code object will resurrect it and prevent it " @@ -214,7 +222,7 @@ msgid "" "later, any watcher callbacks active at that time will be called again." msgstr "" -#: ../../c-api/code.rst:185 +#: ../../c-api/code.rst:191 msgid "" "Users of this API should not rely on internal runtime implementation " "details. Such details may include, but are not limited to, the exact order " @@ -224,14 +232,14 @@ msgid "" "the Python code being executed." msgstr "" -#: ../../c-api/code.rst:192 +#: ../../c-api/code.rst:198 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " "will be printed as an unraisable exception using :c:func:" "`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" -#: ../../c-api/code.rst:196 +#: ../../c-api/code.rst:202 msgid "" "There may already be a pending exception set on entry to the callback. In " "this case, the callback should return ``0`` with the same exception still " @@ -240,85 +248,85 @@ msgid "" "it before returning." msgstr "" -#: ../../c-api/code.rst:206 +#: ../../c-api/code.rst:212 msgid "Extra information" msgstr "" -#: ../../c-api/code.rst:208 +#: ../../c-api/code.rst:214 msgid "" "To support low-level extensions to frame evaluation, such as external just-" "in-time compilers, it is possible to attach arbitrary extra data to code " "objects." msgstr "" -#: ../../c-api/code.rst:212 +#: ../../c-api/code.rst:218 msgid "" "These functions are part of the unstable C API tier: this functionality is a " "CPython implementation detail, and the API may change without deprecation " "warnings." msgstr "" -#: ../../c-api/code.rst:218 +#: ../../c-api/code.rst:224 msgid "Return a new an opaque index value used to adding data to code objects." msgstr "" -#: ../../c-api/code.rst:220 +#: ../../c-api/code.rst:226 msgid "" "You generally call this function once (per interpreter) and use the result " "with ``PyCode_GetExtra`` and ``PyCode_SetExtra`` to manipulate data on " "individual code objects." msgstr "" -#: ../../c-api/code.rst:224 +#: ../../c-api/code.rst:230 msgid "" "If *free* is not ``NULL``: when a code object is deallocated, *free* will be " "called on non-``NULL`` data stored under the new index. Use :c:func:" "`Py_DecRef` when storing :c:type:`PyObject`." msgstr "" -#: ../../c-api/code.rst:230 +#: ../../c-api/code.rst:236 msgid "as ``_PyEval_RequestCodeExtraIndex``" msgstr "" -#: ../../c-api/code.rst:234 +#: ../../c-api/code.rst:240 msgid "" "Renamed to ``PyUnstable_Eval_RequestCodeExtraIndex``. The old private name " "is deprecated, but will be available until the API changes." msgstr "" -#: ../../c-api/code.rst:240 +#: ../../c-api/code.rst:246 msgid "" "Set *extra* to the extra data stored under the given index. Return 0 on " "success. Set an exception and return -1 on failure." msgstr "" -#: ../../c-api/code.rst:243 +#: ../../c-api/code.rst:249 msgid "" "If no data was set under the index, set *extra* to ``NULL`` and return 0 " "without setting an exception." msgstr "" -#: ../../c-api/code.rst:248 +#: ../../c-api/code.rst:254 msgid "as ``_PyCode_GetExtra``" msgstr "" -#: ../../c-api/code.rst:252 +#: ../../c-api/code.rst:258 msgid "" "Renamed to ``PyUnstable_Code_GetExtra``. The old private name is deprecated, " "but will be available until the API changes." msgstr "" -#: ../../c-api/code.rst:258 +#: ../../c-api/code.rst:264 msgid "" "Set the extra data stored under the given index to *extra*. Return 0 on " "success. Set an exception and return -1 on failure." msgstr "" -#: ../../c-api/code.rst:263 +#: ../../c-api/code.rst:269 msgid "as ``_PyCode_SetExtra``" msgstr "" -#: ../../c-api/code.rst:267 +#: ../../c-api/code.rst:273 msgid "" "Renamed to ``PyUnstable_Code_SetExtra``. The old private name is deprecated, " "but will be available until the API changes." @@ -336,22 +344,22 @@ msgstr "code(程式碼)" msgid "code object" msgstr "code object(程式碼物件)" -#: ../../c-api/code.rst:56 +#: ../../c-api/code.rst:62 msgid "PyCode_New (C function)" msgstr "PyCode_New(C 函式)" -#: ../../c-api/code.rst:69 +#: ../../c-api/code.rst:75 msgid "PyCode_NewWithPosOnlyArgs (C function)" msgstr "PyCode_NewWithPosOnlyArgs(C 函式)" -#: ../../c-api/code.rst:228 +#: ../../c-api/code.rst:234 msgid "_PyEval_RequestCodeExtraIndex (C function)" msgstr "_PyEval_RequestCodeExtraIndex(C 函式)" -#: ../../c-api/code.rst:246 +#: ../../c-api/code.rst:252 msgid "_PyCode_GetExtra (C function)" msgstr "_PyCode_GetExtra(C 函式)" -#: ../../c-api/code.rst:261 +#: ../../c-api/code.rst:267 msgid "_PyCode_SetExtra (C function)" msgstr "_PyCode_SetExtra(C 函式)" diff --git a/c-api/complex.po b/c-api/complex.po index aadd5c049e..a6448fac77 100644 --- a/c-api/complex.po +++ b/c-api/complex.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -181,6 +181,19 @@ msgid "Return the real part of *op* as a C :c:expr:`double`." msgstr "以 C 的 :c:expr:`double` 形式回傳 *op* 的實部。" #: ../../c-api/complex.rst:126 +#, fuzzy +msgid "" +"If *op* is not a Python complex number object but has a :meth:`~object." +"__complex__` method, this method will first be called to convert *op* to a " +"Python complex number object. If :meth:`!__complex__` is not defined then " +"it falls back to call :c:func:`PyFloat_AsDouble` and returns its result." +msgstr "" +"如果 *op* 不是 Python 複數物件,但有一個 :meth:`~object.__complex__` 方法,則" +"首先會呼叫該方法將 *op* 轉換為 Python 複數物件。如果 :meth:`!__complex__` 並" +"未定義,那麼它會回退到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未" +"定義,則它將繼續回退為 :meth:`~object.__index__`。" + +#: ../../c-api/complex.rst:132 ../../c-api/complex.rst:148 msgid "" "Upon failure, this method returns ``-1.0`` with an exception set, so one " "should call :c:func:`PyErr_Occurred` to check for errors." @@ -188,15 +201,33 @@ msgstr "" "失敗時,此方法回傳 ``-1.0`` 並設定例外,因此應該呼叫 :c:func:" "`PyErr_Occurred` 來檢查錯誤。" -#: ../../c-api/complex.rst:132 +#: ../../c-api/complex.rst:135 ../../c-api/complex.rst:151 +msgid "Use :meth:`~object.__complex__` if available." +msgstr "如果可用則使用 :meth:`~object.__complex__`。" + +#: ../../c-api/complex.rst:140 msgid "Return the imaginary part of *op* as a C :c:expr:`double`." msgstr "將 *op* 的虛部作為 C 的 :c:expr:`double` 回傳。" -#: ../../c-api/complex.rst:137 +#: ../../c-api/complex.rst:142 +#, fuzzy +msgid "" +"If *op* is not a Python complex number object but has a :meth:`~object." +"__complex__` method, this method will first be called to convert *op* to a " +"Python complex number object. If :meth:`!__complex__` is not defined then " +"it falls back to call :c:func:`PyFloat_AsDouble` and returns ``0.0`` on " +"success." +msgstr "" +"如果 *op* 不是 Python 複數物件,但有一個 :meth:`~object.__complex__` 方法,則" +"首先會呼叫該方法將 *op* 轉換為 Python 複數物件。如果 :meth:`!__complex__` 並" +"未定義,那麼它會回退到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未" +"定義,則它將繼續回退為 :meth:`~object.__index__`。" + +#: ../../c-api/complex.rst:156 msgid "Return the :c:type:`Py_complex` value of the complex number *op*." msgstr "回傳複數 *op* 的 :c:type:`Py_complex` 值。" -#: ../../c-api/complex.rst:139 +#: ../../c-api/complex.rst:158 msgid "" "If *op* is not a Python complex number object but has a :meth:`~object." "__complex__` method, this method will first be called to convert *op* to a " @@ -209,7 +240,7 @@ msgstr "" "未定義,那麼它會回退到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未" "定義,則它將繼續回退為 :meth:`~object.__index__`。" -#: ../../c-api/complex.rst:145 +#: ../../c-api/complex.rst:164 msgid "" "Upon failure, this method returns :c:type:`Py_complex` with :c:member:" "`~Py_complex.real` set to ``-1.0`` and with an exception set, so one should " @@ -218,7 +249,7 @@ msgstr "" "失敗時,此方法回傳 :c:type:`Py_complex` 並將 :c:member:`~Py_complex.real` 設" "為 ``-1.0``,並設定例外,因此應該呼叫 :c:func:`PyErr_Occurred` 來檢查錯誤。" -#: ../../c-api/complex.rst:149 +#: ../../c-api/complex.rst:168 msgid "Use :meth:`~object.__index__` if available." msgstr "如果可用則使用 :meth:`~object.__index__`。" diff --git a/c-api/dict.po b/c-api/dict.po index 446c91328a..2905a63507 100644 --- a/c-api/dict.po +++ b/c-api/dict.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -76,10 +76,17 @@ msgid "" msgstr "" #: ../../c-api/dict.rst:60 +msgid "" +"This is the same as :c:func:`PyDict_Contains`, but *key* is specified as a :" +"c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" +"`PyObject*`." +msgstr "" + +#: ../../c-api/dict.rst:69 msgid "Return a new dictionary that contains the same key-value pairs as *p*." msgstr "" -#: ../../c-api/dict.rst:65 +#: ../../c-api/dict.rst:74 msgid "" "Insert *val* into the dictionary *p* with a key of *key*. *key* must be :" "term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return ``0`` " @@ -87,14 +94,14 @@ msgid "" "to *val*." msgstr "" -#: ../../c-api/dict.rst:73 +#: ../../c-api/dict.rst:82 msgid "" "This is the same as :c:func:`PyDict_SetItem`, but *key* is specified as a :c:" "expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/dict.rst:80 +#: ../../c-api/dict.rst:89 msgid "" "Remove the entry in dictionary *p* with key *key*. *key* must be :term:" "`hashable`; if it isn't, :exc:`TypeError` is raised. If *key* is not in the " @@ -102,47 +109,72 @@ msgid "" "failure." msgstr "" -#: ../../c-api/dict.rst:88 +#: ../../c-api/dict.rst:97 msgid "" "This is the same as :c:func:`PyDict_DelItem`, but *key* is specified as a :c:" "expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/dict.rst:95 +#: ../../c-api/dict.rst:104 msgid "" -"Return the object from dictionary *p* which has a key *key*. Return " -"``NULL`` if the key *key* is not present, but *without* setting an exception." +"Return a new :term:`strong reference` to the object from dictionary *p* " +"which has a key *key*:" msgstr "" -#: ../../c-api/dict.rst:100 +#: ../../c-api/dict.rst:107 +msgid "" +"If the key is present, set *\\*result* to a new :term:`strong reference` to " +"the value and return ``1``." +msgstr "" + +#: ../../c-api/dict.rst:109 +msgid "If the key is missing, set *\\*result* to ``NULL`` and return ``0``." +msgstr "" + +#: ../../c-api/dict.rst:110 ../../c-api/dict.rst:207 +msgid "On error, raise an exception and return ``-1``." +msgstr "" + +#: ../../c-api/dict.rst:114 +msgid "See also the :c:func:`PyObject_GetItem` function." +msgstr "" + +#: ../../c-api/dict.rst:119 +msgid "" +"Return a :term:`borrowed reference` to the object from dictionary *p* which " +"has a key *key*. Return ``NULL`` if the key *key* is missing *without* " +"setting an exception." +msgstr "" + +#: ../../c-api/dict.rst:125 msgid "" "Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" "`~object.__eq__` methods are silently ignored. Prefer the :c:func:" "`PyDict_GetItemWithError` function instead." msgstr "" -#: ../../c-api/dict.rst:104 +#: ../../c-api/dict.rst:129 msgid "" "Calling this API without :term:`GIL` held had been allowed for historical " "reason. It is no longer allowed." msgstr "" -#: ../../c-api/dict.rst:111 +#: ../../c-api/dict.rst:136 msgid "" "Variant of :c:func:`PyDict_GetItem` that does not suppress exceptions. " "Return ``NULL`` **with** an exception set if an exception occurred. Return " "``NULL`` **without** an exception set if the key wasn't present." msgstr "" -#: ../../c-api/dict.rst:119 +#: ../../c-api/dict.rst:144 msgid "" "This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a :c:" "expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/dict.rst:125 +#: ../../c-api/dict.rst:150 msgid "" "Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" "`~object.__eq__` methods or while creating the temporary :class:`str` object " @@ -150,7 +182,14 @@ msgid "" "function with your own :c:func:`PyUnicode_FromString` *key* instead." msgstr "" -#: ../../c-api/dict.rst:134 +#: ../../c-api/dict.rst:159 +msgid "" +"Similar than :c:func:`PyDict_GetItemRef`, but *key* is specified as a :c:" +"expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" +"`PyObject*`." +msgstr "" + +#: ../../c-api/dict.rst:168 msgid "" "This is the same as the Python-level :meth:`dict.setdefault`. If present, " "it returns the value corresponding to *key* from the dictionary *p*. If the " @@ -160,29 +199,79 @@ msgid "" "the insertion." msgstr "" -#: ../../c-api/dict.rst:144 +#: ../../c-api/dict.rst:179 +msgid "" +"Inserts *default_value* into the dictionary *p* with a key of *key* if the " +"key is not already present in the dictionary. If *result* is not ``NULL``, " +"then *\\*result* is set to a :term:`strong reference` to either " +"*default_value*, if the key was not present, or the existing value, if *key* " +"was already present in the dictionary. Returns ``1`` if the key was present " +"and *default_value* was not inserted, or ``0`` if the key was not present " +"and *default_value* was inserted. On failure, returns ``-1``, sets an " +"exception, and sets ``*result`` to ``NULL``." +msgstr "" + +#: ../../c-api/dict.rst:189 +msgid "" +"For clarity: if you have a strong reference to *default_value* before " +"calling this function, then after it returns, you hold a strong reference to " +"both *default_value* and *\\*result* (if it's not ``NULL``). These may refer " +"to the same object: in that case you hold two separate references to it." +msgstr "" + +#: ../../c-api/dict.rst:200 +msgid "" +"Remove *key* from dictionary *p* and optionally return the removed value. Do " +"not raise :exc:`KeyError` if the key missing." +msgstr "" + +#: ../../c-api/dict.rst:203 +msgid "" +"If the key is present, set *\\*result* to a new reference to the removed " +"value if *result* is not ``NULL``, and return ``1``." +msgstr "" + +#: ../../c-api/dict.rst:205 +msgid "" +"If the key is missing, set *\\*result* to ``NULL`` if *result* is not " +"``NULL``, and return ``0``." +msgstr "" + +#: ../../c-api/dict.rst:209 +msgid "" +"This is similar to :meth:`dict.pop`, but without the default value and not " +"raising :exc:`KeyError` if the key missing." +msgstr "" + +#: ../../c-api/dict.rst:217 +msgid "" +"Similar to :c:func:`PyDict_Pop`, but *key* is specified as a :c:expr:`const " +"char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +msgstr "" + +#: ../../c-api/dict.rst:226 msgid "" "Return a :c:type:`PyListObject` containing all the items from the dictionary." msgstr "" -#: ../../c-api/dict.rst:149 +#: ../../c-api/dict.rst:231 msgid "" "Return a :c:type:`PyListObject` containing all the keys from the dictionary." msgstr "" -#: ../../c-api/dict.rst:154 +#: ../../c-api/dict.rst:236 msgid "" "Return a :c:type:`PyListObject` containing all the values from the " "dictionary *p*." msgstr "" -#: ../../c-api/dict.rst:162 +#: ../../c-api/dict.rst:244 msgid "" "Return the number of items in the dictionary. This is equivalent to " "``len(p)`` on a dictionary." msgstr "" -#: ../../c-api/dict.rst:168 +#: ../../c-api/dict.rst:250 msgid "" "Iterate over all key-value pairs in the dictionary *p*. The :c:type:" "`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` prior to the " @@ -196,11 +285,11 @@ msgid "" "structure is sparse, the offsets are not consecutive." msgstr "" -#: ../../c-api/dict.rst:179 +#: ../../c-api/dict.rst:261 msgid "For example::" msgstr "舉例來說: ::" -#: ../../c-api/dict.rst:181 +#: ../../c-api/dict.rst:263 msgid "" "PyObject *key, *value;\n" "Py_ssize_t pos = 0;\n" @@ -211,14 +300,14 @@ msgid "" "}" msgstr "" -#: ../../c-api/dict.rst:189 +#: ../../c-api/dict.rst:271 msgid "" "The dictionary *p* should not be mutated during iteration. It is safe to " "modify the values of the keys as you iterate over the dictionary, but only " "so long as the set of keys does not change. For example::" msgstr "" -#: ../../c-api/dict.rst:193 +#: ../../c-api/dict.rst:275 msgid "" "PyObject *key, *value;\n" "Py_ssize_t pos = 0;\n" @@ -256,7 +345,23 @@ msgstr "" " Py_DECREF(o);\n" "}" -#: ../../c-api/dict.rst:214 +#: ../../c-api/dict.rst:293 +msgid "" +"The function is not thread-safe in the :term:`free-threaded ` build without external synchronization. You can use :c:macro:" +"`Py_BEGIN_CRITICAL_SECTION` to lock the dictionary while iterating over it::" +msgstr "" + +#: ../../c-api/dict.rst:298 +msgid "" +"Py_BEGIN_CRITICAL_SECTION(self->dict);\n" +"while (PyDict_Next(self->dict, &pos, &key, &value)) {\n" +" ...\n" +"}\n" +"Py_END_CRITICAL_SECTION();" +msgstr "" + +#: ../../c-api/dict.rst:307 msgid "" "Iterate over mapping object *b* adding key-value pairs to dictionary *a*. " "*b* may be a dictionary, or any object supporting :c:func:`PyMapping_Keys` " @@ -266,7 +371,7 @@ msgid "" "or ``-1`` if an exception was raised." msgstr "" -#: ../../c-api/dict.rst:224 +#: ../../c-api/dict.rst:317 msgid "" "This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to ``a." "update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall back " @@ -275,7 +380,7 @@ msgid "" "exception was raised." msgstr "" -#: ../../c-api/dict.rst:233 +#: ../../c-api/dict.rst:326 msgid "" "Update or merge into dictionary *a*, from the key-value pairs in *seq2*. " "*seq2* must be an iterable object producing iterable objects of length 2, " @@ -284,7 +389,7 @@ msgid "" "if an exception was raised. Equivalent Python (except for the return value)::" msgstr "" -#: ../../c-api/dict.rst:240 +#: ../../c-api/dict.rst:333 msgid "" "def PyDict_MergeFromSeq2(a, seq2, override):\n" " for key, value in seq2:\n" @@ -296,7 +401,7 @@ msgstr "" " if override or key not in a:\n" " a[key] = value" -#: ../../c-api/dict.rst:247 +#: ../../c-api/dict.rst:340 msgid "" "Register *callback* as a dictionary watcher. Return a non-negative integer " "id which must be passed to future calls to :c:func:`PyDict_Watch`. In case " @@ -304,21 +409,21 @@ msgid "" "exception." msgstr "" -#: ../../c-api/dict.rst:256 +#: ../../c-api/dict.rst:349 msgid "" "Clear watcher identified by *watcher_id* previously returned from :c:func:" "`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error (e.g. if the " "given *watcher_id* was never registered.)" msgstr "" -#: ../../c-api/dict.rst:264 +#: ../../c-api/dict.rst:357 msgid "" "Mark dictionary *dict* as watched. The callback granted *watcher_id* by :c:" "func:`PyDict_AddWatcher` will be called when *dict* is modified or " "deallocated. Return ``0`` on success or ``-1`` on error." msgstr "" -#: ../../c-api/dict.rst:272 +#: ../../c-api/dict.rst:365 msgid "" "Mark dictionary *dict* as no longer watched. The callback granted " "*watcher_id* by :c:func:`PyDict_AddWatcher` will no longer be called when " @@ -326,7 +431,7 @@ msgid "" "watched by this watcher. Return ``0`` on success or ``-1`` on error." msgstr "" -#: ../../c-api/dict.rst:281 +#: ../../c-api/dict.rst:374 msgid "" "Enumeration of possible dictionary watcher events: ``PyDict_EVENT_ADDED``, " "``PyDict_EVENT_MODIFIED``, ``PyDict_EVENT_DELETED``, " @@ -334,11 +439,11 @@ msgid "" "``PyDict_EVENT_DEALLOCATED``." msgstr "" -#: ../../c-api/dict.rst:289 +#: ../../c-api/dict.rst:382 msgid "Type of a dict watcher callback function." msgstr "" -#: ../../c-api/dict.rst:291 +#: ../../c-api/dict.rst:384 msgid "" "If *event* is ``PyDict_EVENT_CLEARED`` or ``PyDict_EVENT_DEALLOCATED``, both " "*key* and *new_value* will be ``NULL``. If *event* is ``PyDict_EVENT_ADDED`` " @@ -347,7 +452,7 @@ msgid "" "dictionary and *new_value* will be ``NULL``." msgstr "" -#: ../../c-api/dict.rst:297 +#: ../../c-api/dict.rst:390 msgid "" "``PyDict_EVENT_CLONED`` occurs when *dict* was previously empty and another " "dict is merged into it. To maintain efficiency of this operation, per-key " @@ -355,14 +460,14 @@ msgid "" "``PyDict_EVENT_CLONED`` is issued, and *key* will be the source dictionary." msgstr "" -#: ../../c-api/dict.rst:303 +#: ../../c-api/dict.rst:396 msgid "" "The callback may inspect but must not modify *dict*; doing so could have " "unpredictable effects, including infinite recursion. Do not trigger Python " "code execution in the callback, as it could modify the dict as a side effect." msgstr "" -#: ../../c-api/dict.rst:307 +#: ../../c-api/dict.rst:400 msgid "" "If *event* is ``PyDict_EVENT_DEALLOCATED``, taking a new reference in the " "callback to the about-to-be-destroyed dictionary will resurrect it and " @@ -371,20 +476,20 @@ msgid "" "again." msgstr "" -#: ../../c-api/dict.rst:313 +#: ../../c-api/dict.rst:406 msgid "" "Callbacks occur before the notified modification to *dict* takes place, so " "the prior state of *dict* can be inspected." msgstr "" -#: ../../c-api/dict.rst:316 +#: ../../c-api/dict.rst:409 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " "will be printed as an unraisable exception using :c:func:" "`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" -#: ../../c-api/dict.rst:320 +#: ../../c-api/dict.rst:413 msgid "" "There may already be a pending exception set on entry to the callback. In " "this case, the callback should return ``0`` with the same exception still " @@ -401,11 +506,11 @@ msgstr "object(物件)" msgid "dictionary" msgstr "dictionary(字典)" -#: ../../c-api/dict.rst:160 +#: ../../c-api/dict.rst:242 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/dict.rst:160 +#: ../../c-api/dict.rst:242 msgid "len" msgstr "len" diff --git a/c-api/exceptions.po b/c-api/exceptions.po index 82db6b2566..7709f0093c 100644 --- a/c-api/exceptions.po +++ b/c-api/exceptions.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -143,22 +143,31 @@ msgstr "使用 :func:`sys.unraisablehook`。" #: ../../c-api/exceptions.rst:104 msgid "" +"Similar to :c:func:`PyErr_WriteUnraisable`, but the *format* and subsequent " +"parameters help format the warning message; they have the same meaning and " +"values as in :c:func:`PyUnicode_FromFormat`. ``PyErr_WriteUnraisable(obj)`` " +"is roughly equivalent to ``PyErr_FormatUnraisable(\"Exception ignored in: " +"%R\", obj)``. If *format* is ``NULL``, only the traceback is printed." +msgstr "" + +#: ../../c-api/exceptions.rst:116 +msgid "" "Print the standard traceback display of ``exc`` to ``sys.stderr``, including " "chained exceptions and notes." msgstr "" -#: ../../c-api/exceptions.rst:110 +#: ../../c-api/exceptions.rst:123 msgid "Raising exceptions" msgstr "" -#: ../../c-api/exceptions.rst:112 +#: ../../c-api/exceptions.rst:125 msgid "" "These functions help you set the current thread's error indicator. For " "convenience, some of these functions will always return a ``NULL`` pointer " "for use in a ``return`` statement." msgstr "" -#: ../../c-api/exceptions.rst:119 +#: ../../c-api/exceptions.rst:132 msgid "" "This is the most common way to set the error indicator. The first argument " "specifies the exception type; it is normally one of the standard exceptions, " @@ -167,13 +176,13 @@ msgid "" "error message; it is decoded from ``'utf-8'``." msgstr "" -#: ../../c-api/exceptions.rst:128 +#: ../../c-api/exceptions.rst:141 msgid "" "This function is similar to :c:func:`PyErr_SetString` but lets you specify " "an arbitrary Python object for the \"value\" of the exception." msgstr "" -#: ../../c-api/exceptions.rst:134 +#: ../../c-api/exceptions.rst:147 msgid "" "This function sets the error indicator and returns ``NULL``. *exception* " "should be a Python exception class. The *format* and subsequent parameters " @@ -181,31 +190,31 @@ msgid "" "c:func:`PyUnicode_FromFormat`. *format* is an ASCII-encoded string." msgstr "" -#: ../../c-api/exceptions.rst:143 +#: ../../c-api/exceptions.rst:156 msgid "" "Same as :c:func:`PyErr_Format`, but taking a :c:type:`va_list` argument " "rather than a variable number of arguments." msgstr "" -#: ../../c-api/exceptions.rst:151 +#: ../../c-api/exceptions.rst:164 msgid "This is a shorthand for ``PyErr_SetObject(type, Py_None)``." msgstr "" -#: ../../c-api/exceptions.rst:156 +#: ../../c-api/exceptions.rst:169 msgid "" "This is a shorthand for ``PyErr_SetString(PyExc_TypeError, message)``, where " "*message* indicates that a built-in operation was invoked with an illegal " "argument. It is mostly for internal use." msgstr "" -#: ../../c-api/exceptions.rst:163 +#: ../../c-api/exceptions.rst:176 msgid "" "This is a shorthand for ``PyErr_SetNone(PyExc_MemoryError)``; it returns " "``NULL`` so an object allocation function can write ``return " "PyErr_NoMemory();`` when it runs out of memory." msgstr "" -#: ../../c-api/exceptions.rst:172 +#: ../../c-api/exceptions.rst:185 msgid "" "This is a convenience function to raise an exception when a C library " "function has returned an error and set the C variable :c:data:`errno`. It " @@ -219,7 +228,7 @@ msgid "" "``return PyErr_SetFromErrno(type);`` when the system call returns an error." msgstr "" -#: ../../c-api/exceptions.rst:186 +#: ../../c-api/exceptions.rst:199 msgid "" "Similar to :c:func:`PyErr_SetFromErrno`, with the additional behavior that " "if *filenameObject* is not ``NULL``, it is passed to the constructor of " @@ -227,21 +236,21 @@ msgid "" "is used to define the :attr:`!filename` attribute of the exception instance." msgstr "" -#: ../../c-api/exceptions.rst:195 +#: ../../c-api/exceptions.rst:208 msgid "" "Similar to :c:func:`PyErr_SetFromErrnoWithFilenameObject`, but takes a " "second filename object, for raising errors when a function that takes two " "filenames fails." msgstr "" -#: ../../c-api/exceptions.rst:204 +#: ../../c-api/exceptions.rst:217 msgid "" "Similar to :c:func:`PyErr_SetFromErrnoWithFilenameObject`, but the filename " "is given as a C string. *filename* is decoded from the :term:`filesystem " "encoding and error handler`." msgstr "" -#: ../../c-api/exceptions.rst:211 +#: ../../c-api/exceptions.rst:224 msgid "" "This is a convenience function to raise :exc:`OSError`. If called with " "*ierr* of ``0``, the error code returned by a call to :c:func:`!" @@ -255,19 +264,19 @@ msgid "" "``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:221 ../../c-api/exceptions.rst:229 -#: ../../c-api/exceptions.rst:240 ../../c-api/exceptions.rst:250 -#: ../../c-api/exceptions.rst:258 ../../c-api/exceptions.rst:268 +#: ../../c-api/exceptions.rst:234 ../../c-api/exceptions.rst:242 +#: ../../c-api/exceptions.rst:253 ../../c-api/exceptions.rst:263 +#: ../../c-api/exceptions.rst:271 ../../c-api/exceptions.rst:281 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../c-api/exceptions.rst:226 +#: ../../c-api/exceptions.rst:239 msgid "" "Similar to :c:func:`PyErr_SetFromWindowsErr`, with an additional parameter " "specifying the exception type to be raised." msgstr "" -#: ../../c-api/exceptions.rst:234 +#: ../../c-api/exceptions.rst:247 msgid "" "Similar to :c:func:`PyErr_SetFromWindowsErr`, with the additional behavior " "that if *filename* is not ``NULL``, it is decoded from the filesystem " @@ -276,7 +285,7 @@ msgid "" "attribute of the exception instance." msgstr "" -#: ../../c-api/exceptions.rst:245 +#: ../../c-api/exceptions.rst:258 msgid "" "Similar to :c:func:`PyErr_SetExcFromWindowsErr`, with the additional " "behavior that if *filename* is not ``NULL``, it is passed to the constructor " @@ -284,19 +293,19 @@ msgid "" "filename` attribute of the exception instance." msgstr "" -#: ../../c-api/exceptions.rst:255 +#: ../../c-api/exceptions.rst:268 msgid "" "Similar to :c:func:`PyErr_SetExcFromWindowsErrWithFilenameObject`, but " "accepts a second filename object." msgstr "" -#: ../../c-api/exceptions.rst:265 +#: ../../c-api/exceptions.rst:278 msgid "" "Similar to :c:func:`PyErr_SetFromWindowsErrWithFilename`, with an additional " "parameter specifying the exception type to be raised." msgstr "" -#: ../../c-api/exceptions.rst:273 +#: ../../c-api/exceptions.rst:286 msgid "" "This is a convenience function to raise :exc:`ImportError`. *msg* will be " "set as the exception's message string. *name* and *path*, both of which can " @@ -304,13 +313,13 @@ msgid "" "``path`` attributes." msgstr "" -#: ../../c-api/exceptions.rst:283 +#: ../../c-api/exceptions.rst:296 msgid "" "Much like :c:func:`PyErr_SetImportError` but this function allows for " "specifying a subclass of :exc:`ImportError` to raise." msgstr "" -#: ../../c-api/exceptions.rst:291 +#: ../../c-api/exceptions.rst:304 msgid "" "Set file, line, and offset information for the current exception. If the " "current exception is not a :exc:`SyntaxError`, then it sets additional " @@ -318,19 +327,19 @@ msgid "" "is a :exc:`SyntaxError`." msgstr "" -#: ../../c-api/exceptions.rst:301 +#: ../../c-api/exceptions.rst:314 msgid "" "Like :c:func:`PyErr_SyntaxLocationObject`, but *filename* is a byte string " "decoded from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/exceptions.rst:309 +#: ../../c-api/exceptions.rst:322 msgid "" "Like :c:func:`PyErr_SyntaxLocationEx`, but the *col_offset* parameter is " "omitted." msgstr "" -#: ../../c-api/exceptions.rst:315 +#: ../../c-api/exceptions.rst:328 msgid "" "This is a shorthand for ``PyErr_SetString(PyExc_SystemError, message)``, " "where *message* indicates that an internal operation (e.g. a Python/C API " @@ -338,11 +347,11 @@ msgid "" "use." msgstr "" -#: ../../c-api/exceptions.rst:322 +#: ../../c-api/exceptions.rst:335 msgid "Issuing warnings" msgstr "" -#: ../../c-api/exceptions.rst:324 +#: ../../c-api/exceptions.rst:337 msgid "" "Use these functions to issue warnings from C code. They mirror similar " "functions exported by the Python :mod:`warnings` module. They normally " @@ -358,7 +367,7 @@ msgid "" "return an error value)." msgstr "" -#: ../../c-api/exceptions.rst:339 +#: ../../c-api/exceptions.rst:352 msgid "" "Issue a warning message. The *category* argument is a warning category (see " "below) or ``NULL``; the *message* argument is a UTF-8 encoded string. " @@ -368,7 +377,7 @@ msgid "" "`PyErr_WarnEx`, 2 is the function above that, and so forth." msgstr "" -#: ../../c-api/exceptions.rst:346 +#: ../../c-api/exceptions.rst:359 msgid "" "Warning categories must be subclasses of :c:data:`PyExc_Warning`; :c:data:" "`PyExc_Warning` is a subclass of :c:data:`PyExc_Exception`; the default " @@ -377,14 +386,14 @@ msgid "" "enumerated at :ref:`standardwarningcategories`." msgstr "" -#: ../../c-api/exceptions.rst:352 +#: ../../c-api/exceptions.rst:365 msgid "" "For information about warning control, see the documentation for the :mod:" "`warnings` module and the :option:`-W` option in the command line " "documentation. There is no C API for warning control." msgstr "" -#: ../../c-api/exceptions.rst:359 +#: ../../c-api/exceptions.rst:372 msgid "" "Issue a warning message with explicit control over all warning attributes. " "This is a straightforward wrapper around the Python function :func:`warnings." @@ -392,32 +401,32 @@ msgid "" "arguments may be set to ``NULL`` to get the default effect described there." msgstr "" -#: ../../c-api/exceptions.rst:370 +#: ../../c-api/exceptions.rst:383 msgid "" "Similar to :c:func:`PyErr_WarnExplicitObject` except that *message* and " "*module* are UTF-8 encoded strings, and *filename* is decoded from the :term:" "`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/exceptions.rst:377 +#: ../../c-api/exceptions.rst:390 msgid "" "Function similar to :c:func:`PyErr_WarnEx`, but use :c:func:" "`PyUnicode_FromFormat` to format the warning message. *format* is an ASCII-" "encoded string." msgstr "" -#: ../../c-api/exceptions.rst:386 +#: ../../c-api/exceptions.rst:399 msgid "" "Function similar to :c:func:`PyErr_WarnFormat`, but *category* is :exc:" "`ResourceWarning` and it passes *source* to :class:`!warnings." "WarningMessage`." msgstr "" -#: ../../c-api/exceptions.rst:393 +#: ../../c-api/exceptions.rst:406 msgid "Querying the error indicator" msgstr "" -#: ../../c-api/exceptions.rst:397 +#: ../../c-api/exceptions.rst:410 msgid "" "Test whether the error indicator is set. If set, return the exception " "*type* (the first argument to the last call to one of the ``PyErr_Set*`` " @@ -426,11 +435,11 @@ msgid "" "`Py_DECREF` it." msgstr "" -#: ../../c-api/exceptions.rst:403 +#: ../../c-api/exceptions.rst:416 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/exceptions.rst:407 +#: ../../c-api/exceptions.rst:420 msgid "" "Do not compare the return value to a specific exception; use :c:func:" "`PyErr_ExceptionMatches` instead, shown below. (The comparison could easily " @@ -438,14 +447,14 @@ msgid "" "of a class exception, or it may be a subclass of the expected exception.)" msgstr "" -#: ../../c-api/exceptions.rst:415 +#: ../../c-api/exceptions.rst:428 msgid "" "Equivalent to ``PyErr_GivenExceptionMatches(PyErr_Occurred(), exc)``. This " "should only be called when an exception is actually set; a memory access " "violation will occur if no exception has been raised." msgstr "" -#: ../../c-api/exceptions.rst:422 +#: ../../c-api/exceptions.rst:435 msgid "" "Return true if the *given* exception matches the exception type in *exc*. " "If *exc* is a class object, this also returns true when *given* is an " @@ -453,23 +462,23 @@ msgid "" "tuple (and recursively in subtuples) are searched for a match." msgstr "" -#: ../../c-api/exceptions.rst:430 +#: ../../c-api/exceptions.rst:443 msgid "" "Return the exception currently being raised, clearing the error indicator at " "the same time. Return ``NULL`` if the error indicator is not set." msgstr "" -#: ../../c-api/exceptions.rst:433 +#: ../../c-api/exceptions.rst:446 msgid "" "This function is used by code that needs to catch exceptions, or code that " "needs to save and restore the error indicator temporarily." msgstr "" -#: ../../c-api/exceptions.rst:436 ../../c-api/exceptions.rst:480 +#: ../../c-api/exceptions.rst:449 ../../c-api/exceptions.rst:493 msgid "For example::" msgstr "舉例來說: ::" -#: ../../c-api/exceptions.rst:438 +#: ../../c-api/exceptions.rst:451 msgid "" "{\n" " PyObject *exc = PyErr_GetRaisedException();\n" @@ -480,27 +489,27 @@ msgid "" "}" msgstr "" -#: ../../c-api/exceptions.rst:446 +#: ../../c-api/exceptions.rst:459 msgid "" ":c:func:`PyErr_GetHandledException`, to save the exception currently being " "handled." msgstr "" -#: ../../c-api/exceptions.rst:454 +#: ../../c-api/exceptions.rst:467 msgid "" "Set *exc* as the exception currently being raised, clearing the existing " "exception if one is set." msgstr "" -#: ../../c-api/exceptions.rst:459 +#: ../../c-api/exceptions.rst:472 msgid "This call steals a reference to *exc*, which must be a valid exception." msgstr "" -#: ../../c-api/exceptions.rst:468 +#: ../../c-api/exceptions.rst:481 msgid "Use :c:func:`PyErr_GetRaisedException` instead." msgstr "" -#: ../../c-api/exceptions.rst:470 +#: ../../c-api/exceptions.rst:483 msgid "" "Retrieve the error indicator into three variables whose addresses are " "passed. If the error indicator is not set, set all three variables to " @@ -509,13 +518,13 @@ msgid "" "the type object is not." msgstr "" -#: ../../c-api/exceptions.rst:477 +#: ../../c-api/exceptions.rst:490 msgid "" "This function is normally only used by legacy code that needs to catch " "exceptions or save and restore the error indicator temporarily." msgstr "" -#: ../../c-api/exceptions.rst:482 +#: ../../c-api/exceptions.rst:495 msgid "" "{\n" " PyObject *type, *value, *traceback;\n" @@ -527,11 +536,11 @@ msgid "" "}" msgstr "" -#: ../../c-api/exceptions.rst:496 +#: ../../c-api/exceptions.rst:509 msgid "Use :c:func:`PyErr_SetRaisedException` instead." msgstr "" -#: ../../c-api/exceptions.rst:498 +#: ../../c-api/exceptions.rst:511 msgid "" "Set the error indicator from the three objects, *type*, *value*, and " "*traceback*, clearing the existing exception if one is set. If the objects " @@ -544,20 +553,20 @@ msgid "" "don't use this function. I warned you.)" msgstr "" -#: ../../c-api/exceptions.rst:512 +#: ../../c-api/exceptions.rst:525 msgid "" "This function is normally only used by legacy code that needs to save and " "restore the error indicator temporarily. Use :c:func:`PyErr_Fetch` to save " "the current error indicator." msgstr "" -#: ../../c-api/exceptions.rst:521 +#: ../../c-api/exceptions.rst:534 msgid "" "Use :c:func:`PyErr_GetRaisedException` instead, to avoid any possible de-" "normalization." msgstr "" -#: ../../c-api/exceptions.rst:524 +#: ../../c-api/exceptions.rst:537 msgid "" "Under certain circumstances, the values returned by :c:func:`PyErr_Fetch` " "below can be \"unnormalized\", meaning that ``*exc`` is a class object but " @@ -567,14 +576,14 @@ msgid "" "improve performance." msgstr "" -#: ../../c-api/exceptions.rst:532 +#: ../../c-api/exceptions.rst:545 msgid "" "This function *does not* implicitly set the :attr:`~BaseException." "__traceback__` attribute on the exception value. If setting the traceback " "appropriately is desired, the following additional snippet is needed::" msgstr "" -#: ../../c-api/exceptions.rst:537 +#: ../../c-api/exceptions.rst:550 msgid "" "if (tb != NULL) {\n" " PyException_SetTraceback(val, tb);\n" @@ -584,7 +593,7 @@ msgstr "" " PyException_SetTraceback(val, tb);\n" "}" -#: ../../c-api/exceptions.rst:544 +#: ../../c-api/exceptions.rst:557 msgid "" "Retrieve the active exception instance, as would be returned by :func:`sys." "exception`. This refers to an exception that was *already caught*, not to an " @@ -592,7 +601,7 @@ msgid "" "or ``NULL``. Does not modify the interpreter's exception state." msgstr "" -#: ../../c-api/exceptions.rst:551 +#: ../../c-api/exceptions.rst:564 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -600,14 +609,14 @@ msgid "" "clear the exception state." msgstr "" -#: ../../c-api/exceptions.rst:560 +#: ../../c-api/exceptions.rst:573 msgid "" "Set the active exception, as known from ``sys.exception()``. This refers to " "an exception that was *already caught*, not to an exception that was freshly " "raised. To clear the exception state, pass ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:567 +#: ../../c-api/exceptions.rst:580 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -615,7 +624,7 @@ msgid "" "exception state." msgstr "" -#: ../../c-api/exceptions.rst:576 +#: ../../c-api/exceptions.rst:589 msgid "" "Retrieve the old-style representation of the exception info, as known from :" "func:`sys.exc_info`. This refers to an exception that was *already caught*, " @@ -625,7 +634,7 @@ msgid "" "using :c:func:`PyErr_GetHandledException`." msgstr "" -#: ../../c-api/exceptions.rst:585 +#: ../../c-api/exceptions.rst:598 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -633,7 +642,7 @@ msgid "" "exception state." msgstr "" -#: ../../c-api/exceptions.rst:595 +#: ../../c-api/exceptions.rst:608 msgid "" "Set the exception info, as known from ``sys.exc_info()``. This refers to an " "exception that was *already caught*, not to an exception that was freshly " @@ -643,7 +652,7 @@ msgid "" "`PyErr_SetHandledException`." msgstr "" -#: ../../c-api/exceptions.rst:604 +#: ../../c-api/exceptions.rst:617 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -651,22 +660,22 @@ msgid "" "state." msgstr "" -#: ../../c-api/exceptions.rst:611 +#: ../../c-api/exceptions.rst:624 msgid "" "The ``type`` and ``traceback`` arguments are no longer used and can be NULL. " "The interpreter now derives them from the exception instance (the ``value`` " "argument). The function still steals references of all three arguments." msgstr "" -#: ../../c-api/exceptions.rst:619 +#: ../../c-api/exceptions.rst:632 msgid "Signal Handling" msgstr "" -#: ../../c-api/exceptions.rst:629 +#: ../../c-api/exceptions.rst:642 msgid "This function interacts with Python's signal handling." msgstr "" -#: ../../c-api/exceptions.rst:631 +#: ../../c-api/exceptions.rst:644 msgid "" "If the function is called from the main thread and under the main Python " "interpreter, it checks whether a signal has been sent to the processes and " @@ -674,7 +683,7 @@ msgid "" "module is supported, this can invoke a signal handler written in Python." msgstr "" -#: ../../c-api/exceptions.rst:636 +#: ../../c-api/exceptions.rst:649 msgid "" "The function attempts to handle all pending signals, and then returns ``0``. " "However, if a Python signal handler raises an exception, the error indicator " @@ -683,44 +692,44 @@ msgid "" "`PyErr_CheckSignals()` invocation)." msgstr "" -#: ../../c-api/exceptions.rst:642 +#: ../../c-api/exceptions.rst:655 msgid "" "If the function is called from a non-main thread, or under a non-main Python " "interpreter, it does nothing and returns ``0``." msgstr "" -#: ../../c-api/exceptions.rst:645 +#: ../../c-api/exceptions.rst:658 msgid "" "This function can be called by long-running C code that wants to be " "interruptible by user requests (such as by pressing Ctrl-C)." msgstr "" -#: ../../c-api/exceptions.rst:649 +#: ../../c-api/exceptions.rst:662 msgid "" "The default Python signal handler for :c:macro:`!SIGINT` raises the :exc:" "`KeyboardInterrupt` exception." msgstr "" -#: ../../c-api/exceptions.rst:660 +#: ../../c-api/exceptions.rst:673 msgid "" "Simulate the effect of a :c:macro:`!SIGINT` signal arriving. This is " "equivalent to ``PyErr_SetInterruptEx(SIGINT)``." msgstr "" -#: ../../c-api/exceptions.rst:664 ../../c-api/exceptions.rst:691 +#: ../../c-api/exceptions.rst:677 ../../c-api/exceptions.rst:704 msgid "" "This function is async-signal-safe. It can be called without the :term:" "`GIL` and from a C signal handler." msgstr "" -#: ../../c-api/exceptions.rst:674 +#: ../../c-api/exceptions.rst:687 msgid "" "Simulate the effect of a signal arriving. The next time :c:func:" "`PyErr_CheckSignals` is called, the Python signal handler for the given " "signal number will be called." msgstr "" -#: ../../c-api/exceptions.rst:678 +#: ../../c-api/exceptions.rst:691 msgid "" "This function can be called by C code that sets up its own signal handling " "and wants Python signal handlers to be invoked as expected when an " @@ -728,27 +737,27 @@ msgid "" "interrupt an operation)." msgstr "" -#: ../../c-api/exceptions.rst:683 +#: ../../c-api/exceptions.rst:696 msgid "" "If the given signal isn't handled by Python (it was set to :py:const:`signal." "SIG_DFL` or :py:const:`signal.SIG_IGN`), it will be ignored." msgstr "" -#: ../../c-api/exceptions.rst:686 +#: ../../c-api/exceptions.rst:699 msgid "" "If *signum* is outside of the allowed range of signal numbers, ``-1`` is " "returned. Otherwise, ``0`` is returned. The error indicator is never " "changed by this function." msgstr "" -#: ../../c-api/exceptions.rst:699 +#: ../../c-api/exceptions.rst:712 msgid "" "This utility function specifies a file descriptor to which the signal number " "is written as a single byte whenever a signal is received. *fd* must be non-" "blocking. It returns the previous such file descriptor." msgstr "" -#: ../../c-api/exceptions.rst:703 +#: ../../c-api/exceptions.rst:716 msgid "" "The value ``-1`` disables the feature; this is the initial state. This is " "equivalent to :func:`signal.set_wakeup_fd` in Python, but without any error " @@ -756,15 +765,15 @@ msgid "" "be called from the main thread." msgstr "" -#: ../../c-api/exceptions.rst:708 +#: ../../c-api/exceptions.rst:721 msgid "On Windows, the function now also supports socket handles." msgstr "" -#: ../../c-api/exceptions.rst:713 +#: ../../c-api/exceptions.rst:726 msgid "Exception Classes" msgstr "例外類別" -#: ../../c-api/exceptions.rst:717 +#: ../../c-api/exceptions.rst:730 msgid "" "This utility function creates and returns a new exception class. The *name* " "argument must be the name of the new exception, a C string of the form " @@ -773,7 +782,7 @@ msgid "" "(accessible in C as :c:data:`PyExc_Exception`)." msgstr "" -#: ../../c-api/exceptions.rst:723 +#: ../../c-api/exceptions.rst:736 msgid "" "The :attr:`!__module__` attribute of the new class is set to the first part " "(up to the last dot) of the *name* argument, and the class name is set to " @@ -783,31 +792,31 @@ msgid "" "variables and methods." msgstr "" -#: ../../c-api/exceptions.rst:732 +#: ../../c-api/exceptions.rst:745 msgid "" "Same as :c:func:`PyErr_NewException`, except that the new exception class " "can easily be given a docstring: If *doc* is non-``NULL``, it will be used " "as the docstring for the exception class." msgstr "" -#: ../../c-api/exceptions.rst:740 +#: ../../c-api/exceptions.rst:753 msgid "Exception Objects" msgstr "例外物件" -#: ../../c-api/exceptions.rst:744 +#: ../../c-api/exceptions.rst:757 msgid "" "Return the traceback associated with the exception as a new reference, as " "accessible from Python through the :attr:`~BaseException.__traceback__` " "attribute. If there is no traceback associated, this returns ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:752 +#: ../../c-api/exceptions.rst:765 msgid "" "Set the traceback associated with the exception to *tb*. Use ``Py_None`` to " "clear it." msgstr "" -#: ../../c-api/exceptions.rst:758 +#: ../../c-api/exceptions.rst:771 msgid "" "Return the context (another exception instance during whose handling *ex* " "was raised) associated with the exception as a new reference, as accessible " @@ -815,14 +824,14 @@ msgid "" "there is no context associated, this returns ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:766 +#: ../../c-api/exceptions.rst:779 msgid "" "Set the context associated with the exception to *ctx*. Use ``NULL`` to " "clear it. There is no type check to make sure that *ctx* is an exception " "instance. This steals a reference to *ctx*." msgstr "" -#: ../../c-api/exceptions.rst:773 +#: ../../c-api/exceptions.rst:786 msgid "" "Return the cause (either an exception instance, or ``None``, set by " "``raise ... from ...``) associated with the exception as a new reference, as " @@ -830,28 +839,28 @@ msgid "" "attribute." msgstr "" -#: ../../c-api/exceptions.rst:781 +#: ../../c-api/exceptions.rst:794 msgid "" "Set the cause associated with the exception to *cause*. Use ``NULL`` to " "clear it. There is no type check to make sure that *cause* is either an " "exception instance or ``None``. This steals a reference to *cause*." msgstr "" -#: ../../c-api/exceptions.rst:785 +#: ../../c-api/exceptions.rst:798 msgid "" "The :attr:`~BaseException.__suppress_context__` attribute is implicitly set " "to ``True`` by this function." msgstr "" -#: ../../c-api/exceptions.rst:791 +#: ../../c-api/exceptions.rst:804 msgid "Return :attr:`~BaseException.args` of exception *ex*." msgstr "" -#: ../../c-api/exceptions.rst:796 +#: ../../c-api/exceptions.rst:809 msgid "Set :attr:`~BaseException.args` of exception *ex* to *args*." msgstr "" -#: ../../c-api/exceptions.rst:800 +#: ../../c-api/exceptions.rst:813 msgid "" "Implement part of the interpreter's implementation of :keyword:`!except*`. " "*orig* is the original exception that was caught, and *excs* is the list of " @@ -863,72 +872,72 @@ msgid "" "if there is nothing to reraise." msgstr "" -#: ../../c-api/exceptions.rst:814 +#: ../../c-api/exceptions.rst:827 msgid "Unicode Exception Objects" msgstr "" -#: ../../c-api/exceptions.rst:816 +#: ../../c-api/exceptions.rst:829 msgid "" "The following functions are used to create and modify Unicode exceptions " "from C." msgstr "" -#: ../../c-api/exceptions.rst:820 +#: ../../c-api/exceptions.rst:833 msgid "" "Create a :class:`UnicodeDecodeError` object with the attributes *encoding*, " "*object*, *length*, *start*, *end* and *reason*. *encoding* and *reason* are " "UTF-8 encoded strings." msgstr "" -#: ../../c-api/exceptions.rst:827 +#: ../../c-api/exceptions.rst:840 msgid "Return the *encoding* attribute of the given exception object." msgstr "" -#: ../../c-api/exceptions.rst:833 +#: ../../c-api/exceptions.rst:846 msgid "Return the *object* attribute of the given exception object." msgstr "" -#: ../../c-api/exceptions.rst:839 +#: ../../c-api/exceptions.rst:852 msgid "" "Get the *start* attribute of the given exception object and place it into " "*\\*start*. *start* must not be ``NULL``. Return ``0`` on success, ``-1`` " "on failure." msgstr "" -#: ../../c-api/exceptions.rst:847 +#: ../../c-api/exceptions.rst:860 msgid "" "Set the *start* attribute of the given exception object to *start*. Return " "``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:854 +#: ../../c-api/exceptions.rst:867 msgid "" "Get the *end* attribute of the given exception object and place it into " "*\\*end*. *end* must not be ``NULL``. Return ``0`` on success, ``-1`` on " "failure." msgstr "" -#: ../../c-api/exceptions.rst:862 +#: ../../c-api/exceptions.rst:875 msgid "" "Set the *end* attribute of the given exception object to *end*. Return " "``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:869 +#: ../../c-api/exceptions.rst:882 msgid "Return the *reason* attribute of the given exception object." msgstr "" -#: ../../c-api/exceptions.rst:875 +#: ../../c-api/exceptions.rst:888 msgid "" "Set the *reason* attribute of the given exception object to *reason*. " "Return ``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:882 +#: ../../c-api/exceptions.rst:895 msgid "Recursion Control" msgstr "" -#: ../../c-api/exceptions.rst:884 +#: ../../c-api/exceptions.rst:897 msgid "" "These two functions provide a way to perform safe recursive calls at the C " "level, both in the core and in extension modules. They are needed if the " @@ -938,44 +947,44 @@ msgid "" "recursion handling." msgstr "" -#: ../../c-api/exceptions.rst:893 +#: ../../c-api/exceptions.rst:906 msgid "Marks a point where a recursive C-level call is about to be performed." msgstr "" -#: ../../c-api/exceptions.rst:895 +#: ../../c-api/exceptions.rst:908 msgid "" "If :c:macro:`!USE_STACKCHECK` is defined, this function checks if the OS " "stack overflowed using :c:func:`PyOS_CheckStack`. If this is the case, it " "sets a :exc:`MemoryError` and returns a nonzero value." msgstr "" -#: ../../c-api/exceptions.rst:899 +#: ../../c-api/exceptions.rst:912 msgid "" "The function then checks if the recursion limit is reached. If this is the " "case, a :exc:`RecursionError` is set and a nonzero value is returned. " "Otherwise, zero is returned." msgstr "" -#: ../../c-api/exceptions.rst:903 +#: ../../c-api/exceptions.rst:916 msgid "" "*where* should be a UTF-8 encoded string such as ``\" in instance check\"`` " "to be concatenated to the :exc:`RecursionError` message caused by the " "recursion depth limit." msgstr "" -#: ../../c-api/exceptions.rst:907 ../../c-api/exceptions.rst:915 +#: ../../c-api/exceptions.rst:920 ../../c-api/exceptions.rst:928 msgid "" "This function is now also available in the :ref:`limited API `." msgstr "" -#: ../../c-api/exceptions.rst:912 +#: ../../c-api/exceptions.rst:925 msgid "" "Ends a :c:func:`Py_EnterRecursiveCall`. Must be called once for each " "*successful* invocation of :c:func:`Py_EnterRecursiveCall`." msgstr "" -#: ../../c-api/exceptions.rst:918 +#: ../../c-api/exceptions.rst:931 msgid "" "Properly implementing :c:member:`~PyTypeObject.tp_repr` for container types " "requires special recursion handling. In addition to protecting the stack, :" @@ -984,13 +993,13 @@ msgid "" "Effectively, these are the C equivalent to :func:`reprlib.recursive_repr`." msgstr "" -#: ../../c-api/exceptions.rst:926 +#: ../../c-api/exceptions.rst:939 msgid "" "Called at the beginning of the :c:member:`~PyTypeObject.tp_repr` " "implementation to detect cycles." msgstr "" -#: ../../c-api/exceptions.rst:929 +#: ../../c-api/exceptions.rst:942 msgid "" "If the object has already been processed, the function returns a positive " "integer. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " @@ -998,30 +1007,30 @@ msgid "" "`dict` objects return ``{...}`` and :class:`list` objects return ``[...]``." msgstr "" -#: ../../c-api/exceptions.rst:935 +#: ../../c-api/exceptions.rst:948 msgid "" "The function will return a negative integer if the recursion limit is " "reached. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " "should typically return ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:939 +#: ../../c-api/exceptions.rst:952 msgid "" "Otherwise, the function returns zero and the :c:member:`~PyTypeObject." "tp_repr` implementation can continue normally." msgstr "" -#: ../../c-api/exceptions.rst:944 +#: ../../c-api/exceptions.rst:957 msgid "" "Ends a :c:func:`Py_ReprEnter`. Must be called once for each invocation of :" "c:func:`Py_ReprEnter` that returns zero." msgstr "" -#: ../../c-api/exceptions.rst:951 +#: ../../c-api/exceptions.rst:964 msgid "Standard Exceptions" msgstr "" -#: ../../c-api/exceptions.rst:953 +#: ../../c-api/exceptions.rst:966 msgid "" "All standard Python exceptions are available as global variables whose names " "are ``PyExc_`` followed by the Python exception name. These have the type :" @@ -1029,451 +1038,451 @@ msgid "" "all the variables:" msgstr "" -#: ../../c-api/exceptions.rst:1014 ../../c-api/exceptions.rst:1147 -#: ../../c-api/exceptions.rst:1192 +#: ../../c-api/exceptions.rst:1027 ../../c-api/exceptions.rst:1160 +#: ../../c-api/exceptions.rst:1205 msgid "C Name" msgstr "C 名稱" -#: ../../c-api/exceptions.rst:1014 ../../c-api/exceptions.rst:1192 +#: ../../c-api/exceptions.rst:1027 ../../c-api/exceptions.rst:1205 msgid "Python Name" msgstr "Python 名稱" -#: ../../c-api/exceptions.rst:1014 ../../c-api/exceptions.rst:1147 -#: ../../c-api/exceptions.rst:1192 +#: ../../c-api/exceptions.rst:1027 ../../c-api/exceptions.rst:1160 +#: ../../c-api/exceptions.rst:1205 msgid "Notes" msgstr "註解" -#: ../../c-api/exceptions.rst:1016 +#: ../../c-api/exceptions.rst:1029 msgid ":c:data:`PyExc_BaseException`" msgstr ":c:data:`PyExc_BaseException`" -#: ../../c-api/exceptions.rst:1016 +#: ../../c-api/exceptions.rst:1029 msgid ":exc:`BaseException`" msgstr ":exc:`BaseException`" -#: ../../c-api/exceptions.rst:1016 ../../c-api/exceptions.rst:1018 -#: ../../c-api/exceptions.rst:1020 ../../c-api/exceptions.rst:1066 -#: ../../c-api/exceptions.rst:1078 +#: ../../c-api/exceptions.rst:1029 ../../c-api/exceptions.rst:1031 +#: ../../c-api/exceptions.rst:1033 ../../c-api/exceptions.rst:1079 +#: ../../c-api/exceptions.rst:1091 msgid "[1]_" msgstr "[1]_" -#: ../../c-api/exceptions.rst:1018 +#: ../../c-api/exceptions.rst:1031 msgid ":c:data:`PyExc_Exception`" msgstr ":c:data:`PyExc_Exception`" -#: ../../c-api/exceptions.rst:1018 +#: ../../c-api/exceptions.rst:1031 msgid ":exc:`Exception`" msgstr ":exc:`Exception`" -#: ../../c-api/exceptions.rst:1020 +#: ../../c-api/exceptions.rst:1033 msgid ":c:data:`PyExc_ArithmeticError`" msgstr ":c:data:`PyExc_ArithmeticError`" -#: ../../c-api/exceptions.rst:1020 +#: ../../c-api/exceptions.rst:1033 msgid ":exc:`ArithmeticError`" msgstr ":exc:`ArithmeticError`" -#: ../../c-api/exceptions.rst:1022 +#: ../../c-api/exceptions.rst:1035 msgid ":c:data:`PyExc_AssertionError`" msgstr ":c:data:`PyExc_AssertionError`" -#: ../../c-api/exceptions.rst:1022 +#: ../../c-api/exceptions.rst:1035 msgid ":exc:`AssertionError`" msgstr ":exc:`AssertionError`" -#: ../../c-api/exceptions.rst:1024 +#: ../../c-api/exceptions.rst:1037 msgid ":c:data:`PyExc_AttributeError`" msgstr ":c:data:`PyExc_AttributeError`" -#: ../../c-api/exceptions.rst:1024 +#: ../../c-api/exceptions.rst:1037 msgid ":exc:`AttributeError`" msgstr ":exc:`AttributeError`" -#: ../../c-api/exceptions.rst:1026 +#: ../../c-api/exceptions.rst:1039 msgid ":c:data:`PyExc_BlockingIOError`" msgstr ":c:data:`PyExc_BlockingIOError`" -#: ../../c-api/exceptions.rst:1026 +#: ../../c-api/exceptions.rst:1039 msgid ":exc:`BlockingIOError`" msgstr ":exc:`BlockingIOError`" -#: ../../c-api/exceptions.rst:1028 +#: ../../c-api/exceptions.rst:1041 msgid ":c:data:`PyExc_BrokenPipeError`" msgstr ":c:data:`PyExc_BrokenPipeError`" -#: ../../c-api/exceptions.rst:1028 +#: ../../c-api/exceptions.rst:1041 msgid ":exc:`BrokenPipeError`" msgstr ":exc:`BrokenPipeError`" -#: ../../c-api/exceptions.rst:1030 +#: ../../c-api/exceptions.rst:1043 msgid ":c:data:`PyExc_BufferError`" msgstr ":c:data:`PyExc_BufferError`" -#: ../../c-api/exceptions.rst:1030 +#: ../../c-api/exceptions.rst:1043 msgid ":exc:`BufferError`" msgstr ":exc:`BufferError`" -#: ../../c-api/exceptions.rst:1032 +#: ../../c-api/exceptions.rst:1045 msgid ":c:data:`PyExc_ChildProcessError`" msgstr ":c:data:`PyExc_ChildProcessError`" -#: ../../c-api/exceptions.rst:1032 +#: ../../c-api/exceptions.rst:1045 msgid ":exc:`ChildProcessError`" msgstr ":exc:`ChildProcessError`" -#: ../../c-api/exceptions.rst:1034 +#: ../../c-api/exceptions.rst:1047 msgid ":c:data:`PyExc_ConnectionAbortedError`" msgstr ":c:data:`PyExc_ConnectionAbortedError`" -#: ../../c-api/exceptions.rst:1034 +#: ../../c-api/exceptions.rst:1047 msgid ":exc:`ConnectionAbortedError`" msgstr ":exc:`ConnectionAbortedError`" -#: ../../c-api/exceptions.rst:1036 +#: ../../c-api/exceptions.rst:1049 msgid ":c:data:`PyExc_ConnectionError`" msgstr ":c:data:`PyExc_ConnectionError`" -#: ../../c-api/exceptions.rst:1036 +#: ../../c-api/exceptions.rst:1049 msgid ":exc:`ConnectionError`" msgstr ":exc:`ConnectionError`" -#: ../../c-api/exceptions.rst:1038 +#: ../../c-api/exceptions.rst:1051 msgid ":c:data:`PyExc_ConnectionRefusedError`" msgstr ":c:data:`PyExc_ConnectionRefusedError`" -#: ../../c-api/exceptions.rst:1038 +#: ../../c-api/exceptions.rst:1051 msgid ":exc:`ConnectionRefusedError`" msgstr ":exc:`ConnectionRefusedError`" -#: ../../c-api/exceptions.rst:1040 +#: ../../c-api/exceptions.rst:1053 msgid ":c:data:`PyExc_ConnectionResetError`" msgstr ":c:data:`PyExc_ConnectionResetError`" -#: ../../c-api/exceptions.rst:1040 +#: ../../c-api/exceptions.rst:1053 msgid ":exc:`ConnectionResetError`" msgstr ":exc:`ConnectionResetError`" -#: ../../c-api/exceptions.rst:1042 +#: ../../c-api/exceptions.rst:1055 msgid ":c:data:`PyExc_EOFError`" msgstr ":c:data:`PyExc_EOFError`" -#: ../../c-api/exceptions.rst:1042 +#: ../../c-api/exceptions.rst:1055 msgid ":exc:`EOFError`" msgstr ":exc:`EOFError`" -#: ../../c-api/exceptions.rst:1044 +#: ../../c-api/exceptions.rst:1057 msgid ":c:data:`PyExc_FileExistsError`" msgstr ":c:data:`PyExc_FileExistsError`" -#: ../../c-api/exceptions.rst:1044 +#: ../../c-api/exceptions.rst:1057 msgid ":exc:`FileExistsError`" msgstr ":exc:`FileExistsError`" -#: ../../c-api/exceptions.rst:1046 +#: ../../c-api/exceptions.rst:1059 msgid ":c:data:`PyExc_FileNotFoundError`" msgstr ":c:data:`PyExc_FileNotFoundError`" -#: ../../c-api/exceptions.rst:1046 +#: ../../c-api/exceptions.rst:1059 msgid ":exc:`FileNotFoundError`" msgstr ":exc:`FileNotFoundError`" -#: ../../c-api/exceptions.rst:1048 +#: ../../c-api/exceptions.rst:1061 msgid ":c:data:`PyExc_FloatingPointError`" msgstr ":c:data:`PyExc_FloatingPointError`" -#: ../../c-api/exceptions.rst:1048 +#: ../../c-api/exceptions.rst:1061 msgid ":exc:`FloatingPointError`" msgstr ":exc:`FloatingPointError`" -#: ../../c-api/exceptions.rst:1050 +#: ../../c-api/exceptions.rst:1063 msgid ":c:data:`PyExc_GeneratorExit`" msgstr ":c:data:`PyExc_GeneratorExit`" -#: ../../c-api/exceptions.rst:1050 +#: ../../c-api/exceptions.rst:1063 msgid ":exc:`GeneratorExit`" msgstr ":exc:`GeneratorExit`" -#: ../../c-api/exceptions.rst:1052 +#: ../../c-api/exceptions.rst:1065 msgid ":c:data:`PyExc_ImportError`" msgstr ":c:data:`PyExc_ImportError`" -#: ../../c-api/exceptions.rst:1052 +#: ../../c-api/exceptions.rst:1065 msgid ":exc:`ImportError`" msgstr ":exc:`ImportError`" -#: ../../c-api/exceptions.rst:1054 +#: ../../c-api/exceptions.rst:1067 msgid ":c:data:`PyExc_IndentationError`" msgstr ":c:data:`PyExc_IndentationError`" -#: ../../c-api/exceptions.rst:1054 +#: ../../c-api/exceptions.rst:1067 msgid ":exc:`IndentationError`" msgstr ":exc:`IndentationError`" -#: ../../c-api/exceptions.rst:1056 +#: ../../c-api/exceptions.rst:1069 msgid ":c:data:`PyExc_IndexError`" msgstr ":c:data:`PyExc_IndexError`" -#: ../../c-api/exceptions.rst:1056 +#: ../../c-api/exceptions.rst:1069 msgid ":exc:`IndexError`" msgstr ":exc:`IndexError`" -#: ../../c-api/exceptions.rst:1058 +#: ../../c-api/exceptions.rst:1071 msgid ":c:data:`PyExc_InterruptedError`" msgstr ":c:data:`PyExc_InterruptedError`" -#: ../../c-api/exceptions.rst:1058 +#: ../../c-api/exceptions.rst:1071 msgid ":exc:`InterruptedError`" msgstr ":exc:`InterruptedError`" -#: ../../c-api/exceptions.rst:1060 +#: ../../c-api/exceptions.rst:1073 msgid ":c:data:`PyExc_IsADirectoryError`" msgstr ":c:data:`PyExc_IsADirectoryError`" -#: ../../c-api/exceptions.rst:1060 +#: ../../c-api/exceptions.rst:1073 msgid ":exc:`IsADirectoryError`" msgstr ":exc:`IsADirectoryError`" -#: ../../c-api/exceptions.rst:1062 +#: ../../c-api/exceptions.rst:1075 msgid ":c:data:`PyExc_KeyError`" msgstr ":c:data:`PyExc_KeyError`" -#: ../../c-api/exceptions.rst:1062 +#: ../../c-api/exceptions.rst:1075 msgid ":exc:`KeyError`" msgstr ":exc:`KeyError`" -#: ../../c-api/exceptions.rst:1064 +#: ../../c-api/exceptions.rst:1077 msgid ":c:data:`PyExc_KeyboardInterrupt`" msgstr ":c:data:`PyExc_KeyboardInterrupt`" -#: ../../c-api/exceptions.rst:1064 +#: ../../c-api/exceptions.rst:1077 msgid ":exc:`KeyboardInterrupt`" msgstr ":exc:`KeyboardInterrupt`" -#: ../../c-api/exceptions.rst:1066 +#: ../../c-api/exceptions.rst:1079 msgid ":c:data:`PyExc_LookupError`" msgstr ":c:data:`PyExc_LookupError`" -#: ../../c-api/exceptions.rst:1066 +#: ../../c-api/exceptions.rst:1079 msgid ":exc:`LookupError`" msgstr ":exc:`LookupError`" -#: ../../c-api/exceptions.rst:1068 +#: ../../c-api/exceptions.rst:1081 msgid ":c:data:`PyExc_MemoryError`" msgstr ":c:data:`PyExc_MemoryError`" -#: ../../c-api/exceptions.rst:1068 +#: ../../c-api/exceptions.rst:1081 msgid ":exc:`MemoryError`" msgstr ":exc:`MemoryError`" -#: ../../c-api/exceptions.rst:1070 +#: ../../c-api/exceptions.rst:1083 msgid ":c:data:`PyExc_ModuleNotFoundError`" msgstr ":c:data:`PyExc_ModuleNotFoundError`" -#: ../../c-api/exceptions.rst:1070 +#: ../../c-api/exceptions.rst:1083 msgid ":exc:`ModuleNotFoundError`" msgstr ":exc:`ModuleNotFoundError`" -#: ../../c-api/exceptions.rst:1072 +#: ../../c-api/exceptions.rst:1085 msgid ":c:data:`PyExc_NameError`" msgstr ":c:data:`PyExc_NameError`" -#: ../../c-api/exceptions.rst:1072 +#: ../../c-api/exceptions.rst:1085 msgid ":exc:`NameError`" msgstr ":exc:`NameError`" -#: ../../c-api/exceptions.rst:1074 +#: ../../c-api/exceptions.rst:1087 msgid ":c:data:`PyExc_NotADirectoryError`" msgstr ":c:data:`PyExc_NotADirectoryError`" -#: ../../c-api/exceptions.rst:1074 +#: ../../c-api/exceptions.rst:1087 msgid ":exc:`NotADirectoryError`" msgstr ":exc:`NotADirectoryError`" -#: ../../c-api/exceptions.rst:1076 +#: ../../c-api/exceptions.rst:1089 msgid ":c:data:`PyExc_NotImplementedError`" msgstr ":c:data:`PyExc_NotImplementedError`" -#: ../../c-api/exceptions.rst:1076 +#: ../../c-api/exceptions.rst:1089 msgid ":exc:`NotImplementedError`" msgstr ":exc:`NotImplementedError`" -#: ../../c-api/exceptions.rst:1078 +#: ../../c-api/exceptions.rst:1091 msgid ":c:data:`PyExc_OSError`" msgstr ":c:data:`PyExc_OSError`" -#: ../../c-api/exceptions.rst:1078 +#: ../../c-api/exceptions.rst:1091 msgid ":exc:`OSError`" msgstr ":exc:`OSError`" -#: ../../c-api/exceptions.rst:1080 +#: ../../c-api/exceptions.rst:1093 msgid ":c:data:`PyExc_OverflowError`" msgstr ":c:data:`PyExc_OverflowError`" -#: ../../c-api/exceptions.rst:1080 +#: ../../c-api/exceptions.rst:1093 msgid ":exc:`OverflowError`" msgstr ":exc:`OverflowError`" -#: ../../c-api/exceptions.rst:1082 +#: ../../c-api/exceptions.rst:1095 msgid ":c:data:`PyExc_PermissionError`" msgstr ":c:data:`PyExc_PermissionError`" -#: ../../c-api/exceptions.rst:1082 +#: ../../c-api/exceptions.rst:1095 msgid ":exc:`PermissionError`" msgstr ":exc:`PermissionError`" -#: ../../c-api/exceptions.rst:1084 +#: ../../c-api/exceptions.rst:1097 msgid ":c:data:`PyExc_ProcessLookupError`" msgstr ":c:data:`PyExc_ProcessLookupError`" -#: ../../c-api/exceptions.rst:1084 +#: ../../c-api/exceptions.rst:1097 msgid ":exc:`ProcessLookupError`" msgstr ":exc:`ProcessLookupError`" -#: ../../c-api/exceptions.rst:1086 +#: ../../c-api/exceptions.rst:1099 msgid ":c:data:`PyExc_RecursionError`" msgstr ":c:data:`PyExc_RecursionError`" -#: ../../c-api/exceptions.rst:1086 +#: ../../c-api/exceptions.rst:1099 msgid ":exc:`RecursionError`" msgstr ":exc:`RecursionError`" -#: ../../c-api/exceptions.rst:1088 +#: ../../c-api/exceptions.rst:1101 msgid ":c:data:`PyExc_ReferenceError`" msgstr ":c:data:`PyExc_ReferenceError`" -#: ../../c-api/exceptions.rst:1088 +#: ../../c-api/exceptions.rst:1101 msgid ":exc:`ReferenceError`" msgstr ":exc:`ReferenceError`" -#: ../../c-api/exceptions.rst:1090 +#: ../../c-api/exceptions.rst:1103 msgid ":c:data:`PyExc_RuntimeError`" msgstr ":c:data:`PyExc_RuntimeError`" -#: ../../c-api/exceptions.rst:1090 +#: ../../c-api/exceptions.rst:1103 msgid ":exc:`RuntimeError`" msgstr ":exc:`RuntimeError`" -#: ../../c-api/exceptions.rst:1092 +#: ../../c-api/exceptions.rst:1105 msgid ":c:data:`PyExc_StopAsyncIteration`" msgstr ":c:data:`PyExc_StopAsyncIteration`" -#: ../../c-api/exceptions.rst:1092 +#: ../../c-api/exceptions.rst:1105 msgid ":exc:`StopAsyncIteration`" msgstr ":exc:`StopAsyncIteration`" -#: ../../c-api/exceptions.rst:1094 +#: ../../c-api/exceptions.rst:1107 msgid ":c:data:`PyExc_StopIteration`" msgstr ":c:data:`PyExc_StopIteration`" -#: ../../c-api/exceptions.rst:1094 +#: ../../c-api/exceptions.rst:1107 msgid ":exc:`StopIteration`" msgstr ":exc:`StopIteration`" -#: ../../c-api/exceptions.rst:1096 +#: ../../c-api/exceptions.rst:1109 msgid ":c:data:`PyExc_SyntaxError`" msgstr ":c:data:`PyExc_SyntaxError`" -#: ../../c-api/exceptions.rst:1096 +#: ../../c-api/exceptions.rst:1109 msgid ":exc:`SyntaxError`" msgstr ":exc:`SyntaxError`" -#: ../../c-api/exceptions.rst:1098 +#: ../../c-api/exceptions.rst:1111 msgid ":c:data:`PyExc_SystemError`" msgstr ":c:data:`PyExc_SystemError`" -#: ../../c-api/exceptions.rst:1098 +#: ../../c-api/exceptions.rst:1111 msgid ":exc:`SystemError`" msgstr ":exc:`SystemError`" -#: ../../c-api/exceptions.rst:1100 +#: ../../c-api/exceptions.rst:1113 msgid ":c:data:`PyExc_SystemExit`" msgstr ":c:data:`PyExc_SystemExit`" -#: ../../c-api/exceptions.rst:1100 +#: ../../c-api/exceptions.rst:1113 msgid ":exc:`SystemExit`" msgstr ":exc:`SystemExit`" -#: ../../c-api/exceptions.rst:1102 +#: ../../c-api/exceptions.rst:1115 msgid ":c:data:`PyExc_TabError`" msgstr ":c:data:`PyExc_TabError`" -#: ../../c-api/exceptions.rst:1102 +#: ../../c-api/exceptions.rst:1115 msgid ":exc:`TabError`" msgstr ":exc:`TabError`" -#: ../../c-api/exceptions.rst:1104 +#: ../../c-api/exceptions.rst:1117 msgid ":c:data:`PyExc_TimeoutError`" msgstr ":c:data:`PyExc_TimeoutError`" -#: ../../c-api/exceptions.rst:1104 +#: ../../c-api/exceptions.rst:1117 msgid ":exc:`TimeoutError`" msgstr ":exc:`TimeoutError`" -#: ../../c-api/exceptions.rst:1106 +#: ../../c-api/exceptions.rst:1119 msgid ":c:data:`PyExc_TypeError`" msgstr ":c:data:`PyExc_TypeError`" -#: ../../c-api/exceptions.rst:1106 +#: ../../c-api/exceptions.rst:1119 msgid ":exc:`TypeError`" msgstr ":exc:`TypeError`" -#: ../../c-api/exceptions.rst:1108 +#: ../../c-api/exceptions.rst:1121 msgid ":c:data:`PyExc_UnboundLocalError`" msgstr ":c:data:`PyExc_UnboundLocalError`" -#: ../../c-api/exceptions.rst:1108 +#: ../../c-api/exceptions.rst:1121 msgid ":exc:`UnboundLocalError`" msgstr ":exc:`UnboundLocalError`" -#: ../../c-api/exceptions.rst:1110 +#: ../../c-api/exceptions.rst:1123 msgid ":c:data:`PyExc_UnicodeDecodeError`" msgstr ":c:data:`PyExc_UnicodeDecodeError`" -#: ../../c-api/exceptions.rst:1110 +#: ../../c-api/exceptions.rst:1123 msgid ":exc:`UnicodeDecodeError`" msgstr ":exc:`UnicodeDecodeError`" -#: ../../c-api/exceptions.rst:1112 +#: ../../c-api/exceptions.rst:1125 msgid ":c:data:`PyExc_UnicodeEncodeError`" msgstr ":c:data:`PyExc_UnicodeEncodeError`" -#: ../../c-api/exceptions.rst:1112 +#: ../../c-api/exceptions.rst:1125 msgid ":exc:`UnicodeEncodeError`" msgstr ":exc:`UnicodeEncodeError`" -#: ../../c-api/exceptions.rst:1114 +#: ../../c-api/exceptions.rst:1127 msgid ":c:data:`PyExc_UnicodeError`" msgstr ":c:data:`PyExc_UnicodeError`" -#: ../../c-api/exceptions.rst:1114 +#: ../../c-api/exceptions.rst:1127 msgid ":exc:`UnicodeError`" msgstr ":exc:`UnicodeError`" -#: ../../c-api/exceptions.rst:1116 +#: ../../c-api/exceptions.rst:1129 msgid ":c:data:`PyExc_UnicodeTranslateError`" msgstr ":c:data:`PyExc_UnicodeTranslateError`" -#: ../../c-api/exceptions.rst:1116 +#: ../../c-api/exceptions.rst:1129 msgid ":exc:`UnicodeTranslateError`" msgstr ":exc:`UnicodeTranslateError`" -#: ../../c-api/exceptions.rst:1118 +#: ../../c-api/exceptions.rst:1131 msgid ":c:data:`PyExc_ValueError`" msgstr ":c:data:`PyExc_ValueError`" -#: ../../c-api/exceptions.rst:1118 +#: ../../c-api/exceptions.rst:1131 msgid ":exc:`ValueError`" msgstr ":exc:`ValueError`" -#: ../../c-api/exceptions.rst:1120 +#: ../../c-api/exceptions.rst:1133 msgid ":c:data:`PyExc_ZeroDivisionError`" msgstr ":c:data:`PyExc_ZeroDivisionError`" -#: ../../c-api/exceptions.rst:1120 +#: ../../c-api/exceptions.rst:1133 msgid ":exc:`ZeroDivisionError`" msgstr ":exc:`ZeroDivisionError`" -#: ../../c-api/exceptions.rst:1123 +#: ../../c-api/exceptions.rst:1136 msgid "" ":c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, :c:data:" "`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, :c:data:" @@ -1493,57 +1502,57 @@ msgstr "" "`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` 和 :c:data:" "`PyExc_TimeoutError` 是在 :pep:`3151` 被引入。" -#: ../../c-api/exceptions.rst:1133 +#: ../../c-api/exceptions.rst:1146 msgid ":c:data:`PyExc_StopAsyncIteration` and :c:data:`PyExc_RecursionError`." msgstr ":c:data:`PyExc_StopAsyncIteration` 和 :c:data:`PyExc_RecursionError`。" -#: ../../c-api/exceptions.rst:1136 +#: ../../c-api/exceptions.rst:1149 msgid ":c:data:`PyExc_ModuleNotFoundError`." msgstr ":c:data:`PyExc_ModuleNotFoundError`。" -#: ../../c-api/exceptions.rst:1139 +#: ../../c-api/exceptions.rst:1152 msgid "These are compatibility aliases to :c:data:`PyExc_OSError`:" msgstr "" -#: ../../c-api/exceptions.rst:1149 +#: ../../c-api/exceptions.rst:1162 msgid ":c:data:`!PyExc_EnvironmentError`" msgstr ":c:data:`!PyExc_EnvironmentError`" -#: ../../c-api/exceptions.rst:1151 +#: ../../c-api/exceptions.rst:1164 msgid ":c:data:`!PyExc_IOError`" msgstr ":c:data:`!PyExc_IOError`" -#: ../../c-api/exceptions.rst:1153 +#: ../../c-api/exceptions.rst:1166 msgid ":c:data:`!PyExc_WindowsError`" msgstr ":c:data:`!PyExc_WindowsError`" -#: ../../c-api/exceptions.rst:1153 +#: ../../c-api/exceptions.rst:1166 msgid "[2]_" msgstr "[2]_" -#: ../../c-api/exceptions.rst:1156 +#: ../../c-api/exceptions.rst:1169 msgid "These aliases used to be separate exception types." msgstr "" -#: ../../c-api/exceptions.rst:1159 ../../c-api/exceptions.rst:1220 +#: ../../c-api/exceptions.rst:1172 ../../c-api/exceptions.rst:1233 msgid "Notes:" msgstr "註解:" -#: ../../c-api/exceptions.rst:1162 +#: ../../c-api/exceptions.rst:1175 msgid "This is a base class for other standard exceptions." msgstr "" -#: ../../c-api/exceptions.rst:1165 +#: ../../c-api/exceptions.rst:1178 msgid "" "Only defined on Windows; protect code that uses this by testing that the " "preprocessor macro ``MS_WINDOWS`` is defined." msgstr "" -#: ../../c-api/exceptions.rst:1171 +#: ../../c-api/exceptions.rst:1184 msgid "Standard Warning Categories" msgstr "" -#: ../../c-api/exceptions.rst:1173 +#: ../../c-api/exceptions.rst:1186 msgid "" "All standard Python warning categories are available as global variables " "whose names are ``PyExc_`` followed by the Python exception name. These have " @@ -1551,393 +1560,393 @@ msgid "" "here are all the variables:" msgstr "" -#: ../../c-api/exceptions.rst:1194 +#: ../../c-api/exceptions.rst:1207 msgid ":c:data:`PyExc_Warning`" msgstr ":c:data:`PyExc_Warning`" -#: ../../c-api/exceptions.rst:1194 +#: ../../c-api/exceptions.rst:1207 msgid ":exc:`Warning`" msgstr ":exc:`Warning`" -#: ../../c-api/exceptions.rst:1194 +#: ../../c-api/exceptions.rst:1207 msgid "[3]_" msgstr "[3]_" -#: ../../c-api/exceptions.rst:1196 +#: ../../c-api/exceptions.rst:1209 msgid ":c:data:`PyExc_BytesWarning`" msgstr ":c:data:`PyExc_BytesWarning`" -#: ../../c-api/exceptions.rst:1196 +#: ../../c-api/exceptions.rst:1209 msgid ":exc:`BytesWarning`" msgstr ":exc:`BytesWarning`" -#: ../../c-api/exceptions.rst:1198 +#: ../../c-api/exceptions.rst:1211 msgid ":c:data:`PyExc_DeprecationWarning`" msgstr ":c:data:`PyExc_DeprecationWarning`" -#: ../../c-api/exceptions.rst:1198 +#: ../../c-api/exceptions.rst:1211 msgid ":exc:`DeprecationWarning`" msgstr ":exc:`DeprecationWarning`" -#: ../../c-api/exceptions.rst:1200 +#: ../../c-api/exceptions.rst:1213 msgid ":c:data:`PyExc_FutureWarning`" msgstr ":c:data:`PyExc_FutureWarning`" -#: ../../c-api/exceptions.rst:1200 +#: ../../c-api/exceptions.rst:1213 msgid ":exc:`FutureWarning`" msgstr ":exc:`FutureWarning`" -#: ../../c-api/exceptions.rst:1202 +#: ../../c-api/exceptions.rst:1215 msgid ":c:data:`PyExc_ImportWarning`" msgstr ":c:data:`PyExc_ImportWarning`" -#: ../../c-api/exceptions.rst:1202 +#: ../../c-api/exceptions.rst:1215 msgid ":exc:`ImportWarning`" msgstr ":exc:`ImportWarning`" -#: ../../c-api/exceptions.rst:1204 +#: ../../c-api/exceptions.rst:1217 msgid ":c:data:`PyExc_PendingDeprecationWarning`" msgstr ":c:data:`PyExc_PendingDeprecationWarning`" -#: ../../c-api/exceptions.rst:1204 +#: ../../c-api/exceptions.rst:1217 msgid ":exc:`PendingDeprecationWarning`" msgstr ":exc:`PendingDeprecationWarning`" -#: ../../c-api/exceptions.rst:1206 +#: ../../c-api/exceptions.rst:1219 msgid ":c:data:`PyExc_ResourceWarning`" msgstr ":c:data:`PyExc_ResourceWarning`" -#: ../../c-api/exceptions.rst:1206 +#: ../../c-api/exceptions.rst:1219 msgid ":exc:`ResourceWarning`" msgstr ":exc:`ResourceWarning`" -#: ../../c-api/exceptions.rst:1208 +#: ../../c-api/exceptions.rst:1221 msgid ":c:data:`PyExc_RuntimeWarning`" msgstr ":c:data:`PyExc_RuntimeWarning`" -#: ../../c-api/exceptions.rst:1208 +#: ../../c-api/exceptions.rst:1221 msgid ":exc:`RuntimeWarning`" msgstr ":exc:`RuntimeWarning`" -#: ../../c-api/exceptions.rst:1210 +#: ../../c-api/exceptions.rst:1223 msgid ":c:data:`PyExc_SyntaxWarning`" msgstr ":c:data:`PyExc_SyntaxWarning`" -#: ../../c-api/exceptions.rst:1210 +#: ../../c-api/exceptions.rst:1223 msgid ":exc:`SyntaxWarning`" msgstr ":exc:`SyntaxWarning`" -#: ../../c-api/exceptions.rst:1212 +#: ../../c-api/exceptions.rst:1225 msgid ":c:data:`PyExc_UnicodeWarning`" msgstr ":c:data:`PyExc_UnicodeWarning`" -#: ../../c-api/exceptions.rst:1212 +#: ../../c-api/exceptions.rst:1225 msgid ":exc:`UnicodeWarning`" msgstr ":exc:`UnicodeWarning`" -#: ../../c-api/exceptions.rst:1214 +#: ../../c-api/exceptions.rst:1227 msgid ":c:data:`PyExc_UserWarning`" msgstr ":c:data:`PyExc_UserWarning`" -#: ../../c-api/exceptions.rst:1214 +#: ../../c-api/exceptions.rst:1227 msgid ":exc:`UserWarning`" msgstr ":exc:`UserWarning`" -#: ../../c-api/exceptions.rst:1217 +#: ../../c-api/exceptions.rst:1230 msgid ":c:data:`PyExc_ResourceWarning`." msgstr ":c:data:`PyExc_ResourceWarning`." -#: ../../c-api/exceptions.rst:1223 +#: ../../c-api/exceptions.rst:1236 msgid "This is a base class for other standard warning categories." msgstr "" -#: ../../c-api/exceptions.rst:170 +#: ../../c-api/exceptions.rst:183 msgid "strerror (C function)" msgstr "strerror(C 函式)" -#: ../../c-api/exceptions.rst:624 ../../c-api/exceptions.rst:655 -#: ../../c-api/exceptions.rst:670 +#: ../../c-api/exceptions.rst:637 ../../c-api/exceptions.rst:668 +#: ../../c-api/exceptions.rst:683 msgid "module" msgstr "module(模組)" -#: ../../c-api/exceptions.rst:624 ../../c-api/exceptions.rst:655 -#: ../../c-api/exceptions.rst:670 +#: ../../c-api/exceptions.rst:637 ../../c-api/exceptions.rst:668 +#: ../../c-api/exceptions.rst:683 msgid "signal" msgstr "signal(訊號)" -#: ../../c-api/exceptions.rst:624 ../../c-api/exceptions.rst:655 +#: ../../c-api/exceptions.rst:637 ../../c-api/exceptions.rst:668 msgid "SIGINT (C macro)" msgstr "SIGINT(C 巨集)" -#: ../../c-api/exceptions.rst:624 ../../c-api/exceptions.rst:655 -#: ../../c-api/exceptions.rst:670 +#: ../../c-api/exceptions.rst:637 ../../c-api/exceptions.rst:668 +#: ../../c-api/exceptions.rst:683 msgid "KeyboardInterrupt (built-in exception)" msgstr "KeyboardInterrupt(內建例外)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_BaseException (C var)" msgstr "PyExc_BaseException(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_Exception (C var)" msgstr "PyExc_Exception(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ArithmeticError (C var)" msgstr "PyExc_ArithmeticError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_AssertionError (C var)" msgstr "PyExc_AssertionError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_AttributeError (C var)" msgstr "PyExc_AttributeError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_BlockingIOError (C var)" msgstr "PyExc_BlockingIOError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_BrokenPipeError (C var)" msgstr "PyExc_BrokenPipeError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_BufferError (C var)" msgstr "PyExc_BufferError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ChildProcessError (C var)" msgstr "PyExc_ChildProcessError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ConnectionAbortedError (C var)" msgstr "PyExc_ConnectionAbortedError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ConnectionError (C var)" msgstr "PyExc_ConnectionError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ConnectionRefusedError (C var)" msgstr "PyExc_ConnectionRefusedError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ConnectionResetError (C var)" msgstr "PyExc_ConnectionResetError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_EOFError (C var)" msgstr "PyExc_EOFError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_FileExistsError (C var)" msgstr "PyExc_FileExistsError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_FileNotFoundError (C var)" msgstr "PyExc_FileNotFoundError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_FloatingPointError (C var)" msgstr "PyExc_FloatingPointError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_GeneratorExit (C var)" msgstr "PyExc_GeneratorExit(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ImportError (C var)" msgstr "PyExc_ImportError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_IndentationError (C var)" msgstr "PyExc_IndentationError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_IndexError (C var)" msgstr "PyExc_IndexError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_InterruptedError (C var)" msgstr "PyExc_InterruptedError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_IsADirectoryError (C var)" msgstr "PyExc_IsADirectoryError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_KeyError (C var)" msgstr "PyExc_KeyError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_KeyboardInterrupt (C var)" msgstr "PyExc_KeyboardInterrupt(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_LookupError (C var)" msgstr "PyExc_LookupError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_MemoryError (C var)" msgstr "PyExc_MemoryError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ModuleNotFoundError (C var)" msgstr "PyExc_ModuleNotFoundError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_NameError (C var)" msgstr "PyExc_NameError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_NotADirectoryError (C var)" msgstr "PyExc_NotADirectoryError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_NotImplementedError (C var)" msgstr "PyExc_NotImplementedError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_OSError (C var)" msgstr "PyExc_OSError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_OverflowError (C var)" msgstr "PyExc_OverflowError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_PermissionError (C var)" msgstr "PyExc_PermissionError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ProcessLookupError (C var)" msgstr "PyExc_ProcessLookupError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_RecursionError (C var)" msgstr "PyExc_RecursionError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ReferenceError (C var)" msgstr "PyExc_ReferenceError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_RuntimeError (C var)" msgstr "PyExc_RuntimeError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_StopAsyncIteration (C var)" msgstr "PyExc_StopAsyncIteration(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_StopIteration (C var)" msgstr "PyExc_StopIteration(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_SyntaxError (C var)" msgstr "PyExc_SyntaxError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_SystemError (C var)" msgstr "PyExc_SystemError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_SystemExit (C var)" msgstr "PyExc_SystemExit(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_TabError (C var)" msgstr "PyExc_TabError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_TimeoutError (C var)" msgstr "PyExc_TimeoutError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_TypeError (C var)" msgstr "PyExc_TypeError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_UnboundLocalError (C var)" msgstr "PyExc_UnboundLocalError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_UnicodeDecodeError (C var)" msgstr "PyExc_UnicodeDecodeError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_UnicodeEncodeError (C var)" msgstr "PyExc_UnicodeEncodeError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_UnicodeError (C var)" msgstr "PyExc_UnicodeError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_UnicodeTranslateError (C var)" msgstr "PyExc_UnicodeTranslateError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ValueError (C var)" msgstr "PyExc_ValueError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ZeroDivisionError (C var)" msgstr "PyExc_ZeroDivisionError(C 變數)" -#: ../../c-api/exceptions.rst:1141 +#: ../../c-api/exceptions.rst:1154 msgid "PyExc_EnvironmentError (C var)" msgstr "PyExc_EnvironmentError(C 變數)" -#: ../../c-api/exceptions.rst:1141 +#: ../../c-api/exceptions.rst:1154 msgid "PyExc_IOError (C var)" msgstr "PyExc_IOError(C 變數)" -#: ../../c-api/exceptions.rst:1141 +#: ../../c-api/exceptions.rst:1154 msgid "PyExc_WindowsError (C var)" msgstr "PyExc_WindowsError(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1191 msgid "PyExc_Warning (C var)" msgstr "PyExc_Warning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1191 msgid "PyExc_BytesWarning (C var)" msgstr "PyExc_BytesWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1191 msgid "PyExc_DeprecationWarning (C var)" msgstr "PyExc_DeprecationWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1191 msgid "PyExc_FutureWarning (C var)" msgstr "PyExc_FutureWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1191 msgid "PyExc_ImportWarning (C var)" msgstr "PyExc_ImportWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1191 msgid "PyExc_PendingDeprecationWarning (C var)" msgstr "PyExc_PendingDeprecationWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1191 msgid "PyExc_ResourceWarning (C var)" msgstr "PyExc_ResourceWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1191 msgid "PyExc_RuntimeWarning (C var)" msgstr "PyExc_RuntimeWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1191 msgid "PyExc_SyntaxWarning (C var)" msgstr "PyExc_SyntaxWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1191 msgid "PyExc_UnicodeWarning (C var)" msgstr "PyExc_UnicodeWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1191 msgid "PyExc_UserWarning (C var)" msgstr "PyExc_UserWarning(C 變數)" diff --git a/c-api/file.po b/c-api/file.po index 869e229878..ccf0d607eb 100644 --- a/c-api/file.po +++ b/c-api/file.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-04 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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-" @@ -111,10 +111,10 @@ msgstr "" "數。" #: ../../c-api/file.rst:68 -msgid "The handler is a function of type:" +msgid "The *handler* is a function of type:" msgstr "" -#: ../../c-api/file.rst:72 +#: ../../c-api/file.rst:73 #, fuzzy msgid "" "Equivalent of :c:expr:`PyObject *(\\*)(PyObject *path, void *userData)`, " @@ -123,7 +123,7 @@ msgstr "" "處理程式是 :c:expr:`PyObject *(\\*)(PyObject *path, void *userData)` 型別的函" "式,其中 *path* 保證為 :c:type:`PyUnicodeObject`。" -#: ../../c-api/file.rst:76 +#: ../../c-api/file.rst:77 msgid "" "The *userData* pointer is passed into the hook function. Since hook " "functions may be called from different runtimes, this pointer should not " @@ -132,7 +132,7 @@ msgstr "" "*userData* 指標被傳遞到掛鉤函式 (hook function) 中。由於可能會從不同的執行環" "境 (runtime) 呼叫掛鉤函式,因此該指標不應直接指向 Python 狀態。" -#: ../../c-api/file.rst:80 +#: ../../c-api/file.rst:81 msgid "" "As this hook is intentionally used during import, avoid importing new " "modules during its execution unless they are known to be frozen or available " @@ -141,7 +141,7 @@ msgstr "" "由於此掛鉤函式是在導入期間有意使用的,因此請避免在其執行期間導入新模組,除非" "它們已知有被凍結或在 ``sys.modules`` 中可用。" -#: ../../c-api/file.rst:84 +#: ../../c-api/file.rst:85 #, fuzzy msgid "" "Once a hook has been set, it cannot be removed or replaced, and later calls " @@ -152,11 +152,11 @@ msgstr "" "`PyFile_SetOpenCodeHook` 將失敗。失敗時,函式回傳 -1 並在直譯器已初始化時設定" "例外。" -#: ../../c-api/file.rst:88 +#: ../../c-api/file.rst:89 msgid "This function is safe to call before :c:func:`Py_Initialize`." msgstr "在 :c:func:`Py_Initialize` 之前呼叫此函式是安全的。" -#: ../../c-api/file.rst:90 +#: ../../c-api/file.rst:91 msgid "" "Raises an :ref:`auditing event ` ``setopencodehook`` with no " "arguments." @@ -164,7 +164,7 @@ msgstr "" "不帶引數地引發一個\\ :ref:`稽核事件 (auditing event) ` " "``setopencodehook``。" -#: ../../c-api/file.rst:100 +#: ../../c-api/file.rst:101 msgid "" "Write object *obj* to file object *p*. The only supported flag for *flags* " "is :c:macro:`Py_PRINT_RAW`; if given, the :func:`str` of the object is " @@ -175,7 +175,7 @@ msgstr "" "`Py_PRINT_RAW`;如果有給定,則寫入物件的 :func:`str` 而不是 :func:`repr`。在" "成功回傳 ``0`` 或在失敗回傳 ``-1``;將設定適當的例外。" -#: ../../c-api/file.rst:108 +#: ../../c-api/file.rst:109 msgid "" "Write string *s* to file object *p*. Return ``0`` on success or ``-1`` on " "failure; the appropriate exception will be set." @@ -195,6 +195,6 @@ msgstr "file(檔案)" msgid "EOFError (built-in exception)" msgstr "EOFError(內建例外)" -#: ../../c-api/file.rst:98 +#: ../../c-api/file.rst:99 msgid "Py_PRINT_RAW (C macro)" msgstr "Py_PRINT_RAW(C 巨集)" diff --git a/c-api/frame.po b/c-api/frame.po index 289f01ebb1..1e518a36e3 100644 --- a/c-api/frame.po +++ b/c-api/frame.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-12-06 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -87,7 +87,7 @@ msgstr "回傳 :term:`strong reference`。結果不能為 ``NULL``。" msgid "Get the *frame* code." msgstr "" -#: ../../c-api/frame.rst:64 ../../c-api/frame.rst:125 +#: ../../c-api/frame.rst:64 ../../c-api/frame.rst:130 msgid "Return a :term:`strong reference`." msgstr "回傳 :term:`strong reference`。" @@ -146,34 +146,43 @@ msgid "" msgstr "" #: ../../c-api/frame.rst:123 -msgid "Get the *frame*'s :attr:`~frame.f_locals` attribute (:class:`dict`)." +msgid "" +"Get the *frame*'s :attr:`~frame.f_locals` attribute. If the frame refers to " +"an :term:`optimized scope`, this returns a write-through proxy object that " +"allows modifying the locals. In all other cases (classes, modules, :func:" +"`exec`, :func:`eval`) it returns the mapping representing the frame locals " +"directly (as described for :func:`locals`)." +msgstr "" + +#: ../../c-api/frame.rst:134 +msgid "As part of :pep:`667`, return a proxy object for optimized scopes." msgstr "" -#: ../../c-api/frame.rst:132 +#: ../../c-api/frame.rst:140 msgid "Return the line number that *frame* is currently executing." msgstr "" -#: ../../c-api/frame.rst:137 +#: ../../c-api/frame.rst:145 msgid "Internal Frames" msgstr "" -#: ../../c-api/frame.rst:139 +#: ../../c-api/frame.rst:147 msgid "Unless using :pep:`523`, you will not need this." msgstr "" -#: ../../c-api/frame.rst:143 +#: ../../c-api/frame.rst:151 msgid "The interpreter's internal frame representation." msgstr "" -#: ../../c-api/frame.rst:149 +#: ../../c-api/frame.rst:157 msgid "Return a :term:`strong reference` to the code object for the frame." msgstr "" -#: ../../c-api/frame.rst:156 +#: ../../c-api/frame.rst:164 msgid "Return the byte offset into the last executed instruction." msgstr "" -#: ../../c-api/frame.rst:163 +#: ../../c-api/frame.rst:171 msgid "" "Return the currently executing line number, or -1 if there is no line number." msgstr "" diff --git a/c-api/hash.po b/c-api/hash.po index dc6a9c0d0d..42324bd36d 100644 --- a/c-api/hash.po +++ b/c-api/hash.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-02-18 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-04-30 00:20+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,7 +22,9 @@ msgid "PyHash API" msgstr "PyHash API" #: ../../c-api/hash.rst:6 -msgid "See also the :c:member:`PyTypeObject.tp_hash` member." +#, fuzzy +msgid "" +"See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`." msgstr "另請參閱 :c:member:`PyTypeObject.tp_hash` 成員。" #: ../../c-api/hash.rst:10 @@ -33,28 +35,70 @@ msgstr "雜湊值型別:有符號整數。" msgid "Hash value type: unsigned integer." msgstr "雜湊值型別:無符號整數。" -#: ../../c-api/hash.rst:23 +#: ../../c-api/hash.rst:22 +msgid "" +"The `Mersenne prime `_ ``P = " +"2**n -1``, used for numeric hash scheme." +msgstr "" + +#: ../../c-api/hash.rst:28 +msgid "The exponent ``n`` of ``P`` in :c:macro:`PyHASH_MODULUS`." +msgstr "" + +#: ../../c-api/hash.rst:34 +msgid "Prime multiplier used in string and various other hashes." +msgstr "" + +#: ../../c-api/hash.rst:40 +msgid "The hash value returned for a positive infinity." +msgstr "" + +#: ../../c-api/hash.rst:46 +msgid "The multiplier used for the imaginary part of a complex number." +msgstr "" + +#: ../../c-api/hash.rst:52 msgid "Hash function definition used by :c:func:`PyHash_GetFuncDef`." msgstr ":c:func:`PyHash_GetFuncDef` 所使用的雜湊函式定義。" -#: ../../c-api/hash.rst:31 +#: ../../c-api/hash.rst:60 msgid "Hash function name (UTF-8 encoded string)." msgstr "雜湊函式名稱(UTF-8 編碼字串)。" -#: ../../c-api/hash.rst:35 +#: ../../c-api/hash.rst:64 msgid "Internal size of the hash value in bits." msgstr "雜湊值的內部大小(以位元為單位)。" -#: ../../c-api/hash.rst:39 +#: ../../c-api/hash.rst:68 msgid "Size of seed input in bits." msgstr "Seed 輸入的大小(以位元為單位)。" -#: ../../c-api/hash.rst:46 +#: ../../c-api/hash.rst:75 msgid "Get the hash function definition." msgstr "取得雜湊函式定義。" -#: ../../c-api/hash.rst:49 +#: ../../c-api/hash.rst:78 msgid ":pep:`456` \"Secure and interchangeable hash algorithm\"." msgstr "" ":pep:`456`\\ 「安全且可交替使用的雜湊演算法 (Secure and interchangeable hash " "algorithm)」。" + +#: ../../c-api/hash.rst:85 +msgid "" +"Hash a pointer value: process the pointer value as an integer (cast it to " +"``uintptr_t`` internally). The pointer is not dereferenced." +msgstr "" + +#: ../../c-api/hash.rst:88 +msgid "The function cannot fail: it cannot return ``-1``." +msgstr "" + +#: ../../c-api/hash.rst:94 +msgid "" +"Generic hashing function that is meant to be put into a type object's " +"``tp_hash`` slot. Its result only depends on the object's identity." +msgstr "" + +#: ../../c-api/hash.rst:99 +msgid "In CPython, it is equivalent to :c:func:`Py_HashPointer`." +msgstr "" diff --git a/c-api/import.po b/c-api/import.po index 965a7f170f..96b3529885 100644 --- a/c-api/import.po +++ b/c-api/import.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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-" @@ -41,13 +41,17 @@ msgid "" "needed anymore." msgstr "" -#: ../../c-api/import.rst:34 +#: ../../c-api/import.rst:29 +msgid "Use :c:func:`PyImport_ImportModule` instead." +msgstr "請改用 :c:func:`PyImport_ImportModule`。" + +#: ../../c-api/import.rst:37 msgid "" "Import a module. This is best described by referring to the built-in Python " "function :func:`__import__`." msgstr "" -#: ../../c-api/import.rst:37 ../../c-api/import.rst:53 +#: ../../c-api/import.rst:40 ../../c-api/import.rst:56 msgid "" "The return value is a new reference to the imported module or top-level " "package, or ``NULL`` with an exception set on failure. Like for :func:" @@ -55,30 +59,30 @@ msgid "" "is normally the top-level package, unless a non-empty *fromlist* was given." msgstr "" -#: ../../c-api/import.rst:43 +#: ../../c-api/import.rst:46 msgid "" "Failing imports remove incomplete module objects, like with :c:func:" "`PyImport_ImportModule`." msgstr "" -#: ../../c-api/import.rst:49 +#: ../../c-api/import.rst:52 msgid "" "Import a module. This is best described by referring to the built-in Python " "function :func:`__import__`, as the standard :func:`__import__` function " "calls this function directly." msgstr "" -#: ../../c-api/import.rst:63 +#: ../../c-api/import.rst:66 msgid "" "Similar to :c:func:`PyImport_ImportModuleLevelObject`, but the name is a " "UTF-8 encoded string instead of a Unicode object." msgstr "" -#: ../../c-api/import.rst:66 +#: ../../c-api/import.rst:69 msgid "Negative values for *level* are no longer accepted." msgstr "" -#: ../../c-api/import.rst:71 +#: ../../c-api/import.rst:74 msgid "" "This is a higher-level interface that calls the current \"import hook " "function\" (with an explicit *level* of 0, meaning absolute import). It " @@ -87,40 +91,59 @@ msgid "" "hooks are installed in the current environment." msgstr "" -#: ../../c-api/import.rst:77 +#: ../../c-api/import.rst:80 msgid "This function always uses absolute imports." msgstr "" -#: ../../c-api/import.rst:82 +#: ../../c-api/import.rst:85 msgid "" "Reload a module. Return a new reference to the reloaded module, or ``NULL`` " "with an exception set on failure (the module still exists in this case)." msgstr "" -#: ../../c-api/import.rst:88 +#: ../../c-api/import.rst:91 +msgid "Return the module object corresponding to a module name." +msgstr "" + +#: ../../c-api/import.rst:93 +msgid "" +"The *name* argument may be of the form ``package.module``. First check the " +"modules dictionary if there's one there, and if not, create a new one and " +"insert it in the modules dictionary." +msgstr "" + +#: ../../c-api/import.rst:97 msgid "" -"Return the module object corresponding to a module name. The *name* " -"argument may be of the form ``package.module``. First check the modules " -"dictionary if there's one there, and if not, create a new one and insert it " -"in the modules dictionary. Return ``NULL`` with an exception set on failure." +"Return a :term:`strong reference` to the module on success. Return ``NULL`` " +"with an exception set on failure." +msgstr "" + +#: ../../c-api/import.rst:100 +msgid "The module name *name* is decoded from UTF-8." msgstr "" -#: ../../c-api/import.rst:95 +#: ../../c-api/import.rst:102 msgid "" "This function does not load or import the module; if the module wasn't " "already loaded, you will get an empty module object. Use :c:func:" -"`PyImport_ImportModule` or one of its variants to import a module. Package " +"`PyImport_ImportModule` or one of its variants to import a module. Package " "structures implied by a dotted name for *name* are not created if not " "already present." msgstr "" -#: ../../c-api/import.rst:105 +#: ../../c-api/import.rst:113 msgid "" -"Similar to :c:func:`PyImport_AddModuleObject`, but the name is a UTF-8 " -"encoded string instead of a Unicode object." +"Similar to :c:func:`PyImport_AddModuleRef`, but return a :term:`borrowed " +"reference` and *name* is a Python :class:`str` object." msgstr "" -#: ../../c-api/import.rst:113 +#: ../../c-api/import.rst:121 +msgid "" +"Similar to :c:func:`PyImport_AddModuleRef`, but return a :term:`borrowed " +"reference`." +msgstr "" + +#: ../../c-api/import.rst:129 msgid "" "Given a module name (possibly of the form ``package.module``) and a code " "object read from a Python bytecode file or obtained from the built-in " @@ -134,7 +157,7 @@ msgid "" "to the module author's intents) state." msgstr "" -#: ../../c-api/import.rst:123 +#: ../../c-api/import.rst:139 msgid "" "The module's :attr:`__spec__` and :attr:`__loader__` will be set, if not set " "already, with the appropriate values. The spec's loader will be set to the " @@ -142,61 +165,61 @@ msgid "" "machinery.SourceFileLoader` otherwise." msgstr "" -#: ../../c-api/import.rst:128 +#: ../../c-api/import.rst:144 msgid "" "The module's :attr:`__file__` attribute will be set to the code object's :" "attr:`~codeobject.co_filename`. If applicable, :attr:`__cached__` will also " "be set." msgstr "" -#: ../../c-api/import.rst:132 +#: ../../c-api/import.rst:148 msgid "" "This function will reload the module if it was already imported. See :c:" "func:`PyImport_ReloadModule` for the intended way to reload a module." msgstr "" -#: ../../c-api/import.rst:135 +#: ../../c-api/import.rst:151 msgid "" "If *name* points to a dotted name of the form ``package.module``, any " "package structures not already created will still not be created." msgstr "" -#: ../../c-api/import.rst:138 +#: ../../c-api/import.rst:154 msgid "" "See also :c:func:`PyImport_ExecCodeModuleEx` and :c:func:" "`PyImport_ExecCodeModuleWithPathnames`." msgstr "" -#: ../../c-api/import.rst:141 +#: ../../c-api/import.rst:157 msgid "" "The setting of :attr:`__cached__` and :attr:`__loader__` is deprecated. See :" "class:`~importlib.machinery.ModuleSpec` for alternatives." msgstr "" -#: ../../c-api/import.rst:149 +#: ../../c-api/import.rst:165 msgid "" "Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`__file__` attribute " "of the module object is set to *pathname* if it is non-``NULL``." msgstr "" -#: ../../c-api/import.rst:152 +#: ../../c-api/import.rst:168 msgid "See also :c:func:`PyImport_ExecCodeModuleWithPathnames`." msgstr "也請見 :c:func:`PyImport_ExecCodeModuleWithPathnames`。" -#: ../../c-api/import.rst:157 +#: ../../c-api/import.rst:173 msgid "" "Like :c:func:`PyImport_ExecCodeModuleEx`, but the :attr:`__cached__` " "attribute of the module object is set to *cpathname* if it is non-``NULL``. " "Of the three functions, this is the preferred one to use." msgstr "" -#: ../../c-api/import.rst:163 +#: ../../c-api/import.rst:179 msgid "" "Setting :attr:`__cached__` is deprecated. See :class:`~importlib.machinery." "ModuleSpec` for alternatives." msgstr "" -#: ../../c-api/import.rst:170 +#: ../../c-api/import.rst:186 msgid "" "Like :c:func:`PyImport_ExecCodeModuleObject`, but *name*, *pathname* and " "*cpathname* are UTF-8 encoded strings. Attempts are also made to figure out " @@ -204,48 +227,48 @@ msgid "" "set to ``NULL``." msgstr "" -#: ../../c-api/import.rst:176 +#: ../../c-api/import.rst:192 msgid "" "Uses :func:`!imp.source_from_cache` in calculating the source path if only " "the bytecode path is provided." msgstr "" -#: ../../c-api/import.rst:179 +#: ../../c-api/import.rst:195 msgid "No longer uses the removed :mod:`!imp` module." msgstr "不再使用已被移除的 :mod:`!imp` 模組。" -#: ../../c-api/import.rst:185 +#: ../../c-api/import.rst:201 msgid "" "Return the magic number for Python bytecode files (a.k.a. :file:`.pyc` " "file). The magic number should be present in the first four bytes of the " "bytecode file, in little-endian byte order. Returns ``-1`` on error." msgstr "" -#: ../../c-api/import.rst:189 +#: ../../c-api/import.rst:205 msgid "Return value of ``-1`` upon failure." msgstr "當失敗時回傳 ``-1``。" -#: ../../c-api/import.rst:195 +#: ../../c-api/import.rst:211 msgid "" "Return the magic tag string for :pep:`3147` format Python bytecode file " "names. Keep in mind that the value at ``sys.implementation.cache_tag`` is " "authoritative and should be used instead of this function." msgstr "" -#: ../../c-api/import.rst:203 +#: ../../c-api/import.rst:219 msgid "" "Return the dictionary used for the module administration (a.k.a. ``sys." "modules``). Note that this is a per-interpreter variable." msgstr "" -#: ../../c-api/import.rst:208 +#: ../../c-api/import.rst:224 msgid "" "Return the already imported module with the given name. If the module has " "not been imported yet then returns ``NULL`` but does not set an error. " "Returns ``NULL`` and sets an error if the lookup failed." msgstr "" -#: ../../c-api/import.rst:216 +#: ../../c-api/import.rst:232 msgid "" "Return a finder object for a :data:`sys.path`/:attr:`!pkg.__path__` item " "*path*, possibly by fetching it from the :data:`sys.path_importer_cache` " @@ -256,7 +279,7 @@ msgid "" "path_importer_cache`. Return a new reference to the finder object." msgstr "" -#: ../../c-api/import.rst:227 +#: ../../c-api/import.rst:243 msgid "" "Load a frozen module named *name*. Return ``1`` for success, ``0`` if the " "module is not found, and ``-1`` with an exception set if the initialization " @@ -265,17 +288,17 @@ msgid "" "the module if it was already imported.)" msgstr "" -#: ../../c-api/import.rst:235 +#: ../../c-api/import.rst:251 msgid "The ``__file__`` attribute is no longer set on the module." msgstr "" -#: ../../c-api/import.rst:241 +#: ../../c-api/import.rst:257 msgid "" "Similar to :c:func:`PyImport_ImportFrozenModuleObject`, but the name is a " "UTF-8 encoded string instead of a Unicode object." msgstr "" -#: ../../c-api/import.rst:249 +#: ../../c-api/import.rst:265 msgid "" "This is the structure type definition for frozen module descriptors, as " "generated by the :program:`freeze` utility (see :file:`Tools/freeze/` in the " @@ -283,7 +306,7 @@ msgid "" "h`, is::" msgstr "" -#: ../../c-api/import.rst:254 +#: ../../c-api/import.rst:270 msgid "" "struct _frozen {\n" " const char *name;\n" @@ -299,13 +322,13 @@ msgstr "" " bool is_package;\n" "};" -#: ../../c-api/import.rst:261 +#: ../../c-api/import.rst:277 msgid "" "The new ``is_package`` field indicates whether the module is a package or " "not. This replaces setting the ``size`` field to a negative value." msgstr "" -#: ../../c-api/import.rst:267 +#: ../../c-api/import.rst:283 msgid "" "This pointer is initialized to point to an array of :c:struct:`_frozen` " "records, terminated by one whose members are all ``NULL`` or zero. When a " @@ -314,7 +337,7 @@ msgid "" "frozen modules." msgstr "" -#: ../../c-api/import.rst:275 +#: ../../c-api/import.rst:291 msgid "" "Add a single module to the existing table of built-in modules. This is a " "convenience wrapper around :c:func:`PyImport_ExtendInittab`, returning " @@ -324,7 +347,7 @@ msgid "" "before :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/import.rst:285 +#: ../../c-api/import.rst:301 msgid "" "Structure describing a single entry in the list of built-in modules. " "Programs which embed Python may use an array of these structures in " @@ -332,15 +355,15 @@ msgid "" "built-in modules. The structure consists of two members:" msgstr "" -#: ../../c-api/import.rst:293 +#: ../../c-api/import.rst:309 msgid "The module name, as an ASCII encoded string." msgstr "" -#: ../../c-api/import.rst:297 +#: ../../c-api/import.rst:313 msgid "Initialization function for a module built into the interpreter." msgstr "" -#: ../../c-api/import.rst:302 +#: ../../c-api/import.rst:318 msgid "" "Add a collection of modules to the table of built-in modules. The *newtab* " "array must end with a sentinel entry which contains ``NULL`` for the :c:" @@ -351,7 +374,7 @@ msgid "" "before :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/import.rst:309 +#: ../../c-api/import.rst:325 msgid "" "If Python is initialized multiple times, :c:func:`PyImport_AppendInittab` " "or :c:func:`PyImport_ExtendInittab` must be called before each Python " @@ -374,18 +397,18 @@ msgstr "__all__(套件變數)" msgid "modules (in module sys)" msgstr "modules(sys 模組中)" -#: ../../c-api/import.rst:32 ../../c-api/import.rst:111 +#: ../../c-api/import.rst:35 ../../c-api/import.rst:127 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/import.rst:32 +#: ../../c-api/import.rst:35 msgid "__import__" msgstr "__import__" -#: ../../c-api/import.rst:111 +#: ../../c-api/import.rst:127 msgid "compile" msgstr "compile(編譯)" -#: ../../c-api/import.rst:247 +#: ../../c-api/import.rst:263 msgid "freeze utility" msgstr "freeze utility(凍結工具)" diff --git a/c-api/init.po b/c-api/init.po index 455a041f48..9ca9aecb98 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -74,98 +74,94 @@ msgid ":c:func:`PyObject_SetArenaAllocator`" msgstr ":c:func:`PyObject_SetArenaAllocator`" #: ../../c-api/init.rst:32 -msgid ":c:func:`Py_SetPath`" -msgstr ":c:func:`Py_SetPath`" - -#: ../../c-api/init.rst:33 msgid ":c:func:`Py_SetProgramName`" msgstr ":c:func:`Py_SetProgramName`" -#: ../../c-api/init.rst:34 +#: ../../c-api/init.rst:33 msgid ":c:func:`Py_SetPythonHome`" msgstr ":c:func:`Py_SetPythonHome`" -#: ../../c-api/init.rst:35 -msgid ":c:func:`Py_SetStandardStreamEncoding`" -msgstr ":c:func:`Py_SetStandardStreamEncoding`" - -#: ../../c-api/init.rst:36 -msgid ":c:func:`PySys_AddWarnOption`" -msgstr ":c:func:`PySys_AddWarnOption`" - -#: ../../c-api/init.rst:37 -msgid ":c:func:`PySys_AddXOption`" -msgstr ":c:func:`PySys_AddXOption`" - -#: ../../c-api/init.rst:38 +#: ../../c-api/init.rst:34 msgid ":c:func:`PySys_ResetWarnOptions`" msgstr ":c:func:`PySys_ResetWarnOptions`" -#: ../../c-api/init.rst:40 +#: ../../c-api/init.rst:36 msgid "Informative functions:" msgstr "" -#: ../../c-api/init.rst:42 +#: ../../c-api/init.rst:38 msgid ":c:func:`Py_IsInitialized`" msgstr ":c:func:`Py_IsInitialized`" -#: ../../c-api/init.rst:43 +#: ../../c-api/init.rst:39 msgid ":c:func:`PyMem_GetAllocator`" msgstr ":c:func:`PyMem_GetAllocator`" -#: ../../c-api/init.rst:44 +#: ../../c-api/init.rst:40 msgid ":c:func:`PyObject_GetArenaAllocator`" msgstr ":c:func:`PyObject_GetArenaAllocator`" -#: ../../c-api/init.rst:45 +#: ../../c-api/init.rst:41 msgid ":c:func:`Py_GetBuildInfo`" msgstr ":c:func:`Py_GetBuildInfo`" -#: ../../c-api/init.rst:46 +#: ../../c-api/init.rst:42 msgid ":c:func:`Py_GetCompiler`" msgstr ":c:func:`Py_GetCompiler`" -#: ../../c-api/init.rst:47 +#: ../../c-api/init.rst:43 msgid ":c:func:`Py_GetCopyright`" msgstr ":c:func:`Py_GetCopyright`" -#: ../../c-api/init.rst:48 +#: ../../c-api/init.rst:44 msgid ":c:func:`Py_GetPlatform`" msgstr ":c:func:`Py_GetPlatform`" -#: ../../c-api/init.rst:49 +#: ../../c-api/init.rst:45 msgid ":c:func:`Py_GetVersion`" msgstr ":c:func:`Py_GetVersion`" -#: ../../c-api/init.rst:51 +#: ../../c-api/init.rst:47 msgid "Utilities:" msgstr "" -#: ../../c-api/init.rst:53 +#: ../../c-api/init.rst:49 msgid ":c:func:`Py_DecodeLocale`" msgstr ":c:func:`Py_DecodeLocale`" -#: ../../c-api/init.rst:55 +#: ../../c-api/init.rst:51 msgid "Memory allocators:" msgstr "" -#: ../../c-api/init.rst:57 +#: ../../c-api/init.rst:53 msgid ":c:func:`PyMem_RawMalloc`" msgstr ":c:func:`PyMem_RawMalloc`" -#: ../../c-api/init.rst:58 +#: ../../c-api/init.rst:54 msgid ":c:func:`PyMem_RawRealloc`" msgstr ":c:func:`PyMem_RawRealloc`" -#: ../../c-api/init.rst:59 +#: ../../c-api/init.rst:55 msgid ":c:func:`PyMem_RawCalloc`" msgstr ":c:func:`PyMem_RawCalloc`" -#: ../../c-api/init.rst:60 +#: ../../c-api/init.rst:56 msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" -#: ../../c-api/init.rst:64 +#: ../../c-api/init.rst:58 +msgid "Synchronization:" +msgstr "" + +#: ../../c-api/init.rst:60 +msgid ":c:func:`PyMutex_Lock`" +msgstr ":c:func:`PyMutex_Lock`" + +#: ../../c-api/init.rst:61 +msgid ":c:func:`PyMutex_Unlock`" +msgstr ":c:func:`PyMutex_Unlock`" + +#: ../../c-api/init.rst:65 msgid "" "The following functions **should not be called** before :c:func:" "`Py_Initialize`: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:" @@ -174,18 +170,18 @@ msgid "" "`Py_GetProgramName` and :c:func:`PyEval_InitThreads`." msgstr "" -#: ../../c-api/init.rst:74 +#: ../../c-api/init.rst:75 msgid "Global configuration variables" msgstr "" -#: ../../c-api/init.rst:76 +#: ../../c-api/init.rst:77 msgid "" "Python has variables for the global configuration to control different " "features and options. By default, these flags are controlled by :ref:" "`command line options `." msgstr "" -#: ../../c-api/init.rst:80 +#: ../../c-api/init.rst:81 msgid "" "When a flag is set by an option, the value of the flag is the number of " "times that the option was set. For example, ``-b`` sets :c:data:" @@ -193,108 +189,108 @@ msgid "" "2." msgstr "" -#: ../../c-api/init.rst:86 +#: ../../c-api/init.rst:87 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "bytes_warning` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:90 +#: ../../c-api/init.rst:91 msgid "" "Issue a warning when comparing :class:`bytes` or :class:`bytearray` with :" "class:`str` or :class:`bytes` with :class:`int`. Issue an error if greater " "or equal to ``2``." msgstr "" -#: ../../c-api/init.rst:94 +#: ../../c-api/init.rst:95 msgid "Set by the :option:`-b` option." msgstr "由 :option:`-b` 選項設定。" -#: ../../c-api/init.rst:100 +#: ../../c-api/init.rst:101 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "parser_debug` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:104 +#: ../../c-api/init.rst:105 msgid "" "Turn on parser debugging output (for expert only, depending on compilation " "options)." msgstr "" -#: ../../c-api/init.rst:107 +#: ../../c-api/init.rst:108 msgid "" "Set by the :option:`-d` option and the :envvar:`PYTHONDEBUG` environment " "variable." msgstr "由 :option:`-d` 選項與 :envvar:`PYTHONDEBUG` 環境變數設定。" -#: ../../c-api/init.rst:114 +#: ../../c-api/init.rst:115 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "write_bytecode` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:118 +#: ../../c-api/init.rst:119 msgid "" "If set to non-zero, Python won't try to write ``.pyc`` files on the import " "of source modules." msgstr "" -#: ../../c-api/init.rst:121 +#: ../../c-api/init.rst:122 msgid "" "Set by the :option:`-B` option and the :envvar:`PYTHONDONTWRITEBYTECODE` " "environment variable." msgstr "" "由 :option:`-B` 選項與 :envvar:`PYTHONDONTWRITEBYTECODE` 環境變數設定。" -#: ../../c-api/init.rst:128 +#: ../../c-api/init.rst:129 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "pathconfig_warnings` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:132 +#: ../../c-api/init.rst:133 msgid "" "Suppress error messages when calculating the module search path in :c:func:" "`Py_GetPath`." msgstr "" -#: ../../c-api/init.rst:135 +#: ../../c-api/init.rst:136 msgid "Private flag used by ``_freeze_module`` and ``frozenmain`` programs." msgstr "" -#: ../../c-api/init.rst:141 +#: ../../c-api/init.rst:142 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "hash_seed` and :c:member:`PyConfig.use_hash_seed` should be used instead, " "see :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:146 +#: ../../c-api/init.rst:147 msgid "" "Set to ``1`` if the :envvar:`PYTHONHASHSEED` environment variable is set to " "a non-empty string." msgstr "" "如果環境變數 :envvar:`PYTHONHASHSEED` 被設定為一個非空字串則設為 ``1``。" -#: ../../c-api/init.rst:149 +#: ../../c-api/init.rst:150 msgid "" "If the flag is non-zero, read the :envvar:`PYTHONHASHSEED` environment " "variable to initialize the secret hash seed." msgstr "" -#: ../../c-api/init.rst:156 +#: ../../c-api/init.rst:157 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "use_environment` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:160 +#: ../../c-api/init.rst:161 msgid "" "Ignore all :envvar:`!PYTHON*` environment variables, e.g. :envvar:" "`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." @@ -302,73 +298,73 @@ msgstr "" "忽略所有可能被設定的 :envvar:`!PYTHON*` 環境變數,例如 :envvar:`PYTHONPATH` " "與 :envvar:`PYTHONHOME`。" -#: ../../c-api/init.rst:163 +#: ../../c-api/init.rst:164 msgid "Set by the :option:`-E` and :option:`-I` options." msgstr "由 :option:`-E` 與 :option:`-I` 選項設定。" -#: ../../c-api/init.rst:169 +#: ../../c-api/init.rst:170 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "inspect` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:173 +#: ../../c-api/init.rst:174 msgid "" "When a script is passed as first argument or the :option:`-c` option is " "used, enter interactive mode after executing the script or the command, even " "when :data:`sys.stdin` does not appear to be a terminal." msgstr "" -#: ../../c-api/init.rst:177 +#: ../../c-api/init.rst:178 msgid "" "Set by the :option:`-i` option and the :envvar:`PYTHONINSPECT` environment " "variable." msgstr "由 :option:`-i` 選項與 :envvar:`PYTHONINSPECT` 環境變數設定。" -#: ../../c-api/init.rst:184 +#: ../../c-api/init.rst:185 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "interactive` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:188 +#: ../../c-api/init.rst:189 msgid "Set by the :option:`-i` option." msgstr "由 :option:`-i` 選項設定。" -#: ../../c-api/init.rst:194 +#: ../../c-api/init.rst:195 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "isolated` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:198 +#: ../../c-api/init.rst:199 msgid "" "Run Python in isolated mode. In isolated mode :data:`sys.path` contains " "neither the script's directory nor the user's site-packages directory." msgstr "" -#: ../../c-api/init.rst:201 +#: ../../c-api/init.rst:202 msgid "Set by the :option:`-I` option." msgstr "由 :option:`-i` 選項設定。" -#: ../../c-api/init.rst:209 +#: ../../c-api/init.rst:210 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyPreConfig." "legacy_windows_fs_encoding` should be used instead, see :ref:`Python " "Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:213 +#: ../../c-api/init.rst:214 msgid "" "If the flag is non-zero, use the ``mbcs`` encoding with ``replace`` error " "handler, instead of the UTF-8 encoding with ``surrogatepass`` error handler, " "for the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/init.rst:217 +#: ../../c-api/init.rst:218 msgid "" "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment " "variable is set to a non-empty string." @@ -376,45 +372,45 @@ msgstr "" "如果環境變數 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 被設定為一個非空字串則設" "為 ``1``。" -#: ../../c-api/init.rst:220 +#: ../../c-api/init.rst:221 msgid "See :pep:`529` for more details." msgstr "更多詳情請見 :pep:`529`。" -#: ../../c-api/init.rst:222 ../../c-api/init.rst:240 +#: ../../c-api/init.rst:223 ../../c-api/init.rst:241 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../c-api/init.rst:228 +#: ../../c-api/init.rst:229 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "legacy_windows_stdio` should be used instead, see :ref:`Python " "Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:232 +#: ../../c-api/init.rst:233 msgid "" "If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!io." "_WindowsConsoleIO` for :mod:`sys` standard streams." msgstr "" -#: ../../c-api/init.rst:235 +#: ../../c-api/init.rst:236 msgid "" "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSSTDIO` environment variable " "is set to a non-empty string." msgstr "" -#: ../../c-api/init.rst:238 +#: ../../c-api/init.rst:239 msgid "See :pep:`528` for more details." msgstr "更多詳情請見 :pep:`528`。" -#: ../../c-api/init.rst:246 +#: ../../c-api/init.rst:247 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "site_import` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:250 +#: ../../c-api/init.rst:251 msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " @@ -422,24 +418,24 @@ msgid "" "main` if you want them to be triggered)." msgstr "" -#: ../../c-api/init.rst:255 +#: ../../c-api/init.rst:256 msgid "Set by the :option:`-S` option." msgstr "由 :option:`-S` 選項設定。" -#: ../../c-api/init.rst:261 +#: ../../c-api/init.rst:262 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "user_site_directory` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:265 +#: ../../c-api/init.rst:266 msgid "" "Don't add the :data:`user site-packages directory ` to :data:" "`sys.path`." msgstr "" -#: ../../c-api/init.rst:268 +#: ../../c-api/init.rst:269 msgid "" "Set by the :option:`-s` and :option:`-I` options, and the :envvar:" "`PYTHONNOUSERSITE` environment variable." @@ -447,60 +443,60 @@ msgstr "" "由 :option:`-s` 選項、:option:`-I` 選項與 :envvar:`PYTHONNOUSERSITE` 環境變數" "設定。" -#: ../../c-api/init.rst:275 +#: ../../c-api/init.rst:276 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "optimization_level` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:279 +#: ../../c-api/init.rst:280 msgid "" "Set by the :option:`-O` option and the :envvar:`PYTHONOPTIMIZE` environment " "variable." msgstr "由 :option:`-O` 選項與 :envvar:`PYTHONOPTIMIZE` 環境變數設定。" -#: ../../c-api/init.rst:286 +#: ../../c-api/init.rst:287 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "quiet` should be used instead, see :ref:`Python Initialization Configuration " "`." msgstr "" -#: ../../c-api/init.rst:290 +#: ../../c-api/init.rst:291 msgid "" "Don't display the copyright and version messages even in interactive mode." msgstr "" -#: ../../c-api/init.rst:292 +#: ../../c-api/init.rst:293 msgid "Set by the :option:`-q` option." msgstr "由 :option:`-q` 選項設定。" -#: ../../c-api/init.rst:300 +#: ../../c-api/init.rst:301 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "buffered_stdio` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:304 +#: ../../c-api/init.rst:305 msgid "Force the stdout and stderr streams to be unbuffered." msgstr "" -#: ../../c-api/init.rst:306 +#: ../../c-api/init.rst:307 msgid "" "Set by the :option:`-u` option and the :envvar:`PYTHONUNBUFFERED` " "environment variable." msgstr "由 :option:`-u` 選項與 :envvar:`PYTHONUNBUFFERED` 環境變數設定。" -#: ../../c-api/init.rst:313 +#: ../../c-api/init.rst:314 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "verbose` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:317 +#: ../../c-api/init.rst:318 msgid "" "Print a message each time a module is initialized, showing the place " "(filename or built-in module) from which it is loaded. If greater or equal " @@ -508,29 +504,30 @@ msgid "" "for a module. Also provides information on module cleanup at exit." msgstr "" -#: ../../c-api/init.rst:322 +#: ../../c-api/init.rst:323 msgid "" "Set by the :option:`-v` option and the :envvar:`PYTHONVERBOSE` environment " "variable." msgstr "由 :option:`-v` 選項與 :envvar:`PYTHONVERBOSE` 環境變數設定。" -#: ../../c-api/init.rst:329 +#: ../../c-api/init.rst:330 msgid "Initializing and finalizing the interpreter" msgstr "" -#: ../../c-api/init.rst:347 +#: ../../c-api/init.rst:345 msgid "" "Initialize the Python interpreter. In an application embedding Python, " "this should be called before using any other Python/C API functions; see :" "ref:`Before Python Initialization ` for the few exceptions." msgstr "" -#: ../../c-api/init.rst:351 +#: ../../c-api/init.rst:349 msgid "" "This initializes the table of loaded modules (``sys.modules``), and creates " "the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. It " "also initializes the module search path (``sys.path``). It does not set " -"``sys.argv``; use :c:func:`PySys_SetArgvEx` for that. This is a no-op when " +"``sys.argv``; use the new :c:type:`PyConfig` API of the :ref:`Python " +"Initialization Configuration ` for that. This is a no-op when " "called for a second time (without calling :c:func:`Py_FinalizeEx` first). " "There is no return value; it is a fatal error if the initialization fails." msgstr "" @@ -563,6 +560,12 @@ msgstr "" #: ../../c-api/init.rst:386 msgid "" +"Return true (non-zero) if the main Python interpreter is :term:`shutting " +"down `. Return false (zero) otherwise." +msgstr "" + +#: ../../c-api/init.rst:394 +msgid "" "Undo all initializations made by :c:func:`Py_Initialize` and subsequent use " "of Python/C API functions, and destroy all sub-interpreters (see :c:func:" "`Py_NewInterpreter` below) that were created and not yet destroyed since the " @@ -571,7 +574,7 @@ msgid "" "second time (without calling :c:func:`Py_Initialize` again first)." msgstr "" -#: ../../c-api/init.rst:393 +#: ../../c-api/init.rst:401 msgid "" "Since this is the reverse of :c:func:`Py_Initialize`, it should be called in " "the same thread with the same interpreter active. That means the main " @@ -579,13 +582,13 @@ msgid "" "`Py_RunMain` is running." msgstr "" -#: ../../c-api/init.rst:398 +#: ../../c-api/init.rst:406 msgid "" "Normally the return value is ``0``. If there were errors during finalization " "(flushing buffered data), ``-1`` is returned." msgstr "" -#: ../../c-api/init.rst:402 +#: ../../c-api/init.rst:410 msgid "" "This function is provided for a number of reasons. An embedding application " "might want to restart Python without having to restart the application " @@ -596,7 +599,7 @@ msgid "" "Python before exiting from the application." msgstr "" -#: ../../c-api/init.rst:410 +#: ../../c-api/init.rst:418 msgid "" "**Bugs and caveats:** The destruction of modules and objects in modules is " "done in random order; this may cause destructors (:meth:`~object.__del__` " @@ -611,7 +614,7 @@ msgid "" "more than once." msgstr "" -#: ../../c-api/init.rst:421 +#: ../../c-api/init.rst:429 msgid "" "Raises an :ref:`auditing event ` ``cpython." "_PySys_ClearAuditHooks`` with no arguments." @@ -619,68 +622,24 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "_PySys_ClearAuditHooks``。" -#: ../../c-api/init.rst:427 +#: ../../c-api/init.rst:435 msgid "" "This is a backwards-compatible version of :c:func:`Py_FinalizeEx` that " "disregards the return value." msgstr "" -#: ../../c-api/init.rst:432 +#: ../../c-api/init.rst:440 msgid "Process-wide parameters" msgstr "" -#: ../../c-api/init.rst:442 -msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"stdio_encoding` and :c:member:`PyConfig.stdio_errors` should be used " -"instead, see :ref:`Python Initialization Configuration `." -msgstr "" - -#: ../../c-api/init.rst:447 -msgid "" -"This function should be called before :c:func:`Py_Initialize`, if it is " -"called at all. It specifies which encoding and error handling to use with " -"standard IO, with the same meanings as in :func:`str.encode`." -msgstr "" - -#: ../../c-api/init.rst:451 -msgid "" -"It overrides :envvar:`PYTHONIOENCODING` values, and allows embedding code to " -"control IO encoding when the environment variable does not work." -msgstr "" - -#: ../../c-api/init.rst:454 -msgid "" -"*encoding* and/or *errors* may be ``NULL`` to use :envvar:`PYTHONIOENCODING` " -"and/or default values (depending on other settings)." -msgstr "" - -#: ../../c-api/init.rst:458 -msgid "" -"Note that :data:`sys.stderr` always uses the \"backslashreplace\" error " -"handler, regardless of this (or any other) setting." -msgstr "" - -#: ../../c-api/init.rst:461 -msgid "" -"If :c:func:`Py_FinalizeEx` is called, this function will need to be called " -"again in order to affect subsequent calls to :c:func:`Py_Initialize`." -msgstr "" - -#: ../../c-api/init.rst:464 -msgid "" -"Returns ``0`` if successful, a nonzero value on error (e.g. calling after " -"the interpreter has already been initialized)." -msgstr "" - -#: ../../c-api/init.rst:479 +#: ../../c-api/init.rst:450 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "program_name` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:483 +#: ../../c-api/init.rst:454 msgid "" "This function should be called before :c:func:`Py_Initialize` is called for " "the first time, if it is called at all. It tells the interpreter the value " @@ -694,36 +653,41 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:494 +#: ../../c-api/init.rst:465 ../../c-api/init.rst:704 ../../c-api/init.rst:740 +#: ../../c-api/init.rst:766 msgid "" "Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" -"`wchar_t *` string." +"`wchar_*` string." msgstr "" -#: ../../c-api/init.rst:504 +#: ../../c-api/init.rst:473 msgid "" -"Return the program name set with :c:func:`Py_SetProgramName`, or the " +"Return the program name set with :c:member:`PyConfig.program_name`, or the " "default. The returned string points into static storage; the caller should " "not modify its value." msgstr "" -#: ../../c-api/init.rst:508 ../../c-api/init.rst:527 ../../c-api/init.rst:568 -#: ../../c-api/init.rst:587 ../../c-api/init.rst:611 ../../c-api/init.rst:834 +#: ../../c-api/init.rst:477 ../../c-api/init.rst:499 ../../c-api/init.rst:543 +#: ../../c-api/init.rst:564 ../../c-api/init.rst:590 ../../c-api/init.rst:778 msgid "" "This function should not be called before :c:func:`Py_Initialize`, otherwise " "it returns ``NULL``." msgstr "此函式不應該在 :c:func:`Py_Initialize` 之前呼叫,否則會回傳 ``NULL``。" -#: ../../c-api/init.rst:511 ../../c-api/init.rst:530 ../../c-api/init.rst:571 -#: ../../c-api/init.rst:590 ../../c-api/init.rst:616 ../../c-api/init.rst:837 +#: ../../c-api/init.rst:480 ../../c-api/init.rst:502 ../../c-api/init.rst:546 +#: ../../c-api/init.rst:567 ../../c-api/init.rst:595 ../../c-api/init.rst:781 msgid "It now returns ``NULL`` if called before :c:func:`Py_Initialize`." msgstr "如果在 :c:func:`Py_Initialize` 之前呼叫,現在會回傳 ``NULL``。" -#: ../../c-api/init.rst:517 +#: ../../c-api/init.rst:483 ../../c-api/init.rst:570 +msgid "Get :data:`sys.executable` instead." +msgstr "" + +#: ../../c-api/init.rst:489 msgid "" "Return the *prefix* for installed platform-independent files. This is " "derived through a number of complicated rules from the program name set " -"with :c:func:`Py_SetProgramName` and some environment variables; for " +"with :c:member:`PyConfig.program_name` and some environment variables; for " "example, if the program name is ``'/usr/local/bin/python'``, the prefix is " "``'/usr/local'``. The returned string points into static storage; the caller " "should not modify its value. This corresponds to the :makevar:`prefix` " @@ -733,11 +697,15 @@ msgid "" "also the next function." msgstr "" -#: ../../c-api/init.rst:536 +#: ../../c-api/init.rst:505 +msgid "Get :data:`sys.prefix` instead." +msgstr "" + +#: ../../c-api/init.rst:511 msgid "" "Return the *exec-prefix* for installed platform-*dependent* files. This is " "derived through a number of complicated rules from the program name set " -"with :c:func:`Py_SetProgramName` and some environment variables; for " +"with :c:member:`PyConfig.program_name` and some environment variables; for " "example, if the program name is ``'/usr/local/bin/python'``, the exec-prefix " "is ``'/usr/local'``. The returned string points into static storage; the " "caller should not modify its value. This corresponds to the :makevar:" @@ -747,7 +715,7 @@ msgid "" "on Unix." msgstr "" -#: ../../c-api/init.rst:546 +#: ../../c-api/init.rst:521 msgid "" "Background: The exec-prefix differs from the prefix when platform dependent " "files (such as executables and shared libraries) are installed in a " @@ -756,7 +724,7 @@ msgid "" "independent may be installed in :file:`/usr/local`." msgstr "" -#: ../../c-api/init.rst:552 +#: ../../c-api/init.rst:527 msgid "" "Generally speaking, a platform is a combination of hardware and software " "families, e.g. Sparc machines running the Solaris 2.x operating system are " @@ -770,7 +738,7 @@ msgid "" "independent from the Python version by which they were compiled!)." msgstr "" -#: ../../c-api/init.rst:563 +#: ../../c-api/init.rst:538 msgid "" "System administrators will know how to configure the :program:`mount` or :" "program:`automount` programs to share :file:`/usr/local` between platforms " @@ -778,19 +746,23 @@ msgid "" "platform." msgstr "" -#: ../../c-api/init.rst:581 +#: ../../c-api/init.rst:549 +msgid "Get :data:`sys.exec_prefix` instead." +msgstr "" + +#: ../../c-api/init.rst:558 msgid "" "Return the full program name of the Python executable; this is computed as " "a side-effect of deriving the default module search path from the program " -"name (set by :c:func:`Py_SetProgramName` above). The returned string points " +"name (set by :c:member:`PyConfig.program_name`). The returned string points " "into static storage; the caller should not modify its value. The value is " "available to Python code as ``sys.executable``." msgstr "" -#: ../../c-api/init.rst:601 +#: ../../c-api/init.rst:580 msgid "" "Return the default module search path; this is computed from the program " -"name (set by :c:func:`Py_SetProgramName` above) and some environment " +"name (set by :c:member:`PyConfig.program_name`) and some environment " "variables. The returned string consists of a series of directory names " "separated by a platform dependent delimiter character. The delimiter " "character is ``':'`` on Unix and macOS, ``';'`` on Windows. The returned " @@ -800,63 +772,21 @@ msgid "" "for loading modules." msgstr "" -#: ../../c-api/init.rst:627 -msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"module_search_paths` and :c:member:`PyConfig.module_search_paths_set` should " -"be used instead, see :ref:`Python Initialization Configuration `." -msgstr "" - -#: ../../c-api/init.rst:632 -msgid "" -"Set the default module search path. If this function is called before :c:" -"func:`Py_Initialize`, then :c:func:`Py_GetPath` won't attempt to compute a " -"default search path but uses the one provided instead. This is useful if " -"Python is embedded by an application that has full knowledge of the location " -"of all modules. The path components should be separated by the platform " -"dependent delimiter character, which is ``':'`` on Unix and macOS, ``';'`` " -"on Windows." -msgstr "" - -#: ../../c-api/init.rst:640 -msgid "" -"This also causes :data:`sys.executable` to be set to the program full path " -"(see :c:func:`Py_GetProgramFullPath`) and for :data:`sys.prefix` and :data:" -"`sys.exec_prefix` to be empty. It is up to the caller to modify these if " -"required after calling :c:func:`Py_Initialize`." -msgstr "" - -#: ../../c-api/init.rst:645 ../../c-api/init.rst:760 ../../c-api/init.rst:796 -#: ../../c-api/init.rst:822 -msgid "" -"Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" -"`wchar_*` string." +#: ../../c-api/init.rst:598 +msgid "Get :data:`sys.path` instead." msgstr "" -#: ../../c-api/init.rst:648 -msgid "" -"The path argument is copied internally, so the caller may free it after the " -"call completes." -msgstr "" - -#: ../../c-api/init.rst:651 -msgid "" -"The program full path is now used for :data:`sys.executable`, instead of the " -"program name." -msgstr "" - -#: ../../c-api/init.rst:660 +#: ../../c-api/init.rst:604 msgid "" "Return the version of this Python interpreter. This is a string that looks " "something like ::" msgstr "" -#: ../../c-api/init.rst:663 +#: ../../c-api/init.rst:607 msgid "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" msgstr "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" -#: ../../c-api/init.rst:667 +#: ../../c-api/init.rst:611 msgid "" "The first word (up to the first space character) is the current Python " "version; the first characters are the major and minor version separated by a " @@ -865,11 +795,11 @@ msgid "" "version`." msgstr "" -#: ../../c-api/init.rst:672 +#: ../../c-api/init.rst:616 msgid "See also the :c:var:`Py_Version` constant." msgstr "" -#: ../../c-api/init.rst:679 +#: ../../c-api/init.rst:623 msgid "" "Return the platform identifier for the current platform. On Unix, this is " "formed from the \"official\" name of the operating system, converted to " @@ -880,50 +810,50 @@ msgid "" "available to Python code as ``sys.platform``." msgstr "" -#: ../../c-api/init.rst:690 +#: ../../c-api/init.rst:634 msgid "" "Return the official copyright string for the current Python version, for " "example" msgstr "" -#: ../../c-api/init.rst:692 +#: ../../c-api/init.rst:636 msgid "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" msgstr "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" -#: ../../c-api/init.rst:696 +#: ../../c-api/init.rst:640 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as ``sys.copyright``." msgstr "" -#: ../../c-api/init.rst:702 +#: ../../c-api/init.rst:646 msgid "" "Return an indication of the compiler used to build the current Python " "version, in square brackets, for example::" msgstr "" -#: ../../c-api/init.rst:705 +#: ../../c-api/init.rst:649 msgid "\"[GCC 2.7.2.2]\"" msgstr "\"[GCC 2.7.2.2]\"" -#: ../../c-api/init.rst:709 ../../c-api/init.rst:723 +#: ../../c-api/init.rst:653 ../../c-api/init.rst:667 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as part of the variable " "``sys.version``." msgstr "" -#: ../../c-api/init.rst:716 +#: ../../c-api/init.rst:660 msgid "" "Return information about the sequence number and build date and time of the " "current Python interpreter instance, for example ::" msgstr "" -#: ../../c-api/init.rst:719 +#: ../../c-api/init.rst:663 msgid "\"#67, Aug 1 1997, 22:34:28\"" msgstr "\"#67, Aug 1 1997, 22:34:28\"" -#: ../../c-api/init.rst:735 +#: ../../c-api/init.rst:679 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` " @@ -931,7 +861,7 @@ msgid "" "config>`." msgstr "" -#: ../../c-api/init.rst:740 +#: ../../c-api/init.rst:684 msgid "" "Set :data:`sys.argv` based on *argc* and *argv*. These parameters are " "similar to those passed to the program's :c:func:`main` function with the " @@ -942,84 +872,84 @@ msgid "" "fatal condition is signalled using :c:func:`Py_FatalError`." msgstr "" -#: ../../c-api/init.rst:748 +#: ../../c-api/init.rst:692 msgid "" "If *updatepath* is zero, this is all the function does. If *updatepath* is " "non-zero, the function also modifies :data:`sys.path` according to the " "following algorithm:" msgstr "" -#: ../../c-api/init.rst:752 +#: ../../c-api/init.rst:696 msgid "" "If the name of an existing script is passed in ``argv[0]``, the absolute " "path of the directory where the script is located is prepended to :data:`sys." "path`." msgstr "" -#: ../../c-api/init.rst:755 +#: ../../c-api/init.rst:699 msgid "" "Otherwise (that is, if *argc* is ``0`` or ``argv[0]`` doesn't point to an " "existing file name), an empty string is prepended to :data:`sys.path`, which " "is the same as prepending the current working directory (``\".\"``)." msgstr "" -#: ../../c-api/init.rst:763 ../../c-api/init.rst:799 +#: ../../c-api/init.rst:707 ../../c-api/init.rst:743 msgid "" "See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv` " "members of the :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:767 +#: ../../c-api/init.rst:711 msgid "" "It is recommended that applications embedding the Python interpreter for " "purposes other than executing a single script pass ``0`` as *updatepath*, " "and update :data:`sys.path` themselves if desired. See :cve:`2008-5983`." msgstr "" -#: ../../c-api/init.rst:772 +#: ../../c-api/init.rst:716 msgid "" "On versions before 3.1.3, you can achieve the same effect by manually " "popping the first :data:`sys.path` element after having called :c:func:" "`PySys_SetArgv`, for example using::" msgstr "" -#: ../../c-api/init.rst:776 +#: ../../c-api/init.rst:720 msgid "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" msgstr "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" -#: ../../c-api/init.rst:788 +#: ../../c-api/init.rst:732 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv` and :c:member:`PyConfig.parse_argv` should be used instead, see :ref:" "`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:792 +#: ../../c-api/init.rst:736 msgid "" "This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to " "``1`` unless the :program:`python` interpreter was started with the :option:" "`-I`." msgstr "" -#: ../../c-api/init.rst:802 +#: ../../c-api/init.rst:746 msgid "The *updatepath* value depends on :option:`-I`." msgstr "" -#: ../../c-api/init.rst:809 +#: ../../c-api/init.rst:753 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "home` should be used instead, see :ref:`Python Initialization Configuration " "`." msgstr "" -#: ../../c-api/init.rst:813 +#: ../../c-api/init.rst:757 msgid "" "Set the default \"home\" directory, that is, the location of the standard " "Python libraries. See :envvar:`PYTHONHOME` for the meaning of the argument " "string." msgstr "" -#: ../../c-api/init.rst:817 +#: ../../c-api/init.rst:761 msgid "" "The argument should point to a zero-terminated character string in static " "storage whose contents will not change for the duration of the program's " @@ -1027,18 +957,24 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:830 +#: ../../c-api/init.rst:774 msgid "" -"Return the default \"home\", that is, the value set by a previous call to :c:" -"func:`Py_SetPythonHome`, or the value of the :envvar:`PYTHONHOME` " -"environment variable if it is set." +"Return the default \"home\", that is, the value set by :c:member:`PyConfig." +"home`, or the value of the :envvar:`PYTHONHOME` environment variable if it " +"is set." msgstr "" -#: ../../c-api/init.rst:844 +#: ../../c-api/init.rst:784 +msgid "" +"Get :c:member:`PyConfig.home` or :envvar:`PYTHONHOME` environment variable " +"instead." +msgstr "改為取得 :c:member:`PyConfig.home` 或 :envvar:`PYTHONHOME` 環境變數。" + +#: ../../c-api/init.rst:792 msgid "Thread State and the Global Interpreter Lock" msgstr "" -#: ../../c-api/init.rst:851 +#: ../../c-api/init.rst:799 msgid "" "The Python interpreter is not fully thread-safe. In order to support multi-" "threaded Python programs, there's a global lock, called the :term:`global " @@ -1050,7 +986,7 @@ msgid "" "once instead of twice." msgstr "" -#: ../../c-api/init.rst:861 +#: ../../c-api/init.rst:809 msgid "" "Therefore, the rule exists that only the thread that has acquired the :term:" "`GIL` may operate on Python objects or call Python/C API functions. In order " @@ -1060,7 +996,7 @@ msgid "" "a file, so that other Python threads can run in the meantime." msgstr "" -#: ../../c-api/init.rst:871 +#: ../../c-api/init.rst:819 msgid "" "The Python interpreter keeps some thread-specific bookkeeping information " "inside a data structure called :c:type:`PyThreadState`. There's also one " @@ -1068,17 +1004,17 @@ msgid "" "retrieved using :c:func:`PyThreadState_Get`." msgstr "" -#: ../../c-api/init.rst:877 +#: ../../c-api/init.rst:825 msgid "Releasing the GIL from extension code" msgstr "" -#: ../../c-api/init.rst:879 +#: ../../c-api/init.rst:827 msgid "" "Most extension code manipulating the :term:`GIL` has the following simple " "structure::" msgstr "" -#: ../../c-api/init.rst:882 +#: ../../c-api/init.rst:830 msgid "" "Save the thread state in a local variable.\n" "Release the global interpreter lock.\n" @@ -1087,29 +1023,29 @@ msgid "" "Restore the thread state from the local variable." msgstr "" -#: ../../c-api/init.rst:888 +#: ../../c-api/init.rst:836 msgid "This is so common that a pair of macros exists to simplify it::" msgstr "" -#: ../../c-api/init.rst:890 +#: ../../c-api/init.rst:838 msgid "" "Py_BEGIN_ALLOW_THREADS\n" "... Do some blocking I/O operation ...\n" "Py_END_ALLOW_THREADS" msgstr "" -#: ../../c-api/init.rst:898 +#: ../../c-api/init.rst:846 msgid "" "The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a " "hidden local variable; the :c:macro:`Py_END_ALLOW_THREADS` macro closes the " "block." msgstr "" -#: ../../c-api/init.rst:902 +#: ../../c-api/init.rst:850 msgid "The block above expands to the following code::" msgstr "" -#: ../../c-api/init.rst:904 +#: ../../c-api/init.rst:852 msgid "" "PyThreadState *_save;\n" "\n" @@ -1118,7 +1054,7 @@ msgid "" "PyEval_RestoreThread(_save);" msgstr "" -#: ../../c-api/init.rst:914 +#: ../../c-api/init.rst:862 msgid "" "Here is how these functions work: the global interpreter lock is used to " "protect the pointer to the current thread state. When releasing the lock " @@ -1129,7 +1065,7 @@ msgid "" "state, the lock must be acquired before storing the thread state pointer." msgstr "" -#: ../../c-api/init.rst:923 +#: ../../c-api/init.rst:871 msgid "" "Calling system I/O functions is the most common use case for releasing the " "GIL, but it can also be useful before calling long-running computations " @@ -1139,11 +1075,11 @@ msgid "" "compressing or hashing data." msgstr "" -#: ../../c-api/init.rst:934 +#: ../../c-api/init.rst:882 msgid "Non-Python created threads" msgstr "" -#: ../../c-api/init.rst:936 +#: ../../c-api/init.rst:884 msgid "" "When threads are created using the dedicated Python APIs (such as the :mod:" "`threading` module), a thread state is automatically associated to them and " @@ -1153,7 +1089,7 @@ msgid "" "for them." msgstr "" -#: ../../c-api/init.rst:943 +#: ../../c-api/init.rst:891 msgid "" "If you need to call Python code from these threads (often this will be part " "of a callback API provided by the aforementioned third-party library), you " @@ -1164,14 +1100,14 @@ msgid "" "finally free the thread state data structure." msgstr "" -#: ../../c-api/init.rst:951 +#: ../../c-api/init.rst:899 msgid "" "The :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` functions " "do all of the above automatically. The typical idiom for calling into " "Python from a C thread is::" msgstr "" -#: ../../c-api/init.rst:955 +#: ../../c-api/init.rst:903 msgid "" "PyGILState_STATE gstate;\n" "gstate = PyGILState_Ensure();\n" @@ -1184,7 +1120,7 @@ msgid "" "PyGILState_Release(gstate);" msgstr "" -#: ../../c-api/init.rst:965 +#: ../../c-api/init.rst:913 msgid "" "Note that the ``PyGILState_*`` functions assume there is only one global " "interpreter (created automatically by :c:func:`Py_Initialize`). Python " @@ -1193,11 +1129,11 @@ msgid "" "``PyGILState_*`` API is unsupported." msgstr "" -#: ../../c-api/init.rst:975 +#: ../../c-api/init.rst:923 msgid "Cautions about fork()" msgstr "" -#: ../../c-api/init.rst:977 +#: ../../c-api/init.rst:925 msgid "" "Another important thing to note about threads is their behaviour in the face " "of the C :c:func:`fork` call. On most systems with :c:func:`fork`, after a " @@ -1206,7 +1142,7 @@ msgid "" "CPython's runtime." msgstr "" -#: ../../c-api/init.rst:983 +#: ../../c-api/init.rst:931 msgid "" "The fact that only the \"current\" thread remains means any locks held by " "other threads will never be released. Python solves this for :func:`os.fork` " @@ -1223,7 +1159,7 @@ msgid "" "locks, but is not always able to." msgstr "" -#: ../../c-api/init.rst:998 +#: ../../c-api/init.rst:946 msgid "" "The fact that all other threads go away also means that CPython's runtime " "state there must be cleaned up properly, which :func:`os.fork` does. This " @@ -1236,17 +1172,17 @@ msgid "" "called immediately after." msgstr "" -#: ../../c-api/init.rst:1011 +#: ../../c-api/init.rst:959 msgid "High-level API" msgstr "高階 API" -#: ../../c-api/init.rst:1013 +#: ../../c-api/init.rst:961 msgid "" "These are the most commonly used types and functions when writing C " "extension code, or when embedding the Python interpreter:" msgstr "" -#: ../../c-api/init.rst:1018 +#: ../../c-api/init.rst:966 msgid "" "This data structure represents the state shared by a number of cooperating " "threads. Threads belonging to the same interpreter share their module " @@ -1254,7 +1190,7 @@ msgid "" "in this structure." msgstr "" -#: ../../c-api/init.rst:1023 +#: ../../c-api/init.rst:971 msgid "" "Threads belonging to different interpreters initially share nothing, except " "process state like available memory, open file descriptors and such. The " @@ -1262,52 +1198,41 @@ msgid "" "which interpreter they belong." msgstr "" -#: ../../c-api/init.rst:1031 +#: ../../c-api/init.rst:979 msgid "" "This data structure represents the state of a single thread. The only " "public data member is:" msgstr "" -#: ../../c-api/init.rst:1036 +#: ../../c-api/init.rst:984 msgid "This thread's interpreter state." msgstr "" -#: ../../c-api/init.rst:1047 +#: ../../c-api/init.rst:995 msgid "Deprecated function which does nothing." msgstr "" -#: ../../c-api/init.rst:1049 +#: ../../c-api/init.rst:997 msgid "" "In Python 3.6 and older, this function created the GIL if it didn't exist." msgstr "" -#: ../../c-api/init.rst:1051 +#: ../../c-api/init.rst:999 msgid "The function now does nothing." msgstr "此函式現在不會做任何事情。" -#: ../../c-api/init.rst:1054 +#: ../../c-api/init.rst:1002 msgid "" "This function is now called by :c:func:`Py_Initialize()`, so you don't have " "to call it yourself anymore." msgstr "" -#: ../../c-api/init.rst:1058 +#: ../../c-api/init.rst:1006 msgid "" "This function cannot be called before :c:func:`Py_Initialize()` anymore." msgstr "" -#: ../../c-api/init.rst:1068 -msgid "" -"Returns a non-zero value if :c:func:`PyEval_InitThreads` has been called. " -"This function can be called without holding the GIL, and therefore can be " -"used to avoid calls to the locking API when running single-threaded." -msgstr "" - -#: ../../c-api/init.rst:1072 -msgid "The :term:`GIL` is now initialized by :c:func:`Py_Initialize()`." -msgstr "" - -#: ../../c-api/init.rst:1080 +#: ../../c-api/init.rst:1016 msgid "" "Release the global interpreter lock (if it has been created) and reset the " "thread state to ``NULL``, returning the previous thread state (which is not " @@ -1315,7 +1240,7 @@ msgid "" "acquired it." msgstr "" -#: ../../c-api/init.rst:1088 +#: ../../c-api/init.rst:1024 msgid "" "Acquire the global interpreter lock (if it has been created) and set the " "thread state to *tstate*, which must not be ``NULL``. If the lock has been " @@ -1323,37 +1248,54 @@ msgid "" "ensues." msgstr "" -#: ../../c-api/init.rst:1094 ../../c-api/init.rst:1140 -#: ../../c-api/init.rst:1422 +#: ../../c-api/init.rst:1030 ../../c-api/init.rst:1089 +#: ../../c-api/init.rst:1371 msgid "" "Calling this function from a thread when the runtime is finalizing will " "terminate the thread, even if the thread was not created by Python. You can " -"use :c:func:`!_Py_IsFinalizing` or :func:`sys.is_finalizing` to check if the " +"use :c:func:`Py_IsFinalizing` or :func:`sys.is_finalizing` to check if the " "interpreter is in process of being finalized before calling this function to " "avoid unwanted termination." msgstr "" -#: ../../c-api/init.rst:1102 +#: ../../c-api/init.rst:1038 msgid "" "Return the current thread state. The global interpreter lock must be held. " "When the current thread state is ``NULL``, this issues a fatal error (so " "that the caller needn't check for ``NULL``)." msgstr "" -#: ../../c-api/init.rst:1109 +#: ../../c-api/init.rst:1042 +msgid "See also :c:func:`PyThreadState_GetUnchecked`." +msgstr "也請見 :c:func:`PyThreadState_GetUnchecked`。" + +#: ../../c-api/init.rst:1047 +msgid "" +"Similar to :c:func:`PyThreadState_Get`, but don't kill the process with a " +"fatal error if it is NULL. The caller is responsible to check if the result " +"is NULL." +msgstr "" + +#: ../../c-api/init.rst:1051 +msgid "" +"In Python 3.5 to 3.12, the function was private and known as " +"``_PyThreadState_UncheckedGet()``." +msgstr "" + +#: ../../c-api/init.rst:1058 msgid "" "Swap the current thread state with the thread state given by the argument " "*tstate*, which may be ``NULL``. The global interpreter lock must be held " "and is not released." msgstr "" -#: ../../c-api/init.rst:1114 +#: ../../c-api/init.rst:1063 msgid "" "The following functions use thread-local storage, and are not compatible " "with sub-interpreters:" msgstr "" -#: ../../c-api/init.rst:1119 +#: ../../c-api/init.rst:1068 msgid "" "Ensure that the current thread is ready to call the Python C API regardless " "of the current state of Python, or of the global interpreter lock. This may " @@ -1366,7 +1308,7 @@ msgid "" "is acceptable." msgstr "" -#: ../../c-api/init.rst:1129 +#: ../../c-api/init.rst:1078 msgid "" "The return value is an opaque \"handle\" to the thread state when :c:func:" "`PyGILState_Ensure` was called, and must be passed to :c:func:" @@ -1376,13 +1318,13 @@ msgid "" "func:`PyGILState_Release`." msgstr "" -#: ../../c-api/init.rst:1136 +#: ../../c-api/init.rst:1085 msgid "" "When the function returns, the current thread will hold the GIL and be able " "to call arbitrary Python code. Failure is a fatal error." msgstr "" -#: ../../c-api/init.rst:1148 +#: ../../c-api/init.rst:1097 msgid "" "Release any resources previously acquired. After this call, Python's state " "will be the same as it was prior to the corresponding :c:func:" @@ -1390,13 +1332,13 @@ msgid "" "caller, hence the use of the GILState API)." msgstr "" -#: ../../c-api/init.rst:1153 +#: ../../c-api/init.rst:1102 msgid "" "Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:" "func:`PyGILState_Release` on the same thread." msgstr "" -#: ../../c-api/init.rst:1159 +#: ../../c-api/init.rst:1108 msgid "" "Get the current thread state for this thread. May return ``NULL`` if no " "GILState API has been used on the current thread. Note that the main thread " @@ -1404,7 +1346,7 @@ msgid "" "made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -#: ../../c-api/init.rst:1167 +#: ../../c-api/init.rst:1116 msgid "" "Return ``1`` if the current thread is holding the GIL and ``0`` otherwise. " "This function can be called from any thread at any time. Only if it has had " @@ -1415,13 +1357,13 @@ msgid "" "otherwise behave differently." msgstr "" -#: ../../c-api/init.rst:1179 +#: ../../c-api/init.rst:1128 msgid "" "The following macros are normally used without a trailing semicolon; look " "for example usage in the Python source distribution." msgstr "" -#: ../../c-api/init.rst:1185 +#: ../../c-api/init.rst:1134 msgid "" "This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" "``. Note that it contains an opening brace; it must be matched with a " @@ -1429,7 +1371,7 @@ msgid "" "discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1193 +#: ../../c-api/init.rst:1142 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " "contains a closing brace; it must be matched with an earlier :c:macro:" @@ -1437,40 +1379,40 @@ msgid "" "macro." msgstr "" -#: ../../c-api/init.rst:1201 +#: ../../c-api/init.rst:1150 msgid "" "This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :" "c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" -#: ../../c-api/init.rst:1207 +#: ../../c-api/init.rst:1156 msgid "" "This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :" "c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " "declaration." msgstr "" -#: ../../c-api/init.rst:1213 +#: ../../c-api/init.rst:1162 msgid "Low-level API" msgstr "低階 API" -#: ../../c-api/init.rst:1215 +#: ../../c-api/init.rst:1164 msgid "" "All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:1217 +#: ../../c-api/init.rst:1166 msgid ":c:func:`Py_Initialize()` now initializes the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:1223 +#: ../../c-api/init.rst:1172 msgid "" "Create a new interpreter state object. The global interpreter lock need not " "be held, but may be held if it is necessary to serialize calls to this " "function." msgstr "" -#: ../../c-api/init.rst:1227 +#: ../../c-api/init.rst:1176 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_New`` with no arguments." @@ -1478,13 +1420,13 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_New``。" -#: ../../c-api/init.rst:1232 +#: ../../c-api/init.rst:1181 msgid "" "Reset all information in an interpreter state object. The global " "interpreter lock must be held." msgstr "" -#: ../../c-api/init.rst:1235 +#: ../../c-api/init.rst:1184 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_Clear`` with no arguments." @@ -1492,40 +1434,40 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_Clear``。" -#: ../../c-api/init.rst:1240 +#: ../../c-api/init.rst:1189 msgid "" "Destroy an interpreter state object. The global interpreter lock need not " "be held. The interpreter state must have been reset with a previous call " "to :c:func:`PyInterpreterState_Clear`." msgstr "" -#: ../../c-api/init.rst:1247 +#: ../../c-api/init.rst:1196 msgid "" "Create a new thread state object belonging to the given interpreter object. " "The global interpreter lock need not be held, but may be held if it is " "necessary to serialize calls to this function." msgstr "" -#: ../../c-api/init.rst:1254 +#: ../../c-api/init.rst:1203 msgid "" "Reset all information in a thread state object. The global interpreter lock " "must be held." msgstr "" -#: ../../c-api/init.rst:1257 +#: ../../c-api/init.rst:1206 msgid "" "This function now calls the :c:member:`PyThreadState.on_delete` callback. " "Previously, that happened in :c:func:`PyThreadState_Delete`." msgstr "" -#: ../../c-api/init.rst:1264 +#: ../../c-api/init.rst:1213 msgid "" "Destroy a thread state object. The global interpreter lock need not be " "held. The thread state must have been reset with a previous call to :c:func:" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1271 +#: ../../c-api/init.rst:1220 msgid "" "Destroy the current thread state and release the global interpreter lock. " "Like :c:func:`PyThreadState_Delete`, the global interpreter lock need not be " @@ -1533,119 +1475,119 @@ msgid "" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1279 +#: ../../c-api/init.rst:1228 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1281 +#: ../../c-api/init.rst:1230 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: ../../c-api/init.rst:1284 +#: ../../c-api/init.rst:1233 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "也請見 :c:func:`PyEval_GetFrame`。" -#: ../../c-api/init.rst:1286 ../../c-api/init.rst:1295 -#: ../../c-api/init.rst:1304 +#: ../../c-api/init.rst:1235 ../../c-api/init.rst:1244 +#: ../../c-api/init.rst:1253 msgid "*tstate* must not be ``NULL``." msgstr "*tstate* 不可為 ``NULL``。" -#: ../../c-api/init.rst:1293 +#: ../../c-api/init.rst:1242 msgid "" "Get the unique thread state identifier of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1302 +#: ../../c-api/init.rst:1251 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1311 +#: ../../c-api/init.rst:1260 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1313 +#: ../../c-api/init.rst:1262 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -#: ../../c-api/init.rst:1320 +#: ../../c-api/init.rst:1269 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -#: ../../c-api/init.rst:1323 +#: ../../c-api/init.rst:1272 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -#: ../../c-api/init.rst:1331 +#: ../../c-api/init.rst:1280 msgid "Get the current interpreter." msgstr "" -#: ../../c-api/init.rst:1333 +#: ../../c-api/init.rst:1282 msgid "" "Issue a fatal error if there no current Python thread state or no current " "interpreter. It cannot return NULL." msgstr "" -#: ../../c-api/init.rst:1336 ../../c-api/init.rst:1346 +#: ../../c-api/init.rst:1285 ../../c-api/init.rst:1295 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/init.rst:1343 +#: ../../c-api/init.rst:1292 msgid "" "Return the interpreter's unique ID. If there was any error in doing so then " "``-1`` is returned and an error is set." msgstr "" -#: ../../c-api/init.rst:1353 +#: ../../c-api/init.rst:1302 msgid "" "Return a dictionary in which interpreter-specific data may be stored. If " "this function returns ``NULL`` then no exception has been raised and the " "caller should assume no interpreter-specific dict is available." msgstr "" -#: ../../c-api/init.rst:1357 +#: ../../c-api/init.rst:1306 msgid "" "This is not a replacement for :c:func:`PyModule_GetState()`, which " "extensions should use to store interpreter-specific state information." msgstr "" -#: ../../c-api/init.rst:1364 +#: ../../c-api/init.rst:1313 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1366 +#: ../../c-api/init.rst:1315 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1369 +#: ../../c-api/init.rst:1318 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1372 +#: ../../c-api/init.rst:1321 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: ../../c-api/init.rst:1377 +#: ../../c-api/init.rst:1326 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1379 ../../c-api/init.rst:1387 +#: ../../c-api/init.rst:1328 ../../c-api/init.rst:1336 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1385 +#: ../../c-api/init.rst:1334 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1394 +#: ../../c-api/init.rst:1343 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " @@ -1654,7 +1596,7 @@ msgid "" "raised and the caller should assume no current thread state is available." msgstr "" -#: ../../c-api/init.rst:1403 +#: ../../c-api/init.rst:1352 msgid "" "Asynchronously raise an exception in a thread. The *id* argument is the " "thread id of the target thread; *exc* is the exception object to be raised. " @@ -1666,33 +1608,33 @@ msgid "" "raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1411 +#: ../../c-api/init.rst:1360 msgid "" "The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" "`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1417 +#: ../../c-api/init.rst:1366 msgid "" "Acquire the global interpreter lock and set the current thread state to " "*tstate*, which must not be ``NULL``. The lock must have been created " "earlier. If this thread already has the lock, deadlock ensues." msgstr "" -#: ../../c-api/init.rst:1428 ../../c-api/init.rst:1466 +#: ../../c-api/init.rst:1377 msgid "" "Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" "`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " "current thread if called while the interpreter is finalizing." msgstr "" -#: ../../c-api/init.rst:1433 +#: ../../c-api/init.rst:1382 msgid "" ":c:func:`PyEval_RestoreThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1439 +#: ../../c-api/init.rst:1388 msgid "" "Reset the current thread state to ``NULL`` and release the global " "interpreter lock. The lock must have been created earlier and must be held " @@ -1701,50 +1643,17 @@ msgid "" "isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1445 +#: ../../c-api/init.rst:1394 msgid "" ":c:func:`PyEval_SaveThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1451 -msgid "" -"Acquire the global interpreter lock. The lock must have been created " -"earlier. If this thread already has the lock, a deadlock ensues." -msgstr "" - -#: ../../c-api/init.rst:1454 -msgid "" -"This function does not update the current thread state. Please use :c:func:" -"`PyEval_RestoreThread` or :c:func:`PyEval_AcquireThread` instead." -msgstr "" - -#: ../../c-api/init.rst:1460 -msgid "" -"Calling this function from a thread when the runtime is finalizing will " -"terminate the thread, even if the thread was not created by Python. You can " -"use :c:func:`_Py_IsFinalizing` or :func:`sys.is_finalizing` to check if the " -"interpreter is in process of being finalized before calling this function to " -"avoid unwanted termination." -msgstr "" - -#: ../../c-api/init.rst:1474 -msgid "" -"Release the global interpreter lock. The lock must have been created " -"earlier." -msgstr "" - -#: ../../c-api/init.rst:1476 -msgid "" -"This function does not update the current thread state. Please use :c:func:" -"`PyEval_SaveThread` or :c:func:`PyEval_ReleaseThread` instead." -msgstr "" - -#: ../../c-api/init.rst:1485 +#: ../../c-api/init.rst:1401 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1487 +#: ../../c-api/init.rst:1403 msgid "" "While in most uses, you will only embed a single Python interpreter, there " "are cases where you need to create several independent interpreters in the " @@ -1752,7 +1661,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1492 +#: ../../c-api/init.rst:1408 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -1763,31 +1672,31 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1499 +#: ../../c-api/init.rst:1415 msgid "" "You can switch between sub-interpreters using the :c:func:" "`PyThreadState_Swap` function. You can create and destroy them using the " "following functions:" msgstr "" -#: ../../c-api/init.rst:1505 +#: ../../c-api/init.rst:1421 msgid "" "Structure containing most parameters to configure a sub-interpreter. Its " "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " "modified by the runtime." msgstr "" -#: ../../c-api/init.rst:1511 +#: ../../c-api/init.rst:1427 msgid "Structure fields:" msgstr "" -#: ../../c-api/init.rst:1515 +#: ../../c-api/init.rst:1431 msgid "" "If this is ``0`` then the sub-interpreter will use its own \"object\" " "allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" -#: ../../c-api/init.rst:1519 +#: ../../c-api/init.rst:1435 msgid "" "If this is ``0`` then :c:member:`~PyInterpreterConfig." "check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " @@ -1795,44 +1704,44 @@ msgid "" "`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: ../../c-api/init.rst:1527 +#: ../../c-api/init.rst:1443 msgid "" "If this is ``0`` then the runtime will not support forking the process in " "any thread where the sub-interpreter is currently active. Otherwise fork is " "unrestricted." msgstr "" -#: ../../c-api/init.rst:1531 +#: ../../c-api/init.rst:1447 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: ../../c-api/init.rst:1536 +#: ../../c-api/init.rst:1452 msgid "" "If this is ``0`` then the runtime will not support replacing the current " "process via exec (e.g. :func:`os.execv`) in any thread where the sub-" "interpreter is currently active. Otherwise exec is unrestricted." msgstr "" -#: ../../c-api/init.rst:1541 +#: ../../c-api/init.rst:1457 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: ../../c-api/init.rst:1546 +#: ../../c-api/init.rst:1462 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create threads. Otherwise threads are allowed." msgstr "" -#: ../../c-api/init.rst:1552 +#: ../../c-api/init.rst:1468 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create daemon threads. Otherwise daemon threads are allowed (as long as :c:" "member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" -#: ../../c-api/init.rst:1559 +#: ../../c-api/init.rst:1475 msgid "" "If this is ``0`` then all extension modules may be imported, including " "legacy (single-phase init) modules, in any thread where the sub-interpreter " @@ -1841,37 +1750,37 @@ msgid "" "`Py_mod_multiple_interpreters`.)" msgstr "" -#: ../../c-api/init.rst:1566 +#: ../../c-api/init.rst:1482 msgid "" "This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." "use_main_obmalloc` is ``0``." msgstr "" -#: ../../c-api/init.rst:1571 +#: ../../c-api/init.rst:1487 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: ../../c-api/init.rst:1578 +#: ../../c-api/init.rst:1494 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: ../../c-api/init.rst:1582 +#: ../../c-api/init.rst:1498 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: ../../c-api/init.rst:1586 +#: ../../c-api/init.rst:1502 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: ../../c-api/init.rst:1588 +#: ../../c-api/init.rst:1504 msgid "" "If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" "`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: ../../c-api/init.rst:1602 +#: ../../c-api/init.rst:1518 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " @@ -1884,13 +1793,13 @@ msgid "" "underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1612 +#: ../../c-api/init.rst:1528 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: ../../c-api/init.rst:1615 +#: ../../c-api/init.rst:1531 msgid "" "Upon success, *tstate_p* will be set to the first thread state created in " "the new sub-interpreter. This thread state is made in the current thread " @@ -1901,7 +1810,7 @@ msgid "" "state." msgstr "" -#: ../../c-api/init.rst:1624 +#: ../../c-api/init.rst:1540 msgid "" "Like all other Python/C API functions, the global interpreter lock must be " "held before calling this function and is still held when it returns. " @@ -1913,13 +1822,13 @@ msgid "" "released here." msgstr "" -#: ../../c-api/init.rst:1635 +#: ../../c-api/init.rst:1551 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: ../../c-api/init.rst:1638 +#: ../../c-api/init.rst:1554 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -1943,7 +1852,7 @@ msgstr "" "};\n" "PyThreadState *tstate = Py_NewInterpreterFromConfig(&config);" -#: ../../c-api/init.rst:1649 +#: ../../c-api/init.rst:1565 msgid "" "Note that the config is used only briefly and does not get modified. During " "initialization the config's values are converted into various :c:type:" @@ -1951,11 +1860,11 @@ msgid "" "internally on the :c:type:`PyInterpreterState`." msgstr "" -#: ../../c-api/init.rst:1658 +#: ../../c-api/init.rst:1574 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1660 +#: ../../c-api/init.rst:1576 msgid "" "For modules using multi-phase initialization, e.g. :c:func:" "`PyModule_FromDefAndSpec`, a separate module object is created and " @@ -1963,7 +1872,7 @@ msgid "" "are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1666 +#: ../../c-api/init.rst:1582 msgid "" "For modules using single-phase initialization, e.g. :c:func:" "`PyModule_Create`, the first time a particular extension is imported, it is " @@ -1975,7 +1884,7 @@ msgid "" "might cause unwanted behavior (see `Bugs and caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1677 +#: ../../c-api/init.rst:1593 msgid "" "Note that this is different from what happens when an extension is imported " "after the interpreter has been completely re-initialized by calling :c:func:" @@ -1985,7 +1894,7 @@ msgid "" "shared between these modules." msgstr "" -#: ../../c-api/init.rst:1697 +#: ../../c-api/init.rst:1613 msgid "" "Create a new sub-interpreter. This is essentially just a wrapper around :c:" "func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " @@ -1994,7 +1903,7 @@ msgid "" "single-phase init modules." msgstr "" -#: ../../c-api/init.rst:1709 +#: ../../c-api/init.rst:1625 msgid "" "Destroy the (sub-)interpreter represented by the given thread state. The " "given thread state must be the current thread state. See the discussion of " @@ -2004,17 +1913,17 @@ msgid "" "be held before calling this function. No GIL is held when it returns." msgstr "" -#: ../../c-api/init.rst:1717 +#: ../../c-api/init.rst:1633 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: ../../c-api/init.rst:1722 +#: ../../c-api/init.rst:1638 msgid "A Per-Interpreter GIL" msgstr "" -#: ../../c-api/init.rst:1724 +#: ../../c-api/init.rst:1640 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -2026,7 +1935,7 @@ msgid "" "just using threads. (See :pep:`554`.)" msgstr "" -#: ../../c-api/init.rst:1734 +#: ../../c-api/init.rst:1650 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -2035,12 +1944,12 @@ msgid "" "the refcount. One simple but less-efficient approach around this is to use " "a global lock around all use of some state (or object). Alternately, " "effectively immutable objects (like integers or strings) can be made safe in " -"spite of their refcounts by making them \"immortal\". In fact, this has been " -"done for the builtin singletons, small integers, and a number of other " +"spite of their refcounts by making them :term:`immortal`. In fact, this has " +"been done for the builtin singletons, small integers, and a number of other " "builtin objects." msgstr "" -#: ../../c-api/init.rst:1745 +#: ../../c-api/init.rst:1661 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -2048,7 +1957,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: ../../c-api/init.rst:1750 +#: ../../c-api/init.rst:1666 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -2058,11 +1967,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: ../../c-api/init.rst:1761 +#: ../../c-api/init.rst:1677 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1763 +#: ../../c-api/init.rst:1679 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -2075,7 +1984,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1773 +#: ../../c-api/init.rst:1689 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -2084,7 +1993,7 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1779 +#: ../../c-api/init.rst:1695 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " @@ -2096,25 +2005,25 @@ msgid "" "created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1790 +#: ../../c-api/init.rst:1706 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1792 +#: ../../c-api/init.rst:1708 msgid "" "A mechanism is provided to make asynchronous notifications to the main " "interpreter thread. These notifications take the form of a function pointer " "and a void pointer argument." msgstr "" -#: ../../c-api/init.rst:1799 +#: ../../c-api/init.rst:1715 msgid "" "Schedule a function to be called from the main interpreter thread. On " "success, ``0`` is returned and *func* is queued for being called in the main " "thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -#: ../../c-api/init.rst:1803 +#: ../../c-api/init.rst:1719 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2122,17 +2031,17 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1808 +#: ../../c-api/init.rst:1724 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1809 +#: ../../c-api/init.rst:1725 msgid "" "with the main thread holding the :term:`global interpreter lock` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1812 +#: ../../c-api/init.rst:1728 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " @@ -2140,20 +2049,20 @@ msgid "" "if the global interpreter lock is released." msgstr "" -#: ../../c-api/init.rst:1817 +#: ../../c-api/init.rst:1733 msgid "" "This function doesn't need a current thread state to run, and it doesn't " "need the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:1820 +#: ../../c-api/init.rst:1736 msgid "" "To call this function in a subinterpreter, the caller must hold the GIL. " "Otherwise, the function *func* can be scheduled to be called from the wrong " "interpreter." msgstr "" -#: ../../c-api/init.rst:1825 +#: ../../c-api/init.rst:1741 msgid "" "This is a low-level function, only useful for very special cases. There is " "no guarantee that *func* will be called as quick as possible. If the main " @@ -2163,7 +2072,7 @@ msgid "" "`PyGILState API`." msgstr "" -#: ../../c-api/init.rst:1834 +#: ../../c-api/init.rst:1750 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " @@ -2171,18 +2080,18 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:1843 +#: ../../c-api/init.rst:1759 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:1848 +#: ../../c-api/init.rst:1764 msgid "" "The Python interpreter provides some low-level support for attaching " "profiling and execution tracing facilities. These are used for profiling, " "debugging, and coverage analysis tools." msgstr "" -#: ../../c-api/init.rst:1852 +#: ../../c-api/init.rst:1768 msgid "" "This C interface allows the profiling or tracing code to avoid the overhead " "of calling through Python-level callable objects, making a direct C function " @@ -2192,7 +2101,7 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:1862 +#: ../../c-api/init.rst:1778 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " @@ -2204,66 +2113,66 @@ msgid "" "value of *what*:" msgstr "" -#: ../../c-api/init.rst:1871 +#: ../../c-api/init.rst:1787 msgid "Value of *what*" msgstr "" -#: ../../c-api/init.rst:1871 +#: ../../c-api/init.rst:1787 msgid "Meaning of *arg*" msgstr "*arg* 的含義" -#: ../../c-api/init.rst:1873 +#: ../../c-api/init.rst:1789 msgid ":c:data:`PyTrace_CALL`" msgstr ":c:data:`PyTrace_CALL`" -#: ../../c-api/init.rst:1873 ../../c-api/init.rst:1878 -#: ../../c-api/init.rst:1889 +#: ../../c-api/init.rst:1789 ../../c-api/init.rst:1794 +#: ../../c-api/init.rst:1805 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:1875 +#: ../../c-api/init.rst:1791 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr ":c:data:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:1875 +#: ../../c-api/init.rst:1791 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:1878 +#: ../../c-api/init.rst:1794 msgid ":c:data:`PyTrace_LINE`" msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:1880 +#: ../../c-api/init.rst:1796 msgid ":c:data:`PyTrace_RETURN`" msgstr ":c:data:`PyTrace_RETURN`" -#: ../../c-api/init.rst:1880 +#: ../../c-api/init.rst:1796 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:1883 +#: ../../c-api/init.rst:1799 msgid ":c:data:`PyTrace_C_CALL`" msgstr ":c:data:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:1883 ../../c-api/init.rst:1885 -#: ../../c-api/init.rst:1887 +#: ../../c-api/init.rst:1799 ../../c-api/init.rst:1801 +#: ../../c-api/init.rst:1803 msgid "Function object being called." msgstr "被呼叫的函式物件。" -#: ../../c-api/init.rst:1885 +#: ../../c-api/init.rst:1801 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:1887 +#: ../../c-api/init.rst:1803 msgid ":c:data:`PyTrace_C_RETURN`" msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:1889 +#: ../../c-api/init.rst:1805 msgid ":c:data:`PyTrace_OPCODE`" msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:1894 +#: ../../c-api/init.rst:1810 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -2272,7 +2181,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:1903 +#: ../../c-api/init.rst:1819 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "an exception has been raised. The callback function is called with this " @@ -2284,7 +2193,7 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:1914 +#: ../../c-api/init.rst:1830 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " @@ -2292,31 +2201,31 @@ msgid "" "f_trace_lines` to *0* on that frame." msgstr "" -#: ../../c-api/init.rst:1922 +#: ../../c-api/init.rst:1838 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a call is about to return." msgstr "" -#: ../../c-api/init.rst:1928 +#: ../../c-api/init.rst:1844 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function is about to be called." msgstr "" -#: ../../c-api/init.rst:1934 +#: ../../c-api/init.rst:1850 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has raised an exception." msgstr "" -#: ../../c-api/init.rst:1940 +#: ../../c-api/init.rst:1856 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:1946 +#: ../../c-api/init.rst:1862 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " @@ -2324,7 +2233,7 @@ msgid "" "attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:1954 +#: ../../c-api/init.rst:1870 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " @@ -2334,29 +2243,29 @@ msgid "" "`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:1961 +#: ../../c-api/init.rst:1877 msgid "See also the :func:`sys.setprofile` function." msgstr "" -#: ../../c-api/init.rst:1963 ../../c-api/init.rst:1970 -#: ../../c-api/init.rst:1989 ../../c-api/init.rst:1996 +#: ../../c-api/init.rst:1879 ../../c-api/init.rst:1886 +#: ../../c-api/init.rst:1905 ../../c-api/init.rst:1912 msgid "The caller must hold the :term:`GIL`." msgstr "呼叫者必須持有 :term:`GIL`。" -#: ../../c-api/init.rst:1967 +#: ../../c-api/init.rst:1883 msgid "" "Like :c:func:`PyEval_SetProfile` but sets the profile function in all " "running threads belonging to the current interpreter instead of the setting " "it only on the current thread." msgstr "" -#: ../../c-api/init.rst:1972 +#: ../../c-api/init.rst:1888 msgid "" "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " "while setting the profile functions in all threads." msgstr "" -#: ../../c-api/init.rst:1980 +#: ../../c-api/init.rst:1896 msgid "" "Set the tracing function to *func*. This is similar to :c:func:" "`PyEval_SetProfile`, except the tracing function does receive line-number " @@ -2367,65 +2276,120 @@ msgid "" "*what* parameter." msgstr "" -#: ../../c-api/init.rst:1987 +#: ../../c-api/init.rst:1903 msgid "See also the :func:`sys.settrace` function." msgstr "也請見 :func:`sys.settrace` 函式。" -#: ../../c-api/init.rst:1993 +#: ../../c-api/init.rst:1909 msgid "" "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " "threads belonging to the current interpreter instead of the setting it only " "on the current thread." msgstr "" -#: ../../c-api/init.rst:1998 +#: ../../c-api/init.rst:1914 msgid "" "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " "while setting the trace functions in all threads." msgstr "" -#: ../../c-api/init.rst:2007 +#: ../../c-api/init.rst:1920 +msgid "Reference tracing" +msgstr "" + +#: ../../c-api/init.rst:1926 +msgid "" +"The type of the trace function registered using :c:func:" +"`PyRefTracer_SetTracer`. The first parameter is a Python object that has " +"been just created (when **event** is set to :c:data:`PyRefTracer_CREATE`) or " +"about to be destroyed (when **event** is set to :c:data:" +"`PyRefTracer_DESTROY`). The **data** argument is the opaque pointer that was " +"provided when :c:func:`PyRefTracer_SetTracer` was called." +msgstr "" + +#: ../../c-api/init.rst:1936 +msgid "" +"The value for the *event* parameter to :c:type:`PyRefTracer` functions when " +"a Python object has been created." +msgstr "" + +#: ../../c-api/init.rst:1941 +msgid "" +"The value for the *event* parameter to :c:type:`PyRefTracer` functions when " +"a Python object has been destroyed." +msgstr "" + +#: ../../c-api/init.rst:1946 +msgid "" +"Register a reference tracer function. The function will be called when a new " +"Python has been created or when an object is going to be destroyed. If " +"**data** is provided it must be an opaque pointer that will be provided when " +"the tracer function is called. Return ``0`` on success. Set an exception and " +"return ``-1`` on error." +msgstr "" + +#: ../../c-api/init.rst:1952 +msgid "" +"Not that tracer functions **must not** create Python objects inside or " +"otherwise the call will be re-entrant. The tracer also **must not** clear " +"any existing exception or set an exception. The GIL will be held every time " +"the tracer function is called." +msgstr "" + +#: ../../c-api/init.rst:1957 ../../c-api/init.rst:1968 +msgid "The GIL must be held when calling this function." +msgstr "" + +#: ../../c-api/init.rst:1963 +msgid "" +"Get the registered reference tracer function and the value of the opaque " +"data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " +"called. If no tracer was registered this function will return NULL and will " +"set the **data** pointer to NULL." +msgstr "" + +#: ../../c-api/init.rst:1975 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:2012 +#: ../../c-api/init.rst:1980 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:2017 +#: ../../c-api/init.rst:1985 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:2022 +#: ../../c-api/init.rst:1990 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:2027 +#: ../../c-api/init.rst:1995 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:2033 +#: ../../c-api/init.rst:2001 msgid "" "Return the pointer to the first :c:type:`PyThreadState` object in the list " "of threads associated with the interpreter *interp*." msgstr "" -#: ../../c-api/init.rst:2039 +#: ../../c-api/init.rst:2007 msgid "" "Return the next thread state object after *tstate* from the list of all such " "objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" -#: ../../c-api/init.rst:2046 +#: ../../c-api/init.rst:2014 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:2050 +#: ../../c-api/init.rst:2018 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2435,19 +2399,19 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:2057 +#: ../../c-api/init.rst:2025 msgid "" "The GIL does *not* need to be held when calling these functions; they supply " "their own locking." msgstr "" -#: ../../c-api/init.rst:2060 +#: ../../c-api/init.rst:2028 msgid "" "Note that :file:`Python.h` does not include the declaration of the TLS APIs, " "you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -#: ../../c-api/init.rst:2064 +#: ../../c-api/init.rst:2032 msgid "" "None of these API functions handle memory management on behalf of the :c:" "expr:`void*` values. You need to allocate and deallocate them yourself. If " @@ -2455,22 +2419,22 @@ msgid "" "don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:2072 +#: ../../c-api/init.rst:2040 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:2074 +#: ../../c-api/init.rst:2042 msgid "" "TSS API is introduced to supersede the use of the existing TLS API within " "the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` " "instead of :c:expr:`int` to represent thread keys." msgstr "" -#: ../../c-api/init.rst:2080 +#: ../../c-api/init.rst:2048 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:2085 +#: ../../c-api/init.rst:2053 msgid "" "This data structure represents the state of a thread key, the definition of " "which may depend on the underlying TLS implementation, and it has an " @@ -2478,52 +2442,52 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:2090 +#: ../../c-api/init.rst:2058 msgid "" "When :ref:`Py_LIMITED_API ` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -#: ../../c-api/init.rst:2096 +#: ../../c-api/init.rst:2064 msgid "" "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " "that this macro won't be defined with :ref:`Py_LIMITED_API `." msgstr "" -#: ../../c-api/init.rst:2101 +#: ../../c-api/init.rst:2069 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:2103 +#: ../../c-api/init.rst:2071 msgid "" "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " "built with :ref:`Py_LIMITED_API `, where static allocation of this " "type is not possible due to its implementation being opaque at build time." msgstr "" -#: ../../c-api/init.rst:2110 +#: ../../c-api/init.rst:2078 msgid "" "Return a value which is the same state as a value initialized with :c:macro:" "`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." msgstr "" -#: ../../c-api/init.rst:2117 +#: ../../c-api/init.rst:2085 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" -#: ../../c-api/init.rst:2123 +#: ../../c-api/init.rst:2091 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: ../../c-api/init.rst:2128 +#: ../../c-api/init.rst:2096 msgid "Methods" msgstr "方法" -#: ../../c-api/init.rst:2130 +#: ../../c-api/init.rst:2098 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " @@ -2531,13 +2495,13 @@ msgid "" "func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2138 +#: ../../c-api/init.rst:2106 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2144 +#: ../../c-api/init.rst:2112 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -2546,7 +2510,7 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:2153 +#: ../../c-api/init.rst:2121 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " @@ -2555,31 +2519,31 @@ msgid "" "key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:2162 +#: ../../c-api/init.rst:2130 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" -#: ../../c-api/init.rst:2169 +#: ../../c-api/init.rst:2137 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" -#: ../../c-api/init.rst:2177 +#: ../../c-api/init.rst:2145 msgid "Thread Local Storage (TLS) API" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../c-api/init.rst:2179 +#: ../../c-api/init.rst:2147 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API `." msgstr "" -#: ../../c-api/init.rst:2184 +#: ../../c-api/init.rst:2152 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -2588,190 +2552,364 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:2189 +#: ../../c-api/init.rst:2157 msgid "" "Due to the compatibility problem noted above, this version of the API should " "not be used in new code." msgstr "" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:502 ../../c-api/init.rst:577 -msgid "Py_SetProgramName()" -msgstr "Py_SetProgramName()" +#: ../../c-api/init.rst:2168 +msgid "Synchronization Primitives" +msgstr "" + +#: ../../c-api/init.rst:2170 +msgid "The C-API provides a basic mutual exclusion lock." +msgstr "" + +#: ../../c-api/init.rst:2174 +msgid "" +"A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " +"zero to represent the unlocked state. For example::" +msgstr "" + +#: ../../c-api/init.rst:2177 +msgid "PyMutex mutex = {0};" +msgstr "" -#: ../../c-api/init.rst:334 +#: ../../c-api/init.rst:2179 +msgid "" +"Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " +"contents and address of a :c:type:`!PyMutex` are meaningful, and it must " +"remain at a fixed, writable location in memory." +msgstr "" + +#: ../../c-api/init.rst:2185 +msgid "" +"A :c:type:`!PyMutex` currently occupies one byte, but the size should be " +"considered unstable. The size may change in future Python releases without " +"a deprecation period." +msgstr "" + +#: ../../c-api/init.rst:2193 +msgid "" +"Lock mutex *m*. If another thread has already locked it, the calling thread " +"will block until the mutex is unlocked. While blocked, the thread will " +"temporarily release the :term:`GIL` if it is held." +msgstr "" + +#: ../../c-api/init.rst:2201 +msgid "" +"Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " +"issue a fatal error." +msgstr "" + +#: ../../c-api/init.rst:2209 +msgid "Python Critical Section API" +msgstr "" + +#: ../../c-api/init.rst:2211 +msgid "" +"The critical section API provides a deadlock avoidance layer on top of per-" +"object locks for :term:`free-threaded ` CPython. They are " +"intended to replace reliance on the :term:`global interpreter lock`, and are " +"no-ops in versions of Python with the global interpreter lock." +msgstr "" + +#: ../../c-api/init.rst:2216 +msgid "" +"Critical sections avoid deadlocks by implicitly suspending active critical " +"sections and releasing the locks during calls to :c:func:" +"`PyEval_SaveThread`. When :c:func:`PyEval_RestoreThread` is called, the most " +"recent critical section is resumed, and its locks reacquired. This means " +"the critical section API provides weaker guarantees than traditional locks " +"-- they are useful because their behavior is similar to the :term:`GIL`." +msgstr "" + +#: ../../c-api/init.rst:2223 +msgid "" +"The functions and structs used by the macros are exposed for cases where C " +"macros are not available. They should only be used as in the given macro " +"expansions. Note that the sizes and contents of the structures may change in " +"future Python versions." +msgstr "" + +#: ../../c-api/init.rst:2230 +msgid "" +"Operations that need to lock two objects at once must use :c:macro:" +"`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " +"lock more than one object at once, because the inner critical section may " +"suspend the outer critical sections. This API does not provide a way to " +"lock more than two objects at once." +msgstr "" + +#: ../../c-api/init.rst:2236 +msgid "Example usage::" +msgstr "" + +#: ../../c-api/init.rst:2238 +msgid "" +"static PyObject *\n" +"set_field(MyObject *self, PyObject *value)\n" +"{\n" +" Py_BEGIN_CRITICAL_SECTION(self);\n" +" Py_SETREF(self->field, Py_XNewRef(value));\n" +" Py_END_CRITICAL_SECTION();\n" +" Py_RETURN_NONE;\n" +"}" +msgstr "" + +#: ../../c-api/init.rst:2247 +msgid "" +"In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " +"can call arbitrary code through an object's deallocation function. The " +"critical section API avoids potentital deadlocks due to reentrancy and lock " +"ordering by allowing the runtime to temporarily suspend the critical section " +"if the code triggered by the finalizer blocks and calls :c:func:" +"`PyEval_SaveThread`." +msgstr "" + +#: ../../c-api/init.rst:2255 +msgid "" +"Acquires the per-object lock for the object *op* and begins a critical " +"section." +msgstr "" + +#: ../../c-api/init.rst:2258 ../../c-api/init.rst:2272 +#: ../../c-api/init.rst:2287 ../../c-api/init.rst:2301 +msgid "In the free-threaded build, this macro expands to::" +msgstr "" + +#: ../../c-api/init.rst:2260 +msgid "" +"{\n" +" PyCriticalSection _py_cs;\n" +" PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" +msgstr "" + +#: ../../c-api/init.rst:2264 ../../c-api/init.rst:2293 +msgid "In the default build, this macro expands to ``{``." +msgstr "" + +#: ../../c-api/init.rst:2270 +msgid "Ends the critical section and releases the per-object lock." +msgstr "" + +#: ../../c-api/init.rst:2274 +msgid "" +" PyCriticalSection_End(&_py_cs);\n" +"}" +msgstr "" + +#: ../../c-api/init.rst:2277 ../../c-api/init.rst:2306 +msgid "In the default build, this macro expands to ``}``." +msgstr "" + +#: ../../c-api/init.rst:2283 +msgid "" +"Acquires the per-objects locks for the objects *a* and *b* and begins a " +"critical section. The locks are acquired in a consistent order (lowest " +"address first) to avoid lock ordering deadlocks." +msgstr "" + +#: ../../c-api/init.rst:2289 +msgid "" +"{\n" +" PyCriticalSection2 _py_cs2;\n" +" PyCriticalSection_Begin2(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" +msgstr "" + +#: ../../c-api/init.rst:2299 +msgid "Ends the critical section and releases the per-object locks." +msgstr "" + +#: ../../c-api/init.rst:2303 +msgid "" +" PyCriticalSection_End2(&_py_cs2);\n" +"}" +msgstr "" + +#: ../../c-api/init.rst:335 msgid "PyEval_InitThreads()" msgstr "PyEval_InitThreads()" -#: ../../c-api/init.rst:334 +#: ../../c-api/init.rst:335 msgid "modules (in module sys)" msgstr "modules(sys 模組中)" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:596 ../../c-api/init.rst:622 +#: ../../c-api/init.rst:335 ../../c-api/init.rst:576 msgid "path (in module sys)" msgstr "path(sys 模組中)" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:596 ../../c-api/init.rst:622 -#: ../../c-api/init.rst:1063 ../../c-api/init.rst:1594 -#: ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:335 ../../c-api/init.rst:576 ../../c-api/init.rst:1011 +#: ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 msgid "module" msgstr "模組" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:335 ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:335 ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 msgid "__main__" msgstr "__main__" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:335 ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 msgid "sys" msgstr "sys" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:596 ../../c-api/init.rst:622 +#: ../../c-api/init.rst:335 ../../c-api/init.rst:576 msgid "search" msgstr "search(搜尋)" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:596 ../../c-api/init.rst:622 +#: ../../c-api/init.rst:335 ../../c-api/init.rst:576 msgid "path" msgstr "path(路徑)" -#: ../../c-api/init.rst:334 -msgid "PySys_SetArgv (C function)" -msgstr "PySys_SetArgv(C 函式)" - -#: ../../c-api/init.rst:334 -msgid "PySys_SetArgvEx (C function)" -msgstr "PySys_SetArgvEx(C 函式)" - -#: ../../c-api/init.rst:334 ../../c-api/init.rst:1654 ../../c-api/init.rst:1707 +#: ../../c-api/init.rst:335 ../../c-api/init.rst:1570 ../../c-api/init.rst:1623 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" -#: ../../c-api/init.rst:437 ../../c-api/init.rst:474 +#: ../../c-api/init.rst:445 msgid "Py_Initialize()" msgstr "Py_Initialize()" -#: ../../c-api/init.rst:437 ../../c-api/init.rst:474 ../../c-api/init.rst:730 +#: ../../c-api/init.rst:445 ../../c-api/init.rst:674 msgid "main()" msgstr "main()" -#: ../../c-api/init.rst:437 -msgid "stdin" -msgstr "stdin" - -#: ../../c-api/init.rst:437 -msgid "stdout" -msgstr "stdout" - -#: ../../c-api/init.rst:437 -msgid "sdterr" -msgstr "sdterr" - -#: ../../c-api/init.rst:474 ../../c-api/init.rst:622 +#: ../../c-api/init.rst:445 msgid "Py_GetPath()" msgstr "Py_GetPath()" -#: ../../c-api/init.rst:577 +#: ../../c-api/init.rst:555 msgid "executable (in module sys)" msgstr "executable(sys 模組中)" -#: ../../c-api/init.rst:596 -msgid "Py_SetPath()" -msgstr "Py_SetPath()" - -#: ../../c-api/init.rst:665 ../../c-api/init.rst:707 ../../c-api/init.rst:721 +#: ../../c-api/init.rst:609 ../../c-api/init.rst:651 ../../c-api/init.rst:665 msgid "version (in module sys)" msgstr "version(sys 模組中)" -#: ../../c-api/init.rst:677 +#: ../../c-api/init.rst:621 msgid "platform (in module sys)" msgstr "platform(sys 模組中)" -#: ../../c-api/init.rst:694 +#: ../../c-api/init.rst:638 msgid "copyright (in module sys)" msgstr "copyright(sys 模組中)" -#: ../../c-api/init.rst:730 +#: ../../c-api/init.rst:674 msgid "Py_FatalError()" msgstr "Py_FatalError()" -#: ../../c-api/init.rst:730 +#: ../../c-api/init.rst:674 msgid "argv (in module sys)" msgstr "argv(sys 模組中)" -#: ../../c-api/init.rst:846 +#: ../../c-api/init.rst:794 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../c-api/init.rst:846 +#: ../../c-api/init.rst:794 msgid "interpreter lock" msgstr "interpreter lock(直譯器鎖)" -#: ../../c-api/init.rst:846 +#: ../../c-api/init.rst:794 msgid "lock, interpreter" msgstr "lock, interpreter(鎖、直譯器)" -#: ../../c-api/init.rst:859 +#: ../../c-api/init.rst:807 msgid "setswitchinterval (in module sys)" msgstr "setswitchinterval (sys 模組中)" -#: ../../c-api/init.rst:868 +#: ../../c-api/init.rst:816 msgid "PyThreadState (C type)" msgstr "PyThreadState(C 型別)" -#: ../../c-api/init.rst:894 +#: ../../c-api/init.rst:842 msgid "Py_BEGIN_ALLOW_THREADS (C macro)" msgstr "Py_BEGIN_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:894 +#: ../../c-api/init.rst:842 msgid "Py_END_ALLOW_THREADS (C macro)" msgstr "Py_END_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:910 +#: ../../c-api/init.rst:858 msgid "PyEval_RestoreThread (C function)" msgstr "PyEval_RestoreThread(C 函式)" -#: ../../c-api/init.rst:910 +#: ../../c-api/init.rst:858 msgid "PyEval_SaveThread (C function)" msgstr "PyEval_SaveThread(C 函式)" -#: ../../c-api/init.rst:1041 +#: ../../c-api/init.rst:989 msgid "PyEval_AcquireThread()" msgstr "PyEval_AcquireThread()" -#: ../../c-api/init.rst:1041 +#: ../../c-api/init.rst:989 msgid "PyEval_ReleaseThread()" msgstr "PyEval_ReleaseThread()" -#: ../../c-api/init.rst:1041 +#: ../../c-api/init.rst:989 msgid "PyEval_SaveThread()" msgstr "PyEval_SaveThread()" -#: ../../c-api/init.rst:1041 +#: ../../c-api/init.rst:989 msgid "PyEval_RestoreThread()" msgstr "PyEval_RestoreThread()" -#: ../../c-api/init.rst:1063 +#: ../../c-api/init.rst:1011 msgid "_thread" msgstr "_thread" -#: ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 msgid "stdout (in module sys)" msgstr "stdout(sys 模組中)" -#: ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 msgid "stderr (in module sys)" msgstr "stderr(sys 模組中)" -#: ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 msgid "stdin (in module sys)" msgstr "stdin(sys 模組中)" -#: ../../c-api/init.rst:1654 +#: ../../c-api/init.rst:1570 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/init.rst:1684 +#: ../../c-api/init.rst:1600 msgid "close (in module os)" msgstr "close(os 模組中)" + +#~ msgid ":c:func:`Py_SetPath`" +#~ msgstr ":c:func:`Py_SetPath`" + +#~ msgid ":c:func:`Py_SetStandardStreamEncoding`" +#~ msgstr ":c:func:`Py_SetStandardStreamEncoding`" + +#~ msgid ":c:func:`PySys_AddWarnOption`" +#~ msgstr ":c:func:`PySys_AddWarnOption`" + +#~ msgid ":c:func:`PySys_AddXOption`" +#~ msgstr ":c:func:`PySys_AddXOption`" + +#~ msgid "Py_SetProgramName()" +#~ msgstr "Py_SetProgramName()" + +#~ msgid "PySys_SetArgv (C function)" +#~ msgstr "PySys_SetArgv(C 函式)" + +#~ msgid "PySys_SetArgvEx (C function)" +#~ msgstr "PySys_SetArgvEx(C 函式)" + +#~ msgid "stdin" +#~ msgstr "stdin" + +#~ msgid "stdout" +#~ msgstr "stdout" + +#~ msgid "sdterr" +#~ msgstr "sdterr" + +#~ msgid "Py_SetPath()" +#~ msgstr "Py_SetPath()" diff --git a/c-api/init_config.po b/c-api/init_config.po index d26579f04a..a51f220060 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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-" @@ -149,7 +149,7 @@ msgid "*index* must be greater than or equal to ``0``." msgstr "" #: ../../c-api/init_config.rst:108 ../../c-api/init_config.rst:128 -#: ../../c-api/init_config.rst:235 ../../c-api/init_config.rst:544 +#: ../../c-api/init_config.rst:235 ../../c-api/init_config.rst:554 msgid "Structure fields:" msgstr "" @@ -355,116 +355,135 @@ msgid "" "allocator ` with :ref:`debug hooks `." msgstr "" -#: ../../c-api/init_config.rst:257 +#: ../../c-api/init_config.rst:256 +msgid "" +"``PYMEM_ALLOCATOR_MIMALLOC`` (``6``): use ``mimalloc``, a fast malloc " +"replacement." +msgstr "" + +#: ../../c-api/init_config.rst:258 +msgid "" +"``PYMEM_ALLOCATOR_MIMALLOC_DEBUG`` (``7``): use ``mimalloc``, a fast malloc " +"replacement with :ref:`debug hooks `." +msgstr "" + +#: ../../c-api/init_config.rst:262 msgid "" "``PYMEM_ALLOCATOR_PYMALLOC`` and ``PYMEM_ALLOCATOR_PYMALLOC_DEBUG`` are not " "supported if Python is :option:`configured using --without-pymalloc <--" "without-pymalloc>`." msgstr "" -#: ../../c-api/init_config.rst:261 +#: ../../c-api/init_config.rst:266 +msgid "" +"``PYMEM_ALLOCATOR_MIMALLOC`` and ``PYMEM_ALLOCATOR_MIMALLOC_DEBUG`` are not " +"supported if Python is :option:`configured using --without-mimalloc <--" +"without-mimalloc>` or if the underlying atomic support isn't available." +msgstr "" + +#: ../../c-api/init_config.rst:271 msgid "See :ref:`Memory Management `." msgstr "請見\\ :ref:`記憶體管理 `。" -#: ../../c-api/init_config.rst:263 +#: ../../c-api/init_config.rst:273 msgid "Default: ``PYMEM_ALLOCATOR_NOT_SET``." msgstr "預設:``PYMEM_ALLOCATOR_NOT_SET``。" -#: ../../c-api/init_config.rst:267 +#: ../../c-api/init_config.rst:277 msgid "Set the LC_CTYPE locale to the user preferred locale." msgstr "" -#: ../../c-api/init_config.rst:269 +#: ../../c-api/init_config.rst:279 msgid "" "If equals to ``0``, set :c:member:`~PyPreConfig.coerce_c_locale` and :c:" "member:`~PyPreConfig.coerce_c_locale_warn` members to ``0``." msgstr "" -#: ../../c-api/init_config.rst:272 ../../c-api/init_config.rst:283 +#: ../../c-api/init_config.rst:282 ../../c-api/init_config.rst:293 msgid "See the :term:`locale encoding`." msgstr "請見 :term:`locale encoding`。" -#: ../../c-api/init_config.rst:274 ../../c-api/init_config.rst:329 -#: ../../c-api/init_config.rst:684 +#: ../../c-api/init_config.rst:284 ../../c-api/init_config.rst:339 +#: ../../c-api/init_config.rst:710 msgid "Default: ``1`` in Python config, ``0`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:278 +#: ../../c-api/init_config.rst:288 msgid "If equals to ``2``, coerce the C locale." msgstr "" -#: ../../c-api/init_config.rst:280 +#: ../../c-api/init_config.rst:290 msgid "" "If equals to ``1``, read the LC_CTYPE locale to decide if it should be " "coerced." msgstr "" -#: ../../c-api/init_config.rst:285 ../../c-api/init_config.rst:291 +#: ../../c-api/init_config.rst:295 ../../c-api/init_config.rst:301 msgid "Default: ``-1`` in Python config, ``0`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:289 +#: ../../c-api/init_config.rst:299 msgid "If non-zero, emit a warning if the C locale is coerced." msgstr "" -#: ../../c-api/init_config.rst:295 +#: ../../c-api/init_config.rst:305 msgid "" ":ref:`Python Development Mode `: see :c:member:`PyConfig.dev_mode`." msgstr "" -#: ../../c-api/init_config.rst:298 ../../c-api/init_config.rst:693 -#: ../../c-api/init_config.rst:735 ../../c-api/init_config.rst:1188 +#: ../../c-api/init_config.rst:308 ../../c-api/init_config.rst:719 +#: ../../c-api/init_config.rst:765 ../../c-api/init_config.rst:1244 msgid "Default: ``-1`` in Python mode, ``0`` in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:302 +#: ../../c-api/init_config.rst:312 msgid "Isolated mode: see :c:member:`PyConfig.isolated`." msgstr "" -#: ../../c-api/init_config.rst:304 ../../c-api/init_config.rst:880 +#: ../../c-api/init_config.rst:314 ../../c-api/init_config.rst:921 msgid "Default: ``0`` in Python mode, ``1`` in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:308 +#: ../../c-api/init_config.rst:318 msgid "If non-zero:" msgstr "如果不為 0:" -#: ../../c-api/init_config.rst:310 +#: ../../c-api/init_config.rst:320 msgid "Set :c:member:`PyPreConfig.utf8_mode` to ``0``," msgstr "將 :c:member:`PyPreConfig.utf8_mode` 設為 ``0``、" -#: ../../c-api/init_config.rst:311 +#: ../../c-api/init_config.rst:321 msgid "Set :c:member:`PyConfig.filesystem_encoding` to ``\"mbcs\"``," msgstr "將 :c:member:`PyConfig.filesystem_encoding` 設為 ``\"mbcs\"``、" -#: ../../c-api/init_config.rst:312 +#: ../../c-api/init_config.rst:322 msgid "Set :c:member:`PyConfig.filesystem_errors` to ``\"replace\"``." msgstr "將 :c:member:`PyConfig.filesystem_errors` 設為 ``\"replace\"``。" -#: ../../c-api/init_config.rst:314 +#: ../../c-api/init_config.rst:324 msgid "" "Initialized from the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment " "variable value." msgstr "" -#: ../../c-api/init_config.rst:317 ../../c-api/init_config.rst:894 +#: ../../c-api/init_config.rst:327 ../../c-api/init_config.rst:935 msgid "" "Only available on Windows. ``#ifdef MS_WINDOWS`` macro can be used for " "Windows specific code." msgstr "" -#: ../../c-api/init_config.rst:320 ../../c-api/init_config.rst:632 -#: ../../c-api/init_config.rst:639 ../../c-api/init_config.rst:706 -#: ../../c-api/init_config.rst:815 ../../c-api/init_config.rst:829 -#: ../../c-api/init_config.rst:843 ../../c-api/init_config.rst:897 -#: ../../c-api/init_config.rst:911 ../../c-api/init_config.rst:971 -#: ../../c-api/init_config.rst:1023 ../../c-api/init_config.rst:1083 -#: ../../c-api/init_config.rst:1123 ../../c-api/init_config.rst:1152 -#: ../../c-api/init_config.rst:1239 +#: ../../c-api/init_config.rst:330 ../../c-api/init_config.rst:658 +#: ../../c-api/init_config.rst:665 ../../c-api/init_config.rst:732 +#: ../../c-api/init_config.rst:843 ../../c-api/init_config.rst:857 +#: ../../c-api/init_config.rst:871 ../../c-api/init_config.rst:938 +#: ../../c-api/init_config.rst:952 ../../c-api/init_config.rst:1012 +#: ../../c-api/init_config.rst:1064 ../../c-api/init_config.rst:1126 +#: ../../c-api/init_config.rst:1180 ../../c-api/init_config.rst:1209 +#: ../../c-api/init_config.rst:1298 msgid "Default: ``0``." msgstr "預設:``0``。" -#: ../../c-api/init_config.rst:324 +#: ../../c-api/init_config.rst:334 msgid "" "If non-zero, :c:func:`Py_PreInitializeFromArgs` and :c:func:" "`Py_PreInitializeFromBytesArgs` parse their ``argv`` argument the same way " @@ -472,95 +491,95 @@ msgid "" "Arguments `." msgstr "" -#: ../../c-api/init_config.rst:333 +#: ../../c-api/init_config.rst:343 msgid "" "Use :ref:`environment variables `? See :c:member:`PyConfig." "use_environment`." msgstr "" -#: ../../c-api/init_config.rst:336 ../../c-api/init_config.rst:1213 +#: ../../c-api/init_config.rst:346 ../../c-api/init_config.rst:1272 msgid "Default: ``1`` in Python config and ``0`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:340 +#: ../../c-api/init_config.rst:350 msgid "If non-zero, enable the :ref:`Python UTF-8 Mode `." msgstr "" -#: ../../c-api/init_config.rst:342 +#: ../../c-api/init_config.rst:352 msgid "" "Set to ``0`` or ``1`` by the :option:`-X utf8 <-X>` command line option and " "the :envvar:`PYTHONUTF8` environment variable." msgstr "" -#: ../../c-api/init_config.rst:345 +#: ../../c-api/init_config.rst:355 msgid "Also set to ``1`` if the ``LC_CTYPE`` locale is ``C`` or ``POSIX``." msgstr "" -#: ../../c-api/init_config.rst:347 +#: ../../c-api/init_config.rst:357 msgid "Default: ``-1`` in Python config and ``0`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:353 +#: ../../c-api/init_config.rst:363 msgid "Preinitialize Python with PyPreConfig" msgstr "" -#: ../../c-api/init_config.rst:355 +#: ../../c-api/init_config.rst:365 msgid "The preinitialization of Python:" msgstr "" -#: ../../c-api/init_config.rst:357 +#: ../../c-api/init_config.rst:367 msgid "Set the Python memory allocators (:c:member:`PyPreConfig.allocator`)" msgstr "" -#: ../../c-api/init_config.rst:358 +#: ../../c-api/init_config.rst:368 msgid "Configure the LC_CTYPE locale (:term:`locale encoding`)" msgstr "" -#: ../../c-api/init_config.rst:359 +#: ../../c-api/init_config.rst:369 msgid "" "Set the :ref:`Python UTF-8 Mode ` (:c:member:`PyPreConfig." "utf8_mode`)" msgstr "" -#: ../../c-api/init_config.rst:362 +#: ../../c-api/init_config.rst:372 msgid "" "The current preconfiguration (``PyPreConfig`` type) is stored in " "``_PyRuntime.preconfig``." msgstr "" -#: ../../c-api/init_config.rst:365 +#: ../../c-api/init_config.rst:375 msgid "Functions to preinitialize Python:" msgstr "" -#: ../../c-api/init_config.rst:369 ../../c-api/init_config.rst:375 -#: ../../c-api/init_config.rst:384 +#: ../../c-api/init_config.rst:379 ../../c-api/init_config.rst:385 +#: ../../c-api/init_config.rst:394 msgid "Preinitialize Python from *preconfig* preconfiguration." msgstr "" -#: ../../c-api/init_config.rst:371 ../../c-api/init_config.rst:380 -#: ../../c-api/init_config.rst:389 +#: ../../c-api/init_config.rst:381 ../../c-api/init_config.rst:390 +#: ../../c-api/init_config.rst:399 msgid "*preconfig* must not be ``NULL``." msgstr "*preconfig* 不可為 ``NULL``。" -#: ../../c-api/init_config.rst:377 +#: ../../c-api/init_config.rst:387 msgid "" "Parse *argv* command line arguments (bytes strings) if :c:member:" "`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -#: ../../c-api/init_config.rst:386 +#: ../../c-api/init_config.rst:396 msgid "" "Parse *argv* command line arguments (wide strings) if :c:member:" "`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -#: ../../c-api/init_config.rst:391 ../../c-api/init_config.rst:1301 +#: ../../c-api/init_config.rst:401 ../../c-api/init_config.rst:1360 msgid "" "The caller is responsible to handle exceptions (error or exit) using :c:func:" "`PyStatus_Exception` and :c:func:`Py_ExitStatusException`." msgstr "" -#: ../../c-api/init_config.rst:394 +#: ../../c-api/init_config.rst:404 msgid "" "For :ref:`Python Configuration ` (:c:func:" "`PyPreConfig_InitPythonConfig`), if Python is initialized with command line " @@ -570,7 +589,7 @@ msgid "" "`Python UTF-8 Mode `." msgstr "" -#: ../../c-api/init_config.rst:401 +#: ../../c-api/init_config.rst:411 msgid "" "``PyMem_SetAllocator()`` can be called after :c:func:`Py_PreInitialize` and " "before :c:func:`Py_InitializeFromConfig` to install a custom memory " @@ -578,7 +597,7 @@ msgid "" "`PyPreConfig.allocator` is set to ``PYMEM_ALLOCATOR_NOT_SET``." msgstr "" -#: ../../c-api/init_config.rst:406 +#: ../../c-api/init_config.rst:416 msgid "" "Python memory allocation functions like :c:func:`PyMem_RawMalloc` must not " "be used before the Python preinitialization, whereas calling directly " @@ -586,13 +605,13 @@ msgid "" "not be called before the Python preinitialization." msgstr "" -#: ../../c-api/init_config.rst:411 +#: ../../c-api/init_config.rst:421 msgid "" "Example using the preinitialization to enable the :ref:`Python UTF-8 Mode " "`::" msgstr "" -#: ../../c-api/init_config.rst:414 +#: ../../c-api/init_config.rst:424 msgid "" "PyStatus status;\n" "PyPreConfig preconfig;\n" @@ -612,84 +631,84 @@ msgid "" "Py_Finalize();" msgstr "" -#: ../../c-api/init_config.rst:433 +#: ../../c-api/init_config.rst:443 msgid "PyConfig" msgstr "PyConfig" -#: ../../c-api/init_config.rst:437 +#: ../../c-api/init_config.rst:447 msgid "Structure containing most parameters to configure Python." msgstr "" -#: ../../c-api/init_config.rst:439 +#: ../../c-api/init_config.rst:449 msgid "" "When done, the :c:func:`PyConfig_Clear` function must be used to release the " "configuration memory." msgstr "" -#: ../../c-api/init_config.rst:444 +#: ../../c-api/init_config.rst:454 msgid "Structure methods:" msgstr "" -#: ../../c-api/init_config.rst:448 +#: ../../c-api/init_config.rst:458 msgid "" "Initialize configuration with the :ref:`Python Configuration `." msgstr "" -#: ../../c-api/init_config.rst:453 +#: ../../c-api/init_config.rst:463 msgid "" "Initialize configuration with the :ref:`Isolated Configuration `." msgstr "" -#: ../../c-api/init_config.rst:458 +#: ../../c-api/init_config.rst:468 msgid "Copy the wide character string *str* into ``*config_str``." msgstr "" -#: ../../c-api/init_config.rst:460 ../../c-api/init_config.rst:467 -#: ../../c-api/init_config.rst:474 ../../c-api/init_config.rst:482 -#: ../../c-api/init_config.rst:488 ../../c-api/init_config.rst:505 +#: ../../c-api/init_config.rst:470 ../../c-api/init_config.rst:477 +#: ../../c-api/init_config.rst:484 ../../c-api/init_config.rst:492 +#: ../../c-api/init_config.rst:498 ../../c-api/init_config.rst:515 msgid ":ref:`Preinitialize Python ` if needed." msgstr "" -#: ../../c-api/init_config.rst:464 +#: ../../c-api/init_config.rst:474 msgid "" "Decode *str* using :c:func:`Py_DecodeLocale` and set the result into " "``*config_str``." msgstr "" -#: ../../c-api/init_config.rst:471 +#: ../../c-api/init_config.rst:481 msgid "" "Set command line arguments (:c:member:`~PyConfig.argv` member of *config*) " "from the *argv* list of wide character strings." msgstr "" -#: ../../c-api/init_config.rst:478 +#: ../../c-api/init_config.rst:488 msgid "" "Set command line arguments (:c:member:`~PyConfig.argv` member of *config*) " "from the *argv* list of bytes strings. Decode bytes using :c:func:" "`Py_DecodeLocale`." msgstr "" -#: ../../c-api/init_config.rst:486 +#: ../../c-api/init_config.rst:496 msgid "Set the list of wide strings *list* to *length* and *items*." msgstr "" -#: ../../c-api/init_config.rst:492 +#: ../../c-api/init_config.rst:502 msgid "Read all Python configuration." msgstr "" -#: ../../c-api/init_config.rst:494 +#: ../../c-api/init_config.rst:504 msgid "Fields which are already initialized are left unchanged." msgstr "" -#: ../../c-api/init_config.rst:496 +#: ../../c-api/init_config.rst:506 msgid "" "Fields for :ref:`path configuration ` are no longer " "calculated or modified when calling this function, as of Python 3.11." msgstr "" -#: ../../c-api/init_config.rst:499 ../../c-api/init_config.rst:1000 +#: ../../c-api/init_config.rst:509 ../../c-api/init_config.rst:1041 msgid "" "The :c:func:`PyConfig_Read` function only parses :c:member:`PyConfig.argv` " "arguments once: :c:member:`PyConfig.parse_argv` is set to ``2`` after " @@ -698,25 +717,25 @@ msgid "" "as Python options." msgstr "" -#: ../../c-api/init_config.rst:507 +#: ../../c-api/init_config.rst:517 msgid "" "The :c:member:`PyConfig.argv` arguments are now only parsed once, :c:member:" "`PyConfig.parse_argv` is set to ``2`` after arguments are parsed, and " "arguments are only parsed if :c:member:`PyConfig.parse_argv` equals ``1``." msgstr "" -#: ../../c-api/init_config.rst:513 +#: ../../c-api/init_config.rst:523 msgid "" ":c:func:`PyConfig_Read` no longer calculates all paths, and so fields listed " "under :ref:`Python Path Configuration ` may no longer be " "updated until :c:func:`Py_InitializeFromConfig` is called." msgstr "" -#: ../../c-api/init_config.rst:521 +#: ../../c-api/init_config.rst:531 msgid "Release configuration memory." msgstr "" -#: ../../c-api/init_config.rst:523 +#: ../../c-api/init_config.rst:533 msgid "" "Most ``PyConfig`` methods :ref:`preinitialize Python ` if needed. " "In that case, the Python preinitialization configuration (:c:type:" @@ -725,23 +744,23 @@ msgid "" "before calling a :c:type:`PyConfig` method:" msgstr "" -#: ../../c-api/init_config.rst:529 +#: ../../c-api/init_config.rst:539 msgid ":c:member:`PyConfig.dev_mode`" msgstr ":c:member:`PyConfig.dev_mode`" -#: ../../c-api/init_config.rst:530 +#: ../../c-api/init_config.rst:540 msgid ":c:member:`PyConfig.isolated`" msgstr ":c:member:`PyConfig.isolated`" -#: ../../c-api/init_config.rst:531 +#: ../../c-api/init_config.rst:541 msgid ":c:member:`PyConfig.parse_argv`" msgstr ":c:member:`PyConfig.parse_argv`" -#: ../../c-api/init_config.rst:532 +#: ../../c-api/init_config.rst:542 msgid ":c:member:`PyConfig.use_environment`" msgstr ":c:member:`PyConfig.use_environment`" -#: ../../c-api/init_config.rst:534 +#: ../../c-api/init_config.rst:544 msgid "" "Moreover, if :c:func:`PyConfig_SetArgv` or :c:func:`PyConfig_SetBytesArgv` " "is used, this method must be called before other methods, since the " @@ -749,412 +768,435 @@ msgid "" "member:`~PyConfig.parse_argv` is non-zero)." msgstr "" -#: ../../c-api/init_config.rst:539 +#: ../../c-api/init_config.rst:549 msgid "" "The caller of these methods is responsible to handle exceptions (error or " "exit) using ``PyStatus_Exception()`` and ``Py_ExitStatusException()``." msgstr "" -#: ../../c-api/init_config.rst:548 -msgid "Command line arguments: :data:`sys.argv`." -msgstr "命令列引數::data:`sys.argv`。" +#: ../../c-api/init_config.rst:562 +msgid "" +"Set :data:`sys.argv` command line arguments based on :c:member:`~PyConfig." +"argv`. These parameters are similar to those passed to the program's :c:" +"func:`main` function with the difference that the first entry should refer " +"to the script file to be executed rather than the executable hosting the " +"Python interpreter. If there isn't a script that will be run, the first " +"entry in :c:member:`~PyConfig.argv` can be an empty string." +msgstr "" -#: ../../c-api/init_config.rst:550 +#: ../../c-api/init_config.rst:570 msgid "" "Set :c:member:`~PyConfig.parse_argv` to ``1`` to parse :c:member:`~PyConfig." "argv` the same way the regular Python parses Python command line arguments " "and then to strip Python arguments from :c:member:`~PyConfig.argv`." msgstr "" -#: ../../c-api/init_config.rst:555 +#: ../../c-api/init_config.rst:575 msgid "" "If :c:member:`~PyConfig.argv` is empty, an empty string is added to ensure " "that :data:`sys.argv` always exists and is never empty." msgstr "" -#: ../../c-api/init_config.rst:558 ../../c-api/init_config.rst:585 -#: ../../c-api/init_config.rst:597 ../../c-api/init_config.rst:605 -#: ../../c-api/init_config.rst:713 ../../c-api/init_config.rst:722 -#: ../../c-api/init_config.rst:804 ../../c-api/init_config.rst:941 -#: ../../c-api/init_config.rst:1042 ../../c-api/init_config.rst:1060 -#: ../../c-api/init_config.rst:1074 ../../c-api/init_config.rst:1091 -#: ../../c-api/init_config.rst:1104 ../../c-api/init_config.rst:1112 +#: ../../c-api/init_config.rst:578 ../../c-api/init_config.rst:605 +#: ../../c-api/init_config.rst:619 ../../c-api/init_config.rst:629 +#: ../../c-api/init_config.rst:739 ../../c-api/init_config.rst:750 +#: ../../c-api/init_config.rst:832 ../../c-api/init_config.rst:982 +#: ../../c-api/init_config.rst:1083 ../../c-api/init_config.rst:1102 +#: ../../c-api/init_config.rst:1117 ../../c-api/init_config.rst:1134 +#: ../../c-api/init_config.rst:1147 ../../c-api/init_config.rst:1155 +#: ../../c-api/init_config.rst:1169 msgid "Default: ``NULL``." msgstr "預設值:``NULL``。" -#: ../../c-api/init_config.rst:560 +#: ../../c-api/init_config.rst:580 msgid "See also the :c:member:`~PyConfig.orig_argv` member." msgstr "" -#: ../../c-api/init_config.rst:564 +#: ../../c-api/init_config.rst:584 msgid "" "If equals to zero, ``Py_RunMain()`` prepends a potentially unsafe path to :" "data:`sys.path` at startup:" msgstr "" -#: ../../c-api/init_config.rst:567 +#: ../../c-api/init_config.rst:587 msgid "" "If :c:member:`argv[0] ` is equal to ``L\"-m\"`` (``python -m " "module``), prepend the current working directory." msgstr "" -#: ../../c-api/init_config.rst:569 +#: ../../c-api/init_config.rst:589 msgid "" "If running a script (``python script.py``), prepend the script's directory. " "If it's a symbolic link, resolve symbolic links." msgstr "" -#: ../../c-api/init_config.rst:571 +#: ../../c-api/init_config.rst:591 msgid "" "Otherwise (``python -c code`` and ``python``), prepend an empty string, " "which means the current working directory." msgstr "" -#: ../../c-api/init_config.rst:574 +#: ../../c-api/init_config.rst:594 msgid "" "Set to ``1`` by the :option:`-P` command line option and the :envvar:" "`PYTHONSAFEPATH` environment variable." msgstr "" -#: ../../c-api/init_config.rst:577 +#: ../../c-api/init_config.rst:597 msgid "Default: ``0`` in Python config, ``1`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:583 +#: ../../c-api/init_config.rst:603 msgid ":data:`sys.base_exec_prefix`." msgstr ":data:`sys.base_exec_prefix`。" -#: ../../c-api/init_config.rst:587 ../../c-api/init_config.rst:599 -#: ../../c-api/init_config.rst:607 ../../c-api/init_config.rst:715 -#: ../../c-api/init_config.rst:724 ../../c-api/init_config.rst:958 -#: ../../c-api/init_config.rst:1044 +#: ../../c-api/init_config.rst:607 ../../c-api/init_config.rst:621 +#: ../../c-api/init_config.rst:631 ../../c-api/init_config.rst:741 +#: ../../c-api/init_config.rst:752 ../../c-api/init_config.rst:999 +#: ../../c-api/init_config.rst:1085 msgid "Part of the :ref:`Python Path Configuration ` output." msgstr "" -#: ../../c-api/init_config.rst:591 +#: ../../c-api/init_config.rst:609 +msgid "See also :c:member:`PyConfig.exec_prefix`." +msgstr "也請見 :c:member:`PyConfig.exec_prefix`" + +#: ../../c-api/init_config.rst:613 msgid "Python base executable: :data:`sys._base_executable`." msgstr "" -#: ../../c-api/init_config.rst:593 +#: ../../c-api/init_config.rst:615 msgid "Set by the :envvar:`__PYVENV_LAUNCHER__` environment variable." msgstr "" -#: ../../c-api/init_config.rst:595 +#: ../../c-api/init_config.rst:617 msgid "Set from :c:member:`PyConfig.executable` if ``NULL``." msgstr "" -#: ../../c-api/init_config.rst:603 +#: ../../c-api/init_config.rst:623 +msgid "See also :c:member:`PyConfig.executable`." +msgstr "也請見 :c:member:`PyConfig.executable`" + +#: ../../c-api/init_config.rst:627 msgid ":data:`sys.base_prefix`." msgstr ":data:`sys.base_prefix`。" -#: ../../c-api/init_config.rst:611 +#: ../../c-api/init_config.rst:633 +msgid "See also :c:member:`PyConfig.prefix`." +msgstr "也請見 :c:member:`PyConfig.prefix`" + +#: ../../c-api/init_config.rst:637 msgid "" "If equals to ``0`` and :c:member:`~PyConfig.configure_c_stdio` is non-zero, " "disable buffering on the C streams stdout and stderr." msgstr "" -#: ../../c-api/init_config.rst:614 +#: ../../c-api/init_config.rst:640 msgid "" "Set to ``0`` by the :option:`-u` command line option and the :envvar:" "`PYTHONUNBUFFERED` environment variable." msgstr "" -#: ../../c-api/init_config.rst:617 +#: ../../c-api/init_config.rst:643 msgid "stdin is always opened in buffered mode." msgstr "" -#: ../../c-api/init_config.rst:619 ../../c-api/init_config.rst:652 -#: ../../c-api/init_config.rst:1140 ../../c-api/init_config.rst:1271 +#: ../../c-api/init_config.rst:645 ../../c-api/init_config.rst:678 +#: ../../c-api/init_config.rst:1197 ../../c-api/init_config.rst:1330 msgid "Default: ``1``." msgstr "預設值:``1``。" -#: ../../c-api/init_config.rst:623 +#: ../../c-api/init_config.rst:649 msgid "" "If equals to ``1``, issue a warning when comparing :class:`bytes` or :class:" "`bytearray` with :class:`str`, or comparing :class:`bytes` with :class:`int`." msgstr "" -#: ../../c-api/init_config.rst:627 +#: ../../c-api/init_config.rst:653 msgid "" "If equal or greater to ``2``, raise a :exc:`BytesWarning` exception in these " "cases." msgstr "" -#: ../../c-api/init_config.rst:630 +#: ../../c-api/init_config.rst:656 msgid "Incremented by the :option:`-b` command line option." msgstr "" -#: ../../c-api/init_config.rst:636 +#: ../../c-api/init_config.rst:662 msgid "" "If non-zero, emit a :exc:`EncodingWarning` warning when :class:`io." "TextIOWrapper` uses its default encoding. See :ref:`io-encoding-warning` for " "details." msgstr "" -#: ../../c-api/init_config.rst:645 +#: ../../c-api/init_config.rst:671 msgid "" "If equals to ``0``, disables the inclusion of the end line and column " "mappings in code objects. Also disables traceback printing carets to " "specific error locations." msgstr "" -#: ../../c-api/init_config.rst:649 +#: ../../c-api/init_config.rst:675 msgid "" "Set to ``0`` by the :envvar:`PYTHONNODEBUGRANGES` environment variable and " "by the :option:`-X no_debug_ranges <-X>` command line option." msgstr "" -#: ../../c-api/init_config.rst:658 +#: ../../c-api/init_config.rst:684 msgid "" "Control the validation behavior of hash-based ``.pyc`` files: value of the :" "option:`--check-hash-based-pycs` command line option." msgstr "" -#: ../../c-api/init_config.rst:661 +#: ../../c-api/init_config.rst:687 msgid "Valid values:" msgstr "" -#: ../../c-api/init_config.rst:663 +#: ../../c-api/init_config.rst:689 msgid "" "``L\"always\"``: Hash the source file for invalidation regardless of value " "of the 'check_source' flag." msgstr "" -#: ../../c-api/init_config.rst:665 +#: ../../c-api/init_config.rst:691 msgid "``L\"never\"``: Assume that hash-based pycs always are valid." msgstr "" -#: ../../c-api/init_config.rst:666 +#: ../../c-api/init_config.rst:692 msgid "" "``L\"default\"``: The 'check_source' flag in hash-based pycs determines " "invalidation." msgstr "" -#: ../../c-api/init_config.rst:669 +#: ../../c-api/init_config.rst:695 msgid "Default: ``L\"default\"``." msgstr "預設:``L\"default\"``。" -#: ../../c-api/init_config.rst:671 +#: ../../c-api/init_config.rst:697 msgid "See also :pep:`552` \"Deterministic pycs\"." msgstr "" -#: ../../c-api/init_config.rst:675 +#: ../../c-api/init_config.rst:701 msgid "If non-zero, configure C standard streams:" msgstr "" -#: ../../c-api/init_config.rst:677 +#: ../../c-api/init_config.rst:703 msgid "" "On Windows, set the binary mode (``O_BINARY``) on stdin, stdout and stderr." msgstr "" -#: ../../c-api/init_config.rst:679 +#: ../../c-api/init_config.rst:705 msgid "" "If :c:member:`~PyConfig.buffered_stdio` equals zero, disable buffering of " "stdin, stdout and stderr streams." msgstr "" -#: ../../c-api/init_config.rst:681 +#: ../../c-api/init_config.rst:707 msgid "" "If :c:member:`~PyConfig.interactive` is non-zero, enable stream buffering on " "stdin and stdout (only stdout on Windows)." msgstr "" -#: ../../c-api/init_config.rst:688 +#: ../../c-api/init_config.rst:714 msgid "If non-zero, enable the :ref:`Python Development Mode `." msgstr "" -#: ../../c-api/init_config.rst:690 +#: ../../c-api/init_config.rst:716 msgid "" "Set to ``1`` by the :option:`-X dev <-X>` option and the :envvar:" "`PYTHONDEVMODE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:697 +#: ../../c-api/init_config.rst:723 msgid "Dump Python references?" msgstr "" -#: ../../c-api/init_config.rst:699 +#: ../../c-api/init_config.rst:725 msgid "If non-zero, dump all objects which are still alive at exit." msgstr "" -#: ../../c-api/init_config.rst:701 +#: ../../c-api/init_config.rst:727 msgid "Set to ``1`` by the :envvar:`PYTHONDUMPREFS` environment variable." msgstr "" -#: ../../c-api/init_config.rst:703 +#: ../../c-api/init_config.rst:729 msgid "" -"Need a special build of Python with the ``Py_TRACE_REFS`` macro defined: see " -"the :option:`configure --with-trace-refs option <--with-trace-refs>`." +"Needs a special build of Python with the ``Py_TRACE_REFS`` macro defined: " +"see the :option:`configure --with-trace-refs option <--with-trace-refs>`." msgstr "" -#: ../../c-api/init_config.rst:710 +#: ../../c-api/init_config.rst:736 msgid "" "The site-specific directory prefix where the platform-dependent Python files " "are installed: :data:`sys.exec_prefix`." msgstr "" -#: ../../c-api/init_config.rst:719 +#: ../../c-api/init_config.rst:743 +msgid "See also :c:member:`PyConfig.base_exec_prefix`." +msgstr "也請見 :c:member:`PyConfig.base_exec_prefix`" + +#: ../../c-api/init_config.rst:747 msgid "" "The absolute path of the executable binary for the Python interpreter: :data:" "`sys.executable`." msgstr "" -#: ../../c-api/init_config.rst:728 +#: ../../c-api/init_config.rst:754 +msgid "See also :c:member:`PyConfig.base_executable`." +msgstr "也請見 :c:member:`PyConfig.base_executable`" + +#: ../../c-api/init_config.rst:758 msgid "Enable faulthandler?" msgstr "" -#: ../../c-api/init_config.rst:730 +#: ../../c-api/init_config.rst:760 msgid "If non-zero, call :func:`faulthandler.enable` at startup." msgstr "" -#: ../../c-api/init_config.rst:732 +#: ../../c-api/init_config.rst:762 msgid "" "Set to ``1`` by :option:`-X faulthandler <-X>` and the :envvar:" "`PYTHONFAULTHANDLER` environment variable." msgstr "" -#: ../../c-api/init_config.rst:739 +#: ../../c-api/init_config.rst:769 msgid "" ":term:`Filesystem encoding `: :func:" "`sys.getfilesystemencoding`." msgstr "" -#: ../../c-api/init_config.rst:742 +#: ../../c-api/init_config.rst:772 msgid "On macOS, Android and VxWorks: use ``\"utf-8\"`` by default." msgstr "" -#: ../../c-api/init_config.rst:744 +#: ../../c-api/init_config.rst:774 msgid "" "On Windows: use ``\"utf-8\"`` by default, or ``\"mbcs\"`` if :c:member:" "`~PyPreConfig.legacy_windows_fs_encoding` of :c:type:`PyPreConfig` is non-" "zero." msgstr "" -#: ../../c-api/init_config.rst:748 +#: ../../c-api/init_config.rst:778 msgid "Default encoding on other platforms:" msgstr "" -#: ../../c-api/init_config.rst:750 +#: ../../c-api/init_config.rst:780 msgid "``\"utf-8\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero." msgstr "" -#: ../../c-api/init_config.rst:751 +#: ../../c-api/init_config.rst:781 msgid "" "``\"ascii\"`` if Python detects that ``nl_langinfo(CODESET)`` announces the " "ASCII encoding, whereas the ``mbstowcs()`` function decodes from a different " "encoding (usually Latin1)." msgstr "" -#: ../../c-api/init_config.rst:754 +#: ../../c-api/init_config.rst:784 msgid "``\"utf-8\"`` if ``nl_langinfo(CODESET)`` returns an empty string." msgstr "" -#: ../../c-api/init_config.rst:755 +#: ../../c-api/init_config.rst:785 msgid "" "Otherwise, use the :term:`locale encoding`: ``nl_langinfo(CODESET)`` result." msgstr "" -#: ../../c-api/init_config.rst:758 +#: ../../c-api/init_config.rst:788 msgid "" "At Python startup, the encoding name is normalized to the Python codec name. " "For example, ``\"ANSI_X3.4-1968\"`` is replaced with ``\"ascii\"``." msgstr "" -#: ../../c-api/init_config.rst:761 +#: ../../c-api/init_config.rst:791 msgid "See also the :c:member:`~PyConfig.filesystem_errors` member." msgstr "" -#: ../../c-api/init_config.rst:765 +#: ../../c-api/init_config.rst:795 msgid "" ":term:`Filesystem error handler `: :" "func:`sys.getfilesystemencodeerrors`." msgstr "" -#: ../../c-api/init_config.rst:768 +#: ../../c-api/init_config.rst:798 msgid "" "On Windows: use ``\"surrogatepass\"`` by default, or ``\"replace\"`` if :c:" "member:`~PyPreConfig.legacy_windows_fs_encoding` of :c:type:`PyPreConfig` is " "non-zero." msgstr "" -#: ../../c-api/init_config.rst:772 +#: ../../c-api/init_config.rst:802 msgid "On other platforms: use ``\"surrogateescape\"`` by default." msgstr "" -#: ../../c-api/init_config.rst:774 +#: ../../c-api/init_config.rst:804 msgid "Supported error handlers:" msgstr "" -#: ../../c-api/init_config.rst:776 +#: ../../c-api/init_config.rst:806 msgid "``\"strict\"``" msgstr "``\"strict\"``" -#: ../../c-api/init_config.rst:777 +#: ../../c-api/init_config.rst:807 msgid "``\"surrogateescape\"``" msgstr "``\"surrogateescape\"``" -#: ../../c-api/init_config.rst:778 +#: ../../c-api/init_config.rst:808 msgid "``\"surrogatepass\"`` (only supported with the UTF-8 encoding)" msgstr "" -#: ../../c-api/init_config.rst:780 +#: ../../c-api/init_config.rst:810 msgid "See also the :c:member:`~PyConfig.filesystem_encoding` member." msgstr "" -#: ../../c-api/init_config.rst:785 +#: ../../c-api/init_config.rst:815 msgid "Randomized hash function seed." msgstr "" -#: ../../c-api/init_config.rst:787 +#: ../../c-api/init_config.rst:817 msgid "" "If :c:member:`~PyConfig.use_hash_seed` is zero, a seed is chosen randomly at " "Python startup, and :c:member:`~PyConfig.hash_seed` is ignored." msgstr "" -#: ../../c-api/init_config.rst:790 +#: ../../c-api/init_config.rst:820 msgid "Set by the :envvar:`PYTHONHASHSEED` environment variable." msgstr "" -#: ../../c-api/init_config.rst:792 +#: ../../c-api/init_config.rst:822 msgid "" "Default *use_hash_seed* value: ``-1`` in Python mode, ``0`` in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:797 -msgid "Python home directory." -msgstr "" - -#: ../../c-api/init_config.rst:799 +#: ../../c-api/init_config.rst:827 msgid "" -"If :c:func:`Py_SetPythonHome` has been called, use its argument if it is not " -"``NULL``." +"Set the default Python \"home\" directory, that is, the location of the " +"standard Python libraries (see :envvar:`PYTHONHOME`)." msgstr "" -#: ../../c-api/init_config.rst:802 +#: ../../c-api/init_config.rst:830 msgid "Set by the :envvar:`PYTHONHOME` environment variable." msgstr "" -#: ../../c-api/init_config.rst:806 ../../c-api/init_config.rst:923 -#: ../../c-api/init_config.rst:943 ../../c-api/init_config.rst:1032 -#: ../../c-api/init_config.rst:1062 +#: ../../c-api/init_config.rst:834 ../../c-api/init_config.rst:964 +#: ../../c-api/init_config.rst:984 ../../c-api/init_config.rst:1073 +#: ../../c-api/init_config.rst:1104 msgid "Part of the :ref:`Python Path Configuration ` input." msgstr "" -#: ../../c-api/init_config.rst:810 +#: ../../c-api/init_config.rst:838 msgid "If non-zero, profile import time." msgstr "" -#: ../../c-api/init_config.rst:812 +#: ../../c-api/init_config.rst:840 msgid "" "Set the ``1`` by the :option:`-X importtime <-X>` option and the :envvar:" "`PYTHONPROFILEIMPORTTIME` environment variable." msgstr "" -#: ../../c-api/init_config.rst:819 +#: ../../c-api/init_config.rst:847 msgid "Enter interactive mode after executing a script or a command." msgstr "" -#: ../../c-api/init_config.rst:821 +#: ../../c-api/init_config.rst:849 msgid "" "If greater than ``0``, enable inspect: when a script is passed as first " "argument or the -c option is used, enter interactive mode after executing " @@ -1162,30 +1204,30 @@ msgid "" "a terminal." msgstr "" -#: ../../c-api/init_config.rst:826 +#: ../../c-api/init_config.rst:854 msgid "" "Incremented by the :option:`-i` command line option. Set to ``1`` if the :" "envvar:`PYTHONINSPECT` environment variable is non-empty." msgstr "" -#: ../../c-api/init_config.rst:833 +#: ../../c-api/init_config.rst:861 msgid "Install Python signal handlers?" msgstr "" -#: ../../c-api/init_config.rst:835 ../../c-api/init_config.rst:1006 -#: ../../c-api/init_config.rst:1030 ../../c-api/init_config.rst:1223 +#: ../../c-api/init_config.rst:863 ../../c-api/init_config.rst:1047 +#: ../../c-api/init_config.rst:1071 ../../c-api/init_config.rst:1282 msgid "Default: ``1`` in Python mode, ``0`` in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:839 +#: ../../c-api/init_config.rst:867 msgid "If greater than ``0``, enable the interactive mode (REPL)." msgstr "" -#: ../../c-api/init_config.rst:841 +#: ../../c-api/init_config.rst:869 msgid "Incremented by the :option:`-i` command line option." msgstr "" -#: ../../c-api/init_config.rst:847 +#: ../../c-api/init_config.rst:875 msgid "" "Configures the :ref:`integer string conversion length limitation " "`. An initial value of ``-1`` means the value will be " @@ -1195,30 +1237,47 @@ msgid "" "str_digits_check_threshold`) are unsupported and will produce an error." msgstr "" -#: ../../c-api/init_config.rst:855 +#: ../../c-api/init_config.rst:883 msgid "" "Configured by the :option:`-X int_max_str_digits <-X>` command line flag or " "the :envvar:`PYTHONINTMAXSTRDIGITS` environment variable." msgstr "" -#: ../../c-api/init_config.rst:858 +#: ../../c-api/init_config.rst:886 msgid "" "Default: ``-1`` in Python mode. 4300 (:data:`sys.int_info." "default_max_str_digits`) in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:865 +#: ../../c-api/init_config.rst:893 +msgid "" +"If the value of :c:member:`~PyConfig.cpu_count` is not ``-1`` then it will " +"override the return values of :func:`os.cpu_count`, :func:`os." +"process_cpu_count`, and :func:`multiprocessing.cpu_count`." +msgstr "" + +#: ../../c-api/init_config.rst:897 +msgid "" +"Configured by the :samp:`-X cpu_count={n|default}` command line flag or the :" +"envvar:`PYTHON_CPU_COUNT` environment variable." +msgstr "" + +#: ../../c-api/init_config.rst:900 ../../c-api/init_config.rst:1259 +msgid "Default: ``-1``." +msgstr "預設值:``1``。" + +#: ../../c-api/init_config.rst:906 msgid "If greater than ``0``, enable isolated mode:" msgstr "" -#: ../../c-api/init_config.rst:867 +#: ../../c-api/init_config.rst:908 msgid "" "Set :c:member:`~PyConfig.safe_path` to ``1``: don't prepend a potentially " "unsafe path to :data:`sys.path` at Python startup, such as the current " "directory, the script's directory or an empty string." msgstr "" -#: ../../c-api/init_config.rst:871 +#: ../../c-api/init_config.rst:912 msgid "" "Set :c:member:`~PyConfig.use_environment` to ``0``: ignore ``PYTHON`` " "environment variables." @@ -1226,77 +1285,77 @@ msgstr "" "將 :c:member:`~PyConfig.use_environment` 設定為 ``0``:忽略 ``PYTHON`` 環境變" "數。" -#: ../../c-api/init_config.rst:873 +#: ../../c-api/init_config.rst:914 msgid "" "Set :c:member:`~PyConfig.user_site_directory` to ``0``: don't add the user " "site directory to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:875 +#: ../../c-api/init_config.rst:916 msgid "" "Python REPL doesn't import :mod:`readline` nor enable default readline " "configuration on interactive prompts." msgstr "" -#: ../../c-api/init_config.rst:878 +#: ../../c-api/init_config.rst:919 msgid "Set to ``1`` by the :option:`-I` command line option." msgstr "" -#: ../../c-api/init_config.rst:882 +#: ../../c-api/init_config.rst:923 msgid "" "See also the :ref:`Isolated Configuration ` and :c:" "member:`PyPreConfig.isolated`." msgstr "" -#: ../../c-api/init_config.rst:887 +#: ../../c-api/init_config.rst:928 msgid "" "If non-zero, use :class:`io.FileIO` instead of :class:`!io." "_WindowsConsoleIO` for :data:`sys.stdin`, :data:`sys.stdout` and :data:`sys." "stderr`." msgstr "" -#: ../../c-api/init_config.rst:891 +#: ../../c-api/init_config.rst:932 msgid "" "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSSTDIO` environment variable " "is set to a non-empty string." msgstr "" -#: ../../c-api/init_config.rst:899 +#: ../../c-api/init_config.rst:940 msgid "See also the :pep:`528` (Change Windows console encoding to UTF-8)." msgstr "" -#: ../../c-api/init_config.rst:903 +#: ../../c-api/init_config.rst:944 msgid "" "If non-zero, dump statistics on :ref:`Python pymalloc memory allocator " "` at exit." msgstr "" -#: ../../c-api/init_config.rst:906 +#: ../../c-api/init_config.rst:947 msgid "Set to ``1`` by the :envvar:`PYTHONMALLOCSTATS` environment variable." msgstr "" -#: ../../c-api/init_config.rst:908 +#: ../../c-api/init_config.rst:949 msgid "" "The option is ignored if Python is :option:`configured using the --without-" "pymalloc option <--without-pymalloc>`." msgstr "" -#: ../../c-api/init_config.rst:915 +#: ../../c-api/init_config.rst:956 msgid "Platform library directory name: :data:`sys.platlibdir`." msgstr "" -#: ../../c-api/init_config.rst:917 +#: ../../c-api/init_config.rst:958 msgid "Set by the :envvar:`PYTHONPLATLIBDIR` environment variable." msgstr "" -#: ../../c-api/init_config.rst:919 +#: ../../c-api/init_config.rst:960 msgid "" "Default: value of the ``PLATLIBDIR`` macro which is set by the :option:" "`configure --with-platlibdir option <--with-platlibdir>` (default: " "``\"lib\"``, or ``\"DLLs\"`` on Windows)." msgstr "" -#: ../../c-api/init_config.rst:927 +#: ../../c-api/init_config.rst:968 msgid "" "This macro is now used on Windows to locate the standard library extension " "modules, typically under ``DLLs``. However, for compatibility, note that " @@ -1304,21 +1363,21 @@ msgid "" "and virtual environments." msgstr "" -#: ../../c-api/init_config.rst:936 +#: ../../c-api/init_config.rst:977 msgid "" "Module search paths (:data:`sys.path`) as a string separated by ``DELIM`` (:" "data:`os.pathsep`)." msgstr "" -#: ../../c-api/init_config.rst:939 +#: ../../c-api/init_config.rst:980 msgid "Set by the :envvar:`PYTHONPATH` environment variable." msgstr "" -#: ../../c-api/init_config.rst:948 +#: ../../c-api/init_config.rst:989 msgid "Module search paths: :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:950 +#: ../../c-api/init_config.rst:991 msgid "" "If :c:member:`~PyConfig.module_search_paths_set` is equal to ``0``, :c:func:" "`Py_InitializeFromConfig` will replace :c:member:`~PyConfig." @@ -1326,41 +1385,41 @@ msgid "" "to ``1``." msgstr "" -#: ../../c-api/init_config.rst:955 +#: ../../c-api/init_config.rst:996 msgid "" "Default: empty list (``module_search_paths``) and ``0`` " "(``module_search_paths_set``)." msgstr "" -#: ../../c-api/init_config.rst:962 +#: ../../c-api/init_config.rst:1003 msgid "Compilation optimization level:" msgstr "" -#: ../../c-api/init_config.rst:964 +#: ../../c-api/init_config.rst:1005 msgid "``0``: Peephole optimizer, set ``__debug__`` to ``True``." msgstr "" -#: ../../c-api/init_config.rst:965 +#: ../../c-api/init_config.rst:1006 msgid "``1``: Level 0, remove assertions, set ``__debug__`` to ``False``." msgstr "" -#: ../../c-api/init_config.rst:966 +#: ../../c-api/init_config.rst:1007 msgid "``2``: Level 1, strip docstrings." msgstr "" -#: ../../c-api/init_config.rst:968 +#: ../../c-api/init_config.rst:1009 msgid "" "Incremented by the :option:`-O` command line option. Set to the :envvar:" "`PYTHONOPTIMIZE` environment variable value." msgstr "" -#: ../../c-api/init_config.rst:975 +#: ../../c-api/init_config.rst:1016 msgid "" "The list of the original command line arguments passed to the Python " "executable: :data:`sys.orig_argv`." msgstr "" -#: ../../c-api/init_config.rst:978 +#: ../../c-api/init_config.rst:1019 msgid "" "If :c:member:`~PyConfig.orig_argv` list is empty and :c:member:`~PyConfig." "argv` is not a list only containing an empty string, :c:func:`PyConfig_Read` " @@ -1369,388 +1428,400 @@ msgid "" "parse_argv` is non-zero)." msgstr "" -#: ../../c-api/init_config.rst:985 +#: ../../c-api/init_config.rst:1026 msgid "" "See also the :c:member:`~PyConfig.argv` member and the :c:func:" "`Py_GetArgcArgv` function." msgstr "" -#: ../../c-api/init_config.rst:988 ../../c-api/init_config.rst:1258 -#: ../../c-api/init_config.rst:1277 +#: ../../c-api/init_config.rst:1029 ../../c-api/init_config.rst:1317 +#: ../../c-api/init_config.rst:1336 msgid "Default: empty list." msgstr "" -#: ../../c-api/init_config.rst:994 +#: ../../c-api/init_config.rst:1035 msgid "Parse command line arguments?" msgstr "" -#: ../../c-api/init_config.rst:996 +#: ../../c-api/init_config.rst:1037 msgid "" "If equals to ``1``, parse :c:member:`~PyConfig.argv` the same way the " "regular Python parses :ref:`command line arguments `, and " "strip Python arguments from :c:member:`~PyConfig.argv`." msgstr "" -#: ../../c-api/init_config.rst:1008 +#: ../../c-api/init_config.rst:1049 msgid "" "The :c:member:`PyConfig.argv` arguments are now only parsed if :c:member:" "`PyConfig.parse_argv` equals to ``1``." msgstr "" -#: ../../c-api/init_config.rst:1014 +#: ../../c-api/init_config.rst:1055 msgid "" "Parser debug mode. If greater than ``0``, turn on parser debugging output " "(for expert only, depending on compilation options)." msgstr "" -#: ../../c-api/init_config.rst:1017 +#: ../../c-api/init_config.rst:1058 msgid "" "Incremented by the :option:`-d` command line option. Set to the :envvar:" "`PYTHONDEBUG` environment variable value." msgstr "" -#: ../../c-api/init_config.rst:1020 +#: ../../c-api/init_config.rst:1061 ../../c-api/init_config.rst:1166 msgid "" -"Need a :ref:`debug build of Python ` (the ``Py_DEBUG`` macro " +"Needs a :ref:`debug build of Python ` (the ``Py_DEBUG`` macro " "must be defined)." msgstr "" -#: ../../c-api/init_config.rst:1027 +#: ../../c-api/init_config.rst:1068 msgid "" "If non-zero, calculation of path configuration is allowed to log warnings " "into ``stderr``. If equals to ``0``, suppress these warnings." msgstr "" -#: ../../c-api/init_config.rst:1034 +#: ../../c-api/init_config.rst:1075 msgid "Now also applies on Windows." msgstr "" -#: ../../c-api/init_config.rst:1039 +#: ../../c-api/init_config.rst:1080 msgid "" "The site-specific directory prefix where the platform independent Python " "files are installed: :data:`sys.prefix`." msgstr "" -#: ../../c-api/init_config.rst:1048 +#: ../../c-api/init_config.rst:1087 +msgid "See also :c:member:`PyConfig.base_prefix`." +msgstr "也請見 :c:member:`PyConfig.base_prefix`" + +#: ../../c-api/init_config.rst:1091 msgid "" "Program name used to initialize :c:member:`~PyConfig.executable` and in " "early error messages during Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1051 -msgid "If :func:`Py_SetProgramName` has been called, use its argument." -msgstr "" - -#: ../../c-api/init_config.rst:1052 +#: ../../c-api/init_config.rst:1094 msgid "On macOS, use :envvar:`PYTHONEXECUTABLE` environment variable if set." msgstr "" -#: ../../c-api/init_config.rst:1053 +#: ../../c-api/init_config.rst:1095 msgid "" "If the ``WITH_NEXT_FRAMEWORK`` macro is defined, use :envvar:" "`__PYVENV_LAUNCHER__` environment variable if set." msgstr "" -#: ../../c-api/init_config.rst:1055 +#: ../../c-api/init_config.rst:1097 msgid "" "Use ``argv[0]`` of :c:member:`~PyConfig.argv` if available and non-empty." msgstr "" -#: ../../c-api/init_config.rst:1057 +#: ../../c-api/init_config.rst:1099 msgid "" "Otherwise, use ``L\"python\"`` on Windows, or ``L\"python3\"`` on other " "platforms." msgstr "" -#: ../../c-api/init_config.rst:1066 +#: ../../c-api/init_config.rst:1108 msgid "" "Directory where cached ``.pyc`` files are written: :data:`sys." "pycache_prefix`." msgstr "" -#: ../../c-api/init_config.rst:1069 +#: ../../c-api/init_config.rst:1111 msgid "" "Set by the :option:`-X pycache_prefix=PATH <-X>` command line option and " -"the :envvar:`PYTHONPYCACHEPREFIX` environment variable." +"the :envvar:`PYTHONPYCACHEPREFIX` environment variable. The command-line " +"option takes precedence." msgstr "" -#: ../../c-api/init_config.rst:1072 +#: ../../c-api/init_config.rst:1115 msgid "If ``NULL``, :data:`sys.pycache_prefix` is set to ``None``." msgstr "" -#: ../../c-api/init_config.rst:1078 +#: ../../c-api/init_config.rst:1121 msgid "" "Quiet mode. If greater than ``0``, don't display the copyright and version " "at Python startup in interactive mode." msgstr "" -#: ../../c-api/init_config.rst:1081 +#: ../../c-api/init_config.rst:1124 msgid "Incremented by the :option:`-q` command line option." msgstr "" -#: ../../c-api/init_config.rst:1087 +#: ../../c-api/init_config.rst:1130 msgid "Value of the :option:`-c` command line option." msgstr "" -#: ../../c-api/init_config.rst:1089 ../../c-api/init_config.rst:1110 +#: ../../c-api/init_config.rst:1132 ../../c-api/init_config.rst:1153 msgid "Used by :c:func:`Py_RunMain`." msgstr "" -#: ../../c-api/init_config.rst:1095 +#: ../../c-api/init_config.rst:1138 msgid "" "Filename passed on the command line: trailing command line argument without :" "option:`-c` or :option:`-m`. It is used by the :c:func:`Py_RunMain` function." msgstr "" -#: ../../c-api/init_config.rst:1099 +#: ../../c-api/init_config.rst:1142 msgid "" "For example, it is set to ``script.py`` by the ``python3 script.py arg`` " "command line." msgstr "" -#: ../../c-api/init_config.rst:1102 +#: ../../c-api/init_config.rst:1145 msgid "See also the :c:member:`PyConfig.skip_source_first_line` option." msgstr "也請見 :c:member:`PyConfig.skip_source_first_line` 選項。" -#: ../../c-api/init_config.rst:1108 +#: ../../c-api/init_config.rst:1151 msgid "Value of the :option:`-m` command line option." msgstr "" -#: ../../c-api/init_config.rst:1116 -msgid "Show total reference count at exit (excluding immortal objects)?" +#: ../../c-api/init_config.rst:1159 +msgid "" +"``package.module`` path to module that should be imported before ``site.py`` " +"is run." msgstr "" -#: ../../c-api/init_config.rst:1118 +#: ../../c-api/init_config.rst:1162 +msgid "" +"Set by the :option:`-X presite=package.module <-X>` command-line option and " +"the :envvar:`PYTHON_PRESITE` environment variable. The command-line option " +"takes precedence." +msgstr "" + +#: ../../c-api/init_config.rst:1173 +msgid "" +"Show total reference count at exit (excluding :term:`immortal` objects)?" +msgstr "" + +#: ../../c-api/init_config.rst:1175 msgid "Set to ``1`` by :option:`-X showrefcount <-X>` command line option." msgstr "" -#: ../../c-api/init_config.rst:1120 +#: ../../c-api/init_config.rst:1177 msgid "" -"Need a :ref:`debug build of Python ` (the ``Py_REF_DEBUG`` " +"Needs a :ref:`debug build of Python ` (the ``Py_REF_DEBUG`` " "macro must be defined)." msgstr "" -#: ../../c-api/init_config.rst:1127 +#: ../../c-api/init_config.rst:1184 msgid "Import the :mod:`site` module at startup?" msgstr "" -#: ../../c-api/init_config.rst:1129 +#: ../../c-api/init_config.rst:1186 msgid "" "If equal to zero, disable the import of the module site and the site-" "dependent manipulations of :data:`sys.path` that it entails." msgstr "" -#: ../../c-api/init_config.rst:1132 +#: ../../c-api/init_config.rst:1189 msgid "" "Also disable these manipulations if the :mod:`site` module is explicitly " "imported later (call :func:`site.main` if you want them to be triggered)." msgstr "" -#: ../../c-api/init_config.rst:1135 +#: ../../c-api/init_config.rst:1192 msgid "Set to ``0`` by the :option:`-S` command line option." msgstr "" -#: ../../c-api/init_config.rst:1137 +#: ../../c-api/init_config.rst:1194 msgid "" ":data:`sys.flags.no_site ` is set to the inverted value of :c:" "member:`~PyConfig.site_import`." msgstr "" -#: ../../c-api/init_config.rst:1144 +#: ../../c-api/init_config.rst:1201 msgid "" "If non-zero, skip the first line of the :c:member:`PyConfig.run_filename` " "source." msgstr "" -#: ../../c-api/init_config.rst:1147 +#: ../../c-api/init_config.rst:1204 msgid "" "It allows the usage of non-Unix forms of ``#!cmd``. This is intended for a " "DOS specific hack only." msgstr "" -#: ../../c-api/init_config.rst:1150 +#: ../../c-api/init_config.rst:1207 msgid "Set to ``1`` by the :option:`-x` command line option." msgstr "" -#: ../../c-api/init_config.rst:1157 +#: ../../c-api/init_config.rst:1214 msgid "" "Encoding and encoding errors of :data:`sys.stdin`, :data:`sys.stdout` and :" "data:`sys.stderr` (but :data:`sys.stderr` always uses " "``\"backslashreplace\"`` error handler)." msgstr "" -#: ../../c-api/init_config.rst:1161 -msgid "" -"If :c:func:`Py_SetStandardStreamEncoding` has been called, use its *error* " -"and *errors* arguments if they are not ``NULL``." -msgstr "" - -#: ../../c-api/init_config.rst:1164 +#: ../../c-api/init_config.rst:1218 msgid "" "Use the :envvar:`PYTHONIOENCODING` environment variable if it is non-empty." msgstr "" -#: ../../c-api/init_config.rst:1167 +#: ../../c-api/init_config.rst:1221 msgid "Default encoding:" msgstr "" -#: ../../c-api/init_config.rst:1169 +#: ../../c-api/init_config.rst:1223 msgid "``\"UTF-8\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero." msgstr "" -#: ../../c-api/init_config.rst:1170 +#: ../../c-api/init_config.rst:1224 msgid "Otherwise, use the :term:`locale encoding`." msgstr "" -#: ../../c-api/init_config.rst:1172 +#: ../../c-api/init_config.rst:1226 msgid "Default error handler:" msgstr "" -#: ../../c-api/init_config.rst:1174 +#: ../../c-api/init_config.rst:1228 msgid "On Windows: use ``\"surrogateescape\"``." msgstr "" -#: ../../c-api/init_config.rst:1175 +#: ../../c-api/init_config.rst:1229 msgid "" "``\"surrogateescape\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero, or " "if the LC_CTYPE locale is \"C\" or \"POSIX\"." msgstr "" -#: ../../c-api/init_config.rst:1177 +#: ../../c-api/init_config.rst:1231 msgid "``\"strict\"`` otherwise." msgstr "" -#: ../../c-api/init_config.rst:1181 +#: ../../c-api/init_config.rst:1233 +msgid "See also :c:member:`PyConfig.legacy_windows_stdio`." +msgstr "也請見 :c:member:`PyConfig.legacy_windows_stdio`。" + +#: ../../c-api/init_config.rst:1237 msgid "Enable tracemalloc?" msgstr "" -#: ../../c-api/init_config.rst:1183 +#: ../../c-api/init_config.rst:1239 msgid "If non-zero, call :func:`tracemalloc.start` at startup." msgstr "" -#: ../../c-api/init_config.rst:1185 +#: ../../c-api/init_config.rst:1241 msgid "" "Set by :option:`-X tracemalloc=N <-X>` command line option and by the :" "envvar:`PYTHONTRACEMALLOC` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1192 +#: ../../c-api/init_config.rst:1248 msgid "Enable compatibility mode with the perf profiler?" msgstr "" -#: ../../c-api/init_config.rst:1194 +#: ../../c-api/init_config.rst:1250 msgid "" "If non-zero, initialize the perf trampoline. See :ref:`perf_profiling` for " "more information." msgstr "" -#: ../../c-api/init_config.rst:1197 +#: ../../c-api/init_config.rst:1253 msgid "" -"Set by :option:`-X perf <-X>` command line option and by the :envvar:" -"`PYTHONPERFSUPPORT` environment variable." +"Set by :option:`-X perf <-X>` command-line option and by the :envvar:" +"`PYTHON_PERF_JIT_SUPPORT` environment variable for perf support with stack " +"pointers and :option:`-X perf_jit <-X>` command-line option and by the :" +"envvar:`PYTHON_PERF_JIT_SUPPORT` environment variable for perf support with " +"DWARF JIT information." msgstr "" -#: ../../c-api/init_config.rst:1200 -msgid "Default: ``-1``." -msgstr "預設值:``1``。" - -#: ../../c-api/init_config.rst:1206 +#: ../../c-api/init_config.rst:1265 msgid "Use :ref:`environment variables `?" msgstr "" -#: ../../c-api/init_config.rst:1208 +#: ../../c-api/init_config.rst:1267 msgid "" "If equals to zero, ignore the :ref:`environment variables `." msgstr "" -#: ../../c-api/init_config.rst:1211 +#: ../../c-api/init_config.rst:1270 msgid "Set to ``0`` by the :option:`-E` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1217 +#: ../../c-api/init_config.rst:1276 msgid "If non-zero, add the user site directory to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1219 +#: ../../c-api/init_config.rst:1278 msgid "Set to ``0`` by the :option:`-s` and :option:`-I` command line options." msgstr "" -#: ../../c-api/init_config.rst:1221 +#: ../../c-api/init_config.rst:1280 msgid "Set to ``0`` by the :envvar:`PYTHONNOUSERSITE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1227 +#: ../../c-api/init_config.rst:1286 msgid "" "Verbose mode. If greater than ``0``, print a message each time a module is " "imported, showing the place (filename or built-in module) from which it is " "loaded." msgstr "" -#: ../../c-api/init_config.rst:1231 +#: ../../c-api/init_config.rst:1290 msgid "" "If greater than or equal to ``2``, print a message for each file that is " "checked for when searching for a module. Also provides information on module " "cleanup at exit." msgstr "" -#: ../../c-api/init_config.rst:1235 +#: ../../c-api/init_config.rst:1294 msgid "Incremented by the :option:`-v` command line option." msgstr "" -#: ../../c-api/init_config.rst:1237 +#: ../../c-api/init_config.rst:1296 msgid "Set by the :envvar:`PYTHONVERBOSE` environment variable value." msgstr "" -#: ../../c-api/init_config.rst:1243 +#: ../../c-api/init_config.rst:1302 msgid "" "Options of the :mod:`warnings` module to build warnings filters, lowest to " "highest priority: :data:`sys.warnoptions`." msgstr "" -#: ../../c-api/init_config.rst:1246 +#: ../../c-api/init_config.rst:1305 msgid "" "The :mod:`warnings` module adds :data:`sys.warnoptions` in the reverse " "order: the last :c:member:`PyConfig.warnoptions` item becomes the first item " "of :data:`warnings.filters` which is checked first (highest priority)." msgstr "" -#: ../../c-api/init_config.rst:1251 +#: ../../c-api/init_config.rst:1310 msgid "" "The :option:`-W` command line options adds its value to :c:member:`~PyConfig." "warnoptions`, it can be used multiple times." msgstr "" -#: ../../c-api/init_config.rst:1254 +#: ../../c-api/init_config.rst:1313 msgid "" "The :envvar:`PYTHONWARNINGS` environment variable can also be used to add " "warning options. Multiple options can be specified, separated by commas (``," "``)." msgstr "" -#: ../../c-api/init_config.rst:1262 +#: ../../c-api/init_config.rst:1321 msgid "" "If equal to ``0``, Python won't try to write ``.pyc`` files on the import of " "source modules." msgstr "" -#: ../../c-api/init_config.rst:1265 +#: ../../c-api/init_config.rst:1324 msgid "" "Set to ``0`` by the :option:`-B` command line option and the :envvar:" "`PYTHONDONTWRITEBYTECODE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1268 +#: ../../c-api/init_config.rst:1327 msgid "" ":data:`sys.dont_write_bytecode` is initialized to the inverted value of :c:" "member:`~PyConfig.write_bytecode`." msgstr "" -#: ../../c-api/init_config.rst:1275 +#: ../../c-api/init_config.rst:1334 msgid "Values of the :option:`-X` command line options: :data:`sys._xoptions`." msgstr "" -#: ../../c-api/init_config.rst:1279 +#: ../../c-api/init_config.rst:1338 msgid "" "If :c:member:`~PyConfig.parse_argv` is non-zero, :c:member:`~PyConfig.argv` " "arguments are parsed the same way the regular Python parses :ref:`command " @@ -1758,29 +1829,29 @@ msgid "" "c:member:`~PyConfig.argv`." msgstr "" -#: ../../c-api/init_config.rst:1284 +#: ../../c-api/init_config.rst:1343 msgid "" "The :c:member:`~PyConfig.xoptions` options are parsed to set other options: " "see the :option:`-X` command line option." msgstr "" -#: ../../c-api/init_config.rst:1289 +#: ../../c-api/init_config.rst:1348 msgid "The ``show_alloc_count`` field has been removed." msgstr "" -#: ../../c-api/init_config.rst:1293 +#: ../../c-api/init_config.rst:1352 msgid "Initialization with PyConfig" msgstr "" -#: ../../c-api/init_config.rst:1295 +#: ../../c-api/init_config.rst:1354 msgid "Function to initialize Python:" msgstr "" -#: ../../c-api/init_config.rst:1299 +#: ../../c-api/init_config.rst:1358 msgid "Initialize Python from *config* configuration." msgstr "" -#: ../../c-api/init_config.rst:1304 +#: ../../c-api/init_config.rst:1363 msgid "" "If :c:func:`PyImport_FrozenModules`, :c:func:`PyImport_AppendInittab` or :c:" "func:`PyImport_ExtendInittab` are used, they must be set or called after " @@ -1789,17 +1860,17 @@ msgid "" "`PyImport_ExtendInittab` must be called before each Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1311 +#: ../../c-api/init_config.rst:1370 msgid "" "The current configuration (``PyConfig`` type) is stored in " "``PyInterpreterState.config``." msgstr "" -#: ../../c-api/init_config.rst:1314 +#: ../../c-api/init_config.rst:1373 msgid "Example setting the program name::" msgstr "" -#: ../../c-api/init_config.rst:1316 +#: ../../c-api/init_config.rst:1375 msgid "" "void init_python(void)\n" "{\n" @@ -1853,7 +1924,7 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init_config.rst:1342 +#: ../../c-api/init_config.rst:1401 msgid "" "More complete example modifying the default configuration, read the " "configuration, and then override some parameters. Note that since 3.11, many " @@ -1862,7 +1933,7 @@ msgid "" "called will be left unchanged by initialization::" msgstr "" -#: ../../c-api/init_config.rst:1349 +#: ../../c-api/init_config.rst:1408 msgid "" "PyStatus init_python(const char *program_name)\n" "{\n" @@ -1917,18 +1988,18 @@ msgid "" "}" msgstr "" -#: ../../c-api/init_config.rst:1405 +#: ../../c-api/init_config.rst:1464 msgid "Isolated Configuration" msgstr "" -#: ../../c-api/init_config.rst:1407 +#: ../../c-api/init_config.rst:1466 msgid "" ":c:func:`PyPreConfig_InitIsolatedConfig` and :c:func:" "`PyConfig_InitIsolatedConfig` functions create a configuration to isolate " "Python from the system. For example, to embed Python into an application." msgstr "" -#: ../../c-api/init_config.rst:1412 +#: ../../c-api/init_config.rst:1471 msgid "" "This configuration ignores global configuration variables, environment " "variables, command line arguments (:c:member:`PyConfig.argv` is not parsed) " @@ -1936,115 +2007,115 @@ msgid "" "LC_CTYPE locale are left unchanged. Signal handlers are not installed." msgstr "" -#: ../../c-api/init_config.rst:1417 +#: ../../c-api/init_config.rst:1476 msgid "" "Configuration files are still used with this configuration to determine " "paths that are unspecified. Ensure :c:member:`PyConfig.home` is specified to " "avoid computing the default path configuration." msgstr "" -#: ../../c-api/init_config.rst:1425 +#: ../../c-api/init_config.rst:1484 msgid "Python Configuration" msgstr "" -#: ../../c-api/init_config.rst:1427 +#: ../../c-api/init_config.rst:1486 msgid "" ":c:func:`PyPreConfig_InitPythonConfig` and :c:func:" "`PyConfig_InitPythonConfig` functions create a configuration to build a " "customized Python which behaves as the regular Python." msgstr "" -#: ../../c-api/init_config.rst:1431 +#: ../../c-api/init_config.rst:1490 msgid "" "Environments variables and command line arguments are used to configure " "Python, whereas global configuration variables are ignored." msgstr "" -#: ../../c-api/init_config.rst:1434 +#: ../../c-api/init_config.rst:1493 msgid "" "This function enables C locale coercion (:pep:`538`) and :ref:`Python UTF-8 " "Mode ` (:pep:`540`) depending on the LC_CTYPE locale, :envvar:" "`PYTHONUTF8` and :envvar:`PYTHONCOERCECLOCALE` environment variables." msgstr "" -#: ../../c-api/init_config.rst:1443 +#: ../../c-api/init_config.rst:1502 msgid "Python Path Configuration" msgstr "" -#: ../../c-api/init_config.rst:1445 +#: ../../c-api/init_config.rst:1504 msgid ":c:type:`PyConfig` contains multiple fields for the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1447 +#: ../../c-api/init_config.rst:1506 msgid "Path configuration inputs:" msgstr "" -#: ../../c-api/init_config.rst:1449 +#: ../../c-api/init_config.rst:1508 msgid ":c:member:`PyConfig.home`" msgstr ":c:member:`PyConfig.home`" -#: ../../c-api/init_config.rst:1450 +#: ../../c-api/init_config.rst:1509 msgid ":c:member:`PyConfig.platlibdir`" msgstr ":c:member:`PyConfig.platlibdir`" -#: ../../c-api/init_config.rst:1451 +#: ../../c-api/init_config.rst:1510 msgid ":c:member:`PyConfig.pathconfig_warnings`" msgstr ":c:member:`PyConfig.pathconfig_warnings`" -#: ../../c-api/init_config.rst:1452 +#: ../../c-api/init_config.rst:1511 msgid ":c:member:`PyConfig.program_name`" msgstr ":c:member:`PyConfig.program_name`" -#: ../../c-api/init_config.rst:1453 +#: ../../c-api/init_config.rst:1512 msgid ":c:member:`PyConfig.pythonpath_env`" msgstr ":c:member:`PyConfig.pythonpath_env`" -#: ../../c-api/init_config.rst:1454 +#: ../../c-api/init_config.rst:1513 msgid "current working directory: to get absolute paths" msgstr "" -#: ../../c-api/init_config.rst:1455 +#: ../../c-api/init_config.rst:1514 msgid "" "``PATH`` environment variable to get the program full path (from :c:member:" "`PyConfig.program_name`)" msgstr "" -#: ../../c-api/init_config.rst:1457 +#: ../../c-api/init_config.rst:1516 msgid "``__PYVENV_LAUNCHER__`` environment variable" msgstr "``__PYVENV_LAUNCHER__`` 環境變數" -#: ../../c-api/init_config.rst:1458 +#: ../../c-api/init_config.rst:1517 msgid "" "(Windows only) Application paths in the registry under " "\"Software\\Python\\PythonCore\\X.Y\\PythonPath\" of HKEY_CURRENT_USER and " "HKEY_LOCAL_MACHINE (where X.Y is the Python version)." msgstr "" -#: ../../c-api/init_config.rst:1462 +#: ../../c-api/init_config.rst:1521 msgid "Path configuration output fields:" msgstr "" -#: ../../c-api/init_config.rst:1464 +#: ../../c-api/init_config.rst:1523 msgid ":c:member:`PyConfig.base_exec_prefix`" msgstr ":c:member:`PyConfig.base_exec_prefix`" -#: ../../c-api/init_config.rst:1465 +#: ../../c-api/init_config.rst:1524 msgid ":c:member:`PyConfig.base_executable`" msgstr ":c:member:`PyConfig.base_executable`" -#: ../../c-api/init_config.rst:1466 +#: ../../c-api/init_config.rst:1525 msgid ":c:member:`PyConfig.base_prefix`" msgstr ":c:member:`PyConfig.base_prefix`" -#: ../../c-api/init_config.rst:1467 +#: ../../c-api/init_config.rst:1526 msgid ":c:member:`PyConfig.exec_prefix`" msgstr ":c:member:`PyConfig.exec_prefix`" -#: ../../c-api/init_config.rst:1468 +#: ../../c-api/init_config.rst:1527 msgid ":c:member:`PyConfig.executable`" msgstr ":c:member:`PyConfig.executable`" -#: ../../c-api/init_config.rst:1469 +#: ../../c-api/init_config.rst:1528 msgid "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" @@ -2052,11 +2123,11 @@ msgstr "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" -#: ../../c-api/init_config.rst:1471 +#: ../../c-api/init_config.rst:1530 msgid ":c:member:`PyConfig.prefix`" msgstr ":c:member:`PyConfig.prefix`" -#: ../../c-api/init_config.rst:1473 +#: ../../c-api/init_config.rst:1532 msgid "" "If at least one \"output field\" is not set, Python calculates the path " "configuration to fill unset fields. If :c:member:`~PyConfig." @@ -2065,7 +2136,7 @@ msgid "" "module_search_paths_set` is set to ``1``." msgstr "" -#: ../../c-api/init_config.rst:1479 +#: ../../c-api/init_config.rst:1538 msgid "" "It is possible to completely ignore the function calculating the default " "path configuration by setting explicitly all path configuration output " @@ -2075,52 +2146,52 @@ msgid "" "modification." msgstr "" -#: ../../c-api/init_config.rst:1486 +#: ../../c-api/init_config.rst:1545 msgid "" "Set :c:member:`~PyConfig.pathconfig_warnings` to ``0`` to suppress warnings " "when calculating the path configuration (Unix only, Windows does not log any " "warning)." msgstr "" -#: ../../c-api/init_config.rst:1489 +#: ../../c-api/init_config.rst:1548 msgid "" "If :c:member:`~PyConfig.base_prefix` or :c:member:`~PyConfig." "base_exec_prefix` fields are not set, they inherit their value from :c:" "member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` respectively." msgstr "" -#: ../../c-api/init_config.rst:1493 +#: ../../c-api/init_config.rst:1552 msgid ":c:func:`Py_RunMain` and :c:func:`Py_Main` modify :data:`sys.path`:" msgstr "" -#: ../../c-api/init_config.rst:1495 +#: ../../c-api/init_config.rst:1554 msgid "" "If :c:member:`~PyConfig.run_filename` is set and is a directory which " "contains a ``__main__.py`` script, prepend :c:member:`~PyConfig." "run_filename` to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1498 +#: ../../c-api/init_config.rst:1557 msgid "If :c:member:`~PyConfig.isolated` is zero:" msgstr "" -#: ../../c-api/init_config.rst:1500 +#: ../../c-api/init_config.rst:1559 msgid "" "If :c:member:`~PyConfig.run_module` is set, prepend the current directory " "to :data:`sys.path`. Do nothing if the current directory cannot be read." msgstr "" -#: ../../c-api/init_config.rst:1502 +#: ../../c-api/init_config.rst:1561 msgid "" "If :c:member:`~PyConfig.run_filename` is set, prepend the directory of the " "filename to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1504 +#: ../../c-api/init_config.rst:1563 msgid "Otherwise, prepend an empty string to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1506 +#: ../../c-api/init_config.rst:1565 msgid "" "If :c:member:`~PyConfig.site_import` is non-zero, :data:`sys.path` can be " "modified by the :mod:`site` module. If :c:member:`~PyConfig." @@ -2129,170 +2200,170 @@ msgid "" "data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1512 +#: ../../c-api/init_config.rst:1571 msgid "The following configuration files are used by the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1514 +#: ../../c-api/init_config.rst:1573 msgid "``pyvenv.cfg``" msgstr "``pyvenv.cfg``" -#: ../../c-api/init_config.rst:1515 +#: ../../c-api/init_config.rst:1574 msgid "``._pth`` file (ex: ``python._pth``)" msgstr "" -#: ../../c-api/init_config.rst:1516 +#: ../../c-api/init_config.rst:1575 msgid "``pybuilddir.txt`` (Unix only)" msgstr "" -#: ../../c-api/init_config.rst:1518 +#: ../../c-api/init_config.rst:1577 msgid "If a ``._pth`` file is present:" msgstr "" -#: ../../c-api/init_config.rst:1520 +#: ../../c-api/init_config.rst:1579 msgid "Set :c:member:`~PyConfig.isolated` to ``1``." msgstr "將 :c:member:`~PyConfig.isolated` 設定為 ``1``。" -#: ../../c-api/init_config.rst:1521 +#: ../../c-api/init_config.rst:1580 msgid "Set :c:member:`~PyConfig.use_environment` to ``0``." msgstr "將 :c:member:`~PyConfig.use_environment` 設定為 ``0``。" -#: ../../c-api/init_config.rst:1522 +#: ../../c-api/init_config.rst:1581 msgid "Set :c:member:`~PyConfig.site_import` to ``0``." msgstr "將 :c:member:`~PyConfig.site_import` 設定為 ``0``。" -#: ../../c-api/init_config.rst:1523 +#: ../../c-api/init_config.rst:1582 msgid "Set :c:member:`~PyConfig.safe_path` to ``1``." msgstr "將 :c:member:`~PyConfig.safe_path` 設定為 ``1``。" -#: ../../c-api/init_config.rst:1525 +#: ../../c-api/init_config.rst:1584 msgid "" "The ``__PYVENV_LAUNCHER__`` environment variable is used to set :c:member:" -"`PyConfig.base_executable`" +"`PyConfig.base_executable`." msgstr "" -#: ../../c-api/init_config.rst:1530 +#: ../../c-api/init_config.rst:1589 msgid "Py_RunMain()" msgstr "Py_RunMain()" -#: ../../c-api/init_config.rst:1534 +#: ../../c-api/init_config.rst:1593 msgid "" "Execute the command (:c:member:`PyConfig.run_command`), the script (:c:" "member:`PyConfig.run_filename`) or the module (:c:member:`PyConfig." "run_module`) specified on the command line or in the configuration." msgstr "" -#: ../../c-api/init_config.rst:1539 +#: ../../c-api/init_config.rst:1598 msgid "By default and when if :option:`-i` option is used, run the REPL." msgstr "" -#: ../../c-api/init_config.rst:1541 +#: ../../c-api/init_config.rst:1600 msgid "" "Finally, finalizes Python and returns an exit status that can be passed to " "the ``exit()`` function." msgstr "" -#: ../../c-api/init_config.rst:1544 +#: ../../c-api/init_config.rst:1603 msgid "" "See :ref:`Python Configuration ` for an example of " "customized Python always running in isolated mode using :c:func:`Py_RunMain`." msgstr "" -#: ../../c-api/init_config.rst:1550 +#: ../../c-api/init_config.rst:1609 msgid "Py_GetArgcArgv()" msgstr "Py_GetArgcArgv()" -#: ../../c-api/init_config.rst:1554 +#: ../../c-api/init_config.rst:1613 msgid "Get the original command line arguments, before Python modified them." msgstr "" -#: ../../c-api/init_config.rst:1556 +#: ../../c-api/init_config.rst:1615 msgid "See also :c:member:`PyConfig.orig_argv` member." msgstr "" -#: ../../c-api/init_config.rst:1560 +#: ../../c-api/init_config.rst:1619 msgid "Multi-Phase Initialization Private Provisional API" msgstr "" -#: ../../c-api/init_config.rst:1562 +#: ../../c-api/init_config.rst:1621 msgid "" "This section is a private provisional API introducing multi-phase " "initialization, the core feature of :pep:`432`:" msgstr "" -#: ../../c-api/init_config.rst:1565 +#: ../../c-api/init_config.rst:1624 msgid "\"Core\" initialization phase, \"bare minimum Python\":" msgstr "" -#: ../../c-api/init_config.rst:1567 +#: ../../c-api/init_config.rst:1626 msgid "Builtin types;" msgstr "內建型別;" -#: ../../c-api/init_config.rst:1568 +#: ../../c-api/init_config.rst:1627 msgid "Builtin exceptions;" msgstr "內建例外;" -#: ../../c-api/init_config.rst:1569 +#: ../../c-api/init_config.rst:1628 msgid "Builtin and frozen modules;" msgstr "" -#: ../../c-api/init_config.rst:1570 +#: ../../c-api/init_config.rst:1629 msgid "" "The :mod:`sys` module is only partially initialized (ex: :data:`sys.path` " "doesn't exist yet)." msgstr "" -#: ../../c-api/init_config.rst:1573 +#: ../../c-api/init_config.rst:1632 msgid "\"Main\" initialization phase, Python is fully initialized:" msgstr "" -#: ../../c-api/init_config.rst:1575 +#: ../../c-api/init_config.rst:1634 msgid "Install and configure :mod:`importlib`;" msgstr "" -#: ../../c-api/init_config.rst:1576 +#: ../../c-api/init_config.rst:1635 msgid "Apply the :ref:`Path Configuration `;" msgstr "" -#: ../../c-api/init_config.rst:1577 +#: ../../c-api/init_config.rst:1636 msgid "Install signal handlers;" msgstr "" -#: ../../c-api/init_config.rst:1578 +#: ../../c-api/init_config.rst:1637 msgid "" "Finish :mod:`sys` module initialization (ex: create :data:`sys.stdout` and :" "data:`sys.path`);" msgstr "" -#: ../../c-api/init_config.rst:1580 +#: ../../c-api/init_config.rst:1639 msgid "" "Enable optional features like :mod:`faulthandler` and :mod:`tracemalloc`;" msgstr "" -#: ../../c-api/init_config.rst:1581 +#: ../../c-api/init_config.rst:1640 msgid "Import the :mod:`site` module;" msgstr "引入 :mod:`site` 模組;" -#: ../../c-api/init_config.rst:1582 +#: ../../c-api/init_config.rst:1641 msgid "etc." msgstr "" -#: ../../c-api/init_config.rst:1584 +#: ../../c-api/init_config.rst:1643 msgid "Private provisional API:" msgstr "" -#: ../../c-api/init_config.rst:1586 +#: ../../c-api/init_config.rst:1645 msgid "" ":c:member:`PyConfig._init_main`: if set to ``0``, :c:func:" "`Py_InitializeFromConfig` stops at the \"Core\" initialization phase." msgstr "" -#: ../../c-api/init_config.rst:1591 +#: ../../c-api/init_config.rst:1650 msgid "" "Move to the \"Main\" initialization phase, finish the Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1593 +#: ../../c-api/init_config.rst:1652 msgid "" "No module is imported during the \"Core\" phase and the ``importlib`` module " "is not configured: the :ref:`Path Configuration ` is only " @@ -2301,14 +2372,14 @@ msgid "" "maybe install a custom :data:`sys.meta_path` importer or an import hook, etc." msgstr "" -#: ../../c-api/init_config.rst:1599 +#: ../../c-api/init_config.rst:1658 msgid "" "It may become possible to calculate the :ref:`Path Configuration ` in Python, after the Core phase and before the Main phase, which is " "one of the :pep:`432` motivation." msgstr "" -#: ../../c-api/init_config.rst:1603 +#: ../../c-api/init_config.rst:1662 msgid "" "The \"Core\" phase is not properly defined: what should be and what should " "not be available at this phase is not specified yet. The API is marked as " @@ -2316,13 +2387,13 @@ msgid "" "until a proper public API is designed." msgstr "" -#: ../../c-api/init_config.rst:1608 +#: ../../c-api/init_config.rst:1667 msgid "" "Example running Python code between \"Core\" and \"Main\" initialization " "phases::" msgstr "" -#: ../../c-api/init_config.rst:1611 +#: ../../c-api/init_config.rst:1670 msgid "" "void init_python(void)\n" "{\n" @@ -2358,3 +2429,14 @@ msgid "" " }\n" "}" msgstr "" + +#: ../../c-api/init_config.rst:558 +msgid "main()" +msgstr "" + +#: ../../c-api/init_config.rst:558 +msgid "argv (in module sys)" +msgstr "" + +#~ msgid "Command line arguments: :data:`sys.argv`." +#~ msgstr "命令列引數::data:`sys.argv`。" diff --git a/c-api/intro.po b/c-api/intro.po index bbea4a82b0..9854c7f4d0 100644 --- a/c-api/intro.po +++ b/c-api/intro.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-04-25 18:01+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1211,13 +1211,14 @@ msgstr "" "`PYTHONHOME`,或者透過設定 :envvar:`PYTHONPATH` 在標準路徑前面插入額外的目" "錄。" -#: ../../c-api/intro.rst:779 +#: ../../c-api/intro.rst:778 +#, fuzzy msgid "" -"The embedding application can steer the search by calling " -"``Py_SetProgramName(file)`` *before* calling :c:func:`Py_Initialize`. Note " -"that :envvar:`PYTHONHOME` still overrides this and :envvar:`PYTHONPATH` is " -"still inserted in front of the standard path. An application that requires " -"total control has to provide its own implementation of :c:func:" +"The embedding application can steer the search by setting :c:member:" +"`PyConfig.program_name` *before* calling :c:func:`Py_InitializeFromConfig`. " +"Note that :envvar:`PYTHONHOME` still overrides this and :envvar:`PYTHONPATH` " +"is still inserted in front of the standard path. An application that " +"requires total control has to provide its own implementation of :c:func:" "`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, and :c:" "func:`Py_GetProgramFullPath` (all defined in :file:`Modules/getpath.c`)." msgstr "" @@ -1426,10 +1427,6 @@ msgstr "path(路徑)" msgid "path (in module sys)" msgstr "path(sys 模組中)" -#: ../../c-api/intro.rst:772 -msgid "Py_SetProgramName (C function)" -msgstr "Py_SetProgramName(C 函式)" - #: ../../c-api/intro.rst:772 msgid "Py_GetPath (C function)" msgstr "Py_GetPath(C 函式)" @@ -1449,3 +1446,6 @@ msgstr "Py_GetProgramFullPath(C 函式)" #: ../../c-api/intro.rst:787 msgid "Py_IsInitialized (C function)" msgstr "Py_IsInitialized(C 函式)" + +#~ msgid "Py_SetProgramName (C function)" +#~ msgstr "Py_SetProgramName(C 函式)" diff --git a/c-api/list.po b/c-api/list.po index 3f36448343..8627316f79 100644 --- a/c-api/list.po +++ b/c-api/list.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-08-24 00:55+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -57,43 +57,54 @@ msgid "Return a new list of length *len* on success, or ``NULL`` on failure." msgstr "成功時回傳長度為 *len* 的新串列,失敗時回傳 ``NULL``。" #: ../../c-api/list.rst:40 +#, fuzzy msgid "" "If *len* is greater than zero, the returned list object's items are set to " -"``NULL``. Thus you cannot use abstract API functions such as :c:func:" -"`PySequence_SetItem` or expose the object to Python code before setting all " -"items to a real object with :c:func:`PyList_SetItem`." +"``NULL``. Thus you cannot use abstract API functions such as :c:func:" +"`PySequence_SetItem` or expose the object to Python code before setting all " +"items to a real object with :c:func:`PyList_SetItem` or :c:func:" +"`PyList_SET_ITEM()`. The following APIs are safe APIs before the list is " +"fully initialized: :c:func:`PyList_SetItem()` and :c:func:" +"`PyList_SET_ITEM()`." msgstr "" "如果 *len* 大於零,則回傳的串列物件之項目將被設定為 ``NULL``。因此,在使用 :" "c:func:`PyList_SetItem` 來將所有項目設定為一個真實物件前,你無法使用像是 :c:" "func:`PySequence_SetItem` 的使用抽象 API 函式,也不能將物件暴露 (expose) 給 " "Python 程式碼。" -#: ../../c-api/list.rst:50 +#: ../../c-api/list.rst:53 msgid "" "Return the length of the list object in *list*; this is equivalent to " "``len(list)`` on a list object." msgstr "回傳 *list* 串列物件的長度;這相當於串列物件的 ``len(list)``。" -#: ../../c-api/list.rst:56 +#: ../../c-api/list.rst:59 msgid "Similar to :c:func:`PyList_Size`, but without error checking." msgstr "與 :c:func:`PyList_Size` 類似,但沒有錯誤檢查。" -#: ../../c-api/list.rst:61 +#: ../../c-api/list.rst:64 +#, fuzzy msgid "" "Return the object at position *index* in the list pointed to by *list*. The " "position must be non-negative; indexing from the end of the list is not " -"supported. If *index* is out of bounds (<0 or >=len(list)), return ``NULL`` " -"and set an :exc:`IndexError` exception." +"supported. If *index* is out of bounds (:code:`<0 or >=len(list)`), return " +"``NULL`` and set an :exc:`IndexError` exception." msgstr "" "回傳 *list* 指向的串列中位於 *index* 位置的物件。該位置不可為負數;並不支援從" "串列尾末開始索引。如果 *index* 超出邊界範圍(<0 或 >=len(list))則回傳 " "``NULL`` 並設定 :exc:`IndexError` 例外。" -#: ../../c-api/list.rst:69 +#: ../../c-api/list.rst:74 +msgid "" +"Like :c:func:`PyList_GetItemRef`, but returns a :term:`borrowed reference` " +"instead of a :term:`strong reference`." +msgstr "" + +#: ../../c-api/list.rst:80 msgid "Similar to :c:func:`PyList_GetItem`, but without error checking." msgstr "與 :c:func:`PyList_GetItem` 類似,但沒有錯誤檢查。" -#: ../../c-api/list.rst:74 +#: ../../c-api/list.rst:85 msgid "" "Set the item at index *index* in list to *item*. Return ``0`` on success. " "If *index* is out of bounds, return ``-1`` and set an :exc:`IndexError` " @@ -102,14 +113,14 @@ msgstr "" "將串列中索引 *index* 處的項目設定為 *item*。成功時回傳 ``0``。如果 *index* 超" "出邊界範圍則回傳 ``-1`` 並設定一個 :exc:`IndexError` 例外。" -#: ../../c-api/list.rst:80 +#: ../../c-api/list.rst:91 msgid "" "This function \"steals\" a reference to *item* and discards a reference to " "an item already in the list at the affected position." msgstr "" "此函式「竊取」對 *item* 的參照,並丟棄對串列中受影響位置上已存在項目的參照。" -#: ../../c-api/list.rst:86 +#: ../../c-api/list.rst:97 msgid "" "Macro form of :c:func:`PyList_SetItem` without error checking. This is " "normally only used to fill in new lists where there is no previous content." @@ -117,7 +128,13 @@ msgstr "" ":c:func:`PyList_SetItem` 的巨集形式,沒有錯誤檢查。這通常僅用於填充沒有已存在" "內容的新串列。" -#: ../../c-api/list.rst:91 +#: ../../c-api/list.rst:100 +msgid "" +"Bounds checking is performed as an assertion if Python is built in :ref:" +"`debug mode ` or :option:`with assertions <--with-assertions>`." +msgstr "" + +#: ../../c-api/list.rst:106 msgid "" "This macro \"steals\" a reference to *item*, and, unlike :c:func:" "`PyList_SetItem`, does *not* discard a reference to any item that is being " @@ -127,7 +144,7 @@ msgstr "" "\\ *不會*\\ 丟棄對任意被替換項目的參照;*list* 中位置 *i* 的任何參照都將被洩" "漏 (leak)。" -#: ../../c-api/list.rst:99 +#: ../../c-api/list.rst:114 msgid "" "Insert the item *item* into list *list* in front of index *index*. Return " "``0`` if successful; return ``-1`` and set an exception if unsuccessful. " @@ -137,7 +154,7 @@ msgstr "" "``0``;如果失敗則回傳 ``-1`` 並設定例外。類似於 ``list.insert(index, " "item)``。" -#: ../../c-api/list.rst:106 +#: ../../c-api/list.rst:121 msgid "" "Append the object *item* at the end of list *list*. Return ``0`` if " "successful; return ``-1`` and set an exception if unsuccessful. Analogous " @@ -146,7 +163,7 @@ msgstr "" "將物件 *item* 附加到串列 *list* 的最後面。如果成功則回傳 ``0``;如果不成功," "則回傳 ``-1`` 並設定例外。類似於 ``list.append(item)``。" -#: ../../c-api/list.rst:113 +#: ../../c-api/list.rst:128 msgid "" "Return a list of the objects in *list* containing the objects *between* " "*low* and *high*. Return ``NULL`` and set an exception if unsuccessful. " @@ -157,7 +174,7 @@ msgstr "" "成功則回傳 ``NULL`` 並設定例外。類似於 ``list[low:high]``。不支援從串列尾末開" "始索引。" -#: ../../c-api/list.rst:120 +#: ../../c-api/list.rst:135 msgid "" "Set the slice of *list* between *low* and *high* to the contents of " "*itemlist*. Analogous to ``list[low:high] = itemlist``. The *itemlist* may " @@ -170,7 +187,33 @@ msgstr "" "(切片刪除)。成功時回傳 ``0``,失敗時則回傳 ``-1``。不支援從串列尾末開始索" "引。" -#: ../../c-api/list.rst:129 +#: ../../c-api/list.rst:144 +msgid "" +"Extend *list* with the contents of *iterable*. This is the same as " +"``PyList_SetSlice(list, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, iterable)`` and " +"analogous to ``list.extend(iterable)`` or ``list += iterable``." +msgstr "" + +#: ../../c-api/list.rst:148 +msgid "" +"Raise an exception and return ``-1`` if *list* is not a :class:`list` " +"object. Return 0 on success." +msgstr "" + +#: ../../c-api/list.rst:156 +msgid "" +"Remove all items from *list*. This is the same as ``PyList_SetSlice(list, " +"0, PY_SSIZE_T_MAX, NULL)`` and analogous to ``list.clear()`` or ``del " +"list[:]``." +msgstr "" + +#: ../../c-api/list.rst:160 +msgid "" +"Raise an exception and return ``-1`` if *list* is not a :class:`list` " +"object. Return 0 on success." +msgstr "" + +#: ../../c-api/list.rst:168 msgid "" "Sort the items of *list* in place. Return ``0`` on success, ``-1`` on " "failure. This is equivalent to ``list.sort()``." @@ -178,7 +221,7 @@ msgstr "" "對 *list* 的項目進行原地 (in place) 排序。成功時回傳 ``0``,失敗時回傳 " "``-1``。這相當於 ``list.sort()``。" -#: ../../c-api/list.rst:135 +#: ../../c-api/list.rst:174 msgid "" "Reverse the items of *list* in place. Return ``0`` on success, ``-1`` on " "failure. This is the equivalent of ``list.reverse()``." @@ -186,7 +229,7 @@ msgstr "" "原地反轉 *list* 的項目。成功時回傳 ``0``,失敗時回傳 ``-1``。這相當於 ``list." "reverse()``。" -#: ../../c-api/list.rst:143 +#: ../../c-api/list.rst:182 msgid "" "Return a new tuple object containing the contents of *list*; equivalent to " "``tuple(list)``." @@ -202,14 +245,14 @@ msgstr "object(物件)" msgid "list" msgstr "list(串列)" -#: ../../c-api/list.rst:48 ../../c-api/list.rst:141 +#: ../../c-api/list.rst:51 ../../c-api/list.rst:180 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/list.rst:48 +#: ../../c-api/list.rst:51 msgid "len" msgstr "len" -#: ../../c-api/list.rst:141 +#: ../../c-api/list.rst:180 msgid "tuple" msgstr "tuple(元組)" diff --git a/c-api/long.po b/c-api/long.po index 32a9ac0039..7abcaaf2c1 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-06 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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-" @@ -138,35 +138,69 @@ msgid "" "retrieved from the resulting value using :c:func:`PyLong_AsVoidPtr`." msgstr "" -#: ../../c-api/long.rst:123 ../../c-api/long.rst:141 +#: ../../c-api/long.rst:118 +msgid "" +"Create a Python integer from the value contained in the first *n_bytes* of " +"*buffer*, interpreted as a two's-complement signed number." +msgstr "" + +#: ../../c-api/long.rst:121 +msgid "" +"*flags* are as for :c:func:`PyLong_AsNativeBytes`. Passing ``-1`` will " +"select the native endian that CPython was compiled with and assume that the " +"most-significant bit is a sign bit. Passing " +"``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` will produce the same result as " +"calling :c:func:`PyLong_FromUnsignedNativeBytes`. Other flags are ignored." +msgstr "" + +#: ../../c-api/long.rst:132 +msgid "" +"Create a Python integer from the value contained in the first *n_bytes* of " +"*buffer*, interpreted as an unsigned number." +msgstr "" + +#: ../../c-api/long.rst:135 +msgid "" +"*flags* are as for :c:func:`PyLong_AsNativeBytes`. Passing ``-1`` will " +"select the native endian that CPython was compiled with and assume that the " +"most-significant bit is not a sign bit. Flags other than endian are ignored." +msgstr "" + +#: ../../c-api/long.rst:149 ../../c-api/long.rst:175 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__` " "method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:127 +#: ../../c-api/long.rst:153 msgid "" "Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" "expr:`long`." msgstr "" -#: ../../c-api/long.rst:130 ../../c-api/long.rst:150 ../../c-api/long.rst:171 -#: ../../c-api/long.rst:191 ../../c-api/long.rst:214 +#: ../../c-api/long.rst:156 ../../c-api/long.rst:184 ../../c-api/long.rst:205 +#: ../../c-api/long.rst:225 ../../c-api/long.rst:248 msgid "Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:132 ../../c-api/long.rst:152 ../../c-api/long.rst:173 -#: ../../c-api/long.rst:195 ../../c-api/long.rst:279 ../../c-api/long.rst:299 +#: ../../c-api/long.rst:158 ../../c-api/long.rst:186 ../../c-api/long.rst:207 +#: ../../c-api/long.rst:229 ../../c-api/long.rst:313 ../../c-api/long.rst:333 msgid "Use :meth:`~object.__index__` if available." msgstr "" -#: ../../c-api/long.rst:135 ../../c-api/long.rst:155 ../../c-api/long.rst:176 -#: ../../c-api/long.rst:198 ../../c-api/long.rst:282 ../../c-api/long.rst:302 +#: ../../c-api/long.rst:161 ../../c-api/long.rst:189 ../../c-api/long.rst:210 +#: ../../c-api/long.rst:232 ../../c-api/long.rst:316 ../../c-api/long.rst:336 msgid "This function will no longer use :meth:`~object.__int__`." msgstr "" -#: ../../c-api/long.rst:145 +#: ../../c-api/long.rst:167 +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:179 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 " @@ -174,20 +208,20 @@ msgid "" "exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" -#: ../../c-api/long.rst:164 ../../c-api/long.rst:182 +#: ../../c-api/long.rst:198 ../../c-api/long.rst:216 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:168 +#: ../../c-api/long.rst:202 msgid "" "Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" "expr:`long long`." msgstr "" -#: ../../c-api/long.rst:186 +#: ../../c-api/long.rst:220 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 " @@ -195,133 +229,133 @@ msgid "" "exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" -#: ../../c-api/long.rst:208 +#: ../../c-api/long.rst:242 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:211 +#: ../../c-api/long.rst:245 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:223 +#: ../../c-api/long.rst:257 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:226 +#: ../../c-api/long.rst:260 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "expr:`unsigned long`." msgstr "" -#: ../../c-api/long.rst:229 +#: ../../c-api/long.rst:263 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:239 +#: ../../c-api/long.rst:273 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:242 +#: ../../c-api/long.rst:276 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "type:`size_t`." msgstr "" -#: ../../c-api/long.rst:245 +#: ../../c-api/long.rst:279 msgid "" "Returns ``(size_t)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:254 +#: ../../c-api/long.rst:288 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:257 +#: ../../c-api/long.rst:291 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:260 +#: ../../c-api/long.rst:294 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:263 +#: ../../c-api/long.rst:297 msgid "" "A negative *pylong* now raises :exc:`OverflowError`, not :exc:`TypeError`." msgstr "" -#: ../../c-api/long.rst:269 +#: ../../c-api/long.rst:303 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:273 +#: ../../c-api/long.rst:307 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:276 +#: ../../c-api/long.rst:310 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:288 +#: ../../c-api/long.rst:322 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:293 +#: ../../c-api/long.rst:327 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:296 +#: ../../c-api/long.rst:330 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` " "to disambiguate." msgstr "" -#: ../../c-api/long.rst:308 +#: ../../c-api/long.rst:342 msgid "" "Return a C :c:expr:`double` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:311 +#: ../../c-api/long.rst:345 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "expr:`double`." msgstr "" -#: ../../c-api/long.rst:314 +#: ../../c-api/long.rst:348 msgid "" "Returns ``-1.0`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:319 +#: ../../c-api/long.rst:353 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 " @@ -329,52 +363,263 @@ msgid "" "c:func:`PyLong_FromVoidPtr`." msgstr "" -#: ../../c-api/long.rst:324 +#: ../../c-api/long.rst:358 msgid "" "Returns ``NULL`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:329 +#: ../../c-api/long.rst:363 +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:367 +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:371 +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 " +"*n_bytes* of the buffer are written: large buffers are padded with zeroes." +msgstr "" + +#: ../../c-api/long.rst:376 +msgid "" +"If the returned value is greater than than *n_bytes*, the value was " +"truncated: as many of the lowest bits of the value as could fit are written, " +"and the higher bits are ignored. This matches the typical behavior of a C-" +"style downcast." +msgstr "" + +#: ../../c-api/long.rst:383 +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:386 +msgid "``0`` will never be returned." +msgstr "" + +#: ../../c-api/long.rst:388 +msgid "Values are always copied as two's-complement." +msgstr "" + +#: ../../c-api/long.rst:390 +msgid "Usage example::" +msgstr "" + +#: ../../c-api/long.rst:392 +msgid "" +"int32_t value;\n" +"Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, &value, sizeof(value), -1);\n" +"if (bytes < 0) {\n" +" // Failed. A Python exception was set with the reason.\n" +" return NULL;\n" +"}\n" +"else if (bytes <= (Py_ssize_t)sizeof(value)) {\n" +" // Success!\n" +"}\n" +"else {\n" +" // Overflow occurred, but 'value' contains the truncated\n" +" // lowest bits of pylong.\n" +"}" +msgstr "" + +#: ../../c-api/long.rst:406 +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:413 +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:416 +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:419 +msgid "" +"// Ask how much space we need.\n" +"Py_ssize_t expected = PyLong_AsNativeBytes(pylong, NULL, 0, -1);\n" +"if (expected < 0) {\n" +" // Failed. A Python exception was set with the reason.\n" +" return NULL;\n" +"}\n" +"assert(expected != 0); // Impossible per the API definition.\n" +"uint8_t *bignum = malloc(expected);\n" +"if (!bignum) {\n" +" PyErr_SetString(PyExc_MemoryError, \"bignum malloc failed.\");\n" +" return NULL;\n" +"}\n" +"// Safely get the entire value.\n" +"Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, bignum, expected, -1);\n" +"if (bytes < 0) { // Exception has been set.\n" +" free(bignum);\n" +" return NULL;\n" +"}\n" +"else if (bytes > expected) { // This should not be possible.\n" +" PyErr_SetString(PyExc_RuntimeError,\n" +" \"Unexpected bignum truncation after a size check.\");\n" +" free(bignum);\n" +" return NULL;\n" +"}\n" +"// The expected success given the above pre-check.\n" +"// ... use bignum ...\n" +"free(bignum);" +msgstr "" + +#: ../../c-api/long.rst:447 +msgid "" +"*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults " +"that behave most like a C cast, or a combintation of the other flags in the " +"table below. Note that ``-1`` cannot be combined with other flags." +msgstr "" + +#: ../../c-api/long.rst:452 +msgid "" +"Currently, ``-1`` corresponds to ``Py_ASNATIVEBYTES_NATIVE_ENDIAN | " +"Py_ASNATIVEBYTES_UNSIGNED_BUFFER``." +msgstr "" + +#: ../../c-api/long.rst:456 +msgid "Flag" +msgstr "" + +#: ../../c-api/long.rst:456 +msgid "Value" +msgstr "" + +#: ../../c-api/long.rst:458 +msgid "``-1``" +msgstr "" + +#: ../../c-api/long.rst:459 +msgid "``0``" +msgstr "" + +#: ../../c-api/long.rst:460 +msgid "``1``" +msgstr "" + +#: ../../c-api/long.rst:461 +msgid "``3``" +msgstr "" + +#: ../../c-api/long.rst:462 +msgid "``4``" +msgstr "" + +#: ../../c-api/long.rst:463 +msgid "``8``" +msgstr "" + +#: ../../c-api/long.rst:464 +msgid "``16``" +msgstr "" + +#: ../../c-api/long.rst:467 +msgid "" +"Specifying ``Py_ASNATIVEBYTES_NATIVE_ENDIAN`` will override any other endian " +"flags. Passing ``2`` is reserved." +msgstr "" + +#: ../../c-api/long.rst:470 +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:474 +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 " +"single-byte buffer. If the destination buffer is later treated as signed, a " +"positive input value may become negative. Note that the flag does not affect " +"handling of negative values: for those, space for a sign bit is always " +"requested." +msgstr "" + +#: ../../c-api/long.rst:481 +msgid "" +"Specifying ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` causes an exception to be " +"set if *pylong* is negative. Without this flag, negative values will be " +"copied provided there is enough space for at least one sign bit, regardless " +"of whether ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` was specified." +msgstr "" + +#: ../../c-api/long.rst:486 +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 " +"result in Python code executing and other threads being allowed to run, " +"which could cause changes to other objects or values in use. When *flags* is " +"``-1``, this option is not set, and non-integer values will raise :exc:" +"`TypeError`." +msgstr "" + +#: ../../c-api/long.rst:495 +msgid "" +"With the default *flags* (``-1``, or *UNSIGNED_BUFFER* without " +"*REJECT_NEGATIVE*), multiple Python integers can map to a single value " +"without overflow. For example, both ``255`` and ``-1`` fit a single-byte " +"buffer and set all its bits. This matches typical C cast behavior." +msgstr "" + +#: ../../c-api/long.rst:506 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:333 +#: ../../c-api/long.rst:510 msgid "On failure, return ``NULL`` with an exception set." msgstr "在失敗時,會回傳 ``NULL`` 並設定例外。" -#: ../../c-api/long.rst:340 +#: ../../c-api/long.rst:517 msgid "Return 1 if *op* is compact, 0 otherwise." msgstr "" -#: ../../c-api/long.rst:342 +#: ../../c-api/long.rst:519 msgid "" "This function makes it possible for performance-critical code to implement a " "“fast path” for small integers. For compact values use :c:func:" "`PyUnstable_Long_CompactValue`; for others fall back to a :c:func:" -"`PyLong_As* ` function or :c:func:`calling " -"` :meth:`int.to_bytes`." +"`PyLong_As* ` function or :c:func:`PyLong_AsNativeBytes`." msgstr "" -#: ../../c-api/long.rst:348 +#: ../../c-api/long.rst:525 msgid "The speedup is expected to be negligible for most users." msgstr "" -#: ../../c-api/long.rst:350 +#: ../../c-api/long.rst:527 msgid "" "Exactly what values are considered compact is an implementation detail and " "is subject to change." msgstr "" -#: ../../c-api/long.rst:355 +#: ../../c-api/long.rst:532 msgid "" "If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`, " "return its value." msgstr "" -#: ../../c-api/long.rst:358 +#: ../../c-api/long.rst:535 msgid "Otherwise, the return value is undefined." msgstr "" @@ -390,23 +635,23 @@ msgstr "long integer(長整数)" msgid "integer" msgstr "integer(整数)" -#: ../../c-api/long.rst:119 +#: ../../c-api/long.rst:145 msgid "LONG_MAX (C macro)" msgstr "LONG_MAX(C 巨集)" -#: ../../c-api/long.rst:119 ../../c-api/long.rst:161 ../../c-api/long.rst:204 -#: ../../c-api/long.rst:219 ../../c-api/long.rst:235 ../../c-api/long.rst:251 +#: ../../c-api/long.rst:145 ../../c-api/long.rst:195 ../../c-api/long.rst:238 +#: ../../c-api/long.rst:253 ../../c-api/long.rst:269 ../../c-api/long.rst:285 msgid "OverflowError (built-in exception)" msgstr "OverflowError(内建例外)" -#: ../../c-api/long.rst:204 +#: ../../c-api/long.rst:238 msgid "PY_SSIZE_T_MAX (C macro)" msgstr "PY_SSIZE_T_MAX(C 巨集)" -#: ../../c-api/long.rst:219 +#: ../../c-api/long.rst:253 msgid "ULONG_MAX (C macro)" msgstr "ULONG_MAX(C 巨集)" -#: ../../c-api/long.rst:235 +#: ../../c-api/long.rst:269 msgid "SIZE_MAX (C macro)" msgstr "SIZE_MAX(C 巨集)" diff --git a/c-api/mapping.po b/c-api/mapping.po index 6541506687..49e8987a80 100644 --- a/c-api/mapping.po +++ b/c-api/mapping.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-03 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-05-11 14:32+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -61,6 +61,31 @@ msgstr "" #: ../../c-api/mapping.rst:38 msgid "" +"Variant of :c:func:`PyObject_GetItem` which doesn't raise :exc:`KeyError` if " +"the key is not found." +msgstr "" + +#: ../../c-api/mapping.rst:41 +msgid "" +"If the key is found, return ``1`` and set *\\*result* to a new :term:`strong " +"reference` to the corresponding value. If the key is not found, return ``0`` " +"and set *\\*result* to ``NULL``; the :exc:`KeyError` is silenced. If an " +"error other than :exc:`KeyError` is raised, return ``-1`` and set " +"*\\*result* to ``NULL``." +msgstr "" + +#: ../../c-api/mapping.rst:53 +#, fuzzy +msgid "" +"This is the same as :c:func:`PyMapping_GetOptionalItem`, but *key* is " +"specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." +msgstr "" +"這與 :c:func:`PyMapping_HasKey` 相同,但 *key* 被指定為 :c:expr:`const " +"char*` UTF-8 編碼位元組字串,而不是 :c:expr:`PyObject*`。" + +#: ../../c-api/mapping.rst:62 +msgid "" "This is the same as :c:func:`PyObject_SetItem`, but *key* is specified as a :" "c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." @@ -68,11 +93,11 @@ msgstr "" "這與 :c:func:`PyObject_SetItem` 相同,但 *key* 被指定為 :c:expr:`const " "char*` UTF-8 編碼位元組字串,而不是 :c:expr:`PyObject*`。" -#: ../../c-api/mapping.rst:45 +#: ../../c-api/mapping.rst:69 msgid "This is an alias of :c:func:`PyObject_DelItem`." msgstr "這是 :c:func:`PyObject_DelItem` 的別名。" -#: ../../c-api/mapping.rst:50 +#: ../../c-api/mapping.rst:74 msgid "" "This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as a :" "c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" @@ -81,7 +106,27 @@ msgstr "" "這與 :c:func:`PyObject_DelItem` 相同,但 *key* 被指定為 :c:expr:`const " "char*` UTF-8 編碼位元組字串,而不是 :c:expr:`PyObject*`。" -#: ../../c-api/mapping.rst:57 +#: ../../c-api/mapping.rst:81 +#, fuzzy +msgid "" +"Return ``1`` if the mapping object has the key *key* and ``0`` otherwise. " +"This is equivalent to the Python expression ``key in o``. On failure, return " +"``-1``." +msgstr "" +"如果對映物件具有鍵 *key* 則回傳 ``1``,否則回傳 ``0``。這相當於 Python 運算" +"式 ``key in o``。這個函式總會是成功的。" + +#: ../../c-api/mapping.rst:90 +#, fuzzy +msgid "" +"This is the same as :c:func:`PyMapping_HasKeyWithError`, but *key* is " +"specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." +msgstr "" +"這與 :c:func:`PyMapping_HasKey` 相同,但 *key* 被指定為 :c:expr:`const " +"char*` UTF-8 編碼位元組字串,而不是 :c:expr:`PyObject*`。" + +#: ../../c-api/mapping.rst:99 msgid "" "Return ``1`` if the mapping object has the key *key* and ``0`` otherwise. " "This is equivalent to the Python expression ``key in o``. This function " @@ -90,16 +135,18 @@ msgstr "" "如果對映物件具有鍵 *key* 則回傳 ``1``,否則回傳 ``0``。這相當於 Python 運算" "式 ``key in o``。這個函式總會是成功的。" -#: ../../c-api/mapping.rst:63 +#: ../../c-api/mapping.rst:105 +#, fuzzy msgid "" "Exceptions which occur when this calls :meth:`~object.__getitem__` method " "are silently ignored. For proper error handling, use :c:func:" +"`PyMapping_HasKeyWithError`, :c:func:`PyMapping_GetOptionalItem` or :c:func:" "`PyObject_GetItem()` instead." msgstr "" "當它呼叫 :meth:`~object.__getitem__` 方法時發生的例外將被默默忽略。為了適當地" "處理錯誤,請改用 :c:func:`PyObject_GetItem()`。" -#: ../../c-api/mapping.rst:70 +#: ../../c-api/mapping.rst:113 msgid "" "This is the same as :c:func:`PyMapping_HasKey`, but *key* is specified as a :" "c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" @@ -108,34 +155,37 @@ msgstr "" "這與 :c:func:`PyMapping_HasKey` 相同,但 *key* 被指定為 :c:expr:`const " "char*` UTF-8 編碼位元組字串,而不是 :c:expr:`PyObject*`。" -#: ../../c-api/mapping.rst:76 +#: ../../c-api/mapping.rst:119 +#, fuzzy msgid "" "Exceptions that occur when this calls :meth:`~object.__getitem__` method or " "while creating the temporary :class:`str` object are silently ignored. For " -"proper error handling, use :c:func:`PyMapping_GetItemString` instead." +"proper error handling, use :c:func:`PyMapping_HasKeyStringWithError`, :c:" +"func:`PyMapping_GetOptionalItemString` or :c:func:`PyMapping_GetItemString` " +"instead." msgstr "" "當它呼叫 :meth:`~object.__getitem__` 方法或建立臨時 :class:`str` 物件時發生的" "例外將被默默忽略。為了適當地處理錯誤,請改用 :c:func:" "`PyMapping_GetItemString`。" -#: ../../c-api/mapping.rst:84 +#: ../../c-api/mapping.rst:129 msgid "" "On success, return a list of the keys in object *o*. On failure, return " "``NULL``." msgstr "成功時回傳一個物件 *o* 內之鍵的串列,失敗時回傳 ``NULL``。" -#: ../../c-api/mapping.rst:87 ../../c-api/mapping.rst:96 -#: ../../c-api/mapping.rst:105 +#: ../../c-api/mapping.rst:132 ../../c-api/mapping.rst:141 +#: ../../c-api/mapping.rst:150 msgid "Previously, the function returned a list or a tuple." msgstr "在以前,該函式會回傳串列或元組。" -#: ../../c-api/mapping.rst:93 +#: ../../c-api/mapping.rst:138 msgid "" "On success, return a list of the values in object *o*. On failure, return " "``NULL``." msgstr "成功時回傳物件 *o* 中值的串列。失敗時回傳 ``NULL``。" -#: ../../c-api/mapping.rst:102 +#: ../../c-api/mapping.rst:147 msgid "" "On success, return a list of the items in object *o*, where each item is a " "tuple containing a key-value pair. On failure, return ``NULL``." diff --git a/c-api/memory.po b/c-api/memory.po index caff2b4129..489366188e 100644 --- a/c-api/memory.po +++ b/c-api/memory.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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-" @@ -552,181 +552,187 @@ msgstr "" #: ../../c-api/memory.rst:394 msgid "" +"``mimalloc``: :ref:`mimalloc memory allocator `. The pymalloc " +"allocator will be used if mimalloc support isn't available." +msgstr "" + +#: ../../c-api/memory.rst:396 +msgid "" "\"+ debug\": with :ref:`debug hooks on the Python memory allocators `." msgstr "" -#: ../../c-api/memory.rst:396 +#: ../../c-api/memory.rst:398 msgid "\"Debug build\": :ref:`Python build in debug mode `." msgstr "" -#: ../../c-api/memory.rst:401 +#: ../../c-api/memory.rst:403 msgid "Customize Memory Allocators" msgstr "" -#: ../../c-api/memory.rst:407 +#: ../../c-api/memory.rst:409 msgid "" "Structure used to describe a memory block allocator. The structure has the " "following fields:" msgstr "" -#: ../../c-api/memory.rst:411 ../../c-api/memory.rst:658 +#: ../../c-api/memory.rst:413 ../../c-api/memory.rst:660 msgid "Field" msgstr "欄位" -#: ../../c-api/memory.rst:411 ../../c-api/memory.rst:658 +#: ../../c-api/memory.rst:413 ../../c-api/memory.rst:660 msgid "Meaning" msgstr "意義" -#: ../../c-api/memory.rst:413 ../../c-api/memory.rst:660 +#: ../../c-api/memory.rst:415 ../../c-api/memory.rst:662 msgid "``void *ctx``" msgstr "``void *ctx``" -#: ../../c-api/memory.rst:413 ../../c-api/memory.rst:660 +#: ../../c-api/memory.rst:415 ../../c-api/memory.rst:662 msgid "user context passed as first argument" msgstr "" -#: ../../c-api/memory.rst:415 +#: ../../c-api/memory.rst:417 msgid "``void* malloc(void *ctx, size_t size)``" msgstr "``void* malloc(void *ctx, size_t size)``" -#: ../../c-api/memory.rst:415 +#: ../../c-api/memory.rst:417 msgid "allocate a memory block" msgstr "" -#: ../../c-api/memory.rst:417 +#: ../../c-api/memory.rst:419 msgid "``void* calloc(void *ctx, size_t nelem, size_t elsize)``" msgstr "``void* calloc(void *ctx, size_t nelem, size_t elsize)``" -#: ../../c-api/memory.rst:417 +#: ../../c-api/memory.rst:419 msgid "allocate a memory block initialized with zeros" msgstr "" -#: ../../c-api/memory.rst:420 +#: ../../c-api/memory.rst:422 msgid "``void* realloc(void *ctx, void *ptr, size_t new_size)``" msgstr "``void* realloc(void *ctx, void *ptr, size_t new_size)``" -#: ../../c-api/memory.rst:420 +#: ../../c-api/memory.rst:422 msgid "allocate or resize a memory block" msgstr "" -#: ../../c-api/memory.rst:422 +#: ../../c-api/memory.rst:424 msgid "``void free(void *ctx, void *ptr)``" msgstr "``void free(void *ctx, void *ptr)``" -#: ../../c-api/memory.rst:422 +#: ../../c-api/memory.rst:424 msgid "free a memory block" msgstr "" -#: ../../c-api/memory.rst:425 +#: ../../c-api/memory.rst:427 msgid "" "The :c:type:`!PyMemAllocator` structure was renamed to :c:type:" "`PyMemAllocatorEx` and a new ``calloc`` field was added." msgstr "" -#: ../../c-api/memory.rst:432 +#: ../../c-api/memory.rst:434 msgid "Enum used to identify an allocator domain. Domains:" msgstr "" -#: ../../c-api/memory.rst:438 ../../c-api/memory.rst:447 -#: ../../c-api/memory.rst:456 +#: ../../c-api/memory.rst:440 ../../c-api/memory.rst:449 +#: ../../c-api/memory.rst:458 msgid "Functions:" msgstr "函式:" -#: ../../c-api/memory.rst:440 +#: ../../c-api/memory.rst:442 msgid ":c:func:`PyMem_RawMalloc`" msgstr ":c:func:`PyMem_RawMalloc`" -#: ../../c-api/memory.rst:441 +#: ../../c-api/memory.rst:443 msgid ":c:func:`PyMem_RawRealloc`" msgstr ":c:func:`PyMem_RawRealloc`" -#: ../../c-api/memory.rst:442 +#: ../../c-api/memory.rst:444 msgid ":c:func:`PyMem_RawCalloc`" msgstr ":c:func:`PyMem_RawCalloc`" -#: ../../c-api/memory.rst:443 +#: ../../c-api/memory.rst:445 msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" -#: ../../c-api/memory.rst:449 +#: ../../c-api/memory.rst:451 msgid ":c:func:`PyMem_Malloc`," msgstr ":c:func:`PyMem_Malloc`," -#: ../../c-api/memory.rst:450 +#: ../../c-api/memory.rst:452 msgid ":c:func:`PyMem_Realloc`" msgstr ":c:func:`PyMem_Realloc`" -#: ../../c-api/memory.rst:451 +#: ../../c-api/memory.rst:453 msgid ":c:func:`PyMem_Calloc`" msgstr ":c:func:`PyMem_Calloc`" -#: ../../c-api/memory.rst:452 +#: ../../c-api/memory.rst:454 msgid ":c:func:`PyMem_Free`" msgstr ":c:func:`PyMem_Free`" -#: ../../c-api/memory.rst:458 +#: ../../c-api/memory.rst:460 msgid ":c:func:`PyObject_Malloc`" msgstr ":c:func:`PyObject_Malloc`" -#: ../../c-api/memory.rst:459 +#: ../../c-api/memory.rst:461 msgid ":c:func:`PyObject_Realloc`" msgstr ":c:func:`PyObject_Realloc`" -#: ../../c-api/memory.rst:460 +#: ../../c-api/memory.rst:462 msgid ":c:func:`PyObject_Calloc`" msgstr ":c:func:`PyObject_Calloc`" -#: ../../c-api/memory.rst:461 +#: ../../c-api/memory.rst:463 msgid ":c:func:`PyObject_Free`" msgstr ":c:func:`PyObject_Free`" -#: ../../c-api/memory.rst:465 +#: ../../c-api/memory.rst:467 msgid "Get the memory block allocator of the specified domain." msgstr "" -#: ../../c-api/memory.rst:470 +#: ../../c-api/memory.rst:472 msgid "Set the memory block allocator of the specified domain." msgstr "" -#: ../../c-api/memory.rst:472 +#: ../../c-api/memory.rst:474 msgid "" "The new allocator must return a distinct non-``NULL`` pointer when " "requesting zero bytes." msgstr "" -#: ../../c-api/memory.rst:475 +#: ../../c-api/memory.rst:477 msgid "" "For the :c:macro:`PYMEM_DOMAIN_RAW` domain, the allocator must be thread-" "safe: the :term:`GIL ` is not held when the " "allocator is called." msgstr "" -#: ../../c-api/memory.rst:479 +#: ../../c-api/memory.rst:481 msgid "" "For the remaining domains, the allocator must also be thread-safe: the " "allocator may be called in different interpreters that do not share a " "``GIL``." msgstr "" -#: ../../c-api/memory.rst:483 +#: ../../c-api/memory.rst:485 msgid "" "If the new allocator is not a hook (does not call the previous allocator), " "the :c:func:`PyMem_SetupDebugHooks` function must be called to reinstall the " "debug hooks on top on the new allocator." msgstr "" -#: ../../c-api/memory.rst:487 +#: ../../c-api/memory.rst:489 msgid "" "See also :c:member:`PyPreConfig.allocator` and :ref:`Preinitialize Python " "with PyPreConfig `." msgstr "" -#: ../../c-api/memory.rst:492 +#: ../../c-api/memory.rst:494 msgid ":c:func:`PyMem_SetAllocator` does have the following contract:" msgstr "" -#: ../../c-api/memory.rst:494 +#: ../../c-api/memory.rst:496 msgid "" "It can be called after :c:func:`Py_PreInitialize` and before :c:func:" "`Py_InitializeFromConfig` to install a custom memory allocator. There are no " @@ -736,7 +742,7 @@ msgid "" "domains>` for more information." msgstr "" -#: ../../c-api/memory.rst:502 +#: ../../c-api/memory.rst:504 msgid "" "If called after Python has finish initializing (after :c:func:" "`Py_InitializeFromConfig` has been called) the allocator **must** wrap the " @@ -744,21 +750,21 @@ msgid "" "arbitrary one is **not supported**." msgstr "" -#: ../../c-api/memory.rst:507 +#: ../../c-api/memory.rst:509 msgid "All allocators must be thread-safe." msgstr "" -#: ../../c-api/memory.rst:513 +#: ../../c-api/memory.rst:515 msgid "" "Setup :ref:`debug hooks in the Python memory allocators ` " "to detect memory errors." msgstr "" -#: ../../c-api/memory.rst:520 +#: ../../c-api/memory.rst:522 msgid "Debug hooks on the Python memory allocators" msgstr "" -#: ../../c-api/memory.rst:522 +#: ../../c-api/memory.rst:524 msgid "" "When :ref:`Python is built in debug mode `, the :c:func:" "`PyMem_SetupDebugHooks` function is called at the :ref:`Python " @@ -766,19 +772,19 @@ msgid "" "allocators to detect memory errors." msgstr "" -#: ../../c-api/memory.rst:527 +#: ../../c-api/memory.rst:529 msgid "" "The :envvar:`PYTHONMALLOC` environment variable can be used to install debug " "hooks on a Python compiled in release mode (ex: ``PYTHONMALLOC=debug``)." msgstr "" -#: ../../c-api/memory.rst:530 +#: ../../c-api/memory.rst:532 msgid "" "The :c:func:`PyMem_SetupDebugHooks` function can be used to set debug hooks " "after calling :c:func:`PyMem_SetAllocator`." msgstr "" -#: ../../c-api/memory.rst:533 +#: ../../c-api/memory.rst:535 msgid "" "These debug hooks fill dynamically allocated memory blocks with special, " "recognizable bit patterns. Newly allocated memory is filled with the byte " @@ -788,25 +794,25 @@ msgid "" "these bytes are unlikely to be valid addresses, floats, or ASCII strings." msgstr "" -#: ../../c-api/memory.rst:540 +#: ../../c-api/memory.rst:542 msgid "Runtime checks:" msgstr "Runtime 檢查:" -#: ../../c-api/memory.rst:542 +#: ../../c-api/memory.rst:544 msgid "" "Detect API violations. For example, detect if :c:func:`PyObject_Free` is " "called on a memory block allocated by :c:func:`PyMem_Malloc`." msgstr "" -#: ../../c-api/memory.rst:544 +#: ../../c-api/memory.rst:546 msgid "Detect write before the start of the buffer (buffer underflow)." msgstr "" -#: ../../c-api/memory.rst:545 +#: ../../c-api/memory.rst:547 msgid "Detect write after the end of the buffer (buffer overflow)." msgstr "" -#: ../../c-api/memory.rst:546 +#: ../../c-api/memory.rst:548 msgid "" "Check that the :term:`GIL ` is held when allocator " "functions of :c:macro:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) " @@ -814,7 +820,7 @@ msgid "" "called." msgstr "" -#: ../../c-api/memory.rst:551 +#: ../../c-api/memory.rst:553 msgid "" "On error, the debug hooks use the :mod:`tracemalloc` module to get the " "traceback where a memory block was allocated. The traceback is only " @@ -822,7 +828,7 @@ msgid "" "memory block was traced." msgstr "" -#: ../../c-api/memory.rst:556 +#: ../../c-api/memory.rst:558 msgid "" "Let *S* = ``sizeof(size_t)``. ``2*S`` bytes are added at each end of each " "block of *N* bytes requested. The memory layout is like so, where p " @@ -832,49 +838,49 @@ msgid "" "from a Python slice):" msgstr "" -#: ../../c-api/memory.rst:562 +#: ../../c-api/memory.rst:564 msgid "``p[-2*S:-S]``" msgstr "``p[-2*S:-S]``" -#: ../../c-api/memory.rst:563 +#: ../../c-api/memory.rst:565 msgid "" "Number of bytes originally asked for. This is a size_t, big-endian (easier " "to read in a memory dump)." msgstr "" -#: ../../c-api/memory.rst:565 +#: ../../c-api/memory.rst:567 msgid "``p[-S]``" msgstr "``p[-S]``" -#: ../../c-api/memory.rst:566 +#: ../../c-api/memory.rst:568 msgid "API identifier (ASCII character):" msgstr "" -#: ../../c-api/memory.rst:568 +#: ../../c-api/memory.rst:570 msgid "``'r'`` for :c:macro:`PYMEM_DOMAIN_RAW`." msgstr "" -#: ../../c-api/memory.rst:569 +#: ../../c-api/memory.rst:571 msgid "``'m'`` for :c:macro:`PYMEM_DOMAIN_MEM`." msgstr "" -#: ../../c-api/memory.rst:570 +#: ../../c-api/memory.rst:572 msgid "``'o'`` for :c:macro:`PYMEM_DOMAIN_OBJ`." msgstr "" -#: ../../c-api/memory.rst:572 +#: ../../c-api/memory.rst:574 msgid "``p[-S+1:0]``" msgstr "``p[-S+1:0]``" -#: ../../c-api/memory.rst:573 +#: ../../c-api/memory.rst:575 msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch under- writes and reads." msgstr "" -#: ../../c-api/memory.rst:575 +#: ../../c-api/memory.rst:577 msgid "``p[0:N]``" msgstr "``p[0:N]``" -#: ../../c-api/memory.rst:576 +#: ../../c-api/memory.rst:578 msgid "" "The requested memory, filled with copies of PYMEM_CLEANBYTE, used to catch " "reference to uninitialized memory. When a realloc-like function is called " @@ -885,25 +891,25 @@ msgid "" "bytes are also filled with PYMEM_DEADBYTE." msgstr "" -#: ../../c-api/memory.rst:584 +#: ../../c-api/memory.rst:586 msgid "``p[N:N+S]``" msgstr "``p[N:N+S]``" -#: ../../c-api/memory.rst:585 +#: ../../c-api/memory.rst:587 msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch over- writes and reads." msgstr "" -#: ../../c-api/memory.rst:587 +#: ../../c-api/memory.rst:589 msgid "``p[N+S:N+2*S]``" msgstr "``p[N+S:N+2*S]``" -#: ../../c-api/memory.rst:588 +#: ../../c-api/memory.rst:590 msgid "" "Only used if the ``PYMEM_DEBUG_SERIALNO`` macro is defined (not defined by " "default)." msgstr "" -#: ../../c-api/memory.rst:591 +#: ../../c-api/memory.rst:593 msgid "" "A serial number, incremented by 1 on each call to a malloc-like or realloc-" "like function. Big-endian :c:type:`size_t`. If \"bad memory\" is detected " @@ -913,7 +919,7 @@ msgid "" "number is incremented, and exists so you can set such a breakpoint easily." msgstr "" -#: ../../c-api/memory.rst:598 +#: ../../c-api/memory.rst:600 msgid "" "A realloc-like or free-like function first checks that the " "PYMEM_FORBIDDENBYTE bytes at each end are intact. If they've been altered, " @@ -926,7 +932,7 @@ msgid "" "getting used)." msgstr "" -#: ../../c-api/memory.rst:607 +#: ../../c-api/memory.rst:609 msgid "" "The :c:func:`PyMem_SetupDebugHooks` function now also works on Python " "compiled in release mode. On error, the debug hooks now use :mod:" @@ -935,7 +941,7 @@ msgid "" "`PYMEM_DOMAIN_OBJ` and :c:macro:`PYMEM_DOMAIN_MEM` domains are called." msgstr "" -#: ../../c-api/memory.rst:615 +#: ../../c-api/memory.rst:617 msgid "" "Byte patterns ``0xCB`` (``PYMEM_CLEANBYTE``), ``0xDB`` (``PYMEM_DEADBYTE``) " "and ``0xFB`` (``PYMEM_FORBIDDENBYTE``) have been replaced with ``0xCD``, " @@ -943,11 +949,11 @@ msgid "" "``malloc()`` and ``free()``." msgstr "" -#: ../../c-api/memory.rst:625 +#: ../../c-api/memory.rst:627 msgid "The pymalloc allocator" msgstr "" -#: ../../c-api/memory.rst:627 +#: ../../c-api/memory.rst:629 msgid "" "Python has a *pymalloc* allocator optimized for small objects (smaller or " "equal to 512 bytes) with a short lifetime. It uses memory mappings called " @@ -956,110 +962,122 @@ msgid "" "`PyMem_RawRealloc` for allocations larger than 512 bytes." msgstr "" -#: ../../c-api/memory.rst:633 +#: ../../c-api/memory.rst:635 msgid "" "*pymalloc* is the :ref:`default allocator ` of " "the :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) and :c:macro:" "`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) domains." msgstr "" -#: ../../c-api/memory.rst:637 +#: ../../c-api/memory.rst:639 msgid "The arena allocator uses the following functions:" msgstr "" -#: ../../c-api/memory.rst:639 +#: ../../c-api/memory.rst:641 msgid ":c:func:`!VirtualAlloc` and :c:func:`!VirtualFree` on Windows," msgstr "" -#: ../../c-api/memory.rst:640 +#: ../../c-api/memory.rst:642 msgid ":c:func:`!mmap` and :c:func:`!munmap` if available," msgstr "" -#: ../../c-api/memory.rst:641 +#: ../../c-api/memory.rst:643 msgid ":c:func:`malloc` and :c:func:`free` otherwise." msgstr "" -#: ../../c-api/memory.rst:643 +#: ../../c-api/memory.rst:645 msgid "" "This allocator is disabled if Python is configured with the :option:`--" "without-pymalloc` option. It can also be disabled at runtime using the :" "envvar:`PYTHONMALLOC` environment variable (ex: ``PYTHONMALLOC=malloc``)." msgstr "" -#: ../../c-api/memory.rst:648 +#: ../../c-api/memory.rst:650 msgid "Customize pymalloc Arena Allocator" msgstr "" -#: ../../c-api/memory.rst:654 +#: ../../c-api/memory.rst:656 msgid "" "Structure used to describe an arena allocator. The structure has three " "fields:" msgstr "" -#: ../../c-api/memory.rst:662 +#: ../../c-api/memory.rst:664 msgid "``void* alloc(void *ctx, size_t size)``" msgstr "``void* alloc(void *ctx, size_t size)``" -#: ../../c-api/memory.rst:662 +#: ../../c-api/memory.rst:664 msgid "allocate an arena of size bytes" msgstr "" -#: ../../c-api/memory.rst:664 +#: ../../c-api/memory.rst:666 msgid "``void free(void *ctx, void *ptr, size_t size)``" msgstr "``void free(void *ctx, void *ptr, size_t size)``" -#: ../../c-api/memory.rst:664 +#: ../../c-api/memory.rst:666 msgid "free an arena" msgstr "" -#: ../../c-api/memory.rst:669 +#: ../../c-api/memory.rst:671 msgid "Get the arena allocator." msgstr "" -#: ../../c-api/memory.rst:673 +#: ../../c-api/memory.rst:675 msgid "Set the arena allocator." msgstr "" -#: ../../c-api/memory.rst:677 +#: ../../c-api/memory.rst:680 +msgid "The mimalloc allocator" +msgstr "" + +#: ../../c-api/memory.rst:684 +msgid "" +"Python supports the mimalloc allocator when the underlying platform support " +"is available. mimalloc \"is a general purpose allocator with excellent " +"performance characteristics. Initially developed by Daan Leijen for the " +"runtime systems of the Koka and Lean languages.\"" +msgstr "" + +#: ../../c-api/memory.rst:689 msgid "tracemalloc C API" msgstr "" -#: ../../c-api/memory.rst:683 +#: ../../c-api/memory.rst:695 msgid "Track an allocated memory block in the :mod:`tracemalloc` module." msgstr "" -#: ../../c-api/memory.rst:685 +#: ../../c-api/memory.rst:697 msgid "" "Return ``0`` on success, return ``-1`` on error (failed to allocate memory " "to store the trace). Return ``-2`` if tracemalloc is disabled." msgstr "" -#: ../../c-api/memory.rst:688 +#: ../../c-api/memory.rst:700 msgid "If memory block is already tracked, update the existing trace." msgstr "" -#: ../../c-api/memory.rst:692 +#: ../../c-api/memory.rst:704 msgid "" "Untrack an allocated memory block in the :mod:`tracemalloc` module. Do " "nothing if the block was not tracked." msgstr "" -#: ../../c-api/memory.rst:695 +#: ../../c-api/memory.rst:707 msgid "Return ``-2`` if tracemalloc is disabled, otherwise return ``0``." msgstr "" -#: ../../c-api/memory.rst:701 +#: ../../c-api/memory.rst:713 msgid "Examples" msgstr "範例" -#: ../../c-api/memory.rst:703 +#: ../../c-api/memory.rst:715 msgid "" "Here is the example from section :ref:`memoryoverview`, rewritten so that " "the I/O buffer is allocated from the Python heap by using the first function " "set::" msgstr "" -#: ../../c-api/memory.rst:706 +#: ../../c-api/memory.rst:718 msgid "" "PyObject *res;\n" "char *buf = (char *) PyMem_Malloc(BUFSIZ); /* for I/O */\n" @@ -1072,11 +1090,11 @@ msgid "" "return res;" msgstr "" -#: ../../c-api/memory.rst:716 +#: ../../c-api/memory.rst:728 msgid "The same code using the type-oriented function set::" msgstr "" -#: ../../c-api/memory.rst:718 +#: ../../c-api/memory.rst:730 msgid "" "PyObject *res;\n" "char *buf = PyMem_New(char, BUFSIZ); /* for I/O */\n" @@ -1089,7 +1107,7 @@ msgid "" "return res;" msgstr "" -#: ../../c-api/memory.rst:728 +#: ../../c-api/memory.rst:740 msgid "" "Note that in the two examples above, the buffer is always manipulated via " "functions belonging to the same set. Indeed, it is required to use the same " @@ -1099,7 +1117,7 @@ msgid "" "different allocators operating on different heaps. ::" msgstr "" -#: ../../c-api/memory.rst:735 +#: ../../c-api/memory.rst:747 msgid "" "char *buf1 = PyMem_New(char, BUFSIZ);\n" "char *buf2 = (char *) malloc(BUFSIZ);\n" @@ -1110,14 +1128,14 @@ msgid "" "free(buf1); /* Fatal -- should be PyMem_Del() */" msgstr "" -#: ../../c-api/memory.rst:743 +#: ../../c-api/memory.rst:755 msgid "" "In addition to the functions aimed at handling raw memory blocks from the " "Python heap, objects in Python are allocated and released with :c:macro:" "`PyObject_New`, :c:macro:`PyObject_NewVar` and :c:func:`PyObject_Del`." msgstr "" -#: ../../c-api/memory.rst:747 +#: ../../c-api/memory.rst:759 msgid "" "These will be explained in the next chapter on defining and implementing new " "object types in C." diff --git a/c-api/module.po b/c-api/module.po index 3c990d4f27..cd977561d1 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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-" @@ -50,7 +50,7 @@ msgid "" msgstr "" #: ../../c-api/module.rst:46 ../../c-api/module.rst:270 -#: ../../c-api/module.rst:445 +#: ../../c-api/module.rst:470 msgid "Return ``NULL`` with an exception set on error." msgstr "在失敗時回傳 ``NULL`` 並設定例外。" @@ -430,7 +430,7 @@ msgid "" "order they appear in the *m_slots* array." msgstr "" -#: ../../c-api/module.rst:389 +#: ../../c-api/module.rst:389 ../../c-api/module.rst:422 msgid "Specifies one of the following values:" msgstr "" @@ -468,15 +468,44 @@ msgid "" "defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED``." msgstr "" -#: ../../c-api/module.rst:420 +#: ../../c-api/module.rst:426 +msgid "" +"The module depends on the presence of the global interpreter lock (GIL), and " +"may access global state without synchronization." +msgstr "" + +#: ../../c-api/module.rst:431 +msgid "The module is safe to run without an active GIL." +msgstr "" + +#: ../../c-api/module.rst:433 +msgid "" +"This slot is ignored by Python builds not configured with :option:`--disable-" +"gil`. Otherwise, it determines whether or not importing this module will " +"cause the GIL to be automatically enabled. See :ref:`whatsnew313-free-" +"threaded-cpython` for more detail." +msgstr "" + +#: ../../c-api/module.rst:438 +msgid "" +"Multiple ``Py_mod_gil`` slots may not be specified in one module definition." +msgstr "" + +#: ../../c-api/module.rst:440 +msgid "" +"If ``Py_mod_gil`` is not specified, the import machinery defaults to " +"``Py_MOD_GIL_USED``." +msgstr "" + +#: ../../c-api/module.rst:445 msgid "See :PEP:`489` for more details on multi-phase initialization." msgstr "" -#: ../../c-api/module.rst:423 +#: ../../c-api/module.rst:448 msgid "Low-level module creation functions" msgstr "" -#: ../../c-api/module.rst:425 +#: ../../c-api/module.rst:450 msgid "" "The following functions are called under the hood when using multi-phase " "initialization. They can be used directly, for example when creating module " @@ -484,14 +513,14 @@ msgid "" "``PyModule_ExecDef`` must be called to fully initialize a module." msgstr "" -#: ../../c-api/module.rst:432 +#: ../../c-api/module.rst:457 msgid "" "Create a new module object, given the definition in *def* and the ModuleSpec " "*spec*. This behaves like :c:func:`PyModule_FromDefAndSpec2` with " "*module_api_version* set to :c:macro:`PYTHON_API_VERSION`." msgstr "" -#: ../../c-api/module.rst:440 +#: ../../c-api/module.rst:465 msgid "" "Create a new module object, given the definition in *def* and the ModuleSpec " "*spec*, assuming the API version *module_api_version*. If that version does " @@ -499,24 +528,24 @@ msgid "" "emitted." msgstr "" -#: ../../c-api/module.rst:449 +#: ../../c-api/module.rst:474 msgid "" "Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec` " "instead; only use this if you are sure you need it." msgstr "" -#: ../../c-api/module.rst:456 +#: ../../c-api/module.rst:481 msgid "Process any execution slots (:c:data:`Py_mod_exec`) given in *def*." msgstr "" -#: ../../c-api/module.rst:462 +#: ../../c-api/module.rst:487 msgid "" "Set the docstring for *module* to *docstring*. This function is called " "automatically when creating a module from ``PyModuleDef``, using either " "``PyModule_Create`` or ``PyModule_FromDefAndSpec``." msgstr "" -#: ../../c-api/module.rst:471 +#: ../../c-api/module.rst:496 msgid "" "Add the functions from the ``NULL`` terminated *functions* array to " "*module*. Refer to the :c:type:`PyMethodDef` documentation for details on " @@ -528,11 +557,11 @@ msgid "" "``PyModule_FromDefAndSpec``." msgstr "" -#: ../../c-api/module.rst:483 +#: ../../c-api/module.rst:508 msgid "Support functions" msgstr "支援的函式" -#: ../../c-api/module.rst:485 +#: ../../c-api/module.rst:510 msgid "" "The module initialization function (if using single phase initialization) or " "a function called from a module execution slot (if using multi-phase " @@ -540,28 +569,29 @@ msgid "" "module state:" msgstr "" -#: ../../c-api/module.rst:492 +#: ../../c-api/module.rst:517 msgid "" "Add an object to *module* as *name*. This is a convenience function which " "can be used from the module's initialization function." msgstr "" -#: ../../c-api/module.rst:495 +#: ../../c-api/module.rst:520 msgid "" "On success, return ``0``. On error, raise an exception and return ``-1``." msgstr "" -#: ../../c-api/module.rst:497 +#: ../../c-api/module.rst:522 msgid "" "Return ``-1`` if *value* is ``NULL``. It must be called with an exception " "raised in this case." msgstr "" -#: ../../c-api/module.rst:500 ../../c-api/module.rst:549 +#: ../../c-api/module.rst:525 ../../c-api/module.rst:572 +#: ../../c-api/module.rst:599 msgid "Example usage::" msgstr "用法範例: ::" -#: ../../c-api/module.rst:502 +#: ../../c-api/module.rst:527 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -587,13 +617,13 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:514 ../../c-api/module.rst:567 +#: ../../c-api/module.rst:539 msgid "" "The example can also be written without checking explicitly if *obj* is " "``NULL``::" msgstr "" -#: ../../c-api/module.rst:517 +#: ../../c-api/module.rst:542 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -613,80 +643,94 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:526 ../../c-api/module.rst:583 +#: ../../c-api/module.rst:551 msgid "" "Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this " "case, since *obj* can be ``NULL``." msgstr "" -#: ../../c-api/module.rst:534 +#: ../../c-api/module.rst:554 +msgid "" +"The number of different *name* strings passed to this function should be " +"kept small, usually by only using statically allocated strings as *name*. " +"For names that aren't known at compile time, prefer calling :c:func:" +"`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For more " +"details, see :c:func:`PyUnicode_InternFromString`, which may be used " +"internally to create a key object." +msgstr "" + +#: ../../c-api/module.rst:567 +msgid "" +"Similar to :c:func:`PyModule_AddObjectRef`, but \"steals\" a reference to " +"*value*. It can be called with a result of function that returns a new " +"reference without bothering to check its result or even saving it to a " +"variable." +msgstr "" + +#: ../../c-api/module.rst:574 +msgid "" +"if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n" +" goto error;\n" +"}" +msgstr "" + +#: ../../c-api/module.rst:583 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to " "*value* on success (if it returns ``0``)." msgstr "" -#: ../../c-api/module.rst:537 +#: ../../c-api/module.rst:586 msgid "" -"The new :c:func:`PyModule_AddObjectRef` function is recommended, since it is " -"easy to introduce reference leaks by misusing the :c:func:" -"`PyModule_AddObject` function." +"The new :c:func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions " +"are recommended, since it is easy to introduce reference leaks by misusing " +"the :c:func:`PyModule_AddObject` function." msgstr "" -#: ../../c-api/module.rst:543 +#: ../../c-api/module.rst:593 msgid "" "Unlike other functions that steal references, ``PyModule_AddObject()`` only " "releases the reference to *value* **on success**." msgstr "" -#: ../../c-api/module.rst:546 +#: ../../c-api/module.rst:596 msgid "" "This means that its return value must be checked, and calling code must :c:" -"func:`Py_DECREF` *value* manually on error." +"func:`Py_XDECREF` *value* manually on error." msgstr "" -#: ../../c-api/module.rst:551 +#: ../../c-api/module.rst:601 msgid "" -"static int\n" -"add_spam(PyObject *module, int value)\n" -"{\n" -" PyObject *obj = PyLong_FromLong(value);\n" -" if (obj == NULL) {\n" -" return -1;\n" -" }\n" -" if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" -" Py_DECREF(obj);\n" -" return -1;\n" -" }\n" -" // PyModule_AddObject() stole a reference to obj:\n" -" // Py_DECREF(obj) is not needed here\n" -" return 0;\n" -"}" +"PyObject *obj = PyBytes_FromString(value);\n" +"if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" +" // If 'obj' is not NULL and PyModule_AddObject() failed,\n" +" // 'obj' strong reference must be deleted with Py_XDECREF().\n" +" // If 'obj' is NULL, Py_XDECREF() does nothing.\n" +" Py_XDECREF(obj);\n" +" goto error;\n" +"}\n" +"// PyModule_AddObject() stole a reference to obj:\n" +"// Py_XDECREF(obj) is not needed here." msgstr "" -#: ../../c-api/module.rst:570 -msgid "" -"static int\n" -"add_spam(PyObject *module, int value)\n" -"{\n" -" PyObject *obj = PyLong_FromLong(value);\n" -" if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" -" Py_XDECREF(obj);\n" -" return -1;\n" -" }\n" -" // PyModule_AddObject() stole a reference to obj:\n" -" // Py_DECREF(obj) is not needed here\n" -" return 0;\n" -"}" +#: ../../c-api/module.rst:614 +msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`." msgstr "" -#: ../../c-api/module.rst:589 +#: ../../c-api/module.rst:619 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:596 +#: ../../c-api/module.rst:623 +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:629 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 " @@ -694,7 +738,14 @@ msgid "" "on success." msgstr "" -#: ../../c-api/module.rst:604 +#: ../../c-api/module.rst:634 +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:641 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 " @@ -702,11 +753,11 @@ msgid "" "with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:612 +#: ../../c-api/module.rst:649 msgid "Add a string constant to *module*." msgstr "" -#: ../../c-api/module.rst:616 +#: ../../c-api/module.rst:653 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 " @@ -714,25 +765,36 @@ msgid "" "``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:626 +#: ../../c-api/module.rst:663 +msgid "" +"Indicate that *module* does or does not support running without the global " +"interpreter lock (GIL), using one of the values from :c:macro:`Py_mod_gil`. " +"It must be called during *module*'s initialization function. If this " +"function is not called during module initialization, the import machinery " +"assumes the module does not support running without the GIL. This function " +"is only available in Python builds configured with :option:`--disable-gil`. " +"Return ``-1`` with an exception set on error, ``0`` on success." +msgstr "" + +#: ../../c-api/module.rst:676 msgid "Module lookup" msgstr "模組查找" -#: ../../c-api/module.rst:628 +#: ../../c-api/module.rst:678 msgid "" "Single-phase initialization creates singleton modules that can be looked up " "in the context of the current interpreter. This allows the module object to " "be retrieved later with only a reference to the module definition." msgstr "" -#: ../../c-api/module.rst:632 +#: ../../c-api/module.rst:682 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:637 +#: ../../c-api/module.rst:687 msgid "" "Returns the module object that was created from *def* for the current " "interpreter. This method requires that the module object has been attached " @@ -741,18 +803,18 @@ msgid "" "to the interpreter state yet, it returns ``NULL``." msgstr "" -#: ../../c-api/module.rst:644 +#: ../../c-api/module.rst:694 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:647 +#: ../../c-api/module.rst:697 msgid "Only effective on modules created using single-phase initialization." msgstr "" -#: ../../c-api/module.rst:649 +#: ../../c-api/module.rst:699 msgid "" "Python calls ``PyState_AddModule`` automatically after importing a module, " "so it is unnecessary (but harmless) to call it from module initialization " @@ -763,15 +825,15 @@ msgid "" "state updates)." msgstr "" -#: ../../c-api/module.rst:657 ../../c-api/module.rst:668 +#: ../../c-api/module.rst:707 ../../c-api/module.rst:718 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/module.rst:659 +#: ../../c-api/module.rst:709 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "成功時回傳 ``0``,在失敗時回傳 ``-1`` 並設定例外。" -#: ../../c-api/module.rst:665 +#: ../../c-api/module.rst:715 msgid "" "Removes the module object created from *def* from the interpreter state. " "Return ``-1`` with an exception set on error, ``0`` on success." diff --git a/c-api/monitoring.po b/c-api/monitoring.po new file mode 100644 index 0000000000..cd950f57fa --- /dev/null +++ b/c-api/monitoring.po @@ -0,0 +1,168 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../c-api/monitoring.rst:6 +msgid "Monitoring C API" +msgstr "" + +#: ../../c-api/monitoring.rst:8 +msgid "Added in version 3.13." +msgstr "" + +#: ../../c-api/monitoring.rst:10 +msgid "" +"An extension may need to interact with the event monitoring system. " +"Subscribing to events and registering callbacks can be done via the Python " +"API exposed in :mod:`sys.monitoring`." +msgstr "" + +#: ../../c-api/monitoring.rst:15 +msgid "Generating Execution Events" +msgstr "" + +#: ../../c-api/monitoring.rst:17 +msgid "" +"The functions below make it possible for an extension to fire monitoring " +"events as it emulates the execution of Python code. Each of these functions " +"accepts a ``PyMonitoringState`` struct which contains concise information " +"about the activation state of events, as well as the event arguments, which " +"include a ``PyObject*`` representing the code object, the instruction offset " +"and sometimes additional, event-specific arguments (see :mod:`sys." +"monitoring` for details about the signatures of the different event " +"callbacks). The ``codelike`` argument should be an instance of :class:`types." +"CodeType` or of a type that emulates it." +msgstr "" + +#: ../../c-api/monitoring.rst:27 +msgid "" +"The VM disables tracing when firing an event, so there is no need for user " +"code to do that." +msgstr "" + +#: ../../c-api/monitoring.rst:30 +msgid "" +"Monitoring functions should not be called with an exception set, except " +"those listed below as working with the current exception." +msgstr "" + +#: ../../c-api/monitoring.rst:35 +msgid "" +"Representation of the state of an event type. It is allocated by the user " +"while its contents are maintained by the monitoring API functions described " +"below." +msgstr "" + +#: ../../c-api/monitoring.rst:39 +msgid "" +"All of the functions below return 0 on success and -1 (with an exception " +"set) on error." +msgstr "" + +#: ../../c-api/monitoring.rst:41 +msgid "See :mod:`sys.monitoring` for descriptions of the events." +msgstr "" + +#: ../../c-api/monitoring.rst:45 +msgid "Fire a ``PY_START`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:50 +msgid "Fire a ``PY_RESUME`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:55 +msgid "Fire a ``PY_RETURN`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:60 +msgid "Fire a ``PY_YIELD`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:65 +msgid "Fire a ``CALL`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:70 +msgid "Fire a ``LINE`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:75 +msgid "Fire a ``JUMP`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:80 +msgid "Fire a ``BRANCH`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:85 +msgid "Fire a ``C_RETURN`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:90 +msgid "" +"Fire a ``PY_THROW`` event with the current exception (as returned by :c:func:" +"`PyErr_GetRaisedException`)." +msgstr "" + +#: ../../c-api/monitoring.rst:96 +msgid "" +"Fire a ``RAISE`` event with the current exception (as returned by :c:func:" +"`PyErr_GetRaisedException`)." +msgstr "" + +#: ../../c-api/monitoring.rst:102 +msgid "" +"Fire a ``C_RAISE`` event with the current exception (as returned by :c:func:" +"`PyErr_GetRaisedException`)." +msgstr "" + +#: ../../c-api/monitoring.rst:108 +msgid "" +"Fire a ``RERAISE`` event with the current exception (as returned by :c:func:" +"`PyErr_GetRaisedException`)." +msgstr "" + +#: ../../c-api/monitoring.rst:114 +msgid "" +"Fire an ``EXCEPTION_HANDLED`` event with the current exception (as returned " +"by :c:func:`PyErr_GetRaisedException`)." +msgstr "" + +#: ../../c-api/monitoring.rst:120 +msgid "" +"Fire a ``PY_UNWIND`` event with the current exception (as returned by :c:" +"func:`PyErr_GetRaisedException`)." +msgstr "" + +#: ../../c-api/monitoring.rst:126 +msgid "" +"Fire a ``STOP_ITERATION`` event. If ``value`` is an instance of :exc:" +"`StopIteration`, it is used. Otherwise, a new :exc:`StopIteration` instance " +"is created with ``value`` as its argument." +msgstr "" + +#: ../../c-api/monitoring.rst:131 +msgid "Managing the Monitoring State" +msgstr "" + +#: ../../c-api/monitoring.rst:133 +msgid "" +"Monitoring states can be managed with the help of monitoring scopes. A scope " +"would typically correspond to a python function." +msgstr "" diff --git a/c-api/none.po b/c-api/none.po index 2d9800c5f1..eb714cd111 100644 --- a/c-api/none.po +++ b/c-api/none.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-29 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,11 +34,12 @@ msgstr "" #: ../../c-api/none.rst:18 msgid "" "The Python ``None`` object, denoting lack of value. This object has no " -"methods and is `immortal `_." +"methods and is :term:`immortal`." msgstr "" #: ../../c-api/none.rst:21 -msgid ":c:data:`Py_None` is immortal." +#, fuzzy +msgid ":c:data:`Py_None` is :term:`immortal`." msgstr ":c:data:`Py_None` 為不滅的 (immortal)。" #: ../../c-api/none.rst:26 diff --git a/c-api/object.po b/c-api/object.po index e0f8e16f9f..a672a4c44f 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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-" @@ -23,26 +23,149 @@ msgid "Object Protocol" msgstr "物件協定" #: ../../c-api/object.rst:11 +msgid "Get a :term:`strong reference` to a constant." +msgstr "" + +#: ../../c-api/object.rst:13 +msgid "Set an exception and return ``NULL`` if *constant_id* is invalid." +msgstr "" + +#: ../../c-api/object.rst:15 +msgid "*constant_id* must be one of these constant identifiers:" +msgstr "" + +#: ../../c-api/object.rst:20 +msgid "Constant Identifier" +msgstr "" + +#: ../../c-api/object.rst:20 +msgid "Value" +msgstr "" + +#: ../../c-api/object.rst:20 +msgid "Returned object" +msgstr "" + +#: ../../c-api/object.rst:22 ../../c-api/object.rst:27 +msgid "``0``" +msgstr "" + +#: ../../c-api/object.rst:22 +msgid ":py:data:`None`" +msgstr "" + +#: ../../c-api/object.rst:23 ../../c-api/object.rst:28 +msgid "``1``" +msgstr "" + +#: ../../c-api/object.rst:23 +msgid ":py:data:`False`" +msgstr "" + +#: ../../c-api/object.rst:24 +msgid "``2``" +msgstr "" + +#: ../../c-api/object.rst:24 +msgid ":py:data:`True`" +msgstr "" + +#: ../../c-api/object.rst:25 +msgid "``3``" +msgstr "" + +#: ../../c-api/object.rst:25 +msgid ":py:data:`Ellipsis`" +msgstr "" + +#: ../../c-api/object.rst:26 +msgid "``4``" +msgstr "" + +#: ../../c-api/object.rst:26 +msgid ":py:data:`NotImplemented`" +msgstr "" + +#: ../../c-api/object.rst:27 +msgid "``5``" +msgstr "" + +#: ../../c-api/object.rst:28 +msgid "``6``" +msgstr "" + +#: ../../c-api/object.rst:29 +msgid "``7``" +msgstr "" + +#: ../../c-api/object.rst:29 +msgid "``''``" +msgstr "" + +#: ../../c-api/object.rst:30 +msgid "``8``" +msgstr "" + +#: ../../c-api/object.rst:30 +msgid "``b''``" +msgstr "" + +#: ../../c-api/object.rst:31 +msgid "``9``" +msgstr "" + +#: ../../c-api/object.rst:31 +msgid "``()``" +msgstr "" + +#: ../../c-api/object.rst:34 +msgid "" +"Numeric values are only given for projects which cannot use the constant " +"identifiers." +msgstr "" + +#: ../../c-api/object.rst:42 +msgid "In CPython, all of these constants are :term:`immortal`." +msgstr "" + +#: ../../c-api/object.rst:47 +msgid "" +"Similar to :c:func:`Py_GetConstant`, but return a :term:`borrowed reference`." +msgstr "" + +#: ../../c-api/object.rst:50 +msgid "" +"This function is primarily intended for backwards compatibility: using :c:" +"func:`Py_GetConstant` is recommended for new code." +msgstr "" + +#: ../../c-api/object.rst:53 +msgid "" +"The reference is borrowed from the interpreter, and is valid until the " +"interpreter finalization." +msgstr "" + +#: ../../c-api/object.rst:61 msgid "" "The ``NotImplemented`` singleton, used to signal that an operation is not " "implemented for the given type combination." msgstr "" -#: ../../c-api/object.rst:17 +#: ../../c-api/object.rst:67 msgid "" "Properly handle returning :c:data:`Py_NotImplemented` from within a C " "function (that is, create a new :term:`strong reference` to :const:" "`NotImplemented` and return it)." msgstr "" -#: ../../c-api/object.rst:24 +#: ../../c-api/object.rst:74 msgid "" "Flag to be used with multiple functions that print the object (like :c:func:" "`PyObject_Print` and :c:func:`PyFile_WriteObject`). If passed, these " "function would use the :func:`str` of the object instead of the :func:`repr`." msgstr "" -#: ../../c-api/object.rst:32 +#: ../../c-api/object.rst:82 msgid "" "Print an object *o*, on file *fp*. Returns ``-1`` on error. The flags " "argument is used to enable certain printing options. The only option " @@ -50,50 +173,99 @@ msgid "" "the object is written instead of the :func:`repr`." msgstr "" -#: ../../c-api/object.rst:40 +#: ../../c-api/object.rst:90 +msgid "" +"Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. " +"This is equivalent to the Python expression ``hasattr(o, attr_name)``. On " +"failure, return ``-1``." +msgstr "" + +#: ../../c-api/object.rst:99 msgid "" -"Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. " -"This is equivalent to the Python expression ``hasattr(o, attr_name)``. This " -"function always succeeds." +"This is the same as :c:func:`PyObject_HasAttrWithError`, but *attr_name* is " +"specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" -#: ../../c-api/object.rst:46 +#: ../../c-api/object.rst:108 +msgid "" +"Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. " +"This function always succeeds." +msgstr "" + +#: ../../c-api/object.rst:113 msgid "" "Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" "`~object.__getattribute__` methods are silently ignored. For proper error " -"handling, use :c:func:`PyObject_GetAttr` instead." +"handling, use :c:func:`PyObject_HasAttrWithError`, :c:func:" +"`PyObject_GetOptionalAttr` or :c:func:`PyObject_GetAttr` instead." msgstr "" -#: ../../c-api/object.rst:53 +#: ../../c-api/object.rst:121 msgid "" "This is the same as :c:func:`PyObject_HasAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/object.rst:59 +#: ../../c-api/object.rst:127 msgid "" "Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" "`~object.__getattribute__` methods or while creating the temporary :class:" "`str` object are silently ignored. For proper error handling, use :c:func:" -"`PyObject_GetAttrString` instead." +"`PyObject_HasAttrStringWithError`, :c:func:`PyObject_GetOptionalAttrString` " +"or :c:func:`PyObject_GetAttrString` instead." msgstr "" -#: ../../c-api/object.rst:67 +#: ../../c-api/object.rst:137 msgid "" "Retrieve an attribute named *attr_name* from object *o*. Returns the " "attribute value on success, or ``NULL`` on failure. This is the equivalent " "of the Python expression ``o.attr_name``." msgstr "" -#: ../../c-api/object.rst:74 +#: ../../c-api/object.rst:141 +msgid "" +"If the missing attribute should not be treated as a failure, you can use :c:" +"func:`PyObject_GetOptionalAttr` instead." +msgstr "" + +#: ../../c-api/object.rst:147 msgid "" "This is the same as :c:func:`PyObject_GetAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/object.rst:81 +#: ../../c-api/object.rst:151 +msgid "" +"If the missing attribute should not be treated as a failure, you can use :c:" +"func:`PyObject_GetOptionalAttrString` instead." +msgstr "" + +#: ../../c-api/object.rst:157 +msgid "" +"Variant of :c:func:`PyObject_GetAttr` which doesn't raise :exc:" +"`AttributeError` if the attribute is not found." +msgstr "" + +#: ../../c-api/object.rst:160 +msgid "" +"If the attribute is found, return ``1`` and set *\\*result* to a new :term:" +"`strong reference` to the attribute. If the attribute is not found, return " +"``0`` and set *\\*result* to ``NULL``; the :exc:`AttributeError` is " +"silenced. If an error other than :exc:`AttributeError` is raised, return " +"``-1`` and set *\\*result* to ``NULL``." +msgstr "" + +#: ../../c-api/object.rst:172 +msgid "" +"This is the same as :c:func:`PyObject_GetOptionalAttr`, but *attr_name* is " +"specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." +msgstr "" + +#: ../../c-api/object.rst:180 msgid "" "Generic attribute getter function that is meant to be put into a type " "object's ``tp_getattro`` slot. It looks for a descriptor in the dictionary " @@ -103,34 +275,44 @@ msgid "" "descriptors don't. Otherwise, an :exc:`AttributeError` is raised." msgstr "" -#: ../../c-api/object.rst:91 +#: ../../c-api/object.rst:190 msgid "" "Set the value of the attribute named *attr_name*, for object *o*, to the " "value *v*. Raise an exception and return ``-1`` on failure; return ``0`` on " "success. This is the equivalent of the Python statement ``o.attr_name = v``." msgstr "" -#: ../../c-api/object.rst:96 +#: ../../c-api/object.rst:195 msgid "" "If *v* is ``NULL``, the attribute is deleted. This behaviour is deprecated " "in favour of using :c:func:`PyObject_DelAttr`, but there are currently no " "plans to remove it." msgstr "" -#: ../../c-api/object.rst:103 +#: ../../c-api/object.rst:202 msgid "" "This is the same as :c:func:`PyObject_SetAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/object.rst:107 +#: ../../c-api/object.rst:206 msgid "" "If *v* is ``NULL``, the attribute is deleted, but this feature is deprecated " "in favour of using :c:func:`PyObject_DelAttrString`." msgstr "" -#: ../../c-api/object.rst:113 +#: ../../c-api/object.rst:209 +msgid "" +"The number of different attribute names passed to this function should be " +"kept small, usually by using a statically allocated string as *attr_name*. " +"For attribute names that aren't known at compile time, prefer calling :c:" +"func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For " +"more details, see :c:func:`PyUnicode_InternFromString`, which may be used " +"internally to create a key object." +msgstr "" + +#: ../../c-api/object.rst:219 msgid "" "Generic attribute setter and deleter function that is meant to be put into a " "type object's :c:member:`~PyTypeObject.tp_setattro` slot. It looks for a " @@ -142,26 +324,36 @@ msgid "" "returned." msgstr "" -#: ../../c-api/object.rst:125 +#: ../../c-api/object.rst:231 msgid "" "Delete attribute named *attr_name*, for object *o*. Returns ``-1`` on " "failure. This is the equivalent of the Python statement ``del o.attr_name``." msgstr "" -#: ../../c-api/object.rst:131 +#: ../../c-api/object.rst:237 msgid "" "This is the same as :c:func:`PyObject_DelAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/object.rst:138 +#: ../../c-api/object.rst:241 +msgid "" +"The number of different attribute names passed to this function should be " +"kept small, usually by using a statically allocated string as *attr_name*. " +"For attribute names that aren't known at compile time, prefer calling :c:" +"func:`PyUnicode_FromString` and :c:func:`PyObject_DelAttr` directly. For " +"more details, see :c:func:`PyUnicode_InternFromString`, which may be used " +"internally to create a key object for lookup." +msgstr "" + +#: ../../c-api/object.rst:252 msgid "" "A generic implementation for the getter of a ``__dict__`` descriptor. It " "creates the dictionary if necessary." msgstr "" -#: ../../c-api/object.rst:141 +#: ../../c-api/object.rst:255 msgid "" "This function may also be called to get the :py:attr:`~object.__dict__` of " "the object *o*. Pass ``NULL`` for *context* when calling it. Since this " @@ -170,30 +362,30 @@ msgid "" "the object." msgstr "" -#: ../../c-api/object.rst:147 +#: ../../c-api/object.rst:261 msgid "On failure, returns ``NULL`` with an exception set." msgstr "在失敗時,會回傳 ``NULL`` 並設定例外。" -#: ../../c-api/object.rst:154 +#: ../../c-api/object.rst:268 msgid "" "A generic implementation for the setter of a ``__dict__`` descriptor. This " "implementation does not allow the dictionary to be deleted." msgstr "" -#: ../../c-api/object.rst:162 +#: ../../c-api/object.rst:276 msgid "" "Return a pointer to :py:attr:`~object.__dict__` of the object *obj*. If " "there is no ``__dict__``, return ``NULL`` without setting an exception." msgstr "" -#: ../../c-api/object.rst:165 +#: ../../c-api/object.rst:279 msgid "" "This function may need to allocate memory for the dictionary, so it may be " "more efficient to call :c:func:`PyObject_GetAttr` when accessing an " "attribute on the object." msgstr "" -#: ../../c-api/object.rst:172 +#: ../../c-api/object.rst:286 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " "which must be one of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`, :" @@ -204,33 +396,33 @@ msgid "" "success, or ``NULL`` on failure." msgstr "" -#: ../../c-api/object.rst:182 +#: ../../c-api/object.rst:296 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " "like :c:func:`PyObject_RichCompare`, but returns ``-1`` on error, ``0`` if " "the result is false, ``1`` otherwise." msgstr "" -#: ../../c-api/object.rst:187 +#: ../../c-api/object.rst:301 msgid "" "If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool` " "will always return ``1`` for :c:macro:`Py_EQ` and ``0`` for :c:macro:`Py_NE`." msgstr "" -#: ../../c-api/object.rst:192 +#: ../../c-api/object.rst:306 msgid "" "Format *obj* using *format_spec*. This is equivalent to the Python " "expression ``format(obj, format_spec)``." msgstr "" -#: ../../c-api/object.rst:195 +#: ../../c-api/object.rst:309 msgid "" "*format_spec* may be ``NULL``. In this case the call is equivalent to " "``format(obj)``. Returns the formatted string on success, ``NULL`` on " "failure." msgstr "" -#: ../../c-api/object.rst:203 +#: ../../c-api/object.rst:317 msgid "" "Compute a string representation of object *o*. Returns the string " "representation on success, ``NULL`` on failure. This is the equivalent of " @@ -238,13 +430,13 @@ msgid "" "function." msgstr "" -#: ../../c-api/object.rst:207 ../../c-api/object.rst:231 +#: ../../c-api/object.rst:321 ../../c-api/object.rst:345 msgid "" "This function now includes a debug assertion to help ensure that it does not " "silently discard an active exception." msgstr "" -#: ../../c-api/object.rst:215 +#: ../../c-api/object.rst:329 msgid "" "As :c:func:`PyObject_Repr`, compute a string representation of object *o*, " "but escape the non-ASCII characters in the string returned by :c:func:" @@ -253,7 +445,7 @@ msgid "" "Called by the :func:`ascii` built-in function." msgstr "" -#: ../../c-api/object.rst:226 +#: ../../c-api/object.rst:340 msgid "" "Compute a string representation of object *o*. Returns the string " "representation on success, ``NULL`` on failure. This is the equivalent of " @@ -261,7 +453,7 @@ msgid "" "function and, therefore, by the :func:`print` function." msgstr "" -#: ../../c-api/object.rst:240 +#: ../../c-api/object.rst:354 msgid "" "Compute a bytes representation of object *o*. ``NULL`` is returned on " "failure and a bytes object on success. This is equivalent to the Python " @@ -270,20 +462,20 @@ msgid "" "bytes object." msgstr "" -#: ../../c-api/object.rst:249 +#: ../../c-api/object.rst:363 msgid "" "Return ``1`` if the class *derived* is identical to or derived from the " "class *cls*, otherwise return ``0``. In case of an error, return ``-1``." msgstr "" -#: ../../c-api/object.rst:252 ../../c-api/object.rst:271 +#: ../../c-api/object.rst:366 ../../c-api/object.rst:385 msgid "" "If *cls* is a tuple, the check will be done against every entry in *cls*. " "The result will be ``1`` when at least one of the checks returns ``1``, " "otherwise it will be ``0``." msgstr "" -#: ../../c-api/object.rst:256 +#: ../../c-api/object.rst:370 msgid "" "If *cls* has a :meth:`~class.__subclasscheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " @@ -291,52 +483,52 @@ msgid "" "e. contained in ``cls.__mro__``." msgstr "" -#: ../../c-api/object.rst:261 +#: ../../c-api/object.rst:375 msgid "" "Normally only class objects, i.e. instances of :class:`type` or a derived " "class, are considered classes. However, objects can override this by having " "a :attr:`~class.__bases__` attribute (which must be a tuple of base classes)." msgstr "" -#: ../../c-api/object.rst:268 +#: ../../c-api/object.rst:382 msgid "" "Return ``1`` if *inst* is an instance of the class *cls* or a subclass of " "*cls*, or ``0`` if not. On error, returns ``-1`` and sets an exception." msgstr "" -#: ../../c-api/object.rst:275 +#: ../../c-api/object.rst:389 msgid "" "If *cls* has a :meth:`~class.__instancecheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " "*inst* is an instance of *cls* if its class is a subclass of *cls*." msgstr "" -#: ../../c-api/object.rst:279 +#: ../../c-api/object.rst:393 msgid "" "An instance *inst* can override what is considered its class by having a :" "attr:`~instance.__class__` attribute." msgstr "" -#: ../../c-api/object.rst:282 +#: ../../c-api/object.rst:396 msgid "" "An object *cls* can override if it is considered a class, and what its base " "classes are, by having a :attr:`~class.__bases__` attribute (which must be a " "tuple of base classes)." msgstr "" -#: ../../c-api/object.rst:291 +#: ../../c-api/object.rst:405 msgid "" "Compute and return the hash value of an object *o*. On failure, return " "``-1``. This is the equivalent of the Python expression ``hash(o)``." msgstr "" -#: ../../c-api/object.rst:294 +#: ../../c-api/object.rst:408 msgid "" "The return type is now Py_hash_t. This is a signed integer the same size " "as :c:type:`Py_ssize_t`." msgstr "" -#: ../../c-api/object.rst:301 +#: ../../c-api/object.rst:415 msgid "" "Set a :exc:`TypeError` indicating that ``type(o)`` is not :term:`hashable` " "and return ``-1``. This function receives special treatment when stored in a " @@ -344,21 +536,21 @@ msgid "" "that it is not hashable." msgstr "" -#: ../../c-api/object.rst:309 +#: ../../c-api/object.rst:423 msgid "" "Returns ``1`` if the object *o* is considered to be true, and ``0`` " "otherwise. This is equivalent to the Python expression ``not not o``. On " "failure, return ``-1``." msgstr "" -#: ../../c-api/object.rst:316 +#: ../../c-api/object.rst:430 msgid "" "Returns ``0`` if the object *o* is considered to be true, and ``1`` " "otherwise. This is equivalent to the Python expression ``not o``. On " "failure, return ``-1``." msgstr "" -#: ../../c-api/object.rst:325 +#: ../../c-api/object.rst:439 msgid "" "When *o* is non-``NULL``, returns a type object corresponding to the object " "type of object *o*. On failure, raises :exc:`SystemError` and returns " @@ -369,13 +561,13 @@ msgid "" "when a new :term:`strong reference` is needed." msgstr "" -#: ../../c-api/object.rst:337 +#: ../../c-api/object.rst:451 msgid "" "Return non-zero if the object *o* is of type *type* or a subtype of *type*, " "and ``0`` otherwise. Both parameters must be non-``NULL``." msgstr "" -#: ../../c-api/object.rst:346 +#: ../../c-api/object.rst:460 msgid "" "Return the length of object *o*. If the object *o* provides either the " "sequence and mapping protocols, the sequence length is returned. On error, " @@ -383,7 +575,7 @@ msgid "" "``len(o)``." msgstr "" -#: ../../c-api/object.rst:353 +#: ../../c-api/object.rst:467 msgid "" "Return an estimated length for the object *o*. First try to return its " "actual length, then an estimate using :meth:`~object.__length_hint__`, and " @@ -392,26 +584,26 @@ msgid "" "defaultvalue)``." msgstr "" -#: ../../c-api/object.rst:363 +#: ../../c-api/object.rst:477 msgid "" "Return element of *o* corresponding to the object *key* or ``NULL`` on " "failure. This is the equivalent of the Python expression ``o[key]``." msgstr "" -#: ../../c-api/object.rst:369 +#: ../../c-api/object.rst:483 msgid "" "Map the object *key* to the value *v*. Raise an exception and return ``-1`` " "on failure; return ``0`` on success. This is the equivalent of the Python " "statement ``o[key] = v``. This function *does not* steal a reference to *v*." msgstr "" -#: ../../c-api/object.rst:377 +#: ../../c-api/object.rst:491 msgid "" "Remove the mapping for the object *key* from the object *o*. Return ``-1`` " "on failure. This is equivalent to the Python statement ``del o[key]``." msgstr "" -#: ../../c-api/object.rst:383 +#: ../../c-api/object.rst:497 msgid "" "This is equivalent to the Python expression ``dir(o)``, returning a " "(possibly empty) list of strings appropriate for the object argument, or " @@ -421,7 +613,7 @@ msgid "" "`PyErr_Occurred` will return false." msgstr "" -#: ../../c-api/object.rst:392 +#: ../../c-api/object.rst:506 msgid "" "This is equivalent to the Python expression ``iter(o)``. It returns a new " "iterator for the object argument, or the object itself if the object is " @@ -429,7 +621,7 @@ msgid "" "object cannot be iterated." msgstr "" -#: ../../c-api/object.rst:400 +#: ../../c-api/object.rst:514 msgid "" "This is the equivalent to the Python expression ``aiter(o)``. Takes an :" "class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it. " @@ -438,90 +630,104 @@ msgid "" "``NULL`` if the object cannot be iterated." msgstr "" -#: ../../c-api/object.rst:410 +#: ../../c-api/object.rst:524 msgid "Get a pointer to subclass-specific data reserved for *cls*." msgstr "" -#: ../../c-api/object.rst:412 +#: ../../c-api/object.rst:526 msgid "" "The object *o* must be an instance of *cls*, and *cls* must have been " "created using negative :c:member:`PyType_Spec.basicsize`. Python does not " "check this." msgstr "" -#: ../../c-api/object.rst:416 +#: ../../c-api/object.rst:530 msgid "On error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/object.rst:422 +#: ../../c-api/object.rst:536 msgid "" "Return the size of the instance memory space reserved for *cls*, i.e. the " "size of the memory :c:func:`PyObject_GetTypeData` returns." msgstr "" -#: ../../c-api/object.rst:425 +#: ../../c-api/object.rst:539 msgid "" "This may be larger than requested using :c:member:`-PyType_Spec.basicsize " "`; it is safe to use this larger size (e.g. with :c:" "func:`!memset`)." msgstr "" -#: ../../c-api/object.rst:428 +#: ../../c-api/object.rst:542 msgid "" "The type *cls* **must** have been created using negative :c:member:" "`PyType_Spec.basicsize`. Python does not check this." msgstr "" -#: ../../c-api/object.rst:432 +#: ../../c-api/object.rst:546 msgid "On error, set an exception and return a negative value." msgstr "" -#: ../../c-api/object.rst:438 +#: ../../c-api/object.rst:552 msgid "" "Get a pointer to per-item data for a class with :c:macro:" "`Py_TPFLAGS_ITEMS_AT_END`." msgstr "" -#: ../../c-api/object.rst:441 +#: ../../c-api/object.rst:555 msgid "" "On error, set an exception and return ``NULL``. :py:exc:`TypeError` is " "raised if *o* does not have :c:macro:`Py_TPFLAGS_ITEMS_AT_END` set." msgstr "" -#: ../../c-api/object.rst:201 ../../c-api/object.rst:213 -#: ../../c-api/object.rst:238 ../../c-api/object.rst:289 -#: ../../c-api/object.rst:323 ../../c-api/object.rst:344 +#: ../../c-api/object.rst:563 +msgid "Visit the managed dictionary of *obj*." +msgstr "" + +#: ../../c-api/object.rst:565 ../../c-api/object.rst:574 +msgid "" +"This function must only be called in a traverse function of the type which " +"has the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." +msgstr "" + +#: ../../c-api/object.rst:572 +msgid "Clear the managed dictionary of *obj*." +msgstr "" + +#: ../../c-api/object.rst:315 ../../c-api/object.rst:327 +#: ../../c-api/object.rst:352 ../../c-api/object.rst:403 +#: ../../c-api/object.rst:437 ../../c-api/object.rst:458 msgid "built-in function" msgstr "bulit-in function(內建函式)" -#: ../../c-api/object.rst:201 +#: ../../c-api/object.rst:315 msgid "repr" msgstr "repr" -#: ../../c-api/object.rst:213 +#: ../../c-api/object.rst:327 msgid "ascii" msgstr "ascii" -#: ../../c-api/object.rst:221 +#: ../../c-api/object.rst:335 msgid "string" msgstr "string(字串)" -#: ../../c-api/object.rst:221 +#: ../../c-api/object.rst:335 msgid "PyObject_Str (C function)" msgstr "PyObject_Str(C 函式)" -#: ../../c-api/object.rst:238 +#: ../../c-api/object.rst:352 msgid "bytes" msgstr "bytes(位元組)" -#: ../../c-api/object.rst:289 +#: ../../c-api/object.rst:403 msgid "hash" msgstr "hash(雜湊)" -#: ../../c-api/object.rst:323 +#: ../../c-api/object.rst:437 msgid "type" msgstr "type(型別)" -#: ../../c-api/object.rst:344 +#: ../../c-api/object.rst:458 msgid "len" msgstr "len" diff --git a/c-api/refcounting.po b/c-api/refcounting.po index a2ff320cd7..4f44c6bec2 100644 --- a/c-api/refcounting.po +++ b/c-api/refcounting.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-08-06 14:19+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,12 +35,13 @@ msgid "Get the reference count of the Python object *o*." msgstr "取得物件 *o* 的參照計數。" #: ../../c-api/refcounting.rst:18 +#, fuzzy msgid "" "Note that the returned value may not actually reflect how many references to " -"the object are actually held. For example, some objects are \"immortal\" " -"and have a very high refcount that does not reflect the actual number of " -"references. Consequently, do not rely on the returned value to be accurate, " -"other than a value of 0 or 1." +"the object are actually held. For example, some objects are :term:" +"`immortal` and have a very high refcount that does not reflect the actual " +"number of references. Consequently, do not rely on the returned value to be " +"accurate, other than a value of 0 or 1." msgstr "" "請注意,回傳的值可能實際上並不反映實際保存了多少對該物件的參照。例如,某些物" "件是「不滅的 (immortal)」,並且具有非常高的參照計數,不能反映實際的參照數量。" @@ -65,18 +66,24 @@ msgstr "設定物件 *o* 的參照計數。" #: ../../c-api/refcounting.rst:37 msgid "" -"Note that this function has no effect on `immortal `_ objects." +"On :ref:`Python build with Free Threading `, if " +"*refcnt* is larger than ``UINT32_MAX``, the object is made :term:`immortal`." +msgstr "" + +#: ../../c-api/refcounting.rst:40 ../../c-api/refcounting.rst:53 +#: ../../c-api/refcounting.rst:119 +#, fuzzy +msgid "This function has no effect on :term:`immortal` objects." msgstr "" "請注意,此函式對\\ `不滅的 `_\\ 物件沒有影" "響。" -#: ../../c-api/refcounting.rst:43 ../../c-api/refcounting.rst:65 -#: ../../c-api/refcounting.rst:142 +#: ../../c-api/refcounting.rst:44 ../../c-api/refcounting.rst:68 +#: ../../c-api/refcounting.rst:147 msgid "Immortal objects are not modified." msgstr "不滅的物件不會被修改。" -#: ../../c-api/refcounting.rst:49 +#: ../../c-api/refcounting.rst:50 msgid "" "Indicate taking a new :term:`strong reference` to object *o*, indicating it " "is in use and should not be destroyed." @@ -84,7 +91,7 @@ msgstr "" "代表取得對於物件 *o* 的新\\ :term:`強參照 `,即它正在使用且" "不應被銷毀。" -#: ../../c-api/refcounting.rst:52 +#: ../../c-api/refcounting.rst:55 msgid "" "This function is usually used to convert a :term:`borrowed reference` to a :" "term:`strong reference` in-place. The :c:func:`Py_NewRef` function can be " @@ -94,11 +101,12 @@ msgstr "" "換為\\ :term:`強參照 `。:c:func:`Py_NewRef` 函式可用於建立" "新的\\ :term:`強參照 `。" -#: ../../c-api/refcounting.rst:56 -msgid "When done using the object, release it by calling :c:func:`Py_DECREF`." +#: ../../c-api/refcounting.rst:59 +#, fuzzy +msgid "When done using the object, release is by calling :c:func:`Py_DECREF`." msgstr "使用完該物件後,透過呼叫 :c:func:`Py_DECREF` 來釋放它。" -#: ../../c-api/refcounting.rst:58 +#: ../../c-api/refcounting.rst:61 msgid "" "The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, " "use :c:func:`Py_XINCREF`." @@ -106,15 +114,17 @@ msgstr "" "該物件不能為 ``NULL``;如果你不確定它不是 ``NULL``,請使用 :c:func:" "`Py_XINCREF`。" -#: ../../c-api/refcounting.rst:61 +#: ../../c-api/refcounting.rst:64 ../../c-api/refcounting.rst:132 +#, fuzzy msgid "" -"Do not expect this function to actually modify *o* in any way. For at least :" -"pep:`some objects <0683>`, this function has no effect." +"Do not expect this function to actually modify *o* in any way. For at least " +"`some objects `_, this function has no " +"effect." msgstr "" "不要期望此函式會以任何方式實際修改 *o*,至少對於\\ :pep:`某些物件 <0683>`\\ " "來說,此函式沒有任何效果。" -#: ../../c-api/refcounting.rst:71 +#: ../../c-api/refcounting.rst:74 msgid "" "Similar to :c:func:`Py_INCREF`, but the object *o* can be ``NULL``, in which " "case this has no effect." @@ -122,11 +132,11 @@ msgstr "" "與 :c:func:`Py_INCREF` 類似,但物件 *o* 可以為 ``NULL``,在這種情況下這就不會" "有任何效果。" -#: ../../c-api/refcounting.rst:74 +#: ../../c-api/refcounting.rst:77 msgid "See also :c:func:`Py_XNewRef`." msgstr "另請見 :c:func:`Py_XNewRef`。" -#: ../../c-api/refcounting.rst:79 +#: ../../c-api/refcounting.rst:82 msgid "" "Create a new :term:`strong reference` to an object: call :c:func:`Py_INCREF` " "on *o* and return the object *o*." @@ -134,7 +144,7 @@ msgstr "" "建立對物件的新\\ :term:`強參照 `:於 *o* 呼叫 :c:func:" "`Py_INCREF` 並回傳物件 *o*。" -#: ../../c-api/refcounting.rst:82 +#: ../../c-api/refcounting.rst:85 msgid "" "When the :term:`strong reference` is no longer needed, :c:func:`Py_DECREF` " "should be called on it to release the reference." @@ -142,7 +152,7 @@ msgstr "" "當不再需要\\ :term:`強參照 `\\ 時,應對其呼叫 :c:func:" "`Py_DECREF` 以釋放該參照。" -#: ../../c-api/refcounting.rst:85 +#: ../../c-api/refcounting.rst:88 msgid "" "The object *o* must not be ``NULL``; use :c:func:`Py_XNewRef` if *o* can be " "``NULL``." @@ -150,11 +160,11 @@ msgstr "" "物件 *o* 不能為 ``NULL``;如果 *o* 可以為 ``NULL``,則使用 :c:func:" "`Py_XNewRef`。" -#: ../../c-api/refcounting.rst:88 +#: ../../c-api/refcounting.rst:91 msgid "For example::" msgstr "舉例來說: ::" -#: ../../c-api/refcounting.rst:90 +#: ../../c-api/refcounting.rst:93 msgid "" "Py_INCREF(obj);\n" "self->attr = obj;" @@ -162,27 +172,27 @@ msgstr "" "Py_INCREF(obj);\n" "self->attr = obj;" -#: ../../c-api/refcounting.rst:93 +#: ../../c-api/refcounting.rst:96 msgid "can be written as::" msgstr "可以寫成: ::" -#: ../../c-api/refcounting.rst:95 +#: ../../c-api/refcounting.rst:98 msgid "self->attr = Py_NewRef(obj);" msgstr "self->attr = Py_NewRef(obj);" -#: ../../c-api/refcounting.rst:97 +#: ../../c-api/refcounting.rst:100 msgid "See also :c:func:`Py_INCREF`." msgstr "另請參閱 :c:func:`Py_INCREF`。" -#: ../../c-api/refcounting.rst:104 +#: ../../c-api/refcounting.rst:107 msgid "Similar to :c:func:`Py_NewRef`, but the object *o* can be NULL." msgstr "與 :c:func:`Py_NewRef` 類似,但物件 *o* 可以為 NULL。" -#: ../../c-api/refcounting.rst:106 +#: ../../c-api/refcounting.rst:109 msgid "If the object *o* is ``NULL``, the function just returns ``NULL``." msgstr "如果物件 *o* 為 ``NULL``,則該函式僅回傳 ``NULL``。" -#: ../../c-api/refcounting.rst:113 +#: ../../c-api/refcounting.rst:116 msgid "" "Release a :term:`strong reference` to object *o*, indicating the reference " "is no longer used." @@ -190,7 +200,7 @@ msgstr "" "釋放一個對物件 *o* 的\\ :term:`強參照 `,代表該參照不會再被" "使用。" -#: ../../c-api/refcounting.rst:116 +#: ../../c-api/refcounting.rst:121 msgid "" "Once the last :term:`strong reference` is released (i.e. the object's " "reference count reaches 0), the object's type's deallocation function (which " @@ -200,14 +210,14 @@ msgstr "" "到零),則觸發物件之型別的釋放函式 (deallocation function)(不得為 " "``NULL``\\ )。" -#: ../../c-api/refcounting.rst:121 +#: ../../c-api/refcounting.rst:126 msgid "" "This function is usually used to delete a :term:`strong reference` before " "exiting its scope." msgstr "" "此函式通常用於在退出作用域之前刪除\\ :term:`強參照 `。" -#: ../../c-api/refcounting.rst:124 +#: ../../c-api/refcounting.rst:129 msgid "" "The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, " "use :c:func:`Py_XDECREF`." @@ -215,15 +225,7 @@ msgstr "" "該物件不能為 ``NULL``;如果你不確定它不是 ``NULL``,請改用 :c:func:" "`Py_XDECREF`。" -#: ../../c-api/refcounting.rst:127 -msgid "" -"Do not expect this function to actually modify *o* in any way. For at least :" -"pep:`some objects <683>`, this function has no effect." -msgstr "" -"不要期望此函式會以任何方式實際修改 *o*,至少對於\\ :pep:`某些物件 <683>`\\ 來" -"說,此函式沒有任何效果。" - -#: ../../c-api/refcounting.rst:133 +#: ../../c-api/refcounting.rst:138 msgid "" "The deallocation function can cause arbitrary Python code to be invoked (e." "g. when a class instance with a :meth:`~object.__del__` method is " @@ -242,7 +244,7 @@ msgstr "" "式碼應將已刪除物件的參照複製到臨時變數中,更新 list 資料結構,然後為臨時變數" "呼叫 :c:func:`Py_DECREF`。" -#: ../../c-api/refcounting.rst:148 +#: ../../c-api/refcounting.rst:153 msgid "" "Similar to :c:func:`Py_DECREF`, but the object *o* can be ``NULL``, in which " "case this has no effect. The same warning from :c:func:`Py_DECREF` applies " @@ -251,7 +253,7 @@ msgstr "" "和 :c:func:`Py_DECREF` 類似,但該物件可以是 ``NULL``,在這種情況下巨集不起作" "用。在這裡也會出現與 :c:func:`Py_DECREF` 相同的警告。" -#: ../../c-api/refcounting.rst:155 +#: ../../c-api/refcounting.rst:160 msgid "" "Release a :term:`strong reference` for object *o*. The object may be " "``NULL``, in which case the macro has no effect; otherwise the effect is the " @@ -265,7 +267,7 @@ msgstr "" "非引數也設定為 ``NULL``。:c:func:`Py_DECREF` 的警告不適用於傳遞的物件,因為巨" "集在釋放其參照之前小心地使用臨時變數並將引數設定為 ``NULL``。" -#: ../../c-api/refcounting.rst:163 +#: ../../c-api/refcounting.rst:168 msgid "" "It is a good idea to use this macro whenever releasing a reference to an " "object that might be traversed during garbage collection." @@ -273,7 +275,7 @@ msgstr "" "每當要釋放垃圾回收 (garbage collection) 期間可能被遍歷到之對於物件的參照時," "使用此巨集是個好主意。" -#: ../../c-api/refcounting.rst:166 +#: ../../c-api/refcounting.rst:171 msgid "" "The macro argument is now only evaluated once. If the argument has side " "effects, these are no longer duplicated." @@ -281,7 +283,7 @@ msgstr "" "巨集引數現在僅會被求值 (evaluate) 一次。如果引數有其他副作用,則不再重複作" "用。" -#: ../../c-api/refcounting.rst:173 +#: ../../c-api/refcounting.rst:178 msgid "" "Indicate taking a new :term:`strong reference` to object *o*. A function " "version of :c:func:`Py_XINCREF`. It can be used for runtime dynamic " @@ -290,7 +292,7 @@ msgstr "" "代表取得對於物件 *o* 的\\ :term:`強參照 `。:c:func:" "`Py_XINCREF` 的函式版本。它可用於 Python 的 runtime 動態嵌入。" -#: ../../c-api/refcounting.rst:180 +#: ../../c-api/refcounting.rst:185 msgid "" "Release a :term:`strong reference` to object *o*. A function version of :c:" "func:`Py_XDECREF`. It can be used for runtime dynamic embedding of Python." @@ -298,7 +300,7 @@ msgstr "" "釋放對物件 *o* 的\\ :term:`強參照 `。:c:func:`Py_XDECREF` " "的函式版本。它可用於 Python 的 runtime 動態嵌入。" -#: ../../c-api/refcounting.rst:187 +#: ../../c-api/refcounting.rst:192 msgid "" "Macro safely releasing a :term:`strong reference` to object *dst* and " "setting *dst* to *src*." @@ -306,11 +308,11 @@ msgstr "" "巨集安全地釋放對於物件 *dst* 的\\ :term:`強參照 `\\ 並將 " "*dst* 設定為 *src*。" -#: ../../c-api/refcounting.rst:190 +#: ../../c-api/refcounting.rst:195 msgid "As in case of :c:func:`Py_CLEAR`, \"the obvious\" code can be deadly::" msgstr "與 :c:func:`Py_CLEAR` 的情況一樣,「明顯的」程式碼可能是致命的: ::" -#: ../../c-api/refcounting.rst:192 +#: ../../c-api/refcounting.rst:197 msgid "" "Py_DECREF(dst);\n" "dst = src;" @@ -318,15 +320,15 @@ msgstr "" "Py_DECREF(dst);\n" "dst = src;" -#: ../../c-api/refcounting.rst:195 +#: ../../c-api/refcounting.rst:200 msgid "The safe way is::" msgstr "安全的方法是: ::" -#: ../../c-api/refcounting.rst:197 +#: ../../c-api/refcounting.rst:202 msgid "Py_SETREF(dst, src);" msgstr "Py_SETREF(dst, src);" -#: ../../c-api/refcounting.rst:199 +#: ../../c-api/refcounting.rst:204 msgid "" "That arranges to set *dst* to *src* _before_ releasing the reference to the " "old value of *dst*, so that any code triggered as a side-effect of *dst* " @@ -336,16 +338,23 @@ msgstr "" "被拆除而觸發的任何副作用 (side-effect) 之程式碼不會相信 *dst* 是指向一個有效" "物件。" -#: ../../c-api/refcounting.rst:206 ../../c-api/refcounting.rst:218 +#: ../../c-api/refcounting.rst:211 ../../c-api/refcounting.rst:223 msgid "" "The macro arguments are now only evaluated once. If an argument has side " "effects, these are no longer duplicated." msgstr "巨集引數現在僅會被求值一次。如果引數有其他副作用,則不再重複作用。" -#: ../../c-api/refcounting.rst:213 +#: ../../c-api/refcounting.rst:218 msgid "" "Variant of :c:macro:`Py_SETREF` macro that uses :c:func:`Py_XDECREF` instead " "of :c:func:`Py_DECREF`." msgstr "" ":c:macro:`Py_SETREF` 巨集的變體,請改用 :c:func:`Py_XDECREF` 而非 :c:func:" "`Py_DECREF`。" + +#~ msgid "" +#~ "Do not expect this function to actually modify *o* in any way. For at " +#~ "least :pep:`some objects <683>`, this function has no effect." +#~ msgstr "" +#~ "不要期望此函式會以任何方式實際修改 *o*,至少對於\\ :pep:`某些物件 " +#~ "<683>`\\ 來說,此函式沒有任何效果。" diff --git a/c-api/reflection.po b/c-api/reflection.po index b07264941d..6854e16e93 100644 --- a/c-api/reflection.po +++ b/c-api/reflection.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,41 +22,103 @@ msgstr "" msgid "Reflection" msgstr "" -#: ../../c-api/reflection.rst:10 +#: ../../c-api/reflection.rst:12 +msgid "Use :c:func:`PyEval_GetFrameBuiltins` instead." +msgstr "" + +#: ../../c-api/reflection.rst:14 ../../c-api/reflection.rst:66 msgid "" "Return a dictionary of the builtins in the current execution frame, or the " "interpreter of the thread state if no frame is currently executing." msgstr "" -#: ../../c-api/reflection.rst:16 +#: ../../c-api/reflection.rst:22 msgid "" -"Return a dictionary of the local variables in the current execution frame, " -"or ``NULL`` if no frame is currently executing." +"Use either :c:func:`PyEval_GetFrameLocals` to obtain the same behaviour as " +"calling :func:`locals` in Python code, or else call :c:func:" +"`PyFrame_GetLocals` on the result of :c:func:`PyEval_GetFrame` to access " +"the :attr:`~frame.f_locals` attribute of the currently executing frame." msgstr "" -#: ../../c-api/reflection.rst:22 +#: ../../c-api/reflection.rst:27 +msgid "" +"Return a mapping providing access to the local variables in the current " +"execution frame, or ``NULL`` if no frame is currently executing." +msgstr "" + +#: ../../c-api/reflection.rst:30 +msgid "" +"Refer to :func:`locals` for details of the mapping returned at different " +"scopes." +msgstr "" + +#: ../../c-api/reflection.rst:32 +msgid "" +"As this function returns a :term:`borrowed reference`, the dictionary " +"returned for :term:`optimized scopes ` is cached on the " +"frame object and will remain alive as long as the frame object does. Unlike :" +"c:func:`PyEval_GetFrameLocals` and :func:`locals`, subsequent calls to this " +"function in the same frame will update the contents of the cached dictionary " +"to reflect changes in the state of the local variables rather than returning " +"a new snapshot." +msgstr "" + +#: ../../c-api/reflection.rst:39 +msgid "" +"As part of :pep:`667`, :c:func:`PyFrame_GetLocals`, :func:`locals`, and :" +"attr:`FrameType.f_locals ` no longer make use of the shared " +"cache dictionary. Refer to the :ref:`What's New entry ` for additional details." +msgstr "" + +#: ../../c-api/reflection.rst:50 +msgid "Use :c:func:`PyEval_GetFrameGlobals` instead." +msgstr "" + +#: ../../c-api/reflection.rst:52 msgid "" "Return a dictionary of the global variables in the current execution frame, " "or ``NULL`` if no frame is currently executing." msgstr "" -#: ../../c-api/reflection.rst:28 +#: ../../c-api/reflection.rst:58 msgid "" "Return the current thread state's frame, which is ``NULL`` if no frame is " "currently executing." msgstr "" -#: ../../c-api/reflection.rst:31 +#: ../../c-api/reflection.rst:61 msgid "See also :c:func:`PyThreadState_GetFrame`." msgstr "另請見 :c:func:`PyThreadState_GetFrame`。" -#: ../../c-api/reflection.rst:36 +#: ../../c-api/reflection.rst:74 +msgid "" +"Return a dictionary of the local variables in the current execution frame, " +"or ``NULL`` if no frame is currently executing. Equivalent to calling :func:" +"`locals` in Python code." +msgstr "" + +#: ../../c-api/reflection.rst:78 +msgid "" +"To access :attr:`~frame.f_locals` on the current frame without making an " +"independent snapshot in :term:`optimized scopes `, call :c:" +"func:`PyFrame_GetLocals` on the result of :c:func:`PyEval_GetFrame`." +msgstr "" + +#: ../../c-api/reflection.rst:87 +msgid "" +"Return a dictionary of the global variables in the current execution frame, " +"or ``NULL`` if no frame is currently executing. Equivalent to calling :func:" +"`globals` in Python code." +msgstr "" + +#: ../../c-api/reflection.rst:96 msgid "" "Return the name of *func* if it is a function, class or instance object, " "else the name of *func*\\s type." msgstr "" -#: ../../c-api/reflection.rst:42 +#: ../../c-api/reflection.rst:102 msgid "" "Return a description string, depending on the type of *func*. Return values " "include \"()\" for functions and methods, \" constructor\", \" instance\", " diff --git a/c-api/slice.po b/c-api/slice.po index b747809cd1..a2b3dbc7a7 100644 --- a/c-api/slice.po +++ b/c-api/slice.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -161,10 +161,9 @@ msgstr "" #: ../../c-api/slice.rst:123 msgid "" "The Python ``Ellipsis`` object. This object has no methods. Like :c:data:" -"`Py_None`, it is an `immortal `_. " -"singleton object." +"`Py_None`, it is an :term:`immortal` singleton object." msgstr "" -#: ../../c-api/slice.rst:127 +#: ../../c-api/slice.rst:126 msgid ":c:data:`Py_Ellipsis` is immortal." msgstr ":c:data:`Py_Ellipsis` 為不滅的 (immortal)。" diff --git a/c-api/structures.po b/c-api/structures.po index db16244b8f..76d856ee90 100644 --- a/c-api/structures.po +++ b/c-api/structures.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -241,10 +241,11 @@ msgid "" msgstr "" #: ../../c-api/structures.rst:196 +#, fuzzy msgid "" -"PyObject *_PyCFunctionFast(PyObject *self,\n" -" PyObject *const *args,\n" -" Py_ssize_t nargs);" +"PyObject *PyCFunctionFast(PyObject *self,\n" +" PyObject *const *args,\n" +" Py_ssize_t nargs);" msgstr "" "PyObject *_PyCFunctionFast(PyObject *self,\n" " PyObject *const *args,\n" @@ -258,11 +259,12 @@ msgid "" msgstr "" #: ../../c-api/structures.rst:206 +#, fuzzy msgid "" -"PyObject *_PyCFunctionFastWithKeywords(PyObject *self,\n" -" PyObject *const *args,\n" -" Py_ssize_t nargs,\n" -" PyObject *kwnames);" +"PyObject *PyCFunctionFastWithKeywords(PyObject *self,\n" +" PyObject *const *args,\n" +" Py_ssize_t nargs,\n" +" PyObject *kwnames);" msgstr "" "PyObject *_PyCFunctionFastWithKeywords(PyObject *self,\n" " PyObject *const *args,\n" @@ -368,7 +370,7 @@ msgstr "" #: ../../c-api/structures.rst:292 msgid "" "Fast calling convention supporting only positional arguments. The methods " -"have the type :c:type:`_PyCFunctionFast`. The first parameter is *self*, the " +"have the type :c:type:`PyCFunctionFast`. The first parameter is *self*, the " "second parameter is a C array of :c:expr:`PyObject*` values indicating the " "arguments and the third parameter is the number of arguments (the length of " "the array)." @@ -385,7 +387,7 @@ msgstr ":c:expr:`METH_FASTCALL | METH_KEYWORDS`" #: ../../c-api/structures.rst:308 msgid "" "Extension of :c:macro:`METH_FASTCALL` supporting also keyword arguments, " -"with methods of type :c:type:`_PyCFunctionFastWithKeywords`. Keyword " +"with methods of type :c:type:`PyCFunctionFastWithKeywords`. Keyword " "arguments are passed the same way as in the :ref:`vectorcall protocol " "`: there is an additional fourth :c:expr:`PyObject*` parameter " "which is a tuple representing the names of the keyword arguments (which are " diff --git a/c-api/sys.po b/c-api/sys.po index 9cb3befea9..5fa011518f 100644 --- a/c-api/sys.po +++ b/c-api/sys.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-04 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -282,54 +282,17 @@ msgid "" "prior to :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/sys.rst:247 ../../c-api/sys.rst:258 -msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"warnoptions` should be used instead, see :ref:`Python Initialization " -"Configuration `." -msgstr "" - -#: ../../c-api/sys.rst:251 -msgid "" -"Append *s* to :data:`sys.warnoptions`. This function must be called prior " -"to :c:func:`Py_Initialize` in order to affect the warnings filter list." -msgstr "" - -#: ../../c-api/sys.rst:262 -msgid "Append *unicode* to :data:`sys.warnoptions`." +#: ../../c-api/sys.rst:245 +msgid "Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead." msgstr "" -#: ../../c-api/sys.rst:264 -msgid "" -"Note: this function is not currently usable from outside the CPython " -"implementation, as it must be called prior to the implicit import of :mod:" -"`warnings` in :c:func:`Py_Initialize` to be effective, but can't be called " -"until enough of the runtime has been initialized to permit the creation of " -"Unicode objects." -msgstr "" - -#: ../../c-api/sys.rst:274 -msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"module_search_paths` and :c:member:`PyConfig.module_search_paths_set` should " -"be used instead, see :ref:`Python Initialization Configuration `." -msgstr "" - -#: ../../c-api/sys.rst:279 -msgid "" -"Set :data:`sys.path` to a list object of paths found in *path* which should " -"be a list of paths separated with the platform's search path delimiter (``:" -"`` on Unix, ``;`` on Windows)." -msgstr "" - -#: ../../c-api/sys.rst:287 +#: ../../c-api/sys.rst:250 msgid "" "Write the output string described by *format* to :data:`sys.stdout`. No " "exceptions are raised, even if truncation occurs (see below)." msgstr "" -#: ../../c-api/sys.rst:290 +#: ../../c-api/sys.rst:253 msgid "" "*format* should limit the total size of the formatted output string to 1000 " "bytes or less -- after 1000 bytes, the output string is truncated. In " @@ -340,85 +303,89 @@ msgid "" "of digits for very large numbers." msgstr "" -#: ../../c-api/sys.rst:298 +#: ../../c-api/sys.rst:261 msgid "" "If a problem occurs, or :data:`sys.stdout` is unset, the formatted message " "is written to the real (C level) *stdout*." msgstr "" -#: ../../c-api/sys.rst:303 +#: ../../c-api/sys.rst:266 msgid "" "As :c:func:`PySys_WriteStdout`, but write to :data:`sys.stderr` or *stderr* " "instead." msgstr "" -#: ../../c-api/sys.rst:308 +#: ../../c-api/sys.rst:271 msgid "" "Function similar to PySys_WriteStdout() but format the message using :c:func:" "`PyUnicode_FromFormatV` and don't truncate the message to an arbitrary " "length." msgstr "" -#: ../../c-api/sys.rst:316 +#: ../../c-api/sys.rst:279 msgid "" "As :c:func:`PySys_FormatStdout`, but write to :data:`sys.stderr` or *stderr* " "instead." msgstr "" -#: ../../c-api/sys.rst:323 -msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"xoptions` should be used instead, see :ref:`Python Initialization " -"Configuration `." -msgstr "" - -#: ../../c-api/sys.rst:327 -msgid "" -"Parse *s* as a set of :option:`-X` options and add them to the current " -"options mapping as returned by :c:func:`PySys_GetXOptions`. This function " -"may be called prior to :c:func:`Py_Initialize`." -msgstr "" - -#: ../../c-api/sys.rst:337 +#: ../../c-api/sys.rst:286 msgid "" "Return the current dictionary of :option:`-X` options, similarly to :data:" "`sys._xoptions`. On error, ``NULL`` is returned and an exception is set." msgstr "" -#: ../../c-api/sys.rst:346 +#: ../../c-api/sys.rst:295 msgid "" "Raise an auditing event with any active hooks. Return zero for success and " "non-zero with an exception set on failure." msgstr "" -#: ../../c-api/sys.rst:349 +#: ../../c-api/sys.rst:298 +msgid "The *event* string argument must not be *NULL*." +msgstr "" + +#: ../../c-api/sys.rst:300 msgid "" "If any hooks have been added, *format* and other arguments will be used to " "construct a tuple to pass. Apart from ``N``, the same format characters as " "used in :c:func:`Py_BuildValue` are available. If the built value is not a " -"tuple, it will be added into a single-element tuple. (The ``N`` format " -"option consumes a reference, but since there is no way to know whether " -"arguments to this function will be consumed, using it may cause reference " -"leaks.)" +"tuple, it will be added into a single-element tuple." +msgstr "" + +#: ../../c-api/sys.rst:305 +msgid "" +"The ``N`` format option must not be used. It consumes a reference, but since " +"there is no way to know whether arguments to this function will be consumed, " +"using it may cause reference leaks." msgstr "" -#: ../../c-api/sys.rst:357 +#: ../../c-api/sys.rst:309 msgid "" "Note that ``#`` format characters should always be treated as :c:type:" "`Py_ssize_t`, regardless of whether ``PY_SSIZE_T_CLEAN`` was defined." msgstr "" -#: ../../c-api/sys.rst:360 +#: ../../c-api/sys.rst:312 msgid ":func:`sys.audit` performs the same function from Python code." msgstr "" -#: ../../c-api/sys.rst:366 +#: ../../c-api/sys.rst:314 +msgid "See also :c:func:`PySys_AuditTuple`." +msgstr "" + +#: ../../c-api/sys.rst:320 msgid "" "Require :c:type:`Py_ssize_t` for ``#`` format characters. Previously, an " "unavoidable deprecation warning was raised." msgstr "" -#: ../../c-api/sys.rst:372 +#: ../../c-api/sys.rst:326 +msgid "" +"Similar to :c:func:`PySys_Audit`, but pass arguments as a Python object. " +"*args* must be a :class:`tuple`. To pass no arguments, *args* can be *NULL*." +msgstr "" + +#: ../../c-api/sys.rst:334 msgid "" "Append the callable *hook* to the list of active auditing hooks. Return zero " "on success and non-zero on failure. If the runtime has been initialized, " @@ -426,14 +393,14 @@ msgid "" "all interpreters created by the runtime." msgstr "" -#: ../../c-api/sys.rst:378 +#: ../../c-api/sys.rst:340 msgid "" "The *userData* pointer is passed into the hook function. Since hook " "functions may be called from different runtimes, this pointer should not " "refer directly to Python state." msgstr "" -#: ../../c-api/sys.rst:382 +#: ../../c-api/sys.rst:344 msgid "" "This function is safe to call before :c:func:`Py_Initialize`. When called " "after runtime initialization, existing audit hooks are notified and may " @@ -441,20 +408,20 @@ msgid "" "`Exception` (other errors will not be silenced)." msgstr "" -#: ../../c-api/sys.rst:387 +#: ../../c-api/sys.rst:349 msgid "" "The hook function is always called with the GIL held by the Python " "interpreter that raised the event." msgstr "" -#: ../../c-api/sys.rst:390 +#: ../../c-api/sys.rst:352 msgid "" "See :pep:`578` for a detailed description of auditing. Functions in the " "runtime and standard library that raise events are listed in the :ref:`audit " "events table `. Details are in each function's documentation." msgstr "" -#: ../../c-api/sys.rst:395 ../../c-api/sys.rst:397 +#: ../../c-api/sys.rst:357 ../../c-api/sys.rst:359 msgid "" "If the interpreter is initialized, this function raises an auditing event " "``sys.addaudithook`` with no arguments. If any existing hooks raise an " @@ -463,18 +430,19 @@ msgid "" "hook has been added unless they control all existing hooks." msgstr "" -#: ../../c-api/sys.rst:406 +#: ../../c-api/sys.rst:368 msgid "" "The type of the hook function. *event* is the C string event argument passed " -"to :c:func:`PySys_Audit`. *args* is guaranteed to be a :c:type:" -"`PyTupleObject`. *userData* is the argument passed to PySys_AddAuditHook()." +"to :c:func:`PySys_Audit` or :c:func:`PySys_AuditTuple`. *args* is guaranteed " +"to be a :c:type:`PyTupleObject`. *userData* is the argument passed to " +"PySys_AddAuditHook()." msgstr "" -#: ../../c-api/sys.rst:417 +#: ../../c-api/sys.rst:380 msgid "Process Control" msgstr "行程控制" -#: ../../c-api/sys.rst:424 +#: ../../c-api/sys.rst:387 msgid "" "Print a fatal error message and kill the process. No cleanup is performed. " "This function should only be invoked when a condition is detected that would " @@ -484,29 +452,29 @@ msgid "" "file:`core` file." msgstr "" -#: ../../c-api/sys.rst:431 +#: ../../c-api/sys.rst:394 msgid "" "The ``Py_FatalError()`` function is replaced with a macro which logs " "automatically the name of the current function, unless the " "``Py_LIMITED_API`` macro is defined." msgstr "" -#: ../../c-api/sys.rst:435 +#: ../../c-api/sys.rst:398 msgid "Log the function name automatically." msgstr "" -#: ../../c-api/sys.rst:445 +#: ../../c-api/sys.rst:408 msgid "" "Exit the current process. This calls :c:func:`Py_FinalizeEx` and then calls " "the standard C library function ``exit(status)``. If :c:func:" "`Py_FinalizeEx` indicates an error, the exit status is set to 120." msgstr "" -#: ../../c-api/sys.rst:449 +#: ../../c-api/sys.rst:412 msgid "Errors from finalization no longer ignored." msgstr "" -#: ../../c-api/sys.rst:459 +#: ../../c-api/sys.rst:422 msgid "" "Register a cleanup function to be called by :c:func:`Py_FinalizeEx`. The " "cleanup function will be called with no arguments and should return no " @@ -522,18 +490,18 @@ msgstr "" msgid "USE_STACKCHECK (C macro)" msgstr "USE_STACKCHECK(C 巨集)" -#: ../../c-api/sys.rst:422 +#: ../../c-api/sys.rst:385 msgid "abort (C function)" msgstr "abort(C 函式)" -#: ../../c-api/sys.rst:441 ../../c-api/sys.rst:455 +#: ../../c-api/sys.rst:404 ../../c-api/sys.rst:418 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" -#: ../../c-api/sys.rst:441 +#: ../../c-api/sys.rst:404 msgid "exit (C function)" msgstr "exit(C 函式)" -#: ../../c-api/sys.rst:455 +#: ../../c-api/sys.rst:418 msgid "cleanup functions" msgstr "cleanup functions(清理函式)" diff --git a/c-api/time.po b/c-api/time.po new file mode 100644 index 0000000000..d41ea7d002 --- /dev/null +++ b/c-api/time.po @@ -0,0 +1,167 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../c-api/time.rst:4 +msgid "PyTime C API" +msgstr "" + +#: ../../c-api/time.rst:8 +msgid "" +"The clock C API provides access to system clocks. It is similar to the " +"Python :mod:`time` module." +msgstr "" + +#: ../../c-api/time.rst:11 +msgid "" +"For C API related to the :mod:`datetime` module, see :ref:`datetimeobjects`." +msgstr "" + +#: ../../c-api/time.rst:15 +msgid "Types" +msgstr "" + +#: ../../c-api/time.rst:19 +msgid "" +"A timestamp or duration in nanoseconds, represented as a signed 64-bit " +"integer." +msgstr "" + +#: ../../c-api/time.rst:22 +msgid "" +"The reference point for timestamps depends on the clock used. For example, :" +"c:func:`PyTime_Time` returns timestamps relative to the UNIX epoch." +msgstr "" + +#: ../../c-api/time.rst:25 +msgid "" +"The supported range is around [-292.3 years; +292.3 years]. Using the Unix " +"epoch (January 1st, 1970) as reference, the supported date range is around " +"[1677-09-21; 2262-04-11]. The exact limits are exposed as constants:" +msgstr "" + +#: ../../c-api/time.rst:32 +msgid "Minimum value of :c:type:`PyTime_t`." +msgstr "" + +#: ../../c-api/time.rst:36 +msgid "Maximum value of :c:type:`PyTime_t`." +msgstr "" + +#: ../../c-api/time.rst:40 +msgid "Clock Functions" +msgstr "" + +#: ../../c-api/time.rst:42 +msgid "" +"The following functions take a pointer to a :c:expr:`PyTime_t` that they set " +"to the value of a particular clock. Details of each clock are given in the " +"documentation of the corresponding Python function." +msgstr "" + +#: ../../c-api/time.rst:47 +msgid "" +"The functions return ``0`` on success, or ``-1`` (with an exception set) on " +"failure." +msgstr "" + +#: ../../c-api/time.rst:50 +msgid "" +"On integer overflow, they set the :c:data:`PyExc_OverflowError` exception " +"and set ``*result`` to the value clamped to the ``[PyTime_MIN; PyTime_MAX]`` " +"range. (On current systems, integer overflows are likely caused by " +"misconfigured system time.)" +msgstr "" + +#: ../../c-api/time.rst:56 +msgid "" +"As any other C API (unless otherwise specified), the functions must be " +"called with the :term:`GIL` held." +msgstr "" + +#: ../../c-api/time.rst:61 +msgid "" +"Read the monotonic clock. See :func:`time.monotonic` for important details " +"on this clock." +msgstr "" + +#: ../../c-api/time.rst:66 +msgid "" +"Read the performance counter. See :func:`time.perf_counter` for important " +"details on this clock." +msgstr "" + +#: ../../c-api/time.rst:71 +msgid "" +"Read the “wall clock” time. See :func:`time.time` for details important on " +"this clock." +msgstr "" + +#: ../../c-api/time.rst:76 +msgid "Raw Clock Functions" +msgstr "" + +#: ../../c-api/time.rst:78 +msgid "" +"Similar to clock functions, but don't set an exception on error and don't " +"require the caller to hold the GIL." +msgstr "" + +#: ../../c-api/time.rst:81 +msgid "On success, the functions return ``0``." +msgstr "" + +#: ../../c-api/time.rst:83 +msgid "" +"On failure, they set ``*result`` to ``0`` and return ``-1``, *without* " +"setting an exception. To get the cause of the error, acquire the GIL and " +"call the regular (non-``Raw``) function. Note that the regular function may " +"succeed after the ``Raw`` one failed." +msgstr "" + +#: ../../c-api/time.rst:90 +msgid "" +"Similar to :c:func:`PyTime_Monotonic`, but don't set an exception on error " +"and don't require holding the GIL." +msgstr "" + +#: ../../c-api/time.rst:95 +msgid "" +"Similar to :c:func:`PyTime_PerfCounter`, but don't set an exception on error " +"and don't require holding the GIL." +msgstr "" + +#: ../../c-api/time.rst:100 +msgid "" +"Similar to :c:func:`PyTime_Time`, but don't set an exception on error and " +"don't require holding the GIL." +msgstr "" + +#: ../../c-api/time.rst:105 +msgid "Conversion functions" +msgstr "" + +#: ../../c-api/time.rst:109 +msgid "Convert a timestamp to a number of seconds as a C :c:expr:`double`." +msgstr "" + +#: ../../c-api/time.rst:111 +msgid "" +"The function cannot fail, but note that :c:expr:`double` has limited " +"accuracy for large values." +msgstr "" diff --git a/c-api/tuple.po b/c-api/tuple.po index 311e813a55..3e5dbda024 100644 --- a/c-api/tuple.po +++ b/c-api/tuple.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-28 13:20+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -119,14 +119,21 @@ msgid "" "*only* be used to fill in brand new tuples." msgstr "" -#: ../../c-api/tuple.rst:104 +#: ../../c-api/tuple.rst:102 ../../c-api/tuple.rst:217 +#: ../../c-api/tuple.rst:235 +msgid "" +"Bounds checking is performed as an assertion if Python is built in :ref:" +"`debug mode ` or :option:`with assertions <--with-assertions>`." +msgstr "" + +#: ../../c-api/tuple.rst:107 msgid "" "This function \"steals\" a reference to *o*, and, unlike :c:func:" "`PyTuple_SetItem`, does *not* discard a reference to any item that is being " "replaced; any reference in the tuple at position *pos* will be leaked." msgstr "" -#: ../../c-api/tuple.rst:112 +#: ../../c-api/tuple.rst:115 msgid "" "Can be used to resize a tuple. *newsize* will be the new length of the " "tuple. Because tuples are *supposed* to be immutable, this should only be " @@ -141,11 +148,11 @@ msgid "" "`SystemError`." msgstr "" -#: ../../c-api/tuple.rst:127 +#: ../../c-api/tuple.rst:130 msgid "Struct Sequence Objects" msgstr "" -#: ../../c-api/tuple.rst:129 +#: ../../c-api/tuple.rst:132 msgid "" "Struct sequence objects are the C equivalent of :func:`~collections." "namedtuple` objects, i.e. a sequence whose items can also be accessed " @@ -153,48 +160,48 @@ msgid "" "specific struct sequence type." msgstr "" -#: ../../c-api/tuple.rst:136 +#: ../../c-api/tuple.rst:139 msgid "" "Create a new struct sequence type from the data in *desc*, described below. " "Instances of the resulting type can be created with :c:func:" "`PyStructSequence_New`." msgstr "" -#: ../../c-api/tuple.rst:139 ../../c-api/tuple.rst:207 +#: ../../c-api/tuple.rst:142 ../../c-api/tuple.rst:210 msgid "Return ``NULL`` with an exception set on failure." msgstr "" -#: ../../c-api/tuple.rst:144 +#: ../../c-api/tuple.rst:147 msgid "Initializes a struct sequence type *type* from *desc* in place." msgstr "" -#: ../../c-api/tuple.rst:149 +#: ../../c-api/tuple.rst:152 msgid "" "Like :c:func:`PyStructSequence_InitType`, but returns ``0`` on success and " "``-1`` with an exception set on failure." msgstr "" -#: ../../c-api/tuple.rst:157 +#: ../../c-api/tuple.rst:160 msgid "Contains the meta information of a struct sequence type to create." msgstr "" -#: ../../c-api/tuple.rst:161 +#: ../../c-api/tuple.rst:164 msgid "Name of the struct sequence type." msgstr "" -#: ../../c-api/tuple.rst:165 +#: ../../c-api/tuple.rst:168 msgid "Pointer to docstring for the type or ``NULL`` to omit." msgstr "" -#: ../../c-api/tuple.rst:169 +#: ../../c-api/tuple.rst:172 msgid "Pointer to ``NULL``-terminated array with field names of the new type." msgstr "" -#: ../../c-api/tuple.rst:173 +#: ../../c-api/tuple.rst:176 msgid "Number of fields visible to the Python side (if used as tuple)." msgstr "" -#: ../../c-api/tuple.rst:178 +#: ../../c-api/tuple.rst:181 msgid "" "Describes a field of a struct sequence. As a struct sequence is modeled as a " "tuple, all fields are typed as :c:expr:`PyObject*`. The index in the :c:" @@ -203,55 +210,60 @@ msgid "" "described." msgstr "" -#: ../../c-api/tuple.rst:186 +#: ../../c-api/tuple.rst:189 msgid "" "Name for the field or ``NULL`` to end the list of named fields, set to :c:" "data:`PyStructSequence_UnnamedField` to leave unnamed." msgstr "" -#: ../../c-api/tuple.rst:191 +#: ../../c-api/tuple.rst:194 msgid "Field docstring or ``NULL`` to omit." msgstr "" -#: ../../c-api/tuple.rst:196 +#: ../../c-api/tuple.rst:199 msgid "Special value for a field name to leave it unnamed." msgstr "" -#: ../../c-api/tuple.rst:198 +#: ../../c-api/tuple.rst:201 msgid "The type was changed from ``char *``." msgstr "" -#: ../../c-api/tuple.rst:204 +#: ../../c-api/tuple.rst:207 msgid "" "Creates an instance of *type*, which must have been created with :c:func:" "`PyStructSequence_NewType`." msgstr "" -#: ../../c-api/tuple.rst:212 +#: ../../c-api/tuple.rst:215 msgid "" -"Return the object at position *pos* in the struct sequence pointed to by " -"*p*. No bounds checking is performed." +"Return the object at position *pos* in the struct sequence pointed to by *p*." msgstr "" -#: ../../c-api/tuple.rst:218 -msgid "Macro equivalent of :c:func:`PyStructSequence_GetItem`." +#: ../../c-api/tuple.rst:223 +msgid "Alias to :c:func:`PyStructSequence_GetItem`." msgstr "" -#: ../../c-api/tuple.rst:223 +#: ../../c-api/tuple.rst:225 +msgid "Now implemented as an alias to :c:func:`PyStructSequence_GetItem`." +msgstr "" + +#: ../../c-api/tuple.rst:231 msgid "" "Sets the field at index *pos* of the struct sequence *p* to value *o*. " "Like :c:func:`PyTuple_SET_ITEM`, this should only be used to fill in brand " "new instances." msgstr "" -#: ../../c-api/tuple.rst:229 ../../c-api/tuple.rst:239 +#: ../../c-api/tuple.rst:240 msgid "This function \"steals\" a reference to *o*." msgstr "" -#: ../../c-api/tuple.rst:234 -msgid "" -"Similar to :c:func:`PyStructSequence_SetItem`, but implemented as a static " -"inlined function." +#: ../../c-api/tuple.rst:245 +msgid "Alias to :c:func:`PyStructSequence_SetItem`." +msgstr "" + +#: ../../c-api/tuple.rst:247 +msgid "Now implemented as an alias to :c:func:`PyStructSequence_SetItem`." msgstr "" #: ../../c-api/tuple.rst:8 diff --git a/c-api/type.po b/c-api/type.po index a5480ec94c..0cba8494b9 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-10-14 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -209,36 +209,49 @@ msgstr "" #: ../../c-api/type.rst:190 msgid "" +"Return the type's fully qualified name. Equivalent to ``f\"{type.__module__}." +"{type.__qualname__}\"``, or ``type.__qualname__`` if ``type.__module__`` is " +"not a string or is equal to ``\"builtins\"``." +msgstr "" + +#: ../../c-api/type.rst:198 +msgid "" +"Return the type's module name. Equivalent to getting the ``type.__module__`` " +"attribute." +msgstr "" + +#: ../../c-api/type.rst:205 +msgid "" "Return the function pointer stored in the given slot. If the result is " "``NULL``, this indicates that either the slot is ``NULL``, or that the " "function was called with invalid parameters. Callers will typically cast the " "result pointer into the appropriate function type." msgstr "" -#: ../../c-api/type.rst:196 +#: ../../c-api/type.rst:211 msgid "" "See :c:member:`PyType_Slot.slot` for possible values of the *slot* argument." msgstr "" -#: ../../c-api/type.rst:200 +#: ../../c-api/type.rst:215 msgid "" ":c:func:`PyType_GetSlot` can now accept all types. Previously, it was " "limited to :ref:`heap types `." msgstr "" -#: ../../c-api/type.rst:206 +#: ../../c-api/type.rst:221 msgid "" "Return the module object associated with the given type when the type was " "created using :c:func:`PyType_FromModuleAndSpec`." msgstr "" -#: ../../c-api/type.rst:209 ../../c-api/type.rst:229 +#: ../../c-api/type.rst:224 ../../c-api/type.rst:244 msgid "" "If no module is associated with the given type, sets :py:class:`TypeError` " "and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:212 +#: ../../c-api/type.rst:227 msgid "" "This function is usually used to get the module in which a method is " "defined. Note that in such a method, ``PyType_GetModule(Py_TYPE(self))`` may " @@ -249,31 +262,31 @@ msgid "" "type:`!PyCMethod` cannot be used." msgstr "" -#: ../../c-api/type.rst:225 +#: ../../c-api/type.rst:240 msgid "" "Return the state of the module object associated with the given type. This " "is a shortcut for calling :c:func:`PyModule_GetState()` on the result of :c:" "func:`PyType_GetModule`." msgstr "" -#: ../../c-api/type.rst:232 +#: ../../c-api/type.rst:247 msgid "" "If the *type* has an associated module but its state is ``NULL``, returns " "``NULL`` without setting an exception." msgstr "" -#: ../../c-api/type.rst:239 +#: ../../c-api/type.rst:254 msgid "" "Find the first superclass whose module was created from the given :c:type:" "`PyModuleDef` *def*, and return that module." msgstr "" -#: ../../c-api/type.rst:242 +#: ../../c-api/type.rst:257 msgid "" "If no module is found, raises a :py:class:`TypeError` and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:244 +#: ../../c-api/type.rst:259 msgid "" "This function is intended to be used together with :c:func:" "`PyModule_GetState()` to get module state from slot methods (such as :c:" @@ -282,40 +295,40 @@ msgid "" "type:`PyCMethod` calling convention." msgstr "" -#: ../../c-api/type.rst:254 +#: ../../c-api/type.rst:269 msgid "Attempt to assign a version tag to the given type." msgstr "" -#: ../../c-api/type.rst:256 +#: ../../c-api/type.rst:271 msgid "" "Returns 1 if the type already had a valid version tag or a new one was " "assigned, or 0 if a new tag could not be assigned." msgstr "" -#: ../../c-api/type.rst:263 +#: ../../c-api/type.rst:278 msgid "Creating Heap-Allocated Types" msgstr "" -#: ../../c-api/type.rst:265 +#: ../../c-api/type.rst:280 msgid "" "The following functions and structs are used to create :ref:`heap types " "`." msgstr "" -#: ../../c-api/type.rst:270 +#: ../../c-api/type.rst:285 msgid "" "Create and return a :ref:`heap type ` from the *spec* (see :c:" "macro:`Py_TPFLAGS_HEAPTYPE`)." msgstr "" -#: ../../c-api/type.rst:273 +#: ../../c-api/type.rst:288 msgid "" "The metaclass *metaclass* is used to construct the resulting type object. " "When *metaclass* is ``NULL``, the metaclass is derived from *bases* (or " "*Py_tp_base[s]* slots if *bases* is ``NULL``, see below)." msgstr "" -#: ../../c-api/type.rst:277 +#: ../../c-api/type.rst:292 msgid "" "Metaclasses that override :c:member:`~PyTypeObject.tp_new` are not " "supported, except if ``tp_new`` is ``NULL``. (For backwards compatibility, " @@ -324,7 +337,7 @@ msgid "" "deprecated and in Python 3.14+ such metaclasses will not be supported.)" msgstr "" -#: ../../c-api/type.rst:284 +#: ../../c-api/type.rst:299 msgid "" "The *bases* argument can be used to specify base classes; it can either be " "only one class or a tuple of classes. If *bases* is ``NULL``, the " @@ -333,7 +346,7 @@ msgid "" "derives from :class:`object`." msgstr "" -#: ../../c-api/type.rst:290 +#: ../../c-api/type.rst:305 msgid "" "The *module* argument can be used to record the module in which the new " "class is defined. It must be a module object or ``NULL``. If not ``NULL``, " @@ -342,11 +355,11 @@ msgid "" "subclasses; it must be specified for each class individually." msgstr "" -#: ../../c-api/type.rst:297 +#: ../../c-api/type.rst:312 msgid "This function calls :c:func:`PyType_Ready` on the new type." msgstr "" -#: ../../c-api/type.rst:299 +#: ../../c-api/type.rst:314 msgid "" "Note that this function does *not* fully match the behavior of calling :py:" "class:`type() ` or using the :keyword:`class` statement. With user-" @@ -355,41 +368,41 @@ msgid "" "Specifically:" msgstr "" -#: ../../c-api/type.rst:306 +#: ../../c-api/type.rst:321 msgid "" ":py:meth:`~object.__new__` is not called on the new class (and it must be " "set to ``type.__new__``)." msgstr "" -#: ../../c-api/type.rst:308 +#: ../../c-api/type.rst:323 msgid ":py:meth:`~object.__init__` is not called on the new class." msgstr "" -#: ../../c-api/type.rst:309 +#: ../../c-api/type.rst:324 msgid ":py:meth:`~object.__init_subclass__` is not called on any bases." msgstr "" -#: ../../c-api/type.rst:310 +#: ../../c-api/type.rst:325 msgid ":py:meth:`~object.__set_name__` is not called on new descriptors." msgstr "" -#: ../../c-api/type.rst:316 +#: ../../c-api/type.rst:331 msgid "Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, module, spec, bases)``。" -#: ../../c-api/type.rst:322 +#: ../../c-api/type.rst:337 msgid "" "The function now accepts a single class as the *bases* argument and ``NULL`` " "as the ``tp_doc`` slot." msgstr "" -#: ../../c-api/type.rst:327 ../../c-api/type.rst:344 +#: ../../c-api/type.rst:342 ../../c-api/type.rst:359 msgid "" "The function now finds and uses a metaclass corresponding to the provided " "base classes. Previously, only :class:`type` instances were returned." msgstr "" -#: ../../c-api/type.rst:330 ../../c-api/type.rst:347 ../../c-api/type.rst:363 +#: ../../c-api/type.rst:345 ../../c-api/type.rst:362 ../../c-api/type.rst:378 msgid "" "The :c:member:`~PyTypeObject.tp_new` of the metaclass is *ignored*. which " "may result in incomplete initialization. Creating classes whose metaclass " @@ -397,42 +410,42 @@ msgid "" "it will be no longer allowed." msgstr "" -#: ../../c-api/type.rst:338 +#: ../../c-api/type.rst:353 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, bases)``。" -#: ../../c-api/type.rst:355 +#: ../../c-api/type.rst:370 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``。" -#: ../../c-api/type.rst:359 +#: ../../c-api/type.rst:374 msgid "" "The function now finds and uses a metaclass corresponding to the base " "classes provided in *Py_tp_base[s]* slots. Previously, only :class:`type` " "instances were returned." msgstr "" -#: ../../c-api/type.rst:380 +#: ../../c-api/type.rst:395 msgid "Structure defining a type's behavior." msgstr "" -#: ../../c-api/type.rst:384 +#: ../../c-api/type.rst:399 msgid "Name of the type, used to set :c:member:`PyTypeObject.tp_name`." msgstr "" -#: ../../c-api/type.rst:388 +#: ../../c-api/type.rst:403 msgid "" "If positive, specifies the size of the instance in bytes. It is used to set :" "c:member:`PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/type.rst:391 +#: ../../c-api/type.rst:406 msgid "" "If zero, specifies that :c:member:`~PyTypeObject.tp_basicsize` should be " "inherited." msgstr "" -#: ../../c-api/type.rst:394 +#: ../../c-api/type.rst:409 msgid "" "If negative, the absolute value specifies how much space instances of the " "class need *in addition* to the superclass. Use :c:func:" @@ -440,17 +453,17 @@ msgid "" "this way." msgstr "" -#: ../../c-api/type.rst:401 +#: ../../c-api/type.rst:416 msgid "Previously, this field could not be negative." msgstr "" -#: ../../c-api/type.rst:405 +#: ../../c-api/type.rst:420 msgid "" "Size of one element of a variable-size type, in bytes. Used to set :c:member:" "`PyTypeObject.tp_itemsize`. See ``tp_itemsize`` documentation for caveats." msgstr "" -#: ../../c-api/type.rst:409 +#: ../../c-api/type.rst:424 msgid "" "If zero, :c:member:`~PyTypeObject.tp_itemsize` is inherited. Extending " "arbitrary variable-sized classes is dangerous, since some types use a fixed " @@ -459,58 +472,58 @@ msgid "" "only possible in the following situations:" msgstr "" -#: ../../c-api/type.rst:416 +#: ../../c-api/type.rst:431 msgid "" "The base is not variable-sized (its :c:member:`~PyTypeObject.tp_itemsize`)." msgstr "" -#: ../../c-api/type.rst:418 +#: ../../c-api/type.rst:433 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is positive, suggesting that " "the memory layout of the base class is known." msgstr "" -#: ../../c-api/type.rst:420 +#: ../../c-api/type.rst:435 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is zero, suggesting that the " "subclass does not access the instance's memory directly." msgstr "" -#: ../../c-api/type.rst:423 +#: ../../c-api/type.rst:438 msgid "With the :c:macro:`Py_TPFLAGS_ITEMS_AT_END` flag." msgstr "" -#: ../../c-api/type.rst:427 +#: ../../c-api/type.rst:442 msgid "Type flags, used to set :c:member:`PyTypeObject.tp_flags`." msgstr "" -#: ../../c-api/type.rst:429 +#: ../../c-api/type.rst:444 msgid "" "If the ``Py_TPFLAGS_HEAPTYPE`` flag is not set, :c:func:" "`PyType_FromSpecWithBases` sets it automatically." msgstr "" -#: ../../c-api/type.rst:434 +#: ../../c-api/type.rst:449 msgid "" "Array of :c:type:`PyType_Slot` structures. Terminated by the special slot " "value ``{0, NULL}``." msgstr "" -#: ../../c-api/type.rst:437 +#: ../../c-api/type.rst:452 msgid "Each slot ID should be specified at most once." msgstr "" -#: ../../c-api/type.rst:447 +#: ../../c-api/type.rst:462 msgid "" "Structure defining optional functionality of a type, containing a slot ID " "and a value pointer." msgstr "" -#: ../../c-api/type.rst:452 +#: ../../c-api/type.rst:467 msgid "A slot ID." msgstr "" -#: ../../c-api/type.rst:454 +#: ../../c-api/type.rst:469 msgid "" "Slot IDs are named like the field names of the structures :c:type:" "`PyTypeObject`, :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, :c:" @@ -518,30 +531,30 @@ msgid "" "prefix. For example, use:" msgstr "" -#: ../../c-api/type.rst:460 +#: ../../c-api/type.rst:475 msgid "``Py_tp_dealloc`` to set :c:member:`PyTypeObject.tp_dealloc`" msgstr "" -#: ../../c-api/type.rst:461 +#: ../../c-api/type.rst:476 msgid "``Py_nb_add`` to set :c:member:`PyNumberMethods.nb_add`" msgstr "" -#: ../../c-api/type.rst:462 +#: ../../c-api/type.rst:477 msgid "``Py_sq_length`` to set :c:member:`PySequenceMethods.sq_length`" msgstr "" -#: ../../c-api/type.rst:464 +#: ../../c-api/type.rst:479 msgid "" "The following “offset” fields cannot be set using :c:type:`PyType_Slot`:" msgstr "" -#: ../../c-api/type.rst:466 +#: ../../c-api/type.rst:481 msgid "" ":c:member:`~PyTypeObject.tp_weaklistoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)" msgstr "" -#: ../../c-api/type.rst:468 +#: ../../c-api/type.rst:483 msgid "" ":c:member:`~PyTypeObject.tp_dictoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_DICT` instead if possible)" @@ -549,7 +562,7 @@ msgstr "" ":c:member:`~PyTypeObject.tp_dictoffset`\\ (如果可能,請改用 :c:macro:" "`Py_TPFLAGS_MANAGED_DICT`)" -#: ../../c-api/type.rst:470 +#: ../../c-api/type.rst:485 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall_offset` (use " "``\"__vectorcalloffset__\"`` in :ref:`PyMemberDef `)" @@ -557,7 +570,7 @@ msgstr "" ":c:member:`~PyTypeObject.tp_vectorcall_offset`\\ (請用 :ref:`PyMemberDef " "` 中的 ``\"__vectorcalloffset__\"``)" -#: ../../c-api/type.rst:474 +#: ../../c-api/type.rst:489 msgid "" "If it is not possible to switch to a ``MANAGED`` flag (for example, for " "vectorcall or to support Python older than 3.12), specify the offset in :c:" @@ -565,48 +578,48 @@ msgid "" "documentation ` for details." msgstr "" -#: ../../c-api/type.rst:480 +#: ../../c-api/type.rst:495 msgid "The following fields cannot be set at all when creating a heap type:" msgstr "" -#: ../../c-api/type.rst:482 +#: ../../c-api/type.rst:497 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall` (use :c:member:`~PyTypeObject." "tp_new` and/or :c:member:`~PyTypeObject.tp_init`)" msgstr "" -#: ../../c-api/type.rst:486 +#: ../../c-api/type.rst:501 msgid "" "Internal fields: :c:member:`~PyTypeObject.tp_dict`, :c:member:`~PyTypeObject." "tp_mro`, :c:member:`~PyTypeObject.tp_cache`, :c:member:`~PyTypeObject." "tp_subclasses`, and :c:member:`~PyTypeObject.tp_weaklist`." msgstr "" -#: ../../c-api/type.rst:493 +#: ../../c-api/type.rst:508 msgid "" "Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be problematic on " "some platforms. To avoid issues, use the *bases* argument of :c:func:" "`PyType_FromSpecWithBases` instead." msgstr "" -#: ../../c-api/type.rst:500 +#: ../../c-api/type.rst:515 msgid "Slots in :c:type:`PyBufferProcs` may be set in the unlimited API." msgstr "" -#: ../../c-api/type.rst:502 +#: ../../c-api/type.rst:517 msgid "" ":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." "bf_releasebuffer` are now available under the :ref:`limited API `." msgstr "" -#: ../../c-api/type.rst:509 +#: ../../c-api/type.rst:524 msgid "" "The desired value of the slot. In most cases, this is a pointer to a " "function." msgstr "" -#: ../../c-api/type.rst:512 +#: ../../c-api/type.rst:527 msgid "Slots other than ``Py_tp_doc`` may not be ``NULL``." msgstr "" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index 77ee43ce9e..a19d40c885 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:33+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1292,43 +1292,42 @@ msgid "" msgstr "" #: ../../c-api/typeobj.rst:503 ../../c-api/typeobj.rst:526 -#: ../../c-api/typeobj.rst:548 ../../c-api/typeobj.rst:562 -#: ../../c-api/typeobj.rst:606 ../../c-api/typeobj.rst:649 -#: ../../c-api/typeobj.rst:708 ../../c-api/typeobj.rst:749 -#: ../../c-api/typeobj.rst:766 ../../c-api/typeobj.rst:783 -#: ../../c-api/typeobj.rst:801 ../../c-api/typeobj.rst:825 -#: ../../c-api/typeobj.rst:842 ../../c-api/typeobj.rst:854 -#: ../../c-api/typeobj.rst:866 ../../c-api/typeobj.rst:899 -#: ../../c-api/typeobj.rst:917 ../../c-api/typeobj.rst:937 -#: ../../c-api/typeobj.rst:958 ../../c-api/typeobj.rst:984 -#: ../../c-api/typeobj.rst:1003 ../../c-api/typeobj.rst:1019 -#: ../../c-api/typeobj.rst:1058 ../../c-api/typeobj.rst:1069 -#: ../../c-api/typeobj.rst:1079 ../../c-api/typeobj.rst:1089 -#: ../../c-api/typeobj.rst:1103 ../../c-api/typeobj.rst:1121 -#: ../../c-api/typeobj.rst:1144 ../../c-api/typeobj.rst:1159 -#: ../../c-api/typeobj.rst:1172 ../../c-api/typeobj.rst:1194 -#: ../../c-api/typeobj.rst:1238 ../../c-api/typeobj.rst:1259 -#: ../../c-api/typeobj.rst:1278 ../../c-api/typeobj.rst:1308 -#: ../../c-api/typeobj.rst:1330 ../../c-api/typeobj.rst:1356 -#: ../../c-api/typeobj.rst:1424 ../../c-api/typeobj.rst:1492 -#: ../../c-api/typeobj.rst:1553 ../../c-api/typeobj.rst:1589 -#: ../../c-api/typeobj.rst:1614 ../../c-api/typeobj.rst:1637 -#: ../../c-api/typeobj.rst:1650 ../../c-api/typeobj.rst:1665 -#: ../../c-api/typeobj.rst:1679 ../../c-api/typeobj.rst:1709 -#: ../../c-api/typeobj.rst:1741 ../../c-api/typeobj.rst:1767 -#: ../../c-api/typeobj.rst:1785 ../../c-api/typeobj.rst:1814 -#: ../../c-api/typeobj.rst:1858 ../../c-api/typeobj.rst:1875 -#: ../../c-api/typeobj.rst:1916 ../../c-api/typeobj.rst:1938 -#: ../../c-api/typeobj.rst:1970 ../../c-api/typeobj.rst:1998 -#: ../../c-api/typeobj.rst:2011 ../../c-api/typeobj.rst:2021 -#: ../../c-api/typeobj.rst:2038 ../../c-api/typeobj.rst:2055 -#: ../../c-api/typeobj.rst:2069 ../../c-api/typeobj.rst:2115 -#: ../../c-api/typeobj.rst:2138 +#: ../../c-api/typeobj.rst:540 ../../c-api/typeobj.rst:584 +#: ../../c-api/typeobj.rst:627 ../../c-api/typeobj.rst:686 +#: ../../c-api/typeobj.rst:727 ../../c-api/typeobj.rst:744 +#: ../../c-api/typeobj.rst:761 ../../c-api/typeobj.rst:779 +#: ../../c-api/typeobj.rst:803 ../../c-api/typeobj.rst:820 +#: ../../c-api/typeobj.rst:832 ../../c-api/typeobj.rst:844 +#: ../../c-api/typeobj.rst:877 ../../c-api/typeobj.rst:899 +#: ../../c-api/typeobj.rst:919 ../../c-api/typeobj.rst:940 +#: ../../c-api/typeobj.rst:966 ../../c-api/typeobj.rst:985 +#: ../../c-api/typeobj.rst:1001 ../../c-api/typeobj.rst:1040 +#: ../../c-api/typeobj.rst:1051 ../../c-api/typeobj.rst:1061 +#: ../../c-api/typeobj.rst:1071 ../../c-api/typeobj.rst:1085 +#: ../../c-api/typeobj.rst:1103 ../../c-api/typeobj.rst:1126 +#: ../../c-api/typeobj.rst:1144 ../../c-api/typeobj.rst:1157 +#: ../../c-api/typeobj.rst:1179 ../../c-api/typeobj.rst:1223 +#: ../../c-api/typeobj.rst:1244 ../../c-api/typeobj.rst:1263 +#: ../../c-api/typeobj.rst:1293 ../../c-api/typeobj.rst:1315 +#: ../../c-api/typeobj.rst:1341 ../../c-api/typeobj.rst:1426 +#: ../../c-api/typeobj.rst:1500 ../../c-api/typeobj.rst:1561 +#: ../../c-api/typeobj.rst:1597 ../../c-api/typeobj.rst:1622 +#: ../../c-api/typeobj.rst:1645 ../../c-api/typeobj.rst:1658 +#: ../../c-api/typeobj.rst:1673 ../../c-api/typeobj.rst:1687 +#: ../../c-api/typeobj.rst:1717 ../../c-api/typeobj.rst:1749 +#: ../../c-api/typeobj.rst:1775 ../../c-api/typeobj.rst:1793 +#: ../../c-api/typeobj.rst:1822 ../../c-api/typeobj.rst:1866 +#: ../../c-api/typeobj.rst:1883 ../../c-api/typeobj.rst:1924 +#: ../../c-api/typeobj.rst:1946 ../../c-api/typeobj.rst:1978 +#: ../../c-api/typeobj.rst:2006 ../../c-api/typeobj.rst:2019 +#: ../../c-api/typeobj.rst:2029 ../../c-api/typeobj.rst:2046 +#: ../../c-api/typeobj.rst:2063 ../../c-api/typeobj.rst:2077 +#: ../../c-api/typeobj.rst:2123 ../../c-api/typeobj.rst:2146 msgid "**Inheritance:**" msgstr "" -#: ../../c-api/typeobj.rst:505 ../../c-api/typeobj.rst:564 -#: ../../c-api/typeobj.rst:608 +#: ../../c-api/typeobj.rst:505 ../../c-api/typeobj.rst:542 +#: ../../c-api/typeobj.rst:586 msgid "This field is not inherited by subtypes." msgstr "" @@ -1356,58 +1355,31 @@ msgid "" "class. :c:func:`PyType_Ready` will not change this field if it is non-zero." msgstr "" -#: ../../c-api/typeobj.rst:528 ../../c-api/typeobj.rst:710 -#: ../../c-api/typeobj.rst:827 ../../c-api/typeobj.rst:919 -#: ../../c-api/typeobj.rst:939 ../../c-api/typeobj.rst:1616 -#: ../../c-api/typeobj.rst:1639 ../../c-api/typeobj.rst:1769 -#: ../../c-api/typeobj.rst:1787 ../../c-api/typeobj.rst:1860 -#: ../../c-api/typeobj.rst:1972 ../../c-api/typeobj.rst:2117 +#: ../../c-api/typeobj.rst:528 ../../c-api/typeobj.rst:688 +#: ../../c-api/typeobj.rst:805 ../../c-api/typeobj.rst:901 +#: ../../c-api/typeobj.rst:921 ../../c-api/typeobj.rst:1624 +#: ../../c-api/typeobj.rst:1647 ../../c-api/typeobj.rst:1777 +#: ../../c-api/typeobj.rst:1795 ../../c-api/typeobj.rst:1868 +#: ../../c-api/typeobj.rst:1980 ../../c-api/typeobj.rst:2125 msgid "This field is inherited by subtypes." msgstr "" -#: ../../c-api/typeobj.rst:534 -msgid "" -"These fields are only present when the macro ``Py_TRACE_REFS`` is defined " -"(see the :option:`configure --with-trace-refs option <--with-trace-refs>`)." -msgstr "" - -#: ../../c-api/typeobj.rst:537 -msgid "" -"Their initialization to ``NULL`` is taken care of by the " -"``PyObject_HEAD_INIT`` macro. For :ref:`statically allocated objects " -"`, these fields always remain ``NULL``. For :ref:`dynamically " -"allocated objects `, these two fields are used to link the " -"object into a doubly linked list of *all* live objects on the heap." -msgstr "" - -#: ../../c-api/typeobj.rst:543 -msgid "" -"This could be used for various debugging purposes; currently the only uses " -"are the :func:`sys.getobjects` function and to print the objects that are " -"still alive at the end of a run when the environment variable :envvar:" -"`PYTHONDUMPREFS` is set." -msgstr "" - -#: ../../c-api/typeobj.rst:550 -msgid "These fields are not inherited by subtypes." -msgstr "" - -#: ../../c-api/typeobj.rst:554 +#: ../../c-api/typeobj.rst:532 msgid "PyVarObject Slots" msgstr "" -#: ../../c-api/typeobj.rst:558 +#: ../../c-api/typeobj.rst:536 msgid "" "For :ref:`statically allocated type objects `, this should be " "initialized to zero. For :ref:`dynamically allocated type objects `, this field has a special internal meaning." msgstr "" -#: ../../c-api/typeobj.rst:568 +#: ../../c-api/typeobj.rst:546 msgid "PyTypeObject Slots" msgstr "" -#: ../../c-api/typeobj.rst:570 +#: ../../c-api/typeobj.rst:548 msgid "" "Each slot has a section describing inheritance. If :c:func:`PyType_Ready` " "may set a value when the field is set to ``NULL`` then there will also be a " @@ -1415,7 +1387,7 @@ msgid "" "`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as defaults.)" msgstr "" -#: ../../c-api/typeobj.rst:577 +#: ../../c-api/typeobj.rst:555 msgid "" "Pointer to a NUL-terminated string containing the name of the type. For " "types that are accessible as module globals, the string should be the full " @@ -1427,14 +1399,14 @@ msgid "" "tp_name` initializer ``\"P.Q.M.T\"``." msgstr "" -#: ../../c-api/typeobj.rst:585 +#: ../../c-api/typeobj.rst:563 msgid "" "For :ref:`dynamically allocated type objects `, this should just " "be the type name, and the module name explicitly stored in the type dict as " "the value for key ``'__module__'``." msgstr "" -#: ../../c-api/typeobj.rst:590 +#: ../../c-api/typeobj.rst:568 msgid "" "For :ref:`statically allocated type objects `, the *tp_name* " "field should contain a dot. Everything before the last dot is made " @@ -1442,7 +1414,7 @@ msgid "" "last dot is made accessible as the :attr:`~definition.__name__` attribute." msgstr "" -#: ../../c-api/typeobj.rst:596 +#: ../../c-api/typeobj.rst:574 msgid "" "If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is " "made accessible as the :attr:`~definition.__name__` attribute, and the :attr:" @@ -1452,19 +1424,19 @@ msgid "" "created with pydoc." msgstr "" -#: ../../c-api/typeobj.rst:602 +#: ../../c-api/typeobj.rst:580 msgid "" "This field must not be ``NULL``. It is the only required field in :c:func:" "`PyTypeObject` (other than potentially :c:member:`~PyTypeObject." "tp_itemsize`)." msgstr "" -#: ../../c-api/typeobj.rst:614 +#: ../../c-api/typeobj.rst:592 msgid "" "These fields allow calculating the size in bytes of instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:616 +#: ../../c-api/typeobj.rst:594 msgid "" "There are two kinds of types: types with fixed-length instances have a zero :" "c:member:`~PyTypeObject.tp_itemsize` field, types with variable-length " @@ -1473,7 +1445,7 @@ msgid "" "in :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:621 +#: ../../c-api/typeobj.rst:599 msgid "" "For a type with variable-length instances, the instances must have an :c:" "member:`~PyVarObject.ob_size` field, and the instance size is :c:member:" @@ -1489,7 +1461,7 @@ msgid "" "`~PyVarObject.ob_size` field)." msgstr "" -#: ../../c-api/typeobj.rst:632 +#: ../../c-api/typeobj.rst:610 msgid "" "The basic size includes the fields in the instance declared by the macro :c:" "macro:`PyObject_HEAD` or :c:macro:`PyObject_VAR_HEAD` (whichever is used to " @@ -1501,7 +1473,7 @@ msgid "" "include the GC header size." msgstr "" -#: ../../c-api/typeobj.rst:640 +#: ../../c-api/typeobj.rst:618 msgid "" "A note about alignment: if the variable items require a particular " "alignment, this should be taken care of by the value of :c:member:" @@ -1512,12 +1484,12 @@ msgid "" "alignment requirement for ``double``)." msgstr "" -#: ../../c-api/typeobj.rst:647 +#: ../../c-api/typeobj.rst:625 msgid "" "For any type with variable-length instances, this field must not be ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:651 +#: ../../c-api/typeobj.rst:629 msgid "" "These fields are inherited separately by subtypes. If the base type has a " "non-zero :c:member:`~PyTypeObject.tp_itemsize`, it is generally not safe to " @@ -1525,7 +1497,7 @@ msgid "" "subtype (though this depends on the implementation of the base type)." msgstr "" -#: ../../c-api/typeobj.rst:659 +#: ../../c-api/typeobj.rst:637 msgid "" "A pointer to the instance destructor function. This function must be " "defined unless the type guarantees that its instances will never be " @@ -1533,11 +1505,11 @@ msgid "" "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:663 +#: ../../c-api/typeobj.rst:641 msgid "void tp_dealloc(PyObject *self);" msgstr "void tp_dealloc(PyObject *self);" -#: ../../c-api/typeobj.rst:665 +#: ../../c-api/typeobj.rst:643 msgid "" "The destructor function is called by the :c:func:`Py_DECREF` and :c:func:" "`Py_XDECREF` macros when the new reference count is zero. At this point, " @@ -1555,14 +1527,14 @@ msgid "" "allocated using :c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar`." msgstr "" -#: ../../c-api/typeobj.rst:680 +#: ../../c-api/typeobj.rst:658 msgid "" "If the type supports garbage collection (has the :c:macro:" "`Py_TPFLAGS_HAVE_GC` flag bit set), the destructor should call :c:func:" "`PyObject_GC_UnTrack` before clearing any member fields." msgstr "" -#: ../../c-api/typeobj.rst:684 +#: ../../c-api/typeobj.rst:662 msgid "" "static void foo_dealloc(foo_object *self) {\n" " PyObject_GC_UnTrack(self);\n" @@ -1576,7 +1548,7 @@ msgstr "" " Py_TYPE(self)->tp_free((PyObject *)self);\n" "}" -#: ../../c-api/typeobj.rst:692 +#: ../../c-api/typeobj.rst:670 msgid "" "Finally, if the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the " "deallocator should release the owned reference to its type object (via :c:" @@ -1584,7 +1556,7 @@ msgid "" "dangling pointers, the recommended way to achieve this is:" msgstr "" -#: ../../c-api/typeobj.rst:698 +#: ../../c-api/typeobj.rst:676 msgid "" "static void foo_dealloc(foo_object *self) {\n" " PyTypeObject *tp = Py_TYPE(self);\n" @@ -1594,28 +1566,28 @@ msgid "" "}" msgstr "" -#: ../../c-api/typeobj.rst:715 +#: ../../c-api/typeobj.rst:693 msgid "" "An optional offset to a per-instance function that implements calling the " "object using the :ref:`vectorcall protocol `, a more efficient " "alternative of the simpler :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:720 +#: ../../c-api/typeobj.rst:698 msgid "" "This field is only used if the flag :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` is " "set. If so, this must be a positive integer containing the offset in the " "instance of a :c:type:`vectorcallfunc` pointer." msgstr "" -#: ../../c-api/typeobj.rst:724 +#: ../../c-api/typeobj.rst:702 msgid "" "The *vectorcallfunc* pointer may be ``NULL``, in which case the instance " "behaves as if :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` was not set: calling the " "instance falls back to :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:728 +#: ../../c-api/typeobj.rst:706 msgid "" "Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also set :c:member:" "`~PyTypeObject.tp_call` and make sure its behaviour is consistent with the " @@ -1623,13 +1595,13 @@ msgid "" "`PyVectorcall_Call`." msgstr "" -#: ../../c-api/typeobj.rst:735 +#: ../../c-api/typeobj.rst:713 msgid "" "Before version 3.8, this slot was named ``tp_print``. In Python 2.x, it was " "used for printing to a file. In Python 3.0 to 3.7, it was unused." msgstr "" -#: ../../c-api/typeobj.rst:741 +#: ../../c-api/typeobj.rst:719 msgid "" "Before version 3.12, it was not recommended for :ref:`mutable heap types " "` to implement the vectorcall protocol. When a user sets :attr:" @@ -1639,7 +1611,7 @@ msgid "" "`Py_TPFLAGS_HAVE_VECTORCALL` flag." msgstr "" -#: ../../c-api/typeobj.rst:751 +#: ../../c-api/typeobj.rst:729 msgid "" "This field is always inherited. However, the :c:macro:" "`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If it's not set, " @@ -1647,11 +1619,11 @@ msgid "" "func:`PyVectorcall_Call` is explicitly called." msgstr "" -#: ../../c-api/typeobj.rst:760 +#: ../../c-api/typeobj.rst:738 msgid "An optional pointer to the get-attribute-string function." msgstr "" -#: ../../c-api/typeobj.rst:762 +#: ../../c-api/typeobj.rst:740 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, " @@ -1659,7 +1631,7 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:768 ../../c-api/typeobj.rst:960 +#: ../../c-api/typeobj.rst:746 ../../c-api/typeobj.rst:942 msgid "" "Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject." "tp_getattro`" @@ -1667,7 +1639,7 @@ msgstr "" "群組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject." "tp_getattro`" -#: ../../c-api/typeobj.rst:770 +#: ../../c-api/typeobj.rst:748 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " @@ -1676,12 +1648,12 @@ msgid "" "tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:777 ../../c-api/typeobj.rst:973 +#: ../../c-api/typeobj.rst:755 ../../c-api/typeobj.rst:955 msgid "" "An optional pointer to the function for setting and deleting attributes." msgstr "" -#: ../../c-api/typeobj.rst:779 +#: ../../c-api/typeobj.rst:757 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, " @@ -1689,7 +1661,7 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:785 ../../c-api/typeobj.rst:986 +#: ../../c-api/typeobj.rst:763 ../../c-api/typeobj.rst:968 msgid "" "Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject." "tp_setattro`" @@ -1697,7 +1669,7 @@ msgstr "" "群組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject." "tp_setattro`" -#: ../../c-api/typeobj.rst:787 +#: ../../c-api/typeobj.rst:765 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " @@ -1706,38 +1678,38 @@ msgid "" "tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:794 +#: ../../c-api/typeobj.rst:772 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement :term:`awaitable` and :term:`asynchronous iterator` " "protocols at the C-level. See :ref:`async-structs` for details." msgstr "" -#: ../../c-api/typeobj.rst:798 +#: ../../c-api/typeobj.rst:776 msgid "Formerly known as ``tp_compare`` and ``tp_reserved``." msgstr "" -#: ../../c-api/typeobj.rst:803 +#: ../../c-api/typeobj.rst:781 msgid "" "The :c:member:`~PyTypeObject.tp_as_async` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:811 +#: ../../c-api/typeobj.rst:789 msgid "" "An optional pointer to a function that implements the built-in function :" "func:`repr`." msgstr "" -#: ../../c-api/typeobj.rst:814 +#: ../../c-api/typeobj.rst:792 msgid "The signature is the same as for :c:func:`PyObject_Repr`::" msgstr "" -#: ../../c-api/typeobj.rst:816 +#: ../../c-api/typeobj.rst:794 msgid "PyObject *tp_repr(PyObject *self);" msgstr "PyObject *tp_repr(PyObject *self);" -#: ../../c-api/typeobj.rst:818 +#: ../../c-api/typeobj.rst:796 msgid "" "The function must return a string or a Unicode object. Ideally, this " "function should return a string that, when passed to :func:`eval`, given a " @@ -1746,85 +1718,85 @@ msgid "" "``'>'`` from which both the type and the value of the object can be deduced." msgstr "" -#: ../../c-api/typeobj.rst:829 ../../c-api/typeobj.rst:941 -#: ../../c-api/typeobj.rst:966 ../../c-api/typeobj.rst:992 -#: ../../c-api/typeobj.rst:1033 ../../c-api/typeobj.rst:1562 -#: ../../c-api/typeobj.rst:1596 ../../c-api/typeobj.rst:1713 -#: ../../c-api/typeobj.rst:1746 ../../c-api/typeobj.rst:1821 -#: ../../c-api/typeobj.rst:1862 ../../c-api/typeobj.rst:1880 -#: ../../c-api/typeobj.rst:1922 ../../c-api/typeobj.rst:1943 -#: ../../c-api/typeobj.rst:1974 +#: ../../c-api/typeobj.rst:807 ../../c-api/typeobj.rst:886 +#: ../../c-api/typeobj.rst:923 ../../c-api/typeobj.rst:948 +#: ../../c-api/typeobj.rst:974 ../../c-api/typeobj.rst:1015 +#: ../../c-api/typeobj.rst:1570 ../../c-api/typeobj.rst:1604 +#: ../../c-api/typeobj.rst:1721 ../../c-api/typeobj.rst:1754 +#: ../../c-api/typeobj.rst:1829 ../../c-api/typeobj.rst:1870 +#: ../../c-api/typeobj.rst:1888 ../../c-api/typeobj.rst:1930 +#: ../../c-api/typeobj.rst:1951 ../../c-api/typeobj.rst:1982 msgid "**Default:**" msgstr "**預設:**" -#: ../../c-api/typeobj.rst:831 +#: ../../c-api/typeobj.rst:809 msgid "" "When this field is not set, a string of the form ``<%s object at %p>`` is " "returned, where ``%s`` is replaced by the type name, and ``%p`` by the " "object's memory address." msgstr "" -#: ../../c-api/typeobj.rst:838 +#: ../../c-api/typeobj.rst:816 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the number protocol. These fields are documented " "in :ref:`number-structs`." msgstr "" -#: ../../c-api/typeobj.rst:844 +#: ../../c-api/typeobj.rst:822 msgid "" "The :c:member:`~PyTypeObject.tp_as_number` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:850 +#: ../../c-api/typeobj.rst:828 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the sequence protocol. These fields are documented " "in :ref:`sequence-structs`." msgstr "" -#: ../../c-api/typeobj.rst:856 +#: ../../c-api/typeobj.rst:834 msgid "" "The :c:member:`~PyTypeObject.tp_as_sequence` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:862 +#: ../../c-api/typeobj.rst:840 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the mapping protocol. These fields are documented " "in :ref:`mapping-structs`." msgstr "" -#: ../../c-api/typeobj.rst:868 +#: ../../c-api/typeobj.rst:846 msgid "" "The :c:member:`~PyTypeObject.tp_as_mapping` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:876 +#: ../../c-api/typeobj.rst:854 msgid "" "An optional pointer to a function that implements the built-in function :" "func:`hash`." msgstr "" -#: ../../c-api/typeobj.rst:879 +#: ../../c-api/typeobj.rst:857 msgid "The signature is the same as for :c:func:`PyObject_Hash`::" msgstr "" -#: ../../c-api/typeobj.rst:881 +#: ../../c-api/typeobj.rst:859 msgid "Py_hash_t tp_hash(PyObject *);" msgstr "Py_hash_t tp_hash(PyObject *);" -#: ../../c-api/typeobj.rst:883 +#: ../../c-api/typeobj.rst:861 msgid "" "The value ``-1`` should not be returned as a normal return value; when an " "error occurs during the computation of the hash value, the function should " "set an exception and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:887 +#: ../../c-api/typeobj.rst:865 msgid "" "When this field is not set (*and* :c:member:`~PyTypeObject.tp_richcompare` " "is not set), an attempt to take the hash of the object raises :exc:" @@ -1832,7 +1804,7 @@ msgid "" "`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:891 +#: ../../c-api/typeobj.rst:869 msgid "" "This field can be set explicitly to :c:func:`PyObject_HashNotImplemented` to " "block inheritance of the hash method from a parent type. This is interpreted " @@ -1843,7 +1815,7 @@ msgid "" "`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:901 ../../c-api/typeobj.rst:1555 +#: ../../c-api/typeobj.rst:879 ../../c-api/typeobj.rst:1563 msgid "" "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject." "tp_richcompare`" @@ -1851,7 +1823,7 @@ msgstr "" "群組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject." "tp_richcompare`" -#: ../../c-api/typeobj.rst:903 +#: ../../c-api/typeobj.rst:881 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_richcompare`: a subtype inherits both of :c:member:`~PyTypeObject." @@ -1860,18 +1832,22 @@ msgid "" "are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:911 +#: ../../c-api/typeobj.rst:888 +msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericHash`." +msgstr "" + +#: ../../c-api/typeobj.rst:893 msgid "" "An optional pointer to a function that implements calling the object. This " "should be ``NULL`` if the object is not callable. The signature is the same " "as for :c:func:`PyObject_Call`::" msgstr "" -#: ../../c-api/typeobj.rst:915 +#: ../../c-api/typeobj.rst:897 msgid "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" msgstr "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" -#: ../../c-api/typeobj.rst:924 +#: ../../c-api/typeobj.rst:906 msgid "" "An optional pointer to a function that implements the built-in operation :" "func:`str`. (Note that :class:`str` is a type now, and :func:`str` calls " @@ -1880,15 +1856,15 @@ msgid "" "this handler.)" msgstr "" -#: ../../c-api/typeobj.rst:929 +#: ../../c-api/typeobj.rst:911 msgid "The signature is the same as for :c:func:`PyObject_Str`::" msgstr "" -#: ../../c-api/typeobj.rst:931 +#: ../../c-api/typeobj.rst:913 msgid "PyObject *tp_str(PyObject *self);" msgstr "PyObject *tp_str(PyObject *self);" -#: ../../c-api/typeobj.rst:933 +#: ../../c-api/typeobj.rst:915 msgid "" "The function must return a string or a Unicode object. It should be a " "\"friendly\" string representation of the object, as this is the " @@ -1896,32 +1872,32 @@ msgid "" "function." msgstr "" -#: ../../c-api/typeobj.rst:943 +#: ../../c-api/typeobj.rst:925 msgid "" "When this field is not set, :c:func:`PyObject_Repr` is called to return a " "string representation." msgstr "" -#: ../../c-api/typeobj.rst:949 +#: ../../c-api/typeobj.rst:931 msgid "An optional pointer to the get-attribute function." msgstr "" -#: ../../c-api/typeobj.rst:951 +#: ../../c-api/typeobj.rst:933 msgid "The signature is the same as for :c:func:`PyObject_GetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:953 +#: ../../c-api/typeobj.rst:935 msgid "PyObject *tp_getattro(PyObject *self, PyObject *attr);" msgstr "PyObject *tp_getattro(PyObject *self, PyObject *attr);" -#: ../../c-api/typeobj.rst:955 +#: ../../c-api/typeobj.rst:937 msgid "" "It is usually convenient to set this field to :c:func:" "`PyObject_GenericGetAttr`, which implements the normal way of looking for " "object attributes." msgstr "" -#: ../../c-api/typeobj.rst:962 +#: ../../c-api/typeobj.rst:944 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_getattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " @@ -1930,19 +1906,19 @@ msgid "" "tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:968 +#: ../../c-api/typeobj.rst:950 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:975 +#: ../../c-api/typeobj.rst:957 msgid "The signature is the same as for :c:func:`PyObject_SetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:977 +#: ../../c-api/typeobj.rst:959 msgid "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" msgstr "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" -#: ../../c-api/typeobj.rst:979 +#: ../../c-api/typeobj.rst:961 msgid "" "In addition, setting *value* to ``NULL`` to delete an attribute must be " "supported. It is usually convenient to set this field to :c:func:" @@ -1950,7 +1926,7 @@ msgid "" "attributes." msgstr "" -#: ../../c-api/typeobj.rst:988 +#: ../../c-api/typeobj.rst:970 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_setattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " @@ -1959,24 +1935,24 @@ msgid "" "tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:994 +#: ../../c-api/typeobj.rst:976 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:999 +#: ../../c-api/typeobj.rst:981 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the buffer interface. These fields are documented " "in :ref:`buffer-structs`." msgstr "" -#: ../../c-api/typeobj.rst:1005 +#: ../../c-api/typeobj.rst:987 msgid "" "The :c:member:`~PyTypeObject.tp_as_buffer` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:1011 +#: ../../c-api/typeobj.rst:993 msgid "" "This field is a bit mask of various flags. Some flags indicate variant " "semantics for certain situations; others are used to indicate that certain " @@ -1988,7 +1964,7 @@ msgid "" "accessed and must be considered to have a zero or ``NULL`` value instead." msgstr "" -#: ../../c-api/typeobj.rst:1021 +#: ../../c-api/typeobj.rst:1003 msgid "" "Inheritance of this field is complicated. Most flag bits are inherited " "individually, i.e. if the base type has a flag bit set, the subtype inherits " @@ -2004,7 +1980,7 @@ msgid "" "*really* inherited individually?" msgstr "" -#: ../../c-api/typeobj.rst:1035 +#: ../../c-api/typeobj.rst:1017 msgid "" ":c:data:`PyBaseObject_Type` uses ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``." @@ -2012,11 +1988,11 @@ msgstr "" ":c:data:`PyBaseObject_Type` 使用 ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``。" -#: ../../c-api/typeobj.rst:1038 +#: ../../c-api/typeobj.rst:1020 msgid "**Bit Masks:**" msgstr "" -#: ../../c-api/typeobj.rst:1042 +#: ../../c-api/typeobj.rst:1024 msgid "" "The following bit masks are currently defined; these can be ORed together " "using the ``|`` operator to form the value of the :c:member:`~PyTypeObject." @@ -2025,7 +2001,7 @@ msgid "" "zero." msgstr "" -#: ../../c-api/typeobj.rst:1049 +#: ../../c-api/typeobj.rst:1031 msgid "" "This bit is set when the type object itself is allocated on the heap, for " "example, types created dynamically using :c:func:`PyType_FromSpec`. In this " @@ -2038,32 +2014,32 @@ msgid "" "reference cycle with their own module object." msgstr "" -#: ../../c-api/typeobj.rst:1060 ../../c-api/typeobj.rst:1071 -#: ../../c-api/typeobj.rst:1081 ../../c-api/typeobj.rst:1091 -#: ../../c-api/typeobj.rst:1123 +#: ../../c-api/typeobj.rst:1042 ../../c-api/typeobj.rst:1053 +#: ../../c-api/typeobj.rst:1063 ../../c-api/typeobj.rst:1073 +#: ../../c-api/typeobj.rst:1105 msgid "???" msgstr "???" -#: ../../c-api/typeobj.rst:1065 +#: ../../c-api/typeobj.rst:1047 msgid "" "This bit is set when the type can be used as the base type of another type. " "If this bit is clear, the type cannot be subtyped (similar to a \"final\" " "class in Java)." msgstr "" -#: ../../c-api/typeobj.rst:1076 +#: ../../c-api/typeobj.rst:1058 msgid "" "This bit is set when the type object has been fully initialized by :c:func:" "`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1086 +#: ../../c-api/typeobj.rst:1068 msgid "" "This bit is set while :c:func:`PyType_Ready` is in the process of " "initializing the type object." msgstr "" -#: ../../c-api/typeobj.rst:1096 +#: ../../c-api/typeobj.rst:1078 msgid "" "This bit is set when the object supports garbage collection. If this bit is " "set, instances must be created using :c:macro:`PyObject_GC_New` and " @@ -2073,14 +2049,14 @@ msgid "" "tp_clear` are present in the type object." msgstr "" -#: ../../c-api/typeobj.rst:1105 ../../c-api/typeobj.rst:1426 -#: ../../c-api/typeobj.rst:1494 +#: ../../c-api/typeobj.rst:1087 ../../c-api/typeobj.rst:1428 +#: ../../c-api/typeobj.rst:1502 msgid "" "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject." "tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" msgstr "" -#: ../../c-api/typeobj.rst:1107 +#: ../../c-api/typeobj.rst:1089 msgid "" "The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with the :c:" "member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` " @@ -2090,99 +2066,105 @@ msgid "" "values." msgstr "" -#: ../../c-api/typeobj.rst:1117 +#: ../../c-api/typeobj.rst:1099 msgid "" "This is a bitmask of all the bits that pertain to the existence of certain " "fields in the type object and its extension structures. Currently, it " "includes the following bits: :c:macro:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`." msgstr "" -#: ../../c-api/typeobj.rst:1128 +#: ../../c-api/typeobj.rst:1110 msgid "This bit indicates that objects behave like unbound methods." msgstr "" -#: ../../c-api/typeobj.rst:1130 +#: ../../c-api/typeobj.rst:1112 msgid "If this flag is set for ``type(meth)``, then:" msgstr "" -#: ../../c-api/typeobj.rst:1132 +#: ../../c-api/typeobj.rst:1114 msgid "" "``meth.__get__(obj, cls)(*args, **kwds)`` (with ``obj`` not None) must be " "equivalent to ``meth(obj, *args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1135 +#: ../../c-api/typeobj.rst:1117 msgid "" "``meth.__get__(None, cls)(*args, **kwds)`` must be equivalent to " "``meth(*args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1138 +#: ../../c-api/typeobj.rst:1120 msgid "" "This flag enables an optimization for typical method calls like ``obj." "meth()``: it avoids creating a temporary \"bound method\" object for ``obj." "meth``." msgstr "" -#: ../../c-api/typeobj.rst:1146 +#: ../../c-api/typeobj.rst:1128 msgid "" "This flag is never inherited by types without the :c:macro:" "`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it is inherited " "whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1152 +#: ../../c-api/typeobj.rst:1134 msgid "" "This bit indicates that instances of the class have a ``__dict__`` " "attribute, and that the space for the dictionary is managed by the VM." msgstr "" -#: ../../c-api/typeobj.rst:1155 +#: ../../c-api/typeobj.rst:1137 msgid "If this flag is set, :c:macro:`Py_TPFLAGS_HAVE_GC` should also be set." msgstr "" -#: ../../c-api/typeobj.rst:1161 +#: ../../c-api/typeobj.rst:1139 +msgid "" +"The type traverse function must call :c:func:`PyObject_VisitManagedDict` and " +"its clear function must call :c:func:`PyObject_ClearManagedDict`." +msgstr "" + +#: ../../c-api/typeobj.rst:1146 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject.tp_dictoffset` " "field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1167 +#: ../../c-api/typeobj.rst:1152 msgid "" "This bit indicates that instances of the class should be weakly " "referenceable." msgstr "" -#: ../../c-api/typeobj.rst:1174 +#: ../../c-api/typeobj.rst:1159 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject." "tp_weaklistoffset` field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1180 +#: ../../c-api/typeobj.rst:1165 msgid "" "Only usable with variable-size types, i.e. ones with non-zero :c:member:" "`~PyTypeObject.tp_itemsize`." msgstr "" -#: ../../c-api/typeobj.rst:1183 +#: ../../c-api/typeobj.rst:1168 msgid "" "Indicates that the variable-sized portion of an instance of this type is at " "the end of the instance's memory area, at an offset of ``Py_TYPE(obj)-" ">tp_basicsize`` (which may be different in each subclass)." msgstr "" -#: ../../c-api/typeobj.rst:1188 +#: ../../c-api/typeobj.rst:1173 msgid "" "When setting this flag, be sure that all superclasses either use this memory " "layout, or are not variable-sized. Python does not check this." msgstr "" -#: ../../c-api/typeobj.rst:1196 +#: ../../c-api/typeobj.rst:1181 msgid "This flag is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1210 +#: ../../c-api/typeobj.rst:1195 msgid "" "These flags are used by functions such as :c:func:`PyLong_Check` to quickly " "determine if a type is a subclass of a built-in type; such specific checks " @@ -2192,90 +2174,90 @@ msgid "" "behave differently depending on what kind of check is used." msgstr "" -#: ../../c-api/typeobj.rst:1221 +#: ../../c-api/typeobj.rst:1206 msgid "" "This bit is set when the :c:member:`~PyTypeObject.tp_finalize` slot is " "present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1226 +#: ../../c-api/typeobj.rst:1211 msgid "" "This flag isn't necessary anymore, as the interpreter assumes the :c:member:" "`~PyTypeObject.tp_finalize` slot is always present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1234 +#: ../../c-api/typeobj.rst:1219 msgid "" "This bit is set when the class implements the :ref:`vectorcall protocol " "`. See :c:member:`~PyTypeObject.tp_vectorcall_offset` for " "details." msgstr "" -#: ../../c-api/typeobj.rst:1240 +#: ../../c-api/typeobj.rst:1225 msgid "" "This bit is inherited if :c:member:`~PyTypeObject.tp_call` is also inherited." msgstr "" -#: ../../c-api/typeobj.rst:1247 +#: ../../c-api/typeobj.rst:1232 msgid "" "This flag is now removed from a class when the class's :py:meth:`~object." "__call__` method is reassigned." msgstr "" -#: ../../c-api/typeobj.rst:1250 +#: ../../c-api/typeobj.rst:1235 msgid "This flag can now be inherited by mutable classes." msgstr "" -#: ../../c-api/typeobj.rst:1254 +#: ../../c-api/typeobj.rst:1239 msgid "" "This bit is set for type objects that are immutable: type attributes cannot " "be set nor deleted." msgstr "" -#: ../../c-api/typeobj.rst:1256 +#: ../../c-api/typeobj.rst:1241 msgid "" ":c:func:`PyType_Ready` automatically applies this flag to :ref:`static types " "`." msgstr "" -#: ../../c-api/typeobj.rst:1261 +#: ../../c-api/typeobj.rst:1246 msgid "This flag is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:1267 +#: ../../c-api/typeobj.rst:1252 msgid "" "Disallow creating instances of the type: set :c:member:`~PyTypeObject." "tp_new` to NULL and don't create the ``__new__`` key in the type dictionary." msgstr "" -#: ../../c-api/typeobj.rst:1271 +#: ../../c-api/typeobj.rst:1256 msgid "" "The flag must be set before creating the type, not after. For example, it " "must be set before :c:func:`PyType_Ready` is called on the type." msgstr "" -#: ../../c-api/typeobj.rst:1274 +#: ../../c-api/typeobj.rst:1259 msgid "" "The flag is set automatically on :ref:`static types ` if :c:" "member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` and :c:" "member:`~PyTypeObject.tp_new` is NULL." msgstr "" -#: ../../c-api/typeobj.rst:1280 +#: ../../c-api/typeobj.rst:1265 msgid "" "This flag is not inherited. However, subclasses will not be instantiable " "unless they provide a non-NULL :c:member:`~PyTypeObject.tp_new` (which is " "only possible via the C API)." msgstr "" -#: ../../c-api/typeobj.rst:1287 +#: ../../c-api/typeobj.rst:1272 msgid "" "To disallow instantiating a class directly but allow instantiating its " "subclasses (e.g. for an :term:`abstract base class`), do not use this flag. " "Instead, make :c:member:`~PyTypeObject.tp_new` only succeed for subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1298 +#: ../../c-api/typeobj.rst:1283 msgid "" "This bit indicates that instances of the class may match mapping patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2283,23 +2265,23 @@ msgid "" "unset when registering :class:`collections.abc.Sequence`." msgstr "" -#: ../../c-api/typeobj.rst:1305 ../../c-api/typeobj.rst:1327 +#: ../../c-api/typeobj.rst:1290 ../../c-api/typeobj.rst:1312 msgid "" ":c:macro:`Py_TPFLAGS_MAPPING` and :c:macro:`Py_TPFLAGS_SEQUENCE` are " "mutually exclusive; it is an error to enable both flags simultaneously." msgstr "" -#: ../../c-api/typeobj.rst:1310 +#: ../../c-api/typeobj.rst:1295 msgid "" "This flag is inherited by types that do not already set :c:macro:" "`Py_TPFLAGS_SEQUENCE`." msgstr "" -#: ../../c-api/typeobj.rst:1313 ../../c-api/typeobj.rst:1335 +#: ../../c-api/typeobj.rst:1298 ../../c-api/typeobj.rst:1320 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: ../../c-api/typeobj.rst:1320 +#: ../../c-api/typeobj.rst:1305 msgid "" "This bit indicates that instances of the class may match sequence patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2307,53 +2289,53 @@ msgid "" "unset when registering :class:`collections.abc.Mapping`." msgstr "" -#: ../../c-api/typeobj.rst:1332 +#: ../../c-api/typeobj.rst:1317 msgid "" "This flag is inherited by types that do not already set :c:macro:" "`Py_TPFLAGS_MAPPING`." msgstr "" -#: ../../c-api/typeobj.rst:1342 +#: ../../c-api/typeobj.rst:1327 msgid "" "Internal. Do not set or unset this flag. To indicate that a class has " "changed call :c:func:`PyType_Modified`" msgstr "" -#: ../../c-api/typeobj.rst:1346 +#: ../../c-api/typeobj.rst:1331 msgid "" -"This flag is present in header files, but is an internal feature and should " -"not be used. It will be removed in a future version of CPython" +"This flag is present in header files, but is not be used. It will be removed " +"in a future version of CPython" msgstr "" -#: ../../c-api/typeobj.rst:1352 +#: ../../c-api/typeobj.rst:1337 msgid "" "An optional pointer to a NUL-terminated C string giving the docstring for " "this type object. This is exposed as the :attr:`__doc__` attribute on the " "type and instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:1358 +#: ../../c-api/typeobj.rst:1343 msgid "This field is *not* inherited by subtypes." msgstr "" -#: ../../c-api/typeobj.rst:1363 +#: ../../c-api/typeobj.rst:1348 msgid "" "An optional pointer to a traversal function for the garbage collector. This " "is only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1366 +#: ../../c-api/typeobj.rst:1351 msgid "int tp_traverse(PyObject *self, visitproc visit, void *arg);" msgstr "int tp_traverse(PyObject *self, visitproc visit, void *arg);" -#: ../../c-api/typeobj.rst:1368 ../../c-api/typeobj.rst:1489 +#: ../../c-api/typeobj.rst:1353 ../../c-api/typeobj.rst:1497 msgid "" "More information about Python's garbage collection scheme can be found in " "section :ref:`supporting-cycle-detection`." msgstr "" -#: ../../c-api/typeobj.rst:1371 +#: ../../c-api/typeobj.rst:1356 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage " "collector to detect reference cycles. A typical implementation of a :c:" @@ -2363,7 +2345,7 @@ msgid "" "`!_thread` extension module::" msgstr "" -#: ../../c-api/typeobj.rst:1377 +#: ../../c-api/typeobj.rst:1362 msgid "" "static int\n" "local_traverse(localobject *self, visitproc visit, void *arg)\n" @@ -2383,7 +2365,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1386 +#: ../../c-api/typeobj.rst:1371 msgid "" "Note that :c:func:`Py_VISIT` is called only on those members that can " "participate in reference cycles. Although there is also a ``self->key`` " @@ -2391,14 +2373,48 @@ msgid "" "part of a reference cycle." msgstr "" -#: ../../c-api/typeobj.rst:1390 +#: ../../c-api/typeobj.rst:1375 msgid "" "On the other hand, even if you know a member can never be part of a cycle, " "as a debugging aid you may want to visit it anyway just so the :mod:`gc` " "module's :func:`~gc.get_referents` function will include it." msgstr "" -#: ../../c-api/typeobj.rst:1395 +#: ../../c-api/typeobj.rst:1379 +msgid "" +"Heap types (:c:macro:`Py_TPFLAGS_HEAPTYPE`) must visit their type with::" +msgstr "" + +#: ../../c-api/typeobj.rst:1381 +msgid "Py_VISIT(Py_TYPE(self));" +msgstr "" + +#: ../../c-api/typeobj.rst:1383 +msgid "" +"It is only needed since Python 3.9. To support Python 3.8 and older, this " +"line must be conditional::" +msgstr "" + +#: ../../c-api/typeobj.rst:1386 +msgid "" +"#if PY_VERSION_HEX >= 0x03090000\n" +" Py_VISIT(Py_TYPE(self));\n" +"#endif" +msgstr "" + +#: ../../c-api/typeobj.rst:1390 +msgid "" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" +"`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" +"`PyObject_VisitManagedDict` like this::" +msgstr "" + +#: ../../c-api/typeobj.rst:1394 +#, fuzzy +msgid "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" +msgstr "PyObject *tp_iternext(PyObject *self);" + +#: ../../c-api/typeobj.rst:1397 msgid "" "When implementing :c:member:`~PyTypeObject.tp_traverse`, only the members " "that the instance *owns* (by having :term:`strong references ` hold a reference to " "their type. Their traversal function must therefore either visit :c:func:" @@ -2427,14 +2443,14 @@ msgid "" "superclass). If they do not, the type object may not be garbage-collected." msgstr "" -#: ../../c-api/typeobj.rst:1419 +#: ../../c-api/typeobj.rst:1421 msgid "" "Heap-allocated types are expected to visit ``Py_TYPE(self)`` in " "``tp_traverse``. In earlier versions of Python, due to `bug 40217 `_, doing this may lead to crashes in subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1428 +#: ../../c-api/typeobj.rst:1430 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_clear` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:" @@ -2442,18 +2458,18 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1436 +#: ../../c-api/typeobj.rst:1438 msgid "" "An optional pointer to a clear function for the garbage collector. This is " "only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1439 +#: ../../c-api/typeobj.rst:1441 msgid "int tp_clear(PyObject *);" msgstr "int tp_clear(PyObject *);" -#: ../../c-api/typeobj.rst:1441 +#: ../../c-api/typeobj.rst:1443 msgid "" "The :c:member:`~PyTypeObject.tp_clear` member function is used to break " "reference cycles in cyclic garbage detected by the garbage collector. Taken " @@ -2468,7 +2484,7 @@ msgid "" "good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1451 +#: ../../c-api/typeobj.rst:1453 msgid "" "Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the " "instance's references to those of its members that may be Python objects, " @@ -2476,7 +2492,7 @@ msgid "" "example::" msgstr "" -#: ../../c-api/typeobj.rst:1455 +#: ../../c-api/typeobj.rst:1457 msgid "" "static int\n" "local_clear(localobject *self)\n" @@ -2498,7 +2514,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1465 +#: ../../c-api/typeobj.rst:1467 msgid "" "The :c:func:`Py_CLEAR` macro should be used, because clearing references is " "delicate: the reference to the contained object must not be released (via :" @@ -2513,7 +2529,19 @@ msgid "" "performs the operations in a safe order." msgstr "" -#: ../../c-api/typeobj.rst:1477 +#: ../../c-api/typeobj.rst:1479 +msgid "" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" +"`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" +"`PyObject_ClearManagedDict` like this::" +msgstr "" + +#: ../../c-api/typeobj.rst:1483 +#, fuzzy +msgid "PyObject_ClearManagedDict((PyObject*)self);" +msgstr "PyObject *am_anext(PyObject *self);" + +#: ../../c-api/typeobj.rst:1485 msgid "" "Note that :c:member:`~PyTypeObject.tp_clear` is not *always* called before " "an instance is deallocated. For example, when reference counting is enough " @@ -2521,7 +2549,7 @@ msgid "" "is not involved and :c:member:`~PyTypeObject.tp_dealloc` is called directly." msgstr "" -#: ../../c-api/typeobj.rst:1483 +#: ../../c-api/typeobj.rst:1491 msgid "" "Because the goal of :c:member:`~PyTypeObject.tp_clear` functions is to break " "reference cycles, it's not necessary to clear contained objects like Python " @@ -2531,7 +2559,7 @@ msgid "" "invoke :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1496 +#: ../../c-api/typeobj.rst:1504 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_traverse` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :" @@ -2539,22 +2567,22 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1504 +#: ../../c-api/typeobj.rst:1512 msgid "" "An optional pointer to the rich comparison function, whose signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1506 +#: ../../c-api/typeobj.rst:1514 msgid "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" msgstr "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" -#: ../../c-api/typeobj.rst:1508 +#: ../../c-api/typeobj.rst:1516 msgid "" "The first parameter is guaranteed to be an instance of the type that is " "defined by :c:type:`PyTypeObject`." msgstr "" -#: ../../c-api/typeobj.rst:1511 +#: ../../c-api/typeobj.rst:1519 msgid "" "The function should return the result of the comparison (usually ``Py_True`` " "or ``Py_False``). If the comparison is undefined, it must return " @@ -2562,50 +2590,50 @@ msgid "" "set an exception condition." msgstr "" -#: ../../c-api/typeobj.rst:1516 +#: ../../c-api/typeobj.rst:1524 msgid "" "The following constants are defined to be used as the third argument for :c:" "member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:" msgstr "" -#: ../../c-api/typeobj.rst:1522 +#: ../../c-api/typeobj.rst:1530 msgid "Constant" msgstr "常數" -#: ../../c-api/typeobj.rst:1522 +#: ../../c-api/typeobj.rst:1530 msgid "Comparison" msgstr "" -#: ../../c-api/typeobj.rst:1524 +#: ../../c-api/typeobj.rst:1532 msgid "``<``" msgstr "``<``" -#: ../../c-api/typeobj.rst:1526 +#: ../../c-api/typeobj.rst:1534 msgid "``<=``" msgstr "``<=``" -#: ../../c-api/typeobj.rst:1528 +#: ../../c-api/typeobj.rst:1536 msgid "``==``" msgstr "``==``" -#: ../../c-api/typeobj.rst:1530 +#: ../../c-api/typeobj.rst:1538 msgid "``!=``" msgstr "``!=``" -#: ../../c-api/typeobj.rst:1532 +#: ../../c-api/typeobj.rst:1540 msgid "``>``" msgstr "``>``" -#: ../../c-api/typeobj.rst:1534 +#: ../../c-api/typeobj.rst:1542 msgid "``>=``" msgstr "``>=``" -#: ../../c-api/typeobj.rst:1537 +#: ../../c-api/typeobj.rst:1545 msgid "" "The following macro is defined to ease writing rich comparison functions:" msgstr "" -#: ../../c-api/typeobj.rst:1541 +#: ../../c-api/typeobj.rst:1549 msgid "" "Return ``Py_True`` or ``Py_False`` from the function, depending on the " "result of a comparison. VAL_A and VAL_B must be orderable by C comparison " @@ -2613,15 +2641,15 @@ msgid "" "specifies the requested operation, as for :c:func:`PyObject_RichCompare`." msgstr "" -#: ../../c-api/typeobj.rst:1547 +#: ../../c-api/typeobj.rst:1555 msgid "The returned value is a new :term:`strong reference`." msgstr "" -#: ../../c-api/typeobj.rst:1549 +#: ../../c-api/typeobj.rst:1557 msgid "On error, sets an exception and returns ``NULL`` from the function." msgstr "" -#: ../../c-api/typeobj.rst:1557 +#: ../../c-api/typeobj.rst:1565 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" @@ -2629,7 +2657,7 @@ msgid "" "tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1564 +#: ../../c-api/typeobj.rst:1572 msgid "" ":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject." "tp_richcompare` implementation, which may be inherited. However, if only :c:" @@ -2638,13 +2666,13 @@ msgid "" "comparisons." msgstr "" -#: ../../c-api/typeobj.rst:1573 +#: ../../c-api/typeobj.rst:1581 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1576 +#: ../../c-api/typeobj.rst:1584 msgid "" "If the instances of this type are weakly referenceable, this field is " "greater than zero and contains the offset in the instance structure of the " @@ -2654,19 +2682,19 @@ msgid "" "`PyObject*` which is initialized to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1583 +#: ../../c-api/typeobj.rst:1591 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_weaklist`; that " "is the list head for weak references to the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1586 +#: ../../c-api/typeobj.rst:1594 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " "and :c:member:`~PyTypeObject.tp_weaklistoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1591 +#: ../../c-api/typeobj.rst:1599 msgid "" "This field is inherited by subtypes, but see the rules listed below. A " "subtype may override this offset; this means that the subtype uses a " @@ -2675,7 +2703,7 @@ msgid "" "not be a problem." msgstr "" -#: ../../c-api/typeobj.rst:1598 +#: ../../c-api/typeobj.rst:1606 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject." @@ -2683,32 +2711,32 @@ msgid "" "unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1606 +#: ../../c-api/typeobj.rst:1614 msgid "" "An optional pointer to a function that returns an :term:`iterator` for the " "object. Its presence normally signals that the instances of this type are :" "term:`iterable` (although sequences may be iterable without this function)." msgstr "" -#: ../../c-api/typeobj.rst:1610 +#: ../../c-api/typeobj.rst:1618 msgid "This function has the same signature as :c:func:`PyObject_GetIter`::" msgstr "" -#: ../../c-api/typeobj.rst:1612 +#: ../../c-api/typeobj.rst:1620 msgid "PyObject *tp_iter(PyObject *self);" msgstr "PyObject *tp_iter(PyObject *self);" -#: ../../c-api/typeobj.rst:1621 +#: ../../c-api/typeobj.rst:1629 msgid "" "An optional pointer to a function that returns the next item in an :term:" "`iterator`. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1624 +#: ../../c-api/typeobj.rst:1632 msgid "PyObject *tp_iternext(PyObject *self);" msgstr "PyObject *tp_iternext(PyObject *self);" -#: ../../c-api/typeobj.rst:1626 +#: ../../c-api/typeobj.rst:1634 msgid "" "When the iterator is exhausted, it must return ``NULL``; a :exc:" "`StopIteration` exception may or may not be set. When another error occurs, " @@ -2716,74 +2744,74 @@ msgid "" "this type are iterators." msgstr "" -#: ../../c-api/typeobj.rst:1631 +#: ../../c-api/typeobj.rst:1639 msgid "" "Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` " "function, and that function should return the iterator instance itself (not " "a new iterator instance)." msgstr "" -#: ../../c-api/typeobj.rst:1635 +#: ../../c-api/typeobj.rst:1643 msgid "This function has the same signature as :c:func:`PyIter_Next`." msgstr "" -#: ../../c-api/typeobj.rst:1644 +#: ../../c-api/typeobj.rst:1652 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMethodDef` structures, declaring regular methods of this type." msgstr "" -#: ../../c-api/typeobj.rst:1647 +#: ../../c-api/typeobj.rst:1655 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1652 +#: ../../c-api/typeobj.rst:1660 msgid "" "This field is not inherited by subtypes (methods are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1658 +#: ../../c-api/typeobj.rst:1666 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMemberDef` structures, declaring regular data members (fields or slots) " "of instances of this type." msgstr "" -#: ../../c-api/typeobj.rst:1662 +#: ../../c-api/typeobj.rst:1670 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1667 +#: ../../c-api/typeobj.rst:1675 msgid "" "This field is not inherited by subtypes (members are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1673 +#: ../../c-api/typeobj.rst:1681 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyGetSetDef` structures, declaring computed attributes of instances of this " "type." msgstr "" -#: ../../c-api/typeobj.rst:1676 +#: ../../c-api/typeobj.rst:1684 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a getset descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1681 +#: ../../c-api/typeobj.rst:1689 msgid "" "This field is not inherited by subtypes (computed attributes are inherited " "through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1687 +#: ../../c-api/typeobj.rst:1695 msgid "" "An optional pointer to a base type from which type properties are " "inherited. At this level, only single inheritance is supported; multiple " @@ -2791,7 +2819,7 @@ msgid "" "metatype." msgstr "" -#: ../../c-api/typeobj.rst:1695 +#: ../../c-api/typeobj.rst:1703 msgid "" "Slot initialization is subject to the rules of initializing globals. C99 " "requires the initializers to be \"address constants\". Function designators " @@ -2799,7 +2827,7 @@ msgid "" "valid C99 address constants." msgstr "" -#: ../../c-api/typeobj.rst:1700 +#: ../../c-api/typeobj.rst:1708 msgid "" "However, the unary '&' operator applied to a non-static variable like :c:" "data:`PyBaseObject_Type` is not required to produce an address constant. " @@ -2807,27 +2835,27 @@ msgid "" "strictly standard conforming in this particular behavior." msgstr "" -#: ../../c-api/typeobj.rst:1706 +#: ../../c-api/typeobj.rst:1714 msgid "" "Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the " "extension module's init function." msgstr "" -#: ../../c-api/typeobj.rst:1711 +#: ../../c-api/typeobj.rst:1719 msgid "This field is not inherited by subtypes (obviously)." msgstr "" -#: ../../c-api/typeobj.rst:1715 +#: ../../c-api/typeobj.rst:1723 msgid "" "This field defaults to ``&PyBaseObject_Type`` (which to Python programmers " "is known as the type :class:`object`)." msgstr "" -#: ../../c-api/typeobj.rst:1721 +#: ../../c-api/typeobj.rst:1729 msgid "The type's dictionary is stored here by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1723 +#: ../../c-api/typeobj.rst:1731 msgid "" "This field should normally be initialized to ``NULL`` before PyType_Ready is " "called; it may also be initialized to a dictionary containing initial " @@ -2838,73 +2866,73 @@ msgid "" "be treated as read-only." msgstr "" -#: ../../c-api/typeobj.rst:1731 +#: ../../c-api/typeobj.rst:1739 msgid "" "Some types may not store their dictionary in this slot. Use :c:func:" "`PyType_GetDict` to retrieve the dictionary for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1737 +#: ../../c-api/typeobj.rst:1745 msgid "" "Internals detail: For static builtin types, this is always ``NULL``. " "Instead, the dict for such types is stored on ``PyInterpreterState``. Use :c:" "func:`PyType_GetDict` to get the dict for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1743 +#: ../../c-api/typeobj.rst:1751 msgid "" "This field is not inherited by subtypes (though the attributes defined in " "here are inherited through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1748 +#: ../../c-api/typeobj.rst:1756 msgid "" "If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new " "dictionary to it." msgstr "" -#: ../../c-api/typeobj.rst:1753 +#: ../../c-api/typeobj.rst:1761 msgid "" "It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:" "member:`~PyTypeObject.tp_dict` with the dictionary C-API." msgstr "" -#: ../../c-api/typeobj.rst:1759 +#: ../../c-api/typeobj.rst:1767 msgid "An optional pointer to a \"descriptor get\" function." msgstr "" -#: ../../c-api/typeobj.rst:1761 ../../c-api/typeobj.rst:1777 -#: ../../c-api/typeobj.rst:1841 ../../c-api/typeobj.rst:1871 -#: ../../c-api/typeobj.rst:1895 +#: ../../c-api/typeobj.rst:1769 ../../c-api/typeobj.rst:1785 +#: ../../c-api/typeobj.rst:1849 ../../c-api/typeobj.rst:1879 +#: ../../c-api/typeobj.rst:1903 msgid "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1763 +#: ../../c-api/typeobj.rst:1771 msgid "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" msgstr "" "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" -#: ../../c-api/typeobj.rst:1774 +#: ../../c-api/typeobj.rst:1782 msgid "" "An optional pointer to a function for setting and deleting a descriptor's " "value." msgstr "" -#: ../../c-api/typeobj.rst:1779 +#: ../../c-api/typeobj.rst:1787 msgid "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" msgstr "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" -#: ../../c-api/typeobj.rst:1781 +#: ../../c-api/typeobj.rst:1789 msgid "The *value* argument is set to ``NULL`` to delete the value." msgstr "" -#: ../../c-api/typeobj.rst:1792 +#: ../../c-api/typeobj.rst:1800 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_DICT` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1795 +#: ../../c-api/typeobj.rst:1803 msgid "" "If the instances of this type have a dictionary containing instance " "variables, this field is non-zero and contains the offset in the instances " @@ -2912,19 +2940,19 @@ msgid "" "func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:1800 +#: ../../c-api/typeobj.rst:1808 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_dict`; that is " "the dictionary for attributes of the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1803 +#: ../../c-api/typeobj.rst:1811 msgid "" "The value specifies the offset of the dictionary from the start of the " "instance structure." msgstr "" -#: ../../c-api/typeobj.rst:1805 +#: ../../c-api/typeobj.rst:1813 msgid "" "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" "only. To get the pointer to the dictionary call :c:func:" @@ -2933,13 +2961,13 @@ msgid "" "to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" -#: ../../c-api/typeobj.rst:1811 +#: ../../c-api/typeobj.rst:1819 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " "and :c:member:`~PyTypeObject.tp_dictoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1816 +#: ../../c-api/typeobj.rst:1824 msgid "" "This field is inherited by subtypes. A subtype should not override this " "offset; doing so could be unsafe, if C code tries to access the dictionary " @@ -2947,25 +2975,25 @@ msgid "" "`Py_TPFLAGS_MANAGED_DICT`." msgstr "" -#: ../../c-api/typeobj.rst:1823 +#: ../../c-api/typeobj.rst:1831 msgid "" "This slot has no default. For :ref:`static types `, if the " "field is ``NULL`` then no :attr:`~object.__dict__` gets created for " "instances." msgstr "" -#: ../../c-api/typeobj.rst:1826 +#: ../../c-api/typeobj.rst:1834 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" -"`~PyTypeObject.tp_dict` field, then :c:member:`~PyTypeObject.tp_dictoffset` " +"`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_dictoffset` " "will be set to ``-1``, to indicate that it is unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1834 +#: ../../c-api/typeobj.rst:1842 msgid "An optional pointer to an instance initialization function." msgstr "" -#: ../../c-api/typeobj.rst:1836 +#: ../../c-api/typeobj.rst:1844 msgid "" "This function corresponds to the :meth:`~object.__init__` method of " "classes. Like :meth:`!__init__`, it is possible to create an instance " @@ -2973,18 +3001,18 @@ msgid "" "instance by calling its :meth:`!__init__` method again." msgstr "" -#: ../../c-api/typeobj.rst:1843 +#: ../../c-api/typeobj.rst:1851 msgid "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" msgstr "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1845 +#: ../../c-api/typeobj.rst:1853 msgid "" "The self argument is the instance to be initialized; the *args* and *kwds* " "arguments represent positional and keyword arguments of the call to :meth:" "`~object.__init__`." msgstr "" -#: ../../c-api/typeobj.rst:1849 +#: ../../c-api/typeobj.rst:1857 msgid "" "The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called " "when an instance is created normally by calling its type, after the type's :" @@ -2996,53 +3024,53 @@ msgid "" "subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" -#: ../../c-api/typeobj.rst:1856 +#: ../../c-api/typeobj.rst:1864 msgid "Returns ``0`` on success, ``-1`` and sets an exception on error." msgstr "" -#: ../../c-api/typeobj.rst:1864 +#: ../../c-api/typeobj.rst:1872 msgid "" "For :ref:`static types ` this field does not have a default." msgstr "" -#: ../../c-api/typeobj.rst:1869 +#: ../../c-api/typeobj.rst:1877 msgid "An optional pointer to an instance allocation function." msgstr "" -#: ../../c-api/typeobj.rst:1873 +#: ../../c-api/typeobj.rst:1881 msgid "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" msgstr "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" -#: ../../c-api/typeobj.rst:1877 +#: ../../c-api/typeobj.rst:1885 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)." msgstr "" -#: ../../c-api/typeobj.rst:1882 +#: ../../c-api/typeobj.rst:1890 msgid "" "For dynamic subtypes, this field is always set to :c:func:" "`PyType_GenericAlloc`, to force a standard heap allocation strategy." msgstr "" -#: ../../c-api/typeobj.rst:1886 +#: ../../c-api/typeobj.rst:1894 msgid "" "For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:" "`PyType_GenericAlloc`. That is the recommended value for all statically " "defined types." msgstr "" -#: ../../c-api/typeobj.rst:1893 +#: ../../c-api/typeobj.rst:1901 msgid "An optional pointer to an instance creation function." msgstr "" -#: ../../c-api/typeobj.rst:1897 +#: ../../c-api/typeobj.rst:1905 msgid "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" msgstr "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1899 +#: ../../c-api/typeobj.rst:1907 msgid "" "The *subtype* argument is the type of the object being created; the *args* " "and *kwds* arguments represent positional and keyword arguments of the call " @@ -3051,7 +3079,7 @@ msgid "" "that type (but not an unrelated type)." msgstr "" -#: ../../c-api/typeobj.rst:1905 +#: ../../c-api/typeobj.rst:1913 msgid "" "The :c:member:`~PyTypeObject.tp_new` function should call ``subtype-" ">tp_alloc(subtype, nitems)`` to allocate space for the object, and then do " @@ -3063,20 +3091,20 @@ msgid "" "be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" -#: ../../c-api/typeobj.rst:1913 +#: ../../c-api/typeobj.rst:1921 msgid "" "Set the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow " "creating instances of the type in Python." msgstr "" -#: ../../c-api/typeobj.rst:1918 +#: ../../c-api/typeobj.rst:1926 msgid "" "This field is inherited by subtypes, except it is not inherited by :ref:" "`static types ` whose :c:member:`~PyTypeObject.tp_base` is " "``NULL`` or ``&PyBaseObject_Type``." msgstr "" -#: ../../c-api/typeobj.rst:1924 +#: ../../c-api/typeobj.rst:1932 msgid "" "For :ref:`static types ` this field has no default. This means " "if the slot is defined as ``NULL``, the type cannot be called to create new " @@ -3084,44 +3112,44 @@ msgid "" "factory function." msgstr "" -#: ../../c-api/typeobj.rst:1932 +#: ../../c-api/typeobj.rst:1940 msgid "" "An optional pointer to an instance deallocation function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1934 +#: ../../c-api/typeobj.rst:1942 msgid "void tp_free(void *self);" msgstr "void tp_free(void *self);" -#: ../../c-api/typeobj.rst:1936 +#: ../../c-api/typeobj.rst:1944 msgid "" "An initializer that is compatible with this signature is :c:func:" "`PyObject_Free`." msgstr "" -#: ../../c-api/typeobj.rst:1940 +#: ../../c-api/typeobj.rst:1948 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)" msgstr "" -#: ../../c-api/typeobj.rst:1945 +#: ../../c-api/typeobj.rst:1953 msgid "" "In dynamic subtypes, this field is set to a deallocator suitable to match :c:" "func:`PyType_GenericAlloc` and the value of the :c:macro:" "`Py_TPFLAGS_HAVE_GC` flag bit." msgstr "" -#: ../../c-api/typeobj.rst:1949 +#: ../../c-api/typeobj.rst:1957 msgid "" "For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:`PyObject_Del`." msgstr "" -#: ../../c-api/typeobj.rst:1954 +#: ../../c-api/typeobj.rst:1962 msgid "An optional pointer to a function called by the garbage collector." msgstr "" -#: ../../c-api/typeobj.rst:1956 +#: ../../c-api/typeobj.rst:1964 msgid "" "The garbage collector needs to know whether a particular object is " "collectible or not. Normally, it is sufficient to look at the object's " @@ -3133,93 +3161,93 @@ msgid "" "instance. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1964 +#: ../../c-api/typeobj.rst:1972 msgid "int tp_is_gc(PyObject *self);" msgstr "int tp_is_gc(PyObject *self);" -#: ../../c-api/typeobj.rst:1966 +#: ../../c-api/typeobj.rst:1974 msgid "" "(The only example of this are types themselves. The metatype, :c:data:" "`PyType_Type`, defines this function to distinguish between statically and :" "ref:`dynamically allocated types `.)" msgstr "" -#: ../../c-api/typeobj.rst:1976 +#: ../../c-api/typeobj.rst:1984 msgid "" "This slot has no default. If this field is ``NULL``, :c:macro:" "`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." msgstr "" -#: ../../c-api/typeobj.rst:1982 +#: ../../c-api/typeobj.rst:1990 msgid "Tuple of base types." msgstr "" -#: ../../c-api/typeobj.rst:1984 ../../c-api/typeobj.rst:2008 +#: ../../c-api/typeobj.rst:1992 ../../c-api/typeobj.rst:2016 msgid "" "This field should be set to ``NULL`` and treated as read-only. Python will " "fill it in when the type is :c:func:`initialized `." msgstr "" -#: ../../c-api/typeobj.rst:1987 +#: ../../c-api/typeobj.rst:1995 msgid "" "For dynamically created classes, the ``Py_tp_bases`` :c:type:`slot " "` can be used instead of the *bases* argument of :c:func:" "`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" -#: ../../c-api/typeobj.rst:1994 +#: ../../c-api/typeobj.rst:2002 msgid "" "Multiple inheritance does not work well for statically defined types. If you " "set ``tp_bases`` to a tuple, Python will not raise an error, but some slots " "will only be inherited from the first base." msgstr "" -#: ../../c-api/typeobj.rst:2000 ../../c-api/typeobj.rst:2023 -#: ../../c-api/typeobj.rst:2040 ../../c-api/typeobj.rst:2057 -#: ../../c-api/typeobj.rst:2071 +#: ../../c-api/typeobj.rst:2008 ../../c-api/typeobj.rst:2031 +#: ../../c-api/typeobj.rst:2048 ../../c-api/typeobj.rst:2065 +#: ../../c-api/typeobj.rst:2079 msgid "This field is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:2005 +#: ../../c-api/typeobj.rst:2013 msgid "" "Tuple containing the expanded set of base types, starting with the type " "itself and ending with :class:`object`, in Method Resolution Order." msgstr "" -#: ../../c-api/typeobj.rst:2013 +#: ../../c-api/typeobj.rst:2021 msgid "" "This field is not inherited; it is calculated fresh by :c:func:" "`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2019 +#: ../../c-api/typeobj.rst:2027 msgid "Unused. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2028 +#: ../../c-api/typeobj.rst:2036 msgid "" "A collection of subclasses. Internal use only. May be an invalid pointer." msgstr "" -#: ../../c-api/typeobj.rst:2030 +#: ../../c-api/typeobj.rst:2038 msgid "" "To get a list of subclasses, call the Python method :py:meth:`~class." "__subclasses__`." msgstr "" -#: ../../c-api/typeobj.rst:2035 +#: ../../c-api/typeobj.rst:2043 msgid "" "For some types, this field does not hold a valid :c:expr:`PyObject*`. The " "type was changed to :c:expr:`void*` to indicate this." msgstr "" -#: ../../c-api/typeobj.rst:2045 +#: ../../c-api/typeobj.rst:2053 msgid "" "Weak reference list head, for weak references to this type object. Not " "inherited. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2050 +#: ../../c-api/typeobj.rst:2058 msgid "" "Internals detail: For the static builtin types this is always ``NULL``, even " "if weakrefs are added. Instead, the weakrefs for each are stored on " @@ -3227,25 +3255,25 @@ msgid "" "``_PyObject_GET_WEAKREFS_LISTPTR()`` macro to avoid the distinction." msgstr "" -#: ../../c-api/typeobj.rst:2062 +#: ../../c-api/typeobj.rst:2070 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." msgstr "" -#: ../../c-api/typeobj.rst:2067 +#: ../../c-api/typeobj.rst:2075 msgid "Used to index into the method cache. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2076 +#: ../../c-api/typeobj.rst:2084 msgid "" "An optional pointer to an instance finalization function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2078 +#: ../../c-api/typeobj.rst:2086 msgid "void tp_finalize(PyObject *self);" msgstr "void tp_finalize(PyObject *self);" -#: ../../c-api/typeobj.rst:2080 +#: ../../c-api/typeobj.rst:2088 msgid "" "If :c:member:`~PyTypeObject.tp_finalize` is set, the interpreter calls it " "once when finalizing an instance. It is called either from the garbage " @@ -3255,14 +3283,14 @@ msgid "" "object in a sane state." msgstr "" -#: ../../c-api/typeobj.rst:2087 +#: ../../c-api/typeobj.rst:2095 msgid "" ":c:member:`~PyTypeObject.tp_finalize` should not mutate the current " "exception status; therefore, a recommended way to write a non-trivial " "finalizer is::" msgstr "" -#: ../../c-api/typeobj.rst:2090 +#: ../../c-api/typeobj.rst:2098 msgid "" "static void\n" "local_finalize(PyObject *self)\n" @@ -3279,7 +3307,7 @@ msgid "" "}" msgstr "" -#: ../../c-api/typeobj.rst:2104 +#: ../../c-api/typeobj.rst:2112 msgid "" "Also, note that, in a garbage collected Python, :c:member:`~PyTypeObject." "tp_dealloc` may be called from any Python thread, not just the thread which " @@ -3292,18 +3320,18 @@ msgid "" "which called tp_dealloc will not violate any assumptions of the library." msgstr "" -#: ../../c-api/typeobj.rst:2123 +#: ../../c-api/typeobj.rst:2131 msgid "" "Before version 3.8 it was necessary to set the :c:macro:" "`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be used. " "This is no longer required." msgstr "" -#: ../../c-api/typeobj.rst:2127 +#: ../../c-api/typeobj.rst:2135 msgid "\"Safe object finalization\" (:pep:`442`)" msgstr "" -#: ../../c-api/typeobj.rst:2132 +#: ../../c-api/typeobj.rst:2140 msgid "" "Vectorcall function to use for calls of this type object. In other words, it " "is used to implement :ref:`vectorcall ` for ``type.__call__``. " @@ -3311,65 +3339,65 @@ msgid "" "meth:`~object.__new__` and :meth:`~object.__init__` is used." msgstr "" -#: ../../c-api/typeobj.rst:2140 +#: ../../c-api/typeobj.rst:2148 msgid "This field is never inherited." msgstr "" -#: ../../c-api/typeobj.rst:2142 +#: ../../c-api/typeobj.rst:2150 msgid "(the field exists since 3.8 but it's only used since 3.9)" msgstr "" -#: ../../c-api/typeobj.rst:2147 +#: ../../c-api/typeobj.rst:2155 msgid "Internal. Do not use." msgstr "" -#: ../../c-api/typeobj.rst:2155 +#: ../../c-api/typeobj.rst:2163 msgid "Static Types" msgstr "" -#: ../../c-api/typeobj.rst:2157 +#: ../../c-api/typeobj.rst:2165 msgid "" "Traditionally, types defined in C code are *static*, that is, a static :c:" "type:`PyTypeObject` structure is defined directly in code and initialized " "using :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2161 +#: ../../c-api/typeobj.rst:2169 msgid "" "This results in types that are limited relative to types defined in Python:" msgstr "" -#: ../../c-api/typeobj.rst:2163 +#: ../../c-api/typeobj.rst:2171 msgid "" "Static types are limited to one base, i.e. they cannot use multiple " "inheritance." msgstr "" -#: ../../c-api/typeobj.rst:2165 +#: ../../c-api/typeobj.rst:2173 msgid "" "Static type objects (but not necessarily their instances) are immutable. It " "is not possible to add or modify the type object's attributes from Python." msgstr "" -#: ../../c-api/typeobj.rst:2167 +#: ../../c-api/typeobj.rst:2175 msgid "" "Static type objects are shared across :ref:`sub-interpreters `, so they should not include any subinterpreter-" "specific state." msgstr "" -#: ../../c-api/typeobj.rst:2171 +#: ../../c-api/typeobj.rst:2179 msgid "" "Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API " "` as an opaque struct, any extension modules using static " "types must be compiled for a specific Python minor version." msgstr "" -#: ../../c-api/typeobj.rst:2179 +#: ../../c-api/typeobj.rst:2187 msgid "Heap Types" msgstr "" -#: ../../c-api/typeobj.rst:2181 +#: ../../c-api/typeobj.rst:2189 msgid "" "An alternative to :ref:`static types ` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " @@ -3377,29 +3405,29 @@ msgid "" "`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" -#: ../../c-api/typeobj.rst:2186 +#: ../../c-api/typeobj.rst:2194 msgid "" "This is done by filling a :c:type:`PyType_Spec` structure and calling :c:" "func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:" "`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`." msgstr "" -#: ../../c-api/typeobj.rst:2194 +#: ../../c-api/typeobj.rst:2202 msgid "Number Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2201 +#: ../../c-api/typeobj.rst:2209 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the number protocol. Each function is used by the function of " "similar name documented in the :ref:`number` section." msgstr "" -#: ../../c-api/typeobj.rst:2207 ../../c-api/typeobj.rst:2531 +#: ../../c-api/typeobj.rst:2215 ../../c-api/typeobj.rst:2539 msgid "Here is the structure definition::" msgstr "" -#: ../../c-api/typeobj.rst:2209 +#: ../../c-api/typeobj.rst:2217 msgid "" "typedef struct {\n" " binaryfunc nb_add;\n" @@ -3487,7 +3515,7 @@ msgstr "" " binaryfunc nb_inplace_matrix_multiply;\n" "} PyNumberMethods;" -#: ../../c-api/typeobj.rst:2254 +#: ../../c-api/typeobj.rst:2262 msgid "" "Binary and ternary functions must check the type of all their operands, and " "implement the necessary conversions (at least one of the operands is an " @@ -3497,31 +3525,31 @@ msgid "" "and set an exception." msgstr "" -#: ../../c-api/typeobj.rst:2263 +#: ../../c-api/typeobj.rst:2271 msgid "" "The :c:member:`~PyNumberMethods.nb_reserved` field should always be " "``NULL``. It was previously called :c:member:`!nb_long`, and was renamed in " "Python 3.0.1." msgstr "" -#: ../../c-api/typeobj.rst:2308 +#: ../../c-api/typeobj.rst:2316 msgid "Mapping Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2315 +#: ../../c-api/typeobj.rst:2323 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the mapping protocol. It has three members:" msgstr "" -#: ../../c-api/typeobj.rst:2320 +#: ../../c-api/typeobj.rst:2328 msgid "" "This function is used by :c:func:`PyMapping_Size` and :c:func:" "`PyObject_Size`, and has the same signature. This slot may be set to " "``NULL`` if the object has no defined length." msgstr "" -#: ../../c-api/typeobj.rst:2326 +#: ../../c-api/typeobj.rst:2334 msgid "" "This function is used by :c:func:`PyObject_GetItem` and :c:func:" "`PySequence_GetSlice`, and has the same signature as :c:func:`!" @@ -3529,7 +3557,7 @@ msgid "" "`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2334 +#: ../../c-api/typeobj.rst:2342 msgid "" "This function is used by :c:func:`PyObject_SetItem`, :c:func:" "`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:" @@ -3539,17 +3567,17 @@ msgid "" "deletion." msgstr "" -#: ../../c-api/typeobj.rst:2345 +#: ../../c-api/typeobj.rst:2353 msgid "Sequence Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2352 +#: ../../c-api/typeobj.rst:2360 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the sequence protocol." msgstr "" -#: ../../c-api/typeobj.rst:2357 +#: ../../c-api/typeobj.rst:2365 msgid "" "This function is used by :c:func:`PySequence_Size` and :c:func:" "`PyObject_Size`, and has the same signature. It is also used for handling " @@ -3557,21 +3585,21 @@ msgid "" "member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" -#: ../../c-api/typeobj.rst:2364 +#: ../../c-api/typeobj.rst:2372 msgid "" "This function is used by :c:func:`PySequence_Concat` and has the same " "signature. It is also used by the ``+`` operator, after trying the numeric " "addition via the :c:member:`~PyNumberMethods.nb_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2370 +#: ../../c-api/typeobj.rst:2378 msgid "" "This function is used by :c:func:`PySequence_Repeat` and has the same " "signature. It is also used by the ``*`` operator, after trying numeric " "multiplication via the :c:member:`~PyNumberMethods.nb_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2376 +#: ../../c-api/typeobj.rst:2384 msgid "" "This function is used by :c:func:`PySequence_GetItem` and has the same " "signature. It is also used by :c:func:`PyObject_GetItem`, after trying the " @@ -3580,7 +3608,7 @@ msgid "" "``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2382 +#: ../../c-api/typeobj.rst:2390 msgid "" "Negative indexes are handled as follows: if the :c:member:" "`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " @@ -3589,7 +3617,7 @@ msgid "" "index is passed as is to the function." msgstr "" -#: ../../c-api/typeobj.rst:2389 +#: ../../c-api/typeobj.rst:2397 msgid "" "This function is used by :c:func:`PySequence_SetItem` and has the same " "signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:" @@ -3598,14 +3626,14 @@ msgid "" "``NULL`` if the object does not support item assignment and deletion." msgstr "" -#: ../../c-api/typeobj.rst:2398 +#: ../../c-api/typeobj.rst:2406 msgid "" "This function may be used by :c:func:`PySequence_Contains` and has the same " "signature. This slot may be left to ``NULL``, in this case :c:func:`!" "PySequence_Contains` simply traverses the sequence until it finds a match." msgstr "" -#: ../../c-api/typeobj.rst:2405 +#: ../../c-api/typeobj.rst:2413 msgid "" "This function is used by :c:func:`PySequence_InPlaceConcat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -3615,7 +3643,7 @@ msgid "" "c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2414 +#: ../../c-api/typeobj.rst:2422 msgid "" "This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -3625,76 +3653,76 @@ msgid "" "via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2425 +#: ../../c-api/typeobj.rst:2433 msgid "Buffer Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2433 +#: ../../c-api/typeobj.rst:2441 msgid "" "This structure holds pointers to the functions required by the :ref:`Buffer " "protocol `. The protocol defines how an exporter object can " "expose its internal data to consumer objects." msgstr "" -#: ../../c-api/typeobj.rst:2439 ../../c-api/typeobj.rst:2488 -#: ../../c-api/typeobj.rst:2542 ../../c-api/typeobj.rst:2553 -#: ../../c-api/typeobj.rst:2565 ../../c-api/typeobj.rst:2575 +#: ../../c-api/typeobj.rst:2447 ../../c-api/typeobj.rst:2496 +#: ../../c-api/typeobj.rst:2550 ../../c-api/typeobj.rst:2561 +#: ../../c-api/typeobj.rst:2573 ../../c-api/typeobj.rst:2583 msgid "The signature of this function is::" msgstr "" -#: ../../c-api/typeobj.rst:2441 +#: ../../c-api/typeobj.rst:2449 msgid "int (PyObject *exporter, Py_buffer *view, int flags);" msgstr "int (PyObject *exporter, Py_buffer *view, int flags);" -#: ../../c-api/typeobj.rst:2443 +#: ../../c-api/typeobj.rst:2451 msgid "" "Handle a request to *exporter* to fill in *view* as specified by *flags*. " "Except for point (3), an implementation of this function MUST take these " "steps:" msgstr "" -#: ../../c-api/typeobj.rst:2447 +#: ../../c-api/typeobj.rst:2455 msgid "" "Check if the request can be met. If not, raise :exc:`BufferError`, set :c:" "expr:`view->obj` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:2450 +#: ../../c-api/typeobj.rst:2458 msgid "Fill in the requested fields." msgstr "" -#: ../../c-api/typeobj.rst:2452 +#: ../../c-api/typeobj.rst:2460 msgid "Increment an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2454 +#: ../../c-api/typeobj.rst:2462 msgid "" "Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`." msgstr "" -#: ../../c-api/typeobj.rst:2456 +#: ../../c-api/typeobj.rst:2464 msgid "Return ``0``." msgstr "回傳 ``0``。" -#: ../../c-api/typeobj.rst:2458 +#: ../../c-api/typeobj.rst:2466 msgid "" "If *exporter* is part of a chain or tree of buffer providers, two main " "schemes can be used:" msgstr "" -#: ../../c-api/typeobj.rst:2461 +#: ../../c-api/typeobj.rst:2469 msgid "" "Re-export: Each member of the tree acts as the exporting object and sets :c:" "expr:`view->obj` to a new reference to itself." msgstr "" -#: ../../c-api/typeobj.rst:2464 +#: ../../c-api/typeobj.rst:2472 msgid "" "Redirect: The buffer request is redirected to the root object of the tree. " "Here, :c:expr:`view->obj` will be a new reference to the root object." msgstr "" -#: ../../c-api/typeobj.rst:2468 +#: ../../c-api/typeobj.rst:2476 msgid "" "The individual fields of *view* are described in section :ref:`Buffer " "structure `, the rules how an exporter must react to " @@ -3702,7 +3730,7 @@ msgid "" "types>`." msgstr "" -#: ../../c-api/typeobj.rst:2473 +#: ../../c-api/typeobj.rst:2481 msgid "" "All memory pointed to in the :c:type:`Py_buffer` structure belongs to the " "exporter and must remain valid until there are no consumers left. :c:member:" @@ -3711,23 +3739,23 @@ msgid "" "internal` are read-only for the consumer." msgstr "" -#: ../../c-api/typeobj.rst:2480 +#: ../../c-api/typeobj.rst:2488 msgid "" ":c:func:`PyBuffer_FillInfo` provides an easy way of exposing a simple bytes " "buffer while dealing correctly with all request types." msgstr "" -#: ../../c-api/typeobj.rst:2483 +#: ../../c-api/typeobj.rst:2491 msgid "" ":c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps " "this function." msgstr "" -#: ../../c-api/typeobj.rst:2490 +#: ../../c-api/typeobj.rst:2498 msgid "void (PyObject *exporter, Py_buffer *view);" msgstr "void (PyObject *exporter, Py_buffer *view);" -#: ../../c-api/typeobj.rst:2492 +#: ../../c-api/typeobj.rst:2500 msgid "" "Handle a request to release the resources of the buffer. If no resources " "need to be released, :c:member:`PyBufferProcs.bf_releasebuffer` may be " @@ -3735,15 +3763,15 @@ msgid "" "these optional steps:" msgstr "" -#: ../../c-api/typeobj.rst:2497 +#: ../../c-api/typeobj.rst:2505 msgid "Decrement an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2499 +#: ../../c-api/typeobj.rst:2507 msgid "If the counter is ``0``, free all memory associated with *view*." msgstr "" -#: ../../c-api/typeobj.rst:2501 +#: ../../c-api/typeobj.rst:2509 msgid "" "The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep " "track of buffer-specific resources. This field is guaranteed to remain " @@ -3751,30 +3779,30 @@ msgid "" "*view* argument." msgstr "" -#: ../../c-api/typeobj.rst:2507 +#: ../../c-api/typeobj.rst:2515 msgid "" "This function MUST NOT decrement :c:expr:`view->obj`, since that is done " "automatically in :c:func:`PyBuffer_Release` (this scheme is useful for " "breaking reference cycles)." msgstr "" -#: ../../c-api/typeobj.rst:2512 +#: ../../c-api/typeobj.rst:2520 msgid "" ":c:func:`PyBuffer_Release` is the interface for the consumer that wraps this " "function." msgstr "" -#: ../../c-api/typeobj.rst:2520 +#: ../../c-api/typeobj.rst:2528 msgid "Async Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2528 +#: ../../c-api/typeobj.rst:2536 msgid "" "This structure holds pointers to the functions required to implement :term:" "`awaitable` and :term:`asynchronous iterator` objects." msgstr "" -#: ../../c-api/typeobj.rst:2533 +#: ../../c-api/typeobj.rst:2541 msgid "" "typedef struct {\n" " unaryfunc am_await;\n" @@ -3790,62 +3818,62 @@ msgstr "" " sendfunc am_send;\n" "} PyAsyncMethods;" -#: ../../c-api/typeobj.rst:2544 +#: ../../c-api/typeobj.rst:2552 msgid "PyObject *am_await(PyObject *self);" msgstr "" -#: ../../c-api/typeobj.rst:2546 +#: ../../c-api/typeobj.rst:2554 msgid "" "The returned object must be an :term:`iterator`, i.e. :c:func:`PyIter_Check` " "must return ``1`` for it." msgstr "" -#: ../../c-api/typeobj.rst:2549 +#: ../../c-api/typeobj.rst:2557 msgid "" "This slot may be set to ``NULL`` if an object is not an :term:`awaitable`." msgstr "" -#: ../../c-api/typeobj.rst:2555 +#: ../../c-api/typeobj.rst:2563 msgid "PyObject *am_aiter(PyObject *self);" msgstr "PyObject *am_aiter(PyObject *self);" -#: ../../c-api/typeobj.rst:2557 +#: ../../c-api/typeobj.rst:2565 msgid "" "Must return an :term:`asynchronous iterator` object. See :meth:`~object." "__anext__` for details." msgstr "" -#: ../../c-api/typeobj.rst:2560 +#: ../../c-api/typeobj.rst:2568 msgid "" "This slot may be set to ``NULL`` if an object does not implement " "asynchronous iteration protocol." msgstr "" -#: ../../c-api/typeobj.rst:2567 +#: ../../c-api/typeobj.rst:2575 msgid "PyObject *am_anext(PyObject *self);" msgstr "PyObject *am_anext(PyObject *self);" -#: ../../c-api/typeobj.rst:2569 +#: ../../c-api/typeobj.rst:2577 msgid "" "Must return an :term:`awaitable` object. See :meth:`~object.__anext__` for " "details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2577 +#: ../../c-api/typeobj.rst:2585 msgid "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" msgstr "" "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" -#: ../../c-api/typeobj.rst:2579 +#: ../../c-api/typeobj.rst:2587 msgid "" "See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2588 +#: ../../c-api/typeobj.rst:2596 msgid "Slot Type typedefs" msgstr "" -#: ../../c-api/typeobj.rst:2592 +#: ../../c-api/typeobj.rst:2600 msgid "" "The purpose of this function is to separate memory allocation from memory " "initialization. It should return a pointer to a block of memory of adequate " @@ -3859,80 +3887,80 @@ msgid "" "length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:2602 +#: ../../c-api/typeobj.rst:2610 msgid "" "This function should not do any other instance initialization, not even to " "allocate additional memory; that should be done by :c:member:`~PyTypeObject." "tp_new`." msgstr "" -#: ../../c-api/typeobj.rst:2609 +#: ../../c-api/typeobj.rst:2617 msgid "See :c:member:`~PyTypeObject.tp_free`." msgstr "請見 :c:member:`~PyTypeObject.tp_free`。" -#: ../../c-api/typeobj.rst:2613 +#: ../../c-api/typeobj.rst:2621 msgid "See :c:member:`~PyTypeObject.tp_new`." msgstr "請見 :c:member:`~PyTypeObject.tp_new`。" -#: ../../c-api/typeobj.rst:2617 +#: ../../c-api/typeobj.rst:2625 msgid "See :c:member:`~PyTypeObject.tp_init`." msgstr "請見 :c:member:`~PyTypeObject.tp_init`。" -#: ../../c-api/typeobj.rst:2621 +#: ../../c-api/typeobj.rst:2629 msgid "See :c:member:`~PyTypeObject.tp_repr`." msgstr "請見 :c:member:`~PyTypeObject.tp_repr`。" -#: ../../c-api/typeobj.rst:2625 ../../c-api/typeobj.rst:2634 +#: ../../c-api/typeobj.rst:2633 ../../c-api/typeobj.rst:2642 msgid "Return the value of the named attribute for the object." msgstr "" -#: ../../c-api/typeobj.rst:2629 ../../c-api/typeobj.rst:2640 +#: ../../c-api/typeobj.rst:2637 ../../c-api/typeobj.rst:2648 msgid "" "Set the value of the named attribute for the object. The value argument is " "set to ``NULL`` to delete the attribute." msgstr "" -#: ../../c-api/typeobj.rst:2636 +#: ../../c-api/typeobj.rst:2644 msgid "See :c:member:`~PyTypeObject.tp_getattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_getattro`。" -#: ../../c-api/typeobj.rst:2643 +#: ../../c-api/typeobj.rst:2651 msgid "See :c:member:`~PyTypeObject.tp_setattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_setattro`。" -#: ../../c-api/typeobj.rst:2647 +#: ../../c-api/typeobj.rst:2655 msgid "See :c:member:`~PyTypeObject.tp_descr_get`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_get`。" -#: ../../c-api/typeobj.rst:2651 +#: ../../c-api/typeobj.rst:2659 msgid "See :c:member:`~PyTypeObject.tp_descr_set`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_set`。" -#: ../../c-api/typeobj.rst:2655 +#: ../../c-api/typeobj.rst:2663 msgid "See :c:member:`~PyTypeObject.tp_hash`." msgstr "請見 :c:member:`~PyTypeObject.tp_hash`。" -#: ../../c-api/typeobj.rst:2659 +#: ../../c-api/typeobj.rst:2667 msgid "See :c:member:`~PyTypeObject.tp_richcompare`." msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" -#: ../../c-api/typeobj.rst:2663 +#: ../../c-api/typeobj.rst:2671 msgid "See :c:member:`~PyTypeObject.tp_iter`." msgstr "請見 :c:member:`~PyTypeObject.tp_iter`。" -#: ../../c-api/typeobj.rst:2667 +#: ../../c-api/typeobj.rst:2675 msgid "See :c:member:`~PyTypeObject.tp_iternext`." msgstr "請見 :c:member:`~PyTypeObject.tp_iternext`。" -#: ../../c-api/typeobj.rst:2681 +#: ../../c-api/typeobj.rst:2689 msgid "See :c:member:`~PyAsyncMethods.am_send`." msgstr "請見 :c:member:`~PyAsyncMethods.am_send`。" -#: ../../c-api/typeobj.rst:2697 +#: ../../c-api/typeobj.rst:2705 msgid "Examples" msgstr "範例" -#: ../../c-api/typeobj.rst:2699 +#: ../../c-api/typeobj.rst:2707 msgid "" "The following are simple examples of Python type definitions. They include " "common usage you may encounter. Some demonstrate tricky corner cases. For " @@ -3940,11 +3968,11 @@ msgid "" "and :ref:`new-types-topics`." msgstr "" -#: ../../c-api/typeobj.rst:2704 +#: ../../c-api/typeobj.rst:2712 msgid "A basic :ref:`static type `::" msgstr "" -#: ../../c-api/typeobj.rst:2706 +#: ../../c-api/typeobj.rst:2714 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -3962,13 +3990,13 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2721 +#: ../../c-api/typeobj.rst:2729 msgid "" "You may also find older code (especially in the CPython code base) with a " "more verbose initializer::" msgstr "" -#: ../../c-api/typeobj.rst:2724 +#: ../../c-api/typeobj.rst:2732 msgid "" "static PyTypeObject MyObject_Type = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -4052,11 +4080,11 @@ msgstr "" " myobj_new, /* tp_new */\n" "};" -#: ../../c-api/typeobj.rst:2765 +#: ../../c-api/typeobj.rst:2773 msgid "A type that supports weakrefs, instance dicts, and hashing::" msgstr "" -#: ../../c-api/typeobj.rst:2767 +#: ../../c-api/typeobj.rst:2775 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4082,14 +4110,14 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2790 +#: ../../c-api/typeobj.rst:2798 msgid "" "A str subclass that cannot be subclassed and cannot be called to create " "instances (e.g. uses a separate factory func) using :c:macro:" "`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" -#: ../../c-api/typeobj.rst:2794 +#: ../../c-api/typeobj.rst:2802 msgid "" "typedef struct {\n" " PyUnicodeObject raw;\n" @@ -4107,12 +4135,12 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2809 +#: ../../c-api/typeobj.rst:2817 msgid "" "The simplest :ref:`static type ` with fixed-length instances::" msgstr "" -#: ../../c-api/typeobj.rst:2811 +#: ../../c-api/typeobj.rst:2819 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4132,13 +4160,13 @@ msgstr "" " .tp_name = \"mymod.MyObject\",\n" "};" -#: ../../c-api/typeobj.rst:2820 +#: ../../c-api/typeobj.rst:2828 msgid "" "The simplest :ref:`static type ` with variable-length " "instances::" msgstr "" -#: ../../c-api/typeobj.rst:2822 +#: ../../c-api/typeobj.rst:2830 msgid "" "typedef struct {\n" " PyObject_VAR_HEAD\n" @@ -4164,14 +4192,14 @@ msgstr "" " .tp_itemsize = sizeof(char *),\n" "};" -#: ../../c-api/typeobj.rst:809 ../../c-api/typeobj.rst:874 +#: ../../c-api/typeobj.rst:787 ../../c-api/typeobj.rst:852 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/typeobj.rst:809 +#: ../../c-api/typeobj.rst:787 msgid "repr" msgstr "repr" -#: ../../c-api/typeobj.rst:874 +#: ../../c-api/typeobj.rst:852 msgid "hash" msgstr "hash(雜湊)" diff --git a/c-api/unicode.po b/c-api/unicode.po index 65f3f6325b..44e3e7af19 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -79,52 +79,52 @@ msgid "" "build time." msgstr "" -#: ../../c-api/unicode.rst:60 +#: ../../c-api/unicode.rst:62 msgid "" "These subtypes of :c:type:`PyObject` represent a Python Unicode object. In " "almost all cases, they shouldn't be used directly, since all API functions " "that deal with Unicode objects take and return :c:type:`PyObject` pointers." msgstr "" -#: ../../c-api/unicode.rst:69 +#: ../../c-api/unicode.rst:71 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python Unicode type. " "It is exposed to Python code as ``str``." msgstr "" -#: ../../c-api/unicode.rst:73 +#: ../../c-api/unicode.rst:75 msgid "" "The following APIs are C macros and static inlined functions for fast checks " "and access to internal read-only data of Unicode objects:" msgstr "" -#: ../../c-api/unicode.rst:78 +#: ../../c-api/unicode.rst:80 msgid "" "Return true if the object *obj* is a Unicode object or an instance of a " "Unicode subtype. This function always succeeds." msgstr "" -#: ../../c-api/unicode.rst:84 +#: ../../c-api/unicode.rst:86 msgid "" "Return true if the object *obj* is a Unicode object, but not an instance of " "a subtype. This function always succeeds." msgstr "" -#: ../../c-api/unicode.rst:90 +#: ../../c-api/unicode.rst:92 msgid "Returns ``0``. This API is kept only for backward compatibility." msgstr "" -#: ../../c-api/unicode.rst:94 +#: ../../c-api/unicode.rst:96 msgid "This API does nothing since Python 3.12." msgstr "" -#: ../../c-api/unicode.rst:100 +#: ../../c-api/unicode.rst:102 msgid "" "Return the length of the Unicode string, in code points. *unicode* has to " "be a Unicode object in the \"canonical\" representation (not checked)." msgstr "" -#: ../../c-api/unicode.rst:110 +#: ../../c-api/unicode.rst:112 msgid "" "Return a pointer to the canonical representation cast to UCS1, UCS2 or UCS4 " "integer types for direct character access. No checks are performed if the " @@ -132,15 +132,15 @@ msgid "" "`PyUnicode_KIND` to select the right function." msgstr "" -#: ../../c-api/unicode.rst:122 +#: ../../c-api/unicode.rst:124 msgid "Return values of the :c:func:`PyUnicode_KIND` macro." msgstr "" -#: ../../c-api/unicode.rst:126 +#: ../../c-api/unicode.rst:128 msgid "``PyUnicode_WCHAR_KIND`` has been removed." msgstr "``PyUnicode_WCHAR_KIND`` 已被移除。" -#: ../../c-api/unicode.rst:132 +#: ../../c-api/unicode.rst:134 msgid "" "Return one of the PyUnicode kind constants (see above) that indicate how " "many bytes per character this Unicode object uses to store its data. " @@ -148,13 +148,13 @@ msgid "" "(not checked)." msgstr "" -#: ../../c-api/unicode.rst:141 +#: ../../c-api/unicode.rst:143 msgid "" "Return a void pointer to the raw Unicode buffer. *unicode* has to be a " "Unicode object in the \"canonical\" representation (not checked)." msgstr "" -#: ../../c-api/unicode.rst:150 +#: ../../c-api/unicode.rst:152 msgid "" "Write into a canonical representation *data* (as obtained with :c:func:" "`PyUnicode_DATA`). This function performs no sanity checks, and is intended " @@ -164,97 +164,97 @@ msgid "" "written to that location." msgstr "" -#: ../../c-api/unicode.rst:163 +#: ../../c-api/unicode.rst:165 msgid "" "Read a code point from a canonical representation *data* (as obtained with :" "c:func:`PyUnicode_DATA`). No checks or ready calls are performed." msgstr "" -#: ../../c-api/unicode.rst:171 +#: ../../c-api/unicode.rst:173 msgid "" "Read a character from a Unicode object *unicode*, which must be in the " "\"canonical\" representation. This is less efficient than :c:func:" "`PyUnicode_READ` if you do multiple consecutive reads." msgstr "" -#: ../../c-api/unicode.rst:180 +#: ../../c-api/unicode.rst:182 msgid "" "Return the maximum code point that is suitable for creating another string " "based on *unicode*, which must be in the \"canonical\" representation. This " "is always an approximation but more efficient than iterating over the string." msgstr "" -#: ../../c-api/unicode.rst:189 +#: ../../c-api/unicode.rst:191 msgid "" "Return ``1`` if the string is a valid identifier according to the language " "definition, section :ref:`identifiers`. Return ``0`` otherwise." msgstr "" -#: ../../c-api/unicode.rst:192 +#: ../../c-api/unicode.rst:194 msgid "" "The function does not call :c:func:`Py_FatalError` anymore if the string is " "not ready." msgstr "" -#: ../../c-api/unicode.rst:198 +#: ../../c-api/unicode.rst:200 msgid "Unicode Character Properties" msgstr "" -#: ../../c-api/unicode.rst:200 +#: ../../c-api/unicode.rst:202 msgid "" "Unicode provides many different character properties. The most often needed " "ones are available through these macros which are mapped to C functions " "depending on the Python configuration." msgstr "" -#: ../../c-api/unicode.rst:207 +#: ../../c-api/unicode.rst:209 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a whitespace character." msgstr "" -#: ../../c-api/unicode.rst:212 +#: ../../c-api/unicode.rst:214 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a lowercase character." msgstr "" -#: ../../c-api/unicode.rst:217 +#: ../../c-api/unicode.rst:219 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an uppercase character." msgstr "" -#: ../../c-api/unicode.rst:222 +#: ../../c-api/unicode.rst:224 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a titlecase character." msgstr "" -#: ../../c-api/unicode.rst:227 +#: ../../c-api/unicode.rst:229 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a linebreak character." msgstr "" -#: ../../c-api/unicode.rst:232 +#: ../../c-api/unicode.rst:234 msgid "Return ``1`` or ``0`` depending on whether *ch* is a decimal character." msgstr "" -#: ../../c-api/unicode.rst:237 +#: ../../c-api/unicode.rst:239 msgid "Return ``1`` or ``0`` depending on whether *ch* is a digit character." msgstr "" -#: ../../c-api/unicode.rst:242 +#: ../../c-api/unicode.rst:244 msgid "Return ``1`` or ``0`` depending on whether *ch* is a numeric character." msgstr "" -#: ../../c-api/unicode.rst:247 +#: ../../c-api/unicode.rst:249 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphabetic character." msgstr "" -#: ../../c-api/unicode.rst:252 +#: ../../c-api/unicode.rst:254 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphanumeric character." msgstr "" -#: ../../c-api/unicode.rst:257 +#: ../../c-api/unicode.rst:259 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a printable character. " "Nonprintable characters are those characters defined in the Unicode " @@ -265,62 +265,57 @@ msgid "" "to :data:`sys.stdout` or :data:`sys.stderr`.)" msgstr "" -#: ../../c-api/unicode.rst:266 +#: ../../c-api/unicode.rst:268 msgid "These APIs can be used for fast direct character conversions:" msgstr "" -#: ../../c-api/unicode.rst:271 +#: ../../c-api/unicode.rst:273 msgid "Return the character *ch* converted to lower case." msgstr "" -#: ../../c-api/unicode.rst:273 ../../c-api/unicode.rst:281 -#: ../../c-api/unicode.rst:289 -msgid "This function uses simple case mappings." -msgstr "" - -#: ../../c-api/unicode.rst:279 +#: ../../c-api/unicode.rst:278 msgid "Return the character *ch* converted to upper case." msgstr "" -#: ../../c-api/unicode.rst:287 +#: ../../c-api/unicode.rst:283 msgid "Return the character *ch* converted to title case." msgstr "" -#: ../../c-api/unicode.rst:295 +#: ../../c-api/unicode.rst:288 msgid "" "Return the character *ch* converted to a decimal positive integer. Return " "``-1`` if this is not possible. This function does not raise exceptions." msgstr "" -#: ../../c-api/unicode.rst:301 +#: ../../c-api/unicode.rst:294 msgid "" "Return the character *ch* converted to a single digit integer. Return ``-1`` " "if this is not possible. This function does not raise exceptions." msgstr "" -#: ../../c-api/unicode.rst:307 +#: ../../c-api/unicode.rst:300 msgid "" "Return the character *ch* converted to a double. Return ``-1.0`` if this is " "not possible. This function does not raise exceptions." msgstr "" -#: ../../c-api/unicode.rst:311 +#: ../../c-api/unicode.rst:304 msgid "These APIs can be used to work with surrogates:" msgstr "" -#: ../../c-api/unicode.rst:315 +#: ../../c-api/unicode.rst:308 msgid "Check if *ch* is a surrogate (``0xD800 <= ch <= 0xDFFF``)." msgstr "" -#: ../../c-api/unicode.rst:319 +#: ../../c-api/unicode.rst:312 msgid "Check if *ch* is a high surrogate (``0xD800 <= ch <= 0xDBFF``)." msgstr "" -#: ../../c-api/unicode.rst:323 +#: ../../c-api/unicode.rst:316 msgid "Check if *ch* is a low surrogate (``0xDC00 <= ch <= 0xDFFF``)." msgstr "" -#: ../../c-api/unicode.rst:327 +#: ../../c-api/unicode.rst:320 msgid "" "Join two surrogate characters and return a single :c:type:`Py_UCS4` value. " "*high* and *low* are respectively the leading and trailing surrogates in a " @@ -328,30 +323,30 @@ msgid "" "be in the range [0xDC00; 0xDFFF]." msgstr "" -#: ../../c-api/unicode.rst:334 +#: ../../c-api/unicode.rst:327 msgid "Creating and accessing Unicode strings" msgstr "" -#: ../../c-api/unicode.rst:336 +#: ../../c-api/unicode.rst:329 msgid "" "To create Unicode objects and access their basic sequence properties, use " "these APIs:" msgstr "" -#: ../../c-api/unicode.rst:341 +#: ../../c-api/unicode.rst:334 msgid "" "Create a new Unicode object. *maxchar* should be the true maximum code " "point to be placed in the string. As an approximation, it can be rounded up " "to the nearest value in the sequence 127, 255, 65535, 1114111." msgstr "" -#: ../../c-api/unicode.rst:345 +#: ../../c-api/unicode.rst:338 msgid "" "This is the recommended way to allocate a new Unicode object. Objects " "created using this function are not resizable." msgstr "" -#: ../../c-api/unicode.rst:354 +#: ../../c-api/unicode.rst:347 msgid "" "Create a new Unicode object with the given *kind* (possible values are :c:" "macro:`PyUnicode_1BYTE_KIND` etc., as returned by :c:func:" @@ -359,7 +354,7 @@ msgid "" "1, 2 or 4 bytes per character, as given by the kind." msgstr "" -#: ../../c-api/unicode.rst:359 +#: ../../c-api/unicode.rst:352 msgid "" "If necessary, the input *buffer* is copied and transformed into the " "canonical representation. For example, if the *buffer* is a UCS4 string (:c:" @@ -367,7 +362,7 @@ msgid "" "range, it will be transformed into UCS1 (:c:macro:`PyUnicode_1BYTE_KIND`)." msgstr "" -#: ../../c-api/unicode.rst:370 +#: ../../c-api/unicode.rst:363 msgid "" "Create a Unicode object from the char buffer *str*. The bytes will be " "interpreted as being UTF-8 encoded. The buffer is copied into the new " @@ -375,29 +370,29 @@ msgid "" "data is not allowed." msgstr "" -#: ../../c-api/unicode.rst:376 +#: ../../c-api/unicode.rst:369 msgid "This function raises :exc:`SystemError` when:" msgstr "" -#: ../../c-api/unicode.rst:378 +#: ../../c-api/unicode.rst:371 msgid "*size* < 0," msgstr "" -#: ../../c-api/unicode.rst:379 +#: ../../c-api/unicode.rst:372 msgid "*str* is ``NULL`` and *size* > 0" msgstr "" -#: ../../c-api/unicode.rst:381 +#: ../../c-api/unicode.rst:374 msgid "*str* == ``NULL`` with *size* > 0 is not allowed anymore." msgstr "" -#: ../../c-api/unicode.rst:387 +#: ../../c-api/unicode.rst:380 msgid "" "Create a Unicode object from a UTF-8 encoded null-terminated char buffer " "*str*." msgstr "" -#: ../../c-api/unicode.rst:393 +#: ../../c-api/unicode.rst:386 msgid "" "Take a C :c:func:`printf`\\ -style *format* string and a variable number of " "arguments, calculate the size of the resulting Python Unicode string and " @@ -406,23 +401,23 @@ msgid "" "*format* ASCII-encoded string." msgstr "" -#: ../../c-api/unicode.rst:399 +#: ../../c-api/unicode.rst:392 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../c-api/unicode.rst:402 +#: ../../c-api/unicode.rst:395 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../c-api/unicode.rst:404 +#: ../../c-api/unicode.rst:397 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../c-api/unicode.rst:407 +#: ../../c-api/unicode.rst:400 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is given in the next argument, which must be of type :c:expr:" @@ -430,7 +425,7 @@ msgid "" "optional precision." msgstr "" -#: ../../c-api/unicode.rst:412 +#: ../../c-api/unicode.rst:405 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. If " "specified as ``'*'`` (an asterisk), the actual precision is given in the " @@ -438,271 +433,317 @@ msgid "" "comes after the precision." msgstr "" -#: ../../c-api/unicode.rst:417 +#: ../../c-api/unicode.rst:410 msgid "Length modifier (optional)." msgstr "" -#: ../../c-api/unicode.rst:419 +#: ../../c-api/unicode.rst:412 msgid "Conversion type." msgstr "" -#: ../../c-api/unicode.rst:421 +#: ../../c-api/unicode.rst:414 msgid "The conversion flag characters are:" msgstr "" -#: ../../c-api/unicode.rst:426 +#: ../../c-api/unicode.rst:419 msgid "Flag" msgstr "旗標" -#: ../../c-api/unicode.rst:426 +#: ../../c-api/unicode.rst:419 msgid "Meaning" msgstr "含義" -#: ../../c-api/unicode.rst:428 +#: ../../c-api/unicode.rst:421 msgid "``0``" msgstr "``0``" -#: ../../c-api/unicode.rst:428 +#: ../../c-api/unicode.rst:421 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../c-api/unicode.rst:430 +#: ../../c-api/unicode.rst:423 msgid "``-``" msgstr "``-``" -#: ../../c-api/unicode.rst:430 +#: ../../c-api/unicode.rst:423 msgid "" "The converted value is left adjusted (overrides the ``0`` flag if both are " "given)." msgstr "" -#: ../../c-api/unicode.rst:434 +#: ../../c-api/unicode.rst:427 msgid "" "The length modifiers for following integer conversions (``d``, ``i``, ``o``, " "``u``, ``x``, or ``X``) specify the type of the argument (:c:expr:`int` by " "default):" msgstr "" -#: ../../c-api/unicode.rst:441 +#: ../../c-api/unicode.rst:434 msgid "Modifier" msgstr "" -#: ../../c-api/unicode.rst:441 +#: ../../c-api/unicode.rst:434 msgid "Types" msgstr "" -#: ../../c-api/unicode.rst:443 +#: ../../c-api/unicode.rst:436 msgid "``l``" msgstr "``l``" -#: ../../c-api/unicode.rst:443 +#: ../../c-api/unicode.rst:436 msgid ":c:expr:`long` or :c:expr:`unsigned long`" msgstr ":c:expr:`long` 或 :c:expr:`unsigned long`" -#: ../../c-api/unicode.rst:445 +#: ../../c-api/unicode.rst:438 msgid "``ll``" msgstr "``ll``" -#: ../../c-api/unicode.rst:445 +#: ../../c-api/unicode.rst:438 msgid ":c:expr:`long long` or :c:expr:`unsigned long long`" msgstr ":c:expr:`long long` 或 :c:expr:`unsigned long long`" -#: ../../c-api/unicode.rst:447 +#: ../../c-api/unicode.rst:440 msgid "``j``" msgstr "``j``" -#: ../../c-api/unicode.rst:447 +#: ../../c-api/unicode.rst:440 msgid ":c:type:`intmax_t` or :c:type:`uintmax_t`" msgstr ":c:type:`intmax_t` 或 :c:type:`uintmax_t`" -#: ../../c-api/unicode.rst:449 +#: ../../c-api/unicode.rst:442 msgid "``z``" msgstr "``z``" -#: ../../c-api/unicode.rst:449 +#: ../../c-api/unicode.rst:442 msgid ":c:type:`size_t` or :c:type:`ssize_t`" msgstr ":c:type:`size_t` 或 :c:type:`ssize_t`" -#: ../../c-api/unicode.rst:451 +#: ../../c-api/unicode.rst:444 msgid "``t``" msgstr "``t``" -#: ../../c-api/unicode.rst:451 +#: ../../c-api/unicode.rst:444 msgid ":c:type:`ptrdiff_t`" msgstr ":c:type:`ptrdiff_t`" -#: ../../c-api/unicode.rst:454 +#: ../../c-api/unicode.rst:447 msgid "" "The length modifier ``l`` for following conversions ``s`` or ``V`` specify " "that the type of the argument is :c:expr:`const wchar_t*`." msgstr "" -#: ../../c-api/unicode.rst:457 +#: ../../c-api/unicode.rst:450 msgid "The conversion specifiers are:" msgstr "" -#: ../../c-api/unicode.rst:463 +#: ../../c-api/unicode.rst:456 msgid "Conversion Specifier" msgstr "" -#: ../../c-api/unicode.rst:464 +#: ../../c-api/unicode.rst:457 msgid "Type" msgstr "" -#: ../../c-api/unicode.rst:465 +#: ../../c-api/unicode.rst:458 msgid "Comment" msgstr "" -#: ../../c-api/unicode.rst:467 +#: ../../c-api/unicode.rst:460 msgid "``%``" msgstr "``%``" -#: ../../c-api/unicode.rst:468 +#: ../../c-api/unicode.rst:461 msgid "*n/a*" msgstr "*n/a*" -#: ../../c-api/unicode.rst:469 +#: ../../c-api/unicode.rst:462 msgid "The literal ``%`` character." msgstr "" -#: ../../c-api/unicode.rst:471 +#: ../../c-api/unicode.rst:464 msgid "``d``, ``i``" msgstr "``d``, ``i``" -#: ../../c-api/unicode.rst:472 ../../c-api/unicode.rst:476 -#: ../../c-api/unicode.rst:480 ../../c-api/unicode.rst:484 -#: ../../c-api/unicode.rst:488 +#: ../../c-api/unicode.rst:465 ../../c-api/unicode.rst:469 +#: ../../c-api/unicode.rst:473 ../../c-api/unicode.rst:477 +#: ../../c-api/unicode.rst:481 msgid "Specified by the length modifier" msgstr "" -#: ../../c-api/unicode.rst:473 +#: ../../c-api/unicode.rst:466 msgid "The decimal representation of a signed C integer." msgstr "" -#: ../../c-api/unicode.rst:475 +#: ../../c-api/unicode.rst:468 msgid "``u``" msgstr "``u``" -#: ../../c-api/unicode.rst:477 +#: ../../c-api/unicode.rst:470 msgid "The decimal representation of an unsigned C integer." msgstr "" -#: ../../c-api/unicode.rst:479 +#: ../../c-api/unicode.rst:472 msgid "``o``" msgstr "``o``" -#: ../../c-api/unicode.rst:481 +#: ../../c-api/unicode.rst:474 msgid "The octal representation of an unsigned C integer." msgstr "" -#: ../../c-api/unicode.rst:483 +#: ../../c-api/unicode.rst:476 msgid "``x``" msgstr "``x``" -#: ../../c-api/unicode.rst:485 +#: ../../c-api/unicode.rst:478 msgid "The hexadecimal representation of an unsigned C integer (lowercase)." msgstr "" -#: ../../c-api/unicode.rst:487 +#: ../../c-api/unicode.rst:480 msgid "``X``" msgstr "``X``" -#: ../../c-api/unicode.rst:489 +#: ../../c-api/unicode.rst:482 msgid "The hexadecimal representation of an unsigned C integer (uppercase)." msgstr "" -#: ../../c-api/unicode.rst:491 +#: ../../c-api/unicode.rst:484 msgid "``c``" msgstr "``c``" -#: ../../c-api/unicode.rst:492 +#: ../../c-api/unicode.rst:485 msgid ":c:expr:`int`" msgstr ":c:expr:`int`" -#: ../../c-api/unicode.rst:493 +#: ../../c-api/unicode.rst:486 msgid "A single character." msgstr "" -#: ../../c-api/unicode.rst:495 +#: ../../c-api/unicode.rst:488 msgid "``s``" msgstr "``s``" -#: ../../c-api/unicode.rst:496 +#: ../../c-api/unicode.rst:489 msgid ":c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`const char*` 或 :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:497 +#: ../../c-api/unicode.rst:490 msgid "A null-terminated C character array." msgstr "" -#: ../../c-api/unicode.rst:499 +#: ../../c-api/unicode.rst:492 msgid "``p``" msgstr "``p``" -#: ../../c-api/unicode.rst:500 +#: ../../c-api/unicode.rst:493 msgid ":c:expr:`const void*`" msgstr ":c:expr:`const void*`" -#: ../../c-api/unicode.rst:501 +#: ../../c-api/unicode.rst:494 msgid "" "The hex representation of a C pointer. Mostly equivalent to " "``printf(\"%p\")`` except that it is guaranteed to start with the literal " "``0x`` regardless of what the platform's ``printf`` yields." msgstr "" -#: ../../c-api/unicode.rst:506 +#: ../../c-api/unicode.rst:499 msgid "``A``" msgstr "``A``" -#: ../../c-api/unicode.rst:507 ../../c-api/unicode.rst:511 -#: ../../c-api/unicode.rst:521 ../../c-api/unicode.rst:525 +#: ../../c-api/unicode.rst:500 ../../c-api/unicode.rst:504 +#: ../../c-api/unicode.rst:514 ../../c-api/unicode.rst:518 +#: ../../c-api/unicode.rst:522 ../../c-api/unicode.rst:527 msgid ":c:expr:`PyObject*`" msgstr ":c:expr:`PyObject*`" -#: ../../c-api/unicode.rst:508 +#: ../../c-api/unicode.rst:501 msgid "The result of calling :func:`ascii`." msgstr "" -#: ../../c-api/unicode.rst:510 +#: ../../c-api/unicode.rst:503 msgid "``U``" msgstr "``U``" -#: ../../c-api/unicode.rst:512 +#: ../../c-api/unicode.rst:505 msgid "A Unicode object." msgstr "一 Unicode 物件。" -#: ../../c-api/unicode.rst:514 +#: ../../c-api/unicode.rst:507 msgid "``V``" msgstr "``V``" -#: ../../c-api/unicode.rst:515 +#: ../../c-api/unicode.rst:508 msgid ":c:expr:`PyObject*`, :c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`PyObject*`、:c:expr:`const char*` 或 :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:516 +#: ../../c-api/unicode.rst:509 msgid "" "A Unicode object (which may be ``NULL``) and a null-terminated C character " "array as a second parameter (which will be used, if the first parameter is " "``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:520 +#: ../../c-api/unicode.rst:513 msgid "``S``" msgstr "``S``" -#: ../../c-api/unicode.rst:522 +#: ../../c-api/unicode.rst:515 msgid "The result of calling :c:func:`PyObject_Str`." msgstr "" -#: ../../c-api/unicode.rst:524 +#: ../../c-api/unicode.rst:517 msgid "``R``" msgstr "``R``" -#: ../../c-api/unicode.rst:526 +#: ../../c-api/unicode.rst:519 msgid "The result of calling :c:func:`PyObject_Repr`." msgstr "" -#: ../../c-api/unicode.rst:529 +#: ../../c-api/unicode.rst:521 +msgid "``T``" +msgstr "" + +#: ../../c-api/unicode.rst:523 +msgid "" +"Get the fully qualified name of an object type; call :c:func:" +"`PyType_GetFullyQualifiedName`." +msgstr "" + +#: ../../c-api/unicode.rst:526 +msgid "``#T``" +msgstr "" + +#: ../../c-api/unicode.rst:528 +msgid "" +"Similar to ``T`` format, but use a colon (``:``) as separator between the " +"module name and the qualified name." +msgstr "" + +#: ../../c-api/unicode.rst:531 +msgid "``N``" +msgstr "" + +#: ../../c-api/unicode.rst:532 ../../c-api/unicode.rst:537 +#, fuzzy +msgid ":c:expr:`PyTypeObject*`" +msgstr ":c:expr:`PyObject*`" + +#: ../../c-api/unicode.rst:533 +msgid "" +"Get the fully qualified name of a type; call :c:func:" +"`PyType_GetFullyQualifiedName`." +msgstr "" + +#: ../../c-api/unicode.rst:536 +msgid "``#N``" +msgstr "" + +#: ../../c-api/unicode.rst:538 +msgid "" +"Similar to ``N`` format, but use a colon (``:``) as separator between the " +"module name and the qualified name." +msgstr "" + +#: ../../c-api/unicode.rst:542 msgid "" "The width formatter unit is number of characters rather than bytes. The " "precision formatter unit is number of bytes or :c:type:`wchar_t` items (if " @@ -712,28 +753,28 @@ msgid "" "``PyObject*`` argument is not ``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:537 +#: ../../c-api/unicode.rst:550 msgid "" "Unlike to C :c:func:`printf` the ``0`` flag has effect even when a precision " "is given for integer conversions (``d``, ``i``, ``u``, ``o``, ``x``, or " "``X``)." msgstr "" -#: ../../c-api/unicode.rst:541 +#: ../../c-api/unicode.rst:554 msgid "Support for ``\"%lld\"`` and ``\"%llu\"`` added." msgstr "" -#: ../../c-api/unicode.rst:544 +#: ../../c-api/unicode.rst:557 msgid "Support for ``\"%li\"``, ``\"%lli\"`` and ``\"%zi\"`` added." msgstr "" -#: ../../c-api/unicode.rst:547 +#: ../../c-api/unicode.rst:560 msgid "" "Support width and precision formatter for ``\"%s\"``, ``\"%A\"``, " "``\"%U\"``, ``\"%V\"``, ``\"%S\"``, ``\"%R\"`` added." msgstr "" -#: ../../c-api/unicode.rst:551 +#: ../../c-api/unicode.rst:564 msgid "" "Support for conversion specifiers ``o`` and ``X``. Support for length " "modifiers ``j`` and ``t``. Length modifiers are now applied to all integer " @@ -742,36 +783,40 @@ msgid "" "flag ``-``." msgstr "" -#: ../../c-api/unicode.rst:559 +#: ../../c-api/unicode.rst:572 msgid "" "An unrecognized format character now sets a :exc:`SystemError`. In previous " "versions it caused all the rest of the format string to be copied as-is to " "the result string, and any extra arguments discarded." msgstr "" -#: ../../c-api/unicode.rst:566 +#: ../../c-api/unicode.rst:576 +msgid "Support for ``%T``, ``%#T``, ``%N`` and ``%#N`` formats added." +msgstr "" + +#: ../../c-api/unicode.rst:582 msgid "" "Identical to :c:func:`PyUnicode_FromFormat` except that it takes exactly two " "arguments." msgstr "" -#: ../../c-api/unicode.rst:572 +#: ../../c-api/unicode.rst:588 msgid "" "Copy an instance of a Unicode subtype to a new true Unicode object if " "necessary. If *obj* is already a true Unicode object (not a subtype), return " "a new :term:`strong reference` to the object." msgstr "" -#: ../../c-api/unicode.rst:576 +#: ../../c-api/unicode.rst:592 msgid "" "Objects other than Unicode or its subtypes will cause a :exc:`TypeError`." msgstr "" -#: ../../c-api/unicode.rst:582 +#: ../../c-api/unicode.rst:598 msgid "Decode an encoded object *obj* to a Unicode object." msgstr "" -#: ../../c-api/unicode.rst:584 +#: ../../c-api/unicode.rst:600 msgid "" ":class:`bytes`, :class:`bytearray` and other :term:`bytes-like objects " "` are decoded according to the given *encoding* and using " @@ -779,23 +824,23 @@ msgid "" "interface use the default values (see :ref:`builtincodecs` for details)." msgstr "" -#: ../../c-api/unicode.rst:590 +#: ../../c-api/unicode.rst:606 msgid "" "All other objects, including Unicode objects, cause a :exc:`TypeError` to be " "set." msgstr "" -#: ../../c-api/unicode.rst:593 +#: ../../c-api/unicode.rst:609 msgid "" "The API returns ``NULL`` if there was an error. The caller is responsible " "for decref'ing the returned objects." msgstr "" -#: ../../c-api/unicode.rst:599 +#: ../../c-api/unicode.rst:615 msgid "Return the length of the Unicode object, in code points." msgstr "" -#: ../../c-api/unicode.rst:610 +#: ../../c-api/unicode.rst:626 msgid "" "Copy characters from one Unicode object into another. This function " "performs character conversion when necessary and falls back to :c:func:`!" @@ -803,52 +848,52 @@ msgid "" "otherwise returns the number of copied characters." msgstr "" -#: ../../c-api/unicode.rst:621 +#: ../../c-api/unicode.rst:637 msgid "" "Fill a string with a character: write *fill_char* into ``unicode[start:" "start+length]``." msgstr "" -#: ../../c-api/unicode.rst:624 +#: ../../c-api/unicode.rst:640 msgid "" "Fail if *fill_char* is bigger than the string maximum character, or if the " "string has more than 1 reference." msgstr "" -#: ../../c-api/unicode.rst:627 +#: ../../c-api/unicode.rst:643 msgid "" "Return the number of written character, or return ``-1`` and raise an " "exception on error." msgstr "" -#: ../../c-api/unicode.rst:636 +#: ../../c-api/unicode.rst:652 msgid "" "Write a character to a string. The string must have been created through :c:" "func:`PyUnicode_New`. Since Unicode strings are supposed to be immutable, " "the string must not be shared, or have been hashed yet." msgstr "" -#: ../../c-api/unicode.rst:640 +#: ../../c-api/unicode.rst:656 msgid "" "This function checks that *unicode* is a Unicode object, that the index is " "not out of bounds, and that the object can be modified safely (i.e. that it " "its reference count is one)." msgstr "" -#: ../../c-api/unicode.rst:649 +#: ../../c-api/unicode.rst:665 msgid "" "Read a character from a string. This function checks that *unicode* is a " "Unicode object and the index is not out of bounds, in contrast to :c:func:" "`PyUnicode_READ_CHAR`, which performs no error checking." msgstr "" -#: ../../c-api/unicode.rst:659 +#: ../../c-api/unicode.rst:675 msgid "" "Return a substring of *unicode*, from character index *start* (included) to " "character index *end* (excluded). Negative indices are not supported." msgstr "" -#: ../../c-api/unicode.rst:668 +#: ../../c-api/unicode.rst:684 msgid "" "Copy the string *unicode* into a UCS4 buffer, including a null character, if " "*copy_null* is set. Returns ``NULL`` and sets an exception on error (in " @@ -856,7 +901,7 @@ msgid "" "*unicode*). *buffer* is returned on success." msgstr "" -#: ../../c-api/unicode.rst:678 +#: ../../c-api/unicode.rst:694 msgid "" "Copy the string *unicode* into a new UCS4 buffer that is allocated using :c:" "func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:" @@ -864,17 +909,17 @@ msgid "" "appended." msgstr "" -#: ../../c-api/unicode.rst:687 +#: ../../c-api/unicode.rst:703 msgid "Locale Encoding" msgstr "" -#: ../../c-api/unicode.rst:689 +#: ../../c-api/unicode.rst:705 msgid "" "The current locale encoding can be used to decode text from the operating " "system." msgstr "" -#: ../../c-api/unicode.rst:696 +#: ../../c-api/unicode.rst:712 msgid "" "Decode a string from UTF-8 on Android and VxWorks, or from the current " "locale encoding on other platforms. The supported error handlers are " @@ -883,21 +928,21 @@ msgid "" "null character but cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:703 +#: ../../c-api/unicode.rst:719 msgid "" "Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from the :" "term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:706 ../../c-api/unicode.rst:741 +#: ../../c-api/unicode.rst:722 ../../c-api/unicode.rst:757 msgid "This function ignores the :ref:`Python UTF-8 Mode `." msgstr "" -#: ../../c-api/unicode.rst:710 ../../c-api/unicode.rst:807 +#: ../../c-api/unicode.rst:726 ../../c-api/unicode.rst:823 msgid "The :c:func:`Py_DecodeLocale` function." msgstr ":c:func:`Py_DecodeLocale` 函式。" -#: ../../c-api/unicode.rst:714 +#: ../../c-api/unicode.rst:730 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -905,13 +950,13 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:723 +#: ../../c-api/unicode.rst:739 msgid "" "Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string " "length using :c:func:`!strlen`." msgstr "" -#: ../../c-api/unicode.rst:731 +#: ../../c-api/unicode.rst:747 msgid "" "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " "locale encoding on other platforms. The supported error handlers are " @@ -920,17 +965,17 @@ msgid "" "`bytes` object. *unicode* cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:738 +#: ../../c-api/unicode.rst:754 msgid "" "Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to the :term:" "`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:745 ../../c-api/unicode.rst:838 +#: ../../c-api/unicode.rst:761 ../../c-api/unicode.rst:854 msgid "The :c:func:`Py_EncodeLocale` function." msgstr ":c:func:`Py_EncodeLocale` 函式。" -#: ../../c-api/unicode.rst:749 +#: ../../c-api/unicode.rst:765 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -938,24 +983,24 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:758 +#: ../../c-api/unicode.rst:774 msgid "File System Encoding" msgstr "" -#: ../../c-api/unicode.rst:760 +#: ../../c-api/unicode.rst:776 msgid "" "Functions encoding to and decoding from the :term:`filesystem encoding and " "error handler` (:pep:`383` and :pep:`529`)." msgstr "" -#: ../../c-api/unicode.rst:763 +#: ../../c-api/unicode.rst:779 msgid "" "To encode file names to :class:`bytes` during argument parsing, the " "``\"O&\"`` converter should be used, passing :c:func:`PyUnicode_FSConverter` " "as the conversion function:" msgstr "" -#: ../../c-api/unicode.rst:769 +#: ../../c-api/unicode.rst:785 msgid "" "ParseTuple converter: encode :class:`str` objects -- obtained directly or " "through the :class:`os.PathLike` interface -- to :class:`bytes` using :c:" @@ -964,18 +1009,18 @@ msgid "" "is no longer used." msgstr "" -#: ../../c-api/unicode.rst:777 ../../c-api/unicode.rst:794 +#: ../../c-api/unicode.rst:793 ../../c-api/unicode.rst:810 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../c-api/unicode.rst:780 +#: ../../c-api/unicode.rst:796 msgid "" "To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` " "converter should be used, passing :c:func:`PyUnicode_FSDecoder` as the " "conversion function:" msgstr "" -#: ../../c-api/unicode.rst:786 +#: ../../c-api/unicode.rst:802 msgid "" "ParseTuple converter: decode :class:`bytes` objects -- obtained either " "directly or indirectly through the :class:`os.PathLike` interface -- to :" @@ -984,57 +1029,57 @@ msgid "" "which must be released when it is no longer used." msgstr "" -#: ../../c-api/unicode.rst:800 +#: ../../c-api/unicode.rst:816 msgid "Decode a string from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:802 +#: ../../c-api/unicode.rst:818 msgid "" "If you need to decode a string from the current locale encoding, use :c:func:" "`PyUnicode_DecodeLocaleAndSize`." msgstr "" -#: ../../c-api/unicode.rst:809 ../../c-api/unicode.rst:822 -#: ../../c-api/unicode.rst:842 +#: ../../c-api/unicode.rst:825 ../../c-api/unicode.rst:838 +#: ../../c-api/unicode.rst:858 msgid "" "The :term:`filesystem error handler ` " "is now used." msgstr "" -#: ../../c-api/unicode.rst:816 +#: ../../c-api/unicode.rst:832 msgid "" "Decode a null-terminated string from the :term:`filesystem encoding and " "error handler`." msgstr "" -#: ../../c-api/unicode.rst:819 +#: ../../c-api/unicode.rst:835 msgid "" "If the string length is known, use :c:func:" "`PyUnicode_DecodeFSDefaultAndSize`." msgstr "" -#: ../../c-api/unicode.rst:829 +#: ../../c-api/unicode.rst:845 msgid "" "Encode a Unicode object to the :term:`filesystem encoding and error " "handler`, and return :class:`bytes`. Note that the resulting :class:`bytes` " "object can contain null bytes." msgstr "" -#: ../../c-api/unicode.rst:833 +#: ../../c-api/unicode.rst:849 msgid "" "If you need to encode a string to the current locale encoding, use :c:func:" "`PyUnicode_EncodeLocale`." msgstr "" -#: ../../c-api/unicode.rst:847 +#: ../../c-api/unicode.rst:863 msgid "wchar_t Support" msgstr "wchar_t 支援" -#: ../../c-api/unicode.rst:849 +#: ../../c-api/unicode.rst:865 msgid ":c:type:`wchar_t` support for platforms which support it:" msgstr "" -#: ../../c-api/unicode.rst:853 +#: ../../c-api/unicode.rst:869 msgid "" "Create a Unicode object from the :c:type:`wchar_t` buffer *wstr* of the " "given *size*. Passing ``-1`` as the *size* indicates that the function must " @@ -1042,7 +1087,7 @@ msgid "" "failure." msgstr "" -#: ../../c-api/unicode.rst:861 +#: ../../c-api/unicode.rst:877 msgid "" "Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. " "At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly " @@ -1050,13 +1095,13 @@ msgid "" "`wchar_t` characters copied or ``-1`` in case of an error." msgstr "" -#: ../../c-api/unicode.rst:866 +#: ../../c-api/unicode.rst:882 msgid "" "When *wstr* is ``NULL``, instead return the *size* that would be required to " "store all of *unicode* including a terminating null." msgstr "" -#: ../../c-api/unicode.rst:869 +#: ../../c-api/unicode.rst:885 msgid "" "Note that the resulting :c:expr:`wchar_t*` string may or may not be null-" "terminated. It is the responsibility of the caller to make sure that the :c:" @@ -1066,7 +1111,7 @@ msgid "" "most C functions." msgstr "" -#: ../../c-api/unicode.rst:879 +#: ../../c-api/unicode.rst:895 msgid "" "Convert the Unicode object to a wide character string. The output string " "always ends with a null character. If *size* is not ``NULL``, write the " @@ -1077,37 +1122,37 @@ msgid "" "`wchar_t*` string contains null characters a :exc:`ValueError` is raised." msgstr "" -#: ../../c-api/unicode.rst:887 +#: ../../c-api/unicode.rst:903 msgid "" "Returns a buffer allocated by :c:macro:`PyMem_New` (use :c:func:`PyMem_Free` " "to free it) on success. On error, returns ``NULL`` and *\\*size* is " "undefined. Raises a :exc:`MemoryError` if memory allocation is failed." msgstr "" -#: ../../c-api/unicode.rst:894 +#: ../../c-api/unicode.rst:910 msgid "" "Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` " "string contains null characters." msgstr "" -#: ../../c-api/unicode.rst:902 +#: ../../c-api/unicode.rst:918 msgid "Built-in Codecs" msgstr "" -#: ../../c-api/unicode.rst:904 +#: ../../c-api/unicode.rst:920 msgid "" "Python provides a set of built-in codecs which are written in C for speed. " "All of these codecs are directly usable via the following functions." msgstr "" -#: ../../c-api/unicode.rst:907 +#: ../../c-api/unicode.rst:923 msgid "" "Many of the following APIs take two arguments encoding and errors, and they " "have the same semantics as the ones of the built-in :func:`str` string " "object constructor." msgstr "" -#: ../../c-api/unicode.rst:911 +#: ../../c-api/unicode.rst:927 msgid "" "Setting encoding to ``NULL`` causes the default encoding to be used which is " "UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for " @@ -1115,28 +1160,28 @@ msgid "" "handler` internally." msgstr "" -#: ../../c-api/unicode.rst:916 +#: ../../c-api/unicode.rst:932 msgid "" "Error handling is set by errors which may also be set to ``NULL`` meaning to " "use the default handling defined for the codec. Default error handling for " "all built-in codecs is \"strict\" (:exc:`ValueError` is raised)." msgstr "" -#: ../../c-api/unicode.rst:920 +#: ../../c-api/unicode.rst:936 msgid "" "The codecs all use a similar interface. Only deviations from the following " "generic ones are documented for simplicity." msgstr "" -#: ../../c-api/unicode.rst:925 +#: ../../c-api/unicode.rst:941 msgid "Generic Codecs" msgstr "" -#: ../../c-api/unicode.rst:927 +#: ../../c-api/unicode.rst:943 msgid "These are the generic codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:933 +#: ../../c-api/unicode.rst:949 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string " "*str*. *encoding* and *errors* have the same meaning as the parameters of " @@ -1145,7 +1190,7 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:943 +#: ../../c-api/unicode.rst:959 msgid "" "Encode a Unicode object and return the result as Python bytes object. " "*encoding* and *errors* have the same meaning as the parameters of the same " @@ -1154,21 +1199,21 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:951 +#: ../../c-api/unicode.rst:967 msgid "UTF-8 Codecs" msgstr "UTF-8 編解碼器" -#: ../../c-api/unicode.rst:953 +#: ../../c-api/unicode.rst:969 msgid "These are the UTF-8 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:958 +#: ../../c-api/unicode.rst:974 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:965 +#: ../../c-api/unicode.rst:981 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF8`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-8 byte sequences will " @@ -1176,14 +1221,14 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:973 +#: ../../c-api/unicode.rst:989 msgid "" "Encode a Unicode object using UTF-8 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:980 +#: ../../c-api/unicode.rst:996 msgid "" "Return a pointer to the UTF-8 encoding of the Unicode object, and store the " "size of the encoded representation (in bytes) in *size*. The *size* " @@ -1192,13 +1237,13 @@ msgid "" "regardless of whether there are any other null code points." msgstr "" -#: ../../c-api/unicode.rst:986 +#: ../../c-api/unicode.rst:1002 msgid "" -"In the case of an error, ``NULL`` is returned with an exception set and no " -"*size* is stored." +"On error, set an exception, set *size* to ``-1`` (if it's not NULL) and " +"return ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:989 +#: ../../c-api/unicode.rst:1005 msgid "" "This caches the UTF-8 representation of the string in the Unicode object, " "and subsequent calls will return a pointer to the same buffer. The caller " @@ -1207,47 +1252,47 @@ msgid "" "collected." msgstr "" -#: ../../c-api/unicode.rst:996 ../../c-api/unicode.rst:1009 +#: ../../c-api/unicode.rst:1012 ../../c-api/unicode.rst:1025 msgid "The return type is now ``const char *`` rather of ``char *``." msgstr "" -#: ../../c-api/unicode.rst:999 +#: ../../c-api/unicode.rst:1015 msgid "This function is a part of the :ref:`limited API `." msgstr "" -#: ../../c-api/unicode.rst:1005 +#: ../../c-api/unicode.rst:1021 msgid "As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size." msgstr "" -#: ../../c-api/unicode.rst:1014 +#: ../../c-api/unicode.rst:1030 msgid "UTF-32 Codecs" msgstr "UTF-32 編解碼器" -#: ../../c-api/unicode.rst:1016 +#: ../../c-api/unicode.rst:1032 msgid "These are the UTF-32 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1022 +#: ../../c-api/unicode.rst:1038 msgid "" "Decode *size* bytes from a UTF-32 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1026 ../../c-api/unicode.rst:1076 +#: ../../c-api/unicode.rst:1042 ../../c-api/unicode.rst:1092 msgid "" "If *byteorder* is non-``NULL``, the decoder starts decoding using the given " "byte order::" msgstr "" -#: ../../c-api/unicode.rst:1029 ../../c-api/unicode.rst:1079 +#: ../../c-api/unicode.rst:1045 ../../c-api/unicode.rst:1095 msgid "" "*byteorder == -1: little endian\n" "*byteorder == 0: native order\n" "*byteorder == 1: big endian" msgstr "" -#: ../../c-api/unicode.rst:1033 +#: ../../c-api/unicode.rst:1049 msgid "" "If ``*byteorder`` is zero, and the first four bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1255,21 +1300,21 @@ msgid "" "``-1`` or ``1``, any byte order mark is copied to the output." msgstr "" -#: ../../c-api/unicode.rst:1038 +#: ../../c-api/unicode.rst:1054 msgid "" "After completion, *\\*byteorder* is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1041 ../../c-api/unicode.rst:1092 +#: ../../c-api/unicode.rst:1057 ../../c-api/unicode.rst:1108 msgid "If *byteorder* is ``NULL``, the codec starts in native order mode." msgstr "" -#: ../../c-api/unicode.rst:1043 ../../c-api/unicode.rst:1094 +#: ../../c-api/unicode.rst:1059 ../../c-api/unicode.rst:1110 msgid "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1049 +#: ../../c-api/unicode.rst:1065 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF32`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF32Stateful` will not " @@ -1278,29 +1323,29 @@ msgid "" "number of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1058 +#: ../../c-api/unicode.rst:1074 msgid "" "Return a Python byte string using the UTF-32 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1064 +#: ../../c-api/unicode.rst:1080 msgid "UTF-16 Codecs" msgstr "UTF-16 編解碼器" -#: ../../c-api/unicode.rst:1066 +#: ../../c-api/unicode.rst:1082 msgid "These are the UTF-16 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1072 +#: ../../c-api/unicode.rst:1088 msgid "" "Decode *size* bytes from a UTF-16 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1083 +#: ../../c-api/unicode.rst:1099 msgid "" "If ``*byteorder`` is zero, and the first two bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1309,13 +1354,13 @@ msgid "" "result in either a ``\\ufeff`` or a ``\\ufffe`` character)." msgstr "" -#: ../../c-api/unicode.rst:1089 +#: ../../c-api/unicode.rst:1105 msgid "" "After completion, ``*byteorder`` is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1100 +#: ../../c-api/unicode.rst:1116 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF16`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF16Stateful` will not " @@ -1325,28 +1370,28 @@ msgid "" "*consumed*." msgstr "" -#: ../../c-api/unicode.rst:1109 +#: ../../c-api/unicode.rst:1125 msgid "" "Return a Python byte string using the UTF-16 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1115 +#: ../../c-api/unicode.rst:1131 msgid "UTF-7 Codecs" msgstr "UTF-7 編解碼器" -#: ../../c-api/unicode.rst:1117 +#: ../../c-api/unicode.rst:1133 msgid "These are the UTF-7 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1122 +#: ../../c-api/unicode.rst:1138 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1129 +#: ../../c-api/unicode.rst:1145 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF7`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-7 base-64 sections will " @@ -1354,101 +1399,101 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1136 +#: ../../c-api/unicode.rst:1152 msgid "Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1138 +#: ../../c-api/unicode.rst:1154 msgid "These are the \"Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1144 +#: ../../c-api/unicode.rst:1160 msgid "" "Create a Unicode object by decoding *size* bytes of the Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1150 +#: ../../c-api/unicode.rst:1166 msgid "" "Encode a Unicode object using Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1156 +#: ../../c-api/unicode.rst:1172 msgid "Raw-Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1158 +#: ../../c-api/unicode.rst:1174 msgid "These are the \"Raw Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1164 +#: ../../c-api/unicode.rst:1180 msgid "" "Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1170 +#: ../../c-api/unicode.rst:1186 msgid "" "Encode a Unicode object using Raw-Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1176 +#: ../../c-api/unicode.rst:1192 msgid "Latin-1 Codecs" msgstr "Latin-1 編解碼器" -#: ../../c-api/unicode.rst:1178 +#: ../../c-api/unicode.rst:1194 msgid "" "These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 " "Unicode ordinals and only these are accepted by the codecs during encoding." msgstr "" -#: ../../c-api/unicode.rst:1184 +#: ../../c-api/unicode.rst:1200 msgid "" "Create a Unicode object by decoding *size* bytes of the Latin-1 encoded " "string *str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1190 +#: ../../c-api/unicode.rst:1206 msgid "" "Encode a Unicode object using Latin-1 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1196 +#: ../../c-api/unicode.rst:1212 msgid "ASCII Codecs" msgstr "ASCII 編解碼器" -#: ../../c-api/unicode.rst:1198 +#: ../../c-api/unicode.rst:1214 msgid "" "These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All " "other codes generate errors." msgstr "" -#: ../../c-api/unicode.rst:1204 +#: ../../c-api/unicode.rst:1220 msgid "" "Create a Unicode object by decoding *size* bytes of the ASCII encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1210 +#: ../../c-api/unicode.rst:1226 msgid "" "Encode a Unicode object using ASCII and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1216 +#: ../../c-api/unicode.rst:1232 msgid "Character Map Codecs" msgstr "" -#: ../../c-api/unicode.rst:1218 +#: ../../c-api/unicode.rst:1234 msgid "" "This codec is special in that it can be used to implement many different " "codecs (and this is in fact what was done to obtain most of the standard " @@ -1458,18 +1503,18 @@ msgid "" "sequences work well." msgstr "" -#: ../../c-api/unicode.rst:1224 +#: ../../c-api/unicode.rst:1240 msgid "These are the mapping codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1229 +#: ../../c-api/unicode.rst:1245 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string *str* " "using the given *mapping* object. Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1233 +#: ../../c-api/unicode.rst:1249 msgid "" "If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* " "must map bytes ordinals (integers in the range from 0 to 255) to Unicode " @@ -1479,14 +1524,14 @@ msgid "" "treated as undefined mappings and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1244 +#: ../../c-api/unicode.rst:1260 msgid "" "Encode a Unicode object using the given *mapping* object and return the " "result as a bytes object. Error handling is \"strict\". Return ``NULL`` if " "an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1248 +#: ../../c-api/unicode.rst:1264 msgid "" "The *mapping* object must map Unicode ordinal integers to bytes objects, " "integers in the range from 0 to 255 or ``None``. Unmapped character " @@ -1494,41 +1539,41 @@ msgid "" "``None`` are treated as \"undefined mapping\" and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1254 +#: ../../c-api/unicode.rst:1270 msgid "The following codec API is special in that maps Unicode to Unicode." msgstr "" -#: ../../c-api/unicode.rst:1258 +#: ../../c-api/unicode.rst:1274 msgid "" "Translate a string by applying a character mapping table to it and return " "the resulting Unicode object. Return ``NULL`` if an exception was raised by " "the codec." msgstr "" -#: ../../c-api/unicode.rst:1262 +#: ../../c-api/unicode.rst:1278 msgid "" "The mapping table must map Unicode ordinal integers to Unicode ordinal " "integers or ``None`` (causing deletion of the character)." msgstr "" -#: ../../c-api/unicode.rst:1265 +#: ../../c-api/unicode.rst:1281 msgid "" "Mapping tables need only provide the :meth:`~object.__getitem__` interface; " "dictionaries and sequences work well. Unmapped character ordinals (ones " "which cause a :exc:`LookupError`) are left untouched and are copied as-is." msgstr "" -#: ../../c-api/unicode.rst:1269 +#: ../../c-api/unicode.rst:1285 msgid "" "*errors* has the usual meaning for codecs. It may be ``NULL`` which " "indicates to use the default error handling." msgstr "" -#: ../../c-api/unicode.rst:1274 +#: ../../c-api/unicode.rst:1290 msgid "MBCS codecs for Windows" msgstr "" -#: ../../c-api/unicode.rst:1276 +#: ../../c-api/unicode.rst:1292 msgid "" "These are the MBCS codec APIs. They are currently only available on Windows " "and use the Win32 MBCS converters to implement the conversions. Note that " @@ -1536,13 +1581,13 @@ msgid "" "is defined by the user settings on the machine running the codec." msgstr "" -#: ../../c-api/unicode.rst:1283 +#: ../../c-api/unicode.rst:1299 msgid "" "Create a Unicode object by decoding *size* bytes of the MBCS encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1290 +#: ../../c-api/unicode.rst:1306 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeMBCS`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeMBCSStateful` will not " @@ -1550,44 +1595,44 @@ msgid "" "will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1298 +#: ../../c-api/unicode.rst:1314 msgid "" "Encode a Unicode object using MBCS and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1305 +#: ../../c-api/unicode.rst:1321 msgid "" "Encode the Unicode object using the specified code page and return a Python " "bytes object. Return ``NULL`` if an exception was raised by the codec. Use :" "c:macro:`!CP_ACP` code page to get the MBCS encoder." msgstr "" -#: ../../c-api/unicode.rst:1313 +#: ../../c-api/unicode.rst:1329 msgid "Methods & Slots" msgstr "" -#: ../../c-api/unicode.rst:1319 +#: ../../c-api/unicode.rst:1335 msgid "Methods and Slot Functions" msgstr "" -#: ../../c-api/unicode.rst:1321 +#: ../../c-api/unicode.rst:1337 msgid "" "The following APIs are capable of handling Unicode objects and strings on " "input (we refer to them as strings in the descriptions) and return Unicode " "objects or integers as appropriate." msgstr "" -#: ../../c-api/unicode.rst:1325 +#: ../../c-api/unicode.rst:1341 msgid "They all return ``NULL`` or ``-1`` if an exception occurs." msgstr "" -#: ../../c-api/unicode.rst:1330 +#: ../../c-api/unicode.rst:1346 msgid "Concat two strings giving a new Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1335 +#: ../../c-api/unicode.rst:1351 msgid "" "Split a string giving a list of Unicode strings. If *sep* is ``NULL``, " "splitting will be done at all whitespace substrings. Otherwise, splits " @@ -1596,27 +1641,27 @@ msgid "" "list." msgstr "" -#: ../../c-api/unicode.rst:1343 +#: ../../c-api/unicode.rst:1359 msgid "" "Split a Unicode string at line breaks, returning a list of Unicode strings. " "CRLF is considered to be one line break. If *keepends* is ``0``, the Line " "break characters are not included in the resulting strings." msgstr "" -#: ../../c-api/unicode.rst:1350 +#: ../../c-api/unicode.rst:1366 msgid "" "Join a sequence of strings using the given *separator* and return the " "resulting Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1357 +#: ../../c-api/unicode.rst:1373 msgid "" "Return ``1`` if *substr* matches ``unicode[start:end]`` at the given tail " "end (*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` " "a suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1365 +#: ../../c-api/unicode.rst:1381 msgid "" "Return the first position of *substr* in ``unicode[start:end]`` using the " "given *direction* (*direction* == ``1`` means to do a forward search, " @@ -1625,7 +1670,7 @@ msgid "" "``-2`` indicates that an error occurred and an exception has been set." msgstr "" -#: ../../c-api/unicode.rst:1375 +#: ../../c-api/unicode.rst:1391 msgid "" "Return the first position of the character *ch* in ``unicode[start:end]`` " "using the given *direction* (*direction* == ``1`` means to do a forward " @@ -1635,37 +1680,56 @@ msgid "" "set." msgstr "" -#: ../../c-api/unicode.rst:1383 +#: ../../c-api/unicode.rst:1399 msgid "" "*start* and *end* are now adjusted to behave like ``unicode[start:end]``." msgstr "" -#: ../../c-api/unicode.rst:1390 +#: ../../c-api/unicode.rst:1406 msgid "" "Return the number of non-overlapping occurrences of *substr* in " "``unicode[start:end]``. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1397 +#: ../../c-api/unicode.rst:1413 msgid "" "Replace at most *maxcount* occurrences of *substr* in *unicode* with " "*replstr* and return the resulting Unicode object. *maxcount* == ``-1`` " "means replace all occurrences." msgstr "" -#: ../../c-api/unicode.rst:1404 +#: ../../c-api/unicode.rst:1420 msgid "" "Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, " "and greater than, respectively." msgstr "" -#: ../../c-api/unicode.rst:1407 +#: ../../c-api/unicode.rst:1423 msgid "" "This function returns ``-1`` upon failure, so one should call :c:func:" "`PyErr_Occurred` to check for errors." msgstr "" -#: ../../c-api/unicode.rst:1413 +#: ../../c-api/unicode.rst:1429 +msgid "" +"Compare a Unicode object with a char buffer which is interpreted as being " +"UTF-8 or ASCII encoded and return true (``1``) if they are equal, or false " +"(``0``) otherwise. If the Unicode object contains surrogate characters or " +"the C string is not valid UTF-8, false (``0``) is returned." +msgstr "" + +#: ../../c-api/unicode.rst:1435 ../../c-api/unicode.rst:1456 +msgid "This function does not raise exceptions." +msgstr "" + +#: ../../c-api/unicode.rst:1442 +msgid "" +"Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string* " +"length using :c:func:`!strlen`. If the Unicode object contains null " +"characters, false (``0``) is returned." +msgstr "" + +#: ../../c-api/unicode.rst:1451 msgid "" "Compare a Unicode object, *unicode*, with *string* and return ``-1``, ``0``, " "``1`` for less than, equal, and greater than, respectively. It is best to " @@ -1673,51 +1737,47 @@ msgid "" "string as ISO-8859-1 if it contains non-ASCII characters." msgstr "" -#: ../../c-api/unicode.rst:1418 -msgid "This function does not raise exceptions." -msgstr "" - -#: ../../c-api/unicode.rst:1423 +#: ../../c-api/unicode.rst:1461 msgid "Rich compare two Unicode strings and return one of the following:" msgstr "" -#: ../../c-api/unicode.rst:1425 +#: ../../c-api/unicode.rst:1463 msgid "``NULL`` in case an exception was raised" msgstr "" -#: ../../c-api/unicode.rst:1426 +#: ../../c-api/unicode.rst:1464 msgid ":c:data:`Py_True` or :c:data:`Py_False` for successful comparisons" msgstr "" -#: ../../c-api/unicode.rst:1427 +#: ../../c-api/unicode.rst:1465 msgid ":c:data:`Py_NotImplemented` in case the type combination is unknown" msgstr "" -#: ../../c-api/unicode.rst:1429 +#: ../../c-api/unicode.rst:1467 msgid "" "Possible values for *op* are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:" "`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, and :c:macro:`Py_LE`." msgstr "" -#: ../../c-api/unicode.rst:1435 +#: ../../c-api/unicode.rst:1473 msgid "" "Return a new string object from *format* and *args*; this is analogous to " "``format % args``." msgstr "" -#: ../../c-api/unicode.rst:1441 +#: ../../c-api/unicode.rst:1479 msgid "" "Check whether *substr* is contained in *unicode* and return true or false " "accordingly." msgstr "" -#: ../../c-api/unicode.rst:1444 +#: ../../c-api/unicode.rst:1482 msgid "" "*substr* has to coerce to a one element Unicode string. ``-1`` is returned " "if there was an error." msgstr "" -#: ../../c-api/unicode.rst:1450 +#: ../../c-api/unicode.rst:1488 msgid "" "Intern the argument :c:expr:`*p_unicode` in place. The argument must be the " "address of a pointer variable pointing to a Python Unicode string object. " @@ -1725,16 +1785,58 @@ msgid "" "`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the reference to " "the old string object and creating a new :term:`strong reference` to the " "interned string object), otherwise it leaves :c:expr:`*p_unicode` alone and " -"interns it (creating a new :term:`strong reference`). (Clarification: even " -"though there is a lot of talk about references, think of this function as " -"reference-neutral; you own the object after the call if and only if you " -"owned it before the call.)" +"interns it." msgstr "" -#: ../../c-api/unicode.rst:1463 +#: ../../c-api/unicode.rst:1495 +msgid "" +"(Clarification: even though there is a lot of talk about references, think " +"of this function as reference-neutral. You must own the object you pass in; " +"after the call you no longer own the passed-in reference, but you newly own " +"the result.)" +msgstr "" + +#: ../../c-api/unicode.rst:1500 +msgid "" +"This function never raises an exception. On error, it leaves its argument " +"unchanged without interning it." +msgstr "" + +#: ../../c-api/unicode.rst:1503 +msgid "" +"Instances of subclasses of :py:class:`str` may not be interned, that is, :c:" +"expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, then -- " +"as with any other error -- the argument is left unchanged." +msgstr "" + +#: ../../c-api/unicode.rst:1507 +msgid "" +"Note that interned strings are not “immortal”. You must keep a reference to " +"the result to benefit from interning." +msgstr "" + +#: ../../c-api/unicode.rst:1513 msgid "" "A combination of :c:func:`PyUnicode_FromString` and :c:func:" -"`PyUnicode_InternInPlace`, returning either a new Unicode string object that " -"has been interned, or a new (\"owned\") reference to an earlier interned " -"string object with the same value." +"`PyUnicode_InternInPlace`, meant for statically allocated strings." +msgstr "" + +#: ../../c-api/unicode.rst:1516 +msgid "" +"Return a new (\"owned\") reference to either a new Unicode string object " +"that has been interned, or an earlier interned string object with the same " +"value." +msgstr "" + +#: ../../c-api/unicode.rst:1520 +msgid "" +"Python may keep a reference to the result, or make it :term:`immortal`, " +"preventing it from being garbage-collected promptly. For interning an " +"unbounded number of different strings, such as ones coming from user input, " +"prefer calling :c:func:`PyUnicode_FromString` and :c:func:" +"`PyUnicode_InternInPlace` directly." +msgstr "" + +#: ../../c-api/unicode.rst:1528 +msgid "Strings interned this way are made :term:`immortal`." msgstr "" diff --git a/c-api/weakref.po b/c-api/weakref.po index 5e805fe78e..7bbbcb9f44 100644 --- a/c-api/weakref.po +++ b/c-api/weakref.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-27 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,17 +33,19 @@ msgstr "" #: ../../c-api/weakref.rst:16 msgid "" -"Return true if *ob* is either a reference or proxy object. This function " -"always succeeds." +"Return non-zero if *ob* is either a reference or proxy object. This " +"function always succeeds." msgstr "" #: ../../c-api/weakref.rst:22 msgid "" -"Return true if *ob* is a reference object. This function always succeeds." +"Return non-zero if *ob* is a reference object. This function always " +"succeeds." msgstr "" #: ../../c-api/weakref.rst:27 -msgid "Return true if *ob* is a proxy object. This function always succeeds." +msgid "" +"Return non-zero if *ob* is a proxy object. This function always succeeds." msgstr "" #: ../../c-api/weakref.rst:32 @@ -72,11 +74,31 @@ msgstr "" #: ../../c-api/weakref.rst:56 msgid "" -"Return the referenced object from a weak reference, *ref*. If the referent " -"is no longer live, returns ``Py_None``." +"Get a :term:`strong reference` to the referenced object from a weak " +"reference, *ref*, into *\\*pobj*." +msgstr "" + +#: ../../c-api/weakref.rst:59 +msgid "" +"On success, set *\\*pobj* to a new :term:`strong reference` to the " +"referenced object and return 1." msgstr "" #: ../../c-api/weakref.rst:61 +msgid "If the reference is dead, set *\\*pobj* to ``NULL`` and return 0." +msgstr "" + +#: ../../c-api/weakref.rst:62 +msgid "On error, raise an exception and return -1." +msgstr "" + +#: ../../c-api/weakref.rst:69 +msgid "" +"Return a :term:`borrowed reference` to the referenced object from a weak " +"reference, *ref*. If the referent is no longer live, returns ``Py_None``." +msgstr "" + +#: ../../c-api/weakref.rst:74 msgid "" "This function returns a :term:`borrowed reference` to the referenced object. " "This means that you should always call :c:func:`Py_INCREF` on the object " @@ -84,19 +106,42 @@ msgid "" "reference." msgstr "" -#: ../../c-api/weakref.rst:69 +#: ../../c-api/weakref.rst:79 ../../c-api/weakref.rst:87 +msgid "Use :c:func:`PyWeakref_GetRef` instead." +msgstr "" + +#: ../../c-api/weakref.rst:85 msgid "Similar to :c:func:`PyWeakref_GetObject`, but does no error checking." msgstr "" -#: ../../c-api/weakref.rst:74 +#: ../../c-api/weakref.rst:93 msgid "" "This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler " "to clear weak references." msgstr "" -#: ../../c-api/weakref.rst:77 +#: ../../c-api/weakref.rst:96 msgid "" "This iterates through the weak references for *object* and calls callbacks " "for those references which have one. It returns when all callbacks have been " "attempted." msgstr "" + +#: ../../c-api/weakref.rst:103 +msgid "Clears the weakrefs for *object* without calling the callbacks." +msgstr "" + +#: ../../c-api/weakref.rst:105 +msgid "" +"This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler " +"for types with finalizers (i.e., :meth:`~object.__del__`). The handler for " +"those objects first calls :c:func:`PyObject_ClearWeakRefs` to clear weakrefs " +"and call their callbacks, then the finalizer, and finally this function to " +"clear any weakrefs that may have been created by the finalizer." +msgstr "" + +#: ../../c-api/weakref.rst:111 +msgid "" +"In most circumstances, it's more appropriate to use :c:func:" +"`PyObject_ClearWeakRefs` to clear weakrefs instead of this function." +msgstr "" diff --git a/copyright.po b/copyright.po index 27acc6692d..63bcc2fbfa 100644 --- a/copyright.po +++ b/copyright.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-01-10 00:17+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-06-25 20:17+0800\n" "Last-Translator: meowmeowcat \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,7 +32,8 @@ msgid "Python and this documentation is:" msgstr "Python 和這份說明文件的版權:" #: ../../copyright.rst:7 -msgid "Copyright © 2001-2023 Python Software Foundation. All rights reserved." +#, fuzzy +msgid "Copyright © 2001-2024 Python Software Foundation. All rights reserved." msgstr "Copyright © 2001-2023 Python Software Foundation 保留一切權利。" #: ../../copyright.rst:9 diff --git a/deprecations/c-api-pending-removal-in-3.15.po b/deprecations/c-api-pending-removal-in-3.15.po index 48eda9c242..20ea03215f 100644 --- a/deprecations/c-api-pending-removal-in-3.15.po +++ b/deprecations/c-api-pending-removal-in-3.15.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-17 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -33,13 +33,12 @@ msgstr "" "`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 -msgid "" -":c:func:`PyWeakref_GET_OBJECT`: use :c:func:`!PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GET_OBJECT`:請改用 :c:func:`!PyWeakref_GetRef`。" +msgid ":c:func:`PyWeakref_GET_OBJECT`: use :c:func:`PyWeakref_GetRef` instead." +msgstr ":c:func:`PyWeakref_GET_OBJECT`:請改用 :c:func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 -msgid ":c:func:`PyWeakref_GetObject`: use :c:func:`!PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GetObject`:請改用 :c:func:`!PyWeakref_GetRef`。" +msgid ":c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef` instead." +msgstr ":c:func:`PyWeakref_GetObject`:請改用 :c:func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:8 msgid ":c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead." diff --git a/deprecations/index.po b/deprecations/index.po index a60a074bcb..88748aa9dd 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-30 18:24+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,180 +20,6 @@ msgstr "" msgid "Deprecations" msgstr "已棄用項目" -#: ../../deprecations/pending-removal-in-3.13.rst:2 -msgid "Pending Removal in Python 3.13" -msgstr "Python 3.13 中待移除的項目" - -#: ../../deprecations/pending-removal-in-3.13.rst:4 -msgid "Modules (see :pep:`594`):" -msgstr "模組(請見 :pep:`594`):" - -#: ../../deprecations/pending-removal-in-3.13.rst:6 -msgid ":mod:`aifc`" -msgstr ":mod:`aifc`" - -#: ../../deprecations/pending-removal-in-3.13.rst:7 -msgid ":mod:`audioop`" -msgstr ":mod:`audioop`" - -#: ../../deprecations/pending-removal-in-3.13.rst:8 -msgid ":mod:`cgi`" -msgstr ":mod:`cgi`" - -#: ../../deprecations/pending-removal-in-3.13.rst:9 -msgid ":mod:`cgitb`" -msgstr ":mod:`cgitb`" - -#: ../../deprecations/pending-removal-in-3.13.rst:10 -msgid ":mod:`chunk`" -msgstr ":mod:`chunk`" - -#: ../../deprecations/pending-removal-in-3.13.rst:11 -msgid ":mod:`crypt`" -msgstr ":mod:`crypt`" - -#: ../../deprecations/pending-removal-in-3.13.rst:12 -msgid ":mod:`imghdr`" -msgstr ":mod:`imghdr`" - -#: ../../deprecations/pending-removal-in-3.13.rst:13 -msgid ":mod:`mailcap`" -msgstr ":mod:`mailcap`" - -#: ../../deprecations/pending-removal-in-3.13.rst:14 -msgid ":mod:`msilib`" -msgstr ":mod:`msilib`" - -#: ../../deprecations/pending-removal-in-3.13.rst:15 -msgid ":mod:`nis`" -msgstr ":mod:`nis`" - -#: ../../deprecations/pending-removal-in-3.13.rst:16 -msgid ":mod:`nntplib`" -msgstr ":mod:`nntplib`" - -#: ../../deprecations/pending-removal-in-3.13.rst:17 -msgid ":mod:`ossaudiodev`" -msgstr ":mod:`ossaudiodev`" - -#: ../../deprecations/pending-removal-in-3.13.rst:18 -msgid ":mod:`pipes`" -msgstr ":mod:`pipes`" - -#: ../../deprecations/pending-removal-in-3.13.rst:19 -msgid ":mod:`sndhdr`" -msgstr ":mod:`sndhdr`" - -#: ../../deprecations/pending-removal-in-3.13.rst:20 -msgid ":mod:`spwd`" -msgstr ":mod:`spwd`" - -#: ../../deprecations/pending-removal-in-3.13.rst:21 -msgid ":mod:`sunau`" -msgstr ":mod:`sunau`" - -#: ../../deprecations/pending-removal-in-3.13.rst:22 -msgid ":mod:`telnetlib`" -msgstr ":mod:`telnetlib`" - -#: ../../deprecations/pending-removal-in-3.13.rst:23 -msgid ":mod:`uu`" -msgstr ":mod:`uu`" - -#: ../../deprecations/pending-removal-in-3.13.rst:24 -msgid ":mod:`xdrlib`" -msgstr ":mod:`xdrlib`" - -#: ../../deprecations/pending-removal-in-3.13.rst:26 -msgid "Other modules:" -msgstr "其他模組:" - -#: ../../deprecations/pending-removal-in-3.13.rst:28 -msgid ":mod:`!lib2to3`, and the :program:`2to3` program (:gh:`84540`)" -msgstr ":mod:`!lib2to3` 和 :program:`2to3` 程式 (:gh:`84540`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:30 -msgid "APIs:" -msgstr "API:" - -#: ../../deprecations/pending-removal-in-3.13.rst:32 -msgid ":class:`!configparser.LegacyInterpolation` (:gh:`90765`)" -msgstr ":class:`!configparser.LegacyInterpolation` (:gh:`90765`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:33 -msgid "``locale.resetlocale()`` (:gh:`90817`)" -msgstr "``locale.resetlocale()`` (:gh:`90817`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:34 -msgid ":meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)" -msgstr ":meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:35 -msgid ":func:`!unittest.findTestCases` (:gh:`50096`)" -msgstr ":func:`!unittest.findTestCases` (:gh:`50096`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:36 -msgid ":func:`!unittest.getTestCaseNames` (:gh:`50096`)" -msgstr ":func:`!unittest.getTestCaseNames` (:gh:`50096`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:37 -msgid ":func:`!unittest.makeSuite` (:gh:`50096`)" -msgstr ":func:`!unittest.makeSuite` (:gh:`50096`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:38 -msgid ":meth:`!unittest.TestProgram.usageExit` (:gh:`67048`)" -msgstr ":meth:`!unittest.TestProgram.usageExit` (:gh:`67048`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:39 -msgid ":class:`!webbrowser.MacOSX` (:gh:`86421`)" -msgstr ":class:`!webbrowser.MacOSX` (:gh:`86421`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:40 -msgid ":class:`classmethod` descriptor chaining (:gh:`89519`)" -msgstr ":class:`classmethod` 描述器鏈接 (:gh:`89519`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:41 -msgid ":mod:`importlib.resources` deprecated methods:" -msgstr ":mod:`importlib.resources` 的已棄用方法:" - -#: ../../deprecations/pending-removal-in-3.13.rst:43 -msgid "``contents()``" -msgstr "``contents()``" - -#: ../../deprecations/pending-removal-in-3.13.rst:44 -msgid "``is_resource()``" -msgstr "``is_resource()``" - -#: ../../deprecations/pending-removal-in-3.13.rst:45 -msgid "``open_binary()``" -msgstr "``open_binary()``" - -#: ../../deprecations/pending-removal-in-3.13.rst:46 -msgid "``open_text()``" -msgstr "``open_text()``" - -#: ../../deprecations/pending-removal-in-3.13.rst:47 -msgid "``path()``" -msgstr "``path()``" - -#: ../../deprecations/pending-removal-in-3.13.rst:48 -msgid "``read_binary()``" -msgstr "``read_binary()``" - -#: ../../deprecations/pending-removal-in-3.13.rst:49 -msgid "``read_text()``" -msgstr "``read_text()``" - -#: ../../deprecations/pending-removal-in-3.13.rst:51 -msgid "" -"Use :func:`importlib.resources.files` instead. Refer to `importlib-" -"resources: Migrating from Legacy `_ (:gh:`106531`)" -msgstr "" -"請改用 :func:`importlib.resources.files`。請參閱 `importlib-resources: " -"Migrating from Legacy `_ (:gh:`106531`)" - #: ../../deprecations/c-api-pending-removal-in-3.14.rst:2 #: ../../deprecations/pending-removal-in-3.14.rst:2 msgid "Pending Removal in Python 3.14" @@ -489,12 +315,11 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:16 msgid "" ":mod:`pathlib`: :meth:`pathlib.PurePath.is_reserved` is deprecated and " -"scheduled for removal in Python 3.15. From Python 3.13 onwards, use ``os." -"path.isreserved`` to detect reserved paths on Windows." +"scheduled for removal in Python 3.15. Use :func:`os.path.isreserved` to " +"detect reserved paths on Windows." msgstr "" ":mod:`pathlib`::meth:`pathlib.PurePath.is_reserved` 已被棄用並計劃在 Python " -"3.15 中移除。從 Python 3.13 開始,請用 ``os.path.isreserved`` 來偵測 Windows " -"上的保留路徑。" +"3.15 中移除。請用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:21 msgid "" @@ -769,17 +594,23 @@ msgstr "回傳值上的隱式 ``None``。" #: ../../deprecations/pending-removal-in-future.rst:69 msgid "" +":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " +"use :meth:`~logging.warning` instead." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:72 +msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:75 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:74 +#: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -787,7 +618,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:80 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -799,12 +630,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:84 +#: ../../deprecations/pending-removal-in-future.rst:87 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:86 +#: ../../deprecations/pending-removal-in-future.rst:89 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -812,15 +643,15 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:92 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:91 +#: ../../deprecations/pending-removal-in-future.rst:94 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:95 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" "`!selected_npn_protocol` are deprecated: use ALPN instead." @@ -828,58 +659,58 @@ msgstr "" ":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" "`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:96 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:97 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:107 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid "" ":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " "ignored." msgstr "" ":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" -#: ../../deprecations/pending-removal-in-future.rst:109 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:111 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid "" ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." "notify_all`." @@ -887,11 +718,11 @@ msgstr "" ":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." "notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:113 +#: ../../deprecations/pending-removal-in-future.rst:116 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" "attr:`threading.Thread.daemon` attribute." @@ -899,7 +730,7 @@ msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:118 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" "attr:`threading.Thread.name` attribute." @@ -907,20 +738,20 @@ msgstr "" ":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" "attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:117 +#: ../../deprecations/pending-removal-in-future.rst:120 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:121 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:123 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:122 +#: ../../deprecations/pending-removal-in-future.rst:125 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -928,58 +759,58 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:127 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:129 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:135 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:137 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:139 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "" ":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" "`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " @@ -989,13 +820,13 @@ msgstr "" "class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" "`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:143 +#: ../../deprecations/pending-removal-in-future.rst:146 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:149 msgid "" ":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." "etree.ElementTree.Element` is deprecated. In a future release it will always " @@ -1006,7 +837,7 @@ msgstr "" "Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " "``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:151 +#: ../../deprecations/pending-removal-in-future.rst:154 msgid "" ":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" "`~zipimport.zipimporter.exec_module` instead." @@ -1014,7 +845,7 @@ msgstr "" ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." "zipimporter.exec_module`。" -#: ../../deprecations/index.rst:15 +#: ../../deprecations/index.rst:13 msgid "C API Deprecations" msgstr "C API 的棄用項目" @@ -1216,13 +1047,12 @@ msgstr "" "`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 -msgid "" -":c:func:`PyWeakref_GET_OBJECT`: use :c:func:`!PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GET_OBJECT`:請改用 :c:func:`!PyWeakref_GetRef`。" +msgid ":c:func:`PyWeakref_GET_OBJECT`: use :c:func:`PyWeakref_GetRef` instead." +msgstr ":c:func:`PyWeakref_GET_OBJECT`:請改用 :c:func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 -msgid ":c:func:`PyWeakref_GetObject`: use :c:func:`!PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GetObject`:請改用 :c:func:`!PyWeakref_GetRef`。" +msgid ":c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef` instead." +msgstr ":c:func:`PyWeakref_GetObject`:請改用 :c:func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:8 msgid ":c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead." @@ -1401,3 +1231,135 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-future.rst:31 msgid ":c:func:`PyThread_ReInitTLS`: unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" + +#~ msgid "Pending Removal in Python 3.13" +#~ msgstr "Python 3.13 中待移除的項目" + +#~ msgid "Modules (see :pep:`594`):" +#~ msgstr "模組(請見 :pep:`594`):" + +#~ msgid ":mod:`aifc`" +#~ msgstr ":mod:`aifc`" + +#~ msgid ":mod:`audioop`" +#~ msgstr ":mod:`audioop`" + +#~ msgid ":mod:`cgi`" +#~ msgstr ":mod:`cgi`" + +#~ msgid ":mod:`cgitb`" +#~ msgstr ":mod:`cgitb`" + +#~ msgid ":mod:`chunk`" +#~ msgstr ":mod:`chunk`" + +#~ msgid ":mod:`crypt`" +#~ msgstr ":mod:`crypt`" + +#~ msgid ":mod:`imghdr`" +#~ msgstr ":mod:`imghdr`" + +#~ msgid ":mod:`mailcap`" +#~ msgstr ":mod:`mailcap`" + +#~ msgid ":mod:`msilib`" +#~ msgstr ":mod:`msilib`" + +#~ msgid ":mod:`nis`" +#~ msgstr ":mod:`nis`" + +#~ msgid ":mod:`nntplib`" +#~ msgstr ":mod:`nntplib`" + +#~ msgid ":mod:`ossaudiodev`" +#~ msgstr ":mod:`ossaudiodev`" + +#~ msgid ":mod:`pipes`" +#~ msgstr ":mod:`pipes`" + +#~ msgid ":mod:`sndhdr`" +#~ msgstr ":mod:`sndhdr`" + +#~ msgid ":mod:`spwd`" +#~ msgstr ":mod:`spwd`" + +#~ msgid ":mod:`sunau`" +#~ msgstr ":mod:`sunau`" + +#~ msgid ":mod:`telnetlib`" +#~ msgstr ":mod:`telnetlib`" + +#~ msgid ":mod:`uu`" +#~ msgstr ":mod:`uu`" + +#~ msgid ":mod:`xdrlib`" +#~ msgstr ":mod:`xdrlib`" + +#~ msgid "Other modules:" +#~ msgstr "其他模組:" + +#~ msgid ":mod:`!lib2to3`, and the :program:`2to3` program (:gh:`84540`)" +#~ msgstr ":mod:`!lib2to3` 和 :program:`2to3` 程式 (:gh:`84540`)" + +#~ msgid "APIs:" +#~ msgstr "API:" + +#~ msgid ":class:`!configparser.LegacyInterpolation` (:gh:`90765`)" +#~ msgstr ":class:`!configparser.LegacyInterpolation` (:gh:`90765`)" + +#~ msgid "``locale.resetlocale()`` (:gh:`90817`)" +#~ msgstr "``locale.resetlocale()`` (:gh:`90817`)" + +#~ msgid ":meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)" +#~ msgstr ":meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)" + +#~ msgid ":func:`!unittest.findTestCases` (:gh:`50096`)" +#~ msgstr ":func:`!unittest.findTestCases` (:gh:`50096`)" + +#~ msgid ":func:`!unittest.getTestCaseNames` (:gh:`50096`)" +#~ msgstr ":func:`!unittest.getTestCaseNames` (:gh:`50096`)" + +#~ msgid ":func:`!unittest.makeSuite` (:gh:`50096`)" +#~ msgstr ":func:`!unittest.makeSuite` (:gh:`50096`)" + +#~ msgid ":meth:`!unittest.TestProgram.usageExit` (:gh:`67048`)" +#~ msgstr ":meth:`!unittest.TestProgram.usageExit` (:gh:`67048`)" + +#~ msgid ":class:`!webbrowser.MacOSX` (:gh:`86421`)" +#~ msgstr ":class:`!webbrowser.MacOSX` (:gh:`86421`)" + +#~ msgid ":class:`classmethod` descriptor chaining (:gh:`89519`)" +#~ msgstr ":class:`classmethod` 描述器鏈接 (:gh:`89519`)" + +#~ msgid ":mod:`importlib.resources` deprecated methods:" +#~ msgstr ":mod:`importlib.resources` 的已棄用方法:" + +#~ msgid "``contents()``" +#~ msgstr "``contents()``" + +#~ msgid "``is_resource()``" +#~ msgstr "``is_resource()``" + +#~ msgid "``open_binary()``" +#~ msgstr "``open_binary()``" + +#~ msgid "``open_text()``" +#~ msgstr "``open_text()``" + +#~ msgid "``path()``" +#~ msgstr "``path()``" + +#~ msgid "``read_binary()``" +#~ msgstr "``read_binary()``" + +#~ msgid "``read_text()``" +#~ msgstr "``read_text()``" + +#~ msgid "" +#~ "Use :func:`importlib.resources.files` instead. Refer to `importlib-" +#~ "resources: Migrating from Legacy `_ (:gh:`106531`)" +#~ msgstr "" +#~ "請改用 :func:`importlib.resources.files`。請參閱 `importlib-resources: " +#~ "Migrating from Legacy `_ (:gh:`106531`)" diff --git a/deprecations/pending-removal-in-3.13.po b/deprecations/pending-removal-in-3.13.po index f737520746..d39a172a1a 100644 --- a/deprecations/pending-removal-in-3.13.po +++ b/deprecations/pending-removal-in-3.13.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-30 18:24+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -24,80 +24,80 @@ msgid "Modules (see :pep:`594`):" msgstr "模組(請見 :pep:`594`):" #: ../../deprecations/pending-removal-in-3.13.rst:6 -msgid ":mod:`aifc`" -msgstr ":mod:`aifc`" +msgid ":mod:`!aifc`" +msgstr ":mod:`!aifc`" #: ../../deprecations/pending-removal-in-3.13.rst:7 -msgid ":mod:`audioop`" -msgstr ":mod:`audioop`" +msgid ":mod:`!audioop`" +msgstr ":mod:`!audioop`" #: ../../deprecations/pending-removal-in-3.13.rst:8 -msgid ":mod:`cgi`" -msgstr ":mod:`cgi`" +msgid ":mod:`!cgi`" +msgstr ":mod:`!cgi`" #: ../../deprecations/pending-removal-in-3.13.rst:9 -msgid ":mod:`cgitb`" -msgstr ":mod:`cgitb`" +msgid ":mod:`!cgitb`" +msgstr ":mod:`!cgitb`" #: ../../deprecations/pending-removal-in-3.13.rst:10 -msgid ":mod:`chunk`" -msgstr ":mod:`chunk`" +msgid ":mod:`!chunk`" +msgstr ":mod:`!chunk`" #: ../../deprecations/pending-removal-in-3.13.rst:11 -msgid ":mod:`crypt`" -msgstr ":mod:`crypt`" +msgid ":mod:`!crypt`" +msgstr ":mod:`!crypt`" #: ../../deprecations/pending-removal-in-3.13.rst:12 -msgid ":mod:`imghdr`" -msgstr ":mod:`imghdr`" +msgid ":mod:`!imghdr`" +msgstr ":mod:`!imghdr`" #: ../../deprecations/pending-removal-in-3.13.rst:13 -msgid ":mod:`mailcap`" -msgstr ":mod:`mailcap`" +msgid ":mod:`!mailcap`" +msgstr ":mod:`!mailcap`" #: ../../deprecations/pending-removal-in-3.13.rst:14 -msgid ":mod:`msilib`" -msgstr ":mod:`msilib`" +msgid ":mod:`!msilib`" +msgstr ":mod:`!msilib`" #: ../../deprecations/pending-removal-in-3.13.rst:15 -msgid ":mod:`nis`" -msgstr ":mod:`nis`" +msgid ":mod:`!nis`" +msgstr ":mod:`!nis`" #: ../../deprecations/pending-removal-in-3.13.rst:16 -msgid ":mod:`nntplib`" -msgstr ":mod:`nntplib`" +msgid ":mod:`!nntplib`" +msgstr ":mod:`!nntplib`" #: ../../deprecations/pending-removal-in-3.13.rst:17 -msgid ":mod:`ossaudiodev`" -msgstr ":mod:`ossaudiodev`" +msgid ":mod:`!ossaudiodev`" +msgstr ":mod:`!ossaudiodev`" #: ../../deprecations/pending-removal-in-3.13.rst:18 -msgid ":mod:`pipes`" -msgstr ":mod:`pipes`" +msgid ":mod:`!pipes`" +msgstr ":mod:`!pipes`" #: ../../deprecations/pending-removal-in-3.13.rst:19 -msgid ":mod:`sndhdr`" -msgstr ":mod:`sndhdr`" +msgid ":mod:`!sndhdr`" +msgstr ":mod:`!sndhdr`" #: ../../deprecations/pending-removal-in-3.13.rst:20 -msgid ":mod:`spwd`" -msgstr ":mod:`spwd`" +msgid ":mod:`!spwd`" +msgstr ":mod:`!spwd`" #: ../../deprecations/pending-removal-in-3.13.rst:21 -msgid ":mod:`sunau`" -msgstr ":mod:`sunau`" +msgid ":mod:`!sunau`" +msgstr ":mod:`!sunau`" #: ../../deprecations/pending-removal-in-3.13.rst:22 -msgid ":mod:`telnetlib`" -msgstr ":mod:`telnetlib`" +msgid ":mod:`!telnetlib`" +msgstr ":mod:`!telnetlib`" #: ../../deprecations/pending-removal-in-3.13.rst:23 -msgid ":mod:`uu`" -msgstr ":mod:`uu`" +msgid ":mod:`!uu`" +msgstr ":mod:`!uu`" #: ../../deprecations/pending-removal-in-3.13.rst:24 -msgid ":mod:`xdrlib`" -msgstr ":mod:`xdrlib`" +msgid ":mod:`!xdrlib`" +msgstr ":mod:`!xdrlib`" #: ../../deprecations/pending-removal-in-3.13.rst:26 msgid "Other modules:" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index 56ae2ea588..b2019d1972 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-30 18:24+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -47,12 +47,11 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:16 msgid "" ":mod:`pathlib`: :meth:`pathlib.PurePath.is_reserved` is deprecated and " -"scheduled for removal in Python 3.15. From Python 3.13 onwards, use ``os." -"path.isreserved`` to detect reserved paths on Windows." +"scheduled for removal in Python 3.15. Use :func:`os.path.isreserved` to " +"detect reserved paths on Windows." msgstr "" ":mod:`pathlib`::meth:`pathlib.PurePath.is_reserved` 已被棄用並計劃在 Python " -"3.15 中移除。從 Python 3.13 開始,請用 ``os.path.isreserved`` 來偵測 Windows " -"上的保留路徑。" +"3.15 中移除。請用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:21 msgid "" diff --git a/deprecations/pending-removal-in-future.po b/deprecations/pending-removal-in-future.po index fd4cd109a1..c46ed6f7d3 100644 --- a/deprecations/pending-removal-in-future.po +++ b/deprecations/pending-removal-in-future.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-26 18:24+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -182,17 +182,23 @@ msgstr "回傳值上的隱式 ``None``。" #: ../../deprecations/pending-removal-in-future.rst:69 msgid "" +":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " +"use :meth:`~logging.warning` instead." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:72 +msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:75 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:74 +#: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -200,7 +206,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:80 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -212,12 +218,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:84 +#: ../../deprecations/pending-removal-in-future.rst:87 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:86 +#: ../../deprecations/pending-removal-in-future.rst:89 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -225,15 +231,15 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:92 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:91 +#: ../../deprecations/pending-removal-in-future.rst:94 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:95 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" "`!selected_npn_protocol` are deprecated: use ALPN instead." @@ -241,58 +247,58 @@ msgstr "" ":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" "`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:96 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:97 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:107 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid "" ":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " "ignored." msgstr "" ":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" -#: ../../deprecations/pending-removal-in-future.rst:109 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:111 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid "" ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." "notify_all`." @@ -300,11 +306,11 @@ msgstr "" ":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." "notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:113 +#: ../../deprecations/pending-removal-in-future.rst:116 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" "attr:`threading.Thread.daemon` attribute." @@ -312,7 +318,7 @@ msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:118 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" "attr:`threading.Thread.name` attribute." @@ -320,20 +326,20 @@ msgstr "" ":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" "attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:117 +#: ../../deprecations/pending-removal-in-future.rst:120 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:121 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:123 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:122 +#: ../../deprecations/pending-removal-in-future.rst:125 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -341,58 +347,58 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:127 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:129 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:135 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:137 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:139 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "" ":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" "`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " @@ -402,13 +408,13 @@ msgstr "" "class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" "`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:143 +#: ../../deprecations/pending-removal-in-future.rst:146 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:149 msgid "" ":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." "etree.ElementTree.Element` is deprecated. In a future release it will always " @@ -419,7 +425,7 @@ msgstr "" "Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " "``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:151 +#: ../../deprecations/pending-removal-in-future.rst:154 msgid "" ":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" "`~zipimport.zipimporter.exec_module` instead." diff --git a/extending/embedding.po b/extending/embedding.po index 51c96c2554..ac486c5aef 100644 --- a/extending/embedding.po +++ b/extending/embedding.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -95,43 +95,64 @@ msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" -" wchar_t *program = Py_DecodeLocale(argv[0], NULL);\n" -" if (program == NULL) {\n" -" fprintf(stderr, \"Fatal error: cannot decode argv[0]\\n\");\n" -" exit(1);\n" +" PyStatus status;\n" +" PyConfig config;\n" +" PyConfig_InitPythonConfig(&config);\n" +"\n" +" /* optional but recommended */\n" +" status = PyConfig_SetBytesString(&config, &config.program_name, " +"argv[0]);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" " }\n" -" Py_SetProgramName(program); /* optional but recommended */\n" -" Py_Initialize();\n" +"\n" +" status = Py_InitializeFromConfig(&config);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +" PyConfig_Clear(&config);\n" +"\n" " PyRun_SimpleString(\"from time import time,ctime\\n\"\n" " \"print('Today is', ctime(time()))\\n\");\n" " if (Py_FinalizeEx() < 0) {\n" " exit(120);\n" " }\n" -" PyMem_RawFree(program);\n" " return 0;\n" +"\n" +" exception:\n" +" PyConfig_Clear(&config);\n" +" Py_ExitStatusException(status);\n" "}" msgstr "" -#: ../../extending/embedding.rst:78 +#: ../../extending/embedding.rst:92 msgid "" -"The :c:func:`Py_SetProgramName` function should be called before :c:func:" -"`Py_Initialize` to inform the interpreter about paths to Python run-time " -"libraries. Next, the Python interpreter is initialized with :c:func:" -"`Py_Initialize`, followed by the execution of a hard-coded Python script " -"that prints the date and time. Afterwards, the :c:func:`Py_FinalizeEx` call " -"shuts the interpreter down, followed by the end of the program. In a real " -"program, you may want to get the Python script from another source, perhaps " -"a text-editor routine, a file, or a database. Getting the Python code from " -"a file can better be done by using the :c:func:`PyRun_SimpleFile` function, " -"which saves you the trouble of allocating memory space and loading the file " -"contents." +"``#define PY_SSIZE_T_CLEAN`` was used to indicate that ``Py_ssize_t`` should " +"be used in some APIs instead of ``int``. It is not necessary since Python " +"3.13, but we keep it here for backward compatibility. See :ref:`arg-parsing-" +"string-and-buffers` for a description of this macro." msgstr "" -#: ../../extending/embedding.rst:93 +#: ../../extending/embedding.rst:97 +msgid "" +"Setting :c:member:`PyConfig.program_name` should be called before :c:func:" +"`Py_InitializeFromConfig` to inform the interpreter about paths to Python " +"run-time libraries. Next, the Python interpreter is initialized with :c:" +"func:`Py_Initialize`, followed by the execution of a hard-coded Python " +"script that prints the date and time. Afterwards, the :c:func:" +"`Py_FinalizeEx` call shuts the interpreter down, followed by the end of the " +"program. In a real program, you may want to get the Python script from " +"another source, perhaps a text-editor routine, a file, or a database. " +"Getting the Python code from a file can better be done by using the :c:func:" +"`PyRun_SimpleFile` function, which saves you the trouble of allocating " +"memory space and loading the file contents." +msgstr "" + +#: ../../extending/embedding.rst:112 msgid "Beyond Very High Level Embedding: An overview" msgstr "" -#: ../../extending/embedding.rst:95 +#: ../../extending/embedding.rst:114 msgid "" "The high level interface gives you the ability to execute arbitrary pieces " "of Python code from your application, but exchanging data values is quite " @@ -140,7 +161,7 @@ msgid "" "anything." msgstr "" -#: ../../extending/embedding.rst:100 +#: ../../extending/embedding.rst:119 msgid "" "It should be noted that extending Python and embedding Python is quite the " "same activity, despite the different intent. Most topics discussed in the " @@ -148,37 +169,37 @@ msgid "" "code from Python to C really does:" msgstr "" -#: ../../extending/embedding.rst:105 +#: ../../extending/embedding.rst:124 msgid "Convert data values from Python to C," msgstr "" -#: ../../extending/embedding.rst:107 +#: ../../extending/embedding.rst:126 msgid "Perform a function call to a C routine using the converted values, and" msgstr "" -#: ../../extending/embedding.rst:109 +#: ../../extending/embedding.rst:128 msgid "Convert the data values from the call from C to Python." msgstr "" -#: ../../extending/embedding.rst:111 +#: ../../extending/embedding.rst:130 msgid "When embedding Python, the interface code does:" msgstr "" -#: ../../extending/embedding.rst:113 +#: ../../extending/embedding.rst:132 msgid "Convert data values from C to Python," msgstr "" -#: ../../extending/embedding.rst:115 +#: ../../extending/embedding.rst:134 msgid "" "Perform a function call to a Python interface routine using the converted " "values, and" msgstr "" -#: ../../extending/embedding.rst:118 +#: ../../extending/embedding.rst:137 msgid "Convert the data values from the call from Python to C." msgstr "" -#: ../../extending/embedding.rst:120 +#: ../../extending/embedding.rst:139 msgid "" "As you can see, the data conversion steps are simply swapped to accommodate " "the different direction of the cross-language transfer. The only difference " @@ -186,7 +207,7 @@ msgid "" "you call a C routine, when embedding, you call a Python routine." msgstr "" -#: ../../extending/embedding.rst:125 +#: ../../extending/embedding.rst:144 msgid "" "This chapter will not discuss how to convert data from Python to C and vice " "versa. Also, proper use of references and dealing with errors is assumed to " @@ -194,11 +215,11 @@ msgid "" "interpreter, you can refer to earlier chapters for the required information." msgstr "" -#: ../../extending/embedding.rst:134 +#: ../../extending/embedding.rst:153 msgid "Pure Embedding" msgstr "" -#: ../../extending/embedding.rst:136 +#: ../../extending/embedding.rst:155 msgid "" "The first program aims to execute a function in a Python script. Like in the " "section about the very high level interface, the Python interpreter does not " @@ -206,11 +227,11 @@ msgid "" "section)." msgstr "" -#: ../../extending/embedding.rst:141 +#: ../../extending/embedding.rst:160 msgid "The code to run a function defined in a Python script is:" msgstr "" -#: ../../extending/embedding.rst:143 +#: ../../extending/embedding.rst:162 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -286,7 +307,7 @@ msgid "" "}\n" msgstr "" -#: ../../extending/embedding.rst:146 +#: ../../extending/embedding.rst:165 msgid "" "This code loads a Python script using ``argv[1]``, and calls the function " "named in ``argv[2]``. Its integer arguments are the other values of the " @@ -295,7 +316,7 @@ msgid "" "a Python script, such as:" msgstr "" -#: ../../extending/embedding.rst:152 +#: ../../extending/embedding.rst:171 msgid "" "def multiply(a,b):\n" " print(\"Will compute\", a, \"times\", b)\n" @@ -305,25 +326,25 @@ msgid "" " return c" msgstr "" -#: ../../extending/embedding.rst:161 +#: ../../extending/embedding.rst:180 msgid "then the result should be:" msgstr "" -#: ../../extending/embedding.rst:163 +#: ../../extending/embedding.rst:182 msgid "" "$ call multiply multiply 3 2\n" "Will compute 3 times 2\n" "Result of call: 6" msgstr "" -#: ../../extending/embedding.rst:169 +#: ../../extending/embedding.rst:188 msgid "" "Although the program is quite large for its functionality, most of the code " "is for data conversion between Python and C, and for error reporting. The " "interesting part with respect to embedding Python starts with ::" msgstr "" -#: ../../extending/embedding.rst:173 +#: ../../extending/embedding.rst:192 msgid "" "Py_Initialize();\n" "pName = PyUnicode_DecodeFSDefault(argv[1]);\n" @@ -331,7 +352,7 @@ msgid "" "pModule = PyImport_Import(pName);" msgstr "" -#: ../../extending/embedding.rst:178 +#: ../../extending/embedding.rst:197 msgid "" "After initializing the interpreter, the script is loaded using :c:func:" "`PyImport_Import`. This routine needs a Python string as its argument, " @@ -339,7 +360,7 @@ msgid "" "conversion routine. ::" msgstr "" -#: ../../extending/embedding.rst:183 +#: ../../extending/embedding.rst:202 msgid "" "pFunc = PyObject_GetAttrString(pModule, argv[2]);\n" "/* pFunc is a new reference */\n" @@ -350,7 +371,7 @@ msgid "" "Py_XDECREF(pFunc);" msgstr "" -#: ../../extending/embedding.rst:191 +#: ../../extending/embedding.rst:210 msgid "" "Once the script is loaded, the name we're looking for is retrieved using :c:" "func:`PyObject_GetAttrString`. If the name exists, and the object returned " @@ -359,22 +380,22 @@ msgid "" "Python function is then made with::" msgstr "" -#: ../../extending/embedding.rst:197 +#: ../../extending/embedding.rst:216 msgid "pValue = PyObject_CallObject(pFunc, pArgs);" msgstr "pValue = PyObject_CallObject(pFunc, pArgs);" -#: ../../extending/embedding.rst:199 +#: ../../extending/embedding.rst:218 msgid "" "Upon return of the function, ``pValue`` is either ``NULL`` or it contains a " "reference to the return value of the function. Be sure to release the " "reference after examining the value." msgstr "" -#: ../../extending/embedding.rst:207 +#: ../../extending/embedding.rst:226 msgid "Extending Embedded Python" msgstr "" -#: ../../extending/embedding.rst:209 +#: ../../extending/embedding.rst:228 msgid "" "Until now, the embedded Python interpreter had no access to functionality " "from the application itself. The Python API allows this by extending the " @@ -386,7 +407,7 @@ msgid "" "like you would write a normal Python extension. For example::" msgstr "" -#: ../../extending/embedding.rst:218 +#: ../../extending/embedding.rst:237 msgid "" "static int numargs=0;\n" "\n" @@ -417,13 +438,13 @@ msgid "" "}" msgstr "" -#: ../../extending/embedding.rst:246 +#: ../../extending/embedding.rst:265 msgid "" "Insert the above code just above the :c:func:`main` function. Also, insert " "the following two statements before the call to :c:func:`Py_Initialize`::" msgstr "" -#: ../../extending/embedding.rst:249 +#: ../../extending/embedding.rst:268 msgid "" "numargs = argc;\n" "PyImport_AppendInittab(\"emb\", &PyInit_emb);" @@ -431,30 +452,30 @@ msgstr "" "numargs = argc;\n" "PyImport_AppendInittab(\"emb\", &PyInit_emb);" -#: ../../extending/embedding.rst:252 +#: ../../extending/embedding.rst:271 msgid "" "These two lines initialize the ``numargs`` variable, and make the :func:`!" "emb.numargs` function accessible to the embedded Python interpreter. With " "these extensions, the Python script can do things like" msgstr "" -#: ../../extending/embedding.rst:256 +#: ../../extending/embedding.rst:275 msgid "" "import emb\n" "print(\"Number of arguments\", emb.numargs())" msgstr "" -#: ../../extending/embedding.rst:261 +#: ../../extending/embedding.rst:280 msgid "" "In a real application, the methods will expose an API of the application to " "Python." msgstr "" -#: ../../extending/embedding.rst:271 +#: ../../extending/embedding.rst:290 msgid "Embedding Python in C++" msgstr "" -#: ../../extending/embedding.rst:273 +#: ../../extending/embedding.rst:292 msgid "" "It is also possible to embed Python in a C++ program; precisely how this is " "done will depend on the details of the C++ system used; in general you will " @@ -463,11 +484,11 @@ msgid "" "+." msgstr "" -#: ../../extending/embedding.rst:282 +#: ../../extending/embedding.rst:301 msgid "Compiling and Linking under Unix-like systems" msgstr "" -#: ../../extending/embedding.rst:284 +#: ../../extending/embedding.rst:303 msgid "" "It is not necessarily trivial to find the right flags to pass to your " "compiler (and linker) in order to embed the Python interpreter into your " @@ -475,7 +496,7 @@ msgid "" "implemented as C dynamic extensions (:file:`.so` files) linked against it." msgstr "" -#: ../../extending/embedding.rst:290 +#: ../../extending/embedding.rst:309 msgid "" "To find out the required compiler and linker flags, you can execute the :" "file:`python{X.Y}-config` script which is generated as part of the " @@ -484,13 +505,13 @@ msgid "" "directly useful to you:" msgstr "" -#: ../../extending/embedding.rst:296 +#: ../../extending/embedding.rst:315 msgid "" "``pythonX.Y-config --cflags`` will give you the recommended flags when " "compiling:" msgstr "" -#: ../../extending/embedding.rst:299 +#: ../../extending/embedding.rst:318 msgid "" "$ /opt/bin/python3.11-config --cflags\n" "-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare -DNDEBUG " @@ -500,13 +521,13 @@ msgstr "" "-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare -DNDEBUG " "-g -fwrapv -O3 -Wall" -#: ../../extending/embedding.rst:304 +#: ../../extending/embedding.rst:323 msgid "" "``pythonX.Y-config --ldflags --embed`` will give you the recommended flags " "when linking:" msgstr "" -#: ../../extending/embedding.rst:307 +#: ../../extending/embedding.rst:326 msgid "" "$ /opt/bin/python3.11-config --ldflags --embed\n" "-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib -lpython3.11 -" @@ -516,7 +537,7 @@ msgstr "" "-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib -lpython3.11 -" "lpthread -ldl -lutil -lm" -#: ../../extending/embedding.rst:313 +#: ../../extending/embedding.rst:332 msgid "" "To avoid confusion between several Python installations (and especially " "between the system Python and your own compiled Python), it is recommended " @@ -524,7 +545,7 @@ msgid "" "above example." msgstr "" -#: ../../extending/embedding.rst:318 +#: ../../extending/embedding.rst:337 msgid "" "If this procedure doesn't work for you (it is not guaranteed to work for all " "Unix-like platforms; however, we welcome :ref:`bug reports >> import sysconfig\n" ">>> sysconfig.get_config_var('LIBS')\n" diff --git a/extending/extending.po b/extending/extending.po index 249b400169..6ff3917736 100644 --- a/extending/extending.po +++ b/extending/extending.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:34+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -91,7 +91,7 @@ msgstr "" msgid "The first two lines of our file can be::" msgstr "" -#: ../../extending/extending.rst:60 +#: ../../extending/extending.rst:60 ../../extending/extending.rst:663 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include " @@ -114,11 +114,13 @@ msgstr "" #: ../../extending/extending.rst:72 msgid "" -"It is recommended to always define ``PY_SSIZE_T_CLEAN`` before including " -"``Python.h``. See :ref:`parsetuple` for a description of this macro." +"``#define PY_SSIZE_T_CLEAN`` was used to indicate that ``Py_ssize_t`` should " +"be used in some APIs instead of ``int``. It is not necessary since Python " +"3.13, but we keep it here for backward compatibility. See :ref:`arg-parsing-" +"string-and-buffers` for a description of this macro." msgstr "" -#: ../../extending/extending.rst:75 +#: ../../extending/extending.rst:77 msgid "" "All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` " "or ``PY``, except those defined in standard header files. For convenience, " @@ -129,14 +131,14 @@ msgid "" "and :c:func:`realloc` directly." msgstr "" -#: ../../extending/extending.rst:83 +#: ../../extending/extending.rst:85 msgid "" "The next thing we add to our module file is the C function that will be " "called when the Python expression ``spam.system(string)`` is evaluated " "(we'll see shortly how it ends up being called)::" msgstr "" -#: ../../extending/extending.rst:87 +#: ../../extending/extending.rst:89 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -162,7 +164,7 @@ msgstr "" " return PyLong_FromLong(sts);\n" "}" -#: ../../extending/extending.rst:99 +#: ../../extending/extending.rst:101 msgid "" "There is a straightforward translation from the argument list in Python (for " "example, the single expression ``\"ls -l\"``) to the arguments passed to the " @@ -170,13 +172,13 @@ msgid "" "*self* and *args*." msgstr "" -#: ../../extending/extending.rst:104 +#: ../../extending/extending.rst:106 msgid "" "The *self* argument points to the module object for module-level functions; " "for a method it would point to the object instance." msgstr "" -#: ../../extending/extending.rst:107 +#: ../../extending/extending.rst:109 msgid "" "The *args* argument will be a pointer to a Python tuple object containing " "the arguments. Each item of the tuple corresponds to an argument in the " @@ -188,7 +190,7 @@ msgid "" "variables into which to store the converted values. More about this later." msgstr "" -#: ../../extending/extending.rst:116 +#: ../../extending/extending.rst:118 msgid "" ":c:func:`PyArg_ParseTuple` returns true (nonzero) if all arguments have the " "right type and its components have been stored in the variables whose " @@ -198,11 +200,11 @@ msgid "" "example)." msgstr "" -#: ../../extending/extending.rst:126 +#: ../../extending/extending.rst:128 msgid "Intermezzo: Errors and Exceptions" msgstr "" -#: ../../extending/extending.rst:128 +#: ../../extending/extending.rst:130 msgid "" "An important convention throughout the Python interpreter is the following: " "when a function fails, it should set an exception condition and return an " @@ -214,13 +216,13 @@ msgid "" "important to know about them to understand how errors are passed around." msgstr "" -#: ../../extending/extending.rst:137 +#: ../../extending/extending.rst:139 msgid "" "The Python API defines a number of functions to set various types of " "exceptions." msgstr "" -#: ../../extending/extending.rst:139 +#: ../../extending/extending.rst:141 msgid "" "The most common one is :c:func:`PyErr_SetString`. Its arguments are an " "exception object and a C string. The exception object is usually a " @@ -229,7 +231,7 @@ msgid "" "and stored as the \"associated value\" of the exception." msgstr "" -#: ../../extending/extending.rst:145 +#: ../../extending/extending.rst:147 msgid "" "Another useful function is :c:func:`PyErr_SetFromErrno`, which only takes an " "exception argument and constructs the associated value by inspection of the " @@ -239,7 +241,7 @@ msgid "" "to any of these functions." msgstr "" -#: ../../extending/extending.rst:152 +#: ../../extending/extending.rst:154 msgid "" "You can test non-destructively whether an exception has been set with :c:" "func:`PyErr_Occurred`. This returns the current exception object, or " @@ -248,7 +250,7 @@ msgid "" "since you should be able to tell from the return value." msgstr "" -#: ../../extending/extending.rst:158 +#: ../../extending/extending.rst:160 msgid "" "When a function *f* that calls another function *g* detects that the latter " "fails, *f* should itself return an error value (usually ``NULL`` or " @@ -261,7 +263,7 @@ msgid "" "tries to find an exception handler specified by the Python programmer." msgstr "" -#: ../../extending/extending.rst:168 +#: ../../extending/extending.rst:170 msgid "" "(There are situations where a module can actually give a more detailed error " "message by calling another ``PyErr_*`` function, and in such cases it is " @@ -270,7 +272,7 @@ msgid "" "can fail for a variety of reasons.)" msgstr "" -#: ../../extending/extending.rst:174 +#: ../../extending/extending.rst:176 msgid "" "To ignore an exception set by a function call that failed, the exception " "condition must be cleared explicitly by calling :c:func:`PyErr_Clear`. The " @@ -279,7 +281,7 @@ msgid "" "itself (possibly by trying something else, or pretending nothing went wrong)." msgstr "" -#: ../../extending/extending.rst:180 +#: ../../extending/extending.rst:182 msgid "" "Every failing :c:func:`malloc` call must be turned into an exception --- the " "direct caller of :c:func:`malloc` (or :c:func:`realloc`) must call :c:func:" @@ -288,7 +290,7 @@ msgid "" "so this note is only relevant to those who call :c:func:`malloc` directly." msgstr "" -#: ../../extending/extending.rst:186 +#: ../../extending/extending.rst:188 msgid "" "Also note that, with the important exception of :c:func:`PyArg_ParseTuple` " "and friends, functions that return an integer status usually return a " @@ -296,14 +298,14 @@ msgid "" "calls." msgstr "" -#: ../../extending/extending.rst:190 +#: ../../extending/extending.rst:192 msgid "" "Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` or :" "c:func:`Py_DECREF` calls for objects you have already created) when you " "return an error indicator!" msgstr "" -#: ../../extending/extending.rst:194 +#: ../../extending/extending.rst:196 msgid "" "The choice of which exception to raise is entirely yours. There are " "predeclared C objects corresponding to all built-in Python exceptions, such " @@ -316,23 +318,24 @@ msgid "" "satisfy other conditions, :c:data:`PyExc_ValueError` is appropriate." msgstr "" -#: ../../extending/extending.rst:204 +#: ../../extending/extending.rst:206 msgid "" "You can also define a new exception that is unique to your module. For this, " "you usually declare a static object variable at the beginning of your file::" msgstr "" -#: ../../extending/extending.rst:207 +#: ../../extending/extending.rst:209 msgid "static PyObject *SpamError;" msgstr "static PyObject *SpamError;" -#: ../../extending/extending.rst:209 +#: ../../extending/extending.rst:211 msgid "" "and initialize it in your module's initialization function (:c:func:`!" "PyInit_spam`) with an exception object::" msgstr "" -#: ../../extending/extending.rst:212 +#: ../../extending/extending.rst:214 +#, fuzzy msgid "" "PyMODINIT_FUNC\n" "PyInit_spam(void)\n" @@ -344,9 +347,7 @@ msgid "" " return NULL;\n" "\n" " SpamError = PyErr_NewException(\"spam.error\", NULL, NULL);\n" -" Py_XINCREF(SpamError);\n" -" if (PyModule_AddObject(m, \"error\", SpamError) < 0) {\n" -" Py_XDECREF(SpamError);\n" +" if (PyModule_AddObjectRef(m, \"error\", SpamError) < 0) {\n" " Py_CLEAR(SpamError);\n" " Py_DECREF(m);\n" " return NULL;\n" @@ -636,14 +637,15 @@ msgstr "" #: ../../extending/extending.rst:386 msgid "" +"#define PY_SSIZE_T_CLEAN\n" +"#include \n" +"\n" "int\n" "main(int argc, char *argv[])\n" "{\n" -" wchar_t *program = Py_DecodeLocale(argv[0], NULL);\n" -" if (program == NULL) {\n" -" fprintf(stderr, \"Fatal error: cannot decode argv[0]\\n\");\n" -" exit(1);\n" -" }\n" +" PyStatus status;\n" +" PyConfig config;\n" +" PyConfig_InitPythonConfig(&config);\n" "\n" " /* Add a built-in module, before Py_Initialize */\n" " if (PyImport_AppendInittab(\"spam\", PyInit_spam) == -1) {\n" @@ -653,11 +655,19 @@ msgid "" " }\n" "\n" " /* Pass argv[0] to the Python interpreter */\n" -" Py_SetProgramName(program);\n" +" status = PyConfig_SetBytesString(&config, &config.program_name, " +"argv[0]);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" "\n" " /* Initialize the Python interpreter. Required.\n" " If this step fails, it will be a fatal error. */\n" -" Py_Initialize();\n" +" status = Py_InitializeFromConfig(&config);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +" PyConfig_Clear(&config);\n" "\n" " /* Optionally import the module; alternatively,\n" " import can be deferred until the embedded script\n" @@ -668,14 +678,17 @@ msgid "" " fprintf(stderr, \"Error: could not import module 'spam'\\n\");\n" " }\n" "\n" -" ...\n" +" // ... use Python C API here ...\n" "\n" -" PyMem_RawFree(program);\n" " return 0;\n" +"\n" +" exception:\n" +" PyConfig_Clear(&config);\n" +" Py_ExitStatusException(status);\n" "}" msgstr "" -#: ../../extending/extending.rst:425 +#: ../../extending/extending.rst:436 msgid "" "Removing entries from ``sys.modules`` or importing compiled modules into " "multiple interpreters within a process (or following a :c:func:`fork` " @@ -684,14 +697,14 @@ msgid "" "initializing internal data structures." msgstr "" -#: ../../extending/extending.rst:431 +#: ../../extending/extending.rst:442 msgid "" "A more substantial example module is included in the Python source " "distribution as :file:`Modules/xxmodule.c`. This file may be used as a " "template or simply read as an example." msgstr "" -#: ../../extending/extending.rst:437 +#: ../../extending/extending.rst:448 msgid "" "Unlike our ``spam`` example, ``xxmodule`` uses *multi-phase initialization* " "(new in Python 3.5), where a PyModuleDef structure is returned from " @@ -699,11 +712,11 @@ msgid "" "For details on multi-phase initialization, see :PEP:`489`." msgstr "" -#: ../../extending/extending.rst:446 +#: ../../extending/extending.rst:457 msgid "Compilation and Linkage" msgstr "" -#: ../../extending/extending.rst:448 +#: ../../extending/extending.rst:459 msgid "" "There are two more things to do before you can use your new extension: " "compiling and linking it with the Python system. If you use dynamic " @@ -713,7 +726,7 @@ msgid "" "Windows (chapter :ref:`building-on-windows`) for more information about this." msgstr "" -#: ../../extending/extending.rst:455 +#: ../../extending/extending.rst:466 msgid "" "If you can't use dynamic loading, or if you want to make your module a " "permanent part of the Python interpreter, you will have to change the " @@ -723,11 +736,11 @@ msgid "" "line to the file :file:`Modules/Setup.local` describing your file:" msgstr "" -#: ../../extending/extending.rst:462 +#: ../../extending/extending.rst:473 msgid "spam spammodule.o" msgstr "spam spammodule.o" -#: ../../extending/extending.rst:466 +#: ../../extending/extending.rst:477 msgid "" "and rebuild the interpreter by running :program:`make` in the toplevel " "directory. You can also run :program:`make` in the :file:`Modules/` " @@ -736,21 +749,21 @@ msgid "" "the :file:`Setup` file.)" msgstr "" -#: ../../extending/extending.rst:472 +#: ../../extending/extending.rst:483 msgid "" "If your module requires additional libraries to link with, these can be " "listed on the line in the configuration file as well, for instance:" msgstr "" -#: ../../extending/extending.rst:475 +#: ../../extending/extending.rst:486 msgid "spam spammodule.o -lX11" msgstr "spam spammodule.o -lX11" -#: ../../extending/extending.rst:483 +#: ../../extending/extending.rst:494 msgid "Calling Python Functions from C" msgstr "" -#: ../../extending/extending.rst:485 +#: ../../extending/extending.rst:496 msgid "" "So far we have concentrated on making C functions callable from Python. The " "reverse is also useful: calling Python functions from C. This is especially " @@ -761,7 +774,7 @@ msgid "" "uses are also imaginable." msgstr "" -#: ../../extending/extending.rst:493 +#: ../../extending/extending.rst:504 msgid "" "Fortunately, the Python interpreter is easily called recursively, and there " "is a standard interface to call a Python function. (I won't dwell on how to " @@ -770,7 +783,7 @@ msgid "" "line option in :file:`Modules/main.c` from the Python source code.)" msgstr "" -#: ../../extending/extending.rst:499 +#: ../../extending/extending.rst:510 msgid "" "Calling a Python function is easy. First, the Python program must somehow " "pass you the Python function object. You should provide a function (or some " @@ -780,7 +793,7 @@ msgid "" "function might be part of a module definition::" msgstr "" -#: ../../extending/extending.rst:506 +#: ../../extending/extending.rst:517 msgid "" "static PyObject *my_callback = NULL;\n" "\n" @@ -807,7 +820,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:529 +#: ../../extending/extending.rst:540 msgid "" "This function must be registered with the interpreter using the :c:macro:" "`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The :" @@ -815,7 +828,7 @@ msgid "" "section :ref:`parsetuple`." msgstr "" -#: ../../extending/extending.rst:534 +#: ../../extending/extending.rst:545 msgid "" "The macros :c:func:`Py_XINCREF` and :c:func:`Py_XDECREF` increment/decrement " "the reference count of an object and are safe in the presence of ``NULL`` " @@ -823,7 +836,7 @@ msgid "" "info on them in section :ref:`refcounts`." msgstr "" -#: ../../extending/extending.rst:541 +#: ../../extending/extending.rst:552 msgid "" "Later, when it is time to call the function, you call the C function :c:func:" "`PyObject_CallObject`. This function has two arguments, both pointers to " @@ -835,7 +848,7 @@ msgid "" "or more format codes between parentheses. For example::" msgstr "" -#: ../../extending/extending.rst:550 +#: ../../extending/extending.rst:561 msgid "" "int arg;\n" "PyObject *arglist;\n" @@ -849,7 +862,7 @@ msgid "" "Py_DECREF(arglist);" msgstr "" -#: ../../extending/extending.rst:561 +#: ../../extending/extending.rst:572 msgid "" ":c:func:`PyObject_CallObject` returns a Python object pointer: this is the " "return value of the Python function. :c:func:`PyObject_CallObject` is " @@ -858,7 +871,7 @@ msgid "" "`Py_DECREF`\\ -ed immediately after the :c:func:`PyObject_CallObject` call." msgstr "" -#: ../../extending/extending.rst:568 +#: ../../extending/extending.rst:579 msgid "" "The return value of :c:func:`PyObject_CallObject` is \"new\": either it is a " "brand new object, or it is an existing object whose reference count has been " @@ -867,7 +880,7 @@ msgid "" "not interested in its value." msgstr "" -#: ../../extending/extending.rst:574 +#: ../../extending/extending.rst:585 msgid "" "Before you do this, however, it is important to check that the return value " "isn't ``NULL``. If it is, the Python function terminated by raising an " @@ -878,7 +891,7 @@ msgid "" "should be cleared by calling :c:func:`PyErr_Clear`. For example::" msgstr "" -#: ../../extending/extending.rst:582 +#: ../../extending/extending.rst:593 msgid "" "if (result == NULL)\n" " return NULL; /* Pass error back */\n" @@ -886,7 +899,7 @@ msgid "" "Py_DECREF(result);" msgstr "" -#: ../../extending/extending.rst:587 +#: ../../extending/extending.rst:598 msgid "" "Depending on the desired interface to the Python callback function, you may " "also have to provide an argument list to :c:func:`PyObject_CallObject`. In " @@ -898,7 +911,7 @@ msgid "" "you want to pass an integral event code, you might use the following code::" msgstr "" -#: ../../extending/extending.rst:596 +#: ../../extending/extending.rst:607 msgid "" "PyObject *arglist;\n" "...\n" @@ -911,7 +924,7 @@ msgid "" "Py_DECREF(result);" msgstr "" -#: ../../extending/extending.rst:606 +#: ../../extending/extending.rst:617 msgid "" "Note the placement of ``Py_DECREF(arglist)`` immediately after the call, " "before the error check! Also note that strictly speaking this code is not " @@ -919,14 +932,14 @@ msgid "" "checked." msgstr "" -#: ../../extending/extending.rst:610 +#: ../../extending/extending.rst:621 msgid "" "You may also call a function with keyword arguments by using :c:func:" "`PyObject_Call`, which supports arguments and keyword arguments. As in the " "above example, we use :c:func:`Py_BuildValue` to construct the dictionary. ::" msgstr "" -#: ../../extending/extending.rst:614 +#: ../../extending/extending.rst:625 msgid "" "PyObject *dict;\n" "...\n" @@ -939,19 +952,19 @@ msgid "" "Py_DECREF(result);" msgstr "" -#: ../../extending/extending.rst:628 +#: ../../extending/extending.rst:639 msgid "Extracting Parameters in Extension Functions" msgstr "" -#: ../../extending/extending.rst:632 +#: ../../extending/extending.rst:643 msgid "The :c:func:`PyArg_ParseTuple` function is declared as follows::" msgstr "" -#: ../../extending/extending.rst:634 +#: ../../extending/extending.rst:645 msgid "int PyArg_ParseTuple(PyObject *arg, const char *format, ...);" msgstr "" -#: ../../extending/extending.rst:636 +#: ../../extending/extending.rst:647 msgid "" "The *arg* argument must be a tuple object containing an argument list passed " "from Python to a C function. The *format* argument must be a format string, " @@ -960,7 +973,7 @@ msgid "" "whose type is determined by the format string." msgstr "" -#: ../../extending/extending.rst:642 +#: ../../extending/extending.rst:653 msgid "" "Note that while :c:func:`PyArg_ParseTuple` checks that the Python arguments " "have the required types, it cannot check the validity of the addresses of C " @@ -968,23 +981,17 @@ msgid "" "probably crash or at least overwrite random bits in memory. So be careful!" msgstr "" -#: ../../extending/extending.rst:647 +#: ../../extending/extending.rst:658 msgid "" "Note that any Python object references which are provided to the caller are " "*borrowed* references; do not decrement their reference count!" msgstr "" -#: ../../extending/extending.rst:650 +#: ../../extending/extending.rst:661 msgid "Some example calls::" msgstr "一些呼叫範例: ::" -#: ../../extending/extending.rst:652 -msgid "" -"#define PY_SSIZE_T_CLEAN /* Make \"s#\" use Py_ssize_t rather than int. */\n" -"#include " -msgstr "" - -#: ../../extending/extending.rst:657 +#: ../../extending/extending.rst:668 msgid "" "int ok;\n" "int i, j;\n" @@ -1004,27 +1011,27 @@ msgstr "" "ok = PyArg_ParseTuple(args, \"\"); /* 沒有引數 */\n" " /* Python 呼叫:f() */" -#: ../../extending/extending.rst:668 +#: ../../extending/extending.rst:679 msgid "" "ok = PyArg_ParseTuple(args, \"s\", &s); /* A string */\n" " /* Possible Python call: f('whoops!') */" msgstr "" -#: ../../extending/extending.rst:673 +#: ../../extending/extending.rst:684 msgid "" "ok = PyArg_ParseTuple(args, \"lls\", &k, &l, &s); /* Two longs and a string " "*/\n" " /* Possible Python call: f(1, 2, 'three') */" msgstr "" -#: ../../extending/extending.rst:678 +#: ../../extending/extending.rst:689 msgid "" "ok = PyArg_ParseTuple(args, \"(ii)s#\", &i, &j, &s, &size);\n" " /* A pair of ints and a string, whose size is also returned */\n" " /* Possible Python call: f((1, 2), 'three') */" msgstr "" -#: ../../extending/extending.rst:684 +#: ../../extending/extending.rst:695 msgid "" "{\n" " const char *file;\n" @@ -1039,7 +1046,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:698 +#: ../../extending/extending.rst:709 msgid "" "{\n" " int left, top, right, bottom, h, v;\n" @@ -1051,7 +1058,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:709 +#: ../../extending/extending.rst:720 msgid "" "{\n" " Py_complex c;\n" @@ -1061,24 +1068,26 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:720 +#: ../../extending/extending.rst:731 msgid "Keyword Parameters for Extension Functions" msgstr "" -#: ../../extending/extending.rst:724 +#: ../../extending/extending.rst:735 msgid "" "The :c:func:`PyArg_ParseTupleAndKeywords` function is declared as follows::" msgstr "" -#: ../../extending/extending.rst:726 +#: ../../extending/extending.rst:737 +#, fuzzy msgid "" "int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,\n" -" const char *format, char *kwlist[], ...);" +" const char *format, char * const " +"*kwlist, ...);" msgstr "" "int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,\n" " const char *format, char *kwlist[], ...);" -#: ../../extending/extending.rst:729 +#: ../../extending/extending.rst:740 msgid "" "The *arg* and *format* parameters are identical to those of the :c:func:" "`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of " @@ -1090,22 +1099,22 @@ msgid "" "raises an appropriate exception." msgstr "" -#: ../../extending/extending.rst:739 +#: ../../extending/extending.rst:750 msgid "" "Nested tuples cannot be parsed when using keyword arguments! Keyword " "parameters passed in which are not present in the *kwlist* will cause :exc:" "`TypeError` to be raised." msgstr "" -#: ../../extending/extending.rst:745 +#: ../../extending/extending.rst:756 msgid "" "Here is an example module which uses keywords, based on an example by Geoff " "Philbrick (philbrick@hks.com)::" msgstr "" -#: ../../extending/extending.rst:748 +#: ../../extending/extending.rst:759 msgid "" -"#define PY_SSIZE_T_CLEAN /* Make \"s#\" use Py_ssize_t rather than int. */\n" +"#define PY_SSIZE_T_CLEAN\n" "#include \n" "\n" "static PyObject *\n" @@ -1157,21 +1166,21 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:800 +#: ../../extending/extending.rst:811 msgid "Building Arbitrary Values" msgstr "" -#: ../../extending/extending.rst:802 +#: ../../extending/extending.rst:813 msgid "" "This function is the counterpart to :c:func:`PyArg_ParseTuple`. It is " "declared as follows::" msgstr "" -#: ../../extending/extending.rst:805 +#: ../../extending/extending.rst:816 msgid "PyObject *Py_BuildValue(const char *format, ...);" msgstr "PyObject *Py_BuildValue(const char *format, ...);" -#: ../../extending/extending.rst:807 +#: ../../extending/extending.rst:818 msgid "" "It recognizes a set of format units similar to the ones recognized by :c:" "func:`PyArg_ParseTuple`, but the arguments (which are input to the function, " @@ -1179,7 +1188,7 @@ msgid "" "object, suitable for returning from a C function called from Python." msgstr "" -#: ../../extending/extending.rst:812 +#: ../../extending/extending.rst:823 msgid "" "One difference with :c:func:`PyArg_ParseTuple`: while the latter requires " "its first argument to be a tuple (since Python argument lists are always " @@ -1191,12 +1200,12 @@ msgid "" "parenthesize the format string." msgstr "" -#: ../../extending/extending.rst:820 +#: ../../extending/extending.rst:831 msgid "" "Examples (to the left the call, to the right the resulting Python value):" msgstr "" -#: ../../extending/extending.rst:822 +#: ../../extending/extending.rst:833 msgid "" "Py_BuildValue(\"\") None\n" "Py_BuildValue(\"i\", 123) 123\n" @@ -1234,11 +1243,11 @@ msgstr "" "Py_BuildValue(\"((ii)(ii)) (ii)\",\n" " 1, 2, 3, 4, 5, 6) (((1, 2), (3, 4)), (5, 6))" -#: ../../extending/extending.rst:846 +#: ../../extending/extending.rst:857 msgid "Reference Counts" msgstr "" -#: ../../extending/extending.rst:848 +#: ../../extending/extending.rst:859 msgid "" "In languages like C or C++, the programmer is responsible for dynamic " "allocation and deallocation of memory on the heap. In C, this is done using " @@ -1247,7 +1256,7 @@ msgid "" "restrict the following discussion to the C case." msgstr "" -#: ../../extending/extending.rst:854 +#: ../../extending/extending.rst:865 msgid "" "Every block of memory allocated with :c:func:`malloc` should eventually be " "returned to the pool of available memory by exactly one call to :c:func:" @@ -1262,7 +1271,7 @@ msgid "" "crashes." msgstr "" -#: ../../extending/extending.rst:865 +#: ../../extending/extending.rst:876 msgid "" "Common causes of memory leaks are unusual paths through the code. For " "instance, a function may allocate a block of memory, do some calculation, " @@ -1279,7 +1288,7 @@ msgid "" "of errors." msgstr "" -#: ../../extending/extending.rst:878 +#: ../../extending/extending.rst:889 msgid "" "Since Python makes heavy use of :c:func:`malloc` and :c:func:`free`, it " "needs a strategy to avoid memory leaks as well as the use of freed memory. " @@ -1290,7 +1299,7 @@ msgid "" "reference to the object has been deleted and the object is freed." msgstr "" -#: ../../extending/extending.rst:886 +#: ../../extending/extending.rst:897 msgid "" "An alternative strategy is called :dfn:`automatic garbage collection`. " "(Sometimes, reference counting is also referred to as a garbage collection " @@ -1306,7 +1315,7 @@ msgid "" "with reference counts." msgstr "" -#: ../../extending/extending.rst:898 +#: ../../extending/extending.rst:909 msgid "" "While Python uses the traditional reference counting implementation, it also " "offers a cycle detector that works to detect reference cycles. This allows " @@ -1320,7 +1329,7 @@ msgid "" "though there are no further references to the cycle itself." msgstr "" -#: ../../extending/extending.rst:909 +#: ../../extending/extending.rst:920 msgid "" "The cycle detector is able to detect garbage cycles and can reclaim them. " "The :mod:`gc` module exposes a way to run the detector (the :func:`~gc." @@ -1328,11 +1337,11 @@ msgid "" "disable the detector at runtime." msgstr "" -#: ../../extending/extending.rst:918 +#: ../../extending/extending.rst:929 msgid "Reference Counting in Python" msgstr "" -#: ../../extending/extending.rst:920 +#: ../../extending/extending.rst:931 msgid "" "There are two macros, ``Py_INCREF(x)`` and ``Py_DECREF(x)``, which handle " "the incrementing and decrementing of the reference count. :c:func:" @@ -1343,7 +1352,7 @@ msgid "" "object." msgstr "" -#: ../../extending/extending.rst:927 +#: ../../extending/extending.rst:938 msgid "" "The big question now remains: when to use ``Py_INCREF(x)`` and " "``Py_DECREF(x)``? Let's first introduce some terms. Nobody \"owns\" an " @@ -1356,7 +1365,7 @@ msgid "" "reference creates a memory leak." msgstr "" -#: ../../extending/extending.rst:936 +#: ../../extending/extending.rst:947 msgid "" "It is also possible to :dfn:`borrow` [#]_ a reference to an object. The " "borrower of a reference should not call :c:func:`Py_DECREF`. The borrower " @@ -1365,7 +1374,7 @@ msgid "" "risks using freed memory and should be avoided completely [#]_." msgstr "" -#: ../../extending/extending.rst:942 +#: ../../extending/extending.rst:953 msgid "" "The advantage of borrowing over owning a reference is that you don't need to " "take care of disposing of the reference on all possible paths through the " @@ -1376,7 +1385,7 @@ msgid "" "borrowed has in fact disposed of it." msgstr "" -#: ../../extending/extending.rst:950 +#: ../../extending/extending.rst:961 msgid "" "A borrowed reference can be changed into an owned reference by calling :c:" "func:`Py_INCREF`. This does not affect the status of the owner from which " @@ -1385,18 +1394,18 @@ msgid "" "properly, as well as the previous owner)." msgstr "" -#: ../../extending/extending.rst:960 +#: ../../extending/extending.rst:971 msgid "Ownership Rules" msgstr "" -#: ../../extending/extending.rst:962 +#: ../../extending/extending.rst:973 msgid "" "Whenever an object reference is passed into or out of a function, it is part " "of the function's interface specification whether ownership is transferred " "with the reference or not." msgstr "" -#: ../../extending/extending.rst:966 +#: ../../extending/extending.rst:977 msgid "" "Most functions that return a reference to an object pass on ownership with " "the reference. In particular, all functions whose function it is to create " @@ -1407,7 +1416,7 @@ msgid "" "reference to a cached item." msgstr "" -#: ../../extending/extending.rst:974 +#: ../../extending/extending.rst:985 msgid "" "Many functions that extract objects from other objects also transfer " "ownership with the reference, for instance :c:func:" @@ -1418,14 +1427,14 @@ msgid "" "list or dictionary." msgstr "" -#: ../../extending/extending.rst:981 +#: ../../extending/extending.rst:992 msgid "" "The function :c:func:`PyImport_AddModule` also returns a borrowed reference, " "even though it may actually create the object it returns: this is possible " "because an owned reference to the object is stored in ``sys.modules``." msgstr "" -#: ../../extending/extending.rst:985 +#: ../../extending/extending.rst:996 msgid "" "When you pass an object reference into another function, in general, the " "function borrows the reference from you --- if it needs to store it, it will " @@ -1436,7 +1445,7 @@ msgid "" "don't take over ownership --- they are \"normal.\")" msgstr "" -#: ../../extending/extending.rst:993 +#: ../../extending/extending.rst:1004 msgid "" "When a C function is called from Python, it borrows references to its " "arguments from the caller. The caller owns a reference to the object, so " @@ -1445,18 +1454,18 @@ msgid "" "turned into an owned reference by calling :c:func:`Py_INCREF`." msgstr "" -#: ../../extending/extending.rst:999 +#: ../../extending/extending.rst:1010 msgid "" "The object reference returned from a C function that is called from Python " "must be an owned reference --- ownership is transferred from the function to " "its caller." msgstr "" -#: ../../extending/extending.rst:1007 +#: ../../extending/extending.rst:1018 msgid "Thin Ice" msgstr "" -#: ../../extending/extending.rst:1009 +#: ../../extending/extending.rst:1020 msgid "" "There are a few situations where seemingly harmless use of a borrowed " "reference can lead to problems. These all have to do with implicit " @@ -1464,14 +1473,14 @@ msgid "" "dispose of it." msgstr "" -#: ../../extending/extending.rst:1013 +#: ../../extending/extending.rst:1024 msgid "" "The first and most important case to know about is using :c:func:`Py_DECREF` " "on an unrelated object while borrowing a reference to a list item. For " "instance::" msgstr "" -#: ../../extending/extending.rst:1016 +#: ../../extending/extending.rst:1027 msgid "" "void\n" "bug(PyObject *list)\n" @@ -1491,14 +1500,14 @@ msgstr "" " PyObject_Print(item, stdout, 0); /* BUG! */\n" "}" -#: ../../extending/extending.rst:1025 +#: ../../extending/extending.rst:1036 msgid "" "This function first borrows a reference to ``list[0]``, then replaces " "``list[1]`` with the value ``0``, and finally prints the borrowed reference. " "Looks harmless, right? But it's not!" msgstr "" -#: ../../extending/extending.rst:1029 +#: ../../extending/extending.rst:1040 msgid "" "Let's follow the control flow into :c:func:`PyList_SetItem`. The list owns " "references to all its items, so when item 1 is replaced, it has to dispose " @@ -1508,7 +1517,7 @@ msgid "" "count of 1, disposing of it will call its :meth:`!__del__` method." msgstr "" -#: ../../extending/extending.rst:1036 +#: ../../extending/extending.rst:1047 msgid "" "Since it is written in Python, the :meth:`!__del__` method can execute " "arbitrary Python code. Could it perhaps do something to invalidate the " @@ -1519,13 +1528,13 @@ msgid "" "associated with it, thereby invalidating ``item``." msgstr "" -#: ../../extending/extending.rst:1044 +#: ../../extending/extending.rst:1055 msgid "" "The solution, once you know the source of the problem, is easy: temporarily " "increment the reference count. The correct version of the function reads::" msgstr "" -#: ../../extending/extending.rst:1047 +#: ../../extending/extending.rst:1058 msgid "" "void\n" "no_bug(PyObject *list)\n" @@ -1549,14 +1558,14 @@ msgstr "" " Py_DECREF(item);\n" "}" -#: ../../extending/extending.rst:1058 +#: ../../extending/extending.rst:1069 msgid "" "This is a true story. An older version of Python contained variants of this " "bug and someone spent a considerable amount of time in a C debugger to " "figure out why his :meth:`!__del__` methods would fail..." msgstr "" -#: ../../extending/extending.rst:1062 +#: ../../extending/extending.rst:1073 msgid "" "The second case of problems with a borrowed reference is a variant involving " "threads. Normally, multiple threads in the Python interpreter can't get in " @@ -1569,7 +1578,7 @@ msgid "" "previous one::" msgstr "" -#: ../../extending/extending.rst:1071 +#: ../../extending/extending.rst:1082 msgid "" "void\n" "bug(PyObject *list)\n" @@ -1582,11 +1591,11 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1085 +#: ../../extending/extending.rst:1096 msgid "NULL Pointers" msgstr "NULL 指標" -#: ../../extending/extending.rst:1087 +#: ../../extending/extending.rst:1098 msgid "" "In general, functions that take object references as arguments do not expect " "you to pass them ``NULL`` pointers, and will dump core (or cause later core " @@ -1598,21 +1607,21 @@ msgid "" "more slowly." msgstr "" -#: ../../extending/extending.rst:1095 +#: ../../extending/extending.rst:1106 msgid "" "It is better to test for ``NULL`` only at the \"source:\" when a pointer " "that may be ``NULL`` is received, for example, from :c:func:`malloc` or from " "a function that may raise an exception." msgstr "" -#: ../../extending/extending.rst:1099 +#: ../../extending/extending.rst:1110 msgid "" "The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for " "``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` and :c:" "func:`Py_XDECREF` do." msgstr "" -#: ../../extending/extending.rst:1103 +#: ../../extending/extending.rst:1114 msgid "" "The macros for checking for a particular object type (``Pytype_Check()``) " "don't check for ``NULL`` pointers --- again, there is much code that calls " @@ -1621,24 +1630,24 @@ msgid "" "variants with ``NULL`` checking." msgstr "" -#: ../../extending/extending.rst:1109 +#: ../../extending/extending.rst:1120 msgid "" "The C function calling mechanism guarantees that the argument list passed to " "C functions (``args`` in the examples) is never ``NULL`` --- in fact it " "guarantees that it is always a tuple [#]_." msgstr "" -#: ../../extending/extending.rst:1113 +#: ../../extending/extending.rst:1124 msgid "" "It is a severe error to ever let a ``NULL`` pointer \"escape\" to the Python " "user." msgstr "" -#: ../../extending/extending.rst:1124 +#: ../../extending/extending.rst:1135 msgid "Writing Extensions in C++" msgstr "" -#: ../../extending/extending.rst:1126 +#: ../../extending/extending.rst:1137 msgid "" "It is possible to write extension modules in C++. Some restrictions apply. " "If the main program (the Python interpreter) is compiled and linked by the C " @@ -1651,11 +1660,11 @@ msgid "" "(all recent C++ compilers define this symbol)." msgstr "" -#: ../../extending/extending.rst:1140 +#: ../../extending/extending.rst:1151 msgid "Providing a C API for an Extension Module" msgstr "" -#: ../../extending/extending.rst:1145 +#: ../../extending/extending.rst:1156 msgid "" "Many extension modules just provide new functions and types to be used from " "Python, but sometimes the code in an extension module can be useful for " @@ -1666,7 +1675,7 @@ msgid "" "functions for direct manipulation from other extension modules." msgstr "" -#: ../../extending/extending.rst:1153 +#: ../../extending/extending.rst:1164 msgid "" "At first sight this seems easy: just write the functions (without declaring " "them ``static``, of course), provide an appropriate header file, and " @@ -1682,7 +1691,7 @@ msgid "" "call might not have been loaded yet!" msgstr "" -#: ../../extending/extending.rst:1165 +#: ../../extending/extending.rst:1176 msgid "" "Portability therefore requires not to make any assumptions about symbol " "visibility. This means that all symbols in extension modules should be " @@ -1692,7 +1701,7 @@ msgid "" "accessible from other extension modules must be exported in a different way." msgstr "" -#: ../../extending/extending.rst:1172 +#: ../../extending/extending.rst:1183 msgid "" "Python provides a special mechanism to pass C-level information (pointers) " "from one extension module to another one: Capsules. A Capsule is a Python " @@ -1704,7 +1713,7 @@ msgid "" "the Capsule." msgstr "" -#: ../../extending/extending.rst:1180 +#: ../../extending/extending.rst:1191 msgid "" "There are many ways in which Capsules can be used to export the C API of an " "extension module. Each function could get its own Capsule, or all C API " @@ -1714,7 +1723,7 @@ msgid "" "client modules." msgstr "" -#: ../../extending/extending.rst:1186 +#: ../../extending/extending.rst:1197 msgid "" "Whichever method you choose, it's important to name your Capsules properly. " "The function :c:func:`PyCapsule_New` takes a name parameter (:c:expr:`const " @@ -1724,17 +1733,17 @@ msgid "" "from another." msgstr "" -#: ../../extending/extending.rst:1193 +#: ../../extending/extending.rst:1204 msgid "" "In particular, Capsules used to expose C APIs should be given a name " "following this convention::" msgstr "" -#: ../../extending/extending.rst:1196 +#: ../../extending/extending.rst:1207 msgid "modulename.attributename" msgstr "modulename.attributename" -#: ../../extending/extending.rst:1198 +#: ../../extending/extending.rst:1209 msgid "" "The convenience function :c:func:`PyCapsule_Import` makes it easy to load a " "C API provided via a Capsule, but only if the Capsule's name matches this " @@ -1742,7 +1751,7 @@ msgid "" "the Capsule they load contains the correct C API." msgstr "" -#: ../../extending/extending.rst:1203 +#: ../../extending/extending.rst:1214 msgid "" "The following example demonstrates an approach that puts most of the burden " "on the writer of the exporting module, which is appropriate for commonly " @@ -1753,7 +1762,7 @@ msgid "" "modules only have to call this macro before accessing the C API." msgstr "" -#: ../../extending/extending.rst:1211 +#: ../../extending/extending.rst:1222 msgid "" "The exporting module is a modification of the :mod:`!spam` module from " "section :ref:`extending-simpleexample`. The function :func:`!spam.system` " @@ -1764,13 +1773,13 @@ msgid "" "modules." msgstr "" -#: ../../extending/extending.rst:1218 +#: ../../extending/extending.rst:1229 msgid "" "The function :c:func:`!PySpam_System` is a plain C function, declared " "``static`` like everything else::" msgstr "" -#: ../../extending/extending.rst:1221 +#: ../../extending/extending.rst:1232 msgid "" "static int\n" "PySpam_System(const char *command)\n" @@ -1784,11 +1793,11 @@ msgstr "" " return system(command);\n" "}" -#: ../../extending/extending.rst:1227 +#: ../../extending/extending.rst:1238 msgid "The function :c:func:`!spam_system` is modified in a trivial way::" msgstr "" -#: ../../extending/extending.rst:1229 +#: ../../extending/extending.rst:1240 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -1814,19 +1823,19 @@ msgstr "" " return PyLong_FromLong(sts);\n" "}" -#: ../../extending/extending.rst:1241 +#: ../../extending/extending.rst:1252 msgid "In the beginning of the module, right after the line ::" msgstr "" -#: ../../extending/extending.rst:1243 +#: ../../extending/extending.rst:1254 msgid "#include " msgstr "#include " -#: ../../extending/extending.rst:1245 +#: ../../extending/extending.rst:1256 msgid "two more lines must be added::" msgstr "" -#: ../../extending/extending.rst:1247 +#: ../../extending/extending.rst:1258 msgid "" "#define SPAM_MODULE\n" "#include \"spammodule.h\"" @@ -1834,7 +1843,7 @@ msgstr "" "#define SPAM_MODULE\n" "#include \"spammodule.h\"" -#: ../../extending/extending.rst:1250 +#: ../../extending/extending.rst:1261 msgid "" "The ``#define`` is used to tell the header file that it is being included in " "the exporting module, not a client module. Finally, the module's " @@ -1842,7 +1851,7 @@ msgid "" "array::" msgstr "" -#: ../../extending/extending.rst:1254 +#: ../../extending/extending.rst:1265 msgid "" "PyMODINIT_FUNC\n" "PyInit_spam(void)\n" @@ -1862,8 +1871,7 @@ msgid "" " c_api_object = PyCapsule_New((void *)PySpam_API, \"spam._C_API\", " "NULL);\n" "\n" -" if (PyModule_AddObject(m, \"_C_API\", c_api_object) < 0) {\n" -" Py_XDECREF(c_api_object);\n" +" if (PyModule_Add(m, \"_C_API\", c_api_object) < 0) {\n" " Py_DECREF(m);\n" " return NULL;\n" " }\n" @@ -1872,19 +1880,19 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1280 +#: ../../extending/extending.rst:1290 msgid "" "Note that ``PySpam_API`` is declared ``static``; otherwise the pointer array " "would disappear when :c:func:`!PyInit_spam` terminates!" msgstr "" -#: ../../extending/extending.rst:1283 +#: ../../extending/extending.rst:1293 msgid "" "The bulk of the work is in the header file :file:`spammodule.h`, which looks " "like this::" msgstr "" -#: ../../extending/extending.rst:1286 +#: ../../extending/extending.rst:1296 msgid "" "#ifndef Py_SPAMMODULE_H\n" "#define Py_SPAMMODULE_H\n" @@ -1936,14 +1944,14 @@ msgid "" "#endif /* !defined(Py_SPAMMODULE_H) */" msgstr "" -#: ../../extending/extending.rst:1334 +#: ../../extending/extending.rst:1344 msgid "" "All that a client module must do in order to have access to the function :c:" "func:`!PySpam_System` is to call the function (or rather macro) :c:func:`!" "import_spam` in its initialization function::" msgstr "" -#: ../../extending/extending.rst:1338 +#: ../../extending/extending.rst:1348 msgid "" "PyMODINIT_FUNC\n" "PyInit_client(void)\n" @@ -1960,14 +1968,14 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1352 +#: ../../extending/extending.rst:1362 msgid "" "The main disadvantage of this approach is that the file :file:`spammodule.h` " "is rather complicated. However, the basic structure is the same for each " "function that is exported, so it has to be learned only once." msgstr "" -#: ../../extending/extending.rst:1356 +#: ../../extending/extending.rst:1366 msgid "" "Finally it should be mentioned that Capsules offer additional functionality, " "which is especially useful for memory allocation and deallocation of the " @@ -1977,47 +1985,47 @@ msgid "" "in the Python source code distribution)." msgstr "" -#: ../../extending/extending.rst:1364 +#: ../../extending/extending.rst:1374 msgid "Footnotes" msgstr "註解" -#: ../../extending/extending.rst:1365 +#: ../../extending/extending.rst:1375 msgid "" "An interface for this function already exists in the standard module :mod:" "`os` --- it was chosen as a simple and straightforward example." msgstr "" -#: ../../extending/extending.rst:1368 +#: ../../extending/extending.rst:1378 msgid "" "The metaphor of \"borrowing\" a reference is not completely correct: the " "owner still has a copy of the reference." msgstr "" -#: ../../extending/extending.rst:1371 +#: ../../extending/extending.rst:1381 msgid "" "Checking that the reference count is at least 1 **does not work** --- the " "reference count itself could be in freed memory and may thus be reused for " "another object!" msgstr "" -#: ../../extending/extending.rst:1375 +#: ../../extending/extending.rst:1385 msgid "" "These guarantees don't hold when you use the \"old\" style calling " "convention --- this is still found in much existing code." msgstr "" -#: ../../extending/extending.rst:539 +#: ../../extending/extending.rst:550 msgid "PyObject_CallObject (C function)" msgstr "PyObject_CallObject(C 函式)" -#: ../../extending/extending.rst:630 +#: ../../extending/extending.rst:641 msgid "PyArg_ParseTuple (C function)" msgstr "PyArg_ParseTuple(C 函式)" -#: ../../extending/extending.rst:722 +#: ../../extending/extending.rst:733 msgid "PyArg_ParseTupleAndKeywords (C function)" msgstr "PyArg_ParseTupleAndKeywords(C 函式)" -#: ../../extending/extending.rst:743 +#: ../../extending/extending.rst:754 msgid "Philbrick, Geoff" msgstr "Philbrick, Geoff" diff --git a/extending/newtypes.po b/extending/newtypes.po index bf29295701..d31c7ef8a7 100644 --- a/extending/newtypes.po +++ b/extending/newtypes.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:34+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -775,7 +775,7 @@ msgstr "" #: ../../extending/newtypes.rst:451 msgid "" -":c:type:`!Py_hash_t` is a signed integer type with a platform-varying width. " +":c:type:`Py_hash_t` is a signed integer type with a platform-varying width. " "Returning ``-1`` from :c:member:`~PyTypeObject.tp_hash` indicates an error, " "which is why you should be careful to avoid returning it when hash " "computation is successful, as seen above." diff --git a/extending/newtypes_tutorial.po b/extending/newtypes_tutorial.po index d0a96394d1..8b1a2a41b9 100644 --- a/extending/newtypes_tutorial.po +++ b/extending/newtypes_tutorial.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -102,9 +102,8 @@ msgid "" " if (m == NULL)\n" " return NULL;\n" "\n" -" Py_INCREF(&CustomType);\n" -" if (PyModule_AddObject(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" -" Py_DECREF(&CustomType);\n" +" if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) " +"{\n" " Py_DECREF(m);\n" " return NULL;\n" " }\n" @@ -358,10 +357,9 @@ msgid "" msgstr "" #: ../../extending/newtypes_tutorial.rst:183 +#, fuzzy msgid "" -"Py_INCREF(&CustomType);\n" -"if (PyModule_AddObject(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" -" Py_DECREF(&CustomType);\n" +"if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" " Py_DECREF(m);\n" " return NULL;\n" "}" @@ -373,13 +371,13 @@ msgstr "" " return NULL;\n" "}" -#: ../../extending/newtypes_tutorial.rst:190 +#: ../../extending/newtypes_tutorial.rst:188 msgid "" "This adds the type to the module dictionary. This allows us to create :" "class:`!Custom` instances by calling the :class:`!Custom` class:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:193 +#: ../../extending/newtypes_tutorial.rst:191 msgid "" ">>> import custom\n" ">>> mycustom = custom.Custom()" @@ -387,13 +385,13 @@ msgstr "" ">>> import custom\n" ">>> mycustom = custom.Custom()" -#: ../../extending/newtypes_tutorial.rst:198 +#: ../../extending/newtypes_tutorial.rst:196 msgid "" "That's it! All that remains is to build it; put the above code in a file " "called :file:`custom.c`," msgstr "" -#: ../../extending/newtypes_tutorial.rst:201 +#: ../../extending/newtypes_tutorial.rst:199 msgid "" "[build-system]\n" "requires = [\"setuptools\"]\n" @@ -411,11 +409,11 @@ msgstr "" "name = \"custom\"\n" "version = \"1\"\n" -#: ../../extending/newtypes_tutorial.rst:203 +#: ../../extending/newtypes_tutorial.rst:201 msgid "in a file called :file:`pyproject.toml`, and" msgstr "" -#: ../../extending/newtypes_tutorial.rst:205 +#: ../../extending/newtypes_tutorial.rst:203 msgid "" "from setuptools import Extension, setup\n" "setup(ext_modules=[Extension(\"custom\", [\"custom.c\"])])" @@ -423,44 +421,44 @@ msgstr "" "from setuptools import Extension, setup\n" "setup(ext_modules=[Extension(\"custom\", [\"custom.c\"])])" -#: ../../extending/newtypes_tutorial.rst:210 +#: ../../extending/newtypes_tutorial.rst:208 msgid "in a file called :file:`setup.py`; then typing" msgstr "" -#: ../../extending/newtypes_tutorial.rst:212 -#: ../../extending/newtypes_tutorial.rst:527 +#: ../../extending/newtypes_tutorial.rst:210 +#: ../../extending/newtypes_tutorial.rst:525 msgid "$ python -m pip install ." msgstr "$ python -m pip install ." -#: ../../extending/newtypes_tutorial.rst:216 +#: ../../extending/newtypes_tutorial.rst:214 msgid "" "in a shell should produce a file :file:`custom.so` in a subdirectory and " "install it; now fire up Python --- you should be able to ``import custom`` " "and play around with ``Custom`` objects." msgstr "" -#: ../../extending/newtypes_tutorial.rst:220 +#: ../../extending/newtypes_tutorial.rst:218 msgid "That wasn't so hard, was it?" msgstr "" -#: ../../extending/newtypes_tutorial.rst:222 +#: ../../extending/newtypes_tutorial.rst:220 msgid "" "Of course, the current Custom type is pretty uninteresting. It has no data " "and doesn't do anything. It can't even be subclassed." msgstr "" -#: ../../extending/newtypes_tutorial.rst:227 +#: ../../extending/newtypes_tutorial.rst:225 msgid "Adding data and methods to the Basic example" msgstr "" -#: ../../extending/newtypes_tutorial.rst:229 +#: ../../extending/newtypes_tutorial.rst:227 msgid "" "Let's extend the basic example to add some data and methods. Let's also " "make the type usable as a base class. We'll create a new module, :mod:`!" "custom2` that adds these capabilities:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:233 +#: ../../extending/newtypes_tutorial.rst:231 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -595,11 +593,11 @@ msgid "" "}\n" msgstr "" -#: ../../extending/newtypes_tutorial.rst:236 +#: ../../extending/newtypes_tutorial.rst:234 msgid "This version of the module has a number of changes." msgstr "" -#: ../../extending/newtypes_tutorial.rst:238 +#: ../../extending/newtypes_tutorial.rst:236 msgid "" "The :class:`!Custom` type now has three data attributes in its C struct, " "*first*, *last*, and *number*. The *first* and *last* variables are Python " @@ -607,11 +605,11 @@ msgid "" "integer." msgstr "" -#: ../../extending/newtypes_tutorial.rst:242 +#: ../../extending/newtypes_tutorial.rst:240 msgid "The object structure is updated accordingly::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:244 +#: ../../extending/newtypes_tutorial.rst:242 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -627,13 +625,13 @@ msgstr "" " int number;\n" "} CustomObject;" -#: ../../extending/newtypes_tutorial.rst:251 +#: ../../extending/newtypes_tutorial.rst:249 msgid "" "Because we now have data to manage, we have to be more careful about object " "allocation and deallocation. At a minimum, we need a deallocation method::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:254 +#: ../../extending/newtypes_tutorial.rst:252 msgid "" "static void\n" "Custom_dealloc(CustomObject *self)\n" @@ -651,15 +649,15 @@ msgstr "" " Py_TYPE(self)->tp_free((PyObject *) self);\n" "}" -#: ../../extending/newtypes_tutorial.rst:262 +#: ../../extending/newtypes_tutorial.rst:260 msgid "which is assigned to the :c:member:`~PyTypeObject.tp_dealloc` member::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:264 +#: ../../extending/newtypes_tutorial.rst:262 msgid ".tp_dealloc = (destructor) Custom_dealloc," msgstr ".tp_dealloc = (destructor) Custom_dealloc," -#: ../../extending/newtypes_tutorial.rst:266 +#: ../../extending/newtypes_tutorial.rst:264 msgid "" "This method first clears the reference counts of the two Python attributes. :" "c:func:`Py_XDECREF` correctly handles the case where its argument is " @@ -670,7 +668,7 @@ msgid "" "an instance of a subclass." msgstr "" -#: ../../extending/newtypes_tutorial.rst:275 +#: ../../extending/newtypes_tutorial.rst:273 msgid "" "The explicit cast to ``destructor`` above is needed because we defined " "``Custom_dealloc`` to take a ``CustomObject *`` argument, but the " @@ -679,13 +677,13 @@ msgid "" "oriented polymorphism, in C!" msgstr "" -#: ../../extending/newtypes_tutorial.rst:281 +#: ../../extending/newtypes_tutorial.rst:279 msgid "" "We want to make sure that the first and last names are initialized to empty " "strings, so we provide a ``tp_new`` implementation::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:284 +#: ../../extending/newtypes_tutorial.rst:282 msgid "" "static PyObject *\n" "Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n" @@ -729,15 +727,15 @@ msgstr "" " return (PyObject *) self;\n" "}" -#: ../../extending/newtypes_tutorial.rst:305 +#: ../../extending/newtypes_tutorial.rst:303 msgid "and install it in the :c:member:`~PyTypeObject.tp_new` member::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:307 +#: ../../extending/newtypes_tutorial.rst:305 msgid ".tp_new = Custom_new," msgstr ".tp_new = Custom_new," -#: ../../extending/newtypes_tutorial.rst:309 +#: ../../extending/newtypes_tutorial.rst:307 msgid "" "The ``tp_new`` handler is responsible for creating (as opposed to " "initializing) objects of the type. It is exposed in Python as the :meth:" @@ -748,7 +746,7 @@ msgid "" "``first`` and ``last`` attributes to non-``NULL`` default values." msgstr "" -#: ../../extending/newtypes_tutorial.rst:317 +#: ../../extending/newtypes_tutorial.rst:315 msgid "" "``tp_new`` is passed the type being instantiated (not necessarily " "``CustomType``, if a subclass is instantiated) and any arguments passed when " @@ -758,29 +756,29 @@ msgid "" "k.a. ``tp_init`` in C or ``__init__`` in Python) methods." msgstr "" -#: ../../extending/newtypes_tutorial.rst:325 +#: ../../extending/newtypes_tutorial.rst:323 msgid "" "``tp_new`` shouldn't call ``tp_init`` explicitly, as the interpreter will do " "it itself." msgstr "" -#: ../../extending/newtypes_tutorial.rst:328 +#: ../../extending/newtypes_tutorial.rst:326 msgid "" "The ``tp_new`` implementation calls the :c:member:`~PyTypeObject.tp_alloc` " "slot to allocate memory::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:331 +#: ../../extending/newtypes_tutorial.rst:329 msgid "self = (CustomObject *) type->tp_alloc(type, 0);" msgstr "self = (CustomObject *) type->tp_alloc(type, 0);" -#: ../../extending/newtypes_tutorial.rst:333 +#: ../../extending/newtypes_tutorial.rst:331 msgid "" "Since memory allocation may fail, we must check the :c:member:`~PyTypeObject." "tp_alloc` result against ``NULL`` before proceeding." msgstr "" -#: ../../extending/newtypes_tutorial.rst:337 +#: ../../extending/newtypes_tutorial.rst:335 msgid "" "We didn't fill the :c:member:`~PyTypeObject.tp_alloc` slot ourselves. " "Rather :c:func:`PyType_Ready` fills it for us by inheriting it from our base " @@ -788,7 +786,7 @@ msgid "" "allocation strategy." msgstr "" -#: ../../extending/newtypes_tutorial.rst:343 +#: ../../extending/newtypes_tutorial.rst:341 msgid "" "If you are creating a co-operative :c:member:`~PyTypeObject.tp_new` (one " "that calls a base type's :c:member:`~PyTypeObject.tp_new` or :meth:`~object." @@ -801,13 +799,13 @@ msgid "" "subclasses without getting a :exc:`TypeError`.)" msgstr "" -#: ../../extending/newtypes_tutorial.rst:353 +#: ../../extending/newtypes_tutorial.rst:351 msgid "" "We also define an initialization function which accepts arguments to provide " "initial values for our instance::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:356 +#: ../../extending/newtypes_tutorial.rst:354 msgid "" "static int\n" "Custom_init(CustomObject *self, PyObject *args, PyObject *kwds)\n" @@ -861,15 +859,15 @@ msgstr "" " return 0;\n" "}" -#: ../../extending/newtypes_tutorial.rst:382 +#: ../../extending/newtypes_tutorial.rst:380 msgid "by filling the :c:member:`~PyTypeObject.tp_init` slot. ::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:384 +#: ../../extending/newtypes_tutorial.rst:382 msgid ".tp_init = (initproc) Custom_init," msgstr ".tp_init = (initproc) Custom_init," -#: ../../extending/newtypes_tutorial.rst:386 +#: ../../extending/newtypes_tutorial.rst:384 msgid "" "The :c:member:`~PyTypeObject.tp_init` slot is exposed in Python as the :meth:" "`~object.__init__` method. It is used to initialize an object after it's " @@ -877,7 +875,7 @@ msgid "" "they should return either ``0`` on success or ``-1`` on error." msgstr "" -#: ../../extending/newtypes_tutorial.rst:391 +#: ../../extending/newtypes_tutorial.rst:389 msgid "" "Unlike the ``tp_new`` handler, there is no guarantee that ``tp_init`` is " "called at all (for example, the :mod:`pickle` module by default doesn't " @@ -888,7 +886,7 @@ msgid "" "``first`` member like this::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:399 +#: ../../extending/newtypes_tutorial.rst:397 msgid "" "if (first) {\n" " Py_XDECREF(self->first);\n" @@ -902,7 +900,7 @@ msgstr "" " self->first = first;\n" "}" -#: ../../extending/newtypes_tutorial.rst:405 +#: ../../extending/newtypes_tutorial.rst:403 msgid "" "But this would be risky. Our type doesn't restrict the type of the " "``first`` member, so it could be any kind of object. It could have a " @@ -912,37 +910,37 @@ msgid "" "accesses and modifies our object." msgstr "" -#: ../../extending/newtypes_tutorial.rst:412 +#: ../../extending/newtypes_tutorial.rst:410 msgid "" "To be paranoid and protect ourselves against this possibility, we almost " "always reassign members before decrementing their reference counts. When " "don't we have to do this?" msgstr "" -#: ../../extending/newtypes_tutorial.rst:416 +#: ../../extending/newtypes_tutorial.rst:414 msgid "when we absolutely know that the reference count is greater than 1;" msgstr "" -#: ../../extending/newtypes_tutorial.rst:418 +#: ../../extending/newtypes_tutorial.rst:416 msgid "" "when we know that deallocation of the object [#]_ will neither release the :" "term:`GIL` nor cause any calls back into our type's code;" msgstr "" -#: ../../extending/newtypes_tutorial.rst:421 +#: ../../extending/newtypes_tutorial.rst:419 msgid "" "when decrementing a reference count in a :c:member:`~PyTypeObject." "tp_dealloc` handler on a type which doesn't support cyclic garbage " "collection [#]_." msgstr "" -#: ../../extending/newtypes_tutorial.rst:424 +#: ../../extending/newtypes_tutorial.rst:422 msgid "" "We want to expose our instance variables as attributes. There are a number " "of ways to do that. The simplest way is to define member definitions::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:427 +#: ../../extending/newtypes_tutorial.rst:425 msgid "" "static PyMemberDef Custom_members[] = {\n" " {\"first\", Py_T_OBJECT_EX, offsetof(CustomObject, first), 0,\n" @@ -955,23 +953,23 @@ msgid "" "};" msgstr "" -#: ../../extending/newtypes_tutorial.rst:437 +#: ../../extending/newtypes_tutorial.rst:435 msgid "" "and put the definitions in the :c:member:`~PyTypeObject.tp_members` slot::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:439 +#: ../../extending/newtypes_tutorial.rst:437 msgid ".tp_members = Custom_members," msgstr ".tp_members = Custom_members," -#: ../../extending/newtypes_tutorial.rst:441 +#: ../../extending/newtypes_tutorial.rst:439 msgid "" "Each member definition has a member name, type, offset, access flags and " "documentation string. See the :ref:`Generic-Attribute-Management` section " "below for details." msgstr "" -#: ../../extending/newtypes_tutorial.rst:445 +#: ../../extending/newtypes_tutorial.rst:443 msgid "" "A disadvantage of this approach is that it doesn't provide a way to restrict " "the types of objects that can be assigned to the Python attributes. We " @@ -982,13 +980,13 @@ msgid "" "deleted." msgstr "" -#: ../../extending/newtypes_tutorial.rst:452 +#: ../../extending/newtypes_tutorial.rst:450 msgid "" "We define a single method, :meth:`!Custom.name`, that outputs the objects " "name as the concatenation of the first and last names. ::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:455 +#: ../../extending/newtypes_tutorial.rst:453 msgid "" "static PyObject *\n" "Custom_name(CustomObject *self, PyObject *Py_UNUSED(ignored))\n" @@ -1018,7 +1016,7 @@ msgstr "" " return PyUnicode_FromFormat(\"%S %S\", self->first, self->last);\n" "}" -#: ../../extending/newtypes_tutorial.rst:469 +#: ../../extending/newtypes_tutorial.rst:467 msgid "" "The method is implemented as a C function that takes a :class:`!Custom` (or :" "class:`!Custom` subclass) instance as the first argument. Methods always " @@ -1028,7 +1026,7 @@ msgid "" "method is equivalent to the Python method:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:476 +#: ../../extending/newtypes_tutorial.rst:474 msgid "" "def name(self):\n" " return \"%s %s\" % (self.first, self.last)" @@ -1036,7 +1034,7 @@ msgstr "" "def name(self):\n" " return \"%s %s\" % (self.first, self.last)" -#: ../../extending/newtypes_tutorial.rst:481 +#: ../../extending/newtypes_tutorial.rst:479 msgid "" "Note that we have to check for the possibility that our :attr:`!first` and :" "attr:`!last` members are ``NULL``. This is because they can be deleted, in " @@ -1045,13 +1043,13 @@ msgid "" "We'll see how to do that in the next section." msgstr "" -#: ../../extending/newtypes_tutorial.rst:487 +#: ../../extending/newtypes_tutorial.rst:485 msgid "" "Now that we've defined the method, we need to create an array of method " "definitions::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:490 +#: ../../extending/newtypes_tutorial.rst:488 msgid "" "static PyMethodDef Custom_methods[] = {\n" " {\"name\", (PyCFunction) Custom_name, METH_NOARGS,\n" @@ -1061,21 +1059,21 @@ msgid "" "};" msgstr "" -#: ../../extending/newtypes_tutorial.rst:497 +#: ../../extending/newtypes_tutorial.rst:495 msgid "" "(note that we used the :c:macro:`METH_NOARGS` flag to indicate that the " "method is expecting no arguments other than *self*)" msgstr "" -#: ../../extending/newtypes_tutorial.rst:500 +#: ../../extending/newtypes_tutorial.rst:498 msgid "and assign it to the :c:member:`~PyTypeObject.tp_methods` slot::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:502 +#: ../../extending/newtypes_tutorial.rst:500 msgid ".tp_methods = Custom_methods," msgstr ".tp_methods = Custom_methods," -#: ../../extending/newtypes_tutorial.rst:504 +#: ../../extending/newtypes_tutorial.rst:502 msgid "" "Finally, we'll make our type usable as a base class for subclassing. We've " "written our methods carefully so far so that they don't make any assumptions " @@ -1083,22 +1081,22 @@ msgid "" "to add the :c:macro:`Py_TPFLAGS_BASETYPE` to our class flag definition::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:509 +#: ../../extending/newtypes_tutorial.rst:507 msgid ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE," msgstr ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE," -#: ../../extending/newtypes_tutorial.rst:511 +#: ../../extending/newtypes_tutorial.rst:509 msgid "" "We rename :c:func:`!PyInit_custom` to :c:func:`!PyInit_custom2`, update the " "module name in the :c:type:`PyModuleDef` struct, and update the full class " "name in the :c:type:`PyTypeObject` struct." msgstr "" -#: ../../extending/newtypes_tutorial.rst:515 +#: ../../extending/newtypes_tutorial.rst:513 msgid "Finally, we update our :file:`setup.py` file to include the new module," msgstr "" -#: ../../extending/newtypes_tutorial.rst:517 +#: ../../extending/newtypes_tutorial.rst:515 msgid "" "from setuptools import Extension, setup\n" "setup(ext_modules=[\n" @@ -1112,15 +1110,15 @@ msgstr "" " Extension(\"custom2\", [\"custom2.c\"]),\n" "])" -#: ../../extending/newtypes_tutorial.rst:525 +#: ../../extending/newtypes_tutorial.rst:523 msgid "and then we re-install so that we can ``import custom2``:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:532 +#: ../../extending/newtypes_tutorial.rst:530 msgid "Providing finer control over data attributes" msgstr "" -#: ../../extending/newtypes_tutorial.rst:534 +#: ../../extending/newtypes_tutorial.rst:532 msgid "" "In this section, we'll provide finer control over how the :attr:`!first` " "and :attr:`!last` attributes are set in the :class:`!Custom` example. In the " @@ -1129,7 +1127,7 @@ msgid "" "make sure that these attributes always contain strings." msgstr "" -#: ../../extending/newtypes_tutorial.rst:540 +#: ../../extending/newtypes_tutorial.rst:538 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -1307,14 +1305,14 @@ msgid "" "}\n" msgstr "" -#: ../../extending/newtypes_tutorial.rst:543 +#: ../../extending/newtypes_tutorial.rst:541 msgid "" "To provide greater control, over the :attr:`!first` and :attr:`!last` " "attributes, we'll use custom getter and setter functions. Here are the " "functions for getting and setting the :attr:`!first` attribute::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:547 +#: ../../extending/newtypes_tutorial.rst:545 msgid "" "static PyObject *\n" "Custom_getfirst(CustomObject *self, void *closure)\n" @@ -1345,7 +1343,7 @@ msgid "" "}" msgstr "" -#: ../../extending/newtypes_tutorial.rst:574 +#: ../../extending/newtypes_tutorial.rst:572 msgid "" "The getter function is passed a :class:`!Custom` object and a \"closure\", " "which is a void pointer. In this case, the closure is ignored. (The " @@ -1355,7 +1353,7 @@ msgid "" "data in the closure.)" msgstr "" -#: ../../extending/newtypes_tutorial.rst:580 +#: ../../extending/newtypes_tutorial.rst:578 msgid "" "The setter function is passed the :class:`!Custom` object, the new value, " "and the closure. The new value may be ``NULL``, in which case the attribute " @@ -1363,11 +1361,11 @@ msgid "" "deleted or if its new value is not a string." msgstr "" -#: ../../extending/newtypes_tutorial.rst:585 +#: ../../extending/newtypes_tutorial.rst:583 msgid "We create an array of :c:type:`PyGetSetDef` structures::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:587 +#: ../../extending/newtypes_tutorial.rst:585 msgid "" "static PyGetSetDef Custom_getsetters[] = {\n" " {\"first\", (getter) Custom_getfirst, (setter) Custom_setfirst,\n" @@ -1378,26 +1376,26 @@ msgid "" "};" msgstr "" -#: ../../extending/newtypes_tutorial.rst:595 +#: ../../extending/newtypes_tutorial.rst:593 msgid "and register it in the :c:member:`~PyTypeObject.tp_getset` slot::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:597 +#: ../../extending/newtypes_tutorial.rst:595 msgid ".tp_getset = Custom_getsetters," msgstr ".tp_getset = Custom_getsetters," -#: ../../extending/newtypes_tutorial.rst:599 +#: ../../extending/newtypes_tutorial.rst:597 msgid "" "The last item in a :c:type:`PyGetSetDef` structure is the \"closure\" " "mentioned above. In this case, we aren't using a closure, so we just pass " "``NULL``." msgstr "" -#: ../../extending/newtypes_tutorial.rst:602 +#: ../../extending/newtypes_tutorial.rst:600 msgid "We also remove the member definitions for these attributes::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:604 +#: ../../extending/newtypes_tutorial.rst:602 msgid "" "static PyMemberDef Custom_members[] = {\n" " {\"number\", Py_T_INT, offsetof(CustomObject, number), 0,\n" @@ -1406,13 +1404,13 @@ msgid "" "};" msgstr "" -#: ../../extending/newtypes_tutorial.rst:610 +#: ../../extending/newtypes_tutorial.rst:608 msgid "" "We also need to update the :c:member:`~PyTypeObject.tp_init` handler to only " "allow strings [#]_ to be passed::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:613 +#: ../../extending/newtypes_tutorial.rst:611 msgid "" "static int\n" "Custom_init(CustomObject *self, PyObject *args, PyObject *kwds)\n" @@ -1441,7 +1439,7 @@ msgid "" "}" msgstr "" -#: ../../extending/newtypes_tutorial.rst:639 +#: ../../extending/newtypes_tutorial.rst:637 msgid "" "With these changes, we can assure that the ``first`` and ``last`` members " "are never ``NULL`` so we can remove checks for ``NULL`` values in almost all " @@ -1451,25 +1449,25 @@ msgid "" "possibility that the initialization of these members failed in ``tp_new``." msgstr "" -#: ../../extending/newtypes_tutorial.rst:646 +#: ../../extending/newtypes_tutorial.rst:644 msgid "" "We also rename the module initialization function and module name in the " "initialization function, as we did before, and we add an extra definition to " "the :file:`setup.py` file." msgstr "" -#: ../../extending/newtypes_tutorial.rst:652 +#: ../../extending/newtypes_tutorial.rst:650 msgid "Supporting cyclic garbage collection" msgstr "" -#: ../../extending/newtypes_tutorial.rst:654 +#: ../../extending/newtypes_tutorial.rst:652 msgid "" "Python has a :term:`cyclic garbage collector (GC) ` that " "can identify unneeded objects even when their reference counts are not zero. " "This can happen when objects are involved in cycles. For example, consider:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:658 +#: ../../extending/newtypes_tutorial.rst:656 msgid "" ">>> l = []\n" ">>> l.append(l)\n" @@ -1479,7 +1477,7 @@ msgstr "" ">>> l.append(l)\n" ">>> del l" -#: ../../extending/newtypes_tutorial.rst:664 +#: ../../extending/newtypes_tutorial.rst:662 msgid "" "In this example, we create a list that contains itself. When we delete it, " "it still has a reference from itself. Its reference count doesn't drop to " @@ -1487,7 +1485,7 @@ msgid "" "out that the list is garbage and free it." msgstr "" -#: ../../extending/newtypes_tutorial.rst:669 +#: ../../extending/newtypes_tutorial.rst:667 msgid "" "In the second version of the :class:`!Custom` example, we allowed any kind " "of object to be stored in the :attr:`!first` or :attr:`!last` attributes " @@ -1496,7 +1494,7 @@ msgid "" "those two reasons, :class:`!Custom` objects can participate in cycles:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:675 +#: ../../extending/newtypes_tutorial.rst:673 msgid "" ">>> import custom3\n" ">>> class Derived(custom3.Custom): pass\n" @@ -1510,7 +1508,7 @@ msgstr "" ">>> n = Derived()\n" ">>> n.some_attribute = n" -#: ../../extending/newtypes_tutorial.rst:683 +#: ../../extending/newtypes_tutorial.rst:681 msgid "" "To allow a :class:`!Custom` instance participating in a reference cycle to " "be properly detected and collected by the cyclic GC, our :class:`!Custom` " @@ -1518,7 +1516,7 @@ msgid "" "these slots:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:687 +#: ../../extending/newtypes_tutorial.rst:685 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -1715,13 +1713,13 @@ msgid "" "}\n" msgstr "" -#: ../../extending/newtypes_tutorial.rst:690 +#: ../../extending/newtypes_tutorial.rst:688 msgid "" "First, the traversal method lets the cyclic GC know about subobjects that " "could participate in cycles::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:693 +#: ../../extending/newtypes_tutorial.rst:691 msgid "" "static int\n" "Custom_traverse(CustomObject *self, visitproc visit, void *arg)\n" @@ -1757,7 +1755,7 @@ msgstr "" " return 0;\n" "}" -#: ../../extending/newtypes_tutorial.rst:710 +#: ../../extending/newtypes_tutorial.rst:708 msgid "" "For each subobject that can participate in cycles, we need to call the :c:" "func:`!visit` function, which is passed to the traversal method. The :c:func:" @@ -1766,14 +1764,14 @@ msgid "" "be returned if it is non-zero." msgstr "" -#: ../../extending/newtypes_tutorial.rst:716 +#: ../../extending/newtypes_tutorial.rst:714 msgid "" "Python provides a :c:func:`Py_VISIT` macro that automates calling visit " "functions. With :c:func:`Py_VISIT`, we can minimize the amount of " "boilerplate in ``Custom_traverse``::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:720 +#: ../../extending/newtypes_tutorial.rst:718 msgid "" "static int\n" "Custom_traverse(CustomObject *self, visitproc visit, void *arg)\n" @@ -1791,19 +1789,19 @@ msgstr "" " return 0;\n" "}" -#: ../../extending/newtypes_tutorial.rst:729 +#: ../../extending/newtypes_tutorial.rst:727 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` implementation must name its " "arguments exactly *visit* and *arg* in order to use :c:func:`Py_VISIT`." msgstr "" -#: ../../extending/newtypes_tutorial.rst:732 +#: ../../extending/newtypes_tutorial.rst:730 msgid "" "Second, we need to provide a method for clearing any subobjects that can " "participate in cycles::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:735 +#: ../../extending/newtypes_tutorial.rst:733 msgid "" "static int\n" "Custom_clear(CustomObject *self)\n" @@ -1821,7 +1819,7 @@ msgstr "" " return 0;\n" "}" -#: ../../extending/newtypes_tutorial.rst:743 +#: ../../extending/newtypes_tutorial.rst:741 msgid "" "Notice the use of the :c:func:`Py_CLEAR` macro. It is the recommended and " "safe way to clear data attributes of arbitrary types while decrementing " @@ -1831,11 +1829,11 @@ msgid "" "again (*especially* if there is a reference cycle)." msgstr "" -#: ../../extending/newtypes_tutorial.rst:751 +#: ../../extending/newtypes_tutorial.rst:749 msgid "You could emulate :c:func:`Py_CLEAR` by writing::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:753 +#: ../../extending/newtypes_tutorial.rst:751 msgid "" "PyObject *tmp;\n" "tmp = self->first;\n" @@ -1847,14 +1845,14 @@ msgstr "" "self->first = NULL;\n" "Py_XDECREF(tmp);" -#: ../../extending/newtypes_tutorial.rst:758 +#: ../../extending/newtypes_tutorial.rst:756 msgid "" "Nevertheless, it is much easier and less error-prone to always use :c:func:" "`Py_CLEAR` when deleting an attribute. Don't try to micro-optimize at the " "expense of robustness!" msgstr "" -#: ../../extending/newtypes_tutorial.rst:762 +#: ../../extending/newtypes_tutorial.rst:760 msgid "" "The deallocator ``Custom_dealloc`` may call arbitrary code when clearing " "attributes. It means the circular GC can be triggered inside the function. " @@ -1864,7 +1862,7 @@ msgid "" "`PyObject_GC_UnTrack` and ``Custom_clear``::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:769 +#: ../../extending/newtypes_tutorial.rst:767 msgid "" "static void\n" "Custom_dealloc(CustomObject *self)\n" @@ -1882,18 +1880,18 @@ msgstr "" " Py_TYPE(self)->tp_free((PyObject *) self);\n" "}" -#: ../../extending/newtypes_tutorial.rst:777 +#: ../../extending/newtypes_tutorial.rst:775 msgid "" "Finally, we add the :c:macro:`Py_TPFLAGS_HAVE_GC` flag to the class flags::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:779 +#: ../../extending/newtypes_tutorial.rst:777 msgid "" ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC," msgstr "" ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC," -#: ../../extending/newtypes_tutorial.rst:781 +#: ../../extending/newtypes_tutorial.rst:779 msgid "" "That's pretty much it. If we had written custom :c:member:`~PyTypeObject." "tp_alloc` or :c:member:`~PyTypeObject.tp_free` handlers, we'd need to modify " @@ -1901,11 +1899,11 @@ msgid "" "automatically provided." msgstr "" -#: ../../extending/newtypes_tutorial.rst:787 +#: ../../extending/newtypes_tutorial.rst:785 msgid "Subclassing other types" msgstr "" -#: ../../extending/newtypes_tutorial.rst:789 +#: ../../extending/newtypes_tutorial.rst:787 msgid "" "It is possible to create new extension types that are derived from existing " "types. It is easiest to inherit from the built in types, since an extension " @@ -1913,7 +1911,7 @@ msgid "" "share these :c:type:`PyTypeObject` structures between extension modules." msgstr "" -#: ../../extending/newtypes_tutorial.rst:794 +#: ../../extending/newtypes_tutorial.rst:792 msgid "" "In this example we will create a :class:`!SubList` type that inherits from " "the built-in :class:`list` type. The new type will be completely compatible " @@ -1921,7 +1919,7 @@ msgid "" "that increases an internal counter:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:799 +#: ../../extending/newtypes_tutorial.rst:797 msgid "" ">>> import sublist\n" ">>> s = sublist.SubList(range(3))\n" @@ -1943,7 +1941,7 @@ msgstr "" ">>> print(s.increment())\n" "2" -#: ../../extending/newtypes_tutorial.rst:811 +#: ../../extending/newtypes_tutorial.rst:809 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -2005,10 +2003,8 @@ msgid "" " if (m == NULL)\n" " return NULL;\n" "\n" -" Py_INCREF(&SubListType);\n" -" if (PyModule_AddObject(m, \"SubList\", (PyObject *) &SubListType) < 0) " -"{\n" -" Py_DECREF(&SubListType);\n" +" if (PyModule_AddObjectRef(m, \"SubList\", (PyObject *) &SubListType) < " +"0) {\n" " Py_DECREF(m);\n" " return NULL;\n" " }\n" @@ -2017,14 +2013,14 @@ msgid "" "}\n" msgstr "" -#: ../../extending/newtypes_tutorial.rst:814 +#: ../../extending/newtypes_tutorial.rst:812 msgid "" "As you can see, the source code closely resembles the :class:`!Custom` " "examples in previous sections. We will break down the main differences " "between them. ::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:817 +#: ../../extending/newtypes_tutorial.rst:815 msgid "" "typedef struct {\n" " PyListObject list;\n" @@ -2036,21 +2032,21 @@ msgstr "" " int state;\n" "} SubListObject;" -#: ../../extending/newtypes_tutorial.rst:822 +#: ../../extending/newtypes_tutorial.rst:820 msgid "" "The primary difference for derived type objects is that the base type's " "object structure must be the first value. The base type will already " "include the :c:func:`PyObject_HEAD` at the beginning of its structure." msgstr "" -#: ../../extending/newtypes_tutorial.rst:826 +#: ../../extending/newtypes_tutorial.rst:824 msgid "" "When a Python object is a :class:`!SubList` instance, its ``PyObject *`` " "pointer can be safely cast to both ``PyListObject *`` and ``SubListObject " "*``::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:829 +#: ../../extending/newtypes_tutorial.rst:827 msgid "" "static int\n" "SubList_init(SubListObject *self, PyObject *args, PyObject *kwds)\n" @@ -2070,13 +2066,13 @@ msgstr "" " return 0;\n" "}" -#: ../../extending/newtypes_tutorial.rst:838 +#: ../../extending/newtypes_tutorial.rst:836 msgid "" "We see above how to call through to the :meth:`~object.__init__` method of " "the base type." msgstr "" -#: ../../extending/newtypes_tutorial.rst:841 +#: ../../extending/newtypes_tutorial.rst:839 msgid "" "This pattern is important when writing a type with custom :c:member:" "`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_dealloc` members. " @@ -2085,7 +2081,7 @@ msgid "" "the base class handle it by calling its own :c:member:`~PyTypeObject.tp_new`." msgstr "" -#: ../../extending/newtypes_tutorial.rst:847 +#: ../../extending/newtypes_tutorial.rst:845 msgid "" "The :c:type:`PyTypeObject` struct supports a :c:member:`~PyTypeObject." "tp_base` specifying the type's concrete base class. Due to cross-platform " @@ -2094,7 +2090,8 @@ msgid "" "function::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:853 +#: ../../extending/newtypes_tutorial.rst:851 +#, fuzzy msgid "" "PyMODINIT_FUNC\n" "PyInit_sublist(void)\n" @@ -2108,10 +2105,8 @@ msgid "" " if (m == NULL)\n" " return NULL;\n" "\n" -" Py_INCREF(&SubListType);\n" -" if (PyModule_AddObject(m, \"SubList\", (PyObject *) &SubListType) < 0) " -"{\n" -" Py_DECREF(&SubListType);\n" +" if (PyModule_AddObjectRef(m, \"SubList\", (PyObject *) &SubListType) < " +"0) {\n" " Py_DECREF(m);\n" " return NULL;\n" " }\n" @@ -2142,7 +2137,7 @@ msgstr "" " return m;\n" "}" -#: ../../extending/newtypes_tutorial.rst:875 +#: ../../extending/newtypes_tutorial.rst:871 msgid "" "Before calling :c:func:`PyType_Ready`, the type structure must have the :c:" "member:`~PyTypeObject.tp_base` slot filled in. When we are deriving an " @@ -2151,29 +2146,29 @@ msgid "" "from the base type will be inherited." msgstr "" -#: ../../extending/newtypes_tutorial.rst:881 +#: ../../extending/newtypes_tutorial.rst:877 msgid "" "After that, calling :c:func:`PyType_Ready` and adding the type object to the " "module is the same as with the basic :class:`!Custom` examples." msgstr "" -#: ../../extending/newtypes_tutorial.rst:886 +#: ../../extending/newtypes_tutorial.rst:882 msgid "Footnotes" msgstr "註解" -#: ../../extending/newtypes_tutorial.rst:887 +#: ../../extending/newtypes_tutorial.rst:883 msgid "" "This is true when we know that the object is a basic type, like a string or " "a float." msgstr "" -#: ../../extending/newtypes_tutorial.rst:890 +#: ../../extending/newtypes_tutorial.rst:886 msgid "" "We relied on this in the :c:member:`~PyTypeObject.tp_dealloc` handler in " "this example, because our type doesn't support garbage collection." msgstr "" -#: ../../extending/newtypes_tutorial.rst:893 +#: ../../extending/newtypes_tutorial.rst:889 msgid "" "We now know that the first and last members are strings, so perhaps we could " "be less careful about decrementing their reference counts, however, we " @@ -2183,7 +2178,7 @@ msgid "" "objects." msgstr "" -#: ../../extending/newtypes_tutorial.rst:899 +#: ../../extending/newtypes_tutorial.rst:895 msgid "" "Also, even with our attributes restricted to strings instances, the user " "could pass arbitrary :class:`str` subclasses and therefore still create " diff --git a/faq/design.po b/faq/design.po index 24856df300..0b92963fe7 100644 --- a/faq/design.po +++ b/faq/design.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-08-31 11:34+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -647,10 +647,11 @@ msgid "Can Python be compiled to machine code, C or some other language?" msgstr "Python 可以被編譯成機器語言、C 語言或其他種語言嗎?" #: ../../faq/design.rst:330 +#, fuzzy msgid "" "`Cython `_ compiles a modified version of Python with " -"optional annotations into C extensions. `Nuitka `_ is " -"an up-and-coming compiler of Python into C++ code, aiming to support the " +"optional annotations into C extensions. `Nuitka `_ " +"is an up-and-coming compiler of Python into C++ code, aiming to support the " "full Python language." msgstr "" "`Cython `_ 可以編譯一個調整過有選擇性註解的 Python 版" @@ -678,12 +679,13 @@ msgstr "" "函式。" #: ../../faq/design.rst:347 +#, fuzzy msgid "" "Other implementations (such as `Jython `_ or `PyPy " -"`_), however, can rely on a different mechanism such as a " -"full-blown garbage collector. This difference can cause some subtle porting " -"problems if your Python code depends on the behavior of the reference " -"counting implementation." +"`_), however, can rely on a different mechanism such " +"as a full-blown garbage collector. This difference can cause some subtle " +"porting problems if your Python code depends on the behavior of the " +"reference counting implementation." msgstr "" "然而,在其他實作(像是 `Jython `_ 或 `PyPy `_)中,會使用像是成熟的垃圾收集器等不同機制。如果你的 Python 程式碼" diff --git a/faq/general.po b/faq/general.po index 9f53ddf567..95f7688655 100644 --- a/faq/general.po +++ b/faq/general.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-06-23 16:56+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -611,12 +611,13 @@ msgstr "" "且會保證介面在一系列的錯誤修正發布版本中維持不變。" #: ../../faq/general.rst:311 +#, fuzzy msgid "" "The latest stable releases can always be found on the `Python download page " "`_. There are two production-ready " "versions of Python: 2.x and 3.x. The recommended version is 3.x, which is " -"supported by most widely used libraries. Although 2.x is still widely " -"used, :pep:`it is not maintained anymore <0373>`." +"supported by most widely used libraries. Although 2.x is still widely used, " +"`it is not maintained anymore `_." msgstr "" "最新的穩定發布版本隨時都可以在 `Python 下載頁面 `_\\ 上找到。Python 有兩個生產就緒 (production-ready) 的版本:2.x " diff --git a/faq/gui.po b/faq/gui.po index 46fba489b2..784f3360fb 100644 --- a/faq/gui.po +++ b/faq/gui.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-05 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-07-02 17:41+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -93,30 +93,15 @@ msgstr "" #: ../../faq/gui.rst:49 msgid "" -"To get truly stand-alone applications, the Tcl scripts that form the library " -"have to be integrated into the application as well. One tool supporting that " -"is SAM (stand-alone modules), which is part of the Tix distribution (https://" -"tix.sourceforge.net/)." +"Various third-party freeze libraries such as py2exe and cx_Freeze have " +"handling for Tkinter applications built-in." msgstr "" -"要得到真正獨立的應用程式,必須將構成函式庫的 Tcl 腳本也整合到應用程式中。一個" -"可支援該方法的工具是 SAM(stand-alone modules,獨立模組),它是 Tix 發行版的" -"一部分 (https://tix.sourceforge.net/)。" #: ../../faq/gui.rst:54 -msgid "" -"Build Tix with SAM enabled, perform the appropriate call to :c:func:`!" -"Tclsam_init`, etc. inside Python's :file:`Modules/tkappinit.c`, and link " -"with libtclsam and libtksam (you might include the Tix libraries as well)." -msgstr "" -"請在 SAM 被啟用的情況下建置 Tix,對 Python 的 :file:`Modules/tkappinit.c` 中" -"的 :c:func:`!Tclsam_init` 等函式執行適當的呼叫,並與 libtclsam 和 libtksam 連" -"結(你可能也會 include Tix 函式庫)。" - -#: ../../faq/gui.rst:61 msgid "Can I have Tk events handled while waiting for I/O?" msgstr "是否可以在等待 I/O 時處理 Tk 事件?" -#: ../../faq/gui.rst:63 +#: ../../faq/gui.rst:56 msgid "" "On platforms other than Windows, yes, and you don't even need threads! But " "you'll have to restructure your I/O code a bit. Tk has the equivalent of " @@ -130,11 +115,11 @@ msgstr "" "進行時,該函式將會從 Tk mainloop 被呼叫。請參閱\\ :ref:`tkinter-file-" "handlers`。" -#: ../../faq/gui.rst:71 +#: ../../faq/gui.rst:64 msgid "I can't get key bindings to work in Tkinter: why?" msgstr "我無法讓鍵繫結 (key binding) 在 Tkinter 中作用:為什麼?" -#: ../../faq/gui.rst:73 +#: ../../faq/gui.rst:66 msgid "" "An often-heard complaint is that event handlers :ref:`bound ` to events with the :meth:`!bind` method don't get handled even when " @@ -144,7 +129,7 @@ msgstr "" "`\\ 到帶有 :meth:`!bind` method 的事件,但在按下相應的鍵" "時,該事件也沒有被處理。" -#: ../../faq/gui.rst:77 +#: ../../faq/gui.rst:70 msgid "" "The most common cause is that the widget to which the binding applies " "doesn't have \"keyboard focus\". Check out the Tk documentation for the " @@ -154,3 +139,22 @@ msgstr "" "最常見的原因是,繫結到的小工具並沒有「鍵盤焦點 (keyboard focus)」。請查看 Tk " "說明文件中關於焦點命令的敘述。通常,點擊一個小工具,會讓它得到鍵盤焦點(但不" "適用於標籤;請參閱 takefocus 選項)。" + +#~ msgid "" +#~ "To get truly stand-alone applications, the Tcl scripts that form the " +#~ "library have to be integrated into the application as well. One tool " +#~ "supporting that is SAM (stand-alone modules), which is part of the Tix " +#~ "distribution (https://tix.sourceforge.net/)." +#~ msgstr "" +#~ "要得到真正獨立的應用程式,必須將構成函式庫的 Tcl 腳本也整合到應用程式中。" +#~ "一個可支援該方法的工具是 SAM(stand-alone modules,獨立模組),它是 Tix 發" +#~ "行版的一部分 (https://tix.sourceforge.net/)。" + +#~ msgid "" +#~ "Build Tix with SAM enabled, perform the appropriate call to :c:func:`!" +#~ "Tclsam_init`, etc. inside Python's :file:`Modules/tkappinit.c`, and link " +#~ "with libtclsam and libtksam (you might include the Tix libraries as well)." +#~ msgstr "" +#~ "請在 SAM 被啟用的情況下建置 Tix,對 Python 的 :file:`Modules/tkappinit.c` " +#~ "中的 :c:func:`!Tclsam_init` 等函式執行適當的呼叫,並與 libtclsam 和 " +#~ "libtksam 連結(你可能也會 include Tix 函式庫)。" diff --git a/faq/library.po b/faq/library.po index 8ed007828e..fef7290929 100644 --- a/faq/library.po +++ b/faq/library.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-02-18 13:22+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -716,7 +716,7 @@ msgstr "" msgid "Can't we get rid of the Global Interpreter Lock?" msgstr "不能擺脫全局直譯器鎖嗎?" -#: ../../faq/library.rst:410 +#: ../../faq/library.rst:408 #, fuzzy msgid "" "The :term:`global interpreter lock` (GIL) is often seen as a hindrance to " @@ -728,17 +728,32 @@ msgstr "" "機器上部署的障礙,因為多執行緒 Python 程式實際上只使用一個 CPU,因為堅持(幾" "乎)所有 Python 程式碼只能在持有 GIL 的情況下運行。" -#: ../../faq/library.rst:415 +#: ../../faq/library.rst:413 +msgid "" +"With the approval of :pep:`703` work is now underway to remove the GIL from " +"the CPython implementation of Python. Initially it will be implemented as " +"an optional compiler flag when building the interpreter, and so separate " +"builds will be available with and without the GIL. Long-term, the hope is " +"to settle on a single build, once the performance implications of removing " +"the GIL are fully understood. Python 3.13 is likely to be the first release " +"containing this work, although it may not be completely functional in this " +"release." +msgstr "" + +#: ../../faq/library.rst:422 #, fuzzy msgid "" -"Back in the days of Python 1.5, Greg Stein actually implemented a " +"The current work to remove the GIL is based on a `fork of Python 3.9 with " +"the GIL removed `_ by Sam Gross. Prior " +"to that, in the days of Python 1.5, Greg Stein actually implemented a " "comprehensive patch set (the \"free threading\" patches) that removed the " -"GIL and replaced it with fine-grained locking. Adam Olsen recently did a " -"similar experiment in his `python-safethread `_ project. Unfortunately, both experiments " -"exhibited a sharp drop in single-thread performance (at least 30% slower), " -"due to the amount of fine-grained locking necessary to compensate for the " -"removal of the GIL." +"GIL and replaced it with fine-grained locking. Adam Olsen did a similar " +"experiment in his `python-safethread `_ project. Unfortunately, both of these earlier " +"experiments exhibited a sharp drop in single-thread performance (at least " +"30% slower), due to the amount of fine-grained locking necessary to " +"compensate for the removal of the GIL. The Python 3.9 fork is the first " +"attempt at removing the GIL with an acceptable performance impact." msgstr "" "回到 Python 1.5 時代,Greg Stein 實際上實作了一個全面的補丁集( \"自由執行緒" "\" 補丁),刪除了 GIL 並用細粒度鎖定取而代之。 Adam Olsen 最近在他的 `python-" @@ -746,16 +761,16 @@ msgstr "" "一個類似的實驗。不幸的是,這兩個實驗都表現出單執行緒性能的急劇下降(至少慢了 " "30%),這是由於需要大量的細粒度鎖定來補償 GIL 的移除。" -#: ../../faq/library.rst:423 +#: ../../faq/library.rst:437 #, fuzzy msgid "" -"This doesn't mean that you can't make good use of Python on multi-CPU " -"machines! You just have to be creative with dividing the work up between " -"multiple *processes* rather than multiple *threads*. The :class:" -"`~concurrent.futures.ProcessPoolExecutor` class in the new :mod:`concurrent." -"futures` module provides an easy way of doing so; the :mod:`multiprocessing` " -"module provides a lower-level API in case you want more control over " -"dispatching of tasks." +"The presence of the GIL in current Python releases doesn't mean that you " +"can't make good use of Python on multi-CPU machines! You just have to be " +"creative with dividing the work up between multiple *processes* rather than " +"multiple *threads*. The :class:`~concurrent.futures.ProcessPoolExecutor` " +"class in the new :mod:`concurrent.futures` module provides an easy way of " +"doing so; the :mod:`multiprocessing` module provides a lower-level API in " +"case you want more control over dispatching of tasks." msgstr "" "這並不意味著你不能在多 CPU 機器上用好 Python!你只需要創造性地將工作分配給多" "個*行程*而​​不是多個*執行緒*。新的 :mod:`concurrent.futures` 模組中的 :class:" @@ -763,7 +778,7 @@ msgstr "" "`multiprocessing` 模組提供了一個較低階別的 API,以防你希望更好地控制任務的調" "度。" -#: ../../faq/library.rst:431 +#: ../../faq/library.rst:446 #, fuzzy msgid "" "Judicious use of C extensions will also help; if you use a C extension to " @@ -776,53 +791,26 @@ msgstr "" "在執行執行緒在 C 程式碼中時釋放 GIL,並允許其他執行緒完成一些工作。一些標準函" "式庫模組,例如 :mod:`zlib` 和 :mod:`hashlib` 已經這樣做了。" -#: ../../faq/library.rst:437 -#, fuzzy -msgid "" -"It has been suggested that the GIL should be a per-interpreter-state lock " -"rather than truly global; interpreters then wouldn't be able to share " -"objects. Unfortunately, this isn't likely to happen either. It would be a " -"tremendous amount of work, because many object implementations currently " -"have global state. For example, small integers and short strings are cached; " -"these caches would have to be moved to the interpreter state. Other object " -"types have their own free list; these free lists would have to be moved to " -"the interpreter state. And so on." -msgstr "" -"有人建議 GIL 應該是每個直譯器狀態鎖,而不是真正的全局鎖;口譯員將無法共享物" -"件。不幸的是,這也不太可能發生。這將是一項巨大的工作量,因為目前許多物件實作" -"都具有全局狀態。例如,快取小整數和短字串;這些快取必須移至直譯器狀態。其他物" -"件型別有自己的空閒列表;這些空閒列表必須移至直譯器狀態。等等。" - -#: ../../faq/library.rst:446 -#, fuzzy -msgid "" -"And I doubt that it can even be done in finite time, because the same " -"problem exists for 3rd party extensions. It is likely that 3rd party " -"extensions are being written at a faster rate than you can convert them to " -"store all their global state in the interpreter state." -msgstr "" -"而且我懷疑它甚至可以在有限的時間內完成,因為第 3 方擴充存在同樣的問題。 3rd " -"方擴充的編寫速度可能比你轉換它們以將其所有全局狀態存儲在直譯器狀態中的速度更" -"快。" - -#: ../../faq/library.rst:451 -#, fuzzy +#: ../../faq/library.rst:452 msgid "" -"And finally, once you have multiple interpreters not sharing any state, what " -"have you gained over running each interpreter in a separate process?" +"An alternative approach to reducing the impact of the GIL is to make the GIL " +"a per-interpreter-state lock rather than truly global. This was :ref:`first " +"implemented in Python 3.12 ` and is available in the C " +"API. A Python interface to it is expected in Python 3.13. The main " +"limitation to it at the moment is likely to be 3rd party extension modules, " +"since these must be written with multiple interpreters in mind in order to " +"be usable, so many older extension modules will not be usable." msgstr "" -"最後,如果你有多個不共享任何狀態的直譯器,那麼在單獨的行程中運行每個直譯器有" -"什麼好處呢?" -#: ../../faq/library.rst:456 +#: ../../faq/library.rst:462 msgid "Input and Output" msgstr "輸入與輸出" -#: ../../faq/library.rst:459 +#: ../../faq/library.rst:465 msgid "How do I delete a file? (And other file questions...)" msgstr "如何刪除檔案?(以及其他檔案問題...)" -#: ../../faq/library.rst:461 +#: ../../faq/library.rst:467 #, fuzzy msgid "" "Use ``os.remove(filename)`` or ``os.unlink(filename)``; for documentation, " @@ -833,7 +821,7 @@ msgstr "" "mod:`os` 模組。這兩個功能是相同的; :func:`~os.unlink` 只是這個函式的 Unix 系" "統呼叫的名稱。" -#: ../../faq/library.rst:465 +#: ../../faq/library.rst:471 #, fuzzy msgid "" "To remove a directory, use :func:`os.rmdir`; use :func:`os.mkdir` to create " @@ -847,11 +835,11 @@ msgstr "" "removedirs(path)`` 將刪除中間目錄,只要它們是空的;如果要刪除整個目錄樹及其內" "容,請使用 :func:`shutil.rmtree`。" -#: ../../faq/library.rst:471 +#: ../../faq/library.rst:477 msgid "To rename a file, use ``os.rename(old_path, new_path)``." msgstr "要重新命名檔案,請使用 ``os.rename(old_path, new_path)``。" -#: ../../faq/library.rst:473 +#: ../../faq/library.rst:479 #, fuzzy msgid "" "To truncate a file, open it using ``f = open(filename, \"rb+\")``, and use " @@ -864,7 +852,7 @@ msgstr "" "檔案,還有 ``os.ftruncate(fd, offset)``,其中 *fd* 是檔案描述器(一個小整" "數)。" -#: ../../faq/library.rst:478 +#: ../../faq/library.rst:484 #, fuzzy msgid "" "The :mod:`shutil` module also contains a number of functions to work on " @@ -874,11 +862,11 @@ msgstr "" ":mod:`shutil` 模組還包含許多用於處理檔案的函式,包括:func:`~shutil." "copyfile`、:func:`~shutil.copytree` 和:func:`~shutil.rmtree`。" -#: ../../faq/library.rst:484 +#: ../../faq/library.rst:490 msgid "How do I copy a file?" msgstr "如何複製檔案?" -#: ../../faq/library.rst:486 +#: ../../faq/library.rst:492 #, fuzzy msgid "" "The :mod:`shutil` module contains a :func:`~shutil.copyfile` function. Note " @@ -896,11 +884,11 @@ msgstr "" "使用。它也不會複製檔案權限和元資料,儘管使用 :func:`shutil.copy2` 會保留其中" "的大部分(儘管不是全部)。" -#: ../../faq/library.rst:497 +#: ../../faq/library.rst:503 msgid "How do I read (or write) binary data?" msgstr "如何讀取(或寫入)二進位制資料?" -#: ../../faq/library.rst:499 +#: ../../faq/library.rst:505 #, fuzzy msgid "" "To read or write complex binary data formats, it's best to use the :mod:" @@ -910,7 +898,7 @@ msgstr "" "要讀取或寫入複雜的二進制資料格式,最好使用 :mod:`struct` 模組。它允許你獲取包" "含二進制資料(通常是數字)的字串並將其轉換為 Python 物件;反之亦然。" -#: ../../faq/library.rst:503 +#: ../../faq/library.rst:509 #, fuzzy msgid "" "For example, the following code reads two 2-byte integers and one 4-byte " @@ -919,7 +907,7 @@ msgstr "" "例如,以下程式碼從一個檔案中以大端格式讀取兩個 2 位元組整數和一個 4 位元組整" "數: ::" -#: ../../faq/library.rst:506 +#: ../../faq/library.rst:512 msgid "" "import struct\n" "\n" @@ -933,7 +921,7 @@ msgstr "" " s = f.read(8)\n" " x, y, z = struct.unpack(\">hhl\", s)" -#: ../../faq/library.rst:512 +#: ../../faq/library.rst:518 #, fuzzy msgid "" "The '>' in the format string forces big-endian data; the letter 'h' reads " @@ -943,7 +931,7 @@ msgstr "" "格式字串中的 \">\" 強制使用大端資料;字母 'h' 讀取一個 \"短整數\" (2 位元" "組), 'l' 從字串中讀取一個 \"長整數\" (4 位元組)。" -#: ../../faq/library.rst:516 +#: ../../faq/library.rst:522 #, fuzzy msgid "" "For data that is more regular (e.g. a homogeneous list of ints or floats), " @@ -952,7 +940,7 @@ msgstr "" "對於更規則的資料(例如,整數或浮點數的同類列表),你還可以使用 :mod:`array` " "模組。" -#: ../../faq/library.rst:521 +#: ../../faq/library.rst:527 #, fuzzy msgid "" "To read and write binary data, it is mandatory to open the file in binary " @@ -964,12 +952,12 @@ msgstr "" "給 :func:`open`)。如果你改用 ``\"r\"``(預設設定),檔案將以文本模式打開,並" "且 ``f.read()`` 將回傳 str 物件而不是 bytes ` 物件。" -#: ../../faq/library.rst:529 +#: ../../faq/library.rst:535 #, fuzzy msgid "I can't seem to use os.read() on a pipe created with os.popen(); why?" msgstr "我似乎無法在用 os.popen() 建立的管道上使用 os.read();為什麼?" -#: ../../faq/library.rst:531 +#: ../../faq/library.rst:537 #, fuzzy msgid "" ":func:`os.read` is a low-level function which takes a file descriptor, a " @@ -983,38 +971,38 @@ msgstr "" "型別相同。因此,要從使用 :func:`os.popen` 建立的管道 *p* 中讀取 *n* 個位元" "組,你需要使用 ``p.read(n)``。" -#: ../../faq/library.rst:617 +#: ../../faq/library.rst:623 msgid "How do I access the serial (RS232) port?" msgstr "如何存取序列 (RS232) 連接埠?" -#: ../../faq/library.rst:619 +#: ../../faq/library.rst:625 msgid "For Win32, OSX, Linux, BSD, Jython, IronPython:" msgstr "對於 Win32、OSX、Linux、BSD、Jython、IronPython:" -#: ../../faq/library.rst:621 +#: ../../faq/library.rst:627 msgid ":pypi:`pyserial`" msgstr ":pypi:`pyserial`" -#: ../../faq/library.rst:623 +#: ../../faq/library.rst:629 msgid "For Unix, see a Usenet post by Mitch Chapman:" msgstr "對於 Unix,請參閱 Mitch Chapman 的 Usenet 貼文:" -#: ../../faq/library.rst:625 +#: ../../faq/library.rst:631 msgid "https://groups.google.com/groups?selm=34A04430.CF9@ohioee.com" msgstr "https://groups.google.com/groups?selm=34A04430.CF9@ohioee.com" -#: ../../faq/library.rst:629 +#: ../../faq/library.rst:635 msgid "Why doesn't closing sys.stdout (stdin, stderr) really close it?" msgstr "為什麼關閉 sys.stdout (stdin, stderr) 並沒有真正關閉它?" -#: ../../faq/library.rst:631 +#: ../../faq/library.rst:637 msgid "" "Python :term:`file objects ` are a high-level layer of " "abstraction on low-level C file descriptors." msgstr "" "Python :term:`檔案物件 `\\ 是低階 C 檔案描述器的高階抽象層。" -#: ../../faq/library.rst:634 +#: ../../faq/library.rst:640 #, fuzzy msgid "" "For most file objects you create in Python via the built-in :func:`open` " @@ -1027,7 +1015,7 @@ msgstr "" "close()`` 從 Python 的角度將 Python 檔案物件標記為已關閉,並安排關閉底層 C 檔" "案描述器。當 ``f`` 變成垃圾時,這也會自動發生在 ``f`` 的析構函式中。" -#: ../../faq/library.rst:640 +#: ../../faq/library.rst:646 #, fuzzy msgid "" "But stdin, stdout and stderr are treated specially by Python, because of the " @@ -1039,7 +1027,7 @@ msgstr "" "態。運行 ``sys.stdout.close()`` 將 Python 級檔案物件標記為已關閉,但是 * " "not* 關閉關聯的 C 檔案描述器。" -#: ../../faq/library.rst:645 +#: ../../faq/library.rst:651 #, fuzzy msgid "" "To close the underlying C file descriptor for one of these three, you should " @@ -1049,7 +1037,7 @@ msgstr "" "要關閉這三個之一的底層 C 檔案描述器,你應該首先確定這是你真正想要做的(例如," "你可能會混淆試圖執行 I/O 的擴充模組)。如果是,使用 :func:`os.close`: ::" -#: ../../faq/library.rst:649 +#: ../../faq/library.rst:655 msgid "" "os.close(stdin.fileno())\n" "os.close(stdout.fileno())\n" @@ -1059,19 +1047,19 @@ msgstr "" "os.close(stdout.fileno())\n" "os.close(stderr.fileno())" -#: ../../faq/library.rst:653 +#: ../../faq/library.rst:659 msgid "Or you can use the numeric constants 0, 1 and 2, respectively." msgstr "或者你可以分別使用數字常數 0、1 和 2。" -#: ../../faq/library.rst:657 +#: ../../faq/library.rst:663 msgid "Network/Internet Programming" msgstr "網路 (Network)/網際網路 (Internet) 程式" -#: ../../faq/library.rst:660 +#: ../../faq/library.rst:666 msgid "What WWW tools are there for Python?" msgstr "Python 有哪些 WWW 工具?" -#: ../../faq/library.rst:662 +#: ../../faq/library.rst:668 #, fuzzy msgid "" "See the chapters titled :ref:`internet` and :ref:`netdata` in the Library " @@ -1081,7 +1069,7 @@ msgstr "" "請參閱函式庫參考手冊中標題為 :ref:`internet` 和 :ref:`netdata` 的章節。 " "Python 有許多模組可以幫助你構建伺服器端和用戶端 Web 系統。" -#: ../../faq/library.rst:668 +#: ../../faq/library.rst:674 #, fuzzy msgid "" "A summary of available frameworks is maintained by Paul Boddie at https://" @@ -1090,78 +1078,11 @@ msgstr "" "可用框架的摘要由 Paul Boddie 在 https://wiki.python.org/moin/" "WebProgramming\\ 維護。" -#: ../../faq/library.rst:671 -#, fuzzy -msgid "" -"Cameron Laird maintains a useful set of pages about Python web technologies " -"at https://web.archive.org/web/20210224183619/http://phaseit.net/claird/comp." -"lang.python/web_python." -msgstr "" -"Cameron Laird 在 https://web.archive.org/web/20210224183619/http://phaseit." -"net/claird/comp.lang.python/web_python 維護著一組有用的關於 Python 網路技術的" -"頁面。" - -#: ../../faq/library.rst:676 -msgid "How can I mimic CGI form submission (METHOD=POST)?" -msgstr "如何模擬 CGI 表單送出 (submission) (METHOD=POST)?" - -#: ../../faq/library.rst:678 -#, fuzzy -msgid "" -"I would like to retrieve web pages that are the result of POSTing a form. Is " -"there existing code that would let me do this easily?" -msgstr "" -"我想檢索作為發布表單結果的網頁。是否有現成的程式碼可以讓我輕鬆地做到這一點?" - -#: ../../faq/library.rst:681 -msgid "Yes. Here's a simple example that uses :mod:`urllib.request`::" -msgstr "是的,這是一個 :mod:`urllib.request` 的簡單範例: ::" - -#: ../../faq/library.rst:683 -msgid "" -"#!/usr/local/bin/python\n" -"\n" -"import urllib.request\n" -"\n" -"# build the query string\n" -"qs = \"First=Josephine&MI=Q&Last=Public\"\n" -"\n" -"# connect and send the server a path\n" -"req = urllib.request.urlopen('http://www.some-server.out-there/'\n" -" '/cgi-bin/some-cgi-script', data=qs)\n" -"with req:\n" -" msg, hdrs = req.read(), req.info()" -msgstr "" - -#: ../../faq/library.rst:696 -#, fuzzy -msgid "" -"Note that in general for percent-encoded POST operations, query strings must " -"be quoted using :func:`urllib.parse.urlencode`. For example, to send " -"``name=Guy Steele, Jr.``::" -msgstr "" -"請注意,通常對於百分比編碼的 POST 操作,查詢字串必須使用 :func:`urllib.parse." -"urlencode` 引用。例如,發送 ``name=Guy Steele, Jr.``: ::" - -#: ../../faq/library.rst:700 -msgid "" -">>> import urllib.parse\n" -">>> urllib.parse.urlencode({'name': 'Guy Steele, Jr.'})\n" -"'name=Guy+Steele%2C+Jr.'" -msgstr "" -">>> import urllib.parse\n" -">>> urllib.parse.urlencode({'name': 'Guy Steele, Jr.'})\n" -"'name=Guy+Steele%2C+Jr.'" - -#: ../../faq/library.rst:704 -msgid ":ref:`urllib-howto` for extensive examples." -msgstr ":ref:`urllib-howto` 內有大量範例。" - -#: ../../faq/library.rst:708 +#: ../../faq/library.rst:679 msgid "What module should I use to help with generating HTML?" msgstr "我應該使用什麼模組來輔助產生 HTML?" -#: ../../faq/library.rst:712 +#: ../../faq/library.rst:683 #, fuzzy msgid "" "You can find a collection of useful links on the `Web Programming wiki page " @@ -1170,15 +1091,15 @@ msgstr "" "你可以在 \"Web 編寫程式維基頁面 \" 上找到一組有用的鏈接。" -#: ../../faq/library.rst:717 +#: ../../faq/library.rst:688 msgid "How do I send mail from a Python script?" msgstr "如何從 Python 腳本發送郵件?" -#: ../../faq/library.rst:719 +#: ../../faq/library.rst:690 msgid "Use the standard library module :mod:`smtplib`." msgstr "使用標準函式庫模組 :mod:`smtplib`。" -#: ../../faq/library.rst:721 +#: ../../faq/library.rst:692 #, fuzzy msgid "" "Here's a very simple interactive mail sender that uses it. This method will " @@ -1187,7 +1108,7 @@ msgstr "" "這是一個使用它的非常簡單的交互式郵件發件人。此方法適用於任何支援 SMTP 偵聽器" "的主機。: ::" -#: ../../faq/library.rst:724 +#: ../../faq/library.rst:695 msgid "" "import sys, smtplib\n" "\n" @@ -1207,7 +1128,7 @@ msgid "" "server.quit()" msgstr "" -#: ../../faq/library.rst:741 +#: ../../faq/library.rst:712 #, fuzzy msgid "" "A Unix-only alternative uses sendmail. The location of the sendmail program " @@ -1219,7 +1140,7 @@ msgstr "" "時是 \"/usr/lib/sendmail\" ,有時是 \"/usr/sbin/sendmail\" 。 sendmail 手冊頁" "將幫助你。這是一些示例程式碼: ::" -#: ../../faq/library.rst:746 +#: ../../faq/library.rst:717 msgid "" "import os\n" "\n" @@ -1235,18 +1156,18 @@ msgid "" " print(\"Sendmail exit status\", sts)" msgstr "" -#: ../../faq/library.rst:761 +#: ../../faq/library.rst:732 #, fuzzy msgid "How do I avoid blocking in the connect() method of a socket?" msgstr "如何避免阻塞 socket 的 connect() 方法?" -#: ../../faq/library.rst:763 +#: ../../faq/library.rst:734 msgid "" "The :mod:`select` module is commonly used to help with asynchronous I/O on " "sockets." msgstr ":mod:`select` 模組通常用於幫助處理 socket 上的非同步 I/O。" -#: ../../faq/library.rst:766 +#: ../../faq/library.rst:737 #, fuzzy msgid "" "To prevent the TCP connect from blocking, you can set the socket to non-" @@ -1262,7 +1183,7 @@ msgstr "" "誤號 ``.errno``。 ``errno.EINPROGRESS`` 表示連接正在進行中,但尚未完成。不同" "的作業系統將回傳不同的值,因此你將不得不檢查系統回傳的內容。" -#: ../../faq/library.rst:774 +#: ../../faq/library.rst:745 #, fuzzy msgid "" "You can use the :meth:`~socket.socket.connect_ex` method to avoid creating " @@ -1276,7 +1197,7 @@ msgstr "" "EISCONN`` 表示你已連接 - 或者你可以將此 socket 傳遞給 :meth:`select.select` " "檢查它是否可寫。" -#: ../../faq/library.rst:782 +#: ../../faq/library.rst:753 msgid "" "The :mod:`asyncio` module provides a general purpose single-threaded and " "concurrent asynchronous library, which can be used for writing non-blocking " @@ -1287,19 +1208,19 @@ msgstr "" "網路程式碼。第三方 `Twisted `_ 函式庫是一種流行且功能豐" "富的替代方案。" -#: ../../faq/library.rst:790 +#: ../../faq/library.rst:761 msgid "Databases" msgstr "資料庫" -#: ../../faq/library.rst:793 +#: ../../faq/library.rst:764 msgid "Are there any interfaces to database packages in Python?" msgstr "Python 中是否有任何資料庫套件的介面?" -#: ../../faq/library.rst:795 +#: ../../faq/library.rst:766 msgid "Yes." msgstr "有的。" -#: ../../faq/library.rst:797 +#: ../../faq/library.rst:768 #, fuzzy msgid "" "Interfaces to disk-based hashes such as :mod:`DBM ` and :mod:`GDBM " @@ -1311,7 +1232,7 @@ msgstr "" "含在標準 Python 中。還有 :mod:`sqlite3` 模組,它提供了一個輕量級的基於磁盤的" "關係資料庫。" -#: ../../faq/library.rst:802 +#: ../../faq/library.rst:773 #, fuzzy msgid "" "Support for most relational databases is available. See the " @@ -1321,12 +1242,12 @@ msgstr "" "支援大多數關係資料庫。有關詳細資訊,請參閱`DatabaseProgramming 維基頁面 " "`_。" -#: ../../faq/library.rst:808 +#: ../../faq/library.rst:779 #, fuzzy msgid "How do you implement persistent objects in Python?" msgstr "你如何在 Python 中實作持久物件?" -#: ../../faq/library.rst:810 +#: ../../faq/library.rst:781 #, fuzzy msgid "" "The :mod:`pickle` library module solves this in a very general way (though " @@ -1338,21 +1259,21 @@ msgstr "" "如打開的檔案、socket 或窗口之類的東西),而 :mod:`shelve` 庫模組使用 pickle " "和 (g) dbm 建立包含任意 Python 物件的持久映射。" -#: ../../faq/library.rst:817 +#: ../../faq/library.rst:788 msgid "Mathematics and Numerics" msgstr "數學和數值" -#: ../../faq/library.rst:820 +#: ../../faq/library.rst:791 msgid "How do I generate random numbers in Python?" msgstr "如何在 Python 中生成隨機數?" -#: ../../faq/library.rst:822 +#: ../../faq/library.rst:793 msgid "" "The standard module :mod:`random` implements a random number generator. " "Usage is simple::" msgstr "標準模組 :mod:`random` 實作了一個隨機數生成器。用法很簡單: ::" -#: ../../faq/library.rst:825 +#: ../../faq/library.rst:796 msgid "" "import random\n" "random.random()" @@ -1360,43 +1281,123 @@ msgstr "" "import random\n" "random.random()" -#: ../../faq/library.rst:828 +#: ../../faq/library.rst:799 msgid "This returns a random floating-point number in the range [0, 1)." msgstr "這將回傳 [0, 1) 範圍內的隨機浮點數。" -#: ../../faq/library.rst:830 +#: ../../faq/library.rst:801 msgid "" "There are also many other specialized generators in this module, such as:" msgstr "該模組中還有許多其他專用生成器,例如:" -#: ../../faq/library.rst:832 +#: ../../faq/library.rst:803 msgid "``randrange(a, b)`` chooses an integer in the range [a, b)." msgstr "``randrange(a, b)`` 會選擇 [a, b) 範圍內的一個整數。" -#: ../../faq/library.rst:833 +#: ../../faq/library.rst:804 msgid "``uniform(a, b)`` chooses a floating-point number in the range [a, b)." msgstr "``uniform(a, b)`` 會選擇 [a, b) 範圍內的浮點數。" -#: ../../faq/library.rst:834 +#: ../../faq/library.rst:805 msgid "" "``normalvariate(mean, sdev)`` samples the normal (Gaussian) distribution." msgstr "``normalvariate(mean, sdev)`` 對常態(高斯)分佈進行採樣 (sample)。" -#: ../../faq/library.rst:836 +#: ../../faq/library.rst:807 msgid "Some higher-level functions operate on sequences directly, such as:" msgstr "一些更高階的函式會直接對序列進行操作,例如:" -#: ../../faq/library.rst:838 +#: ../../faq/library.rst:809 msgid "``choice(S)`` chooses a random element from a given sequence." msgstr "``choice(S)`` 會從給定序列中選擇一個隨機元素。" -#: ../../faq/library.rst:839 +#: ../../faq/library.rst:810 msgid "``shuffle(L)`` shuffles a list in-place, i.e. permutes it randomly." msgstr "``shuffle(L)`` 會原地 (in-place) 打亂 list,即隨機排列它。" -#: ../../faq/library.rst:841 +#: ../../faq/library.rst:812 msgid "" "There's also a ``Random`` class you can instantiate to create independent " "multiple random number generators." msgstr "" "還有一個 ``Random`` 類別,你可以將它實例化以建立多個獨立的隨機數生成器。" + +#, fuzzy +#~ msgid "" +#~ "It has been suggested that the GIL should be a per-interpreter-state lock " +#~ "rather than truly global; interpreters then wouldn't be able to share " +#~ "objects. Unfortunately, this isn't likely to happen either. It would be " +#~ "a tremendous amount of work, because many object implementations " +#~ "currently have global state. For example, small integers and short " +#~ "strings are cached; these caches would have to be moved to the " +#~ "interpreter state. Other object types have their own free list; these " +#~ "free lists would have to be moved to the interpreter state. And so on." +#~ msgstr "" +#~ "有人建議 GIL 應該是每個直譯器狀態鎖,而不是真正的全局鎖;口譯員將無法共享" +#~ "物件。不幸的是,這也不太可能發生。這將是一項巨大的工作量,因為目前許多物件" +#~ "實作都具有全局狀態。例如,快取小整數和短字串;這些快取必須移至直譯器狀態。" +#~ "其他物件型別有自己的空閒列表;這些空閒列表必須移至直譯器狀態。等等。" + +#, fuzzy +#~ msgid "" +#~ "And I doubt that it can even be done in finite time, because the same " +#~ "problem exists for 3rd party extensions. It is likely that 3rd party " +#~ "extensions are being written at a faster rate than you can convert them " +#~ "to store all their global state in the interpreter state." +#~ msgstr "" +#~ "而且我懷疑它甚至可以在有限的時間內完成,因為第 3 方擴充存在同樣的問題。 " +#~ "3rd 方擴充的編寫速度可能比你轉換它們以將其所有全局狀態存儲在直譯器狀態中的" +#~ "速度更快。" + +#, fuzzy +#~ msgid "" +#~ "And finally, once you have multiple interpreters not sharing any state, " +#~ "what have you gained over running each interpreter in a separate process?" +#~ msgstr "" +#~ "最後,如果你有多個不共享任何狀態的直譯器,那麼在單獨的行程中運行每個直譯器" +#~ "有什麼好處呢?" + +#, fuzzy +#~ msgid "" +#~ "Cameron Laird maintains a useful set of pages about Python web " +#~ "technologies at https://web.archive.org/web/20210224183619/http://phaseit." +#~ "net/claird/comp.lang.python/web_python." +#~ msgstr "" +#~ "Cameron Laird 在 https://web.archive.org/web/20210224183619/http://" +#~ "phaseit.net/claird/comp.lang.python/web_python 維護著一組有用的關於 " +#~ "Python 網路技術的頁面。" + +#~ msgid "How can I mimic CGI form submission (METHOD=POST)?" +#~ msgstr "如何模擬 CGI 表單送出 (submission) (METHOD=POST)?" + +#, fuzzy +#~ msgid "" +#~ "I would like to retrieve web pages that are the result of POSTing a form. " +#~ "Is there existing code that would let me do this easily?" +#~ msgstr "" +#~ "我想檢索作為發布表單結果的網頁。是否有現成的程式碼可以讓我輕鬆地做到這一" +#~ "點?" + +#~ msgid "Yes. Here's a simple example that uses :mod:`urllib.request`::" +#~ msgstr "是的,這是一個 :mod:`urllib.request` 的簡單範例: ::" + +#, fuzzy +#~ msgid "" +#~ "Note that in general for percent-encoded POST operations, query strings " +#~ "must be quoted using :func:`urllib.parse.urlencode`. For example, to " +#~ "send ``name=Guy Steele, Jr.``::" +#~ msgstr "" +#~ "請注意,通常對於百分比編碼的 POST 操作,查詢字串必須使用 :func:`urllib." +#~ "parse.urlencode` 引用。例如,發送 ``name=Guy Steele, Jr.``: ::" + +#~ msgid "" +#~ ">>> import urllib.parse\n" +#~ ">>> urllib.parse.urlencode({'name': 'Guy Steele, Jr.'})\n" +#~ "'name=Guy+Steele%2C+Jr.'" +#~ msgstr "" +#~ ">>> import urllib.parse\n" +#~ ">>> urllib.parse.urlencode({'name': 'Guy Steele, Jr.'})\n" +#~ "'name=Guy+Steele%2C+Jr.'" + +#~ msgid ":ref:`urllib-howto` for extensive examples." +#~ msgstr ":ref:`urllib-howto` 內有大量範例。" diff --git a/faq/programming.po b/faq/programming.po index 7d5dde418c..4a9bd315fb 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-04-25 14:17+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1794,6 +1794,7 @@ msgstr "" "用 :class:`io.StringIO` 物件或 :mod:`array` 模組: ::" #: ../../faq/programming.rst:914 +#, fuzzy msgid "" ">>> import io\n" ">>> s = \"Hello, world\"\n" @@ -1808,12 +1809,12 @@ msgid "" "'Hello, there!'\n" "\n" ">>> import array\n" -">>> a = array.array('u', s)\n" +">>> a = array.array('w', s)\n" ">>> print(a)\n" -"array('u', 'Hello, world')\n" +"array('w', 'Hello, world')\n" ">>> a[0] = 'y'\n" ">>> print(a)\n" -"array('u', 'yello, world')\n" +"array('w', 'yello, world')\n" ">>> a.tounicode()\n" "'yello, world'" msgstr "" diff --git a/glossary.po b/glossary.po index 3f5dd3d9d9..076f333c7b 100644 --- a/glossary.po +++ b/glossary.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,63 +30,40 @@ msgstr "``>>>``" #: ../../glossary.rst:12 msgid "" -"The default Python prompt of the interactive shell. Often seen for code " -"examples which can be executed interactively in the interpreter." +"The default Python prompt of the :term:`interactive` shell. Often seen for " +"code examples which can be executed interactively in the interpreter." msgstr "" -"互動式 shell 的預設 Python 提示字元。常見於能在直譯器中以互動方式被執行的程式" -"碼範例。" +":term:`互動式 ` shell 的預設 Python 提示字元。常見於能在直譯器中" +"以互動方式被執行的程式碼範例。" -#: ../../glossary.rst:14 +#: ../../glossary.rst:15 msgid "``...``" msgstr "``...``" -#: ../../glossary.rst:16 +#: ../../glossary.rst:17 msgid "Can refer to:" msgstr "可以表示:" -#: ../../glossary.rst:18 +#: ../../glossary.rst:19 msgid "" -"The default Python prompt of the interactive shell when entering the code " -"for an indented code block, when within a pair of matching left and right " -"delimiters (parentheses, square brackets, curly braces or triple quotes), or " -"after specifying a decorator." +"The default Python prompt of the :term:`interactive` shell when entering the " +"code for an indented code block, when within a pair of matching left and " +"right delimiters (parentheses, square brackets, curly braces or triple " +"quotes), or after specifying a decorator." msgstr "" "在一個被縮排的程式碼區塊、在一對匹配的左右定界符(delimiter,例如括號、方括" "號、花括號或三引號)內部,或是在指定一個裝飾器 (decorator) 之後,要輸入程式碼" -"時,互動式 shell 顯示的預設 Python 提示字元。" +"時,:term:`互動式 ` shell 顯示的預設 Python 提示字元。" -#: ../../glossary.rst:23 +#: ../../glossary.rst:24 msgid "The :const:`Ellipsis` built-in constant." msgstr "內建常數 :const:`Ellipsis`。" -#: ../../glossary.rst:24 -msgid "2to3" -msgstr "2to3" - -#: ../../glossary.rst:26 -msgid "" -"A tool that tries to convert Python 2.x code to Python 3.x code by handling " -"most of the incompatibilities which can be detected by parsing the source " -"and traversing the parse tree." -msgstr "" -"一個試著將 Python 2.x 程式碼轉換為 Python 3.x 程式碼的工具,它是透過處理大部" -"分的不相容性來達成此目的,而這些不相容性能夠透過剖析原始碼和遍歷剖析樹而被檢" -"測出來。" - -#: ../../glossary.rst:30 -msgid "" -"2to3 is available in the standard library as :mod:`lib2to3`; a standalone " -"entry point is provided as :file:`Tools/scripts/2to3`. See :ref:`2to3-" -"reference`." -msgstr "" -"2to3 在可以標準函式庫中以 :mod:`lib2to3` 被使用;它提供了一個獨立的入口點," -"在 :file:`Tools/scripts/2to3`。請參閱 :ref:`2to3-reference`。" - -#: ../../glossary.rst:33 +#: ../../glossary.rst:25 msgid "abstract base class" msgstr "abstract base class(抽象基底類別)" -#: ../../glossary.rst:35 +#: ../../glossary.rst:27 msgid "" "Abstract base classes complement :term:`duck-typing` by providing a way to " "define interfaces when other techniques like :func:`hasattr` would be clumsy " @@ -109,11 +86,11 @@ msgstr "" "模組)及 import 尋檢器和載入器(在 :mod:`importlib.abc` 模組)。你可以使用 :" "mod:`abc` 模組建立自己的 ABC。" -#: ../../glossary.rst:46 +#: ../../glossary.rst:38 msgid "annotation" msgstr "annotation(註釋)" -#: ../../glossary.rst:48 +#: ../../glossary.rst:40 msgid "" "A label associated with a variable, a class attribute or a function " "parameter or return value, used by convention as a :term:`type hint`." @@ -121,7 +98,7 @@ msgstr "" "一個與變數、class 屬性、函式的參數或回傳值相關聯的標籤。照慣例,它被用來作" "為 :term:`type hint`\\ (型別提示)。" -#: ../../glossary.rst:52 +#: ../../glossary.rst:44 msgid "" "Annotations of local variables cannot be accessed at runtime, but " "annotations of global variables, class attributes, and functions are stored " @@ -132,7 +109,7 @@ msgstr "" "的註解,會分別被儲存在模組、class 和函式的 :attr:`__annotations__` 特殊屬性" "中。" -#: ../../glossary.rst:58 +#: ../../glossary.rst:50 msgid "" "See :term:`variable annotation`, :term:`function annotation`, :pep:`484` " "and :pep:`526`, which describe this functionality. Also see :ref:" @@ -142,11 +119,11 @@ msgstr "" "和 :pep:`526`,這些章節皆有此功能的說明。關於註釋的最佳實踐方法也請參閱 :ref:" "`annotations-howto`。" -#: ../../glossary.rst:62 +#: ../../glossary.rst:54 msgid "argument" msgstr "argument(引數)" -#: ../../glossary.rst:64 +#: ../../glossary.rst:56 msgid "" "A value passed to a :term:`function` (or :term:`method`) when calling the " "function. There are two kinds of argument:" @@ -154,7 +131,7 @@ msgstr "" "呼叫函式時被傳遞給 :term:`function`\\ (或 :term:`method`\\ )的值。引數有兩" "種:" -#: ../../glossary.rst:67 +#: ../../glossary.rst:59 msgid "" ":dfn:`keyword argument`: an argument preceded by an identifier (e.g. " "``name=``) in a function call or passed as a value in a dictionary preceded " @@ -166,13 +143,13 @@ msgstr "" "遞的引數。例如,``3`` 和 ``5`` 都是以下 :func:`complex` 呼叫中的關鍵字引" "數: ::" -#: ../../glossary.rst:72 +#: ../../glossary.rst:64 msgid "" "complex(real=3, imag=5)\n" "complex(**{'real': 3, 'imag': 5})" msgstr "" -#: ../../glossary.rst:75 +#: ../../glossary.rst:67 msgid "" ":dfn:`positional argument`: an argument that is not a keyword argument. " "Positional arguments can appear at the beginning of an argument list and/or " @@ -183,13 +160,13 @@ msgstr "" "引數列表的起始處出現,和(或)作為 ``*`` 之後的 :term:`iterable`\\ (可疊代物" "件)中的元素被傳遞。例如,``3`` 和 ``5`` 都是以下呼叫中的位置引數: ::" -#: ../../glossary.rst:81 +#: ../../glossary.rst:73 msgid "" "complex(3, 5)\n" "complex(*(3, 5))" msgstr "" -#: ../../glossary.rst:84 +#: ../../glossary.rst:76 msgid "" "Arguments are assigned to the named local variables in a function body. See " "the :ref:`calls` section for the rules governing this assignment. " @@ -200,7 +177,7 @@ msgstr "" "\\ :ref:`calls`\\ 章節。在語法上,任何運算式都可以被用來表示一個引數;其評估" "值會被指定給區域變數。" -#: ../../glossary.rst:89 +#: ../../glossary.rst:81 msgid "" "See also the :term:`parameter` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " @@ -209,11 +186,11 @@ msgstr "" "另請參閱術語表的 :term:`parameter`\\ (參數)條目、常見問題中的\\ :ref:`引數" "和參數之間的差異 `,以及 :pep:`362`。" -#: ../../glossary.rst:92 +#: ../../glossary.rst:84 msgid "asynchronous context manager" msgstr "asynchronous context manager(非同步情境管理器)" -#: ../../glossary.rst:94 +#: ../../glossary.rst:86 msgid "" "An object which controls the environment seen in an :keyword:`async with` " "statement by defining :meth:`~object.__aenter__` and :meth:`~object." @@ -223,11 +200,11 @@ msgstr "" "meth:`~object.__aenter__` 和 :meth:`~object.__aexit__` method(方法)來控制" "的。由 :pep:`492` 引入。" -#: ../../glossary.rst:97 +#: ../../glossary.rst:89 msgid "asynchronous generator" msgstr "asynchronous generator(非同步產生器)" -#: ../../glossary.rst:99 +#: ../../glossary.rst:91 msgid "" "A function which returns an :term:`asynchronous generator iterator`. It " "looks like a coroutine function defined with :keyword:`async def` except " @@ -239,7 +216,7 @@ msgstr "" "function),但不同的是它包含了 :keyword:`yield` 運算式,能生成一系列可用於 :" "keyword:`async for` 迴圈的值。" -#: ../../glossary.rst:104 +#: ../../glossary.rst:96 msgid "" "Usually refers to an asynchronous generator function, but may refer to an " "*asynchronous generator iterator* in some contexts. In cases where the " @@ -249,7 +226,7 @@ msgstr "" "同步產生器疊代器 (asynchronous generator iterator)*。萬一想表達的意思不夠清" "楚,那就使用完整的術語,以避免歧義。" -#: ../../glossary.rst:108 +#: ../../glossary.rst:100 msgid "" "An asynchronous generator function may contain :keyword:`await` expressions " "as well as :keyword:`async for`, and :keyword:`async with` statements." @@ -257,16 +234,16 @@ msgstr "" "一個非同步產生器函式可能包含 :keyword:`await` 運算式,以及 :keyword:`async " "for` 和 :keyword:`async with` 陳述式。" -#: ../../glossary.rst:111 +#: ../../glossary.rst:103 msgid "asynchronous generator iterator" msgstr "asynchronous generator iterator(非同步產生器疊代器)" -#: ../../glossary.rst:113 +#: ../../glossary.rst:105 msgid "An object created by a :term:`asynchronous generator` function." msgstr "" "一個由 :term:`asynchronous generator`\\ (非同步產生器)函式所建立的物件。" -#: ../../glossary.rst:115 +#: ../../glossary.rst:107 msgid "" "This is an :term:`asynchronous iterator` which when called using the :meth:" "`~object.__anext__` method returns an awaitable object which will execute " @@ -278,7 +255,7 @@ msgstr "" "object),該物件將執行非同步產生器的函式主體,直到遇到下一個 :keyword:`yield` " "運算式。" -#: ../../glossary.rst:120 +#: ../../glossary.rst:112 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " "location execution state (including local variables and pending try-" @@ -291,11 +268,11 @@ msgstr "" "__anext__` 回傳的可等待物件有效地回復時,它會從停止的地方繼續執行。請參閱 :" "pep:`492` 和 :pep:`525`。" -#: ../../glossary.rst:125 +#: ../../glossary.rst:117 msgid "asynchronous iterable" msgstr "asynchronous iterable(非同步可疊代物件)" -#: ../../glossary.rst:127 +#: ../../glossary.rst:119 msgid "" "An object, that can be used in an :keyword:`async for` statement. Must " "return an :term:`asynchronous iterator` from its :meth:`~object.__aiter__` " @@ -305,11 +282,11 @@ msgstr "" "`~object.__aiter__` method 回傳一個 :term:`asynchronous iterator`\\ (非同步" "疊代器)。由 :pep:`492` 引入。" -#: ../../glossary.rst:130 +#: ../../glossary.rst:122 msgid "asynchronous iterator" msgstr "asynchronous iterator(非同步疊代器)" -#: ../../glossary.rst:132 +#: ../../glossary.rst:124 msgid "" "An object that implements the :meth:`~object.__aiter__` and :meth:`~object." "__anext__` methods. :meth:`~object.__anext__` must return an :term:" @@ -323,11 +300,11 @@ msgstr "" "method 所回傳的可等待物件,直到它引發 :exc:`StopAsyncIteration` 例外。由 :" "pep:`492` 引入。" -#: ../../glossary.rst:137 +#: ../../glossary.rst:129 msgid "attribute" msgstr "attribute(屬性)" -#: ../../glossary.rst:139 +#: ../../glossary.rst:131 msgid "" "A value associated with an object which is usually referenced by name using " "dotted expressions. For example, if an object *o* has an attribute *a* it " @@ -336,7 +313,7 @@ msgstr "" "一個與某物件相關聯的值,該值大多能透過使用點分隔運算式 (dotted expression) 的" "名稱被參照。例如,如果物件 *o* 有一個屬性 *a*,則該屬性能以 *o.a* 被參照。" -#: ../../glossary.rst:144 +#: ../../glossary.rst:136 msgid "" "It is possible to give an object an attribute whose name is not an " "identifier as defined by :ref:`identifiers`, for example using :func:" @@ -348,11 +325,11 @@ msgstr "" "別符 (identifier) 的屬性是有可能的,例如使用 :func:`setattr`。像這樣的屬性將" "無法使用點分隔運算式來存取,而是需要使用 :func:`getattr` 來取得它。" -#: ../../glossary.rst:149 +#: ../../glossary.rst:141 msgid "awaitable" msgstr "awaitable(可等待物件)" -#: ../../glossary.rst:151 +#: ../../glossary.rst:143 msgid "" "An object that can be used in an :keyword:`await` expression. Can be a :" "term:`coroutine` or an object with an :meth:`~object.__await__` method. See " @@ -362,11 +339,11 @@ msgstr "" "`coroutine`\\ (協程),或是一個有 :meth:`~object.__await__` method 的物件。" "另請參閱 :pep:`492`。" -#: ../../glossary.rst:154 +#: ../../glossary.rst:146 msgid "BDFL" msgstr "BDFL" -#: ../../glossary.rst:156 +#: ../../glossary.rst:148 msgid "" "Benevolent Dictator For Life, a.k.a. `Guido van Rossum `_, Python's creator." @@ -374,11 +351,11 @@ msgstr "" "Benevolent Dictator For Life(終身仁慈獨裁者),又名 `Guido van Rossum " "`_,Python 的創造者。" -#: ../../glossary.rst:158 +#: ../../glossary.rst:150 msgid "binary file" msgstr "binary file(二進位檔案)" -#: ../../glossary.rst:160 +#: ../../glossary.rst:152 msgid "" "A :term:`file object` able to read and write :term:`bytes-like objects " "`. Examples of binary files are files opened in binary " @@ -392,7 +369,7 @@ msgstr "" "`、:data:`sys.stdout.buffer `,以及 :class:`io." "BytesIO` 和 :class:`gzip.GzipFile` 實例。" -#: ../../glossary.rst:167 +#: ../../glossary.rst:159 msgid "" "See also :term:`text file` for a file object able to read and write :class:" "`str` objects." @@ -400,11 +377,11 @@ msgstr "" "另請參閱 :term:`text file`\\ (文字檔案),它是一個能夠讀取和寫入 :class:" "`str` 物件的檔案物件。" -#: ../../glossary.rst:169 +#: ../../glossary.rst:161 msgid "borrowed reference" msgstr "borrowed reference(借用參照)" -#: ../../glossary.rst:171 +#: ../../glossary.rst:163 msgid "" "In Python's C API, a borrowed reference is a reference to an object, where " "the code using the object does not own the reference. It becomes a dangling " @@ -416,7 +393,7 @@ msgstr "" "如,一次垃圾回收 (garbage collection) 可以移除對物件的最後一個 :term:`strong " "reference`\\ (強參照),而將該物件銷毀。" -#: ../../glossary.rst:177 +#: ../../glossary.rst:169 msgid "" "Calling :c:func:`Py_INCREF` on the :term:`borrowed reference` is recommended " "to convert it to a :term:`strong reference` in-place, except when the object " @@ -429,11 +406,11 @@ msgstr "" "借用參照之前被銷毀。:c:func:`Py_NewRef` 函式可用於建立一個新的 :term:`strong " "reference`。" -#: ../../glossary.rst:182 +#: ../../glossary.rst:174 msgid "bytes-like object" msgstr "bytes-like object(類位元組串物件)" -#: ../../glossary.rst:184 +#: ../../glossary.rst:176 msgid "" "An object that supports the :ref:`bufferobjects` and can export a C-:term:" "`contiguous` buffer. This includes all :class:`bytes`, :class:`bytearray`, " @@ -447,7 +424,7 @@ msgstr "" "物件,以及許多常見的 :class:`memoryview` 物件。類位元組串物件可用於處理二進位" "資料的各種運算;這些運算包括壓縮、儲存至二進位檔案和透過 socket(插座)發送。" -#: ../../glossary.rst:191 +#: ../../glossary.rst:183 msgid "" "Some operations need the binary data to be mutable. The documentation often " "refers to these as \"read-write bytes-like objects\". Example mutable " @@ -462,11 +439,11 @@ msgstr "" "的類位元組串物件」)中;這些物件包括 :class:`bytes`,以及 :class:`bytes` 物件" "的 :class:`memoryview`。" -#: ../../glossary.rst:199 +#: ../../glossary.rst:191 msgid "bytecode" msgstr "bytecode(位元組碼)" -#: ../../glossary.rst:201 +#: ../../glossary.rst:193 msgid "" "Python source code is compiled into bytecode, the internal representation of " "a Python program in the CPython interpreter. The bytecode is also cached in " @@ -485,18 +462,18 @@ msgstr "" "上是無法在不同的 Python 虛擬機器之間運作的,也不能在不同版本的 Python 之間保" "持穩定。" -#: ../../glossary.rst:211 +#: ../../glossary.rst:203 msgid "" "A list of bytecode instructions can be found in the documentation for :ref:" "`the dis module `." msgstr "" "位元組碼的指令列表可以在 :ref:`dis 模組 `\\ 的說明文件中找到。" -#: ../../glossary.rst:213 +#: ../../glossary.rst:205 msgid "callable" msgstr "callable(可呼叫物件)" -#: ../../glossary.rst:215 +#: ../../glossary.rst:207 msgid "" "A callable is an object that can be called, possibly with a set of arguments " "(see :term:`argument`), with the following syntax::" @@ -504,11 +481,11 @@ msgstr "" "一個 callable 是可以被呼叫的物件,呼叫時可能以下列形式帶有一組引數(請見 :" "term:`argument`): ::" -#: ../../glossary.rst:218 +#: ../../glossary.rst:210 msgid "callable(argument1, argument2, argumentN)" msgstr "" -#: ../../glossary.rst:220 +#: ../../glossary.rst:212 msgid "" "A :term:`function`, and by extension a :term:`method`, is a callable. An " "instance of a class that implements the :meth:`~object.__call__` method is " @@ -517,22 +494,22 @@ msgstr "" "一個 :term:`function` 與其延伸的 :term:`method` 都是 callable。一個有實作 :" "meth:`~object.__call__` 方法的 class 之實例也是個 callable。" -#: ../../glossary.rst:223 +#: ../../glossary.rst:215 msgid "callback" msgstr "callback(回呼)" -#: ../../glossary.rst:225 +#: ../../glossary.rst:217 msgid "" "A subroutine function which is passed as an argument to be executed at some " "point in the future." msgstr "" "作為引數被傳遞的一個副程式 (subroutine) 函式,會在未來的某個時間點被執行。" -#: ../../glossary.rst:227 +#: ../../glossary.rst:219 msgid "class" msgstr "class(類別)" -#: ../../glossary.rst:229 +#: ../../glossary.rst:221 msgid "" "A template for creating user-defined objects. Class definitions normally " "contain method definitions which operate on instances of the class." @@ -540,11 +517,11 @@ msgstr "" "一個用於建立使用者定義物件的模板。Class 的定義通常會包含 method 的定義,這些 " "method 可以在 class 的實例上進行操作。" -#: ../../glossary.rst:232 +#: ../../glossary.rst:224 msgid "class variable" msgstr "class variable(類別變數)" -#: ../../glossary.rst:234 +#: ../../glossary.rst:226 msgid "" "A variable defined in a class and intended to be modified only at class " "level (i.e., not in an instance of the class)." @@ -552,11 +529,11 @@ msgstr "" "一個在 class 中被定義,且應該只能在 class 層次(意即不是在 class 的實例中)被" "修改的變數。" -#: ../../glossary.rst:236 +#: ../../glossary.rst:228 msgid "complex number" msgstr "complex number(複數)" -#: ../../glossary.rst:238 +#: ../../glossary.rst:230 msgid "" "An extension of the familiar real number system in which all numbers are " "expressed as a sum of a real part and an imaginary part. Imaginary numbers " @@ -576,11 +553,11 @@ msgstr "" "相當進階的數學功能。如果你沒有察覺到對它們的需求,那麼幾乎能確定你可以安全地" "忽略它們。" -#: ../../glossary.rst:248 +#: ../../glossary.rst:240 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../glossary.rst:250 +#: ../../glossary.rst:242 msgid "" "An object which controls the environment seen in a :keyword:`with` statement " "by defining :meth:`~object.__enter__` and :meth:`~object.__exit__` methods. " @@ -590,11 +567,11 @@ msgstr "" "`~object.__enter__` 和 :meth:`~object.__exit__` method 來控制的。請參閱 :pep:" "`343`。" -#: ../../glossary.rst:253 +#: ../../glossary.rst:245 msgid "context variable" msgstr "context variable(情境變數)" -#: ../../glossary.rst:255 +#: ../../glossary.rst:247 msgid "" "A variable which can have different values depending on its context. This is " "similar to Thread-Local Storage in which each execution thread may have a " @@ -609,11 +586,11 @@ msgstr "" "任務 (concurrent asynchronous task) 中,對於變數狀態的追蹤。請參閱 :mod:" "`contextvars`。" -#: ../../glossary.rst:262 +#: ../../glossary.rst:254 msgid "contiguous" msgstr "contiguous(連續的)" -#: ../../glossary.rst:266 +#: ../../glossary.rst:258 msgid "" "A buffer is considered contiguous exactly if it is either *C-contiguous* or " "*Fortran contiguous*. Zero-dimensional buffers are C and Fortran " @@ -630,11 +607,11 @@ msgstr "" "的順序訪問各個項目時,最後一個索引的變化最快。然而,在 Fortran contiguous 陣" "列中,第一個索引的變化最快。" -#: ../../glossary.rst:274 +#: ../../glossary.rst:266 msgid "coroutine" msgstr "coroutine(協程)" -#: ../../glossary.rst:276 +#: ../../glossary.rst:268 msgid "" "Coroutines are a more generalized form of subroutines. Subroutines are " "entered at one point and exited at another point. Coroutines can be " @@ -645,11 +622,11 @@ msgstr "" "在另一個時間點被退出。協程可以在許多不同的時間點被進入、退出和回復。它們能夠" "以 :keyword:`async def` 陳述式被實作。另請參閱 :pep:`492`。" -#: ../../glossary.rst:281 +#: ../../glossary.rst:273 msgid "coroutine function" msgstr "coroutine function(協程函式)" -#: ../../glossary.rst:283 +#: ../../glossary.rst:275 msgid "" "A function which returns a :term:`coroutine` object. A coroutine function " "may be defined with the :keyword:`async def` statement, and may contain :" @@ -660,11 +637,11 @@ msgstr "" "`async def` 陳述式被定義,並可能會包含 :keyword:`await`、:keyword:`async " "for` 和 :keyword:`async with` 關鍵字。這些關鍵字由 :pep:`492` 引入。" -#: ../../glossary.rst:288 +#: ../../glossary.rst:280 msgid "CPython" msgstr "CPython" -#: ../../glossary.rst:290 +#: ../../glossary.rst:282 msgid "" "The canonical implementation of the Python programming language, as " "distributed on `python.org `_. The term \"CPython\" " @@ -675,11 +652,11 @@ msgstr "" "`_ 上。「CPython」這個術語在必要時被使用,以區分此實" "作與其它語言的實作,例如 Jython 或 IronPython。" -#: ../../glossary.rst:294 +#: ../../glossary.rst:286 msgid "decorator" msgstr "decorator(裝飾器)" -#: ../../glossary.rst:296 +#: ../../glossary.rst:288 msgid "" "A function returning another function, usually applied as a function " "transformation using the ``@wrapper`` syntax. Common examples for " @@ -689,13 +666,13 @@ msgstr "" "式的變換 (function transformation)。裝飾器的常見範例是 :func:`classmethod` " "和 :func:`staticmethod`。" -#: ../../glossary.rst:300 +#: ../../glossary.rst:292 msgid "" "The decorator syntax is merely syntactic sugar, the following two function " "definitions are semantically equivalent::" msgstr "裝飾器語法只是語法糖。以下兩個函式定義在語義上是等效的: ::" -#: ../../glossary.rst:303 +#: ../../glossary.rst:295 msgid "" "def f(arg):\n" " ...\n" @@ -713,7 +690,7 @@ msgstr "" "def f(arg):\n" " ..." -#: ../../glossary.rst:311 +#: ../../glossary.rst:303 msgid "" "The same concept exists for classes, but is less commonly used there. See " "the documentation for :ref:`function definitions ` and :ref:`class " @@ -722,11 +699,11 @@ msgstr "" "Class 也存在相同的概念,但在那裡比較不常用。關於裝飾器的更多內容,請參閱\\ :" "ref:`函式定義 `\\ 和 :ref:`class 定義 `\\ 的說明文件。" -#: ../../glossary.rst:314 +#: ../../glossary.rst:306 msgid "descriptor" msgstr "descriptor(描述器)" -#: ../../glossary.rst:316 +#: ../../glossary.rst:308 msgid "" "Any object which defines the methods :meth:`~object.__get__`, :meth:`~object." "__set__`, or :meth:`~object.__delete__`. When a class attribute is a " @@ -746,7 +723,7 @@ msgstr "" "們是許多功能的基礎,這些功能包括函式、method、屬性 (property)、class method、" "靜態 method,以及對 super class(父類別)的參照。" -#: ../../glossary.rst:327 +#: ../../glossary.rst:319 msgid "" "For more information about descriptors' methods, see :ref:`descriptors` or " "the :ref:`Descriptor How To Guide `." @@ -754,11 +731,11 @@ msgstr "" "關於描述器 method 的更多資訊,請參閱\\ :ref:`descriptors`\\ 或\\ :ref:`描述器" "使用指南 `。" -#: ../../glossary.rst:329 +#: ../../glossary.rst:321 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../glossary.rst:331 +#: ../../glossary.rst:323 msgid "" "An associative array, where arbitrary keys are mapped to values. The keys " "can be any object with :meth:`~object.__hash__` and :meth:`~object.__eq__` " @@ -768,11 +745,11 @@ msgstr "" "有 :meth:`~object.__hash__` 和 :meth:`~object.__eq__` method 的物件。在 Perl " "中被稱為雜湊 (hash)。" -#: ../../glossary.rst:335 +#: ../../glossary.rst:327 msgid "dictionary comprehension" msgstr "dictionary comprehension(字典綜合運算)" -#: ../../glossary.rst:337 +#: ../../glossary.rst:329 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a dictionary with the results. ``results = {n: n ** 2 for n in " @@ -783,11 +760,11 @@ msgstr "" "字典回傳。``results = {n: n ** 2 for n in range(10)}`` 會產生一個字典,它包含" "了鍵 ``n`` 映射到值 ``n ** 2``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:341 +#: ../../glossary.rst:333 msgid "dictionary view" msgstr "dictionary view(字典檢視)" -#: ../../glossary.rst:343 +#: ../../glossary.rst:335 msgid "" "The objects returned from :meth:`dict.keys`, :meth:`dict.values`, and :meth:" "`dict.items` are called dictionary views. They provide a dynamic view on the " @@ -800,11 +777,11 @@ msgstr "" "反映這些變動。若要強制將字典檢視轉為完整的 list(串列),須使用 " "``list(dictview)``。請參閱\\ :ref:`dict-views`。" -#: ../../glossary.rst:349 +#: ../../glossary.rst:341 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../glossary.rst:351 +#: ../../glossary.rst:343 msgid "" "A string literal which appears as the first expression in a class, function " "or module. While ignored when the suite is executed, it is recognized by " @@ -817,11 +794,11 @@ msgstr "" "__doc__` 屬性中。由於說明字串可以透過內省 (introspection) 來瀏覽,因此它是物" "件的說明文件存放的標準位置。" -#: ../../glossary.rst:357 +#: ../../glossary.rst:349 msgid "duck-typing" msgstr "duck-typing(鴨子型別)" -#: ../../glossary.rst:359 +#: ../../glossary.rst:351 msgid "" "A programming style which does not look at an object's type to determine if " "it has the right interface; instead, the method or attribute is simply " @@ -842,11 +819,11 @@ msgstr "" "來補充。)然而,它通常會採用 :func:`hasattr` 測試,或是 :term:`EAFP` 程式設計" "風格。" -#: ../../glossary.rst:368 +#: ../../glossary.rst:360 msgid "EAFP" msgstr "EAFP" -#: ../../glossary.rst:370 +#: ../../glossary.rst:362 msgid "" "Easier to ask for forgiveness than permission. This common Python coding " "style assumes the existence of valid keys or attributes and catches " @@ -861,11 +838,11 @@ msgstr "" "keyword:`except` 陳述式。該技術與許多其他語言(例如 C)常見的 :term:`LBYL` 風" "格形成了對比。" -#: ../../glossary.rst:376 +#: ../../glossary.rst:368 msgid "expression" msgstr "expression(運算式)" -#: ../../glossary.rst:378 +#: ../../glossary.rst:370 msgid "" "A piece of syntax which can be evaluated to some value. In other words, an " "expression is an accumulation of expression elements like literals, names, " @@ -881,11 +858,11 @@ msgstr "" "(陳述式)不能被用作運算式,例如 :keyword:`while`。賦值 (assignment) 也是陳述" "式,而不是運算式。" -#: ../../glossary.rst:385 +#: ../../glossary.rst:377 msgid "extension module" msgstr "extension module(擴充模組)" -#: ../../glossary.rst:387 +#: ../../glossary.rst:379 msgid "" "A module written in C or C++, using Python's C API to interact with the core " "and with user code." @@ -893,11 +870,11 @@ msgstr "" "一個以 C 或 C++ 編寫的模組,它使用 Python 的 C API 來與核心及使用者程式碼進行" "互動。" -#: ../../glossary.rst:389 +#: ../../glossary.rst:381 msgid "f-string" msgstr "f-string(f 字串)" -#: ../../glossary.rst:391 +#: ../../glossary.rst:383 msgid "" "String literals prefixed with ``'f'`` or ``'F'`` are commonly called \"f-" "strings\" which is short for :ref:`formatted string literals `. " @@ -906,11 +883,11 @@ msgstr "" "以 ``'f'`` 或 ``'F'`` 為前綴的字串文本通常被稱為「f 字串」,它是\\ :ref:`格式" "化的字串文本 `\\ 的縮寫。另請參閱 :pep:`498`。" -#: ../../glossary.rst:394 +#: ../../glossary.rst:386 msgid "file object" msgstr "file object(檔案物件)" -#: ../../glossary.rst:396 +#: ../../glossary.rst:388 msgid "" "An object exposing a file-oriented API (with methods such as :meth:`!read` " "or :meth:`!write`) to an underlying resource. Depending on the way it was " @@ -925,7 +902,7 @@ msgstr "" "衝區、socket(插座)、管線 (pipe) 等)的存取。檔案物件也被稱為\\ :dfn:`類檔案" "物件 (file-like object)` 或\\ :dfn:`串流 (stream)`。" -#: ../../glossary.rst:404 +#: ../../glossary.rst:396 msgid "" "There are actually three categories of file objects: raw :term:`binary files " "`, buffered :term:`binary files ` and :term:`text " @@ -937,19 +914,19 @@ msgstr "" "term:`二進位檔案 `\\ 和\\ :term:`文字檔案 `。它們的介" "面在 :mod:`io` 模組中被定義。建立檔案物件的標準方法是使用 :func:`open` 函式。" -#: ../../glossary.rst:409 +#: ../../glossary.rst:401 msgid "file-like object" msgstr "file-like object(類檔案物件)" -#: ../../glossary.rst:411 +#: ../../glossary.rst:403 msgid "A synonym for :term:`file object`." msgstr ":term:`file object`\\ (檔案物件)的同義字。" -#: ../../glossary.rst:412 +#: ../../glossary.rst:404 msgid "filesystem encoding and error handler" msgstr "filesystem encoding and error handler(檔案系統編碼和錯誤處理函式)" -#: ../../glossary.rst:414 +#: ../../glossary.rst:406 msgid "" "Encoding and error handler used by Python to decode bytes from the operating " "system and encode Unicode to the operating system." @@ -957,7 +934,7 @@ msgstr "" "Python 所使用的一種編碼和錯誤處理函式,用來解碼來自作業系統的位元組,以及將 " "Unicode 編碼到作業系統。" -#: ../../glossary.rst:417 +#: ../../glossary.rst:409 msgid "" "The filesystem encoding must guarantee to successfully decode all bytes " "below 128. If the file system encoding fails to provide this guarantee, API " @@ -966,7 +943,7 @@ msgstr "" "檔案系統編碼必須保證能成功解碼所有小於 128 的位元組。如果檔案系統編碼無法提供" "此保證,則 API 函式會引發 :exc:`UnicodeError`。" -#: ../../glossary.rst:421 +#: ../../glossary.rst:413 msgid "" "The :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors` functions can be used to get the filesystem " @@ -975,7 +952,7 @@ msgstr "" ":func:`sys.getfilesystemencoding` 和 :func:`sys.getfilesystemencodeerrors` 函" "式可用於取得檔案系統編碼和錯誤處理函式。" -#: ../../glossary.rst:425 +#: ../../glossary.rst:417 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " "startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." @@ -987,22 +964,22 @@ msgstr "" "member:`~PyConfig.filesystem_encoding`,以及 :c:type:`PyConfig` 的成員 :c:" "member:`~PyConfig.filesystem_errors`。" -#: ../../glossary.rst:430 +#: ../../glossary.rst:422 msgid "See also the :term:`locale encoding`." msgstr "另請參閱 :term:`locale encoding`\\ (區域編碼)。" -#: ../../glossary.rst:431 +#: ../../glossary.rst:423 msgid "finder" msgstr "finder(尋檢器)" -#: ../../glossary.rst:433 +#: ../../glossary.rst:425 msgid "" "An object that tries to find the :term:`loader` for a module that is being " "imported." msgstr "" "一個物件,它會嘗試為正在被 import 的模組尋找 :term:`loader`\\ (載入器)。" -#: ../../glossary.rst:436 +#: ../../glossary.rst:428 msgid "" "There are two types of finder: :term:`meta path finders ` " "for use with :data:`sys.meta_path`, and :term:`path entry finders ` 會使用 :data:`sys.meta_path`,而\\ :term:`路徑項目尋檢器 (path " "entry finder) ` 會使用 :data:`sys.path_hooks`。" -#: ../../glossary.rst:440 +#: ../../glossary.rst:432 msgid "See :ref:`importsystem` and :mod:`importlib` for much more detail." msgstr "請參閱 :ref:`importsystem` 和 :mod:`importlib` 以了解更多細節。" -#: ../../glossary.rst:441 +#: ../../glossary.rst:433 msgid "floor division" msgstr "floor division(向下取整除法)" -#: ../../glossary.rst:443 +#: ../../glossary.rst:435 msgid "" "Mathematical division that rounds down to nearest integer. The floor " "division operator is ``//``. For example, the expression ``11 // 4`` " @@ -1033,11 +1010,23 @@ msgstr "" "``2.75`` 不同。請注意,``(-11) // 4`` 的結果是 ``-3``,因為是 ``-2.75`` 被\\ " "*向下*\\ 無條件捨去。請參閱 :pep:`238`。" -#: ../../glossary.rst:448 +#: ../../glossary.rst:440 +msgid "free threading" +msgstr "" + +#: ../../glossary.rst:442 +msgid "" +"A threading model where multiple threads can run Python bytecode " +"simultaneously within the same interpreter. This is in contrast to the :" +"term:`global interpreter lock` which allows only one thread to execute " +"Python bytecode at a time. See :pep:`703`." +msgstr "" + +#: ../../glossary.rst:446 msgid "function" msgstr "function(函式)" -#: ../../glossary.rst:450 +#: ../../glossary.rst:448 msgid "" "A series of statements which returns some value to a caller. It can also be " "passed zero or more :term:`arguments ` which may be used in the " @@ -1049,15 +1038,15 @@ msgstr "" "`parameter`\\ (參數)、:term:`method`\\ (方法),以及\\ :ref:`function`\\ " "章節。" -#: ../../glossary.rst:454 +#: ../../glossary.rst:452 msgid "function annotation" msgstr "function annotation(函式註釋)" -#: ../../glossary.rst:456 +#: ../../glossary.rst:454 msgid "An :term:`annotation` of a function parameter or return value." msgstr "函式參數或回傳值的一個 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:458 +#: ../../glossary.rst:456 msgid "" "Function annotations are usually used for :term:`type hints `: " "for example, this function is expected to take two :class:`int` arguments " @@ -1066,7 +1055,7 @@ msgstr "" "函式註釋通常被使用於\\ :term:`型別提示 `:例如,這個函式預期會得到" "兩個 :class:`int` 引數,並會有一個 :class:`int` 回傳值: ::" -#: ../../glossary.rst:463 +#: ../../glossary.rst:461 msgid "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" @@ -1074,11 +1063,11 @@ msgstr "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" -#: ../../glossary.rst:466 +#: ../../glossary.rst:464 msgid "Function annotation syntax is explained in section :ref:`function`." msgstr "函式註釋的語法在\\ :ref:`function`\\ 章節有詳細解釋。" -#: ../../glossary.rst:468 +#: ../../glossary.rst:466 msgid "" "See :term:`variable annotation` and :pep:`484`, which describe this " "functionality. Also see :ref:`annotations-howto` for best practices on " @@ -1087,11 +1076,11 @@ msgstr "" "請參閱 :term:`variable annotation` 和 :pep:`484`,皆有此功能的描述。關於註釋" "的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:472 +#: ../../glossary.rst:470 msgid "__future__" msgstr "__future__" -#: ../../glossary.rst:474 +#: ../../glossary.rst:472 msgid "" "A :ref:`future statement `, ``from __future__ import ``, " "directs the compiler to compile the current module using syntax or semantics " @@ -1107,7 +1096,7 @@ msgstr "" "import 此模組並對其變數求值,你可以看見一個新的功能是何時首次被新增到此語言" "中,以及它何時將會(或已經)成為預設的功能: ::" -#: ../../glossary.rst:482 +#: ../../glossary.rst:480 msgid "" ">>> import __future__\n" ">>> __future__.division\n" @@ -1117,11 +1106,11 @@ msgstr "" ">>> __future__.division\n" "_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)" -#: ../../glossary.rst:485 +#: ../../glossary.rst:483 msgid "garbage collection" msgstr "garbage collection(垃圾回收)" -#: ../../glossary.rst:487 +#: ../../glossary.rst:485 msgid "" "The process of freeing memory when it is not used anymore. Python performs " "garbage collection via reference counting and a cyclic garbage collector " @@ -1133,11 +1122,11 @@ msgstr "" "垃圾回收器 (cyclic garbage collector) 來完成。垃圾回收器可以使用 :mod:`gc` 模" "組對其進行控制。" -#: ../../glossary.rst:492 ../../glossary.rst:493 +#: ../../glossary.rst:490 ../../glossary.rst:491 msgid "generator" msgstr "generator(產生器)" -#: ../../glossary.rst:495 +#: ../../glossary.rst:493 msgid "" "A function which returns a :term:`generator iterator`. It looks like a " "normal function except that it contains :keyword:`yield` expressions for " @@ -1148,7 +1137,7 @@ msgstr "" "個正常的函式,但不同的是它包含了 :keyword:`yield` 運算式,能產生一系列的值," "這些值可用於 for 迴圈,或是以 :func:`next` 函式,每次檢索其中的一個值。" -#: ../../glossary.rst:500 +#: ../../glossary.rst:498 msgid "" "Usually refers to a generator function, but may refer to a *generator " "iterator* in some contexts. In cases where the intended meaning isn't " @@ -1157,15 +1146,15 @@ msgstr "" "這個術語通常用來表示一個產生器函式,但在某些情境中,也可能是表示\\ *產生器疊" "代器*。萬一想表達的意思不夠清楚,那就使用完整的術語,以避免歧義。" -#: ../../glossary.rst:503 +#: ../../glossary.rst:501 msgid "generator iterator" msgstr "generator iterator(產生器疊代器)" -#: ../../glossary.rst:505 +#: ../../glossary.rst:503 msgid "An object created by a :term:`generator` function." msgstr "一個由 :term:`generator`\\ (產生器)函式所建立的物件。" -#: ../../glossary.rst:507 +#: ../../glossary.rst:505 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " "location execution state (including local variables and pending try-" @@ -1176,32 +1165,33 @@ msgstr "" "中的 try 陳述式)。當\\ *產生器疊代器*\\ 回復時,它會從停止的地方繼續執行(與" "那些每次調用時都要重新開始的函式有所不同)。" -#: ../../glossary.rst:513 ../../glossary.rst:514 +#: ../../glossary.rst:511 ../../glossary.rst:512 msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../glossary.rst:516 +#: ../../glossary.rst:514 msgid "" -"An expression that returns an iterator. It looks like a normal expression " -"followed by a :keyword:`!for` clause defining a loop variable, range, and an " -"optional :keyword:`!if` clause. The combined expression generates values " -"for an enclosing function::" +"An :term:`expression` that returns an :term:`iterator`. It looks like a " +"normal expression followed by a :keyword:`!for` clause defining a loop " +"variable, range, and an optional :keyword:`!if` clause. The combined " +"expression generates values for an enclosing function::" msgstr "" -"一個會回傳疊代器的運算式。它看起來像一個正常的運算式,後面接著一個 :keyword:" -"`!for` 子句,該子句定義了迴圈變數、範圍以及一個選擇性的 :keyword:`!if` 子句。" -"該組合運算式會為外層函式產生多個值: ::" +"一個會回傳\\ :term:`疊代器 `\\ 的\\ :term:`運算式 `。它" +"看起來像一個正常的運算式,後面接著一個 :keyword:`!for` 子句,該子句定義了迴圈" +"變數、範圍以及一個選擇性的 :keyword:`!if` 子句。該組合運算式會為外層函式產生" +"多個值: ::" -#: ../../glossary.rst:521 +#: ../../glossary.rst:519 msgid "" ">>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81\n" "285" msgstr "" -#: ../../glossary.rst:523 +#: ../../glossary.rst:521 msgid "generic function" msgstr "generic function(泛型函式)" -#: ../../glossary.rst:525 +#: ../../glossary.rst:523 msgid "" "A function composed of multiple functions implementing the same operation " "for different types. Which implementation should be used during a call is " @@ -1210,7 +1200,7 @@ msgstr "" "一個由多個函式組成的函式,該函式會對不同的型別實作相同的運算。呼叫期間應該使" "用哪種實作,是由調度演算法 (dispatch algorithm) 來決定。" -#: ../../glossary.rst:529 +#: ../../glossary.rst:527 msgid "" "See also the :term:`single dispatch` glossary entry, the :func:`functools." "singledispatch` decorator, and :pep:`443`." @@ -1218,11 +1208,11 @@ msgstr "" "另請參閱 :term:`single dispatch`\\ (單一調度)術語表條目、:func:`functools." "singledispatch` 裝飾器和 :pep:`443`。" -#: ../../glossary.rst:531 +#: ../../glossary.rst:529 msgid "generic type" msgstr "generic type(泛型型別)" -#: ../../glossary.rst:533 +#: ../../glossary.rst:531 msgid "" "A :term:`type` that can be parameterized; typically a :ref:`container " "class` such as :class:`list` or :class:`dict`. Used for :" @@ -1232,7 +1222,7 @@ msgstr "" "`容器型別 `,像是 :class:`list` 和 :class:`dict`。它被用於" "\\ :term:`型別提示 `\\ 和\\ :term:`註釋 `。" -#: ../../glossary.rst:538 +#: ../../glossary.rst:536 msgid "" "For more details, see :ref:`generic alias types`, :pep:" "`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` module." @@ -1240,19 +1230,19 @@ msgstr "" "詳情請參閱\\ :ref:`泛型別名型別 `、:pep:`483`、:pep:" "`484`、:pep:`585` 和 :mod:`typing` 模組。" -#: ../../glossary.rst:540 +#: ../../glossary.rst:538 msgid "GIL" msgstr "GIL" -#: ../../glossary.rst:542 +#: ../../glossary.rst:540 msgid "See :term:`global interpreter lock`." msgstr "請參閱 :term:`global interpreter lock`\\ (全域直譯器鎖)。" -#: ../../glossary.rst:543 +#: ../../glossary.rst:541 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../glossary.rst:545 +#: ../../glossary.rst:543 msgid "" "The mechanism used by the :term:`CPython` interpreter to assure that only " "one thread executes Python :term:`bytecode` at a time. This simplifies the " @@ -1269,7 +1259,7 @@ msgstr "" "(multi-threaded),但代價是會犧牲掉多處理器的機器能夠提供的一大部分平行性 " "(parallelism)。" -#: ../../glossary.rst:554 +#: ../../glossary.rst:552 msgid "" "However, some extension modules, either standard or third-party, are " "designed so as to release the GIL when doing computationally intensive tasks " @@ -1280,23 +1270,21 @@ msgstr "" "計算密集 (computationally intensive) 的任務時,可以解除 GIL。另外,在執行 I/" "O 時,GIL 總是會被解除。" -#: ../../glossary.rst:559 +#: ../../glossary.rst:557 msgid "" -"Past efforts to create a \"free-threaded\" interpreter (one which locks " -"shared data at a much finer granularity) have not been successful because " -"performance suffered in the common single-processor case. It is believed " -"that overcoming this performance issue would make the implementation much " -"more complicated and therefore costlier to maintain." +"As of Python 3.13, the GIL can be disabled using the :option:`--disable-gil` " +"build configuration. After building Python with this option, code must be " +"run with :option:`-X gil 0 <-X>` or after setting the :envvar:`PYTHON_GIL=0 " +"` environment variable. This feature enables improved " +"performance for multi-threaded applications and makes it easier to use multi-" +"core CPUs efficiently. For more details, see :pep:`703`." msgstr "" -"過去對於建立「無限制執行緒」直譯器(以更高的精細度鎖定共享資料的直譯器)的努" -"力並未成功,因為在一般的單一處理器情況下,效能會有所損失。一般認為,若要克服" -"這個效能問題,會使實作變得複雜許多,進而付出更高的維護成本。" -#: ../../glossary.rst:565 +#: ../../glossary.rst:563 msgid "hash-based pyc" msgstr "hash-based pyc(雜湊架構的 pyc)" -#: ../../glossary.rst:567 +#: ../../glossary.rst:565 msgid "" "A bytecode cache file that uses the hash rather than the last-modified time " "of the corresponding source file to determine its validity. See :ref:`pyc-" @@ -1305,11 +1293,11 @@ msgstr "" "一個位元組碼 (bytecode) 暫存檔,它使用雜湊值而不是對應原始檔案的最後修改時" "間,來確定其有效性。請參閱\\ :ref:`pyc-invalidation`。" -#: ../../glossary.rst:570 +#: ../../glossary.rst:568 msgid "hashable" msgstr "hashable(可雜湊的)" -#: ../../glossary.rst:572 +#: ../../glossary.rst:570 msgid "" "An object is *hashable* if it has a hash value which never changes during " "its lifetime (it needs a :meth:`~object.__hash__` method), and can be " @@ -1321,7 +1309,7 @@ msgstr "" "`~object.__eq__` method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結果為相等的" "多個可雜湊物件,它們必須擁有相同的雜湊值。" -#: ../../glossary.rst:578 +#: ../../glossary.rst:576 msgid "" "Hashability makes an object usable as a dictionary key and a set member, " "because these data structures use the hash value internally." @@ -1329,7 +1317,7 @@ msgstr "" "可雜湊性 (hashability) 使一個物件可用作 dictionary(字典)的鍵和 set(集合)" "的成員,因為這些資料結構都在其內部使用了雜湊值。" -#: ../../glossary.rst:581 +#: ../../glossary.rst:579 msgid "" "Most of Python's immutable built-in objects are hashable; mutable containers " "(such as lists or dictionaries) are not; immutable containers (such as " @@ -1344,11 +1332,11 @@ msgstr "" "則這些物件會被預設為可雜湊的。它們在互相比較時都是不相等的(除非它們與自己比" "較),而它們的雜湊值則是衍生自它們的 :func:`id`。" -#: ../../glossary.rst:588 +#: ../../glossary.rst:586 msgid "IDLE" msgstr "IDLE" -#: ../../glossary.rst:590 +#: ../../glossary.rst:588 msgid "" "An Integrated Development and Learning Environment for Python. :ref:`idle` " "is a basic editor and interpreter environment which ships with the standard " @@ -1358,28 +1346,28 @@ msgstr "" "境)。:ref:`idle` 是一個基本的編輯器和直譯器環境,它和 Python 的標準發行版本" "一起被提供。" -#: ../../glossary.rst:593 +#: ../../glossary.rst:591 msgid "immortal" msgstr "" -#: ../../glossary.rst:595 +#: ../../glossary.rst:593 msgid "" "*Immortal objects* are a CPython implementation detail introduced in :pep:" "`683`." msgstr "" -#: ../../glossary.rst:598 +#: ../../glossary.rst:596 msgid "" "If an object is immortal, its :term:`reference count` is never modified, and " "therefore it is never deallocated while the interpreter is running. For " "example, :const:`True` and :const:`None` are immortal in CPython." msgstr "" -#: ../../glossary.rst:601 +#: ../../glossary.rst:599 msgid "immutable" msgstr "immutable(不可變物件)" -#: ../../glossary.rst:603 +#: ../../glossary.rst:601 msgid "" "An object with a fixed value. Immutable objects include numbers, strings " "and tuples. Such an object cannot be altered. A new object has to be " @@ -1391,11 +1379,11 @@ msgstr "" "能被改變的。如果一個不同的值必須被儲存,則必須建立一個新的物件。它們在需要恆" "定雜湊值的地方,扮演重要的角色,例如 dictionary(字典)中的一個鍵。" -#: ../../glossary.rst:608 +#: ../../glossary.rst:606 msgid "import path" msgstr "import path(引入路徑)" -#: ../../glossary.rst:610 +#: ../../glossary.rst:608 msgid "" "A list of locations (or :term:`path entries `) that are searched " "by the :term:`path based finder` for modules to import. During import, this " @@ -1407,11 +1395,11 @@ msgstr "" "的位置。在 import 期間,此位置列表通常是來自 :data:`sys.path`,但對於子套件 " "(subpackage) 而言,它也可能是來自父套件的 ``__path__`` 屬性。" -#: ../../glossary.rst:615 +#: ../../glossary.rst:613 msgid "importing" msgstr "importing(引入)" -#: ../../glossary.rst:617 +#: ../../glossary.rst:615 msgid "" "The process by which Python code in one module is made available to Python " "code in another module." @@ -1419,11 +1407,11 @@ msgstr "" "一個過程。一個模組中的 Python 程式碼可以透過此過程,被另一個模組中的 Python " "程式碼使用。" -#: ../../glossary.rst:619 +#: ../../glossary.rst:617 msgid "importer" msgstr "importer(引入器)" -#: ../../glossary.rst:621 +#: ../../glossary.rst:619 msgid "" "An object that both finds and loads a module; both a :term:`finder` and :" "term:`loader` object." @@ -1431,28 +1419,29 @@ msgstr "" "一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也是 :term:" "`loader`\\ (載入器)物件。" -#: ../../glossary.rst:623 +#: ../../glossary.rst:621 msgid "interactive" msgstr "interactive(互動的)" -#: ../../glossary.rst:625 +#: ../../glossary.rst:623 msgid "" "Python has an interactive interpreter which means you can enter statements " "and expressions at the interpreter prompt, immediately execute them and see " "their results. Just launch ``python`` with no arguments (possibly by " "selecting it from your computer's main menu). It is a very powerful way to " -"test out new ideas or inspect modules and packages (remember ``help(x)``)." +"test out new ideas or inspect modules and packages (remember ``help(x)``). " +"For more on interactive mode, see :ref:`tut-interac`." msgstr "" "Python 有一個互動式直譯器,這表示你可以在直譯器的提示字元輸入陳述式和運算式," "立即執行它們並且看到它們的結果。只要啟動 ``python``,不需要任何引數(可能藉由" "從你的電腦的主選單選擇它)。這是測試新想法或檢查模塊和包的非常強大的方法(請" -"記住help(x))。" +"記住help(x))。更多互動式模式相關資訊請見 :ref:`tut-interac`。" -#: ../../glossary.rst:631 +#: ../../glossary.rst:630 msgid "interpreted" msgstr "interpreted(直譯的)" -#: ../../glossary.rst:633 +#: ../../glossary.rst:632 msgid "" "Python is an interpreted language, as opposed to a compiled one, though the " "distinction can be blurry because of the presence of the bytecode compiler. " @@ -1466,11 +1455,11 @@ msgstr "" "一個執行檔,然後再執行它。直譯語言通常比編譯語言有更短的開發/除錯週期,不過" "它們的程式通常也運行得較慢。另請參閱 :term:`interactive`\\ (互動的)。" -#: ../../glossary.rst:640 +#: ../../glossary.rst:639 msgid "interpreter shutdown" msgstr "interpreter shutdown(直譯器關閉)" -#: ../../glossary.rst:642 +#: ../../glossary.rst:641 msgid "" "When asked to shut down, the Python interpreter enters a special phase where " "it gradually releases all allocated resources, such as modules and various " @@ -1488,18 +1477,18 @@ msgstr "" "段被執行的程式碼會遇到各種例外,因為它所依賴的資源可能不再有作用了(常見的例" "子是函式庫模組或是警告機制)。" -#: ../../glossary.rst:651 +#: ../../glossary.rst:650 msgid "" "The main reason for interpreter shutdown is that the ``__main__`` module or " "the script being run has finished executing." msgstr "" "直譯器關閉的主要原因,是 ``__main__`` 模組或正被運行的腳本已經執行完成。" -#: ../../glossary.rst:653 +#: ../../glossary.rst:652 msgid "iterable" msgstr "iterable(可疊代物件)" -#: ../../glossary.rst:655 +#: ../../glossary.rst:654 msgid "" "An object capable of returning its members one at a time. Examples of " "iterables include all sequence types (such as :class:`list`, :class:`str`, " @@ -1515,7 +1504,7 @@ msgstr "" "`sequence`\\ (序列)語意的 :meth:`~object.__getitem__` method,該物件就是可" "疊代物件。" -#: ../../glossary.rst:663 +#: ../../glossary.rst:662 msgid "" "Iterables can be used in a :keyword:`for` loop and in many other places " "where a sequence is needed (:func:`zip`, :func:`map`, ...). When an " @@ -1535,11 +1524,11 @@ msgstr "" "數,用於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代器)、:" "term:`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" -#: ../../glossary.rst:673 +#: ../../glossary.rst:672 msgid "iterator" msgstr "iterator(疊代器)" -#: ../../glossary.rst:675 +#: ../../glossary.rst:674 msgid "" "An object representing a stream of data. Repeated calls to the iterator's :" "meth:`~iterator.__next__` method (or passing it to the built-in function :" @@ -1568,23 +1557,25 @@ msgstr "" "此事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一個已被用盡的疊代器物" "件,使其看起來就像一個空的容器。" -#: ../../glossary.rst:690 +#: ../../glossary.rst:689 msgid "More information can be found in :ref:`typeiter`." msgstr "在\\ :ref:`typeiter`\\ 文中可以找到更多資訊。" -#: ../../glossary.rst:694 +#: ../../glossary.rst:693 +#, fuzzy msgid "" "CPython does not consistently apply the requirement that an iterator define :" -"meth:`~iterator.__iter__`." +"meth:`~iterator.__iter__`. And also please note that the free-threading " +"CPython does not guarantee the thread-safety of iterator operations." msgstr "" "CPython 並不是始終如一地都會檢查「疊代器有定義 :meth:`~iterator." "__iter__`\\ 」這個規定。" -#: ../../glossary.rst:696 +#: ../../glossary.rst:698 msgid "key function" msgstr "key function(鍵函式)" -#: ../../glossary.rst:698 +#: ../../glossary.rst:700 msgid "" "A key function or collation function is a callable that returns a value used " "for sorting or ordering. For example, :func:`locale.strxfrm` is used to " @@ -1594,7 +1585,7 @@ msgstr "" "一個用於排序 (sorting) 或定序 (ordering) 的值。例如,:func:`locale.strxfrm` " "被用來產生一個了解區域特定排序慣例的排序鍵。" -#: ../../glossary.rst:703 +#: ../../glossary.rst:705 msgid "" "A number of tools in Python accept key functions to control how elements are " "ordered or grouped. They include :func:`min`, :func:`max`, :func:`sorted`, :" @@ -1606,7 +1597,7 @@ msgstr "" "merge`、:func:`heapq.nsmallest`、:func:`heapq.nlargest` 和 :func:`itertools." "groupby`。" -#: ../../glossary.rst:709 +#: ../../glossary.rst:711 msgid "" "There are several ways to create a key function. For example. the :meth:" "`str.lower` method can serve as a key function for case insensitive sorts. " @@ -1623,19 +1614,19 @@ msgstr "" "式 (constructor)。關於如何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排序 " "`。" -#: ../../glossary.rst:716 +#: ../../glossary.rst:718 msgid "keyword argument" msgstr "keyword argument(關鍵字引數)" -#: ../../glossary.rst:718 ../../glossary.rst:1008 +#: ../../glossary.rst:720 ../../glossary.rst:1019 msgid "See :term:`argument`." msgstr "請參閱 :term:`argument`\\ (引數)。" -#: ../../glossary.rst:719 +#: ../../glossary.rst:721 msgid "lambda" msgstr "lambda" -#: ../../glossary.rst:721 +#: ../../glossary.rst:723 msgid "" "An anonymous inline function consisting of a single :term:`expression` which " "is evaluated when the function is called. The syntax to create a lambda " @@ -1645,11 +1636,11 @@ msgstr "" "function),於該函式被呼叫時求值。建立 lambda 函式的語法是 ``lambda " "[parameters]: expression``" -#: ../../glossary.rst:724 +#: ../../glossary.rst:726 msgid "LBYL" msgstr "LBYL" -#: ../../glossary.rst:726 +#: ../../glossary.rst:728 msgid "" "Look before you leap. This coding style explicitly tests for pre-conditions " "before making calls or lookups. This style contrasts with the :term:`EAFP` " @@ -1660,7 +1651,7 @@ msgstr "" "地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許多 :" "keyword:`if` 陳述式的存在。" -#: ../../glossary.rst:731 +#: ../../glossary.rst:733 msgid "" "In a multi-threaded environment, the LBYL approach can risk introducing a " "race condition between \"the looking\" and \"the leaping\". For example, " @@ -1674,11 +1665,11 @@ msgstr "" "了 *key*,則該程式碼就會失效。這個問題可以用鎖 (lock) 或使用 EAFP 編碼方式來" "解決。" -#: ../../glossary.rst:736 +#: ../../glossary.rst:738 msgid "list" msgstr "list(串列)" -#: ../../glossary.rst:738 +#: ../../glossary.rst:740 msgid "" "A built-in Python :term:`sequence`. Despite its name it is more akin to an " "array in other languages than to a linked list since access to elements is " @@ -1688,11 +1679,11 @@ msgstr "" "似其他語言中的一個陣列 (array) 而較不像一個鏈結串列 (linked list),因為存取元" "素的時間複雜度是 *O*\\ (1)。" -#: ../../glossary.rst:741 +#: ../../glossary.rst:743 msgid "list comprehension" msgstr "list comprehension(串列綜合運算)" -#: ../../glossary.rst:743 +#: ../../glossary.rst:745 msgid "" "A compact way to process all or part of the elements in a sequence and " "return a list with the results. ``result = ['{:#04x}'.format(x) for x in " @@ -1706,11 +1697,11 @@ msgstr "" "keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有元素都會被" "處理。" -#: ../../glossary.rst:749 +#: ../../glossary.rst:751 msgid "loader" msgstr "loader(載入器)" -#: ../../glossary.rst:751 +#: ../../glossary.rst:753 msgid "" "An object that loads a module. It must define a method named :meth:" "`load_module`. A loader is typically returned by a :term:`finder`. See :pep:" @@ -1722,11 +1713,11 @@ msgstr "" "`302`,關於 :term:`abstract base class`\\ (抽象基底類別),請參閱 :class:" "`importlib.abc.Loader`。" -#: ../../glossary.rst:755 +#: ../../glossary.rst:757 msgid "locale encoding" msgstr "locale encoding(區域編碼)" -#: ../../glossary.rst:757 +#: ../../glossary.rst:759 msgid "" "On Unix, it is the encoding of the LC_CTYPE locale. It can be set with :func:" "`locale.setlocale(locale.LC_CTYPE, new_locale) `." @@ -1734,36 +1725,36 @@ msgstr "" "在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以用 :func:`locale." "setlocale(locale.LC_CTYPE, new_locale) ` 來設定。" -#: ../../glossary.rst:760 +#: ../../glossary.rst:762 msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." msgstr "在 Windows 上,它是 ANSI 代碼頁(code page,例如 ``\"cp1252\"``\\ )。" -#: ../../glossary.rst:762 +#: ../../glossary.rst:764 msgid "" "On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." msgstr "在 Android 和 VxWorks 上,Python 使用 ``\"utf-8\"`` 作為區域編碼。" -#: ../../glossary.rst:764 +#: ../../glossary.rst:766 msgid ":func:`locale.getencoding` can be used to get the locale encoding." msgstr ":func:`locale.getencoding` 可以用來取得區域編碼。" -#: ../../glossary.rst:766 +#: ../../glossary.rst:768 msgid "See also the :term:`filesystem encoding and error handler`." msgstr "也請參考 :term:`filesystem encoding and error handler`。" -#: ../../glossary.rst:767 +#: ../../glossary.rst:769 msgid "magic method" msgstr "magic method(魔術方法)" -#: ../../glossary.rst:771 +#: ../../glossary.rst:773 msgid "An informal synonym for :term:`special method`." msgstr ":term:`special method`\\ (特殊方法)的一個非正式同義詞。" -#: ../../glossary.rst:772 +#: ../../glossary.rst:774 msgid "mapping" msgstr "mapping(對映)" -#: ../../glossary.rst:774 +#: ../../glossary.rst:776 msgid "" "A container object that supports arbitrary key lookups and implements the " "methods specified in the :class:`collections.abc.Mapping` or :class:" @@ -1778,11 +1769,11 @@ msgstr "" "包括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections." "OrderedDict` 和 :class:`collections.Counter`。" -#: ../../glossary.rst:780 +#: ../../glossary.rst:782 msgid "meta path finder" msgstr "meta path finder(元路徑尋檢器)" -#: ../../glossary.rst:782 +#: ../../glossary.rst:784 msgid "" "A :term:`finder` returned by a search of :data:`sys.meta_path`. Meta path " "finders are related to, but different from :term:`path entry finders ` " "相關但是不同。" -#: ../../glossary.rst:786 +#: ../../glossary.rst:788 msgid "" "See :class:`importlib.abc.MetaPathFinder` for the methods that meta path " "finders implement." msgstr "" "關於元路徑尋檢器實作的 method,請參閱 :class:`importlib.abc.MetaPathFinder`。" -#: ../../glossary.rst:788 +#: ../../glossary.rst:790 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../glossary.rst:790 +#: ../../glossary.rst:792 msgid "" "The class of a class. Class definitions create a class name, a class " "dictionary, and a list of base classes. The metaclass is responsible for " @@ -1823,15 +1814,15 @@ msgstr "" "性存取、增加執行緒安全性、追蹤物件建立、實作單例模式 (singleton),以及許多其" "他的任務。" -#: ../../glossary.rst:800 +#: ../../glossary.rst:802 msgid "More information can be found in :ref:`metaclasses`." msgstr "更多資訊可以在\\ :ref:`metaclasses`\\ 章節中找到。" -#: ../../glossary.rst:769 ../../glossary.rst:801 ../../glossary.rst:1138 +#: ../../glossary.rst:771 ../../glossary.rst:803 ../../glossary.rst:1168 msgid "method" msgstr "method(方法)" -#: ../../glossary.rst:803 +#: ../../glossary.rst:805 msgid "" "A function which is defined inside a class body. If called as an attribute " "of an instance of that class, the method will get the instance object as its " @@ -1843,11 +1834,11 @@ msgstr "" "通常被稱為 ``self``)。請參閱 :term:`function`\\ (函式)和 :term:`nested " "scope`\\ (巢狀作用域)。" -#: ../../glossary.rst:807 +#: ../../glossary.rst:809 msgid "method resolution order" msgstr "method resolution order(方法解析順序)" -#: ../../glossary.rst:809 +#: ../../glossary.rst:811 msgid "" "Method Resolution Order is the order in which base classes are searched for " "a member during lookup. See :ref:`python_2.3_mro` for details of the " @@ -1856,11 +1847,11 @@ msgstr "" "方法解析順序是在查找某個成員的過程中,base class(基底類別)被搜尋的順序。關" "於 Python 自 2.3 版直譯器所使用的演算法細節,請參閱 :ref:`python_2.3_mro`。" -#: ../../glossary.rst:812 +#: ../../glossary.rst:814 msgid "module" msgstr "module(模組)" -#: ../../glossary.rst:814 +#: ../../glossary.rst:816 msgid "" "An object that serves as an organizational unit of Python code. Modules " "have a namespace containing arbitrary Python objects. Modules are loaded " @@ -1870,15 +1861,15 @@ msgstr "" "空間,它包含任意的 Python 物件。模組是藉由 :term:`importing` 的過程,被載入" "至 Python。" -#: ../../glossary.rst:818 +#: ../../glossary.rst:820 msgid "See also :term:`package`." msgstr "另請參閱 :term:`package`\\ (套件)。" -#: ../../glossary.rst:819 +#: ../../glossary.rst:821 msgid "module spec" msgstr "module spec(模組規格)" -#: ../../glossary.rst:821 +#: ../../glossary.rst:823 msgid "" "A namespace containing the import-related information used to load a module. " "An instance of :class:`importlib.machinery.ModuleSpec`." @@ -1886,19 +1877,19 @@ msgstr "" "一個命名空間,它包含用於載入模組的 import 相關資訊。它是 :class:`importlib." "machinery.ModuleSpec` 的一個實例。" -#: ../../glossary.rst:823 +#: ../../glossary.rst:825 msgid "MRO" msgstr "MRO" -#: ../../glossary.rst:825 +#: ../../glossary.rst:827 msgid "See :term:`method resolution order`." msgstr "請參閱 :term:`method resolution order`\\ (方法解析順序)。" -#: ../../glossary.rst:826 +#: ../../glossary.rst:828 msgid "mutable" msgstr "mutable(可變物件)" -#: ../../glossary.rst:828 +#: ../../glossary.rst:830 msgid "" "Mutable objects can change their value but keep their :func:`id`. See also :" "term:`immutable`." @@ -1906,11 +1897,11 @@ msgstr "" "可變物件可以改變它們的值,但維持它們的 :func:`id`。另請參閱 :term:" "`immutable`\\ (不可變物件)。" -#: ../../glossary.rst:830 +#: ../../glossary.rst:832 msgid "named tuple" msgstr "named tuple(附名元組)" -#: ../../glossary.rst:832 +#: ../../glossary.rst:834 msgid "" "The term \"named tuple\" applies to any type or class that inherits from " "tuple and whose indexable elements are also accessible using named " @@ -1920,7 +1911,7 @@ msgstr "" "索引 (indexable) 元素也可以用附名屬性來存取。這些型別或 class 也可以具有其他" "的特性。" -#: ../../glossary.rst:836 +#: ../../glossary.rst:838 msgid "" "Several built-in types are named tuples, including the values returned by :" "func:`time.localtime` and :func:`os.stat`. Another example is :data:`sys." @@ -1929,7 +1920,7 @@ msgstr "" "有些內建型別是 named tuple,包括由 :func:`time.localtime` 和 :func:`os.stat` " "回傳的值。另一個例子是 :data:`sys.float_info`: ::" -#: ../../glossary.rst:840 +#: ../../glossary.rst:842 msgid "" ">>> sys.float_info[1] # indexed access\n" "1024\n" @@ -1939,7 +1930,7 @@ msgid "" "True" msgstr "" -#: ../../glossary.rst:847 +#: ../../glossary.rst:849 msgid "" "Some named tuples are built-in types (such as the above examples). " "Alternatively, a named tuple can be created from a regular class definition " @@ -1956,11 +1947,11 @@ msgstr "" "namedtuple` 來建立。後者技術也增加了一些額外的 method,這些 method 可能是在手" "寫或內建的 named tuple 中,無法找到的。" -#: ../../glossary.rst:855 +#: ../../glossary.rst:857 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../glossary.rst:857 +#: ../../glossary.rst:859 msgid "" "The place where a variable is stored. Namespaces are implemented as " "dictionaries. There are the local, global and built-in namespaces as well " @@ -1980,11 +1971,11 @@ msgstr "" "func:`itertools.islice` 明確地表示,這些函式分別是由 :mod:`random` 和 :mod:" "`itertools` 模組在實作。" -#: ../../glossary.rst:867 +#: ../../glossary.rst:869 msgid "namespace package" msgstr "namespace package(命名空間套件)" -#: ../../glossary.rst:869 +#: ../../glossary.rst:871 msgid "" "A :pep:`420` :term:`package` which serves only as a container for " "subpackages. Namespace packages may have no physical representation, and " @@ -1995,15 +1986,15 @@ msgstr "" "一個容器。命名空間套件可能沒有實體的表示法,而且具體來說它們不像是一個 :term:" "`regular package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這個檔案。" -#: ../../glossary.rst:874 +#: ../../glossary.rst:876 msgid "See also :term:`module`." msgstr "另請參閱 :term:`module`\\ (模組)。" -#: ../../glossary.rst:875 +#: ../../glossary.rst:877 msgid "nested scope" msgstr "nested scope(巢狀作用域)" -#: ../../glossary.rst:877 +#: ../../glossary.rst:879 msgid "" "The ability to refer to a variable in an enclosing definition. For " "instance, a function defined inside another function can refer to variables " @@ -2018,11 +2009,11 @@ msgstr "" "寫入。同樣地,全域變數是在全域命名空間中讀取及寫入。:keyword:`nonlocal` 容許" "對外層作用域進行寫入。" -#: ../../glossary.rst:884 +#: ../../glossary.rst:886 msgid "new-style class" msgstr "new-style class(新式類別)" -#: ../../glossary.rst:886 +#: ../../glossary.rst:888 msgid "" "Old name for the flavor of classes now used for all class objects. In " "earlier Python versions, only new-style classes could use Python's newer, " @@ -2034,11 +2025,11 @@ msgstr "" "__slots__`、描述器 (descriptor)、屬性 (property)、:meth:`~object." "__getattribute__`、class method(類別方法)和 static method(靜態方法)。" -#: ../../glossary.rst:891 +#: ../../glossary.rst:893 msgid "object" msgstr "object(物件)" -#: ../../glossary.rst:893 +#: ../../glossary.rst:895 msgid "" "Any data with state (attributes or value) and defined behavior (methods). " "Also the ultimate base class of any :term:`new-style class`." @@ -2046,11 +2037,26 @@ msgstr "" "具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任何 :term:" "`new-style class`\\ (新式類別)的最終 base class(基底類別)。" -#: ../../glossary.rst:896 +#: ../../glossary.rst:898 +msgid "optimized scope" +msgstr "optimized scope(最佳化作用域)" + +#: ../../glossary.rst:900 +msgid "" +"A scope where target local variable names are reliably known to the compiler " +"when the code is compiled, allowing optimization of read and write access to " +"these names. The local namespaces for functions, generators, coroutines, " +"comprehensions, and generator expressions are optimized in this fashion. " +"Note: most interpreter optimizations are applied to all scopes, only those " +"relying on a known set of local and nonlocal variable names are restricted " +"to optimized scopes." +msgstr "" + +#: ../../glossary.rst:907 msgid "package" msgstr "package(套件)" -#: ../../glossary.rst:898 +#: ../../glossary.rst:909 msgid "" "A Python :term:`module` which can contain submodules or recursively, " "subpackages. Technically, a package is a Python module with a ``__path__`` " @@ -2060,17 +2066,17 @@ msgstr "" "迴的子套件 (subpackage)。技術上而言,套件就是具有 ``__path__`` 屬性的一個 " "Python 模組。" -#: ../../glossary.rst:902 +#: ../../glossary.rst:913 msgid "See also :term:`regular package` and :term:`namespace package`." msgstr "" "另請參閱 :term:`regular package`\\ (正規套件)和 :term:`namespace " "package`\\ (命名空間套件)。" -#: ../../glossary.rst:903 +#: ../../glossary.rst:914 msgid "parameter" msgstr "parameter(參數)" -#: ../../glossary.rst:905 +#: ../../glossary.rst:916 msgid "" "A named entity in a :term:`function` (or method) definition that specifies " "an :term:`argument` (or in some cases, arguments) that the function can " @@ -2080,7 +2086,7 @@ msgstr "" "它指明該函式能夠接受的一個 :term:`argument`\\ (引數),或在某些情況下指示多" "個引數。共有有五種不同的參數類型:" -#: ../../glossary.rst:909 +#: ../../glossary.rst:920 msgid "" ":dfn:`positional-or-keyword`: specifies an argument that can be passed " "either :term:`positionally ` or as a :term:`keyword argument " @@ -2091,11 +2097,11 @@ msgstr "" "置 `\\ 或是作為\\ :term:`關鍵字引數 `\\ 被傳遞的引數。這" "是參數的預設類型,例如以下的 *foo* 和 *bar*: ::" -#: ../../glossary.rst:914 +#: ../../glossary.rst:925 msgid "def func(foo, bar=None): ..." msgstr "def func(foo, bar=None): ..." -#: ../../glossary.rst:918 +#: ../../glossary.rst:929 msgid "" ":dfn:`positional-only`: specifies an argument that can be supplied only by " "position. Positional-only parameters can be defined by including a ``/`` " @@ -2106,11 +2112,11 @@ msgstr "" "式定義的參數列表中包含一個 ``/`` 字元,就可以在該字元前面定義僅限位置參數,例" "如以下的 *posonly1* 和 *posonly2*: ::" -#: ../../glossary.rst:923 +#: ../../glossary.rst:934 msgid "def func(posonly1, posonly2, /, positional_or_keyword): ..." msgstr "def func(posonly1, posonly2, /, positional_or_keyword): ..." -#: ../../glossary.rst:927 +#: ../../glossary.rst:938 msgid "" ":dfn:`keyword-only`: specifies an argument that can be supplied only by " "keyword. Keyword-only parameters can be defined by including a single var-" @@ -2123,11 +2129,11 @@ msgstr "" "單純的 ``*`` 字元,就可以在其後方定義僅限關鍵字參數,例如以下的 *kw_only1* " "和 *kw_only2*: ::" -#: ../../glossary.rst:933 +#: ../../glossary.rst:944 msgid "def func(arg, *, kw_only1, kw_only2): ..." msgstr "def func(arg, *, kw_only1, kw_only2): ..." -#: ../../glossary.rst:935 +#: ../../glossary.rst:946 msgid "" ":dfn:`var-positional`: specifies that an arbitrary sequence of positional " "arguments can be provided (in addition to any positional arguments already " @@ -2139,11 +2145,11 @@ msgstr "" "數(在已被其他參數接受的任何位置引數之外)。這類參數是透過在其參數名稱字首加" "上 ``*`` 來定義的,例如以下的 *args*: ::" -#: ../../glossary.rst:941 +#: ../../glossary.rst:952 msgid "def func(*args, **kwargs): ..." msgstr "def func(*args, **kwargs): ..." -#: ../../glossary.rst:943 +#: ../../glossary.rst:954 msgid "" ":dfn:`var-keyword`: specifies that arbitrarily many keyword arguments can be " "provided (in addition to any keyword arguments already accepted by other " @@ -2154,14 +2160,14 @@ msgstr "" "已被其他參數接受的任何關鍵字引數之外)。這類參數是透過在其參數名稱字首加上 " "``**`` 來定義的,例如上面範例中的 *kwargs*。" -#: ../../glossary.rst:949 +#: ../../glossary.rst:960 msgid "" "Parameters can specify both optional and required arguments, as well as " "default values for some optional arguments." msgstr "" "參數可以指明引數是選擇性的或必需的,也可以為一些選擇性的引數指定預設值。" -#: ../../glossary.rst:952 +#: ../../glossary.rst:963 msgid "" "See also the :term:`argument` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " @@ -2172,11 +2178,11 @@ msgstr "" "參數之間的差異 `、:class:`inspect.Parameter` " "class、:ref:`function`\\ 章節,以及 :pep:`362`。" -#: ../../glossary.rst:956 +#: ../../glossary.rst:967 msgid "path entry" msgstr "path entry(路徑項目)" -#: ../../glossary.rst:958 +#: ../../glossary.rst:969 msgid "" "A single location on the :term:`import path` which the :term:`path based " "finder` consults to find modules for importing." @@ -2184,11 +2190,11 @@ msgstr "" "在 :term:`import path`\\ (引入路徑)中的一個位置,而 :term:`path based " "finder` (基於路徑的尋檢器)會參考該位置來尋找要 import 的模組。" -#: ../../glossary.rst:960 +#: ../../glossary.rst:971 msgid "path entry finder" msgstr "path entry finder(路徑項目尋檢器)" -#: ../../glossary.rst:962 +#: ../../glossary.rst:973 msgid "" "A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. a :" "term:`path entry hook`) which knows how to locate modules given a :term:" @@ -2198,7 +2204,7 @@ msgstr "" "`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一個 :term:" "`path entry`\\ 定位模組。" -#: ../../glossary.rst:966 +#: ../../glossary.rst:977 msgid "" "See :class:`importlib.abc.PathEntryFinder` for the methods that path entry " "finders implement." @@ -2206,11 +2212,11 @@ msgstr "" "關於路徑項目尋檢器實作的 method,請參閱 :class:`importlib.abc." "PathEntryFinder`。" -#: ../../glossary.rst:968 +#: ../../glossary.rst:979 msgid "path entry hook" msgstr "path entry hook(路徑項目鉤)" -#: ../../glossary.rst:970 +#: ../../glossary.rst:981 msgid "" "A callable on the :data:`sys.path_hooks` list which returns a :term:`path " "entry finder` if it knows how to find modules on a specific :term:`path " @@ -2220,11 +2226,11 @@ msgstr "" "個特定的 :term:`path entry` 中尋找模組,則會回傳一個 :term:`path entry " "finder`\\ (路徑項目尋檢器)。" -#: ../../glossary.rst:973 +#: ../../glossary.rst:984 msgid "path based finder" msgstr "path based finder(基於路徑的尋檢器)" -#: ../../glossary.rst:975 +#: ../../glossary.rst:986 msgid "" "One of the default :term:`meta path finders ` which " "searches an :term:`import path` for modules." @@ -2232,11 +2238,11 @@ msgstr "" "預設的\\ :term:`元路徑尋檢器 (meta path finder) ` 之一,它" "會在一個 :term:`import path` 中搜尋模組。" -#: ../../glossary.rst:977 +#: ../../glossary.rst:988 msgid "path-like object" msgstr "path-like object(類路徑物件)" -#: ../../glossary.rst:979 +#: ../../glossary.rst:990 msgid "" "An object representing a file system path. A path-like object is either a :" "class:`str` or :class:`bytes` object representing a path, or an object " @@ -2254,11 +2260,11 @@ msgstr "" "`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結果。由 :" "pep:`519` 引入。" -#: ../../glossary.rst:987 +#: ../../glossary.rst:998 msgid "PEP" msgstr "PEP" -#: ../../glossary.rst:989 +#: ../../glossary.rst:1000 msgid "" "Python Enhancement Proposal. A PEP is a design document providing " "information to the Python community, or describing a new feature for Python " @@ -2269,7 +2275,7 @@ msgstr "" "為 Python 社群提供資訊,或是描述 Python 的一個新功能或該功能的程序和環境。" "PEP 應該要提供簡潔的技術規範以及被提案功能的運作原理。" -#: ../../glossary.rst:995 +#: ../../glossary.rst:1006 msgid "" "PEPs are intended to be the primary mechanisms for proposing major new " "features, for collecting community input on an issue, and for documenting " @@ -2281,15 +2287,15 @@ msgstr "" "已納入 Python 的設計決策的記錄,這些過程的主要機制。PEP 的作者要負責在社群內" "建立共識並記錄反對意見。" -#: ../../glossary.rst:1001 +#: ../../glossary.rst:1012 msgid "See :pep:`1`." msgstr "請參閱 :pep:`1`。" -#: ../../glossary.rst:1002 +#: ../../glossary.rst:1013 msgid "portion" msgstr "portion(部分)" -#: ../../glossary.rst:1004 +#: ../../glossary.rst:1015 msgid "" "A set of files in a single directory (possibly stored in a zip file) that " "contribute to a namespace package, as defined in :pep:`420`." @@ -2297,15 +2303,15 @@ msgstr "" "在單一目錄中的一組檔案(也可能儲存在一個 zip 檔中),這些檔案能對一個命名空間" "套件 (namespace package) 有所貢獻,如同 :pep:`420` 中的定義。" -#: ../../glossary.rst:1006 +#: ../../glossary.rst:1017 msgid "positional argument" msgstr "positional argument(位置引數)" -#: ../../glossary.rst:1009 +#: ../../glossary.rst:1020 msgid "provisional API" msgstr "provisional API(暫行 API)" -#: ../../glossary.rst:1011 +#: ../../glossary.rst:1022 msgid "" "A provisional API is one which has been deliberately excluded from the " "standard library's backwards compatibility guarantees. While major changes " @@ -2321,7 +2327,7 @@ msgstr "" "該介面)。這種變更並不會無端地產生——只有 API 被納入之前未察覺的嚴重基本缺陷被" "揭露時,它們才會發生。" -#: ../../glossary.rst:1020 +#: ../../glossary.rst:1031 msgid "" "Even for provisional APIs, backwards incompatible changes are seen as a " "\"solution of last resort\" - every attempt will still be made to find a " @@ -2330,7 +2336,7 @@ msgstr "" "即使對於暫行 API,向後不相容的變更也會被視為「最後的解決方案」——對於任何被發" "現的問題,仍然會盡可能找出一個向後相容的解決方案。" -#: ../../glossary.rst:1024 +#: ../../glossary.rst:1035 msgid "" "This process allows the standard library to continue to evolve over time, " "without locking in problematic design errors for extended periods of time. " @@ -2339,19 +2345,19 @@ msgstr "" "這個過程使得標準函式庫能隨著時間不斷進化,而避免耗費過長的時間去鎖定有問題的" "設計錯誤。請參閱 :pep:`411` 了解更多細節。" -#: ../../glossary.rst:1027 +#: ../../glossary.rst:1038 msgid "provisional package" msgstr "provisional package(暫行套件)" -#: ../../glossary.rst:1029 +#: ../../glossary.rst:1040 msgid "See :term:`provisional API`." msgstr "請參閱 :term:`provisional API`\\ (暫行 API)。" -#: ../../glossary.rst:1030 +#: ../../glossary.rst:1041 msgid "Python 3000" msgstr "Python 3000" -#: ../../glossary.rst:1032 +#: ../../glossary.rst:1043 msgid "" "Nickname for the Python 3.x release line (coined long ago when the release " "of version 3 was something in the distant future.) This is also abbreviated " @@ -2360,11 +2366,11 @@ msgstr "" "Python 3.x 系列版本的暱稱(很久以前創造的,當時第 3 版的發布是在遙遠的未" "來。)也可以縮寫為「Py3k」。" -#: ../../glossary.rst:1035 +#: ../../glossary.rst:1046 msgid "Pythonic" msgstr "Pythonic(Python 風格的)" -#: ../../glossary.rst:1037 +#: ../../glossary.rst:1048 msgid "" "An idea or piece of code which closely follows the most common idioms of the " "Python language, rather than implementing code using concepts common to " @@ -2378,7 +2384,7 @@ msgstr "" "keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並沒有" "這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" -#: ../../glossary.rst:1044 +#: ../../glossary.rst:1055 msgid "" "for i in range(len(food)):\n" " print(food[i])" @@ -2386,11 +2392,11 @@ msgstr "" "for i in range(len(food)):\n" " print(food[i])" -#: ../../glossary.rst:1047 +#: ../../glossary.rst:1058 msgid "As opposed to the cleaner, Pythonic method::" msgstr "相較之下,以下方法更簡潔、更具有 Python 風格: ::" -#: ../../glossary.rst:1049 +#: ../../glossary.rst:1060 msgid "" "for piece in food:\n" " print(piece)" @@ -2398,11 +2404,11 @@ msgstr "" "for piece in food:\n" " print(piece)" -#: ../../glossary.rst:1051 +#: ../../glossary.rst:1062 msgid "qualified name" msgstr "qualified name(限定名稱)" -#: ../../glossary.rst:1053 +#: ../../glossary.rst:1064 msgid "" "A dotted name showing the \"path\" from a module's global scope to a class, " "function or method defined in that module, as defined in :pep:`3155`. For " @@ -2413,7 +2419,7 @@ msgstr "" "或 method 的「路徑」,如 :pep:`3155` 中的定義。對於頂層的函式和 class 而言," "限定名稱與其物件名稱相同: ::" -#: ../../glossary.rst:1058 +#: ../../glossary.rst:1069 msgid "" ">>> class C:\n" "... class D:\n" @@ -2439,7 +2445,7 @@ msgstr "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" -#: ../../glossary.rst:1070 +#: ../../glossary.rst:1081 msgid "" "When used to refer to modules, the *fully qualified name* means the entire " "dotted path to the module, including any parent packages, e.g. ``email.mime." @@ -2448,7 +2454,7 @@ msgstr "" "當用於引用模組時,*完全限定名稱 (fully qualified name)* 是表示該模組的完整點" "分隔路徑,包括任何的父套件,例如 ``email.mime.text``: ::" -#: ../../glossary.rst:1074 +#: ../../glossary.rst:1085 msgid "" ">>> import email.mime.text\n" ">>> email.mime.text.__name__\n" @@ -2458,17 +2464,18 @@ msgstr "" ">>> email.mime.text.__name__\n" "'email.mime.text'" -#: ../../glossary.rst:1077 +#: ../../glossary.rst:1088 msgid "reference count" msgstr "reference count(參照計數)" -#: ../../glossary.rst:1079 +#: ../../glossary.rst:1090 +#, fuzzy msgid "" "The number of references to an object. When the reference count of an " -"object drops to zero, it is deallocated. Some objects are \"immortal\" and " -"have reference counts that are never modified, and therefore the objects are " -"never deallocated. Reference counting is generally not visible to Python " -"code, but it is a key element of the :term:`CPython` implementation. " +"object drops to zero, it is deallocated. Some objects are :term:`immortal` " +"and have reference counts that are never modified, and therefore the objects " +"are never deallocated. Reference counting is generally not visible to " +"Python code, but it is a key element of the :term:`CPython` implementation. " "Programmers can call the :func:`sys.getrefcount` function to return the " "reference count for a particular object." msgstr "" @@ -2478,11 +2485,11 @@ msgstr "" "`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :func:`~sys.getrefcount` 函" "式來回傳一個特定物件的參照計數。" -#: ../../glossary.rst:1087 +#: ../../glossary.rst:1098 msgid "regular package" msgstr "regular package(正規套件)" -#: ../../glossary.rst:1089 +#: ../../glossary.rst:1100 msgid "" "A traditional :term:`package`, such as a directory containing an ``__init__." "py`` file." @@ -2490,15 +2497,25 @@ msgstr "" "一個傳統的 :term:`package`\\ (套件),例如一個包含 ``__init__.py`` 檔案的目" "錄。" -#: ../../glossary.rst:1092 +#: ../../glossary.rst:1103 msgid "See also :term:`namespace package`." msgstr "另請參閱 :term:`namespace package`\\ (命名空間套件)。" -#: ../../glossary.rst:1093 +#: ../../glossary.rst:1104 +msgid "REPL" +msgstr "" + +#: ../../glossary.rst:1106 +msgid "" +"An acronym for the \"read–eval–print loop\", another name for the :term:" +"`interactive` interpreter shell." +msgstr "" + +#: ../../glossary.rst:1108 msgid "__slots__" msgstr "__slots__" -#: ../../glossary.rst:1095 +#: ../../glossary.rst:1110 msgid "" "A declaration inside a class that saves memory by pre-declaring space for " "instance attributes and eliminating instance dictionaries. Though popular, " @@ -2511,11 +2528,11 @@ msgstr "" "最好保留給那種在一個記憶體關鍵 (memory-critical) 的應用程式中存在大量實例的罕" "見情況。" -#: ../../glossary.rst:1100 +#: ../../glossary.rst:1115 msgid "sequence" msgstr "sequence(序列)" -#: ../../glossary.rst:1102 +#: ../../glossary.rst:1117 msgid "" "An :term:`iterable` which supports efficient element access using integer " "indices via the :meth:`~object.__getitem__` special method and defines a :" @@ -2534,7 +2551,7 @@ msgstr "" "為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`immutable` " "鍵,而不是整數。" -#: ../../glossary.rst:1111 +#: ../../glossary.rst:1126 msgid "" "The :class:`collections.abc.Sequence` abstract base class defines a much " "richer interface that goes beyond just :meth:`~object.__getitem__` and :meth:" @@ -2551,11 +2568,11 @@ msgstr "" "用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於序列方法的文件,請見" "\\ :ref:`常見序列操作 `。" -#: ../../glossary.rst:1120 +#: ../../glossary.rst:1135 msgid "set comprehension" msgstr "set comprehension(集合綜合運算)" -#: ../../glossary.rst:1122 +#: ../../glossary.rst:1137 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a set with the results. ``results = {c for c in 'abracadabra' if c " @@ -2566,11 +2583,11 @@ msgstr "" "set 回傳。``results = {c for c in 'abracadabra' if c not in 'abc'}`` 會產生一" "個字串 set:``{'r', 'd'}``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:1126 +#: ../../glossary.rst:1141 msgid "single dispatch" msgstr "single dispatch(單一調度)" -#: ../../glossary.rst:1128 +#: ../../glossary.rst:1143 msgid "" "A form of :term:`generic function` dispatch where the implementation is " "chosen based on the type of a single argument." @@ -2578,11 +2595,11 @@ msgstr "" ":term:`generic function`\\ (泛型函式)調度的一種形式,在此,實作的選擇是基於" "單一引數的型別。" -#: ../../glossary.rst:1130 +#: ../../glossary.rst:1145 msgid "slice" msgstr "slice(切片)" -#: ../../glossary.rst:1132 +#: ../../glossary.rst:1147 msgid "" "An object usually containing a portion of a :term:`sequence`. A slice is " "created using the subscript notation, ``[]`` with colons between numbers " @@ -2594,11 +2611,40 @@ msgstr "" "之間使用冒號,例如 ``variable_name[1:3:5]``。在括號(下標)符號的內部,會使" "用 :class:`slice` 物件。" -#: ../../glossary.rst:1136 +#: ../../glossary.rst:1151 +msgid "soft deprecated" +msgstr "" + +#: ../../glossary.rst:1153 +msgid "" +"A soft deprecation can be used when using an API which should no longer be " +"used to write new code, but it remains safe to continue using it in existing " +"code. The API remains documented and tested, but will not be developed " +"further (no enhancement)." +msgstr "" + +#: ../../glossary.rst:1158 +msgid "" +"The main difference between a \"soft\" and a (regular) \"hard\" deprecation " +"is that the soft deprecation does not imply scheduling the removal of the " +"deprecated API." +msgstr "" + +#: ../../glossary.rst:1162 +msgid "Another difference is that a soft deprecation does not issue a warning." +msgstr "" + +#: ../../glossary.rst:1164 +msgid "" +"See `PEP 387: Soft Deprecation `_." +msgstr "" + +#: ../../glossary.rst:1166 msgid "special method" msgstr "special method(特殊方法)" -#: ../../glossary.rst:1140 +#: ../../glossary.rst:1170 msgid "" "A method that is called implicitly by Python to execute a certain operation " "on a type, such as addition. Such methods have names starting and ending " @@ -2609,11 +2655,11 @@ msgstr "" "種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在\\ :ref:" "`specialnames`\\ 中有詳細說明。" -#: ../../glossary.rst:1144 +#: ../../glossary.rst:1174 msgid "statement" msgstr "statement(陳述式)" -#: ../../glossary.rst:1146 +#: ../../glossary.rst:1176 msgid "" "A statement is part of a suite (a \"block\" of code). A statement is either " "an :term:`expression` or one of several constructs with a keyword, such as :" @@ -2623,11 +2669,11 @@ msgstr "" "term:`expression`\\ (運算式),或是含有關鍵字(例如 :keyword:`if`、:keyword:" "`while` 或 :keyword:`for`\\ )的多種結構之一。" -#: ../../glossary.rst:1149 +#: ../../glossary.rst:1179 msgid "static type checker" msgstr "static type checker(靜態型別檢查器)" -#: ../../glossary.rst:1151 +#: ../../glossary.rst:1181 msgid "" "An external tool that reads Python code and analyzes it, looking for issues " "such as incorrect types. See also :term:`type hints ` and the :" @@ -2637,11 +2683,11 @@ msgstr "" "另請參閱\\ :term:`型別提示 (type hints) ` 以及 :mod:`typing` 模" "組。" -#: ../../glossary.rst:1154 +#: ../../glossary.rst:1184 msgid "strong reference" msgstr "strong reference(強參照)" -#: ../../glossary.rst:1156 +#: ../../glossary.rst:1186 msgid "" "In Python's C API, a strong reference is a reference to an object which is " "owned by the code holding the reference. The strong reference is taken by " @@ -2652,7 +2698,7 @@ msgstr "" "有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透過 :c:" "func:`Py_DECREF` 釋放強參照。" -#: ../../glossary.rst:1162 +#: ../../glossary.rst:1192 msgid "" "The :c:func:`Py_NewRef` function can be used to create a strong reference to " "an object. Usually, the :c:func:`Py_DECREF` function must be called on the " @@ -2662,15 +2708,15 @@ msgstr "" ":c:func:`Py_NewRef` 函式可用於建立一個對物件的強參照。通常,在退出強參照的作" "用域之前,必須在該強參照上呼叫 :c:func:`Py_DECREF` 函式,以避免洩漏一個參照。" -#: ../../glossary.rst:1167 +#: ../../glossary.rst:1197 msgid "See also :term:`borrowed reference`." msgstr "另請參閱 :term:`borrowed reference`\\ (借用參照)。" -#: ../../glossary.rst:1168 +#: ../../glossary.rst:1198 msgid "text encoding" msgstr "text encoding(文字編碼)" -#: ../../glossary.rst:1170 +#: ../../glossary.rst:1200 msgid "" "A string in Python is a sequence of Unicode code points (in range " "``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be " @@ -2679,7 +2725,7 @@ msgstr "" "Python 中的字串是一個 Unicode 碼點 (code point) 的序列(範圍在 ``U+0000`` -- " "``U+10FFFF`` 之間)。若要儲存或傳送一個字串,它必須被序列化為一個位元組序列。" -#: ../../glossary.rst:1174 +#: ../../glossary.rst:1204 msgid "" "Serializing a string into a sequence of bytes is known as \"encoding\", and " "recreating the string from the sequence of bytes is known as \"decoding\"." @@ -2687,7 +2733,7 @@ msgstr "" "將一個字串序列化為位元組序列,稱為「編碼」,而從位元組序列重新建立該字串則稱" "為「解碼 (decoding)」。" -#: ../../glossary.rst:1177 +#: ../../glossary.rst:1207 msgid "" "There are a variety of different text serialization :ref:`codecs `, which are collectively referred to as \"text encodings\"." @@ -2695,11 +2741,11 @@ msgstr "" "有多種不同的文字序列化編解碼器 (:ref:`codecs `),它們被統" "稱為「文字編碼」。" -#: ../../glossary.rst:1180 +#: ../../glossary.rst:1210 msgid "text file" msgstr "text file(文字檔案)" -#: ../../glossary.rst:1182 +#: ../../glossary.rst:1212 msgid "" "A :term:`file object` able to read and write :class:`str` objects. Often, a " "text file actually accesses a byte-oriented datastream and handles the :term:" @@ -2713,7 +2759,7 @@ msgstr "" "有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔案、:data:`sys.stdin`、:data:" "`sys.stdout` 以及 :class:`io.StringIO` 的實例。" -#: ../../glossary.rst:1189 +#: ../../glossary.rst:1219 msgid "" "See also :term:`binary file` for a file object able to read and write :term:" "`bytes-like objects `." @@ -2721,11 +2767,11 @@ msgstr "" "另請參閱 :term:`binary file`\\ (二進位檔案),它是一個能夠讀取和寫入\\ :" "term:`類位元組串物件 (bytes-like object) ` 的檔案物件。" -#: ../../glossary.rst:1191 +#: ../../glossary.rst:1221 msgid "triple-quoted string" msgstr "triple-quoted string(三引號內字串)" -#: ../../glossary.rst:1193 +#: ../../glossary.rst:1223 msgid "" "A string which is bound by three instances of either a quotation mark (\") " "or an apostrophe ('). While they don't provide any functionality not " @@ -2740,11 +2786,11 @@ msgstr "" "中包含未跳脫 (unescaped) 的單引號和雙引號,而且它們不需使用連續字元 " "(continuation character) 就可以跨越多行,這使得它們在編寫說明字串時特別有用。" -#: ../../glossary.rst:1200 +#: ../../glossary.rst:1230 msgid "type" msgstr "type(型別)" -#: ../../glossary.rst:1202 +#: ../../glossary.rst:1232 msgid "" "The type of a Python object determines what kind of object it is; every " "object has a type. An object's type is accessible as its :attr:`~instance." @@ -2754,22 +2800,22 @@ msgstr "" "件的型別可以用它的 :attr:`~instance.__class__` 屬性來存取,或以 " "``type(obj)`` 來檢索。" -#: ../../glossary.rst:1206 +#: ../../glossary.rst:1236 msgid "type alias" msgstr "type alias(型別別名)" -#: ../../glossary.rst:1208 +#: ../../glossary.rst:1238 msgid "A synonym for a type, created by assigning the type to an identifier." msgstr "一個型別的同義詞,透過將型別指定給一個識別符 (identifier) 來建立。" -#: ../../glossary.rst:1210 +#: ../../glossary.rst:1240 msgid "" "Type aliases are useful for simplifying :term:`type hints `. For " "example::" msgstr "" "型別別名對於簡化\\ :term:`型別提示 (type hint) ` 很有用。例如: ::" -#: ../../glossary.rst:1213 +#: ../../glossary.rst:1243 msgid "" "def remove_gray_shades(\n" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" @@ -2779,11 +2825,11 @@ msgstr "" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" " pass" -#: ../../glossary.rst:1217 +#: ../../glossary.rst:1247 msgid "could be made more readable like this::" msgstr "可以寫成這樣,更具有可讀性: ::" -#: ../../glossary.rst:1219 +#: ../../glossary.rst:1249 msgid "" "Color = tuple[int, int, int]\n" "\n" @@ -2795,15 +2841,15 @@ msgstr "" "def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" " pass" -#: ../../glossary.rst:1224 ../../glossary.rst:1238 +#: ../../glossary.rst:1254 ../../glossary.rst:1268 msgid "See :mod:`typing` and :pep:`484`, which describe this functionality." msgstr "請參閱 :mod:`typing` 和 :pep:`484`,有此功能的描述。" -#: ../../glossary.rst:1225 +#: ../../glossary.rst:1255 msgid "type hint" msgstr "type hint(型別提示)" -#: ../../glossary.rst:1227 +#: ../../glossary.rst:1257 msgid "" "An :term:`annotation` that specifies the expected type for a variable, a " "class attribute, or a function parameter or return value." @@ -2811,7 +2857,7 @@ msgstr "" "一種 :term:`annotation`\\ (註釋),它指定一個變數、一個 class 屬性或一個函式" "的參數或回傳值的預期型別。" -#: ../../glossary.rst:1230 +#: ../../glossary.rst:1260 msgid "" "Type hints are optional and are not enforced by Python but they are useful " "to :term:`static type checkers `. They can also aid " @@ -2821,7 +2867,7 @@ msgstr "" "(static type checkers) `\\ 很有用,並能協助 IDE 完成程式" "碼的補全 (completion) 和重構 (refactoring)。" -#: ../../glossary.rst:1234 +#: ../../glossary.rst:1264 msgid "" "Type hints of global variables, class attributes, and functions, but not " "local variables, can be accessed using :func:`typing.get_type_hints`." @@ -2829,11 +2875,11 @@ msgstr "" "全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使用 :func:" "`typing.get_type_hints` 來存取。" -#: ../../glossary.rst:1239 +#: ../../glossary.rst:1269 msgid "universal newlines" msgstr "universal newlines(通用換行字元)" -#: ../../glossary.rst:1241 +#: ../../glossary.rst:1271 msgid "" "A manner of interpreting text streams in which all of the following are " "recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the " @@ -2846,20 +2892,20 @@ msgstr "" "``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用於 :func:`bytes." "splitlines` 的附加用途。" -#: ../../glossary.rst:1246 +#: ../../glossary.rst:1276 msgid "variable annotation" msgstr "variable annotation(變數註釋)" -#: ../../glossary.rst:1248 +#: ../../glossary.rst:1278 msgid "An :term:`annotation` of a variable or a class attribute." msgstr "一個變數或 class 屬性的 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:1250 +#: ../../glossary.rst:1280 msgid "" "When annotating a variable or a class attribute, assignment is optional::" msgstr "註釋變數或 class 屬性時,賦值是選擇性的: ::" -#: ../../glossary.rst:1252 +#: ../../glossary.rst:1282 msgid "" "class C:\n" " field: 'annotation'" @@ -2867,7 +2913,7 @@ msgstr "" "class C:\n" " field: 'annotation'" -#: ../../glossary.rst:1255 +#: ../../glossary.rst:1285 msgid "" "Variable annotations are usually used for :term:`type hints `: " "for example this variable is expected to take :class:`int` values::" @@ -2875,15 +2921,15 @@ msgstr "" "變數註釋通常用於\\ :term:`型別提示 (type hint) `:例如,這個變數預" "期會取得 :class:`int`\\ (整數)值: ::" -#: ../../glossary.rst:1259 +#: ../../glossary.rst:1289 msgid "count: int = 0" msgstr "count: int = 0" -#: ../../glossary.rst:1261 +#: ../../glossary.rst:1291 msgid "Variable annotation syntax is explained in section :ref:`annassign`." msgstr "變數註釋的語法在\\ :ref:`annassign`\\ 章節有詳細的解釋。" -#: ../../glossary.rst:1263 +#: ../../glossary.rst:1293 msgid "" "See :term:`function annotation`, :pep:`484` and :pep:`526`, which describe " "this functionality. Also see :ref:`annotations-howto` for best practices on " @@ -2892,11 +2938,11 @@ msgstr "" "請參閱 :term:`function annotation`\\ (函式註釋)、:pep:`484` 和 :pep:`526`," "皆有此功能的描述。關於註釋的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:1267 +#: ../../glossary.rst:1297 msgid "virtual environment" msgstr "virtual environment(虛擬環境)" -#: ../../glossary.rst:1269 +#: ../../glossary.rst:1299 msgid "" "A cooperatively isolated runtime environment that allows Python users and " "applications to install and upgrade Python distribution packages without " @@ -2907,15 +2953,15 @@ msgstr "" "程式得以安裝和升級 Python 發佈套件,而不會對同一個系統上運行的其他 Python 應" "用程式的行為產生干擾。" -#: ../../glossary.rst:1274 +#: ../../glossary.rst:1304 msgid "See also :mod:`venv`." msgstr "另請參閱 :mod:`venv`。" -#: ../../glossary.rst:1275 +#: ../../glossary.rst:1305 msgid "virtual machine" msgstr "virtual machine(虛擬機器)" -#: ../../glossary.rst:1277 +#: ../../glossary.rst:1307 msgid "" "A computer defined entirely in software. Python's virtual machine executes " "the :term:`bytecode` emitted by the bytecode compiler." @@ -2923,11 +2969,11 @@ msgstr "" "一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行由 :term:" "`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" -#: ../../glossary.rst:1279 +#: ../../glossary.rst:1309 msgid "Zen of Python" msgstr "Zen of Python(Python 之禪)" -#: ../../glossary.rst:1281 +#: ../../glossary.rst:1311 msgid "" "Listing of Python design principles and philosophies that are helpful in " "understanding and using the language. The listing can be found by typing " @@ -2936,18 +2982,49 @@ msgstr "" "Python 設計原則與哲學的列表,其內容有助於理解和使用此語言。此列表可以透過在互" "動式提式字元後輸入「``import this``」來找到它。" -#: ../../glossary.rst:264 +#: ../../glossary.rst:256 msgid "C-contiguous" msgstr "C-contiguous(C 連續的)" -#: ../../glossary.rst:264 +#: ../../glossary.rst:256 msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" -#: ../../glossary.rst:769 +#: ../../glossary.rst:771 msgid "magic" msgstr "magic" -#: ../../glossary.rst:1138 +#: ../../glossary.rst:1168 msgid "special" msgstr "special" + +#~ msgid "2to3" +#~ msgstr "2to3" + +#~ msgid "" +#~ "A tool that tries to convert Python 2.x code to Python 3.x code by " +#~ "handling most of the incompatibilities which can be detected by parsing " +#~ "the source and traversing the parse tree." +#~ msgstr "" +#~ "一個試著將 Python 2.x 程式碼轉換為 Python 3.x 程式碼的工具,它是透過處理大" +#~ "部分的不相容性來達成此目的,而這些不相容性能夠透過剖析原始碼和遍歷剖析樹而" +#~ "被檢測出來。" + +#~ msgid "" +#~ "2to3 is available in the standard library as :mod:`lib2to3`; a standalone " +#~ "entry point is provided as :file:`Tools/scripts/2to3`. See :ref:`2to3-" +#~ "reference`." +#~ msgstr "" +#~ "2to3 在可以標準函式庫中以 :mod:`lib2to3` 被使用;它提供了一個獨立的入口" +#~ "點,在 :file:`Tools/scripts/2to3`。請參閱 :ref:`2to3-reference`。" + +#~ msgid "" +#~ "Past efforts to create a \"free-threaded\" interpreter (one which locks " +#~ "shared data at a much finer granularity) have not been successful because " +#~ "performance suffered in the common single-processor case. It is believed " +#~ "that overcoming this performance issue would make the implementation much " +#~ "more complicated and therefore costlier to maintain." +#~ msgstr "" +#~ "過去對於建立「無限制執行緒」直譯器(以更高的精細度鎖定共享資料的直譯器)的" +#~ "努力並未成功,因為在一般的單一處理器情況下,效能會有所損失。一般認為,若要" +#~ "克服這個效能問題,會使實作變得複雜許多,進而付出更高的維護成本。" diff --git a/howto/descriptor.po b/howto/descriptor.po index 09c6f7afd2..6cc6a29c8f 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1201,7 +1201,8 @@ msgstr "" #: ../../howto/descriptor.rst:992 msgid "" "To see how :func:`property` is implemented in terms of the descriptor " -"protocol, here is a pure Python equivalent:" +"protocol, here is a pure Python equivalent that implements most of the core " +"functionality:" msgstr "" #: ../../howto/descriptor.rst:995 @@ -1216,61 +1217,46 @@ msgid "" " if doc is None and fget is not None:\n" " doc = fget.__doc__\n" " self.__doc__ = doc\n" -" self._name = ''\n" +" self.__name__ = ''\n" "\n" " def __set_name__(self, owner, name):\n" -" self._name = name\n" +" self.__name__ = name\n" "\n" " def __get__(self, obj, objtype=None):\n" " if obj is None:\n" " return self\n" " if self.fget is None:\n" -" raise AttributeError(\n" -" f'property {self._name!r} of {type(obj).__name__!r} object " -"has no getter'\n" -" )\n" +" raise AttributeError\n" " return self.fget(obj)\n" "\n" " def __set__(self, obj, value):\n" " if self.fset is None:\n" -" raise AttributeError(\n" -" f'property {self._name!r} of {type(obj).__name__!r} object " -"has no setter'\n" -" )\n" +" raise AttributeError\n" " self.fset(obj, value)\n" "\n" " def __delete__(self, obj):\n" " if self.fdel is None:\n" -" raise AttributeError(\n" -" f'property {self._name!r} of {type(obj).__name__!r} object " -"has no deleter'\n" -" )\n" +" raise AttributeError\n" " self.fdel(obj)\n" "\n" " def getter(self, fget):\n" -" prop = type(self)(fget, self.fset, self.fdel, self.__doc__)\n" -" prop._name = self._name\n" -" return prop\n" +" return type(self)(fget, self.fset, self.fdel, self.__doc__)\n" "\n" " def setter(self, fset):\n" -" prop = type(self)(self.fget, fset, self.fdel, self.__doc__)\n" -" prop._name = self._name\n" -" return prop\n" +" return type(self)(self.fget, fset, self.fdel, self.__doc__)\n" "\n" " def deleter(self, fdel):\n" -" prop = type(self)(self.fget, self.fset, fdel, self.__doc__)\n" -" prop._name = self._name\n" -" return prop" +" return type(self)(self.fget, self.fset, fdel, self.__doc__)" msgstr "" -#: ../../howto/descriptor.rst:1132 +#: ../../howto/descriptor.rst:1120 msgid "" "The :func:`property` builtin helps whenever a user interface has granted " "attribute access and then subsequent changes require the intervention of a " "method." msgstr "" -#: ../../howto/descriptor.rst:1136 +#: ../../howto/descriptor.rst:1124 msgid "" "For instance, a spreadsheet class may grant access to a cell value through " "``Cell('b10').value``. Subsequent improvements to the program require the " @@ -1280,7 +1266,7 @@ msgid "" "descriptor:" msgstr "" -#: ../../howto/descriptor.rst:1142 +#: ../../howto/descriptor.rst:1130 msgid "" "class Cell:\n" " ...\n" @@ -1292,23 +1278,23 @@ msgid "" " return self._value" msgstr "" -#: ../../howto/descriptor.rst:1153 +#: ../../howto/descriptor.rst:1141 msgid "" "Either the built-in :func:`property` or our :func:`Property` equivalent " "would work in this example." msgstr "" -#: ../../howto/descriptor.rst:1158 +#: ../../howto/descriptor.rst:1146 msgid "Functions and methods" msgstr "" -#: ../../howto/descriptor.rst:1160 +#: ../../howto/descriptor.rst:1148 msgid "" "Python's object oriented features are built upon a function based " "environment. Using non-data descriptors, the two are merged seamlessly." msgstr "" -#: ../../howto/descriptor.rst:1163 +#: ../../howto/descriptor.rst:1151 msgid "" "Functions stored in class dictionaries get turned into methods when invoked. " "Methods only differ from regular functions in that the object instance is " @@ -1316,13 +1302,13 @@ msgid "" "*self* but could be called *this* or any other variable name." msgstr "" -#: ../../howto/descriptor.rst:1168 +#: ../../howto/descriptor.rst:1156 msgid "" "Methods can be created manually with :class:`types.MethodType` which is " "roughly equivalent to:" msgstr "" -#: ../../howto/descriptor.rst:1171 +#: ../../howto/descriptor.rst:1159 msgid "" "class MethodType:\n" " \"Emulate PyMethod_Type in Objects/classobject.c\"\n" @@ -1334,10 +1320,24 @@ msgid "" " def __call__(self, *args, **kwargs):\n" " func = self.__func__\n" " obj = self.__self__\n" -" return func(obj, *args, **kwargs)" +" return func(obj, *args, **kwargs)\n" +"\n" +" def __getattribute__(self, name):\n" +" \"Emulate method_getset() in Objects/classobject.c\"\n" +" if name == '__doc__':\n" +" return self.__func__.__doc__\n" +" return object.__getattribute__(self, name)\n" +"\n" +" def __getattr__(self, name):\n" +" \"Emulate method_getattro() in Objects/classobject.c\"\n" +" return getattr(self.__func__, name)\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" \"Emulate method_descr_get() in Objects/classobject.c\"\n" +" return self" msgstr "" -#: ../../howto/descriptor.rst:1185 +#: ../../howto/descriptor.rst:1187 msgid "" "To support automatic creation of methods, functions include the :meth:" "`__get__` method for binding methods during attribute access. This means " @@ -1345,7 +1345,7 @@ msgid "" "dotted lookup from an instance. Here's how it works:" msgstr "" -#: ../../howto/descriptor.rst:1190 +#: ../../howto/descriptor.rst:1192 msgid "" "class Function:\n" " ...\n" @@ -1357,28 +1357,32 @@ msgid "" " return MethodType(self, obj)" msgstr "" -#: ../../howto/descriptor.rst:1201 +#: ../../howto/descriptor.rst:1203 msgid "" "Running the following class in the interpreter shows how the function " "descriptor works in practice:" msgstr "" -#: ../../howto/descriptor.rst:1204 +#: ../../howto/descriptor.rst:1206 +#, fuzzy msgid "" "class D:\n" -" def f(self, x):\n" -" return x" +" def f(self):\n" +" return self\n" +"\n" +"class D2:\n" +" pass" msgstr "" "class D:\n" " def f(self, x):\n" " return x" -#: ../../howto/descriptor.rst:1210 +#: ../../howto/descriptor.rst:1224 msgid "" "The function has a :term:`qualified name` attribute to support introspection:" msgstr "" -#: ../../howto/descriptor.rst:1212 +#: ../../howto/descriptor.rst:1226 msgid "" ">>> D.f.__qualname__\n" "'D.f'" @@ -1386,13 +1390,13 @@ msgstr "" ">>> D.f.__qualname__\n" "'D.f'" -#: ../../howto/descriptor.rst:1217 +#: ../../howto/descriptor.rst:1231 msgid "" "Accessing the function through the class dictionary does not invoke :meth:" "`__get__`. Instead, it just returns the underlying function object::" msgstr "" -#: ../../howto/descriptor.rst:1220 +#: ../../howto/descriptor.rst:1234 msgid "" ">>> D.__dict__['f']\n" "" @@ -1400,13 +1404,13 @@ msgstr "" ">>> D.__dict__['f']\n" "" -#: ../../howto/descriptor.rst:1223 +#: ../../howto/descriptor.rst:1237 msgid "" "Dotted access from a class calls :meth:`__get__` which just returns the " "underlying function unchanged::" msgstr "" -#: ../../howto/descriptor.rst:1226 +#: ../../howto/descriptor.rst:1240 msgid "" ">>> D.f\n" "" @@ -1414,13 +1418,13 @@ msgstr "" ">>> D.f\n" "" -#: ../../howto/descriptor.rst:1229 +#: ../../howto/descriptor.rst:1243 msgid "" "The interesting behavior occurs during dotted access from an instance. The " "dotted lookup calls :meth:`__get__` which returns a bound method object::" msgstr "" -#: ../../howto/descriptor.rst:1232 +#: ../../howto/descriptor.rst:1246 msgid "" ">>> d = D()\n" ">>> d.f\n" @@ -1430,13 +1434,13 @@ msgstr "" ">>> d.f\n" ">" -#: ../../howto/descriptor.rst:1236 +#: ../../howto/descriptor.rst:1250 msgid "" "Internally, the bound method stores the underlying function and the bound " "instance::" msgstr "" -#: ../../howto/descriptor.rst:1239 +#: ../../howto/descriptor.rst:1253 msgid "" ">>> d.f.__func__\n" "\n" @@ -1450,23 +1454,23 @@ msgstr "" ">>> d.f.__self__\n" "<__main__.D object at 0x00B18C90>" -#: ../../howto/descriptor.rst:1245 +#: ../../howto/descriptor.rst:1259 msgid "" "If you have ever wondered where *self* comes from in regular methods or " "where *cls* comes from in class methods, this is it!" msgstr "" -#: ../../howto/descriptor.rst:1250 +#: ../../howto/descriptor.rst:1264 msgid "Kinds of methods" msgstr "" -#: ../../howto/descriptor.rst:1252 +#: ../../howto/descriptor.rst:1266 msgid "" "Non-data descriptors provide a simple mechanism for variations on the usual " "patterns of binding functions into methods." msgstr "" -#: ../../howto/descriptor.rst:1255 +#: ../../howto/descriptor.rst:1269 msgid "" "To recap, functions have a :meth:`__get__` method so that they can be " "converted to a method when accessed as attributes. The non-data descriptor " @@ -1474,55 +1478,55 @@ msgid "" "f(*args)`` becomes ``f(*args)``." msgstr "" -#: ../../howto/descriptor.rst:1260 +#: ../../howto/descriptor.rst:1274 msgid "This chart summarizes the binding and its two most useful variants:" msgstr "" -#: ../../howto/descriptor.rst:1263 +#: ../../howto/descriptor.rst:1277 msgid "Transformation" msgstr "" -#: ../../howto/descriptor.rst:1263 +#: ../../howto/descriptor.rst:1277 msgid "Called from an object" msgstr "" -#: ../../howto/descriptor.rst:1263 +#: ../../howto/descriptor.rst:1277 msgid "Called from a class" msgstr "" -#: ../../howto/descriptor.rst:1266 +#: ../../howto/descriptor.rst:1280 msgid "function" msgstr "函式" -#: ../../howto/descriptor.rst:1266 +#: ../../howto/descriptor.rst:1280 msgid "f(obj, \\*args)" msgstr "f(obj, \\*args)" -#: ../../howto/descriptor.rst:1266 ../../howto/descriptor.rst:1268 +#: ../../howto/descriptor.rst:1280 ../../howto/descriptor.rst:1282 msgid "f(\\*args)" msgstr "f(\\*args)" -#: ../../howto/descriptor.rst:1268 +#: ../../howto/descriptor.rst:1282 msgid "staticmethod" msgstr "staticmethod" -#: ../../howto/descriptor.rst:1270 +#: ../../howto/descriptor.rst:1284 msgid "classmethod" msgstr "classmethod" -#: ../../howto/descriptor.rst:1270 +#: ../../howto/descriptor.rst:1284 msgid "f(type(obj), \\*args)" msgstr "f(type(obj), \\*args)" -#: ../../howto/descriptor.rst:1270 +#: ../../howto/descriptor.rst:1284 msgid "f(cls, \\*args)" msgstr "f(cls, \\*args)" -#: ../../howto/descriptor.rst:1275 +#: ../../howto/descriptor.rst:1289 msgid "Static methods" msgstr "" -#: ../../howto/descriptor.rst:1277 +#: ../../howto/descriptor.rst:1291 msgid "" "Static methods return the underlying function without changes. Calling " "either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into ``object." @@ -1531,13 +1535,13 @@ msgid "" "a class." msgstr "" -#: ../../howto/descriptor.rst:1283 +#: ../../howto/descriptor.rst:1297 msgid "" "Good candidates for static methods are methods that do not reference the " "``self`` variable." msgstr "" -#: ../../howto/descriptor.rst:1286 +#: ../../howto/descriptor.rst:1300 msgid "" "For instance, a statistics package may include a container class for " "experimental data. The class provides normal methods for computing the " @@ -1549,13 +1553,13 @@ msgid "" "``s.erf(1.5) --> .9332`` or ``Sample.erf(1.5) --> .9332``." msgstr "" -#: ../../howto/descriptor.rst:1295 +#: ../../howto/descriptor.rst:1309 msgid "" "Since static methods return the underlying function with no changes, the " "example calls are unexciting:" msgstr "" -#: ../../howto/descriptor.rst:1298 +#: ../../howto/descriptor.rst:1312 msgid "" "class E:\n" " @staticmethod\n" @@ -1567,7 +1571,7 @@ msgstr "" " def f(x):\n" " return x * 10" -#: ../../howto/descriptor.rst:1305 +#: ../../howto/descriptor.rst:1319 msgid "" ">>> E.f(3)\n" "30\n" @@ -1579,13 +1583,13 @@ msgstr "" ">>> E().f(3)\n" "30" -#: ../../howto/descriptor.rst:1312 +#: ../../howto/descriptor.rst:1326 msgid "" "Using the non-data descriptor protocol, a pure Python version of :func:" "`staticmethod` would look like this:" msgstr "" -#: ../../howto/descriptor.rst:1315 +#: ../../howto/descriptor.rst:1329 msgid "" "import functools\n" "\n" @@ -1603,7 +1607,7 @@ msgid "" " return self.f(*args, **kwds)" msgstr "" -#: ../../howto/descriptor.rst:1332 +#: ../../howto/descriptor.rst:1346 msgid "" "The :func:`functools.update_wrapper` call adds a ``__wrapped__`` attribute " "that refers to the underlying function. Also it carries forward the " @@ -1612,18 +1616,18 @@ msgid "" "__doc__`, and :attr:`~function.__annotations__`." msgstr "" -#: ../../howto/descriptor.rst:1401 +#: ../../howto/descriptor.rst:1415 msgid "Class methods" msgstr "" -#: ../../howto/descriptor.rst:1403 +#: ../../howto/descriptor.rst:1417 msgid "" "Unlike static methods, class methods prepend the class reference to the " "argument list before calling the function. This format is the same for " "whether the caller is an object or a class:" msgstr "" -#: ../../howto/descriptor.rst:1407 +#: ../../howto/descriptor.rst:1421 msgid "" "class F:\n" " @classmethod\n" @@ -1635,7 +1639,7 @@ msgstr "" " def f(cls, x):\n" " return cls.__name__, x" -#: ../../howto/descriptor.rst:1414 +#: ../../howto/descriptor.rst:1428 msgid "" ">>> F.f(3)\n" "('F', 3)\n" @@ -1647,7 +1651,7 @@ msgstr "" ">>> F().f(3)\n" "('F', 3)" -#: ../../howto/descriptor.rst:1421 +#: ../../howto/descriptor.rst:1435 msgid "" "This behavior is useful whenever the method only needs to have a class " "reference and does not rely on data stored in a specific instance. One use " @@ -1656,7 +1660,7 @@ msgid "" "of keys. The pure Python equivalent is:" msgstr "" -#: ../../howto/descriptor.rst:1427 +#: ../../howto/descriptor.rst:1441 msgid "" "class Dict(dict):\n" " @classmethod\n" @@ -1668,11 +1672,11 @@ msgid "" " return d" msgstr "" -#: ../../howto/descriptor.rst:1438 +#: ../../howto/descriptor.rst:1452 msgid "Now a new dictionary of unique keys can be constructed like this:" msgstr "" -#: ../../howto/descriptor.rst:1440 +#: ../../howto/descriptor.rst:1454 msgid "" ">>> d = Dict.fromkeys('abracadabra')\n" ">>> type(d) is Dict\n" @@ -1686,13 +1690,13 @@ msgstr "" ">>> d\n" "{'a': None, 'b': None, 'r': None, 'c': None, 'd': None}" -#: ../../howto/descriptor.rst:1448 +#: ../../howto/descriptor.rst:1462 msgid "" "Using the non-data descriptor protocol, a pure Python version of :func:" "`classmethod` would look like this:" msgstr "" -#: ../../howto/descriptor.rst:1451 +#: ../../howto/descriptor.rst:1465 msgid "" "import functools\n" "\n" @@ -1706,44 +1710,10 @@ msgid "" " def __get__(self, obj, cls=None):\n" " if cls is None:\n" " cls = type(obj)\n" -" if hasattr(type(self.f), '__get__'):\n" -" # This code path was added in Python 3.9\n" -" # and was deprecated in Python 3.11.\n" -" return self.f.__get__(cls, cls)\n" " return MethodType(self.f, cls)" msgstr "" -#: ../../howto/descriptor.rst:1526 -msgid "" -"The code path for ``hasattr(type(self.f), '__get__')`` was added in Python " -"3.9 and makes it possible for :func:`classmethod` to support chained " -"decorators. For example, a classmethod and property could be chained " -"together. In Python 3.11, this functionality was deprecated." -msgstr "" - -#: ../../howto/descriptor.rst:1531 -msgid "" -"class G:\n" -" @classmethod\n" -" @property\n" -" def __doc__(cls):\n" -" return f'A doc for {cls.__name__!r}'" -msgstr "" -"class G:\n" -" @classmethod\n" -" @property\n" -" def __doc__(cls):\n" -" return f'A doc for {cls.__name__!r}'" - -#: ../../howto/descriptor.rst:1539 -msgid "" -">>> G.__doc__\n" -"\"A doc for 'G'\"" -msgstr "" -">>> G.__doc__\n" -"\"A doc for 'G'\"" - -#: ../../howto/descriptor.rst:1544 +#: ../../howto/descriptor.rst:1527 msgid "" "The :func:`functools.update_wrapper` call in ``ClassMethod`` adds a " "``__wrapped__`` attribute that refers to the underlying function. Also it " @@ -1753,24 +1723,24 @@ msgid "" "__annotations__`." msgstr "" -#: ../../howto/descriptor.rst:1553 +#: ../../howto/descriptor.rst:1536 msgid "Member objects and __slots__" msgstr "" -#: ../../howto/descriptor.rst:1555 +#: ../../howto/descriptor.rst:1538 msgid "" "When a class defines ``__slots__``, it replaces instance dictionaries with a " "fixed-length array of slot values. From a user point of view that has " "several effects:" msgstr "" -#: ../../howto/descriptor.rst:1559 +#: ../../howto/descriptor.rst:1542 msgid "" "1. Provides immediate detection of bugs due to misspelled attribute " "assignments. Only attribute names specified in ``__slots__`` are allowed:" msgstr "" -#: ../../howto/descriptor.rst:1562 +#: ../../howto/descriptor.rst:1545 msgid "" "class Vehicle:\n" " __slots__ = ('id_number', 'make', 'model')" @@ -1778,7 +1748,7 @@ msgstr "" "class Vehicle:\n" " __slots__ = ('id_number', 'make', 'model')" -#: ../../howto/descriptor.rst:1567 +#: ../../howto/descriptor.rst:1550 msgid "" ">>> auto = Vehicle()\n" ">>> auto.id_nubmer = 'VYE483814LQEX'\n" @@ -1792,13 +1762,13 @@ msgstr "" " ...\n" "AttributeError: 'Vehicle' object has no attribute 'id_nubmer'" -#: ../../howto/descriptor.rst:1575 +#: ../../howto/descriptor.rst:1558 msgid "" "2. Helps create immutable objects where descriptors manage access to private " "attributes stored in ``__slots__``:" msgstr "" -#: ../../howto/descriptor.rst:1578 +#: ../../howto/descriptor.rst:1561 msgid "" "class Immutable:\n" "\n" @@ -1818,7 +1788,7 @@ msgid "" " return self._name" msgstr "" -#: ../../howto/descriptor.rst:1596 +#: ../../howto/descriptor.rst:1579 msgid "" ">>> mark = Immutable('Botany', 'Mark Watney')\n" ">>> mark.dept\n" @@ -1844,7 +1814,7 @@ msgstr "" " ...\n" "AttributeError: 'Immutable' object has no attribute 'location'" -#: ../../howto/descriptor.rst:1610 +#: ../../howto/descriptor.rst:1593 msgid "" "3. Saves memory. On a 64-bit Linux build, an instance with two attributes " "takes 48 bytes with ``__slots__`` and 152 bytes without. This `flyweight " @@ -1852,19 +1822,19 @@ msgid "" "only matters when a large number of instances are going to be created." msgstr "" -#: ../../howto/descriptor.rst:1615 +#: ../../howto/descriptor.rst:1598 msgid "" "4. Improves speed. Reading instance variables is 35% faster with " "``__slots__`` (as measured with Python 3.10 on an Apple M1 processor)." msgstr "" -#: ../../howto/descriptor.rst:1618 +#: ../../howto/descriptor.rst:1601 msgid "" "5. Blocks tools like :func:`functools.cached_property` which require an " "instance dictionary to function correctly:" msgstr "" -#: ../../howto/descriptor.rst:1621 +#: ../../howto/descriptor.rst:1604 msgid "" "from functools import cached_property\n" "\n" @@ -1877,7 +1847,7 @@ msgid "" " for n in reversed(range(100_000)))" msgstr "" -#: ../../howto/descriptor.rst:1633 +#: ../../howto/descriptor.rst:1616 msgid "" ">>> CP().pi\n" "Traceback (most recent call last):\n" @@ -1889,7 +1859,7 @@ msgstr "" " ...\n" "TypeError: No '__dict__' attribute on 'CP' instance to cache 'pi' property." -#: ../../howto/descriptor.rst:1640 +#: ../../howto/descriptor.rst:1623 msgid "" "It is not possible to create an exact drop-in pure Python version of " "``__slots__`` because it requires direct access to C structures and control " @@ -1899,7 +1869,7 @@ msgid "" "managed by member descriptors:" msgstr "" -#: ../../howto/descriptor.rst:1647 +#: ../../howto/descriptor.rst:1630 msgid "" "null = object()\n" "\n" @@ -1938,13 +1908,13 @@ msgid "" " return f''" msgstr "" -#: ../../howto/descriptor.rst:1685 +#: ../../howto/descriptor.rst:1668 msgid "" "The :meth:`type.__new__` method takes care of adding member objects to class " "variables:" msgstr "" -#: ../../howto/descriptor.rst:1688 +#: ../../howto/descriptor.rst:1671 msgid "" "class Type(type):\n" " 'Simulate how the type metaclass adds member objects for slots'\n" @@ -1958,14 +1928,14 @@ msgid "" " return type.__new__(mcls, clsname, bases, mapping, **kwargs)" msgstr "" -#: ../../howto/descriptor.rst:1701 +#: ../../howto/descriptor.rst:1684 msgid "" "The :meth:`object.__new__` method takes care of creating instances that have " "slots instead of an instance dictionary. Here is a rough simulation in pure " "Python:" msgstr "" -#: ../../howto/descriptor.rst:1705 +#: ../../howto/descriptor.rst:1688 msgid "" "class Object:\n" " 'Simulate how object.__new__() allocates memory for __slots__'\n" @@ -1997,13 +1967,13 @@ msgid "" " super().__delattr__(name)" msgstr "" -#: ../../howto/descriptor.rst:1736 +#: ../../howto/descriptor.rst:1719 msgid "" "To use the simulation in a real class, just inherit from :class:`Object` and " "set the :term:`metaclass` to :class:`Type`:" msgstr "" -#: ../../howto/descriptor.rst:1739 +#: ../../howto/descriptor.rst:1722 msgid "" "class H(Object, metaclass=Type):\n" " 'Instance variables stored in slots'\n" @@ -2015,12 +1985,12 @@ msgid "" " self.y = y" msgstr "" -#: ../../howto/descriptor.rst:1750 +#: ../../howto/descriptor.rst:1733 msgid "" "At this point, the metaclass has loaded member objects for *x* and *y*::" msgstr "" -#: ../../howto/descriptor.rst:1752 +#: ../../howto/descriptor.rst:1735 msgid "" ">>> from pprint import pp\n" ">>> pp(dict(vars(H)))\n" @@ -2040,13 +2010,13 @@ msgstr "" " 'x': ,\n" " 'y': }" -#: ../../howto/descriptor.rst:1771 +#: ../../howto/descriptor.rst:1754 msgid "" "When instances are created, they have a ``slot_values`` list where the " "attributes are stored:" msgstr "" -#: ../../howto/descriptor.rst:1774 +#: ../../howto/descriptor.rst:1757 msgid "" ">>> h = H(10, 20)\n" ">>> vars(h)\n" @@ -2062,11 +2032,11 @@ msgstr "" ">>> vars(h)\n" "{'_slotvalues': [55, 20]}" -#: ../../howto/descriptor.rst:1783 +#: ../../howto/descriptor.rst:1766 msgid "Misspelled or unassigned attributes will raise an exception:" msgstr "" -#: ../../howto/descriptor.rst:1785 +#: ../../howto/descriptor.rst:1768 msgid "" ">>> h.xz\n" "Traceback (most recent call last):\n" @@ -2077,3 +2047,23 @@ msgstr "" "Traceback (most recent call last):\n" " ...\n" "AttributeError: 'H' object has no attribute 'xz'" + +#~ msgid "" +#~ "class G:\n" +#~ " @classmethod\n" +#~ " @property\n" +#~ " def __doc__(cls):\n" +#~ " return f'A doc for {cls.__name__!r}'" +#~ msgstr "" +#~ "class G:\n" +#~ " @classmethod\n" +#~ " @property\n" +#~ " def __doc__(cls):\n" +#~ " return f'A doc for {cls.__name__!r}'" + +#~ msgid "" +#~ ">>> G.__doc__\n" +#~ "\"A doc for 'G'\"" +#~ msgstr "" +#~ ">>> G.__doc__\n" +#~ "\"A doc for 'G'\"" diff --git a/howto/enum.po b/howto/enum.po index 17361c7a2b..8e243e281d 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,24 +17,24 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ../../howto/enum.rst:3 +#: ../../howto/enum.rst:5 msgid "Enum HOWTO" msgstr "" -#: ../../howto/enum.rst:9 +#: ../../howto/enum.rst:11 msgid "" "An :class:`Enum` is a set of symbolic names bound to unique values. They " "are similar to global variables, but they offer a more useful :func:`repr`, " "grouping, type-safety, and a few other features." msgstr "" -#: ../../howto/enum.rst:13 +#: ../../howto/enum.rst:15 msgid "" "They are most useful when you have a variable that can take one of a limited " "selection of values. For example, the days of the week::" msgstr "" -#: ../../howto/enum.rst:16 +#: ../../howto/enum.rst:18 msgid "" ">>> from enum import Enum\n" ">>> class Weekday(Enum):\n" @@ -47,11 +47,11 @@ msgid "" "... SUNDAY = 7" msgstr "" -#: ../../howto/enum.rst:26 +#: ../../howto/enum.rst:28 msgid "Or perhaps the RGB primary colors::" msgstr "" -#: ../../howto/enum.rst:28 +#: ../../howto/enum.rst:30 msgid "" ">>> from enum import Enum\n" ">>> class Color(Enum):\n" @@ -60,17 +60,17 @@ msgid "" "... BLUE = 3" msgstr "" -#: ../../howto/enum.rst:34 +#: ../../howto/enum.rst:36 msgid "" "As you can see, creating an :class:`Enum` is as simple as writing a class " "that inherits from :class:`Enum` itself." msgstr "" -#: ../../howto/enum.rst:37 +#: ../../howto/enum.rst:39 msgid "Case of Enum Members" msgstr "" -#: ../../howto/enum.rst:39 +#: ../../howto/enum.rst:41 msgid "" "Because Enums are used to represent constants, and to help avoid issues with " "name clashes between mixin-class methods/attributes and enum names, we " @@ -78,14 +78,14 @@ msgid "" "that style in our examples." msgstr "" -#: ../../howto/enum.rst:44 +#: ../../howto/enum.rst:46 msgid "" "Depending on the nature of the enum a member's value may or may not be " "important, but either way that value can be used to get the corresponding " "member::" msgstr "" -#: ../../howto/enum.rst:48 +#: ../../howto/enum.rst:50 msgid "" ">>> Weekday(3)\n" "" @@ -93,14 +93,14 @@ msgstr "" ">>> Weekday(3)\n" "" -#: ../../howto/enum.rst:51 +#: ../../howto/enum.rst:53 msgid "" "As you can see, the ``repr()`` of a member shows the enum name, the member " "name, and the value. The ``str()`` of a member shows only the enum name and " "member name::" msgstr "" -#: ../../howto/enum.rst:55 +#: ../../howto/enum.rst:57 msgid "" ">>> print(Weekday.THURSDAY)\n" "Weekday.THURSDAY" @@ -108,11 +108,11 @@ msgstr "" ">>> print(Weekday.THURSDAY)\n" "Weekday.THURSDAY" -#: ../../howto/enum.rst:58 +#: ../../howto/enum.rst:60 msgid "The *type* of an enumeration member is the enum it belongs to::" msgstr "" -#: ../../howto/enum.rst:60 +#: ../../howto/enum.rst:62 msgid "" ">>> type(Weekday.MONDAY)\n" "\n" @@ -120,11 +120,11 @@ msgid "" "True" msgstr "" -#: ../../howto/enum.rst:65 +#: ../../howto/enum.rst:67 msgid "Enum members have an attribute that contains just their :attr:`name`::" msgstr "" -#: ../../howto/enum.rst:67 +#: ../../howto/enum.rst:69 msgid "" ">>> print(Weekday.TUESDAY.name)\n" "TUESDAY" @@ -132,11 +132,11 @@ msgstr "" ">>> print(Weekday.TUESDAY.name)\n" "TUESDAY" -#: ../../howto/enum.rst:70 +#: ../../howto/enum.rst:72 msgid "Likewise, they have an attribute for their :attr:`value`::" msgstr "" -#: ../../howto/enum.rst:73 +#: ../../howto/enum.rst:75 msgid "" ">>> Weekday.WEDNESDAY.value\n" "3" @@ -144,7 +144,7 @@ msgstr "" ">>> Weekday.WEDNESDAY.value\n" "3" -#: ../../howto/enum.rst:76 +#: ../../howto/enum.rst:78 msgid "" "Unlike many languages that treat enumerations solely as name/value pairs, " "Python Enums can have behavior added. For example, :class:`datetime.date` " @@ -155,18 +155,18 @@ msgid "" "instance and return the matching enum member::" msgstr "" -#: ../../howto/enum.rst:84 +#: ../../howto/enum.rst:86 msgid "" "@classmethod\n" "def from_date(cls, date):\n" " return cls(date.isoweekday())" msgstr "" -#: ../../howto/enum.rst:88 +#: ../../howto/enum.rst:90 msgid "The complete :class:`Weekday` enum now looks like this::" msgstr "" -#: ../../howto/enum.rst:90 +#: ../../howto/enum.rst:92 msgid "" ">>> class Weekday(Enum):\n" "... MONDAY = 1\n" @@ -194,24 +194,24 @@ msgstr "" "... def from_date(cls, date):\n" "... return cls(date.isoweekday())" -#: ../../howto/enum.rst:103 +#: ../../howto/enum.rst:105 msgid "Now we can find out what today is! Observe::" msgstr "" -#: ../../howto/enum.rst:105 +#: ../../howto/enum.rst:107 msgid "" ">>> from datetime import date\n" ">>> Weekday.from_date(date.today()) \n" "" msgstr "" -#: ../../howto/enum.rst:109 +#: ../../howto/enum.rst:111 msgid "" "Of course, if you're reading this on some other day, you'll see that day " "instead." msgstr "" -#: ../../howto/enum.rst:111 +#: ../../howto/enum.rst:113 msgid "" "This :class:`Weekday` enum is great if our variable only needs one day, but " "what if we need several? Maybe we're writing a function to plot chores " @@ -219,7 +219,7 @@ msgid "" "different type of :class:`Enum`::" msgstr "" -#: ../../howto/enum.rst:116 +#: ../../howto/enum.rst:118 msgid "" ">>> from enum import Flag\n" ">>> class Weekday(Flag):\n" @@ -241,19 +241,19 @@ msgstr "" "... SATURDAY = 32\n" "... SUNDAY = 64" -#: ../../howto/enum.rst:126 +#: ../../howto/enum.rst:128 msgid "" "We've changed two things: we're inherited from :class:`Flag`, and the values " "are all powers of 2." msgstr "" -#: ../../howto/enum.rst:129 +#: ../../howto/enum.rst:131 msgid "" "Just like the original :class:`Weekday` enum above, we can have a single " "selection::" msgstr "" -#: ../../howto/enum.rst:131 +#: ../../howto/enum.rst:133 msgid "" ">>> first_week_day = Weekday.MONDAY\n" ">>> first_week_day\n" @@ -263,13 +263,13 @@ msgstr "" ">>> first_week_day\n" "" -#: ../../howto/enum.rst:135 +#: ../../howto/enum.rst:137 msgid "" "But :class:`Flag` also allows us to combine several members into a single " "variable::" msgstr "" -#: ../../howto/enum.rst:138 +#: ../../howto/enum.rst:140 msgid "" ">>> weekend = Weekday.SATURDAY | Weekday.SUNDAY\n" ">>> weekend\n" @@ -279,11 +279,11 @@ msgstr "" ">>> weekend\n" "" -#: ../../howto/enum.rst:142 +#: ../../howto/enum.rst:144 msgid "You can even iterate over a :class:`Flag` variable::" msgstr "" -#: ../../howto/enum.rst:144 +#: ../../howto/enum.rst:146 msgid "" ">>> for day in weekend:\n" "... print(day)\n" @@ -295,11 +295,11 @@ msgstr "" "Weekday.SATURDAY\n" "Weekday.SUNDAY" -#: ../../howto/enum.rst:149 +#: ../../howto/enum.rst:151 msgid "Okay, let's get some chores set up::" msgstr "" -#: ../../howto/enum.rst:151 +#: ../../howto/enum.rst:153 msgid "" ">>> chores_for_ethan = {\n" "... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday." @@ -315,11 +315,11 @@ msgstr "" "... 'answer SO questions': Weekday.SATURDAY,\n" "... }" -#: ../../howto/enum.rst:157 +#: ../../howto/enum.rst:159 msgid "And a function to display the chores for a given day::" msgstr "" -#: ../../howto/enum.rst:159 +#: ../../howto/enum.rst:161 msgid "" ">>> def show_chores(chores, day):\n" "... for chore, days in chores.items():\n" @@ -337,13 +337,13 @@ msgstr "" ">>> show_chores(chores_for_ethan, Weekday.SATURDAY)\n" "answer SO questions" -#: ../../howto/enum.rst:167 +#: ../../howto/enum.rst:169 msgid "" "In cases where the actual values of the members do not matter, you can save " "yourself some work and use :func:`auto` for the values::" msgstr "" -#: ../../howto/enum.rst:170 +#: ../../howto/enum.rst:172 msgid "" ">>> from enum import auto\n" ">>> class Weekday(Flag):\n" @@ -367,18 +367,18 @@ msgstr "" "... SUNDAY = auto()\n" "... WEEKEND = SATURDAY | SUNDAY" -#: ../../howto/enum.rst:186 +#: ../../howto/enum.rst:188 msgid "Programmatic access to enumeration members and their attributes" msgstr "" -#: ../../howto/enum.rst:188 +#: ../../howto/enum.rst:190 msgid "" "Sometimes it's useful to access members in enumerations programmatically (i." "e. situations where ``Color.RED`` won't do because the exact color is not " "known at program-writing time). ``Enum`` allows such access::" msgstr "" -#: ../../howto/enum.rst:192 +#: ../../howto/enum.rst:194 msgid "" ">>> Color(1)\n" "\n" @@ -390,11 +390,11 @@ msgstr "" ">>> Color(3)\n" "" -#: ../../howto/enum.rst:197 +#: ../../howto/enum.rst:199 msgid "If you want to access enum members by *name*, use item access::" msgstr "" -#: ../../howto/enum.rst:199 +#: ../../howto/enum.rst:201 msgid "" ">>> Color['RED']\n" "\n" @@ -406,11 +406,11 @@ msgstr "" ">>> Color['GREEN']\n" "" -#: ../../howto/enum.rst:204 +#: ../../howto/enum.rst:206 msgid "If you have an enum member and need its :attr:`name` or :attr:`value`::" msgstr "" -#: ../../howto/enum.rst:206 +#: ../../howto/enum.rst:208 msgid "" ">>> member = Color.RED\n" ">>> member.name\n" @@ -424,15 +424,15 @@ msgstr "" ">>> member.value\n" "1" -#: ../../howto/enum.rst:214 +#: ../../howto/enum.rst:216 msgid "Duplicating enum members and values" msgstr "" -#: ../../howto/enum.rst:216 +#: ../../howto/enum.rst:218 msgid "Having two enum members with the same name is invalid::" msgstr "" -#: ../../howto/enum.rst:218 +#: ../../howto/enum.rst:220 msgid "" ">>> class Shape(Enum):\n" "... SQUARE = 2\n" @@ -450,7 +450,7 @@ msgstr "" "...\n" "TypeError: 'SQUARE' already defined as 2" -#: ../../howto/enum.rst:226 +#: ../../howto/enum.rst:228 msgid "" "However, an enum member can have other names associated with it. Given two " "entries ``A`` and ``B`` with the same value (and ``A`` defined first), ``B`` " @@ -459,7 +459,7 @@ msgid "" "member ``A``. By-name lookup of ``B`` will also return the member ``A``::" msgstr "" -#: ../../howto/enum.rst:232 +#: ../../howto/enum.rst:234 msgid "" ">>> class Shape(Enum):\n" "... SQUARE = 2\n" @@ -487,24 +487,24 @@ msgstr "" ">>> Shape(2)\n" "" -#: ../../howto/enum.rst:247 +#: ../../howto/enum.rst:249 msgid "" "Attempting to create a member with the same name as an already defined " "attribute (another member, a method, etc.) or attempting to create an " "attribute with the same name as a member is not allowed." msgstr "" -#: ../../howto/enum.rst:253 +#: ../../howto/enum.rst:255 msgid "Ensuring unique enumeration values" msgstr "" -#: ../../howto/enum.rst:255 +#: ../../howto/enum.rst:257 msgid "" "By default, enumerations allow multiple names as aliases for the same value. " "When this behavior isn't desired, you can use the :func:`unique` decorator::" msgstr "" -#: ../../howto/enum.rst:258 +#: ../../howto/enum.rst:260 msgid "" ">>> from enum import Enum, unique\n" ">>> @unique\n" @@ -530,15 +530,15 @@ msgstr "" "...\n" "ValueError: duplicate values found in : FOUR -> THREE" -#: ../../howto/enum.rst:272 +#: ../../howto/enum.rst:274 msgid "Using automatic values" msgstr "" -#: ../../howto/enum.rst:274 +#: ../../howto/enum.rst:276 msgid "If the exact value is unimportant you can use :class:`auto`::" msgstr "" -#: ../../howto/enum.rst:276 +#: ../../howto/enum.rst:278 msgid "" ">>> from enum import Enum, auto\n" ">>> class Color(Enum):\n" @@ -558,13 +558,13 @@ msgstr "" ">>> [member.value for member in Color]\n" "[1, 2, 3]" -#: ../../howto/enum.rst:285 +#: ../../howto/enum.rst:287 msgid "" "The values are chosen by :func:`_generate_next_value_`, which can be " "overridden::" msgstr "" -#: ../../howto/enum.rst:288 +#: ../../howto/enum.rst:290 msgid "" ">>> class AutoName(Enum):\n" "... @staticmethod\n" @@ -594,20 +594,20 @@ msgstr "" ">>> [member.value for member in Ordinal]\n" "['NORTH', 'SOUTH', 'EAST', 'WEST']" -#: ../../howto/enum.rst:304 +#: ../../howto/enum.rst:306 msgid "" "The :meth:`_generate_next_value_` method must be defined before any members." msgstr "" -#: ../../howto/enum.rst:307 +#: ../../howto/enum.rst:309 msgid "Iteration" msgstr "" -#: ../../howto/enum.rst:309 +#: ../../howto/enum.rst:311 msgid "Iterating over the members of an enum does not provide the aliases::" msgstr "" -#: ../../howto/enum.rst:311 +#: ../../howto/enum.rst:313 msgid "" ">>> list(Shape)\n" "[, , ]\n" @@ -623,20 +623,20 @@ msgstr "" "THURSDAY: 8>, , , ]" -#: ../../howto/enum.rst:316 +#: ../../howto/enum.rst:318 msgid "" "Note that the aliases ``Shape.ALIAS_FOR_SQUARE`` and ``Weekday.WEEKEND`` " "aren't shown." msgstr "" -#: ../../howto/enum.rst:318 +#: ../../howto/enum.rst:320 msgid "" "The special attribute ``__members__`` is a read-only ordered mapping of " "names to members. It includes all names defined in the enumeration, " "including the aliases::" msgstr "" -#: ../../howto/enum.rst:322 +#: ../../howto/enum.rst:324 msgid "" ">>> for name, member in Shape.__members__.items():\n" "... name, member\n" @@ -654,13 +654,13 @@ msgstr "" "('CIRCLE', )\n" "('ALIAS_FOR_SQUARE', )" -#: ../../howto/enum.rst:330 +#: ../../howto/enum.rst:332 msgid "" "The ``__members__`` attribute can be used for detailed programmatic access " "to the enumeration members. For example, finding all the aliases::" msgstr "" -#: ../../howto/enum.rst:333 +#: ../../howto/enum.rst:335 msgid "" ">>> [name for name, member in Shape.__members__.items() if member.name != " "name]\n" @@ -670,21 +670,21 @@ msgstr "" "name]\n" "['ALIAS_FOR_SQUARE']" -#: ../../howto/enum.rst:338 +#: ../../howto/enum.rst:340 msgid "" "Aliases for flags include values with multiple flags set, such as ``3``, and " "no flags set, i.e. ``0``." msgstr "" -#: ../../howto/enum.rst:343 +#: ../../howto/enum.rst:345 msgid "Comparisons" msgstr "比較" -#: ../../howto/enum.rst:345 +#: ../../howto/enum.rst:347 msgid "Enumeration members are compared by identity::" msgstr "" -#: ../../howto/enum.rst:347 +#: ../../howto/enum.rst:349 msgid "" ">>> Color.RED is Color.RED\n" "True\n" @@ -700,13 +700,13 @@ msgstr "" ">>> Color.RED is not Color.BLUE\n" "True" -#: ../../howto/enum.rst:354 +#: ../../howto/enum.rst:356 msgid "" "Ordered comparisons between enumeration values are *not* supported. Enum " "members are not integers (but see `IntEnum`_ below)::" msgstr "" -#: ../../howto/enum.rst:357 +#: ../../howto/enum.rst:359 msgid "" ">>> Color.RED < Color.BLUE\n" "Traceback (most recent call last):\n" @@ -718,11 +718,11 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: '<' not supported between instances of 'Color' and 'Color'" -#: ../../howto/enum.rst:362 +#: ../../howto/enum.rst:364 msgid "Equality comparisons are defined though::" msgstr "" -#: ../../howto/enum.rst:364 +#: ../../howto/enum.rst:366 msgid "" ">>> Color.BLUE == Color.RED\n" "False\n" @@ -738,14 +738,14 @@ msgstr "" ">>> Color.BLUE == Color.BLUE\n" "True" -#: ../../howto/enum.rst:371 +#: ../../howto/enum.rst:373 msgid "" "Comparisons against non-enumeration values will always compare not equal " "(again, :class:`IntEnum` was explicitly designed to behave differently, see " "below)::" msgstr "" -#: ../../howto/enum.rst:375 +#: ../../howto/enum.rst:377 msgid "" ">>> Color.BLUE == 2\n" "False" @@ -753,18 +753,18 @@ msgstr "" ">>> Color.BLUE == 2\n" "False" -#: ../../howto/enum.rst:380 +#: ../../howto/enum.rst:382 msgid "" "It is possible to reload modules -- if a reloaded module contains enums, " "they will be recreated, and the new members may not compare identical/equal " "to the original members." msgstr "" -#: ../../howto/enum.rst:385 +#: ../../howto/enum.rst:387 msgid "Allowed members and attributes of enumerations" msgstr "" -#: ../../howto/enum.rst:387 +#: ../../howto/enum.rst:389 msgid "" "Most of the examples above use integers for enumeration values. Using " "integers is short and handy (and provided by default by the `Functional " @@ -773,13 +773,13 @@ msgid "" "*is* important, enumerations can have arbitrary values." msgstr "" -#: ../../howto/enum.rst:393 +#: ../../howto/enum.rst:395 msgid "" "Enumerations are Python classes, and can have methods and special methods as " "usual. If we have this enumeration::" msgstr "" -#: ../../howto/enum.rst:396 +#: ../../howto/enum.rst:398 msgid "" ">>> class Mood(Enum):\n" "... FUNKY = 1\n" @@ -799,11 +799,11 @@ msgid "" "..." msgstr "" -#: ../../howto/enum.rst:413 +#: ../../howto/enum.rst:415 msgid "Then::" msgstr "" -#: ../../howto/enum.rst:415 +#: ../../howto/enum.rst:417 msgid "" ">>> Mood.favorite_mood()\n" "\n" @@ -819,7 +819,7 @@ msgstr "" ">>> str(Mood.FUNKY)\n" "'my custom str! 1'" -#: ../../howto/enum.rst:422 +#: ../../howto/enum.rst:424 msgid "" "The rules for what is allowed are as follows: names that start and end with " "a single underscore are reserved by enum and cannot be used; all other " @@ -829,14 +829,14 @@ msgid "" "names listed in :attr:`_ignore_`." msgstr "" -#: ../../howto/enum.rst:429 +#: ../../howto/enum.rst:431 msgid "" "Note: if your enumeration defines :meth:`__new__` and/or :meth:`__init__`, " "any value(s) given to the enum member will be passed into those methods. See " "`Planet`_ for an example." msgstr "" -#: ../../howto/enum.rst:435 +#: ../../howto/enum.rst:437 msgid "" "The :meth:`__new__` method, if defined, is used during creation of the Enum " "members; it is then replaced by Enum's :meth:`__new__` which is used after " @@ -844,18 +844,18 @@ msgid "" "more details." msgstr "" -#: ../../howto/enum.rst:442 +#: ../../howto/enum.rst:444 msgid "Restricted Enum subclassing" msgstr "" -#: ../../howto/enum.rst:444 +#: ../../howto/enum.rst:446 msgid "" "A new :class:`Enum` class must have one base enum class, up to one concrete " "data type, and as many :class:`object`-based mixin classes as needed. The " "order of these base classes is::" msgstr "" -#: ../../howto/enum.rst:448 +#: ../../howto/enum.rst:450 msgid "" "class EnumName([mix-in, ...,] [data-type,] base-enum):\n" " pass" @@ -863,13 +863,13 @@ msgstr "" "class EnumName([mix-in, ...,] [data-type,] base-enum):\n" " pass" -#: ../../howto/enum.rst:451 +#: ../../howto/enum.rst:453 msgid "" "Also, subclassing an enumeration is allowed only if the enumeration does not " "define any members. So this is forbidden::" msgstr "" -#: ../../howto/enum.rst:454 +#: ../../howto/enum.rst:456 msgid "" ">>> class MoreColor(Color):\n" "... PINK = 17\n" @@ -885,11 +885,11 @@ msgstr "" "...\n" "TypeError: cannot extend " -#: ../../howto/enum.rst:461 +#: ../../howto/enum.rst:463 msgid "But this is allowed::" msgstr "但這是允許的:" -#: ../../howto/enum.rst:463 +#: ../../howto/enum.rst:465 msgid "" ">>> class Foo(Enum):\n" "... def some_behavior(self):\n" @@ -909,7 +909,7 @@ msgstr "" "... SAD = 2\n" "..." -#: ../../howto/enum.rst:472 +#: ../../howto/enum.rst:474 msgid "" "Allowing subclassing of enums that define members would lead to a violation " "of some important invariants of types and instances. On the other hand, it " @@ -917,17 +917,17 @@ msgid "" "enumerations. (See `OrderedEnum`_ for an example.)" msgstr "" -#: ../../howto/enum.rst:481 +#: ../../howto/enum.rst:483 msgid "Dataclass support" msgstr "" -#: ../../howto/enum.rst:483 +#: ../../howto/enum.rst:485 msgid "" "When inheriting from a :class:`~dataclasses.dataclass`, the :meth:`~Enum." "__repr__` omits the inherited class' name. For example::" msgstr "" -#: ../../howto/enum.rst:486 +#: ../../howto/enum.rst:488 msgid "" ">>> from dataclasses import dataclass, field\n" ">>> @dataclass\n" @@ -957,27 +957,48 @@ msgstr "" ">>> Creature.DOG\n" "" -#: ../../howto/enum.rst:500 +#: ../../howto/enum.rst:502 msgid "" -"Use the :func:`!dataclass` argument ``repr=False`` to use the standard :func:" -"`repr`." +"Use the :func:`~dataclasses.dataclass` argument ``repr=False`` to use the " +"standard :func:`repr`." msgstr "" -#: ../../howto/enum.rst:503 +#: ../../howto/enum.rst:505 msgid "" "Only the dataclass fields are shown in the value area, not the dataclass' " "name." msgstr "" -#: ../../howto/enum.rst:509 +#: ../../howto/enum.rst:511 +msgid "" +"Adding :func:`~dataclasses.dataclass` decorator to :class:`Enum` and its " +"subclasses is not supported. It will not raise any errors, but it will " +"produce very strange results at runtime, such as members being equal to each " +"other::" +msgstr "" + +#: ../../howto/enum.rst:516 +msgid "" +">>> @dataclass # don't do this: it does not make any sense\n" +"... class Color(Enum):\n" +"... RED = 1\n" +"... BLUE = 2\n" +"...\n" +">>> Color.RED is Color.BLUE\n" +"False\n" +">>> Color.RED == Color.BLUE # problem is here: they should not be equal\n" +"True" +msgstr "" + +#: ../../howto/enum.rst:528 msgid "Pickling" msgstr "" -#: ../../howto/enum.rst:511 +#: ../../howto/enum.rst:530 msgid "Enumerations can be pickled and unpickled::" msgstr "" -#: ../../howto/enum.rst:513 +#: ../../howto/enum.rst:532 msgid "" ">>> from test.test_enum import Fruit\n" ">>> from pickle import dumps, loads\n" @@ -989,27 +1010,27 @@ msgstr "" ">>> Fruit.TOMATO is loads(dumps(Fruit.TOMATO))\n" "True" -#: ../../howto/enum.rst:518 +#: ../../howto/enum.rst:537 msgid "" "The usual restrictions for pickling apply: picklable enums must be defined " "in the top level of a module, since unpickling requires them to be " "importable from that module." msgstr "" -#: ../../howto/enum.rst:524 +#: ../../howto/enum.rst:543 msgid "" "With pickle protocol version 4 it is possible to easily pickle enums nested " "in other classes." msgstr "" -#: ../../howto/enum.rst:527 +#: ../../howto/enum.rst:546 msgid "" "It is possible to modify how enum members are pickled/unpickled by defining :" "meth:`__reduce_ex__` in the enumeration class. The default method is by-" "value, but enums with complicated values may want to use by-name::" msgstr "" -#: ../../howto/enum.rst:531 +#: ../../howto/enum.rst:550 msgid "" ">>> import enum\n" ">>> class MyEnum(enum.Enum):\n" @@ -1019,22 +1040,22 @@ msgstr "" ">>> class MyEnum(enum.Enum):\n" "... __reduce_ex__ = enum.pickle_by_enum_name" -#: ../../howto/enum.rst:537 +#: ../../howto/enum.rst:556 msgid "" "Using by-name for flags is not recommended, as unnamed aliases will not " "unpickle." msgstr "" -#: ../../howto/enum.rst:542 +#: ../../howto/enum.rst:561 msgid "Functional API" msgstr "" -#: ../../howto/enum.rst:544 +#: ../../howto/enum.rst:563 msgid "" "The :class:`Enum` class is callable, providing the following functional API::" msgstr "" -#: ../../howto/enum.rst:546 +#: ../../howto/enum.rst:565 msgid "" ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG')\n" ">>> Animal\n" @@ -1052,13 +1073,13 @@ msgstr "" ">>> list(Animal)\n" "[, , , ]" -#: ../../howto/enum.rst:554 +#: ../../howto/enum.rst:573 msgid "" "The semantics of this API resemble :class:`~collections.namedtuple`. The " "first argument of the call to :class:`Enum` is the name of the enumeration." msgstr "" -#: ../../howto/enum.rst:557 +#: ../../howto/enum.rst:576 msgid "" "The second argument is the *source* of enumeration member names. It can be " "a whitespace-separated string of names, a sequence of names, a sequence of 2-" @@ -1070,7 +1091,7 @@ msgid "" "assignment to :class:`Animal` is equivalent to::" msgstr "" -#: ../../howto/enum.rst:566 +#: ../../howto/enum.rst:585 msgid "" ">>> class Animal(Enum):\n" "... ANT = 1\n" @@ -1086,14 +1107,14 @@ msgstr "" "... DOG = 4\n" "..." -#: ../../howto/enum.rst:573 +#: ../../howto/enum.rst:592 msgid "" "The reason for defaulting to ``1`` as the starting number and not ``0`` is " "that ``0`` is ``False`` in a boolean sense, but by default enum members all " "evaluate to ``True``." msgstr "" -#: ../../howto/enum.rst:577 +#: ../../howto/enum.rst:596 msgid "" "Pickling enums created with the functional API can be tricky as frame stack " "implementation details are used to try and figure out which module the " @@ -1102,18 +1123,18 @@ msgid "" "Jython). The solution is to specify the module name explicitly as follows::" msgstr "" -#: ../../howto/enum.rst:583 +#: ../../howto/enum.rst:602 msgid ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=__name__)" msgstr ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=__name__)" -#: ../../howto/enum.rst:587 +#: ../../howto/enum.rst:606 msgid "" "If ``module`` is not supplied, and Enum cannot determine what it is, the new " "Enum members will not be unpicklable; to keep errors closer to the source, " "pickling will be disabled." msgstr "" -#: ../../howto/enum.rst:591 +#: ../../howto/enum.rst:610 msgid "" "The new pickle protocol 4 also, in some circumstances, relies on :attr:" "`~definition.__qualname__` being set to the location where pickle will be " @@ -1121,17 +1142,17 @@ msgid "" "class SomeData in the global scope::" msgstr "" -#: ../../howto/enum.rst:596 +#: ../../howto/enum.rst:615 msgid "" ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', qualname='SomeData.Animal')" msgstr "" ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', qualname='SomeData.Animal')" -#: ../../howto/enum.rst:598 +#: ../../howto/enum.rst:617 msgid "The complete signature is::" msgstr "" -#: ../../howto/enum.rst:600 +#: ../../howto/enum.rst:619 msgid "" "Enum(\n" " value='NewEnumName',\n" @@ -1153,73 +1174,73 @@ msgstr "" " start=1,\n" " )" -#: ../../howto/enum.rst:610 +#: ../../howto/enum.rst:629 msgid "*value*: What the new enum class will record as its name." msgstr "" -#: ../../howto/enum.rst:612 +#: ../../howto/enum.rst:631 msgid "" "*names*: The enum members. This can be a whitespace- or comma-separated " "string (values will start at 1 unless otherwise specified)::" msgstr "" -#: ../../howto/enum.rst:615 +#: ../../howto/enum.rst:634 msgid "'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'" msgstr "'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'" -#: ../../howto/enum.rst:617 +#: ../../howto/enum.rst:636 msgid "or an iterator of names::" msgstr "" -#: ../../howto/enum.rst:619 +#: ../../howto/enum.rst:638 msgid "['RED', 'GREEN', 'BLUE']" msgstr "['RED', 'GREEN', 'BLUE']" -#: ../../howto/enum.rst:621 +#: ../../howto/enum.rst:640 msgid "or an iterator of (name, value) pairs::" msgstr "" -#: ../../howto/enum.rst:623 +#: ../../howto/enum.rst:642 msgid "[('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)]" msgstr "[('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)]" -#: ../../howto/enum.rst:625 +#: ../../howto/enum.rst:644 msgid "or a mapping::" msgstr "" -#: ../../howto/enum.rst:627 +#: ../../howto/enum.rst:646 msgid "{'CHARTREUSE': 7, 'SEA_GREEN': 11, 'ROSEMARY': 42}" msgstr "{'CHARTREUSE': 7, 'SEA_GREEN': 11, 'ROSEMARY': 42}" -#: ../../howto/enum.rst:629 +#: ../../howto/enum.rst:648 msgid "*module*: name of module where new enum class can be found." msgstr "" -#: ../../howto/enum.rst:631 +#: ../../howto/enum.rst:650 msgid "*qualname*: where in module new enum class can be found." msgstr "" -#: ../../howto/enum.rst:633 +#: ../../howto/enum.rst:652 msgid "*type*: type to mix in to new enum class." msgstr "" -#: ../../howto/enum.rst:635 +#: ../../howto/enum.rst:654 msgid "*start*: number to start counting at if only names are passed in." msgstr "" -#: ../../howto/enum.rst:637 +#: ../../howto/enum.rst:656 msgid "The *start* parameter was added." msgstr "" -#: ../../howto/enum.rst:642 +#: ../../howto/enum.rst:661 msgid "Derived Enumerations" msgstr "" -#: ../../howto/enum.rst:645 +#: ../../howto/enum.rst:664 msgid "IntEnum" msgstr "" -#: ../../howto/enum.rst:647 +#: ../../howto/enum.rst:666 msgid "" "The first variation of :class:`Enum` that is provided is also a subclass of :" "class:`int`. Members of an :class:`IntEnum` can be compared to integers; by " @@ -1227,7 +1248,7 @@ msgid "" "each other::" msgstr "" -#: ../../howto/enum.rst:652 +#: ../../howto/enum.rst:671 msgid "" ">>> from enum import IntEnum\n" ">>> class Shape(IntEnum):\n" @@ -1261,13 +1282,13 @@ msgstr "" ">>> Shape.CIRCLE == Request.POST\n" "True" -#: ../../howto/enum.rst:668 +#: ../../howto/enum.rst:687 msgid "" "However, they still can't be compared to standard :class:`Enum` " "enumerations::" msgstr "" -#: ../../howto/enum.rst:670 +#: ../../howto/enum.rst:689 msgid "" ">>> class Shape(IntEnum):\n" "... CIRCLE = 1\n" @@ -1291,12 +1312,12 @@ msgstr "" ">>> Shape.CIRCLE == Color.RED\n" "False" -#: ../../howto/enum.rst:681 +#: ../../howto/enum.rst:700 msgid "" ":class:`IntEnum` values behave like integers in other ways you'd expect::" msgstr "" -#: ../../howto/enum.rst:683 +#: ../../howto/enum.rst:702 msgid "" ">>> int(Shape.CIRCLE)\n" "1\n" @@ -1312,11 +1333,11 @@ msgstr "" ">>> [i for i in range(Shape.SQUARE)]\n" "[0, 1]" -#: ../../howto/enum.rst:692 +#: ../../howto/enum.rst:711 msgid "StrEnum" msgstr "StrEnum" -#: ../../howto/enum.rst:694 +#: ../../howto/enum.rst:713 msgid "" "The second variation of :class:`Enum` that is provided is also a subclass " "of :class:`str`. Members of a :class:`StrEnum` can be compared to strings; " @@ -1324,11 +1345,11 @@ msgid "" "each other." msgstr "" -#: ../../howto/enum.rst:703 +#: ../../howto/enum.rst:722 msgid "IntFlag" msgstr "IntFlag" -#: ../../howto/enum.rst:705 +#: ../../howto/enum.rst:724 msgid "" "The next variation of :class:`Enum` provided, :class:`IntFlag`, is also " "based on :class:`int`. The difference being :class:`IntFlag` members can be " @@ -1338,23 +1359,23 @@ msgid "" "is used." msgstr "" -#: ../../howto/enum.rst:713 +#: ../../howto/enum.rst:732 msgid "" "Any operation on an :class:`IntFlag` member besides the bit-wise operations " "will lose the :class:`IntFlag` membership." msgstr "" -#: ../../howto/enum.rst:716 +#: ../../howto/enum.rst:735 msgid "" "Bit-wise operations that result in invalid :class:`IntFlag` values will lose " "the :class:`IntFlag` membership. See :class:`FlagBoundary` for details." msgstr "" -#: ../../howto/enum.rst:723 +#: ../../howto/enum.rst:742 msgid "Sample :class:`IntFlag` class::" msgstr "" -#: ../../howto/enum.rst:725 +#: ../../howto/enum.rst:744 msgid "" ">>> from enum import IntFlag\n" ">>> class Perm(IntFlag):\n" @@ -1384,11 +1405,11 @@ msgstr "" ">>> Perm.R in RW\n" "True" -#: ../../howto/enum.rst:739 +#: ../../howto/enum.rst:758 msgid "It is also possible to name the combinations::" msgstr "" -#: ../../howto/enum.rst:741 +#: ../../howto/enum.rst:760 msgid "" ">>> class Perm(IntFlag):\n" "... R = 4\n" @@ -1416,20 +1437,20 @@ msgstr "" ">>> Perm(7)\n" "" -#: ../../howto/enum.rst:756 +#: ../../howto/enum.rst:775 msgid "" "Named combinations are considered aliases. Aliases do not show up during " "iteration, but can be returned from by-value lookups." msgstr "" -#: ../../howto/enum.rst:761 +#: ../../howto/enum.rst:780 msgid "" "Another important difference between :class:`IntFlag` and :class:`Enum` is " "that if no flags are set (the value is 0), its boolean evaluation is :data:" "`False`::" msgstr "" -#: ../../howto/enum.rst:764 +#: ../../howto/enum.rst:783 msgid "" ">>> Perm.R & Perm.X\n" "\n" @@ -1441,13 +1462,13 @@ msgstr "" ">>> bool(Perm.R & Perm.X)\n" "False" -#: ../../howto/enum.rst:769 +#: ../../howto/enum.rst:788 msgid "" "Because :class:`IntFlag` members are also subclasses of :class:`int` they " "can be combined with them (but may lose :class:`IntFlag` membership::" msgstr "" -#: ../../howto/enum.rst:772 +#: ../../howto/enum.rst:791 msgid "" ">>> Perm.X | 4\n" "\n" @@ -1461,13 +1482,13 @@ msgstr "" ">>> Perm.X + 8\n" "9" -#: ../../howto/enum.rst:780 +#: ../../howto/enum.rst:799 msgid "" "The negation operator, ``~``, always returns an :class:`IntFlag` member with " "a positive value::" msgstr "" -#: ../../howto/enum.rst:783 +#: ../../howto/enum.rst:802 msgid "" ">>> (~Perm.X).value == (Perm.R|Perm.W).value == 6\n" "True" @@ -1475,11 +1496,11 @@ msgstr "" ">>> (~Perm.X).value == (Perm.R|Perm.W).value == 6\n" "True" -#: ../../howto/enum.rst:786 +#: ../../howto/enum.rst:805 msgid ":class:`IntFlag` members can also be iterated over::" msgstr "" -#: ../../howto/enum.rst:788 +#: ../../howto/enum.rst:807 msgid "" ">>> list(RW)\n" "[, ]" @@ -1487,11 +1508,11 @@ msgstr "" ">>> list(RW)\n" "[, ]" -#: ../../howto/enum.rst:795 +#: ../../howto/enum.rst:814 msgid "Flag" msgstr "Flag" -#: ../../howto/enum.rst:797 +#: ../../howto/enum.rst:816 msgid "" "The last variation is :class:`Flag`. Like :class:`IntFlag`, :class:`Flag` " "members can be combined using the bitwise operators (&, \\|, ^, ~). Unlike :" @@ -1501,13 +1522,13 @@ msgid "" "value and let :class:`Flag` select an appropriate value." msgstr "" -#: ../../howto/enum.rst:806 +#: ../../howto/enum.rst:825 msgid "" "Like :class:`IntFlag`, if a combination of :class:`Flag` members results in " "no flags being set, the boolean evaluation is :data:`False`::" msgstr "" -#: ../../howto/enum.rst:809 +#: ../../howto/enum.rst:828 msgid "" ">>> from enum import Flag, auto\n" ">>> class Color(Flag):\n" @@ -1531,13 +1552,13 @@ msgstr "" ">>> bool(Color.RED & Color.GREEN)\n" "False" -#: ../../howto/enum.rst:820 +#: ../../howto/enum.rst:839 msgid "" "Individual flags should have values that are powers of two (1, 2, 4, " "8, ...), while combinations of flags will not::" msgstr "" -#: ../../howto/enum.rst:823 +#: ../../howto/enum.rst:842 msgid "" ">>> class Color(Flag):\n" "... RED = auto()\n" @@ -1557,13 +1578,13 @@ msgstr "" ">>> Color.WHITE\n" "" -#: ../../howto/enum.rst:832 +#: ../../howto/enum.rst:851 msgid "" "Giving a name to the \"no flags set\" condition does not change its boolean " "value::" msgstr "" -#: ../../howto/enum.rst:835 +#: ../../howto/enum.rst:854 msgid "" ">>> class Color(Flag):\n" "... BLACK = 0\n" @@ -1587,11 +1608,11 @@ msgstr "" ">>> bool(Color.BLACK)\n" "False" -#: ../../howto/enum.rst:846 +#: ../../howto/enum.rst:865 msgid ":class:`Flag` members can also be iterated over::" msgstr "" -#: ../../howto/enum.rst:848 +#: ../../howto/enum.rst:867 msgid "" ">>> purple = Color.RED | Color.BLUE\n" ">>> list(purple)\n" @@ -1601,7 +1622,7 @@ msgstr "" ">>> list(purple)\n" "[, ]" -#: ../../howto/enum.rst:856 +#: ../../howto/enum.rst:875 msgid "" "For the majority of new code, :class:`Enum` and :class:`Flag` are strongly " "recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic " @@ -1612,50 +1633,51 @@ msgid "" "enumerations, or for interoperability with other systems." msgstr "" -#: ../../howto/enum.rst:866 +#: ../../howto/enum.rst:885 msgid "Others" msgstr "其他" -#: ../../howto/enum.rst:868 +#: ../../howto/enum.rst:887 msgid "" "While :class:`IntEnum` is part of the :mod:`enum` module, it would be very " "simple to implement independently::" msgstr "" -#: ../../howto/enum.rst:871 +#: ../../howto/enum.rst:890 +#, fuzzy msgid "" -"class IntEnum(int, Enum):\n" +"class IntEnum(int, ReprEnum): # or Enum instead of ReprEnum\n" " pass" msgstr "" "class IntEnum(int, Enum):\n" " pass" -#: ../../howto/enum.rst:874 +#: ../../howto/enum.rst:893 msgid "" "This demonstrates how similar derived enumerations can be defined; for " "example a :class:`FloatEnum` that mixes in :class:`float` instead of :class:" "`int`." msgstr "" -#: ../../howto/enum.rst:877 +#: ../../howto/enum.rst:896 msgid "Some rules:" msgstr "一些規則:" -#: ../../howto/enum.rst:879 +#: ../../howto/enum.rst:898 msgid "" -"When subclassing :class:`Enum`, mix-in types must appear before :class:" -"`Enum` itself in the sequence of bases, as in the :class:`IntEnum` example " -"above." +"When subclassing :class:`Enum`, mix-in types must appear before the :class:" +"`Enum` class itself in the sequence of bases, as in the :class:`IntEnum` " +"example above." msgstr "" -#: ../../howto/enum.rst:882 +#: ../../howto/enum.rst:901 msgid "" "Mix-in types must be subclassable. For example, :class:`bool` and :class:" "`range` are not subclassable and will throw an error during Enum creation if " "used as the mix-in type." msgstr "" -#: ../../howto/enum.rst:885 +#: ../../howto/enum.rst:904 msgid "" "While :class:`Enum` can have members of any type, once you mix in an " "additional type, all the members must have values of that type, e.g. :class:" @@ -1663,57 +1685,57 @@ msgid "" "methods and don't specify another type." msgstr "" -#: ../../howto/enum.rst:889 +#: ../../howto/enum.rst:908 msgid "" "When another data type is mixed in, the :attr:`value` attribute is *not the " "same* as the enum member itself, although it is equivalent and will compare " "equal." msgstr "" -#: ../../howto/enum.rst:892 +#: ../../howto/enum.rst:911 msgid "" "A ``data type`` is a mixin that defines :meth:`__new__`, or a :class:" "`~dataclasses.dataclass`" msgstr "" -#: ../../howto/enum.rst:894 +#: ../../howto/enum.rst:913 msgid "" "%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` class's :meth:" "`__str__` and :meth:`__repr__` respectively; other codes (such as ``%i`` or " "``%h`` for IntEnum) treat the enum member as its mixed-in type." msgstr "" -#: ../../howto/enum.rst:897 +#: ../../howto/enum.rst:916 msgid "" ":ref:`Formatted string literals `, :meth:`str.format`, and :func:" "`format` will use the enum's :meth:`__str__` method." msgstr "" -#: ../../howto/enum.rst:902 +#: ../../howto/enum.rst:921 msgid "" "Because :class:`IntEnum`, :class:`IntFlag`, and :class:`StrEnum` are " "designed to be drop-in replacements for existing constants, their :meth:" "`__str__` method has been reset to their data types' :meth:`__str__` method." msgstr "" -#: ../../howto/enum.rst:910 +#: ../../howto/enum.rst:929 msgid "When to use :meth:`__new__` vs. :meth:`__init__`" msgstr "" -#: ../../howto/enum.rst:912 +#: ../../howto/enum.rst:931 msgid "" ":meth:`__new__` must be used whenever you want to customize the actual value " "of the :class:`Enum` member. Any other modifications may go in either :meth:" "`__new__` or :meth:`__init__`, with :meth:`__init__` being preferred." msgstr "" -#: ../../howto/enum.rst:916 +#: ../../howto/enum.rst:935 msgid "" "For example, if you want to pass several items to the constructor, but only " "want one of them to be the value::" msgstr "" -#: ../../howto/enum.rst:919 +#: ../../howto/enum.rst:938 msgid "" ">>> class Coordinate(bytes, Enum):\n" "... \"\"\"\n" @@ -1738,99 +1760,114 @@ msgid "" "Coordinate.VY" msgstr "" -#: ../../howto/enum.rst:943 +#: ../../howto/enum.rst:962 msgid "" "*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the " "one that is found; instead, use the data type directly." msgstr "" -#: ../../howto/enum.rst:948 +#: ../../howto/enum.rst:967 msgid "Finer Points" msgstr "" -#: ../../howto/enum.rst:951 +#: ../../howto/enum.rst:970 msgid "Supported ``__dunder__`` names" msgstr "" -#: ../../howto/enum.rst:953 +#: ../../howto/enum.rst:972 msgid "" ":attr:`__members__` is a read-only ordered mapping of ``member_name``:" "``member`` items. It is only available on the class." msgstr "" -#: ../../howto/enum.rst:956 +#: ../../howto/enum.rst:975 msgid "" ":meth:`__new__`, if specified, must create and return the enum members; it " "is also a very good idea to set the member's :attr:`_value_` appropriately. " "Once all the members are created it is no longer used." msgstr "" -#: ../../howto/enum.rst:962 +#: ../../howto/enum.rst:981 msgid "Supported ``_sunder_`` names" msgstr "" -#: ../../howto/enum.rst:964 -msgid "``_name_`` -- name of the member" +#: ../../howto/enum.rst:983 +#, fuzzy +msgid ":attr:`~Enum._name_` -- name of the member" msgstr "``_name_`` -- 成員的名稱" -#: ../../howto/enum.rst:965 +#: ../../howto/enum.rst:984 +msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" +msgstr "" + +#: ../../howto/enum.rst:985 msgid "" -"``_value_`` -- value of the member; can be set / modified in ``__new__``" +":meth:`~Enum._missing_` -- a lookup function used when a value is not found; " +"may be overridden" msgstr "" -#: ../../howto/enum.rst:967 +#: ../../howto/enum.rst:987 msgid "" -"``_missing_`` -- a lookup function used when a value is not found; may be " -"overridden" +":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" +"class:`str`, that will not be transformed into members, and will be removed " +"from the final class" msgstr "" -#: ../../howto/enum.rst:969 +#: ../../howto/enum.rst:990 msgid "" -"``_ignore_`` -- a list of names, either as a :class:`list` or a :class:" -"`str`, that will not be transformed into members, and will be removed from " -"the final class" +":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for " +"an enum member; may be overridden" msgstr "" -#: ../../howto/enum.rst:972 +#: ../../howto/enum.rst:992 msgid "" -"``_order_`` -- used in Python 2/3 code to ensure member order is consistent " -"(class attribute, removed during class creation)" +":meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing " +"member." msgstr "" -#: ../../howto/enum.rst:974 +#: ../../howto/enum.rst:994 msgid "" -"``_generate_next_value_`` -- used by the `Functional API`_ and by :class:" -"`auto` to get an appropriate value for an enum member; may be overridden" +":meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an " +"existing member. See `MultiValueEnum`_ for an example." msgstr "" -#: ../../howto/enum.rst:980 +#: ../../howto/enum.rst:999 msgid "" -"For standard :class:`Enum` classes the next value chosen is the last value " -"seen incremented by one." +"For standard :class:`Enum` classes the next value chosen is the highest " +"value seen incremented by one." msgstr "" -#: ../../howto/enum.rst:983 +#: ../../howto/enum.rst:1002 msgid "" "For :class:`Flag` classes the next value chosen will be the next highest " -"power-of-two, regardless of the last value seen." +"power-of-two." +msgstr "" + +#: ../../howto/enum.rst:1005 +msgid "" +"Prior versions would use the last seen value instead of the highest value." msgstr "" -#: ../../howto/enum.rst:986 +#: ../../howto/enum.rst:1008 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" msgstr "``_missing_``、``_order_``、``_generate_next_value_``" -#: ../../howto/enum.rst:987 +#: ../../howto/enum.rst:1009 msgid "``_ignore_``" msgstr "``_ignore_``" -#: ../../howto/enum.rst:989 +#: ../../howto/enum.rst:1010 +msgid "``_add_alias_``, ``_add_value_alias_``" +msgstr "" + +#: ../../howto/enum.rst:1012 msgid "" "To help keep Python 2 / Python 3 code in sync an :attr:`_order_` attribute " "can be provided. It will be checked against the actual order of the " "enumeration and raise an error if the two do not match::" msgstr "" -#: ../../howto/enum.rst:993 +#: ../../howto/enum.rst:1016 msgid "" ">>> class Color(Enum):\n" "... _order_ = 'RED GREEN BLUE'\n" @@ -1856,27 +1893,27 @@ msgstr "" " ['RED', 'BLUE', 'GREEN']\n" " ['RED', 'GREEN', 'BLUE']" -#: ../../howto/enum.rst:1007 +#: ../../howto/enum.rst:1030 msgid "" "In Python 2 code the :attr:`_order_` attribute is necessary as definition " "order is lost before it can be recorded." msgstr "" -#: ../../howto/enum.rst:1012 +#: ../../howto/enum.rst:1035 msgid "_Private__names" msgstr "_Private__names" -#: ../../howto/enum.rst:1014 +#: ../../howto/enum.rst:1037 msgid "" ":ref:`Private names ` are not converted to enum " "members, but remain normal attributes." msgstr "" -#: ../../howto/enum.rst:1021 +#: ../../howto/enum.rst:1044 msgid "``Enum`` member type" msgstr "" -#: ../../howto/enum.rst:1023 +#: ../../howto/enum.rst:1046 msgid "" "Enum members are instances of their enum class, and are normally accessed as " "``EnumClass.member``. In certain situations, such as writing custom enum " @@ -1886,18 +1923,18 @@ msgid "" "strongly recommended." msgstr "" -#: ../../howto/enum.rst:1034 +#: ../../howto/enum.rst:1057 msgid "Creating members that are mixed with other data types" msgstr "" -#: ../../howto/enum.rst:1036 +#: ../../howto/enum.rst:1059 msgid "" "When subclassing other data types, such as :class:`int` or :class:`str`, " "with an :class:`Enum`, all values after the ``=`` are passed to that data " "type's constructor. For example::" msgstr "" -#: ../../howto/enum.rst:1040 +#: ../../howto/enum.rst:1063 msgid "" ">>> class MyEnum(IntEnum): # help(int) -> int(x, base=10) -> integer\n" "... example = '11', 16 # so x='11' and base=16\n" @@ -1906,11 +1943,11 @@ msgid "" "17" msgstr "" -#: ../../howto/enum.rst:1048 +#: ../../howto/enum.rst:1071 msgid "Boolean value of ``Enum`` classes and members" msgstr "" -#: ../../howto/enum.rst:1050 +#: ../../howto/enum.rst:1073 msgid "" "Enum classes that are mixed with non-:class:`Enum` types (such as :class:" "`int`, :class:`str`, etc.) are evaluated according to the mixed-in type's " @@ -1919,7 +1956,7 @@ msgid "" "your class::" msgstr "" -#: ../../howto/enum.rst:1056 +#: ../../howto/enum.rst:1079 msgid "" "def __bool__(self):\n" " return bool(self.value)" @@ -1927,22 +1964,22 @@ msgstr "" "def __bool__(self):\n" " return bool(self.value)" -#: ../../howto/enum.rst:1059 +#: ../../howto/enum.rst:1082 msgid "Plain :class:`Enum` classes always evaluate as :data:`True`." msgstr "" -#: ../../howto/enum.rst:1063 +#: ../../howto/enum.rst:1086 msgid "``Enum`` classes with methods" msgstr "" -#: ../../howto/enum.rst:1065 +#: ../../howto/enum.rst:1088 msgid "" "If you give your enum subclass extra methods, like the `Planet`_ class " "below, those methods will show up in a :func:`dir` of the member, but not of " "the class::" msgstr "" -#: ../../howto/enum.rst:1069 +#: ../../howto/enum.rst:1092 msgid "" ">>> dir(Planet) \n" "['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', " @@ -1958,17 +1995,17 @@ msgstr "" "['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', " "'surface_gravity', 'value']" -#: ../../howto/enum.rst:1076 +#: ../../howto/enum.rst:1099 msgid "Combining members of ``Flag``" msgstr "" -#: ../../howto/enum.rst:1078 +#: ../../howto/enum.rst:1101 msgid "" "Iterating over a combination of :class:`Flag` members will only return the " "members that are comprised of a single bit::" msgstr "" -#: ../../howto/enum.rst:1081 +#: ../../howto/enum.rst:1104 msgid "" ">>> class Color(Flag):\n" "... RED = auto()\n" @@ -1984,15 +2021,15 @@ msgid "" "" msgstr "" -#: ../../howto/enum.rst:1096 +#: ../../howto/enum.rst:1119 msgid "``Flag`` and ``IntFlag`` minutia" msgstr "" -#: ../../howto/enum.rst:1098 +#: ../../howto/enum.rst:1121 msgid "Using the following snippet for our examples::" msgstr "" -#: ../../howto/enum.rst:1100 +#: ../../howto/enum.rst:1123 msgid "" ">>> class Color(IntFlag):\n" "... BLACK = 0\n" @@ -2012,23 +2049,23 @@ msgstr "" "... WHITE = RED | GREEN | BLUE\n" "..." -#: ../../howto/enum.rst:1109 +#: ../../howto/enum.rst:1132 msgid "the following are true:" msgstr "" -#: ../../howto/enum.rst:1111 +#: ../../howto/enum.rst:1134 msgid "single-bit flags are canonical" msgstr "" -#: ../../howto/enum.rst:1112 +#: ../../howto/enum.rst:1135 msgid "multi-bit and zero-bit flags are aliases" msgstr "" -#: ../../howto/enum.rst:1113 +#: ../../howto/enum.rst:1136 msgid "only canonical flags are returned during iteration::" msgstr "" -#: ../../howto/enum.rst:1115 +#: ../../howto/enum.rst:1138 msgid "" ">>> list(Color.WHITE)\n" "[, , ]" @@ -2036,13 +2073,13 @@ msgstr "" ">>> list(Color.WHITE)\n" "[, , ]" -#: ../../howto/enum.rst:1118 +#: ../../howto/enum.rst:1141 msgid "" "negating a flag or flag set returns a new flag/flag set with the " "corresponding positive integer value::" msgstr "" -#: ../../howto/enum.rst:1121 +#: ../../howto/enum.rst:1144 msgid "" ">>> Color.BLUE\n" "\n" @@ -2056,11 +2093,11 @@ msgstr "" ">>> ~Color.BLUE\n" "" -#: ../../howto/enum.rst:1127 +#: ../../howto/enum.rst:1150 msgid "names of pseudo-flags are constructed from their members' names::" msgstr "" -#: ../../howto/enum.rst:1129 +#: ../../howto/enum.rst:1152 msgid "" ">>> (Color.RED | Color.GREEN).name\n" "'RED|GREEN'\n" @@ -2074,11 +2111,11 @@ msgid "" "True" msgstr "" -#: ../../howto/enum.rst:1140 +#: ../../howto/enum.rst:1163 msgid "multi-bit flags, aka aliases, can be returned from operations::" msgstr "" -#: ../../howto/enum.rst:1142 +#: ../../howto/enum.rst:1165 msgid "" ">>> Color.RED | Color.BLUE\n" "\n" @@ -2098,13 +2135,13 @@ msgstr "" ">>> Color(0)\n" "" -#: ../../howto/enum.rst:1151 +#: ../../howto/enum.rst:1174 msgid "" "membership / containment checking: zero-valued flags are always considered " "to be contained::" msgstr "" -#: ../../howto/enum.rst:1154 +#: ../../howto/enum.rst:1177 msgid "" ">>> Color.BLACK in Color.WHITE\n" "True" @@ -2112,13 +2149,13 @@ msgstr "" ">>> Color.BLACK in Color.WHITE\n" "True" -#: ../../howto/enum.rst:1157 +#: ../../howto/enum.rst:1180 msgid "" "otherwise, only if all bits of one flag are in the other flag will True be " "returned::" msgstr "" -#: ../../howto/enum.rst:1160 +#: ../../howto/enum.rst:1183 msgid "" ">>> Color.PURPLE in Color.WHITE\n" "True\n" @@ -2132,62 +2169,62 @@ msgstr "" ">>> Color.GREEN in Color.PURPLE\n" "False" -#: ../../howto/enum.rst:1166 +#: ../../howto/enum.rst:1189 msgid "" "There is a new boundary mechanism that controls how out-of-range / invalid " "bits are handled: ``STRICT``, ``CONFORM``, ``EJECT``, and ``KEEP``:" msgstr "" -#: ../../howto/enum.rst:1169 +#: ../../howto/enum.rst:1192 msgid "STRICT --> raises an exception when presented with invalid values" msgstr "" -#: ../../howto/enum.rst:1170 +#: ../../howto/enum.rst:1193 msgid "CONFORM --> discards any invalid bits" msgstr "" -#: ../../howto/enum.rst:1171 +#: ../../howto/enum.rst:1194 msgid "EJECT --> lose Flag status and become a normal int with the given value" msgstr "" -#: ../../howto/enum.rst:1172 +#: ../../howto/enum.rst:1195 msgid "KEEP --> keep the extra bits" msgstr "" -#: ../../howto/enum.rst:1174 +#: ../../howto/enum.rst:1197 msgid "keeps Flag status and extra bits" msgstr "" -#: ../../howto/enum.rst:1175 +#: ../../howto/enum.rst:1198 msgid "extra bits do not show up in iteration" msgstr "" -#: ../../howto/enum.rst:1176 +#: ../../howto/enum.rst:1199 msgid "extra bits do show up in repr() and str()" msgstr "" -#: ../../howto/enum.rst:1178 +#: ../../howto/enum.rst:1201 msgid "" "The default for Flag is ``STRICT``, the default for ``IntFlag`` is " "``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see ``ssl." "Options`` for an example of when ``KEEP`` is needed)." msgstr "" -#: ../../howto/enum.rst:1186 +#: ../../howto/enum.rst:1209 msgid "How are Enums and Flags different?" msgstr "" -#: ../../howto/enum.rst:1188 +#: ../../howto/enum.rst:1211 msgid "" "Enums have a custom metaclass that affects many aspects of both derived :" "class:`Enum` classes and their instances (members)." msgstr "" -#: ../../howto/enum.rst:1193 +#: ../../howto/enum.rst:1216 msgid "Enum Classes" msgstr "" -#: ../../howto/enum.rst:1195 +#: ../../howto/enum.rst:1218 msgid "" "The :class:`EnumType` metaclass is responsible for providing the :meth:" "`__contains__`, :meth:`__dir__`, :meth:`__iter__` and other methods that " @@ -2198,11 +2235,11 @@ msgid "" "`__getnewargs__`, :meth:`__str__` and :meth:`__repr__`)." msgstr "" -#: ../../howto/enum.rst:1204 +#: ../../howto/enum.rst:1227 msgid "Flag Classes" msgstr "" -#: ../../howto/enum.rst:1206 +#: ../../howto/enum.rst:1229 msgid "" "Flags have an expanded view of aliasing: to be canonical, the value of a " "flag needs to be a power-of-two value, and not a duplicate name. So, in " @@ -2211,11 +2248,11 @@ msgid "" "considered an alias." msgstr "" -#: ../../howto/enum.rst:1212 +#: ../../howto/enum.rst:1235 msgid "Enum Members (aka instances)" msgstr "" -#: ../../howto/enum.rst:1214 +#: ../../howto/enum.rst:1237 msgid "" "The most interesting thing about enum members is that they are singletons. :" "class:`EnumType` creates them all while it is creating the enum class " @@ -2224,17 +2261,17 @@ msgid "" "instances." msgstr "" -#: ../../howto/enum.rst:1220 +#: ../../howto/enum.rst:1243 msgid "Flag Members" msgstr "" -#: ../../howto/enum.rst:1222 +#: ../../howto/enum.rst:1245 msgid "" "Flag members can be iterated over just like the :class:`Flag` class, and " "only the canonical members will be returned. For example::" msgstr "" -#: ../../howto/enum.rst:1225 +#: ../../howto/enum.rst:1248 msgid "" ">>> list(Color)\n" "[, , ]" @@ -2242,17 +2279,17 @@ msgstr "" ">>> list(Color)\n" "[, , ]" -#: ../../howto/enum.rst:1228 +#: ../../howto/enum.rst:1251 msgid "(Note that ``BLACK``, ``PURPLE``, and ``WHITE`` do not show up.)" msgstr "" -#: ../../howto/enum.rst:1230 +#: ../../howto/enum.rst:1253 msgid "" "Inverting a flag member returns the corresponding positive value, rather " "than a negative value --- for example::" msgstr "" -#: ../../howto/enum.rst:1233 +#: ../../howto/enum.rst:1256 msgid "" ">>> ~Color.RED\n" "" @@ -2260,13 +2297,13 @@ msgstr "" ">>> ~Color.RED\n" "" -#: ../../howto/enum.rst:1236 +#: ../../howto/enum.rst:1259 msgid "" "Flag members have a length corresponding to the number of power-of-two " "values they contain. For example::" msgstr "" -#: ../../howto/enum.rst:1239 +#: ../../howto/enum.rst:1262 msgid "" ">>> len(Color.PURPLE)\n" "2" @@ -2274,11 +2311,11 @@ msgstr "" ">>> len(Color.PURPLE)\n" "2" -#: ../../howto/enum.rst:1246 +#: ../../howto/enum.rst:1269 msgid "Enum Cookbook" msgstr "" -#: ../../howto/enum.rst:1249 +#: ../../howto/enum.rst:1272 msgid "" "While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, and :" "class:`IntFlag` are expected to cover the majority of use-cases, they cannot " @@ -2286,50 +2323,50 @@ msgid "" "that can be used directly, or as examples for creating one's own." msgstr "" -#: ../../howto/enum.rst:1256 +#: ../../howto/enum.rst:1279 msgid "Omitting values" msgstr "" -#: ../../howto/enum.rst:1258 +#: ../../howto/enum.rst:1281 msgid "" "In many use-cases, one doesn't care what the actual value of an enumeration " "is. There are several ways to define this type of simple enumeration:" msgstr "" -#: ../../howto/enum.rst:1261 +#: ../../howto/enum.rst:1284 msgid "use instances of :class:`auto` for the value" msgstr "" -#: ../../howto/enum.rst:1262 +#: ../../howto/enum.rst:1285 msgid "use instances of :class:`object` as the value" msgstr "" -#: ../../howto/enum.rst:1263 +#: ../../howto/enum.rst:1286 msgid "use a descriptive string as the value" msgstr "" -#: ../../howto/enum.rst:1264 +#: ../../howto/enum.rst:1287 msgid "" "use a tuple as the value and a custom :meth:`__new__` to replace the tuple " "with an :class:`int` value" msgstr "" -#: ../../howto/enum.rst:1267 +#: ../../howto/enum.rst:1290 msgid "" "Using any of these methods signifies to the user that these values are not " "important, and also enables one to add, remove, or reorder members without " "having to renumber the remaining members." msgstr "" -#: ../../howto/enum.rst:1273 +#: ../../howto/enum.rst:1296 msgid "Using :class:`auto`" msgstr "使用 :class:`auto`" -#: ../../howto/enum.rst:1275 +#: ../../howto/enum.rst:1298 msgid "Using :class:`auto` would look like::" msgstr "" -#: ../../howto/enum.rst:1277 +#: ../../howto/enum.rst:1300 msgid "" ">>> class Color(Enum):\n" "... RED = auto()\n" @@ -2347,15 +2384,15 @@ msgstr "" ">>> Color.GREEN\n" "" -#: ../../howto/enum.rst:1287 +#: ../../howto/enum.rst:1310 msgid "Using :class:`object`" msgstr "使用 :class:`object`" -#: ../../howto/enum.rst:1289 +#: ../../howto/enum.rst:1312 msgid "Using :class:`object` would look like::" msgstr "" -#: ../../howto/enum.rst:1291 +#: ../../howto/enum.rst:1314 msgid "" ">>> class Color(Enum):\n" "... RED = object()\n" @@ -2373,13 +2410,13 @@ msgstr "" ">>> Color.GREEN \n" ">" -#: ../../howto/enum.rst:1299 +#: ../../howto/enum.rst:1322 msgid "" "This is also a good example of why you might want to write your own :meth:" "`__repr__`::" msgstr "" -#: ../../howto/enum.rst:1302 +#: ../../howto/enum.rst:1325 msgid "" ">>> class Color(Enum):\n" "... RED = object()\n" @@ -2401,15 +2438,15 @@ msgstr "" ">>> Color.GREEN\n" "" -#: ../../howto/enum.rst:1315 +#: ../../howto/enum.rst:1338 msgid "Using a descriptive string" msgstr "" -#: ../../howto/enum.rst:1317 +#: ../../howto/enum.rst:1340 msgid "Using a string as the value would look like::" msgstr "" -#: ../../howto/enum.rst:1319 +#: ../../howto/enum.rst:1342 msgid "" ">>> class Color(Enum):\n" "... RED = 'stop'\n" @@ -2427,15 +2464,15 @@ msgstr "" ">>> Color.GREEN\n" "" -#: ../../howto/enum.rst:1329 +#: ../../howto/enum.rst:1352 msgid "Using a custom :meth:`__new__`" msgstr "" -#: ../../howto/enum.rst:1331 +#: ../../howto/enum.rst:1354 msgid "Using an auto-numbering :meth:`__new__` would look like::" msgstr "" -#: ../../howto/enum.rst:1333 +#: ../../howto/enum.rst:1356 msgid "" ">>> class AutoNumber(Enum):\n" "... def __new__(cls):\n" @@ -2467,13 +2504,13 @@ msgstr "" ">>> Color.GREEN\n" "" -#: ../../howto/enum.rst:1348 +#: ../../howto/enum.rst:1371 msgid "" "To make a more general purpose ``AutoNumber``, add ``*args`` to the " "signature::" msgstr "" -#: ../../howto/enum.rst:1350 +#: ../../howto/enum.rst:1373 msgid "" ">>> class AutoNumber(Enum):\n" "... def __new__(cls, *args): # this is the only change from above\n" @@ -2484,13 +2521,13 @@ msgid "" "..." msgstr "" -#: ../../howto/enum.rst:1358 +#: ../../howto/enum.rst:1381 msgid "" "Then when you inherit from ``AutoNumber`` you can write your own " "``__init__`` to handle any extra arguments::" msgstr "" -#: ../../howto/enum.rst:1361 +#: ../../howto/enum.rst:1384 msgid "" ">>> class Swatch(AutoNumber):\n" "... def __init__(self, pantone='unknown'):\n" @@ -2507,35 +2544,35 @@ msgid "" "'unknown'" msgstr "" -#: ../../howto/enum.rst:1377 +#: ../../howto/enum.rst:1400 msgid "" "The :meth:`__new__` method, if defined, is used during creation of the Enum " "members; it is then replaced by Enum's :meth:`__new__` which is used after " "class creation for lookup of existing members." msgstr "" -#: ../../howto/enum.rst:1383 +#: ../../howto/enum.rst:1406 msgid "" "*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the " "one that is found; instead, use the data type directly -- e.g.::" msgstr "" -#: ../../howto/enum.rst:1386 +#: ../../howto/enum.rst:1409 msgid "obj = int.__new__(cls, value)" msgstr "obj = int.__new__(cls, value)" -#: ../../howto/enum.rst:1390 +#: ../../howto/enum.rst:1413 msgid "OrderedEnum" msgstr "OrderedEnum" -#: ../../howto/enum.rst:1392 +#: ../../howto/enum.rst:1415 msgid "" "An ordered enumeration that is not based on :class:`IntEnum` and so " "maintains the normal :class:`Enum` invariants (such as not being comparable " "to other enumerations)::" msgstr "" -#: ../../howto/enum.rst:1396 +#: ../../howto/enum.rst:1419 msgid "" ">>> class OrderedEnum(Enum):\n" "... def __ge__(self, other):\n" @@ -2593,17 +2630,17 @@ msgstr "" ">>> Grade.C < Grade.A\n" "True" -#: ../../howto/enum.rst:1426 +#: ../../howto/enum.rst:1449 msgid "DuplicateFreeEnum" msgstr "DuplicateFreeEnum" -#: ../../howto/enum.rst:1428 +#: ../../howto/enum.rst:1451 msgid "" "Raises an error if a duplicate member value is found instead of creating an " "alias::" msgstr "" -#: ../../howto/enum.rst:1431 +#: ../../howto/enum.rst:1454 msgid "" ">>> class DuplicateFreeEnum(Enum):\n" "... def __init__(self, *args):\n" @@ -2627,24 +2664,52 @@ msgid "" "ValueError: aliases not allowed in DuplicateFreeEnum: 'GRENE' --> 'GREEN'" msgstr "" -#: ../../howto/enum.rst:1453 +#: ../../howto/enum.rst:1476 msgid "" "This is a useful example for subclassing Enum to add or change other " "behaviors as well as disallowing aliases. If the only desired change is " "disallowing aliases, the :func:`unique` decorator can be used instead." msgstr "" -#: ../../howto/enum.rst:1459 +#: ../../howto/enum.rst:1482 +msgid "MultiValueEnum" +msgstr "" + +#: ../../howto/enum.rst:1484 +msgid "Supports having more than one value per member::" +msgstr "" + +#: ../../howto/enum.rst:1486 +msgid "" +">>> class MultiValueEnum(Enum):\n" +"... def __new__(cls, value, *values):\n" +"... self = object.__new__(cls)\n" +"... self._value_ = value\n" +"... for v in values:\n" +"... self._add_value_alias_(v)\n" +"... return self\n" +"...\n" +">>> class DType(MultiValueEnum):\n" +"... float32 = 'f', 8\n" +"... double64 = 'd', 9\n" +"...\n" +">>> DType('f')\n" +"\n" +">>> DType(9)\n" +"" +msgstr "" + +#: ../../howto/enum.rst:1505 msgid "Planet" msgstr "" -#: ../../howto/enum.rst:1461 +#: ../../howto/enum.rst:1507 msgid "" "If :meth:`__new__` or :meth:`__init__` is defined, the value of the enum " "member will be passed to those methods::" msgstr "" -#: ../../howto/enum.rst:1464 +#: ../../howto/enum.rst:1510 msgid "" ">>> class Planet(Enum):\n" "... MERCURY = (3.303e+23, 2.4397e6)\n" @@ -2670,15 +2735,15 @@ msgid "" "9.802652743337129" msgstr "" -#: ../../howto/enum.rst:1490 +#: ../../howto/enum.rst:1536 msgid "TimePeriod" msgstr "" -#: ../../howto/enum.rst:1492 +#: ../../howto/enum.rst:1538 msgid "An example to show the :attr:`_ignore_` attribute in use::" msgstr "" -#: ../../howto/enum.rst:1494 +#: ../../howto/enum.rst:1540 msgid "" ">>> from datetime import timedelta\n" ">>> class Period(timedelta, Enum):\n" @@ -2696,11 +2761,11 @@ msgid "" "timedelta(days=366)>]" msgstr "" -#: ../../howto/enum.rst:1511 +#: ../../howto/enum.rst:1557 msgid "Subclassing EnumType" msgstr "" -#: ../../howto/enum.rst:1513 +#: ../../howto/enum.rst:1559 msgid "" "While most enum needs can be met by customizing :class:`Enum` subclasses, " "either with class decorators or custom functions, :class:`EnumType` can be " diff --git a/howto/free-threading-extensions.po b/howto/free-threading-extensions.po new file mode 100644 index 0000000000..08d6aaa97a --- /dev/null +++ b/howto/free-threading-extensions.po @@ -0,0 +1,451 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../howto/free-threading-extensions.rst:7 +msgid "C API Extension Support for Free Threading" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:9 +msgid "" +"Starting with the 3.13 release, CPython has experimental support for running " +"with the :term:`global interpreter lock` (GIL) disabled in a configuration " +"called :term:`free threading`. This document describes how to adapt C API " +"extensions to support free threading." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:16 +msgid "Identifying the Free-Threaded Build in C" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:18 +msgid "" +"The CPython C API exposes the ``Py_GIL_DISABLED`` macro: in the free-" +"threaded build it's defined to ``1``, and in the regular build it's not " +"defined. You can use it to enable code that only runs under the free-" +"threaded build::" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:22 +msgid "" +"#ifdef Py_GIL_DISABLED\n" +"/* code that only runs in the free-threaded build */\n" +"#endif" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:27 +msgid "Module Initialization" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:29 +msgid "" +"Extension modules need to explicitly indicate that they support running with " +"the GIL disabled; otherwise importing the extension will raise a warning and " +"enable the GIL at runtime." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:33 +msgid "" +"There are two ways to indicate that an extension module supports running " +"with the GIL disabled depending on whether the extension uses multi-phase or " +"single-phase initialization." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:38 +msgid "Multi-Phase Initialization" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:40 +msgid "" +"Extensions that use multi-phase initialization (i.e., :c:func:" +"`PyModuleDef_Init`) should add a :c:data:`Py_mod_gil` slot in the module " +"definition. If your extension supports older versions of CPython, you " +"should guard the slot with a :c:data:`PY_VERSION_HEX` check." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:47 +msgid "" +"static struct PyModuleDef_Slot module_slots[] = {\n" +" ...\n" +"#if PY_VERSION_HEX >= 0x030D0000\n" +" {Py_mod_gil, Py_MOD_GIL_NOT_USED},\n" +"#endif\n" +" {0, NULL}\n" +"};\n" +"\n" +"static struct PyModuleDef moduledef = {\n" +" PyModuleDef_HEAD_INIT,\n" +" .m_slots = module_slots,\n" +" ...\n" +"};" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:63 +msgid "Single-Phase Initialization" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:65 +msgid "" +"Extensions that use single-phase initialization (i.e., :c:func:" +"`PyModule_Create`) should call :c:func:`PyUnstable_Module_SetGIL` to " +"indicate that they support running with the GIL disabled. The function is " +"only defined in the free-threaded build, so you should guard the call with " +"``#ifdef Py_GIL_DISABLED`` to avoid compilation errors in the regular build." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:73 +msgid "" +"static struct PyModuleDef moduledef = {\n" +" PyModuleDef_HEAD_INIT,\n" +" ...\n" +"};\n" +"\n" +"PyMODINIT_FUNC\n" +"PyInit_mymodule(void)\n" +"{\n" +" PyObject *m = PyModule_Create(&moduledef);\n" +" if (m == NULL) {\n" +" return NULL;\n" +" }\n" +"#ifdef Py_GIL_DISABLED\n" +" PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);\n" +"#endif\n" +" return m;\n" +"}" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:93 +msgid "General API Guidelines" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:95 +msgid "Most of the C API is thread-safe, but there are some exceptions." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:97 +msgid "" +"**Struct Fields**: Accessing fields in Python C API objects or structs " +"directly is not thread-safe if the field may be concurrently modified." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:99 +msgid "" +"**Macros**: Accessor macros like :c:macro:`PyList_GET_ITEM` and :c:macro:" +"`PyList_SET_ITEM` do not perform any error checking or locking. These macros " +"are not thread-safe if the container object may be modified concurrently." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:103 +msgid "" +"**Borrowed References**: C API functions that return :term:`borrowed " +"references ` may not be thread-safe if the containing " +"object is modified concurrently. See the section on :ref:`borrowed " +"references ` for more information." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:110 +msgid "Container Thread Safety" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:112 +msgid "" +"Containers like :c:struct:`PyListObject`, :c:struct:`PyDictObject`, and :c:" +"struct:`PySetObject` perform internal locking in the free-threaded build. " +"For example, the :c:func:`PyList_Append` will lock the list before appending " +"an item." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:120 +msgid "``PyDict_Next``" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:122 +msgid "" +"A notable exception is :c:func:`PyDict_Next`, which does not lock the " +"dictionary. You should use :c:macro:`Py_BEGIN_CRITICAL_SECTION` to protect " +"the dictionary while iterating over it if the dictionary may be concurrently " +"modified::" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:127 +msgid "" +"Py_BEGIN_CRITICAL_SECTION(dict);\n" +"PyObject *key, *value;\n" +"Py_ssize_t pos = 0;\n" +"while (PyDict_Next(dict, &pos, &key, &value)) {\n" +" ...\n" +"}\n" +"Py_END_CRITICAL_SECTION();" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:137 +msgid "Borrowed References" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:141 +msgid "" +"Some C API functions return :term:`borrowed references `. These APIs are not thread-safe if the containing object is " +"modified concurrently. For example, it's not safe to use :c:func:" +"`PyList_GetItem` if the list may be modified concurrently." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:146 +msgid "" +"The following table lists some borrowed reference APIs and their " +"replacements that return :term:`strong references `." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:150 +msgid "Borrowed reference API" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:150 +msgid "Strong reference API" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:152 +msgid ":c:func:`PyList_GetItem`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:152 +msgid ":c:func:`PyList_GetItemRef`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:154 +msgid ":c:func:`PyDict_GetItem`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:154 +#: ../../howto/free-threading-extensions.rst:156 +msgid ":c:func:`PyDict_GetItemRef`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:156 +msgid ":c:func:`PyDict_GetItemWithError`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:158 +msgid ":c:func:`PyDict_GetItemString`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:158 +msgid ":c:func:`PyDict_GetItemStringRef`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:160 +msgid ":c:func:`PyDict_SetDefault`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:160 +msgid ":c:func:`PyDict_SetDefaultRef`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:162 +msgid ":c:func:`PyDict_Next`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:162 +msgid "none (see :ref:`PyDict_Next`)" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:164 +msgid ":c:func:`PyWeakref_GetObject`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:164 +#: ../../howto/free-threading-extensions.rst:166 +msgid ":c:func:`PyWeakref_GetRef`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:166 +msgid ":c:func:`PyWeakref_GET_OBJECT`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:168 +msgid ":c:func:`PyImport_AddModule`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:168 +msgid ":c:func:`PyImport_AddModuleRef`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:171 +msgid "" +"Not all APIs that return borrowed references are problematic. For example, :" +"c:func:`PyTuple_GetItem` is safe because tuples are immutable. Similarly, " +"not all uses of the above APIs are problematic. For example, :c:func:" +"`PyDict_GetItem` is often used for parsing keyword argument dictionaries in " +"function calls; those keyword argument dictionaries are effectively private " +"(not accessible by other threads), so using borrowed references in that " +"context is safe." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:179 +msgid "" +"Some of these functions were added in Python 3.13. You can use the " +"`pythoncapi-compat `_ package " +"to provide implementations of these functions for older Python versions." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:185 +msgid "Memory Allocation APIs" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:187 +msgid "" +"Python's memory management C API provides functions in three different :ref:" +"`allocation domains `: \"raw\", \"mem\", and \"object\". " +"For thread-safety, the free-threaded build requires that only Python objects " +"are allocated using the object domain, and that all Python object are " +"allocated using that domain. This differs from the prior Python versions, " +"where this was only a best practice and not a hard requirement." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:196 +msgid "" +"Search for uses of :c:func:`PyObject_Malloc` in your extension and check " +"that the allocated memory is used for Python objects. Use :c:func:" +"`PyMem_Malloc` to allocate buffers instead of :c:func:`PyObject_Malloc`." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:203 +msgid "Thread State and GIL APIs" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:205 +msgid "" +"Python provides a set of functions and macros to manage thread state and the " +"GIL, such as:" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:208 +msgid ":c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:209 +msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:210 +msgid ":c:macro:`Py_BEGIN_ALLOW_THREADS` and :c:macro:`Py_END_ALLOW_THREADS`" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:212 +msgid "" +"These functions should still be used in the free-threaded build to manage " +"thread state even when the :term:`GIL` is disabled. For example, if you " +"create a thread outside of Python, you must call :c:func:`PyGILState_Ensure` " +"before calling into the Python API to ensure that the thread has a valid " +"Python thread state." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:218 +msgid "" +"You should continue to call :c:func:`PyEval_SaveThread` or :c:macro:" +"`Py_BEGIN_ALLOW_THREADS` around blocking operations, such as I/O or lock " +"acquisitions, to allow other threads to run the :term:`cyclic garbage " +"collector `." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:225 +msgid "Protecting Internal Extension State" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:227 +msgid "" +"Your extension may have internal state that was previously protected by the " +"GIL. You may need to add locking to protect this state. The approach will " +"depend on your extension, but some common patterns include:" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:231 +msgid "" +"**Caches**: global caches are a common source of shared state. Consider " +"using a lock to protect the cache or disabling it in the free-threaded build " +"if the cache is not critical for performance." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:234 +msgid "" +"**Global State**: global state may need to be protected by a lock or moved " +"to thread local storage. C11 and C++11 provide the ``thread_local`` or " +"``_Thread_local`` for `thread-local storage `_." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:241 +msgid "Building Extensions for the Free-Threaded Build" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:243 +msgid "" +"C API extensions need to be built specifically for the free-threaded build. " +"The wheels, shared libraries, and binaries are indicated by a ``t`` suffix." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:246 +msgid "" +"`pypa/manylinux `_ supports the free-" +"threaded build, with the ``t`` suffix, such as ``python3.13t``." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:248 +msgid "" +"`pypa/cibuildwheel `_ supports the " +"free-threaded build if you set `CIBW_FREE_THREADED_SUPPORT `_." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:253 +msgid "Limited C API and Stable ABI" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:255 +msgid "" +"The free-threaded build does not currently support the :ref:`Limited C API " +"` or the stable ABI. If you use `setuptools `_ to build your extension and " +"currently set ``py_limited_api=True`` you can use ``py_limited_api=not " +"sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` to opt out of the limited " +"API when building with the free-threaded build." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:263 +msgid "" +"You will need to build separate wheels specifically for the free-threaded " +"build. If you currently use the stable ABI, you can continue to build a " +"single wheel for multiple non-free-threaded Python versions." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:269 +msgid "Windows" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:271 +msgid "" +"Due to a limitation of the official Windows installer, you will need to " +"manually define ``Py_GIL_DISABLED=1`` when building extensions from source." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:276 +msgid "" +"`Porting Extension Modules to Support Free-Threading `_: A community-maintained porting guide for " +"extension authors." +msgstr "" diff --git a/howto/functional.po b/howto/functional.po index 4ba6c8302d..f55926dec9 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: ../../howto/functional.rst:3 +#: ../../howto/functional.rst:5 msgid "Functional Programming HOWTO" msgstr "函式編程 HOWTO" @@ -26,7 +26,7 @@ msgstr "函式編程 HOWTO" msgid "Author" msgstr "作者" -#: ../../howto/functional.rst:5 +#: ../../howto/functional.rst:7 msgid "A. M. Kuchling" msgstr "A. M. Kuchling" @@ -34,11 +34,11 @@ msgstr "A. M. Kuchling" msgid "Release" msgstr "發佈版本" -#: ../../howto/functional.rst:6 +#: ../../howto/functional.rst:8 msgid "0.32" msgstr "0.32" -#: ../../howto/functional.rst:8 +#: ../../howto/functional.rst:10 msgid "" "In this document, we'll take a tour of Python's features suitable for " "implementing programs in a functional style. After an introduction to the " @@ -47,30 +47,30 @@ msgid "" "such as :mod:`itertools` and :mod:`functools`." msgstr "" -#: ../../howto/functional.rst:16 +#: ../../howto/functional.rst:18 msgid "Introduction" msgstr "簡介" -#: ../../howto/functional.rst:18 +#: ../../howto/functional.rst:20 msgid "" "This section explains the basic concept of functional programming; if you're " "just interested in learning about Python language features, skip to the next " "section on :ref:`functional-howto-iterators`." msgstr "" -#: ../../howto/functional.rst:22 +#: ../../howto/functional.rst:24 msgid "" "Programming languages support decomposing problems in several different ways:" msgstr "" -#: ../../howto/functional.rst:24 +#: ../../howto/functional.rst:26 msgid "" "Most programming languages are **procedural**: programs are lists of " "instructions that tell the computer what to do with the program's input. C, " "Pascal, and even Unix shells are procedural languages." msgstr "" -#: ../../howto/functional.rst:28 +#: ../../howto/functional.rst:30 msgid "" "In **declarative** languages, you write a specification that describes the " "problem to be solved, and the language implementation figures out how to " @@ -80,7 +80,7 @@ msgid "" "indexes, which subclauses should be performed first, etc." msgstr "" -#: ../../howto/functional.rst:35 +#: ../../howto/functional.rst:37 msgid "" "**Object-oriented** programs manipulate collections of objects. Objects " "have internal state and support methods that query or modify this internal " @@ -89,7 +89,7 @@ msgid "" "force the use of object-oriented features." msgstr "" -#: ../../howto/functional.rst:41 +#: ../../howto/functional.rst:43 msgid "" "**Functional** programming decomposes a problem into a set of functions. " "Ideally, functions only take inputs and produce outputs, and don't have any " @@ -98,7 +98,7 @@ msgid "" "other variants) and Haskell." msgstr "" -#: ../../howto/functional.rst:47 +#: ../../howto/functional.rst:49 msgid "" "The designers of some computer languages choose to emphasize one particular " "approach to programming. This often makes it difficult to write programs " @@ -111,7 +111,7 @@ msgid "" "functional, for example." msgstr "" -#: ../../howto/functional.rst:58 +#: ../../howto/functional.rst:60 msgid "" "In a functional program, input flows through a set of functions. Each " "function operates on its input and produces some output. Functional style " @@ -122,7 +122,7 @@ msgid "" "runs; every function's output must only depend on its input." msgstr "" -#: ../../howto/functional.rst:66 +#: ../../howto/functional.rst:68 msgid "" "Some languages are very strict about purity and don't even have assignment " "statements such as ``a=3`` or ``c = a + b``, but it's difficult to avoid all " @@ -133,7 +133,7 @@ msgid "" "for a second." msgstr "" -#: ../../howto/functional.rst:73 +#: ../../howto/functional.rst:75 msgid "" "Python programs written in functional style usually won't go to the extreme " "of avoiding all I/O or all assignments; instead, they'll provide a " @@ -143,7 +143,7 @@ msgid "" "other side effects." msgstr "" -#: ../../howto/functional.rst:79 +#: ../../howto/functional.rst:81 msgid "" "Functional programming can be considered the opposite of object-oriented " "programming. Objects are little capsules containing some internal state " @@ -155,40 +155,40 @@ msgid "" "objects in your application (e-mail messages, transactions, etc.)." msgstr "" -#: ../../howto/functional.rst:88 +#: ../../howto/functional.rst:90 msgid "" "Functional design may seem like an odd constraint to work under. Why should " "you avoid objects and side effects? There are theoretical and practical " "advantages to the functional style:" msgstr "" -#: ../../howto/functional.rst:92 +#: ../../howto/functional.rst:94 msgid "Formal provability." msgstr "" -#: ../../howto/functional.rst:93 +#: ../../howto/functional.rst:95 msgid "Modularity." msgstr "" -#: ../../howto/functional.rst:94 +#: ../../howto/functional.rst:96 msgid "Composability." msgstr "" -#: ../../howto/functional.rst:95 +#: ../../howto/functional.rst:97 msgid "Ease of debugging and testing." msgstr "" -#: ../../howto/functional.rst:99 +#: ../../howto/functional.rst:101 msgid "Formal provability" msgstr "" -#: ../../howto/functional.rst:101 +#: ../../howto/functional.rst:103 msgid "" "A theoretical benefit is that it's easier to construct a mathematical proof " "that a functional program is correct." msgstr "" -#: ../../howto/functional.rst:104 +#: ../../howto/functional.rst:106 msgid "" "For a long time researchers have been interested in finding ways to " "mathematically prove programs correct. This is different from testing a " @@ -198,7 +198,7 @@ msgid "" "the right result for all possible inputs." msgstr "" -#: ../../howto/functional.rst:111 +#: ../../howto/functional.rst:113 msgid "" "The technique used to prove programs correct is to write down " "**invariants**, properties of the input data and of the program's variables " @@ -209,7 +209,7 @@ msgid "" "invariants should match the desired conditions on the program's output." msgstr "" -#: ../../howto/functional.rst:119 +#: ../../howto/functional.rst:121 msgid "" "Functional programming's avoidance of assignments arose because assignments " "are difficult to handle with this technique; assignments can break " @@ -217,7 +217,7 @@ msgid "" "invariants that can be propagated onward." msgstr "" -#: ../../howto/functional.rst:124 +#: ../../howto/functional.rst:126 msgid "" "Unfortunately, proving programs correct is largely impractical and not " "relevant to Python software. Even trivial programs require proofs that are " @@ -229,11 +229,11 @@ msgid "" "wrongly believe you've proved the program correct." msgstr "" -#: ../../howto/functional.rst:135 +#: ../../howto/functional.rst:137 msgid "Modularity" msgstr "" -#: ../../howto/functional.rst:137 +#: ../../howto/functional.rst:139 msgid "" "A more practical benefit of functional programming is that it forces you to " "break apart your problem into small pieces. Programs are more modular as a " @@ -242,15 +242,15 @@ msgid "" "Small functions are also easier to read and to check for errors." msgstr "" -#: ../../howto/functional.rst:145 +#: ../../howto/functional.rst:147 msgid "Ease of debugging and testing" msgstr "" -#: ../../howto/functional.rst:147 +#: ../../howto/functional.rst:149 msgid "Testing and debugging a functional-style program is easier." msgstr "" -#: ../../howto/functional.rst:149 +#: ../../howto/functional.rst:151 msgid "" "Debugging is simplified because functions are generally small and clearly " "specified. When a program doesn't work, each function is an interface point " @@ -259,7 +259,7 @@ msgid "" "responsible for a bug." msgstr "" -#: ../../howto/functional.rst:154 +#: ../../howto/functional.rst:156 msgid "" "Testing is easier because each function is a potential subject for a unit " "test. Functions don't depend on system state that needs to be replicated " @@ -267,11 +267,11 @@ msgid "" "and then check that the output matches expectations." msgstr "" -#: ../../howto/functional.rst:161 +#: ../../howto/functional.rst:163 msgid "Composability" msgstr "" -#: ../../howto/functional.rst:163 +#: ../../howto/functional.rst:165 msgid "" "As you work on a functional-style program, you'll write a number of " "functions with varying inputs and outputs. Some of these functions will be " @@ -282,24 +282,24 @@ msgid "" "different situations." msgstr "" -#: ../../howto/functional.rst:170 +#: ../../howto/functional.rst:172 msgid "" "Over time you'll form a personal library of utilities. Often you'll " "assemble new programs by arranging existing functions in a new configuration " "and writing a few functions specialized for the current task." msgstr "" -#: ../../howto/functional.rst:178 +#: ../../howto/functional.rst:180 msgid "Iterators" msgstr "" -#: ../../howto/functional.rst:180 +#: ../../howto/functional.rst:182 msgid "" "I'll start by looking at a Python language feature that's an important " "foundation for writing functional-style programs: iterators." msgstr "" -#: ../../howto/functional.rst:183 +#: ../../howto/functional.rst:185 msgid "" "An iterator is an object representing a stream of data; this object returns " "the data one element at a time. A Python iterator must support a method " @@ -310,7 +310,7 @@ msgid "" "reasonable to write an iterator that produces an infinite stream of data." msgstr "" -#: ../../howto/functional.rst:191 +#: ../../howto/functional.rst:193 msgid "" "The built-in :func:`iter` function takes an arbitrary object and tries to " "return an iterator that will return the object's contents or elements, " @@ -320,11 +320,11 @@ msgid "" "an iterator for it." msgstr "" -#: ../../howto/functional.rst:198 +#: ../../howto/functional.rst:200 msgid "You can experiment with the iteration interface manually:" msgstr "" -#: ../../howto/functional.rst:216 +#: ../../howto/functional.rst:218 msgid "" "Python expects iterable objects in several different contexts, the most " "important being the :keyword:`for` statement. In the statement ``for X in " @@ -332,7 +332,7 @@ msgid "" "an iterator. These two statements are equivalent::" msgstr "" -#: ../../howto/functional.rst:222 +#: ../../howto/functional.rst:224 msgid "" "for i in iter(obj):\n" " print(i)\n" @@ -346,19 +346,19 @@ msgstr "" "for i in obj:\n" " print(i)" -#: ../../howto/functional.rst:228 +#: ../../howto/functional.rst:230 msgid "" "Iterators can be materialized as lists or tuples by using the :func:`list` " "or :func:`tuple` constructor functions:" msgstr "" -#: ../../howto/functional.rst:237 +#: ../../howto/functional.rst:239 msgid "" "Sequence unpacking also supports iterators: if you know an iterator will " "return N elements, you can unpack them into an N-tuple:" msgstr "" -#: ../../howto/functional.rst:246 +#: ../../howto/functional.rst:248 msgid "" "Built-in functions such as :func:`max` and :func:`min` can take a single " "iterator argument and will return the largest or smallest element. The " @@ -369,7 +369,7 @@ msgid "" "stream, the ``\"in\"`` and ``\"not in\"`` operators won't return either." msgstr "" -#: ../../howto/functional.rst:254 +#: ../../howto/functional.rst:256 msgid "" "Note that you can only go forward in an iterator; there's no way to get the " "previous element, reset the iterator, or make a copy of it. Iterator " @@ -380,24 +380,24 @@ msgid "" "new iterator." msgstr "" -#: ../../howto/functional.rst:264 +#: ../../howto/functional.rst:266 msgid "Data Types That Support Iterators" msgstr "" -#: ../../howto/functional.rst:266 +#: ../../howto/functional.rst:268 msgid "" "We've already seen how lists and tuples support iterators. In fact, any " "Python sequence type, such as strings, will automatically support creation " "of an iterator." msgstr "" -#: ../../howto/functional.rst:270 +#: ../../howto/functional.rst:272 msgid "" "Calling :func:`iter` on a dictionary returns an iterator that will loop over " "the dictionary's keys::" msgstr "" -#: ../../howto/functional.rst:273 +#: ../../howto/functional.rst:275 msgid "" ">>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,\n" "... 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}\n" @@ -433,14 +433,14 @@ msgstr "" "Nov 11\n" "Dec 12" -#: ../../howto/functional.rst:290 +#: ../../howto/functional.rst:292 msgid "" "Note that starting with Python 3.7, dictionary iteration order is guaranteed " "to be the same as the insertion order. In earlier versions, the behaviour " "was unspecified and could vary between implementations." msgstr "" -#: ../../howto/functional.rst:294 +#: ../../howto/functional.rst:296 msgid "" "Applying :func:`iter` to a dictionary always loops over the keys, but " "dictionaries have methods that return other iterators. If you want to " @@ -448,33 +448,33 @@ msgid "" "`~dict.values` or :meth:`~dict.items` methods to get an appropriate iterator." msgstr "" -#: ../../howto/functional.rst:300 +#: ../../howto/functional.rst:302 msgid "" "The :func:`dict` constructor can accept an iterator that returns a finite " "stream of ``(key, value)`` tuples:" msgstr "" -#: ../../howto/functional.rst:307 +#: ../../howto/functional.rst:309 msgid "" "Files also support iteration by calling the :meth:`~io.TextIOBase.readline` " "method until there are no more lines in the file. This means you can read " "each line of a file like this::" msgstr "" -#: ../../howto/functional.rst:311 +#: ../../howto/functional.rst:313 msgid "" "for line in file:\n" " # do something for each line\n" " ..." msgstr "" -#: ../../howto/functional.rst:315 +#: ../../howto/functional.rst:317 msgid "" "Sets can take their contents from an iterable and let you iterate over the " "set's elements::" msgstr "" -#: ../../howto/functional.rst:318 +#: ../../howto/functional.rst:320 msgid "" ">>> S = {2, 3, 5, 7, 11, 13}\n" ">>> for i in S:\n" @@ -496,11 +496,11 @@ msgstr "" "11\n" "13" -#: ../../howto/functional.rst:331 +#: ../../howto/functional.rst:333 msgid "Generator expressions and list comprehensions" msgstr "" -#: ../../howto/functional.rst:333 +#: ../../howto/functional.rst:335 msgid "" "Two common operations on an iterator's output are 1) performing some " "operation for every element, 2) selecting a subset of elements that meet " @@ -509,7 +509,7 @@ msgid "" "containing a given substring." msgstr "" -#: ../../howto/functional.rst:339 +#: ../../howto/functional.rst:341 msgid "" "List comprehensions and generator expressions (short form: \"listcomps\" and " "\"genexps\") are a concise notation for such operations, borrowed from the " @@ -517,7 +517,7 @@ msgid "" "strip all the whitespace from a stream of strings with the following code::" msgstr "" -#: ../../howto/functional.rst:344 +#: ../../howto/functional.rst:346 msgid "" ">>> line_list = [' line 1\\n', 'line 2 \\n', ' \\n', '']\n" "\n" @@ -528,12 +528,12 @@ msgid "" ">>> stripped_list = [line.strip() for line in line_list]" msgstr "" -#: ../../howto/functional.rst:352 +#: ../../howto/functional.rst:354 msgid "" "You can select only certain elements by adding an ``\"if\"`` condition::" msgstr "" -#: ../../howto/functional.rst:354 +#: ../../howto/functional.rst:356 msgid "" ">>> stripped_list = [line.strip() for line in line_list\n" "... if line != \"\"]" @@ -541,7 +541,7 @@ msgstr "" ">>> stripped_list = [line.strip() for line in line_list\n" "... if line != \"\"]" -#: ../../howto/functional.rst:357 +#: ../../howto/functional.rst:359 msgid "" "With a list comprehension, you get back a Python list; ``stripped_list`` is " "a list containing the resulting lines, not an iterator. Generator " @@ -552,14 +552,14 @@ msgid "" "preferable in these situations." msgstr "" -#: ../../howto/functional.rst:364 +#: ../../howto/functional.rst:366 msgid "" "Generator expressions are surrounded by parentheses (\"()\") and list " "comprehensions are surrounded by square brackets (\"[]\"). Generator " "expressions have the form::" msgstr "" -#: ../../howto/functional.rst:368 +#: ../../howto/functional.rst:370 msgid "" "( expression for expr in sequence1\n" " if condition1\n" @@ -581,13 +581,13 @@ msgstr "" " for exprN in sequenceN\n" " if conditionN )" -#: ../../howto/functional.rst:378 +#: ../../howto/functional.rst:380 msgid "" "Again, for a list comprehension only the outside brackets are different " "(square brackets instead of parentheses)." msgstr "" -#: ../../howto/functional.rst:381 +#: ../../howto/functional.rst:383 msgid "" "The elements of the generated output will be the successive values of " "``expression``. The ``if`` clauses are all optional; if present, " @@ -595,18 +595,18 @@ msgid "" "is true." msgstr "" -#: ../../howto/functional.rst:385 +#: ../../howto/functional.rst:387 msgid "" "Generator expressions always have to be written inside parentheses, but the " "parentheses signalling a function call also count. If you want to create an " "iterator that will be immediately passed to a function you can write::" msgstr "" -#: ../../howto/functional.rst:389 +#: ../../howto/functional.rst:391 msgid "obj_total = sum(obj.count for obj in list_all_objects())" msgstr "obj_total = sum(obj.count for obj in list_all_objects())" -#: ../../howto/functional.rst:391 +#: ../../howto/functional.rst:393 msgid "" "The ``for...in`` clauses contain the sequences to be iterated over. The " "sequences do not have to be the same length, because they are iterated over " @@ -616,13 +616,13 @@ msgid "" "``sequence2``." msgstr "" -#: ../../howto/functional.rst:397 +#: ../../howto/functional.rst:399 msgid "" "To put it another way, a list comprehension or generator expression is " "equivalent to the following Python code::" msgstr "" -#: ../../howto/functional.rst:400 +#: ../../howto/functional.rst:402 msgid "" "for expr1 in sequence1:\n" " if not (condition1):\n" @@ -639,7 +639,7 @@ msgid "" " # the expression." msgstr "" -#: ../../howto/functional.rst:414 +#: ../../howto/functional.rst:416 msgid "" "This means that when there are multiple ``for...in`` clauses but no ``if`` " "clauses, the length of the resulting output will be equal to the product of " @@ -647,14 +647,14 @@ msgid "" "output list is 9 elements long:" msgstr "" -#: ../../howto/functional.rst:426 +#: ../../howto/functional.rst:428 msgid "" "To avoid introducing an ambiguity into Python's grammar, if ``expression`` " "is creating a tuple, it must be surrounded with parentheses. The first list " "comprehension below is a syntax error, while the second one is correct::" msgstr "" -#: ../../howto/functional.rst:430 +#: ../../howto/functional.rst:432 msgid "" "# Syntax error\n" "[x, y for x in seq1 for y in seq2]\n" @@ -666,18 +666,18 @@ msgstr "" "# 正確\n" "[(x, y) for x in seq1 for y in seq2]" -#: ../../howto/functional.rst:437 +#: ../../howto/functional.rst:439 msgid "Generators" msgstr "" -#: ../../howto/functional.rst:439 +#: ../../howto/functional.rst:441 msgid "" "Generators are a special class of functions that simplify the task of " "writing iterators. Regular functions compute a value and return it, but " "generators return an iterator that returns a stream of values." msgstr "" -#: ../../howto/functional.rst:443 +#: ../../howto/functional.rst:445 msgid "" "You're doubtless familiar with how regular function calls work in Python or " "C. When you call a function, it gets a private namespace where its local " @@ -690,18 +690,18 @@ msgid "" "thought of as resumable functions." msgstr "" -#: ../../howto/functional.rst:452 +#: ../../howto/functional.rst:454 msgid "Here's the simplest example of a generator function:" msgstr "" -#: ../../howto/functional.rst:458 +#: ../../howto/functional.rst:460 msgid "" "Any function containing a :keyword:`yield` keyword is a generator function; " "this is detected by Python's :term:`bytecode` compiler which compiles the " "function specially as a result." msgstr "" -#: ../../howto/functional.rst:462 +#: ../../howto/functional.rst:464 msgid "" "When you call a generator function, it doesn't return a single value; " "instead it returns a generator object that supports the iterator protocol. " @@ -713,17 +713,17 @@ msgid "" "method, the function will resume executing." msgstr "" -#: ../../howto/functional.rst:471 +#: ../../howto/functional.rst:473 msgid "Here's a sample usage of the ``generate_ints()`` generator:" msgstr "" -#: ../../howto/functional.rst:488 +#: ../../howto/functional.rst:490 msgid "" "You could equally write ``for i in generate_ints(5)``, or ``a, b, c = " "generate_ints(3)``." msgstr "" -#: ../../howto/functional.rst:491 +#: ../../howto/functional.rst:493 msgid "" "Inside a generator function, ``return value`` causes " "``StopIteration(value)`` to be raised from the :meth:`~generator.__next__` " @@ -731,7 +731,7 @@ msgid "" "procession of values ends and the generator cannot yield any further values." msgstr "" -#: ../../howto/functional.rst:496 +#: ../../howto/functional.rst:498 msgid "" "You could achieve the effect of generators manually by writing your own " "class and storing all the local variables of the generator as instance " @@ -741,7 +741,7 @@ msgid "" "complicated generator, writing a corresponding class can be much messier." msgstr "" -#: ../../howto/functional.rst:504 +#: ../../howto/functional.rst:506 msgid "" "The test suite included with Python's library, :source:`Lib/test/" "test_generators.py`, contains a number of more interesting examples. Here's " @@ -749,7 +749,7 @@ msgid "" "generators recursively. ::" msgstr "" -#: ../../howto/functional.rst:509 +#: ../../howto/functional.rst:511 msgid "" "# A recursive generator that generates Tree leaves in in-order.\n" "def inorder(t):\n" @@ -763,7 +763,7 @@ msgid "" " yield x" msgstr "" -#: ../../howto/functional.rst:520 +#: ../../howto/functional.rst:522 msgid "" "Two other examples in ``test_generators.py`` produce solutions for the N-" "Queens problem (placing N queens on an NxN chess board so that no queen " @@ -772,11 +772,11 @@ msgid "" "twice)." msgstr "" -#: ../../howto/functional.rst:528 +#: ../../howto/functional.rst:530 msgid "Passing values into a generator" msgstr "" -#: ../../howto/functional.rst:530 +#: ../../howto/functional.rst:532 msgid "" "In Python 2.4 and earlier, generators only produced output. Once a " "generator's code was invoked to create an iterator, there was no way to pass " @@ -786,18 +786,18 @@ msgid "" "these approaches are messy." msgstr "" -#: ../../howto/functional.rst:537 +#: ../../howto/functional.rst:539 msgid "" "In Python 2.5 there's a simple way to pass values into a generator. :keyword:" "`yield` became an expression, returning a value that can be assigned to a " "variable or otherwise operated on::" msgstr "" -#: ../../howto/functional.rst:541 +#: ../../howto/functional.rst:543 msgid "val = (yield i)" msgstr "val = (yield i)" -#: ../../howto/functional.rst:543 +#: ../../howto/functional.rst:545 msgid "" "I recommend that you **always** put parentheses around a ``yield`` " "expression when you're doing something with the returned value, as in the " @@ -805,7 +805,7 @@ msgid "" "always add them instead of having to remember when they're needed." msgstr "" -#: ../../howto/functional.rst:548 +#: ../../howto/functional.rst:550 msgid "" "(:pep:`342` explains the exact rules, which are that a ``yield``-expression " "must always be parenthesized except when it occurs at the top-level " @@ -814,7 +814,7 @@ msgid "" "operation, as in ``val = (yield i) + 12``.)" msgstr "" -#: ../../howto/functional.rst:554 +#: ../../howto/functional.rst:556 msgid "" "Values are sent into a generator by calling its :meth:`send(value) " "` method. This method resumes the generator's code and the " @@ -822,13 +822,13 @@ msgid "" "`~generator.__next__` method is called, the ``yield`` returns ``None``." msgstr "" -#: ../../howto/functional.rst:559 +#: ../../howto/functional.rst:561 msgid "" "Here's a simple counter that increments by 1 and allows changing the value " "of the internal counter." msgstr "" -#: ../../howto/functional.rst:562 +#: ../../howto/functional.rst:564 msgid "" "def counter(maximum):\n" " i = 0\n" @@ -841,11 +841,11 @@ msgid "" " i += 1" msgstr "" -#: ../../howto/functional.rst:574 +#: ../../howto/functional.rst:576 msgid "And here's an example of changing the counter:" msgstr "" -#: ../../howto/functional.rst:591 +#: ../../howto/functional.rst:593 msgid "" "Because ``yield`` will often be returning ``None``, you should always check " "for this case. Don't just use its value in expressions unless you're sure " @@ -853,20 +853,20 @@ msgid "" "resume your generator function." msgstr "" -#: ../../howto/functional.rst:596 +#: ../../howto/functional.rst:598 msgid "" "In addition to :meth:`~generator.send`, there are two other methods on " "generators:" msgstr "" -#: ../../howto/functional.rst:599 +#: ../../howto/functional.rst:601 msgid "" ":meth:`throw(value) ` is used to raise an exception inside " "the generator; the exception is raised by the ``yield`` expression where the " "generator's execution is paused." msgstr "" -#: ../../howto/functional.rst:603 +#: ../../howto/functional.rst:605 msgid "" ":meth:`~generator.close` raises a :exc:`GeneratorExit` exception inside the " "generator to terminate the iteration. On receiving this exception, the " @@ -877,20 +877,20 @@ msgid "" "collected." msgstr "" -#: ../../howto/functional.rst:611 +#: ../../howto/functional.rst:613 msgid "" "If you need to run cleanup code when a :exc:`GeneratorExit` occurs, I " "suggest using a ``try: ... finally:`` suite instead of catching :exc:" "`GeneratorExit`." msgstr "" -#: ../../howto/functional.rst:614 +#: ../../howto/functional.rst:616 msgid "" "The cumulative effect of these changes is to turn generators from one-way " "producers of information into both producers and consumers." msgstr "" -#: ../../howto/functional.rst:617 +#: ../../howto/functional.rst:619 msgid "" "Generators also become **coroutines**, a more generalized form of " "subroutines. Subroutines are entered at one point and exited at another " @@ -899,36 +899,36 @@ msgid "" "statements)." msgstr "" -#: ../../howto/functional.rst:624 +#: ../../howto/functional.rst:626 msgid "Built-in functions" msgstr "內建函式" -#: ../../howto/functional.rst:626 +#: ../../howto/functional.rst:628 msgid "" "Let's look in more detail at built-in functions often used with iterators." msgstr "" -#: ../../howto/functional.rst:628 +#: ../../howto/functional.rst:630 msgid "" "Two of Python's built-in functions, :func:`map` and :func:`filter` duplicate " "the features of generator expressions:" msgstr "" -#: ../../howto/functional.rst:631 +#: ../../howto/functional.rst:633 msgid "" ":func:`map(f, iterA, iterB, ...) ` returns an iterator over the sequence" msgstr "" -#: ../../howto/functional.rst:632 +#: ../../howto/functional.rst:634 msgid "" "``f(iterA[0], iterB[0]), f(iterA[1], iterB[1]), f(iterA[2], iterB[2]), ...``." msgstr "" -#: ../../howto/functional.rst:642 +#: ../../howto/functional.rst:644 msgid "You can of course achieve the same effect with a list comprehension." msgstr "" -#: ../../howto/functional.rst:644 +#: ../../howto/functional.rst:646 msgid "" ":func:`filter(predicate, iter) ` returns an iterator over all the " "sequence elements that meet a certain condition, and is similarly duplicated " @@ -937,18 +937,18 @@ msgid "" "must take a single value." msgstr "" -#: ../../howto/functional.rst:657 +#: ../../howto/functional.rst:659 msgid "This can also be written as a list comprehension:" msgstr "" -#: ../../howto/functional.rst:663 +#: ../../howto/functional.rst:665 msgid "" ":func:`enumerate(iter, start=0) ` counts off the elements in the " "iterable returning 2-tuples containing the count (from *start*) and each " "element. ::" msgstr "" -#: ../../howto/functional.rst:667 +#: ../../howto/functional.rst:669 msgid "" ">>> for item in enumerate(['subject', 'verb', 'object']):\n" "... print(item)\n" @@ -962,13 +962,13 @@ msgstr "" "(1, 'verb')\n" "(2, 'object')" -#: ../../howto/functional.rst:673 +#: ../../howto/functional.rst:675 msgid "" ":func:`enumerate` is often used when looping through a list and recording " "the indexes at which certain conditions are met::" msgstr "" -#: ../../howto/functional.rst:676 +#: ../../howto/functional.rst:678 msgid "" "f = open('data.txt', 'r')\n" "for i, line in enumerate(f):\n" @@ -980,7 +980,7 @@ msgstr "" " if line.strip() == '':\n" " print('Blank line at line #%i' % i)" -#: ../../howto/functional.rst:681 +#: ../../howto/functional.rst:683 msgid "" ":func:`sorted(iterable, key=None, reverse=False) ` collects all the " "elements of the iterable into a list, sorts the list, and returns the sorted " @@ -988,7 +988,7 @@ msgid "" "constructed list's :meth:`~list.sort` method. ::" msgstr "" -#: ../../howto/functional.rst:686 +#: ../../howto/functional.rst:688 msgid "" ">>> import random\n" ">>> # Generate 8 random numbers between [0, 10000)\n" @@ -1001,12 +1001,12 @@ msgid "" "[9878, 9828, 8442, 7953, 6431, 6213, 2207, 769]" msgstr "" -#: ../../howto/functional.rst:696 +#: ../../howto/functional.rst:698 msgid "" "(For a more detailed discussion of sorting, see the :ref:`sortinghowto`.)" msgstr "" -#: ../../howto/functional.rst:699 +#: ../../howto/functional.rst:701 msgid "" "The :func:`any(iter) ` and :func:`all(iter) ` built-ins look at " "the truth values of an iterable's contents. :func:`any` returns ``True`` if " @@ -1014,13 +1014,13 @@ msgid "" "``True`` if all of the elements are true values:" msgstr "" -#: ../../howto/functional.rst:718 +#: ../../howto/functional.rst:720 msgid "" ":func:`zip(iterA, iterB, ...) ` takes one element from each iterable " "and returns them in a tuple::" msgstr "" -#: ../../howto/functional.rst:721 +#: ../../howto/functional.rst:723 msgid "" "zip(['a', 'b', 'c'], (1, 2, 3)) =>\n" " ('a', 1), ('b', 2), ('c', 3)" @@ -1028,7 +1028,7 @@ msgstr "" "zip(['a', 'b', 'c'], (1, 2, 3)) =>\n" " ('a', 1), ('b', 2), ('c', 3)" -#: ../../howto/functional.rst:724 +#: ../../howto/functional.rst:726 msgid "" "It doesn't construct an in-memory list and exhaust all the input iterators " "before returning; instead tuples are constructed and returned only if " @@ -1036,14 +1036,14 @@ msgid "" "evaluation `__.)" msgstr "" -#: ../../howto/functional.rst:729 +#: ../../howto/functional.rst:731 msgid "" "This iterator is intended to be used with iterables that are all of the same " "length. If the iterables are of different lengths, the resulting stream " "will be the same length as the shortest iterable. ::" msgstr "" -#: ../../howto/functional.rst:733 +#: ../../howto/functional.rst:735 msgid "" "zip(['a', 'b'], (1, 2, 3)) =>\n" " ('a', 1), ('b', 2)" @@ -1051,49 +1051,49 @@ msgstr "" "zip(['a', 'b'], (1, 2, 3)) =>\n" " ('a', 1), ('b', 2)" -#: ../../howto/functional.rst:736 +#: ../../howto/functional.rst:738 msgid "" "You should avoid doing this, though, because an element may be taken from " "the longer iterators and discarded. This means you can't go on to use the " "iterators further because you risk skipping a discarded element." msgstr "" -#: ../../howto/functional.rst:742 +#: ../../howto/functional.rst:744 msgid "The itertools module" msgstr "itertools 模組" -#: ../../howto/functional.rst:744 +#: ../../howto/functional.rst:746 msgid "" "The :mod:`itertools` module contains a number of commonly used iterators as " "well as functions for combining several iterators. This section will " "introduce the module's contents by showing small examples." msgstr "" -#: ../../howto/functional.rst:748 +#: ../../howto/functional.rst:750 msgid "The module's functions fall into a few broad classes:" msgstr "" -#: ../../howto/functional.rst:750 +#: ../../howto/functional.rst:752 msgid "Functions that create a new iterator based on an existing iterator." msgstr "" -#: ../../howto/functional.rst:751 +#: ../../howto/functional.rst:753 msgid "Functions for treating an iterator's elements as function arguments." msgstr "" -#: ../../howto/functional.rst:752 +#: ../../howto/functional.rst:754 msgid "Functions for selecting portions of an iterator's output." msgstr "" -#: ../../howto/functional.rst:753 +#: ../../howto/functional.rst:755 msgid "A function for grouping an iterator's output." msgstr "" -#: ../../howto/functional.rst:756 +#: ../../howto/functional.rst:758 msgid "Creating new iterators" msgstr "建立新的疊代器" -#: ../../howto/functional.rst:758 +#: ../../howto/functional.rst:760 msgid "" ":func:`itertools.count(start, step) ` returns an infinite " "stream of evenly spaced values. You can optionally supply the starting " @@ -1101,7 +1101,7 @@ msgid "" "defaults to 1::" msgstr "" -#: ../../howto/functional.rst:762 +#: ../../howto/functional.rst:764 msgid "" "itertools.count() =>\n" " 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...\n" @@ -1117,7 +1117,7 @@ msgstr "" "itertools.count(10, 5) =>\n" " 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, ..." -#: ../../howto/functional.rst:769 +#: ../../howto/functional.rst:771 msgid "" ":func:`itertools.cycle(iter) ` saves a copy of the contents " "of a provided iterable and returns a new iterator that returns its elements " @@ -1125,7 +1125,7 @@ msgid "" "infinitely. ::" msgstr "" -#: ../../howto/functional.rst:773 +#: ../../howto/functional.rst:775 msgid "" "itertools.cycle([1, 2, 3, 4, 5]) =>\n" " 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, ..." @@ -1133,14 +1133,14 @@ msgstr "" "itertools.cycle([1, 2, 3, 4, 5]) =>\n" " 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, ..." -#: ../../howto/functional.rst:776 +#: ../../howto/functional.rst:778 msgid "" ":func:`itertools.repeat(elem, [n]) ` returns the provided " "element *n* times, or returns the element endlessly if *n* is not " "provided. ::" msgstr "" -#: ../../howto/functional.rst:779 +#: ../../howto/functional.rst:781 msgid "" "itertools.repeat('abc') =>\n" " abc, abc, abc, abc, abc, abc, abc, abc, abc, abc, ...\n" @@ -1152,7 +1152,7 @@ msgstr "" "itertools.repeat('abc', 5) =>\n" " abc, abc, abc, abc, abc" -#: ../../howto/functional.rst:784 +#: ../../howto/functional.rst:786 msgid "" ":func:`itertools.chain(iterA, iterB, ...) ` takes an " "arbitrary number of iterables as input, and returns all the elements of the " @@ -1160,7 +1160,7 @@ msgid "" "the iterables have been exhausted. ::" msgstr "" -#: ../../howto/functional.rst:789 +#: ../../howto/functional.rst:791 msgid "" "itertools.chain(['a', 'b', 'c'], (1, 2, 3)) =>\n" " a, b, c, 1, 2, 3" @@ -1168,7 +1168,7 @@ msgstr "" "itertools.chain(['a', 'b', 'c'], (1, 2, 3)) =>\n" " a, b, c, 1, 2, 3" -#: ../../howto/functional.rst:792 +#: ../../howto/functional.rst:794 msgid "" ":func:`itertools.islice(iter, [start], stop, [step]) ` " "returns a stream that's a slice of the iterator. With a single *stop* " @@ -1179,7 +1179,7 @@ msgid "" "*step*. ::" msgstr "" -#: ../../howto/functional.rst:799 +#: ../../howto/functional.rst:801 msgid "" "itertools.islice(range(10), 8) =>\n" " 0, 1, 2, 3, 4, 5, 6, 7\n" @@ -1195,7 +1195,7 @@ msgstr "" "itertools.islice(range(10), 2, 8, 2) =>\n" " 2, 4, 6" -#: ../../howto/functional.rst:806 +#: ../../howto/functional.rst:808 msgid "" ":func:`itertools.tee(iter, [n]) ` replicates an iterator; it " "returns *n* independent iterators that will all return the contents of the " @@ -1205,7 +1205,7 @@ msgid "" "and one of the new iterators is consumed more than the others. ::" msgstr "" -#: ../../howto/functional.rst:814 +#: ../../howto/functional.rst:816 msgid "" "itertools.tee( itertools.count() ) =>\n" " iterA, iterB\n" @@ -1225,11 +1225,11 @@ msgstr "" "and iterB ->\n" " 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ..." -#: ../../howto/functional.rst:825 +#: ../../howto/functional.rst:827 msgid "Calling functions on elements" msgstr "" -#: ../../howto/functional.rst:827 +#: ../../howto/functional.rst:829 msgid "" "The :mod:`operator` module contains a set of functions corresponding to " "Python's operators. Some examples are :func:`operator.add(a, b) ` assumes that the " "iterable will return a stream of tuples, and calls *func* using these tuples " "as the arguments::" msgstr "" -#: ../../howto/functional.rst:837 +#: ../../howto/functional.rst:839 msgid "" "itertools.starmap(os.path.join,\n" " [('/bin', 'python'), ('/usr', 'bin', 'java'),\n" @@ -1259,24 +1259,24 @@ msgstr "" "=>\n" " /bin/python, /usr/bin/java, /usr/bin/perl, /usr/bin/ruby" -#: ../../howto/functional.rst:845 +#: ../../howto/functional.rst:847 msgid "Selecting elements" msgstr "" -#: ../../howto/functional.rst:847 +#: ../../howto/functional.rst:849 msgid "" "Another group of functions chooses a subset of an iterator's elements based " "on a predicate." msgstr "" -#: ../../howto/functional.rst:850 +#: ../../howto/functional.rst:852 msgid "" ":func:`itertools.filterfalse(predicate, iter) ` is " "the opposite of :func:`filter`, returning all elements for which the " "predicate returns false::" msgstr "" -#: ../../howto/functional.rst:854 +#: ../../howto/functional.rst:856 msgid "" "itertools.filterfalse(is_even, itertools.count()) =>\n" " 1, 3, 5, 7, 9, 11, 13, 15, ..." @@ -1284,14 +1284,14 @@ msgstr "" "itertools.filterfalse(is_even, itertools.count()) =>\n" " 1, 3, 5, 7, 9, 11, 13, 15, ..." -#: ../../howto/functional.rst:857 +#: ../../howto/functional.rst:859 msgid "" ":func:`itertools.takewhile(predicate, iter) ` returns " "elements for as long as the predicate returns true. Once the predicate " "returns false, the iterator will signal the end of its results. ::" msgstr "" -#: ../../howto/functional.rst:861 +#: ../../howto/functional.rst:863 msgid "" "def less_than_10(x):\n" " return x < 10\n" @@ -1311,14 +1311,14 @@ msgstr "" "itertools.takewhile(is_even, itertools.count()) =>\n" " 0" -#: ../../howto/functional.rst:870 +#: ../../howto/functional.rst:872 msgid "" ":func:`itertools.dropwhile(predicate, iter) ` discards " "elements while the predicate returns true, and then returns the rest of the " "iterable's results. ::" msgstr "" -#: ../../howto/functional.rst:874 +#: ../../howto/functional.rst:876 msgid "" "itertools.dropwhile(less_than_10, itertools.count()) =>\n" " 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...\n" @@ -1332,7 +1332,7 @@ msgstr "" "itertools.dropwhile(is_even, itertools.count()) =>\n" " 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ..." -#: ../../howto/functional.rst:880 +#: ../../howto/functional.rst:882 msgid "" ":func:`itertools.compress(data, selectors) ` takes two " "iterators and returns only those elements of *data* for which the " @@ -1340,7 +1340,7 @@ msgid "" "is exhausted::" msgstr "" -#: ../../howto/functional.rst:884 +#: ../../howto/functional.rst:886 msgid "" "itertools.compress([1, 2, 3, 4, 5], [True, True, False, False, True]) =>\n" " 1, 2, 5" @@ -1348,18 +1348,18 @@ msgstr "" "itertools.compress([1, 2, 3, 4, 5], [True, True, False, False, True]) =>\n" " 1, 2, 5" -#: ../../howto/functional.rst:889 +#: ../../howto/functional.rst:891 msgid "Combinatoric functions" msgstr "" -#: ../../howto/functional.rst:891 +#: ../../howto/functional.rst:893 msgid "" "The :func:`itertools.combinations(iterable, r) ` " "returns an iterator giving all possible *r*-tuple combinations of the " "elements contained in *iterable*. ::" msgstr "" -#: ../../howto/functional.rst:895 +#: ../../howto/functional.rst:897 msgid "" "itertools.combinations([1, 2, 3, 4, 5], 2) =>\n" " (1, 2), (1, 3), (1, 4), (1, 5),\n" @@ -1383,7 +1383,7 @@ msgstr "" " (2, 3, 4), (2, 3, 5), (2, 4, 5),\n" " (3, 4, 5)" -#: ../../howto/functional.rst:906 +#: ../../howto/functional.rst:908 msgid "" "The elements within each tuple remain in the same order as *iterable* " "returned them. For example, the number 1 is always before 2, 3, 4, or 5 in " @@ -1392,7 +1392,7 @@ msgid "" "constraint on the order, returning all possible arrangements of length *r*::" msgstr "" -#: ../../howto/functional.rst:913 +#: ../../howto/functional.rst:915 msgid "" "itertools.permutations([1, 2, 3, 4, 5], 2) =>\n" " (1, 2), (1, 3), (1, 4), (1, 5),\n" @@ -1418,19 +1418,19 @@ msgstr "" " ...\n" " (5, 4, 3, 2, 1)" -#: ../../howto/functional.rst:925 +#: ../../howto/functional.rst:927 msgid "" "If you don't supply a value for *r* the length of the iterable is used, " "meaning that all the elements are permuted." msgstr "" -#: ../../howto/functional.rst:928 +#: ../../howto/functional.rst:930 msgid "" "Note that these functions produce all of the possible combinations by " "position and don't require that the contents of *iterable* are unique::" msgstr "" -#: ../../howto/functional.rst:931 +#: ../../howto/functional.rst:933 msgid "" "itertools.permutations('aba', 3) =>\n" " ('a', 'b', 'a'), ('a', 'a', 'b'), ('b', 'a', 'a'),\n" @@ -1440,13 +1440,13 @@ msgstr "" " ('a', 'b', 'a'), ('a', 'a', 'b'), ('b', 'a', 'a'),\n" " ('b', 'a', 'a'), ('a', 'a', 'b'), ('a', 'b', 'a')" -#: ../../howto/functional.rst:935 +#: ../../howto/functional.rst:937 msgid "" "The identical tuple ``('a', 'a', 'b')`` occurs twice, but the two 'a' " "strings came from different positions." msgstr "" -#: ../../howto/functional.rst:938 +#: ../../howto/functional.rst:940 msgid "" "The :func:`itertools.combinations_with_replacement(iterable, r) ` function relaxes a different constraint: " @@ -1455,7 +1455,7 @@ msgid "" "the second element is selected. ::" msgstr "" -#: ../../howto/functional.rst:944 +#: ../../howto/functional.rst:946 msgid "" "itertools.combinations_with_replacement([1, 2, 3, 4, 5], 2) =>\n" " (1, 1), (1, 2), (1, 3), (1, 4), (1, 5),\n" @@ -1471,11 +1471,11 @@ msgstr "" " (4, 4), (4, 5),\n" " (5, 5)" -#: ../../howto/functional.rst:953 +#: ../../howto/functional.rst:955 msgid "Grouping elements" msgstr "" -#: ../../howto/functional.rst:955 +#: ../../howto/functional.rst:957 msgid "" "The last function I'll discuss, :func:`itertools.groupby(iter, " "key_func=None) `, is the most complicated. " @@ -1484,14 +1484,14 @@ msgid "" "key is simply each element itself." msgstr "" -#: ../../howto/functional.rst:960 +#: ../../howto/functional.rst:962 msgid "" ":func:`~itertools.groupby` collects all the consecutive elements from the " "underlying iterable that have the same key value, and returns a stream of 2-" "tuples containing a key value and an iterator for the elements with that key." msgstr "" -#: ../../howto/functional.rst:966 +#: ../../howto/functional.rst:968 msgid "" "city_list = [('Decatur', 'AL'), ('Huntsville', 'AL'), ('Selma', 'AL'),\n" " ('Anchorage', 'AK'), ('Nome', 'AK'),\n" @@ -1537,7 +1537,7 @@ msgstr "" "iterator-3 =>\n" " ('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ')" -#: ../../howto/functional.rst:988 +#: ../../howto/functional.rst:990 msgid "" ":func:`~itertools.groupby` assumes that the underlying iterable's contents " "will already be sorted based on the key. Note that the returned iterators " @@ -1545,11 +1545,11 @@ msgid "" "iterator-1 before requesting iterator-2 and its corresponding key." msgstr "" -#: ../../howto/functional.rst:995 +#: ../../howto/functional.rst:997 msgid "The functools module" msgstr "functools 模組" -#: ../../howto/functional.rst:997 +#: ../../howto/functional.rst:999 msgid "" "The :mod:`functools` module contains some higher-order functions. A **higher-" "order function** takes one or more functions as input and returns a new " @@ -1557,7 +1557,7 @@ msgid "" "partial` function." msgstr "" -#: ../../howto/functional.rst:1002 +#: ../../howto/functional.rst:1004 msgid "" "For programs written in a functional style, you'll sometimes want to " "construct variants of existing functions that have some of the parameters " @@ -1567,7 +1567,7 @@ msgid "" "\"partial function application\"." msgstr "" -#: ../../howto/functional.rst:1008 +#: ../../howto/functional.rst:1010 msgid "" "The constructor for :func:`~functools.partial` takes the arguments " "``(function, arg1, arg2, ..., kwarg1=value1, kwarg2=value2)``. The " @@ -1575,11 +1575,11 @@ msgid "" "with the filled-in arguments." msgstr "" -#: ../../howto/functional.rst:1013 +#: ../../howto/functional.rst:1015 msgid "Here's a small but realistic example::" msgstr "以下是個很小但實際的範例: ::" -#: ../../howto/functional.rst:1015 +#: ../../howto/functional.rst:1017 msgid "" "import functools\n" "\n" @@ -1592,7 +1592,7 @@ msgid "" "server_log('Unable to open socket')" msgstr "" -#: ../../howto/functional.rst:1025 +#: ../../howto/functional.rst:1027 msgid "" ":func:`functools.reduce(func, iter, [initial_value]) ` " "cumulatively performs an operation on all the iterable's elements and, " @@ -1607,7 +1607,7 @@ msgid "" "``func(initial_value, A)`` is the first calculation. ::" msgstr "" -#: ../../howto/functional.rst:1037 +#: ../../howto/functional.rst:1039 msgid "" ">>> import operator, functools\n" ">>> functools.reduce(operator.concat, ['A', 'BB', 'C'])\n" @@ -1633,20 +1633,20 @@ msgstr "" ">>> functools.reduce(operator.mul, [], 1)\n" "1" -#: ../../howto/functional.rst:1049 +#: ../../howto/functional.rst:1051 msgid "" "If you use :func:`operator.add` with :func:`functools.reduce`, you'll add up " "all the elements of the iterable. This case is so common that there's a " "special built-in called :func:`sum` to compute it:" msgstr "" -#: ../../howto/functional.rst:1061 +#: ../../howto/functional.rst:1063 msgid "" "For many uses of :func:`functools.reduce`, though, it can be clearer to just " "write the obvious :keyword:`for` loop::" msgstr "" -#: ../../howto/functional.rst:1064 +#: ../../howto/functional.rst:1066 msgid "" "import functools\n" "# Instead of:\n" @@ -1658,7 +1658,7 @@ msgid "" " product *= i" msgstr "" -#: ../../howto/functional.rst:1073 +#: ../../howto/functional.rst:1075 msgid "" "A related function is :func:`itertools.accumulate(iterable, func=operator." "add) `. It performs the same calculation, but instead " @@ -1666,7 +1666,7 @@ msgid "" "iterator that also yields each partial result::" msgstr "" -#: ../../howto/functional.rst:1078 +#: ../../howto/functional.rst:1080 msgid "" "itertools.accumulate([1, 2, 3, 4, 5]) =>\n" " 1, 3, 6, 10, 15\n" @@ -1680,11 +1680,11 @@ msgstr "" "itertools.accumulate([1, 2, 3, 4, 5], operator.mul) =>\n" " 1, 2, 6, 24, 120" -#: ../../howto/functional.rst:1086 +#: ../../howto/functional.rst:1088 msgid "The operator module" msgstr "operator 模組" -#: ../../howto/functional.rst:1088 +#: ../../howto/functional.rst:1090 msgid "" "The :mod:`operator` module was mentioned earlier. It contains a set of " "functions corresponding to Python's operators. These functions are often " @@ -1692,55 +1692,55 @@ msgid "" "functions that perform a single operation." msgstr "" -#: ../../howto/functional.rst:1093 +#: ../../howto/functional.rst:1095 msgid "Some of the functions in this module are:" msgstr "" -#: ../../howto/functional.rst:1095 +#: ../../howto/functional.rst:1097 msgid "" "Math operations: ``add()``, ``sub()``, ``mul()``, ``floordiv()``, " "``abs()``, ..." msgstr "" "數學運算:``add()``、``sub()``、``mul()``、``floordiv()``、``abs()``..." -#: ../../howto/functional.rst:1096 +#: ../../howto/functional.rst:1098 msgid "Logical operations: ``not_()``, ``truth()``." msgstr "" -#: ../../howto/functional.rst:1097 +#: ../../howto/functional.rst:1099 msgid "Bitwise operations: ``and_()``, ``or_()``, ``invert()``." msgstr "" -#: ../../howto/functional.rst:1098 +#: ../../howto/functional.rst:1100 msgid "" "Comparisons: ``eq()``, ``ne()``, ``lt()``, ``le()``, ``gt()``, and ``ge()``." msgstr "" -#: ../../howto/functional.rst:1099 +#: ../../howto/functional.rst:1101 msgid "Object identity: ``is_()``, ``is_not()``." msgstr "" -#: ../../howto/functional.rst:1101 +#: ../../howto/functional.rst:1103 msgid "Consult the operator module's documentation for a complete list." msgstr "" -#: ../../howto/functional.rst:1105 +#: ../../howto/functional.rst:1107 msgid "Small functions and the lambda expression" msgstr "" -#: ../../howto/functional.rst:1107 +#: ../../howto/functional.rst:1109 msgid "" "When writing functional-style programs, you'll often need little functions " "that act as predicates or that combine elements in some way." msgstr "" -#: ../../howto/functional.rst:1110 +#: ../../howto/functional.rst:1112 msgid "" "If there's a Python built-in or a module function that's suitable, you don't " "need to define a new function at all::" msgstr "" -#: ../../howto/functional.rst:1113 +#: ../../howto/functional.rst:1115 msgid "" "stripped_lines = [line.strip() for line in lines]\n" "existing_files = filter(os.path.exists, file_list)" @@ -1748,7 +1748,7 @@ msgstr "" "stripped_lines = [line.strip() for line in lines]\n" "existing_files = filter(os.path.exists, file_list)" -#: ../../howto/functional.rst:1116 +#: ../../howto/functional.rst:1118 msgid "" "If the function you need doesn't exist, you need to write it. One way to " "write small functions is to use the :keyword:`lambda` expression. " @@ -1757,7 +1757,7 @@ msgid "" "expression::" msgstr "" -#: ../../howto/functional.rst:1121 +#: ../../howto/functional.rst:1123 msgid "" "adder = lambda x, y: x+y\n" "\n" @@ -1767,13 +1767,13 @@ msgstr "" "\n" "print_assign = lambda name, value: name + '=' + str(value)" -#: ../../howto/functional.rst:1125 +#: ../../howto/functional.rst:1127 msgid "" "An alternative is to just use the ``def`` statement and define a function in " "the usual way::" msgstr "" -#: ../../howto/functional.rst:1128 +#: ../../howto/functional.rst:1130 msgid "" "def adder(x, y):\n" " return x + y\n" @@ -1787,13 +1787,13 @@ msgstr "" "def print_assign(name, value):\n" " return name + '=' + str(value)" -#: ../../howto/functional.rst:1134 +#: ../../howto/functional.rst:1136 msgid "" "Which alternative is preferable? That's a style question; my usual course " "is to avoid using ``lambda``." msgstr "" -#: ../../howto/functional.rst:1137 +#: ../../howto/functional.rst:1139 msgid "" "One reason for my preference is that ``lambda`` is quite limited in the " "functions it can define. The result has to be computable as a single " @@ -1803,7 +1803,7 @@ msgid "" "that's hard to read. Quick, what's the following code doing? ::" msgstr "" -#: ../../howto/functional.rst:1144 +#: ../../howto/functional.rst:1146 msgid "" "import functools\n" "total = functools.reduce(lambda a, b: (0, a[1] + b[1]), items)[1]" @@ -1811,14 +1811,14 @@ msgstr "" "import functools\n" "total = functools.reduce(lambda a, b: (0, a[1] + b[1]), items)[1]" -#: ../../howto/functional.rst:1147 +#: ../../howto/functional.rst:1149 msgid "" "You can figure it out, but it takes time to disentangle the expression to " "figure out what's going on. Using a short nested ``def`` statements makes " "things a little bit better::" msgstr "" -#: ../../howto/functional.rst:1151 +#: ../../howto/functional.rst:1153 msgid "" "import functools\n" "def combine(a, b):\n" @@ -1832,11 +1832,11 @@ msgstr "" "\n" "total = functools.reduce(combine, items)[1]" -#: ../../howto/functional.rst:1157 +#: ../../howto/functional.rst:1159 msgid "But it would be best of all if I had simply used a ``for`` loop::" msgstr "" -#: ../../howto/functional.rst:1159 +#: ../../howto/functional.rst:1161 msgid "" "total = 0\n" "for a, b in items:\n" @@ -1846,59 +1846,59 @@ msgstr "" "for a, b in items:\n" " total += b" -#: ../../howto/functional.rst:1163 +#: ../../howto/functional.rst:1165 msgid "Or the :func:`sum` built-in and a generator expression::" msgstr "" -#: ../../howto/functional.rst:1165 +#: ../../howto/functional.rst:1167 msgid "total = sum(b for a, b in items)" msgstr "total = sum(b for a, b in items)" -#: ../../howto/functional.rst:1167 +#: ../../howto/functional.rst:1169 msgid "" "Many uses of :func:`functools.reduce` are clearer when written as ``for`` " "loops." msgstr "" -#: ../../howto/functional.rst:1169 +#: ../../howto/functional.rst:1171 msgid "" "Fredrik Lundh once suggested the following set of rules for refactoring uses " "of ``lambda``:" msgstr "" -#: ../../howto/functional.rst:1172 +#: ../../howto/functional.rst:1174 msgid "Write a lambda function." msgstr "" -#: ../../howto/functional.rst:1173 +#: ../../howto/functional.rst:1175 msgid "Write a comment explaining what the heck that lambda does." msgstr "" -#: ../../howto/functional.rst:1174 +#: ../../howto/functional.rst:1176 msgid "" "Study the comment for a while, and think of a name that captures the essence " "of the comment." msgstr "" -#: ../../howto/functional.rst:1176 +#: ../../howto/functional.rst:1178 msgid "Convert the lambda to a def statement, using that name." msgstr "" -#: ../../howto/functional.rst:1177 +#: ../../howto/functional.rst:1179 msgid "Remove the comment." msgstr "" -#: ../../howto/functional.rst:1179 +#: ../../howto/functional.rst:1181 msgid "" "I really like these rules, but you're free to disagree about whether this " "lambda-free style is better." msgstr "" -#: ../../howto/functional.rst:1184 +#: ../../howto/functional.rst:1186 msgid "Revision History and Acknowledgements" msgstr "" -#: ../../howto/functional.rst:1186 +#: ../../howto/functional.rst:1188 msgid "" "The author would like to thank the following people for offering " "suggestions, corrections and assistance with various drafts of this article: " @@ -1906,40 +1906,40 @@ msgid "" "Krell, Leandro Lameiro, Jussi Salmela, Collin Winter, Blake Winton." msgstr "" -#: ../../howto/functional.rst:1191 +#: ../../howto/functional.rst:1193 msgid "Version 0.1: posted June 30 2006." msgstr "" -#: ../../howto/functional.rst:1193 +#: ../../howto/functional.rst:1195 msgid "Version 0.11: posted July 1 2006. Typo fixes." msgstr "" -#: ../../howto/functional.rst:1195 +#: ../../howto/functional.rst:1197 msgid "" "Version 0.2: posted July 10 2006. Merged genexp and listcomp sections into " "one. Typo fixes." msgstr "" -#: ../../howto/functional.rst:1198 +#: ../../howto/functional.rst:1200 msgid "" "Version 0.21: Added more references suggested on the tutor mailing list." msgstr "" -#: ../../howto/functional.rst:1200 +#: ../../howto/functional.rst:1202 msgid "" "Version 0.30: Adds a section on the ``functional`` module written by Collin " "Winter; adds short section on the operator module; a few other edits." msgstr "" -#: ../../howto/functional.rst:1205 +#: ../../howto/functional.rst:1207 msgid "References" msgstr "" -#: ../../howto/functional.rst:1208 +#: ../../howto/functional.rst:1210 msgid "General" msgstr "" -#: ../../howto/functional.rst:1210 +#: ../../howto/functional.rst:1212 msgid "" "**Structure and Interpretation of Computer Programs**, by Harold Abelson and " "Gerald Jay Sussman with Julie Sussman. The book can be found at https://" @@ -1950,24 +1950,24 @@ msgid "" "functional-style Python code." msgstr "" -#: ../../howto/functional.rst:1218 +#: ../../howto/functional.rst:1220 msgid "" "https://www.defmacro.org/ramblings/fp.html:%20A%20general%20introduction%20to" "functional programming that uses Java examples and has a lengthy historical " "introduction." msgstr "" -#: ../../howto/functional.rst:1221 +#: ../../howto/functional.rst:1223 msgid "" "https://en.wikipedia.org/wiki/Functional_programming:%20General%20Wikipedia" "entry describing functional programming." msgstr "" -#: ../../howto/functional.rst:1224 +#: ../../howto/functional.rst:1226 msgid "https://en.wikipedia.org/wiki/Coroutine:%20Entry%20for%20coroutines." msgstr "https://en.wikipedia.org/wiki/Coroutine:%20%E5%8D%94%E7%A8%8B%20(coroutines)%20%E7%9A%84%E6%A2%9D%E7%9B%AE%E3%80%82" -#: ../../howto/functional.rst:1226 +#: ../../howto/functional.rst:1228 msgid "" "https://en.wikipedia.org/wiki/Partial_application:%20Entry%20for%20the%20concept%20of" "partial function application." @@ -1975,16 +1975,16 @@ msgstr "" "https://en.wikipedia.org/wiki/Partial_application:%20%E5%81%8F%E5%87%BD%E5%BC%8F%20(partial" "application) 概念的條目。" -#: ../../howto/functional.rst:1228 +#: ../../howto/functional.rst:1230 msgid "" "https://en.wikipedia.org/wiki/Currying:%20Entry%20for%20the%20concept%20of%20currying." msgstr "https://en.wikipedia.org/wiki/Currying:%20currying%20%E6%A6%82%E5%BF%B5%E7%9A%84%E6%A2%9D%E7%9B%AE%E3%80%82" -#: ../../howto/functional.rst:1231 +#: ../../howto/functional.rst:1233 msgid "Python-specific" msgstr "" -#: ../../howto/functional.rst:1233 +#: ../../howto/functional.rst:1235 msgid "" "https://gnosis.cx/TPiP/:%20The%20first%20chapter%20of%20David%20Mertz's book :title-" "reference:`Text Processing in Python` discusses functional programming for " @@ -1992,7 +1992,7 @@ msgid "" "Text Processing\"." msgstr "" -#: ../../howto/functional.rst:1238 +#: ../../howto/functional.rst:1240 msgid "" "Mertz also wrote a 3-part series of articles on functional programming for " "IBM's DeveloperWorks site; see `part 1 `__," msgstr "" -#: ../../howto/functional.rst:1246 +#: ../../howto/functional.rst:1248 msgid "Python documentation" msgstr "Python 說明文件" -#: ../../howto/functional.rst:1248 +#: ../../howto/functional.rst:1250 msgid "Documentation for the :mod:`itertools` module." msgstr ":mod:`itertools` 模組的說明文件。" -#: ../../howto/functional.rst:1250 +#: ../../howto/functional.rst:1252 msgid "Documentation for the :mod:`functools` module." msgstr ":mod:`functools` 模組的說明文件。" -#: ../../howto/functional.rst:1252 +#: ../../howto/functional.rst:1254 msgid "Documentation for the :mod:`operator` module." msgstr ":mod:`operator` 模組的說明文件。" -#: ../../howto/functional.rst:1254 +#: ../../howto/functional.rst:1256 msgid ":pep:`289`: \"Generator Expressions\"" msgstr ":pep:`289`:「產生器運算式 (Generator Expressions)」" -#: ../../howto/functional.rst:1256 +#: ../../howto/functional.rst:1258 msgid "" ":pep:`342`: \"Coroutines via Enhanced Generators\" describes the new " "generator features in Python 2.5." diff --git a/howto/index.po b/howto/index.po index 8d63eba8e0..d0d55f2163 100644 --- a/howto/index.po +++ b/howto/index.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-26 18:54+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-07-05 12:45+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,16 +25,116 @@ msgid "Python HOWTOs" msgstr "Python 如何達成任務" #: ../../howto/index.rst:5 +#, fuzzy msgid "" -"Python HOWTOs are documents that cover a single, specific topic, and attempt " -"to cover it fairly completely. Modelled on the Linux Documentation Project's " -"HOWTO collection, this collection is an effort to foster documentation " -"that's more detailed than the Python Library Reference." +"Python HOWTOs are documents that cover a specific topic in-depth. Modeled on " +"the Linux Documentation Project's HOWTO collection, this collection is an " +"effort to foster documentation that's more detailed than the Python Library " +"Reference." msgstr "" "「Python 如何達成任務 (HOWTOs)」是一系列的說明文件,其內容會盡量完整地涵蓋某" "些單一、特定的主題。以 Linux 說明文件專案的 HOWTO 系列為模範,本系列的目標是" "提供比 Python 函式庫參考手冊更實用的說明文件。" -#: ../../howto/index.rst:11 -msgid "Currently, the HOWTOs are:" -msgstr "目前有以下這些任務指南:" +#: ../../howto/index.rst:37 +msgid "General:" +msgstr "" + +#: ../../howto/index.rst:39 +msgid ":ref:`annotations-howto`" +msgstr "" + +#: ../../howto/index.rst:40 +msgid ":ref:`argparse-tutorial`" +msgstr "" + +#: ../../howto/index.rst:41 +msgid ":ref:`descriptorhowto`" +msgstr "" + +#: ../../howto/index.rst:42 +msgid ":ref:`enum-howto`" +msgstr "" + +#: ../../howto/index.rst:43 +msgid ":ref:`functional-howto`" +msgstr "" + +#: ../../howto/index.rst:44 +msgid ":ref:`ipaddress-howto`" +msgstr "" + +#: ../../howto/index.rst:45 +msgid ":ref:`logging-howto`" +msgstr "" + +#: ../../howto/index.rst:46 +msgid ":ref:`logging-cookbook`" +msgstr "" + +#: ../../howto/index.rst:47 +msgid ":ref:`regex-howto`" +msgstr "" + +#: ../../howto/index.rst:48 +msgid ":ref:`sortinghowto`" +msgstr "" + +#: ../../howto/index.rst:49 +msgid ":ref:`unicode-howto`" +msgstr "" + +#: ../../howto/index.rst:50 +msgid ":ref:`urllib-howto`" +msgstr "" + +#: ../../howto/index.rst:52 +msgid "Advanced development:" +msgstr "" + +#: ../../howto/index.rst:54 +msgid ":ref:`curses-howto`" +msgstr "" + +#: ../../howto/index.rst:55 +msgid ":ref:`freethreading-extensions-howto`" +msgstr "" + +#: ../../howto/index.rst:56 +msgid ":ref:`isolating-extensions-howto`" +msgstr "" + +#: ../../howto/index.rst:57 +msgid ":ref:`python_2.3_mro`" +msgstr "" + +#: ../../howto/index.rst:58 +msgid ":ref:`socket-howto`" +msgstr "" + +#: ../../howto/index.rst:59 +msgid ":ref:`timerfd-howto`" +msgstr "" + +#: ../../howto/index.rst:60 +msgid ":ref:`cporting-howto`" +msgstr "" + +#: ../../howto/index.rst:62 +msgid "Debugging and profiling:" +msgstr "" + +#: ../../howto/index.rst:64 +msgid ":ref:`gdb`" +msgstr "" + +#: ../../howto/index.rst:65 +msgid ":ref:`instrumentation`" +msgstr "" + +#: ../../howto/index.rst:66 +msgid ":ref:`perf_profiling`" +msgstr "" + +#~ msgid "Currently, the HOWTOs are:" +#~ msgstr "目前有以下這些任務指南:" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index 9b489b58c4..abe416bd57 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -445,10 +445,11 @@ msgstr "" #: ../../howto/logging-cookbook.rst:335 msgid "" "This configuration does *almost* what we want, except that ``sys.stdout`` " -"would show messages of severity ``ERROR`` and above as well as ``INFO`` and " -"``WARNING`` messages. To prevent this, we can set up a filter which excludes " -"those messages and add it to the relevant handler. This can be configured by " -"adding a ``filters`` section parallel to ``formatters`` and ``handlers``:" +"would show messages of severity ``ERROR`` and only events of this severity " +"and higher will be tracked as well as ``INFO`` and ``WARNING`` messages. To " +"prevent this, we can set up a filter which excludes those messages and add " +"it to the relevant handler. This can be configured by adding a ``filters`` " +"section parallel to ``formatters`` and ``handlers``:" msgstr "" #: ../../howto/logging-cookbook.rst:341 diff --git a/howto/logging.po b/howto/logging.po index c3a2fde401..fa2c5628aa 100644 --- a/howto/logging.po +++ b/howto/logging.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -19,7 +19,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: ../../howto/logging.rst:3 +#: ../../howto/logging.rst:5 msgid "Logging HOWTO" msgstr "如何使用 Logging 模組" @@ -27,21 +27,21 @@ msgstr "如何使用 Logging 模組" msgid "Author" msgstr "作者" -#: ../../howto/logging.rst:5 +#: ../../howto/logging.rst:7 msgid "Vinay Sajip " msgstr "Vinay Sajip " -#: ../../howto/logging.rst:11 +#: ../../howto/logging.rst:13 msgid "" "This page contains tutorial information. For links to reference information " "and a logging cookbook, please see :ref:`tutorial-ref-links`." msgstr "" -#: ../../howto/logging.rst:15 +#: ../../howto/logging.rst:17 msgid "Basic Logging Tutorial" msgstr "基礎 Logging 指南" -#: ../../howto/logging.rst:17 +#: ../../howto/logging.rst:19 msgid "" "Logging is a means of tracking events that happen when some software runs. " "The software's developer adds logging calls to their code to indicate that " @@ -56,11 +56,11 @@ msgstr "" "述。這段訊息可能包含一些因為此事件發生而改變的資料。開發者也可以指派事件的重" "要程度,重要程度有時候也會被稱作 *程度* 或是 *嚴重性* 。" -#: ../../howto/logging.rst:26 +#: ../../howto/logging.rst:28 msgid "When to use logging" msgstr "什麼時候使用 logging" -#: ../../howto/logging.rst:28 +#: ../../howto/logging.rst:30 msgid "" "You can access logging functionality by creating a logger via ``logger = " "getLogger(__name__)``, and then calling the logger's :meth:`~Logger.debug`, :" @@ -70,158 +70,158 @@ msgid "" "each of a set of common tasks, the best tool to use for that task." msgstr "" -#: ../../howto/logging.rst:36 +#: ../../howto/logging.rst:38 msgid "Task you want to perform" msgstr "" -#: ../../howto/logging.rst:36 +#: ../../howto/logging.rst:38 msgid "The best tool for the task" msgstr "" -#: ../../howto/logging.rst:38 +#: ../../howto/logging.rst:40 msgid "" "Display console output for ordinary usage of a command line script or program" msgstr "" -#: ../../howto/logging.rst:38 +#: ../../howto/logging.rst:40 msgid ":func:`print`" msgstr ":func:`print`" -#: ../../howto/logging.rst:42 +#: ../../howto/logging.rst:44 msgid "" "Report events that occur during normal operation of a program (e.g. for " "status monitoring or fault investigation)" msgstr "" -#: ../../howto/logging.rst:42 +#: ../../howto/logging.rst:44 msgid "" "A logger's :meth:`~Logger.info` (or :meth:`~Logger.debug` method for very " "detailed output for diagnostic purposes)" msgstr "" -#: ../../howto/logging.rst:47 +#: ../../howto/logging.rst:49 msgid "Issue a warning regarding a particular runtime event" msgstr "" -#: ../../howto/logging.rst:47 +#: ../../howto/logging.rst:49 msgid "" ":func:`warnings.warn` in library code if the issue is avoidable and the " "client application should be modified to eliminate the warning" msgstr "" -#: ../../howto/logging.rst:52 +#: ../../howto/logging.rst:54 msgid "" "A logger's :meth:`~Logger.warning` method if there is nothing the client " "application can do about the situation, but the event should still be noted" msgstr "" -#: ../../howto/logging.rst:58 +#: ../../howto/logging.rst:60 msgid "Report an error regarding a particular runtime event" msgstr "" -#: ../../howto/logging.rst:58 +#: ../../howto/logging.rst:60 msgid "Raise an exception" msgstr "" -#: ../../howto/logging.rst:61 +#: ../../howto/logging.rst:63 msgid "" "Report suppression of an error without raising an exception (e.g. error " "handler in a long-running server process)" msgstr "" -#: ../../howto/logging.rst:61 +#: ../../howto/logging.rst:63 msgid "" "A logger's :meth:`~Logger.error`, :meth:`~Logger.exception` or :meth:" "`~Logger.critical` method as appropriate for the specific error and " "application domain" msgstr "" -#: ../../howto/logging.rst:68 +#: ../../howto/logging.rst:70 msgid "" "The logger methods are named after the level or severity of the events they " "are used to track. The standard levels and their applicability are described " "below (in increasing order of severity):" msgstr "" -#: ../../howto/logging.rst:75 ../../howto/logging.rst:874 +#: ../../howto/logging.rst:77 ../../howto/logging.rst:875 msgid "Level" msgstr "" -#: ../../howto/logging.rst:75 +#: ../../howto/logging.rst:77 msgid "When it's used" msgstr "" -#: ../../howto/logging.rst:77 ../../howto/logging.rst:884 +#: ../../howto/logging.rst:79 ../../howto/logging.rst:885 msgid "``DEBUG``" msgstr "``DEBUG``" -#: ../../howto/logging.rst:77 +#: ../../howto/logging.rst:79 msgid "" "Detailed information, typically of interest only when diagnosing problems." msgstr "" -#: ../../howto/logging.rst:80 ../../howto/logging.rst:882 +#: ../../howto/logging.rst:82 ../../howto/logging.rst:883 msgid "``INFO``" msgstr "``INFO``" -#: ../../howto/logging.rst:80 +#: ../../howto/logging.rst:82 msgid "Confirmation that things are working as expected." msgstr "" -#: ../../howto/logging.rst:83 ../../howto/logging.rst:880 +#: ../../howto/logging.rst:85 ../../howto/logging.rst:881 msgid "``WARNING``" msgstr "``WARNING``" -#: ../../howto/logging.rst:83 +#: ../../howto/logging.rst:85 msgid "" "An indication that something unexpected happened, or indicative of some " "problem in the near future (e.g. 'disk space low'). The software is still " "working as expected." msgstr "" -#: ../../howto/logging.rst:88 ../../howto/logging.rst:878 +#: ../../howto/logging.rst:90 ../../howto/logging.rst:879 msgid "``ERROR``" msgstr "``ERROR``" -#: ../../howto/logging.rst:88 +#: ../../howto/logging.rst:90 msgid "" "Due to a more serious problem, the software has not been able to perform " "some function." msgstr "" -#: ../../howto/logging.rst:91 ../../howto/logging.rst:876 +#: ../../howto/logging.rst:93 ../../howto/logging.rst:877 msgid "``CRITICAL``" msgstr "``CRITICAL``" -#: ../../howto/logging.rst:91 +#: ../../howto/logging.rst:93 msgid "" "A serious error, indicating that the program itself may be unable to " "continue running." msgstr "" -#: ../../howto/logging.rst:95 +#: ../../howto/logging.rst:97 msgid "" -"The default level is ``WARNING``, which means that only events of this level " -"and above will be tracked, unless the logging package is configured to do " -"otherwise." +"The default level is ``WARNING``, which means that only events of this " +"severity and higher will be tracked, unless the logging package is " +"configured to do otherwise." msgstr "" -#: ../../howto/logging.rst:99 +#: ../../howto/logging.rst:100 msgid "" "Events that are tracked can be handled in different ways. The simplest way " "of handling tracked events is to print them to the console. Another common " "way is to write them to a disk file." msgstr "" -#: ../../howto/logging.rst:107 +#: ../../howto/logging.rst:108 msgid "A simple example" msgstr "一個簡單範例" -#: ../../howto/logging.rst:109 +#: ../../howto/logging.rst:110 msgid "A very simple example is::" msgstr "一個非常簡單的例子是: ::" -#: ../../howto/logging.rst:111 +#: ../../howto/logging.rst:112 msgid "" "import logging\n" "logging.warning('Watch out!') # will print a message to the console\n" @@ -231,15 +231,15 @@ msgstr "" "logging.warning('Watch out!') # 將會印出訊息至控制台\n" "logging.info('I told you so') # 不會印出任何東西" -#: ../../howto/logging.rst:115 +#: ../../howto/logging.rst:116 msgid "If you type these lines into a script and run it, you'll see:" msgstr "" -#: ../../howto/logging.rst:117 +#: ../../howto/logging.rst:118 msgid "WARNING:root:Watch out!" msgstr "WARNING:root:Watch out!" -#: ../../howto/logging.rst:121 +#: ../../howto/logging.rst:122 msgid "" "printed out on the console. The ``INFO`` message doesn't appear because the " "default level is ``WARNING``. The printed message includes the indication of " @@ -248,7 +248,7 @@ msgid "" "need that; formatting options will also be explained later." msgstr "" -#: ../../howto/logging.rst:127 +#: ../../howto/logging.rst:128 msgid "" "Notice that in this example, we use functions directly on the ``logging`` " "module, like ``logging.debug``, rather than creating a logger and calling " @@ -260,11 +260,11 @@ msgid "" "methods." msgstr "" -#: ../../howto/logging.rst:136 +#: ../../howto/logging.rst:137 msgid "Logging to a file" msgstr "" -#: ../../howto/logging.rst:138 +#: ../../howto/logging.rst:139 msgid "" "A very common situation is that of recording logging events in a file, so " "let's look at that next. Be sure to try the following in a newly started " @@ -272,7 +272,7 @@ msgid "" "above::" msgstr "" -#: ../../howto/logging.rst:142 +#: ../../howto/logging.rst:143 msgid "" "import logging\n" "logger = logging.getLogger(__name__)\n" @@ -284,7 +284,7 @@ msgid "" "logger.error('And non-ASCII stuff, too, like Øresund and Malmö')" msgstr "" -#: ../../howto/logging.rst:150 +#: ../../howto/logging.rst:151 msgid "" "The *encoding* argument was added. In earlier Python versions, or if not " "specified, the encoding used is the default value used by :func:`open`. " @@ -293,13 +293,13 @@ msgid "" "values and the default, see the documentation for :func:`open`." msgstr "" -#: ../../howto/logging.rst:157 +#: ../../howto/logging.rst:158 msgid "" "And now if we open the file and look at what we have, we should find the log " "messages:" msgstr "" -#: ../../howto/logging.rst:160 +#: ../../howto/logging.rst:161 msgid "" "DEBUG:__main__:This message should go to the log file\n" "INFO:__main__:So should this\n" @@ -307,40 +307,40 @@ msgid "" "ERROR:__main__:And non-ASCII stuff, too, like Øresund and Malmö" msgstr "" -#: ../../howto/logging.rst:167 +#: ../../howto/logging.rst:168 msgid "" "This example also shows how you can set the logging level which acts as the " "threshold for tracking. In this case, because we set the threshold to " "``DEBUG``, all of the messages were printed." msgstr "" -#: ../../howto/logging.rst:171 +#: ../../howto/logging.rst:172 msgid "" "If you want to set the logging level from a command-line option such as:" msgstr "" -#: ../../howto/logging.rst:173 +#: ../../howto/logging.rst:174 msgid "--log=INFO" msgstr "--log=INFO" -#: ../../howto/logging.rst:177 +#: ../../howto/logging.rst:178 msgid "" "and you have the value of the parameter passed for ``--log`` in some " "variable *loglevel*, you can use::" msgstr "" -#: ../../howto/logging.rst:180 +#: ../../howto/logging.rst:181 msgid "getattr(logging, loglevel.upper())" msgstr "getattr(logging, loglevel.upper())" -#: ../../howto/logging.rst:182 +#: ../../howto/logging.rst:183 msgid "" "to get the value which you'll pass to :func:`basicConfig` via the *level* " "argument. You may want to error check any user input value, perhaps as in " "the following example::" msgstr "" -#: ../../howto/logging.rst:186 +#: ../../howto/logging.rst:187 msgid "" "# assuming loglevel is bound to the string value obtained from the\n" "# command line argument. Convert to upper case to allow the user to\n" @@ -351,14 +351,14 @@ msgid "" "logging.basicConfig(level=numeric_level, ...)" msgstr "" -#: ../../howto/logging.rst:194 +#: ../../howto/logging.rst:195 msgid "" "The call to :func:`basicConfig` should come *before* any calls to a logger's " "methods such as :meth:`~Logger.debug`, :meth:`~Logger.info`, etc. Otherwise, " "that logging event may not be handled in the desired manner." msgstr "" -#: ../../howto/logging.rst:198 +#: ../../howto/logging.rst:199 msgid "" "If you run the above script several times, the messages from successive runs " "are appended to the file *example.log*. If you want each run to start " @@ -366,7 +366,7 @@ msgid "" "*filemode* argument, by changing the call in the above example to::" msgstr "" -#: ../../howto/logging.rst:203 +#: ../../howto/logging.rst:204 msgid "" "logging.basicConfig(filename='example.log', filemode='w', level=logging." "DEBUG)" @@ -374,23 +374,23 @@ msgstr "" "logging.basicConfig(filename='example.log', filemode='w', level=logging." "DEBUG)" -#: ../../howto/logging.rst:205 +#: ../../howto/logging.rst:206 msgid "" "The output will be the same as before, but the log file is no longer " "appended to, so the messages from earlier runs are lost." msgstr "" -#: ../../howto/logging.rst:210 +#: ../../howto/logging.rst:211 msgid "Logging variable data" msgstr "" -#: ../../howto/logging.rst:212 +#: ../../howto/logging.rst:213 msgid "" "To log variable data, use a format string for the event description message " "and append the variable data as arguments. For example::" msgstr "" -#: ../../howto/logging.rst:215 +#: ../../howto/logging.rst:216 msgid "" "import logging\n" "logging.warning('%s before you %s', 'Look', 'leap!')" @@ -398,15 +398,15 @@ msgstr "" "import logging\n" "logging.warning('%s before you %s', 'Look', 'leap!')" -#: ../../howto/logging.rst:218 +#: ../../howto/logging.rst:219 msgid "will display:" msgstr "" -#: ../../howto/logging.rst:220 +#: ../../howto/logging.rst:221 msgid "WARNING:root:Look before you leap!" msgstr "WARNING:root:Look before you leap!" -#: ../../howto/logging.rst:224 +#: ../../howto/logging.rst:225 msgid "" "As you can see, merging of variable data into the event description message " "uses the old, %-style of string formatting. This is for backwards " @@ -416,17 +416,17 @@ msgid "" "tutorial: see :ref:`formatting-styles` for more information." msgstr "" -#: ../../howto/logging.rst:233 +#: ../../howto/logging.rst:234 msgid "Changing the format of displayed messages" msgstr "" -#: ../../howto/logging.rst:235 +#: ../../howto/logging.rst:236 msgid "" "To change the format which is used to display messages, you need to specify " "the format you want to use::" msgstr "" -#: ../../howto/logging.rst:238 +#: ../../howto/logging.rst:239 msgid "" "import logging\n" "logging.basicConfig(format='%(levelname)s:%(message)s', level=logging." @@ -436,18 +436,18 @@ msgid "" "logging.warning('And this, too')" msgstr "" -#: ../../howto/logging.rst:244 +#: ../../howto/logging.rst:245 msgid "which would print:" msgstr "" -#: ../../howto/logging.rst:246 +#: ../../howto/logging.rst:247 msgid "" "DEBUG:This message should appear on the console\n" "INFO:So should this\n" "WARNING:And this, too" msgstr "" -#: ../../howto/logging.rst:252 +#: ../../howto/logging.rst:253 msgid "" "Notice that the 'root' which appeared in earlier examples has disappeared. " "For a full set of things that can appear in format strings, you can refer to " @@ -457,39 +457,39 @@ msgid "" "This is described in the next section." msgstr "" -#: ../../howto/logging.rst:261 +#: ../../howto/logging.rst:262 msgid "Displaying the date/time in messages" msgstr "" -#: ../../howto/logging.rst:263 +#: ../../howto/logging.rst:264 msgid "" "To display the date and time of an event, you would place '%(asctime)s' in " "your format string::" msgstr "" -#: ../../howto/logging.rst:266 +#: ../../howto/logging.rst:267 msgid "" "import logging\n" "logging.basicConfig(format='%(asctime)s %(message)s')\n" "logging.warning('is when this event was logged.')" msgstr "" -#: ../../howto/logging.rst:270 +#: ../../howto/logging.rst:271 msgid "which should print something like this:" msgstr "" -#: ../../howto/logging.rst:272 +#: ../../howto/logging.rst:273 msgid "2010-12-12 11:41:42,612 is when this event was logged." msgstr "" -#: ../../howto/logging.rst:276 +#: ../../howto/logging.rst:277 msgid "" "The default format for date/time display (shown above) is like ISO8601 or :" "rfc:`3339`. If you need more control over the formatting of the date/time, " "provide a *datefmt* argument to ``basicConfig``, as in this example::" msgstr "" -#: ../../howto/logging.rst:280 +#: ../../howto/logging.rst:281 msgid "" "import logging\n" "logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:" @@ -497,25 +497,25 @@ msgid "" "logging.warning('is when this event was logged.')" msgstr "" -#: ../../howto/logging.rst:284 +#: ../../howto/logging.rst:285 msgid "which would display something like this:" msgstr "" -#: ../../howto/logging.rst:286 +#: ../../howto/logging.rst:287 msgid "12/12/2010 11:46:36 AM is when this event was logged." msgstr "" -#: ../../howto/logging.rst:290 +#: ../../howto/logging.rst:291 msgid "" "The format of the *datefmt* argument is the same as supported by :func:`time." "strftime`." msgstr "" -#: ../../howto/logging.rst:295 +#: ../../howto/logging.rst:296 msgid "Next Steps" msgstr "" -#: ../../howto/logging.rst:297 +#: ../../howto/logging.rst:298 msgid "" "That concludes the basic tutorial. It should be enough to get you up and " "running with logging. There's a lot more that the logging package offers, " @@ -524,7 +524,7 @@ msgid "" "of your favourite beverage and carry on." msgstr "" -#: ../../howto/logging.rst:303 +#: ../../howto/logging.rst:304 msgid "" "If your logging needs are simple, then use the above examples to incorporate " "logging into your own scripts, and if you run into problems or don't " @@ -533,50 +533,50 @@ msgid "" "should receive help before too long." msgstr "" -#: ../../howto/logging.rst:309 +#: ../../howto/logging.rst:310 msgid "" "Still here? You can carry on reading the next few sections, which provide a " "slightly more advanced/in-depth tutorial than the basic one above. After " "that, you can take a look at the :ref:`logging-cookbook`." msgstr "" -#: ../../howto/logging.rst:317 +#: ../../howto/logging.rst:318 msgid "Advanced Logging Tutorial" msgstr "" -#: ../../howto/logging.rst:319 +#: ../../howto/logging.rst:320 msgid "" "The logging library takes a modular approach and offers several categories " "of components: loggers, handlers, filters, and formatters." msgstr "" -#: ../../howto/logging.rst:322 +#: ../../howto/logging.rst:323 msgid "Loggers expose the interface that application code directly uses." msgstr "" -#: ../../howto/logging.rst:323 +#: ../../howto/logging.rst:324 msgid "" "Handlers send the log records (created by loggers) to the appropriate " "destination." msgstr "" -#: ../../howto/logging.rst:325 +#: ../../howto/logging.rst:326 msgid "" "Filters provide a finer grained facility for determining which log records " "to output." msgstr "" -#: ../../howto/logging.rst:327 +#: ../../howto/logging.rst:328 msgid "Formatters specify the layout of log records in the final output." msgstr "" -#: ../../howto/logging.rst:329 +#: ../../howto/logging.rst:330 msgid "" "Log event information is passed between loggers, handlers, filters and " "formatters in a :class:`LogRecord` instance." msgstr "" -#: ../../howto/logging.rst:332 +#: ../../howto/logging.rst:333 msgid "" "Logging is performed by calling methods on instances of the :class:`Logger` " "class (hereafter called :dfn:`loggers`). Each instance has a name, and they " @@ -587,23 +587,23 @@ msgid "" "originates." msgstr "" -#: ../../howto/logging.rst:339 +#: ../../howto/logging.rst:340 msgid "" "A good convention to use when naming loggers is to use a module-level " "logger, in each module which uses logging, named as follows::" msgstr "" -#: ../../howto/logging.rst:342 +#: ../../howto/logging.rst:343 msgid "logger = logging.getLogger(__name__)" msgstr "logger = logging.getLogger(__name__)" -#: ../../howto/logging.rst:344 +#: ../../howto/logging.rst:345 msgid "" "This means that logger names track the package/module hierarchy, and it's " "intuitively obvious where events are logged just from the logger name." msgstr "" -#: ../../howto/logging.rst:347 +#: ../../howto/logging.rst:348 msgid "" "The root of the hierarchy of loggers is called the root logger. That's the " "logger used by the functions :func:`debug`, :func:`info`, :func:`warning`, :" @@ -612,7 +612,7 @@ msgid "" "root logger's name is printed as 'root' in the logged output." msgstr "" -#: ../../howto/logging.rst:353 +#: ../../howto/logging.rst:354 msgid "" "It is, of course, possible to log messages to different destinations. " "Support is included in the package for writing log messages to files, HTTP " @@ -623,7 +623,7 @@ msgid "" "built-in handler classes." msgstr "" -#: ../../howto/logging.rst:360 +#: ../../howto/logging.rst:361 msgid "" "By default, no destination is set for any logging messages. You can specify " "a destination (such as console or file) by using :func:`basicConfig` as in " @@ -635,36 +635,36 @@ msgid "" "message output." msgstr "" -#: ../../howto/logging.rst:368 +#: ../../howto/logging.rst:369 msgid "The default format set by :func:`basicConfig` for messages is:" msgstr "" -#: ../../howto/logging.rst:370 +#: ../../howto/logging.rst:371 msgid "severity:logger name:message" msgstr "severity:logger name:message" -#: ../../howto/logging.rst:374 +#: ../../howto/logging.rst:375 msgid "" "You can change this by passing a format string to :func:`basicConfig` with " "the *format* keyword argument. For all options regarding how a format string " "is constructed, see :ref:`formatter-objects`." msgstr "" -#: ../../howto/logging.rst:379 +#: ../../howto/logging.rst:380 msgid "Logging Flow" msgstr "" -#: ../../howto/logging.rst:381 +#: ../../howto/logging.rst:382 msgid "" "The flow of log event information in loggers and handlers is illustrated in " "the following diagram." msgstr "" -#: ../../howto/logging.rst:432 +#: ../../howto/logging.rst:433 msgid "Loggers" msgstr "" -#: ../../howto/logging.rst:434 +#: ../../howto/logging.rst:435 msgid "" ":class:`Logger` objects have a threefold job. First, they expose several " "methods to application code so that applications can log messages at " @@ -674,17 +674,17 @@ msgid "" "handlers." msgstr "" -#: ../../howto/logging.rst:440 +#: ../../howto/logging.rst:441 msgid "" "The most widely used methods on logger objects fall into two categories: " "configuration and message sending." msgstr "" -#: ../../howto/logging.rst:443 +#: ../../howto/logging.rst:444 msgid "These are the most common configuration methods:" msgstr "" -#: ../../howto/logging.rst:445 +#: ../../howto/logging.rst:446 msgid "" ":meth:`Logger.setLevel` specifies the lowest-severity log message a logger " "will handle, where debug is the lowest built-in severity level and critical " @@ -693,32 +693,32 @@ msgid "" "messages and will ignore DEBUG messages." msgstr "" -#: ../../howto/logging.rst:451 +#: ../../howto/logging.rst:452 msgid "" ":meth:`Logger.addHandler` and :meth:`Logger.removeHandler` add and remove " "handler objects from the logger object. Handlers are covered in more detail " "in :ref:`handler-basic`." msgstr "" -#: ../../howto/logging.rst:455 +#: ../../howto/logging.rst:456 msgid "" ":meth:`Logger.addFilter` and :meth:`Logger.removeFilter` add and remove " "filter objects from the logger object. Filters are covered in more detail " "in :ref:`filter`." msgstr "" -#: ../../howto/logging.rst:459 +#: ../../howto/logging.rst:460 msgid "" "You don't need to always call these methods on every logger you create. See " "the last two paragraphs in this section." msgstr "" -#: ../../howto/logging.rst:462 +#: ../../howto/logging.rst:463 msgid "" "With the logger object configured, the following methods create log messages:" msgstr "" -#: ../../howto/logging.rst:464 +#: ../../howto/logging.rst:465 msgid "" ":meth:`Logger.debug`, :meth:`Logger.info`, :meth:`Logger.warning`, :meth:" "`Logger.error`, and :meth:`Logger.critical` all create log records with a " @@ -731,14 +731,14 @@ msgid "" "exception information." msgstr "" -#: ../../howto/logging.rst:474 +#: ../../howto/logging.rst:475 msgid "" ":meth:`Logger.exception` creates a log message similar to :meth:`Logger." "error`. The difference is that :meth:`Logger.exception` dumps a stack trace " "along with it. Call this method only from an exception handler." msgstr "" -#: ../../howto/logging.rst:478 +#: ../../howto/logging.rst:479 msgid "" ":meth:`Logger.log` takes a log level as an explicit argument. This is a " "little more verbose for logging messages than using the log level " @@ -746,7 +746,7 @@ msgid "" "levels." msgstr "" -#: ../../howto/logging.rst:482 +#: ../../howto/logging.rst:483 msgid "" ":func:`getLogger` returns a reference to a logger instance with the " "specified name if it is provided, or ``root`` if not. The names are period-" @@ -758,7 +758,7 @@ msgid "" "descendants of ``foo``." msgstr "" -#: ../../howto/logging.rst:490 +#: ../../howto/logging.rst:491 msgid "" "Loggers have a concept of *effective level*. If a level is not explicitly " "set on a logger, the level of its parent is used instead as its effective " @@ -770,7 +770,7 @@ msgid "" "handlers." msgstr "" -#: ../../howto/logging.rst:498 +#: ../../howto/logging.rst:499 msgid "" "Child loggers propagate messages up to the handlers associated with their " "ancestor loggers. Because of this, it is unnecessary to define and configure " @@ -780,11 +780,11 @@ msgid "" "attribute of a logger to ``False``.)" msgstr "" -#: ../../howto/logging.rst:509 +#: ../../howto/logging.rst:510 msgid "Handlers" msgstr "" -#: ../../howto/logging.rst:511 +#: ../../howto/logging.rst:512 msgid "" ":class:`~logging.Handler` objects are responsible for dispatching the " "appropriate log messages (based on the log messages' severity) to the " @@ -797,14 +797,14 @@ msgid "" "of a specific severity to a specific location." msgstr "" -#: ../../howto/logging.rst:521 +#: ../../howto/logging.rst:522 msgid "" "The standard library includes quite a few handler types (see :ref:`useful-" "handlers`); the tutorials use mainly :class:`StreamHandler` and :class:" "`FileHandler` in its examples." msgstr "" -#: ../../howto/logging.rst:525 +#: ../../howto/logging.rst:526 msgid "" "There are very few methods in a handler for application developers to " "concern themselves with. The only handler methods that seem relevant for " @@ -812,7 +812,7 @@ msgid "" "not creating custom handlers) are the following configuration methods:" msgstr "" -#: ../../howto/logging.rst:530 +#: ../../howto/logging.rst:531 msgid "" "The :meth:`~Handler.setLevel` method, just as in logger objects, specifies " "the lowest severity that will be dispatched to the appropriate destination. " @@ -822,19 +822,19 @@ msgid "" "send on." msgstr "" -#: ../../howto/logging.rst:536 +#: ../../howto/logging.rst:537 msgid "" ":meth:`~Handler.setFormatter` selects a Formatter object for this handler to " "use." msgstr "" -#: ../../howto/logging.rst:539 +#: ../../howto/logging.rst:540 msgid "" ":meth:`~Handler.addFilter` and :meth:`~Handler.removeFilter` respectively " "configure and deconfigure filter objects on handlers." msgstr "" -#: ../../howto/logging.rst:542 +#: ../../howto/logging.rst:543 msgid "" "Application code should not directly instantiate and use instances of :class:" "`Handler`. Instead, the :class:`Handler` class is a base class that defines " @@ -842,11 +842,11 @@ msgid "" "behavior that child classes can use (or override)." msgstr "" -#: ../../howto/logging.rst:549 +#: ../../howto/logging.rst:550 msgid "Formatters" msgstr "" -#: ../../howto/logging.rst:551 +#: ../../howto/logging.rst:552 msgid "" "Formatter objects configure the final order, structure, and contents of the " "log message. Unlike the base :class:`logging.Handler` class, application " @@ -856,24 +856,24 @@ msgid "" "string and a style indicator." msgstr "" -#: ../../howto/logging.rst:560 +#: ../../howto/logging.rst:561 msgid "" "If there is no message format string, the default is to use the raw " "message. If there is no date format string, the default date format is:" msgstr "" -#: ../../howto/logging.rst:563 +#: ../../howto/logging.rst:564 msgid "%Y-%m-%d %H:%M:%S" msgstr "%Y-%m-%d %H:%M:%S" -#: ../../howto/logging.rst:567 +#: ../../howto/logging.rst:568 msgid "" "with the milliseconds tacked on at the end. The ``style`` is one of ``'%'``, " "``'{'``, or ``'$'``. If one of these is not specified, then ``'%'`` will be " "used." msgstr "" -#: ../../howto/logging.rst:570 +#: ../../howto/logging.rst:571 msgid "" "If the ``style`` is ``'%'``, the message format string uses ``%()s`` styled string substitution; the possible keys are documented in :" @@ -883,22 +883,22 @@ msgid "" "should conform to what is expected by :meth:`string.Template.substitute`." msgstr "" -#: ../../howto/logging.rst:577 +#: ../../howto/logging.rst:578 msgid "Added the ``style`` parameter." msgstr "新增 ``style`` 參數。" -#: ../../howto/logging.rst:580 +#: ../../howto/logging.rst:581 msgid "" "The following message format string will log the time in a human-readable " "format, the severity of the message, and the contents of the message, in " "that order::" msgstr "" -#: ../../howto/logging.rst:584 +#: ../../howto/logging.rst:585 msgid "'%(asctime)s - %(levelname)s - %(message)s'" msgstr "" -#: ../../howto/logging.rst:586 +#: ../../howto/logging.rst:587 msgid "" "Formatters use a user-configurable function to convert the creation time of " "a record to a tuple. By default, :func:`time.localtime` is used; to change " @@ -909,40 +909,40 @@ msgid "" "in the Formatter class (to ``time.gmtime`` for GMT display)." msgstr "" -#: ../../howto/logging.rst:596 +#: ../../howto/logging.rst:597 msgid "Configuring Logging" msgstr "" -#: ../../howto/logging.rst:600 +#: ../../howto/logging.rst:601 msgid "Programmers can configure logging in three ways:" msgstr "" -#: ../../howto/logging.rst:602 +#: ../../howto/logging.rst:603 msgid "" "Creating loggers, handlers, and formatters explicitly using Python code that " "calls the configuration methods listed above." msgstr "" -#: ../../howto/logging.rst:604 +#: ../../howto/logging.rst:605 msgid "" "Creating a logging config file and reading it using the :func:`fileConfig` " "function." msgstr "" -#: ../../howto/logging.rst:606 +#: ../../howto/logging.rst:607 msgid "" "Creating a dictionary of configuration information and passing it to the :" "func:`dictConfig` function." msgstr "" -#: ../../howto/logging.rst:609 +#: ../../howto/logging.rst:610 msgid "" "For the reference documentation on the last two options, see :ref:`logging-" "config-api`. The following example configures a very simple logger, a " "console handler, and a simple formatter using Python code::" msgstr "" -#: ../../howto/logging.rst:613 +#: ../../howto/logging.rst:614 msgid "" "import logging\n" "\n" @@ -972,12 +972,12 @@ msgid "" "logger.critical('critical message')" msgstr "" -#: ../../howto/logging.rst:639 +#: ../../howto/logging.rst:640 msgid "" "Running this module from the command line produces the following output:" msgstr "" -#: ../../howto/logging.rst:641 +#: ../../howto/logging.rst:642 msgid "" "$ python simple_logging_module.py\n" "2005-03-19 15:10:26,618 - simple_example - DEBUG - debug message\n" @@ -987,14 +987,14 @@ msgid "" "2005-03-19 15:10:26,773 - simple_example - CRITICAL - critical message" msgstr "" -#: ../../howto/logging.rst:650 +#: ../../howto/logging.rst:651 msgid "" "The following Python module creates a logger, handler, and formatter nearly " "identical to those in the example listed above, with the only difference " "being the names of the objects::" msgstr "" -#: ../../howto/logging.rst:654 +#: ../../howto/logging.rst:655 msgid "" "import logging\n" "import logging.config\n" @@ -1012,11 +1012,11 @@ msgid "" "logger.critical('critical message')" msgstr "" -#: ../../howto/logging.rst:669 +#: ../../howto/logging.rst:670 msgid "Here is the logging.conf file:" msgstr "" -#: ../../howto/logging.rst:671 +#: ../../howto/logging.rst:672 msgid "" "[loggers]\n" "keys=root,simpleExample\n" @@ -1047,12 +1047,12 @@ msgid "" "format=%(asctime)s - %(name)s - %(levelname)s - %(message)s" msgstr "" -#: ../../howto/logging.rst:701 +#: ../../howto/logging.rst:702 msgid "" "The output is nearly identical to that of the non-config-file-based example:" msgstr "" -#: ../../howto/logging.rst:703 +#: ../../howto/logging.rst:704 msgid "" "$ python simple_logging_config.py\n" "2005-03-19 15:38:55,977 - simpleExample - DEBUG - debug message\n" @@ -1062,14 +1062,14 @@ msgid "" "2005-03-19 15:38:56,130 - simpleExample - CRITICAL - critical message" msgstr "" -#: ../../howto/logging.rst:712 +#: ../../howto/logging.rst:713 msgid "" "You can see that the config file approach has a few advantages over the " "Python code approach, mainly separation of configuration and code and the " "ability of noncoders to easily modify the logging properties." msgstr "" -#: ../../howto/logging.rst:716 +#: ../../howto/logging.rst:717 msgid "" "The :func:`fileConfig` function takes a default parameter, " "``disable_existing_loggers``, which defaults to ``True`` for reasons of " @@ -1080,7 +1080,7 @@ msgid "" "information, and specify ``False`` for this parameter if you wish." msgstr "" -#: ../../howto/logging.rst:724 +#: ../../howto/logging.rst:725 msgid "" "The dictionary passed to :func:`dictConfig` can also specify a Boolean value " "with key ``disable_existing_loggers``, which if not specified explicitly in " @@ -1089,7 +1089,7 @@ msgid "" "want - in which case, provide the key explicitly with a value of ``False``." msgstr "" -#: ../../howto/logging.rst:734 +#: ../../howto/logging.rst:735 msgid "" "Note that the class names referenced in config files need to be either " "relative to the logging module, or absolute values which can be resolved " @@ -1100,7 +1100,7 @@ msgid "" "path)." msgstr "" -#: ../../howto/logging.rst:742 +#: ../../howto/logging.rst:743 msgid "" "In Python 3.2, a new means of configuring logging has been introduced, using " "dictionaries to hold configuration information. This provides a superset of " @@ -1115,13 +1115,13 @@ msgid "" "a socket, or use whatever approach makes sense for your application." msgstr "" -#: ../../howto/logging.rst:754 +#: ../../howto/logging.rst:755 msgid "" "Here's an example of the same configuration as above, in YAML format for the " "new dictionary-based approach:" msgstr "" -#: ../../howto/logging.rst:757 +#: ../../howto/logging.rst:758 msgid "" "version: 1\n" "formatters:\n" @@ -1143,24 +1143,24 @@ msgid "" " handlers: [console]" msgstr "" -#: ../../howto/logging.rst:778 +#: ../../howto/logging.rst:779 msgid "" "For more information about logging using a dictionary, see :ref:`logging-" "config-api`." msgstr "" -#: ../../howto/logging.rst:782 +#: ../../howto/logging.rst:783 msgid "What happens if no configuration is provided" msgstr "" -#: ../../howto/logging.rst:784 +#: ../../howto/logging.rst:785 msgid "" "If no logging configuration is provided, it is possible to have a situation " "where a logging event needs to be output, but no handlers can be found to " "output the event." msgstr "" -#: ../../howto/logging.rst:788 +#: ../../howto/logging.rst:789 msgid "" "The event is output using a 'handler of last resort', stored in :data:" "`lastResort`. This internal handler is not associated with any logger, and " @@ -1172,32 +1172,32 @@ msgid "" "severities will be output." msgstr "" -#: ../../howto/logging.rst:799 +#: ../../howto/logging.rst:800 msgid "For versions of Python prior to 3.2, the behaviour is as follows:" msgstr "" -#: ../../howto/logging.rst:801 +#: ../../howto/logging.rst:802 msgid "" "If :data:`raiseExceptions` is ``False`` (production mode), the event is " "silently dropped." msgstr "" -#: ../../howto/logging.rst:804 +#: ../../howto/logging.rst:805 msgid "" "If :data:`raiseExceptions` is ``True`` (development mode), a message 'No " "handlers could be found for logger X.Y.Z' is printed once." msgstr "" -#: ../../howto/logging.rst:807 +#: ../../howto/logging.rst:808 msgid "" "To obtain the pre-3.2 behaviour, :data:`lastResort` can be set to ``None``." msgstr "" -#: ../../howto/logging.rst:813 +#: ../../howto/logging.rst:814 msgid "Configuring Logging for a Library" msgstr "" -#: ../../howto/logging.rst:815 +#: ../../howto/logging.rst:816 msgid "" "When developing a library which uses logging, you should take care to " "document how the library uses logging - for example, the names of loggers " @@ -1208,7 +1208,7 @@ msgid "" "is regarded as the best default behaviour." msgstr "" -#: ../../howto/logging.rst:823 +#: ../../howto/logging.rst:824 msgid "" "If for some reason you *don't* want these messages printed in the absence of " "any logging configuration, you can attach a do-nothing handler to the top-" @@ -1220,7 +1220,7 @@ msgid "" "to those handlers, as normal." msgstr "" -#: ../../howto/logging.rst:832 +#: ../../howto/logging.rst:833 msgid "" "A do-nothing handler is included in the logging package: :class:`~logging." "NullHandler` (since Python 3.1). An instance of this handler could be added " @@ -1231,20 +1231,20 @@ msgid "" "etc. then the code::" msgstr "" -#: ../../howto/logging.rst:840 +#: ../../howto/logging.rst:841 msgid "" "import logging\n" "logging.getLogger('foo').addHandler(logging.NullHandler())" msgstr "" -#: ../../howto/logging.rst:843 +#: ../../howto/logging.rst:844 msgid "" "should have the desired effect. If an organisation produces a number of " "libraries, then the logger name specified can be 'orgname.foo' rather than " "just 'foo'." msgstr "" -#: ../../howto/logging.rst:847 +#: ../../howto/logging.rst:848 msgid "" "It is strongly advised that you *do not log to the root logger* in your " "library. Instead, use a logger with a unique and easily identifiable name, " @@ -1254,7 +1254,7 @@ msgid "" "library as they wish." msgstr "" -#: ../../howto/logging.rst:854 +#: ../../howto/logging.rst:855 msgid "" "It is strongly advised that you *do not add any handlers other than* :class:" "`~logging.NullHandler` *to your library's loggers*. This is because the " @@ -1265,11 +1265,11 @@ msgid "" "carry out unit tests and deliver logs which suit their requirements." msgstr "" -#: ../../howto/logging.rst:865 +#: ../../howto/logging.rst:866 msgid "Logging Levels" msgstr "" -#: ../../howto/logging.rst:867 +#: ../../howto/logging.rst:868 msgid "" "The numeric values of logging levels are given in the following table. These " "are primarily of interest if you want to define your own levels, and need " @@ -1278,39 +1278,39 @@ msgid "" "value; the predefined name is lost." msgstr "" -#: ../../howto/logging.rst:874 +#: ../../howto/logging.rst:875 msgid "Numeric value" msgstr "" -#: ../../howto/logging.rst:876 +#: ../../howto/logging.rst:877 msgid "50" msgstr "50" -#: ../../howto/logging.rst:878 +#: ../../howto/logging.rst:879 msgid "40" msgstr "40" -#: ../../howto/logging.rst:880 +#: ../../howto/logging.rst:881 msgid "30" msgstr "30" -#: ../../howto/logging.rst:882 +#: ../../howto/logging.rst:883 msgid "20" msgstr "20" -#: ../../howto/logging.rst:884 +#: ../../howto/logging.rst:885 msgid "10" msgstr "10" -#: ../../howto/logging.rst:886 +#: ../../howto/logging.rst:887 msgid "``NOTSET``" msgstr "``NOTSET``" -#: ../../howto/logging.rst:886 +#: ../../howto/logging.rst:887 msgid "0" msgstr "0" -#: ../../howto/logging.rst:889 +#: ../../howto/logging.rst:890 msgid "" "Levels can also be associated with loggers, being set either by the " "developer or through loading a saved logging configuration. When a logging " @@ -1320,14 +1320,14 @@ msgid "" "basic mechanism controlling the verbosity of logging output." msgstr "" -#: ../../howto/logging.rst:896 +#: ../../howto/logging.rst:897 msgid "" "Logging messages are encoded as instances of the :class:`~logging.LogRecord` " "class. When a logger decides to actually log an event, a :class:`~logging." "LogRecord` instance is created from the logging message." msgstr "" -#: ../../howto/logging.rst:900 +#: ../../howto/logging.rst:901 msgid "" "Logging messages are subjected to a dispatch mechanism through the use of :" "dfn:`handlers`, which are instances of subclasses of the :class:`Handler` " @@ -1344,7 +1344,7 @@ msgid "" "at which point the passing to ancestor handlers stops)." msgstr "" -#: ../../howto/logging.rst:914 +#: ../../howto/logging.rst:915 msgid "" "Just as for loggers, handlers can have levels associated with them. A " "handler's level acts as a filter in the same way as a logger's level does. " @@ -1354,11 +1354,11 @@ msgid "" "`~Handler.emit`." msgstr "" -#: ../../howto/logging.rst:923 +#: ../../howto/logging.rst:924 msgid "Custom Levels" msgstr "" -#: ../../howto/logging.rst:925 +#: ../../howto/logging.rst:926 msgid "" "Defining your own levels is possible, but should not be necessary, as the " "existing levels have been chosen on the basis of practical experience. " @@ -1371,27 +1371,27 @@ msgid "" "given numeric value might mean different things for different libraries." msgstr "" -#: ../../howto/logging.rst:938 +#: ../../howto/logging.rst:939 msgid "Useful Handlers" msgstr "" -#: ../../howto/logging.rst:940 +#: ../../howto/logging.rst:941 msgid "" "In addition to the base :class:`Handler` class, many useful subclasses are " "provided:" msgstr "" -#: ../../howto/logging.rst:943 +#: ../../howto/logging.rst:944 msgid "" ":class:`StreamHandler` instances send messages to streams (file-like " "objects)." msgstr "" -#: ../../howto/logging.rst:946 +#: ../../howto/logging.rst:947 msgid ":class:`FileHandler` instances send messages to disk files." msgstr "" -#: ../../howto/logging.rst:948 +#: ../../howto/logging.rst:949 msgid "" ":class:`~handlers.BaseRotatingHandler` is the base class for handlers that " "rotate log files at a certain point. It is not meant to be instantiated " @@ -1399,61 +1399,61 @@ msgid "" "`~handlers.TimedRotatingFileHandler`." msgstr "" -#: ../../howto/logging.rst:953 +#: ../../howto/logging.rst:954 msgid "" ":class:`~handlers.RotatingFileHandler` instances send messages to disk " "files, with support for maximum log file sizes and log file rotation." msgstr "" -#: ../../howto/logging.rst:956 +#: ../../howto/logging.rst:957 msgid "" ":class:`~handlers.TimedRotatingFileHandler` instances send messages to disk " "files, rotating the log file at certain timed intervals." msgstr "" -#: ../../howto/logging.rst:959 +#: ../../howto/logging.rst:960 msgid "" ":class:`~handlers.SocketHandler` instances send messages to TCP/IP sockets. " "Since 3.4, Unix domain sockets are also supported." msgstr "" -#: ../../howto/logging.rst:962 +#: ../../howto/logging.rst:963 msgid "" ":class:`~handlers.DatagramHandler` instances send messages to UDP sockets. " "Since 3.4, Unix domain sockets are also supported." msgstr "" -#: ../../howto/logging.rst:965 +#: ../../howto/logging.rst:966 msgid "" ":class:`~handlers.SMTPHandler` instances send messages to a designated email " "address." msgstr "" -#: ../../howto/logging.rst:968 +#: ../../howto/logging.rst:969 msgid "" ":class:`~handlers.SysLogHandler` instances send messages to a Unix syslog " "daemon, possibly on a remote machine." msgstr "" -#: ../../howto/logging.rst:971 +#: ../../howto/logging.rst:972 msgid "" ":class:`~handlers.NTEventLogHandler` instances send messages to a Windows " "NT/2000/XP event log." msgstr "" -#: ../../howto/logging.rst:974 +#: ../../howto/logging.rst:975 msgid "" ":class:`~handlers.MemoryHandler` instances send messages to a buffer in " "memory, which is flushed whenever specific criteria are met." msgstr "" -#: ../../howto/logging.rst:977 +#: ../../howto/logging.rst:978 msgid "" ":class:`~handlers.HTTPHandler` instances send messages to an HTTP server " "using either ``GET`` or ``POST`` semantics." msgstr "" -#: ../../howto/logging.rst:980 +#: ../../howto/logging.rst:981 msgid "" ":class:`~handlers.WatchedFileHandler` instances watch the file they are " "logging to. If the file changes, it is closed and reopened using the file " @@ -1461,13 +1461,13 @@ msgid "" "support the underlying mechanism used." msgstr "" -#: ../../howto/logging.rst:985 +#: ../../howto/logging.rst:986 msgid "" ":class:`~handlers.QueueHandler` instances send messages to a queue, such as " "those implemented in the :mod:`queue` or :mod:`multiprocessing` modules." msgstr "" -#: ../../howto/logging.rst:988 +#: ../../howto/logging.rst:989 msgid "" ":class:`NullHandler` instances do nothing with error messages. They are used " "by library developers who want to use logging, but want to avoid the 'No " @@ -1476,15 +1476,15 @@ msgid "" "more information." msgstr "" -#: ../../howto/logging.rst:994 +#: ../../howto/logging.rst:995 msgid "The :class:`NullHandler` class." msgstr "" -#: ../../howto/logging.rst:997 +#: ../../howto/logging.rst:998 msgid "The :class:`~handlers.QueueHandler` class." msgstr "" -#: ../../howto/logging.rst:1000 +#: ../../howto/logging.rst:1001 msgid "" "The :class:`NullHandler`, :class:`StreamHandler` and :class:`FileHandler` " "classes are defined in the core logging package. The other handlers are " @@ -1492,14 +1492,14 @@ msgid "" "module, :mod:`logging.config`, for configuration functionality.)" msgstr "" -#: ../../howto/logging.rst:1005 +#: ../../howto/logging.rst:1006 msgid "" "Logged messages are formatted for presentation through instances of the :" "class:`Formatter` class. They are initialized with a format string suitable " "for use with the % operator and a dictionary." msgstr "" -#: ../../howto/logging.rst:1009 +#: ../../howto/logging.rst:1010 msgid "" "For formatting multiple messages in a batch, instances of :class:" "`BufferingFormatter` can be used. In addition to the format string (which is " @@ -1507,7 +1507,7 @@ msgid "" "trailer format strings." msgstr "" -#: ../../howto/logging.rst:1014 +#: ../../howto/logging.rst:1015 msgid "" "When filtering based on logger level and/or handler level is not enough, " "instances of :class:`Filter` can be added to both :class:`Logger` and :class:" @@ -1517,18 +1517,18 @@ msgid "" "value, the message is not processed further." msgstr "" -#: ../../howto/logging.rst:1021 +#: ../../howto/logging.rst:1022 msgid "" "The basic :class:`Filter` functionality allows filtering by specific logger " "name. If this feature is used, messages sent to the named logger and its " "children are allowed through the filter, and all others dropped." msgstr "" -#: ../../howto/logging.rst:1029 +#: ../../howto/logging.rst:1030 msgid "Exceptions raised during logging" msgstr "" -#: ../../howto/logging.rst:1031 +#: ../../howto/logging.rst:1032 msgid "" "The logging package is designed to swallow exceptions which occur while " "logging in production. This is so that errors which occur while handling " @@ -1536,7 +1536,7 @@ msgid "" "errors - do not cause the application using logging to terminate prematurely." msgstr "" -#: ../../howto/logging.rst:1036 +#: ../../howto/logging.rst:1037 msgid "" ":class:`SystemExit` and :class:`KeyboardInterrupt` exceptions are never " "swallowed. Other exceptions which occur during the :meth:`~Handler.emit` " @@ -1544,7 +1544,7 @@ msgid "" "handleError` method." msgstr "" -#: ../../howto/logging.rst:1041 +#: ../../howto/logging.rst:1042 msgid "" "The default implementation of :meth:`~Handler.handleError` in :class:" "`Handler` checks to see if a module-level variable, :data:`raiseExceptions`, " @@ -1552,7 +1552,7 @@ msgid "" "the exception is swallowed." msgstr "" -#: ../../howto/logging.rst:1047 +#: ../../howto/logging.rst:1048 msgid "" "The default value of :data:`raiseExceptions` is ``True``. This is because " "during development, you typically want to be notified of any exceptions that " @@ -1560,11 +1560,11 @@ msgid "" "production usage." msgstr "" -#: ../../howto/logging.rst:1057 +#: ../../howto/logging.rst:1058 msgid "Using arbitrary objects as messages" msgstr "" -#: ../../howto/logging.rst:1059 +#: ../../howto/logging.rst:1060 msgid "" "In the preceding sections and examples, it has been assumed that the message " "passed when logging the event is a string. However, this is not the only " @@ -1576,11 +1576,11 @@ msgid "" "the wire." msgstr "" -#: ../../howto/logging.rst:1070 +#: ../../howto/logging.rst:1071 msgid "Optimization" msgstr "最佳化" -#: ../../howto/logging.rst:1072 +#: ../../howto/logging.rst:1073 msgid "" "Formatting of message arguments is deferred until it cannot be avoided. " "However, computing the arguments passed to the logging method can also be " @@ -1591,20 +1591,20 @@ msgid "" "code like this::" msgstr "" -#: ../../howto/logging.rst:1080 +#: ../../howto/logging.rst:1081 msgid "" "if logger.isEnabledFor(logging.DEBUG):\n" " logger.debug('Message with %s, %s', expensive_func1(),\n" " expensive_func2())" msgstr "" -#: ../../howto/logging.rst:1084 +#: ../../howto/logging.rst:1085 msgid "" "so that if the logger's threshold is set above ``DEBUG``, the calls to " "``expensive_func1`` and ``expensive_func2`` are never made." msgstr "" -#: ../../howto/logging.rst:1087 +#: ../../howto/logging.rst:1088 msgid "" "In some cases, :meth:`~Logger.isEnabledFor` can itself be more expensive " "than you'd like (e.g. for deeply nested loggers where an explicit level is " @@ -1616,7 +1616,7 @@ msgid "" "while the application is running (which is not all that common)." msgstr "" -#: ../../howto/logging.rst:1096 +#: ../../howto/logging.rst:1097 msgid "" "There are other optimizations which can be made for specific applications " "which need more precise control over what logging information is collected. " @@ -1624,94 +1624,94 @@ msgid "" "you don't need:" msgstr "" -#: ../../howto/logging.rst:1102 +#: ../../howto/logging.rst:1103 msgid "What you don't want to collect" msgstr "" -#: ../../howto/logging.rst:1102 +#: ../../howto/logging.rst:1103 msgid "How to avoid collecting it" msgstr "" -#: ../../howto/logging.rst:1104 +#: ../../howto/logging.rst:1105 msgid "Information about where calls were made from." msgstr "" -#: ../../howto/logging.rst:1104 +#: ../../howto/logging.rst:1105 msgid "" "Set ``logging._srcfile`` to ``None``. This avoids calling :func:`sys." "_getframe`, which may help to speed up your code in environments like PyPy " "(which can't speed up code that uses :func:`sys._getframe`)." msgstr "" -#: ../../howto/logging.rst:1110 +#: ../../howto/logging.rst:1111 msgid "Threading information." msgstr "" -#: ../../howto/logging.rst:1110 +#: ../../howto/logging.rst:1111 msgid "Set ``logging.logThreads`` to ``False``." msgstr "將 ``logging.logThreads`` 設為 ``False``。" -#: ../../howto/logging.rst:1112 +#: ../../howto/logging.rst:1113 msgid "Current process ID (:func:`os.getpid`)" msgstr "當前的行程 ID (:func:`os.getpid`)" -#: ../../howto/logging.rst:1112 +#: ../../howto/logging.rst:1113 msgid "Set ``logging.logProcesses`` to ``False``." msgstr "將 ``logging.logProcesses`` 設為 ``False``。" -#: ../../howto/logging.rst:1114 +#: ../../howto/logging.rst:1115 msgid "" "Current process name when using ``multiprocessing`` to manage multiple " "processes." msgstr "" -#: ../../howto/logging.rst:1114 +#: ../../howto/logging.rst:1115 msgid "Set ``logging.logMultiprocessing`` to ``False``." msgstr "將 ``logging.logMultiprocessing`` 設為 ``False``。" -#: ../../howto/logging.rst:1117 +#: ../../howto/logging.rst:1118 msgid "Current :class:`asyncio.Task` name when using ``asyncio``." msgstr "" -#: ../../howto/logging.rst:1117 +#: ../../howto/logging.rst:1118 msgid "Set ``logging.logAsyncioTasks`` to ``False``." msgstr "將 ``logging.logAsyncioTasks`` 設為 ``False``。" -#: ../../howto/logging.rst:1121 +#: ../../howto/logging.rst:1122 msgid "" "Also note that the core logging module only includes the basic handlers. If " "you don't import :mod:`logging.handlers` and :mod:`logging.config`, they " "won't take up any memory." msgstr "" -#: ../../howto/logging.rst:1128 +#: ../../howto/logging.rst:1129 msgid "Other resources" msgstr "其他資源" -#: ../../howto/logging.rst:1132 +#: ../../howto/logging.rst:1133 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../howto/logging.rst:1133 +#: ../../howto/logging.rst:1134 msgid "API reference for the logging module." msgstr "" -#: ../../howto/logging.rst:1135 +#: ../../howto/logging.rst:1136 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../howto/logging.rst:1136 +#: ../../howto/logging.rst:1137 msgid "Configuration API for the logging module." msgstr "" -#: ../../howto/logging.rst:1138 +#: ../../howto/logging.rst:1139 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../howto/logging.rst:1139 +#: ../../howto/logging.rst:1140 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../howto/logging.rst:1141 +#: ../../howto/logging.rst:1142 msgid ":ref:`A logging cookbook `" msgstr "" diff --git a/howto/perf_profiling.po b/howto/perf_profiling.po index 7005f65a62..d89ee4250b 100644 --- a/howto/perf_profiling.po +++ b/howto/perf_profiling.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-12-09 17:39+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -403,10 +403,10 @@ msgstr "例如,使用環境變數: ::" #: ../../howto/perf_profiling.rst:165 msgid "" -"$ PYTHONPERFSUPPORT=1 python script.py\n" +"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python script.py\n" "$ perf report -g -i perf.data" msgstr "" -"$ PYTHONPERFSUPPORT=1 python script.py\n" +"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python script.py\n" "$ perf report -g -i perf.data" #: ../../howto/perf_profiling.rst:168 @@ -415,10 +415,10 @@ msgstr "例如,使用 :option:`!-X` 選項: ::" #: ../../howto/perf_profiling.rst:170 msgid "" -"$ python -X perf script.py\n" +"$ perf record -F 9999 -g -o perf.data python -X perf script.py\n" "$ perf report -g -i perf.data" msgstr "" -"$ python -X perf script.py\n" +"$ perf record -F 9999 -g -o perf.data python -X perf script.py\n" "$ perf report -g -i perf.data" #: ../../howto/perf_profiling.rst:173 @@ -449,10 +449,10 @@ msgstr "...然後: ::" #: ../../howto/perf_profiling.rst:187 msgid "" -"$ python ./example.py\n" +"$ perf record -F 9999 -g -o perf.data python ./example.py\n" "$ perf report -g -i perf.data" msgstr "" -"$ python ./example.py\n" +"$ perf record -F 9999 -g -o perf.data python ./example.py\n" "$ perf report -g -i perf.data" #: ../../howto/perf_profiling.rst:192 @@ -490,3 +490,97 @@ msgid "" msgstr "" "如果你沒有看到任何輸出,則表示你的直譯器尚未使用 frame 指標進行編譯,因此它可" "能無法在 ``perf`` 的輸出中顯示 Python 函式。" + +#: ../../howto/perf_profiling.rst:211 +msgid "How to work without frame pointers" +msgstr "" + +#: ../../howto/perf_profiling.rst:213 +msgid "" +"If you are working with a Python interpreter that has been compiled without " +"frame pointers, you can still use the ``perf`` profiler, but the overhead " +"will be a bit higher because Python needs to generate unwinding information " +"for every Python function call on the fly. Additionally, ``perf`` will take " +"more time to process the data because it will need to use the DWARF " +"debugging information to unwind the stack and this is a slow process." +msgstr "" + +#: ../../howto/perf_profiling.rst:220 +msgid "" +"To enable this mode, you can use the environment variable :envvar:" +"`PYTHON_PERF_JIT_SUPPORT` or the :option:`-X perf_jit <-X>` option, which " +"will enable the JIT mode for the ``perf`` profiler." +msgstr "" + +#: ../../howto/perf_profiling.rst:226 +msgid "" +"Due to a bug in the ``perf`` tool, only ``perf`` versions higher than v6.8 " +"will work with the JIT mode. The fix was also backported to the v6.7.2 " +"version of the tool." +msgstr "" + +#: ../../howto/perf_profiling.rst:230 +msgid "" +"Note that when checking the version of the ``perf`` tool (which can be done " +"by running ``perf version``) you must take into account that some distros " +"add some custom version numbers including a ``-`` character. This means " +"that ``perf 6.7-3`` is not necessarily ``perf 6.7.3``." +msgstr "" + +#: ../../howto/perf_profiling.rst:235 +msgid "" +"When using the perf JIT mode, you need an extra step before you can run " +"``perf report``. You need to call the ``perf inject`` command to inject the " +"JIT information into the ``perf.data`` file.::" +msgstr "" + +#: ../../howto/perf_profiling.rst:239 +msgid "" +"$ perf record -F 9999 -g --call-graph dwarf -o perf.data python -Xperf_jit " +"my_script.py\n" +"$ perf inject -i perf.data --jit --output perf.jit.data\n" +"$ perf report -g -i perf.jit.data" +msgstr "" +"$ perf record -F 9999 -g --call-graph dwarf -o perf.data python -Xperf_jit " +"my_script.py\n" +"$ perf inject -i perf.data --jit --output perf.jit.data\n" +"$ perf report -g -i perf.jit.data" + +#: ../../howto/perf_profiling.rst:243 +msgid "or using the environment variable::" +msgstr "或使用環境變數: ::" + +#: ../../howto/perf_profiling.rst:245 +msgid "" +"$ PYTHON_PERF_JIT_SUPPORT=1 perf record -F 9999 -g --call-graph dwarf -o " +"perf.data python my_script.py\n" +"$ perf inject -i perf.data --jit --output perf.jit.data\n" +"$ perf report -g -i perf.jit.data" +msgstr "" +"$ PYTHON_PERF_JIT_SUPPORT=1 perf record -F 9999 -g --call-graph dwarf -o " +"perf.data python my_script.py\n" +"$ perf inject -i perf.data --jit --output perf.jit.data\n" +"$ perf report -g -i perf.jit.data" + +#: ../../howto/perf_profiling.rst:249 +msgid "" +"``perf inject --jit`` command will read ``perf.data``, automatically pick up " +"the perf dump file that Python creates (in ``/tmp/perf-$PID.dump``), and " +"then create ``perf.jit.data`` which merges all the JIT information together. " +"It should also create a lot of ``jitted-XXXX-N.so`` files in the current " +"directory which are ELF images for all the JIT trampolines that were created " +"by Python." +msgstr "" + +#: ../../howto/perf_profiling.rst:257 +msgid "" +"Notice that when using ``--call-graph dwarf`` the ``perf`` tool will take " +"snapshots of the stack of the process being profiled and save the " +"information in the ``perf.data`` file. By default the size of the stack dump " +"is 8192 bytes but the user can change the size by passing the size after " +"comma like ``--call-graph dwarf,4096``. The size of the stack dump is " +"important because if the size is too small ``perf`` will not be able to " +"unwind the stack and the output will be incomplete. On the other hand, if " +"the size is too big, then ``perf`` won't be able to sample the process as " +"frequently as it would like as the overhead will be higher." +msgstr "" diff --git a/howto/timerfd.po b/howto/timerfd.po new file mode 100644 index 0000000000..27b4768a58 --- /dev/null +++ b/howto/timerfd.po @@ -0,0 +1,285 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../howto/timerfd.rst:5 +msgid "timer file descriptor HOWTO" +msgstr "" + +#: ../../howto/timerfd.rst:0 +msgid "Release" +msgstr "" + +#: ../../howto/timerfd.rst:7 +msgid "1.13" +msgstr "" + +#: ../../howto/timerfd.rst:9 +msgid "" +"This HOWTO discusses Python's support for the linux timer file descriptor." +msgstr "" + +#: ../../howto/timerfd.rst:13 +msgid "Examples" +msgstr "" + +#: ../../howto/timerfd.rst:15 +msgid "" +"The following example shows how to use a timer file descriptor to execute a " +"function twice a second:" +msgstr "" + +#: ../../howto/timerfd.rst:18 +msgid "" +"# Practical scripts should use really use a non-blocking timer,\n" +"# we use a blocking timer here for simplicity.\n" +"import os, time\n" +"\n" +"# Create the timer file descriptor\n" +"fd = os.timerfd_create(time.CLOCK_REALTIME)\n" +"\n" +"# Start the timer in 1 second, with an interval of half a second\n" +"os.timerfd_settime(fd, initial=1, interval=0.5)\n" +"\n" +"try:\n" +" # Process timer events four times.\n" +" for _ in range(4):\n" +" # read() will block until the timer expires\n" +" _ = os.read(fd, 8)\n" +" print(\"Timer expired\")\n" +"finally:\n" +" # Remember to close the timer file descriptor!\n" +" os.close(fd)" +msgstr "" + +#: ../../howto/timerfd.rst:40 +msgid "" +"To avoid the precision loss caused by the :class:`float` type, timer file " +"descriptors allow specifying initial expiration and interval in integer " +"nanoseconds with ``_ns`` variants of the functions." +msgstr "" + +#: ../../howto/timerfd.rst:44 +msgid "" +"This example shows how :func:`~select.epoll` can be used with timer file " +"descriptors to wait until the file descriptor is ready for reading:" +msgstr "" + +#: ../../howto/timerfd.rst:47 +msgid "" +"import os, time, select, socket, sys\n" +"\n" +"# Create an epoll object\n" +"ep = select.epoll()\n" +"\n" +"# In this example, use loopback address to send \"stop\" command to the " +"server.\n" +"#\n" +"# $ telnet 127.0.0.1 1234\n" +"# Trying 127.0.0.1...\n" +"# Connected to 127.0.0.1.\n" +"# Escape character is '^]'.\n" +"# stop\n" +"# Connection closed by foreign host.\n" +"#\n" +"sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"sock.bind((\"127.0.0.1\", 1234))\n" +"sock.setblocking(False)\n" +"sock.listen(1)\n" +"ep.register(sock, select.EPOLLIN)\n" +"\n" +"# Create timer file descriptors in non-blocking mode.\n" +"num = 3\n" +"fds = []\n" +"for _ in range(num):\n" +" fd = os.timerfd_create(time.CLOCK_REALTIME, flags=os.TFD_NONBLOCK)\n" +" fds.append(fd)\n" +" # Register the timer file descriptor for read events\n" +" ep.register(fd, select.EPOLLIN)\n" +"\n" +"# Start the timer with os.timerfd_settime_ns() in nanoseconds.\n" +"# Timer 1 fires every 0.25 seconds; timer 2 every 0.5 seconds; etc\n" +"for i, fd in enumerate(fds, start=1):\n" +" one_sec_in_nsec = 10**9\n" +" i = i * one_sec_in_nsec\n" +" os.timerfd_settime_ns(fd, initial=i//4, interval=i//4)\n" +"\n" +"timeout = 3\n" +"try:\n" +" conn = None\n" +" is_active = True\n" +" while is_active:\n" +" # Wait for the timer to expire for 3 seconds.\n" +" # epoll.poll() returns a list of (fd, event) pairs.\n" +" # fd is a file descriptor.\n" +" # sock and conn[=returned value of socket.accept()] are socket " +"objects, not file descriptors.\n" +" # So use sock.fileno() and conn.fileno() to get the file " +"descriptors.\n" +" events = ep.poll(timeout)\n" +"\n" +" # If more than one timer file descriptors are ready for reading at " +"once,\n" +" # epoll.poll() returns a list of (fd, event) pairs.\n" +" #\n" +" # In this example settings,\n" +" # 1st timer fires every 0.25 seconds in 0.25 seconds. (0.25, 0.5, " +"0.75, 1.0, ...)\n" +" # 2nd timer every 0.5 seconds in 0.5 seconds. (0.5, 1.0, 1.5, " +"2.0, ...)\n" +" # 3rd timer every 0.75 seconds in 0.75 seconds. (0.75, 1.5, 2.25, " +"3.0, ...)\n" +" #\n" +" # In 0.25 seconds, only 1st timer fires.\n" +" # In 0.5 seconds, 1st timer and 2nd timer fires at once.\n" +" # In 0.75 seconds, 1st timer and 3rd timer fires at once.\n" +" # In 1.5 seconds, 1st timer, 2nd timer and 3rd timer fires at " +"once.\n" +" #\n" +" # If a timer file descriptor is signaled more than once since\n" +" # the last os.read() call, os.read() returns the number of signaled\n" +" # as host order of class bytes.\n" +" print(f\"Signaled events={events}\")\n" +" for fd, event in events:\n" +" if event & select.EPOLLIN:\n" +" if fd == sock.fileno():\n" +" # Check if there is a connection request.\n" +" print(f\"Accepting connection {fd}\")\n" +" conn, addr = sock.accept()\n" +" conn.setblocking(False)\n" +" print(f\"Accepted connection {conn} from {addr}\")\n" +" ep.register(conn, select.EPOLLIN)\n" +" elif conn and fd == conn.fileno():\n" +" # Check if there is data to read.\n" +" print(f\"Reading data {fd}\")\n" +" data = conn.recv(1024)\n" +" if data:\n" +" # You should catch UnicodeDecodeError exception for " +"safety.\n" +" cmd = data.decode()\n" +" if cmd.startswith(\"stop\"):\n" +" print(f\"Stopping server\")\n" +" is_active = False\n" +" else:\n" +" print(f\"Unknown command: {cmd}\")\n" +" else:\n" +" # No more data, close connection\n" +" print(f\"Closing connection {fd}\")\n" +" ep.unregister(conn)\n" +" conn.close()\n" +" conn = None\n" +" elif fd in fds:\n" +" print(f\"Reading timer {fd}\")\n" +" count = int.from_bytes(os.read(fd, 8), byteorder=sys." +"byteorder)\n" +" print(f\"Timer {fds.index(fd) + 1} expired {count} " +"times\")\n" +" else:\n" +" print(f\"Unknown file descriptor {fd}\")\n" +"finally:\n" +" for fd in fds:\n" +" ep.unregister(fd)\n" +" os.close(fd)\n" +" ep.close()" +msgstr "" + +#: ../../howto/timerfd.rst:153 +msgid "" +"This example shows how :func:`~select.select` can be used with timer file " +"descriptors to wait until the file descriptor is ready for reading:" +msgstr "" + +#: ../../howto/timerfd.rst:156 +msgid "" +"import os, time, select, socket, sys\n" +"\n" +"# In this example, use loopback address to send \"stop\" command to the " +"server.\n" +"#\n" +"# $ telnet 127.0.0.1 1234\n" +"# Trying 127.0.0.1...\n" +"# Connected to 127.0.0.1.\n" +"# Escape character is '^]'.\n" +"# stop\n" +"# Connection closed by foreign host.\n" +"#\n" +"sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"sock.bind((\"127.0.0.1\", 1234))\n" +"sock.setblocking(False)\n" +"sock.listen(1)\n" +"\n" +"# Create timer file descriptors in non-blocking mode.\n" +"num = 3\n" +"fds = [os.timerfd_create(time.CLOCK_REALTIME, flags=os.TFD_NONBLOCK)\n" +" for _ in range(num)]\n" +"select_fds = fds + [sock]\n" +"\n" +"# Start the timers with os.timerfd_settime() in seconds.\n" +"# Timer 1 fires every 0.25 seconds; timer 2 every 0.5 seconds; etc\n" +"for i, fd in enumerate(fds, start=1):\n" +" os.timerfd_settime(fd, initial=i/4, interval=i/4)\n" +"\n" +"timeout = 3\n" +"try:\n" +" conn = None\n" +" is_active = True\n" +" while is_active:\n" +" # Wait for the timer to expire for 3 seconds.\n" +" # select.select() returns a list of file descriptors or objects.\n" +" rfd, wfd, xfd = select.select(select_fds, select_fds, select_fds, " +"timeout)\n" +" for fd in rfd:\n" +" if fd == sock:\n" +" # Check if there is a connection request.\n" +" print(f\"Accepting connection {fd}\")\n" +" conn, addr = sock.accept()\n" +" conn.setblocking(False)\n" +" print(f\"Accepted connection {conn} from {addr}\")\n" +" select_fds.append(conn)\n" +" elif conn and fd == conn:\n" +" # Check if there is data to read.\n" +" print(f\"Reading data {fd}\")\n" +" data = conn.recv(1024)\n" +" if data:\n" +" # You should catch UnicodeDecodeError exception for " +"safety.\n" +" cmd = data.decode()\n" +" if cmd.startswith(\"stop\"):\n" +" print(f\"Stopping server\")\n" +" is_active = False\n" +" else:\n" +" print(f\"Unknown command: {cmd}\")\n" +" else:\n" +" # No more data, close connection\n" +" print(f\"Closing connection {fd}\")\n" +" select_fds.remove(conn)\n" +" conn.close()\n" +" conn = None\n" +" elif fd in fds:\n" +" print(f\"Reading timer {fd}\")\n" +" count = int.from_bytes(os.read(fd, 8), byteorder=sys." +"byteorder)\n" +" print(f\"Timer {fds.index(fd) + 1} expired {count} times\")\n" +" else:\n" +" print(f\"Unknown file descriptor {fd}\")\n" +"finally:\n" +" for fd in fds:\n" +" os.close(fd)\n" +" sock.close()\n" +" sock = None" +msgstr "" diff --git a/library/_thread.po b/library/_thread.po index c491b6a257..3fad9c4652 100644 --- a/library/_thread.po +++ b/library/_thread.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -173,14 +173,19 @@ msgstr "" "系統重新使用)。" #: ../../library/_thread.rst:123 +#, fuzzy msgid "" ":ref:`Availability `: Windows, FreeBSD, Linux, macOS, OpenBSD, " -"NetBSD, AIX, DragonFlyBSD." +"NetBSD, AIX, DragonFlyBSD, GNU/kFreeBSD." msgstr "" ":ref:`適用 `:Windows、FreeBSD、Linux、macOS、OpenBSD、NetBSD、" "AIX、DragonFlyBSD。" -#: ../../library/_thread.rst:130 +#: ../../library/_thread.rst:127 +msgid "Added support for GNU/kFreeBSD." +msgstr "" + +#: ../../library/_thread.rst:133 msgid "" "Return the thread stack size used when creating new threads. The optional " "*size* argument specifies the stack size to be used for subsequently created " @@ -208,15 +213,15 @@ msgstr "" "分配。應參考平台文檔以獲取更多訊息(4 KiB 頁面是比較普遍的;在缺乏更具體訊息" "的情況下,建議使用 4096 的倍數作為堆疊大小)。" -#: ../../library/_thread.rst:145 +#: ../../library/_thread.rst:148 msgid ":ref:`Availability `: Windows, pthreads." msgstr ":ref:`適用 `:Windows, pthreads。" -#: ../../library/_thread.rst:147 +#: ../../library/_thread.rst:150 msgid "Unix platforms with POSIX threads support." msgstr "Unix 平台上支援 POSIX 執行緒。" -#: ../../library/_thread.rst:152 +#: ../../library/_thread.rst:155 msgid "" "The maximum value allowed for the *timeout* parameter of :meth:`Lock.acquire " "`. Specifying a timeout greater than this value will " @@ -225,11 +230,11 @@ msgstr "" ":meth:`Lock.acquire ` 的 *timeout* 參數所允許的最大" "值。指定超過此值的 timeout 將引發 :exc:`OverflowError` 錯誤。" -#: ../../library/_thread.rst:159 +#: ../../library/_thread.rst:162 msgid "Lock objects have the following methods:" msgstr "鎖物件具有以下方法:" -#: ../../library/_thread.rst:164 +#: ../../library/_thread.rst:167 msgid "" "Without any optional argument, this method acquires the lock " "unconditionally, if necessary waiting until it is released by another thread " @@ -239,7 +244,7 @@ msgstr "" "沒有任何可選引數時,此方法無條件地獲取鎖,必要時會等待直到被另一個執行緒釋放" "(一次只能有一個執行緒獲取鎖 --- 這正是鎖存在的原因)。" -#: ../../library/_thread.rst:168 +#: ../../library/_thread.rst:171 msgid "" "If the *blocking* argument is present, the action depends on its value: if " "it is false, the lock is only acquired if it can be acquired immediately " @@ -249,7 +254,7 @@ msgstr "" "如果存在 *blocking* 引數,則根據其值執行操作:如果為 False,只有在可以立即獲" "取鎖而無需等待的情況下才獲取鎖,而如果為 True,則像上面一樣無條件地獲取鎖。" -#: ../../library/_thread.rst:173 +#: ../../library/_thread.rst:176 msgid "" "If the floating-point *timeout* argument is present and positive, it " "specifies the maximum wait time in seconds before returning. A negative " @@ -260,40 +265,40 @@ msgstr "" "(以秒為單位)。如果 *timeout* 引數為負值,則表示等待時間會無限期地等待。如" "果 *blocking* 為 False,則你無法指定 *timeout*。" -#: ../../library/_thread.rst:178 +#: ../../library/_thread.rst:181 msgid "" "The return value is ``True`` if the lock is acquired successfully, ``False`` " "if not." msgstr "如果成功獲取鎖,回傳值為 ``True``,否則為 ``False``。" -#: ../../library/_thread.rst:181 +#: ../../library/_thread.rst:184 msgid "The *timeout* parameter is new." msgstr "新增的 *timeout* 參數。" -#: ../../library/_thread.rst:184 +#: ../../library/_thread.rst:187 msgid "Lock acquires can now be interrupted by signals on POSIX." msgstr "現在獲取鎖的操作可以被 POSIX 訊號中斷。" -#: ../../library/_thread.rst:190 +#: ../../library/_thread.rst:193 msgid "" "Releases the lock. The lock must have been acquired earlier, but not " "necessarily by the same thread." msgstr "釋放鎖。鎖必須先前被獲取,但不一定是由同一個執行緒獲取的。" -#: ../../library/_thread.rst:196 +#: ../../library/_thread.rst:199 msgid "" "Return the status of the lock: ``True`` if it has been acquired by some " "thread, ``False`` if not." msgstr "" "回傳鎖的狀態:如果鎖已被某個執行緒獲取,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/_thread.rst:199 +#: ../../library/_thread.rst:202 msgid "" "In addition to these methods, lock objects can also be used via the :keyword:" "`with` statement, e.g.::" msgstr "除了這些方法之外,鎖物件還可以透過 :keyword:`with` 語句來使用,例如:" -#: ../../library/_thread.rst:202 +#: ../../library/_thread.rst:205 msgid "" "import _thread\n" "\n" @@ -303,11 +308,11 @@ msgid "" " print(\"a_lock is locked while this executes\")" msgstr "" -#: ../../library/_thread.rst:209 +#: ../../library/_thread.rst:212 msgid "**Caveats:**" msgstr "**注意事項:**" -#: ../../library/_thread.rst:213 +#: ../../library/_thread.rst:216 msgid "" "Threads interact strangely with interrupts: the :exc:`KeyboardInterrupt` " "exception will be received by an arbitrary thread. (When the :mod:`signal` " @@ -317,7 +322,7 @@ msgstr "" "`KeyboardInterrupt` 例外。(當 :mod:`signal` 模組可用時,中斷總是會進入主執行" "緒。)" -#: ../../library/_thread.rst:217 +#: ../../library/_thread.rst:220 msgid "" "Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is " "equivalent to calling :func:`_thread.exit`." @@ -325,7 +330,7 @@ msgstr "" "呼叫 :func:`sys.exit` 函數或引發 :exc:`SystemExit` 例外等同於呼叫 :func:" "`_thread.exit` 函式。" -#: ../../library/_thread.rst:220 +#: ../../library/_thread.rst:223 msgid "" "It is not possible to interrupt the :meth:`~threading.Lock.acquire` method " "on a lock --- the :exc:`KeyboardInterrupt` exception will happen after the " @@ -334,7 +339,7 @@ msgstr "" "無法在鎖的 :meth:`~threading.Lock.acquire` 方法上中斷執行, :exc:" "`KeyboardInterrupt` 例外會在鎖被獲取後發生。" -#: ../../library/_thread.rst:224 +#: ../../library/_thread.rst:227 msgid "" "When the main thread exits, it is system defined whether the other threads " "survive. On most systems, they are killed without executing :keyword:" @@ -344,7 +349,7 @@ msgstr "" "終止,而不會執行 :keyword:`try` ... :keyword:`finally` 子句或執行物件的解構函" "式。" -#: ../../library/_thread.rst:229 +#: ../../library/_thread.rst:232 msgid "" "When the main thread exits, it does not do any of its usual cleanup (except " "that :keyword:`try` ... :keyword:`finally` clauses are honored), and the " @@ -381,10 +386,10 @@ msgstr "threads(執行緒)" msgid "POSIX" msgstr "POSIX" -#: ../../library/_thread.rst:211 +#: ../../library/_thread.rst:214 msgid "module" msgstr "module(模組)" -#: ../../library/_thread.rst:211 +#: ../../library/_thread.rst:214 msgid "signal" msgstr "signal(訊號)" diff --git a/library/argparse.po b/library/argparse.po index dae329691f..726a5ed8f2 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -514,7 +514,7 @@ msgstr "" msgid "*exit_on_error* parameter was added." msgstr "新增 *exit_on_error* 參數。" -#: ../../library/argparse.rst:244 ../../library/argparse.rst:780 +#: ../../library/argparse.rst:244 ../../library/argparse.rst:782 msgid "The following sections describe how each of these are used." msgstr "" @@ -1431,11 +1431,15 @@ msgid "" "meth:`parse_args`." msgstr "" -#: ../../library/argparse.rst:786 -msgid "name or flags" +#: ../../library/argparse.rst:780 +msgid "deprecated_ - Whether or not use of the argument is deprecated." msgstr "" #: ../../library/argparse.rst:788 +msgid "name or flags" +msgstr "" + +#: ../../library/argparse.rst:790 msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " @@ -1444,30 +1448,30 @@ msgid "" "or a simple argument name." msgstr "" -#: ../../library/argparse.rst:794 +#: ../../library/argparse.rst:796 msgid "For example, an optional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:796 +#: ../../library/argparse.rst:798 msgid ">>> parser.add_argument('-f', '--foo')" msgstr ">>> parser.add_argument('-f', '--foo')" -#: ../../library/argparse.rst:798 +#: ../../library/argparse.rst:800 msgid "while a positional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:800 +#: ../../library/argparse.rst:802 msgid ">>> parser.add_argument('bar')" msgstr ">>> parser.add_argument('bar')" -#: ../../library/argparse.rst:802 +#: ../../library/argparse.rst:804 msgid "" "When :meth:`~ArgumentParser.parse_args` is called, optional arguments will " "be identified by the ``-`` prefix, and the remaining arguments will be " "assumed to be positional::" msgstr "" -#: ../../library/argparse.rst:806 +#: ../../library/argparse.rst:808 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo')\n" @@ -1491,11 +1495,11 @@ msgstr "" "usage: PROG [-h] [-f FOO] bar\n" "PROG: error: the following arguments are required: bar" -#: ../../library/argparse.rst:821 +#: ../../library/argparse.rst:823 msgid "action" msgstr "" -#: ../../library/argparse.rst:823 +#: ../../library/argparse.rst:825 msgid "" ":class:`ArgumentParser` objects associate command-line arguments with " "actions. These actions can do just about anything with the command-line " @@ -1505,13 +1509,13 @@ msgid "" "be handled. The supplied actions are:" msgstr "" -#: ../../library/argparse.rst:829 +#: ../../library/argparse.rst:831 msgid "" "``'store'`` - This just stores the argument's value. This is the default " "action. For example::" msgstr "" -#: ../../library/argparse.rst:832 +#: ../../library/argparse.rst:834 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -1523,7 +1527,7 @@ msgstr "" ">>> parser.parse_args('--foo 1'.split())\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:837 +#: ../../library/argparse.rst:839 msgid "" "``'store_const'`` - This stores the value specified by the const_ keyword " "argument; note that the const_ keyword argument defaults to ``None``. The " @@ -1531,7 +1535,7 @@ msgid "" "specify some sort of flag. For example::" msgstr "" -#: ../../library/argparse.rst:842 +#: ../../library/argparse.rst:844 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/store_const', const=42)\n" @@ -1543,7 +1547,7 @@ msgstr "" ">>> parser.parse_args(['--foo'])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:847 +#: ../../library/argparse.rst:849 msgid "" "``'store_true'`` and ``'store_false'`` - These are special cases of " "``'store_const'`` used for storing the values ``True`` and ``False`` " @@ -1551,7 +1555,7 @@ msgid "" "``True`` respectively. For example::" msgstr "" -#: ../../library/argparse.rst:852 +#: ../../library/argparse.rst:854 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/store_true')\n" @@ -1567,7 +1571,7 @@ msgstr "" ">>> parser.parse_args('--foo --bar'.split())\n" "Namespace(foo=True, bar=False, baz=True)" -#: ../../library/argparse.rst:859 +#: ../../library/argparse.rst:861 msgid "" "``'append'`` - This stores a list, and appends each argument value to the " "list. It is useful to allow an option to be specified multiple times. If the " @@ -1576,7 +1580,7 @@ msgid "" "after those default values. Example usage::" msgstr "" -#: ../../library/argparse.rst:865 +#: ../../library/argparse.rst:867 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/append')\n" @@ -1588,7 +1592,7 @@ msgstr "" ">>> parser.parse_args('--foo 1 --foo 2'.split())\n" "Namespace(foo=['1', '2'])" -#: ../../library/argparse.rst:870 +#: ../../library/argparse.rst:872 msgid "" "``'append_const'`` - This stores a list, and appends the value specified by " "the const_ keyword argument to the list; note that the const_ keyword " @@ -1597,7 +1601,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:876 +#: ../../library/argparse.rst:878 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--str', dest='types', action='http://github.com/append_const', " @@ -1615,13 +1619,13 @@ msgstr "" ">>> parser.parse_args('--str --int'.split())\n" "Namespace(types=[, ])" -#: ../../library/argparse.rst:882 +#: ../../library/argparse.rst:884 msgid "" "``'count'`` - This counts the number of times a keyword argument occurs. For " "example, this is useful for increasing verbosity levels::" msgstr "" -#: ../../library/argparse.rst:885 +#: ../../library/argparse.rst:887 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--verbose', '-v', action='http://github.com/count', default=0)\n" @@ -1629,11 +1633,11 @@ msgid "" "Namespace(verbose=3)" msgstr "" -#: ../../library/argparse.rst:890 +#: ../../library/argparse.rst:892 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." msgstr "" -#: ../../library/argparse.rst:892 +#: ../../library/argparse.rst:894 msgid "" "``'help'`` - This prints a complete help message for all the options in the " "current parser and then exits. By default a help action is automatically " @@ -1641,14 +1645,14 @@ msgid "" "output is created." msgstr "" -#: ../../library/argparse.rst:897 +#: ../../library/argparse.rst:899 msgid "" "``'version'`` - This expects a ``version=`` keyword argument in the :meth:" "`~ArgumentParser.add_argument` call, and prints version information and " "exits when invoked::" msgstr "" -#: ../../library/argparse.rst:901 +#: ../../library/argparse.rst:903 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -1664,13 +1668,13 @@ msgstr "" ">>> parser.parse_args(['--version'])\n" "PROG 2.0" -#: ../../library/argparse.rst:907 +#: ../../library/argparse.rst:909 msgid "" "``'extend'`` - This stores a list, and extends each argument value to the " "list. Example usage::" msgstr "" -#: ../../library/argparse.rst:911 +#: ../../library/argparse.rst:913 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " @@ -1686,7 +1690,7 @@ msgstr "" "\"f4\"])\n" "Namespace(foo=['f1', 'f2', 'f3', 'f4'])" -#: ../../library/argparse.rst:918 +#: ../../library/argparse.rst:920 msgid "" "You may also specify an arbitrary action by passing an Action subclass or " "other object that implements the same interface. The " @@ -1694,7 +1698,7 @@ msgid "" "boolean actions such as ``--foo`` and ``--no-foo``::" msgstr "" -#: ../../library/argparse.rst:923 +#: ../../library/argparse.rst:925 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -1708,18 +1712,18 @@ msgstr "" ">>> parser.parse_args(['--no-foo'])\n" "Namespace(foo=False)" -#: ../../library/argparse.rst:931 +#: ../../library/argparse.rst:933 msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " "overriding the ``__call__`` method and optionally the ``__init__`` and " "``format_usage`` methods." msgstr "" -#: ../../library/argparse.rst:935 +#: ../../library/argparse.rst:937 msgid "An example of a custom action::" msgstr "" -#: ../../library/argparse.rst:937 +#: ../../library/argparse.rst:939 msgid "" ">>> class FooAction(argparse.Action):\n" "... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" @@ -1740,15 +1744,15 @@ msgid "" "Namespace(bar='1', foo='2')" msgstr "" -#: ../../library/argparse.rst:955 +#: ../../library/argparse.rst:957 msgid "For more details, see :class:`Action`." msgstr "" -#: ../../library/argparse.rst:961 +#: ../../library/argparse.rst:963 msgid "nargs" msgstr "" -#: ../../library/argparse.rst:963 +#: ../../library/argparse.rst:965 msgid "" "ArgumentParser objects usually associate a single command-line argument with " "a single action to be taken. The ``nargs`` keyword argument associates a " @@ -1756,13 +1760,13 @@ msgid "" "ref:`specifying-ambiguous-arguments`. The supported values are:" msgstr "" -#: ../../library/argparse.rst:968 +#: ../../library/argparse.rst:970 msgid "" "``N`` (an integer). ``N`` arguments from the command line will be gathered " "together into a list. For example::" msgstr "" -#: ../../library/argparse.rst:971 +#: ../../library/argparse.rst:973 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs=2)\n" @@ -1776,13 +1780,13 @@ msgstr "" ">>> parser.parse_args('c --foo a b'.split())\n" "Namespace(bar=['c'], foo=['a', 'b'])" -#: ../../library/argparse.rst:977 +#: ../../library/argparse.rst:979 msgid "" "Note that ``nargs=1`` produces a list of one item. This is different from " "the default, in which the item is produced by itself." msgstr "" -#: ../../library/argparse.rst:982 +#: ../../library/argparse.rst:984 msgid "" "``'?'``. One argument will be consumed from the command line if possible, " "and produced as a single item. If no command-line argument is present, the " @@ -1792,7 +1796,7 @@ msgid "" "produced. Some examples to illustrate this::" msgstr "" -#: ../../library/argparse.rst:989 +#: ../../library/argparse.rst:991 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" @@ -1814,13 +1818,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(bar='d', foo='d')" -#: ../../library/argparse.rst:999 +#: ../../library/argparse.rst:1001 msgid "" "One of the more common uses of ``nargs='?'`` is to allow optional input and " "output files::" msgstr "" -#: ../../library/argparse.rst:1002 +#: ../../library/argparse.rst:1004 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', nargs='?', type=argparse.FileType('r'),\n" @@ -1846,7 +1850,7 @@ msgstr "" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>,\n" " outfile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1016 +#: ../../library/argparse.rst:1018 msgid "" "``'*'``. All command-line arguments present are gathered into a list. Note " "that it generally doesn't make much sense to have more than one positional " @@ -1854,7 +1858,7 @@ msgid "" "``nargs='*'`` is possible. For example::" msgstr "" -#: ../../library/argparse.rst:1021 +#: ../../library/argparse.rst:1023 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='*')\n" @@ -1870,14 +1874,14 @@ msgstr "" ">>> parser.parse_args('a b --foo x y --bar 1 2'.split())\n" "Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])" -#: ../../library/argparse.rst:1030 +#: ../../library/argparse.rst:1032 msgid "" "``'+'``. Just like ``'*'``, all command-line args present are gathered into " "a list. Additionally, an error message will be generated if there wasn't at " "least one command-line argument present. For example::" msgstr "" -#: ../../library/argparse.rst:1034 +#: ../../library/argparse.rst:1036 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('foo', nargs='+')\n" @@ -1895,7 +1899,7 @@ msgstr "" "usage: PROG [-h] foo [foo ...]\n" "PROG: error: the following arguments are required: foo" -#: ../../library/argparse.rst:1042 +#: ../../library/argparse.rst:1044 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " @@ -1903,11 +1907,11 @@ msgid "" "be produced." msgstr "" -#: ../../library/argparse.rst:1050 +#: ../../library/argparse.rst:1052 msgid "const" msgstr "" -#: ../../library/argparse.rst:1052 +#: ../../library/argparse.rst:1054 msgid "" "The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to " "hold constant values that are not read from the command line but are " @@ -1915,7 +1919,7 @@ msgid "" "common uses of it are:" msgstr "" -#: ../../library/argparse.rst:1056 +#: ../../library/argparse.rst:1058 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='http://github.com/store_const'`` or ``action='http://github.com/append_const'``. These actions add " @@ -1925,7 +1929,7 @@ msgid "" "receive a default value of ``None``." msgstr "" -#: ../../library/argparse.rst:1064 +#: ../../library/argparse.rst:1066 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with option strings " "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " @@ -1935,17 +1939,17 @@ msgid "" "to be ``None`` instead. See the nargs_ description for examples." msgstr "" -#: ../../library/argparse.rst:1071 +#: ../../library/argparse.rst:1073 msgid "" "``const=None`` by default, including when ``action='http://github.com/append_const'`` or " "``action='http://github.com/store_const'``." msgstr "" -#: ../../library/argparse.rst:1078 +#: ../../library/argparse.rst:1080 msgid "default" msgstr "" -#: ../../library/argparse.rst:1080 +#: ../../library/argparse.rst:1082 msgid "" "All optional arguments and some positional arguments may be omitted at the " "command line. The ``default`` keyword argument of :meth:`~ArgumentParser." @@ -1955,7 +1959,7 @@ msgid "" "command line::" msgstr "" -#: ../../library/argparse.rst:1087 +#: ../../library/argparse.rst:1089 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1971,13 +1975,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:1094 +#: ../../library/argparse.rst:1096 msgid "" "If the target namespace already has an attribute set, the action *default* " "will not over write it::" msgstr "" -#: ../../library/argparse.rst:1097 +#: ../../library/argparse.rst:1099 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1989,7 +1993,7 @@ msgstr "" ">>> parser.parse_args([], namespace=argparse.Namespace(foo=101))\n" "Namespace(foo=101)" -#: ../../library/argparse.rst:1102 +#: ../../library/argparse.rst:1104 msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " @@ -1997,7 +2001,7 @@ msgid "" "`Namespace` return value. Otherwise, the parser uses the value as is::" msgstr "" -#: ../../library/argparse.rst:1107 +#: ../../library/argparse.rst:1109 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--length', default='10', type=int)\n" @@ -2011,13 +2015,13 @@ msgstr "" ">>> parser.parse_args()\n" "Namespace(length=10, width=10.5)" -#: ../../library/argparse.rst:1113 +#: ../../library/argparse.rst:1115 msgid "" "For positional arguments with nargs_ equal to ``?`` or ``*``, the " "``default`` value is used when no command-line argument was present::" msgstr "" -#: ../../library/argparse.rst:1116 +#: ../../library/argparse.rst:1118 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', nargs='?', default=42)\n" @@ -2033,13 +2037,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:1124 +#: ../../library/argparse.rst:1126 msgid "" "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " "the command-line argument was not present::" msgstr "" -#: ../../library/argparse.rst:1127 +#: ../../library/argparse.rst:1129 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" @@ -2055,11 +2059,11 @@ msgstr "" ">>> parser.parse_args(['--foo', '1'])\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:1138 +#: ../../library/argparse.rst:1140 msgid "type" msgstr "" -#: ../../library/argparse.rst:1140 +#: ../../library/argparse.rst:1142 msgid "" "By default, the parser reads command-line arguments in as simple strings. " "However, quite often the command-line string should instead be interpreted " @@ -2068,13 +2072,13 @@ msgid "" "checking and type conversions to be performed." msgstr "" -#: ../../library/argparse.rst:1146 +#: ../../library/argparse.rst:1148 msgid "" "If the type_ keyword is used with the default_ keyword, the type converter " "is only applied if the default is a string." msgstr "" -#: ../../library/argparse.rst:1149 +#: ../../library/argparse.rst:1151 msgid "" "The argument to ``type`` can be any callable that accepts a single string. " "If the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" @@ -2082,11 +2086,11 @@ msgid "" "is displayed. No other exception types are handled." msgstr "" -#: ../../library/argparse.rst:1154 +#: ../../library/argparse.rst:1156 msgid "Common built-in types and functions can be used as type converters:" msgstr "" -#: ../../library/argparse.rst:1156 +#: ../../library/argparse.rst:1158 msgid "" "import argparse\n" "import pathlib\n" @@ -2114,11 +2118,11 @@ msgstr "" "encoding='latin-1'))\n" "parser.add_argument('datapath', type=pathlib.Path)" -#: ../../library/argparse.rst:1170 +#: ../../library/argparse.rst:1172 msgid "User defined functions can be used as well:" msgstr "" -#: ../../library/argparse.rst:1172 +#: ../../library/argparse.rst:1174 msgid "" ">>> def hyphenated(string):\n" "... return '-'.join([word[:4] for word in string.casefold().split()])\n" @@ -2136,14 +2140,14 @@ msgstr "" ">>> parser.parse_args(['\"The Tale of Two Cities\"'])\n" "Namespace(short_title='\"the-tale-of-two-citi')" -#: ../../library/argparse.rst:1182 +#: ../../library/argparse.rst:1184 msgid "" "The :func:`bool` function is not recommended as a type converter. All it " "does is convert empty strings to ``False`` and non-empty strings to " "``True``. This is usually not what is desired." msgstr "" -#: ../../library/argparse.rst:1186 +#: ../../library/argparse.rst:1188 msgid "" "In general, the ``type`` keyword is a convenience that should only be used " "for simple conversions that can only raise one of the three supported " @@ -2151,7 +2155,7 @@ msgid "" "management should be done downstream after the arguments are parsed." msgstr "" -#: ../../library/argparse.rst:1191 +#: ../../library/argparse.rst:1193 msgid "" "For example, JSON or YAML conversions have complex error cases that require " "better reporting than can be given by the ``type`` keyword. A :exc:`~json." @@ -2159,7 +2163,7 @@ msgid "" "exception would not be handled at all." msgstr "" -#: ../../library/argparse.rst:1196 +#: ../../library/argparse.rst:1198 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " "``type`` keyword. If one argument uses *FileType* and then a subsequent " @@ -2168,17 +2172,17 @@ msgid "" "run and then use the :keyword:`with`-statement to manage the files." msgstr "" -#: ../../library/argparse.rst:1202 +#: ../../library/argparse.rst:1204 msgid "" "For type checkers that simply check against a fixed set of values, consider " "using the choices_ keyword instead." msgstr "" -#: ../../library/argparse.rst:1209 +#: ../../library/argparse.rst:1211 msgid "choices" msgstr "" -#: ../../library/argparse.rst:1211 +#: ../../library/argparse.rst:1213 msgid "" "Some command-line arguments should be selected from a restricted set of " "values. These can be handled by passing a sequence object as the *choices* " @@ -2187,7 +2191,7 @@ msgid "" "be displayed if the argument was not one of the acceptable values::" msgstr "" -#: ../../library/argparse.rst:1217 +#: ../../library/argparse.rst:1219 msgid "" ">>> parser = argparse.ArgumentParser(prog='game.py')\n" ">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" @@ -2207,14 +2211,14 @@ msgstr "" "game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n" "'paper', 'scissors')" -#: ../../library/argparse.rst:1226 +#: ../../library/argparse.rst:1228 msgid "" "Note that inclusion in the *choices* sequence is checked after any type_ " "conversions have been performed, so the type of the objects in the *choices* " "sequence should match the type_ specified::" msgstr "" -#: ../../library/argparse.rst:1230 +#: ../../library/argparse.rst:1232 msgid "" ">>> parser = argparse.ArgumentParser(prog='doors.py')\n" ">>> parser.add_argument('door', type=int, choices=range(1, 4))\n" @@ -2232,19 +2236,19 @@ msgstr "" "usage: doors.py [-h] {1,2,3}\n" "doors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3)" -#: ../../library/argparse.rst:1238 +#: ../../library/argparse.rst:1240 msgid "" "Any sequence can be passed as the *choices* value, so :class:`list` " "objects, :class:`tuple` objects, and custom sequences are all supported." msgstr "" -#: ../../library/argparse.rst:1241 +#: ../../library/argparse.rst:1243 msgid "" "Use of :class:`enum.Enum` is not recommended because it is difficult to " "control its appearance in usage, help, and error messages." msgstr "" -#: ../../library/argparse.rst:1244 +#: ../../library/argparse.rst:1246 msgid "" "Formatted choices override the default *metavar* which is normally derived " "from *dest*. This is usually what you want because the user never sees the " @@ -2252,11 +2256,11 @@ msgid "" "are many choices), just specify an explicit metavar_." msgstr "" -#: ../../library/argparse.rst:1253 +#: ../../library/argparse.rst:1255 msgid "required" msgstr "" -#: ../../library/argparse.rst:1255 +#: ../../library/argparse.rst:1257 msgid "" "In general, the :mod:`argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " @@ -2264,7 +2268,7 @@ msgid "" "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: ../../library/argparse.rst:1260 +#: ../../library/argparse.rst:1262 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', required=True)\n" @@ -2282,24 +2286,24 @@ msgstr "" "usage: [-h] --foo FOO\n" ": error: the following arguments are required: --foo" -#: ../../library/argparse.rst:1268 +#: ../../library/argparse.rst:1270 msgid "" "As the example shows, if an option is marked as ``required``, :meth:" "`~ArgumentParser.parse_args` will report an error if that option is not " "present at the command line." msgstr "" -#: ../../library/argparse.rst:1274 +#: ../../library/argparse.rst:1276 msgid "" "Required options are generally considered bad form because users expect " "*options* to be *optional*, and thus they should be avoided when possible." msgstr "" -#: ../../library/argparse.rst:1281 +#: ../../library/argparse.rst:1283 msgid "help" msgstr "幫助" -#: ../../library/argparse.rst:1283 +#: ../../library/argparse.rst:1285 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " @@ -2307,7 +2311,7 @@ msgid "" "each argument::" msgstr "" -#: ../../library/argparse.rst:1288 +#: ../../library/argparse.rst:1290 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', action='http://github.com/store_true',\n" @@ -2339,7 +2343,7 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo foo the bars before frobbling" -#: ../../library/argparse.rst:1303 +#: ../../library/argparse.rst:1305 msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " @@ -2348,7 +2352,7 @@ msgid "" "``%(type)s``, etc.::" msgstr "" -#: ../../library/argparse.rst:1308 +#: ../../library/argparse.rst:1310 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" @@ -2374,19 +2378,19 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1320 +#: ../../library/argparse.rst:1322 msgid "" "As the help string supports %-formatting, if you want a literal ``%`` to " "appear in the help string, you must escape it as ``%%``." msgstr "" -#: ../../library/argparse.rst:1323 +#: ../../library/argparse.rst:1325 msgid "" ":mod:`argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:1326 +#: ../../library/argparse.rst:1328 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" @@ -2404,11 +2408,11 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1338 +#: ../../library/argparse.rst:1340 msgid "metavar" msgstr "" -#: ../../library/argparse.rst:1340 +#: ../../library/argparse.rst:1342 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " "refer to each expected argument. By default, ArgumentParser objects use the " @@ -2420,7 +2424,7 @@ msgid "" "argument will be referred to as ``FOO``. An example::" msgstr "" -#: ../../library/argparse.rst:1349 +#: ../../library/argparse.rst:1351 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2452,11 +2456,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO" -#: ../../library/argparse.rst:1364 +#: ../../library/argparse.rst:1366 msgid "An alternative name can be specified with ``metavar``::" msgstr "" -#: ../../library/argparse.rst:1366 +#: ../../library/argparse.rst:1368 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', metavar='YYY')\n" @@ -2488,21 +2492,21 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo YYY" -#: ../../library/argparse.rst:1381 +#: ../../library/argparse.rst:1383 msgid "" "Note that ``metavar`` only changes the *displayed* name - the name of the " "attribute on the :meth:`~ArgumentParser.parse_args` object is still " "determined by the dest_ value." msgstr "" -#: ../../library/argparse.rst:1385 +#: ../../library/argparse.rst:1387 msgid "" "Different values of ``nargs`` may cause the metavar to be used multiple " "times. Providing a tuple to ``metavar`` specifies a different display for " "each of the arguments::" msgstr "" -#: ../../library/argparse.rst:1389 +#: ../../library/argparse.rst:1391 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', nargs=2)\n" @@ -2526,11 +2530,11 @@ msgstr "" " -x X X\n" " --foo bar baz" -#: ../../library/argparse.rst:1404 +#: ../../library/argparse.rst:1406 msgid "dest" msgstr "" -#: ../../library/argparse.rst:1406 +#: ../../library/argparse.rst:1408 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " @@ -2540,7 +2544,7 @@ msgid "" "add_argument`::" msgstr "" -#: ../../library/argparse.rst:1413 +#: ../../library/argparse.rst:1415 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('bar')\n" @@ -2552,7 +2556,7 @@ msgstr "" ">>> parser.parse_args(['XXX'])\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1418 +#: ../../library/argparse.rst:1420 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " @@ -2564,7 +2568,7 @@ msgid "" "below illustrate this behavior::" msgstr "" -#: ../../library/argparse.rst:1427 +#: ../../library/argparse.rst:1429 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('-f', '--foo-bar', '--foo')\n" @@ -2582,11 +2586,11 @@ msgstr "" ">>> parser.parse_args('--foo 1 -y 2'.split())\n" "Namespace(foo_bar='1', x='2')" -#: ../../library/argparse.rst:1435 +#: ../../library/argparse.rst:1437 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" -#: ../../library/argparse.rst:1437 +#: ../../library/argparse.rst:1439 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', dest='bar')\n" @@ -2598,11 +2602,45 @@ msgstr "" ">>> parser.parse_args('--foo XXX'.split())\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1443 +#: ../../library/argparse.rst:1448 +msgid "deprecated" +msgstr "" + +#: ../../library/argparse.rst:1450 +msgid "" +"During a project's lifetime, some arguments may need to be removed from the " +"command line. Before removing them, you should inform your users that the " +"arguments are deprecated and will be removed. The ``deprecated`` keyword " +"argument of :meth:`~ArgumentParser.add_argument`, which defaults to " +"``False``, specifies if the argument is deprecated and will be removed in " +"the future. For arguments, if ``deprecated`` is ``True``, then a warning " +"will be printed to standard error when the argument is used::" +msgstr "" + +#: ../../library/argparse.rst:1460 +#, fuzzy +msgid "" +">>> import argparse\n" +">>> parser = argparse.ArgumentParser(prog='snake.py')\n" +">>> parser.add_argument('--legs', default=0, type=int, deprecated=True)\n" +">>> parser.parse_args([])\n" +"Namespace(legs=0)\n" +">>> parser.parse_args(['--legs', '4']) \n" +"snake.py: warning: option '--legs' is deprecated\n" +"Namespace(legs=4)" +msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" +">>> parser.parse_args([])\n" +"Namespace()\n" +">>> parser.parse_args(['--foo', '1'])\n" +"Namespace(foo='1')" + +#: ../../library/argparse.rst:1473 msgid "Action classes" msgstr "" -#: ../../library/argparse.rst:1445 +#: ../../library/argparse.rst:1475 msgid "" "Action classes implement the Action API, a callable which returns a callable " "which processes arguments from the command-line. Any object which follows " @@ -2610,7 +2648,7 @@ msgid "" "add_argument`." msgstr "" -#: ../../library/argparse.rst:1454 +#: ../../library/argparse.rst:1484 msgid "" "Action objects are used by an ArgumentParser to represent the information " "needed to parse a single argument from one or more strings from the command " @@ -2619,7 +2657,7 @@ msgid "" "the ``action`` itself." msgstr "" -#: ../../library/argparse.rst:1460 +#: ../../library/argparse.rst:1490 msgid "" "Instances of Action (or return value of any callable to the ``action`` " "parameter) should have attributes \"dest\", \"option_strings\", \"default\", " @@ -2627,91 +2665,91 @@ msgid "" "these attributes are defined is to call ``Action.__init__``." msgstr "" -#: ../../library/argparse.rst:1465 +#: ../../library/argparse.rst:1495 msgid "" "Action instances should be callable, so subclasses must override the " "``__call__`` method, which should accept four parameters:" msgstr "" -#: ../../library/argparse.rst:1468 +#: ../../library/argparse.rst:1498 msgid "``parser`` - The ArgumentParser object which contains this action." msgstr "" -#: ../../library/argparse.rst:1470 +#: ../../library/argparse.rst:1500 msgid "" "``namespace`` - The :class:`Namespace` object that will be returned by :meth:" "`~ArgumentParser.parse_args`. Most actions add an attribute to this object " "using :func:`setattr`." msgstr "" -#: ../../library/argparse.rst:1474 +#: ../../library/argparse.rst:1504 msgid "" "``values`` - The associated command-line arguments, with any type " "conversions applied. Type conversions are specified with the type_ keyword " "argument to :meth:`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1478 +#: ../../library/argparse.rst:1508 msgid "" "``option_string`` - The option string that was used to invoke this action. " "The ``option_string`` argument is optional, and will be absent if the action " "is associated with a positional argument." msgstr "" -#: ../../library/argparse.rst:1482 +#: ../../library/argparse.rst:1512 msgid "" "The ``__call__`` method may perform arbitrary actions, but will typically " "set attributes on the ``namespace`` based on ``dest`` and ``values``." msgstr "" -#: ../../library/argparse.rst:1485 +#: ../../library/argparse.rst:1515 msgid "" "Action subclasses can define a ``format_usage`` method that takes no " "argument and return a string which will be used when printing the usage of " "the program. If such method is not provided, a sensible default will be used." msgstr "" -#: ../../library/argparse.rst:1490 +#: ../../library/argparse.rst:1520 msgid "The parse_args() method" msgstr "" -#: ../../library/argparse.rst:1494 +#: ../../library/argparse.rst:1524 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" -#: ../../library/argparse.rst:1497 +#: ../../library/argparse.rst:1527 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " "created and how they are assigned. See the documentation for :meth:" "`add_argument` for details." msgstr "" -#: ../../library/argparse.rst:1501 +#: ../../library/argparse.rst:1531 msgid "" "args_ - List of strings to parse. The default is taken from :data:`sys." "argv`." msgstr "" -#: ../../library/argparse.rst:1504 +#: ../../library/argparse.rst:1534 msgid "" "namespace_ - An object to take the attributes. The default is a new empty :" "class:`Namespace` object." msgstr "" -#: ../../library/argparse.rst:1509 +#: ../../library/argparse.rst:1539 msgid "Option value syntax" msgstr "" -#: ../../library/argparse.rst:1511 +#: ../../library/argparse.rst:1541 msgid "" "The :meth:`~ArgumentParser.parse_args` method supports several ways of " "specifying the value of an option (if it takes one). In the simplest case, " "the option and its value are passed as two separate arguments::" msgstr "" -#: ../../library/argparse.rst:1515 +#: ../../library/argparse.rst:1545 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2729,14 +2767,14 @@ msgstr "" ">>> parser.parse_args(['--foo', 'FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1523 +#: ../../library/argparse.rst:1553 msgid "" "For long options (options with names longer than a single character), the " "option and value can also be passed as a single command-line argument, using " "``=`` to separate them::" msgstr "" -#: ../../library/argparse.rst:1527 +#: ../../library/argparse.rst:1557 msgid "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" @@ -2744,13 +2782,13 @@ msgstr "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1530 +#: ../../library/argparse.rst:1560 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "" -#: ../../library/argparse.rst:1533 +#: ../../library/argparse.rst:1563 msgid "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" @@ -2758,13 +2796,13 @@ msgstr "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" -#: ../../library/argparse.rst:1536 +#: ../../library/argparse.rst:1566 msgid "" "Several short options can be joined together, using only a single ``-`` " "prefix, as long as only the last option (or none of them) requires a value::" msgstr "" -#: ../../library/argparse.rst:1539 +#: ../../library/argparse.rst:1569 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='http://github.com/store_true')\n" @@ -2780,11 +2818,11 @@ msgstr "" ">>> parser.parse_args(['-xyzZ'])\n" "Namespace(x=True, y=True, z='Z')" -#: ../../library/argparse.rst:1548 +#: ../../library/argparse.rst:1578 msgid "Invalid arguments" msgstr "" -#: ../../library/argparse.rst:1550 +#: ../../library/argparse.rst:1580 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " @@ -2792,7 +2830,7 @@ msgid "" "an error, it exits and prints the error along with a usage message::" msgstr "" -#: ../../library/argparse.rst:1555 +#: ../../library/argparse.rst:1585 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', type=int)\n" @@ -2814,11 +2852,11 @@ msgid "" "PROG: error: extra arguments found: badger" msgstr "" -#: ../../library/argparse.rst:1576 +#: ../../library/argparse.rst:1606 msgid "Arguments containing ``-``" msgstr "" -#: ../../library/argparse.rst:1578 +#: ../../library/argparse.rst:1608 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " @@ -2830,7 +2868,7 @@ msgid "" "negative numbers::" msgstr "" -#: ../../library/argparse.rst:1586 +#: ../../library/argparse.rst:1616 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2863,7 +2901,7 @@ msgid "" "PROG: error: argument -1: expected one argument" msgstr "" -#: ../../library/argparse.rst:1616 +#: ../../library/argparse.rst:1646 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " @@ -2871,7 +2909,7 @@ msgid "" "positional argument::" msgstr "" -#: ../../library/argparse.rst:1621 +#: ../../library/argparse.rst:1651 msgid "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" @@ -2879,24 +2917,24 @@ msgstr "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" -#: ../../library/argparse.rst:1624 +#: ../../library/argparse.rst:1654 msgid "" "See also :ref:`the argparse howto on ambiguous arguments ` for more details." msgstr "" -#: ../../library/argparse.rst:1630 +#: ../../library/argparse.rst:1660 msgid "Argument abbreviations (prefix matching)" msgstr "" -#: ../../library/argparse.rst:1632 +#: ../../library/argparse.rst:1662 msgid "" "The :meth:`~ArgumentParser.parse_args` method :ref:`by default " "` allows long options to be abbreviated to a prefix, if the " "abbreviation is unambiguous (the prefix matches a unique option)::" msgstr "" -#: ../../library/argparse.rst:1636 +#: ../../library/argparse.rst:1666 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -2920,17 +2958,17 @@ msgstr "" "usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" "PROG: error: ambiguous option: -ba could match -badger, -bacon" -#: ../../library/argparse.rst:1647 +#: ../../library/argparse.rst:1677 msgid "" "An error is produced for arguments that could produce more than one options. " "This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." msgstr "" -#: ../../library/argparse.rst:1653 +#: ../../library/argparse.rst:1683 msgid "Beyond ``sys.argv``" msgstr "" -#: ../../library/argparse.rst:1655 +#: ../../library/argparse.rst:1685 msgid "" "Sometimes it may be useful to have an ArgumentParser parse arguments other " "than those of :data:`sys.argv`. This can be accomplished by passing a list " @@ -2938,7 +2976,7 @@ msgid "" "testing at the interactive prompt::" msgstr "" -#: ../../library/argparse.rst:1660 +#: ../../library/argparse.rst:1690 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\n" @@ -2964,24 +3002,24 @@ msgstr "" ">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" "Namespace(accumulate=, integers=[1, 2, 3, 4])" -#: ../../library/argparse.rst:1675 +#: ../../library/argparse.rst:1705 msgid "The Namespace object" msgstr "" -#: ../../library/argparse.rst:1679 +#: ../../library/argparse.rst:1709 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." msgstr "" -#: ../../library/argparse.rst:1682 +#: ../../library/argparse.rst:1712 msgid "" "This class is deliberately simple, just an :class:`object` subclass with a " "readable string representation. If you prefer to have dict-like view of the " "attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" -#: ../../library/argparse.rst:1686 +#: ../../library/argparse.rst:1716 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2995,14 +3033,14 @@ msgstr "" ">>> vars(args)\n" "{'foo': 'BAR'}" -#: ../../library/argparse.rst:1692 +#: ../../library/argparse.rst:1722 msgid "" "It may also be useful to have an :class:`ArgumentParser` assign attributes " "to an already existing object, rather than a new :class:`Namespace` object. " "This can be achieved by specifying the ``namespace=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:1696 +#: ../../library/argparse.rst:1726 msgid "" ">>> class C:\n" "... pass\n" @@ -3024,15 +3062,15 @@ msgstr "" ">>> c.foo\n" "'BAR'" -#: ../../library/argparse.rst:1708 +#: ../../library/argparse.rst:1738 msgid "Other utilities" msgstr "" -#: ../../library/argparse.rst:1711 +#: ../../library/argparse.rst:1741 msgid "Sub-commands" msgstr "" -#: ../../library/argparse.rst:1718 +#: ../../library/argparse.rst:1748 msgid "" "Many programs split up their functionality into a number of sub-commands, " "for example, the ``svn`` program can invoke sub-commands like ``svn " @@ -3048,69 +3086,69 @@ msgid "" "can be modified as usual." msgstr "" -#: ../../library/argparse.rst:1730 +#: ../../library/argparse.rst:1760 msgid "Description of parameters:" msgstr "" -#: ../../library/argparse.rst:1732 +#: ../../library/argparse.rst:1762 msgid "" "title - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " "positional arguments" msgstr "" -#: ../../library/argparse.rst:1736 +#: ../../library/argparse.rst:1766 msgid "" "description - description for the sub-parser group in help output, by " "default ``None``" msgstr "" -#: ../../library/argparse.rst:1739 +#: ../../library/argparse.rst:1769 msgid "" "prog - usage information that will be displayed with sub-command help, by " "default the name of the program and any positional arguments before the " "subparser argument" msgstr "" -#: ../../library/argparse.rst:1743 +#: ../../library/argparse.rst:1773 msgid "" "parser_class - class which will be used to create sub-parser instances, by " "default the class of the current parser (e.g. ArgumentParser)" msgstr "" -#: ../../library/argparse.rst:1746 +#: ../../library/argparse.rst:1776 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "" -#: ../../library/argparse.rst:1749 +#: ../../library/argparse.rst:1779 msgid "" "dest_ - name of the attribute under which sub-command name will be stored; " "by default ``None`` and no value is stored" msgstr "" -#: ../../library/argparse.rst:1752 +#: ../../library/argparse.rst:1782 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "" -#: ../../library/argparse.rst:1755 +#: ../../library/argparse.rst:1785 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" -#: ../../library/argparse.rst:1757 +#: ../../library/argparse.rst:1787 msgid "" "metavar_ - string presenting available sub-commands in help; by default it " "is ``None`` and presents sub-commands in form {cmd1, cmd2, ..}" msgstr "" -#: ../../library/argparse.rst:1760 +#: ../../library/argparse.rst:1790 msgid "Some example usage::" msgstr "一些使用範例: ::" -#: ../../library/argparse.rst:1762 +#: ../../library/argparse.rst:1792 msgid "" ">>> # create the top-level parser\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -3132,7 +3170,7 @@ msgid "" "Namespace(baz='Z', foo=True)" msgstr "" -#: ../../library/argparse.rst:1781 +#: ../../library/argparse.rst:1811 msgid "" "Note that the object returned by :meth:`parse_args` will only contain " "attributes for the main parser and the subparser that was selected by the " @@ -3142,7 +3180,7 @@ msgid "" "``baz`` attributes are present." msgstr "" -#: ../../library/argparse.rst:1788 +#: ../../library/argparse.rst:1818 msgid "" "Similarly, when a help message is requested from a subparser, only the help " "for that particular parser will be printed. The help message will not " @@ -3151,7 +3189,7 @@ msgid "" "to :meth:`~_SubParsersAction.add_parser` as above.)" msgstr "" -#: ../../library/argparse.rst:1796 +#: ../../library/argparse.rst:1826 msgid "" ">>> parser.parse_args(['--help'])\n" "usage: PROG [-h] [--foo] {a,b} ...\n" @@ -3209,14 +3247,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --baz {X,Y,Z} baz help" -#: ../../library/argparse.rst:1824 +#: ../../library/argparse.rst:1854 msgid "" "The :meth:`add_subparsers` method also supports ``title`` and " "``description`` keyword arguments. When either is present, the subparser's " "commands will appear in their own group in the help output. For example::" msgstr "" -#: ../../library/argparse.rst:1828 +#: ../../library/argparse.rst:1858 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -3252,14 +3290,15 @@ msgstr "" "\n" " {foo,bar} additional help" -#: ../../library/argparse.rst:1845 +#: ../../library/argparse.rst:1875 msgid "" -"Furthermore, ``add_parser`` supports an additional ``aliases`` argument, " -"which allows multiple strings to refer to the same subparser. This example, " -"like ``svn``, aliases ``co`` as a shorthand for ``checkout``::" +"Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional " +"*aliases* argument, which allows multiple strings to refer to the same " +"subparser. This example, like ``svn``, aliases ``co`` as a shorthand for " +"``checkout``::" msgstr "" -#: ../../library/argparse.rst:1849 +#: ../../library/argparse.rst:1880 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -3275,7 +3314,13 @@ msgstr "" ">>> parser.parse_args(['co', 'bar'])\n" "Namespace(foo='bar')" -#: ../../library/argparse.rst:1856 +#: ../../library/argparse.rst:1887 +msgid "" +":meth:`~_SubParsersAction.add_parser` supports also an additional " +"*deprecated* argument, which allows to deprecate the subparser." +msgstr "" + +#: ../../library/argparse.rst:1901 msgid "" "One particularly effective way of handling sub-commands is to combine the " "use of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` " @@ -3283,7 +3328,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:1861 +#: ../../library/argparse.rst:1906 msgid "" ">>> # sub-command functions\n" ">>> def foo(args):\n" @@ -3318,7 +3363,7 @@ msgid "" "((XYZYX))" msgstr "" -#: ../../library/argparse.rst:1893 +#: ../../library/argparse.rst:1938 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " @@ -3328,7 +3373,7 @@ msgid "" "argument to the :meth:`add_subparsers` call will work::" msgstr "" -#: ../../library/argparse.rst:1900 +#: ../../library/argparse.rst:1945 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" @@ -3348,15 +3393,15 @@ msgstr "" ">>> parser.parse_args(['2', 'frobble'])\n" "Namespace(subparser_name='2', y='frobble')" -#: ../../library/argparse.rst:1909 +#: ../../library/argparse.rst:1954 msgid "New *required* keyword argument." msgstr "" -#: ../../library/argparse.rst:1914 +#: ../../library/argparse.rst:1959 msgid "FileType objects" msgstr "FileType 物件" -#: ../../library/argparse.rst:1918 +#: ../../library/argparse.rst:1963 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " "argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" @@ -3365,7 +3410,7 @@ msgid "" "the :func:`open` function for more details)::" msgstr "" -#: ../../library/argparse.rst:1924 +#: ../../library/argparse.rst:1969 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" @@ -3383,14 +3428,14 @@ msgstr "" "Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " "raw=<_io.FileIO name='raw.dat' mode='wb'>)" -#: ../../library/argparse.rst:1930 +#: ../../library/argparse.rst:1975 msgid "" "FileType objects understand the pseudo-argument ``'-'`` and automatically " "convert this into :data:`sys.stdin` for readable :class:`FileType` objects " "and :data:`sys.stdout` for writable :class:`FileType` objects::" msgstr "" -#: ../../library/argparse.rst:1934 +#: ../../library/argparse.rst:1979 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" @@ -3402,15 +3447,15 @@ msgstr "" ">>> parser.parse_args(['-'])\n" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1939 +#: ../../library/argparse.rst:1984 msgid "Added the *encodings* and *errors* parameters." msgstr "" -#: ../../library/argparse.rst:1944 +#: ../../library/argparse.rst:1989 msgid "Argument groups" msgstr "" -#: ../../library/argparse.rst:1948 +#: ../../library/argparse.rst:1993 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"options\" when displaying help messages. When " @@ -3419,7 +3464,7 @@ msgid "" "method::" msgstr "" -#: ../../library/argparse.rst:1954 +#: ../../library/argparse.rst:1999 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group = parser.add_argument_group('group')\n" @@ -3443,7 +3488,7 @@ msgstr "" " bar bar help\n" " --foo FOO foo help" -#: ../../library/argparse.rst:1965 +#: ../../library/argparse.rst:2010 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " "has an :meth:`~ArgumentParser.add_argument` method just like a regular :" @@ -3454,7 +3499,7 @@ msgid "" "this display::" msgstr "" -#: ../../library/argparse.rst:1973 +#: ../../library/argparse.rst:2018 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" @@ -3492,13 +3537,13 @@ msgstr "" "\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1991 +#: ../../library/argparse.rst:2036 msgid "" "Note that any arguments not in your user-defined groups will end up back in " "the usual \"positional arguments\" and \"optional arguments\" sections." msgstr "" -#: ../../library/argparse.rst:1994 +#: ../../library/argparse.rst:2039 msgid "" "Calling :meth:`add_argument_group` on an argument group is deprecated. This " "feature was never supported and does not always work correctly. The function " @@ -3506,18 +3551,18 @@ msgid "" "future." msgstr "" -#: ../../library/argparse.rst:2002 +#: ../../library/argparse.rst:2047 msgid "Mutual exclusion" msgstr "" -#: ../../library/argparse.rst:2006 +#: ../../library/argparse.rst:2051 msgid "" "Create a mutually exclusive group. :mod:`argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " "command line::" msgstr "" -#: ../../library/argparse.rst:2010 +#: ../../library/argparse.rst:2055 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -3543,14 +3588,14 @@ msgstr "" "usage: PROG [-h] [--foo | --bar]\n" "PROG: error: argument --bar: not allowed with argument --foo" -#: ../../library/argparse.rst:2022 +#: ../../library/argparse.rst:2067 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " "is required::" msgstr "" -#: ../../library/argparse.rst:2026 +#: ../../library/argparse.rst:2071 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -3568,7 +3613,7 @@ msgstr "" "usage: PROG [-h] (--foo | --bar)\n" "PROG: error: one of the arguments --foo --bar is required" -#: ../../library/argparse.rst:2034 +#: ../../library/argparse.rst:2079 msgid "" "Note that currently mutually exclusive argument groups do not support the " "*title* and *description* arguments of :meth:`~ArgumentParser." @@ -3576,7 +3621,7 @@ msgid "" "argument group that has a title and description. For example::" msgstr "" -#: ../../library/argparse.rst:2040 +#: ../../library/argparse.rst:2085 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -3612,7 +3657,7 @@ msgstr "" " --foo FOO foo help\n" " --bar BAR bar help" -#: ../../library/argparse.rst:2057 +#: ../../library/argparse.rst:2102 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " "on a mutually exclusive group is deprecated. These features were never " @@ -3620,11 +3665,11 @@ msgid "" "by accident through inheritance and will be removed in the future." msgstr "" -#: ../../library/argparse.rst:2065 +#: ../../library/argparse.rst:2110 msgid "Parser defaults" msgstr "" -#: ../../library/argparse.rst:2069 +#: ../../library/argparse.rst:2114 msgid "" "Most of the time, the attributes of the object returned by :meth:" "`parse_args` will be fully determined by inspecting the command-line " @@ -3633,7 +3678,7 @@ msgid "" "command line to be added::" msgstr "" -#: ../../library/argparse.rst:2075 +#: ../../library/argparse.rst:2120 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -3647,12 +3692,12 @@ msgstr "" ">>> parser.parse_args(['736'])\n" "Namespace(bar=42, baz='badger', foo=736)" -#: ../../library/argparse.rst:2081 +#: ../../library/argparse.rst:2126 msgid "" "Note that parser-level defaults always override argument-level defaults::" msgstr "" -#: ../../library/argparse.rst:2083 +#: ../../library/argparse.rst:2128 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -3666,20 +3711,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo='spam')" -#: ../../library/argparse.rst:2089 +#: ../../library/argparse.rst:2134 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " "example of this type." msgstr "" -#: ../../library/argparse.rst:2095 +#: ../../library/argparse.rst:2140 msgid "" "Get the default value for a namespace attribute, as set by either :meth:" "`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" msgstr "" -#: ../../library/argparse.rst:2099 +#: ../../library/argparse.rst:2144 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" @@ -3691,54 +3736,54 @@ msgstr "" ">>> parser.get_default('foo')\n" "'badger'" -#: ../../library/argparse.rst:2106 +#: ../../library/argparse.rst:2151 msgid "Printing help" msgstr "" -#: ../../library/argparse.rst:2108 +#: ../../library/argparse.rst:2153 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " "several formatting methods are available:" msgstr "" -#: ../../library/argparse.rst:2114 +#: ../../library/argparse.rst:2159 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " "assumed." msgstr "" -#: ../../library/argparse.rst:2120 +#: ../../library/argparse.rst:2165 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " "``None``, :data:`sys.stdout` is assumed." msgstr "" -#: ../../library/argparse.rst:2124 +#: ../../library/argparse.rst:2169 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "" -#: ../../library/argparse.rst:2129 +#: ../../library/argparse.rst:2174 msgid "" "Return a string containing a brief description of how the :class:" "`ArgumentParser` should be invoked on the command line." msgstr "" -#: ../../library/argparse.rst:2134 +#: ../../library/argparse.rst:2179 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:2139 +#: ../../library/argparse.rst:2184 msgid "Partial parsing" msgstr "" -#: ../../library/argparse.rst:2143 +#: ../../library/argparse.rst:2188 msgid "" "Sometimes a script may only parse a few of the command-line arguments, " "passing the remaining arguments on to another script or program. In these " @@ -3749,7 +3794,7 @@ msgid "" "remaining argument strings." msgstr "" -#: ../../library/argparse.rst:2152 +#: ../../library/argparse.rst:2197 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/store_true')\n" @@ -3763,7 +3808,7 @@ msgstr "" ">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" -#: ../../library/argparse.rst:2159 +#: ../../library/argparse.rst:2204 msgid "" ":ref:`Prefix matching ` rules apply to :meth:" "`~ArgumentParser.parse_known_args`. The parser may consume an option even if " @@ -3771,11 +3816,11 @@ msgid "" "remaining arguments list." msgstr "" -#: ../../library/argparse.rst:2166 +#: ../../library/argparse.rst:2211 msgid "Customizing file parsing" msgstr "" -#: ../../library/argparse.rst:2170 +#: ../../library/argparse.rst:2215 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -3783,20 +3828,20 @@ msgid "" "reading." msgstr "" -#: ../../library/argparse.rst:2175 +#: ../../library/argparse.rst:2220 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " "The method is called once per line read from the argument file, in order." msgstr "" -#: ../../library/argparse.rst:2179 +#: ../../library/argparse.rst:2224 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" msgstr "" -#: ../../library/argparse.rst:2182 +#: ../../library/argparse.rst:2227 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" @@ -3806,18 +3851,18 @@ msgstr "" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" -#: ../../library/argparse.rst:2188 +#: ../../library/argparse.rst:2233 msgid "Exiting methods" msgstr "" -#: ../../library/argparse.rst:2192 +#: ../../library/argparse.rst:2237 msgid "" "This method terminates the program, exiting with the specified *status* and, " "if given, it prints a *message* before that. The user can override this " "method to handle these steps differently::" msgstr "" -#: ../../library/argparse.rst:2196 +#: ../../library/argparse.rst:2241 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -3831,17 +3876,17 @@ msgstr "" " raise Exception(f'Exiting because of an error: {message}')\n" " exit(status)" -#: ../../library/argparse.rst:2204 +#: ../../library/argparse.rst:2249 msgid "" "This method prints a usage message including the *message* to the standard " "error and terminates the program with a status code of 2." msgstr "" -#: ../../library/argparse.rst:2209 +#: ../../library/argparse.rst:2254 msgid "Intermixed parsing" msgstr "" -#: ../../library/argparse.rst:2214 +#: ../../library/argparse.rst:2259 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -3849,7 +3894,7 @@ msgid "" "parsing style." msgstr "" -#: ../../library/argparse.rst:2219 +#: ../../library/argparse.rst:2264 msgid "" "These parsers do not support all the argparse features, and will raise " "exceptions if unsupported features are used. In particular, subparsers, and " @@ -3857,7 +3902,7 @@ msgid "" "not supported." msgstr "" -#: ../../library/argparse.rst:2224 +#: ../../library/argparse.rst:2269 msgid "" "The following example shows the difference between :meth:`~ArgumentParser." "parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " @@ -3865,7 +3910,7 @@ msgid "" "collects all the positionals into ``rest``. ::" msgstr "" -#: ../../library/argparse.rst:2230 +#: ../../library/argparse.rst:2275 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3885,7 +3930,7 @@ msgstr "" ">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" "Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" -#: ../../library/argparse.rst:2239 +#: ../../library/argparse.rst:2284 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -3893,11 +3938,11 @@ msgid "" "there are any remaining unparsed argument strings." msgstr "" -#: ../../library/argparse.rst:2249 +#: ../../library/argparse.rst:2294 msgid "Upgrading optparse code" msgstr "" -#: ../../library/argparse.rst:2251 +#: ../../library/argparse.rst:2296 msgid "" "Originally, the :mod:`argparse` module had attempted to maintain " "compatibility with :mod:`optparse`. However, :mod:`optparse` was difficult " @@ -3908,47 +3953,47 @@ msgid "" "compatibility." msgstr "" -#: ../../library/argparse.rst:2258 +#: ../../library/argparse.rst:2303 msgid "" "The :mod:`argparse` module improves on the standard library :mod:`optparse` " "module in a number of ways including:" msgstr "" -#: ../../library/argparse.rst:2261 +#: ../../library/argparse.rst:2306 msgid "Handling positional arguments." msgstr "" -#: ../../library/argparse.rst:2262 +#: ../../library/argparse.rst:2307 msgid "Supporting sub-commands." msgstr "" -#: ../../library/argparse.rst:2263 +#: ../../library/argparse.rst:2308 msgid "Allowing alternative option prefixes like ``+`` and ``/``." msgstr "" -#: ../../library/argparse.rst:2264 +#: ../../library/argparse.rst:2309 msgid "Handling zero-or-more and one-or-more style arguments." msgstr "" -#: ../../library/argparse.rst:2265 +#: ../../library/argparse.rst:2310 msgid "Producing more informative usage messages." msgstr "" -#: ../../library/argparse.rst:2266 +#: ../../library/argparse.rst:2311 msgid "Providing a much simpler interface for custom ``type`` and ``action``." msgstr "" -#: ../../library/argparse.rst:2268 +#: ../../library/argparse.rst:2313 msgid "A partial upgrade path from :mod:`optparse` to :mod:`argparse`:" msgstr "" -#: ../../library/argparse.rst:2270 +#: ../../library/argparse.rst:2315 msgid "" "Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:" "`ArgumentParser.add_argument` calls." msgstr "" -#: ../../library/argparse.rst:2273 +#: ../../library/argparse.rst:2318 msgid "" "Replace ``(options, args) = parser.parse_args()`` with ``args = parser." "parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls " @@ -3956,78 +4001,78 @@ msgid "" "``options``, now in the :mod:`argparse` context is called ``args``." msgstr "" -#: ../../library/argparse.rst:2278 +#: ../../library/argparse.rst:2323 msgid "" "Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using :" "meth:`~ArgumentParser.parse_intermixed_args` instead of :meth:" "`~ArgumentParser.parse_args`." msgstr "" -#: ../../library/argparse.rst:2282 +#: ../../library/argparse.rst:2327 msgid "" "Replace callback actions and the ``callback_*`` keyword arguments with " "``type`` or ``action`` arguments." msgstr "" -#: ../../library/argparse.rst:2285 +#: ../../library/argparse.rst:2330 msgid "" "Replace string names for ``type`` keyword arguments with the corresponding " "type objects (e.g. int, float, complex, etc)." msgstr "" -#: ../../library/argparse.rst:2288 +#: ../../library/argparse.rst:2333 msgid "" "Replace :class:`optparse.Values` with :class:`Namespace` and :exc:`optparse." "OptionError` and :exc:`optparse.OptionValueError` with :exc:`ArgumentError`." msgstr "" -#: ../../library/argparse.rst:2292 +#: ../../library/argparse.rst:2337 msgid "" "Replace strings with implicit arguments such as ``%default`` or ``%prog`` " "with the standard Python syntax to use dictionaries to format strings, that " "is, ``%(default)s`` and ``%(prog)s``." msgstr "" -#: ../../library/argparse.rst:2296 +#: ../../library/argparse.rst:2341 msgid "" "Replace the OptionParser constructor ``version`` argument with a call to " "``parser.add_argument('--version', action='http://github.com/version', version='')``." msgstr "" -#: ../../library/argparse.rst:2300 +#: ../../library/argparse.rst:2345 msgid "Exceptions" msgstr "" -#: ../../library/argparse.rst:2304 +#: ../../library/argparse.rst:2349 msgid "An error from creating or using an argument (optional or positional)." msgstr "" -#: ../../library/argparse.rst:2306 +#: ../../library/argparse.rst:2351 msgid "" "The string value of this exception is the message, augmented with " "information about the argument that caused it." msgstr "" -#: ../../library/argparse.rst:2311 +#: ../../library/argparse.rst:2356 msgid "" "Raised when something goes wrong converting a command line string to a type." msgstr "" -#: ../../library/argparse.rst:980 +#: ../../library/argparse.rst:982 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/argparse.rst:980 ../../library/argparse.rst:1014 -#: ../../library/argparse.rst:1028 +#: ../../library/argparse.rst:982 ../../library/argparse.rst:1016 +#: ../../library/argparse.rst:1030 msgid "in argparse module" msgstr "於 argparse 模組中" -#: ../../library/argparse.rst:1014 +#: ../../library/argparse.rst:1016 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/argparse.rst:1028 +#: ../../library/argparse.rst:1030 msgid "+ (plus)" msgstr "+ (加號)" diff --git a/library/array.po b/library/array.po index c45d79a1f8..22011a7f92 100644 --- a/library/array.po +++ b/library/array.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-11-23 18:40+0800\n" "Last-Translator: Benson Chen \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -69,10 +69,10 @@ msgid "signed char" msgstr "signed char" #: ../../library/array.rst:21 ../../library/array.rst:23 -#: ../../library/array.rst:27 ../../library/array.rst:29 -#: ../../library/array.rst:31 ../../library/array.rst:33 -#: ../../library/array.rst:35 ../../library/array.rst:37 -#: ../../library/array.rst:39 ../../library/array.rst:41 +#: ../../library/array.rst:29 ../../library/array.rst:31 +#: ../../library/array.rst:33 ../../library/array.rst:35 +#: ../../library/array.rst:37 ../../library/array.rst:39 +#: ../../library/array.rst:41 ../../library/array.rst:43 msgid "int" msgstr "int" @@ -96,13 +96,13 @@ msgstr "``'u'``" msgid "wchar_t" msgstr "wchar_t" -#: ../../library/array.rst:25 +#: ../../library/array.rst:25 ../../library/array.rst:27 msgid "Unicode character" msgstr "Unicode character" -#: ../../library/array.rst:25 ../../library/array.rst:27 -#: ../../library/array.rst:29 ../../library/array.rst:31 -#: ../../library/array.rst:33 +#: ../../library/array.rst:25 ../../library/array.rst:29 +#: ../../library/array.rst:31 ../../library/array.rst:33 +#: ../../library/array.rst:35 msgid "2" msgstr "2" @@ -111,104 +111,112 @@ msgid "\\(1)" msgstr "\\(1)" #: ../../library/array.rst:27 +msgid "``'w'``" +msgstr "" + +#: ../../library/array.rst:27 +msgid "Py_UCS4" +msgstr "" + +#: ../../library/array.rst:27 ../../library/array.rst:37 +#: ../../library/array.rst:39 ../../library/array.rst:45 +msgid "4" +msgstr "4" + +#: ../../library/array.rst:29 msgid "``'h'``" msgstr "``'h'``" -#: ../../library/array.rst:27 +#: ../../library/array.rst:29 msgid "signed short" msgstr "signed short" -#: ../../library/array.rst:29 +#: ../../library/array.rst:31 msgid "``'H'``" msgstr "``'H'``" -#: ../../library/array.rst:29 +#: ../../library/array.rst:31 msgid "unsigned short" msgstr "unsigned short" -#: ../../library/array.rst:31 +#: ../../library/array.rst:33 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/array.rst:31 +#: ../../library/array.rst:33 msgid "signed int" msgstr "signed int" -#: ../../library/array.rst:33 +#: ../../library/array.rst:35 msgid "``'I'``" msgstr "``'I'``" -#: ../../library/array.rst:33 +#: ../../library/array.rst:35 msgid "unsigned int" msgstr "unsigned int" -#: ../../library/array.rst:35 +#: ../../library/array.rst:37 msgid "``'l'``" msgstr "``'l'``" -#: ../../library/array.rst:35 +#: ../../library/array.rst:37 msgid "signed long" msgstr "signed long" -#: ../../library/array.rst:35 ../../library/array.rst:37 -#: ../../library/array.rst:43 -msgid "4" -msgstr "4" - -#: ../../library/array.rst:37 +#: ../../library/array.rst:39 msgid "``'L'``" msgstr "``'L'``" -#: ../../library/array.rst:37 +#: ../../library/array.rst:39 msgid "unsigned long" msgstr "unsigned long" -#: ../../library/array.rst:39 +#: ../../library/array.rst:41 msgid "``'q'``" msgstr "``'q'``" -#: ../../library/array.rst:39 +#: ../../library/array.rst:41 msgid "signed long long" msgstr "signed long long" -#: ../../library/array.rst:39 ../../library/array.rst:41 -#: ../../library/array.rst:45 +#: ../../library/array.rst:41 ../../library/array.rst:43 +#: ../../library/array.rst:47 msgid "8" msgstr "8" -#: ../../library/array.rst:41 +#: ../../library/array.rst:43 msgid "``'Q'``" msgstr "``'Q'``" -#: ../../library/array.rst:41 +#: ../../library/array.rst:43 msgid "unsigned long long" msgstr "unsigned long long" -#: ../../library/array.rst:43 +#: ../../library/array.rst:45 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/array.rst:43 ../../library/array.rst:45 +#: ../../library/array.rst:45 ../../library/array.rst:47 msgid "float" msgstr "float" -#: ../../library/array.rst:45 +#: ../../library/array.rst:47 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/array.rst:45 +#: ../../library/array.rst:47 msgid "double" msgstr "double" -#: ../../library/array.rst:48 +#: ../../library/array.rst:50 msgid "Notes:" msgstr "註解:" -#: ../../library/array.rst:51 +#: ../../library/array.rst:53 msgid "It can be 16 bits or 32 bits depending on the platform." msgstr "根據平台的不同,它有可能是 16 位元或者 32 位元。" -#: ../../library/array.rst:53 +#: ../../library/array.rst:55 msgid "" "``array('u')`` now uses :c:type:`wchar_t` as C type instead of deprecated " "``Py_UNICODE``. This change doesn't affect its behavior because " @@ -218,7 +226,11 @@ msgstr "" "C type。這個異動並沒有影響到它的作用,因爲自從 Python 3.3 開始 " "``Py_UNICODE`` 即為 :c:type:`wchar_t` 的別名。" -#: ../../library/array.rst:61 +#: ../../library/array.rst:60 +msgid "Please migrate to ``'w'`` typecode." +msgstr "" + +#: ../../library/array.rst:64 msgid "" "The actual representation of values is determined by the machine " "architecture (strictly speaking, by the C implementation). The actual size " @@ -227,19 +239,19 @@ msgstr "" "實際上數值的表示方法是被機器的架構所決定(更精準地說,被 C 的實作方法決定)。" "實際的大小可以透過 :attr:`array.itemsize` 屬性存取。" -#: ../../library/array.rst:65 +#: ../../library/array.rst:68 msgid "The module defines the following item:" msgstr "這個模組定義了以下項目:" -#: ../../library/array.rst:70 +#: ../../library/array.rst:73 msgid "A string with all available type codes." msgstr "一個包含所有可用的 type codes 的字串。" -#: ../../library/array.rst:73 +#: ../../library/array.rst:76 msgid "The module defines the following type:" msgstr "這個模組定義了下方的型別:" -#: ../../library/array.rst:78 +#: ../../library/array.rst:81 msgid "" "A new array whose items are restricted by *typecode*, and initialized from " "the optional *initializer* value, which must be a :class:`bytes` or :class:" @@ -250,7 +262,7 @@ msgstr "" "*initializer* 必須是一個 :class:`bytes` 或 :class:`bytearray` 物件、一個 " "Unicode 字串或包含適當型別元素的可疊代物件 (iterable)。" -#: ../../library/array.rst:83 +#: ../../library/array.rst:86 msgid "" "If given a :class:`bytes` or :class:`bytearray` object, the initializer is " "passed to the new array's :meth:`frombytes` method; if given a Unicode " @@ -263,7 +275,7 @@ msgstr "" "方法;其他情況時, 一個 initializer 的可疊代物件將被傳入 :meth:`extend` 方法" "之中來將初始項目新增至陣列。" -#: ../../library/array.rst:90 +#: ../../library/array.rst:93 msgid "" "Array objects support the ordinary sequence operations of indexing, slicing, " "concatenation, and multiplication. When using slice assignment, the " @@ -278,7 +290,7 @@ msgstr "" "了緩衝區介面,可以在任何支援 :term:`bytes-like objects ` " "的地方使用。" -#: ../../library/array.rst:96 +#: ../../library/array.rst:99 msgid "" "Raises an :ref:`auditing event ` ``array.__new__`` with arguments " "``typecode``, ``initializer``." @@ -286,19 +298,19 @@ msgstr "" "引發\\ :ref:`稽核事件 (auditing event) ` ``array.__new__`` 並附帶引" "數 ``typecode``、``initializer``。" -#: ../../library/array.rst:101 +#: ../../library/array.rst:104 msgid "The typecode character used to create the array." msgstr "typecode 字元被用在建立陣列時。" -#: ../../library/array.rst:106 +#: ../../library/array.rst:109 msgid "The length in bytes of one array item in the internal representation." msgstr "陣列當中的一個元素在內部需要的位元組長度。" -#: ../../library/array.rst:111 +#: ../../library/array.rst:114 msgid "Append a new item with value *x* to the end of the array." msgstr "新增一個元素 *x* 到陣列的最尾端。" -#: ../../library/array.rst:116 +#: ../../library/array.rst:119 msgid "" "Return a tuple ``(address, length)`` giving the current memory address and " "the length in elements of the buffer used to hold array's contents. The " @@ -315,7 +327,7 @@ msgstr "" "用,例如 :c:func:`!ioctl` 指令。只要陣列存在且沒有使用任何更改長度的操作時," "回傳的數值就有效。" -#: ../../library/array.rst:126 +#: ../../library/array.rst:129 msgid "" "When using array objects from code written in C or C++ (the only way to " "effectively make use of this information), it makes more sense to use the " @@ -327,7 +339,7 @@ msgstr "" "適當的做法是使用陣列物件支援的緩衝區介面。這個方法維護了向後兼容性,並應該在" "新的程式碼中避免。關於緩衝區介面的文件在\\ :ref:`bufferobjects`。" -#: ../../library/array.rst:135 +#: ../../library/array.rst:138 msgid "" "\"Byteswap\" all items of the array. This is only supported for values " "which are 1, 2, 4, or 8 bytes in size; for other types of values, :exc:" @@ -338,11 +350,11 @@ msgstr "" "列,其他型別的值會導致 :exc:`RuntimeError`。這在從機器讀取位元順序不同的檔案" "時很有用。" -#: ../../library/array.rst:143 +#: ../../library/array.rst:146 msgid "Return the number of occurrences of *x* in the array." msgstr "回傳 *x* 在陣列中出現了幾次。" -#: ../../library/array.rst:148 +#: ../../library/array.rst:151 msgid "" "Append items from *iterable* to the end of the array. If *iterable* is " "another array, it must have *exactly* the same type code; if not, :exc:" @@ -354,7 +366,7 @@ msgstr "" "個陣列,它必須可以被疊代 (iterable) 且其中的元素必須是可以被加入陣列中的正確" "型別。" -#: ../../library/array.rst:156 +#: ../../library/array.rst:159 msgid "" "Appends items from the :term:`bytes-like object`, interpreting its content " "as an array of machine values (as if it had been read from a file using the :" @@ -363,11 +375,11 @@ msgstr "" "從 :term:`bytes-like object` 中新增元素。讀取時會將其內容當作一個機器數值組成" "的陣列(就像從檔案中使用 :meth:`fromfile` 方法讀出的資料)。" -#: ../../library/array.rst:160 +#: ../../library/array.rst:163 msgid ":meth:`!fromstring` is renamed to :meth:`frombytes` for clarity." msgstr "將 :meth:`!fromstring` 更名為 :meth:`frombytes`,使其更加清晰易懂。" -#: ../../library/array.rst:166 +#: ../../library/array.rst:169 msgid "" "Read *n* items (as machine values) from the :term:`file object` *f* and " "append them to the end of the array. If less than *n* items are available, :" @@ -378,7 +390,7 @@ msgstr "" "入陣列的最尾端。如果只有少於 *n* 個有效的元素會導致 :exc:`EOFError`,但有效的" "元素仍然會被加入陣列中。" -#: ../../library/array.rst:174 +#: ../../library/array.rst:177 msgid "" "Append items from the list. This is equivalent to ``for x in list: a." "append(x)`` except that if there is a type error, the array is unchanged." @@ -386,18 +398,19 @@ msgstr "" "從 list 中新增元素。這等價於 ``for x in list: a.append(x)``,除了有型別錯誤產" "生時,陣列會保持原狀不會被更改。" -#: ../../library/array.rst:180 +#: ../../library/array.rst:183 +#, fuzzy msgid "" "Extends this array with data from the given Unicode string. The array must " -"have type code ``'u'``; otherwise a :exc:`ValueError` is raised. Use ``array." -"frombytes(unicodestring.encode(enc))`` to append Unicode data to an array of " -"some other type." +"have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. " +"Use ``array.frombytes(unicodestring.encode(enc))`` to append Unicode data to " +"an array of some other type." msgstr "" "用給定的 Unicode 字串擴展這個陣列。陣列的 type code 必須是 ``u``;其他的型別" "會導致 :exc:`ValueError` 被引發。使用 ``array.frombytes(unicodestring." "encode(enc))`` 來新增 Unicode 資料到一個其他型別的陣列。" -#: ../../library/array.rst:188 +#: ../../library/array.rst:191 msgid "" "Return the smallest *i* such that *i* is the index of the first occurrence " "of *x* in the array. The optional arguments *start* and *stop* can be " @@ -408,17 +421,17 @@ msgstr "" "數 *start* 及 *stop* 則可以被用來在指定的陣列空間中搜尋 *x*。如果 *x* 不存在" "將導致 :exc:`ValueError`。" -#: ../../library/array.rst:193 +#: ../../library/array.rst:196 msgid "Added optional *start* and *stop* parameters." msgstr "新增選擇性的參數 *start* 及 *stop*。" -#: ../../library/array.rst:199 +#: ../../library/array.rst:202 msgid "" "Insert a new item with value *x* in the array before position *i*. Negative " "values are treated as being relative to the end of the array." msgstr "在位置 *i* 之前插入一個元素 *x*。負數的索引值會從陣列尾端開始數。" -#: ../../library/array.rst:205 +#: ../../library/array.rst:208 msgid "" "Removes the item with the index *i* from the array and returns it. The " "optional argument defaults to ``-1``, so that by default the last item is " @@ -427,15 +440,20 @@ msgstr "" "移除並回傳陣列索引值 *i* 的元素。選擇性的引數 *i* 預設為 ``-1``,所以預設會刪" "除並回傳最後一個元素。" -#: ../../library/array.rst:212 +#: ../../library/array.rst:215 msgid "Remove the first occurrence of *x* from the array." msgstr "從陣列中刪除第一個出現的 *x*。" -#: ../../library/array.rst:217 +#: ../../library/array.rst:220 +#, fuzzy +msgid "Remove all elements from the array." +msgstr "從陣列中刪除第一個出現的 *x*。" + +#: ../../library/array.rst:227 msgid "Reverse the order of the items in the array." msgstr "反轉陣列中元素的順序。" -#: ../../library/array.rst:222 +#: ../../library/array.rst:232 msgid "" "Convert the array to an array of machine values and return the bytes " "representation (the same sequence of bytes that would be written to a file " @@ -444,38 +462,41 @@ msgstr "" "將陣列轉為另一個機器數值組成的陣列並回傳它的位元組表示(跟用 :meth:`tofile` " "方法寫入檔案時的位元序列相同)。" -#: ../../library/array.rst:226 +#: ../../library/array.rst:236 msgid ":meth:`!tostring` is renamed to :meth:`tobytes` for clarity." msgstr "為了明確性,過去的 :meth:`!tostring` 已更名為 :meth:`tobytes`。" -#: ../../library/array.rst:232 +#: ../../library/array.rst:242 msgid "Write all items (as machine values) to the :term:`file object` *f*." msgstr "將所有元素(作為機器數值)寫入 :term:`file object` *f*。" -#: ../../library/array.rst:237 +#: ../../library/array.rst:247 msgid "Convert the array to an ordinary list with the same items." msgstr "不更改元素,將陣列轉為一般的 list。" -#: ../../library/array.rst:242 +#: ../../library/array.rst:252 +#, fuzzy msgid "" -"Convert the array to a Unicode string. The array must have a type ``'u'``; " -"otherwise a :exc:`ValueError` is raised. Use ``array.tobytes().decode(enc)`` " -"to obtain a Unicode string from an array of some other type." +"Convert the array to a Unicode string. The array must have a type ``'u'`` " +"or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.tobytes()." +"decode(enc)`` to obtain a Unicode string from an array of some other type." msgstr "" "將陣列轉為一個 Unicode 字串。陣列的型別必須為 ``u``。其他型別的陣列會導致 :" "exc:`ValueError` 錯誤。請使用 ``array.tobytes().decode(enc)`` 來為其他型別的" "陣列轉為 Unicode 字串。" -#: ../../library/array.rst:247 +#: ../../library/array.rst:257 +#, fuzzy msgid "" "The string representation of array objects has the form ``array(typecode, " "initializer)``. The *initializer* is omitted if the array is empty, " -"otherwise it is a Unicode string if the *typecode* is ``'u'``, otherwise it " -"is a list of numbers. The string representation is guaranteed to be able to " -"be converted back to an array with the same type and value using :func:" -"`eval`, so long as the :class:`~array.array` class has been imported using " -"``from array import array``. Variables ``inf`` and ``nan`` must also be " -"defined if it contains corresponding floating-point values. Examples::" +"otherwise it is a Unicode string if the *typecode* is ``'u'`` or ``'w'``, " +"otherwise it is a list of numbers. The string representation is guaranteed " +"to be able to be converted back to an array with the same type and value " +"using :func:`eval`, so long as the :class:`~array.array` class has been " +"imported using ``from array import array``. Variables ``inf`` and ``nan`` " +"must also be defined if it contains corresponding floating-point values. " +"Examples::" msgstr "" "陣列物件的字串表示形式為 ``array(typecode, initializer)``。若為空陣列則參數 " "*initializer* 被省略,若 *typecode* 是 ``'u'`` 將被表示為 Unicode 字串,其他" @@ -483,10 +504,11 @@ msgstr "" "過 ``from array import array`` 的方式引入,便能確保該字串表示能透過 :func:" "`eval` 轉換回一個擁有相同型別及數值的陣列。範例: ::" -#: ../../library/array.rst:259 +#: ../../library/array.rst:269 +#, fuzzy msgid "" "array('l')\n" -"array('u', 'hello \\u2641')\n" +"array('w', 'hello \\u2641')\n" "array('l', [1, 2, 3, 4, 5])\n" "array('d', [1.0, 2.0, 3.14, -inf, nan])" msgstr "" @@ -495,34 +517,32 @@ msgstr "" "array('l', [1, 2, 3, 4, 5])\n" "array('d', [1.0, 2.0, 3.14, -inf, nan])" -#: ../../library/array.rst:267 +#: ../../library/array.rst:277 msgid "Module :mod:`struct`" msgstr ":mod:`struct` 模組" -#: ../../library/array.rst:268 +#: ../../library/array.rst:278 msgid "Packing and unpacking of heterogeneous binary data." msgstr "將包含不同資料類型的二進位資料包裝與解開包裝。" -#: ../../library/array.rst:270 -msgid "Module :mod:`xdrlib`" -msgstr ":mod:`xdrlib` 模組" - -#: ../../library/array.rst:271 -msgid "" -"Packing and unpacking of External Data Representation (XDR) data as used in " -"some remote procedure call systems." -msgstr "" -"將 External Data Representation (XDR) 的資料包裝與解開包裝,這用在一些遠端操" -"作的系統 (remote procedure call systems)。" - -#: ../../library/array.rst:274 +#: ../../library/array.rst:280 msgid "`NumPy `_" msgstr "`NumPy `_" -#: ../../library/array.rst:275 +#: ../../library/array.rst:281 msgid "The NumPy package defines another array type." msgstr "NumPy 套件定義了另一個陣列型別" #: ../../library/array.rst:7 msgid "arrays" msgstr "arrays(陣列)" + +#~ msgid "Module :mod:`xdrlib`" +#~ msgstr ":mod:`xdrlib` 模組" + +#~ msgid "" +#~ "Packing and unpacking of External Data Representation (XDR) data as used " +#~ "in some remote procedure call systems." +#~ msgstr "" +#~ "將 External Data Representation (XDR) 的資料包裝與解開包裝,這用在一些遠端" +#~ "操作的系統 (remote procedure call systems)。" diff --git a/library/ast.po b/library/ast.po index ab82cd210a..4a81075034 100644 --- a/library/ast.po +++ b/library/ast.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -224,9 +224,9 @@ msgid "" "\n" " type_ignore = TypeIgnore(int lineno, string tag)\n" "\n" -" type_param = TypeVar(identifier name, expr? bound)\n" -" | ParamSpec(identifier name)\n" -" | TypeVarTuple(identifier name)\n" +" type_param = TypeVar(identifier name, expr? bound, expr? default_value)\n" +" | ParamSpec(identifier name, expr? default_value)\n" +" | TypeVarTuple(identifier name, expr? default_value)\n" " attributes (int lineno, int col_offset, int end_lineno, int " "end_col_offset)\n" "}\n" @@ -264,8 +264,9 @@ msgstr "" "有特定建構函式節點的實例會被建立。" #: ../../library/ast.rst:64 +#, fuzzy msgid "" -"Each concrete class has an attribute :attr:`_fields` which gives the names " +"Each concrete class has an attribute :attr:`!_fields` which gives the names " "of all child nodes." msgstr "每個具體類別都有一個屬性 :attr:`_fields`,它會給出所有子節點的名稱。" @@ -290,8 +291,21 @@ msgstr "" "可以有零個或多個值(用星號標記),則這些值將表示為 Python 串列。使用 :func:" "`compile` 編譯 AST 時,所有可能的屬性都必須存在並且具有有效值。" +#: ../../library/ast.rst:79 +msgid "" +"The :attr:`!_field_types` attribute on each concrete class is a dictionary " +"mapping field names (as also listed in :attr:`_fields`) to their types." +msgstr "" + #: ../../library/ast.rst:82 msgid "" +">>> ast.TypeVar._field_types\n" +"{'name': , 'bound': ast.expr | None, 'default_value': ast.expr " +"| None}" +msgstr "" + +#: ../../library/ast.rst:94 +msgid "" "Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses have :attr:" "`lineno`, :attr:`col_offset`, :attr:`end_lineno`, and :attr:`end_col_offset` " "attributes. The :attr:`lineno` and :attr:`end_lineno` are the first and " @@ -308,7 +322,7 @@ msgstr "" "`end_col_offset` 是生成節點的第一個和最後一個標記對應的 UTF-8 位元組偏移量。" "會記錄 UTF-8 偏移量是因為剖析器 (parser) 內部使用 UTF-8。" -#: ../../library/ast.rst:91 +#: ../../library/ast.rst:103 msgid "" "Note that the end positions are not required by the compiler and are " "therefore optional. The end offset is *after* the last symbol, for example " @@ -319,12 +333,12 @@ msgstr "" "之後*,例如可以使用 ``source_line[node.col_offset : node.end_col_offset]`` 來" "獲取單列運算式節點 (expression node) 的原始片段。" -#: ../../library/ast.rst:96 +#: ../../library/ast.rst:108 msgid "" "The constructor of a class :class:`ast.T` parses its arguments as follows:" msgstr ":class:`ast.T` 類別的建構函式按以下方式剖析其引數:" -#: ../../library/ast.rst:98 +#: ../../library/ast.rst:110 msgid "" "If there are positional arguments, there must be as many as there are items " "in :attr:`T._fields`; they will be assigned as attributes of these names." @@ -332,44 +346,20 @@ msgstr "" "如果有位置引數,則必須與 :attr:`T._fields` 中的項目一樣多;它們將被賦値為這些" "名稱的屬性。" -#: ../../library/ast.rst:100 +#: ../../library/ast.rst:112 msgid "" "If there are keyword arguments, they will set the attributes of the same " "names to the given values." msgstr "如果有關鍵字引數,它們會將相同名稱的屬性設定為給定值。" -#: ../../library/ast.rst:103 +#: ../../library/ast.rst:115 msgid "" "For example, to create and populate an :class:`ast.UnaryOp` node, you could " "use ::" msgstr "" "例如,要建立並填充 (populate) :class:`ast.UnaryOp` 節點,你可以使用: ::" -#: ../../library/ast.rst:106 -msgid "" -"node = ast.UnaryOp()\n" -"node.op = ast.USub()\n" -"node.operand = ast.Constant()\n" -"node.operand.value = 5\n" -"node.operand.lineno = 0\n" -"node.operand.col_offset = 0\n" -"node.lineno = 0\n" -"node.col_offset = 0" -msgstr "" -"node = ast.UnaryOp()\n" -"node.op = ast.USub()\n" -"node.operand = ast.Constant()\n" -"node.operand.value = 5\n" -"node.operand.lineno = 0\n" -"node.operand.col_offset = 0\n" -"node.lineno = 0\n" -"node.col_offset = 0" - -#: ../../library/ast.rst:115 -msgid "or the more compact ::" -msgstr "或更簡潔的: ::" - -#: ../../library/ast.rst:117 +#: ../../library/ast.rst:118 msgid "" "node = ast.UnaryOp(ast.USub(), ast.Constant(5, lineno=0, col_offset=0),\n" " lineno=0, col_offset=0)" @@ -377,17 +367,27 @@ msgstr "" "node = ast.UnaryOp(ast.USub(), ast.Constant(5, lineno=0, col_offset=0),\n" " lineno=0, col_offset=0)" -#: ../../library/ast.rst:122 +#: ../../library/ast.rst:121 +msgid "" +"If a field that is optional in the grammar is omitted from the constructor, " +"it defaults to ``None``. If a list field is omitted, it defaults to the " +"empty list. If a field of type :class:`!ast.expr_context` is omitted, it " +"defaults to :class:`Load() `. If any other field is omitted, a :" +"exc:`DeprecationWarning` is raised and the AST node will not have this " +"field. In Python 3.15, this condition will raise an error." +msgstr "" + +#: ../../library/ast.rst:130 msgid "Class :class:`ast.Constant` is now used for all constants." msgstr ":class:`ast.Constant` 類別現在用於所有常數。" -#: ../../library/ast.rst:126 +#: ../../library/ast.rst:134 msgid "" "Simple indices are represented by their value, extended slices are " "represented as tuples." msgstr "以它們的值表示簡單索引,擴充切片 (slice) 則以元組 (tuple) 表示。" -#: ../../library/ast.rst:131 +#: ../../library/ast.rst:139 msgid "" "Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!ast.Bytes`, :" "class:`!ast.NameConstant` and :class:`!ast.Ellipsis` are still available, " @@ -398,7 +398,7 @@ msgstr "" "ast.NameConstant` 和 :class:`!ast.Ellipsis` 仍然可用,但它們將在未來的 " "Python 釋出版本中移除。與此同時,實例化它們將回傳不同類別的實例。" -#: ../../library/ast.rst:138 +#: ../../library/ast.rst:146 msgid "" "Old classes :class:`!ast.Index` and :class:`!ast.ExtSlice` are still " "available, but they will be removed in future Python releases. In the " @@ -407,7 +407,16 @@ msgstr "" "舊的類別 :class:`!ast.Index` 和 :class:`!ast.ExtSlice` 仍然可用,但它們將在未" "來的 Python 版本中刪除。同時,實例化它們會回傳不同類別的實例。" -#: ../../library/ast.rst:144 +#: ../../library/ast.rst:153 +msgid "" +"Previous versions of Python allowed the creation of AST nodes that were " +"missing required fields. Similarly, AST node constructors allowed arbitrary " +"keyword arguments that were set as attributes of the AST node, even if they " +"did not match any of the fields of the AST node. This behavior is deprecated " +"and will be removed in Python 3.15." +msgstr "" + +#: ../../library/ast.rst:160 msgid "" "The descriptions of the specific node classes displayed here were initially " "adapted from the fantastic `Green Tree Snakes `__ 專案和所有貢獻者那裡改編而來" "的。" -#: ../../library/ast.rst:153 +#: ../../library/ast.rst:169 msgid "Root nodes" msgstr "根節點" -#: ../../library/ast.rst:157 +#: ../../library/ast.rst:173 msgid "" "A Python module, as with :ref:`file input `. Node type generated " "by :func:`ast.parse` in the default ``\"exec\"`` *mode*." @@ -429,11 +438,11 @@ msgstr "" "一個 Python 模組,與\\ :ref:`檔案輸入 ` 一樣。由 :func:`ast." "parse` 在預設的 ``\"exec\"`` *mode* 下生成的節點型別。" -#: ../../library/ast.rst:160 +#: ../../library/ast.rst:176 msgid "*body* is a :class:`list` of the module's :ref:`ast-statements`." msgstr "*body* 是模組的\\ :ref:`ast-statements` 的一個 :class:`list`。" -#: ../../library/ast.rst:162 +#: ../../library/ast.rst:178 msgid "" "*type_ignores* is a :class:`list` of the module's type ignore comments; see :" "func:`ast.parse` for more details." @@ -441,7 +450,8 @@ msgstr "" "*type_ignores* 是模組的忽略型別註解的 :class:`list`;有關更多詳細資訊,請參" "閱 :func:`ast.parse`。" -#: ../../library/ast.rst:165 +#: ../../library/ast.rst:181 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('x = 1'), indent=4))\n" "Module(\n" @@ -449,8 +459,7 @@ msgid "" " Assign(\n" " targets=[\n" " Name(id='x', ctx=Store())],\n" -" value=Constant(value=1))],\n" -" type_ignores=[])" +" value=Constant(value=1))])" msgstr "" ">>> print(ast.dump(ast.parse('x = 1'), indent=4))\n" "Module(\n" @@ -461,7 +470,7 @@ msgstr "" " value=Constant(value=1))],\n" " type_ignores=[])" -#: ../../library/ast.rst:179 +#: ../../library/ast.rst:194 msgid "" "A single Python :ref:`expression input `. Node type " "generated by :func:`ast.parse` when *mode* is ``\"eval\"``." @@ -469,14 +478,14 @@ msgstr "" "單個 Python :ref:`運算式輸入 `。當 *mode* 是 ``\"eval\"`` " "時節點型別由 :func:`ast.parse` 生成。" -#: ../../library/ast.rst:182 +#: ../../library/ast.rst:197 msgid "" "*body* is a single node, one of the :ref:`expression types `." msgstr "" "*body* 是單個節點,是\\ :ref:`運算式型別 `\\ 的其中之一。" -#: ../../library/ast.rst:185 ../../library/ast.rst:255 +#: ../../library/ast.rst:200 ../../library/ast.rst:270 msgid "" ">>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))\n" "Expression(\n" @@ -486,7 +495,7 @@ msgstr "" "Expression(\n" " body=Constant(value=123))" -#: ../../library/ast.rst:194 +#: ../../library/ast.rst:209 msgid "" "A single :ref:`interactive input `, like in :ref:`tut-interac`. " "Node type generated by :func:`ast.parse` when *mode* is ``\"single\"``." @@ -494,13 +503,13 @@ msgstr "" "單個\\ :ref:`互動式輸入 `,和\\ :ref:`tut-interac`\\ 中所述的相" "似。當 *mode* 是 ``\"single\"`` 時節點型別由 :func:`ast.parse` 生成。" -#: ../../library/ast.rst:197 +#: ../../library/ast.rst:212 msgid "*body* is a :class:`list` of :ref:`statement nodes `." msgstr "" "*body* 是\\ :ref:`陳述式節點 (statement nodes) ` 的 :class:" "`list`。" -#: ../../library/ast.rst:199 +#: ../../library/ast.rst:214 msgid "" ">>> print(ast.dump(ast.parse('x = 1; y = 2', mode='single'), indent=4))\n" "Interactive(\n" @@ -526,7 +535,7 @@ msgstr "" " Name(id='y', ctx=Store())],\n" " value=Constant(value=2))])" -#: ../../library/ast.rst:216 +#: ../../library/ast.rst:231 msgid "" "A representation of an old-style type comments for functions, as Python " "versions prior to 3.5 didn't support :pep:`484` annotations. Node type " @@ -535,11 +544,11 @@ msgstr "" "函式的舊式型別註解的表示法,因為 3.5 之前的 Python 版本不支援 :pep:`484` 註" "釋。當 *mode* 是 ``\"func_type\"`` 時節點型別由 :func:`ast.parse` 生成。" -#: ../../library/ast.rst:220 +#: ../../library/ast.rst:235 msgid "Such type comments would look like this::" msgstr "這種型別的註解看起來像這樣: ::" -#: ../../library/ast.rst:222 +#: ../../library/ast.rst:237 msgid "" "def sum_two_number(a, b):\n" " # type: (int, int) -> int\n" @@ -549,17 +558,17 @@ msgstr "" " # type: (int, int) -> int\n" " return a + b" -#: ../../library/ast.rst:226 +#: ../../library/ast.rst:241 msgid "" "*argtypes* is a :class:`list` of :ref:`expression nodes `." msgstr "" "*argtypes* 是\\ :ref:`運算式節點 `\\ 的 :class:`list`。" -#: ../../library/ast.rst:228 +#: ../../library/ast.rst:243 msgid "*returns* is a single :ref:`expression node `." msgstr "*returns* 是單個\\ :ref:`運算式節點 `。" -#: ../../library/ast.rst:230 +#: ../../library/ast.rst:245 msgid "" ">>> print(ast.dump(ast.parse('(int, str) -> List[int]', mode='func_type'), " "indent=4))\n" @@ -583,11 +592,11 @@ msgstr "" " slice=Name(id='int', ctx=Load()),\n" " ctx=Load()))" -#: ../../library/ast.rst:246 +#: ../../library/ast.rst:261 msgid "Literals" msgstr "文本 (Literals)" -#: ../../library/ast.rst:250 +#: ../../library/ast.rst:265 msgid "" "A constant value. The ``value`` attribute of the ``Constant`` literal " "contains the Python object it represents. The values represented can be " @@ -599,7 +608,7 @@ msgstr "" "示的值可以是簡單型別,例如數字、字串或 ``None``,但如果它們的所有元素都是常" "數,也可以是不可變的 (immutable) 容器型別(元組和凍結集合 (frozensets))。" -#: ../../library/ast.rst:264 +#: ../../library/ast.rst:279 msgid "" "Node representing a single formatting field in an f-string. If the string " "contains a single formatting field and nothing else the node can be isolated " @@ -609,33 +618,33 @@ msgstr "" "沒有其他內容,則可以隔離 (isolate) 該節點,否則它將出現在 :class:`JoinedStr` " "中。" -#: ../../library/ast.rst:268 +#: ../../library/ast.rst:283 msgid "" "``value`` is any expression node (such as a literal, a variable, or a " "function call)." msgstr "``value`` 為任何運算式節點(例如文字、變數或函式呼叫)。" -#: ../../library/ast.rst:270 +#: ../../library/ast.rst:285 msgid "``conversion`` is an integer:" msgstr "``conversion`` 是一個整數:" -#: ../../library/ast.rst:272 +#: ../../library/ast.rst:287 msgid "-1: no formatting" msgstr "-1: 無格式化" -#: ../../library/ast.rst:273 +#: ../../library/ast.rst:288 msgid "115: ``!s`` string formatting" msgstr "115: ``!s`` 字串格式化" -#: ../../library/ast.rst:274 +#: ../../library/ast.rst:289 msgid "114: ``!r`` repr formatting" msgstr "114:``!r`` 重複格式化化" -#: ../../library/ast.rst:275 +#: ../../library/ast.rst:290 msgid "97: ``!a`` ascii formatting" msgstr "97: ``!a`` ascii 格式化" -#: ../../library/ast.rst:277 +#: ../../library/ast.rst:292 msgid "" "``format_spec`` is a :class:`JoinedStr` node representing the formatting of " "the value, or ``None`` if no format was specified. Both ``conversion`` and " @@ -644,14 +653,15 @@ msgstr "" "``format_spec`` 是一個 :class:`JoinedStr` 節點,表示值的格式,若未指定格式則" "為 ``None``。``conversion`` 和 ``format_spec`` 可以同時設定。" -#: ../../library/ast.rst:284 +#: ../../library/ast.rst:299 msgid "" "An f-string, comprising a series of :class:`FormattedValue` and :class:" "`Constant` nodes." msgstr "" "一個 f 字串,包含一系列 :class:`FormattedValue` 和 :class:`Constant` 節點。" -#: ../../library/ast.rst:287 +#: ../../library/ast.rst:302 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('f\"sin({a}) is {sin(a):.3}\"', mode='eval'), " "indent=4))\n" @@ -667,8 +677,7 @@ msgid "" " value=Call(\n" " func=Name(id='sin', ctx=Load()),\n" " args=[\n" -" Name(id='a', ctx=Load())],\n" -" keywords=[]),\n" +" Name(id='a', ctx=Load())]),\n" " conversion=-1,\n" " format_spec=JoinedStr(\n" " values=[\n" @@ -695,7 +704,7 @@ msgstr "" " values=[\n" " Constant(value='.3')]))]))" -#: ../../library/ast.rst:313 +#: ../../library/ast.rst:327 msgid "" "A list or tuple. ``elts`` holds a list of nodes representing the elements. " "``ctx`` is :class:`Store` if the container is an assignment target (i.e. " @@ -704,7 +713,7 @@ msgstr "" "串列或元組。``elts`` 保存表示元素的節點串列。如果容器是賦值目標(即 ``(x," "y)=something`` ),則 ``ctx`` 是 :class:`Store`,否則是 :class:`Load`。" -#: ../../library/ast.rst:317 +#: ../../library/ast.rst:331 msgid "" ">>> print(ast.dump(ast.parse('[1, 2, 3]', mode='eval'), indent=4))\n" "Expression(\n" @@ -740,11 +749,11 @@ msgstr "" " Constant(value=3)],\n" " ctx=Load()))" -#: ../../library/ast.rst:339 +#: ../../library/ast.rst:353 msgid "A set. ``elts`` holds a list of nodes representing the set's elements." msgstr "一個集合。``elts`` 保存表示集合之元素的節點串列。" -#: ../../library/ast.rst:341 +#: ../../library/ast.rst:355 msgid "" ">>> print(ast.dump(ast.parse('{1, 2, 3}', mode='eval'), indent=4))\n" "Expression(\n" @@ -762,7 +771,7 @@ msgstr "" " Constant(value=2),\n" " Constant(value=3)]))" -#: ../../library/ast.rst:354 +#: ../../library/ast.rst:368 msgid "" "A dictionary. ``keys`` and ``values`` hold lists of nodes representing the " "keys and the values respectively, in matching order (what would be returned " @@ -772,7 +781,7 @@ msgstr "" "節點串列(為呼叫 :code:`dictionary.keys()` 和 :code:`dictionary.values()` 時" "將回傳的內容)。" -#: ../../library/ast.rst:358 +#: ../../library/ast.rst:372 msgid "" "When doing dictionary unpacking using dictionary literals the expression to " "be expanded goes in the ``values`` list, with a ``None`` at the " @@ -781,7 +790,7 @@ msgstr "" "當使用字典文本進行字典解包 (unpack) 時,要擴充的運算式位於 ``values`` 串列" "中,在 ``keys`` 中的相應位置有一個 ``None``。" -#: ../../library/ast.rst:362 +#: ../../library/ast.rst:376 msgid "" ">>> print(ast.dump(ast.parse('{\"a\":1, **d}', mode='eval'), indent=4))\n" "Expression(\n" @@ -803,17 +812,17 @@ msgstr "" " Constant(value=1),\n" " Name(id='d', ctx=Load())]))" -#: ../../library/ast.rst:376 +#: ../../library/ast.rst:390 msgid "Variables" msgstr "變數" -#: ../../library/ast.rst:380 +#: ../../library/ast.rst:394 msgid "" "A variable name. ``id`` holds the name as a string, and ``ctx`` is one of " "the following types." msgstr "一個變數名稱。``id`` 將名稱以字串形式保存,且 ``ctx`` 是以下型別之一。" -#: ../../library/ast.rst:388 +#: ../../library/ast.rst:402 msgid "" "Variable references can be used to load the value of a variable, to assign a " "new value to it, or to delete it. Variable references are given a context to " @@ -822,14 +831,14 @@ msgstr "" "變數參照可用於載入變數的值、為其分配新值或刪除它。變數參照被賦予情境 " "(context) 來區分這些情況。" -#: ../../library/ast.rst:392 +#: ../../library/ast.rst:406 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('a'), indent=4))\n" "Module(\n" " body=[\n" " Expr(\n" -" value=Name(id='a', ctx=Load()))],\n" -" type_ignores=[])\n" +" value=Name(id='a', ctx=Load()))])\n" "\n" ">>> print(ast.dump(ast.parse('a = 1'), indent=4))\n" "Module(\n" @@ -837,16 +846,14 @@ msgid "" " Assign(\n" " targets=[\n" " Name(id='a', ctx=Store())],\n" -" value=Constant(value=1))],\n" -" type_ignores=[])\n" +" value=Constant(value=1))])\n" "\n" ">>> print(ast.dump(ast.parse('del a'), indent=4))\n" "Module(\n" " body=[\n" " Delete(\n" " targets=[\n" -" Name(id='a', ctx=Del())])],\n" -" type_ignores=[])" +" Name(id='a', ctx=Del())])])" msgstr "" ">>> print(ast.dump(ast.parse('a'), indent=4))\n" "Module(\n" @@ -872,7 +879,7 @@ msgstr "" " Name(id='a', ctx=Del())])],\n" " type_ignores=[])" -#: ../../library/ast.rst:421 +#: ../../library/ast.rst:432 msgid "" "A ``*var`` variable reference. ``value`` holds the variable, typically a :" "class:`Name` node. This type must be used when building a :class:`Call` node " @@ -881,7 +888,8 @@ msgstr "" "一個 ``*var`` 變數參照。``value`` 保存變數,通常是一個 :class:`Name` 節點。在" "使用 ``*args`` 建置 :class:`Call` 節點時必須使用此型別。" -#: ../../library/ast.rst:425 +#: ../../library/ast.rst:436 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('a, *b = it'), indent=4))\n" "Module(\n" @@ -895,8 +903,7 @@ msgid "" " value=Name(id='b', ctx=Store()),\n" " ctx=Store())],\n" " ctx=Store())],\n" -" value=Name(id='it', ctx=Load()))],\n" -" type_ignores=[])" +" value=Name(id='it', ctx=Load()))])" msgstr "" ">>> print(ast.dump(ast.parse('a, *b = it'), indent=4))\n" "Module(\n" @@ -913,11 +920,11 @@ msgstr "" " value=Name(id='it', ctx=Load()))],\n" " type_ignores=[])" -#: ../../library/ast.rst:446 +#: ../../library/ast.rst:456 msgid "Expressions" msgstr "運算式" -#: ../../library/ast.rst:450 +#: ../../library/ast.rst:460 msgid "" "When an expression, such as a function call, appears as a statement by " "itself with its return value not used or stored, it is wrapped in this " @@ -930,7 +937,8 @@ msgstr "" "`Constant`、:class:`Name`、:class:`Lambda`、:class:`Yield` 或 :class:" "`YieldFrom`" -#: ../../library/ast.rst:455 +#: ../../library/ast.rst:465 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('-a'), indent=4))\n" "Module(\n" @@ -938,8 +946,7 @@ msgid "" " Expr(\n" " value=UnaryOp(\n" " op=USub(),\n" -" operand=Name(id='a', ctx=Load())))],\n" -" type_ignores=[])" +" operand=Name(id='a', ctx=Load())))])" msgstr "" ">>> print(ast.dump(ast.parse('-a'), indent=4))\n" "Module(\n" @@ -950,14 +957,14 @@ msgstr "" " operand=Name(id='a', ctx=Load())))],\n" " type_ignores=[])" -#: ../../library/ast.rst:469 +#: ../../library/ast.rst:478 msgid "" "A unary operation. ``op`` is the operator, and ``operand`` any expression " "node." msgstr "" "一元運算 (unary operation)。``op`` 是運算子,``operand`` 是任何運算式節點。" -#: ../../library/ast.rst:478 +#: ../../library/ast.rst:487 msgid "" "Unary operator tokens. :class:`Not` is the ``not`` keyword, :class:`Invert` " "is the ``~`` operator." @@ -965,7 +972,7 @@ msgstr "" "一元運算子標記。 :class:`Not` 是 ``not`` 關鍵字、:class:`Invert` 是 ``~`` 運" "算子。" -#: ../../library/ast.rst:481 +#: ../../library/ast.rst:490 msgid "" ">>> print(ast.dump(ast.parse('not x', mode='eval'), indent=4))\n" "Expression(\n" @@ -979,7 +986,7 @@ msgstr "" " op=Not(),\n" " operand=Name(id='x', ctx=Load())))" -#: ../../library/ast.rst:492 +#: ../../library/ast.rst:501 msgid "" "A binary operation (like addition or division). ``op`` is the operator, and " "``left`` and ``right`` are any expression nodes." @@ -987,7 +994,7 @@ msgstr "" "二元運算 (binary operation)(如加法或除法)。 ``op`` 是運算子、``left`` 和 " "``right`` 是任意運算式節點。" -#: ../../library/ast.rst:495 +#: ../../library/ast.rst:504 msgid "" ">>> print(ast.dump(ast.parse('x + y', mode='eval'), indent=4))\n" "Expression(\n" @@ -1003,11 +1010,11 @@ msgstr "" " op=Add(),\n" " right=Name(id='y', ctx=Load())))" -#: ../../library/ast.rst:519 +#: ../../library/ast.rst:528 msgid "Binary operator tokens." msgstr "二元運算子 token。" -#: ../../library/ast.rst:524 +#: ../../library/ast.rst:533 msgid "" "A boolean operation, 'or' or 'and'. ``op`` is :class:`Or` or :class:`And`. " "``values`` are the values involved. Consecutive operations with the same " @@ -1018,11 +1025,11 @@ msgstr "" "有所涉及的值。使用同一運算子的連續操作(例如 ``a or b or c``\\ )會被折疊為具" "有多個值的一個節點。" -#: ../../library/ast.rst:529 +#: ../../library/ast.rst:538 msgid "This doesn't include ``not``, which is a :class:`UnaryOp`." msgstr "這不包括 ``not``,它是一個 :class:`UnaryOp`。" -#: ../../library/ast.rst:531 +#: ../../library/ast.rst:540 msgid "" ">>> print(ast.dump(ast.parse('x or y', mode='eval'), indent=4))\n" "Expression(\n" @@ -1040,11 +1047,11 @@ msgstr "" " Name(id='x', ctx=Load()),\n" " Name(id='y', ctx=Load())]))" -#: ../../library/ast.rst:545 +#: ../../library/ast.rst:554 msgid "Boolean operator tokens." msgstr "布林運算子 token。" -#: ../../library/ast.rst:550 +#: ../../library/ast.rst:559 msgid "" "A comparison of two or more values. ``left`` is the first value in the " "comparison, ``ops`` the list of operators, and ``comparators`` the list of " @@ -1053,7 +1060,7 @@ msgstr "" "兩個或多個值的比較。``left`` 是比較中的第一個值、``ops`` 是運算子串列、" "``comparators`` 是要比較的第一個元素之後值的串列。" -#: ../../library/ast.rst:554 +#: ../../library/ast.rst:563 msgid "" ">>> print(ast.dump(ast.parse('1 <= a < 10', mode='eval'), indent=4))\n" "Expression(\n" @@ -1077,11 +1084,11 @@ msgstr "" " Name(id='a', ctx=Load()),\n" " Constant(value=10)]))" -#: ../../library/ast.rst:579 +#: ../../library/ast.rst:588 msgid "Comparison operator tokens." msgstr "比較運算子 token。" -#: ../../library/ast.rst:584 +#: ../../library/ast.rst:593 msgid "" "A function call. ``func`` is the function, which will often be a :class:" "`Name` or :class:`Attribute` object. Of the arguments:" @@ -1089,25 +1096,26 @@ msgstr "" "一個函式呼叫。``func`` 是該函式,通常是一個 :class:`Name` 或 :class:" "`Attribute` 物件。而在引數中:" -#: ../../library/ast.rst:587 +#: ../../library/ast.rst:596 msgid "``args`` holds a list of the arguments passed by position." msgstr "``args`` 保存按位置傳遞的引數串列。" -#: ../../library/ast.rst:588 +#: ../../library/ast.rst:597 msgid "" "``keywords`` holds a list of :class:`.keyword` objects representing " "arguments passed by keyword." msgstr "" "``keywords`` 保存一個 :class:`.keyword` 物件串列,表示透過關鍵字傳遞的引數。" -#: ../../library/ast.rst:591 +#: ../../library/ast.rst:600 +#, fuzzy msgid "" -"When creating a ``Call`` node, ``args`` and ``keywords`` are required, but " -"they can be empty lists." +"The ``args`` and ``keywords`` arguments are optional and default to empty " +"lists." msgstr "" "建立 ``Call`` 節點時會需要 ``args`` 和 ``keywords``,但它們可以是空串列。" -#: ../../library/ast.rst:594 +#: ../../library/ast.rst:602 msgid "" ">>> print(ast.dump(ast.parse('func(a, b=c, *d, **e)', mode='eval'), " "indent=4))\n" @@ -1143,7 +1151,7 @@ msgstr "" " keyword(\n" " value=Name(id='e', ctx=Load()))]))" -#: ../../library/ast.rst:615 +#: ../../library/ast.rst:623 msgid "" "A keyword argument to a function call or class definition. ``arg`` is a raw " "string of the parameter name, ``value`` is a node to pass in." @@ -1151,7 +1159,7 @@ msgstr "" "函式呼叫或類別定義的關鍵字引數。``arg`` 是參數名稱的原始字串,``value`` 是要" "傳入的節點。" -#: ../../library/ast.rst:621 +#: ../../library/ast.rst:629 msgid "" "An expression such as ``a if b else c``. Each field holds a single node, so " "in the following example, all three are :class:`Name` nodes." @@ -1159,7 +1167,7 @@ msgstr "" "像是 ``a if b else c`` 之類的運算式。每個欄位都保存一個節點,因此在以下範例" "中,所有三個都是 :class:`Name` 節點。" -#: ../../library/ast.rst:624 +#: ../../library/ast.rst:632 msgid "" ">>> print(ast.dump(ast.parse('a if b else c', mode='eval'), indent=4))\n" "Expression(\n" @@ -1175,7 +1183,7 @@ msgstr "" " body=Name(id='a', ctx=Load()),\n" " orelse=Name(id='c', ctx=Load())))" -#: ../../library/ast.rst:636 +#: ../../library/ast.rst:644 msgid "" "Attribute access, e.g. ``d.keys``. ``value`` is a node, typically a :class:" "`Name`. ``attr`` is a bare string giving the name of the attribute, and " @@ -1186,7 +1194,7 @@ msgstr "" "``attr`` 是一個屬性名稱的字串,``ctx`` 根據屬性的作用方式可能是 :class:" "`Load`、:class:`Store` 或 :class:`Del`。" -#: ../../library/ast.rst:641 +#: ../../library/ast.rst:649 msgid "" ">>> print(ast.dump(ast.parse('snake.colour', mode='eval'), indent=4))\n" "Expression(\n" @@ -1202,7 +1210,7 @@ msgstr "" " attr='colour',\n" " ctx=Load()))" -#: ../../library/ast.rst:653 +#: ../../library/ast.rst:661 msgid "" "A named expression. This AST node is produced by the assignment expressions " "operator (also known as the walrus operator). As opposed to the :class:" @@ -1213,7 +1221,7 @@ msgstr "" "運算子)產生。相對於 :class:`Assign` 節點之第一個引數可為多個節點,在這種情況" "下 ``target`` 和 ``value`` 都必須是單個節點。" -#: ../../library/ast.rst:658 +#: ../../library/ast.rst:666 msgid "" ">>> print(ast.dump(ast.parse('(x := 4)', mode='eval'), indent=4))\n" "Expression(\n" @@ -1227,11 +1235,11 @@ msgstr "" " target=Name(id='x', ctx=Store()),\n" " value=Constant(value=4)))" -#: ../../library/ast.rst:669 +#: ../../library/ast.rst:677 msgid "Subscripting" msgstr "下標 (Subscripting)" -#: ../../library/ast.rst:673 +#: ../../library/ast.rst:681 msgid "" "A subscript, such as ``l[1]``. ``value`` is the subscripted object (usually " "sequence or mapping). ``slice`` is an index, slice or key. It can be a :" @@ -1243,7 +1251,7 @@ msgstr "" "下標執行的操作不同,``ctx`` 可以是 :class:`Load`、:class:`Store` 或 :class:" "`Del`。" -#: ../../library/ast.rst:679 +#: ../../library/ast.rst:687 msgid "" ">>> print(ast.dump(ast.parse('l[1:2, 3]', mode='eval'), indent=4))\n" "Expression(\n" @@ -1271,7 +1279,7 @@ msgstr "" " ctx=Load()),\n" " ctx=Load()))" -#: ../../library/ast.rst:697 +#: ../../library/ast.rst:705 msgid "" "Regular slicing (on the form ``lower:upper`` or ``lower:upper:step``). Can " "occur only inside the *slice* field of :class:`Subscript`, either directly " @@ -1280,7 +1288,7 @@ msgstr "" "常規切片(形式為 ``lower:upper`` 或 ``lower:upper:step``\\ )。只能直接或者或" "者作為 :class:`Tuple` 的元素出現在 :class:`Subscript` 的 *slice* 欄位內。" -#: ../../library/ast.rst:701 +#: ../../library/ast.rst:709 msgid "" ">>> print(ast.dump(ast.parse('l[1:2]', mode='eval'), indent=4))\n" "Expression(\n" @@ -1300,11 +1308,11 @@ msgstr "" " upper=Constant(value=2)),\n" " ctx=Load()))" -#: ../../library/ast.rst:714 +#: ../../library/ast.rst:722 msgid "Comprehensions" msgstr "綜合運算式 (comprehensions)" -#: ../../library/ast.rst:721 +#: ../../library/ast.rst:729 msgid "" "List and set comprehensions, generator expressions, and dictionary " "comprehensions. ``elt`` (or ``key`` and ``value``) is a single node " @@ -1313,14 +1321,17 @@ msgstr "" "串列和集合綜合運算、生成器運算式和字典綜合運算。``elt``\\ (或 ``key`` 和 " "``value``\\ )是單個節點,表示各個項目會被求值 (evaluate) 的部分。" -#: ../../library/ast.rst:725 +#: ../../library/ast.rst:733 msgid "``generators`` is a list of :class:`comprehension` nodes." msgstr "``generators`` 是一個 :class:`comprehension` 節點的串列。" -#: ../../library/ast.rst:727 +#: ../../library/ast.rst:735 +#, fuzzy msgid "" -">>> print(ast.dump(ast.parse('[x for x in numbers]', mode='eval'), " -"indent=4))\n" +">>> print(ast.dump(\n" +"... ast.parse('[x for x in numbers]', mode='eval'),\n" +"... indent=4,\n" +"... ))\n" "Expression(\n" " body=ListComp(\n" " elt=Name(id='x', ctx=Load()),\n" @@ -1328,10 +1339,11 @@ msgid "" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" " is_async=0)]))\n" -">>> print(ast.dump(ast.parse('{x: x**2 for x in numbers}', mode='eval'), " -"indent=4))\n" +">>> print(ast.dump(\n" +"... ast.parse('{x: x**2 for x in numbers}', mode='eval'),\n" +"... indent=4,\n" +"... ))\n" "Expression(\n" " body=DictComp(\n" " key=Name(id='x', ctx=Load()),\n" @@ -1343,10 +1355,11 @@ msgid "" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" " is_async=0)]))\n" -">>> print(ast.dump(ast.parse('{x for x in numbers}', mode='eval'), " -"indent=4))\n" +">>> print(ast.dump(\n" +"... ast.parse('{x for x in numbers}', mode='eval'),\n" +"... indent=4,\n" +"... ))\n" "Expression(\n" " body=SetComp(\n" " elt=Name(id='x', ctx=Load()),\n" @@ -1354,7 +1367,6 @@ msgid "" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" " is_async=0)]))" msgstr "" ">>> print(ast.dump(ast.parse('[x for x in numbers]', mode='eval'), " @@ -1395,7 +1407,7 @@ msgstr "" " ifs=[],\n" " is_async=0)]))" -#: ../../library/ast.rst:767 +#: ../../library/ast.rst:781 msgid "" "One ``for`` clause in a comprehension. ``target`` is the reference to use " "for each element - typically a :class:`Name` or :class:`Tuple` node. " @@ -1406,7 +1418,7 @@ msgstr "" "class:`Name` 或 :class:`Tuple` 節點。``iter`` 是要疊代的物件。``ifs`` 是測試" "運算式的串列:每個 ``for`` 子句可以有多個 ``ifs``。" -#: ../../library/ast.rst:772 +#: ../../library/ast.rst:786 msgid "" "``is_async`` indicates a comprehension is asynchronous (using an ``async " "for`` instead of ``for``). The value is an integer (0 or 1)." @@ -1414,7 +1426,8 @@ msgstr "" "``is_async`` 表示綜合運算式是非同步的(使用 ``async for`` 而不是 ``for`` )。" "該值為整數(0 或 1)。" -#: ../../library/ast.rst:775 +#: ../../library/ast.rst:789 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('[ord(c) for line in file for c in line]', " "mode='eval'),\n" @@ -1424,18 +1437,15 @@ msgid "" " elt=Call(\n" " func=Name(id='ord', ctx=Load()),\n" " args=[\n" -" Name(id='c', ctx=Load())],\n" -" keywords=[]),\n" +" Name(id='c', ctx=Load())]),\n" " generators=[\n" " comprehension(\n" " target=Name(id='line', ctx=Store()),\n" " iter=Name(id='file', ctx=Load()),\n" -" ifs=[],\n" " is_async=0),\n" " comprehension(\n" " target=Name(id='c', ctx=Store()),\n" " iter=Name(id='line', ctx=Load()),\n" -" ifs=[],\n" " is_async=0)]))\n" "\n" ">>> print(ast.dump(ast.parse('(n**2 for n in it if n>5 if n<10)', " @@ -1475,21 +1485,57 @@ msgid "" " comprehension(\n" " target=Name(id='i', ctx=Store()),\n" " iter=Name(id='soc', ctx=Load()),\n" -" ifs=[],\n" " is_async=1)]))" msgstr "" +">>> print(ast.dump(ast.parse('[x for x in numbers]', mode='eval'), " +"indent=4))\n" +"Expression(\n" +" body=ListComp(\n" +" elt=Name(id='x', ctx=Load()),\n" +" generators=[\n" +" comprehension(\n" +" target=Name(id='x', ctx=Store()),\n" +" iter=Name(id='numbers', ctx=Load()),\n" +" ifs=[],\n" +" is_async=0)]))\n" +">>> print(ast.dump(ast.parse('{x: x**2 for x in numbers}', mode='eval'), " +"indent=4))\n" +"Expression(\n" +" body=DictComp(\n" +" key=Name(id='x', ctx=Load()),\n" +" value=BinOp(\n" +" left=Name(id='x', ctx=Load()),\n" +" op=Pow(),\n" +" right=Constant(value=2)),\n" +" generators=[\n" +" comprehension(\n" +" target=Name(id='x', ctx=Store()),\n" +" iter=Name(id='numbers', ctx=Load()),\n" +" ifs=[],\n" +" is_async=0)]))\n" +">>> print(ast.dump(ast.parse('{x for x in numbers}', mode='eval'), " +"indent=4))\n" +"Expression(\n" +" body=SetComp(\n" +" elt=Name(id='x', ctx=Load()),\n" +" generators=[\n" +" comprehension(\n" +" target=Name(id='x', ctx=Store()),\n" +" iter=Name(id='numbers', ctx=Load()),\n" +" ifs=[],\n" +" is_async=0)]))" -#: ../../library/ast.rst:841 +#: ../../library/ast.rst:851 msgid "Statements" msgstr "陳述式" -#: ../../library/ast.rst:845 +#: ../../library/ast.rst:855 msgid "" "An assignment. ``targets`` is a list of nodes, and ``value`` is a single " "node." msgstr "一個賦值。``targets`` 是節點串列,``value`` 是單個節點。" -#: ../../library/ast.rst:847 +#: ../../library/ast.rst:857 msgid "" "Multiple nodes in ``targets`` represents assigning the same value to each. " "Unpacking is represented by putting a :class:`Tuple` or :class:`List` within " @@ -1498,13 +1544,14 @@ msgstr "" "``targets`` 中的多個節點表示為每個節點分配相同的值。解包是透過在 ``targets`` " "中放置一個 :class:`Tuple` 或 :class:`List` 來表示的。" -#: ../../library/ast.rst:853 ../../library/ast.rst:1165 -#: ../../library/ast.rst:1370 ../../library/ast.rst:1895 +#: ../../library/ast.rst:863 ../../library/ast.rst:1158 +#: ../../library/ast.rst:1352 ../../library/ast.rst:1881 msgid "" "``type_comment`` is an optional string with the type annotation as a comment." msgstr "``type_comment`` 是一個可選字串,其中的註解為型別註釋。" -#: ../../library/ast.rst:855 +#: ../../library/ast.rst:865 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('a = b = 1'), indent=4)) # Multiple assignment\n" "Module(\n" @@ -1513,8 +1560,7 @@ msgid "" " targets=[\n" " Name(id='a', ctx=Store()),\n" " Name(id='b', ctx=Store())],\n" -" value=Constant(value=1))],\n" -" type_ignores=[])\n" +" value=Constant(value=1))])\n" "\n" ">>> print(ast.dump(ast.parse('a,b = c'), indent=4)) # Unpacking\n" "Module(\n" @@ -1526,11 +1572,24 @@ msgid "" " Name(id='a', ctx=Store()),\n" " Name(id='b', ctx=Store())],\n" " ctx=Store())],\n" -" value=Name(id='c', ctx=Load()))],\n" -" type_ignores=[])" +" value=Name(id='c', ctx=Load()))])" msgstr "" +">>> print(ast.dump(ast.parse('a, *b = it'), indent=4))\n" +"Module(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Tuple(\n" +" elts=[\n" +" Name(id='a', ctx=Store()),\n" +" Starred(\n" +" value=Name(id='b', ctx=Store()),\n" +" ctx=Store())],\n" +" ctx=Store())],\n" +" value=Name(id='it', ctx=Load()))],\n" +" type_ignores=[])" -#: ../../library/ast.rst:883 +#: ../../library/ast.rst:891 msgid "" "An assignment with a type annotation. ``target`` is a single node and can be " "a :class:`Name`, an :class:`Attribute` or a :class:`Subscript`. " @@ -1541,7 +1600,7 @@ msgstr "" "`Attribute` 或 :class:`Subscript`。``annotation`` 是註釋,例如 :class:" "`Constant` 或 :class:`Name` 節點。``value`` 是單個可選節點。" -#: ../../library/ast.rst:888 +#: ../../library/ast.rst:896 msgid "" "``simple`` is always either 0 (indicating a \"complex\" target) or 1 " "(indicating a \"simple\" target). A \"simple\" target consists solely of a :" @@ -1554,7 +1613,8 @@ msgstr "" "被視為是複雜的。只有簡單目標會出現在模組和類別的 :attr:`__annotations__` 字典" "中。" -#: ../../library/ast.rst:894 +#: ../../library/ast.rst:902 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('c: int'), indent=4))\n" "Module(\n" @@ -1562,8 +1622,7 @@ msgid "" " AnnAssign(\n" " target=Name(id='c', ctx=Store()),\n" " annotation=Name(id='int', ctx=Load()),\n" -" simple=1)],\n" -" type_ignores=[])\n" +" simple=1)])\n" "\n" ">>> print(ast.dump(ast.parse('(a): int = 1'), indent=4)) # Annotation with " "parenthesis\n" @@ -1573,8 +1632,7 @@ msgid "" " target=Name(id='a', ctx=Store()),\n" " annotation=Name(id='int', ctx=Load()),\n" " value=Constant(value=1),\n" -" simple=0)],\n" -" type_ignores=[])\n" +" simple=0)])\n" "\n" ">>> print(ast.dump(ast.parse('a.b: int'), indent=4)) # Attribute annotation\n" "Module(\n" @@ -1585,8 +1643,7 @@ msgid "" " attr='b',\n" " ctx=Store()),\n" " annotation=Name(id='int', ctx=Load()),\n" -" simple=0)],\n" -" type_ignores=[])\n" +" simple=0)])\n" "\n" ">>> print(ast.dump(ast.parse('a[1]: int'), indent=4)) # Subscript " "annotation\n" @@ -1598,11 +1655,47 @@ msgid "" " slice=Constant(value=1),\n" " ctx=Store()),\n" " annotation=Name(id='int', ctx=Load()),\n" -" simple=0)],\n" -" type_ignores=[])" +" simple=0)])" msgstr "" +">>> print(ast.dump(ast.parse('[x for x in numbers]', mode='eval'), " +"indent=4))\n" +"Expression(\n" +" body=ListComp(\n" +" elt=Name(id='x', ctx=Load()),\n" +" generators=[\n" +" comprehension(\n" +" target=Name(id='x', ctx=Store()),\n" +" iter=Name(id='numbers', ctx=Load()),\n" +" ifs=[],\n" +" is_async=0)]))\n" +">>> print(ast.dump(ast.parse('{x: x**2 for x in numbers}', mode='eval'), " +"indent=4))\n" +"Expression(\n" +" body=DictComp(\n" +" key=Name(id='x', ctx=Load()),\n" +" value=BinOp(\n" +" left=Name(id='x', ctx=Load()),\n" +" op=Pow(),\n" +" right=Constant(value=2)),\n" +" generators=[\n" +" comprehension(\n" +" target=Name(id='x', ctx=Store()),\n" +" iter=Name(id='numbers', ctx=Load()),\n" +" ifs=[],\n" +" is_async=0)]))\n" +">>> print(ast.dump(ast.parse('{x for x in numbers}', mode='eval'), " +"indent=4))\n" +"Expression(\n" +" body=SetComp(\n" +" elt=Name(id='x', ctx=Load()),\n" +" generators=[\n" +" comprehension(\n" +" target=Name(id='x', ctx=Store()),\n" +" iter=Name(id='numbers', ctx=Load()),\n" +" ifs=[],\n" +" is_async=0)]))" -#: ../../library/ast.rst:942 +#: ../../library/ast.rst:946 msgid "" "Augmented assignment, such as ``a += 1``. In the following example, " "``target`` is a :class:`Name` node for ``x`` (with the :class:`Store` " @@ -1613,7 +1706,7 @@ msgstr "" "是 ``x`` 的 :class:`Name` 節點(帶有 :class:`Store` 情境),``op`` 是 :class:" "`Add`,``value`` 是一個值為 1 的 :class:`Constant`。" -#: ../../library/ast.rst:947 +#: ../../library/ast.rst:951 msgid "" "The ``target`` attribute cannot be of class :class:`Tuple` or :class:`List`, " "unlike the targets of :class:`Assign`." @@ -1621,7 +1714,8 @@ msgstr "" "與 :class:`Assign` 的目標不同,``target`` 屬性不能屬於 :class:`Tuple` 或 :" "class:`List` 類別。" -#: ../../library/ast.rst:950 +#: ../../library/ast.rst:954 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('x += 2'), indent=4))\n" "Module(\n" @@ -1629,8 +1723,7 @@ msgid "" " AugAssign(\n" " target=Name(id='x', ctx=Store()),\n" " op=Add(),\n" -" value=Constant(value=2))],\n" -" type_ignores=[])" +" value=Constant(value=2))])" msgstr "" ">>> print(ast.dump(ast.parse('x += 2'), indent=4))\n" "Module(\n" @@ -1641,7 +1734,7 @@ msgstr "" " value=Constant(value=2))],\n" " type_ignores=[])" -#: ../../library/ast.rst:964 +#: ../../library/ast.rst:967 msgid "" "A ``raise`` statement. ``exc`` is the exception object to be raised, " "normally a :class:`Call` or :class:`Name`, or ``None`` for a standalone " @@ -1651,15 +1744,15 @@ msgstr "" "class:`Name`,若是獨立的 ``raise`` 則為 ``None``。``cause`` 是 ``raise x " "from y`` 中的可選部分 ``y``。" -#: ../../library/ast.rst:968 +#: ../../library/ast.rst:971 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('raise x from y'), indent=4))\n" "Module(\n" " body=[\n" " Raise(\n" " exc=Name(id='x', ctx=Load()),\n" -" cause=Name(id='y', ctx=Load()))],\n" -" type_ignores=[])" +" cause=Name(id='y', ctx=Load()))])" msgstr "" ">>> print(ast.dump(ast.parse('raise x from y'), indent=4))\n" "Module(\n" @@ -1669,7 +1762,7 @@ msgstr "" " cause=Name(id='y', ctx=Load()))],\n" " type_ignores=[])" -#: ../../library/ast.rst:981 +#: ../../library/ast.rst:983 msgid "" "An assertion. ``test`` holds the condition, such as a :class:`Compare` node. " "``msg`` holds the failure message." @@ -1677,15 +1770,15 @@ msgstr "" "一個斷言 (assertion)。``test`` 保存條件,例如 :class:`Compare` 節點。``msg`` " "保存失敗訊息。" -#: ../../library/ast.rst:984 +#: ../../library/ast.rst:986 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('assert x,y'), indent=4))\n" "Module(\n" " body=[\n" " Assert(\n" " test=Name(id='x', ctx=Load()),\n" -" msg=Name(id='y', ctx=Load()))],\n" -" type_ignores=[])" +" msg=Name(id='y', ctx=Load()))])" msgstr "" ">>> print(ast.dump(ast.parse('assert x,y'), indent=4))\n" "Module(\n" @@ -1695,7 +1788,7 @@ msgstr "" " msg=Name(id='y', ctx=Load()))],\n" " type_ignores=[])" -#: ../../library/ast.rst:997 +#: ../../library/ast.rst:998 msgid "" "Represents a ``del`` statement. ``targets`` is a list of nodes, such as :" "class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." @@ -1703,7 +1796,8 @@ msgstr "" "代表一個 ``del`` 陳述式。``targets`` 是節點串列,例如 :class:`Name`、:class:" "`Attribute` 或 :class:`Subscript` 節點。" -#: ../../library/ast.rst:1000 +#: ../../library/ast.rst:1001 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('del x,y,z'), indent=4))\n" "Module(\n" @@ -1712,8 +1806,7 @@ msgid "" " targets=[\n" " Name(id='x', ctx=Del()),\n" " Name(id='y', ctx=Del()),\n" -" Name(id='z', ctx=Del())])],\n" -" type_ignores=[])" +" Name(id='z', ctx=Del())])])" msgstr "" ">>> print(ast.dump(ast.parse('del x,y,z'), indent=4))\n" "Module(\n" @@ -1730,12 +1823,12 @@ msgid "A ``pass`` statement." msgstr "一個 ``pass`` 陳述式。" #: ../../library/ast.rst:1017 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('pass'), indent=4))\n" "Module(\n" " body=[\n" -" Pass()],\n" -" type_ignores=[])" +" Pass()])" msgstr "" ">>> print(ast.dump(ast.parse('pass'), indent=4))\n" "Module(\n" @@ -1743,7 +1836,7 @@ msgstr "" " Pass()],\n" " type_ignores=[])" -#: ../../library/ast.rst:1028 +#: ../../library/ast.rst:1027 msgid "" "A :ref:`type alias ` created through the :keyword:`type` " "statement. ``name`` is the name of the alias, ``type_params`` is a list of :" @@ -1754,16 +1847,15 @@ msgstr "" "aliases>`。``name`` 是別名的名稱、``type_params`` 是\\ :ref:`型別參數 (type " "parameter) ` 的串列、``value`` 是型別別名的值。" -#: ../../library/ast.rst:1033 +#: ../../library/ast.rst:1032 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('type Alias = int'), indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" " name=Name(id='Alias', ctx=Store()),\n" -" type_params=[],\n" -" value=Name(id='int', ctx=Load()))],\n" -" type_ignores=[])" +" value=Name(id='int', ctx=Load()))])" msgstr "" ">>> print(ast.dump(ast.parse('type Alias = int'), indent=4))\n" "Module(\n" @@ -1774,21 +1866,22 @@ msgstr "" " value=Name(id='int', ctx=Load()))],\n" " type_ignores=[])" -#: ../../library/ast.rst:1046 +#: ../../library/ast.rst:1043 msgid "" "Other statements which are only applicable inside functions or loops are " "described in other sections." msgstr "其他僅適用於函式或迴圈內部的陳述式將在其他部分中描述。" -#: ../../library/ast.rst:1050 +#: ../../library/ast.rst:1047 msgid "Imports" msgstr "引入 (imports)" -#: ../../library/ast.rst:1054 +#: ../../library/ast.rst:1051 msgid "An import statement. ``names`` is a list of :class:`alias` nodes." msgstr "一個 import 陳述式。``names`` 是 :class:`alias` 節點的串列。" -#: ../../library/ast.rst:1056 +#: ../../library/ast.rst:1053 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('import x,y,z'), indent=4))\n" "Module(\n" @@ -1797,8 +1890,7 @@ msgid "" " names=[\n" " alias(name='x'),\n" " alias(name='y'),\n" -" alias(name='z')])],\n" -" type_ignores=[])" +" alias(name='z')])])" msgstr "" ">>> print(ast.dump(ast.parse('import x,y,z'), indent=4))\n" "Module(\n" @@ -1810,7 +1902,7 @@ msgstr "" " alias(name='z')])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1071 +#: ../../library/ast.rst:1067 msgid "" "Represents ``from x import y``. ``module`` is a raw string of the 'from' " "name, without any leading dots, or ``None`` for statements such as ``from . " @@ -1821,7 +1913,8 @@ msgstr "" "點 (dot),或者對於諸如 ``from . import foo`` 之類的陳述式則為 ``None``。" "``level`` 是一個整數,保存相對引入的級別(0 表示絕對引入)。" -#: ../../library/ast.rst:1076 +#: ../../library/ast.rst:1072 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('from y import x,y,z'), indent=4))\n" "Module(\n" @@ -1832,8 +1925,7 @@ msgid "" " alias(name='x'),\n" " alias(name='y'),\n" " alias(name='z')],\n" -" level=0)],\n" -" type_ignores=[])" +" level=0)])" msgstr "" ">>> print(ast.dump(ast.parse('from y import x,y,z'), indent=4))\n" "Module(\n" @@ -1847,7 +1939,7 @@ msgstr "" " level=0)],\n" " type_ignores=[])" -#: ../../library/ast.rst:1093 +#: ../../library/ast.rst:1088 msgid "" "Both parameters are raw strings of the names. ``asname`` can be ``None`` if " "the regular name is to be used." @@ -1855,7 +1947,8 @@ msgstr "" "這兩個參數都是名稱的原始字串。如果要使用常規名稱,``asname`` 可以為 " "``None``。" -#: ../../library/ast.rst:1096 +#: ../../library/ast.rst:1091 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('from ..foo.bar import a as b, c'), indent=4))\n" "Module(\n" @@ -1865,8 +1958,7 @@ msgid "" " names=[\n" " alias(name='a', asname='b'),\n" " alias(name='c')],\n" -" level=2)],\n" -" type_ignores=[])" +" level=2)])" msgstr "" ">>> print(ast.dump(ast.parse('from ..foo.bar import a as b, c'), indent=4))\n" "Module(\n" @@ -1879,17 +1971,17 @@ msgstr "" " level=2)],\n" " type_ignores=[])" -#: ../../library/ast.rst:1110 +#: ../../library/ast.rst:1104 msgid "Control flow" msgstr "流程控制" -#: ../../library/ast.rst:1113 +#: ../../library/ast.rst:1107 msgid "" "Optional clauses such as ``else`` are stored as an empty list if they're not " "present." msgstr "諸如 ``else`` 之類的可選子句如果不存在,則將被儲存為空串列。" -#: ../../library/ast.rst:1118 +#: ../../library/ast.rst:1112 msgid "" "An ``if`` statement. ``test`` holds a single node, such as a :class:" "`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." @@ -1897,7 +1989,7 @@ msgstr "" "一個 ``if`` 陳述式。``test`` 保存單個節點,例如 :class:`Compare` 節點。" "``body`` 和 ``orelse`` 各自保存一個節點串列。" -#: ../../library/ast.rst:1121 +#: ../../library/ast.rst:1115 msgid "" "``elif`` clauses don't have a special representation in the AST, but rather " "appear as extra :class:`If` nodes within the ``orelse`` section of the " @@ -1906,7 +1998,8 @@ msgstr "" "``elif`` 子句在 AST 中沒有特殊表示,而是在前一個子句的 ``orelse`` 部分中作為" "額外的 :class:`If` 節點出現。" -#: ../../library/ast.rst:1125 +#: ../../library/ast.rst:1119 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... if x:\n" @@ -1931,8 +2024,7 @@ msgid "" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... if x:\n" @@ -1960,7 +2052,7 @@ msgstr "" " value=Constant(value=Ellipsis))])])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1156 +#: ../../library/ast.rst:1149 msgid "" "A ``for`` loop. ``target`` holds the variable(s) the loop assigns to, as a " "single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` or :" @@ -1975,7 +2067,8 @@ msgstr "" "行的節點串列。如果迴圈正常完成,則執行 ``orelse`` 中的內容,而不是透過 " "``break`` 陳述式執行。" -#: ../../library/ast.rst:1167 +#: ../../library/ast.rst:1160 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... for x in y:\n" @@ -1993,8 +2086,7 @@ msgid "" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... for x in y:\n" @@ -2015,13 +2107,14 @@ msgstr "" " value=Constant(value=Ellipsis))])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1191 +#: ../../library/ast.rst:1183 msgid "" "A ``while`` loop. ``test`` holds the condition, such as a :class:`Compare` " "node." msgstr "一個 ``while`` 迴圈。``test`` 保存條件,例如 :class:`Compare` 節點。" -#: ../../library/ast.rst:1194 +#: ../../library/ast.rst:1186 +#, fuzzy msgid "" ">> print(ast.dump(ast.parse(\"\"\"\n" "... while x:\n" @@ -2038,8 +2131,7 @@ msgid "" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])" msgstr "" ">> print(ast.dump(ast.parse(\"\"\"\n" "... while x:\n" @@ -2059,11 +2151,12 @@ msgstr "" " value=Constant(value=Ellipsis))])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1218 +#: ../../library/ast.rst:1209 msgid "The ``break`` and ``continue`` statements." msgstr "``break`` 和 ``continue`` 陳述式。" -#: ../../library/ast.rst:1220 +#: ../../library/ast.rst:1211 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... for a in b:\n" @@ -2089,9 +2182,7 @@ msgid "" " body=[\n" " Break()],\n" " orelse=[\n" -" Continue()])],\n" -" orelse=[])],\n" -" type_ignores=[])" +" Continue()])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... for a in b:\n" @@ -2121,7 +2212,7 @@ msgstr "" " orelse=[])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1253 +#: ../../library/ast.rst:1242 msgid "" "``try`` blocks. All attributes are list of nodes to execute, except for " "``handlers``, which is a list of :class:`ExceptHandler` nodes." @@ -2129,7 +2220,8 @@ msgstr "" "``try`` 區塊。除 ``handlers`` 是 :class:`ExceptHandler` 節點的串列外,其他所" "有屬性都是要執行之節點的串列。" -#: ../../library/ast.rst:1256 +#: ../../library/ast.rst:1245 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -2166,8 +2258,7 @@ msgid "" " value=Constant(value=Ellipsis))],\n" " finalbody=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -2207,7 +2298,7 @@ msgstr "" " value=Constant(value=Ellipsis))])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1299 +#: ../../library/ast.rst:1287 msgid "" "``try`` blocks which are followed by ``except*`` clauses. The attributes are " "the same as for :class:`Try` but the :class:`ExceptHandler` nodes in " @@ -2217,7 +2308,8 @@ msgstr "" "``handlers`` 中的 :class:`ExceptHandler` 節點被直譯 (interpret) 為 " "``except*`` 區塊而不是 ``except``。" -#: ../../library/ast.rst:1303 +#: ../../library/ast.rst:1291 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -2236,10 +2328,7 @@ msgid "" " type=Name(id='Exception', ctx=Load()),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])],\n" -" orelse=[],\n" -" finalbody=[])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -2263,7 +2352,7 @@ msgstr "" " finalbody=[])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1331 +#: ../../library/ast.rst:1316 msgid "" "A single ``except`` clause. ``type`` is the exception type it will match, " "typically a :class:`Name` node (or ``None`` for a catch-all ``except:`` " @@ -2275,7 +2364,8 @@ msgstr "" "``name`` 是用於保存例外的名稱之原始字串,如果子句沒有 ``as foo`` ,則為 " "``None``。``body`` 是節點串列。" -#: ../../library/ast.rst:1336 +#: ../../library/ast.rst:1321 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... try:\n" @@ -2296,10 +2386,7 @@ msgid "" " ExceptHandler(\n" " type=Name(id='TypeError', ctx=Load()),\n" " body=[\n" -" Pass()])],\n" -" orelse=[],\n" -" finalbody=[])],\n" -" type_ignores=[])" +" Pass()])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... try:\n" @@ -2325,7 +2412,7 @@ msgstr "" " finalbody=[])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1365 +#: ../../library/ast.rst:1347 msgid "" "A ``with`` block. ``items`` is a list of :class:`withitem` nodes " "representing the context managers, and ``body`` is the indented block inside " @@ -2334,7 +2421,7 @@ msgstr "" "一個 ``with`` 區塊。``items`` 是表示情境管理器的 :class:`withitem` 節點串列," "``body`` 是情境內的縮進區塊。" -#: ../../library/ast.rst:1375 +#: ../../library/ast.rst:1357 msgid "" "A single context manager in a ``with`` block. ``context_expr`` is the " "context manager, often a :class:`Call` node. ``optional_vars`` is a :class:" @@ -2345,7 +2432,8 @@ msgstr "" "class:`Call` 節點。``Optional_vars`` 是 ``as foo`` 部分的 :class:`Name`、:" "class:`Tuple` 或 :class:`List`,或者如果不使用則為 ``None`` 。" -#: ../../library/ast.rst:1380 +#: ../../library/ast.rst:1362 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... with a as b, c as d:\n" @@ -2367,9 +2455,7 @@ msgid "" " func=Name(id='something', ctx=Load()),\n" " args=[\n" " Name(id='b', ctx=Load()),\n" -" Name(id='d', ctx=Load())],\n" -" keywords=[]))])],\n" -" type_ignores=[])" +" Name(id='d', ctx=Load())]))])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... with a as b, c as d:\n" @@ -2395,11 +2481,11 @@ msgstr "" " keywords=[]))])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1408 +#: ../../library/ast.rst:1388 msgid "Pattern matching" msgstr "模式匹配 (pattern matching)" -#: ../../library/ast.rst:1413 +#: ../../library/ast.rst:1393 msgid "" "A ``match`` statement. ``subject`` holds the subject of the match (the " "object that is being matched against the cases) and ``cases`` contains an " @@ -2408,7 +2494,7 @@ msgstr "" "一個 ``match`` 陳述式。``subject`` 保存匹配的主題(與案例匹配的物件)," "``cases`` 包含具有不同案例的 :class:`match_case` 節點的可疊代物件。" -#: ../../library/ast.rst:1421 +#: ../../library/ast.rst:1401 msgid "" "A single case pattern in a ``match`` statement. ``pattern`` contains the " "match pattern that the subject will be matched against. Note that the :class:" @@ -2419,13 +2505,13 @@ msgstr "" "請注意,為模式生成的 :class:`AST` 節點與為運算式生成的節點不同,即使它們共享" "相同的語法。" -#: ../../library/ast.rst:1426 +#: ../../library/ast.rst:1406 msgid "" "The ``guard`` attribute contains an expression that will be evaluated if the " "pattern matches the subject." msgstr "``guard`` 屬性包含一個運算式,如果模式與主題匹配,則將對該運算式求值。" -#: ../../library/ast.rst:1429 +#: ../../library/ast.rst:1409 msgid "" "``body`` contains a list of nodes to execute if the pattern matches and the " "result of evaluating the guard expression is true." @@ -2433,7 +2519,8 @@ msgstr "" "``body`` 包含一個節點串列,如果模式匹配並且為防護運算式 (guard expression) 的" "求值 (evaluate) 結果為真,則會執行該節點串列。" -#: ../../library/ast.rst:1432 +#: ../../library/ast.rst:1412 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2462,14 +2549,10 @@ msgid "" " value=Constant(value=Ellipsis))]),\n" " match_case(\n" " pattern=MatchClass(\n" -" cls=Name(id='tuple', ctx=Load()),\n" -" patterns=[],\n" -" kwd_attrs=[],\n" -" kwd_patterns=[]),\n" +" cls=Name(id='tuple', ctx=Load())),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2507,7 +2590,7 @@ msgstr "" " value=Constant(value=Ellipsis))])])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1474 +#: ../../library/ast.rst:1450 msgid "" "A match literal or value pattern that compares by equality. ``value`` is an " "expression node. Permitted value nodes are restricted as described in the " @@ -2517,7 +2600,8 @@ msgstr "" "以相等性進行比較的匹配文本或值的模式。``value`` 是一個運算式節點。允許值節點" "受到匹配陳述式文件中所述的限制。如果匹配主題等於求出值,則此模式成功。" -#: ../../library/ast.rst:1479 +#: ../../library/ast.rst:1455 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2534,8 +2618,7 @@ msgid "" " value=Constant(value='Relevant')),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2555,7 +2638,7 @@ msgstr "" " value=Constant(value=Ellipsis))])])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1503 +#: ../../library/ast.rst:1478 msgid "" "A match literal pattern that compares by identity. ``value`` is the " "singleton to be compared against: ``None``, ``True``, or ``False``. This " @@ -2565,7 +2648,8 @@ msgstr "" "``True`` 或 ``False`` 進行比較的單例 (singleton)。如果匹配主題是給定的常數," "則此模式成功。" -#: ../../library/ast.rst:1507 +#: ../../library/ast.rst:1482 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2581,8 +2665,7 @@ msgid "" " pattern=MatchSingleton(value=None),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2601,7 +2684,7 @@ msgstr "" " value=Constant(value=Ellipsis))])])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1530 +#: ../../library/ast.rst:1504 msgid "" "A match sequence pattern. ``patterns`` contains the patterns to be matched " "against the subject elements if the subject is a sequence. Matches a " @@ -2611,7 +2694,8 @@ msgstr "" "匹配序列模式。如果主題是一個序列,``patterns`` 包含與主題元素匹配的模式。如果" "子模式之一是 ``MatchStar`` 節點,則匹配可變長度序列,否則匹配固定長度序列。" -#: ../../library/ast.rst:1535 +#: ../../library/ast.rst:1509 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2632,8 +2716,7 @@ msgid "" " value=Constant(value=2))]),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2657,7 +2740,7 @@ msgstr "" " value=Constant(value=Ellipsis))])])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1563 +#: ../../library/ast.rst:1536 msgid "" "Matches the rest of the sequence in a variable length match sequence " "pattern. If ``name`` is not ``None``, a list containing the remaining " @@ -2667,7 +2750,8 @@ msgstr "" "以可變長度匹配序列模式匹配序列的其餘部分。如果 ``name`` 不是 ``None``,則如果" "整體序列模式成功,則包含其餘序列元素的串列將綁定到該名稱。" -#: ../../library/ast.rst:1567 +#: ../../library/ast.rst:1540 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2698,8 +2782,7 @@ msgid "" " MatchStar()]),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2733,7 +2816,7 @@ msgstr "" " value=Constant(value=Ellipsis))])])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1605 +#: ../../library/ast.rst:1577 msgid "" "A match mapping pattern. ``keys`` is a sequence of expression nodes. " "``patterns`` is a corresponding sequence of pattern nodes. ``rest`` is an " @@ -2745,7 +2828,7 @@ msgstr "" "列。``rest`` 是一個可選名稱,可以指定它來捕獲剩餘的對映元素。允許的鍵運算式受" "到匹配陳述式文件中所述的限制。" -#: ../../library/ast.rst:1611 +#: ../../library/ast.rst:1583 msgid "" "This pattern succeeds if the subject is a mapping, all evaluated key " "expressions are present in the mapping, and the value corresponding to each " @@ -2757,7 +2840,8 @@ msgstr "" "應的子模式匹配,則此模式成功。如果 ``rest`` 不是 ``None``,則如果整體對映模式" "成功,則包含其餘對映元素的字典將綁定到該名稱。" -#: ../../library/ast.rst:1617 +#: ../../library/ast.rst:1589 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2783,12 +2867,10 @@ msgid "" " Expr(\n" " value=Constant(value=Ellipsis))]),\n" " match_case(\n" -" pattern=MatchMapping(keys=[], patterns=[], " -"rest='rest'),\n" +" pattern=MatchMapping(rest='rest'),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2821,7 +2903,7 @@ msgstr "" " value=Constant(value=Ellipsis))])])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1653 +#: ../../library/ast.rst:1624 msgid "" "A match class pattern. ``cls`` is an expression giving the nominal class to " "be matched. ``patterns`` is a sequence of pattern nodes to be matched " @@ -2836,7 +2918,7 @@ msgstr "" "``kwd_attrs`` 是要匹配的附加屬性序列(在類別模式中指定為關鍵字引數)," "``kwd_patterns`` 是相應的模式(在類別模式中指定為關鍵字的值)。" -#: ../../library/ast.rst:1660 +#: ../../library/ast.rst:1631 msgid "" "This pattern succeeds if the subject is an instance of the nominated class, " "all positional patterns match the corresponding class-defined attributes, " @@ -2845,7 +2927,7 @@ msgstr "" "如果主題是指定類別的實例,所有位置模式都與相應的類別定義屬性匹配,並且任何指" "定的關鍵字屬性與其相應模式匹配,則此模式成功。" -#: ../../library/ast.rst:1664 +#: ../../library/ast.rst:1635 msgid "" "Note: classes may define a property that returns self in order to match a " "pattern node against the instance being matched. Several builtin types are " @@ -2854,7 +2936,8 @@ msgstr "" "注意:類別可以定義一個回傳 self 的特性 (property),以便將模式節點與正在匹配的" "實例進行匹配。一些內建型別也以這種方式匹配,如同匹配陳述式文件中所述。" -#: ../../library/ast.rst:1668 +#: ../../library/ast.rst:1639 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2875,16 +2958,13 @@ msgid "" " MatchValue(\n" " value=Constant(value=0)),\n" " MatchValue(\n" -" value=Constant(value=0))],\n" -" kwd_attrs=[],\n" -" kwd_patterns=[]),\n" +" value=Constant(value=0))]),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))]),\n" " match_case(\n" " pattern=MatchClass(\n" " cls=Name(id='Point3D', ctx=Load()),\n" -" patterns=[],\n" " kwd_attrs=[\n" " 'x',\n" " 'y',\n" @@ -2898,8 +2978,7 @@ msgid "" " value=Constant(value=0))]),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2946,7 +3025,7 @@ msgstr "" " value=Constant(value=Ellipsis))])])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1719 +#: ../../library/ast.rst:1686 msgid "" "A match \"as-pattern\", capture pattern or wildcard pattern. ``pattern`` " "contains the match pattern that the subject will be matched against. If the " @@ -2957,7 +3036,7 @@ msgstr "" "(wildcard pattern)。``pattern`` 包含主題將與之匹配的匹配模式。如果模式為 " "``None``,則該節點代表捕獲模式(即裸名 (bare name))並且始終會成功。" -#: ../../library/ast.rst:1724 +#: ../../library/ast.rst:1691 msgid "" "The ``name`` attribute contains the name that will be bound if the pattern " "is successful. If ``name`` is ``None``, ``pattern`` must also be ``None`` " @@ -2966,7 +3045,8 @@ msgstr "" "``name`` 屬性包含模式成功時將綁定的名稱。如果 ``name`` 為 ``None``,則 " "``pattern`` 也必須為 ``None``,並且節點代表通配模式。" -#: ../../library/ast.rst:1728 +#: ../../library/ast.rst:1695 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2993,8 +3073,7 @@ msgid "" " pattern=MatchAs(),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -3024,7 +3103,7 @@ msgstr "" " value=Constant(value=Ellipsis))])])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1762 +#: ../../library/ast.rst:1728 msgid "" "A match \"or-pattern\". An or-pattern matches each of its subpatterns in " "turn to the subject, until one succeeds. The or-pattern is then deemed to " @@ -3036,7 +3115,8 @@ msgstr "" "到成功為止,然後 or 模式就會被認為是成功的。如果沒有一個子模式成功,則 or 模" "式將失敗。 ``patterns`` 屬性包含將與主題進行匹配的匹配模式節點串列。" -#: ../../library/ast.rst:1768 +#: ../../library/ast.rst:1734 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -3057,8 +3137,7 @@ msgid "" " MatchAs(name='y')]),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -3082,29 +3161,34 @@ msgstr "" " value=Constant(value=Ellipsis))])])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1797 +#: ../../library/ast.rst:1762 msgid "Type parameters" msgstr "型別參數 (type parameters)" -#: ../../library/ast.rst:1799 +#: ../../library/ast.rst:1764 msgid "" ":ref:`Type parameters ` can exist on classes, functions, and " "type aliases." msgstr ":ref:`型別參數 `\\ 可以存在於類別、函式和型別別名上。" -#: ../../library/ast.rst:1804 +#: ../../library/ast.rst:1769 +#, fuzzy msgid "" -"A :class:`typing.TypeVar`. ``name`` is the name of the type variable. " -"``bound`` is the bound or constraints, if any. If ``bound`` is a :class:" -"`Tuple`, it represents constraints; otherwise it represents the bound." +"A :class:`typing.TypeVar`. *name* is the name of the type variable. *bound* " +"is the bound or constraints, if any. If *bound* is a :class:`Tuple`, it " +"represents constraints; otherwise it represents the bound. *default_value* " +"is the default value; if the :class:`!TypeVar` has no default, this " +"attribute will be set to ``None``." msgstr "" "一個 :class:`typing.TypeVar`。``name`` 是型別變數的名稱。``bound`` 是(如果有" "存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一個 :class:" "`Tuple`,它代表約束;否則它代表界限。" -#: ../../library/ast.rst:1808 +#: ../../library/ast.rst:1775 +#, fuzzy msgid "" -">>> print(ast.dump(ast.parse(\"type Alias[T: int] = list[T]\"), indent=4))\n" +">>> print(ast.dump(ast.parse(\"type Alias[T: int = bool] = list[T]\"), " +"indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" @@ -3112,12 +3196,12 @@ msgid "" " type_params=[\n" " TypeVar(\n" " name='T',\n" -" bound=Name(id='int', ctx=Load()))],\n" +" bound=Name(id='int', ctx=Load()),\n" +" default_value=Name(id='bool', ctx=Load()))],\n" " value=Subscript(\n" " value=Name(id='list', ctx=Load()),\n" " slice=Name(id='T', ctx=Load()),\n" -" ctx=Load()))],\n" -" type_ignores=[])" +" ctx=Load()))])" msgstr "" ">>> print(ast.dump(ast.parse(\"type Alias[T: int] = list[T]\"), indent=4))\n" "Module(\n" @@ -3134,22 +3218,36 @@ msgstr "" " ctx=Load()))],\n" " type_ignores=[])" -#: ../../library/ast.rst:1829 +#: ../../library/ast.rst:1794 ../../library/ast.rst:1829 +#: ../../library/ast.rst:1861 +#, fuzzy +msgid "Added the *default_value* parameter." +msgstr "新增 *indent* 選項。" + +#: ../../library/ast.rst:1799 msgid "" -"A :class:`typing.ParamSpec`. ``name`` is the name of the parameter " -"specification." -msgstr "A :class:`typing.ParamSpec`。``name`` 是參數規範的名稱。" +"A :class:`typing.ParamSpec`. *name* is the name of the parameter " +"specification. *default_value* is the default value; if the :class:`!" +"ParamSpec` has no default, this attribute will be set to ``None``." +msgstr "" -#: ../../library/ast.rst:1831 +#: ../../library/ast.rst:1803 +#, fuzzy msgid "" -">>> print(ast.dump(ast.parse(\"type Alias[**P] = Callable[P, int]\"), " -"indent=4))\n" +">>> print(ast.dump(ast.parse(\"type Alias[**P = (int, str)] = Callable[P, " +"int]\"), indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" " name=Name(id='Alias', ctx=Store()),\n" " type_params=[\n" -" ParamSpec(name='P')],\n" +" ParamSpec(\n" +" name='P',\n" +" default_value=Tuple(\n" +" elts=[\n" +" Name(id='int', ctx=Load()),\n" +" Name(id='str', ctx=Load())],\n" +" ctx=Load()))],\n" " value=Subscript(\n" " value=Name(id='Callable', ctx=Load()),\n" " slice=Tuple(\n" @@ -3157,8 +3255,7 @@ msgid "" " Name(id='P', ctx=Load()),\n" " Name(id='int', ctx=Load())],\n" " ctx=Load()),\n" -" ctx=Load()))],\n" -" type_ignores=[])" +" ctx=Load()))])" msgstr "" ">>> print(ast.dump(ast.parse(\"type Alias[**P] = Callable[P, int]\"), " "indent=4))\n" @@ -3178,21 +3275,30 @@ msgstr "" " ctx=Load()))],\n" " type_ignores=[])" -#: ../../library/ast.rst:1854 +#: ../../library/ast.rst:1834 +#, fuzzy msgid "" -"A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable " -"tuple." -msgstr "一個 :class:`typing.TypeVarTuple`。``name`` 是型別變數元組的名稱。" +"A :class:`typing.TypeVarTuple`. *name* is the name of the type variable " +"tuple. *default_value* is the default value; if the :class:`!TypeVarTuple` " +"has no default, this attribute will be set to ``None``." +msgstr "" +"一個 :class:`typing.TypeVar`。``name`` 是型別變數的名稱。``bound`` 是(如果有" +"存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一個 :class:" +"`Tuple`,它代表約束;否則它代表界限。" -#: ../../library/ast.rst:1856 +#: ../../library/ast.rst:1838 +#, fuzzy msgid "" -">>> print(ast.dump(ast.parse(\"type Alias[*Ts] = tuple[*Ts]\"), indent=4))\n" +">>> print(ast.dump(ast.parse(\"type Alias[*Ts = ()] = tuple[*Ts]\"), " +"indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" " name=Name(id='Alias', ctx=Store()),\n" " type_params=[\n" -" TypeVarTuple(name='Ts')],\n" +" TypeVarTuple(\n" +" name='Ts',\n" +" default_value=Tuple(ctx=Load()))],\n" " value=Subscript(\n" " value=Name(id='tuple', ctx=Load()),\n" " slice=Tuple(\n" @@ -3201,8 +3307,7 @@ msgid "" " value=Name(id='Ts', ctx=Load()),\n" " ctx=Load())],\n" " ctx=Load()),\n" -" ctx=Load()))],\n" -" type_ignores=[])" +" ctx=Load()))])" msgstr "" ">>> print(ast.dump(ast.parse(\"type Alias[*Ts] = tuple[*Ts]\"), indent=4))\n" "Module(\n" @@ -3222,27 +3327,27 @@ msgstr "" " ctx=Load()))],\n" " type_ignores=[])" -#: ../../library/ast.rst:1879 +#: ../../library/ast.rst:1865 msgid "Function and class definitions" msgstr "函式和類別定義" -#: ../../library/ast.rst:1883 +#: ../../library/ast.rst:1869 msgid "A function definition." msgstr "一個函式定義。" -#: ../../library/ast.rst:1885 +#: ../../library/ast.rst:1871 msgid "``name`` is a raw string of the function name." msgstr "``name`` 是函式名稱的原始字串。" -#: ../../library/ast.rst:1886 +#: ../../library/ast.rst:1872 msgid "``args`` is an :class:`arguments` node." msgstr "``args`` 是一個 :class:`arguments` 節點。" -#: ../../library/ast.rst:1887 +#: ../../library/ast.rst:1873 msgid "``body`` is the list of nodes inside the function." msgstr "``body`` 是函式內節點的串列。" -#: ../../library/ast.rst:1888 +#: ../../library/ast.rst:1874 msgid "" "``decorator_list`` is the list of decorators to be applied, stored outermost " "first (i.e. the first in the list will be applied last)." @@ -3250,20 +3355,20 @@ msgstr "" "``decorator_list`` 是要應用的裝飾器串列,在最外層者會被儲存在首位(即串列中首" "位將會是最後一個被應用的那個)。" -#: ../../library/ast.rst:1890 +#: ../../library/ast.rst:1876 msgid "``returns`` is the return annotation." msgstr "``returns`` 是回傳註釋。" -#: ../../library/ast.rst:1891 ../../library/ast.rst:2067 +#: ../../library/ast.rst:1877 ../../library/ast.rst:2041 msgid "``type_params`` is a list of :ref:`type parameters `." msgstr "``type_params`` 是\\ :ref:`型別參數 `\\ 的串列。" -#: ../../library/ast.rst:1897 ../../library/ast.rst:2096 -#: ../../library/ast.rst:2107 +#: ../../library/ast.rst:1883 ../../library/ast.rst:2068 +#: ../../library/ast.rst:2079 msgid "Added ``type_params``." msgstr "新增了 ``type_params``。" -#: ../../library/ast.rst:1903 +#: ../../library/ast.rst:1889 msgid "" "``lambda`` is a minimal function definition that can be used inside an " "expression. Unlike :class:`FunctionDef`, ``body`` holds a single node." @@ -3271,7 +3376,8 @@ msgstr "" "``lambda`` 是可以在運算式內使用的最小函式定義。與 :class:`FunctionDef` 不同," "``body`` 保存單個節點。" -#: ../../library/ast.rst:1906 +#: ../../library/ast.rst:1892 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\n" "Module(\n" @@ -3279,15 +3385,10 @@ msgid "" " Expr(\n" " value=Lambda(\n" " args=arguments(\n" -" posonlyargs=[],\n" " args=[\n" " arg(arg='x'),\n" -" arg(arg='y')],\n" -" kwonlyargs=[],\n" -" kw_defaults=[],\n" -" defaults=[]),\n" -" body=Constant(value=Ellipsis)))],\n" -" type_ignores=[])" +" arg(arg='y')]),\n" +" body=Constant(value=Ellipsis)))])" msgstr "" ">>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\n" "Module(\n" @@ -3305,17 +3406,17 @@ msgstr "" " body=Constant(value=Ellipsis)))],\n" " type_ignores=[])" -#: ../../library/ast.rst:1927 +#: ../../library/ast.rst:1908 msgid "The arguments for a function." msgstr "函式的引數。" -#: ../../library/ast.rst:1929 +#: ../../library/ast.rst:1910 msgid "" "``posonlyargs``, ``args`` and ``kwonlyargs`` are lists of :class:`arg` nodes." msgstr "" "``posonlyargs``、``args`` 和 ``kwonlyargs`` 是 :class:`arg` 節點的串列。" -#: ../../library/ast.rst:1930 +#: ../../library/ast.rst:1911 msgid "" "``vararg`` and ``kwarg`` are single :class:`arg` nodes, referring to the " "``*args, **kwargs`` parameters." @@ -3323,7 +3424,7 @@ msgstr "" "``vararg`` 和 ``kwarg`` 是單個 :class:`arg` 節點,指的是 ``*args, **kwargs`` " "參數。" -#: ../../library/ast.rst:1932 +#: ../../library/ast.rst:1913 msgid "" "``kw_defaults`` is a list of default values for keyword-only arguments. If " "one is ``None``, the corresponding argument is required." @@ -3331,7 +3432,7 @@ msgstr "" "``kw_defaults`` 是僅限關鍵字引數的預設值串列。如果其中某個為 ``None``,則相應" "參數就會是必要的。" -#: ../../library/ast.rst:1934 +#: ../../library/ast.rst:1915 msgid "" "``defaults`` is a list of default values for arguments that can be passed " "positionally. If there are fewer defaults, they correspond to the last n " @@ -3340,7 +3441,7 @@ msgstr "" "``defaults`` 是可以按位置傳遞的引數的預設值串列。如果預設值較少,則它們對應於" "最後 n 個引數。" -#: ../../library/ast.rst:1941 +#: ../../library/ast.rst:1922 msgid "" "A single argument in a list. ``arg`` is a raw string of the argument name; " "``annotation`` is its annotation, such as a :class:`Name` node." @@ -3348,12 +3449,13 @@ msgstr "" "串列中的單個引數。``arg`` 是引數名稱的原始字串,``annotation`` 是它的註釋,例" "如 :class:`Name` 節點。" -#: ../../library/ast.rst:1946 +#: ../../library/ast.rst:1927 msgid "" "``type_comment`` is an optional string with the type annotation as a comment" msgstr "``type_comment`` 是一個可選字串,其註解為型別註釋" -#: ../../library/ast.rst:1948 +#: ../../library/ast.rst:1929 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3367,7 +3469,6 @@ msgid "" " FunctionDef(\n" " name='f',\n" " args=arguments(\n" -" posonlyargs=[],\n" " args=[\n" " arg(\n" " arg='a',\n" @@ -3390,9 +3491,7 @@ msgid "" " decorator_list=[\n" " Name(id='decorator1', ctx=Load()),\n" " Name(id='decorator2', ctx=Load())],\n" -" returns=Constant(value='return annotation'),\n" -" type_params=[])],\n" -" type_ignores=[])" +" returns=Constant(value='return annotation'))])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3433,18 +3532,18 @@ msgstr "" " type_params=[])],\n" " type_ignores=[])" -#: ../../library/ast.rst:1991 +#: ../../library/ast.rst:1969 msgid "A ``return`` statement." msgstr "一個 ``return`` 陳述式。" -#: ../../library/ast.rst:1993 +#: ../../library/ast.rst:1971 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('return 4'), indent=4))\n" "Module(\n" " body=[\n" " Return(\n" -" value=Constant(value=4))],\n" -" type_ignores=[])" +" value=Constant(value=4))])" msgstr "" ">>> print(ast.dump(ast.parse('return 4'), indent=4))\n" "Module(\n" @@ -3453,7 +3552,7 @@ msgstr "" " value=Constant(value=4))],\n" " type_ignores=[])" -#: ../../library/ast.rst:2006 +#: ../../library/ast.rst:1983 msgid "" "A ``yield`` or ``yield from`` expression. Because these are expressions, " "they must be wrapped in an :class:`Expr` node if the value sent back is not " @@ -3462,23 +3561,22 @@ msgstr "" "一個 ``yield`` 或 ``yield from`` 運算式。因為這些是運算式,所以如果不使用發送" "回來的值,則必須將它們包裝在 :class:`Expr` 節點中。" -#: ../../library/ast.rst:2009 +#: ../../library/ast.rst:1986 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('yield x'), indent=4))\n" "Module(\n" " body=[\n" " Expr(\n" " value=Yield(\n" -" value=Name(id='x', ctx=Load())))],\n" -" type_ignores=[])\n" +" value=Name(id='x', ctx=Load())))])\n" "\n" ">>> print(ast.dump(ast.parse('yield from x'), indent=4))\n" "Module(\n" " body=[\n" " Expr(\n" " value=YieldFrom(\n" -" value=Name(id='x', ctx=Load())))],\n" -" type_ignores=[])" +" value=Name(id='x', ctx=Load())))])" msgstr "" ">>> print(ast.dump(ast.parse('yield x'), indent=4))\n" "Module(\n" @@ -3496,12 +3594,13 @@ msgstr "" " value=Name(id='x', ctx=Load())))],\n" " type_ignores=[])" -#: ../../library/ast.rst:2031 +#: ../../library/ast.rst:2006 msgid "" "``global`` and ``nonlocal`` statements. ``names`` is a list of raw strings." msgstr "``global`` 和 ``nonlocal`` 陳述式。``names`` 是原始字串的串列。" -#: ../../library/ast.rst:2033 +#: ../../library/ast.rst:2008 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('global x,y,z'), indent=4))\n" "Module(\n" @@ -3510,8 +3609,7 @@ msgid "" " names=[\n" " 'x',\n" " 'y',\n" -" 'z'])],\n" -" type_ignores=[])\n" +" 'z'])])\n" "\n" ">>> print(ast.dump(ast.parse('nonlocal x,y,z'), indent=4))\n" "Module(\n" @@ -3520,8 +3618,7 @@ msgid "" " names=[\n" " 'x',\n" " 'y',\n" -" 'z'])],\n" -" type_ignores=[])" +" 'z'])])" msgstr "" ">>> print(ast.dump(ast.parse('global x,y,z'), indent=4))\n" "Module(\n" @@ -3543,38 +3640,40 @@ msgstr "" " 'z'])],\n" " type_ignores=[])" -#: ../../library/ast.rst:2058 +#: ../../library/ast.rst:2031 msgid "A class definition." msgstr "一個類別定義。" -#: ../../library/ast.rst:2060 +#: ../../library/ast.rst:2033 msgid "``name`` is a raw string for the class name" msgstr "``name`` 是類別名的原始字串" -#: ../../library/ast.rst:2061 +#: ../../library/ast.rst:2034 msgid "``bases`` is a list of nodes for explicitly specified base classes." msgstr "``bases`` 是被顯式指定的基底類別節點串列。" -#: ../../library/ast.rst:2062 +#: ../../library/ast.rst:2035 +#, fuzzy msgid "" "``keywords`` is a list of :class:`.keyword` nodes, principally for " -"'metaclass'. Other keywords will be passed to the metaclass, as per :pep:" -"`3115`." +"'metaclass'. Other keywords will be passed to the metaclass, as per " +"`PEP-3115 `_." msgstr "" "``keywords`` 是一個 :class:`.keyword` 節點的串列,主要用於 'metaclass'(元類" "別)。如 :pep:`3115` 所述,其他關鍵字將被傳遞到 metaclass。" -#: ../../library/ast.rst:2064 +#: ../../library/ast.rst:2038 msgid "" "``body`` is a list of nodes representing the code within the class " "definition." msgstr "``body`` 是表示類別定義中程式碼的節點串列。" -#: ../../library/ast.rst:2066 +#: ../../library/ast.rst:2040 msgid "``decorator_list`` is a list of nodes, as in :class:`FunctionDef`." msgstr "``decorator_list`` 是一個節點串列,如 :class:`FunctionDef` 中所示。" -#: ../../library/ast.rst:2069 +#: ../../library/ast.rst:2043 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3597,9 +3696,7 @@ msgid "" " Pass()],\n" " decorator_list=[\n" " Name(id='decorator1', ctx=Load()),\n" -" Name(id='decorator2', ctx=Load())],\n" -" type_params=[])],\n" -" type_ignores=[])" +" Name(id='decorator2', ctx=Load())])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3626,17 +3723,17 @@ msgstr "" " type_params=[])],\n" " type_ignores=[])" -#: ../../library/ast.rst:2100 +#: ../../library/ast.rst:2072 msgid "Async and await" msgstr "async 和 await" -#: ../../library/ast.rst:2104 +#: ../../library/ast.rst:2076 msgid "" "An ``async def`` function definition. Has the same fields as :class:" "`FunctionDef`." msgstr "一個 ``async def`` 函式定義。與 :class:`FunctionDef` 具有相同的欄位。" -#: ../../library/ast.rst:2113 +#: ../../library/ast.rst:2085 msgid "" "An ``await`` expression. ``value`` is what it waits for. Only valid in the " "body of an :class:`AsyncFunctionDef`." @@ -3644,7 +3741,8 @@ msgstr "" "一個 ``await`` 運算式。``value`` 是它等待的東西。僅在 :class:" "`AsyncFunctionDef` 主體 (body) 中有效。" -#: ../../library/ast.rst:2116 +#: ../../library/ast.rst:2088 +#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -3654,22 +3752,12 @@ msgid "" " body=[\n" " AsyncFunctionDef(\n" " name='f',\n" -" args=arguments(\n" -" posonlyargs=[],\n" -" args=[],\n" -" kwonlyargs=[],\n" -" kw_defaults=[],\n" -" defaults=[]),\n" +" args=arguments(),\n" " body=[\n" " Expr(\n" " value=Await(\n" " value=Call(\n" -" func=Name(id='other_func', ctx=Load()),\n" -" args=[],\n" -" keywords=[])))],\n" -" decorator_list=[],\n" -" type_params=[])],\n" -" type_ignores=[])" +" func=Name(id='other_func', ctx=Load()))))])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -3696,7 +3784,7 @@ msgstr "" " type_params=[])],\n" " type_ignores=[])" -#: ../../library/ast.rst:2147 +#: ../../library/ast.rst:2109 msgid "" "``async for`` loops and ``async with`` context managers. They have the same " "fields as :class:`For` and :class:`With`, respectively. Only valid in the " @@ -3705,7 +3793,7 @@ msgstr "" "``async for`` 迴圈和 ``async with`` 情境管理器。它們分別具有與 :class:`For` " "和 :class:`With` 相同的欄位。僅在 :class:`AsyncFunctionDef` 主體中有效。" -#: ../../library/ast.rst:2152 +#: ../../library/ast.rst:2114 msgid "" "When a string is parsed by :func:`ast.parse`, operator nodes (subclasses of :" "class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast." @@ -3718,11 +3806,11 @@ msgstr "" "boolop` 和 :class:`ast.expr_context`\\ )將是單例。對其中之一的更改將反映在所" "有其他出現的相同值中(例如 :class:`ast.Add`\\ )。" -#: ../../library/ast.rst:2160 +#: ../../library/ast.rst:2122 msgid ":mod:`ast` Helpers" msgstr ":mod:`ast` 輔助程式" -#: ../../library/ast.rst:2162 +#: ../../library/ast.rst:2124 msgid "" "Apart from the node classes, the :mod:`ast` module defines these utility " "functions and classes for traversing abstract syntax trees:" @@ -3730,15 +3818,18 @@ msgstr "" "除了節點類別之外,:mod:`ast` 模組還定義了這些用於遍歷 (traverse) 抽象語法樹的" "實用函式和類別:" -#: ../../library/ast.rst:2167 +#: ../../library/ast.rst:2129 +#, fuzzy msgid "" "Parse the source into an AST node. Equivalent to ``compile(source, " -"filename, mode, ast.PyCF_ONLY_AST)``." +"filename, mode, flags=FLAGS_VALUE, optimize=optimize)``, where " +"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and ``ast." +"PyCF_OPTIMIZED_AST`` otherwise." msgstr "" "將原始碼剖析為 AST 節點。相當於 ``compile(source, filename, mode, ast." "PyCF_ONLY_AST)``。" -#: ../../library/ast.rst:2170 +#: ../../library/ast.rst:2134 msgid "" "If ``type_comments=True`` is given, the parser is modified to check and " "return type comments as specified by :pep:`484` and :pep:`526`. This is " @@ -3757,7 +3848,7 @@ msgstr "" "``None``。此外,``# type: ignore`` 註釋的位置將作為 :class:`Module` 的 " "``type_ignores`` 屬性回傳(否則它始終是一個空串列)。" -#: ../../library/ast.rst:2180 +#: ../../library/ast.rst:2144 msgid "" "In addition, if ``mode`` is ``'func_type'``, the input syntax is modified to " "correspond to :pep:`484` \"signature type comments\", e.g. ``(str, int) -> " @@ -3767,13 +3858,14 @@ msgstr "" "名型別註解 (signature type comments)」而被修改,例如 ``(str, int) -> " "List[str]``。" -#: ../../library/ast.rst:2184 +#: ../../library/ast.rst:2148 +#, fuzzy msgid "" "Setting ``feature_version`` to a tuple ``(major, minor)`` will result in a " "\"best-effort\" attempt to parse using that Python version's grammar. For " "example, setting ``feature_version=(3, 9)`` will attempt to disallow parsing " "of :keyword:`match` statements. Currently ``major`` must equal to ``3``. The " -"lowest supported version is ``(3, 4)`` (and this may increase in future " +"lowest supported version is ``(3, 7)`` (and this may increase in future " "Python versions); the highest is ``sys.version_info[0:2]``. \"Best-effort\" " "attempt means there is no guarantee that the parse (or success of the parse) " "is the same as when run on the Python version corresponding to " @@ -3787,12 +3879,12 @@ msgstr "" "能保證剖析(或剖析的成功)與在與 ``feature_version`` 對應的 Python 版本上運行" "時相同。" -#: ../../library/ast.rst:2194 +#: ../../library/ast.rst:2158 msgid "" "If source contains a null character (``\\0``), :exc:`ValueError` is raised." msgstr "如果來源包含 null 字元 (``\\0``),則會引發 :exc:`ValueError`。" -#: ../../library/ast.rst:2197 +#: ../../library/ast.rst:2161 msgid "" "Note that successfully parsing source code into an AST object doesn't " "guarantee that the source code provided is valid Python code that can be " @@ -3806,14 +3898,14 @@ msgstr "" "原始的 ``return 42`` 為 return 陳述式生成一個有效的 AST 節點,但它不能單獨編" "譯(它需要位於函式節點內)。" -#: ../../library/ast.rst:2204 +#: ../../library/ast.rst:2168 msgid "" "In particular, :func:`ast.parse` won't do any scoping checks, which the " "compilation step does." msgstr "" "特別是 :func:`ast.parse` 不會執行任何範圍檢查,而編譯步驟才會執行此操作。" -#: ../../library/ast.rst:2208 +#: ../../library/ast.rst:2172 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string due to stack depth limitations in Python's AST compiler." @@ -3821,11 +3913,17 @@ msgstr "" "由於 Python AST 編譯器中的堆疊 (stack) 深度限制,太大或太複雜的字串可能會導" "致 Python 直譯器崩潰。" -#: ../../library/ast.rst:2212 +#: ../../library/ast.rst:2176 msgid "Added ``type_comments``, ``mode='func_type'`` and ``feature_version``." msgstr "新增 ``type_comments``、``mode='func_type'`` 與 ``feature_version``。" -#: ../../library/ast.rst:2218 +#: ../../library/ast.rst:2179 +msgid "" +"The minimum supported version for ``feature_version`` is now ``(3, 7)``. The " +"``optimize`` argument was added." +msgstr "" + +#: ../../library/ast.rst:2186 msgid "" "Unparse an :class:`ast.AST` object and generate a string with code that " "would produce an equivalent :class:`ast.AST` object if parsed back with :" @@ -3834,7 +3932,7 @@ msgstr "" "反剖析 :class:`ast.AST` 物件並生成一個帶有程式碼的字串,如果使用 :func:`ast." "parse` 剖析回來,該程式碼將生成等效的 :class:`ast.AST` 物件。" -#: ../../library/ast.rst:2223 +#: ../../library/ast.rst:2191 msgid "" "The produced code string will not necessarily be equal to the original code " "that generated the :class:`ast.AST` object (without any compiler " @@ -3843,13 +3941,13 @@ msgstr "" "生成的程式碼字串不一定等於生成 :class:`ast.AST` 物件的原始程式碼(沒有任何編" "譯器最佳化,例如常數元組/凍結集合)。" -#: ../../library/ast.rst:2228 +#: ../../library/ast.rst:2196 msgid "" "Trying to unparse a highly complex expression would result with :exc:" "`RecursionError`." msgstr "嘗試剖析高度複雜的運算式會導致 :exc:`RecursionError`。" -#: ../../library/ast.rst:2236 +#: ../../library/ast.rst:2204 msgid "" "Evaluate an expression node or a string containing only a Python literal or " "container display. The string or node provided may only consist of the " @@ -3860,7 +3958,7 @@ msgstr "" "能包含以下 Python 文本結構:字串、位元組、數字、元組、串列、字典、集合、布林" "值、``None`` 和 ``Ellipsis``。" -#: ../../library/ast.rst:2241 +#: ../../library/ast.rst:2209 msgid "" "This can be used for evaluating strings containing Python values without the " "need to parse the values oneself. It is not capable of evaluating " @@ -3869,7 +3967,7 @@ msgstr "" "這可用於為包含 Python 值的字串求值,而無需自己剖析這些值。它無法計算任意複雜" "的運算式,例如涉及運算子或索引。" -#: ../../library/ast.rst:2246 +#: ../../library/ast.rst:2214 msgid "" "This function had been documented as \"safe\" in the past without defining " "what that meant. That was misleading. This is specifically designed not to " @@ -3886,13 +3984,13 @@ msgstr "" "盡或 C 堆疊耗盡,從而導致行程崩潰。某些輸入也可能會出現 CPU 消耗過多而導致拒" "絕服務的情況。因此不建議在不受信任的資料上呼叫它。" -#: ../../library/ast.rst:2256 +#: ../../library/ast.rst:2224 msgid "" "It is possible to crash the Python interpreter due to stack depth " "limitations in Python's AST compiler." msgstr "由於 Python AST 編譯器的堆疊深度限制,Python 直譯器可能會崩潰。" -#: ../../library/ast.rst:2259 +#: ../../library/ast.rst:2227 msgid "" "It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:" "`MemoryError` and :exc:`RecursionError` depending on the malformed input." @@ -3900,19 +3998,19 @@ msgstr "" "它可能會引發 :exc:`ValueError`、:exc:`TypeError`、:exc:`SyntaxError`、:exc:" "`MemoryError` 和 :exc:`RecursionError`,具體取決於格式錯誤的輸入。" -#: ../../library/ast.rst:2263 +#: ../../library/ast.rst:2231 msgid "Now allows bytes and set literals." msgstr "現在允許位元組和集合文本 (set literal)。" -#: ../../library/ast.rst:2266 +#: ../../library/ast.rst:2234 msgid "Now supports creating empty sets with ``'set()'``." msgstr "現在支援使用 ``'set()'`` 建立空集合。" -#: ../../library/ast.rst:2269 +#: ../../library/ast.rst:2237 msgid "For string inputs, leading spaces and tabs are now stripped." msgstr "對於字串輸入,前導空格和定位字元 (tab) 現在已被去除。" -#: ../../library/ast.rst:2275 +#: ../../library/ast.rst:2243 msgid "" "Return the docstring of the given *node* (which must be a :class:" "`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, or :class:" @@ -3924,11 +4022,11 @@ msgstr "" "件字串則為 ``None``。如果 *clean* 為 true,則使用 :func:`inspect.cleandoc` 清" "理文件字串的縮排。" -#: ../../library/ast.rst:2281 +#: ../../library/ast.rst:2249 msgid ":class:`AsyncFunctionDef` is now supported." msgstr "目前已支援 :class:`AsyncFunctionDef`。" -#: ../../library/ast.rst:2287 +#: ../../library/ast.rst:2255 msgid "" "Get source code segment of the *source* that generated *node*. If some " "location information (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :" @@ -3939,7 +4037,7 @@ msgstr "" "lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST.col_offset` 或 :attr:" "`~ast.AST.end_col_offset`\\ )遺漏,則回傳 ``None``。" -#: ../../library/ast.rst:2291 +#: ../../library/ast.rst:2259 msgid "" "If *padded* is ``True``, the first line of a multi-line statement will be " "padded with spaces to match its original position." @@ -3947,7 +4045,7 @@ msgstr "" "如果 *padded* 為 ``True``,則多列陳述式的第一列將用空格填充 (padded) 以匹配其" "原始位置。" -#: ../../library/ast.rst:2299 +#: ../../library/ast.rst:2267 msgid "" "When you compile a node tree with :func:`compile`, the compiler expects :" "attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes for every " @@ -3961,7 +4059,7 @@ msgstr "" "要存在。填入生成的節點相當繁瑣,因此該輔助工具透過將這些屬性設定為父節點的" "值,在尚未設定的地方遞迴地新增這些屬性。它從 *node* 開始遞迴地作用。" -#: ../../library/ast.rst:2308 +#: ../../library/ast.rst:2276 msgid "" "Increment the line number and end line number of each node in the tree " "starting at *node* by *n*. This is useful to \"move code\" to a different " @@ -3970,7 +4068,7 @@ msgstr "" "將樹中從 *node* 開始的每個節點的列號和結束列號增加 *n*。這對於「移動程式碼」" "到檔案中的不同位置很有用。" -#: ../../library/ast.rst:2315 +#: ../../library/ast.rst:2283 msgid "" "Copy source location (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :" "attr:`~ast.AST.end_lineno`, and :attr:`~ast.AST.end_col_offset`) from " @@ -3980,7 +4078,7 @@ msgstr "" "attr:`~ast.AST.end_lineno` 和 :attr:`~ast.AST.end_col_offset` )從 " "*old_node* 複製到 *new_node*,並回傳 *new_node* 。" -#: ../../library/ast.rst:2322 +#: ../../library/ast.rst:2290 msgid "" "Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` " "that is present on *node*." @@ -3988,7 +4086,7 @@ msgstr "" "為 *node* 上存在的 ``node._fields`` 中的每個欄位生成一個 ``(fieldname, " "value)`` 元組。" -#: ../../library/ast.rst:2328 +#: ../../library/ast.rst:2296 msgid "" "Yield all direct child nodes of *node*, that is, all fields that are nodes " "and all items of fields that are lists of nodes." @@ -3996,7 +4094,7 @@ msgstr "" "生成 *node* 的所有直接子節點,即作為節點的所有欄位以及作為節點串列欄位的所有" "項目。" -#: ../../library/ast.rst:2334 +#: ../../library/ast.rst:2302 msgid "" "Recursively yield all descendant nodes in the tree starting at *node* " "(including *node* itself), in no specified order. This is useful if you " @@ -4005,7 +4103,7 @@ msgstr "" "遞迴地生成樹中從 *node* 開始的所有後代節點(包括 *node* 本身),不按指定順" "序。如果你只想就地修改節點而不關心情境,這非常有用。" -#: ../../library/ast.rst:2341 +#: ../../library/ast.rst:2309 msgid "" "A node visitor base class that walks the abstract syntax tree and calls a " "visitor function for every node found. This function may return a value " @@ -4014,13 +4112,13 @@ msgstr "" "節點訪問者基底類別,它遍歷抽象語法樹並為找到的每個節點呼叫訪問者函式。該函式" "可能會回傳一個由 :meth:`visit` 方法轉發的值。" -#: ../../library/ast.rst:2345 +#: ../../library/ast.rst:2313 msgid "" "This class is meant to be subclassed, with the subclass adding visitor " "methods." msgstr "這個類別應該被子類別化,子類別新增訪問者方法。" -#: ../../library/ast.rst:2350 +#: ../../library/ast.rst:2318 msgid "" "Visit a node. The default implementation calls the method called :samp:" "`self.visit_{classname}` where *classname* is the name of the node class, " @@ -4030,11 +4128,11 @@ msgstr "" "*classname* 是節點類別的名稱,或者在該方法不存在時呼叫 :meth:" "`generic_visit`。" -#: ../../library/ast.rst:2356 +#: ../../library/ast.rst:2324 msgid "This visitor calls :meth:`visit` on all children of the node." msgstr "該訪問者對該節點的所有子節點呼叫 :meth:`visit`。" -#: ../../library/ast.rst:2358 +#: ../../library/ast.rst:2326 msgid "" "Note that child nodes of nodes that have a custom visitor method won't be " "visited unless the visitor calls :meth:`generic_visit` or visits them itself." @@ -4042,11 +4140,11 @@ msgstr "" "請注意,除非訪問者呼叫 :meth:`generic_visit` 或訪問它們本身,否則不會訪問具有" "自定義訪問者方法的節點之子節點。" -#: ../../library/ast.rst:2364 +#: ../../library/ast.rst:2332 msgid "Handles all constant nodes." msgstr "處理所有常數節點。" -#: ../../library/ast.rst:2366 +#: ../../library/ast.rst:2334 msgid "" "Don't use the :class:`NodeVisitor` if you want to apply changes to nodes " "during traversal. For this a special visitor exists (:class:" @@ -4056,7 +4154,7 @@ msgstr "" "`NodeVisitor`。為此,有個允許修改的特殊遍歷訪問者工具 :class:" "`NodeTransformer`。" -#: ../../library/ast.rst:2372 +#: ../../library/ast.rst:2340 msgid "" "Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!visit_Bytes`, :meth:" "`!visit_NameConstant` and :meth:`!visit_Ellipsis` are deprecated now and " @@ -4067,13 +4165,13 @@ msgstr "" "visit_NameConstant` 和 :meth:`!visit_Ellipsis` 方法現已棄用,並且不會在未來的" "Python 版本中被呼叫。新增 :meth:`visit_Constant` 方法來處理所有常數節點。" -#: ../../library/ast.rst:2380 +#: ../../library/ast.rst:2348 msgid "" "A :class:`NodeVisitor` subclass that walks the abstract syntax tree and " "allows modification of nodes." msgstr "一個 :class:`NodeVisitor` 子類別,它會遍歷抽象語法樹並允許修改節點。" -#: ../../library/ast.rst:2383 +#: ../../library/ast.rst:2351 msgid "" "The :class:`NodeTransformer` will walk the AST and use the return value of " "the visitor methods to replace or remove the old node. If the return value " @@ -4085,7 +4183,7 @@ msgstr "" "點。如果訪問者方法的回傳值為 ``None``,則該節點將從其位置中刪除,否則將被替換" "為回傳值。回傳值可能是原始節點,在這種情況下不會發生替換。" -#: ../../library/ast.rst:2389 +#: ../../library/ast.rst:2357 msgid "" "Here is an example transformer that rewrites all occurrences of name lookups " "(``foo``) to ``data['foo']``::" @@ -4093,7 +4191,7 @@ msgstr "" "下面是一個示範用的 transformer,它將查找所有出現名稱 (``foo``) 並改寫為 " "``data['foo']``: ::" -#: ../../library/ast.rst:2392 +#: ../../library/ast.rst:2360 msgid "" "class RewriteName(NodeTransformer):\n" "\n" @@ -4113,7 +4211,7 @@ msgstr "" " ctx=node.ctx\n" " )" -#: ../../library/ast.rst:2401 +#: ../../library/ast.rst:2369 msgid "" "Keep in mind that if the node you're operating on has child nodes you must " "either transform the child nodes yourself or call the :meth:`~ast." @@ -4122,7 +4220,7 @@ msgstr "" "請記住,如果你正在操作的節點有子節點,你必須自己轉換子節點或先呼叫該節點的 :" "meth:`~ast.NodeVisitor.generic_visit` 方法。" -#: ../../library/ast.rst:2405 +#: ../../library/ast.rst:2373 msgid "" "For nodes that were part of a collection of statements (that applies to all " "statement nodes), the visitor may also return a list of nodes rather than " @@ -4131,7 +4229,7 @@ msgstr "" "對於屬於陳述式總集 (collection) 一部分的節點(適用於所有陳述式節點),訪問者" "還可以回傳節點串列,而不僅僅是單個節點。" -#: ../../library/ast.rst:2409 +#: ../../library/ast.rst:2377 msgid "" "If :class:`NodeTransformer` introduces new nodes (that weren't part of " "original tree) without giving them location information (such as :attr:`~ast." @@ -4142,7 +4240,7 @@ msgstr "" "它們提供位置資訊(例如 :attr:`~ast.AST.lineno`\\ ),則應使用新的子樹呼叫 :" "func:`fix_missing_locations` 以重新計算位置資訊: ::" -#: ../../library/ast.rst:2414 +#: ../../library/ast.rst:2382 msgid "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" @@ -4150,15 +4248,15 @@ msgstr "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" -#: ../../library/ast.rst:2417 +#: ../../library/ast.rst:2385 msgid "Usually you use the transformer like this::" msgstr "你通常會像這樣使用 transformer: ::" -#: ../../library/ast.rst:2419 +#: ../../library/ast.rst:2387 msgid "node = YourTransformer().visit(node)" msgstr "node = YourTransformer().visit(node)" -#: ../../library/ast.rst:2424 +#: ../../library/ast.rst:2392 msgid "" "Return a formatted dump of the tree in *node*. This is mainly useful for " "debugging purposes. If *annotate_fields* is true (by default), the returned " @@ -4174,7 +4272,7 @@ msgstr "" "潔。預設情況下,不會傾印列號和行偏移量等屬性。如果需要,可以設定 " "*include_attributes* 為 true。" -#: ../../library/ast.rst:2432 +#: ../../library/ast.rst:2400 msgid "" "If *indent* is a non-negative integer or string, then the tree will be " "pretty-printed with that indent level. An indent level of 0, negative, or " @@ -4188,21 +4286,85 @@ msgstr "" "(預設值)代表選擇單列表示。使用正整數縮排可以在每個級別縮排相同數量的空格。" "如果 *indent* 是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個級別。" -#: ../../library/ast.rst:2439 +#: ../../library/ast.rst:2407 +msgid "" +"If *show_empty* is ``False`` (the default), empty lists and fields that are " +"``None`` will be omitted from the output." +msgstr "" + +#: ../../library/ast.rst:2410 msgid "Added the *indent* option." msgstr "新增 *indent* 選項。" -#: ../../library/ast.rst:2446 +#: ../../library/ast.rst:2413 +#, fuzzy +msgid "Added the *show_empty* option." +msgstr "新增 *indent* 選項。" + +#: ../../library/ast.rst:2416 +#, fuzzy +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\\\n" +"... async def f():\n" +"... await other_func()\n" +"... \"\"\"), indent=4, show_empty=True))\n" +"Module(\n" +" body=[\n" +" AsyncFunctionDef(\n" +" name='f',\n" +" args=arguments(\n" +" posonlyargs=[],\n" +" args=[],\n" +" kwonlyargs=[],\n" +" kw_defaults=[],\n" +" defaults=[]),\n" +" body=[\n" +" Expr(\n" +" value=Await(\n" +" value=Call(\n" +" func=Name(id='other_func', ctx=Load()),\n" +" args=[],\n" +" keywords=[])))],\n" +" decorator_list=[],\n" +" type_params=[])],\n" +" type_ignores=[])" +msgstr "" +">>> print(ast.dump(ast.parse(\"\"\"\\\n" +"... async def f():\n" +"... await other_func()\n" +"... \"\"\"), indent=4))\n" +"Module(\n" +" body=[\n" +" AsyncFunctionDef(\n" +" name='f',\n" +" args=arguments(\n" +" posonlyargs=[],\n" +" args=[],\n" +" kwonlyargs=[],\n" +" kw_defaults=[],\n" +" defaults=[]),\n" +" body=[\n" +" Expr(\n" +" value=Await(\n" +" value=Call(\n" +" func=Name(id='other_func', ctx=Load()),\n" +" args=[],\n" +" keywords=[])))],\n" +" decorator_list=[],\n" +" type_params=[])],\n" +" type_ignores=[])" + +#: ../../library/ast.rst:2447 msgid "Compiler Flags" msgstr "編譯器旗標" -#: ../../library/ast.rst:2448 +#: ../../library/ast.rst:2449 msgid "" "The following flags may be passed to :func:`compile` in order to change " "effects on the compilation of a program:" msgstr "可以將以下旗標傳遞給 :func:`compile` 以變更對程式的編譯效果:" -#: ../../library/ast.rst:2453 +#: ../../library/ast.rst:2454 msgid "" "Enables support for top-level ``await``, ``async for``, ``async with`` and " "async comprehensions." @@ -4210,13 +4372,19 @@ msgstr "" "啟用對最高階 ``await``、``async for``、``async with`` 和非同步綜合運算的支" "援。" -#: ../../library/ast.rst:2460 +#: ../../library/ast.rst:2461 msgid "" "Generates and returns an abstract syntax tree instead of returning a " "compiled code object." msgstr "生成並回傳抽象語法樹,而不是回傳已編譯的程式碼物件。" -#: ../../library/ast.rst:2465 +#: ../../library/ast.rst:2466 +msgid "" +"The returned AST is optimized according to the *optimize* argument in :func:" +"`compile` or :func:`ast.parse`." +msgstr "" + +#: ../../library/ast.rst:2473 msgid "" "Enables support for :pep:`484` and :pep:`526` style type comments (``# type: " "``, ``# type: ignore ``)." @@ -4224,47 +4392,47 @@ msgstr "" "啟用對 :pep:`484` 和 :pep:`526` 樣式型別註釋的支援 (``# type: ``, ``# " "type: ignore ``)。" -#: ../../library/ast.rst:2474 +#: ../../library/ast.rst:2482 msgid "Command-Line Usage" msgstr "命令列用法" -#: ../../library/ast.rst:2478 +#: ../../library/ast.rst:2486 msgid "" "The :mod:`ast` module can be executed as a script from the command line. It " "is as simple as:" msgstr ":mod:`ast` 模組可以作為腳本從命令列執行,可以像這樣簡單地做到:" -#: ../../library/ast.rst:2481 +#: ../../library/ast.rst:2489 msgid "python -m ast [-m ] [-a] [infile]" msgstr "python -m ast [-m ] [-a] [infile]" -#: ../../library/ast.rst:2485 +#: ../../library/ast.rst:2493 msgid "The following options are accepted:" msgstr "以下選項可被接受:" -#: ../../library/ast.rst:2491 +#: ../../library/ast.rst:2499 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/ast.rst:2496 +#: ../../library/ast.rst:2504 msgid "" "Specify what kind of code must be compiled, like the *mode* argument in :" "func:`parse`." msgstr "指定必須編譯哪種類型的程式碼,像是 :func:`parse` 中的 *mode* 引數。" -#: ../../library/ast.rst:2501 +#: ../../library/ast.rst:2509 msgid "Don't parse type comments." msgstr "不要剖析型別註解。" -#: ../../library/ast.rst:2505 +#: ../../library/ast.rst:2513 msgid "Include attributes such as line numbers and column offsets." msgstr "包括列號和行偏移量等屬性。" -#: ../../library/ast.rst:2510 +#: ../../library/ast.rst:2518 msgid "Indentation of nodes in AST (number of spaces)." msgstr "AST 中節點的縮進(空格數)。" -#: ../../library/ast.rst:2512 +#: ../../library/ast.rst:2520 msgid "" "If :file:`infile` is specified its contents are parsed to AST and dumped to " "stdout. Otherwise, the content is read from stdin." @@ -4272,7 +4440,7 @@ msgstr "" "如果指定了 :file:`infile`,則其內容將被剖析為 AST 並傾印 (dump) 到 stdout。否" "則會從 stdin 讀取內容。" -#: ../../library/ast.rst:2518 +#: ../../library/ast.rst:2526 msgid "" "`Green Tree Snakes `_, an external " "documentation resource, has good details on working with Python ASTs." @@ -4280,7 +4448,7 @@ msgstr "" "`Green Tree Snakes `_ 是一個外部文件" "資源,提供了有關使用 Python AST 的詳細資訊。" -#: ../../library/ast.rst:2521 +#: ../../library/ast.rst:2529 msgid "" "`ASTTokens `_ " "annotates Python ASTs with the positions of tokens and text in the source " @@ -4291,7 +4459,7 @@ msgstr "" "用生成它們的原始碼中的標記和文本的位置來註釋 Python AST。這對於進行原始碼轉換" "的工具很有幫助。" -#: ../../library/ast.rst:2526 +#: ../../library/ast.rst:2534 msgid "" "`leoAst.py `_ unifies the token-based and parse-tree-based views of python programs " @@ -4301,7 +4469,7 @@ msgstr "" "py>`_ 透過在 token 和 ast 節點之間插入雙向鏈結,統一了 python 程式的基於 " "token 和基於剖析樹的視圖。" -#: ../../library/ast.rst:2531 +#: ../../library/ast.rst:2539 msgid "" "`LibCST `_ parses code as a Concrete Syntax " "Tree that looks like an ast tree and keeps all formatting details. It's " @@ -4311,7 +4479,7 @@ msgstr "" "(Concrete Syntax Tree),看起來像 ast 樹並保留所有格式詳細資訊。它對於建置自動" "重構 (codemod) 應用程式和 linter 非常有用。" -#: ../../library/ast.rst:2536 +#: ../../library/ast.rst:2544 msgid "" "`Parso `_ is a Python parser that supports " "error recovery and round-trip parsing for different Python versions (in " @@ -4333,3 +4501,35 @@ msgstr "於 AST 文法中" #: ../../library/ast.rst:60 msgid "* (asterisk)" msgstr "* (星號)" + +#~ msgid "" +#~ "node = ast.UnaryOp()\n" +#~ "node.op = ast.USub()\n" +#~ "node.operand = ast.Constant()\n" +#~ "node.operand.value = 5\n" +#~ "node.operand.lineno = 0\n" +#~ "node.operand.col_offset = 0\n" +#~ "node.lineno = 0\n" +#~ "node.col_offset = 0" +#~ msgstr "" +#~ "node = ast.UnaryOp()\n" +#~ "node.op = ast.USub()\n" +#~ "node.operand = ast.Constant()\n" +#~ "node.operand.value = 5\n" +#~ "node.operand.lineno = 0\n" +#~ "node.operand.col_offset = 0\n" +#~ "node.lineno = 0\n" +#~ "node.col_offset = 0" + +#~ msgid "or the more compact ::" +#~ msgstr "或更簡潔的: ::" + +#~ msgid "" +#~ "A :class:`typing.ParamSpec`. ``name`` is the name of the parameter " +#~ "specification." +#~ msgstr "A :class:`typing.ParamSpec`。``name`` 是參數規範的名稱。" + +#~ msgid "" +#~ "A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable " +#~ "tuple." +#~ msgstr "一個 :class:`typing.TypeVarTuple`。``name`` 是型別變數元組的名稱。" diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index eb903e4cdf..3e07964e9d 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-02-20 12:36+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -296,8 +296,8 @@ msgid "" msgstr "請注意,使用 :func:`asyncio.run` 時不需要呼叫此函式。" #: ../../library/asyncio-eventloop.rst:176 -#: ../../library/asyncio-eventloop.rst:1253 -#: ../../library/asyncio-eventloop.rst:1671 +#: ../../library/asyncio-eventloop.rst:1269 +#: ../../library/asyncio-eventloop.rst:1712 msgid "Example::" msgstr "範例: ::" @@ -647,8 +647,8 @@ msgid "The socket type will be :py:const:`~socket.SOCK_STREAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_STREAM`。" #: ../../library/asyncio-eventloop.rst:412 -#: ../../library/asyncio-eventloop.rst:1164 #: ../../library/asyncio-eventloop.rst:1180 +#: ../../library/asyncio-eventloop.rst:1196 msgid "" "*protocol_factory* must be a callable returning an :ref:`asyncio protocol " "` implementation." @@ -788,7 +788,7 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:482 #: ../../library/asyncio-eventloop.rst:597 -#: ../../library/asyncio-eventloop.rst:825 +#: ../../library/asyncio-eventloop.rst:841 msgid "" "The *sock* argument transfers ownership of the socket to the transport " "created. To close the socket, call the transport's :meth:`~asyncio." @@ -808,7 +808,7 @@ msgstr "" "式類似於 *host* 和 *port*。" #: ../../library/asyncio-eventloop.rst:490 -#: ../../library/asyncio-eventloop.rst:919 +#: ../../library/asyncio-eventloop.rst:935 msgid "" "*ssl_handshake_timeout* is (for a TLS connection) the time in seconds to " "wait for the TLS handshake to complete before aborting the connection. " @@ -819,9 +819,9 @@ msgstr "" "秒。" #: ../../library/asyncio-eventloop.rst:494 -#: ../../library/asyncio-eventloop.rst:742 -#: ../../library/asyncio-eventloop.rst:836 -#: ../../library/asyncio-eventloop.rst:923 +#: ../../library/asyncio-eventloop.rst:750 +#: ../../library/asyncio-eventloop.rst:852 +#: ../../library/asyncio-eventloop.rst:939 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " @@ -845,7 +845,7 @@ msgstr "" "包含所有例外的 ``ExceptionGroup`` (即使只有一個例外)。" #: ../../library/asyncio-eventloop.rst:508 -#: ../../library/asyncio-eventloop.rst:754 +#: ../../library/asyncio-eventloop.rst:762 msgid "Added support for SSL/TLS in :class:`ProactorEventLoop`." msgstr "新增 :class:`ProactorEventLoop` 中的 SSL/TLS 支援。" @@ -858,7 +858,7 @@ msgstr "" "socket 選項。" #: ../../library/asyncio-eventloop.rst:517 -#: ../../library/asyncio-eventloop.rst:846 +#: ../../library/asyncio-eventloop.rst:862 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "增加 *ssl_handshake_timeout* 參數。" @@ -888,10 +888,10 @@ msgstr "更多資訊請見: https://datatracker.ietf.org/doc/html/rfc6555" #: ../../library/asyncio-eventloop.rst:536 #: ../../library/asyncio-eventloop.rst:660 -#: ../../library/asyncio-eventloop.rst:768 -#: ../../library/asyncio-eventloop.rst:803 -#: ../../library/asyncio-eventloop.rst:850 -#: ../../library/asyncio-eventloop.rst:931 +#: ../../library/asyncio-eventloop.rst:776 +#: ../../library/asyncio-eventloop.rst:815 +#: ../../library/asyncio-eventloop.rst:866 +#: ../../library/asyncio-eventloop.rst:947 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "增加 *ssl_shutdown_timeout* 參數。" @@ -927,8 +927,8 @@ msgid "The socket type will be :py:const:`~socket.SOCK_DGRAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_DGRAM`。" #: ../../library/asyncio-eventloop.rst:561 -#: ../../library/asyncio-eventloop.rst:685 -#: ../../library/asyncio-eventloop.rst:817 +#: ../../library/asyncio-eventloop.rst:686 +#: ../../library/asyncio-eventloop.rst:833 msgid "" "*protocol_factory* must be a callable returning a :ref:`protocol ` implementation." @@ -1085,8 +1085,8 @@ msgstr "" "有關此方法的引數資訊,請參閱 :meth:`loop.create_connection` 方法的文件。" #: ../../library/asyncio-eventloop.rst:652 -#: ../../library/asyncio-eventloop.rst:794 -#: ../../library/asyncio-eventloop.rst:1233 +#: ../../library/asyncio-eventloop.rst:806 +#: ../../library/asyncio-eventloop.rst:1249 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" @@ -1102,7 +1102,7 @@ msgstr "" msgid "Creating network servers" msgstr "建立網路伺服器" -#: ../../library/asyncio-eventloop.rst:678 +#: ../../library/asyncio-eventloop.rst:679 msgid "" "Create a TCP server (socket type :const:`~socket.SOCK_STREAM`) listening on " "*port* of the *host* address." @@ -1110,33 +1110,33 @@ msgstr "" "建立一個 TCP 伺服器(socket 類型 :const:`~socket.SOCK_STREAM`\\ ),監聽 " "*host* 位址的 *port*。" -#: ../../library/asyncio-eventloop.rst:681 +#: ../../library/asyncio-eventloop.rst:682 msgid "Returns a :class:`Server` object." msgstr "回傳一個 :class:`Server` 物件。" -#: ../../library/asyncio-eventloop.rst:683 +#: ../../library/asyncio-eventloop.rst:684 msgid "Arguments:" msgstr "引數:" -#: ../../library/asyncio-eventloop.rst:688 +#: ../../library/asyncio-eventloop.rst:689 msgid "" "The *host* parameter can be set to several types which determine where the " "server would be listening:" msgstr "可以將 *host* 參數設為幾種類型,以確定伺服器將監聽的位置:" -#: ../../library/asyncio-eventloop.rst:691 +#: ../../library/asyncio-eventloop.rst:692 msgid "" "If *host* is a string, the TCP server is bound to a single network interface " "specified by *host*." msgstr "如果 *host* 是字串,則 TCP 伺服器綁定到由 *host* 指定的單個網路介面。" -#: ../../library/asyncio-eventloop.rst:694 +#: ../../library/asyncio-eventloop.rst:695 msgid "" "If *host* is a sequence of strings, the TCP server is bound to all network " "interfaces specified by the sequence." msgstr "如果 *host* 是字串序列,則 TCP 伺服器綁定到序列指定的所有網路介面。" -#: ../../library/asyncio-eventloop.rst:697 +#: ../../library/asyncio-eventloop.rst:698 msgid "" "If *host* is an empty string or ``None``, all interfaces are assumed and a " "list of multiple sockets will be returned (most likely one for IPv4 and " @@ -1145,7 +1145,7 @@ msgstr "" "若 *host* 是空字串或 ``None``,則所有介面都被假定並回傳多個 socket 的清單(可" "能一個用於 IPv4,另一個用於 IPv6)。" -#: ../../library/asyncio-eventloop.rst:701 +#: ../../library/asyncio-eventloop.rst:702 msgid "" "The *port* parameter can be set to specify which port the server should " "listen on. If ``0`` or ``None`` (the default), a random unused port will be " @@ -1156,7 +1156,7 @@ msgstr "" "設值),將隨機選擇一個未使用的埠(請注意,如果 *host* 解析為多個網路介面,將" "為每個介面隨機選擇不同的隨機埠)。" -#: ../../library/asyncio-eventloop.rst:706 +#: ../../library/asyncio-eventloop.rst:707 msgid "" "*family* can be set to either :const:`socket.AF_INET` or :const:`~socket." "AF_INET6` to force the socket to use IPv4 or IPv6. If not set, the *family* " @@ -1166,11 +1166,11 @@ msgstr "" "制使用 IPv4 或 IPv6。如果未設定,*family* 將從主機名稱決定(預設為 :const:" "`~socket.AF_UNSPEC`\\ )。" -#: ../../library/asyncio-eventloop.rst:711 +#: ../../library/asyncio-eventloop.rst:712 msgid "*flags* is a bitmask for :meth:`getaddrinfo`." msgstr "*flags* 是 :meth:`getaddrinfo` 的位元遮罩。" -#: ../../library/asyncio-eventloop.rst:713 +#: ../../library/asyncio-eventloop.rst:714 msgid "" "*sock* can optionally be specified in order to use a preexisting socket " "object. If specified, *host* and *port* must not be specified." @@ -1178,7 +1178,7 @@ msgstr "" "可以可選地指定 *sock* 以使用現有的 socket 物件。如果指定了,*host* 和 *port* " "不能指定。" -#: ../../library/asyncio-eventloop.rst:718 +#: ../../library/asyncio-eventloop.rst:719 msgid "" "The *sock* argument transfers ownership of the socket to the server created. " "To close the socket, call the server's :meth:`~asyncio.Server.close` method." @@ -1186,7 +1186,7 @@ msgstr "" "*sock* 引數將 socket 的所有權轉移給建立的伺服器。要關閉 socket,請呼叫伺服器" "的 :meth:`~asyncio.Server.close` 方法。" -#: ../../library/asyncio-eventloop.rst:722 +#: ../../library/asyncio-eventloop.rst:723 msgid "" "*backlog* is the maximum number of queued connections passed to :meth:" "`~socket.socket.listen` (defaults to 100)." @@ -1194,14 +1194,14 @@ msgstr "" "*backlog* 是傳遞給 :meth:`~socket.socket.listen` 的最大佇列連線數(預設為 " "100)。" -#: ../../library/asyncio-eventloop.rst:725 +#: ../../library/asyncio-eventloop.rst:726 msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` instance to enable TLS over " "the accepted connections." msgstr "" "*ssl* 可以設定為 :class:`~ssl.SSLContext` 實例以在接受的連線上啟用 TLS。" -#: ../../library/asyncio-eventloop.rst:728 +#: ../../library/asyncio-eventloop.rst:729 msgid "" "*reuse_address* tells the kernel to reuse a local socket in ``TIME_WAIT`` " "state, without waiting for its natural timeout to expire. If not specified " @@ -1210,7 +1210,7 @@ msgstr "" "*reuse_address* 告訴內核重用 ``TIME_WAIT`` 狀態下的本地 socket,而不等待其自" "然超時過期。如果未指定,在 Unix 上將自動設置為 ``True``。" -#: ../../library/asyncio-eventloop.rst:733 +#: ../../library/asyncio-eventloop.rst:734 msgid "" "*reuse_port* tells the kernel to allow this endpoint to be bound to the same " "port as other existing endpoints are bound to, so long as they all set this " @@ -1219,7 +1219,18 @@ msgstr "" "*reuse_port* 告訴內核允許此端點繫結到與其他現有端點繫結的相同埠,只要它們在建" "立時都設置了此旗標。此選項在旗標 Windows 上不受支援。" -#: ../../library/asyncio-eventloop.rst:738 +#: ../../library/asyncio-eventloop.rst:739 +msgid "" +"*keep_alive* set to ``True`` keeps connections active by enabling the " +"periodic transmission of messages." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:744 +#, fuzzy +msgid "Added the *keep_alive* parameter." +msgstr "加入 *name* 參數。" + +#: ../../library/asyncio-eventloop.rst:746 msgid "" "*ssl_handshake_timeout* is (for a TLS server) the time in seconds to wait " "for the TLS handshake to complete before aborting the connection. ``60.0`` " @@ -1228,7 +1239,7 @@ msgstr "" "(對於 TLS 伺服器)\\ *ssl_handshake_timeout* 是在中斷連線之前等待 TLS 握手完" "成的時間(以秒為單位)。如果為 ``None``\\ (預設),則為 ``60.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:746 +#: ../../library/asyncio-eventloop.rst:754 msgid "" "*start_serving* set to ``True`` (the default) causes the created server to " "start accepting connections immediately. When set to ``False``, the user " @@ -1239,11 +1250,11 @@ msgstr "" "接。當設置為 ``False`` 時,用戶應該等待 :meth:`Server.start_serving` 或 :" "meth:`Server.serve_forever` 來使伺服器開始接受連線。" -#: ../../library/asyncio-eventloop.rst:758 +#: ../../library/asyncio-eventloop.rst:766 msgid "The *host* parameter can be a sequence of strings." msgstr "*host* 參數可以是字串序列。" -#: ../../library/asyncio-eventloop.rst:762 +#: ../../library/asyncio-eventloop.rst:770 msgid "" "Added *ssl_handshake_timeout* and *start_serving* parameters. The socket " "option :ref:`socket.TCP_NODELAY ` is set by default " @@ -1252,7 +1263,7 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。所有 TCP 連線都預設有 :" "ref:`socket.TCP_NODELAY ` socket 選項。" -#: ../../library/asyncio-eventloop.rst:772 +#: ../../library/asyncio-eventloop.rst:780 msgid "" "The :func:`start_server` function is a higher-level alternative API that " "returns a pair of :class:`StreamReader` and :class:`StreamWriter` that can " @@ -1261,7 +1272,7 @@ msgstr "" ":func:`start_server` 函式是一個更高階的替代 API,它回傳一對 :class:" "`StreamReader` 和 :class:`StreamWriter`,可以在 async/await 程式碼中使用。" -#: ../../library/asyncio-eventloop.rst:783 +#: ../../library/asyncio-eventloop.rst:791 msgid "" "Similar to :meth:`loop.create_server` but works with the :py:const:`~socket." "AF_UNIX` socket family." @@ -1269,7 +1280,7 @@ msgstr "" "類似 :meth:`loop.create_server`,但適用於 :py:const:`~socket.AF_UNIX` socket " "家族。" -#: ../../library/asyncio-eventloop.rst:786 +#: ../../library/asyncio-eventloop.rst:794 msgid "" "*path* is the name of a Unix domain socket, and is required, unless a *sock* " "argument is provided. Abstract Unix sockets, :class:`str`, :class:`bytes`, " @@ -1279,13 +1290,20 @@ msgstr "" "象 Unix sockets、:class:`str`、:class:`bytes` 和 :class:`~pathlib.Path` 路" "徑。" -#: ../../library/asyncio-eventloop.rst:791 +#: ../../library/asyncio-eventloop.rst:799 +msgid "" +"If *cleanup_socket* is true then the Unix socket will automatically be " +"removed from the filesystem when the server is closed, unless the socket has " +"been replaced after the server has been created." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:803 msgid "" "See the documentation of the :meth:`loop.create_server` method for " "information about arguments to this method." msgstr "有關此方法的引數資訊,請參閱 :meth:`loop.create_server` 方法的文件。" -#: ../../library/asyncio-eventloop.rst:798 +#: ../../library/asyncio-eventloop.rst:810 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :class:`~pathlib.Path` object." @@ -1293,22 +1311,27 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。*path* 參數現在可為一" "個 :class:`~pathlib.Path` 物件。" -#: ../../library/asyncio-eventloop.rst:810 +#: ../../library/asyncio-eventloop.rst:819 +#, fuzzy +msgid "Added the *cleanup_socket* parameter." +msgstr "加入 *context* 參數。" + +#: ../../library/asyncio-eventloop.rst:826 msgid "Wrap an already accepted connection into a transport/protocol pair." msgstr "將已接受的連線包裝成傳輸層/協議對。" -#: ../../library/asyncio-eventloop.rst:812 +#: ../../library/asyncio-eventloop.rst:828 msgid "" "This method can be used by servers that accept connections outside of " "asyncio but that use asyncio to handle them." msgstr "此方法可以由在 asyncio 外接受連線但使用 asyncio 處理連線的伺服器使用。" -#: ../../library/asyncio-eventloop.rst:815 -#: ../../library/asyncio-eventloop.rst:905 +#: ../../library/asyncio-eventloop.rst:831 +#: ../../library/asyncio-eventloop.rst:921 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-eventloop.rst:820 +#: ../../library/asyncio-eventloop.rst:836 msgid "" "*sock* is a preexisting socket object returned from :meth:`socket.accept " "`." @@ -1316,13 +1339,13 @@ msgstr "" "*sock* 是從 :meth:`socket.accept ` 回傳的預先存在的 " "socket 物件。" -#: ../../library/asyncio-eventloop.rst:829 +#: ../../library/asyncio-eventloop.rst:845 msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` to enable SSL over the " "accepted connections." msgstr "*ssl* 可以設置為 :class:`~ssl.SSLContext` 以在已接受的連線上啟用 SSL。" -#: ../../library/asyncio-eventloop.rst:832 +#: ../../library/asyncio-eventloop.rst:848 msgid "" "*ssl_handshake_timeout* is (for an SSL connection) the time in seconds to " "wait for the SSL handshake to complete before aborting the connection. " @@ -1331,29 +1354,29 @@ msgstr "" "(對於 SSL 連線)\\ *ssl_handshake_timeout* 是在中斷連線之前等待 SSL 握手完成" "的時間(以秒為單位)。如果為 ``None``\\ (預設),則為 ``60.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:840 +#: ../../library/asyncio-eventloop.rst:856 msgid "Returns a ``(transport, protocol)`` pair." msgstr "回傳 ``(transport, protocol)`` 對。" -#: ../../library/asyncio-eventloop.rst:854 +#: ../../library/asyncio-eventloop.rst:870 msgid "Transferring files" msgstr "傳輸檔案" -#: ../../library/asyncio-eventloop.rst:859 +#: ../../library/asyncio-eventloop.rst:875 msgid "" "Send a *file* over a *transport*. Return the total number of bytes sent." msgstr "通過 *transport* 發送 *file*。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:862 +#: ../../library/asyncio-eventloop.rst:878 msgid "The method uses high-performance :meth:`os.sendfile` if available." msgstr "如果可用,該方法使用高性能 :meth:`os.sendfile`。" -#: ../../library/asyncio-eventloop.rst:864 +#: ../../library/asyncio-eventloop.rst:880 msgid "*file* must be a regular file object opened in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:866 -#: ../../library/asyncio-eventloop.rst:1111 +#: ../../library/asyncio-eventloop.rst:882 +#: ../../library/asyncio-eventloop.rst:1127 msgid "" "*offset* tells from where to start reading the file. If specified, *count* " "is the total number of bytes to transmit as opposed to sending the file " @@ -1365,7 +1388,7 @@ msgstr "" "不是發送檔案直到達到 EOF。即使此方法引發錯誤時,檔案位置也始終更新,可以使" "用 :meth:`file.tell() ` 取得實際發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:873 +#: ../../library/asyncio-eventloop.rst:889 msgid "" "*fallback* set to ``True`` makes asyncio to manually read and send the file " "when the platform does not support the sendfile system call (e.g. Windows or " @@ -1374,7 +1397,7 @@ msgstr "" "將 *fallback* 設置為 ``True`` 會使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:877 +#: ../../library/asyncio-eventloop.rst:893 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support the " "*sendfile* syscall and *fallback* is ``False``." @@ -1382,15 +1405,15 @@ msgstr "" "如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,則引發 :exc:" "`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:884 +#: ../../library/asyncio-eventloop.rst:900 msgid "TLS Upgrade" msgstr "TLS 升級" -#: ../../library/asyncio-eventloop.rst:891 +#: ../../library/asyncio-eventloop.rst:907 msgid "Upgrade an existing transport-based connection to TLS." msgstr "將基於傳輸的現有連線升級到 TLS。" -#: ../../library/asyncio-eventloop.rst:893 +#: ../../library/asyncio-eventloop.rst:909 msgid "" "Create a TLS coder/decoder instance and insert it between the *transport* " "and the *protocol*. The coder/decoder implements both *transport*-facing " @@ -1399,7 +1422,7 @@ msgstr "" "建立 TLS 編解碼器實例並在 *transport* 和 *protocol* 之間插入它。編解碼器既實" "作了對於 *transport* 的協議,也實作了對於 *protocol* 的傳輸。" -#: ../../library/asyncio-eventloop.rst:897 +#: ../../library/asyncio-eventloop.rst:913 msgid "" "Return the created two-interface instance. After *await*, the *protocol* " "must stop using the original *transport* and communicate with the returned " @@ -1410,13 +1433,13 @@ msgstr "" "*transport*,僅與回傳的物件通信,因為編碼器快取了 *protocol* 端的資料,並且" "與 *transport* 間歇性地交換額外的 TLS session 封包。" -#: ../../library/asyncio-eventloop.rst:902 +#: ../../library/asyncio-eventloop.rst:918 msgid "" "In some situations (e.g. when the passed transport is already closing) this " "may return ``None``." msgstr "在某些情況下(例如傳入的傳輸已經關閉),此函式可能回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:907 +#: ../../library/asyncio-eventloop.rst:923 msgid "" "*transport* and *protocol* instances that methods like :meth:`~loop." "create_server` and :meth:`~loop.create_connection` return." @@ -1424,11 +1447,11 @@ msgstr "" "*transport* 和 *protocol* 實例,由像 :meth:`~loop.create_server` 和 :meth:" "`~loop.create_connection` 等方法回傳。" -#: ../../library/asyncio-eventloop.rst:911 +#: ../../library/asyncio-eventloop.rst:927 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "*sslcontext*:配置好的 :class:`~ssl.SSLContext` 實例。" -#: ../../library/asyncio-eventloop.rst:913 +#: ../../library/asyncio-eventloop.rst:929 msgid "" "*server_side* pass ``True`` when a server-side connection is being upgraded " "(like the one created by :meth:`~loop.create_server`)." @@ -1436,17 +1459,17 @@ msgstr "" "當升級伺服器端連線時(像由 :meth:`~loop.create_server` 建立的那樣)傳遞 " "``True``。" -#: ../../library/asyncio-eventloop.rst:916 +#: ../../library/asyncio-eventloop.rst:932 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "*server_hostname*:設置或覆蓋將用於匹配目標伺服器憑證的主機名。" -#: ../../library/asyncio-eventloop.rst:936 +#: ../../library/asyncio-eventloop.rst:952 msgid "Watching file descriptors" msgstr "監視檔案描述器" -#: ../../library/asyncio-eventloop.rst:940 +#: ../../library/asyncio-eventloop.rst:956 msgid "" "Start monitoring the *fd* file descriptor for read availability and invoke " "*callback* with the specified arguments once *fd* is available for reading." @@ -1454,7 +1477,7 @@ msgstr "" "開始監視 *fd* 檔案描述器的讀取可用性,一但 *fd* 可讀取,使用指定引數呼叫 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:946 +#: ../../library/asyncio-eventloop.rst:962 msgid "" "Stop monitoring the *fd* file descriptor for read availability. Returns " "``True`` if *fd* was previously being monitored for reads." @@ -1462,7 +1485,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的讀取可用性。如果 *fd* 之前正在監視讀取,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:951 +#: ../../library/asyncio-eventloop.rst:967 msgid "" "Start monitoring the *fd* file descriptor for write availability and invoke " "*callback* with the specified arguments once *fd* is available for writing." @@ -1470,8 +1493,8 @@ msgstr "" "開始監視 *fd* 檔案描述器的寫入可用性,一旦 *fd* 可寫入,使用指定引數呼叫 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:955 -#: ../../library/asyncio-eventloop.rst:1220 +#: ../../library/asyncio-eventloop.rst:971 +#: ../../library/asyncio-eventloop.rst:1236 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *callback*." @@ -1479,7 +1502,7 @@ msgstr "" "使用 :func:`functools.partial` 向 *callback* :ref:`傳送關鍵字引數 `。" -#: ../../library/asyncio-eventloop.rst:960 +#: ../../library/asyncio-eventloop.rst:976 msgid "" "Stop monitoring the *fd* file descriptor for write availability. Returns " "``True`` if *fd* was previously being monitored for writes." @@ -1487,7 +1510,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的寫入可用性。如果 *fd* 之前正在監視寫入,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:963 +#: ../../library/asyncio-eventloop.rst:979 msgid "" "See also :ref:`Platform Support ` section for some " "limitations of these methods." @@ -1495,11 +1518,11 @@ msgstr "" "另請參閱\\ :ref:`平台支援 `\\ 部分以了解這些方法的" "一些限制。" -#: ../../library/asyncio-eventloop.rst:968 +#: ../../library/asyncio-eventloop.rst:984 msgid "Working with socket objects directly" msgstr "直接使用 socket 物件" -#: ../../library/asyncio-eventloop.rst:970 +#: ../../library/asyncio-eventloop.rst:986 msgid "" "In general, protocol implementations that use transport-based APIs such as :" "meth:`loop.create_connection` and :meth:`loop.create_server` are faster than " @@ -1511,7 +1534,7 @@ msgstr "" "`loop.create_server`\\ )的協議實作比直接使用 socket 的實作更快。然而在某些情" "況下性能不是關鍵,直接使用 :class:`~socket.socket` 物件更方便。" -#: ../../library/asyncio-eventloop.rst:979 +#: ../../library/asyncio-eventloop.rst:995 msgid "" "Receive up to *nbytes* from *sock*. Asynchronous version of :meth:`socket." "recv() `." @@ -1519,23 +1542,23 @@ msgstr "" "從 *sock* 接收最多 *nbytes*。:meth:`socket.recv() ` 的非" "同步版本。" -#: ../../library/asyncio-eventloop.rst:982 +#: ../../library/asyncio-eventloop.rst:998 msgid "Return the received data as a bytes object." msgstr "將接收到的資料作為 bytes 物件回傳。" -#: ../../library/asyncio-eventloop.rst:984 -#: ../../library/asyncio-eventloop.rst:998 -#: ../../library/asyncio-eventloop.rst:1009 -#: ../../library/asyncio-eventloop.rst:1021 -#: ../../library/asyncio-eventloop.rst:1036 -#: ../../library/asyncio-eventloop.rst:1051 -#: ../../library/asyncio-eventloop.rst:1061 -#: ../../library/asyncio-eventloop.rst:1087 -#: ../../library/asyncio-eventloop.rst:1125 +#: ../../library/asyncio-eventloop.rst:1000 +#: ../../library/asyncio-eventloop.rst:1014 +#: ../../library/asyncio-eventloop.rst:1025 +#: ../../library/asyncio-eventloop.rst:1037 +#: ../../library/asyncio-eventloop.rst:1052 +#: ../../library/asyncio-eventloop.rst:1067 +#: ../../library/asyncio-eventloop.rst:1077 +#: ../../library/asyncio-eventloop.rst:1103 +#: ../../library/asyncio-eventloop.rst:1141 msgid "*sock* must be a non-blocking socket." msgstr "*sock* 必須是非阻塞 socket。" -#: ../../library/asyncio-eventloop.rst:986 +#: ../../library/asyncio-eventloop.rst:1002 msgid "" "Even though this method was always documented as a coroutine method, " "releases before Python 3.7 returned a :class:`Future`. Since Python 3.7 this " @@ -1544,7 +1567,7 @@ msgstr "" "儘管此方法一直記錄為協程方法,但 Python 3.7 之前的版本回傳 :class:`Future`。" "自 Python 3.7 起,這是 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:993 +#: ../../library/asyncio-eventloop.rst:1009 msgid "" "Receive data from *sock* into the *buf* buffer. Modeled after the blocking :" "meth:`socket.recv_into() ` method." @@ -1552,11 +1575,11 @@ msgstr "" "從 *sock* 接收資料到 *buf* 緩衝區。仿照阻塞 :meth:`socket.recv_into() " "` 方法。" -#: ../../library/asyncio-eventloop.rst:996 +#: ../../library/asyncio-eventloop.rst:1012 msgid "Return the number of bytes written to the buffer." msgstr "回傳寫入緩衝區位元組的數目。" -#: ../../library/asyncio-eventloop.rst:1004 +#: ../../library/asyncio-eventloop.rst:1020 msgid "" "Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of :" "meth:`socket.recvfrom() `." @@ -1564,11 +1587,11 @@ msgstr "" "從 *sock* 接收最多 *bufsize* 大小的資料單元。:meth:`socket.recvfrom() " "` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1007 +#: ../../library/asyncio-eventloop.rst:1023 msgid "Return a tuple of (received data, remote address)." msgstr "回傳一個元組 (received data, remote address)。" -#: ../../library/asyncio-eventloop.rst:1015 +#: ../../library/asyncio-eventloop.rst:1031 msgid "" "Receive a datagram of up to *nbytes* from *sock* into *buf*. Asynchronous " "version of :meth:`socket.recvfrom_into() `." @@ -1576,11 +1599,11 @@ msgstr "" "從 *sock* 接收最多 *nbytes* 大小的資料單元到 *buf*。:meth:`socket." "recvfrom_into() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1019 +#: ../../library/asyncio-eventloop.rst:1035 msgid "Return a tuple of (number of bytes received, remote address)." msgstr "回傳一個元組 (number of bytes received, remote address)。" -#: ../../library/asyncio-eventloop.rst:1027 +#: ../../library/asyncio-eventloop.rst:1043 msgid "" "Send *data* to the *sock* socket. Asynchronous version of :meth:`socket." "sendall() `." @@ -1588,7 +1611,7 @@ msgstr "" "將 *data* 發送到 *sock* socket。:meth:`socket.sendall() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1030 +#: ../../library/asyncio-eventloop.rst:1046 msgid "" "This method continues to send to the socket until either all data in *data* " "has been sent or an error occurs. ``None`` is returned on success. On " @@ -1600,8 +1623,8 @@ msgstr "" "回傳 ``None``。錯誤時引發例外。此外,沒有辦法確定接收端成功處理了多少資料(如" "果有的話)。" -#: ../../library/asyncio-eventloop.rst:1038 -#: ../../library/asyncio-eventloop.rst:1089 +#: ../../library/asyncio-eventloop.rst:1054 +#: ../../library/asyncio-eventloop.rst:1105 msgid "" "Even though the method was always documented as a coroutine method, before " "Python 3.7 it returned a :class:`Future`. Since Python 3.7, this is an " @@ -1610,7 +1633,7 @@ msgstr "" "儘管該方法一直被記錄為協程方法,但在 Python 3.7 之前它回傳 :class:`Future`。" "從 Python 3.7 開始,這是一個 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:1045 +#: ../../library/asyncio-eventloop.rst:1061 msgid "" "Send a datagram from *sock* to *address*. Asynchronous version of :meth:" "`socket.sendto() `." @@ -1618,20 +1641,20 @@ msgstr "" "從 *sock* 向 *address* 發送一個資料單元。:meth:`socket.sendto() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1049 +#: ../../library/asyncio-eventloop.rst:1065 msgid "Return the number of bytes sent." msgstr "回傳發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:1057 +#: ../../library/asyncio-eventloop.rst:1073 msgid "Connect *sock* to a remote socket at *address*." msgstr "將 *sock* 連線到位於 *address* 的遠端 socket。" -#: ../../library/asyncio-eventloop.rst:1059 +#: ../../library/asyncio-eventloop.rst:1075 msgid "" "Asynchronous version of :meth:`socket.connect() `." msgstr ":meth:`socket.connect() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1063 +#: ../../library/asyncio-eventloop.rst:1079 msgid "" "``address`` no longer needs to be resolved. ``sock_connect`` will try to " "check if the *address* is already resolved by calling :func:`socket." @@ -1642,7 +1665,7 @@ msgstr "" "inet_pton` 檢查 *address* 是否已解析。如果沒有,將使用 :meth:`loop." "getaddrinfo` 解析 *address*。" -#: ../../library/asyncio-eventloop.rst:1072 +#: ../../library/asyncio-eventloop.rst:1088 msgid "" ":meth:`loop.create_connection` and :func:`asyncio.open_connection() " "`." @@ -1650,7 +1673,7 @@ msgstr "" ":meth:`loop.create_connection` 和 :func:`asyncio.open_connection() " "`。" -#: ../../library/asyncio-eventloop.rst:1078 +#: ../../library/asyncio-eventloop.rst:1094 msgid "" "Accept a connection. Modeled after the blocking :meth:`socket.accept() " "` method." @@ -1658,7 +1681,7 @@ msgstr "" "接受一個連線。模擬阻塞的 :meth:`socket.accept() ` 方" "法。" -#: ../../library/asyncio-eventloop.rst:1081 +#: ../../library/asyncio-eventloop.rst:1097 msgid "" "The socket must be bound to an address and listening for connections. The " "return value is a pair ``(conn, address)`` where *conn* is a *new* socket " @@ -1669,34 +1692,34 @@ msgstr "" "中 *conn* 是一個 *新* socket 物件,可在連線上發送和接收資料,*address* 是連接" "另一端對應的 socket 地址。" -#: ../../library/asyncio-eventloop.rst:1096 +#: ../../library/asyncio-eventloop.rst:1112 msgid ":meth:`loop.create_server` and :func:`start_server`." msgstr ":meth:`loop.create_server` 和 :func:`start_server`。" -#: ../../library/asyncio-eventloop.rst:1101 +#: ../../library/asyncio-eventloop.rst:1117 msgid "" "Send a file using high-performance :mod:`os.sendfile` if possible. Return " "the total number of bytes sent." msgstr "" "如果可行,使用高性能 :mod:`os.sendfile` 發送檔案。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:1104 +#: ../../library/asyncio-eventloop.rst:1120 msgid "" "Asynchronous version of :meth:`socket.sendfile() `." msgstr ":meth:`socket.sendfile() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1106 +#: ../../library/asyncio-eventloop.rst:1122 msgid "" "*sock* must be a non-blocking :const:`socket.SOCK_STREAM` :class:`~socket." "socket`." msgstr "" "*sock* 必須是非阻塞的 :const:`socket.SOCK_STREAM` :class:`~socket.socket`。" -#: ../../library/asyncio-eventloop.rst:1109 +#: ../../library/asyncio-eventloop.rst:1125 msgid "*file* must be a regular file object open in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:1118 +#: ../../library/asyncio-eventloop.rst:1134 msgid "" "*fallback*, when set to ``True``, makes asyncio manually read and send the " "file when the platform does not support the sendfile syscall (e.g. Windows " @@ -1705,7 +1728,7 @@ msgstr "" "當設置為 ``True`` 時,*fallback* 使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:1122 +#: ../../library/asyncio-eventloop.rst:1138 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support " "*sendfile* syscall and *fallback* is ``False``." @@ -1713,19 +1736,19 @@ msgstr "" "如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,引發 :exc:" "`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:1131 +#: ../../library/asyncio-eventloop.rst:1147 msgid "DNS" msgstr "DNS" -#: ../../library/asyncio-eventloop.rst:1136 +#: ../../library/asyncio-eventloop.rst:1152 msgid "Asynchronous version of :meth:`socket.getaddrinfo`." msgstr ":meth:`socket.getaddrinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1140 +#: ../../library/asyncio-eventloop.rst:1156 msgid "Asynchronous version of :meth:`socket.getnameinfo`." msgstr ":meth:`socket.getnameinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1143 +#: ../../library/asyncio-eventloop.rst:1159 msgid "" "Both *getaddrinfo* and *getnameinfo* internally utilize their synchronous " "versions through the loop's default thread pool executor. When this executor " @@ -1735,7 +1758,7 @@ msgid "" "executor with a larger number of workers." msgstr "" -#: ../../library/asyncio-eventloop.rst:1150 +#: ../../library/asyncio-eventloop.rst:1166 msgid "" "Both *getaddrinfo* and *getnameinfo* methods were always documented to " "return a coroutine, but prior to Python 3.7 they were, in fact, returning :" @@ -1746,19 +1769,19 @@ msgstr "" "它們實際上回傳 :class:`asyncio.Future` 物件。從 Python 3.7 開始,兩個方法都是" "協程。" -#: ../../library/asyncio-eventloop.rst:1158 +#: ../../library/asyncio-eventloop.rst:1174 msgid "Working with pipes" msgstr "使用管道" -#: ../../library/asyncio-eventloop.rst:1162 +#: ../../library/asyncio-eventloop.rst:1178 msgid "Register the read end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的讀取端。" -#: ../../library/asyncio-eventloop.rst:1167 +#: ../../library/asyncio-eventloop.rst:1183 msgid "*pipe* is a :term:`file-like object `." msgstr "*pipe* 是 :term:`類檔案物件 `。" -#: ../../library/asyncio-eventloop.rst:1169 +#: ../../library/asyncio-eventloop.rst:1185 msgid "" "Return pair ``(transport, protocol)``, where *transport* supports the :class:" "`ReadTransport` interface and *protocol* is an object instantiated by the " @@ -1767,22 +1790,22 @@ msgstr "" "回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" "`ReadTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1173 #: ../../library/asyncio-eventloop.rst:1189 +#: ../../library/asyncio-eventloop.rst:1205 msgid "" "With :class:`SelectorEventLoop` event loop, the *pipe* is set to non-" "blocking mode." msgstr "使用 :class:`SelectorEventLoop` 事件迴圈時,*pipe* 設置為非阻塞模式。" -#: ../../library/asyncio-eventloop.rst:1178 +#: ../../library/asyncio-eventloop.rst:1194 msgid "Register the write end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的寫入端。" -#: ../../library/asyncio-eventloop.rst:1183 +#: ../../library/asyncio-eventloop.rst:1199 msgid "*pipe* is :term:`file-like object `." msgstr "*pipe* 是 :term:`file-like object `。" -#: ../../library/asyncio-eventloop.rst:1185 +#: ../../library/asyncio-eventloop.rst:1201 msgid "" "Return pair ``(transport, protocol)``, where *transport* supports :class:" "`WriteTransport` interface and *protocol* is an object instantiated by the " @@ -1791,7 +1814,7 @@ msgstr "" "回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" "`WriteTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1194 +#: ../../library/asyncio-eventloop.rst:1210 msgid "" ":class:`SelectorEventLoop` does not support the above methods on Windows. " "Use :class:`ProactorEventLoop` instead for Windows." @@ -1799,20 +1822,20 @@ msgstr "" ":class:`SelectorEventLoop` 在 Windows 上不支援上述方法。對於 Windows 請使用 :" "class:`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1199 +#: ../../library/asyncio-eventloop.rst:1215 msgid "" "The :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods." msgstr ":meth:`loop.subprocess_exec` 和 :meth:`loop.subprocess_shell` 方法。" -#: ../../library/asyncio-eventloop.rst:1204 +#: ../../library/asyncio-eventloop.rst:1220 msgid "Unix signals" msgstr "Unix 訊號" -#: ../../library/asyncio-eventloop.rst:1210 +#: ../../library/asyncio-eventloop.rst:1226 msgid "Set *callback* as the handler for the *signum* signal." msgstr "將 *callback* 設置為 *signum* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1212 +#: ../../library/asyncio-eventloop.rst:1228 msgid "" "The callback will be invoked by *loop*, along with other queued callbacks " "and runnable coroutines of that event loop. Unlike signal handlers " @@ -1823,7 +1846,7 @@ msgstr "" "用 :func:`signal.signal` 註冊的訊號處理程式不同,使用此函式註冊的回呼允許與事" "件迴圈進行互動。" -#: ../../library/asyncio-eventloop.rst:1217 +#: ../../library/asyncio-eventloop.rst:1233 msgid "" "Raise :exc:`ValueError` if the signal number is invalid or uncatchable. " "Raise :exc:`RuntimeError` if there is a problem setting up the handler." @@ -1831,16 +1854,16 @@ msgstr "" "如果訊號號無效或不可捕獲,引發 :exc:`ValueError`。如果設定處理程序有問題,拋" "出 :exc:`RuntimeError`。" -#: ../../library/asyncio-eventloop.rst:1223 +#: ../../library/asyncio-eventloop.rst:1239 msgid "" "Like :func:`signal.signal`, this function must be invoked in the main thread." msgstr "像 :func:`signal.signal` 一樣,此函式必須在主執行緒中呼叫。" -#: ../../library/asyncio-eventloop.rst:1228 +#: ../../library/asyncio-eventloop.rst:1244 msgid "Remove the handler for the *sig* signal." msgstr "移除 *sig* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1230 +#: ../../library/asyncio-eventloop.rst:1246 msgid "" "Return ``True`` if the signal handler was removed, or ``False`` if no " "handler was set for the given signal." @@ -1848,19 +1871,19 @@ msgstr "" "如果訊號處理程式被移除,回傳 ``True``;如果給定訊號沒有設置處理程式,回傳 " "``False``。" -#: ../../library/asyncio-eventloop.rst:1237 +#: ../../library/asyncio-eventloop.rst:1253 msgid "The :mod:`signal` module." msgstr ":mod:`signal` 模組。" -#: ../../library/asyncio-eventloop.rst:1241 +#: ../../library/asyncio-eventloop.rst:1257 msgid "Executing code in thread or process pools" msgstr "在執行緒池或行程池中執行程式碼" -#: ../../library/asyncio-eventloop.rst:1245 +#: ../../library/asyncio-eventloop.rst:1261 msgid "Arrange for *func* to be called in the specified executor." msgstr "安排在指定的執行器中呼叫 *func*。" -#: ../../library/asyncio-eventloop.rst:1247 +#: ../../library/asyncio-eventloop.rst:1263 msgid "" "The *executor* argument should be an :class:`concurrent.futures.Executor` " "instance. The default executor is used if *executor* is ``None``. The " @@ -1869,7 +1892,7 @@ msgid "" "and used by :func:`run_in_executor` if needed." msgstr "" -#: ../../library/asyncio-eventloop.rst:1255 +#: ../../library/asyncio-eventloop.rst:1271 msgid "" "import asyncio\n" "import concurrent.futures\n" @@ -1912,7 +1935,7 @@ msgid "" " asyncio.run(main())" msgstr "" -#: ../../library/asyncio-eventloop.rst:1295 +#: ../../library/asyncio-eventloop.rst:1311 msgid "" "Note that the entry point guard (``if __name__ == '__main__'``) is required " "for option 3 due to the peculiarities of :mod:`multiprocessing`, which is " @@ -1924,11 +1947,11 @@ msgstr "" "== '__main__'``\\ )。請參閱\\ :ref:`主模組的安全引入 `。" -#: ../../library/asyncio-eventloop.rst:1300 +#: ../../library/asyncio-eventloop.rst:1316 msgid "This method returns a :class:`asyncio.Future` object." msgstr "此方法回傳 :class:`asyncio.Future` 物件。" -#: ../../library/asyncio-eventloop.rst:1302 +#: ../../library/asyncio-eventloop.rst:1318 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *func*." @@ -1936,7 +1959,7 @@ msgstr "" "使用 :func:`functools.partial` 將來\\ :ref:`關鍵字引數傳遞 `\\ 給 *func*。" -#: ../../library/asyncio-eventloop.rst:1305 +#: ../../library/asyncio-eventloop.rst:1321 msgid "" ":meth:`loop.run_in_executor` no longer configures the ``max_workers`` of the " "thread pool executor it creates, instead leaving it up to the thread pool " @@ -1947,7 +1970,7 @@ msgstr "" "``max_workers``,而是讓執行緒池執行器(\\ :class:`~concurrent.futures." "ThreadPoolExecutor`)設定預設值。" -#: ../../library/asyncio-eventloop.rst:1314 +#: ../../library/asyncio-eventloop.rst:1330 msgid "" "Set *executor* as the default executor used by :meth:`run_in_executor`. " "*executor* must be an instance of :class:`~concurrent.futures." @@ -1956,26 +1979,26 @@ msgstr "" "將 *executor* 設置為 :meth:`run_in_executor` 使用的預設執行器。*executor* 必" "須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1318 +#: ../../library/asyncio-eventloop.rst:1334 msgid "" "*executor* must be an instance of :class:`~concurrent.futures." "ThreadPoolExecutor`." msgstr "" "*executor* 必須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1324 +#: ../../library/asyncio-eventloop.rst:1340 msgid "Error Handling API" msgstr "錯誤處理 API" -#: ../../library/asyncio-eventloop.rst:1326 +#: ../../library/asyncio-eventloop.rst:1342 msgid "Allows customizing how exceptions are handled in the event loop." msgstr "允許自定義事件迴圈中的例外處理方式。" -#: ../../library/asyncio-eventloop.rst:1330 +#: ../../library/asyncio-eventloop.rst:1346 msgid "Set *handler* as the new event loop exception handler." msgstr "將 *handler* 設定為新的事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1332 +#: ../../library/asyncio-eventloop.rst:1348 msgid "" "If *handler* is ``None``, the default exception handler will be set. " "Otherwise, *handler* must be a callable with the signature matching ``(loop, " @@ -1988,7 +2011,7 @@ msgstr "" "圈的,``context`` 是包含例外詳細資訊的 ``dict`` 物件(有關情境的詳細資訊,請" "參閱 :meth:`call_exception_handler` 文件)。" -#: ../../library/asyncio-eventloop.rst:1340 +#: ../../library/asyncio-eventloop.rst:1356 msgid "" "If the handler is called on behalf of a :class:`~asyncio.Task` or :class:" "`~asyncio.Handle`, it is run in the :class:`contextvars.Context` of that " @@ -1997,7 +2020,7 @@ msgstr "" "如果代表 :class:`~asyncio.Task` 或 :class:`~asyncio.Handle` 呼叫處理程式,它" "將在該任務或回呼處理程式的 :class:`contextvars.Context` 中運行。" -#: ../../library/asyncio-eventloop.rst:1346 +#: ../../library/asyncio-eventloop.rst:1362 msgid "" "The handler may be called in the :class:`~contextvars.Context` of the task " "or handle where the exception originated." @@ -2005,18 +2028,18 @@ msgstr "" "處理程式可能在引發例外的任務或處理程式的 :class:`~contextvars.Context` 中被呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1351 +#: ../../library/asyncio-eventloop.rst:1367 msgid "" "Return the current exception handler, or ``None`` if no custom exception " "handler was set." msgstr "" "回傳當前的例外處理程式,如果未設置自定義例外處理程式,則回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:1358 +#: ../../library/asyncio-eventloop.rst:1374 msgid "Default exception handler." msgstr "預設例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1360 +#: ../../library/asyncio-eventloop.rst:1376 msgid "" "This is called when an exception occurs and no exception handler is set. " "This can be called by a custom exception handler that wants to defer to the " @@ -2025,17 +2048,17 @@ msgstr "" "當發生例外且未設置例外處理程式時呼叫此函式。自定義例外處理程式可以呼叫此函式" "以轉由預設處理程式處理。" -#: ../../library/asyncio-eventloop.rst:1364 +#: ../../library/asyncio-eventloop.rst:1380 msgid "" "*context* parameter has the same meaning as in :meth:" "`call_exception_handler`." msgstr "*context* 參數與 :meth:`call_exception_handler` 中的意思相同。" -#: ../../library/asyncio-eventloop.rst:1369 +#: ../../library/asyncio-eventloop.rst:1385 msgid "Call the current event loop exception handler." msgstr "呼叫當前事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1371 +#: ../../library/asyncio-eventloop.rst:1387 msgid "" "*context* is a ``dict`` object containing the following keys (new keys may " "be introduced in future Python versions):" @@ -2043,47 +2066,47 @@ msgstr "" "*context* 是一個包含以下鍵的 ``dict`` 物件(未來的 Python 版本中可能會引入新" "的鍵):" -#: ../../library/asyncio-eventloop.rst:1374 +#: ../../library/asyncio-eventloop.rst:1390 msgid "'message': Error message;" msgstr "'message':錯誤訊息;" -#: ../../library/asyncio-eventloop.rst:1375 +#: ../../library/asyncio-eventloop.rst:1391 msgid "'exception' (optional): Exception object;" msgstr "'exception'(可選):例外物件;" -#: ../../library/asyncio-eventloop.rst:1376 +#: ../../library/asyncio-eventloop.rst:1392 msgid "'future' (optional): :class:`asyncio.Future` instance;" msgstr "'future'(可選): :class:`asyncio.Future` 實例;" -#: ../../library/asyncio-eventloop.rst:1377 +#: ../../library/asyncio-eventloop.rst:1393 msgid "'task' (optional): :class:`asyncio.Task` instance;" msgstr "'task'(可選): :class:`asyncio.Task` 實例;" -#: ../../library/asyncio-eventloop.rst:1378 +#: ../../library/asyncio-eventloop.rst:1394 msgid "'handle' (optional): :class:`asyncio.Handle` instance;" msgstr "'handle'(可選): :class:`asyncio.Handle` 實例;" -#: ../../library/asyncio-eventloop.rst:1379 +#: ../../library/asyncio-eventloop.rst:1395 msgid "'protocol' (optional): :ref:`Protocol ` instance;" msgstr "'protocol'(可選): :ref:`Protocol ` 實例;" -#: ../../library/asyncio-eventloop.rst:1380 +#: ../../library/asyncio-eventloop.rst:1396 msgid "'transport' (optional): :ref:`Transport ` instance;" msgstr "'transport'(可選): :ref:`Transport ` 實例;" -#: ../../library/asyncio-eventloop.rst:1381 +#: ../../library/asyncio-eventloop.rst:1397 msgid "'socket' (optional): :class:`socket.socket` instance;" msgstr "'socket'(可選): :class:`socket.socket` 實例;" -#: ../../library/asyncio-eventloop.rst:1382 +#: ../../library/asyncio-eventloop.rst:1398 msgid "'asyncgen' (optional): Asynchronous generator that caused" msgstr "'asyncgen'(可選): 非同步產生器引發" -#: ../../library/asyncio-eventloop.rst:1383 +#: ../../library/asyncio-eventloop.rst:1399 msgid "the exception." msgstr "例外。" -#: ../../library/asyncio-eventloop.rst:1387 +#: ../../library/asyncio-eventloop.rst:1403 msgid "" "This method should not be overloaded in subclassed event loops. For custom " "exception handling, use the :meth:`set_exception_handler` method." @@ -2091,15 +2114,15 @@ msgstr "" "此方法不應在子類別事件迴圈中被覆寫。為了自定義例外處理,請使用 :meth:" "`set_exception_handler` 方法。" -#: ../../library/asyncio-eventloop.rst:1392 +#: ../../library/asyncio-eventloop.rst:1408 msgid "Enabling debug mode" msgstr "啟用除錯模式" -#: ../../library/asyncio-eventloop.rst:1396 +#: ../../library/asyncio-eventloop.rst:1412 msgid "Get the debug mode (:class:`bool`) of the event loop." msgstr "取得事件迴圈的除錯模式(\\ :class:`bool`\\ )。" -#: ../../library/asyncio-eventloop.rst:1398 +#: ../../library/asyncio-eventloop.rst:1414 msgid "" "The default value is ``True`` if the environment variable :envvar:" "`PYTHONASYNCIODEBUG` is set to a non-empty string, ``False`` otherwise." @@ -2107,17 +2130,17 @@ msgstr "" "如果環境變數 :envvar:`PYTHONASYNCIODEBUG` 被設定為非空字串,則預設值為 " "``True``,否則為 ``False``。" -#: ../../library/asyncio-eventloop.rst:1404 +#: ../../library/asyncio-eventloop.rst:1420 msgid "Set the debug mode of the event loop." msgstr "設定事件迴圈的除錯模式。" -#: ../../library/asyncio-eventloop.rst:1408 +#: ../../library/asyncio-eventloop.rst:1424 msgid "" "The new :ref:`Python Development Mode ` can now also be used to " "enable the debug mode." msgstr "現在也可以使用新的 :ref:`Python 開發模式 ` 啟用除錯模式。" -#: ../../library/asyncio-eventloop.rst:1413 +#: ../../library/asyncio-eventloop.rst:1429 msgid "" "This attribute can be used to set the minimum execution duration in seconds " "that is considered \"slow\". When debug mode is enabled, \"slow\" callbacks " @@ -2126,19 +2149,19 @@ msgstr "" "此屬性可用於設定被視為\"慢\"的最短執行時間(以秒為單位)。啟用偵錯模式" "後,\"慢\"回呼將被記錄。" -#: ../../library/asyncio-eventloop.rst:1417 +#: ../../library/asyncio-eventloop.rst:1433 msgid "Default value is 100 milliseconds." msgstr "預設值為 100 毫秒" -#: ../../library/asyncio-eventloop.rst:1421 +#: ../../library/asyncio-eventloop.rst:1437 msgid "The :ref:`debug mode of asyncio `." msgstr ":ref:`asyncio 的除錯模式 `。" -#: ../../library/asyncio-eventloop.rst:1425 +#: ../../library/asyncio-eventloop.rst:1441 msgid "Running Subprocesses" msgstr "運行子行程" -#: ../../library/asyncio-eventloop.rst:1427 +#: ../../library/asyncio-eventloop.rst:1443 msgid "" "Methods described in this subsections are low-level. In regular async/await " "code consider using the high-level :func:`asyncio.create_subprocess_shell` " @@ -2148,7 +2171,7 @@ msgstr "" "func:`asyncio.create_subprocess_shell` 和 :func:`asyncio." "create_subprocess_exec` 輔助功能而不是。" -#: ../../library/asyncio-eventloop.rst:1434 +#: ../../library/asyncio-eventloop.rst:1450 msgid "" "On Windows, the default event loop :class:`ProactorEventLoop` supports " "subprocesses, whereas :class:`SelectorEventLoop` does not. See :ref:" @@ -2158,26 +2181,26 @@ msgstr "" "`SelectorEventLoop` 不支援。詳細資訊請參見 :ref:`Windows 上對於子行程的支援 " "`。" -#: ../../library/asyncio-eventloop.rst:1445 +#: ../../library/asyncio-eventloop.rst:1461 msgid "" "Create a subprocess from one or more string arguments specified by *args*." msgstr "從 *args* 指定的一個或多個字串引數建立子行程。" -#: ../../library/asyncio-eventloop.rst:1448 +#: ../../library/asyncio-eventloop.rst:1464 msgid "*args* must be a list of strings represented by:" msgstr "*args* 必須是由以下項表示的字串串列:" -#: ../../library/asyncio-eventloop.rst:1450 +#: ../../library/asyncio-eventloop.rst:1466 msgid ":class:`str`;" msgstr ":class:`str`;" -#: ../../library/asyncio-eventloop.rst:1451 +#: ../../library/asyncio-eventloop.rst:1467 msgid "" "or :class:`bytes`, encoded to the :ref:`filesystem encoding `." msgstr "或 :class:`bytes`,編碼為 :ref:`檔案系統編碼 `。" -#: ../../library/asyncio-eventloop.rst:1454 +#: ../../library/asyncio-eventloop.rst:1470 msgid "" "The first string specifies the program executable, and the remaining strings " "specify the arguments. Together, string arguments form the ``argv`` of the " @@ -2186,7 +2209,7 @@ msgstr "" "第一個字串指定程序可執行檔案,其餘字串指定引數。字串引數一起組成程序的 " "``argv``。" -#: ../../library/asyncio-eventloop.rst:1458 +#: ../../library/asyncio-eventloop.rst:1474 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=False`` and the list of strings passed as the first " @@ -2197,7 +2220,7 @@ msgstr "" "字串串列作為第一個引數傳遞;然而,:class:`~subprocess.Popen` 接受單個字串串列" "引數,*subprocess_exec* 接受多個字串引數。" -#: ../../library/asyncio-eventloop.rst:1464 +#: ../../library/asyncio-eventloop.rst:1480 msgid "" "The *protocol_factory* must be a callable returning a subclass of the :class:" "`asyncio.SubprocessProtocol` class." @@ -2205,67 +2228,67 @@ msgstr "" "*protocol_factory* 必須是回傳 :class:`asyncio.SubprocessProtocol` 子類別的可" "呼叫物件。" -#: ../../library/asyncio-eventloop.rst:1467 +#: ../../library/asyncio-eventloop.rst:1483 msgid "Other parameters:" msgstr "其他參數:" -#: ../../library/asyncio-eventloop.rst:1469 +#: ../../library/asyncio-eventloop.rst:1485 msgid "*stdin* can be any of these:" msgstr "*stdin* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1471 -#: ../../library/asyncio-eventloop.rst:1482 -#: ../../library/asyncio-eventloop.rst:1492 +#: ../../library/asyncio-eventloop.rst:1487 +#: ../../library/asyncio-eventloop.rst:1498 +#: ../../library/asyncio-eventloop.rst:1508 msgid "a file-like object" msgstr "類檔案物件" -#: ../../library/asyncio-eventloop.rst:1472 +#: ../../library/asyncio-eventloop.rst:1488 msgid "" "an existing file descriptor (a positive integer), for example those created " "with :meth:`os.pipe`" msgstr "現有的檔案描述器(正整數),例如用 :meth:`os.pipe` 建立的" -#: ../../library/asyncio-eventloop.rst:1473 -#: ../../library/asyncio-eventloop.rst:1483 -#: ../../library/asyncio-eventloop.rst:1493 +#: ../../library/asyncio-eventloop.rst:1489 +#: ../../library/asyncio-eventloop.rst:1499 +#: ../../library/asyncio-eventloop.rst:1509 msgid "" "the :const:`subprocess.PIPE` constant (default) which will create a new pipe " "and connect it," msgstr ":const:`subprocess.PIPE` 常數(預設),它將建立一個新的管道並連線," -#: ../../library/asyncio-eventloop.rst:1475 -#: ../../library/asyncio-eventloop.rst:1485 -#: ../../library/asyncio-eventloop.rst:1495 +#: ../../library/asyncio-eventloop.rst:1491 +#: ../../library/asyncio-eventloop.rst:1501 +#: ../../library/asyncio-eventloop.rst:1511 msgid "" "the value ``None`` which will make the subprocess inherit the file " "descriptor from this process" msgstr "值 ``None`` 將使子行程從此行程繼承檔案描述器" -#: ../../library/asyncio-eventloop.rst:1477 -#: ../../library/asyncio-eventloop.rst:1487 -#: ../../library/asyncio-eventloop.rst:1497 +#: ../../library/asyncio-eventloop.rst:1493 +#: ../../library/asyncio-eventloop.rst:1503 +#: ../../library/asyncio-eventloop.rst:1513 msgid "" "the :const:`subprocess.DEVNULL` constant which indicates that the special :" "data:`os.devnull` file will be used" msgstr "" ":const:`subprocess.DEVNULL` 常數,表示將使用特殊的 :data:`os.devnull` 檔案" -#: ../../library/asyncio-eventloop.rst:1480 +#: ../../library/asyncio-eventloop.rst:1496 msgid "*stdout* can be any of these:" msgstr "*stdout* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1490 +#: ../../library/asyncio-eventloop.rst:1506 msgid "*stderr* can be any of these:" msgstr "*stderr* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1499 +#: ../../library/asyncio-eventloop.rst:1515 msgid "" "the :const:`subprocess.STDOUT` constant which will connect the standard " "error stream to the process' standard output stream" msgstr "" ":const:`subprocess.STDOUT` 常數,它將標準錯誤串流連線到行程的標準輸出串流" -#: ../../library/asyncio-eventloop.rst:1502 +#: ../../library/asyncio-eventloop.rst:1518 msgid "" "All other keyword arguments are passed to :class:`subprocess.Popen` without " "interpretation, except for *bufsize*, *universal_newlines*, *shell*, *text*, " @@ -2275,7 +2298,7 @@ msgstr "" "*bufsize*、*universal_newlines*、*shell*、*text*、*encoding* 和 *errors* 除" "外,這些不應該指定。" -#: ../../library/asyncio-eventloop.rst:1507 +#: ../../library/asyncio-eventloop.rst:1523 msgid "" "The ``asyncio`` subprocess API does not support decoding the streams as " "text. :func:`bytes.decode` can be used to convert the bytes returned from " @@ -2284,7 +2307,7 @@ msgstr "" "``asyncio`` 子行程 API 不支援將串流解碼為文本。可以使用 :func:`bytes.decode` " "將從串流回傳的位元組轉換為文本。" -#: ../../library/asyncio-eventloop.rst:1511 +#: ../../library/asyncio-eventloop.rst:1527 msgid "" "If a file-like object passed as *stdin*, *stdout* or *stderr* represents a " "pipe, then the other side of this pipe should be registered with :meth:" @@ -2295,13 +2318,13 @@ msgstr "" "端應該使用 :meth:`~loop.connect_write_pipe` 或 :meth:`~loop." "connect_read_pipe` 註冊到事件迴圈中。" -#: ../../library/asyncio-eventloop.rst:1516 +#: ../../library/asyncio-eventloop.rst:1532 msgid "" "See the constructor of the :class:`subprocess.Popen` class for documentation " "on other arguments." msgstr "有關其他引數的文件,請參閱 :class:`subprocess.Popen` 類別的建構函式。" -#: ../../library/asyncio-eventloop.rst:1519 +#: ../../library/asyncio-eventloop.rst:1535 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`asyncio.SubprocessTransport` base class and *protocol* is an " @@ -2311,7 +2334,7 @@ msgstr "" "SubprocessTransport` 基底類別,*protocol* 是由 *protocol_factory* 實例化的物" "件。" -#: ../../library/asyncio-eventloop.rst:1527 +#: ../../library/asyncio-eventloop.rst:1543 msgid "" "Create a subprocess from *cmd*, which can be a :class:`str` or a :class:" "`bytes` string encoded to the :ref:`filesystem encoding ` 的 :class:`bytes` 字串。" -#: ../../library/asyncio-eventloop.rst:1532 +#: ../../library/asyncio-eventloop.rst:1548 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=True``." @@ -2328,7 +2351,7 @@ msgstr "" "這類似於標準函式庫中的 :class:`subprocess.Popen` 類別,使用 ``shell=True`` 呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1535 +#: ../../library/asyncio-eventloop.rst:1551 msgid "" "The *protocol_factory* must be a callable returning a subclass of the :class:" "`SubprocessProtocol` class." @@ -2336,13 +2359,13 @@ msgstr "" "*protocol_factory* 必須是回傳 :class:`SubprocessProtocol` 子類別的可呼叫物" "件。" -#: ../../library/asyncio-eventloop.rst:1538 +#: ../../library/asyncio-eventloop.rst:1554 msgid "" "See :meth:`~loop.subprocess_exec` for more details about the remaining " "arguments." msgstr "有關其餘引數的更多詳細資訊,請參閱 :meth:`~loop.subprocess_exec`。" -#: ../../library/asyncio-eventloop.rst:1541 +#: ../../library/asyncio-eventloop.rst:1557 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`SubprocessTransport` base class and *protocol* is an object " @@ -2352,7 +2375,7 @@ msgstr "" "`SubprocessTransport` 基底類別,而 *protocol* 是由 *protocol_factory* 實例化" "的物件。" -#: ../../library/asyncio-eventloop.rst:1546 +#: ../../library/asyncio-eventloop.rst:1562 msgid "" "It is the application's responsibility to ensure that all whitespace and " "special characters are quoted appropriately to avoid `shell injection " @@ -2365,11 +2388,11 @@ msgstr "" "wikipedia.org/wiki/Shell_injection#Shell_injection>`_\\ 風險。可以使用 :func:" "`shlex.quote` 函式來正確跳脫用於構建 shell 命令的字串中的空白和特殊字元。" -#: ../../library/asyncio-eventloop.rst:1555 +#: ../../library/asyncio-eventloop.rst:1571 msgid "Callback Handles" msgstr "回呼處理" -#: ../../library/asyncio-eventloop.rst:1559 +#: ../../library/asyncio-eventloop.rst:1575 msgid "" "A callback wrapper object returned by :meth:`loop.call_soon`, :meth:`loop." "call_soon_threadsafe`." @@ -2377,46 +2400,46 @@ msgstr "" "由 :meth:`loop.call_soon` 和 :meth:`loop.call_soon_threadsafe` 回傳的回呼包裝" "器。" -#: ../../library/asyncio-eventloop.rst:1564 +#: ../../library/asyncio-eventloop.rst:1580 msgid "" "Return the :class:`contextvars.Context` object associated with the handle." msgstr "回傳與處理相關聯的 :class:`contextvars.Context` 物件。" -#: ../../library/asyncio-eventloop.rst:1571 +#: ../../library/asyncio-eventloop.rst:1587 msgid "" "Cancel the callback. If the callback has already been canceled or executed, " "this method has no effect." msgstr "取消回呼。如果回呼已被取消或執行,此方法將不起作用。" -#: ../../library/asyncio-eventloop.rst:1576 +#: ../../library/asyncio-eventloop.rst:1592 msgid "Return ``True`` if the callback was cancelled." msgstr "如果回呼已被取消,回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1582 +#: ../../library/asyncio-eventloop.rst:1598 msgid "" "A callback wrapper object returned by :meth:`loop.call_later`, and :meth:" "`loop.call_at`." msgstr "由 :meth:`loop.call_later` 和 :meth:`loop.call_at` 回傳的回呼包裝器。" -#: ../../library/asyncio-eventloop.rst:1585 +#: ../../library/asyncio-eventloop.rst:1601 msgid "This class is a subclass of :class:`Handle`." msgstr "這個類別是 :class:`Handle` 的子類別。" -#: ../../library/asyncio-eventloop.rst:1589 +#: ../../library/asyncio-eventloop.rst:1605 msgid "Return a scheduled callback time as :class:`float` seconds." msgstr "回傳預定的回呼時間,以 :class:`float` 秒為單位。" -#: ../../library/asyncio-eventloop.rst:1591 +#: ../../library/asyncio-eventloop.rst:1607 msgid "" "The time is an absolute timestamp, using the same time reference as :meth:" "`loop.time`." msgstr "時間是一個絕對的時間戳,使用與 :meth:`loop.time` 相同的時間參照。" -#: ../../library/asyncio-eventloop.rst:1598 +#: ../../library/asyncio-eventloop.rst:1614 msgid "Server Objects" msgstr "Server 物件" -#: ../../library/asyncio-eventloop.rst:1600 +#: ../../library/asyncio-eventloop.rst:1616 msgid "" "Server objects are created by :meth:`loop.create_server`, :meth:`loop." "create_unix_server`, :func:`start_server`, and :func:`start_unix_server` " @@ -2426,11 +2449,11 @@ msgstr "" "create_unix_server`、:func:`start_server` 和 :func:`start_unix_server` 函式所" "建立。" -#: ../../library/asyncio-eventloop.rst:1604 +#: ../../library/asyncio-eventloop.rst:1620 msgid "Do not instantiate the :class:`Server` class directly." msgstr "請勿直接實例化 :class:`Server` 類別。" -#: ../../library/asyncio-eventloop.rst:1608 +#: ../../library/asyncio-eventloop.rst:1624 msgid "" "*Server* objects are asynchronous context managers. When used in an ``async " "with`` statement, it's guaranteed that the Server object is closed and not " @@ -2439,7 +2462,7 @@ msgstr "" "*Server* 物件是非同步情境管理器。當在 ``async with`` 陳述中使用時,可以保證在" "完成 ``async with`` 陳述時,Server 物件將會關閉並停止接受新的連線: ::" -#: ../../library/asyncio-eventloop.rst:1613 +#: ../../library/asyncio-eventloop.rst:1629 msgid "" "srv = await loop.create_server(...)\n" "\n" @@ -2449,30 +2472,30 @@ msgid "" "# At this point, srv is closed and no longer accepts new connections." msgstr "" -#: ../../library/asyncio-eventloop.rst:1621 +#: ../../library/asyncio-eventloop.rst:1637 msgid "Server object is an asynchronous context manager since Python 3.7." msgstr "自 Python 3.7 起,Server 物件是非同步情境管理器。" -#: ../../library/asyncio-eventloop.rst:1624 +#: ../../library/asyncio-eventloop.rst:1640 msgid "" "This class was exposed publicly as ``asyncio.Server`` in Python 3.9.11, " "3.10.3 and 3.11." msgstr "" "此類別在 Python 3.9.11、3.10.3 和 3.11 中以 ``asyncio.Server`` 的形式被公開。" -#: ../../library/asyncio-eventloop.rst:1629 +#: ../../library/asyncio-eventloop.rst:1645 msgid "" "Stop serving: close listening sockets and set the :attr:`sockets` attribute " "to ``None``." msgstr "停止服務:關閉監聽的 sockets 並將 :attr:`sockets` 屬性設為 ``None``。" -#: ../../library/asyncio-eventloop.rst:1632 +#: ../../library/asyncio-eventloop.rst:1648 msgid "" "The sockets that represent existing incoming client connections are left " "open." msgstr "代表現有傳入用戶端連線的 sockets 仍然保持開啟。" -#: ../../library/asyncio-eventloop.rst:1635 +#: ../../library/asyncio-eventloop.rst:1651 msgid "" "The server is closed asynchronously; use the :meth:`wait_closed` coroutine " "to wait until the server is closed (and no more connections are active)." @@ -2480,21 +2503,54 @@ msgstr "" "伺服器以非同步方式關閉;使用 :meth:`wait_close` 協程等待伺服器關閉(不再有活" "躍連線)。" -#: ../../library/asyncio-eventloop.rst:1641 +#: ../../library/asyncio-eventloop.rst:1657 +#, fuzzy +msgid "Close all existing incoming client connections." +msgstr "代表現有傳入用戶端連線的 sockets 仍然保持開啟。" + +#: ../../library/asyncio-eventloop.rst:1659 +msgid "" +"Calls :meth:`~asyncio.BaseTransport.close` on all associated transports." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1662 +msgid "" +":meth:`close` should be called before :meth:`close_clients` when closing the " +"server to avoid races with new clients connecting." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1669 +msgid "" +"Close all existing incoming client connections immediately, without waiting " +"for pending operations to complete." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1672 +msgid "" +"Calls :meth:`~asyncio.WriteTransport.abort` on all associated transports." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1675 +msgid "" +":meth:`close` should be called before :meth:`abort_clients` when closing the " +"server to avoid races with new clients connecting." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1682 msgid "Return the event loop associated with the server object." msgstr "回傳與伺服器物件關聯的事件迴圈。" -#: ../../library/asyncio-eventloop.rst:1647 +#: ../../library/asyncio-eventloop.rst:1688 msgid "Start accepting connections." msgstr "開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1649 +#: ../../library/asyncio-eventloop.rst:1690 msgid "" "This method is idempotent, so it can be called when the server is already " "serving." msgstr "此方法是幂等的,因此可以在伺服器已經運行時呼叫。" -#: ../../library/asyncio-eventloop.rst:1652 +#: ../../library/asyncio-eventloop.rst:1693 msgid "" "The *start_serving* keyword-only parameter to :meth:`loop.create_server` " "and :meth:`asyncio.start_server` allows creating a Server object that is not " @@ -2507,14 +2563,14 @@ msgstr "" "種情況下,可以使用 ``Server.start_serving()`` 或 :meth:`Server." "serve_forever` 來使 Server 開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1663 +#: ../../library/asyncio-eventloop.rst:1704 msgid "" "Start accepting connections until the coroutine is cancelled. Cancellation " "of ``serve_forever`` task causes the server to be closed." msgstr "" "開始接受連線,直到協程被取消。取消 ``serve_forever`` 任務會導致伺服器關閉。" -#: ../../library/asyncio-eventloop.rst:1667 +#: ../../library/asyncio-eventloop.rst:1708 msgid "" "This method can be called if the server is already accepting connections. " "Only one ``serve_forever`` task can exist per one *Server* object." @@ -2522,7 +2578,7 @@ msgstr "" "如果伺服器已經接受連線,則可以呼叫此方法。每個 *Server* 物件只能存在一個 " "``serve_forever`` 任務。" -#: ../../library/asyncio-eventloop.rst:1673 +#: ../../library/asyncio-eventloop.rst:1714 msgid "" "async def client_connected(reader, writer):\n" " # Communicate with the client with\n" @@ -2537,24 +2593,24 @@ msgid "" "asyncio.run(main('127.0.0.1', 0))" msgstr "" -#: ../../library/asyncio-eventloop.rst:1689 +#: ../../library/asyncio-eventloop.rst:1730 msgid "Return ``True`` if the server is accepting new connections." msgstr "如果伺服器正在接受新連線,則回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1695 +#: ../../library/asyncio-eventloop.rst:1736 msgid "" "Wait until the :meth:`close` method completes and all active connections " "have finished." msgstr "等待 :meth:`close` 方法完成且所有活動連線都已結束。" -#: ../../library/asyncio-eventloop.rst:1700 +#: ../../library/asyncio-eventloop.rst:1741 msgid "" "List of socket-like objects, ``asyncio.trsock.TransportSocket``, which the " "server is listening on." msgstr "" "伺服器正在監聽的類似 socket 的物件串列,``asyncio.trsock.TransportSocket``。" -#: ../../library/asyncio-eventloop.rst:1703 +#: ../../library/asyncio-eventloop.rst:1744 msgid "" "Prior to Python 3.7 ``Server.sockets`` used to return an internal list of " "server sockets directly. In 3.7 a copy of that list is returned." @@ -2562,11 +2618,11 @@ msgstr "" "在 Python 3.7 之前,``Server.sockets`` 曾經直接回傳內部伺服器 sockets 的串" "列。在 3.7 中回傳了該串列的副本。" -#: ../../library/asyncio-eventloop.rst:1713 +#: ../../library/asyncio-eventloop.rst:1754 msgid "Event Loop Implementations" msgstr "事件迴圈實作" -#: ../../library/asyncio-eventloop.rst:1715 +#: ../../library/asyncio-eventloop.rst:1756 msgid "" "asyncio ships with two different event loop implementations: :class:" "`SelectorEventLoop` and :class:`ProactorEventLoop`." @@ -2574,19 +2630,21 @@ msgstr "" "asyncio 內附兩個不同的事件迴圈實作::class:`SelectorEventLoop` 和 :class:" "`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1718 -msgid "" -"By default asyncio is configured to use :class:`SelectorEventLoop` on Unix " -"and :class:`ProactorEventLoop` on Windows." +#: ../../library/asyncio-eventloop.rst:1759 +#, fuzzy +msgid "By default asyncio is configured to use :class:`EventLoop`." msgstr "" "預設情況下,asyncio 配置為在 Unix 上使用 :class:`SelectorEventLoop`,在 " "Windows 上使用 :class:`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1724 -msgid "An event loop based on the :mod:`selectors` module." +#: ../../library/asyncio-eventloop.rst:1764 +#, fuzzy +msgid "" +"A subclass of :class:`AbstractEventLoop` based on the :mod:`selectors` " +"module." msgstr "基於 :mod:`selectors` 模組的事件迴圈。" -#: ../../library/asyncio-eventloop.rst:1726 +#: ../../library/asyncio-eventloop.rst:1767 msgid "" "Uses the most efficient *selector* available for the given platform. It is " "also possible to manually configure the exact selector implementation to be " @@ -2595,7 +2653,7 @@ msgstr "" "使用特定平台上最有效的 *selector*。也可以手動配置要使用的確切 selector 實" "作: ::" -#: ../../library/asyncio-eventloop.rst:1730 +#: ../../library/asyncio-eventloop.rst:1771 msgid "" "import asyncio\n" "import selectors\n" @@ -2617,19 +2675,22 @@ msgstr "" "\n" "asyncio.set_event_loop_policy(MyPolicy())" -#: ../../library/asyncio-eventloop.rst:1741 +#: ../../library/asyncio-eventloop.rst:1782 msgid ":ref:`Availability `: Unix, Windows." msgstr ":ref:`適用 `:Unix、Windows。" -#: ../../library/asyncio-eventloop.rst:1746 -msgid "An event loop for Windows that uses \"I/O Completion Ports\" (IOCP)." +#: ../../library/asyncio-eventloop.rst:1787 +#, fuzzy +msgid "" +"A subclass of :class:`AbstractEventLoop` for Windows that uses \"I/O " +"Completion Ports\" (IOCP)." msgstr "用於 Windows 的事件迴圈,使用\"I/O 完成埠\"(IOCP)。" -#: ../../library/asyncio-eventloop.rst:1748 +#: ../../library/asyncio-eventloop.rst:1789 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/asyncio-eventloop.rst:1752 +#: ../../library/asyncio-eventloop.rst:1793 msgid "" "`MSDN documentation on I/O Completion Ports `_." @@ -2637,11 +2698,26 @@ msgstr "" "`I/O 完成埠(I/O Completion Ports)的 MSDN 文件 `_。" -#: ../../library/asyncio-eventloop.rst:1758 +#: ../../library/asyncio-eventloop.rst:1798 +msgid "" +"An alias to the most efficient available subclass of :class:" +"`AbstractEventLoop` for the given platform." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1801 +#, fuzzy +msgid "" +"It is an alias to :class:`SelectorEventLoop` on Unix and :class:" +"`ProactorEventLoop` on Windows." +msgstr "" +"預設情況下,asyncio 配置為在 Unix 上使用 :class:`SelectorEventLoop`,在 " +"Windows 上使用 :class:`ProactorEventLoop`。" + +#: ../../library/asyncio-eventloop.rst:1807 msgid "Abstract base class for asyncio-compliant event loops." msgstr "為符合 asyncio 標準的事件迴圈的抽象基礎類別。" -#: ../../library/asyncio-eventloop.rst:1760 +#: ../../library/asyncio-eventloop.rst:1809 msgid "" "The :ref:`asyncio-event-loop-methods` section lists all methods that an " "alternative implementation of ``AbstractEventLoop`` should have defined." @@ -2649,11 +2725,11 @@ msgstr "" ":ref:`asyncio-event-loop-methods` 部分列出了替代 ``AbstractEventLoop`` 實作應" "該定義的所有方法。" -#: ../../library/asyncio-eventloop.rst:1766 +#: ../../library/asyncio-eventloop.rst:1815 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-eventloop.rst:1768 +#: ../../library/asyncio-eventloop.rst:1817 msgid "" "Note that all examples in this section **purposefully** show how to use the " "low-level event loop APIs, such as :meth:`loop.run_forever` and :meth:`loop." @@ -2664,11 +2740,11 @@ msgstr "" "`loop.run_forever` 和 :meth:`loop.call_soon`。現代 asyncio 應用程式很少需要這" "種方式撰寫;請考慮使用高階的函式,如 :func:`asyncio.run`。" -#: ../../library/asyncio-eventloop.rst:1778 +#: ../../library/asyncio-eventloop.rst:1827 msgid "Hello World with call_soon()" msgstr "使用 call_soon() 的 Hello World 範例" -#: ../../library/asyncio-eventloop.rst:1780 +#: ../../library/asyncio-eventloop.rst:1829 msgid "" "An example using the :meth:`loop.call_soon` method to schedule a callback. " "The callback displays ``\"Hello World\"`` and then stops the event loop::" @@ -2676,7 +2752,7 @@ msgstr "" "使用 :meth:`loop.call_soon` 方法排程回呼的範例。回呼會顯示 ``\"Hello " "World\"``,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1784 +#: ../../library/asyncio-eventloop.rst:1833 msgid "" "import asyncio\n" "\n" @@ -2697,18 +2773,18 @@ msgid "" " loop.close()" msgstr "" -#: ../../library/asyncio-eventloop.rst:1804 +#: ../../library/asyncio-eventloop.rst:1853 msgid "" "A similar :ref:`Hello World ` example created with a coroutine " "and the :func:`run` function." msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`Hello World ` 範例。" -#: ../../library/asyncio-eventloop.rst:1811 +#: ../../library/asyncio-eventloop.rst:1860 msgid "Display the current date with call_later()" msgstr "使用 call_later() 顯示目前日期" -#: ../../library/asyncio-eventloop.rst:1813 +#: ../../library/asyncio-eventloop.rst:1862 msgid "" "An example of a callback displaying the current date every second. The " "callback uses the :meth:`loop.call_later` method to reschedule itself after " @@ -2717,7 +2793,7 @@ msgstr "" "一個回呼的範例,每秒顯示目前日期。回呼使用 :meth:`loop.call_later` 方法在 5 " "秒後重新排程自己,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1817 +#: ../../library/asyncio-eventloop.rst:1866 msgid "" "import asyncio\n" "import datetime\n" @@ -2742,7 +2818,7 @@ msgid "" " loop.close()" msgstr "" -#: ../../library/asyncio-eventloop.rst:1841 +#: ../../library/asyncio-eventloop.rst:1890 msgid "" "A similar :ref:`current date ` example created with a " "coroutine and the :func:`run` function." @@ -2750,11 +2826,11 @@ msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`current date " "` 範例。" -#: ../../library/asyncio-eventloop.rst:1848 +#: ../../library/asyncio-eventloop.rst:1897 msgid "Watch a file descriptor for read events" msgstr "監聽檔案描述器以進行讀取事件" -#: ../../library/asyncio-eventloop.rst:1850 +#: ../../library/asyncio-eventloop.rst:1899 msgid "" "Wait until a file descriptor received some data using the :meth:`loop." "add_reader` method and then close the event loop::" @@ -2762,7 +2838,7 @@ msgstr "" "使用 :meth:`loop.add_reader` 方法等待檔案描述器接收到某些資料,然後關閉事件迴" "圈: ::" -#: ../../library/asyncio-eventloop.rst:1853 +#: ../../library/asyncio-eventloop.rst:1902 msgid "" "import asyncio\n" "from socket import socketpair\n" @@ -2798,7 +2874,7 @@ msgid "" " loop.close()" msgstr "" -#: ../../library/asyncio-eventloop.rst:1888 +#: ../../library/asyncio-eventloop.rst:1937 msgid "" "A similar :ref:`example ` using " "transports, protocols, and the :meth:`loop.create_connection` method." @@ -2806,7 +2882,7 @@ msgstr "" "使用傳輸、協定和 :meth:`loop.create_connection` 方法的類似 :ref:`範例 " "`。" -#: ../../library/asyncio-eventloop.rst:1892 +#: ../../library/asyncio-eventloop.rst:1941 msgid "" "Another similar :ref:`example ` " "using the high-level :func:`asyncio.open_connection` function and streams." @@ -2814,15 +2890,15 @@ msgstr "" "另一個使用高階 :func:`asyncio.open_connection` 函式和串流的類似 :ref:`範例 " "`。" -#: ../../library/asyncio-eventloop.rst:1900 +#: ../../library/asyncio-eventloop.rst:1949 msgid "Set signal handlers for SIGINT and SIGTERM" msgstr "設定 SIGINT 和 SIGTERM 的訊號處理程式" -#: ../../library/asyncio-eventloop.rst:1902 +#: ../../library/asyncio-eventloop.rst:1951 msgid "(This ``signals`` example only works on Unix.)" msgstr "(此 ``signals`` 範例僅在 Unix 上運作。)" -#: ../../library/asyncio-eventloop.rst:1904 +#: ../../library/asyncio-eventloop.rst:1953 msgid "" "Register handlers for signals :const:`~signal.SIGINT` and :const:`~signal." "SIGTERM` using the :meth:`loop.add_signal_handler` method::" @@ -2830,7 +2906,7 @@ msgstr "" "使用 :meth:`loop.add_signal_handler` 方法註冊訊號 :py:data:`SIGINT` 和 :py:" "data:`SIGTERM` 的處理程式: ::" -#: ../../library/asyncio-eventloop.rst:1907 +#: ../../library/asyncio-eventloop.rst:1956 msgid "" "import asyncio\n" "import functools\n" diff --git a/library/asyncio-protocol.po b/library/asyncio-protocol.po index 682e411440..9b58685f3e 100644 --- a/library/asyncio-protocol.po +++ b/library/asyncio-protocol.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -501,7 +501,14 @@ msgid "" "the target address given on transport creation." msgstr "" -#: ../../library/asyncio-protocol.rst:367 +#: ../../library/asyncio-protocol.rst:365 +msgid "" +"This method can be called with an empty bytes object to send a zero-length " +"datagram. The buffer size calculation used for flow control is also updated " +"to account for the datagram header." +msgstr "" + +#: ../../library/asyncio-protocol.rst:372 msgid "" "Close the transport immediately, without waiting for pending operations to " "complete. Buffered data will be lost. No more data will be received. The " @@ -509,110 +516,110 @@ msgid "" "method will eventually be called with :const:`None` as its argument." msgstr "" -#: ../../library/asyncio-protocol.rst:377 +#: ../../library/asyncio-protocol.rst:382 msgid "Subprocess Transports" msgstr "" -#: ../../library/asyncio-protocol.rst:381 +#: ../../library/asyncio-protocol.rst:386 msgid "Return the subprocess process id as an integer." msgstr "" -#: ../../library/asyncio-protocol.rst:385 +#: ../../library/asyncio-protocol.rst:390 msgid "" "Return the transport for the communication pipe corresponding to the integer " "file descriptor *fd*:" msgstr "" -#: ../../library/asyncio-protocol.rst:388 +#: ../../library/asyncio-protocol.rst:393 msgid "" "``0``: readable streaming transport of the standard input (*stdin*), or :" "const:`None` if the subprocess was not created with ``stdin=PIPE``" msgstr "" -#: ../../library/asyncio-protocol.rst:390 +#: ../../library/asyncio-protocol.rst:395 msgid "" "``1``: writable streaming transport of the standard output (*stdout*), or :" "const:`None` if the subprocess was not created with ``stdout=PIPE``" msgstr "" -#: ../../library/asyncio-protocol.rst:392 +#: ../../library/asyncio-protocol.rst:397 msgid "" "``2``: writable streaming transport of the standard error (*stderr*), or :" "const:`None` if the subprocess was not created with ``stderr=PIPE``" msgstr "" -#: ../../library/asyncio-protocol.rst:394 +#: ../../library/asyncio-protocol.rst:399 msgid "other *fd*: :const:`None`" msgstr "" -#: ../../library/asyncio-protocol.rst:398 +#: ../../library/asyncio-protocol.rst:403 msgid "" "Return the subprocess return code as an integer or :const:`None` if it " "hasn't returned, which is similar to the :attr:`subprocess.Popen.returncode` " "attribute." msgstr "" -#: ../../library/asyncio-protocol.rst:404 +#: ../../library/asyncio-protocol.rst:409 msgid "Kill the subprocess." msgstr "" -#: ../../library/asyncio-protocol.rst:406 +#: ../../library/asyncio-protocol.rst:411 msgid "" "On POSIX systems, the function sends SIGKILL to the subprocess. On Windows, " "this method is an alias for :meth:`terminate`." msgstr "" -#: ../../library/asyncio-protocol.rst:409 +#: ../../library/asyncio-protocol.rst:414 msgid "See also :meth:`subprocess.Popen.kill`." msgstr "另請參閱 :meth:`subprocess.Popen.kill`。" -#: ../../library/asyncio-protocol.rst:413 +#: ../../library/asyncio-protocol.rst:418 msgid "" "Send the *signal* number to the subprocess, as in :meth:`subprocess.Popen." "send_signal`." msgstr "" -#: ../../library/asyncio-protocol.rst:418 +#: ../../library/asyncio-protocol.rst:423 msgid "Stop the subprocess." msgstr "" -#: ../../library/asyncio-protocol.rst:420 +#: ../../library/asyncio-protocol.rst:425 msgid "" "On POSIX systems, this method sends :py:const:`~signal.SIGTERM` to the " "subprocess. On Windows, the Windows API function :c:func:`!TerminateProcess` " "is called to stop the subprocess." msgstr "" -#: ../../library/asyncio-protocol.rst:424 +#: ../../library/asyncio-protocol.rst:429 msgid "See also :meth:`subprocess.Popen.terminate`." msgstr "另請參閱 :meth:`subprocess.Popen.terminate`。" -#: ../../library/asyncio-protocol.rst:428 +#: ../../library/asyncio-protocol.rst:433 msgid "Kill the subprocess by calling the :meth:`kill` method." msgstr "" -#: ../../library/asyncio-protocol.rst:430 +#: ../../library/asyncio-protocol.rst:435 msgid "" "If the subprocess hasn't returned yet, and close transports of *stdin*, " "*stdout*, and *stderr* pipes." msgstr "" -#: ../../library/asyncio-protocol.rst:437 +#: ../../library/asyncio-protocol.rst:442 msgid "Protocols" msgstr "" -#: ../../library/asyncio-protocol.rst:439 +#: ../../library/asyncio-protocol.rst:444 msgid "**Source code:** :source:`Lib/asyncio/protocols.py`" msgstr "**原始碼:**\\ :source:`Lib/asyncio/protocols.py`" -#: ../../library/asyncio-protocol.rst:443 +#: ../../library/asyncio-protocol.rst:448 msgid "" "asyncio provides a set of abstract base classes that should be used to " "implement network protocols. Those classes are meant to be used together " "with :ref:`transports `." msgstr "" -#: ../../library/asyncio-protocol.rst:447 +#: ../../library/asyncio-protocol.rst:452 msgid "" "Subclasses of abstract base protocol classes may implement some or all " "methods. All these methods are callbacks: they are called by transports on " @@ -620,117 +627,117 @@ msgid "" "method should be called by the corresponding transport." msgstr "" -#: ../../library/asyncio-protocol.rst:454 +#: ../../library/asyncio-protocol.rst:459 msgid "Base Protocols" msgstr "" -#: ../../library/asyncio-protocol.rst:458 +#: ../../library/asyncio-protocol.rst:463 msgid "Base protocol with methods that all protocols share." msgstr "" -#: ../../library/asyncio-protocol.rst:462 +#: ../../library/asyncio-protocol.rst:467 msgid "" "The base class for implementing streaming protocols (TCP, Unix sockets, etc)." msgstr "" -#: ../../library/asyncio-protocol.rst:467 +#: ../../library/asyncio-protocol.rst:472 msgid "" "A base class for implementing streaming protocols with manual control of the " "receive buffer." msgstr "" -#: ../../library/asyncio-protocol.rst:472 +#: ../../library/asyncio-protocol.rst:477 msgid "The base class for implementing datagram (UDP) protocols." msgstr "" -#: ../../library/asyncio-protocol.rst:476 +#: ../../library/asyncio-protocol.rst:481 msgid "" "The base class for implementing protocols communicating with child processes " "(unidirectional pipes)." msgstr "" -#: ../../library/asyncio-protocol.rst:481 +#: ../../library/asyncio-protocol.rst:486 msgid "Base Protocol" msgstr "" -#: ../../library/asyncio-protocol.rst:483 +#: ../../library/asyncio-protocol.rst:488 msgid "All asyncio protocols can implement Base Protocol callbacks." msgstr "" -#: ../../library/asyncio-protocol.rst:486 +#: ../../library/asyncio-protocol.rst:491 msgid "Connection Callbacks" msgstr "" -#: ../../library/asyncio-protocol.rst:487 +#: ../../library/asyncio-protocol.rst:492 msgid "" "Connection callbacks are called on all protocols, exactly once per a " "successful connection. All other protocol callbacks can only be called " "between those two methods." msgstr "" -#: ../../library/asyncio-protocol.rst:493 +#: ../../library/asyncio-protocol.rst:498 msgid "Called when a connection is made." msgstr "" -#: ../../library/asyncio-protocol.rst:495 +#: ../../library/asyncio-protocol.rst:500 msgid "" "The *transport* argument is the transport representing the connection. The " "protocol is responsible for storing the reference to its transport." msgstr "" -#: ../../library/asyncio-protocol.rst:501 +#: ../../library/asyncio-protocol.rst:506 msgid "Called when the connection is lost or closed." msgstr "" -#: ../../library/asyncio-protocol.rst:503 +#: ../../library/asyncio-protocol.rst:508 msgid "" "The argument is either an exception object or :const:`None`. The latter " "means a regular EOF is received, or the connection was aborted or closed by " "this side of the connection." msgstr "" -#: ../../library/asyncio-protocol.rst:509 +#: ../../library/asyncio-protocol.rst:514 msgid "Flow Control Callbacks" msgstr "" -#: ../../library/asyncio-protocol.rst:510 +#: ../../library/asyncio-protocol.rst:515 msgid "" "Flow control callbacks can be called by transports to pause or resume " "writing performed by the protocol." msgstr "" -#: ../../library/asyncio-protocol.rst:513 +#: ../../library/asyncio-protocol.rst:518 msgid "" "See the documentation of the :meth:`~WriteTransport.set_write_buffer_limits` " "method for more details." msgstr "" -#: ../../library/asyncio-protocol.rst:518 +#: ../../library/asyncio-protocol.rst:523 msgid "Called when the transport's buffer goes over the high watermark." msgstr "" -#: ../../library/asyncio-protocol.rst:522 +#: ../../library/asyncio-protocol.rst:527 msgid "Called when the transport's buffer drains below the low watermark." msgstr "" -#: ../../library/asyncio-protocol.rst:524 +#: ../../library/asyncio-protocol.rst:529 msgid "" "If the buffer size equals the high watermark, :meth:`~BaseProtocol." "pause_writing` is not called: the buffer size must go strictly over." msgstr "" -#: ../../library/asyncio-protocol.rst:528 +#: ../../library/asyncio-protocol.rst:533 msgid "" "Conversely, :meth:`~BaseProtocol.resume_writing` is called when the buffer " "size is equal or lower than the low watermark. These end conditions are " "important to ensure that things go as expected when either mark is zero." msgstr "" -#: ../../library/asyncio-protocol.rst:535 +#: ../../library/asyncio-protocol.rst:540 msgid "Streaming Protocols" msgstr "" -#: ../../library/asyncio-protocol.rst:537 +#: ../../library/asyncio-protocol.rst:542 msgid "" "Event methods, such as :meth:`loop.create_server`, :meth:`loop." "create_unix_server`, :meth:`loop.create_connection`, :meth:`loop." @@ -739,13 +746,13 @@ msgid "" "that return streaming protocols." msgstr "" -#: ../../library/asyncio-protocol.rst:545 +#: ../../library/asyncio-protocol.rst:550 msgid "" "Called when some data is received. *data* is a non-empty bytes object " "containing the incoming data." msgstr "" -#: ../../library/asyncio-protocol.rst:548 +#: ../../library/asyncio-protocol.rst:553 msgid "" "Whether the data is buffered, chunked or reassembled depends on the " "transport. In general, you shouldn't rely on specific semantics and instead " @@ -753,27 +760,27 @@ msgid "" "the correct order." msgstr "" -#: ../../library/asyncio-protocol.rst:553 +#: ../../library/asyncio-protocol.rst:558 msgid "" "The method can be called an arbitrary number of times while a connection is " "open." msgstr "" -#: ../../library/asyncio-protocol.rst:556 +#: ../../library/asyncio-protocol.rst:561 msgid "" "However, :meth:`protocol.eof_received() ` is called " "at most once. Once ``eof_received()`` is called, ``data_received()`` is not " "called anymore." msgstr "" -#: ../../library/asyncio-protocol.rst:562 +#: ../../library/asyncio-protocol.rst:567 msgid "" "Called when the other end signals it won't send any more data (for example " "by calling :meth:`transport.write_eof() `, if the " "other end also uses asyncio)." msgstr "" -#: ../../library/asyncio-protocol.rst:567 +#: ../../library/asyncio-protocol.rst:572 msgid "" "This method may return a false value (including ``None``), in which case the " "transport will close itself. Conversely, if this method returns a true " @@ -782,19 +789,19 @@ msgid "" "connection." msgstr "" -#: ../../library/asyncio-protocol.rst:573 +#: ../../library/asyncio-protocol.rst:578 msgid "" "Some transports, including SSL, don't support half-closed connections, in " "which case returning true from this method will result in the connection " "being closed." msgstr "" -#: ../../library/asyncio-protocol.rst:578 -#: ../../library/asyncio-protocol.rst:636 +#: ../../library/asyncio-protocol.rst:583 +#: ../../library/asyncio-protocol.rst:641 msgid "State machine:" msgstr "" -#: ../../library/asyncio-protocol.rst:580 +#: ../../library/asyncio-protocol.rst:585 msgid "" "start -> connection_made\n" " [-> data_received]*\n" @@ -806,17 +813,17 @@ msgstr "" " [-> eof_received]?\n" "-> connection_lost -> end" -#: ../../library/asyncio-protocol.rst:589 +#: ../../library/asyncio-protocol.rst:594 msgid "Buffered Streaming Protocols" msgstr "" -#: ../../library/asyncio-protocol.rst:593 +#: ../../library/asyncio-protocol.rst:598 msgid "" "Buffered Protocols can be used with any event loop method that supports " "`Streaming Protocols`_." msgstr "" -#: ../../library/asyncio-protocol.rst:596 +#: ../../library/asyncio-protocol.rst:601 msgid "" "``BufferedProtocol`` implementations allow explicit manual allocation and " "control of the receive buffer. Event loops can then use the buffer provided " @@ -826,16 +833,16 @@ msgid "" "number of buffer allocations." msgstr "" -#: ../../library/asyncio-protocol.rst:603 +#: ../../library/asyncio-protocol.rst:608 msgid "" "The following callbacks are called on :class:`BufferedProtocol` instances:" msgstr "" -#: ../../library/asyncio-protocol.rst:608 +#: ../../library/asyncio-protocol.rst:613 msgid "Called to allocate a new receive buffer." msgstr "" -#: ../../library/asyncio-protocol.rst:610 +#: ../../library/asyncio-protocol.rst:615 msgid "" "*sizehint* is the recommended minimum size for the returned buffer. It is " "acceptable to return smaller or larger buffers than what *sizehint* " @@ -843,27 +850,27 @@ msgid "" "to return a buffer with a zero size." msgstr "" -#: ../../library/asyncio-protocol.rst:615 +#: ../../library/asyncio-protocol.rst:620 msgid "" "``get_buffer()`` must return an object implementing the :ref:`buffer " "protocol `." msgstr "" -#: ../../library/asyncio-protocol.rst:620 +#: ../../library/asyncio-protocol.rst:625 msgid "Called when the buffer was updated with the received data." msgstr "" -#: ../../library/asyncio-protocol.rst:622 +#: ../../library/asyncio-protocol.rst:627 msgid "*nbytes* is the total number of bytes that were written to the buffer." msgstr "" -#: ../../library/asyncio-protocol.rst:626 +#: ../../library/asyncio-protocol.rst:631 msgid "" "See the documentation of the :meth:`protocol.eof_received() ` method." msgstr "" -#: ../../library/asyncio-protocol.rst:630 +#: ../../library/asyncio-protocol.rst:635 msgid "" ":meth:`~BufferedProtocol.get_buffer` can be called an arbitrary number of " "times during a connection. However, :meth:`protocol.eof_received() " @@ -872,7 +879,7 @@ msgid "" "won't be called after it." msgstr "" -#: ../../library/asyncio-protocol.rst:638 +#: ../../library/asyncio-protocol.rst:643 msgid "" "start -> connection_made\n" " [-> get_buffer\n" @@ -888,44 +895,44 @@ msgstr "" " [-> eof_received]?\n" "-> connection_lost -> end" -#: ../../library/asyncio-protocol.rst:649 +#: ../../library/asyncio-protocol.rst:654 msgid "Datagram Protocols" msgstr "" -#: ../../library/asyncio-protocol.rst:651 +#: ../../library/asyncio-protocol.rst:656 msgid "" "Datagram Protocol instances should be constructed by protocol factories " "passed to the :meth:`loop.create_datagram_endpoint` method." msgstr "" -#: ../../library/asyncio-protocol.rst:656 +#: ../../library/asyncio-protocol.rst:661 msgid "" "Called when a datagram is received. *data* is a bytes object containing the " "incoming data. *addr* is the address of the peer sending the data; the " "exact format depends on the transport." msgstr "" -#: ../../library/asyncio-protocol.rst:662 +#: ../../library/asyncio-protocol.rst:667 msgid "" "Called when a previous send or receive operation raises an :class:" "`OSError`. *exc* is the :class:`OSError` instance." msgstr "" -#: ../../library/asyncio-protocol.rst:665 +#: ../../library/asyncio-protocol.rst:670 msgid "" "This method is called in rare conditions, when the transport (e.g. UDP) " "detects that a datagram could not be delivered to its recipient. In many " "conditions though, undeliverable datagrams will be silently dropped." msgstr "" -#: ../../library/asyncio-protocol.rst:672 +#: ../../library/asyncio-protocol.rst:677 msgid "" "On BSD systems (macOS, FreeBSD, etc.) flow control is not supported for " "datagram protocols, because there is no reliable way to detect send failures " "caused by writing too many packets." msgstr "" -#: ../../library/asyncio-protocol.rst:676 +#: ../../library/asyncio-protocol.rst:681 msgid "" "The socket always appears 'ready' and excess packets are dropped. An :class:" "`OSError` with ``errno`` set to :const:`errno.ENOBUFS` may or may not be " @@ -933,64 +940,64 @@ msgid "" "error_received` but otherwise ignored." msgstr "" -#: ../../library/asyncio-protocol.rst:685 +#: ../../library/asyncio-protocol.rst:690 msgid "Subprocess Protocols" msgstr "" -#: ../../library/asyncio-protocol.rst:687 +#: ../../library/asyncio-protocol.rst:692 msgid "" "Subprocess Protocol instances should be constructed by protocol factories " "passed to the :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` " "methods." msgstr "" -#: ../../library/asyncio-protocol.rst:693 +#: ../../library/asyncio-protocol.rst:698 msgid "" "Called when the child process writes data into its stdout or stderr pipe." msgstr "" -#: ../../library/asyncio-protocol.rst:696 +#: ../../library/asyncio-protocol.rst:701 msgid "*fd* is the integer file descriptor of the pipe." msgstr "" -#: ../../library/asyncio-protocol.rst:698 +#: ../../library/asyncio-protocol.rst:703 msgid "*data* is a non-empty bytes object containing the received data." msgstr "" -#: ../../library/asyncio-protocol.rst:702 +#: ../../library/asyncio-protocol.rst:707 msgid "" "Called when one of the pipes communicating with the child process is closed." msgstr "" -#: ../../library/asyncio-protocol.rst:705 +#: ../../library/asyncio-protocol.rst:710 msgid "*fd* is the integer file descriptor that was closed." msgstr "" -#: ../../library/asyncio-protocol.rst:709 +#: ../../library/asyncio-protocol.rst:714 msgid "Called when the child process has exited." msgstr "" -#: ../../library/asyncio-protocol.rst:711 +#: ../../library/asyncio-protocol.rst:716 msgid "" "It can be called before :meth:`~SubprocessProtocol.pipe_data_received` and :" "meth:`~SubprocessProtocol.pipe_connection_lost` methods." msgstr "" -#: ../../library/asyncio-protocol.rst:716 +#: ../../library/asyncio-protocol.rst:721 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-protocol.rst:721 +#: ../../library/asyncio-protocol.rst:726 msgid "TCP Echo Server" msgstr "" -#: ../../library/asyncio-protocol.rst:723 +#: ../../library/asyncio-protocol.rst:728 msgid "" "Create a TCP echo server using the :meth:`loop.create_server` method, send " "back received data, and close the connection::" msgstr "" -#: ../../library/asyncio-protocol.rst:726 +#: ../../library/asyncio-protocol.rst:731 msgid "" "import asyncio\n" "\n" @@ -1018,7 +1025,7 @@ msgid "" " loop = asyncio.get_running_loop()\n" "\n" " server = await loop.create_server(\n" -" lambda: EchoServerProtocol(),\n" +" EchoServerProtocol,\n" " '127.0.0.1', 8888)\n" "\n" " async with server:\n" @@ -1028,23 +1035,23 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-protocol.rst:764 +#: ../../library/asyncio-protocol.rst:769 msgid "" "The :ref:`TCP echo server using streams ` " "example uses the high-level :func:`asyncio.start_server` function." msgstr "" -#: ../../library/asyncio-protocol.rst:770 +#: ../../library/asyncio-protocol.rst:775 msgid "TCP Echo Client" msgstr "" -#: ../../library/asyncio-protocol.rst:772 +#: ../../library/asyncio-protocol.rst:777 msgid "" "A TCP echo client using the :meth:`loop.create_connection` method, sends " "data, and waits until the connection is closed::" msgstr "" -#: ../../library/asyncio-protocol.rst:775 +#: ../../library/asyncio-protocol.rst:780 msgid "" "import asyncio\n" "\n" @@ -1089,23 +1096,23 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-protocol.rst:820 +#: ../../library/asyncio-protocol.rst:825 msgid "" "The :ref:`TCP echo client using streams ` " "example uses the high-level :func:`asyncio.open_connection` function." msgstr "" -#: ../../library/asyncio-protocol.rst:827 +#: ../../library/asyncio-protocol.rst:832 msgid "UDP Echo Server" msgstr "" -#: ../../library/asyncio-protocol.rst:829 +#: ../../library/asyncio-protocol.rst:834 msgid "" "A UDP echo server, using the :meth:`loop.create_datagram_endpoint` method, " "sends back received data::" msgstr "" -#: ../../library/asyncio-protocol.rst:832 +#: ../../library/asyncio-protocol.rst:837 msgid "" "import asyncio\n" "\n" @@ -1131,7 +1138,7 @@ msgid "" " # One protocol instance will be created to serve all\n" " # client requests.\n" " transport, protocol = await loop.create_datagram_endpoint(\n" -" lambda: EchoServerProtocol(),\n" +" EchoServerProtocol,\n" " local_addr=('127.0.0.1', 9999))\n" "\n" " try:\n" @@ -1143,17 +1150,17 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-protocol.rst:871 +#: ../../library/asyncio-protocol.rst:876 msgid "UDP Echo Client" msgstr "" -#: ../../library/asyncio-protocol.rst:873 +#: ../../library/asyncio-protocol.rst:878 msgid "" "A UDP echo client, using the :meth:`loop.create_datagram_endpoint` method, " "sends data and closes the transport when it receives the answer::" msgstr "" -#: ../../library/asyncio-protocol.rst:876 +#: ../../library/asyncio-protocol.rst:881 msgid "" "import asyncio\n" "\n" @@ -1204,17 +1211,17 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-protocol.rst:928 +#: ../../library/asyncio-protocol.rst:933 msgid "Connecting Existing Sockets" msgstr "" -#: ../../library/asyncio-protocol.rst:930 +#: ../../library/asyncio-protocol.rst:935 msgid "" "Wait until a socket receives data using the :meth:`loop.create_connection` " "method with a protocol::" msgstr "" -#: ../../library/asyncio-protocol.rst:933 +#: ../../library/asyncio-protocol.rst:938 msgid "" "import asyncio\n" "import socket\n" @@ -1266,35 +1273,35 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-protocol.rst:984 +#: ../../library/asyncio-protocol.rst:989 msgid "" "The :ref:`watch a file descriptor for read events " "` example uses the low-level :meth:`loop." "add_reader` method to register an FD." msgstr "" -#: ../../library/asyncio-protocol.rst:988 +#: ../../library/asyncio-protocol.rst:993 msgid "" "The :ref:`register an open socket to wait for data using streams " "` example uses high-level streams " "created by the :func:`open_connection` function in a coroutine." msgstr "" -#: ../../library/asyncio-protocol.rst:995 +#: ../../library/asyncio-protocol.rst:1000 msgid "loop.subprocess_exec() and SubprocessProtocol" msgstr "" -#: ../../library/asyncio-protocol.rst:997 +#: ../../library/asyncio-protocol.rst:1002 msgid "" "An example of a subprocess protocol used to get the output of a subprocess " "and to wait for the subprocess exit." msgstr "" -#: ../../library/asyncio-protocol.rst:1000 +#: ../../library/asyncio-protocol.rst:1005 msgid "The subprocess is created by the :meth:`loop.subprocess_exec` method::" msgstr "" -#: ../../library/asyncio-protocol.rst:1002 +#: ../../library/asyncio-protocol.rst:1007 msgid "" "import asyncio\n" "import sys\n" @@ -1355,7 +1362,7 @@ msgid "" "print(f\"Current date: {date}\")" msgstr "" -#: ../../library/asyncio-protocol.rst:1060 +#: ../../library/asyncio-protocol.rst:1065 msgid "" "See also the :ref:`same example ` " "written using high-level APIs." diff --git a/library/asyncio-queue.po b/library/asyncio-queue.po index 9fdc258a29..088dea0967 100644 --- a/library/asyncio-queue.po +++ b/library/asyncio-queue.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-02-20 18:34+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -109,16 +109,22 @@ msgid "" "item is available." msgstr "從佇列中刪除並回傳一個元素。如果佇列為空,則持續等待直到佇列中有元素。" -#: ../../library/asyncio-queue.rst:67 +#: ../../library/asyncio-queue.rst:65 +msgid "" +"Raises :exc:`QueueShutDown` if the queue has been shut down and is empty, or " +"if the queue has been shut down immediately." +msgstr "" + +#: ../../library/asyncio-queue.rst:70 msgid "" "Return an item if one is immediately available, else raise :exc:`QueueEmpty`." msgstr "如果佇列內有值則立即回傳佇列中的元素,否則引發 :exc:`QueueEmpty`。" -#: ../../library/asyncio-queue.rst:72 +#: ../../library/asyncio-queue.rst:75 msgid "Block until all items in the queue have been received and processed." msgstr "持續阻塞直到佇列中所有的元素都被接收和處理完畢。" -#: ../../library/asyncio-queue.rst:74 +#: ../../library/asyncio-queue.rst:77 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " "queue. The count goes down whenever a consumer coroutine calls :meth:" @@ -131,7 +137,7 @@ msgstr "" "成,未完成任務計數就會減少。當未完成計數降到零的時候,:meth:`join` 阻塞會被解" "除 (unblock)。" -#: ../../library/asyncio-queue.rst:82 +#: ../../library/asyncio-queue.rst:85 msgid "" "Put an item into the queue. If the queue is full, wait until a free slot is " "available before adding the item." @@ -139,23 +145,48 @@ msgstr "" "將一個元素放進佇列。如果佇列滿了,在新增元素之前,會持續等待直到有空閒插槽 " "(free slot) 能被使用。" -#: ../../library/asyncio-queue.rst:87 +#: ../../library/asyncio-queue.rst:88 +msgid "Raises :exc:`QueueShutDown` if the queue has been shut down." +msgstr "" + +#: ../../library/asyncio-queue.rst:92 msgid "Put an item into the queue without blocking." msgstr "不阻塞地將一個元素放入佇列。" -#: ../../library/asyncio-queue.rst:89 +#: ../../library/asyncio-queue.rst:94 msgid "If no free slot is immediately available, raise :exc:`QueueFull`." msgstr "如果沒有立即可用的空閒插槽,引發 :exc:`QueueFull`。" -#: ../../library/asyncio-queue.rst:93 +#: ../../library/asyncio-queue.rst:98 msgid "Return the number of items in the queue." msgstr "回傳佇列中的元素數量。" -#: ../../library/asyncio-queue.rst:97 +#: ../../library/asyncio-queue.rst:102 +msgid "" +"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` raise :" +"exc:`QueueShutDown`." +msgstr "" + +#: ../../library/asyncio-queue.rst:105 +msgid "" +"By default, :meth:`~Queue.get` on a shut down queue will only raise once the " +"queue is empty. Set *immediate* to true to make :meth:`~Queue.get` raise " +"immediately instead." +msgstr "" + +#: ../../library/asyncio-queue.rst:109 +msgid "" +"All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be " +"unblocked. If *immediate* is true, a task will be marked as done for each " +"remaining item in the queue, which may unblock callers of :meth:`~Queue." +"join`." +msgstr "" + +#: ../../library/asyncio-queue.rst:118 msgid "Indicate that a formerly enqueued task is complete." msgstr "表示前面一個排隊的任務已經完成。" -#: ../../library/asyncio-queue.rst:99 +#: ../../library/asyncio-queue.rst:120 msgid "" "Used by queue consumers. For each :meth:`~Queue.get` used to fetch a task, a " "subsequent call to :meth:`task_done` tells the queue that the processing on " @@ -164,7 +195,7 @@ msgstr "" "由佇列消耗者使用。對於每個用於獲取一個任務的 :meth:`~Queue.get`,接續的 :" "meth:`task_done` 呼叫會告訴佇列這個任務的處理已經完成。" -#: ../../library/asyncio-queue.rst:103 +#: ../../library/asyncio-queue.rst:124 msgid "" "If a :meth:`join` is currently blocking, it will resume when all items have " "been processed (meaning that a :meth:`task_done` call was received for every " @@ -173,47 +204,53 @@ msgstr "" "如果 :meth:`join` 當前正在阻塞,在所有項目都被處理後會解除阻塞(意味著每個" "以 :meth:`~Queue.put` 放進佇列的條目都會收到一個 :meth:`task_done`\\ )。" -#: ../../library/asyncio-queue.rst:108 +#: ../../library/asyncio-queue.rst:129 +msgid "" +"``shutdown(immediate=True)`` calls :meth:`task_done` for each remaining item " +"in the queue." +msgstr "" + +#: ../../library/asyncio-queue.rst:132 msgid "" "Raises :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "如果被呼叫的次數多於放入佇列中的項目數量,將引發 :exc:`ValueError`。" -#: ../../library/asyncio-queue.rst:113 +#: ../../library/asyncio-queue.rst:137 msgid "Priority Queue" msgstr "Priority Queue(優先佇列)" -#: ../../library/asyncio-queue.rst:117 +#: ../../library/asyncio-queue.rst:141 msgid "" "A variant of :class:`Queue`; retrieves entries in priority order (lowest " "first)." msgstr ":class:`Queue` 的變形;按優先順序取出條目 (最小的先取出)。" -#: ../../library/asyncio-queue.rst:120 +#: ../../library/asyncio-queue.rst:144 msgid "Entries are typically tuples of the form ``(priority_number, data)``." msgstr "條目通常是 ``(priority_number, data)`` 形式的 tuple(元組)。" -#: ../../library/asyncio-queue.rst:125 +#: ../../library/asyncio-queue.rst:149 msgid "LIFO Queue" msgstr "LIFO Queue" -#: ../../library/asyncio-queue.rst:129 +#: ../../library/asyncio-queue.rst:153 msgid "" "A variant of :class:`Queue` that retrieves most recently added entries first " "(last in, first out)." msgstr ":class:`Queue` 的變形,先取出最近新增的條目(後進先出)。" -#: ../../library/asyncio-queue.rst:134 +#: ../../library/asyncio-queue.rst:158 msgid "Exceptions" msgstr "例外" -#: ../../library/asyncio-queue.rst:138 +#: ../../library/asyncio-queue.rst:162 msgid "" "This exception is raised when the :meth:`~Queue.get_nowait` method is called " "on an empty queue." msgstr "當佇列為空的時候,呼叫 :meth:`~Queue.get_nowait` 方法會引發這個例外。" -#: ../../library/asyncio-queue.rst:144 +#: ../../library/asyncio-queue.rst:168 msgid "" "Exception raised when the :meth:`~Queue.put_nowait` method is called on a " "queue that has reached its *maxsize*." @@ -221,16 +258,25 @@ msgstr "" "當佇列中條目數量已經達到它的 *maxsize* 時,呼叫 :meth:`~Queue.put_nowait` 方" "法會引發這個例外。" -#: ../../library/asyncio-queue.rst:149 +#: ../../library/asyncio-queue.rst:174 +#, fuzzy +msgid "" +"Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on " +"a queue which has been shut down." +msgstr "" +"當佇列中條目數量已經達到它的 *maxsize* 時,呼叫 :meth:`~Queue.put_nowait` 方" +"法會引發這個例外。" + +#: ../../library/asyncio-queue.rst:181 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-queue.rst:153 +#: ../../library/asyncio-queue.rst:185 msgid "" "Queues can be used to distribute workload between several concurrent tasks::" msgstr "佇列能被用於多個並行任務的工作分配:" -#: ../../library/asyncio-queue.rst:156 +#: ../../library/asyncio-queue.rst:188 msgid "" "import asyncio\n" "import random\n" diff --git a/library/asyncio-runner.po b/library/asyncio-runner.po index 374d66b0e3..0dd0adb9cc 100644 --- a/library/asyncio-runner.po +++ b/library/asyncio-runner.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -54,13 +54,13 @@ msgstr "" "這個函式負責運行被傳入的協程、管理 asyncio 的事件迴圈、*終結非同步產生器*,以" "及關閉執行器。" -#: ../../library/asyncio-runner.rst:33 ../../library/asyncio-runner.rst:113 +#: ../../library/asyncio-runner.rst:33 ../../library/asyncio-runner.rst:115 msgid "" "This function cannot be called when another asyncio event loop is running in " "the same thread." msgstr "當另一個非同步事件迴圈在同一執行緒中執行時,無法呼叫此函式。" -#: ../../library/asyncio-runner.rst:36 ../../library/asyncio-runner.rst:83 +#: ../../library/asyncio-runner.rst:36 ../../library/asyncio-runner.rst:85 msgid "" "If *debug* is ``True``, the event loop will be run in debug mode. ``False`` " "disables debug mode explicitly. ``None`` is used to respect the global :ref:" @@ -71,30 +71,32 @@ msgstr "" "定。" #: ../../library/asyncio-runner.rst:40 +#, fuzzy msgid "" "If *loop_factory* is not ``None``, it is used to create a new event loop; " "otherwise :func:`asyncio.new_event_loop` is used. The loop is closed at the " "end. This function should be used as a main entry point for asyncio " "programs, and should ideally only be called once. It is recommended to use " -"*loop_factory* to configure the event loop instead of policies." +"*loop_factory* to configure the event loop instead of policies. Passing :" +"class:`asyncio.EventLoop` allows running asyncio without the policy system." msgstr "" "如果 *loop_factory* 不為 ``None``,它會被用於建立一個新的事件迴圈;否則會改" "用 :func:`asyncio.new_event_loop`。迴圈會在最後關閉。這個函式應該要作為" "asyncio 程式的主要進入點,且理想上僅會被呼叫一次。推薦使用 *loop_factory* 來" "設定事件迴圈時而不是使用 policies(政策)。" -#: ../../library/asyncio-runner.rst:46 +#: ../../library/asyncio-runner.rst:48 msgid "" "The executor is given a timeout duration of 5 minutes to shutdown. If the " "executor hasn't finished within that duration, a warning is emitted and the " "executor is closed." msgstr "" -#: ../../library/asyncio-runner.rst:50 +#: ../../library/asyncio-runner.rst:52 msgid "Example::" msgstr "範例: ::" -#: ../../library/asyncio-runner.rst:52 +#: ../../library/asyncio-runner.rst:54 msgid "" "async def main():\n" " await asyncio.sleep(1)\n" @@ -108,36 +110,36 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../library/asyncio-runner.rst:60 +#: ../../library/asyncio-runner.rst:62 msgid "Updated to use :meth:`loop.shutdown_default_executor`." msgstr "" -#: ../../library/asyncio-runner.rst:65 +#: ../../library/asyncio-runner.rst:67 msgid "" "*debug* is ``None`` by default to respect the global debug mode settings." msgstr "" -#: ../../library/asyncio-runner.rst:69 +#: ../../library/asyncio-runner.rst:71 msgid "Added *loop_factory* parameter." msgstr "新增 *loop_factory* 參數。" -#: ../../library/asyncio-runner.rst:73 +#: ../../library/asyncio-runner.rst:75 msgid "Runner context manager" msgstr "" -#: ../../library/asyncio-runner.rst:77 +#: ../../library/asyncio-runner.rst:79 msgid "" "A context manager that simplifies *multiple* async function calls in the " "same context." msgstr "" -#: ../../library/asyncio-runner.rst:80 +#: ../../library/asyncio-runner.rst:82 msgid "" "Sometimes several top-level async functions should be called in the same :" "ref:`event loop ` and :class:`contextvars.Context`." msgstr "" -#: ../../library/asyncio-runner.rst:87 +#: ../../library/asyncio-runner.rst:89 msgid "" "*loop_factory* could be used for overriding the loop creation. It is the " "responsibility of the *loop_factory* to set the created loop as the current " @@ -145,13 +147,13 @@ msgid "" "event loop with :func:`asyncio.set_event_loop` if *loop_factory* is ``None``." msgstr "" -#: ../../library/asyncio-runner.rst:92 +#: ../../library/asyncio-runner.rst:94 msgid "" "Basically, :func:`asyncio.run` example can be rewritten with the runner " "usage::" msgstr "" -#: ../../library/asyncio-runner.rst:94 +#: ../../library/asyncio-runner.rst:96 msgid "" "async def main():\n" " await asyncio.sleep(1)\n" @@ -167,52 +169,52 @@ msgstr "" "with asyncio.Runner() as runner:\n" " runner.run(main())" -#: ../../library/asyncio-runner.rst:105 +#: ../../library/asyncio-runner.rst:107 msgid "Run a :term:`coroutine ` *coro* in the embedded loop." msgstr "" -#: ../../library/asyncio-runner.rst:107 +#: ../../library/asyncio-runner.rst:109 msgid "Return the coroutine's result or raise its exception." msgstr "" -#: ../../library/asyncio-runner.rst:109 +#: ../../library/asyncio-runner.rst:111 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *coro* to run in. The runner's default " "context is used if ``None``." msgstr "" -#: ../../library/asyncio-runner.rst:118 +#: ../../library/asyncio-runner.rst:120 msgid "Close the runner." msgstr "" -#: ../../library/asyncio-runner.rst:120 +#: ../../library/asyncio-runner.rst:122 msgid "" "Finalize asynchronous generators, shutdown default executor, close the event " "loop and release embedded :class:`contextvars.Context`." msgstr "" -#: ../../library/asyncio-runner.rst:125 +#: ../../library/asyncio-runner.rst:127 msgid "Return the event loop associated with the runner instance." msgstr "" -#: ../../library/asyncio-runner.rst:129 +#: ../../library/asyncio-runner.rst:131 msgid "" ":class:`Runner` uses the lazy initialization strategy, its constructor " "doesn't initialize underlying low-level structures." msgstr "" -#: ../../library/asyncio-runner.rst:132 +#: ../../library/asyncio-runner.rst:134 msgid "" "Embedded *loop* and *context* are created at the :keyword:`with` body " "entering or the first call of :meth:`run` or :meth:`get_loop`." msgstr "" -#: ../../library/asyncio-runner.rst:137 +#: ../../library/asyncio-runner.rst:139 msgid "Handling Keyboard Interruption" msgstr "" -#: ../../library/asyncio-runner.rst:141 +#: ../../library/asyncio-runner.rst:143 msgid "" "When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, :exc:" "`KeyboardInterrupt` exception is raised in the main thread by default. " @@ -220,26 +222,26 @@ msgid "" "asyncio internals and can hang the program from exiting." msgstr "" -#: ../../library/asyncio-runner.rst:146 +#: ../../library/asyncio-runner.rst:148 msgid "" "To mitigate this issue, :mod:`asyncio` handles :const:`signal.SIGINT` as " "follows:" msgstr "" -#: ../../library/asyncio-runner.rst:148 +#: ../../library/asyncio-runner.rst:150 msgid "" ":meth:`asyncio.Runner.run` installs a custom :const:`signal.SIGINT` handler " "before any user code is executed and removes it when exiting from the " "function." msgstr "" -#: ../../library/asyncio-runner.rst:150 +#: ../../library/asyncio-runner.rst:152 msgid "" "The :class:`~asyncio.Runner` creates the main task for the passed coroutine " "for its execution." msgstr "" -#: ../../library/asyncio-runner.rst:152 +#: ../../library/asyncio-runner.rst:154 msgid "" "When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, the custom signal " "handler cancels the main task by calling :meth:`asyncio.Task.cancel` which " @@ -249,7 +251,7 @@ msgid "" "Runner.run` raises :exc:`KeyboardInterrupt`." msgstr "" -#: ../../library/asyncio-runner.rst:158 +#: ../../library/asyncio-runner.rst:160 msgid "" "A user could write a tight loop which cannot be interrupted by :meth:" "`asyncio.Task.cancel`, in which case the second following :kbd:`Ctrl-C` " diff --git a/library/asyncio-stream.po b/library/asyncio-stream.po index 524e90c944..a89301bcf9 100644 --- a/library/asyncio-stream.po +++ b/library/asyncio-stream.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-10-31 16:28+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,7 +42,7 @@ msgstr "" msgid "Here is an example of a TCP echo client written using asyncio streams::" msgstr "這是一個使用 asyncio 串流編寫的 TCP echo 客戶端範例: ::" -#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:404 +#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:415 msgid "" "import asyncio\n" "\n" @@ -146,7 +146,7 @@ msgstr "移除 *loop* 參數。" #: ../../library/asyncio-stream.rst:86 ../../library/asyncio-stream.rst:128 #: ../../library/asyncio-stream.rst:160 ../../library/asyncio-stream.rst:190 -#: ../../library/asyncio-stream.rst:372 +#: ../../library/asyncio-stream.rst:383 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "新增 *ssl_shutdown_timeout* 參數。" @@ -352,20 +352,32 @@ msgstr "" "`IncompleteReadError` 例外,且內部緩衝區會被重置。:attr:`IncompleteReadError." "partial` 屬性可能包含一部分的 separator。" -#: ../../library/asyncio-stream.rst:267 +#: ../../library/asyncio-stream.rst:263 +msgid "" +"The *separator* may also be a tuple of separators. In this case the return " +"value will be the shortest possible that has any separator as the suffix. " +"For the purposes of :exc:`LimitOverrunError`, the shortest possible " +"separator is considered to be the one that matched." +msgstr "" + +#: ../../library/asyncio-stream.rst:273 +msgid "The *separator* parameter may now be a :class:`tuple` of separators." +msgstr "" + +#: ../../library/asyncio-stream.rst:278 msgid "Return ``True`` if the buffer is empty and :meth:`feed_eof` was called." msgstr "如果緩衝區是空的且 :meth:`feed_eof` 曾被呼叫則回傳 ``True``。" -#: ../../library/asyncio-stream.rst:272 +#: ../../library/asyncio-stream.rst:283 msgid "StreamWriter" msgstr "StreamWriter" -#: ../../library/asyncio-stream.rst:276 +#: ../../library/asyncio-stream.rst:287 msgid "" "Represents a writer object that provides APIs to write data to the IO stream." msgstr "表示一個有提供 API 來將資料寫入 IO 串流的 writer 物件。" -#: ../../library/asyncio-stream.rst:279 +#: ../../library/asyncio-stream.rst:290 msgid "" "It is not recommended to instantiate *StreamWriter* objects directly; use :" "func:`open_connection` and :func:`start_server` instead." @@ -373,7 +385,7 @@ msgstr "" "不建議直接實例化 *StreamWriter* 物件;使用 :func:`open_connection` 和 :func:" "`start_server` 會是較好的做法。" -#: ../../library/asyncio-stream.rst:285 +#: ../../library/asyncio-stream.rst:296 msgid "" "The method attempts to write the *data* to the underlying socket " "immediately. If that fails, the data is queued in an internal write buffer " @@ -382,11 +394,11 @@ msgstr "" "此方法會嘗試立即將 *data* 寫入到底層的 socket。如果失敗,資料會被放到內部寫入" "緩衝中排隊等待 (queue),直到它可被發送。" -#: ../../library/asyncio-stream.rst:289 ../../library/asyncio-stream.rst:301 +#: ../../library/asyncio-stream.rst:300 ../../library/asyncio-stream.rst:312 msgid "The method should be used along with the ``drain()`` method::" msgstr "此方法應當與 ``drain()`` 方法一起使用: ::" -#: ../../library/asyncio-stream.rst:291 +#: ../../library/asyncio-stream.rst:302 msgid "" "stream.write(data)\n" "await stream.drain()" @@ -394,7 +406,7 @@ msgstr "" "stream.write(data)\n" "await stream.drain()" -#: ../../library/asyncio-stream.rst:296 +#: ../../library/asyncio-stream.rst:307 msgid "" "The method writes a list (or any iterable) of bytes to the underlying socket " "immediately. If that fails, the data is queued in an internal write buffer " @@ -403,7 +415,7 @@ msgstr "" "此方法會立即嘗試將一個位元組 list(或任何可疊代物件 (iterable))寫入到底層的 " "socket。如果失敗,資料會被放到內部寫入緩衝中排隊等待,直到它可被發送。" -#: ../../library/asyncio-stream.rst:303 +#: ../../library/asyncio-stream.rst:314 msgid "" "stream.writelines(lines)\n" "await stream.drain()" @@ -411,17 +423,17 @@ msgstr "" "stream.writelines(lines)\n" "await stream.drain()" -#: ../../library/asyncio-stream.rst:308 +#: ../../library/asyncio-stream.rst:319 msgid "The method closes the stream and the underlying socket." msgstr "此方法會關閉串流以及底層的 socket。" -#: ../../library/asyncio-stream.rst:310 +#: ../../library/asyncio-stream.rst:321 msgid "" "The method should be used, though not mandatory, along with the " "``wait_closed()`` method::" msgstr "此方法應與 ``wait_closed()`` 方法一起使用,但並非強制: ::" -#: ../../library/asyncio-stream.rst:313 +#: ../../library/asyncio-stream.rst:324 msgid "" "stream.close()\n" "await stream.wait_closed()" @@ -429,7 +441,7 @@ msgstr "" "stream.close()\n" "await stream.wait_closed()" -#: ../../library/asyncio-stream.rst:318 +#: ../../library/asyncio-stream.rst:329 msgid "" "Return ``True`` if the underlying transport supports the :meth:`write_eof` " "method, ``False`` otherwise." @@ -437,26 +449,26 @@ msgstr "" "如果底層的傳輸支援 :meth:`write_eof` 方法就回傳 ``True``,否則回傳 " "``False``。" -#: ../../library/asyncio-stream.rst:323 +#: ../../library/asyncio-stream.rst:334 msgid "" "Close the write end of the stream after the buffered write data is flushed." msgstr "在已緩衝的寫入資料被清理 (flush) 後關閉串流的寫入端。" -#: ../../library/asyncio-stream.rst:328 +#: ../../library/asyncio-stream.rst:339 msgid "Return the underlying asyncio transport." msgstr "回傳底層的 asyncio 傳輸。" -#: ../../library/asyncio-stream.rst:332 +#: ../../library/asyncio-stream.rst:343 msgid "" "Access optional transport information; see :meth:`BaseTransport." "get_extra_info` for details." msgstr "存取可選的傳輸資訊;詳情請見 :meth:`BaseTransport.get_extra_info`。" -#: ../../library/asyncio-stream.rst:337 +#: ../../library/asyncio-stream.rst:348 msgid "Wait until it is appropriate to resume writing to the stream. Example::" msgstr "等待直到可以繼續寫入到串流。範例: ::" -#: ../../library/asyncio-stream.rst:340 +#: ../../library/asyncio-stream.rst:351 msgid "" "writer.write(data)\n" "await writer.drain()" @@ -464,7 +476,7 @@ msgstr "" "writer.write(data)\n" "await writer.drain()" -#: ../../library/asyncio-stream.rst:343 +#: ../../library/asyncio-stream.rst:354 msgid "" "This is a flow control method that interacts with the underlying IO write " "buffer. When the size of the buffer reaches the high watermark, *drain()* " @@ -476,48 +488,48 @@ msgstr "" "(high watermark) 時,*drain()* 會阻塞直到緩衝區大小減少至最低標記位 (low " "watermark) 以便繼續寫入。當沒有要等待的資料時,:meth:`drain` 會立即回傳。" -#: ../../library/asyncio-stream.rst:353 +#: ../../library/asyncio-stream.rst:364 msgid "Upgrade an existing stream-based connection to TLS." msgstr "" -#: ../../library/asyncio-stream.rst:355 +#: ../../library/asyncio-stream.rst:366 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-stream.rst:357 +#: ../../library/asyncio-stream.rst:368 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "" -#: ../../library/asyncio-stream.rst:359 +#: ../../library/asyncio-stream.rst:370 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "" -#: ../../library/asyncio-stream.rst:362 +#: ../../library/asyncio-stream.rst:373 msgid "" "*ssl_handshake_timeout* is the time in seconds to wait for the TLS handshake " "to complete before aborting the connection. ``60.0`` seconds if ``None`` " "(default)." msgstr "" -#: ../../library/asyncio-stream.rst:366 +#: ../../library/asyncio-stream.rst:377 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " "(default)." msgstr "" -#: ../../library/asyncio-stream.rst:378 +#: ../../library/asyncio-stream.rst:389 msgid "" "Return ``True`` if the stream is closed or in the process of being closed." msgstr "如果串流已被關閉或正在被關閉則回傳 ``True``。" -#: ../../library/asyncio-stream.rst:385 +#: ../../library/asyncio-stream.rst:396 msgid "Wait until the stream is closed." msgstr "等待直到串流被關閉。" -#: ../../library/asyncio-stream.rst:387 +#: ../../library/asyncio-stream.rst:398 msgid "" "Should be called after :meth:`close` to wait until the underlying connection " "is closed, ensuring that all data has been flushed before e.g. exiting the " @@ -526,19 +538,19 @@ msgstr "" "應當在 :meth:`close` 之後才被呼叫,這會持續等待直到底層的連線被關閉,以確保在" "這之前(例如在程式退出前)所有資料都已經被清空" -#: ../../library/asyncio-stream.rst:395 +#: ../../library/asyncio-stream.rst:406 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-stream.rst:400 +#: ../../library/asyncio-stream.rst:411 msgid "TCP echo client using streams" msgstr "使用串流的 TCP echo 客戶端" -#: ../../library/asyncio-stream.rst:402 +#: ../../library/asyncio-stream.rst:413 msgid "TCP echo client using the :func:`asyncio.open_connection` function::" msgstr "使用 :func:`asyncio.open_connection` 函式的 TCP echo 客戶端: ::" -#: ../../library/asyncio-stream.rst:426 +#: ../../library/asyncio-stream.rst:437 msgid "" "The :ref:`TCP echo client protocol " "` example uses the low-level :meth:" @@ -547,15 +559,15 @@ msgstr "" "使用低階 :meth:`loop.create_connection` 方法的 :ref:`TCP echo 客戶端協定 " "`\\ 範例。" -#: ../../library/asyncio-stream.rst:433 +#: ../../library/asyncio-stream.rst:444 msgid "TCP echo server using streams" msgstr "使用串流的 TCP echo 伺服器" -#: ../../library/asyncio-stream.rst:435 +#: ../../library/asyncio-stream.rst:446 msgid "TCP echo server using the :func:`asyncio.start_server` function::" msgstr "TCP echo 伺服器使用 :func:`asyncio.start_server` 函式: ::" -#: ../../library/asyncio-stream.rst:437 +#: ../../library/asyncio-stream.rst:448 msgid "" "import asyncio\n" "\n" @@ -615,7 +627,7 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../library/asyncio-stream.rst:469 +#: ../../library/asyncio-stream.rst:480 msgid "" "The :ref:`TCP echo server protocol " "` example uses the :meth:`loop." @@ -624,16 +636,16 @@ msgstr "" "使用 :meth:`loop.create_server` 方法的 :ref:`TCP echo 伺服器協定 " "` 範例。" -#: ../../library/asyncio-stream.rst:474 +#: ../../library/asyncio-stream.rst:485 msgid "Get HTTP headers" msgstr "獲取 HTTP 標頭" -#: ../../library/asyncio-stream.rst:476 +#: ../../library/asyncio-stream.rst:487 msgid "" "Simple example querying HTTP headers of the URL passed on the command line::" msgstr "查詢自命令列傳入之 URL 所帶有 HTTP 標頭的簡單範例: ::" -#: ../../library/asyncio-stream.rst:478 +#: ../../library/asyncio-stream.rst:489 msgid "" "import asyncio\n" "import urllib.parse\n" @@ -672,34 +684,34 @@ msgid "" "asyncio.run(print_http_headers(url))" msgstr "" -#: ../../library/asyncio-stream.rst:515 +#: ../../library/asyncio-stream.rst:526 msgid "Usage::" msgstr "用法: ::" -#: ../../library/asyncio-stream.rst:517 +#: ../../library/asyncio-stream.rst:528 msgid "python example.py http://example.com/path/page.html" msgstr "python example.py http://example.com/path/page.html" -#: ../../library/asyncio-stream.rst:519 +#: ../../library/asyncio-stream.rst:530 msgid "or with HTTPS::" msgstr "或使用 HTTPS: ::" -#: ../../library/asyncio-stream.rst:521 +#: ../../library/asyncio-stream.rst:532 msgid "python example.py https://example.com/path/page.html" msgstr "python example.py https://example.com/path/page.html" -#: ../../library/asyncio-stream.rst:527 +#: ../../library/asyncio-stream.rst:538 msgid "Register an open socket to wait for data using streams" msgstr "註冊一個使用串流來等待資料的開放 socket" -#: ../../library/asyncio-stream.rst:529 +#: ../../library/asyncio-stream.rst:540 msgid "" "Coroutine waiting until a socket receives data using the :func:" "`open_connection` function::" msgstr "" "等待直到 socket 透過使用 :func:`open_connection` 函式接收到資料的協程: ::" -#: ../../library/asyncio-stream.rst:532 +#: ../../library/asyncio-stream.rst:543 msgid "" "import asyncio\n" "import socket\n" @@ -732,7 +744,7 @@ msgid "" "asyncio.run(wait_for_data())" msgstr "" -#: ../../library/asyncio-stream.rst:564 +#: ../../library/asyncio-stream.rst:575 msgid "" "The :ref:`register an open socket to wait for data using a protocol " "` example uses a low-level protocol and " @@ -742,7 +754,7 @@ msgstr "" "`\\ 範例中,有使用了低階協定以及 :meth:" "`loop.create_connection` 方法。" -#: ../../library/asyncio-stream.rst:568 +#: ../../library/asyncio-stream.rst:579 msgid "" "The :ref:`watch a file descriptor for read events " "` example uses the low-level :meth:`loop." diff --git a/library/asyncio-sync.po b/library/asyncio-sync.po index 04f6aea38c..ffee4a801a 100644 --- a/library/asyncio-sync.po +++ b/library/asyncio-sync.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-02-09 19:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -109,7 +109,7 @@ msgid "" msgstr "" #: ../../library/asyncio-sync.rst:56 ../../library/asyncio-sync.rst:199 -#: ../../library/asyncio-sync.rst:298 +#: ../../library/asyncio-sync.rst:304 msgid "which is equivalent to::" msgstr "這等價於: ::" @@ -126,8 +126,8 @@ msgid "" msgstr "" #: ../../library/asyncio-sync.rst:67 ../../library/asyncio-sync.rst:112 -#: ../../library/asyncio-sync.rst:187 ../../library/asyncio-sync.rst:286 -#: ../../library/asyncio-sync.rst:341 +#: ../../library/asyncio-sync.rst:187 ../../library/asyncio-sync.rst:292 +#: ../../library/asyncio-sync.rst:347 msgid "Removed the *loop* parameter." msgstr "移除 ``loop`` 參數。" @@ -201,7 +201,7 @@ msgstr "" "wait` 方法會被阻塞 (block) 直到該旗標被設為 *true*。該旗標初始設置為 " "*false*。" -#: ../../library/asyncio-sync.rst:117 ../../library/asyncio-sync.rst:365 +#: ../../library/asyncio-sync.rst:117 ../../library/asyncio-sync.rst:371 msgid "Example::" msgstr "範例: ::" @@ -340,9 +340,10 @@ msgstr "" "``True``。" #: ../../library/asyncio-sync.rst:219 +#, fuzzy msgid "" -"Wake up at most *n* tasks (1 by default) waiting on this condition. The " -"method is no-op if no tasks are waiting." +"Wake up *n* tasks (1 by default) waiting on this condition. If fewer than " +"*n* tasks are waiting they are all awakened." msgstr "" "喚醒至多 *n* 個正在等待此條件的任務(預設為 1),如果沒有正在等待的任務則此方" "法為空操作 (no-op)。" @@ -398,27 +399,36 @@ msgstr "" "`notify_all` 的呼叫所喚醒。一但被喚醒,Condition 會重新獲取該鎖且此方法會回" "傳 ``True``。" -#: ../../library/asyncio-sync.rst:262 +#: ../../library/asyncio-sync.rst:260 +msgid "" +"Note that a task *may* return from this call spuriously, which is why the " +"caller should always re-check the state and be prepared to :meth:`wait` " +"again. For this reason, you may prefer to use :meth:`wait_for` instead." +msgstr "" + +#: ../../library/asyncio-sync.rst:267 msgid "Wait until a predicate becomes *true*." msgstr "持續等待直到謂語 (predicate) 成為 *true*。" -#: ../../library/asyncio-sync.rst:264 +#: ../../library/asyncio-sync.rst:269 +#, fuzzy msgid "" "The predicate must be a callable which result will be interpreted as a " -"boolean value. The final value is the return value." +"boolean value. The method will repeatedly :meth:`wait` until the predicate " +"evaluates to *true*. The final value is the return value." msgstr "" "謂語必須是一個結果可被直譯為一個 boolean 值的可呼叫物件 (callable)。最終值為" "回傳值。" -#: ../../library/asyncio-sync.rst:270 +#: ../../library/asyncio-sync.rst:276 msgid "Semaphore" msgstr "Semaphore" -#: ../../library/asyncio-sync.rst:274 +#: ../../library/asyncio-sync.rst:280 msgid "A Semaphore object. Not thread-safe." msgstr "一個旗號 (semaphore) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:276 +#: ../../library/asyncio-sync.rst:282 msgid "" "A semaphore manages an internal counter which is decremented by each :meth:" "`acquire` call and incremented by each :meth:`release` call. The counter can " @@ -429,7 +439,7 @@ msgstr "" "呼叫 :meth:`release` 時增加一。此計數器永遠不會少於零;當 :meth:`acquire` 發" "現它是零時,它會持續阻塞並等待某任務呼叫 :meth:`release`。" -#: ../../library/asyncio-sync.rst:282 +#: ../../library/asyncio-sync.rst:288 msgid "" "The optional *value* argument gives the initial value for the internal " "counter (``1`` by default). If the given value is less than ``0`` a :exc:" @@ -438,12 +448,12 @@ msgstr "" "可選的 *value* 引數給定了內部計數器的初始值(預設為 ``1``\\ )。如給定的值少" "於 ``0`` 則 :exc:`ValueError` 會被引發。" -#: ../../library/asyncio-sync.rst:289 +#: ../../library/asyncio-sync.rst:295 msgid "" "The preferred way to use a Semaphore is an :keyword:`async with` statement::" msgstr "使用 Semaphore 的推薦方式是透過 :keyword:`async with` 陳述式: ::" -#: ../../library/asyncio-sync.rst:292 +#: ../../library/asyncio-sync.rst:298 msgid "" "sem = asyncio.Semaphore(10)\n" "\n" @@ -452,7 +462,7 @@ msgid "" " # work with shared resource" msgstr "" -#: ../../library/asyncio-sync.rst:300 +#: ../../library/asyncio-sync.rst:306 msgid "" "sem = asyncio.Semaphore(10)\n" "\n" @@ -464,11 +474,11 @@ msgid "" " sem.release()" msgstr "" -#: ../../library/asyncio-sync.rst:311 +#: ../../library/asyncio-sync.rst:317 msgid "Acquire a semaphore." msgstr "獲取一個旗號。" -#: ../../library/asyncio-sync.rst:313 +#: ../../library/asyncio-sync.rst:319 msgid "" "If the internal counter is greater than zero, decrement it by one and return " "``True`` immediately. If it is zero, wait until a :meth:`release` is called " @@ -477,11 +487,11 @@ msgstr "" "如果內部計數器大於零,將其減一並立刻回傳 ``True``。如果為零,則持續等待直到 :" "meth:`release` 被呼叫,並回傳 ``True``。" -#: ../../library/asyncio-sync.rst:319 +#: ../../library/asyncio-sync.rst:325 msgid "Returns ``True`` if semaphore can not be acquired immediately." msgstr "如果旗號無法立即被取得則回傳 ``True``。" -#: ../../library/asyncio-sync.rst:323 +#: ../../library/asyncio-sync.rst:329 msgid "" "Release a semaphore, incrementing the internal counter by one. Can wake up a " "task waiting to acquire the semaphore." @@ -489,7 +499,7 @@ msgstr "" "釋放一個旗號,並為其內部的計數器數值增加一。可以把一個正在等待獲取旗號的任務" "叫醒。" -#: ../../library/asyncio-sync.rst:326 +#: ../../library/asyncio-sync.rst:332 msgid "" "Unlike :class:`BoundedSemaphore`, :class:`Semaphore` allows making more " "``release()`` calls than ``acquire()`` calls." @@ -497,15 +507,15 @@ msgstr "" "和 :class:`BoundedSemaphore` 不同,:class:`Semaphore` 允許 ``release()`` 的呼" "叫次數多於 ``acquire()``。" -#: ../../library/asyncio-sync.rst:331 +#: ../../library/asyncio-sync.rst:337 msgid "BoundedSemaphore" msgstr "BoundedSemaphore" -#: ../../library/asyncio-sync.rst:335 +#: ../../library/asyncio-sync.rst:341 msgid "A bounded semaphore object. Not thread-safe." msgstr "一個有界的旗號物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:337 +#: ../../library/asyncio-sync.rst:343 msgid "" "Bounded Semaphore is a version of :class:`Semaphore` that raises a :exc:" "`ValueError` in :meth:`~Semaphore.release` if it increases the internal " @@ -515,15 +525,15 @@ msgstr "" "加至大於初始 *value* 值的話,:exc:`ValueError` 會在 :meth:`~Semaphore." "release` 時被引發。" -#: ../../library/asyncio-sync.rst:346 +#: ../../library/asyncio-sync.rst:352 msgid "Barrier" msgstr "Barrier" -#: ../../library/asyncio-sync.rst:350 +#: ../../library/asyncio-sync.rst:356 msgid "A barrier object. Not thread-safe." msgstr "一個屏障 (barrier) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:352 +#: ../../library/asyncio-sync.rst:358 msgid "" "A barrier is a simple synchronization primitive that allows to block until " "*parties* number of tasks are waiting on it. Tasks can wait on the :meth:" @@ -532,17 +542,17 @@ msgid "" "waiting tasks would unblock simultaneously." msgstr "" -#: ../../library/asyncio-sync.rst:358 +#: ../../library/asyncio-sync.rst:364 msgid "" ":keyword:`async with` can be used as an alternative to awaiting on :meth:" "`~Barrier.wait`." msgstr "" -#: ../../library/asyncio-sync.rst:361 +#: ../../library/asyncio-sync.rst:367 msgid "The barrier can be reused any number of times." msgstr "" -#: ../../library/asyncio-sync.rst:367 +#: ../../library/asyncio-sync.rst:373 msgid "" "async def example_barrier():\n" " # barrier with 3 parties\n" @@ -566,11 +576,11 @@ msgid "" "asyncio.run(example_barrier())" msgstr "" -#: ../../library/asyncio-sync.rst:388 +#: ../../library/asyncio-sync.rst:394 msgid "Result of this example is::" msgstr "" -#: ../../library/asyncio-sync.rst:390 +#: ../../library/asyncio-sync.rst:396 msgid "" "\n" "\n" @@ -582,27 +592,27 @@ msgstr "" "barrier passed\n" "" -#: ../../library/asyncio-sync.rst:399 +#: ../../library/asyncio-sync.rst:405 msgid "" "Pass the barrier. When all the tasks party to the barrier have called this " "function, they are all unblocked simultaneously." msgstr "" -#: ../../library/asyncio-sync.rst:402 +#: ../../library/asyncio-sync.rst:408 msgid "" "When a waiting or blocked task in the barrier is cancelled, this task exits " "the barrier which stays in the same state. If the state of the barrier is " "\"filling\", the number of waiting task decreases by 1." msgstr "" -#: ../../library/asyncio-sync.rst:407 +#: ../../library/asyncio-sync.rst:413 msgid "" "The return value is an integer in the range of 0 to ``parties-1``, different " "for each task. This can be used to select a task to do some special " "housekeeping, e.g.::" msgstr "" -#: ../../library/asyncio-sync.rst:411 +#: ../../library/asyncio-sync.rst:417 msgid "" "...\n" "async with barrier as position:\n" @@ -611,51 +621,51 @@ msgid "" " print('End of *draining phase*')" msgstr "" -#: ../../library/asyncio-sync.rst:417 +#: ../../library/asyncio-sync.rst:423 msgid "" "This method may raise a :class:`BrokenBarrierError` exception if the barrier " "is broken or reset while a task is waiting. It could raise a :exc:" "`CancelledError` if a task is cancelled." msgstr "" -#: ../../library/asyncio-sync.rst:423 +#: ../../library/asyncio-sync.rst:429 msgid "" "Return the barrier to the default, empty state. Any tasks waiting on it " "will receive the :class:`BrokenBarrierError` exception." msgstr "" -#: ../../library/asyncio-sync.rst:426 +#: ../../library/asyncio-sync.rst:432 msgid "" "If a barrier is broken it may be better to just leave it and create a new " "one." msgstr "" -#: ../../library/asyncio-sync.rst:430 +#: ../../library/asyncio-sync.rst:436 msgid "" "Put the barrier into a broken state. This causes any active or future calls " "to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use this for " "example if one of the tasks needs to abort, to avoid infinite waiting tasks." msgstr "" -#: ../../library/asyncio-sync.rst:437 +#: ../../library/asyncio-sync.rst:443 msgid "The number of tasks required to pass the barrier." msgstr "" -#: ../../library/asyncio-sync.rst:441 +#: ../../library/asyncio-sync.rst:447 msgid "The number of tasks currently waiting in the barrier while filling." msgstr "" -#: ../../library/asyncio-sync.rst:445 +#: ../../library/asyncio-sync.rst:451 msgid "A boolean that is ``True`` if the barrier is in the broken state." msgstr "" -#: ../../library/asyncio-sync.rst:450 +#: ../../library/asyncio-sync.rst:456 msgid "" "This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:" "`Barrier` object is reset or broken." msgstr "" -#: ../../library/asyncio-sync.rst:458 +#: ../../library/asyncio-sync.rst:464 msgid "" "Acquiring a lock using ``await lock`` or ``yield from lock`` and/or :keyword:" "`with` statement (``with await lock``, ``with (yield from lock)``) was " diff --git a/library/asyncio-task.po b/library/asyncio-task.po index d58e8d737e..6e293fd3d1 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -435,11 +435,11 @@ msgid "" " task.add_done_callback(background_tasks.discard)" msgstr "" -#: ../../library/asyncio-task.rst:287 ../../library/asyncio-task.rst:1075 +#: ../../library/asyncio-task.rst:287 ../../library/asyncio-task.rst:1141 msgid "Added the *name* parameter." msgstr "新增 *name* 參數。" -#: ../../library/asyncio-task.rst:290 ../../library/asyncio-task.rst:1082 +#: ../../library/asyncio-task.rst:290 ../../library/asyncio-task.rst:1148 msgid "Added the *context* parameter." msgstr "新增 *context* 參數。" @@ -493,17 +493,22 @@ msgstr "" #: ../../library/asyncio-task.rst:335 msgid "" "Create a task in this task group. The signature matches that of :func:" -"`asyncio.create_task`." +"`asyncio.create_task`. If the task group is inactive (e.g. not yet entered, " +"already finished, or in the process of shutting down), we will close the " +"given ``coro``." msgstr "" -#: ../../library/asyncio-task.rst:338 ../../library/asyncio-task.rst:472 -#: ../../library/asyncio-task.rst:645 ../../library/asyncio-task.rst:703 -#: ../../library/asyncio-task.rst:729 ../../library/asyncio-task.rst:769 -#: ../../library/asyncio-task.rst:868 +#: ../../library/asyncio-task.rst:343 +msgid "Close the given coroutine if the task group is not active." +msgstr "" + +#: ../../library/asyncio-task.rst:345 ../../library/asyncio-task.rst:503 +#: ../../library/asyncio-task.rst:676 ../../library/asyncio-task.rst:734 +#: ../../library/asyncio-task.rst:760 ../../library/asyncio-task.rst:800 msgid "Example::" msgstr "範例: ::" -#: ../../library/asyncio-task.rst:340 +#: ../../library/asyncio-task.rst:347 msgid "" "async def main():\n" " async with asyncio.TaskGroup() as tg:\n" @@ -513,7 +518,7 @@ msgid "" "result()}\")" msgstr "" -#: ../../library/asyncio-task.rst:346 +#: ../../library/asyncio-task.rst:353 msgid "" "The ``async with`` statement will wait for all tasks in the group to finish. " "While waiting, new tasks may still be added to the group (for example, by " @@ -522,7 +527,7 @@ msgid "" "block is exited, no new tasks may be added to the group." msgstr "" -#: ../../library/asyncio-task.rst:353 +#: ../../library/asyncio-task.rst:360 msgid "" "The first time any of the tasks belonging to the group fails with an " "exception other than :exc:`asyncio.CancelledError`, the remaining tasks in " @@ -534,7 +539,7 @@ msgid "" "bubble out of the containing ``async with`` statement." msgstr "" -#: ../../library/asyncio-task.rst:363 +#: ../../library/asyncio-task.rst:370 msgid "" "Once all tasks have finished, if any tasks have failed with an exception " "other than :exc:`asyncio.CancelledError`, those exceptions are combined in " @@ -542,7 +547,7 @@ msgid "" "their documentation) which is then raised." msgstr "" -#: ../../library/asyncio-task.rst:370 +#: ../../library/asyncio-task.rst:377 msgid "" "Two base exceptions are treated specially: If any task fails with :exc:" "`KeyboardInterrupt` or :exc:`SystemExit`, the task group still cancels the " @@ -551,7 +556,7 @@ msgid "" "`ExceptionGroup` or :exc:`BaseExceptionGroup`." msgstr "" -#: ../../library/asyncio-task.rst:376 +#: ../../library/asyncio-task.rst:383 msgid "" "If the body of the ``async with`` statement exits with an exception (so :" "meth:`~object.__aexit__` is called with an exception set), this is treated " @@ -563,38 +568,69 @@ msgid "" "`KeyboardInterrupt` and :exc:`SystemExit` as in the previous paragraph." msgstr "" -#: ../../library/asyncio-task.rst:390 +#: ../../library/asyncio-task.rst:395 +msgid "" +"Task groups are careful not to mix up the internal cancellation used to " +"\"wake up\" their :meth:`~object.__aexit__` with cancellation requests for " +"the task in which they are running made by other parties. In particular, " +"when one task group is syntactically nested in another, and both experience " +"an exception in one of their child tasks simultaneously, the inner task " +"group will process its exceptions, and then the outer task group will " +"receive another cancellation and process its own exceptions." +msgstr "" + +#: ../../library/asyncio-task.rst:403 +msgid "" +"In the case where a task group is cancelled externally and also must raise " +"an :exc:`ExceptionGroup`, it will call the parent task's :meth:`~asyncio." +"Task.cancel` method. This ensures that a :exc:`asyncio.CancelledError` will " +"be raised at the next :keyword:`await`, so the cancellation is not lost." +msgstr "" + +#: ../../library/asyncio-task.rst:409 +msgid "" +"Task groups preserve the cancellation count reported by :meth:`asyncio.Task." +"cancelling`." +msgstr "" + +#: ../../library/asyncio-task.rst:414 +msgid "" +"Improved handling of simultaneous internal and external cancellations and " +"correct preservation of cancellation counts." +msgstr "" + +#: ../../library/asyncio-task.rst:418 msgid "Sleeping" msgstr "" -#: ../../library/asyncio-task.rst:394 +#: ../../library/asyncio-task.rst:422 msgid "Block for *delay* seconds." msgstr "" -#: ../../library/asyncio-task.rst:396 +#: ../../library/asyncio-task.rst:424 msgid "" "If *result* is provided, it is returned to the caller when the coroutine " "completes." msgstr "" -#: ../../library/asyncio-task.rst:399 +#: ../../library/asyncio-task.rst:427 msgid "" "``sleep()`` always suspends the current task, allowing other tasks to run." msgstr "" -#: ../../library/asyncio-task.rst:402 +#: ../../library/asyncio-task.rst:430 msgid "" "Setting the delay to 0 provides an optimized path to allow other tasks to " "run. This can be used by long-running functions to avoid blocking the event " "loop for the full duration of the function call." msgstr "" -#: ../../library/asyncio-task.rst:408 +#: ../../library/asyncio-task.rst:436 msgid "" "Example of coroutine displaying the current date every second for 5 seconds::" msgstr "" -#: ../../library/asyncio-task.rst:411 +#: ../../library/asyncio-task.rst:439 msgid "" "import asyncio\n" "import datetime\n" @@ -624,36 +660,40 @@ msgstr "" "\n" "asyncio.run(display_date())" -#: ../../library/asyncio-task.rst:426 ../../library/asyncio-task.rst:521 -#: ../../library/asyncio-task.rst:620 ../../library/asyncio-task.rst:794 -#: ../../library/asyncio-task.rst:848 ../../library/asyncio-task.rst:874 +#: ../../library/asyncio-task.rst:454 ../../library/asyncio-task.rst:552 +#: ../../library/asyncio-task.rst:651 ../../library/asyncio-task.rst:825 +#: ../../library/asyncio-task.rst:879 ../../library/asyncio-task.rst:936 msgid "Removed the *loop* parameter." msgstr "移除 *loop* 參數。" -#: ../../library/asyncio-task.rst:431 +#: ../../library/asyncio-task.rst:457 +msgid "Raises :exc:`ValueError` if *delay* is :data:`~math.nan`." +msgstr "" + +#: ../../library/asyncio-task.rst:462 msgid "Running Tasks Concurrently" msgstr "" -#: ../../library/asyncio-task.rst:435 +#: ../../library/asyncio-task.rst:466 msgid "" "Run :ref:`awaitable objects ` in the *aws* sequence " "*concurrently*." msgstr "" -#: ../../library/asyncio-task.rst:438 +#: ../../library/asyncio-task.rst:469 msgid "" "If any awaitable in *aws* is a coroutine, it is automatically scheduled as a " "Task." msgstr "" -#: ../../library/asyncio-task.rst:441 +#: ../../library/asyncio-task.rst:472 msgid "" "If all awaitables are completed successfully, the result is an aggregate " "list of returned values. The order of result values corresponds to the " "order of awaitables in *aws*." msgstr "" -#: ../../library/asyncio-task.rst:445 +#: ../../library/asyncio-task.rst:476 msgid "" "If *return_exceptions* is ``False`` (default), the first raised exception is " "immediately propagated to the task that awaits on ``gather()``. Other " @@ -661,19 +701,19 @@ msgid "" "run." msgstr "" -#: ../../library/asyncio-task.rst:450 +#: ../../library/asyncio-task.rst:481 msgid "" "If *return_exceptions* is ``True``, exceptions are treated the same as " "successful results, and aggregated in the result list." msgstr "" -#: ../../library/asyncio-task.rst:453 +#: ../../library/asyncio-task.rst:484 msgid "" "If ``gather()`` is *cancelled*, all submitted awaitables (that have not " "completed yet) are also *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:456 +#: ../../library/asyncio-task.rst:487 msgid "" "If any Task or Future from the *aws* sequence is *cancelled*, it is treated " "as if it raised :exc:`CancelledError` -- the ``gather()`` call is **not** " @@ -681,7 +721,7 @@ msgid "" "submitted Task/Future to cause other Tasks/Futures to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:463 +#: ../../library/asyncio-task.rst:494 msgid "" "A new alternative to create and run tasks concurrently and wait for their " "completion is :class:`asyncio.TaskGroup`. *TaskGroup* provides stronger " @@ -691,7 +731,7 @@ msgid "" "tasks)." msgstr "" -#: ../../library/asyncio-task.rst:474 +#: ../../library/asyncio-task.rst:505 msgid "" "import asyncio\n" "\n" @@ -730,7 +770,7 @@ msgid "" "# [2, 6, 24]" msgstr "" -#: ../../library/asyncio-task.rst:510 +#: ../../library/asyncio-task.rst:541 msgid "" "If *return_exceptions* is false, cancelling gather() after it has been " "marked done won't cancel any submitted awaitables. For instance, gather can " @@ -739,28 +779,28 @@ msgid "" "the awaitables) from gather won't cancel any other awaitables." msgstr "" -#: ../../library/asyncio-task.rst:517 +#: ../../library/asyncio-task.rst:548 msgid "" "If the *gather* itself is cancelled, the cancellation is propagated " "regardless of *return_exceptions*." msgstr "" -#: ../../library/asyncio-task.rst:524 +#: ../../library/asyncio-task.rst:555 msgid "" "Deprecation warning is emitted if no positional arguments are provided or " "not all positional arguments are Future-like objects and there is no running " "event loop." msgstr "" -#: ../../library/asyncio-task.rst:533 +#: ../../library/asyncio-task.rst:564 msgid "Eager Task Factory" msgstr "" -#: ../../library/asyncio-task.rst:537 +#: ../../library/asyncio-task.rst:568 msgid "A task factory for eager task execution." msgstr "" -#: ../../library/asyncio-task.rst:539 +#: ../../library/asyncio-task.rst:570 msgid "" "When using this factory (via :meth:`loop.set_task_factory(asyncio." "eager_task_factory) `), coroutines begin execution " @@ -770,13 +810,13 @@ msgid "" "synchronously." msgstr "" -#: ../../library/asyncio-task.rst:545 +#: ../../library/asyncio-task.rst:576 msgid "" "A common example where this is beneficial is coroutines which employ caching " "or memoization to avoid actual I/O when possible." msgstr "" -#: ../../library/asyncio-task.rst:550 +#: ../../library/asyncio-task.rst:581 msgid "" "Immediate execution of the coroutine is a semantic change. If the coroutine " "returns or raises, the task is never scheduled to the event loop. If the " @@ -785,46 +825,46 @@ msgid "" "the application's task execution order is likely to change." msgstr "" -#: ../../library/asyncio-task.rst:561 +#: ../../library/asyncio-task.rst:592 msgid "" "Create an eager task factory, similar to :func:`eager_task_factory`, using " "the provided *custom_task_constructor* when creating a new task instead of " "the default :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:565 +#: ../../library/asyncio-task.rst:596 msgid "" "*custom_task_constructor* must be a *callable* with the signature matching " "the signature of :class:`Task.__init__ `. The callable must return a :" "class:`asyncio.Task`-compatible object." msgstr "" -#: ../../library/asyncio-task.rst:569 +#: ../../library/asyncio-task.rst:600 msgid "" "This function returns a *callable* intended to be used as a task factory of " "an event loop via :meth:`loop.set_task_factory(factory) `)." msgstr "" -#: ../../library/asyncio-task.rst:576 +#: ../../library/asyncio-task.rst:607 msgid "Shielding From Cancellation" msgstr "" -#: ../../library/asyncio-task.rst:580 +#: ../../library/asyncio-task.rst:611 msgid "" "Protect an :ref:`awaitable object ` from being :meth:" "`cancelled `." msgstr "" -#: ../../library/asyncio-task.rst:583 ../../library/asyncio-task.rst:749 +#: ../../library/asyncio-task.rst:614 ../../library/asyncio-task.rst:780 msgid "If *aw* is a coroutine it is automatically scheduled as a Task." msgstr "" -#: ../../library/asyncio-task.rst:585 +#: ../../library/asyncio-task.rst:616 msgid "The statement::" msgstr "" -#: ../../library/asyncio-task.rst:587 +#: ../../library/asyncio-task.rst:618 msgid "" "task = asyncio.create_task(something())\n" "res = await shield(task)" @@ -832,15 +872,15 @@ msgstr "" "task = asyncio.create_task(something())\n" "res = await shield(task)" -#: ../../library/asyncio-task.rst:590 +#: ../../library/asyncio-task.rst:621 msgid "is equivalent to::" msgstr "" -#: ../../library/asyncio-task.rst:592 +#: ../../library/asyncio-task.rst:623 msgid "res = await something()" msgstr "res = await something()" -#: ../../library/asyncio-task.rst:594 +#: ../../library/asyncio-task.rst:625 msgid "" "*except* that if the coroutine containing it is cancelled, the Task running " "in ``something()`` is not cancelled. From the point of view of " @@ -849,20 +889,20 @@ msgid "" "`CancelledError`." msgstr "" -#: ../../library/asyncio-task.rst:600 +#: ../../library/asyncio-task.rst:631 msgid "" "If ``something()`` is cancelled by other means (i.e. from within itself) " "that would also cancel ``shield()``." msgstr "" -#: ../../library/asyncio-task.rst:603 +#: ../../library/asyncio-task.rst:634 msgid "" "If it is desired to completely ignore cancellation (not recommended) the " "``shield()`` function should be combined with a try/except clause, as " "follows::" msgstr "" -#: ../../library/asyncio-task.rst:607 +#: ../../library/asyncio-task.rst:638 msgid "" "task = asyncio.create_task(something())\n" "try:\n" @@ -876,7 +916,7 @@ msgstr "" "except CancelledError:\n" " res = None" -#: ../../library/asyncio-task.rst:615 +#: ../../library/asyncio-task.rst:646 msgid "" "Save a reference to tasks passed to this function, to avoid a task " "disappearing mid-execution. The event loop only keeps weak references to " @@ -884,36 +924,36 @@ msgid "" "any time, even before it's done." msgstr "" -#: ../../library/asyncio-task.rst:623 +#: ../../library/asyncio-task.rst:654 msgid "" "Deprecation warning is emitted if *aw* is not Future-like object and there " "is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:629 +#: ../../library/asyncio-task.rst:660 msgid "Timeouts" msgstr "" -#: ../../library/asyncio-task.rst:633 +#: ../../library/asyncio-task.rst:664 msgid "" "Return an :ref:`asynchronous context manager ` that " "can be used to limit the amount of time spent waiting on something." msgstr "" -#: ../../library/asyncio-task.rst:637 +#: ../../library/asyncio-task.rst:668 msgid "" "*delay* can either be ``None``, or a float/int number of seconds to wait. If " "*delay* is ``None``, no time limit will be applied; this can be useful if " "the delay is unknown when the context manager is created." msgstr "" -#: ../../library/asyncio-task.rst:642 +#: ../../library/asyncio-task.rst:673 msgid "" "In either case, the context manager can be rescheduled after creation using :" "meth:`Timeout.reschedule`." msgstr "" -#: ../../library/asyncio-task.rst:647 +#: ../../library/asyncio-task.rst:678 msgid "" "async def main():\n" " async with asyncio.timeout(10):\n" @@ -923,7 +963,7 @@ msgstr "" " async with asyncio.timeout(10):\n" " await long_running_task()" -#: ../../library/asyncio-task.rst:651 +#: ../../library/asyncio-task.rst:682 msgid "" "If ``long_running_task`` takes more than 10 seconds to complete, the context " "manager will cancel the current task and handle the resulting :exc:`asyncio." @@ -931,18 +971,18 @@ msgid "" "can be caught and handled." msgstr "" -#: ../../library/asyncio-task.rst:658 +#: ../../library/asyncio-task.rst:689 msgid "" "The :func:`asyncio.timeout` context manager is what transforms the :exc:" "`asyncio.CancelledError` into a :exc:`TimeoutError`, which means the :exc:" "`TimeoutError` can only be caught *outside* of the context manager." msgstr "" -#: ../../library/asyncio-task.rst:663 +#: ../../library/asyncio-task.rst:694 msgid "Example of catching :exc:`TimeoutError`::" msgstr "" -#: ../../library/asyncio-task.rst:665 +#: ../../library/asyncio-task.rst:696 msgid "" "async def main():\n" " try:\n" @@ -954,48 +994,48 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -#: ../../library/asyncio-task.rst:674 +#: ../../library/asyncio-task.rst:705 msgid "" "The context manager produced by :func:`asyncio.timeout` can be rescheduled " "to a different deadline and inspected." msgstr "" -#: ../../library/asyncio-task.rst:679 +#: ../../library/asyncio-task.rst:710 msgid "" "An :ref:`asynchronous context manager ` for " "cancelling overdue coroutines." msgstr "" -#: ../../library/asyncio-task.rst:682 +#: ../../library/asyncio-task.rst:713 msgid "" "``when`` should be an absolute time at which the context should time out, as " "measured by the event loop's clock:" msgstr "" -#: ../../library/asyncio-task.rst:685 +#: ../../library/asyncio-task.rst:716 msgid "If ``when`` is ``None``, the timeout will never trigger." msgstr "" -#: ../../library/asyncio-task.rst:686 +#: ../../library/asyncio-task.rst:717 msgid "" "If ``when < loop.time()``, the timeout will trigger on the next iteration of " "the event loop." msgstr "" -#: ../../library/asyncio-task.rst:691 +#: ../../library/asyncio-task.rst:722 msgid "" "Return the current deadline, or ``None`` if the current deadline is not set." msgstr "" -#: ../../library/asyncio-task.rst:696 +#: ../../library/asyncio-task.rst:727 msgid "Reschedule the timeout." msgstr "" -#: ../../library/asyncio-task.rst:700 +#: ../../library/asyncio-task.rst:731 msgid "Return whether the context manager has exceeded its deadline (expired)." msgstr "" -#: ../../library/asyncio-task.rst:705 +#: ../../library/asyncio-task.rst:736 msgid "" "async def main():\n" " try:\n" @@ -1013,17 +1053,17 @@ msgid "" " print(\"Looks like we haven't finished on time.\")" msgstr "" -#: ../../library/asyncio-task.rst:720 +#: ../../library/asyncio-task.rst:751 msgid "Timeout context managers can be safely nested." msgstr "" -#: ../../library/asyncio-task.rst:726 +#: ../../library/asyncio-task.rst:757 msgid "" "Similar to :func:`asyncio.timeout`, except *when* is the absolute time to " "stop waiting, or ``None``." msgstr "" -#: ../../library/asyncio-task.rst:731 +#: ../../library/asyncio-task.rst:762 msgid "" "async def main():\n" " loop = get_running_loop()\n" @@ -1037,41 +1077,41 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -#: ../../library/asyncio-task.rst:746 +#: ../../library/asyncio-task.rst:777 msgid "" "Wait for the *aw* :ref:`awaitable ` to complete with a " "timeout." msgstr "" -#: ../../library/asyncio-task.rst:751 +#: ../../library/asyncio-task.rst:782 msgid "" "*timeout* can either be ``None`` or a float or int number of seconds to wait " "for. If *timeout* is ``None``, block until the future completes." msgstr "" -#: ../../library/asyncio-task.rst:755 +#: ../../library/asyncio-task.rst:786 msgid "" "If a timeout occurs, it cancels the task and raises :exc:`TimeoutError`." msgstr "" -#: ../../library/asyncio-task.rst:758 +#: ../../library/asyncio-task.rst:789 msgid "" "To avoid the task :meth:`cancellation `, wrap it in :func:" "`shield`." msgstr "" -#: ../../library/asyncio-task.rst:761 +#: ../../library/asyncio-task.rst:792 msgid "" "The function will wait until the future is actually cancelled, so the total " "wait time may exceed the *timeout*. If an exception happens during " "cancellation, it is propagated." msgstr "" -#: ../../library/asyncio-task.rst:765 +#: ../../library/asyncio-task.rst:796 msgid "If the wait is cancelled, the future *aw* is also cancelled." msgstr "" -#: ../../library/asyncio-task.rst:771 +#: ../../library/asyncio-task.rst:802 msgid "" "async def eternity():\n" " # Sleep for one hour\n" @@ -1092,137 +1132,186 @@ msgid "" "# timeout!" msgstr "" -#: ../../library/asyncio-task.rst:789 +#: ../../library/asyncio-task.rst:820 msgid "" "When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be " "cancelled. Previously, it raised :exc:`TimeoutError` immediately." msgstr "" -#: ../../library/asyncio-task.rst:797 +#: ../../library/asyncio-task.rst:828 msgid "Raises :exc:`TimeoutError` instead of :exc:`asyncio.TimeoutError`." msgstr "引發 :exc:`TimeoutError` 而不是 :exc:`asyncio.TimeoutError`。" -#: ../../library/asyncio-task.rst:802 +#: ../../library/asyncio-task.rst:833 msgid "Waiting Primitives" msgstr "" -#: ../../library/asyncio-task.rst:806 +#: ../../library/asyncio-task.rst:837 msgid "" "Run :class:`~asyncio.Future` and :class:`~asyncio.Task` instances in the " "*aws* iterable concurrently and block until the condition specified by " "*return_when*." msgstr "" -#: ../../library/asyncio-task.rst:810 +#: ../../library/asyncio-task.rst:841 msgid "The *aws* iterable must not be empty." msgstr "" -#: ../../library/asyncio-task.rst:812 +#: ../../library/asyncio-task.rst:843 msgid "Returns two sets of Tasks/Futures: ``(done, pending)``." msgstr "" -#: ../../library/asyncio-task.rst:814 +#: ../../library/asyncio-task.rst:845 msgid "Usage::" msgstr "用法: ::" -#: ../../library/asyncio-task.rst:816 +#: ../../library/asyncio-task.rst:847 msgid "done, pending = await asyncio.wait(aws)" msgstr "done, pending = await asyncio.wait(aws)" -#: ../../library/asyncio-task.rst:818 +#: ../../library/asyncio-task.rst:849 msgid "" "*timeout* (a float or int), if specified, can be used to control the maximum " "number of seconds to wait before returning." msgstr "" -#: ../../library/asyncio-task.rst:821 +#: ../../library/asyncio-task.rst:852 msgid "" "Note that this function does not raise :exc:`TimeoutError`. Futures or Tasks " "that aren't done when the timeout occurs are simply returned in the second " "set." msgstr "" -#: ../../library/asyncio-task.rst:825 +#: ../../library/asyncio-task.rst:856 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "" -#: ../../library/asyncio-task.rst:831 +#: ../../library/asyncio-task.rst:862 msgid "Constant" msgstr "常數" -#: ../../library/asyncio-task.rst:832 +#: ../../library/asyncio-task.rst:863 msgid "Description" msgstr "描述" -#: ../../library/asyncio-task.rst:835 +#: ../../library/asyncio-task.rst:866 msgid "The function will return when any future finishes or is cancelled." msgstr "" -#: ../../library/asyncio-task.rst:838 +#: ../../library/asyncio-task.rst:869 msgid "" "The function will return when any future finishes by raising an exception. " "If no future raises an exception then it is equivalent to :const:" "`ALL_COMPLETED`." msgstr "" -#: ../../library/asyncio-task.rst:843 +#: ../../library/asyncio-task.rst:874 msgid "The function will return when all futures finish or are cancelled." msgstr "" -#: ../../library/asyncio-task.rst:845 +#: ../../library/asyncio-task.rst:876 msgid "" "Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the futures " "when a timeout occurs." msgstr "" -#: ../../library/asyncio-task.rst:851 +#: ../../library/asyncio-task.rst:882 msgid "Passing coroutine objects to ``wait()`` directly is forbidden." msgstr "" -#: ../../library/asyncio-task.rst:854 ../../library/asyncio-task.rst:881 +#: ../../library/asyncio-task.rst:885 ../../library/asyncio-task.rst:943 msgid "Added support for generators yielding tasks." msgstr "" -#: ../../library/asyncio-task.rst:860 +#: ../../library/asyncio-task.rst:891 msgid "" "Run :ref:`awaitable objects ` in the *aws* iterable " -"concurrently. Return an iterator of coroutines. Each coroutine returned can " -"be awaited to get the earliest next result from the iterable of the " -"remaining awaitables." +"concurrently. The returned object can be iterated to obtain the results of " +"the awaitables as they finish." +msgstr "" + +#: ../../library/asyncio-task.rst:895 +msgid "" +"The object returned by ``as_completed()`` can be iterated as an :term:" +"`asynchronous iterator` or a plain :term:`iterator`. When asynchronous " +"iteration is used, the originally-supplied awaitables are yielded if they " +"are tasks or futures. This makes it easy to correlate previously-scheduled " +"tasks with their results. Example::" +msgstr "" + +#: ../../library/asyncio-task.rst:901 +msgid "" +"ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" +"ipv6_connect = create_task(open_connection(\"::1\", 80))\n" +"tasks = [ipv4_connect, ipv6_connect]\n" +"\n" +"async for earliest_connect in as_completed(tasks):\n" +" # earliest_connect is done. The result can be obtained by\n" +" # awaiting it or calling earliest_connect.result()\n" +" reader, writer = await earliest_connect\n" +"\n" +" if earliest_connect is ipv6_connect:\n" +" print(\"IPv6 connection established.\")\n" +" else:\n" +" print(\"IPv4 connection established.\")" msgstr "" -#: ../../library/asyncio-task.rst:865 +#: ../../library/asyncio-task.rst:915 msgid "" -"Raises :exc:`TimeoutError` if the timeout occurs before all Futures are done." +"During asynchronous iteration, implicitly-created tasks will be yielded for " +"supplied awaitables that aren't tasks or futures." msgstr "" -#: ../../library/asyncio-task.rst:870 +#: ../../library/asyncio-task.rst:918 msgid "" -"for coro in as_completed(aws):\n" -" earliest_result = await coro\n" -" # ..." +"When used as a plain iterator, each iteration yields a new coroutine that " +"returns the result or raises the exception of the next completed awaitable. " +"This pattern is compatible with Python versions older than 3.13::" msgstr "" -"for coro in as_completed(aws):\n" -" earliest_result = await coro\n" -" # ..." -#: ../../library/asyncio-task.rst:877 +#: ../../library/asyncio-task.rst:922 +msgid "" +"ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" +"ipv6_connect = create_task(open_connection(\"::1\", 80))\n" +"tasks = [ipv4_connect, ipv6_connect]\n" +"\n" +"for next_connect in as_completed(tasks):\n" +" # next_connect is not one of the original task objects. It must be\n" +" # awaited to obtain the result value or raise the exception of the\n" +" # awaitable that finishes next.\n" +" reader, writer = await next_connect" +msgstr "" + +#: ../../library/asyncio-task.rst:932 +msgid "" +"A :exc:`TimeoutError` is raised if the timeout occurs before all awaitables " +"are done. This is raised by the ``async for`` loop during asynchronous " +"iteration or by the coroutines yielded during plain iteration." +msgstr "" + +#: ../../library/asyncio-task.rst:939 msgid "" "Deprecation warning is emitted if not all awaitable objects in the *aws* " "iterable are Future-like objects and there is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:886 +#: ../../library/asyncio-task.rst:946 +msgid "" +"The result can now be used as either an :term:`asynchronous iterator` or as " +"a plain :term:`iterator` (previously it was only a plain iterator)." +msgstr "" + +#: ../../library/asyncio-task.rst:952 msgid "Running in Threads" msgstr "" -#: ../../library/asyncio-task.rst:890 +#: ../../library/asyncio-task.rst:956 msgid "Asynchronously run function *func* in a separate thread." msgstr "" -#: ../../library/asyncio-task.rst:892 +#: ../../library/asyncio-task.rst:958 msgid "" "Any \\*args and \\*\\*kwargs supplied for this function are directly passed " "to *func*. Also, the current :class:`contextvars.Context` is propagated, " @@ -1230,19 +1319,19 @@ msgid "" "separate thread." msgstr "" -#: ../../library/asyncio-task.rst:897 +#: ../../library/asyncio-task.rst:963 msgid "" "Return a coroutine that can be awaited to get the eventual result of *func*." msgstr "" -#: ../../library/asyncio-task.rst:899 +#: ../../library/asyncio-task.rst:965 msgid "" "This coroutine function is primarily intended to be used for executing IO-" "bound functions/methods that would otherwise block the event loop if they " "were run in the main thread. For example::" msgstr "" -#: ../../library/asyncio-task.rst:903 +#: ../../library/asyncio-task.rst:969 msgid "" "def blocking_io():\n" " print(f\"start blocking_io at {time.strftime('%X')}\")\n" @@ -1271,7 +1360,7 @@ msgid "" "# finished main at 19:50:54" msgstr "" -#: ../../library/asyncio-task.rst:929 +#: ../../library/asyncio-task.rst:995 msgid "" "Directly calling ``blocking_io()`` in any coroutine would block the event " "loop for its duration, resulting in an additional 1 second of run time. " @@ -1279,7 +1368,7 @@ msgid "" "thread without blocking the event loop." msgstr "" -#: ../../library/asyncio-task.rst:936 +#: ../../library/asyncio-task.rst:1002 msgid "" "Due to the :term:`GIL`, ``asyncio.to_thread()`` can typically only be used " "to make IO-bound functions non-blocking. However, for extension modules that " @@ -1287,27 +1376,27 @@ msgid "" "``asyncio.to_thread()`` can also be used for CPU-bound functions." msgstr "" -#: ../../library/asyncio-task.rst:945 +#: ../../library/asyncio-task.rst:1011 msgid "Scheduling From Other Threads" msgstr "" -#: ../../library/asyncio-task.rst:949 +#: ../../library/asyncio-task.rst:1015 msgid "Submit a coroutine to the given event loop. Thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:951 +#: ../../library/asyncio-task.rst:1017 msgid "" "Return a :class:`concurrent.futures.Future` to wait for the result from " "another OS thread." msgstr "" -#: ../../library/asyncio-task.rst:954 +#: ../../library/asyncio-task.rst:1020 msgid "" "This function is meant to be called from a different OS thread than the one " "where the event loop is running. Example::" msgstr "" -#: ../../library/asyncio-task.rst:957 +#: ../../library/asyncio-task.rst:1023 msgid "" "# Create a coroutine\n" "coro = asyncio.sleep(1, result=3)\n" @@ -1319,13 +1408,13 @@ msgid "" "assert future.result(timeout) == 3" msgstr "" -#: ../../library/asyncio-task.rst:966 +#: ../../library/asyncio-task.rst:1032 msgid "" "If an exception is raised in the coroutine, the returned Future will be " "notified. It can also be used to cancel the task in the event loop::" msgstr "" -#: ../../library/asyncio-task.rst:970 +#: ../../library/asyncio-task.rst:1036 msgid "" "try:\n" " result = future.result(timeout)\n" @@ -1338,59 +1427,59 @@ msgid "" " print(f'The coroutine returned: {result!r}')" msgstr "" -#: ../../library/asyncio-task.rst:980 +#: ../../library/asyncio-task.rst:1046 msgid "" "See the :ref:`concurrency and multithreading ` " "section of the documentation." msgstr "" -#: ../../library/asyncio-task.rst:983 +#: ../../library/asyncio-task.rst:1049 msgid "" "Unlike other asyncio functions this function requires the *loop* argument to " "be passed explicitly." msgstr "" -#: ../../library/asyncio-task.rst:990 +#: ../../library/asyncio-task.rst:1056 msgid "Introspection" msgstr "" -#: ../../library/asyncio-task.rst:995 +#: ../../library/asyncio-task.rst:1061 msgid "" "Return the currently running :class:`Task` instance, or ``None`` if no task " "is running." msgstr "" -#: ../../library/asyncio-task.rst:998 +#: ../../library/asyncio-task.rst:1064 msgid "" "If *loop* is ``None`` :func:`get_running_loop` is used to get the current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:1006 +#: ../../library/asyncio-task.rst:1072 msgid "Return a set of not yet finished :class:`Task` objects run by the loop." msgstr "" -#: ../../library/asyncio-task.rst:1009 +#: ../../library/asyncio-task.rst:1075 msgid "" "If *loop* is ``None``, :func:`get_running_loop` is used for getting current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:1017 +#: ../../library/asyncio-task.rst:1083 msgid "Return ``True`` if *obj* is a coroutine object." msgstr "" -#: ../../library/asyncio-task.rst:1023 +#: ../../library/asyncio-task.rst:1089 msgid "Task Object" msgstr "" -#: ../../library/asyncio-task.rst:1027 +#: ../../library/asyncio-task.rst:1093 msgid "" "A :class:`Future-like ` object that runs a Python :ref:`coroutine " "`. Not thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:1030 +#: ../../library/asyncio-task.rst:1096 msgid "" "Tasks are used to run coroutines in event loops. If a coroutine awaits on a " "Future, the Task suspends the execution of the coroutine and waits for the " @@ -1398,21 +1487,21 @@ msgid "" "wrapped coroutine resumes." msgstr "" -#: ../../library/asyncio-task.rst:1036 +#: ../../library/asyncio-task.rst:1102 msgid "" "Event loops use cooperative scheduling: an event loop runs one Task at a " "time. While a Task awaits for the completion of a Future, the event loop " "runs other Tasks, callbacks, or performs IO operations." msgstr "" -#: ../../library/asyncio-task.rst:1041 +#: ../../library/asyncio-task.rst:1107 msgid "" "Use the high-level :func:`asyncio.create_task` function to create Tasks, or " "the low-level :meth:`loop.create_task` or :func:`ensure_future` functions. " "Manual instantiation of Tasks is discouraged." msgstr "" -#: ../../library/asyncio-task.rst:1046 +#: ../../library/asyncio-task.rst:1112 msgid "" "To cancel a running Task use the :meth:`cancel` method. Calling it will " "cause the Task to throw a :exc:`CancelledError` exception into the wrapped " @@ -1420,20 +1509,20 @@ msgid "" "cancellation, the Future object will be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1051 +#: ../../library/asyncio-task.rst:1117 msgid "" ":meth:`cancelled` can be used to check if the Task was cancelled. The method " "returns ``True`` if the wrapped coroutine did not suppress the :exc:" "`CancelledError` exception and was actually cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1056 +#: ../../library/asyncio-task.rst:1122 msgid "" ":class:`asyncio.Task` inherits from :class:`Future` all of its APIs except :" "meth:`Future.set_result` and :meth:`Future.set_exception`." msgstr "" -#: ../../library/asyncio-task.rst:1060 +#: ../../library/asyncio-task.rst:1126 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *coro* to run in. If no *context* is " @@ -1441,7 +1530,7 @@ msgid "" "in the copied context." msgstr "" -#: ../../library/asyncio-task.rst:1065 +#: ../../library/asyncio-task.rst:1131 msgid "" "An optional keyword-only *eager_start* argument allows eagerly starting the " "execution of the :class:`asyncio.Task` at task creation time. If set to " @@ -1451,96 +1540,96 @@ msgid "" "eagerly and will skip scheduling to the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1072 +#: ../../library/asyncio-task.rst:1138 msgid "Added support for the :mod:`contextvars` module." msgstr "" -#: ../../library/asyncio-task.rst:1078 +#: ../../library/asyncio-task.rst:1144 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" -#: ../../library/asyncio-task.rst:1085 +#: ../../library/asyncio-task.rst:1151 msgid "Added the *eager_start* parameter." msgstr "新增 *eager_start* 參數。" -#: ../../library/asyncio-task.rst:1090 +#: ../../library/asyncio-task.rst:1156 msgid "Return ``True`` if the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:1092 +#: ../../library/asyncio-task.rst:1158 msgid "" "A Task is *done* when the wrapped coroutine either returned a value, raised " "an exception, or the Task was cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1097 +#: ../../library/asyncio-task.rst:1163 msgid "Return the result of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1099 +#: ../../library/asyncio-task.rst:1165 msgid "" "If the Task is *done*, the result of the wrapped coroutine is returned (or " "if the coroutine raised an exception, that exception is re-raised.)" msgstr "" -#: ../../library/asyncio-task.rst:1103 ../../library/asyncio-task.rst:1117 +#: ../../library/asyncio-task.rst:1169 ../../library/asyncio-task.rst:1183 msgid "" "If the Task has been *cancelled*, this method raises a :exc:`CancelledError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:1106 +#: ../../library/asyncio-task.rst:1172 msgid "" "If the Task's result isn't yet available, this method raises an :exc:" "`InvalidStateError` exception." msgstr "" -#: ../../library/asyncio-task.rst:1111 +#: ../../library/asyncio-task.rst:1177 msgid "Return the exception of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1113 +#: ../../library/asyncio-task.rst:1179 msgid "" "If the wrapped coroutine raised an exception that exception is returned. If " "the wrapped coroutine returned normally this method returns ``None``." msgstr "" -#: ../../library/asyncio-task.rst:1120 +#: ../../library/asyncio-task.rst:1186 msgid "" "If the Task isn't *done* yet, this method raises an :exc:`InvalidStateError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:1125 +#: ../../library/asyncio-task.rst:1191 msgid "Add a callback to be run when the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:1127 ../../library/asyncio-task.rst:1136 +#: ../../library/asyncio-task.rst:1193 ../../library/asyncio-task.rst:1202 msgid "This method should only be used in low-level callback-based code." msgstr "" -#: ../../library/asyncio-task.rst:1129 +#: ../../library/asyncio-task.rst:1195 msgid "" "See the documentation of :meth:`Future.add_done_callback` for more details." msgstr "" -#: ../../library/asyncio-task.rst:1134 +#: ../../library/asyncio-task.rst:1200 msgid "Remove *callback* from the callbacks list." msgstr "" -#: ../../library/asyncio-task.rst:1138 +#: ../../library/asyncio-task.rst:1204 msgid "" "See the documentation of :meth:`Future.remove_done_callback` for more " "details." msgstr "" -#: ../../library/asyncio-task.rst:1143 +#: ../../library/asyncio-task.rst:1209 msgid "Return the list of stack frames for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1145 +#: ../../library/asyncio-task.rst:1211 msgid "" "If the wrapped coroutine is not done, this returns the stack where it is " "suspended. If the coroutine has completed successfully or was cancelled, " @@ -1548,15 +1637,15 @@ msgid "" "this returns the list of traceback frames." msgstr "" -#: ../../library/asyncio-task.rst:1151 +#: ../../library/asyncio-task.rst:1217 msgid "The frames are always ordered from oldest to newest." msgstr "" -#: ../../library/asyncio-task.rst:1153 +#: ../../library/asyncio-task.rst:1219 msgid "Only one stack frame is returned for a suspended coroutine." msgstr "" -#: ../../library/asyncio-task.rst:1155 +#: ../../library/asyncio-task.rst:1221 msgid "" "The optional *limit* argument sets the maximum number of frames to return; " "by default all available frames are returned. The ordering of the returned " @@ -1565,81 +1654,81 @@ msgid "" "are returned. (This matches the behavior of the traceback module.)" msgstr "" -#: ../../library/asyncio-task.rst:1164 +#: ../../library/asyncio-task.rst:1230 msgid "Print the stack or traceback for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1166 +#: ../../library/asyncio-task.rst:1232 msgid "" "This produces output similar to that of the traceback module for the frames " "retrieved by :meth:`get_stack`." msgstr "" -#: ../../library/asyncio-task.rst:1169 +#: ../../library/asyncio-task.rst:1235 msgid "The *limit* argument is passed to :meth:`get_stack` directly." msgstr "" -#: ../../library/asyncio-task.rst:1171 +#: ../../library/asyncio-task.rst:1237 msgid "" "The *file* argument is an I/O stream to which the output is written; by " "default output is written to :data:`sys.stdout`." msgstr "" -#: ../../library/asyncio-task.rst:1176 +#: ../../library/asyncio-task.rst:1242 msgid "Return the coroutine object wrapped by the :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:1180 +#: ../../library/asyncio-task.rst:1246 msgid "" "This will return ``None`` for Tasks which have already completed eagerly. " "See the :ref:`Eager Task Factory `." msgstr "" -#: ../../library/asyncio-task.rst:1187 +#: ../../library/asyncio-task.rst:1253 msgid "Newly added eager task execution means result may be ``None``." msgstr "" -#: ../../library/asyncio-task.rst:1191 +#: ../../library/asyncio-task.rst:1257 msgid "" "Return the :class:`contextvars.Context` object associated with the task." msgstr "" -#: ../../library/asyncio-task.rst:1198 +#: ../../library/asyncio-task.rst:1264 msgid "Return the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1200 +#: ../../library/asyncio-task.rst:1266 msgid "" "If no name has been explicitly assigned to the Task, the default asyncio " "Task implementation generates a default name during instantiation." msgstr "" -#: ../../library/asyncio-task.rst:1208 +#: ../../library/asyncio-task.rst:1274 msgid "Set the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1210 +#: ../../library/asyncio-task.rst:1276 msgid "" "The *value* argument can be any object, which is then converted to a string." msgstr "" -#: ../../library/asyncio-task.rst:1213 +#: ../../library/asyncio-task.rst:1279 msgid "" "In the default Task implementation, the name will be visible in the :func:" "`repr` output of a task object." msgstr "" -#: ../../library/asyncio-task.rst:1220 +#: ../../library/asyncio-task.rst:1286 msgid "Request the Task to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1222 +#: ../../library/asyncio-task.rst:1288 msgid "" "This arranges for a :exc:`CancelledError` exception to be thrown into the " "wrapped coroutine on the next cycle of the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1225 +#: ../../library/asyncio-task.rst:1291 msgid "" "The coroutine then has a chance to clean up or even deny the request by " "suppressing the exception with a :keyword:`try` ... ... ``except " @@ -1651,21 +1740,21 @@ msgid "" "addition to catching the exception." msgstr "" -#: ../../library/asyncio-task.rst:1235 +#: ../../library/asyncio-task.rst:1301 msgid "Added the *msg* parameter." msgstr "新增 *msg* 參數。" -#: ../../library/asyncio-task.rst:1238 +#: ../../library/asyncio-task.rst:1304 msgid "The ``msg`` parameter is propagated from cancelled task to its awaiter." msgstr "" -#: ../../library/asyncio-task.rst:1243 +#: ../../library/asyncio-task.rst:1309 msgid "" "The following example illustrates how coroutines can intercept the " "cancellation request::" msgstr "" -#: ../../library/asyncio-task.rst:1246 +#: ../../library/asyncio-task.rst:1312 msgid "" "async def cancel_me():\n" " print('cancel_me(): before sleep')\n" @@ -1702,32 +1791,32 @@ msgid "" "# main(): cancel_me is cancelled now" msgstr "" -#: ../../library/asyncio-task.rst:1282 +#: ../../library/asyncio-task.rst:1348 msgid "Return ``True`` if the Task is *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:1284 +#: ../../library/asyncio-task.rst:1350 msgid "" "The Task is *cancelled* when the cancellation was requested with :meth:" "`cancel` and the wrapped coroutine propagated the :exc:`CancelledError` " "exception thrown into it." msgstr "" -#: ../../library/asyncio-task.rst:1290 +#: ../../library/asyncio-task.rst:1356 msgid "Decrement the count of cancellation requests to this Task." msgstr "" -#: ../../library/asyncio-task.rst:1292 +#: ../../library/asyncio-task.rst:1358 msgid "Returns the remaining number of cancellation requests." msgstr "" -#: ../../library/asyncio-task.rst:1294 +#: ../../library/asyncio-task.rst:1360 msgid "" "Note that once execution of a cancelled task completed, further calls to :" "meth:`uncancel` are ineffective." msgstr "" -#: ../../library/asyncio-task.rst:1299 +#: ../../library/asyncio-task.rst:1365 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. In particular, if a Task gets successfully uncancelled, this " @@ -1736,7 +1825,7 @@ msgid "" "respective structured block. For example::" msgstr "" -#: ../../library/asyncio-task.rst:1306 +#: ../../library/asyncio-task.rst:1372 msgid "" "async def make_request_with_timeout():\n" " try:\n" @@ -1750,7 +1839,7 @@ msgid "" " await unrelated_code()" msgstr "" -#: ../../library/asyncio-task.rst:1317 +#: ../../library/asyncio-task.rst:1383 msgid "" "While the block with ``make_request()`` and ``make_another_request()`` might " "get cancelled due to the timeout, ``unrelated_code()`` should continue " @@ -1759,20 +1848,33 @@ msgid "" "similar fashion." msgstr "" -#: ../../library/asyncio-task.rst:1323 +#: ../../library/asyncio-task.rst:1389 msgid "" "If end-user code is, for some reason, suppressing cancellation by catching :" "exc:`CancelledError`, it needs to call this method to remove the " "cancellation state." msgstr "" -#: ../../library/asyncio-task.rst:1329 +#: ../../library/asyncio-task.rst:1393 +msgid "" +"When this method decrements the cancellation count to zero, the method " +"checks if a previous :meth:`cancel` call had arranged for :exc:" +"`CancelledError` to be thrown into the task. If it hasn't been thrown yet, " +"that arrangement will be rescinded (by resetting the internal " +"``_must_cancel`` flag)." +msgstr "" + +#: ../../library/asyncio-task.rst:1399 +msgid "Changed to rescind pending cancellation requests upon reaching zero." +msgstr "" + +#: ../../library/asyncio-task.rst:1404 msgid "" "Return the number of pending cancellation requests to this Task, i.e., the " "number of calls to :meth:`cancel` less the number of :meth:`uncancel` calls." msgstr "" -#: ../../library/asyncio-task.rst:1333 +#: ../../library/asyncio-task.rst:1408 msgid "" "Note that if this number is greater than zero but the Task is still " "executing, :meth:`cancelled` will still return ``False``. This is because " @@ -1781,12 +1883,21 @@ msgid "" "to zero." msgstr "" -#: ../../library/asyncio-task.rst:1339 +#: ../../library/asyncio-task.rst:1414 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. See :meth:`uncancel` for more details." msgstr "" +#~ msgid "" +#~ "for coro in as_completed(aws):\n" +#~ " earliest_result = await coro\n" +#~ " # ..." +#~ msgstr "" +#~ "for coro in as_completed(aws):\n" +#~ " earliest_result = await coro\n" +#~ " # ..." + #~ msgid ":const:`FIRST_COMPLETED`" #~ msgstr ":const:`FIRST_COMPLETED`" diff --git a/library/asyncio.po b/library/asyncio.po index 83f26e4982..f6ca78be42 100644 --- a/library/asyncio.po +++ b/library/asyncio.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-11-23 12:40+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -21,15 +21,15 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Poedit 3.0\n" -#: ../../library/asyncio.rst:87 +#: ../../library/asyncio.rst:91 msgid "High-level APIs" msgstr "高階 API" -#: ../../library/asyncio.rst:99 +#: ../../library/asyncio.rst:103 msgid "Low-level APIs" msgstr "低階 API" -#: ../../library/asyncio.rst:110 +#: ../../library/asyncio.rst:114 msgid "Guides and Tutorials" msgstr "指南與教學" @@ -148,14 +148,15 @@ msgstr "" "based) 的函式庫與程式碼。" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +#, fuzzy +msgid ":ref:`Availability `: not WASI." msgstr ":ref:`適用 `:非 Emscripten、非 WASI。" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上不起作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" @@ -165,7 +166,10 @@ msgid "asyncio REPL" msgstr "" #: ../../library/asyncio.rst:65 -msgid "You can experiment with an ``asyncio`` concurrent context in the REPL:" +#, fuzzy +msgid "" +"You can experiment with an ``asyncio`` concurrent context in the :term:" +"`REPL`:" msgstr "你能在 REPL 中對一個 ``asyncio`` 的並行情境 (context) 進行實驗:" #: ../../library/asyncio.rst:67 @@ -198,10 +202,16 @@ msgstr "" msgid "(also 3.11.10, 3.10.15, 3.9.20, and 3.8.20) Emits audit events." msgstr "" -#: ../../library/asyncio.rst:86 +#: ../../library/asyncio.rst:82 +msgid "" +"Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also " +"executed. Emits audit events." +msgstr "" + +#: ../../library/asyncio.rst:90 msgid "Reference" msgstr "參閱" -#: ../../library/asyncio.rst:119 +#: ../../library/asyncio.rst:123 msgid "The source code for asyncio can be found in :source:`Lib/asyncio/`." msgstr "asyncio 的原始碼可以在 :source:`Lib/asyncio/` 中找到。" diff --git a/library/base64.po b/library/base64.po index 7c399a80fe..6a500d7382 100644 --- a/library/base64.po +++ b/library/base64.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-29 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -400,11 +400,31 @@ msgstr "" "解碼經過 base85 編碼的\\ :term:`類位元組物件 `\\ 或 ASCII " "字串 *b*,並回傳解碼後的 :class:`bytes`。必要時會隱式移除填充。" -#: ../../library/base64.rst:247 +#: ../../library/base64.rst:249 +#, fuzzy +msgid "" +"Encode the :term:`bytes-like object` *s* using Z85 (as used in ZeroMQ) and " +"return the encoded :class:`bytes`. See `Z85 specification `_ for more information." +msgstr "" +"使用 Base85(例如,git 風格的二進位差異 (binary diff))對\\ :term:`類位元組物" +"件 ` *b* 進行編碼,並回傳編碼後的 :class:`bytes`。" + +#: ../../library/base64.rst:258 +#, fuzzy +msgid "" +"Decode the Z85-encoded :term:`bytes-like object` or ASCII string *s* and " +"return the decoded :class:`bytes`. See `Z85 specification `_ for more information." +msgstr "" +"解碼經過 base85 編碼的\\ :term:`類位元組物件 `\\ 或 ASCII " +"字串 *b*,並回傳解碼後的 :class:`bytes`。必要時會隱式移除填充。" + +#: ../../library/base64.rst:265 msgid "The legacy interface:" msgstr "舊版介面:" -#: ../../library/base64.rst:251 +#: ../../library/base64.rst:269 msgid "" "Decode the contents of the binary *input* file and write the resulting " "binary data to the *output* file. *input* and *output* must be :term:`file " @@ -415,7 +435,7 @@ msgstr "" "*input* 和 *output* 必須是\\ :term:`檔案物件 `。*input* 將被讀" "取,直到 ``input.readline()`` 回傳一個空的 bytes 物件為止。" -#: ../../library/base64.rst:259 +#: ../../library/base64.rst:277 msgid "" "Decode the :term:`bytes-like object` *s*, which must contain one or more " "lines of base64 encoded data, and return the decoded :class:`bytes`." @@ -423,7 +443,7 @@ msgstr "" "解碼必須包含一行或多行的 base64 編碼資料\\ :term:`類位元組物件 ` *s*,並回傳解碼後的 :class:`bytes`。" -#: ../../library/base64.rst:267 +#: ../../library/base64.rst:285 msgid "" "Encode the contents of the binary *input* file and write the resulting " "base64 encoded data to the *output* file. *input* and *output* must be :term:" @@ -438,7 +458,7 @@ msgstr "" "出的每 76 個位元組之後插入一個換行字元 (``b'\\n'``),並確保輸出始終以換行字元" "結尾,符合 :rfc:`2045` (MIME) 的規定。" -#: ../../library/base64.rst:277 +#: ../../library/base64.rst:295 msgid "" "Encode the :term:`bytes-like object` *s*, which can contain arbitrary binary " "data, and return :class:`bytes` containing the base64-encoded data, with " @@ -449,15 +469,15 @@ msgstr "" "碼,並回傳包含 base64 編碼資料 :class:`bytes`,在每 76 個輸出位元組後插入換行" "字元 (``b'\\n'``) ,並確保有尾隨換行字元,符合 :rfc:`2045` (MIME) 的規定。" -#: ../../library/base64.rst:285 +#: ../../library/base64.rst:303 msgid "An example usage of the module:" msgstr "模組的一個範例用法:" -#: ../../library/base64.rst:298 +#: ../../library/base64.rst:316 msgid "Security Considerations" msgstr "安全性注意事項" -#: ../../library/base64.rst:300 +#: ../../library/base64.rst:318 msgid "" "A new security considerations section was added to :rfc:`4648` (section 12); " "it's recommended to review the security section for any code deployed to " @@ -466,18 +486,18 @@ msgstr "" ":rfc:`4648`\\ (第 12 節)中添加了一個新的安全性考量部分;建議對部署到正式環" "境的任何程式碼進行安全性部分的審查。" -#: ../../library/base64.rst:305 +#: ../../library/base64.rst:323 msgid "Module :mod:`binascii`" msgstr ":mod:`binascii` 模組" -#: ../../library/base64.rst:306 +#: ../../library/base64.rst:324 msgid "" "Support module containing ASCII-to-binary and binary-to-ASCII conversions." msgstr "" "支援模組中包含 ASCII 到二進位 (ASCII-to-binary) 和二進位到 ASCII (binary-to-" "ASCII) 的轉換功能。" -#: ../../library/base64.rst:308 +#: ../../library/base64.rst:326 msgid "" ":rfc:`1521` - MIME (Multipurpose Internet Mail Extensions) Part One: " "Mechanisms for Specifying and Describing the Format of Internet Message " @@ -486,7 +506,7 @@ msgstr "" ":rfc:`1521` - MIME(多用途網際網路郵件擴展)第一部分:指定和描述網際網路主體" "格式的機制。" -#: ../../library/base64.rst:309 +#: ../../library/base64.rst:327 msgid "" "Section 5.2, \"Base64 Content-Transfer-Encoding,\" provides the definition " "of the base64 encoding." diff --git a/library/bdb.po b/library/bdb.po index 65abd710d1..5f1e59843e 100644 --- a/library/bdb.po +++ b/library/bdb.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -415,57 +415,63 @@ msgid "" "from caller's frame." msgstr "" -#: ../../library/bdb.rst:294 +#: ../../library/bdb.rst:292 +msgid "" +":func:`set_trace` will enter the debugger immediately, rather than on the " +"next line of code to be executed." +msgstr "" + +#: ../../library/bdb.rst:298 msgid "" "Stop only at breakpoints or when finished. If there are no breakpoints, set " "the system trace function to ``None``." msgstr "" -#: ../../library/bdb.rst:301 +#: ../../library/bdb.rst:305 msgid "" "Set the :attr:`!quitting` attribute to ``True``. This raises :exc:`BdbQuit` " "in the next call to one of the :meth:`!dispatch_\\*` methods." msgstr "" -#: ../../library/bdb.rst:305 +#: ../../library/bdb.rst:309 msgid "" "Derived classes and clients can call the following methods to manipulate " "breakpoints. These methods return a string containing an error message if " "something went wrong, or ``None`` if all is well." msgstr "" -#: ../../library/bdb.rst:311 +#: ../../library/bdb.rst:315 msgid "" "Set a new breakpoint. If the *lineno* line doesn't exist for the *filename* " "passed as argument, return an error message. The *filename* should be in " "canonical form, as described in the :meth:`canonic` method." msgstr "" -#: ../../library/bdb.rst:317 +#: ../../library/bdb.rst:321 msgid "" "Delete the breakpoints in *filename* and *lineno*. If none were set, return " "an error message." msgstr "" -#: ../../library/bdb.rst:322 +#: ../../library/bdb.rst:326 msgid "" "Delete the breakpoint which has the index *arg* in the :attr:`Breakpoint." "bpbynumber`. If *arg* is not numeric or out of range, return an error " "message." msgstr "" -#: ../../library/bdb.rst:328 +#: ../../library/bdb.rst:332 msgid "" "Delete all breakpoints in *filename*. If none were set, return an error " "message." msgstr "" -#: ../../library/bdb.rst:333 +#: ../../library/bdb.rst:337 msgid "" "Delete all existing breakpoints. If none were set, return an error message." msgstr "" -#: ../../library/bdb.rst:338 +#: ../../library/bdb.rst:342 msgid "" "Return a breakpoint specified by the given number. If *arg* is a string, it " "will be converted to a number. If *arg* is a non-numeric string, if the " @@ -473,103 +479,103 @@ msgid "" "raised." msgstr "" -#: ../../library/bdb.rst:347 +#: ../../library/bdb.rst:351 msgid "Return ``True`` if there is a breakpoint for *lineno* in *filename*." msgstr "" -#: ../../library/bdb.rst:351 +#: ../../library/bdb.rst:355 msgid "" "Return all breakpoints for *lineno* in *filename*, or an empty list if none " "are set." msgstr "" -#: ../../library/bdb.rst:356 +#: ../../library/bdb.rst:360 msgid "Return all breakpoints in *filename*, or an empty list if none are set." msgstr "" -#: ../../library/bdb.rst:360 +#: ../../library/bdb.rst:364 msgid "Return all breakpoints that are set." msgstr "" -#: ../../library/bdb.rst:363 +#: ../../library/bdb.rst:367 msgid "" "Derived classes and clients can call the following methods to get a data " "structure representing a stack trace." msgstr "" -#: ../../library/bdb.rst:368 +#: ../../library/bdb.rst:372 msgid "Return a list of (frame, lineno) tuples in a stack trace, and a size." msgstr "" -#: ../../library/bdb.rst:370 +#: ../../library/bdb.rst:374 msgid "" "The most recently called frame is last in the list. The size is the number " "of frames below the frame where the debugger was invoked." msgstr "" -#: ../../library/bdb.rst:375 +#: ../../library/bdb.rst:379 msgid "" "Return a string with information about a stack entry, which is a ``(frame, " "lineno)`` tuple. The return string contains:" msgstr "" -#: ../../library/bdb.rst:378 +#: ../../library/bdb.rst:382 msgid "The canonical filename which contains the frame." msgstr "" -#: ../../library/bdb.rst:379 +#: ../../library/bdb.rst:383 msgid "The function name or ``\"\"``." msgstr "函式名稱或 ``\"\"``。" -#: ../../library/bdb.rst:380 +#: ../../library/bdb.rst:384 msgid "The input arguments." msgstr "輸入引數。" -#: ../../library/bdb.rst:381 +#: ../../library/bdb.rst:385 msgid "The return value." msgstr "回傳值。" -#: ../../library/bdb.rst:382 +#: ../../library/bdb.rst:386 msgid "The line of code (if it exists)." msgstr "" -#: ../../library/bdb.rst:385 +#: ../../library/bdb.rst:389 msgid "" "The following two methods can be called by clients to use a debugger to " "debug a :term:`statement`, given as a string." msgstr "" -#: ../../library/bdb.rst:390 +#: ../../library/bdb.rst:394 msgid "" "Debug a statement executed via the :func:`exec` function. *globals* " "defaults to :attr:`!__main__.__dict__`, *locals* defaults to *globals*." msgstr "" -#: ../../library/bdb.rst:395 +#: ../../library/bdb.rst:399 msgid "" "Debug an expression executed via the :func:`eval` function. *globals* and " "*locals* have the same meaning as in :meth:`run`." msgstr "" -#: ../../library/bdb.rst:400 +#: ../../library/bdb.rst:404 msgid "For backwards compatibility. Calls the :meth:`run` method." msgstr "" -#: ../../library/bdb.rst:404 +#: ../../library/bdb.rst:408 msgid "Debug a single function call, and return its result." msgstr "" -#: ../../library/bdb.rst:407 +#: ../../library/bdb.rst:411 msgid "Finally, the module defines the following functions:" msgstr "" -#: ../../library/bdb.rst:411 +#: ../../library/bdb.rst:415 msgid "" "Return ``True`` if we should break here, depending on the way the :class:" "`Breakpoint` *b* was set." msgstr "" -#: ../../library/bdb.rst:414 +#: ../../library/bdb.rst:418 msgid "" "If it was set via line number, it checks if :attr:`b.line ` is the same as the one in *frame*. If the breakpoint was set via :" @@ -578,13 +584,13 @@ msgid "" "line." msgstr "" -#: ../../library/bdb.rst:423 +#: ../../library/bdb.rst:427 msgid "" "Return ``(active breakpoint, delete temporary flag)`` or ``(None, None)`` as " "the breakpoint to act upon." msgstr "" -#: ../../library/bdb.rst:426 +#: ../../library/bdb.rst:430 msgid "" "The *active breakpoint* is the first entry in :attr:`bplist ` for the (:attr:`file `, :attr:`line ` count is ignored)." msgstr "" -#: ../../library/bdb.rst:437 +#: ../../library/bdb.rst:441 msgid "If no such entry exists, then ``(None, None)`` is returned." msgstr "" -#: ../../library/bdb.rst:442 +#: ../../library/bdb.rst:446 msgid "Start debugging with a :class:`Bdb` instance from caller's frame." msgstr "" -#: ../../library/bdb.rst:299 +#: ../../library/bdb.rst:303 msgid "quitting (bdb.Bdb attribute)" msgstr "" diff --git a/library/binascii.po b/library/binascii.po index ac5a3facbf..2aa9b51367 100644 --- a/library/binascii.po +++ b/library/binascii.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,17 +22,16 @@ msgstr "" msgid ":mod:`!binascii` --- Convert between binary and ASCII" msgstr ":mod:`!binascii` --- 在二進位制和 ASCII 之間轉換" -#: ../../library/binascii.rst:14 +#: ../../library/binascii.rst:13 msgid "" "The :mod:`binascii` module contains a number of methods to convert between " "binary and various ASCII-encoded binary representations. Normally, you will " -"not use these functions directly but use wrapper modules like :mod:`uu` or :" -"mod:`base64` instead. The :mod:`binascii` module contains low-level " -"functions written in C for greater speed that are used by the higher-level " -"modules." +"not use these functions directly but use wrapper modules like :mod:`base64` " +"instead. The :mod:`binascii` module contains low-level functions written in " +"C for greater speed that are used by the higher-level modules." msgstr "" -#: ../../library/binascii.rst:23 +#: ../../library/binascii.rst:22 msgid "" "``a2b_*`` functions accept Unicode strings containing only ASCII characters. " "Other functions only accept :term:`bytes-like objects ` " @@ -40,22 +39,22 @@ msgid "" "the buffer protocol)." msgstr "" -#: ../../library/binascii.rst:28 +#: ../../library/binascii.rst:27 msgid "ASCII-only unicode strings are now accepted by the ``a2b_*`` functions." msgstr "" -#: ../../library/binascii.rst:32 +#: ../../library/binascii.rst:31 msgid "The :mod:`binascii` module defines the following functions:" msgstr "" -#: ../../library/binascii.rst:37 +#: ../../library/binascii.rst:36 msgid "" "Convert a single line of uuencoded data back to binary and return the binary " "data. Lines normally contain 45 (binary) bytes, except for the last line. " "Line data may be followed by whitespace." msgstr "" -#: ../../library/binascii.rst:44 +#: ../../library/binascii.rst:43 msgid "" "Convert binary data to a line of ASCII characters, the return value is the " "converted line, including a newline char. The length of *data* should be at " @@ -63,67 +62,67 @@ msgid "" "spaces." msgstr "" -#: ../../library/binascii.rst:48 +#: ../../library/binascii.rst:47 msgid "Added the *backtick* parameter." msgstr "新增 *backtick* 參數。" -#: ../../library/binascii.rst:54 +#: ../../library/binascii.rst:53 msgid "" "Convert a block of base64 data back to binary and return the binary data. " "More than one line may be passed at a time." msgstr "" -#: ../../library/binascii.rst:57 +#: ../../library/binascii.rst:56 msgid "" "If *strict_mode* is true, only valid base64 data will be converted. Invalid " "base64 data will raise :exc:`binascii.Error`." msgstr "" -#: ../../library/binascii.rst:60 +#: ../../library/binascii.rst:59 msgid "Valid base64:" msgstr "" -#: ../../library/binascii.rst:62 +#: ../../library/binascii.rst:61 msgid "Conforms to :rfc:`3548`." msgstr "" -#: ../../library/binascii.rst:63 +#: ../../library/binascii.rst:62 msgid "Contains only characters from the base64 alphabet." msgstr "" -#: ../../library/binascii.rst:64 +#: ../../library/binascii.rst:63 msgid "" "Contains no excess data after padding (including excess padding, newlines, " "etc.)." msgstr "" -#: ../../library/binascii.rst:65 +#: ../../library/binascii.rst:64 msgid "Does not start with a padding." msgstr "" -#: ../../library/binascii.rst:67 +#: ../../library/binascii.rst:66 msgid "Added the *strict_mode* parameter." msgstr "新增 *strict_mode* 參數。" -#: ../../library/binascii.rst:73 +#: ../../library/binascii.rst:72 msgid "" "Convert binary data to a line of ASCII characters in base64 coding. The " "return value is the converted line, including a newline char if *newline* is " "true. The output of this function conforms to :rfc:`3548`." msgstr "" -#: ../../library/binascii.rst:77 +#: ../../library/binascii.rst:76 msgid "Added the *newline* parameter." msgstr "新增 *newline* 參數。" -#: ../../library/binascii.rst:83 +#: ../../library/binascii.rst:82 msgid "" "Convert a block of quoted-printable data back to binary and return the " "binary data. More than one line may be passed at a time. If the optional " "argument *header* is present and true, underscores will be decoded as spaces." msgstr "" -#: ../../library/binascii.rst:90 +#: ../../library/binascii.rst:89 msgid "" "Convert binary data to a line(s) of ASCII characters in quoted-printable " "encoding. The return value is the converted line(s). If the optional " @@ -136,7 +135,7 @@ msgid "" "might corrupt the binary data stream." msgstr "" -#: ../../library/binascii.rst:103 +#: ../../library/binascii.rst:102 msgid "" "Compute a 16-bit CRC value of *data*, starting with *value* as the initial " "CRC, and return the result. This uses the CRC-CCITT polynomial *x*:sup:`16` " @@ -144,7 +143,7 @@ msgid "" "used in the binhex4 format." msgstr "" -#: ../../library/binascii.rst:111 +#: ../../library/binascii.rst:110 msgid "" "Compute CRC-32, the unsigned 32-bit checksum of *data*, starting with an " "initial CRC of *value*. The default initial CRC is zero. The algorithm is " @@ -153,7 +152,7 @@ msgid "" "algorithm. Use as follows::" msgstr "" -#: ../../library/binascii.rst:117 +#: ../../library/binascii.rst:116 msgid "" "print(binascii.crc32(b\"hello world\"))\n" "# Or, in two pieces:\n" @@ -162,24 +161,24 @@ msgid "" "print('crc32 = {:#010x}'.format(crc))" msgstr "" -#: ../../library/binascii.rst:123 +#: ../../library/binascii.rst:122 msgid "The result is always unsigned." msgstr "" -#: ../../library/binascii.rst:129 +#: ../../library/binascii.rst:128 msgid "" "Return the hexadecimal representation of the binary *data*. Every byte of " "*data* is converted into the corresponding 2-digit hex representation. The " "returned bytes object is therefore twice as long as the length of *data*." msgstr "" -#: ../../library/binascii.rst:133 +#: ../../library/binascii.rst:132 msgid "" "Similar functionality (but returning a text string) is also conveniently " "accessible using the :meth:`bytes.hex` method." msgstr "" -#: ../../library/binascii.rst:136 +#: ../../library/binascii.rst:135 msgid "" "If *sep* is specified, it must be a single character str or bytes object. It " "will be inserted in the output after every *bytes_per_sep* input bytes. " @@ -187,11 +186,11 @@ msgid "" "if you wish to count from the left, supply a negative *bytes_per_sep* value." msgstr "" -#: ../../library/binascii.rst:151 +#: ../../library/binascii.rst:150 msgid "The *sep* and *bytes_per_sep* parameters were added." msgstr "新增 *sep* 與 *bytes_per_sep* 參數。" -#: ../../library/binascii.rst:157 +#: ../../library/binascii.rst:156 msgid "" "Return the binary data represented by the hexadecimal string *hexstr*. This " "function is the inverse of :func:`b2a_hex`. *hexstr* must contain an even " @@ -199,45 +198,37 @@ msgid "" "an :exc:`Error` exception is raised." msgstr "" -#: ../../library/binascii.rst:162 +#: ../../library/binascii.rst:161 msgid "" "Similar functionality (accepting only text string arguments, but more " "liberal towards whitespace) is also accessible using the :meth:`bytes." "fromhex` class method." msgstr "" -#: ../../library/binascii.rst:168 +#: ../../library/binascii.rst:167 msgid "Exception raised on errors. These are usually programming errors." msgstr "" -#: ../../library/binascii.rst:173 +#: ../../library/binascii.rst:172 msgid "" "Exception raised on incomplete data. These are usually not programming " "errors, but may be handled by reading a little more data and trying again." msgstr "" -#: ../../library/binascii.rst:179 +#: ../../library/binascii.rst:178 msgid "Module :mod:`base64`" msgstr ":mod:`base64` 模組" -#: ../../library/binascii.rst:180 +#: ../../library/binascii.rst:179 msgid "" "Support for RFC compliant base64-style encoding in base 16, 32, 64, and 85." msgstr "" -#: ../../library/binascii.rst:183 -msgid "Module :mod:`uu`" -msgstr ":mod:`uu` 模組" - -#: ../../library/binascii.rst:184 -msgid "Support for UU encoding used on Unix." -msgstr "" - -#: ../../library/binascii.rst:186 +#: ../../library/binascii.rst:182 msgid "Module :mod:`quopri`" msgstr ":mod:`quopri` 模組" -#: ../../library/binascii.rst:187 +#: ../../library/binascii.rst:183 msgid "Support for quoted-printable encoding used in MIME email messages." msgstr "" @@ -245,10 +236,12 @@ msgstr "" msgid "module" msgstr "module(模組)" -#: ../../library/binascii.rst:8 -msgid "uu" -msgstr "uu" - #: ../../library/binascii.rst:8 msgid "base64" msgstr "base64" + +#~ msgid "Module :mod:`uu`" +#~ msgstr ":mod:`uu` 模組" + +#~ msgid "uu" +#~ msgstr "uu" diff --git a/library/bz2.po b/library/bz2.po index 9f4e9f5ee2..9424d42055 100644 --- a/library/bz2.po +++ b/library/bz2.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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,11 +99,11 @@ msgid "" "handling behavior, and line ending(s)." msgstr "" -#: ../../library/bz2.rst:59 ../../library/bz2.rst:162 +#: ../../library/bz2.rst:59 ../../library/bz2.rst:175 msgid "The ``'x'`` (exclusive creation) mode was added." msgstr "" -#: ../../library/bz2.rst:62 ../../library/bz2.rst:169 +#: ../../library/bz2.rst:62 ../../library/bz2.rst:182 msgid "Accepts a :term:`path-like object`." msgstr "" @@ -153,7 +153,7 @@ msgid "" msgstr "" #: ../../library/bz2.rst:94 -msgid ":class:`BZ2File` also provides the following methods:" +msgid ":class:`BZ2File` also provides the following methods and attributes:" msgstr "" #: ../../library/bz2.rst:98 @@ -206,93 +206,103 @@ msgstr "" msgid "Returns the number of bytes read (0 for EOF)." msgstr "" -#: ../../library/bz2.rst:152 +#: ../../library/bz2.rst:153 +msgid "``'rb'`` for reading and ``'wb'`` for writing." +msgstr "" + +#: ../../library/bz2.rst:159 +msgid "" +"The bzip2 file name. Equivalent to the :attr:`~io.FileIO.name` attribute of " +"the underlying :term:`file object`." +msgstr "" + +#: ../../library/bz2.rst:165 msgid "Support for the :keyword:`with` statement was added." msgstr "" -#: ../../library/bz2.rst:155 +#: ../../library/bz2.rst:168 msgid "" "Support was added for *filename* being a :term:`file object` instead of an " "actual filename." msgstr "" -#: ../../library/bz2.rst:159 +#: ../../library/bz2.rst:172 msgid "" "The ``'a'`` (append) mode was added, along with support for reading multi-" "stream files." msgstr "" -#: ../../library/bz2.rst:165 +#: ../../library/bz2.rst:178 msgid "" "The :meth:`~io.BufferedIOBase.read` method now accepts an argument of " "``None``." msgstr "" -#: ../../library/bz2.rst:172 +#: ../../library/bz2.rst:185 msgid "" "The *buffering* parameter has been removed. It was ignored and deprecated " "since Python 3.0. Pass an open file object to control how the file is opened." msgstr "" -#: ../../library/bz2.rst:177 +#: ../../library/bz2.rst:190 msgid "The *compresslevel* parameter became keyword-only." msgstr "" -#: ../../library/bz2.rst:179 +#: ../../library/bz2.rst:192 msgid "" "This class is thread unsafe in the face of multiple simultaneous readers or " "writers, just like its equivalent classes in :mod:`gzip` and :mod:`lzma` " "have always been." msgstr "" -#: ../../library/bz2.rst:186 +#: ../../library/bz2.rst:199 msgid "Incremental (de)compression" msgstr "" -#: ../../library/bz2.rst:190 +#: ../../library/bz2.rst:203 msgid "" "Create a new compressor object. This object may be used to compress data " "incrementally. For one-shot compression, use the :func:`compress` function " "instead." msgstr "" -#: ../../library/bz2.rst:194 ../../library/bz2.rst:282 +#: ../../library/bz2.rst:207 ../../library/bz2.rst:295 msgid "" "*compresslevel*, if given, must be an integer between ``1`` and ``9``. The " "default is ``9``." msgstr "" -#: ../../library/bz2.rst:199 +#: ../../library/bz2.rst:212 msgid "" "Provide data to the compressor object. Returns a chunk of compressed data if " "possible, or an empty byte string otherwise." msgstr "" -#: ../../library/bz2.rst:202 +#: ../../library/bz2.rst:215 msgid "" "When you have finished providing data to the compressor, call the :meth:" "`flush` method to finish the compression process." msgstr "" -#: ../../library/bz2.rst:208 +#: ../../library/bz2.rst:221 msgid "" "Finish the compression process. Returns the compressed data left in internal " "buffers." msgstr "" -#: ../../library/bz2.rst:211 +#: ../../library/bz2.rst:224 msgid "" "The compressor object may not be used after this method has been called." msgstr "" -#: ../../library/bz2.rst:216 +#: ../../library/bz2.rst:229 msgid "" "Create a new decompressor object. This object may be used to decompress data " "incrementally. For one-shot compression, use the :func:`decompress` function " "instead." msgstr "" -#: ../../library/bz2.rst:221 +#: ../../library/bz2.rst:234 msgid "" "This class does not transparently handle inputs containing multiple " "compressed streams, unlike :func:`decompress` and :class:`BZ2File`. If you " @@ -300,7 +310,7 @@ msgid "" "must use a new decompressor for each stream." msgstr "" -#: ../../library/bz2.rst:228 +#: ../../library/bz2.rst:241 msgid "" "Decompress *data* (a :term:`bytes-like object`), returning uncompressed data " "as bytes. Some of *data* may be buffered internally, for use in later calls " @@ -308,7 +318,7 @@ msgid "" "output of any previous calls to :meth:`decompress`." msgstr "" -#: ../../library/bz2.rst:234 +#: ../../library/bz2.rst:247 msgid "" "If *max_length* is nonnegative, returns at most *max_length* bytes of " "decompressed data. If this limit is reached and further output can be " @@ -317,99 +327,99 @@ msgid "" "``b''`` to obtain more of the output." msgstr "" -#: ../../library/bz2.rst:241 +#: ../../library/bz2.rst:254 msgid "" "If all of the input data was decompressed and returned (either because this " "was less than *max_length* bytes, or because *max_length* was negative), " "the :attr:`~.needs_input` attribute will be set to ``True``." msgstr "" -#: ../../library/bz2.rst:246 +#: ../../library/bz2.rst:259 msgid "" "Attempting to decompress data after the end of stream is reached raises an :" "exc:`EOFError`. Any data found after the end of the stream is ignored and " "saved in the :attr:`~.unused_data` attribute." msgstr "" -#: ../../library/bz2.rst:250 +#: ../../library/bz2.rst:263 msgid "Added the *max_length* parameter." msgstr "新增 *max_length* 參數。" -#: ../../library/bz2.rst:255 +#: ../../library/bz2.rst:268 msgid "``True`` if the end-of-stream marker has been reached." msgstr "" -#: ../../library/bz2.rst:262 +#: ../../library/bz2.rst:275 msgid "Data found after the end of the compressed stream." msgstr "" -#: ../../library/bz2.rst:264 +#: ../../library/bz2.rst:277 msgid "" "If this attribute is accessed before the end of the stream has been reached, " "its value will be ``b''``." msgstr "" -#: ../../library/bz2.rst:269 +#: ../../library/bz2.rst:282 msgid "" "``False`` if the :meth:`.decompress` method can provide more decompressed " "data before requiring new uncompressed input." msgstr "" -#: ../../library/bz2.rst:276 +#: ../../library/bz2.rst:289 msgid "One-shot (de)compression" msgstr "" -#: ../../library/bz2.rst:280 +#: ../../library/bz2.rst:293 msgid "Compress *data*, a :term:`bytes-like object `." msgstr "" -#: ../../library/bz2.rst:285 +#: ../../library/bz2.rst:298 msgid "For incremental compression, use a :class:`BZ2Compressor` instead." msgstr "" -#: ../../library/bz2.rst:290 +#: ../../library/bz2.rst:303 msgid "Decompress *data*, a :term:`bytes-like object `." msgstr "" -#: ../../library/bz2.rst:292 +#: ../../library/bz2.rst:305 msgid "" "If *data* is the concatenation of multiple compressed streams, decompress " "all of the streams." msgstr "" -#: ../../library/bz2.rst:295 +#: ../../library/bz2.rst:308 msgid "For incremental decompression, use a :class:`BZ2Decompressor` instead." msgstr "" -#: ../../library/bz2.rst:297 +#: ../../library/bz2.rst:310 msgid "Support for multi-stream inputs was added." msgstr "" -#: ../../library/bz2.rst:303 +#: ../../library/bz2.rst:316 msgid "Examples of usage" msgstr "用法範例" -#: ../../library/bz2.rst:305 +#: ../../library/bz2.rst:318 msgid "Below are some examples of typical usage of the :mod:`bz2` module." msgstr "" -#: ../../library/bz2.rst:307 +#: ../../library/bz2.rst:320 msgid "" "Using :func:`compress` and :func:`decompress` to demonstrate round-trip " "compression:" msgstr "" -#: ../../library/bz2.rst:325 +#: ../../library/bz2.rst:338 msgid "Using :class:`BZ2Compressor` for incremental compression:" msgstr "" -#: ../../library/bz2.rst:343 +#: ../../library/bz2.rst:356 msgid "" "The example above uses a very \"nonrandom\" stream of data (a stream of " "``b\"z\"`` chunks). Random data tends to compress poorly, while ordered, " "repetitive data usually yields a high compression ratio." msgstr "" -#: ../../library/bz2.rst:347 +#: ../../library/bz2.rst:360 msgid "Writing and reading a bzip2-compressed file in binary mode:" msgstr "" diff --git a/library/calendar.po b/library/calendar.po index 65de226b31..4365ce363d 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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-" @@ -645,10 +645,11 @@ msgid "" msgstr ":mod:`calendar` 模組可以作為腳本從命令列執行,並以互動方式列印日曆。" #: ../../library/calendar.rst:511 +#, fuzzy msgid "" "python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" -" [year] [month]" +" [-f FIRST_WEEKDAY] [year] [month]" msgstr "" "python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" @@ -760,12 +761,18 @@ msgid "Print the calendar to the terminal as text, or as an HTML document." msgstr "將日曆以文字或 HTML 文件的形式印出到終端機。" #: ../../library/calendar.rst:591 +#, fuzzy msgid "" -"The year to print the calendar for. Must be a number between 1 and 9999. " -"Defaults to the current year." +"The weekday to start each week. Must be a number between 0 (Monday) and 6 " +"(Sunday). Defaults to 0." +msgstr "印出日曆的年份。必須是 1 到 9999 之間的數字。預設為當前年份。" + +#: ../../library/calendar.rst:599 +#, fuzzy +msgid "The year to print the calendar for. Defaults to the current year." msgstr "印出日曆的年份。必須是 1 到 9999 之間的數字。預設為當前年份。" -#: ../../library/calendar.rst:598 +#: ../../library/calendar.rst:605 msgid "" "The month of the specified :option:`year` to print the calendar for. Must be " "a number between 1 and 12, and may only be used in text mode. Defaults to " @@ -774,11 +781,11 @@ msgstr "" "要列印日曆的指定 :option:`year` 的月份。必須是 1 到 12 之間的數字,並且只能在" "文字模式下使用。預設列印全年日曆。" -#: ../../library/calendar.rst:604 +#: ../../library/calendar.rst:611 msgid "*Text-mode options:*" msgstr "*文字模式選項:*" -#: ../../library/calendar.rst:608 +#: ../../library/calendar.rst:615 msgid "" "The width of the date column in terminal columns. The date is printed " "centred in the column. Any value lower than 2 is ignored. Defaults to 2." @@ -786,7 +793,7 @@ msgstr "" "終端機行中日期行的寬度。日期印出在行的中央。任何小於 2 的值都會被忽略。預設" "為 2。" -#: ../../library/calendar.rst:616 +#: ../../library/calendar.rst:623 msgid "" "The number of lines for each week in terminal rows. The date is printed top-" "aligned. Any value lower than 1 is ignored. Defaults to 1." @@ -794,21 +801,21 @@ msgstr "" "終端機列中每週的列數。日期印出時頂部會對齊。任何小於 1 的值都會被忽略。預設" "為 1。" -#: ../../library/calendar.rst:624 +#: ../../library/calendar.rst:631 msgid "" "The space between months in columns. Any value lower than 2 is ignored. " "Defaults to 6." msgstr "行中月份之間的間距。任何小於 2 的值都會被忽略。預設為 6。" -#: ../../library/calendar.rst:631 +#: ../../library/calendar.rst:638 msgid "The number of months printed per row. Defaults to 3." msgstr "每列印出的月份數量。預設為 3。" -#: ../../library/calendar.rst:635 +#: ../../library/calendar.rst:642 msgid "*HTML-mode options:*" msgstr "*HTML 模式選項:*" -#: ../../library/calendar.rst:639 +#: ../../library/calendar.rst:646 msgid "" "The path of a CSS stylesheet to use for the calendar. This must either be " "relative to the generated HTML, or an absolute HTTP or ``file:///`` URL." diff --git a/library/cmd.po b/library/cmd.po index 79408d6293..5a99032492 100644 --- a/library/cmd.po +++ b/library/cmd.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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-" @@ -53,41 +53,54 @@ msgstr "" #: ../../library/cmd.rst:29 msgid "" +"The default, ``'tab'``, is treated specially, so that it refers to the :kbd:" +"`Tab` key on every :data:`readline.backend`. Specifically, if :data:" +"`readline.backend` is ``editline``, ``Cmd`` will use ``'^I'`` instead of " +"``'tab'``. Note that other values are not treated this way, and might only " +"work with a specific backend." +msgstr "" + +#: ../../library/cmd.rst:36 +msgid "" "The optional arguments *stdin* and *stdout* specify the input and output " "file objects that the Cmd instance or subclass instance will use for input " "and output. If not specified, they will default to :data:`sys.stdin` and :" "data:`sys.stdout`." msgstr "" -#: ../../library/cmd.rst:34 +#: ../../library/cmd.rst:41 msgid "" "If you want a given *stdin* to be used, make sure to set the instance's :" "attr:`use_rawinput` attribute to ``False``, otherwise *stdin* will be " "ignored." msgstr "" -#: ../../library/cmd.rst:42 +#: ../../library/cmd.rst:45 +msgid "``completekey='tab'`` is replaced by ``'^I'`` for ``editline``." +msgstr "" + +#: ../../library/cmd.rst:52 msgid "Cmd Objects" msgstr "Cmd 物件" -#: ../../library/cmd.rst:44 +#: ../../library/cmd.rst:54 msgid "A :class:`Cmd` instance has the following methods:" msgstr "" -#: ../../library/cmd.rst:49 +#: ../../library/cmd.rst:59 msgid "" "Repeatedly issue a prompt, accept input, parse an initial prefix off the " "received input, and dispatch to action methods, passing them the remainder " "of the line as argument." msgstr "" -#: ../../library/cmd.rst:53 +#: ../../library/cmd.rst:63 msgid "" "The optional argument is a banner or intro string to be issued before the " "first prompt (this overrides the :attr:`intro` class attribute)." msgstr "" -#: ../../library/cmd.rst:56 +#: ../../library/cmd.rst:66 msgid "" "If the :mod:`readline` module is loaded, input will automatically inherit :" "program:`bash`\\ -like history-list editing (e.g. :kbd:`Control-P` scrolls " @@ -96,11 +109,11 @@ msgid "" "B` moves the cursor to the left non-destructively, etc.)." msgstr "" -#: ../../library/cmd.rst:62 +#: ../../library/cmd.rst:72 msgid "An end-of-file on input is passed back as the string ``'EOF'``." msgstr "" -#: ../../library/cmd.rst:68 +#: ../../library/cmd.rst:78 msgid "" "An interpreter instance will recognize a command name ``foo`` if and only if " "it has a method :meth:`!do_foo`. As a special case, a line beginning with " @@ -109,14 +122,14 @@ msgid "" "dispatched to the method :meth:`!do_shell` (if such a method is defined)." msgstr "" -#: ../../library/cmd.rst:74 +#: ../../library/cmd.rst:84 msgid "" "This method will return when the :meth:`postcmd` method returns a true " "value. The *stop* argument to :meth:`postcmd` is the return value from the " "command's corresponding :meth:`!do_\\*` method." msgstr "" -#: ../../library/cmd.rst:78 +#: ../../library/cmd.rst:88 msgid "" "If completion is enabled, completing commands will be done automatically, " "and completing of commands args is done by calling :meth:`!complete_foo` " @@ -128,7 +141,7 @@ msgid "" "the argument is in." msgstr "" -#: ../../library/cmd.rst:89 +#: ../../library/cmd.rst:99 msgid "" "All subclasses of :class:`Cmd` inherit a predefined :meth:`!do_help`. This " "method, called with an argument ``'bar'``, invokes the corresponding method :" @@ -139,7 +152,7 @@ msgid "" "undocumented commands." msgstr "" -#: ../../library/cmd.rst:100 +#: ../../library/cmd.rst:110 msgid "" "Interpret the argument as though it had been typed in response to the " "prompt. This may be overridden, but should not normally need to be; see the :" @@ -150,32 +163,32 @@ msgid "" "return value from the :meth:`default` method is returned." msgstr "" -#: ../../library/cmd.rst:111 +#: ../../library/cmd.rst:121 msgid "" "Method called when an empty line is entered in response to the prompt. If " "this method is not overridden, it repeats the last nonempty command entered." msgstr "" -#: ../../library/cmd.rst:117 +#: ../../library/cmd.rst:127 msgid "" "Method called on an input line when the command prefix is not recognized. If " "this method is not overridden, it prints an error message and returns." msgstr "" -#: ../../library/cmd.rst:123 +#: ../../library/cmd.rst:133 msgid "" "Method called to complete an input line when no command-specific :meth:`!" "complete_\\*` method is available. By default, it returns an empty list." msgstr "" -#: ../../library/cmd.rst:129 +#: ../../library/cmd.rst:139 msgid "" "Method called to display a list of strings as a compact set of columns. Each " "column is only as wide as necessary. Columns are separated by two spaces for " "readability." msgstr "" -#: ../../library/cmd.rst:136 +#: ../../library/cmd.rst:146 msgid "" "Hook method executed just before the command line *line* is interpreted, but " "after the input prompt is generated and issued. This method is a stub in :" @@ -185,7 +198,7 @@ msgid "" "*line* unchanged." msgstr "" -#: ../../library/cmd.rst:146 +#: ../../library/cmd.rst:156 msgid "" "Hook method executed just after a command dispatch is finished. This method " "is a stub in :class:`Cmd`; it exists to be overridden by subclasses. *line* " @@ -196,74 +209,74 @@ msgid "" "corresponds to *stop*; returning false will cause interpretation to continue." msgstr "" -#: ../../library/cmd.rst:157 +#: ../../library/cmd.rst:167 msgid "" "Hook method executed once when :meth:`cmdloop` is called. This method is a " "stub in :class:`Cmd`; it exists to be overridden by subclasses." msgstr "" -#: ../../library/cmd.rst:163 +#: ../../library/cmd.rst:173 msgid "" "Hook method executed once when :meth:`cmdloop` is about to return. This " "method is a stub in :class:`Cmd`; it exists to be overridden by subclasses." msgstr "" -#: ../../library/cmd.rst:167 +#: ../../library/cmd.rst:177 msgid "" "Instances of :class:`Cmd` subclasses have some public instance variables:" msgstr "" -#: ../../library/cmd.rst:171 +#: ../../library/cmd.rst:181 msgid "The prompt issued to solicit input." msgstr "" -#: ../../library/cmd.rst:176 +#: ../../library/cmd.rst:186 msgid "The string of characters accepted for the command prefix." msgstr "" -#: ../../library/cmd.rst:181 +#: ../../library/cmd.rst:191 msgid "The last nonempty command prefix seen." msgstr "" -#: ../../library/cmd.rst:186 +#: ../../library/cmd.rst:196 msgid "" "A list of queued input lines. The cmdqueue list is checked in :meth:" "`cmdloop` when new input is needed; if it is nonempty, its elements will be " "processed in order, as if entered at the prompt." msgstr "" -#: ../../library/cmd.rst:193 +#: ../../library/cmd.rst:203 msgid "" "A string to issue as an intro or banner. May be overridden by giving the :" "meth:`cmdloop` method an argument." msgstr "" -#: ../../library/cmd.rst:199 +#: ../../library/cmd.rst:209 msgid "" "The header to issue if the help output has a section for documented commands." msgstr "" -#: ../../library/cmd.rst:204 +#: ../../library/cmd.rst:214 msgid "" "The header to issue if the help output has a section for miscellaneous help " "topics (that is, there are :meth:`!help_\\*` methods without corresponding :" "meth:`!do_\\*` methods)." msgstr "" -#: ../../library/cmd.rst:211 +#: ../../library/cmd.rst:221 msgid "" "The header to issue if the help output has a section for undocumented " "commands (that is, there are :meth:`!do_\\*` methods without corresponding :" "meth:`!help_\\*` methods)." msgstr "" -#: ../../library/cmd.rst:218 +#: ../../library/cmd.rst:228 msgid "" "The character used to draw separator lines under the help-message headers. " "If empty, no ruler line is drawn. It defaults to ``'='``." msgstr "" -#: ../../library/cmd.rst:224 +#: ../../library/cmd.rst:234 msgid "" "A flag, defaulting to true. If true, :meth:`cmdloop` uses :func:`input` to " "display a prompt and read the next command; if false, :data:`sys.stdout." @@ -273,23 +286,23 @@ msgid "" "editing and command-history keystrokes.)" msgstr "" -#: ../../library/cmd.rst:234 +#: ../../library/cmd.rst:244 msgid "Cmd Example" msgstr "" -#: ../../library/cmd.rst:238 +#: ../../library/cmd.rst:248 msgid "" "The :mod:`cmd` module is mainly useful for building custom shells that let a " "user work with a program interactively." msgstr "" -#: ../../library/cmd.rst:241 +#: ../../library/cmd.rst:251 msgid "" "This section presents a simple example of how to build a shell around a few " "of the commands in the :mod:`turtle` module." msgstr "" -#: ../../library/cmd.rst:244 +#: ../../library/cmd.rst:254 msgid "" "Basic turtle commands such as :meth:`~turtle.forward` are added to a :class:" "`Cmd` subclass with method named :meth:`!do_forward`. The argument is " @@ -297,7 +310,7 @@ msgid "" "used in the help utility provided by the shell." msgstr "" -#: ../../library/cmd.rst:249 +#: ../../library/cmd.rst:259 msgid "" "The example also includes a basic record and playback facility implemented " "with the :meth:`~Cmd.precmd` method which is responsible for converting the " @@ -306,7 +319,7 @@ msgid "" "attr:`~Cmd.cmdqueue` for immediate playback::" msgstr "" -#: ../../library/cmd.rst:255 +#: ../../library/cmd.rst:265 msgid "" "import cmd, sys\n" "from turtle import *\n" @@ -386,14 +399,14 @@ msgid "" " TurtleShell().cmdloop()" msgstr "" -#: ../../library/cmd.rst:330 +#: ../../library/cmd.rst:340 msgid "" "Here is a sample session with the turtle shell showing the help functions, " "using blank lines to repeat commands, and the simple record and playback " "facility:" msgstr "" -#: ../../library/cmd.rst:333 +#: ../../library/cmd.rst:343 msgid "" "Welcome to the turtle shell. Type help or ? to list commands.\n" "\n" @@ -511,14 +524,14 @@ msgstr "" "(turtle) bye\n" "Thank you for using Turtle" -#: ../../library/cmd.rst:64 +#: ../../library/cmd.rst:74 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/cmd.rst:64 +#: ../../library/cmd.rst:74 msgid "in a command interpreter" msgstr "於 command interpreter(指令直譯器)中" -#: ../../library/cmd.rst:64 +#: ../../library/cmd.rst:74 msgid "! (exclamation)" msgstr "! (驚嘆號)" diff --git a/library/cmdline.po b/library/cmdline.po index 7a8f563111..ed2fd4286f 100644 --- a/library/cmdline.po +++ b/library/cmdline.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-10-12 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-10-14 16:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -154,73 +154,78 @@ msgid ":mod:`quopri`" msgstr ":mod:`quopri`" #: ../../library/cmdline.rst:39 +#, fuzzy +msgid ":ref:`random `" +msgstr ":ref:`asyncio `" + +#: ../../library/cmdline.rst:40 msgid ":mod:`runpy`" msgstr ":mod:`runpy`" -#: ../../library/cmdline.rst:40 +#: ../../library/cmdline.rst:41 msgid ":ref:`site `" msgstr ":ref:`site `" -#: ../../library/cmdline.rst:41 +#: ../../library/cmdline.rst:42 msgid ":ref:`sqlite3 `" msgstr ":ref:`sqlite3 `" -#: ../../library/cmdline.rst:42 +#: ../../library/cmdline.rst:43 msgid ":ref:`sysconfig `" msgstr ":ref:`sysconfig `" -#: ../../library/cmdline.rst:43 +#: ../../library/cmdline.rst:44 msgid ":mod:`tabnanny`" msgstr ":mod:`tabnanny`" -#: ../../library/cmdline.rst:44 +#: ../../library/cmdline.rst:45 msgid ":ref:`tarfile `" msgstr ":ref:`tarfile `" -#: ../../library/cmdline.rst:45 +#: ../../library/cmdline.rst:46 msgid ":mod:`!this`" msgstr ":mod:`!this`" -#: ../../library/cmdline.rst:46 +#: ../../library/cmdline.rst:47 msgid ":ref:`timeit `" msgstr ":ref:`timeit `" -#: ../../library/cmdline.rst:47 +#: ../../library/cmdline.rst:48 msgid ":ref:`tokenize `" msgstr ":ref:`tokenize `" -#: ../../library/cmdline.rst:48 +#: ../../library/cmdline.rst:49 msgid ":ref:`trace `" msgstr ":ref:`trace `" -#: ../../library/cmdline.rst:49 +#: ../../library/cmdline.rst:50 msgid ":mod:`turtledemo`" msgstr ":mod:`turtledemo`" -#: ../../library/cmdline.rst:50 +#: ../../library/cmdline.rst:51 msgid ":ref:`unittest `" msgstr ":ref:`unittest `" -#: ../../library/cmdline.rst:51 +#: ../../library/cmdline.rst:52 msgid ":ref:`uuid `" msgstr ":ref:`uuid `" -#: ../../library/cmdline.rst:52 +#: ../../library/cmdline.rst:53 msgid ":mod:`venv`" msgstr ":mod:`venv`" -#: ../../library/cmdline.rst:53 +#: ../../library/cmdline.rst:54 msgid ":mod:`webbrowser`" msgstr ":mod:`webbrowser`" -#: ../../library/cmdline.rst:54 +#: ../../library/cmdline.rst:55 msgid ":ref:`zipapp `" msgstr ":ref:`zipapp `" -#: ../../library/cmdline.rst:55 +#: ../../library/cmdline.rst:56 msgid ":ref:`zipfile `" msgstr ":ref:`zipfile `" -#: ../../library/cmdline.rst:57 +#: ../../library/cmdline.rst:58 msgid "See also the :ref:`Python command-line interface `." msgstr "另請見 :ref:`Python 命令列介面 `。" diff --git a/library/code.po b/library/code.po index e779167cf9..b424c1a11c 100644 --- a/library/code.po +++ b/library/code.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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-" @@ -38,35 +38,43 @@ msgid "" "This class deals with parsing and interpreter state (the user's namespace); " "it does not deal with input buffering or prompting or input file naming (the " "filename is always passed in explicitly). The optional *locals* argument " -"specifies the dictionary in which code will be executed; it defaults to a " -"newly created dictionary with key ``'__name__'`` set to ``'__console__'`` " -"and key ``'__doc__'`` set to ``None``." +"specifies a mapping to use as the namespace in which code will be executed; " +"it defaults to a newly created dictionary with key ``'__name__'`` set to " +"``'__console__'`` and key ``'__doc__'`` set to ``None``." msgstr "" #: ../../library/code.rst:28 msgid "" "Closely emulate the behavior of the interactive Python interpreter. This " "class builds on :class:`InteractiveInterpreter` and adds prompting using the " -"familiar ``sys.ps1`` and ``sys.ps2``, and input buffering." +"familiar ``sys.ps1`` and ``sys.ps2``, and input buffering. If *local_exit* " +"is true, ``exit()`` and ``quit()`` in the console will not raise :exc:" +"`SystemExit`, but instead return to the calling code." msgstr "" -#: ../../library/code.rst:35 +#: ../../library/code.rst:34 ../../library/code.rst:52 +#, fuzzy +msgid "Added *local_exit* parameter." +msgstr "新增 *exitmsg* 參數。" + +#: ../../library/code.rst:39 msgid "" "Convenience function to run a read-eval-print loop. This creates a new " "instance of :class:`InteractiveConsole` and sets *readfunc* to be used as " "the :meth:`InteractiveConsole.raw_input` method, if provided. If *local* is " "provided, it is passed to the :class:`InteractiveConsole` constructor for " -"use as the default namespace for the interpreter loop. The :meth:" -"`~InteractiveConsole.interact` method of the instance is then run with " +"use as the default namespace for the interpreter loop. If *local_exit* is " +"provided, it is passed to the :class:`InteractiveConsole` constructor. The :" +"meth:`~InteractiveConsole.interact` method of the instance is then run with " "*banner* and *exitmsg* passed as the banner and exit message to use, if " "provided. The console object is discarded after use." msgstr "" -#: ../../library/code.rst:44 +#: ../../library/code.rst:49 msgid "Added *exitmsg* parameter." msgstr "新增 *exitmsg* 參數。" -#: ../../library/code.rst:50 +#: ../../library/code.rst:57 msgid "" "This function is useful for programs that want to emulate Python's " "interpreter main loop (a.k.a. the read-eval-print loop). The tricky part is " @@ -76,7 +84,7 @@ msgid "" "real interpreter main loop." msgstr "" -#: ../../library/code.rst:57 +#: ../../library/code.rst:64 msgid "" "*source* is the source string; *filename* is the optional filename from " "which source was read, defaulting to ``''``; and *symbol* is the " @@ -84,7 +92,7 @@ msgid "" "``'eval'`` or ``'exec'``." msgstr "" -#: ../../library/code.rst:62 +#: ../../library/code.rst:69 msgid "" "Returns a code object (the same as ``compile(source, filename, symbol)``) if " "the command is complete and valid; ``None`` if the command is incomplete; " @@ -93,18 +101,18 @@ msgid "" "contains an invalid literal." msgstr "" -#: ../../library/code.rst:72 +#: ../../library/code.rst:79 msgid "Interactive Interpreter Objects" msgstr "" -#: ../../library/code.rst:77 +#: ../../library/code.rst:84 msgid "" "Compile and run some source in the interpreter. Arguments are the same as " "for :func:`compile_command`; the default for *filename* is ``''``, " "and for *symbol* is ``'single'``. One of several things can happen:" msgstr "" -#: ../../library/code.rst:81 +#: ../../library/code.rst:88 msgid "" "The input is incorrect; :func:`compile_command` raised an exception (:exc:" "`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be printed " @@ -112,13 +120,13 @@ msgid "" "``False``." msgstr "" -#: ../../library/code.rst:86 +#: ../../library/code.rst:93 msgid "" "The input is incomplete, and more input is required; :func:`compile_command` " "returned ``None``. :meth:`runsource` returns ``True``." msgstr "" -#: ../../library/code.rst:89 +#: ../../library/code.rst:96 msgid "" "The input is complete; :func:`compile_command` returned a code object. The " "code is executed by calling the :meth:`runcode` (which also handles run-time " @@ -126,27 +134,27 @@ msgid "" "``False``." msgstr "" -#: ../../library/code.rst:93 +#: ../../library/code.rst:100 msgid "" "The return value can be used to decide whether to use ``sys.ps1`` or ``sys." "ps2`` to prompt the next line." msgstr "" -#: ../../library/code.rst:99 +#: ../../library/code.rst:106 msgid "" "Execute a code object. When an exception occurs, :meth:`showtraceback` is " "called to display a traceback. All exceptions are caught except :exc:" "`SystemExit`, which is allowed to propagate." msgstr "" -#: ../../library/code.rst:103 +#: ../../library/code.rst:110 msgid "" "A note about :exc:`KeyboardInterrupt`: this exception may occur elsewhere in " "this code, and may not always be caught. The caller should be prepared to " "deal with it." msgstr "" -#: ../../library/code.rst:110 +#: ../../library/code.rst:117 msgid "" "Display the syntax error that just occurred. This does not display a stack " "trace because there isn't one for syntax errors. If *filename* is given, it " @@ -155,38 +163,38 @@ msgid "" "string. The output is written by the :meth:`write` method." msgstr "" -#: ../../library/code.rst:119 +#: ../../library/code.rst:126 msgid "" "Display the exception that just occurred. We remove the first stack item " "because it is within the interpreter object implementation. The output is " "written by the :meth:`write` method." msgstr "" -#: ../../library/code.rst:123 +#: ../../library/code.rst:130 msgid "" "The full chained traceback is displayed instead of just the primary " "traceback." msgstr "" -#: ../../library/code.rst:129 +#: ../../library/code.rst:136 msgid "" "Write a string to the standard error stream (``sys.stderr``). Derived " "classes should override this to provide the appropriate output handling as " "needed." msgstr "" -#: ../../library/code.rst:136 +#: ../../library/code.rst:143 msgid "Interactive Console Objects" msgstr "" -#: ../../library/code.rst:138 +#: ../../library/code.rst:145 msgid "" "The :class:`InteractiveConsole` class is a subclass of :class:" "`InteractiveInterpreter`, and so offers all the methods of the interpreter " "objects as well as the following additions." msgstr "" -#: ../../library/code.rst:145 +#: ../../library/code.rst:152 msgid "" "Closely emulate the interactive Python console. The optional *banner* " "argument specify the banner to print before the first interaction; by " @@ -196,22 +204,22 @@ msgid "" "close!)." msgstr "" -#: ../../library/code.rst:151 +#: ../../library/code.rst:158 msgid "" "The optional *exitmsg* argument specifies an exit message printed when " "exiting. Pass the empty string to suppress the exit message. If *exitmsg* is " "not given or ``None``, a default message is printed." msgstr "" -#: ../../library/code.rst:155 +#: ../../library/code.rst:162 msgid "To suppress printing any banner, pass an empty string." msgstr "" -#: ../../library/code.rst:158 +#: ../../library/code.rst:165 msgid "Print an exit message when exiting." msgstr "" -#: ../../library/code.rst:164 +#: ../../library/code.rst:171 msgid "" "Push a line of source text to the interpreter. The line should not have a " "trailing newline; it may have internal newlines. The line is appended to a " @@ -224,11 +232,11 @@ msgid "" "same as :meth:`!runsource`)." msgstr "" -#: ../../library/code.rst:176 +#: ../../library/code.rst:183 msgid "Remove any unhandled source text from the input buffer." msgstr "" -#: ../../library/code.rst:181 +#: ../../library/code.rst:188 msgid "" "Write a prompt and read a line. The returned line does not include the " "trailing newline. When the user enters the EOF key sequence, :exc:" diff --git a/library/codecs.po b/library/codecs.po index 4bef52ddb0..aa60cd8b84 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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-" @@ -369,8 +369,8 @@ msgid "Value" msgstr "" #: ../../library/codecs.rst:330 ../../library/codecs.rst:373 -#: ../../library/codecs.rst:393 ../../library/codecs.rst:1330 -#: ../../library/codecs.rst:1398 ../../library/codecs.rst:1455 +#: ../../library/codecs.rst:393 ../../library/codecs.rst:1331 +#: ../../library/codecs.rst:1399 ../../library/codecs.rst:1454 msgid "Meaning" msgstr "含義" @@ -1369,13 +1369,13 @@ msgstr "" msgid "an IBM PC code page, which is ASCII compatible" msgstr "" -#: ../../library/codecs.rst:1075 ../../library/codecs.rst:1330 -#: ../../library/codecs.rst:1398 ../../library/codecs.rst:1455 +#: ../../library/codecs.rst:1075 ../../library/codecs.rst:1331 +#: ../../library/codecs.rst:1399 ../../library/codecs.rst:1454 msgid "Codec" msgstr "" -#: ../../library/codecs.rst:1075 ../../library/codecs.rst:1330 -#: ../../library/codecs.rst:1398 ../../library/codecs.rst:1455 +#: ../../library/codecs.rst:1075 ../../library/codecs.rst:1331 +#: ../../library/codecs.rst:1399 ../../library/codecs.rst:1454 msgid "Aliases" msgstr "" @@ -1405,7 +1405,7 @@ msgid "big5-tw, csbig5" msgstr "big5-tw, csbig5" #: ../../library/codecs.rst:1079 ../../library/codecs.rst:1081 -#: ../../library/codecs.rst:1139 +#: ../../library/codecs.rst:1140 msgid "Traditional Chinese" msgstr "繁體中文" @@ -1446,8 +1446,8 @@ msgid "EBCDIC-CP-HE, IBM424" msgstr "EBCDIC-CP-HE, IBM424" #: ../../library/codecs.rst:1089 ../../library/codecs.rst:1109 -#: ../../library/codecs.rst:1119 ../../library/codecs.rst:1162 -#: ../../library/codecs.rst:1225 +#: ../../library/codecs.rst:1119 ../../library/codecs.rst:1163 +#: ../../library/codecs.rst:1226 msgid "Hebrew" msgstr "希伯來文" @@ -1468,9 +1468,9 @@ msgid "EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500" msgstr "EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500" #: ../../library/codecs.rst:1093 ../../library/codecs.rst:1102 -#: ../../library/codecs.rst:1113 ../../library/codecs.rst:1149 -#: ../../library/codecs.rst:1156 ../../library/codecs.rst:1209 -#: ../../library/codecs.rst:1237 ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1113 ../../library/codecs.rst:1150 +#: ../../library/codecs.rst:1157 ../../library/codecs.rst:1210 +#: ../../library/codecs.rst:1238 ../../library/codecs.rst:1266 msgid "Western Europe" msgstr "" @@ -1479,7 +1479,7 @@ msgid "cp720" msgstr "cp720" #: ../../library/codecs.rst:1096 ../../library/codecs.rst:1123 -#: ../../library/codecs.rst:1164 ../../library/codecs.rst:1221 +#: ../../library/codecs.rst:1165 ../../library/codecs.rst:1222 msgid "Arabic" msgstr "阿拉伯文" @@ -1488,8 +1488,8 @@ msgid "cp737" msgstr "cp737" #: ../../library/codecs.rst:1098 ../../library/codecs.rst:1129 -#: ../../library/codecs.rst:1133 ../../library/codecs.rst:1158 -#: ../../library/codecs.rst:1223 ../../library/codecs.rst:1258 +#: ../../library/codecs.rst:1133 ../../library/codecs.rst:1159 +#: ../../library/codecs.rst:1224 ../../library/codecs.rst:1259 msgid "Greek" msgstr "希臘文" @@ -1501,8 +1501,8 @@ msgstr "cp775" msgid "IBM775" msgstr "IBM775" -#: ../../library/codecs.rst:1100 ../../library/codecs.rst:1166 -#: ../../library/codecs.rst:1216 ../../library/codecs.rst:1233 +#: ../../library/codecs.rst:1100 ../../library/codecs.rst:1167 +#: ../../library/codecs.rst:1217 ../../library/codecs.rst:1234 msgid "Baltic languages" msgstr "" @@ -1522,8 +1522,8 @@ msgstr "cp852" msgid "852, IBM852" msgstr "852, IBM852" -#: ../../library/codecs.rst:1104 ../../library/codecs.rst:1151 -#: ../../library/codecs.rst:1212 ../../library/codecs.rst:1262 +#: ../../library/codecs.rst:1104 ../../library/codecs.rst:1152 +#: ../../library/codecs.rst:1213 ../../library/codecs.rst:1263 msgid "Central and Eastern Europe" msgstr "" @@ -1535,8 +1535,8 @@ msgstr "cp855" msgid "855, IBM855" msgstr "855, IBM855" -#: ../../library/codecs.rst:1106 ../../library/codecs.rst:1153 -#: ../../library/codecs.rst:1218 ../../library/codecs.rst:1255 +#: ../../library/codecs.rst:1106 ../../library/codecs.rst:1154 +#: ../../library/codecs.rst:1219 ../../library/codecs.rst:1256 msgid "Bulgarian, Byelorussian, Macedonian, Russian, Serbian" msgstr "" @@ -1552,9 +1552,9 @@ msgstr "cp857" msgid "857, IBM857" msgstr "857, IBM857" -#: ../../library/codecs.rst:1111 ../../library/codecs.rst:1143 -#: ../../library/codecs.rst:1160 ../../library/codecs.rst:1227 -#: ../../library/codecs.rst:1267 +#: ../../library/codecs.rst:1111 ../../library/codecs.rst:1144 +#: ../../library/codecs.rst:1161 ../../library/codecs.rst:1228 +#: ../../library/codecs.rst:1268 msgid "Turkish" msgstr "土耳其文" @@ -1586,7 +1586,7 @@ msgstr "cp861" msgid "861, CP-IS, IBM861" msgstr "861, CP-IS, IBM861" -#: ../../library/codecs.rst:1117 ../../library/codecs.rst:1260 +#: ../../library/codecs.rst:1117 ../../library/codecs.rst:1261 msgid "Icelandic" msgstr "" @@ -1638,7 +1638,7 @@ msgstr "cp866" msgid "866, IBM866" msgstr "866, IBM866" -#: ../../library/codecs.rst:1127 ../../library/codecs.rst:1243 +#: ../../library/codecs.rst:1127 ../../library/codecs.rst:1244 msgid "Russian" msgstr "俄羅斯文" @@ -1667,188 +1667,189 @@ msgid "cp932" msgstr "cp932" #: ../../library/codecs.rst:1135 -msgid "932, ms932, mskanji, ms-kanji" +#, fuzzy +msgid "932, ms932, mskanji, ms-kanji, windows-31j" msgstr "932, ms932, mskanji, ms-kanji" -#: ../../library/codecs.rst:1135 ../../library/codecs.rst:1170 -#: ../../library/codecs.rst:1172 ../../library/codecs.rst:1174 -#: ../../library/codecs.rst:1191 ../../library/codecs.rst:1194 -#: ../../library/codecs.rst:1199 ../../library/codecs.rst:1202 -#: ../../library/codecs.rst:1204 ../../library/codecs.rst:1272 -#: ../../library/codecs.rst:1275 ../../library/codecs.rst:1278 +#: ../../library/codecs.rst:1135 ../../library/codecs.rst:1171 +#: ../../library/codecs.rst:1173 ../../library/codecs.rst:1175 +#: ../../library/codecs.rst:1192 ../../library/codecs.rst:1195 +#: ../../library/codecs.rst:1200 ../../library/codecs.rst:1203 +#: ../../library/codecs.rst:1205 ../../library/codecs.rst:1273 +#: ../../library/codecs.rst:1276 ../../library/codecs.rst:1279 msgid "Japanese" msgstr "日文" -#: ../../library/codecs.rst:1137 +#: ../../library/codecs.rst:1138 msgid "cp949" msgstr "cp949" -#: ../../library/codecs.rst:1137 +#: ../../library/codecs.rst:1138 msgid "949, ms949, uhc" msgstr "949, ms949, uhc" -#: ../../library/codecs.rst:1137 ../../library/codecs.rst:1176 -#: ../../library/codecs.rst:1206 ../../library/codecs.rst:1241 +#: ../../library/codecs.rst:1138 ../../library/codecs.rst:1177 +#: ../../library/codecs.rst:1207 ../../library/codecs.rst:1242 msgid "Korean" msgstr "韓文" -#: ../../library/codecs.rst:1139 +#: ../../library/codecs.rst:1140 msgid "cp950" msgstr "cp950" -#: ../../library/codecs.rst:1139 +#: ../../library/codecs.rst:1140 msgid "950, ms950" msgstr "950, ms950" -#: ../../library/codecs.rst:1141 +#: ../../library/codecs.rst:1142 msgid "cp1006" msgstr "cp1006" -#: ../../library/codecs.rst:1141 +#: ../../library/codecs.rst:1142 msgid "Urdu" msgstr "" -#: ../../library/codecs.rst:1143 +#: ../../library/codecs.rst:1144 msgid "cp1026" msgstr "cp1026" -#: ../../library/codecs.rst:1143 +#: ../../library/codecs.rst:1144 msgid "ibm1026" msgstr "ibm1026" -#: ../../library/codecs.rst:1145 +#: ../../library/codecs.rst:1146 msgid "cp1125" msgstr "cp1125" -#: ../../library/codecs.rst:1145 +#: ../../library/codecs.rst:1146 msgid "1125, ibm1125, cp866u, ruscii" msgstr "1125, ibm1125, cp866u, ruscii" -#: ../../library/codecs.rst:1145 ../../library/codecs.rst:1249 +#: ../../library/codecs.rst:1146 ../../library/codecs.rst:1250 msgid "Ukrainian" msgstr "烏克蘭文" -#: ../../library/codecs.rst:1149 +#: ../../library/codecs.rst:1150 msgid "cp1140" msgstr "cp1140" -#: ../../library/codecs.rst:1149 +#: ../../library/codecs.rst:1150 msgid "ibm1140" msgstr "ibm1140" -#: ../../library/codecs.rst:1151 +#: ../../library/codecs.rst:1152 msgid "cp1250" msgstr "cp1250" -#: ../../library/codecs.rst:1151 +#: ../../library/codecs.rst:1152 msgid "windows-1250" msgstr "windows-1250" -#: ../../library/codecs.rst:1153 +#: ../../library/codecs.rst:1154 msgid "cp1251" msgstr "cp1251" -#: ../../library/codecs.rst:1153 +#: ../../library/codecs.rst:1154 msgid "windows-1251" msgstr "windows-1251" -#: ../../library/codecs.rst:1156 +#: ../../library/codecs.rst:1157 msgid "cp1252" msgstr "cp1252" -#: ../../library/codecs.rst:1156 +#: ../../library/codecs.rst:1157 msgid "windows-1252" msgstr "windows-1252" -#: ../../library/codecs.rst:1158 +#: ../../library/codecs.rst:1159 msgid "cp1253" msgstr "cp1253" -#: ../../library/codecs.rst:1158 +#: ../../library/codecs.rst:1159 msgid "windows-1253" msgstr "windows-1253" -#: ../../library/codecs.rst:1160 +#: ../../library/codecs.rst:1161 msgid "cp1254" msgstr "cp1254" -#: ../../library/codecs.rst:1160 +#: ../../library/codecs.rst:1161 msgid "windows-1254" msgstr "windows-1254" -#: ../../library/codecs.rst:1162 +#: ../../library/codecs.rst:1163 msgid "cp1255" msgstr "cp1255" -#: ../../library/codecs.rst:1162 +#: ../../library/codecs.rst:1163 msgid "windows-1255" msgstr "windows-1255" -#: ../../library/codecs.rst:1164 +#: ../../library/codecs.rst:1165 msgid "cp1256" msgstr "cp1256" -#: ../../library/codecs.rst:1164 +#: ../../library/codecs.rst:1165 msgid "windows-1256" msgstr "windows-1256" -#: ../../library/codecs.rst:1166 +#: ../../library/codecs.rst:1167 msgid "cp1257" msgstr "cp1257" -#: ../../library/codecs.rst:1166 +#: ../../library/codecs.rst:1167 msgid "windows-1257" msgstr "windows-1257" -#: ../../library/codecs.rst:1168 +#: ../../library/codecs.rst:1169 msgid "cp1258" msgstr "cp1258" -#: ../../library/codecs.rst:1168 +#: ../../library/codecs.rst:1169 msgid "windows-1258" msgstr "windows-1258" -#: ../../library/codecs.rst:1168 +#: ../../library/codecs.rst:1169 msgid "Vietnamese" msgstr "越南文" -#: ../../library/codecs.rst:1170 +#: ../../library/codecs.rst:1171 msgid "euc_jp" msgstr "euc_jp" -#: ../../library/codecs.rst:1170 +#: ../../library/codecs.rst:1171 msgid "eucjp, ujis, u-jis" msgstr "eucjp, ujis, u-jis" -#: ../../library/codecs.rst:1172 +#: ../../library/codecs.rst:1173 msgid "euc_jis_2004" msgstr "euc_jis_2004" -#: ../../library/codecs.rst:1172 +#: ../../library/codecs.rst:1173 msgid "jisx0213, eucjis2004" msgstr "jisx0213, eucjis2004" -#: ../../library/codecs.rst:1174 +#: ../../library/codecs.rst:1175 msgid "euc_jisx0213" msgstr "euc_jisx0213" -#: ../../library/codecs.rst:1174 +#: ../../library/codecs.rst:1175 msgid "eucjisx0213" msgstr "eucjisx0213" -#: ../../library/codecs.rst:1176 +#: ../../library/codecs.rst:1177 msgid "euc_kr" msgstr "euc_kr" -#: ../../library/codecs.rst:1176 +#: ../../library/codecs.rst:1177 msgid "euckr, korean, ksc5601, ks_c-5601, ks_c-5601-1987, ksx1001, ks_x-1001" msgstr "euckr, korean, ksc5601, ks_c-5601, ks_c-5601-1987, ksx1001, ks_x-1001" -#: ../../library/codecs.rst:1180 +#: ../../library/codecs.rst:1181 msgid "gb2312" msgstr "gb2312" -#: ../../library/codecs.rst:1180 +#: ../../library/codecs.rst:1181 msgid "" "chinese, csiso58gb231280, euc-cn, euccn, eucgb2312-cn, gb2312-1980, " "gb2312-80, iso-ir-58" @@ -1856,446 +1857,446 @@ msgstr "" "chinese, csiso58gb231280, euc-cn, euccn, eucgb2312-cn, gb2312-1980, " "gb2312-80, iso-ir-58" -#: ../../library/codecs.rst:1180 ../../library/codecs.rst:1189 +#: ../../library/codecs.rst:1181 ../../library/codecs.rst:1190 msgid "Simplified Chinese" msgstr "簡體中文" -#: ../../library/codecs.rst:1185 +#: ../../library/codecs.rst:1186 msgid "gbk" msgstr "gbk" -#: ../../library/codecs.rst:1185 +#: ../../library/codecs.rst:1186 msgid "936, cp936, ms936" msgstr "936, cp936, ms936" -#: ../../library/codecs.rst:1185 ../../library/codecs.rst:1187 +#: ../../library/codecs.rst:1186 ../../library/codecs.rst:1188 msgid "Unified Chinese" msgstr "" -#: ../../library/codecs.rst:1187 +#: ../../library/codecs.rst:1188 msgid "gb18030" msgstr "gb18030" -#: ../../library/codecs.rst:1187 +#: ../../library/codecs.rst:1188 msgid "gb18030-2000" msgstr "gb18030-2000" -#: ../../library/codecs.rst:1189 +#: ../../library/codecs.rst:1190 msgid "hz" msgstr "" -#: ../../library/codecs.rst:1189 +#: ../../library/codecs.rst:1190 msgid "hzgb, hz-gb, hz-gb-2312" msgstr "hzgb, hz-gb, hz-gb-2312" -#: ../../library/codecs.rst:1191 +#: ../../library/codecs.rst:1192 msgid "iso2022_jp" msgstr "iso2022_jp" -#: ../../library/codecs.rst:1191 +#: ../../library/codecs.rst:1192 msgid "csiso2022jp, iso2022jp, iso-2022-jp" msgstr "csiso2022jp, iso2022jp, iso-2022-jp" -#: ../../library/codecs.rst:1194 +#: ../../library/codecs.rst:1195 msgid "iso2022_jp_1" msgstr "iso2022_jp_1" -#: ../../library/codecs.rst:1194 +#: ../../library/codecs.rst:1195 msgid "iso2022jp-1, iso-2022-jp-1" msgstr "iso2022jp-1, iso-2022-jp-1" -#: ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1197 msgid "iso2022_jp_2" msgstr "iso2022_jp_2" -#: ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1197 msgid "iso2022jp-2, iso-2022-jp-2" msgstr "iso2022jp-2, iso-2022-jp-2" -#: ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1197 msgid "Japanese, Korean, Simplified Chinese, Western Europe, Greek" msgstr "" -#: ../../library/codecs.rst:1199 +#: ../../library/codecs.rst:1200 msgid "iso2022_jp_2004" msgstr "iso2022_jp_2004" -#: ../../library/codecs.rst:1199 +#: ../../library/codecs.rst:1200 msgid "iso2022jp-2004, iso-2022-jp-2004" msgstr "iso2022jp-2004, iso-2022-jp-2004" -#: ../../library/codecs.rst:1202 +#: ../../library/codecs.rst:1203 msgid "iso2022_jp_3" msgstr "iso2022_jp_3" -#: ../../library/codecs.rst:1202 +#: ../../library/codecs.rst:1203 msgid "iso2022jp-3, iso-2022-jp-3" msgstr "iso2022jp-3, iso-2022-jp-3" -#: ../../library/codecs.rst:1204 +#: ../../library/codecs.rst:1205 msgid "iso2022_jp_ext" msgstr "iso2022_jp_ext" -#: ../../library/codecs.rst:1204 +#: ../../library/codecs.rst:1205 msgid "iso2022jp-ext, iso-2022-jp-ext" msgstr "iso2022jp-ext, iso-2022-jp-ext" -#: ../../library/codecs.rst:1206 +#: ../../library/codecs.rst:1207 msgid "iso2022_kr" msgstr "iso2022_kr" -#: ../../library/codecs.rst:1206 +#: ../../library/codecs.rst:1207 msgid "csiso2022kr, iso2022kr, iso-2022-kr" msgstr "csiso2022kr, iso2022kr, iso-2022-kr" -#: ../../library/codecs.rst:1209 +#: ../../library/codecs.rst:1210 msgid "latin_1" msgstr "latin_1" -#: ../../library/codecs.rst:1209 +#: ../../library/codecs.rst:1210 msgid "iso-8859-1, iso8859-1, 8859, cp819, latin, latin1, L1" msgstr "iso-8859-1, iso8859-1, 8859, cp819, latin, latin1, L1" -#: ../../library/codecs.rst:1212 +#: ../../library/codecs.rst:1213 msgid "iso8859_2" msgstr "iso8859_2" -#: ../../library/codecs.rst:1212 +#: ../../library/codecs.rst:1213 msgid "iso-8859-2, latin2, L2" msgstr "iso-8859-2, latin2, L2" -#: ../../library/codecs.rst:1214 +#: ../../library/codecs.rst:1215 msgid "iso8859_3" msgstr "iso8859_3" -#: ../../library/codecs.rst:1214 +#: ../../library/codecs.rst:1215 msgid "iso-8859-3, latin3, L3" msgstr "iso-8859-3, latin3, L3" -#: ../../library/codecs.rst:1214 +#: ../../library/codecs.rst:1215 msgid "Esperanto, Maltese" msgstr "" -#: ../../library/codecs.rst:1216 +#: ../../library/codecs.rst:1217 msgid "iso8859_4" msgstr "iso8859_4" -#: ../../library/codecs.rst:1216 +#: ../../library/codecs.rst:1217 msgid "iso-8859-4, latin4, L4" msgstr "iso-8859-4, latin4, L4" -#: ../../library/codecs.rst:1218 +#: ../../library/codecs.rst:1219 msgid "iso8859_5" msgstr "iso8859_5" -#: ../../library/codecs.rst:1218 +#: ../../library/codecs.rst:1219 msgid "iso-8859-5, cyrillic" msgstr "iso-8859-5, cyrillic" -#: ../../library/codecs.rst:1221 +#: ../../library/codecs.rst:1222 msgid "iso8859_6" msgstr "iso8859_6" -#: ../../library/codecs.rst:1221 +#: ../../library/codecs.rst:1222 msgid "iso-8859-6, arabic" msgstr "iso-8859-6, arabic" -#: ../../library/codecs.rst:1223 +#: ../../library/codecs.rst:1224 msgid "iso8859_7" msgstr "iso8859_7" -#: ../../library/codecs.rst:1223 +#: ../../library/codecs.rst:1224 msgid "iso-8859-7, greek, greek8" msgstr "iso-8859-7, greek, greek8" -#: ../../library/codecs.rst:1225 +#: ../../library/codecs.rst:1226 msgid "iso8859_8" msgstr "iso8859_8" -#: ../../library/codecs.rst:1225 +#: ../../library/codecs.rst:1226 msgid "iso-8859-8, hebrew" msgstr "iso-8859-8, hebrew" -#: ../../library/codecs.rst:1227 +#: ../../library/codecs.rst:1228 msgid "iso8859_9" msgstr "iso8859_9" -#: ../../library/codecs.rst:1227 +#: ../../library/codecs.rst:1228 msgid "iso-8859-9, latin5, L5" msgstr "iso-8859-9, latin5, L5" -#: ../../library/codecs.rst:1229 +#: ../../library/codecs.rst:1230 msgid "iso8859_10" msgstr "iso8859_10" -#: ../../library/codecs.rst:1229 +#: ../../library/codecs.rst:1230 msgid "iso-8859-10, latin6, L6" msgstr "iso-8859-10, latin6, L6" -#: ../../library/codecs.rst:1229 +#: ../../library/codecs.rst:1230 msgid "Nordic languages" msgstr "" -#: ../../library/codecs.rst:1231 +#: ../../library/codecs.rst:1232 msgid "iso8859_11" msgstr "iso8859_11" -#: ../../library/codecs.rst:1231 +#: ../../library/codecs.rst:1232 msgid "iso-8859-11, thai" msgstr "iso-8859-11, thai" -#: ../../library/codecs.rst:1231 +#: ../../library/codecs.rst:1232 msgid "Thai languages" msgstr "" -#: ../../library/codecs.rst:1233 +#: ../../library/codecs.rst:1234 msgid "iso8859_13" msgstr "iso8859_13" -#: ../../library/codecs.rst:1233 +#: ../../library/codecs.rst:1234 msgid "iso-8859-13, latin7, L7" msgstr "iso-8859-13, latin7, L7" -#: ../../library/codecs.rst:1235 +#: ../../library/codecs.rst:1236 msgid "iso8859_14" msgstr "iso8859_14" -#: ../../library/codecs.rst:1235 +#: ../../library/codecs.rst:1236 msgid "iso-8859-14, latin8, L8" msgstr "iso-8859-14, latin8, L8" -#: ../../library/codecs.rst:1235 +#: ../../library/codecs.rst:1236 msgid "Celtic languages" msgstr "" -#: ../../library/codecs.rst:1237 +#: ../../library/codecs.rst:1238 msgid "iso8859_15" msgstr "iso8859_15" -#: ../../library/codecs.rst:1237 +#: ../../library/codecs.rst:1238 msgid "iso-8859-15, latin9, L9" msgstr "iso-8859-15, latin9, L9" -#: ../../library/codecs.rst:1239 +#: ../../library/codecs.rst:1240 msgid "iso8859_16" msgstr "iso8859_16" -#: ../../library/codecs.rst:1239 +#: ../../library/codecs.rst:1240 msgid "iso-8859-16, latin10, L10" msgstr "iso-8859-16, latin10, L10" -#: ../../library/codecs.rst:1239 +#: ../../library/codecs.rst:1240 msgid "South-Eastern Europe" msgstr "" -#: ../../library/codecs.rst:1241 +#: ../../library/codecs.rst:1242 msgid "johab" msgstr "" -#: ../../library/codecs.rst:1241 +#: ../../library/codecs.rst:1242 msgid "cp1361, ms1361" msgstr "cp1361, ms1361" -#: ../../library/codecs.rst:1243 +#: ../../library/codecs.rst:1244 msgid "koi8_r" msgstr "koi8_r" -#: ../../library/codecs.rst:1245 +#: ../../library/codecs.rst:1246 msgid "koi8_t" msgstr "koi8_t" -#: ../../library/codecs.rst:1245 +#: ../../library/codecs.rst:1246 msgid "Tajik" msgstr "" -#: ../../library/codecs.rst:1249 +#: ../../library/codecs.rst:1250 msgid "koi8_u" msgstr "koi8_u" -#: ../../library/codecs.rst:1251 +#: ../../library/codecs.rst:1252 msgid "kz1048" msgstr "kz1048" -#: ../../library/codecs.rst:1251 +#: ../../library/codecs.rst:1252 msgid "kz_1048, strk1048_2002, rk1048" msgstr "kz_1048, strk1048_2002, rk1048" -#: ../../library/codecs.rst:1251 ../../library/codecs.rst:1269 +#: ../../library/codecs.rst:1252 ../../library/codecs.rst:1270 msgid "Kazakh" msgstr "" -#: ../../library/codecs.rst:1255 +#: ../../library/codecs.rst:1256 msgid "mac_cyrillic" msgstr "mac_cyrillic" -#: ../../library/codecs.rst:1255 +#: ../../library/codecs.rst:1256 msgid "maccyrillic" msgstr "" -#: ../../library/codecs.rst:1258 +#: ../../library/codecs.rst:1259 msgid "mac_greek" msgstr "mac_greek" -#: ../../library/codecs.rst:1258 +#: ../../library/codecs.rst:1259 msgid "macgreek" msgstr "" -#: ../../library/codecs.rst:1260 +#: ../../library/codecs.rst:1261 msgid "mac_iceland" msgstr "mac_iceland" -#: ../../library/codecs.rst:1260 +#: ../../library/codecs.rst:1261 msgid "maciceland" msgstr "" -#: ../../library/codecs.rst:1262 +#: ../../library/codecs.rst:1263 msgid "mac_latin2" msgstr "mac_latin2" -#: ../../library/codecs.rst:1262 +#: ../../library/codecs.rst:1263 msgid "maclatin2, maccentraleurope, mac_centeuro" msgstr "maclatin2, maccentraleurope, mac_centeuro" -#: ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1266 msgid "mac_roman" msgstr "mac_roman" -#: ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1266 msgid "macroman, macintosh" msgstr "macroman, macintosh" -#: ../../library/codecs.rst:1267 +#: ../../library/codecs.rst:1268 msgid "mac_turkish" msgstr "mac_turkish" -#: ../../library/codecs.rst:1267 +#: ../../library/codecs.rst:1268 msgid "macturkish" msgstr "" -#: ../../library/codecs.rst:1269 +#: ../../library/codecs.rst:1270 msgid "ptcp154" msgstr "ptcp154" -#: ../../library/codecs.rst:1269 +#: ../../library/codecs.rst:1270 msgid "csptcp154, pt154, cp154, cyrillic-asian" msgstr "csptcp154, pt154, cp154, cyrillic-asian" -#: ../../library/codecs.rst:1272 +#: ../../library/codecs.rst:1273 msgid "shift_jis" msgstr "shift_jis" -#: ../../library/codecs.rst:1272 +#: ../../library/codecs.rst:1273 msgid "csshiftjis, shiftjis, sjis, s_jis" msgstr "csshiftjis, shiftjis, sjis, s_jis" -#: ../../library/codecs.rst:1275 +#: ../../library/codecs.rst:1276 msgid "shift_jis_2004" msgstr "shift_jis_2004" -#: ../../library/codecs.rst:1275 +#: ../../library/codecs.rst:1276 msgid "shiftjis2004, sjis_2004, sjis2004" msgstr "shiftjis2004, sjis_2004, sjis2004" -#: ../../library/codecs.rst:1278 +#: ../../library/codecs.rst:1279 msgid "shift_jisx0213" msgstr "shift_jisx0213" -#: ../../library/codecs.rst:1278 +#: ../../library/codecs.rst:1279 msgid "shiftjisx0213, sjisx0213, s_jisx0213" msgstr "shiftjisx0213, sjisx0213, s_jisx0213" -#: ../../library/codecs.rst:1281 +#: ../../library/codecs.rst:1282 msgid "utf_32" msgstr "utf_32" -#: ../../library/codecs.rst:1281 +#: ../../library/codecs.rst:1282 msgid "U32, utf32" msgstr "U32, utf32" -#: ../../library/codecs.rst:1281 ../../library/codecs.rst:1283 -#: ../../library/codecs.rst:1285 ../../library/codecs.rst:1287 -#: ../../library/codecs.rst:1289 ../../library/codecs.rst:1291 -#: ../../library/codecs.rst:1293 ../../library/codecs.rst:1295 -#: ../../library/codecs.rst:1297 +#: ../../library/codecs.rst:1282 ../../library/codecs.rst:1284 +#: ../../library/codecs.rst:1286 ../../library/codecs.rst:1288 +#: ../../library/codecs.rst:1290 ../../library/codecs.rst:1292 +#: ../../library/codecs.rst:1294 ../../library/codecs.rst:1296 +#: ../../library/codecs.rst:1298 msgid "all languages" msgstr "" -#: ../../library/codecs.rst:1283 +#: ../../library/codecs.rst:1284 msgid "utf_32_be" msgstr "utf_32_be" -#: ../../library/codecs.rst:1283 +#: ../../library/codecs.rst:1284 msgid "UTF-32BE" msgstr "UTF-32BE" -#: ../../library/codecs.rst:1285 +#: ../../library/codecs.rst:1286 msgid "utf_32_le" msgstr "utf_32_le" -#: ../../library/codecs.rst:1285 +#: ../../library/codecs.rst:1286 msgid "UTF-32LE" msgstr "UTF-32LE" -#: ../../library/codecs.rst:1287 +#: ../../library/codecs.rst:1288 msgid "utf_16" msgstr "utf_16" -#: ../../library/codecs.rst:1287 +#: ../../library/codecs.rst:1288 msgid "U16, utf16" msgstr "U16, utf16" -#: ../../library/codecs.rst:1289 +#: ../../library/codecs.rst:1290 msgid "utf_16_be" msgstr "utf_16_be" -#: ../../library/codecs.rst:1289 +#: ../../library/codecs.rst:1290 msgid "UTF-16BE" msgstr "UTF-16BE" -#: ../../library/codecs.rst:1291 +#: ../../library/codecs.rst:1292 msgid "utf_16_le" msgstr "utf_16_le" -#: ../../library/codecs.rst:1291 +#: ../../library/codecs.rst:1292 msgid "UTF-16LE" msgstr "UTF-16LE" -#: ../../library/codecs.rst:1293 +#: ../../library/codecs.rst:1294 msgid "utf_7" msgstr "utf_7" -#: ../../library/codecs.rst:1293 +#: ../../library/codecs.rst:1294 msgid "U7, unicode-1-1-utf-7" msgstr "U7, unicode-1-1-utf-7" -#: ../../library/codecs.rst:1295 +#: ../../library/codecs.rst:1296 msgid "utf_8" msgstr "utf_8" -#: ../../library/codecs.rst:1295 +#: ../../library/codecs.rst:1296 msgid "U8, UTF, utf8, cp65001" msgstr "U8, UTF, utf8, cp65001" -#: ../../library/codecs.rst:1297 +#: ../../library/codecs.rst:1298 msgid "utf_8_sig" msgstr "utf_8_sig" -#: ../../library/codecs.rst:1300 +#: ../../library/codecs.rst:1301 msgid "" "The utf-16\\* and utf-32\\* encoders no longer allow surrogate code points " "(``U+D800``--``U+DFFF``) to be encoded. The utf-32\\* decoders no longer " "decode byte sequences that correspond to surrogate code points." msgstr "" -#: ../../library/codecs.rst:1306 +#: ../../library/codecs.rst:1307 msgid "``cp65001`` is now an alias to ``utf_8``." msgstr "" -#: ../../library/codecs.rst:1311 +#: ../../library/codecs.rst:1312 msgid "Python Specific Encodings" msgstr "" -#: ../../library/codecs.rst:1313 +#: ../../library/codecs.rst:1314 msgid "" "A number of predefined codecs are specific to Python, so their codec names " "have no meaning outside Python. These are listed in the tables below based " @@ -2305,274 +2306,268 @@ msgid "" "asymmetric codecs, the stated meaning describes the encoding direction." msgstr "" -#: ../../library/codecs.rst:1321 +#: ../../library/codecs.rst:1322 msgid "Text Encodings" msgstr "" -#: ../../library/codecs.rst:1323 +#: ../../library/codecs.rst:1324 msgid "" "The following codecs provide :class:`str` to :class:`bytes` encoding and :" "term:`bytes-like object` to :class:`str` decoding, similar to the Unicode " "text encodings." msgstr "" -#: ../../library/codecs.rst:1332 +#: ../../library/codecs.rst:1333 msgid "idna" msgstr "idna" -#: ../../library/codecs.rst:1332 +#: ../../library/codecs.rst:1333 msgid "" "Implement :rfc:`3490`, see also :mod:`encodings.idna`. Only " "``errors='strict'`` is supported." msgstr "" -#: ../../library/codecs.rst:1338 +#: ../../library/codecs.rst:1339 msgid "mbcs" msgstr "mbcs" -#: ../../library/codecs.rst:1338 +#: ../../library/codecs.rst:1339 msgid "ansi, dbcs" msgstr "ansi, dbcs" -#: ../../library/codecs.rst:1338 +#: ../../library/codecs.rst:1339 msgid "" "Windows only: Encode the operand according to the ANSI codepage (CP_ACP)." msgstr "" -#: ../../library/codecs.rst:1342 +#: ../../library/codecs.rst:1343 msgid "oem" msgstr "oem" -#: ../../library/codecs.rst:1342 +#: ../../library/codecs.rst:1343 msgid "" "Windows only: Encode the operand according to the OEM codepage (CP_OEMCP)." msgstr "" -#: ../../library/codecs.rst:1348 +#: ../../library/codecs.rst:1349 msgid "palmos" msgstr "" -#: ../../library/codecs.rst:1348 +#: ../../library/codecs.rst:1349 msgid "Encoding of PalmOS 3.5." msgstr "" -#: ../../library/codecs.rst:1350 +#: ../../library/codecs.rst:1351 msgid "punycode" msgstr "" -#: ../../library/codecs.rst:1350 +#: ../../library/codecs.rst:1351 msgid "Implement :rfc:`3492`. Stateful codecs are not supported." msgstr "" -#: ../../library/codecs.rst:1354 +#: ../../library/codecs.rst:1355 msgid "raw_unicode_escape" msgstr "raw_unicode_escape" -#: ../../library/codecs.rst:1354 +#: ../../library/codecs.rst:1355 msgid "" "Latin-1 encoding with :samp:`\\\\u{XXXX}` and :samp:`\\\\U{XXXXXXXX}` for " "other code points. Existing backslashes are not escaped in any way. It is " "used in the Python pickle protocol." msgstr "" -#: ../../library/codecs.rst:1364 +#: ../../library/codecs.rst:1365 msgid "undefined" msgstr "" -#: ../../library/codecs.rst:1364 +#: ../../library/codecs.rst:1365 msgid "" "Raise an exception for all conversions, even empty strings. The error " "handler is ignored." msgstr "" -#: ../../library/codecs.rst:1369 +#: ../../library/codecs.rst:1370 msgid "unicode_escape" msgstr "unicode_escape" -#: ../../library/codecs.rst:1369 +#: ../../library/codecs.rst:1370 msgid "" "Encoding suitable as the contents of a Unicode literal in ASCII-encoded " "Python source code, except that quotes are not escaped. Decode from Latin-1 " "source code. Beware that Python source code actually uses UTF-8 by default." msgstr "" -#: ../../library/codecs.rst:1381 +#: ../../library/codecs.rst:1382 msgid "\"unicode_internal\" codec is removed." msgstr "" -#: ../../library/codecs.rst:1388 +#: ../../library/codecs.rst:1389 msgid "Binary Transforms" msgstr "" -#: ../../library/codecs.rst:1390 +#: ../../library/codecs.rst:1391 msgid "" "The following codecs provide binary transforms: :term:`bytes-like object` " "to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode` " "(which only produces :class:`str` output)." msgstr "" -#: ../../library/codecs.rst:1398 +#: ../../library/codecs.rst:1399 msgid "Encoder / decoder" msgstr "" -#: ../../library/codecs.rst:1400 +#: ../../library/codecs.rst:1401 msgid "base64_codec [#b64]_" msgstr "base64_codec [#b64]_" -#: ../../library/codecs.rst:1400 +#: ../../library/codecs.rst:1401 msgid "base64, base_64" msgstr "base64, base_64" -#: ../../library/codecs.rst:1400 +#: ../../library/codecs.rst:1401 msgid "" "Convert the operand to multiline MIME base64 (the result always includes a " "trailing ``'\\n'``)." msgstr "" -#: ../../library/codecs.rst:1405 +#: ../../library/codecs.rst:1406 msgid "" "accepts any :term:`bytes-like object` as input for encoding and decoding" msgstr "" -#: ../../library/codecs.rst:1400 +#: ../../library/codecs.rst:1401 msgid ":meth:`base64.encodebytes` / :meth:`base64.decodebytes`" msgstr ":meth:`base64.encodebytes` / :meth:`base64.decodebytes`" -#: ../../library/codecs.rst:1411 +#: ../../library/codecs.rst:1412 msgid "bz2_codec" msgstr "bz2_codec" -#: ../../library/codecs.rst:1411 +#: ../../library/codecs.rst:1412 msgid "bz2" msgstr "bz2" -#: ../../library/codecs.rst:1411 +#: ../../library/codecs.rst:1412 msgid "Compress the operand using bz2." msgstr "" -#: ../../library/codecs.rst:1411 +#: ../../library/codecs.rst:1412 msgid ":meth:`bz2.compress` / :meth:`bz2.decompress`" msgstr ":meth:`bz2.compress` / :meth:`bz2.decompress`" -#: ../../library/codecs.rst:1414 +#: ../../library/codecs.rst:1415 msgid "hex_codec" msgstr "hex_codec" -#: ../../library/codecs.rst:1414 +#: ../../library/codecs.rst:1415 msgid "hex" msgstr "hex" -#: ../../library/codecs.rst:1414 +#: ../../library/codecs.rst:1415 msgid "" "Convert the operand to hexadecimal representation, with two digits per byte." msgstr "" -#: ../../library/codecs.rst:1414 +#: ../../library/codecs.rst:1415 msgid ":meth:`binascii.b2a_hex` / :meth:`binascii.a2b_hex`" msgstr ":meth:`binascii.b2a_hex` / :meth:`binascii.a2b_hex`" -#: ../../library/codecs.rst:1419 +#: ../../library/codecs.rst:1420 msgid "quopri_codec" msgstr "quopri_codec" -#: ../../library/codecs.rst:1419 +#: ../../library/codecs.rst:1420 msgid "quopri, quotedprintable, quoted_printable" msgstr "quopri, quotedprintable, quoted_printable" -#: ../../library/codecs.rst:1419 +#: ../../library/codecs.rst:1420 msgid "Convert the operand to MIME quoted printable." msgstr "" -#: ../../library/codecs.rst:1419 +#: ../../library/codecs.rst:1420 msgid ":meth:`quopri.encode` with ``quotetabs=True`` / :meth:`quopri.decode`" msgstr ":meth:`quopri.encode` with ``quotetabs=True`` / :meth:`quopri.decode`" -#: ../../library/codecs.rst:1423 +#: ../../library/codecs.rst:1424 msgid "uu_codec" msgstr "uu_codec" -#: ../../library/codecs.rst:1423 +#: ../../library/codecs.rst:1424 msgid "uu" msgstr "uu" -#: ../../library/codecs.rst:1423 +#: ../../library/codecs.rst:1424 msgid "Convert the operand using uuencode." msgstr "" -#: ../../library/codecs.rst:1423 -#, fuzzy -msgid "" -":meth:`!uu.encode` / :meth:`!uu.decode` (Note: :mod:`uu` is deprecated.)" -msgstr ":meth:`uu.encode` / :meth:`uu.decode`" - -#: ../../library/codecs.rst:1428 +#: ../../library/codecs.rst:1427 msgid "zlib_codec" msgstr "zlib_codec" -#: ../../library/codecs.rst:1428 +#: ../../library/codecs.rst:1427 msgid "zip, zlib" msgstr "zip, zlib" -#: ../../library/codecs.rst:1428 +#: ../../library/codecs.rst:1427 msgid "Compress the operand using gzip." msgstr "" -#: ../../library/codecs.rst:1428 +#: ../../library/codecs.rst:1427 msgid ":meth:`zlib.compress` / :meth:`zlib.decompress`" msgstr ":meth:`zlib.compress` / :meth:`zlib.decompress`" -#: ../../library/codecs.rst:1432 +#: ../../library/codecs.rst:1431 msgid "" "In addition to :term:`bytes-like objects `, " "``'base64_codec'`` also accepts ASCII-only instances of :class:`str` for " "decoding" msgstr "" -#: ../../library/codecs.rst:1436 +#: ../../library/codecs.rst:1435 msgid "Restoration of the binary transforms." msgstr "" -#: ../../library/codecs.rst:1439 +#: ../../library/codecs.rst:1438 msgid "Restoration of the aliases for the binary transforms." msgstr "" -#: ../../library/codecs.rst:1446 +#: ../../library/codecs.rst:1445 msgid "Text Transforms" msgstr "" -#: ../../library/codecs.rst:1448 +#: ../../library/codecs.rst:1447 msgid "" "The following codec provides a text transform: a :class:`str` to :class:" "`str` mapping. It is not supported by :meth:`str.encode` (which only " "produces :class:`bytes` output)." msgstr "" -#: ../../library/codecs.rst:1457 +#: ../../library/codecs.rst:1456 msgid "rot_13" msgstr "rot_13" -#: ../../library/codecs.rst:1457 +#: ../../library/codecs.rst:1456 msgid "rot13" msgstr "" -#: ../../library/codecs.rst:1457 +#: ../../library/codecs.rst:1456 msgid "Return the Caesar-cypher encryption of the operand." msgstr "" -#: ../../library/codecs.rst:1462 +#: ../../library/codecs.rst:1461 msgid "Restoration of the ``rot_13`` text transform." msgstr "" -#: ../../library/codecs.rst:1465 +#: ../../library/codecs.rst:1464 msgid "Restoration of the ``rot13`` alias." msgstr "" -#: ../../library/codecs.rst:1470 +#: ../../library/codecs.rst:1469 msgid "" ":mod:`encodings.idna` --- Internationalized Domain Names in Applications" msgstr "" -#: ../../library/codecs.rst:1476 +#: ../../library/codecs.rst:1475 msgid "" "This module implements :rfc:`3490` (Internationalized Domain Names in " "Applications) and :rfc:`3492` (Nameprep: A Stringprep Profile for " @@ -2580,13 +2575,13 @@ msgid "" "encoding and :mod:`stringprep`." msgstr "" -#: ../../library/codecs.rst:1481 +#: ../../library/codecs.rst:1480 msgid "" "If you need the IDNA 2008 standard from :rfc:`5891` and :rfc:`5895`, use the " "third-party :pypi:`idna` module." msgstr "" -#: ../../library/codecs.rst:1484 +#: ../../library/codecs.rst:1483 msgid "" "These RFCs together define a protocol to support non-ASCII characters in " "domain names. A domain name containing non-ASCII characters (such as ``www." @@ -2600,7 +2595,7 @@ msgid "" "presenting them to the user." msgstr "" -#: ../../library/codecs.rst:1495 +#: ../../library/codecs.rst:1494 msgid "" "Python supports this conversion in several ways: the ``idna`` codec " "performs conversion between Unicode and ACE, separating an input string into " @@ -2617,14 +2612,14 @@ msgid "" "sends that field at all)." msgstr "" -#: ../../library/codecs.rst:1508 +#: ../../library/codecs.rst:1507 msgid "" "When receiving host names from the wire (such as in reverse name lookup), no " "automatic conversion to Unicode is performed: applications wishing to " "present such host names to the user should decode them to Unicode." msgstr "" -#: ../../library/codecs.rst:1512 +#: ../../library/codecs.rst:1511 msgid "" "The module :mod:`encodings.idna` also implements the nameprep procedure, " "which performs certain normalizations on host names, to achieve case-" @@ -2632,49 +2627,49 @@ msgid "" "characters. The nameprep functions can be used directly if desired." msgstr "" -#: ../../library/codecs.rst:1520 +#: ../../library/codecs.rst:1519 msgid "" "Return the nameprepped version of *label*. The implementation currently " "assumes query strings, so ``AllowUnassigned`` is true." msgstr "" -#: ../../library/codecs.rst:1526 +#: ../../library/codecs.rst:1525 msgid "" "Convert a label to ASCII, as specified in :rfc:`3490`. ``UseSTD3ASCIIRules`` " "is assumed to be false." msgstr "" -#: ../../library/codecs.rst:1532 +#: ../../library/codecs.rst:1531 msgid "Convert a label to Unicode, as specified in :rfc:`3490`." msgstr "" -#: ../../library/codecs.rst:1536 +#: ../../library/codecs.rst:1535 msgid ":mod:`encodings.mbcs` --- Windows ANSI codepage" msgstr "" -#: ../../library/codecs.rst:1541 +#: ../../library/codecs.rst:1540 msgid "This module implements the ANSI codepage (CP_ACP)." msgstr "" -#: ../../library/codecs.rst:1543 +#: ../../library/codecs.rst:1542 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/codecs.rst:1545 +#: ../../library/codecs.rst:1544 msgid "" "Before 3.2, the *errors* argument was ignored; ``'replace'`` was always used " "to encode, and ``'ignore'`` to decode." msgstr "" -#: ../../library/codecs.rst:1549 +#: ../../library/codecs.rst:1548 msgid "Support any error handler." msgstr "" -#: ../../library/codecs.rst:1554 +#: ../../library/codecs.rst:1553 msgid ":mod:`encodings.utf_8_sig` --- UTF-8 codec with BOM signature" msgstr "" -#: ../../library/codecs.rst:1560 +#: ../../library/codecs.rst:1559 msgid "" "This module implements a variant of the UTF-8 codec. On encoding, a UTF-8 " "encoded BOM will be prepended to the UTF-8 encoded bytes. For the stateful " @@ -2771,3 +2766,8 @@ msgstr "\\N" #: ../../library/codecs.rst:387 msgid "surrogatepass" msgstr "surrogatepass" + +#, fuzzy +#~ msgid "" +#~ ":meth:`!uu.encode` / :meth:`!uu.decode` (Note: :mod:`uu` is deprecated.)" +#~ msgstr ":meth:`uu.encode` / :meth:`uu.decode`" diff --git a/library/collections.po b/library/collections.po index a10d9492cf..28d2d79ade 100644 --- a/library/collections.po +++ b/library/collections.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-01-22 21:42+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -612,7 +612,7 @@ msgid "" "list(c) # list unique elements\n" "set(c) # convert to a set\n" "dict(c) # convert to a regular dictionary\n" -"c.items() # convert to a list of (elem, cnt) pairs\n" +"c.items() # access the (elem, cnt) pairs\n" "Counter(dict(list_of_pairs)) # convert from a list of (elem, cnt) pairs\n" "c.most_common()[:-n-1:-1] # n least common elements\n" "+c # remove zero and negative counts" @@ -1207,7 +1207,7 @@ msgstr "" "此屬性為 :meth:`__missing__` 方法所使用。如果有引數被傳入建構函式,則此屬性會" "被初始化成第一個引數,如未提供引數則被初始化為 ``None``。" -#: ../../library/collections.rst:765 ../../library/collections.rst:1182 +#: ../../library/collections.rst:765 ../../library/collections.rst:1188 msgid "" "Added merge (``|``) and update (``|=``) operators, specified in :pep:`584`." msgstr "新增合併 (``|``) 和更新 (``|=``) 運算子,請見 :pep:`584`。" @@ -1539,15 +1539,26 @@ msgstr "" "... inventory[partnum] = record._replace(price=newprices[partnum], " "timestamp=time.now())" +#: ../../library/collections.rst:982 +msgid "" +"Named tuples are also supported by generic function :func:`copy.replace`." +msgstr "" + #: ../../library/collections.rst:984 msgid "" +"Raise :exc:`TypeError` instead of :exc:`ValueError` for invalid keyword " +"arguments." +msgstr "" + +#: ../../library/collections.rst:990 +msgid "" "Tuple of strings listing the field names. Useful for introspection and for " "creating new named tuple types from existing named tuples." msgstr "" "列出 tuple 欄位名稱的字串,用於自我檢查或是從現有 named tuple 建立一個新的 " "named tuple 型別。" -#: ../../library/collections.rst:987 +#: ../../library/collections.rst:993 msgid "" ">>> p._fields # view the field names\n" "('x', 'y')\n" @@ -1558,11 +1569,11 @@ msgid "" "Pixel(x=11, y=22, red=128, green=255, blue=0)" msgstr "" -#: ../../library/collections.rst:999 +#: ../../library/collections.rst:1005 msgid "Dictionary mapping field names to default values." msgstr "將欄位名稱對映至預設值的字典。" -#: ../../library/collections.rst:1001 +#: ../../library/collections.rst:1007 msgid "" ">>> Account = namedtuple('Account', ['type', 'balance'], defaults=[0])\n" ">>> Account._field_defaults\n" @@ -1576,13 +1587,13 @@ msgstr "" ">>> Account('premium')\n" "Account(type='premium', balance=0)" -#: ../../library/collections.rst:1009 +#: ../../library/collections.rst:1015 msgid "" "To retrieve a field whose name is stored in a string, use the :func:" "`getattr` function:" msgstr "要取得這個名稱存於字串的欄位,要使用 :func:`getattr` 函式:" -#: ../../library/collections.rst:1015 +#: ../../library/collections.rst:1021 msgid "" "To convert a dictionary to a named tuple, use the double-star-operator (as " "described in :ref:`tut-unpacking-arguments`):" @@ -1590,7 +1601,7 @@ msgstr "" "(如\\ :ref:`tut-unpacking-arguments`\\ 所述)將一個字典轉換成 named tuple," "要使用 \\*\\* 雙星號運算子:" -#: ../../library/collections.rst:1022 +#: ../../library/collections.rst:1028 msgid "" "Since a named tuple is a regular Python class, it is easy to add or change " "functionality with a subclass. Here is how to add a calculated field and a " @@ -1599,7 +1610,7 @@ msgstr "" "因為一個 named tuple 是一個常規的 Python 類別,我們可以很容易的透過子類別來新" "增或更改功能,以下是如何新增一個計算得到的欄位和固定寬度的輸出列印格式:" -#: ../../library/collections.rst:1026 +#: ../../library/collections.rst:1032 msgid "" ">>> class Point(namedtuple('Point', ['x', 'y'])):\n" "... __slots__ = ()\n" @@ -1629,7 +1640,7 @@ msgstr "" "Point: x= 3.000 y= 4.000 hypot= 5.000\n" "Point: x=14.000 y= 0.714 hypot=14.018" -#: ../../library/collections.rst:1041 +#: ../../library/collections.rst:1047 msgid "" "The subclass shown above sets ``__slots__`` to an empty tuple. This helps " "keep memory requirements low by preventing the creation of instance " @@ -1638,7 +1649,7 @@ msgstr "" "上面的子類別將 ``__slots__`` 設定為空 tuple,這樣一來就防止了字典實例被建立," "因而保持了較低的記憶體用量。" -#: ../../library/collections.rst:1044 +#: ../../library/collections.rst:1050 msgid "" "Subclassing is not useful for adding new, stored fields. Instead, simply " "create a new named tuple type from the :attr:`~somenamedtuple._fields` " @@ -1647,17 +1658,17 @@ msgstr "" "子類別化無法用於增加新的、已被儲存的欄位,應當透過 :attr:`~somenamedtuple." "_fields` 屬性以建立一個新的 named tuple 來實現:" -#: ../../library/collections.rst:1049 +#: ../../library/collections.rst:1055 msgid "" "Docstrings can be customized by making direct assignments to the ``__doc__`` " "fields:" msgstr "透過直接賦值給 ``__doc__``,可以自訂說明文件字串:" -#: ../../library/collections.rst:1058 +#: ../../library/collections.rst:1064 msgid "Property docstrings became writeable." msgstr "文件字串屬性變成可寫入。" -#: ../../library/collections.rst:1063 +#: ../../library/collections.rst:1069 msgid "" "See :class:`typing.NamedTuple` for a way to add type hints for named " "tuples. It also provides an elegant notation using the :keyword:`class` " @@ -1666,7 +1677,7 @@ msgstr "" "關於為 named tuple 新增型別提示的方法,請參閱 :class:`typing.NamedTuple`,它" "運用 :keyword:`class` 關鍵字以提供了一個簡潔的表示法: ::" -#: ../../library/collections.rst:1067 +#: ../../library/collections.rst:1073 msgid "" "class Component(NamedTuple):\n" " part_number: int\n" @@ -1678,7 +1689,7 @@ msgstr "" " weight: float\n" " description: Optional[str] = None" -#: ../../library/collections.rst:1072 +#: ../../library/collections.rst:1078 msgid "" "See :meth:`types.SimpleNamespace` for a mutable namespace based on an " "underlying dictionary instead of a tuple." @@ -1686,7 +1697,7 @@ msgstr "" "關於以 dict 而非 tuple 為底層的可變命名空間,請參考 :meth:`types." "SimpleNamespace`。" -#: ../../library/collections.rst:1075 +#: ../../library/collections.rst:1081 msgid "" "The :mod:`dataclasses` module provides a decorator and functions for " "automatically adding generated special methods to user-defined classes." @@ -1694,11 +1705,11 @@ msgstr "" ":mod:`dataclasses` 模組提供了一個裝飾器和一些函式,用於自動將被生成的特殊方法" "新增到使用者定義的類別中。" -#: ../../library/collections.rst:1080 +#: ../../library/collections.rst:1086 msgid ":class:`OrderedDict` objects" msgstr ":class:`OrderedDict` 物件" -#: ../../library/collections.rst:1082 +#: ../../library/collections.rst:1088 msgid "" "Ordered dictionaries are just like regular dictionaries but have some extra " "capabilities relating to ordering operations. They have become less " @@ -1709,11 +1720,11 @@ msgstr "" "功能,但由於內建的 :class:`dict` 類別現在已經有記憶插入順序的能力(Python " "3.7 中確保了這種新行為),它們變得不那麼重要了。" -#: ../../library/collections.rst:1088 +#: ../../library/collections.rst:1094 msgid "Some differences from :class:`dict` still remain:" msgstr "仍存在一些與 :class:`dict` 的不同之處:" -#: ../../library/collections.rst:1090 +#: ../../library/collections.rst:1096 msgid "" "The regular :class:`dict` was designed to be very good at mapping " "operations. Tracking insertion order was secondary." @@ -1721,7 +1732,7 @@ msgstr "" "常規的 :class:`dict` 被設計成非常擅長於對映相關操作,追蹤插入的順序為次要目" "標。" -#: ../../library/collections.rst:1093 +#: ../../library/collections.rst:1099 msgid "" "The :class:`OrderedDict` was designed to be good at reordering operations. " "Space efficiency, iteration speed, and the performance of update operations " @@ -1730,7 +1741,7 @@ msgstr "" ":class:`OrderedDict` 則被設計成擅長於重新排序相關的操作,空間效率、疊代速度和" "更新操作的效能則為次要設計目標。" -#: ../../library/collections.rst:1097 +#: ../../library/collections.rst:1103 msgid "" "The :class:`OrderedDict` algorithm can handle frequent reordering operations " "better than :class:`dict`. As shown in the recipes below, this makes it " @@ -1739,12 +1750,12 @@ msgstr "" ":class:`OrderedDict` 比起 :class:`dict` 更適合處理頻繁的重新排序操作,如在下" "方用法中所示,這讓它適合用於多種 LRU cache 的實作中。" -#: ../../library/collections.rst:1101 +#: ../../library/collections.rst:1107 msgid "" "The equality operation for :class:`OrderedDict` checks for matching order." msgstr ":class:`OrderedDict` 之相等性運算會檢查順序是否相同。" -#: ../../library/collections.rst:1103 +#: ../../library/collections.rst:1109 msgid "" "A regular :class:`dict` can emulate the order sensitive equality test with " "``p == q and all(k1 == k2 for k1, k2 in zip(p, q))``." @@ -1752,7 +1763,7 @@ msgstr "" "一個一般的 :class:`dict` 可以用 ``p == q and all(k1 == k2 for k1, k2 in " "zip(p, q))`` 來效仿有檢查順序的相等性運算。" -#: ../../library/collections.rst:1106 +#: ../../library/collections.rst:1112 msgid "" "The :meth:`popitem` method of :class:`OrderedDict` has a different " "signature. It accepts an optional argument to specify which item is popped." @@ -1760,7 +1771,7 @@ msgstr "" ":class:`OrderedDict` 類別的 :meth:`popitem` 方法有不同的函式簽名 " "(signature),它接受傳入一個選擇性引數來指定要移除哪個元素。" -#: ../../library/collections.rst:1109 +#: ../../library/collections.rst:1115 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=True)`` " "with ``d.popitem()`` which is guaranteed to pop the rightmost (last) item." @@ -1768,7 +1779,7 @@ msgstr "" "一個一般的 :class:`dict` 可以用 ``d.popitem()`` 來效仿 OrderedDict 的 ``od." "popitem(last=True)``,這保證會移除最右邊(最後一個)的元素。" -#: ../../library/collections.rst:1112 +#: ../../library/collections.rst:1118 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=False)`` " "with ``(k := next(iter(d)), d.pop(k))`` which will return and remove the " @@ -1778,7 +1789,7 @@ msgstr "" "OrderedDict 的 ``od.popitem(last=False)``,若最左邊(第一個)的元素存在,則將" "其回傳並移除。" -#: ../../library/collections.rst:1116 +#: ../../library/collections.rst:1122 msgid "" ":class:`OrderedDict` has a :meth:`move_to_end` method to efficiently " "reposition an element to an endpoint." @@ -1786,7 +1797,7 @@ msgstr "" ":class:`OrderedDict` 有個 :meth:`move_to_end` 方法可有效率地將一個元素重新排" "列到任一端。" -#: ../../library/collections.rst:1119 +#: ../../library/collections.rst:1125 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.move_to_end(k, " "last=True)`` with ``d[k] = d.pop(k)`` which will move the key and its " @@ -1796,7 +1807,7 @@ msgstr "" "``od.move_to_end(k, last=True)``,這會將該鍵與其對應到的值移動至最右(最後" "面)的位置。" -#: ../../library/collections.rst:1123 +#: ../../library/collections.rst:1129 msgid "" "A regular :class:`dict` does not have an efficient equivalent for " "OrderedDict's ``od.move_to_end(k, last=False)`` which moves the key and its " @@ -1806,18 +1817,18 @@ msgstr "" "last=False)`` 等價的有效方式,這是將鍵與其對應到的值移動至最左(最前面)位置" "的方法。" -#: ../../library/collections.rst:1127 +#: ../../library/collections.rst:1133 msgid "Until Python 3.8, :class:`dict` lacked a :meth:`__reversed__` method." msgstr "在 Python 3.8 之前,:class:`dict` 並沒有 :meth:`__reversed__` 方法。" -#: ../../library/collections.rst:1132 +#: ../../library/collections.rst:1138 msgid "" "Return an instance of a :class:`dict` subclass that has methods specialized " "for rearranging dictionary order." msgstr "" "回傳一個 :class:`dict` 子類別的實例,它具有專門用於重新排列字典順序的方法。" -#: ../../library/collections.rst:1139 +#: ../../library/collections.rst:1145 msgid "" "The :meth:`popitem` method for ordered dictionaries returns and removes a " "(key, value) pair. The pairs are returned in :abbr:`LIFO (last-in, first-" @@ -1829,7 +1840,7 @@ msgstr "" "回傳鍵值對,否則就按 :abbr:`FIFO (first-in, first-out)` 先進先出的順序回傳鍵" "值對。" -#: ../../library/collections.rst:1146 +#: ../../library/collections.rst:1152 msgid "" "Move an existing *key* to either end of an ordered dictionary. The item is " "moved to the right end if *last* is true (the default) or to the beginning " @@ -1839,7 +1850,7 @@ msgstr "" "設值)則將元素移至右端;如果 *last* 為假值則將元素移至左端。如果 *key* 不存在" "則會引發 :exc:`KeyError`:" -#: ../../library/collections.rst:1151 +#: ../../library/collections.rst:1157 msgid "" ">>> d = OrderedDict.fromkeys('abcde')\n" ">>> d.move_to_end('b')\n" @@ -1857,7 +1868,7 @@ msgstr "" ">>> ''.join(d)\n" "'bacde'" -#: ../../library/collections.rst:1163 +#: ../../library/collections.rst:1169 msgid "" "In addition to the usual mapping methods, ordered dictionaries also support " "reverse iteration using :func:`reversed`." @@ -1865,7 +1876,7 @@ msgstr "" "除了普通的對映方法,ordered dictionary 還支援了透過 :func:`reversed` 來做倒序" "疊代。" -#: ../../library/collections.rst:1166 +#: ../../library/collections.rst:1172 msgid "" "Equality tests between :class:`OrderedDict` objects are order-sensitive and " "are implemented as ``list(od1.items())==list(od2.items())``. Equality tests " @@ -1879,7 +1890,7 @@ msgstr "" "其他 :class:`~collections.abc.Mapping` 物件間的相等性運算則像普通字典一樣不考" "慮順序性,這使得 :class:`OrderedDict` 可於任何字典可使用的時機中被替換掉。" -#: ../../library/collections.rst:1173 +#: ../../library/collections.rst:1179 msgid "" "The items, keys, and values :term:`views ` of :class:" "`OrderedDict` now support reverse iteration using :func:`reversed`." @@ -1887,7 +1898,7 @@ msgstr "" ":class:`OrderedDict` 的項 (item)、鍵與值之\\ :term:`視圖 `\\ 現在可透過 :func:`reversed` 來倒序疊代。" -#: ../../library/collections.rst:1177 +#: ../../library/collections.rst:1183 msgid "" "With the acceptance of :pep:`468`, order is retained for keyword arguments " "passed to the :class:`OrderedDict` constructor and its :meth:`update` method." @@ -1895,11 +1906,11 @@ msgstr "" "隨著 :pep:`468` 被核可,被傳入給 :class:`OrderedDict` 建構函式與其 :meth:" "`update` 方法的關鍵字引數之順序被保留了下來。" -#: ../../library/collections.rst:1187 +#: ../../library/collections.rst:1193 msgid ":class:`OrderedDict` Examples and Recipes" msgstr ":class:`OrderedDict` 範例與用法" -#: ../../library/collections.rst:1189 +#: ../../library/collections.rst:1195 msgid "" "It is straightforward to create an ordered dictionary variant that remembers " "the order the keys were *last* inserted. If a new entry overwrites an " @@ -1909,7 +1920,7 @@ msgstr "" "建立一個能夠記住鍵\\ *最後*\\ 插入順序的 ordered dictionary 變體很簡單。如果" "新條目覆蓋了現有條目,則原本插入位置會被更改並移動至末端: ::" -#: ../../library/collections.rst:1194 +#: ../../library/collections.rst:1200 msgid "" "class LastUpdatedOrderedDict(OrderedDict):\n" " 'Store items in the order the keys were last added'\n" @@ -1919,7 +1930,7 @@ msgid "" " self.move_to_end(key)" msgstr "" -#: ../../library/collections.rst:1201 +#: ../../library/collections.rst:1207 msgid "" "An :class:`OrderedDict` would also be useful for implementing variants of :" "func:`functools.lru_cache`:" @@ -1927,7 +1938,7 @@ msgstr "" ":class:`OrderedDict` 在實現一個 :func:`functools.lru_cache` 的變形版本時也非" "常有用:" -#: ../../library/collections.rst:1204 +#: ../../library/collections.rst:1210 msgid "" "from collections import OrderedDict\n" "from time import time\n" @@ -1950,11 +1961,11 @@ msgid "" " result = self.func(*args)\n" " self.cache[args] = time(), result\n" " if len(self.cache) > self.maxsize:\n" -" self.cache.popitem(0)\n" +" self.cache.popitem(last=False)\n" " return result" msgstr "" -#: ../../library/collections.rst:1231 +#: ../../library/collections.rst:1237 msgid "" "class MultiHitLRUCache:\n" " \"\"\" LRU cache that defers caching a result until\n" @@ -1983,20 +1994,20 @@ msgid "" " if self.requests[args] <= self.cache_after:\n" " self.requests.move_to_end(args)\n" " if len(self.requests) > self.maxrequests:\n" -" self.requests.popitem(0)\n" +" self.requests.popitem(last=False)\n" " else:\n" " self.requests.pop(args, None)\n" " self.cache[args] = result\n" " if len(self.cache) > self.maxsize:\n" -" self.cache.popitem(0)\n" +" self.cache.popitem(last=False)\n" " return result" msgstr "" -#: ../../library/collections.rst:1300 +#: ../../library/collections.rst:1306 msgid ":class:`UserDict` objects" msgstr ":class:`UserDict` 物件" -#: ../../library/collections.rst:1302 +#: ../../library/collections.rst:1308 msgid "" "The class, :class:`UserDict` acts as a wrapper around dictionary objects. " "The need for this class has been partially supplanted by the ability to " @@ -2007,7 +2018,7 @@ msgstr "" "`dict` 建立子類別,這個類別的需求已部分被滿足,不過這個類別使用起來更方便,因" "為被包裝的字典可以作為其屬性來存取。" -#: ../../library/collections.rst:1310 +#: ../../library/collections.rst:1316 msgid "" "Class that simulates a dictionary. The instance's contents are kept in a " "regular dictionary, which is accessible via the :attr:`data` attribute of :" @@ -2019,23 +2030,23 @@ msgstr "" "`data` 屬性來做存取。如果有提供 *initialdata*,:attr:`data` 屬性會被初始化為" "其值;要注意指到 *initialdata* 的參照不會被保留,使其可被用於其他目的。" -#: ../../library/collections.rst:1316 +#: ../../library/collections.rst:1322 msgid "" "In addition to supporting the methods and operations of mappings, :class:" "`UserDict` instances provide the following attribute:" msgstr "" "除了支援作為對映所需的方法與操作,:class:`UserDict` 實例提供了以下屬性:" -#: ../../library/collections.rst:1321 +#: ../../library/collections.rst:1327 msgid "" "A real dictionary used to store the contents of the :class:`UserDict` class." msgstr "一個真實的字典,用於儲存 :class:`UserDict` 類別的資料內容。" -#: ../../library/collections.rst:1327 +#: ../../library/collections.rst:1333 msgid ":class:`UserList` objects" msgstr ":class:`UserList` 物件" -#: ../../library/collections.rst:1329 +#: ../../library/collections.rst:1335 msgid "" "This class acts as a wrapper around list objects. It is a useful base class " "for your own list-like classes which can inherit from them and override " @@ -2046,7 +2057,7 @@ msgstr "" "入新方法來定義你所需的一個類似於 list 的類別。如此一來,我們可以為 list 加入" "新的特性。" -#: ../../library/collections.rst:1334 +#: ../../library/collections.rst:1340 msgid "" "The need for this class has been partially supplanted by the ability to " "subclass directly from :class:`list`; however, this class can be easier to " @@ -2055,7 +2066,7 @@ msgstr "" "因為已經可以直接自 :class:`list` 建立子類別,這個類別的需求已部分被滿足,不過" "這個類別使用起來更方便,因為被包裝的 list 可以作為其屬性來存取。" -#: ../../library/collections.rst:1340 +#: ../../library/collections.rst:1346 msgid "" "Class that simulates a list. The instance's contents are kept in a regular " "list, which is accessible via the :attr:`data` attribute of :class:" @@ -2068,20 +2079,20 @@ msgstr "" "list ``[]``。*list* 可以是任何 iterable,例如一個真實的 Python list 或是一" "個 :class:`UserList` 物件。" -#: ../../library/collections.rst:1346 +#: ../../library/collections.rst:1352 msgid "" "In addition to supporting the methods and operations of mutable sequences, :" "class:`UserList` instances provide the following attribute:" msgstr "除了支援可變序列的方法與操作,:class:`UserList` 實例提供了以下屬性:" -#: ../../library/collections.rst:1351 +#: ../../library/collections.rst:1357 msgid "" "A real :class:`list` object used to store the contents of the :class:" "`UserList` class." msgstr "" "一個真實的 :class:`list` 物件,用於儲存 :class:`UserList` 類別的資料內容。" -#: ../../library/collections.rst:1354 +#: ../../library/collections.rst:1360 msgid "" "**Subclassing requirements:** Subclasses of :class:`UserList` are expected " "to offer a constructor which can be called with either no arguments or one " @@ -2095,7 +2106,7 @@ msgstr "" "例,為了達成上述目的,它假設建構函式可傳入單一參數來呼叫,該參數即是做為數據" "來源的一個序列物件。" -#: ../../library/collections.rst:1361 +#: ../../library/collections.rst:1367 msgid "" "If a derived class does not wish to comply with this requirement, all of the " "special methods supported by this class will need to be overridden; please " @@ -2105,11 +2116,11 @@ msgstr "" "如果希望一個自此獲得的子類別不遵從上述要求,那所有該類別支援的特殊方法則必須" "被覆寫;請參考原始碼來理解在這情況下哪些方法是必須提供的。" -#: ../../library/collections.rst:1367 +#: ../../library/collections.rst:1373 msgid ":class:`UserString` objects" msgstr ":class:`UserString` 物件" -#: ../../library/collections.rst:1369 +#: ../../library/collections.rst:1375 msgid "" "The class, :class:`UserString` acts as a wrapper around string objects. The " "need for this class has been partially supplanted by the ability to subclass " @@ -2120,7 +2131,7 @@ msgstr "" "建立子類別,這個類別的需求已經部分被滿足,不過這個類別使用起來更方便,因為被" "包裝的字串可以作為其屬性來存取。" -#: ../../library/collections.rst:1377 +#: ../../library/collections.rst:1383 msgid "" "Class that simulates a string object. The instance's content is kept in a " "regular string object, which is accessible via the :attr:`data` attribute " @@ -2132,21 +2143,21 @@ msgstr "" "的 :attr:`data` 屬性來做存取。實例內容被初始化為 *seq* 的複製,*seq* 引數可以" "是任何可被內建函式 :func:`str` 轉換成字串的物件。" -#: ../../library/collections.rst:1384 +#: ../../library/collections.rst:1390 msgid "" "In addition to supporting the methods and operations of strings, :class:" "`UserString` instances provide the following attribute:" msgstr "" "除了支援字串的方法和操作以外,:class:`UserString` 實例也提供了以下屬性:" -#: ../../library/collections.rst:1389 +#: ../../library/collections.rst:1395 msgid "" "A real :class:`str` object used to store the contents of the :class:" "`UserString` class." msgstr "" "一個真實的 :class:`str` 物件,用來儲存 :class:`UserString` 類別的資料內容。" -#: ../../library/collections.rst:1392 +#: ../../library/collections.rst:1398 msgid "" "New methods ``__getnewargs__``, ``__rmod__``, ``casefold``, ``format_map``, " "``isprintable``, and ``maketrans``." diff --git a/library/compileall.po b/library/compileall.po index 16383e7652..2f8e76a53f 100644 --- a/library/compileall.po +++ b/library/compileall.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,14 +36,14 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid ":ref:`Availability `: not WASI." msgstr "" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" @@ -128,7 +128,7 @@ msgstr "" #: ../../library/compileall.rst:92 msgid "" "Use *N* workers to compile the files within the given directory. If ``0`` is " -"used, then the result of :func:`os.cpu_count` will be used." +"used, then the result of :func:`os.process_cpu_count` will be used." msgstr "" #: ../../library/compileall.rst:98 diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index 4b25e089b3..061f4dc950 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-01-24 03:33+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,14 +51,15 @@ msgstr "" "相同的介面,該介面由抽象的 :class:`Executor` 類別定義。" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +#, fuzzy +msgid ":ref:`Availability `: not WASI." msgstr ":ref:`適用 `:非 Emscripten、非 WASI。" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上沒有作用" "或不可使用。更多資訊,請參閱 :ref:`wasm-availability`。" @@ -338,7 +339,7 @@ msgstr "" "thread) 的 :class:`threading.Thread` 名稱,以便於除錯。" #: ../../library/concurrent.futures.rst:179 -#: ../../library/concurrent.futures.rst:283 +#: ../../library/concurrent.futures.rst:287 msgid "Added the *initializer* and *initargs* arguments." msgstr "新增 *initializer* 與 *initargs* 引數。" @@ -361,11 +362,17 @@ msgstr "" "ThreadPoolExecutor 現在在啟動 *max_workers* 工作執行緒之前會重用 (reuse) 空閒" "的工作執行緒。" -#: ../../library/concurrent.futures.rst:195 +#: ../../library/concurrent.futures.rst:191 +msgid "" +"Default value of *max_workers* is changed to ``min(32, (os." +"process_cpu_count() or 1) + 4)``." +msgstr "" + +#: ../../library/concurrent.futures.rst:199 msgid "ThreadPoolExecutor Example" msgstr "ThreadPoolExecutor 範例" -#: ../../library/concurrent.futures.rst:198 +#: ../../library/concurrent.futures.rst:202 msgid "" "import concurrent.futures\n" "import urllib.request\n" @@ -396,11 +403,11 @@ msgid "" " print('%r page is %d bytes' % (url, len(data)))" msgstr "" -#: ../../library/concurrent.futures.rst:227 +#: ../../library/concurrent.futures.rst:231 msgid "ProcessPoolExecutor" msgstr "ProcessPoolExecutor" -#: ../../library/concurrent.futures.rst:229 +#: ../../library/concurrent.futures.rst:233 msgid "" "The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that " "uses a pool of processes to execute calls asynchronously. :class:" @@ -415,7 +422,7 @@ msgstr "" "Interpreter Lock) `,但也意味著只能執行和回傳可被 " "pickle 的 (picklable) 物件。" -#: ../../library/concurrent.futures.rst:236 +#: ../../library/concurrent.futures.rst:240 msgid "" "The ``__main__`` module must be importable by worker subprocesses. This " "means that :class:`ProcessPoolExecutor` will not work in the interactive " @@ -425,7 +432,7 @@ msgstr "" "class:`ProcessPoolExecutor` 將無法在交互式直譯器 (interactive interpreter) 中" "工作。" -#: ../../library/concurrent.futures.rst:239 +#: ../../library/concurrent.futures.rst:243 msgid "" "Calling :class:`Executor` or :class:`Future` methods from a callable " "submitted to a :class:`ProcessPoolExecutor` will result in deadlock." @@ -433,19 +440,20 @@ msgstr "" "從提交給 :class:`ProcessPoolExecutor` 的可呼叫物件中呼叫 :class:`Executor` " "或 :class:`Future` 方法將導致死鎖。" -#: ../../library/concurrent.futures.rst:244 +#: ../../library/concurrent.futures.rst:248 +#, fuzzy msgid "" "An :class:`Executor` subclass that executes calls asynchronously using a " "pool of at most *max_workers* processes. If *max_workers* is ``None`` or " -"not given, it will default to the number of processors on the machine. If " -"*max_workers* is less than or equal to ``0``, then a :exc:`ValueError` will " -"be raised. On Windows, *max_workers* must be less than or equal to ``61``. " -"If it is not then :exc:`ValueError` will be raised. If *max_workers* is " -"``None``, then the default chosen will be at most ``61``, even if more " -"processors are available. *mp_context* can be a :mod:`multiprocessing` " -"context or ``None``. It will be used to launch the workers. If *mp_context* " -"is ``None`` or not given, the default :mod:`multiprocessing` context is " -"used. See :ref:`multiprocessing-start-methods`." +"not given, it will default to :func:`os.process_cpu_count`. If *max_workers* " +"is less than or equal to ``0``, then a :exc:`ValueError` will be raised. On " +"Windows, *max_workers* must be less than or equal to ``61``. If it is not " +"then :exc:`ValueError` will be raised. If *max_workers* is ``None``, then " +"the default chosen will be at most ``61``, even if more processors are " +"available. *mp_context* can be a :mod:`multiprocessing` context or ``None``. " +"It will be used to launch the workers. If *mp_context* is ``None`` or not " +"given, the default :mod:`multiprocessing` context is used. See :ref:" +"`multiprocessing-start-methods`." msgstr "" "一個 :class:`Executor` 子類別,它使用了最多有 *max_workers* 個行程的池來非同" "步地執行呼叫。如果 *max_workers* 為 ``None`` 或未給定,它將被預設為機器上的處" @@ -457,7 +465,7 @@ msgstr "" "預設的 :mod:`multiprocessing` 情境。請見 :ref:`multiprocessing-start-" "methods`。" -#: ../../library/concurrent.futures.rst:258 +#: ../../library/concurrent.futures.rst:262 msgid "" "*initializer* is an optional callable that is called at the start of each " "worker process; *initargs* is a tuple of arguments passed to the " @@ -470,7 +478,7 @@ msgstr "" "外,所有當前未定的作業以及任何向池中提交更多作業的嘗試都將引發 :exc:" "`~concurrent.futures.process.BrokenProcessPool`。" -#: ../../library/concurrent.futures.rst:264 +#: ../../library/concurrent.futures.rst:268 msgid "" "*max_tasks_per_child* is an optional argument that specifies the maximum " "number of tasks a single process can execute before it will exit and be " @@ -486,7 +494,7 @@ msgstr "" "數的情況下,將預設使用 \"spawn\" 做為 multiprocessing 啟動方法。此功能與 " "\"fork\" 啟動方法不相容。" -#: ../../library/concurrent.futures.rst:272 +#: ../../library/concurrent.futures.rst:276 msgid "" "When one of the worker processes terminates abruptly, a :exc:`~concurrent." "futures.process.BrokenProcessPool` error is now raised. Previously, " @@ -497,14 +505,14 @@ msgstr "" "BrokenProcessPool` 錯誤。在過去,此行為是未定義的 (undefined),但對 executor " "或其 future 的操作經常會發生凍結或死鎖。" -#: ../../library/concurrent.futures.rst:279 +#: ../../library/concurrent.futures.rst:283 msgid "" "The *mp_context* argument was added to allow users to control the " "start_method for worker processes created by the pool." msgstr "" "新增了 *mp_context* 引數以允許使用者控制由池所建立的工作行程的 start_method。" -#: ../../library/concurrent.futures.rst:286 +#: ../../library/concurrent.futures.rst:290 msgid "" "The default :mod:`multiprocessing` start method (see :ref:`multiprocessing-" "start-methods`) will change away from *fork* in Python 3.14. Code that " @@ -517,14 +525,14 @@ msgstr "" "`ProcessPoolExecutor` 的程式碼應透過傳遞 ``mp_context=multiprocessing." "get_context(\"fork\")`` 參數來明確指定。" -#: ../../library/concurrent.futures.rst:293 +#: ../../library/concurrent.futures.rst:297 msgid "" "The *max_tasks_per_child* argument was added to allow users to control the " "lifetime of workers in the pool." msgstr "" "新增了 *max_tasks_per_child* 引數以允許使用者控制池中 worker 的生命週期。" -#: ../../library/concurrent.futures.rst:297 +#: ../../library/concurrent.futures.rst:301 msgid "" "On POSIX systems, if your application has multiple threads and the :mod:" "`multiprocessing` context uses the ``\"fork\"`` start method: The :func:`os." @@ -537,11 +545,17 @@ msgstr "" "能會引發 :exc:`DeprecationWarning`。傳遞一個 *mp_context* 以配置為使用不同的" "啟動方法。更多說明請參閱 :func:`os.fork` 文件。" -#: ../../library/concurrent.futures.rst:308 +#: ../../library/concurrent.futures.rst:309 +msgid "" +"*max_workers* uses :func:`os.process_cpu_count` by default, instead of :func:" +"`os.cpu_count`." +msgstr "" + +#: ../../library/concurrent.futures.rst:316 msgid "ProcessPoolExecutor Example" msgstr "ProcessPoolExecutor 範例" -#: ../../library/concurrent.futures.rst:311 +#: ../../library/concurrent.futures.rst:319 msgid "" "import concurrent.futures\n" "import math\n" @@ -609,11 +623,11 @@ msgstr "" "if __name__ == '__main__':\n" " main()" -#: ../../library/concurrent.futures.rst:346 +#: ../../library/concurrent.futures.rst:354 msgid "Future Objects" msgstr "Future 物件" -#: ../../library/concurrent.futures.rst:348 +#: ../../library/concurrent.futures.rst:356 msgid "" "The :class:`Future` class encapsulates the asynchronous execution of a " "callable. :class:`Future` instances are created by :meth:`Executor.submit`." @@ -621,7 +635,7 @@ msgstr "" ":class:`Future` 類別封裝了可呼叫物件的非同步執行。:class:`Future` 實例由 :" "meth:`Executor.submit` 建立。" -#: ../../library/concurrent.futures.rst:353 +#: ../../library/concurrent.futures.rst:361 msgid "" "Encapsulates the asynchronous execution of a callable. :class:`Future` " "instances are created by :meth:`Executor.submit` and should not be created " @@ -630,7 +644,7 @@ msgstr "" "封裝可呼叫物件的非同步執行。:class:`Future` 實例由 :meth:`Executor.submit` 建" "立,且除測試外不應直接建立。" -#: ../../library/concurrent.futures.rst:359 +#: ../../library/concurrent.futures.rst:367 msgid "" "Attempt to cancel the call. If the call is currently being executed or " "finished running and cannot be cancelled then the method will return " @@ -640,22 +654,22 @@ msgstr "" "嘗試取消呼叫。如果呼叫當前正在執行或已完成運行且無法取消,則該方法將回傳 " "``False``,否則呼叫將被取消並且該方法將回傳 ``True``。" -#: ../../library/concurrent.futures.rst:366 +#: ../../library/concurrent.futures.rst:374 msgid "Return ``True`` if the call was successfully cancelled." msgstr "如果該呼叫成功被取消,則回傳 ``True``。" -#: ../../library/concurrent.futures.rst:370 +#: ../../library/concurrent.futures.rst:378 msgid "" "Return ``True`` if the call is currently being executed and cannot be " "cancelled." msgstr "如果呼叫正在執行且無法取消,則回傳 ``True``。" -#: ../../library/concurrent.futures.rst:375 +#: ../../library/concurrent.futures.rst:383 msgid "" "Return ``True`` if the call was successfully cancelled or finished running." msgstr "如果呼叫成功被取消或結束運行,則回傳 ``True``。" -#: ../../library/concurrent.futures.rst:380 +#: ../../library/concurrent.futures.rst:388 msgid "" "Return the value returned by the call. If the call hasn't yet completed then " "this method will wait up to *timeout* seconds. If the call hasn't completed " @@ -667,19 +681,19 @@ msgstr "" "叫在 *timeout* 秒內未完成,則會引發 :exc:`TimeoutError`。*timeout* 可以是整數" "或浮點數。如果未指定 *timeout* 或為 ``None``,則等待時間就不會有限制。" -#: ../../library/concurrent.futures.rst:387 -#: ../../library/concurrent.futures.rst:401 +#: ../../library/concurrent.futures.rst:395 +#: ../../library/concurrent.futures.rst:409 msgid "" "If the future is cancelled before completing then :exc:`.CancelledError` " "will be raised." msgstr "如果 future 在完成之前被取消,那麼 :exc:`.CancelledError` 將被引發。" -#: ../../library/concurrent.futures.rst:390 +#: ../../library/concurrent.futures.rst:398 msgid "" "If the call raised an exception, this method will raise the same exception." msgstr "如果該呼叫引發了例外,此方法將引發相同的例外。" -#: ../../library/concurrent.futures.rst:394 +#: ../../library/concurrent.futures.rst:402 msgid "" "Return the exception raised by the call. If the call hasn't yet completed " "then this method will wait up to *timeout* seconds. If the call hasn't " @@ -691,11 +705,11 @@ msgstr "" "呼叫在 *timeout* 秒內未完成,則會引發 :exc:`TimeoutError`。 *timeout* 可以是" "整數或浮點數。如果未指定 *timeout* 或為 ``None``,則等待時間就不會有限制。" -#: ../../library/concurrent.futures.rst:404 +#: ../../library/concurrent.futures.rst:412 msgid "If the call completed without raising, ``None`` is returned." msgstr "如果呼叫在沒有引發的情況下完成,則回傳 ``None``。" -#: ../../library/concurrent.futures.rst:408 +#: ../../library/concurrent.futures.rst:416 msgid "" "Attaches the callable *fn* to the future. *fn* will be called, with the " "future as its only argument, when the future is cancelled or finishes " @@ -704,7 +718,7 @@ msgstr "" "將可呼叫的 *fn* 附加到 future 上。當 future 被取消或完成運行時,*fn* 將被以 " "future 作為其唯一引數來呼叫。" -#: ../../library/concurrent.futures.rst:412 +#: ../../library/concurrent.futures.rst:420 msgid "" "Added callables are called in the order that they were added and are always " "called in a thread belonging to the process that added them. If the " @@ -716,19 +730,19 @@ msgstr "" "如果可呼叫物件引發 :exc:`Exception` 子類別,它將被記錄 (log) 並忽略。如果可呼" "叫物件引發 :exc:`BaseException` 子類別,該行為未定義。" -#: ../../library/concurrent.futures.rst:418 +#: ../../library/concurrent.futures.rst:426 msgid "" "If the future has already completed or been cancelled, *fn* will be called " "immediately." msgstr "如果 future 已經完成或被取消,*fn* 將立即被呼叫。" -#: ../../library/concurrent.futures.rst:421 +#: ../../library/concurrent.futures.rst:429 msgid "" "The following :class:`Future` methods are meant for use in unit tests and :" "class:`Executor` implementations." msgstr "以下 :class:`Future` 方法旨在用於單元測試和 :class:`Executor` 實作。" -#: ../../library/concurrent.futures.rst:426 +#: ../../library/concurrent.futures.rst:434 msgid "" "This method should only be called by :class:`Executor` implementations " "before executing the work associated with the :class:`Future` and by unit " @@ -737,7 +751,7 @@ msgstr "" "此方法只能在與 :class:`Future` 關聯的工作被執行之前於 :class:`Executor` 實作" "中呼叫,或者在單元測試中呼叫。" -#: ../../library/concurrent.futures.rst:430 +#: ../../library/concurrent.futures.rst:438 msgid "" "If the method returns ``False`` then the :class:`Future` was cancelled, i." "e. :meth:`Future.cancel` was called and returned ``True``. Any threads " @@ -748,7 +762,7 @@ msgstr "" "cancel` 被呼叫並回傳 ``True``。任何等待 :class:`Future` 完成的執行緒(即透" "過 :func:`as_completed` 或 :func:`wait`)將被喚醒。" -#: ../../library/concurrent.futures.rst:435 +#: ../../library/concurrent.futures.rst:443 msgid "" "If the method returns ``True`` then the :class:`Future` was not cancelled " "and has been put in the running state, i.e. calls to :meth:`Future.running` " @@ -757,7 +771,7 @@ msgstr "" "如果該方法回傳 ``True`` 則代表 :class:`Future` 未被取消並已進入運行狀態,意即" "呼叫 :meth:`Future.running` 將回傳 ``True``。" -#: ../../library/concurrent.futures.rst:439 +#: ../../library/concurrent.futures.rst:447 msgid "" "This method can only be called once and cannot be called after :meth:`Future." "set_result` or :meth:`Future.set_exception` have been called." @@ -765,20 +779,20 @@ msgstr "" "此方法只能呼叫一次,且不能在呼叫 :meth:`Future.set_result` 或 :meth:`Future." "set_exception` 之後呼叫。" -#: ../../library/concurrent.futures.rst:445 +#: ../../library/concurrent.futures.rst:453 msgid "" "Sets the result of the work associated with the :class:`Future` to *result*." msgstr "將與 :class:`Future` 關聯的工作結果設定為 *result*。" -#: ../../library/concurrent.futures.rst:448 -#: ../../library/concurrent.futures.rst:461 +#: ../../library/concurrent.futures.rst:456 +#: ../../library/concurrent.futures.rst:469 msgid "" "This method should only be used by :class:`Executor` implementations and " "unit tests." msgstr "此方法只能在 :class:`Executor` 實作中和單元測試中使用。" -#: ../../library/concurrent.futures.rst:451 -#: ../../library/concurrent.futures.rst:464 +#: ../../library/concurrent.futures.rst:459 +#: ../../library/concurrent.futures.rst:472 msgid "" "This method raises :exc:`concurrent.futures.InvalidStateError` if the :class:" "`Future` is already done." @@ -786,18 +800,18 @@ msgstr "" "如果 :class:`Future` 已經完成,此方法會引發 :exc:`concurrent.futures." "InvalidStateError`。" -#: ../../library/concurrent.futures.rst:458 +#: ../../library/concurrent.futures.rst:466 msgid "" "Sets the result of the work associated with the :class:`Future` to the :" "class:`Exception` *exception*." msgstr "" "將與 :class:`Future` 關聯的工作結果設定為 :class:`Exception` *exception*。" -#: ../../library/concurrent.futures.rst:470 +#: ../../library/concurrent.futures.rst:478 msgid "Module Functions" msgstr "模組函式" -#: ../../library/concurrent.futures.rst:474 +#: ../../library/concurrent.futures.rst:482 msgid "" "Wait for the :class:`Future` instances (possibly created by different :class:" "`Executor` instances) given by *fs* to complete. Duplicate futures given to " @@ -813,7 +827,7 @@ msgstr "" "完成的 future(已完成或被取消的 future)。第二組名為 ``not_done``,包含未完成" "的 future(未定或運行中的 future)。" -#: ../../library/concurrent.futures.rst:482 +#: ../../library/concurrent.futures.rst:490 msgid "" "*timeout* can be used to control the maximum number of seconds to wait " "before returning. *timeout* can be an int or float. If *timeout* is not " @@ -822,25 +836,25 @@ msgstr "" "*timeout* 可用於控制回傳前等待的最大秒數。*timeout* 可以是整數或浮點數。如果" "未指定 *timeout* 或為 ``None``,則等待時間就沒有限制。" -#: ../../library/concurrent.futures.rst:486 +#: ../../library/concurrent.futures.rst:494 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "*return_when* 表示此函式應回傳的時間。它必須是以下常數之一:" -#: ../../library/concurrent.futures.rst:492 +#: ../../library/concurrent.futures.rst:500 msgid "Constant" msgstr "常數" -#: ../../library/concurrent.futures.rst:493 +#: ../../library/concurrent.futures.rst:501 msgid "Description" msgstr "描述" -#: ../../library/concurrent.futures.rst:496 +#: ../../library/concurrent.futures.rst:504 msgid "The function will return when any future finishes or is cancelled." msgstr "當任何 future 完成或被取消時,該函式就會回傳。" -#: ../../library/concurrent.futures.rst:499 +#: ../../library/concurrent.futures.rst:507 msgid "" "The function will return when any future finishes by raising an exception. " "If no future raises an exception then it is equivalent to :const:" @@ -849,11 +863,11 @@ msgstr "" "該函式會在任何 future 透過引發例外而完結時回傳。如果 future 沒有引發例外,那" "麼它等同於 :const:`ALL_COMPLETED`。" -#: ../../library/concurrent.futures.rst:504 +#: ../../library/concurrent.futures.rst:512 msgid "The function will return when all futures finish or are cancelled." msgstr "當所有 future 都完成或被取消時,該函式才會回傳。" -#: ../../library/concurrent.futures.rst:508 +#: ../../library/concurrent.futures.rst:516 msgid "" "Returns an iterator over the :class:`Future` instances (possibly created by " "different :class:`Executor` instances) given by *fs* that yields futures as " @@ -873,36 +887,36 @@ msgstr "" "`TimeoutError`。*timeout* 可以是整數或浮點數。如果未指定 *timeout* 或為 " "``None``,則等待時間就沒有限制。" -#: ../../library/concurrent.futures.rst:521 +#: ../../library/concurrent.futures.rst:529 msgid ":pep:`3148` -- futures - execute computations asynchronously" msgstr ":pep:`3148` -- futures - 非同步地執行運算" -#: ../../library/concurrent.futures.rst:522 +#: ../../library/concurrent.futures.rst:530 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "描述此功能並提出被包含於 Python 標準函式庫中的提案。" -#: ../../library/concurrent.futures.rst:527 +#: ../../library/concurrent.futures.rst:535 msgid "Exception classes" msgstr "例外類別" -#: ../../library/concurrent.futures.rst:533 +#: ../../library/concurrent.futures.rst:541 msgid "Raised when a future is cancelled." msgstr "當 future 被取消時引發。" -#: ../../library/concurrent.futures.rst:537 +#: ../../library/concurrent.futures.rst:545 msgid "" "A deprecated alias of :exc:`TimeoutError`, raised when a future operation " "exceeds the given timeout." msgstr "" ":exc:`TimeoutError` 的棄用別名,在 future 操作超過給定超時 (timeout) 時引發。" -#: ../../library/concurrent.futures.rst:542 +#: ../../library/concurrent.futures.rst:550 msgid "This class was made an alias of :exc:`TimeoutError`." msgstr "這個類別是 :exc:`TimeoutError` 的別名。" -#: ../../library/concurrent.futures.rst:547 +#: ../../library/concurrent.futures.rst:555 msgid "" "Derived from :exc:`RuntimeError`, this exception class is raised when an " "executor is broken for some reason, and cannot be used to submit or execute " @@ -911,13 +925,13 @@ msgstr "" "衍生自 :exc:`RuntimeError`,當執行器因某種原因損壞時會引發此例外類別,並且不" "能用於提交或執行新任務。" -#: ../../library/concurrent.futures.rst:555 +#: ../../library/concurrent.futures.rst:563 msgid "" "Raised when an operation is performed on a future that is not allowed in the " "current state." msgstr "當前狀態下不允許的 future 操作被執行時而引發。" -#: ../../library/concurrent.futures.rst:564 +#: ../../library/concurrent.futures.rst:572 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor`, this exception class " "is raised when one of the workers of a :class:`~concurrent.futures." @@ -926,7 +940,7 @@ msgstr "" "衍生自 :exc:`~concurrent.futures.BrokenExecutor`,當 :class:`~concurrent." "futures.ThreadPoolExecutor` 的其中一個 worker 初始化失敗時會引發此例外類別。" -#: ../../library/concurrent.futures.rst:575 +#: ../../library/concurrent.futures.rst:583 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor` (formerly :exc:" "`RuntimeError`), this exception class is raised when one of the workers of " diff --git a/library/configparser.po b/library/configparser.po index a5139db278..0943f36e02 100644 --- a/library/configparser.po +++ b/library/configparser.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -187,7 +187,7 @@ msgid "" "and stored in lowercase [1]_." msgstr "" -#: ../../library/configparser.rst:147 ../../library/configparser.rst:966 +#: ../../library/configparser.rst:147 ../../library/configparser.rst:992 msgid "" "It is possible to read several configurations into a single :class:" "`ConfigParser`, where the most recently added configuration has the highest " @@ -197,7 +197,7 @@ msgid "" "``example.ini`` file." msgstr "" -#: ../../library/configparser.rst:154 ../../library/configparser.rst:973 +#: ../../library/configparser.rst:154 ../../library/configparser.rst:999 msgid "" "[DEFAULT]\n" "ServerAliveInterval = -1" @@ -205,7 +205,7 @@ msgstr "" "[DEFAULT]\n" "ServerAliveInterval = -1" -#: ../../library/configparser.rst:159 ../../library/configparser.rst:978 +#: ../../library/configparser.rst:159 ../../library/configparser.rst:1004 msgid "" ">>> config_override = configparser.ConfigParser()\n" ">>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}\n" @@ -403,16 +403,24 @@ msgstr "" #: ../../library/configparser.rst:282 msgid "" +"The first section name may be omitted if the parser is configured to allow " +"an unnamed top level section with ``allow_unnamed_section=True``. In this " +"case, the keys/values may be retrieved by :const:`UNNAMED_SECTION` as in " +"``config[UNNAMED_SECTION]``." +msgstr "" + +#: ../../library/configparser.rst:287 +msgid "" "Configuration files may include comments, prefixed by specific characters " "(``#`` and ``;`` by default [1]_). Comments may appear on their own on an " "otherwise empty line, possibly indented. [1]_" msgstr "" -#: ../../library/configparser.rst:286 ../../library/configparser.rst:349 +#: ../../library/configparser.rst:291 ../../library/configparser.rst:375 msgid "For example:" msgstr "舉例來說:" -#: ../../library/configparser.rst:288 +#: ../../library/configparser.rst:293 msgid "" "[Simple Values]\n" "key=value\n" @@ -457,18 +465,42 @@ msgid "" " # Did I mention we can indent comments, too?" msgstr "" -#: ../../library/configparser.rst:334 +#: ../../library/configparser.rst:341 +msgid "Unnamed Sections" +msgstr "" + +#: ../../library/configparser.rst:343 +msgid "" +"The name of the first section (or unique) may be omitted and values " +"retrieved by the :const:`UNNAMED_SECTION` attribute." +msgstr "" + +#: ../../library/configparser.rst:346 +msgid "" +">>> config = \"\"\"\n" +"... option = value\n" +"...\n" +"... [ Section 2 ]\n" +"... another = val\n" +"... \"\"\"\n" +">>> unnamed = configparser.ConfigParser(allow_unnamed_section=True)\n" +">>> unnamed.read_string(config)\n" +">>> unnamed.get(configparser.UNNAMED_SECTION, 'option')\n" +"'value'" +msgstr "" + +#: ../../library/configparser.rst:360 msgid "Interpolation of values" msgstr "" -#: ../../library/configparser.rst:336 +#: ../../library/configparser.rst:362 msgid "" "On top of the core functionality, :class:`ConfigParser` supports " "interpolation. This means values can be preprocessed before returning them " "from ``get()`` calls." msgstr "" -#: ../../library/configparser.rst:344 +#: ../../library/configparser.rst:370 msgid "" "The default implementation used by :class:`ConfigParser`. It enables values " "to contain format strings which refer to other values in the same section, " @@ -476,7 +508,7 @@ msgid "" "can be provided on initialization." msgstr "" -#: ../../library/configparser.rst:351 +#: ../../library/configparser.rst:377 msgid "" "[Paths]\n" "home_dir: /Users\n" @@ -489,7 +521,7 @@ msgid "" "gain: 80%%" msgstr "" -#: ../../library/configparser.rst:362 +#: ../../library/configparser.rst:388 msgid "" "In the example above, :class:`ConfigParser` with *interpolation* set to " "``BasicInterpolation()`` would resolve ``%(home_dir)s`` to the value of " @@ -499,14 +531,14 @@ msgid "" "specific order in the configuration file." msgstr "" -#: ../../library/configparser.rst:369 +#: ../../library/configparser.rst:395 msgid "" "With ``interpolation`` set to ``None``, the parser would simply return " "``%(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/" "lumberjack`` as the value of ``my_dir``." msgstr "" -#: ../../library/configparser.rst:377 +#: ../../library/configparser.rst:403 msgid "" "An alternative handler for interpolation which implements a more advanced " "syntax, used for instance in ``zc.buildout``. Extended interpolation is " @@ -516,13 +548,13 @@ msgid "" "possibly the default values from the special section)." msgstr "" -#: ../../library/configparser.rst:384 +#: ../../library/configparser.rst:410 msgid "" "For example, the configuration specified above with basic interpolation, " "would look like this with extended interpolation:" msgstr "" -#: ../../library/configparser.rst:387 +#: ../../library/configparser.rst:413 msgid "" "[Paths]\n" "home_dir: /Users\n" @@ -535,11 +567,11 @@ msgid "" "cost: $$80" msgstr "" -#: ../../library/configparser.rst:398 +#: ../../library/configparser.rst:424 msgid "Values from other sections can be fetched as well:" msgstr "" -#: ../../library/configparser.rst:400 +#: ../../library/configparser.rst:426 msgid "" "[Common]\n" "home_dir: /Users\n" @@ -575,11 +607,11 @@ msgstr "" "my_pictures: ${my_dir}/Pictures\n" "python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python}" -#: ../../library/configparser.rst:420 +#: ../../library/configparser.rst:446 msgid "Mapping Protocol Access" msgstr "" -#: ../../library/configparser.rst:424 +#: ../../library/configparser.rst:450 msgid "" "Mapping protocol access is a generic name for functionality that enables " "using custom objects as if they were dictionaries. In case of :mod:" @@ -587,7 +619,7 @@ msgid "" "``parser['section']['option']`` notation." msgstr "" -#: ../../library/configparser.rst:429 +#: ../../library/configparser.rst:455 msgid "" "``parser['section']`` in particular returns a proxy for the section's data " "in the parser. This means that the values are not copied but they are taken " @@ -596,7 +628,7 @@ msgid "" "original parser." msgstr "" -#: ../../library/configparser.rst:435 +#: ../../library/configparser.rst:461 msgid "" ":mod:`configparser` objects behave as close to actual dictionaries as " "possible. The mapping interface is complete and adheres to the :class:" @@ -604,7 +636,7 @@ msgid "" "that should be taken into account:" msgstr "" -#: ../../library/configparser.rst:440 +#: ../../library/configparser.rst:466 msgid "" "By default, all keys in sections are accessible in a case-insensitive manner " "[1]_. E.g. ``for option in parser[\"section\"]`` yields only " @@ -613,7 +645,7 @@ msgid "" "expressions return ``True``::" msgstr "" -#: ../../library/configparser.rst:445 +#: ../../library/configparser.rst:471 msgid "" "\"a\" in parser[\"section\"]\n" "\"A\" in parser[\"section\"]" @@ -621,7 +653,7 @@ msgstr "" "\"a\" in parser[\"section\"]\n" "\"A\" in parser[\"section\"]" -#: ../../library/configparser.rst:448 +#: ../../library/configparser.rst:474 msgid "" "All sections include ``DEFAULTSECT`` values as well which means that ``." "clear()`` on a section may not leave the section visibly empty. This is " @@ -631,30 +663,30 @@ msgid "" "default value causes a :exc:`KeyError`." msgstr "" -#: ../../library/configparser.rst:455 +#: ../../library/configparser.rst:481 msgid "``DEFAULTSECT`` cannot be removed from the parser:" msgstr "" -#: ../../library/configparser.rst:457 +#: ../../library/configparser.rst:483 msgid "trying to delete it raises :exc:`ValueError`," msgstr "" -#: ../../library/configparser.rst:459 +#: ../../library/configparser.rst:485 msgid "``parser.clear()`` leaves it intact," msgstr "" -#: ../../library/configparser.rst:461 +#: ../../library/configparser.rst:487 msgid "``parser.popitem()`` never returns it." msgstr "" -#: ../../library/configparser.rst:463 +#: ../../library/configparser.rst:489 msgid "" "``parser.get(section, option, **kwargs)`` - the second argument is **not** a " "fallback value. Note however that the section-level ``get()`` methods are " "compatible both with the mapping protocol and the classic configparser API." msgstr "" -#: ../../library/configparser.rst:467 +#: ../../library/configparser.rst:493 msgid "" "``parser.items()`` is compatible with the mapping protocol (returns a list " "of *section_name*, *section_proxy* pairs including the DEFAULTSECT). " @@ -664,18 +696,18 @@ msgid "" "(unless ``raw=True`` is provided)." msgstr "" -#: ../../library/configparser.rst:474 +#: ../../library/configparser.rst:500 msgid "" "The mapping protocol is implemented on top of the existing legacy API so " "that subclasses overriding the original interface still should have mappings " "working as expected." msgstr "" -#: ../../library/configparser.rst:480 +#: ../../library/configparser.rst:506 msgid "Customizing Parser Behaviour" msgstr "" -#: ../../library/configparser.rst:482 +#: ../../library/configparser.rst:508 msgid "" "There are nearly as many INI format variants as there are applications using " "it. :mod:`configparser` goes a long way to provide support for the largest " @@ -684,17 +716,17 @@ msgid "" "customize some of the features." msgstr "" -#: ../../library/configparser.rst:488 +#: ../../library/configparser.rst:514 msgid "" "The most common way to change the way a specific config parser works is to " "use the :meth:`!__init__` options:" msgstr "" -#: ../../library/configparser.rst:491 +#: ../../library/configparser.rst:517 msgid "*defaults*, default value: ``None``" msgstr "" -#: ../../library/configparser.rst:493 +#: ../../library/configparser.rst:519 msgid "" "This option accepts a dictionary of key-value pairs which will be initially " "put in the ``DEFAULT`` section. This makes for an elegant way to support " @@ -702,17 +734,17 @@ msgid "" "the documented default." msgstr "" -#: ../../library/configparser.rst:498 +#: ../../library/configparser.rst:524 msgid "" "Hint: if you want to specify default values for a specific section, use :" "meth:`~ConfigParser.read_dict` before you read the actual file." msgstr "" -#: ../../library/configparser.rst:501 +#: ../../library/configparser.rst:527 msgid "*dict_type*, default value: :class:`dict`" msgstr "" -#: ../../library/configparser.rst:503 +#: ../../library/configparser.rst:529 msgid "" "This option has a major impact on how the mapping protocol will behave and " "how the written configuration files look. With the standard dictionary, " @@ -720,20 +752,20 @@ msgid "" "goes for options within sections." msgstr "" -#: ../../library/configparser.rst:508 +#: ../../library/configparser.rst:534 msgid "" "An alternative dictionary type can be used for example to sort sections and " "options on write-back." msgstr "" -#: ../../library/configparser.rst:511 +#: ../../library/configparser.rst:537 msgid "" "Please note: there are ways to add a set of key-value pairs in a single " "operation. When you use a regular dictionary in those operations, the order " "of the keys will be ordered. For example:" msgstr "" -#: ../../library/configparser.rst:515 +#: ../../library/configparser.rst:541 msgid "" ">>> parser = configparser.ConfigParser()\n" ">>> parser.read_dict({'section1': {'key1': 'value1',\n" @@ -767,11 +799,11 @@ msgstr "" ">>> [option for option in parser['section3']]\n" "['foo', 'bar', 'baz']" -#: ../../library/configparser.rst:533 +#: ../../library/configparser.rst:559 msgid "*allow_no_value*, default value: ``False``" msgstr "" -#: ../../library/configparser.rst:535 +#: ../../library/configparser.rst:561 msgid "" "Some configuration files are known to include settings without values, but " "which otherwise conform to the syntax supported by :mod:`configparser`. The " @@ -779,7 +811,7 @@ msgid "" "such values should be accepted:" msgstr "" -#: ../../library/configparser.rst:540 +#: ../../library/configparser.rst:566 msgid "" ">>> import configparser\n" "\n" @@ -810,32 +842,32 @@ msgid "" "KeyError: 'does-not-exist'" msgstr "" -#: ../../library/configparser.rst:570 +#: ../../library/configparser.rst:596 msgid "*delimiters*, default value: ``('=', ':')``" msgstr "" -#: ../../library/configparser.rst:572 +#: ../../library/configparser.rst:598 msgid "" "Delimiters are substrings that delimit keys from values within a section. " "The first occurrence of a delimiting substring on a line is considered a " "delimiter. This means values (but not keys) can contain the delimiters." msgstr "" -#: ../../library/configparser.rst:576 +#: ../../library/configparser.rst:602 msgid "" "See also the *space_around_delimiters* argument to :meth:`ConfigParser." "write`." msgstr "" -#: ../../library/configparser.rst:579 +#: ../../library/configparser.rst:605 msgid "*comment_prefixes*, default value: ``('#', ';')``" msgstr "" -#: ../../library/configparser.rst:581 +#: ../../library/configparser.rst:607 msgid "*inline_comment_prefixes*, default value: ``None``" msgstr "" -#: ../../library/configparser.rst:583 +#: ../../library/configparser.rst:609 msgid "" "Comment prefixes are strings that indicate the start of a valid comment " "within a config file. *comment_prefixes* are used only on otherwise empty " @@ -845,13 +877,13 @@ msgid "" "used as prefixes for whole line comments." msgstr "" -#: ../../library/configparser.rst:590 +#: ../../library/configparser.rst:616 msgid "" "In previous versions of :mod:`configparser` behaviour matched " "``comment_prefixes=('#',';')`` and ``inline_comment_prefixes=(';',)``." msgstr "" -#: ../../library/configparser.rst:594 +#: ../../library/configparser.rst:620 msgid "" "Please note that config parsers don't support escaping of comment prefixes " "so using *inline_comment_prefixes* may prevent users from specifying option " @@ -861,7 +893,7 @@ msgid "" "values is to interpolate the prefix, for example::" msgstr "" -#: ../../library/configparser.rst:601 +#: ../../library/configparser.rst:627 msgid "" ">>> from configparser import ConfigParser, ExtendedInterpolation\n" ">>> parser = ConfigParser(interpolation=ExtendedInterpolation())\n" @@ -903,11 +935,11 @@ msgid "" "line #3" msgstr "" -#: ../../library/configparser.rst:640 +#: ../../library/configparser.rst:666 msgid "*strict*, default value: ``True``" msgstr "" -#: ../../library/configparser.rst:642 +#: ../../library/configparser.rst:668 msgid "" "When set to ``True``, the parser will not allow for any section or option " "duplicates while reading from a single source (using :meth:`~ConfigParser." @@ -915,17 +947,17 @@ msgid "" "read_dict`). It is recommended to use strict parsers in new applications." msgstr "" -#: ../../library/configparser.rst:647 +#: ../../library/configparser.rst:673 msgid "" "In previous versions of :mod:`configparser` behaviour matched " "``strict=False``." msgstr "" -#: ../../library/configparser.rst:651 +#: ../../library/configparser.rst:677 msgid "*empty_lines_in_values*, default value: ``True``" msgstr "" -#: ../../library/configparser.rst:653 +#: ../../library/configparser.rst:679 msgid "" "In config parsers, values can span multiple lines as long as they are " "indented more than the key that holds them. By default parsers also let " @@ -935,7 +967,7 @@ msgid "" "lose track of the file structure. Take for instance:" msgstr "" -#: ../../library/configparser.rst:660 +#: ../../library/configparser.rst:686 msgid "" "[Section]\n" "key = multiline\n" @@ -944,7 +976,7 @@ msgid "" " this = is still a part of the multiline value of 'key'" msgstr "" -#: ../../library/configparser.rst:668 +#: ../../library/configparser.rst:694 msgid "" "This can be especially problematic for the user to see if she's using a " "proportional font to edit the file. That is why when your application does " @@ -953,13 +985,13 @@ msgid "" "would produce two keys, ``key`` and ``this``." msgstr "" -#: ../../library/configparser.rst:674 +#: ../../library/configparser.rst:700 msgid "" "*default_section*, default value: ``configparser.DEFAULTSECT`` (that is: " "``\"DEFAULT\"``)" msgstr "" -#: ../../library/configparser.rst:677 +#: ../../library/configparser.rst:703 msgid "" "The convention of allowing a special section of default values for other " "sections or interpolation purposes is a powerful concept of this library, " @@ -973,11 +1005,11 @@ msgid "" "files from one format to another)." msgstr "" -#: ../../library/configparser.rst:688 +#: ../../library/configparser.rst:714 msgid "*interpolation*, default value: ``configparser.BasicInterpolation``" msgstr "" -#: ../../library/configparser.rst:690 +#: ../../library/configparser.rst:716 msgid "" "Interpolation behaviour may be customized by providing a custom handler " "through the *interpolation* argument. ``None`` can be used to turn off " @@ -987,11 +1019,11 @@ msgid "" "`RawConfigParser` has a default value of ``None``." msgstr "" -#: ../../library/configparser.rst:697 +#: ../../library/configparser.rst:723 msgid "*converters*, default value: not set" msgstr "" -#: ../../library/configparser.rst:699 +#: ../../library/configparser.rst:725 msgid "" "Config parsers provide option value getters that perform type conversion. " "By default :meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat`, " @@ -1005,7 +1037,7 @@ msgid "" "``parser_instance['section'].getdecimal('key', 0)``." msgstr "" -#: ../../library/configparser.rst:710 +#: ../../library/configparser.rst:736 msgid "" "If the converter needs to access the state of the parser, it can be " "implemented as a method on a config parser subclass. If the name of this " @@ -1013,14 +1045,14 @@ msgid "" "the dict-compatible form (see the ``getdecimal()`` example above)." msgstr "" -#: ../../library/configparser.rst:715 +#: ../../library/configparser.rst:741 msgid "" "More advanced customization may be achieved by overriding default values of " "these parser attributes. The defaults are defined on the classes, so they " "may be overridden by subclasses or by attribute assignment." msgstr "" -#: ../../library/configparser.rst:721 +#: ../../library/configparser.rst:747 msgid "" "By default when using :meth:`~ConfigParser.getboolean`, config parsers " "consider the following values ``True``: ``'1'``, ``'yes'``, ``'true'``, " @@ -1029,7 +1061,7 @@ msgid "" "strings and their Boolean outcomes. For example:" msgstr "" -#: ../../library/configparser.rst:727 +#: ../../library/configparser.rst:753 msgid "" ">>> custom = configparser.ConfigParser()\n" ">>> custom['section1'] = {'funky': 'nope'}\n" @@ -1051,13 +1083,13 @@ msgstr "" ">>> custom['section1'].getboolean('funky')\n" "False" -#: ../../library/configparser.rst:739 +#: ../../library/configparser.rst:765 msgid "" "Other typical Boolean pairs include ``accept``/``reject`` or ``enabled``/" "``disabled``." msgstr "" -#: ../../library/configparser.rst:745 +#: ../../library/configparser.rst:771 msgid "" "This method transforms option names on every read, get, or set operation. " "The default converts the name to lowercase. This also means that when a " @@ -1065,7 +1097,7 @@ msgid "" "method if that's unsuitable. For example:" msgstr "" -#: ../../library/configparser.rst:751 +#: ../../library/configparser.rst:777 msgid "" ">>> config = \"\"\"\n" "... [Section1]\n" @@ -1109,14 +1141,14 @@ msgstr "" ">>> list(custom['Section2'].keys())\n" "['AnotherKey']" -#: ../../library/configparser.rst:775 +#: ../../library/configparser.rst:801 msgid "" "The optionxform function transforms option names to a canonical form. This " "should be an idempotent function: if the name is already in canonical form, " "it should be returned unchanged." msgstr "" -#: ../../library/configparser.rst:782 +#: ../../library/configparser.rst:808 msgid "" "A compiled regular expression used to parse section headers. The default " "matches ``[section]`` to the name ``\"section\"``. Whitespace is considered " @@ -1125,7 +1157,7 @@ msgid "" "example:" msgstr "" -#: ../../library/configparser.rst:788 +#: ../../library/configparser.rst:814 msgid "" ">>> import re\n" ">>> config = \"\"\"\n" @@ -1163,18 +1195,18 @@ msgstr "" ">>> custom.sections()\n" "['Section 1', 'Section 2']" -#: ../../library/configparser.rst:810 +#: ../../library/configparser.rst:836 msgid "" "While ConfigParser objects also use an ``OPTCRE`` attribute for recognizing " "option lines, it's not recommended to override it because that would " "interfere with constructor options *allow_no_value* and *delimiters*." msgstr "" -#: ../../library/configparser.rst:816 +#: ../../library/configparser.rst:842 msgid "Legacy API Examples" msgstr "" -#: ../../library/configparser.rst:818 +#: ../../library/configparser.rst:844 msgid "" "Mainly because of backwards compatibility concerns, :mod:`configparser` " "provides also a legacy API with explicit ``get``/``set`` methods. While " @@ -1183,11 +1215,11 @@ msgid "" "advanced, low-level and downright counterintuitive." msgstr "" -#: ../../library/configparser.rst:824 +#: ../../library/configparser.rst:850 msgid "An example of writing to a configuration file::" msgstr "" -#: ../../library/configparser.rst:826 +#: ../../library/configparser.rst:852 msgid "" "import configparser\n" "\n" @@ -1211,11 +1243,11 @@ msgid "" " config.write(configfile)" msgstr "" -#: ../../library/configparser.rst:847 +#: ../../library/configparser.rst:873 msgid "An example of reading the configuration file again::" msgstr "" -#: ../../library/configparser.rst:849 +#: ../../library/configparser.rst:875 msgid "" "import configparser\n" "\n" @@ -1234,11 +1266,11 @@ msgid "" " print(config.get('Section1', 'foo'))" msgstr "" -#: ../../library/configparser.rst:865 +#: ../../library/configparser.rst:891 msgid "To get interpolation, use :class:`ConfigParser`::" msgstr "" -#: ../../library/configparser.rst:867 +#: ../../library/configparser.rst:893 msgid "" "import configparser\n" "\n" @@ -1273,13 +1305,13 @@ msgid "" " # -> None" msgstr "" -#: ../../library/configparser.rst:898 +#: ../../library/configparser.rst:924 msgid "" "Default values are available in both types of ConfigParsers. They are used " "in interpolation if an option used is not defined elsewhere. ::" msgstr "" -#: ../../library/configparser.rst:901 +#: ../../library/configparser.rst:927 msgid "" "import configparser\n" "\n" @@ -1293,11 +1325,11 @@ msgid "" "print(config.get('Section1', 'foo')) # -> \"Life is hard!\"" msgstr "" -#: ../../library/configparser.rst:916 +#: ../../library/configparser.rst:942 msgid "ConfigParser Objects" msgstr "ConfigParser 物件" -#: ../../library/configparser.rst:920 +#: ../../library/configparser.rst:946 msgid "" "The main configuration parser. When *defaults* is given, it is initialized " "into the dictionary of intrinsic defaults. When *dict_type* is given, it " @@ -1305,7 +1337,7 @@ msgid "" "the options within a section, and for the default values." msgstr "" -#: ../../library/configparser.rst:925 +#: ../../library/configparser.rst:951 msgid "" "When *delimiters* is given, it is used as the set of substrings that divide " "keys from values. When *comment_prefixes* is given, it will be used as the " @@ -1314,7 +1346,7 @@ msgid "" "as the set of substrings that prefix comments in non-empty lines." msgstr "" -#: ../../library/configparser.rst:931 +#: ../../library/configparser.rst:957 msgid "" "When *strict* is ``True`` (the default), the parser won't allow for any " "section or option duplicates while reading from a single source (file, " @@ -1327,7 +1359,7 @@ msgid "" "without the trailing delimiter." msgstr "" -#: ../../library/configparser.rst:941 +#: ../../library/configparser.rst:967 msgid "" "When *default_section* is given, it specifies the name for the special " "section holding default values for other sections and interpolation purposes " @@ -1337,7 +1369,7 @@ msgid "" "settings to a new config file." msgstr "" -#: ../../library/configparser.rst:948 +#: ../../library/configparser.rst:974 msgid "" "Interpolation behaviour may be customized by providing a custom handler " "through the *interpolation* argument. ``None`` can be used to turn off " @@ -1346,7 +1378,7 @@ msgid "" "`dedicated documentation section <#interpolation-of-values>`_." msgstr "" -#: ../../library/configparser.rst:954 +#: ../../library/configparser.rst:980 msgid "" "All option names used in interpolation will be passed through the :meth:" "`optionxform` method just like any other option name reference. For " @@ -1355,7 +1387,7 @@ msgid "" "%(BAR)s`` are equivalent." msgstr "" -#: ../../library/configparser.rst:960 +#: ../../library/configparser.rst:986 msgid "" "When *converters* is given, it should be a dictionary where each key " "represents the name of a type converter and each value is a callable " @@ -1364,44 +1396,50 @@ msgid "" "object and section proxies." msgstr "" -#: ../../library/configparser.rst:991 +#: ../../library/configparser.rst:1017 msgid "The default *dict_type* is :class:`collections.OrderedDict`." msgstr "" -#: ../../library/configparser.rst:994 +#: ../../library/configparser.rst:1020 msgid "" "*allow_no_value*, *delimiters*, *comment_prefixes*, *strict*, " "*empty_lines_in_values*, *default_section* and *interpolation* were added." msgstr "" -#: ../../library/configparser.rst:999 +#: ../../library/configparser.rst:1025 msgid "The *converters* argument was added." msgstr "新增 *converters* 引數。" -#: ../../library/configparser.rst:1002 +#: ../../library/configparser.rst:1028 msgid "" "The *defaults* argument is read with :meth:`read_dict`, providing consistent " "behavior across the parser: non-string keys and values are implicitly " "converted to strings." msgstr "" -#: ../../library/configparser.rst:1007 ../../library/configparser.rst:1270 +#: ../../library/configparser.rst:1033 ../../library/configparser.rst:1305 msgid "" "The default *dict_type* is :class:`dict`, since it now preserves insertion " "order." msgstr "" -#: ../../library/configparser.rst:1013 +#: ../../library/configparser.rst:1037 +msgid "" +"Raise a :exc:`MultilineContinuationError` when *allow_no_value* is ``True``, " +"and a key without a value is continued with an indented line." +msgstr "" + +#: ../../library/configparser.rst:1043 msgid "Return a dictionary containing the instance-wide defaults." msgstr "" -#: ../../library/configparser.rst:1018 +#: ../../library/configparser.rst:1048 msgid "" "Return a list of the sections available; the *default section* is not " "included in the list." msgstr "" -#: ../../library/configparser.rst:1024 +#: ../../library/configparser.rst:1054 msgid "" "Add a section named *section* to the instance. If a section by the given " "name already exists, :exc:`DuplicateSectionError` is raised. If the " @@ -1409,34 +1447,34 @@ msgid "" "the section must be a string; if not, :exc:`TypeError` is raised." msgstr "" -#: ../../library/configparser.rst:1029 +#: ../../library/configparser.rst:1059 msgid "Non-string section names raise :exc:`TypeError`." msgstr "" -#: ../../library/configparser.rst:1035 +#: ../../library/configparser.rst:1065 msgid "" "Indicates whether the named *section* is present in the configuration. The " "*default section* is not acknowledged." msgstr "" -#: ../../library/configparser.rst:1041 +#: ../../library/configparser.rst:1071 msgid "Return a list of options available in the specified *section*." msgstr "" -#: ../../library/configparser.rst:1046 +#: ../../library/configparser.rst:1076 msgid "" "If the given *section* exists, and contains the given *option*, return :" "const:`True`; otherwise return :const:`False`. If the specified *section* " "is :const:`None` or an empty string, DEFAULT is assumed." msgstr "" -#: ../../library/configparser.rst:1053 +#: ../../library/configparser.rst:1083 msgid "" "Attempt to read and parse an iterable of filenames, returning a list of " "filenames which were successfully parsed." msgstr "" -#: ../../library/configparser.rst:1056 +#: ../../library/configparser.rst:1086 msgid "" "If *filenames* is a string, a :class:`bytes` object or a :term:`path-like " "object`, it is treated as a single filename. If a file named in *filenames* " @@ -1447,7 +1485,7 @@ msgid "" "be read." msgstr "" -#: ../../library/configparser.rst:1065 +#: ../../library/configparser.rst:1095 msgid "" "If none of the named files exist, the :class:`ConfigParser` instance will " "contain an empty dataset. An application which requires initial values to " @@ -1455,7 +1493,7 @@ msgid "" "`read_file` before calling :meth:`read` for any optional files::" msgstr "" -#: ../../library/configparser.rst:1071 +#: ../../library/configparser.rst:1101 msgid "" "import configparser, os\n" "\n" @@ -1471,49 +1509,49 @@ msgstr "" "config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')],\n" " encoding='cp1250')" -#: ../../library/configparser.rst:1078 +#: ../../library/configparser.rst:1108 msgid "" "Added the *encoding* parameter. Previously, all files were read using the " "default encoding for :func:`open`." msgstr "" -#: ../../library/configparser.rst:1082 +#: ../../library/configparser.rst:1112 msgid "The *filenames* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/configparser.rst:1085 +#: ../../library/configparser.rst:1115 msgid "The *filenames* parameter accepts a :class:`bytes` object." msgstr "" -#: ../../library/configparser.rst:1091 +#: ../../library/configparser.rst:1121 msgid "" "Read and parse configuration data from *f* which must be an iterable " "yielding Unicode strings (for example files opened in text mode)." msgstr "" -#: ../../library/configparser.rst:1094 +#: ../../library/configparser.rst:1124 msgid "" "Optional argument *source* specifies the name of the file being read. If " "not given and *f* has a :attr:`!name` attribute, that is used for *source*; " "the default is ``''``." msgstr "" -#: ../../library/configparser.rst:1098 +#: ../../library/configparser.rst:1128 msgid "Replaces :meth:`!readfp`." msgstr "取代 :meth:`!readfp`。" -#: ../../library/configparser.rst:1103 +#: ../../library/configparser.rst:1133 msgid "Parse configuration data from a string." msgstr "" -#: ../../library/configparser.rst:1105 +#: ../../library/configparser.rst:1135 msgid "" "Optional argument *source* specifies a context-specific name of the string " "passed. If not given, ``''`` is used. This should commonly be a " "filesystem path or a URL." msgstr "" -#: ../../library/configparser.rst:1114 +#: ../../library/configparser.rst:1144 msgid "" "Load configuration from any object that provides a dict-like ``items()`` " "method. Keys are section names, values are dictionaries with keys and " @@ -1522,17 +1560,17 @@ msgid "" "automatically converted to strings." msgstr "" -#: ../../library/configparser.rst:1120 +#: ../../library/configparser.rst:1150 msgid "" "Optional argument *source* specifies a context-specific name of the " "dictionary passed. If not given, ```` is used." msgstr "" -#: ../../library/configparser.rst:1123 +#: ../../library/configparser.rst:1153 msgid "This method can be used to copy state between parsers." msgstr "" -#: ../../library/configparser.rst:1130 +#: ../../library/configparser.rst:1160 msgid "" "Get an *option* value for the named *section*. If *vars* is provided, it " "must be a dictionary. The *option* is looked up in *vars* (if provided), " @@ -1541,35 +1579,35 @@ msgid "" "provided as a *fallback* value." msgstr "" -#: ../../library/configparser.rst:1136 +#: ../../library/configparser.rst:1166 msgid "" "All the ``'%'`` interpolations are expanded in the return values, unless the " "*raw* argument is true. Values for interpolation keys are looked up in the " "same manner as the option." msgstr "" -#: ../../library/configparser.rst:1140 +#: ../../library/configparser.rst:1170 msgid "" "Arguments *raw*, *vars* and *fallback* are keyword only to protect users " "from trying to use the third argument as the *fallback* fallback (especially " "when using the mapping protocol)." msgstr "" -#: ../../library/configparser.rst:1148 +#: ../../library/configparser.rst:1178 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to an integer. See :meth:`get` for explanation of *raw*, *vars* and " "*fallback*." msgstr "" -#: ../../library/configparser.rst:1155 +#: ../../library/configparser.rst:1185 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a floating-point number. See :meth:`get` for explanation of *raw*, " "*vars* and *fallback*." msgstr "" -#: ../../library/configparser.rst:1162 +#: ../../library/configparser.rst:1192 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a Boolean value. Note that the accepted values for the option are " @@ -1581,34 +1619,34 @@ msgid "" "*fallback*." msgstr "" -#: ../../library/configparser.rst:1175 +#: ../../library/configparser.rst:1205 msgid "" "When *section* is not given, return a list of *section_name*, " "*section_proxy* pairs, including DEFAULTSECT." msgstr "" -#: ../../library/configparser.rst:1178 +#: ../../library/configparser.rst:1208 msgid "" "Otherwise, return a list of *name*, *value* pairs for the options in the " "given *section*. Optional arguments have the same meaning as for the :meth:" "`get` method." msgstr "" -#: ../../library/configparser.rst:1182 +#: ../../library/configparser.rst:1212 msgid "" "Items present in *vars* no longer appear in the result. The previous " "behaviour mixed actual parser options with variables provided for " "interpolation." msgstr "" -#: ../../library/configparser.rst:1190 +#: ../../library/configparser.rst:1220 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. *option* and *value* must be " "strings; if not, :exc:`TypeError` is raised." msgstr "" -#: ../../library/configparser.rst:1197 +#: ../../library/configparser.rst:1227 msgid "" "Write a representation of the configuration to the specified :term:`file " "object`, which must be opened in text mode (accepting strings). This " @@ -1617,27 +1655,27 @@ msgid "" "surrounded by spaces." msgstr "" -#: ../../library/configparser.rst:1205 +#: ../../library/configparser.rst:1235 msgid "" "Comments in the original configuration file are not preserved when writing " "the configuration back. What is considered a comment, depends on the given " "values for *comment_prefix* and *inline_comment_prefix*." msgstr "" -#: ../../library/configparser.rst:1213 +#: ../../library/configparser.rst:1243 msgid "" "Remove the specified *option* from the specified *section*. If the section " "does not exist, raise :exc:`NoSectionError`. If the option existed to be " "removed, return :const:`True`; otherwise return :const:`False`." msgstr "" -#: ../../library/configparser.rst:1221 +#: ../../library/configparser.rst:1251 msgid "" "Remove the specified *section* from the configuration. If the section in " "fact existed, return ``True``. Otherwise return ``False``." msgstr "" -#: ../../library/configparser.rst:1227 +#: ../../library/configparser.rst:1257 msgid "" "Transforms the option name *option* as found in an input file or as passed " "in by client code to the form that should be used in the internal " @@ -1646,7 +1684,7 @@ msgid "" "of this name on instances to affect this behavior." msgstr "" -#: ../../library/configparser.rst:1233 +#: ../../library/configparser.rst:1263 msgid "" "You don't need to subclass the parser to use this method, you can also set " "it on an instance, to a function that takes a string argument and returns a " @@ -1654,7 +1692,7 @@ msgid "" "sensitive::" msgstr "" -#: ../../library/configparser.rst:1238 +#: ../../library/configparser.rst:1268 msgid "" "cfgparser = ConfigParser()\n" "cfgparser.optionxform = str" @@ -1662,24 +1700,30 @@ msgstr "" "cfgparser = ConfigParser()\n" "cfgparser.optionxform = str" -#: ../../library/configparser.rst:1241 +#: ../../library/configparser.rst:1271 msgid "" "Note that when reading configuration files, whitespace around the option " "names is stripped before :meth:`optionxform` is called." msgstr "" -#: ../../library/configparser.rst:1247 +#: ../../library/configparser.rst:1277 +msgid "" +"A special object representing a section name used to reference the unnamed " +"section (see :ref:`unnamed-sections`)." +msgstr "" + +#: ../../library/configparser.rst:1282 msgid "" "The maximum depth for recursive interpolation for :meth:`~configparser." "ConfigParser.get` when the *raw* parameter is false. This is relevant only " "when the default *interpolation* is used." msgstr "" -#: ../../library/configparser.rst:1255 +#: ../../library/configparser.rst:1290 msgid "RawConfigParser Objects" msgstr "RawConfigParser 物件" -#: ../../library/configparser.rst:1265 +#: ../../library/configparser.rst:1300 msgid "" "Legacy variant of the :class:`ConfigParser`. It has interpolation disabled " "by default and allows for non-string section names, option names, and values " @@ -1687,27 +1731,27 @@ msgid "" "``defaults=`` keyword argument handling." msgstr "" -#: ../../library/configparser.rst:1275 +#: ../../library/configparser.rst:1310 msgid "" "Consider using :class:`ConfigParser` instead which checks types of the " "values to be stored internally. If you don't want interpolation, you can " "use ``ConfigParser(interpolation=None)``." msgstr "" -#: ../../library/configparser.rst:1282 +#: ../../library/configparser.rst:1317 msgid "" "Add a section named *section* to the instance. If a section by the given " "name already exists, :exc:`DuplicateSectionError` is raised. If the " "*default section* name is passed, :exc:`ValueError` is raised." msgstr "" -#: ../../library/configparser.rst:1286 +#: ../../library/configparser.rst:1321 msgid "" "Type of *section* is not checked which lets users create non-string named " "sections. This behaviour is unsupported and may cause internal errors." msgstr "" -#: ../../library/configparser.rst:1292 +#: ../../library/configparser.rst:1327 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. While it is possible to use :class:" @@ -1717,7 +1761,7 @@ msgid "" "string values." msgstr "" -#: ../../library/configparser.rst:1299 +#: ../../library/configparser.rst:1334 msgid "" "This method lets users assign non-string values to keys internally. This " "behaviour is unsupported and will cause errors when attempting to write to a " @@ -1725,32 +1769,32 @@ msgid "" "not allow such assignments to take place." msgstr "" -#: ../../library/configparser.rst:1306 +#: ../../library/configparser.rst:1341 msgid "Exceptions" msgstr "例外" -#: ../../library/configparser.rst:1310 +#: ../../library/configparser.rst:1345 msgid "Base class for all other :mod:`configparser` exceptions." msgstr "" -#: ../../library/configparser.rst:1315 +#: ../../library/configparser.rst:1350 msgid "Exception raised when a specified section is not found." msgstr "" -#: ../../library/configparser.rst:1320 +#: ../../library/configparser.rst:1355 msgid "" "Exception raised if :meth:`~ConfigParser.add_section` is called with the " "name of a section that is already present or in strict parsers when a " "section if found more than once in a single input file, string or dictionary." msgstr "" -#: ../../library/configparser.rst:1324 +#: ../../library/configparser.rst:1359 msgid "" "Added the optional *source* and *lineno* attributes and parameters to :meth:" "`!__init__`." msgstr "" -#: ../../library/configparser.rst:1331 +#: ../../library/configparser.rst:1366 msgid "" "Exception raised by strict parsers if a single option appears twice during " "reading from a single file, string or dictionary. This catches misspellings " @@ -1758,58 +1802,64 @@ msgid "" "representing the same case-insensitive configuration key." msgstr "" -#: ../../library/configparser.rst:1339 +#: ../../library/configparser.rst:1374 msgid "" "Exception raised when a specified option is not found in the specified " "section." msgstr "" -#: ../../library/configparser.rst:1345 +#: ../../library/configparser.rst:1380 msgid "" "Base class for exceptions raised when problems occur performing string " "interpolation." msgstr "" -#: ../../library/configparser.rst:1351 +#: ../../library/configparser.rst:1386 msgid "" "Exception raised when string interpolation cannot be completed because the " "number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass of :" "exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1358 +#: ../../library/configparser.rst:1393 msgid "" "Exception raised when an option referenced from a value does not exist. " "Subclass of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1364 +#: ../../library/configparser.rst:1399 msgid "" "Exception raised when the source text into which substitutions are made does " "not conform to the required syntax. Subclass of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1370 +#: ../../library/configparser.rst:1405 msgid "" "Exception raised when attempting to parse a file which has no section " "headers." msgstr "" -#: ../../library/configparser.rst:1376 +#: ../../library/configparser.rst:1411 msgid "Exception raised when errors occur attempting to parse a file." msgstr "" -#: ../../library/configparser.rst:1378 +#: ../../library/configparser.rst:1413 msgid "" "The ``filename`` attribute and :meth:`!__init__` constructor argument were " "removed. They have been available using the name ``source`` since 3.2." msgstr "" -#: ../../library/configparser.rst:1383 +#: ../../library/configparser.rst:1419 +msgid "" +"Exception raised when a key without a corresponding value is continued with " +"an indented line." +msgstr "" + +#: ../../library/configparser.rst:1425 msgid "Footnotes" msgstr "註解" -#: ../../library/configparser.rst:1384 +#: ../../library/configparser.rst:1426 msgid "" "Config parsers allow for heavy customization. If you are interested in " "changing the behaviour outlined by the footnote reference, consult the " @@ -1836,14 +1886,14 @@ msgstr "ini file(ini 檔案)" msgid "Windows ini file" msgstr "Windows ini file(Windows ini 檔案)" -#: ../../library/configparser.rst:340 +#: ../../library/configparser.rst:366 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/configparser.rst:340 ../../library/configparser.rst:373 +#: ../../library/configparser.rst:366 ../../library/configparser.rst:399 msgid "interpolation in configuration files" msgstr "interpolation in configuration files(設定檔中的插值)" -#: ../../library/configparser.rst:373 +#: ../../library/configparser.rst:399 msgid "$ (dollar)" msgstr "$ (金錢符號)" diff --git a/library/contextvars.po b/library/contextvars.po index 11e024b8ff..b90483b630 100644 --- a/library/contextvars.po +++ b/library/contextvars.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-11 21:40+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -329,7 +329,7 @@ msgid "" " # without passing it explicitly to this function.\n" "\n" " client_addr = client_addr_var.get()\n" -" return f'Good bye, client @ {client_addr}\\r\\n'.encode()\n" +" return f'Good bye, client @ {client_addr}\\n'.encode()\n" "\n" "async def handle_request(reader, writer):\n" " addr = writer.transport.get_extra_info('socket').getpeername()\n" @@ -343,10 +343,9 @@ msgid "" " print(line)\n" " if not line.strip():\n" " break\n" +" writer.write(line)\n" "\n" -" writer.write(b'HTTP/1.1 200 OK\\r\\n') # status line\n" -" writer.write(b'\\r\\n') # headers\n" -" writer.write(render_goodbye()) # body\n" +" writer.write(render_goodbye())\n" " writer.close()\n" "\n" "async def main():\n" @@ -358,7 +357,6 @@ msgid "" "\n" "asyncio.run(main())\n" "\n" -"# To test it you can use telnet or curl:\n" -"# telnet 127.0.0.1 8081\n" -"# curl 127.0.0.1:8081" +"# To test it you can use telnet:\n" +"# telnet 127.0.0.1 8081" msgstr "" diff --git a/library/copy.po b/library/copy.po index 166c566389..71812c86b4 100644 --- a/library/copy.po +++ b/library/copy.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-01-20 18:49+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -46,18 +46,26 @@ msgid "Interface summary:" msgstr "介面摘要:" #: ../../library/copy.rst:22 -msgid "Return a shallow copy of *x*." +#, fuzzy +msgid "Return a shallow copy of *obj*." msgstr "回傳 *x* 的淺層複製。" #: ../../library/copy.rst:27 -msgid "Return a deep copy of *x*." +#, fuzzy +msgid "Return a deep copy of *obj*." msgstr "回傳 *x* 的深層複製。" #: ../../library/copy.rst:32 +msgid "" +"Creates a new object of the same type as *obj*, replacing fields with values " +"from *changes*." +msgstr "" + +#: ../../library/copy.rst:40 msgid "Raised for module specific errors." msgstr "引發針對特定模組的錯誤。" -#: ../../library/copy.rst:36 +#: ../../library/copy.rst:44 msgid "" "The difference between shallow and deep copying is only relevant for " "compound objects (objects that contain other objects, like lists or class " @@ -66,7 +74,7 @@ msgstr "" "淺層與深層複製的區別僅與複合物件(即包含 list 或類別的實例等其他物件的物件)" "相關:" -#: ../../library/copy.rst:39 +#: ../../library/copy.rst:47 msgid "" "A *shallow copy* constructs a new compound object and then (to the extent " "possible) inserts *references* into it to the objects found in the original." @@ -74,7 +82,7 @@ msgstr "" "*淺層複製*\\ 建構一個新的複合物件,然後(在儘可能的範圍內)將原始物件中找到的" "物件的\\ *參照*\\ 插入其中。" -#: ../../library/copy.rst:42 +#: ../../library/copy.rst:50 msgid "" "A *deep copy* constructs a new compound object and then, recursively, " "inserts *copies* into it of the objects found in the original." @@ -82,19 +90,19 @@ msgstr "" "*深層複製*\\ 建構一個新的複合物件,然後遞迴地將在原始物件裡找到的物件的\\ *副" "本*\\ 插入其中。" -#: ../../library/copy.rst:45 +#: ../../library/copy.rst:53 msgid "" "Two problems often exist with deep copy operations that don't exist with " "shallow copy operations:" msgstr "深層複製操作通常存在兩個問題,而淺層複製操作並不存在這些問題:" -#: ../../library/copy.rst:48 +#: ../../library/copy.rst:56 msgid "" "Recursive objects (compound objects that, directly or indirectly, contain a " "reference to themselves) may cause a recursive loop." msgstr "遞迴物件(直接或間接包含對自身參照的複合物件)可能會導致遞迴迴圈。" -#: ../../library/copy.rst:51 +#: ../../library/copy.rst:59 msgid "" "Because deep copy copies everything it may copy too much, such as data which " "is intended to be shared between copies." @@ -102,23 +110,23 @@ msgstr "" "由於深層複製會複製所有內容,因此可能會有過多複製(例如應該在副本之間共享的資" "料)。" -#: ../../library/copy.rst:54 +#: ../../library/copy.rst:62 msgid "The :func:`deepcopy` function avoids these problems by:" msgstr ":func:`deepcopy` 函式用以下方式避免了這些問題:" -#: ../../library/copy.rst:56 +#: ../../library/copy.rst:64 msgid "" "keeping a ``memo`` dictionary of objects already copied during the current " "copying pass; and" msgstr "保留在當前複製過程中已複製的物件的 ``memo`` 字典;以及" -#: ../../library/copy.rst:59 +#: ../../library/copy.rst:67 msgid "" "letting user-defined classes override the copying operation or the set of " "components copied." msgstr "允許使用者定義的類別複寫 (override) 複製操作或複製的元件集合。" -#: ../../library/copy.rst:62 +#: ../../library/copy.rst:70 msgid "" "This module does not copy types like module, method, stack trace, stack " "frame, file, socket, window, or any similar types. It does \"copy\" " @@ -131,7 +139,7 @@ msgstr "" "(淺層或深層地)\"複製\"函式和類別;這與 :mod:`pickle` 模組處理這類問題的方式" "是相似的。" -#: ../../library/copy.rst:67 +#: ../../library/copy.rst:75 msgid "" "Shallow copies of dictionaries can be made using :meth:`dict.copy`, and of " "lists by assigning a slice of the entire list, for example, ``copied_list = " @@ -140,7 +148,7 @@ msgstr "" "字典的淺層複製可以使用 :meth:`dict.copy`\\,而 list 的淺層複製可以透過賦值整" "個 list 的切片 (slice) 完成,例如,``copied_list = original_list[:]``。" -#: ../../library/copy.rst:73 +#: ../../library/copy.rst:81 msgid "" "Classes can use the same interfaces to control copying that they use to " "control pickling. See the description of module :mod:`pickle` for " @@ -151,17 +159,26 @@ msgstr "" "參考 :mod:`pickle` 模組。實際上,:mod:`copy` 模組使用的正是從 :mod:`copyreg` " "模組中註冊的 pickle 函式。" -#: ../../library/copy.rst:82 +#: ../../library/copy.rst:92 msgid "" "In order for a class to define its own copy implementation, it can define " -"special methods :meth:`__copy__` and :meth:`__deepcopy__`. The former is " -"called to implement the shallow copy operation; no additional arguments are " -"passed. The latter is called to implement the deep copy operation; it is " -"passed one argument, the ``memo`` dictionary. If the :meth:`__deepcopy__` " -"implementation needs to make a deep copy of a component, it should call the :" -"func:`deepcopy` function with the component as first argument and the memo " -"dictionary as second argument. The memo dictionary should be treated as an " -"opaque object." +"special methods :meth:`~object.__copy__` and :meth:`~object.__deepcopy__`." +msgstr "" + +#: ../../library/copy.rst:98 +msgid "" +"Called to implement the shallow copy operation; no additional arguments are " +"passed." +msgstr "" + +#: ../../library/copy.rst:104 +#, fuzzy +msgid "" +"Called to implement the deep copy operation; it is passed one argument, the " +"*memo* dictionary. If the ``__deepcopy__`` implementation needs to make a " +"deep copy of a component, it should call the :func:`~copy.deepcopy` function " +"with the component as first argument and the *memo* dictionary as second " +"argument. The *memo* dictionary should be treated as an opaque object." msgstr "" "想要為一個類別定義它自己的複製操作實作,可以透過定義特殊方法 :meth:" "`__copy__` 和 :meth:`__deepcopy__`。呼叫前者以實現淺層複製操作;不必傳入額外" @@ -170,11 +187,25 @@ msgstr "" "`deepcopy` 函式並以該元件作為第一個引數、以該 memo 字典作為第二個引數。memo " "字典應當被當作不透明物件 (opaque object) 來處理。" -#: ../../library/copy.rst:94 +#: ../../library/copy.rst:114 +msgid "" +"Function :func:`!copy.replace` is more limited than :func:`~copy.copy` and :" +"func:`~copy.deepcopy`, and only supports named tuples created by :func:" +"`~collections.namedtuple`, :mod:`dataclasses`, and other classes which " +"define method :meth:`~object.__replace__`." +msgstr "" + +#: ../../library/copy.rst:122 +msgid "" +"This method should create a new object of the same type, replacing fields " +"with values from *changes*." +msgstr "" + +#: ../../library/copy.rst:128 msgid "Module :mod:`pickle`" msgstr ":mod:`pickle` 模組" -#: ../../library/copy.rst:95 +#: ../../library/copy.rst:129 msgid "" "Discussion of the special methods used to support object state retrieval and " "restoration." @@ -182,18 +213,23 @@ msgstr "" "支援物件之狀態檢索 (state retrieval) 和恢復 (restoration) 相關特殊方法的討" "論。" -#: ../../library/copy.rst:71 +#: ../../library/copy.rst:79 msgid "module" msgstr "module(模組)" -#: ../../library/copy.rst:71 +#: ../../library/copy.rst:79 msgid "pickle" msgstr "pickle" -#: ../../library/copy.rst:78 +#: ../../library/copy.rst:86 msgid "__copy__() (copy protocol)" msgstr "__copy__() (複製協定)" -#: ../../library/copy.rst:78 +#: ../../library/copy.rst:86 msgid "__deepcopy__() (copy protocol)" msgstr "__deepcopy__() (複製協定)" + +#: ../../library/copy.rst:111 +#, fuzzy +msgid "__replace__() (replace protocol)" +msgstr "__deepcopy__() (複製協定)" diff --git a/library/crypto.po b/library/crypto.po index cfbe820b88..fcccdac384 100644 --- a/library/crypto.po +++ b/library/crypto.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-02-15 18:06+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -24,11 +24,11 @@ msgid "Cryptographic Services" msgstr "加密服務" #: ../../library/crypto.rst:9 +#, fuzzy msgid "" "The modules described in this chapter implement various algorithms of a " "cryptographic nature. They are available at the discretion of the " -"installation. On Unix systems, the :mod:`crypt` module may also be " -"available. Here's an overview:" +"installation. Here's an overview:" msgstr "" "本章所描述的模組 (module) 實作了多種加密演算法。它們可以在安裝時選擇是否一同" "安裝。在 Unix 系統上,:mod:`crypt` 模組也有機會能夠被使用。以下為概述:" diff --git a/library/ctypes.po b/library/ctypes.po index ab06366040..048c245976 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-14 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-04-26 02:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -83,8 +83,8 @@ msgstr "" #: ../../library/ctypes.rst:53 msgid "" "Here are some examples for Windows. Note that ``msvcrt`` is the MS standard " -"C library containing most standard C functions, and uses the ``cdecl`` " -"calling convention::" +"C library containing most standard C functions, and uses the cdecl calling " +"convention::" msgstr "" #: ../../library/ctypes.rst:57 @@ -366,7 +366,7 @@ msgid "" "calls. ``None`` is passed as a C ``NULL`` pointer, bytes objects and strings " "are passed as pointer to the memory block that contains their data (:c:expr:" "`char *` or :c:expr:`wchar_t *`). Python integers are passed as the " -"platforms default C :c:expr:`int` type, their value is masked to fit into " +"platform's default C :c:expr:`int` type, their value is masked to fit into " "the C type." msgstr "" @@ -376,7 +376,7 @@ msgid "" "learn more about :mod:`ctypes` data types." msgstr "" -#: ../../library/ctypes.rst:212 ../../library/ctypes.rst:2198 +#: ../../library/ctypes.rst:212 ../../library/ctypes.rst:2203 msgid "Fundamental data types" msgstr "" @@ -740,6 +740,7 @@ msgid "" msgstr "" #: ../../library/ctypes.rst:351 +#, fuzzy msgid "" ">>> printf = libc.printf\n" ">>> printf(b\"Hello, %s\\n\", b\"World!\")\n" @@ -754,7 +755,8 @@ msgid "" ">>> printf(b\"%f bottles of beer\\n\", 42.5)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -"ArgumentError: argument 2: TypeError: Don't know how to convert parameter 2\n" +"ctypes.ArgumentError: argument 2: TypeError: Don't know how to convert " +"parameter 2\n" ">>>" msgstr "" ">>> printf = libc.printf\n" @@ -904,11 +906,13 @@ msgid "" msgstr "" #: ../../library/ctypes.rst:445 +#, fuzzy msgid "" ">>> printf(b\"%d %d %d\", 1, 2, 3)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -"ArgumentError: argument 2: TypeError: wrong type\n" +"ctypes.ArgumentError: argument 2: TypeError: 'int' object cannot be " +"interpreted as ctypes.c_char_p\n" ">>> printf(b\"%s %d %f\\n\", b\"X\", 2, 3)\n" "X 2 3.000000\n" "13\n" @@ -1304,10 +1308,14 @@ msgid "" "compiler does it. It is possible to override this behavior by specifying a :" "attr:`~Structure._pack_` class attribute in the subclass definition. This " "must be set to a positive integer and specifies the maximum alignment for " -"the fields. This is what ``#pragma pack(n)`` also does in MSVC." +"the fields. This is what ``#pragma pack(n)`` also does in MSVC. It is also " +"possible to set a minimum alignment for how the subclass itself is packed in " +"the same way ``#pragma align(n)`` works in MSVC. This can be achieved by " +"specifying a ::attr:`~Structure._align_` class attribute in the subclass " +"definition." msgstr "" -#: ../../library/ctypes.rst:673 +#: ../../library/ctypes.rst:677 msgid "" ":mod:`ctypes` uses the native byte order for Structures and Unions. To " "build structures with non-native byte order, you can use one of the :class:" @@ -1316,18 +1324,18 @@ msgid "" "classes cannot contain pointer fields." msgstr "" -#: ../../library/ctypes.rst:683 +#: ../../library/ctypes.rst:687 msgid "Bit fields in structures and unions" msgstr "" -#: ../../library/ctypes.rst:685 +#: ../../library/ctypes.rst:689 msgid "" "It is possible to create structures and unions containing bit fields. Bit " "fields are only possible for integer fields, the bit width is specified as " "the third item in the :attr:`~Structure._fields_` tuples::" msgstr "" -#: ../../library/ctypes.rst:689 +#: ../../library/ctypes.rst:693 msgid "" ">>> class Int(Structure):\n" "... _fields_ = [(\"first_16\", c_int, 16),\n" @@ -1349,33 +1357,33 @@ msgstr "" "\n" ">>>" -#: ../../library/ctypes.rst:703 +#: ../../library/ctypes.rst:707 msgid "Arrays" msgstr "" -#: ../../library/ctypes.rst:705 +#: ../../library/ctypes.rst:709 msgid "" "Arrays are sequences, containing a fixed number of instances of the same " "type." msgstr "" -#: ../../library/ctypes.rst:707 +#: ../../library/ctypes.rst:711 msgid "" "The recommended way to create array types is by multiplying a data type with " "a positive integer::" msgstr "" -#: ../../library/ctypes.rst:710 +#: ../../library/ctypes.rst:714 msgid "TenPointsArrayType = POINT * 10" msgstr "" -#: ../../library/ctypes.rst:712 +#: ../../library/ctypes.rst:716 msgid "" "Here is an example of a somewhat artificial data type, a structure " "containing 4 POINTs among other stuff::" msgstr "" -#: ../../library/ctypes.rst:715 +#: ../../library/ctypes.rst:719 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -1403,28 +1411,28 @@ msgstr "" "4\n" ">>>" -#: ../../library/ctypes.rst:728 +#: ../../library/ctypes.rst:732 msgid "Instances are created in the usual way, by calling the class::" msgstr "" -#: ../../library/ctypes.rst:730 +#: ../../library/ctypes.rst:734 msgid "" "arr = TenPointsArrayType()\n" "for pt in arr:\n" " print(pt.x, pt.y)" msgstr "" -#: ../../library/ctypes.rst:734 +#: ../../library/ctypes.rst:738 msgid "" "The above code print a series of ``0 0`` lines, because the array contents " "is initialized to zeros." msgstr "" -#: ../../library/ctypes.rst:737 +#: ../../library/ctypes.rst:741 msgid "Initializers of the correct type can also be specified::" msgstr "" -#: ../../library/ctypes.rst:739 +#: ../../library/ctypes.rst:743 msgid "" ">>> from ctypes import *\n" ">>> TenIntegers = c_int * 10\n" @@ -1446,17 +1454,17 @@ msgstr "" "1 2 3 4 5 6 7 8 9 10\n" ">>>" -#: ../../library/ctypes.rst:753 +#: ../../library/ctypes.rst:757 msgid "Pointers" msgstr "" -#: ../../library/ctypes.rst:755 +#: ../../library/ctypes.rst:759 msgid "" "Pointer instances are created by calling the :func:`pointer` function on a :" "mod:`ctypes` type::" msgstr "" -#: ../../library/ctypes.rst:758 +#: ../../library/ctypes.rst:762 msgid "" ">>> from ctypes import *\n" ">>> i = c_int(42)\n" @@ -1468,13 +1476,13 @@ msgstr "" ">>> pi = pointer(i)\n" ">>>" -#: ../../library/ctypes.rst:763 +#: ../../library/ctypes.rst:767 msgid "" "Pointer instances have a :attr:`~_Pointer.contents` attribute which returns " "the object to which the pointer points, the ``i`` object above::" msgstr "" -#: ../../library/ctypes.rst:766 +#: ../../library/ctypes.rst:770 msgid "" ">>> pi.contents\n" "c_long(42)\n" @@ -1484,13 +1492,13 @@ msgstr "" "c_long(42)\n" ">>>" -#: ../../library/ctypes.rst:770 +#: ../../library/ctypes.rst:774 msgid "" "Note that :mod:`ctypes` does not have OOR (original object return), it " "constructs a new, equivalent object each time you retrieve an attribute::" msgstr "" -#: ../../library/ctypes.rst:773 +#: ../../library/ctypes.rst:777 msgid "" ">>> pi.contents is i\n" "False\n" @@ -1504,14 +1512,14 @@ msgstr "" "False\n" ">>>" -#: ../../library/ctypes.rst:779 +#: ../../library/ctypes.rst:783 msgid "" "Assigning another :class:`c_int` instance to the pointer's contents " "attribute would cause the pointer to point to the memory location where this " "is stored::" msgstr "" -#: ../../library/ctypes.rst:782 +#: ../../library/ctypes.rst:786 msgid "" ">>> i = c_int(99)\n" ">>> pi.contents = i\n" @@ -1525,11 +1533,11 @@ msgstr "" "c_long(99)\n" ">>>" -#: ../../library/ctypes.rst:791 +#: ../../library/ctypes.rst:795 msgid "Pointer instances can also be indexed with integers::" msgstr "" -#: ../../library/ctypes.rst:793 +#: ../../library/ctypes.rst:797 msgid "" ">>> pi[0]\n" "99\n" @@ -1539,11 +1547,11 @@ msgstr "" "99\n" ">>>" -#: ../../library/ctypes.rst:797 +#: ../../library/ctypes.rst:801 msgid "Assigning to an integer index changes the pointed to value::" msgstr "" -#: ../../library/ctypes.rst:799 +#: ../../library/ctypes.rst:803 msgid "" ">>> print(i)\n" "c_long(99)\n" @@ -1559,7 +1567,7 @@ msgstr "" "c_long(22)\n" ">>>" -#: ../../library/ctypes.rst:806 +#: ../../library/ctypes.rst:810 msgid "" "It is also possible to use indexes different from 0, but you must know what " "you're doing, just as in C: You can access or change arbitrary memory " @@ -1568,7 +1576,7 @@ msgid "" "instead of a single item." msgstr "" -#: ../../library/ctypes.rst:812 +#: ../../library/ctypes.rst:816 msgid "" "Behind the scenes, the :func:`pointer` function does more than simply create " "pointer instances, it has to create pointer *types* first. This is done with " @@ -1576,7 +1584,7 @@ msgid "" "returns a new type::" msgstr "" -#: ../../library/ctypes.rst:817 +#: ../../library/ctypes.rst:821 msgid "" ">>> PI = POINTER(c_int)\n" ">>> PI\n" @@ -1600,13 +1608,13 @@ msgstr "" "\n" ">>>" -#: ../../library/ctypes.rst:828 +#: ../../library/ctypes.rst:832 msgid "" "Calling the pointer type without an argument creates a ``NULL`` pointer. " "``NULL`` pointers have a ``False`` boolean value::" msgstr "" -#: ../../library/ctypes.rst:831 +#: ../../library/ctypes.rst:835 msgid "" ">>> null_ptr = POINTER(c_int)()\n" ">>> print(bool(null_ptr))\n" @@ -1618,13 +1626,13 @@ msgstr "" "False\n" ">>>" -#: ../../library/ctypes.rst:836 +#: ../../library/ctypes.rst:840 msgid "" ":mod:`ctypes` checks for ``NULL`` when dereferencing pointers (but " "dereferencing invalid non-\\ ``NULL`` pointers would crash Python)::" msgstr "" -#: ../../library/ctypes.rst:839 +#: ../../library/ctypes.rst:843 msgid "" ">>> null_ptr[0]\n" "Traceback (most recent call last):\n" @@ -1650,11 +1658,11 @@ msgstr "" "ValueError: NULL pointer access\n" ">>>" -#: ../../library/ctypes.rst:855 +#: ../../library/ctypes.rst:859 msgid "Type conversions" msgstr "" -#: ../../library/ctypes.rst:857 +#: ../../library/ctypes.rst:861 msgid "" "Usually, ctypes does strict type checking. This means, if you have " "``POINTER(c_int)`` in the :attr:`~_FuncPtr.argtypes` list of a function or " @@ -1665,7 +1673,7 @@ msgid "" "ctypes accepts an array of c_int::" msgstr "" -#: ../../library/ctypes.rst:864 +#: ../../library/ctypes.rst:868 msgid "" ">>> class Bar(Structure):\n" "... _fields_ = [(\"count\", c_int), (\"values\", POINTER(c_int))]\n" @@ -1695,7 +1703,7 @@ msgstr "" "3\n" ">>>" -#: ../../library/ctypes.rst:878 +#: ../../library/ctypes.rst:882 msgid "" "In addition, if a function argument is explicitly declared to be a pointer " "type (such as ``POINTER(c_int)``) in :attr:`~_FuncPtr.argtypes`, an object " @@ -1704,11 +1712,11 @@ msgid "" "automatically." msgstr "" -#: ../../library/ctypes.rst:883 +#: ../../library/ctypes.rst:887 msgid "To set a POINTER type field to ``NULL``, you can assign ``None``::" msgstr "" -#: ../../library/ctypes.rst:885 +#: ../../library/ctypes.rst:889 msgid "" ">>> bar.values = None\n" ">>>" @@ -1716,7 +1724,7 @@ msgstr "" ">>> bar.values = None\n" ">>>" -#: ../../library/ctypes.rst:890 +#: ../../library/ctypes.rst:894 msgid "" "Sometimes you have instances of incompatible types. In C, you can cast one " "type into another type. :mod:`ctypes` provides a :func:`cast` function " @@ -1725,7 +1733,7 @@ msgid "" "``values`` field, but not instances of other types::" msgstr "" -#: ../../library/ctypes.rst:896 +#: ../../library/ctypes.rst:900 msgid "" ">>> bar.values = (c_byte * 4)()\n" "Traceback (most recent call last):\n" @@ -1741,11 +1749,11 @@ msgstr "" "instance\n" ">>>" -#: ../../library/ctypes.rst:902 +#: ../../library/ctypes.rst:906 msgid "For these cases, the :func:`cast` function is handy." msgstr "" -#: ../../library/ctypes.rst:904 +#: ../../library/ctypes.rst:908 msgid "" "The :func:`cast` function can be used to cast a ctypes instance into a " "pointer to a different ctypes data type. :func:`cast` takes two parameters, " @@ -1754,7 +1762,7 @@ msgid "" "references the same memory block as the first argument::" msgstr "" -#: ../../library/ctypes.rst:910 +#: ../../library/ctypes.rst:914 msgid "" ">>> a = (c_byte * 4)()\n" ">>> cast(a, POINTER(c_int))\n" @@ -1766,13 +1774,13 @@ msgstr "" "\n" ">>>" -#: ../../library/ctypes.rst:915 +#: ../../library/ctypes.rst:919 msgid "" "So, :func:`cast` can be used to assign to the ``values`` field of ``Bar`` " "the structure::" msgstr "" -#: ../../library/ctypes.rst:918 +#: ../../library/ctypes.rst:922 msgid "" ">>> bar = Bar()\n" ">>> bar.values = cast((c_byte * 4)(), POINTER(c_int))\n" @@ -1786,18 +1794,18 @@ msgstr "" "0\n" ">>>" -#: ../../library/ctypes.rst:928 +#: ../../library/ctypes.rst:932 msgid "Incomplete Types" msgstr "" -#: ../../library/ctypes.rst:930 +#: ../../library/ctypes.rst:934 msgid "" "*Incomplete Types* are structures, unions or arrays whose members are not " "yet specified. In C, they are specified by forward declarations, which are " "defined later::" msgstr "" -#: ../../library/ctypes.rst:934 +#: ../../library/ctypes.rst:938 msgid "" "struct cell; /* forward declaration */\n" "\n" @@ -1807,13 +1815,13 @@ msgid "" "};" msgstr "" -#: ../../library/ctypes.rst:941 +#: ../../library/ctypes.rst:945 msgid "" "The straightforward translation into ctypes code would be this, but it does " "not work::" msgstr "" -#: ../../library/ctypes.rst:944 +#: ../../library/ctypes.rst:948 msgid "" ">>> class cell(Structure):\n" "... _fields_ = [(\"name\", c_char_p),\n" @@ -1835,14 +1843,14 @@ msgstr "" "NameError: name 'cell' is not defined\n" ">>>" -#: ../../library/ctypes.rst:954 +#: ../../library/ctypes.rst:958 msgid "" "because the new ``class cell`` is not available in the class statement " "itself. In :mod:`ctypes`, we can define the ``cell`` class and set the :attr:" "`~Structure._fields_` attribute later, after the class statement::" msgstr "" -#: ../../library/ctypes.rst:958 +#: ../../library/ctypes.rst:962 msgid "" ">>> from ctypes import *\n" ">>> class cell(Structure):\n" @@ -1860,13 +1868,13 @@ msgstr "" "... (\"next\", POINTER(cell))]\n" ">>>" -#: ../../library/ctypes.rst:966 +#: ../../library/ctypes.rst:970 msgid "" "Let's try it. We create two instances of ``cell``, and let them point to " "each other, and finally follow the pointer chain a few times::" msgstr "" -#: ../../library/ctypes.rst:969 +#: ../../library/ctypes.rst:973 msgid "" ">>> c1 = cell()\n" ">>> c1.name = b\"foo\"\n" @@ -1896,24 +1904,24 @@ msgstr "" "foo bar foo bar foo bar foo bar\n" ">>>" -#: ../../library/ctypes.rst:987 +#: ../../library/ctypes.rst:991 msgid "Callback functions" msgstr "回呼函式" -#: ../../library/ctypes.rst:989 +#: ../../library/ctypes.rst:993 msgid "" ":mod:`ctypes` allows creating C callable function pointers from Python " "callables. These are sometimes called *callback functions*." msgstr "" -#: ../../library/ctypes.rst:992 +#: ../../library/ctypes.rst:996 msgid "" "First, you must create a class for the callback function. The class knows " "the calling convention, the return type, and the number and types of " "arguments this function will receive." msgstr "" -#: ../../library/ctypes.rst:996 +#: ../../library/ctypes.rst:1000 msgid "" "The :func:`CFUNCTYPE` factory function creates types for callback functions " "using the ``cdecl`` calling convention. On Windows, the :func:`WINFUNCTYPE` " @@ -1921,21 +1929,21 @@ msgid "" "calling convention." msgstr "" -#: ../../library/ctypes.rst:1001 +#: ../../library/ctypes.rst:1005 msgid "" "Both of these factory functions are called with the result type as first " "argument, and the callback functions expected argument types as the " "remaining arguments." msgstr "" -#: ../../library/ctypes.rst:1005 +#: ../../library/ctypes.rst:1009 msgid "" "I will present an example here which uses the standard C library's :c:func:`!" "qsort` function, that is used to sort items with the help of a callback " "function. :c:func:`!qsort` will be used to sort an array of integers::" msgstr "" -#: ../../library/ctypes.rst:1009 +#: ../../library/ctypes.rst:1013 msgid "" ">>> IntArray5 = c_int * 5\n" ">>> ia = IntArray5(5, 1, 7, 33, 99)\n" @@ -1949,7 +1957,7 @@ msgstr "" ">>> qsort.restype = None\n" ">>>" -#: ../../library/ctypes.rst:1015 +#: ../../library/ctypes.rst:1019 msgid "" ":func:`!qsort` must be called with a pointer to the data to sort, the number " "of items in the data array, the size of one item, and a pointer to the " @@ -1959,13 +1967,13 @@ msgid "" "otherwise." msgstr "" -#: ../../library/ctypes.rst:1021 +#: ../../library/ctypes.rst:1025 msgid "" "So our callback function receives pointers to integers, and must return an " "integer. First we create the ``type`` for the callback function::" msgstr "" -#: ../../library/ctypes.rst:1024 +#: ../../library/ctypes.rst:1028 msgid "" ">>> CMPFUNC = CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" ">>>" @@ -1973,13 +1981,13 @@ msgstr "" ">>> CMPFUNC = CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" ">>>" -#: ../../library/ctypes.rst:1027 +#: ../../library/ctypes.rst:1031 msgid "" "To get started, here is a simple callback that shows the values it gets " "passed::" msgstr "" -#: ../../library/ctypes.rst:1030 +#: ../../library/ctypes.rst:1034 msgid "" ">>> def py_cmp_func(a, b):\n" "... print(\"py_cmp_func\", a[0], b[0])\n" @@ -1995,11 +2003,11 @@ msgstr "" ">>> cmp_func = CMPFUNC(py_cmp_func)\n" ">>>" -#: ../../library/ctypes.rst:1037 +#: ../../library/ctypes.rst:1041 msgid "The result::" msgstr "結果為: ::" -#: ../../library/ctypes.rst:1039 +#: ../../library/ctypes.rst:1043 msgid "" ">>> qsort(ia, len(ia), sizeof(c_int), cmp_func) \n" "py_cmp_func 5 1\n" @@ -2017,11 +2025,11 @@ msgstr "" "py_cmp_func 1 7\n" ">>>" -#: ../../library/ctypes.rst:1047 +#: ../../library/ctypes.rst:1051 msgid "Now we can actually compare the two items and return a useful result::" msgstr "" -#: ../../library/ctypes.rst:1049 +#: ../../library/ctypes.rst:1053 msgid "" ">>> def py_cmp_func(a, b):\n" "... print(\"py_cmp_func\", a[0], b[0])\n" @@ -2049,11 +2057,11 @@ msgstr "" "py_cmp_func 5 7\n" ">>>" -#: ../../library/ctypes.rst:1062 +#: ../../library/ctypes.rst:1066 msgid "As we can easily check, our array is sorted now::" msgstr "" -#: ../../library/ctypes.rst:1064 +#: ../../library/ctypes.rst:1068 msgid "" ">>> for i in ia: print(i, end=\" \")\n" "...\n" @@ -2065,13 +2073,13 @@ msgstr "" "1 5 7 33 99\n" ">>>" -#: ../../library/ctypes.rst:1069 +#: ../../library/ctypes.rst:1073 msgid "" "The function factories can be used as decorator factories, so we may as well " "write::" msgstr "" -#: ../../library/ctypes.rst:1072 +#: ../../library/ctypes.rst:1076 msgid "" ">>> @CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" "... def py_cmp_func(a, b):\n" @@ -2099,14 +2107,14 @@ msgstr "" "py_cmp_func 5 7\n" ">>>" -#: ../../library/ctypes.rst:1087 +#: ../../library/ctypes.rst:1091 msgid "" "Make sure you keep references to :func:`CFUNCTYPE` objects as long as they " "are used from C code. :mod:`ctypes` doesn't, and if you don't, they may be " "garbage collected, crashing your program when a callback is made." msgstr "" -#: ../../library/ctypes.rst:1091 +#: ../../library/ctypes.rst:1095 msgid "" "Also, note that if the callback function is called in a thread created " "outside of Python's control (e.g. by the foreign code that calls the " @@ -2116,25 +2124,25 @@ msgid "" "even when those calls are made from the same C thread." msgstr "" -#: ../../library/ctypes.rst:1101 +#: ../../library/ctypes.rst:1105 msgid "Accessing values exported from dlls" msgstr "" -#: ../../library/ctypes.rst:1103 +#: ../../library/ctypes.rst:1107 msgid "" "Some shared libraries not only export functions, they also export variables. " "An example in the Python library itself is the :c:data:`Py_Version`, Python " "runtime version number encoded in a single constant integer." msgstr "" -#: ../../library/ctypes.rst:1107 +#: ../../library/ctypes.rst:1111 msgid "" ":mod:`ctypes` can access values like this with the :meth:`~_CData.in_dll` " "class methods of the type. *pythonapi* is a predefined symbol giving access " "to the Python C api::" msgstr "" -#: ../../library/ctypes.rst:1111 +#: ../../library/ctypes.rst:1115 msgid "" ">>> version = ctypes.c_int.in_dll(ctypes.pythonapi, \"Py_Version\")\n" ">>> print(hex(version.value))\n" @@ -2144,17 +2152,17 @@ msgstr "" ">>> print(hex(version.value))\n" "0x30c00a0" -#: ../../library/ctypes.rst:1115 +#: ../../library/ctypes.rst:1119 msgid "" "An extended example which also demonstrates the use of pointers accesses " "the :c:data:`PyImport_FrozenModules` pointer exported by Python." msgstr "" -#: ../../library/ctypes.rst:1118 +#: ../../library/ctypes.rst:1122 msgid "Quoting the docs for that value:" msgstr "" -#: ../../library/ctypes.rst:1120 +#: ../../library/ctypes.rst:1124 msgid "" "This pointer is initialized to point to an array of :c:struct:`_frozen` " "records, terminated by one whose members are all ``NULL`` or zero. When a " @@ -2163,13 +2171,13 @@ msgid "" "frozen modules." msgstr "" -#: ../../library/ctypes.rst:1125 +#: ../../library/ctypes.rst:1129 msgid "" "So manipulating this pointer could even prove useful. To restrict the " "example size, we show only how this table can be read with :mod:`ctypes`::" msgstr "" -#: ../../library/ctypes.rst:1128 +#: ../../library/ctypes.rst:1132 msgid "" ">>> from ctypes import *\n" ">>>\n" @@ -2193,13 +2201,13 @@ msgstr "" "...\n" ">>>" -#: ../../library/ctypes.rst:1139 +#: ../../library/ctypes.rst:1143 msgid "" "We have defined the :c:struct:`_frozen` data type, so we can get the pointer " "to the table::" msgstr "" -#: ../../library/ctypes.rst:1142 +#: ../../library/ctypes.rst:1146 msgid "" ">>> FrozenTable = POINTER(struct_frozen)\n" ">>> table = FrozenTable.in_dll(pythonapi, \"_PyImport_FrozenBootstrap\")\n" @@ -2209,7 +2217,7 @@ msgstr "" ">>> table = FrozenTable.in_dll(pythonapi, \"_PyImport_FrozenBootstrap\")\n" ">>>" -#: ../../library/ctypes.rst:1146 +#: ../../library/ctypes.rst:1150 msgid "" "Since ``table`` is a ``pointer`` to the array of ``struct_frozen`` records, " "we can iterate over it, but we just have to make sure that our loop " @@ -2218,7 +2226,7 @@ msgid "" "the loop when we hit the ``NULL`` entry::" msgstr "" -#: ../../library/ctypes.rst:1152 +#: ../../library/ctypes.rst:1156 msgid "" ">>> for item in table:\n" "... if item.name is None:\n" @@ -2240,28 +2248,28 @@ msgstr "" "zipimport 12345\n" ">>>" -#: ../../library/ctypes.rst:1162 +#: ../../library/ctypes.rst:1166 msgid "" "The fact that standard Python has a frozen module and a frozen package " "(indicated by the negative ``size`` member) is not well known, it is only " "used for testing. Try it out with ``import __hello__`` for example." msgstr "" -#: ../../library/ctypes.rst:1170 +#: ../../library/ctypes.rst:1174 msgid "Surprises" msgstr "" -#: ../../library/ctypes.rst:1172 +#: ../../library/ctypes.rst:1176 msgid "" "There are some edges in :mod:`ctypes` where you might expect something other " "than what actually happens." msgstr "" -#: ../../library/ctypes.rst:1175 +#: ../../library/ctypes.rst:1179 msgid "Consider the following example::" msgstr "" -#: ../../library/ctypes.rst:1177 +#: ../../library/ctypes.rst:1181 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -2299,13 +2307,13 @@ msgstr "" "3 4 3 4\n" ">>>" -#: ../../library/ctypes.rst:1195 +#: ../../library/ctypes.rst:1199 msgid "" "Hm. We certainly expected the last statement to print ``3 4 1 2``. What " "happened? Here are the steps of the ``rc.a, rc.b = rc.b, rc.a`` line above::" msgstr "" -#: ../../library/ctypes.rst:1198 +#: ../../library/ctypes.rst:1202 msgid "" ">>> temp0, temp1 = rc.b, rc.a\n" ">>> rc.a = temp0\n" @@ -2317,7 +2325,7 @@ msgstr "" ">>> rc.b = temp1\n" ">>>" -#: ../../library/ctypes.rst:1203 +#: ../../library/ctypes.rst:1207 msgid "" "Note that ``temp0`` and ``temp1`` are objects still using the internal " "buffer of the ``rc`` object above. So executing ``rc.a = temp0`` copies the " @@ -2326,20 +2334,20 @@ msgid "" "have the expected effect." msgstr "" -#: ../../library/ctypes.rst:1209 +#: ../../library/ctypes.rst:1213 msgid "" "Keep in mind that retrieving sub-objects from Structure, Unions, and Arrays " "doesn't *copy* the sub-object, instead it retrieves a wrapper object " "accessing the root-object's underlying buffer." msgstr "" -#: ../../library/ctypes.rst:1213 +#: ../../library/ctypes.rst:1217 msgid "" "Another example that may behave differently from what one would expect is " "this::" msgstr "" -#: ../../library/ctypes.rst:1215 +#: ../../library/ctypes.rst:1219 msgid "" ">>> s = c_char_p()\n" ">>> s.value = b\"abc def ghi\"\n" @@ -2357,13 +2365,13 @@ msgstr "" "False\n" ">>>" -#: ../../library/ctypes.rst:1225 +#: ../../library/ctypes.rst:1229 msgid "" "Objects instantiated from :class:`c_char_p` can only have their value set to " "bytes or integers." msgstr "" -#: ../../library/ctypes.rst:1228 +#: ../../library/ctypes.rst:1232 msgid "" "Why is it printing ``False``? ctypes instances are objects containing a " "memory block plus some :term:`descriptor`\\s accessing the contents of the " @@ -2372,16 +2380,16 @@ msgid "" "the contents again constructs a new Python object each time!" msgstr "" -#: ../../library/ctypes.rst:1238 +#: ../../library/ctypes.rst:1242 msgid "Variable-sized data types" msgstr "" -#: ../../library/ctypes.rst:1240 +#: ../../library/ctypes.rst:1244 msgid "" ":mod:`ctypes` provides some support for variable-sized arrays and structures." msgstr "" -#: ../../library/ctypes.rst:1242 +#: ../../library/ctypes.rst:1246 msgid "" "The :func:`resize` function can be used to resize the memory buffer of an " "existing ctypes object. The function takes the object as first argument, " @@ -2390,7 +2398,7 @@ msgid "" "objects type, a :exc:`ValueError` is raised if this is tried::" msgstr "" -#: ../../library/ctypes.rst:1248 +#: ../../library/ctypes.rst:1252 msgid "" ">>> short_array = (c_short * 4)()\n" ">>> print(sizeof(short_array))\n" @@ -2420,14 +2428,14 @@ msgstr "" "8\n" ">>>" -#: ../../library/ctypes.rst:1262 +#: ../../library/ctypes.rst:1266 msgid "" "This is nice and fine, but how would one access the additional elements " "contained in this array? Since the type still only knows about 4 elements, " "we get errors accessing other elements::" msgstr "" -#: ../../library/ctypes.rst:1266 +#: ../../library/ctypes.rst:1270 msgid "" ">>> short_array[:]\n" "[0, 0, 0, 0]\n" @@ -2445,28 +2453,28 @@ msgstr "" "IndexError: invalid index\n" ">>>" -#: ../../library/ctypes.rst:1274 +#: ../../library/ctypes.rst:1278 msgid "" "Another way to use variable-sized data types with :mod:`ctypes` is to use " "the dynamic nature of Python, and (re-)define the data type after the " "required size is already known, on a case by case basis." msgstr "" -#: ../../library/ctypes.rst:1282 +#: ../../library/ctypes.rst:1286 msgid "ctypes reference" msgstr "" -#: ../../library/ctypes.rst:1288 +#: ../../library/ctypes.rst:1292 msgid "Finding shared libraries" msgstr "" -#: ../../library/ctypes.rst:1290 +#: ../../library/ctypes.rst:1294 msgid "" "When programming in a compiled language, shared libraries are accessed when " "compiling/linking a program, and when the program is run." msgstr "" -#: ../../library/ctypes.rst:1293 +#: ../../library/ctypes.rst:1297 msgid "" "The purpose of the :func:`~ctypes.util.find_library` function is to locate a " "library in a way similar to what the compiler or runtime loader does (on " @@ -2475,13 +2483,13 @@ msgid "" "and call the runtime loader directly." msgstr "" -#: ../../library/ctypes.rst:1299 +#: ../../library/ctypes.rst:1303 msgid "" "The :mod:`!ctypes.util` module provides a function which can help to " "determine the library to load." msgstr "" -#: ../../library/ctypes.rst:1307 +#: ../../library/ctypes.rst:1311 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like *lib*, suffix like ``.so``, ``.dylib`` or version " @@ -2489,29 +2497,29 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:1312 ../../library/ctypes.rst:1972 +#: ../../library/ctypes.rst:1316 ../../library/ctypes.rst:1977 msgid "The exact functionality is system dependent." msgstr "" -#: ../../library/ctypes.rst:1314 +#: ../../library/ctypes.rst:1318 msgid "" "On Linux, :func:`~ctypes.util.find_library` tries to run external programs " "(``/sbin/ldconfig``, ``gcc``, ``objdump`` and ``ld``) to find the library " "file. It returns the filename of the library file." msgstr "" -#: ../../library/ctypes.rst:1318 +#: ../../library/ctypes.rst:1322 msgid "" "On Linux, the value of the environment variable ``LD_LIBRARY_PATH`` is used " "when searching for libraries, if a library cannot be found by any other " "means." msgstr "" -#: ../../library/ctypes.rst:1322 +#: ../../library/ctypes.rst:1326 msgid "Here are some examples::" msgstr "以下是一些範例: ::" -#: ../../library/ctypes.rst:1324 +#: ../../library/ctypes.rst:1328 msgid "" ">>> from ctypes.util import find_library\n" ">>> find_library(\"m\")\n" @@ -2531,14 +2539,14 @@ msgstr "" "'libbz2.so.1.0'\n" ">>>" -#: ../../library/ctypes.rst:1333 +#: ../../library/ctypes.rst:1337 msgid "" -"On macOS, :func:`~ctypes.util.find_library` tries several predefined naming " -"schemes and paths to locate the library, and returns a full pathname if " -"successful::" +"On macOS and Android, :func:`~ctypes.util.find_library` uses the system's " +"standard naming schemes and paths to locate the library, and returns a full " +"pathname if successful::" msgstr "" -#: ../../library/ctypes.rst:1336 +#: ../../library/ctypes.rst:1341 msgid "" ">>> from ctypes.util import find_library\n" ">>> find_library(\"c\")\n" @@ -2562,7 +2570,7 @@ msgstr "" "'/System/Library/Frameworks/AGL.framework/AGL'\n" ">>>" -#: ../../library/ctypes.rst:1347 +#: ../../library/ctypes.rst:1352 msgid "" "On Windows, :func:`~ctypes.util.find_library` searches along the system " "search path, and returns the full pathname, but since there is no predefined " @@ -2570,7 +2578,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/ctypes.rst:1351 +#: ../../library/ctypes.rst:1356 msgid "" "If wrapping a shared library with :mod:`ctypes`, it *may* be better to " "determine the shared library name at development time, and hardcode that " @@ -2578,24 +2586,24 @@ msgid "" "to locate the library at runtime." msgstr "" -#: ../../library/ctypes.rst:1359 +#: ../../library/ctypes.rst:1364 msgid "Loading shared libraries" msgstr "" -#: ../../library/ctypes.rst:1361 +#: ../../library/ctypes.rst:1366 msgid "" "There are several ways to load shared libraries into the Python process. " "One way is to instantiate one of the following classes:" msgstr "" -#: ../../library/ctypes.rst:1367 +#: ../../library/ctypes.rst:1372 msgid "" "Instances of this class represent loaded shared libraries. Functions in " "these libraries use the standard C calling convention, and are assumed to " "return :c:expr:`int`." msgstr "" -#: ../../library/ctypes.rst:1371 +#: ../../library/ctypes.rst:1376 msgid "" "On Windows creating a :class:`CDLL` instance may fail even if the DLL name " "exists. When a dependent DLL of the loaded DLL is not found, a :exc:" @@ -2607,18 +2615,18 @@ msgid "" "determine which one is not found using Windows debugging and tracing tools." msgstr "" -#: ../../library/ctypes.rst:1383 ../../library/ctypes.rst:1406 -#: ../../library/ctypes.rst:1417 ../../library/ctypes.rst:1434 +#: ../../library/ctypes.rst:1388 ../../library/ctypes.rst:1411 +#: ../../library/ctypes.rst:1422 ../../library/ctypes.rst:1439 msgid "The *name* parameter can now be a :term:`path-like object`." msgstr "" -#: ../../library/ctypes.rst:1387 +#: ../../library/ctypes.rst:1392 msgid "" "`Microsoft DUMPBIN tool `_ -- A tool to find DLL dependents." msgstr "" -#: ../../library/ctypes.rst:1393 +#: ../../library/ctypes.rst:1398 msgid "" "Windows only: Instances of this class represent loaded shared libraries, " "functions in these libraries use the ``stdcall`` calling convention, and are " @@ -2628,26 +2636,26 @@ msgid "" "value signals a failure, an :class:`OSError` is automatically raised." msgstr "" -#: ../../library/ctypes.rst:1400 +#: ../../library/ctypes.rst:1405 msgid "" ":exc:`WindowsError` used to be raised, which is now an alias of :exc:" "`OSError`." msgstr "" -#: ../../library/ctypes.rst:1411 +#: ../../library/ctypes.rst:1416 msgid "" "Windows only: Instances of this class represent loaded shared libraries, " "functions in these libraries use the ``stdcall`` calling convention, and are " "assumed to return :c:expr:`int` by default." msgstr "" -#: ../../library/ctypes.rst:1419 +#: ../../library/ctypes.rst:1424 msgid "" "The Python :term:`global interpreter lock` is released before calling any " "function exported by these libraries, and reacquired afterwards." msgstr "" -#: ../../library/ctypes.rst:1425 +#: ../../library/ctypes.rst:1430 msgid "" "Instances of this class behave like :class:`CDLL` instances, except that the " "Python GIL is *not* released during the function call, and after the " @@ -2655,21 +2663,21 @@ msgid "" "set, a Python exception is raised." msgstr "" -#: ../../library/ctypes.rst:1430 +#: ../../library/ctypes.rst:1435 msgid "Thus, this is only useful to call Python C api functions directly." msgstr "" -#: ../../library/ctypes.rst:1436 +#: ../../library/ctypes.rst:1441 msgid "" "All these classes can be instantiated by calling them with at least one " "argument, the pathname of the shared library. If you have an existing " "handle to an already loaded shared library, it can be passed as the " -"``handle`` named parameter, otherwise the underlying platforms :c:func:`!" +"``handle`` named parameter, otherwise the underlying platform's :c:func:`!" "dlopen` or :c:func:`!LoadLibrary` function is used to load the library into " "the process, and to get a handle to it." msgstr "" -#: ../../library/ctypes.rst:1443 +#: ../../library/ctypes.rst:1448 msgid "" "The *mode* parameter can be used to specify how the library is loaded. For " "details, consult the :manpage:`dlopen(3)` manpage. On Windows, *mode* is " @@ -2677,24 +2685,24 @@ msgid "" "configurable." msgstr "" -#: ../../library/ctypes.rst:1448 +#: ../../library/ctypes.rst:1453 msgid "" "The *use_errno* parameter, when set to true, enables a ctypes mechanism that " "allows accessing the system :data:`errno` error number in a safe way. :mod:" -"`ctypes` maintains a thread-local copy of the systems :data:`errno` " +"`ctypes` maintains a thread-local copy of the system's :data:`errno` " "variable; if you call foreign functions created with ``use_errno=True`` then " "the :data:`errno` value before the function call is swapped with the ctypes " "private copy, the same happens immediately after the function call." msgstr "" -#: ../../library/ctypes.rst:1455 +#: ../../library/ctypes.rst:1460 msgid "" "The function :func:`ctypes.get_errno` returns the value of the ctypes " "private copy, and the function :func:`ctypes.set_errno` changes the ctypes " "private copy to a new value and returns the former value." msgstr "" -#: ../../library/ctypes.rst:1459 +#: ../../library/ctypes.rst:1464 msgid "" "The *use_last_error* parameter, when set to true, enables the same mechanism " "for the Windows error code which is managed by the :func:`GetLastError` and :" @@ -2703,7 +2711,7 @@ msgid "" "private copy of the windows error code." msgstr "" -#: ../../library/ctypes.rst:1465 +#: ../../library/ctypes.rst:1470 msgid "" "The *winmode* parameter is used on Windows to specify how the library is " "loaded (since *mode* is ignored). It takes any value that is valid for the " @@ -2713,29 +2721,29 @@ msgid "" "ensure the correct library and dependencies are loaded." msgstr "" -#: ../../library/ctypes.rst:1472 +#: ../../library/ctypes.rst:1477 msgid "Added *winmode* parameter." msgstr "新增 *winmode* 參數。" -#: ../../library/ctypes.rst:1479 +#: ../../library/ctypes.rst:1484 msgid "" "Flag to use as *mode* parameter. On platforms where this flag is not " "available, it is defined as the integer zero." msgstr "" -#: ../../library/ctypes.rst:1486 +#: ../../library/ctypes.rst:1491 msgid "" "Flag to use as *mode* parameter. On platforms where this is not available, " "it is the same as *RTLD_GLOBAL*." msgstr "" -#: ../../library/ctypes.rst:1493 +#: ../../library/ctypes.rst:1498 msgid "" "The default mode which is used to load shared libraries. On OSX 10.3, this " "is *RTLD_GLOBAL*, otherwise it is the same as *RTLD_LOCAL*." msgstr "" -#: ../../library/ctypes.rst:1496 +#: ../../library/ctypes.rst:1501 msgid "" "Instances of these classes have no public methods. Functions exported by " "the shared library can be accessed as attributes or by index. Please note " @@ -2744,7 +2752,7 @@ msgid "" "other hand, accessing it through an index returns a new object each time::" msgstr "" -#: ../../library/ctypes.rst:1502 +#: ../../library/ctypes.rst:1507 msgid "" ">>> from ctypes import CDLL\n" ">>> libc = CDLL(\"libc.so.6\") # On Linux\n" @@ -2760,21 +2768,21 @@ msgstr "" ">>> libc['time'] == libc['time']\n" "False" -#: ../../library/ctypes.rst:1509 +#: ../../library/ctypes.rst:1514 msgid "" "The following public attributes are available, their name starts with an " "underscore to not clash with exported function names:" msgstr "" -#: ../../library/ctypes.rst:1515 +#: ../../library/ctypes.rst:1520 msgid "The system handle used to access the library." msgstr "" -#: ../../library/ctypes.rst:1520 +#: ../../library/ctypes.rst:1525 msgid "The name of the library passed in the constructor." msgstr "" -#: ../../library/ctypes.rst:1522 +#: ../../library/ctypes.rst:1527 msgid "" "Shared libraries can also be loaded by using one of the prefabricated " "objects, which are instances of the :class:`LibraryLoader` class, either by " @@ -2782,13 +2790,13 @@ msgid "" "library as attribute of the loader instance." msgstr "" -#: ../../library/ctypes.rst:1530 +#: ../../library/ctypes.rst:1535 msgid "" "Class which loads shared libraries. *dlltype* should be one of the :class:" "`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." msgstr "" -#: ../../library/ctypes.rst:1533 +#: ../../library/ctypes.rst:1538 msgid "" ":meth:`!__getattr__` has special behavior: It allows loading a shared " "library by accessing it as attribute of a library loader instance. The " @@ -2796,39 +2804,39 @@ msgid "" "each time." msgstr "" -#: ../../library/ctypes.rst:1539 +#: ../../library/ctypes.rst:1544 msgid "" "Load a shared library into the process and return it. This method always " "returns a new instance of the library." msgstr "" -#: ../../library/ctypes.rst:1543 +#: ../../library/ctypes.rst:1548 msgid "These prefabricated library loaders are available:" msgstr "" -#: ../../library/ctypes.rst:1548 +#: ../../library/ctypes.rst:1553 msgid "Creates :class:`CDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1554 +#: ../../library/ctypes.rst:1559 msgid "Windows only: Creates :class:`WinDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1560 +#: ../../library/ctypes.rst:1565 msgid "Windows only: Creates :class:`OleDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1566 +#: ../../library/ctypes.rst:1571 msgid "Creates :class:`PyDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1569 +#: ../../library/ctypes.rst:1574 msgid "" "For accessing the C Python api directly, a ready-to-use Python shared " "library object is available:" msgstr "" -#: ../../library/ctypes.rst:1575 +#: ../../library/ctypes.rst:1580 msgid "" "An instance of :class:`PyDLL` that exposes Python C API functions as " "attributes. Note that all these functions are assumed to return C :c:expr:" @@ -2836,32 +2844,32 @@ msgid "" "correct :attr:`!restype` attribute to use these functions." msgstr "" -#: ../../library/ctypes.rst:1580 ../../library/ctypes.rst:1582 +#: ../../library/ctypes.rst:1585 ../../library/ctypes.rst:1587 msgid "" "Loading a library through any of these objects raises an :ref:`auditing " "event ` ``ctypes.dlopen`` with string argument ``name``, the name " "used to load the library." msgstr "" -#: ../../library/ctypes.rst:1586 ../../library/ctypes.rst:1588 +#: ../../library/ctypes.rst:1591 ../../library/ctypes.rst:1593 msgid "" "Accessing a function on a loaded library raises an auditing event ``ctypes." "dlsym`` with arguments ``library`` (the library object) and ``name`` (the " "symbol's name as a string or integer)." msgstr "" -#: ../../library/ctypes.rst:1592 ../../library/ctypes.rst:1594 +#: ../../library/ctypes.rst:1597 ../../library/ctypes.rst:1599 msgid "" "In cases when only the library handle is available rather than the object, " "accessing a function raises an auditing event ``ctypes.dlsym/handle`` with " "arguments ``handle`` (the raw library handle) and ``name``." msgstr "" -#: ../../library/ctypes.rst:1601 +#: ../../library/ctypes.rst:1606 msgid "Foreign functions" msgstr "" -#: ../../library/ctypes.rst:1603 +#: ../../library/ctypes.rst:1608 msgid "" "As explained in the previous section, foreign functions can be accessed as " "attributes of loaded shared libraries. The function objects created in this " @@ -2870,29 +2878,29 @@ msgid "" "library loader. They are instances of a private class:" msgstr "" -#: ../../library/ctypes.rst:1612 +#: ../../library/ctypes.rst:1617 msgid "Base class for C callable foreign functions." msgstr "" -#: ../../library/ctypes.rst:1614 +#: ../../library/ctypes.rst:1619 msgid "" "Instances of foreign functions are also C compatible data types; they " "represent C function pointers." msgstr "" -#: ../../library/ctypes.rst:1617 +#: ../../library/ctypes.rst:1622 msgid "" "This behavior can be customized by assigning to special attributes of the " "foreign function object." msgstr "" -#: ../../library/ctypes.rst:1622 +#: ../../library/ctypes.rst:1627 msgid "" "Assign a ctypes type to specify the result type of the foreign function. Use " "``None`` for :c:expr:`void`, a function not returning anything." msgstr "" -#: ../../library/ctypes.rst:1625 +#: ../../library/ctypes.rst:1630 msgid "" "It is possible to assign a callable Python object that is not a ctypes type, " "in this case the function is assumed to return a C :c:expr:`int`, and the " @@ -2902,7 +2910,7 @@ msgid "" "callable to the :attr:`errcheck` attribute." msgstr "" -#: ../../library/ctypes.rst:1634 +#: ../../library/ctypes.rst:1639 msgid "" "Assign a tuple of ctypes types to specify the argument types that the " "function accepts. Functions using the ``stdcall`` calling convention can " @@ -2911,7 +2919,7 @@ msgid "" "unspecified arguments as well." msgstr "" -#: ../../library/ctypes.rst:1640 +#: ../../library/ctypes.rst:1645 msgid "" "When a foreign function is called, each actual argument is passed to the :" "meth:`~_CData.from_param` class method of the items in the :attr:`argtypes` " @@ -2921,7 +2929,7 @@ msgid "" "object using ctypes conversion rules." msgstr "" -#: ../../library/ctypes.rst:1647 +#: ../../library/ctypes.rst:1652 msgid "" "New: It is now possible to put items in argtypes which are not ctypes types, " "but each item must have a :meth:`~_CData.from_param` method which returns a " @@ -2929,44 +2937,44 @@ msgid "" "defining adapters that can adapt custom objects as function parameters." msgstr "" -#: ../../library/ctypes.rst:1654 +#: ../../library/ctypes.rst:1659 msgid "" "Assign a Python function or another callable to this attribute. The callable " "will be called with three or more arguments:" msgstr "" -#: ../../library/ctypes.rst:1661 +#: ../../library/ctypes.rst:1666 msgid "" "*result* is what the foreign function returns, as specified by the :attr:`!" "restype` attribute." msgstr "" -#: ../../library/ctypes.rst:1664 +#: ../../library/ctypes.rst:1669 msgid "" "*func* is the foreign function object itself, this allows reusing the same " "callable object to check or post process the results of several functions." msgstr "" -#: ../../library/ctypes.rst:1668 +#: ../../library/ctypes.rst:1673 msgid "" "*arguments* is a tuple containing the parameters originally passed to the " "function call, this allows specializing the behavior on the arguments used." msgstr "" -#: ../../library/ctypes.rst:1672 +#: ../../library/ctypes.rst:1677 msgid "" "The object that this function returns will be returned from the foreign " "function call, but it can also check the result value and raise an exception " "if the foreign function call failed." msgstr "" -#: ../../library/ctypes.rst:1679 +#: ../../library/ctypes.rst:1684 msgid "" "This exception is raised when a foreign function call cannot convert one of " "the passed arguments." msgstr "" -#: ../../library/ctypes.rst:1683 ../../library/ctypes.rst:1685 +#: ../../library/ctypes.rst:1688 ../../library/ctypes.rst:1690 msgid "" "On Windows, when a foreign function call raises a system exception (for " "example, due to an access violation), it will be captured and replaced with " @@ -2975,18 +2983,18 @@ msgid "" "hook to replace the exception with its own." msgstr "" -#: ../../library/ctypes.rst:1691 ../../library/ctypes.rst:1693 +#: ../../library/ctypes.rst:1696 ../../library/ctypes.rst:1698 msgid "" "Some ways to invoke foreign function calls may raise an auditing event " "``ctypes.call_function`` with arguments ``function pointer`` and " "``arguments``." msgstr "" -#: ../../library/ctypes.rst:1699 +#: ../../library/ctypes.rst:1704 msgid "Function prototypes" msgstr "" -#: ../../library/ctypes.rst:1701 +#: ../../library/ctypes.rst:1706 msgid "" "Foreign functions can also be created by instantiating function prototypes. " "Function prototypes are similar to function prototypes in C; they describe a " @@ -2997,7 +3005,7 @@ msgid "" "``@wrapper`` syntax. See :ref:`ctypes-callback-functions` for examples." msgstr "" -#: ../../library/ctypes.rst:1712 +#: ../../library/ctypes.rst:1717 msgid "" "The returned function prototype creates functions that use the standard C " "calling convention. The function will release the GIL during the call. If " @@ -3006,37 +3014,37 @@ msgid "" "after the call; *use_last_error* does the same for the Windows error code." msgstr "" -#: ../../library/ctypes.rst:1722 +#: ../../library/ctypes.rst:1727 msgid "" "Windows only: The returned function prototype creates functions that use the " "``stdcall`` calling convention. The function will release the GIL during " "the call. *use_errno* and *use_last_error* have the same meaning as above." msgstr "" -#: ../../library/ctypes.rst:1730 +#: ../../library/ctypes.rst:1735 msgid "" "The returned function prototype creates functions that use the Python " "calling convention. The function will *not* release the GIL during the call." msgstr "" -#: ../../library/ctypes.rst:1733 +#: ../../library/ctypes.rst:1738 msgid "" "Function prototypes created by these factory functions can be instantiated " "in different ways, depending on the type and number of the parameters in the " "call:" msgstr "" -#: ../../library/ctypes.rst:1740 +#: ../../library/ctypes.rst:1745 msgid "" "Returns a foreign function at the specified address which must be an integer." msgstr "" -#: ../../library/ctypes.rst:1747 +#: ../../library/ctypes.rst:1752 msgid "" "Create a C callable function (a callback function) from a Python *callable*." msgstr "" -#: ../../library/ctypes.rst:1754 +#: ../../library/ctypes.rst:1759 msgid "" "Returns a foreign function exported by a shared library. *func_spec* must be " "a 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the " @@ -3044,7 +3052,7 @@ msgid "" "small integer. The second item is the shared library instance." msgstr "" -#: ../../library/ctypes.rst:1764 +#: ../../library/ctypes.rst:1769 msgid "" "Returns a foreign function that will call a COM method. *vtbl_index* is the " "index into the virtual function table, a small non-negative integer. *name* " @@ -3052,79 +3060,79 @@ msgid "" "identifier which is used in extended error reporting." msgstr "" -#: ../../library/ctypes.rst:1769 +#: ../../library/ctypes.rst:1774 msgid "" "COM methods use a special calling convention: They require a pointer to the " "COM interface as first argument, in addition to those parameters that are " "specified in the :attr:`!argtypes` tuple." msgstr "" -#: ../../library/ctypes.rst:1773 +#: ../../library/ctypes.rst:1778 msgid "" "The optional *paramflags* parameter creates foreign function wrappers with " "much more functionality than the features described above." msgstr "" -#: ../../library/ctypes.rst:1776 +#: ../../library/ctypes.rst:1781 msgid "" "*paramflags* must be a tuple of the same length as :attr:`~_FuncPtr." "argtypes`." msgstr "" -#: ../../library/ctypes.rst:1778 +#: ../../library/ctypes.rst:1783 msgid "" "Each item in this tuple contains further information about a parameter, it " "must be a tuple containing one, two, or three items." msgstr "" -#: ../../library/ctypes.rst:1781 +#: ../../library/ctypes.rst:1786 msgid "" "The first item is an integer containing a combination of direction flags for " "the parameter:" msgstr "" -#: ../../library/ctypes.rst:1784 +#: ../../library/ctypes.rst:1789 msgid "1" msgstr "1" -#: ../../library/ctypes.rst:1785 +#: ../../library/ctypes.rst:1790 msgid "Specifies an input parameter to the function." msgstr "" -#: ../../library/ctypes.rst:1787 +#: ../../library/ctypes.rst:1792 msgid "2" msgstr "2" -#: ../../library/ctypes.rst:1788 +#: ../../library/ctypes.rst:1793 msgid "Output parameter. The foreign function fills in a value." msgstr "" -#: ../../library/ctypes.rst:1790 +#: ../../library/ctypes.rst:1795 msgid "4" msgstr "4" -#: ../../library/ctypes.rst:1791 +#: ../../library/ctypes.rst:1796 msgid "Input parameter which defaults to the integer zero." msgstr "" -#: ../../library/ctypes.rst:1793 +#: ../../library/ctypes.rst:1798 msgid "" "The optional second item is the parameter name as string. If this is " "specified, the foreign function can be called with named parameters." msgstr "" -#: ../../library/ctypes.rst:1796 +#: ../../library/ctypes.rst:1801 msgid "The optional third item is the default value for this parameter." msgstr "" -#: ../../library/ctypes.rst:1799 +#: ../../library/ctypes.rst:1804 msgid "" "The following example demonstrates how to wrap the Windows ``MessageBoxW`` " "function so that it supports default parameters and named arguments. The C " "declaration from the windows header file is this::" msgstr "" -#: ../../library/ctypes.rst:1803 +#: ../../library/ctypes.rst:1808 msgid "" "WINUSERAPI int WINAPI\n" "MessageBoxW(\n" @@ -3140,11 +3148,11 @@ msgstr "" " LPCWSTR lpCaption,\n" " UINT uType);" -#: ../../library/ctypes.rst:1810 ../../library/ctypes.rst:1833 +#: ../../library/ctypes.rst:1815 ../../library/ctypes.rst:1838 msgid "Here is the wrapping with :mod:`ctypes`::" msgstr "" -#: ../../library/ctypes.rst:1812 +#: ../../library/ctypes.rst:1817 msgid "" ">>> from ctypes import c_int, WINFUNCTYPE, windll\n" ">>> from ctypes.wintypes import HWND, LPCWSTR, UINT\n" @@ -3160,11 +3168,11 @@ msgstr "" "\"Hello from ctypes\"), (1, \"flags\", 0)\n" ">>> MessageBox = prototype((\"MessageBoxW\", windll.user32), paramflags)" -#: ../../library/ctypes.rst:1818 +#: ../../library/ctypes.rst:1823 msgid "The ``MessageBox`` foreign function can now be called in these ways::" msgstr "" -#: ../../library/ctypes.rst:1820 +#: ../../library/ctypes.rst:1825 msgid "" ">>> MessageBox()\n" ">>> MessageBox(text=\"Spam, spam, spam\")\n" @@ -3174,7 +3182,7 @@ msgstr "" ">>> MessageBox(text=\"Spam, spam, spam\")\n" ">>> MessageBox(flags=2, text=\"foo bar\")" -#: ../../library/ctypes.rst:1824 +#: ../../library/ctypes.rst:1829 msgid "" "A second example demonstrates output parameters. The win32 " "``GetWindowRect`` function retrieves the dimensions of a specified window by " @@ -3182,7 +3190,7 @@ msgid "" "the C declaration::" msgstr "" -#: ../../library/ctypes.rst:1828 +#: ../../library/ctypes.rst:1833 msgid "" "WINUSERAPI BOOL WINAPI\n" "GetWindowRect(\n" @@ -3194,7 +3202,7 @@ msgstr "" " HWND hWnd,\n" " LPRECT lpRect);" -#: ../../library/ctypes.rst:1835 +#: ../../library/ctypes.rst:1840 msgid "" ">>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError\n" ">>> from ctypes.wintypes import BOOL, HWND, RECT\n" @@ -3212,7 +3220,7 @@ msgstr "" "paramflags)\n" ">>>" -#: ../../library/ctypes.rst:1842 +#: ../../library/ctypes.rst:1847 msgid "" "Functions with output parameters will automatically return the output " "parameter value if there is a single one, or a tuple containing the output " @@ -3220,7 +3228,7 @@ msgid "" "now returns a RECT instance, when called." msgstr "" -#: ../../library/ctypes.rst:1847 +#: ../../library/ctypes.rst:1852 msgid "" "Output parameters can be combined with the :attr:`~_FuncPtr.errcheck` " "protocol to do further output processing and error checking. The win32 " @@ -3229,7 +3237,7 @@ msgid "" "exception when the api call failed::" msgstr "" -#: ../../library/ctypes.rst:1852 +#: ../../library/ctypes.rst:1857 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3247,7 +3255,7 @@ msgstr "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" -#: ../../library/ctypes.rst:1860 +#: ../../library/ctypes.rst:1865 msgid "" "If the :attr:`~_FuncPtr.errcheck` function returns the argument tuple it " "receives unchanged, :mod:`ctypes` continues the normal processing it does on " @@ -3256,7 +3264,7 @@ msgid "" "and return them instead, the normal processing will no longer take place::" msgstr "" -#: ../../library/ctypes.rst:1866 +#: ../../library/ctypes.rst:1871 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3276,17 +3284,17 @@ msgstr "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" -#: ../../library/ctypes.rst:1879 +#: ../../library/ctypes.rst:1884 msgid "Utility functions" msgstr "" -#: ../../library/ctypes.rst:1883 +#: ../../library/ctypes.rst:1888 msgid "" "Returns the address of the memory buffer as integer. *obj* must be an " "instance of a ctypes type." msgstr "" -#: ../../library/ctypes.rst:1886 +#: ../../library/ctypes.rst:1891 msgid "" "Raises an :ref:`auditing event ` ``ctypes.addressof`` with " "argument ``obj``." @@ -3294,34 +3302,34 @@ msgstr "" "引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` ``ctypes." "addressof``。" -#: ../../library/ctypes.rst:1891 +#: ../../library/ctypes.rst:1896 msgid "" "Returns the alignment requirements of a ctypes type. *obj_or_type* must be a " "ctypes type or instance." msgstr "" -#: ../../library/ctypes.rst:1897 +#: ../../library/ctypes.rst:1902 msgid "" "Returns a light-weight pointer to *obj*, which must be an instance of a " "ctypes type. *offset* defaults to zero, and must be an integer that will be " "added to the internal pointer value." msgstr "" -#: ../../library/ctypes.rst:1901 +#: ../../library/ctypes.rst:1906 msgid "``byref(obj, offset)`` corresponds to this C code::" msgstr "" -#: ../../library/ctypes.rst:1903 +#: ../../library/ctypes.rst:1908 msgid "(((char *)&obj) + offset)" msgstr "(((char *)&obj) + offset)" -#: ../../library/ctypes.rst:1905 +#: ../../library/ctypes.rst:1910 msgid "" "The returned object can only be used as a foreign function call parameter. " "It behaves similar to ``pointer(obj)``, but the construction is a lot faster." msgstr "" -#: ../../library/ctypes.rst:1911 +#: ../../library/ctypes.rst:1916 msgid "" "This function is similar to the cast operator in C. It returns a new " "instance of *type* which points to the same memory block as *obj*. *type* " @@ -3329,19 +3337,19 @@ msgid "" "as a pointer." msgstr "" -#: ../../library/ctypes.rst:1919 +#: ../../library/ctypes.rst:1924 msgid "" "This function creates a mutable character buffer. The returned object is a " "ctypes array of :class:`c_char`." msgstr "" -#: ../../library/ctypes.rst:1922 +#: ../../library/ctypes.rst:1927 msgid "" "*init_or_size* must be an integer which specifies the size of the array, or " "a bytes object which will be used to initialize the array items." msgstr "" -#: ../../library/ctypes.rst:1925 +#: ../../library/ctypes.rst:1930 msgid "" "If a bytes object is specified as first argument, the buffer is made one " "item larger than its length so that the last element in the array is a NUL " @@ -3350,7 +3358,7 @@ msgid "" "not be used." msgstr "" -#: ../../library/ctypes.rst:1930 +#: ../../library/ctypes.rst:1935 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_string_buffer`` " "with arguments ``init``, ``size``." @@ -3358,19 +3366,19 @@ msgstr "" "引發一個附帶引數 ``init`` 與 ``size`` 的\\ :ref:`稽核事件 ` " "``ctypes.create_string_buffer``。" -#: ../../library/ctypes.rst:1935 +#: ../../library/ctypes.rst:1940 msgid "" "This function creates a mutable unicode character buffer. The returned " "object is a ctypes array of :class:`c_wchar`." msgstr "" -#: ../../library/ctypes.rst:1938 +#: ../../library/ctypes.rst:1943 msgid "" "*init_or_size* must be an integer which specifies the size of the array, or " "a string which will be used to initialize the array items." msgstr "" -#: ../../library/ctypes.rst:1941 +#: ../../library/ctypes.rst:1946 msgid "" "If a string is specified as first argument, the buffer is made one item " "larger than the length of the string so that the last element in the array " @@ -3379,7 +3387,7 @@ msgid "" "should not be used." msgstr "" -#: ../../library/ctypes.rst:1947 +#: ../../library/ctypes.rst:1952 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_unicode_buffer`` " "with arguments ``init``, ``size``." @@ -3387,21 +3395,21 @@ msgstr "" "引發一個附帶引數 ``init`` 與 ``size`` 的\\ :ref:`稽核事件 ` " "``ctypes.create_unicode_buffer``。" -#: ../../library/ctypes.rst:1952 +#: ../../library/ctypes.rst:1957 msgid "" "Windows only: This function is a hook which allows implementing in-process " "COM servers with ctypes. It is called from the DllCanUnloadNow function " "that the _ctypes extension dll exports." msgstr "" -#: ../../library/ctypes.rst:1959 +#: ../../library/ctypes.rst:1964 msgid "" "Windows only: This function is a hook which allows implementing in-process " "COM servers with ctypes. It is called from the DllGetClassObject function " "that the ``_ctypes`` extension dll exports." msgstr "" -#: ../../library/ctypes.rst:1967 +#: ../../library/ctypes.rst:1972 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like ``lib``, suffix like ``.so``, ``.dylib`` or version " @@ -3409,94 +3417,94 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:1978 +#: ../../library/ctypes.rst:1983 msgid "" "Windows only: return the filename of the VC runtime library used by Python, " "and by the extension modules. If the name of the library cannot be " "determined, ``None`` is returned." msgstr "" -#: ../../library/ctypes.rst:1982 +#: ../../library/ctypes.rst:1987 msgid "" "If you need to free memory, for example, allocated by an extension module " "with a call to the ``free(void *)``, it is important that you use the " "function in the same library that allocated the memory." msgstr "" -#: ../../library/ctypes.rst:1989 +#: ../../library/ctypes.rst:1994 msgid "" "Windows only: Returns a textual description of the error code *code*. If no " "error code is specified, the last error code is used by calling the Windows " "api function GetLastError." msgstr "" -#: ../../library/ctypes.rst:1996 +#: ../../library/ctypes.rst:2001 msgid "" "Windows only: Returns the last error code set by Windows in the calling " "thread. This function calls the Windows ``GetLastError()`` function " "directly, it does not return the ctypes-private copy of the error code." msgstr "" -#: ../../library/ctypes.rst:2002 +#: ../../library/ctypes.rst:2007 msgid "" "Returns the current value of the ctypes-private copy of the system :data:" "`errno` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:2005 +#: ../../library/ctypes.rst:2010 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_errno`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``ctypes.get_errno``。" -#: ../../library/ctypes.rst:2009 +#: ../../library/ctypes.rst:2014 msgid "" "Windows only: returns the current value of the ctypes-private copy of the " "system :data:`!LastError` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:2012 +#: ../../library/ctypes.rst:2017 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_last_error`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``ctypes.get_last_error``。" -#: ../../library/ctypes.rst:2016 +#: ../../library/ctypes.rst:2021 msgid "" "Same as the standard C memmove library function: copies *count* bytes from " "*src* to *dst*. *dst* and *src* must be integers or ctypes instances that " "can be converted to pointers." msgstr "" -#: ../../library/ctypes.rst:2023 +#: ../../library/ctypes.rst:2028 msgid "" "Same as the standard C memset library function: fills the memory block at " "address *dst* with *count* bytes of value *c*. *dst* must be an integer " "specifying an address, or a ctypes instance." msgstr "" -#: ../../library/ctypes.rst:2030 +#: ../../library/ctypes.rst:2035 msgid "" "Create and return a new ctypes pointer type. Pointer types are cached and " "reused internally, so calling this function repeatedly is cheap. *type* must " "be a ctypes type." msgstr "" -#: ../../library/ctypes.rst:2037 +#: ../../library/ctypes.rst:2042 msgid "" "Create a new pointer instance, pointing to *obj*. The returned object is of " "the type ``POINTER(type(obj))``." msgstr "" -#: ../../library/ctypes.rst:2040 +#: ../../library/ctypes.rst:2045 msgid "" "Note: If you just want to pass a pointer to an object to a foreign function " "call, you should use ``byref(obj)`` which is much faster." msgstr "" -#: ../../library/ctypes.rst:2046 +#: ../../library/ctypes.rst:2051 msgid "" "This function resizes the internal memory buffer of *obj*, which must be an " "instance of a ctypes type. It is not possible to make the buffer smaller " @@ -3504,13 +3512,13 @@ msgid "" "but it is possible to enlarge the buffer." msgstr "" -#: ../../library/ctypes.rst:2054 +#: ../../library/ctypes.rst:2059 msgid "" "Set the current value of the ctypes-private copy of the system :data:`errno` " "variable in the calling thread to *value* and return the previous value." msgstr "" -#: ../../library/ctypes.rst:2057 +#: ../../library/ctypes.rst:2062 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_errno`` with " "argument ``errno``." @@ -3518,14 +3526,14 @@ msgstr "" "引發一個附帶引數 ``errno`` 的\\ :ref:`稽核事件 ` ``ctypes." "set_errno``。" -#: ../../library/ctypes.rst:2062 +#: ../../library/ctypes.rst:2067 msgid "" "Windows only: set the current value of the ctypes-private copy of the " "system :data:`!LastError` variable in the calling thread to *value* and " "return the previous value." msgstr "" -#: ../../library/ctypes.rst:2066 +#: ../../library/ctypes.rst:2071 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_last_error`` with " "argument ``error``." @@ -3533,19 +3541,19 @@ msgstr "" "引發一個附帶引數 ``error`` 的\\ :ref:`稽核事件 ` ``ctypes." "set_last_error``。" -#: ../../library/ctypes.rst:2071 +#: ../../library/ctypes.rst:2076 msgid "" "Returns the size in bytes of a ctypes type or instance memory buffer. Does " "the same as the C ``sizeof`` operator." msgstr "" -#: ../../library/ctypes.rst:2077 +#: ../../library/ctypes.rst:2082 msgid "" "Return the byte string at *void \\*ptr*. If *size* is specified, it is used " "as size, otherwise the string is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2081 +#: ../../library/ctypes.rst:2086 msgid "" "Raises an :ref:`auditing event ` ``ctypes.string_at`` with " "arguments ``ptr``, ``size``." @@ -3553,7 +3561,7 @@ msgstr "" "引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." "string_at``。" -#: ../../library/ctypes.rst:2086 +#: ../../library/ctypes.rst:2091 msgid "" "Windows only: this function is probably the worst-named thing in ctypes. It " "creates an instance of :exc:`OSError`. If *code* is not specified, " @@ -3562,20 +3570,20 @@ msgid "" "error." msgstr "" -#: ../../library/ctypes.rst:2092 +#: ../../library/ctypes.rst:2097 msgid "" "An instance of :exc:`WindowsError` used to be created, which is now an alias " "of :exc:`OSError`." msgstr "" -#: ../../library/ctypes.rst:2099 +#: ../../library/ctypes.rst:2104 msgid "" "Return the wide-character string at *void \\*ptr*. If *size* is specified, " "it is used as the number of characters of the string, otherwise the string " "is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2104 +#: ../../library/ctypes.rst:2109 msgid "" "Raises an :ref:`auditing event ` ``ctypes.wstring_at`` with " "arguments ``ptr``, ``size``." @@ -3583,11 +3591,11 @@ msgstr "" "引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." "wstring_at``。" -#: ../../library/ctypes.rst:2110 +#: ../../library/ctypes.rst:2115 msgid "Data types" msgstr "" -#: ../../library/ctypes.rst:2115 +#: ../../library/ctypes.rst:2120 msgid "" "This non-public class is the common base class of all ctypes data types. " "Among other things, all ctypes type instances contain a memory block that " @@ -3597,13 +3605,13 @@ msgid "" "alive in case the memory block contains pointers." msgstr "" -#: ../../library/ctypes.rst:2122 +#: ../../library/ctypes.rst:2127 msgid "" "Common methods of ctypes data types, these are all class methods (to be " "exact, they are methods of the :term:`metaclass`):" msgstr "" -#: ../../library/ctypes.rst:2127 +#: ../../library/ctypes.rst:2132 msgid "" "This method returns a ctypes instance that shares the buffer of the *source* " "object. The *source* object must support the writeable buffer interface. " @@ -3612,7 +3620,7 @@ msgid "" "exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2133 ../../library/ctypes.rst:2143 +#: ../../library/ctypes.rst:2138 ../../library/ctypes.rst:2148 msgid "" "Raises an :ref:`auditing event ` ``ctypes.cdata/buffer`` with " "arguments ``pointer``, ``size``, ``offset``." @@ -3620,7 +3628,7 @@ msgstr "" "引發一個附帶引數 ``pointer``、``size``、``offset`` 的\\ :ref:`稽核事件 " "` ``ctypes.cdata/buffer``。" -#: ../../library/ctypes.rst:2137 +#: ../../library/ctypes.rst:2142 msgid "" "This method creates a ctypes instance, copying the buffer from the *source* " "object buffer which must be readable. The optional *offset* parameter " @@ -3628,19 +3636,19 @@ msgid "" "If the source buffer is not large enough a :exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2147 +#: ../../library/ctypes.rst:2152 msgid "" "This method returns a ctypes type instance using the memory specified by " "*address* which must be an integer." msgstr "" -#: ../../library/ctypes.rst:2150 ../../library/ctypes.rst:2152 +#: ../../library/ctypes.rst:2155 ../../library/ctypes.rst:2157 msgid "" "This method, and others that indirectly call this method, raises an :ref:" "`auditing event ` ``ctypes.cdata`` with argument ``address``." msgstr "" -#: ../../library/ctypes.rst:2158 +#: ../../library/ctypes.rst:2163 msgid "" "This method adapts *obj* to a ctypes type. It is called with the actual " "object used in a foreign function call when the type is present in the " @@ -3648,25 +3656,25 @@ msgid "" "object that can be used as a function call parameter." msgstr "" -#: ../../library/ctypes.rst:2163 +#: ../../library/ctypes.rst:2168 msgid "" "All ctypes data types have a default implementation of this classmethod that " "normally returns *obj* if that is an instance of the type. Some types " "accept other objects as well." msgstr "" -#: ../../library/ctypes.rst:2169 +#: ../../library/ctypes.rst:2174 msgid "" "This method returns a ctypes type instance exported by a shared library. " "*name* is the name of the symbol that exports the data, *library* is the " "loaded shared library." msgstr "" -#: ../../library/ctypes.rst:2173 +#: ../../library/ctypes.rst:2178 msgid "Common instance variables of ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2177 +#: ../../library/ctypes.rst:2182 msgid "" "Sometimes ctypes data instances do not own the memory block they contain, " "instead they share part of the memory block of a base object. The :attr:" @@ -3674,13 +3682,13 @@ msgid "" "block." msgstr "" -#: ../../library/ctypes.rst:2184 +#: ../../library/ctypes.rst:2189 msgid "" "This read-only variable is true when the ctypes data instance has allocated " "the memory block itself, false otherwise." msgstr "" -#: ../../library/ctypes.rst:2189 +#: ../../library/ctypes.rst:2194 msgid "" "This member is either ``None`` or a dictionary containing Python objects " "that need to be kept alive so that the memory block contents is kept valid. " @@ -3688,7 +3696,7 @@ msgid "" "dictionary." msgstr "" -#: ../../library/ctypes.rst:2202 +#: ../../library/ctypes.rst:2207 msgid "" "This non-public class is the base class of all fundamental ctypes data " "types. It is mentioned here because it contains the common attributes of the " @@ -3697,11 +3705,11 @@ msgid "" "types that are not and do not contain pointers can now be pickled." msgstr "" -#: ../../library/ctypes.rst:2208 +#: ../../library/ctypes.rst:2213 msgid "Instances have a single attribute:" msgstr "" -#: ../../library/ctypes.rst:2212 +#: ../../library/ctypes.rst:2217 msgid "" "This attribute contains the actual value of the instance. For integer and " "pointer types, it is an integer, for character types, it is a single " @@ -3709,7 +3717,7 @@ msgid "" "bytes object or string." msgstr "" -#: ../../library/ctypes.rst:2217 +#: ../../library/ctypes.rst:2222 msgid "" "When the ``value`` attribute is retrieved from a ctypes instance, usually a " "new object is returned each time. :mod:`ctypes` does *not* implement " @@ -3717,7 +3725,7 @@ msgid "" "true for all other ctypes object instances." msgstr "" -#: ../../library/ctypes.rst:2223 +#: ../../library/ctypes.rst:2228 msgid "" "Fundamental data types, when returned as foreign function call results, or, " "for example, by retrieving structure field members or array items, are " @@ -3727,7 +3735,7 @@ msgid "" "instance." msgstr "" -#: ../../library/ctypes.rst:2231 +#: ../../library/ctypes.rst:2236 msgid "" "Subclasses of fundamental data types do *not* inherit this behavior. So, if " "a foreign functions :attr:`!restype` is a subclass of :class:`c_void_p`, you " @@ -3735,25 +3743,25 @@ msgid "" "you can get the value of the pointer by accessing the ``value`` attribute." msgstr "" -#: ../../library/ctypes.rst:2236 +#: ../../library/ctypes.rst:2241 msgid "These are the fundamental ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2240 +#: ../../library/ctypes.rst:2245 msgid "" "Represents the C :c:expr:`signed char` datatype, and interprets the value as " "small integer. The constructor accepts an optional integer initializer; no " "overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2247 +#: ../../library/ctypes.rst:2252 msgid "" "Represents the C :c:expr:`char` datatype, and interprets the value as a " "single character. The constructor accepts an optional string initializer, " "the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2254 +#: ../../library/ctypes.rst:2259 msgid "" "Represents the C :c:expr:`char *` datatype when it points to a zero-" "terminated string. For a general character pointer that may also point to " @@ -3761,182 +3769,182 @@ msgid "" "integer address, or a bytes object." msgstr "" -#: ../../library/ctypes.rst:2262 +#: ../../library/ctypes.rst:2267 msgid "" "Represents the C :c:expr:`double` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2268 +#: ../../library/ctypes.rst:2273 msgid "" "Represents the C :c:expr:`long double` datatype. The constructor accepts an " "optional float initializer. On platforms where ``sizeof(long double) == " "sizeof(double)`` it is an alias to :class:`c_double`." msgstr "" -#: ../../library/ctypes.rst:2274 +#: ../../library/ctypes.rst:2279 msgid "" "Represents the C :c:expr:`float` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2280 +#: ../../library/ctypes.rst:2285 msgid "" "Represents the C :c:expr:`signed int` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias to :class:`c_long`." msgstr "" -#: ../../library/ctypes.rst:2287 +#: ../../library/ctypes.rst:2292 msgid "" "Represents the C 8-bit :c:expr:`signed int` datatype. Usually an alias for :" "class:`c_byte`." msgstr "" -#: ../../library/ctypes.rst:2293 +#: ../../library/ctypes.rst:2298 msgid "" "Represents the C 16-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_short`." msgstr "" -#: ../../library/ctypes.rst:2299 +#: ../../library/ctypes.rst:2304 msgid "" "Represents the C 32-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_int`." msgstr "" -#: ../../library/ctypes.rst:2305 +#: ../../library/ctypes.rst:2310 msgid "" "Represents the C 64-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_longlong`." msgstr "" -#: ../../library/ctypes.rst:2311 +#: ../../library/ctypes.rst:2316 msgid "" "Represents the C :c:expr:`signed long` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2317 +#: ../../library/ctypes.rst:2322 msgid "" "Represents the C :c:expr:`signed long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2323 +#: ../../library/ctypes.rst:2328 msgid "" "Represents the C :c:expr:`signed short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2329 +#: ../../library/ctypes.rst:2334 msgid "Represents the C :c:type:`size_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2334 +#: ../../library/ctypes.rst:2339 msgid "Represents the C :c:type:`ssize_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2341 +#: ../../library/ctypes.rst:2346 msgid "Represents the C :c:type:`time_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2348 +#: ../../library/ctypes.rst:2353 msgid "" "Represents the C :c:expr:`unsigned char` datatype, it interprets the value " "as small integer. The constructor accepts an optional integer initializer; " "no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2355 +#: ../../library/ctypes.rst:2360 msgid "" "Represents the C :c:expr:`unsigned int` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`." msgstr "" -#: ../../library/ctypes.rst:2362 +#: ../../library/ctypes.rst:2367 msgid "" "Represents the C 8-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ubyte`." msgstr "" -#: ../../library/ctypes.rst:2368 +#: ../../library/ctypes.rst:2373 msgid "" "Represents the C 16-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ushort`." msgstr "" -#: ../../library/ctypes.rst:2374 +#: ../../library/ctypes.rst:2379 msgid "" "Represents the C 32-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_uint`." msgstr "" -#: ../../library/ctypes.rst:2380 +#: ../../library/ctypes.rst:2385 msgid "" "Represents the C 64-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ulonglong`." msgstr "" -#: ../../library/ctypes.rst:2386 +#: ../../library/ctypes.rst:2391 msgid "" "Represents the C :c:expr:`unsigned long` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2392 +#: ../../library/ctypes.rst:2397 msgid "" "Represents the C :c:expr:`unsigned long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2398 +#: ../../library/ctypes.rst:2403 msgid "" "Represents the C :c:expr:`unsigned short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2404 +#: ../../library/ctypes.rst:2409 msgid "" "Represents the C :c:expr:`void *` type. The value is represented as " "integer. The constructor accepts an optional integer initializer." msgstr "" -#: ../../library/ctypes.rst:2410 +#: ../../library/ctypes.rst:2415 msgid "" "Represents the C :c:type:`wchar_t` datatype, and interprets the value as a " "single character unicode string. The constructor accepts an optional string " "initializer, the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2417 +#: ../../library/ctypes.rst:2422 msgid "" "Represents the C :c:expr:`wchar_t *` datatype, which must be a pointer to a " "zero-terminated wide character string. The constructor accepts an integer " "address, or a string." msgstr "" -#: ../../library/ctypes.rst:2424 +#: ../../library/ctypes.rst:2429 msgid "" "Represent the C :c:expr:`bool` datatype (more accurately, :c:expr:`_Bool` " "from C99). Its value can be ``True`` or ``False``, and the constructor " "accepts any object that has a truth value." msgstr "" -#: ../../library/ctypes.rst:2431 +#: ../../library/ctypes.rst:2436 msgid "" "Windows only: Represents a :c:type:`!HRESULT` value, which contains success " "or error information for a function or method call." msgstr "" -#: ../../library/ctypes.rst:2437 +#: ../../library/ctypes.rst:2442 msgid "" "Represents the C :c:expr:`PyObject *` datatype. Calling this without an " "argument creates a ``NULL`` :c:expr:`PyObject *` pointer." msgstr "" -#: ../../library/ctypes.rst:2440 +#: ../../library/ctypes.rst:2445 msgid "" "The :mod:`!ctypes.wintypes` module provides quite some other Windows " "specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, or :c:" @@ -3944,41 +3952,41 @@ msgid "" "are also defined." msgstr "" -#: ../../library/ctypes.rst:2448 +#: ../../library/ctypes.rst:2453 msgid "Structured data types" msgstr "" -#: ../../library/ctypes.rst:2453 +#: ../../library/ctypes.rst:2458 msgid "Abstract base class for unions in native byte order." msgstr "" -#: ../../library/ctypes.rst:2458 +#: ../../library/ctypes.rst:2463 msgid "Abstract base class for unions in *big endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2464 +#: ../../library/ctypes.rst:2469 msgid "Abstract base class for unions in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2470 +#: ../../library/ctypes.rst:2475 msgid "Abstract base class for structures in *big endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2475 +#: ../../library/ctypes.rst:2480 msgid "Abstract base class for structures in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2477 +#: ../../library/ctypes.rst:2482 msgid "" "Structures and unions with non-native byte order cannot contain pointer type " "fields, or any other data types containing pointer type fields." msgstr "" -#: ../../library/ctypes.rst:2483 +#: ../../library/ctypes.rst:2488 msgid "Abstract base class for structures in *native* byte order." msgstr "" -#: ../../library/ctypes.rst:2485 +#: ../../library/ctypes.rst:2490 msgid "" "Concrete structure and union types must be created by subclassing one of " "these types, and at least define a :attr:`_fields_` class variable. :mod:" @@ -3986,34 +3994,34 @@ msgid "" "the fields by direct attribute accesses. These are the" msgstr "" -#: ../../library/ctypes.rst:2493 +#: ../../library/ctypes.rst:2498 msgid "" "A sequence defining the structure fields. The items must be 2-tuples or 3-" "tuples. The first item is the name of the field, the second item specifies " "the type of the field; it can be any ctypes data type." msgstr "" -#: ../../library/ctypes.rst:2497 +#: ../../library/ctypes.rst:2502 msgid "" "For integer type fields like :class:`c_int`, a third optional item can be " "given. It must be a small positive integer defining the bit width of the " "field." msgstr "" -#: ../../library/ctypes.rst:2501 +#: ../../library/ctypes.rst:2506 msgid "" "Field names must be unique within one structure or union. This is not " "checked, only one field can be accessed when names are repeated." msgstr "" -#: ../../library/ctypes.rst:2504 +#: ../../library/ctypes.rst:2509 msgid "" "It is possible to define the :attr:`_fields_` class variable *after* the " "class statement that defines the Structure subclass, this allows creating " "data types that directly or indirectly reference themselves::" msgstr "" -#: ../../library/ctypes.rst:2508 +#: ../../library/ctypes.rst:2513 msgid "" "class List(Structure):\n" " pass\n" @@ -4027,7 +4035,7 @@ msgstr "" " ...\n" " ]" -#: ../../library/ctypes.rst:2514 +#: ../../library/ctypes.rst:2519 msgid "" "The :attr:`_fields_` class variable must, however, be defined before the " "type is first used (an instance is created, :func:`sizeof` is called on it, " @@ -4035,14 +4043,14 @@ msgid "" "raise an AttributeError." msgstr "" -#: ../../library/ctypes.rst:2519 +#: ../../library/ctypes.rst:2524 msgid "" "It is possible to define sub-subclasses of structure types, they inherit the " "fields of the base class plus the :attr:`_fields_` defined in the sub-" "subclass, if any." msgstr "" -#: ../../library/ctypes.rst:2526 +#: ../../library/ctypes.rst:2531 msgid "" "An optional small integer that allows overriding the alignment of structure " "fields in the instance. :attr:`_pack_` must already be defined when :attr:" @@ -4050,14 +4058,21 @@ msgid "" "attribute to 0 is the same as not setting it at all." msgstr "" -#: ../../library/ctypes.rst:2534 +#: ../../library/ctypes.rst:2539 +msgid "" +"An optional small integer that allows overriding the alignment of the " +"structure when being packed or unpacked to/from memory. Setting this " +"attribute to 0 is the same as not setting it at all." +msgstr "" + +#: ../../library/ctypes.rst:2545 msgid "" "An optional sequence that lists the names of unnamed (anonymous) fields. :" "attr:`_anonymous_` must be already defined when :attr:`_fields_` is " "assigned, otherwise it will have no effect." msgstr "" -#: ../../library/ctypes.rst:2538 +#: ../../library/ctypes.rst:2549 msgid "" "The fields listed in this variable must be structure or union type fields. :" "mod:`ctypes` will create descriptors in the structure type that allows " @@ -4065,11 +4080,11 @@ msgid "" "structure or union field." msgstr "" -#: ../../library/ctypes.rst:2543 +#: ../../library/ctypes.rst:2554 msgid "Here is an example type (Windows)::" msgstr "" -#: ../../library/ctypes.rst:2545 +#: ../../library/ctypes.rst:2556 msgid "" "class _U(Union):\n" " _fields_ = [(\"lptdesc\", POINTER(TYPEDESC)),\n" @@ -4091,7 +4106,7 @@ msgstr "" " _fields_ = [(\"u\", _U),\n" " (\"vt\", VARTYPE)]" -#: ../../library/ctypes.rst:2556 +#: ../../library/ctypes.rst:2567 msgid "" "The ``TYPEDESC`` structure describes a COM data type, the ``vt`` field " "specifies which one of the union fields is valid. Since the ``u`` field is " @@ -4101,7 +4116,7 @@ msgid "" "temporary union instance::" msgstr "" -#: ../../library/ctypes.rst:2563 +#: ../../library/ctypes.rst:2574 msgid "" "td = TYPEDESC()\n" "td.vt = VT_PTR\n" @@ -4113,7 +4128,7 @@ msgstr "" "td.lptdesc = POINTER(some_type)\n" "td.u.lptdesc = POINTER(some_type)" -#: ../../library/ctypes.rst:2568 +#: ../../library/ctypes.rst:2579 msgid "" "It is possible to define sub-subclasses of structures, they inherit the " "fields of the base class. If the subclass definition has a separate :attr:" @@ -4121,7 +4136,7 @@ msgid "" "of the base class." msgstr "" -#: ../../library/ctypes.rst:2573 +#: ../../library/ctypes.rst:2584 msgid "" "Structure and union constructors accept both positional and keyword " "arguments. Positional arguments are used to initialize member fields in the " @@ -4131,15 +4146,15 @@ msgid "" "names not present in :attr:`_fields_`." msgstr "" -#: ../../library/ctypes.rst:2584 +#: ../../library/ctypes.rst:2595 msgid "Arrays and pointers" msgstr "" -#: ../../library/ctypes.rst:2588 +#: ../../library/ctypes.rst:2599 msgid "Abstract base class for arrays." msgstr "" -#: ../../library/ctypes.rst:2590 +#: ../../library/ctypes.rst:2601 msgid "" "The recommended way to create concrete array types is by multiplying any :" "mod:`ctypes` data type with a non-negative integer. Alternatively, you can " @@ -4149,34 +4164,46 @@ msgid "" "an :class:`Array`." msgstr "" -#: ../../library/ctypes.rst:2600 +#: ../../library/ctypes.rst:2611 msgid "" "A positive integer specifying the number of elements in the array. Out-of-" "range subscripts result in an :exc:`IndexError`. Will be returned by :func:" "`len`." msgstr "" -#: ../../library/ctypes.rst:2607 +#: ../../library/ctypes.rst:2618 msgid "Specifies the type of each element in the array." msgstr "" -#: ../../library/ctypes.rst:2610 +#: ../../library/ctypes.rst:2621 msgid "" "Array subclass constructors accept positional arguments, used to initialize " "the elements in order." msgstr "" -#: ../../library/ctypes.rst:2616 +#: ../../library/ctypes.rst:2626 +msgid "" +"Create an array. Equivalent to ``type * length``, where *type* is a :mod:" +"`ctypes` data type and *length* an integer." +msgstr "" + +#: ../../library/ctypes.rst:2630 +msgid "" +"This function is :term:`soft deprecated` in favor of multiplication. There " +"are no plans to remove it." +msgstr "" + +#: ../../library/ctypes.rst:2636 msgid "Private, abstract base class for pointers." msgstr "" -#: ../../library/ctypes.rst:2618 +#: ../../library/ctypes.rst:2638 msgid "" "Concrete pointer types are created by calling :func:`POINTER` with the type " "that will be pointed to; this is done automatically by :func:`pointer`." msgstr "" -#: ../../library/ctypes.rst:2622 +#: ../../library/ctypes.rst:2642 msgid "" "If a pointer points to an array, its elements can be read and written using " "standard subscript and slice accesses. Pointer objects have no size, so :" @@ -4185,11 +4212,11 @@ msgid "" "probably crash with an access violation (if you're lucky)." msgstr "" -#: ../../library/ctypes.rst:2632 +#: ../../library/ctypes.rst:2652 msgid "Specifies the type pointed to." msgstr "" -#: ../../library/ctypes.rst:2636 +#: ../../library/ctypes.rst:2656 msgid "" "Returns the object to which to pointer points. Assigning to this attribute " "changes the pointer to point to the assigned object." diff --git a/library/curses.po b/library/curses.po index 91641a8133..e2707a4f1a 100644 --- a/library/curses.po +++ b/library/curses.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-27 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -40,80 +40,92 @@ msgid "" "curses library hosted on Linux and the BSD variants of Unix." msgstr "" -#: ../../library/curses.rst:26 +#: ../../includes/wasm-ios-notavail.rst:3 +msgid ":ref:`Availability `: not WASI, not iOS." +msgstr "" + +#: ../../includes/wasm-ios-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms, or " +"on iOS. See :ref:`wasm-availability` for more information on WASM " +"availability; see :ref:`iOS-availability` for more information on iOS " +"availability." +msgstr "" + +#: ../../library/curses.rst:28 msgid "" "Whenever the documentation mentions a *character* it can be specified as an " "integer, a one-character Unicode string or a one-byte byte string." msgstr "" -#: ../../library/curses.rst:29 +#: ../../library/curses.rst:31 msgid "" "Whenever the documentation mentions a *character string* it can be specified " "as a Unicode string or a byte string." msgstr "" -#: ../../library/curses.rst:34 +#: ../../library/curses.rst:36 msgid "Module :mod:`curses.ascii`" msgstr ":mod:`curses.ascii` 模組" -#: ../../library/curses.rst:35 +#: ../../library/curses.rst:37 msgid "" "Utilities for working with ASCII characters, regardless of your locale " "settings." msgstr "" -#: ../../library/curses.rst:37 +#: ../../library/curses.rst:39 msgid "Module :mod:`curses.panel`" msgstr ":mod:`curses.panel` 模組" -#: ../../library/curses.rst:38 +#: ../../library/curses.rst:40 msgid "A panel stack extension that adds depth to curses windows." msgstr "" -#: ../../library/curses.rst:40 +#: ../../library/curses.rst:42 msgid "Module :mod:`curses.textpad`" msgstr ":mod:`curses.textpad` 模組" -#: ../../library/curses.rst:41 +#: ../../library/curses.rst:43 msgid "" "Editable text widget for curses supporting :program:`Emacs`\\ -like " "bindings." msgstr "" -#: ../../library/curses.rst:43 +#: ../../library/curses.rst:45 msgid ":ref:`curses-howto`" msgstr ":ref:`curses-howto`" -#: ../../library/curses.rst:44 +#: ../../library/curses.rst:46 msgid "" "Tutorial material on using curses with Python, by Andrew Kuchling and Eric " "Raymond." msgstr "" -#: ../../library/curses.rst:51 +#: ../../library/curses.rst:53 msgid "Functions" msgstr "函式" -#: ../../library/curses.rst:53 +#: ../../library/curses.rst:55 msgid "The module :mod:`curses` defines the following exception:" msgstr "" -#: ../../library/curses.rst:58 +#: ../../library/curses.rst:60 msgid "Exception raised when a curses library function returns an error." msgstr "" -#: ../../library/curses.rst:62 +#: ../../library/curses.rst:64 msgid "" "Whenever *x* or *y* arguments to a function or a method are optional, they " "default to the current cursor location. Whenever *attr* is optional, it " "defaults to :const:`A_NORMAL`." msgstr "" -#: ../../library/curses.rst:66 +#: ../../library/curses.rst:68 msgid "The module :mod:`curses` defines the following functions:" msgstr "" -#: ../../library/curses.rst:71 +#: ../../library/curses.rst:73 msgid "" "Return the output speed of the terminal in bits per second. On software " "terminal emulators it will have a fixed high value. Included for historical " @@ -121,17 +133,17 @@ msgid "" "and occasionally to change interfaces depending on the line speed." msgstr "" -#: ../../library/curses.rst:79 +#: ../../library/curses.rst:81 msgid "Emit a short attention sound." msgstr "" -#: ../../library/curses.rst:84 +#: ../../library/curses.rst:86 msgid "" "Return ``True`` or ``False``, depending on whether the programmer can change " "the colors displayed by the terminal." msgstr "" -#: ../../library/curses.rst:90 +#: ../../library/curses.rst:92 msgid "" "Enter cbreak mode. In cbreak mode (sometimes called \"rare\" mode) normal " "tty line buffering is turned off and characters are available to be read one " @@ -141,7 +153,7 @@ msgid "" "terminal in cbreak mode." msgstr "" -#: ../../library/curses.rst:99 +#: ../../library/curses.rst:101 msgid "" "Return the intensity of the red, green, and blue (RGB) components in the " "color *color_number*, which must be between ``0`` and ``COLORS - 1``. " @@ -150,7 +162,7 @@ msgid "" "component)." msgstr "" -#: ../../library/curses.rst:107 +#: ../../library/curses.rst:109 msgid "" "Return the attribute value for displaying text in the specified color pair. " "Only the first 256 color pairs are supported. This attribute value can be " @@ -159,7 +171,7 @@ msgid "" "function." msgstr "" -#: ../../library/curses.rst:116 +#: ../../library/curses.rst:118 msgid "" "Set the cursor state. *visibility* can be set to ``0``, ``1``, or ``2``, " "for invisible, normal, or very visible. If the terminal supports the " @@ -168,7 +180,7 @@ msgid "" "and the \"very visible\" mode is a block cursor." msgstr "" -#: ../../library/curses.rst:125 +#: ../../library/curses.rst:127 msgid "" "Save the current terminal mode as the \"program\" mode, the mode when the " "running program is using curses. (Its counterpart is the \"shell\" mode, " @@ -176,7 +188,7 @@ msgid "" "`reset_prog_mode` will restore this mode." msgstr "" -#: ../../library/curses.rst:133 +#: ../../library/curses.rst:135 msgid "" "Save the current terminal mode as the \"shell\" mode, the mode when the " "running program is not using curses. (Its counterpart is the \"program\" " @@ -184,11 +196,11 @@ msgid "" "func:`reset_shell_mode` will restore this mode." msgstr "" -#: ../../library/curses.rst:141 +#: ../../library/curses.rst:143 msgid "Insert an *ms* millisecond pause in output." msgstr "" -#: ../../library/curses.rst:146 +#: ../../library/curses.rst:148 msgid "" "Update the physical screen. The curses library keeps two data structures, " "one representing the current physical screen contents and a virtual screen " @@ -196,7 +208,7 @@ msgid "" "the physical screen to match the virtual screen." msgstr "" -#: ../../library/curses.rst:151 +#: ../../library/curses.rst:153 msgid "" "The virtual screen may be updated by a :meth:`~window.noutrefresh` call " "after write operations such as :meth:`~window.addstr` have been performed on " @@ -207,24 +219,24 @@ msgid "" "func:`!doupdate`." msgstr "" -#: ../../library/curses.rst:161 +#: ../../library/curses.rst:163 msgid "" "Enter echo mode. In echo mode, each character input is echoed to the screen " "as it is entered." msgstr "" -#: ../../library/curses.rst:167 +#: ../../library/curses.rst:169 msgid "De-initialize the library, and return terminal to normal status." msgstr "" -#: ../../library/curses.rst:172 +#: ../../library/curses.rst:174 msgid "" "Return the user's current erase character as a one-byte bytes object. Under " "Unix operating systems this is a property of the controlling tty of the " "curses program, and is not set by the curses library itself." msgstr "" -#: ../../library/curses.rst:179 +#: ../../library/curses.rst:181 msgid "" "The :func:`.filter` routine, if used, must be called before :func:`initscr` " "is called. The effect is that, during those calls, :envvar:`LINES` is set " @@ -235,20 +247,20 @@ msgid "" "time line editing without touching the rest of the screen." msgstr "" -#: ../../library/curses.rst:189 +#: ../../library/curses.rst:191 msgid "" "Flash the screen. That is, change it to reverse-video and then change it " "back in a short interval. Some people prefer such as 'visible bell' to the " "audible attention signal produced by :func:`beep`." msgstr "" -#: ../../library/curses.rst:196 +#: ../../library/curses.rst:198 msgid "" "Flush all input buffers. This throws away any typeahead that has been " "typed by the user and has not yet been processed by the program." msgstr "" -#: ../../library/curses.rst:202 +#: ../../library/curses.rst:204 msgid "" "After :meth:`~window.getch` returns :const:`KEY_MOUSE` to signal a mouse " "event, this method should be called to retrieve the queued mouse event, " @@ -263,51 +275,51 @@ msgid "" "const:`BUTTON_ALT`." msgstr "" -#: ../../library/curses.rst:213 ../../library/curses.rst:1774 +#: ../../library/curses.rst:215 ../../library/curses.rst:1776 msgid "" "The ``BUTTON5_*`` constants are now exposed if they are provided by the " "underlying curses library." msgstr "" -#: ../../library/curses.rst:220 +#: ../../library/curses.rst:222 msgid "" "Return the current coordinates of the virtual screen cursor as a tuple ``(y, " "x)``. If :meth:`leaveok ` is currently ``True``, then " "return ``(-1, -1)``." msgstr "" -#: ../../library/curses.rst:226 +#: ../../library/curses.rst:228 msgid "" "Read window related data stored in the file by an earlier :func:`window." "putwin` call. The routine then creates and initializes a new window using " "that data, returning the new window object." msgstr "" -#: ../../library/curses.rst:233 +#: ../../library/curses.rst:235 msgid "" "Return ``True`` if the terminal can display colors; otherwise, return " "``False``." msgstr "" -#: ../../library/curses.rst:237 +#: ../../library/curses.rst:239 msgid "" "Return ``True`` if the module supports extended colors; otherwise, return " "``False``. Extended color support allows more than 256 color pairs for " "terminals that support more than 16 colors (e.g. xterm-256color)." msgstr "" -#: ../../library/curses.rst:241 +#: ../../library/curses.rst:243 msgid "Extended color support requires ncurses version 6.1 or later." msgstr "" -#: ../../library/curses.rst:247 +#: ../../library/curses.rst:249 msgid "" "Return ``True`` if the terminal has insert- and delete-character " "capabilities. This function is included for historical reasons only, as all " "modern software terminal emulators have such capabilities." msgstr "" -#: ../../library/curses.rst:254 +#: ../../library/curses.rst:256 msgid "" "Return ``True`` if the terminal has insert- and delete-line capabilities, or " "can simulate them using scrolling regions. This function is included for " @@ -315,13 +327,13 @@ msgid "" "capabilities." msgstr "" -#: ../../library/curses.rst:262 +#: ../../library/curses.rst:264 msgid "" "Take a key value *ch*, and return ``True`` if the current terminal type " "recognizes a key with that value." msgstr "" -#: ../../library/curses.rst:268 +#: ../../library/curses.rst:270 msgid "" "Used for half-delay mode, which is similar to cbreak mode in that characters " "typed by the user are immediately available to the program. However, after " @@ -330,7 +342,7 @@ msgid "" "``255``. Use :func:`nocbreak` to leave half-delay mode." msgstr "" -#: ../../library/curses.rst:277 +#: ../../library/curses.rst:279 msgid "" "Change the definition of a color, taking the number of the color to be " "changed followed by three RGB values (for the amounts of red, green, and " @@ -342,7 +354,7 @@ msgid "" "``True``." msgstr "" -#: ../../library/curses.rst:288 +#: ../../library/curses.rst:290 msgid "" "Change the definition of a color-pair. It takes three arguments: the number " "of the color-pair to be changed, the foreground color number, and the " @@ -355,31 +367,31 @@ msgid "" "definition." msgstr "" -#: ../../library/curses.rst:301 +#: ../../library/curses.rst:303 msgid "" "Initialize the library. Return a :ref:`window ` " "object which represents the whole screen." msgstr "" -#: ../../library/curses.rst:306 +#: ../../library/curses.rst:308 msgid "" "If there is an error opening the terminal, the underlying curses library may " "cause the interpreter to exit." msgstr "" -#: ../../library/curses.rst:312 +#: ../../library/curses.rst:314 msgid "" "Return ``True`` if :func:`resize_term` would modify the window structure, " "``False`` otherwise." msgstr "" -#: ../../library/curses.rst:318 +#: ../../library/curses.rst:320 msgid "" "Return ``True`` if :func:`endwin` has been called (that is, the curses " "library has been deinitialized)." msgstr "" -#: ../../library/curses.rst:324 +#: ../../library/curses.rst:326 msgid "" "Return the name of the key numbered *k* as a bytes object. The name of a " "key generating printable ASCII character is the key's character. The name " @@ -390,27 +402,27 @@ msgid "" "character." msgstr "" -#: ../../library/curses.rst:334 +#: ../../library/curses.rst:336 msgid "" "Return the user's current line kill character as a one-byte bytes object. " "Under Unix operating systems this is a property of the controlling tty of " "the curses program, and is not set by the curses library itself." msgstr "" -#: ../../library/curses.rst:341 +#: ../../library/curses.rst:343 msgid "" "Return a bytes object containing the terminfo long name field describing the " "current terminal. The maximum length of a verbose description is 128 " "characters. It is defined only after the call to :func:`initscr`." msgstr "" -#: ../../library/curses.rst:348 +#: ../../library/curses.rst:350 msgid "" "If *flag* is ``True``, allow 8-bit characters to be input. If *flag* is " "``False``, allow only 7-bit chars." msgstr "" -#: ../../library/curses.rst:354 +#: ../../library/curses.rst:356 msgid "" "Set the maximum time in milliseconds that can elapse between press and " "release events in order for them to be recognized as a click, and return the " @@ -418,7 +430,7 @@ msgid "" "fifth of a second." msgstr "" -#: ../../library/curses.rst:361 +#: ../../library/curses.rst:363 msgid "" "Set the mouse events to be reported, and return a tuple ``(availmask, " "oldmask)``. *availmask* indicates which of the specified mouse events can " @@ -427,17 +439,17 @@ msgid "" "never called, no mouse events are ever reported." msgstr "" -#: ../../library/curses.rst:370 +#: ../../library/curses.rst:372 msgid "Sleep for *ms* milliseconds." msgstr "" -#: ../../library/curses.rst:375 +#: ../../library/curses.rst:377 msgid "" "Create and return a pointer to a new pad data structure with the given " "number of lines and columns. Return a pad as a window object." msgstr "" -#: ../../library/curses.rst:378 +#: ../../library/curses.rst:380 msgid "" "A pad is like a window, except that it is not restricted by the screen size, " "and is not necessarily associated with a particular part of the screen. " @@ -453,35 +465,35 @@ msgid "" "to be displayed." msgstr "" -#: ../../library/curses.rst:394 +#: ../../library/curses.rst:396 msgid "" "Return a new :ref:`window `, whose left-upper corner " "is at ``(begin_y, begin_x)``, and whose height/width is *nlines*/*ncols*." msgstr "" -#: ../../library/curses.rst:397 +#: ../../library/curses.rst:399 msgid "" "By default, the window will extend from the specified position to the lower " "right corner of the screen." msgstr "" -#: ../../library/curses.rst:403 +#: ../../library/curses.rst:405 msgid "" "Enter newline mode. This mode translates the return key into newline on " "input, and translates newline into return and line-feed on output. Newline " "mode is initially on." msgstr "" -#: ../../library/curses.rst:410 +#: ../../library/curses.rst:412 msgid "" "Leave cbreak mode. Return to normal \"cooked\" mode with line buffering." msgstr "" -#: ../../library/curses.rst:415 +#: ../../library/curses.rst:417 msgid "Leave echo mode. Echoing of input characters is turned off." msgstr "" -#: ../../library/curses.rst:420 +#: ../../library/curses.rst:422 msgid "" "Leave newline mode. Disable translation of return into newline on input, " "and disable low-level translation of newline into newline/return on output " @@ -491,7 +503,7 @@ msgid "" "also, it will be able to detect the return key on input." msgstr "" -#: ../../library/curses.rst:430 +#: ../../library/curses.rst:432 msgid "" "When the :func:`!noqiflush` routine is used, normal flush of input and " "output queues associated with the ``INTR``, ``QUIT`` and ``SUSP`` characters " @@ -500,63 +512,63 @@ msgid "" "occurred, after the handler exits." msgstr "" -#: ../../library/curses.rst:438 +#: ../../library/curses.rst:440 msgid "Leave raw mode. Return to normal \"cooked\" mode with line buffering." msgstr "" -#: ../../library/curses.rst:443 +#: ../../library/curses.rst:445 msgid "" "Return a tuple ``(fg, bg)`` containing the colors for the requested color " "pair. The value of *pair_number* must be between ``0`` and ``COLOR_PAIRS - " "1``." msgstr "" -#: ../../library/curses.rst:449 +#: ../../library/curses.rst:451 msgid "" "Return the number of the color-pair set by the attribute value *attr*. :func:" "`color_pair` is the counterpart to this function." msgstr "" -#: ../../library/curses.rst:455 +#: ../../library/curses.rst:457 msgid "" "Equivalent to ``tputs(str, 1, putchar)``; emit the value of a specified " "terminfo capability for the current terminal. Note that the output of :func:" "`putp` always goes to standard output." msgstr "" -#: ../../library/curses.rst:462 +#: ../../library/curses.rst:464 msgid "" "If *flag* is ``False``, the effect is the same as calling :func:`noqiflush`. " "If *flag* is ``True``, or no argument is provided, the queues will be " "flushed when these control characters are read." msgstr "" -#: ../../library/curses.rst:469 +#: ../../library/curses.rst:471 msgid "" "Enter raw mode. In raw mode, normal line buffering and processing of " "interrupt, quit, suspend, and flow control keys are turned off; characters " "are presented to curses input functions one by one." msgstr "" -#: ../../library/curses.rst:476 +#: ../../library/curses.rst:478 msgid "" "Restore the terminal to \"program\" mode, as previously saved by :func:" "`def_prog_mode`." msgstr "" -#: ../../library/curses.rst:482 +#: ../../library/curses.rst:484 msgid "" "Restore the terminal to \"shell\" mode, as previously saved by :func:" "`def_shell_mode`." msgstr "" -#: ../../library/curses.rst:488 +#: ../../library/curses.rst:490 msgid "" "Restore the state of the terminal modes to what it was at the last call to :" "func:`savetty`." msgstr "" -#: ../../library/curses.rst:494 +#: ../../library/curses.rst:496 msgid "" "Backend function used by :func:`resizeterm`, performing most of the work; " "when resizing the windows, :func:`resize_term` blank-fills the areas that " @@ -566,47 +578,47 @@ msgid "" "to resize these without additional interaction with the application." msgstr "" -#: ../../library/curses.rst:504 +#: ../../library/curses.rst:506 msgid "" "Resize the standard and current windows to the specified dimensions, and " "adjusts other bookkeeping data used by the curses library that record the " "window dimensions (in particular the SIGWINCH handler)." msgstr "" -#: ../../library/curses.rst:511 +#: ../../library/curses.rst:513 msgid "" "Save the current state of the terminal modes in a buffer, usable by :func:" "`resetty`." msgstr "" -#: ../../library/curses.rst:516 +#: ../../library/curses.rst:518 msgid "Retrieves the value set by :func:`set_escdelay`." msgstr "" -#: ../../library/curses.rst:522 +#: ../../library/curses.rst:524 msgid "" "Sets the number of milliseconds to wait after reading an escape character, " "to distinguish between an individual escape character entered on the " "keyboard from escape sequences sent by cursor and function keys." msgstr "" -#: ../../library/curses.rst:530 +#: ../../library/curses.rst:532 msgid "Retrieves the value set by :func:`set_tabsize`." msgstr "" -#: ../../library/curses.rst:536 +#: ../../library/curses.rst:538 msgid "" "Sets the number of columns used by the curses library when converting a tab " "character to spaces as it adds the tab to a window." msgstr "" -#: ../../library/curses.rst:543 +#: ../../library/curses.rst:545 msgid "" "Set the virtual screen cursor to *y*, *x*. If *y* and *x* are both ``-1``, " "then :meth:`leaveok ` is set ``True``." msgstr "" -#: ../../library/curses.rst:549 +#: ../../library/curses.rst:551 msgid "" "Initialize the terminal. *term* is a string giving the terminal name, or " "``None``; if omitted or ``None``, the value of the :envvar:`TERM` " @@ -615,14 +627,14 @@ msgid "" "descriptor for ``sys.stdout`` will be used." msgstr "" -#: ../../library/curses.rst:558 +#: ../../library/curses.rst:560 msgid "" "Must be called if the programmer wants to use colors, and before any other " "color manipulation routine is called. It is good practice to call this " "routine right after :func:`initscr`." msgstr "" -#: ../../library/curses.rst:562 +#: ../../library/curses.rst:564 msgid "" ":func:`start_color` initializes eight basic colors (black, red, green, " "yellow, blue, magenta, cyan, and white), and two global variables in the :" @@ -632,20 +644,20 @@ msgid "" "terminal was just turned on." msgstr "" -#: ../../library/curses.rst:571 +#: ../../library/curses.rst:573 msgid "" "Return a logical OR of all video attributes supported by the terminal. This " "information is useful when a curses program needs complete control over the " "appearance of the screen." msgstr "" -#: ../../library/curses.rst:578 +#: ../../library/curses.rst:580 msgid "" "Return the value of the environment variable :envvar:`TERM`, as a bytes " "object, truncated to 14 characters." msgstr "" -#: ../../library/curses.rst:584 +#: ../../library/curses.rst:586 msgid "" "Return the value of the Boolean capability corresponding to the terminfo " "capability name *capname* as an integer. Return the value ``-1`` if " @@ -653,7 +665,7 @@ msgid "" "from the terminal description." msgstr "" -#: ../../library/curses.rst:592 +#: ../../library/curses.rst:594 msgid "" "Return the value of the numeric capability corresponding to the terminfo " "capability name *capname* as an integer. Return the value ``-2`` if " @@ -661,7 +673,7 @@ msgid "" "from the terminal description." msgstr "" -#: ../../library/curses.rst:600 +#: ../../library/curses.rst:602 msgid "" "Return the value of the string capability corresponding to the terminfo " "capability name *capname* as a bytes object. Return ``None`` if *capname* " @@ -669,7 +681,7 @@ msgid "" "terminal description." msgstr "" -#: ../../library/curses.rst:608 +#: ../../library/curses.rst:610 msgid "" "Instantiate the bytes object *str* with the supplied parameters, where *str* " "should be a parameterized string obtained from the terminfo database. E.g. " @@ -677,13 +689,13 @@ msgid "" "exact result depending on terminal type." msgstr "" -#: ../../library/curses.rst:616 +#: ../../library/curses.rst:618 msgid "" "Specify that the file descriptor *fd* be used for typeahead checking. If " "*fd* is ``-1``, then no typeahead checking is done." msgstr "" -#: ../../library/curses.rst:619 +#: ../../library/curses.rst:621 msgid "" "The curses library does \"line-breakout optimization\" by looking for " "typeahead periodically while updating the screen. If input is found, and it " @@ -693,7 +705,7 @@ msgid "" "typeahead checking." msgstr "" -#: ../../library/curses.rst:628 +#: ../../library/curses.rst:630 msgid "" "Return a bytes object which is a printable representation of the character " "*ch*. Control characters are represented as a caret followed by the " @@ -701,35 +713,35 @@ msgid "" "are." msgstr "" -#: ../../library/curses.rst:635 +#: ../../library/curses.rst:637 msgid "Push *ch* so the next :meth:`~window.getch` will return it." msgstr "" -#: ../../library/curses.rst:639 +#: ../../library/curses.rst:641 msgid "Only one *ch* can be pushed before :meth:`!getch` is called." msgstr "" -#: ../../library/curses.rst:644 +#: ../../library/curses.rst:646 msgid "" "Update the :const:`LINES` and :const:`COLS` module variables. Useful for " "detecting manual screen resize." msgstr "" -#: ../../library/curses.rst:652 +#: ../../library/curses.rst:654 msgid "Push *ch* so the next :meth:`~window.get_wch` will return it." msgstr "" -#: ../../library/curses.rst:656 +#: ../../library/curses.rst:658 msgid "Only one *ch* can be pushed before :meth:`!get_wch` is called." msgstr "" -#: ../../library/curses.rst:663 +#: ../../library/curses.rst:665 msgid "" "Push a :const:`KEY_MOUSE` event onto the input queue, associating the given " "state data with it." msgstr "" -#: ../../library/curses.rst:669 +#: ../../library/curses.rst:671 msgid "" "If used, this function should be called before :func:`initscr` or newterm " "are called. When *flag* is ``False``, the values of lines and columns " @@ -739,7 +751,7 @@ msgid "" "to use the window size if :envvar:`LINES` and :envvar:`COLUMNS` are not set)." msgstr "" -#: ../../library/curses.rst:679 +#: ../../library/curses.rst:681 msgid "" "Allow use of default values for colors on terminals supporting this feature. " "Use this to support transparency in your application. The default color is " @@ -748,7 +760,7 @@ msgid "" "*x* to a red foreground color on the default background." msgstr "" -#: ../../library/curses.rst:688 +#: ../../library/curses.rst:690 msgid "" "Initialize curses and call another callable object, *func*, which should be " "the rest of your curses-using application. If the application raises an " @@ -762,50 +774,50 @@ msgid "" "echo, and disables the terminal keypad." msgstr "" -#: ../../library/curses.rst:702 +#: ../../library/curses.rst:704 msgid "Window Objects" msgstr "" -#: ../../library/curses.rst:704 +#: ../../library/curses.rst:706 msgid "" "Window objects, as returned by :func:`initscr` and :func:`newwin` above, " "have the following methods and attributes:" msgstr "" -#: ../../library/curses.rst:711 +#: ../../library/curses.rst:713 msgid "" "Paint character *ch* at ``(y, x)`` with attributes *attr*, overwriting any " "character previously painted at that location. By default, the character " "position and attributes are the current settings for the window object." msgstr "" -#: ../../library/curses.rst:717 +#: ../../library/curses.rst:719 msgid "" "Writing outside the window, subwindow, or pad raises a :exc:`curses.error`. " "Attempting to write to the lower right corner of a window, subwindow, or pad " "will cause an exception to be raised after the character is printed." msgstr "" -#: ../../library/curses.rst:725 +#: ../../library/curses.rst:727 msgid "" "Paint at most *n* characters of the character string *str* at ``(y, x)`` " "with attributes *attr*, overwriting anything previously on the display." msgstr "" -#: ../../library/curses.rst:733 +#: ../../library/curses.rst:735 msgid "" "Paint the character string *str* at ``(y, x)`` with attributes *attr*, " "overwriting anything previously on the display." msgstr "" -#: ../../library/curses.rst:738 +#: ../../library/curses.rst:740 msgid "" "Writing outside the window, subwindow, or pad raises :exc:`curses.error`. " "Attempting to write to the lower right corner of a window, subwindow, or pad " "will cause an exception to be raised after the string is printed." msgstr "" -#: ../../library/curses.rst:742 +#: ../../library/curses.rst:744 msgid "" "A `bug in ncurses `_, the backend for " "this Python module, can cause SegFaults when resizing windows. This is fixed " @@ -815,44 +827,44 @@ msgid "" "line." msgstr "" -#: ../../library/curses.rst:752 +#: ../../library/curses.rst:754 msgid "" "Remove attribute *attr* from the \"background\" set applied to all writes to " "the current window." msgstr "" -#: ../../library/curses.rst:758 +#: ../../library/curses.rst:760 msgid "" "Add attribute *attr* from the \"background\" set applied to all writes to " "the current window." msgstr "" -#: ../../library/curses.rst:764 +#: ../../library/curses.rst:766 msgid "" "Set the \"background\" set of attributes to *attr*. This set is initially " "``0`` (no attributes)." msgstr "" -#: ../../library/curses.rst:770 +#: ../../library/curses.rst:772 msgid "" "Set the background property of the window to the character *ch*, with " "attributes *attr*. The change is then applied to every character position " "in that window:" msgstr "" -#: ../../library/curses.rst:774 +#: ../../library/curses.rst:776 msgid "" "The attribute of every character in the window is changed to the new " "background attribute." msgstr "" -#: ../../library/curses.rst:777 +#: ../../library/curses.rst:779 msgid "" "Wherever the former background character appears, it is changed to the new " "background character." msgstr "" -#: ../../library/curses.rst:783 +#: ../../library/curses.rst:785 msgid "" "Set the window's background. A window's background consists of a character " "and any combination of attributes. The attribute part of the background is " @@ -863,128 +875,128 @@ msgid "" "delete line/character operations." msgstr "" -#: ../../library/curses.rst:793 +#: ../../library/curses.rst:795 msgid "" "Draw a border around the edges of the window. Each parameter specifies the " "character to use for a specific part of the border; see the table below for " "more details." msgstr "" -#: ../../library/curses.rst:799 +#: ../../library/curses.rst:801 msgid "" "A ``0`` value for any parameter will cause the default character to be used " "for that parameter. Keyword parameters can *not* be used. The defaults are " "listed in this table:" msgstr "" -#: ../../library/curses.rst:804 +#: ../../library/curses.rst:806 msgid "Parameter" msgstr "參數" -#: ../../library/curses.rst:804 +#: ../../library/curses.rst:806 msgid "Description" msgstr "描述" -#: ../../library/curses.rst:804 +#: ../../library/curses.rst:806 msgid "Default value" msgstr "" -#: ../../library/curses.rst:806 +#: ../../library/curses.rst:808 msgid "*ls*" msgstr "*ls*" -#: ../../library/curses.rst:806 +#: ../../library/curses.rst:808 msgid "Left side" msgstr "" -#: ../../library/curses.rst:806 ../../library/curses.rst:808 +#: ../../library/curses.rst:808 ../../library/curses.rst:810 msgid ":const:`ACS_VLINE`" msgstr ":const:`ACS_VLINE`" -#: ../../library/curses.rst:808 +#: ../../library/curses.rst:810 msgid "*rs*" msgstr "*rs*" -#: ../../library/curses.rst:808 +#: ../../library/curses.rst:810 msgid "Right side" msgstr "" -#: ../../library/curses.rst:810 +#: ../../library/curses.rst:812 msgid "*ts*" msgstr "*ts*" -#: ../../library/curses.rst:810 +#: ../../library/curses.rst:812 msgid "Top" msgstr "" -#: ../../library/curses.rst:810 ../../library/curses.rst:812 +#: ../../library/curses.rst:812 ../../library/curses.rst:814 msgid ":const:`ACS_HLINE`" msgstr ":const:`ACS_HLINE`" -#: ../../library/curses.rst:812 +#: ../../library/curses.rst:814 msgid "*bs*" msgstr "*bs*" -#: ../../library/curses.rst:812 +#: ../../library/curses.rst:814 msgid "Bottom" msgstr "" -#: ../../library/curses.rst:814 +#: ../../library/curses.rst:816 msgid "*tl*" msgstr "*tl*" -#: ../../library/curses.rst:814 +#: ../../library/curses.rst:816 msgid "Upper-left corner" msgstr "" -#: ../../library/curses.rst:814 +#: ../../library/curses.rst:816 msgid ":const:`ACS_ULCORNER`" msgstr ":const:`ACS_ULCORNER`" -#: ../../library/curses.rst:816 +#: ../../library/curses.rst:818 msgid "*tr*" msgstr "*tr*" -#: ../../library/curses.rst:816 +#: ../../library/curses.rst:818 msgid "Upper-right corner" msgstr "" -#: ../../library/curses.rst:816 +#: ../../library/curses.rst:818 msgid ":const:`ACS_URCORNER`" msgstr ":const:`ACS_URCORNER`" -#: ../../library/curses.rst:818 +#: ../../library/curses.rst:820 msgid "*bl*" msgstr "*bl*" -#: ../../library/curses.rst:818 +#: ../../library/curses.rst:820 msgid "Bottom-left corner" msgstr "" -#: ../../library/curses.rst:818 +#: ../../library/curses.rst:820 msgid ":const:`ACS_LLCORNER`" msgstr ":const:`ACS_LLCORNER`" -#: ../../library/curses.rst:820 +#: ../../library/curses.rst:822 msgid "*br*" msgstr "*br*" -#: ../../library/curses.rst:820 +#: ../../library/curses.rst:822 msgid "Bottom-right corner" msgstr "" -#: ../../library/curses.rst:820 +#: ../../library/curses.rst:822 msgid ":const:`ACS_LRCORNER`" msgstr ":const:`ACS_LRCORNER`" -#: ../../library/curses.rst:826 +#: ../../library/curses.rst:828 msgid "" "Similar to :meth:`border`, but both *ls* and *rs* are *vertch* and both *ts* " "and *bs* are *horch*. The default corner characters are always used by this " "function." msgstr "" -#: ../../library/curses.rst:835 +#: ../../library/curses.rst:837 msgid "" "Set the attributes of *num* characters at the current cursor position, or at " "position ``(y, x)`` if supplied. If *num* is not given or is ``-1``, the " @@ -994,45 +1006,45 @@ msgid "" "be redisplayed by the next window refresh." msgstr "" -#: ../../library/curses.rst:845 +#: ../../library/curses.rst:847 msgid "" "Like :meth:`erase`, but also cause the whole window to be repainted upon " "next call to :meth:`refresh`." msgstr "" -#: ../../library/curses.rst:851 +#: ../../library/curses.rst:853 msgid "" "If *flag* is ``True``, the next call to :meth:`refresh` will clear the " "window completely." msgstr "" -#: ../../library/curses.rst:857 +#: ../../library/curses.rst:859 msgid "" "Erase from cursor to the end of the window: all lines below the cursor are " "deleted, and then the equivalent of :meth:`clrtoeol` is performed." msgstr "" -#: ../../library/curses.rst:863 +#: ../../library/curses.rst:865 msgid "Erase from cursor to the end of the line." msgstr "" -#: ../../library/curses.rst:868 +#: ../../library/curses.rst:870 msgid "" "Update the current cursor position of all the ancestors of the window to " "reflect the current cursor position of the window." msgstr "" -#: ../../library/curses.rst:874 +#: ../../library/curses.rst:876 msgid "Delete any character at ``(y, x)``." msgstr "" -#: ../../library/curses.rst:879 +#: ../../library/curses.rst:881 msgid "" "Delete the line under the cursor. All following lines are moved up by one " "line." msgstr "" -#: ../../library/curses.rst:885 +#: ../../library/curses.rst:887 msgid "" "An abbreviation for \"derive window\", :meth:`derwin` is the same as " "calling :meth:`subwin`, except that *begin_y* and *begin_x* are relative to " @@ -1040,13 +1052,13 @@ msgid "" "a window object for the derived window." msgstr "" -#: ../../library/curses.rst:893 +#: ../../library/curses.rst:895 msgid "" "Add character *ch* with attribute *attr*, and immediately call :meth:" "`refresh` on the window." msgstr "" -#: ../../library/curses.rst:899 +#: ../../library/curses.rst:901 msgid "" "Test whether the given pair of screen-relative character-cell coordinates " "are enclosed by the given window, returning ``True`` or ``False``. It is " @@ -1054,11 +1066,11 @@ msgid "" "location of a mouse event." msgstr "" -#: ../../library/curses.rst:904 +#: ../../library/curses.rst:906 msgid "Previously it returned ``1`` or ``0`` instead of ``True`` or ``False``." msgstr "" -#: ../../library/curses.rst:910 +#: ../../library/curses.rst:912 msgid "" "Encoding used to encode method arguments (Unicode strings and characters). " "The encoding attribute is inherited from the parent window when a subwindow " @@ -1066,19 +1078,19 @@ msgid "" "locale encoding is used (see :func:`locale.getencoding`)." msgstr "" -#: ../../library/curses.rst:920 +#: ../../library/curses.rst:922 msgid "Clear the window." msgstr "" -#: ../../library/curses.rst:925 +#: ../../library/curses.rst:927 msgid "Return a tuple ``(y, x)`` of coordinates of upper-left corner." msgstr "" -#: ../../library/curses.rst:930 +#: ../../library/curses.rst:932 msgid "Return the given window's current background character/attribute pair." msgstr "" -#: ../../library/curses.rst:935 +#: ../../library/curses.rst:937 msgid "" "Get a character. Note that the integer returned does *not* have to be in " "ASCII range: function keys, keypad keys and so on are represented by numbers " @@ -1086,14 +1098,14 @@ msgid "" "otherwise wait until a key is pressed." msgstr "" -#: ../../library/curses.rst:943 +#: ../../library/curses.rst:945 msgid "" "Get a wide character. Return a character for most keys, or an integer for " "function keys, keypad keys, and other special keys. In no-delay mode, raise " "an exception if there is no input." msgstr "" -#: ../../library/curses.rst:952 +#: ../../library/curses.rst:954 msgid "" "Get a character, returning a string instead of an integer, as :meth:`getch` " "does. Function keys, keypad keys and other special keys return a multibyte " @@ -1101,35 +1113,35 @@ msgid "" "there is no input." msgstr "" -#: ../../library/curses.rst:960 +#: ../../library/curses.rst:962 msgid "Return a tuple ``(y, x)`` of the height and width of the window." msgstr "" -#: ../../library/curses.rst:965 +#: ../../library/curses.rst:967 msgid "" "Return the beginning coordinates of this window relative to its parent " "window as a tuple ``(y, x)``. Return ``(-1, -1)`` if this window has no " "parent." msgstr "" -#: ../../library/curses.rst:975 +#: ../../library/curses.rst:977 msgid "" "Read a bytes object from the user, with primitive line editing capacity." msgstr "" -#: ../../library/curses.rst:980 +#: ../../library/curses.rst:982 msgid "" "Return a tuple ``(y, x)`` of current cursor position relative to the " "window's upper-left corner." msgstr "" -#: ../../library/curses.rst:987 +#: ../../library/curses.rst:989 msgid "" "Display a horizontal line starting at ``(y, x)`` with length *n* consisting " "of the character *ch*." msgstr "" -#: ../../library/curses.rst:993 +#: ../../library/curses.rst:995 msgid "" "If *flag* is ``False``, curses no longer considers using the hardware insert/" "delete character feature of the terminal; if *flag* is ``True``, use of " @@ -1137,13 +1149,13 @@ msgid "" "initialized, use of character insert/delete is enabled by default." msgstr "" -#: ../../library/curses.rst:1001 +#: ../../library/curses.rst:1003 msgid "" "If *flag* is ``True``, :mod:`curses` will try and use hardware line editing " "facilities. Otherwise, line insertion/deletion are disabled." msgstr "" -#: ../../library/curses.rst:1007 +#: ../../library/curses.rst:1009 msgid "" "If *flag* is ``True``, any change in the window image automatically causes " "the window to be refreshed; you no longer have to call :meth:`refresh` " @@ -1151,19 +1163,19 @@ msgid "" "calls to wrefresh. This option is disabled by default." msgstr "" -#: ../../library/curses.rst:1015 +#: ../../library/curses.rst:1017 msgid "" "Return the character at the given position in the window. The bottom 8 bits " "are the character proper, and upper bits are the attributes." msgstr "" -#: ../../library/curses.rst:1022 +#: ../../library/curses.rst:1024 msgid "" "Paint character *ch* at ``(y, x)`` with attributes *attr*, moving the line " "from position *x* right by one character." msgstr "" -#: ../../library/curses.rst:1028 +#: ../../library/curses.rst:1030 msgid "" "Insert *nlines* lines into the specified window above the current line. The " "*nlines* bottom lines are lost. For negative *nlines*, delete *nlines* " @@ -1172,13 +1184,13 @@ msgid "" "remains the same." msgstr "" -#: ../../library/curses.rst:1037 +#: ../../library/curses.rst:1039 msgid "" "Insert a blank line under the cursor. All following lines are moved down by " "one line." msgstr "" -#: ../../library/curses.rst:1044 +#: ../../library/curses.rst:1046 msgid "" "Insert a character string (as many characters as will fit on the line) " "before the character under the cursor, up to *n* characters. If *n* is " @@ -1188,7 +1200,7 @@ msgid "" "if specified)." msgstr "" -#: ../../library/curses.rst:1054 +#: ../../library/curses.rst:1056 msgid "" "Insert a character string (as many characters as will fit on the line) " "before the character under the cursor. All characters to the right of the " @@ -1197,7 +1209,7 @@ msgid "" "specified)." msgstr "" -#: ../../library/curses.rst:1063 +#: ../../library/curses.rst:1065 msgid "" "Return a bytes object of characters, extracted from the window starting at " "the current cursor position, or at *y*, *x* if specified. Attributes are " @@ -1205,76 +1217,76 @@ msgid "" "string at most *n* characters long (exclusive of the trailing NUL)." msgstr "" -#: ../../library/curses.rst:1071 +#: ../../library/curses.rst:1073 msgid "" "Return ``True`` if the specified line was modified since the last call to :" "meth:`refresh`; otherwise return ``False``. Raise a :exc:`curses.error` " "exception if *line* is not valid for the given window." msgstr "" -#: ../../library/curses.rst:1078 +#: ../../library/curses.rst:1080 msgid "" "Return ``True`` if the specified window was modified since the last call to :" "meth:`refresh`; otherwise return ``False``." msgstr "" -#: ../../library/curses.rst:1084 +#: ../../library/curses.rst:1086 msgid "" "If *flag* is ``True``, escape sequences generated by some keys (keypad, " "function keys) will be interpreted by :mod:`curses`. If *flag* is ``False``, " "escape sequences will be left as is in the input stream." msgstr "" -#: ../../library/curses.rst:1091 +#: ../../library/curses.rst:1093 msgid "" "If *flag* is ``True``, cursor is left where it is on update, instead of " "being at \"cursor position.\" This reduces cursor movement where possible. " "If possible the cursor will be made invisible." msgstr "" -#: ../../library/curses.rst:1095 +#: ../../library/curses.rst:1097 msgid "" "If *flag* is ``False``, cursor will always be at \"cursor position\" after " "an update." msgstr "" -#: ../../library/curses.rst:1100 +#: ../../library/curses.rst:1102 msgid "Move cursor to ``(new_y, new_x)``." msgstr "" -#: ../../library/curses.rst:1105 +#: ../../library/curses.rst:1107 msgid "" "Move the window inside its parent window. The screen-relative parameters of " "the window are not changed. This routine is used to display different parts " "of the parent window at the same physical position on the screen." msgstr "" -#: ../../library/curses.rst:1112 +#: ../../library/curses.rst:1114 msgid "Move the window so its upper-left corner is at ``(new_y, new_x)``." msgstr "" -#: ../../library/curses.rst:1117 +#: ../../library/curses.rst:1119 msgid "If *flag* is ``True``, :meth:`getch` will be non-blocking." msgstr "" -#: ../../library/curses.rst:1122 +#: ../../library/curses.rst:1124 msgid "If *flag* is ``True``, escape sequences will not be timed out." msgstr "" -#: ../../library/curses.rst:1124 +#: ../../library/curses.rst:1126 msgid "" "If *flag* is ``False``, after a few milliseconds, an escape sequence will " "not be interpreted, and will be left in the input stream as is." msgstr "" -#: ../../library/curses.rst:1130 +#: ../../library/curses.rst:1132 msgid "" "Mark for refresh but wait. This function updates the data structure " "representing the desired state of the window, but does not force an update " "of the physical screen. To accomplish that, call :func:`doupdate`." msgstr "" -#: ../../library/curses.rst:1137 +#: ../../library/curses.rst:1139 msgid "" "Overlay the window on top of *destwin*. The windows need not be the same " "size, only the overlapping region is copied. This copy is non-destructive, " @@ -1282,7 +1294,7 @@ msgid "" "contents of *destwin*." msgstr "" -#: ../../library/curses.rst:1142 +#: ../../library/curses.rst:1144 msgid "" "To get fine-grained control over the copied region, the second form of :meth:" "`overlay` can be used. *sminrow* and *smincol* are the upper-left " @@ -1290,7 +1302,7 @@ msgid "" "in the destination window." msgstr "" -#: ../../library/curses.rst:1150 +#: ../../library/curses.rst:1152 msgid "" "Overwrite the window on top of *destwin*. The windows need not be the same " "size, in which case only the overlapping region is copied. This copy is " @@ -1298,7 +1310,7 @@ msgid "" "the old contents of *destwin*." msgstr "" -#: ../../library/curses.rst:1155 +#: ../../library/curses.rst:1157 msgid "" "To get fine-grained control over the copied region, the second form of :meth:" "`overwrite` can be used. *sminrow* and *smincol* are the upper-left " @@ -1306,31 +1318,31 @@ msgid "" "the destination window." msgstr "" -#: ../../library/curses.rst:1163 +#: ../../library/curses.rst:1165 msgid "" "Write all data associated with the window into the provided file object. " "This information can be later retrieved using the :func:`getwin` function." msgstr "" -#: ../../library/curses.rst:1169 +#: ../../library/curses.rst:1171 msgid "" "Indicate that the *num* screen lines, starting at line *beg*, are corrupted " "and should be completely redrawn on the next :meth:`refresh` call." msgstr "" -#: ../../library/curses.rst:1175 +#: ../../library/curses.rst:1177 msgid "" "Touch the entire window, causing it to be completely redrawn on the next :" "meth:`refresh` call." msgstr "" -#: ../../library/curses.rst:1181 +#: ../../library/curses.rst:1183 msgid "" "Update the display immediately (sync actual screen with previous drawing/" "deleting methods)." msgstr "" -#: ../../library/curses.rst:1184 +#: ../../library/curses.rst:1186 msgid "" "The 6 optional arguments can only be specified when the window is a pad " "created with :func:`newpad`. The additional parameters are needed to " @@ -1345,7 +1357,7 @@ msgid "" "*smincol* are treated as if they were zero." msgstr "" -#: ../../library/curses.rst:1198 +#: ../../library/curses.rst:1200 msgid "" "Reallocate storage for a curses window to adjust its dimensions to the " "specified values. If either dimension is larger than the current values, " @@ -1353,11 +1365,11 @@ msgid "" "rendition (as set by :meth:`bkgdset`) merged into them." msgstr "" -#: ../../library/curses.rst:1206 +#: ../../library/curses.rst:1208 msgid "Scroll the screen or scrolling region upward by *lines* lines." msgstr "" -#: ../../library/curses.rst:1211 +#: ../../library/curses.rst:1213 msgid "" "Control what happens when the cursor of a window is moved off the edge of " "the window or scrolling region, either as a result of a newline action on " @@ -1367,54 +1379,54 @@ msgid "" "scrolling effect on the terminal, it is also necessary to call :meth:`idlok`." msgstr "" -#: ../../library/curses.rst:1221 +#: ../../library/curses.rst:1223 msgid "" "Set the scrolling region from line *top* to line *bottom*. All scrolling " "actions will take place in this region." msgstr "" -#: ../../library/curses.rst:1227 +#: ../../library/curses.rst:1229 msgid "" "Turn off the standout attribute. On some terminals this has the side effect " "of turning off all attributes." msgstr "" -#: ../../library/curses.rst:1233 +#: ../../library/curses.rst:1235 msgid "Turn on attribute *A_STANDOUT*." msgstr "" -#: ../../library/curses.rst:1239 ../../library/curses.rst:1246 +#: ../../library/curses.rst:1241 ../../library/curses.rst:1248 msgid "" "Return a sub-window, whose upper-left corner is at ``(begin_y, begin_x)``, " "and whose width/height is *ncols*/*nlines*." msgstr "" -#: ../../library/curses.rst:1249 +#: ../../library/curses.rst:1251 msgid "" "By default, the sub-window will extend from the specified position to the " "lower right corner of the window." msgstr "" -#: ../../library/curses.rst:1255 +#: ../../library/curses.rst:1257 msgid "" "Touch each location in the window that has been touched in any of its " "ancestor windows. This routine is called by :meth:`refresh`, so it should " "almost never be necessary to call it manually." msgstr "" -#: ../../library/curses.rst:1262 +#: ../../library/curses.rst:1264 msgid "" "If *flag* is ``True``, then :meth:`syncup` is called automatically whenever " "there is a change in the window." msgstr "" -#: ../../library/curses.rst:1268 +#: ../../library/curses.rst:1270 msgid "" "Touch all locations in ancestors of the window that have been changed in " "the window." msgstr "" -#: ../../library/curses.rst:1274 +#: ../../library/curses.rst:1276 msgid "" "Set blocking or non-blocking read behavior for the window. If *delay* is " "negative, blocking read is used (which will wait indefinitely for input). " @@ -1424,7 +1436,7 @@ msgid "" "still no input at the end of that time." msgstr "" -#: ../../library/curses.rst:1284 +#: ../../library/curses.rst:1286 msgid "" "Pretend *count* lines have been changed, starting with line *start*. If " "*changed* is supplied, it specifies whether the affected lines are marked as " @@ -1432,49 +1444,49 @@ msgid "" "``=False``)." msgstr "" -#: ../../library/curses.rst:1291 +#: ../../library/curses.rst:1293 msgid "" "Pretend the whole window has been changed, for purposes of drawing " "optimizations." msgstr "" -#: ../../library/curses.rst:1297 +#: ../../library/curses.rst:1299 msgid "" "Mark all lines in the window as unchanged since the last call to :meth:" "`refresh`." msgstr "" -#: ../../library/curses.rst:1304 +#: ../../library/curses.rst:1306 msgid "" "Display a vertical line starting at ``(y, x)`` with length *n* consisting of " "the character *ch* with attributes *attr*." msgstr "" -#: ../../library/curses.rst:1309 +#: ../../library/curses.rst:1311 msgid "Constants" msgstr "" -#: ../../library/curses.rst:1311 +#: ../../library/curses.rst:1313 msgid "The :mod:`curses` module defines the following data members:" msgstr "" -#: ../../library/curses.rst:1316 +#: ../../library/curses.rst:1318 msgid "" "Some curses routines that return an integer, such as :meth:`~window." "getch`, return :const:`ERR` upon failure." msgstr "" -#: ../../library/curses.rst:1322 +#: ../../library/curses.rst:1324 msgid "" "Some curses routines that return an integer, such as :func:`napms`, " "return :const:`OK` upon success." msgstr "" -#: ../../library/curses.rst:1329 +#: ../../library/curses.rst:1331 msgid "A bytes object representing the current version of the module." msgstr "" -#: ../../library/curses.rst:1334 +#: ../../library/curses.rst:1336 msgid "" "A named tuple containing the three components of the ncurses library " "version: *major*, *minor*, and *patch*. All values are integers. The " @@ -1482,536 +1494,536 @@ msgid "" "is equivalent to ``curses.ncurses_version.major`` and so on." msgstr "" -#: ../../library/curses.rst:1339 +#: ../../library/curses.rst:1341 msgid "Availability: if the ncurses library is used." msgstr "" -#: ../../library/curses.rst:1345 +#: ../../library/curses.rst:1347 msgid "" "The maximum number of colors the terminal can support. It is defined only " "after the call to :func:`start_color`." msgstr "" -#: ../../library/curses.rst:1350 +#: ../../library/curses.rst:1352 msgid "" "The maximum number of color pairs the terminal can support. It is defined " "only after the call to :func:`start_color`." msgstr "" -#: ../../library/curses.rst:1355 +#: ../../library/curses.rst:1357 msgid "" "The width of the screen, i.e., the number of columns. It is defined only " "after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :" "func:`resizeterm` and :func:`resize_term`." msgstr "" -#: ../../library/curses.rst:1362 +#: ../../library/curses.rst:1364 msgid "" "The height of the screen, i.e., the number of lines. It is defined only " "after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :" "func:`resizeterm` and :func:`resize_term`." msgstr "" -#: ../../library/curses.rst:1368 +#: ../../library/curses.rst:1370 msgid "" "Some constants are available to specify character cell attributes. The exact " "constants available are system dependent." msgstr "" -#: ../../library/curses.rst:1372 +#: ../../library/curses.rst:1374 msgid "Attribute" msgstr "" -#: ../../library/curses.rst:1372 ../../library/curses.rst:1417 -#: ../../library/curses.rst:1663 ../../library/curses.rst:1755 +#: ../../library/curses.rst:1374 ../../library/curses.rst:1419 +#: ../../library/curses.rst:1665 ../../library/curses.rst:1757 msgid "Meaning" msgstr "含義" -#: ../../library/curses.rst:1374 +#: ../../library/curses.rst:1376 msgid "Alternate character set mode" msgstr "" -#: ../../library/curses.rst:1376 +#: ../../library/curses.rst:1378 msgid "Blink mode" msgstr "" -#: ../../library/curses.rst:1378 +#: ../../library/curses.rst:1380 msgid "Bold mode" msgstr "" -#: ../../library/curses.rst:1380 +#: ../../library/curses.rst:1382 msgid "Dim mode" msgstr "" -#: ../../library/curses.rst:1382 +#: ../../library/curses.rst:1384 msgid "Invisible or blank mode" msgstr "" -#: ../../library/curses.rst:1384 +#: ../../library/curses.rst:1386 msgid "Italic mode" msgstr "" -#: ../../library/curses.rst:1386 +#: ../../library/curses.rst:1388 msgid "Normal attribute" msgstr "" -#: ../../library/curses.rst:1388 +#: ../../library/curses.rst:1390 msgid "Protected mode" msgstr "" -#: ../../library/curses.rst:1390 +#: ../../library/curses.rst:1392 msgid "Reverse background and foreground colors" msgstr "" -#: ../../library/curses.rst:1393 +#: ../../library/curses.rst:1395 msgid "Standout mode" msgstr "" -#: ../../library/curses.rst:1395 +#: ../../library/curses.rst:1397 msgid "Underline mode" msgstr "" -#: ../../library/curses.rst:1397 +#: ../../library/curses.rst:1399 msgid "Horizontal highlight" msgstr "" -#: ../../library/curses.rst:1399 +#: ../../library/curses.rst:1401 msgid "Left highlight" msgstr "" -#: ../../library/curses.rst:1401 +#: ../../library/curses.rst:1403 msgid "Low highlight" msgstr "" -#: ../../library/curses.rst:1403 +#: ../../library/curses.rst:1405 msgid "Right highlight" msgstr "" -#: ../../library/curses.rst:1405 +#: ../../library/curses.rst:1407 msgid "Top highlight" msgstr "" -#: ../../library/curses.rst:1407 +#: ../../library/curses.rst:1409 msgid "Vertical highlight" msgstr "" -#: ../../library/curses.rst:1410 +#: ../../library/curses.rst:1412 msgid "``A_ITALIC`` was added." msgstr "" -#: ../../library/curses.rst:1413 +#: ../../library/curses.rst:1415 msgid "" "Several constants are available to extract corresponding attributes returned " "by some methods." msgstr "" -#: ../../library/curses.rst:1417 +#: ../../library/curses.rst:1419 msgid "Bit-mask" msgstr "" -#: ../../library/curses.rst:1419 +#: ../../library/curses.rst:1421 msgid "Bit-mask to extract attributes" msgstr "" -#: ../../library/curses.rst:1422 +#: ../../library/curses.rst:1424 msgid "Bit-mask to extract a character" msgstr "" -#: ../../library/curses.rst:1425 +#: ../../library/curses.rst:1427 msgid "Bit-mask to extract color-pair field information" msgstr "" -#: ../../library/curses.rst:1429 +#: ../../library/curses.rst:1431 msgid "" "Keys are referred to by integer constants with names starting with " "``KEY_``. The exact keycaps available are system dependent." msgstr "" -#: ../../library/curses.rst:1435 +#: ../../library/curses.rst:1437 msgid "Key constant" msgstr "" -#: ../../library/curses.rst:1435 +#: ../../library/curses.rst:1437 msgid "Key" msgstr "" -#: ../../library/curses.rst:1437 +#: ../../library/curses.rst:1439 msgid "Minimum key value" msgstr "" -#: ../../library/curses.rst:1439 +#: ../../library/curses.rst:1441 msgid "Break key (unreliable)" msgstr "" -#: ../../library/curses.rst:1441 +#: ../../library/curses.rst:1443 msgid "Down-arrow" msgstr "" -#: ../../library/curses.rst:1443 +#: ../../library/curses.rst:1445 msgid "Up-arrow" msgstr "" -#: ../../library/curses.rst:1445 +#: ../../library/curses.rst:1447 msgid "Left-arrow" msgstr "" -#: ../../library/curses.rst:1447 +#: ../../library/curses.rst:1449 msgid "Right-arrow" msgstr "" -#: ../../library/curses.rst:1449 +#: ../../library/curses.rst:1451 msgid "Home key (upward+left arrow)" msgstr "" -#: ../../library/curses.rst:1451 +#: ../../library/curses.rst:1453 msgid "Backspace (unreliable)" msgstr "" -#: ../../library/curses.rst:1453 +#: ../../library/curses.rst:1455 msgid "Function keys. Up to 64 function keys are supported." msgstr "" -#: ../../library/curses.rst:1456 +#: ../../library/curses.rst:1458 msgid "Value of function key *n*" msgstr "" -#: ../../library/curses.rst:1458 +#: ../../library/curses.rst:1460 msgid "Delete line" msgstr "" -#: ../../library/curses.rst:1460 +#: ../../library/curses.rst:1462 msgid "Insert line" msgstr "" -#: ../../library/curses.rst:1462 +#: ../../library/curses.rst:1464 msgid "Delete character" msgstr "" -#: ../../library/curses.rst:1464 +#: ../../library/curses.rst:1466 msgid "Insert char or enter insert mode" msgstr "" -#: ../../library/curses.rst:1466 +#: ../../library/curses.rst:1468 msgid "Exit insert char mode" msgstr "" -#: ../../library/curses.rst:1468 +#: ../../library/curses.rst:1470 msgid "Clear screen" msgstr "" -#: ../../library/curses.rst:1470 +#: ../../library/curses.rst:1472 msgid "Clear to end of screen" msgstr "" -#: ../../library/curses.rst:1472 +#: ../../library/curses.rst:1474 msgid "Clear to end of line" msgstr "" -#: ../../library/curses.rst:1474 +#: ../../library/curses.rst:1476 msgid "Scroll 1 line forward" msgstr "" -#: ../../library/curses.rst:1476 +#: ../../library/curses.rst:1478 msgid "Scroll 1 line backward (reverse)" msgstr "" -#: ../../library/curses.rst:1478 +#: ../../library/curses.rst:1480 msgid "Next page" msgstr "" -#: ../../library/curses.rst:1480 +#: ../../library/curses.rst:1482 msgid "Previous page" msgstr "" -#: ../../library/curses.rst:1482 +#: ../../library/curses.rst:1484 msgid "Set tab" msgstr "" -#: ../../library/curses.rst:1484 +#: ../../library/curses.rst:1486 msgid "Clear tab" msgstr "" -#: ../../library/curses.rst:1486 +#: ../../library/curses.rst:1488 msgid "Clear all tabs" msgstr "" -#: ../../library/curses.rst:1488 +#: ../../library/curses.rst:1490 msgid "Enter or send (unreliable)" msgstr "" -#: ../../library/curses.rst:1490 +#: ../../library/curses.rst:1492 msgid "Soft (partial) reset (unreliable)" msgstr "" -#: ../../library/curses.rst:1492 +#: ../../library/curses.rst:1494 msgid "Reset or hard reset (unreliable)" msgstr "" -#: ../../library/curses.rst:1494 +#: ../../library/curses.rst:1496 msgid "Print" msgstr "" -#: ../../library/curses.rst:1496 +#: ../../library/curses.rst:1498 msgid "Home down or bottom (lower left)" msgstr "" -#: ../../library/curses.rst:1498 +#: ../../library/curses.rst:1500 msgid "Upper left of keypad" msgstr "" -#: ../../library/curses.rst:1500 +#: ../../library/curses.rst:1502 msgid "Upper right of keypad" msgstr "" -#: ../../library/curses.rst:1502 +#: ../../library/curses.rst:1504 msgid "Center of keypad" msgstr "" -#: ../../library/curses.rst:1504 +#: ../../library/curses.rst:1506 msgid "Lower left of keypad" msgstr "" -#: ../../library/curses.rst:1506 +#: ../../library/curses.rst:1508 msgid "Lower right of keypad" msgstr "" -#: ../../library/curses.rst:1508 +#: ../../library/curses.rst:1510 msgid "Back tab" msgstr "" -#: ../../library/curses.rst:1510 +#: ../../library/curses.rst:1512 msgid "Beg (beginning)" msgstr "" -#: ../../library/curses.rst:1512 +#: ../../library/curses.rst:1514 msgid "Cancel" msgstr "" -#: ../../library/curses.rst:1514 +#: ../../library/curses.rst:1516 msgid "Close" msgstr "" -#: ../../library/curses.rst:1516 +#: ../../library/curses.rst:1518 msgid "Cmd (command)" msgstr "" -#: ../../library/curses.rst:1518 +#: ../../library/curses.rst:1520 msgid "Copy" msgstr "" -#: ../../library/curses.rst:1520 +#: ../../library/curses.rst:1522 msgid "Create" msgstr "" -#: ../../library/curses.rst:1522 +#: ../../library/curses.rst:1524 msgid "End" msgstr "" -#: ../../library/curses.rst:1524 +#: ../../library/curses.rst:1526 msgid "Exit" msgstr "" -#: ../../library/curses.rst:1526 +#: ../../library/curses.rst:1528 msgid "Find" msgstr "" -#: ../../library/curses.rst:1528 +#: ../../library/curses.rst:1530 msgid "Help" msgstr "" -#: ../../library/curses.rst:1530 +#: ../../library/curses.rst:1532 msgid "Mark" msgstr "" -#: ../../library/curses.rst:1532 +#: ../../library/curses.rst:1534 msgid "Message" msgstr "" -#: ../../library/curses.rst:1534 +#: ../../library/curses.rst:1536 msgid "Move" msgstr "" -#: ../../library/curses.rst:1536 +#: ../../library/curses.rst:1538 msgid "Next" msgstr "" -#: ../../library/curses.rst:1538 +#: ../../library/curses.rst:1540 msgid "Open" msgstr "" -#: ../../library/curses.rst:1540 +#: ../../library/curses.rst:1542 msgid "Options" msgstr "" -#: ../../library/curses.rst:1542 +#: ../../library/curses.rst:1544 msgid "Prev (previous)" msgstr "" -#: ../../library/curses.rst:1544 +#: ../../library/curses.rst:1546 msgid "Redo" msgstr "" -#: ../../library/curses.rst:1546 +#: ../../library/curses.rst:1548 msgid "Ref (reference)" msgstr "" -#: ../../library/curses.rst:1548 +#: ../../library/curses.rst:1550 msgid "Refresh" msgstr "" -#: ../../library/curses.rst:1550 +#: ../../library/curses.rst:1552 msgid "Replace" msgstr "" -#: ../../library/curses.rst:1552 +#: ../../library/curses.rst:1554 msgid "Restart" msgstr "" -#: ../../library/curses.rst:1554 +#: ../../library/curses.rst:1556 msgid "Resume" msgstr "" -#: ../../library/curses.rst:1556 +#: ../../library/curses.rst:1558 msgid "Save" msgstr "" -#: ../../library/curses.rst:1558 +#: ../../library/curses.rst:1560 msgid "Shifted Beg (beginning)" msgstr "" -#: ../../library/curses.rst:1560 +#: ../../library/curses.rst:1562 msgid "Shifted Cancel" msgstr "" -#: ../../library/curses.rst:1562 +#: ../../library/curses.rst:1564 msgid "Shifted Command" msgstr "" -#: ../../library/curses.rst:1564 +#: ../../library/curses.rst:1566 msgid "Shifted Copy" msgstr "" -#: ../../library/curses.rst:1566 +#: ../../library/curses.rst:1568 msgid "Shifted Create" msgstr "" -#: ../../library/curses.rst:1568 +#: ../../library/curses.rst:1570 msgid "Shifted Delete char" msgstr "" -#: ../../library/curses.rst:1570 +#: ../../library/curses.rst:1572 msgid "Shifted Delete line" msgstr "" -#: ../../library/curses.rst:1572 +#: ../../library/curses.rst:1574 msgid "Select" msgstr "" -#: ../../library/curses.rst:1574 +#: ../../library/curses.rst:1576 msgid "Shifted End" msgstr "" -#: ../../library/curses.rst:1576 +#: ../../library/curses.rst:1578 msgid "Shifted Clear line" msgstr "" -#: ../../library/curses.rst:1578 +#: ../../library/curses.rst:1580 msgid "Shifted Exit" msgstr "" -#: ../../library/curses.rst:1580 +#: ../../library/curses.rst:1582 msgid "Shifted Find" msgstr "" -#: ../../library/curses.rst:1582 +#: ../../library/curses.rst:1584 msgid "Shifted Help" msgstr "" -#: ../../library/curses.rst:1584 +#: ../../library/curses.rst:1586 msgid "Shifted Home" msgstr "" -#: ../../library/curses.rst:1586 +#: ../../library/curses.rst:1588 msgid "Shifted Input" msgstr "" -#: ../../library/curses.rst:1588 +#: ../../library/curses.rst:1590 msgid "Shifted Left arrow" msgstr "" -#: ../../library/curses.rst:1590 +#: ../../library/curses.rst:1592 msgid "Shifted Message" msgstr "" -#: ../../library/curses.rst:1592 +#: ../../library/curses.rst:1594 msgid "Shifted Move" msgstr "" -#: ../../library/curses.rst:1594 +#: ../../library/curses.rst:1596 msgid "Shifted Next" msgstr "" -#: ../../library/curses.rst:1596 +#: ../../library/curses.rst:1598 msgid "Shifted Options" msgstr "" -#: ../../library/curses.rst:1598 +#: ../../library/curses.rst:1600 msgid "Shifted Prev" msgstr "" -#: ../../library/curses.rst:1600 +#: ../../library/curses.rst:1602 msgid "Shifted Print" msgstr "" -#: ../../library/curses.rst:1602 +#: ../../library/curses.rst:1604 msgid "Shifted Redo" msgstr "" -#: ../../library/curses.rst:1604 +#: ../../library/curses.rst:1606 msgid "Shifted Replace" msgstr "" -#: ../../library/curses.rst:1606 +#: ../../library/curses.rst:1608 msgid "Shifted Right arrow" msgstr "" -#: ../../library/curses.rst:1608 +#: ../../library/curses.rst:1610 msgid "Shifted Resume" msgstr "" -#: ../../library/curses.rst:1610 +#: ../../library/curses.rst:1612 msgid "Shifted Save" msgstr "" -#: ../../library/curses.rst:1612 +#: ../../library/curses.rst:1614 msgid "Shifted Suspend" msgstr "" -#: ../../library/curses.rst:1614 +#: ../../library/curses.rst:1616 msgid "Shifted Undo" msgstr "" -#: ../../library/curses.rst:1616 +#: ../../library/curses.rst:1618 msgid "Suspend" msgstr "" -#: ../../library/curses.rst:1618 +#: ../../library/curses.rst:1620 msgid "Undo" msgstr "" -#: ../../library/curses.rst:1620 +#: ../../library/curses.rst:1622 msgid "Mouse event has occurred" msgstr "" -#: ../../library/curses.rst:1622 +#: ../../library/curses.rst:1624 msgid "Terminal resize event" msgstr "" -#: ../../library/curses.rst:1624 +#: ../../library/curses.rst:1626 msgid "Maximum key value" msgstr "" -#: ../../library/curses.rst:1627 +#: ../../library/curses.rst:1629 msgid "" "On VT100s and their software emulations, such as X terminal emulators, there " "are normally at least four function keys (:const:`KEY_F1 `, :const:" @@ -2023,64 +2035,64 @@ msgid "" "keypad mappings are standard:" msgstr "" -#: ../../library/curses.rst:1636 +#: ../../library/curses.rst:1638 msgid "Keycap" msgstr "" -#: ../../library/curses.rst:1636 ../../library/curses.rst:1781 -#: ../../library/curses.rst:1905 +#: ../../library/curses.rst:1638 ../../library/curses.rst:1783 +#: ../../library/curses.rst:1907 msgid "Constant" msgstr "" -#: ../../library/curses.rst:1638 +#: ../../library/curses.rst:1640 msgid ":kbd:`Insert`" msgstr ":kbd:`Insert`" -#: ../../library/curses.rst:1638 +#: ../../library/curses.rst:1640 msgid "KEY_IC" msgstr "KEY_IC" -#: ../../library/curses.rst:1640 +#: ../../library/curses.rst:1642 msgid ":kbd:`Delete`" msgstr ":kbd:`Delete`" -#: ../../library/curses.rst:1640 +#: ../../library/curses.rst:1642 msgid "KEY_DC" msgstr "KEY_DC" -#: ../../library/curses.rst:1642 +#: ../../library/curses.rst:1644 msgid ":kbd:`Home`" msgstr ":kbd:`Home`" -#: ../../library/curses.rst:1642 +#: ../../library/curses.rst:1644 msgid "KEY_HOME" msgstr "KEY_HOME" -#: ../../library/curses.rst:1644 +#: ../../library/curses.rst:1646 msgid ":kbd:`End`" msgstr ":kbd:`End`" -#: ../../library/curses.rst:1644 +#: ../../library/curses.rst:1646 msgid "KEY_END" msgstr "KEY_END" -#: ../../library/curses.rst:1646 +#: ../../library/curses.rst:1648 msgid ":kbd:`Page Up`" msgstr ":kbd:`Page Up`" -#: ../../library/curses.rst:1646 +#: ../../library/curses.rst:1648 msgid "KEY_PPAGE" msgstr "KEY_PPAGE" -#: ../../library/curses.rst:1648 +#: ../../library/curses.rst:1650 msgid ":kbd:`Page Down`" msgstr ":kbd:`Page Down`" -#: ../../library/curses.rst:1648 +#: ../../library/curses.rst:1650 msgid "KEY_NPAGE" msgstr "KEY_NPAGE" -#: ../../library/curses.rst:1653 +#: ../../library/curses.rst:1655 msgid "" "The following table lists characters from the alternate character set. These " "are inherited from the VT100 terminal, and will generally be available on " @@ -2088,268 +2100,268 @@ msgid "" "available, curses falls back on a crude printable ASCII approximation." msgstr "" -#: ../../library/curses.rst:1660 +#: ../../library/curses.rst:1662 msgid "These are available only after :func:`initscr` has been called." msgstr "" -#: ../../library/curses.rst:1663 +#: ../../library/curses.rst:1665 msgid "ACS code" msgstr "" -#: ../../library/curses.rst:1665 +#: ../../library/curses.rst:1667 msgid "alternate name for upper right corner" msgstr "" -#: ../../library/curses.rst:1667 +#: ../../library/curses.rst:1669 msgid "solid square block" msgstr "" -#: ../../library/curses.rst:1669 +#: ../../library/curses.rst:1671 msgid "board of squares" msgstr "" -#: ../../library/curses.rst:1671 +#: ../../library/curses.rst:1673 msgid "alternate name for horizontal line" msgstr "" -#: ../../library/curses.rst:1673 +#: ../../library/curses.rst:1675 msgid "alternate name for upper left corner" msgstr "" -#: ../../library/curses.rst:1675 +#: ../../library/curses.rst:1677 msgid "alternate name for top tee" msgstr "" -#: ../../library/curses.rst:1677 +#: ../../library/curses.rst:1679 msgid "bottom tee" msgstr "" -#: ../../library/curses.rst:1679 +#: ../../library/curses.rst:1681 msgid "bullet" msgstr "" -#: ../../library/curses.rst:1681 +#: ../../library/curses.rst:1683 msgid "checker board (stipple)" msgstr "" -#: ../../library/curses.rst:1683 +#: ../../library/curses.rst:1685 msgid "arrow pointing down" msgstr "" -#: ../../library/curses.rst:1685 +#: ../../library/curses.rst:1687 msgid "degree symbol" msgstr "" -#: ../../library/curses.rst:1687 +#: ../../library/curses.rst:1689 msgid "diamond" msgstr "" -#: ../../library/curses.rst:1689 +#: ../../library/curses.rst:1691 msgid "greater-than-or-equal-to" msgstr "" -#: ../../library/curses.rst:1691 +#: ../../library/curses.rst:1693 msgid "horizontal line" msgstr "" -#: ../../library/curses.rst:1693 +#: ../../library/curses.rst:1695 msgid "lantern symbol" msgstr "" -#: ../../library/curses.rst:1695 +#: ../../library/curses.rst:1697 msgid "left arrow" msgstr "" -#: ../../library/curses.rst:1697 +#: ../../library/curses.rst:1699 msgid "less-than-or-equal-to" msgstr "" -#: ../../library/curses.rst:1699 +#: ../../library/curses.rst:1701 msgid "lower left-hand corner" msgstr "" -#: ../../library/curses.rst:1701 +#: ../../library/curses.rst:1703 msgid "lower right-hand corner" msgstr "" -#: ../../library/curses.rst:1703 +#: ../../library/curses.rst:1705 msgid "left tee" msgstr "" -#: ../../library/curses.rst:1705 +#: ../../library/curses.rst:1707 msgid "not-equal sign" msgstr "" -#: ../../library/curses.rst:1707 +#: ../../library/curses.rst:1709 msgid "letter pi" msgstr "" -#: ../../library/curses.rst:1709 +#: ../../library/curses.rst:1711 msgid "plus-or-minus sign" msgstr "" -#: ../../library/curses.rst:1711 +#: ../../library/curses.rst:1713 msgid "big plus sign" msgstr "" -#: ../../library/curses.rst:1713 +#: ../../library/curses.rst:1715 msgid "right arrow" msgstr "" -#: ../../library/curses.rst:1715 +#: ../../library/curses.rst:1717 msgid "right tee" msgstr "" -#: ../../library/curses.rst:1717 +#: ../../library/curses.rst:1719 msgid "scan line 1" msgstr "" -#: ../../library/curses.rst:1719 +#: ../../library/curses.rst:1721 msgid "scan line 3" msgstr "" -#: ../../library/curses.rst:1721 +#: ../../library/curses.rst:1723 msgid "scan line 7" msgstr "" -#: ../../library/curses.rst:1723 +#: ../../library/curses.rst:1725 msgid "scan line 9" msgstr "" -#: ../../library/curses.rst:1725 +#: ../../library/curses.rst:1727 msgid "alternate name for lower right corner" msgstr "" -#: ../../library/curses.rst:1727 +#: ../../library/curses.rst:1729 msgid "alternate name for vertical line" msgstr "" -#: ../../library/curses.rst:1729 +#: ../../library/curses.rst:1731 msgid "alternate name for right tee" msgstr "" -#: ../../library/curses.rst:1731 +#: ../../library/curses.rst:1733 msgid "alternate name for lower left corner" msgstr "" -#: ../../library/curses.rst:1733 +#: ../../library/curses.rst:1735 msgid "alternate name for bottom tee" msgstr "" -#: ../../library/curses.rst:1735 +#: ../../library/curses.rst:1737 msgid "alternate name for left tee" msgstr "" -#: ../../library/curses.rst:1737 +#: ../../library/curses.rst:1739 msgid "alternate name for crossover or big plus" msgstr "" -#: ../../library/curses.rst:1739 +#: ../../library/curses.rst:1741 msgid "pound sterling" msgstr "" -#: ../../library/curses.rst:1741 +#: ../../library/curses.rst:1743 msgid "top tee" msgstr "" -#: ../../library/curses.rst:1743 +#: ../../library/curses.rst:1745 msgid "up arrow" msgstr "" -#: ../../library/curses.rst:1745 +#: ../../library/curses.rst:1747 msgid "upper left corner" msgstr "" -#: ../../library/curses.rst:1747 +#: ../../library/curses.rst:1749 msgid "upper right corner" msgstr "" -#: ../../library/curses.rst:1749 +#: ../../library/curses.rst:1751 msgid "vertical line" msgstr "" -#: ../../library/curses.rst:1752 +#: ../../library/curses.rst:1754 msgid "" "The following table lists mouse button constants used by :meth:`getmouse`:" msgstr "" -#: ../../library/curses.rst:1755 +#: ../../library/curses.rst:1757 msgid "Mouse button constant" msgstr "" -#: ../../library/curses.rst:1757 +#: ../../library/curses.rst:1759 msgid "Mouse button *n* pressed" msgstr "" -#: ../../library/curses.rst:1759 +#: ../../library/curses.rst:1761 msgid "Mouse button *n* released" msgstr "" -#: ../../library/curses.rst:1761 +#: ../../library/curses.rst:1763 msgid "Mouse button *n* clicked" msgstr "" -#: ../../library/curses.rst:1763 +#: ../../library/curses.rst:1765 msgid "Mouse button *n* double clicked" msgstr "" -#: ../../library/curses.rst:1765 +#: ../../library/curses.rst:1767 msgid "Mouse button *n* triple clicked" msgstr "" -#: ../../library/curses.rst:1767 +#: ../../library/curses.rst:1769 msgid "Shift was down during button state change" msgstr "" -#: ../../library/curses.rst:1769 ../../library/curses.rst:1771 +#: ../../library/curses.rst:1771 ../../library/curses.rst:1773 msgid "Control was down during button state change" msgstr "" -#: ../../library/curses.rst:1778 +#: ../../library/curses.rst:1780 msgid "The following table lists the predefined colors:" msgstr "" -#: ../../library/curses.rst:1781 +#: ../../library/curses.rst:1783 msgid "Color" msgstr "顏色" -#: ../../library/curses.rst:1783 +#: ../../library/curses.rst:1785 msgid "Black" msgstr "黑" -#: ../../library/curses.rst:1785 +#: ../../library/curses.rst:1787 msgid "Blue" msgstr "藍" -#: ../../library/curses.rst:1787 +#: ../../library/curses.rst:1789 msgid "Cyan (light greenish blue)" msgstr "" -#: ../../library/curses.rst:1789 +#: ../../library/curses.rst:1791 msgid "Green" msgstr "綠" -#: ../../library/curses.rst:1791 +#: ../../library/curses.rst:1793 msgid "Magenta (purplish red)" msgstr "" -#: ../../library/curses.rst:1793 +#: ../../library/curses.rst:1795 msgid "Red" msgstr "紅" -#: ../../library/curses.rst:1795 +#: ../../library/curses.rst:1797 msgid "White" msgstr "白" -#: ../../library/curses.rst:1797 +#: ../../library/curses.rst:1799 msgid "Yellow" msgstr "" -#: ../../library/curses.rst:1802 +#: ../../library/curses.rst:1804 msgid ":mod:`curses.textpad` --- Text input widget for curses programs" msgstr "" -#: ../../library/curses.rst:1810 +#: ../../library/curses.rst:1812 msgid "" "The :mod:`curses.textpad` module provides a :class:`Textbox` class that " "handles elementary text editing in a curses window, supporting a set of " @@ -2359,11 +2371,11 @@ msgid "" "purposes." msgstr "" -#: ../../library/curses.rst:1816 +#: ../../library/curses.rst:1818 msgid "The module :mod:`curses.textpad` defines the following function:" msgstr "" -#: ../../library/curses.rst:1821 +#: ../../library/curses.rst:1823 msgid "" "Draw a rectangle. The first argument must be a window object; the remaining " "arguments are coordinates relative to that window. The second and third " @@ -2375,15 +2387,15 @@ msgid "" "will be drawn with ASCII dashes, vertical bars, and plus signs." msgstr "" -#: ../../library/curses.rst:1834 +#: ../../library/curses.rst:1836 msgid "Textbox objects" msgstr "" -#: ../../library/curses.rst:1836 +#: ../../library/curses.rst:1838 msgid "You can instantiate a :class:`Textbox` object as follows:" msgstr "" -#: ../../library/curses.rst:1841 +#: ../../library/curses.rst:1843 msgid "" "Return a textbox widget object. The *win* argument should be a curses :ref:" "`window ` object in which the textbox is to be " @@ -2392,11 +2404,11 @@ msgid "" "instance's :attr:`stripspaces` flag is initially on." msgstr "" -#: ../../library/curses.rst:1847 +#: ../../library/curses.rst:1849 msgid ":class:`Textbox` objects have the following methods:" msgstr "" -#: ../../library/curses.rst:1852 +#: ../../library/curses.rst:1854 msgid "" "This is the entry point you will normally use. It accepts editing " "keystrokes until one of the termination keystrokes is entered. If " @@ -2407,167 +2419,167 @@ msgid "" "`stripspaces` attribute." msgstr "" -#: ../../library/curses.rst:1863 +#: ../../library/curses.rst:1865 msgid "" "Process a single command keystroke. Here are the supported special " "keystrokes:" msgstr "" -#: ../../library/curses.rst:1867 ../../library/curses.rst:1905 +#: ../../library/curses.rst:1869 ../../library/curses.rst:1907 msgid "Keystroke" msgstr "" -#: ../../library/curses.rst:1867 +#: ../../library/curses.rst:1869 msgid "Action" msgstr "" -#: ../../library/curses.rst:1869 +#: ../../library/curses.rst:1871 msgid ":kbd:`Control-A`" msgstr ":kbd:`Control-A`" -#: ../../library/curses.rst:1869 +#: ../../library/curses.rst:1871 msgid "Go to left edge of window." msgstr "" -#: ../../library/curses.rst:1871 ../../library/curses.rst:1907 +#: ../../library/curses.rst:1873 ../../library/curses.rst:1909 msgid ":kbd:`Control-B`" msgstr ":kbd:`Control-B`" -#: ../../library/curses.rst:1871 +#: ../../library/curses.rst:1873 msgid "Cursor left, wrapping to previous line if appropriate." msgstr "" -#: ../../library/curses.rst:1874 +#: ../../library/curses.rst:1876 msgid ":kbd:`Control-D`" msgstr ":kbd:`Control-D`" -#: ../../library/curses.rst:1874 +#: ../../library/curses.rst:1876 msgid "Delete character under cursor." msgstr "" -#: ../../library/curses.rst:1876 +#: ../../library/curses.rst:1878 msgid ":kbd:`Control-E`" msgstr ":kbd:`Control-E`" -#: ../../library/curses.rst:1876 +#: ../../library/curses.rst:1878 msgid "Go to right edge (stripspaces off) or end of line (stripspaces on)." msgstr "" -#: ../../library/curses.rst:1879 ../../library/curses.rst:1909 +#: ../../library/curses.rst:1881 ../../library/curses.rst:1911 msgid ":kbd:`Control-F`" msgstr ":kbd:`Control-F`" -#: ../../library/curses.rst:1879 +#: ../../library/curses.rst:1881 msgid "Cursor right, wrapping to next line when appropriate." msgstr "" -#: ../../library/curses.rst:1882 +#: ../../library/curses.rst:1884 msgid ":kbd:`Control-G`" msgstr ":kbd:`Control-G`" -#: ../../library/curses.rst:1882 +#: ../../library/curses.rst:1884 msgid "Terminate, returning the window contents." msgstr "" -#: ../../library/curses.rst:1884 +#: ../../library/curses.rst:1886 msgid ":kbd:`Control-H`" msgstr ":kbd:`Control-H`" -#: ../../library/curses.rst:1884 +#: ../../library/curses.rst:1886 msgid "Delete character backward." msgstr "" -#: ../../library/curses.rst:1886 +#: ../../library/curses.rst:1888 msgid ":kbd:`Control-J`" msgstr ":kbd:`Control-J`" -#: ../../library/curses.rst:1886 +#: ../../library/curses.rst:1888 msgid "Terminate if the window is 1 line, otherwise insert newline." msgstr "" -#: ../../library/curses.rst:1889 +#: ../../library/curses.rst:1891 msgid ":kbd:`Control-K`" msgstr ":kbd:`Control-K`" -#: ../../library/curses.rst:1889 +#: ../../library/curses.rst:1891 msgid "If line is blank, delete it, otherwise clear to end of line." msgstr "" -#: ../../library/curses.rst:1892 +#: ../../library/curses.rst:1894 msgid ":kbd:`Control-L`" msgstr ":kbd:`Control-L`" -#: ../../library/curses.rst:1892 +#: ../../library/curses.rst:1894 msgid "Refresh screen." msgstr "" -#: ../../library/curses.rst:1894 ../../library/curses.rst:1913 +#: ../../library/curses.rst:1896 ../../library/curses.rst:1915 msgid ":kbd:`Control-N`" msgstr ":kbd:`Control-N`" -#: ../../library/curses.rst:1894 +#: ../../library/curses.rst:1896 msgid "Cursor down; move down one line." msgstr "" -#: ../../library/curses.rst:1896 +#: ../../library/curses.rst:1898 msgid ":kbd:`Control-O`" msgstr ":kbd:`Control-O`" -#: ../../library/curses.rst:1896 +#: ../../library/curses.rst:1898 msgid "Insert a blank line at cursor location." msgstr "" -#: ../../library/curses.rst:1898 ../../library/curses.rst:1911 +#: ../../library/curses.rst:1900 ../../library/curses.rst:1913 msgid ":kbd:`Control-P`" msgstr ":kbd:`Control-P`" -#: ../../library/curses.rst:1898 +#: ../../library/curses.rst:1900 msgid "Cursor up; move up one line." msgstr "" -#: ../../library/curses.rst:1901 +#: ../../library/curses.rst:1903 msgid "" "Move operations do nothing if the cursor is at an edge where the movement is " "not possible. The following synonyms are supported where possible:" msgstr "" -#: ../../library/curses.rst:1907 +#: ../../library/curses.rst:1909 msgid ":const:`~curses.KEY_LEFT`" msgstr ":const:`~curses.KEY_LEFT`" -#: ../../library/curses.rst:1909 +#: ../../library/curses.rst:1911 msgid ":const:`~curses.KEY_RIGHT`" msgstr ":const:`~curses.KEY_RIGHT`" -#: ../../library/curses.rst:1911 +#: ../../library/curses.rst:1913 msgid ":const:`~curses.KEY_UP`" msgstr ":const:`~curses.KEY_UP`" -#: ../../library/curses.rst:1913 +#: ../../library/curses.rst:1915 msgid ":const:`~curses.KEY_DOWN`" msgstr ":const:`~curses.KEY_DOWN`" -#: ../../library/curses.rst:1915 +#: ../../library/curses.rst:1917 msgid ":const:`~curses.KEY_BACKSPACE`" msgstr ":const:`~curses.KEY_BACKSPACE`" -#: ../../library/curses.rst:1915 +#: ../../library/curses.rst:1917 msgid ":kbd:`Control-h`" msgstr ":kbd:`Control-h`" -#: ../../library/curses.rst:1918 +#: ../../library/curses.rst:1920 msgid "" "All other keystrokes are treated as a command to insert the given character " "and move right (with line wrapping)." msgstr "" -#: ../../library/curses.rst:1924 +#: ../../library/curses.rst:1926 msgid "" "Return the window contents as a string; whether blanks in the window are " "included is affected by the :attr:`stripspaces` member." msgstr "" -#: ../../library/curses.rst:1930 +#: ../../library/curses.rst:1932 msgid "" "This attribute is a flag which controls the interpretation of blanks in the " "window. When it is on, trailing blanks on each line are ignored; any cursor " diff --git a/library/dataclasses.po b/library/dataclasses.po index 42efc54a27..3725bca2be 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-02-11 15:02+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -889,7 +889,13 @@ msgstr "" "造函式可能是明智的,或者可能是處理實例複製的自定義:func:`!replace` (或類似命" "名的)方法。" -#: ../../library/dataclasses.rst:474 +#: ../../library/dataclasses.rst:472 +msgid "" +"Dataclass instances are also supported by generic function :func:`copy." +"replace`." +msgstr "" + +#: ../../library/dataclasses.rst:476 #, fuzzy msgid "" "Return ``True`` if its parameter is a dataclass (including subclasses of a " @@ -897,7 +903,7 @@ msgid "" msgstr "" "如果它的參數是一個資料類別或一個實例,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/dataclasses.rst:477 +#: ../../library/dataclasses.rst:479 #, fuzzy msgid "" "If you need to know if a class is an instance of a dataclass (and not a " @@ -907,18 +913,18 @@ msgstr "" "如果你需要知道一個類是否是資料類別的實例(而不是資料類別本身),那麼新增一個" "進一步的檢查 ``not isinstance(obj, type)``: ::" -#: ../../library/dataclasses.rst:481 +#: ../../library/dataclasses.rst:483 msgid "" "def is_dataclass_instance(obj):\n" " return is_dataclass(obj) and not isinstance(obj, type)" msgstr "" -#: ../../library/dataclasses.rst:486 +#: ../../library/dataclasses.rst:488 #, fuzzy msgid "A sentinel value signifying a missing default or default_factory." msgstr "表示缺少 default 或 default_factory 的標記值。" -#: ../../library/dataclasses.rst:490 +#: ../../library/dataclasses.rst:492 #, fuzzy msgid "" "A sentinel value used as a type annotation. Any fields after a pseudo-field " @@ -934,14 +940,14 @@ msgstr "" "類欄位的名稱。按照慣例,名稱 ``_`` 用於 :const:`!KW_ONLY` 欄位。僅關鍵字欄位" "表示 :meth:`~object.__init__` 參數,在實例化類時必須將其指定為關鍵字。" -#: ../../library/dataclasses.rst:499 +#: ../../library/dataclasses.rst:501 #, fuzzy msgid "" "In this example, the fields ``y`` and ``z`` will be marked as keyword-only " "fields::" msgstr "在此示例中,欄位 ``y`` 和 ``z`` 將被標記為僅關鍵字欄位: ::" -#: ../../library/dataclasses.rst:501 +#: ../../library/dataclasses.rst:503 msgid "" "@dataclass\n" "class Point:\n" @@ -953,14 +959,14 @@ msgid "" "p = Point(0, y=1.5, z=2.0)" msgstr "" -#: ../../library/dataclasses.rst:510 +#: ../../library/dataclasses.rst:512 #, fuzzy msgid "" "In a single dataclass, it is an error to specify more than one field whose " "type is :const:`!KW_ONLY`." msgstr "在單個資料類別中,指定多個型別為 :const:`!KW_ONLY` 的欄位是錯誤的。" -#: ../../library/dataclasses.rst:517 +#: ../../library/dataclasses.rst:519 #, fuzzy msgid "" "Raised when an implicitly defined :meth:`~object.__setattr__` or :meth:" @@ -970,12 +976,12 @@ msgstr "" "當在使用 frozen=True 定義的資料類別上呼叫隱式定義的 :meth:`__setattr__` 或 :" "meth:`__delattr__` 時引發。它是 :exc:`AttributeError` 的子類別。" -#: ../../library/dataclasses.rst:524 +#: ../../library/dataclasses.rst:526 #, fuzzy msgid "Post-init processing" msgstr "初始化後處理" -#: ../../library/dataclasses.rst:528 +#: ../../library/dataclasses.rst:530 #, fuzzy msgid "" "When defined on the class, it will be called by the generated :meth:`~object." @@ -991,14 +997,14 @@ msgstr "" "按照它們在類中定義的順序傳遞給 :meth:`!__post_init__` 。如果沒有生成 :meth:`!" "__init__` 方法,那麼 :meth:`!__post_init__` 將不會被自動呼叫。" -#: ../../library/dataclasses.rst:535 +#: ../../library/dataclasses.rst:537 #, fuzzy msgid "" "Among other uses, this allows for initializing field values that depend on " "one or more other fields. For example::" msgstr "在其他用途中,這允許初始化依賴於一個或多個其他欄位的欄位值。例如: ::" -#: ../../library/dataclasses.rst:538 +#: ../../library/dataclasses.rst:540 msgid "" "@dataclass\n" "class C:\n" @@ -1010,7 +1016,7 @@ msgid "" " self.c = self.a + self.b" msgstr "" -#: ../../library/dataclasses.rst:547 +#: ../../library/dataclasses.rst:549 #, fuzzy msgid "" "The :meth:`~object.__init__` method generated by :func:`@dataclass " @@ -1022,12 +1028,12 @@ msgstr "" "類別 :meth:`!__init__` 方法。如果基底類別有一個必須呼叫的 :meth:`!__init__` " "方法,通常在 :meth:`__post_init__` 方法中呼叫此方法: ::" -#: ../../library/dataclasses.rst:552 +#: ../../library/dataclasses.rst:554 msgid "" "class Rectangle:\n" " def __init__(self, height, width):\n" -" self.height = height\n" -" self.width = width\n" +" self.height = height\n" +" self.width = width\n" "\n" "@dataclass\n" "class Square(Rectangle):\n" @@ -1037,7 +1043,7 @@ msgid "" " super().__init__(self.side, self.side)" msgstr "" -#: ../../library/dataclasses.rst:564 +#: ../../library/dataclasses.rst:566 #, fuzzy msgid "" "Note, however, that in general the dataclass-generated :meth:`!__init__` " @@ -1047,7 +1053,7 @@ msgstr "" "但是請注意,通常不需要呼叫資料類別生成的 :meth:`!__init__` 方法,因為派生資料" "類別將負責初始化作為資料類別本身的任何基底類別的所有欄位。" -#: ../../library/dataclasses.rst:568 +#: ../../library/dataclasses.rst:570 #, fuzzy msgid "" "See the section below on init-only variables for ways to pass parameters to :" @@ -1057,11 +1063,11 @@ msgstr "" "請參閱下面有關僅初始化變數的部分,了解將參數傳遞給 :meth:`!__post_init__` 的" "方法。另請參閱有關 :func:`replace` 如何處理 ``init=False`` 欄位的警告。" -#: ../../library/dataclasses.rst:575 +#: ../../library/dataclasses.rst:577 msgid "Class variables" msgstr "類別變數" -#: ../../library/dataclasses.rst:577 +#: ../../library/dataclasses.rst:579 #, fuzzy msgid "" "One of the few places where :func:`@dataclass ` actually inspects " @@ -1078,12 +1084,12 @@ msgstr "" "外,並被資料類別機制忽略。模組級 :func:`fields` 函式不會回傳此類別 " "``ClassVar`` 偽欄位。" -#: ../../library/dataclasses.rst:588 +#: ../../library/dataclasses.rst:590 #, fuzzy msgid "Init-only variables" msgstr "僅初始化變數" -#: ../../library/dataclasses.rst:590 +#: ../../library/dataclasses.rst:592 #, fuzzy msgid "" "Another place where :func:`@dataclass ` inspects a type " @@ -1103,14 +1109,14 @@ msgstr "" "的 :meth:`~object.__init__` 方法,並傳遞給可選的 :meth:`__post_init__` 方法。" "它們不被資料類使用。" -#: ../../library/dataclasses.rst:600 +#: ../../library/dataclasses.rst:602 #, fuzzy msgid "" "For example, suppose a field will be initialized from a database, if a value " "is not provided when creating the class::" msgstr "例如,假設一個欄位將從資料庫中初始化,如果在建立類時沒有提供值: ::" -#: ../../library/dataclasses.rst:603 +#: ../../library/dataclasses.rst:605 msgid "" "@dataclass\n" "class C:\n" @@ -1125,7 +1131,7 @@ msgid "" "c = C(10, database=my_database)" msgstr "" -#: ../../library/dataclasses.rst:615 +#: ../../library/dataclasses.rst:617 #, fuzzy msgid "" "In this case, :func:`fields` will return :class:`Field` objects for :attr:`!" @@ -1134,11 +1140,11 @@ msgstr "" "在這種情況下,:func:`fields` 將為 :attr:`!i` 和 :attr:`!j` 回傳 :class:" "`Field` 物件,但不會為 :attr:`!database` 回傳。" -#: ../../library/dataclasses.rst:621 +#: ../../library/dataclasses.rst:623 msgid "Frozen instances" msgstr "凍結實例" -#: ../../library/dataclasses.rst:623 +#: ../../library/dataclasses.rst:625 #, fuzzy msgid "" "It is not possible to create truly immutable Python objects. However, by " @@ -1152,7 +1158,7 @@ msgstr "" "別將向類新增 :meth:`~object.__setattr__` 和 :meth:`~object.__delattr__` 方" "法。這些方法在呼叫時會引發 :exc:`FrozenInstanceError`。" -#: ../../library/dataclasses.rst:629 +#: ../../library/dataclasses.rst:631 #, fuzzy msgid "" "There is a tiny performance penalty when using ``frozen=True``: :meth:" @@ -1162,11 +1168,11 @@ msgstr "" "使用 ``frozen=True`` 時有一個微小的性能損失::meth:`~object.__init__` 不能使" "用簡單賦值來初始化欄位,必須使用 :meth:`!object.__setattr__`。" -#: ../../library/dataclasses.rst:638 +#: ../../library/dataclasses.rst:640 msgid "Inheritance" msgstr "繼承" -#: ../../library/dataclasses.rst:640 +#: ../../library/dataclasses.rst:642 #, fuzzy msgid "" "When the dataclass is being created by the :func:`@dataclass ` " @@ -1184,7 +1190,7 @@ msgstr "" "將自己的欄位新增到有序映射中。所有生成的方法都將使用這種組合的、計算的有序欄" "位映射。因為欄位是按插入順序排列的,所以派生類會覆蓋基底類別。一個例子: ::" -#: ../../library/dataclasses.rst:650 +#: ../../library/dataclasses.rst:652 msgid "" "@dataclass\n" "class Base:\n" @@ -1197,7 +1203,7 @@ msgid "" " x: int = 15" msgstr "" -#: ../../library/dataclasses.rst:660 +#: ../../library/dataclasses.rst:662 #, fuzzy msgid "" "The final list of fields is, in order, :attr:`!x`, :attr:`!y`, :attr:`!z`. " @@ -1207,23 +1213,23 @@ msgstr "" "最終的欄位列表按順序為 :attr:`!x`、:attr:`!y`、:attr:`!z`。:attr:`!x` 的最終" "型別是 :class:`int`,如類別 :class:`!C` 中指定的那樣。" -#: ../../library/dataclasses.rst:663 +#: ../../library/dataclasses.rst:665 #, fuzzy msgid "" "The generated :meth:`~object.__init__` method for :class:`!C` will look " "like::" msgstr "為 :class:`!C` 生成的 :meth:`~object.__init__` 方法將如下所示: ::" -#: ../../library/dataclasses.rst:665 +#: ../../library/dataclasses.rst:667 msgid "def __init__(self, x: int = 15, y: int = 0, z: int = 10):" msgstr "" -#: ../../library/dataclasses.rst:668 +#: ../../library/dataclasses.rst:670 #, fuzzy msgid "Re-ordering of keyword-only parameters in :meth:`!__init__`" msgstr ":meth:`!__init__` 中僅關鍵字參數的重新排序" -#: ../../library/dataclasses.rst:670 +#: ../../library/dataclasses.rst:672 #, fuzzy msgid "" "After the parameters needed for :meth:`~object.__init__` are computed, any " @@ -1235,7 +1241,7 @@ msgstr "" "僅關鍵字)參數之後。這是如何在 Python 中實作僅關鍵字參數的要求:它們必須位於" "非僅關鍵字參數之後。" -#: ../../library/dataclasses.rst:676 +#: ../../library/dataclasses.rst:678 #, fuzzy msgid "" "In this example, :attr:`!Base.y`, :attr:`!Base.w`, and :attr:`!D.t` are " @@ -1245,7 +1251,7 @@ msgstr "" "在此示例中,:attr:`!Base.y`、:attr:`!Base.w` 和 :attr:`!D.t` 是僅限關鍵字的欄" "位,:attr:`!Base.x` 和 :attr:`!D.z` 是常規欄位: ::" -#: ../../library/dataclasses.rst:679 +#: ../../library/dataclasses.rst:681 msgid "" "@dataclass\n" "class Base:\n" @@ -1260,18 +1266,18 @@ msgid "" " t: int = field(kw_only=True, default=0)" msgstr "" -#: ../../library/dataclasses.rst:691 +#: ../../library/dataclasses.rst:693 #, fuzzy msgid "The generated :meth:`!__init__` method for :class:`!D` will look like::" msgstr "為 :class:`!D` 生成的 :meth:`!__init__` 方法將如下所示: ::" -#: ../../library/dataclasses.rst:693 +#: ../../library/dataclasses.rst:695 msgid "" "def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: " "int = 0):" msgstr "" -#: ../../library/dataclasses.rst:695 +#: ../../library/dataclasses.rst:697 #, fuzzy msgid "" "Note that the parameters have been re-ordered from how they appear in the " @@ -1281,18 +1287,18 @@ msgstr "" "請注意,參數已根據它們在欄位列表中的顯示方式重新排序:從常規欄位派生的參數後" "跟從僅關鍵字欄位派生的參數。" -#: ../../library/dataclasses.rst:699 +#: ../../library/dataclasses.rst:701 #, fuzzy msgid "" "The relative ordering of keyword-only parameters is maintained in the re-" "ordered :meth:`!__init__` parameter list." msgstr "僅關鍵字參數的相對順序在重新排序的 :meth:`!__init__` 參數列表中維護。" -#: ../../library/dataclasses.rst:704 +#: ../../library/dataclasses.rst:706 msgid "Default factory functions" msgstr "預設工廠函式" -#: ../../library/dataclasses.rst:706 +#: ../../library/dataclasses.rst:708 #, fuzzy msgid "" "If a :func:`field` specifies a *default_factory*, it is called with zero " @@ -1302,11 +1308,11 @@ msgstr "" "如果 :func:`field` 指定了 *default_factory*,當需要該欄位的預設值時,它會以零" "引數呼叫。例如,要建立列表的新實例,請使用: ::" -#: ../../library/dataclasses.rst:710 +#: ../../library/dataclasses.rst:712 msgid "mylist: list = field(default_factory=list)" msgstr "" -#: ../../library/dataclasses.rst:712 +#: ../../library/dataclasses.rst:714 #, fuzzy msgid "" "If a field is excluded from :meth:`~object.__init__` (using ``init=False``) " @@ -1319,11 +1325,11 @@ msgstr "" "位還指定了 ``default_factory``,那麼預設工廠函式將始終從生成的 :meth:" "`__init__ 中呼叫`功能。發生這種情況是因為沒有其他方法可以為該欄位賦予初始值。" -#: ../../library/dataclasses.rst:719 +#: ../../library/dataclasses.rst:721 msgid "Mutable default values" msgstr "可變預設值" -#: ../../library/dataclasses.rst:721 +#: ../../library/dataclasses.rst:723 #, fuzzy msgid "" "Python stores default member variable values in class attributes. Consider " @@ -1331,7 +1337,7 @@ msgid "" msgstr "" "Python 將預設成員變數值存儲在類別屬性中。考慮這個例子,不使用資料類別: ::" -#: ../../library/dataclasses.rst:724 +#: ../../library/dataclasses.rst:726 msgid "" "class C:\n" " x = []\n" @@ -1346,7 +1352,7 @@ msgid "" "assert o1.x is o2.x" msgstr "" -#: ../../library/dataclasses.rst:736 +#: ../../library/dataclasses.rst:738 #, fuzzy msgid "" "Note that the two instances of class :class:`!C` share the same class " @@ -1355,12 +1361,12 @@ msgstr "" "請注意,類別 :class:`!C` 的兩個實例共享同一個類別變數 :attr:`!x`,正如預期的" "那樣。" -#: ../../library/dataclasses.rst:739 +#: ../../library/dataclasses.rst:741 #, fuzzy msgid "Using dataclasses, *if* this code was valid::" msgstr "使用資料類別,*如果*此程式碼有效: ::" -#: ../../library/dataclasses.rst:741 +#: ../../library/dataclasses.rst:743 msgid "" "@dataclass\n" "class D:\n" @@ -1369,11 +1375,11 @@ msgid "" " self.x.append(element)" msgstr "" -#: ../../library/dataclasses.rst:747 +#: ../../library/dataclasses.rst:749 msgid "it would generate code similar to::" msgstr "它會生成類似的程式碼: ::" -#: ../../library/dataclasses.rst:749 +#: ../../library/dataclasses.rst:751 msgid "" "class D:\n" " x = []\n" @@ -1385,7 +1391,7 @@ msgid "" "assert D().x is D().x" msgstr "" -#: ../../library/dataclasses.rst:758 +#: ../../library/dataclasses.rst:760 #, fuzzy msgid "" "This has the same issue as the original example using class :class:`!C`. " @@ -1405,14 +1411,14 @@ msgstr "" "到不可散列的預設參數,它將引發 :exc:`TypeError`。假設是如果一個值是不可散列" "的,那麼它就是可變的。這是一個部分解決方案,但它確實可以防止許多常見錯誤。" -#: ../../library/dataclasses.rst:769 +#: ../../library/dataclasses.rst:771 #, fuzzy msgid "" "Using default factory functions is a way to create new instances of mutable " "types as default values for fields::" msgstr "使用預設工廠函式是一種建立可變型別的新實例作為欄位預設值的方法: ::" -#: ../../library/dataclasses.rst:772 +#: ../../library/dataclasses.rst:774 msgid "" "@dataclass\n" "class D:\n" @@ -1421,7 +1427,7 @@ msgid "" "assert D().x is not D().x" msgstr "" -#: ../../library/dataclasses.rst:778 +#: ../../library/dataclasses.rst:780 #, fuzzy msgid "" "Instead of looking for and disallowing objects of type :class:`list`, :class:" @@ -1431,12 +1437,12 @@ msgstr "" "不再查找和禁止型別為 :class:`list`、:class:`dict` 或 :class:`set` 的物件,現" "在不允許使用不可散列的對像作為預設值。不可散列性用於近似可變性。" -#: ../../library/dataclasses.rst:785 +#: ../../library/dataclasses.rst:787 #, fuzzy msgid "Descriptor-typed fields" msgstr "描述器型別的欄位" -#: ../../library/dataclasses.rst:787 +#: ../../library/dataclasses.rst:789 #, fuzzy msgid "" "Fields that are assigned :ref:`descriptor objects ` as their " @@ -1444,7 +1450,7 @@ msgid "" msgstr "" "指定為\\ :ref:`描述器物件 `\\ 作為預設值的欄位具有以下特殊行為:" -#: ../../library/dataclasses.rst:790 +#: ../../library/dataclasses.rst:792 #, fuzzy msgid "" "The value for the field passed to the dataclass's :meth:`~object.__init__` " @@ -1454,7 +1460,7 @@ msgstr "" "傳遞給資料類別的 :meth:`~object.__init__` 方法的欄位值被傳遞給描述器的 :meth:" "`~object.__set__` 方法,而不是覆蓋描述器物件。" -#: ../../library/dataclasses.rst:794 +#: ../../library/dataclasses.rst:796 #, fuzzy msgid "" "Similarly, when getting or setting the field, the descriptor's :meth:" @@ -1464,7 +1470,7 @@ msgstr "" "同樣,在獲取或設定欄位時,將呼叫描述器的 :meth:`~object.__get__` 或 :meth:`!" "__set__` 方法,而不是回傳或覆蓋描述器物件。" -#: ../../library/dataclasses.rst:798 +#: ../../library/dataclasses.rst:800 #, fuzzy msgid "" "To determine whether a field contains a default value, :func:`@dataclass " @@ -1480,7 +1486,7 @@ msgstr "" "面,如果描述器在這種情況下引發 :exc:`AttributeError`,則不會為該欄位提供預設" "值。" -#: ../../library/dataclasses.rst:808 +#: ../../library/dataclasses.rst:810 msgid "" "class IntConversionDescriptor:\n" " def __init__(self, *, default):\n" @@ -1509,7 +1515,7 @@ msgid "" "print(i.quantity_on_hand) # 2" msgstr "" -#: ../../library/dataclasses.rst:833 +#: ../../library/dataclasses.rst:835 #, fuzzy msgid "" "Note that if a field is annotated with a descriptor type, but is not " diff --git a/library/datetime.po b/library/datetime.po index f6c272b6dd..886165ae86 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-08-07 10:20+0800\n" "Last-Translator: Griiid \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -423,8 +423,8 @@ msgstr "" "(-1, 86399, 999999)" #: ../../library/datetime.rst:265 ../../library/datetime.rst:552 -#: ../../library/datetime.rst:1071 ../../library/datetime.rst:1702 -#: ../../library/datetime.rst:2304 +#: ../../library/datetime.rst:1108 ../../library/datetime.rst:1746 +#: ../../library/datetime.rst:2351 msgid "Class attributes:" msgstr "類別屬性:" @@ -452,7 +452,7 @@ msgid "" msgstr "" #: ../../library/datetime.rst:287 ../../library/datetime.rst:570 -#: ../../library/datetime.rst:1091 ../../library/datetime.rst:1722 +#: ../../library/datetime.rst:1128 ../../library/datetime.rst:1766 msgid "Instance attributes (read-only):" msgstr "" @@ -469,17 +469,17 @@ msgid "Between 0 and 999,999 inclusive." msgstr "在 0 到 999,999 (含)之間" #: ../../library/datetime.rst:304 ../../library/datetime.rst:587 -#: ../../library/datetime.rst:1144 +#: ../../library/datetime.rst:1181 msgid "Supported operations:" msgstr "" #: ../../library/datetime.rst:309 ../../library/datetime.rst:590 -#: ../../library/datetime.rst:1147 +#: ../../library/datetime.rst:1184 msgid "Operation" msgstr "" #: ../../library/datetime.rst:309 ../../library/datetime.rst:590 -#: ../../library/datetime.rst:1147 +#: ../../library/datetime.rst:1184 msgid "Result" msgstr "" @@ -624,7 +624,7 @@ msgid "" msgstr "" #: ../../library/datetime.rst:370 ../../library/datetime.rst:609 -#: ../../library/datetime.rst:2535 +#: ../../library/datetime.rst:2582 msgid "Notes:" msgstr "註解:" @@ -695,8 +695,8 @@ msgid "" "and only if it isn't equal to ``timedelta(0)``." msgstr "" -#: ../../library/datetime.rst:414 ../../library/datetime.rst:635 -#: ../../library/datetime.rst:1230 ../../library/datetime.rst:1829 +#: ../../library/datetime.rst:414 ../../library/datetime.rst:651 +#: ../../library/datetime.rst:1271 ../../library/datetime.rst:1873 msgid "Instance methods:" msgstr "實例方法:" @@ -803,12 +803,12 @@ msgstr "``1 <= month <= 12``" msgid "``1 <= day <= number of days in the given month and year``" msgstr "" -#: ../../library/datetime.rst:479 ../../library/datetime.rst:850 +#: ../../library/datetime.rst:479 ../../library/datetime.rst:869 msgid "" "If an argument outside those ranges is given, :exc:`ValueError` is raised." msgstr "" -#: ../../library/datetime.rst:482 ../../library/datetime.rst:855 +#: ../../library/datetime.rst:482 ../../library/datetime.rst:874 msgid "Other constructors, all class methods:" msgstr "" @@ -862,23 +862,23 @@ msgid "" "ISO 8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:524 ../../library/datetime.rst:1011 +#: ../../library/datetime.rst:524 ../../library/datetime.rst:1030 msgid "" "Reduced precision dates are not currently supported (``YYYY-MM``, ``YYYY``)." msgstr "" -#: ../../library/datetime.rst:526 ../../library/datetime.rst:1013 +#: ../../library/datetime.rst:526 ../../library/datetime.rst:1032 msgid "" "Extended date representations are not currently supported (``±YYYYYY-MM-" "DD``)." msgstr "" -#: ../../library/datetime.rst:528 ../../library/datetime.rst:1015 +#: ../../library/datetime.rst:528 ../../library/datetime.rst:1034 msgid "Ordinal dates are not currently supported (``YYYY-OOO``)." msgstr "" -#: ../../library/datetime.rst:530 ../../library/datetime.rst:1017 -#: ../../library/datetime.rst:1458 +#: ../../library/datetime.rst:530 ../../library/datetime.rst:1036 +#: ../../library/datetime.rst:1502 msgid "Examples::" msgstr "範例: ::" @@ -925,15 +925,15 @@ msgid "" "``timedelta(days=1)``." msgstr "" -#: ../../library/datetime.rst:574 ../../library/datetime.rst:1095 +#: ../../library/datetime.rst:574 ../../library/datetime.rst:1132 msgid "Between :const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -#: ../../library/datetime.rst:579 ../../library/datetime.rst:1100 +#: ../../library/datetime.rst:579 ../../library/datetime.rst:1137 msgid "Between 1 and 12 inclusive." msgstr "在 1 到 12 (含)之間。" -#: ../../library/datetime.rst:584 ../../library/datetime.rst:1105 +#: ../../library/datetime.rst:584 ../../library/datetime.rst:1142 msgid "Between 1 and the number of days in the given month of the given year." msgstr "" @@ -957,7 +957,7 @@ msgstr "" msgid "``timedelta = date1 - date2``" msgstr "``timedelta = date1 - date2``" -#: ../../library/datetime.rst:598 ../../library/datetime.rst:1153 +#: ../../library/datetime.rst:598 ../../library/datetime.rst:1190 msgid "\\(3)" msgstr "\\(3)" @@ -969,7 +969,7 @@ msgstr "``date1 == date2``" msgid "``date1 != date2``" msgstr "``date1 != date2``" -#: ../../library/datetime.rst:600 ../../library/datetime.rst:1155 +#: ../../library/datetime.rst:600 ../../library/datetime.rst:1192 msgid "Equality comparison. (4)" msgstr "" @@ -989,7 +989,7 @@ msgstr "``date1 <= date2``" msgid "``date1 >= date2``" msgstr "``date1 >= date2``" -#: ../../library/datetime.rst:603 ../../library/datetime.rst:1158 +#: ../../library/datetime.rst:603 ../../library/datetime.rst:1195 msgid "Order comparison. (5)" msgstr "" @@ -1016,29 +1016,51 @@ msgstr "" msgid ":class:`date` objects are equal if they represent the same date." msgstr "" -#: ../../library/datetime.rst:629 +#: ../../library/datetime.rst:628 +msgid "" +":class:`!date` objects that are not also :class:`.datetime` instances are " +"never equal to :class:`!datetime` objects, even if they represent the same " +"date." +msgstr "" + +#: ../../library/datetime.rst:633 msgid "" "*date1* is considered less than *date2* when *date1* precedes *date2* in " "time. In other words, ``date1 < date2`` if and only if ``date1.toordinal() < " "date2.toordinal()``." msgstr "" -#: ../../library/datetime.rst:633 +#: ../../library/datetime.rst:637 +msgid "" +"Order comparison between a :class:`!date` object that is not also a :class:`." +"datetime` instance and a :class:`!datetime` object raises :exc:`TypeError`." +msgstr "" + +#: ../../library/datetime.rst:641 ../../library/datetime.rst:1263 +msgid "" +"Comparison between :class:`.datetime` object and an instance of the :class:" +"`date` subclass that is not a :class:`!datetime` subclass no longer converts " +"the latter to :class:`!date`, ignoring the time part and the time zone. The " +"default behavior can be changed by overriding the special comparison methods " +"in subclasses." +msgstr "" + +#: ../../library/datetime.rst:649 msgid "" "In Boolean contexts, all :class:`date` objects are considered to be true." msgstr "" -#: ../../library/datetime.rst:639 +#: ../../library/datetime.rst:655 msgid "" "Return a date with the same value, except for those parameters given new " "values by whichever keyword arguments are specified." msgstr "" -#: ../../library/datetime.rst:642 ../../library/datetime.rst:1872 +#: ../../library/datetime.rst:658 ../../library/datetime.rst:1919 msgid "Example::" msgstr "範例: ::" -#: ../../library/datetime.rst:644 +#: ../../library/datetime.rst:660 msgid "" ">>> from datetime import date\n" ">>> d = date(2002, 12, 31)\n" @@ -1050,41 +1072,47 @@ msgstr "" ">>> d.replace(day=26)\n" "datetime.date(2002, 12, 26)" -#: ../../library/datetime.rst:652 ../../library/datetime.rst:1343 +#: ../../library/datetime.rst:665 +msgid "" +":class:`date` objects are also supported by generic function :func:`copy." +"replace`." +msgstr "" + +#: ../../library/datetime.rst:671 ../../library/datetime.rst:1387 msgid "" "Return a :class:`time.struct_time` such as returned by :func:`time." "localtime`." msgstr "" "回傳一個 :class:`time.struct_time`,如同 :func:`time.localtime` 所回傳。" -#: ../../library/datetime.rst:654 +#: ../../library/datetime.rst:673 msgid "The hours, minutes and seconds are 0, and the DST flag is -1." msgstr "" -#: ../../library/datetime.rst:656 ../../library/datetime.rst:1345 +#: ../../library/datetime.rst:675 ../../library/datetime.rst:1389 msgid "``d.timetuple()`` is equivalent to::" msgstr "``d.timetuple()`` 等價於: ::" -#: ../../library/datetime.rst:658 +#: ../../library/datetime.rst:677 msgid "" "time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))" msgstr "" "time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))" -#: ../../library/datetime.rst:660 +#: ../../library/datetime.rst:679 msgid "" "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " "day number within the current year starting with 1 for January 1st." msgstr "" -#: ../../library/datetime.rst:666 +#: ../../library/datetime.rst:685 msgid "" "Return the proleptic Gregorian ordinal of the date, where January 1 of year " "1 has ordinal 1. For any :class:`date` object *d*, ``date.fromordinal(d." "toordinal()) == d``." msgstr "" -#: ../../library/datetime.rst:673 +#: ../../library/datetime.rst:692 msgid "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " "For example, ``date(2002, 12, 4).weekday() == 2``, a Wednesday. See also :" @@ -1093,25 +1121,25 @@ msgstr "" "回傳一個代表星期幾的整數,星期一為 0、星期日為 6。例如 ``date(2002, 12, 4)." "weekday() == 2`` 為星期三。也請參考 :meth:`isoweekday`。" -#: ../../library/datetime.rst:680 +#: ../../library/datetime.rst:699 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " "For example, ``date(2002, 12, 4).isoweekday() == 3``, a Wednesday. See also :" "meth:`weekday`, :meth:`isocalendar`." msgstr "" -#: ../../library/datetime.rst:687 +#: ../../library/datetime.rst:706 msgid "" "Return a :term:`named tuple` object with three components: ``year``, " "``week`` and ``weekday``." msgstr "" -#: ../../library/datetime.rst:690 +#: ../../library/datetime.rst:709 msgid "" "The ISO calendar is a widely used variant of the Gregorian calendar. [#]_" msgstr "" -#: ../../library/datetime.rst:692 +#: ../../library/datetime.rst:711 msgid "" "The ISO year consists of 52 or 53 full weeks, and where a week starts on a " "Monday and ends on a Sunday. The first week of an ISO year is the first " @@ -1120,13 +1148,13 @@ msgid "" "Gregorian year." msgstr "" -#: ../../library/datetime.rst:697 +#: ../../library/datetime.rst:716 msgid "" "For example, 2004 begins on a Thursday, so the first week of ISO year 2004 " "begins on Monday, 29 Dec 2003 and ends on Sunday, 4 Jan 2004::" msgstr "" -#: ../../library/datetime.rst:700 +#: ../../library/datetime.rst:719 msgid "" ">>> from datetime import date\n" ">>> date(2003, 12, 29).isocalendar()\n" @@ -1140,16 +1168,16 @@ msgstr "" ">>> date(2004, 1, 4).isocalendar()\n" "datetime.IsoCalendarDate(year=2004, week=1, weekday=7)" -#: ../../library/datetime.rst:706 +#: ../../library/datetime.rst:725 msgid "Result changed from a tuple to a :term:`named tuple`." msgstr "" -#: ../../library/datetime.rst:711 +#: ../../library/datetime.rst:730 msgid "" "Return a string representing the date in ISO 8601 format, ``YYYY-MM-DD``::" msgstr "回傳一以 ISO 8601 格式 ``YYYY-MM-DD`` 表示的日期字串: ::" -#: ../../library/datetime.rst:713 +#: ../../library/datetime.rst:732 msgid "" ">>> from datetime import date\n" ">>> date(2002, 12, 4).isoformat()\n" @@ -1159,15 +1187,15 @@ msgstr "" ">>> date(2002, 12, 4).isoformat()\n" "'2002-12-04'" -#: ../../library/datetime.rst:719 +#: ../../library/datetime.rst:738 msgid "For a date *d*, ``str(d)`` is equivalent to ``d.isoformat()``." msgstr "" -#: ../../library/datetime.rst:724 +#: ../../library/datetime.rst:743 msgid "Return a string representing the date::" msgstr "" -#: ../../library/datetime.rst:726 +#: ../../library/datetime.rst:745 msgid "" ">>> from datetime import date\n" ">>> date(2002, 12, 4).ctime()\n" @@ -1177,22 +1205,22 @@ msgstr "" ">>> date(2002, 12, 4).ctime()\n" "'Wed Dec 4 00:00:00 2002'" -#: ../../library/datetime.rst:730 ../../library/datetime.rst:1529 +#: ../../library/datetime.rst:749 ../../library/datetime.rst:1573 msgid "``d.ctime()`` is equivalent to::" msgstr "``d.ctime()`` 等價於: ::" -#: ../../library/datetime.rst:732 ../../library/datetime.rst:1531 +#: ../../library/datetime.rst:751 ../../library/datetime.rst:1575 msgid "time.ctime(time.mktime(d.timetuple()))" msgstr "time.ctime(time.mktime(d.timetuple()))" -#: ../../library/datetime.rst:734 +#: ../../library/datetime.rst:753 msgid "" "on platforms where the native C :c:func:`ctime` function (which :func:`time." "ctime` invokes, but which :meth:`date.ctime` does not invoke) conforms to " "the C standard." msgstr "" -#: ../../library/datetime.rst:741 +#: ../../library/datetime.rst:760 msgid "" "Return a string representing the date, controlled by an explicit format " "string. Format codes referring to hours, minutes or seconds will see 0 " @@ -1200,7 +1228,7 @@ msgid "" "isoformat`." msgstr "" -#: ../../library/datetime.rst:748 +#: ../../library/datetime.rst:767 msgid "" "Same as :meth:`.date.strftime`. This makes it possible to specify a format " "string for a :class:`.date` object in :ref:`formatted string literals >> import time\n" ">>> from datetime import date\n" @@ -1252,11 +1280,11 @@ msgstr "" ">>> time_to_birthday.days\n" "202" -#: ../../library/datetime.rst:775 +#: ../../library/datetime.rst:794 msgid "More examples of working with :class:`date`:" msgstr "更多 :class:`date` 的用法範例:" -#: ../../library/datetime.rst:777 +#: ../../library/datetime.rst:796 msgid "" ">>> from datetime import date\n" ">>> d = date.fromordinal(730920) # 730920th day after 1. 1. 0001\n" @@ -1300,17 +1328,17 @@ msgid "" "datetime.date(2005, 3, 11)" msgstr "" -#: ../../library/datetime.rst:824 +#: ../../library/datetime.rst:843 msgid ":class:`.datetime` Objects" msgstr ":class:`.datetime` 物件" -#: ../../library/datetime.rst:826 +#: ../../library/datetime.rst:845 msgid "" "A :class:`.datetime` object is a single object containing all the " "information from a :class:`date` object and a :class:`.time` object." msgstr "" -#: ../../library/datetime.rst:829 +#: ../../library/datetime.rst:848 msgid "" "Like a :class:`date` object, :class:`.datetime` assumes the current " "Gregorian calendar extended in both directions; like a :class:`.time` " @@ -1318,81 +1346,81 @@ msgid "" "every day." msgstr "" -#: ../../library/datetime.rst:833 +#: ../../library/datetime.rst:852 msgid "Constructor:" msgstr "" -#: ../../library/datetime.rst:837 +#: ../../library/datetime.rst:856 msgid "" "The *year*, *month* and *day* arguments are required. *tzinfo* may be " "``None``, or an instance of a :class:`tzinfo` subclass. The remaining " "arguments must be integers in the following ranges:" msgstr "" -#: ../../library/datetime.rst:841 +#: ../../library/datetime.rst:860 msgid "``MINYEAR <= year <= MAXYEAR``," msgstr "``MINYEAR <= year <= MAXYEAR``," -#: ../../library/datetime.rst:842 +#: ../../library/datetime.rst:861 msgid "``1 <= month <= 12``," msgstr "``1 <= month <= 12``," -#: ../../library/datetime.rst:843 +#: ../../library/datetime.rst:862 msgid "``1 <= day <= number of days in the given month and year``," msgstr "" -#: ../../library/datetime.rst:844 ../../library/datetime.rst:1693 +#: ../../library/datetime.rst:863 ../../library/datetime.rst:1737 msgid "``0 <= hour < 24``," msgstr "``0 <= hour < 24``," -#: ../../library/datetime.rst:845 ../../library/datetime.rst:1694 +#: ../../library/datetime.rst:864 ../../library/datetime.rst:1738 msgid "``0 <= minute < 60``," msgstr "``0 <= minute < 60``," -#: ../../library/datetime.rst:846 ../../library/datetime.rst:1695 +#: ../../library/datetime.rst:865 ../../library/datetime.rst:1739 msgid "``0 <= second < 60``," msgstr "``0 <= second < 60``," -#: ../../library/datetime.rst:847 ../../library/datetime.rst:1696 +#: ../../library/datetime.rst:866 ../../library/datetime.rst:1740 msgid "``0 <= microsecond < 1000000``," msgstr "``0 <= microsecond < 1000000``," -#: ../../library/datetime.rst:848 ../../library/datetime.rst:1697 +#: ../../library/datetime.rst:867 ../../library/datetime.rst:1741 msgid "``fold in [0, 1]``." msgstr "" -#: ../../library/datetime.rst:852 ../../library/datetime.rst:1264 -#: ../../library/datetime.rst:1839 +#: ../../library/datetime.rst:871 ../../library/datetime.rst:1308 +#: ../../library/datetime.rst:1886 msgid "Added the *fold* parameter." msgstr "新增 *fold* 參數。" -#: ../../library/datetime.rst:859 +#: ../../library/datetime.rst:878 msgid "Return the current local date and time, with :attr:`.tzinfo` ``None``." msgstr "回傳目前的本地日期與時間,且 :attr:`.tzinfo` 為 ``None``。" -#: ../../library/datetime.rst:861 +#: ../../library/datetime.rst:880 msgid "Equivalent to::" msgstr "等價於: ::" -#: ../../library/datetime.rst:863 +#: ../../library/datetime.rst:882 msgid "datetime.fromtimestamp(time.time())" msgstr "datetime.fromtimestamp(time.time())" -#: ../../library/datetime.rst:865 +#: ../../library/datetime.rst:884 msgid "See also :meth:`now`, :meth:`fromtimestamp`." msgstr "也請見 :meth:`now`、:meth:`fromtimestamp`。" -#: ../../library/datetime.rst:867 +#: ../../library/datetime.rst:886 msgid "" "This method is functionally equivalent to :meth:`now`, but without a ``tz`` " "parameter." msgstr "" -#: ../../library/datetime.rst:872 +#: ../../library/datetime.rst:891 msgid "Return the current local date and time." msgstr "" -#: ../../library/datetime.rst:874 +#: ../../library/datetime.rst:893 msgid "" "If optional argument *tz* is ``None`` or not specified, this is like :meth:" "`today`, but, if possible, supplies more precision than can be gotten from " @@ -1403,28 +1431,28 @@ msgstr "" "供比透過 :func:`time.time` 取得的時間戳記更多位數的資訊(例如,這在有提供 C :" "c:func:`gettimeofday` 函式的平台上可能可行)。" -#: ../../library/datetime.rst:880 +#: ../../library/datetime.rst:899 msgid "" "If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` " "subclass, and the current date and time are converted to *tz*’s time zone." msgstr "" -#: ../../library/datetime.rst:883 +#: ../../library/datetime.rst:902 msgid "This function is preferred over :meth:`today` and :meth:`utcnow`." msgstr "" -#: ../../library/datetime.rst:888 +#: ../../library/datetime.rst:907 msgid "Return the current UTC date and time, with :attr:`.tzinfo` ``None``." msgstr "" -#: ../../library/datetime.rst:890 +#: ../../library/datetime.rst:909 msgid "" "This is like :meth:`now`, but returns the current UTC date and time, as a " "naive :class:`.datetime` object. An aware current UTC datetime can be " "obtained by calling ``datetime.now(timezone.utc)``. See also :meth:`now`." msgstr "" -#: ../../library/datetime.rst:896 +#: ../../library/datetime.rst:915 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -1432,11 +1460,11 @@ msgid "" "current time in UTC is by calling ``datetime.now(timezone.utc)``." msgstr "" -#: ../../library/datetime.rst:903 +#: ../../library/datetime.rst:922 msgid "Use :meth:`datetime.now` with :attr:`UTC` instead." msgstr "" -#: ../../library/datetime.rst:908 +#: ../../library/datetime.rst:927 msgid "" "Return the local date and time corresponding to the POSIX timestamp, such as " "is returned by :func:`time.time`. If optional argument *tz* is ``None`` or " @@ -1444,13 +1472,13 @@ msgid "" "time, and the returned :class:`.datetime` object is naive." msgstr "" -#: ../../library/datetime.rst:913 +#: ../../library/datetime.rst:932 msgid "" "If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` " "subclass, and the timestamp is converted to *tz*’s time zone." msgstr "" -#: ../../library/datetime.rst:916 +#: ../../library/datetime.rst:935 msgid "" ":meth:`fromtimestamp` may raise :exc:`OverflowError`, if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -1463,7 +1491,7 @@ msgid "" "preferred over :meth:`utcfromtimestamp`." msgstr "" -#: ../../library/datetime.rst:927 +#: ../../library/datetime.rst:946 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -1471,17 +1499,17 @@ msgid "" "`ValueError` on :c:func:`localtime` or :c:func:`gmtime` failure." msgstr "" -#: ../../library/datetime.rst:934 +#: ../../library/datetime.rst:953 msgid ":meth:`fromtimestamp` may return instances with :attr:`.fold` set to 1." msgstr "" -#: ../../library/datetime.rst:939 +#: ../../library/datetime.rst:958 msgid "" "Return the UTC :class:`.datetime` corresponding to the POSIX timestamp, " "with :attr:`.tzinfo` ``None``. (The resulting object is naive.)" msgstr "" -#: ../../library/datetime.rst:942 +#: ../../library/datetime.rst:961 msgid "" "This may raise :exc:`OverflowError`, if the timestamp is out of the range of " "values supported by the platform C :c:func:`gmtime` function, and :exc:" @@ -1489,33 +1517,33 @@ msgid "" "to years in 1970 through 2038." msgstr "" -#: ../../library/datetime.rst:947 +#: ../../library/datetime.rst:966 msgid "To get an aware :class:`.datetime` object, call :meth:`fromtimestamp`::" msgstr "" -#: ../../library/datetime.rst:949 +#: ../../library/datetime.rst:968 msgid "datetime.fromtimestamp(timestamp, timezone.utc)" msgstr "datetime.fromtimestamp(timestamp, timezone.utc)" -#: ../../library/datetime.rst:951 +#: ../../library/datetime.rst:970 msgid "" "On the POSIX compliant platforms, it is equivalent to the following " "expression::" msgstr "" -#: ../../library/datetime.rst:954 +#: ../../library/datetime.rst:973 msgid "" "datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" msgstr "" "datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" -#: ../../library/datetime.rst:956 +#: ../../library/datetime.rst:975 msgid "" "except the latter formula always supports the full years range: between :" "const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -#: ../../library/datetime.rst:961 +#: ../../library/datetime.rst:980 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -1524,7 +1552,7 @@ msgid "" "tz=timezone.utc)``." msgstr "" -#: ../../library/datetime.rst:967 +#: ../../library/datetime.rst:986 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`gmtime` " @@ -1532,11 +1560,11 @@ msgid "" "`gmtime` failure." msgstr "" -#: ../../library/datetime.rst:975 +#: ../../library/datetime.rst:994 msgid "Use :meth:`datetime.fromtimestamp` with :attr:`UTC` instead." msgstr "" -#: ../../library/datetime.rst:980 +#: ../../library/datetime.rst:999 msgid "" "Return the :class:`.datetime` corresponding to the proleptic Gregorian " "ordinal, where January 1 of year 1 has ordinal 1. :exc:`ValueError` is " @@ -1545,7 +1573,7 @@ msgid "" "is ``None``." msgstr "" -#: ../../library/datetime.rst:988 +#: ../../library/datetime.rst:1007 msgid "" "Return a new :class:`.datetime` object whose date components are equal to " "the given :class:`date` object's, and whose time components are equal to the " @@ -1556,35 +1584,35 @@ msgid "" "attr:`.tzinfo` attributes are ignored." msgstr "" -#: ../../library/datetime.rst:996 +#: ../../library/datetime.rst:1015 msgid "" "For any :class:`.datetime` object *d*, ``d == datetime.combine(d.date(), d." "time(), d.tzinfo)``." msgstr "" -#: ../../library/datetime.rst:999 +#: ../../library/datetime.rst:1018 msgid "Added the *tzinfo* argument." msgstr "新增 *tzinfo* 引數。" -#: ../../library/datetime.rst:1005 +#: ../../library/datetime.rst:1024 msgid "" "Return a :class:`.datetime` corresponding to a *date_string* in any valid " "ISO 8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:1008 ../../library/datetime.rst:1793 +#: ../../library/datetime.rst:1027 ../../library/datetime.rst:1837 msgid "Time zone offsets may have fractional seconds." msgstr "" -#: ../../library/datetime.rst:1009 +#: ../../library/datetime.rst:1028 msgid "The ``T`` separator may be replaced by any single unicode character." msgstr "" -#: ../../library/datetime.rst:1010 ../../library/datetime.rst:1798 +#: ../../library/datetime.rst:1029 ../../library/datetime.rst:1842 msgid "Fractional hours and minutes are not supported." msgstr "" -#: ../../library/datetime.rst:1019 +#: ../../library/datetime.rst:1038 msgid "" ">>> from datetime import datetime\n" ">>> datetime.fromisoformat('2011-11-04')\n" @@ -1630,13 +1658,13 @@ msgstr "" "datetime.datetime(2011, 11, 4, 0, 5, 23,\n" " tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))" -#: ../../library/datetime.rst:1041 +#: ../../library/datetime.rst:1060 msgid "" "Previously, this method only supported formats that could be emitted by :" "meth:`date.isoformat` or :meth:`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1048 +#: ../../library/datetime.rst:1067 msgid "" "Return a :class:`.datetime` corresponding to the ISO calendar date specified " "by year, week and day. The non-date components of the datetime are populated " @@ -1644,23 +1672,23 @@ msgid "" "`datetime.isocalendar`." msgstr "" -#: ../../library/datetime.rst:1057 +#: ../../library/datetime.rst:1076 msgid "" "Return a :class:`.datetime` corresponding to *date_string*, parsed according " "to *format*." msgstr "" -#: ../../library/datetime.rst:1060 +#: ../../library/datetime.rst:1079 msgid "" "If *format* does not contain microseconds or time zone information, this is " "equivalent to::" msgstr "" -#: ../../library/datetime.rst:1062 ../../library/datetime.rst:2515 +#: ../../library/datetime.rst:1081 ../../library/datetime.rst:2562 msgid "datetime(*(time.strptime(date_string, format)[0:6]))" msgstr "datetime(*(time.strptime(date_string, format)[0:6]))" -#: ../../library/datetime.rst:1064 +#: ../../library/datetime.rst:1083 msgid "" ":exc:`ValueError` is raised if the date_string and format can't be parsed " "by :func:`time.strptime` or if it returns a value which isn't a time tuple. " @@ -1668,44 +1696,65 @@ msgid "" "fromisoformat`." msgstr "" -#: ../../library/datetime.rst:1075 +#: ../../library/datetime.rst:1090 +msgid "" +"If *format* specifies a day of month without a year a :exc:" +"`DeprecationWarning` is now emitted. This is to avoid a quadrennial leap " +"year bug in code seeking to parse only a month and day as the default year " +"used in absence of one in the format is not a leap year. Such *format* " +"values may raise an error as of Python 3.15. The workaround is to always " +"include a year in your *format*. If parsing *date_string* values that do " +"not have a year, explicitly add a year that is a leap year before parsing:" +msgstr "" + +#: ../../library/datetime.rst:1099 +msgid "" +">>> from datetime import datetime\n" +">>> date_string = \"02/29\"\n" +">>> when = datetime.strptime(f\"{date_string};1984\", \"%m/%d;%Y\") # " +"Avoids leap year bug.\n" +">>> when.strftime(\"%B %d\") \n" +"'February 29'" +msgstr "" + +#: ../../library/datetime.rst:1112 msgid "" "The earliest representable :class:`.datetime`, ``datetime(MINYEAR, 1, 1, " "tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1081 +#: ../../library/datetime.rst:1118 msgid "" "The latest representable :class:`.datetime`, ``datetime(MAXYEAR, 12, 31, 23, " "59, 59, 999999, tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1087 +#: ../../library/datetime.rst:1124 msgid "" "The smallest possible difference between non-equal :class:`.datetime` " "objects, ``timedelta(microseconds=1)``." msgstr "" -#: ../../library/datetime.rst:1110 ../../library/datetime.rst:1726 +#: ../../library/datetime.rst:1147 ../../library/datetime.rst:1770 msgid "In ``range(24)``." msgstr "" -#: ../../library/datetime.rst:1115 ../../library/datetime.rst:1120 -#: ../../library/datetime.rst:1731 ../../library/datetime.rst:1736 +#: ../../library/datetime.rst:1152 ../../library/datetime.rst:1157 +#: ../../library/datetime.rst:1775 ../../library/datetime.rst:1780 msgid "In ``range(60)``." msgstr "" -#: ../../library/datetime.rst:1125 ../../library/datetime.rst:1741 +#: ../../library/datetime.rst:1162 ../../library/datetime.rst:1785 msgid "In ``range(1000000)``." msgstr "" -#: ../../library/datetime.rst:1130 +#: ../../library/datetime.rst:1167 msgid "" "The object passed as the *tzinfo* argument to the :class:`.datetime` " "constructor, or ``None`` if none was passed." msgstr "" -#: ../../library/datetime.rst:1136 ../../library/datetime.rst:1752 +#: ../../library/datetime.rst:1173 ../../library/datetime.rst:1796 msgid "" "In ``[0, 1]``. Used to disambiguate wall times during a repeated interval. " "(A repeated interval occurs when clocks are rolled back at the end of " @@ -1715,26 +1764,26 @@ msgid "" "time representation." msgstr "" -#: ../../library/datetime.rst:1149 +#: ../../library/datetime.rst:1186 msgid "``datetime2 = datetime1 + timedelta``" msgstr "``datetime2 = datetime1 + timedelta``" -#: ../../library/datetime.rst:1149 ../../library/datetime.rst:2362 -#: ../../library/datetime.rst:2367 ../../library/datetime.rst:2379 -#: ../../library/datetime.rst:2384 ../../library/datetime.rst:2444 -#: ../../library/datetime.rst:2449 ../../library/datetime.rst:2453 +#: ../../library/datetime.rst:1186 ../../library/datetime.rst:2409 +#: ../../library/datetime.rst:2414 ../../library/datetime.rst:2426 +#: ../../library/datetime.rst:2431 ../../library/datetime.rst:2491 +#: ../../library/datetime.rst:2496 ../../library/datetime.rst:2500 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/datetime.rst:1151 +#: ../../library/datetime.rst:1188 msgid "``datetime2 = datetime1 - timedelta``" msgstr "``datetime2 = datetime1 - timedelta``" -#: ../../library/datetime.rst:1151 ../../library/datetime.rst:2395 +#: ../../library/datetime.rst:1188 ../../library/datetime.rst:2442 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/datetime.rst:1153 +#: ../../library/datetime.rst:1190 msgid "``timedelta = datetime1 - datetime2``" msgstr "``timedelta = datetime1 - datetime2``" @@ -1762,7 +1811,7 @@ msgstr "``datetime1 <= datetime2``" msgid "``datetime1 >= datetime2``" msgstr "``datetime1 >= datetime2``" -#: ../../library/datetime.rst:1165 +#: ../../library/datetime.rst:1202 msgid "" "``datetime2`` is a duration of ``timedelta`` removed from ``datetime1``, " "moving forward in time if ``timedelta.days > 0``, or backward if ``timedelta." @@ -1773,7 +1822,7 @@ msgid "" "adjustments are done even if the input is an aware object." msgstr "" -#: ../../library/datetime.rst:1174 +#: ../../library/datetime.rst:1211 msgid "" "Computes the ``datetime2`` such that ``datetime2 + timedelta == datetime1``. " "As for addition, the result has the same :attr:`~.datetime.tzinfo` attribute " @@ -1781,14 +1830,14 @@ msgid "" "input is aware." msgstr "" -#: ../../library/datetime.rst:1179 +#: ../../library/datetime.rst:1216 msgid "" "Subtraction of a :class:`.datetime` from a :class:`.datetime` is defined " "only if both operands are naive, or if both are aware. If one is aware and " "the other is naive, :exc:`TypeError` is raised." msgstr "" -#: ../../library/datetime.rst:1183 +#: ../../library/datetime.rst:1220 msgid "" "If both are naive, or both are aware and have the same :attr:`~.datetime." "tzinfo` attribute, the :attr:`~.datetime.tzinfo` attributes are ignored, and " @@ -1796,7 +1845,7 @@ msgid "" "datetime1``. No time zone adjustments are done in this case." msgstr "" -#: ../../library/datetime.rst:1188 +#: ../../library/datetime.rst:1225 msgid "" "If both are aware and have different :attr:`~.datetime.tzinfo` attributes, " "``a-b`` acts as if *a* and *b* were first converted to naive UTC datetimes. " @@ -1805,20 +1854,17 @@ msgid "" "overflows." msgstr "" -#: ../../library/datetime.rst:1194 +#: ../../library/datetime.rst:1231 msgid "" ":class:`.datetime` objects are equal if they represent the same date and " "time, taking into account the time zone." msgstr "" -#: ../../library/datetime.rst:1197 -msgid "" -"Naive and aware :class:`!datetime` objects are never equal. :class:`!" -"datetime` objects are never equal to :class:`date` objects that are not " -"also :class:`!datetime` instances, even if they represent the same date." +#: ../../library/datetime.rst:1234 +msgid "Naive and aware :class:`!datetime` objects are never equal." msgstr "" -#: ../../library/datetime.rst:1202 +#: ../../library/datetime.rst:1236 msgid "" "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " "the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " @@ -1829,20 +1875,19 @@ msgid "" "interval are never equal to :class:`!datetime` instances in other time zone." msgstr "" -#: ../../library/datetime.rst:1212 +#: ../../library/datetime.rst:1246 msgid "" "*datetime1* is considered less than *datetime2* when *datetime1* precedes " "*datetime2* in time, taking into account the time zone." msgstr "" -#: ../../library/datetime.rst:1215 +#: ../../library/datetime.rst:1249 msgid "" -"Order comparison between naive and aware :class:`.datetime` objects, as well " -"as a :class:`!datetime` object and a :class:`!date` object that is not also " -"a :class:`!datetime` instance, raises :exc:`TypeError`." +"Order comparison between naive and aware :class:`.datetime` objects raises :" +"exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1219 +#: ../../library/datetime.rst:1252 msgid "" "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " "the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " @@ -1852,33 +1897,33 @@ msgid "" "implementation never overflows." msgstr "" -#: ../../library/datetime.rst:1226 +#: ../../library/datetime.rst:1259 msgid "" "Equality comparisons between aware and naive :class:`.datetime` instances " "don't raise :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1234 +#: ../../library/datetime.rst:1275 msgid "Return :class:`date` object with same year, month and day." msgstr "" -#: ../../library/datetime.rst:1239 +#: ../../library/datetime.rst:1280 msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond and " "fold. :attr:`.tzinfo` is ``None``. See also method :meth:`timetz`." msgstr "" -#: ../../library/datetime.rst:1242 ../../library/datetime.rst:1251 +#: ../../library/datetime.rst:1283 ../../library/datetime.rst:1292 msgid "The fold value is copied to the returned :class:`.time` object." msgstr "" -#: ../../library/datetime.rst:1248 +#: ../../library/datetime.rst:1289 msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond, " "fold, and tzinfo attributes. See also method :meth:`time`." msgstr "" -#: ../../library/datetime.rst:1259 +#: ../../library/datetime.rst:1300 msgid "" "Return a datetime with the same attributes, except for those attributes " "given new values by whichever keyword arguments are specified. Note that " @@ -1886,21 +1931,27 @@ msgid "" "datetime with no conversion of date and time data." msgstr "" -#: ../../library/datetime.rst:1270 +#: ../../library/datetime.rst:1305 +msgid "" +":class:`.datetime` objects are also supported by generic function :func:" +"`copy.replace`." +msgstr "" + +#: ../../library/datetime.rst:1314 msgid "" "Return a :class:`.datetime` object with new :attr:`.tzinfo` attribute *tz*, " "adjusting the date and time data so the result is the same UTC time as " "*self*, but in *tz*'s local time." msgstr "" -#: ../../library/datetime.rst:1274 +#: ../../library/datetime.rst:1318 msgid "" "If provided, *tz* must be an instance of a :class:`tzinfo` subclass, and " "its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. If " "*self* is naive, it is presumed to represent time in the system time zone." msgstr "" -#: ../../library/datetime.rst:1278 +#: ../../library/datetime.rst:1322 msgid "" "If called without arguments (or with ``tz=None``) the system local time zone " "is assumed for the target time zone. The ``.tzinfo`` attribute of the " @@ -1908,7 +1959,7 @@ msgid "" "with the zone name and offset obtained from the OS." msgstr "" -#: ../../library/datetime.rst:1283 +#: ../../library/datetime.rst:1327 msgid "" "If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no " "adjustment of date or time data is performed. Else the result is local time " @@ -1917,7 +1968,7 @@ msgid "" "date and time data as ``dt - dt.utcoffset()``." msgstr "" -#: ../../library/datetime.rst:1289 +#: ../../library/datetime.rst:1333 msgid "" "If you merely want to attach a :class:`timezone` object *tz* to a datetime " "*dt* without adjustment of date and time data, use ``dt." @@ -1926,14 +1977,14 @@ msgid "" "use ``dt.replace(tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1294 +#: ../../library/datetime.rst:1338 msgid "" "Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :" "class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. " "Ignoring error cases, :meth:`astimezone` acts like::" msgstr "" -#: ../../library/datetime.rst:1298 +#: ../../library/datetime.rst:1342 msgid "" "def astimezone(self, tz):\n" " if self.tzinfo is tz:\n" @@ -1944,49 +1995,49 @@ msgid "" " return tz.fromutc(utc)" msgstr "" -#: ../../library/datetime.rst:1306 +#: ../../library/datetime.rst:1350 msgid "*tz* now can be omitted." msgstr "" -#: ../../library/datetime.rst:1309 +#: ../../library/datetime.rst:1353 msgid "" "The :meth:`astimezone` method can now be called on naive instances that are " "presumed to represent system local time." msgstr "" -#: ../../library/datetime.rst:1316 +#: ../../library/datetime.rst:1360 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "utcoffset(self)``, and raises an exception if the latter doesn't return " "``None`` or a :class:`timedelta` object with magnitude less than one day." msgstr "" -#: ../../library/datetime.rst:1320 ../../library/datetime.rst:1912 -#: ../../library/datetime.rst:2019 ../../library/datetime.rst:2264 -#: ../../library/datetime.rst:2276 ../../library/datetime.rst:2588 +#: ../../library/datetime.rst:1364 ../../library/datetime.rst:1959 +#: ../../library/datetime.rst:2066 ../../library/datetime.rst:2311 +#: ../../library/datetime.rst:2323 ../../library/datetime.rst:2635 msgid "The UTC offset is not restricted to a whole number of minutes." msgstr "" -#: ../../library/datetime.rst:1326 +#: ../../library/datetime.rst:1370 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "dst(self)``, and raises an exception if the latter doesn't return ``None`` " "or a :class:`timedelta` object with magnitude less than one day." msgstr "" -#: ../../library/datetime.rst:1330 ../../library/datetime.rst:1922 -#: ../../library/datetime.rst:2073 +#: ../../library/datetime.rst:1374 ../../library/datetime.rst:1969 +#: ../../library/datetime.rst:2120 msgid "The DST offset is not restricted to a whole number of minutes." msgstr "" -#: ../../library/datetime.rst:1336 +#: ../../library/datetime.rst:1380 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "tzname(self)``, raises an exception if the latter doesn't return ``None`` or " "a string object," msgstr "" -#: ../../library/datetime.rst:1347 +#: ../../library/datetime.rst:1391 msgid "" "time.struct_time((d.year, d.month, d.day,\n" " d.hour, d.minute, d.second,\n" @@ -1996,7 +2047,7 @@ msgstr "" " d.hour, d.minute, d.second,\n" " d.weekday(), yday, dst))" -#: ../../library/datetime.rst:1351 +#: ../../library/datetime.rst:1395 msgid "" "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " "day number within the current year starting with 1 for January 1st. The :" @@ -2007,7 +2058,7 @@ msgid "" "to 0." msgstr "" -#: ../../library/datetime.rst:1362 +#: ../../library/datetime.rst:1406 msgid "" "If :class:`.datetime` instance *d* is naive, this is the same as ``d." "timetuple()`` except that :attr:`~.time.struct_time.tm_isdst` is forced to 0 " @@ -2015,7 +2066,7 @@ msgid "" "time." msgstr "" -#: ../../library/datetime.rst:1366 +#: ../../library/datetime.rst:1410 msgid "" "If *d* is aware, *d* is normalized to UTC time, by subtracting ``d." "utcoffset()``, and a :class:`time.struct_time` for the normalized time is " @@ -2024,7 +2075,7 @@ msgid "" "and UTC adjustment spills over a year boundary." msgstr "" -#: ../../library/datetime.rst:1375 +#: ../../library/datetime.rst:1419 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -2034,20 +2085,20 @@ msgid "" "meth:`.datetime.timetuple`." msgstr "" -#: ../../library/datetime.rst:1384 +#: ../../library/datetime.rst:1428 msgid "" "Return the proleptic Gregorian ordinal of the date. The same as ``self." "date().toordinal()``." msgstr "" -#: ../../library/datetime.rst:1389 +#: ../../library/datetime.rst:1433 msgid "" "Return POSIX timestamp corresponding to the :class:`.datetime` instance. The " "return value is a :class:`float` similar to that returned by :func:`time." "time`." msgstr "" -#: ../../library/datetime.rst:1393 +#: ../../library/datetime.rst:1437 msgid "" "Naive :class:`.datetime` instances are assumed to represent local time and " "this method relies on the platform C :c:func:`mktime` function to perform " @@ -2057,22 +2108,22 @@ msgid "" "future." msgstr "" -#: ../../library/datetime.rst:1400 +#: ../../library/datetime.rst:1444 msgid "" "For aware :class:`.datetime` instances, the return value is computed as::" msgstr "" -#: ../../library/datetime.rst:1403 +#: ../../library/datetime.rst:1447 msgid "(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()" msgstr "(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()" -#: ../../library/datetime.rst:1407 +#: ../../library/datetime.rst:1451 msgid "" "The :meth:`timestamp` method uses the :attr:`.fold` attribute to " "disambiguate the times during a repeated interval." msgstr "" -#: ../../library/datetime.rst:1413 +#: ../../library/datetime.rst:1457 msgid "" "There is no method to obtain the POSIX timestamp directly from a naive :" "class:`.datetime` instance representing UTC time. If your application uses " @@ -2080,57 +2131,57 @@ msgid "" "the POSIX timestamp by supplying ``tzinfo=timezone.utc``::" msgstr "" -#: ../../library/datetime.rst:1419 +#: ../../library/datetime.rst:1463 msgid "timestamp = dt.replace(tzinfo=timezone.utc).timestamp()" msgstr "timestamp = dt.replace(tzinfo=timezone.utc).timestamp()" -#: ../../library/datetime.rst:1421 +#: ../../library/datetime.rst:1465 msgid "or by calculating the timestamp directly::" msgstr "" -#: ../../library/datetime.rst:1423 +#: ../../library/datetime.rst:1467 msgid "timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)" msgstr "timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)" -#: ../../library/datetime.rst:1427 +#: ../../library/datetime.rst:1471 msgid "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " "The same as ``self.date().weekday()``. See also :meth:`isoweekday`." msgstr "" -#: ../../library/datetime.rst:1433 +#: ../../library/datetime.rst:1477 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " "The same as ``self.date().isoweekday()``. See also :meth:`weekday`, :meth:" "`isocalendar`." msgstr "" -#: ../../library/datetime.rst:1440 +#: ../../library/datetime.rst:1484 msgid "" "Return a :term:`named tuple` with three components: ``year``, ``week`` and " "``weekday``. The same as ``self.date().isocalendar()``." msgstr "" -#: ../../library/datetime.rst:1446 +#: ../../library/datetime.rst:1490 msgid "Return a string representing the date and time in ISO 8601 format:" msgstr "" -#: ../../library/datetime.rst:1448 +#: ../../library/datetime.rst:1492 msgid "``YYYY-MM-DDTHH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "``YYYY-MM-DDTHH:MM:SS.ffffff``,如果 :attr:`microsecond` 不是 0" -#: ../../library/datetime.rst:1449 +#: ../../library/datetime.rst:1493 msgid "``YYYY-MM-DDTHH:MM:SS``, if :attr:`microsecond` is 0" msgstr "``YYYY-MM-DDTHH:MM:SS``,如果 :attr:`microsecond` 是 0" -#: ../../library/datetime.rst:1451 +#: ../../library/datetime.rst:1495 msgid "" "If :meth:`utcoffset` does not return ``None``, a string is appended, giving " "the UTC offset:" msgstr "" "如果 :meth:`utcoffset` 没有回傳 ``None``,則會附加一个字串,給出 UTC 偏移:" -#: ../../library/datetime.rst:1454 +#: ../../library/datetime.rst:1498 msgid "" "``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` " "is not 0" @@ -2138,13 +2189,13 @@ msgstr "" "``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``,如果 :attr:`microsecond` " "不是 0" -#: ../../library/datetime.rst:1456 +#: ../../library/datetime.rst:1500 msgid "" "``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0" msgstr "" "``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``,如果 :attr:`microsecond` 是 0" -#: ../../library/datetime.rst:1460 +#: ../../library/datetime.rst:1504 msgid "" ">>> from datetime import datetime, timezone\n" ">>> datetime(2019, 5, 18, 15, 17, 8, 132263).isoformat()\n" @@ -2158,13 +2209,13 @@ msgstr "" ">>> datetime(2019, 5, 18, 15, 17, tzinfo=timezone.utc).isoformat()\n" "'2019-05-18T15:17:00+00:00'" -#: ../../library/datetime.rst:1466 +#: ../../library/datetime.rst:1510 msgid "" "The optional argument *sep* (default ``'T'``) is a one-character separator, " "placed between the date and time portions of the result. For example::" msgstr "" -#: ../../library/datetime.rst:1469 +#: ../../library/datetime.rst:1513 msgid "" ">>> from datetime import tzinfo, timedelta, datetime\n" ">>> class TZ(tzinfo):\n" @@ -2178,53 +2229,53 @@ msgid "" "'2009-11-27T00:00:00.000100-06:39'" msgstr "" -#: ../../library/datetime.rst:1480 ../../library/datetime.rst:1852 +#: ../../library/datetime.rst:1524 ../../library/datetime.rst:1899 msgid "" "The optional argument *timespec* specifies the number of additional " "components of the time to include (the default is ``'auto'``). It can be one " "of the following:" msgstr "" -#: ../../library/datetime.rst:1484 ../../library/datetime.rst:1856 +#: ../../library/datetime.rst:1528 ../../library/datetime.rst:1903 msgid "" "``'auto'``: Same as ``'seconds'`` if :attr:`microsecond` is 0, same as " "``'microseconds'`` otherwise." msgstr "" -#: ../../library/datetime.rst:1486 ../../library/datetime.rst:1858 +#: ../../library/datetime.rst:1530 ../../library/datetime.rst:1905 msgid "``'hours'``: Include the :attr:`hour` in the two-digit ``HH`` format." msgstr "" -#: ../../library/datetime.rst:1487 ../../library/datetime.rst:1859 +#: ../../library/datetime.rst:1531 ../../library/datetime.rst:1906 msgid "" "``'minutes'``: Include :attr:`hour` and :attr:`minute` in ``HH:MM`` format." msgstr "" -#: ../../library/datetime.rst:1488 ../../library/datetime.rst:1860 +#: ../../library/datetime.rst:1532 ../../library/datetime.rst:1907 msgid "" "``'seconds'``: Include :attr:`hour`, :attr:`minute`, and :attr:`second` in " "``HH:MM:SS`` format." msgstr "" -#: ../../library/datetime.rst:1490 ../../library/datetime.rst:1862 +#: ../../library/datetime.rst:1534 ../../library/datetime.rst:1909 msgid "" "``'milliseconds'``: Include full time, but truncate fractional second part " "to milliseconds. ``HH:MM:SS.sss`` format." msgstr "" -#: ../../library/datetime.rst:1492 ../../library/datetime.rst:1864 +#: ../../library/datetime.rst:1536 ../../library/datetime.rst:1911 msgid "``'microseconds'``: Include full time in ``HH:MM:SS.ffffff`` format." msgstr "" -#: ../../library/datetime.rst:1496 ../../library/datetime.rst:1868 +#: ../../library/datetime.rst:1540 ../../library/datetime.rst:1915 msgid "Excluded time components are truncated, not rounded." msgstr "" -#: ../../library/datetime.rst:1498 +#: ../../library/datetime.rst:1542 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument::" msgstr "" -#: ../../library/datetime.rst:1501 +#: ../../library/datetime.rst:1545 msgid "" ">>> from datetime import datetime\n" ">>> datetime.now().isoformat(timespec='minutes') \n" @@ -2240,21 +2291,21 @@ msgstr "" ">>> dt.isoformat(timespec='microseconds')\n" "'2015-01-01T12:30:59.000000'" -#: ../../library/datetime.rst:1508 ../../library/datetime.rst:1883 +#: ../../library/datetime.rst:1552 ../../library/datetime.rst:1930 msgid "Added the *timespec* parameter." msgstr "新增 *timespec* 參數。" -#: ../../library/datetime.rst:1514 +#: ../../library/datetime.rst:1558 msgid "" "For a :class:`.datetime` instance *d*, ``str(d)`` is equivalent to ``d." "isoformat(' ')``." msgstr "" -#: ../../library/datetime.rst:1520 +#: ../../library/datetime.rst:1564 msgid "Return a string representing the date and time::" msgstr "" -#: ../../library/datetime.rst:1522 +#: ../../library/datetime.rst:1566 msgid "" ">>> from datetime import datetime\n" ">>> datetime(2002, 12, 4, 20, 30, 40).ctime()\n" @@ -2264,27 +2315,27 @@ msgstr "" ">>> datetime(2002, 12, 4, 20, 30, 40).ctime()\n" "'Wed Dec 4 20:30:40 2002'" -#: ../../library/datetime.rst:1526 +#: ../../library/datetime.rst:1570 msgid "" "The output string will *not* include time zone information, regardless of " "whether the input is aware or naive." msgstr "" -#: ../../library/datetime.rst:1533 +#: ../../library/datetime.rst:1577 msgid "" "on platforms where the native C :c:func:`ctime` function (which :func:`time." "ctime` invokes, but which :meth:`datetime.ctime` does not invoke) conforms " "to the C standard." msgstr "" -#: ../../library/datetime.rst:1540 +#: ../../library/datetime.rst:1584 msgid "" "Return a string representing the date and time, controlled by an explicit " "format string. See also :ref:`strftime-strptime-behavior` and :meth:" "`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1547 +#: ../../library/datetime.rst:1591 msgid "" "Same as :meth:`.datetime.strftime`. This makes it possible to specify a " "format string for a :class:`.datetime` object in :ref:`formatted string " @@ -2292,15 +2343,15 @@ msgid "" "`strftime-strptime-behavior` and :meth:`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1554 +#: ../../library/datetime.rst:1598 msgid "Examples of Usage: :class:`.datetime`" msgstr "用法範例::class:`.datetime`" -#: ../../library/datetime.rst:1556 +#: ../../library/datetime.rst:1600 msgid "Examples of working with :class:`.datetime` objects:" msgstr "更多 :class:`.datetime` 的用法範例:" -#: ../../library/datetime.rst:1558 +#: ../../library/datetime.rst:1602 msgid "" ">>> from datetime import datetime, date, time, timezone\n" "\n" @@ -2354,14 +2405,14 @@ msgid "" "'The day is 21, the month is November, the time is 04:30PM.'" msgstr "" -#: ../../library/datetime.rst:1609 +#: ../../library/datetime.rst:1653 msgid "" "The example below defines a :class:`tzinfo` subclass capturing time zone " "information for Kabul, Afghanistan, which used +4 UTC until 1945 and then " "+4:30 UTC thereafter::" msgstr "" -#: ../../library/datetime.rst:1613 +#: ../../library/datetime.rst:1657 msgid "" "from datetime import timedelta, datetime, tzinfo, timezone\n" "\n" @@ -2408,11 +2459,11 @@ msgid "" " return \"+04\"" msgstr "" -#: ../../library/datetime.rst:1656 +#: ../../library/datetime.rst:1700 msgid "Usage of ``KabulTz`` from above::" msgstr "" -#: ../../library/datetime.rst:1658 +#: ../../library/datetime.rst:1702 msgid "" ">>> tz1 = KabulTz()\n" "\n" @@ -2436,63 +2487,63 @@ msgid "" "True" msgstr "" -#: ../../library/datetime.rst:1682 +#: ../../library/datetime.rst:1726 msgid ":class:`.time` Objects" msgstr ":class:`.time` 物件" -#: ../../library/datetime.rst:1684 +#: ../../library/datetime.rst:1728 msgid "" "A :class:`.time` object represents a (local) time of day, independent of any " "particular day, and subject to adjustment via a :class:`tzinfo` object." msgstr "" -#: ../../library/datetime.rst:1689 +#: ../../library/datetime.rst:1733 msgid "" "All arguments are optional. *tzinfo* may be ``None``, or an instance of a :" "class:`tzinfo` subclass. The remaining arguments must be integers in the " "following ranges:" msgstr "" -#: ../../library/datetime.rst:1699 +#: ../../library/datetime.rst:1743 msgid "" "If an argument outside those ranges is given, :exc:`ValueError` is raised. " "All default to 0 except *tzinfo*, which defaults to ``None``." msgstr "" -#: ../../library/datetime.rst:1707 +#: ../../library/datetime.rst:1751 msgid "The earliest representable :class:`.time`, ``time(0, 0, 0, 0)``." msgstr "" -#: ../../library/datetime.rst:1712 +#: ../../library/datetime.rst:1756 msgid "The latest representable :class:`.time`, ``time(23, 59, 59, 999999)``." msgstr "" -#: ../../library/datetime.rst:1717 +#: ../../library/datetime.rst:1761 msgid "" "The smallest possible difference between non-equal :class:`.time` objects, " "``timedelta(microseconds=1)``, although note that arithmetic on :class:`." "time` objects is not supported." msgstr "" -#: ../../library/datetime.rst:1746 +#: ../../library/datetime.rst:1790 msgid "" "The object passed as the tzinfo argument to the :class:`.time` constructor, " "or ``None`` if none was passed." msgstr "" -#: ../../library/datetime.rst:1760 +#: ../../library/datetime.rst:1804 msgid "" ":class:`.time` objects support equality and order comparisons, where *a* is " "considered less than *b* when *a* precedes *b* in time." msgstr "" -#: ../../library/datetime.rst:1763 +#: ../../library/datetime.rst:1807 msgid "" "Naive and aware :class:`!time` objects are never equal. Order comparison " "between naive and aware :class:`!time` objects raises :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1767 +#: ../../library/datetime.rst:1811 msgid "" "If both comparands are aware, and have the same :attr:`~.time.tzinfo` " "attribute, the :attr:`!tzinfo` and :attr:`!fold` attributes are ignored and " @@ -2501,18 +2552,18 @@ msgid "" "subtracting their UTC offsets (obtained from ``self.utcoffset()``)." msgstr "" -#: ../../library/datetime.rst:1773 +#: ../../library/datetime.rst:1817 msgid "" "Equality comparisons between aware and naive :class:`.time` instances don't " "raise :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1777 +#: ../../library/datetime.rst:1821 msgid "" "In Boolean contexts, a :class:`.time` object is always considered to be true." msgstr "" -#: ../../library/datetime.rst:1779 +#: ../../library/datetime.rst:1823 msgid "" "Before Python 3.5, a :class:`.time` object was considered to be false if it " "represented midnight in UTC. This behavior was considered obscure and error-" @@ -2520,33 +2571,33 @@ msgid "" "details." msgstr "" -#: ../../library/datetime.rst:1786 +#: ../../library/datetime.rst:1830 msgid "Other constructor:" msgstr "" -#: ../../library/datetime.rst:1790 +#: ../../library/datetime.rst:1834 msgid "" "Return a :class:`.time` corresponding to a *time_string* in any valid ISO " "8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:1794 +#: ../../library/datetime.rst:1838 msgid "" "The leading ``T``, normally required in cases where there may be ambiguity " "between a date and a time, is not required." msgstr "" -#: ../../library/datetime.rst:1796 +#: ../../library/datetime.rst:1840 msgid "" "Fractional seconds may have any number of digits (anything beyond 6 will be " "truncated)." msgstr "" -#: ../../library/datetime.rst:1800 +#: ../../library/datetime.rst:1844 msgid "Examples:" msgstr "範例: ::" -#: ../../library/datetime.rst:1802 +#: ../../library/datetime.rst:1846 msgid "" ">>> from datetime import time\n" ">>> time.fromisoformat('04:23:01')\n" @@ -2586,13 +2637,13 @@ msgstr "" ">>> time.fromisoformat('04:23:01+00:00')\n" "datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)" -#: ../../library/datetime.rst:1824 +#: ../../library/datetime.rst:1868 msgid "" "Previously, this method only supported formats that could be emitted by :" "meth:`time.isoformat`." msgstr "" -#: ../../library/datetime.rst:1834 +#: ../../library/datetime.rst:1878 msgid "" "Return a :class:`.time` with the same value, except for those attributes " "given new values by whichever keyword arguments are specified. Note that " @@ -2600,35 +2651,41 @@ msgid "" "aware :class:`.time`, without conversion of the time data." msgstr "" -#: ../../library/datetime.rst:1845 +#: ../../library/datetime.rst:1883 +msgid "" +":class:`.time` objects are also supported by generic function :func:`copy." +"replace`." +msgstr "" + +#: ../../library/datetime.rst:1892 msgid "Return a string representing the time in ISO 8601 format, one of:" msgstr "" -#: ../../library/datetime.rst:1847 +#: ../../library/datetime.rst:1894 msgid "``HH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "" -#: ../../library/datetime.rst:1848 +#: ../../library/datetime.rst:1895 msgid "``HH:MM:SS``, if :attr:`microsecond` is 0" msgstr "" -#: ../../library/datetime.rst:1849 +#: ../../library/datetime.rst:1896 msgid "" "``HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :meth:`utcoffset` does not " "return ``None``" msgstr "" -#: ../../library/datetime.rst:1850 +#: ../../library/datetime.rst:1897 msgid "" "``HH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0 and :meth:" "`utcoffset` does not return ``None``" msgstr "" -#: ../../library/datetime.rst:1870 +#: ../../library/datetime.rst:1917 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument." msgstr "" -#: ../../library/datetime.rst:1874 +#: ../../library/datetime.rst:1921 msgid "" ">>> from datetime import time\n" ">>> time(hour=12, minute=34, second=56, microsecond=123456)." @@ -2650,18 +2707,18 @@ msgstr "" ">>> dt.isoformat(timespec='auto')\n" "'12:34:56'" -#: ../../library/datetime.rst:1889 +#: ../../library/datetime.rst:1936 msgid "For a time *t*, ``str(t)`` is equivalent to ``t.isoformat()``." msgstr "" -#: ../../library/datetime.rst:1894 +#: ../../library/datetime.rst:1941 msgid "" "Return a string representing the time, controlled by an explicit format " "string. See also :ref:`strftime-strptime-behavior` and :meth:`time." "isoformat`." msgstr "" -#: ../../library/datetime.rst:1900 +#: ../../library/datetime.rst:1947 msgid "" "Same as :meth:`.time.strftime`. This makes it possible to specify a format " "string for a :class:`.time` object in :ref:`formatted string literals >> from datetime import time, tzinfo, timedelta\n" ">>> class TZ1(tzinfo):\n" @@ -2750,18 +2807,18 @@ msgstr "" ">>> 'The {} is {:%H:%M}.'.format(\"time\", t)\n" "'The time is 12:10.'" -#: ../../library/datetime.rst:1965 +#: ../../library/datetime.rst:2012 msgid ":class:`tzinfo` Objects" msgstr ":class:`tzinfo` 物件" -#: ../../library/datetime.rst:1969 +#: ../../library/datetime.rst:2016 msgid "" "This is an abstract base class, meaning that this class should not be " "instantiated directly. Define a subclass of :class:`tzinfo` to capture " "information about a particular time zone." msgstr "" -#: ../../library/datetime.rst:1973 +#: ../../library/datetime.rst:2020 msgid "" "An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the " "constructors for :class:`.datetime` and :class:`.time` objects. The latter " @@ -2771,7 +2828,7 @@ msgid "" "object passed to them." msgstr "" -#: ../../library/datetime.rst:1979 +#: ../../library/datetime.rst:2026 msgid "" "You need to derive a concrete subclass, and (at least) supply " "implementations of the standard :class:`tzinfo` methods needed by the :class:" @@ -2781,7 +2838,7 @@ msgid "" "American EST and EDT." msgstr "" -#: ../../library/datetime.rst:1986 +#: ../../library/datetime.rst:2033 msgid "" "Special requirement for pickling: A :class:`tzinfo` subclass must have an :" "meth:`~object.__init__` method that can be called with no arguments, " @@ -2789,20 +2846,20 @@ msgid "" "technical requirement that may be relaxed in the future." msgstr "" -#: ../../library/datetime.rst:1992 +#: ../../library/datetime.rst:2039 msgid "" "A concrete subclass of :class:`tzinfo` may need to implement the following " "methods. Exactly which methods are needed depends on the uses made of aware :" "mod:`!datetime` objects. If in doubt, simply implement all of them." msgstr "" -#: ../../library/datetime.rst:1999 +#: ../../library/datetime.rst:2046 msgid "" "Return offset of local time from UTC, as a :class:`timedelta` object that is " "positive east of UTC. If local time is west of UTC, this should be negative." msgstr "" -#: ../../library/datetime.rst:2002 +#: ../../library/datetime.rst:2049 msgid "" "This represents the *total* offset from UTC; for example, if a :class:" "`tzinfo` object represents both time zone and DST adjustments, :meth:" @@ -2813,31 +2870,31 @@ msgid "" "meth:`utcoffset` will probably look like one of these two::" msgstr "" -#: ../../library/datetime.rst:2010 +#: ../../library/datetime.rst:2057 msgid "" "return CONSTANT # fixed-offset class\n" "return CONSTANT + self.dst(dt) # daylight-aware class" msgstr "" -#: ../../library/datetime.rst:2013 +#: ../../library/datetime.rst:2060 msgid "" "If :meth:`utcoffset` does not return ``None``, :meth:`dst` should not return " "``None`` either." msgstr "" -#: ../../library/datetime.rst:2016 +#: ../../library/datetime.rst:2063 msgid "" "The default implementation of :meth:`utcoffset` raises :exc:" "`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2025 +#: ../../library/datetime.rst:2072 msgid "" "Return the daylight saving time (DST) adjustment, as a :class:`timedelta` " "object or ``None`` if DST information isn't known." msgstr "" -#: ../../library/datetime.rst:2029 +#: ../../library/datetime.rst:2076 msgid "" "Return ``timedelta(0)`` if DST is not in effect. If DST is in effect, return " "the offset as a :class:`timedelta` object (see :meth:`utcoffset` for " @@ -2850,17 +2907,17 @@ msgid "" "to account for DST changes when crossing time zones." msgstr "" -#: ../../library/datetime.rst:2039 +#: ../../library/datetime.rst:2086 msgid "" "An instance *tz* of a :class:`tzinfo` subclass that models both standard and " "daylight times must be consistent in this sense:" msgstr "" -#: ../../library/datetime.rst:2042 +#: ../../library/datetime.rst:2089 msgid "``tz.utcoffset(dt) - tz.dst(dt)``" msgstr "``tz.utcoffset(dt) - tz.dst(dt)``" -#: ../../library/datetime.rst:2044 +#: ../../library/datetime.rst:2091 msgid "" "must return the same result for every :class:`.datetime` *dt* with ``dt." "tzinfo == tz``. For sane :class:`tzinfo` subclasses, this expression yields " @@ -2873,24 +2930,24 @@ msgid "" "astimezone` regardless." msgstr "" -#: ../../library/datetime.rst:2053 +#: ../../library/datetime.rst:2100 msgid "" "Most implementations of :meth:`dst` will probably look like one of these " "two::" msgstr "" -#: ../../library/datetime.rst:2055 +#: ../../library/datetime.rst:2102 msgid "" "def dst(self, dt):\n" " # a fixed-offset class: doesn't account for DST\n" " return timedelta(0)" msgstr "" -#: ../../library/datetime.rst:2059 +#: ../../library/datetime.rst:2106 msgid "or::" msgstr "或是: ::" -#: ../../library/datetime.rst:2061 +#: ../../library/datetime.rst:2108 msgid "" "def dst(self, dt):\n" " # Code to set dston and dstoff to the time zone's DST\n" @@ -2903,12 +2960,12 @@ msgid "" " return timedelta(0)" msgstr "" -#: ../../library/datetime.rst:2071 +#: ../../library/datetime.rst:2118 msgid "" "The default implementation of :meth:`dst` raises :exc:`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2079 +#: ../../library/datetime.rst:2126 msgid "" "Return the time zone name corresponding to the :class:`.datetime` object " "*dt*, as a string. Nothing about string names is defined by the :mod:`!" @@ -2922,13 +2979,13 @@ msgid "" "accounting for daylight time." msgstr "" -#: ../../library/datetime.rst:2089 +#: ../../library/datetime.rst:2136 msgid "" "The default implementation of :meth:`tzname` raises :exc:" "`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2092 +#: ../../library/datetime.rst:2139 msgid "" "These methods are called by a :class:`.datetime` or :class:`.time` object, " "in response to their methods of the same names. A :class:`.datetime` object " @@ -2938,7 +2995,7 @@ msgid "" "datetime`." msgstr "" -#: ../../library/datetime.rst:2098 +#: ../../library/datetime.rst:2145 msgid "" "When ``None`` is passed, it's up to the class designer to decide the best " "response. For example, returning ``None`` is appropriate if the class wishes " @@ -2947,7 +3004,7 @@ msgid "" "offset, as there is no other convention for discovering the standard offset." msgstr "" -#: ../../library/datetime.rst:2104 +#: ../../library/datetime.rst:2151 msgid "" "When a :class:`.datetime` object is passed in response to a :class:`." "datetime` method, ``dt.tzinfo`` is the same object as *self*. :class:" @@ -2957,13 +3014,13 @@ msgid "" "zones." msgstr "" -#: ../../library/datetime.rst:2110 +#: ../../library/datetime.rst:2157 msgid "" "There is one more :class:`tzinfo` method that a subclass may wish to " "override:" msgstr "" -#: ../../library/datetime.rst:2115 +#: ../../library/datetime.rst:2162 msgid "" "This is called from the default :meth:`datetime.astimezone` implementation. " "When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time " @@ -2972,7 +3029,7 @@ msgid "" "datetime in *self*'s local time." msgstr "" -#: ../../library/datetime.rst:2121 +#: ../../library/datetime.rst:2168 msgid "" "Most :class:`tzinfo` subclasses should be able to inherit the default :meth:" "`fromutc` implementation without problems. It's strong enough to handle " @@ -2987,13 +3044,13 @@ msgid "" "offset changes." msgstr "" -#: ../../library/datetime.rst:2132 +#: ../../library/datetime.rst:2179 msgid "" "Skipping code for error cases, the default :meth:`fromutc` implementation " "acts like::" msgstr "" -#: ../../library/datetime.rst:2135 +#: ../../library/datetime.rst:2182 msgid "" "def fromutc(self, dt):\n" " # raise ValueError error if dt.tzinfo is not self\n" @@ -3011,13 +3068,13 @@ msgid "" " return dt" msgstr "" -#: ../../library/datetime.rst:2150 +#: ../../library/datetime.rst:2197 msgid "" "In the following :download:`tzinfo_examples.py <../includes/tzinfo_examples." "py>` file there are some examples of :class:`tzinfo` classes:" msgstr "" -#: ../../library/datetime.rst:2154 +#: ../../library/datetime.rst:2201 msgid "" "from datetime import tzinfo, timedelta, datetime\n" "\n" @@ -3197,7 +3254,7 @@ msgid "" "Pacific = USTimeZone(-8, \"Pacific\", \"PST\", \"PDT\")\n" msgstr "" -#: ../../library/datetime.rst:2156 +#: ../../library/datetime.rst:2203 msgid "" "Note that there are unavoidable subtleties twice per year in a :class:" "`tzinfo` subclass accounting for both standard and daylight time, at the DST " @@ -3206,7 +3263,7 @@ msgid "" "ends the minute after 1:59 (EDT) on the first Sunday in November::" msgstr "" -#: ../../library/datetime.rst:2162 +#: ../../library/datetime.rst:2209 msgid "" " UTC 3:MM 4:MM 5:MM 6:MM 7:MM 8:MM\n" " EST 22:MM 23:MM 0:MM 1:MM 2:MM 3:MM\n" @@ -3224,7 +3281,7 @@ msgstr "" "\n" " end 23:MM 0:MM 1:MM 1:MM 2:MM 3:MM" -#: ../../library/datetime.rst:2170 +#: ../../library/datetime.rst:2217 msgid "" "When DST starts (the \"start\" line), the local wall clock leaps from 1:59 " "to 3:00. A wall time of the form 2:MM doesn't really make sense on that day, " @@ -3233,7 +3290,7 @@ msgid "" "get::" msgstr "" -#: ../../library/datetime.rst:2175 +#: ../../library/datetime.rst:2222 msgid "" ">>> from datetime import datetime, timezone\n" ">>> from tzinfo_examples import HOUR, Eastern\n" @@ -3261,7 +3318,7 @@ msgstr "" "07:00:00 UTC = 03:00:00 EDT\n" "08:00:00 UTC = 04:00:00 EDT" -#: ../../library/datetime.rst:2189 +#: ../../library/datetime.rst:2236 msgid "" "When DST ends (the \"end\" line), there's a potentially worse problem: " "there's an hour that can't be spelled unambiguously in local wall time: the " @@ -3276,7 +3333,7 @@ msgid "" "Fall back transition of 2016, we get::" msgstr "" -#: ../../library/datetime.rst:2200 +#: ../../library/datetime.rst:2247 msgid "" ">>> u0 = datetime(2016, 11, 6, 4, tzinfo=timezone.utc)\n" ">>> for i in range(4):\n" @@ -3300,13 +3357,13 @@ msgstr "" "06:00:00 UTC = 01:00:00 EST 1\n" "07:00:00 UTC = 02:00:00 EST 0" -#: ../../library/datetime.rst:2211 +#: ../../library/datetime.rst:2258 msgid "" "Note that the :class:`.datetime` instances that differ only by the value of " "the :attr:`~.datetime.fold` attribute are considered equal in comparisons." msgstr "" -#: ../../library/datetime.rst:2214 +#: ../../library/datetime.rst:2261 msgid "" "Applications that can't bear wall-time ambiguities should explicitly check " "the value of the :attr:`~.datetime.fold` attribute or avoid using hybrid :" @@ -3316,28 +3373,28 @@ msgid "" "offset -4 hours))." msgstr "" -#: ../../library/datetime.rst:2222 +#: ../../library/datetime.rst:2269 msgid ":mod:`zoneinfo`" msgstr ":mod:`zoneinfo`" -#: ../../library/datetime.rst:2223 +#: ../../library/datetime.rst:2270 msgid "" "The :mod:`!datetime` module has a basic :class:`timezone` class (for " "handling arbitrary fixed offsets from UTC) and its :attr:`timezone.utc` " "attribute (a UTC :class:`!timezone` instance)." msgstr "" -#: ../../library/datetime.rst:2227 +#: ../../library/datetime.rst:2274 msgid "" "``zoneinfo`` brings the *IANA time zone database* (also known as the Olson " "database) to Python, and its usage is recommended." msgstr "" -#: ../../library/datetime.rst:2230 +#: ../../library/datetime.rst:2277 msgid "`IANA time zone database `_" msgstr "`IANA 時區資料庫 `_" -#: ../../library/datetime.rst:2231 +#: ../../library/datetime.rst:2278 msgid "" "The Time Zone Database (often called tz, tzdata or zoneinfo) contains code " "and data that represent the history of local time for many representative " @@ -3346,24 +3403,24 @@ msgid "" "saving rules." msgstr "" -#: ../../library/datetime.rst:2241 +#: ../../library/datetime.rst:2288 msgid ":class:`timezone` Objects" msgstr ":class:`timezone` 物件" -#: ../../library/datetime.rst:2243 +#: ../../library/datetime.rst:2290 msgid "" "The :class:`timezone` class is a subclass of :class:`tzinfo`, each instance " "of which represents a time zone defined by a fixed offset from UTC." msgstr "" -#: ../../library/datetime.rst:2247 +#: ../../library/datetime.rst:2294 msgid "" "Objects of this class cannot be used to represent time zone information in " "the locations where different offsets are used in different days of the year " "or where historical changes have been made to civil time." msgstr "" -#: ../../library/datetime.rst:2254 +#: ../../library/datetime.rst:2301 msgid "" "The *offset* argument must be specified as a :class:`timedelta` object " "representing the difference between the local time and UTC. It must be " @@ -3371,25 +3428,25 @@ msgid "" "otherwise :exc:`ValueError` is raised." msgstr "" -#: ../../library/datetime.rst:2259 +#: ../../library/datetime.rst:2306 msgid "" "The *name* argument is optional. If specified it must be a string that will " "be used as the value returned by the :meth:`datetime.tzname` method." msgstr "" -#: ../../library/datetime.rst:2270 ../../library/datetime.rst:2281 +#: ../../library/datetime.rst:2317 ../../library/datetime.rst:2328 msgid "" "Return the fixed value specified when the :class:`timezone` instance is " "constructed." msgstr "" -#: ../../library/datetime.rst:2273 +#: ../../library/datetime.rst:2320 msgid "" "The *dt* argument is ignored. The return value is a :class:`timedelta` " "instance equal to the difference between the local time and UTC." msgstr "" -#: ../../library/datetime.rst:2284 +#: ../../library/datetime.rst:2331 msgid "" "If *name* is not provided in the constructor, the name returned by " "``tzname(dt)`` is generated from the value of the ``offset`` as follows. If " @@ -3398,119 +3455,119 @@ msgid "" "are two digits of ``offset.hours`` and ``offset.minutes`` respectively." msgstr "" -#: ../../library/datetime.rst:2290 +#: ../../library/datetime.rst:2337 msgid "" "Name generated from ``offset=timedelta(0)`` is now plain ``'UTC'``, not " "``'UTC+00:00'``." msgstr "" -#: ../../library/datetime.rst:2297 +#: ../../library/datetime.rst:2344 msgid "Always returns ``None``." msgstr "總是回傳 ``None``。" -#: ../../library/datetime.rst:2301 +#: ../../library/datetime.rst:2348 msgid "" "Return ``dt + offset``. The *dt* argument must be an aware :class:`." "datetime` instance, with ``tzinfo`` set to ``self``." msgstr "" -#: ../../library/datetime.rst:2308 +#: ../../library/datetime.rst:2355 msgid "The UTC time zone, ``timezone(timedelta(0))``." msgstr "UTC 時區,``timezone(timedelta(0))``。" -#: ../../library/datetime.rst:2317 +#: ../../library/datetime.rst:2364 msgid ":meth:`~.datetime.strftime` and :meth:`~.datetime.strptime` Behavior" msgstr ":meth:`~.datetime.strftime` 與 :meth:`~.datetime.strptime` 的行為" -#: ../../library/datetime.rst:2319 +#: ../../library/datetime.rst:2366 msgid "" ":class:`date`, :class:`.datetime`, and :class:`.time` objects all support a " "``strftime(format)`` method, to create a string representing the time under " "the control of an explicit format string." msgstr "" -#: ../../library/datetime.rst:2323 +#: ../../library/datetime.rst:2370 msgid "" "Conversely, the :meth:`datetime.strptime` class method creates a :class:`." "datetime` object from a string representing a date and time and a " "corresponding format string." msgstr "" -#: ../../library/datetime.rst:2327 +#: ../../library/datetime.rst:2374 msgid "" "The table below provides a high-level comparison of :meth:`~.datetime." "strftime` versus :meth:`~.datetime.strptime`:" msgstr "" -#: ../../library/datetime.rst:2331 +#: ../../library/datetime.rst:2378 msgid "``strftime``" msgstr "``strftime``" -#: ../../library/datetime.rst:2331 +#: ../../library/datetime.rst:2378 msgid "``strptime``" msgstr "``strptime``" -#: ../../library/datetime.rst:2333 +#: ../../library/datetime.rst:2380 msgid "Usage" msgstr "用法" -#: ../../library/datetime.rst:2333 +#: ../../library/datetime.rst:2380 msgid "Convert object to a string according to a given format" msgstr "" -#: ../../library/datetime.rst:2333 +#: ../../library/datetime.rst:2380 msgid "" "Parse a string into a :class:`.datetime` object given a corresponding format" msgstr "" -#: ../../library/datetime.rst:2335 +#: ../../library/datetime.rst:2382 msgid "Type of method" msgstr "" -#: ../../library/datetime.rst:2335 +#: ../../library/datetime.rst:2382 msgid "Instance method" msgstr "實例方法" -#: ../../library/datetime.rst:2335 +#: ../../library/datetime.rst:2382 msgid "Class method" msgstr "類別方法" -#: ../../library/datetime.rst:2337 +#: ../../library/datetime.rst:2384 msgid "Method of" msgstr "" -#: ../../library/datetime.rst:2337 +#: ../../library/datetime.rst:2384 msgid ":class:`date`; :class:`.datetime`; :class:`.time`" msgstr ":class:`date`; :class:`.datetime`; :class:`.time`" -#: ../../library/datetime.rst:2337 +#: ../../library/datetime.rst:2384 msgid ":class:`.datetime`" msgstr ":class:`.datetime`" -#: ../../library/datetime.rst:2339 +#: ../../library/datetime.rst:2386 msgid "Signature" msgstr "" -#: ../../library/datetime.rst:2339 +#: ../../library/datetime.rst:2386 msgid "``strftime(format)``" msgstr "``strftime(format)``" -#: ../../library/datetime.rst:2339 +#: ../../library/datetime.rst:2386 msgid "``strptime(date_string, format)``" msgstr "``strptime(date_string, format)``" -#: ../../library/datetime.rst:2346 +#: ../../library/datetime.rst:2393 msgid "" ":meth:`~.datetime.strftime` and :meth:`~.datetime.strptime` Format Codes" msgstr ":meth:`~.datetime.strftime` 與 :meth:`~.datetime.strptime` 格式碼" -#: ../../library/datetime.rst:2348 +#: ../../library/datetime.rst:2395 msgid "" "These methods accept format codes that can be used to parse and format " "dates::" msgstr "" -#: ../../library/datetime.rst:2350 +#: ../../library/datetime.rst:2397 msgid "" ">>> datetime.strptime('31/01/22 23:59:59.999999',\n" "... '%d/%m/%y %H:%M:%S.%f')\n" @@ -3524,33 +3581,33 @@ msgstr "" ">>> _.strftime('%a %d %b %Y, %I:%M%p')\n" "'Mon 31 Jan 2022, 11:59PM'" -#: ../../library/datetime.rst:2356 +#: ../../library/datetime.rst:2403 msgid "" "The following is a list of all the format codes that the 1989 C standard " "requires, and these work on all platforms with a standard C implementation." msgstr "" -#: ../../library/datetime.rst:2360 ../../library/datetime.rst:2463 +#: ../../library/datetime.rst:2407 ../../library/datetime.rst:2510 msgid "Directive" msgstr "" -#: ../../library/datetime.rst:2360 ../../library/datetime.rst:2463 +#: ../../library/datetime.rst:2407 ../../library/datetime.rst:2510 msgid "Meaning" msgstr "含義" -#: ../../library/datetime.rst:2360 ../../library/datetime.rst:2463 +#: ../../library/datetime.rst:2407 ../../library/datetime.rst:2510 msgid "Example" msgstr "範例" -#: ../../library/datetime.rst:2360 ../../library/datetime.rst:2463 +#: ../../library/datetime.rst:2407 ../../library/datetime.rst:2510 msgid "Notes" msgstr "註解" -#: ../../library/datetime.rst:2362 +#: ../../library/datetime.rst:2409 msgid "``%a``" msgstr "``%a``" -#: ../../library/datetime.rst:2362 +#: ../../library/datetime.rst:2409 msgid "Weekday as locale's abbreviated name." msgstr "" @@ -3562,11 +3619,11 @@ msgstr "" msgid "So, Mo, ..., Sa (de_DE)" msgstr "" -#: ../../library/datetime.rst:2367 +#: ../../library/datetime.rst:2414 msgid "``%A``" msgstr "``%A``" -#: ../../library/datetime.rst:2367 +#: ../../library/datetime.rst:2414 msgid "Weekday as locale's full name." msgstr "" @@ -3578,42 +3635,42 @@ msgstr "" msgid "Sonntag, Montag, ..., Samstag (de_DE)" msgstr "" -#: ../../library/datetime.rst:2372 +#: ../../library/datetime.rst:2419 msgid "``%w``" msgstr "``%w``" -#: ../../library/datetime.rst:2372 +#: ../../library/datetime.rst:2419 msgid "Weekday as a decimal number, where 0 is Sunday and 6 is Saturday." msgstr "" -#: ../../library/datetime.rst:2372 +#: ../../library/datetime.rst:2419 msgid "0, 1, ..., 6" msgstr "0, 1, ..., 6" -#: ../../library/datetime.rst:2376 +#: ../../library/datetime.rst:2423 msgid "``%d``" msgstr "``%d``" -#: ../../library/datetime.rst:2376 +#: ../../library/datetime.rst:2423 msgid "Day of the month as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2376 +#: ../../library/datetime.rst:2423 msgid "01, 02, ..., 31" msgstr "01, 02, ..., 31" -#: ../../library/datetime.rst:2376 ../../library/datetime.rst:2389 -#: ../../library/datetime.rst:2392 ../../library/datetime.rst:2398 -#: ../../library/datetime.rst:2401 ../../library/datetime.rst:2407 -#: ../../library/datetime.rst:2425 +#: ../../library/datetime.rst:2423 ../../library/datetime.rst:2436 +#: ../../library/datetime.rst:2439 ../../library/datetime.rst:2445 +#: ../../library/datetime.rst:2448 ../../library/datetime.rst:2454 +#: ../../library/datetime.rst:2472 msgid "\\(9)" msgstr "\\(9)" -#: ../../library/datetime.rst:2379 +#: ../../library/datetime.rst:2426 msgid "``%b``" msgstr "``%b``" -#: ../../library/datetime.rst:2379 +#: ../../library/datetime.rst:2426 msgid "Month as locale's abbreviated name." msgstr "" @@ -3625,11 +3682,11 @@ msgstr "" msgid "Jan, Feb, ..., Dez (de_DE)" msgstr "" -#: ../../library/datetime.rst:2384 +#: ../../library/datetime.rst:2431 msgid "``%B``" msgstr "``%B``" -#: ../../library/datetime.rst:2384 +#: ../../library/datetime.rst:2431 msgid "Month as locale's full name." msgstr "" @@ -3641,67 +3698,67 @@ msgstr "" msgid "Januar, Februar, ..., Dezember (de_DE)" msgstr "" -#: ../../library/datetime.rst:2389 +#: ../../library/datetime.rst:2436 msgid "``%m``" msgstr "``%m``" -#: ../../library/datetime.rst:2389 +#: ../../library/datetime.rst:2436 msgid "Month as a zero-padded decimal number." msgstr "以零填充的並以十進位數字表示的月份。" -#: ../../library/datetime.rst:2389 ../../library/datetime.rst:2401 +#: ../../library/datetime.rst:2436 ../../library/datetime.rst:2448 msgid "01, 02, ..., 12" msgstr "01, 02, ..., 12" -#: ../../library/datetime.rst:2392 +#: ../../library/datetime.rst:2439 msgid "``%y``" msgstr "``%y``" -#: ../../library/datetime.rst:2392 +#: ../../library/datetime.rst:2439 msgid "Year without century as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2392 +#: ../../library/datetime.rst:2439 msgid "00, 01, ..., 99" msgstr "00, 01, ..., 99" -#: ../../library/datetime.rst:2395 +#: ../../library/datetime.rst:2442 msgid "``%Y``" msgstr "``%Y``" -#: ../../library/datetime.rst:2395 +#: ../../library/datetime.rst:2442 msgid "Year with century as a decimal number." msgstr "" -#: ../../library/datetime.rst:2395 ../../library/datetime.rst:2465 +#: ../../library/datetime.rst:2442 ../../library/datetime.rst:2512 msgid "0001, 0002, ..., 2013, 2014, ..., 9998, 9999" msgstr "0001, 0002, ..., 2013, 2014, ..., 9998, 9999" -#: ../../library/datetime.rst:2398 +#: ../../library/datetime.rst:2445 msgid "``%H``" msgstr "``%H``" -#: ../../library/datetime.rst:2398 +#: ../../library/datetime.rst:2445 msgid "Hour (24-hour clock) as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2398 +#: ../../library/datetime.rst:2445 msgid "00, 01, ..., 23" msgstr "00, 01, ..., 23" -#: ../../library/datetime.rst:2401 +#: ../../library/datetime.rst:2448 msgid "``%I``" msgstr "``%I``" -#: ../../library/datetime.rst:2401 +#: ../../library/datetime.rst:2448 msgid "Hour (12-hour clock) as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2404 +#: ../../library/datetime.rst:2451 msgid "``%p``" msgstr "``%p``" -#: ../../library/datetime.rst:2404 +#: ../../library/datetime.rst:2451 msgid "Locale's equivalent of either AM or PM." msgstr "" @@ -3713,128 +3770,128 @@ msgstr "AM, PM (en_US);" msgid "am, pm (de_DE)" msgstr "am, pm (de_DE)" -#: ../../library/datetime.rst:2404 +#: ../../library/datetime.rst:2451 msgid "\\(1), \\(3)" msgstr "\\(1), \\(3)" -#: ../../library/datetime.rst:2407 +#: ../../library/datetime.rst:2454 msgid "``%M``" msgstr "``%M``" -#: ../../library/datetime.rst:2407 +#: ../../library/datetime.rst:2454 msgid "Minute as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2407 ../../library/datetime.rst:2410 +#: ../../library/datetime.rst:2454 ../../library/datetime.rst:2457 msgid "00, 01, ..., 59" msgstr "00, 01, ..., 59" -#: ../../library/datetime.rst:2410 +#: ../../library/datetime.rst:2457 msgid "``%S``" msgstr "``%S``" -#: ../../library/datetime.rst:2410 +#: ../../library/datetime.rst:2457 msgid "Second as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2410 +#: ../../library/datetime.rst:2457 msgid "\\(4), \\(9)" msgstr "\\(4), \\(9)" -#: ../../library/datetime.rst:2413 +#: ../../library/datetime.rst:2460 msgid "``%f``" msgstr "``%f``" -#: ../../library/datetime.rst:2413 +#: ../../library/datetime.rst:2460 msgid "Microsecond as a decimal number, zero-padded to 6 digits." msgstr "" -#: ../../library/datetime.rst:2413 +#: ../../library/datetime.rst:2460 msgid "000000, 000001, ..., 999999" msgstr "000000, 000001, ..., 999999" -#: ../../library/datetime.rst:2413 +#: ../../library/datetime.rst:2460 msgid "\\(5)" msgstr "\\(5)" -#: ../../library/datetime.rst:2417 ../../library/datetime.rst:2576 +#: ../../library/datetime.rst:2464 ../../library/datetime.rst:2623 msgid "``%z``" msgstr "``%z``" -#: ../../library/datetime.rst:2417 +#: ../../library/datetime.rst:2464 msgid "" "UTC offset in the form ``±HHMM[SS[.ffffff]]`` (empty string if the object is " "naive)." msgstr "" -#: ../../library/datetime.rst:2417 +#: ../../library/datetime.rst:2464 msgid "(empty), +0000, -0400, +1030, +063415, -030712.345216" msgstr "" -#: ../../library/datetime.rst:2417 ../../library/datetime.rst:2422 -#: ../../library/datetime.rst:2479 +#: ../../library/datetime.rst:2464 ../../library/datetime.rst:2469 +#: ../../library/datetime.rst:2526 msgid "\\(6)" msgstr "\\(6)" -#: ../../library/datetime.rst:2422 ../../library/datetime.rst:2602 +#: ../../library/datetime.rst:2469 ../../library/datetime.rst:2649 msgid "``%Z``" msgstr "``%Z``" -#: ../../library/datetime.rst:2422 +#: ../../library/datetime.rst:2469 msgid "Time zone name (empty string if the object is naive)." msgstr "" -#: ../../library/datetime.rst:2422 +#: ../../library/datetime.rst:2469 msgid "(empty), UTC, GMT" msgstr "" -#: ../../library/datetime.rst:2425 +#: ../../library/datetime.rst:2472 msgid "``%j``" msgstr "``%j``" -#: ../../library/datetime.rst:2425 +#: ../../library/datetime.rst:2472 msgid "Day of the year as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2425 +#: ../../library/datetime.rst:2472 msgid "001, 002, ..., 366" msgstr "001, 002, ..., 366" -#: ../../library/datetime.rst:2428 +#: ../../library/datetime.rst:2475 msgid "``%U``" msgstr "``%U``" -#: ../../library/datetime.rst:2428 +#: ../../library/datetime.rst:2475 msgid "" "Week number of the year (Sunday as the first day of the week) as a zero-" "padded decimal number. All days in a new year preceding the first Sunday are " "considered to be in week 0." msgstr "" -#: ../../library/datetime.rst:2428 ../../library/datetime.rst:2436 +#: ../../library/datetime.rst:2475 ../../library/datetime.rst:2483 msgid "00, 01, ..., 53" msgstr "00, 01, ..., 53" -#: ../../library/datetime.rst:2428 ../../library/datetime.rst:2436 +#: ../../library/datetime.rst:2475 ../../library/datetime.rst:2483 msgid "\\(7), \\(9)" msgstr "\\(7), \\(9)" -#: ../../library/datetime.rst:2436 +#: ../../library/datetime.rst:2483 msgid "``%W``" msgstr "``%W``" -#: ../../library/datetime.rst:2436 +#: ../../library/datetime.rst:2483 msgid "" "Week number of the year (Monday as the first day of the week) as a zero-" "padded decimal number. All days in a new year preceding the first Monday are " "considered to be in week 0." msgstr "" -#: ../../library/datetime.rst:2444 +#: ../../library/datetime.rst:2491 msgid "``%c``" msgstr "``%c``" -#: ../../library/datetime.rst:2444 +#: ../../library/datetime.rst:2491 msgid "Locale's appropriate date and time representation." msgstr "" @@ -3846,11 +3903,11 @@ msgstr "" msgid "Di 16 Aug 21:30:00 1988 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2449 +#: ../../library/datetime.rst:2496 msgid "``%x``" msgstr "``%x``" -#: ../../library/datetime.rst:2449 +#: ../../library/datetime.rst:2496 msgid "Locale's appropriate date representation." msgstr "" @@ -3866,11 +3923,11 @@ msgstr "" msgid "16.08.1988 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2453 +#: ../../library/datetime.rst:2500 msgid "``%X``" msgstr "``%X``" -#: ../../library/datetime.rst:2453 +#: ../../library/datetime.rst:2500 msgid "Locale's appropriate time representation." msgstr "" @@ -3882,83 +3939,83 @@ msgstr "" msgid "21:30:00 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2456 +#: ../../library/datetime.rst:2503 msgid "``%%``" msgstr "``%%``" -#: ../../library/datetime.rst:2456 +#: ../../library/datetime.rst:2503 msgid "A literal ``'%'`` character." msgstr "" -#: ../../library/datetime.rst:2456 +#: ../../library/datetime.rst:2503 msgid "%" msgstr "%" -#: ../../library/datetime.rst:2459 +#: ../../library/datetime.rst:2506 msgid "" "Several additional directives not required by the C89 standard are included " "for convenience. These parameters all correspond to ISO 8601 date values." msgstr "" -#: ../../library/datetime.rst:2465 +#: ../../library/datetime.rst:2512 msgid "``%G``" msgstr "``%G``" -#: ../../library/datetime.rst:2465 +#: ../../library/datetime.rst:2512 msgid "" "ISO 8601 year with century representing the year that contains the greater " "part of the ISO week (``%V``)." msgstr "" -#: ../../library/datetime.rst:2465 +#: ../../library/datetime.rst:2512 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/datetime.rst:2470 +#: ../../library/datetime.rst:2517 msgid "``%u``" msgstr "``%u``" -#: ../../library/datetime.rst:2470 +#: ../../library/datetime.rst:2517 msgid "ISO 8601 weekday as a decimal number where 1 is Monday." msgstr "" -#: ../../library/datetime.rst:2470 +#: ../../library/datetime.rst:2517 msgid "1, 2, ..., 7" msgstr "1, 2, ..., 7" -#: ../../library/datetime.rst:2473 +#: ../../library/datetime.rst:2520 msgid "``%V``" msgstr "``%V``" -#: ../../library/datetime.rst:2473 +#: ../../library/datetime.rst:2520 msgid "" "ISO 8601 week as a decimal number with Monday as the first day of the week. " "Week 01 is the week containing Jan 4." msgstr "" -#: ../../library/datetime.rst:2473 +#: ../../library/datetime.rst:2520 msgid "01, 02, ..., 53" msgstr "01, 02, ..., 53" -#: ../../library/datetime.rst:2473 +#: ../../library/datetime.rst:2520 msgid "\\(8), \\(9)" msgstr "\\(8), \\(9)" -#: ../../library/datetime.rst:2479 ../../library/datetime.rst:2598 +#: ../../library/datetime.rst:2526 ../../library/datetime.rst:2645 msgid "``%:z``" msgstr "``%:z``" -#: ../../library/datetime.rst:2479 +#: ../../library/datetime.rst:2526 msgid "" "UTC offset in the form ``±HH:MM[:SS[.ffffff]]`` (empty string if the object " "is naive)." msgstr "" -#: ../../library/datetime.rst:2479 +#: ../../library/datetime.rst:2526 msgid "(empty), +00:00, -04:00, +10:30, +06:34:15, -03:07:12.345216" msgstr "" -#: ../../library/datetime.rst:2485 +#: ../../library/datetime.rst:2532 msgid "" "These may not be available on all platforms when used with the :meth:`~." "datetime.strftime` method. The ISO 8601 year and ISO 8601 week directives " @@ -3967,7 +4024,7 @@ msgid "" "directives will raise a :exc:`ValueError`." msgstr "" -#: ../../library/datetime.rst:2490 +#: ../../library/datetime.rst:2537 msgid "" "The full set of format codes supported varies across platforms, because " "Python calls the platform C library's :c:func:`strftime` function, and " @@ -3977,44 +4034,44 @@ msgid "" "unsupported format specifiers." msgstr "" -#: ../../library/datetime.rst:2496 +#: ../../library/datetime.rst:2543 msgid "``%G``, ``%u`` and ``%V`` were added." msgstr "新增 ``%G``、``%u`` 與 ``%V``。" -#: ../../library/datetime.rst:2499 +#: ../../library/datetime.rst:2546 msgid "``%:z`` was added." msgstr "新增 ``%:z``。" -#: ../../library/datetime.rst:2503 +#: ../../library/datetime.rst:2550 msgid "Technical Detail" msgstr "技術細節" -#: ../../library/datetime.rst:2505 +#: ../../library/datetime.rst:2552 msgid "" "Broadly speaking, ``d.strftime(fmt)`` acts like the :mod:`time` module's " "``time.strftime(fmt, d.timetuple())`` although not all objects support a :" "meth:`~date.timetuple` method." msgstr "" -#: ../../library/datetime.rst:2509 +#: ../../library/datetime.rst:2556 msgid "" "For the :meth:`.datetime.strptime` class method, the default value is " "``1900-01-01T00:00:00.000``: any components not specified in the format " "string will be pulled from the default value. [#]_" msgstr "" -#: ../../library/datetime.rst:2513 +#: ../../library/datetime.rst:2560 msgid "Using ``datetime.strptime(date_string, format)`` is equivalent to::" msgstr "" -#: ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2564 msgid "" "except when the format includes sub-second components or time zone offset " "information, which are supported in ``datetime.strptime`` but are discarded " "by ``time.strptime``." msgstr "" -#: ../../library/datetime.rst:2521 +#: ../../library/datetime.rst:2568 msgid "" "For :class:`.time` objects, the format codes for year, month, and day should " "not be used, as :class:`!time` objects have no such values. If they're used " @@ -4024,7 +4081,7 @@ msgstr "" "time` 物件並沒有這些值。如果使用這些格式碼,年份會以 1900 代替、月及日會以 1 " "代替。" -#: ../../library/datetime.rst:2525 +#: ../../library/datetime.rst:2572 msgid "" "For :class:`date` objects, the format codes for hours, minutes, seconds, and " "microseconds should not be used, as :class:`date` objects have no such " @@ -4033,7 +4090,7 @@ msgstr "" "對 :class:`.date` 物件來說,不應該使用時、分、秒、微秒的格式碼,因為 :class:" "`date` 物件並沒有這些值。如果使用這些格式碼,這些值都會以 0 代替。" -#: ../../library/datetime.rst:2529 +#: ../../library/datetime.rst:2576 msgid "" "For the same reason, handling of format strings containing Unicode code " "points that can't be represented in the charset of the current locale is " @@ -4042,7 +4099,7 @@ msgid "" "`UnicodeError` or return an empty string instead." msgstr "" -#: ../../library/datetime.rst:2538 +#: ../../library/datetime.rst:2585 msgid "" "Because the format depends on the current locale, care should be taken when " "making assumptions about the output value. Field orderings will vary (for " @@ -4050,38 +4107,38 @@ msgid "" "contain non-ASCII characters." msgstr "" -#: ../../library/datetime.rst:2544 +#: ../../library/datetime.rst:2591 msgid "" "The :meth:`~.datetime.strptime` method can parse years in the full [1, 9999] " "range, but years < 1000 must be zero-filled to 4-digit width." msgstr "" -#: ../../library/datetime.rst:2547 +#: ../../library/datetime.rst:2594 msgid "" "In previous versions, :meth:`~.datetime.strftime` method was restricted to " "years >= 1900." msgstr "" -#: ../../library/datetime.rst:2551 +#: ../../library/datetime.rst:2598 msgid "" "In version 3.2, :meth:`~.datetime.strftime` method was restricted to years " ">= 1000." msgstr "" -#: ../../library/datetime.rst:2556 +#: ../../library/datetime.rst:2603 msgid "" "When used with the :meth:`~.datetime.strptime` method, the ``%p`` directive " "only affects the output hour field if the ``%I`` directive is used to parse " "the hour." msgstr "" -#: ../../library/datetime.rst:2560 +#: ../../library/datetime.rst:2607 msgid "" "Unlike the :mod:`time` module, the :mod:`!datetime` module does not support " "leap seconds." msgstr "" -#: ../../library/datetime.rst:2564 +#: ../../library/datetime.rst:2611 msgid "" "When used with the :meth:`~.datetime.strptime` method, the ``%f`` directive " "accepts from one to six digits and zero pads on the right. ``%f`` is an " @@ -4089,17 +4146,17 @@ msgid "" "separately in datetime objects, and therefore always available)." msgstr "" -#: ../../library/datetime.rst:2571 +#: ../../library/datetime.rst:2618 msgid "" "For a naive object, the ``%z``, ``%:z`` and ``%Z`` format codes are replaced " "by empty strings." msgstr "" -#: ../../library/datetime.rst:2574 +#: ../../library/datetime.rst:2621 msgid "For an aware object:" msgstr "" -#: ../../library/datetime.rst:2577 +#: ../../library/datetime.rst:2624 msgid "" ":meth:`~.datetime.utcoffset` is transformed into a string of the form " "``±HHMM[SS[.ffffff]]``, where ``HH`` is a 2-digit string giving the number " @@ -4113,7 +4170,7 @@ msgid "" "replaced with the string ``'-0330'``." msgstr "" -#: ../../library/datetime.rst:2591 +#: ../../library/datetime.rst:2638 msgid "" "When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` " "method, the UTC offsets can have a colon as a separator between hours, " @@ -4122,53 +4179,53 @@ msgid "" "``'+00:00'``." msgstr "" -#: ../../library/datetime.rst:2599 +#: ../../library/datetime.rst:2646 msgid "" "Behaves exactly as ``%z``, but has a colon separator added between hours, " "minutes and seconds." msgstr "" -#: ../../library/datetime.rst:2603 +#: ../../library/datetime.rst:2650 msgid "" "In :meth:`~.datetime.strftime`, ``%Z`` is replaced by an empty string if :" "meth:`~.datetime.tzname` returns ``None``; otherwise ``%Z`` is replaced by " "the returned value, which must be a string." msgstr "" -#: ../../library/datetime.rst:2607 +#: ../../library/datetime.rst:2654 msgid ":meth:`~.datetime.strptime` only accepts certain values for ``%Z``:" msgstr "" -#: ../../library/datetime.rst:2609 +#: ../../library/datetime.rst:2656 msgid "any value in ``time.tzname`` for your machine's locale" msgstr "" -#: ../../library/datetime.rst:2610 +#: ../../library/datetime.rst:2657 msgid "the hard-coded values ``UTC`` and ``GMT``" msgstr "" -#: ../../library/datetime.rst:2612 +#: ../../library/datetime.rst:2659 msgid "" "So someone living in Japan may have ``JST``, ``UTC``, and ``GMT`` as valid " "values, but probably not ``EST``. It will raise ``ValueError`` for invalid " "values." msgstr "" -#: ../../library/datetime.rst:2616 +#: ../../library/datetime.rst:2663 msgid "" "When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` " "method, an aware :class:`.datetime` object will be produced. The ``tzinfo`` " "of the result will be set to a :class:`timezone` instance." msgstr "" -#: ../../library/datetime.rst:2622 +#: ../../library/datetime.rst:2669 msgid "" "When used with the :meth:`~.datetime.strptime` method, ``%U`` and ``%W`` are " "only used in calculations when the day of the week and the calendar year " "(``%Y``) are specified." msgstr "" -#: ../../library/datetime.rst:2627 +#: ../../library/datetime.rst:2674 msgid "" "Similar to ``%U`` and ``%W``, ``%V`` is only used in calculations when the " "day of the week and the ISO year (``%G``) are specified in a :meth:`~." @@ -4176,7 +4233,7 @@ msgid "" "interchangeable." msgstr "" -#: ../../library/datetime.rst:2633 +#: ../../library/datetime.rst:2680 msgid "" "When used with the :meth:`~.datetime.strptime` method, the leading zero is " "optional for formats ``%d``, ``%m``, ``%H``, ``%I``, ``%M``, ``%S``, " @@ -4184,15 +4241,40 @@ msgid "" "zero." msgstr "" -#: ../../library/datetime.rst:2638 +#: ../../library/datetime.rst:2685 +msgid "" +"When parsing a month and day using :meth:`~.datetime.strptime`, always " +"include a year in the format. If the value you need to parse lacks a year, " +"append an explicit dummy leap year. Otherwise your code will raise an " +"exception when it encounters leap day because the default year used by the " +"parser is not a leap year. Users run into this bug every four years..." +msgstr "" + +#: ../../library/datetime.rst:2691 +msgid "" +">>> month_day = \"02/29\"\n" +">>> datetime.strptime(f\"{month_day};1984\", \"%m/%d;%Y\") # No leap year " +"bug.\n" +"datetime.datetime(1984, 2, 29, 0, 0)" +msgstr "" + +#: ../../library/datetime.rst:2697 +msgid "" +":meth:`~.datetime.strptime` calls using a format string containing a day of " +"month without a year now emit a :exc:`DeprecationWarning`. In 3.15 or later " +"we may change this into an error or change the default year to a leap year. " +"See :gh:`70647`." +msgstr "" + +#: ../../library/datetime.rst:2704 msgid "Footnotes" msgstr "註解" -#: ../../library/datetime.rst:2639 +#: ../../library/datetime.rst:2705 msgid "If, that is, we ignore the effects of Relativity" msgstr "也就是說,我們會忽略相對論的效應" -#: ../../library/datetime.rst:2641 +#: ../../library/datetime.rst:2707 msgid "" "This matches the definition of the \"proleptic Gregorian\" calendar in " "Dershowitz and Reingold's book *Calendrical Calculations*, where it's the " @@ -4201,23 +4283,23 @@ msgid "" "systems." msgstr "" -#: ../../library/datetime.rst:2647 +#: ../../library/datetime.rst:2713 msgid "" "See R. H. van Gent's `guide to the mathematics of the ISO 8601 calendar " "`_ for a good explanation." msgstr "" -#: ../../library/datetime.rst:2651 +#: ../../library/datetime.rst:2717 msgid "" "Passing ``datetime.strptime('Feb 29', '%b %d')`` will fail since 1900 is not " "a leap year." msgstr "" -#: ../../library/datetime.rst:2311 +#: ../../library/datetime.rst:2358 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/datetime.rst:2311 +#: ../../library/datetime.rst:2358 msgid "datetime format" msgstr "datetime format(日期時間格式)" diff --git a/library/dbm.po b/library/dbm.po index baa011d56e..c93cd0d4b0 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,52 +27,79 @@ msgid "**Source code:** :source:`Lib/dbm/__init__.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/__init__.py`" #: ../../library/dbm.rst:11 +#, fuzzy +msgid ":mod:`dbm` is a generic interface to variants of the DBM database:" +msgstr ":mod:`!dbm` --- Unix \"databases\" 的介面" + +#: ../../library/dbm.rst:13 +msgid ":mod:`dbm.sqlite3`" +msgstr "" + +#: ../../library/dbm.rst:14 +msgid ":mod:`dbm.gnu`" +msgstr "" + +#: ../../library/dbm.rst:15 +msgid ":mod:`dbm.ndbm`" +msgstr "" + +#: ../../library/dbm.rst:17 msgid "" -":mod:`dbm` is a generic interface to variants of the DBM database --- :mod:" -"`dbm.gnu` or :mod:`dbm.ndbm`. If none of these modules is installed, the " -"slow-but-simple implementation in module :mod:`dbm.dumb` will be used. " -"There is a `third party interface `_ to the Oracle Berkeley DB." +"If none of these modules are installed, the slow-but-simple implementation " +"in module :mod:`dbm.dumb` will be used. There is a `third party interface " +"`_ to the Oracle Berkeley DB." msgstr "" -#: ../../library/dbm.rst:20 +#: ../../includes/wasm-ios-notavail.rst:3 +msgid ":ref:`Availability `: not WASI, not iOS." +msgstr "" + +#: ../../includes/wasm-ios-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms, or " +"on iOS. See :ref:`wasm-availability` for more information on WASM " +"availability; see :ref:`iOS-availability` for more information on iOS " +"availability." +msgstr "" + +#: ../../library/dbm.rst:26 msgid "" "A tuple containing the exceptions that can be raised by each of the " "supported modules, with a unique exception also named :exc:`dbm.error` as " "the first item --- the latter is used when :exc:`dbm.error` is raised." msgstr "" -#: ../../library/dbm.rst:27 +#: ../../library/dbm.rst:33 msgid "" "This function attempts to guess which of the several simple database modules " -"available --- :mod:`dbm.gnu`, :mod:`dbm.ndbm` or :mod:`dbm.dumb` --- should " -"be used to open a given file." +"available --- :mod:`dbm.sqlite3`, :mod:`dbm.gnu`, :mod:`dbm.ndbm`, or :mod:" +"`dbm.dumb` --- should be used to open a given file." msgstr "" -#: ../../library/dbm.rst:31 +#: ../../library/dbm.rst:37 msgid "Return one of the following values:" msgstr "回傳以下其中一個值:" -#: ../../library/dbm.rst:33 +#: ../../library/dbm.rst:39 msgid "" "``None`` if the file can't be opened because it's unreadable or doesn't exist" msgstr "" -#: ../../library/dbm.rst:34 +#: ../../library/dbm.rst:40 msgid "the empty string (``''``) if the file's format can't be guessed" msgstr "" -#: ../../library/dbm.rst:35 +#: ../../library/dbm.rst:41 msgid "" "a string containing the required module name, such as ``'dbm.ndbm'`` or " "``'dbm.gnu'``" msgstr "" -#: ../../library/dbm.rst:37 ../../library/dbm.rst:202 ../../library/dbm.rst:386 +#: ../../library/dbm.rst:43 ../../library/dbm.rst:248 ../../library/dbm.rst:444 msgid "*filename* accepts a :term:`path-like object`." msgstr "" -#: ../../library/dbm.rst:61 +#: ../../library/dbm.rst:67 msgid "Open a database and return the corresponding database object." msgstr "" @@ -80,7 +107,7 @@ msgstr "" msgid "Parameters" msgstr "參數" -#: ../../library/dbm.rst:63 +#: ../../library/dbm.rst:69 msgid "" "The database file to open. If the database file already exists, the :func:" "`whichdb` function is used to determine its type and the appropriate module " @@ -88,18 +115,18 @@ msgid "" "imported is used." msgstr "" -#: ../../library/dbm.rst:64 ../../library/dbm.rst:174 +#: ../../library/dbm.rst:70 ../../library/dbm.rst:220 msgid "The database file to open." msgstr "要打開的資料庫檔案" -#: ../../library/dbm.rst:66 +#: ../../library/dbm.rst:72 msgid "" "If the database file already exists, the :func:`whichdb` function is used to " "determine its type and the appropriate module is used; if it does not exist, " "the first submodule listed above that can be imported is used." msgstr "" -#: ../../library/dbm.rst:71 ../../library/dbm.rst:297 +#: ../../library/dbm.rst:77 ../../library/dbm.rst:178 ../../library/dbm.rst:349 msgid "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n|" @@ -107,34 +134,36 @@ msgstr "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n|" -#: ../../library/dbm.rst:72 ../../library/dbm.rst:179 ../../library/dbm.rst:298 +#: ../../library/dbm.rst:78 ../../library/dbm.rst:180 ../../library/dbm.rst:225 +#: ../../library/dbm.rst:350 msgid "``'r'`` (default): |flag_r|" msgstr "``'r'`` (default): |flag_r|" -#: ../../library/dbm.rst:73 ../../library/dbm.rst:180 ../../library/dbm.rst:299 -#: ../../library/dbm.rst:367 +#: ../../library/dbm.rst:79 ../../library/dbm.rst:181 ../../library/dbm.rst:226 +#: ../../library/dbm.rst:351 ../../library/dbm.rst:425 msgid "``'w'``: |flag_w|" msgstr "``'w'``: |flag_w|" -#: ../../library/dbm.rst:74 ../../library/dbm.rst:181 ../../library/dbm.rst:300 +#: ../../library/dbm.rst:80 ../../library/dbm.rst:182 ../../library/dbm.rst:227 +#: ../../library/dbm.rst:352 msgid "``'c'``: |flag_c|" msgstr "``'c'``: |flag_c|" -#: ../../library/dbm.rst:75 ../../library/dbm.rst:182 ../../library/dbm.rst:301 -#: ../../library/dbm.rst:369 +#: ../../library/dbm.rst:81 ../../library/dbm.rst:183 ../../library/dbm.rst:228 +#: ../../library/dbm.rst:353 ../../library/dbm.rst:427 msgid "``'n'``: |flag_n|" msgstr "``'n'``: |flag_n|" -#: ../../library/dbm.rst:77 ../../library/dbm.rst:196 ../../library/dbm.rst:303 -#: ../../library/dbm.rst:371 +#: ../../library/dbm.rst:83 ../../library/dbm.rst:242 ../../library/dbm.rst:355 +#: ../../library/dbm.rst:429 msgid "|mode_param_doc|" msgstr "|mode_param_doc|" -#: ../../library/dbm.rst:80 +#: ../../library/dbm.rst:86 msgid "*file* accepts a :term:`path-like object`." msgstr "*file* 接受一個\\ :term:`類路徑物件 `。" -#: ../../library/dbm.rst:83 +#: ../../library/dbm.rst:89 msgid "" "The object returned by :func:`~dbm.open` supports the same basic " "functionality as a :class:`dict`; keys and their corresponding values can be " @@ -143,44 +172,44 @@ msgid "" "setdefault` methods." msgstr "" -#: ../../library/dbm.rst:88 +#: ../../library/dbm.rst:94 msgid "" "Key and values are always stored as :class:`bytes`. This means that when " "strings are used they are implicitly converted to the default encoding " "before being stored." msgstr "" -#: ../../library/dbm.rst:92 +#: ../../library/dbm.rst:98 msgid "" "These objects also support being used in a :keyword:`with` statement, which " "will automatically close them when done." msgstr "" -#: ../../library/dbm.rst:95 +#: ../../library/dbm.rst:101 msgid "" ":meth:`!get` and :meth:`!setdefault` methods are now available for all :mod:" "`dbm` backends." msgstr "" -#: ../../library/dbm.rst:99 +#: ../../library/dbm.rst:105 msgid "" "Added native support for the context management protocol to the objects " "returned by :func:`~dbm.open`." msgstr "" -#: ../../library/dbm.rst:103 +#: ../../library/dbm.rst:109 msgid "" "Deleting a key from a read-only database raises a database module specific " "exception instead of :exc:`KeyError`." msgstr "" -#: ../../library/dbm.rst:107 +#: ../../library/dbm.rst:113 msgid "" "The following example records some hostnames and a corresponding title, and " "then prints out the contents of the database::" msgstr "" -#: ../../library/dbm.rst:110 +#: ../../library/dbm.rst:116 msgid "" "import dbm\n" "\n" @@ -207,51 +236,86 @@ msgid "" "# db is automatically closed when leaving the with statement." msgstr "" -#: ../../library/dbm.rst:137 +#: ../../library/dbm.rst:143 msgid "Module :mod:`shelve`" msgstr ":mod:`shelve` 模組" -#: ../../library/dbm.rst:138 +#: ../../library/dbm.rst:144 msgid "Persistence module which stores non-string data." msgstr "" -#: ../../library/dbm.rst:141 +#: ../../library/dbm.rst:147 msgid "The individual submodules are described in the following sections." msgstr "" -#: ../../library/dbm.rst:145 +#: ../../library/dbm.rst:150 +msgid ":mod:`dbm.sqlite3` --- SQLite backend for dbm" +msgstr "" + +#: ../../library/dbm.rst:158 +#, fuzzy +msgid "**Source code:** :source:`Lib/dbm/sqlite3.py`" +msgstr "**原始碼:**\\ :source:`Lib/dbm/gnu.py`" + +#: ../../library/dbm.rst:162 +msgid "" +"This module uses the standard library :mod:`sqlite3` module to provide an " +"SQLite backend for the :mod:`dbm` module. The files created by :mod:`dbm." +"sqlite3` can thus be opened by :mod:`sqlite3`, or any other SQLite browser, " +"including the SQLite CLI." +msgstr "" + +#: ../../library/dbm.rst:169 +msgid "" +"Open an SQLite database. The returned object behaves like a :term:`mapping`, " +"implements a :meth:`!close` method, and supports a \"closing\" context " +"manager via the :keyword:`with` keyword." +msgstr "" + +#: ../../library/dbm.rst:174 +#, fuzzy +msgid "The path to the database to be opened." +msgstr "要打開的資料庫檔案" + +#: ../../library/dbm.rst:185 +msgid "" +"The Unix file access mode of the file (default: octal ``0o666``), used only " +"when the database has to be created." +msgstr "" + +#: ../../library/dbm.rst:191 msgid ":mod:`dbm.gnu` --- GNU database manager" msgstr ":mod:`dbm.gnu` --- GNU 資料庫管理器" -#: ../../library/dbm.rst:151 +#: ../../library/dbm.rst:197 msgid "**Source code:** :source:`Lib/dbm/gnu.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/gnu.py`" -#: ../../library/dbm.rst:155 +#: ../../library/dbm.rst:201 msgid "" "The :mod:`dbm.gnu` module provides an interface to the :abbr:`GDBM (GNU " "dbm)` library, similar to the :mod:`dbm.ndbm` module, but with additional " "functionality like crash tolerance." msgstr "" -#: ../../library/dbm.rst:161 ../../library/dbm.rst:267 +#: ../../library/dbm.rst:207 ../../library/dbm.rst:319 msgid "" "The file formats created by :mod:`dbm.gnu` and :mod:`dbm.ndbm` are " "incompatible and can not be used interchangeably." msgstr "" -#: ../../library/dbm.rst:166 +#: ../../library/dbm.rst:212 msgid "" "Raised on :mod:`dbm.gnu`-specific errors, such as I/O errors. :exc:" "`KeyError` is raised for general mapping errors like specifying an incorrect " "key." msgstr "" -#: ../../library/dbm.rst:172 +#: ../../library/dbm.rst:218 msgid "Open a GDBM database and return a :class:`!gdbm` object." msgstr "" -#: ../../library/dbm.rst:178 +#: ../../library/dbm.rst:224 msgid "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n| The following additional characters may be appended to " @@ -263,29 +327,29 @@ msgid "" "flag characters." msgstr "" -#: ../../library/dbm.rst:184 +#: ../../library/dbm.rst:230 msgid "" "The following additional characters may be appended to control how the " "database is opened:" msgstr "" -#: ../../library/dbm.rst:187 +#: ../../library/dbm.rst:233 msgid "" "``'f'``: Open the database in fast mode. Writes to the database will not be " "synchronized." msgstr "" -#: ../../library/dbm.rst:189 +#: ../../library/dbm.rst:235 msgid "" "``'s'``: Synchronized mode. Changes to the database will be written " "immediately to the file." msgstr "" -#: ../../library/dbm.rst:191 +#: ../../library/dbm.rst:237 msgid "``'u'``: Do not lock database." msgstr "``'u'``: 不要鎖住資料庫。" -#: ../../library/dbm.rst:193 +#: ../../library/dbm.rst:239 msgid "" "Not all flags are valid for all versions of GDBM. See the :data:`open_flags` " "member for a list of supported flag characters." @@ -295,24 +359,24 @@ msgstr "" msgid "Raises" msgstr "引發" -#: ../../library/dbm.rst:199 +#: ../../library/dbm.rst:245 msgid "If an invalid *flag* argument is passed." msgstr "如果一個無效的 *flag* 引數被傳入。" -#: ../../library/dbm.rst:207 +#: ../../library/dbm.rst:253 msgid "" "A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` " "supports." msgstr "" -#: ../../library/dbm.rst:209 +#: ../../library/dbm.rst:255 msgid "" ":class:`!gdbm` objects behave similar to :term:`mappings `, but :" "meth:`!items` and :meth:`!values` methods are not supported. The following " "methods are also provided:" msgstr "" -#: ../../library/dbm.rst:215 +#: ../../library/dbm.rst:261 msgid "" "It's possible to loop over every key in the database using this method and " "the :meth:`nextkey` method. The traversal is ordered by GDBM's internal " @@ -320,14 +384,14 @@ msgid "" "starting key." msgstr "" -#: ../../library/dbm.rst:222 +#: ../../library/dbm.rst:268 msgid "" "Returns the key that follows *key* in the traversal. The following code " "prints every key in the database ``db``, without having to create a list in " "memory that contains them all::" msgstr "" -#: ../../library/dbm.rst:226 +#: ../../library/dbm.rst:272 msgid "" "k = db.firstkey()\n" "while k is not None:\n" @@ -339,7 +403,7 @@ msgstr "" " print(k)\n" " k = db.nextkey(k)" -#: ../../library/dbm.rst:233 +#: ../../library/dbm.rst:279 msgid "" "If you have carried out a lot of deletions and would like to shrink the " "space used by the GDBM file, this routine will reorganize the database. :" @@ -348,32 +412,37 @@ msgid "" "reused as new (key, value) pairs are added." msgstr "" -#: ../../library/dbm.rst:241 +#: ../../library/dbm.rst:287 msgid "" "When the database has been opened in fast mode, this method forces any " "unwritten data to be written to the disk." msgstr "" -#: ../../library/dbm.rst:246 +#: ../../library/dbm.rst:292 msgid "Close the GDBM database." msgstr "關閉 GDBM 資料庫。" -#: ../../library/dbm.rst:250 +#: ../../library/dbm.rst:296 +#, fuzzy +msgid "Remove all items from the GDBM database." +msgstr "關閉 GDBM 資料庫。" + +#: ../../library/dbm.rst:302 msgid ":mod:`dbm.ndbm` --- New Database Manager" msgstr ":mod:`dbm.ndbm` --- 新資料庫管理器" -#: ../../library/dbm.rst:256 +#: ../../library/dbm.rst:308 msgid "**Source code:** :source:`Lib/dbm/ndbm.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/ndbm.py`" -#: ../../library/dbm.rst:260 +#: ../../library/dbm.rst:312 msgid "" "The :mod:`dbm.ndbm` module provides an interface to the :abbr:`NDBM (New " "Database Manager)` library. This module can be used with the \"classic\" " "NDBM interface or the :abbr:`GDBM (GNU dbm)` compatibility interface." msgstr "" -#: ../../library/dbm.rst:272 +#: ../../library/dbm.rst:324 msgid "" "The NDBM library shipped as part of macOS has an undocumented limitation on " "the size of values, which can result in corrupted database files when " @@ -381,51 +450,56 @@ msgid "" "result in a hard crash (segmentation fault)." msgstr "" -#: ../../library/dbm.rst:279 +#: ../../library/dbm.rst:331 msgid "" "Raised on :mod:`dbm.ndbm`-specific errors, such as I/O errors. :exc:" "`KeyError` is raised for general mapping errors like specifying an incorrect " "key." msgstr "" -#: ../../library/dbm.rst:285 +#: ../../library/dbm.rst:337 msgid "Name of the NDBM implementation library used." msgstr "" -#: ../../library/dbm.rst:290 +#: ../../library/dbm.rst:342 msgid "Open an NDBM database and return an :class:`!ndbm` object." msgstr "" -#: ../../library/dbm.rst:292 +#: ../../library/dbm.rst:344 msgid "" "The basename of the database file (without the :file:`.dir` or :file:`.pag` " "extensions)." msgstr "" -#: ../../library/dbm.rst:306 +#: ../../library/dbm.rst:358 msgid "" ":class:`!ndbm` objects behave similar to :term:`mappings `, but :" "meth:`!items` and :meth:`!values` methods are not supported. The following " "methods are also provided:" msgstr "" -#: ../../library/dbm.rst:310 +#: ../../library/dbm.rst:362 msgid "Accepts :term:`path-like object` for filename." msgstr "" -#: ../../library/dbm.rst:315 +#: ../../library/dbm.rst:367 msgid "Close the NDBM database." msgstr "關閉 NDBM 資料庫。" -#: ../../library/dbm.rst:319 +#: ../../library/dbm.rst:371 +#, fuzzy +msgid "Remove all items from the NDBM database." +msgstr "關閉 NDBM 資料庫。" + +#: ../../library/dbm.rst:377 msgid ":mod:`dbm.dumb` --- Portable DBM implementation" msgstr ":mod:`dbm.dumb` --- 可攜式 DBM 實作" -#: ../../library/dbm.rst:324 +#: ../../library/dbm.rst:382 msgid "**Source code:** :source:`Lib/dbm/dumb.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/dumb.py`" -#: ../../library/dbm.rst:330 +#: ../../library/dbm.rst:388 msgid "" "The :mod:`dbm.dumb` module is intended as a last resort fallback for the :" "mod:`dbm` module when a more robust module is not available. The :mod:`dbm." @@ -433,53 +507,53 @@ msgid "" "the other database modules." msgstr "" -#: ../../library/dbm.rst:337 +#: ../../library/dbm.rst:395 msgid "" "The :mod:`dbm.dumb` module provides a persistent :class:`dict`-like " "interface which is written entirely in Python. Unlike other :mod:`dbm` " "backends, such as :mod:`dbm.gnu`, no external library is required." msgstr "" -#: ../../library/dbm.rst:342 +#: ../../library/dbm.rst:400 msgid "The :mod:`!dbm.dumb` module defines the following:" msgstr ":mod:`!dbm.dumb` 模組定義了以下項目:" -#: ../../library/dbm.rst:346 +#: ../../library/dbm.rst:404 msgid "" "Raised on :mod:`dbm.dumb`-specific errors, such as I/O errors. :exc:" "`KeyError` is raised for general mapping errors like specifying an incorrect " "key." msgstr "" -#: ../../library/dbm.rst:352 +#: ../../library/dbm.rst:410 msgid "" "Open a :mod:`!dbm.dumb` database. The returned database object behaves " "similar to a :term:`mapping`, in addition to providing :meth:`~dumbdbm.sync` " "and :meth:`~dumbdbm.close` methods." msgstr "" -#: ../../library/dbm.rst:357 +#: ../../library/dbm.rst:415 msgid "" "The basename of the database file (without extensions). A new database " "creates the following files: - :file:`{filename}.dat` - :file:`{filename}." "dir`" msgstr "" -#: ../../library/dbm.rst:358 +#: ../../library/dbm.rst:416 msgid "" "The basename of the database file (without extensions). A new database " "creates the following files:" msgstr "" -#: ../../library/dbm.rst:361 +#: ../../library/dbm.rst:419 msgid ":file:`{filename}.dat`" msgstr ":file:`{filename}.dat`" -#: ../../library/dbm.rst:362 +#: ../../library/dbm.rst:420 msgid ":file:`{filename}.dir`" msgstr ":file:`{filename}.dir`" -#: ../../library/dbm.rst:365 +#: ../../library/dbm.rst:423 msgid "" "* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (default): |flag_c| * " "``'n'``: |flag_n|" @@ -487,49 +561,49 @@ msgstr "" "* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (default): |flag_c| * " "``'n'``: |flag_n|" -#: ../../library/dbm.rst:366 +#: ../../library/dbm.rst:424 msgid "``'r'``: |flag_r|" msgstr "``'r'``: |flag_r|" -#: ../../library/dbm.rst:368 +#: ../../library/dbm.rst:426 msgid "``'c'`` (default): |flag_c|" msgstr "``'c'`` (default): |flag_c|" -#: ../../library/dbm.rst:375 +#: ../../library/dbm.rst:433 msgid "" "It is possible to crash the Python interpreter when loading a database with " "a sufficiently large/complex entry due to stack depth limitations in " "Python's AST compiler." msgstr "" -#: ../../library/dbm.rst:379 +#: ../../library/dbm.rst:437 msgid "" ":func:`~dbm.dumb.open` always creates a new database when *flag* is ``'n'``." msgstr "" -#: ../../library/dbm.rst:382 +#: ../../library/dbm.rst:440 msgid "" "A database opened read-only if *flag* is ``'r'``. A database is not created " "if it does not exist if *flag* is ``'r'`` or ``'w'``." msgstr "" -#: ../../library/dbm.rst:389 +#: ../../library/dbm.rst:447 msgid "" "In addition to the methods provided by the :class:`collections.abc." "MutableMapping` class, the following methods are provided:" msgstr "" -#: ../../library/dbm.rst:395 +#: ../../library/dbm.rst:453 msgid "" "Synchronize the on-disk directory and data files. This method is called by " "the :meth:`Shelve.sync` method." msgstr "" -#: ../../library/dbm.rst:400 +#: ../../library/dbm.rst:458 msgid "Close the database." msgstr "關閉資料庫。" -#: ../../library/dbm.rst:326 +#: ../../library/dbm.rst:384 msgid "databases" msgstr "databases(資料庫)" diff --git a/library/development.po b/library/development.po index 99e5b0b6c7..ef66cf89b2 100644 --- a/library/development.po +++ b/library/development.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-20 18:08+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,10 +29,9 @@ msgid "" "the :mod:`pydoc` module takes a module and generates documentation based on " "the module's contents. The :mod:`doctest` and :mod:`unittest` modules " "contains frameworks for writing unit tests that automatically exercise code " -"and verify that the expected output is produced. :program:`2to3` can " -"translate Python 2.x source code into valid Python 3.x code." +"and verify that the expected output is produced." msgstr "" -#: ../../library/development.rst:14 +#: ../../library/development.rst:13 msgid "The list of modules described in this chapter is:" msgstr "" diff --git a/library/dis.po b/library/dis.po index e8e917efaa..1d488345c8 100644 --- a/library/dis.po +++ b/library/dis.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-07-27 16:55+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -82,10 +82,17 @@ msgid "" msgstr "" #: ../../library/dis.rst:54 +msgid "" +"The output shows logical labels rather than instruction offsets for jump " +"targets and exception handlers. The ``-O`` command line option and the " +"``show_offsets`` argument were added." +msgstr "" + +#: ../../library/dis.rst:59 msgid "Example: Given the function :func:`!myfunc`::" msgstr "" -#: ../../library/dis.rst:56 +#: ../../library/dis.rst:61 msgid "" "def myfunc(alist):\n" " return len(alist)" @@ -93,87 +100,95 @@ msgstr "" "def myfunc(alist):\n" " return len(alist)" -#: ../../library/dis.rst:59 +#: ../../library/dis.rst:64 msgid "" "the following command can be used to display the disassembly of :func:`!" "myfunc`:" msgstr "" -#: ../../library/dis.rst:62 +#: ../../library/dis.rst:67 msgid "" ">>> dis.dis(myfunc)\n" -" 2 0 RESUME 0\n" +" 2 RESUME 0\n" "\n" -" 3 2 LOAD_GLOBAL 1 (NULL + len)\n" -" 12 LOAD_FAST 0 (alist)\n" -" 14 CALL 1\n" -" 22 RETURN_VALUE" +" 3 LOAD_GLOBAL 1 (len + NULL)\n" +" LOAD_FAST 0 (alist)\n" +" CALL 1\n" +" RETURN_VALUE" msgstr "" ">>> dis.dis(myfunc)\n" -" 2 0 RESUME 0\n" +" 2 RESUME 0\n" "\n" -" 3 2 LOAD_GLOBAL 1 (NULL + len)\n" -" 12 LOAD_FAST 0 (alist)\n" -" 14 CALL 1\n" -" 22 RETURN_VALUE" +" 3 LOAD_GLOBAL 1 (len + NULL)\n" +" LOAD_FAST 0 (alist)\n" +" CALL 1\n" +" RETURN_VALUE" -#: ../../library/dis.rst:72 +#: ../../library/dis.rst:77 msgid "(The \"2\" is a line number)." msgstr "" -#: ../../library/dis.rst:77 +#: ../../library/dis.rst:82 msgid "Command-line interface" msgstr "" -#: ../../library/dis.rst:79 +#: ../../library/dis.rst:84 msgid "The :mod:`dis` module can be invoked as a script from the command line:" msgstr "" -#: ../../library/dis.rst:81 -msgid "python -m dis [-h] [infile]" -msgstr "python -m dis [-h] [infile]" +#: ../../library/dis.rst:86 +msgid "python -m dis [-h] [-C] [-O] [infile]" +msgstr "python -m dis [-h] [-C] [-O] [infile]" -#: ../../library/dis.rst:85 +#: ../../library/dis.rst:90 msgid "The following options are accepted:" msgstr "" -#: ../../library/dis.rst:91 +#: ../../library/dis.rst:96 msgid "Display usage and exit." msgstr "" -#: ../../library/dis.rst:93 +#: ../../library/dis.rst:100 +msgid "Show inline caches." +msgstr "" + +#: ../../library/dis.rst:104 +msgid "Show offsets of instructions." +msgstr "" + +#: ../../library/dis.rst:106 msgid "" "If :file:`infile` is specified, its disassembled code will be written to " -"stdout. Otherwise, disassembly is performed on compiled source code recieved " +"stdout. Otherwise, disassembly is performed on compiled source code received " "from stdin." msgstr "" -#: ../../library/dis.rst:97 +#: ../../library/dis.rst:110 msgid "Bytecode analysis" msgstr "" -#: ../../library/dis.rst:101 +#: ../../library/dis.rst:114 msgid "" "The bytecode analysis API allows pieces of Python code to be wrapped in a :" "class:`Bytecode` object that provides easy access to details of the compiled " "code." msgstr "" -#: ../../library/dis.rst:108 +#: ../../library/dis.rst:121 msgid "" "Analyse the bytecode corresponding to a function, generator, asynchronous " "generator, coroutine, method, string of source code, or a code object (as " "returned by :func:`compile`)." msgstr "" -#: ../../library/dis.rst:112 +#: ../../library/dis.rst:125 msgid "" "This is a convenience wrapper around many of the functions listed below, " "most notably :func:`get_instructions`, as iterating over a :class:`Bytecode` " "instance yields the bytecode operations as :class:`Instruction` instances." msgstr "" -#: ../../library/dis.rst:116 ../../library/dis.rst:304 +#: ../../library/dis.rst:129 ../../library/dis.rst:326 msgid "" "If *first_line* is not ``None``, it indicates the line number that should be " "reported for the first source line in the disassembled code. Otherwise, the " @@ -181,67 +196,73 @@ msgid "" "code object." msgstr "" -#: ../../library/dis.rst:121 +#: ../../library/dis.rst:134 msgid "" "If *current_offset* is not ``None``, it refers to an instruction offset in " "the disassembled code. Setting this means :meth:`.dis` will display a " "\"current instruction\" marker against the specified opcode." msgstr "" -#: ../../library/dis.rst:125 +#: ../../library/dis.rst:138 msgid "" "If *show_caches* is ``True``, :meth:`.dis` will display inline cache entries " "used by the interpreter to specialize the bytecode." msgstr "" -#: ../../library/dis.rst:128 +#: ../../library/dis.rst:141 msgid "" "If *adaptive* is ``True``, :meth:`.dis` will display specialized bytecode " "that may be different from the original bytecode." msgstr "" -#: ../../library/dis.rst:133 +#: ../../library/dis.rst:144 +msgid "" +"If *show_offsets* is ``True``, :meth:`.dis` will include instruction offsets " +"in the output." +msgstr "" + +#: ../../library/dis.rst:149 msgid "" "Construct a :class:`Bytecode` instance from the given traceback, setting " "*current_offset* to the instruction responsible for the exception." msgstr "" -#: ../../library/dis.rst:138 +#: ../../library/dis.rst:154 msgid "The compiled code object." msgstr "" -#: ../../library/dis.rst:142 +#: ../../library/dis.rst:158 msgid "The first source line of the code object (if available)" msgstr "" -#: ../../library/dis.rst:146 +#: ../../library/dis.rst:162 msgid "" "Return a formatted view of the bytecode operations (the same as printed by :" "func:`dis.dis`, but returned as a multi-line string)." msgstr "" -#: ../../library/dis.rst:151 +#: ../../library/dis.rst:167 msgid "" "Return a formatted multi-line string with detailed information about the " "code object, like :func:`code_info`." msgstr "" -#: ../../library/dis.rst:154 ../../library/dis.rst:194 -#: ../../library/dis.rst:246 +#: ../../library/dis.rst:170 ../../library/dis.rst:210 +#: ../../library/dis.rst:262 msgid "This can now handle coroutine and asynchronous generator objects." msgstr "" -#: ../../library/dis.rst:157 ../../library/dis.rst:249 -#: ../../library/dis.rst:265 ../../library/dis.rst:292 -#: ../../library/dis.rst:313 +#: ../../library/dis.rst:173 ../../library/dis.rst:265 +#: ../../library/dis.rst:282 ../../library/dis.rst:312 +#: ../../library/dis.rst:335 msgid "Added the *show_caches* and *adaptive* parameters." msgstr "新增 *show_caches* 與 *adaptive* 參數。" -#: ../../library/dis.rst:160 +#: ../../library/dis.rst:176 msgid "Example:" msgstr "範例:" -#: ../../library/dis.rst:162 +#: ../../library/dis.rst:178 msgid "" ">>> bytecode = dis.Bytecode(myfunc)\n" ">>> for instr in bytecode:\n" @@ -263,11 +284,11 @@ msgstr "" "CALL\n" "RETURN_VALUE" -#: ../../library/dis.rst:176 +#: ../../library/dis.rst:192 msgid "Analysis functions" msgstr "" -#: ../../library/dis.rst:178 +#: ../../library/dis.rst:194 msgid "" "The :mod:`dis` module also defines the following analysis functions that " "convert the input directly to the desired output. They can be useful if only " @@ -275,39 +296,39 @@ msgid "" "isn't useful:" msgstr "" -#: ../../library/dis.rst:184 +#: ../../library/dis.rst:200 msgid "" "Return a formatted multi-line string with detailed code object information " "for the supplied function, generator, asynchronous generator, coroutine, " "method, source code string or code object." msgstr "" -#: ../../library/dis.rst:188 +#: ../../library/dis.rst:204 msgid "" "Note that the exact contents of code info strings are highly implementation " "dependent and they may change arbitrarily across Python VMs or Python " "releases." msgstr "" -#: ../../library/dis.rst:200 +#: ../../library/dis.rst:216 msgid "" "Print detailed code object information for the supplied function, method, " "source code string or code object to *file* (or ``sys.stdout`` if *file* is " "not specified)." msgstr "" -#: ../../library/dis.rst:204 +#: ../../library/dis.rst:220 msgid "" "This is a convenient shorthand for ``print(code_info(x), file=file)``, " "intended for interactive exploration at the interpreter prompt." msgstr "" -#: ../../library/dis.rst:209 ../../library/dis.rst:240 -#: ../../library/dis.rst:262 ../../library/dis.rst:289 +#: ../../library/dis.rst:225 ../../library/dis.rst:256 +#: ../../library/dis.rst:279 ../../library/dis.rst:309 msgid "Added *file* parameter." msgstr "新增 *file* 參數。" -#: ../../library/dis.rst:215 +#: ../../library/dis.rst:231 msgid "" "Disassemble the *x* object. *x* can denote either a module, a class, a " "method, a function, a generator, an asynchronous generator, a coroutine, a " @@ -323,100 +344,111 @@ msgid "" "disassembles the last traceback." msgstr "" -#: ../../library/dis.rst:228 ../../library/dis.rst:259 -#: ../../library/dis.rst:286 +#: ../../library/dis.rst:244 ../../library/dis.rst:276 +#: ../../library/dis.rst:306 msgid "" "The disassembly is written as text to the supplied *file* argument if " "provided and to ``sys.stdout`` otherwise." msgstr "" -#: ../../library/dis.rst:231 +#: ../../library/dis.rst:247 msgid "" "The maximal depth of recursion is limited by *depth* unless it is ``None``. " "``depth=0`` means no recursion." msgstr "" -#: ../../library/dis.rst:234 +#: ../../library/dis.rst:250 msgid "" "If *show_caches* is ``True``, this function will display inline cache " "entries used by the interpreter to specialize the bytecode." msgstr "" -#: ../../library/dis.rst:237 +#: ../../library/dis.rst:253 msgid "" "If *adaptive* is ``True``, this function will display specialized bytecode " "that may be different from the original bytecode." msgstr "" -#: ../../library/dis.rst:243 +#: ../../library/dis.rst:259 msgid "Implemented recursive disassembling and added *depth* parameter." msgstr "" -#: ../../library/dis.rst:255 +#: ../../library/dis.rst:272 msgid "" "Disassemble the top-of-stack function of a traceback, using the last " "traceback if none was passed. The instruction causing the exception is " "indicated." msgstr "" -#: ../../library/dis.rst:272 +#: ../../library/dis.rst:285 ../../library/dis.rst:315 +msgid "Added the *show_offsets* parameter." +msgstr "新增 *show_offsets* 參數。" + +#: ../../library/dis.rst:292 msgid "" "Disassemble a code object, indicating the last instruction if *lasti* was " "provided. The output is divided in the following columns:" msgstr "" -#: ../../library/dis.rst:275 +#: ../../library/dis.rst:295 msgid "the line number, for the first instruction of each line" msgstr "" -#: ../../library/dis.rst:276 +#: ../../library/dis.rst:296 msgid "the current instruction, indicated as ``-->``," msgstr "" -#: ../../library/dis.rst:277 +#: ../../library/dis.rst:297 msgid "a labelled instruction, indicated with ``>>``," msgstr "" -#: ../../library/dis.rst:278 +#: ../../library/dis.rst:298 msgid "the address of the instruction," msgstr "" -#: ../../library/dis.rst:279 +#: ../../library/dis.rst:299 msgid "the operation code name," msgstr "" -#: ../../library/dis.rst:280 +#: ../../library/dis.rst:300 msgid "operation parameters, and" msgstr "" -#: ../../library/dis.rst:281 +#: ../../library/dis.rst:301 msgid "interpretation of the parameters in parentheses." msgstr "" -#: ../../library/dis.rst:283 +#: ../../library/dis.rst:303 msgid "" "The parameter interpretation recognizes local and global variable names, " "constant values, branch targets, and compare operators." msgstr "" -#: ../../library/dis.rst:298 +#: ../../library/dis.rst:320 msgid "" "Return an iterator over the instructions in the supplied function, method, " "source code string or code object." msgstr "" -#: ../../library/dis.rst:301 +#: ../../library/dis.rst:323 msgid "" "The iterator generates a series of :class:`Instruction` named tuples giving " "the details of each operation in the supplied code." msgstr "" -#: ../../library/dis.rst:309 +#: ../../library/dis.rst:331 +msgid "The *adaptive* parameter works as it does in :func:`dis`." +msgstr "" + +#: ../../library/dis.rst:338 msgid "" -"The *show_caches* and *adaptive* parameters work as they do in :func:`dis`." +"The *show_caches* parameter is deprecated and has no effect. The iterator " +"generates the :class:`Instruction` instances with the *cache_info* field " +"populated (regardless of the value of *show_caches*) and it no longer " +"generates separate items for the cache entries." msgstr "" -#: ../../library/dis.rst:319 +#: ../../library/dis.rst:346 msgid "" "This generator function uses the :meth:`~codeobject.co_lines` method of the :" "ref:`code object ` *code* to find the offsets which are starts " @@ -424,28 +456,33 @@ msgid "" "pairs." msgstr "" -#: ../../library/dis.rst:324 +#: ../../library/dis.rst:351 msgid "Line numbers can be decreasing. Before, they were always increasing." msgstr "" -#: ../../library/dis.rst:327 +#: ../../library/dis.rst:354 msgid "" "The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of the :" "attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab` " "attributes of the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:335 +#: ../../library/dis.rst:359 +msgid "" +"Line numbers can be ``None`` for bytecode that does not map to source lines." +msgstr "" + +#: ../../library/dis.rst:365 msgid "" "Detect all offsets in the raw compiled bytecode string *code* which are jump " "targets, and return a list of these offsets." msgstr "" -#: ../../library/dis.rst:341 +#: ../../library/dis.rst:371 msgid "Compute the stack effect of *opcode* with argument *oparg*." msgstr "" -#: ../../library/dis.rst:343 +#: ../../library/dis.rst:373 msgid "" "If the code has a jump target and *jump* is ``True``, :func:`~stack_effect` " "will return the stack effect of jumping. If *jump* is ``False``, it will " @@ -453,122 +490,182 @@ msgid "" "it will return the maximal stack effect of both cases." msgstr "" -#: ../../library/dis.rst:350 +#: ../../library/dis.rst:380 msgid "Added *jump* parameter." msgstr "新增 *jump* 參數。" -#: ../../library/dis.rst:357 +#: ../../library/dis.rst:383 +msgid "" +"If ``oparg`` is omitted (or ``None``), the stack effect is now returned for " +"``oparg=0``. Previously this was an error for opcodes that use their arg. It " +"is also no longer an error to pass an integer ``oparg`` when the ``opcode`` " +"does not use it; the ``oparg`` in this case is ignored." +msgstr "" + +#: ../../library/dis.rst:393 msgid "Python Bytecode Instructions" msgstr "" -#: ../../library/dis.rst:359 +#: ../../library/dis.rst:395 msgid "" "The :func:`get_instructions` function and :class:`Bytecode` class provide " "details of bytecode instructions as :class:`Instruction` instances:" msgstr "" -#: ../../library/dis.rst:364 +#: ../../library/dis.rst:400 msgid "Details for a bytecode operation" msgstr "" -#: ../../library/dis.rst:368 +#: ../../library/dis.rst:404 msgid "" "numeric code for operation, corresponding to the opcode values listed below " "and the bytecode values in the :ref:`opcode_collections`." msgstr "" -#: ../../library/dis.rst:374 +#: ../../library/dis.rst:410 msgid "human readable name for operation" msgstr "" -#: ../../library/dis.rst:379 +#: ../../library/dis.rst:415 +msgid "" +"numeric code for the base operation if operation is specialized; otherwise " +"equal to :data:`opcode`" +msgstr "" + +#: ../../library/dis.rst:421 +msgid "" +"human readable name for the base operation if operation is specialized; " +"otherwise equal to :data:`opname`" +msgstr "" + +#: ../../library/dis.rst:427 msgid "numeric argument to operation (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:384 +#: ../../library/dis.rst:431 +msgid "alias for :data:`arg`" +msgstr "" + +#: ../../library/dis.rst:435 msgid "resolved arg value (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:389 +#: ../../library/dis.rst:440 msgid "" "human readable description of operation argument (if any), otherwise an " "empty string." msgstr "" -#: ../../library/dis.rst:395 +#: ../../library/dis.rst:446 msgid "start index of operation within bytecode sequence" msgstr "" -#: ../../library/dis.rst:400 -msgid "line started by this opcode (if any), otherwise ``None``" +#: ../../library/dis.rst:451 +msgid "" +"start index of operation within bytecode sequence, including prefixed " +"``EXTENDED_ARG`` operations if present; otherwise equal to :data:`offset`" +msgstr "" + +#: ../../library/dis.rst:457 +msgid "start index of the cache entries following the operation" +msgstr "" + +#: ../../library/dis.rst:462 +msgid "end index of the cache entries following the operation" +msgstr "" + +#: ../../library/dis.rst:467 +msgid "``True`` if this opcode starts a source line, otherwise ``False``" msgstr "" -#: ../../library/dis.rst:405 +#: ../../library/dis.rst:472 +msgid "" +"source line number associated with this opcode (if any), otherwise ``None``" +msgstr "" + +#: ../../library/dis.rst:477 msgid "``True`` if other code jumps to here, otherwise ``False``" msgstr "" -#: ../../library/dis.rst:410 +#: ../../library/dis.rst:482 +msgid "" +"bytecode index of the jump target if this is a jump operation, otherwise " +"``None``" +msgstr "" + +#: ../../library/dis.rst:488 msgid "" ":class:`dis.Positions` object holding the start and end locations that are " "covered by this instruction." msgstr "" -#: ../../library/dis.rst:417 +#: ../../library/dis.rst:503 msgid "Field ``positions`` is added." msgstr "" -#: ../../library/dis.rst:422 +#: ../../library/dis.rst:507 +msgid "Changed field ``starts_line``." +msgstr "" + +#: ../../library/dis.rst:509 +msgid "" +"Added fields ``start_offset``, ``cache_offset``, ``end_offset``, " +"``baseopname``, ``baseopcode``, ``jump_target``, ``oparg``, ``line_number`` " +"and ``cache_info``." +msgstr "" + +#: ../../library/dis.rst:516 msgid "" "In case the information is not available, some fields might be ``None``." msgstr "" -#: ../../library/dis.rst:432 +#: ../../library/dis.rst:526 msgid "" "The Python compiler currently generates the following bytecode instructions." msgstr "" -#: ../../library/dis.rst:435 +#: ../../library/dis.rst:529 msgid "**General instructions**" msgstr "" -#: ../../library/dis.rst:437 +#: ../../library/dis.rst:531 msgid "" "In the following, We will refer to the interpreter stack as ``STACK`` and " "describe operations on it as if it was a Python list. The top of the stack " "corresponds to ``STACK[-1]`` in this language." msgstr "" -#: ../../library/dis.rst:443 +#: ../../library/dis.rst:537 msgid "" "Do nothing code. Used as a placeholder by the bytecode optimizer, and to " "generate line tracing events." msgstr "" -#: ../../library/dis.rst:449 +#: ../../library/dis.rst:543 msgid "Removes the top-of-stack item::" msgstr "" -#: ../../library/dis.rst:451 +#: ../../library/dis.rst:545 msgid "STACK.pop()" msgstr "STACK.pop()" -#: ../../library/dis.rst:456 +#: ../../library/dis.rst:550 msgid "" -"Removes the top two values from the stack. Equivalent to ``POP_TOP``; " -"``POP_TOP``. Used to clean up at the end of loops, hence the name." +"Removes the top-of-stack item. Equivalent to ``POP_TOP``. Used to clean up " +"at the end of loops, hence the name." msgstr "" -#: ../../library/dis.rst:465 +#: ../../library/dis.rst:559 msgid "Implements ``del STACK[-2]``. Used to clean up when a generator exits." msgstr "" -#: ../../library/dis.rst:473 +#: ../../library/dis.rst:567 msgid "" "Push the i-th item to the top of the stack without removing it from its " "original location::" msgstr "" -#: ../../library/dis.rst:476 +#: ../../library/dis.rst:570 msgid "" "assert i > 0\n" "STACK.append(STACK[-i])" @@ -576,15 +673,15 @@ msgstr "" "assert i > 0\n" "STACK.append(STACK[-i])" -#: ../../library/dis.rst:484 +#: ../../library/dis.rst:578 msgid "Swap the top of the stack with the i-th element::" msgstr "" -#: ../../library/dis.rst:486 +#: ../../library/dis.rst:580 msgid "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" msgstr "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" -#: ../../library/dis.rst:493 +#: ../../library/dis.rst:587 msgid "" "Rather than being an actual instruction, this opcode is used to mark extra " "space for the interpreter to cache useful data directly in the bytecode " @@ -592,77 +689,86 @@ msgid "" "viewed with ``show_caches=True``." msgstr "" -#: ../../library/dis.rst:498 +#: ../../library/dis.rst:592 msgid "" "Logically, this space is part of the preceding instruction. Many opcodes " "expect to be followed by an exact number of caches, and will instruct the " "interpreter to skip over them at runtime." msgstr "" -#: ../../library/dis.rst:502 +#: ../../library/dis.rst:596 msgid "" "Populated caches can look like arbitrary instructions, so great care should " "be taken when reading or modifying raw, adaptive bytecode containing " "quickened data." msgstr "" -#: ../../library/dis.rst:509 +#: ../../library/dis.rst:603 msgid "**Unary operations**" msgstr "" -#: ../../library/dis.rst:511 +#: ../../library/dis.rst:605 msgid "" "Unary operations take the top of the stack, apply the operation, and push " "the result back on the stack." msgstr "" -#: ../../library/dis.rst:517 +#: ../../library/dis.rst:611 msgid "Implements ``STACK[-1] = -STACK[-1]``." msgstr "" -#: ../../library/dis.rst:522 +#: ../../library/dis.rst:616 msgid "Implements ``STACK[-1] = not STACK[-1]``." msgstr "" -#: ../../library/dis.rst:527 +#: ../../library/dis.rst:618 ../../library/dis.rst:1313 +#: ../../library/dis.rst:1329 +msgid "This instruction now requires an exact :class:`bool` operand." +msgstr "" + +#: ../../library/dis.rst:624 msgid "Implements ``STACK[-1] = ~STACK[-1]``." msgstr "" -#: ../../library/dis.rst:532 +#: ../../library/dis.rst:629 msgid "Implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:537 +#: ../../library/dis.rst:634 msgid "" "If ``STACK[-1]`` is a :term:`generator iterator` or :term:`coroutine` object " "it is left as is. Otherwise, implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:543 +#: ../../library/dis.rst:642 +msgid "Implements ``STACK[-1] = bool(STACK[-1])``." +msgstr "" + +#: ../../library/dis.rst:647 msgid "**Binary and in-place operations**" msgstr "" -#: ../../library/dis.rst:545 +#: ../../library/dis.rst:649 msgid "" "Binary operations remove the top two items from the stack (``STACK[-1]`` and " "``STACK[-2]``). They perform the operation, then put the result back on the " "stack." msgstr "" -#: ../../library/dis.rst:548 +#: ../../library/dis.rst:652 msgid "" "In-place operations are like binary operations, but the operation is done in-" "place when ``STACK[-2]`` supports it, and the resulting ``STACK[-1]`` may be " "(but does not have to be) the original ``STACK[-2]``." msgstr "" -#: ../../library/dis.rst:555 +#: ../../library/dis.rst:659 msgid "" "Implements the binary and in-place operators (depending on the value of " "*op*)::" msgstr "" -#: ../../library/dis.rst:558 +#: ../../library/dis.rst:662 msgid "" "rhs = STACK.pop()\n" "lhs = STACK.pop()\n" @@ -672,17 +778,17 @@ msgstr "" "lhs = STACK.pop()\n" "STACK.append(lhs op rhs)" -#: ../../library/dis.rst:567 ../../library/dis.rst:576 -#: ../../library/dis.rst:586 ../../library/dis.rst:594 -#: ../../library/dis.rst:606 ../../library/dis.rst:694 -#: ../../library/dis.rst:704 ../../library/dis.rst:714 -#: ../../library/dis.rst:934 ../../library/dis.rst:945 -#: ../../library/dis.rst:1049 ../../library/dis.rst:1061 -#: ../../library/dis.rst:1073 +#: ../../library/dis.rst:671 ../../library/dis.rst:680 +#: ../../library/dis.rst:690 ../../library/dis.rst:698 +#: ../../library/dis.rst:710 ../../library/dis.rst:798 +#: ../../library/dis.rst:808 ../../library/dis.rst:818 +#: ../../library/dis.rst:1041 ../../library/dis.rst:1052 +#: ../../library/dis.rst:1156 ../../library/dis.rst:1168 +#: ../../library/dis.rst:1180 msgid "Implements::" msgstr "" -#: ../../library/dis.rst:569 +#: ../../library/dis.rst:673 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -692,7 +798,7 @@ msgstr "" "container = STACK.pop()\n" "STACK.append(container[key])" -#: ../../library/dis.rst:578 +#: ../../library/dis.rst:682 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -704,7 +810,7 @@ msgstr "" "value = STACK.pop()\n" "container[key] = value" -#: ../../library/dis.rst:588 +#: ../../library/dis.rst:692 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -714,7 +820,7 @@ msgstr "" "container = STACK.pop()\n" "del container[key]" -#: ../../library/dis.rst:596 +#: ../../library/dis.rst:700 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -726,7 +832,7 @@ msgstr "" "container = STACK.pop()\n" "STACK.append(container[start:end])" -#: ../../library/dis.rst:608 +#: ../../library/dis.rst:712 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -740,11 +846,11 @@ msgstr "" "values = STACK.pop()\n" "container[start:end] = value" -#: ../../library/dis.rst:617 +#: ../../library/dis.rst:721 msgid "**Coroutine opcodes**" msgstr "" -#: ../../library/dis.rst:621 +#: ../../library/dis.rst:725 msgid "" "Implements ``STACK[-1] = get_awaitable(STACK[-1])``, where " "``get_awaitable(o)`` returns ``o`` if ``o`` is a coroutine object or a " @@ -752,39 +858,39 @@ msgid "" "resolves ``o.__await__``." msgstr "" -#: ../../library/dis.rst:626 +#: ../../library/dis.rst:730 msgid "" "If the ``where`` operand is nonzero, it indicates where the instruction " "occurs:" msgstr "" -#: ../../library/dis.rst:629 +#: ../../library/dis.rst:733 msgid "``1``: After a call to ``__aenter__``" msgstr "" -#: ../../library/dis.rst:630 +#: ../../library/dis.rst:734 msgid "``2``: After a call to ``__aexit__``" msgstr "" -#: ../../library/dis.rst:634 +#: ../../library/dis.rst:738 msgid "Previously, this instruction did not have an oparg." msgstr "" -#: ../../library/dis.rst:640 +#: ../../library/dis.rst:744 msgid "Implements ``STACK[-1] = STACK[-1].__aiter__()``." msgstr "" -#: ../../library/dis.rst:643 +#: ../../library/dis.rst:747 msgid "Returning awaitable objects from ``__aiter__`` is no longer supported." msgstr "" -#: ../../library/dis.rst:650 +#: ../../library/dis.rst:754 msgid "" "Implement ``STACK.append(get_awaitable(STACK[-1].__anext__()))`` to the " "stack. See ``GET_AWAITABLE`` for details about ``get_awaitable``." msgstr "" -#: ../../library/dis.rst:658 +#: ../../library/dis.rst:762 msgid "" "Terminates an :keyword:`async for` loop. Handles an exception raised when " "awaiting a next item. The stack contains the async iterable in ``STACK[-2]`` " @@ -792,13 +898,13 @@ msgid "" "is not :exc:`StopAsyncIteration`, it is re-raised." msgstr "" -#: ../../library/dis.rst:665 ../../library/dis.rst:770 -#: ../../library/dis.rst:781 +#: ../../library/dis.rst:769 ../../library/dis.rst:877 +#: ../../library/dis.rst:888 msgid "" "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: ../../library/dis.rst:671 +#: ../../library/dis.rst:775 msgid "" "Handles an exception raised during a :meth:`~generator.throw` or :meth:" "`~generator.close` call through the current frame. If ``STACK[-1]`` is an " @@ -806,21 +912,21 @@ msgid "" "its ``value`` member. Otherwise, re-raise ``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:681 +#: ../../library/dis.rst:785 msgid "" "Resolves ``__aenter__`` and ``__aexit__`` from ``STACK[-1]``. Pushes " "``__aexit__`` and result of ``__aenter__()`` to the stack::" msgstr "" -#: ../../library/dis.rst:684 +#: ../../library/dis.rst:788 msgid "STACK.extend((__aexit__, __aenter__())" msgstr "STACK.extend((__aexit__, __aenter__())" -#: ../../library/dis.rst:690 +#: ../../library/dis.rst:794 msgid "**Miscellaneous opcodes**" msgstr "" -#: ../../library/dis.rst:696 +#: ../../library/dis.rst:800 msgid "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" @@ -828,11 +934,11 @@ msgstr "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" -#: ../../library/dis.rst:699 +#: ../../library/dis.rst:803 msgid "Used to implement set comprehensions." msgstr "" -#: ../../library/dis.rst:706 +#: ../../library/dis.rst:810 msgid "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" @@ -840,11 +946,11 @@ msgstr "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" -#: ../../library/dis.rst:709 +#: ../../library/dis.rst:813 msgid "Used to implement list comprehensions." msgstr "" -#: ../../library/dis.rst:716 +#: ../../library/dis.rst:820 msgid "" "value = STACK.pop()\n" "key = STACK.pop()\n" @@ -854,17 +960,17 @@ msgstr "" "key = STACK.pop()\n" "dict.__setitem__(STACK[-i], key, value)" -#: ../../library/dis.rst:720 +#: ../../library/dis.rst:824 msgid "Used to implement dict comprehensions." msgstr "" -#: ../../library/dis.rst:723 +#: ../../library/dis.rst:827 msgid "" "Map value is ``STACK[-1]`` and map key is ``STACK[-2]``. Before, those were " "reversed." msgstr "" -#: ../../library/dis.rst:727 +#: ../../library/dis.rst:831 msgid "" "For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` and :opcode:" "`MAP_ADD` instructions, while the added value or key/value pair is popped " @@ -872,29 +978,35 @@ msgid "" "further iterations of the loop." msgstr "" -#: ../../library/dis.rst:735 +#: ../../library/dis.rst:839 msgid "Returns with ``STACK[-1]`` to the caller of the function." msgstr "" -#: ../../library/dis.rst:740 +#: ../../library/dis.rst:844 msgid "Returns with ``co_consts[consti]`` to the caller of the function." msgstr "" -#: ../../library/dis.rst:747 +#: ../../library/dis.rst:851 msgid "Yields ``STACK.pop()`` from a :term:`generator`." msgstr "" -#: ../../library/dis.rst:749 +#: ../../library/dis.rst:853 msgid "oparg set to be the stack depth." msgstr "" -#: ../../library/dis.rst:752 +#: ../../library/dis.rst:856 msgid "" "oparg set to be the exception block depth, for efficient closing of " "generators." msgstr "" -#: ../../library/dis.rst:758 +#: ../../library/dis.rst:859 +msgid "" +"oparg is ``1`` if this instruction is part of a yield-from or await, and " +"``0`` otherwise." +msgstr "" + +#: ../../library/dis.rst:865 msgid "" "Checks whether ``__annotations__`` is defined in ``locals()``, if not it is " "set up to an empty ``dict``. This opcode is only emitted if a class or " @@ -902,39 +1014,39 @@ msgid "" "statically." msgstr "" -#: ../../library/dis.rst:768 +#: ../../library/dis.rst:875 msgid "" "Pops a value from the stack, which is used to restore the exception state." msgstr "" -#: ../../library/dis.rst:775 +#: ../../library/dis.rst:882 msgid "" "Re-raises the exception currently on top of the stack. If oparg is non-zero, " "pops an additional value from the stack which is used to set :attr:`~frame." "f_lasti` of the current frame." msgstr "" -#: ../../library/dis.rst:786 +#: ../../library/dis.rst:893 msgid "" "Pops a value from the stack. Pushes the current exception to the top of the " "stack. Pushes the value originally popped back to the stack. Used in " "exception handlers." msgstr "" -#: ../../library/dis.rst:794 +#: ../../library/dis.rst:901 msgid "" "Performs exception matching for ``except``. Tests whether the ``STACK[-2]`` " "is an exception matching ``STACK[-1]``. Pops ``STACK[-1]`` and pushes the " "boolean result of the test." msgstr "" -#: ../../library/dis.rst:802 +#: ../../library/dis.rst:909 msgid "" "Performs exception matching for ``except*``. Applies ``split(STACK[-1])`` on " "the exception group representing ``STACK[-2]``." msgstr "" -#: ../../library/dis.rst:805 +#: ../../library/dis.rst:912 msgid "" "In case of a match, pops two items from the stack and pushes the non-" "matching subgroup (``None`` in case of full match) followed by the matching " @@ -942,7 +1054,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/dis.rst:814 +#: ../../library/dis.rst:921 msgid "" "Calls the function in position 4 on the stack with arguments (type, val, tb) " "representing the exception at the top of the stack. Used to implement the " @@ -950,25 +1062,25 @@ msgid "" "occurred in a :keyword:`with` statement." msgstr "" -#: ../../library/dis.rst:821 +#: ../../library/dis.rst:928 msgid "" "The ``__exit__`` function is in position 4 of the stack rather than 7. " "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: ../../library/dis.rst:828 +#: ../../library/dis.rst:935 msgid "" "Pushes :exc:`AssertionError` onto the stack. Used by the :keyword:`assert` " "statement." msgstr "" -#: ../../library/dis.rst:836 +#: ../../library/dis.rst:943 msgid "" "Pushes :func:`!builtins.__build_class__` onto the stack. It is later called " "to construct a class." msgstr "" -#: ../../library/dis.rst:842 +#: ../../library/dis.rst:949 msgid "" "This opcode performs several operations before a with block starts. First, " "it loads :meth:`~object.__exit__` from the context manager and pushes it " @@ -977,11 +1089,11 @@ msgid "" "``__enter__()`` method is pushed onto the stack." msgstr "" -#: ../../library/dis.rst:853 +#: ../../library/dis.rst:960 msgid "Perform ``STACK.append(len(STACK[-1]))``." msgstr "" -#: ../../library/dis.rst:860 +#: ../../library/dis.rst:967 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Mapping` (or, " "more technically: if it has the :c:macro:`Py_TPFLAGS_MAPPING` flag set in " @@ -989,7 +1101,7 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:870 +#: ../../library/dis.rst:977 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Sequence` and is " "*not* an instance of :class:`str`/:class:`bytes`/:class:`bytearray` (or, " @@ -998,20 +1110,20 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:880 +#: ../../library/dis.rst:987 msgid "" "``STACK[-1]`` is a tuple of mapping keys, and ``STACK[-2]`` is the match " "subject. If ``STACK[-2]`` contains all of the keys in ``STACK[-1]``, push a :" "class:`tuple` containing the corresponding values. Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:886 ../../library/dis.rst:1520 +#: ../../library/dis.rst:993 ../../library/dis.rst:1664 msgid "" "Previously, this instruction also pushed a boolean value indicating success " "(``True``) or failure (``False``)." msgstr "" -#: ../../library/dis.rst:893 +#: ../../library/dis.rst:1000 msgid "" "Implements ``name = STACK.pop()``. *namei* is the index of *name* in the " "attribute :attr:`~codeobject.co_names` of the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:906 +#: ../../library/dis.rst:1013 msgid "" "Unpacks ``STACK[-1]`` into *count* individual values, which are put onto the " "stack right-to-left. Require there to be exactly *count* values.::" msgstr "" -#: ../../library/dis.rst:909 +#: ../../library/dis.rst:1016 msgid "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" @@ -1039,7 +1151,7 @@ msgstr "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" -#: ../../library/dis.rst:915 +#: ../../library/dis.rst:1022 msgid "" "Implements assignment with a starred target: Unpacks an iterable in " "``STACK[-1]`` into individual values, where the total number of values can " @@ -1047,11 +1159,11 @@ msgid "" "will be a list of all leftover items." msgstr "" -#: ../../library/dis.rst:920 +#: ../../library/dis.rst:1027 msgid "The number of values before and after the list value is limited to 255." msgstr "" -#: ../../library/dis.rst:922 +#: ../../library/dis.rst:1029 msgid "" "The number of values before the list value is encoded in the argument of the " "opcode. The number of values after the list if any is encoded using an " @@ -1060,13 +1172,13 @@ msgid "" "list value, the high byte of *counts* the number of values after it." msgstr "" -#: ../../library/dis.rst:928 +#: ../../library/dis.rst:1035 msgid "" "The extracted values are put onto the stack right-to-left, i.e. ``a, *b, c = " "d`` will be stored after execution as ``STACK.extend((a, b, c))``." msgstr "" -#: ../../library/dis.rst:936 +#: ../../library/dis.rst:1043 msgid "" "obj = STACK.pop()\n" "value = STACK.pop()\n" @@ -1076,13 +1188,13 @@ msgstr "" "value = STACK.pop()\n" "obj.name = value" -#: ../../library/dis.rst:940 +#: ../../library/dis.rst:1047 msgid "" "where *namei* is the index of name in :attr:`~codeobject.co_names` of the :" "ref:`code object `." msgstr "" -#: ../../library/dis.rst:947 +#: ../../library/dis.rst:1054 msgid "" "obj = STACK.pop()\n" "del obj.name" @@ -1090,38 +1202,38 @@ msgstr "" "obj = STACK.pop()\n" "del obj.name" -#: ../../library/dis.rst:950 +#: ../../library/dis.rst:1057 msgid "" "where *namei* is the index of name into :attr:`~codeobject.co_names` of the :" "ref:`code object `." msgstr "" -#: ../../library/dis.rst:956 +#: ../../library/dis.rst:1063 msgid "Works as :opcode:`STORE_NAME`, but stores the name as a global." msgstr "" -#: ../../library/dis.rst:961 +#: ../../library/dis.rst:1068 msgid "Works as :opcode:`DELETE_NAME`, but deletes a global name." msgstr "" -#: ../../library/dis.rst:966 +#: ../../library/dis.rst:1073 msgid "Pushes ``co_consts[consti]`` onto the stack." msgstr "" -#: ../../library/dis.rst:971 +#: ../../library/dis.rst:1078 msgid "" "Pushes the value associated with ``co_names[namei]`` onto the stack. The " "name is looked up within the locals, then the globals, then the builtins." msgstr "" -#: ../../library/dis.rst:977 +#: ../../library/dis.rst:1084 msgid "" "Pushes a reference to the locals dictionary onto the stack. This is used to " "prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` and :" "opcode:`LOAD_FROM_DICT_OR_GLOBALS`." msgstr "" -#: ../../library/dis.rst:986 +#: ../../library/dis.rst:1093 msgid "" "Pops a mapping off the stack and looks up the value for ``co_names[namei]``. " "If the name is not found there, looks it up in the globals and then the " @@ -1130,13 +1242,13 @@ msgid "" "bodies." msgstr "" -#: ../../library/dis.rst:997 +#: ../../library/dis.rst:1104 msgid "" "Creates a tuple consuming *count* items from the stack, and pushes the " "resulting tuple onto the stack::" msgstr "" -#: ../../library/dis.rst:1000 +#: ../../library/dis.rst:1107 msgid "" "if count == 0:\n" " value = ()\n" @@ -1154,41 +1266,41 @@ msgstr "" "\n" "STACK.append(value)" -#: ../../library/dis.rst:1011 +#: ../../library/dis.rst:1118 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a list." msgstr "" -#: ../../library/dis.rst:1016 +#: ../../library/dis.rst:1123 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a set." msgstr "" -#: ../../library/dis.rst:1021 +#: ../../library/dis.rst:1128 msgid "" "Pushes a new dictionary object onto the stack. Pops ``2 * count`` items so " "that the dictionary holds *count* entries: ``{..., STACK[-4]: STACK[-3], " "STACK[-2]: STACK[-1]}``." msgstr "" -#: ../../library/dis.rst:1025 +#: ../../library/dis.rst:1132 msgid "" "The dictionary is created from stack items instead of creating an empty " "dictionary pre-sized to hold *count* items." msgstr "" -#: ../../library/dis.rst:1032 +#: ../../library/dis.rst:1139 msgid "" "The version of :opcode:`BUILD_MAP` specialized for constant keys. Pops the " "top element on the stack which contains a tuple of keys, then starting from " "``STACK[-2]``, pops *count* values to form values in the built dictionary." msgstr "" -#: ../../library/dis.rst:1041 +#: ../../library/dis.rst:1148 msgid "" "Concatenates *count* strings from the stack and pushes the resulting string " "onto the stack." msgstr "" -#: ../../library/dis.rst:1051 +#: ../../library/dis.rst:1158 msgid "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" @@ -1196,11 +1308,11 @@ msgstr "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" -#: ../../library/dis.rst:1054 +#: ../../library/dis.rst:1161 msgid "Used to build lists." msgstr "" -#: ../../library/dis.rst:1063 +#: ../../library/dis.rst:1170 msgid "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" @@ -1208,11 +1320,11 @@ msgstr "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" -#: ../../library/dis.rst:1066 +#: ../../library/dis.rst:1173 msgid "Used to build sets." msgstr "" -#: ../../library/dis.rst:1075 +#: ../../library/dis.rst:1182 msgid "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" @@ -1220,91 +1332,102 @@ msgstr "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" -#: ../../library/dis.rst:1078 +#: ../../library/dis.rst:1185 msgid "Used to build dicts." msgstr "" -#: ../../library/dis.rst:1085 +#: ../../library/dis.rst:1192 msgid "Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys." msgstr "" -#: ../../library/dis.rst:1092 +#: ../../library/dis.rst:1199 msgid "" "If the low bit of ``namei`` is not set, this replaces ``STACK[-1]`` with " "``getattr(STACK[-1], co_names[namei>>1])``." msgstr "" -#: ../../library/dis.rst:1095 +#: ../../library/dis.rst:1202 msgid "" "If the low bit of ``namei`` is set, this will attempt to load a method named " "``co_names[namei>>1]`` from the ``STACK[-1]`` object. ``STACK[-1]`` is " "popped. This bytecode distinguishes two cases: if ``STACK[-1]`` has a method " "with the correct name, the bytecode pushes the unbound method and " "``STACK[-1]``. ``STACK[-1]`` will be used as the first argument (``self``) " -"by :opcode:`CALL` when calling the unbound method. Otherwise, ``NULL`` and " -"the object returned by the attribute lookup are pushed." +"by :opcode:`CALL` or :opcode:`CALL_KW` when calling the unbound method. " +"Otherwise, ``NULL`` and the object returned by the attribute lookup are " +"pushed." msgstr "" -#: ../../library/dis.rst:1103 +#: ../../library/dis.rst:1211 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is pushed to " "the stack before the attribute or unbound method respectively." msgstr "" -#: ../../library/dis.rst:1110 +#: ../../library/dis.rst:1218 msgid "" "This opcode implements :func:`super`, both in its zero-argument and two-" "argument forms (e.g. ``super().method()``, ``super().attr`` and ``super(cls, " "self).method()``, ``super(cls, self).attr``)." msgstr "" -#: ../../library/dis.rst:1114 -msgid "" -"It pops three values from the stack (from top of stack down): - ``self``: " -"the first argument to the current method - ``cls``: the class within which " -"the current method was defined - the global ``super``" +#: ../../library/dis.rst:1222 +msgid "It pops three values from the stack (from top of stack down):" +msgstr "" + +#: ../../library/dis.rst:1224 +msgid "``self``: the first argument to the current method" +msgstr "" + +#: ../../library/dis.rst:1225 +msgid "``cls``: the class within which the current method was defined" +msgstr "" + +#: ../../library/dis.rst:1226 +msgid "the global ``super``" msgstr "" -#: ../../library/dis.rst:1119 +#: ../../library/dis.rst:1228 msgid "" "With respect to its argument, it works similarly to :opcode:`LOAD_ATTR`, " "except that ``namei`` is shifted left by 2 bits instead of 1." msgstr "" -#: ../../library/dis.rst:1122 +#: ../../library/dis.rst:1231 msgid "" "The low bit of ``namei`` signals to attempt a method load, as with :opcode:" "`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded method. When " "it is unset a single value is pushed to the stack." msgstr "" -#: ../../library/dis.rst:1126 +#: ../../library/dis.rst:1235 msgid "" "The second-low bit of ``namei``, if set, means that this was a two-argument " "call to :func:`super` (unset means zero-argument)." msgstr "" -#: ../../library/dis.rst:1134 +#: ../../library/dis.rst:1243 msgid "" "Performs a Boolean operation. The operation name can be found in " -"``cmp_op[opname >> 4]``." +"``cmp_op[opname >> 5]``. If the fifth-lowest bit of ``opname`` is set " +"(``opname & 16``), the result should be coerced to ``bool``." msgstr "" -#: ../../library/dis.rst:1137 +#: ../../library/dis.rst:1247 msgid "" -"The cmp_op index is now stored in the four-highest bits of oparg instead of " -"the four-lowest bits of oparg." +"The fifth-lowest bit of the oparg now indicates a forced conversion to :" +"class:`bool`." msgstr "" -#: ../../library/dis.rst:1143 +#: ../../library/dis.rst:1254 msgid "Performs ``is`` comparison, or ``is not`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1150 +#: ../../library/dis.rst:1261 msgid "Performs ``in`` comparison, or ``not in`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1157 +#: ../../library/dis.rst:1268 msgid "" "Imports the module ``co_names[namei]``. ``STACK[-1]`` and ``STACK[-2]`` are " "popped and provide the *fromlist* and *level* arguments of :func:" @@ -1313,68 +1436,68 @@ msgid "" "opcode:`STORE_FAST` instruction modifies the namespace." msgstr "" -#: ../../library/dis.rst:1165 +#: ../../library/dis.rst:1276 msgid "" "Loads the attribute ``co_names[namei]`` from the module found in " "``STACK[-1]``. The resulting object is pushed onto the stack, to be " "subsequently stored by a :opcode:`STORE_FAST` instruction." msgstr "" -#: ../../library/dis.rst:1172 +#: ../../library/dis.rst:1283 msgid "Increments bytecode counter by *delta*." msgstr "" -#: ../../library/dis.rst:1177 +#: ../../library/dis.rst:1288 msgid "Decrements bytecode counter by *delta*. Checks for interrupts." msgstr "" -#: ../../library/dis.rst:1184 +#: ../../library/dis.rst:1295 msgid "Decrements bytecode counter by *delta*. Does not check for interrupts." msgstr "" -#: ../../library/dis.rst:1191 +#: ../../library/dis.rst:1302 msgid "" "If ``STACK[-1]`` is true, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1194 ../../library/dis.rst:1207 +#: ../../library/dis.rst:1305 ../../library/dis.rst:1321 msgid "" "The oparg is now a relative delta rather than an absolute target. This " "opcode is a pseudo-instruction, replaced in final bytecode by the directed " "versions (forward/backward)." msgstr "" -#: ../../library/dis.rst:1199 ../../library/dis.rst:1212 -#: ../../library/dis.rst:1225 ../../library/dis.rst:1239 +#: ../../library/dis.rst:1310 ../../library/dis.rst:1326 +#: ../../library/dis.rst:1342 ../../library/dis.rst:1356 msgid "This is no longer a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1204 +#: ../../library/dis.rst:1318 msgid "" "If ``STACK[-1]`` is false, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1217 +#: ../../library/dis.rst:1334 msgid "" "If ``STACK[-1]`` is not ``None``, increments the bytecode counter by " "*delta*. ``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1220 ../../library/dis.rst:1234 +#: ../../library/dis.rst:1337 ../../library/dis.rst:1351 msgid "" "This opcode is a pseudo-instruction, replaced in final bytecode by the " "directed versions (forward/backward)." msgstr "" -#: ../../library/dis.rst:1231 +#: ../../library/dis.rst:1348 msgid "" "If ``STACK[-1]`` is ``None``, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1244 +#: ../../library/dis.rst:1361 msgid "" "``STACK[-1]`` is an :term:`iterator`. Call its :meth:`~iterator.__next__` " "method. If this yields a new value, push it on the stack (leaving the " @@ -1382,88 +1505,72 @@ msgid "" "code counter is incremented by *delta*." msgstr "" -#: ../../library/dis.rst:1249 +#: ../../library/dis.rst:1366 msgid "Up until 3.11 the iterator was popped when it was exhausted." msgstr "" -#: ../../library/dis.rst:1254 +#: ../../library/dis.rst:1371 msgid "Loads the global named ``co_names[namei>>1]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1256 +#: ../../library/dis.rst:1373 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` is pushed to the stack " "before the global variable." msgstr "" -#: ../../library/dis.rst:1262 +#: ../../library/dis.rst:1379 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1264 +#: ../../library/dis.rst:1381 msgid "" "This opcode is now only used in situations where the local variable is " "guaranteed to be initialized. It cannot raise :exc:`UnboundLocalError`." msgstr "" -#: ../../library/dis.rst:1270 +#: ../../library/dis.rst:1387 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack, " "raising an :exc:`UnboundLocalError` if the local variable has not been " "initialized." msgstr "" -#: ../../library/dis.rst:1278 +#: ../../library/dis.rst:1395 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack (or " "pushes ``NULL`` onto the stack if the local variable has not been " "initialized) and sets ``co_varnames[var_num]`` to ``NULL``." msgstr "" -#: ../../library/dis.rst:1286 +#: ../../library/dis.rst:1403 msgid "Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1291 +#: ../../library/dis.rst:1408 msgid "Deletes local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1296 +#: ../../library/dis.rst:1413 msgid "" "Creates a new cell in slot ``i``. If that slot is nonempty then that value " "is stored into the new cell." msgstr "" -#: ../../library/dis.rst:1304 -msgid "" -"Pushes a reference to the cell contained in slot ``i`` of the \"fast " -"locals\" storage. The name of the variable is ``co_fastlocalnames[i]``." -msgstr "" - -#: ../../library/dis.rst:1307 -msgid "" -"Note that ``LOAD_CLOSURE`` is effectively an alias for ``LOAD_FAST``. It " -"exists to keep bytecode a little more readable." -msgstr "" - -#: ../../library/dis.rst:1310 -msgid "``i`` is no longer offset by the length of ``co_varnames``." -msgstr "" - -#: ../../library/dis.rst:1316 +#: ../../library/dis.rst:1421 msgid "" "Loads the cell contained in slot ``i`` of the \"fast locals\" storage. " "Pushes a reference to the object the cell contains on the stack." msgstr "" -#: ../../library/dis.rst:1319 ../../library/dis.rst:1341 -#: ../../library/dis.rst:1352 +#: ../../library/dis.rst:1424 ../../library/dis.rst:1446 +#: ../../library/dis.rst:1457 msgid "" "``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`." msgstr "" -#: ../../library/dis.rst:1325 +#: ../../library/dis.rst:1430 msgid "" "Pops a mapping off the stack and looks up the name associated with slot " "``i`` of the \"fast locals\" storage in this mapping. If the name is not " @@ -1473,94 +1580,111 @@ msgid "" "scopes ` within class bodies." msgstr "" -#: ../../library/dis.rst:1338 +#: ../../library/dis.rst:1443 msgid "" "Stores ``STACK.pop()`` into the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1347 +#: ../../library/dis.rst:1452 msgid "" "Empties the cell contained in slot ``i`` of the \"fast locals\" storage. " "Used by the :keyword:`del` statement." msgstr "" -#: ../../library/dis.rst:1358 +#: ../../library/dis.rst:1463 msgid "" "Copies the ``n`` free variables from the closure into the frame. Removes the " "need for special code on the caller's side when calling closures." msgstr "" -#: ../../library/dis.rst:1367 +#: ../../library/dis.rst:1472 msgid "" "Raises an exception using one of the 3 forms of the ``raise`` statement, " "depending on the value of *argc*:" msgstr "" -#: ../../library/dis.rst:1370 +#: ../../library/dis.rst:1475 msgid "0: ``raise`` (re-raise previous exception)" msgstr "" -#: ../../library/dis.rst:1371 +#: ../../library/dis.rst:1476 msgid "" "1: ``raise STACK[-1]`` (raise exception instance or type at ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1372 +#: ../../library/dis.rst:1477 msgid "" "2: ``raise STACK[-2] from STACK[-1]`` (raise exception instance or type at " "``STACK[-2]`` with ``__cause__`` set to ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1378 +#: ../../library/dis.rst:1483 msgid "" -"Calls a callable object with the number of arguments specified by ``argc``, " -"including the named arguments specified by the preceding :opcode:`KW_NAMES`, " -"if any. On the stack are (in ascending order), either:" +"Calls a callable object with the number of arguments specified by ``argc``. " +"On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1383 -msgid "NULL" +#: ../../library/dis.rst:1486 ../../library/dis.rst:1510 +msgid "The callable" msgstr "" -#: ../../library/dis.rst:1384 ../../library/dis.rst:1390 -msgid "The callable" +#: ../../library/dis.rst:1487 ../../library/dis.rst:1511 +msgid "``self`` or ``NULL``" msgstr "" -#: ../../library/dis.rst:1385 -msgid "The positional arguments" +#: ../../library/dis.rst:1488 ../../library/dis.rst:1512 +msgid "The remaining positional arguments" msgstr "" -#: ../../library/dis.rst:1386 ../../library/dis.rst:1393 -msgid "The named arguments" +#: ../../library/dis.rst:1490 +msgid "``argc`` is the total of the positional arguments, excluding ``self``." msgstr "" -#: ../../library/dis.rst:1388 -msgid "or:" -msgstr "或:" +#: ../../library/dis.rst:1492 +msgid "" +"``CALL`` pops all arguments and the callable object off the stack, calls the " +"callable object with those arguments, and pushes the return value returned " +"by the callable object." +msgstr "" -#: ../../library/dis.rst:1391 -msgid "``self``" -msgstr "``self``" +#: ../../library/dis.rst:1498 +msgid "The callable now always appears at the same position on the stack." +msgstr "" -#: ../../library/dis.rst:1392 -msgid "The remaining positional arguments" +#: ../../library/dis.rst:1501 +msgid "Calls with keyword arguments are now handled by :opcode:`CALL_KW`." msgstr "" -#: ../../library/dis.rst:1395 +#: ../../library/dis.rst:1507 +msgid "" +"Calls a callable object with the number of arguments specified by ``argc``, " +"including one or more named arguments. On the stack are (in ascending order):" +msgstr "" + +#: ../../library/dis.rst:1513 +msgid "The named arguments" +msgstr "" + +#: ../../library/dis.rst:1514 +msgid "A :class:`tuple` of keyword argument names" +msgstr "" + +#: ../../library/dis.rst:1516 msgid "" "``argc`` is the total of the positional and named arguments, excluding " -"``self`` when a ``NULL`` is not present." +"``self``. The length of the tuple of keyword argument names is the number of " +"named arguments." msgstr "" -#: ../../library/dis.rst:1398 +#: ../../library/dis.rst:1519 msgid "" -"``CALL`` pops all arguments and the callable object off the stack, calls the " -"callable object with those arguments, and pushes the return value returned " -"by the callable object." +"``CALL_KW`` pops all arguments, the keyword names, and the callable object " +"off the stack, calls the callable object with those arguments, and pushes " +"the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1407 +#: ../../library/dis.rst:1528 msgid "" "Calls a callable object with variable set of positional and keyword " "arguments. If the lowest bit of *flags* is set, the top of the stack " @@ -1572,73 +1696,76 @@ msgid "" "arguments, and pushes the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1422 +#: ../../library/dis.rst:1543 msgid "" "Pushes a ``NULL`` to the stack. Used in the call sequence to match the " "``NULL`` pushed by :opcode:`LOAD_METHOD` for non-method calls." msgstr "" -#: ../../library/dis.rst:1431 +#: ../../library/dis.rst:1552 msgid "" -"Prefixes :opcode:`CALL`. Stores a reference to ``co_consts[consti]`` into an " -"internal variable for use by :opcode:`CALL`. ``co_consts[consti]`` must be a " -"tuple of strings." +"Pushes a new function object on the stack built from the code object at " +"``STACK[1]``." +msgstr "" + +#: ../../library/dis.rst:1554 +msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" msgstr "" -#: ../../library/dis.rst:1440 +#: ../../library/dis.rst:1557 +msgid "Qualified name at ``STACK[-1]`` was removed." +msgstr "" + +#: ../../library/dis.rst:1560 msgid "" -"Pushes a new function object on the stack. From bottom to top, the consumed " -"stack must consist of values if the argument carries a specified flag value" +"Extra function attributes on the stack, signaled by oparg flags, were " +"removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`." msgstr "" -#: ../../library/dis.rst:1443 +#: ../../library/dis.rst:1567 +msgid "" +"Sets an attribute on a function object. Expects the function at " +"``STACK[-1]`` and the attribute value to set at ``STACK[-2]``; consumes both " +"and leaves the function at ``STACK[-1]``. The flag determines which " +"attribute to set:" +msgstr "" + +#: ../../library/dis.rst:1571 msgid "" "``0x01`` a tuple of default values for positional-only and positional-or-" "keyword parameters in positional order" msgstr "" -#: ../../library/dis.rst:1445 +#: ../../library/dis.rst:1573 msgid "``0x02`` a dictionary of keyword-only parameters' default values" msgstr "" -#: ../../library/dis.rst:1446 +#: ../../library/dis.rst:1574 msgid "``0x04`` a tuple of strings containing parameters' annotations" msgstr "" -#: ../../library/dis.rst:1447 +#: ../../library/dis.rst:1575 msgid "``0x08`` a tuple containing cells for free variables, making a closure" msgstr "" -#: ../../library/dis.rst:1448 -msgid "the code associated with the function (at ``STACK[-1]``)" -msgstr "" - -#: ../../library/dis.rst:1450 -msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" -msgstr "" - -#: ../../library/dis.rst:1453 -msgid "Qualified name at ``STACK[-1]`` was removed." -msgstr "" - -#: ../../library/dis.rst:1461 +#: ../../library/dis.rst:1584 msgid "" "Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, " "implements::" msgstr "" -#: ../../library/dis.rst:1463 +#: ../../library/dis.rst:1586 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" "STACK.append(slice(start, end))" msgstr "" -#: ../../library/dis.rst:1467 +#: ../../library/dis.rst:1590 msgid "if it is 3, implements::" msgstr "" -#: ../../library/dis.rst:1469 +#: ../../library/dis.rst:1592 msgid "" "step = STACK.pop()\n" "end = STACK.pop()\n" @@ -1650,11 +1777,11 @@ msgstr "" "start = STACK.pop()\n" "STACK.append(slice(start, end, step))" -#: ../../library/dis.rst:1474 +#: ../../library/dis.rst:1597 msgid "See the :func:`slice` built-in function for more information." msgstr "" -#: ../../library/dis.rst:1479 +#: ../../library/dis.rst:1602 msgid "" "Prefixes any opcode which has an argument too big to fit into the default " "one byte. *ext* holds an additional byte which act as higher bits in the " @@ -1662,54 +1789,75 @@ msgid "" "allowed, forming an argument from two-byte to four-byte." msgstr "" -#: ../../library/dis.rst:1487 +#: ../../library/dis.rst:1610 +msgid "Convert value to a string, depending on ``oparg``::" +msgstr "" + +#: ../../library/dis.rst:1612 msgid "" -"Used for implementing formatted literal strings (f-strings). Pops an " -"optional *fmt_spec* from the stack, then a required *value*. *flags* is " -"interpreted as follows:" +"value = STACK.pop()\n" +"result = func(value)\n" +"STACK.append(result)" msgstr "" +"value = STACK.pop()\n" +"result = func(value)\n" +"STACK.append(result)" -#: ../../library/dis.rst:1491 -msgid "``(flags & 0x03) == 0x00``: *value* is formatted as-is." +#: ../../library/dis.rst:1616 +msgid "``oparg == 1``: call :func:`str` on *value*" msgstr "" -#: ../../library/dis.rst:1492 -msgid "" -"``(flags & 0x03) == 0x01``: call :func:`str` on *value* before formatting it." +#: ../../library/dis.rst:1617 +msgid "``oparg == 2``: call :func:`repr` on *value*" msgstr "" -#: ../../library/dis.rst:1494 -msgid "" -"``(flags & 0x03) == 0x02``: call :func:`repr` on *value* before formatting " -"it." +#: ../../library/dis.rst:1618 +msgid "``oparg == 3``: call :func:`ascii` on *value*" msgstr "" -#: ../../library/dis.rst:1496 -msgid "" -"``(flags & 0x03) == 0x03``: call :func:`ascii` on *value* before formatting " -"it." +#: ../../library/dis.rst:1620 ../../library/dis.rst:1633 +#: ../../library/dis.rst:1646 +msgid "Used for implementing formatted literal strings (f-strings)." msgstr "" -#: ../../library/dis.rst:1498 +#: ../../library/dis.rst:1627 +msgid "Formats the value on top of stack::" +msgstr "" + +#: ../../library/dis.rst:1629 msgid "" -"``(flags & 0x04) == 0x04``: pop *fmt_spec* from the stack and use it, else " -"use an empty *fmt_spec*." +"value = STACK.pop()\n" +"result = value.__format__(\"\")\n" +"STACK.append(result)" msgstr "" +"value = STACK.pop()\n" +"result = value.__format__(\"\")\n" +"STACK.append(result)" -#: ../../library/dis.rst:1501 +#: ../../library/dis.rst:1639 +msgid "Formats the given value with the given format spec::" +msgstr "" + +#: ../../library/dis.rst:1641 msgid "" -"Formatting is performed using :c:func:`PyObject_Format`. The result is " -"pushed on the stack." +"spec = STACK.pop()\n" +"value = STACK.pop()\n" +"result = value.__format__(spec)\n" +"STACK.append(result)" msgstr "" +"spec = STACK.pop()\n" +"value = STACK.pop()\n" +"result = value.__format__(spec)\n" +"STACK.append(result)" -#: ../../library/dis.rst:1509 +#: ../../library/dis.rst:1653 msgid "" "``STACK[-1]`` is a tuple of keyword attribute names, ``STACK[-2]`` is the " "class being matched against, and ``STACK[-3]`` is the match subject. " "*count* is the number of positional sub-patterns." msgstr "" -#: ../../library/dis.rst:1513 +#: ../../library/dis.rst:1657 msgid "" "Pop ``STACK[-1]``, ``STACK[-2]``, and ``STACK[-3]``. If ``STACK[-3]`` is an " "instance of ``STACK[-2]`` and has the positional and keyword attributes " @@ -1717,269 +1865,285 @@ msgid "" "Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:1527 +#: ../../library/dis.rst:1671 msgid "A no-op. Performs internal tracing, debugging and optimization checks." msgstr "" -#: ../../library/dis.rst:1529 -msgid "The ``where`` operand marks where the ``RESUME`` occurs:" +#: ../../library/dis.rst:1673 +msgid "" +"The ``context`` oparand consists of two parts. The lowest two bits indicate " +"where the ``RESUME`` occurs:" msgstr "" -#: ../../library/dis.rst:1531 +#: ../../library/dis.rst:1676 msgid "" "``0`` The start of a function, which is neither a generator, coroutine nor " "an async generator" msgstr "" -#: ../../library/dis.rst:1533 +#: ../../library/dis.rst:1678 msgid "``1`` After a ``yield`` expression" msgstr "" -#: ../../library/dis.rst:1534 +#: ../../library/dis.rst:1679 msgid "``2`` After a ``yield from`` expression" msgstr "" -#: ../../library/dis.rst:1535 +#: ../../library/dis.rst:1680 msgid "``3`` After an ``await`` expression" msgstr "" -#: ../../library/dis.rst:1542 +#: ../../library/dis.rst:1682 +msgid "" +"The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` " +"otherwise." +msgstr "" + +#: ../../library/dis.rst:1687 +msgid "The oparg value changed to include information about except-depth" +msgstr "" + +#: ../../library/dis.rst:1693 msgid "" "Create a generator, coroutine, or async generator from the current frame. " "Used as first opcode of in code object for the above mentioned callables. " "Clear the current frame and return the newly created generator." msgstr "" -#: ../../library/dis.rst:1551 +#: ../../library/dis.rst:1702 msgid "" "Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])``. Used in ``yield " "from`` and ``await`` statements." msgstr "" -#: ../../library/dis.rst:1554 +#: ../../library/dis.rst:1705 msgid "" "If the call raises :exc:`StopIteration`, pop the top value from the stack, " "push the exception's ``value`` attribute, and increment the bytecode counter " "by *delta*." msgstr "" -#: ../../library/dis.rst:1563 +#: ../../library/dis.rst:1714 msgid "" "This is not really an opcode. It identifies the dividing line between " "opcodes in the range [0,255] which don't use their argument and those that " "do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively)." msgstr "" -#: ../../library/dis.rst:1567 +#: ../../library/dis.rst:1718 msgid "" -"If your application uses pseudo instructions, use the :data:`hasarg` " -"collection instead." +"If your application uses pseudo instructions or specialized instructions, " +"use the :data:`hasarg` collection instead." msgstr "" -#: ../../library/dis.rst:1570 +#: ../../library/dis.rst:1721 msgid "" "Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT`` " "ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument." msgstr "" -#: ../../library/dis.rst:1574 +#: ../../library/dis.rst:1725 msgid "" "Pseudo instructions were added to the :mod:`dis` module, and for them it is " "not true that comparison with ``HAVE_ARGUMENT`` indicates whether they use " "their arg." msgstr "" -#: ../../library/dis.rst:1582 +#: ../../library/dis.rst:1730 +msgid "Use :data:`hasarg` instead." +msgstr "" + +#: ../../library/dis.rst:1735 msgid "" "Calls an intrinsic function with one argument. Passes ``STACK[-1]`` as the " "argument and sets ``STACK[-1]`` to the result. Used to implement " "functionality that is not performance critical." msgstr "" -#: ../../library/dis.rst:1586 ../../library/dis.rst:1640 +#: ../../library/dis.rst:1739 ../../library/dis.rst:1793 msgid "The operand determines which intrinsic function is called:" msgstr "" -#: ../../library/dis.rst:1589 ../../library/dis.rst:1643 +#: ../../library/dis.rst:1742 ../../library/dis.rst:1796 msgid "Operand" msgstr "" -#: ../../library/dis.rst:1589 ../../library/dis.rst:1643 +#: ../../library/dis.rst:1742 ../../library/dis.rst:1796 msgid "Description" msgstr "" -#: ../../library/dis.rst:1591 +#: ../../library/dis.rst:1744 msgid "``INTRINSIC_1_INVALID``" msgstr "``INTRINSIC_1_INVALID``" -#: ../../library/dis.rst:1591 ../../library/dis.rst:1645 +#: ../../library/dis.rst:1744 ../../library/dis.rst:1798 msgid "Not valid" msgstr "" -#: ../../library/dis.rst:1593 +#: ../../library/dis.rst:1746 msgid "``INTRINSIC_PRINT``" msgstr "``INTRINSIC_PRINT``" -#: ../../library/dis.rst:1593 +#: ../../library/dis.rst:1746 msgid "Prints the argument to standard out. Used in the REPL." msgstr "" -#: ../../library/dis.rst:1596 +#: ../../library/dis.rst:1749 msgid "``INTRINSIC_IMPORT_STAR``" msgstr "``INTRINSIC_IMPORT_STAR``" -#: ../../library/dis.rst:1596 +#: ../../library/dis.rst:1749 msgid "Performs ``import *`` for the named module." msgstr "" -#: ../../library/dis.rst:1599 +#: ../../library/dis.rst:1752 msgid "``INTRINSIC_STOPITERATION_ERROR``" msgstr "``INTRINSIC_STOPITERATION_ERROR``" -#: ../../library/dis.rst:1599 +#: ../../library/dis.rst:1752 msgid "Extracts the return value from a ``StopIteration`` exception." msgstr "" -#: ../../library/dis.rst:1602 +#: ../../library/dis.rst:1755 msgid "``INTRINSIC_ASYNC_GEN_WRAP``" msgstr "``INTRINSIC_ASYNC_GEN_WRAP``" -#: ../../library/dis.rst:1602 +#: ../../library/dis.rst:1755 msgid "Wraps an async generator value" msgstr "" -#: ../../library/dis.rst:1604 +#: ../../library/dis.rst:1757 msgid "``INTRINSIC_UNARY_POSITIVE``" msgstr "``INTRINSIC_UNARY_POSITIVE``" -#: ../../library/dis.rst:1604 +#: ../../library/dis.rst:1757 msgid "Performs the unary ``+`` operation" msgstr "" -#: ../../library/dis.rst:1607 +#: ../../library/dis.rst:1760 msgid "``INTRINSIC_LIST_TO_TUPLE``" msgstr "``INTRINSIC_LIST_TO_TUPLE``" -#: ../../library/dis.rst:1607 +#: ../../library/dis.rst:1760 msgid "Converts a list to a tuple" msgstr "" -#: ../../library/dis.rst:1609 +#: ../../library/dis.rst:1762 msgid "``INTRINSIC_TYPEVAR``" msgstr "``INTRINSIC_TYPEVAR``" -#: ../../library/dis.rst:1609 +#: ../../library/dis.rst:1762 msgid "Creates a :class:`typing.TypeVar`" msgstr "" -#: ../../library/dis.rst:1611 +#: ../../library/dis.rst:1764 msgid "``INTRINSIC_PARAMSPEC``" msgstr "``INTRINSIC_PARAMSPEC``" -#: ../../library/dis.rst:1611 +#: ../../library/dis.rst:1764 msgid "Creates a :class:`typing.ParamSpec`" msgstr "" -#: ../../library/dis.rst:1614 +#: ../../library/dis.rst:1767 msgid "``INTRINSIC_TYPEVARTUPLE``" msgstr "``INTRINSIC_TYPEVARTUPLE``" -#: ../../library/dis.rst:1614 +#: ../../library/dis.rst:1767 msgid "Creates a :class:`typing.TypeVarTuple`" msgstr "" -#: ../../library/dis.rst:1617 +#: ../../library/dis.rst:1770 msgid "``INTRINSIC_SUBSCRIPT_GENERIC``" msgstr "``INTRINSIC_SUBSCRIPT_GENERIC``" -#: ../../library/dis.rst:1617 +#: ../../library/dis.rst:1770 msgid "Returns :class:`typing.Generic` subscripted with the argument" msgstr "" -#: ../../library/dis.rst:1620 +#: ../../library/dis.rst:1773 msgid "``INTRINSIC_TYPEALIAS``" msgstr "``INTRINSIC_TYPEALIAS``" -#: ../../library/dis.rst:1620 +#: ../../library/dis.rst:1773 msgid "" "Creates a :class:`typing.TypeAliasType`; used in the :keyword:`type` " "statement. The argument is a tuple of the type alias's name, type " "parameters, and value." msgstr "" -#: ../../library/dis.rst:1632 +#: ../../library/dis.rst:1785 msgid "" "Calls an intrinsic function with two arguments. Used to implement " "functionality that is not performance critical::" msgstr "" -#: ../../library/dis.rst:1635 +#: ../../library/dis.rst:1788 msgid "" "arg2 = STACK.pop()\n" "arg1 = STACK.pop()\n" "result = intrinsic2(arg1, arg2)\n" -"STACK.push(result)" +"STACK.append(result)" msgstr "" "arg2 = STACK.pop()\n" "arg1 = STACK.pop()\n" "result = intrinsic2(arg1, arg2)\n" -"STACK.push(result)" +"STACK.append(result)" -#: ../../library/dis.rst:1645 +#: ../../library/dis.rst:1798 msgid "``INTRINSIC_2_INVALID``" msgstr "``INTRINSIC_2_INVALID``" -#: ../../library/dis.rst:1647 +#: ../../library/dis.rst:1800 msgid "``INTRINSIC_PREP_RERAISE_STAR``" msgstr "``INTRINSIC_PREP_RERAISE_STAR``" -#: ../../library/dis.rst:1647 +#: ../../library/dis.rst:1800 msgid "Calculates the :exc:`ExceptionGroup` to raise from a ``try-except*``." msgstr "" -#: ../../library/dis.rst:1651 +#: ../../library/dis.rst:1804 msgid "``INTRINSIC_TYPEVAR_WITH_BOUND``" msgstr "``INTRINSIC_TYPEVAR_WITH_BOUND``" -#: ../../library/dis.rst:1651 +#: ../../library/dis.rst:1804 msgid "Creates a :class:`typing.TypeVar` with a bound." msgstr "" -#: ../../library/dis.rst:1654 +#: ../../library/dis.rst:1807 msgid "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" msgstr "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" -#: ../../library/dis.rst:1654 +#: ../../library/dis.rst:1807 msgid "Creates a :class:`typing.TypeVar` with constraints." msgstr "" -#: ../../library/dis.rst:1658 +#: ../../library/dis.rst:1811 msgid "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" msgstr "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" -#: ../../library/dis.rst:1658 +#: ../../library/dis.rst:1811 msgid "Sets the ``__type_params__`` attribute of a function." msgstr "" -#: ../../library/dis.rst:1665 +#: ../../library/dis.rst:1818 msgid "**Pseudo-instructions**" msgstr "" -#: ../../library/dis.rst:1667 +#: ../../library/dis.rst:1820 msgid "" "These opcodes do not appear in Python bytecode. They are used by the " "compiler but are replaced by real opcodes or removed before bytecode is " "generated." msgstr "" -#: ../../library/dis.rst:1672 +#: ../../library/dis.rst:1825 msgid "" "Set up an exception handler for the following code block. If an exception " "occurs, the value stack level is restored to its current state and control " "is transferred to the exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1679 +#: ../../library/dis.rst:1832 msgid "" "Like ``SETUP_FINALLY``, but in case of an exception also pushes the last " "instruction (``lasti``) to the stack so that ``RERAISE`` can restore it. If " @@ -1988,76 +2152,91 @@ msgid "" "exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1688 +#: ../../library/dis.rst:1841 msgid "" "Like ``SETUP_CLEANUP``, but in case of an exception one more item is popped " "from the stack before control is transferred to the exception handler at " "``target``." msgstr "" -#: ../../library/dis.rst:1692 +#: ../../library/dis.rst:1845 msgid "" "This variant is used in :keyword:`with` and :keyword:`async with` " "constructs, which push the return value of the context manager's :meth:" "`~object.__enter__` or :meth:`~object.__aenter__` to the stack." msgstr "" -#: ../../library/dis.rst:1699 +#: ../../library/dis.rst:1852 msgid "" "Marks the end of the code block associated with the last ``SETUP_FINALLY``, " "``SETUP_CLEANUP`` or ``SETUP_WITH``." msgstr "" -#: ../../library/dis.rst:1705 +#: ../../library/dis.rst:1858 msgid "" "Undirected relative jump instructions which are replaced by their directed " "(forward/backward) counterparts by the assembler." msgstr "" -#: ../../library/dis.rst:1710 +#: ../../library/dis.rst:1863 +msgid "" +"Pushes a reference to the cell contained in slot ``i`` of the \"fast " +"locals\" storage." +msgstr "" + +#: ../../library/dis.rst:1866 +msgid "" +"Note that ``LOAD_CLOSURE`` is replaced with ``LOAD_FAST`` in the assembler." +msgstr "" + +#: ../../library/dis.rst:1868 +msgid "This opcode is now a pseudo-instruction." +msgstr "" + +#: ../../library/dis.rst:1874 msgid "" "Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode with a " "flag set in the arg." msgstr "" -#: ../../library/dis.rst:1717 +#: ../../library/dis.rst:1881 msgid "Opcode collections" msgstr "" -#: ../../library/dis.rst:1719 +#: ../../library/dis.rst:1883 msgid "" "These collections are provided for automatic introspection of bytecode " "instructions:" msgstr "" -#: ../../library/dis.rst:1722 +#: ../../library/dis.rst:1886 msgid "" "The collections now contain pseudo instructions and instrumented " "instructions as well. These are opcodes with values ``>= MIN_PSEUDO_OPCODE`` " "and ``>= MIN_INSTRUMENTED_OPCODE``." msgstr "" -#: ../../library/dis.rst:1729 +#: ../../library/dis.rst:1893 msgid "Sequence of operation names, indexable using the bytecode." msgstr "" -#: ../../library/dis.rst:1734 +#: ../../library/dis.rst:1898 msgid "Dictionary mapping operation names to bytecodes." msgstr "" -#: ../../library/dis.rst:1739 +#: ../../library/dis.rst:1903 msgid "Sequence of all compare operation names." msgstr "" -#: ../../library/dis.rst:1744 +#: ../../library/dis.rst:1908 msgid "Sequence of bytecodes that use their argument." msgstr "" -#: ../../library/dis.rst:1751 +#: ../../library/dis.rst:1915 msgid "Sequence of bytecodes that access a constant." msgstr "" -#: ../../library/dis.rst:1756 +#: ../../library/dis.rst:1920 msgid "" "Sequence of bytecodes that access a free variable. 'free' in this context " "refers to names in the current scope that are referenced by inner scopes or " @@ -2065,34 +2244,52 @@ msgid "" "include references to global or builtin scopes." msgstr "" -#: ../../library/dis.rst:1764 +#: ../../library/dis.rst:1928 msgid "Sequence of bytecodes that access an attribute by name." msgstr "" -#: ../../library/dis.rst:1769 -msgid "Sequence of bytecodes that have a relative jump target." -msgstr "" - -#: ../../library/dis.rst:1774 -msgid "Sequence of bytecodes that have an absolute jump target." +#: ../../library/dis.rst:1933 +msgid "Sequence of bytecodes that have a jump target. All jumps are relative." msgstr "" -#: ../../library/dis.rst:1779 +#: ../../library/dis.rst:1940 msgid "Sequence of bytecodes that access a local variable." msgstr "" -#: ../../library/dis.rst:1784 +#: ../../library/dis.rst:1945 msgid "Sequence of bytecodes of Boolean operations." msgstr "" -#: ../../library/dis.rst:1788 +#: ../../library/dis.rst:1949 msgid "Sequence of bytecodes that set an exception handler." msgstr "" -#: ../../library/dis.rst:1459 +#: ../../library/dis.rst:1956 +msgid "Sequence of bytecodes that have a relative jump target." +msgstr "" + +#: ../../library/dis.rst:1958 +msgid "All jumps are now relative. Use :data:`hasjump`." +msgstr "" + +#: ../../library/dis.rst:1964 +msgid "Sequence of bytecodes that have an absolute jump target." +msgstr "" + +#: ../../library/dis.rst:1966 +msgid "All jumps are now relative. This list is empty." +msgstr "" + +#: ../../library/dis.rst:1582 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/dis.rst:1459 +#: ../../library/dis.rst:1582 msgid "slice" msgstr "slice(切片)" + +#~ msgid "or:" +#~ msgstr "或:" + +#~ msgid "``self``" +#~ msgstr "``self``" diff --git a/library/doctest.po b/library/doctest.po index a85b869990..fda2f389c6 100644 --- a/library/doctest.po +++ b/library/doctest.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -166,6 +166,7 @@ msgid "And so on, eventually ending with:" msgstr "" #: ../../library/doctest.rst:116 +#, fuzzy msgid "" "Trying:\n" " factorial(1e100)\n" @@ -175,10 +176,10 @@ msgid "" " OverflowError: n too large\n" "ok\n" "2 items passed all tests:\n" -" 1 tests in __main__\n" -" 8 tests in __main__.factorial\n" -"9 tests in 2 items.\n" -"9 passed and 0 failed.\n" +" 1 test in __main__\n" +" 6 tests in __main__.factorial\n" +"7 tests in 2 items.\n" +"7 passed.\n" "Test passed.\n" "$" msgstr "" @@ -1397,14 +1398,14 @@ msgid "" "continue running examples." msgstr "" -#: ../../library/doctest.rst:930 ../../library/doctest.rst:1071 +#: ../../library/doctest.rst:930 ../../library/doctest.rst:1072 msgid "" "Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) " "that should be used to extract tests from the files. It defaults to a " "normal parser (i.e., ``DocTestParser()``)." msgstr "" -#: ../../library/doctest.rst:934 ../../library/doctest.rst:1075 +#: ../../library/doctest.rst:934 ../../library/doctest.rst:1076 msgid "" "Optional argument *encoding* specifies an encoding that should be used to " "convert the file to unicode." @@ -1552,24 +1553,26 @@ msgid "" "framework and runs the interactive examples in each file. If an example in " "any file fails, then the synthesized unit test fails, and a :exc:" "`failureException` exception is raised showing the name of the file " -"containing the test and a (sometimes approximate) line number." +"containing the test and a (sometimes approximate) line number. If all the " +"examples in a file are skipped, then the synthesized unit test is also " +"marked as skipped." msgstr "" -#: ../../library/doctest.rst:1026 +#: ../../library/doctest.rst:1027 msgid "Pass one or more paths (as strings) to text files to be examined." msgstr "" -#: ../../library/doctest.rst:1028 +#: ../../library/doctest.rst:1029 msgid "Options may be provided as keyword arguments:" msgstr "" -#: ../../library/doctest.rst:1030 +#: ../../library/doctest.rst:1031 msgid "" "Optional argument *module_relative* specifies how the filenames in *paths* " "should be interpreted:" msgstr "" -#: ../../library/doctest.rst:1033 +#: ../../library/doctest.rst:1034 msgid "" "If *module_relative* is ``True`` (the default), then each filename in " "*paths* specifies an OS-independent module-relative path. By default, this " @@ -1580,14 +1583,14 @@ msgid "" "``)." msgstr "" -#: ../../library/doctest.rst:1041 +#: ../../library/doctest.rst:1042 msgid "" "If *module_relative* is ``False``, then each filename in *paths* specifies " "an OS-specific path. The path may be absolute or relative; relative paths " "are resolved with respect to the current working directory." msgstr "" -#: ../../library/doctest.rst:1045 +#: ../../library/doctest.rst:1046 msgid "" "Optional argument *package* is a Python package or the name of a Python " "package whose directory should be used as the base directory for module-" @@ -1597,7 +1600,7 @@ msgid "" "``False``." msgstr "" -#: ../../library/doctest.rst:1052 +#: ../../library/doctest.rst:1053 msgid "" "Optional argument *setUp* specifies a set-up function for the test suite. " "This is called before running the tests in each file. The *setUp* function " @@ -1605,7 +1608,7 @@ msgid "" "test globals as the *globs* attribute of the test passed." msgstr "" -#: ../../library/doctest.rst:1057 +#: ../../library/doctest.rst:1058 msgid "" "Optional argument *tearDown* specifies a tear-down function for the test " "suite. This is called after running the tests in each file. The *tearDown* " @@ -1613,14 +1616,14 @@ msgid "" "access the test globals as the *globs* attribute of the test passed." msgstr "" -#: ../../library/doctest.rst:1062 ../../library/doctest.rst:1096 +#: ../../library/doctest.rst:1063 ../../library/doctest.rst:1098 msgid "" "Optional argument *globs* is a dictionary containing the initial global " "variables for the tests. A new copy of this dictionary is created for each " "test. By default, *globs* is a new empty dictionary." msgstr "" -#: ../../library/doctest.rst:1066 +#: ../../library/doctest.rst:1067 msgid "" "Optional argument *optionflags* specifies the default doctest options for " "the tests, created by or-ing together individual option flags. See section :" @@ -1628,61 +1631,62 @@ msgid "" "for a better way to set reporting options." msgstr "" -#: ../../library/doctest.rst:1078 +#: ../../library/doctest.rst:1079 msgid "" "The global ``__file__`` is added to the globals provided to doctests loaded " "from a text file using :func:`DocFileSuite`." msgstr "" -#: ../../library/doctest.rst:1084 +#: ../../library/doctest.rst:1085 msgid "Convert doctest tests for a module to a :class:`unittest.TestSuite`." msgstr "" -#: ../../library/doctest.rst:1086 +#: ../../library/doctest.rst:1087 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " "framework and runs each doctest in the module. If any of the doctests fail, " "then the synthesized unit test fails, and a :exc:`failureException` " "exception is raised showing the name of the file containing the test and a " -"(sometimes approximate) line number." +"(sometimes approximate) line number. If all the examples in a docstring are " +"skipped, then the synthesized unit test is also marked as skipped." msgstr "" -#: ../../library/doctest.rst:1092 +#: ../../library/doctest.rst:1094 msgid "" "Optional argument *module* provides the module to be tested. It can be a " "module object or a (possibly dotted) module name. If not specified, the " "module calling this function is used." msgstr "" -#: ../../library/doctest.rst:1100 +#: ../../library/doctest.rst:1102 msgid "" "Optional argument *extraglobs* specifies an extra set of global variables, " "which is merged into *globs*. By default, no extra globals are used." msgstr "" -#: ../../library/doctest.rst:1103 +#: ../../library/doctest.rst:1105 msgid "" "Optional argument *test_finder* is the :class:`DocTestFinder` object (or a " "drop-in replacement) that is used to extract doctests from the module." msgstr "" -#: ../../library/doctest.rst:1106 +#: ../../library/doctest.rst:1108 msgid "" "Optional arguments *setUp*, *tearDown*, and *optionflags* are the same as " "for function :func:`DocFileSuite` above." msgstr "" -#: ../../library/doctest.rst:1109 +#: ../../library/doctest.rst:1111 msgid "This function uses the same search technique as :func:`testmod`." msgstr "" -#: ../../library/doctest.rst:1111 +#: ../../library/doctest.rst:1113 msgid "" ":func:`DocTestSuite` returns an empty :class:`unittest.TestSuite` if " "*module* contains no docstrings instead of raising :exc:`ValueError`." msgstr "" -#: ../../library/doctest.rst:1117 +#: ../../library/doctest.rst:1119 msgid "" "When doctests which have been converted to unit tests by :func:" "`DocFileSuite` or :func:`DocTestSuite` fail, this exception is raised " @@ -1690,7 +1694,7 @@ msgid "" "approximate) line number." msgstr "" -#: ../../library/doctest.rst:1121 +#: ../../library/doctest.rst:1123 msgid "" "Under the covers, :func:`DocTestSuite` creates a :class:`unittest.TestSuite` " "out of :class:`!doctest.DocTestCase` instances, and :class:`!DocTestCase` is " @@ -1699,14 +1703,14 @@ msgid "" "questions about the exact details of :mod:`unittest` integration." msgstr "" -#: ../../library/doctest.rst:1127 +#: ../../library/doctest.rst:1129 msgid "" "Similarly, :func:`DocFileSuite` creates a :class:`unittest.TestSuite` out " "of :class:`!doctest.DocFileCase` instances, and :class:`!DocFileCase` is a " "subclass of :class:`!DocTestCase`." msgstr "" -#: ../../library/doctest.rst:1131 +#: ../../library/doctest.rst:1133 msgid "" "So both ways of creating a :class:`unittest.TestSuite` run instances of :" "class:`!DocTestCase`. This is important for a subtle reason: when you run :" @@ -1719,23 +1723,23 @@ msgid "" "through :mod:`unittest` to :mod:`doctest` test runners." msgstr "" -#: ../../library/doctest.rst:1141 +#: ../../library/doctest.rst:1143 msgid "" "For this reason, :mod:`doctest` also supports a notion of :mod:`doctest` " "reporting flags specific to :mod:`unittest` support, via this function:" msgstr "" -#: ../../library/doctest.rst:1147 +#: ../../library/doctest.rst:1149 msgid "Set the :mod:`doctest` reporting flags to use." msgstr "" -#: ../../library/doctest.rst:1149 +#: ../../library/doctest.rst:1151 msgid "" "Argument *flags* takes the :ref:`bitwise OR ` of option flags. See " "section :ref:`doctest-options`. Only \"reporting flags\" can be used." msgstr "" -#: ../../library/doctest.rst:1152 +#: ../../library/doctest.rst:1154 msgid "" "This is a module-global setting, and affects all future doctests run by " "module :mod:`unittest`: the :meth:`!runTest` method of :class:`!" @@ -1749,17 +1753,17 @@ msgid "" "`!doctest`'s :mod:`unittest` reporting flags are ignored." msgstr "" -#: ../../library/doctest.rst:1163 +#: ../../library/doctest.rst:1165 msgid "" "The value of the :mod:`unittest` reporting flags in effect before the " "function was called is returned by the function." msgstr "" -#: ../../library/doctest.rst:1170 +#: ../../library/doctest.rst:1172 msgid "Advanced API" msgstr "" -#: ../../library/doctest.rst:1172 +#: ../../library/doctest.rst:1174 msgid "" "The basic API is a simple wrapper that's intended to make doctest easy to " "use. It is fairly flexible, and should meet most users' needs; however, if " @@ -1767,62 +1771,62 @@ msgid "" "doctest's capabilities, then you should use the advanced API." msgstr "" -#: ../../library/doctest.rst:1177 +#: ../../library/doctest.rst:1179 msgid "" "The advanced API revolves around two container classes, which are used to " "store the interactive examples extracted from doctest cases:" msgstr "" -#: ../../library/doctest.rst:1180 +#: ../../library/doctest.rst:1182 msgid "" ":class:`Example`: A single Python :term:`statement`, paired with its " "expected output." msgstr "" -#: ../../library/doctest.rst:1183 +#: ../../library/doctest.rst:1185 msgid "" ":class:`DocTest`: A collection of :class:`Example`\\ s, typically extracted " "from a single docstring or text file." msgstr "" -#: ../../library/doctest.rst:1186 +#: ../../library/doctest.rst:1188 msgid "" "Additional processing classes are defined to find, parse, and run, and check " "doctest examples:" msgstr "" -#: ../../library/doctest.rst:1189 +#: ../../library/doctest.rst:1191 msgid "" ":class:`DocTestFinder`: Finds all docstrings in a given module, and uses a :" "class:`DocTestParser` to create a :class:`DocTest` from every docstring that " "contains interactive examples." msgstr "" -#: ../../library/doctest.rst:1193 +#: ../../library/doctest.rst:1195 msgid "" ":class:`DocTestParser`: Creates a :class:`DocTest` object from a string " "(such as an object's docstring)." msgstr "" -#: ../../library/doctest.rst:1196 +#: ../../library/doctest.rst:1198 msgid "" ":class:`DocTestRunner`: Executes the examples in a :class:`DocTest`, and " "uses an :class:`OutputChecker` to verify their output." msgstr "" -#: ../../library/doctest.rst:1199 +#: ../../library/doctest.rst:1201 msgid "" ":class:`OutputChecker`: Compares the actual output from a doctest example " "with the expected output, and decides whether they match." msgstr "" -#: ../../library/doctest.rst:1202 +#: ../../library/doctest.rst:1204 msgid "" "The relationships among these processing classes are summarized in the " "following diagram::" msgstr "" -#: ../../library/doctest.rst:1205 +#: ../../library/doctest.rst:1207 msgid "" " list of:\n" "+------+ +---------+\n" @@ -1842,30 +1846,30 @@ msgstr "" " DocTestParser | Example | OutputChecker\n" " +---------+" -#: ../../library/doctest.rst:1218 +#: ../../library/doctest.rst:1220 msgid "DocTest Objects" msgstr "DocTest 物件" -#: ../../library/doctest.rst:1223 +#: ../../library/doctest.rst:1225 msgid "" "A collection of doctest examples that should be run in a single namespace. " "The constructor arguments are used to initialize the attributes of the same " "names." msgstr "" -#: ../../library/doctest.rst:1227 +#: ../../library/doctest.rst:1229 msgid "" ":class:`DocTest` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: ../../library/doctest.rst:1233 +#: ../../library/doctest.rst:1235 msgid "" "A list of :class:`Example` objects encoding the individual interactive " "Python examples that should be run by this test." msgstr "" -#: ../../library/doctest.rst:1239 +#: ../../library/doctest.rst:1241 msgid "" "The namespace (aka globals) that the examples should be run in. This is a " "dictionary mapping names to values. Any changes to the namespace made by " @@ -1873,57 +1877,57 @@ msgid "" "`globs` after the test is run." msgstr "" -#: ../../library/doctest.rst:1247 +#: ../../library/doctest.rst:1249 msgid "" "A string name identifying the :class:`DocTest`. Typically, this is the name " "of the object or file that the test was extracted from." msgstr "" -#: ../../library/doctest.rst:1253 +#: ../../library/doctest.rst:1255 msgid "" "The name of the file that this :class:`DocTest` was extracted from; or " "``None`` if the filename is unknown, or if the :class:`DocTest` was not " "extracted from a file." msgstr "" -#: ../../library/doctest.rst:1260 +#: ../../library/doctest.rst:1262 msgid "" "The line number within :attr:`filename` where this :class:`DocTest` begins, " "or ``None`` if the line number is unavailable. This line number is zero-" "based with respect to the beginning of the file." msgstr "" -#: ../../library/doctest.rst:1267 +#: ../../library/doctest.rst:1269 msgid "" "The string that the test was extracted from, or ``None`` if the string is " "unavailable, or if the test was not extracted from a string." msgstr "" -#: ../../library/doctest.rst:1274 +#: ../../library/doctest.rst:1276 msgid "Example Objects" msgstr "Example 物件" -#: ../../library/doctest.rst:1279 +#: ../../library/doctest.rst:1281 msgid "" "A single interactive example, consisting of a Python statement and its " "expected output. The constructor arguments are used to initialize the " "attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1284 +#: ../../library/doctest.rst:1286 msgid "" ":class:`Example` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: ../../library/doctest.rst:1290 +#: ../../library/doctest.rst:1292 msgid "" "A string containing the example's source code. This source code consists of " "a single Python statement, and always ends with a newline; the constructor " "adds a newline when necessary." msgstr "" -#: ../../library/doctest.rst:1297 +#: ../../library/doctest.rst:1299 msgid "" "The expected output from running the example's source code (either from " "stdout, or a traceback in case of exception). :attr:`want` ends with a " @@ -1931,7 +1935,7 @@ msgid "" "The constructor adds a newline when necessary." msgstr "" -#: ../../library/doctest.rst:1305 +#: ../../library/doctest.rst:1307 msgid "" "The exception message generated by the example, if the example is expected " "to generate an exception; or ``None`` if it is not expected to generate an " @@ -1940,20 +1944,20 @@ msgid "" "unless it's ``None``. The constructor adds a newline if needed." msgstr "" -#: ../../library/doctest.rst:1314 +#: ../../library/doctest.rst:1316 msgid "" "The line number within the string containing this example where the example " "begins. This line number is zero-based with respect to the beginning of the " "containing string." msgstr "" -#: ../../library/doctest.rst:1321 +#: ../../library/doctest.rst:1323 msgid "" "The example's indentation in the containing string, i.e., the number of " "space characters that precede the example's first prompt." msgstr "" -#: ../../library/doctest.rst:1327 +#: ../../library/doctest.rst:1329 msgid "" "A dictionary mapping from option flags to ``True`` or ``False``, which is " "used to override default options for this example. Any option flags not " @@ -1962,11 +1966,11 @@ msgid "" "default, no options are set." msgstr "" -#: ../../library/doctest.rst:1337 +#: ../../library/doctest.rst:1339 msgid "DocTestFinder objects" msgstr "DocTestFinder 物件" -#: ../../library/doctest.rst:1342 +#: ../../library/doctest.rst:1344 msgid "" "A processing class used to extract the :class:`DocTest`\\ s that are " "relevant to a given object, from its docstring and the docstrings of its " @@ -1974,48 +1978,48 @@ msgid "" "classes, functions, methods, staticmethods, classmethods, and properties." msgstr "" -#: ../../library/doctest.rst:1347 +#: ../../library/doctest.rst:1349 msgid "" "The optional argument *verbose* can be used to display the objects searched " "by the finder. It defaults to ``False`` (no output)." msgstr "" -#: ../../library/doctest.rst:1350 +#: ../../library/doctest.rst:1352 msgid "" "The optional argument *parser* specifies the :class:`DocTestParser` object " "(or a drop-in replacement) that is used to extract doctests from docstrings." msgstr "" -#: ../../library/doctest.rst:1353 +#: ../../library/doctest.rst:1355 msgid "" "If the optional argument *recurse* is false, then :meth:`DocTestFinder.find` " "will only examine the given object, and not any contained objects." msgstr "" -#: ../../library/doctest.rst:1356 +#: ../../library/doctest.rst:1358 msgid "" "If the optional argument *exclude_empty* is false, then :meth:`DocTestFinder." "find` will include tests for objects with empty docstrings." msgstr "" -#: ../../library/doctest.rst:1360 +#: ../../library/doctest.rst:1362 msgid ":class:`DocTestFinder` defines the following method:" msgstr "" -#: ../../library/doctest.rst:1365 +#: ../../library/doctest.rst:1367 msgid "" "Return a list of the :class:`DocTest`\\ s that are defined by *obj*'s " "docstring, or by any of its contained objects' docstrings." msgstr "" -#: ../../library/doctest.rst:1368 +#: ../../library/doctest.rst:1370 msgid "" "The optional argument *name* specifies the object's name; this name will be " "used to construct names for the returned :class:`DocTest`\\ s. If *name* is " "not specified, then ``obj.__name__`` is used." msgstr "" -#: ../../library/doctest.rst:1372 +#: ../../library/doctest.rst:1374 msgid "" "The optional parameter *module* is the module that contains the given " "object. If the module is not specified or is ``None``, then the test finder " @@ -2023,26 +2027,26 @@ msgid "" "module is used:" msgstr "" -#: ../../library/doctest.rst:1376 +#: ../../library/doctest.rst:1378 msgid "As a default namespace, if *globs* is not specified." msgstr "" -#: ../../library/doctest.rst:1378 +#: ../../library/doctest.rst:1380 msgid "" "To prevent the DocTestFinder from extracting DocTests from objects that are " "imported from other modules. (Contained objects with modules other than " "*module* are ignored.)" msgstr "" -#: ../../library/doctest.rst:1382 +#: ../../library/doctest.rst:1384 msgid "To find the name of the file containing the object." msgstr "" -#: ../../library/doctest.rst:1384 +#: ../../library/doctest.rst:1386 msgid "To help find the line number of the object within its file." msgstr "" -#: ../../library/doctest.rst:1386 +#: ../../library/doctest.rst:1388 msgid "" "If *module* is ``False``, no attempt to find the module will be made. This " "is obscure, of use mostly in testing doctest itself: if *module* is " @@ -2051,7 +2055,7 @@ msgid "" "contained objects will (recursively) be searched for doctests." msgstr "" -#: ../../library/doctest.rst:1392 +#: ../../library/doctest.rst:1394 msgid "" "The globals for each :class:`DocTest` is formed by combining *globs* and " "*extraglobs* (bindings in *extraglobs* override bindings in *globs*). A new " @@ -2061,34 +2065,34 @@ msgid "" "defaults to ``{}``." msgstr "" -#: ../../library/doctest.rst:1403 +#: ../../library/doctest.rst:1405 msgid "DocTestParser objects" msgstr "DocTestParser 物件" -#: ../../library/doctest.rst:1408 +#: ../../library/doctest.rst:1410 msgid "" "A processing class used to extract interactive examples from a string, and " "use them to create a :class:`DocTest` object." msgstr "" -#: ../../library/doctest.rst:1412 +#: ../../library/doctest.rst:1414 msgid ":class:`DocTestParser` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1417 +#: ../../library/doctest.rst:1419 msgid "" "Extract all doctest examples from the given string, and collect them into a :" "class:`DocTest` object." msgstr "" -#: ../../library/doctest.rst:1420 +#: ../../library/doctest.rst:1422 msgid "" "*globs*, *name*, *filename*, and *lineno* are attributes for the new :class:" "`DocTest` object. See the documentation for :class:`DocTest` for more " "information." msgstr "" -#: ../../library/doctest.rst:1427 +#: ../../library/doctest.rst:1429 msgid "" "Extract all doctest examples from the given string, and return them as a " "list of :class:`Example` objects. Line numbers are 0-based. The optional " @@ -2096,7 +2100,7 @@ msgid "" "error messages." msgstr "" -#: ../../library/doctest.rst:1434 +#: ../../library/doctest.rst:1436 msgid "" "Divide the given string into examples and intervening text, and return them " "as a list of alternating :class:`Example`\\ s and strings. Line numbers for " @@ -2105,16 +2109,33 @@ msgid "" msgstr "" #: ../../library/doctest.rst:1443 +#, fuzzy +msgid "TestResults objects" +msgstr "DocTestRunner 物件" + +#: ../../library/doctest.rst:1450 +msgid "Number of failed tests." +msgstr "" + +#: ../../library/doctest.rst:1454 +msgid "Number of attempted tests." +msgstr "" + +#: ../../library/doctest.rst:1458 +msgid "Number of skipped tests." +msgstr "" + +#: ../../library/doctest.rst:1466 msgid "DocTestRunner objects" msgstr "DocTestRunner 物件" -#: ../../library/doctest.rst:1448 +#: ../../library/doctest.rst:1471 msgid "" "A processing class used to execute and verify the interactive examples in a :" "class:`DocTest`." msgstr "" -#: ../../library/doctest.rst:1451 +#: ../../library/doctest.rst:1474 msgid "" "The comparison between expected outputs and actual outputs is done by an :" "class:`OutputChecker`. This comparison may be customized with a number of " @@ -2124,7 +2145,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/doctest.rst:1457 +#: ../../library/doctest.rst:1480 msgid "" "The test runner's display output can be controlled in two ways. First, an " "output function can be passed to :meth:`run`; this function will be called " @@ -2135,14 +2156,14 @@ msgid "" "`report_unexpected_exception`, and :meth:`report_failure`." msgstr "" -#: ../../library/doctest.rst:1465 +#: ../../library/doctest.rst:1488 msgid "" "The optional keyword argument *checker* specifies the :class:`OutputChecker` " "object (or drop-in replacement) that should be used to compare the expected " "outputs to the actual outputs of doctest examples." msgstr "" -#: ../../library/doctest.rst:1469 +#: ../../library/doctest.rst:1492 msgid "" "The optional keyword argument *verbose* controls the :class:" "`DocTestRunner`'s verbosity. If *verbose* is ``True``, then information is " @@ -2151,60 +2172,68 @@ msgid "" "verbose output is used iff the command-line switch ``-v`` is used." msgstr "" -#: ../../library/doctest.rst:1475 +#: ../../library/doctest.rst:1498 msgid "" "The optional keyword argument *optionflags* can be used to control how the " "test runner compares expected output to actual output, and how it displays " "failures. For more information, see section :ref:`doctest-options`." msgstr "" -#: ../../library/doctest.rst:1480 +#: ../../library/doctest.rst:1502 +msgid "" +"The test runner accumulates statistics. The aggregated number of attempted, " +"failed and skipped examples is also available via the :attr:`tries`, :attr:" +"`failures` and :attr:`skips` attributes. The :meth:`run` and :meth:" +"`summarize` methods return a :class:`TestResults` instance." +msgstr "" + +#: ../../library/doctest.rst:1507 msgid ":class:`DocTestRunner` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1485 +#: ../../library/doctest.rst:1512 msgid "" "Report that the test runner is about to process the given example. This " "method is provided to allow subclasses of :class:`DocTestRunner` to " "customize their output; it should not be called directly." msgstr "" -#: ../../library/doctest.rst:1489 +#: ../../library/doctest.rst:1516 msgid "" "*example* is the example about to be processed. *test* is the test " "*containing example*. *out* is the output function that was passed to :meth:" "`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1496 +#: ../../library/doctest.rst:1523 msgid "" "Report that the given example ran successfully. This method is provided to " "allow subclasses of :class:`DocTestRunner` to customize their output; it " "should not be called directly." msgstr "" -#: ../../library/doctest.rst:1500 ../../library/doctest.rst:1511 +#: ../../library/doctest.rst:1527 ../../library/doctest.rst:1538 msgid "" "*example* is the example about to be processed. *got* is the actual output " "from the example. *test* is the test containing *example*. *out* is the " "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1507 +#: ../../library/doctest.rst:1534 msgid "" "Report that the given example failed. This method is provided to allow " "subclasses of :class:`DocTestRunner` to customize their output; it should " "not be called directly." msgstr "" -#: ../../library/doctest.rst:1518 +#: ../../library/doctest.rst:1545 msgid "" "Report that the given example raised an unexpected exception. This method is " "provided to allow subclasses of :class:`DocTestRunner` to customize their " "output; it should not be called directly." msgstr "" -#: ../../library/doctest.rst:1522 +#: ../../library/doctest.rst:1549 msgid "" "*example* is the example about to be processed. *exc_info* is a tuple " "containing information about the unexpected exception (as returned by :func:" @@ -2212,13 +2241,14 @@ msgid "" "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1530 +#: ../../library/doctest.rst:1557 msgid "" "Run the examples in *test* (a :class:`DocTest` object), and display the " -"results using the writer function *out*." +"results using the writer function *out*. Return a :class:`TestResults` " +"instance." msgstr "" -#: ../../library/doctest.rst:1533 +#: ../../library/doctest.rst:1561 msgid "" "The examples are run in the namespace ``test.globs``. If *clear_globs* is " "true (the default), then this namespace will be cleared after the test runs, " @@ -2226,39 +2256,55 @@ msgid "" "after the test completes, then use *clear_globs=False*." msgstr "" -#: ../../library/doctest.rst:1538 +#: ../../library/doctest.rst:1566 msgid "" "*compileflags* gives the set of flags that should be used by the Python " "compiler when running the examples. If not specified, then it will default " "to the set of future-import flags that apply to *globs*." msgstr "" -#: ../../library/doctest.rst:1542 +#: ../../library/doctest.rst:1570 msgid "" "The output of each example is checked using the :class:`DocTestRunner`'s " "output checker, and the results are formatted by the :meth:`!DocTestRunner." "report_\\*` methods." msgstr "" -#: ../../library/doctest.rst:1549 +#: ../../library/doctest.rst:1577 msgid "" "Print a summary of all the test cases that have been run by this " -"DocTestRunner, and return a :term:`named tuple` ``TestResults(failed, " -"attempted)``." +"DocTestRunner, and return a :class:`TestResults` instance." msgstr "" -#: ../../library/doctest.rst:1552 +#: ../../library/doctest.rst:1580 msgid "" "The optional *verbose* argument controls how detailed the summary is. If " "the verbosity is not specified, then the :class:`DocTestRunner`'s verbosity " "is used." msgstr "" -#: ../../library/doctest.rst:1559 +#: ../../library/doctest.rst:1584 +#, fuzzy +msgid ":class:`DocTestParser` has the following attributes:" +msgstr ":exc:`DocTestFailure` 定義了以下屬性:" + +#: ../../library/doctest.rst:1588 +msgid "Number of attempted examples." +msgstr "" + +#: ../../library/doctest.rst:1592 +msgid "Number of failed examples." +msgstr "" + +#: ../../library/doctest.rst:1596 +msgid "Number of skipped examples." +msgstr "" + +#: ../../library/doctest.rst:1604 msgid "OutputChecker objects" msgstr "OutputChecker 物件" -#: ../../library/doctest.rst:1564 +#: ../../library/doctest.rst:1609 msgid "" "A class used to check the whether the actual output from a doctest example " "matches the expected output. :class:`OutputChecker` defines two methods: :" @@ -2267,11 +2313,11 @@ msgid "" "string describing the differences between two outputs." msgstr "" -#: ../../library/doctest.rst:1571 +#: ../../library/doctest.rst:1616 msgid ":class:`OutputChecker` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1575 +#: ../../library/doctest.rst:1620 msgid "" "Return ``True`` iff the actual output from an example (*got*) matches the " "expected output (*want*). These strings are always considered to match if " @@ -2280,28 +2326,28 @@ msgid "" "`doctest-options` for more information about option flags." msgstr "" -#: ../../library/doctest.rst:1584 +#: ../../library/doctest.rst:1629 msgid "" "Return a string describing the differences between the expected output for a " "given example (*example*) and the actual output (*got*). *optionflags* is " "the set of option flags used to compare *want* and *got*." msgstr "" -#: ../../library/doctest.rst:1592 +#: ../../library/doctest.rst:1637 msgid "Debugging" msgstr "" -#: ../../library/doctest.rst:1594 +#: ../../library/doctest.rst:1639 msgid "Doctest provides several mechanisms for debugging doctest examples:" msgstr "" -#: ../../library/doctest.rst:1596 +#: ../../library/doctest.rst:1641 msgid "" "Several functions convert doctests to executable Python programs, which can " "be run under the Python debugger, :mod:`pdb`." msgstr "" -#: ../../library/doctest.rst:1599 +#: ../../library/doctest.rst:1644 msgid "" "The :class:`DebugRunner` class is a subclass of :class:`DocTestRunner` that " "raises an exception for the first failing example, containing information " @@ -2309,13 +2355,13 @@ msgid "" "debugging on the example." msgstr "" -#: ../../library/doctest.rst:1604 +#: ../../library/doctest.rst:1649 msgid "" "The :mod:`unittest` cases generated by :func:`DocTestSuite` support the :" "meth:`debug` method defined by :class:`unittest.TestCase`." msgstr "" -#: ../../library/doctest.rst:1607 +#: ../../library/doctest.rst:1652 msgid "" "You can add a call to :func:`pdb.set_trace` in a doctest example, and you'll " "drop into the Python debugger when that line is executed. Then you can " @@ -2323,7 +2369,7 @@ msgid "" "`a.py` contains just this module docstring::" msgstr "" -#: ../../library/doctest.rst:1612 +#: ../../library/doctest.rst:1657 msgid "" "\"\"\"\n" ">>> def f(x):\n" @@ -2345,11 +2391,11 @@ msgstr "" "9\n" "\"\"\"" -#: ../../library/doctest.rst:1622 +#: ../../library/doctest.rst:1667 msgid "Then an interactive Python session may look like this::" msgstr "" -#: ../../library/doctest.rst:1624 +#: ../../library/doctest.rst:1669 msgid "" ">>> import a, doctest\n" ">>> doctest.testmod(a)\n" @@ -2411,17 +2457,17 @@ msgstr "" "(0, 3)\n" ">>>" -#: ../../library/doctest.rst:1655 +#: ../../library/doctest.rst:1700 msgid "" "Functions that convert doctests to Python code, and possibly run the " "synthesized code under the debugger:" msgstr "" -#: ../../library/doctest.rst:1661 +#: ../../library/doctest.rst:1706 msgid "Convert text with examples to a script." msgstr "" -#: ../../library/doctest.rst:1663 +#: ../../library/doctest.rst:1708 msgid "" "Argument *s* is a string containing doctest examples. The string is " "converted to a Python script, where doctest examples in *s* are converted to " @@ -2429,7 +2475,7 @@ msgid "" "generated script is returned as a string. For example, ::" msgstr "" -#: ../../library/doctest.rst:1668 +#: ../../library/doctest.rst:1713 msgid "" "import doctest\n" "print(doctest.script_from_examples(r\"\"\"\n" @@ -2442,11 +2488,11 @@ msgid "" "\"\"\"))" msgstr "" -#: ../../library/doctest.rst:1678 +#: ../../library/doctest.rst:1723 msgid "displays::" msgstr "" -#: ../../library/doctest.rst:1680 +#: ../../library/doctest.rst:1725 msgid "" "# Set x and y to 1 and 2.\n" "x, y = 1, 2\n" @@ -2457,18 +2503,18 @@ msgid "" "## 3" msgstr "" -#: ../../library/doctest.rst:1688 +#: ../../library/doctest.rst:1733 msgid "" "This function is used internally by other functions (see below), but can " "also be useful when you want to transform an interactive Python session into " "a Python script." msgstr "" -#: ../../library/doctest.rst:1695 +#: ../../library/doctest.rst:1740 msgid "Convert the doctest for an object to a script." msgstr "" -#: ../../library/doctest.rst:1697 +#: ../../library/doctest.rst:1742 msgid "" "Argument *module* is a module object, or dotted name of a module, containing " "the object whose doctests are of interest. Argument *name* is the name " @@ -2478,7 +2524,7 @@ msgid "" "module :file:`a.py` contains a top-level function :func:`!f`, then ::" msgstr "" -#: ../../library/doctest.rst:1704 +#: ../../library/doctest.rst:1749 msgid "" "import a, doctest\n" "print(doctest.testsource(a, \"a.f\"))" @@ -2486,17 +2532,17 @@ msgstr "" "import a, doctest\n" "print(doctest.testsource(a, \"a.f\"))" -#: ../../library/doctest.rst:1707 +#: ../../library/doctest.rst:1752 msgid "" "prints a script version of function :func:`!f`'s docstring, with doctests " "converted to code, and the rest placed in comments." msgstr "" -#: ../../library/doctest.rst:1713 +#: ../../library/doctest.rst:1758 msgid "Debug the doctests for an object." msgstr "" -#: ../../library/doctest.rst:1715 +#: ../../library/doctest.rst:1760 msgid "" "The *module* and *name* arguments are the same as for function :func:" "`testsource` above. The synthesized Python script for the named object's " @@ -2504,13 +2550,13 @@ msgid "" "the control of the Python debugger, :mod:`pdb`." msgstr "" -#: ../../library/doctest.rst:1720 +#: ../../library/doctest.rst:1765 msgid "" "A shallow copy of ``module.__dict__`` is used for both local and global " "execution context." msgstr "" -#: ../../library/doctest.rst:1723 +#: ../../library/doctest.rst:1768 msgid "" "Optional argument *pm* controls whether post-mortem debugging is used. If " "*pm* has a true value, the script file is run directly, and the debugger " @@ -2522,30 +2568,30 @@ msgid "" "to :func:`pdb.run`." msgstr "" -#: ../../library/doctest.rst:1734 +#: ../../library/doctest.rst:1779 msgid "Debug the doctests in a string." msgstr "" -#: ../../library/doctest.rst:1736 +#: ../../library/doctest.rst:1781 msgid "" "This is like function :func:`debug` above, except that a string containing " "doctest examples is specified directly, via the *src* argument." msgstr "" -#: ../../library/doctest.rst:1739 +#: ../../library/doctest.rst:1784 msgid "" "Optional argument *pm* has the same meaning as in function :func:`debug` " "above." msgstr "" -#: ../../library/doctest.rst:1741 +#: ../../library/doctest.rst:1786 msgid "" "Optional argument *globs* gives a dictionary to use as both local and global " "execution context. If not specified, or ``None``, an empty dictionary is " "used. If specified, a shallow copy of the dictionary is used." msgstr "" -#: ../../library/doctest.rst:1746 +#: ../../library/doctest.rst:1791 msgid "" "The :class:`DebugRunner` class, and the special exceptions it may raise, are " "of most interest to testing framework authors, and will only be sketched " @@ -2553,7 +2599,7 @@ msgid "" "(which is a doctest!) for more details:" msgstr "" -#: ../../library/doctest.rst:1754 +#: ../../library/doctest.rst:1799 msgid "" "A subclass of :class:`DocTestRunner` that raises an exception as soon as a " "failure is encountered. If an unexpected exception occurs, an :exc:" @@ -2563,89 +2609,89 @@ msgid "" "the actual output." msgstr "" -#: ../../library/doctest.rst:1761 +#: ../../library/doctest.rst:1806 msgid "" "For information about the constructor parameters and methods, see the " "documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-" "api`." msgstr "" -#: ../../library/doctest.rst:1764 +#: ../../library/doctest.rst:1809 msgid "" "There are two exceptions that may be raised by :class:`DebugRunner` " "instances:" msgstr "" -#: ../../library/doctest.rst:1769 +#: ../../library/doctest.rst:1814 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example's actual output did not match its expected output. The constructor " "arguments are used to initialize the attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1773 +#: ../../library/doctest.rst:1818 msgid ":exc:`DocTestFailure` defines the following attributes:" msgstr ":exc:`DocTestFailure` 定義了以下屬性:" -#: ../../library/doctest.rst:1778 ../../library/doctest.rst:1802 +#: ../../library/doctest.rst:1823 ../../library/doctest.rst:1847 msgid "The :class:`DocTest` object that was being run when the example failed." msgstr "" -#: ../../library/doctest.rst:1783 ../../library/doctest.rst:1807 +#: ../../library/doctest.rst:1828 ../../library/doctest.rst:1852 msgid "The :class:`Example` that failed." msgstr "" -#: ../../library/doctest.rst:1788 +#: ../../library/doctest.rst:1833 msgid "The example's actual output." msgstr "" -#: ../../library/doctest.rst:1793 +#: ../../library/doctest.rst:1838 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example raised an unexpected exception. The constructor arguments are used " "to initialize the attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1797 +#: ../../library/doctest.rst:1842 msgid ":exc:`UnexpectedException` defines the following attributes:" msgstr "" -#: ../../library/doctest.rst:1812 +#: ../../library/doctest.rst:1857 msgid "" "A tuple containing information about the unexpected exception, as returned " "by :func:`sys.exc_info`." msgstr "" -#: ../../library/doctest.rst:1819 +#: ../../library/doctest.rst:1864 msgid "Soapbox" msgstr "" -#: ../../library/doctest.rst:1821 +#: ../../library/doctest.rst:1866 msgid "" "As mentioned in the introduction, :mod:`doctest` has grown to have three " "primary uses:" msgstr "" -#: ../../library/doctest.rst:1824 +#: ../../library/doctest.rst:1869 msgid "Checking examples in docstrings." msgstr "" -#: ../../library/doctest.rst:1826 +#: ../../library/doctest.rst:1871 msgid "Regression testing." msgstr "" -#: ../../library/doctest.rst:1828 +#: ../../library/doctest.rst:1873 msgid "Executable documentation / literate testing." msgstr "" -#: ../../library/doctest.rst:1830 +#: ../../library/doctest.rst:1875 msgid "" "These uses have different requirements, and it is important to distinguish " "them. In particular, filling your docstrings with obscure test cases makes " "for bad documentation." msgstr "" -#: ../../library/doctest.rst:1834 +#: ../../library/doctest.rst:1879 msgid "" "When writing a docstring, choose docstring examples with care. There's an " "art to this that needs to be learned---it may not be natural at first. " @@ -2657,7 +2703,7 @@ msgid "" "\"harmless\" change." msgstr "" -#: ../../library/doctest.rst:1842 +#: ../../library/doctest.rst:1887 msgid "" "Doctest also makes an excellent tool for regression testing, especially if " "you don't skimp on explanatory text. By interleaving prose and examples, it " @@ -2678,13 +2724,13 @@ msgid "" "different results, blurring the distinction between testing and explaining." msgstr "" -#: ../../library/doctest.rst:1860 +#: ../../library/doctest.rst:1905 msgid "" "Regression testing is best confined to dedicated objects or files. There " "are several options for organizing tests:" msgstr "" -#: ../../library/doctest.rst:1863 +#: ../../library/doctest.rst:1908 msgid "" "Write text files containing test cases as interactive examples, and test the " "files using :func:`testfile` or :func:`DocFileSuite`. This is recommended, " @@ -2692,7 +2738,7 @@ msgid "" "doctest." msgstr "" -#: ../../library/doctest.rst:1868 +#: ../../library/doctest.rst:1913 msgid "" "Define functions named ``_regrtest_topic`` that consist of single " "docstrings, containing test cases for the named topics. These functions can " @@ -2700,13 +2746,13 @@ msgid "" "test file." msgstr "" -#: ../../library/doctest.rst:1872 +#: ../../library/doctest.rst:1917 msgid "" "Define a ``__test__`` dictionary mapping from regression test topics to " "docstrings containing test cases." msgstr "" -#: ../../library/doctest.rst:1875 +#: ../../library/doctest.rst:1920 msgid "" "When you have placed your tests in a module, the module can itself be the " "test runner. When a test fails, you can arrange for your test runner to re-" @@ -2714,7 +2760,8 @@ msgid "" "example of such a test runner::" msgstr "" -#: ../../library/doctest.rst:1880 +#: ../../library/doctest.rst:1925 +#, fuzzy msgid "" "if __name__ == '__main__':\n" " import doctest\n" @@ -2729,7 +2776,7 @@ msgid "" " optionflags=flags)\n" " else:\n" " fail, total = doctest.testmod(optionflags=flags)\n" -" print(\"{} failures out of {} tests\".format(fail, total))" +" print(f\"{fail} failures out of {total} tests\")" msgstr "" "if __name__ == '__main__':\n" " import doctest\n" @@ -2746,11 +2793,11 @@ msgstr "" " fail, total = doctest.testmod(optionflags=flags)\n" " print(\"{} failures out of {} tests\".format(fail, total))" -#: ../../library/doctest.rst:1897 +#: ../../library/doctest.rst:1942 msgid "Footnotes" msgstr "註解" -#: ../../library/doctest.rst:1898 +#: ../../library/doctest.rst:1943 msgid "" "Examples containing both expected output and an exception are not supported. " "Trying to guess where one ends and the other begins is too error-prone, and " diff --git a/library/email.examples.po b/library/email.examples.po index 31933d8dcb..fe74e43133 100644 --- a/library/email.examples.po +++ b/library/email.examples.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -197,7 +197,7 @@ msgid "" " # Guess the content type based on the file's extension. Encoding\n" " # will be ignored, although we should check for simple things like\n" " # gzip'd or compressed files.\n" -" ctype, encoding = mimetypes.guess_type(path)\n" +" ctype, encoding = mimetypes.guess_file_type(path)\n" " if ctype is None or encoding is not None:\n" " # No guess could be made, or the file is encoded (compressed), " "so\n" @@ -306,14 +306,14 @@ msgid "" "\n" "# Create the base text message.\n" "msg = EmailMessage()\n" -"msg['Subject'] = \"Ayons asperges pour le déjeuner\"\n" +"msg['Subject'] = \"Pourquoi pas des asperges pour ce midi ?\"\n" "msg['From'] = Address(\"Pepé Le Pew\", \"pepe\", \"example.com\")\n" "msg['To'] = (Address(\"Penelope Pussycat\", \"penelope\", \"example.com\"),\n" " Address(\"Fabrette Pussycat\", \"fabrette\", \"example.com\"))\n" "msg.set_content(\"\"\"\\\n" "Salut!\n" "\n" -"Cela ressemble à un excellent recipie[1] déjeuner.\n" +"Cette recette [1] sera sûrement un très bon repas.\n" "\n" "[1] http://www.yummly.com/recipe/Roasted-Asparagus-Epicurious-203718\n" "\n" @@ -331,11 +331,11 @@ msgid "" " \n" " \n" "

Salut!

\n" -"

Cela ressemble à un excellent\n" +"

Cette\n" " \n" -" recipie\n" -" déjeuner.\n" +" recette\n" +" sera sûrement un très bon repas.\n" "

\n" " \n" " \n" @@ -463,11 +463,11 @@ msgid "" "To: Penelope Pussycat , Fabrette Pussycat " "\n" "From: Pepé Le Pew \n" -"Subject: Ayons asperges pour le déjeuner\n" +"Subject: Pourquoi pas des asperges pour ce midi ?\n" "\n" "Salut!\n" "\n" -"Cela ressemble à un excellent recipie[1] déjeuner." +"Cette recette [1] sera sûrement un très bon repas." msgstr "" #: ../../library/email.examples.rst:66 diff --git a/library/email.generator.po b/library/email.generator.po index 97e310ce13..64c675911d 100644 --- a/library/email.generator.po +++ b/library/email.generator.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,9 +31,9 @@ msgid "" "One of the most common tasks is to generate the flat (serialized) version of " "the email message represented by a message object structure. You will need " "to do this if you want to send your message via :meth:`smtplib.SMTP." -"sendmail` or the :mod:`nntplib` module, or print the message on the " -"console. Taking a message object structure and producing a serialized " -"representation is the job of the generator classes." +"sendmail`, or print the message on the console. Taking a message object " +"structure and producing a serialized representation is the job of the " +"generator classes." msgstr "" #: ../../library/email.generator.rst:18 diff --git a/library/email.po b/library/email.po index 583f0d7880..da6d04ebe5 100644 --- a/library/email.po +++ b/library/email.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,10 +31,10 @@ msgid "" "The :mod:`email` package is a library for managing email messages. It is " "specifically *not* designed to do any sending of email messages to SMTP (:" "rfc:`2821`), NNTP, or other servers; those are functions of modules such as :" -"mod:`smtplib` and :mod:`nntplib`. The :mod:`email` package attempts to be " -"as RFC-compliant as possible, supporting :rfc:`5322` and :rfc:`6532`, as " -"well as such MIME-related RFCs as :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, :" -"rfc:`2183`, and :rfc:`2231`." +"mod:`smtplib`. The :mod:`email` package attempts to be as RFC-compliant as " +"possible, supporting :rfc:`5322` and :rfc:`6532`, as well as such MIME-" +"related RFCs as :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, :rfc:`2183`, and :rfc:" +"`2231`." msgstr "" #: ../../library/email.rst:23 @@ -181,22 +181,17 @@ msgid "IMAP (Internet Message Access Protocol) client" msgstr "" #: ../../library/email.rst:144 -msgid "Module :mod:`nntplib`" -msgstr ":mod:`nntplib` 模組" - -#: ../../library/email.rst:145 -msgid "NNTP (Net News Transport Protocol) client" -msgstr "" - -#: ../../library/email.rst:147 msgid "Module :mod:`mailbox`" msgstr ":mod:`mailbox` 模組" -#: ../../library/email.rst:148 +#: ../../library/email.rst:145 msgid "" "Tools for creating, reading, and managing collections of messages on disk " "using a variety standard formats." msgstr "" +#~ msgid "Module :mod:`nntplib`" +#~ msgstr ":mod:`nntplib` 模組" + #~ msgid "Module :mod:`smtpd`" #~ msgstr ":mod:`smtpd` 模組" diff --git a/library/ensurepip.po b/library/ensurepip.po index 4a991ef370..8b2bc4d453 100644 --- a/library/ensurepip.po +++ b/library/ensurepip.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -75,15 +75,17 @@ msgstr ":pep:`453`: 在 Python 安裝中的 pip 明確初始建置" msgid "The original rationale and specification for this module." msgstr "此模組的最初設計理念與規範。" -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +#: ../../includes/wasm-ios-notavail.rst:3 +msgid ":ref:`Availability `: not WASI, not iOS." msgstr "" -#: ../../includes/wasm-notavail.rst:5 +#: ../../includes/wasm-ios-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly platforms, or " +"on iOS. See :ref:`wasm-availability` for more information on WASM " +"availability; see :ref:`iOS-availability` for more information on iOS " +"availability." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/enum.po b/library/enum.po index b98379c42b..d67a0bd1b5 100644 --- a/library/enum.po +++ b/library/enum.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-09-11 14:08+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -335,11 +335,12 @@ msgstr "" "節請參考 :ref:`建立 EnumType 的子類別 `。" #: ../../library/enum.rst:168 +#, fuzzy msgid "" -"*EnumType* is responsible for setting the correct :meth:`!__repr__`, :meth:`!" -"__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the final " -"*enum*, as well as creating the enum members, properly handling duplicates, " -"providing iteration over the enum class, etc." +"``EnumType`` is responsible for setting the correct :meth:`!__repr__`, :meth:" +"`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the " +"final *enum*, as well as creating the enum members, properly handling " +"duplicates, providing iteration over the enum class, etc." msgstr "" "*EnumType* 負責在最後的\\ *列舉*\\ 上面設定正確的 :meth:`!__repr__`、:meth:`!" "__str__`、:meth:`!__format__` 及 :meth:`!__reduce__` 方法,以及建立列舉成員," @@ -529,19 +530,34 @@ msgstr "" "[, , ]" #: ../../library/enum.rst:251 -msgid "Before 3.11 ``enum`` used ``EnumMeta`` type, which is kept as an alias." +msgid "" +"Adds a new name as an alias to an existing member. Raises a :exc:" +"`NameError` if the name is already assigned to a different member." msgstr "" -"在 3.11 之前,``enum`` 使用 ``EnumMeta`` 類型,目前保留此類型當作別名。" #: ../../library/enum.rst:256 +msgid "" +"Adds a new value as an alias to an existing member. Raises a :exc:" +"`ValueError` if the value is already linked with a different member." +msgstr "" + +#: ../../library/enum.rst:261 +#, fuzzy +msgid "" +"Before 3.11 ``EnumType`` was called ``EnumMeta``, which is still available " +"as an alias." +msgstr "" +"在 3.11 之前,``enum`` 使用 ``EnumMeta`` 類型,目前保留此類型當作別名。" + +#: ../../library/enum.rst:266 msgid "*Enum* is the base class for all *enum* enumerations." msgstr "*Enum* 是所有 *enum* 列舉的基礎類別。" -#: ../../library/enum.rst:260 +#: ../../library/enum.rst:270 msgid "The name used to define the ``Enum`` member::" msgstr "用來定義 ``Enum`` 成員的名稱: ::" -#: ../../library/enum.rst:262 +#: ../../library/enum.rst:272 msgid "" ">>> Color.BLUE.name\n" "'BLUE'" @@ -549,11 +565,11 @@ msgstr "" ">>> Color.BLUE.name\n" "'BLUE'" -#: ../../library/enum.rst:267 +#: ../../library/enum.rst:277 msgid "The value given to the ``Enum`` member::" msgstr "``Enum`` 成員給定的值: ::" -#: ../../library/enum.rst:269 +#: ../../library/enum.rst:279 msgid "" ">>> Color.RED.value\n" "1" @@ -561,15 +577,15 @@ msgstr "" ">>> Color.RED.value\n" "1" -#: ../../library/enum.rst:272 ../../library/enum.rst:292 +#: ../../library/enum.rst:282 ../../library/enum.rst:302 msgid "Value of the member, can be set in :meth:`~Enum.__new__`." msgstr "成員的值,可以在 :meth:`~Enum.__new__` 設定。" -#: ../../library/enum.rst:274 +#: ../../library/enum.rst:284 msgid "Enum member values" msgstr "列舉成員的值" -#: ../../library/enum.rst:276 +#: ../../library/enum.rst:286 msgid "" "Member values can be anything: :class:`int`, :class:`str`, etc. If the " "exact value is unimportant you may use :class:`auto` instances and an " @@ -579,7 +595,7 @@ msgstr "" "重要,你可以使用 :class:`auto` 實例,它會為你選擇合適的值。更多細節請參考 :" "class:`auto`。" -#: ../../library/enum.rst:281 +#: ../../library/enum.rst:291 msgid "" "While mutable/unhashable values, such as :class:`dict`, :class:`list` or a " "mutable :class:`~dataclasses.dataclass`, can be used, they will have a " @@ -587,23 +603,23 @@ msgid "" "mutable/unhashable values in the enum." msgstr "" -#: ../../library/enum.rst:288 +#: ../../library/enum.rst:298 msgid "Name of the member." msgstr "成員名稱。" -#: ../../library/enum.rst:296 +#: ../../library/enum.rst:306 msgid "" "No longer used, kept for backward compatibility. (class attribute, removed " "during class creation)." msgstr "已不再使用,只為了向後相容而保留(類別屬性,在類別建立時移除)" -#: ../../library/enum.rst:301 +#: ../../library/enum.rst:311 msgid "" "``_ignore_`` is only used during creation and is removed from the " "enumeration once creation is complete." msgstr "``_ignore_`` 只有在建立的時候用到,在列舉建立完成後會被移除。" -#: ../../library/enum.rst:304 +#: ../../library/enum.rst:314 msgid "" "``_ignore_`` is a list of names that will not become members, and whose " "names will also be removed from the completed enumeration. See :ref:" @@ -612,7 +628,7 @@ msgstr "" "``_ignore_`` 是一個不會變成成員的名稱串列,在列舉建立完成後其名稱會被移除。範" "例請參考 :ref:`TimePeriod `。" -#: ../../library/enum.rst:310 +#: ../../library/enum.rst:320 msgid "" "Returns ``['__class__', '__doc__', '__module__', 'name', 'value']`` and any " "public methods defined on *self.__class__*::" @@ -620,7 +636,7 @@ msgstr "" "回傳 ``['__class__', '__doc__', '__module__', 'name', 'value']`` 及任何 " "*self.__class__* 上定義的公開方法: ::" -#: ../../library/enum.rst:313 +#: ../../library/enum.rst:323 msgid "" ">>> from datetime import date\n" ">>> class Weekday(Enum):\n" @@ -660,11 +676,11 @@ msgstr "" msgid "name" msgstr "name" -#: ../../library/enum.rst:331 +#: ../../library/enum.rst:341 msgid "The name of the member being defined (e.g. 'RED')." msgstr "定義的成員名稱(例如 'RED')。" -#: ../../library/enum.rst:332 +#: ../../library/enum.rst:342 msgid "The start value for the Enum; the default is 1." msgstr "列舉的開始值,預設為 1。" @@ -672,7 +688,7 @@ msgstr "列舉的開始值,預設為 1。" msgid "count" msgstr "count" -#: ../../library/enum.rst:333 +#: ../../library/enum.rst:343 msgid "The number of members currently defined, not including this one." msgstr "已定義的成員數量,不包含目前這一個。" @@ -680,17 +696,17 @@ msgstr "已定義的成員數量,不包含目前這一個。" msgid "last_values" msgstr "last_values" -#: ../../library/enum.rst:334 +#: ../../library/enum.rst:344 msgid "A list of the previous values." msgstr "一個之前值的串列。" -#: ../../library/enum.rst:336 +#: ../../library/enum.rst:346 msgid "" "A *staticmethod* that is used to determine the next value returned by :class:" "`auto`::" msgstr "一個 *staticmethod*,用來決定 :class:`auto` 下一個要回傳的值的: ::" -#: ../../library/enum.rst:339 +#: ../../library/enum.rst:349 msgid "" ">>> from enum import auto\n" ">>> class PowersOfThree(Enum):\n" @@ -714,7 +730,7 @@ msgstr "" ">>> PowersOfThree.SECOND.value\n" "9" -#: ../../library/enum.rst:352 +#: ../../library/enum.rst:362 msgid "" "By default, does nothing. If multiple values are given in the member " "assignment, those values become separate arguments to ``__init__``; e.g." @@ -722,19 +738,19 @@ msgstr "" "預設情況下,不執行任何操作。如果在成員賦值中給出多個值,這些值將成為與 " "``__init__`` 分別的引數;例如" -#: ../../library/enum.rst:359 +#: ../../library/enum.rst:369 msgid "" "``Weekday.__init__()`` would be called as ``Weekday.__init__(self, 1, " "'Mon')``" msgstr "``Weekday.__init__()`` 將被稱為 ``Weekday.__init__(self, 1, 'Mon')``" -#: ../../library/enum.rst:363 +#: ../../library/enum.rst:373 msgid "" "A *classmethod* that is used to further configure subsequent subclasses. By " "default, does nothing." msgstr "一個 *classmethod*,用來進一步設定後續的子類別,預設不做任何事。" -#: ../../library/enum.rst:368 +#: ../../library/enum.rst:378 msgid "" "A *classmethod* for looking up values not found in *cls*. By default it " "does nothing, but can be overridden to implement custom search behavior::" @@ -742,7 +758,7 @@ msgstr "" "一個 *classmethod*,用來查詢在 *cls* 裡找不到的值。預設不做任何事,但可以被覆" "寫以實作客製化的搜尋行為: ::" -#: ../../library/enum.rst:371 +#: ../../library/enum.rst:381 msgid "" ">>> from enum import StrEnum\n" ">>> class Build(StrEnum):\n" @@ -778,7 +794,7 @@ msgstr "" ">>> Build('deBUG')\n" "" -#: ../../library/enum.rst:390 +#: ../../library/enum.rst:400 msgid "" "By default, doesn't exist. If specified, either in the enum class " "definition or in a mixin class (such as ``int``), all values given in the " @@ -787,12 +803,12 @@ msgstr "" "預設情況下不存在。如果有指定,無論是在列舉類別定義中還是在 mixin 類別中(例" "如 ``int``\\ ),都將傳遞成員賦值中給出的所有值;例如" -#: ../../library/enum.rst:398 +#: ../../library/enum.rst:408 msgid "" "results in the call ``int('1a', 16)`` and a value of ``26`` for the member." msgstr "" -#: ../../library/enum.rst:402 +#: ../../library/enum.rst:412 msgid "" "When writing a custom ``__new__``, do not use ``super().__new__`` -- call " "the appropriate ``__new__`` instead." @@ -800,7 +816,7 @@ msgstr "" "當寫自訂的 ``__new__`` 時,不要使用 ``super().__new__``,而是要呼叫適當的 " "``__new__``。" -#: ../../library/enum.rst:407 +#: ../../library/enum.rst:417 msgid "" "Returns the string used for *repr()* calls. By default, returns the *Enum* " "name, member name, and value, but can be overridden::" @@ -808,7 +824,7 @@ msgstr "" "回傳呼叫 *repr()* 時使用的字串。預設回傳 *Enum* 名稱、成員名稱及值,但可以被" "覆寫: ::" -#: ../../library/enum.rst:410 +#: ../../library/enum.rst:420 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -834,7 +850,7 @@ msgstr "" "ALTERNATE}\"\n" "(OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')" -#: ../../library/enum.rst:423 +#: ../../library/enum.rst:433 msgid "" "Returns the string used for *str()* calls. By default, returns the *Enum* " "name and member name, but can be overridden::" @@ -842,7 +858,7 @@ msgstr "" "回傳呼叫 *str()* 時使用的字串。預設回傳 *Enum* 名稱及成員名稱,但可以被覆" "寫: ::" -#: ../../library/enum.rst:426 +#: ../../library/enum.rst:436 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -866,7 +882,7 @@ msgstr "" "ALTERNATE}\"\n" "(, 'ALTERNATE', 'ALTERNATE')" -#: ../../library/enum.rst:438 +#: ../../library/enum.rst:448 msgid "" "Returns the string used for *format()* and *f-string* calls. By default, " "returns :meth:`__str__` return value, but can be overridden::" @@ -874,7 +890,7 @@ msgstr "" "回傳呼叫 *format()* 及 *f-string* 時使用的字串。預設回傳 :meth:`__str__` 的回" "傳值,但可以被覆寫: ::" -#: ../../library/enum.rst:441 +#: ../../library/enum.rst:451 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -898,33 +914,34 @@ msgstr "" "ALTERNATE}\"\n" "(, 'OtherStyle.ALTERNATE', 'ALTERNATE')" -#: ../../library/enum.rst:453 +#: ../../library/enum.rst:463 msgid "" "Using :class:`auto` with :class:`Enum` results in integers of increasing " "value, starting with ``1``." msgstr ":class:`Enum` 使用 :class:`auto` 會產生從 ``1`` 開始遞增的整數。" -#: ../../library/enum.rst:456 +#: ../../library/enum.rst:466 msgid "Added :ref:`enum-dataclass-support`" msgstr "新增 :ref:`enum-dataclass-support`" -#: ../../library/enum.rst:461 +#: ../../library/enum.rst:471 +#, fuzzy msgid "" -"*IntEnum* is the same as *Enum*, but its members are also integers and can " -"be used anywhere that an integer can be used. If any integer operation is " -"performed with an *IntEnum* member, the resulting value loses its " -"enumeration status." +"*IntEnum* is the same as :class:`Enum`, but its members are also integers " +"and can be used anywhere that an integer can be used. If any integer " +"operation is performed with an *IntEnum* member, the resulting value loses " +"its enumeration status." msgstr "" "*IntEnum* 和 *Enum* 一樣,但其成員同時也是整數而可以被用在任何使用整數的地" "方。如果 *IntEnum* 成員經過任何整數運算,其結果會失去列舉狀態。" -#: ../../library/enum.rst:482 +#: ../../library/enum.rst:492 msgid "" "Using :class:`auto` with :class:`IntEnum` results in integers of increasing " "value, starting with ``1``." msgstr ":class:`IntEnum` 使用 :class:`auto` 會產生從 ``1`` 開始遞增的整數。" -#: ../../library/enum.rst:485 +#: ../../library/enum.rst:495 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` was " @@ -934,17 +951,18 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" -#: ../../library/enum.rst:492 +#: ../../library/enum.rst:502 +#, fuzzy msgid "" -"*StrEnum* is the same as *Enum*, but its members are also strings and can be " -"used in most of the same places that a string can be used. The result of " -"any string operation performed on or with a *StrEnum* member is not part of " -"the enumeration." +"``StrEnum`` is the same as :class:`Enum`, but its members are also strings " +"and can be used in most of the same places that a string can be used. The " +"result of any string operation performed on or with a *StrEnum* member is " +"not part of the enumeration." msgstr "" "*StrEnum* 和 *Enum* 一樣,但其成員同時也是字串而可以被用在幾乎所有使用字串的" "地方。*StrEnum* 成員經過任何字串操作的結果會不再是列舉的一部份。" -#: ../../library/enum.rst:498 +#: ../../library/enum.rst:508 msgid "" "There are places in the stdlib that check for an exact :class:`str` instead " "of a :class:`str` subclass (i.e. ``type(unknown) == str`` instead of " @@ -955,13 +973,13 @@ msgstr "" "是 ``type(unknown) == str`` 而不是 ``isinstance(unknown, str)``),在這些地方" "你需要使用 ``str(StrEnum.member)``。" -#: ../../library/enum.rst:505 +#: ../../library/enum.rst:515 msgid "" "Using :class:`auto` with :class:`StrEnum` results in the lower-cased member " "name as the value." msgstr ":class:`StrEnum` 使用 :class:`auto` 會產生小寫的成員名稱當作值。" -#: ../../library/enum.rst:510 +#: ../../library/enum.rst:520 msgid "" ":meth:`~object.__str__` is :meth:`!str.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` is " @@ -971,7 +989,7 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!str.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 也會是 :meth:`!str.__format__`。" -#: ../../library/enum.rst:518 +#: ../../library/enum.rst:528 msgid "" "``Flag`` is the same as :class:`Enum`, but its members support the bitwise " "operators ``&`` (*AND*), ``|`` (*OR*), ``^`` (*XOR*), and ``~`` (*INVERT*); " @@ -981,11 +999,11 @@ msgstr "" "(*OR*)、``^`` (*XOR*) 和 ``~`` (*INVERT*);這些操作的結果是列舉的成員(的別" "名)。" -#: ../../library/enum.rst:524 +#: ../../library/enum.rst:534 msgid "Returns *True* if value is in self::" msgstr "如果 value 在 self 裡則回傳 *True*: ::" -#: ../../library/enum.rst:526 +#: ../../library/enum.rst:536 msgid "" ">>> from enum import Flag, auto\n" ">>> class Color(Flag):\n" @@ -1021,11 +1039,11 @@ msgstr "" ">>> white in purple\n" "False" -#: ../../library/enum.rst:545 +#: ../../library/enum.rst:555 msgid "Returns all contained non-alias members::" msgstr "回傳所有包含的非別名成員: ::" -#: ../../library/enum.rst:547 +#: ../../library/enum.rst:557 msgid "" ">>> list(Color.RED)\n" "[]\n" @@ -1037,11 +1055,11 @@ msgstr "" ">>> list(purple)\n" "[, ]" -#: ../../library/enum.rst:556 +#: ../../library/enum.rst:566 msgid "Returns number of members in flag::" msgstr "回傳旗標裡的成員數量: ::" -#: ../../library/enum.rst:558 +#: ../../library/enum.rst:568 msgid "" ">>> len(Color.GREEN)\n" "1\n" @@ -1053,11 +1071,11 @@ msgstr "" ">>> len(white)\n" "3" -#: ../../library/enum.rst:567 +#: ../../library/enum.rst:577 msgid "Returns *True* if any members in flag, *False* otherwise::" msgstr "如果成員在旗標裡則回傳 *True*,否則回傳 *False*: ::" -#: ../../library/enum.rst:569 +#: ../../library/enum.rst:579 msgid "" ">>> bool(Color.GREEN)\n" "True\n" @@ -1075,11 +1093,11 @@ msgstr "" ">>> bool(black)\n" "False" -#: ../../library/enum.rst:579 +#: ../../library/enum.rst:589 msgid "Returns current flag binary or'ed with other::" msgstr "回傳和 other 做 OR 過後的二進位旗標: ::" -#: ../../library/enum.rst:581 +#: ../../library/enum.rst:591 msgid "" ">>> Color.RED | Color.GREEN\n" "" @@ -1087,11 +1105,11 @@ msgstr "" ">>> Color.RED | Color.GREEN\n" "" -#: ../../library/enum.rst:586 +#: ../../library/enum.rst:596 msgid "Returns current flag binary and'ed with other::" msgstr "回傳和 other 做 AND 過後的二進位旗標: ::" -#: ../../library/enum.rst:588 +#: ../../library/enum.rst:598 msgid "" ">>> purple & white\n" "\n" @@ -1103,11 +1121,11 @@ msgstr "" ">>> purple & Color.GREEN\n" "" -#: ../../library/enum.rst:595 +#: ../../library/enum.rst:605 msgid "Returns current flag binary xor'ed with other::" msgstr "回傳和 other 做 XOR 過後的二進位旗標: ::" -#: ../../library/enum.rst:597 +#: ../../library/enum.rst:607 msgid "" ">>> purple ^ white\n" "\n" @@ -1119,11 +1137,12 @@ msgstr "" ">>> purple ^ Color.GREEN\n" "" -#: ../../library/enum.rst:604 -msgid "Returns all the flags in *type(self)* that are not in self::" +#: ../../library/enum.rst:614 +#, fuzzy +msgid "Returns all the flags in *type(self)* that are not in *self*::" msgstr "回傳所有在 *type(self)* 但不在 self 裡的旗標: ::" -#: ../../library/enum.rst:606 +#: ../../library/enum.rst:616 msgid "" ">>> ~white\n" "\n" @@ -1139,7 +1158,7 @@ msgstr "" ">>> ~Color.RED\n" "" -#: ../../library/enum.rst:615 +#: ../../library/enum.rst:625 msgid "" "Function used to format any remaining unnamed numeric values. Default is " "the value's repr; common choices are :func:`hex` and :func:`oct`." @@ -1147,31 +1166,32 @@ msgstr "" "用來格式化任何剩下未命名數值的函式。預設是值的 repr,常見選擇是 :func:`hex` " "和 :func:`oct`。" -#: ../../library/enum.rst:620 +#: ../../library/enum.rst:630 msgid "" "Using :class:`auto` with :class:`Flag` results in integers that are powers " "of two, starting with ``1``." msgstr ":class:`Flag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" -#: ../../library/enum.rst:623 +#: ../../library/enum.rst:633 msgid "The *repr()* of zero-valued flags has changed. It is now::" msgstr "值為 0 的旗標的 *repr()* 已改變。現在是: ::" -#: ../../library/enum.rst:631 +#: ../../library/enum.rst:641 +#, fuzzy msgid "" -"*IntFlag* is the same as *Flag*, but its members are also integers and can " -"be used anywhere that an integer can be used." +"``IntFlag`` is the same as :class:`Flag`, but its members are also integers " +"and can be used anywhere that an integer can be used." msgstr "" "*IntFlag* 和 *Flag* 一樣,但其成員同時也是整數而可以被用在任何使用整數的地" "方。" -#: ../../library/enum.rst:645 +#: ../../library/enum.rst:655 msgid "" "If any integer operation is performed with an *IntFlag* member, the result " "is not an *IntFlag*::" msgstr "如果 *IntFlag* 成員經過任何整數運算,其結果不是 *IntFlag*: ::" -#: ../../library/enum.rst:648 +#: ../../library/enum.rst:658 msgid "" ">>> Color.RED + 2\n" "3" @@ -1179,32 +1199,35 @@ msgstr "" ">>> Color.RED + 2\n" "3" -#: ../../library/enum.rst:651 -msgid "If a *Flag* operation is performed with an *IntFlag* member and:" +#: ../../library/enum.rst:661 +#, fuzzy +msgid "If a :class:`Flag` operation is performed with an *IntFlag* member and:" msgstr "如果 *IntFlag* 成員經過 *Flag* 操作且:" -#: ../../library/enum.rst:653 +#: ../../library/enum.rst:663 msgid "the result is a valid *IntFlag*: an *IntFlag* is returned" msgstr "結果是合法的 *IntFlag*:回傳 *IntFlag*" -#: ../../library/enum.rst:654 +#: ../../library/enum.rst:664 +#, fuzzy msgid "" -"the result is not a valid *IntFlag*: the result depends on the " -"*FlagBoundary* setting" +"the result is not a valid *IntFlag*: the result depends on the :class:" +"`FlagBoundary` setting" msgstr "結果不是合法的 *IntFlag*:結果會根據 *FlagBoundary* 的設定" -#: ../../library/enum.rst:656 -msgid "The *repr()* of unnamed zero-valued flags has changed. It is now:" +#: ../../library/enum.rst:666 +#, fuzzy +msgid "The :func:`repr` of unnamed zero-valued flags has changed. It is now:" msgstr "未命名且值為 0 的旗標的 *repr()* 已改變。現在是: ::" -#: ../../library/enum.rst:663 +#: ../../library/enum.rst:673 msgid "" "Using :class:`auto` with :class:`IntFlag` results in integers that are " "powers of two, starting with ``1``." msgstr "" ":class:`IntFlag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" -#: ../../library/enum.rst:668 +#: ../../library/enum.rst:678 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` " @@ -1214,7 +1237,7 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" -#: ../../library/enum.rst:672 +#: ../../library/enum.rst:682 msgid "" "Inversion of an :class:`!IntFlag` now returns a positive value that is the " "union of all flags not in the given flag, rather than a negative value. This " @@ -1223,7 +1246,7 @@ msgstr "" ":class:`!IntFlag` 的反轉 (inversion) 現在會回傳正值,該值是不在給定旗標的所有" "旗標聯集,而不是一個負值。這符合現有 :class:`Flag` 的行為。" -#: ../../library/enum.rst:678 +#: ../../library/enum.rst:688 msgid "" ":class:`!ReprEnum` uses the :meth:`repr() ` of :class:`Enum`, " "but the :class:`str() ` of the mixed-in data type:" @@ -1231,15 +1254,15 @@ msgstr "" ":class:`!ReprEnum` 使用 :class:`Enum` 的 :meth:`repr() `,但使" "用混合資料類型的 :class:`str() `:" -#: ../../library/enum.rst:681 +#: ../../library/enum.rst:691 msgid ":meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag`" msgstr "對 :class:`IntEnum` 和 :class:`IntFlag` 是 :meth:`!int.__str__`" -#: ../../library/enum.rst:682 +#: ../../library/enum.rst:692 msgid ":meth:`!str.__str__` for :class:`StrEnum`" msgstr "對 :class:`StrEnum` 是 :meth:`!str.__str__`" -#: ../../library/enum.rst:684 +#: ../../library/enum.rst:694 msgid "" "Inherit from :class:`!ReprEnum` to keep the :class:`str() ` / :func:" "`format` of the mixed-in data type instead of using the :class:`Enum`-" @@ -1248,7 +1271,7 @@ msgstr "" "繼承 :class:`!ReprEnum` 來保留混合資料類型的 :class:`str() ` / :func:" "`format`,而不是使用 :class:`Enum` 預設的 :meth:`str() `。" -#: ../../library/enum.rst:693 +#: ../../library/enum.rst:703 msgid "" "*EnumCheck* contains the options used by the :func:`verify` decorator to " "ensure various constraints; failed constraints result in a :exc:`ValueError`." @@ -1256,11 +1279,11 @@ msgstr "" "*EnumCheck* 包含 :func:`verify` 裝飾器使用的選項,以確保多樣的限制,不符合限" "制會產生 :exc:`ValueError`。" -#: ../../library/enum.rst:698 +#: ../../library/enum.rst:708 msgid "Ensure that each value has only one name::" msgstr "確保每個值只有一個名稱: ::" -#: ../../library/enum.rst:700 +#: ../../library/enum.rst:710 msgid "" ">>> from enum import Enum, verify, UNIQUE\n" ">>> @verify(UNIQUE)\n" @@ -1284,13 +1307,13 @@ msgstr "" "...\n" "ValueError: aliases found in : CRIMSON -> RED" -#: ../../library/enum.rst:714 +#: ../../library/enum.rst:724 msgid "" "Ensure that there are no missing values between the lowest-valued member and " "the highest-valued member::" msgstr "確保在最小值成員跟最大值成員間沒有缺少值: ::" -#: ../../library/enum.rst:717 +#: ../../library/enum.rst:727 msgid "" ">>> from enum import Enum, verify, CONTINUOUS\n" ">>> @verify(CONTINUOUS)\n" @@ -1312,7 +1335,7 @@ msgstr "" "...\n" "ValueError: invalid enum 'Color': missing values 3, 4" -#: ../../library/enum.rst:729 +#: ../../library/enum.rst:739 msgid "" "Ensure that any flag groups/masks contain only named flags -- useful when " "values are specified instead of being generated by :func:`auto`::" @@ -1320,7 +1343,7 @@ msgstr "" "確保任何旗標群組 / 遮罩只包含命名旗標 -- 當值是用指定而不是透過 :func:`auto` " "產生時是很實用的: ::" -#: ../../library/enum.rst:732 +#: ../../library/enum.rst:742 msgid "" ">>> from enum import Flag, verify, NAMED_FLAGS\n" ">>> @verify(NAMED_FLAGS)\n" @@ -1348,24 +1371,25 @@ msgstr "" "ValueError: invalid Flag 'Color': aliases WHITE and NEON are missing " "combined values of 0x18 [use enum.show_flag_values(value) for details]" -#: ../../library/enum.rst:746 +#: ../../library/enum.rst:756 msgid "" "CONTINUOUS and NAMED_FLAGS are designed to work with integer-valued members." msgstr "CONTINUOUS 和 NAMED_FLAGS 是設計用來運作在整數值的成員上。" -#: ../../library/enum.rst:752 +#: ../../library/enum.rst:762 +#, fuzzy msgid "" -"*FlagBoundary* controls how out-of-range values are handled in *Flag* and " -"its subclasses." +"``FlagBoundary`` controls how out-of-range values are handled in :class:" +"`Flag` and its subclasses." msgstr "*FlagBoundary* 控制在 *Flag* 及其子類別中如何處理範圍外的值。" -#: ../../library/enum.rst:757 +#: ../../library/enum.rst:767 msgid "" "Out-of-range values cause a :exc:`ValueError` to be raised. This is the " "default for :class:`Flag`::" msgstr "範圍外的值會引發 :exc:`ValueError`。這是 :class:`Flag` 的預設行為: ::" -#: ../../library/enum.rst:760 +#: ../../library/enum.rst:770 msgid "" ">>> from enum import Flag, STRICT, auto\n" ">>> class StrictFlag(Flag, boundary=STRICT):\n" @@ -1393,13 +1417,14 @@ msgstr "" " given 0b0 10100\n" " allowed 0b0 00111" -#: ../../library/enum.rst:775 +#: ../../library/enum.rst:785 +#, fuzzy msgid "" -"Out-of-range values have invalid values removed, leaving a valid *Flag* " -"value::" +"Out-of-range values have invalid values removed, leaving a valid :class:" +"`Flag` value::" msgstr "範圍外的值會移除非法值,留下合法的 *Flag* 值: ::" -#: ../../library/enum.rst:778 +#: ../../library/enum.rst:788 msgid "" ">>> from enum import Flag, CONFORM, auto\n" ">>> class ConformFlag(Flag, boundary=CONFORM):\n" @@ -1419,20 +1444,23 @@ msgstr "" ">>> ConformFlag(2**2 + 2**4)\n" "" -#: ../../library/enum.rst:789 +#: ../../library/enum.rst:799 +#, fuzzy msgid "" -"Out-of-range values lose their *Flag* membership and revert to :class:`int`." +"Out-of-range values lose their :class:`Flag` membership and revert to :class:" +"`int`." msgstr "範圍外的值會失去它們的 *Flag* 成員資格且恢復成 :class:`int`。" -#: ../../library/enum.rst:802 +#: ../../library/enum.rst:812 +#, fuzzy msgid "" -"Out-of-range values are kept, and the *Flag* membership is kept. This is the " -"default for :class:`IntFlag`::" +"Out-of-range values are kept, and the :class:`Flag` membership is kept. This " +"is the default for :class:`IntFlag`::" msgstr "" "範圍外的值會被保留,*Flag* 成員資格也會被保留。這是 :class:`IntFlag` 的預設行" "為: ::" -#: ../../library/enum.rst:805 +#: ../../library/enum.rst:815 msgid "" ">>> from enum import Flag, KEEP, auto\n" ">>> class KeepFlag(Flag, boundary=KEEP):\n" @@ -1452,11 +1480,11 @@ msgstr "" ">>> KeepFlag(2**2 + 2**4)\n" "" -#: ../../library/enum.rst:819 +#: ../../library/enum.rst:829 msgid "Supported ``__dunder__`` names" msgstr "支援 ``__dunder__`` 名稱" -#: ../../library/enum.rst:821 +#: ../../library/enum.rst:831 msgid "" ":attr:`~EnumType.__members__` is a read-only ordered mapping of " "``member_name``:``member`` items. It is only available on the class." @@ -1464,36 +1492,49 @@ msgstr "" ":attr:`~EnumType.__members__` 是一個唯讀有序的\\ ``成員名稱``:``成員``\\ 項" "目的對映。只有在類別上可用。" -#: ../../library/enum.rst:824 +#: ../../library/enum.rst:834 +#, fuzzy msgid "" ":meth:`~Enum.__new__`, if specified, must create and return the enum " "members; it is also a very good idea to set the member's :attr:`!_value_` " -"appropriately. Once all the members are created it is no longer used." +"appropriately. Once all the members are created it is no longer used." msgstr "" "如果指定了 :meth:`~Enum.__new__`,它必須建立並回傳列舉成員;適當地設定成員" "的 :attr:`!_value_` 也是一個很好的主意。一旦所有成員都建立之後就不會再被用" "到。" -#: ../../library/enum.rst:830 +#: ../../library/enum.rst:840 msgid "Supported ``_sunder_`` names" msgstr "支援 ``_sunder_`` 名稱" -#: ../../library/enum.rst:832 +#: ../../library/enum.rst:842 +msgid "" +":meth:`~EnumType._add_alias_` -- adds a new name as an alias to an existing " +"member." +msgstr "" + +#: ../../library/enum.rst:844 +msgid "" +":meth:`~EnumType._add_value_alias_` -- adds a new value as an alias to an " +"existing member." +msgstr "" + +#: ../../library/enum.rst:846 msgid ":attr:`~Enum._name_` -- name of the member" msgstr ":attr:`~Enum._name_` -- 成員名稱" -#: ../../library/enum.rst:833 +#: ../../library/enum.rst:847 msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" msgstr ":attr:`~Enum._value_` -- 成員的值;可以在 ``__new__`` 設定" -#: ../../library/enum.rst:834 +#: ../../library/enum.rst:848 msgid "" ":meth:`~Enum._missing_` -- a lookup function used when a value is not found; " "may be overridden" msgstr "" ":meth:`~Enum._missing_` -- 當值沒有被找到時會使用的查詢函式;可以被覆寫" -#: ../../library/enum.rst:836 +#: ../../library/enum.rst:850 msgid "" ":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" "class:`str`, that will not be transformed into members, and will be removed " @@ -1502,7 +1543,7 @@ msgstr "" ":attr:`~Enum._ignore_` -- 一個名稱的串列,可以是 :class:`list` 或 :class:" "`str`,它不會被轉換成成員,且在最後的類別上會被移除" -#: ../../library/enum.rst:839 +#: ../../library/enum.rst:853 msgid "" ":attr:`~Enum._order_` -- no longer used, kept for backward compatibility " "(class attribute, removed during class creation)" @@ -1510,49 +1551,67 @@ msgstr "" ":attr:`~Enum._order_` -- 不再被使用,僅為了向後相容而保留(類別屬性,在類別建" "立時移除)" -#: ../../library/enum.rst:841 +#: ../../library/enum.rst:855 msgid "" ":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for " "an enum member; may be overridden" msgstr "" ":meth:`~Enum._generate_next_value_` -- 用來為列舉成員取得合適的值;可以被覆寫" -#: ../../library/enum.rst:846 +#: ../../library/enum.rst:860 +#, fuzzy msgid "" -"For standard :class:`Enum` classes the next value chosen is the last value " -"seen incremented by one." +"For standard :class:`Enum` classes the next value chosen is the highest " +"value seen incremented by one." msgstr "" "對標準的 :class:`Enum` 類別來說,下一個被選擇的值是最後一個看見的值加一。" -#: ../../library/enum.rst:849 +#: ../../library/enum.rst:863 +#, fuzzy msgid "" "For :class:`Flag` classes the next value chosen will be the next highest " -"power-of-two, regardless of the last value seen." +"power-of-two." msgstr "" "對 :class:`Flag` 類別來說,下一個被選擇的值是下一個最大的 2 的次方,不管最後" "一個看見的值是什麼。" -#: ../../library/enum.rst:852 +#: ../../library/enum.rst:866 +msgid "" +"While ``_sunder_`` names are generally reserved for the further development " +"of the :class:`Enum` class and can not be used, some are explicitly allowed:" +msgstr "" + +#: ../../library/enum.rst:869 +msgid "" +"``_repr_*`` (e.g. ``_repr_html_``), as used in `IPython's rich display`_" +msgstr "" + +#: ../../library/enum.rst:871 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" msgstr "``_missing_``、``_order_``、``_generate_next_value_``" -#: ../../library/enum.rst:853 +#: ../../library/enum.rst:872 msgid "``_ignore_``" msgstr "``_ignore_``" -#: ../../library/enum.rst:858 +#: ../../library/enum.rst:873 +msgid "``_add_alias_``, ``_add_value_alias_``, ``_repr_*``" +msgstr "" + +#: ../../library/enum.rst:879 msgid "Utilities and Decorators" msgstr "通用項目與裝飾器" -#: ../../library/enum.rst:862 +#: ../../library/enum.rst:883 +#, fuzzy msgid "" "*auto* can be used in place of a value. If used, the *Enum* machinery will " -"call an *Enum*'s :meth:`~Enum._generate_next_value_` to get an appropriate " -"value. For *Enum* and *IntEnum* that appropriate value will be the last " -"value plus one; for *Flag* and *IntFlag* it will be the first power-of-two " -"greater than the highest value; for *StrEnum* it will be the lower-cased " -"version of the member's name. Care must be taken if mixing *auto()* with " -"manually specified values." +"call an :class:`Enum`'s :meth:`~Enum._generate_next_value_` to get an " +"appropriate value. For :class:`Enum` and :class:`IntEnum` that appropriate " +"value will be the last value plus one; for :class:`Flag` and :class:" +"`IntFlag` it will be the first power-of-two greater than the highest value; " +"for :class:`StrEnum` it will be the lower-cased version of the member's " +"name. Care must be taken if mixing *auto()* with manually specified values." msgstr "" "*auto* 可以用來取代給值。如果使用的話,*Enum* 系統會呼叫 *Enum* 的 :meth:" "`~Enum._generate_next_value_` 來取得合適的值。對 *Enum* 和 *IntEnum* 來說,合" @@ -1560,16 +1619,16 @@ msgstr "" "2 的次方的數字;對 *StrEnum* 來說,是成員名稱的小寫版本。如果混用 *auto()* 和" "手動指定值的話要特別注意。" -#: ../../library/enum.rst:870 +#: ../../library/enum.rst:891 msgid "" "*auto* instances are only resolved when at the top level of an assignment:" msgstr "*auto* 實例只有在最上層的賦值時才會被解析:" -#: ../../library/enum.rst:872 +#: ../../library/enum.rst:893 msgid "``FIRST = auto()`` will work (auto() is replaced with ``1``);" msgstr "``FIRST = auto()`` 可以運作(auto() 會被取代成 ``1``)" -#: ../../library/enum.rst:873 +#: ../../library/enum.rst:894 msgid "" "``SECOND = auto(), -2`` will work (auto is replaced with ``2``, so ``2, -2`` " "is used to create the ``SECOND`` enum member;" @@ -1577,7 +1636,7 @@ msgstr "" "``SECOND = auto(), -2`` 可以運作(auto 會被取代成 ``2``, 因此 ``2, -2`` 會被" "用來建立列舉成員 ``SECOND``;" -#: ../../library/enum.rst:875 +#: ../../library/enum.rst:896 msgid "" "``THREE = [auto(), -3]`` will *not* work (``, -3`` is used to " "create the ``THREE`` enum member)" @@ -1585,19 +1644,19 @@ msgstr "" "``THREE = [auto(), -3]`` *無法*\\ 運作(\\ ``, -3`` 會被用來建立列" "舉成員 ``THREE``)" -#: ../../library/enum.rst:880 +#: ../../library/enum.rst:901 msgid "" "In prior versions, ``auto()`` had to be the only thing on the assignment " "line to work properly." msgstr "在之前的版本中,``auto()`` 必須是賦值行裡的唯一內容才能運作正確。" -#: ../../library/enum.rst:883 +#: ../../library/enum.rst:904 msgid "" "``_generate_next_value_`` can be overridden to customize the values used by " "*auto*." msgstr "可以覆寫 ``_generate_next_value_`` 來客製 *auto* 使用的值。" -#: ../../library/enum.rst:886 +#: ../../library/enum.rst:907 msgid "" "in 3.13 the default ``_generate_next_value_`` will always return the highest " "member value incremented by 1, and will fail if any member is an " @@ -1606,7 +1665,7 @@ msgstr "" "在 3.13 預設 ``_generate_next_value_`` 總是回傳最大的成員值加一,如果任何成員" "是不相容的類型就會失敗。" -#: ../../library/enum.rst:892 +#: ../../library/enum.rst:913 msgid "" "A decorator similar to the built-in *property*, but specifically for " "enumerations. It allows member attributes to have the same names as members " @@ -1615,7 +1674,7 @@ msgstr "" "和內建的 *property* 相似的裝飾器,但只專門針對列舉。它允許成員屬性和成員本身" "有相同名稱。" -#: ../../library/enum.rst:896 +#: ../../library/enum.rst:917 msgid "" "the *property* and the member must be defined in separate classes; for " "example, the *value* and *name* attributes are defined in the *Enum* class, " @@ -1625,7 +1684,7 @@ msgstr "" "*屬性*\\ 和成員必須定義在分開的類別裡;例如 *value* 和 *name* 屬性定義在 " "*Enum* 類別而 *Enum* 子類別可以定義成員名稱為 ``value`` 和 ``name``。" -#: ../../library/enum.rst:905 +#: ../../library/enum.rst:926 msgid "" "A :keyword:`class` decorator specifically for enumerations. It searches an " "enumeration's :attr:`~EnumType.__members__`, gathering any aliases it finds; " @@ -1635,7 +1694,7 @@ msgstr "" "__members__`,蒐集任何它找到的別名;如果有找到任何別名則引發 :exc:" "`ValueError` 並附上細節: ::" -#: ../../library/enum.rst:909 +#: ../../library/enum.rst:930 msgid "" ">>> from enum import Enum, unique\n" ">>> @unique\n" @@ -1661,7 +1720,7 @@ msgstr "" "...\n" "ValueError: duplicate values found in : FOUR -> THREE" -#: ../../library/enum.rst:923 +#: ../../library/enum.rst:944 msgid "" "A :keyword:`class` decorator specifically for enumerations. Members from :" "class:`EnumCheck` are used to specify which constraints should be checked on " @@ -1670,15 +1729,15 @@ msgstr "" "專門針對列舉的 :keyword:`class` 裝飾器。使用 :class:`EnumCheck` 裡的成員來指" "定在裝飾的列舉上應該檢查什麼限制。" -#: ../../library/enum.rst:931 +#: ../../library/enum.rst:952 msgid "A decorator for use in enums: its target will become a member." msgstr "列舉所使用的裝飾器:其目標會變成成員。" -#: ../../library/enum.rst:937 +#: ../../library/enum.rst:958 msgid "A decorator for use in enums: its target will not become a member." msgstr "列舉所使用的裝飾器:其目標不會變成成員。" -#: ../../library/enum.rst:943 +#: ../../library/enum.rst:964 msgid "" "A decorator to change the :class:`str() ` and :func:`repr` of an enum " "to show its members as belonging to the module instead of its class. Should " @@ -1689,19 +1748,19 @@ msgstr "" "組而不是其類別。應該只有當列舉成員被匯出到模組的全域命名空間才使用(範例請參" "考 :class:`re.RegexFlag`)。" -#: ../../library/enum.rst:953 +#: ../../library/enum.rst:974 msgid "Return a list of all power-of-two integers contained in a flag *value*." msgstr "回傳在旗標\\ *值*\\ 中包含的所有 2 的次方的整數串列。" -#: ../../library/enum.rst:960 +#: ../../library/enum.rst:981 msgid "Notes" msgstr "備註" -#: ../../library/enum.rst:962 +#: ../../library/enum.rst:983 msgid ":class:`IntEnum`, :class:`StrEnum`, and :class:`IntFlag`" msgstr ":class:`IntEnum`、:class:`StrEnum` 及 :class:`IntFlag`" -#: ../../library/enum.rst:964 +#: ../../library/enum.rst:985 msgid "" "These three enum types are designed to be drop-in replacements for existing " "integer- and string-based values; as such, they have extra limitations:" @@ -1709,17 +1768,17 @@ msgstr "" "這三種列舉類型是設計來直接取代現有以整數及字串為基底的值;因此它們有額外的限" "制:" -#: ../../library/enum.rst:967 +#: ../../library/enum.rst:988 msgid "``__str__`` uses the value and not the name of the enum member" msgstr "``__str__`` 使用值而不是列舉成員的名稱" -#: ../../library/enum.rst:969 +#: ../../library/enum.rst:990 msgid "" "``__format__``, because it uses ``__str__``, will also use the value of the " "enum member instead of its name" msgstr "``__format__`` 因為使用 ``__str__``,也會使用值而不是列舉成員的名稱" -#: ../../library/enum.rst:972 +#: ../../library/enum.rst:993 msgid "" "If you do not need/want those limitations, you can either create your own " "base class by mixing in the ``int`` or ``str`` type yourself::" @@ -1727,7 +1786,7 @@ msgstr "" "如果你不需要或不想要這些限制,你可以透過混合 ``int`` 或 ``str`` 類型來建立自" "己的基礎類別: ::" -#: ../../library/enum.rst:975 +#: ../../library/enum.rst:996 msgid "" ">>> from enum import Enum\n" ">>> class MyIntEnum(int, Enum):\n" @@ -1737,11 +1796,11 @@ msgstr "" ">>> class MyIntEnum(int, Enum):\n" "... pass" -#: ../../library/enum.rst:979 +#: ../../library/enum.rst:1000 msgid "or you can reassign the appropriate :meth:`str`, etc., in your enum::" msgstr "或者你也可以在你的列舉重新給定合適的 :meth:`str`: ::" -#: ../../library/enum.rst:981 +#: ../../library/enum.rst:1002 msgid "" ">>> from enum import Enum, IntEnum\n" ">>> class MyIntEnum(IntEnum):\n" diff --git a/library/exceptions.po b/library/exceptions.po index f24969ec8e..836c4bee5c 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-09-17 09:18+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -624,19 +624,47 @@ msgstr "" "化,大部分的浮點數運算都沒有被檢查。" #: ../../library/exceptions.rst:421 +#, fuzzy msgid "" -"This exception is derived from :exc:`RuntimeError`. It is raised when the " -"interpreter detects that the maximum recursion depth (see :func:`sys." -"getrecursionlimit`) is exceeded." +"This exception is derived from :exc:`RuntimeError`. It is raised when an " +"operation is blocked during interpreter shutdown also known as :term:`Python " +"finalization `." msgstr "" "此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參考 :" "func:`sys.getrecursionlimit`)時會引發此例外。" #: ../../library/exceptions.rst:425 +msgid "" +"Examples of operations which can be blocked with a :exc:" +"`PythonFinalizationError` during the Python finalization:" +msgstr "" + +#: ../../library/exceptions.rst:428 +msgid "Creating a new Python thread." +msgstr "" + +#: ../../library/exceptions.rst:429 +msgid ":func:`os.fork`." +msgstr "" + +#: ../../library/exceptions.rst:431 +msgid "See also the :func:`sys.is_finalizing` function." +msgstr "" + +#: ../../library/exceptions.rst:433 ../../library/exceptions.rst:443 msgid "Previously, a plain :exc:`RuntimeError` was raised." msgstr "在之前,會引發一般的 :exc:`RuntimeError`。" -#: ../../library/exceptions.rst:431 +#: ../../library/exceptions.rst:439 +msgid "" +"This exception is derived from :exc:`RuntimeError`. It is raised when the " +"interpreter detects that the maximum recursion depth (see :func:`sys." +"getrecursionlimit`) is exceeded." +msgstr "" +"此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參考 :" +"func:`sys.getrecursionlimit`)時會引發此例外。" + +#: ../../library/exceptions.rst:449 msgid "" "This exception is raised when a weak reference proxy, created by the :func:" "`weakref.proxy` function, is used to access an attribute of the referent " @@ -647,7 +675,7 @@ msgstr "" "用來存取已經被垃圾回收 (garbage collected) 的參照物屬性時會引發此例外。更多關" "於弱參照的資訊參考 :mod:`weakref` 模組。" -#: ../../library/exceptions.rst:439 +#: ../../library/exceptions.rst:457 msgid "" "Raised when an error is detected that doesn't fall in any of the other " "categories. The associated value is a string indicating what precisely went " @@ -656,7 +684,7 @@ msgstr "" "當偵測到一個不屬於任何其他種類的錯誤時會引發此例外。關聯值是一個表示確切什麼" "地方出錯的字串。" -#: ../../library/exceptions.rst:446 +#: ../../library/exceptions.rst:464 msgid "" "Raised by built-in function :func:`next` and an :term:`iterator`\\'s :meth:" "`~iterator.__next__` method to signal that there are no further items " @@ -665,7 +693,7 @@ msgstr "" "會被內建函式 :func:`next` 及 :term:`iterator` 的 :meth:`~iterator.__next__` " "方法引發,用來表示疊代器沒有更多項目可以產生。" -#: ../../library/exceptions.rst:452 +#: ../../library/exceptions.rst:470 msgid "" "The exception object has a single attribute :attr:`!value`, which is given " "as an argument when constructing the exception, and defaults to :const:" @@ -674,7 +702,7 @@ msgstr "" "此例外物件有單一屬性 :attr:`!value`,當建構此例外時會以引數給定,預設為 :" "const:`None`。" -#: ../../library/exceptions.rst:456 +#: ../../library/exceptions.rst:474 msgid "" "When a :term:`generator` or :term:`coroutine` function returns, a new :exc:" "`StopIteration` instance is raised, and the value returned by the function " @@ -684,7 +712,7 @@ msgstr "" "`StopIteration` 實例會被引發,而該函式的回傳值會被用來當作此例外建構函式的 :" "attr:`value` 參數。" -#: ../../library/exceptions.rst:461 +#: ../../library/exceptions.rst:479 msgid "" "If a generator code directly or indirectly raises :exc:`StopIteration`, it " "is converted into a :exc:`RuntimeError` (retaining the :exc:`StopIteration` " @@ -693,13 +721,13 @@ msgstr "" "如果產生器程式直接或間接引發 :exc:`StopIteration`,則其會被轉換成 :exc:" "`RuntimeError`\\ (保留 :exc:`StopIteration` 作為新例外的成因)。" -#: ../../library/exceptions.rst:465 +#: ../../library/exceptions.rst:483 msgid "" "Added ``value`` attribute and the ability for generator functions to use it " "to return a value." msgstr "新增 ``value`` 屬性且產生器函式可以用它來回傳值。" -#: ../../library/exceptions.rst:469 +#: ../../library/exceptions.rst:487 msgid "" "Introduced the RuntimeError transformation via ``from __future__ import " "generator_stop``, see :pep:`479`." @@ -707,7 +735,7 @@ msgstr "" "透過 ``from __future__ import generator_stop`` 引入 RuntimeError 的轉換,參" "考 :pep:`479`。" -#: ../../library/exceptions.rst:473 +#: ../../library/exceptions.rst:491 msgid "" "Enable :pep:`479` for all code by default: a :exc:`StopIteration` error " "raised in a generator is transformed into a :exc:`RuntimeError`." @@ -715,7 +743,7 @@ msgstr "" "預設對所有程式啟用 :pep:`479`:在產生器引發的 :exc:`StopIteration` 錯誤會轉換" "成 :exc:`RuntimeError`。" -#: ../../library/exceptions.rst:479 +#: ../../library/exceptions.rst:497 msgid "" "Must be raised by :meth:`~object.__anext__` method of an :term:`asynchronous " "iterator` object to stop the iteration." @@ -723,7 +751,7 @@ msgstr "" "此例外必須被 :term:`asynchronous iterator` 物件的 :meth:`~object.__anext__` " "方法引發來停止疊代。" -#: ../../library/exceptions.rst:486 +#: ../../library/exceptions.rst:504 msgid "" "Raised when the parser encounters a syntax error. This may occur in an :" "keyword:`import` statement, in a call to the built-in functions :func:" @@ -734,7 +762,7 @@ msgstr "" "呼叫內建函式 :func:`compile`、:func:`exec` 或 :func:`eval` 的時候,或者在讀取" "初始腳本或標準輸入(也包含互動式)的時候。" -#: ../../library/exceptions.rst:492 +#: ../../library/exceptions.rst:510 msgid "" "The :func:`str` of the exception instance returns only the error message. " "Details is a tuple whose members are also available as separate attributes." @@ -742,18 +770,18 @@ msgstr "" "例外實例的 :func:`str` 只回傳錯誤訊息。Details 是個元組,其成員也能夠以分開的" "屬性取得。" -#: ../../library/exceptions.rst:497 +#: ../../library/exceptions.rst:515 msgid "The name of the file the syntax error occurred in." msgstr "發生語法錯誤所在的檔案名稱。" -#: ../../library/exceptions.rst:501 +#: ../../library/exceptions.rst:519 msgid "" "Which line number in the file the error occurred in. This is 1-indexed: the " "first line in the file has a ``lineno`` of 1." msgstr "" "發生錯誤所在檔案的列號。這是以 1 開始的索引:檔案第一列的 ``lineno`` 是 1。" -#: ../../library/exceptions.rst:506 +#: ../../library/exceptions.rst:524 msgid "" "The column in the line where the error occurred. This is 1-indexed: the " "first character in the line has an ``offset`` of 1." @@ -761,11 +789,11 @@ msgstr "" "發生錯誤所在該列的欄號 (column)。這是以 1 開始的索引:該列第一個字元的 " "``offset`` 是 1。" -#: ../../library/exceptions.rst:511 +#: ../../library/exceptions.rst:529 msgid "The source code text involved in the error." msgstr "涉及該錯誤的原始程式碼文字。" -#: ../../library/exceptions.rst:515 +#: ../../library/exceptions.rst:533 msgid "" "Which line number in the file the error occurred ends in. This is 1-indexed: " "the first line in the file has a ``lineno`` of 1." @@ -773,7 +801,7 @@ msgstr "" "發生錯誤所在檔案的結束列號。這是以 1 開始的索引:檔案第一列的 ``lineno`` 是 " "1。" -#: ../../library/exceptions.rst:520 +#: ../../library/exceptions.rst:538 msgid "" "The column in the end line where the error occurred finishes. This is 1-" "indexed: the first character in the line has an ``offset`` of 1." @@ -781,7 +809,7 @@ msgstr "" "發生錯誤所在該結束列的欄號。這是以 1 開始的索引:該列第一個字元的 ``offset`` " "是 1。" -#: ../../library/exceptions.rst:523 +#: ../../library/exceptions.rst:541 msgid "" "For errors in f-string fields, the message is prefixed by \"f-string: \" and " "the offsets are offsets in a text constructed from the replacement " @@ -792,18 +820,18 @@ msgstr "" "(offset) 是從替代表達式建構的文字的偏移量。例如編譯 f'Bad {a b} field' 會得到" "這個 args 屬性:('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))。" -#: ../../library/exceptions.rst:528 +#: ../../library/exceptions.rst:546 msgid "Added the :attr:`end_lineno` and :attr:`end_offset` attributes." msgstr "新增 :attr:`end_lineno` 與 :attr:`end_offset` 屬性。" -#: ../../library/exceptions.rst:533 +#: ../../library/exceptions.rst:551 msgid "" "Base class for syntax errors related to incorrect indentation. This is a " "subclass of :exc:`SyntaxError`." msgstr "" "與不正確的縮排有關的語法錯誤的基礎類別。這是 :exc:`SyntaxError` 的子類別。" -#: ../../library/exceptions.rst:539 +#: ../../library/exceptions.rst:557 msgid "" "Raised when indentation contains an inconsistent use of tabs and spaces. " "This is a subclass of :exc:`IndentationError`." @@ -811,7 +839,7 @@ msgstr "" "當縮排包含製表符號 (tab) 和空白的不一致用法時會引發此例外。這是 :exc:" "`IndentationError` 的子類別。" -#: ../../library/exceptions.rst:545 +#: ../../library/exceptions.rst:563 msgid "" "Raised when the interpreter finds an internal error, but the situation does " "not look so serious to cause it to abandon all hope. The associated value is " @@ -820,7 +848,7 @@ msgstr "" "當直譯器找到一個內部錯誤,但該情況看起來沒有嚴重到要讓它放棄所有的希望時會引" "發此例外。關聯值是一個表示什麼地方出錯的字串(以低階的方式表達)。" -#: ../../library/exceptions.rst:549 +#: ../../library/exceptions.rst:567 msgid "" "You should report this to the author or maintainer of your Python " "interpreter. Be sure to report the version of the Python interpreter (``sys." @@ -832,7 +860,7 @@ msgstr "" "的版本(``sys.version``;這也會在互動式 Python 會話的開頭被印出)、確切的錯誤" "訊息(該例外的關聯值)及如果可能的話,觸發此錯誤的程式來源。" -#: ../../library/exceptions.rst:558 +#: ../../library/exceptions.rst:576 msgid "" "This exception is raised by the :func:`sys.exit` function. It inherits " "from :exc:`BaseException` instead of :exc:`Exception` so that it is not " @@ -853,7 +881,7 @@ msgstr "" "``None``,結束狀態會是 0;如果它是其他類型(例如字串),則物件的值會被印出而" "結束狀態是 1。" -#: ../../library/exceptions.rst:569 +#: ../../library/exceptions.rst:587 msgid "" "A call to :func:`sys.exit` is translated into an exception so that clean-up " "handlers (:keyword:`finally` clauses of :keyword:`try` statements) can be " @@ -867,13 +895,13 @@ msgstr "" "風險下執行腳本。如果在絕對有必要立即結束的情況(例如在子行程呼叫完 :func:`os." "fork` 之後 )可以使用 :func:`os._exit` 函式。" -#: ../../library/exceptions.rst:578 +#: ../../library/exceptions.rst:596 msgid "" "The exit status or error message that is passed to the constructor. " "(Defaults to ``None``.)" msgstr "傳入建構函式的結束狀態或錯誤訊息。(預設是 ``None``。 )" -#: ../../library/exceptions.rst:584 +#: ../../library/exceptions.rst:602 msgid "" "Raised when an operation or function is applied to an object of " "inappropriate type. The associated value is a string giving details about " @@ -882,7 +910,7 @@ msgstr "" "當一個操作或函式被用在不適合的類型的物件時會引發此例外。關聯值是一個字串,提" "供關於不相符類型的細節。" -#: ../../library/exceptions.rst:587 +#: ../../library/exceptions.rst:605 msgid "" "This exception may be raised by user code to indicate that an attempted " "operation on an object is not supported, and is not meant to be. If an " @@ -893,7 +921,7 @@ msgstr "" "這樣做。如果一個物件有意要支援某個給定的操作但尚未提供實作,該引發的正確例外" "是 :exc:`NotImplementedError`。" -#: ../../library/exceptions.rst:592 +#: ../../library/exceptions.rst:610 msgid "" "Passing arguments of the wrong type (e.g. passing a :class:`list` when an :" "class:`int` is expected) should result in a :exc:`TypeError`, but passing " @@ -904,7 +932,7 @@ msgstr "" "導致 :exc:`TypeError`,但傳入帶有錯誤值的引數(例如超出預期範圍的數值)應該要" "導致 :exc:`ValueError`。" -#: ../../library/exceptions.rst:599 +#: ../../library/exceptions.rst:617 msgid "" "Raised when a reference is made to a local variable in a function or method, " "but no value has been bound to that variable. This is a subclass of :exc:" @@ -913,7 +941,7 @@ msgstr "" "當在函式或方法裡引用某個區域變數,但該變數尚未被繫結到任何值的時候會引發此例" "外。這是 :exc:`NameError` 的子類別。" -#: ../../library/exceptions.rst:606 +#: ../../library/exceptions.rst:624 msgid "" "Raised when a Unicode-related encoding or decoding error occurs. It is a " "subclass of :exc:`ValueError`." @@ -921,7 +949,7 @@ msgstr "" "當 Unicode 相關的編碼或解碼錯誤發生時會引發此例外。這是 :exc:`ValueError` 的" "子類別。" -#: ../../library/exceptions.rst:609 +#: ../../library/exceptions.rst:627 msgid "" ":exc:`UnicodeError` has attributes that describe the encoding or decoding " "error. For example, ``err.object[err.start:err.end]`` gives the particular " @@ -930,27 +958,27 @@ msgstr "" ":exc:`UnicodeError` 有屬性描述編碼或解碼錯誤。例如 ``err.object[err.start:" "err.end]`` 會提供讓編解碼器失敗的具體無效輸入。" -#: ../../library/exceptions.rst:615 +#: ../../library/exceptions.rst:633 msgid "The name of the encoding that raised the error." msgstr "引發錯誤的編碼名稱。" -#: ../../library/exceptions.rst:619 +#: ../../library/exceptions.rst:637 msgid "A string describing the specific codec error." msgstr "描述特定編解碼器錯誤的字串。" -#: ../../library/exceptions.rst:623 +#: ../../library/exceptions.rst:641 msgid "The object the codec was attempting to encode or decode." msgstr "編解碼器嘗試編碼或解碼的物件。" -#: ../../library/exceptions.rst:627 +#: ../../library/exceptions.rst:645 msgid "The first index of invalid data in :attr:`object`." msgstr "在 :attr:`object` 中無效資料的開始索引。" -#: ../../library/exceptions.rst:631 +#: ../../library/exceptions.rst:649 msgid "The index after the last invalid data in :attr:`object`." msgstr "在 :attr:`object` 中最後的無效資料後的索引。" -#: ../../library/exceptions.rst:636 +#: ../../library/exceptions.rst:654 msgid "" "Raised when a Unicode-related error occurs during encoding. It is a " "subclass of :exc:`UnicodeError`." @@ -958,7 +986,7 @@ msgstr "" "在編碼當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:642 +#: ../../library/exceptions.rst:660 msgid "" "Raised when a Unicode-related error occurs during decoding. It is a " "subclass of :exc:`UnicodeError`." @@ -966,7 +994,7 @@ msgstr "" "在解碼當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:648 +#: ../../library/exceptions.rst:666 msgid "" "Raised when a Unicode-related error occurs during translating. It is a " "subclass of :exc:`UnicodeError`." @@ -974,7 +1002,7 @@ msgstr "" "在轉譯當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:654 +#: ../../library/exceptions.rst:672 msgid "" "Raised when an operation or function receives an argument that has the right " "type but an inappropriate value, and the situation is not described by a " @@ -983,7 +1011,7 @@ msgstr "" "當一個操作或函式收到引數是正確類型但是不適合的值,且該情況無法被更精確的例外" "例如 :exc:`IndexError` 所描述時會引發此例外。" -#: ../../library/exceptions.rst:661 +#: ../../library/exceptions.rst:679 msgid "" "Raised when the second argument of a division or modulo operation is zero. " "The associated value is a string indicating the type of the operands and the " @@ -992,7 +1020,7 @@ msgstr "" "當除法或模數運算 (modulo operation) 的第二個引數是 0 的時候會引發此例外。關聯" "值是一個字串,表示運算元及運算的類型。" -#: ../../library/exceptions.rst:666 +#: ../../library/exceptions.rst:684 msgid "" "The following exceptions are kept for compatibility with previous versions; " "starting from Python 3.3, they are aliases of :exc:`OSError`." @@ -1000,21 +1028,21 @@ msgstr "" "以下例外是為了相容於之前版本而保留;從 Python 3.3 開始,它們是 :exc:" "`OSError` 的別名。" -#: ../../library/exceptions.rst:675 +#: ../../library/exceptions.rst:693 msgid "Only available on Windows." msgstr "僅限於在 Windows 中使用。" -#: ../../library/exceptions.rst:679 +#: ../../library/exceptions.rst:697 msgid "OS exceptions" msgstr "作業系統例外" -#: ../../library/exceptions.rst:681 +#: ../../library/exceptions.rst:699 msgid "" "The following exceptions are subclasses of :exc:`OSError`, they get raised " "depending on the system error code." msgstr "以下的例外是 :exc:`OSError` 的子類別,它們根據系統錯誤代碼來引發。" -#: ../../library/exceptions.rst:686 +#: ../../library/exceptions.rst:704 msgid "" "Raised when an operation would block on an object (e.g. socket) set for non-" "blocking operation. Corresponds to :c:data:`errno` :py:const:`~errno." @@ -1025,14 +1053,14 @@ msgstr "" "到 :c:data:`errno` :py:const:`~errno.EAGAIN`、:py:const:`~errno.EALREADY`、:" "py:const:`~errno.EWOULDBLOCK` 及 :py:const:`~errno.EINPROGRESS`。" -#: ../../library/exceptions.rst:691 +#: ../../library/exceptions.rst:709 msgid "" "In addition to those of :exc:`OSError`, :exc:`BlockingIOError` can have one " "more attribute:" msgstr "" "除了 :exc:`OSError` 的那些屬性之外,:exc:`BlockingIOError` 有多一個屬性:" -#: ../../library/exceptions.rst:696 +#: ../../library/exceptions.rst:714 msgid "" "An integer containing the number of characters written to the stream before " "it blocked. This attribute is available when using the buffered I/O classes " @@ -1041,7 +1069,7 @@ msgstr "" "一個整數,內容為在其阻塞之前,已寫進串流的字元數。當使用 :mod:`io` 模組裡的緩" "衝 I/O 類別時這個屬性是可用的。" -#: ../../library/exceptions.rst:702 +#: ../../library/exceptions.rst:720 msgid "" "Raised when an operation on a child process failed. Corresponds to :c:data:" "`errno` :py:const:`~errno.ECHILD`." @@ -1049,11 +1077,11 @@ msgstr "" "當子行程上的操作失敗時會引發此例外。對應到 :c:data:`errno` :py:const:`~errno." "ECHILD`。" -#: ../../library/exceptions.rst:707 +#: ../../library/exceptions.rst:725 msgid "A base class for connection-related issues." msgstr "連線相關問題的基礎類別。" -#: ../../library/exceptions.rst:709 +#: ../../library/exceptions.rst:727 msgid "" "Subclasses are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:" "`ConnectionRefusedError` and :exc:`ConnectionResetError`." @@ -1061,7 +1089,7 @@ msgstr "" "子類別有 :exc:`BrokenPipeError`、:exc:`ConnectionAbortedError`、:exc:" "`ConnectionRefusedError` 及 :exc:`ConnectionResetError`。" -#: ../../library/exceptions.rst:714 +#: ../../library/exceptions.rst:732 msgid "" "A subclass of :exc:`ConnectionError`, raised when trying to write on a pipe " "while the other end has been closed, or trying to write on a socket which " @@ -1072,7 +1100,7 @@ msgstr "" "會引發此例外,或者當嘗試寫入已關閉寫入的 socket 時也會引發。對應到 :c:data:" "`errno` :py:const:`~errno.EPIPE` 及 :py:const:`~errno.ESHUTDOWN`。" -#: ../../library/exceptions.rst:721 +#: ../../library/exceptions.rst:739 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " "aborted by the peer. Corresponds to :c:data:`errno` :py:const:`~errno." @@ -1081,7 +1109,7 @@ msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線的嘗試被對等端點 (peer) 中斷時會引" "發此例外。對應到 :c:data:`errno` :py:const:`~errno.ECONNABORTED`。" -#: ../../library/exceptions.rst:727 +#: ../../library/exceptions.rst:745 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " "refused by the peer. Corresponds to :c:data:`errno` :py:const:`~errno." @@ -1090,7 +1118,7 @@ msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線的嘗試被對等端點拒絕時會引發此例" "外。對應到 :c:data:`errno` :py:const:`~errno.ECONNREFUSED`。" -#: ../../library/exceptions.rst:733 +#: ../../library/exceptions.rst:751 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection is reset by " "the peer. Corresponds to :c:data:`errno` :py:const:`~errno.ECONNRESET`." @@ -1098,7 +1126,7 @@ msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線被對等端點重置時會引發此例外。對應" "到 :c:data:`errno` :py:const:`~errno.ECONNRESET`。" -#: ../../library/exceptions.rst:739 +#: ../../library/exceptions.rst:757 msgid "" "Raised when trying to create a file or directory which already exists. " "Corresponds to :c:data:`errno` :py:const:`~errno.EEXIST`." @@ -1106,7 +1134,7 @@ msgstr "" "當嘗試建立已存在的檔案或目錄時會引發此例外。對應到 :c:data:`errno` :py:const:" "`~errno.EEXIST`。" -#: ../../library/exceptions.rst:744 +#: ../../library/exceptions.rst:762 msgid "" "Raised when a file or directory is requested but doesn't exist. Corresponds " "to :c:data:`errno` :py:const:`~errno.ENOENT`." @@ -1114,7 +1142,7 @@ msgstr "" "當請求不存在的檔案或目錄時會引發此例外。對應到 :c:data:`errno` :py:const:" "`~errno.ENOENT`。" -#: ../../library/exceptions.rst:749 +#: ../../library/exceptions.rst:767 msgid "" "Raised when a system call is interrupted by an incoming signal. Corresponds " "to :c:data:`errno` :py:const:`~errno.EINTR`." @@ -1122,7 +1150,7 @@ msgstr "" "當系統呼叫被傳入的信號中斷時會引發此例外。對應到 :c:data:`errno` :py:const:" "`~errno.EINTR`。" -#: ../../library/exceptions.rst:752 +#: ../../library/exceptions.rst:770 msgid "" "Python now retries system calls when a syscall is interrupted by a signal, " "except if the signal handler raises an exception (see :pep:`475` for the " @@ -1131,7 +1159,7 @@ msgstr "" "現在當 syscall 被信號中斷時 Python 會重試系統呼叫而不會引發 :exc:" "`InterruptedError`,除非信號處理器引發例外(理由可參考 :pep:`475`)。" -#: ../../library/exceptions.rst:759 +#: ../../library/exceptions.rst:777 msgid "" "Raised when a file operation (such as :func:`os.remove`) is requested on a " "directory. Corresponds to :c:data:`errno` :py:const:`~errno.EISDIR`." @@ -1139,7 +1167,7 @@ msgstr "" "當在目錄上請求檔案操作(例如 :func:`os.remove`)時會引發此例外。對應到 :c:" "data:`errno` :py:const:`~errno.EISDIR`。" -#: ../../library/exceptions.rst:765 +#: ../../library/exceptions.rst:783 msgid "" "Raised when a directory operation (such as :func:`os.listdir`) is requested " "on something which is not a directory. On most POSIX platforms, it may also " @@ -1151,7 +1179,7 @@ msgstr "" "外。在大多數的 POSIX 平台上,如果嘗試操作開啟或遍歷一個當作目錄的非目錄檔案也" "會引發此例外。對應到 :c:data:`errno` :py:const:`~errno.ENOTDIR`。" -#: ../../library/exceptions.rst:773 +#: ../../library/exceptions.rst:791 msgid "" "Raised when trying to run an operation without the adequate access rights - " "for example filesystem permissions. Corresponds to :c:data:`errno` :py:const:" @@ -1162,14 +1190,14 @@ msgstr "" "到 :c:data:`errno` :py:const:`~errno.EACCES`、:py:const:`~errno.EPERM` 及 :" "py:const:`~errno.ENOTCAPABLE`。" -#: ../../library/exceptions.rst:778 +#: ../../library/exceptions.rst:796 msgid "" "WASI's :py:const:`~errno.ENOTCAPABLE` is now mapped to :exc:" "`PermissionError`." msgstr "" "WASI 的 :py:const:`~errno.ENOTCAPABLE` 現在對應到 :exc:`PermissionError`。" -#: ../../library/exceptions.rst:784 +#: ../../library/exceptions.rst:802 msgid "" "Raised when a given process doesn't exist. Corresponds to :c:data:`errno` :" "py:const:`~errno.ESRCH`." @@ -1177,7 +1205,7 @@ msgstr "" "當給定的行程不存在時會引發此例外。對應到 :c:data:`errno` :py:const:`~errno." "ESRCH`。" -#: ../../library/exceptions.rst:789 +#: ../../library/exceptions.rst:807 msgid "" "Raised when a system function timed out at the system level. Corresponds to :" "c:data:`errno` :py:const:`~errno.ETIMEDOUT`." @@ -1185,40 +1213,40 @@ msgstr "" "當系統函式在系統層級超時會引發此例外。對應到 :c:data:`errno` :py:const:" "`~errno.ETIMEDOUT`。" -#: ../../library/exceptions.rst:792 +#: ../../library/exceptions.rst:810 msgid "All the above :exc:`OSError` subclasses were added." msgstr "加入以上所有的 :exc:`OSError` 子類別。" -#: ../../library/exceptions.rst:798 +#: ../../library/exceptions.rst:816 msgid ":pep:`3151` - Reworking the OS and IO exception hierarchy" msgstr ":pep:`3151` — 改寫作業系統與 IO 例外階層" -#: ../../library/exceptions.rst:804 +#: ../../library/exceptions.rst:822 msgid "Warnings" msgstr "警告" -#: ../../library/exceptions.rst:806 +#: ../../library/exceptions.rst:824 msgid "" "The following exceptions are used as warning categories; see the :ref:" "`warning-categories` documentation for more details." msgstr "" "以下的例外是當作警告的種類使用;更多細節參考 :ref:`warning-categories` 文件。" -#: ../../library/exceptions.rst:811 +#: ../../library/exceptions.rst:829 msgid "Base class for warning categories." msgstr "警告種類的基礎類別。" -#: ../../library/exceptions.rst:816 +#: ../../library/exceptions.rst:834 msgid "Base class for warnings generated by user code." msgstr "使用者程式碼產生的警告的基礎類別。" -#: ../../library/exceptions.rst:821 +#: ../../library/exceptions.rst:839 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for other Python developers." msgstr "關於已棄用功能的警告的基礎類別,且當那些警告是針對其他 Python 開發者。" -#: ../../library/exceptions.rst:824 +#: ../../library/exceptions.rst:842 msgid "" "Ignored by the default warning filters, except in the ``__main__`` module (:" "pep:`565`). Enabling the :ref:`Python Development Mode ` shows this " @@ -1227,17 +1255,17 @@ msgstr "" "會被預設的警告過濾器忽略,在 ``__main__`` 模組裡除外 (:pep:`565`)。啟用 :ref:" "`Python 開發模式 `\\ 會顯示此警告。" -#: ../../library/exceptions.rst:828 ../../library/exceptions.rst:844 +#: ../../library/exceptions.rst:846 ../../library/exceptions.rst:862 msgid "The deprecation policy is described in :pep:`387`." msgstr "棄用原則描述在 :pep:`387` 裡。" -#: ../../library/exceptions.rst:833 +#: ../../library/exceptions.rst:851 msgid "" "Base class for warnings about features which are obsolete and expected to be " "deprecated in the future, but are not deprecated at the moment." msgstr "關於過時且預期未來要被棄用,但目前尚未被棄用的功能的警告的基礎類別。" -#: ../../library/exceptions.rst:837 +#: ../../library/exceptions.rst:855 msgid "" "This class is rarely used as emitting a warning about a possible upcoming " "deprecation is unusual, and :exc:`DeprecationWarning` is preferred for " @@ -1246,8 +1274,8 @@ msgstr "" "因為發出關於可能即將被棄用的警告是不尋常的,此類別很少被使用,而對已經被棄用" "的情況會優先使用 :exc:`DeprecationWarning`。" -#: ../../library/exceptions.rst:841 ../../library/exceptions.rst:867 -#: ../../library/exceptions.rst:894 +#: ../../library/exceptions.rst:859 ../../library/exceptions.rst:885 +#: ../../library/exceptions.rst:912 msgid "" "Ignored by the default warning filters. Enabling the :ref:`Python " "Development Mode ` shows this warning." @@ -1255,15 +1283,15 @@ msgstr "" "會被預設的警告過濾器忽略。啟用 :ref:`Python 開發模式 `\\ 會顯示此警" "告。" -#: ../../library/exceptions.rst:849 +#: ../../library/exceptions.rst:867 msgid "Base class for warnings about dubious syntax." msgstr "關於可疑語法的警告的基礎類別。" -#: ../../library/exceptions.rst:854 +#: ../../library/exceptions.rst:872 msgid "Base class for warnings about dubious runtime behavior." msgstr "關於可疑執行環境行為的警告的基礎類別。" -#: ../../library/exceptions.rst:859 +#: ../../library/exceptions.rst:877 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for end users of applications that are written in Python." @@ -1271,36 +1299,36 @@ msgstr "" "關於已棄用功能的警告的基礎類別,且當那些警告是針對以 Python 寫的應用程式的終" "端使用者。" -#: ../../library/exceptions.rst:865 +#: ../../library/exceptions.rst:883 msgid "Base class for warnings about probable mistakes in module imports." msgstr "關於在模組引入的可能錯誤的警告的基礎類別。" -#: ../../library/exceptions.rst:873 +#: ../../library/exceptions.rst:891 msgid "Base class for warnings related to Unicode." msgstr "Unicode 相關警告的基礎類別。" -#: ../../library/exceptions.rst:878 +#: ../../library/exceptions.rst:896 msgid "Base class for warnings related to encodings." msgstr "編碼相關警告的基礎類別。" -#: ../../library/exceptions.rst:880 +#: ../../library/exceptions.rst:898 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節參考\\ :ref:`io-encoding-warning`。" -#: ../../library/exceptions.rst:887 +#: ../../library/exceptions.rst:905 msgid "" "Base class for warnings related to :class:`bytes` and :class:`bytearray`." msgstr ":class:`bytes` 及 :class:`bytearray` 相關警告的基礎類別。" -#: ../../library/exceptions.rst:892 +#: ../../library/exceptions.rst:910 msgid "Base class for warnings related to resource usage." msgstr "資源用法相關警告的基礎類別。" -#: ../../library/exceptions.rst:903 +#: ../../library/exceptions.rst:921 msgid "Exception groups" msgstr "例外群組" -#: ../../library/exceptions.rst:905 +#: ../../library/exceptions.rst:923 msgid "" "The following are used when it is necessary to raise multiple unrelated " "exceptions. They are part of the exception hierarchy so they can be handled " @@ -1312,7 +1340,7 @@ msgstr "" "所有其他例外一樣使用 :keyword:`except` 來處理。此外,它們會以包含的例外類型為" "基礎來比對其子群組而被 :keyword:`except*` 辨認出來。" -#: ../../library/exceptions.rst:914 +#: ../../library/exceptions.rst:932 msgid "" "Both of these exception types wrap the exceptions in the sequence ``excs``. " "The ``msg`` parameter must be a string. The difference between the two " @@ -1328,7 +1356,7 @@ msgstr "" "`Exception` 的子類別。這個設計使得 ``except Exception`` 可以捕捉 :exc:" "`ExceptionGroup` 但不能捕捉 :exc:`BaseExceptionGroup`。" -#: ../../library/exceptions.rst:922 +#: ../../library/exceptions.rst:940 msgid "" "The :exc:`BaseExceptionGroup` constructor returns an :exc:`ExceptionGroup` " "rather than a :exc:`BaseExceptionGroup` if all contained exceptions are :exc:" @@ -1341,17 +1369,17 @@ msgstr "" "使用來讓這樣的選擇自動化。另一方面來說,如果任何包含的例外不是 :exc:" "`Exception` 的子類別,:exc:`ExceptionGroup` 建構函式會引發 :exc:`TypeError`。" -#: ../../library/exceptions.rst:931 +#: ../../library/exceptions.rst:949 msgid "The ``msg`` argument to the constructor. This is a read-only attribute." msgstr "建構函式的 ``msg`` 引數。這是一個唯讀的屬性。" -#: ../../library/exceptions.rst:935 +#: ../../library/exceptions.rst:953 msgid "" "A tuple of the exceptions in the ``excs`` sequence given to the constructor. " "This is a read-only attribute." msgstr "指定給建構函式 ``excs`` 序列中的例外組成的元組。這是一個唯讀的屬性。" -#: ../../library/exceptions.rst:940 +#: ../../library/exceptions.rst:958 msgid "" "Returns an exception group that contains only the exceptions from the " "current group that match *condition*, or ``None`` if the result is empty." @@ -1359,18 +1387,16 @@ msgstr "" "回傳只包含從現有群組比對到 *condition* 的例外的例外群組,或者當結果為空時回" "傳 ``None``。" -#: ../../library/exceptions.rst:943 +#: ../../library/exceptions.rst:961 msgid "" -"The condition can be either a function that accepts an exception and returns " -"true for those that should be in the subgroup, or it can be an exception " -"type or a tuple of exception types, which is used to check for a match using " -"the same check that is used in an ``except`` clause." +"The condition can be an exception type or tuple of exception types, in which " +"case each exception is checked for a match using the same check that is used " +"in an ``except`` clause. The condition can also be a callable (other than a " +"type object) that accepts an exception as its single argument and returns " +"true for the exceptions that should be in the subgroup." msgstr "" -"條件可以是一個函式,接受一個例外並對那些應該要在子群組裡的例外回傳 true,或者" -"可以是一個例外類型或例外類型的元組,並使用與 ``except`` 子句所使用的相同檢查" -"來檢查是否有比對到。" -#: ../../library/exceptions.rst:948 +#: ../../library/exceptions.rst:967 msgid "" "The nesting structure of the current exception is preserved in the result, " "as are the values of its :attr:`message`, :attr:`~BaseException." @@ -1383,7 +1409,7 @@ msgstr "" "__context__` 及 :attr:`~BaseException.__notes__` 欄位的值也一樣。空的巢狀群組" "會從結果裡排除。" -#: ../../library/exceptions.rst:955 +#: ../../library/exceptions.rst:974 msgid "" "The condition is checked for all exceptions in the nested exception group, " "including the top-level and any nested exception groups. If the condition is " @@ -1392,7 +1418,11 @@ msgstr "" "條件會對巢狀例外群組裡的所有例外做檢查,包括頂層及任何巢狀的例外群組。如果條" "件對這樣的例外群組為 true,它會被完整包含在結果裡。" -#: ../../library/exceptions.rst:961 +#: ../../library/exceptions.rst:978 +msgid "``condition`` can be any callable which is not a type object." +msgstr "" + +#: ../../library/exceptions.rst:983 msgid "" "Like :meth:`subgroup`, but returns the pair ``(match, rest)`` where " "``match`` is ``subgroup(condition)`` and ``rest`` is the remaining non-" @@ -1401,13 +1431,13 @@ msgstr "" "像 :meth:`subgroup` 一樣,但回傳一對 ``(match, rest)``,其中 ``match`` 是 " "``subgroup(condition)`` 而 ``rest`` 是剩下沒有比對到的部分。" -#: ../../library/exceptions.rst:967 +#: ../../library/exceptions.rst:989 msgid "" "Returns an exception group with the same :attr:`message`, but which wraps " "the exceptions in ``excs``." msgstr "回傳有相同 :attr:`message` 但將例外包裝在 ``excs`` 的例外群組。" -#: ../../library/exceptions.rst:970 +#: ../../library/exceptions.rst:992 msgid "" "This method is used by :meth:`subgroup` and :meth:`split`, which are used in " "various contexts to break up an exception group. A subclass needs to " @@ -1418,7 +1448,7 @@ msgstr "" "組。子類別需要覆寫它來讓 :meth:`subgroup` 及 :meth:`split` 回傳子類別而不是 :" "exc:`ExceptionGroup` 的實例。" -#: ../../library/exceptions.rst:976 +#: ../../library/exceptions.rst:998 msgid "" ":meth:`subgroup` and :meth:`split` copy the :attr:`~BaseException." "__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException." @@ -1431,7 +1461,7 @@ msgstr "" "`~BaseException.__context__` 和 :attr:`~BaseException.__notes__` 欄位到 :" "meth:`derive` 所回傳的例外群組上,因此這些欄位不需要被 :meth:`derive` 更新。" -#: ../../library/exceptions.rst:983 +#: ../../library/exceptions.rst:1005 msgid "" ">>> class MyGroup(ExceptionGroup):\n" "... def derive(self, excs):\n" @@ -1485,7 +1515,7 @@ msgstr "" ">>> exc.__traceback__ is match.__traceback__ is rest.__traceback__\n" "True" -#: ../../library/exceptions.rst:1009 +#: ../../library/exceptions.rst:1031 msgid "" "Note that :exc:`BaseExceptionGroup` defines :meth:`~object.__new__`, so " "subclasses that need a different constructor signature need to override that " @@ -1497,7 +1527,7 @@ msgstr "" "建構函式簽名的子類別需要覆寫它而不是 :meth:`~object.__init__`。例如下面定義了" "一個例外群組子類別接受 exit_code 並從中建構群組的訊息。: ::" -#: ../../library/exceptions.rst:1015 +#: ../../library/exceptions.rst:1037 msgid "" "class Errors(ExceptionGroup):\n" " def __new__(cls, errors, exit_code):\n" @@ -1517,7 +1547,7 @@ msgstr "" " def derive(self, excs):\n" " return Errors(excs, self.exit_code)" -#: ../../library/exceptions.rst:1024 +#: ../../library/exceptions.rst:1046 msgid "" "Like :exc:`ExceptionGroup`, any subclass of :exc:`BaseExceptionGroup` which " "is also a subclass of :exc:`Exception` can only wrap instances of :exc:" @@ -1526,15 +1556,16 @@ msgstr "" "像 :exc:`ExceptionGroup` 一樣,任何 :exc:`BaseExceptionGroup` 的子類別且也" "是 :exc:`Exception` 的子類別只能包裝 :exc:`Exception` 的實例。" -#: ../../library/exceptions.rst:1032 +#: ../../library/exceptions.rst:1054 msgid "Exception hierarchy" msgstr "例外階層" -#: ../../library/exceptions.rst:1034 +#: ../../library/exceptions.rst:1056 msgid "The class hierarchy for built-in exceptions is:" msgstr "內建例外的類別階層如下:" -#: ../../library/exceptions.rst:1036 +#: ../../library/exceptions.rst:1058 +#, fuzzy msgid "" "BaseException\n" " ├── BaseExceptionGroup\n" @@ -1578,6 +1609,7 @@ msgid "" " ├── ReferenceError\n" " ├── RuntimeError\n" " │ ├── NotImplementedError\n" +" │ ├── PythonFinalizationError\n" " │ └── RecursionError\n" " ├── StopAsyncIteration\n" " ├── StopIteration\n" @@ -1720,3 +1752,13 @@ msgstr "module(模組)" #: ../../library/exceptions.rst:345 msgid "errno" msgstr "errno" + +#~ msgid "" +#~ "The condition can be either a function that accepts an exception and " +#~ "returns true for those that should be in the subgroup, or it can be an " +#~ "exception type or a tuple of exception types, which is used to check for " +#~ "a match using the same check that is used in an ``except`` clause." +#~ msgstr "" +#~ "條件可以是一個函式,接受一個例外並對那些應該要在子群組裡的例外回傳 true," +#~ "或者可以是一個例外類型或例外類型的元組,並使用與 ``except`` 子句所使用的相" +#~ "同檢查來檢查是否有比對到。" diff --git a/library/fcntl.po b/library/fcntl.po index 283b9f5887..4a43c0463f 100644 --- a/library/fcntl.po +++ b/library/fcntl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,7 +31,8 @@ msgid "" msgstr "" #: ../../library/fcntl.rst:21 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +#, fuzzy +msgid ":ref:`Availability `: Unix, not WASI." msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" #: ../../library/fcntl.rst:23 @@ -51,29 +52,30 @@ msgstr "" #: ../../library/fcntl.rst:33 msgid "" -"The fcntl module now contains ``F_ADD_SEALS``, ``F_GET_SEALS``, and " +"The :mod:`!fcntl` module now contains ``F_ADD_SEALS``, ``F_GET_SEALS``, and " "``F_SEAL_*`` constants for sealing of :func:`os.memfd_create` file " "descriptors." msgstr "" #: ../../library/fcntl.rst:38 msgid "" -"On macOS, the fcntl module exposes the ``F_GETPATH`` constant, which obtains " -"the path of a file from a file descriptor. On Linux(>=3.15), the fcntl " -"module exposes the ``F_OFD_GETLK``, ``F_OFD_SETLK`` and ``F_OFD_SETLKW`` " -"constants, which are used when working with open file description locks." +"On macOS, the :mod:`!fcntl` module exposes the ``F_GETPATH`` constant, which " +"obtains the path of a file from a file descriptor. On Linux(>=3.15), the :" +"mod:`!fcntl` module exposes the ``F_OFD_GETLK``, ``F_OFD_SETLK`` and " +"``F_OFD_SETLKW`` constants, which are used when working with open file " +"description locks." msgstr "" #: ../../library/fcntl.rst:45 msgid "" -"On Linux >= 2.6.11, the fcntl module exposes the ``F_GETPIPE_SZ`` and " -"``F_SETPIPE_SZ`` constants, which allow to check and modify a pipe's size " -"respectively." +"On Linux >= 2.6.11, the :mod:`!fcntl` module exposes the ``F_GETPIPE_SZ`` " +"and ``F_SETPIPE_SZ`` constants, which allow to check and modify a pipe's " +"size respectively." msgstr "" #: ../../library/fcntl.rst:50 msgid "" -"On FreeBSD, the fcntl module exposes the ``F_DUP2FD`` and " +"On FreeBSD, the :mod:`!fcntl` module exposes the ``F_DUP2FD`` and " "``F_DUP2FD_CLOEXEC`` constants, which allow to duplicate a file descriptor, " "the latter setting ``FD_CLOEXEC`` flag in addition." msgstr "" @@ -87,10 +89,31 @@ msgid "" msgstr "" #: ../../library/fcntl.rst:61 +msgid "" +"On Linux >= 2.6.32, the :mod:`!fcntl` module exposes the ``F_GETOWN_EX``, " +"``F_SETOWN_EX``, ``F_OWNER_TID``, ``F_OWNER_PID``, ``F_OWNER_PGRP`` " +"constants, which allow to direct I/O availability signals to a specific " +"thread, process, or process group. On Linux >= 4.13, the :mod:`!fcntl` " +"module exposes the ``F_GET_RW_HINT``, ``F_SET_RW_HINT``, " +"``F_GET_FILE_RW_HINT``, ``F_SET_FILE_RW_HINT``, and ``RWH_WRITE_LIFE_*`` " +"constants, which allow to inform the kernel about the relative expected " +"lifetime of writes on a given inode or via a particular open file " +"description. On Linux >= 5.1 and NetBSD, the :mod:`!fcntl` module exposes " +"the ``F_SEAL_FUTURE_WRITE`` constant for use with ``F_ADD_SEALS`` and " +"``F_GET_SEALS`` operations. On FreeBSD, the :mod:`!fcntl` module exposes the " +"``F_READAHEAD``, ``F_ISUNIONSTACK``, and ``F_KINFO`` constants. On macOS and " +"FreeBSD, the :mod:`!fcntl` module exposes the ``F_RDAHEAD`` constant. On " +"NetBSD and AIX, the :mod:`!fcntl` module exposes the ``F_CLOSEM`` constant. " +"On NetBSD, the :mod:`!fcntl` module exposes the ``F_MAXFD`` constant. On " +"macOS and NetBSD, the :mod:`!fcntl` module exposes the ``F_GETNOSIGPIPE`` " +"and ``F_SETNOSIGPIPE`` constant." +msgstr "" + +#: ../../library/fcntl.rst:82 msgid "The module defines the following functions:" msgstr "" -#: ../../library/fcntl.rst:66 +#: ../../library/fcntl.rst:87 msgid "" "Perform the operation *cmd* on file descriptor *fd* (file objects providing " "a :meth:`~io.IOBase.fileno` method are accepted as well). The values used " @@ -109,11 +132,11 @@ msgid "" "result in a segmentation violation or a more subtle data corruption." msgstr "" -#: ../../library/fcntl.rst:83 +#: ../../library/fcntl.rst:104 msgid "If the :c:func:`fcntl` call fails, an :exc:`OSError` is raised." msgstr "" -#: ../../library/fcntl.rst:85 +#: ../../library/fcntl.rst:106 msgid "" "Raises an :ref:`auditing event ` ``fcntl.fcntl`` with arguments " "``fd``, ``cmd``, ``arg``." @@ -121,13 +144,13 @@ msgstr "" "引發一個附帶引數 ``fd``、``cmd``、``arg`` 的\\ :ref:`稽核事件 ` " "``fcntl.fcntl``。" -#: ../../library/fcntl.rst:90 +#: ../../library/fcntl.rst:111 msgid "" "This function is identical to the :func:`~fcntl.fcntl` function, except that " "the argument handling is even more complicated." msgstr "" -#: ../../library/fcntl.rst:93 +#: ../../library/fcntl.rst:114 msgid "" "The *request* parameter is limited to values that can fit in 32-bits. " "Additional constants of interest for use as the *request* argument can be " @@ -135,26 +158,26 @@ msgid "" "relevant C header files." msgstr "" -#: ../../library/fcntl.rst:98 +#: ../../library/fcntl.rst:119 msgid "" "The parameter *arg* can be one of an integer, an object supporting the read-" "only buffer interface (like :class:`bytes`) or an object supporting the read-" "write buffer interface (like :class:`bytearray`)." msgstr "" -#: ../../library/fcntl.rst:102 +#: ../../library/fcntl.rst:123 msgid "" "In all but the last case, behaviour is as for the :func:`~fcntl.fcntl` " "function." msgstr "" -#: ../../library/fcntl.rst:105 +#: ../../library/fcntl.rst:126 msgid "" "If a mutable buffer is passed, then the behaviour is determined by the value " "of the *mutate_flag* parameter." msgstr "" -#: ../../library/fcntl.rst:108 +#: ../../library/fcntl.rst:129 msgid "" "If it is false, the buffer's mutability is ignored and behaviour is as for a " "read-only buffer, except that the 1024 byte limit mentioned above is avoided " @@ -162,7 +185,7 @@ msgid "" "system wants to put there, things should work." msgstr "" -#: ../../library/fcntl.rst:113 +#: ../../library/fcntl.rst:134 msgid "" "If *mutate_flag* is true (the default), then the buffer is (in effect) " "passed to the underlying :func:`ioctl` system call, the latter's return code " @@ -173,16 +196,16 @@ msgid "" "copied back into the supplied buffer." msgstr "" -#: ../../library/fcntl.rst:121 +#: ../../library/fcntl.rst:142 msgid "" "If the :c:func:`ioctl` call fails, an :exc:`OSError` exception is raised." msgstr "" -#: ../../library/fcntl.rst:123 +#: ../../library/fcntl.rst:144 msgid "An example::" msgstr "範例: ::" -#: ../../library/fcntl.rst:125 +#: ../../library/fcntl.rst:146 msgid "" ">>> import array, fcntl, struct, termios, os\n" ">>> os.getpgrp()\n" @@ -206,7 +229,7 @@ msgstr "" ">>> buf\n" "array('h', [13341])" -#: ../../library/fcntl.rst:136 +#: ../../library/fcntl.rst:157 msgid "" "Raises an :ref:`auditing event ` ``fcntl.ioctl`` with arguments " "``fd``, ``request``, ``arg``." @@ -214,7 +237,7 @@ msgstr "" "引發一個附帶引數 ``fd``、``request``、``arg`` 的\\ :ref:`稽核事件 " "` ``fcntl.ioctl``。" -#: ../../library/fcntl.rst:141 +#: ../../library/fcntl.rst:162 msgid "" "Perform the lock operation *operation* on file descriptor *fd* (file objects " "providing a :meth:`~io.IOBase.fileno` method are accepted as well). See the " @@ -222,12 +245,12 @@ msgid "" "function is emulated using :c:func:`fcntl`.)" msgstr "" -#: ../../library/fcntl.rst:146 +#: ../../library/fcntl.rst:167 msgid "" "If the :c:func:`flock` call fails, an :exc:`OSError` exception is raised." msgstr "" -#: ../../library/fcntl.rst:148 +#: ../../library/fcntl.rst:169 msgid "" "Raises an :ref:`auditing event ` ``fcntl.flock`` with arguments " "``fd``, ``operation``." @@ -235,7 +258,7 @@ msgstr "" "引發一個附帶引數 ``fd``、``operation`` 的\\ :ref:`稽核事件 ` " "``fcntl.flock``。" -#: ../../library/fcntl.rst:153 +#: ../../library/fcntl.rst:174 msgid "" "This is essentially a wrapper around the :func:`~fcntl.fcntl` locking calls. " "*fd* is the file descriptor (file objects providing a :meth:`~io.IOBase." @@ -243,25 +266,25 @@ msgid "" "*cmd* is one of the following values:" msgstr "" -#: ../../library/fcntl.rst:160 +#: ../../library/fcntl.rst:181 msgid "Release an existing lock." msgstr "" -#: ../../library/fcntl.rst:164 +#: ../../library/fcntl.rst:185 msgid "Acquire a shared lock." msgstr "" -#: ../../library/fcntl.rst:168 +#: ../../library/fcntl.rst:189 msgid "Acquire an exclusive lock." msgstr "" -#: ../../library/fcntl.rst:172 +#: ../../library/fcntl.rst:193 msgid "" "Bitwise OR with any of the other three ``LOCK_*`` constants to make the " "request non-blocking." msgstr "" -#: ../../library/fcntl.rst:175 +#: ../../library/fcntl.rst:196 msgid "" "If :const:`!LOCK_NB` is used and the lock cannot be acquired, an :exc:" "`OSError` will be raised and the exception will have an *errno* attribute " @@ -271,33 +294,33 @@ msgid "" "a file opened for writing." msgstr "" -#: ../../library/fcntl.rst:182 +#: ../../library/fcntl.rst:203 msgid "" "*len* is the number of bytes to lock, *start* is the byte offset at which " "the lock starts, relative to *whence*, and *whence* is as with :func:`io." "IOBase.seek`, specifically:" msgstr "" -#: ../../library/fcntl.rst:186 +#: ../../library/fcntl.rst:207 msgid "``0`` -- relative to the start of the file (:const:`os.SEEK_SET`)" msgstr "" -#: ../../library/fcntl.rst:187 +#: ../../library/fcntl.rst:208 msgid "``1`` -- relative to the current buffer position (:const:`os.SEEK_CUR`)" msgstr "" -#: ../../library/fcntl.rst:188 +#: ../../library/fcntl.rst:209 msgid "``2`` -- relative to the end of the file (:const:`os.SEEK_END`)" msgstr "" -#: ../../library/fcntl.rst:190 +#: ../../library/fcntl.rst:211 msgid "" "The default for *start* is 0, which means to start at the beginning of the " "file. The default for *len* is 0 which means to lock to the end of the " "file. The default for *whence* is also 0." msgstr "" -#: ../../library/fcntl.rst:194 +#: ../../library/fcntl.rst:215 msgid "" "Raises an :ref:`auditing event ` ``fcntl.lockf`` with arguments " "``fd``, ``cmd``, ``len``, ``start``, ``whence``." @@ -305,11 +328,11 @@ msgstr "" "引發一個附帶引數 ``fd``、``cmd``、``len``、``start``、``whence`` 的\\ :ref:`" "稽核事件 ` ``fcntl.lockf``。" -#: ../../library/fcntl.rst:196 +#: ../../library/fcntl.rst:217 msgid "Examples (all on a SVR4 compliant system)::" msgstr "" -#: ../../library/fcntl.rst:198 +#: ../../library/fcntl.rst:219 msgid "" "import struct, fcntl, os\n" "\n" @@ -327,7 +350,7 @@ msgstr "" "lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0)\n" "rv = fcntl.fcntl(f, fcntl.F_SETLKW, lockdata)" -#: ../../library/fcntl.rst:206 +#: ../../library/fcntl.rst:227 msgid "" "Note that in the first example the return value variable *rv* will hold an " "integer value; in the second example it will hold a :class:`bytes` object. " @@ -335,11 +358,11 @@ msgid "" "therefore using the :func:`flock` call may be better." msgstr "" -#: ../../library/fcntl.rst:214 +#: ../../library/fcntl.rst:235 msgid "Module :mod:`os`" msgstr ":mod:`os` 模組" -#: ../../library/fcntl.rst:215 +#: ../../library/fcntl.rst:236 msgid "" "If the locking flags :const:`~os.O_SHLOCK` and :const:`~os.O_EXLOCK` are " "present in the :mod:`os` module (on BSD only), the :func:`os.open` function " diff --git a/library/filecmp.po b/library/filecmp.po index c93d892b11..ca8839f45d 100644 --- a/library/filecmp.po +++ b/library/filecmp.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -120,124 +120,128 @@ msgstr "" #: ../../library/filecmp.rst:80 msgid "" "The :class:`dircmp` class compares files by doing *shallow* comparisons as " -"described for :func:`filecmp.cmp`." +"described for :func:`filecmp.cmp` by default using the *shallow* parameter." msgstr "" -#: ../../library/filecmp.rst:83 +#: ../../library/filecmp.rst:86 +msgid "Added the *shallow* parameter." +msgstr "" + +#: ../../library/filecmp.rst:88 msgid "The :class:`dircmp` class provides the following methods:" msgstr "" -#: ../../library/filecmp.rst:87 +#: ../../library/filecmp.rst:92 msgid "Print (to :data:`sys.stdout`) a comparison between *a* and *b*." msgstr "" -#: ../../library/filecmp.rst:91 +#: ../../library/filecmp.rst:96 msgid "" "Print a comparison between *a* and *b* and common immediate subdirectories." msgstr "" -#: ../../library/filecmp.rst:96 +#: ../../library/filecmp.rst:101 msgid "" "Print a comparison between *a* and *b* and common subdirectories " "(recursively)." msgstr "" -#: ../../library/filecmp.rst:99 +#: ../../library/filecmp.rst:104 msgid "" "The :class:`dircmp` class offers a number of interesting attributes that may " "be used to get various bits of information about the directory trees being " "compared." msgstr "" -#: ../../library/filecmp.rst:103 +#: ../../library/filecmp.rst:108 msgid "" "Note that via :meth:`~object.__getattr__` hooks, all attributes are computed " "lazily, so there is no speed penalty if only those attributes which are " "lightweight to compute are used." msgstr "" -#: ../../library/filecmp.rst:110 +#: ../../library/filecmp.rst:115 msgid "The directory *a*." msgstr "" -#: ../../library/filecmp.rst:115 +#: ../../library/filecmp.rst:120 msgid "The directory *b*." msgstr "" -#: ../../library/filecmp.rst:120 +#: ../../library/filecmp.rst:125 msgid "Files and subdirectories in *a*, filtered by *hide* and *ignore*." msgstr "" -#: ../../library/filecmp.rst:125 +#: ../../library/filecmp.rst:130 msgid "Files and subdirectories in *b*, filtered by *hide* and *ignore*." msgstr "" -#: ../../library/filecmp.rst:130 +#: ../../library/filecmp.rst:135 msgid "Files and subdirectories in both *a* and *b*." msgstr "" -#: ../../library/filecmp.rst:135 +#: ../../library/filecmp.rst:140 msgid "Files and subdirectories only in *a*." msgstr "" -#: ../../library/filecmp.rst:140 +#: ../../library/filecmp.rst:145 msgid "Files and subdirectories only in *b*." msgstr "" -#: ../../library/filecmp.rst:145 +#: ../../library/filecmp.rst:150 msgid "Subdirectories in both *a* and *b*." msgstr "" -#: ../../library/filecmp.rst:150 +#: ../../library/filecmp.rst:155 msgid "Files in both *a* and *b*." msgstr "" -#: ../../library/filecmp.rst:155 +#: ../../library/filecmp.rst:160 msgid "" "Names in both *a* and *b*, such that the type differs between the " "directories, or names for which :func:`os.stat` reports an error." msgstr "" -#: ../../library/filecmp.rst:161 +#: ../../library/filecmp.rst:166 msgid "" "Files which are identical in both *a* and *b*, using the class's file " "comparison operator." msgstr "" -#: ../../library/filecmp.rst:167 +#: ../../library/filecmp.rst:172 msgid "" "Files which are in both *a* and *b*, whose contents differ according to the " "class's file comparison operator." msgstr "" -#: ../../library/filecmp.rst:173 +#: ../../library/filecmp.rst:178 msgid "Files which are in both *a* and *b*, but could not be compared." msgstr "" -#: ../../library/filecmp.rst:178 +#: ../../library/filecmp.rst:183 msgid "" "A dictionary mapping names in :attr:`common_dirs` to :class:`dircmp` " "instances (or MyDirCmp instances if this instance is of type MyDirCmp, a " "subclass of :class:`dircmp`)." msgstr "" -#: ../../library/filecmp.rst:182 +#: ../../library/filecmp.rst:187 msgid "" "Previously entries were always :class:`dircmp` instances. Now entries are " "the same type as *self*, if *self* is a subclass of :class:`dircmp`." msgstr "" -#: ../../library/filecmp.rst:191 +#: ../../library/filecmp.rst:196 msgid "List of directories ignored by :class:`dircmp` by default." msgstr "" -#: ../../library/filecmp.rst:194 +#: ../../library/filecmp.rst:199 msgid "" "Here is a simplified example of using the ``subdirs`` attribute to search " "recursively through two directories to show common different files::" msgstr "" -#: ../../library/filecmp.rst:197 +#: ../../library/filecmp.rst:202 msgid "" ">>> from filecmp import dircmp\n" ">>> def print_diff_files(dcmp):\n" diff --git a/library/fractions.po b/library/fractions.po index 91b33f2a86..0bed2f807a 100644 --- a/library/fractions.po +++ b/library/fractions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2016-01-31 07:18+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -168,73 +168,79 @@ msgid "" "``\"G\"`` and ``\"%\"\"``." msgstr "" -#: ../../library/fractions.rst:111 -msgid "Numerator of the Fraction in lowest term." +#: ../../library/fractions.rst:109 +msgid "" +"Formatting of :class:`Fraction` instances without a presentation type now " +"supports fill, alignment, sign handling, minimum width and grouping." msgstr "" #: ../../library/fractions.rst:115 +msgid "Numerator of the Fraction in lowest term." +msgstr "" + +#: ../../library/fractions.rst:119 msgid "Denominator of the Fraction in lowest term." msgstr "" -#: ../../library/fractions.rst:120 +#: ../../library/fractions.rst:124 msgid "" "Return a tuple of two integers, whose ratio is equal to the original " "Fraction. The ratio is in lowest terms and has a positive denominator." msgstr "" -#: ../../library/fractions.rst:128 +#: ../../library/fractions.rst:132 msgid "Return ``True`` if the Fraction is an integer." msgstr "" -#: ../../library/fractions.rst:134 +#: ../../library/fractions.rst:138 msgid "" "Alternative constructor which only accepts instances of :class:`float` or :" "class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is not " "the same value as ``Fraction(3, 10)``." msgstr "" -#: ../../library/fractions.rst:140 +#: ../../library/fractions.rst:144 msgid "" "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " "directly from a :class:`float`." msgstr "" -#: ../../library/fractions.rst:146 +#: ../../library/fractions.rst:150 msgid "" "Alternative constructor which only accepts instances of :class:`decimal." "Decimal` or :class:`numbers.Integral`." msgstr "" -#: ../../library/fractions.rst:151 +#: ../../library/fractions.rst:155 msgid "" "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " "directly from a :class:`decimal.Decimal` instance." msgstr "" -#: ../../library/fractions.rst:158 +#: ../../library/fractions.rst:162 msgid "" "Finds and returns the closest :class:`Fraction` to ``self`` that has " "denominator at most max_denominator. This method is useful for finding " "rational approximations to a given floating-point number:" msgstr "" -#: ../../library/fractions.rst:166 +#: ../../library/fractions.rst:170 msgid "or for recovering a rational number that's represented as a float:" msgstr "" -#: ../../library/fractions.rst:179 +#: ../../library/fractions.rst:183 msgid "" "Returns the greatest :class:`int` ``<= self``. This method can also be " "accessed through the :func:`math.floor` function:" msgstr "" -#: ../../library/fractions.rst:189 +#: ../../library/fractions.rst:193 msgid "" "Returns the least :class:`int` ``>= self``. This method can also be " "accessed through the :func:`math.ceil` function." msgstr "" -#: ../../library/fractions.rst:196 +#: ../../library/fractions.rst:200 msgid "" "The first version returns the nearest :class:`int` to ``self``, rounding " "half to even. The second version rounds ``self`` to the nearest multiple of " @@ -243,24 +249,49 @@ msgid "" "func:`round` function." msgstr "" -#: ../../library/fractions.rst:204 +#: ../../library/fractions.rst:208 msgid "" -"Provides support for float-style formatting of :class:`Fraction` instances " -"via the :meth:`str.format` method, the :func:`format` built-in function, or :" -"ref:`Formatted string literals `. The presentation types " -"``\"e\"``, ``\"E\"``, ``\"f\"``, ``\"F\"``, ``\"g\"``, ``\"G\"`` and ``\"%" -"\"`` are supported. For these presentation types, formatting for a :class:" -"`Fraction` object ``x`` follows the rules outlined for the :class:`float` " -"type in the :ref:`formatspec` section." +"Provides support for formatting of :class:`Fraction` instances via the :meth:" +"`str.format` method, the :func:`format` built-in function, or :ref:" +"`Formatted string literals `." msgstr "" #: ../../library/fractions.rst:212 +msgid "" +"If the ``format_spec`` format specification string does not end with one of " +"the presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` " +"or ``'%'`` then formatting follows the general rules for fill, alignment, " +"sign handling, minimum width, and grouping as described in the :ref:`format " +"specification mini-language `. The \"alternate form\" flag " +"``'#'`` is supported: if present, it forces the output string to always " +"include an explicit denominator, even when the value being formatted is an " +"exact integer. The zero-fill flag ``'0'`` is not supported." +msgstr "" + +#: ../../library/fractions.rst:222 +msgid "" +"If the ``format_spec`` format specification string ends with one of the " +"presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` or " +"``'%'`` then formatting follows the rules outlined for the :class:`float` " +"type in the :ref:`formatspec` section." +msgstr "" + +#: ../../library/fractions.rst:227 msgid "Here are some examples::" msgstr "" -#: ../../library/fractions.rst:214 +#: ../../library/fractions.rst:229 +#, fuzzy msgid "" ">>> from fractions import Fraction\n" +">>> format(Fraction(103993, 33102), '_')\n" +"'103_993/33_102'\n" +">>> format(Fraction(1, 7), '.^+10')\n" +"'...+1/7...'\n" +">>> format(Fraction(3, 1), '')\n" +"'3'\n" +">>> format(Fraction(3, 1), '#')\n" +"'3/1'\n" ">>> format(Fraction(1, 7), '.40g')\n" "'0.1428571428571428571428571428571428571429'\n" ">>> format(Fraction('1234567.855'), '_.2f')\n" @@ -282,10 +313,10 @@ msgstr "" ">>> \"{:.2%} price increase\".format(Fraction(new_price, old_price) - 1)\n" "'34.67% price increase'" -#: ../../library/fractions.rst:228 +#: ../../library/fractions.rst:251 msgid "Module :mod:`numbers`" msgstr ":mod:`numbers` 模組" -#: ../../library/fractions.rst:229 +#: ../../library/fractions.rst:252 msgid "The abstract base classes making up the numeric tower." msgstr "" diff --git a/library/ftplib.po b/library/ftplib.po index cc4d59a8b2..b0dac40c3a 100644 --- a/library/ftplib.po +++ b/library/ftplib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-04-26 19:44+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -46,14 +46,14 @@ msgid "The default encoding is UTF-8, following :rfc:`2640`." msgstr "預設編碼是 UTF-8,遵循 :rfc:`2640`。" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr ":ref:`Availability `:非 Emscripten、非 WASI。" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`Availability `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上不起作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/functions.po b/library/functions.po index a330e5f3a0..1ac9b3f1e4 100644 --- a/library/functions.po +++ b/library/functions.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-05-06 17:06+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -514,8 +514,8 @@ msgid "" "ways." msgstr "如果不一定需要 \"0b\" 前綴,還可以使用如下的方法。" -#: ../../library/functions.rst:141 ../../library/functions.rst:909 -#: ../../library/functions.rst:1246 +#: ../../library/functions.rst:141 ../../library/functions.rst:929 +#: ../../library/functions.rst:1308 msgid "See also :func:`format` for more information." msgstr "可參考 :func:`format` 獲取更多資訊。" @@ -535,7 +535,7 @@ msgstr "" "(參見 :ref:`typesnumeric`),其他 class 不能繼承自它。它只有 ``False`` 和 " "``True`` 兩個實例(參見 :ref:`typebool`)。" -#: ../../library/functions.rst:156 ../../library/functions.rst:774 +#: ../../library/functions.rst:156 ../../library/functions.rst:794 msgid "The parameter is now positional-only." msgstr "現在為僅限位置參數。" @@ -931,8 +931,8 @@ msgid "" "number from real and imaginary parts." msgstr "" -#: ../../library/functions.rst:382 ../../library/functions.rst:719 -#: ../../library/functions.rst:965 +#: ../../library/functions.rst:382 ../../library/functions.rst:739 +#: ../../library/functions.rst:985 msgid "Examples:" msgstr "例如: ::" @@ -1021,8 +1021,8 @@ msgstr "" msgid "The complex type is described in :ref:`typesnumeric`." msgstr "複數型別在 :ref:`typesnumeric` 中有相關描述。" -#: ../../library/functions.rst:445 ../../library/functions.rst:771 -#: ../../library/functions.rst:1014 +#: ../../library/functions.rst:445 ../../library/functions.rst:791 +#: ../../library/functions.rst:1034 msgid "Grouping digits with underscores as in code literals is allowed." msgstr "可以使用底線將程式碼文字中的數字進行分組。" @@ -1228,20 +1228,23 @@ msgid "Syntax errors are reported as exceptions." msgstr "" #: ../../library/functions.rst:589 +#, fuzzy msgid "" "The *expression* argument is parsed and evaluated as a Python expression " "(technically speaking, a condition list) using the *globals* and *locals* " -"dictionaries as global and local namespace. If the *globals* dictionary is " +"mappings as global and local namespace. If the *globals* dictionary is " "present and does not contain a value for the key ``__builtins__``, a " "reference to the dictionary of the built-in module :mod:`builtins` is " "inserted under that key before *expression* is parsed. That way you can " "control what builtins are available to the executed code by inserting your " "own ``__builtins__`` dictionary into *globals* before passing it to :func:" -"`eval`. If the *locals* dictionary is omitted it defaults to the *globals* " -"dictionary. If both dictionaries are omitted, the expression is executed " -"with the *globals* and *locals* in the environment where :func:`eval` is " -"called. Note, *eval()* does not have access to the :term:`nested scopes " -"` (non-locals) in the enclosing environment." +"`eval`. If the *locals* mapping is omitted it defaults to the *globals* " +"dictionary. If both mappings are omitted, the expression is executed with " +"the *globals* and *locals* in the environment where :func:`eval` is called. " +"Note, *eval()* will only have access to the :term:`nested scopes ` (non-locals) in the enclosing environment if they are already " +"referenced in the scope that is calling :func:`eval` (e.g. via a :keyword:" +"`nonlocal` statement)." msgstr "" "*expression* 引數會被視為一條 Python 運算式(技術上而言,是條件列表)來剖析及" "求值,而 *globals* 和 *locals* dictionaries 分別用作全域和區域命名空間。如果 " @@ -1253,11 +1256,11 @@ msgstr "" "func:`eval` 被呼叫的環境中執行運算式。請注意,*eval()* 在封閉 (enclosing) 環" "境中無法存取\\ :term:`巢狀作用域 ` (non-locals)。" -#: ../../library/functions.rst:604 +#: ../../library/functions.rst:605 msgid "Example:" msgstr "範例:" -#: ../../library/functions.rst:610 +#: ../../library/functions.rst:611 msgid "" "This function can also be used to execute arbitrary code objects (such as " "those created by :func:`compile`). In this case, pass a code object instead " @@ -1268,7 +1271,7 @@ msgstr "" "情況下,傳入的引數是程式碼物件而不是字串。如果編譯該物件時的 *mode* 引數是 " "``'exec'``,那麼 :func:`eval` 回傳值為 ``None``。" -#: ../../library/functions.rst:615 +#: ../../library/functions.rst:616 msgid "" "Hints: dynamic execution of statements is supported by the :func:`exec` " "function. The :func:`globals` and :func:`locals` functions return the " @@ -1279,13 +1282,13 @@ msgstr "" "函式分別回傳當前的全域性和局部性 dictionary,它們對於將引數傳遞給 :func:" "`eval` 或 :func:`exec` 可能會方便許多。" -#: ../../library/functions.rst:620 +#: ../../library/functions.rst:621 msgid "" "If the given source is a string, then leading and trailing spaces and tabs " "are stripped." msgstr "如果給定來源是一個字串,那麼其前後的空格和定位字元會被移除。" -#: ../../library/functions.rst:623 +#: ../../library/functions.rst:624 msgid "" "See :func:`ast.literal_eval` for a function that can safely evaluate strings " "with expressions containing only literals." @@ -1293,8 +1296,8 @@ msgstr "" "另外可以參閱 :func:`ast.literal_eval`,該函式可以安全執行僅包含文字的運算式字" "串。" -#: ../../library/functions.rst:626 ../../library/functions.rst:628 -#: ../../library/functions.rst:671 ../../library/functions.rst:673 +#: ../../library/functions.rst:627 ../../library/functions.rst:629 +#: ../../library/functions.rst:683 ../../library/functions.rst:685 msgid "" "Raises an :ref:`auditing event ` ``exec`` with the code object as " "the argument. Code compilation events may also be raised." @@ -1302,9 +1305,20 @@ msgstr "" "引發一個附帶程式碼物件為引數的\\ :ref:`稽核事件 ` ``exec``。也可能" "會引發程式碼編譯事件。" -#: ../../library/functions.rst:635 +#: ../../library/functions.rst:634 ../../library/functions.rst:705 +msgid "The *globals* and *locals* arguments can now be passed as keywords." +msgstr "" + +#: ../../library/functions.rst:638 ../../library/functions.rst:709 +msgid "" +"The semantics of the default *locals* namespace have been adjusted as " +"described for the :func:`locals` builtin." +msgstr "" + +#: ../../library/functions.rst:645 +#, fuzzy msgid "" -"This function supports dynamic execution of Python code. *object* must be " +"This function supports dynamic execution of Python code. *source* must be " "either a string or a code object. If it is a string, the string is parsed " "as a suite of Python statements which is then executed (unless a syntax " "error occurs). [#]_ If it is a code object, it is simply executed. In all " @@ -1322,7 +1336,7 @@ msgstr "" "`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在函式之外使" "用。該函式回傳值是 ``None``。" -#: ../../library/functions.rst:646 +#: ../../library/functions.rst:656 #, fuzzy msgid "" "In all cases, if the optional parts are omitted, the code is executed in the " @@ -1339,16 +1353,16 @@ msgstr "" "供了 *locals* 引數,則它可以是任何映射物件。請記住在 module 層級中全域性和本" "地變數是相同的 dictionary。" -#: ../../library/functions.rst:656 +#: ../../library/functions.rst:666 msgid "" -"Most users should just pass a *globals* argument and never *locals*. If exec " -"gets two separate objects as *globals* and *locals*, the code will be " -"executed as if it were embedded in a class definition." +"When ``exec`` gets two separate objects as *globals* and *locals*, the code " +"will be executed as if it were embedded in a class definition. This means " +"functions and classes defined in the executed code will not be able to " +"access variables assigned at the top level (as the \"top level\" variables " +"are treated as class variables in a class definition)." msgstr "" -"大部分使用者只需要傳入 *globals* 引數,而不用傳遞 *locals*。如果 exec 有兩個" -"不同的 *globals* 和 *locals* 物件,程式碼就像嵌入在 class 定義中一樣執行。" -#: ../../library/functions.rst:660 +#: ../../library/functions.rst:672 msgid "" "If the *globals* dictionary does not contain a value for the key " "``__builtins__``, a reference to the dictionary of the built-in module :mod:" @@ -1361,7 +1375,7 @@ msgstr "" "dictionary 傳入 :func:`exec` 之前,你可以透過將它插入 *globals* 來控制你需要" "哪些內建函式來執行程式碼。" -#: ../../library/functions.rst:666 +#: ../../library/functions.rst:678 msgid "" "The *closure* argument specifies a closure--a tuple of cellvars. It's only " "valid when the *object* is a code object containing free variables. The " @@ -1372,19 +1386,20 @@ msgstr "" "只有在 *object* 是一個含有自由變數 (free variable) 的程式碼物件時,它才有效。" "Tuple 的長度必須與程式碼物件所引用的自由變數數量完全匹配。" -#: ../../library/functions.rst:678 +#: ../../library/functions.rst:690 +#, fuzzy msgid "" "The built-in functions :func:`globals` and :func:`locals` return the current " -"global and local dictionary, respectively, which may be useful to pass " -"around for use as the second and third argument to :func:`exec`." +"global and local namespace, respectively, which may be useful to pass around " +"for use as the second and third argument to :func:`exec`." msgstr "" "內建 :func:`globals` 和 :func:`locals` 函式各自回傳當前的全域性和本地 " "dictionary,因此可以將它們傳遞給 :func:`exec` 的第二個和第三個引數。" -#: ../../library/functions.rst:684 +#: ../../library/functions.rst:696 +#, fuzzy msgid "" -"The default *locals* act as described for function :func:`locals` below: " -"modifications to the default *locals* dictionary should not be attempted. " +"The default *locals* act as described for function :func:`locals` below. " "Pass an explicit *locals* dictionary if you need to see effects of the code " "on *locals* after function :func:`exec` returns." msgstr "" @@ -1392,11 +1407,11 @@ msgstr "" "預設的 *locals* dictionary。如果你想在 :func:`exec` 函式回傳時知道程式碼對 " "*locals* 的變動,請明確地傳遞 *locals* dictionary 。" -#: ../../library/functions.rst:689 +#: ../../library/functions.rst:700 msgid "Added the *closure* parameter." msgstr "增加了 *closure* 參數。" -#: ../../library/functions.rst:695 +#: ../../library/functions.rst:715 msgid "" "Construct an iterator from those elements of *iterable* for which *function* " "is true. *iterable* may be either a sequence, a container which supports " @@ -1408,7 +1423,7 @@ msgstr "" "*function* 是 ``None``,則會假設它是一個識別性函式,即 *iterable* 中所有假值" "元素會被移除。" -#: ../../library/functions.rst:701 +#: ../../library/functions.rst:721 msgid "" "Note that ``filter(function, iterable)`` is equivalent to the generator " "expression ``(item for item in iterable if function(item))`` if function is " @@ -1419,7 +1434,7 @@ msgstr "" "是 ``None`` 的時候為 ``(item for item in iterable if function(item))``;" "function 是 ``None`` 的時候為 ``(item for item in iterable if item)``。" -#: ../../library/functions.rst:706 +#: ../../library/functions.rst:726 msgid "" "See :func:`itertools.filterfalse` for the complementary function that " "returns elements of *iterable* for which *function* is false." @@ -1427,11 +1442,11 @@ msgstr "" "請參閱 :func:`itertools.filterfalse`,只有 *function* 為 false 時才選取 " "*iterable* 中元素的互補函式。" -#: ../../library/functions.rst:717 +#: ../../library/functions.rst:737 msgid "Return a floating-point number constructed from a number or a string." msgstr "回傳從數字或字串生成的浮點數。" -#: ../../library/functions.rst:721 +#: ../../library/functions.rst:741 msgid "" ">>> float('+1.23')\n" "1.23\n" @@ -1455,7 +1470,7 @@ msgstr "" ">>> float('-Infinity')\n" "-inf" -#: ../../library/functions.rst:734 +#: ../../library/functions.rst:754 msgid "" "If the argument is a string, it should contain a decimal number, optionally " "preceded by a sign, and optionally embedded in whitespace. The optional " @@ -1470,7 +1485,7 @@ msgstr "" "數也可以是 NaN(非數字)或正負無窮大的字串。確切地說,除去首尾的空格後,輸入" "必須遵循以下語法中 :token:`~float:floatvalue` 的生成規則:" -#: ../../library/functions.rst:755 +#: ../../library/functions.rst:775 msgid "" "Case is not significant, so, for example, \"inf\", \"Inf\", \"INFINITY\", " "and \"iNfINity\" are all acceptable spellings for positive infinity." @@ -1478,7 +1493,7 @@ msgstr "" "字母大小寫不影響,例如,\"inf\"、\"Inf\"、\"INFINITY\"、\"iNfINity\" 都可以表" "示正無窮大。" -#: ../../library/functions.rst:758 +#: ../../library/functions.rst:778 msgid "" "Otherwise, if the argument is an integer or a floating-point number, a " "floating-point number with the same value (within Python's floating-point " @@ -1488,7 +1503,7 @@ msgstr "" "否則,如果引數是整數或浮點數,則回傳具有相同值(在 Python 浮點精度範圍內)的" "浮點數。如果引數在 Python 浮點精度範圍外,則會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:763 +#: ../../library/functions.rst:783 msgid "" "For a general Python object ``x``, ``float(x)`` delegates to ``x." "__float__()``. If :meth:`~object.__float__` is not defined then it falls " @@ -1497,22 +1512,22 @@ msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 會委派給 ``x.__float__()``。如果未" "定義 :meth:`~object.__float__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:767 +#: ../../library/functions.rst:787 msgid "If no argument is given, ``0.0`` is returned." msgstr "如果沒有引數,則回傳 ``0.0``。" -#: ../../library/functions.rst:769 +#: ../../library/functions.rst:789 msgid "The float type is described in :ref:`typesnumeric`." msgstr ":ref:`typesnumeric` 描述了浮點數型別。" -#: ../../library/functions.rst:777 +#: ../../library/functions.rst:797 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not " "defined." msgstr "" "如果 :meth:`~object.__float__` 未定義,則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:787 +#: ../../library/functions.rst:807 msgid "" "Convert a *value* to a \"formatted\" representation, as controlled by " "*format_spec*. The interpretation of *format_spec* will depend on the type " @@ -1523,7 +1538,7 @@ msgstr "" "取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語法::ref:" "`formatspec`。" -#: ../../library/functions.rst:792 +#: ../../library/functions.rst:812 msgid "" "The default *format_spec* is an empty string which usually gives the same " "effect as calling :func:`str(value) `." @@ -1531,7 +1546,7 @@ msgstr "" "預設的 *format_spec* 是一個空字串,它通常和呼叫 :func:`str(value) ` 的效" "果相同。" -#: ../../library/functions.rst:795 +#: ../../library/functions.rst:815 msgid "" "A call to ``format(value, format_spec)`` is translated to ``type(value)." "__format__(value, format_spec)`` which bypasses the instance dictionary when " @@ -1545,7 +1560,7 @@ msgstr "" "實例中的字典。如果搜尋到 :mod:`object` 這個 method 但 *format_spec* 不為空," "或是 *format_spec* 或回傳值不是字串,則會引發 :exc:`TypeError`。" -#: ../../library/functions.rst:802 +#: ../../library/functions.rst:822 msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." @@ -1553,7 +1568,7 @@ msgstr "" "當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:811 +#: ../../library/functions.rst:831 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " "*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" @@ -1563,7 +1578,7 @@ msgstr "" "``frozenset`` 是一個內建的 class。有關此 class 的文件,請參閱 :class:" "`frozenset` 和 :ref:`types-set`。" -#: ../../library/functions.rst:815 +#: ../../library/functions.rst:835 msgid "" "For other containers see the built-in :class:`set`, :class:`list`, :class:" "`tuple`, and :class:`dict` classes, as well as the :mod:`collections` module." @@ -1571,7 +1586,7 @@ msgstr "" "請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` " "class,以及 :mod:`collections` module 來了解其它的容器。" -#: ../../library/functions.rst:823 +#: ../../library/functions.rst:843 msgid "" "Return the value of the named attribute of *object*. *name* must be a " "string. If the string is the name of one of the object's attributes, the " @@ -1586,7 +1601,7 @@ msgstr "" "`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:" "`setattr`)。" -#: ../../library/functions.rst:832 +#: ../../library/functions.rst:852 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " @@ -1597,7 +1612,7 @@ msgstr "" "發生在編譯期,因此你必須手動改編私有屬性(有兩個前導底線的屬性)的名稱,才能" "使用 :func:`getattr` 來取得它。" -#: ../../library/functions.rst:840 +#: ../../library/functions.rst:860 msgid "" "Return the dictionary implementing the current module namespace. For code " "within functions, this is set when the function is defined and remains the " @@ -1606,7 +1621,7 @@ msgstr "" "回傳代表當前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義" "函式時設定且不論該函式是在何處呼叫都會保持相同。" -#: ../../library/functions.rst:847 +#: ../../library/functions.rst:867 msgid "" "The arguments are an object and a string. The result is ``True`` if the " "string is the name of one of the object's attributes, ``False`` if not. " @@ -1617,7 +1632,7 @@ msgstr "" "則回傳 ``False``。(此功能是透過呼叫 ``getattr(object, name)`` 並檢查是否引" "發 :exc:`AttributeError` 來實作的。)" -#: ../../library/functions.rst:855 +#: ../../library/functions.rst:875 msgid "" "Return the hash value of the object (if it has one). Hash values are " "integers. They are used to quickly compare dictionary keys during a " @@ -1628,7 +1643,7 @@ msgstr "" "時用來快速比較 dictionary 的鍵。相同大小的數字數值有相同的雜湊值(即使它們型" "別不同,如 1 和 1.0)。" -#: ../../library/functions.rst:862 +#: ../../library/functions.rst:882 msgid "" "For objects with custom :meth:`~object.__hash__` methods, note that :func:" "`hash` truncates the return value based on the bit width of the host machine." @@ -1636,7 +1651,7 @@ msgstr "" "請注意,如果物件帶有自訂的 :meth:`~object.__hash__` 方法,:func:`hash` 將根據" "運行機器的位元長度來截斷回傳值。" -#: ../../library/functions.rst:869 +#: ../../library/functions.rst:889 msgid "" "Invoke the built-in help system. (This function is intended for interactive " "use.) If no argument is given, the interactive help system starts on the " @@ -1650,7 +1665,7 @@ msgstr "" "關鍵字或說明文件主題中搜索該字串,並在控制台上列印幫助資訊。如果引數是其他任" "意物件,則會生成該物件的幫助頁。" -#: ../../library/functions.rst:876 +#: ../../library/functions.rst:896 msgid "" "Note that if a slash(/) appears in the parameter list of a function when " "invoking :func:`help`, it means that the parameters prior to the slash are " @@ -1661,12 +1676,12 @@ msgstr "" "前面的參數是僅限位置 (positional-only) 參數。有關更多資訊,請參閱\\ :ref:`常" "見問答集中的僅限位置參數條目 `。" -#: ../../library/functions.rst:881 +#: ../../library/functions.rst:901 msgid "" "This function is added to the built-in namespace by the :mod:`site` module." msgstr "此函式會被 :mod:`site` module 加入到內建命名空間。" -#: ../../library/functions.rst:883 +#: ../../library/functions.rst:903 msgid "" "Changes to :mod:`pydoc` and :mod:`inspect` mean that the reported signatures " "for callables are now more comprehensive and consistent." @@ -1674,7 +1689,7 @@ msgstr "" "對於 :mod:`pydoc` 和 :mod:`inspect` 的變更,使得可呼叫物件回報的的簽名 " "(signature) 更加全面和一致。" -#: ../../library/functions.rst:890 +#: ../../library/functions.rst:910 msgid "" "Convert an integer number to a lowercase hexadecimal string prefixed with " "\"0x\". If *x* is not a Python :class:`int` object, it has to define an :" @@ -1684,7 +1699,7 @@ msgstr "" "class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並且回傳一" "個整數。舉例來說:" -#: ../../library/functions.rst:899 +#: ../../library/functions.rst:919 msgid "" "If you want to convert an integer number to an uppercase or lower " "hexadecimal string with prefix or not, you can use either of the following " @@ -1693,20 +1708,20 @@ msgstr "" "如果要將整數轉換為大寫或小寫的十六進位制字串,並可選擇有無 \"0x\" 前綴,則可" "以使用如下方法:" -#: ../../library/functions.rst:911 +#: ../../library/functions.rst:931 msgid "" "See also :func:`int` for converting a hexadecimal string to an integer using " "a base of 16." msgstr "另請參閱 :func:`int` 將十六進位制字串轉換為以 16 為基數的整數。" -#: ../../library/functions.rst:916 +#: ../../library/functions.rst:936 msgid "" "To obtain a hexadecimal string representation for a float, use the :meth:" "`float.hex` method." msgstr "" "如果要獲取浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" -#: ../../library/functions.rst:922 +#: ../../library/functions.rst:942 msgid "" "Return the \"identity\" of an object. This is an integer which is " "guaranteed to be unique and constant for this object during its lifetime. " @@ -1716,18 +1731,18 @@ msgstr "" "回傳物件的 \"識別性\" 。該值是一個整數,在此物件的生命週期中保證是唯一且恆定" "的。兩個生命期不重疊的物件可能具有相同的 :func:`id` 值。" -#: ../../library/functions.rst:927 +#: ../../library/functions.rst:947 msgid "This is the address of the object in memory." msgstr "這是該物件在記憶體中的位址。" -#: ../../library/functions.rst:929 +#: ../../library/functions.rst:949 msgid "" "Raises an :ref:`auditing event ` ``builtins.id`` with argument " "``id``." msgstr "" "引發一個附帶引數 ``id`` 的\\ :ref:`稽核事件 ` ``builtins.id``。" -#: ../../library/functions.rst:935 +#: ../../library/functions.rst:955 msgid "" "If the *prompt* argument is present, it is written to standard output " "without a trailing newline. The function then reads a line from input, " @@ -1738,7 +1753,7 @@ msgstr "" "從輸入中讀取一行,將其轉換為字串(去除末尾的換行符)並回傳。當讀取到 EOF 時," "則引發 :exc:`EOFError`。例如: ::" -#: ../../library/functions.rst:940 +#: ../../library/functions.rst:960 msgid "" ">>> s = input('--> ') \n" "--> Monty Python's Flying Circus\n" @@ -1750,7 +1765,7 @@ msgstr "" ">>> s \n" "\"Monty Python's Flying Circus\"" -#: ../../library/functions.rst:945 +#: ../../library/functions.rst:965 msgid "" "If the :mod:`readline` module was loaded, then :func:`input` will use it to " "provide elaborate line editing and history features." @@ -1758,7 +1773,7 @@ msgstr "" "如果載入了 :mod:`readline` module,:func:`input` 將使用它來提供複雜的行編輯和" "歷史記錄功能。" -#: ../../library/functions.rst:948 ../../library/functions.rst:950 +#: ../../library/functions.rst:968 ../../library/functions.rst:970 msgid "" "Raises an :ref:`auditing event ` ``builtins.input`` with argument " "``prompt`` before reading input" @@ -1766,7 +1781,7 @@ msgstr "" "引發一個附帶讀取輸入前的引數 ``prompt`` 的\\ :ref:`稽核事件 ` " "``builtins.input``。" -#: ../../library/functions.rst:953 ../../library/functions.rst:955 +#: ../../library/functions.rst:973 ../../library/functions.rst:975 msgid "" "Raises an :ref:`auditing event ` ``builtins.input/result`` with " "the result after successfully reading input." @@ -1774,13 +1789,13 @@ msgstr "" "引發一個附帶成功讀取結果的\\ :ref:`稽核事件 ` ``builtins.input/" "result``。" -#: ../../library/functions.rst:962 +#: ../../library/functions.rst:982 msgid "" "Return an integer object constructed from a number or a string, or return " "``0`` if no arguments are given." msgstr "" -#: ../../library/functions.rst:967 +#: ../../library/functions.rst:987 msgid "" ">>> int(123.45)\n" "123\n" @@ -1808,7 +1823,7 @@ msgstr "" ">>> int('01110011', base=2)\n" "115" -#: ../../library/functions.rst:982 +#: ../../library/functions.rst:1002 msgid "" "If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x." "__int__()``. If the argument defines :meth:`~object.__index__`, it returns " @@ -1821,7 +1836,7 @@ msgstr "" "義了 :meth:`~object.__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數,則會向零" "的方向無條件捨去。" -#: ../../library/functions.rst:988 +#: ../../library/functions.rst:1008 msgid "" "If the argument is not a number or if *base* is given, then it must be a " "string, :class:`bytes`, or :class:`bytearray` instance representing an " @@ -1834,7 +1849,7 @@ msgstr "" "以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、或在" "數字間有單一底線。" -#: ../../library/functions.rst:994 +#: ../../library/functions.rst:1014 msgid "" "A base-n integer string contains digits, each representing a value from 0 to " "n-1. The values 0--9 can be represented by any Unicode decimal digit. The " @@ -1856,11 +1871,11 @@ msgstr "" "進制中的一個,所以 ``int('010', 0)`` 是非法的,但 ``int('010')`` 和 " "``int('010', 8)`` 是有效的。" -#: ../../library/functions.rst:1005 +#: ../../library/functions.rst:1025 msgid "The integer type is described in :ref:`typesnumeric`." msgstr "整數型別定義請參閱\\ :ref:`typesnumeric`。" -#: ../../library/functions.rst:1007 +#: ../../library/functions.rst:1027 msgid "" "If *base* is not an instance of :class:`int` and the *base* object has a :" "meth:`base.__index__ ` method, that method is called to " @@ -1872,22 +1887,22 @@ msgstr "" "的版本使用 :meth:`base.__int__ ` 而不是 :meth:`base." "__index__ `。" -#: ../../library/functions.rst:1017 +#: ../../library/functions.rst:1037 msgid "The first parameter is now positional-only." msgstr "第一個參數為僅限位置參數。" -#: ../../library/functions.rst:1020 +#: ../../library/functions.rst:1040 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not " "defined." msgstr "" "如果未定義 :meth:`~object.__int__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:1023 +#: ../../library/functions.rst:1043 msgid "The delegation to :meth:`~object.__trunc__` is deprecated." msgstr "對 :meth:`~object.__trunc__` 的委派已棄用。" -#: ../../library/functions.rst:1026 +#: ../../library/functions.rst:1046 msgid "" ":class:`int` string inputs and string representations can be limited to help " "avoid denial of service attacks. A :exc:`ValueError` is raised when the " @@ -1901,7 +1916,7 @@ msgstr "" "`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱\\ :ref:`整" "數字串轉換的長度限制 `\\ 說明文件。" -#: ../../library/functions.rst:1036 +#: ../../library/functions.rst:1056 msgid "" "Return ``True`` if the *object* argument is an instance of the *classinfo* " "argument, or of a (direct, indirect, or :term:`virtual `) of *classinfo*. A class is considered a " @@ -1941,7 +1956,7 @@ msgstr "" "是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:1068 +#: ../../library/functions.rst:1088 msgid "" "Return an :term:`iterator` object. The first argument is interpreted very " "differently depending on the presence of the second argument. Without a " @@ -1965,11 +1980,11 @@ msgstr "" "__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 *sentinel* 則引發 :" "exc:`StopIteration`,否則回傳呼叫結果。" -#: ../../library/functions.rst:1082 +#: ../../library/functions.rst:1102 msgid "See also :ref:`typeiter`." msgstr "另請參閱 :ref:`typeiter`。" -#: ../../library/functions.rst:1084 +#: ../../library/functions.rst:1104 msgid "" "One useful application of the second form of :func:`iter` is to build a " "block-reader. For example, reading fixed-width blocks from a binary database " @@ -1978,7 +1993,7 @@ msgstr "" ":func:`iter` 的第二種形式有一個好用的應用,是能夠建立一個區塊閱讀器 (block-" "reader)。例如,從二進位資料庫檔案中讀取固定寬度的區塊,直到檔案的結尾: ::" -#: ../../library/functions.rst:1088 +#: ../../library/functions.rst:1108 msgid "" "from functools import partial\n" "with open('mydata.db', 'rb') as f:\n" @@ -1990,7 +2005,7 @@ msgstr "" " for block in iter(partial(f.read, 64), b''):\n" " process_block(block)" -#: ../../library/functions.rst:1096 +#: ../../library/functions.rst:1116 msgid "" "Return the length (the number of items) of an object. The argument may be a " "sequence (such as a string, bytes, tuple, list, or range) or a collection " @@ -1999,7 +2014,7 @@ msgstr "" "回傳物件的長度(元素個數)。引數可以是序列(如 string、bytes、tuple、list 或 " "range)或集合(如 dictionary、set 或 frozen set)。" -#: ../../library/functions.rst:1102 +#: ../../library/functions.rst:1122 msgid "" "``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." "maxsize`, such as :class:`range(2 ** 100) `." @@ -2007,7 +2022,7 @@ msgstr "" "如果物件長度大於 :data:`sys.maxsize`,像是 :class:`range(2 ** 100) `," "則 ``len`` 會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:1111 +#: ../../library/functions.rst:1131 msgid "" "Rather than being a function, :class:`list` is actually a mutable sequence " "type, as documented in :ref:`typesseq-list` and :ref:`typesseq`." @@ -2015,26 +2030,85 @@ msgstr "" "除了是函式,:class:`list` 也是可變序列型別,詳情請參閱 :ref:`typesseq-list` " "和 :ref:`typesseq`。" -#: ../../library/functions.rst:1117 +#: ../../library/functions.rst:1137 msgid "" -"Update and return a dictionary representing the current local symbol table. " -"Free variables are returned by :func:`locals` when it is called in function " -"blocks, but not in class blocks. Note that at the module level, :func:" -"`locals` and :func:`globals` are the same dictionary." +"Return a mapping object representing the current local symbol table, with " +"variable names as the keys, and their currently bound references as the " +"values." msgstr "" -"更新並回傳表示當前本地符號表的 dictionary。在函式區塊而不是 class 區塊中呼" -"叫 :func:`locals` 時會回傳自由變數。請注意,在 module 階層中,:func:`locals` " -"和 :func:`globals` 是相同的 dictionary。" -#: ../../library/functions.rst:1123 +#: ../../library/functions.rst:1141 msgid "" -"The contents of this dictionary should not be modified; changes may not " -"affect the values of local and free variables used by the interpreter." +"At module scope, as well as when using :func:`exec` or :func:`eval` with a " +"single namespace, this function returns the same namespace as :func:" +"`globals`." msgstr "" -"此 dictionary 的內容不應該被更動;更改可能不會影響直譯器使用的本地變數或自由" -"變數的值。" -#: ../../library/functions.rst:1128 +#: ../../library/functions.rst:1145 +msgid "" +"At class scope, it returns the namespace that will be passed to the " +"metaclass constructor." +msgstr "" + +#: ../../library/functions.rst:1148 +msgid "" +"When using ``exec()`` or ``eval()`` with separate local and global " +"arguments, it returns the local namespace passed in to the function call." +msgstr "" + +#: ../../library/functions.rst:1151 +msgid "" +"In all of the above cases, each call to ``locals()`` in a given frame of " +"execution will return the *same* mapping object. Changes made through the " +"mapping object returned from ``locals()`` will be visible as assigned, " +"reassigned, or deleted local variables, and assigning, reassigning, or " +"deleting local variables will immediately affect the contents of the " +"returned mapping object." +msgstr "" + +#: ../../library/functions.rst:1158 +msgid "" +"In an :term:`optimized scope` (including functions, generators, and " +"coroutines), each call to ``locals()`` instead returns a fresh dictionary " +"containing the current bindings of the function's local variables and any " +"nonlocal cell references. In this case, name binding changes made via the " +"returned dict are *not* written back to the corresponding local variables or " +"nonlocal cell references, and assigning, reassigning, or deleting local " +"variables and nonlocal cell references does *not* affect the contents of " +"previously returned dictionaries." +msgstr "" + +#: ../../library/functions.rst:1167 +msgid "" +"Calling ``locals()`` as part of a comprehension in a function, generator, or " +"coroutine is equivalent to calling it in the containing scope, except that " +"the comprehension's initialised iteration variables will be included. In " +"other scopes, it behaves as if the comprehension were running as a nested " +"function." +msgstr "" + +#: ../../library/functions.rst:1173 +msgid "" +"Calling ``locals()`` as part of a generator expression is equivalent to " +"calling it in a nested generator function." +msgstr "" + +#: ../../library/functions.rst:1176 +msgid "" +"The behaviour of ``locals()`` in a comprehension has been updated as " +"described in :pep:`709`." +msgstr "" + +#: ../../library/functions.rst:1180 +msgid "" +"As part of :pep:`667`, the semantics of mutating the mapping objects " +"returned from this function are now defined. The behavior in :term:" +"`optimized scopes ` is now as described above. Aside from " +"being defined, the behaviour in other scopes remains unchanged from previous " +"versions." +msgstr "" + +#: ../../library/functions.rst:1190 msgid "" "Return an iterator that applies *function* to every item of *iterable*, " "yielding the results. If additional *iterables* arguments are passed, " @@ -2049,13 +2123,13 @@ msgstr "" "iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經被編排為引數的 tuple," "請參閱 :func:`itertools.starmap`。" -#: ../../library/functions.rst:1140 +#: ../../library/functions.rst:1202 msgid "" "Return the largest item in an iterable or the largest of two or more " "arguments." msgstr "回傳 iterable 中最大的元素,或者回傳兩個以上的引數中最大的。" -#: ../../library/functions.rst:1143 +#: ../../library/functions.rst:1205 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The largest item in the iterable is returned. If two or more positional " @@ -2064,7 +2138,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是個 :term:`iterable`,iterable 中最大的元素" "會被回傳。如果提供了兩個或以上的位置引數,則回傳最大的位置引數。" -#: ../../library/functions.rst:1148 ../../library/functions.rst:1186 +#: ../../library/functions.rst:1210 ../../library/functions.rst:1248 msgid "" "There are two optional keyword-only arguments. The *key* argument specifies " "a one-argument ordering function like that used for :meth:`list.sort`. The " @@ -2077,7 +2151,7 @@ msgstr "" "的物件。如果 iterable 為空,並且沒有提供 *default*,則會引發 :exc:" "`ValueError`。" -#: ../../library/functions.rst:1154 +#: ../../library/functions.rst:1216 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2088,15 +2162,15 @@ msgstr "" "``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " "iterable, key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1159 ../../library/functions.rst:1197 +#: ../../library/functions.rst:1221 ../../library/functions.rst:1259 msgid "Added the *default* keyword-only parameter." msgstr "新增 *default* 僅限關鍵字參數。" -#: ../../library/functions.rst:1162 ../../library/functions.rst:1200 +#: ../../library/functions.rst:1224 ../../library/functions.rst:1262 msgid "The *key* can be ``None``." msgstr "*key* 可以為 ``None``。" -#: ../../library/functions.rst:1170 +#: ../../library/functions.rst:1232 msgid "" "Return a \"memory view\" object created from the given argument. See :ref:" "`typememoryview` for more information." @@ -2104,13 +2178,13 @@ msgstr "" "回傳由給定的引數所建立之「memory view(記憶體檢視)」物件。有關詳細資訊,請參" "閱\\ :ref:`typememoryview`。" -#: ../../library/functions.rst:1178 +#: ../../library/functions.rst:1240 msgid "" "Return the smallest item in an iterable or the smallest of two or more " "arguments." msgstr "回傳 iterable 中最小的元素,或者回傳兩個以上的引數中最小的。" -#: ../../library/functions.rst:1181 +#: ../../library/functions.rst:1243 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The smallest item in the iterable is returned. If two or more positional " @@ -2119,7 +2193,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是 :term:`iterable`,iterable 中最小的元素會" "被回傳。如果提供了兩個以上的位置引數,則回傳最小的位置引數。" -#: ../../library/functions.rst:1192 +#: ../../library/functions.rst:1254 msgid "" "If multiple items are minimal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2130,7 +2204,7 @@ msgstr "" "``sorted(iterable, key=keyfunc)[0]`` 和 ``heapq.nsmallest(1, iterable, " "key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1207 +#: ../../library/functions.rst:1269 msgid "" "Retrieve the next item from the :term:`iterator` by calling its :meth:" "`~iterator.__next__` method. If *default* is given, it is returned if the " @@ -2140,7 +2214,7 @@ msgstr "" "素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引發 :" "exc:`StopIteration`。" -#: ../../library/functions.rst:1214 +#: ../../library/functions.rst:1276 msgid "" "Return a new featureless object. :class:`object` is a base for all classes. " "It has methods that are common to all instances of Python classes. This " @@ -2149,7 +2223,7 @@ msgstr "" "回傳一個沒有特徵的新物件。:class:`object` 是所有 class 的基礎,它具有所有 " "Python class 實例的通用 method。這個函式不接受任何引數。" -#: ../../library/functions.rst:1220 +#: ../../library/functions.rst:1282 msgid "" ":class:`object` does *not* have a :attr:`~object.__dict__`, so you can't " "assign arbitrary attributes to an instance of the :class:`object` class." @@ -2157,7 +2231,7 @@ msgstr "" "由於 :class:`object` *沒有* :attr:`~object.__dict__`,因此無法將任意屬性賦" "給 :class:`object` class 的實例。" -#: ../../library/functions.rst:1226 +#: ../../library/functions.rst:1288 msgid "" "Convert an integer number to an octal string prefixed with \"0o\". The " "result is a valid Python expression. If *x* is not a Python :class:`int` " @@ -2168,7 +2242,7 @@ msgstr "" "Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" "`~object.__index__` method 回傳一個整數。舉例來說:" -#: ../../library/functions.rst:1236 +#: ../../library/functions.rst:1298 msgid "" "If you want to convert an integer number to an octal string either with the " "prefix \"0o\" or not, you can use either of the following ways." @@ -2176,7 +2250,7 @@ msgstr "" "如果要將整數轉換為八進位制字串,不論是否具備 \"0o\" 前綴,都可以使用下面的方" "法。" -#: ../../library/functions.rst:1253 +#: ../../library/functions.rst:1315 msgid "" "Open *file* and return a corresponding :term:`file object`. If the file " "cannot be opened, an :exc:`OSError` is raised. See :ref:`tut-files` for more " @@ -2186,7 +2260,7 @@ msgstr "" "啟,則引發 :exc:`OSError`。關於使用此函式的更多方法,請參閱\\ :ref:`tut-" "files`。" -#: ../../library/functions.rst:1257 +#: ../../library/functions.rst:1319 msgid "" "*file* is a :term:`path-like object` giving the pathname (absolute or " "relative to the current working directory) of the file to be opened or an " @@ -2199,7 +2273,7 @@ msgstr "" "器 (file descriptor)。(如果有給定檔案描述器,它會隨著回傳的 I/O 物件關閉而關" "閉,除非 *closefd* 被設為 ``False``。)" -#: ../../library/functions.rst:1263 +#: ../../library/functions.rst:1325 msgid "" "*mode* is an optional string that specifies the mode in which the file is " "opened. It defaults to ``'r'`` which means open for reading in text mode. " @@ -2220,71 +2294,71 @@ msgstr "" "getencoding` 來獲取當前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制模" "式且不要指定 *encoding*。)可用的模式有:" -#: ../../library/functions.rst:1280 +#: ../../library/functions.rst:1342 msgid "Character" msgstr "字元" -#: ../../library/functions.rst:1280 +#: ../../library/functions.rst:1342 msgid "Meaning" msgstr "意義" -#: ../../library/functions.rst:1282 +#: ../../library/functions.rst:1344 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/functions.rst:1282 +#: ../../library/functions.rst:1344 msgid "open for reading (default)" msgstr "讀取(預設)" -#: ../../library/functions.rst:1283 +#: ../../library/functions.rst:1345 msgid "``'w'``" msgstr "``'w'``" -#: ../../library/functions.rst:1283 +#: ../../library/functions.rst:1345 msgid "open for writing, truncating the file first" msgstr "寫入,會先清除檔案內容" -#: ../../library/functions.rst:1284 +#: ../../library/functions.rst:1346 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/functions.rst:1284 +#: ../../library/functions.rst:1346 msgid "open for exclusive creation, failing if the file already exists" msgstr "唯一性建立,如果文件已存在則會失敗" -#: ../../library/functions.rst:1285 +#: ../../library/functions.rst:1347 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/functions.rst:1285 +#: ../../library/functions.rst:1347 msgid "open for writing, appending to the end of file if it exists" msgstr "寫入,如果檔案存在則在其末端附加內容" -#: ../../library/functions.rst:1286 +#: ../../library/functions.rst:1348 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/functions.rst:1286 ../../library/functions.rst:1430 +#: ../../library/functions.rst:1348 ../../library/functions.rst:1492 msgid "binary mode" msgstr "二進制模式" -#: ../../library/functions.rst:1287 +#: ../../library/functions.rst:1349 msgid "``'t'``" msgstr "``'t'``" -#: ../../library/functions.rst:1287 +#: ../../library/functions.rst:1349 msgid "text mode (default)" msgstr "文字模式(預設)" -#: ../../library/functions.rst:1288 +#: ../../library/functions.rst:1350 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/functions.rst:1288 +#: ../../library/functions.rst:1350 msgid "open for updating (reading and writing)" msgstr "更新(讀取並寫入)" -#: ../../library/functions.rst:1291 +#: ../../library/functions.rst:1353 msgid "" "The default mode is ``'r'`` (open for reading text, a synonym of ``'rt'``). " "Modes ``'w+'`` and ``'w+b'`` open and truncate the file. Modes ``'r+'`` and " @@ -2294,7 +2368,7 @@ msgstr "" "``'w+b'`` 模式會開啟並清除檔案。``'r+'`` 和 ``'r+b'`` 模式會開啟且保留檔案內" "容。" -#: ../../library/functions.rst:1295 +#: ../../library/functions.rst:1357 msgid "" "As mentioned in the :ref:`io-overview`, Python distinguishes between binary " "and text I/O. Files opened in binary mode (including ``'b'`` in the *mode* " @@ -2310,7 +2384,7 @@ msgstr "" "``'t'``),檔案的內容會以 :class:`str` 回傳,其位元組已經先被解碼,使用的是取" "決於平台的編碼系統或是給定的 *encoding*。" -#: ../../library/functions.rst:1305 +#: ../../library/functions.rst:1367 msgid "" "Python doesn't depend on the underlying operating system's notion of text " "files; all the processing is done by Python itself, and is therefore " @@ -2319,7 +2393,7 @@ msgstr "" "Python 不會使用底層作業系統對於文字檔案的操作概念;所有的處理都是由 Python 獨" "自完成的,因此能獨立於不同平台。" -#: ../../library/functions.rst:1309 +#: ../../library/functions.rst:1371 msgid "" "*buffering* is an optional integer used to set the buffering policy. Pass 0 " "to switch buffering off (only allowed in binary mode), 1 to select line " @@ -2340,7 +2414,7 @@ msgstr "" "``write_through`` 旗標。若未給定 *buffering* 引數,則預設的緩衝策略會運作如" "下:" -#: ../../library/functions.rst:1319 +#: ../../library/functions.rst:1381 msgid "" "Binary files are buffered in fixed-size chunks; the size of the buffer is " "chosen using a heuristic trying to determine the underlying device's \"block " @@ -2352,7 +2426,7 @@ msgstr "" "DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 8192 個位元" "組。" -#: ../../library/functions.rst:1324 +#: ../../library/functions.rst:1386 msgid "" "\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` " "returns ``True``) use line buffering. Other text files use the policy " @@ -2361,7 +2435,7 @@ msgstr "" "「互動式」文字檔(:meth:`~io.IOBase.isatty` 回傳 ``True`` 的檔案)會使用列緩" "衝。其他文字檔則使用上述的二進制檔案緩衝策略。" -#: ../../library/functions.rst:1328 +#: ../../library/functions.rst:1390 msgid "" "*encoding* is the name of the encoding used to decode or encode the file. " "This should only be used in text mode. The default encoding is platform " @@ -2374,7 +2448,7 @@ msgstr "" "Python 支援的任何 :term:`text encoding`\\ (文字編碼)都是可以使用的。關於支" "援的編碼系統清單,請參閱 :mod:`codecs` module。" -#: ../../library/functions.rst:1334 +#: ../../library/functions.rst:1396 msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled—this cannot be used in binary mode. A variety of " @@ -2387,7 +2461,7 @@ msgstr "" "handlers`\\ 有列出清單),不過任何已註冊到 :func:`codecs.register_error` 的錯" "誤處理程式名稱也都是有效的。標準的名稱包括:" -#: ../../library/functions.rst:1342 +#: ../../library/functions.rst:1404 msgid "" "``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding " "error. The default value of ``None`` has the same effect." @@ -2395,20 +2469,20 @@ msgstr "" "``'strict'`` 如果發生編碼錯誤,則引發 :exc:`ValueError` 例外。預設值 " "``None`` 也有相同的效果。" -#: ../../library/functions.rst:1346 +#: ../../library/functions.rst:1408 msgid "" "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to " "data loss." msgstr "``'ignore'`` 忽略錯誤。請注意,忽略編碼錯誤可能導致資料遺失。" -#: ../../library/functions.rst:1349 +#: ../../library/functions.rst:1411 msgid "" "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted " "where there is malformed data." msgstr "" "``'replace'`` 會在格式不正確的資料位置插入一個替換標誌(像是 ``'?'``)。" -#: ../../library/functions.rst:1352 +#: ../../library/functions.rst:1414 msgid "" "``'surrogateescape'`` will represent any incorrect bytes as low surrogate " "code units ranging from U+DC80 to U+DCFF. These surrogate code units will " @@ -2421,7 +2495,7 @@ msgstr "" "被還原回 ``surrogateescape`` 錯誤處理程式當時所處理的那些相同位元組。這對於處" "理未知編碼方式的檔案會很好用。" -#: ../../library/functions.rst:1359 +#: ../../library/functions.rst:1421 msgid "" "``'xmlcharrefreplace'`` is only supported when writing to a file. Characters " "not supported by the encoding are replaced with the appropriate XML " @@ -2430,7 +2504,7 @@ msgstr "" "``'xmlcharrefreplace'`` 僅在寫入檔案時可支援。編碼系統不支援的字元會被替換為" "適當的 XML 字元參考 (character reference) ``&#nnn;``。" -#: ../../library/functions.rst:1363 +#: ../../library/functions.rst:1425 msgid "" "``'backslashreplace'`` replaces malformed data by Python's backslashed " "escape sequences." @@ -2438,7 +2512,7 @@ msgstr "" "``'backslashreplace'`` 會用 Python 的反斜線跳脫序列 (backslashed escape " "sequence) 替換格式不正確的資料。" -#: ../../library/functions.rst:1366 +#: ../../library/functions.rst:1428 msgid "" "``'namereplace'`` (also only supported when writing) replaces unsupported " "characters with ``\\N{...}`` escape sequences." @@ -2446,7 +2520,7 @@ msgstr "" "``'namereplace'``\\ (也僅在寫入時支援)會將不支援的字元替換為 ``\\N{...}`` " "跳脫序列。" -#: ../../library/functions.rst:1374 +#: ../../library/functions.rst:1436 msgid "" "*newline* determines how to parse newline characters from the stream. It can " "be ``None``, ``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as " @@ -2455,7 +2529,7 @@ msgstr "" "*newline* 會決定如何剖析資料串流 (stream) 中的換行字元。它可以是 ``None``、" "``''``、``'\\n'``、``'\\r'`` 或 ``'\\r\\n'``。它的運作規則如下:" -#: ../../library/functions.rst:1378 +#: ../../library/functions.rst:1440 msgid "" "When reading input from the stream, if *newline* is ``None``, universal " "newlines mode is enabled. Lines in the input can end in ``'\\n'``, " @@ -2471,7 +2545,7 @@ msgstr "" "傳給呼叫方時,行尾符號不會被轉換。如果它是任何其他有效的值,則輸入資料的行只" "會由給定的字串做結尾,且在回傳給呼叫方時,行尾符號不會被轉換。" -#: ../../library/functions.rst:1386 +#: ../../library/functions.rst:1448 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -2484,7 +2558,7 @@ msgstr "" "``''`` 或 ``'\\n'``,則不做任何轉換。如果 *newline* 是任何其他有效的值,則寫" "入的任何 ``'\\n'`` 字元都將轉換為給定的字串。" -#: ../../library/functions.rst:1392 +#: ../../library/functions.rst:1454 msgid "" "If *closefd* is ``False`` and a file descriptor rather than a filename was " "given, the underlying file descriptor will be kept open when the file is " @@ -2495,7 +2569,7 @@ msgstr "" "則當檔案關閉時,底層的檔案描述器會保持開啟狀態。如果有給定一個檔名,則 " "*closefd* 必須是 ``True``\\ (預設值);否則將引發錯誤。" -#: ../../library/functions.rst:1397 +#: ../../library/functions.rst:1459 msgid "" "A custom opener can be used by passing a callable as *opener*. The " "underlying file descriptor for the file object is then obtained by calling " @@ -2508,11 +2582,11 @@ msgstr "" "必須回傳一個開啟的檔案描述器(將 :mod:`os.open` 作為 *opener* 傳入,在功能上" "的結果會相當於傳入 ``None``)。" -#: ../../library/functions.rst:1403 +#: ../../library/functions.rst:1465 msgid "The newly created file is :ref:`non-inheritable `." msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" -#: ../../library/functions.rst:1405 +#: ../../library/functions.rst:1467 msgid "" "The following example uses the :ref:`dir_fd ` parameter of the :func:" "`os.open` function to open a file relative to a given directory::" @@ -2520,7 +2594,7 @@ msgstr "" "下面的範例使用 :func:`os.open` 函式回傳值當作 :ref:`dir_fd ` 的參數," "從給定的目錄中用相對路徑開啟檔案: ::" -#: ../../library/functions.rst:1408 +#: ../../library/functions.rst:1470 msgid "" ">>> import os\n" ">>> dir_fd = os.open('somedir', os.O_RDONLY)\n" @@ -2533,7 +2607,7 @@ msgid "" ">>> os.close(dir_fd) # don't leak a file descriptor" msgstr "" -#: ../../library/functions.rst:1418 +#: ../../library/functions.rst:1480 msgid "" "The type of :term:`file object` returned by the :func:`open` function " "depends on the mode. When :func:`open` is used to open a file in a text " @@ -2557,7 +2631,7 @@ msgstr "" "BufferedRandom`。當緩衝被停用時,會回傳原始資料串流 :class:`io.FileIO`,它" "是 :class:`io.RawIOBase` 的一個 subclass。" -#: ../../library/functions.rst:1439 +#: ../../library/functions.rst:1501 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " "(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" @@ -2567,7 +2641,7 @@ msgstr "" "`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以及 :mod:" "`shutil`。" -#: ../../library/functions.rst:1443 +#: ../../library/functions.rst:1505 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." @@ -2575,25 +2649,25 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " "` ``open``。" -#: ../../library/functions.rst:1445 +#: ../../library/functions.rst:1507 msgid "" "The ``mode`` and ``flags`` arguments may have been modified or inferred from " "the original call." msgstr "``mode`` 和 ``flags`` 引數可能會被原始的呼叫所修改或推論 (infer)。" -#: ../../library/functions.rst:1450 +#: ../../library/functions.rst:1512 msgid "The *opener* parameter was added." msgstr "增加了 *opener* 參數。" -#: ../../library/functions.rst:1451 +#: ../../library/functions.rst:1513 msgid "The ``'x'`` mode was added." msgstr "增加了 ``'x'`` 模式。" -#: ../../library/functions.rst:1452 +#: ../../library/functions.rst:1514 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "過去引發的 :exc:`IOError`,現在是 :exc:`OSError` 的別名。" -#: ../../library/functions.rst:1453 +#: ../../library/functions.rst:1515 msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." @@ -2601,11 +2675,11 @@ msgstr "" "如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引發 :exc:" "`FileExistsError`。" -#: ../../library/functions.rst:1458 +#: ../../library/functions.rst:1520 msgid "The file is now non-inheritable." msgstr "檔案在此版本開始是不可繼承的。" -#: ../../library/functions.rst:1462 +#: ../../library/functions.rst:1524 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 :" @@ -2614,15 +2688,15 @@ msgstr "" "如果系統呼叫被中斷,但訊號處理程式沒有引發例外,此函式現在會重試系統呼叫,而" "不是引發 :exc:`InterruptedError` 例外(原因詳見 :pep:`475`)。" -#: ../../library/functions.rst:1465 +#: ../../library/functions.rst:1527 msgid "The ``'namereplace'`` error handler was added." msgstr "增加了 ``'namereplace'`` 錯誤處理程式。" -#: ../../library/functions.rst:1469 +#: ../../library/functions.rst:1531 msgid "Support added to accept objects implementing :class:`os.PathLike`." msgstr "增加對於實作 :class:`os.PathLike` 物件的支援。" -#: ../../library/functions.rst:1470 +#: ../../library/functions.rst:1532 msgid "" "On Windows, opening a console buffer may return a subclass of :class:`io." "RawIOBase` other than :class:`io.FileIO`." @@ -2630,11 +2704,11 @@ msgstr "" "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " "subclass,而不是 :class:`io.FileIO`。" -#: ../../library/functions.rst:1473 +#: ../../library/functions.rst:1535 msgid "The ``'U'`` mode has been removed." msgstr "``'U'`` 模式被移除。" -#: ../../library/functions.rst:1478 +#: ../../library/functions.rst:1540 msgid "" "Given a string representing one Unicode character, return an integer " "representing the Unicode code point of that character. For example, " @@ -2645,7 +2719,7 @@ msgstr "" "``ord('a')`` 回傳整數 ``97``、``ord('€')``\\ (歐元符號)回傳 ``8364``。這" "是 :func:`chr` 的逆函式。" -#: ../../library/functions.rst:1486 +#: ../../library/functions.rst:1548 msgid "" "Return *base* to the power *exp*; if *mod* is present, return *base* to the " "power *exp*, modulo *mod* (computed more efficiently than ``pow(base, exp) % " @@ -2656,7 +2730,7 @@ msgstr "" "*mod* 取餘數(比直接呼叫 ``pow(base, exp) % mod`` 計算更高效)。兩個引數形式" "的 ``pow(exp, exp)`` 等價於次方運算子:``base**exp``。" -#: ../../library/functions.rst:1491 +#: ../../library/functions.rst:1553 #, fuzzy msgid "" "The arguments must have numeric types. With mixed operand types, the " @@ -2679,7 +2753,7 @@ msgstr "" "數,且指數 (exponent) 不是整數,則會得到一個複數的結果。例如,``pow(-9, " "0.5)`` 會回傳一個接近 ``3j`` 的值。" -#: ../../library/functions.rst:1503 +#: ../../library/functions.rst:1565 msgid "" "For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must " "also be of integer type and *mod* must be nonzero. If *mod* is present and " @@ -2692,11 +2766,11 @@ msgstr "" "與 *mod* 互質。在這種情況下,會回傳 ``pow(inv_base, -exp, mod)``,其中 " "*inv_base* 是 *base* 對 *mod* 的模倒數 (inverse modulo)。" -#: ../../library/functions.rst:1509 +#: ../../library/functions.rst:1571 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" msgstr "以下是一個計算 ``38`` 對 ``97`` 取模倒數的範例: ::" -#: ../../library/functions.rst:1511 +#: ../../library/functions.rst:1573 msgid "" ">>> pow(38, -1, mod=97)\n" "23\n" @@ -2708,7 +2782,7 @@ msgstr "" ">>> 23 * 38 % 97 == 1\n" "True" -#: ../../library/functions.rst:1516 +#: ../../library/functions.rst:1578 msgid "" "For :class:`int` operands, the three-argument form of ``pow`` now allows the " "second argument to be negative, permitting computation of modular inverses." @@ -2716,12 +2790,12 @@ msgstr "" "對於 :class:`int` 運算元,現在 ``pow`` 的三引數形式允許第二個引數為負數,也容" "許模倒數的計算。" -#: ../../library/functions.rst:1521 +#: ../../library/functions.rst:1583 msgid "" "Allow keyword arguments. Formerly, only positional arguments were supported." msgstr "允許關鍵字引數。在此之前只支援位置引數。" -#: ../../library/functions.rst:1528 +#: ../../library/functions.rst:1590 msgid "" "Print *objects* to the text stream *file*, separated by *sep* and followed " "by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as " @@ -2730,7 +2804,7 @@ msgstr "" "將 *objects* 列印到文字資料串流 *file*,用 *sep* 分隔並以 *end* 結尾。如果有" "給定 *sep*、*end*、*file* 和 *flush*,那麼它們必須是關鍵字引數的形式。" -#: ../../library/functions.rst:1532 +#: ../../library/functions.rst:1594 msgid "" "All non-keyword arguments are converted to strings like :func:`str` does and " "written to the stream, separated by *sep* and followed by *end*. Both *sep* " @@ -2743,7 +2817,7 @@ msgstr "" "以是 ``None``,這表示使用預設值。如果沒有給定 *objects*,:func:`print` 就只會" "寫入 *end*。" -#: ../../library/functions.rst:1538 +#: ../../library/functions.rst:1600 msgid "" "The *file* argument must be an object with a ``write(string)`` method; if it " "is not present or ``None``, :data:`sys.stdout` will be used. Since printed " @@ -2755,7 +2829,7 @@ msgstr "" "串,所以 :func:`print` 不能用於二進位模式的檔案物件。對於此類物件,請改用 " "``file.write(...)``。" -#: ../../library/functions.rst:1543 +#: ../../library/functions.rst:1605 msgid "" "Output buffering is usually determined by *file*. However, if *flush* is " "true, the stream is forcibly flushed." @@ -2763,15 +2837,15 @@ msgstr "" "輸出緩衝通常會由 *file* 決定。但是如果 *flush* 為 true,則資料串流會被強制清" "除。" -#: ../../library/functions.rst:1547 +#: ../../library/functions.rst:1609 msgid "Added the *flush* keyword argument." msgstr "增加了 *flush* 關鍵字引數。" -#: ../../library/functions.rst:1553 +#: ../../library/functions.rst:1615 msgid "Return a property attribute." msgstr "回傳 property 屬性。" -#: ../../library/functions.rst:1555 +#: ../../library/functions.rst:1617 msgid "" "*fget* is a function for getting an attribute value. *fset* is a function " "for setting an attribute value. *fdel* is a function for deleting an " @@ -2780,11 +2854,11 @@ msgstr "" "*fget* 是一個用於取得屬性值的函式,*fset* 是一個用於設定屬性值的函式,*fdel* " "是一個用於刪除屬性值的函式,而 *doc* 會為該屬性建立一個說明字串。" -#: ../../library/functions.rst:1559 +#: ../../library/functions.rst:1621 msgid "A typical use is to define a managed attribute ``x``::" msgstr "一個典型的用途是定義一個受管理的屬性 ``x``: ::" -#: ../../library/functions.rst:1561 +#: ../../library/functions.rst:1623 msgid "" "class C:\n" " def __init__(self):\n" @@ -2816,7 +2890,7 @@ msgstr "" "\n" " x = property(getx, setx, delx, \"I'm the 'x' property.\")" -#: ../../library/functions.rst:1576 +#: ../../library/functions.rst:1638 msgid "" "If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = " "value`` will invoke the setter, and ``del c.x`` the deleter." @@ -2824,7 +2898,7 @@ msgstr "" "如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會呼叫取得器 (getter),``c.x = " "value`` 會呼叫設定器 (setter),而 ``del c.x`` 會呼叫刪除器 (deleter)。" -#: ../../library/functions.rst:1579 +#: ../../library/functions.rst:1641 msgid "" "If given, *doc* will be the docstring of the property attribute. Otherwise, " "the property will copy *fget*'s docstring (if it exists). This makes it " @@ -2835,7 +2909,7 @@ msgstr "" "*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使用 :func:" "`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" -#: ../../library/functions.rst:1583 +#: ../../library/functions.rst:1645 msgid "" "class Parrot:\n" " def __init__(self):\n" @@ -2847,14 +2921,14 @@ msgid "" " return self._voltage" msgstr "" -#: ../../library/functions.rst:1592 +#: ../../library/functions.rst:1654 msgid "" "The ``@property`` decorator turns the :meth:`!voltage` method into a " "\"getter\" for a read-only attribute with the same name, and it sets the " "docstring for *voltage* to \"Get the current voltage.\"" msgstr "" -#: ../../library/functions.rst:1600 +#: ../../library/functions.rst:1662 msgid "" "A property object has ``getter``, ``setter``, and ``deleter`` methods usable " "as decorators that create a copy of the property with the corresponding " @@ -2862,7 +2936,7 @@ msgid "" "with an example:" msgstr "" -#: ../../library/functions.rst:1605 +#: ../../library/functions.rst:1667 msgid "" "class C:\n" " def __init__(self):\n" @@ -2898,30 +2972,36 @@ msgstr "" " def x(self):\n" " del self._x" -#: ../../library/functions.rst:1624 +#: ../../library/functions.rst:1686 msgid "" "This code is exactly equivalent to the first example. Be sure to give the " "additional functions the same name as the original property (``x`` in this " "case.)" msgstr "" -#: ../../library/functions.rst:1628 +#: ../../library/functions.rst:1690 msgid "" "The returned property object also has the attributes ``fget``, ``fset``, and " "``fdel`` corresponding to the constructor arguments." msgstr "" -#: ../../library/functions.rst:1631 +#: ../../library/functions.rst:1693 msgid "The docstrings of property objects are now writeable." msgstr "" -#: ../../library/functions.rst:1640 +#: ../../library/functions.rst:1698 +msgid "" +"Attribute holding the name of the property. The name of the property can be " +"changed at runtime." +msgstr "" + +#: ../../library/functions.rst:1709 msgid "" "Rather than being a function, :class:`range` is actually an immutable " "sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:1646 +#: ../../library/functions.rst:1715 msgid "" "Return a string containing a printable representation of an object. For " "many types, this function makes an attempt to return a string that would " @@ -2934,11 +3014,11 @@ msgid "" "raise :exc:`RuntimeError`." msgstr "" -#: ../../library/functions.rst:1657 +#: ../../library/functions.rst:1726 msgid "This class has a custom representation that can be evaluated::" msgstr "" -#: ../../library/functions.rst:1659 +#: ../../library/functions.rst:1728 msgid "" "class Person:\n" " def __init__(self, name, age):\n" @@ -2956,7 +3036,7 @@ msgstr "" " def __repr__(self):\n" " return f\"Person('{self.name}', {self.age})\"" -#: ../../library/functions.rst:1670 +#: ../../library/functions.rst:1739 msgid "" "Return a reverse :term:`iterator`. *seq* must be an object which has a :" "meth:`~object.__reversed__` method or supports the sequence protocol (the :" @@ -2964,14 +3044,14 @@ msgid "" "with integer arguments starting at ``0``)." msgstr "" -#: ../../library/functions.rst:1678 +#: ../../library/functions.rst:1747 msgid "" "Return *number* rounded to *ndigits* precision after the decimal point. If " "*ndigits* is omitted or is ``None``, it returns the nearest integer to its " "input." msgstr "" -#: ../../library/functions.rst:1682 +#: ../../library/functions.rst:1751 msgid "" "For the built-in types supporting :func:`round`, values are rounded to the " "closest multiple of 10 to the power minus *ndigits*; if two multiples are " @@ -2982,13 +3062,13 @@ msgid "" "``None``. Otherwise, the return value has the same type as *number*." msgstr "" -#: ../../library/functions.rst:1691 +#: ../../library/functions.rst:1760 msgid "" "For a general Python object ``number``, ``round`` delegates to ``number." "__round__``." msgstr "" -#: ../../library/functions.rst:1696 +#: ../../library/functions.rst:1765 msgid "" "The behavior of :func:`round` for floats can be surprising: for example, " "``round(2.675, 2)`` gives ``2.67`` instead of the expected ``2.68``. This is " @@ -2997,21 +3077,21 @@ msgid "" "information." msgstr "" -#: ../../library/functions.rst:1708 +#: ../../library/functions.rst:1777 msgid "" "Return a new :class:`set` object, optionally with elements taken from " "*iterable*. ``set`` is a built-in class. See :class:`set` and :ref:`types-" "set` for documentation about this class." msgstr "" -#: ../../library/functions.rst:1712 +#: ../../library/functions.rst:1781 msgid "" "For other containers see the built-in :class:`frozenset`, :class:`list`, :" "class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` " "module." msgstr "" -#: ../../library/functions.rst:1719 +#: ../../library/functions.rst:1788 msgid "" "This is the counterpart of :func:`getattr`. The arguments are an object, a " "string, and an arbitrary value. The string may name an existing attribute " @@ -3020,7 +3100,7 @@ msgid "" "is equivalent to ``x.foobar = 123``." msgstr "" -#: ../../library/functions.rst:1725 +#: ../../library/functions.rst:1794 msgid "" "*name* need not be a Python identifier as defined in :ref:`identifiers` " "unless the object chooses to enforce that, for example in a custom :meth:" @@ -3029,21 +3109,21 @@ msgid "" "notation, but is accessible through :func:`getattr` etc.." msgstr "" -#: ../../library/functions.rst:1733 +#: ../../library/functions.rst:1802 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " "with two leading underscores) name in order to set it with :func:`setattr`." msgstr "" -#: ../../library/functions.rst:1742 +#: ../../library/functions.rst:1811 msgid "" "Return a :term:`slice` object representing the set of indices specified by " "``range(start, stop, step)``. The *start* and *step* arguments default to " "``None``." msgstr "" -#: ../../library/functions.rst:1750 +#: ../../library/functions.rst:1819 msgid "" "Slice objects have read-only data attributes :attr:`!start`, :attr:`!stop`, " "and :attr:`!step` which merely return the argument values (or their " @@ -3051,48 +3131,48 @@ msgid "" "by NumPy and other third-party packages." msgstr "" -#: ../../library/functions.rst:1755 +#: ../../library/functions.rst:1824 msgid "" "Slice objects are also generated when extended indexing syntax is used. For " "example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See :func:" "`itertools.islice` for an alternate version that returns an :term:`iterator`." msgstr "" -#: ../../library/functions.rst:1760 +#: ../../library/functions.rst:1829 msgid "" "Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:" "`~slice.stop`, and :attr:`~slice.step` are hashable)." msgstr "" -#: ../../library/functions.rst:1766 +#: ../../library/functions.rst:1835 msgid "Return a new sorted list from the items in *iterable*." msgstr "" -#: ../../library/functions.rst:1768 +#: ../../library/functions.rst:1837 msgid "" "Has two optional arguments which must be specified as keyword arguments." msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" -#: ../../library/functions.rst:1770 +#: ../../library/functions.rst:1839 msgid "" "*key* specifies a function of one argument that is used to extract a " "comparison key from each element in *iterable* (for example, ``key=str." "lower``). The default value is ``None`` (compare the elements directly)." msgstr "" -#: ../../library/functions.rst:1774 +#: ../../library/functions.rst:1843 msgid "" "*reverse* is a boolean value. If set to ``True``, then the list elements " "are sorted as if each comparison were reversed." msgstr "" -#: ../../library/functions.rst:1777 +#: ../../library/functions.rst:1846 msgid "" "Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a " "*key* function." msgstr "" -#: ../../library/functions.rst:1780 +#: ../../library/functions.rst:1849 msgid "" "The built-in :func:`sorted` function is guaranteed to be stable. A sort is " "stable if it guarantees not to change the relative order of elements that " @@ -3100,7 +3180,7 @@ msgid "" "example, sort by department, then by salary grade)." msgstr "" -#: ../../library/functions.rst:1785 +#: ../../library/functions.rst:1854 msgid "" "The sort algorithm uses only ``<`` comparisons between items. While " "defining an :meth:`~object.__lt__` method will suffice for sorting, :PEP:`8` " @@ -3112,22 +3192,22 @@ msgid "" "method." msgstr "" -#: ../../library/functions.rst:1794 +#: ../../library/functions.rst:1863 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -#: ../../library/functions.rst:1798 +#: ../../library/functions.rst:1867 msgid "Transform a method into a static method." msgstr "" -#: ../../library/functions.rst:1800 +#: ../../library/functions.rst:1869 msgid "" "A static method does not receive an implicit first argument. To declare a " "static method, use this idiom::" msgstr "" -#: ../../library/functions.rst:1803 +#: ../../library/functions.rst:1872 msgid "" "class C:\n" " @staticmethod\n" @@ -3137,7 +3217,7 @@ msgstr "" " @staticmethod\n" " def f(arg1, arg2, argN): ..." -#: ../../library/functions.rst:1807 +#: ../../library/functions.rst:1876 msgid "" "The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" "`function` for details." @@ -3145,7 +3225,7 @@ msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" -#: ../../library/functions.rst:1810 +#: ../../library/functions.rst:1879 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " "an instance (such as ``C().f()``). Moreover, the static method :term:" @@ -3153,14 +3233,14 @@ msgid "" "(such as ``f()``)." msgstr "" -#: ../../library/functions.rst:1815 +#: ../../library/functions.rst:1884 msgid "" "Static methods in Python are similar to those found in Java or C++. Also, " "see :func:`classmethod` for a variant that is useful for creating alternate " "class constructors." msgstr "" -#: ../../library/functions.rst:1819 +#: ../../library/functions.rst:1888 msgid "" "Like all decorators, it is also possible to call ``staticmethod`` as a " "regular function and do something with its result. This is needed in some " @@ -3169,7 +3249,7 @@ msgid "" "cases, use this idiom::" msgstr "" -#: ../../library/functions.rst:1825 +#: ../../library/functions.rst:1894 msgid "" "def regular_function():\n" " ...\n" @@ -3183,36 +3263,36 @@ msgstr "" "class C:\n" " method = staticmethod(regular_function)" -#: ../../library/functions.rst:1831 +#: ../../library/functions.rst:1900 msgid "For more information on static methods, see :ref:`types`." msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" -#: ../../library/functions.rst:1833 +#: ../../library/functions.rst:1902 msgid "" "Static methods now inherit the method attributes (``__module__``, " "``__name__``, ``__qualname__``, ``__doc__`` and ``__annotations__``), have a " "new ``__wrapped__`` attribute, and are now callable as regular functions." msgstr "" -#: ../../library/functions.rst:1848 +#: ../../library/functions.rst:1917 msgid "" "Return a :class:`str` version of *object*. See :func:`str` for details." msgstr "" -#: ../../library/functions.rst:1850 +#: ../../library/functions.rst:1919 msgid "" "``str`` is the built-in string :term:`class`. For general information about " "strings, see :ref:`textseq`." msgstr "" -#: ../../library/functions.rst:1856 +#: ../../library/functions.rst:1925 msgid "" "Sums *start* and the items of an *iterable* from left to right and returns " "the total. The *iterable*'s items are normally numbers, and the start value " "is not allowed to be a string." msgstr "" -#: ../../library/functions.rst:1860 +#: ../../library/functions.rst:1929 msgid "" "For some use cases, there are good alternatives to :func:`sum`. The " "preferred, fast way to concatenate a sequence of strings is by calling ``''." @@ -3221,37 +3301,37 @@ msgid "" "using :func:`itertools.chain`." msgstr "" -#: ../../library/functions.rst:1866 +#: ../../library/functions.rst:1935 msgid "The *start* parameter can be specified as a keyword argument." msgstr "*start* 參數可被指定為關鍵字引數。" -#: ../../library/functions.rst:1869 +#: ../../library/functions.rst:1938 msgid "" -"Summation of floats switched to an algorithm that gives higher accuracy on " -"most builds." +"Summation of floats switched to an algorithm that gives higher accuracy and " +"better commutativity on most builds." msgstr "" -#: ../../library/functions.rst:1876 +#: ../../library/functions.rst:1945 msgid "" "Return a proxy object that delegates method calls to a parent or sibling " "class of *type*. This is useful for accessing inherited methods that have " "been overridden in a class." msgstr "" -#: ../../library/functions.rst:1880 +#: ../../library/functions.rst:1949 msgid "" "The *object_or_type* determines the :term:`method resolution order` to be " "searched. The search starts from the class right after the *type*." msgstr "" -#: ../../library/functions.rst:1884 +#: ../../library/functions.rst:1953 msgid "" "For example, if :attr:`~class.__mro__` of *object_or_type* is ``D -> B -> C -" "> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" -#: ../../library/functions.rst:1888 +#: ../../library/functions.rst:1957 msgid "" "The :attr:`~class.__mro__` attribute of the class corresponding to " "*object_or_type* lists the method resolution search order used by both :func:" @@ -3259,7 +3339,7 @@ msgid "" "whenever the inheritance hierarchy is updated." msgstr "" -#: ../../library/functions.rst:1893 +#: ../../library/functions.rst:1962 msgid "" "If the second argument is omitted, the super object returned is unbound. If " "the second argument is an object, ``isinstance(obj, type)`` must be true. " @@ -3267,7 +3347,17 @@ msgid "" "(this is useful for classmethods)." msgstr "" -#: ../../library/functions.rst:1898 +#: ../../library/functions.rst:1967 +msgid "" +"When called directly within an ordinary method of a class, both arguments " +"may be omitted (\"zero-argument :func:`!super`\"). In this case, *type* will " +"be the enclosing class, and *obj* will be the first argument of the " +"immediately enclosing function (typically ``self``). (This means that zero-" +"argument :func:`!super` will not work as expected within nested functions, " +"including generator expressions, which implicitly create nested functions.)" +msgstr "" + +#: ../../library/functions.rst:1974 msgid "" "There are two typical use cases for *super*. In a class hierarchy with " "single inheritance, *super* can be used to refer to parent classes without " @@ -3275,7 +3365,7 @@ msgid "" "closely parallels the use of *super* in other programming languages." msgstr "" -#: ../../library/functions.rst:1903 +#: ../../library/functions.rst:1979 msgid "" "The second use case is to support cooperative multiple inheritance in a " "dynamic execution environment. This use case is unique to Python and is not " @@ -3288,11 +3378,11 @@ msgid "" "classes that are unknown prior to runtime)." msgstr "" -#: ../../library/functions.rst:1913 +#: ../../library/functions.rst:1989 msgid "For both use cases, a typical superclass call looks like this::" msgstr "" -#: ../../library/functions.rst:1915 +#: ../../library/functions.rst:1991 msgid "" "class C(B):\n" " def method(self, arg):\n" @@ -3300,14 +3390,14 @@ msgid "" " # super(C, self).method(arg)" msgstr "" -#: ../../library/functions.rst:1920 +#: ../../library/functions.rst:1996 msgid "" "In addition to method lookups, :func:`super` also works for attribute " "lookups. One possible use case for this is calling :term:`descriptors " "` in a parent or sibling class." msgstr "" -#: ../../library/functions.rst:1924 +#: ../../library/functions.rst:2000 msgid "" "Note that :func:`super` is implemented as part of the binding process for " "explicit dotted attribute lookups such as ``super().__getitem__(name)``. It " @@ -3317,7 +3407,7 @@ msgid "" "using statements or operators such as ``super()[name]``." msgstr "" -#: ../../library/functions.rst:1932 +#: ../../library/functions.rst:2008 msgid "" "Also note that, aside from the zero argument form, :func:`super` is not " "limited to use inside methods. The two argument form specifies the " @@ -3327,33 +3417,33 @@ msgid "" "accessing the current instance for ordinary methods." msgstr "" -#: ../../library/functions.rst:1939 +#: ../../library/functions.rst:2015 msgid "" "For practical suggestions on how to design cooperative classes using :func:" "`super`, see `guide to using super() `_." msgstr "" -#: ../../library/functions.rst:1949 +#: ../../library/functions.rst:2025 msgid "" "Rather than being a function, :class:`tuple` is actually an immutable " "sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:1958 +#: ../../library/functions.rst:2034 msgid "" "With one argument, return the type of an *object*. The return value is a " "type object and generally the same object as returned by :attr:`object." "__class__ `." msgstr "" -#: ../../library/functions.rst:1962 +#: ../../library/functions.rst:2038 msgid "" "The :func:`isinstance` built-in function is recommended for testing the type " "of an object, because it takes subclasses into account." msgstr "" -#: ../../library/functions.rst:1966 +#: ../../library/functions.rst:2042 msgid "" "With three arguments, return a new type object. This is essentially a " "dynamic form of the :keyword:`class` statement. The *name* string is the " @@ -3366,11 +3456,11 @@ msgid "" "identical :class:`type` objects:" msgstr "" -#: ../../library/functions.rst:1981 +#: ../../library/functions.rst:2057 msgid "See also :ref:`bltin-type-objects`." msgstr "另請參閱 :ref:`bltin-type-objects`。" -#: ../../library/functions.rst:1983 +#: ../../library/functions.rst:2059 msgid "" "Keyword arguments provided to the three argument form are passed to the " "appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`) " @@ -3378,23 +3468,23 @@ msgid "" "would." msgstr "" -#: ../../library/functions.rst:1988 +#: ../../library/functions.rst:2064 msgid "See also :ref:`class-customization`." msgstr "另請參閱 :ref:`class-customization`。" -#: ../../library/functions.rst:1990 +#: ../../library/functions.rst:2066 msgid "" "Subclasses of :class:`type` which don't override ``type.__new__`` may no " "longer use the one-argument form to get the type of an object." msgstr "" -#: ../../library/functions.rst:1997 +#: ../../library/functions.rst:2073 msgid "" "Return the :attr:`~object.__dict__` attribute for a module, class, instance, " "or any other object with a :attr:`~object.__dict__` attribute." msgstr "" -#: ../../library/functions.rst:2000 +#: ../../library/functions.rst:2076 msgid "" "Objects such as modules and instances have an updateable :attr:`~object." "__dict__` attribute; however, other objects may have write restrictions on " @@ -3402,31 +3492,34 @@ msgid "" "`types.MappingProxyType` to prevent direct dictionary updates)." msgstr "" -#: ../../library/functions.rst:2005 -msgid "" -"Without an argument, :func:`vars` acts like :func:`locals`. Note, the " -"locals dictionary is only useful for reads since updates to the locals " -"dictionary are ignored." +#: ../../library/functions.rst:2081 +msgid "Without an argument, :func:`vars` acts like :func:`locals`." msgstr "" -#: ../../library/functions.rst:2009 +#: ../../library/functions.rst:2083 msgid "" "A :exc:`TypeError` exception is raised if an object is specified but it " "doesn't have a :attr:`~object.__dict__` attribute (for example, if its class " "defines the :attr:`~object.__slots__` attribute)." msgstr "" -#: ../../library/functions.rst:2015 +#: ../../library/functions.rst:2089 +msgid "" +"The result of calling this function without an argument has been updated as " +"described for the :func:`locals` builtin." +msgstr "" + +#: ../../library/functions.rst:2095 msgid "" "Iterate over several iterables in parallel, producing tuples with an item " "from each one." msgstr "" -#: ../../library/functions.rst:2018 +#: ../../library/functions.rst:2098 msgid "Example::" msgstr "例如: ::" -#: ../../library/functions.rst:2020 +#: ../../library/functions.rst:2100 msgid "" ">>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):\n" "... print(item)\n" @@ -3442,27 +3535,27 @@ msgstr "" "(2, 'spice')\n" "(3, 'everything nice')" -#: ../../library/functions.rst:2027 +#: ../../library/functions.rst:2107 msgid "" "More formally: :func:`zip` returns an iterator of tuples, where the *i*-th " "tuple contains the *i*-th element from each of the argument iterables." msgstr "" -#: ../../library/functions.rst:2030 +#: ../../library/functions.rst:2110 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " "columns into rows. This is similar to `transposing a matrix `_." msgstr "" -#: ../../library/functions.rst:2034 +#: ../../library/functions.rst:2114 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " "iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" "`list`." msgstr "" -#: ../../library/functions.rst:2038 +#: ../../library/functions.rst:2118 msgid "" "One thing to consider is that the iterables passed to :func:`zip` could have " "different lengths; sometimes by design, and sometimes because of a bug in " @@ -3470,14 +3563,14 @@ msgid "" "approaches to dealing with this issue:" msgstr "" -#: ../../library/functions.rst:2043 +#: ../../library/functions.rst:2123 msgid "" "By default, :func:`zip` stops when the shortest iterable is exhausted. It " "will ignore the remaining items in the longer iterables, cutting off the " "result to the length of the shortest iterable::" msgstr "" -#: ../../library/functions.rst:2047 +#: ../../library/functions.rst:2127 msgid "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" @@ -3485,14 +3578,14 @@ msgstr "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" -#: ../../library/functions.rst:2050 +#: ../../library/functions.rst:2130 msgid "" ":func:`zip` is often used in cases where the iterables are assumed to be of " "equal length. In such cases, it's recommended to use the ``strict=True`` " "option. Its output is the same as regular :func:`zip`::" msgstr "" -#: ../../library/functions.rst:2054 +#: ../../library/functions.rst:2134 msgid "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" @@ -3500,37 +3593,37 @@ msgstr "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" -#: ../../library/functions.rst:2057 +#: ../../library/functions.rst:2137 msgid "" "Unlike the default behavior, it raises a :exc:`ValueError` if one iterable " "is exhausted before the others:" msgstr "" -#: ../../library/functions.rst:2075 +#: ../../library/functions.rst:2155 msgid "" "Without the ``strict=True`` argument, any bug that results in iterables of " "different lengths will be silenced, possibly manifesting as a hard-to-find " "bug in another part of the program." msgstr "" -#: ../../library/functions.rst:2079 +#: ../../library/functions.rst:2159 msgid "" "Shorter iterables can be padded with a constant value to make all the " "iterables have the same length. This is done by :func:`itertools." "zip_longest`." msgstr "" -#: ../../library/functions.rst:2083 +#: ../../library/functions.rst:2163 msgid "" "Edge cases: With a single iterable argument, :func:`zip` returns an iterator " "of 1-tuples. With no arguments, it returns an empty iterator." msgstr "" -#: ../../library/functions.rst:2086 +#: ../../library/functions.rst:2166 msgid "Tips and tricks:" msgstr "" -#: ../../library/functions.rst:2088 +#: ../../library/functions.rst:2168 msgid "" "The left-to-right evaluation order of the iterables is guaranteed. This " "makes possible an idiom for clustering a data series into n-length groups " @@ -3539,13 +3632,13 @@ msgid "" "iterator. This has the effect of dividing the input into n-length chunks." msgstr "" -#: ../../library/functions.rst:2094 +#: ../../library/functions.rst:2174 msgid "" ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " "list::" msgstr "" -#: ../../library/functions.rst:2097 +#: ../../library/functions.rst:2177 msgid "" ">>> x = [1, 2, 3]\n" ">>> y = [4, 5, 6]\n" @@ -3563,17 +3656,17 @@ msgstr "" ">>> x == list(x2) and y == list(y2)\n" "True" -#: ../../library/functions.rst:2105 +#: ../../library/functions.rst:2185 msgid "Added the ``strict`` argument." msgstr "增加了 ``strict`` 引數。" -#: ../../library/functions.rst:2117 +#: ../../library/functions.rst:2197 msgid "" "This is an advanced function that is not needed in everyday Python " "programming, unlike :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2120 +#: ../../library/functions.rst:2200 msgid "" "This function is invoked by the :keyword:`import` statement. It can be " "replaced (by importing the :mod:`builtins` module and assigning to " @@ -3585,7 +3678,7 @@ msgid "" "discouraged in favor of :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2129 +#: ../../library/functions.rst:2209 msgid "" "The function imports the module *name*, potentially using the given " "*globals* and *locals* to determine how to interpret the name in a package " @@ -3595,7 +3688,7 @@ msgid "" "determine the package context of the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2136 +#: ../../library/functions.rst:2216 msgid "" "*level* specifies whether to use absolute or relative imports. ``0`` (the " "default) means only perform absolute imports. Positive values for *level* " @@ -3604,7 +3697,7 @@ msgid "" "details)." msgstr "" -#: ../../library/functions.rst:2142 +#: ../../library/functions.rst:2222 msgid "" "When the *name* variable is of the form ``package.module``, normally, the " "top-level package (the name up till the first dot) is returned, *not* the " @@ -3612,37 +3705,37 @@ msgid "" "given, the module named by *name* is returned." msgstr "" -#: ../../library/functions.rst:2147 +#: ../../library/functions.rst:2227 msgid "" "For example, the statement ``import spam`` results in bytecode resembling " "the following code::" msgstr "" -#: ../../library/functions.rst:2150 +#: ../../library/functions.rst:2230 msgid "spam = __import__('spam', globals(), locals(), [], 0)" msgstr "spam = __import__('spam', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2152 +#: ../../library/functions.rst:2232 msgid "The statement ``import spam.ham`` results in this call::" msgstr "" -#: ../../library/functions.rst:2154 +#: ../../library/functions.rst:2234 msgid "spam = __import__('spam.ham', globals(), locals(), [], 0)" msgstr "spam = __import__('spam.ham', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2156 +#: ../../library/functions.rst:2236 msgid "" "Note how :func:`__import__` returns the toplevel module here because this is " "the object that is bound to a name by the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2159 +#: ../../library/functions.rst:2239 msgid "" "On the other hand, the statement ``from spam.ham import eggs, sausage as " "saus`` results in ::" msgstr "" -#: ../../library/functions.rst:2162 +#: ../../library/functions.rst:2242 msgid "" "_temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)\n" "eggs = _temp.eggs\n" @@ -3652,36 +3745,36 @@ msgstr "" "eggs = _temp.eggs\n" "saus = _temp.sausage" -#: ../../library/functions.rst:2166 +#: ../../library/functions.rst:2246 msgid "" "Here, the ``spam.ham`` module is returned from :func:`__import__`. From " "this object, the names to import are retrieved and assigned to their " "respective names." msgstr "" -#: ../../library/functions.rst:2170 +#: ../../library/functions.rst:2250 msgid "" "If you simply want to import a module (potentially within a package) by " "name, use :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2173 +#: ../../library/functions.rst:2253 msgid "" "Negative values for *level* are no longer supported (which also changes the " "default value to 0)." msgstr "" -#: ../../library/functions.rst:2177 +#: ../../library/functions.rst:2257 msgid "" "When the command line options :option:`-E` or :option:`-I` are being used, " "the environment variable :envvar:`PYTHONCASEOK` is now ignored." msgstr "" -#: ../../library/functions.rst:2182 +#: ../../library/functions.rst:2262 msgid "Footnotes" msgstr "註解" -#: ../../library/functions.rst:2183 +#: ../../library/functions.rst:2263 msgid "" "Note that the parser only accepts the Unix-style end of line convention. If " "you are reading the code from a file, make sure to use newline conversion " @@ -3694,106 +3787,132 @@ msgstr "" msgid "Boolean" msgstr "Boolean(布林值)" -#: ../../library/functions.rst:154 ../../library/functions.rst:1956 +#: ../../library/functions.rst:154 ../../library/functions.rst:2032 msgid "type" msgstr "type(型別)" -#: ../../library/functions.rst:631 +#: ../../library/functions.rst:641 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/functions.rst:631 +#: ../../library/functions.rst:641 msgid "exec" msgstr "exec" -#: ../../library/functions.rst:713 +#: ../../library/functions.rst:733 msgid "NaN" msgstr "NaN" -#: ../../library/functions.rst:713 +#: ../../library/functions.rst:733 msgid "Infinity" msgstr "Infinity(無窮)" -#: ../../library/functions.rst:781 +#: ../../library/functions.rst:801 msgid "__format__" msgstr "__format__" -#: ../../library/functions.rst:781 ../../library/functions.rst:1840 +#: ../../library/functions.rst:801 ../../library/functions.rst:1909 msgid "string" msgstr "string(字串)" -#: ../../library/functions.rst:781 +#: ../../library/functions.rst:801 msgid "format() (built-in function)" msgstr "format()(內建函式)" -#: ../../library/functions.rst:1248 +#: ../../library/functions.rst:1310 msgid "file object" msgstr "file object(檔案物件)" -#: ../../library/functions.rst:1248 ../../library/functions.rst:1369 +#: ../../library/functions.rst:1310 ../../library/functions.rst:1431 msgid "open() built-in function" msgstr "open() 內建函式" -#: ../../library/functions.rst:1276 +#: ../../library/functions.rst:1338 msgid "file" msgstr "file(檔案)" -#: ../../library/functions.rst:1276 +#: ../../library/functions.rst:1338 msgid "modes" msgstr "modes(模式)" -#: ../../library/functions.rst:1369 +#: ../../library/functions.rst:1431 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/functions.rst:1430 +#: ../../library/functions.rst:1492 msgid "line-buffered I/O" msgstr "line-buffered I/O(行緩衝 I/O)" -#: ../../library/functions.rst:1430 +#: ../../library/functions.rst:1492 msgid "unbuffered I/O" msgstr "unbuffered I/O(非緩衝 I/O)" -#: ../../library/functions.rst:1430 +#: ../../library/functions.rst:1492 msgid "buffer size, I/O" msgstr "buffer size, I/O(緩衝區大小、I/O)" -#: ../../library/functions.rst:1430 +#: ../../library/functions.rst:1492 msgid "I/O control" msgstr "I/O control(I/O 控制)" -#: ../../library/functions.rst:1430 +#: ../../library/functions.rst:1492 msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/functions.rst:1430 +#: ../../library/functions.rst:1492 msgid "text mode" msgstr "text mode(文字模式)" -#: ../../library/functions.rst:1430 ../../library/functions.rst:2111 +#: ../../library/functions.rst:1492 ../../library/functions.rst:2191 msgid "module" msgstr "module(模組)" -#: ../../library/functions.rst:1430 +#: ../../library/functions.rst:1492 msgid "sys" msgstr "sys" -#: ../../library/functions.rst:1840 +#: ../../library/functions.rst:1909 msgid "str() (built-in function)" msgstr "str() (內建函式)" -#: ../../library/functions.rst:1956 +#: ../../library/functions.rst:2032 msgid "object" msgstr "object(物件)" -#: ../../library/functions.rst:2111 +#: ../../library/functions.rst:2191 msgid "statement" msgstr "statement(陳述式)" -#: ../../library/functions.rst:2111 +#: ../../library/functions.rst:2191 msgid "import" msgstr "import(引入)" -#: ../../library/functions.rst:2111 +#: ../../library/functions.rst:2191 msgid "builtins" msgstr "builtins(內建)" + +#~ msgid "" +#~ "Most users should just pass a *globals* argument and never *locals*. If " +#~ "exec gets two separate objects as *globals* and *locals*, the code will " +#~ "be executed as if it were embedded in a class definition." +#~ msgstr "" +#~ "大部分使用者只需要傳入 *globals* 引數,而不用傳遞 *locals*。如果 exec 有" +#~ "兩個不同的 *globals* 和 *locals* 物件,程式碼就像嵌入在 class 定義中一樣執" +#~ "行。" + +#~ msgid "" +#~ "Update and return a dictionary representing the current local symbol " +#~ "table. Free variables are returned by :func:`locals` when it is called in " +#~ "function blocks, but not in class blocks. Note that at the module level, :" +#~ "func:`locals` and :func:`globals` are the same dictionary." +#~ msgstr "" +#~ "更新並回傳表示當前本地符號表的 dictionary。在函式區塊而不是 class 區塊中呼" +#~ "叫 :func:`locals` 時會回傳自由變數。請注意,在 module 階層中,:func:" +#~ "`locals` 和 :func:`globals` 是相同的 dictionary。" + +#~ msgid "" +#~ "The contents of this dictionary should not be modified; changes may not " +#~ "affect the values of local and free variables used by the interpreter." +#~ msgstr "" +#~ "此 dictionary 的內容不應該被更動;更改可能不會影響直譯器使用的本地變數或自" +#~ "由變數的值。" diff --git a/library/functools.po b/library/functools.po index 202b2bf7b8..280a86fb33 100644 --- a/library/functools.po +++ b/library/functools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-05-11 16:02+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -394,9 +394,10 @@ msgstr "" "cache-method-calls`" #: ../../library/functools.rst:220 +#, fuzzy msgid "" "An `LRU (least recently used) cache `_ works best when the " +"Cache_replacement_policies#Least_recently_used_(LRU)>`_ works best when the " "most recent calls are the best predictors of upcoming calls (for example, " "the most popular articles on a news server tend to change each day). The " "cache's size limit assures that the cache does not grow without bound on " @@ -690,16 +691,17 @@ msgstr "" "True" #: ../../library/functools.rst:408 +#, fuzzy msgid "" "Apply *function* of two arguments cumulatively to the items of *iterable*, " "from left to right, so as to reduce the iterable to a single value. For " "example, ``reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])`` calculates " "``((((1+2)+3)+4)+5)``. The left argument, *x*, is the accumulated value and " "the right argument, *y*, is the update value from the *iterable*. If the " -"optional *initializer* is present, it is placed before the items of the " -"iterable in the calculation, and serves as a default when the iterable is " -"empty. If *initializer* is not given and *iterable* contains only one item, " -"the first item is returned." +"optional *initial* is present, it is placed before the items of the iterable " +"in the calculation, and serves as a default when the iterable is empty. If " +"*initial* is not given and *iterable* contains only one item, the first item " +"is returned." msgstr "" "從左到右,將兩個引數的 *function* 累加運用到 *iterable* 的項目上,從而將可疊" "代物件減少為單一值。例如,``reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])`` 會計" @@ -713,13 +715,16 @@ msgid "Roughly equivalent to::" msgstr "大致相當於: ::" #: ../../library/functools.rst:419 +#, fuzzy msgid "" -"def reduce(function, iterable, initializer=None):\n" +"initial_missing = object()\n" +"\n" +"def reduce(function, iterable, initial=initial_missing, /):\n" " it = iter(iterable)\n" -" if initializer is None:\n" +" if initial is initial_missing:\n" " value = next(it)\n" " else:\n" -" value = initializer\n" +" value = initial\n" " for element in it:\n" " value = function(value, element)\n" " return value" @@ -734,7 +739,7 @@ msgstr "" " value = function(value, element)\n" " return value" -#: ../../library/functools.rst:429 +#: ../../library/functools.rst:431 msgid "" "See :func:`itertools.accumulate` for an iterator that yields all " "intermediate values." @@ -742,7 +747,7 @@ msgstr "" "請參閱 :func:`itertools.accumulate` 以了解產生 (yield) 所有中間值 " "(intermediate value) 的疊代器。" -#: ../../library/functools.rst:434 +#: ../../library/functools.rst:436 msgid "" "Transform a function into a :term:`single-dispatch ` :term:" "`generic function`." @@ -750,7 +755,7 @@ msgstr "" "將函式轉換為\\ :term:`單一調度 `\\ :term:`泛型函式 `。" -#: ../../library/functools.rst:437 +#: ../../library/functools.rst:439 msgid "" "To define a generic function, decorate it with the ``@singledispatch`` " "decorator. When defining a function using ``@singledispatch``, note that the " @@ -760,7 +765,7 @@ msgstr "" "``@singledispatch`` 定義函式時,分派調度 (dispatch) 是發生在第一個引數的型別" "上: ::" -#: ../../library/functools.rst:441 +#: ../../library/functools.rst:443 msgid "" ">>> from functools import singledispatch\n" ">>> @singledispatch\n" @@ -776,7 +781,7 @@ msgstr "" "... print(\"Let me just say,\", end=\" \")\n" "... print(arg)" -#: ../../library/functools.rst:448 +#: ../../library/functools.rst:450 msgid "" "To add overloaded implementations to the function, use the :func:`register` " "attribute of the generic function, which can be used as a decorator. For " @@ -786,7 +791,7 @@ msgstr "" "若要為函式新增過載實作,請使用泛型函式的 :func:`register` 屬性,該屬性可用作" "裝飾器。對於以型別來註釋的函式,裝飾器將自動推斷第一個引數的型別: ::" -#: ../../library/functools.rst:453 +#: ../../library/functools.rst:455 msgid "" ">>> @fun.register\n" "... def _(arg: int, verbose=False):\n" @@ -814,11 +819,11 @@ msgstr "" "... for i, elem in enumerate(arg):\n" "... print(i, elem)" -#: ../../library/functools.rst:466 +#: ../../library/functools.rst:468 msgid ":data:`types.UnionType` and :data:`typing.Union` can also be used::" msgstr "也可以使用 :data:`types.UnionType` 和 :data:`typing.Union`: ::" -#: ../../library/functools.rst:468 +#: ../../library/functools.rst:470 msgid "" ">>> @fun.register\n" "... def _(arg: int | float, verbose=False):\n" @@ -850,14 +855,14 @@ msgstr "" "... print(i, elem)\n" "..." -#: ../../library/functools.rst:483 +#: ../../library/functools.rst:485 msgid "" "For code which doesn't use type annotations, the appropriate type argument " "can be passed explicitly to the decorator itself::" msgstr "" "對於不使用型別註釋的程式碼,可以將適當的型別引數明確傳遞給裝飾器本身: ::" -#: ../../library/functools.rst:486 +#: ../../library/functools.rst:488 msgid "" ">>> @fun.register(complex)\n" "... def _(arg, verbose=False):\n" @@ -873,7 +878,7 @@ msgstr "" "... print(arg.real, arg.imag)\n" "..." -#: ../../library/functools.rst:494 +#: ../../library/functools.rst:496 msgid "" "To enable registering :term:`lambdas` and pre-existing functions, " "the :func:`register` attribute can also be used in a functional form::" @@ -881,7 +886,7 @@ msgstr "" "若要啟用註冊 :term:`lambdas` 和預先存在的函式,:func:`register` 屬性" "也能以函式形式使用: ::" -#: ../../library/functools.rst:497 +#: ../../library/functools.rst:499 msgid "" ">>> def nothing(arg, verbose=False):\n" "... print(\"Nothing.\")\n" @@ -893,7 +898,7 @@ msgstr "" "...\n" ">>> fun.register(type(None), nothing)" -#: ../../library/functools.rst:502 +#: ../../library/functools.rst:504 msgid "" "The :func:`register` attribute returns the undecorated function. This " "enables decorator stacking, :mod:`pickling`, and the creation of " @@ -902,7 +907,7 @@ msgstr "" ":func:`register` 屬性回傳未加裝飾器的函式。這讓使得裝飾器堆疊 (decorator " "stacking)、:mod:`pickling` 以及為每個變體獨立建立單元測試成為可能:" -#: ../../library/functools.rst:506 +#: ../../library/functools.rst:508 msgid "" ">>> @fun.register(float)\n" "... @fun.register(Decimal)\n" @@ -924,13 +929,13 @@ msgstr "" ">>> fun_num is fun\n" "False" -#: ../../library/functools.rst:516 +#: ../../library/functools.rst:518 msgid "" "When called, the generic function dispatches on the type of the first " "argument::" msgstr "呼叫時,泛型函式會分派第一個引數的型別: ::" -#: ../../library/functools.rst:519 +#: ../../library/functools.rst:521 msgid "" ">>> fun(\"Hello, world.\")\n" "Hello, world.\n" @@ -966,7 +971,7 @@ msgstr "" ">>> fun(1.23)\n" "0.615" -#: ../../library/functools.rst:536 +#: ../../library/functools.rst:538 msgid "" "Where there is no registered implementation for a specific type, its method " "resolution order is used to find a more generic implementation. The original " @@ -978,7 +983,7 @@ msgstr "" "尋找更通用的實作。用 ``@singledispatch`` 裝飾的原始函式是為基底 :class:" "`object` 型別註冊的,這意味著如果沒有找到更好的實作就會使用它。" -#: ../../library/functools.rst:542 +#: ../../library/functools.rst:544 msgid "" "If an implementation is registered to an :term:`abstract base class`, " "virtual subclasses of the base class will be dispatched to that " @@ -987,7 +992,7 @@ msgstr "" "如果一個實作有被註冊到一個\\ :term:`抽象基底類別 `,則基" "底類別的虛擬子類別將被分派到該實作: ::" -#: ../../library/functools.rst:546 +#: ../../library/functools.rst:548 msgid "" ">>> from collections.abc import Mapping\n" ">>> @fun.register\n" @@ -1011,14 +1016,14 @@ msgstr "" ">>> fun({\"a\": \"b\"})\n" "a => b" -#: ../../library/functools.rst:557 +#: ../../library/functools.rst:559 msgid "" "To check which implementation the generic function will choose for a given " "type, use the ``dispatch()`` attribute::" msgstr "" "若要檢查泛型函式將為給定型別選擇哪種實作,請使用 ``dispatch()`` 屬性: ::" -#: ../../library/functools.rst:560 +#: ../../library/functools.rst:562 msgid "" ">>> fun.dispatch(float)\n" "\n" @@ -1026,13 +1031,13 @@ msgid "" "" msgstr "" -#: ../../library/functools.rst:565 +#: ../../library/functools.rst:567 msgid "" "To access all registered implementations, use the read-only ``registry`` " "attribute::" msgstr "若要存取所有已註冊的實作,請使用唯讀 ``registry`` 屬性: ::" -#: ../../library/functools.rst:568 +#: ../../library/functools.rst:570 msgid "" ">>> fun.registry.keys()\n" "dict_keys([, , ,\n" @@ -1052,11 +1057,11 @@ msgstr "" ">>> fun.registry[object]\n" "" -#: ../../library/functools.rst:579 +#: ../../library/functools.rst:581 msgid "The :func:`register` attribute now supports using type annotations." msgstr ":func:`register` 屬性現在支援使用型別註釋。" -#: ../../library/functools.rst:582 +#: ../../library/functools.rst:584 msgid "" "The :func:`register` attribute now supports :data:`types.UnionType` and :" "data:`typing.Union` as type annotations." @@ -1064,7 +1069,7 @@ msgstr "" ":func:`register` 屬性現在支援以 :data:`types.UnionType` 和 :data:`typing." "Union` 作為型別註釋。" -#: ../../library/functools.rst:589 +#: ../../library/functools.rst:591 msgid "" "Transform a method into a :term:`single-dispatch ` :term:" "`generic function`." @@ -1072,7 +1077,7 @@ msgstr "" "將方法轉換為\\ :term:`單一調度 `\\ :term:`泛型函式 `。" -#: ../../library/functools.rst:592 +#: ../../library/functools.rst:594 msgid "" "To define a generic method, decorate it with the ``@singledispatchmethod`` " "decorator. When defining a function using ``@singledispatchmethod``, note " @@ -1083,7 +1088,7 @@ msgstr "" "用 ``@singledispatchmethod`` 定義函式時,分派調度是發生在第一個非 *self* 或" "非 *cls* 引數的型別上: ::" -#: ../../library/functools.rst:597 +#: ../../library/functools.rst:599 msgid "" "class Negator:\n" " @singledispatchmethod\n" @@ -1111,7 +1116,7 @@ msgstr "" " def _(self, arg: bool):\n" " return not arg" -#: ../../library/functools.rst:610 +#: ../../library/functools.rst:612 msgid "" "``@singledispatchmethod`` supports nesting with other decorators such as :" "func:`@classmethod`. Note that to allow for ``dispatcher." @@ -1124,7 +1129,7 @@ msgstr "" "``singledispatchmethod`` 必須是\\ *最外面的*\\ 裝飾器。以下範例是 " "``Negator`` 類別,其 ``neg`` 方法繫結到該類別,而不是該類別的實例: ::" -#: ../../library/functools.rst:616 +#: ../../library/functools.rst:618 msgid "" "class Negator:\n" " @singledispatchmethod\n" @@ -1158,7 +1163,7 @@ msgstr "" " def _(cls, arg: bool):\n" " return not arg" -#: ../../library/functools.rst:632 +#: ../../library/functools.rst:634 msgid "" "The same pattern can be used for other similar decorators: :func:" "`@staticmethod`, :func:`@abstractmethod`, " @@ -1167,7 +1172,7 @@ msgstr "" "相同的模式可用於其他類似的裝飾器::func:`@staticmethod`、:func:" "`@abstractmethod` 等。" -#: ../../library/functools.rst:641 +#: ../../library/functools.rst:643 msgid "" "Update a *wrapper* function to look like the *wrapped* function. The " "optional arguments are tuples to specify which attributes of the original " @@ -1187,7 +1192,7 @@ msgstr "" "``__qualname__``、``__annotations__`` 和 ``__doc__`` 文件字串 (docstring)和 " "``WRAPPER_UPDATES``\\ (更新包裝器函式的 ``__dict__``,即實例字典)。" -#: ../../library/functools.rst:652 +#: ../../library/functools.rst:654 msgid "" "To allow access to the original function for introspection and other " "purposes (e.g. bypassing a caching decorator such as :func:`lru_cache`), " @@ -1198,7 +1203,7 @@ msgstr "" "飾器,如 :func:`lru_cache`),此函式會自動向包裝器新增 ``__wrapped__`` 屬性," "該包裝器參照被包裝的函式。" -#: ../../library/functools.rst:657 +#: ../../library/functools.rst:659 msgid "" "The main intended use for this function is in :term:`decorator` functions " "which wrap the decorated function and return the wrapper. If the wrapper " @@ -1210,7 +1215,7 @@ msgstr "" "裝器函式未更新,則回傳函式的元資料 (metadata) 將反映包裝器定義而非原始函式定" "義,這通常不太會有幫助。" -#: ../../library/functools.rst:663 +#: ../../library/functools.rst:665 msgid "" ":func:`update_wrapper` may be used with callables other than functions. Any " "attributes named in *assigned* or *updated* that are missing from the object " @@ -1223,7 +1228,7 @@ msgstr "" "器函式上設定它們)。如果包裝函式本身缺少 *updated* 中指定的任何屬性,仍然會引" "發 :exc:`AttributeError`。" -#: ../../library/functools.rst:669 +#: ../../library/functools.rst:671 msgid "" "The ``__wrapped__`` attribute is now automatically added. The " "``__annotations__`` attribute is now copied by default. Missing attributes " @@ -1232,7 +1237,7 @@ msgstr "" "現在會自動新增 ``__wrapped__`` 屬性。現在預設會複製 ``__annotations__`` 屬" "性。缺少的屬性不再觸發 :exc:`AttributeError`。" -#: ../../library/functools.rst:674 +#: ../../library/functools.rst:676 msgid "" "The ``__wrapped__`` attribute now always refers to the wrapped function, " "even if that function defined a ``__wrapped__`` attribute. (see :issue:" @@ -1241,11 +1246,11 @@ msgstr "" "``__wrapped__`` 屬性現在都會參照包裝函式,即便函式有定義 ``__wrapped__`` 屬" "性。(參見 :issue:`17482`)" -#: ../../library/functools.rst:679 +#: ../../library/functools.rst:681 msgid "The ``__type_params__`` attribute is now copied by default." msgstr "現在預設會複製 ``__type_params__`` 屬性。" -#: ../../library/functools.rst:685 +#: ../../library/functools.rst:687 msgid "" "This is a convenience function for invoking :func:`update_wrapper` as a " "function decorator when defining a wrapper function. It is equivalent to " @@ -1256,7 +1261,7 @@ msgstr "" "式裝飾器。它相當於 ``partial(update_wrapper, wrapped=wrapped, " "assigned=assigned, updated=updated)``。例如: ::" -#: ../../library/functools.rst:690 +#: ../../library/functools.rst:692 msgid "" ">>> from functools import wraps\n" ">>> def my_decorator(f):\n" @@ -1280,7 +1285,7 @@ msgid "" "'Docstring'" msgstr "" -#: ../../library/functools.rst:711 +#: ../../library/functools.rst:713 msgid "" "Without the use of this decorator factory, the name of the example function " "would have been ``'wrapper'``, and the docstring of the original :func:" @@ -1289,11 +1294,11 @@ msgstr "" "如果不使用這個裝飾器工廠 (decorator factory),範例函式的名稱將會是 " "``'wrapper'``,並且原始 :func:`example` 的文件字串將會遺失。" -#: ../../library/functools.rst:719 +#: ../../library/functools.rst:721 msgid ":class:`partial` Objects" msgstr ":class:`partial` 物件" -#: ../../library/functools.rst:721 +#: ../../library/functools.rst:723 msgid "" ":class:`partial` objects are callable objects created by :func:`partial`. " "They have three read-only attributes:" @@ -1301,7 +1306,7 @@ msgstr "" ":class:`partial` 物件是由 :func:`partial` 所建立的可呼叫物件。它們有三個唯讀" "屬性:" -#: ../../library/functools.rst:727 +#: ../../library/functools.rst:729 msgid "" "A callable object or function. Calls to the :class:`partial` object will be " "forwarded to :attr:`func` with new arguments and keywords." @@ -1309,7 +1314,7 @@ msgstr "" "一個可呼叫的物件或函式。對 :class:`partial` 物件的呼叫將被轉送到帶有新引數和" "關鍵字的 :attr:`func`。" -#: ../../library/functools.rst:733 +#: ../../library/functools.rst:735 msgid "" "The leftmost positional arguments that will be prepended to the positional " "arguments provided to a :class:`partial` object call." @@ -1317,13 +1322,13 @@ msgstr "" "最左邊的位置引數將會被加入到提供給 :class:`partial` 物件呼叫的位置引數的前" "面。" -#: ../../library/functools.rst:739 +#: ../../library/functools.rst:741 msgid "" "The keyword arguments that will be supplied when the :class:`partial` object " "is called." msgstr "呼叫 :class:`partial` 物件時將提供的關鍵字引數。" -#: ../../library/functools.rst:742 +#: ../../library/functools.rst:744 msgid "" ":class:`partial` objects are like :class:`function` objects in that they are " "callable, weak referenceable, and can have attributes. There are some " diff --git a/library/gc.po b/library/gc.po index df8e9d8b1f..9e8bf39153 100644 --- a/library/gc.po +++ b/library/gc.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-04-24 21:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -64,11 +64,12 @@ msgid "Return ``True`` if automatic collection is enabled." msgstr "如果啟用了自動回收則回傳 ``True``。" #: ../../library/gc.rst:43 +#, fuzzy msgid "" -"With no arguments, run a full collection. The optional argument " -"*generation* may be an integer specifying which generation to collect (from " -"0 to 2). A :exc:`ValueError` is raised if the generation number is " -"invalid. The number of unreachable objects found is returned." +"Perform a collection. The optional argument *generation* may be an integer " +"specifying which generation to collect (from 0 to 2). A :exc:`ValueError` " +"is raised if the generation number is invalid. The sum of collected objects " +"and uncollectable objects is returned." msgstr "" "若被呼叫時沒有引數,則啟動完整垃圾回收。可選的引數 *generation* 可以是一個指" "明需要回收哪一代垃圾的整數(從 0 到 2)。當引數 *generation* 無效時,會引發 :" @@ -76,6 +77,23 @@ msgstr "" #: ../../library/gc.rst:48 msgid "" +"Calling ``gc.collect(0)`` will perform a GC collection on the young " +"generation." +msgstr "" + +#: ../../library/gc.rst:50 +msgid "" +"Calling ``gc.collect(1)`` will perform a GC collection on the young " +"generation and an increment of the old generation." +msgstr "" + +#: ../../library/gc.rst:53 +msgid "" +"Calling ``gc.collect(2)`` or ``gc.collect()`` performs a full collection" +msgstr "" + +#: ../../library/gc.rst:55 +msgid "" "The free lists maintained for a number of built-in types are cleared " "whenever a full collection or collection of the highest generation (2) is " "run. Not all items in some free lists may be freed due to the particular " @@ -85,13 +103,17 @@ msgstr "" "為了特定型別的實現,特別是 :class:`float`,在某些空閒列表中並非所有項目都會被" "釋放。" -#: ../../library/gc.rst:53 +#: ../../library/gc.rst:60 msgid "" "The effect of calling ``gc.collect()`` while the interpreter is already " "performing a collection is undefined." msgstr "" -#: ../../library/gc.rst:59 +#: ../../library/gc.rst:63 +msgid "``generation=1`` performs an increment of collection." +msgstr "" + +#: ../../library/gc.rst:69 msgid "" "Set the garbage collection debugging flags. Debugging information will be " "written to ``sys.stderr``. See below for a list of debugging flags which " @@ -100,25 +122,43 @@ msgstr "" "設定垃圾回收器的除錯旗標。除錯資訊會被寫入 ``sys.stderr``。請見下方的除錯旗標" "列表,可以使用位元操作 (bit operation) 進行設定以控制除錯程式。" -#: ../../library/gc.rst:66 +#: ../../library/gc.rst:76 msgid "Return the debugging flags currently set." msgstr "回傳當前設置的除錯旗標。" -#: ../../library/gc.rst:71 +#: ../../library/gc.rst:82 #, fuzzy msgid "" "Returns a list of all objects tracked by the collector, excluding the list " -"returned. If *generation* is not ``None``, return only the objects tracked " -"by the collector that are in that generation." +"returned. If *generation* is not ``None``, return only the objects as " +"follows:" msgstr "" "回傳一個包含回收器正在追蹤的所有物件的 list,除去所回傳的 list。如果 " "*generation* 不為 None,只回傳回收器正在追蹤且屬於該代的物件。" -#: ../../library/gc.rst:75 +#: ../../library/gc.rst:85 +#, fuzzy +msgid "0: All objects in the young generation" +msgstr "回傳永久代中的物件數量。" + +#: ../../library/gc.rst:86 +msgid "1: No objects, as there is no generation 1 (as of Python 3.13)" +msgstr "" + +#: ../../library/gc.rst:87 +#, fuzzy +msgid "2: All objects in the old generation" +msgstr "回傳永久代中的物件數量。" + +#: ../../library/gc.rst:89 msgid "New *generation* parameter." msgstr "新增 *generation* 參數。" -#: ../../library/gc.rst:78 +#: ../../library/gc.rst:92 +msgid "Generation 1 is removed" +msgstr "" + +#: ../../library/gc.rst:95 msgid "" "Raises an :ref:`auditing event ` ``gc.get_objects`` with argument " "``generation``." @@ -126,7 +166,7 @@ msgstr "" "引發一個附帶引數 ``generation`` 的\\ :ref:`稽核事件 (auditing event) " "` ``gc.get_objects``。" -#: ../../library/gc.rst:82 +#: ../../library/gc.rst:99 msgid "" "Return a list of three per-generation dictionaries containing collection " "statistics since interpreter start. The number of keys may change in the " @@ -136,17 +176,17 @@ msgstr "" "的垃圾回收統計資料。字典的鍵的數目在將來可能會改變,但目前每個字典包含以下項" "目:" -#: ../../library/gc.rst:87 +#: ../../library/gc.rst:104 msgid "``collections`` is the number of times this generation was collected;" msgstr "``collections`` 是該代被回收的次數;" -#: ../../library/gc.rst:89 +#: ../../library/gc.rst:106 msgid "" "``collected`` is the total number of objects collected inside this " "generation;" msgstr "``collected`` 是該代中被回收的物件總數;" -#: ../../library/gc.rst:92 +#: ../../library/gc.rst:109 msgid "" "``uncollectable`` is the total number of objects which were found to be " "uncollectable (and were therefore moved to the :data:`garbage` list) inside " @@ -155,54 +195,64 @@ msgstr "" "``uncollectable`` 是在這一代中被發現無法回收的物件總數(因此被移到 :data:" "`garbage` list 中)。" -#: ../../library/gc.rst:101 +#: ../../library/gc.rst:118 msgid "" "Set the garbage collection thresholds (the collection frequency). Setting " "*threshold0* to zero disables collection." msgstr "設定垃圾回收閾值(回收頻率)。 將 *threshold0* 設為零會停止回收。" -#: ../../library/gc.rst:104 +#: ../../library/gc.rst:121 +msgid "" +"The GC classifies objects into two generations depending on whether they " +"have survived a collection. New objects are placed in the young generation. " +"If an object survives a collection it is moved into the old generation." +msgstr "" + +#: ../../library/gc.rst:125 msgid "" -"The GC classifies objects into three generations depending on how many " -"collection sweeps they have survived. New objects are placed in the " -"youngest generation (generation ``0``). If an object survives a collection " -"it is moved into the next older generation. Since generation ``2`` is the " -"oldest generation, objects in that generation remain there after a " -"collection. In order to decide when to run, the collector keeps track of " -"the number object allocations and deallocations since the last collection. " -"When the number of allocations minus the number of deallocations exceeds " -"*threshold0*, collection starts. Initially only generation ``0`` is " -"examined. If generation ``0`` has been examined more than *threshold1* " -"times since generation ``1`` has been examined, then generation ``1`` is " -"examined as well. With the third generation, things are a bit more " -"complicated, see `Collecting the oldest generation `_ for more " -"information." -msgstr "" -"垃圾回收器會根據物件在多少次垃圾回收後仍倖存來把所有物件分類為三代。新建物件" -"會被放在最年輕代(第 ``0`` 代)。 如果一個物件在一次垃圾回收後倖存,它會被移" -"入下一個較老代。由於第 ``2`` 代是最老代,這一代的物件在一次垃圾回收後仍會保留" -"原樣。為了確定何時要執行,垃圾回收器會追蹤自上一次回收後物件分配和釋放的數" -"量。當分配數量減去釋放數量的結果大於 *threshold0* 時,垃圾回收就會開始。初始" -"時只有第 ``0`` 代會被檢查。如果自第 ``1`` 代被檢查後第 ``0`` 代已被檢查超過 " -"*threshold1* 次,則第 ``1`` 代也會被檢查。對於第三代來說,情況還會更復雜一" -"些,請參閱 `Collecting the oldest generation `_ 來了解詳情。" +"In order to decide when to run, the collector keeps track of the number of " +"object allocations and deallocations since the last collection. When the " +"number of allocations minus the number of deallocations exceeds " +"*threshold0*, collection starts. For each collection, all the objects in the " +"young generation and some fraction of the old generation is collected." +msgstr "" -#: ../../library/gc.rst:121 +#: ../../library/gc.rst:131 +msgid "" +"The fraction of the old generation that is collected is **inversely** " +"proportional to *threshold1*. The larger *threshold1* is, the slower objects " +"in the old generation are collected. For the default value of 10, 1% of the " +"old generation is scanned during each collection." +msgstr "" + +#: ../../library/gc.rst:136 +msgid "*threshold2* is ignored." +msgstr "" + +#: ../../library/gc.rst:138 +msgid "" +"See `Garbage collector design `_ for more information." +msgstr "" + +#: ../../library/gc.rst:140 +msgid "*threshold2* is ignored" +msgstr "" + +#: ../../library/gc.rst:146 msgid "" "Return the current collection counts as a tuple of ``(count0, count1, " "count2)``." msgstr "將當前回收計數以 ``(count0, count1, count2)`` 形式的 tuple 回傳。" -#: ../../library/gc.rst:127 +#: ../../library/gc.rst:152 msgid "" "Return the current collection thresholds as a tuple of ``(threshold0, " "threshold1, threshold2)``." msgstr "" "將當前回收閾值以 ``(threshold0, threshold1, threshold2)`` 形式的 tuple 回傳。" -#: ../../library/gc.rst:133 +#: ../../library/gc.rst:158 msgid "" "Return the list of objects that directly refer to any of objs. This function " "will only locate those containers which support garbage collection; " @@ -212,7 +262,7 @@ msgstr "" "回傳包含直接參照 objs 中任一個物件的物件 list。這個函式只定位支援垃圾回收的容" "器;參照了其它物件但不支援垃圾回收的擴充套件型別無法被找到。" -#: ../../library/gc.rst:138 +#: ../../library/gc.rst:163 msgid "" "Note that objects which have already been dereferenced, but which live in " "cycles and have not yet been collected by the garbage collector can be " @@ -223,7 +273,7 @@ msgstr "" "會被作為參照者出現在回傳的 list 中。若只要獲取當前正在參照的物件,需要在呼" "叫 :func:`get_referrers` 之前呼叫 :func:`collect`。" -#: ../../library/gc.rst:144 +#: ../../library/gc.rst:169 msgid "" "Care must be taken when using objects returned by :func:`get_referrers` " "because some of them could still be under construction and hence in a " @@ -234,7 +284,7 @@ msgstr "" "在建構中而處於暫時無效的狀態。不要把 :func:`get_referrers` 用於除錯以外的其它" "目的。" -#: ../../library/gc.rst:149 +#: ../../library/gc.rst:174 msgid "" "Raises an :ref:`auditing event ` ``gc.get_referrers`` with " "argument ``objs``." @@ -242,7 +292,7 @@ msgstr "" "引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` ``gc." "get_referrers``。" -#: ../../library/gc.rst:154 +#: ../../library/gc.rst:179 msgid "" "Return a list of objects directly referred to by any of the arguments. The " "referents returned are those objects visited by the arguments' C-level :c:" @@ -260,7 +310,7 @@ msgstr "" "此,可以有以下例子:一個整數對於一個引數是直接可達的,這個整數物件有可能出現" "或不出現在結果的 list 當中。" -#: ../../library/gc.rst:162 +#: ../../library/gc.rst:187 msgid "" "Raises an :ref:`auditing event ` ``gc.get_referents`` with " "argument ``objs``." @@ -268,7 +318,7 @@ msgstr "" "引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` ``gc." "get_referents``。" -#: ../../library/gc.rst:166 +#: ../../library/gc.rst:191 msgid "" "Returns ``True`` if the object is currently tracked by the garbage " "collector, ``False`` otherwise. As a general rule, instances of atomic " @@ -282,7 +332,7 @@ msgstr "" "件)會被追蹤。然而,有一些特定型別最佳化會被用來減少垃圾回收器在簡單實例(如" "只含有原子性的鍵和值的字典)上的足跡: ::" -#: ../../library/gc.rst:173 +#: ../../library/gc.rst:198 msgid "" ">>> gc.is_tracked(0)\n" "False\n" @@ -310,14 +360,14 @@ msgstr "" ">>> gc.is_tracked({\"a\": []})\n" "True" -#: ../../library/gc.rst:191 +#: ../../library/gc.rst:216 msgid "" "Returns ``True`` if the given object has been finalized by the garbage " "collector, ``False`` otherwise. ::" msgstr "" "如果給定物件已被垃圾回收器終結則回傳 ``True``,否則回傳 ``False``。: ::" -#: ../../library/gc.rst:194 +#: ../../library/gc.rst:219 msgid "" ">>> x = None\n" ">>> class Lazarus:\n" @@ -345,7 +395,7 @@ msgstr "" ">>> gc.is_finalized(x)\n" "True" -#: ../../library/gc.rst:212 +#: ../../library/gc.rst:237 msgid "" "Freeze all the objects tracked by the garbage collector; move them to a " "permanent generation and ignore them in all the future collections." @@ -353,7 +403,7 @@ msgstr "" "凍結 (freeze) 垃圾回收器所追蹤的所有物件;將它們移至永久代並忽略所有未來的收" "集動作。" -#: ../../library/gc.rst:215 +#: ../../library/gc.rst:240 msgid "" "If a process will ``fork()`` without ``exec()``, avoiding unnecessary copy-" "on-write in child processes will maximize memory sharing and reduce overall " @@ -371,23 +421,23 @@ msgstr "" "disable()``,在 ``fork()`` 之前呼叫 ``gc.freeze()``,並儘早在子行程中呼叫 " "``gc.enable()``。" -#: ../../library/gc.rst:229 +#: ../../library/gc.rst:254 msgid "" "Unfreeze the objects in the permanent generation, put them back into the " "oldest generation." msgstr "解凍 (unfreeze) 永久代中的物件,並將它們放回到最年老代中。" -#: ../../library/gc.rst:237 +#: ../../library/gc.rst:262 msgid "Return the number of objects in the permanent generation." msgstr "回傳永久代中的物件數量。" -#: ../../library/gc.rst:242 +#: ../../library/gc.rst:267 msgid "" "The following variables are provided for read-only access (you can mutate " "the values but should not rebind them):" msgstr "以下變數僅供唯讀存取(你可以修改其值但不應該重新繫結 (rebind) 它們):" -#: ../../library/gc.rst:247 +#: ../../library/gc.rst:272 msgid "" "A list of objects which the collector found to be unreachable but could not " "be freed (uncollectable objects). Starting with Python 3.4, this list " @@ -398,7 +448,7 @@ msgstr "" "開始,該 list 在大多數時候都應該是空的,除非使用了有非 ``NULL`` ``tp_del`` 槽" "位的 C 擴充套件型別的實例。" -#: ../../library/gc.rst:252 +#: ../../library/gc.rst:277 msgid "" "If :const:`DEBUG_SAVEALL` is set, then all unreachable objects will be added " "to this list rather than freed." @@ -406,7 +456,7 @@ msgstr "" "如果設定了 :const:`DEBUG_SAVEALL`,則所有不可達物件將被加進該 list 而不會被釋" "放。" -#: ../../library/gc.rst:255 +#: ../../library/gc.rst:280 msgid "" "If this list is non-empty at :term:`interpreter shutdown`, a :exc:" "`ResourceWarning` is emitted, which is silent by default. If :const:" @@ -417,7 +467,7 @@ msgstr "" "`ResourceWarning`,在預設情況下此警告不會被提醒。如果設定了 :const:" "`DEBUG_UNCOLLECTABLE`,所有無法被回收的物件會被印出。" -#: ../../library/gc.rst:261 +#: ../../library/gc.rst:286 msgid "" "Following :pep:`442`, objects with a :meth:`~object.__del__` method don't " "end up in :data:`gc.garbage` anymore." @@ -425,7 +475,7 @@ msgstr "" "根據 :pep:`442`,帶有 :meth:`~object.__del__` method 的物件最終不會在 :data:" "`gc.garbage` 內。" -#: ../../library/gc.rst:267 +#: ../../library/gc.rst:292 msgid "" "A list of callbacks that will be invoked by the garbage collector before and " "after collection. The callbacks will be called with two arguments, *phase* " @@ -434,29 +484,29 @@ msgstr "" "會被垃圾回收器在回收開始前和完成後呼叫的一系列回呼函式 (callback) 。這些回呼" "函式在被呼叫時附帶兩個引數:*phase* 和 *info*。" -#: ../../library/gc.rst:271 +#: ../../library/gc.rst:296 msgid "*phase* can be one of two values:" msgstr "*phase* 可為以下兩者之一:" -#: ../../library/gc.rst:273 +#: ../../library/gc.rst:298 msgid "\"start\": The garbage collection is about to start." msgstr "\"start\":垃圾回收即將開始。" -#: ../../library/gc.rst:275 +#: ../../library/gc.rst:300 msgid "\"stop\": The garbage collection has finished." msgstr "\"stop\":垃圾回收已結束。" -#: ../../library/gc.rst:277 +#: ../../library/gc.rst:302 msgid "" "*info* is a dict providing more information for the callback. The following " "keys are currently defined:" msgstr "*info* 是一個字典,提供回呼函式更多資訊。已有定義的鍵有:" -#: ../../library/gc.rst:280 +#: ../../library/gc.rst:305 msgid "\"generation\": The oldest generation being collected." msgstr "\"generation\"(代):正在被回收的最年老的一代。" -#: ../../library/gc.rst:282 +#: ../../library/gc.rst:307 msgid "" "\"collected\": When *phase* is \"stop\", the number of objects successfully " "collected." @@ -464,7 +514,7 @@ msgstr "" "\"collected\"(已回收的):當 *phase* 為 \"stop\" 時,被成功回收的物件的數" "目。" -#: ../../library/gc.rst:285 +#: ../../library/gc.rst:310 msgid "" "\"uncollectable\": When *phase* is \"stop\", the number of objects that " "could not be collected and were put in :data:`garbage`." @@ -472,40 +522,40 @@ msgstr "" "\"uncollectable\"(不可回收的):當 *phase* 為 \"stop\" 時,不能被回收並被放" "入 :data:`garbage` 的物件的數目。" -#: ../../library/gc.rst:288 +#: ../../library/gc.rst:313 msgid "" "Applications can add their own callbacks to this list. The primary use " "cases are:" msgstr "應用程式可以把他們自己的回呼函式加入此 list。主要的使用場景有:" -#: ../../library/gc.rst:291 +#: ../../library/gc.rst:316 msgid "" "Gathering statistics about garbage collection, such as how often various " "generations are collected, and how long the collection takes." msgstr "收集垃圾回收的統計資料,如:不同代的回收頻率、回收任務所花費的時間。" -#: ../../library/gc.rst:295 +#: ../../library/gc.rst:320 msgid "" "Allowing applications to identify and clear their own uncollectable types " "when they appear in :data:`garbage`." msgstr "" "讓應用程式可以識別和清理他們自己在 :data:`garbage` 中的不可回收型別物件。" -#: ../../library/gc.rst:301 +#: ../../library/gc.rst:326 msgid "The following constants are provided for use with :func:`set_debug`:" msgstr "以下常數是為了和 :func:`set_debug` 一起使用所提供:" -#: ../../library/gc.rst:306 +#: ../../library/gc.rst:331 msgid "" "Print statistics during collection. This information can be useful when " "tuning the collection frequency." msgstr "在回收完成後印出統計資訊。當調校回收頻率設定時,這些資訊會很有用。" -#: ../../library/gc.rst:312 +#: ../../library/gc.rst:337 msgid "Print information on collectable objects found." msgstr "當發現可回收物件時印出資訊。" -#: ../../library/gc.rst:317 +#: ../../library/gc.rst:342 msgid "" "Print information of uncollectable objects found (objects which are not " "reachable but cannot be freed by the collector). These objects will be " @@ -514,7 +564,7 @@ msgstr "" "印出找到的不可回收物件的資訊(指不能被回收器回收的不可達物件)。這些物件會被" "新增到 ``garbage`` list 中。" -#: ../../library/gc.rst:321 +#: ../../library/gc.rst:346 msgid "" "Also print the contents of the :data:`garbage` list at :term:`interpreter " "shutdown`, if it isn't empty." @@ -522,7 +572,7 @@ msgstr "" "當 :term:`interpreter shutdown`\\ (直譯器關閉)時,若 :data:`garbage` list " "不是空的,那這些內容也會被印出。" -#: ../../library/gc.rst:327 +#: ../../library/gc.rst:352 msgid "" "When set, all unreachable objects found will be appended to *garbage* rather " "than being freed. This can be useful for debugging a leaking program." @@ -530,7 +580,7 @@ msgstr "" "設定後,所有回收器找到的不可達物件會被加進 *garbage* 而不是直接被釋放。這在為" "一個記憶體流失的程式除錯時會很有用。" -#: ../../library/gc.rst:333 +#: ../../library/gc.rst:358 msgid "" "The debugging flags necessary for the collector to print information about a " "leaking program (equal to ``DEBUG_COLLECTABLE | DEBUG_UNCOLLECTABLE | " @@ -538,3 +588,31 @@ msgid "" msgstr "" "要印出記憶體流失程式之相關資訊時,回收器所需的除錯旗標。(等同於 " "``DEBUG_COLLECTABLE | DEBUG_UNCOLLECTABLE | DEBUG_SAVEALL``)。" + +#~ msgid "" +#~ "The GC classifies objects into three generations depending on how many " +#~ "collection sweeps they have survived. New objects are placed in the " +#~ "youngest generation (generation ``0``). If an object survives a " +#~ "collection it is moved into the next older generation. Since generation " +#~ "``2`` is the oldest generation, objects in that generation remain there " +#~ "after a collection. In order to decide when to run, the collector keeps " +#~ "track of the number object allocations and deallocations since the last " +#~ "collection. When the number of allocations minus the number of " +#~ "deallocations exceeds *threshold0*, collection starts. Initially only " +#~ "generation ``0`` is examined. If generation ``0`` has been examined more " +#~ "than *threshold1* times since generation ``1`` has been examined, then " +#~ "generation ``1`` is examined as well. With the third generation, things " +#~ "are a bit more complicated, see `Collecting the oldest generation " +#~ "`_ for more information." +#~ msgstr "" +#~ "垃圾回收器會根據物件在多少次垃圾回收後仍倖存來把所有物件分類為三代。新建物" +#~ "件會被放在最年輕代(第 ``0`` 代)。 如果一個物件在一次垃圾回收後倖存,它會" +#~ "被移入下一個較老代。由於第 ``2`` 代是最老代,這一代的物件在一次垃圾回收後" +#~ "仍會保留原樣。為了確定何時要執行,垃圾回收器會追蹤自上一次回收後物件分配和" +#~ "釋放的數量。當分配數量減去釋放數量的結果大於 *threshold0* 時,垃圾回收就會" +#~ "開始。初始時只有第 ``0`` 代會被檢查。如果自第 ``1`` 代被檢查後第 ``0`` 代" +#~ "已被檢查超過 *threshold1* 次,則第 ``1`` 代也會被檢查。對於第三代來說,情" +#~ "況還會更復雜一些,請參閱 `Collecting the oldest generation `_ 來了解詳情。" diff --git a/library/getopt.po b/library/getopt.po index 20967fec5b..f4467adec5 100644 --- a/library/getopt.po +++ b/library/getopt.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2016-01-31 07:19+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -26,46 +26,52 @@ msgstr ":mod:`!getopt` --- 用於命令列選項的 C 風格剖析器" msgid "**Source code:** :source:`Lib/getopt.py`" msgstr "**原始碼:**\\ :source:`Lib/getopt.py`" -#: ../../library/getopt.rst:12 +#: ../../library/getopt.rst:10 +msgid "" +"The :mod:`getopt` module is :term:`soft deprecated` and will not be " +"developed further; development will continue with the :mod:`argparse` module." +msgstr "" + +#: ../../library/getopt.rst:17 msgid "" "The :mod:`getopt` module is a parser for command line options whose API is " -"designed to be familiar to users of the C :c:func:`getopt` function. Users " -"who are unfamiliar with the C :c:func:`getopt` function or who would like to " -"write less code and get better help and error messages should consider using " -"the :mod:`argparse` module instead." +"designed to be familiar to users of the C :c:func:`!getopt` function. Users " +"who are unfamiliar with the C :c:func:`!getopt` function or who would like " +"to write less code and get better help and error messages should consider " +"using the :mod:`argparse` module instead." msgstr "" -#: ../../library/getopt.rst:20 +#: ../../library/getopt.rst:25 msgid "" "This module helps scripts to parse the command line arguments in ``sys." -"argv``. It supports the same conventions as the Unix :c:func:`getopt` " +"argv``. It supports the same conventions as the Unix :c:func:`!getopt` " "function (including the special meanings of arguments of the form '``-``' " "and '``--``'). Long options similar to those supported by GNU software may " "be used as well via an optional third argument." msgstr "" -#: ../../library/getopt.rst:26 +#: ../../library/getopt.rst:31 msgid "This module provides two functions and an exception:" msgstr "" -#: ../../library/getopt.rst:32 +#: ../../library/getopt.rst:37 msgid "" "Parses command line options and parameter list. *args* is the argument list " "to be parsed, without the leading reference to the running program. " "Typically, this means ``sys.argv[1:]``. *shortopts* is the string of option " "letters that the script wants to recognize, with options that require an " "argument followed by a colon (``':'``; i.e., the same format that Unix :c:" -"func:`getopt` uses)." +"func:`!getopt` uses)." msgstr "" -#: ../../library/getopt.rst:40 +#: ../../library/getopt.rst:45 msgid "" -"Unlike GNU :c:func:`getopt`, after a non-option argument, all further " +"Unlike GNU :c:func:`!getopt`, after a non-option argument, all further " "arguments are considered also non-options. This is similar to the way non-" "GNU Unix systems work." msgstr "" -#: ../../library/getopt.rst:44 +#: ../../library/getopt.rst:49 msgid "" "*longopts*, if specified, must be a list of strings with the names of the " "long options which should be supported. The leading ``'--'`` characters " @@ -79,7 +85,7 @@ msgid "" "uniquely, so :exc:`GetoptError` will be raised." msgstr "" -#: ../../library/getopt.rst:55 +#: ../../library/getopt.rst:60 msgid "" "The return value consists of two elements: the first is a list of ``(option, " "value)`` pairs; the second is the list of program arguments left after the " @@ -92,7 +98,7 @@ msgid "" "occurrences. Long and short options may be mixed." msgstr "" -#: ../../library/getopt.rst:68 +#: ../../library/getopt.rst:73 msgid "" "This function works like :func:`getopt`, except that GNU style scanning mode " "is used by default. This means that option and non-option arguments may be " @@ -100,41 +106,41 @@ msgid "" "a non-option argument is encountered." msgstr "" -#: ../../library/getopt.rst:73 +#: ../../library/getopt.rst:78 msgid "" "If the first character of the option string is ``'+'``, or if the " -"environment variable :envvar:`POSIXLY_CORRECT` is set, then option " +"environment variable :envvar:`!POSIXLY_CORRECT` is set, then option " "processing stops as soon as a non-option argument is encountered." msgstr "" -#: ../../library/getopt.rst:80 +#: ../../library/getopt.rst:85 msgid "" "This is raised when an unrecognized option is found in the argument list or " "when an option requiring an argument is given none. The argument to the " "exception is a string indicating the cause of the error. For long options, " "an argument given to an option which does not require one will also cause " -"this exception to be raised. The attributes :attr:`msg` and :attr:`opt` " +"this exception to be raised. The attributes :attr:`!msg` and :attr:`!opt` " "give the error message and related option; if there is no specific option to " -"which the exception relates, :attr:`opt` is an empty string." +"which the exception relates, :attr:`!opt` is an empty string." msgstr "" -#: ../../library/getopt.rst:91 +#: ../../library/getopt.rst:96 msgid "Alias for :exc:`GetoptError`; for backward compatibility." msgstr "" -#: ../../library/getopt.rst:93 +#: ../../library/getopt.rst:98 msgid "An example using only Unix style options:" msgstr "" -#: ../../library/getopt.rst:105 +#: ../../library/getopt.rst:110 msgid "Using long option names is equally easy:" msgstr "" -#: ../../library/getopt.rst:118 +#: ../../library/getopt.rst:123 msgid "In a script, typical usage is something like this::" msgstr "" -#: ../../library/getopt.rst:120 +#: ../../library/getopt.rst:125 msgid "" "import getopt, sys\n" "\n" @@ -166,14 +172,14 @@ msgid "" " main()" msgstr "" -#: ../../library/getopt.rst:147 +#: ../../library/getopt.rst:152 msgid "" "Note that an equivalent command line interface could be produced with less " "code and more informative help and error messages by using the :mod:" "`argparse` module::" msgstr "" -#: ../../library/getopt.rst:150 +#: ../../library/getopt.rst:155 msgid "" "import argparse\n" "\n" @@ -186,10 +192,10 @@ msgid "" " # ... do something with args.verbose .." msgstr "" -#: ../../library/getopt.rst:162 +#: ../../library/getopt.rst:167 msgid "Module :mod:`argparse`" msgstr ":mod:`argparse` 模組" -#: ../../library/getopt.rst:163 +#: ../../library/getopt.rst:168 msgid "Alternative command line option and argument parsing library." msgstr "" diff --git a/library/getpass.po b/library/getpass.po index aab3b473f7..19177262cd 100644 --- a/library/getpass.po +++ b/library/getpass.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-30 18:24+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-02-11 12:04+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,14 +28,14 @@ msgid "**Source code:** :source:`Lib/getpass.py`" msgstr "**原始碼:**\\ :source:`Lib/getpass.py`" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid ":ref:`Availability `: not WASI." msgstr "" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" @@ -85,12 +85,13 @@ msgid "Return the \"login name\" of the user." msgstr "回傳使用者的\"登入名稱\"。" #: ../../library/getpass.rst:45 +#, fuzzy msgid "" "This function checks the environment variables :envvar:`LOGNAME`, :envvar:" "`USER`, :envvar:`!LNAME` and :envvar:`USERNAME`, in order, and returns the " "value of the first one which is set to a non-empty string. If none are set, " "the login name from the password database is returned on systems which " -"support the :mod:`pwd` module, otherwise, an exception is raised." +"support the :mod:`pwd` module, otherwise, an :exc:`OSError` is raised." msgstr "" "此函式會按順序檢查環境變數 :envvar:`LOGNAME`、:envvar:`USER`、:envvar:`!" "LNAME` 和 :envvar:`USERNAME`,並回傳其中第一個被設定成非空字串的值。如果均未" @@ -100,3 +101,7 @@ msgstr "" #: ../../library/getpass.rst:52 msgid "In general, this function should be preferred over :func:`os.getlogin`." msgstr "大部分情況下,此函式應該要比 :func:`os.getlogin` 優先使用。" + +#: ../../library/getpass.rst:54 +msgid "Previously, various exceptions beyond just :exc:`OSError` were raised." +msgstr "" diff --git a/library/glob.po b/library/glob.po index 6c0281c504..08c7f860d9 100644 --- a/library/glob.po +++ b/library/glob.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-01-24 01:21+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -60,11 +60,11 @@ msgstr "" "對於文本 (literal) 匹配,將元字元 (meta-character) 括在方括號中。例如," "``'[?]'`` 會匹配 ``'?'`` 字元。" -#: ../../library/glob.rst:39 -msgid "The :mod:`pathlib` module offers high-level path objects." -msgstr ":mod:`pathlib` 模組提供高階路徑物件。" +#: ../../library/glob.rst:37 +msgid "The :mod:`glob` module defines the following functions:" +msgstr "" -#: ../../library/glob.rst:45 +#: ../../library/glob.rst:43 msgid "" "Return a possibly empty list of path names that match *pathname*, which must " "be a string containing a path specification. *pathname* can be either " @@ -82,7 +82,7 @@ msgstr "" "取決於檔案系統 (file system)。如果在呼叫此函式期間刪除或新增滿足條件的檔案," "則結果不一定會包含該檔案的路徑名稱。" -#: ../../library/glob.rst:54 +#: ../../library/glob.rst:52 msgid "" "If *root_dir* is not ``None``, it should be a :term:`path-like object` " "specifying the root directory for searching. It has the same effect on :" @@ -93,14 +93,14 @@ msgstr "" "object`。它在呼叫它之前更改當前目錄的影響與 :func:`glob` 相同。如果 " "*pathname* 是相對的,結果將包含相對於 *root_dir* 的路徑。" -#: ../../library/glob.rst:60 +#: ../../library/glob.rst:58 msgid "" "This function can support :ref:`paths relative to directory descriptors " "` with the *dir_fd* parameter." msgstr "" "此函式可以支援以 *dir_fd* 參數使用\\ :ref:`相對目錄描述器的路徑 `。" -#: ../../library/glob.rst:66 +#: ../../library/glob.rst:64 msgid "" "If *recursive* is true, the pattern \"``**``\" will match any files and zero " "or more directories, subdirectories and symbolic links to directories. If " @@ -111,13 +111,13 @@ msgstr "" "和目錄的符號連結。如果模式後面有 :data:`os.sep` 或 :data:`os.altsep` 那麼檔案" "將不會被匹配。" -#: ../../library/glob.rst:71 +#: ../../library/glob.rst:69 msgid "" "If *include_hidden* is true, \"``**``\" pattern will match hidden " "directories." msgstr "如果 *include_hidden* 為真,\"``**``\" 模式將匹配被隱藏的目錄。" -#: ../../library/glob.rst:73 ../../library/glob.rst:100 +#: ../../library/glob.rst:71 ../../library/glob.rst:98 msgid "" "Raises an :ref:`auditing event ` ``glob.glob`` with arguments " "``pathname``, ``recursive``." @@ -125,7 +125,7 @@ msgstr "" "引發一個附帶引數 ``pathname``、``recursive`` 的\\ :ref:`稽核事件 ` " "``glob.glob``。" -#: ../../library/glob.rst:74 ../../library/glob.rst:101 +#: ../../library/glob.rst:72 ../../library/glob.rst:99 msgid "" "Raises an :ref:`auditing event ` ``glob.glob/2`` with arguments " "``pathname``, ``recursive``, ``root_dir``, ``dir_fd``." @@ -133,31 +133,31 @@ msgstr "" "引發一個附帶引數 ``pathname``、``recursive``、``root_dir``、``dir_fd`` 的\\ :" "ref:`稽核事件 ` ``glob.glob/2``。" -#: ../../library/glob.rst:77 +#: ../../library/glob.rst:75 msgid "" "Using the \"``**``\" pattern in large directory trees may consume an " "inordinate amount of time." msgstr "在大型目錄樹中使用 \"``**``\" 模式可能會消耗過多的時間。" -#: ../../library/glob.rst:81 ../../library/glob.rst:104 +#: ../../library/glob.rst:79 ../../library/glob.rst:102 msgid "" "This function may return duplicate path names if *pathname* contains " "multiple \"``**``\" patterns and *recursive* is true." msgstr "" -#: ../../library/glob.rst:84 ../../library/glob.rst:107 +#: ../../library/glob.rst:82 ../../library/glob.rst:105 msgid "Support for recursive globs using \"``**``\"." msgstr "支援以 \"``**``\" 使用遞迴 glob。" -#: ../../library/glob.rst:87 ../../library/glob.rst:110 +#: ../../library/glob.rst:85 ../../library/glob.rst:108 msgid "Added the *root_dir* and *dir_fd* parameters." msgstr "新增 *root_dir* 與 *dir_fd* 參數。" -#: ../../library/glob.rst:90 ../../library/glob.rst:113 +#: ../../library/glob.rst:88 ../../library/glob.rst:111 msgid "Added the *include_hidden* parameter." msgstr "新增 *include_hidden* 參數。" -#: ../../library/glob.rst:97 +#: ../../library/glob.rst:95 msgid "" "Return an :term:`iterator` which yields the same values as :func:`glob` " "without actually storing them all simultaneously." @@ -165,7 +165,7 @@ msgstr "" "回傳一個會產生與 :func:`glob` 相同的值的 :term:`iterator` ,而不是同時存儲全" "部的值。" -#: ../../library/glob.rst:119 +#: ../../library/glob.rst:117 msgid "" "Escape all special characters (``'?'``, ``'*'`` and ``'['``). This is useful " "if you want to match an arbitrary literal string that may have special " @@ -180,17 +180,62 @@ msgstr "" #: ../../library/glob.rst:128 msgid "" -"For example, consider a directory containing the following files: :file:`1." -"gif`, :file:`2.txt`, :file:`card.gif` and a subdirectory :file:`sub` which " -"contains only the file :file:`3.txt`. :func:`glob` will produce the " -"following results. Notice how any leading components of the path are " -"preserved. ::" +"Convert the given path specification to a regular expression for use with :" +"func:`re.match`. The path specification can contain shell-style wildcards." +msgstr "" + +#: ../../library/glob.rst:131 +msgid "For example:" +msgstr "" + +#: ../../library/glob.rst:142 +msgid "" +"Path separators and segments are meaningful to this function, unlike :func:" +"`fnmatch.translate`. By default wildcards do not match path separators, and " +"``*`` pattern segments match precisely one path segment." +msgstr "" + +#: ../../library/glob.rst:146 +msgid "" +"If *recursive* is true, the pattern segment \"``**``\" will match any number " +"of path segments." +msgstr "" + +#: ../../library/glob.rst:149 +msgid "" +"If *include_hidden* is true, wildcards can match path segments that start " +"with a dot (``.``)." +msgstr "" + +#: ../../library/glob.rst:152 +msgid "" +"A sequence of path separators may be supplied to the *seps* argument. If not " +"given, :data:`os.sep` and :data:`~os.altsep` (if available) are used." +msgstr "" + +#: ../../library/glob.rst:157 +msgid "" +":meth:`pathlib.PurePath.full_match` and :meth:`pathlib.Path.glob` methods, " +"which call this function to implement pattern matching and globbing." +msgstr "" + +#: ../../library/glob.rst:165 +msgid "Examples" +msgstr "" + +#: ../../library/glob.rst:167 +#, fuzzy +msgid "" +"Consider a directory containing the following files: :file:`1.gif`, :file:`2." +"txt`, :file:`card.gif` and a subdirectory :file:`sub` which contains only " +"the file :file:`3.txt`. :func:`glob` will produce the following results. " +"Notice how any leading components of the path are preserved. ::" msgstr "" "例如,在一個包含以下檔案的目錄::file:`1.gif`、:file:`2.txt`、:file:`card." "gif`,和一個僅包含 :file:`3.txt` 檔案的子目錄 :file:`sub`,:func:`glob` 將產" "生以下結果。請注意路徑的任何前導部分是如何保留的。 ::" -#: ../../library/glob.rst:134 +#: ../../library/glob.rst:173 msgid "" ">>> import glob\n" ">>> glob.glob('./[0-9].*')\n" @@ -216,7 +261,7 @@ msgstr "" ">>> glob.glob('./**/', recursive=True)\n" "['./', './sub/']" -#: ../../library/glob.rst:146 +#: ../../library/glob.rst:185 msgid "" "If the directory contains files starting with ``.`` they won't be matched by " "default. For example, consider a directory containing :file:`card.gif` and :" @@ -225,7 +270,7 @@ msgstr "" "如果目錄包含以 ``.`` 開頭的檔案,則預設情況下不會去匹配到它們。例如,一個包" "含 :file:`card.gif` 和 :file:`.card.gif` 的目錄: ::" -#: ../../library/glob.rst:150 +#: ../../library/glob.rst:189 msgid "" ">>> import glob\n" ">>> glob.glob('*.gif')\n" @@ -239,14 +284,16 @@ msgstr "" ">>> glob.glob('.c*')\n" "['.card.gif']" -#: ../../library/glob.rst:158 -msgid "Module :mod:`fnmatch`" -msgstr ":mod:`fnmatch` 模組" - -#: ../../library/glob.rst:159 -msgid "Shell-style filename (not path) expansion" +#: ../../library/glob.rst:196 +#, fuzzy +msgid "" +"The :mod:`fnmatch` module offers shell-style filename (not path) expansion." msgstr "Shell 風格檔案名(不是路徑)的擴展" +#: ../../library/glob.rst:199 +msgid "The :mod:`pathlib` module offers high-level path objects." +msgstr ":mod:`pathlib` 模組提供高階路徑物件。" + #: ../../library/glob.rst:9 msgid "filenames" msgstr "filenames(檔案名稱)" @@ -259,7 +306,7 @@ msgstr "pathname expansion(路徑名稱展開)" msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/glob.rst:13 ../../library/glob.rst:63 +#: ../../library/glob.rst:13 ../../library/glob.rst:61 msgid "in glob-style wildcards" msgstr "於 glob 風格的萬用字元中" @@ -283,6 +330,9 @@ msgstr "- (減號)" msgid ". (dot)" msgstr ". (點)" -#: ../../library/glob.rst:63 +#: ../../library/glob.rst:61 msgid "**" msgstr "**" + +#~ msgid "Module :mod:`fnmatch`" +#~ msgstr ":mod:`fnmatch` 模組" diff --git a/library/grp.po b/library/grp.po index 25d2f0707b..00ca37fb41 100644 --- a/library/grp.po +++ b/library/grp.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,7 +29,8 @@ msgid "" msgstr "" #: ../../library/grp.rst:13 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +#, fuzzy +msgid ":ref:`Availability `: Unix, not WASI, not iOS." msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" #: ../../library/grp.rst:15 @@ -143,13 +144,8 @@ msgstr ":mod:`pwd` 模組" msgid "An interface to the user database, similar to this." msgstr "" -#: ../../library/grp.rst:67 -msgid "Module :mod:`spwd`" -msgstr ":mod:`spwd` 模組" - -#: ../../library/grp.rst:68 -msgid "An interface to the shadow password database, similar to this." -msgstr "" +#~ msgid "Module :mod:`spwd`" +#~ msgstr ":mod:`spwd` 模組" #~ msgid "" #~ "This module does not work or is not available on WebAssembly platforms " diff --git a/library/gzip.po b/library/gzip.po index c5f0496a55..d2643f46da 100644 --- a/library/gzip.po +++ b/library/gzip.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -105,7 +105,7 @@ msgstr "" msgid "Added support for the ``'x'``, ``'xb'`` and ``'xt'`` modes." msgstr "新增 ``'x'``、``'xb'`` 和 ``'xt'`` 模式的支援。" -#: ../../library/gzip.rst:59 ../../library/gzip.rst:171 +#: ../../library/gzip.rst:59 ../../library/gzip.rst:175 msgid "Accepts a :term:`path-like object`." msgstr "接受\\ :term:`類路徑物件 `。" @@ -168,14 +168,19 @@ msgstr "" #: ../../library/gzip.rst:103 msgid "" -"The *mtime* argument is an optional numeric timestamp to be written to the " -"last modification time field in the stream when compressing. It should only " -"be provided in compression mode. If omitted or ``None``, the current time " -"is used. See the :attr:`mtime` attribute for more details." +"The optional *mtime* argument is the timestamp requested by gzip. The time " +"is in Unix format, i.e., seconds since 00:00:00 UTC, January 1, 1970. If " +"*mtime* is omitted or ``None``, the current time is used. Use *mtime* = 0 to " +"generate a compressed stream that does not depend on creation time." msgstr "" #: ../../library/gzip.rst:108 msgid "" +"See below for the :attr:`mtime` attribute that is set when decompressing." +msgstr "" + +#: ../../library/gzip.rst:110 +msgid "" "Calling a :class:`GzipFile` object's :meth:`!close` method does not close " "*fileobj*, since you might wish to append more material after the compressed " "data. This also allows you to pass an :class:`io.BytesIO` object opened for " @@ -183,105 +188,103 @@ msgid "" "class:`io.BytesIO` object's :meth:`~io.BytesIO.getvalue` method." msgstr "" -#: ../../library/gzip.rst:114 +#: ../../library/gzip.rst:116 msgid "" ":class:`GzipFile` supports the :class:`io.BufferedIOBase` interface, " "including iteration and the :keyword:`with` statement. Only the :meth:`~io." "IOBase.truncate` method isn't implemented." msgstr "" -#: ../../library/gzip.rst:118 +#: ../../library/gzip.rst:120 msgid ":class:`GzipFile` also provides the following method and attribute:" msgstr ":class:`GzipFile` 也提供了以下的方法和屬性:" -#: ../../library/gzip.rst:122 +#: ../../library/gzip.rst:124 msgid "" "Read *n* uncompressed bytes without advancing the file position. At most one " "single read on the compressed stream is done to satisfy the call. The " "number of bytes returned may be more or less than requested." msgstr "" -#: ../../library/gzip.rst:127 +#: ../../library/gzip.rst:129 msgid "" "While calling :meth:`peek` does not change the file position of the :class:" "`GzipFile`, it may change the position of the underlying file object (e.g. " "if the :class:`GzipFile` was constructed with the *fileobj* parameter)." msgstr "" -#: ../../library/gzip.rst:136 -msgid "" -"When decompressing, the value of the last modification time field in the " -"most recently read header may be read from this attribute, as an integer. " -"The initial value before reading any headers is ``None``." +#: ../../library/gzip.rst:138 +msgid "``'rb'`` for reading and ``'wb'`` for writing." msgstr "" #: ../../library/gzip.rst:140 +msgid "In previous versions it was an integer ``1`` or ``2``." +msgstr "" + +#: ../../library/gzip.rst:145 msgid "" -"All :program:`gzip` compressed streams are required to contain this " -"timestamp field. Some programs, such as :program:`gunzip`\\ , make use of " -"the timestamp. The format is the same as the return value of :func:`time." -"time` and the :attr:`~os.stat_result.st_mtime` attribute of the object " -"returned by :func:`os.stat`." +"When decompressing, this attribute is set to the last timestamp in the most " +"recently read header. It is an integer, holding the number of seconds since " +"the Unix epoch (00:00:00 UTC, January 1, 1970). The initial value before " +"reading any headers is ``None``." msgstr "" -#: ../../library/gzip.rst:148 +#: ../../library/gzip.rst:152 msgid "" "The path to the gzip file on disk, as a :class:`str` or :class:`bytes`. " "Equivalent to the output of :func:`os.fspath` on the original input path, " "with no other normalization, resolution or expansion." msgstr "" -#: ../../library/gzip.rst:152 +#: ../../library/gzip.rst:156 msgid "" "Support for the :keyword:`with` statement was added, along with the *mtime* " "constructor argument and :attr:`mtime` attribute." msgstr "" -#: ../../library/gzip.rst:156 +#: ../../library/gzip.rst:160 msgid "Support for zero-padded and unseekable files was added." msgstr "" -#: ../../library/gzip.rst:159 +#: ../../library/gzip.rst:163 msgid "The :meth:`io.BufferedIOBase.read1` method is now implemented." msgstr ":meth:`io.BufferedIOBase.read1` 方法現在已有實作。" -#: ../../library/gzip.rst:162 +#: ../../library/gzip.rst:166 msgid "Added support for the ``'x'`` and ``'xb'`` modes." msgstr "新增 ``'x'`` 和 ``'xb'`` 模式的支援。" -#: ../../library/gzip.rst:165 +#: ../../library/gzip.rst:169 msgid "" "Added support for writing arbitrary :term:`bytes-like objects `. The :meth:`~io.BufferedIOBase.read` method now accepts an argument " "of ``None``." msgstr "" -#: ../../library/gzip.rst:174 -msgid "" -"Remove the ``filename`` attribute, use the :attr:`~GzipFile.name` attribute " -"instead." -msgstr "" - #: ../../library/gzip.rst:178 msgid "" "Opening :class:`GzipFile` for writing without specifying the *mode* argument " "is deprecated." msgstr "" -#: ../../library/gzip.rst:185 +#: ../../library/gzip.rst:182 +msgid "" +"Remove the ``filename`` attribute, use the :attr:`~GzipFile.name` attribute " +"instead." +msgstr "" + +#: ../../library/gzip.rst:189 msgid "" "Compress the *data*, returning a :class:`bytes` object containing the " "compressed data. *compresslevel* and *mtime* have the same meaning as in " -"the :class:`GzipFile` constructor above. When *mtime* is set to ``0``, this " -"function is equivalent to :func:`zlib.compress` with *wbits* set to ``31``. " -"The zlib function is faster." +"the :class:`GzipFile` constructor above." msgstr "" -#: ../../library/gzip.rst:192 +#: ../../library/gzip.rst:194 msgid "Added the *mtime* parameter for reproducible output." msgstr "" -#: ../../library/gzip.rst:194 +#: ../../library/gzip.rst:196 msgid "" "Speed is improved by compressing all data at once instead of in a streamed " "fashion. Calls with *mtime* set to ``0`` are delegated to :func:`zlib." @@ -292,6 +295,12 @@ msgstr "" #: ../../library/gzip.rst:203 msgid "" +"The gzip header OS byte is guaranteed to be set to 255 when this function is " +"used as was the case in 3.10 and earlier." +msgstr "" + +#: ../../library/gzip.rst:209 +msgid "" "Decompress the *data*, returning a :class:`bytes` object containing the " "uncompressed data. This function is capable of decompressing multi-member " "gzip data (multiple gzip blocks concatenated together). When the data is " @@ -299,21 +308,21 @@ msgid "" "*wbits* set to 31 is faster." msgstr "" -#: ../../library/gzip.rst:210 +#: ../../library/gzip.rst:216 msgid "" "Speed is improved by decompressing members at once in memory instead of in a " "streamed fashion." msgstr "" -#: ../../library/gzip.rst:217 +#: ../../library/gzip.rst:223 msgid "Examples of usage" msgstr "用法範例" -#: ../../library/gzip.rst:219 +#: ../../library/gzip.rst:225 msgid "Example of how to read a compressed file::" msgstr "如何讀取壓縮檔案的範例: ::" -#: ../../library/gzip.rst:221 +#: ../../library/gzip.rst:227 msgid "" "import gzip\n" "with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" @@ -323,11 +332,11 @@ msgstr "" "with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" " file_content = f.read()" -#: ../../library/gzip.rst:225 +#: ../../library/gzip.rst:231 msgid "Example of how to create a compressed GZIP file::" msgstr "如何建立一個壓縮的 GZIP 檔案的範例: ::" -#: ../../library/gzip.rst:227 +#: ../../library/gzip.rst:233 msgid "" "import gzip\n" "content = b\"Lots of content here\"\n" @@ -339,11 +348,11 @@ msgstr "" "with gzip.open('/home/joe/file.txt.gz', 'wb') as f:\n" " f.write(content)" -#: ../../library/gzip.rst:232 +#: ../../library/gzip.rst:238 msgid "Example of how to GZIP compress an existing file::" msgstr "如何壓縮一個已存在的檔案的範例: ::" -#: ../../library/gzip.rst:234 +#: ../../library/gzip.rst:240 msgid "" "import gzip\n" "import shutil\n" @@ -357,11 +366,11 @@ msgstr "" " with gzip.open('/home/joe/file.txt.gz', 'wb') as f_out:\n" " shutil.copyfileobj(f_in, f_out)" -#: ../../library/gzip.rst:240 +#: ../../library/gzip.rst:246 msgid "Example of how to GZIP compress a binary string::" msgstr "如何壓縮一個二進位字串的範例: ::" -#: ../../library/gzip.rst:242 +#: ../../library/gzip.rst:248 msgid "" "import gzip\n" "s_in = b\"Lots of content here\"\n" @@ -371,56 +380,56 @@ msgstr "" "s_in = b\"Lots of content here\"\n" "s_out = gzip.compress(s_in)" -#: ../../library/gzip.rst:248 +#: ../../library/gzip.rst:254 msgid "Module :mod:`zlib`" msgstr ":mod:`zlib` 模組" -#: ../../library/gzip.rst:249 +#: ../../library/gzip.rst:255 msgid "" "The basic data compression module needed to support the :program:`gzip` file " "format." msgstr "" -#: ../../library/gzip.rst:258 +#: ../../library/gzip.rst:264 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/gzip.rst:260 +#: ../../library/gzip.rst:266 msgid "" "The :mod:`gzip` module provides a simple command line interface to compress " "or decompress files." msgstr "" -#: ../../library/gzip.rst:263 +#: ../../library/gzip.rst:269 msgid "Once executed the :mod:`gzip` module keeps the input file(s)." msgstr "" -#: ../../library/gzip.rst:267 +#: ../../library/gzip.rst:273 msgid "" "Add a new command line interface with a usage. By default, when you will " "execute the CLI, the default compression level is 6." msgstr "" -#: ../../library/gzip.rst:271 +#: ../../library/gzip.rst:277 msgid "Command line options" msgstr "命令列選項" -#: ../../library/gzip.rst:275 +#: ../../library/gzip.rst:281 msgid "If *file* is not specified, read from :data:`sys.stdin`." msgstr "如果未指定 *file*,則從 :data:`sys.stdin` 讀取。" -#: ../../library/gzip.rst:279 +#: ../../library/gzip.rst:285 msgid "Indicates the fastest compression method (less compression)." msgstr "" -#: ../../library/gzip.rst:283 +#: ../../library/gzip.rst:289 msgid "Indicates the slowest compression method (best compression)." msgstr "" -#: ../../library/gzip.rst:287 +#: ../../library/gzip.rst:293 msgid "Decompress the given file." msgstr "解壓縮指定的檔案。" -#: ../../library/gzip.rst:291 +#: ../../library/gzip.rst:297 msgid "Show the help message." msgstr "顯示幫助訊息。" diff --git a/library/hashlib.po b/library/hashlib.po index aacf8a8a13..c3eba1ece2 100644 --- a/library/hashlib.po +++ b/library/hashlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-05-11 16:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -511,17 +511,17 @@ msgstr "" "*n* 是 CPU/記憶體開銷係數、*r* 是區塊大小、*p* 為平行化係數、*maxmem* 為記憶" "體限制(OpenSSL 1.1.0 預設為 32 MiB)。*dklen* 是生成密鑰的長度。" -#: ../../library/hashlib.rst:366 +#: ../../library/hashlib.rst:368 msgid "BLAKE2" msgstr "BLAKE2" -#: ../../library/hashlib.rst:373 +#: ../../library/hashlib.rst:375 msgid "" "BLAKE2_ is a cryptographic hash function defined in :rfc:`7693` that comes " "in two flavors:" msgstr "BLAKE2_ 是在 :rfc:`7693` 中定義的加密雜湊函式,有兩種類型:" -#: ../../library/hashlib.rst:376 +#: ../../library/hashlib.rst:378 msgid "" "**BLAKE2b**, optimized for 64-bit platforms and produces digests of any size " "between 1 and 64 bytes," @@ -529,7 +529,7 @@ msgstr "" "**BLAKE2b**,針對 64 位元平台進行了最佳化,可生成 1 到 64 位元組之間任意大小" "的摘要," -#: ../../library/hashlib.rst:379 +#: ../../library/hashlib.rst:381 msgid "" "**BLAKE2s**, optimized for 8- to 32-bit platforms and produces digests of " "any size between 1 and 32 bytes." @@ -537,7 +537,7 @@ msgstr "" "**BLAKE2s**,針對 8 至 32 位元平台進行了最佳化,可生成 1 至 32 位元組之間任意" "大小的摘要。" -#: ../../library/hashlib.rst:382 +#: ../../library/hashlib.rst:384 msgid "" "BLAKE2 supports **keyed mode** (a faster and simpler replacement for HMAC_), " "**salted hashing**, **personalization**, and **tree hashing**." @@ -545,21 +545,21 @@ msgstr "" "BLAKE2 支援\\ **密鑰模式 (keyed mode)** (更快、更簡單的 HMAC_ 替代品)、**加" "鹽雜湊 (salted hashing)**、**個人化**\\ 和\\ **樹狀雜湊**。" -#: ../../library/hashlib.rst:385 +#: ../../library/hashlib.rst:387 msgid "" "Hash objects from this module follow the API of standard library's :mod:" "`hashlib` objects." msgstr "該模組中的雜湊物件遵循標準函式庫的 :mod:`hashlib` 物件 API。" -#: ../../library/hashlib.rst:390 +#: ../../library/hashlib.rst:392 msgid "Creating hash objects" msgstr "建立雜湊物件" -#: ../../library/hashlib.rst:392 +#: ../../library/hashlib.rst:394 msgid "New hash objects are created by calling constructor functions:" msgstr "新的雜湊物件是透過呼叫建構函式建立的:" -#: ../../library/hashlib.rst:406 +#: ../../library/hashlib.rst:408 msgid "" "These functions return the corresponding hash objects for calculating " "BLAKE2b or BLAKE2s. They optionally take these general parameters:" @@ -567,7 +567,7 @@ msgstr "" "這些函式回傳相應的雜湊物件以計算 BLAKE2b 或 BLAKE2s。他們可以選擇採用這些通用" "參數:" -#: ../../library/hashlib.rst:409 +#: ../../library/hashlib.rst:411 msgid "" "*data*: initial chunk of data to hash, which must be :term:`bytes-like " "object`. It can be passed only as positional argument." @@ -575,18 +575,18 @@ msgstr "" "*data*:要雜湊的初始資料塊 (data chunk),它必須是\\ :term:`類位元組物件 " "`。它只能作為位置引數傳遞。" -#: ../../library/hashlib.rst:412 +#: ../../library/hashlib.rst:414 msgid "*digest_size*: size of output digest in bytes." msgstr "*digest_size*:輸出摘要的大小(以位元組為單位)。" -#: ../../library/hashlib.rst:414 +#: ../../library/hashlib.rst:416 msgid "" "*key*: key for keyed hashing (up to 64 bytes for BLAKE2b, up to 32 bytes for " "BLAKE2s)." msgstr "" "*key*:用於密鑰雜湊的密鑰(BLAKE2b 最多 64 位元組、BLAKE2s 最多 32 位元組)。" -#: ../../library/hashlib.rst:417 +#: ../../library/hashlib.rst:419 msgid "" "*salt*: salt for randomized hashing (up to 16 bytes for BLAKE2b, up to 8 " "bytes for BLAKE2s)." @@ -594,62 +594,62 @@ msgstr "" "*salt*:用於隨機雜湊的鹽(BLAKE2b 最多 16 個位元組、BLAKE2s 最多 8 個位元" "組)。" -#: ../../library/hashlib.rst:420 +#: ../../library/hashlib.rst:422 msgid "" "*person*: personalization string (up to 16 bytes for BLAKE2b, up to 8 bytes " "for BLAKE2s)." msgstr "" "*person*:個人化字串(BLAKE2b 最多 16 個位元組、BLAKE2s 最多 8 個位元組)。" -#: ../../library/hashlib.rst:423 +#: ../../library/hashlib.rst:425 msgid "The following table shows limits for general parameters (in bytes):" msgstr "下表顯示了一般參數的限制(以位元組為單位):" -#: ../../library/hashlib.rst:426 +#: ../../library/hashlib.rst:428 msgid "Hash" msgstr "雜湊" -#: ../../library/hashlib.rst:426 +#: ../../library/hashlib.rst:428 msgid "digest_size" msgstr "digest_size" -#: ../../library/hashlib.rst:426 +#: ../../library/hashlib.rst:428 msgid "len(key)" msgstr "len(key)" -#: ../../library/hashlib.rst:426 +#: ../../library/hashlib.rst:428 msgid "len(salt)" msgstr "len(salt)" -#: ../../library/hashlib.rst:426 +#: ../../library/hashlib.rst:428 msgid "len(person)" msgstr "len(person)" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:430 msgid "BLAKE2b" msgstr "BLAKE2b" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:430 msgid "64" msgstr "64" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:430 msgid "16" msgstr "16" -#: ../../library/hashlib.rst:429 +#: ../../library/hashlib.rst:431 msgid "BLAKE2s" msgstr "BLAKE2s" -#: ../../library/hashlib.rst:429 +#: ../../library/hashlib.rst:431 msgid "32" msgstr "32" -#: ../../library/hashlib.rst:429 +#: ../../library/hashlib.rst:431 msgid "8" msgstr "8" -#: ../../library/hashlib.rst:434 +#: ../../library/hashlib.rst:436 msgid "" "BLAKE2 specification defines constant lengths for salt and personalization " "parameters, however, for convenience, this implementation accepts byte " @@ -663,26 +663,26 @@ msgstr "" "以像是 ``b'salt`` 和 ``b'salt\\x00`` 是相同的值。(但 *key* 的情況並非如" "此。)" -#: ../../library/hashlib.rst:441 +#: ../../library/hashlib.rst:443 msgid "These sizes are available as module `constants`_ described below." msgstr "這些大小可作為模組\\ `常數 `_\\ 使用,如下所述。" -#: ../../library/hashlib.rst:443 +#: ../../library/hashlib.rst:445 msgid "" "Constructor functions also accept the following tree hashing parameters:" msgstr "建構函式還接受以下樹狀雜湊參數:" -#: ../../library/hashlib.rst:445 +#: ../../library/hashlib.rst:447 msgid "*fanout*: fanout (0 to 255, 0 if unlimited, 1 in sequential mode)." msgstr "*fanout*:扇出(0 到 255,如果無限制則為 0、順序模式為 1)。" -#: ../../library/hashlib.rst:447 +#: ../../library/hashlib.rst:449 msgid "" "*depth*: maximal depth of tree (1 to 255, 255 if unlimited, 1 in sequential " "mode)." msgstr "*depth*:樹的最大深度(1 到 255,如果無限制則為 255、順序模式為 1)。" -#: ../../library/hashlib.rst:450 +#: ../../library/hashlib.rst:452 msgid "" "*leaf_size*: maximal byte length of leaf (0 to ``2**32-1``, 0 if unlimited " "or in sequential mode)." @@ -690,7 +690,7 @@ msgstr "" "*leaf_size*:葉的最大位元組長度(0 到 ``2**32-1``,如果無限制或處於順序模式則" "為 0)。" -#: ../../library/hashlib.rst:453 +#: ../../library/hashlib.rst:455 msgid "" "*node_offset*: node offset (0 to ``2**64-1`` for BLAKE2b, 0 to ``2**48-1`` " "for BLAKE2s, 0 for the first, leftmost, leaf, or in sequential mode)." @@ -698,12 +698,12 @@ msgstr "" "*node_offset*:節點偏移量(BLAKE2b 為 0 到 ``2**64-1``,BLAKE2s 為 0 到 " "``2**48-1``,0 表示第一個、最左邊、葉子或在順序模式下)。" -#: ../../library/hashlib.rst:456 +#: ../../library/hashlib.rst:458 msgid "" "*node_depth*: node depth (0 to 255, 0 for leaves, or in sequential mode)." msgstr "*node_depth*:節點深度(0 到 255,葉為 0,或在順序模式下)。" -#: ../../library/hashlib.rst:458 +#: ../../library/hashlib.rst:460 msgid "" "*inner_size*: inner digest size (0 to 64 for BLAKE2b, 0 to 32 for BLAKE2s, 0 " "in sequential mode)." @@ -711,18 +711,18 @@ msgstr "" "*inner_size*:內部摘要大小(BLAKE2b 為 0 到 64,BLAKE2s 為 0 到 32,順序模式" "為 0)。" -#: ../../library/hashlib.rst:461 +#: ../../library/hashlib.rst:463 msgid "" "*last_node*: boolean indicating whether the processed node is the last one " "(``False`` for sequential mode)." msgstr "" "*last_node*:布林值,代表處理的節點是否為最後一個(``False`` 代表順序模式)。" -#: ../../library/hashlib.rst:464 +#: ../../library/hashlib.rst:466 msgid "Explanation of tree mode parameters." msgstr "樹狀模式參數說明。" -#: ../../library/hashlib.rst:468 +#: ../../library/hashlib.rst:470 msgid "" "See section 2.10 in `BLAKE2 specification `_ for comprehensive review of tree hashing." @@ -730,36 +730,36 @@ msgstr "" "關於樹狀雜湊的綜合回顧,請參閱 `BLAKE2 規範 `_\\ 中的第 2.10 節。" -#: ../../library/hashlib.rst:474 +#: ../../library/hashlib.rst:476 msgid "Constants" msgstr "常數" -#: ../../library/hashlib.rst:479 +#: ../../library/hashlib.rst:481 msgid "Salt length (maximum length accepted by constructors)." msgstr "鹽長度(建構函式接受的最大長度)。" -#: ../../library/hashlib.rst:485 +#: ../../library/hashlib.rst:487 msgid "" "Personalization string length (maximum length accepted by constructors)." msgstr "個人化字串長度(建構函式接受的最大長度)。" -#: ../../library/hashlib.rst:491 +#: ../../library/hashlib.rst:493 msgid "Maximum key size." msgstr "最大密鑰大小。" -#: ../../library/hashlib.rst:497 +#: ../../library/hashlib.rst:499 msgid "Maximum digest size that the hash function can output." msgstr "雜湊函式可以輸出的最大摘要大小。" -#: ../../library/hashlib.rst:501 +#: ../../library/hashlib.rst:503 msgid "Examples" msgstr "範例" -#: ../../library/hashlib.rst:504 +#: ../../library/hashlib.rst:506 msgid "Simple hashing" msgstr "簡單雜湊" -#: ../../library/hashlib.rst:506 +#: ../../library/hashlib.rst:508 msgid "" "To calculate hash of some data, you should first construct a hash object by " "calling the appropriate constructor function (:func:`blake2b` or :func:" @@ -772,7 +772,7 @@ msgstr "" "update` 來以資料對它更新,最後透過呼叫 :meth:`~hash.digest`\\ (或對於十六進" "位編碼字串則為 :meth:`~hash.hexdigest`)從物件中獲得摘要。" -#: ../../library/hashlib.rst:519 +#: ../../library/hashlib.rst:521 msgid "" "As a shortcut, you can pass the first chunk of data to update directly to " "the constructor as the positional argument:" @@ -780,17 +780,17 @@ msgstr "" "作為一個快捷方式,你可以將要更新的第一個資料塊作為位置引數直接傳遞給建構函" "式:" -#: ../../library/hashlib.rst:526 +#: ../../library/hashlib.rst:528 msgid "" "You can call :meth:`hash.update` as many times as you need to iteratively " "update the hash:" msgstr "你可以根據需求來多次呼叫 :meth:`hash.update` 以疊代更新雜湊:" -#: ../../library/hashlib.rst:540 +#: ../../library/hashlib.rst:542 msgid "Using different digest sizes" msgstr "使用不同的摘要大小" -#: ../../library/hashlib.rst:542 +#: ../../library/hashlib.rst:544 msgid "" "BLAKE2 has configurable size of digests up to 64 bytes for BLAKE2b and up to " "32 bytes for BLAKE2s. For example, to replace SHA-1 with BLAKE2b without " @@ -800,7 +800,7 @@ msgstr "" "組。例如,要在不改變輸出大小的情況下用 BLAKE2b 替換 SHA-1,我們可以指定 " "BLAKE2b 生成 20 位元組的摘要:" -#: ../../library/hashlib.rst:556 +#: ../../library/hashlib.rst:558 msgid "" "Hash objects with different digest sizes have completely different outputs " "(shorter hashes are *not* prefixes of longer hashes); BLAKE2b and BLAKE2s " @@ -809,11 +809,11 @@ msgstr "" "具有不同摘要大小的雜湊物件具有完全不同的輸出(較短的雜湊值\\ *不是*\\ 較長雜" "湊值的前綴);即使輸出長度相同,BLAKE2b 和 BLAKE2s 也會產生不同的輸出:" -#: ../../library/hashlib.rst:572 +#: ../../library/hashlib.rst:574 msgid "Keyed hashing" msgstr "密鑰雜湊 (Keyed hashing)" -#: ../../library/hashlib.rst:574 +#: ../../library/hashlib.rst:576 msgid "" "Keyed hashing can be used for authentication as a faster and simpler " "replacement for `Hash-based message authentication code >> from hashlib import blake2b\n" ">>> h = blake2b(key=b'pseudorandom key', digest_size=16)\n" @@ -847,7 +847,7 @@ msgstr "" ">>> h.hexdigest()\n" "'3d363ff7401e02026f4a4687d4863ced'" -#: ../../library/hashlib.rst:590 +#: ../../library/hashlib.rst:592 msgid "" "As a practical example, a web application can symmetrically sign cookies " "sent to users and later verify them to make sure they weren't tampered with::" @@ -855,7 +855,7 @@ msgstr "" "舉一個實際的例子,網頁應用程式可以對發送給使用者的 cookie 進行對稱簽名 " "(symmetrically sign),然後驗證它們以確保它們沒有被篡改: ::" -#: ../../library/hashlib.rst:593 +#: ../../library/hashlib.rst:595 msgid "" ">>> from hashlib import blake2b\n" ">>> from hmac import compare_digest\n" @@ -909,7 +909,7 @@ msgstr "" ">>> verify(cookie, b'0102030405060708090a0b0c0d0e0f00')\n" "False" -#: ../../library/hashlib.rst:619 +#: ../../library/hashlib.rst:621 msgid "" "Even though there's a native keyed hashing mode, BLAKE2 can, of course, be " "used in HMAC construction with :mod:`hmac` module::" @@ -917,7 +917,7 @@ msgstr "" "儘管有原生密鑰雜湊模式,BLAKE2 還是可以透過 :mod:`hmac` 模組用於建構 " "HMAC: ::" -#: ../../library/hashlib.rst:622 +#: ../../library/hashlib.rst:624 msgid "" ">>> import hmac, hashlib\n" ">>> m = hmac.new(b'secret key', digestmod=hashlib.blake2s)\n" @@ -931,11 +931,11 @@ msgstr "" ">>> m.hexdigest()\n" "'e3c8102868d28b5ff85fc35dda07329970d1a01e273c37481326fe0c861c8142'" -#: ../../library/hashlib.rst:630 +#: ../../library/hashlib.rst:632 msgid "Randomized hashing" msgstr "隨機雜湊 (Randomized hashing)" -#: ../../library/hashlib.rst:632 +#: ../../library/hashlib.rst:634 msgid "" "By setting *salt* parameter users can introduce randomization to the hash " "function. Randomized hashing is useful for protecting against collision " @@ -944,7 +944,7 @@ msgstr "" "透過設定 *salt* 參數,使用者可以向雜湊函式引入隨機化。隨機雜湊在防止針對數位" "簽章中雜湊函式的碰撞攻擊 (collision attacks) 非常有用。" -#: ../../library/hashlib.rst:636 +#: ../../library/hashlib.rst:638 msgid "" "Randomized hashing is designed for situations where one party, the message " "preparer, generates all or part of a message to be signed by a second party, " @@ -975,15 +975,16 @@ msgstr "" "的所有部分都是由簽名者所準備好的,使用隨機雜湊可能會降低數位簽章提供的安全" "性。" -#: ../../library/hashlib.rst:655 +#: ../../library/hashlib.rst:657 +#, fuzzy msgid "" "(`NIST SP-800-106 \"Randomized Hashing for Digital Signatures\" `_)" +"csrc.nist.gov/publications/detail/sp/800-106/archive/2009-02-25>`_)" msgstr "" "(`NIST SP-800-106 「數位簽章的隨機雜湊 (Randomized Hashing for Digital " "Signatures)」 `_)" -#: ../../library/hashlib.rst:658 +#: ../../library/hashlib.rst:660 msgid "" "In BLAKE2 the salt is processed as a one-time input to the hash function " "during initialization, rather than as an input to each compression function." @@ -991,7 +992,7 @@ msgstr "" "在 BLAKE2 中,鹽在初始化期間作為雜湊函式的一次性輸入被處理,而不是作為每個壓" "縮函式的輸入。" -#: ../../library/hashlib.rst:663 +#: ../../library/hashlib.rst:665 msgid "" "*Salted hashing* (or just hashing) with BLAKE2 or any other general-purpose " "cryptographic hash function, such as SHA-256, is not suitable for hashing " @@ -1002,11 +1003,11 @@ msgstr "" "純雜湊)不適合對密碼進行雜湊處理。有關更多資訊,請參閱 `BLAKE2 FAQ `_ 。" -#: ../../library/hashlib.rst:686 +#: ../../library/hashlib.rst:688 msgid "Personalization" msgstr "個人化" -#: ../../library/hashlib.rst:688 +#: ../../library/hashlib.rst:690 msgid "" "Sometimes it is useful to force hash function to produce different digests " "for the same input for different purposes. Quoting the authors of the Skein " @@ -1015,7 +1016,7 @@ msgstr "" "有時候強制雜湊函式為不同目的的相同輸入生成不同的摘要是很有用的。引用 Skein 雜" "湊函式的作者的話:" -#: ../../library/hashlib.rst:692 +#: ../../library/hashlib.rst:694 msgid "" "We recommend that all application designers seriously consider doing this; " "we have seen many protocols where a hash that is computed in one part of the " @@ -1029,7 +1030,7 @@ msgstr "" "關的資料上完成的,並且攻擊者可以強制應用程式將雜湊輸入設為相同的。對協議中使" "用的每個雜湊函式進行個人化可以立即阻止此類攻擊。" -#: ../../library/hashlib.rst:699 +#: ../../library/hashlib.rst:701 msgid "" "(`The Skein Hash Function Family `_, p. 21)" @@ -1037,11 +1038,11 @@ msgstr "" "(`Skein 雜湊函式系列 `_,第 21 頁)" -#: ../../library/hashlib.rst:703 +#: ../../library/hashlib.rst:705 msgid "BLAKE2 can be personalized by passing bytes to the *person* argument::" msgstr "BLAKE2 可以透過將位元組傳遞給 *person* 引數來做個人化: ::" -#: ../../library/hashlib.rst:705 +#: ../../library/hashlib.rst:707 msgid "" ">>> from hashlib import blake2b\n" ">>> FILES_HASH_PERSON = b'MyApp Files Hash'\n" @@ -1067,21 +1068,21 @@ msgstr "" ">>> h.hexdigest()\n" "'cf68fb5761b9c44e7878bfb2c4c9aea52264a80b75005e65619778de59f383a3'" -#: ../../library/hashlib.rst:717 +#: ../../library/hashlib.rst:719 msgid "" "Personalization together with the keyed mode can also be used to derive " "different keys from a single one." msgstr "個人化與密鑰模式還可以一起用於從單個密鑰得出不同的密鑰。" -#: ../../library/hashlib.rst:731 +#: ../../library/hashlib.rst:733 msgid "Tree mode" msgstr "樹狀模式" -#: ../../library/hashlib.rst:733 +#: ../../library/hashlib.rst:735 msgid "Here's an example of hashing a minimal tree with two leaf nodes::" msgstr "下面是對具有兩個葉節點的最小樹進行雜湊處理的範例: ::" -#: ../../library/hashlib.rst:735 +#: ../../library/hashlib.rst:737 msgid "" " 10\n" " / \\\n" @@ -1091,13 +1092,13 @@ msgstr "" " / \\\n" "00 01" -#: ../../library/hashlib.rst:739 +#: ../../library/hashlib.rst:741 msgid "" "This example uses 64-byte internal digests, and returns the 32-byte final " "digest::" msgstr "此範例使用 64-byte 內部摘要,並回傳 32-byte 最終摘要: ::" -#: ../../library/hashlib.rst:742 +#: ../../library/hashlib.rst:744 msgid "" ">>> from hashlib import blake2b\n" ">>>\n" @@ -1151,11 +1152,11 @@ msgstr "" ">>> h10.hexdigest()\n" "'3ad2a9b37c6070e374c7a8c508fe20ca86b6ed54e286e93a0318e95e881db5aa'" -#: ../../library/hashlib.rst:769 +#: ../../library/hashlib.rst:771 msgid "Credits" msgstr "製作人員" -#: ../../library/hashlib.rst:771 +#: ../../library/hashlib.rst:773 msgid "" "BLAKE2_ was designed by *Jean-Philippe Aumasson*, *Samuel Neves*, *Zooko " "Wilcox-O'Hearn*, and *Christian Winnerlein* based on SHA-3_ finalist BLAKE_ " @@ -1167,13 +1168,13 @@ msgstr "" "Henzen*、*Willi Meier* 和 *Raphael C.-W. Phan* 所建立的 SHA-3_ 最終版本 " "BLAKE_。" -#: ../../library/hashlib.rst:776 +#: ../../library/hashlib.rst:778 msgid "" "It uses core algorithm from ChaCha_ cipher designed by *Daniel J. " "Bernstein*." msgstr "它使用 *Daniel J. Bernstein* 設計的 ChaCha_ 密碼的核心演算法。" -#: ../../library/hashlib.rst:778 +#: ../../library/hashlib.rst:780 msgid "" "The stdlib implementation is based on pyblake2_ module. It was written by " "*Dmitry Chestnykh* based on C implementation written by *Samuel Neves*. The " @@ -1183,17 +1184,17 @@ msgstr "" "Neves* 的 C 版本實作為基礎所編寫的。該文件是由 *Dmitry Chestnykh* 編寫並從 " "pyblake2_ 複製過來的。" -#: ../../library/hashlib.rst:782 +#: ../../library/hashlib.rst:784 msgid "The C code was partly rewritten for Python by *Christian Heimes*." msgstr "*Christian Heimes* 為 Python 重寫了部分 C 程式碼。" -#: ../../library/hashlib.rst:784 +#: ../../library/hashlib.rst:786 msgid "" "The following public domain dedication applies for both C hash function " "implementation, extension code, and this documentation:" msgstr "以下公開領域貢獻適用於 C 雜湊函式實作、擴充程式碼和此文件:" -#: ../../library/hashlib.rst:787 +#: ../../library/hashlib.rst:789 msgid "" "To the extent possible under law, the author(s) have dedicated all copyright " "and related and neighboring rights to this software to the public domain " @@ -1202,7 +1203,7 @@ msgstr "" "在法律允許的範圍內,作者已將該軟體的所有版權以及相關和鄰接權利奉獻給全球的公" "開領域。該軟體的發布沒有任何授權 (warranty)。" -#: ../../library/hashlib.rst:791 +#: ../../library/hashlib.rst:793 msgid "" "You should have received a copy of the CC0 Public Domain Dedication along " "with this software. If not, see https://creativecommons.org/publicdomain/" @@ -1212,7 +1213,7 @@ msgstr "" "Dedication) 的副本。如果沒有,請參閱 https://creativecommons.org/" "publicdomain/zero/1.0/ 。" -#: ../../library/hashlib.rst:795 +#: ../../library/hashlib.rst:797 msgid "" "The following people have helped with development or contributed their " "changes to the project and the public domain according to the Creative " @@ -1221,55 +1222,56 @@ msgstr "" "以下人員根據創用 CC 通用公眾領域貢獻宣告 1.0 (Creative Commons Public Domain " "Dedication 1.0 Universal) 於專案和公開領域做出了開發或貢獻:" -#: ../../library/hashlib.rst:799 +#: ../../library/hashlib.rst:801 msgid "*Alexandr Sokolovskiy*" msgstr "*Alexandr Sokolovskiy*" -#: ../../library/hashlib.rst:819 +#: ../../library/hashlib.rst:821 msgid "Module :mod:`hmac`" msgstr ":mod:`hmac` 模組" -#: ../../library/hashlib.rst:820 +#: ../../library/hashlib.rst:822 msgid "A module to generate message authentication codes using hashes." msgstr "使用雜湊生成訊息驗證程式碼的模組。" -#: ../../library/hashlib.rst:822 +#: ../../library/hashlib.rst:824 msgid "Module :mod:`base64`" msgstr ":mod:`base64` 模組" -#: ../../library/hashlib.rst:823 +#: ../../library/hashlib.rst:825 msgid "Another way to encode binary hashes for non-binary environments." msgstr "另一種在非二進位環境中編碼二進位雜湊的方法。" -#: ../../library/hashlib.rst:825 +#: ../../library/hashlib.rst:827 msgid "https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.180-4.pdf" msgstr "https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.180-4.pdf" -#: ../../library/hashlib.rst:826 +#: ../../library/hashlib.rst:828 msgid "The FIPS 180-4 publication on Secure Hash Algorithms." msgstr "有關安全雜湊演算法的 FIPS 180-4 出版物。" -#: ../../library/hashlib.rst:828 -msgid "https://csrc.nist.gov/pubs/fips/202/final" +#: ../../library/hashlib.rst:830 +#, fuzzy +msgid "https://csrc.nist.gov/publications/detail/fips/202/final" msgstr "https://csrc.nist.gov/pubs/fips/202/final" -#: ../../library/hashlib.rst:829 +#: ../../library/hashlib.rst:831 msgid "The FIPS 202 publication on the SHA-3 Standard." msgstr "有關 SHA-3 標準的 FIPS 202 出版物。" -#: ../../library/hashlib.rst:831 +#: ../../library/hashlib.rst:833 msgid "https://www.blake2.net/" msgstr "https://www.blake2.net/" -#: ../../library/hashlib.rst:832 +#: ../../library/hashlib.rst:834 msgid "Official BLAKE2 website." msgstr "BLAKE2 官方網站。" -#: ../../library/hashlib.rst:834 +#: ../../library/hashlib.rst:836 msgid "https://en.wikipedia.org/wiki/Cryptographic_hash_function" msgstr "https://en.wikipedia.org/wiki/Cryptographic_hash_function" -#: ../../library/hashlib.rst:835 +#: ../../library/hashlib.rst:837 msgid "" "Wikipedia article with information on which algorithms have known issues and " "what that means regarding their use." @@ -1277,21 +1279,21 @@ msgstr "" "包含有關哪些演算法存在已知問題以及這些問題對其使用意味著什麼資訊的維基百科文" "章。" -#: ../../library/hashlib.rst:838 +#: ../../library/hashlib.rst:840 msgid "https://www.ietf.org/rfc/rfc8018.txt" msgstr "https://www.ietf.org/rfc/rfc8018.txt" -#: ../../library/hashlib.rst:839 +#: ../../library/hashlib.rst:841 msgid "PKCS #5: Password-Based Cryptography Specification Version 2.1" msgstr "PKCS #5:基於密碼的加密規範版本 2.1" -#: ../../library/hashlib.rst:841 +#: ../../library/hashlib.rst:843 msgid "" "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf" msgstr "" "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf" -#: ../../library/hashlib.rst:842 +#: ../../library/hashlib.rst:844 msgid "NIST Recommendation for Password-Based Key Derivation." msgstr "NIST(美國國家標準技術研究院)針對基於密碼的密鑰衍生的建議。" @@ -1315,6 +1317,6 @@ msgstr "OpenSSL" msgid "(use in module hashlib)" msgstr "(使用於 hashlib 模組中)" -#: ../../library/hashlib.rst:370 +#: ../../library/hashlib.rst:372 msgid "blake2b, blake2s" msgstr "blake2b, blake2s" diff --git a/library/http.client.po b/library/http.client.po index 29447588c4..a3bb30106b 100644 --- a/library/http.client.po +++ b/library/http.client.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,14 +45,14 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid ":ref:`Availability `: not WASI." msgstr "" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/http.cookiejar.po b/library/http.cookiejar.po index 1df6769663..ea30115b2d 100644 --- a/library/http.cookiejar.po +++ b/library/http.cookiejar.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2016-11-19 00:31+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -200,7 +200,8 @@ msgid "" msgstr "" #: ../../library/http.cookiejar.rst:140 -msgid "https://kristol.org/cookie/errata.html" +#, fuzzy +msgid "http://kristol.org/cookie/errata.html" msgstr "https://kristol.org/cookie/errata.html" #: ../../library/http.cookiejar.rst:141 diff --git a/library/http.po b/library/http.po index cbda6c4b7b..96924cb5a1 100644 --- a/library/http.po +++ b/library/http.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -74,8 +74,8 @@ msgstr "" ":class:`enum.IntEnum` 的子類別,它定義了一組 HTTP 狀態碼、原理短語 (reason " "phrase) 以及英文長描述。" -#: ../../library/http.rst:34 ../../library/http.rst:157 -#: ../../library/http.rst:171 +#: ../../library/http.rst:34 ../../library/http.rst:161 +#: ../../library/http.rst:175 msgid "Usage::" msgstr "用法: ::" @@ -126,12 +126,12 @@ msgstr "" msgid "Code" msgstr "狀態碼" -#: ../../library/http.rst:60 ../../library/http.rst:204 +#: ../../library/http.rst:60 ../../library/http.rst:208 msgid "Enum Name" msgstr "列舉名稱" -#: ../../library/http.rst:60 ../../library/http.rst:148 -#: ../../library/http.rst:204 +#: ../../library/http.rst:60 ../../library/http.rst:152 +#: ../../library/http.rst:208 msgid "Details" msgstr "詳情" @@ -144,7 +144,8 @@ msgid "``CONTINUE``" msgstr "``CONTINUE``" #: ../../library/http.rst:62 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.2.1" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.2.1" msgstr "HTTP/1.1 :rfc:`7231`,6.2.1 節" #: ../../library/http.rst:63 @@ -156,7 +157,8 @@ msgid "``SWITCHING_PROTOCOLS``" msgstr "``SWITCHING_PROTOCOLS``" #: ../../library/http.rst:63 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.2.2" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.2.2" msgstr "HTTP/1.1 :rfc:`7231`,6.2.2 節" #: ../../library/http.rst:64 @@ -192,7 +194,8 @@ msgid "``OK``" msgstr "``OK``" #: ../../library/http.rst:66 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.3.1" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.3.1" msgstr "HTTP/1.1 :rfc:`7231`,6.3.1 節" #: ../../library/http.rst:67 @@ -204,7 +207,8 @@ msgid "``CREATED``" msgstr "``CREATED``" #: ../../library/http.rst:67 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.3.2" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.3.2" msgstr "HTTP/1.1 :rfc:`7231`,6.3.2 節" #: ../../library/http.rst:68 @@ -216,7 +220,8 @@ msgid "``ACCEPTED``" msgstr "``ACCEPTED``" #: ../../library/http.rst:68 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.3.3" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.3.3" msgstr "HTTP/1.1 :rfc:`7231`,6.3.3 節" #: ../../library/http.rst:69 @@ -228,7 +233,8 @@ msgid "``NON_AUTHORITATIVE_INFORMATION``" msgstr "``NON_AUTHORITATIVE_INFORMATION``" #: ../../library/http.rst:69 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.3.4" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.3.4" msgstr "HTTP/1.1 :rfc:`7231`,6.3.4 節" #: ../../library/http.rst:70 @@ -240,7 +246,8 @@ msgid "``NO_CONTENT``" msgstr "``NO_CONTENT``" #: ../../library/http.rst:70 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.3.5" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.3.5" msgstr "HTTP/1.1 :rfc:`7231`,6.3.5 節" #: ../../library/http.rst:71 @@ -252,7 +259,8 @@ msgid "``RESET_CONTENT``" msgstr "``RESET_CONTENT``" #: ../../library/http.rst:71 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.3.6" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.3.6" msgstr "HTTP/1.1 :rfc:`7231`,6.3.6 節" #: ../../library/http.rst:72 @@ -264,8 +272,9 @@ msgid "``PARTIAL_CONTENT``" msgstr "``PARTIAL_CONTENT``" #: ../../library/http.rst:72 -msgid "HTTP/1.1 :rfc:`7233`, Section 4.1" -msgstr "HTTP/1.1 :rfc:`7233`,4.1 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.3.7" +msgstr "HTTP/1.1 :rfc:`7231`,4.3.7 節" #: ../../library/http.rst:73 msgid "``207``" @@ -312,7 +321,8 @@ msgid "``MULTIPLE_CHOICES``" msgstr "``MULTIPLE_CHOICES``" #: ../../library/http.rst:76 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.4.1" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.4.1" msgstr "HTTP/1.1 :rfc:`7231`,6.4.1 節" #: ../../library/http.rst:77 @@ -324,7 +334,8 @@ msgid "``MOVED_PERMANENTLY``" msgstr "``MOVED_PERMANENTLY``" #: ../../library/http.rst:77 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.4.2" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.4.2" msgstr "HTTP/1.1 :rfc:`7231`,6.4.2 節" #: ../../library/http.rst:78 @@ -336,7 +347,8 @@ msgid "``FOUND``" msgstr "``FOUND``" #: ../../library/http.rst:78 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.4.3" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.4.3" msgstr "HTTP/1.1 :rfc:`7231`,6.4.3 節" #: ../../library/http.rst:79 @@ -348,7 +360,8 @@ msgid "``SEE_OTHER``" msgstr "``SEE_OTHER``" #: ../../library/http.rst:79 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.4.4" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.4.4" msgstr "HTTP/1.1 :rfc:`7231`,6.4.4 節" #: ../../library/http.rst:80 @@ -360,8 +373,9 @@ msgid "``NOT_MODIFIED``" msgstr "``NOT_MODIFIED``" #: ../../library/http.rst:80 -msgid "HTTP/1.1 :rfc:`7232`, Section 4.1" -msgstr "HTTP/1.1 :rfc:`7232`,4.1 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.4.5" +msgstr "HTTP/1.1 :rfc:`7231`,6.4.5 節" #: ../../library/http.rst:81 msgid "``305``" @@ -372,8 +386,9 @@ msgid "``USE_PROXY``" msgstr "``USE_PROXY``" #: ../../library/http.rst:81 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.4.5" -msgstr "HTTP/1.1 :rfc:`7231`,6.4.5 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.4.6" +msgstr "HTTP/1.1 :rfc:`7231`,6.3.6 節" #: ../../library/http.rst:82 msgid "``307``" @@ -384,8 +399,9 @@ msgid "``TEMPORARY_REDIRECT``" msgstr "``TEMPORARY_REDIRECT``" #: ../../library/http.rst:82 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.4.7" -msgstr "HTTP/1.1 :rfc:`7231`,6.4.7 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.4.8" +msgstr "HTTP/1.1 :rfc:`7231`,6.4.1 節" #: ../../library/http.rst:83 msgid "``308``" @@ -396,8 +412,9 @@ msgid "``PERMANENT_REDIRECT``" msgstr "``PERMANENT_REDIRECT``" #: ../../library/http.rst:83 -msgid "Permanent Redirect :rfc:`7238`, Section 3 (Experimental)" -msgstr "永久重定向 :rfc:`7238`,3 節(實驗性)" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.4.9" +msgstr "HTTP/1.1 :rfc:`7231`,6.4.1 節" #: ../../library/http.rst:84 msgid "``400``" @@ -408,7 +425,8 @@ msgid "``BAD_REQUEST``" msgstr "``BAD_REQUEST``" #: ../../library/http.rst:84 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.1" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.1" msgstr "HTTP/1.1 :rfc:`7231`,6.5.1 節" #: ../../library/http.rst:85 @@ -420,8 +438,9 @@ msgid "``UNAUTHORIZED``" msgstr "``UNAUTHORIZED``" #: ../../library/http.rst:85 -msgid "HTTP/1.1 Authentication :rfc:`7235`, Section 3.1" -msgstr "HTTP/1.1 身分驗證 (Authentication) :rfc:`7235`,3.1 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.2" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.2 節" #: ../../library/http.rst:86 msgid "``402``" @@ -432,8 +451,9 @@ msgid "``PAYMENT_REQUIRED``" msgstr "``PAYMENT_REQUIRED``" #: ../../library/http.rst:86 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.2" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.2 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.3" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.3 節" #: ../../library/http.rst:87 msgid "``403``" @@ -444,8 +464,9 @@ msgid "``FORBIDDEN``" msgstr "``FORBIDDEN``" #: ../../library/http.rst:87 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.3" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.3 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.4" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.4 節" #: ../../library/http.rst:88 msgid "``404``" @@ -456,8 +477,9 @@ msgid "``NOT_FOUND``" msgstr "``NOT_FOUND``" #: ../../library/http.rst:88 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.4" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.4 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.5" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.5 節" #: ../../library/http.rst:89 msgid "``405``" @@ -468,8 +490,9 @@ msgid "``METHOD_NOT_ALLOWED``" msgstr "``METHOD_NOT_ALLOWED``" #: ../../library/http.rst:89 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.5" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.5 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.6" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.6 節" #: ../../library/http.rst:90 msgid "``406``" @@ -480,8 +503,9 @@ msgid "``NOT_ACCEPTABLE``" msgstr "``NOT_ACCEPTABLE``" #: ../../library/http.rst:90 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.6" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.6 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.7" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.7 節" #: ../../library/http.rst:91 msgid "``407``" @@ -492,8 +516,9 @@ msgid "``PROXY_AUTHENTICATION_REQUIRED``" msgstr "``PROXY_AUTHENTICATION_REQUIRED``" #: ../../library/http.rst:91 -msgid "HTTP/1.1 Authentication :rfc:`7235`, Section 3.2" -msgstr "HTTP/1.1 身分驗證 :rfc:`7235`,3.2 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.8" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.8 節" #: ../../library/http.rst:92 msgid "``408``" @@ -504,8 +529,9 @@ msgid "``REQUEST_TIMEOUT``" msgstr "``REQUEST_TIMEOUT``" #: ../../library/http.rst:92 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.7" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.7 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.9" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.9 節" #: ../../library/http.rst:93 msgid "``409``" @@ -516,8 +542,9 @@ msgid "``CONFLICT``" msgstr "``CONFLICT``" #: ../../library/http.rst:93 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.8" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.8 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.10" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.10 節" #: ../../library/http.rst:94 msgid "``410``" @@ -528,8 +555,9 @@ msgid "``GONE``" msgstr "``GONE``" #: ../../library/http.rst:94 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.9" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.9 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.11" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.11 節" #: ../../library/http.rst:95 msgid "``411``" @@ -540,8 +568,9 @@ msgid "``LENGTH_REQUIRED``" msgstr "``LENGTH_REQUIRED``" #: ../../library/http.rst:95 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.10" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.10 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.12" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.12 節" #: ../../library/http.rst:96 msgid "``412``" @@ -552,32 +581,37 @@ msgid "``PRECONDITION_FAILED``" msgstr "``PRECONDITION_FAILED``" #: ../../library/http.rst:96 -msgid "HTTP/1.1 :rfc:`7232`, Section 4.2" -msgstr "HTTP/1.1 :rfc:`7232`,4.2 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.13" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.13 節" #: ../../library/http.rst:97 msgid "``413``" msgstr "``413``" #: ../../library/http.rst:97 -msgid "``REQUEST_ENTITY_TOO_LARGE``" +#, fuzzy +msgid "``CONTENT_TOO_LARGE``" msgstr "``REQUEST_ENTITY_TOO_LARGE``" #: ../../library/http.rst:97 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.11" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.11 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.14" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.14 節" #: ../../library/http.rst:98 msgid "``414``" msgstr "``414``" #: ../../library/http.rst:98 -msgid "``REQUEST_URI_TOO_LONG``" +#, fuzzy +msgid "``URI_TOO_LONG``" msgstr "``REQUEST_URI_TOO_LONG``" #: ../../library/http.rst:98 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.12" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.12 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.15" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.15 節" #: ../../library/http.rst:99 msgid "``415``" @@ -588,20 +622,23 @@ msgid "``UNSUPPORTED_MEDIA_TYPE``" msgstr "``UNSUPPORTED_MEDIA_TYPE``" #: ../../library/http.rst:99 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.13" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.13 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.16" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.1 節" #: ../../library/http.rst:100 msgid "``416``" msgstr "``416``" #: ../../library/http.rst:100 -msgid "``REQUESTED_RANGE_NOT_SATISFIABLE``" +#, fuzzy +msgid "``RANGE_NOT_SATISFIABLE``" msgstr "``REQUESTED_RANGE_NOT_SATISFIABLE``" #: ../../library/http.rst:100 -msgid "HTTP/1.1 Range Requests :rfc:`7233`, Section 4.4" -msgstr "HTTP/1.1 範圍請求 (Range Requests) :rfc:`7233`,4.4 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.17" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.1 節" #: ../../library/http.rst:101 msgid "``417``" @@ -612,8 +649,9 @@ msgid "``EXPECTATION_FAILED``" msgstr "``EXPECTATION_FAILED``" #: ../../library/http.rst:101 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.14" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.14 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.18" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.1 節" #: ../../library/http.rst:102 msgid "``418``" @@ -636,20 +674,23 @@ msgid "``MISDIRECTED_REQUEST``" msgstr "``MISDIRECTED_REQUEST``" #: ../../library/http.rst:103 -msgid "HTTP/2 :rfc:`7540`, Section 9.1.2" -msgstr "HTTP/2 :rfc:`7540`,9.1.2 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.20" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.2 節" #: ../../library/http.rst:104 msgid "``422``" msgstr "``422``" #: ../../library/http.rst:104 -msgid "``UNPROCESSABLE_ENTITY``" +#, fuzzy +msgid "``UNPROCESSABLE_CONTENT``" msgstr "``UNPROCESSABLE_ENTITY``" #: ../../library/http.rst:104 -msgid "WebDAV :rfc:`4918`, Section 11.2" -msgstr "WebDAV :rfc:`4918`,11.2 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.21" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.2 節" #: ../../library/http.rst:105 msgid "``423``" @@ -696,8 +737,9 @@ msgid "``UPGRADE_REQUIRED``" msgstr "``UPGRADE_REQUIRED``" #: ../../library/http.rst:108 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.15" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.15 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.22" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.2 節" #: ../../library/http.rst:109 msgid "``428``" @@ -749,7 +791,8 @@ msgid "``INTERNAL_SERVER_ERROR``" msgstr "``INTERNAL_SERVER_ERROR``" #: ../../library/http.rst:113 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.6.1" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.6.1" msgstr "HTTP/1.1 :rfc:`7231`,6.6.1 節" #: ../../library/http.rst:114 @@ -761,7 +804,8 @@ msgid "``NOT_IMPLEMENTED``" msgstr "``NOT_IMPLEMENTED``" #: ../../library/http.rst:114 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.6.2" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.6.2" msgstr "HTTP/1.1 :rfc:`7231`,6.6.2 節" #: ../../library/http.rst:115 @@ -773,7 +817,8 @@ msgid "``BAD_GATEWAY``" msgstr "``BAD_GATEWAY``" #: ../../library/http.rst:115 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.6.3" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.6.3" msgstr "HTTP/1.1 :rfc:`7231`,6.6.3 節" #: ../../library/http.rst:116 @@ -785,7 +830,8 @@ msgid "``SERVICE_UNAVAILABLE``" msgstr "``SERVICE_UNAVAILABLE``" #: ../../library/http.rst:116 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.6.4" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.6.4" msgstr "HTTP/1.1 :rfc:`7231`,6.6.4 節" #: ../../library/http.rst:117 @@ -797,7 +843,8 @@ msgid "``GATEWAY_TIMEOUT``" msgstr "``GATEWAY_TIMEOUT``" #: ../../library/http.rst:117 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.6.5" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.6.5" msgstr "HTTP/1.1 :rfc:`7231`,6.6.5 節" #: ../../library/http.rst:118 @@ -809,7 +856,8 @@ msgid "``HTTP_VERSION_NOT_SUPPORTED``" msgstr "``HTTP_VERSION_NOT_SUPPORTED``" #: ../../library/http.rst:118 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.6.6" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.6.6" msgstr "HTTP/1.1 :rfc:`7231`,6.6.6 節" #: ../../library/http.rst:119 @@ -901,70 +949,77 @@ msgid "" msgstr "" "新增 ``103 EARLY_HINTS``、``418 IM_A_TEAPOT`` 與 ``425 TOO_EARLY`` 狀態碼。" -#: ../../library/http.rst:141 +#: ../../library/http.rst:140 +msgid "" +"Implemented RFC9110 naming for status constants. Old constant names are " +"preserved for backwards compatibility." +msgstr "" + +#: ../../library/http.rst:145 msgid "HTTP status category" msgstr "HTTP 狀態分類" -#: ../../library/http.rst:145 +#: ../../library/http.rst:149 msgid "" "The enum values have several properties to indicate the HTTP status category:" msgstr "" -#: ../../library/http.rst:148 +#: ../../library/http.rst:152 msgid "Property" msgstr "" -#: ../../library/http.rst:148 +#: ../../library/http.rst:152 msgid "Indicates that" msgstr "" -#: ../../library/http.rst:150 +#: ../../library/http.rst:154 msgid "``is_informational``" msgstr "``is_informational``" -#: ../../library/http.rst:150 +#: ../../library/http.rst:154 msgid "``100 <= status <= 199``" msgstr "``100 <= status <= 199``" -#: ../../library/http.rst:150 ../../library/http.rst:151 -#: ../../library/http.rst:152 ../../library/http.rst:153 -#: ../../library/http.rst:154 -msgid "HTTP/1.1 :rfc:`7231`, Section 6" -msgstr "HTTP/1.1 :rfc:`7231`,6 節" +#: ../../library/http.rst:154 ../../library/http.rst:155 +#: ../../library/http.rst:156 ../../library/http.rst:157 +#: ../../library/http.rst:158 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15" +msgstr "HTTP/2 :rfc:`7540`,9.1.2 節" -#: ../../library/http.rst:151 +#: ../../library/http.rst:155 msgid "``is_success``" msgstr "``is_success``" -#: ../../library/http.rst:151 +#: ../../library/http.rst:155 msgid "``200 <= status <= 299``" msgstr "``200 <= status <= 299``" -#: ../../library/http.rst:152 +#: ../../library/http.rst:156 msgid "``is_redirection``" msgstr "``is_redirection``" -#: ../../library/http.rst:152 +#: ../../library/http.rst:156 msgid "``300 <= status <= 399``" msgstr "``300 <= status <= 399``" -#: ../../library/http.rst:153 +#: ../../library/http.rst:157 msgid "``is_client_error``" msgstr "``is_client_error``" -#: ../../library/http.rst:153 +#: ../../library/http.rst:157 msgid "``400 <= status <= 499``" msgstr "``400 <= status <= 499``" -#: ../../library/http.rst:154 +#: ../../library/http.rst:158 msgid "``is_server_error``" msgstr "``is_server_error``" -#: ../../library/http.rst:154 +#: ../../library/http.rst:158 msgid "``500 <= status <= 599``" msgstr "``500 <= status <= 599``" -#: ../../library/http.rst:159 +#: ../../library/http.rst:163 msgid "" ">>> from http import HTTPStatus\n" ">>> HTTPStatus.OK.is_success\n" @@ -978,13 +1033,13 @@ msgstr "" ">>> HTTPStatus.OK.is_client_error\n" "False" -#: ../../library/http.rst:169 +#: ../../library/http.rst:173 msgid "" "A subclass of :class:`enum.StrEnum` that defines a set of HTTP methods and " "descriptions written in English." msgstr ":class:`enum.StrEnum` 的子類別,它定義了一組 HTTP 方法以及英文描述。" -#: ../../library/http.rst:173 +#: ../../library/http.rst:177 msgid "" ">>> from http import HTTPMethod\n" ">>>\n" @@ -1028,11 +1083,11 @@ msgstr "" " ,\n" " ]" -#: ../../library/http.rst:197 +#: ../../library/http.rst:201 msgid "HTTP methods" msgstr "HTTP 方法" -#: ../../library/http.rst:199 +#: ../../library/http.rst:203 msgid "" "Supported, `IANA-registered methods `_ available in :class:`http.HTTPMethod` are:" @@ -1040,79 +1095,87 @@ msgstr "" ":class:`http.HTTPStatus` 當中,已支援並且有於 `IANA 註冊的狀態碼 `_\\ 有:" -#: ../../library/http.rst:204 +#: ../../library/http.rst:208 msgid "Method" msgstr "方法" -#: ../../library/http.rst:206 +#: ../../library/http.rst:210 msgid "``GET``" msgstr "``GET``" -#: ../../library/http.rst:206 -msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.1" -msgstr "HTTP/1.1 :rfc:`7231`,4.3.1 節" +#: ../../library/http.rst:210 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 9.3.1" +msgstr "HTTP/1.1 :rfc:`7231`,6.3.1 節" -#: ../../library/http.rst:207 +#: ../../library/http.rst:211 msgid "``HEAD``" msgstr "``HEAD``" -#: ../../library/http.rst:207 -msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.2" -msgstr "HTTP/1.1 :rfc:`7231`,4.3.2 節" +#: ../../library/http.rst:211 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 9.3.2" +msgstr "HTTP/2 :rfc:`7540`,9.1.2 節" -#: ../../library/http.rst:208 +#: ../../library/http.rst:212 msgid "``POST``" msgstr "``POST``" -#: ../../library/http.rst:208 -msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.3" -msgstr "HTTP/1.1 :rfc:`7231`,4.3.3 節" +#: ../../library/http.rst:212 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 9.3.3" +msgstr "HTTP/1.1 :rfc:`7231`,6.3.3 節" -#: ../../library/http.rst:209 +#: ../../library/http.rst:213 msgid "``PUT``" msgstr "``PUT``" -#: ../../library/http.rst:209 -msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.4" -msgstr "HTTP/1.1 :rfc:`7231`,4.3.4 節" +#: ../../library/http.rst:213 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 9.3.4" +msgstr "HTTP/1.1 :rfc:`7231`,6.3.4 節" -#: ../../library/http.rst:210 +#: ../../library/http.rst:214 msgid "``DELETE``" msgstr "``DELETE``" -#: ../../library/http.rst:210 -msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.5" +#: ../../library/http.rst:214 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 9.3.5" msgstr "HTTP/1.1 :rfc:`7231`,6.3.5 節" -#: ../../library/http.rst:211 +#: ../../library/http.rst:215 msgid "``CONNECT``" msgstr "``CONNECT``" -#: ../../library/http.rst:211 -msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.6" -msgstr "HTTP/1.1 :rfc:`7231`,4.3.6 節" +#: ../../library/http.rst:215 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 9.3.6" +msgstr "HTTP/1.1 :rfc:`7231`,6.3.6 節" -#: ../../library/http.rst:212 +#: ../../library/http.rst:216 msgid "``OPTIONS``" msgstr "``OPTIONS``" -#: ../../library/http.rst:212 -msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.7" +#: ../../library/http.rst:216 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 9.3.7" msgstr "HTTP/1.1 :rfc:`7231`,4.3.7 節" -#: ../../library/http.rst:213 +#: ../../library/http.rst:217 msgid "``TRACE``" msgstr "``TRACE``" -#: ../../library/http.rst:213 -msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.8" +#: ../../library/http.rst:217 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 9.3.8" msgstr "HTTP/1.1 :rfc:`7231`,4.3.8 節" -#: ../../library/http.rst:214 +#: ../../library/http.rst:218 msgid "``PATCH``" msgstr "``PATCH``" -#: ../../library/http.rst:214 +#: ../../library/http.rst:218 msgid "HTTP/1.1 :rfc:`5789`" msgstr "HTTP/1.1 :rfc:`5789`" @@ -1127,3 +1190,51 @@ msgstr "protocol(協定)" #: ../../library/http.rst:9 msgid "http (standard module)" msgstr "http(標準模組)" + +#~ msgid "HTTP/1.1 :rfc:`7233`, Section 4.1" +#~ msgstr "HTTP/1.1 :rfc:`7233`,4.1 節" + +#~ msgid "HTTP/1.1 :rfc:`7232`, Section 4.1" +#~ msgstr "HTTP/1.1 :rfc:`7232`,4.1 節" + +#~ msgid "HTTP/1.1 :rfc:`7231`, Section 6.4.7" +#~ msgstr "HTTP/1.1 :rfc:`7231`,6.4.7 節" + +#~ msgid "Permanent Redirect :rfc:`7238`, Section 3 (Experimental)" +#~ msgstr "永久重定向 :rfc:`7238`,3 節(實驗性)" + +#~ msgid "HTTP/1.1 Authentication :rfc:`7235`, Section 3.1" +#~ msgstr "HTTP/1.1 身分驗證 (Authentication) :rfc:`7235`,3.1 節" + +#~ msgid "HTTP/1.1 Authentication :rfc:`7235`, Section 3.2" +#~ msgstr "HTTP/1.1 身分驗證 :rfc:`7235`,3.2 節" + +#~ msgid "HTTP/1.1 :rfc:`7232`, Section 4.2" +#~ msgstr "HTTP/1.1 :rfc:`7232`,4.2 節" + +#~ msgid "HTTP/1.1 Range Requests :rfc:`7233`, Section 4.4" +#~ msgstr "HTTP/1.1 範圍請求 (Range Requests) :rfc:`7233`,4.4 節" + +#~ msgid "WebDAV :rfc:`4918`, Section 11.2" +#~ msgstr "WebDAV :rfc:`4918`,11.2 節" + +#~ msgid "HTTP/1.1 :rfc:`7231`, Section 6" +#~ msgstr "HTTP/1.1 :rfc:`7231`,6 節" + +#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.1" +#~ msgstr "HTTP/1.1 :rfc:`7231`,4.3.1 節" + +#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.2" +#~ msgstr "HTTP/1.1 :rfc:`7231`,4.3.2 節" + +#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.3" +#~ msgstr "HTTP/1.1 :rfc:`7231`,4.3.3 節" + +#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.4" +#~ msgstr "HTTP/1.1 :rfc:`7231`,4.3.4 節" + +#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.5" +#~ msgstr "HTTP/1.1 :rfc:`7231`,6.3.5 節" + +#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.6" +#~ msgstr "HTTP/1.1 :rfc:`7231`,4.3.6 節" diff --git a/library/http.server.po b/library/http.server.po index a937e86760..5a706bd1c1 100644 --- a/library/http.server.po +++ b/library/http.server.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,14 +36,14 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid ":ref:`Availability `: not WASI." msgstr "" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" @@ -669,35 +669,50 @@ msgid "" "reasons. Problems with the CGI script will be translated to error 403." msgstr "" -#: ../../library/http.server.rst:505 +#: ../../library/http.server.rst:507 +msgid "" +":class:`CGIHTTPRequestHandler` is being removed in 3.15. CGI has not been " +"considered a good way to do things for well over a decade. This code has " +"been unmaintained for a while now and sees very little practical use. " +"Retaining it could lead to further :ref:`security considerations `." +msgstr "" + +#: ../../library/http.server.rst:513 msgid "" ":class:`CGIHTTPRequestHandler` can be enabled in the command line by passing " "the ``--cgi`` option::" msgstr "" -#: ../../library/http.server.rst:508 +#: ../../library/http.server.rst:516 msgid "python -m http.server --cgi" msgstr "python -m http.server --cgi" -#: ../../library/http.server.rst:512 +#: ../../library/http.server.rst:520 +msgid "" +":mod:`http.server` command line ``--cgi`` support is being removed because :" +"class:`CGIHTTPRequestHandler` is being removed." +msgstr "" + +#: ../../library/http.server.rst:525 msgid "" ":class:`CGIHTTPRequestHandler` and the ``--cgi`` command line option are not " "intended for use by untrusted clients and may be vulnerable to exploitation. " "Always use within a secure environment." msgstr "" -#: ../../library/http.server.rst:519 +#: ../../library/http.server.rst:532 msgid "Security Considerations" msgstr "安全性注意事項" -#: ../../library/http.server.rst:523 +#: ../../library/http.server.rst:536 msgid "" ":class:`SimpleHTTPRequestHandler` will follow symbolic links when handling " "requests, this makes it possible for files outside of the specified " "directory to be served." msgstr "" -#: ../../library/http.server.rst:527 +#: ../../library/http.server.rst:540 msgid "" "Earlier versions of Python did not scrub control characters from the log " "messages emitted to stderr from ``python -m http.server`` or the default :" @@ -706,7 +721,7 @@ msgid "" "codes to your terminal." msgstr "" -#: ../../library/http.server.rst:533 +#: ../../library/http.server.rst:546 msgid "Control characters are scrubbed in stderr logs." msgstr "" @@ -734,10 +749,10 @@ msgstr "URL(統一資源定位器)" msgid "httpd" msgstr "httpd" -#: ../../library/http.server.rst:521 +#: ../../library/http.server.rst:534 msgid "http.server" msgstr "http.server" -#: ../../library/http.server.rst:521 +#: ../../library/http.server.rst:534 msgid "security" msgstr "security(安全)" diff --git a/library/imaplib.po b/library/imaplib.po index aa703fb268..ecc2eaa302 100644 --- a/library/imaplib.po +++ b/library/imaplib.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,14 +35,14 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid ":ref:`Availability `: not WASI." msgstr "" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" @@ -625,7 +625,7 @@ msgid "" "such tags, and popular IMAP servers, such as Gmail, accept and produce such " "flags. There are non-Python programs which also create such tags. Although " "it is an RFC violation and IMAP clients and servers are supposed to be " -"strict, imaplib nonetheless continues to allow such tags to be created for " +"strict, imaplib still continues to allow such tags to be created for " "backward compatibility reasons, and as of Python 3.6, handles them if they " "are sent from the server, since this improves real-world compatibility." msgstr "" diff --git a/library/importlib.metadata.po b/library/importlib.metadata.po index 0002790bd9..02d7d7e1c8 100644 --- a/library/importlib.metadata.po +++ b/library/importlib.metadata.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -59,7 +59,7 @@ msgid "" "*distribution package* can contain multiple *import packages* (and single " "modules), and one top-level *import package* may map to multiple " "*distribution packages* if it is a namespace package. You can use :ref:" -"`package_distributions() ` to get a mapping between " +"`packages_distributions() ` to get a mapping between " "them." msgstr "" @@ -294,10 +294,6 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:174 -msgid "*Compatibility Note*" -msgstr "" - -#: ../../library/importlib.metadata.rst:176 msgid "" "The \"selectable\" entry points were introduced in ``importlib_metadata`` " "3.6 and Python 3.10. Prior to those changes, ``entry_points`` accepted no " @@ -307,29 +303,35 @@ msgid "" "entry_points_selectable` for compatibility options." msgstr "" -#: ../../library/importlib.metadata.rst:188 -msgid "Distribution metadata" +#: ../../library/importlib.metadata.rst:183 +msgid "" +"``EntryPoint`` objects no longer present a tuple-like interface (:meth:" +"`~object.__getitem__`)." msgstr "" #: ../../library/importlib.metadata.rst:190 +msgid "Distribution metadata" +msgstr "" + +#: ../../library/importlib.metadata.rst:192 msgid "" "Every `Distribution Package `_ includes some metadata, which you can extract " "using the ``metadata()`` function::" msgstr "" -#: ../../library/importlib.metadata.rst:194 +#: ../../library/importlib.metadata.rst:196 msgid ">>> wheel_metadata = metadata('wheel') " msgstr ">>> wheel_metadata = metadata('wheel') " -#: ../../library/importlib.metadata.rst:196 +#: ../../library/importlib.metadata.rst:198 msgid "" "The keys of the returned data structure, a ``PackageMetadata``, name the " "metadata keywords, and the values are returned unparsed from the " "distribution metadata::" msgstr "" -#: ../../library/importlib.metadata.rst:200 +#: ../../library/importlib.metadata.rst:202 msgid "" ">>> wheel_metadata['Requires-Python'] \n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" @@ -337,13 +339,13 @@ msgstr "" ">>> wheel_metadata['Requires-Python'] \n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" -#: ../../library/importlib.metadata.rst:203 +#: ../../library/importlib.metadata.rst:205 msgid "" "``PackageMetadata`` also presents a ``json`` attribute that returns all the " "metadata in a JSON-compatible form per :PEP:`566`::" msgstr "" -#: ../../library/importlib.metadata.rst:206 +#: ../../library/importlib.metadata.rst:208 msgid "" ">>> wheel_metadata.json['requires_python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" @@ -351,7 +353,7 @@ msgstr "" ">>> wheel_metadata.json['requires_python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" -#: ../../library/importlib.metadata.rst:211 +#: ../../library/importlib.metadata.rst:213 msgid "" "The actual type of the object returned by ``metadata()`` is an " "implementation detail and should be accessed only through the interface " @@ -359,28 +361,28 @@ msgid "" "readthedocs.io/en/latest/api.html#importlib_metadata.PackageMetadata>`_." msgstr "" -#: ../../library/importlib.metadata.rst:216 +#: ../../library/importlib.metadata.rst:218 msgid "" "The ``Description`` is now included in the metadata when presented through " "the payload. Line continuation characters have been removed." msgstr "" -#: ../../library/importlib.metadata.rst:220 +#: ../../library/importlib.metadata.rst:222 msgid "The ``json`` attribute was added." msgstr "新增 ``json`` 屬性。" -#: ../../library/importlib.metadata.rst:226 +#: ../../library/importlib.metadata.rst:228 msgid "Distribution versions" msgstr "" -#: ../../library/importlib.metadata.rst:228 +#: ../../library/importlib.metadata.rst:230 msgid "" "The ``version()`` function is the quickest way to get a `Distribution " "Package `_'s version number, as a string::" msgstr "" -#: ../../library/importlib.metadata.rst:232 +#: ../../library/importlib.metadata.rst:234 msgid "" ">>> version('wheel') \n" "'0.32.3'" @@ -388,11 +390,11 @@ msgstr "" ">>> version('wheel') \n" "'0.32.3'" -#: ../../library/importlib.metadata.rst:239 +#: ../../library/importlib.metadata.rst:241 msgid "Distribution files" msgstr "" -#: ../../library/importlib.metadata.rst:241 +#: ../../library/importlib.metadata.rst:243 msgid "" "You can also get the full set of files contained within a distribution. The " "``files()`` function takes a `Distribution Package >> util = [p for p in files('wheel') if 'util.py' in str(p)][0] \n" ">>> util \n" @@ -425,11 +427,11 @@ msgstr "" ">>> util.hash \n" "" -#: ../../library/importlib.metadata.rst:258 +#: ../../library/importlib.metadata.rst:260 msgid "Once you have the file, you can also read its contents::" msgstr "" -#: ../../library/importlib.metadata.rst:260 +#: ../../library/importlib.metadata.rst:262 msgid "" ">>> print(util.read_text()) \n" "import base64\n" @@ -449,13 +451,13 @@ msgstr "" " return s.encode('utf-8')\n" " return s" -#: ../../library/importlib.metadata.rst:269 +#: ../../library/importlib.metadata.rst:271 msgid "" "You can also use the ``locate`` method to get a the absolute path to the " "file::" msgstr "" -#: ../../library/importlib.metadata.rst:272 +#: ../../library/importlib.metadata.rst:274 msgid "" ">>> util.locate() \n" "PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')" @@ -463,7 +465,7 @@ msgstr "" ">>> util.locate() \n" "PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')" -#: ../../library/importlib.metadata.rst:275 +#: ../../library/importlib.metadata.rst:277 msgid "" "In the case where the metadata file listing files (RECORD or SOURCES.txt) is " "missing, ``files()`` will return ``None``. The caller may wish to wrap calls " @@ -473,18 +475,18 @@ msgid "" "present." msgstr "" -#: ../../library/importlib.metadata.rst:286 +#: ../../library/importlib.metadata.rst:288 msgid "Distribution requirements" msgstr "" -#: ../../library/importlib.metadata.rst:288 +#: ../../library/importlib.metadata.rst:290 msgid "" "To get the full set of requirements for a `Distribution Package `_, use " "the ``requires()`` function::" msgstr "" -#: ../../library/importlib.metadata.rst:292 +#: ../../library/importlib.metadata.rst:294 msgid "" ">>> requires('wheel') \n" "[\"pytest (>=3.0.0) ; extra == 'test'\", \"pytest-cov ; extra == 'test'\"]" @@ -492,11 +494,11 @@ msgstr "" ">>> requires('wheel') \n" "[\"pytest (>=3.0.0) ; extra == 'test'\", \"pytest-cov ; extra == 'test'\"]" -#: ../../library/importlib.metadata.rst:300 +#: ../../library/importlib.metadata.rst:302 msgid "Mapping import to distribution packages" msgstr "" -#: ../../library/importlib.metadata.rst:302 +#: ../../library/importlib.metadata.rst:304 msgid "" "A convenience method to resolve the `Distribution Package `_ name (or names, " @@ -505,7 +507,7 @@ msgid "" "glossary/#term-Import-Package>`_::" msgstr "" -#: ../../library/importlib.metadata.rst:307 +#: ../../library/importlib.metadata.rst:309 msgid "" ">>> packages_distributions()\n" "{'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': " @@ -515,18 +517,18 @@ msgstr "" "{'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': " "['jaraco.classes', 'jaraco.functools'], ...}" -#: ../../library/importlib.metadata.rst:310 +#: ../../library/importlib.metadata.rst:312 msgid "" "Some editable installs, `do not supply top-level names `_, and thus this function is not " "reliable with such installs." msgstr "" -#: ../../library/importlib.metadata.rst:319 +#: ../../library/importlib.metadata.rst:321 msgid "Distributions" msgstr "" -#: ../../library/importlib.metadata.rst:321 +#: ../../library/importlib.metadata.rst:323 msgid "" "While the above API is the most common and convenient usage, you can get all " "of that information from the ``Distribution`` class. A ``Distribution`` is " @@ -535,7 +537,7 @@ msgid "" "Package>`_. You can get the ``Distribution`` instance::" msgstr "" -#: ../../library/importlib.metadata.rst:327 +#: ../../library/importlib.metadata.rst:329 msgid "" ">>> from importlib.metadata import distribution \n" ">>> dist = distribution('wheel') " @@ -543,13 +545,13 @@ msgstr "" ">>> from importlib.metadata import distribution \n" ">>> dist = distribution('wheel') " -#: ../../library/importlib.metadata.rst:330 +#: ../../library/importlib.metadata.rst:332 msgid "" "Thus, an alternative way to get the version number is through the " "``Distribution`` instance::" msgstr "" -#: ../../library/importlib.metadata.rst:333 +#: ../../library/importlib.metadata.rst:335 msgid "" ">>> dist.version \n" "'0.32.3'" @@ -557,13 +559,13 @@ msgstr "" ">>> dist.version \n" "'0.32.3'" -#: ../../library/importlib.metadata.rst:336 +#: ../../library/importlib.metadata.rst:338 msgid "" "There are all kinds of additional metadata available on the ``Distribution`` " "instance::" msgstr "" -#: ../../library/importlib.metadata.rst:339 +#: ../../library/importlib.metadata.rst:341 msgid "" ">>> dist.metadata['Requires-Python'] \n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'\n" @@ -575,18 +577,35 @@ msgstr "" ">>> dist.metadata['License'] \n" "'MIT'" -#: ../../library/importlib.metadata.rst:344 +#: ../../library/importlib.metadata.rst:346 +msgid "" +"For editable packages, an ``origin`` property may present :pep:`610` " +"metadata::" +msgstr "" + +#: ../../library/importlib.metadata.rst:349 +msgid "" +">>> dist.origin.url\n" +"'file:///path/to/wheel-0.32.3.editable-py3-none-any.whl'" +msgstr "" + +#: ../../library/importlib.metadata.rst:352 msgid "" "The full set of available metadata is not described here. See the `Core " "metadata specifications `_ for additional details." msgstr "" -#: ../../library/importlib.metadata.rst:349 +#: ../../library/importlib.metadata.rst:355 +#, fuzzy +msgid "The ``.origin`` property was added." +msgstr "新增 ``json`` 屬性。" + +#: ../../library/importlib.metadata.rst:359 msgid "Distribution Discovery" msgstr "" -#: ../../library/importlib.metadata.rst:351 +#: ../../library/importlib.metadata.rst:361 msgid "" "By default, this package provides built-in support for discovery of metadata " "for file system and zip file `Distribution Package `_ metadata is not available through :" @@ -621,14 +640,14 @@ msgid "" "on :data:`sys.meta_path`." msgstr "" -#: ../../library/importlib.metadata.rst:370 +#: ../../library/importlib.metadata.rst:380 msgid "" "By default ``importlib.metadata`` installs a finder for distribution " "packages found on the file system. This finder doesn't actually find any " "*distributions*, but it can find their metadata." msgstr "" -#: ../../library/importlib.metadata.rst:375 +#: ../../library/importlib.metadata.rst:385 msgid "" "The abstract class :py:class:`importlib.abc.MetaPathFinder` defines the " "interface expected of finders by Python's import system. ``importlib." @@ -638,7 +657,7 @@ msgid "" "base class, which defines this abstract method::" msgstr "" -#: ../../library/importlib.metadata.rst:383 +#: ../../library/importlib.metadata.rst:393 msgid "" "@abc.abstractmethod\n" "def find_distributions(context=DistributionFinder.Context()):\n" @@ -647,14 +666,14 @@ msgid "" " \"\"\"" msgstr "" -#: ../../library/importlib.metadata.rst:389 +#: ../../library/importlib.metadata.rst:399 msgid "" "The ``DistributionFinder.Context`` object provides ``.path`` and ``.name`` " "properties indicating the path to search and name to match and may supply " "other relevant context." msgstr "" -#: ../../library/importlib.metadata.rst:393 +#: ../../library/importlib.metadata.rst:403 msgid "" "What this means in practice is that to support finding distribution package " "metadata in locations other than the file system, subclass ``Distribution`` " @@ -662,3 +681,109 @@ msgid "" "instances of this derived ``Distribution`` in the ``find_distributions()`` " "method." msgstr "" + +#: ../../library/importlib.metadata.rst:410 +msgid "Example" +msgstr "" + +#: ../../library/importlib.metadata.rst:412 +msgid "" +"Consider for example a custom finder that loads Python modules from a " +"database::" +msgstr "" + +#: ../../library/importlib.metadata.rst:415 +msgid "" +"class DatabaseImporter(importlib.abc.MetaPathFinder):\n" +" def __init__(self, db):\n" +" self.db = db\n" +"\n" +" def find_spec(self, fullname, target=None) -> ModuleSpec:\n" +" return self.db.spec_from_name(fullname)\n" +"\n" +"sys.meta_path.append(DatabaseImporter(connect_db(...)))" +msgstr "" + +#: ../../library/importlib.metadata.rst:424 +msgid "" +"That importer now presumably provides importable modules from a database, " +"but it provides no metadata or entry points. For this custom importer to " +"provide metadata, it would also need to implement ``DistributionFinder``::" +msgstr "" + +#: ../../library/importlib.metadata.rst:429 +msgid "" +"from importlib.metadata import DistributionFinder\n" +"\n" +"class DatabaseImporter(DistributionFinder):\n" +" ...\n" +"\n" +" def find_distributions(self, context=DistributionFinder.Context()):\n" +" query = dict(name=context.name) if context.name else {}\n" +" for dist_record in self.db.query_distributions(query):\n" +" yield DatabaseDistribution(dist_record)" +msgstr "" + +#: ../../library/importlib.metadata.rst:439 +msgid "" +"In this way, ``query_distributions`` would return records for each " +"distribution served by the database matching the query. For example, if " +"``requests-1.0`` is in the database, ``find_distributions`` would yield a " +"``DatabaseDistribution`` for ``Context(name='requests')`` or " +"``Context(name=None)``." +msgstr "" + +#: ../../library/importlib.metadata.rst:445 +msgid "" +"For the sake of simplicity, this example ignores ``context.path``\\. The " +"``path`` attribute defaults to ``sys.path`` and is the set of import paths " +"to be considered in the search. A ``DatabaseImporter`` could potentially " +"function without any concern for a search path. Assuming the importer does " +"no partitioning, the \"path\" would be irrelevant. In order to illustrate " +"the purpose of ``path``, the example would need to illustrate a more complex " +"``DatabaseImporter`` whose behavior varied depending on ``sys.path``/" +"``PYTHONPATH``. In that case, the ``find_distributions`` should honor the " +"``context.path`` and only yield ``Distribution``\\ s pertinent to that path." +msgstr "" + +#: ../../library/importlib.metadata.rst:456 +msgid "``DatabaseDistribution``, then, would look something like::" +msgstr "" + +#: ../../library/importlib.metadata.rst:458 +msgid "" +"class DatabaseDistribution(importlib.metadata.Distributon):\n" +" def __init__(self, record):\n" +" self.record = record\n" +"\n" +" def read_text(self, filename):\n" +" \"\"\"\n" +" Read a file like \"METADATA\" for the current distribution.\n" +" \"\"\"\n" +" if filename == \"METADATA\":\n" +" return f\"\"\"Name: {self.record.name}\n" +"Version: {self.record.version}\n" +"\"\"\"\n" +" if filename == \"entry_points.txt\":\n" +" return \"\\n\".join(\n" +" f\"\"\"[{ep.group}]\\n{ep.name}={ep.value}\"\"\"\n" +" for ep in self.record.entry_points)\n" +"\n" +" def locate_file(self, path):\n" +" raise RuntimeError(\"This distribution has no file system\")" +msgstr "" + +#: ../../library/importlib.metadata.rst:478 +msgid "" +"This basic implementation should provide metadata and entry points for " +"packages served by the ``DatabaseImporter``, assuming that the ``record`` " +"supplies suitable ``.name``, ``.version``, and ``.entry_points`` attributes." +msgstr "" + +#: ../../library/importlib.metadata.rst:483 +msgid "" +"The ``DatabaseDistribution`` may also provide other metadata files, like " +"``RECORD`` (required for ``Distribution.files``) or override the " +"implementation of ``Distribution.files``. See the source for more " +"inspiration." +msgstr "" diff --git a/library/importlib.po b/library/importlib.po index 558737fc77..093b6063c0 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1363,7 +1363,7 @@ msgstr "" msgid "Multi-phase init is now required for use in subinterpreters." msgstr "" -#: ../../library/importlib.rst:1109 +#: ../../library/importlib.rst:1109 ../../library/importlib.rst:1300 msgid "Name of the module the loader supports." msgstr "" @@ -1519,27 +1519,100 @@ msgid "" "and how the module's :attr:`__file__` is populated." msgstr "" -#: ../../library/importlib.rst:1245 +#: ../../library/importlib.rst:1246 +msgid "" +"A specialization of :class:`importlib.machinery.ExtensionFileLoader` that is " +"able to load extension modules in Framework format." +msgstr "" + +#: ../../library/importlib.rst:1249 +msgid "" +"For compatibility with the iOS App Store, *all* binary modules in an iOS app " +"must be dynamic libraries, contained in a framework with appropriate " +"metadata, stored in the ``Frameworks`` folder of the packaged app. There can " +"be only a single binary per framework, and there can be no executable binary " +"material outside the Frameworks folder." +msgstr "" + +#: ../../library/importlib.rst:1255 +msgid "" +"To accommodate this requirement, when running on iOS, extension module " +"binaries are *not* packaged as ``.so`` files on ``sys.path``, but as " +"individual standalone frameworks. To discover those frameworks, this loader " +"is be registered against the ``.fwork`` file extension, with a ``.fwork`` " +"file acting as a placeholder in the original location of the binary on ``sys." +"path``. The ``.fwork`` file contains the path of the actual binary in the " +"``Frameworks`` folder, relative to the app bundle. To allow for resolving a " +"framework-packaged binary back to the original location, the framework is " +"expected to contain a ``.origin`` file that contains the location of the ``." +"fwork`` file, relative to the app bundle." +msgstr "" + +#: ../../library/importlib.rst:1266 +msgid "" +"For example, consider the case of an import ``from foo.bar import _whiz``, " +"where ``_whiz`` is implemented with the binary module ``sources/foo/bar/" +"_whiz.abi3.so``, with ``sources`` being the location registered on ``sys." +"path``, relative to the application bundle. This module *must* be " +"distributed as ``Frameworks/foo.bar._whiz.framework/foo.bar._whiz`` " +"(creating the framework name from the full import path of the module), with " +"an ``Info.plist`` file in the ``.framework`` directory identifying the " +"binary as a framework. The ``foo.bar._whiz`` module would be represented in " +"the original location with a ``sources/foo/bar/_whiz.abi3.fwork`` marker " +"file, containing the path ``Frameworks/foo.bar._whiz/foo.bar._whiz``. The " +"framework would also contain ``Frameworks/foo.bar._whiz.framework/foo.bar." +"_whiz.origin``, containing the path to the ``.fwork`` file." +msgstr "" + +#: ../../library/importlib.rst:1280 +msgid "" +"When a module is loaded with this loader, the ``__file__`` for the module " +"will report as the location of the ``.fwork`` file. This allows code to use " +"the ``__file__`` of a module as an anchor for file system traveral. " +"However, the spec origin will reference the location of the *actual* binary " +"in the ``.framework`` folder." +msgstr "" + +#: ../../library/importlib.rst:1286 +msgid "" +"The Xcode project building the app is responsible for converting any ``.so`` " +"files from wherever they exist in the ``PYTHONPATH`` into frameworks in the " +"``Frameworks`` folder (including stripping extensions from the module file, " +"the addition of framework metadata, and signing the resulting framework), " +"and creating the ``.fwork`` and ``.origin`` files. This will usually be done " +"with a build step in the Xcode project; see the iOS documentation for " +"details on how to construct this build step." +msgstr "" + +#: ../../library/importlib.rst:1296 +msgid ":ref:`Availability `: iOS." +msgstr "" + +#: ../../library/importlib.rst:1304 +msgid "Path to the ``.fwork`` file for the extension module." +msgstr "" + +#: ../../library/importlib.rst:1308 msgid ":mod:`importlib.util` -- Utility code for importers" msgstr "" -#: ../../library/importlib.rst:1251 +#: ../../library/importlib.rst:1314 msgid "**Source code:** :source:`Lib/importlib/util.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/util.py`" -#: ../../library/importlib.rst:1255 +#: ../../library/importlib.rst:1318 msgid "" "This module contains the various objects that help in the construction of " "an :term:`importer`." msgstr "" -#: ../../library/importlib.rst:1260 +#: ../../library/importlib.rst:1323 msgid "" "The bytes which represent the bytecode version number. If you need help with " "loading/writing bytecode then consider :class:`importlib.abc.SourceLoader`." msgstr "" -#: ../../library/importlib.rst:1267 +#: ../../library/importlib.rst:1330 msgid "" "Return the :pep:`3147`/:pep:`488` path to the byte-compiled file associated " "with the source *path*. For example, if *path* is ``/foo/bar/baz.py`` the " @@ -1549,7 +1622,7 @@ msgid "" "`NotImplementedError` will be raised)." msgstr "" -#: ../../library/importlib.rst:1274 +#: ../../library/importlib.rst:1337 msgid "" "The *optimization* parameter is used to specify the optimization level of " "the bytecode file. An empty string represents no optimization, so ``/foo/bar/" @@ -1562,7 +1635,7 @@ msgid "" "be alphanumeric, else :exc:`ValueError` is raised." msgstr "" -#: ../../library/importlib.rst:1284 +#: ../../library/importlib.rst:1347 msgid "" "The *debug_override* parameter is deprecated and can be used to override the " "system's value for ``__debug__``. A ``True`` value is the equivalent of " @@ -1571,18 +1644,18 @@ msgid "" "are not ``None`` then :exc:`TypeError` is raised." msgstr "" -#: ../../library/importlib.rst:1292 +#: ../../library/importlib.rst:1355 msgid "" "The *optimization* parameter was added and the *debug_override* parameter " "was deprecated." msgstr "" -#: ../../library/importlib.rst:1296 ../../library/importlib.rst:1312 -#: ../../library/importlib.rst:1401 +#: ../../library/importlib.rst:1359 ../../library/importlib.rst:1375 +#: ../../library/importlib.rst:1464 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/importlib.rst:1302 +#: ../../library/importlib.rst:1365 msgid "" "Given the *path* to a :pep:`3147` file name, return the associated source " "code file path. For example, if *path* is ``/foo/bar/__pycache__/baz." @@ -1592,25 +1665,25 @@ msgid "" "cache_tag` is not defined, :exc:`NotImplementedError` is raised." msgstr "" -#: ../../library/importlib.rst:1317 +#: ../../library/importlib.rst:1380 msgid "" "Decode the given bytes representing source code and return it as a string " "with universal newlines (as required by :meth:`importlib.abc.InspectLoader." "get_source`)." msgstr "" -#: ../../library/importlib.rst:1325 +#: ../../library/importlib.rst:1388 msgid "Resolve a relative module name to an absolute one." msgstr "" -#: ../../library/importlib.rst:1327 +#: ../../library/importlib.rst:1390 msgid "" "If **name** has no leading dots, then **name** is simply returned. This " "allows for usage such as ``importlib.util.resolve_name('sys', __spec__." "parent)`` without doing a check to see if the **package** argument is needed." msgstr "" -#: ../../library/importlib.rst:1332 +#: ../../library/importlib.rst:1395 msgid "" ":exc:`ImportError` is raised if **name** is a relative module name but " "**package** is a false value (e.g. ``None`` or the empty string). :exc:" @@ -1618,13 +1691,13 @@ msgid "" "package (e.g. requesting ``..bacon`` from within the ``spam`` package)." msgstr "" -#: ../../library/importlib.rst:1340 +#: ../../library/importlib.rst:1403 msgid "" "To improve consistency with import statements, raise :exc:`ImportError` " "instead of :exc:`ValueError` for invalid relative import attempts." msgstr "" -#: ../../library/importlib.rst:1347 +#: ../../library/importlib.rst:1410 msgid "" "Find the :term:`spec ` for a module, optionally relative to the " "specified **package** name. If the module is in :data:`sys.modules`, then " @@ -1634,30 +1707,30 @@ msgid "" "if no spec is found." msgstr "" -#: ../../library/importlib.rst:1354 +#: ../../library/importlib.rst:1417 msgid "" "If **name** is for a submodule (contains a dot), the parent module is " "automatically imported." msgstr "" -#: ../../library/importlib.rst:1357 +#: ../../library/importlib.rst:1420 msgid "**name** and **package** work the same as for :func:`import_module`." msgstr "" -#: ../../library/importlib.rst:1361 +#: ../../library/importlib.rst:1424 msgid "" "Raises :exc:`ModuleNotFoundError` instead of :exc:`AttributeError` if " "**package** is in fact not a package (i.e. lacks a :attr:`__path__` " "attribute)." msgstr "" -#: ../../library/importlib.rst:1368 +#: ../../library/importlib.rst:1431 msgid "" "Create a new module based on **spec** and :meth:`spec.loader.create_module " "`." msgstr "" -#: ../../library/importlib.rst:1371 +#: ../../library/importlib.rst:1434 msgid "" "If :meth:`spec.loader.create_module ` " "does not return ``None``, then any pre-existing attributes will not be " @@ -1665,14 +1738,14 @@ msgid "" "accessing **spec** or setting an attribute on the module." msgstr "" -#: ../../library/importlib.rst:1376 +#: ../../library/importlib.rst:1439 msgid "" "This function is preferred over using :class:`types.ModuleType` to create a " "new module as **spec** is used to set as many import-controlled attributes " "on the module as possible." msgstr "" -#: ../../library/importlib.rst:1384 +#: ../../library/importlib.rst:1447 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on a loader. The parameters have the same meaning as they do " @@ -1681,7 +1754,7 @@ msgid "" "spec." msgstr "" -#: ../../library/importlib.rst:1394 +#: ../../library/importlib.rst:1457 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on the path to a file. Missing information will be filled in " @@ -1689,14 +1762,14 @@ msgid "" "module will be file-based." msgstr "" -#: ../../library/importlib.rst:1406 +#: ../../library/importlib.rst:1469 msgid "" "Return the hash of *source_bytes* as bytes. A hash-based ``.pyc`` file " "embeds the :func:`source_hash` of the corresponding source file's contents " "in its header." msgstr "" -#: ../../library/importlib.rst:1414 +#: ../../library/importlib.rst:1477 msgid "" "A context manager that can temporarily skip the compatibility check for " "extension modules. By default the check is enabled and will fail when a " @@ -1705,33 +1778,33 @@ msgid "" "interpreter GIL, when imported in an interpreter with its own GIL." msgstr "" -#: ../../library/importlib.rst:1421 +#: ../../library/importlib.rst:1484 msgid "" "Note that this function is meant to accommodate an unusual case; one which " "is likely to eventually go away. There's is a pretty good chance this is " "not what you were looking for." msgstr "" -#: ../../library/importlib.rst:1425 +#: ../../library/importlib.rst:1488 msgid "" "You can get the same effect as this function by implementing the basic " "interface of multi-phase init (:pep:`489`) and lying about support for " "multiple interpreters (or per-interpreter GIL)." msgstr "" -#: ../../library/importlib.rst:1430 +#: ../../library/importlib.rst:1493 msgid "" "Using this function to disable the check can lead to unexpected behavior and " "even crashes. It should only be used during extension module development." msgstr "" -#: ../../library/importlib.rst:1438 +#: ../../library/importlib.rst:1501 msgid "" "A class which postpones the execution of the loader of a module until the " "module has an attribute accessed." msgstr "" -#: ../../library/importlib.rst:1441 +#: ../../library/importlib.rst:1504 msgid "" "This class **only** works with loaders that define :meth:`~importlib.abc." "Loader.exec_module` as control over what module type is used for the module " @@ -1744,7 +1817,7 @@ msgid "" "raised if such a substitution is detected." msgstr "" -#: ../../library/importlib.rst:1452 +#: ../../library/importlib.rst:1515 msgid "" "For projects where startup time is critical, this class allows for " "potentially minimizing the cost of loading a module if it is never used. For " @@ -1753,21 +1826,21 @@ msgid "" "postponed and thus occurring out of context." msgstr "" -#: ../../library/importlib.rst:1460 +#: ../../library/importlib.rst:1523 msgid "" "Began calling :meth:`~importlib.abc.Loader.create_module`, removing the " "compatibility warning for :class:`importlib.machinery.BuiltinImporter` and :" "class:`importlib.machinery.ExtensionFileLoader`." msgstr "" -#: ../../library/importlib.rst:1467 +#: ../../library/importlib.rst:1530 msgid "" "A class method which returns a callable that creates a lazy loader. This is " "meant to be used in situations where the loader is passed by class instead " "of by instance. ::" msgstr "" -#: ../../library/importlib.rst:1472 +#: ../../library/importlib.rst:1535 msgid "" "suffixes = importlib.machinery.SOURCE_SUFFIXES\n" "loader = importlib.machinery.SourceFileLoader\n" @@ -1779,20 +1852,20 @@ msgstr "" "lazy_loader = importlib.util.LazyLoader.factory(loader)\n" "finder = importlib.machinery.FileFinder(path, (lazy_loader, suffixes))" -#: ../../library/importlib.rst:1480 +#: ../../library/importlib.rst:1543 msgid "Examples" msgstr "範例" -#: ../../library/importlib.rst:1483 +#: ../../library/importlib.rst:1546 msgid "Importing programmatically" msgstr "" -#: ../../library/importlib.rst:1485 +#: ../../library/importlib.rst:1548 msgid "" "To programmatically import a module, use :func:`importlib.import_module`. ::" msgstr "" -#: ../../library/importlib.rst:1488 +#: ../../library/importlib.rst:1551 msgid "" "import importlib\n" "\n" @@ -1802,23 +1875,23 @@ msgstr "" "\n" "itertools = importlib.import_module('itertools')" -#: ../../library/importlib.rst:1494 +#: ../../library/importlib.rst:1557 msgid "Checking if a module can be imported" msgstr "" -#: ../../library/importlib.rst:1496 +#: ../../library/importlib.rst:1559 msgid "" "If you need to find out if a module can be imported without actually doing " "the import, then you should use :func:`importlib.util.find_spec`." msgstr "" -#: ../../library/importlib.rst:1499 +#: ../../library/importlib.rst:1562 msgid "" "Note that if ``name`` is a submodule (contains a dot), :func:`importlib.util." "find_spec` will import the parent module. ::" msgstr "" -#: ../../library/importlib.rst:1503 +#: ../../library/importlib.rst:1566 msgid "" "import importlib.util\n" "import sys\n" @@ -1838,15 +1911,15 @@ msgid "" " print(f\"can't find the {name!r} module\")" msgstr "" -#: ../../library/importlib.rst:1522 +#: ../../library/importlib.rst:1585 msgid "Importing a source file directly" msgstr "" -#: ../../library/importlib.rst:1524 +#: ../../library/importlib.rst:1587 msgid "To import a Python source file directly, use the following recipe::" msgstr "" -#: ../../library/importlib.rst:1526 +#: ../../library/importlib.rst:1589 msgid "" "import importlib.util\n" "import sys\n" @@ -1862,15 +1935,15 @@ msgid "" "spec.loader.exec_module(module)" msgstr "" -#: ../../library/importlib.rst:1541 +#: ../../library/importlib.rst:1604 msgid "Implementing lazy imports" msgstr "" -#: ../../library/importlib.rst:1543 +#: ../../library/importlib.rst:1606 msgid "The example below shows how to implement lazy imports::" msgstr "" -#: ../../library/importlib.rst:1545 +#: ../../library/importlib.rst:1608 msgid "" ">>> import importlib.util\n" ">>> import sys\n" @@ -1890,11 +1963,11 @@ msgid "" "False" msgstr "" -#: ../../library/importlib.rst:1565 +#: ../../library/importlib.rst:1628 msgid "Setting up an importer" msgstr "" -#: ../../library/importlib.rst:1567 +#: ../../library/importlib.rst:1630 msgid "" "For deep customizations of import, you typically want to implement an :term:" "`importer`. This means managing both the :term:`finder` and :term:`loader` " @@ -1908,7 +1981,7 @@ msgid "" "for the appropriate classes defined within this package)::" msgstr "" -#: ../../library/importlib.rst:1578 +#: ../../library/importlib.rst:1641 msgid "" "import importlib.machinery\n" "import sys\n" @@ -1932,11 +2005,11 @@ msgid "" "sys.path_hooks.append(SpamPathEntryFinder.path_hook(loader_details))" msgstr "" -#: ../../library/importlib.rst:1599 +#: ../../library/importlib.rst:1662 msgid "Approximating :func:`importlib.import_module`" msgstr "" -#: ../../library/importlib.rst:1601 +#: ../../library/importlib.rst:1664 msgid "" "Import itself is implemented in Python code, making it possible to expose " "most of the import machinery through importlib. The following helps " @@ -1944,7 +2017,7 @@ msgid "" "approximate implementation of :func:`importlib.import_module`::" msgstr "" -#: ../../library/importlib.rst:1607 +#: ../../library/importlib.rst:1670 msgid "" "import importlib.util\n" "import sys\n" diff --git a/library/importlib.resources.po b/library/importlib.resources.po index f1e63a27fc..01d3b9aa4c 100644 --- a/library/importlib.resources.po +++ b/library/importlib.resources.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -137,187 +137,227 @@ msgstr "" msgid "Added support for *traversable* representing a directory." msgstr "" -#: ../../library/importlib.resources.rst:103 -msgid "Deprecated functions" -msgstr "已棄用函式" - #: ../../library/importlib.resources.rst:105 +msgid "Functional API" +msgstr "" + +#: ../../library/importlib.resources.rst:107 msgid "" -"An older, deprecated set of functions is still available, but is scheduled " -"for removal in a future version of Python. The main drawback of these " -"functions is that they do not support directories: they assume all resources " -"are located directly within a *package*." +"A set of simplified, backwards-compatible helpers is available. These allow " +"common operations in a single function call." +msgstr "" + +#: ../../library/importlib.resources.rst:110 +msgid "For all the following functions:" msgstr "" #: ../../library/importlib.resources.rst:112 msgid "" -"Whenever a function accepts a ``Package`` argument, you can pass in either " -"a :class:`module object ` or a module name as a string. " -"You can only pass module objects whose ``__spec__." -"submodule_search_locations`` is not ``None``." +"*anchor* is an :class:`~importlib.resources.Anchor`, as in :func:`~importlib." +"resources.files`. Unlike in ``files``, it may not be omitted." +msgstr "" + +#: ../../library/importlib.resources.rst:116 +msgid "" +"*path_names* are components of a resource's path name, relative to the " +"anchor. For example, to get the text of resource named ``info.txt``, use::" msgstr "" -#: ../../library/importlib.resources.rst:117 -msgid "The ``Package`` type is defined as ``Union[str, ModuleType]``." +#: ../../library/importlib.resources.rst:120 +msgid "importlib.resources.read_text(my_module, \"info.txt\")" msgstr "" -#: ../../library/importlib.resources.rst:124 +#: ../../library/importlib.resources.rst:122 msgid "" -"For *resource* arguments of the functions below, you can pass in the name of " -"a resource as a string or a :class:`path-like object `." +"Like :meth:`Traversable.joinpath `, The " +"individual components should use forward slashes (``/``) as path separators. " +"For example, the following are equivalent::" msgstr "" -#: ../../library/importlib.resources.rst:128 -msgid "The ``Resource`` type is defined as ``Union[str, os.PathLike]``." +#: ../../library/importlib.resources.rst:127 +msgid "" +"importlib.resources.read_binary(my_module, \"pics/painting.png\")\n" +"importlib.resources.read_binary(my_module, \"pics\", \"painting.png\")" msgstr "" -#: ../../library/importlib.resources.rst:133 -msgid "Open for binary reading the *resource* within *package*." +#: ../../library/importlib.resources.rst:130 +msgid "" +"For backward compatibility reasons, functions that read text require an " +"explicit *encoding* argument if multiple *path_names* are given. For " +"example, to get the text of ``info/chapter1.txt``, use::" msgstr "" -#: ../../library/importlib.resources.rst:135 +#: ../../library/importlib.resources.rst:134 msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements. *resource* is the name of the resource to open " -"within *package*; it may not contain path separators and it may not have sub-" -"resources (i.e. it cannot be a directory). This function returns a ``typing." -"BinaryIO`` instance, a binary I/O stream open for reading." +"importlib.resources.read_text(my_module, \"info\", \"chapter1.txt\",\n" +" encoding='utf-8')" msgstr "" -#: ../../library/importlib.resources.rst:143 -#: ../../library/importlib.resources.rst:164 -#: ../../library/importlib.resources.rst:182 -#: ../../library/importlib.resources.rst:201 -#: ../../library/importlib.resources.rst:237 -#: ../../library/importlib.resources.rst:253 -msgid "Calls to this function can be replaced by::" +#: ../../library/importlib.resources.rst:139 +msgid "Open the named resource for binary reading." msgstr "" -#: ../../library/importlib.resources.rst:145 -msgid "files(package).joinpath(resource).open('rb')" +#: ../../library/importlib.resources.rst:141 +#: ../../library/importlib.resources.rst:184 +#: ../../library/importlib.resources.rst:232 +#: ../../library/importlib.resources.rst:249 +#: ../../library/importlib.resources.rst:267 +msgid "" +"See :ref:`the introduction ` for details on " +"*anchor* and *path_names*." +msgstr "" + +#: ../../library/importlib.resources.rst:144 +msgid "" +"This function returns a :class:`~typing.BinaryIO` object, that is, a binary " +"stream open for reading." +msgstr "" + +#: ../../library/importlib.resources.rst:147 +#: ../../library/importlib.resources.rst:171 +#: ../../library/importlib.resources.rst:187 +#: ../../library/importlib.resources.rst:208 +#: ../../library/importlib.resources.rst:235 +#: ../../library/importlib.resources.rst:252 +#: ../../library/importlib.resources.rst:270 +msgid "This function is roughly equivalent to::" +msgstr "" + +#: ../../library/importlib.resources.rst:149 +#, fuzzy +msgid "files(anchor).joinpath(*path_names).open('rb')" msgstr "files(package).joinpath(resource).open('rb')" -#: ../../library/importlib.resources.rst:150 +#: ../../library/importlib.resources.rst:151 +#: ../../library/importlib.resources.rst:191 +#: ../../library/importlib.resources.rst:256 +msgid "Multiple *path_names* are accepted." +msgstr "" + +#: ../../library/importlib.resources.rst:157 msgid "" -"Open for text reading the *resource* within *package*. By default, the " -"resource is opened for reading as UTF-8." +"Open the named resource for text reading. By default, the contents are read " +"as strict UTF-8." msgstr "" -#: ../../library/importlib.resources.rst:153 +#: ../../library/importlib.resources.rst:160 +#: ../../library/importlib.resources.rst:200 +msgid "" +"See :ref:`the introduction ` for details on " +"*anchor* and *path_names*. *encoding* and *errors* have the same meaning as " +"in built-in :func:`open`." +msgstr "" + +#: ../../library/importlib.resources.rst:164 +#: ../../library/importlib.resources.rst:204 msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements. *resource* is the name of the resource to open " -"within *package*; it may not contain path separators and it may not have sub-" -"resources (i.e. it cannot be a directory). *encoding* and *errors* have the " -"same meaning as with built-in :func:`open`." +"For backward compatibility reasons, the *encoding* argument must be given " +"explicitly if there are multiple *path_names*. This limitation is scheduled " +"to be removed in Python 3.15." msgstr "" -#: ../../library/importlib.resources.rst:159 +#: ../../library/importlib.resources.rst:168 msgid "" -"This function returns a ``typing.TextIO`` instance, a text I/O stream open " -"for reading." +"This function returns a :class:`~typing.TextIO` object, that is, a text " +"stream open for reading." msgstr "" -#: ../../library/importlib.resources.rst:166 -msgid "files(package).joinpath(resource).open('r', encoding=encoding)" +#: ../../library/importlib.resources.rst:173 +#, fuzzy +msgid "files(anchor).joinpath(*path_names).open('r', encoding=encoding)" msgstr "files(package).joinpath(resource).open('r', encoding=encoding)" -#: ../../library/importlib.resources.rst:171 +#: ../../library/importlib.resources.rst:175 +#: ../../library/importlib.resources.rst:212 +#: ../../library/importlib.resources.rst:239 msgid "" -"Read and return the contents of the *resource* within *package* as ``bytes``." +"Multiple *path_names* are accepted. *encoding* and *errors* must be given as " +"keyword arguments." msgstr "" -#: ../../library/importlib.resources.rst:174 -msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements. *resource* is the name of the resource to open " -"within *package*; it may not contain path separators and it may not have sub-" -"resources (i.e. it cannot be a directory). This function returns the " -"contents of the resource as :class:`bytes`." +#: ../../library/importlib.resources.rst:182 +msgid "Read and return the contents of the named resource as :class:`bytes`." msgstr "" -#: ../../library/importlib.resources.rst:184 -msgid "files(package).joinpath(resource).read_bytes()" +#: ../../library/importlib.resources.rst:189 +#, fuzzy +msgid "files(anchor).joinpath(*path_names).read_bytes()" msgstr "files(package).joinpath(resource).read_bytes()" -#: ../../library/importlib.resources.rst:189 +#: ../../library/importlib.resources.rst:197 msgid "" -"Read and return the contents of *resource* within *package* as a ``str``. By " +"Read and return the contents of the named resource as :class:`str`. By " "default, the contents are read as strict UTF-8." msgstr "" -#: ../../library/importlib.resources.rst:192 -msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements. *resource* is the name of the resource to open " -"within *package*; it may not contain path separators and it may not have sub-" -"resources (i.e. it cannot be a directory). *encoding* and *errors* have the " -"same meaning as with built-in :func:`open`. This function returns the " -"contents of the resource as :class:`str`." -msgstr "" - -#: ../../library/importlib.resources.rst:203 -msgid "files(package).joinpath(resource).read_text(encoding=encoding)" +#: ../../library/importlib.resources.rst:210 +#, fuzzy +msgid "files(anchor).joinpath(*path_names).read_text(encoding=encoding)" msgstr "files(package).joinpath(resource).read_text(encoding=encoding)" -#: ../../library/importlib.resources.rst:208 +#: ../../library/importlib.resources.rst:219 msgid "" -"Return the path to the *resource* as an actual file system path. This " +"Provides the path to the *resource* as an actual file system path. This " "function returns a context manager for use in a :keyword:`with` statement. " "The context manager provides a :class:`pathlib.Path` object." msgstr "" -#: ../../library/importlib.resources.rst:212 +#: ../../library/importlib.resources.rst:223 msgid "" -"Exiting the context manager cleans up any temporary file created when the " -"resource needs to be extracted from e.g. a zip file." +"Exiting the context manager cleans up any temporary files created, e.g. when " +"the resource needs to be extracted from a zip file." msgstr "" -#: ../../library/importlib.resources.rst:215 +#: ../../library/importlib.resources.rst:226 msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements. *resource* is the name of the resource to open " -"within *package*; it may not contain path separators and it may not have sub-" -"resources (i.e. it cannot be a directory)." +"For example, the :meth:`~pathlib.Path.stat` method requires an actual file " +"system path; it can be used like this::" msgstr "" -#: ../../library/importlib.resources.rst:222 -msgid "Calls to this function can be replaced using :func:`as_file`::" +#: ../../library/importlib.resources.rst:229 +msgid "" +"with importlib.resources.path(anchor, \"resource.txt\") as fspath:\n" +" result = fspath.stat()" msgstr "" -#: ../../library/importlib.resources.rst:224 -msgid "as_file(files(package).joinpath(resource))" +#: ../../library/importlib.resources.rst:237 +#, fuzzy +msgid "as_file(files(anchor).joinpath(*path_names))" msgstr "as_file(files(package).joinpath(resource))" -#: ../../library/importlib.resources.rst:229 +#: ../../library/importlib.resources.rst:246 msgid "" -"Return ``True`` if there is a resource named *name* in the package, " -"otherwise ``False``. This function does not consider directories to be " -"resources. *package* is either a name or a module object which conforms to " -"the ``Package`` requirements." +"Return ``True`` if the named resource exists, otherwise ``False``. This " +"function does not consider directories to be resources." msgstr "" -#: ../../library/importlib.resources.rst:239 -msgid "files(package).joinpath(resource).is_file()" +#: ../../library/importlib.resources.rst:254 +#, fuzzy +msgid "files(anchor).joinpath(*path_names).is_file()" msgstr "files(package).joinpath(resource).is_file()" -#: ../../library/importlib.resources.rst:244 +#: ../../library/importlib.resources.rst:262 msgid "" -"Return an iterable over the named items within the package. The iterable " -"returns :class:`str` resources (e.g. files) and non-resources (e.g. " -"directories). The iterable does not recurse into subdirectories." +"Return an iterable over the named items within the package or path. The " +"iterable returns names of resources (e.g. files) and non-resources (e.g. " +"directories) as :class:`str`. The iterable does not recurse into " +"subdirectories." msgstr "" -#: ../../library/importlib.resources.rst:248 +#: ../../library/importlib.resources.rst:272 +#, fuzzy msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements." +"for resource in files(anchor).joinpath(*path_names).iterdir():\n" +" yield resource.name" msgstr "" - -#: ../../library/importlib.resources.rst:255 -msgid "" "(resource.name for resource in files(package).iterdir() if resource." "is_file())" + +#: ../../library/importlib.resources.rst:275 +msgid "" +"Prefer ``iterdir()`` as above, which offers more control over the results " +"and richer functionality." msgstr "" -"(resource.name for resource in files(package).iterdir() if resource." -"is_file())" + +#~ msgid "Deprecated functions" +#~ msgstr "已棄用函式" diff --git a/library/inspect.po b/library/inspect.po index d7fc210c67..75c786af83 100644 --- a/library/inspect.po +++ b/library/inspect.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-13 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -666,11 +666,18 @@ msgid "" "wrapped function is a Python generator function." msgstr "" -#: ../../library/inspect.rst:369 +#: ../../library/inspect.rst:366 +#, fuzzy +msgid "" +"Functions wrapped in :func:`functools.partialmethod` now return ``True`` if " +"the wrapped function is a Python generator function." +msgstr "如果物件是 Python 產生器函式,則回傳 ``True``。" + +#: ../../library/inspect.rst:372 msgid "Return ``True`` if the object is a generator." msgstr "如果物件是產生器,則回傳 ``True``。" -#: ../../library/inspect.rst:374 +#: ../../library/inspect.rst:377 msgid "" "Return ``True`` if the object is a :term:`coroutine function` (a function " "defined with an :keyword:`async def` syntax), a :func:`functools.partial` " @@ -678,54 +685,60 @@ msgid "" "`markcoroutinefunction`." msgstr "" -#: ../../library/inspect.rst:381 +#: ../../library/inspect.rst:384 msgid "" "Functions wrapped in :func:`functools.partial` now return ``True`` if the " "wrapped function is a :term:`coroutine function`." msgstr "" -#: ../../library/inspect.rst:385 +#: ../../library/inspect.rst:388 msgid "" "Sync functions marked with :func:`markcoroutinefunction` now return ``True``." msgstr "" -#: ../../library/inspect.rst:392 +#: ../../library/inspect.rst:392 ../../library/inspect.rst:462 +msgid "" +"Functions wrapped in :func:`functools.partialmethod` now return ``True`` if " +"the wrapped function is a :term:`coroutine function`." +msgstr "" + +#: ../../library/inspect.rst:399 msgid "" "Decorator to mark a callable as a :term:`coroutine function` if it would not " "otherwise be detected by :func:`iscoroutinefunction`." msgstr "" -#: ../../library/inspect.rst:395 +#: ../../library/inspect.rst:402 msgid "" "This may be of use for sync functions that return a :term:`coroutine`, if " "the function is passed to an API that requires :func:`iscoroutinefunction`." msgstr "" -#: ../../library/inspect.rst:398 +#: ../../library/inspect.rst:405 msgid "" "When possible, using an :keyword:`async def` function is preferred. Also " "acceptable is calling the function and testing the return with :func:" "`iscoroutine`." msgstr "" -#: ../../library/inspect.rst:407 +#: ../../library/inspect.rst:414 msgid "" "Return ``True`` if the object is a :term:`coroutine` created by an :keyword:" "`async def` function." msgstr "" -#: ../../library/inspect.rst:415 +#: ../../library/inspect.rst:422 msgid "" "Return ``True`` if the object can be used in :keyword:`await` expression." msgstr "" -#: ../../library/inspect.rst:417 +#: ../../library/inspect.rst:424 msgid "" "Can also be used to distinguish generator-based coroutines from regular " "generators:" msgstr "" -#: ../../library/inspect.rst:420 +#: ../../library/inspect.rst:427 msgid "" "import types\n" "\n" @@ -749,13 +762,13 @@ msgstr "" "assert not isawaitable(gen())\n" "assert isawaitable(gen_coro())" -#: ../../library/inspect.rst:438 +#: ../../library/inspect.rst:445 msgid "" "Return ``True`` if the object is an :term:`asynchronous generator` function, " "for example:" msgstr "" -#: ../../library/inspect.rst:441 +#: ../../library/inspect.rst:448 msgid "" ">>> async def agen():\n" "... yield 1\n" @@ -764,73 +777,74 @@ msgid "" "True" msgstr "" -#: ../../library/inspect.rst:451 +#: ../../library/inspect.rst:458 msgid "" "Functions wrapped in :func:`functools.partial` now return ``True`` if the " "wrapped function is an :term:`asynchronous generator` function." msgstr "" -#: ../../library/inspect.rst:458 +#: ../../library/inspect.rst:468 msgid "" "Return ``True`` if the object is an :term:`asynchronous generator iterator` " "created by an :term:`asynchronous generator` function." msgstr "" -#: ../../library/inspect.rst:465 +#: ../../library/inspect.rst:475 msgid "Return ``True`` if the object is a traceback." msgstr "" -#: ../../library/inspect.rst:470 +#: ../../library/inspect.rst:480 msgid "Return ``True`` if the object is a frame." msgstr "" -#: ../../library/inspect.rst:475 +#: ../../library/inspect.rst:485 msgid "Return ``True`` if the object is a code." msgstr "如果物件是程式碼,則回傳 ``True``。" -#: ../../library/inspect.rst:480 +#: ../../library/inspect.rst:490 msgid "" "Return ``True`` if the object is a built-in function or a bound built-in " "method." msgstr "" -#: ../../library/inspect.rst:485 +#: ../../library/inspect.rst:495 msgid "" "Return ``True`` if the type of object is a :class:`~types.MethodWrapperType`." msgstr "" -#: ../../library/inspect.rst:487 +#: ../../library/inspect.rst:497 msgid "" "These are instances of :class:`~types.MethodWrapperType`, such as :meth:" "`~object.__str__`, :meth:`~object.__eq__` and :meth:`~object.__repr__`." msgstr "" -#: ../../library/inspect.rst:495 +#: ../../library/inspect.rst:505 msgid "" "Return ``True`` if the object is a user-defined or built-in function or " "method." msgstr "如果物件是使用者定義或內建的函式或方法,則回傳 ``True``。" -#: ../../library/inspect.rst:500 +#: ../../library/inspect.rst:510 msgid "Return ``True`` if the object is an abstract base class." msgstr "如果物件是抽象基底類別,則回傳 ``True``。" -#: ../../library/inspect.rst:505 +#: ../../library/inspect.rst:515 msgid "" "Return ``True`` if the object is a method descriptor, but not if :func:" "`ismethod`, :func:`isclass`, :func:`isfunction` or :func:`isbuiltin` are " "true." msgstr "" -#: ../../library/inspect.rst:509 +#: ../../library/inspect.rst:519 msgid "" "This, for example, is true of ``int.__add__``. An object passing this test " -"has a :meth:`~object.__get__` method but not a :meth:`~object.__set__` " -"method, but beyond that the set of attributes varies. A :attr:`~definition." -"__name__` attribute is usually sensible, and :attr:`!__doc__` often is." +"has a :meth:`~object.__get__` method, but not a :meth:`~object.__set__` " +"method or a :meth:`~object.__delete__` method. Beyond that, the set of " +"attributes varies. A :attr:`~definition.__name__` attribute is usually " +"sensible, and :attr:`!__doc__` often is." msgstr "" -#: ../../library/inspect.rst:515 +#: ../../library/inspect.rst:525 msgid "" "Methods implemented via descriptors that also pass one of the other tests " "return ``False`` from the :func:`ismethoddescriptor` test, simply because " @@ -838,11 +852,19 @@ msgid "" "`~method.__func__` attribute (etc) when an object passes :func:`ismethod`." msgstr "" -#: ../../library/inspect.rst:524 +#: ../../library/inspect.rst:531 +msgid "" +"This function no longer incorrectly reports objects with :meth:`~object." +"__get__` and :meth:`~object.__delete__`, but not :meth:`~object.__set__`, as " +"being method descriptors (such objects are data descriptors, not method " +"descriptors)." +msgstr "" + +#: ../../library/inspect.rst:539 msgid "Return ``True`` if the object is a data descriptor." msgstr "如果物件是資料描述器,則回傳 ``True``。" -#: ../../library/inspect.rst:526 +#: ../../library/inspect.rst:541 msgid "" "Data descriptors have a :attr:`~object.__set__` or a :attr:`~object." "__delete__` method. Examples are properties (defined in Python), getsets, " @@ -853,33 +875,33 @@ msgid "" "and members have both of these attributes), but this is not guaranteed." msgstr "" -#: ../../library/inspect.rst:537 +#: ../../library/inspect.rst:552 msgid "Return ``True`` if the object is a getset descriptor." msgstr "" -#: ../../library/inspect.rst:541 +#: ../../library/inspect.rst:556 msgid "" "getsets are attributes defined in extension modules via :c:type:" "`PyGetSetDef` structures. For Python implementations without such types, " "this method will always return ``False``." msgstr "" -#: ../../library/inspect.rst:548 +#: ../../library/inspect.rst:563 msgid "Return ``True`` if the object is a member descriptor." msgstr "如果物件是成員描述器,則回傳 ``True``。" -#: ../../library/inspect.rst:552 +#: ../../library/inspect.rst:567 msgid "" "Member descriptors are attributes defined in extension modules via :c:type:" "`PyMemberDef` structures. For Python implementations without such types, " "this method will always return ``False``." msgstr "" -#: ../../library/inspect.rst:560 +#: ../../library/inspect.rst:575 msgid "Retrieving source code" msgstr "取得原始碼" -#: ../../library/inspect.rst:564 +#: ../../library/inspect.rst:579 msgid "" "Get the documentation string for an object, cleaned up with :func:" "`cleandoc`. If the documentation string for an object is not provided and " @@ -888,11 +910,11 @@ msgid "" "documentation string is invalid or missing." msgstr "" -#: ../../library/inspect.rst:570 +#: ../../library/inspect.rst:585 msgid "Documentation strings are now inherited if not overridden." msgstr "" -#: ../../library/inspect.rst:576 +#: ../../library/inspect.rst:591 msgid "" "Return in a single string any lines of comments immediately preceding the " "object's source code (for a class, function, or method), or at the top of " @@ -901,27 +923,27 @@ msgid "" "been defined in C or the interactive shell." msgstr "" -#: ../../library/inspect.rst:585 +#: ../../library/inspect.rst:600 msgid "" "Return the name of the (text or binary) file in which an object was defined. " "This will fail with a :exc:`TypeError` if the object is a built-in module, " "class, or function." msgstr "" -#: ../../library/inspect.rst:592 +#: ../../library/inspect.rst:607 msgid "" "Try to guess which module an object was defined in. Return ``None`` if the " "module cannot be determined." msgstr "" -#: ../../library/inspect.rst:598 +#: ../../library/inspect.rst:613 msgid "" "Return the name of the Python source file in which an object was defined or " "``None`` if no way can be identified to get the source. This will fail with " "a :exc:`TypeError` if the object is a built-in module, class, or function." msgstr "" -#: ../../library/inspect.rst:606 +#: ../../library/inspect.rst:621 msgid "" "Return a list of source lines and starting line number for an object. The " "argument may be a module, class, method, function, traceback, frame, or code " @@ -932,13 +954,13 @@ msgid "" "built-in module, class, or function." msgstr "" -#: ../../library/inspect.rst:615 ../../library/inspect.rst:629 +#: ../../library/inspect.rst:630 ../../library/inspect.rst:644 msgid "" ":exc:`OSError` is raised instead of :exc:`IOError`, now an alias of the " "former." msgstr "" -#: ../../library/inspect.rst:622 +#: ../../library/inspect.rst:637 msgid "" "Return the text of the source code for an object. The argument may be a " "module, class, method, function, traceback, frame, or code object. The " @@ -947,13 +969,13 @@ msgid "" "object is a built-in module, class, or function." msgstr "" -#: ../../library/inspect.rst:636 +#: ../../library/inspect.rst:651 msgid "" "Clean up indentation from docstrings that are indented to line up with " "blocks of code." msgstr "" -#: ../../library/inspect.rst:639 +#: ../../library/inspect.rst:654 msgid "" "All leading whitespace is removed from the first line. Any leading " "whitespace that can be uniformly removed from the second line onwards is " @@ -961,22 +983,22 @@ msgid "" "Also, all tabs are expanded to spaces." msgstr "" -#: ../../library/inspect.rst:648 +#: ../../library/inspect.rst:663 msgid "Introspecting callables with the Signature object" msgstr "" -#: ../../library/inspect.rst:652 +#: ../../library/inspect.rst:667 msgid "" "The :class:`Signature` object represents the call signature of a callable " "object and its return annotation. To retrieve a :class:`!Signature` object, " "use the :func:`!signature` function." msgstr "" -#: ../../library/inspect.rst:659 +#: ../../library/inspect.rst:674 msgid "Return a :class:`Signature` object for the given *callable*:" msgstr "" -#: ../../library/inspect.rst:661 +#: ../../library/inspect.rst:676 msgid "" ">>> from inspect import signature\n" ">>> def foo(a, *, b:int, **kwargs):\n" @@ -1008,13 +1030,13 @@ msgstr "" ">>> sig.parameters['b'].annotation\n" "" -#: ../../library/inspect.rst:678 +#: ../../library/inspect.rst:693 msgid "" "Accepts a wide range of Python callables, from plain functions and classes " "to :func:`functools.partial` objects." msgstr "" -#: ../../library/inspect.rst:681 +#: ../../library/inspect.rst:696 msgid "" "For objects defined in modules using stringized annotations (``from " "__future__ import annotations``), :func:`signature` will attempt to " @@ -1024,7 +1046,7 @@ msgid "" "func:`get_annotations` for instructions on how to use these parameters." msgstr "" -#: ../../library/inspect.rst:690 +#: ../../library/inspect.rst:705 msgid "" "Raises :exc:`ValueError` if no signature can be provided, and :exc:" "`TypeError` if that type of object is not supported. Also, if the " @@ -1033,32 +1055,32 @@ msgid "" "potentially raise any kind of exception." msgstr "" -#: ../../library/inspect.rst:696 +#: ../../library/inspect.rst:711 msgid "" "A slash(/) in the signature of a function denotes that the parameters prior " "to it are positional-only. For more info, see :ref:`the FAQ entry on " "positional-only parameters `." msgstr "" -#: ../../library/inspect.rst:700 +#: ../../library/inspect.rst:715 msgid "" "The *follow_wrapped* parameter was added. Pass ``False`` to get a signature " "of *callable* specifically (``callable.__wrapped__`` will not be used to " "unwrap decorated callables.)" msgstr "" -#: ../../library/inspect.rst:706 ../../library/inspect.rst:816 +#: ../../library/inspect.rst:721 ../../library/inspect.rst:845 msgid "The *globals*, *locals*, and *eval_str* parameters were added." msgstr "" -#: ../../library/inspect.rst:711 +#: ../../library/inspect.rst:726 msgid "" "Some callables may not be introspectable in certain implementations of " "Python. For example, in CPython, some built-in functions defined in C " "provide no metadata about their arguments." msgstr "" -#: ../../library/inspect.rst:717 +#: ../../library/inspect.rst:732 msgid "" "If the passed object has a :attr:`!__signature__` attribute, we may use it " "to create the signature. The exact semantics are an implementation detail " @@ -1066,14 +1088,14 @@ msgid "" "semantics." msgstr "" -#: ../../library/inspect.rst:725 +#: ../../library/inspect.rst:740 msgid "" "A :class:`!Signature` object represents the call signature of a function and " "its return annotation. For each parameter accepted by the function it " "stores a :class:`Parameter` object in its :attr:`parameters` collection." msgstr "" -#: ../../library/inspect.rst:730 +#: ../../library/inspect.rst:745 msgid "" "The optional *parameters* argument is a sequence of :class:`Parameter` " "objects, which is validated to check that there are no parameters with " @@ -1082,54 +1104,54 @@ msgid "" "defaults follow parameters without defaults." msgstr "" -#: ../../library/inspect.rst:736 +#: ../../library/inspect.rst:751 msgid "" "The optional *return_annotation* argument can be an arbitrary Python object. " "It represents the \"return\" annotation of the callable." msgstr "" -#: ../../library/inspect.rst:739 +#: ../../library/inspect.rst:754 msgid "" ":class:`!Signature` objects are *immutable*. Use :meth:`Signature.replace` " -"to make a modified copy." +"or :func:`copy.replace` to make a modified copy." msgstr "" -#: ../../library/inspect.rst:742 +#: ../../library/inspect.rst:757 msgid ":class:`!Signature` objects are now picklable and :term:`hashable`." msgstr "" -#: ../../library/inspect.rst:747 +#: ../../library/inspect.rst:762 msgid "A special class-level marker to specify absence of a return annotation." msgstr "" -#: ../../library/inspect.rst:751 +#: ../../library/inspect.rst:766 msgid "" "An ordered mapping of parameters' names to the corresponding :class:" "`Parameter` objects. Parameters appear in strict definition order, " "including keyword-only parameters." msgstr "" -#: ../../library/inspect.rst:755 ../../library/inspect.rst:1093 +#: ../../library/inspect.rst:770 ../../library/inspect.rst:1124 msgid "" "Python only explicitly guaranteed that it preserved the declaration order of " "keyword-only parameters as of version 3.7, although in practice this order " "had always been preserved in Python 3." msgstr "" -#: ../../library/inspect.rst:762 +#: ../../library/inspect.rst:777 msgid "" "The \"return\" annotation for the callable. If the callable has no " "\"return\" annotation, this attribute is set to :attr:`Signature.empty`." msgstr "" -#: ../../library/inspect.rst:767 +#: ../../library/inspect.rst:782 msgid "" "Create a mapping from positional and keyword arguments to parameters. " "Returns :class:`BoundArguments` if ``*args`` and ``**kwargs`` match the " "signature, or raises a :exc:`TypeError`." msgstr "" -#: ../../library/inspect.rst:773 +#: ../../library/inspect.rst:788 msgid "" "Works the same way as :meth:`Signature.bind`, but allows the omission of " "some required arguments (mimics :func:`functools.partial` behavior.) " @@ -1137,7 +1159,7 @@ msgid "" "arguments do not match the signature." msgstr "" -#: ../../library/inspect.rst:780 +#: ../../library/inspect.rst:795 msgid "" "Create a new :class:`Signature` instance based on the instance :meth:" "`replace` was invoked on. It is possible to pass different *parameters* and/" @@ -1146,7 +1168,7 @@ msgid "" "Signature`, pass in :attr:`Signature.empty`." msgstr "" -#: ../../library/inspect.rst:788 +#: ../../library/inspect.rst:803 msgid "" ">>> def test(a, b):\n" "... pass\n" @@ -1164,17 +1186,34 @@ msgstr "" ">>> str(new_sig)\n" "\"(a, b) -> 'new return anno'\"" -#: ../../library/inspect.rst:800 +#: ../../library/inspect.rst:813 +msgid "" +":class:`Signature` objects are also supported by the generic function :func:" +"`copy.replace`." +msgstr "" + +#: ../../library/inspect.rst:818 +msgid "Create a string representation of the :class:`Signature` object." +msgstr "" + +#: ../../library/inspect.rst:820 +msgid "" +"If *max_width* is passed, the method will attempt to fit the signature into " +"lines of at most *max_width* characters. If the signature is longer than " +"*max_width*, all parameters will be on separate lines." +msgstr "" + +#: ../../library/inspect.rst:829 msgid "" "Return a :class:`Signature` (or its subclass) object for a given callable " "*obj*." msgstr "" -#: ../../library/inspect.rst:803 +#: ../../library/inspect.rst:832 msgid "This method simplifies subclassing of :class:`Signature`:" msgstr "" -#: ../../library/inspect.rst:805 +#: ../../library/inspect.rst:834 msgid "" "class MySignature(Signature):\n" " pass\n" @@ -1186,129 +1225,129 @@ msgstr "" "sig = MySignature.from_callable(sum)\n" "assert isinstance(sig, MySignature)" -#: ../../library/inspect.rst:812 +#: ../../library/inspect.rst:841 msgid "Its behavior is otherwise identical to that of :func:`signature`." msgstr "" -#: ../../library/inspect.rst:822 +#: ../../library/inspect.rst:851 msgid "" ":class:`!Parameter` objects are *immutable*. Instead of modifying a :class:`!" -"Parameter` object, you can use :meth:`Parameter.replace` to create a " -"modified copy." +"Parameter` object, you can use :meth:`Parameter.replace` or :func:`copy." +"replace` to create a modified copy." msgstr "" -#: ../../library/inspect.rst:826 +#: ../../library/inspect.rst:855 msgid "Parameter objects are now picklable and :term:`hashable`." msgstr "" -#: ../../library/inspect.rst:831 +#: ../../library/inspect.rst:860 msgid "" "A special class-level marker to specify absence of default values and " "annotations." msgstr "" -#: ../../library/inspect.rst:836 +#: ../../library/inspect.rst:865 msgid "" "The name of the parameter as a string. The name must be a valid Python " "identifier." msgstr "" -#: ../../library/inspect.rst:841 +#: ../../library/inspect.rst:870 msgid "" "CPython generates implicit parameter names of the form ``.0`` on the code " "objects used to implement comprehensions and generator expressions." msgstr "" -#: ../../library/inspect.rst:845 +#: ../../library/inspect.rst:874 msgid "" "These parameter names are now exposed by this module as names like " "``implicit0``." msgstr "" -#: ../../library/inspect.rst:851 +#: ../../library/inspect.rst:880 msgid "" "The default value for the parameter. If the parameter has no default value, " "this attribute is set to :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:856 +#: ../../library/inspect.rst:885 msgid "" "The annotation for the parameter. If the parameter has no annotation, this " "attribute is set to :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:861 +#: ../../library/inspect.rst:890 msgid "" "Describes how argument values are bound to the parameter. The possible " "values are accessible via :class:`Parameter` (like ``Parameter." "KEYWORD_ONLY``), and support comparison and ordering, in the following order:" msgstr "" -#: ../../library/inspect.rst:868 +#: ../../library/inspect.rst:897 msgid "Name" msgstr "名稱" -#: ../../library/inspect.rst:868 +#: ../../library/inspect.rst:897 msgid "Meaning" msgstr "意義" -#: ../../library/inspect.rst:870 +#: ../../library/inspect.rst:899 msgid "*POSITIONAL_ONLY*" msgstr "*POSITIONAL_ONLY*" -#: ../../library/inspect.rst:870 +#: ../../library/inspect.rst:899 msgid "" "Value must be supplied as a positional argument. Positional only parameters " "are those which appear before a ``/`` entry (if present) in a Python " "function definition." msgstr "" -#: ../../library/inspect.rst:875 +#: ../../library/inspect.rst:904 msgid "*POSITIONAL_OR_KEYWORD*" msgstr "*POSITIONAL_OR_KEYWORD*" -#: ../../library/inspect.rst:875 +#: ../../library/inspect.rst:904 msgid "" "Value may be supplied as either a keyword or positional argument (this is " "the standard binding behaviour for functions implemented in Python.)" msgstr "" -#: ../../library/inspect.rst:880 +#: ../../library/inspect.rst:909 msgid "*VAR_POSITIONAL*" msgstr "*VAR_POSITIONAL*" -#: ../../library/inspect.rst:880 +#: ../../library/inspect.rst:909 msgid "" "A tuple of positional arguments that aren't bound to any other parameter. " "This corresponds to a ``*args`` parameter in a Python function definition." msgstr "" -#: ../../library/inspect.rst:885 +#: ../../library/inspect.rst:914 msgid "*KEYWORD_ONLY*" msgstr "*KEYWORD_ONLY*" -#: ../../library/inspect.rst:885 +#: ../../library/inspect.rst:914 msgid "" "Value must be supplied as a keyword argument. Keyword only parameters are " "those which appear after a ``*`` or ``*args`` entry in a Python function " "definition." msgstr "" -#: ../../library/inspect.rst:890 +#: ../../library/inspect.rst:919 msgid "*VAR_KEYWORD*" msgstr "*VAR_KEYWORD*" -#: ../../library/inspect.rst:890 +#: ../../library/inspect.rst:919 msgid "" "A dict of keyword arguments that aren't bound to any other parameter. This " "corresponds to a ``**kwargs`` parameter in a Python function definition." msgstr "" -#: ../../library/inspect.rst:896 +#: ../../library/inspect.rst:925 msgid "Example: print all keyword-only arguments without default values:" msgstr "" -#: ../../library/inspect.rst:898 +#: ../../library/inspect.rst:927 msgid "" ">>> def foo(a, b, *, c, d=10):\n" "... pass\n" @@ -1330,15 +1369,15 @@ msgstr "" "... print('Parameter:', param)\n" "Parameter: c" -#: ../../library/inspect.rst:912 +#: ../../library/inspect.rst:941 msgid "Describes an enum value of :attr:`Parameter.kind`." msgstr "" -#: ../../library/inspect.rst:916 +#: ../../library/inspect.rst:945 msgid "Example: print all descriptions of arguments:" msgstr "範例:列印所有引數的描述:" -#: ../../library/inspect.rst:918 +#: ../../library/inspect.rst:947 msgid "" ">>> def foo(a, b, *, c, d=10):\n" "... pass\n" @@ -1362,7 +1401,7 @@ msgstr "" "keyword-only\n" "keyword-only" -#: ../../library/inspect.rst:933 +#: ../../library/inspect.rst:962 msgid "" "Create a new :class:`Parameter` instance based on the instance replaced was " "invoked on. To override a :class:`!Parameter` attribute, pass the " @@ -1370,7 +1409,7 @@ msgid "" "a :class:`!Parameter`, pass :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:938 +#: ../../library/inspect.rst:967 msgid "" ">>> from inspect import Parameter\n" ">>> param = Parameter('foo', Parameter.KEYWORD_ONLY, default=42)\n" @@ -1394,77 +1433,82 @@ msgstr "" ">>> str(param.replace(default=Parameter.empty, annotation='spam'))\n" "\"foo: 'spam'\"" -#: ../../library/inspect.rst:951 +#: ../../library/inspect.rst:980 +msgid "" +":class:`Parameter` objects are also supported by the generic function :func:" +"`copy.replace`." +msgstr "" + +#: ../../library/inspect.rst:983 msgid "" "In Python 3.3 :class:`Parameter` objects were allowed to have ``name`` set " "to ``None`` if their ``kind`` was set to ``POSITIONAL_ONLY``. This is no " "longer permitted." msgstr "" -#: ../../library/inspect.rst:958 +#: ../../library/inspect.rst:990 msgid "" "Result of a :meth:`Signature.bind` or :meth:`Signature.bind_partial` call. " "Holds the mapping of arguments to the function's parameters." msgstr "" -#: ../../library/inspect.rst:963 +#: ../../library/inspect.rst:995 msgid "" "A mutable mapping of parameters' names to arguments' values. Contains only " "explicitly bound arguments. Changes in :attr:`arguments` will reflect in :" "attr:`args` and :attr:`kwargs`." msgstr "" -#: ../../library/inspect.rst:967 +#: ../../library/inspect.rst:999 msgid "" "Should be used in conjunction with :attr:`Signature.parameters` for any " "argument processing purposes." msgstr "" -#: ../../library/inspect.rst:972 +#: ../../library/inspect.rst:1004 msgid "" "Arguments for which :meth:`Signature.bind` or :meth:`Signature.bind_partial` " "relied on a default value are skipped. However, if needed, use :meth:" "`BoundArguments.apply_defaults` to add them." msgstr "" -#: ../../library/inspect.rst:977 +#: ../../library/inspect.rst:1009 msgid "" ":attr:`arguments` is now of type :class:`dict`. Formerly, it was of type :" "class:`collections.OrderedDict`." msgstr "" -#: ../../library/inspect.rst:983 +#: ../../library/inspect.rst:1015 msgid "" "A tuple of positional arguments values. Dynamically computed from the :attr:" "`arguments` attribute." msgstr "" -#: ../../library/inspect.rst:988 +#: ../../library/inspect.rst:1020 msgid "" "A dict of keyword arguments values. Dynamically computed from the :attr:" -"`arguments` attribute. Arguments that can be passed positionally are " -"included in :attr:`args` instead." +"`arguments` attribute." msgstr "" -#: ../../library/inspect.rst:994 +#: ../../library/inspect.rst:1025 msgid "A reference to the parent :class:`Signature` object." msgstr "" -#: ../../library/inspect.rst:998 +#: ../../library/inspect.rst:1029 msgid "Set default values for missing arguments." msgstr "為遺漏的引數設定預設值。" -#: ../../library/inspect.rst:1000 +#: ../../library/inspect.rst:1031 msgid "" "For variable-positional arguments (``*args``) the default is an empty tuple." msgstr "" -#: ../../library/inspect.rst:1003 +#: ../../library/inspect.rst:1034 msgid "" "For variable-keyword arguments (``**kwargs``) the default is an empty dict." msgstr "" -#: ../../library/inspect.rst:1006 +#: ../../library/inspect.rst:1037 msgid "" ">>> def foo(a, b='ham', *args): pass\n" ">>> ba = inspect.signature(foo).bind('spam')\n" @@ -1478,13 +1522,13 @@ msgstr "" ">>> ba.arguments\n" "{'a': 'spam', 'b': 'ham', 'args': ()}" -#: ../../library/inspect.rst:1016 +#: ../../library/inspect.rst:1047 msgid "" "The :attr:`args` and :attr:`kwargs` properties can be used to invoke " "functions:" msgstr "" -#: ../../library/inspect.rst:1019 +#: ../../library/inspect.rst:1050 msgid "" "def test(a, *, b):\n" " ...\n" @@ -1500,19 +1544,19 @@ msgstr "" "ba = sig.bind(10, b=20)\n" "test(*ba.args, **ba.kwargs)" -#: ../../library/inspect.rst:1031 +#: ../../library/inspect.rst:1062 msgid ":pep:`362` - Function Signature Object." msgstr "" -#: ../../library/inspect.rst:1032 +#: ../../library/inspect.rst:1063 msgid "The detailed specification, implementation details and examples." msgstr "" -#: ../../library/inspect.rst:1038 +#: ../../library/inspect.rst:1069 msgid "Classes and functions" msgstr "類別與函式" -#: ../../library/inspect.rst:1042 +#: ../../library/inspect.rst:1073 msgid "" "Arrange the given list of classes into a hierarchy of nested lists. Where a " "nested list appears, it contains classes derived from the class whose entry " @@ -1523,19 +1567,19 @@ msgid "" "will appear multiple times." msgstr "" -#: ../../library/inspect.rst:1053 +#: ../../library/inspect.rst:1084 msgid "" "Get the names and default values of a Python function's parameters. A :term:" "`named tuple` is returned:" msgstr "" -#: ../../library/inspect.rst:1056 +#: ../../library/inspect.rst:1087 msgid "" "``FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, " "annotations)``" msgstr "" -#: ../../library/inspect.rst:1059 +#: ../../library/inspect.rst:1090 msgid "" "*args* is a list of the positional parameter names. *varargs* is the name of " "the ``*`` parameter or ``None`` if arbitrary positional arguments are not " @@ -1550,7 +1594,7 @@ msgid "" "report the function return value annotation (if any)." msgstr "" -#: ../../library/inspect.rst:1074 +#: ../../library/inspect.rst:1105 msgid "" "Note that :func:`signature` and :ref:`Signature Object ` provide the recommended API for callable introspection, and support " @@ -1560,14 +1604,14 @@ msgid "" "``inspect`` module API." msgstr "" -#: ../../library/inspect.rst:1081 +#: ../../library/inspect.rst:1112 msgid "" "This function is now based on :func:`signature`, but still ignores " "``__wrapped__`` attributes and includes the already bound first parameter in " "the signature output for bound methods." msgstr "" -#: ../../library/inspect.rst:1086 +#: ../../library/inspect.rst:1117 msgid "" "This method was previously documented as deprecated in favour of :func:" "`signature` in Python 3.5, but that decision has been reversed in order to " @@ -1575,7 +1619,7 @@ msgid "" "code migrating away from the legacy :func:`getargspec` API." msgstr "" -#: ../../library/inspect.rst:1101 +#: ../../library/inspect.rst:1132 msgid "" "Get information about arguments passed into a particular frame. A :term:" "`named tuple` ``ArgInfo(args, varargs, keywords, locals)`` is returned. " @@ -1584,18 +1628,18 @@ msgid "" "dictionary of the given frame." msgstr "" -#: ../../library/inspect.rst:1108 ../../library/inspect.rst:1118 +#: ../../library/inspect.rst:1139 ../../library/inspect.rst:1149 msgid "This function was inadvertently marked as deprecated in Python 3.5." msgstr "" -#: ../../library/inspect.rst:1113 +#: ../../library/inspect.rst:1144 msgid "" "Format a pretty argument spec from the four values returned by :func:" "`getargvalues`. The format\\* arguments are the corresponding optional " "formatting functions that are called to turn names and values into strings." msgstr "" -#: ../../library/inspect.rst:1123 +#: ../../library/inspect.rst:1154 msgid "" "Return a tuple of class cls's base classes, including cls, in method " "resolution order. No class appears more than once in this tuple. Note that " @@ -1603,7 +1647,7 @@ msgid "" "user-defined metatype is in use, cls will be the first element of the tuple." msgstr "" -#: ../../library/inspect.rst:1131 +#: ../../library/inspect.rst:1162 msgid "" "Bind the *args* and *kwds* to the argument names of the Python function or " "method *func*, as if it was called with them. For bound methods, bind also " @@ -1616,7 +1660,7 @@ msgid "" "example:" msgstr "" -#: ../../library/inspect.rst:1140 +#: ../../library/inspect.rst:1171 msgid "" ">>> from inspect import getcallargs\n" ">>> def f(a, b=1, *pos, **named):\n" @@ -1646,11 +1690,11 @@ msgstr "" "...\n" "TypeError: f() missing 1 required positional argument: 'a'" -#: ../../library/inspect.rst:1157 +#: ../../library/inspect.rst:1188 msgid "Use :meth:`Signature.bind` and :meth:`Signature.bind_partial` instead." msgstr "請改用 :meth:`Signature.bind` 與 :meth:`Signature.bind_partial`。" -#: ../../library/inspect.rst:1163 +#: ../../library/inspect.rst:1194 msgid "" "Get the mapping of external name references in a Python function or method " "*func* to their current values. A :term:`named tuple` " @@ -1662,18 +1706,18 @@ msgid "" "builtins." msgstr "" -#: ../../library/inspect.rst:1172 +#: ../../library/inspect.rst:1203 msgid "" ":exc:`TypeError` is raised if *func* is not a Python function or method." msgstr "如果 *func* 不是 Python 函式或方法,則引發 :exc:`TypeError`。" -#: ../../library/inspect.rst:1179 +#: ../../library/inspect.rst:1210 msgid "" "Get the object wrapped by *func*. It follows the chain of :attr:" "`__wrapped__` attributes returning the last object in the chain." msgstr "" -#: ../../library/inspect.rst:1182 +#: ../../library/inspect.rst:1213 msgid "" "*stop* is an optional callback accepting an object in the wrapper chain as " "its sole argument that allows the unwrapping to be terminated early if the " @@ -1683,80 +1727,80 @@ msgid "" "``__signature__`` attribute defined." msgstr "" -#: ../../library/inspect.rst:1189 +#: ../../library/inspect.rst:1220 msgid ":exc:`ValueError` is raised if a cycle is encountered." msgstr "如果遇到循環,則引發 :exc:`ValueError`。" -#: ../../library/inspect.rst:1196 +#: ../../library/inspect.rst:1227 msgid "Compute the annotations dict for an object." msgstr "" -#: ../../library/inspect.rst:1198 +#: ../../library/inspect.rst:1229 msgid "" "``obj`` may be a callable, class, or module. Passing in an object of any " "other type raises :exc:`TypeError`." msgstr "" -#: ../../library/inspect.rst:1201 +#: ../../library/inspect.rst:1232 msgid "" "Returns a dict. ``get_annotations()`` returns a new dict every time it's " "called; calling it twice on the same object will return two different but " "equivalent dicts." msgstr "" -#: ../../library/inspect.rst:1205 +#: ../../library/inspect.rst:1236 msgid "This function handles several details for you:" msgstr "" -#: ../../library/inspect.rst:1207 +#: ../../library/inspect.rst:1238 msgid "" "If ``eval_str`` is true, values of type ``str`` will be un-stringized using :" "func:`eval`. This is intended for use with stringized annotations (``from " "__future__ import annotations``)." msgstr "" -#: ../../library/inspect.rst:1211 +#: ../../library/inspect.rst:1242 msgid "" "If ``obj`` doesn't have an annotations dict, returns an empty dict. " "(Functions and methods always have an annotations dict; classes, modules, " "and other types of callables may not.)" msgstr "" -#: ../../library/inspect.rst:1215 +#: ../../library/inspect.rst:1246 msgid "" "Ignores inherited annotations on classes. If a class doesn't have its own " "annotations dict, returns an empty dict." msgstr "" -#: ../../library/inspect.rst:1217 +#: ../../library/inspect.rst:1248 msgid "" "All accesses to object members and dict values are done using ``getattr()`` " "and ``dict.get()`` for safety." msgstr "" -#: ../../library/inspect.rst:1219 +#: ../../library/inspect.rst:1250 msgid "Always, always, always returns a freshly created dict." msgstr "" -#: ../../library/inspect.rst:1221 +#: ../../library/inspect.rst:1252 msgid "" "``eval_str`` controls whether or not values of type ``str`` are replaced " "with the result of calling :func:`eval` on those values:" msgstr "" -#: ../../library/inspect.rst:1224 +#: ../../library/inspect.rst:1255 msgid "" "If eval_str is true, :func:`eval` is called on values of type ``str``. (Note " "that ``get_annotations`` doesn't catch exceptions; if :func:`eval` raises an " "exception, it will unwind the stack past the ``get_annotations`` call.)" msgstr "" -#: ../../library/inspect.rst:1228 +#: ../../library/inspect.rst:1259 msgid "" "If eval_str is false (the default), values of type ``str`` are unchanged." msgstr "" -#: ../../library/inspect.rst:1230 +#: ../../library/inspect.rst:1261 msgid "" "``globals`` and ``locals`` are passed in to :func:`eval`; see the " "documentation for :func:`eval` for more information. If ``globals`` or " @@ -1764,35 +1808,35 @@ msgid "" "specific default, contingent on ``type(obj)``:" msgstr "" -#: ../../library/inspect.rst:1235 +#: ../../library/inspect.rst:1266 msgid "If ``obj`` is a module, ``globals`` defaults to ``obj.__dict__``." msgstr "" -#: ../../library/inspect.rst:1236 +#: ../../library/inspect.rst:1267 msgid "" "If ``obj`` is a class, ``globals`` defaults to ``sys.modules[obj.__module__]." "__dict__`` and ``locals`` defaults to the ``obj`` class namespace." msgstr "" -#: ../../library/inspect.rst:1239 +#: ../../library/inspect.rst:1270 msgid "" "If ``obj`` is a callable, ``globals`` defaults to :attr:`obj.__globals__ " "`, although if ``obj`` is a wrapped function (using :" "func:`functools.update_wrapper`) it is first unwrapped." msgstr "" -#: ../../library/inspect.rst:1244 +#: ../../library/inspect.rst:1275 msgid "" "Calling ``get_annotations`` is best practice for accessing the annotations " "dict of any object. See :ref:`annotations-howto` for more information on " "annotations best practices." msgstr "" -#: ../../library/inspect.rst:1254 +#: ../../library/inspect.rst:1285 msgid "The interpreter stack" msgstr "直譯器堆疊" -#: ../../library/inspect.rst:1256 +#: ../../library/inspect.rst:1287 msgid "" "Some of the following functions return :class:`FrameInfo` objects. For " "backwards compatibility these objects allow tuple-like operations on all " @@ -1800,95 +1844,95 @@ msgid "" "may be removed in the future." msgstr "" -#: ../../library/inspect.rst:1265 +#: ../../library/inspect.rst:1296 msgid "The :ref:`frame object ` that the record corresponds to." msgstr "" -#: ../../library/inspect.rst:1269 +#: ../../library/inspect.rst:1300 msgid "" "The file name associated with the code being executed by the frame this " "record corresponds to." msgstr "" -#: ../../library/inspect.rst:1274 +#: ../../library/inspect.rst:1305 msgid "" "The line number of the current line associated with the code being executed " "by the frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1279 +#: ../../library/inspect.rst:1310 msgid "" "The function name that is being executed by the frame this record " "corresponds to." msgstr "" -#: ../../library/inspect.rst:1283 +#: ../../library/inspect.rst:1314 msgid "" "A list of lines of context from the source code that's being executed by the " "frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1288 ../../library/inspect.rst:1327 +#: ../../library/inspect.rst:1319 ../../library/inspect.rst:1358 msgid "" "The index of the current line being executed in the :attr:`code_context` " "list." msgstr "" -#: ../../library/inspect.rst:1292 +#: ../../library/inspect.rst:1323 msgid "" "A :class:`dis.Positions` object containing the start line number, end line " "number, start column offset, and end column offset associated with the " "instruction being executed by the frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1296 +#: ../../library/inspect.rst:1327 msgid "Return a :term:`named tuple` instead of a :class:`tuple`." msgstr "" -#: ../../library/inspect.rst:1299 +#: ../../library/inspect.rst:1330 msgid "" ":class:`!FrameInfo` is now a class instance (that is backwards compatible " "with the previous :term:`named tuple`)." msgstr "" -#: ../../library/inspect.rst:1308 +#: ../../library/inspect.rst:1339 msgid "" "The file name associated with the code being executed by the frame this " "traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1313 +#: ../../library/inspect.rst:1344 msgid "" "The line number of the current line associated with the code being executed " "by the frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1318 +#: ../../library/inspect.rst:1349 msgid "" "The function name that is being executed by the frame this traceback " "corresponds to." msgstr "" -#: ../../library/inspect.rst:1322 +#: ../../library/inspect.rst:1353 msgid "" "A list of lines of context from the source code that's being executed by the " "frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1331 +#: ../../library/inspect.rst:1362 msgid "" "A :class:`dis.Positions` object containing the start line number, end line " "number, start column offset, and end column offset associated with the " "instruction being executed by the frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1336 +#: ../../library/inspect.rst:1367 msgid "" ":class:`!Traceback` is now a class instance (that is backwards compatible " "with the previous :term:`named tuple`)." msgstr "" -#: ../../library/inspect.rst:1343 +#: ../../library/inspect.rst:1374 msgid "" "Keeping references to frame objects, as found in the first element of the " "frame records these functions return, can cause your program to create " @@ -1900,7 +1944,7 @@ msgid "" "consumption which occurs." msgstr "" -#: ../../library/inspect.rst:1351 +#: ../../library/inspect.rst:1382 msgid "" "Though the cycle detector will catch these, destruction of the frames (and " "local variables) can be made deterministic by removing the cycle in a :" @@ -1908,7 +1952,7 @@ msgid "" "disabled when Python was compiled or using :func:`gc.disable`. For example::" msgstr "" -#: ../../library/inspect.rst:1356 +#: ../../library/inspect.rst:1387 msgid "" "def handle_stackframe_without_leak():\n" " frame = inspect.currentframe()\n" @@ -1918,31 +1962,31 @@ msgid "" " del frame" msgstr "" -#: ../../library/inspect.rst:1363 +#: ../../library/inspect.rst:1394 msgid "" "If you want to keep the frame around (for example to print a traceback " "later), you can also break reference cycles by using the :meth:`frame.clear` " "method." msgstr "" -#: ../../library/inspect.rst:1367 +#: ../../library/inspect.rst:1398 msgid "" "The optional *context* argument supported by most of these functions " "specifies the number of lines of context to return, which are centered " "around the current line." msgstr "" -#: ../../library/inspect.rst:1374 +#: ../../library/inspect.rst:1405 msgid "" "Get information about a frame or traceback object. A :class:`Traceback` " "object is returned." msgstr "" -#: ../../library/inspect.rst:1377 +#: ../../library/inspect.rst:1408 msgid "A :class:`Traceback` object is returned instead of a named tuple." msgstr "" -#: ../../library/inspect.rst:1382 +#: ../../library/inspect.rst:1413 msgid "" "Get a list of :class:`FrameInfo` objects for a frame and all outer frames. " "These frames represent the calls that lead to the creation of *frame*. The " @@ -1950,19 +1994,19 @@ msgid "" "represents the outermost call on *frame*'s stack." msgstr "" -#: ../../library/inspect.rst:1387 ../../library/inspect.rst:1402 -#: ../../library/inspect.rst:1428 ../../library/inspect.rst:1443 +#: ../../library/inspect.rst:1418 ../../library/inspect.rst:1433 +#: ../../library/inspect.rst:1459 ../../library/inspect.rst:1474 msgid "" "A list of :term:`named tuples ` ``FrameInfo(frame, filename, " "lineno, function, code_context, index)`` is returned." msgstr "" -#: ../../library/inspect.rst:1392 ../../library/inspect.rst:1407 -#: ../../library/inspect.rst:1433 ../../library/inspect.rst:1448 +#: ../../library/inspect.rst:1423 ../../library/inspect.rst:1438 +#: ../../library/inspect.rst:1464 ../../library/inspect.rst:1479 msgid "A list of :class:`FrameInfo` objects is returned." msgstr "回傳一個 :class:`FrameInfo` 物件串列。" -#: ../../library/inspect.rst:1397 +#: ../../library/inspect.rst:1428 msgid "" "Get a list of :class:`FrameInfo` objects for a traceback's frame and all " "inner frames. These frames represent calls made as a consequence of " @@ -1970,11 +2014,11 @@ msgid "" "represents where the exception was raised." msgstr "" -#: ../../library/inspect.rst:1412 +#: ../../library/inspect.rst:1443 msgid "Return the frame object for the caller's stack frame." msgstr "" -#: ../../library/inspect.rst:1416 +#: ../../library/inspect.rst:1447 msgid "" "This function relies on Python stack frame support in the interpreter, which " "isn't guaranteed to exist in all implementations of Python. If running in " @@ -1982,14 +2026,14 @@ msgid "" "``None``." msgstr "" -#: ../../library/inspect.rst:1424 +#: ../../library/inspect.rst:1455 msgid "" "Return a list of :class:`FrameInfo` objects for the caller's stack. The " "first entry in the returned list represents the caller; the last entry " "represents the outermost call on the stack." msgstr "" -#: ../../library/inspect.rst:1438 +#: ../../library/inspect.rst:1469 msgid "" "Return a list of :class:`FrameInfo` objects for the stack between the " "current frame and the frame in which an exception currently being handled " @@ -1997,11 +2041,11 @@ msgid "" "entry represents where the exception was raised." msgstr "" -#: ../../library/inspect.rst:1452 +#: ../../library/inspect.rst:1483 msgid "Fetching attributes statically" msgstr "" -#: ../../library/inspect.rst:1454 +#: ../../library/inspect.rst:1485 msgid "" "Both :func:`getattr` and :func:`hasattr` can trigger code execution when " "fetching or checking for the existence of attributes. Descriptors, like " @@ -2009,20 +2053,20 @@ msgid "" "`~object.__getattribute__` may be called." msgstr "" -#: ../../library/inspect.rst:1460 +#: ../../library/inspect.rst:1491 msgid "" "For cases where you want passive introspection, like documentation tools, " "this can be inconvenient. :func:`getattr_static` has the same signature as :" "func:`getattr` but avoids executing code when it fetches attributes." msgstr "" -#: ../../library/inspect.rst:1466 +#: ../../library/inspect.rst:1497 msgid "" "Retrieve attributes without triggering dynamic lookup via the descriptor " "protocol, :meth:`~object.__getattr__` or :meth:`~object.__getattribute__`." msgstr "" -#: ../../library/inspect.rst:1470 +#: ../../library/inspect.rst:1501 msgid "" "Note: this function may not be able to retrieve all attributes that getattr " "can fetch (like dynamically created attributes) and may find attributes that " @@ -2030,27 +2074,27 @@ msgid "" "return descriptors objects instead of instance members." msgstr "" -#: ../../library/inspect.rst:1476 +#: ../../library/inspect.rst:1507 msgid "" "If the instance :attr:`~object.__dict__` is shadowed by another member (for " "example a property) then this function will be unable to find instance " "members." msgstr "" -#: ../../library/inspect.rst:1482 +#: ../../library/inspect.rst:1513 msgid "" ":func:`getattr_static` does not resolve descriptors, for example slot " "descriptors or getset descriptors on objects implemented in C. The " "descriptor object is returned instead of the underlying attribute." msgstr "" -#: ../../library/inspect.rst:1486 +#: ../../library/inspect.rst:1517 msgid "" "You can handle these with code like the following. Note that for arbitrary " "getset descriptors invoking these may trigger code execution::" msgstr "" -#: ../../library/inspect.rst:1490 +#: ../../library/inspect.rst:1521 msgid "" "# example code for resolving the builtin descriptor types\n" "class _foo:\n" @@ -2073,11 +2117,11 @@ msgid "" " pass" msgstr "" -#: ../../library/inspect.rst:1512 +#: ../../library/inspect.rst:1543 msgid "Current State of Generators, Coroutines, and Asynchronous Generators" msgstr "" -#: ../../library/inspect.rst:1514 +#: ../../library/inspect.rst:1545 msgid "" "When implementing coroutine schedulers and for other advanced uses of " "generators, it is useful to determine whether a generator is currently " @@ -2086,32 +2130,32 @@ msgid "" "generator to be determined easily." msgstr "" -#: ../../library/inspect.rst:1522 +#: ../../library/inspect.rst:1553 msgid "Get current state of a generator-iterator." msgstr "" -#: ../../library/inspect.rst:1524 ../../library/inspect.rst:1540 -#: ../../library/inspect.rst:1557 +#: ../../library/inspect.rst:1555 ../../library/inspect.rst:1571 +#: ../../library/inspect.rst:1588 msgid "Possible states are:" msgstr "" -#: ../../library/inspect.rst:1526 +#: ../../library/inspect.rst:1557 msgid "GEN_CREATED: Waiting to start execution." msgstr "" -#: ../../library/inspect.rst:1527 +#: ../../library/inspect.rst:1558 msgid "GEN_RUNNING: Currently being executed by the interpreter." msgstr "" -#: ../../library/inspect.rst:1528 +#: ../../library/inspect.rst:1559 msgid "GEN_SUSPENDED: Currently suspended at a yield expression." msgstr "" -#: ../../library/inspect.rst:1529 +#: ../../library/inspect.rst:1560 msgid "GEN_CLOSED: Execution has completed." msgstr "" -#: ../../library/inspect.rst:1535 +#: ../../library/inspect.rst:1566 msgid "" "Get current state of a coroutine object. The function is intended to be " "used with coroutine objects created by :keyword:`async def` functions, but " @@ -2119,23 +2163,23 @@ msgid "" "``cr_frame`` attributes." msgstr "" -#: ../../library/inspect.rst:1542 +#: ../../library/inspect.rst:1573 msgid "CORO_CREATED: Waiting to start execution." msgstr "" -#: ../../library/inspect.rst:1543 +#: ../../library/inspect.rst:1574 msgid "CORO_RUNNING: Currently being executed by the interpreter." msgstr "" -#: ../../library/inspect.rst:1544 +#: ../../library/inspect.rst:1575 msgid "CORO_SUSPENDED: Currently suspended at an await expression." msgstr "" -#: ../../library/inspect.rst:1545 +#: ../../library/inspect.rst:1576 msgid "CORO_CLOSED: Execution has completed." msgstr "" -#: ../../library/inspect.rst:1551 +#: ../../library/inspect.rst:1582 msgid "" "Get current state of an asynchronous generator object. The function is " "intended to be used with asynchronous iterator objects created by :keyword:" @@ -2144,30 +2188,30 @@ msgid "" "``ag_frame`` attributes." msgstr "" -#: ../../library/inspect.rst:1559 +#: ../../library/inspect.rst:1590 msgid "AGEN_CREATED: Waiting to start execution." msgstr "AGEN_CREATED: 等待開始執行。" -#: ../../library/inspect.rst:1560 +#: ../../library/inspect.rst:1591 msgid "AGEN_RUNNING: Currently being executed by the interpreter." msgstr "AGEN_RUNNING: 目前正在被直譯器執行。" -#: ../../library/inspect.rst:1561 +#: ../../library/inspect.rst:1592 msgid "AGEN_SUSPENDED: Currently suspended at a yield expression." msgstr "AGEN_SUSPENDED: 目前於 yield 運算式暫停。" -#: ../../library/inspect.rst:1562 +#: ../../library/inspect.rst:1593 msgid "AGEN_CLOSED: Execution has completed." msgstr "AGEN_CLOSED: 執行已完成。" -#: ../../library/inspect.rst:1566 +#: ../../library/inspect.rst:1597 msgid "" "The current internal state of the generator can also be queried. This is " "mostly useful for testing purposes, to ensure that internal state is being " "updated as expected:" msgstr "" -#: ../../library/inspect.rst:1572 +#: ../../library/inspect.rst:1603 msgid "" "Get the mapping of live local variables in *generator* to their current " "values. A dictionary is returned that maps from variable names to values. " @@ -2175,14 +2219,14 @@ msgid "" "generator, and all the same caveats apply." msgstr "" -#: ../../library/inspect.rst:1577 +#: ../../library/inspect.rst:1608 msgid "" "If *generator* is a :term:`generator` with no currently associated frame, " "then an empty dictionary is returned. :exc:`TypeError` is raised if " "*generator* is not a Python generator object." msgstr "" -#: ../../library/inspect.rst:1583 +#: ../../library/inspect.rst:1614 msgid "" "This function relies on the generator exposing a Python stack frame for " "introspection, which isn't guaranteed to be the case in all implementations " @@ -2190,79 +2234,79 @@ msgid "" "dictionary." msgstr "" -#: ../../library/inspect.rst:1592 +#: ../../library/inspect.rst:1623 msgid "" "This function is analogous to :func:`~inspect.getgeneratorlocals`, but works " "for coroutine objects created by :keyword:`async def` functions." msgstr "" -#: ../../library/inspect.rst:1599 +#: ../../library/inspect.rst:1630 msgid "" "This function is analogous to :func:`~inspect.getgeneratorlocals`, but works " "for asynchronous generator objects created by :keyword:`async def` functions " "which use the :keyword:`yield` statement." msgstr "" -#: ../../library/inspect.rst:1609 +#: ../../library/inspect.rst:1640 msgid "Code Objects Bit Flags" msgstr "" -#: ../../library/inspect.rst:1611 +#: ../../library/inspect.rst:1642 msgid "" "Python code objects have a :attr:`~codeobject.co_flags` attribute, which is " "a bitmap of the following flags:" msgstr "" -#: ../../library/inspect.rst:1616 +#: ../../library/inspect.rst:1647 msgid "The code object is optimized, using fast locals." msgstr "" -#: ../../library/inspect.rst:1620 +#: ../../library/inspect.rst:1651 msgid "" "If set, a new dict will be created for the frame's :attr:`~frame.f_locals` " "when the code object is executed." msgstr "" -#: ../../library/inspect.rst:1625 +#: ../../library/inspect.rst:1656 msgid "The code object has a variable positional parameter (``*args``-like)." msgstr "" -#: ../../library/inspect.rst:1629 +#: ../../library/inspect.rst:1660 msgid "The code object has a variable keyword parameter (``**kwargs``-like)." msgstr "" -#: ../../library/inspect.rst:1633 +#: ../../library/inspect.rst:1664 msgid "The flag is set when the code object is a nested function." msgstr "" -#: ../../library/inspect.rst:1637 +#: ../../library/inspect.rst:1668 msgid "" "The flag is set when the code object is a generator function, i.e. a " "generator object is returned when the code object is executed." msgstr "" -#: ../../library/inspect.rst:1642 +#: ../../library/inspect.rst:1673 msgid "" "The flag is set when the code object is a coroutine function. When the code " "object is executed it returns a coroutine object. See :pep:`492` for more " "details." msgstr "" -#: ../../library/inspect.rst:1650 +#: ../../library/inspect.rst:1681 msgid "" "The flag is used to transform generators into generator-based coroutines. " "Generator objects with this flag can be used in ``await`` expression, and " "can ``yield from`` coroutine objects. See :pep:`492` for more details." msgstr "" -#: ../../library/inspect.rst:1659 +#: ../../library/inspect.rst:1690 msgid "" "The flag is set when the code object is an asynchronous generator function. " "When the code object is executed it returns an asynchronous generator " "object. See :pep:`525` for more details." msgstr "" -#: ../../library/inspect.rst:1666 +#: ../../library/inspect.rst:1697 msgid "" "The flags are specific to CPython, and may not be defined in other Python " "implementations. Furthermore, the flags are an implementation detail, and " @@ -2270,39 +2314,39 @@ msgid "" "use public APIs from the :mod:`inspect` module for any introspection needs." msgstr "" -#: ../../library/inspect.rst:1674 +#: ../../library/inspect.rst:1705 msgid "Buffer flags" msgstr "" -#: ../../library/inspect.rst:1678 +#: ../../library/inspect.rst:1709 msgid "" "This is an :class:`enum.IntFlag` that represents the flags that can be " "passed to the :meth:`~object.__buffer__` method of objects implementing the :" "ref:`buffer protocol `." msgstr "" -#: ../../library/inspect.rst:1682 +#: ../../library/inspect.rst:1713 msgid "The meaning of the flags is explained at :ref:`buffer-request-types`." msgstr "" -#: ../../library/inspect.rst:1709 +#: ../../library/inspect.rst:1740 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/inspect.rst:1711 +#: ../../library/inspect.rst:1742 msgid "" "The :mod:`inspect` module also provides a basic introspection capability " "from the command line." msgstr "" -#: ../../library/inspect.rst:1716 +#: ../../library/inspect.rst:1747 msgid "" "By default, accepts the name of a module and prints the source of that " "module. A class or function within the module can be printed instead by " "appended a colon and the qualified name of the target object." msgstr "" -#: ../../library/inspect.rst:1722 +#: ../../library/inspect.rst:1753 msgid "" "Print information about the specified object rather than the source code" msgstr "" diff --git a/library/intro.po b/library/intro.po index 9488b2750e..599f406f42 100644 --- a/library/intro.po +++ b/library/intro.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-10-26 17:01+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -129,9 +129,10 @@ msgstr "" "其存在於某特定作業系統。" #: ../../library/intro.rst:60 +#, fuzzy msgid "" "If not separately noted, all functions that claim \"Availability: Unix\" are " -"supported on macOS, which builds on a Unix core." +"supported on macOS and iOS, both of which build on a Unix core." msgstr "" "如果沒有分別註釋的話,有標明「適用:Unix」註釋的所有函式也都於 macOS 上支援," "因其建於 Unix 核心之上。" @@ -211,3 +212,65 @@ msgid "" "links are limited and don't support some operations. For example, WASI does " "not permit symlinks with absolute file names." msgstr "" + +#: ../../library/intro.rst:126 +msgid "iOS" +msgstr "" + +#: ../../library/intro.rst:128 +msgid "" +"iOS is, in most respects, a POSIX operating system. File I/O, socket " +"handling, and threading all behave as they would on any POSIX operating " +"system. However, there are several major differences between iOS and other " +"POSIX systems." +msgstr "" + +#: ../../library/intro.rst:132 +msgid "" +"iOS can only use Python in \"embedded\" mode. There is no Python REPL, and " +"no ability to execute binaries that are part of the normal Python developer " +"experience, such as :program:`pip`. To add Python code to your iOS app, you " +"must use the :ref:`Python embedding API ` to add a Python " +"interpreter to an iOS app created with Xcode. See the :ref:`iOS usage guide " +"` for more details." +msgstr "" + +#: ../../library/intro.rst:139 +msgid "" +"An iOS app cannot use any form of subprocessing, background processing, or " +"inter-process communication. If an iOS app attempts to create a subprocess, " +"the process creating the subprocess will either lock up, or crash. An iOS " +"app has no visibility of other applications that are running, nor any " +"ability to communicate with other running applications, outside of the iOS-" +"specific APIs that exist for this purpose." +msgstr "" + +#: ../../library/intro.rst:146 +msgid "" +"iOS apps have limited access to modify system resources (such as the system " +"clock). These resources will often be *readable*, but attempts to modify " +"those resources will usually fail." +msgstr "" + +#: ../../library/intro.rst:150 +msgid "" +"iOS apps have a limited concept of console input and output. ``stdout`` and " +"``stderr`` *exist*, and content written to ``stdout`` and ``stderr`` will be " +"visible in logs when running in Xcode, but this content *won't* be recorded " +"in the system log. If a user who has installed your app provides their app " +"logs as a diagnostic aid, they will not include any detail written to " +"``stdout`` or ``stderr``." +msgstr "" + +#: ../../library/intro.rst:157 +msgid "" +"iOS apps have no concept of ``stdin`` at all. While iOS apps can have a " +"keyboard, this is a software feature, not something that is attached to " +"``stdin``." +msgstr "" + +#: ../../library/intro.rst:161 +msgid "" +"As a result, Python library that involve console manipulation (such as :mod:" +"`curses` and :mod:`readline`) are not available on iOS." +msgstr "" diff --git a/library/ipaddress.po b/library/ipaddress.po index 60917b30e7..a5c2cc8284 100644 --- a/library/ipaddress.po +++ b/library/ipaddress.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -318,7 +318,13 @@ msgid "" "``True`` if the address is reserved for link-local usage. See :RFC:`3927`." msgstr "" -#: ../../library/ipaddress.rst:252 +#: ../../library/ipaddress.rst:249 +msgid "" +":class:`IPv4Address` object representing the IPv4-mapped IPv6 address. See :" +"RFC:`4291`." +msgstr "" + +#: ../../library/ipaddress.rst:259 msgid "" "Returns a string representation of the IP address, controlled by an explicit " "format string. *fmt* can be one of the following: ``'s'``, the default " @@ -330,17 +336,17 @@ msgid "" "used by ``format``, ``str.format`` and f-strings." msgstr "" -#: ../../library/ipaddress.rst:279 +#: ../../library/ipaddress.rst:286 msgid "" "Construct an IPv6 address. An :exc:`AddressValueError` is raised if " "*address* is not a valid IPv6 address." msgstr "" -#: ../../library/ipaddress.rst:282 +#: ../../library/ipaddress.rst:289 msgid "The following constitutes a valid IPv6 address:" msgstr "" -#: ../../library/ipaddress.rst:284 +#: ../../library/ipaddress.rst:291 msgid "" "A string consisting of eight groups of four hexadecimal digits, each group " "representing 16 bits. The groups are separated by colons. This describes an " @@ -350,7 +356,7 @@ msgid "" "to ``\"::abc:7:def\"``." msgstr "" -#: ../../library/ipaddress.rst:292 +#: ../../library/ipaddress.rst:299 msgid "" "Optionally, the string may also have a scope zone ID, expressed with a " "suffix ``%scope_id``. If present, the scope ID must be non-empty, and may " @@ -359,39 +365,39 @@ msgid "" "the node." msgstr "" -#: ../../library/ipaddress.rst:297 +#: ../../library/ipaddress.rst:304 msgid "An integer that fits into 128 bits." msgstr "" -#: ../../library/ipaddress.rst:298 +#: ../../library/ipaddress.rst:305 msgid "" "An integer packed into a :class:`bytes` object of length 16, big-endian." msgstr "" -#: ../../library/ipaddress.rst:308 +#: ../../library/ipaddress.rst:315 msgid "" "The short form of the address representation, with leading zeroes in groups " "omitted and the longest sequence of groups consisting entirely of zeroes " "collapsed to a single empty group." msgstr "" -#: ../../library/ipaddress.rst:312 +#: ../../library/ipaddress.rst:319 msgid "This is also the value returned by ``str(addr)`` for IPv6 addresses." msgstr "" -#: ../../library/ipaddress.rst:316 +#: ../../library/ipaddress.rst:323 msgid "" "The long form of the address representation, with all leading zeroes and " "groups consisting entirely of zeroes included." msgstr "" -#: ../../library/ipaddress.rst:320 +#: ../../library/ipaddress.rst:327 msgid "" "For the following attributes and methods, see the corresponding " "documentation of the :class:`IPv4Address` class:" msgstr "" -#: ../../library/ipaddress.rst:340 +#: ../../library/ipaddress.rst:347 msgid "" "``True`` if the address is reserved for site-local usage. Note that the " "site-local address space has been deprecated by :RFC:`3879`. Use :attr:" @@ -399,21 +405,21 @@ msgid "" "local addresses as defined by :RFC:`4193`." msgstr "" -#: ../../library/ipaddress.rst:347 +#: ../../library/ipaddress.rst:354 msgid "" "For addresses that appear to be IPv4 mapped addresses (starting with ``::" "FFFF/96``), this property will report the embedded IPv4 address. For any " "other address, this property will be ``None``." msgstr "" -#: ../../library/ipaddress.rst:353 +#: ../../library/ipaddress.rst:360 msgid "" "For scoped addresses as defined by :RFC:`4007`, this property identifies the " "particular zone of the address's scope that the address belongs to, as a " "string. When no scope zone is specified, this property will be ``None``." msgstr "" -#: ../../library/ipaddress.rst:359 +#: ../../library/ipaddress.rst:366 msgid "" "For addresses that appear to be 6to4 addresses (starting with " "``2002::/16``) as defined by :RFC:`3056`, this property will report the " @@ -421,7 +427,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/ipaddress.rst:366 +#: ../../library/ipaddress.rst:373 msgid "" "For addresses that appear to be Teredo addresses (starting with " "``2001::/32``) as defined by :RFC:`4380`, this property will report the " @@ -429,23 +435,23 @@ msgid "" "property will be ``None``." msgstr "" -#: ../../library/ipaddress.rst:373 +#: ../../library/ipaddress.rst:380 msgid "" "Refer to the corresponding method documentation in :class:`IPv4Address`." msgstr "" -#: ../../library/ipaddress.rst:379 +#: ../../library/ipaddress.rst:386 msgid "Conversion to Strings and Integers" msgstr "" -#: ../../library/ipaddress.rst:381 +#: ../../library/ipaddress.rst:388 msgid "" "To interoperate with networking interfaces such as the socket module, " "addresses must be converted to strings or integers. This is handled using " "the :func:`str` and :func:`int` builtin functions::" msgstr "" -#: ../../library/ipaddress.rst:385 +#: ../../library/ipaddress.rst:392 msgid "" ">>> str(ipaddress.IPv4Address('192.168.0.1'))\n" "'192.168.0.1'\n" @@ -465,36 +471,36 @@ msgstr "" ">>> int(ipaddress.IPv6Address('::1'))\n" "1" -#: ../../library/ipaddress.rst:394 +#: ../../library/ipaddress.rst:401 msgid "" "Note that IPv6 scoped addresses are converted to integers without scope zone " "ID." msgstr "" -#: ../../library/ipaddress.rst:398 ../../library/ipaddress.rst:782 -#: ../../library/ipaddress.rst:918 +#: ../../library/ipaddress.rst:405 ../../library/ipaddress.rst:789 +#: ../../library/ipaddress.rst:925 msgid "Operators" msgstr "" -#: ../../library/ipaddress.rst:400 +#: ../../library/ipaddress.rst:407 msgid "" "Address objects support some operators. Unless stated otherwise, operators " "can only be applied between compatible objects (i.e. IPv4 with IPv4, IPv6 " "with IPv6)." msgstr "" -#: ../../library/ipaddress.rst:406 +#: ../../library/ipaddress.rst:413 msgid "Comparison operators" msgstr "" -#: ../../library/ipaddress.rst:408 +#: ../../library/ipaddress.rst:415 msgid "" "Address objects can be compared with the usual set of comparison operators. " "Same IPv6 addresses with different scope zone IDs are not equal. Some " "examples::" msgstr "" -#: ../../library/ipaddress.rst:412 +#: ../../library/ipaddress.rst:419 msgid "" ">>> IPv4Address('127.0.0.2') > IPv4Address('127.0.0.1')\n" "True\n" @@ -518,16 +524,16 @@ msgstr "" ">>> IPv6Address('fe80::1234%1') != IPv6Address('fe80::1234%2')\n" "True" -#: ../../library/ipaddress.rst:425 +#: ../../library/ipaddress.rst:432 msgid "Arithmetic operators" msgstr "" -#: ../../library/ipaddress.rst:427 +#: ../../library/ipaddress.rst:434 msgid "" "Integers can be added to or subtracted from address objects. Some examples::" msgstr "" -#: ../../library/ipaddress.rst:429 +#: ../../library/ipaddress.rst:436 msgid "" ">>> IPv4Address('127.0.0.2') + 3\n" "IPv4Address('127.0.0.5')\n" @@ -549,11 +555,11 @@ msgstr "" "ipaddress.AddressValueError: 4294967296 (>= 2**32) is not permitted as an " "IPv4 address" -#: ../../library/ipaddress.rst:440 +#: ../../library/ipaddress.rst:447 msgid "IP Network definitions" msgstr "" -#: ../../library/ipaddress.rst:442 +#: ../../library/ipaddress.rst:449 msgid "" "The :class:`IPv4Network` and :class:`IPv6Network` objects provide a " "mechanism for defining and inspecting IP network definitions. A network " @@ -564,11 +570,11 @@ msgid "" "addresses in the inclusive range ``192.168.1.0`` to ``192.168.1.255``." msgstr "" -#: ../../library/ipaddress.rst:452 +#: ../../library/ipaddress.rst:459 msgid "Prefix, net mask and host mask" msgstr "" -#: ../../library/ipaddress.rst:454 +#: ../../library/ipaddress.rst:461 msgid "" "There are several equivalent ways to specify IP network masks. A *prefix* " "``/`` is a notation that denotes how many high-order bits are set in " @@ -580,11 +586,11 @@ msgid "" "mask equivalent to ``/24`` in IPv4 is ``0.0.0.255``." msgstr "" -#: ../../library/ipaddress.rst:465 +#: ../../library/ipaddress.rst:472 msgid "Network objects" msgstr "" -#: ../../library/ipaddress.rst:467 +#: ../../library/ipaddress.rst:474 msgid "" "All attributes implemented by address objects are implemented by network " "objects as well. In addition, network objects implement additional " @@ -594,12 +600,12 @@ msgid "" "keys in dictionaries." msgstr "" -#: ../../library/ipaddress.rst:476 +#: ../../library/ipaddress.rst:483 msgid "" "Construct an IPv4 network definition. *address* can be one of the following:" msgstr "" -#: ../../library/ipaddress.rst:478 +#: ../../library/ipaddress.rst:485 msgid "" "A string consisting of an IP address and an optional mask, separated by a " "slash (``/``). The IP address is the network address, and the mask can be " @@ -611,26 +617,26 @@ msgid "" "it's considered to be ``/32``." msgstr "" -#: ../../library/ipaddress.rst:487 +#: ../../library/ipaddress.rst:494 msgid "" "For example, the following *address* specifications are equivalent: " "``192.168.1.0/24``, ``192.168.1.0/255.255.255.0`` and " "``192.168.1.0/0.0.0.255``." msgstr "" -#: ../../library/ipaddress.rst:491 +#: ../../library/ipaddress.rst:498 msgid "" "An integer that fits into 32 bits. This is equivalent to a single-address " "network, with the network address being *address* and the mask being ``/32``." msgstr "" -#: ../../library/ipaddress.rst:495 +#: ../../library/ipaddress.rst:502 msgid "" "An integer packed into a :class:`bytes` object of length 4, big-endian. The " "interpretation is similar to an integer *address*." msgstr "" -#: ../../library/ipaddress.rst:498 +#: ../../library/ipaddress.rst:505 msgid "" "A two-tuple of an address description and a netmask, where the address " "description is either a string, a 32-bits integer, a 4-bytes packed integer, " @@ -639,92 +645,92 @@ msgid "" "prefix mask (e.g. ``255.255.255.0``)." msgstr "" -#: ../../library/ipaddress.rst:504 +#: ../../library/ipaddress.rst:511 msgid "" "An :exc:`AddressValueError` is raised if *address* is not a valid IPv4 " "address. A :exc:`NetmaskValueError` is raised if the mask is not valid for " "an IPv4 address." msgstr "" -#: ../../library/ipaddress.rst:508 ../../library/ipaddress.rst:728 +#: ../../library/ipaddress.rst:515 ../../library/ipaddress.rst:735 msgid "" "If *strict* is ``True`` and host bits are set in the supplied address, then :" "exc:`ValueError` is raised. Otherwise, the host bits are masked out to " "determine the appropriate network address." msgstr "" -#: ../../library/ipaddress.rst:512 +#: ../../library/ipaddress.rst:519 msgid "" "Unless stated otherwise, all network methods accepting other network/address " "objects will raise :exc:`TypeError` if the argument's IP version is " "incompatible to ``self``." msgstr "" -#: ../../library/ipaddress.rst:518 ../../library/ipaddress.rst:734 +#: ../../library/ipaddress.rst:525 ../../library/ipaddress.rst:741 msgid "Added the two-tuple form for the *address* constructor parameter." msgstr "" -#: ../../library/ipaddress.rst:523 +#: ../../library/ipaddress.rst:530 msgid "" "Refer to the corresponding attribute documentation in :class:`IPv4Address`." msgstr "" -#: ../../library/ipaddress.rst:533 +#: ../../library/ipaddress.rst:540 msgid "" "These attributes are true for the network as a whole if they are true for " "both the network address and the broadcast address." msgstr "" -#: ../../library/ipaddress.rst:538 +#: ../../library/ipaddress.rst:545 msgid "" "The network address for the network. The network address and the prefix " "length together uniquely define a network." msgstr "" -#: ../../library/ipaddress.rst:543 +#: ../../library/ipaddress.rst:550 msgid "" "The broadcast address for the network. Packets sent to the broadcast address " "should be received by every host on the network." msgstr "" -#: ../../library/ipaddress.rst:548 +#: ../../library/ipaddress.rst:555 msgid "The host mask, as an :class:`IPv4Address` object." msgstr "" -#: ../../library/ipaddress.rst:552 +#: ../../library/ipaddress.rst:559 msgid "The net mask, as an :class:`IPv4Address` object." msgstr "" -#: ../../library/ipaddress.rst:558 +#: ../../library/ipaddress.rst:565 msgid "" "A string representation of the network, with the mask in prefix notation." msgstr "" -#: ../../library/ipaddress.rst:561 +#: ../../library/ipaddress.rst:568 msgid "" "``with_prefixlen`` and ``compressed`` are always the same as " "``str(network)``. ``exploded`` uses the exploded form the network address." msgstr "" -#: ../../library/ipaddress.rst:567 +#: ../../library/ipaddress.rst:574 msgid "" "A string representation of the network, with the mask in net mask notation." msgstr "" -#: ../../library/ipaddress.rst:572 +#: ../../library/ipaddress.rst:579 msgid "" "A string representation of the network, with the mask in host mask notation." msgstr "" -#: ../../library/ipaddress.rst:577 +#: ../../library/ipaddress.rst:584 msgid "The total number of addresses in the network." msgstr "" -#: ../../library/ipaddress.rst:581 +#: ../../library/ipaddress.rst:588 msgid "Length of the network prefix, in bits." msgstr "" -#: ../../library/ipaddress.rst:585 +#: ../../library/ipaddress.rst:592 msgid "" "Returns an iterator over the usable hosts in the network. The usable hosts " "are all the IP addresses that belong to the network, except the network " @@ -734,20 +740,20 @@ msgid "" "containing the single host address." msgstr "" -#: ../../library/ipaddress.rst:603 +#: ../../library/ipaddress.rst:610 msgid "" "``True`` if this network is partly or wholly contained in *other* or *other* " "is wholly contained in this network." msgstr "" -#: ../../library/ipaddress.rst:608 +#: ../../library/ipaddress.rst:615 msgid "" "Computes the network definitions resulting from removing the given *network* " "from this one. Returns an iterator of network objects. Raises :exc:" "`ValueError` if *network* is not completely contained in this network." msgstr "" -#: ../../library/ipaddress.rst:621 +#: ../../library/ipaddress.rst:628 msgid "" "The subnets that join to make the current network definition, depending on " "the argument values. *prefixlen_diff* is the amount our prefix length " @@ -757,7 +763,7 @@ msgid "" "network objects." msgstr "" -#: ../../library/ipaddress.rst:646 +#: ../../library/ipaddress.rst:653 msgid "" "The supernet containing this network definition, depending on the argument " "values. *prefixlen_diff* is the amount our prefix length should be " @@ -766,33 +772,33 @@ msgid "" "*new_prefix* must be set. Returns a single network object." msgstr "" -#: ../../library/ipaddress.rst:662 +#: ../../library/ipaddress.rst:669 msgid "Return ``True`` if this network is a subnet of *other*." msgstr "" -#: ../../library/ipaddress.rst:673 +#: ../../library/ipaddress.rst:680 msgid "Return ``True`` if this network is a supernet of *other*." msgstr "" -#: ../../library/ipaddress.rst:684 +#: ../../library/ipaddress.rst:691 msgid "" "Compare this network to *other*. In this comparison only the network " "addresses are considered; host bits aren't. Returns either ``-1``, ``0`` or " "``1``." msgstr "" -#: ../../library/ipaddress.rst:695 +#: ../../library/ipaddress.rst:702 msgid "" "It uses the same ordering and comparison algorithm as \"<\", \"==\", and " "\">\"" msgstr "" -#: ../../library/ipaddress.rst:701 +#: ../../library/ipaddress.rst:708 msgid "" "Construct an IPv6 network definition. *address* can be one of the following:" msgstr "" -#: ../../library/ipaddress.rst:703 +#: ../../library/ipaddress.rst:710 msgid "" "A string consisting of an IP address and an optional prefix length, " "separated by a slash (``/``). The IP address is the network address, and " @@ -800,26 +806,26 @@ msgid "" "length is provided, it's considered to be ``/128``." msgstr "" -#: ../../library/ipaddress.rst:708 +#: ../../library/ipaddress.rst:715 msgid "" "Note that currently expanded netmasks are not supported. That means ``2001:" "db00::0/24`` is a valid argument while ``2001:db00::0/ffff:ff00::`` is not." msgstr "" -#: ../../library/ipaddress.rst:712 +#: ../../library/ipaddress.rst:719 msgid "" "An integer that fits into 128 bits. This is equivalent to a single-address " "network, with the network address being *address* and the mask being " "``/128``." msgstr "" -#: ../../library/ipaddress.rst:716 +#: ../../library/ipaddress.rst:723 msgid "" "An integer packed into a :class:`bytes` object of length 16, big-endian. The " "interpretation is similar to an integer *address*." msgstr "" -#: ../../library/ipaddress.rst:719 +#: ../../library/ipaddress.rst:726 msgid "" "A two-tuple of an address description and a netmask, where the address " "description is either a string, a 128-bits integer, a 16-bytes packed " @@ -827,14 +833,14 @@ msgid "" "representing the prefix length." msgstr "" -#: ../../library/ipaddress.rst:724 +#: ../../library/ipaddress.rst:731 msgid "" "An :exc:`AddressValueError` is raised if *address* is not a valid IPv6 " "address. A :exc:`NetmaskValueError` is raised if the mask is not valid for " "an IPv6 address." msgstr "" -#: ../../library/ipaddress.rst:757 +#: ../../library/ipaddress.rst:764 msgid "" "Returns an iterator over the usable hosts in the network. The usable hosts " "are all the IP addresses that belong to the network, except the Subnet-" @@ -843,46 +849,46 @@ msgid "" "of 128 will return a list containing the single host address." msgstr "" -#: ../../library/ipaddress.rst:772 +#: ../../library/ipaddress.rst:779 msgid "" "Refer to the corresponding attribute documentation in :class:`IPv4Network`." msgstr "" -#: ../../library/ipaddress.rst:777 +#: ../../library/ipaddress.rst:784 msgid "" "These attribute is true for the network as a whole if it is true for both " "the network address and the broadcast address." msgstr "" -#: ../../library/ipaddress.rst:784 +#: ../../library/ipaddress.rst:791 msgid "" "Network objects support some operators. Unless stated otherwise, operators " "can only be applied between compatible objects (i.e. IPv4 with IPv4, IPv6 " "with IPv6)." msgstr "" -#: ../../library/ipaddress.rst:790 ../../library/ipaddress.rst:926 +#: ../../library/ipaddress.rst:797 ../../library/ipaddress.rst:933 msgid "Logical operators" msgstr "" -#: ../../library/ipaddress.rst:792 +#: ../../library/ipaddress.rst:799 msgid "" "Network objects can be compared with the usual set of logical operators. " "Network objects are ordered first by network address, then by net mask." msgstr "" -#: ../../library/ipaddress.rst:797 +#: ../../library/ipaddress.rst:804 msgid "Iteration" msgstr "" -#: ../../library/ipaddress.rst:799 +#: ../../library/ipaddress.rst:806 msgid "" "Network objects can be iterated to list all the addresses belonging to the " "network. For iteration, *all* hosts are returned, including unusable hosts " "(for usable hosts, use the :meth:`~IPv4Network.hosts` method). An example::" msgstr "" -#: ../../library/ipaddress.rst:804 +#: ../../library/ipaddress.rst:811 msgid "" ">>> for addr in IPv4Network('192.0.2.0/28'):\n" "... addr\n" @@ -924,15 +930,15 @@ msgstr "" "IPv4Address('192.0.2.14')\n" "IPv4Address('192.0.2.15')" -#: ../../library/ipaddress.rst:826 +#: ../../library/ipaddress.rst:833 msgid "Networks as containers of addresses" msgstr "" -#: ../../library/ipaddress.rst:828 +#: ../../library/ipaddress.rst:835 msgid "Network objects can act as containers of addresses. Some examples::" msgstr "" -#: ../../library/ipaddress.rst:830 +#: ../../library/ipaddress.rst:837 msgid "" ">>> IPv4Network('192.0.2.0/28')[0]\n" "IPv4Address('192.0.2.0')\n" @@ -952,92 +958,92 @@ msgstr "" ">>> IPv4Address('192.0.3.6') in IPv4Network('192.0.2.0/28')\n" "False" -#: ../../library/ipaddress.rst:841 +#: ../../library/ipaddress.rst:848 msgid "Interface objects" msgstr "" -#: ../../library/ipaddress.rst:843 +#: ../../library/ipaddress.rst:850 msgid "" "Interface objects are :term:`hashable`, so they can be used as keys in " "dictionaries." msgstr "" -#: ../../library/ipaddress.rst:848 +#: ../../library/ipaddress.rst:855 msgid "" "Construct an IPv4 interface. The meaning of *address* is as in the " "constructor of :class:`IPv4Network`, except that arbitrary host addresses " "are always accepted." msgstr "" -#: ../../library/ipaddress.rst:852 +#: ../../library/ipaddress.rst:859 msgid "" ":class:`IPv4Interface` is a subclass of :class:`IPv4Address`, so it inherits " "all the attributes from that class. In addition, the following attributes " "are available:" msgstr "" -#: ../../library/ipaddress.rst:858 +#: ../../library/ipaddress.rst:865 msgid "The address (:class:`IPv4Address`) without network information." msgstr "" -#: ../../library/ipaddress.rst:866 +#: ../../library/ipaddress.rst:873 msgid "The network (:class:`IPv4Network`) this interface belongs to." msgstr "" -#: ../../library/ipaddress.rst:874 +#: ../../library/ipaddress.rst:881 msgid "" "A string representation of the interface with the mask in prefix notation." msgstr "" -#: ../../library/ipaddress.rst:882 +#: ../../library/ipaddress.rst:889 msgid "" "A string representation of the interface with the network as a net mask." msgstr "" -#: ../../library/ipaddress.rst:890 +#: ../../library/ipaddress.rst:897 msgid "" "A string representation of the interface with the network as a host mask." msgstr "" -#: ../../library/ipaddress.rst:899 +#: ../../library/ipaddress.rst:906 msgid "" "Construct an IPv6 interface. The meaning of *address* is as in the " "constructor of :class:`IPv6Network`, except that arbitrary host addresses " "are always accepted." msgstr "" -#: ../../library/ipaddress.rst:903 +#: ../../library/ipaddress.rst:910 msgid "" ":class:`IPv6Interface` is a subclass of :class:`IPv6Address`, so it inherits " "all the attributes from that class. In addition, the following attributes " "are available:" msgstr "" -#: ../../library/ipaddress.rst:913 +#: ../../library/ipaddress.rst:920 msgid "" "Refer to the corresponding attribute documentation in :class:`IPv4Interface`." msgstr "" -#: ../../library/ipaddress.rst:920 +#: ../../library/ipaddress.rst:927 msgid "" "Interface objects support some operators. Unless stated otherwise, " "operators can only be applied between compatible objects (i.e. IPv4 with " "IPv4, IPv6 with IPv6)." msgstr "" -#: ../../library/ipaddress.rst:928 +#: ../../library/ipaddress.rst:935 msgid "" "Interface objects can be compared with the usual set of logical operators." msgstr "" -#: ../../library/ipaddress.rst:930 +#: ../../library/ipaddress.rst:937 msgid "" "For equality comparison (``==`` and ``!=``), both the IP address and network " "must be the same for the objects to be equal. An interface will not compare " "equal to any address or network object." msgstr "" -#: ../../library/ipaddress.rst:934 +#: ../../library/ipaddress.rst:941 msgid "" "For ordering (``<``, ``>``, etc) the rules are different. Interface and " "address objects with the same IP version can be compared, and the address " @@ -1046,15 +1052,15 @@ msgid "" "then by their IP addresses." msgstr "" -#: ../../library/ipaddress.rst:942 +#: ../../library/ipaddress.rst:949 msgid "Other Module Level Functions" msgstr "" -#: ../../library/ipaddress.rst:944 +#: ../../library/ipaddress.rst:951 msgid "The module also provides the following module level functions:" msgstr "" -#: ../../library/ipaddress.rst:948 +#: ../../library/ipaddress.rst:955 msgid "" "Represent an address as 4 packed bytes in network (big-endian) order. " "*address* is an integer representation of an IPv4 IP address. A :exc:" @@ -1062,7 +1068,7 @@ msgid "" "IP address." msgstr "" -#: ../../library/ipaddress.rst:961 +#: ../../library/ipaddress.rst:968 msgid "" "Represent an address as 16 packed bytes in network (big-endian) order. " "*address* is an integer representation of an IPv6 IP address. A :exc:" @@ -1070,7 +1076,7 @@ msgid "" "IP address." msgstr "" -#: ../../library/ipaddress.rst:969 +#: ../../library/ipaddress.rst:976 msgid "" "Return an iterator of the summarized network range given the first and last " "IP addresses. *first* is the first :class:`IPv4Address` or :class:" @@ -1081,7 +1087,7 @@ msgid "" "address version is not 4 or 6." msgstr "" -#: ../../library/ipaddress.rst:985 +#: ../../library/ipaddress.rst:992 msgid "" "Return an iterator of the collapsed :class:`IPv4Network` or :class:" "`IPv6Network` objects. *addresses* is an :term:`iterable` of :class:" @@ -1089,43 +1095,43 @@ msgid "" "if *addresses* contains mixed version objects." msgstr "" -#: ../../library/ipaddress.rst:998 +#: ../../library/ipaddress.rst:1005 msgid "" "Return a key suitable for sorting between networks and addresses. Address " "and Network objects are not sortable by default; they're fundamentally " "different, so the expression::" msgstr "" -#: ../../library/ipaddress.rst:1002 +#: ../../library/ipaddress.rst:1009 msgid "IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24')" msgstr "IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24')" -#: ../../library/ipaddress.rst:1004 +#: ../../library/ipaddress.rst:1011 msgid "" "doesn't make sense. There are some times however, where you may wish to " "have :mod:`ipaddress` sort these anyway. If you need to do this, you can " "use this function as the *key* argument to :func:`sorted`." msgstr "" -#: ../../library/ipaddress.rst:1008 +#: ../../library/ipaddress.rst:1015 msgid "*obj* is either a network or address object." msgstr "" -#: ../../library/ipaddress.rst:1012 +#: ../../library/ipaddress.rst:1019 msgid "Custom Exceptions" msgstr "" -#: ../../library/ipaddress.rst:1014 +#: ../../library/ipaddress.rst:1021 msgid "" "To support more specific error reporting from class constructors, the module " "defines the following exceptions:" msgstr "" -#: ../../library/ipaddress.rst:1019 +#: ../../library/ipaddress.rst:1026 msgid "Any value error related to the address." msgstr "" -#: ../../library/ipaddress.rst:1024 +#: ../../library/ipaddress.rst:1031 msgid "Any value error related to the net mask." msgstr "" diff --git a/library/itertools.po b/library/itertools.po index 0a2e3042f7..cd3e78c8ca 100644 --- a/library/itertools.po +++ b/library/itertools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-08-16 15:01+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -458,11 +458,11 @@ msgstr "" "如果提供了 *initial* 值,則累積將從該值開始,並且輸出的元素數將比輸入的可疊代" "物件多一個。" -#: ../../library/itertools.rst:113 ../../library/itertools.rst:182 -#: ../../library/itertools.rst:236 ../../library/itertools.rst:279 -#: ../../library/itertools.rst:476 ../../library/itertools.rst:507 -#: ../../library/itertools.rst:542 ../../library/itertools.rst:615 -#: ../../library/itertools.rst:676 ../../library/itertools.rst:718 +#: ../../library/itertools.rst:113 ../../library/itertools.rst:185 +#: ../../library/itertools.rst:244 ../../library/itertools.rst:287 +#: ../../library/itertools.rst:484 ../../library/itertools.rst:515 +#: ../../library/itertools.rst:550 ../../library/itertools.rst:623 +#: ../../library/itertools.rst:684 ../../library/itertools.rst:726 msgid "Roughly equivalent to::" msgstr "大致等價於: ::" @@ -539,6 +539,12 @@ msgstr "" #: ../../library/itertools.rst:170 msgid "" +"If *strict* is true, will raise a :exc:`ValueError` if the final batch is " +"shorter than *n*." +msgstr "" + +#: ../../library/itertools.rst:173 +msgid "" "Loops over the input iterable and accumulates data into tuples up to size " "*n*. The input is consumed lazily, just enough to fill a batch. The result " "is yielded as soon as the batch is full or when the input iterable is " @@ -548,7 +554,7 @@ msgstr "" "消耗 (consumed lazily) 的,會剛好足夠填充一批的資料。一旦批次填滿或輸入的可疊" "代物件耗盡,就會 yield 出結果:" -#: ../../library/itertools.rst:175 +#: ../../library/itertools.rst:178 msgid "" ">>> flattened_data = ['roses', 'red', 'violets', 'blue', 'sugar', 'sweet']\n" ">>> unflattened = list(batched(flattened_data, 2))\n" @@ -560,14 +566,17 @@ msgstr "" ">>> unflattened\n" "[('roses', 'red'), ('violets', 'blue'), ('sugar', 'sweet')]" -#: ../../library/itertools.rst:184 +#: ../../library/itertools.rst:187 +#, fuzzy msgid "" -"def batched(iterable, n):\n" +"def batched(iterable, n, *, strict=False):\n" " # batched('ABCDEFG', 3) → ABC DEF G\n" " if n < 1:\n" " raise ValueError('n must be at least one')\n" " iterator = iter(iterable)\n" " while batch := tuple(islice(iterator, n)):\n" +" if strict and len(batch) != n:\n" +" raise ValueError('batched(): incomplete batch')\n" " yield batch" msgstr "" "def batched(iterable, n):\n" @@ -578,7 +587,11 @@ msgstr "" " while batch := tuple(islice(iterator, n)):\n" " yield batch" -#: ../../library/itertools.rst:197 +#: ../../library/itertools.rst:199 +msgid "Added the *strict* option." +msgstr "" + +#: ../../library/itertools.rst:205 msgid "" "Make an iterator that returns elements from the first iterable until it is " "exhausted, then proceeds to the next iterable, until all of the iterables " @@ -589,7 +602,7 @@ msgstr "" "代物件,直到所有可疊代物件都耗盡。用於將連續的序列做為單一序列處理。大致等價" "於: ::" -#: ../../library/itertools.rst:202 +#: ../../library/itertools.rst:210 msgid "" "def chain(*iterables):\n" " # chain('ABC', 'DEF') → A B C D E F\n" @@ -597,7 +610,7 @@ msgid "" " yield from iterable" msgstr "" -#: ../../library/itertools.rst:210 +#: ../../library/itertools.rst:218 msgid "" "Alternate constructor for :func:`chain`. Gets chained inputs from a single " "iterable argument that is evaluated lazily. Roughly equivalent to::" @@ -605,7 +618,7 @@ msgstr "" ":func:`chain` 的另一個建構函式。從單個可疊代的引數中得到鏈接的輸入,該引數是" "惰性計算的。大致等價於:" -#: ../../library/itertools.rst:213 +#: ../../library/itertools.rst:221 msgid "" "def from_iterable(iterables):\n" " # chain.from_iterable(['ABC', 'DEF']) → A B C D E F\n" @@ -617,11 +630,11 @@ msgstr "" " for iterable in iterables:\n" " yield from iterable" -#: ../../library/itertools.rst:221 +#: ../../library/itertools.rst:229 msgid "Return *r* length subsequences of elements from the input *iterable*." msgstr "從輸入 *iterable* 中回傳長度為 *r* 的元素的子序列。" -#: ../../library/itertools.rst:223 +#: ../../library/itertools.rst:231 msgid "" "The output is a subsequence of :func:`product` keeping only entries that are " "subsequences of the *iterable*. The length of the output is given by :func:" @@ -632,7 +645,7 @@ msgstr "" "度由 :func:`math.comb` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / r! / (n - r)!" "``,當 ``r > n`` 時為零。" -#: ../../library/itertools.rst:228 +#: ../../library/itertools.rst:236 msgid "" "The combination tuples are emitted in lexicographic order according to the " "order of the input *iterable*. If the input *iterable* is sorted, the output " @@ -641,7 +654,7 @@ msgstr "" "根據輸入值 *iterable* 的順序,組合的元組會按照字典順序輸出。如果輸入的 " "*iterable* 已經排序,則輸出的元組也將按排序的順序產生。" -#: ../../library/itertools.rst:232 +#: ../../library/itertools.rst:240 msgid "" "Elements are treated as unique based on their position, not on their value. " "If the input elements are unique, there will be no repeated values within " @@ -650,7 +663,7 @@ msgstr "" "元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,則每" "個組合內將不會有重複的值。" -#: ../../library/itertools.rst:238 +#: ../../library/itertools.rst:246 msgid "" "def combinations(iterable, r):\n" " # combinations('ABCD', 2) → AB AC AD BC BD CD\n" @@ -675,14 +688,14 @@ msgid "" " yield tuple(pool[i] for i in indices)" msgstr "" -#: ../../library/itertools.rst:263 +#: ../../library/itertools.rst:271 msgid "" "Return *r* length subsequences of elements from the input *iterable* " "allowing individual elements to be repeated more than once." msgstr "" "回傳來自輸入 *iterable* 的長度為 *r* 的子序列,且允許個別元素重複多次。" -#: ../../library/itertools.rst:266 +#: ../../library/itertools.rst:274 msgid "" "The output is a subsequence of :func:`product` that keeps only entries that " "are subsequences (with possible repeated elements) of the *iterable*. The " @@ -693,7 +706,7 @@ msgstr "" "複元素)的條目。當 ``n > 0`` 時,回傳的子序列數量為 ``(n + r - 1)! / r! / (n " "- 1)!``。" -#: ../../library/itertools.rst:271 +#: ../../library/itertools.rst:279 msgid "" "The combination tuples are emitted in lexicographic order according to the " "order of the input *iterable*. if the input *iterable* is sorted, the output " @@ -702,7 +715,7 @@ msgstr "" "根據輸入值 *iterable* 的順序,組合的元組會按照字典順序輸出。如果輸入的 " "*iterable* 已經排序,則輸出的元組也將按排序的順序產生。" -#: ../../library/itertools.rst:275 +#: ../../library/itertools.rst:283 msgid "" "Elements are treated as unique based on their position, not on their value. " "If the input elements are unique, the generated combinations will also be " @@ -711,7 +724,7 @@ msgstr "" "元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,生成" "的組合也將是獨特的。" -#: ../../library/itertools.rst:281 +#: ../../library/itertools.rst:289 msgid "" "def combinations_with_replacement(iterable, r):\n" " # combinations_with_replacement('ABC', 2) → AA AB AC BB BC CC\n" @@ -733,7 +746,7 @@ msgid "" " yield tuple(pool[i] for i in indices)" msgstr "" -#: ../../library/itertools.rst:305 +#: ../../library/itertools.rst:313 msgid "" "Make an iterator that returns elements from *data* where the corresponding " "element in *selectors* is true. Stops when either the *data* or *selectors* " @@ -742,14 +755,14 @@ msgstr "" "建立一個疊代器,回傳 *data* 中對應 *selectors* 的元素為 true 的元素。當 " "*data* 或 *selectors* 可疊代物件耗盡時停止。大致等價於: ::" -#: ../../library/itertools.rst:310 +#: ../../library/itertools.rst:318 msgid "" "def compress(data, selectors):\n" " # compress('ABCDEF', [1,0,1,0,1,1]) → A C E F\n" " return (datum for datum, selector in zip(data, selectors) if selector)" msgstr "" -#: ../../library/itertools.rst:319 +#: ../../library/itertools.rst:327 msgid "" "Make an iterator that returns evenly spaced values beginning with *start*. " "Can be used with :func:`map` to generate consecutive data points or with :" @@ -758,7 +771,7 @@ msgstr "" "建立一個疊代器,回傳從 *start* 開始的等差的值。可以與 :func:`map` 一起使用來" "產生連續的資料點,或與 :func:`zip` 一起使用來增加序列號。大致等價於: ::" -#: ../../library/itertools.rst:324 +#: ../../library/itertools.rst:332 msgid "" "def count(start=0, step=1):\n" " # count(10) → 10 11 12 13 14 ...\n" @@ -776,7 +789,7 @@ msgstr "" " yield n\n" " n += step" -#: ../../library/itertools.rst:332 +#: ../../library/itertools.rst:340 msgid "" "When counting with floating-point numbers, better accuracy can sometimes be " "achieved by substituting multiplicative code such as: ``(start + step * i " @@ -785,11 +798,11 @@ msgstr "" "當用浮點數計數時,將上述程式碼替換為乘法有時可以獲得更好的精確度,例如:" "``(start + step * i for i in count())``。" -#: ../../library/itertools.rst:336 +#: ../../library/itertools.rst:344 msgid "Added *step* argument and allowed non-integer arguments." msgstr "新增 *step* 引數並允許非整數引數。" -#: ../../library/itertools.rst:342 +#: ../../library/itertools.rst:350 msgid "" "Make an iterator returning elements from the *iterable* and saving a copy of " "each. When the iterable is exhausted, return elements from the saved copy. " @@ -798,7 +811,7 @@ msgstr "" "建立一個疊代器,回傳 *iterable* 中的元素並保存每個元素的副本。當可疊代物件耗" "盡時,從保存的副本中回傳元素。會無限次的重複。大致等價於: ::" -#: ../../library/itertools.rst:346 +#: ../../library/itertools.rst:354 msgid "" "def cycle(iterable):\n" " # cycle('ABCD') → A B C D A B C D A B C D ...\n" @@ -820,13 +833,13 @@ msgstr "" " for element in saved:\n" " yield element" -#: ../../library/itertools.rst:356 +#: ../../library/itertools.rst:364 msgid "" "This itertool may require significant auxiliary storage (depending on the " "length of the iterable)." msgstr "此 itertool 可能需要大量的輔助儲存空間(取決於可疊代物件的長度)。" -#: ../../library/itertools.rst:362 +#: ../../library/itertools.rst:370 msgid "" "Make an iterator that drops elements from the *iterable* while the " "*predicate* is true and afterwards returns every element. Roughly " @@ -835,7 +848,7 @@ msgstr "" "建立一個疊代器,在 *predicate* 為 true 時丟棄 *iterable* 中的元素,之後回傳每" "個元素。大致等價於:" -#: ../../library/itertools.rst:366 +#: ../../library/itertools.rst:374 msgid "" "def dropwhile(predicate, iterable):\n" " # dropwhile(lambda x: x<5, [1,4,6,3,8]) → 6 3 8\n" @@ -861,7 +874,7 @@ msgstr "" " for x in iterator:\n" " yield x" -#: ../../library/itertools.rst:378 +#: ../../library/itertools.rst:386 msgid "" "Note this does not produce *any* output until the predicate first becomes " "false, so this itertool may have a lengthy start-up time." @@ -869,7 +882,7 @@ msgstr "" "注意,在 predicate 首次變為 False 之前,這不會產生\\ *任何*\\ 輸出,所以此 " "itertool 可能會有較長的啟動時間。" -#: ../../library/itertools.rst:384 +#: ../../library/itertools.rst:392 msgid "" "Make an iterator that filters elements from the *iterable* returning only " "those for which the *predicate* returns a false value. If *predicate* is " @@ -878,7 +891,7 @@ msgstr "" "建立一個疊代器,過濾 *iterable* 中的元素,僅回傳 *predicate* 為 False 值的元" "素。如果 *predicate* 是 ``None``,則回傳為 False 的項目。大致等價於: ::" -#: ../../library/itertools.rst:389 +#: ../../library/itertools.rst:397 msgid "" "def filterfalse(predicate, iterable):\n" " # filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8\n" @@ -896,7 +909,7 @@ msgstr "" " if not predicate(x):\n" " yield x" -#: ../../library/itertools.rst:400 +#: ../../library/itertools.rst:408 msgid "" "Make an iterator that returns consecutive keys and groups from the " "*iterable*. The *key* is a function computing a key value for each element. " @@ -909,7 +922,7 @@ msgstr "" "(identity function),並回傳未被更改的元素。一般來說,可疊代物件需要已經用相同" "的鍵函式進行排序。" -#: ../../library/itertools.rst:406 +#: ../../library/itertools.rst:414 msgid "" "The operation of :func:`groupby` is similar to the ``uniq`` filter in Unix. " "It generates a break or new group every time the value of the key function " @@ -922,7 +935,7 @@ msgstr "" "料進行排序)。這種行為不同於 SQL 的 GROUP BY,其無論輸入順序如何都會聚合相同" "的元素。" -#: ../../library/itertools.rst:412 +#: ../../library/itertools.rst:420 msgid "" "The returned group is itself an iterator that shares the underlying iterable " "with :func:`groupby`. Because the source is shared, when the :func:" @@ -933,7 +946,7 @@ msgstr "" "共享的,當 :func:`groupby` 物件前進時,前一個群組將不再可見。因此,如果之後需" "要該資料,應將其儲存為串列: ::" -#: ../../library/itertools.rst:417 +#: ../../library/itertools.rst:425 msgid "" "groups = []\n" "uniquekeys = []\n" @@ -943,11 +956,11 @@ msgid "" " uniquekeys.append(k)" msgstr "" -#: ../../library/itertools.rst:424 +#: ../../library/itertools.rst:432 msgid ":func:`groupby` is roughly equivalent to::" msgstr ":func:`groupby` 大致等價於: ::" -#: ../../library/itertools.rst:426 +#: ../../library/itertools.rst:434 msgid "" "def groupby(iterable, key=None):\n" " # [k for k, g in groupby('AAAABBBCCDAABBB')] → A B C D A B\n" @@ -1013,7 +1026,7 @@ msgstr "" " for _ in curr_group:\n" " pass" -#: ../../library/itertools.rst:462 +#: ../../library/itertools.rst:470 msgid "" "Make an iterator that returns selected elements from the iterable. Works " "like sequence slicing but does not support negative values for *start*, " @@ -1022,7 +1035,7 @@ msgstr "" "建立一個疊代器,回傳從 iterable 中選取的元素。其作用類似於序列切片 (sequence " "slicing),但不支援負數的 *start*、*stop* 或 *step* 的值。" -#: ../../library/itertools.rst:466 +#: ../../library/itertools.rst:474 msgid "" "If *start* is zero or ``None``, iteration starts at zero. Otherwise, " "elements from the iterable are skipped until *start* is reached." @@ -1030,7 +1043,7 @@ msgstr "" "如果 *start* 為零或 ``None``,則從零開始疊代。否則在達到 *start* 之前,會跳" "過 iterable 中的元素。" -#: ../../library/itertools.rst:469 +#: ../../library/itertools.rst:477 msgid "" "If *stop* is ``None``, iteration continues until the iterator is exhausted, " "if at all. Otherwise, it stops at the specified position." @@ -1038,7 +1051,7 @@ msgstr "" "如果 *stop* 為 ``None``,則疊代將繼續前進直到疊代器耗盡。如果指定了 *stop*," "則在達到指定位置時停止。" -#: ../../library/itertools.rst:472 +#: ../../library/itertools.rst:480 msgid "" "If *step* is ``None``, the step defaults to one. Elements are returned " "consecutively unless *step* is set higher than one which results in items " @@ -1047,7 +1060,7 @@ msgstr "" "如果 *step* 為 ``None``,則步長 (step) 預設為一。元素會連續回傳,除非將 " "*step* 設定為大於一,這會導致一些項目被跳過。" -#: ../../library/itertools.rst:478 +#: ../../library/itertools.rst:486 msgid "" "def islice(iterable, *args):\n" " # islice('ABCDEFG', 2) → A B\n" @@ -1089,11 +1102,11 @@ msgstr "" " yield element\n" " next_i += step" -#: ../../library/itertools.rst:501 +#: ../../library/itertools.rst:509 msgid "Return successive overlapping pairs taken from the input *iterable*." msgstr "回傳從輸入的 *iterable* 中提取的連續重疊對。" -#: ../../library/itertools.rst:503 +#: ../../library/itertools.rst:511 msgid "" "The number of 2-tuples in the output iterator will be one fewer than the " "number of inputs. It will be empty if the input iterable has fewer than two " @@ -1102,7 +1115,7 @@ msgstr "" "輸出疊代器中的 2 元組數量將比輸入少一個。如果輸入的可疊代物件中的值少於兩個," "則輸出將為空值。" -#: ../../library/itertools.rst:509 +#: ../../library/itertools.rst:517 msgid "" "def pairwise(iterable):\n" " # pairwise('ABCDEFG') → AB BC CD DE EF FG\n" @@ -1120,7 +1133,7 @@ msgstr "" " yield a, b\n" " a = b" -#: ../../library/itertools.rst:522 +#: ../../library/itertools.rst:530 msgid "" "Return successive *r* length `permutations of elements `_ from the *iterable*." @@ -1128,7 +1141,7 @@ msgstr "" "回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 `_ 。" -#: ../../library/itertools.rst:525 +#: ../../library/itertools.rst:533 msgid "" "If *r* is not specified or is ``None``, then *r* defaults to the length of " "the *iterable* and all possible full-length permutations are generated." @@ -1136,7 +1149,7 @@ msgstr "" "如果未指定 *r* 或其值為 ``None``,則 *r* 預設為 *iterable* 的長度,並產生所有" "可能的完整長度的排列。" -#: ../../library/itertools.rst:529 +#: ../../library/itertools.rst:537 msgid "" "The output is a subsequence of :func:`product` where entries with repeated " "elements have been filtered out. The length of the output is given by :func:" @@ -1147,7 +1160,7 @@ msgstr "" "func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 ``r " "> n`` 時為零。" -#: ../../library/itertools.rst:534 +#: ../../library/itertools.rst:542 msgid "" "The permutation tuples are emitted in lexicographic order according to the " "order of the input *iterable*. If the input *iterable* is sorted, the " @@ -1156,7 +1169,7 @@ msgstr "" "根據輸入值 *iterable* 的順序,排列的元組會按照字典順序輸出。如果輸入的 " "*iterable* 已排序,則輸出的元組也將按排序的順序產生。" -#: ../../library/itertools.rst:538 +#: ../../library/itertools.rst:546 msgid "" "Elements are treated as unique based on their position, not on their value. " "If the input elements are unique, there will be no repeated values within a " @@ -1165,7 +1178,7 @@ msgstr "" "元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,則排" "列中將不會有重複的值。" -#: ../../library/itertools.rst:544 +#: ../../library/itertools.rst:552 msgid "" "def permutations(iterable, r=None):\n" " # permutations('ABCD', 2) → AB AC AD BA BC BD CA CB CD DA DB DC\n" @@ -1223,11 +1236,11 @@ msgstr "" " else:\n" " return" -#: ../../library/itertools.rst:575 +#: ../../library/itertools.rst:583 msgid "Cartesian product of input iterables." msgstr "輸入的 iterables 的笛卡爾乘積。" -#: ../../library/itertools.rst:577 +#: ../../library/itertools.rst:585 msgid "" "Roughly equivalent to nested for-loops in a generator expression. For " "example, ``product(A, B)`` returns the same as ``((x,y) for x in A for y in " @@ -1236,7 +1249,7 @@ msgstr "" "大致等價於產生器運算式中的巢狀 for 迴圈。例如,``product(A, B)`` 的回傳結果" "與 ``((x,y) for x in A for y in B)`` 相同。" -#: ../../library/itertools.rst:580 +#: ../../library/itertools.rst:588 msgid "" "The nested loops cycle like an odometer with the rightmost element advancing " "on every iteration. This pattern creates a lexicographic ordering so that " @@ -1246,7 +1259,7 @@ msgstr "" "巢狀迴圈的循環類似於里程表,最右邊的元素在每次疊代時前進。這種模式會建立字典" "順序,因此如果輸入的 iterables 已排序,則輸出的乘積元組也將按排序的順序產生。" -#: ../../library/itertools.rst:585 +#: ../../library/itertools.rst:593 msgid "" "To compute the product of an iterable with itself, specify the number of " "repetitions with the optional *repeat* keyword argument. For example, " @@ -1255,7 +1268,7 @@ msgstr "" "要計算可疊代物件自身的乘積,可以使用可選的 *repeat* 關鍵字引數來指定重複次" "數。例如,``product(A, repeat=4)`` 與 ``product(A, A, A, A)`` 相同。" -#: ../../library/itertools.rst:589 +#: ../../library/itertools.rst:597 msgid "" "This function is roughly equivalent to the following code, except that the " "actual implementation does not build up intermediate results in memory::" @@ -1263,7 +1276,7 @@ msgstr "" "此函式大致等價於以下的程式碼,不同之處在於真正的實作不會在記憶體中建立中間結" "果: ::" -#: ../../library/itertools.rst:592 +#: ../../library/itertools.rst:600 msgid "" "def product(*iterables, repeat=1):\n" " # product('ABCD', 'xy') → Ax Ay Bx By Cx Cy Dx Dy\n" @@ -1291,7 +1304,7 @@ msgstr "" " for prod in result:\n" " yield tuple(prod)" -#: ../../library/itertools.rst:605 +#: ../../library/itertools.rst:613 msgid "" "Before :func:`product` runs, it completely consumes the input iterables, " "keeping pools of values in memory to generate the products. Accordingly, it " @@ -1300,7 +1313,7 @@ msgstr "" "在 :func:`product` 執行之前,它會完全消耗輸入的 iterables,並將值的池 (pools " "of values) 保存在記憶體中以產生乘積。因此,它僅對有限的輸入有用。" -#: ../../library/itertools.rst:612 +#: ../../library/itertools.rst:620 msgid "" "Make an iterator that returns *object* over and over again. Runs " "indefinitely unless the *times* argument is specified." @@ -1308,7 +1321,7 @@ msgstr "" "建立一個疊代器,反覆回傳 *object*。除非指定了 *times* 引數,否則會執行無限" "次。" -#: ../../library/itertools.rst:617 +#: ../../library/itertools.rst:625 msgid "" "def repeat(object, times=None):\n" " # repeat(10, 3) → 10 10 10\n" @@ -1328,13 +1341,13 @@ msgstr "" " for i in range(times):\n" " yield object" -#: ../../library/itertools.rst:626 +#: ../../library/itertools.rst:634 msgid "" "A common use for *repeat* is to supply a stream of constant values to *map* " "or *zip*:" msgstr "*repeat* 的常見用途是為 *map* 或 *zip* 提供定值的串流:" -#: ../../library/itertools.rst:629 +#: ../../library/itertools.rst:637 msgid "" ">>> list(map(pow, range(10), repeat(2)))\n" "[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]" @@ -1342,7 +1355,7 @@ msgstr "" ">>> list(map(pow, range(10), repeat(2)))\n" "[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]" -#: ../../library/itertools.rst:637 +#: ../../library/itertools.rst:645 msgid "" "Make an iterator that computes the *function* using arguments obtained from " "the *iterable*. Used instead of :func:`map` when argument parameters have " @@ -1351,7 +1364,7 @@ msgstr "" "建立一個疊代器,使用從 *iterable* 獲取的引數計算 *function* 。當引數參數已經" "被「預先壓縮 (pre-zipped)」成元組時,使用此方法代替 :func:`map`。" -#: ../../library/itertools.rst:641 +#: ../../library/itertools.rst:649 msgid "" "The difference between :func:`map` and :func:`starmap` parallels the " "distinction between ``function(a,b)`` and ``function(*c)``. Roughly " @@ -1360,7 +1373,7 @@ msgstr "" ":func:`map` 和 :func:`starmap` 之間的區別類似於 ``function(a,b)`` 和 " "``function(*c)`` 之間的區別。大致等價於:" -#: ../../library/itertools.rst:645 +#: ../../library/itertools.rst:653 msgid "" "def starmap(function, iterable):\n" " # starmap(pow, [(2,5), (3,2), (10,3)]) → 32 9 1000\n" @@ -1372,7 +1385,7 @@ msgstr "" " for args in iterable:\n" " yield function(*args)" -#: ../../library/itertools.rst:653 +#: ../../library/itertools.rst:661 msgid "" "Make an iterator that returns elements from the *iterable* as long as the " "*predicate* is true. Roughly equivalent to::" @@ -1380,7 +1393,7 @@ msgstr "" "建立一個疊代器,只在 *predicate* 為 true 時回傳 *iterable* 中的元素。大致等價" "於:" -#: ../../library/itertools.rst:656 +#: ../../library/itertools.rst:664 msgid "" "def takewhile(predicate, iterable):\n" " # takewhile(lambda x: x<5, [1,4,6,3,8]) → 1 4\n" @@ -1396,7 +1409,7 @@ msgstr "" " break\n" " yield x" -#: ../../library/itertools.rst:663 +#: ../../library/itertools.rst:671 msgid "" "Note, the element that first fails the predicate condition is consumed from " "the input iterator and there is no way to access it. This could be an issue " @@ -1411,11 +1424,11 @@ msgstr "" "more-itertools.readthedocs.io/en/stable/api.html#more_itertools." "before_and_after>`_ 作為替代。" -#: ../../library/itertools.rst:674 +#: ../../library/itertools.rst:682 msgid "Return *n* independent iterators from a single iterable." msgstr "從一個 iterable 中回傳 *n* 個獨立的疊代器。" -#: ../../library/itertools.rst:678 +#: ../../library/itertools.rst:686 msgid "" "def tee(iterable, n=2):\n" " iterator = iter(iterable)\n" @@ -1449,7 +1462,7 @@ msgstr "" " except StopIteration:\n" " return" -#: ../../library/itertools.rst:694 +#: ../../library/itertools.rst:702 msgid "" "Once a :func:`tee` has been created, the original *iterable* should not be " "used anywhere else; otherwise, the *iterable* could get advanced without the " @@ -1458,7 +1471,7 @@ msgstr "" "一旦建立了 :func:`tee`,原始的 *iterable* 不應在其他地方使用;否則," "*iterable* 可能會在 tee 物件未被通知的情況下前進。" -#: ../../library/itertools.rst:698 +#: ../../library/itertools.rst:706 msgid "" "``tee`` iterators are not threadsafe. A :exc:`RuntimeError` may be raised " "when simultaneously using iterators returned by the same :func:`tee` call, " @@ -1468,7 +1481,7 @@ msgstr "" "呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引發 :exc:" "`RuntimeError`。" -#: ../../library/itertools.rst:702 +#: ../../library/itertools.rst:710 msgid "" "This itertool may require significant auxiliary storage (depending on how " "much temporary data needs to be stored). In general, if one iterator uses " @@ -1479,11 +1492,11 @@ msgstr "" "果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使用 :func:" "`list` 會比 :func:`tee` 更快。" -#: ../../library/itertools.rst:710 +#: ../../library/itertools.rst:718 msgid "Make an iterator that aggregates elements from each of the *iterables*." msgstr "建立一個疊代器,聚合來自每個 *iterables* 中的元素。" -#: ../../library/itertools.rst:713 +#: ../../library/itertools.rst:721 msgid "" "If the iterables are of uneven length, missing values are filled-in with " "*fillvalue*. If not specified, *fillvalue* defaults to ``None``." @@ -1491,11 +1504,11 @@ msgstr "" "如果 iterables 的長度不一,則使用 *fillvalue* 填充缺少的值。如果未指定," "*fillvalue* 會預設為 ``None``。" -#: ../../library/itertools.rst:716 +#: ../../library/itertools.rst:724 msgid "Iteration continues until the longest iterable is exhausted." msgstr "疊代將持續直到最長的可疊代物件耗盡為止。" -#: ../../library/itertools.rst:720 +#: ../../library/itertools.rst:728 msgid "" "def zip_longest(*iterables, fillvalue=None):\n" " # zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-\n" @@ -1541,7 +1554,7 @@ msgstr "" " values.append(value)\n" " yield tuple(values)" -#: ../../library/itertools.rst:742 +#: ../../library/itertools.rst:750 msgid "" "If one of the iterables is potentially infinite, then the :func:" "`zip_longest` function should be wrapped with something that limits the " @@ -1550,18 +1563,18 @@ msgstr "" "如果其中一個 iterables 可能是無限的,那麼應該用別的可以限制呼叫次數的方法來包" "裝 :func:`zip_longest` 函式(例如 :func:`islice` 或 :func:`takewhile`)。" -#: ../../library/itertools.rst:750 +#: ../../library/itertools.rst:758 msgid "Itertools Recipes" msgstr "Itertools 應用技巧" -#: ../../library/itertools.rst:752 +#: ../../library/itertools.rst:760 msgid "" "This section shows recipes for creating an extended toolset using the " "existing itertools as building blocks." msgstr "" "此段落展示了使用現有的 itertools 作為構建塊來建立擴展工具集的應用技巧。" -#: ../../library/itertools.rst:755 +#: ../../library/itertools.rst:763 msgid "" "The primary purpose of the itertools recipes is educational. The recipes " "show various ways of thinking about individual tools — for example, that " @@ -1579,7 +1592,7 @@ msgstr "" "`collections` 模組一同使用以及與內建 itertools(如 ``map()``、``filter()``、" "``reversed()`` 和 ``enumerate()``)一同使用的模式。" -#: ../../library/itertools.rst:764 +#: ../../library/itertools.rst:772 msgid "" "A secondary purpose of the recipes is to serve as an incubator. The " "``accumulate()``, ``compress()``, and ``pairwise()`` itertools started out " @@ -1591,7 +1604,7 @@ msgstr "" "``sliding_window()``、``iter_index()`` 和 ``sieve()`` 的應用技巧正在被測試," "以確定它們是否有價值被收錄到內建的 itertools 中。" -#: ../../library/itertools.rst:769 +#: ../../library/itertools.rst:777 msgid "" "Substantially all of these recipes and many, many others can be installed " "from the :pypi:`more-itertools` project found on the Python Package Index::" @@ -1599,11 +1612,11 @@ msgstr "" "幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上的 :" "pypi:`more-itertools` 專案中安裝: ::" -#: ../../library/itertools.rst:773 +#: ../../library/itertools.rst:781 msgid "python -m pip install more-itertools" msgstr "python -m pip install more-itertools" -#: ../../library/itertools.rst:775 +#: ../../library/itertools.rst:783 msgid "" "Many of the recipes offer the same high performance as the underlying " "toolset. Superior memory performance is kept by processing elements one at a " @@ -1621,7 +1634,7 @@ msgstr "" "用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和\\ :" "term:`產生器 `,則能保持高速度。" -#: ../../library/itertools.rst:783 +#: ../../library/itertools.rst:791 msgid "" "import collections\n" "import contextlib\n" @@ -1800,11 +1813,11 @@ msgid "" " yield func()" msgstr "" -#: ../../library/itertools.rst:956 +#: ../../library/itertools.rst:964 msgid "The following recipes have a more mathematical flavor:" msgstr "以下的應用技巧具有更多的數學風格:" -#: ../../library/itertools.rst:958 +#: ../../library/itertools.rst:966 msgid "" "def powerset(iterable):\n" " \"powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)\"\n" @@ -1819,7 +1832,7 @@ msgid "" "def reshape(matrix, cols):\n" " \"Reshape a 2-D matrix to have a given number of columns.\"\n" " # reshape([(0, 1), (2, 3), (4, 5)], 3) → (0, 1, 2), (3, 4, 5)\n" -" return batched(chain.from_iterable(matrix), cols)\n" +" return batched(chain.from_iterable(matrix), cols, strict=True)\n" "\n" "def transpose(matrix):\n" " \"Swap the rows and columns of a 2-D matrix.\"\n" diff --git a/library/json.po b/library/json.po index 1a8f841146..8d22f578e3 100644 --- a/library/json.po +++ b/library/json.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-08-05 15:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,9 +29,10 @@ msgid "**Source code:** :source:`Lib/json/__init__.py`" msgstr "**原始碼:**\\ :source:`Lib/json/__init__.py`" #: ../../library/json.rst:14 +#, fuzzy msgid "" "`JSON (JavaScript Object Notation) `_, specified by :rfc:" -"`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 `_, is a " "lightweight data interchange format inspired by `JavaScript `_ object literal syntax (although it is not a " @@ -117,9 +118,10 @@ msgid "Pretty printing::" msgstr "美化輸出: ::" #: ../../library/json.rst:56 +#, fuzzy msgid "" ">>> import json\n" -">>> print(json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4))\n" +">>> print(json.dumps({'6': 7, '4': 5}, sort_keys=True, indent=4))\n" "{\n" " \"4\": 5,\n" " \"6\": 7\n" @@ -133,10 +135,28 @@ msgstr "" "}" #: ../../library/json.rst:63 +#, fuzzy +msgid "Specializing JSON object encoding::" +msgstr "自訂特殊的 JSON 解碼方式: ::" + +#: ../../library/json.rst:65 +msgid "" +">>> import json\n" +">>> def custom_json(obj):\n" +"... if isinstance(obj, complex):\n" +"... return {'__complex__': True, 'real': obj.real, 'imag': obj." +"imag}\n" +"... raise TypeError(f'Cannot serialize object of {type(obj)}')\n" +"...\n" +">>> json.dumps(1 + 2j, default=custom_json)\n" +"'{\"__complex__\": true, \"real\": 1.0, \"imag\": 2.0}'" +msgstr "" + +#: ../../library/json.rst:74 msgid "Decoding JSON::" msgstr "JSON 解碼: ::" -#: ../../library/json.rst:65 +#: ../../library/json.rst:76 msgid "" ">>> import json\n" ">>> json.loads('[\"foo\", {\"bar\":[\"baz\", null, 1.0, 2]}]')\n" @@ -158,11 +178,11 @@ msgstr "" ">>> json.load(io)\n" "['streaming API']" -#: ../../library/json.rst:75 +#: ../../library/json.rst:86 msgid "Specializing JSON object decoding::" msgstr "自訂特殊的 JSON 解碼方式: ::" -#: ../../library/json.rst:77 +#: ../../library/json.rst:88 msgid "" ">>> import json\n" ">>> def as_complex(dct):\n" @@ -190,11 +210,11 @@ msgstr "" ">>> json.loads('1.1', parse_float=decimal.Decimal)\n" "Decimal('1.1')" -#: ../../library/json.rst:90 +#: ../../library/json.rst:101 msgid "Extending :class:`JSONEncoder`::" msgstr "繼承 :class:`JSONEncoder` 類別並自行擴充額外的編碼方法: ::" -#: ../../library/json.rst:92 +#: ../../library/json.rst:103 msgid "" ">>> import json\n" ">>> class ComplexEncoder(json.JSONEncoder):\n" @@ -212,11 +232,11 @@ msgid "" "['[2.0', ', 1.0', ']']" msgstr "" -#: ../../library/json.rst:108 +#: ../../library/json.rst:119 msgid "Using :mod:`json.tool` from the shell to validate and pretty-print:" msgstr "在命令列介面裡使用 :mod:`json.tool` 來驗證 JSON 語法和美化呈現方式:" -#: ../../library/json.rst:110 +#: ../../library/json.rst:121 msgid "" "$ echo '{\"json\":\"obj\"}' | python -m json.tool\n" "{\n" @@ -232,11 +252,11 @@ msgstr "" "$ echo '{1.2:3.4}' | python -m json.tool\n" "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" -#: ../../library/json.rst:119 +#: ../../library/json.rst:130 msgid "See :ref:`json-commandline` for detailed documentation." msgstr "更詳盡的文件請見 :ref:`json-commandline`。" -#: ../../library/json.rst:123 +#: ../../library/json.rst:134 msgid "" "JSON is a subset of `YAML `_ 1.2. The JSON produced by " "this module's default settings (in particular, the default *separators* " @@ -248,7 +268,7 @@ msgstr "" "輸出也符合 YAML 1.0 和 1.1 的子集合規範。因此你也可以利用這個模組來當作 YAML " "的序列化工具(serializer)。" -#: ../../library/json.rst:130 +#: ../../library/json.rst:141 msgid "" "This module's encoders and decoders preserve input and output order by " "default. Order is only lost if the underlying containers are unordered." @@ -256,11 +276,11 @@ msgstr "" "這個模組的編、解碼器預設會保存輸入與輸出資料的順序關係,除非一開始的輸入本身" "就是無序的。" -#: ../../library/json.rst:135 +#: ../../library/json.rst:146 msgid "Basic Usage" msgstr "基本用法" -#: ../../library/json.rst:142 +#: ../../library/json.rst:153 msgid "" "Serialize *obj* as a JSON formatted stream to *fp* (a ``.write()``-" "supporting :term:`file-like object`) using this :ref:`conversion table `." msgstr "" @@ -390,7 +410,7 @@ msgstr "" # SkyLull: 我想這裡的 "framed protocol" 指的是 # https://peps.python.org/pep-3154/#framing -#: ../../library/json.rst:203 +#: ../../library/json.rst:214 msgid "" "Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol, so " "trying to serialize multiple objects with repeated calls to :func:`dump` " @@ -400,7 +420,7 @@ msgstr "" "framed)的協定,因此嘗試重複呼叫 :func:`dump` 來序列化多個物件到同一個 *fp* " "裡將導致無效的 JSON 檔案。" -#: ../../library/json.rst:212 +#: ../../library/json.rst:223 msgid "" "Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion " "table `. The arguments have the same meaning as in :func:" @@ -409,7 +429,7 @@ msgstr "" "使用此\\ :ref:`轉換表 `\\ 來將 *obj* 序列化為 JSON 格式 :" "class:`str`。這個引數的作用與 :func:`dump` 中的同名引數意義相同。" -#: ../../library/json.rst:218 +#: ../../library/json.rst:229 msgid "" "Keys in key/value pairs of JSON are always of the type :class:`str`. When a " "dictionary is converted into JSON, all the keys of the dictionary are " @@ -422,7 +442,7 @@ msgstr "" "轉換回字典,則該字典可能不等於原始字典。也就是說,如果字典 x 含有非字串鍵值," "則 ``loads(dumps(x)) != x``。" -#: ../../library/json.rst:227 +#: ../../library/json.rst:238 msgid "" "Deserialize *fp* (a ``.read()``-supporting :term:`text file` or :term:" "`binary file` containing a JSON document) to a Python object using this :ref:" @@ -432,7 +452,7 @@ msgstr "" "read()``、包含 JSON 文件的\\ :term:`文字檔案 `\\ 或\\ :term:`二進" "位檔案 `\\ )去序列化為 Python 物件。" -#: ../../library/json.rst:231 +#: ../../library/json.rst:242 msgid "" "*object_hook* is an optional function that will be called with the result of " "any object literal decoded (a :class:`dict`). The return value of " @@ -445,7 +465,7 @@ msgstr "" "先的 :class:`dict` 輸出。此功能可用於實作自訂解碼器(例如 `JSON-RPC `_ 類別提示)。" -#: ../../library/json.rst:237 +#: ../../library/json.rst:248 msgid "" "*object_pairs_hook* is an optional function that will be called with the " "result of any object literal decoded with an ordered list of pairs. The " @@ -458,11 +478,11 @@ msgstr "" "*object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功能可用於實作" "自訂解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優先。" -#: ../../library/json.rst:243 ../../library/json.rst:347 +#: ../../library/json.rst:254 ../../library/json.rst:358 msgid "Added support for *object_pairs_hook*." msgstr "新增對於 *object_pairs_hook* 的支援。" -#: ../../library/json.rst:246 ../../library/json.rst:350 +#: ../../library/json.rst:257 ../../library/json.rst:361 msgid "" "*parse_float* is an optional function that will be called with the string of " "every JSON float to be decoded. By default, this is equivalent to " @@ -473,7 +493,7 @@ msgstr "" "的函式來進行解碼。預設情況這等效於 ``float(num_str)``。這個參數可用於將 JSON " "中的浮點數解碼或剖析為另一種資料型別(例如 :class:`decimal.Decimal`\\ )。" -#: ../../library/json.rst:251 ../../library/json.rst:355 +#: ../../library/json.rst:262 ../../library/json.rst:366 msgid "" "*parse_int* is an optional function that will be called with the string of " "every JSON int to be decoded. By default, this is equivalent to " @@ -484,7 +504,7 @@ msgstr "" "``int(num_str)``。這個參數可用於將 JSON 中的整數解碼或剖析為另一種資料型別" "(例如 :class:`float`)。" -#: ../../library/json.rst:256 +#: ../../library/json.rst:267 msgid "" "The default *parse_int* of :func:`int` now limits the maximum length of the " "integer string via the interpreter's :ref:`integer string conversion length " @@ -494,7 +514,7 @@ msgstr "" "由直譯器的\\ :ref:`整數字串轉換長度限制 `\\ 機制來達成," "這能防止阻斷服務攻擊 (Denial of Service attacks)。" -#: ../../library/json.rst:262 ../../library/json.rst:360 +#: ../../library/json.rst:273 ../../library/json.rst:371 msgid "" "*parse_constant* is an optional function that will be called with one of the " "following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be " @@ -504,12 +524,12 @@ msgstr "" "``'Infinity'`` 或 ``'NaN'`` 其中之一則會改用這個參數給定的函式來進行解碼。這" "也可用於使解碼過程中遇到無效的 JSON 數字時引發一個例外。" -#: ../../library/json.rst:266 +#: ../../library/json.rst:277 msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore." msgstr "" "遭遇 'null'、'true' 或 'false' 時不再以 *parse_constant* 給定的函式來處理了。" -#: ../../library/json.rst:269 +#: ../../library/json.rst:280 msgid "" "To use a custom :class:`JSONDecoder` subclass, specify it with the ``cls`` " "kwarg; otherwise :class:`JSONDecoder` is used. Additional keyword arguments " @@ -519,8 +539,8 @@ msgstr "" "之,否則將使用預設的 :class:`JSONDecoder`。其他未使用到的關鍵字引數將繼續傳入" "給 JSONDecoder 的建構函式使用。" -#: ../../library/json.rst:273 ../../library/json.rst:291 -#: ../../library/json.rst:369 +#: ../../library/json.rst:284 ../../library/json.rst:302 +#: ../../library/json.rst:380 msgid "" "If the data being deserialized is not a valid JSON document, a :exc:" "`JSONDecodeError` will be raised." @@ -528,7 +548,7 @@ msgstr "" "如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" "`JSONDecodeError` 例外。" -#: ../../library/json.rst:279 +#: ../../library/json.rst:290 msgid "" "*fp* can now be a :term:`binary file`. The input encoding should be UTF-8, " "UTF-16 or UTF-32." @@ -536,7 +556,7 @@ msgstr "" "現在,*fp* 可以是一個\\ :term:`二進位檔案 `,前提是其編碼格式為 " "UTF-8、UTF-16 或 UTF-32。" -#: ../../library/json.rst:285 +#: ../../library/json.rst:296 msgid "" "Deserialize *s* (a :class:`str`, :class:`bytes` or :class:`bytearray` " "instance containing a JSON document) to a Python object using this :ref:" @@ -546,11 +566,11 @@ msgstr "" "class:`str`、:class:`bytes` 或 :class:`bytearray` 的實例(instance))去序列" "化(deserialize)為一個 Python 物件" -#: ../../library/json.rst:289 +#: ../../library/json.rst:300 msgid "The other arguments have the same meaning as in :func:`load`." msgstr "其餘引數的使用方式與意義和 :func:`load` 的相同。" -#: ../../library/json.rst:294 +#: ../../library/json.rst:305 msgid "" "*s* can now be of type :class:`bytes` or :class:`bytearray`. The input " "encoding should be UTF-8, UTF-16 or UTF-32." @@ -558,95 +578,95 @@ msgstr "" "現在,*s* 可以是一個二進位檔案如 :class:`bytes` 或 :class:`bytearray`,前提是" "其編碼格式為 UTF-8、UTF-16 或 UTF-32。" -#: ../../library/json.rst:298 +#: ../../library/json.rst:309 msgid "The keyword argument *encoding* has been removed." msgstr "刪除關鍵字引數 *encoding*。" -#: ../../library/json.rst:303 +#: ../../library/json.rst:314 msgid "Encoders and Decoders" msgstr "編碼器與解碼器" -#: ../../library/json.rst:307 +#: ../../library/json.rst:318 msgid "Simple JSON decoder." msgstr "簡易 JSON 解碼器" -#: ../../library/json.rst:309 +#: ../../library/json.rst:320 msgid "Performs the following translations in decoding by default:" msgstr "預設將執行下列資料型別轉換:" -#: ../../library/json.rst:314 ../../library/json.rst:402 +#: ../../library/json.rst:325 ../../library/json.rst:413 msgid "JSON" msgstr "JSON" -#: ../../library/json.rst:314 ../../library/json.rst:402 +#: ../../library/json.rst:325 ../../library/json.rst:413 msgid "Python" msgstr "Python" -#: ../../library/json.rst:316 ../../library/json.rst:404 +#: ../../library/json.rst:327 ../../library/json.rst:415 msgid "object" msgstr "object" -#: ../../library/json.rst:316 ../../library/json.rst:404 +#: ../../library/json.rst:327 ../../library/json.rst:415 msgid "dict" msgstr "dict" -#: ../../library/json.rst:318 ../../library/json.rst:406 +#: ../../library/json.rst:329 ../../library/json.rst:417 msgid "array" msgstr "array" -#: ../../library/json.rst:318 +#: ../../library/json.rst:329 msgid "list" msgstr "list" -#: ../../library/json.rst:320 ../../library/json.rst:408 +#: ../../library/json.rst:331 ../../library/json.rst:419 msgid "string" msgstr "string" -#: ../../library/json.rst:320 ../../library/json.rst:408 +#: ../../library/json.rst:331 ../../library/json.rst:419 msgid "str" msgstr "str" -#: ../../library/json.rst:322 +#: ../../library/json.rst:333 msgid "number (int)" msgstr "number (整數)" -#: ../../library/json.rst:322 +#: ../../library/json.rst:333 msgid "int" msgstr "int" -#: ../../library/json.rst:324 +#: ../../library/json.rst:335 msgid "number (real)" msgstr "number (實數)" -#: ../../library/json.rst:324 +#: ../../library/json.rst:335 msgid "float" msgstr "float" -#: ../../library/json.rst:326 ../../library/json.rst:412 +#: ../../library/json.rst:337 ../../library/json.rst:423 msgid "true" msgstr "true" -#: ../../library/json.rst:326 ../../library/json.rst:412 +#: ../../library/json.rst:337 ../../library/json.rst:423 msgid "True" msgstr "True" -#: ../../library/json.rst:328 ../../library/json.rst:414 +#: ../../library/json.rst:339 ../../library/json.rst:425 msgid "false" msgstr "false" -#: ../../library/json.rst:328 ../../library/json.rst:414 +#: ../../library/json.rst:339 ../../library/json.rst:425 msgid "False" msgstr "False" -#: ../../library/json.rst:330 ../../library/json.rst:416 +#: ../../library/json.rst:341 ../../library/json.rst:427 msgid "null" msgstr "null" -#: ../../library/json.rst:330 ../../library/json.rst:416 +#: ../../library/json.rst:341 ../../library/json.rst:427 msgid "None" msgstr "None" -#: ../../library/json.rst:333 +#: ../../library/json.rst:344 msgid "" "It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their " "corresponding ``float`` values, which is outside the JSON spec." @@ -654,7 +674,7 @@ msgstr "" "雖然 ``NaN``、``Infinity`` 和 ``-Infinity`` 並不符合 JSON 規範,但解碼器依然" "能正確地將其轉換到相應的 Python ``float`` 值。" -#: ../../library/json.rst:336 +#: ../../library/json.rst:347 msgid "" "*object_hook* is an optional function that will be called with the result of " "every JSON object decoded and its return value will be used in place of the " @@ -665,7 +685,7 @@ msgstr "" "回傳值來取代原先的 :class:`dict`。這個功能可用於提供自訂的去序列化(例如支援 " "`JSON-RPC `_ 類別提示)。" -#: ../../library/json.rst:341 +#: ../../library/json.rst:352 msgid "" "*object_pairs_hook* is an optional function that will be called with the " "result of every JSON object decoded with an ordered list of pairs. The " @@ -674,7 +694,7 @@ msgid "" "*object_hook* is also defined, the *object_pairs_hook* takes priority." msgstr "" -#: ../../library/json.rst:364 +#: ../../library/json.rst:375 msgid "" "If *strict* is false (``True`` is the default), then control characters will " "be allowed inside strings. Control characters in this context are those " @@ -685,25 +705,25 @@ msgstr "" "語境中的控制字元指的是 ASCII 字元編碼在 0~31 範圍內的字元,包括 ``'\\t'``" "(tab)、``'\\n'``、``'\\r'`` 和 ``'\\0'``。" -#: ../../library/json.rst:372 ../../library/json.rst:473 +#: ../../library/json.rst:383 ../../library/json.rst:484 msgid "All parameters are now :ref:`keyword-only `." msgstr "" "所有參數現在都是\\ :ref:`僅限關鍵字參數 `\\ 了。" -#: ../../library/json.rst:377 +#: ../../library/json.rst:388 msgid "" "Return the Python representation of *s* (a :class:`str` instance containing " "a JSON document)." msgstr "" "回傳用 Python 型式表達的 *s* (一個含有 JSON 文件的 :class:`str` 實例)。" -#: ../../library/json.rst:380 +#: ../../library/json.rst:391 msgid "" ":exc:`JSONDecodeError` will be raised if the given JSON document is not " "valid." msgstr "若給定的輸入不符合 JSON 格式會引發 :exc:`JSONDecodeError` 例外。" -#: ../../library/json.rst:385 +#: ../../library/json.rst:396 msgid "" "Decode a JSON document from *s* (a :class:`str` beginning with a JSON " "document) and return a 2-tuple of the Python representation and the index in " @@ -712,40 +732,40 @@ msgstr "" "將 *s* (一個開頭部分含有合格 JSON 文件的 :class:`str`) 解碼,並將 JSON 文件" "結束點的索引值(index)和解碼結果合併為一個二元組(2-tuple)後回傳。" -#: ../../library/json.rst:389 +#: ../../library/json.rst:400 msgid "" "This can be used to decode a JSON document from a string that may have " "extraneous data at the end." msgstr "這個方法可以用來解碼尾段可能帶有 JSON 以外資料的文字。" -#: ../../library/json.rst:395 +#: ../../library/json.rst:406 msgid "Extensible JSON encoder for Python data structures." msgstr "可擴充的 Python 資料結構 JSON 編碼器。" -#: ../../library/json.rst:397 +#: ../../library/json.rst:408 msgid "Supports the following objects and types by default:" msgstr "預設可支援下列物件及型別:" -#: ../../library/json.rst:406 +#: ../../library/json.rst:417 msgid "list, tuple" msgstr "list, tuple" -#: ../../library/json.rst:410 +#: ../../library/json.rst:421 msgid "int, float, int- & float-derived Enums" msgstr "" "int、float 或可作為整數或浮點數運算的衍生列舉(int- or float-derived Enums)" -#: ../../library/json.rst:410 +#: ../../library/json.rst:421 msgid "number" msgstr "number" -#: ../../library/json.rst:419 +#: ../../library/json.rst:430 msgid "Added support for int- and float-derived Enum classes." msgstr "" "增加對整數(int)、浮點數(float)或可作為整數或浮點數運算的衍生列舉(int- " "or float-derived Enums)類別的支援性。" -#: ../../library/json.rst:422 +#: ../../library/json.rst:433 msgid "" "To extend this to recognize other objects, subclass and implement a :meth:" "`~JSONEncoder.default` method with another method that returns a " @@ -756,7 +776,7 @@ msgstr "" "方法。此方法應回傳一個可序列化的 ``o`` 物件,否則此方法應呼叫父類別的 " "JSONEncoder.default 方法(以引發 :exc:`TypeError` 例外)。" -#: ../../library/json.rst:427 +#: ../../library/json.rst:438 msgid "" "If *skipkeys* is false (the default), a :exc:`TypeError` will be raised when " "trying to encode keys that are not :class:`str`, :class:`int`, :class:" @@ -766,7 +786,7 @@ msgstr "" "`int`、:class:`float` 或 ``None`` 的鍵值時,將引發 :exc:`TypeError`。如果 " "*skipkeys* 為 true,這些項目將直接被跳過。" -#: ../../library/json.rst:435 +#: ../../library/json.rst:446 msgid "" "If *check_circular* is true (the default), then lists, dicts, and custom " "encoded objects will be checked for circular references during encoding to " @@ -777,7 +797,7 @@ msgstr "" "(dict)和自訂編碼物件的循環參照,以防止無限遞迴(一個會導致 :exc:" "`RecursionError` 例外的問題)。否則不會進行此類檢查。" -#: ../../library/json.rst:440 +#: ../../library/json.rst:451 msgid "" "If *allow_nan* is true (the default), then ``NaN``, ``Infinity``, and ``-" "Infinity`` will be encoded as such. This behavior is not JSON specification " @@ -789,7 +809,7 @@ msgstr "" "數基於 JavaScript 的編碼器和解碼器一致。否則若設為 false,嘗試對這些浮點數進" "行編碼將引發 :exc:`ValueError` 例外。" -#: ../../library/json.rst:446 +#: ../../library/json.rst:457 msgid "" "If *sort_keys* is true (default: ``False``), then the output of dictionaries " "will be sorted by key; this is useful for regression tests to ensure that " @@ -799,7 +819,7 @@ msgstr "" "按鍵值排序。這項功能可確保 JSON 序列化的結果能被互相比較,能讓日常的回歸測試" "檢查變得方便一些。" -#: ../../library/json.rst:479 +#: ../../library/json.rst:490 msgid "" "Implement this method in a subclass such that it returns a serializable " "object for *o*, or calls the base implementation (to raise a :exc:" @@ -808,7 +828,7 @@ msgstr "" "在任意一個子類別裡實作這個方法時須讓其回傳一個可序列化的物件 *o* ,或呼叫原始" "的實作以引發 :exc:`TypeError` 例外。" -#: ../../library/json.rst:483 +#: ../../library/json.rst:494 msgid "" "For example, to support arbitrary iterators, you could implement :meth:" "`~JSONEncoder.default` like this::" @@ -816,7 +836,7 @@ msgstr "" "舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子的 :meth:" "`~JSONEncoder.default`: ::" -#: ../../library/json.rst:486 +#: ../../library/json.rst:497 msgid "" "def default(self, o):\n" " try:\n" @@ -829,13 +849,13 @@ msgid "" " return super().default(o)" msgstr "" -#: ../../library/json.rst:499 +#: ../../library/json.rst:510 msgid "" "Return a JSON string representation of a Python data structure, *o*. For " "example::" msgstr "回傳一個 Python 資料結構物件 *o* 的 JSON 的字串表示。例如: ::" -#: ../../library/json.rst:502 +#: ../../library/json.rst:513 msgid "" ">>> json.JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n" "'{\"foo\": [\"bar\", \"baz\"]}'" @@ -843,7 +863,7 @@ msgstr "" ">>> json.JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n" "'{\"foo\": [\"bar\", \"baz\"]}'" -#: ../../library/json.rst:508 +#: ../../library/json.rst:519 msgid "" "Encode the given object, *o*, and yield each string representation as " "available. For example::" @@ -851,7 +871,7 @@ msgstr "" "將物件 *o* 編碼,並將結果統整為一個能依序產生(yield)各結果字串的物件。如下" "例: ::" -#: ../../library/json.rst:511 +#: ../../library/json.rst:522 msgid "" "for chunk in json.JSONEncoder().iterencode(bigobject):\n" " mysocket.write(chunk)" @@ -859,43 +879,44 @@ msgstr "" "for chunk in json.JSONEncoder().iterencode(bigobject):\n" " mysocket.write(chunk)" -#: ../../library/json.rst:516 +#: ../../library/json.rst:527 msgid "Exceptions" msgstr "例外" -#: ../../library/json.rst:520 +#: ../../library/json.rst:531 msgid "Subclass of :exc:`ValueError` with the following additional attributes:" msgstr ":exc:`ValueError` 的子類別具有下列額外屬性:" -#: ../../library/json.rst:524 +#: ../../library/json.rst:535 msgid "The unformatted error message." msgstr "未受格式化的錯誤訊息。" -#: ../../library/json.rst:528 +#: ../../library/json.rst:539 msgid "The JSON document being parsed." msgstr "正在被剖析的 JSON 文件。" -#: ../../library/json.rst:532 +#: ../../library/json.rst:543 msgid "The start index of *doc* where parsing failed." msgstr "*doc* 剖析失敗處的起始點的索引值。" -#: ../../library/json.rst:536 +#: ../../library/json.rst:547 msgid "The line corresponding to *pos*." msgstr "*pos* 所在的列(line)數。" -#: ../../library/json.rst:540 +#: ../../library/json.rst:551 msgid "The column corresponding to *pos*." msgstr "*pos* 所在的行(column)數。" -#: ../../library/json.rst:546 +#: ../../library/json.rst:557 msgid "Standard Compliance and Interoperability" msgstr "合規性與互通性(Interoperability)" -#: ../../library/json.rst:548 +#: ../../library/json.rst:559 +#, fuzzy msgid "" -"The JSON format is specified by :rfc:`7159` and by `ECMA-404 `_. This " -"section details this module's level of compliance with the RFC. For " +"The JSON format is specified by :rfc:`7159` and by `ECMA-404 `_. " +"This section details this module's level of compliance with the RFC. For " "simplicity, :class:`JSONEncoder` and :class:`JSONDecoder` subclasses, and " "parameters other than those explicitly mentioned, are not considered." msgstr "" @@ -904,7 +925,7 @@ msgstr "" "組對 RFC 的遵循程度。簡單起見,:class:`JSONEncoder` 和 :class:`JSONDecoder` " "子類別以及未明確提及的參數將不予討論。" -#: ../../library/json.rst:554 +#: ../../library/json.rst:565 msgid "" "This module does not comply with the RFC in a strict fashion, implementing " "some extensions that are valid JavaScript but not valid JSON. In particular:" @@ -912,17 +933,17 @@ msgstr "" "這個模組的部份實作並未非常嚴格地遵循 RFC 規範。準確來說,下列實際實作符合 " "JavaScript 語法格式,但並不符合 JSON 格式:" -#: ../../library/json.rst:557 +#: ../../library/json.rst:568 msgid "Infinite and NaN number values are accepted and output;" msgstr "無限(Infinite)和非數字(NaN)值會被接受。" -#: ../../library/json.rst:558 +#: ../../library/json.rst:569 msgid "" "Repeated names within an object are accepted, and only the value of the last " "name-value pair is used." msgstr "同一個物件內可以有重複的名稱,但只有最後一個同名物件是有效的。" -#: ../../library/json.rst:561 +#: ../../library/json.rst:572 msgid "" "Since the RFC permits RFC-compliant parsers to accept input texts that are " "not RFC-compliant, this module's deserializer is technically RFC-compliant " @@ -931,11 +952,11 @@ msgstr "" "不過 RFC 准許遵循 RFC 的剖析器接受不合規的文字輸入,所以技術上來說若以預設設" "定運作,本模組的去序列化器(deserializer)是符合 RFC 規範的。" -#: ../../library/json.rst:566 +#: ../../library/json.rst:577 msgid "Character Encodings" msgstr "字元編碼格式" -#: ../../library/json.rst:568 +#: ../../library/json.rst:579 msgid "" "The RFC requires that JSON be represented using either UTF-8, UTF-16, or " "UTF-32, with UTF-8 being the recommended default for maximum " @@ -944,7 +965,7 @@ msgstr "" "RFC 要求 JSON 必須以 UTF-8、UTF-16 或 UTF-32 格式編碼。並推薦以 UTF-8 編碼以" "達成最佳的互通性。" -#: ../../library/json.rst:571 +#: ../../library/json.rst:582 msgid "" "As permitted, though not required, by the RFC, this module's serializer sets " "*ensure_ascii=True* by default, thus escaping the output so that the " @@ -953,7 +974,7 @@ msgstr "" "RFC 准許但並不強制編碼器的 *ensure_ascii=True* 行為是預設值,但本模組依然實作" "了此一選項作為預設,因此本模組預設會轉義所有非 ASCII 字元。" -#: ../../library/json.rst:575 +#: ../../library/json.rst:586 msgid "" "Other than the *ensure_ascii* parameter, this module is defined strictly in " "terms of conversion between Python objects and :class:`Unicode strings " @@ -963,7 +984,7 @@ msgstr "" "除了 *ensure_ascii* 選項參數之外,本模組嚴格遵循 Python 物件與 :class:" "`Unicode strings ` 之間的轉換規範,因此並不另外處理字元編碼的問題。" -#: ../../library/json.rst:580 +#: ../../library/json.rst:591 msgid "" "The RFC prohibits adding a byte order mark (BOM) to the start of a JSON " "text, and this module's serializer does not add a BOM to its output. The RFC " @@ -976,7 +997,7 @@ msgstr "" "(deserializer)忽略文件初始的端序記號,因此本模組的去序列化器將在遭遇位於文" "件開頭的端序記號時引發 :exc:`ValueError` 例外。" -#: ../../library/json.rst:586 +#: ../../library/json.rst:597 msgid "" "The RFC does not explicitly forbid JSON strings which contain byte sequences " "that don't correspond to valid Unicode characters (e.g. unpaired UTF-16 " @@ -989,11 +1010,11 @@ msgstr "" "預設情況下,當原始輸入的 :class:`str` 中存在此類序列時,該模組將接受並輸出這" "些序列的編碼位置(code points)。" -#: ../../library/json.rst:594 +#: ../../library/json.rst:605 msgid "Infinite and NaN Number Values" msgstr "正負無限與非數值" -#: ../../library/json.rst:596 +#: ../../library/json.rst:607 msgid "" "The RFC does not permit the representation of infinite or NaN number values. " "Despite that, by default, this module accepts and outputs ``Infinity``, ``-" @@ -1002,7 +1023,7 @@ msgstr "" "RFC 不允許表現無限大或非數值(NaN)。但預設情況下,這個模組仍接受並輸出 " "``Infinity``、``-Infinity`` 和 ``NaN``,如同它們是有效的 JSON 數值字面值: ::" -#: ../../library/json.rst:600 +#: ../../library/json.rst:611 msgid "" ">>> # Neither of these calls raises an exception, but the results are not " "valid JSON\n" @@ -1017,7 +1038,7 @@ msgid "" "nan" msgstr "" -#: ../../library/json.rst:611 +#: ../../library/json.rst:622 msgid "" "In the serializer, the *allow_nan* parameter can be used to alter this " "behavior. In the deserializer, the *parse_constant* parameter can be used " @@ -1026,11 +1047,11 @@ msgstr "" "在序列化器中,*allow_nan* 參數可以改變這個行為。在去序列化器中," "*parse_constant* 參數可以改變這個行為。" -#: ../../library/json.rst:617 +#: ../../library/json.rst:628 msgid "Repeated Names Within an Object" msgstr "物件內重複的名稱" -#: ../../library/json.rst:619 +#: ../../library/json.rst:630 msgid "" "The RFC specifies that the names within a JSON object should be unique, but " "does not mandate how repeated names in JSON objects should be handled. By " @@ -1041,22 +1062,22 @@ msgstr "" "字。預設情況下,本模組不會因此引發例外;相反的,它會忽略該名字的所有重複鍵值" "對,並只保留最後一個: ::" -#: ../../library/json.rst:624 +#: ../../library/json.rst:635 msgid "" ">>> weird_json = '{\"x\": 1, \"x\": 2, \"x\": 3}'\n" ">>> json.loads(weird_json)\n" "{'x': 3}" msgstr "" -#: ../../library/json.rst:628 +#: ../../library/json.rst:639 msgid "The *object_pairs_hook* parameter can be used to alter this behavior." msgstr "*object_parts_hook* 參數可以改變這個行為。" -#: ../../library/json.rst:632 +#: ../../library/json.rst:643 msgid "Top-level Non-Object, Non-Array Values" msgstr "位於頂層的非物件及非列表值" -#: ../../library/json.rst:634 +#: ../../library/json.rst:645 msgid "" "The old version of JSON specified by the obsolete :rfc:`4627` required that " "the top-level value of a JSON text must be either a JSON object or array " @@ -1070,37 +1091,37 @@ msgstr "" "boolean、數字或字串值。 :rfc:`7159` 移除了這個限制,而本模組的序列化器或去串" "列化器中未曾實施過該限制。" -#: ../../library/json.rst:641 +#: ../../library/json.rst:652 msgid "" "Regardless, for maximum interoperability, you may wish to voluntarily adhere " "to the restriction yourself." msgstr "如果想要最大限度地保留互通性,你可能還是會想要自行施加這個限制。" -#: ../../library/json.rst:646 +#: ../../library/json.rst:657 msgid "Implementation Limitations" msgstr "實作限制" -#: ../../library/json.rst:648 +#: ../../library/json.rst:659 msgid "Some JSON deserializer implementations may set limits on:" msgstr "某些 JSON 去序列化器的實作可能會造成下列限制:" -#: ../../library/json.rst:650 +#: ../../library/json.rst:661 msgid "the size of accepted JSON texts" msgstr "JSON 文件長度上限" -#: ../../library/json.rst:651 +#: ../../library/json.rst:662 msgid "the maximum level of nesting of JSON objects and arrays" msgstr "JSON 物件或陣列的最大巢狀層數(level of nesting)限制" -#: ../../library/json.rst:652 +#: ../../library/json.rst:663 msgid "the range and precision of JSON numbers" msgstr "數字的精準度或範圍" -#: ../../library/json.rst:653 +#: ../../library/json.rst:664 msgid "the content and maximum length of JSON strings" msgstr "JSON 字串長度上限" -#: ../../library/json.rst:655 +#: ../../library/json.rst:666 msgid "" "This module does not impose any such limits beyond those of the relevant " "Python datatypes themselves or the Python interpreter itself." @@ -1108,7 +1129,7 @@ msgstr "" "本模組除了 Python 資料型態本身或 Python 直譯器本身的限制以外,不會設定任何此" "類限制。" -#: ../../library/json.rst:658 +#: ../../library/json.rst:669 msgid "" "When serializing to JSON, beware any such limitations in applications that " "may consume your JSON. In particular, it is common for JSON numbers to be " @@ -1123,22 +1144,22 @@ msgstr "" "因而受到其表示範圍和精度限制的影響。這在序列化極大的 Python :class:`int` 數" "值、或是序列化特殊數字型別的實例時(例如 :class:`decimal.Decimal`)尤其重要。" -#: ../../library/json.rst:671 +#: ../../library/json.rst:682 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/json.rst:676 +#: ../../library/json.rst:687 msgid "**Source code:** :source:`Lib/json/tool.py`" msgstr "**原始碼:**\\ :source:`Lib/json/tool.py`" -#: ../../library/json.rst:680 +#: ../../library/json.rst:691 msgid "" "The :mod:`json.tool` module provides a simple command line interface to " "validate and pretty-print JSON objects." msgstr "" ":mod:`json.tool` 模組提供了一個簡易的命令列界面以供校驗與美化呈現 JSON 物件。" -#: ../../library/json.rst:683 +#: ../../library/json.rst:694 msgid "" "If the optional ``infile`` and ``outfile`` arguments are not specified, :" "data:`sys.stdin` and :data:`sys.stdout` will be used respectively:" @@ -1146,7 +1167,7 @@ msgstr "" "如果沒有指定可選引數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` 和 :" "data:`sys.stdout` 將各自做為輸入和輸出的預設值。" -#: ../../library/json.rst:686 +#: ../../library/json.rst:697 msgid "" "$ echo '{\"json\": \"obj\"}' | python -m json.tool\n" "{\n" @@ -1156,7 +1177,7 @@ msgid "" "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" msgstr "" -#: ../../library/json.rst:695 +#: ../../library/json.rst:706 msgid "" "The output is now in the same order as the input. Use the :option:`--sort-" "keys` option to sort the output of dictionaries alphabetically by key." @@ -1164,15 +1185,15 @@ msgstr "" "現在開始輸出和輸入的資料順序會是相同的。傳入 :option:`--sort-keys` 引數以按照" "鍵值的字母順序對輸出進行排序。" -#: ../../library/json.rst:702 +#: ../../library/json.rst:713 msgid "Command line options" msgstr "命令列選項" -#: ../../library/json.rst:706 +#: ../../library/json.rst:717 msgid "The JSON file to be validated or pretty-printed:" msgstr "將被用於校驗或美化呈現的 JSON 文件:" -#: ../../library/json.rst:708 +#: ../../library/json.rst:719 msgid "" "$ python -m json.tool mp_films.json\n" "[\n" @@ -1198,11 +1219,11 @@ msgstr "" " }\n" "]" -#: ../../library/json.rst:722 +#: ../../library/json.rst:733 msgid "If *infile* is not specified, read from :data:`sys.stdin`." msgstr "如果沒有指定 *infile* 則會從 :data:`sys.stdin` 讀取輸入。" -#: ../../library/json.rst:726 +#: ../../library/json.rst:737 msgid "" "Write the output of the *infile* to the given *outfile*. Otherwise, write it " "to :data:`sys.stdout`." @@ -1210,33 +1231,33 @@ msgstr "" "將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入到 :data:`sys." "stdout`。" -#: ../../library/json.rst:731 +#: ../../library/json.rst:742 msgid "Sort the output of dictionaries alphabetically by key." msgstr "按照鍵值的字母順序對輸出字典進行排序。" -#: ../../library/json.rst:737 +#: ../../library/json.rst:748 msgid "" "Disable escaping of non-ascii characters, see :func:`json.dumps` for more " "information." msgstr "關閉非 ASCII 字元的自動轉義功能。詳情請參照 :func:`json.dumps`。" -#: ../../library/json.rst:743 +#: ../../library/json.rst:754 msgid "Parse every input line as separate JSON object." msgstr "將每一行輸入都單獨輸出為一個 JSON 物件。" -#: ../../library/json.rst:749 +#: ../../library/json.rst:760 msgid "Mutually exclusive options for whitespace control." msgstr "互斥的空白字元控制選項。" -#: ../../library/json.rst:755 +#: ../../library/json.rst:766 msgid "Show the help message." msgstr "顯示說明訊息。" -#: ../../library/json.rst:759 +#: ../../library/json.rst:770 msgid "Footnotes" msgstr "註解" -#: ../../library/json.rst:760 +#: ../../library/json.rst:771 msgid "" "As noted in `the errata for RFC 7159 `_, JSON permits literal U+2028 (LINE SEPARATOR) " diff --git a/library/locale.po b/library/locale.po index 08d6cb5caa..2cb4e18ddf 100644 --- a/library/locale.po +++ b/library/locale.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -588,16 +588,6 @@ msgid "" msgstr "" #: ../../library/locale.rst:409 -msgid "Sets the locale for *category* to the default setting." -msgstr "" - -#: ../../library/locale.rst:411 -msgid "" -"The default setting is determined by calling :func:`getdefaultlocale`. " -"*category* defaults to :const:`LC_ALL`." -msgstr "" - -#: ../../library/locale.rst:419 msgid "" "Compares two strings according to the current :const:`LC_COLLATE` setting. " "As any other compare function, returns a negative, or a positive value, or " @@ -605,7 +595,7 @@ msgid "" "is equal to it." msgstr "" -#: ../../library/locale.rst:427 +#: ../../library/locale.rst:417 msgid "" "Transforms a string to one that can be used in locale-aware comparisons. " "For example, ``strxfrm(s1) < strxfrm(s2)`` is equivalent to ``strcoll(s1, " @@ -613,7 +603,7 @@ msgid "" "repeatedly, e.g. when collating a sequence of strings." msgstr "" -#: ../../library/locale.rst:436 +#: ../../library/locale.rst:426 msgid "" "Formats a number *val* according to the current :const:`LC_NUMERIC` setting. " "The format follows the conventions of the ``%`` operator. For floating-" @@ -621,29 +611,29 @@ msgid "" "is ``True``, also takes the grouping into account." msgstr "" -#: ../../library/locale.rst:441 +#: ../../library/locale.rst:431 msgid "" "If *monetary* is true, the conversion uses monetary thousands separator and " "grouping strings." msgstr "" -#: ../../library/locale.rst:444 +#: ../../library/locale.rst:434 msgid "" "Processes formatting specifiers as in ``format % val``, but takes the " "current locale settings into account." msgstr "" -#: ../../library/locale.rst:447 +#: ../../library/locale.rst:437 msgid "The *monetary* keyword parameter was added." msgstr "" -#: ../../library/locale.rst:453 +#: ../../library/locale.rst:443 msgid "" "Formats a number *val* according to the current :const:`LC_MONETARY` " "settings." msgstr "" -#: ../../library/locale.rst:455 +#: ../../library/locale.rst:445 msgid "" "The returned string includes the currency symbol if *symbol* is true, which " "is the default. If *grouping* is ``True`` (which is not the default), " @@ -651,43 +641,43 @@ msgid "" "not the default), the international currency symbol is used." msgstr "" -#: ../../library/locale.rst:462 +#: ../../library/locale.rst:452 msgid "" "This function will not work with the 'C' locale, so you have to set a locale " "via :func:`setlocale` first." msgstr "" -#: ../../library/locale.rst:468 +#: ../../library/locale.rst:458 msgid "" "Formats a floating-point number using the same format as the built-in " "function ``str(float)``, but takes the decimal point into account." msgstr "" -#: ../../library/locale.rst:474 +#: ../../library/locale.rst:464 msgid "" "Converts a string into a normalized number string, following the :const:" "`LC_NUMERIC` settings." msgstr "" -#: ../../library/locale.rst:482 +#: ../../library/locale.rst:472 msgid "" "Converts a normalized number string into a formatted string following the :" "const:`LC_NUMERIC` settings." msgstr "" -#: ../../library/locale.rst:490 +#: ../../library/locale.rst:480 msgid "" "Converts a string to a number, following the :const:`LC_NUMERIC` settings, " "by calling *func* on the result of calling :func:`delocalize` on *string*." msgstr "" -#: ../../library/locale.rst:496 +#: ../../library/locale.rst:486 msgid "" "Converts a string to an integer, following the :const:`LC_NUMERIC` " "conventions." msgstr "" -#: ../../library/locale.rst:501 +#: ../../library/locale.rst:491 msgid "" "Locale category for the character type functions. Most importantly, this " "category defines the text encoding, i.e. how bytes are interpreted as " @@ -697,32 +687,32 @@ msgid "" "SSH connections." msgstr "" -#: ../../library/locale.rst:508 +#: ../../library/locale.rst:498 msgid "" "Python doesn't internally use locale-dependent character transformation " "functions from ``ctype.h``. Instead, an internal ``pyctype.h`` provides " "locale-independent equivalents like :c:macro:`!Py_TOLOWER`." msgstr "" -#: ../../library/locale.rst:515 +#: ../../library/locale.rst:505 msgid "" "Locale category for sorting strings. The functions :func:`strcoll` and :" "func:`strxfrm` of the :mod:`locale` module are affected." msgstr "" -#: ../../library/locale.rst:521 +#: ../../library/locale.rst:511 msgid "" "Locale category for the formatting of time. The function :func:`time." "strftime` follows these conventions." msgstr "" -#: ../../library/locale.rst:527 +#: ../../library/locale.rst:517 msgid "" "Locale category for formatting of monetary values. The available options " "are available from the :func:`localeconv` function." msgstr "" -#: ../../library/locale.rst:533 +#: ../../library/locale.rst:523 msgid "" "Locale category for message display. Python currently does not support " "application specific locale-aware messages. Messages displayed by the " @@ -730,13 +720,13 @@ msgid "" "affected by this category." msgstr "" -#: ../../library/locale.rst:538 +#: ../../library/locale.rst:528 msgid "" "This value may not be available on operating systems not conforming to the " "POSIX standard, most notably Windows." msgstr "" -#: ../../library/locale.rst:544 +#: ../../library/locale.rst:534 msgid "" "Locale category for formatting numbers. The functions :func:" "`format_string`, :func:`atoi`, :func:`atof` and :func:`.str` of the :mod:" @@ -744,7 +734,7 @@ msgid "" "operations are not affected." msgstr "" -#: ../../library/locale.rst:552 +#: ../../library/locale.rst:542 msgid "" "Combination of all locale settings. If this flag is used when the locale is " "changed, setting the locale for all categories is attempted. If that fails " @@ -754,17 +744,17 @@ msgid "" "settings." msgstr "" -#: ../../library/locale.rst:561 +#: ../../library/locale.rst:551 msgid "" "This is a symbolic constant used for different values returned by :func:" "`localeconv`." msgstr "" -#: ../../library/locale.rst:565 +#: ../../library/locale.rst:555 msgid "Example::" msgstr "範例: ::" -#: ../../library/locale.rst:567 +#: ../../library/locale.rst:557 msgid "" ">>> import locale\n" ">>> loc = locale.getlocale() # get current locale\n" @@ -777,11 +767,11 @@ msgid "" ">>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale" msgstr "" -#: ../../library/locale.rst:578 +#: ../../library/locale.rst:568 msgid "Background, details, hints, tips and caveats" msgstr "" -#: ../../library/locale.rst:580 +#: ../../library/locale.rst:570 msgid "" "The C standard defines the locale as a program-wide property that may be " "relatively expensive to change. On top of that, some implementations are " @@ -789,7 +779,7 @@ msgid "" "This makes the locale somewhat painful to use correctly." msgstr "" -#: ../../library/locale.rst:585 +#: ../../library/locale.rst:575 msgid "" "Initially, when a program is started, the locale is the ``C`` locale, no " "matter what the user's preferred locale is. There is one exception: the :" @@ -799,7 +789,7 @@ msgid "" "categories by calling ``setlocale(LC_ALL, '')``." msgstr "" -#: ../../library/locale.rst:592 +#: ../../library/locale.rst:582 msgid "" "It is generally a bad idea to call :func:`setlocale` in some library " "routine, since as a side effect it affects the entire program. Saving and " @@ -807,7 +797,7 @@ msgid "" "that happen to run before the settings have been restored." msgstr "" -#: ../../library/locale.rst:597 +#: ../../library/locale.rst:587 msgid "" "If, when coding a module for general use, you need a locale independent " "version of an operation that is affected by the locale (such as certain " @@ -818,14 +808,14 @@ msgid "" "settings." msgstr "" -#: ../../library/locale.rst:604 +#: ../../library/locale.rst:594 msgid "" "The only way to perform numeric operations according to the locale is to use " "the special functions defined by this module: :func:`atof`, :func:`atoi`, :" "func:`format_string`, :func:`.str`." msgstr "" -#: ../../library/locale.rst:608 +#: ../../library/locale.rst:598 msgid "" "There is no way to perform case conversions and character classifications " "according to the locale. For (Unicode) text strings these are done " @@ -836,11 +826,11 @@ msgid "" "whitespace." msgstr "" -#: ../../library/locale.rst:619 +#: ../../library/locale.rst:609 msgid "For extension writers and programs that embed Python" msgstr "" -#: ../../library/locale.rst:621 +#: ../../library/locale.rst:611 msgid "" "Extension modules should never call :func:`setlocale`, except to find out " "what the current locale is. But since the return value can only be used " @@ -848,7 +838,7 @@ msgid "" "whether or not the locale is ``C``)." msgstr "" -#: ../../library/locale.rst:626 +#: ../../library/locale.rst:616 msgid "" "When Python code uses the :mod:`locale` module to change the locale, this " "also affects the embedding application. If the embedding application " @@ -858,11 +848,11 @@ msgid "" "accessible as a shared library." msgstr "" -#: ../../library/locale.rst:637 +#: ../../library/locale.rst:627 msgid "Access to message catalogs" msgstr "" -#: ../../library/locale.rst:646 +#: ../../library/locale.rst:636 msgid "" "The locale module exposes the C library's gettext interface on systems that " "provide this interface. It consists of the functions :func:`gettext`, :func:" @@ -873,7 +863,7 @@ msgid "" "locating message catalogs." msgstr "" -#: ../../library/locale.rst:653 +#: ../../library/locale.rst:643 msgid "" "Python applications should normally find no need to invoke these functions, " "and should use :mod:`gettext` instead. A known exception to this rule are " diff --git a/library/logging.config.po b/library/logging.config.po index 44221e3ded..018f87b9aa 100644 --- a/library/logging.config.po +++ b/library/logging.config.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -984,12 +984,13 @@ msgid "" "``subject`` value could be accessed using either ``'cfg://handlers.email." "subject'`` or, equivalently, ``'cfg://handlers.email[subject]'``. The " "latter form only needs to be used if the key contains spaces or non-" -"alphanumeric characters. If an index value consists only of decimal digits, " +"alphanumeric characters. Please note that the characters ``[`` and ``]`` are " +"not allowed in the keys. If an index value consists only of decimal digits, " "access will be attempted using the corresponding integer value, falling back " "to the string value if needed." msgstr "" -#: ../../library/logging.config.rst:693 +#: ../../library/logging.config.rst:694 msgid "" "Given a string ``cfg://handlers.myhandler.mykey.123``, this will resolve to " "``config_dict['handlers']['myhandler']['mykey']['123']``. If the string is " @@ -999,11 +1000,11 @@ msgid "" "['mykey']['123']`` if that fails." msgstr "" -#: ../../library/logging.config.rst:705 +#: ../../library/logging.config.rst:706 msgid "Import resolution and custom importers" msgstr "" -#: ../../library/logging.config.rst:707 +#: ../../library/logging.config.rst:708 msgid "" "Import resolution, by default, uses the builtin :func:`__import__` function " "to do its importing. You may want to replace this with your own importing " @@ -1015,7 +1016,7 @@ msgid "" "instance level, you need to wrap it with :func:`staticmethod`. For example::" msgstr "" -#: ../../library/logging.config.rst:717 +#: ../../library/logging.config.rst:718 msgid "" "from importlib import import_module\n" "from logging.config import BaseConfigurator\n" @@ -1027,17 +1028,17 @@ msgstr "" "\n" "BaseConfigurator.importer = staticmethod(import_module)" -#: ../../library/logging.config.rst:722 +#: ../../library/logging.config.rst:723 msgid "" "You don't need to wrap with :func:`staticmethod` if you're setting the " "import callable on a configurator *instance*." msgstr "" -#: ../../library/logging.config.rst:728 +#: ../../library/logging.config.rst:729 msgid "Configuring QueueHandler and QueueListener" msgstr "" -#: ../../library/logging.config.rst:730 +#: ../../library/logging.config.rst:731 msgid "" "If you want to configure a :class:`~logging.handlers.QueueHandler`, noting " "that this is normally used in conjunction with a :class:`~logging.handlers." @@ -1050,7 +1051,7 @@ msgid "" "the example YAML snippet below." msgstr "" -#: ../../library/logging.config.rst:739 +#: ../../library/logging.config.rst:740 msgid "" "handlers:\n" " qhand:\n" @@ -1072,17 +1073,17 @@ msgstr "" " - hand_name_2\n" " ..." -#: ../../library/logging.config.rst:751 +#: ../../library/logging.config.rst:752 msgid "The ``queue`` and ``listener`` keys are optional." msgstr "" -#: ../../library/logging.config.rst:753 +#: ../../library/logging.config.rst:754 msgid "" "If the ``queue`` key is present, the corresponding value can be one of the " "following:" msgstr "" -#: ../../library/logging.config.rst:755 +#: ../../library/logging.config.rst:756 msgid "" "An object implementing the :class:`queue.Queue` public API. For instance, " "this may be an actual instance of :class:`queue.Queue` or a subclass " @@ -1090,13 +1091,13 @@ msgid "" "Queue`." msgstr "" -#: ../../library/logging.config.rst:759 +#: ../../library/logging.config.rst:760 msgid "" "This is of course only possible if you are constructing or modifying the " "configuration dictionary in code." msgstr "" -#: ../../library/logging.config.rst:762 +#: ../../library/logging.config.rst:763 msgid "" "A string that resolves to a callable which, when called with no arguments, " "returns the :class:`queue.Queue` instance to use. That callable could be a :" @@ -1104,39 +1105,39 @@ msgid "" "instance, such as ``my.module.queue_factory()``." msgstr "" -#: ../../library/logging.config.rst:767 +#: ../../library/logging.config.rst:768 msgid "" "A dict with a ``'()'`` key which is constructed in the usual way as " "discussed in :ref:`logging-config-dict-userdef`. The result of this " "construction should be a :class:`queue.Queue` instance." msgstr "" -#: ../../library/logging.config.rst:771 +#: ../../library/logging.config.rst:772 msgid "" "If the ``queue`` key is absent, a standard unbounded :class:`queue.Queue` " "instance is created and used." msgstr "" -#: ../../library/logging.config.rst:774 +#: ../../library/logging.config.rst:775 msgid "" "If the ``listener`` key is present, the corresponding value can be one of " "the following:" msgstr "" -#: ../../library/logging.config.rst:776 +#: ../../library/logging.config.rst:777 msgid "" "A subclass of :class:`logging.handlers.QueueListener`. This is of course " "only possible if you are constructing or modifying the configuration " "dictionary in code." msgstr "" -#: ../../library/logging.config.rst:780 +#: ../../library/logging.config.rst:781 msgid "" "A string which resolves to a class which is a subclass of ``QueueListener``, " "such as ``'my.package.CustomListener'``." msgstr "" -#: ../../library/logging.config.rst:783 +#: ../../library/logging.config.rst:784 msgid "" "A dict with a ``'()'`` key which is constructed in the usual way as " "discussed in :ref:`logging-config-dict-userdef`. The result of this " @@ -1144,31 +1145,31 @@ msgid "" "``QueueListener`` initializer." msgstr "" -#: ../../library/logging.config.rst:787 +#: ../../library/logging.config.rst:788 msgid "" "If the ``listener`` key is absent, :class:`logging.handlers.QueueListener` " "is used." msgstr "" -#: ../../library/logging.config.rst:789 +#: ../../library/logging.config.rst:790 msgid "" "The values under the ``handlers`` key are the names of other handlers in the " "configuration (not shown in the above snippet) which will be passed to the " "queue listener." msgstr "" -#: ../../library/logging.config.rst:793 +#: ../../library/logging.config.rst:794 msgid "" "Any custom queue handler and listener classes will need to be defined with " "the same initialization signatures as :class:`~logging.handlers." "QueueHandler` and :class:`~logging.handlers.QueueListener`." msgstr "" -#: ../../library/logging.config.rst:802 +#: ../../library/logging.config.rst:803 msgid "Configuration file format" msgstr "" -#: ../../library/logging.config.rst:804 +#: ../../library/logging.config.rst:805 msgid "" "The configuration file format understood by :func:`fileConfig` is based on :" "mod:`configparser` functionality. The file must contain sections called " @@ -1185,7 +1186,7 @@ msgid "" "specified in a section called ``[logger_root]``." msgstr "" -#: ../../library/logging.config.rst:819 +#: ../../library/logging.config.rst:820 msgid "" "The :func:`fileConfig` API is older than the :func:`dictConfig` API and does " "not provide functionality to cover certain aspects of logging. For example, " @@ -1198,11 +1199,11 @@ msgid "" "when it's convenient to do so." msgstr "" -#: ../../library/logging.config.rst:829 +#: ../../library/logging.config.rst:830 msgid "Examples of these sections in the file are given below." msgstr "" -#: ../../library/logging.config.rst:831 +#: ../../library/logging.config.rst:832 msgid "" "[loggers]\n" "keys=root,log02,log03,log04,log05,log06,log07\n" @@ -1222,13 +1223,13 @@ msgstr "" "[formatters]\n" "keys=form01,form02,form03,form04,form05,form06,form07,form08,form09" -#: ../../library/logging.config.rst:842 +#: ../../library/logging.config.rst:843 msgid "" "The root logger must specify a level and a list of handlers. An example of a " "root logger section is given below." msgstr "" -#: ../../library/logging.config.rst:845 +#: ../../library/logging.config.rst:846 msgid "" "[logger_root]\n" "level=NOTSET\n" @@ -1238,7 +1239,7 @@ msgstr "" "level=NOTSET\n" "handlers=hand01" -#: ../../library/logging.config.rst:851 +#: ../../library/logging.config.rst:852 msgid "" "The ``level`` entry can be one of ``DEBUG, INFO, WARNING, ERROR, CRITICAL`` " "or ``NOTSET``. For the root logger only, ``NOTSET`` means that all messages " @@ -1246,7 +1247,7 @@ msgid "" "of the ``logging`` package's namespace." msgstr "" -#: ../../library/logging.config.rst:856 +#: ../../library/logging.config.rst:857 msgid "" "The ``handlers`` entry is a comma-separated list of handler names, which " "must appear in the ``[handlers]`` section. These names must appear in the " @@ -1254,13 +1255,13 @@ msgid "" "file." msgstr "" -#: ../../library/logging.config.rst:861 +#: ../../library/logging.config.rst:862 msgid "" "For loggers other than the root logger, some additional information is " "required. This is illustrated by the following example." msgstr "" -#: ../../library/logging.config.rst:864 +#: ../../library/logging.config.rst:865 msgid "" "[logger_parser]\n" "level=DEBUG\n" @@ -1274,7 +1275,7 @@ msgstr "" "propagate=1\n" "qualname=compiler.parser" -#: ../../library/logging.config.rst:872 +#: ../../library/logging.config.rst:873 msgid "" "The ``level`` and ``handlers`` entries are interpreted as for the root " "logger, except that if a non-root logger's level is specified as ``NOTSET``, " @@ -1287,13 +1288,13 @@ msgid "" "application to get the logger." msgstr "" -#: ../../library/logging.config.rst:881 +#: ../../library/logging.config.rst:882 msgid "" "Sections which specify handler configuration are exemplified by the " "following." msgstr "" -#: ../../library/logging.config.rst:883 +#: ../../library/logging.config.rst:884 msgid "" "[handler_hand01]\n" "class=StreamHandler\n" @@ -1307,14 +1308,14 @@ msgstr "" "formatter=form01\n" "args=(sys.stdout,)" -#: ../../library/logging.config.rst:891 +#: ../../library/logging.config.rst:892 msgid "" "The ``class`` entry indicates the handler's class (as determined by :func:" "`eval` in the ``logging`` package's namespace). The ``level`` is interpreted " "as for loggers, and ``NOTSET`` is taken to mean 'log everything'." msgstr "" -#: ../../library/logging.config.rst:895 +#: ../../library/logging.config.rst:896 msgid "" "The ``formatter`` entry indicates the key name of the formatter for this " "handler. If blank, a default formatter (``logging._defaultFormatter``) is " @@ -1322,7 +1323,7 @@ msgid "" "and have a corresponding section in the configuration file." msgstr "" -#: ../../library/logging.config.rst:900 +#: ../../library/logging.config.rst:901 msgid "" "The ``args`` entry, when :ref:`evaluated ` in the context of the " "``logging`` package's namespace, is the list of arguments to the constructor " @@ -1331,7 +1332,7 @@ msgid "" "provided, it defaults to ``()``." msgstr "" -#: ../../library/logging.config.rst:906 +#: ../../library/logging.config.rst:907 msgid "" "The optional ``kwargs`` entry, when :ref:`evaluated ` in the " "context of the ``logging`` package's namespace, is the keyword argument dict " @@ -1339,7 +1340,7 @@ msgid "" "``{}``." msgstr "" -#: ../../library/logging.config.rst:910 +#: ../../library/logging.config.rst:911 msgid "" "[handler_hand02]\n" "class=FileHandler\n" @@ -1447,12 +1448,12 @@ msgstr "" "args=('localhost:9022', '/log', 'GET')\n" "kwargs={'secure': True}" -#: ../../library/logging.config.rst:963 +#: ../../library/logging.config.rst:964 msgid "" "Sections which specify formatter configuration are typified by the following." msgstr "" -#: ../../library/logging.config.rst:965 +#: ../../library/logging.config.rst:966 msgid "" "[formatter_form01]\n" "format=F1 %(asctime)s %(levelname)s %(message)s %(customfield)s\n" @@ -1470,21 +1471,21 @@ msgstr "" "defaults={'customfield': 'defaultvalue'}\n" "class=logging.Formatter" -#: ../../library/logging.config.rst:975 +#: ../../library/logging.config.rst:976 msgid "" "The arguments for the formatter configuration are the same as the keys in " "the dictionary schema :ref:`formatters section `." msgstr "" -#: ../../library/logging.config.rst:979 +#: ../../library/logging.config.rst:980 msgid "" "The ``defaults`` entry, when :ref:`evaluated ` in the context of " "the ``logging`` package's namespace, is a dictionary of default values for " "custom formatting fields. If not provided, it defaults to ``None``." msgstr "" -#: ../../library/logging.config.rst:986 +#: ../../library/logging.config.rst:987 msgid "" "Due to the use of :func:`eval` as described above, there are potential " "security risks which result from using the :func:`listen` to send and " @@ -1493,18 +1494,18 @@ msgid "" "`listen` documentation for more information." msgstr "" -#: ../../library/logging.config.rst:994 +#: ../../library/logging.config.rst:995 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../library/logging.config.rst:995 +#: ../../library/logging.config.rst:996 msgid "API reference for the logging module." msgstr "" -#: ../../library/logging.config.rst:997 +#: ../../library/logging.config.rst:998 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../library/logging.config.rst:998 +#: ../../library/logging.config.rst:999 msgid "Useful handlers included with the logging module." msgstr "" diff --git a/library/logging.po b/library/logging.po index 453999600b..dbfd2969fc 100644 --- a/library/logging.po +++ b/library/logging.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-09 14:12+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-03-28 22:40+0800\n" "Last-Translator: RockLeon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1307,11 +1307,11 @@ msgstr "" msgid "Attribute name" msgstr "" -#: ../../library/logging.rst:992 ../../library/logging.rst:1354 +#: ../../library/logging.rst:992 ../../library/logging.rst:1362 msgid "Format" msgstr "格式" -#: ../../library/logging.rst:992 ../../library/logging.rst:1354 +#: ../../library/logging.rst:992 ../../library/logging.rst:1362 msgid "Description" msgstr "描述" @@ -1357,7 +1357,7 @@ msgstr "``%(created)f``" #: ../../library/logging.rst:1005 msgid "" "Time when the :class:`LogRecord` was created (as returned by :func:`time." -"time`)." +"time_ns` / 1e9)." msgstr "" #: ../../library/logging.rst:0 ../../library/logging.rst:1008 @@ -1617,10 +1617,14 @@ msgstr "" #: ../../library/logging.rst:1084 msgid "" "Returns an instance of :class:`LoggerAdapter` initialized with an " -"underlying :class:`Logger` instance and a dict-like object." +"underlying :class:`Logger` instance, a dict-like object (*extra*), and a " +"boolean (*merge_extra*) indicating whether or not the *extra* argument of " +"individual log calls should be merged with the :class:`LoggerAdapter` extra. " +"The default behavior is to ignore the *extra* argument of individual log " +"calls and only use the one of the :class:`LoggerAdapter` instance" msgstr "" -#: ../../library/logging.rst:1089 +#: ../../library/logging.rst:1093 msgid "" "Modifies the message and/or keyword arguments passed to a logging call in " "order to insert contextual information. This implementation takes the object " @@ -1629,15 +1633,15 @@ msgid "" "(possibly modified) versions of the arguments passed in." msgstr "" -#: ../../library/logging.rst:1097 -msgid "Delegates to the underlying :attr:`!manager` on *logger*." +#: ../../library/logging.rst:1101 +msgid "Delegates to the underlying :attr:`!manager`` on *logger*." msgstr "" -#: ../../library/logging.rst:1101 -msgid "Delegates to the underlying :meth:`!_log` method on *logger*." +#: ../../library/logging.rst:1105 +msgid "Delegates to the underlying :meth:`!_log`` method on *logger*." msgstr "" -#: ../../library/logging.rst:1103 +#: ../../library/logging.rst:1107 msgid "" "In addition to the above, :class:`LoggerAdapter` supports the following " "methods of :class:`Logger`: :meth:`~Logger.debug`, :meth:`~Logger.info`, :" @@ -1649,24 +1653,29 @@ msgid "" "interchangeably." msgstr "" -#: ../../library/logging.rst:1114 +#: ../../library/logging.rst:1118 msgid "" "The :meth:`~Logger.isEnabledFor`, :meth:`~Logger.getEffectiveLevel`, :meth:" "`~Logger.setLevel` and :meth:`~Logger.hasHandlers` methods were added to :" "class:`LoggerAdapter`. These methods delegate to the underlying logger." msgstr "" -#: ../../library/logging.rst:1120 +#: ../../library/logging.rst:1124 msgid "" "Attribute :attr:`!manager` and method :meth:`!_log` were added, which " "delegate to the underlying logger and allow adapters to be nested." msgstr "" -#: ../../library/logging.rst:1125 +#: ../../library/logging.rst:1129 +#, fuzzy +msgid "The *merge_extra* argument was added." +msgstr "新增 *force* 引數。" + +#: ../../library/logging.rst:1133 msgid "Thread Safety" msgstr "" -#: ../../library/logging.rst:1127 +#: ../../library/logging.rst:1135 msgid "" "The logging module is intended to be thread-safe without any special work " "needing to be done by its clients. It achieves this though using threading " @@ -1675,7 +1684,7 @@ msgid "" "O." msgstr "" -#: ../../library/logging.rst:1132 +#: ../../library/logging.rst:1140 msgid "" "If you are implementing asynchronous signal handlers using the :mod:`signal` " "module, you may not be able to use logging from within such handlers. This " @@ -1683,17 +1692,17 @@ msgid "" "always re-entrant, and so cannot be invoked from such signal handlers." msgstr "" -#: ../../library/logging.rst:1139 +#: ../../library/logging.rst:1147 msgid "Module-Level Functions" msgstr "" -#: ../../library/logging.rst:1141 +#: ../../library/logging.rst:1149 msgid "" "In addition to the classes described above, there are a number of module-" "level functions." msgstr "" -#: ../../library/logging.rst:1147 +#: ../../library/logging.rst:1155 msgid "" "Return a logger with the specified name or, if name is ``None``, return the " "root logger of the hierarchy. If specified, the name is typically a dot-" @@ -1703,14 +1712,14 @@ msgid "" "for not doing that, as mentioned in :ref:`logger`." msgstr "" -#: ../../library/logging.rst:1154 +#: ../../library/logging.rst:1162 msgid "" "All calls to this function with a given name return the same logger " "instance. This means that logger instances never need to be passed between " "different parts of an application." msgstr "" -#: ../../library/logging.rst:1161 +#: ../../library/logging.rst:1169 msgid "" "Return either the standard :class:`Logger` class, or the last class passed " "to :func:`setLoggerClass`. This function may be called from within a new " @@ -1719,43 +1728,43 @@ msgid "" "example::" msgstr "" -#: ../../library/logging.rst:1166 +#: ../../library/logging.rst:1174 msgid "" "class MyLogger(logging.getLoggerClass()):\n" " # ... override behaviour here" msgstr "" -#: ../../library/logging.rst:1172 +#: ../../library/logging.rst:1180 msgid "Return a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1174 +#: ../../library/logging.rst:1182 msgid "" "This function has been provided, along with :func:`setLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1179 +#: ../../library/logging.rst:1187 msgid "" "See :func:`setLogRecordFactory` for more information about the how the " "factory is called." msgstr "" -#: ../../library/logging.rst:1184 +#: ../../library/logging.rst:1192 msgid "" "This is a convenience function that calls :meth:`Logger.debug`, on the root " "logger. The handling of the arguments is in every way identical to what is " "described in that method." msgstr "" -#: ../../library/logging.rst:1188 +#: ../../library/logging.rst:1196 msgid "" "The only difference is that if the root logger has no handlers, then :func:" "`basicConfig` is called, prior to calling ``debug`` on the root logger." msgstr "" -#: ../../library/logging.rst:1191 +#: ../../library/logging.rst:1199 msgid "" "For very short scripts or quick demonstrations of ``logging`` facilities, " "``debug`` and the other module-level functions may be convenient. However, " @@ -1765,38 +1774,38 @@ msgid "" "described at the beginnning of this documentation." msgstr "" -#: ../../library/logging.rst:1201 +#: ../../library/logging.rst:1209 msgid "" "Logs a message with level :const:`INFO` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1207 +#: ../../library/logging.rst:1215 msgid "" "Logs a message with level :const:`WARNING` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1210 +#: ../../library/logging.rst:1218 msgid "" "There is an obsolete function ``warn`` which is functionally identical to " "``warning``. As ``warn`` is deprecated, please do not use it - use " "``warning`` instead." msgstr "" -#: ../../library/logging.rst:1217 +#: ../../library/logging.rst:1225 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1223 +#: ../../library/logging.rst:1231 msgid "" "Logs a message with level :const:`CRITICAL` on the root logger. The " "arguments and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1229 +#: ../../library/logging.rst:1237 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`. Exception info is " @@ -1804,13 +1813,13 @@ msgid "" "exception handler." msgstr "" -#: ../../library/logging.rst:1235 +#: ../../library/logging.rst:1243 msgid "" "Logs a message with level *level* on the root logger. The arguments and " "behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1240 +#: ../../library/logging.rst:1248 msgid "" "Provides an overriding level *level* for all loggers which takes precedence " "over the logger's own level. When the need arises to temporarily throttle " @@ -1824,7 +1833,7 @@ msgid "" "individual loggers." msgstr "" -#: ../../library/logging.rst:1251 +#: ../../library/logging.rst:1259 msgid "" "Note that if you have defined any custom logging level higher than " "``CRITICAL`` (this is not recommended), you won't be able to rely on the " @@ -1832,13 +1841,13 @@ msgid "" "a suitable value." msgstr "" -#: ../../library/logging.rst:1256 +#: ../../library/logging.rst:1264 msgid "" "The *level* parameter was defaulted to level ``CRITICAL``. See :issue:" "`28524` for more information about this change." msgstr "" -#: ../../library/logging.rst:1262 +#: ../../library/logging.rst:1270 msgid "" "Associates level *level* with text *levelName* in an internal dictionary, " "which is used to map numeric levels to a textual representation, for example " @@ -1848,24 +1857,24 @@ msgid "" "and they should increase in increasing order of severity." msgstr "" -#: ../../library/logging.rst:1269 +#: ../../library/logging.rst:1277 msgid "" "If you are thinking of defining your own levels, please see the section on :" "ref:`custom-levels`." msgstr "" -#: ../../library/logging.rst:1274 +#: ../../library/logging.rst:1282 msgid "" "Returns a mapping from level names to their corresponding logging levels. " "For example, the string \"CRITICAL\" maps to :const:`CRITICAL`. The returned " "mapping is copied from an internal mapping on each call to this function." msgstr "" -#: ../../library/logging.rst:1282 +#: ../../library/logging.rst:1290 msgid "Returns the textual or numeric representation of logging level *level*." msgstr "" -#: ../../library/logging.rst:1284 +#: ../../library/logging.rst:1292 msgid "" "If *level* is one of the predefined levels :const:`CRITICAL`, :const:" "`ERROR`, :const:`WARNING`, :const:`INFO` or :const:`DEBUG` then you get the " @@ -1875,20 +1884,20 @@ msgid "" "the corresponding string representation is returned." msgstr "" -#: ../../library/logging.rst:1291 +#: ../../library/logging.rst:1299 msgid "" "The *level* parameter also accepts a string representation of the level such " "as 'INFO'. In such cases, this functions returns the corresponding numeric " "value of the level." msgstr "" -#: ../../library/logging.rst:1295 +#: ../../library/logging.rst:1303 msgid "" "If no matching numeric or string value is passed in, the string 'Level %s' % " "level is returned." msgstr "" -#: ../../library/logging.rst:1298 +#: ../../library/logging.rst:1306 msgid "" "Levels are internally integers (as they need to be compared in the logging " "logic). This function is used to convert between an integer level and the " @@ -1897,7 +1906,7 @@ msgid "" "vice versa." msgstr "" -#: ../../library/logging.rst:1304 +#: ../../library/logging.rst:1312 msgid "" "In Python versions earlier than 3.4, this function could also be passed a " "text level, and would return the corresponding numeric value of the level. " @@ -1905,17 +1914,17 @@ msgid "" "Python 3.4, but reinstated in 3.4.2 due to retain backward compatibility." msgstr "" -#: ../../library/logging.rst:1312 +#: ../../library/logging.rst:1320 msgid "" "Returns a handler with the specified *name*, or ``None`` if there is no " "handler with that name." msgstr "" -#: ../../library/logging.rst:1319 +#: ../../library/logging.rst:1327 msgid "Returns an immutable set of all known handler names." msgstr "" -#: ../../library/logging.rst:1325 +#: ../../library/logging.rst:1333 msgid "" "Creates and returns a new :class:`LogRecord` instance whose attributes are " "defined by *attrdict*. This function is useful for taking a pickled :class:" @@ -1923,7 +1932,7 @@ msgid "" "as a :class:`LogRecord` instance at the receiving end." msgstr "" -#: ../../library/logging.rst:1333 +#: ../../library/logging.rst:1341 msgid "" "Does basic configuration for the logging system by creating a :class:" "`StreamHandler` with a default :class:`Formatter` and adding it to the root " @@ -1932,13 +1941,13 @@ msgid "" "no handlers are defined for the root logger." msgstr "" -#: ../../library/logging.rst:1339 +#: ../../library/logging.rst:1347 msgid "" "This function does nothing if the root logger already has handlers " "configured, unless the keyword argument *force* is set to ``True``." msgstr "" -#: ../../library/logging.rst:1342 +#: ../../library/logging.rst:1350 msgid "" "This function should be called from the main thread before other threads are " "started. In versions of Python prior to 2.7.1 and 3.2, if this function is " @@ -1947,54 +1956,54 @@ msgid "" "unexpected results such as messages being duplicated in the log." msgstr "" -#: ../../library/logging.rst:1349 +#: ../../library/logging.rst:1357 msgid "The following keyword arguments are supported." msgstr "" -#: ../../library/logging.rst:1356 +#: ../../library/logging.rst:1364 msgid "*filename*" msgstr "*filename*" -#: ../../library/logging.rst:1356 +#: ../../library/logging.rst:1364 msgid "" "Specifies that a :class:`FileHandler` be created, using the specified " "filename, rather than a :class:`StreamHandler`." msgstr "" -#: ../../library/logging.rst:1360 +#: ../../library/logging.rst:1368 msgid "*filemode*" msgstr "*filemode*" -#: ../../library/logging.rst:1360 +#: ../../library/logging.rst:1368 msgid "" "If *filename* is specified, open the file in this :ref:`mode `. " "Defaults to ``'a'``." msgstr "" -#: ../../library/logging.rst:1364 +#: ../../library/logging.rst:1372 msgid "*format*" msgstr "*format*" -#: ../../library/logging.rst:1364 +#: ../../library/logging.rst:1372 msgid "" "Use the specified format string for the handler. Defaults to attributes " "``levelname``, ``name`` and ``message`` separated by colons." msgstr "" -#: ../../library/logging.rst:1369 +#: ../../library/logging.rst:1377 msgid "*datefmt*" msgstr "*datefmt*" -#: ../../library/logging.rst:1369 +#: ../../library/logging.rst:1377 msgid "" "Use the specified date/time format, as accepted by :func:`time.strftime`." msgstr "" -#: ../../library/logging.rst:1372 +#: ../../library/logging.rst:1380 msgid "*style*" msgstr "*style*" -#: ../../library/logging.rst:1372 +#: ../../library/logging.rst:1380 msgid "" "If *format* is specified, use this style for the format string. One of " "``'%'``, ``'{'`` or ``'$'`` for :ref:`printf-style `." msgstr "" -#: ../../library/logging.rst:1383 +#: ../../library/logging.rst:1391 msgid "*stream*" msgstr "*stream*" -#: ../../library/logging.rst:1383 +#: ../../library/logging.rst:1391 msgid "" "Use the specified stream to initialize the :class:`StreamHandler`. Note that " "this argument is incompatible with *filename* - if both are present, a " "``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1389 +#: ../../library/logging.rst:1397 msgid "*handlers*" msgstr "*handlers*" -#: ../../library/logging.rst:1389 +#: ../../library/logging.rst:1397 msgid "" "If specified, this should be an iterable of already created handlers to add " "to the root logger. Any handlers which don't already have a formatter set " @@ -2034,33 +2043,33 @@ msgid "" "present, a ``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1398 +#: ../../library/logging.rst:1406 msgid "*force*" msgstr "*force*" -#: ../../library/logging.rst:1398 +#: ../../library/logging.rst:1406 msgid "" "If this keyword argument is specified as true, any existing handlers " "attached to the root logger are removed and closed, before carrying out the " "configuration as specified by the other arguments." msgstr "" -#: ../../library/logging.rst:1404 +#: ../../library/logging.rst:1412 msgid "*encoding*" msgstr "*encoding*" -#: ../../library/logging.rst:1404 +#: ../../library/logging.rst:1412 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " "the output file." msgstr "" -#: ../../library/logging.rst:1409 +#: ../../library/logging.rst:1417 msgid "*errors*" msgstr "*errors*" -#: ../../library/logging.rst:1409 +#: ../../library/logging.rst:1417 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " @@ -2069,39 +2078,39 @@ msgid "" "`open`, which means that it will be treated the same as passing 'errors'." msgstr "" -#: ../../library/logging.rst:1420 +#: ../../library/logging.rst:1428 msgid "The *style* argument was added." msgstr "新增 *style* 引數。" -#: ../../library/logging.rst:1423 +#: ../../library/logging.rst:1431 msgid "" "The *handlers* argument was added. Additional checks were added to catch " "situations where incompatible arguments are specified (e.g. *handlers* " "together with *stream* or *filename*, or *stream* together with *filename*)." msgstr "" -#: ../../library/logging.rst:1429 +#: ../../library/logging.rst:1437 msgid "The *force* argument was added." msgstr "新增 *force* 引數。" -#: ../../library/logging.rst:1432 +#: ../../library/logging.rst:1440 msgid "The *encoding* and *errors* arguments were added." msgstr "新增 *encoding* 與 *errors* 引數。" -#: ../../library/logging.rst:1437 +#: ../../library/logging.rst:1445 msgid "" "Informs the logging system to perform an orderly shutdown by flushing and " "closing all handlers. This should be called at application exit and no " "further use of the logging system should be made after this call." msgstr "" -#: ../../library/logging.rst:1441 +#: ../../library/logging.rst:1449 msgid "" "When the logging module is imported, it registers this function as an exit " "handler (see :mod:`atexit`), so normally there's no need to do that manually." msgstr "" -#: ../../library/logging.rst:1448 +#: ../../library/logging.rst:1456 msgid "" "Tells the logging system to use the class *klass* when instantiating a " "logger. The class should define :meth:`!__init__` such that only a name " @@ -2113,32 +2122,32 @@ msgid "" "loggers." msgstr "" -#: ../../library/logging.rst:1459 +#: ../../library/logging.rst:1467 msgid "Set a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1461 +#: ../../library/logging.rst:1469 msgid "The factory callable to be used to instantiate a log record." msgstr "" -#: ../../library/logging.rst:1463 +#: ../../library/logging.rst:1471 msgid "" "This function has been provided, along with :func:`getLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1468 +#: ../../library/logging.rst:1476 msgid "The factory has the following signature:" msgstr "" -#: ../../library/logging.rst:1470 +#: ../../library/logging.rst:1478 msgid "" "``factory(name, level, fn, lno, msg, args, exc_info, func=None, sinfo=None, " "**kwargs)``" msgstr "" -#: ../../library/logging.rst:1472 +#: ../../library/logging.rst:1480 msgid "The logger name." msgstr "" @@ -2146,7 +2155,7 @@ msgstr "" msgid "level" msgstr "" -#: ../../library/logging.rst:1473 +#: ../../library/logging.rst:1481 msgid "The logging level (numeric)." msgstr "" @@ -2154,7 +2163,7 @@ msgstr "" msgid "fn" msgstr "fn" -#: ../../library/logging.rst:1474 +#: ../../library/logging.rst:1482 msgid "The full pathname of the file where the logging call was made." msgstr "" @@ -2162,19 +2171,19 @@ msgstr "" msgid "lno" msgstr "lno" -#: ../../library/logging.rst:1475 +#: ../../library/logging.rst:1483 msgid "The line number in the file where the logging call was made." msgstr "" -#: ../../library/logging.rst:1476 +#: ../../library/logging.rst:1484 msgid "The logging message." msgstr "" -#: ../../library/logging.rst:1477 +#: ../../library/logging.rst:1485 msgid "The arguments for the logging message." msgstr "" -#: ../../library/logging.rst:1478 +#: ../../library/logging.rst:1486 msgid "An exception tuple, or ``None``." msgstr "" @@ -2182,7 +2191,7 @@ msgstr "" msgid "func" msgstr "func" -#: ../../library/logging.rst:1479 +#: ../../library/logging.rst:1487 msgid "The name of the function or method which invoked the logging call." msgstr "" @@ -2190,7 +2199,7 @@ msgstr "" msgid "sinfo" msgstr "sinfo" -#: ../../library/logging.rst:1481 +#: ../../library/logging.rst:1489 msgid "" "A stack traceback such as is provided by :func:`traceback.print_stack`, " "showing the call hierarchy." @@ -2200,15 +2209,15 @@ msgstr "" msgid "kwargs" msgstr "kwargs" -#: ../../library/logging.rst:1483 +#: ../../library/logging.rst:1491 msgid "Additional keyword arguments." msgstr "額外的關鍵字引數。" -#: ../../library/logging.rst:1487 +#: ../../library/logging.rst:1495 msgid "Module-Level Attributes" msgstr "" -#: ../../library/logging.rst:1491 +#: ../../library/logging.rst:1499 msgid "" "A \"handler of last resort\" is available through this attribute. This is a :" "class:`StreamHandler` writing to ``sys.stderr`` with a level of ``WARNING``, " @@ -2219,15 +2228,15 @@ msgid "" "reason, ``lastResort`` can be set to ``None``." msgstr "" -#: ../../library/logging.rst:1503 +#: ../../library/logging.rst:1511 msgid "Used to see if exceptions during handling should be propagated." msgstr "" -#: ../../library/logging.rst:1505 +#: ../../library/logging.rst:1513 msgid "Default: ``True``." msgstr "" -#: ../../library/logging.rst:1507 +#: ../../library/logging.rst:1515 msgid "" "If :data:`raiseExceptions` is ``False``, exceptions get silently ignored. " "This is what is mostly wanted for a logging system - most users will not " @@ -2235,22 +2244,22 @@ msgid "" "application errors." msgstr "" -#: ../../library/logging.rst:1514 +#: ../../library/logging.rst:1522 msgid "Integration with the warnings module" msgstr "" -#: ../../library/logging.rst:1516 +#: ../../library/logging.rst:1524 msgid "" "The :func:`captureWarnings` function can be used to integrate :mod:`logging` " "with the :mod:`warnings` module." msgstr "" -#: ../../library/logging.rst:1521 +#: ../../library/logging.rst:1529 msgid "" "This function is used to turn the capture of warnings by logging on and off." msgstr "" -#: ../../library/logging.rst:1524 +#: ../../library/logging.rst:1532 msgid "" "If *capture* is ``True``, warnings issued by the :mod:`warnings` module will " "be redirected to the logging system. Specifically, a warning will be " @@ -2259,46 +2268,46 @@ msgid "" "`WARNING`." msgstr "" -#: ../../library/logging.rst:1529 +#: ../../library/logging.rst:1537 msgid "" "If *capture* is ``False``, the redirection of warnings to the logging system " "will stop, and warnings will be redirected to their original destinations (i." "e. those in effect before ``captureWarnings(True)`` was called)." msgstr "" -#: ../../library/logging.rst:1536 +#: ../../library/logging.rst:1544 msgid "Module :mod:`logging.config`" msgstr "" -#: ../../library/logging.rst:1537 +#: ../../library/logging.rst:1545 msgid "Configuration API for the logging module." msgstr "" -#: ../../library/logging.rst:1539 +#: ../../library/logging.rst:1547 msgid "Module :mod:`logging.handlers`" msgstr "" -#: ../../library/logging.rst:1540 +#: ../../library/logging.rst:1548 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../library/logging.rst:1542 +#: ../../library/logging.rst:1550 msgid ":pep:`282` - A Logging System" msgstr "" -#: ../../library/logging.rst:1543 +#: ../../library/logging.rst:1551 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "" -#: ../../library/logging.rst:1546 +#: ../../library/logging.rst:1554 msgid "" "`Original Python logging package `_" msgstr "" -#: ../../library/logging.rst:1547 +#: ../../library/logging.rst:1555 msgid "" "This is the original source for the :mod:`logging` package. The version of " "the package available from this site is suitable for use with Python 1.5.2, " diff --git a/library/lzma.po b/library/lzma.po index df86fd296f..164401e87f 100644 --- a/library/lzma.po +++ b/library/lzma.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -104,7 +104,7 @@ msgstr "" msgid "Added support for the ``\"x\"``, ``\"xb\"`` and ``\"xt\"`` modes." msgstr "新增 ``\"x\"``、``\"xb\"`` 和 ``\"xt\"`` 模式的支援。" -#: ../../library/lzma.rst:68 ../../library/lzma.rst:127 +#: ../../library/lzma.rst:68 ../../library/lzma.rst:141 msgid "Accepts a :term:`path-like object`." msgstr "" @@ -151,7 +151,7 @@ msgid "" msgstr "" #: ../../library/lzma.rst:107 -msgid "The following method is also provided:" +msgid "The following method and attributes are also provided:" msgstr "" #: ../../library/lzma.rst:111 @@ -169,60 +169,70 @@ msgid "" "*filename*)." msgstr "" -#: ../../library/lzma.rst:120 +#: ../../library/lzma.rst:122 +msgid "``'rb'`` for reading and ``'wb'`` for writing." +msgstr "" + +#: ../../library/lzma.rst:128 +msgid "" +"The lzma file name. Equivalent to the :attr:`~io.FileIO.name` attribute of " +"the underlying :term:`file object`." +msgstr "" + +#: ../../library/lzma.rst:134 msgid "Added support for the ``\"x\"`` and ``\"xb\"`` modes." msgstr "新增 ``\"x\"`` 和 ``\"xb\"`` 模式的支援。" -#: ../../library/lzma.rst:123 +#: ../../library/lzma.rst:137 msgid "" "The :meth:`~io.BufferedIOBase.read` method now accepts an argument of " "``None``." msgstr "" -#: ../../library/lzma.rst:132 +#: ../../library/lzma.rst:146 msgid "Compressing and decompressing data in memory" msgstr "" -#: ../../library/lzma.rst:136 +#: ../../library/lzma.rst:150 msgid "" "Create a compressor object, which can be used to compress data incrementally." msgstr "" -#: ../../library/lzma.rst:138 +#: ../../library/lzma.rst:152 msgid "" "For a more convenient way of compressing a single chunk of data, see :func:" "`compress`." msgstr "" -#: ../../library/lzma.rst:141 +#: ../../library/lzma.rst:155 msgid "" "The *format* argument specifies what container format should be used. " "Possible values are:" msgstr "" -#: ../../library/lzma.rst:144 +#: ../../library/lzma.rst:158 msgid ":const:`FORMAT_XZ`: The ``.xz`` container format." msgstr "" -#: ../../library/lzma.rst:145 +#: ../../library/lzma.rst:159 msgid "This is the default format." msgstr "" -#: ../../library/lzma.rst:147 +#: ../../library/lzma.rst:161 msgid ":const:`FORMAT_ALONE`: The legacy ``.lzma`` container format." msgstr "" -#: ../../library/lzma.rst:148 +#: ../../library/lzma.rst:162 msgid "" "This format is more limited than ``.xz`` -- it does not support integrity " "checks or multiple filters." msgstr "" -#: ../../library/lzma.rst:151 +#: ../../library/lzma.rst:165 msgid ":const:`FORMAT_RAW`: A raw data stream, not using any container format." msgstr "" -#: ../../library/lzma.rst:152 +#: ../../library/lzma.rst:166 msgid "" "This format specifier does not support integrity checks, and requires that " "you always specify a custom filter chain (for both compression and " @@ -230,46 +240,46 @@ msgid "" "decompressed using :const:`FORMAT_AUTO` (see :class:`LZMADecompressor`)." msgstr "" -#: ../../library/lzma.rst:157 +#: ../../library/lzma.rst:171 msgid "" "The *check* argument specifies the type of integrity check to include in the " "compressed data. This check is used when decompressing, to ensure that the " "data has not been corrupted. Possible values are:" msgstr "" -#: ../../library/lzma.rst:161 +#: ../../library/lzma.rst:175 msgid "" ":const:`CHECK_NONE`: No integrity check. This is the default (and the only " "acceptable value) for :const:`FORMAT_ALONE` and :const:`FORMAT_RAW`." msgstr "" -#: ../../library/lzma.rst:165 +#: ../../library/lzma.rst:179 msgid ":const:`CHECK_CRC32`: 32-bit Cyclic Redundancy Check." msgstr "" -#: ../../library/lzma.rst:167 +#: ../../library/lzma.rst:181 msgid "" ":const:`CHECK_CRC64`: 64-bit Cyclic Redundancy Check. This is the default " "for :const:`FORMAT_XZ`." msgstr "" -#: ../../library/lzma.rst:170 +#: ../../library/lzma.rst:184 msgid ":const:`CHECK_SHA256`: 256-bit Secure Hash Algorithm." msgstr "" -#: ../../library/lzma.rst:172 +#: ../../library/lzma.rst:186 msgid "" "If the specified check is not supported, an :class:`LZMAError` is raised." msgstr "" -#: ../../library/lzma.rst:174 +#: ../../library/lzma.rst:188 msgid "" "The compression settings can be specified either as a preset compression " "level (with the *preset* argument), or in detail as a custom filter chain " "(with the *filters* argument)." msgstr "" -#: ../../library/lzma.rst:178 +#: ../../library/lzma.rst:192 msgid "" "The *preset* argument (if provided) should be an integer between ``0`` and " "``9`` (inclusive), optionally OR-ed with the constant :const:" @@ -278,7 +288,7 @@ msgid "" "presets produce smaller output, but make the compression process slower." msgstr "" -#: ../../library/lzma.rst:187 +#: ../../library/lzma.rst:201 msgid "" "In addition to being more CPU-intensive, compression with higher presets " "also requires much more memory (and produces output that needs more memory " @@ -287,13 +297,13 @@ msgid "" "generally best to stick with the default preset." msgstr "" -#: ../../library/lzma.rst:193 +#: ../../library/lzma.rst:207 msgid "" "The *filters* argument (if provided) should be a filter chain specifier. " "See :ref:`filter-chain-specs` for details." msgstr "" -#: ../../library/lzma.rst:198 +#: ../../library/lzma.rst:212 msgid "" "Compress *data* (a :class:`bytes` object), returning a :class:`bytes` object " "containing compressed data for at least part of the input. Some of *data* " @@ -302,29 +312,29 @@ msgid "" "any previous calls to :meth:`compress`." msgstr "" -#: ../../library/lzma.rst:206 +#: ../../library/lzma.rst:220 msgid "" "Finish the compression process, returning a :class:`bytes` object containing " "any data stored in the compressor's internal buffers." msgstr "" -#: ../../library/lzma.rst:209 +#: ../../library/lzma.rst:223 msgid "The compressor cannot be used after this method has been called." msgstr "" -#: ../../library/lzma.rst:214 +#: ../../library/lzma.rst:228 msgid "" "Create a decompressor object, which can be used to decompress data " "incrementally." msgstr "" -#: ../../library/lzma.rst:217 +#: ../../library/lzma.rst:231 msgid "" "For a more convenient way of decompressing an entire compressed stream at " "once, see :func:`decompress`." msgstr "" -#: ../../library/lzma.rst:220 +#: ../../library/lzma.rst:234 msgid "" "The *format* argument specifies the container format that should be used. " "The default is :const:`FORMAT_AUTO`, which can decompress both ``.xz`` and " @@ -332,7 +342,7 @@ msgid "" "`FORMAT_ALONE`, and :const:`FORMAT_RAW`." msgstr "" -#: ../../library/lzma.rst:225 +#: ../../library/lzma.rst:239 msgid "" "The *memlimit* argument specifies a limit (in bytes) on the amount of memory " "that the decompressor can use. When this argument is used, decompression " @@ -340,7 +350,7 @@ msgid "" "input within the given memory limit." msgstr "" -#: ../../library/lzma.rst:230 +#: ../../library/lzma.rst:244 msgid "" "The *filters* argument specifies the filter chain that was used to create " "the stream being decompressed. This argument is required if *format* is :" @@ -348,7 +358,7 @@ msgid "" "`filter-chain-specs` for more information about filter chains." msgstr "" -#: ../../library/lzma.rst:236 +#: ../../library/lzma.rst:250 msgid "" "This class does not transparently handle inputs containing multiple " "compressed streams, unlike :func:`decompress` and :class:`LZMAFile`. To " @@ -356,7 +366,7 @@ msgid "" "create a new decompressor for each stream." msgstr "" -#: ../../library/lzma.rst:243 +#: ../../library/lzma.rst:257 msgid "" "Decompress *data* (a :term:`bytes-like object`), returning uncompressed data " "as bytes. Some of *data* may be buffered internally, for use in later calls " @@ -364,7 +374,7 @@ msgid "" "output of any previous calls to :meth:`decompress`." msgstr "" -#: ../../library/lzma.rst:249 +#: ../../library/lzma.rst:263 msgid "" "If *max_length* is nonnegative, returns at most *max_length* bytes of " "decompressed data. If this limit is reached and further output can be " @@ -373,100 +383,100 @@ msgid "" "``b''`` to obtain more of the output." msgstr "" -#: ../../library/lzma.rst:256 +#: ../../library/lzma.rst:270 msgid "" "If all of the input data was decompressed and returned (either because this " "was less than *max_length* bytes, or because *max_length* was negative), " "the :attr:`~.needs_input` attribute will be set to ``True``." msgstr "" -#: ../../library/lzma.rst:261 +#: ../../library/lzma.rst:275 msgid "" "Attempting to decompress data after the end of stream is reached raises an :" "exc:`EOFError`. Any data found after the end of the stream is ignored and " "saved in the :attr:`~.unused_data` attribute." msgstr "" -#: ../../library/lzma.rst:265 +#: ../../library/lzma.rst:279 msgid "Added the *max_length* parameter." msgstr "新增 *max_length* 參數。" -#: ../../library/lzma.rst:270 +#: ../../library/lzma.rst:284 msgid "" "The ID of the integrity check used by the input stream. This may be :const:" "`CHECK_UNKNOWN` until enough of the input has been decoded to determine what " "integrity check it uses." msgstr "" -#: ../../library/lzma.rst:276 +#: ../../library/lzma.rst:290 msgid "``True`` if the end-of-stream marker has been reached." msgstr "" -#: ../../library/lzma.rst:280 +#: ../../library/lzma.rst:294 msgid "Data found after the end of the compressed stream." msgstr "" -#: ../../library/lzma.rst:282 +#: ../../library/lzma.rst:296 msgid "Before the end of the stream is reached, this will be ``b\"\"``." msgstr "" -#: ../../library/lzma.rst:286 +#: ../../library/lzma.rst:300 msgid "" "``False`` if the :meth:`.decompress` method can provide more decompressed " "data before requiring new uncompressed input." msgstr "" -#: ../../library/lzma.rst:293 +#: ../../library/lzma.rst:307 msgid "" "Compress *data* (a :class:`bytes` object), returning the compressed data as " "a :class:`bytes` object." msgstr "" -#: ../../library/lzma.rst:296 +#: ../../library/lzma.rst:310 msgid "" "See :class:`LZMACompressor` above for a description of the *format*, " "*check*, *preset* and *filters* arguments." msgstr "" -#: ../../library/lzma.rst:302 +#: ../../library/lzma.rst:316 msgid "" "Decompress *data* (a :class:`bytes` object), returning the uncompressed data " "as a :class:`bytes` object." msgstr "" -#: ../../library/lzma.rst:305 +#: ../../library/lzma.rst:319 msgid "" "If *data* is the concatenation of multiple distinct compressed streams, " "decompress all of these streams, and return the concatenation of the results." msgstr "" -#: ../../library/lzma.rst:308 +#: ../../library/lzma.rst:322 msgid "" "See :class:`LZMADecompressor` above for a description of the *format*, " "*memlimit* and *filters* arguments." msgstr "" -#: ../../library/lzma.rst:313 +#: ../../library/lzma.rst:327 msgid "Miscellaneous" msgstr "" -#: ../../library/lzma.rst:317 +#: ../../library/lzma.rst:331 msgid "" "Return ``True`` if the given integrity check is supported on this system." msgstr "" -#: ../../library/lzma.rst:319 +#: ../../library/lzma.rst:333 msgid "" ":const:`CHECK_NONE` and :const:`CHECK_CRC32` are always supported. :const:" "`CHECK_CRC64` and :const:`CHECK_SHA256` may be unavailable if you are using " "a version of :program:`liblzma` that was compiled with a limited feature set." msgstr "" -#: ../../library/lzma.rst:328 +#: ../../library/lzma.rst:342 msgid "Specifying custom filter chains" msgstr "" -#: ../../library/lzma.rst:330 +#: ../../library/lzma.rst:344 msgid "" "A filter chain specifier is a sequence of dictionaries, where each " "dictionary contains the ID and options for a single filter. Each dictionary " @@ -474,118 +484,118 @@ msgid "" "filter-dependent options. Valid filter IDs are as follows:" msgstr "" -#: ../../library/lzma.rst:335 +#: ../../library/lzma.rst:349 msgid "Compression filters:" msgstr "" -#: ../../library/lzma.rst:337 +#: ../../library/lzma.rst:351 msgid ":const:`FILTER_LZMA1` (for use with :const:`FORMAT_ALONE`)" msgstr "" -#: ../../library/lzma.rst:338 +#: ../../library/lzma.rst:352 msgid "" ":const:`FILTER_LZMA2` (for use with :const:`FORMAT_XZ` and :const:" "`FORMAT_RAW`)" msgstr "" -#: ../../library/lzma.rst:340 +#: ../../library/lzma.rst:354 msgid "Delta filter:" msgstr "" -#: ../../library/lzma.rst:342 +#: ../../library/lzma.rst:356 msgid ":const:`FILTER_DELTA`" msgstr ":const:`FILTER_DELTA`" -#: ../../library/lzma.rst:344 +#: ../../library/lzma.rst:358 msgid "Branch-Call-Jump (BCJ) filters:" msgstr "" -#: ../../library/lzma.rst:346 +#: ../../library/lzma.rst:360 msgid ":const:`FILTER_X86`" msgstr ":const:`FILTER_X86`" -#: ../../library/lzma.rst:347 +#: ../../library/lzma.rst:361 msgid ":const:`FILTER_IA64`" msgstr ":const:`FILTER_IA64`" -#: ../../library/lzma.rst:348 +#: ../../library/lzma.rst:362 msgid ":const:`FILTER_ARM`" msgstr ":const:`FILTER_ARM`" -#: ../../library/lzma.rst:349 +#: ../../library/lzma.rst:363 msgid ":const:`FILTER_ARMTHUMB`" msgstr ":const:`FILTER_ARMTHUMB`" -#: ../../library/lzma.rst:350 +#: ../../library/lzma.rst:364 msgid ":const:`FILTER_POWERPC`" msgstr ":const:`FILTER_POWERPC`" -#: ../../library/lzma.rst:351 +#: ../../library/lzma.rst:365 msgid ":const:`FILTER_SPARC`" msgstr ":const:`FILTER_SPARC`" -#: ../../library/lzma.rst:353 +#: ../../library/lzma.rst:367 msgid "" "A filter chain can consist of up to 4 filters, and cannot be empty. The last " "filter in the chain must be a compression filter, and any other filters must " "be delta or BCJ filters." msgstr "" -#: ../../library/lzma.rst:357 +#: ../../library/lzma.rst:371 msgid "" "Compression filters support the following options (specified as additional " "entries in the dictionary representing the filter):" msgstr "" -#: ../../library/lzma.rst:360 +#: ../../library/lzma.rst:374 msgid "" "``preset``: A compression preset to use as a source of default values for " "options that are not specified explicitly." msgstr "" -#: ../../library/lzma.rst:362 +#: ../../library/lzma.rst:376 msgid "" "``dict_size``: Dictionary size in bytes. This should be between 4 KiB and " "1.5 GiB (inclusive)." msgstr "" -#: ../../library/lzma.rst:364 +#: ../../library/lzma.rst:378 msgid "``lc``: Number of literal context bits." msgstr "" -#: ../../library/lzma.rst:365 +#: ../../library/lzma.rst:379 msgid "" "``lp``: Number of literal position bits. The sum ``lc + lp`` must be at most " "4." msgstr "" -#: ../../library/lzma.rst:367 +#: ../../library/lzma.rst:381 msgid "``pb``: Number of position bits; must be at most 4." msgstr "" -#: ../../library/lzma.rst:368 +#: ../../library/lzma.rst:382 msgid "``mode``: :const:`MODE_FAST` or :const:`MODE_NORMAL`." msgstr "" -#: ../../library/lzma.rst:369 +#: ../../library/lzma.rst:383 msgid "" "``nice_len``: What should be considered a \"nice length\" for a match. This " "should be 273 or less." msgstr "" -#: ../../library/lzma.rst:371 +#: ../../library/lzma.rst:385 msgid "" "``mf``: What match finder to use -- :const:`MF_HC3`, :const:`MF_HC4`, :const:" "`MF_BT2`, :const:`MF_BT3`, or :const:`MF_BT4`." msgstr "" -#: ../../library/lzma.rst:373 +#: ../../library/lzma.rst:387 msgid "" "``depth``: Maximum search depth used by match finder. 0 (default) means to " "select automatically based on other filter options." msgstr "" -#: ../../library/lzma.rst:376 +#: ../../library/lzma.rst:390 msgid "" "The delta filter stores the differences between bytes, producing more " "repetitive input for the compressor in certain circumstances. It supports " @@ -594,7 +604,7 @@ msgid "" "bytes." msgstr "" -#: ../../library/lzma.rst:381 +#: ../../library/lzma.rst:395 msgid "" "The BCJ filters are intended to be applied to machine code. They convert " "relative branches, calls and jumps in the code to use absolute addressing, " @@ -604,15 +614,15 @@ msgid "" "data. The default is 0." msgstr "" -#: ../../library/lzma.rst:389 +#: ../../library/lzma.rst:403 msgid "Examples" msgstr "範例" -#: ../../library/lzma.rst:391 +#: ../../library/lzma.rst:405 msgid "Reading in a compressed file::" msgstr "" -#: ../../library/lzma.rst:393 +#: ../../library/lzma.rst:407 msgid "" "import lzma\n" "with lzma.open(\"file.xz\") as f:\n" @@ -622,11 +632,11 @@ msgstr "" "with lzma.open(\"file.xz\") as f:\n" " file_content = f.read()" -#: ../../library/lzma.rst:397 +#: ../../library/lzma.rst:411 msgid "Creating a compressed file::" msgstr "" -#: ../../library/lzma.rst:399 +#: ../../library/lzma.rst:413 msgid "" "import lzma\n" "data = b\"Insert Data Here\"\n" @@ -634,11 +644,11 @@ msgid "" " f.write(data)" msgstr "" -#: ../../library/lzma.rst:404 +#: ../../library/lzma.rst:418 msgid "Compressing data in memory::" msgstr "" -#: ../../library/lzma.rst:406 +#: ../../library/lzma.rst:420 msgid "" "import lzma\n" "data_in = b\"Insert Data Here\"\n" @@ -648,11 +658,11 @@ msgstr "" "data_in = b\"Insert Data Here\"\n" "data_out = lzma.compress(data_in)" -#: ../../library/lzma.rst:410 +#: ../../library/lzma.rst:424 msgid "Incremental compression::" msgstr "" -#: ../../library/lzma.rst:412 +#: ../../library/lzma.rst:426 msgid "" "import lzma\n" "lzc = lzma.LZMACompressor()\n" @@ -664,11 +674,11 @@ msgid "" "result = b\"\".join([out1, out2, out3, out4])" msgstr "" -#: ../../library/lzma.rst:421 +#: ../../library/lzma.rst:435 msgid "Writing compressed data to an already-open file::" msgstr "" -#: ../../library/lzma.rst:423 +#: ../../library/lzma.rst:437 msgid "" "import lzma\n" "with open(\"file.xz\", \"wb\") as f:\n" @@ -684,11 +694,11 @@ msgstr "" " lzf.write(b\"This *will* be compressed\\n\")\n" " f.write(b\"Not compressed\\n\")" -#: ../../library/lzma.rst:430 +#: ../../library/lzma.rst:444 msgid "Creating a compressed file using a custom filter chain::" msgstr "" -#: ../../library/lzma.rst:432 +#: ../../library/lzma.rst:446 msgid "" "import lzma\n" "my_filters = [\n" diff --git a/library/mailbox.po b/library/mailbox.po index 76156c2730..5a8a09d14a 100644 --- a/library/mailbox.po +++ b/library/mailbox.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -417,49 +417,161 @@ msgid "The :attr:`!colon` attribute may also be set on a per-instance basis." msgstr "" #: ../../library/mailbox.rst:367 +msgid ":class:`Maildir` now ignores files with a leading dot." +msgstr "" + +#: ../../library/mailbox.rst:370 msgid "" ":class:`!Maildir` instances have all of the methods of :class:`Mailbox` in " "addition to the following:" msgstr "" -#: ../../library/mailbox.rst:373 ../../library/mailbox.rst:545 +#: ../../library/mailbox.rst:376 ../../library/mailbox.rst:654 msgid "Return a list of the names of all folders." msgstr "" -#: ../../library/mailbox.rst:378 +#: ../../library/mailbox.rst:381 msgid "" "Return a :class:`!Maildir` instance representing the folder whose name is " "*folder*. A :exc:`NoSuchMailboxError` exception is raised if the folder does " "not exist." msgstr "" -#: ../../library/mailbox.rst:385 +#: ../../library/mailbox.rst:388 msgid "" "Create a folder whose name is *folder* and return a :class:`!Maildir` " "instance representing it." msgstr "" -#: ../../library/mailbox.rst:391 ../../library/mailbox.rst:563 +#: ../../library/mailbox.rst:394 ../../library/mailbox.rst:672 msgid "" "Delete the folder whose name is *folder*. If the folder contains any " "messages, a :exc:`NotEmptyError` exception will be raised and the folder " "will not be deleted." msgstr "" -#: ../../library/mailbox.rst:398 +#: ../../library/mailbox.rst:401 msgid "" "Delete temporary files from the mailbox that have not been accessed in the " "last 36 hours. The Maildir specification says that mail-reading programs " "should do this occasionally." msgstr "" -#: ../../library/mailbox.rst:402 +#: ../../library/mailbox.rst:408 +msgid "" +"Return as a string the flags that are set on the message corresponding to " +"*key*. This is the same as ``get_message(key).get_flags()`` but much faster, " +"because it does not open the message file. Use this method when iterating " +"over the keys to determine which messages are interesting to get." +msgstr "" + +#: ../../library/mailbox.rst:415 +msgid "" +"If you do have a :class:`MaildirMessage` object, use its :meth:" +"`~MaildirMessage.get_flags` method instead, because changes made by the " +"message's :meth:`~MaildirMessage.set_flags`, :meth:`~MaildirMessage." +"add_flag` and :meth:`~MaildirMessage.remove_flag` methods are not reflected " +"here until the mailbox's :meth:`__setitem__` method is called." +msgstr "" + +#: ../../library/mailbox.rst:427 +msgid "" +"On the message corresponding to *key*, set the flags specified by *flags* " +"and unset all others. Calling ``some_mailbox.set_flags(key, flags)`` is " +"similar to ::" +msgstr "" + +#: ../../library/mailbox.rst:431 +msgid "" +"one_message = some_mailbox.get_message(key)\n" +"one_message.set_flags(flags)\n" +"some_mailbox[key] = one_message" +msgstr "" + +#: ../../library/mailbox.rst:435 ../../library/mailbox.rst:498 +msgid "but faster, because it does not open the message file." +msgstr "" + +#: ../../library/mailbox.rst:437 +msgid "" +"If you do have a :class:`MaildirMessage` object, use its :meth:" +"`~MaildirMessage.set_flags` method instead, because changes made with this " +"mailbox method will not be visible to the message object's method, :meth:" +"`~MaildirMessage.get_flags`." +msgstr "" + +#: ../../library/mailbox.rst:447 +msgid "" +"On the message corresponding to *key*, set the flags specified by *flag* " +"without changing other flags. To add more than one flag at a time, *flag* " +"may be a string of more than one character." +msgstr "" + +#: ../../library/mailbox.rst:451 +msgid "" +"Considerations for using this method versus the message object's :meth:" +"`~MaildirMessage.add_flag` method are similar to those for :meth:" +"`set_flags`; see the discussion there." +msgstr "" + +#: ../../library/mailbox.rst:460 +msgid "" +"On the message corresponding to *key*, unset the flags specified by *flag* " +"without changing other flags. To remove more than one flag at a time, *flag* " +"may be a string of more than one character." +msgstr "" + +#: ../../library/mailbox.rst:464 +msgid "" +"Considerations for using this method versus the message object's :meth:" +"`~MaildirMessage.remove_flag` method are similar to those for :meth:" +"`set_flags`; see the discussion there." +msgstr "" + +#: ../../library/mailbox.rst:473 +msgid "" +"Return a string containing the info for the message corresponding to *key*. " +"This is the same as ``get_message(key).get_info()`` but much faster, because " +"it does not open the message file. Use this method when iterating over the " +"keys to determine which messages are interesting to get." +msgstr "" + +#: ../../library/mailbox.rst:480 +msgid "" +"If you do have a :class:`MaildirMessage` object, use its :meth:" +"`~MaildirMessage.get_info` method instead, because changes made by the " +"message's :meth:`~MaildirMessage.set_info` method are not reflected here " +"until the mailbox's :meth:`__setitem__` method is called." +msgstr "" + +#: ../../library/mailbox.rst:491 +msgid "" +"Set the info of the message corresponding to *key* to *info*. Calling " +"``some_mailbox.set_info(key, flags)`` is similar to ::" +msgstr "" + +#: ../../library/mailbox.rst:494 +msgid "" +"one_message = some_mailbox.get_message(key)\n" +"one_message.set_info(info)\n" +"some_mailbox[key] = one_message" +msgstr "" + +#: ../../library/mailbox.rst:500 +msgid "" +"If you do have a :class:`MaildirMessage` object, use its :meth:" +"`~MaildirMessage.set_info` method instead, because changes made with this " +"mailbox method will not be visible to the message object's method, :meth:" +"`~MaildirMessage.get_info`." +msgstr "" + +#: ../../library/mailbox.rst:507 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!Maildir` deserve " "special remarks:" msgstr "" -#: ../../library/mailbox.rst:412 +#: ../../library/mailbox.rst:517 msgid "" "These methods generate unique file names based upon the current process ID. " "When using multiple threads, undetected name clashes may occur and cause " @@ -467,56 +579,56 @@ msgid "" "these methods to manipulate the same mailbox simultaneously." msgstr "" -#: ../../library/mailbox.rst:420 +#: ../../library/mailbox.rst:525 msgid "" "All changes to Maildir mailboxes are immediately applied, so this method " "does nothing." msgstr "" -#: ../../library/mailbox.rst:427 +#: ../../library/mailbox.rst:532 msgid "" "Maildir mailboxes do not support (or require) locking, so these methods do " "nothing." msgstr "" -#: ../../library/mailbox.rst:433 +#: ../../library/mailbox.rst:538 msgid "" ":class:`!Maildir` instances do not keep any open files and the underlying " "mailboxes do not support locking, so this method does nothing." msgstr "" -#: ../../library/mailbox.rst:439 +#: ../../library/mailbox.rst:544 msgid "" "Depending upon the host platform, it may not be possible to modify or remove " "the underlying message while the returned file remains open." msgstr "" -#: ../../library/mailbox.rst:445 +#: ../../library/mailbox.rst:550 msgid "" "`maildir man page from Courier `_" msgstr "" -#: ../../library/mailbox.rst:446 +#: ../../library/mailbox.rst:551 msgid "" "A specification of the format. Describes a common extension for supporting " "folders." msgstr "" -#: ../../library/mailbox.rst:449 +#: ../../library/mailbox.rst:554 msgid "`Using maildir format `_" msgstr "" -#: ../../library/mailbox.rst:450 +#: ../../library/mailbox.rst:555 msgid "" "Notes on Maildir by its inventor. Includes an updated name-creation scheme " "and details on \"info\" semantics." msgstr "" -#: ../../library/mailbox.rst:457 +#: ../../library/mailbox.rst:562 msgid ":class:`!mbox` objects" msgstr ":class:`!mbox` 物件" -#: ../../library/mailbox.rst:462 +#: ../../library/mailbox.rst:567 msgid "" "A subclass of :class:`Mailbox` for mailboxes in mbox format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -526,7 +638,7 @@ msgid "" "mailbox is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:469 +#: ../../library/mailbox.rst:574 msgid "" "The mbox format is the classic format for storing mail on Unix systems. All " "messages in an mbox mailbox are stored in a single file with the beginning " @@ -534,7 +646,7 @@ msgid "" "\"." msgstr "" -#: ../../library/mailbox.rst:473 +#: ../../library/mailbox.rst:578 msgid "" "Several variations of the mbox format exist to address perceived " "shortcomings in the original. In the interest of compatibility, :class:`!" @@ -546,61 +658,61 @@ msgid "" "when reading the message." msgstr "" -#: ../../library/mailbox.rst:481 +#: ../../library/mailbox.rst:586 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!mbox` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:487 +#: ../../library/mailbox.rst:592 msgid "" "Using the file after calling :meth:`~Mailbox.flush` or :meth:`~Mailbox." "close` on the :class:`!mbox` instance may yield unpredictable results or " "raise an exception." msgstr "" -#: ../../library/mailbox.rst:495 ../../library/mailbox.rst:704 -#: ../../library/mailbox.rst:755 +#: ../../library/mailbox.rst:600 ../../library/mailbox.rst:813 +#: ../../library/mailbox.rst:864 msgid "" "Three locking mechanisms are used---dot locking and, if available, the :c:" "func:`!flock` and :c:func:`!lockf` system calls." msgstr "" -#: ../../library/mailbox.rst:501 +#: ../../library/mailbox.rst:606 msgid "" "`mbox man page from tin `_" msgstr "" -#: ../../library/mailbox.rst:502 +#: ../../library/mailbox.rst:607 msgid "A specification of the format, with details on locking." msgstr "" -#: ../../library/mailbox.rst:504 +#: ../../library/mailbox.rst:609 msgid "" "`Configuring Netscape Mail on Unix: Why The Content-Length Format is Bad " "`_" msgstr "" -#: ../../library/mailbox.rst:505 +#: ../../library/mailbox.rst:610 msgid "An argument for using the original mbox format rather than a variation." msgstr "" -#: ../../library/mailbox.rst:507 +#: ../../library/mailbox.rst:612 msgid "" "`\"mbox\" is a family of several mutually incompatible mailbox formats " "`_" msgstr "" -#: ../../library/mailbox.rst:508 +#: ../../library/mailbox.rst:613 msgid "A history of mbox variations." msgstr "" -#: ../../library/mailbox.rst:514 +#: ../../library/mailbox.rst:619 msgid ":class:`!MH` objects" msgstr ":class:`!MH` 物件" -#: ../../library/mailbox.rst:519 +#: ../../library/mailbox.rst:624 msgid "" "A subclass of :class:`Mailbox` for mailboxes in MH format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -610,7 +722,7 @@ msgid "" "is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:526 +#: ../../library/mailbox.rst:631 msgid "" "MH is a directory-based mailbox format invented for the MH Message Handling " "System, a mail user agent. Each message in an MH mailbox resides in its own " @@ -621,7 +733,7 @@ msgid "" "called :file:`.mh_sequences` in each folder." msgstr "" -#: ../../library/mailbox.rst:534 +#: ../../library/mailbox.rst:639 msgid "" "The :class:`!MH` class manipulates MH mailboxes, but it does not attempt to " "emulate all of :program:`mh`'s behaviors. In particular, it does not modify " @@ -629,63 +741,67 @@ msgid "" "are used by :program:`mh` to store its state and configuration." msgstr "" -#: ../../library/mailbox.rst:539 +#: ../../library/mailbox.rst:644 msgid "" ":class:`!MH` instances have all of the methods of :class:`Mailbox` in " "addition to the following:" msgstr "" -#: ../../library/mailbox.rst:550 +#: ../../library/mailbox.rst:649 +msgid "Supported folders that don't contain a :file:`.mh_sequences` file." +msgstr "" + +#: ../../library/mailbox.rst:659 msgid "" "Return an :class:`!MH` instance representing the folder whose name is " "*folder*. A :exc:`NoSuchMailboxError` exception is raised if the folder does " "not exist." msgstr "" -#: ../../library/mailbox.rst:557 +#: ../../library/mailbox.rst:666 msgid "" "Create a folder whose name is *folder* and return an :class:`!MH` instance " "representing it." msgstr "" -#: ../../library/mailbox.rst:570 +#: ../../library/mailbox.rst:679 msgid "" "Return a dictionary of sequence names mapped to key lists. If there are no " "sequences, the empty dictionary is returned." msgstr "" -#: ../../library/mailbox.rst:576 +#: ../../library/mailbox.rst:685 msgid "" "Re-define the sequences that exist in the mailbox based upon *sequences*, a " "dictionary of names mapped to key lists, like returned by :meth:" "`get_sequences`." msgstr "" -#: ../../library/mailbox.rst:583 +#: ../../library/mailbox.rst:692 msgid "" "Rename messages in the mailbox as necessary to eliminate gaps in numbering. " "Entries in the sequences list are updated correspondingly." msgstr "" -#: ../../library/mailbox.rst:588 +#: ../../library/mailbox.rst:697 msgid "" "Already-issued keys are invalidated by this operation and should not be " "subsequently used." msgstr "" -#: ../../library/mailbox.rst:591 +#: ../../library/mailbox.rst:700 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!MH` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:599 +#: ../../library/mailbox.rst:708 msgid "" "These methods immediately delete the message. The MH convention of marking a " "message for deletion by prepending a comma to its name is not used." msgstr "" -#: ../../library/mailbox.rst:606 +#: ../../library/mailbox.rst:715 msgid "" "Three locking mechanisms are used---dot locking and, if available, the :c:" "func:`!flock` and :c:func:`!lockf` system calls. For MH mailboxes, locking " @@ -694,51 +810,51 @@ msgid "" "files." msgstr "" -#: ../../library/mailbox.rst:615 +#: ../../library/mailbox.rst:724 msgid "" "Depending upon the host platform, it may not be possible to remove the " "underlying message while the returned file remains open." msgstr "" -#: ../../library/mailbox.rst:621 +#: ../../library/mailbox.rst:730 msgid "" "All changes to MH mailboxes are immediately applied, so this method does " "nothing." msgstr "" -#: ../../library/mailbox.rst:627 +#: ../../library/mailbox.rst:736 msgid "" ":class:`!MH` instances do not keep any open files, so this method is " "equivalent to :meth:`unlock`." msgstr "" -#: ../../library/mailbox.rst:633 +#: ../../library/mailbox.rst:742 msgid "`nmh - Message Handling System `_" msgstr "" -#: ../../library/mailbox.rst:634 +#: ../../library/mailbox.rst:743 msgid "" "Home page of :program:`nmh`, an updated version of the original :program:" "`mh`." msgstr "" -#: ../../library/mailbox.rst:636 +#: ../../library/mailbox.rst:745 msgid "" "`MH & nmh: Email for Users & Programmers `_" msgstr "" -#: ../../library/mailbox.rst:637 +#: ../../library/mailbox.rst:746 msgid "" "A GPL-licensed book on :program:`mh` and :program:`nmh`, with some " "information on the mailbox format." msgstr "" -#: ../../library/mailbox.rst:644 +#: ../../library/mailbox.rst:753 msgid ":class:`!Babyl` objects" msgstr ":class:`!Babyl` 物件" -#: ../../library/mailbox.rst:649 +#: ../../library/mailbox.rst:758 msgid "" "A subclass of :class:`Mailbox` for mailboxes in Babyl format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -748,7 +864,7 @@ msgid "" "mailbox is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:656 +#: ../../library/mailbox.rst:765 msgid "" "Babyl is a single-file mailbox format used by the Rmail mail user agent " "included with Emacs. The beginning of a message is indicated by a line " @@ -758,7 +874,7 @@ msgid "" "Underscore (``'\\037'``) character." msgstr "" -#: ../../library/mailbox.rst:663 +#: ../../library/mailbox.rst:772 msgid "" "Messages in a Babyl mailbox have two sets of headers, original headers and " "so-called visible headers. Visible headers are typically a subset of the " @@ -769,31 +885,31 @@ msgid "" "in the Babyl options section." msgstr "" -#: ../../library/mailbox.rst:671 +#: ../../library/mailbox.rst:780 msgid "" ":class:`!Babyl` instances have all of the methods of :class:`Mailbox` in " "addition to the following:" msgstr "" -#: ../../library/mailbox.rst:677 +#: ../../library/mailbox.rst:786 msgid "" "Return a list of the names of all user-defined labels used in the mailbox." msgstr "" -#: ../../library/mailbox.rst:681 +#: ../../library/mailbox.rst:790 msgid "" "The actual messages are inspected to determine which labels exist in the " "mailbox rather than consulting the list of labels in the Babyl options " "section, but the Babyl section is updated whenever the mailbox is modified." msgstr "" -#: ../../library/mailbox.rst:686 +#: ../../library/mailbox.rst:795 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!Babyl` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:692 +#: ../../library/mailbox.rst:801 msgid "" "In Babyl mailboxes, the headers of a message are not stored contiguously " "with the body of the message. To generate a file-like representation, the " @@ -803,30 +919,30 @@ msgid "" "memory compared to a string representation." msgstr "" -#: ../../library/mailbox.rst:710 +#: ../../library/mailbox.rst:819 msgid "" "`Format of Version 5 Babyl Files `_" msgstr "" -#: ../../library/mailbox.rst:711 +#: ../../library/mailbox.rst:820 msgid "A specification of the Babyl format." msgstr "" -#: ../../library/mailbox.rst:713 +#: ../../library/mailbox.rst:822 msgid "" "`Reading Mail with Rmail `_" msgstr "" -#: ../../library/mailbox.rst:714 +#: ../../library/mailbox.rst:823 msgid "The Rmail manual, with some information on Babyl semantics." msgstr "" -#: ../../library/mailbox.rst:720 +#: ../../library/mailbox.rst:829 msgid ":class:`!MMDF` objects" msgstr ":class:`!MMDF` 物件" -#: ../../library/mailbox.rst:725 +#: ../../library/mailbox.rst:834 msgid "" "A subclass of :class:`Mailbox` for mailboxes in MMDF format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -836,7 +952,7 @@ msgid "" "mailbox is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:732 +#: ../../library/mailbox.rst:841 msgid "" "MMDF is a single-file mailbox format invented for the Multichannel " "Memorandum Distribution Facility, a mail transfer agent. Each message is in " @@ -849,52 +965,52 @@ msgid "" "subsequent messages." msgstr "" -#: ../../library/mailbox.rst:741 +#: ../../library/mailbox.rst:850 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!MMDF` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:747 +#: ../../library/mailbox.rst:856 msgid "" "Using the file after calling :meth:`~Mailbox.flush` or :meth:`~Mailbox." "close` on the :class:`!MMDF` instance may yield unpredictable results or " "raise an exception." msgstr "" -#: ../../library/mailbox.rst:761 +#: ../../library/mailbox.rst:870 msgid "" "`mmdf man page from tin `_" msgstr "" -#: ../../library/mailbox.rst:762 +#: ../../library/mailbox.rst:871 msgid "" "A specification of MMDF format from the documentation of tin, a newsreader." msgstr "" -#: ../../library/mailbox.rst:764 +#: ../../library/mailbox.rst:873 msgid "`MMDF `_" msgstr "`MMDF `_" -#: ../../library/mailbox.rst:765 +#: ../../library/mailbox.rst:874 msgid "" "A Wikipedia article describing the Multichannel Memorandum Distribution " "Facility." msgstr "" -#: ../../library/mailbox.rst:772 +#: ../../library/mailbox.rst:881 msgid ":class:`!Message` objects" msgstr ":class:`!Message` 物件" -#: ../../library/mailbox.rst:777 +#: ../../library/mailbox.rst:886 msgid "" "A subclass of the :mod:`email.message` module's :class:`~email.message." "Message`. Subclasses of :class:`!mailbox.Message` add mailbox-format-" "specific state and behavior." msgstr "" -#: ../../library/mailbox.rst:781 +#: ../../library/mailbox.rst:890 msgid "" "If *message* is omitted, the new instance is created in a default, empty " "state. If *message* is an :class:`email.message.Message` instance, its " @@ -906,7 +1022,7 @@ msgid "" "compatibility." msgstr "" -#: ../../library/mailbox.rst:790 +#: ../../library/mailbox.rst:899 msgid "" "The format-specific state and behaviors offered by subclasses vary, but in " "general it is only the properties that are not specific to a particular " @@ -918,7 +1034,7 @@ msgid "" "important is retained, because it applies to the message itself." msgstr "" -#: ../../library/mailbox.rst:799 +#: ../../library/mailbox.rst:908 msgid "" "There is no requirement that :class:`!Message` instances be used to " "represent messages retrieved using :class:`Mailbox` instances. In some " @@ -929,17 +1045,17 @@ msgid "" "initialized." msgstr "" -#: ../../library/mailbox.rst:810 +#: ../../library/mailbox.rst:919 msgid ":class:`!MaildirMessage` objects" msgstr ":class:`!MaildirMessage` 物件" -#: ../../library/mailbox.rst:815 +#: ../../library/mailbox.rst:924 msgid "" "A message with Maildir-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:818 +#: ../../library/mailbox.rst:927 msgid "" "Typically, a mail user agent application moves all of the messages in the :" "file:`new` subdirectory to the :file:`cur` subdirectory after the first time " @@ -953,128 +1069,128 @@ msgid "" "flags for Maildir messages are as follows:" msgstr "" -#: ../../library/mailbox.rst:830 ../../library/mailbox.rst:997 -#: ../../library/mailbox.rst:1368 +#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1106 +#: ../../library/mailbox.rst:1477 msgid "Flag" msgstr "" -#: ../../library/mailbox.rst:830 ../../library/mailbox.rst:997 -#: ../../library/mailbox.rst:1368 +#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1106 +#: ../../library/mailbox.rst:1477 msgid "Meaning" msgstr "含義" -#: ../../library/mailbox.rst:830 ../../library/mailbox.rst:997 -#: ../../library/mailbox.rst:1148 ../../library/mailbox.rst:1235 -#: ../../library/mailbox.rst:1368 +#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1106 +#: ../../library/mailbox.rst:1257 ../../library/mailbox.rst:1344 +#: ../../library/mailbox.rst:1477 msgid "Explanation" msgstr "" -#: ../../library/mailbox.rst:832 ../../library/mailbox.rst:1003 -#: ../../library/mailbox.rst:1374 +#: ../../library/mailbox.rst:941 ../../library/mailbox.rst:1112 +#: ../../library/mailbox.rst:1483 msgid "D" msgstr "D" -#: ../../library/mailbox.rst:832 +#: ../../library/mailbox.rst:941 msgid "Draft" msgstr "" -#: ../../library/mailbox.rst:832 +#: ../../library/mailbox.rst:941 msgid "Under composition" msgstr "" -#: ../../library/mailbox.rst:834 ../../library/mailbox.rst:1005 -#: ../../library/mailbox.rst:1376 +#: ../../library/mailbox.rst:943 ../../library/mailbox.rst:1114 +#: ../../library/mailbox.rst:1485 msgid "F" msgstr "F" -#: ../../library/mailbox.rst:834 ../../library/mailbox.rst:1005 -#: ../../library/mailbox.rst:1376 +#: ../../library/mailbox.rst:943 ../../library/mailbox.rst:1114 +#: ../../library/mailbox.rst:1485 msgid "Flagged" msgstr "" -#: ../../library/mailbox.rst:834 ../../library/mailbox.rst:1005 -#: ../../library/mailbox.rst:1154 ../../library/mailbox.rst:1376 +#: ../../library/mailbox.rst:943 ../../library/mailbox.rst:1114 +#: ../../library/mailbox.rst:1263 ../../library/mailbox.rst:1485 msgid "Marked as important" msgstr "" -#: ../../library/mailbox.rst:836 +#: ../../library/mailbox.rst:945 msgid "P" msgstr "P" -#: ../../library/mailbox.rst:836 +#: ../../library/mailbox.rst:945 msgid "Passed" msgstr "" -#: ../../library/mailbox.rst:836 +#: ../../library/mailbox.rst:945 msgid "Forwarded, resent, or bounced" msgstr "" -#: ../../library/mailbox.rst:838 ../../library/mailbox.rst:999 -#: ../../library/mailbox.rst:1370 +#: ../../library/mailbox.rst:947 ../../library/mailbox.rst:1108 +#: ../../library/mailbox.rst:1479 msgid "R" msgstr "R" -#: ../../library/mailbox.rst:838 +#: ../../library/mailbox.rst:947 msgid "Replied" msgstr "" -#: ../../library/mailbox.rst:838 ../../library/mailbox.rst:1007 -#: ../../library/mailbox.rst:1152 ../../library/mailbox.rst:1243 -#: ../../library/mailbox.rst:1378 +#: ../../library/mailbox.rst:947 ../../library/mailbox.rst:1116 +#: ../../library/mailbox.rst:1261 ../../library/mailbox.rst:1352 +#: ../../library/mailbox.rst:1487 msgid "Replied to" msgstr "" -#: ../../library/mailbox.rst:840 +#: ../../library/mailbox.rst:949 msgid "S" msgstr "S" -#: ../../library/mailbox.rst:840 +#: ../../library/mailbox.rst:949 msgid "Seen" msgstr "" -#: ../../library/mailbox.rst:840 ../../library/mailbox.rst:999 -#: ../../library/mailbox.rst:1370 +#: ../../library/mailbox.rst:949 ../../library/mailbox.rst:1108 +#: ../../library/mailbox.rst:1479 msgid "Read" msgstr "" -#: ../../library/mailbox.rst:842 +#: ../../library/mailbox.rst:951 msgid "T" msgstr "T" -#: ../../library/mailbox.rst:842 +#: ../../library/mailbox.rst:951 msgid "Trashed" msgstr "" -#: ../../library/mailbox.rst:842 ../../library/mailbox.rst:1003 -#: ../../library/mailbox.rst:1239 ../../library/mailbox.rst:1374 +#: ../../library/mailbox.rst:951 ../../library/mailbox.rst:1112 +#: ../../library/mailbox.rst:1348 ../../library/mailbox.rst:1483 msgid "Marked for subsequent deletion" msgstr "" -#: ../../library/mailbox.rst:845 +#: ../../library/mailbox.rst:954 msgid ":class:`!MaildirMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:850 +#: ../../library/mailbox.rst:959 msgid "" "Return either \"new\" (if the message should be stored in the :file:`new` " "subdirectory) or \"cur\" (if the message should be stored in the :file:`cur` " "subdirectory)." msgstr "" -#: ../../library/mailbox.rst:856 +#: ../../library/mailbox.rst:965 msgid "" "A message is typically moved from :file:`new` to :file:`cur` after its " -"mailbox has been accessed, whether or not the message is has been read. A " +"mailbox has been accessed, whether or not the message has been read. A " "message ``msg`` has been read if ``\"S\" in msg.get_flags()`` is ``True``." msgstr "" -#: ../../library/mailbox.rst:864 +#: ../../library/mailbox.rst:973 msgid "" "Set the subdirectory the message should be stored in. Parameter *subdir* " "must be either \"new\" or \"cur\"." msgstr "" -#: ../../library/mailbox.rst:870 +#: ../../library/mailbox.rst:979 msgid "" "Return a string specifying the flags that are currently set. If the message " "complies with the standard Maildir format, the result is the concatenation " @@ -1083,11 +1199,11 @@ msgid "" "flags are set or if \"info\" contains experimental semantics." msgstr "" -#: ../../library/mailbox.rst:880 +#: ../../library/mailbox.rst:989 msgid "Set the flags specified by *flags* and unset all others." msgstr "" -#: ../../library/mailbox.rst:885 +#: ../../library/mailbox.rst:994 msgid "" "Set the flag(s) specified by *flag* without changing other flags. To add " "more than one flag at a time, *flag* may be a string of more than one " @@ -1095,7 +1211,7 @@ msgid "" "experimental information rather than flags." msgstr "" -#: ../../library/mailbox.rst:893 +#: ../../library/mailbox.rst:1002 msgid "" "Unset the flag(s) specified by *flag* without changing other flags. To " "remove more than one flag at a time, *flag* maybe a string of more than one " @@ -1103,30 +1219,30 @@ msgid "" "the current \"info\" is not modified." msgstr "" -#: ../../library/mailbox.rst:901 +#: ../../library/mailbox.rst:1010 msgid "" "Return the delivery date of the message as a floating-point number " "representing seconds since the epoch." msgstr "" -#: ../../library/mailbox.rst:907 +#: ../../library/mailbox.rst:1016 msgid "" "Set the delivery date of the message to *date*, a floating-point number " "representing seconds since the epoch." msgstr "" -#: ../../library/mailbox.rst:913 +#: ../../library/mailbox.rst:1022 msgid "" "Return a string containing the \"info\" for a message. This is useful for " "accessing and modifying \"info\" that is experimental (i.e., not a list of " "flags)." msgstr "" -#: ../../library/mailbox.rst:920 +#: ../../library/mailbox.rst:1029 msgid "Set \"info\" to *info*, which should be a string." msgstr "" -#: ../../library/mailbox.rst:922 +#: ../../library/mailbox.rst:1031 msgid "" "When a :class:`!MaildirMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1134,176 +1250,176 @@ msgid "" "take place:" msgstr "" -#: ../../library/mailbox.rst:928 ../../library/mailbox.rst:946 -#: ../../library/mailbox.rst:961 ../../library/mailbox.rst:1068 -#: ../../library/mailbox.rst:1085 ../../library/mailbox.rst:1100 -#: ../../library/mailbox.rst:1116 ../../library/mailbox.rst:1183 -#: ../../library/mailbox.rst:1198 ../../library/mailbox.rst:1212 -#: ../../library/mailbox.rst:1309 ../../library/mailbox.rst:1326 -#: ../../library/mailbox.rst:1340 ../../library/mailbox.rst:1440 -#: ../../library/mailbox.rst:1457 ../../library/mailbox.rst:1472 -#: ../../library/mailbox.rst:1488 +#: ../../library/mailbox.rst:1037 ../../library/mailbox.rst:1055 +#: ../../library/mailbox.rst:1070 ../../library/mailbox.rst:1177 +#: ../../library/mailbox.rst:1194 ../../library/mailbox.rst:1209 +#: ../../library/mailbox.rst:1225 ../../library/mailbox.rst:1292 +#: ../../library/mailbox.rst:1307 ../../library/mailbox.rst:1321 +#: ../../library/mailbox.rst:1418 ../../library/mailbox.rst:1435 +#: ../../library/mailbox.rst:1449 ../../library/mailbox.rst:1549 +#: ../../library/mailbox.rst:1566 ../../library/mailbox.rst:1581 +#: ../../library/mailbox.rst:1597 msgid "Resulting state" msgstr "" -#: ../../library/mailbox.rst:928 ../../library/mailbox.rst:1198 -#: ../../library/mailbox.rst:1326 +#: ../../library/mailbox.rst:1037 ../../library/mailbox.rst:1307 +#: ../../library/mailbox.rst:1435 msgid ":class:`mboxMessage` or :class:`MMDFMessage` state" msgstr "" -#: ../../library/mailbox.rst:931 ../../library/mailbox.rst:948 -#: ../../library/mailbox.rst:963 ../../library/mailbox.rst:1072 -#: ../../library/mailbox.rst:1444 +#: ../../library/mailbox.rst:1040 ../../library/mailbox.rst:1057 +#: ../../library/mailbox.rst:1072 ../../library/mailbox.rst:1181 +#: ../../library/mailbox.rst:1553 msgid "\"cur\" subdirectory" msgstr "" -#: ../../library/mailbox.rst:931 ../../library/mailbox.rst:1072 -#: ../../library/mailbox.rst:1089 ../../library/mailbox.rst:1104 -#: ../../library/mailbox.rst:1120 ../../library/mailbox.rst:1444 -#: ../../library/mailbox.rst:1461 ../../library/mailbox.rst:1476 -#: ../../library/mailbox.rst:1492 +#: ../../library/mailbox.rst:1040 ../../library/mailbox.rst:1181 +#: ../../library/mailbox.rst:1198 ../../library/mailbox.rst:1213 +#: ../../library/mailbox.rst:1229 ../../library/mailbox.rst:1553 +#: ../../library/mailbox.rst:1570 ../../library/mailbox.rst:1585 +#: ../../library/mailbox.rst:1601 msgid "O flag" msgstr "" -#: ../../library/mailbox.rst:933 ../../library/mailbox.rst:952 -#: ../../library/mailbox.rst:1076 ../../library/mailbox.rst:1091 -#: ../../library/mailbox.rst:1124 ../../library/mailbox.rst:1189 -#: ../../library/mailbox.rst:1205 ../../library/mailbox.rst:1448 -#: ../../library/mailbox.rst:1463 ../../library/mailbox.rst:1496 +#: ../../library/mailbox.rst:1042 ../../library/mailbox.rst:1061 +#: ../../library/mailbox.rst:1185 ../../library/mailbox.rst:1200 +#: ../../library/mailbox.rst:1233 ../../library/mailbox.rst:1298 +#: ../../library/mailbox.rst:1314 ../../library/mailbox.rst:1557 +#: ../../library/mailbox.rst:1572 ../../library/mailbox.rst:1605 msgid "F flag" msgstr "" -#: ../../library/mailbox.rst:935 ../../library/mailbox.rst:937 -#: ../../library/mailbox.rst:954 ../../library/mailbox.rst:969 -#: ../../library/mailbox.rst:1070 ../../library/mailbox.rst:1078 -#: ../../library/mailbox.rst:1118 ../../library/mailbox.rst:1187 -#: ../../library/mailbox.rst:1315 ../../library/mailbox.rst:1442 -#: ../../library/mailbox.rst:1450 ../../library/mailbox.rst:1490 +#: ../../library/mailbox.rst:1044 ../../library/mailbox.rst:1046 +#: ../../library/mailbox.rst:1063 ../../library/mailbox.rst:1078 +#: ../../library/mailbox.rst:1179 ../../library/mailbox.rst:1187 +#: ../../library/mailbox.rst:1227 ../../library/mailbox.rst:1296 +#: ../../library/mailbox.rst:1424 ../../library/mailbox.rst:1551 +#: ../../library/mailbox.rst:1559 ../../library/mailbox.rst:1599 msgid "R flag" msgstr "" -#: ../../library/mailbox.rst:935 ../../library/mailbox.rst:1078 -#: ../../library/mailbox.rst:1093 ../../library/mailbox.rst:1108 -#: ../../library/mailbox.rst:1126 ../../library/mailbox.rst:1203 -#: ../../library/mailbox.rst:1333 ../../library/mailbox.rst:1450 -#: ../../library/mailbox.rst:1465 ../../library/mailbox.rst:1480 -#: ../../library/mailbox.rst:1498 +#: ../../library/mailbox.rst:1044 ../../library/mailbox.rst:1187 +#: ../../library/mailbox.rst:1202 ../../library/mailbox.rst:1217 +#: ../../library/mailbox.rst:1235 ../../library/mailbox.rst:1312 +#: ../../library/mailbox.rst:1442 ../../library/mailbox.rst:1559 +#: ../../library/mailbox.rst:1574 ../../library/mailbox.rst:1589 +#: ../../library/mailbox.rst:1607 msgid "A flag" msgstr "" -#: ../../library/mailbox.rst:937 ../../library/mailbox.rst:1070 -#: ../../library/mailbox.rst:1442 +#: ../../library/mailbox.rst:1046 ../../library/mailbox.rst:1179 +#: ../../library/mailbox.rst:1551 msgid "S flag" msgstr "" -#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:971 -#: ../../library/mailbox.rst:1074 ../../library/mailbox.rst:1313 -#: ../../library/mailbox.rst:1446 +#: ../../library/mailbox.rst:1048 ../../library/mailbox.rst:1080 +#: ../../library/mailbox.rst:1183 ../../library/mailbox.rst:1422 +#: ../../library/mailbox.rst:1555 msgid "T flag" msgstr "" -#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1074 -#: ../../library/mailbox.rst:1106 ../../library/mailbox.rst:1122 -#: ../../library/mailbox.rst:1331 ../../library/mailbox.rst:1446 -#: ../../library/mailbox.rst:1478 ../../library/mailbox.rst:1494 +#: ../../library/mailbox.rst:1048 ../../library/mailbox.rst:1183 +#: ../../library/mailbox.rst:1215 ../../library/mailbox.rst:1231 +#: ../../library/mailbox.rst:1440 ../../library/mailbox.rst:1555 +#: ../../library/mailbox.rst:1587 ../../library/mailbox.rst:1603 msgid "D flag" msgstr "" -#: ../../library/mailbox.rst:942 +#: ../../library/mailbox.rst:1051 msgid "" "When a :class:`!MaildirMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:946 ../../library/mailbox.rst:1085 -#: ../../library/mailbox.rst:1340 ../../library/mailbox.rst:1457 +#: ../../library/mailbox.rst:1055 ../../library/mailbox.rst:1194 +#: ../../library/mailbox.rst:1449 ../../library/mailbox.rst:1566 msgid ":class:`MHMessage` state" msgstr "" -#: ../../library/mailbox.rst:948 ../../library/mailbox.rst:1089 -#: ../../library/mailbox.rst:1185 ../../library/mailbox.rst:1201 -#: ../../library/mailbox.rst:1214 ../../library/mailbox.rst:1342 -#: ../../library/mailbox.rst:1461 +#: ../../library/mailbox.rst:1057 ../../library/mailbox.rst:1198 +#: ../../library/mailbox.rst:1294 ../../library/mailbox.rst:1310 +#: ../../library/mailbox.rst:1323 ../../library/mailbox.rst:1451 +#: ../../library/mailbox.rst:1570 msgid "\"unseen\" sequence" msgstr "" -#: ../../library/mailbox.rst:950 ../../library/mailbox.rst:965 +#: ../../library/mailbox.rst:1059 ../../library/mailbox.rst:1074 msgid "\"cur\" subdirectory and S flag" msgstr "" -#: ../../library/mailbox.rst:950 ../../library/mailbox.rst:1087 -#: ../../library/mailbox.rst:1459 +#: ../../library/mailbox.rst:1059 ../../library/mailbox.rst:1196 +#: ../../library/mailbox.rst:1568 msgid "no \"unseen\" sequence" msgstr "" -#: ../../library/mailbox.rst:952 ../../library/mailbox.rst:1091 -#: ../../library/mailbox.rst:1189 ../../library/mailbox.rst:1205 -#: ../../library/mailbox.rst:1463 +#: ../../library/mailbox.rst:1061 ../../library/mailbox.rst:1200 +#: ../../library/mailbox.rst:1298 ../../library/mailbox.rst:1314 +#: ../../library/mailbox.rst:1572 msgid "\"flagged\" sequence" msgstr "" -#: ../../library/mailbox.rst:954 ../../library/mailbox.rst:1093 -#: ../../library/mailbox.rst:1187 ../../library/mailbox.rst:1203 -#: ../../library/mailbox.rst:1216 ../../library/mailbox.rst:1344 -#: ../../library/mailbox.rst:1465 +#: ../../library/mailbox.rst:1063 ../../library/mailbox.rst:1202 +#: ../../library/mailbox.rst:1296 ../../library/mailbox.rst:1312 +#: ../../library/mailbox.rst:1325 ../../library/mailbox.rst:1453 +#: ../../library/mailbox.rst:1574 msgid "\"replied\" sequence" msgstr "" -#: ../../library/mailbox.rst:957 +#: ../../library/mailbox.rst:1066 msgid "" "When a :class:`!MaildirMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:961 ../../library/mailbox.rst:1100 -#: ../../library/mailbox.rst:1212 ../../library/mailbox.rst:1472 +#: ../../library/mailbox.rst:1070 ../../library/mailbox.rst:1209 +#: ../../library/mailbox.rst:1321 ../../library/mailbox.rst:1581 msgid ":class:`BabylMessage` state" msgstr "" -#: ../../library/mailbox.rst:963 ../../library/mailbox.rst:1104 -#: ../../library/mailbox.rst:1214 ../../library/mailbox.rst:1311 -#: ../../library/mailbox.rst:1329 ../../library/mailbox.rst:1342 -#: ../../library/mailbox.rst:1476 +#: ../../library/mailbox.rst:1072 ../../library/mailbox.rst:1213 +#: ../../library/mailbox.rst:1323 ../../library/mailbox.rst:1420 +#: ../../library/mailbox.rst:1438 ../../library/mailbox.rst:1451 +#: ../../library/mailbox.rst:1585 msgid "\"unseen\" label" msgstr "" -#: ../../library/mailbox.rst:965 ../../library/mailbox.rst:1102 -#: ../../library/mailbox.rst:1474 +#: ../../library/mailbox.rst:1074 ../../library/mailbox.rst:1211 +#: ../../library/mailbox.rst:1583 msgid "no \"unseen\" label" msgstr "" -#: ../../library/mailbox.rst:967 ../../library/mailbox.rst:1317 +#: ../../library/mailbox.rst:1076 ../../library/mailbox.rst:1426 msgid "P flag" msgstr "" -#: ../../library/mailbox.rst:967 +#: ../../library/mailbox.rst:1076 msgid "\"forwarded\" or \"resent\" label" msgstr "" -#: ../../library/mailbox.rst:969 ../../library/mailbox.rst:1108 -#: ../../library/mailbox.rst:1216 ../../library/mailbox.rst:1315 -#: ../../library/mailbox.rst:1333 ../../library/mailbox.rst:1344 -#: ../../library/mailbox.rst:1480 +#: ../../library/mailbox.rst:1078 ../../library/mailbox.rst:1217 +#: ../../library/mailbox.rst:1325 ../../library/mailbox.rst:1424 +#: ../../library/mailbox.rst:1442 ../../library/mailbox.rst:1453 +#: ../../library/mailbox.rst:1589 msgid "\"answered\" label" msgstr "" -#: ../../library/mailbox.rst:971 ../../library/mailbox.rst:1106 -#: ../../library/mailbox.rst:1313 ../../library/mailbox.rst:1331 -#: ../../library/mailbox.rst:1478 +#: ../../library/mailbox.rst:1080 ../../library/mailbox.rst:1215 +#: ../../library/mailbox.rst:1422 ../../library/mailbox.rst:1440 +#: ../../library/mailbox.rst:1587 msgid "\"deleted\" label" msgstr "" -#: ../../library/mailbox.rst:978 +#: ../../library/mailbox.rst:1087 msgid ":class:`!mboxMessage` objects" msgstr ":class:`!mboxMessage` 物件" -#: ../../library/mailbox.rst:983 +#: ../../library/mailbox.rst:1092 msgid "" "A message with mbox-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:986 +#: ../../library/mailbox.rst:1095 msgid "" "Messages in an mbox mailbox are stored together in a single file. The " "sender's envelope address and the time of delivery are typically stored in a " @@ -1314,53 +1430,53 @@ msgid "" "typically stored in :mailheader:`Status` and :mailheader:`X-Status` headers." msgstr "" -#: ../../library/mailbox.rst:994 +#: ../../library/mailbox.rst:1103 msgid "Conventional flags for mbox messages are as follows:" msgstr "" -#: ../../library/mailbox.rst:1001 ../../library/mailbox.rst:1372 +#: ../../library/mailbox.rst:1110 ../../library/mailbox.rst:1481 msgid "O" msgstr "O" -#: ../../library/mailbox.rst:1001 ../../library/mailbox.rst:1372 +#: ../../library/mailbox.rst:1110 ../../library/mailbox.rst:1481 msgid "Old" msgstr "" -#: ../../library/mailbox.rst:1001 ../../library/mailbox.rst:1372 +#: ../../library/mailbox.rst:1110 ../../library/mailbox.rst:1481 msgid "Previously detected by MUA" msgstr "" -#: ../../library/mailbox.rst:1003 ../../library/mailbox.rst:1374 +#: ../../library/mailbox.rst:1112 ../../library/mailbox.rst:1483 msgid "Deleted" msgstr "" -#: ../../library/mailbox.rst:1007 ../../library/mailbox.rst:1378 +#: ../../library/mailbox.rst:1116 ../../library/mailbox.rst:1487 msgid "A" msgstr "A" -#: ../../library/mailbox.rst:1007 ../../library/mailbox.rst:1378 +#: ../../library/mailbox.rst:1116 ../../library/mailbox.rst:1487 msgid "Answered" msgstr "" -#: ../../library/mailbox.rst:1010 ../../library/mailbox.rst:1381 +#: ../../library/mailbox.rst:1119 ../../library/mailbox.rst:1490 msgid "" "The \"R\" and \"O\" flags are stored in the :mailheader:`Status` header, and " "the \"D\", \"F\", and \"A\" flags are stored in the :mailheader:`X-Status` " "header. The flags and headers typically appear in the order mentioned." msgstr "" -#: ../../library/mailbox.rst:1014 +#: ../../library/mailbox.rst:1123 msgid ":class:`!mboxMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:1019 ../../library/mailbox.rst:1391 +#: ../../library/mailbox.rst:1128 ../../library/mailbox.rst:1500 msgid "" "Return a string representing the \"From \" line that marks the start of the " "message in an mbox mailbox. The leading \"From \" and the trailing newline " "are excluded." msgstr "" -#: ../../library/mailbox.rst:1026 ../../library/mailbox.rst:1398 +#: ../../library/mailbox.rst:1135 ../../library/mailbox.rst:1507 msgid "" "Set the \"From \" line to *from_*, which should be specified without a " "leading \"From \" or trailing newline. For convenience, *time_* may be " @@ -1370,7 +1486,7 @@ msgid "" "func:`time.gmtime`)." msgstr "" -#: ../../library/mailbox.rst:1036 ../../library/mailbox.rst:1408 +#: ../../library/mailbox.rst:1145 ../../library/mailbox.rst:1517 msgid "" "Return a string specifying the flags that are currently set. If the message " "complies with the conventional format, the result is the concatenation in " @@ -1378,28 +1494,28 @@ msgid "" "``'D'``, ``'F'``, and ``'A'``." msgstr "" -#: ../../library/mailbox.rst:1044 ../../library/mailbox.rst:1416 +#: ../../library/mailbox.rst:1153 ../../library/mailbox.rst:1525 msgid "" "Set the flags specified by *flags* and unset all others. Parameter *flags* " "should be the concatenation in any order of zero or more occurrences of each " "of ``'R'``, ``'O'``, ``'D'``, ``'F'``, and ``'A'``." msgstr "" -#: ../../library/mailbox.rst:1051 ../../library/mailbox.rst:1423 +#: ../../library/mailbox.rst:1160 ../../library/mailbox.rst:1532 msgid "" "Set the flag(s) specified by *flag* without changing other flags. To add " "more than one flag at a time, *flag* may be a string of more than one " "character." msgstr "" -#: ../../library/mailbox.rst:1058 ../../library/mailbox.rst:1430 +#: ../../library/mailbox.rst:1167 ../../library/mailbox.rst:1539 msgid "" "Unset the flag(s) specified by *flag* without changing other flags. To " "remove more than one flag at a time, *flag* maybe a string of more than one " "character." msgstr "" -#: ../../library/mailbox.rst:1062 +#: ../../library/mailbox.rst:1171 msgid "" "When an :class:`!mboxMessage` instance is created based upon a :class:" "`MaildirMessage` instance, a \"From \" line is generated based upon the :" @@ -1407,50 +1523,50 @@ msgid "" "conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1068 ../../library/mailbox.rst:1183 -#: ../../library/mailbox.rst:1309 ../../library/mailbox.rst:1440 +#: ../../library/mailbox.rst:1177 ../../library/mailbox.rst:1292 +#: ../../library/mailbox.rst:1418 ../../library/mailbox.rst:1549 msgid ":class:`MaildirMessage` state" msgstr "" -#: ../../library/mailbox.rst:1081 +#: ../../library/mailbox.rst:1190 msgid "" "When an :class:`!mboxMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1087 ../../library/mailbox.rst:1102 -#: ../../library/mailbox.rst:1459 ../../library/mailbox.rst:1474 +#: ../../library/mailbox.rst:1196 ../../library/mailbox.rst:1211 +#: ../../library/mailbox.rst:1568 ../../library/mailbox.rst:1583 msgid "R flag and O flag" msgstr "" -#: ../../library/mailbox.rst:1096 +#: ../../library/mailbox.rst:1205 msgid "" "When an :class:`!mboxMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1111 +#: ../../library/mailbox.rst:1220 msgid "" "When a :class:`!mboxMessage` instance is created based upon an :class:" "`MMDFMessage` instance, the \"From \" line is copied and all flags directly " "correspond:" msgstr "" -#: ../../library/mailbox.rst:1116 +#: ../../library/mailbox.rst:1225 msgid ":class:`MMDFMessage` state" msgstr "" -#: ../../library/mailbox.rst:1133 +#: ../../library/mailbox.rst:1242 msgid ":class:`!MHMessage` objects" msgstr ":class:`!MHMessage` 物件" -#: ../../library/mailbox.rst:1138 +#: ../../library/mailbox.rst:1247 msgid "" "A message with MH-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1141 +#: ../../library/mailbox.rst:1250 msgid "" "MH messages do not support marks or flags in the traditional sense, but they " "do support sequences, which are logical groupings of arbitrary messages. " @@ -1459,57 +1575,57 @@ msgid "" "formats, as follows:" msgstr "" -#: ../../library/mailbox.rst:1148 +#: ../../library/mailbox.rst:1257 msgid "Sequence" msgstr "" -#: ../../library/mailbox.rst:1150 ../../library/mailbox.rst:1237 +#: ../../library/mailbox.rst:1259 ../../library/mailbox.rst:1346 msgid "unseen" msgstr "" -#: ../../library/mailbox.rst:1150 ../../library/mailbox.rst:1237 +#: ../../library/mailbox.rst:1259 ../../library/mailbox.rst:1346 msgid "Not read, but previously detected by MUA" msgstr "" -#: ../../library/mailbox.rst:1152 +#: ../../library/mailbox.rst:1261 msgid "replied" msgstr "" -#: ../../library/mailbox.rst:1154 +#: ../../library/mailbox.rst:1263 msgid "flagged" msgstr "" -#: ../../library/mailbox.rst:1157 +#: ../../library/mailbox.rst:1266 msgid ":class:`!MHMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:1162 +#: ../../library/mailbox.rst:1271 msgid "Return a list of the names of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1167 +#: ../../library/mailbox.rst:1276 msgid "Set the list of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1172 +#: ../../library/mailbox.rst:1281 msgid "Add *sequence* to the list of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1177 +#: ../../library/mailbox.rst:1286 msgid "Remove *sequence* from the list of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1179 +#: ../../library/mailbox.rst:1288 msgid "" "When an :class:`!MHMessage` instance is created based upon a :class:" "`MaildirMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1185 ../../library/mailbox.rst:1311 +#: ../../library/mailbox.rst:1294 ../../library/mailbox.rst:1420 msgid "no S flag" msgstr "" -#: ../../library/mailbox.rst:1192 +#: ../../library/mailbox.rst:1301 msgid "" "When an :class:`!MHMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1517,110 +1633,110 @@ msgid "" "take place:" msgstr "" -#: ../../library/mailbox.rst:1201 ../../library/mailbox.rst:1329 +#: ../../library/mailbox.rst:1310 ../../library/mailbox.rst:1438 msgid "no R flag" msgstr "" -#: ../../library/mailbox.rst:1208 +#: ../../library/mailbox.rst:1317 msgid "" "When an :class:`!MHMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1223 +#: ../../library/mailbox.rst:1332 msgid ":class:`!BabylMessage` objects" msgstr ":class:`!BabylMessage` 物件" -#: ../../library/mailbox.rst:1228 +#: ../../library/mailbox.rst:1337 msgid "" "A message with Babyl-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1231 +#: ../../library/mailbox.rst:1340 msgid "" "Certain message labels, called :dfn:`attributes`, are defined by convention " "to have special meanings. The attributes are as follows:" msgstr "" -#: ../../library/mailbox.rst:1235 +#: ../../library/mailbox.rst:1344 msgid "Label" msgstr "" -#: ../../library/mailbox.rst:1239 +#: ../../library/mailbox.rst:1348 msgid "deleted" msgstr "" -#: ../../library/mailbox.rst:1241 +#: ../../library/mailbox.rst:1350 msgid "filed" msgstr "" -#: ../../library/mailbox.rst:1241 +#: ../../library/mailbox.rst:1350 msgid "Copied to another file or mailbox" msgstr "" -#: ../../library/mailbox.rst:1243 +#: ../../library/mailbox.rst:1352 msgid "answered" msgstr "" -#: ../../library/mailbox.rst:1245 +#: ../../library/mailbox.rst:1354 msgid "forwarded" msgstr "" -#: ../../library/mailbox.rst:1245 +#: ../../library/mailbox.rst:1354 msgid "Forwarded" msgstr "" -#: ../../library/mailbox.rst:1247 +#: ../../library/mailbox.rst:1356 msgid "edited" msgstr "" -#: ../../library/mailbox.rst:1247 +#: ../../library/mailbox.rst:1356 msgid "Modified by the user" msgstr "" -#: ../../library/mailbox.rst:1249 +#: ../../library/mailbox.rst:1358 msgid "resent" msgstr "" -#: ../../library/mailbox.rst:1249 +#: ../../library/mailbox.rst:1358 msgid "Resent" msgstr "" -#: ../../library/mailbox.rst:1252 +#: ../../library/mailbox.rst:1361 msgid "" "By default, Rmail displays only visible headers. The :class:`!BabylMessage` " "class, though, uses the original headers because they are more complete. " "Visible headers may be accessed explicitly if desired." msgstr "" -#: ../../library/mailbox.rst:1256 +#: ../../library/mailbox.rst:1365 msgid ":class:`!BabylMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:1261 +#: ../../library/mailbox.rst:1370 msgid "Return a list of labels on the message." msgstr "" -#: ../../library/mailbox.rst:1266 +#: ../../library/mailbox.rst:1375 msgid "Set the list of labels on the message to *labels*." msgstr "" -#: ../../library/mailbox.rst:1271 +#: ../../library/mailbox.rst:1380 msgid "Add *label* to the list of labels on the message." msgstr "" -#: ../../library/mailbox.rst:1276 +#: ../../library/mailbox.rst:1385 msgid "Remove *label* from the list of labels on the message." msgstr "" -#: ../../library/mailbox.rst:1281 +#: ../../library/mailbox.rst:1390 msgid "" "Return a :class:`Message` instance whose headers are the message's visible " "headers and whose body is empty." msgstr "" -#: ../../library/mailbox.rst:1287 +#: ../../library/mailbox.rst:1396 msgid "" "Set the message's visible headers to be the same as the headers in " "*message*. Parameter *visible* should be a :class:`Message` instance, an :" @@ -1628,7 +1744,7 @@ msgid "" "(which should be open in text mode)." msgstr "" -#: ../../library/mailbox.rst:1295 +#: ../../library/mailbox.rst:1404 msgid "" "When a :class:`!BabylMessage` instance's original headers are modified, the " "visible headers are not automatically modified to correspond. This method " @@ -1641,17 +1757,17 @@ msgid "" "visible headers." msgstr "" -#: ../../library/mailbox.rst:1305 +#: ../../library/mailbox.rst:1414 msgid "" "When a :class:`!BabylMessage` instance is created based upon a :class:" "`MaildirMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1317 +#: ../../library/mailbox.rst:1426 msgid "\"forwarded\" label" msgstr "" -#: ../../library/mailbox.rst:1320 +#: ../../library/mailbox.rst:1429 msgid "" "When a :class:`!BabylMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1659,23 +1775,23 @@ msgid "" "take place:" msgstr "" -#: ../../library/mailbox.rst:1336 +#: ../../library/mailbox.rst:1445 msgid "" "When a :class:`!BabylMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1351 +#: ../../library/mailbox.rst:1460 msgid ":class:`!MMDFMessage` objects" msgstr ":class:`!MMDFMessage` 物件" -#: ../../library/mailbox.rst:1356 +#: ../../library/mailbox.rst:1465 msgid "" "A message with MMDF-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1359 +#: ../../library/mailbox.rst:1468 msgid "" "As with message in an mbox mailbox, MMDF messages are stored with the " "sender's address and the delivery date in an initial line beginning with " @@ -1683,19 +1799,19 @@ msgid "" "typically stored in :mailheader:`Status` and :mailheader:`X-Status` headers." msgstr "" -#: ../../library/mailbox.rst:1364 +#: ../../library/mailbox.rst:1473 msgid "" "Conventional flags for MMDF messages are identical to those of mbox message " "and are as follows:" msgstr "" -#: ../../library/mailbox.rst:1385 +#: ../../library/mailbox.rst:1494 msgid "" ":class:`!MMDFMessage` instances offer the following methods, which are " "identical to those offered by :class:`mboxMessage`:" msgstr "" -#: ../../library/mailbox.rst:1434 +#: ../../library/mailbox.rst:1543 msgid "" "When an :class:`!MMDFMessage` instance is created based upon a :class:" "`MaildirMessage` instance, a \"From \" line is generated based upon the :" @@ -1703,43 +1819,43 @@ msgid "" "conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1453 +#: ../../library/mailbox.rst:1562 msgid "" "When an :class:`!MMDFMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1468 +#: ../../library/mailbox.rst:1577 msgid "" "When an :class:`!MMDFMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1483 +#: ../../library/mailbox.rst:1592 msgid "" "When an :class:`!MMDFMessage` instance is created based upon an :class:" "`mboxMessage` instance, the \"From \" line is copied and all flags directly " "correspond:" msgstr "" -#: ../../library/mailbox.rst:1488 +#: ../../library/mailbox.rst:1597 msgid ":class:`mboxMessage` state" msgstr "" -#: ../../library/mailbox.rst:1503 +#: ../../library/mailbox.rst:1612 msgid "Exceptions" msgstr "例外" -#: ../../library/mailbox.rst:1505 +#: ../../library/mailbox.rst:1614 msgid "" "The following exception classes are defined in the :mod:`!mailbox` module:" msgstr "" -#: ../../library/mailbox.rst:1510 +#: ../../library/mailbox.rst:1619 msgid "The based class for all other module-specific exceptions." msgstr "" -#: ../../library/mailbox.rst:1515 +#: ../../library/mailbox.rst:1624 msgid "" "Raised when a mailbox is expected but is not found, such as when " "instantiating a :class:`Mailbox` subclass with a path that does not exist " @@ -1747,13 +1863,13 @@ msgid "" "that does not exist." msgstr "" -#: ../../library/mailbox.rst:1522 +#: ../../library/mailbox.rst:1631 msgid "" "Raised when a mailbox is not empty but is expected to be, such as when " "deleting a folder that contains messages." msgstr "" -#: ../../library/mailbox.rst:1528 +#: ../../library/mailbox.rst:1637 msgid "" "Raised when some mailbox-related condition beyond the control of the program " "causes it to be unable to proceed, such as when failing to acquire a lock " @@ -1761,23 +1877,23 @@ msgid "" "name already exists." msgstr "" -#: ../../library/mailbox.rst:1536 +#: ../../library/mailbox.rst:1645 msgid "" "Raised when the data in a file cannot be parsed, such as when an :class:`MH` " "instance attempts to read a corrupted :file:`.mh_sequences` file." msgstr "" -#: ../../library/mailbox.rst:1543 +#: ../../library/mailbox.rst:1652 msgid "Examples" msgstr "範例" -#: ../../library/mailbox.rst:1545 +#: ../../library/mailbox.rst:1654 msgid "" "A simple example of printing the subjects of all messages in a mailbox that " "seem interesting::" msgstr "" -#: ../../library/mailbox.rst:1548 +#: ../../library/mailbox.rst:1657 msgid "" "import mailbox\n" "for message in mailbox.mbox('~/mbox'):\n" @@ -1791,13 +1907,13 @@ msgstr "" " if subject and 'python' in subject.lower():\n" " print(subject)" -#: ../../library/mailbox.rst:1554 +#: ../../library/mailbox.rst:1663 msgid "" "To copy all mail from a Babyl mailbox to an MH mailbox, converting all of " "the format-specific information that can be converted::" msgstr "" -#: ../../library/mailbox.rst:1557 +#: ../../library/mailbox.rst:1666 msgid "" "import mailbox\n" "destination = mailbox.MH('~/Mail')\n" @@ -1815,7 +1931,7 @@ msgstr "" "destination.flush()\n" "destination.unlock()" -#: ../../library/mailbox.rst:1565 +#: ../../library/mailbox.rst:1674 msgid "" "This example sorts mail from several mailing lists into different mailboxes, " "being careful to avoid mail corruption due to concurrent modification by " @@ -1823,7 +1939,7 @@ msgid "" "termination due to malformed messages in the mailbox::" msgstr "" -#: ../../library/mailbox.rst:1570 +#: ../../library/mailbox.rst:1679 msgid "" "import mailbox\n" "import email.errors\n" diff --git a/library/marshal.po b/library/marshal.po index 73bcfc85e3..472d892438 100644 --- a/library/marshal.po +++ b/library/marshal.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-04 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-04-24 21:28+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -40,17 +40,20 @@ msgstr "" "的;它可能在不同 Python 版本中被改變(雖然這種情況極少發生)。[#]_" #: ../../library/marshal.rst:21 +#, fuzzy msgid "" "This is not a general \"persistence\" module. For general persistence and " "transfer of Python objects through RPC calls, see the modules :mod:`pickle` " "and :mod:`shelve`. The :mod:`marshal` module exists mainly to support " "reading and writing the \"pseudo-compiled\" code for Python modules of :file:" "`.pyc` files. Therefore, the Python maintainers reserve the right to modify " -"the marshal format in backward incompatible ways should the need arise. If " -"you're serializing and de-serializing Python objects, use the :mod:`pickle` " -"module instead -- the performance is comparable, version independence is " -"guaranteed, and pickle supports a substantially wider range of objects than " -"marshal." +"the marshal format in backward incompatible ways should the need arise. The " +"format of code objects is not compatible between Python versions, even if " +"the version of the format is the same. De-serializing a code object in the " +"incorrect Python version has undefined behavior. If you're serializing and " +"de-serializing Python objects, use the :mod:`pickle` module instead -- the " +"performance is comparable, version independence is guaranteed, and pickle " +"supports a substantially wider range of objects than marshal." msgstr "" "這不是一個通用「持續性 (persistence)」module 。關於通用持續性以及透過 RPC 呼" "叫傳遞 Python 物件,請參閱 :mod:`pickle` 和 :mod:`shelve` 等 module 。:mod:" @@ -60,7 +63,7 @@ msgstr "" "`pickle` module -- 其執行效率相當、有保證版本獨立性,且實質上 pickle 還支援" "比 marshal 更多樣的物件。" -#: ../../library/marshal.rst:33 +#: ../../library/marshal.rst:37 msgid "" "The :mod:`marshal` module is not intended to be secure against erroneous or " "maliciously constructed data. Never unmarshal data received from an " @@ -69,19 +72,20 @@ msgstr "" ":mod:`marshal` module 對於錯誤或惡意構建的資料來說是不安全的。永遠不要 " "unmarshal 來自不受信任的或來源未經驗證的資料。" -#: ../../library/marshal.rst:39 +#: ../../library/marshal.rst:43 +#, fuzzy msgid "" "Not all Python object types are supported; in general, only objects whose " "value is independent from a particular invocation of Python can be written " "and read by this module. The following types are supported: booleans, " "integers, floating-point numbers, complex numbers, strings, bytes, " -"bytearrays, tuples, lists, sets, frozensets, dictionaries, and code objects, " -"where it should be understood that tuples, lists, sets, frozensets and " -"dictionaries are only supported as long as the values contained therein are " -"themselves supported. The singletons :const:`None`, :const:`Ellipsis` and :" -"exc:`StopIteration` can also be marshalled and unmarshalled. For format " -"*version* lower than 3, recursive lists, sets and dictionaries cannot be " -"written (see below)." +"bytearrays, tuples, lists, sets, frozensets, dictionaries, and code objects " +"(if *allow_code* is true), where it should be understood that tuples, lists, " +"sets, frozensets and dictionaries are only supported as long as the values " +"contained therein are themselves supported. The singletons :const:`None`, :" +"const:`Ellipsis` and :exc:`StopIteration` can also be marshalled and " +"unmarshalled. For format *version* lower than 3, recursive lists, sets and " +"dictionaries cannot be written (see below)." msgstr "" "不是所有 Python 物件型別都有支援;一般來說,此 module 只能寫入和讀取不依賴於" "特定 Python 調用 (invocation) 的物件。下列型別是有支援的:布林 (boolean)、整" @@ -93,18 +97,18 @@ msgstr "" "unmarshal。對於 *version* 低於 3 的格式,遞迴 list、集合和 dictionary 無法被" "寫入(見下文)。" -#: ../../library/marshal.rst:51 +#: ../../library/marshal.rst:56 msgid "" "There are functions that read/write files as well as functions operating on " "bytes-like objects." msgstr "" "有些函式可以讀/寫檔案,還有些函式可以操作類位元組串物件 (bytes-like object)。" -#: ../../library/marshal.rst:54 +#: ../../library/marshal.rst:59 msgid "The module defines these functions:" msgstr "這個 module 定義了以下函式:" -#: ../../library/marshal.rst:59 +#: ../../library/marshal.rst:64 msgid "" "Write the value on the open file. The value must be a supported type. The " "file must be a writeable :term:`binary file`." @@ -112,24 +116,26 @@ msgstr "" "將值寫入被開啟的檔案。值必須為受支援的型別,檔案必須為可寫入的 :term:`binary " "file`。" -#: ../../library/marshal.rst:62 +#: ../../library/marshal.rst:67 +#, fuzzy msgid "" "If the value has (or contains an object that has) an unsupported type, a :" "exc:`ValueError` exception is raised --- but garbage data will also be " "written to the file. The object will not be properly read back by :func:" -"`load`." +"`load`. :ref:`Code objects ` are only supported if " +"*allow_code* is true." msgstr "" "如果值具有(或其所包含的物件具有)不支援的型別,則會引發 :exc:`ValueError` 例" "外 --- 但是垃圾資料 (garbage data) 也將寫入檔案,物件也無法正確地透過 :func:" "`load` 重新讀取。" -#: ../../library/marshal.rst:66 +#: ../../library/marshal.rst:72 msgid "" "The *version* argument indicates the data format that ``dump`` should use " "(see below)." msgstr "*version* 引數指明 ``dump`` 應該使用的資料格式(見下文)。" -#: ../../library/marshal.rst:69 ../../library/marshal.rst:101 +#: ../../library/marshal.rst:75 ../../library/marshal.rst:115 msgid "" "Raises an :ref:`auditing event ` ``marshal.dumps`` with arguments " "``value``, ``version``." @@ -137,24 +143,31 @@ msgstr "" "引發一個附帶引數 ``value`` 與 ``version`` 的\\ :ref:`稽核事件 (auditing " "event) ` ``marshal.dumps``。" -#: ../../library/marshal.rst:74 +#: ../../library/marshal.rst:77 ../../library/marshal.rst:101 +#: ../../library/marshal.rst:117 ../../library/marshal.rst:135 +msgid "Added the *allow_code* parameter." +msgstr "" + +#: ../../library/marshal.rst:83 +#, fuzzy msgid "" "Read one value from the open file and return it. If no valid value is read " "(e.g. because the data has a different Python version's incompatible marshal " -"format), raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. The " -"file must be a readable :term:`binary file`." +"format), raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. :ref:" +"`Code objects ` are only supported if *allow_code* is true. " +"The file must be a readable :term:`binary file`." msgstr "" "從開啟的檔案讀取一個值並回傳。如果讀不到有效的值(例如,由於資料為不同 " "Python 版本的不相容 marshal 格式),則會引發 :exc:`EOFError`、:exc:" "`ValueError` 或 :exc:`TypeError`。檔案必須為可讀取的 :term:`binary file`。" -#: ../../library/marshal.rst:79 +#: ../../library/marshal.rst:89 msgid "" "Raises an :ref:`auditing event ` ``marshal.load`` with no " "arguments." msgstr "引發一個沒有附帶引數的\\ :ref:`稽核事件 ` ``marshal.load``。" -#: ../../library/marshal.rst:83 +#: ../../library/marshal.rst:93 msgid "" "If an object containing an unsupported type was marshalled with :func:" "`dump`, :func:`load` will substitute ``None`` for the unmarshallable type." @@ -162,7 +175,7 @@ msgstr "" "如果透過 :func:`dump` marshal 了一個包含不支援型別的物件,:func:`load` 會將不" "可 marshal 的型別替換為 ``None``。" -#: ../../library/marshal.rst:88 +#: ../../library/marshal.rst:98 msgid "" "This call used to raise a ``code.__new__`` audit event for each code object. " "Now it raises a single ``marshal.load`` event for the entire load operation." @@ -170,33 +183,38 @@ msgstr "" "使用此呼叫為每個程式碼物件引發一個 ``code.__new__`` 稽核事件。現在它會為整個" "載入操作引發單個 ``marshal.load`` 事件。" -#: ../../library/marshal.rst:94 +#: ../../library/marshal.rst:107 +#, fuzzy msgid "" "Return the bytes object that would be written to a file by ``dump(value, " "file)``. The value must be a supported type. Raise a :exc:`ValueError` " -"exception if value has (or contains an object that has) an unsupported type." +"exception if value has (or contains an object that has) an unsupported " +"type. :ref:`Code objects ` are only supported if *allow_code* " +"is true." msgstr "" "回傳將透過 ``dump(value, file)`` 來被寫入一個檔案的位元組串物件,其值必須是有" "支援的型別,如果值(或其包含的任一物件)為不支援的型別則會引發 :exc:" "`ValueError`。" -#: ../../library/marshal.rst:98 +#: ../../library/marshal.rst:112 msgid "" "The *version* argument indicates the data format that ``dumps`` should use " "(see below)." msgstr "*version* 引數指明 ``dumps`` 應當使用的資料型別(見下文)。" -#: ../../library/marshal.rst:106 +#: ../../library/marshal.rst:123 +#, fuzzy msgid "" "Convert the :term:`bytes-like object` to a value. If no valid value is " -"found, raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. Extra " -"bytes in the input are ignored." +"found, raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. :ref:" +"`Code objects ` are only supported if *allow_code* is true. " +"Extra bytes in the input are ignored." msgstr "" "將 :term:`bytes-like object` 轉換為一個值。如果找不到有效的值,則會引發 :exc:" "`EOFError`、:exc:`ValueError` 或 :exc:`TypeError`。輸入中額外的位元組串會被忽" "略。" -#: ../../library/marshal.rst:110 +#: ../../library/marshal.rst:128 msgid "" "Raises an :ref:`auditing event ` ``marshal.loads`` with argument " "``bytes``." @@ -204,7 +222,7 @@ msgstr "" "引發一個附帶引數 ``bytes`` 的\\ :ref:`稽核事件 ` ``marshal." "loads``。" -#: ../../library/marshal.rst:114 +#: ../../library/marshal.rst:132 msgid "" "This call used to raise a ``code.__new__`` audit event for each code object. " "Now it raises a single ``marshal.loads`` event for the entire load operation." @@ -212,11 +230,11 @@ msgstr "" "使用此呼叫為每個程式碼物件引發一個 ``code.__new__`` 稽核事件。現在它會為整個" "載入操作引發單個 ``marshal.loads`` 事件。" -#: ../../library/marshal.rst:118 +#: ../../library/marshal.rst:139 msgid "In addition, the following constants are defined:" msgstr "此外,還定義了以下常數:" -#: ../../library/marshal.rst:122 +#: ../../library/marshal.rst:143 msgid "" "Indicates the format that the module uses. Version 0 is the historical " "format, version 1 shares interned strings and version 2 uses a binary format " @@ -227,11 +245,11 @@ msgstr "" "string),第 2 版對浮點數使用二進位制格式。第 3 版添加了對於物件實例化和遞迴的" "支援。目前使用的是第 4 版。" -#: ../../library/marshal.rst:130 +#: ../../library/marshal.rst:151 msgid "Footnotes" msgstr "註解" -#: ../../library/marshal.rst:131 +#: ../../library/marshal.rst:152 msgid "" "The name of this module stems from a bit of terminology used by the " "designers of Modula-3 (amongst others), who use the term \"marshalling\" for " @@ -256,14 +274,14 @@ msgstr "pickle" msgid "shelve" msgstr "shelve" -#: ../../library/marshal.rst:37 +#: ../../library/marshal.rst:41 msgid "object" msgstr "object(物件)" -#: ../../library/marshal.rst:37 +#: ../../library/marshal.rst:41 msgid "code" msgstr "code(程式碼)" -#: ../../library/marshal.rst:37 +#: ../../library/marshal.rst:41 msgid "code object" msgstr "code object(程式碼物件)" diff --git a/library/math.po b/library/math.po index 015702b2c3..b691fbe5dc 100644 --- a/library/math.po +++ b/library/math.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-04-26 15:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -85,7 +85,7 @@ msgstr "" "因為此值等同於 ``(1 + x)ⁿ`` 進行多項式展開後第 k 項的係數,所以又稱為二項式係" "數。" -#: ../../library/math.rst:51 ../../library/math.rst:258 +#: ../../library/math.rst:51 ../../library/math.rst:274 msgid "" "Raises :exc:`TypeError` if either of the arguments are not integers. Raises :" "exc:`ValueError` if either of the arguments are negative." @@ -114,7 +114,8 @@ msgstr "" "以整數回傳 *n* 的階乘。若 *n* 非整數型別或其值為負會引發 :exc:`ValueError`。" #: ../../library/math.rst:74 -msgid "Accepting floats with integral values (like ``5.0``) is deprecated." +#, fuzzy +msgid "Floats with integral values (like ``5.0``) are no longer accepted." msgstr "允許傳入其值為整數的浮點數(如:``5.0``)已被棄用。" #: ../../library/math.rst:80 @@ -129,6 +130,23 @@ msgstr "" #: ../../library/math.rst:87 msgid "" +"Fused multiply-add operation. Return ``(x * y) + z``, computed as though " +"with infinite precision and range followed by a single round to the " +"``float`` format. This operation often provides better accuracy than the " +"direct expression ``(x * y) + z``." +msgstr "" + +#: ../../library/math.rst:92 +msgid "" +"This function follows the specification of the fusedMultiplyAdd operation " +"described in the IEEE 754 standard. The standard leaves one case " +"implementation-defined, namely the result of ``fma(0, inf, nan)`` and " +"``fma(inf, 0, nan)``. In these cases, ``math.fma`` returns a NaN, and does " +"not raise any exception." +msgstr "" + +#: ../../library/math.rst:103 +msgid "" "Return ``fmod(x, y)``, as defined by the platform C library. Note that the " "Python expression ``x % y`` may not return the same result. The intent of " "the C standard is that ``fmod(x, y)`` be exactly (mathematically; to " @@ -151,7 +169,7 @@ msgstr "" "示成浮點數,並會四捨五入為出乎意料的 ``1e100``。因此,處理浮點數時通常會選擇" "函式 :func:`fmod`,而處理整數時會選擇 Python 運算式 ``x % y``。" -#: ../../library/math.rst:102 +#: ../../library/math.rst:118 msgid "" "Return the mantissa and exponent of *x* as the pair ``(m, e)``. *m* is a " "float and *e* is an integer such that ``x == m * 2**e`` exactly. If *x* is " @@ -162,7 +180,7 @@ msgstr "" "數,且兩者精確地使 ``x == m * 2**e``。若 *x* 為零,回傳 ``(0.0, 0)``,否則令 " "``0.5 <= abs(m) < 1``。此函式用於以可攜的方式「分割」浮點數內部表示法。" -#: ../../library/math.rst:110 +#: ../../library/math.rst:126 msgid "" "Return an accurate floating-point sum of values in the iterable. Avoids " "loss of precision by tracking multiple intermediate partial sums." @@ -170,7 +188,7 @@ msgstr "" "回傳可疊代物件(iterable)中所有值的精確浮點數和。透過追蹤過程中多個部分和" "(partial sum)以避免精確度損失。" -#: ../../library/math.rst:113 +#: ../../library/math.rst:129 msgid "" "The algorithm's accuracy depends on IEEE-754 arithmetic guarantees and the " "typical case where the rounding mode is half-even. On some non-Windows " @@ -182,7 +200,7 @@ msgstr "" "有些非 Windows 平台建置時,底層 C 函式庫使用延伸精度加法運算,而可能導致對過" "程中同一部分和重複捨入,並使其最低有效位不如預期。" -#: ../../library/math.rst:119 +#: ../../library/math.rst:135 msgid "" "For further discussion and two alternative approaches, see the `ASPN " "cookbook recipes for accurate floating-point summation `_。" -#: ../../library/math.rst:126 +#: ../../library/math.rst:142 msgid "" "Return the greatest common divisor of the specified integer arguments. If " "any of the arguments is nonzero, then the returned value is the largest " @@ -204,25 +222,25 @@ msgstr "" "最大的正整數。若所有引數皆為零,則回傳值為 ``0``。``gcd()`` 若未傳入任何引數" "也將回傳 ``0``。" -#: ../../library/math.rst:134 +#: ../../library/math.rst:150 msgid "" "Added support for an arbitrary number of arguments. Formerly, only two " "arguments were supported." msgstr "新增支援任意數量的引數。先前僅支援兩個引數。" -#: ../../library/math.rst:141 +#: ../../library/math.rst:157 msgid "" "Return ``True`` if the values *a* and *b* are close to each other and " "``False`` otherwise." msgstr "若 *a* 及 *b* 兩值足夠接近便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:144 +#: ../../library/math.rst:160 msgid "" "Whether or not two values are considered close is determined according to " "given absolute and relative tolerances." msgstr "兩數是否足夠接近取決於給定的絕對及相對容許偏差(tolerance)。" -#: ../../library/math.rst:147 +#: ../../library/math.rst:163 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " @@ -235,7 +253,7 @@ msgstr "" "設值為 ``1e-09``,該值可確保兩數於大約 9 個十進數位內相同。*rel_tol* 須大於 " "``0``。" -#: ../../library/math.rst:153 +#: ../../library/math.rst:169 msgid "" "*abs_tol* is the minimum absolute tolerance -- useful for comparisons near " "zero. *abs_tol* must be at least zero." @@ -243,7 +261,7 @@ msgstr "" "*abs_tol* 為最小絕對容許偏差 ── 於接近零的比較時很有用。*abs_tol* 須大於等於 " "``0``。" -#: ../../library/math.rst:156 +#: ../../library/math.rst:172 msgid "" "If no errors occur, the result will be: ``abs(a-b) <= max(rel_tol * " "max(abs(a), abs(b)), abs_tol)``." @@ -251,7 +269,7 @@ msgstr "" "若未發生任何錯誤,函式結果為 ``abs(a-b) <= max(rel_tol * max(abs(a), " "abs(b)), abs_tol)``。" -#: ../../library/math.rst:159 +#: ../../library/math.rst:175 msgid "" "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " "handled according to IEEE rules. Specifically, ``NaN`` is not considered " @@ -262,11 +280,11 @@ msgstr "" "處理。更明確地說,``NaN`` 不會與包含自身在內的任何數字足夠接近,而 ``inf`` " "及 ``-inf`` 皆只與自身接近。" -#: ../../library/math.rst:168 +#: ../../library/math.rst:184 msgid ":pep:`485` -- A function for testing approximate equality" msgstr ":pep:`485` ── 用於測試近似相等的函式" -#: ../../library/math.rst:173 +#: ../../library/math.rst:189 msgid "" "Return ``True`` if *x* is neither an infinity nor a NaN, and ``False`` " "otherwise. (Note that ``0.0`` *is* considered finite.)" @@ -274,20 +292,20 @@ msgstr "" "若 *x* 不是無限值或 ``NaN`` 便回傳 ``True``,否則回傳 ``False``。(注意 " "``0.0`` 被視為有限數。)" -#: ../../library/math.rst:181 +#: ../../library/math.rst:197 msgid "" "Return ``True`` if *x* is a positive or negative infinity, and ``False`` " "otherwise." msgstr "若 *x* 是正無限值或負無限值便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:187 +#: ../../library/math.rst:203 msgid "" "Return ``True`` if *x* is a NaN (not a number), and ``False`` otherwise." msgstr "" "若 *x* 是 ``NaN`` ── 即非數字(NaN, not a number)── 便回傳 ``True``,否則回" "傳 ``False``。" -#: ../../library/math.rst:192 +#: ../../library/math.rst:208 msgid "" "Return the integer square root of the nonnegative integer *n*. This is the " "floor of the exact square root of *n*, or equivalently the greatest integer " @@ -296,7 +314,7 @@ msgstr "" "回傳非負整數 *n* 的整數平方根。此值為 *n* 精確平方根經下取整的值,亦等同於滿" "足 *a*\\ ² |nbsp| ≤ |nbsp| *n* 的最大整數值 *a*。" -#: ../../library/math.rst:196 +#: ../../library/math.rst:212 msgid "" "For some applications, it may be more convenient to have the least integer " "*a* such that *n* |nbsp| ≤ |nbsp| *a*\\ ², or in other words the ceiling of " @@ -307,7 +325,7 @@ msgstr "" "者說 *n* 精確平方根經上取整的值 ── 會更加方便。對正數 *n*,此值可使用 ``a = " "1 + isqrt(n - 1)`` 計算。" -#: ../../library/math.rst:206 +#: ../../library/math.rst:222 msgid "" "Return the least common multiple of the specified integer arguments. If all " "arguments are nonzero, then the returned value is the smallest positive " @@ -319,86 +337,86 @@ msgstr "" "最小的正整數。若存在任一引數值為零,則回傳值為 ``0``。``lcm()`` 若未傳入任何" "引數將回傳 ``1``。" -#: ../../library/math.rst:217 +#: ../../library/math.rst:233 msgid "" "Return ``x * (2**i)``. This is essentially the inverse of function :func:" "`frexp`." msgstr "回傳 ``x * (2**i)``。此函式本質上為 :func:`frexp` 的反函式。" -#: ../../library/math.rst:223 +#: ../../library/math.rst:239 msgid "" "Return the fractional and integer parts of *x*. Both results carry the sign " "of *x* and are floats." msgstr "" -#: ../../library/math.rst:229 +#: ../../library/math.rst:245 msgid "Return the floating-point value *steps* steps after *x* towards *y*." msgstr "" -#: ../../library/math.rst:231 +#: ../../library/math.rst:247 msgid "If *x* is equal to *y*, return *y*, unless *steps* is zero." msgstr "" -#: ../../library/math.rst:233 +#: ../../library/math.rst:249 msgid "Examples:" msgstr "範例:" -#: ../../library/math.rst:235 +#: ../../library/math.rst:251 msgid "``math.nextafter(x, math.inf)`` goes up: towards positive infinity." msgstr "" -#: ../../library/math.rst:236 +#: ../../library/math.rst:252 msgid "``math.nextafter(x, -math.inf)`` goes down: towards minus infinity." msgstr "" -#: ../../library/math.rst:237 +#: ../../library/math.rst:253 msgid "``math.nextafter(x, 0.0)`` goes towards zero." msgstr "" -#: ../../library/math.rst:238 +#: ../../library/math.rst:254 msgid "``math.nextafter(x, math.copysign(math.inf, x))`` goes away from zero." msgstr "" -#: ../../library/math.rst:240 +#: ../../library/math.rst:256 msgid "See also :func:`math.ulp`." msgstr "另請參閱 :func:`math.ulp`。" -#: ../../library/math.rst:244 +#: ../../library/math.rst:260 msgid "Added the *steps* argument." msgstr "新增 *steps* 引數。" -#: ../../library/math.rst:249 +#: ../../library/math.rst:265 msgid "" "Return the number of ways to choose *k* items from *n* items without " "repetition and with order." msgstr "" -#: ../../library/math.rst:252 +#: ../../library/math.rst:268 msgid "" "Evaluates to ``n! / (n - k)!`` when ``k <= n`` and evaluates to zero when " "``k > n``." msgstr "" -#: ../../library/math.rst:255 +#: ../../library/math.rst:271 msgid "" "If *k* is not specified or is ``None``, then *k* defaults to *n* and the " "function returns ``n!``." msgstr "" -#: ../../library/math.rst:266 +#: ../../library/math.rst:282 msgid "" "Calculate the product of all the elements in the input *iterable*. The " "default *start* value for the product is ``1``." msgstr "" -#: ../../library/math.rst:269 +#: ../../library/math.rst:285 msgid "" "When the iterable is empty, return the start value. This function is " "intended specifically for use with numeric values and may reject non-numeric " "types." msgstr "" -#: ../../library/math.rst:278 +#: ../../library/math.rst:294 msgid "" "Return the IEEE 754-style remainder of *x* with respect to *y*. For finite " "*x* and finite nonzero *y*, this is the difference ``x - n*y``, where ``n`` " @@ -408,7 +426,7 @@ msgid "" "thus always satisfies ``abs(r) <= 0.5 * abs(y)``." msgstr "" -#: ../../library/math.rst:285 +#: ../../library/math.rst:301 msgid "" "Special cases follow IEEE 754: in particular, ``remainder(x, math.inf)`` is " "*x* for any finite *x*, and ``remainder(x, 0)`` and ``remainder(math.inf, " @@ -416,35 +434,35 @@ msgid "" "remainder operation is zero, that zero will have the same sign as *x*." msgstr "" -#: ../../library/math.rst:291 +#: ../../library/math.rst:307 msgid "" "On platforms using IEEE 754 binary floating point, the result of this " "operation is always exactly representable: no rounding error is introduced." msgstr "" -#: ../../library/math.rst:299 +#: ../../library/math.rst:315 msgid "Return the sum of products of values from two iterables *p* and *q*." msgstr "" -#: ../../library/math.rst:301 +#: ../../library/math.rst:317 msgid "Raises :exc:`ValueError` if the inputs do not have the same length." msgstr "" -#: ../../library/math.rst:303 ../../library/math.rst:498 +#: ../../library/math.rst:319 ../../library/math.rst:514 msgid "Roughly equivalent to::" msgstr "" -#: ../../library/math.rst:305 +#: ../../library/math.rst:321 msgid "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" msgstr "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" -#: ../../library/math.rst:307 +#: ../../library/math.rst:323 msgid "" "For float and mixed int/float inputs, the intermediate products and sums are " "computed with extended precision." msgstr "" -#: ../../library/math.rst:315 +#: ../../library/math.rst:331 msgid "" "Return *x* with the fractional part removed, leaving the integer part. This " "rounds toward 0: ``trunc()`` is equivalent to :func:`floor` for positive " @@ -453,54 +471,54 @@ msgid "" "class:`~numbers.Integral` value." msgstr "" -#: ../../library/math.rst:323 +#: ../../library/math.rst:339 msgid "Return the value of the least significant bit of the float *x*:" msgstr "" -#: ../../library/math.rst:325 +#: ../../library/math.rst:341 msgid "If *x* is a NaN (not a number), return *x*." msgstr "" -#: ../../library/math.rst:326 +#: ../../library/math.rst:342 msgid "If *x* is negative, return ``ulp(-x)``." msgstr "" -#: ../../library/math.rst:327 +#: ../../library/math.rst:343 msgid "If *x* is a positive infinity, return *x*." msgstr "" -#: ../../library/math.rst:328 +#: ../../library/math.rst:344 msgid "" "If *x* is equal to zero, return the smallest positive *denormalized* " "representable float (smaller than the minimum positive *normalized* float, :" "data:`sys.float_info.min `)." msgstr "" -#: ../../library/math.rst:331 +#: ../../library/math.rst:347 msgid "" "If *x* is equal to the largest positive representable float, return the " "value of the least significant bit of *x*, such that the first float smaller " "than *x* is ``x - ulp(x)``." msgstr "" -#: ../../library/math.rst:334 +#: ../../library/math.rst:350 msgid "" "Otherwise (*x* is a positive finite number), return the value of the least " "significant bit of *x*, such that the first float bigger than *x* is ``x + " "ulp(x)``." msgstr "" -#: ../../library/math.rst:338 +#: ../../library/math.rst:354 msgid "ULP stands for \"Unit in the Last Place\"." msgstr "" -#: ../../library/math.rst:340 +#: ../../library/math.rst:356 msgid "" "See also :func:`math.nextafter` and :data:`sys.float_info.epsilon `." msgstr "" -#: ../../library/math.rst:346 +#: ../../library/math.rst:362 msgid "" "Note that :func:`frexp` and :func:`modf` have a different call/return " "pattern than their C equivalents: they take a single argument and return a " @@ -508,7 +526,7 @@ msgid "" "'output parameter' (there is no such thing in Python)." msgstr "" -#: ../../library/math.rst:351 +#: ../../library/math.rst:367 msgid "" "For the :func:`ceil`, :func:`floor`, and :func:`modf` functions, note that " "*all* floating-point numbers of sufficiently large magnitude are exact " @@ -517,26 +535,26 @@ msgid "" "``abs(x) >= 2**52`` necessarily has no fractional bits." msgstr "" -#: ../../library/math.rst:359 +#: ../../library/math.rst:375 msgid "Power and logarithmic functions" msgstr "" -#: ../../library/math.rst:363 +#: ../../library/math.rst:379 msgid "Return the cube root of *x*." msgstr "" -#: ../../library/math.rst:370 +#: ../../library/math.rst:386 msgid "" "Return *e* raised to the power *x*, where *e* = 2.718281... is the base of " "natural logarithms. This is usually more accurate than ``math.e ** x`` or " "``pow(math.e, x)``." msgstr "" -#: ../../library/math.rst:377 +#: ../../library/math.rst:393 msgid "Return *2* raised to the power *x*." msgstr "" -#: ../../library/math.rst:384 +#: ../../library/math.rst:400 msgid "" "Return *e* raised to the power *x*, minus 1. Here *e* is the base of " "natural logarithms. For small floats *x*, the subtraction in ``exp(x) - 1`` " @@ -545,41 +563,41 @@ msgid "" "compute this quantity to full precision:" msgstr "" -#: ../../library/math.rst:401 +#: ../../library/math.rst:417 msgid "With one argument, return the natural logarithm of *x* (to base *e*)." msgstr "" -#: ../../library/math.rst:403 +#: ../../library/math.rst:419 msgid "" "With two arguments, return the logarithm of *x* to the given *base*, " "calculated as ``log(x)/log(base)``." msgstr "" -#: ../../library/math.rst:409 +#: ../../library/math.rst:425 msgid "" "Return the natural logarithm of *1+x* (base *e*). The result is calculated " "in a way which is accurate for *x* near zero." msgstr "" -#: ../../library/math.rst:415 +#: ../../library/math.rst:431 msgid "" "Return the base-2 logarithm of *x*. This is usually more accurate than " "``log(x, 2)``." msgstr "" -#: ../../library/math.rst:422 +#: ../../library/math.rst:438 msgid "" ":meth:`int.bit_length` returns the number of bits necessary to represent an " "integer in binary, excluding the sign and leading zeros." msgstr "" -#: ../../library/math.rst:428 +#: ../../library/math.rst:444 msgid "" "Return the base-10 logarithm of *x*. This is usually more accurate than " "``log(x, 10)``." msgstr "" -#: ../../library/math.rst:434 +#: ../../library/math.rst:450 msgid "" "Return ``x`` raised to the power ``y``. Exceptional cases follow the IEEE " "754 standard as far as possible. In particular, ``pow(1.0, x)`` and " @@ -588,47 +606,47 @@ msgid "" "integer then ``pow(x, y)`` is undefined, and raises :exc:`ValueError`." msgstr "" -#: ../../library/math.rst:441 +#: ../../library/math.rst:457 msgid "" "Unlike the built-in ``**`` operator, :func:`math.pow` converts both its " "arguments to type :class:`float`. Use ``**`` or the built-in :func:`pow` " "function for computing exact integer powers." msgstr "" -#: ../../library/math.rst:445 +#: ../../library/math.rst:461 msgid "" "The special cases ``pow(0.0, -inf)`` and ``pow(-0.0, -inf)`` were changed to " "return ``inf`` instead of raising :exc:`ValueError`, for consistency with " "IEEE 754." msgstr "" -#: ../../library/math.rst:453 +#: ../../library/math.rst:469 msgid "Return the square root of *x*." msgstr "" -#: ../../library/math.rst:457 +#: ../../library/math.rst:473 msgid "Trigonometric functions" msgstr "" -#: ../../library/math.rst:461 +#: ../../library/math.rst:477 msgid "" "Return the arc cosine of *x*, in radians. The result is between ``0`` and " "``pi``." msgstr "" -#: ../../library/math.rst:467 +#: ../../library/math.rst:483 msgid "" "Return the arc sine of *x*, in radians. The result is between ``-pi/2`` and " "``pi/2``." msgstr "" -#: ../../library/math.rst:473 +#: ../../library/math.rst:489 msgid "" "Return the arc tangent of *x*, in radians. The result is between ``-pi/2`` " "and ``pi/2``." msgstr "" -#: ../../library/math.rst:479 +#: ../../library/math.rst:495 msgid "" "Return ``atan(y / x)``, in radians. The result is between ``-pi`` and " "``pi``. The vector in the plane from the origin to point ``(x, y)`` makes " @@ -638,128 +656,128 @@ msgid "" "``pi/4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." msgstr "" -#: ../../library/math.rst:489 +#: ../../library/math.rst:505 msgid "Return the cosine of *x* radians." msgstr "" -#: ../../library/math.rst:494 +#: ../../library/math.rst:510 msgid "" "Return the Euclidean distance between two points *p* and *q*, each given as " "a sequence (or iterable) of coordinates. The two points must have the same " "dimension." msgstr "" -#: ../../library/math.rst:500 +#: ../../library/math.rst:516 msgid "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" msgstr "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" -#: ../../library/math.rst:507 +#: ../../library/math.rst:523 msgid "" "Return the Euclidean norm, ``sqrt(sum(x**2 for x in coordinates))``. This is " "the length of the vector from the origin to the point given by the " "coordinates." msgstr "" -#: ../../library/math.rst:511 +#: ../../library/math.rst:527 msgid "" "For a two dimensional point ``(x, y)``, this is equivalent to computing the " "hypotenuse of a right triangle using the Pythagorean theorem, ``sqrt(x*x + " "y*y)``." msgstr "" -#: ../../library/math.rst:515 +#: ../../library/math.rst:531 msgid "" "Added support for n-dimensional points. Formerly, only the two dimensional " "case was supported." msgstr "" -#: ../../library/math.rst:519 +#: ../../library/math.rst:535 msgid "" "Improved the algorithm's accuracy so that the maximum error is under 1 ulp " "(unit in the last place). More typically, the result is almost always " "correctly rounded to within 1/2 ulp." msgstr "" -#: ../../library/math.rst:527 +#: ../../library/math.rst:543 msgid "Return the sine of *x* radians." msgstr "" -#: ../../library/math.rst:532 +#: ../../library/math.rst:548 msgid "Return the tangent of *x* radians." msgstr "" -#: ../../library/math.rst:536 +#: ../../library/math.rst:552 msgid "Angular conversion" msgstr "" -#: ../../library/math.rst:540 +#: ../../library/math.rst:556 msgid "Convert angle *x* from radians to degrees." msgstr "" -#: ../../library/math.rst:545 +#: ../../library/math.rst:561 msgid "Convert angle *x* from degrees to radians." msgstr "" -#: ../../library/math.rst:549 +#: ../../library/math.rst:565 msgid "Hyperbolic functions" msgstr "" -#: ../../library/math.rst:551 +#: ../../library/math.rst:567 msgid "" "`Hyperbolic functions `_ " "are analogs of trigonometric functions that are based on hyperbolas instead " "of circles." msgstr "" -#: ../../library/math.rst:557 +#: ../../library/math.rst:573 msgid "Return the inverse hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:562 +#: ../../library/math.rst:578 msgid "Return the inverse hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:567 +#: ../../library/math.rst:583 msgid "Return the inverse hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:572 +#: ../../library/math.rst:588 msgid "Return the hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:577 +#: ../../library/math.rst:593 msgid "Return the hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:582 +#: ../../library/math.rst:598 msgid "Return the hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:586 +#: ../../library/math.rst:602 msgid "Special functions" msgstr "" -#: ../../library/math.rst:590 +#: ../../library/math.rst:606 msgid "" "Return the `error function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:593 +#: ../../library/math.rst:609 msgid "" "The :func:`erf` function can be used to compute traditional statistical " "functions such as the `cumulative standard normal distribution `_::" msgstr "" -#: ../../library/math.rst:597 +#: ../../library/math.rst:613 msgid "" "def phi(x):\n" " 'Cumulative distribution function for the standard normal distribution'\n" " return (1.0 + erf(x / sqrt(2.0))) / 2.0" msgstr "" -#: ../../library/math.rst:606 +#: ../../library/math.rst:622 msgid "" "Return the complementary error function at *x*. The `complementary error " "function `_ is defined as " @@ -768,31 +786,31 @@ msgid "" "Loss_of_significance>`_\\." msgstr "" -#: ../../library/math.rst:617 +#: ../../library/math.rst:633 msgid "" "Return the `Gamma function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:625 +#: ../../library/math.rst:641 msgid "" "Return the natural logarithm of the absolute value of the Gamma function at " "*x*." msgstr "" -#: ../../library/math.rst:632 +#: ../../library/math.rst:648 msgid "Constants" msgstr "常數" -#: ../../library/math.rst:636 +#: ../../library/math.rst:652 msgid "The mathematical constant *π* = 3.141592..., to available precision." msgstr "" -#: ../../library/math.rst:641 +#: ../../library/math.rst:657 msgid "The mathematical constant *e* = 2.718281..., to available precision." msgstr "" -#: ../../library/math.rst:646 +#: ../../library/math.rst:662 msgid "" "The mathematical constant *τ* = 6.283185..., to available precision. Tau is " "a circle constant equal to 2\\ *π*, the ratio of a circle's circumference to " @@ -801,13 +819,13 @@ msgid "" "celebrating `Tau day `_ by eating twice as much pie!" msgstr "" -#: ../../library/math.rst:657 +#: ../../library/math.rst:673 msgid "" "A floating-point positive infinity. (For negative infinity, use ``-math." "inf``.) Equivalent to the output of ``float('inf')``." msgstr "" -#: ../../library/math.rst:665 +#: ../../library/math.rst:681 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to the output of " "``float('nan')``. Due to the requirements of the `IEEE-754 standard \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -82,41 +82,54 @@ msgid "" msgstr "" #: ../../library/mimetypes.rst:54 -msgid "Added support for url being a :term:`path-like object`." +msgid "Added support for *url* being a :term:`path-like object`." msgstr "" -#: ../../library/mimetypes.rst:60 +#: ../../library/mimetypes.rst:57 +msgid "" +"Passing a file path instead of URL is :term:`soft deprecated`. Use :func:" +"`guess_file_type` for this." +msgstr "" + +#: ../../library/mimetypes.rst:66 +msgid "" +"Guess the type of a file based on its path, given by *path*. Similar to the :" +"func:`guess_type` function, but accepts a path instead of URL. Path can be a " +"string, a bytes object or a :term:`path-like object`." +msgstr "" + +#: ../../library/mimetypes.rst:75 msgid "" "Guess the extensions for a file based on its MIME type, given by *type*. The " "return value is a list of strings giving all possible filename extensions, " "including the leading dot (``'.'``). The extensions are not guaranteed to " "have been associated with any particular data stream, but would be mapped to " -"the MIME type *type* by :func:`guess_type`." +"the MIME type *type* by :func:`guess_type` and :func:`guess_file_type`." msgstr "" -#: ../../library/mimetypes.rst:66 ../../library/mimetypes.rst:78 +#: ../../library/mimetypes.rst:81 ../../library/mimetypes.rst:93 msgid "" "The optional *strict* argument has the same meaning as with the :func:" "`guess_type` function." msgstr "" -#: ../../library/mimetypes.rst:71 +#: ../../library/mimetypes.rst:86 msgid "" "Guess the extension for a file based on its MIME type, given by *type*. The " "return value is a string giving a filename extension, including the leading " "dot (``'.'``). The extension is not guaranteed to have been associated with " "any particular data stream, but would be mapped to the MIME type *type* by :" -"func:`guess_type`. If no extension can be guessed for *type*, ``None`` is " -"returned." +"func:`guess_type` and :func:`guess_file_type`. If no extension can be " +"guessed for *type*, ``None`` is returned." msgstr "" -#: ../../library/mimetypes.rst:80 +#: ../../library/mimetypes.rst:95 msgid "" "Some additional functions and data items are available for controlling the " "behavior of the module." msgstr "" -#: ../../library/mimetypes.rst:86 +#: ../../library/mimetypes.rst:101 msgid "" "Initialize the internal data structures. If given, *files* must be a " "sequence of file names which should be used to augment the default type " @@ -126,25 +139,25 @@ msgid "" "Calling :func:`init` repeatedly is allowed." msgstr "" -#: ../../library/mimetypes.rst:93 +#: ../../library/mimetypes.rst:108 msgid "" "Specifying an empty list for *files* will prevent the system defaults from " "being applied: only the well-known values will be present from a built-in " "list." msgstr "" -#: ../../library/mimetypes.rst:96 +#: ../../library/mimetypes.rst:111 msgid "" "If *files* is ``None`` the internal data structure is completely rebuilt to " "its initial default value. This is a stable operation and will produce the " "same results when called multiple times." msgstr "" -#: ../../library/mimetypes.rst:100 +#: ../../library/mimetypes.rst:115 msgid "Previously, Windows registry settings were ignored." msgstr "" -#: ../../library/mimetypes.rst:106 +#: ../../library/mimetypes.rst:121 msgid "" "Load the type map given in the file *filename*, if it exists. The type map " "is returned as a dictionary mapping filename extensions, including the " @@ -152,7 +165,7 @@ msgid "" "file *filename* does not exist or cannot be read, ``None`` is returned." msgstr "" -#: ../../library/mimetypes.rst:114 ../../library/mimetypes.rst:279 +#: ../../library/mimetypes.rst:129 ../../library/mimetypes.rst:302 msgid "" "Add a mapping from the MIME type *type* to the extension *ext*. When the " "extension is already known, the new type will replace the old one. When the " @@ -160,26 +173,26 @@ msgid "" "extensions." msgstr "" -#: ../../library/mimetypes.rst:118 ../../library/mimetypes.rst:283 +#: ../../library/mimetypes.rst:133 ../../library/mimetypes.rst:306 msgid "" "When *strict* is ``True`` (the default), the mapping will be added to the " "official MIME types, otherwise to the non-standard ones." msgstr "" -#: ../../library/mimetypes.rst:124 +#: ../../library/mimetypes.rst:139 msgid "" "Flag indicating whether or not the global data structures have been " "initialized. This is set to ``True`` by :func:`init`." msgstr "" -#: ../../library/mimetypes.rst:132 +#: ../../library/mimetypes.rst:147 msgid "" "List of type map file names commonly installed. These files are typically " "named :file:`mime.types` and are installed in different locations by " "different packages." msgstr "" -#: ../../library/mimetypes.rst:139 +#: ../../library/mimetypes.rst:154 msgid "" "Dictionary mapping suffixes to suffixes. This is used to allow recognition " "of encoded files for which the encoding and the type are indicated by the " @@ -187,25 +200,25 @@ msgid "" "`.tar.gz` to allow the encoding and type to be recognized separately." msgstr "" -#: ../../library/mimetypes.rst:147 +#: ../../library/mimetypes.rst:162 msgid "Dictionary mapping filename extensions to encoding types." msgstr "" -#: ../../library/mimetypes.rst:152 +#: ../../library/mimetypes.rst:167 msgid "Dictionary mapping filename extensions to MIME types." msgstr "" -#: ../../library/mimetypes.rst:157 +#: ../../library/mimetypes.rst:172 msgid "" "Dictionary mapping filename extensions to non-standard, but commonly found " "MIME types." msgstr "" -#: ../../library/mimetypes.rst:161 +#: ../../library/mimetypes.rst:176 msgid "An example usage of the module::" msgstr "模組的使用範例: ::" -#: ../../library/mimetypes.rst:163 +#: ../../library/mimetypes.rst:178 msgid "" ">>> import mimetypes\n" ">>> mimetypes.init()\n" @@ -229,18 +242,18 @@ msgstr "" ">>> mimetypes.types_map['.tgz']\n" "'application/x-tar-gz'" -#: ../../library/mimetypes.rst:178 +#: ../../library/mimetypes.rst:193 msgid "MimeTypes Objects" msgstr "MimeTypes 物件" -#: ../../library/mimetypes.rst:180 +#: ../../library/mimetypes.rst:195 msgid "" "The :class:`MimeTypes` class may be useful for applications which may want " "more than one MIME-type database; it provides an interface similar to the " "one of the :mod:`mimetypes` module." msgstr "" -#: ../../library/mimetypes.rst:187 +#: ../../library/mimetypes.rst:202 msgid "" "This class represents a MIME-types database. By default, it provides access " "to the same database as the rest of this module. The initial database is a " @@ -250,13 +263,13 @@ msgid "" "cleared before loading additional data if the default data is not desired." msgstr "" -#: ../../library/mimetypes.rst:194 +#: ../../library/mimetypes.rst:209 msgid "" "The optional *filenames* parameter can be used to cause additional files to " "be loaded \"on top\" of the default database." msgstr "" -#: ../../library/mimetypes.rst:200 +#: ../../library/mimetypes.rst:215 msgid "" "Dictionary mapping suffixes to suffixes. This is used to allow recognition " "of encoded files for which the encoding and the type are indicated by the " @@ -265,13 +278,13 @@ msgid "" "is initially a copy of the global :data:`suffix_map` defined in the module." msgstr "" -#: ../../library/mimetypes.rst:209 +#: ../../library/mimetypes.rst:224 msgid "" "Dictionary mapping filename extensions to encoding types. This is initially " "a copy of the global :data:`encodings_map` defined in the module." msgstr "" -#: ../../library/mimetypes.rst:215 +#: ../../library/mimetypes.rst:230 msgid "" "Tuple containing two dictionaries, mapping filename extensions to MIME " "types: the first dictionary is for the non-standards types and the second " @@ -279,7 +292,7 @@ msgid "" "and :data:`types_map`." msgstr "" -#: ../../library/mimetypes.rst:223 +#: ../../library/mimetypes.rst:238 msgid "" "Tuple containing two dictionaries, mapping MIME types to a list of filename " "extensions: the first dictionary is for the non-standards types and the " @@ -287,57 +300,64 @@ msgid "" "`common_types` and :data:`types_map`." msgstr "" -#: ../../library/mimetypes.rst:231 +#: ../../library/mimetypes.rst:246 msgid "" "Similar to the :func:`guess_extension` function, using the tables stored as " "part of the object." msgstr "" -#: ../../library/mimetypes.rst:237 +#: ../../library/mimetypes.rst:252 msgid "" "Similar to the :func:`guess_type` function, using the tables stored as part " "of the object." msgstr "" -#: ../../library/mimetypes.rst:243 +#: ../../library/mimetypes.rst:258 +msgid "" +"Similar to the :func:`guess_file_type` function, using the tables stored as " +"part of the object." +msgstr "" + +#: ../../library/mimetypes.rst:266 msgid "" "Similar to the :func:`guess_all_extensions` function, using the tables " "stored as part of the object." msgstr "" -#: ../../library/mimetypes.rst:249 +#: ../../library/mimetypes.rst:272 msgid "" "Load MIME information from a file named *filename*. This uses :meth:" "`readfp` to parse the file." msgstr "" -#: ../../library/mimetypes.rst:252 +#: ../../library/mimetypes.rst:275 msgid "" "If *strict* is ``True``, information will be added to list of standard " "types, else to the list of non-standard types." msgstr "" -#: ../../library/mimetypes.rst:258 +#: ../../library/mimetypes.rst:281 msgid "" "Load MIME type information from an open file *fp*. The file must have the " "format of the standard :file:`mime.types` files." msgstr "" -#: ../../library/mimetypes.rst:261 ../../library/mimetypes.rst:271 +#: ../../library/mimetypes.rst:284 ../../library/mimetypes.rst:294 msgid "" "If *strict* is ``True``, information will be added to the list of standard " "types, else to the list of non-standard types." msgstr "" -#: ../../library/mimetypes.rst:267 +#: ../../library/mimetypes.rst:290 msgid "Load MIME type information from the Windows registry." msgstr "" -#: ../../library/mimetypes.rst:269 +#: ../../library/mimetypes.rst:292 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" #: ../../library/mimetypes.rst:11 ../../library/mimetypes.rst:31 +#: ../../library/mimetypes.rst:64 msgid "MIME" msgstr "MIME" @@ -345,14 +365,14 @@ msgstr "MIME" msgid "content type" msgstr "content type(內容類型)" -#: ../../library/mimetypes.rst:31 +#: ../../library/mimetypes.rst:31 ../../library/mimetypes.rst:64 msgid "headers" msgstr "headers(標頭)" -#: ../../library/mimetypes.rst:130 +#: ../../library/mimetypes.rst:145 msgid "file" msgstr "file(檔案)" -#: ../../library/mimetypes.rst:130 +#: ../../library/mimetypes.rst:145 msgid "mime.types" msgstr "mime.types" diff --git a/library/mmap.po b/library/mmap.po index b36417a293..b9e77a07cc 100644 --- a/library/mmap.po +++ b/library/mmap.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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-" @@ -22,14 +22,14 @@ msgid ":mod:`!mmap` --- Memory-mapped file support" msgstr ":mod:`!mmap` --- 記憶體映射檔案的支援" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid ":ref:`Availability `: not WASI." msgstr "" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" @@ -120,7 +120,7 @@ msgid "" "`ALLOCATIONGRANULARITY`." msgstr "" -#: ../../library/mmap.rst:72 ../../library/mmap.rst:163 +#: ../../library/mmap.rst:72 ../../library/mmap.rst:174 msgid "" "Raises an :ref:`auditing event ` ``mmap.__new__`` with arguments " "``fileno``, ``length``, ``access``, ``offset``." @@ -128,7 +128,7 @@ msgstr "" "引發一個附帶引數 ``fileno``、``length``、``access``、``offset`` 的\\ :ref:`稽" "核事件 ` ``mmap.__new__``。" -#: ../../library/mmap.rst:77 +#: ../../library/mmap.rst:78 msgid "" "**(Unix version)** Maps *length* bytes from the file specified by the file " "descriptor *fileno*, and returns a mmap object. If *length* is ``0``, the " @@ -136,7 +136,7 @@ msgid "" "`~mmap.mmap` is called." msgstr "" -#: ../../library/mmap.rst:82 +#: ../../library/mmap.rst:83 msgid "" "*flags* specifies the nature of the mapping. :const:`MAP_PRIVATE` creates a " "private copy-on-write mapping, so changes to the contents of the mmap object " @@ -147,7 +147,7 @@ msgid "" "constants>`." msgstr "" -#: ../../library/mmap.rst:90 +#: ../../library/mmap.rst:91 msgid "" "*prot*, if specified, gives the desired memory protection; the two most " "useful values are :const:`PROT_READ` and :const:`PROT_WRITE`, to specify " @@ -155,7 +155,7 @@ msgid "" "\\| PROT_WRITE`." msgstr "" -#: ../../library/mmap.rst:95 +#: ../../library/mmap.rst:96 msgid "" "*access* may be specified in lieu of *flags* and *prot* as an optional " "keyword parameter. It is an error to specify both *flags*, *prot* and " @@ -163,7 +163,7 @@ msgid "" "use this parameter." msgstr "" -#: ../../library/mmap.rst:100 +#: ../../library/mmap.rst:101 msgid "" "*offset* may be specified as a non-negative integer offset. mmap references " "will be relative to the offset from the beginning of the file. *offset* " @@ -171,18 +171,31 @@ msgid "" "which is equal to :const:`PAGESIZE` on Unix systems." msgstr "" -#: ../../library/mmap.rst:105 +#: ../../library/mmap.rst:106 +msgid "" +"If *trackfd* is ``False``, the file descriptor specified by *fileno* will " +"not be duplicated, and the resulting :class:`!mmap` object will not be " +"associated with the map's underlying file. This means that the :meth:`~mmap." +"mmap.size` and :meth:`~mmap.mmap.resize` methods will fail. This mode is " +"useful to limit the number of open file descriptors." +msgstr "" + +#: ../../library/mmap.rst:113 msgid "" "To ensure validity of the created memory mapping the file specified by the " "descriptor *fileno* is internally automatically synchronized with the " "physical backing store on macOS." msgstr "" -#: ../../library/mmap.rst:109 +#: ../../library/mmap.rst:117 +msgid "The *trackfd* parameter was added." +msgstr "" + +#: ../../library/mmap.rst:120 msgid "This example shows a simple way of using :class:`~mmap.mmap`::" msgstr "" -#: ../../library/mmap.rst:111 +#: ../../library/mmap.rst:122 msgid "" "import mmap\n" "\n" @@ -207,13 +220,13 @@ msgid "" " mm.close()" msgstr "" -#: ../../library/mmap.rst:134 +#: ../../library/mmap.rst:145 msgid "" ":class:`~mmap.mmap` can also be used as a context manager in a :keyword:" "`with` statement::" msgstr "" -#: ../../library/mmap.rst:137 +#: ../../library/mmap.rst:148 msgid "" "import mmap\n" "\n" @@ -225,17 +238,17 @@ msgstr "" "with mmap.mmap(-1, 13) as mm:\n" " mm.write(b\"Hello world!\")" -#: ../../library/mmap.rst:142 +#: ../../library/mmap.rst:153 msgid "Context manager support." msgstr "" -#: ../../library/mmap.rst:146 +#: ../../library/mmap.rst:157 msgid "" "The next example demonstrates how to create an anonymous map and exchange " "data between the parent and child processes::" msgstr "" -#: ../../library/mmap.rst:149 +#: ../../library/mmap.rst:160 msgid "" "import mmap\n" "import os\n" @@ -265,21 +278,21 @@ msgstr "" "\n" " mm.close()" -#: ../../library/mmap.rst:165 +#: ../../library/mmap.rst:176 msgid "Memory-mapped file objects support the following methods:" msgstr "" -#: ../../library/mmap.rst:169 +#: ../../library/mmap.rst:180 msgid "" "Closes the mmap. Subsequent calls to other methods of the object will result " "in a ValueError exception being raised. This will not close the open file." msgstr "" -#: ../../library/mmap.rst:176 +#: ../../library/mmap.rst:187 msgid "``True`` if the file is closed." msgstr "" -#: ../../library/mmap.rst:183 +#: ../../library/mmap.rst:194 msgid "" "Returns the lowest index in the object where the subsequence *sub* is found, " "such that *sub* is contained in the range [*start*, *end*]. Optional " @@ -287,12 +300,12 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/mmap.rst:188 ../../library/mmap.rst:277 -#: ../../library/mmap.rst:309 +#: ../../library/mmap.rst:199 ../../library/mmap.rst:291 +#: ../../library/mmap.rst:331 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" -#: ../../library/mmap.rst:194 +#: ../../library/mmap.rst:205 msgid "" "Flushes changes made to the in-memory copy of a file back to disk. Without " "use of this call there is no guarantee that changes are written back before " @@ -302,20 +315,20 @@ msgid "" "`PAGESIZE` or :const:`ALLOCATIONGRANULARITY`." msgstr "" -#: ../../library/mmap.rst:201 +#: ../../library/mmap.rst:212 msgid "" "``None`` is returned to indicate success. An exception is raised when the " "call failed." msgstr "" -#: ../../library/mmap.rst:204 +#: ../../library/mmap.rst:215 msgid "" "Previously, a nonzero value was returned on success; zero was returned on " "error under Windows. A zero value was returned on success; an exception was " "raised on error under Unix." msgstr "" -#: ../../library/mmap.rst:212 +#: ../../library/mmap.rst:223 msgid "" "Send advice *option* to the kernel about the memory region beginning at " "*start* and extending *length* bytes. *option* must be one of the :ref:" @@ -324,18 +337,18 @@ msgid "" "(including Linux), *start* must be a multiple of the :const:`PAGESIZE`." msgstr "" -#: ../../library/mmap.rst:219 +#: ../../library/mmap.rst:230 msgid "Availability: Systems with the ``madvise()`` system call." msgstr "" -#: ../../library/mmap.rst:226 +#: ../../library/mmap.rst:237 msgid "" "Copy the *count* bytes starting at offset *src* to the destination index " "*dest*. If the mmap was created with :const:`ACCESS_READ`, then calls to " "move will raise a :exc:`TypeError` exception." msgstr "" -#: ../../library/mmap.rst:233 +#: ../../library/mmap.rst:244 msgid "" "Return a :class:`bytes` containing up to *n* bytes starting from the current " "file position. If the argument is omitted, ``None`` or negative, return all " @@ -343,31 +356,36 @@ msgid "" "position is updated to point after the bytes that were returned." msgstr "" -#: ../../library/mmap.rst:239 +#: ../../library/mmap.rst:250 msgid "Argument can be omitted or ``None``." msgstr "" -#: ../../library/mmap.rst:244 +#: ../../library/mmap.rst:255 msgid "" "Returns a byte at the current file position as an integer, and advances the " "file position by 1." msgstr "" -#: ../../library/mmap.rst:250 +#: ../../library/mmap.rst:261 msgid "" "Returns a single line, starting at the current file position and up to the " "next newline. The file position is updated to point after the bytes that " "were returned." msgstr "" -#: ../../library/mmap.rst:257 +#: ../../library/mmap.rst:268 +msgid "Resizes the map and the underlying file, if any." +msgstr "" + +#: ../../library/mmap.rst:270 msgid "" -"Resizes the map and the underlying file, if any. If the mmap was created " -"with :const:`ACCESS_READ` or :const:`ACCESS_COPY`, resizing the map will " -"raise a :exc:`TypeError` exception." +"Resizing a map created with *access* of :const:`ACCESS_READ` or :const:" +"`ACCESS_COPY`, will raise a :exc:`TypeError` exception. Resizing a map " +"created with with *trackfd* set to ``False``, will raise a :exc:`ValueError` " +"exception." msgstr "" -#: ../../library/mmap.rst:261 +#: ../../library/mmap.rst:275 msgid "" "**On Windows**: Resizing the map will raise an :exc:`OSError` if there are " "other maps against the same named file. Resizing an anonymous map (ie " @@ -375,13 +393,13 @@ msgid "" "copied over up to the length of the new size." msgstr "" -#: ../../library/mmap.rst:266 +#: ../../library/mmap.rst:280 msgid "" "Correctly fails if attempting to resize when another map is held Allows " "resize against an anonymous map on Windows" msgstr "" -#: ../../library/mmap.rst:272 +#: ../../library/mmap.rst:286 msgid "" "Returns the highest index in the object where the subsequence *sub* is " "found, such that *sub* is contained in the range [*start*, *end*]. Optional " @@ -389,7 +407,7 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/mmap.rst:283 +#: ../../library/mmap.rst:297 msgid "" "Set the file's current position. *whence* argument is optional and defaults " "to ``os.SEEK_SET`` or ``0`` (absolute file positioning); other values are " @@ -397,17 +415,27 @@ msgid "" "SEEK_END`` or ``2`` (seek relative to the file's end)." msgstr "" -#: ../../library/mmap.rst:291 +#: ../../library/mmap.rst:302 +msgid "Return the new absolute position instead of ``None``." +msgstr "" + +#: ../../library/mmap.rst:307 +msgid "" +"Return whether the file supports seeking, and the return value is always " +"``True``." +msgstr "" + +#: ../../library/mmap.rst:313 msgid "" "Return the length of the file, which can be larger than the size of the " "memory-mapped area." msgstr "" -#: ../../library/mmap.rst:297 +#: ../../library/mmap.rst:319 msgid "Returns the current position of the file pointer." msgstr "" -#: ../../library/mmap.rst:302 +#: ../../library/mmap.rst:324 msgid "" "Write the bytes in *bytes* into memory at the current position of the file " "pointer and return the number of bytes written (never less than " @@ -417,11 +445,11 @@ msgid "" "it will raise a :exc:`TypeError` exception." msgstr "" -#: ../../library/mmap.rst:312 +#: ../../library/mmap.rst:334 msgid "The number of bytes written is now returned." msgstr "" -#: ../../library/mmap.rst:318 +#: ../../library/mmap.rst:340 msgid "" "Write the integer *byte* into memory at the current position of the file " "pointer; the file position is advanced by ``1``. If the mmap was created " @@ -429,25 +457,25 @@ msgid "" "exception." msgstr "" -#: ../../library/mmap.rst:326 +#: ../../library/mmap.rst:348 msgid "MADV_* Constants" msgstr "" -#: ../../library/mmap.rst:353 +#: ../../library/mmap.rst:375 msgid "" "These options can be passed to :meth:`mmap.madvise`. Not every option will " "be present on every system." msgstr "" -#: ../../library/mmap.rst:356 +#: ../../library/mmap.rst:378 msgid "Availability: Systems with the madvise() system call." msgstr "" -#: ../../library/mmap.rst:363 +#: ../../library/mmap.rst:385 msgid "MAP_* Constants" msgstr "MAP_* 常數" -#: ../../library/mmap.rst:376 +#: ../../library/mmap.rst:409 msgid "" "These are the various flags that can be passed to :meth:`mmap.mmap`. :data:" "`MAP_ALIGNED_SUPER` is only available at FreeBSD and :data:`MAP_CONCEAL` is " @@ -455,15 +483,23 @@ msgid "" "some systems." msgstr "" -#: ../../library/mmap.rst:380 +#: ../../library/mmap.rst:413 msgid "Added :data:`MAP_POPULATE` constant." msgstr "新增 :data:`MAP_POPULATE` 常數。" -#: ../../library/mmap.rst:383 +#: ../../library/mmap.rst:416 msgid "Added :data:`MAP_STACK` constant." msgstr "新增 :data:`MAP_STACK` 常數。" -#: ../../library/mmap.rst:386 -msgid "" -"Added :data:`MAP_ALIGNED_SUPER` constant. Added :data:`MAP_CONCEAL` constant." +#: ../../library/mmap.rst:419 +#, fuzzy +msgid "Added :data:`MAP_ALIGNED_SUPER` and :data:`MAP_CONCEAL` constants." msgstr "新增 :data:`MAP_ALIGNED_SUPER` 常數。新增 :data:`MAP_CONCEAL` 常數。" + +#: ../../library/mmap.rst:422 +msgid "" +"Added :data:`MAP_32BIT`, :data:`MAP_HASSEMAPHORE`, :data:`MAP_JIT`, :data:" +"`MAP_NOCACHE`, :data:`MAP_NOEXTEND`, :data:`MAP_NORESERVE`, :data:" +"`MAP_RESILIENT_CODESIGN`, :data:`MAP_RESILIENT_MEDIA`, :data:`MAP_TPRO`, :" +"data:`MAP_TRANSLATED_ALLOW_EXECUTE`, and :data:`MAP_UNIX03` constants." +msgstr "" diff --git a/library/msvcrt.po b/library/msvcrt.po index c3a4747dc1..a59619b149 100644 --- a/library/msvcrt.po +++ b/library/msvcrt.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-04 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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-" @@ -25,8 +25,8 @@ msgstr ":mod:`!msvcrt` --- MS VC++ runtime 提供的有用例程" #: ../../library/msvcrt.rst:12 msgid "" "These functions provide access to some useful capabilities on Windows " -"platforms. Some higher-level modules use these functions to build the " -"Windows implementations of their services. For example, the :mod:`getpass` " +"platforms. Some higher-level modules use these functions to build the " +"Windows implementations of their services. For example, the :mod:`getpass` " "module uses this in the implementation of the :func:`getpass` function." msgstr "" @@ -56,12 +56,12 @@ msgstr "" #: ../../library/msvcrt.rst:38 msgid "" -"Lock part of a file based on file descriptor *fd* from the C runtime. " -"Raises :exc:`OSError` on failure. The locked region of the file extends " -"from the current file position for *nbytes* bytes, and may continue beyond " -"the end of the file. *mode* must be one of the :const:`!LK_\\*` constants " -"listed below. Multiple regions in a file may be locked at the same time, but " -"may not overlap. Adjacent regions are not merged; they must be unlocked " +"Lock part of a file based on file descriptor *fd* from the C runtime. " +"Raises :exc:`OSError` on failure. The locked region of the file extends from " +"the current file position for *nbytes* bytes, and may continue beyond the " +"end of the file. *mode* must be one of the :const:`!LK_\\*` constants listed " +"below. Multiple regions in a file may be locked at the same time, but may " +"not overlap. Adjacent regions are not merged; they must be unlocked " "individually." msgstr "" @@ -76,7 +76,7 @@ msgstr "" #: ../../library/msvcrt.rst:51 msgid "" "Locks the specified bytes. If the bytes cannot be locked, the program " -"immediately tries again after 1 second. If, after 10 attempts, the bytes " +"immediately tries again after 1 second. If, after 10 attempts, the bytes " "cannot be locked, :exc:`OSError` is raised." msgstr "" @@ -99,13 +99,20 @@ msgstr "" #: ../../library/msvcrt.rst:77 msgid "" -"Create a C runtime file descriptor from the file handle *handle*. The " +"Create a C runtime file descriptor from the file handle *handle*. The " "*flags* parameter should be a bitwise OR of :const:`os.O_APPEND`, :const:`os." -"O_RDONLY`, and :const:`os.O_TEXT`. The returned file descriptor may be used " -"as a parameter to :func:`os.fdopen` to create a file object." +"O_RDONLY`, :const:`os.O_TEXT` and :const:`os.O_NOINHERIT`. The returned file " +"descriptor may be used as a parameter to :func:`os.fdopen` to create a file " +"object." msgstr "" -#: ../../library/msvcrt.rst:82 +#: ../../library/msvcrt.rst:83 +msgid "" +"The file descriptor is inheritable by default. Pass :const:`os.O_NOINHERIT` " +"flag to make it non inheritable." +msgstr "" + +#: ../../library/msvcrt.rst:86 msgid "" "Raises an :ref:`auditing event ` ``msvcrt.open_osfhandle`` with " "arguments ``handle``, ``flags``." @@ -113,13 +120,13 @@ msgstr "" "引發一個附帶引數 ``handle``、``flags`` 的\\ :ref:`稽核事件 ` " "``msvcrt.open_osfhandle``。" -#: ../../library/msvcrt.rst:87 +#: ../../library/msvcrt.rst:91 msgid "" -"Return the file handle for the file descriptor *fd*. Raises :exc:`OSError` " +"Return the file handle for the file descriptor *fd*. Raises :exc:`OSError` " "if *fd* is not recognized." msgstr "" -#: ../../library/msvcrt.rst:90 +#: ../../library/msvcrt.rst:94 msgid "" "Raises an :ref:`auditing event ` ``msvcrt.get_osfhandle`` with " "argument ``fd``." @@ -127,76 +134,164 @@ msgstr "" "引發一個附帶引數 ``fd`` 的\\ :ref:`稽核事件 ` ``msvcrt." "get_osfhandle``。" -#: ../../library/msvcrt.rst:96 +#: ../../library/msvcrt.rst:100 msgid "Console I/O" msgstr "" -#: ../../library/msvcrt.rst:101 -msgid "Return ``True`` if a keypress is waiting to be read." +#: ../../library/msvcrt.rst:105 +msgid "" +"Returns a nonzero value if a keypress is waiting to be read. Otherwise, " +"return 0." msgstr "" -#: ../../library/msvcrt.rst:106 +#: ../../library/msvcrt.rst:111 msgid "" "Read a keypress and return the resulting character as a byte string. Nothing " -"is echoed to the console. This call will block if a keypress is not already " +"is echoed to the console. This call will block if a keypress is not already " "available, but will not wait for :kbd:`Enter` to be pressed. If the pressed " "key was a special function key, this will return ``'\\000'`` or ``'\\xe0'``; " "the next call will return the keycode. The :kbd:`Control-C` keypress cannot " "be read with this function." msgstr "" -#: ../../library/msvcrt.rst:116 +#: ../../library/msvcrt.rst:121 msgid "Wide char variant of :func:`getch`, returning a Unicode value." msgstr "" -#: ../../library/msvcrt.rst:121 +#: ../../library/msvcrt.rst:126 msgid "" -"Similar to :func:`getch`, but the keypress will be echoed if it represents " -"a printable character." +"Similar to :func:`getch`, but the keypress will be echoed if it represents a " +"printable character." msgstr "" -#: ../../library/msvcrt.rst:127 +#: ../../library/msvcrt.rst:132 msgid "Wide char variant of :func:`getche`, returning a Unicode value." msgstr "" -#: ../../library/msvcrt.rst:132 +#: ../../library/msvcrt.rst:137 msgid "Print the byte string *char* to the console without buffering." msgstr "" -#: ../../library/msvcrt.rst:137 +#: ../../library/msvcrt.rst:142 msgid "Wide char variant of :func:`putch`, accepting a Unicode value." msgstr "" -#: ../../library/msvcrt.rst:142 +#: ../../library/msvcrt.rst:147 msgid "" "Cause the byte string *char* to be \"pushed back\" into the console buffer; " "it will be the next character read by :func:`getch` or :func:`getche`." msgstr "" -#: ../../library/msvcrt.rst:148 +#: ../../library/msvcrt.rst:153 msgid "Wide char variant of :func:`ungetch`, accepting a Unicode value." msgstr "" -#: ../../library/msvcrt.rst:154 +#: ../../library/msvcrt.rst:159 msgid "Other Functions" msgstr "" -#: ../../library/msvcrt.rst:159 +#: ../../library/msvcrt.rst:164 msgid "" "Force the :c:func:`malloc` heap to clean itself up and return unused blocks " "to the operating system. On failure, this raises :exc:`OSError`." msgstr "" -#: ../../library/msvcrt.rst:164 +#: ../../library/msvcrt.rst:170 +msgid "" +"Changes the location where the C runtime writes an error message for an " +"error that might end the program. *mode* must be one of the :const:`!" +"OUT_\\*` constants listed below or :const:`REPORT_ERRMODE`. Returns the old " +"setting or -1 if an error occurs. Only available in :ref:`debug build of " +"Python `." +msgstr "" + +#: ../../library/msvcrt.rst:179 +msgid "" +"Error sink is determined by the app's type. Only available in :ref:`debug " +"build of Python `." +msgstr "" + +#: ../../library/msvcrt.rst:185 +msgid "" +"Error sink is a standard error. Only available in :ref:`debug build of " +"Python `." +msgstr "" + +#: ../../library/msvcrt.rst:191 +msgid "" +"Error sink is a message box. Only available in :ref:`debug build of Python " +"`." +msgstr "" + +#: ../../library/msvcrt.rst:197 +msgid "" +"Report the current error mode value. Only available in :ref:`debug build of " +"Python `." +msgstr "" + +#: ../../library/msvcrt.rst:203 +msgid "" +"Specifies the destination or destinations for a specific report type " +"generated by :c:func:`!_CrtDbgReport` in the MS VC++ runtime. *type* must be " +"one of the :const:`!CRT_\\*` constants listed below. *mode* must be one of " +"the :const:`!CRTDBG_\\*` constants listed below. Only available in :ref:" +"`debug build of Python `." +msgstr "" + +#: ../../library/msvcrt.rst:212 +msgid "" +"After you use :func:`CrtSetReportMode` to specify :const:`CRTDBG_MODE_FILE`, " +"you can specify the file handle to receive the message text. *type* must be " +"one of the :const:`!CRT_\\*` constants listed below. *file* should be the " +"file handle your want specified. Only available in :ref:`debug build of " +"Python `." +msgstr "" + +#: ../../library/msvcrt.rst:221 +msgid "" +"Warnings, messages, and information that doesn't need immediate attention." +msgstr "" + +#: ../../library/msvcrt.rst:226 +msgid "" +"Errors, unrecoverable problems, and issues that require immediate attention." +msgstr "" + +#: ../../library/msvcrt.rst:231 +msgid "Assertion failures." +msgstr "" + +#: ../../library/msvcrt.rst:236 +msgid "Writes the message to the debugger's output window." +msgstr "" + +#: ../../library/msvcrt.rst:241 +msgid "" +"Writes the message to a user-supplied file handle. :func:`CrtSetReportFile` " +"should be called to define the specific file or stream to use as the " +"destination." +msgstr "" + +#: ../../library/msvcrt.rst:248 +msgid "" +"Creates a message box to display the message along with the ``Abort``, " +"``Retry``, and ``Ignore`` buttons." +msgstr "" + +#: ../../library/msvcrt.rst:254 +msgid "Returns current *mode* for the specified *type*." +msgstr "" + +#: ../../library/msvcrt.rst:259 msgid "The CRT Assembly version, from the :file:`crtassem.h` header file." msgstr "" -#: ../../library/msvcrt.rst:169 +#: ../../library/msvcrt.rst:264 msgid "" "The VC Assembly public key token, from the :file:`crtassem.h` header file." msgstr "" -#: ../../library/msvcrt.rst:174 +#: ../../library/msvcrt.rst:269 msgid "" "The Libraries Assembly name prefix, from the :file:`crtassem.h` header file." msgstr "" diff --git a/library/multiprocessing.po b/library/multiprocessing.po index e935849511..6bbd946213 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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-" @@ -25,15 +25,17 @@ msgstr ":mod:`!multiprocessing` --- 以行程為基礎的平行性" msgid "**Source code:** :source:`Lib/multiprocessing/`" msgstr "**原始碼:**\\ :source:`Lib/multiprocessing/`" -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +#: ../../includes/wasm-ios-notavail.rst:3 +msgid ":ref:`Availability `: not WASI, not iOS." msgstr "" -#: ../../includes/wasm-notavail.rst:5 +#: ../../includes/wasm-ios-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly platforms, or " +"on iOS. See :ref:`wasm-availability` for more information on WASM " +"availability; see :ref:`iOS-availability` for more information on iOS " +"availability." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" @@ -1566,8 +1568,8 @@ msgstr "" #: ../../library/multiprocessing.rst:1011 msgid "" "This number is not equivalent to the number of CPUs the current process can " -"use. The number of usable CPUs can be obtained with ``len(os." -"sched_getaffinity(0))``" +"use. The number of usable CPUs can be obtained with :func:`os." +"process_cpu_count` (or ``len(os.sched_getaffinity(0))``)." msgstr "" #: ../../library/multiprocessing.rst:1015 @@ -1577,39 +1579,46 @@ msgid "" msgstr "" #: ../../library/multiprocessing.rst:1019 -msgid ":func:`os.cpu_count`" -msgstr ":func:`os.cpu_count`" +msgid ":func:`os.cpu_count` :func:`os.process_cpu_count`" +msgstr "" + +#: ../../library/multiprocessing.rst:1024 +msgid "" +"The return value can also be overridden using the :option:`-X cpu_count <-" +"X>` flag or :envvar:`PYTHON_CPU_COUNT` as this is merely a wrapper around " +"the :mod:`os` cpu count APIs." +msgstr "" -#: ../../library/multiprocessing.rst:1023 +#: ../../library/multiprocessing.rst:1030 msgid "" "Return the :class:`Process` object corresponding to the current process." msgstr "" -#: ../../library/multiprocessing.rst:1025 +#: ../../library/multiprocessing.rst:1032 msgid "An analogue of :func:`threading.current_thread`." msgstr "" -#: ../../library/multiprocessing.rst:1029 +#: ../../library/multiprocessing.rst:1036 msgid "" "Return the :class:`Process` object corresponding to the parent process of " "the :func:`current_process`. For the main process, ``parent_process`` will " "be ``None``." msgstr "" -#: ../../library/multiprocessing.rst:1037 +#: ../../library/multiprocessing.rst:1044 msgid "" "Add support for when a program which uses :mod:`multiprocessing` has been " "frozen to produce a Windows executable. (Has been tested with **py2exe**, " "**PyInstaller** and **cx_Freeze**.)" msgstr "" -#: ../../library/multiprocessing.rst:1041 +#: ../../library/multiprocessing.rst:1048 msgid "" "One needs to call this function straight after the ``if __name__ == " "'__main__'`` line of the main module. For example::" msgstr "" -#: ../../library/multiprocessing.rst:1044 +#: ../../library/multiprocessing.rst:1051 msgid "" "from multiprocessing import Process, freeze_support\n" "\n" @@ -1629,13 +1638,13 @@ msgstr "" " freeze_support()\n" " Process(target=f).start()" -#: ../../library/multiprocessing.rst:1053 +#: ../../library/multiprocessing.rst:1060 msgid "" "If the ``freeze_support()`` line is omitted then trying to run the frozen " "executable will raise :exc:`RuntimeError`." msgstr "" -#: ../../library/multiprocessing.rst:1056 +#: ../../library/multiprocessing.rst:1063 msgid "" "Calling ``freeze_support()`` has no effect when invoked on any operating " "system other than Windows. In addition, if the module is being run normally " @@ -1643,7 +1652,7 @@ msgid "" "``freeze_support()`` has no effect." msgstr "" -#: ../../library/multiprocessing.rst:1063 +#: ../../library/multiprocessing.rst:1070 msgid "" "Returns a list of the supported start methods, the first of which is the " "default. The possible start methods are ``'fork'``, ``'spawn'`` and " @@ -1651,13 +1660,13 @@ msgid "" "`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1072 +#: ../../library/multiprocessing.rst:1079 msgid "" "Return a context object which has the same attributes as the :mod:" "`multiprocessing` module." msgstr "" -#: ../../library/multiprocessing.rst:1075 +#: ../../library/multiprocessing.rst:1082 msgid "" "If *method* is ``None`` then the default context is returned. Otherwise " "*method* should be ``'fork'``, ``'spawn'``, ``'forkserver'``. :exc:" @@ -1665,54 +1674,54 @@ msgid "" "ref:`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1084 +#: ../../library/multiprocessing.rst:1091 msgid "Return the name of start method used for starting processes." msgstr "" -#: ../../library/multiprocessing.rst:1086 +#: ../../library/multiprocessing.rst:1093 msgid "" "If the start method has not been fixed and *allow_none* is false, then the " "start method is fixed to the default and the name is returned. If the start " "method has not been fixed and *allow_none* is true then ``None`` is returned." msgstr "" -#: ../../library/multiprocessing.rst:1091 +#: ../../library/multiprocessing.rst:1098 msgid "" "The return value can be ``'fork'``, ``'spawn'``, ``'forkserver'`` or " "``None``. See :ref:`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1098 +#: ../../library/multiprocessing.rst:1105 msgid "" "On macOS, the *spawn* start method is now the default. The *fork* start " "method should be considered unsafe as it can lead to crashes of the " "subprocess. See :issue:`33725`." msgstr "" -#: ../../library/multiprocessing.rst:1104 +#: ../../library/multiprocessing.rst:1111 msgid "" "Set the path of the Python interpreter to use when starting a child process. " "(By default :data:`sys.executable` is used). Embedders will probably need " "to do some thing like ::" msgstr "" -#: ../../library/multiprocessing.rst:1108 +#: ../../library/multiprocessing.rst:1115 msgid "set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe'))" msgstr "set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe'))" -#: ../../library/multiprocessing.rst:1110 +#: ../../library/multiprocessing.rst:1117 msgid "before they can create child processes." msgstr "" -#: ../../library/multiprocessing.rst:1112 +#: ../../library/multiprocessing.rst:1119 msgid "Now supported on POSIX when the ``'spawn'`` start method is used." msgstr "" -#: ../../library/multiprocessing.rst:1115 +#: ../../library/multiprocessing.rst:1122 msgid "Accepts a :term:`path-like object`." msgstr "接受一個\\ :term:`類路徑物件 `。" -#: ../../library/multiprocessing.rst:1120 +#: ../../library/multiprocessing.rst:1127 msgid "" "Set a list of module names for the forkserver main process to attempt to " "import so that their already imported state is inherited by forked " @@ -1721,19 +1730,19 @@ msgid "" "process." msgstr "" -#: ../../library/multiprocessing.rst:1126 +#: ../../library/multiprocessing.rst:1133 msgid "" "For this to work, it must be called before the forkserver process has been " "launched (before creating a :class:`Pool` or starting a :class:`Process`)." msgstr "" -#: ../../library/multiprocessing.rst:1129 +#: ../../library/multiprocessing.rst:1136 msgid "" "Only meaningful when using the ``'forkserver'`` start method. See :ref:" "`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1136 +#: ../../library/multiprocessing.rst:1143 msgid "" "Set the method which should be used to start child processes. The *method* " "argument can be ``'fork'``, ``'spawn'`` or ``'forkserver'``. Raises :exc:" @@ -1743,17 +1752,17 @@ msgid "" "then the context is set to the default context." msgstr "" -#: ../../library/multiprocessing.rst:1143 +#: ../../library/multiprocessing.rst:1150 msgid "" "Note that this should be called at most once, and it should be protected " "inside the ``if __name__ == '__main__'`` clause of the main module." msgstr "" -#: ../../library/multiprocessing.rst:1147 +#: ../../library/multiprocessing.rst:1154 msgid "See :ref:`multiprocessing-start-methods`." msgstr "參閱 :ref:`multiprocessing-start-methods`。" -#: ../../library/multiprocessing.rst:1153 +#: ../../library/multiprocessing.rst:1160 msgid "" ":mod:`multiprocessing` contains no analogues of :func:`threading." "active_count`, :func:`threading.enumerate`, :func:`threading.settrace`, :" @@ -1761,75 +1770,75 @@ msgid "" "local`." msgstr "" -#: ../../library/multiprocessing.rst:1160 +#: ../../library/multiprocessing.rst:1167 msgid "Connection Objects" msgstr "" -#: ../../library/multiprocessing.rst:1164 +#: ../../library/multiprocessing.rst:1171 msgid "" "Connection objects allow the sending and receiving of picklable objects or " "strings. They can be thought of as message oriented connected sockets." msgstr "" -#: ../../library/multiprocessing.rst:1167 +#: ../../library/multiprocessing.rst:1174 msgid "" "Connection objects are usually created using :func:`Pipe ` -- see also :ref:`multiprocessing-listeners-clients`." msgstr "" -#: ../../library/multiprocessing.rst:1175 +#: ../../library/multiprocessing.rst:1182 msgid "" "Send an object to the other end of the connection which should be read " "using :meth:`recv`." msgstr "" -#: ../../library/multiprocessing.rst:1178 +#: ../../library/multiprocessing.rst:1185 msgid "" "The object must be picklable. Very large pickles (approximately 32 MiB+, " "though it depends on the OS) may raise a :exc:`ValueError` exception." msgstr "" -#: ../../library/multiprocessing.rst:1183 +#: ../../library/multiprocessing.rst:1190 msgid "" "Return an object sent from the other end of the connection using :meth:" "`send`. Blocks until there is something to receive. Raises :exc:`EOFError` " "if there is nothing left to receive and the other end was closed." msgstr "" -#: ../../library/multiprocessing.rst:1190 +#: ../../library/multiprocessing.rst:1197 msgid "Return the file descriptor or handle used by the connection." msgstr "" -#: ../../library/multiprocessing.rst:1194 +#: ../../library/multiprocessing.rst:1201 msgid "Close the connection." msgstr "" -#: ../../library/multiprocessing.rst:1196 +#: ../../library/multiprocessing.rst:1203 msgid "This is called automatically when the connection is garbage collected." msgstr "" -#: ../../library/multiprocessing.rst:1200 +#: ../../library/multiprocessing.rst:1207 msgid "Return whether there is any data available to be read." msgstr "" -#: ../../library/multiprocessing.rst:1202 +#: ../../library/multiprocessing.rst:1209 msgid "" "If *timeout* is not specified then it will return immediately. If *timeout* " "is a number then this specifies the maximum time in seconds to block. If " "*timeout* is ``None`` then an infinite timeout is used." msgstr "" -#: ../../library/multiprocessing.rst:1206 +#: ../../library/multiprocessing.rst:1213 msgid "" "Note that multiple connection objects may be polled at once by using :func:" "`multiprocessing.connection.wait`." msgstr "" -#: ../../library/multiprocessing.rst:1211 +#: ../../library/multiprocessing.rst:1218 msgid "Send byte data from a :term:`bytes-like object` as a complete message." msgstr "" -#: ../../library/multiprocessing.rst:1213 +#: ../../library/multiprocessing.rst:1220 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 " @@ -1837,7 +1846,7 @@ msgid "" "exc:`ValueError` exception" msgstr "" -#: ../../library/multiprocessing.rst:1220 +#: ../../library/multiprocessing.rst:1227 msgid "" "Return a complete message of byte data sent from the other end of the " "connection as a string. Blocks until there is something to receive. Raises :" @@ -1845,19 +1854,19 @@ msgid "" "closed." msgstr "" -#: ../../library/multiprocessing.rst:1225 +#: ../../library/multiprocessing.rst:1232 msgid "" "If *maxlength* is specified and the message is longer than *maxlength* then :" "exc:`OSError` is raised and the connection will no longer be readable." msgstr "" -#: ../../library/multiprocessing.rst:1229 +#: ../../library/multiprocessing.rst:1236 msgid "" "This function used to raise :exc:`IOError`, which is now an alias of :exc:" "`OSError`." msgstr "" -#: ../../library/multiprocessing.rst:1236 +#: ../../library/multiprocessing.rst:1243 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 " @@ -1865,38 +1874,38 @@ msgid "" "nothing left to receive and the other end was closed." msgstr "" -#: ../../library/multiprocessing.rst:1242 +#: ../../library/multiprocessing.rst:1249 msgid "" "*buffer* must be a writable :term:`bytes-like object`. If *offset* is given " "then the message will be written into the buffer from that position. Offset " "must be a non-negative integer less than the length of *buffer* (in bytes)." msgstr "" -#: ../../library/multiprocessing.rst:1247 +#: ../../library/multiprocessing.rst:1254 msgid "" "If the buffer is too short then a :exc:`BufferTooShort` exception is raised " "and the complete message is available as ``e.args[0]`` where ``e`` is the " "exception instance." msgstr "" -#: ../../library/multiprocessing.rst:1251 +#: ../../library/multiprocessing.rst:1258 msgid "" "Connection objects themselves can now be transferred between processes " "using :meth:`Connection.send` and :meth:`Connection.recv`." msgstr "" -#: ../../library/multiprocessing.rst:1255 +#: ../../library/multiprocessing.rst:1262 msgid "" "Connection objects also now support the context management protocol -- see :" "ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " "connection object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." msgstr "" -#: ../../library/multiprocessing.rst:1259 +#: ../../library/multiprocessing.rst:1266 msgid "For example:" msgstr "舉例來說:" -#: ../../library/multiprocessing.rst:1261 +#: ../../library/multiprocessing.rst:1268 msgid "" ">>> from multiprocessing import Pipe\n" ">>> a, b = Pipe()\n" @@ -1932,14 +1941,14 @@ msgstr "" ">>> arr2\n" "array('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0])" -#: ../../library/multiprocessing.rst:1284 +#: ../../library/multiprocessing.rst:1291 msgid "" "The :meth:`Connection.recv` method automatically unpickles the data it " "receives, which can be a security risk unless you can trust the process " "which sent the message." msgstr "" -#: ../../library/multiprocessing.rst:1288 +#: ../../library/multiprocessing.rst:1295 msgid "" "Therefore, unless the connection object was produced using :func:`Pipe` you " "should only use the :meth:`~Connection.recv` and :meth:`~Connection.send` " @@ -1947,73 +1956,73 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:1295 +#: ../../library/multiprocessing.rst:1302 msgid "" "If a process is killed while it is trying to read or write to a pipe then " "the data in the pipe is likely to become corrupted, because it may become " "impossible to be sure where the message boundaries lie." msgstr "" -#: ../../library/multiprocessing.rst:1301 +#: ../../library/multiprocessing.rst:1308 msgid "Synchronization primitives" msgstr "" -#: ../../library/multiprocessing.rst:1305 +#: ../../library/multiprocessing.rst:1312 msgid "" "Generally synchronization primitives are not as necessary in a multiprocess " "program as they are in a multithreaded program. See the documentation for :" "mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:1309 +#: ../../library/multiprocessing.rst:1316 msgid "" "Note that one can also create synchronization primitives by using a manager " "object -- see :ref:`multiprocessing-managers`." msgstr "" -#: ../../library/multiprocessing.rst:1314 +#: ../../library/multiprocessing.rst:1321 msgid "A barrier object: a clone of :class:`threading.Barrier`." msgstr "" -#: ../../library/multiprocessing.rst:1320 +#: ../../library/multiprocessing.rst:1327 msgid "" "A bounded semaphore object: a close analog of :class:`threading." "BoundedSemaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1323 -#: ../../library/multiprocessing.rst:1461 +#: ../../library/multiprocessing.rst:1330 +#: ../../library/multiprocessing.rst:1468 msgid "" "A solitary difference from its close analog exists: its ``acquire`` method's " "first argument is named *block*, as is consistent with :meth:`Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1327 +#: ../../library/multiprocessing.rst:1334 msgid "" "On macOS, this is indistinguishable from :class:`Semaphore` because " "``sem_getvalue()`` is not implemented on that platform." msgstr "" -#: ../../library/multiprocessing.rst:1332 +#: ../../library/multiprocessing.rst:1339 msgid "A condition variable: an alias for :class:`threading.Condition`." msgstr "" -#: ../../library/multiprocessing.rst:1334 +#: ../../library/multiprocessing.rst:1341 msgid "" "If *lock* is specified then it should be a :class:`Lock` or :class:`RLock` " "object from :mod:`multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:1337 -#: ../../library/multiprocessing.rst:1875 +#: ../../library/multiprocessing.rst:1344 +#: ../../library/multiprocessing.rst:1882 msgid "The :meth:`~threading.Condition.wait_for` method was added." msgstr "" -#: ../../library/multiprocessing.rst:1342 +#: ../../library/multiprocessing.rst:1349 msgid "A clone of :class:`threading.Event`." msgstr "" -#: ../../library/multiprocessing.rst:1347 +#: ../../library/multiprocessing.rst:1354 msgid "" "A non-recursive lock object: a close analog of :class:`threading.Lock`. Once " "a process or thread has acquired a lock, subsequent attempts to acquire it " @@ -2024,25 +2033,25 @@ msgid "" "as noted." msgstr "" -#: ../../library/multiprocessing.rst:1355 +#: ../../library/multiprocessing.rst:1362 msgid "" "Note that :class:`Lock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.Lock`` initialized with a default " "context." msgstr "" -#: ../../library/multiprocessing.rst:1359 +#: ../../library/multiprocessing.rst:1366 msgid "" ":class:`Lock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1364 -#: ../../library/multiprocessing.rst:1415 +#: ../../library/multiprocessing.rst:1371 +#: ../../library/multiprocessing.rst:1422 msgid "Acquire a lock, blocking or non-blocking." msgstr "" -#: ../../library/multiprocessing.rst:1366 +#: ../../library/multiprocessing.rst:1373 msgid "" "With the *block* argument set to ``True`` (the default), the method call " "will block until the lock is in an unlocked state, then set it to locked and " @@ -2050,14 +2059,14 @@ msgid "" "that in :meth:`threading.Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1371 +#: ../../library/multiprocessing.rst:1378 msgid "" "With the *block* argument set to ``False``, the method call does not block. " "If the lock is currently in a locked state, return ``False``; otherwise set " "the lock to a locked state and return ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1375 +#: ../../library/multiprocessing.rst:1382 msgid "" "When invoked with a positive, floating-point value for *timeout*, block for " "at most the number of seconds specified by *timeout* as long as the lock can " @@ -2071,19 +2080,19 @@ msgid "" "acquired or ``False`` if the timeout period has elapsed." msgstr "" -#: ../../library/multiprocessing.rst:1390 +#: ../../library/multiprocessing.rst:1397 msgid "" "Release a lock. This can be called from any process or thread, not only the " "process or thread which originally acquired the lock." msgstr "" -#: ../../library/multiprocessing.rst:1393 +#: ../../library/multiprocessing.rst:1400 msgid "" "Behavior is the same as in :meth:`threading.Lock.release` except that when " "invoked on an unlocked lock, a :exc:`ValueError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:1399 +#: ../../library/multiprocessing.rst:1406 msgid "" "A recursive lock object: a close analog of :class:`threading.RLock`. A " "recursive lock must be released by the process or thread that acquired it. " @@ -2092,20 +2101,20 @@ msgid "" "release it once for each time it has been acquired." msgstr "" -#: ../../library/multiprocessing.rst:1405 +#: ../../library/multiprocessing.rst:1412 msgid "" "Note that :class:`RLock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.RLock`` initialized with a default " "context." msgstr "" -#: ../../library/multiprocessing.rst:1409 +#: ../../library/multiprocessing.rst:1416 msgid "" ":class:`RLock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1417 +#: ../../library/multiprocessing.rst:1424 msgid "" "When invoked with the *block* argument set to ``True``, block until the lock " "is in an unlocked state (not owned by any process or thread) unless the lock " @@ -2118,7 +2127,7 @@ msgid "" "itself." msgstr "" -#: ../../library/multiprocessing.rst:1427 +#: ../../library/multiprocessing.rst:1434 msgid "" "When invoked with the *block* argument set to ``False``, do not block. If " "the lock has already been acquired (and thus is owned) by another process or " @@ -2129,14 +2138,14 @@ msgid "" "a return value of ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1435 +#: ../../library/multiprocessing.rst:1442 msgid "" "Use and behaviors of the *timeout* argument are the same as in :meth:`Lock." "acquire`. Note that some of these behaviors of *timeout* differ from the " "implemented behaviors in :meth:`threading.RLock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1442 +#: ../../library/multiprocessing.rst:1449 msgid "" "Release a lock, decrementing the recursion level. If after the decrement " "the recursion level is zero, reset the lock to unlocked (not owned by any " @@ -2146,7 +2155,7 @@ msgid "" "locked and owned by the calling process or thread." msgstr "" -#: ../../library/multiprocessing.rst:1450 +#: ../../library/multiprocessing.rst:1457 msgid "" "Only call this method when the calling process or thread owns the lock. An :" "exc:`AssertionError` is raised if this method is called by a process or " @@ -2155,17 +2164,17 @@ msgid "" "from the implemented behavior in :meth:`threading.RLock.release`." msgstr "" -#: ../../library/multiprocessing.rst:1459 +#: ../../library/multiprocessing.rst:1466 msgid "A semaphore object: a close analog of :class:`threading.Semaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1466 +#: ../../library/multiprocessing.rst:1473 msgid "" "On macOS, ``sem_timedwait`` is unsupported, so calling ``acquire()`` with a " "timeout will emulate that function's behavior using a sleeping loop." msgstr "" -#: ../../library/multiprocessing.rst:1471 +#: ../../library/multiprocessing.rst:1478 msgid "" "Some of this package's functionality requires a functioning shared semaphore " "implementation on the host operating system. Without one, the :mod:" @@ -2174,32 +2183,32 @@ msgid "" "additional information." msgstr "" -#: ../../library/multiprocessing.rst:1479 +#: ../../library/multiprocessing.rst:1486 msgid "Shared :mod:`ctypes` Objects" msgstr "共享的 :mod:`ctypes` 物件" -#: ../../library/multiprocessing.rst:1481 +#: ../../library/multiprocessing.rst:1488 msgid "" "It is possible to create shared objects using shared memory which can be " "inherited by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1486 +#: ../../library/multiprocessing.rst:1493 msgid "" "Return a :mod:`ctypes` object allocated from shared memory. By default the " "return value is actually a synchronized wrapper for the object. The object " "itself can be accessed via the *value* attribute of a :class:`Value`." msgstr "" -#: ../../library/multiprocessing.rst:1490 -#: ../../library/multiprocessing.rst:1577 +#: ../../library/multiprocessing.rst:1497 +#: ../../library/multiprocessing.rst:1584 msgid "" "*typecode_or_type* determines the type of the returned object: it is either " "a ctypes type or a one character typecode of the kind used by the :mod:" "`array` module. *\\*args* is passed on to the constructor for the type." msgstr "" -#: ../../library/multiprocessing.rst:1494 +#: ../../library/multiprocessing.rst:1501 msgid "" "If *lock* is ``True`` (the default) then a new recursive lock object is " "created to synchronize access to the value. If *lock* is a :class:`Lock` " @@ -2209,24 +2218,24 @@ msgid "" "\"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1501 +#: ../../library/multiprocessing.rst:1508 msgid "" "Operations like ``+=`` which involve a read and write are not atomic. So " "if, for instance, you want to atomically increment a shared value it is " "insufficient to just do ::" msgstr "" -#: ../../library/multiprocessing.rst:1505 +#: ../../library/multiprocessing.rst:1512 msgid "counter.value += 1" msgstr "counter.value += 1" -#: ../../library/multiprocessing.rst:1507 +#: ../../library/multiprocessing.rst:1514 msgid "" "Assuming the associated lock is recursive (which it is by default) you can " "instead do ::" msgstr "" -#: ../../library/multiprocessing.rst:1510 +#: ../../library/multiprocessing.rst:1517 msgid "" "with counter.get_lock():\n" " counter.value += 1" @@ -2234,19 +2243,19 @@ msgstr "" "with counter.get_lock():\n" " counter.value += 1" -#: ../../library/multiprocessing.rst:1513 -#: ../../library/multiprocessing.rst:1603 -#: ../../library/multiprocessing.rst:1618 +#: ../../library/multiprocessing.rst:1520 +#: ../../library/multiprocessing.rst:1610 +#: ../../library/multiprocessing.rst:1625 msgid "Note that *lock* is a keyword-only argument." msgstr "" -#: ../../library/multiprocessing.rst:1517 +#: ../../library/multiprocessing.rst:1524 msgid "" "Return a ctypes array allocated from shared memory. By default the return " "value is actually a synchronized wrapper for the array." msgstr "" -#: ../../library/multiprocessing.rst:1520 +#: ../../library/multiprocessing.rst:1527 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -2256,7 +2265,7 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1527 +#: ../../library/multiprocessing.rst:1534 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " "synchronize access to the value. If *lock* is a :class:`Lock` or :class:" @@ -2266,28 +2275,28 @@ msgid "" "safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1534 +#: ../../library/multiprocessing.rst:1541 msgid "Note that *lock* is a keyword only argument." msgstr "" -#: ../../library/multiprocessing.rst:1536 +#: ../../library/multiprocessing.rst:1543 msgid "" "Note that an array of :data:`ctypes.c_char` has *value* and *raw* attributes " "which allow one to use it to store and retrieve strings." msgstr "" -#: ../../library/multiprocessing.rst:1541 +#: ../../library/multiprocessing.rst:1548 msgid "The :mod:`multiprocessing.sharedctypes` module" msgstr ":mod:`multiprocessing.sharedctypes` 模組" -#: ../../library/multiprocessing.rst:1546 +#: ../../library/multiprocessing.rst:1553 msgid "" "The :mod:`multiprocessing.sharedctypes` module provides functions for " "allocating :mod:`ctypes` objects from shared memory which can be inherited " "by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1552 +#: ../../library/multiprocessing.rst:1559 msgid "" "Although it is possible to store a pointer in shared memory remember that " "this will refer to a location in the address space of a specific process. " @@ -2296,11 +2305,11 @@ msgid "" "may cause a crash." msgstr "" -#: ../../library/multiprocessing.rst:1560 +#: ../../library/multiprocessing.rst:1567 msgid "Return a ctypes array allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1562 +#: ../../library/multiprocessing.rst:1569 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -2310,40 +2319,40 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1569 +#: ../../library/multiprocessing.rst:1576 msgid "" "Note that setting and getting an element is potentially non-atomic -- use :" "func:`Array` instead to make sure that access is automatically synchronized " "using a lock." msgstr "" -#: ../../library/multiprocessing.rst:1575 +#: ../../library/multiprocessing.rst:1582 msgid "Return a ctypes object allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1581 +#: ../../library/multiprocessing.rst:1588 msgid "" "Note that setting and getting the value is potentially non-atomic -- use :" "func:`Value` instead to make sure that access is automatically synchronized " "using a lock." msgstr "" -#: ../../library/multiprocessing.rst:1585 +#: ../../library/multiprocessing.rst:1592 msgid "" "Note that an array of :data:`ctypes.c_char` has ``value`` and ``raw`` " "attributes which allow one to use it to store and retrieve strings -- see " "documentation for :mod:`ctypes`." msgstr "" -#: ../../library/multiprocessing.rst:1591 +#: ../../library/multiprocessing.rst:1598 msgid "" "The same as :func:`RawArray` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "array." msgstr "" -#: ../../library/multiprocessing.rst:1595 -#: ../../library/multiprocessing.rst:1611 +#: ../../library/multiprocessing.rst:1602 +#: ../../library/multiprocessing.rst:1618 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " "synchronize access to the value. If *lock* is a :class:`~multiprocessing." @@ -2353,113 +2362,113 @@ msgid "" "not necessarily be \"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1607 +#: ../../library/multiprocessing.rst:1614 msgid "" "The same as :func:`RawValue` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "object." msgstr "" -#: ../../library/multiprocessing.rst:1622 +#: ../../library/multiprocessing.rst:1629 msgid "" "Return a ctypes object allocated from shared memory which is a copy of the " "ctypes object *obj*." msgstr "" -#: ../../library/multiprocessing.rst:1627 +#: ../../library/multiprocessing.rst:1634 msgid "" "Return a process-safe wrapper object for a ctypes object which uses *lock* " "to synchronize access. If *lock* is ``None`` (the default) then a :class:" "`multiprocessing.RLock` object is created automatically." msgstr "" -#: ../../library/multiprocessing.rst:1631 +#: ../../library/multiprocessing.rst:1638 msgid "" "A synchronized wrapper will have two methods in addition to those of the " "object it wraps: :meth:`get_obj` returns the wrapped object and :meth:" "`get_lock` returns the lock object used for synchronization." msgstr "" -#: ../../library/multiprocessing.rst:1635 +#: ../../library/multiprocessing.rst:1642 msgid "" "Note that accessing the ctypes object through the wrapper can be a lot " "slower than accessing the raw ctypes object." msgstr "" -#: ../../library/multiprocessing.rst:1638 +#: ../../library/multiprocessing.rst:1645 msgid "Synchronized objects support the :term:`context manager` protocol." msgstr "" -#: ../../library/multiprocessing.rst:1642 +#: ../../library/multiprocessing.rst:1649 msgid "" "The table below compares the syntax for creating shared ctypes objects from " "shared memory with the normal ctypes syntax. (In the table ``MyStruct`` is " "some subclass of :class:`ctypes.Structure`.)" msgstr "" -#: ../../library/multiprocessing.rst:1647 +#: ../../library/multiprocessing.rst:1654 msgid "ctypes" msgstr "ctypes" -#: ../../library/multiprocessing.rst:1647 +#: ../../library/multiprocessing.rst:1654 msgid "sharedctypes using type" msgstr "" -#: ../../library/multiprocessing.rst:1647 +#: ../../library/multiprocessing.rst:1654 msgid "sharedctypes using typecode" msgstr "" -#: ../../library/multiprocessing.rst:1649 +#: ../../library/multiprocessing.rst:1656 msgid "c_double(2.4)" msgstr "c_double(2.4)" -#: ../../library/multiprocessing.rst:1649 +#: ../../library/multiprocessing.rst:1656 msgid "RawValue(c_double, 2.4)" msgstr "RawValue(c_double, 2.4)" -#: ../../library/multiprocessing.rst:1649 +#: ../../library/multiprocessing.rst:1656 msgid "RawValue('d', 2.4)" msgstr "RawValue('d', 2.4)" -#: ../../library/multiprocessing.rst:1650 +#: ../../library/multiprocessing.rst:1657 msgid "MyStruct(4, 6)" msgstr "MyStruct(4, 6)" -#: ../../library/multiprocessing.rst:1650 +#: ../../library/multiprocessing.rst:1657 msgid "RawValue(MyStruct, 4, 6)" msgstr "RawValue(MyStruct, 4, 6)" -#: ../../library/multiprocessing.rst:1651 +#: ../../library/multiprocessing.rst:1658 msgid "(c_short * 7)()" msgstr "(c_short * 7)()" -#: ../../library/multiprocessing.rst:1651 +#: ../../library/multiprocessing.rst:1658 msgid "RawArray(c_short, 7)" msgstr "RawArray(c_short, 7)" -#: ../../library/multiprocessing.rst:1651 +#: ../../library/multiprocessing.rst:1658 msgid "RawArray('h', 7)" msgstr "RawArray('h', 7)" -#: ../../library/multiprocessing.rst:1652 +#: ../../library/multiprocessing.rst:1659 msgid "(c_int * 3)(9, 2, 8)" msgstr "(c_int * 3)(9, 2, 8)" -#: ../../library/multiprocessing.rst:1652 +#: ../../library/multiprocessing.rst:1659 msgid "RawArray(c_int, (9, 2, 8))" msgstr "RawArray(c_int, (9, 2, 8))" -#: ../../library/multiprocessing.rst:1652 +#: ../../library/multiprocessing.rst:1659 msgid "RawArray('i', (9, 2, 8))" msgstr "RawArray('i', (9, 2, 8))" -#: ../../library/multiprocessing.rst:1656 +#: ../../library/multiprocessing.rst:1663 msgid "" "Below is an example where a number of ctypes objects are modified by a child " "process::" msgstr "" -#: ../../library/multiprocessing.rst:1659 +#: ../../library/multiprocessing.rst:1666 msgid "" "from multiprocessing import Process, Lock\n" "from multiprocessing.sharedctypes import Value, Array\n" @@ -2525,11 +2534,11 @@ msgstr "" " print(s.value)\n" " print([(a.x, a.y) for a in A])" -#: ../../library/multiprocessing.rst:1694 +#: ../../library/multiprocessing.rst:1701 msgid "The results printed are ::" msgstr "" -#: ../../library/multiprocessing.rst:1696 +#: ../../library/multiprocessing.rst:1703 msgid "" "49\n" "0.1111111111111111\n" @@ -2541,11 +2550,11 @@ msgstr "" "HELLO WORLD\n" "[(3.515625, 39.0625), (33.0625, 4.0), (5.640625, 90.25)]" -#: ../../library/multiprocessing.rst:1707 +#: ../../library/multiprocessing.rst:1714 msgid "Managers" msgstr "" -#: ../../library/multiprocessing.rst:1709 +#: ../../library/multiprocessing.rst:1716 msgid "" "Managers provide a way to create data which can be shared between different " "processes, including sharing over a network between processes running on " @@ -2554,7 +2563,7 @@ msgid "" "proxies." msgstr "" -#: ../../library/multiprocessing.rst:1718 +#: ../../library/multiprocessing.rst:1725 msgid "" "Returns a started :class:`~multiprocessing.managers.SyncManager` object " "which can be used for sharing objects between processes. The returned " @@ -2562,31 +2571,31 @@ msgid "" "will create shared objects and return corresponding proxies." msgstr "" -#: ../../library/multiprocessing.rst:1726 +#: ../../library/multiprocessing.rst:1733 msgid "" "Manager processes will be shutdown as soon as they are garbage collected or " "their parent process exits. The manager classes are defined in the :mod:" "`multiprocessing.managers` module:" msgstr "" -#: ../../library/multiprocessing.rst:1732 +#: ../../library/multiprocessing.rst:1739 msgid "Create a BaseManager object." msgstr "建立一個 BaseManager 物件。" -#: ../../library/multiprocessing.rst:1734 +#: ../../library/multiprocessing.rst:1741 msgid "" "Once created one should call :meth:`start` or ``get_server()." "serve_forever()`` to ensure that the manager object refers to a started " "manager process." msgstr "" -#: ../../library/multiprocessing.rst:1737 +#: ../../library/multiprocessing.rst:1744 msgid "" "*address* is the address on which the manager process listens for new " "connections. If *address* is ``None`` then an arbitrary one is chosen." msgstr "" -#: ../../library/multiprocessing.rst:1740 +#: ../../library/multiprocessing.rst:1747 msgid "" "*authkey* is the authentication key which will be used to check the validity " "of incoming connections to the server process. If *authkey* is ``None`` " @@ -2594,19 +2603,19 @@ msgid "" "it must be a byte string." msgstr "" -#: ../../library/multiprocessing.rst:1745 +#: ../../library/multiprocessing.rst:1752 msgid "" "*serializer* must be ``'pickle'`` (use :mod:`pickle` serialization) or " "``'xmlrpclib'`` (use :mod:`xmlrpc.client` serialization)." msgstr "" -#: ../../library/multiprocessing.rst:1748 +#: ../../library/multiprocessing.rst:1755 msgid "" "*ctx* is a context object, or ``None`` (use the current context). See the :" "func:`get_context` function." msgstr "" -#: ../../library/multiprocessing.rst:1751 +#: ../../library/multiprocessing.rst:1758 msgid "" "*shutdown_timeout* is a timeout in seconds used to wait until the process " "used by the manager completes in the :meth:`shutdown` method. If the " @@ -2614,24 +2623,24 @@ msgid "" "also times out, the process is killed." msgstr "" -#: ../../library/multiprocessing.rst:1756 +#: ../../library/multiprocessing.rst:1763 msgid "Added the *shutdown_timeout* parameter." msgstr "新增 *shutdown_timeout* 參數。" -#: ../../library/multiprocessing.rst:1761 +#: ../../library/multiprocessing.rst:1768 msgid "" "Start a subprocess to start the manager. If *initializer* is not ``None`` " "then the subprocess will call ``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:1766 +#: ../../library/multiprocessing.rst:1773 msgid "" "Returns a :class:`Server` object which represents the actual server under " "the control of the Manager. The :class:`Server` object supports the :meth:" "`serve_forever` method::" msgstr "" -#: ../../library/multiprocessing.rst:1770 +#: ../../library/multiprocessing.rst:1777 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> manager = BaseManager(address=('', 50000), authkey=b'abc')\n" @@ -2643,15 +2652,15 @@ msgstr "" ">>> server = manager.get_server()\n" ">>> server.serve_forever()" -#: ../../library/multiprocessing.rst:1775 +#: ../../library/multiprocessing.rst:1782 msgid ":class:`Server` additionally has an :attr:`address` attribute." msgstr "" -#: ../../library/multiprocessing.rst:1779 +#: ../../library/multiprocessing.rst:1786 msgid "Connect a local manager object to a remote manager process::" msgstr "" -#: ../../library/multiprocessing.rst:1781 +#: ../../library/multiprocessing.rst:1788 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')\n" @@ -2661,29 +2670,29 @@ msgstr "" ">>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')\n" ">>> m.connect()" -#: ../../library/multiprocessing.rst:1787 +#: ../../library/multiprocessing.rst:1794 msgid "" "Stop the process used by the manager. This is only available if :meth:" "`start` has been used to start the server process." msgstr "" -#: ../../library/multiprocessing.rst:1790 +#: ../../library/multiprocessing.rst:1797 msgid "This can be called multiple times." msgstr "" -#: ../../library/multiprocessing.rst:1794 +#: ../../library/multiprocessing.rst:1801 msgid "" "A classmethod which can be used for registering a type or callable with the " "manager class." msgstr "" -#: ../../library/multiprocessing.rst:1797 +#: ../../library/multiprocessing.rst:1804 msgid "" "*typeid* is a \"type identifier\" which is used to identify a particular " "type of shared object. This must be a string." msgstr "" -#: ../../library/multiprocessing.rst:1800 +#: ../../library/multiprocessing.rst:1807 msgid "" "*callable* is a callable used for creating objects for this type " "identifier. If a manager instance will be connected to the server using " @@ -2691,14 +2700,14 @@ msgid "" "then this can be left as ``None``." msgstr "" -#: ../../library/multiprocessing.rst:1806 +#: ../../library/multiprocessing.rst:1813 msgid "" "*proxytype* is a subclass of :class:`BaseProxy` which is used to create " "proxies for shared objects with this *typeid*. If ``None`` then a proxy " "class is created automatically." msgstr "" -#: ../../library/multiprocessing.rst:1810 +#: ../../library/multiprocessing.rst:1817 msgid "" "*exposed* is used to specify a sequence of method names which proxies for " "this typeid should be allowed to access using :meth:`BaseProxy." @@ -2709,7 +2718,7 @@ msgid "" "method and whose name does not begin with ``'_'``.)" msgstr "" -#: ../../library/multiprocessing.rst:1819 +#: ../../library/multiprocessing.rst:1826 msgid "" "*method_to_typeid* is a mapping used to specify the return type of those " "exposed methods which should return a proxy. It maps method names to typeid " @@ -2719,22 +2728,22 @@ msgid "" "returned by the method will be copied by value." msgstr "" -#: ../../library/multiprocessing.rst:1826 +#: ../../library/multiprocessing.rst:1833 msgid "" "*create_method* determines whether a method should be created with name " "*typeid* which can be used to tell the server process to create a new shared " "object and return a proxy for it. By default it is ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1830 +#: ../../library/multiprocessing.rst:1837 msgid ":class:`BaseManager` instances also have one read-only property:" msgstr "" -#: ../../library/multiprocessing.rst:1834 +#: ../../library/multiprocessing.rst:1841 msgid "The address used by the manager." msgstr "" -#: ../../library/multiprocessing.rst:1836 +#: ../../library/multiprocessing.rst:1843 msgid "" "Manager objects support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` starts the server " @@ -2742,121 +2751,121 @@ msgid "" "object. :meth:`~contextmanager.__exit__` calls :meth:`shutdown`." msgstr "" -#: ../../library/multiprocessing.rst:1842 +#: ../../library/multiprocessing.rst:1849 msgid "" "In previous versions :meth:`~contextmanager.__enter__` did not start the " "manager's server process if it was not already started." msgstr "" -#: ../../library/multiprocessing.rst:1847 +#: ../../library/multiprocessing.rst:1854 msgid "" "A subclass of :class:`BaseManager` which can be used for the synchronization " "of processes. Objects of this type are returned by :func:`multiprocessing." "Manager`." msgstr "" -#: ../../library/multiprocessing.rst:1851 +#: ../../library/multiprocessing.rst:1858 msgid "" "Its methods create and return :ref:`multiprocessing-proxy_objects` for a " "number of commonly used data types to be synchronized across processes. This " "notably includes shared lists and dictionaries." msgstr "" -#: ../../library/multiprocessing.rst:1857 +#: ../../library/multiprocessing.rst:1864 msgid "" "Create a shared :class:`threading.Barrier` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1864 +#: ../../library/multiprocessing.rst:1871 msgid "" "Create a shared :class:`threading.BoundedSemaphore` object and return a " "proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1869 +#: ../../library/multiprocessing.rst:1876 msgid "" "Create a shared :class:`threading.Condition` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1872 +#: ../../library/multiprocessing.rst:1879 msgid "" "If *lock* is supplied then it should be a proxy for a :class:`threading." "Lock` or :class:`threading.RLock` object." msgstr "" -#: ../../library/multiprocessing.rst:1880 +#: ../../library/multiprocessing.rst:1887 msgid "" "Create a shared :class:`threading.Event` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1884 +#: ../../library/multiprocessing.rst:1891 msgid "" "Create a shared :class:`threading.Lock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1888 +#: ../../library/multiprocessing.rst:1895 msgid "Create a shared :class:`Namespace` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1892 +#: ../../library/multiprocessing.rst:1899 msgid "Create a shared :class:`queue.Queue` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1896 +#: ../../library/multiprocessing.rst:1903 msgid "" "Create a shared :class:`threading.RLock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1900 +#: ../../library/multiprocessing.rst:1907 msgid "" "Create a shared :class:`threading.Semaphore` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1905 +#: ../../library/multiprocessing.rst:1912 msgid "Create an array and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1909 +#: ../../library/multiprocessing.rst:1916 msgid "" "Create an object with a writable ``value`` attribute and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1916 +#: ../../library/multiprocessing.rst:1923 msgid "Create a shared :class:`dict` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1921 +#: ../../library/multiprocessing.rst:1928 msgid "Create a shared :class:`list` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1923 +#: ../../library/multiprocessing.rst:1930 msgid "" "Shared objects are capable of being nested. For example, a shared container " "object such as a shared list can contain other shared objects which will all " "be managed and synchronized by the :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:1930 +#: ../../library/multiprocessing.rst:1937 msgid "A type that can register with :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:1932 +#: ../../library/multiprocessing.rst:1939 msgid "" "A namespace object has no public methods, but does have writable attributes. " "Its representation shows the values of its attributes." msgstr "" -#: ../../library/multiprocessing.rst:1935 +#: ../../library/multiprocessing.rst:1942 msgid "" "However, when using a proxy for a namespace object, an attribute beginning " "with ``'_'`` will be an attribute of the proxy and not an attribute of the " "referent:" msgstr "" -#: ../../library/multiprocessing.rst:1939 +#: ../../library/multiprocessing.rst:1946 msgid "" ">>> mp_context = multiprocessing.get_context('spawn')\n" ">>> manager = mp_context.Manager()\n" @@ -2868,18 +2877,18 @@ msgid "" "Namespace(x=10, y='hello')" msgstr "" -#: ../../library/multiprocessing.rst:1952 +#: ../../library/multiprocessing.rst:1959 msgid "Customized managers" msgstr "" -#: ../../library/multiprocessing.rst:1954 +#: ../../library/multiprocessing.rst:1961 msgid "" "To create one's own manager, one creates a subclass of :class:`BaseManager` " "and uses the :meth:`~BaseManager.register` classmethod to register new types " "or callables with the manager class. For example::" msgstr "" -#: ../../library/multiprocessing.rst:1958 +#: ../../library/multiprocessing.rst:1965 msgid "" "from multiprocessing.managers import BaseManager\n" "\n" @@ -2919,23 +2928,23 @@ msgstr "" " print(maths.add(4, 3)) # 印出 7\n" " print(maths.mul(7, 8)) # 印出 56" -#: ../../library/multiprocessing.rst:1979 +#: ../../library/multiprocessing.rst:1986 msgid "Using a remote manager" msgstr "" -#: ../../library/multiprocessing.rst:1981 +#: ../../library/multiprocessing.rst:1988 msgid "" "It is possible to run a manager server on one machine and have clients use " "it from other machines (assuming that the firewalls involved allow it)." msgstr "" -#: ../../library/multiprocessing.rst:1984 +#: ../../library/multiprocessing.rst:1991 msgid "" "Running the following commands creates a server for a single shared queue " "which remote clients can access::" msgstr "" -#: ../../library/multiprocessing.rst:1987 +#: ../../library/multiprocessing.rst:1994 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> from queue import Queue\n" @@ -2955,11 +2964,11 @@ msgstr "" ">>> s = m.get_server()\n" ">>> s.serve_forever()" -#: ../../library/multiprocessing.rst:1996 +#: ../../library/multiprocessing.rst:2003 msgid "One client can access the server as follows::" msgstr "" -#: ../../library/multiprocessing.rst:1998 +#: ../../library/multiprocessing.rst:2005 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> class QueueManager(BaseManager): pass\n" @@ -2979,11 +2988,11 @@ msgstr "" ">>> queue = m.get_queue()\n" ">>> queue.put('hello')" -#: ../../library/multiprocessing.rst:2006 +#: ../../library/multiprocessing.rst:2013 msgid "Another client can also use it::" msgstr "" -#: ../../library/multiprocessing.rst:2008 +#: ../../library/multiprocessing.rst:2015 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> class QueueManager(BaseManager): pass\n" @@ -3005,13 +3014,13 @@ msgstr "" ">>> queue.get()\n" "'hello'" -#: ../../library/multiprocessing.rst:2017 +#: ../../library/multiprocessing.rst:2024 msgid "" "Local processes can also access that queue, using the code from above on the " "client to access it remotely::" msgstr "" -#: ../../library/multiprocessing.rst:2020 +#: ../../library/multiprocessing.rst:2027 msgid "" ">>> from multiprocessing import Process, Queue\n" ">>> from multiprocessing.managers import BaseManager\n" @@ -3051,18 +3060,18 @@ msgstr "" ">>> s = m.get_server()\n" ">>> s.serve_forever()" -#: ../../library/multiprocessing.rst:2042 +#: ../../library/multiprocessing.rst:2049 msgid "Proxy Objects" msgstr "" -#: ../../library/multiprocessing.rst:2044 +#: ../../library/multiprocessing.rst:2051 msgid "" "A proxy is an object which *refers* to a shared object which lives " "(presumably) in a different process. The shared object is said to be the " "*referent* of the proxy. Multiple proxy objects may have the same referent." msgstr "" -#: ../../library/multiprocessing.rst:2048 +#: ../../library/multiprocessing.rst:2055 msgid "" "A proxy object has methods which invoke corresponding methods of its " "referent (although not every method of the referent will necessarily be " @@ -3070,7 +3079,7 @@ msgid "" "its referent can:" msgstr "" -#: ../../library/multiprocessing.rst:2052 +#: ../../library/multiprocessing.rst:2059 msgid "" ">>> mp_context = multiprocessing.get_context('spawn')\n" ">>> manager = mp_context.Manager()\n" @@ -3096,14 +3105,14 @@ msgstr "" ">>> l[2:5]\n" "[4, 9, 16]" -#: ../../library/multiprocessing.rst:2066 +#: ../../library/multiprocessing.rst:2073 msgid "" "Notice that applying :func:`str` to a proxy will return the representation " "of the referent, whereas applying :func:`repr` will return the " "representation of the proxy." msgstr "" -#: ../../library/multiprocessing.rst:2070 +#: ../../library/multiprocessing.rst:2077 msgid "" "An important feature of proxy objects is that they are picklable so they can " "be passed between processes. As such, a referent can contain :ref:" @@ -3111,7 +3120,7 @@ msgid "" "lists, dicts, and other :ref:`multiprocessing-proxy_objects`:" msgstr "" -#: ../../library/multiprocessing.rst:2075 +#: ../../library/multiprocessing.rst:2082 msgid "" ">>> a = manager.list()\n" ">>> b = manager.list()\n" @@ -3123,11 +3132,11 @@ msgid "" "['hello'] ['hello']" msgstr "" -#: ../../library/multiprocessing.rst:2086 +#: ../../library/multiprocessing.rst:2093 msgid "Similarly, dict and list proxies may be nested inside one another::" msgstr "" -#: ../../library/multiprocessing.rst:2088 +#: ../../library/multiprocessing.rst:2095 msgid "" ">>> l_outer = manager.list([ manager.dict() for i in range(2) ])\n" ">>> d_first_inner = l_outer[0]\n" @@ -3151,7 +3160,7 @@ msgstr "" ">>> print(l_outer[1])\n" "{'c': 3, 'z': 26}" -#: ../../library/multiprocessing.rst:2099 +#: ../../library/multiprocessing.rst:2106 msgid "" "If standard (non-proxy) :class:`list` or :class:`dict` objects are contained " "in a referent, modifications to those mutable values will not be propagated " @@ -3162,7 +3171,7 @@ msgid "" "assign the modified value to the container proxy::" msgstr "" -#: ../../library/multiprocessing.rst:2107 +#: ../../library/multiprocessing.rst:2114 msgid "" "# create a list proxy and append a mutable object (a dictionary)\n" "lproxy = manager.list()\n" @@ -3176,20 +3185,20 @@ msgid "" "lproxy[0] = d" msgstr "" -#: ../../library/multiprocessing.rst:2118 +#: ../../library/multiprocessing.rst:2125 msgid "" "This approach is perhaps less convenient than employing nested :ref:" "`multiprocessing-proxy_objects` for most use cases but also demonstrates a " "level of control over the synchronization." msgstr "" -#: ../../library/multiprocessing.rst:2124 +#: ../../library/multiprocessing.rst:2131 msgid "" "The proxy types in :mod:`multiprocessing` do nothing to support comparisons " "by value. So, for instance, we have:" msgstr "" -#: ../../library/multiprocessing.rst:2127 +#: ../../library/multiprocessing.rst:2134 msgid "" ">>> manager.list([1,2,3]) == [1,2,3]\n" "False" @@ -3197,48 +3206,48 @@ msgstr "" ">>> manager.list([1,2,3]) == [1,2,3]\n" "False" -#: ../../library/multiprocessing.rst:2132 +#: ../../library/multiprocessing.rst:2139 msgid "" "One should just use a copy of the referent instead when making comparisons." msgstr "" -#: ../../library/multiprocessing.rst:2136 +#: ../../library/multiprocessing.rst:2143 msgid "Proxy objects are instances of subclasses of :class:`BaseProxy`." msgstr "" -#: ../../library/multiprocessing.rst:2140 +#: ../../library/multiprocessing.rst:2147 msgid "Call and return the result of a method of the proxy's referent." msgstr "" -#: ../../library/multiprocessing.rst:2142 +#: ../../library/multiprocessing.rst:2149 msgid "" "If ``proxy`` is a proxy whose referent is ``obj`` then the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2144 +#: ../../library/multiprocessing.rst:2151 msgid "proxy._callmethod(methodname, args, kwds)" msgstr "proxy._callmethod(methodname, args, kwds)" -#: ../../library/multiprocessing.rst:2146 +#: ../../library/multiprocessing.rst:2153 msgid "will evaluate the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2148 +#: ../../library/multiprocessing.rst:2155 msgid "getattr(obj, methodname)(*args, **kwds)" msgstr "getattr(obj, methodname)(*args, **kwds)" -#: ../../library/multiprocessing.rst:2150 +#: ../../library/multiprocessing.rst:2157 msgid "in the manager's process." msgstr "" -#: ../../library/multiprocessing.rst:2152 +#: ../../library/multiprocessing.rst:2159 msgid "" "The returned value will be a copy of the result of the call or a proxy to a " "new shared object -- see documentation for the *method_to_typeid* argument " "of :meth:`BaseManager.register`." msgstr "" -#: ../../library/multiprocessing.rst:2156 +#: ../../library/multiprocessing.rst:2163 msgid "" "If an exception is raised by the call, then is re-raised by :meth:" "`_callmethod`. If some other exception is raised in the manager's process " @@ -3246,17 +3255,17 @@ msgid "" "meth:`_callmethod`." msgstr "" -#: ../../library/multiprocessing.rst:2161 +#: ../../library/multiprocessing.rst:2168 msgid "" "Note in particular that an exception will be raised if *methodname* has not " "been *exposed*." msgstr "" -#: ../../library/multiprocessing.rst:2164 +#: ../../library/multiprocessing.rst:2171 msgid "An example of the usage of :meth:`_callmethod`:" msgstr "" -#: ../../library/multiprocessing.rst:2166 +#: ../../library/multiprocessing.rst:2173 msgid "" ">>> l = manager.list(range(10))\n" ">>> l._callmethod('__len__')\n" @@ -3278,69 +3287,69 @@ msgstr "" "...\n" "IndexError: list index out of range" -#: ../../library/multiprocessing.rst:2180 +#: ../../library/multiprocessing.rst:2187 msgid "Return a copy of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2182 +#: ../../library/multiprocessing.rst:2189 msgid "If the referent is unpicklable then this will raise an exception." msgstr "" -#: ../../library/multiprocessing.rst:2186 +#: ../../library/multiprocessing.rst:2193 msgid "Return a representation of the proxy object." msgstr "" -#: ../../library/multiprocessing.rst:2190 +#: ../../library/multiprocessing.rst:2197 msgid "Return the representation of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2194 +#: ../../library/multiprocessing.rst:2201 msgid "Cleanup" msgstr "" -#: ../../library/multiprocessing.rst:2196 +#: ../../library/multiprocessing.rst:2203 msgid "" "A proxy object uses a weakref callback so that when it gets garbage " "collected it deregisters itself from the manager which owns its referent." msgstr "" -#: ../../library/multiprocessing.rst:2199 +#: ../../library/multiprocessing.rst:2206 msgid "" "A shared object gets deleted from the manager process when there are no " "longer any proxies referring to it." msgstr "" -#: ../../library/multiprocessing.rst:2204 +#: ../../library/multiprocessing.rst:2211 msgid "Process Pools" msgstr "" -#: ../../library/multiprocessing.rst:2209 +#: ../../library/multiprocessing.rst:2216 msgid "" "One can create a pool of processes which will carry out tasks submitted to " "it with the :class:`Pool` class." msgstr "" -#: ../../library/multiprocessing.rst:2214 +#: ../../library/multiprocessing.rst:2221 msgid "" "A process pool object which controls a pool of worker processes to which " "jobs can be submitted. It supports asynchronous results with timeouts and " "callbacks and has a parallel map implementation." msgstr "" -#: ../../library/multiprocessing.rst:2218 +#: ../../library/multiprocessing.rst:2225 msgid "" "*processes* is the number of worker processes to use. If *processes* is " -"``None`` then the number returned by :func:`os.cpu_count` is used." +"``None`` then the number returned by :func:`os.process_cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2221 -#: ../../library/multiprocessing.rst:2782 +#: ../../library/multiprocessing.rst:2228 +#: ../../library/multiprocessing.rst:2792 msgid "" "If *initializer* is not ``None`` then each worker process will call " "``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:2224 +#: ../../library/multiprocessing.rst:2231 msgid "" "*maxtasksperchild* is the number of tasks a worker process can complete " "before it will exit and be replaced with a fresh worker process, to enable " @@ -3348,7 +3357,7 @@ msgid "" "which means worker processes will live as long as the pool." msgstr "" -#: ../../library/multiprocessing.rst:2229 +#: ../../library/multiprocessing.rst:2236 msgid "" "*context* can be used to specify the context used for starting the worker " "processes. Usually a pool is created using the function :func:" @@ -3356,13 +3365,13 @@ msgid "" "both cases *context* is set appropriately." msgstr "" -#: ../../library/multiprocessing.rst:2235 +#: ../../library/multiprocessing.rst:2242 msgid "" "Note that the methods of the pool object should only be called by the " "process which created the pool." msgstr "" -#: ../../library/multiprocessing.rst:2239 +#: ../../library/multiprocessing.rst:2246 msgid "" ":class:`multiprocessing.pool` objects have internal resources that need to " "be properly managed (like any other resource) by using the pool as a context " @@ -3370,22 +3379,28 @@ msgid "" "to do this can lead to the process hanging on finalization." msgstr "" -#: ../../library/multiprocessing.rst:2244 +#: ../../library/multiprocessing.rst:2251 msgid "" "Note that it is **not correct** to rely on the garbage collector to destroy " "the pool as CPython does not assure that the finalizer of the pool will be " "called (see :meth:`object.__del__` for more information)." msgstr "" -#: ../../library/multiprocessing.rst:2248 +#: ../../library/multiprocessing.rst:2255 msgid "Added the *maxtasksperchild* parameter." msgstr "新增 *maxtasksperchild* 參數。" -#: ../../library/multiprocessing.rst:2251 +#: ../../library/multiprocessing.rst:2258 msgid "Added the *context* parameter." msgstr "新增 *context* 參數。" -#: ../../library/multiprocessing.rst:2256 +#: ../../library/multiprocessing.rst:2261 +msgid "" +"*processes* uses :func:`os.process_cpu_count` by default, instead of :func:" +"`os.cpu_count`." +msgstr "" + +#: ../../library/multiprocessing.rst:2267 msgid "" "Worker processes within a :class:`Pool` typically live for the complete " "duration of the Pool's work queue. A frequent pattern found in other systems " @@ -3396,7 +3411,7 @@ msgid "" "ability to the end user." msgstr "" -#: ../../library/multiprocessing.rst:2266 +#: ../../library/multiprocessing.rst:2277 msgid "" "Call *func* with arguments *args* and keyword arguments *kwds*. It blocks " "until the result is ready. Given this blocks, :meth:`apply_async` is better " @@ -3404,14 +3419,14 @@ msgid "" "executed in one of the workers of the pool." msgstr "" -#: ../../library/multiprocessing.rst:2273 +#: ../../library/multiprocessing.rst:2284 msgid "" "A variant of the :meth:`apply` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2276 -#: ../../library/multiprocessing.rst:2307 +#: ../../library/multiprocessing.rst:2287 +#: ../../library/multiprocessing.rst:2318 msgid "" "If *callback* is specified then it should be a callable which accepts a " "single argument. When the result becomes ready *callback* is applied to it, " @@ -3419,60 +3434,60 @@ msgid "" "applied instead." msgstr "" -#: ../../library/multiprocessing.rst:2281 -#: ../../library/multiprocessing.rst:2312 +#: ../../library/multiprocessing.rst:2292 +#: ../../library/multiprocessing.rst:2323 msgid "" "If *error_callback* is specified then it should be a callable which accepts " "a single argument. If the target function fails, then the *error_callback* " "is called with the exception instance." msgstr "" -#: ../../library/multiprocessing.rst:2285 -#: ../../library/multiprocessing.rst:2316 +#: ../../library/multiprocessing.rst:2296 +#: ../../library/multiprocessing.rst:2327 msgid "" "Callbacks should complete immediately since otherwise the thread which " "handles the results will get blocked." msgstr "" -#: ../../library/multiprocessing.rst:2290 +#: ../../library/multiprocessing.rst:2301 msgid "" "A parallel equivalent of the :func:`map` built-in function (it supports only " "one *iterable* argument though, for multiple iterables see :meth:`starmap`). " "It blocks until the result is ready." msgstr "" -#: ../../library/multiprocessing.rst:2294 +#: ../../library/multiprocessing.rst:2305 msgid "" "This method chops the iterable into a number of chunks which it submits to " "the process pool as separate tasks. The (approximate) size of these chunks " "can be specified by setting *chunksize* to a positive integer." msgstr "" -#: ../../library/multiprocessing.rst:2298 +#: ../../library/multiprocessing.rst:2309 msgid "" "Note that it may cause high memory usage for very long iterables. Consider " "using :meth:`imap` or :meth:`imap_unordered` with explicit *chunksize* " "option for better efficiency." msgstr "" -#: ../../library/multiprocessing.rst:2304 +#: ../../library/multiprocessing.rst:2315 msgid "" "A variant of the :meth:`.map` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2321 +#: ../../library/multiprocessing.rst:2332 msgid "A lazier version of :meth:`.map`." msgstr "" -#: ../../library/multiprocessing.rst:2323 +#: ../../library/multiprocessing.rst:2334 msgid "" "The *chunksize* argument is the same as the one used by the :meth:`.map` " "method. For very long iterables using a large value for *chunksize* can " "make the job complete **much** faster than using the default value of ``1``." msgstr "" -#: ../../library/multiprocessing.rst:2328 +#: ../../library/multiprocessing.rst:2339 msgid "" "Also if *chunksize* is ``1`` then the :meth:`!next` method of the iterator " "returned by the :meth:`imap` method has an optional *timeout* parameter: " @@ -3480,65 +3495,65 @@ msgid "" "result cannot be returned within *timeout* seconds." msgstr "" -#: ../../library/multiprocessing.rst:2335 +#: ../../library/multiprocessing.rst:2346 msgid "" "The same as :meth:`imap` except that the ordering of the results from the " "returned iterator should be considered arbitrary. (Only when there is only " "one worker process is the order guaranteed to be \"correct\".)" msgstr "" -#: ../../library/multiprocessing.rst:2341 +#: ../../library/multiprocessing.rst:2352 msgid "" "Like :meth:`~multiprocessing.pool.Pool.map` except that the elements of the " "*iterable* are expected to be iterables that are unpacked as arguments." msgstr "" -#: ../../library/multiprocessing.rst:2345 +#: ../../library/multiprocessing.rst:2356 msgid "" "Hence an *iterable* of ``[(1,2), (3, 4)]`` results in ``[func(1,2), " "func(3,4)]``." msgstr "" -#: ../../library/multiprocessing.rst:2352 +#: ../../library/multiprocessing.rst:2363 msgid "" "A combination of :meth:`starmap` and :meth:`map_async` that iterates over " "*iterable* of iterables and calls *func* with the iterables unpacked. " "Returns a result object." msgstr "" -#: ../../library/multiprocessing.rst:2360 +#: ../../library/multiprocessing.rst:2371 msgid "" "Prevents any more tasks from being submitted to the pool. Once all the " "tasks have been completed the worker processes will exit." msgstr "" -#: ../../library/multiprocessing.rst:2365 +#: ../../library/multiprocessing.rst:2376 msgid "" "Stops the worker processes immediately without completing outstanding work. " "When the pool object is garbage collected :meth:`terminate` will be called " "immediately." msgstr "" -#: ../../library/multiprocessing.rst:2371 +#: ../../library/multiprocessing.rst:2382 msgid "" "Wait for the worker processes to exit. One must call :meth:`close` or :meth:" "`terminate` before using :meth:`join`." msgstr "" -#: ../../library/multiprocessing.rst:2374 +#: ../../library/multiprocessing.rst:2385 msgid "" "Pool objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the pool " "object, and :meth:`~contextmanager.__exit__` calls :meth:`terminate`." msgstr "" -#: ../../library/multiprocessing.rst:2382 +#: ../../library/multiprocessing.rst:2393 msgid "" "The class of the result returned by :meth:`Pool.apply_async` and :meth:`Pool." "map_async`." msgstr "" -#: ../../library/multiprocessing.rst:2387 +#: ../../library/multiprocessing.rst:2398 msgid "" "Return the result when it arrives. If *timeout* is not ``None`` and the " "result does not arrive within *timeout* seconds then :exc:`multiprocessing." @@ -3546,31 +3561,31 @@ msgid "" "exception will be reraised by :meth:`get`." msgstr "" -#: ../../library/multiprocessing.rst:2394 +#: ../../library/multiprocessing.rst:2405 msgid "Wait until the result is available or until *timeout* seconds pass." msgstr "" -#: ../../library/multiprocessing.rst:2398 +#: ../../library/multiprocessing.rst:2409 msgid "Return whether the call has completed." msgstr "" -#: ../../library/multiprocessing.rst:2402 +#: ../../library/multiprocessing.rst:2413 msgid "" "Return whether the call completed without raising an exception. Will raise :" "exc:`ValueError` if the result is not ready." msgstr "" -#: ../../library/multiprocessing.rst:2405 +#: ../../library/multiprocessing.rst:2416 msgid "" "If the result is not ready, :exc:`ValueError` is raised instead of :exc:" "`AssertionError`." msgstr "" -#: ../../library/multiprocessing.rst:2409 +#: ../../library/multiprocessing.rst:2420 msgid "The following example demonstrates the use of a pool::" msgstr "" -#: ../../library/multiprocessing.rst:2411 +#: ../../library/multiprocessing.rst:2422 msgid "" "from multiprocessing import Pool\n" "import time\n" @@ -3598,17 +3613,17 @@ msgid "" "TimeoutError" msgstr "" -#: ../../library/multiprocessing.rst:2436 +#: ../../library/multiprocessing.rst:2447 msgid "Listeners and Clients" msgstr "" -#: ../../library/multiprocessing.rst:2441 +#: ../../library/multiprocessing.rst:2452 msgid "" "Usually message passing between processes is done using queues or by using :" "class:`~Connection` objects returned by :func:`~multiprocessing.Pipe`." msgstr "" -#: ../../library/multiprocessing.rst:2445 +#: ../../library/multiprocessing.rst:2456 msgid "" "However, the :mod:`multiprocessing.connection` module allows some extra " "flexibility. It basically gives a high level message oriented API for " @@ -3617,46 +3632,46 @@ msgid "" "multiple connections at the same time." msgstr "" -#: ../../library/multiprocessing.rst:2454 +#: ../../library/multiprocessing.rst:2465 msgid "" "Send a randomly generated message to the other end of the connection and " "wait for a reply." msgstr "" -#: ../../library/multiprocessing.rst:2457 +#: ../../library/multiprocessing.rst:2468 msgid "" "If the reply matches the digest of the message using *authkey* as the key " "then a welcome message is sent to the other end of the connection. " "Otherwise :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2463 +#: ../../library/multiprocessing.rst:2474 msgid "" "Receive a message, calculate the digest of the message using *authkey* as " "the key, and then send the digest back." msgstr "" -#: ../../library/multiprocessing.rst:2466 +#: ../../library/multiprocessing.rst:2477 msgid "" "If a welcome message is not received, then :exc:`~multiprocessing." "AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2471 +#: ../../library/multiprocessing.rst:2482 msgid "" "Attempt to set up a connection to the listener which is using address " "*address*, returning a :class:`~Connection`." msgstr "" -#: ../../library/multiprocessing.rst:2474 +#: ../../library/multiprocessing.rst:2485 msgid "" "The type of the connection is determined by *family* argument, but this can " "generally be omitted since it can usually be inferred from the format of " "*address*. (See :ref:`multiprocessing-address-formats`)" msgstr "" -#: ../../library/multiprocessing.rst:2478 -#: ../../library/multiprocessing.rst:2513 +#: ../../library/multiprocessing.rst:2489 +#: ../../library/multiprocessing.rst:2524 msgid "" "If *authkey* is given and not ``None``, it should be a byte string and will " "be used as the secret key for an HMAC-based authentication challenge. No " @@ -3665,26 +3680,26 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:2486 +#: ../../library/multiprocessing.rst:2497 msgid "" "A wrapper for a bound socket or Windows named pipe which is 'listening' for " "connections." msgstr "" -#: ../../library/multiprocessing.rst:2489 +#: ../../library/multiprocessing.rst:2500 msgid "" "*address* is the address to be used by the bound socket or named pipe of the " "listener object." msgstr "" -#: ../../library/multiprocessing.rst:2494 +#: ../../library/multiprocessing.rst:2505 msgid "" "If an address of '0.0.0.0' is used, the address will not be a connectable " "end point on Windows. If you require a connectable end-point, you should use " "'127.0.0.1'." msgstr "" -#: ../../library/multiprocessing.rst:2498 +#: ../../library/multiprocessing.rst:2509 msgid "" "*family* is the type of socket (or named pipe) to use. This can be one of " "the strings ``'AF_INET'`` (for a TCP socket), ``'AF_UNIX'`` (for a Unix " @@ -3698,49 +3713,49 @@ msgid "" "using :func:`tempfile.mkstemp`." msgstr "" -#: ../../library/multiprocessing.rst:2509 +#: ../../library/multiprocessing.rst:2520 msgid "" "If the listener object uses a socket then *backlog* (1 by default) is passed " "to the :meth:`~socket.socket.listen` method of the socket once it has been " "bound." msgstr "" -#: ../../library/multiprocessing.rst:2521 +#: ../../library/multiprocessing.rst:2532 msgid "" "Accept a connection on the bound socket or named pipe of the listener object " "and return a :class:`~Connection` object. If authentication is attempted and " "fails, then :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2528 +#: ../../library/multiprocessing.rst:2539 msgid "" "Close the bound socket or named pipe of the listener object. This is called " "automatically when the listener is garbage collected. However it is " "advisable to call it explicitly." msgstr "" -#: ../../library/multiprocessing.rst:2532 +#: ../../library/multiprocessing.rst:2543 msgid "Listener objects have the following read-only properties:" msgstr "" -#: ../../library/multiprocessing.rst:2536 +#: ../../library/multiprocessing.rst:2547 msgid "The address which is being used by the Listener object." msgstr "" -#: ../../library/multiprocessing.rst:2540 +#: ../../library/multiprocessing.rst:2551 msgid "" "The address from which the last accepted connection came. If this is " "unavailable then it is ``None``." msgstr "" -#: ../../library/multiprocessing.rst:2543 +#: ../../library/multiprocessing.rst:2554 msgid "" "Listener objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " "listener object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." msgstr "" -#: ../../library/multiprocessing.rst:2550 +#: ../../library/multiprocessing.rst:2561 msgid "" "Wait till an object in *object_list* is ready. Returns the list of those " "objects in *object_list* which are ready. If *timeout* is a float then the " @@ -3749,32 +3764,32 @@ msgid "" "zero timeout." msgstr "" -#: ../../library/multiprocessing.rst:2556 +#: ../../library/multiprocessing.rst:2567 msgid "" "For both POSIX and Windows, an object can appear in *object_list* if it is" msgstr "" -#: ../../library/multiprocessing.rst:2559 +#: ../../library/multiprocessing.rst:2570 msgid "a readable :class:`~multiprocessing.connection.Connection` object;" msgstr "" -#: ../../library/multiprocessing.rst:2560 +#: ../../library/multiprocessing.rst:2571 msgid "a connected and readable :class:`socket.socket` object; or" msgstr "" -#: ../../library/multiprocessing.rst:2561 +#: ../../library/multiprocessing.rst:2572 msgid "" "the :attr:`~multiprocessing.Process.sentinel` attribute of a :class:" "`~multiprocessing.Process` object." msgstr "" -#: ../../library/multiprocessing.rst:2564 +#: ../../library/multiprocessing.rst:2575 msgid "" "A connection or socket object is ready when there is data available to be " "read from it, or the other end has been closed." msgstr "" -#: ../../library/multiprocessing.rst:2567 +#: ../../library/multiprocessing.rst:2578 msgid "" "**POSIX**: ``wait(object_list, timeout)`` almost equivalent ``select." "select(object_list, [], [], timeout)``. The difference is that, if :func:" @@ -3782,7 +3797,7 @@ msgid "" "an error number of ``EINTR``, whereas :func:`wait` will not." msgstr "" -#: ../../library/multiprocessing.rst:2573 +#: ../../library/multiprocessing.rst:2584 msgid "" "**Windows**: An item in *object_list* must either be an integer handle which " "is waitable (according to the definition used by the documentation of the " @@ -3792,18 +3807,18 @@ msgid "" "handles.)" msgstr "" -#: ../../library/multiprocessing.rst:2583 +#: ../../library/multiprocessing.rst:2594 msgid "**Examples**" msgstr "" -#: ../../library/multiprocessing.rst:2585 +#: ../../library/multiprocessing.rst:2596 msgid "" "The following server code creates a listener which uses ``'secret " "password'`` as an authentication key. It then waits for a connection and " "sends some data to the client::" msgstr "" -#: ../../library/multiprocessing.rst:2589 +#: ../../library/multiprocessing.rst:2600 msgid "" "from multiprocessing.connection import Listener\n" "from array import array\n" @@ -3821,13 +3836,13 @@ msgid "" " conn.send_bytes(array('i', [42, 1729]))" msgstr "" -#: ../../library/multiprocessing.rst:2604 +#: ../../library/multiprocessing.rst:2615 msgid "" "The following code connects to the server and receives some data from the " "server::" msgstr "" -#: ../../library/multiprocessing.rst:2607 +#: ../../library/multiprocessing.rst:2618 msgid "" "from multiprocessing.connection import Client\n" "from array import array\n" @@ -3857,15 +3872,14 @@ msgstr "" " print(conn.recv_bytes_into(arr)) # => 8\n" " print(arr) # => array('i', [42, 1729, 0, 0, 0])" -#: ../../library/multiprocessing.rst:2621 +#: ../../library/multiprocessing.rst:2632 msgid "" "The following code uses :func:`~multiprocessing.connection.wait` to wait for " "messages from multiple processes at once::" msgstr "" -#: ../../library/multiprocessing.rst:2624 +#: ../../library/multiprocessing.rst:2635 msgid "" -"import time, random\n" "from multiprocessing import Process, Pipe, current_process\n" "from multiprocessing.connection import wait\n" "\n" @@ -3898,23 +3912,23 @@ msgid "" " print(msg)" msgstr "" -#: ../../library/multiprocessing.rst:2660 +#: ../../library/multiprocessing.rst:2670 msgid "Address Formats" msgstr "" -#: ../../library/multiprocessing.rst:2662 +#: ../../library/multiprocessing.rst:2672 msgid "" "An ``'AF_INET'`` address is a tuple of the form ``(hostname, port)`` where " "*hostname* is a string and *port* is an integer." msgstr "" -#: ../../library/multiprocessing.rst:2665 +#: ../../library/multiprocessing.rst:2675 msgid "" "An ``'AF_UNIX'`` address is a string representing a filename on the " "filesystem." msgstr "" -#: ../../library/multiprocessing.rst:2668 +#: ../../library/multiprocessing.rst:2678 msgid "" "An ``'AF_PIPE'`` address is a string of the form :samp:`r'\\\\\\\\\\\\.\\" "\\pipe\\\\\\\\{PipeName}'`. To use :func:`Client` to connect to a named " @@ -3923,17 +3937,17 @@ msgid "" "instead." msgstr "" -#: ../../library/multiprocessing.rst:2673 +#: ../../library/multiprocessing.rst:2683 msgid "" "Note that any string beginning with two backslashes is assumed by default to " "be an ``'AF_PIPE'`` address rather than an ``'AF_UNIX'`` address." msgstr "" -#: ../../library/multiprocessing.rst:2680 +#: ../../library/multiprocessing.rst:2690 msgid "Authentication keys" msgstr "" -#: ../../library/multiprocessing.rst:2682 +#: ../../library/multiprocessing.rst:2692 msgid "" "When one uses :meth:`Connection.recv `, the data received " "is automatically unpickled. Unfortunately unpickling data from an untrusted " @@ -3941,7 +3955,7 @@ msgid "" "use the :mod:`hmac` module to provide digest authentication." msgstr "" -#: ../../library/multiprocessing.rst:2688 +#: ../../library/multiprocessing.rst:2698 msgid "" "An authentication key is a byte string which can be thought of as a " "password: once a connection is established both ends will demand proof that " @@ -3949,7 +3963,7 @@ msgid "" "using the same key does **not** involve sending the key over the connection.)" msgstr "" -#: ../../library/multiprocessing.rst:2694 +#: ../../library/multiprocessing.rst:2704 msgid "" "If authentication is requested but no authentication key is specified then " "the return value of ``current_process().authkey`` is used (see :class:" @@ -3960,17 +3974,17 @@ msgid "" "setting up connections between themselves." msgstr "" -#: ../../library/multiprocessing.rst:2702 +#: ../../library/multiprocessing.rst:2712 msgid "" "Suitable authentication keys can also be generated by using :func:`os." "urandom`." msgstr "" -#: ../../library/multiprocessing.rst:2706 +#: ../../library/multiprocessing.rst:2716 msgid "Logging" msgstr "" -#: ../../library/multiprocessing.rst:2708 +#: ../../library/multiprocessing.rst:2718 msgid "" "Some support for logging is available. Note, however, that the :mod:" "`logging` package does not use process shared locks so it is possible " @@ -3978,27 +3992,27 @@ msgid "" "mixed up." msgstr "" -#: ../../library/multiprocessing.rst:2715 +#: ../../library/multiprocessing.rst:2725 msgid "" "Returns the logger used by :mod:`multiprocessing`. If necessary, a new one " "will be created." msgstr "" -#: ../../library/multiprocessing.rst:2718 +#: ../../library/multiprocessing.rst:2728 msgid "" "When first created the logger has level :const:`logging.NOTSET` and no " "default handler. Messages sent to this logger will not by default propagate " "to the root logger." msgstr "" -#: ../../library/multiprocessing.rst:2722 +#: ../../library/multiprocessing.rst:2732 msgid "" "Note that on Windows child processes will only inherit the level of the " "parent process's logger -- any other customization of the logger will not be " "inherited." msgstr "" -#: ../../library/multiprocessing.rst:2729 +#: ../../library/multiprocessing.rst:2739 msgid "" "This function performs a call to :func:`get_logger` but in addition to " "returning the logger created by get_logger, it adds a handler which sends " @@ -4007,11 +4021,11 @@ msgid "" "``level`` argument." msgstr "" -#: ../../library/multiprocessing.rst:2735 +#: ../../library/multiprocessing.rst:2745 msgid "Below is an example session with logging turned on::" msgstr "" -#: ../../library/multiprocessing.rst:2737 +#: ../../library/multiprocessing.rst:2747 msgid "" ">>> import multiprocessing, logging\n" ">>> logger = multiprocessing.log_to_stderr()\n" @@ -4039,21 +4053,21 @@ msgstr "" "[INFO/MainProcess] sending shutdown message to manager\n" "[INFO/SyncManager-...] manager exiting with exitcode 0" -#: ../../library/multiprocessing.rst:2750 +#: ../../library/multiprocessing.rst:2760 msgid "For a full table of logging levels, see the :mod:`logging` module." msgstr "" -#: ../../library/multiprocessing.rst:2754 +#: ../../library/multiprocessing.rst:2764 msgid "The :mod:`multiprocessing.dummy` module" msgstr ":mod:`multiprocessing.dummy` 模組" -#: ../../library/multiprocessing.rst:2759 +#: ../../library/multiprocessing.rst:2769 msgid "" ":mod:`multiprocessing.dummy` replicates the API of :mod:`multiprocessing` " "but is no more than a wrapper around the :mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:2764 +#: ../../library/multiprocessing.rst:2774 msgid "" "In particular, the ``Pool`` function provided by :mod:`multiprocessing." "dummy` returns an instance of :class:`ThreadPool`, which is a subclass of :" @@ -4061,7 +4075,7 @@ msgid "" "worker threads rather than worker processes." msgstr "" -#: ../../library/multiprocessing.rst:2772 +#: ../../library/multiprocessing.rst:2782 msgid "" "A thread pool object which controls a pool of worker threads to which jobs " "can be submitted. :class:`ThreadPool` instances are fully interface " @@ -4071,18 +4085,18 @@ msgid "" "pool.Pool.terminate` manually." msgstr "" -#: ../../library/multiprocessing.rst:2779 +#: ../../library/multiprocessing.rst:2789 msgid "" "*processes* is the number of worker threads to use. If *processes* is " -"``None`` then the number returned by :func:`os.cpu_count` is used." +"``None`` then the number returned by :func:`os.process_cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2785 +#: ../../library/multiprocessing.rst:2795 msgid "" "Unlike :class:`Pool`, *maxtasksperchild* and *context* cannot be provided." msgstr "" -#: ../../library/multiprocessing.rst:2789 +#: ../../library/multiprocessing.rst:2799 msgid "" "A :class:`ThreadPool` shares the same interface as :class:`Pool`, which is " "designed around a pool of processes and predates the introduction of the :" @@ -4092,7 +4106,7 @@ msgid "" "is not understood by any other libraries." msgstr "" -#: ../../library/multiprocessing.rst:2796 +#: ../../library/multiprocessing.rst:2806 msgid "" "Users should generally prefer to use :class:`concurrent.futures." "ThreadPoolExecutor`, which has a simpler interface that was designed around " @@ -4101,69 +4115,69 @@ msgid "" "`asyncio`." msgstr "" -#: ../../library/multiprocessing.rst:2806 +#: ../../library/multiprocessing.rst:2816 msgid "Programming guidelines" msgstr "" -#: ../../library/multiprocessing.rst:2808 +#: ../../library/multiprocessing.rst:2818 msgid "" "There are certain guidelines and idioms which should be adhered to when " "using :mod:`multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:2813 +#: ../../library/multiprocessing.rst:2823 msgid "All start methods" msgstr "" -#: ../../library/multiprocessing.rst:2815 +#: ../../library/multiprocessing.rst:2825 msgid "The following applies to all start methods." msgstr "" -#: ../../library/multiprocessing.rst:2817 +#: ../../library/multiprocessing.rst:2827 msgid "Avoid shared state" msgstr "" -#: ../../library/multiprocessing.rst:2819 +#: ../../library/multiprocessing.rst:2829 msgid "" "As far as possible one should try to avoid shifting large amounts of data " "between processes." msgstr "" -#: ../../library/multiprocessing.rst:2822 +#: ../../library/multiprocessing.rst:2832 msgid "" "It is probably best to stick to using queues or pipes for communication " "between processes rather than using the lower level synchronization " "primitives." msgstr "" -#: ../../library/multiprocessing.rst:2826 +#: ../../library/multiprocessing.rst:2836 msgid "Picklability" msgstr "" -#: ../../library/multiprocessing.rst:2828 +#: ../../library/multiprocessing.rst:2838 msgid "Ensure that the arguments to the methods of proxies are picklable." msgstr "" -#: ../../library/multiprocessing.rst:2830 +#: ../../library/multiprocessing.rst:2840 msgid "Thread safety of proxies" msgstr "" -#: ../../library/multiprocessing.rst:2832 +#: ../../library/multiprocessing.rst:2842 msgid "" "Do not use a proxy object from more than one thread unless you protect it " "with a lock." msgstr "" -#: ../../library/multiprocessing.rst:2835 +#: ../../library/multiprocessing.rst:2845 msgid "" "(There is never a problem with different processes using the *same* proxy.)" msgstr "" -#: ../../library/multiprocessing.rst:2837 +#: ../../library/multiprocessing.rst:2847 msgid "Joining zombie processes" msgstr "" -#: ../../library/multiprocessing.rst:2839 +#: ../../library/multiprocessing.rst:2849 msgid "" "On POSIX when a process finishes but has not been joined it becomes a " "zombie. There should never be very many because each time a new process " @@ -4174,11 +4188,11 @@ msgid "" "explicitly join all the processes that you start." msgstr "" -#: ../../library/multiprocessing.rst:2847 +#: ../../library/multiprocessing.rst:2857 msgid "Better to inherit than pickle/unpickle" msgstr "" -#: ../../library/multiprocessing.rst:2849 +#: ../../library/multiprocessing.rst:2859 msgid "" "When using the *spawn* or *forkserver* start methods many types from :mod:" "`multiprocessing` need to be picklable so that child processes can use " @@ -4188,11 +4202,11 @@ msgid "" "inherit it from an ancestor process." msgstr "" -#: ../../library/multiprocessing.rst:2857 +#: ../../library/multiprocessing.rst:2867 msgid "Avoid terminating processes" msgstr "" -#: ../../library/multiprocessing.rst:2859 +#: ../../library/multiprocessing.rst:2869 msgid "" "Using the :meth:`Process.terminate ` " "method to stop a process is liable to cause any shared resources (such as " @@ -4200,18 +4214,18 @@ msgid "" "become broken or unavailable to other processes." msgstr "" -#: ../../library/multiprocessing.rst:2865 +#: ../../library/multiprocessing.rst:2875 msgid "" "Therefore it is probably best to only consider using :meth:`Process." "terminate ` on processes which never use " "any shared resources." msgstr "" -#: ../../library/multiprocessing.rst:2869 +#: ../../library/multiprocessing.rst:2879 msgid "Joining processes that use queues" msgstr "" -#: ../../library/multiprocessing.rst:2871 +#: ../../library/multiprocessing.rst:2881 msgid "" "Bear in mind that a process that has put items in a queue will wait before " "terminating until all the buffered items are fed by the \"feeder\" thread to " @@ -4220,7 +4234,7 @@ msgid "" "queue to avoid this behaviour.)" msgstr "" -#: ../../library/multiprocessing.rst:2877 +#: ../../library/multiprocessing.rst:2887 msgid "" "This means that whenever you use a queue you need to make sure that all " "items which have been put on the queue will eventually be removed before the " @@ -4229,11 +4243,11 @@ msgid "" "processes will be joined automatically." msgstr "" -#: ../../library/multiprocessing.rst:2883 +#: ../../library/multiprocessing.rst:2893 msgid "An example which will deadlock is the following::" msgstr "" -#: ../../library/multiprocessing.rst:2885 +#: ../../library/multiprocessing.rst:2895 msgid "" "from multiprocessing import Process, Queue\n" "\n" @@ -4248,17 +4262,17 @@ msgid "" " obj = queue.get()" msgstr "" -#: ../../library/multiprocessing.rst:2897 +#: ../../library/multiprocessing.rst:2907 msgid "" "A fix here would be to swap the last two lines (or simply remove the ``p." "join()`` line)." msgstr "" -#: ../../library/multiprocessing.rst:2900 +#: ../../library/multiprocessing.rst:2910 msgid "Explicitly pass resources to child processes" msgstr "" -#: ../../library/multiprocessing.rst:2902 +#: ../../library/multiprocessing.rst:2912 msgid "" "On POSIX using the *fork* start method, a child process can make use of a " "shared resource created in a parent process using a global resource. " @@ -4266,7 +4280,7 @@ msgid "" "for the child process." msgstr "" -#: ../../library/multiprocessing.rst:2907 +#: ../../library/multiprocessing.rst:2917 msgid "" "Apart from making the code (potentially) compatible with Windows and the " "other start methods this also ensures that as long as the child process is " @@ -4275,11 +4289,11 @@ msgid "" "collected in the parent process." msgstr "" -#: ../../library/multiprocessing.rst:2914 +#: ../../library/multiprocessing.rst:2924 msgid "So for instance ::" msgstr "" -#: ../../library/multiprocessing.rst:2916 +#: ../../library/multiprocessing.rst:2926 msgid "" "from multiprocessing import Process, Lock\n" "\n" @@ -4301,11 +4315,11 @@ msgstr "" " for i in range(10):\n" " Process(target=f).start()" -#: ../../library/multiprocessing.rst:2926 +#: ../../library/multiprocessing.rst:2936 msgid "should be rewritten as ::" msgstr "" -#: ../../library/multiprocessing.rst:2928 +#: ../../library/multiprocessing.rst:2938 msgid "" "from multiprocessing import Process, Lock\n" "\n" @@ -4327,25 +4341,25 @@ msgstr "" " for i in range(10):\n" " Process(target=f, args=(lock,)).start()" -#: ../../library/multiprocessing.rst:2938 +#: ../../library/multiprocessing.rst:2948 msgid "Beware of replacing :data:`sys.stdin` with a \"file like object\"" msgstr "" -#: ../../library/multiprocessing.rst:2940 +#: ../../library/multiprocessing.rst:2950 msgid ":mod:`multiprocessing` originally unconditionally called::" msgstr "" -#: ../../library/multiprocessing.rst:2942 +#: ../../library/multiprocessing.rst:2952 msgid "os.close(sys.stdin.fileno())" msgstr "os.close(sys.stdin.fileno())" -#: ../../library/multiprocessing.rst:2944 +#: ../../library/multiprocessing.rst:2954 msgid "" "in the :meth:`multiprocessing.Process._bootstrap` method --- this resulted " "in issues with processes-in-processes. This has been changed to::" msgstr "" -#: ../../library/multiprocessing.rst:2947 +#: ../../library/multiprocessing.rst:2957 msgid "" "sys.stdin.close()\n" "sys.stdin = open(os.open(os.devnull, os.O_RDONLY), closefd=False)" @@ -4353,7 +4367,7 @@ msgstr "" "sys.stdin.close()\n" "sys.stdin = open(os.open(os.devnull, os.O_RDONLY), closefd=False)" -#: ../../library/multiprocessing.rst:2950 +#: ../../library/multiprocessing.rst:2960 msgid "" "Which solves the fundamental issue of processes colliding with each other " "resulting in a bad file descriptor error, but introduces a potential danger " @@ -4363,14 +4377,14 @@ msgid "" "data being flushed to the object multiple times, resulting in corruption." msgstr "" -#: ../../library/multiprocessing.rst:2957 +#: ../../library/multiprocessing.rst:2967 msgid "" "If you write a file-like object and implement your own caching, you can make " "it fork-safe by storing the pid whenever you append to the cache, and " "discarding the cache when the pid changes. For example::" msgstr "" -#: ../../library/multiprocessing.rst:2961 +#: ../../library/multiprocessing.rst:2971 msgid "" "@property\n" "def cache(self):\n" @@ -4388,26 +4402,26 @@ msgstr "" " self._cache = []\n" " return self._cache" -#: ../../library/multiprocessing.rst:2969 +#: ../../library/multiprocessing.rst:2979 msgid "" "For more information, see :issue:`5155`, :issue:`5313` and :issue:`5331`" msgstr "" -#: ../../library/multiprocessing.rst:2972 +#: ../../library/multiprocessing.rst:2982 msgid "The *spawn* and *forkserver* start methods" msgstr "" -#: ../../library/multiprocessing.rst:2974 +#: ../../library/multiprocessing.rst:2984 msgid "" "There are a few extra restrictions which don't apply to the *fork* start " "method." msgstr "" -#: ../../library/multiprocessing.rst:2977 +#: ../../library/multiprocessing.rst:2987 msgid "More picklability" msgstr "" -#: ../../library/multiprocessing.rst:2979 +#: ../../library/multiprocessing.rst:2989 msgid "" "Ensure that all arguments to :meth:`Process.__init__` are picklable. Also, " "if you subclass :class:`~multiprocessing.Process` then make sure that " @@ -4415,11 +4429,11 @@ msgid "" "Process.start>` method is called." msgstr "" -#: ../../library/multiprocessing.rst:2984 +#: ../../library/multiprocessing.rst:2994 msgid "Global variables" msgstr "" -#: ../../library/multiprocessing.rst:2986 +#: ../../library/multiprocessing.rst:2996 msgid "" "Bear in mind that if code run in a child process tries to access a global " "variable, then the value it sees (if any) may not be the same as the value " @@ -4427,30 +4441,30 @@ msgid "" "Process.start>` was called." msgstr "" -#: ../../library/multiprocessing.rst:2991 +#: ../../library/multiprocessing.rst:3001 msgid "" "However, global variables which are just module level constants cause no " "problems." msgstr "" -#: ../../library/multiprocessing.rst:2996 +#: ../../library/multiprocessing.rst:3006 msgid "Safe importing of main module" msgstr "" -#: ../../library/multiprocessing.rst:2998 +#: ../../library/multiprocessing.rst:3008 msgid "" "Make sure that the main module can be safely imported by a new Python " "interpreter without causing unintended side effects (such as starting a new " "process)." msgstr "" -#: ../../library/multiprocessing.rst:3002 +#: ../../library/multiprocessing.rst:3012 msgid "" "For example, using the *spawn* or *forkserver* start method running the " "following module would fail with a :exc:`RuntimeError`::" msgstr "" -#: ../../library/multiprocessing.rst:3006 +#: ../../library/multiprocessing.rst:3016 msgid "" "from multiprocessing import Process\n" "\n" @@ -4468,13 +4482,13 @@ msgstr "" "p = Process(target=foo)\n" "p.start()" -#: ../../library/multiprocessing.rst:3014 +#: ../../library/multiprocessing.rst:3024 msgid "" "Instead one should protect the \"entry point\" of the program by using ``if " "__name__ == '__main__':`` as follows::" msgstr "" -#: ../../library/multiprocessing.rst:3017 +#: ../../library/multiprocessing.rst:3027 msgid "" "from multiprocessing import Process, freeze_support, set_start_method\n" "\n" @@ -4498,33 +4512,33 @@ msgstr "" " p = Process(target=foo)\n" " p.start()" -#: ../../library/multiprocessing.rst:3028 +#: ../../library/multiprocessing.rst:3038 msgid "" "(The ``freeze_support()`` line can be omitted if the program will be run " "normally instead of frozen.)" msgstr "" -#: ../../library/multiprocessing.rst:3031 +#: ../../library/multiprocessing.rst:3041 msgid "" "This allows the newly spawned Python interpreter to safely import the module " "and then run the module's ``foo()`` function." msgstr "" -#: ../../library/multiprocessing.rst:3034 +#: ../../library/multiprocessing.rst:3044 msgid "" "Similar restrictions apply if a pool or manager is created in the main " "module." msgstr "" -#: ../../library/multiprocessing.rst:3041 +#: ../../library/multiprocessing.rst:3051 msgid "Examples" msgstr "範例" -#: ../../library/multiprocessing.rst:3043 +#: ../../library/multiprocessing.rst:3053 msgid "Demonstration of how to create and use customized managers and proxies:" msgstr "" -#: ../../library/multiprocessing.rst:3045 +#: ../../library/multiprocessing.rst:3055 msgid "" "from multiprocessing import freeze_support\n" "from multiprocessing.managers import BaseManager, BaseProxy\n" @@ -4618,11 +4632,11 @@ msgid "" " test()\n" msgstr "" -#: ../../library/multiprocessing.rst:3049 +#: ../../library/multiprocessing.rst:3059 msgid "Using :class:`~multiprocessing.pool.Pool`:" msgstr "使用 :class:`~multiprocessing.pool.Pool`:" -#: ../../library/multiprocessing.rst:3051 +#: ../../library/multiprocessing.rst:3061 msgid "" "import multiprocessing\n" "import time\n" @@ -4782,13 +4796,13 @@ msgid "" " test()\n" msgstr "" -#: ../../library/multiprocessing.rst:3055 +#: ../../library/multiprocessing.rst:3065 msgid "" "An example showing how to use queues to feed tasks to a collection of worker " "processes and collect the results:" msgstr "" -#: ../../library/multiprocessing.rst:3058 +#: ../../library/multiprocessing.rst:3068 msgid "" "import time\n" "import random\n" @@ -4868,3 +4882,6 @@ msgid "" " freeze_support()\n" " test()\n" msgstr "" + +#~ msgid ":func:`os.cpu_count`" +#~ msgstr ":func:`os.cpu_count`" diff --git a/library/multiprocessing.shared_memory.po b/library/multiprocessing.shared_memory.po index ba28f82048..78ad49ee37 100644 --- a/library/multiprocessing.shared_memory.po +++ b/library/multiprocessing.shared_memory.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-12-11 00:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -127,54 +127,72 @@ msgstr "" "(memory page) 大小來選擇分配記憶體區塊,因此共享記憶體區塊的確切大小可能大於" "或等於請求的大小。當附加到現有共享記憶體區塊時,``size`` 參數將被忽略。" -#: ../../library/multiprocessing.shared_memory.rst:75 +#: ../../library/multiprocessing.shared_memory.rst:73 msgid "" -"Close access to the shared memory from this instance. In order to ensure " -"proper cleanup of resources, all instances should call :meth:`close` once " -"the instance is no longer needed. Note that calling :meth:`!close` does not " -"cause the shared memory block itself to be destroyed." +"When ``True``, register the shared memory block with a resource tracker " +"process on platforms where the OS does not do this automatically. The " +"resource tracker ensures proper cleanup of the shared memory even if all " +"other processes with access to the memory exit without doing so. Python " +"processes created from a common ancestor using :mod:`multiprocessing` " +"facilities share a single resource tracker process, and the lifetime of " +"shared memory segments is handled automatically among these processes. " +"Python processes created in any other way will receive their own resource " +"tracker when accessing shared memory with *track* enabled. This will cause " +"the shared memory to be deleted by the resource tracker of the first process " +"that terminates. To avoid this issue, users of :mod:`subprocess` or " +"standalone Python processes should set *track* to ``False`` when there is " +"already another process in place that does the bookkeeping. *track* is " +"ignored on Windows, which has its own tracking and automatically deletes " +"shared memory when all handles to it have been closed." msgstr "" -"關閉從此實例對共享記憶體的存取。為了確保正確清理資源,一旦實例不再被需要,所" -"有實例都應該呼叫 :meth:`close`。請注意,呼叫 :meth:`!close` 不會使得共享記憶" -"體區塊本身被銷毀。" -#: ../../library/multiprocessing.shared_memory.rst:83 -msgid "" -"Request that the underlying shared memory block be destroyed. In order to " -"ensure proper cleanup of resources, :meth:`unlink` should be called once " -"(and only once) across all processes which have need for the shared memory " -"block. After requesting its destruction, a shared memory block may or may " -"not be immediately destroyed and this behavior may differ across platforms. " -"Attempts to access data inside the shared memory block after :meth:`!unlink` " -"has been called may result in memory access errors. Note: the last process " -"relinquishing its hold on a shared memory block may call :meth:`!unlink` " -"and :meth:`close` in either order." +#: ../../library/multiprocessing.shared_memory.rst:91 +msgid "Added the *track* parameter." msgstr "" -"請求銷毀底層共享記憶體區塊。為了確保正確清理資源,應該在需要共享記憶體區塊的" -"所有行程中呼叫一次(且僅一次)\\ :meth:`unlink`。請求銷毀後,共享記憶體區塊可" -"能會也可能不會立即銷毀,此行為可能因平台而異。呼叫 :meth:`!unlink` 後嘗試存取" -"共享記憶體區塊內的資料可能會導致記憶體存取錯誤。注意:最後一個放棄持有某共享" -"記憶體區塊的行程可以按任意順序呼叫 :meth:`!unlink` 和 :meth:`close`。" #: ../../library/multiprocessing.shared_memory.rst:96 +msgid "" +"Close the file descriptor/handle to the shared memory from this instance. :" +"meth:`close` should be called once access to the shared memory block from " +"this instance is no longer needed. Depending on operating system, the " +"underlying memory may or may not be freed even if all handles to it have " +"been closed. To ensure proper cleanup, use the :meth:`unlink` method." +msgstr "" + +#: ../../library/multiprocessing.shared_memory.rst:105 +msgid "" +"Delete the underlying shared memory block. This should be called only once " +"per shared memory block regardless of the number of handles to it, even in " +"other processes. :meth:`unlink` and :meth:`close` can be called in any " +"order, but trying to access data inside a shared memory block after :meth:" +"`unlink` may result in memory access errors, depending on platform." +msgstr "" + +#: ../../library/multiprocessing.shared_memory.rst:112 +msgid "" +"This method has no effect on Windows, where the only way to delete a shared " +"memory block is to close all handles." +msgstr "" + +#: ../../library/multiprocessing.shared_memory.rst:117 msgid "A memoryview of contents of the shared memory block." msgstr "共享記憶體區塊內容的記憶體視圖 (memoryview)。" -#: ../../library/multiprocessing.shared_memory.rst:100 +#: ../../library/multiprocessing.shared_memory.rst:121 msgid "Read-only access to the unique name of the shared memory block." msgstr "對共享記憶體區塊之唯一名稱的唯讀存取。" -#: ../../library/multiprocessing.shared_memory.rst:104 +#: ../../library/multiprocessing.shared_memory.rst:125 msgid "Read-only access to size in bytes of the shared memory block." msgstr "對共享記憶體區塊大小(以位元組為單位)的唯讀存取。" -#: ../../library/multiprocessing.shared_memory.rst:107 +#: ../../library/multiprocessing.shared_memory.rst:128 msgid "" "The following example demonstrates low-level use of :class:`SharedMemory` " "instances::" msgstr "以下範例示範了 :class:`SharedMemory` 實例的低階使用方式: ::" -#: ../../library/multiprocessing.shared_memory.rst:110 +#: ../../library/multiprocessing.shared_memory.rst:131 msgid "" ">>> from multiprocessing import shared_memory\n" ">>> shm_a = shared_memory.SharedMemory(create=True, size=10)\n" @@ -199,7 +217,7 @@ msgid "" ">>> shm_a.unlink() # Call unlink only once to release the shared memory" msgstr "" -#: ../../library/multiprocessing.shared_memory.rst:133 +#: ../../library/multiprocessing.shared_memory.rst:154 msgid "" "The following example demonstrates a practical use of the :class:" "`SharedMemory` class with `NumPy arrays `_, accessing " @@ -209,7 +227,7 @@ msgstr "" ">`_\\ 的實際用法:從兩個不同的 Python shell 存取相同的 :class:`!numpy." "ndarray`:" -#: ../../library/multiprocessing.shared_memory.rst:137 +#: ../../library/multiprocessing.shared_memory.rst:158 msgid "" ">>> # In the first Python interactive shell\n" ">>> import numpy as np\n" @@ -255,7 +273,7 @@ msgid "" ">>> shm.unlink() # Free and release the shared memory block at the very end" msgstr "" -#: ../../library/multiprocessing.shared_memory.rst:187 +#: ../../library/multiprocessing.shared_memory.rst:208 msgid "" "A subclass of :class:`multiprocessing.managers.BaseManager` which can be " "used for the management of shared memory blocks across processes." @@ -263,7 +281,7 @@ msgstr "" ":class:`multiprocessing.managers.BaseManager` 的子類別,可用於跨行程管理共享" "記憶體區塊。" -#: ../../library/multiprocessing.shared_memory.rst:190 +#: ../../library/multiprocessing.shared_memory.rst:211 msgid "" "A call to :meth:`~multiprocessing.managers.BaseManager.start` on a :class:`!" "SharedMemoryManager` instance causes a new process to be started. This new " @@ -286,7 +304,7 @@ msgstr "" "SharedMemoryManager` 建立 :class:`!SharedMemory` 實例,我們無需手動追蹤和觸" "發共享記憶體資源的釋放。" -#: ../../library/multiprocessing.shared_memory.rst:202 +#: ../../library/multiprocessing.shared_memory.rst:223 msgid "" "This class provides methods for creating and returning :class:`SharedMemory` " "instances and for creating a list-like object (:class:`ShareableList`) " @@ -295,7 +313,7 @@ msgstr "" "此類別提供了用於建立和回傳 :class:`SharedMemory` 實例以及建立由共享記憶體支援" "的類串列物件 (:class:`ShareableList`) 的方法。" -#: ../../library/multiprocessing.shared_memory.rst:206 +#: ../../library/multiprocessing.shared_memory.rst:227 msgid "" "Refer to :class:`~multiprocessing.managers.BaseManager` for a description of " "the inherited *address* and *authkey* optional input arguments and how they " @@ -306,7 +324,7 @@ msgstr "" "和 *authkey* 可選輸入引數的描述以及如何使用它們從其他行程連接到現有的 :class:" "`!SharedMemoryManager` 服務。" -#: ../../library/multiprocessing.shared_memory.rst:213 +#: ../../library/multiprocessing.shared_memory.rst:234 msgid "" "Create and return a new :class:`SharedMemory` object with the specified " "*size* in bytes." @@ -314,7 +332,7 @@ msgstr "" "建立並回傳一個新的 :class:`SharedMemory` 物件,該物件具有指定的 *size*\\ (以" "位元組為單位)。" -#: ../../library/multiprocessing.shared_memory.rst:218 +#: ../../library/multiprocessing.shared_memory.rst:239 msgid "" "Create and return a new :class:`ShareableList` object, initialized by the " "values from the input *sequence*." @@ -322,7 +340,7 @@ msgstr "" "建立並回傳一個新的 :class:`ShareableList` 物件,該物件由輸入 *sequence* 中的" "值初始化。" -#: ../../library/multiprocessing.shared_memory.rst:222 +#: ../../library/multiprocessing.shared_memory.rst:243 msgid "" "The following example demonstrates the basic mechanisms of a :class:" "`~multiprocessing.managers.SharedMemoryManager`:" @@ -330,7 +348,7 @@ msgstr "" "以下範例示範了 :class:`~multiprocessing.managers.SharedMemoryManager` 的基本" "作用機制:" -#: ../../library/multiprocessing.shared_memory.rst:225 +#: ../../library/multiprocessing.shared_memory.rst:246 msgid "" ">>> from multiprocessing.managers import SharedMemoryManager\n" ">>> smm = SharedMemoryManager()\n" @@ -345,7 +363,7 @@ msgid "" ">>> smm.shutdown() # Calls unlink() on sl, raw_shm, and another_sl" msgstr "" -#: ../../library/multiprocessing.shared_memory.rst:240 +#: ../../library/multiprocessing.shared_memory.rst:261 msgid "" "The following example depicts a potentially more convenient pattern for " "using :class:`~multiprocessing.managers.SharedMemoryManager` objects via " @@ -356,7 +374,7 @@ msgstr "" "`~multiprocessing.managers.SharedMemoryManager` 物件,以確保所有共享記憶體區" "塊不再被需要後都被釋放:" -#: ../../library/multiprocessing.shared_memory.rst:245 +#: ../../library/multiprocessing.shared_memory.rst:266 msgid "" ">>> with SharedMemoryManager() as smm:\n" "... sl = smm.ShareableList(range(2000))\n" @@ -371,7 +389,7 @@ msgid "" "... total_result = sum(sl) # Consolidate the partial results now in sl" msgstr "" -#: ../../library/multiprocessing.shared_memory.rst:259 +#: ../../library/multiprocessing.shared_memory.rst:280 msgid "" "When using a :class:`~multiprocessing.managers.SharedMemoryManager` in a :" "keyword:`with` statement, the shared memory blocks created using that " @@ -382,7 +400,7 @@ msgstr "" "SharedMemoryManager` 時,當 :keyword:`!with` 陳述式的程式碼區塊執行完畢時,使" "用該管理器建立的共享記憶體區塊都會被釋放。" -#: ../../library/multiprocessing.shared_memory.rst:267 +#: ../../library/multiprocessing.shared_memory.rst:288 msgid "" "Provide a mutable list-like object where all values stored within are stored " "in a shared memory block. This constrains storable values to the following " @@ -391,31 +409,31 @@ msgstr "" "提供一個類似 list 的可變物件,其中儲存的所有值都儲存在共享記憶體區塊中。這將" "可儲存值限制為以下內建資料型別:" -#: ../../library/multiprocessing.shared_memory.rst:271 +#: ../../library/multiprocessing.shared_memory.rst:292 msgid ":class:`int` (signed 64-bit)" msgstr ":class:`int` (有符號 64 位元)" -#: ../../library/multiprocessing.shared_memory.rst:272 +#: ../../library/multiprocessing.shared_memory.rst:293 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/multiprocessing.shared_memory.rst:273 +#: ../../library/multiprocessing.shared_memory.rst:294 msgid ":class:`bool`" msgstr ":class:`bool`" -#: ../../library/multiprocessing.shared_memory.rst:274 +#: ../../library/multiprocessing.shared_memory.rst:295 msgid ":class:`str` (less than 10M bytes each when encoded as UTF-8)" msgstr ":class:`str` (編碼為 UTF-8 時每個小於 10M 位元組)" -#: ../../library/multiprocessing.shared_memory.rst:275 +#: ../../library/multiprocessing.shared_memory.rst:296 msgid ":class:`bytes` (less than 10M bytes each)" msgstr ":class:`bytes` (每個小於 10M 位元組)" -#: ../../library/multiprocessing.shared_memory.rst:276 +#: ../../library/multiprocessing.shared_memory.rst:297 msgid "``None``" msgstr "``None``" -#: ../../library/multiprocessing.shared_memory.rst:278 +#: ../../library/multiprocessing.shared_memory.rst:299 msgid "" "It also notably differs from the built-in :class:`list` type in that these " "lists can not change their overall length (i.e. no :meth:`!append`, :meth:`!" @@ -426,7 +444,7 @@ msgstr "" "有 :meth:`!append`、:meth:`!insert` 等)並且不支援通過切片動態建立新的 :" "class:`!ShareableList` 實例。" -#: ../../library/multiprocessing.shared_memory.rst:284 +#: ../../library/multiprocessing.shared_memory.rst:305 msgid "" "*sequence* is used in populating a new :class:`!ShareableList` full of " "values. Set to ``None`` to instead attach to an already existing :class:`!" @@ -436,7 +454,7 @@ msgstr "" "為 ``None`` 以透過其唯一的共享記憶體名稱來附加到已經存在的 :class:`!" "ShareableList`。" -#: ../../library/multiprocessing.shared_memory.rst:288 +#: ../../library/multiprocessing.shared_memory.rst:309 msgid "" "*name* is the unique name for the requested shared memory, as described in " "the definition for :class:`SharedMemory`. When attaching to an existing :" @@ -447,7 +465,7 @@ msgstr "" "稱。當附加到現有的 :class:`!ShareableList` 時,指定其共享記憶體區塊的唯一名" "稱,同時將 *sequence* 設定為 ``None``。" -#: ../../library/multiprocessing.shared_memory.rst:295 +#: ../../library/multiprocessing.shared_memory.rst:316 msgid "" "A known issue exists for :class:`bytes` and :class:`str` values. If they end " "with ``\\x00`` nul bytes or characters, those may be *silently stripped* " @@ -461,7 +479,7 @@ msgstr "" "rstrip(b'\\x00')`` 行為被認為是一個錯誤,將來可能會消失。請參閱 :gh:" "`106939`。" -#: ../../library/multiprocessing.shared_memory.rst:301 +#: ../../library/multiprocessing.shared_memory.rst:322 msgid "" "For applications where rstripping of trailing nulls is a problem, work " "around it by always unconditionally appending an extra non-0 byte to the end " @@ -471,7 +489,7 @@ msgstr "" "(workaround) 是始終無條件地在儲存時於此類值的末尾追加一個額外非 0 位元組,並" "在獲取時也無條件地刪除它:" -#: ../../library/multiprocessing.shared_memory.rst:306 +#: ../../library/multiprocessing.shared_memory.rst:327 msgid "" ">>> from multiprocessing import shared_memory\n" ">>> nul_bug_demo = shared_memory.ShareableList(['?\\x00', " @@ -505,11 +523,11 @@ msgstr "" "b'\\x03\\x02\\x01\\x00\\x00\\x00'\n" ">>> padded.shm.unlink()" -#: ../../library/multiprocessing.shared_memory.rst:324 +#: ../../library/multiprocessing.shared_memory.rst:345 msgid "Return the number of occurrences of *value*." msgstr "回傳 *value* 出現的次數。" -#: ../../library/multiprocessing.shared_memory.rst:328 +#: ../../library/multiprocessing.shared_memory.rst:349 msgid "" "Return first index position of *value*. Raise :exc:`ValueError` if *value* " "is not present." @@ -517,23 +535,23 @@ msgstr "" "回傳 *value* 的第一個索引位置。如果 *value* 不存在,則引發 :exc:" "`ValueError`。" -#: ../../library/multiprocessing.shared_memory.rst:333 +#: ../../library/multiprocessing.shared_memory.rst:354 msgid "" "Read-only attribute containing the :mod:`struct` packing format used by all " "currently stored values." msgstr "唯讀屬性,包含所有目前有儲存的值所使用的 :mod:`struct` 打包格式。" -#: ../../library/multiprocessing.shared_memory.rst:338 +#: ../../library/multiprocessing.shared_memory.rst:359 msgid "The :class:`SharedMemory` instance where the values are stored." msgstr "儲存值的 :class:`SharedMemory` 實例。" -#: ../../library/multiprocessing.shared_memory.rst:341 +#: ../../library/multiprocessing.shared_memory.rst:362 msgid "" "The following example demonstrates basic use of a :class:`ShareableList` " "instance:" msgstr "以下範例示範了 :class:`ShareableList` 實例的基本用法:" -#: ../../library/multiprocessing.shared_memory.rst:374 +#: ../../library/multiprocessing.shared_memory.rst:395 msgid "" "The following example depicts how one, two, or many processes may access the " "same :class:`ShareableList` by supplying the name of the shared memory block " @@ -542,7 +560,7 @@ msgstr "" "以下範例描述了一個、兩個或多個行程如何透過提供後面的共享記憶體區塊名稱來存取" "同一個 :class:`ShareableList`:" -#: ../../library/multiprocessing.shared_memory.rst:389 +#: ../../library/multiprocessing.shared_memory.rst:410 msgid "" "The following examples demonstrates that :class:`ShareableList` (and " "underlying :class:`SharedMemory`) objects can be pickled and unpickled if " @@ -567,3 +585,31 @@ msgstr "POSIX Shared Memory(POSIX 共享記憶體)" #: ../../library/multiprocessing.shared_memory.rst:11 msgid "Named Shared Memory" msgstr "Named Shared Memory(附名共享記憶體)" + +#~ msgid "" +#~ "Close access to the shared memory from this instance. In order to ensure " +#~ "proper cleanup of resources, all instances should call :meth:`close` once " +#~ "the instance is no longer needed. Note that calling :meth:`!close` does " +#~ "not cause the shared memory block itself to be destroyed." +#~ msgstr "" +#~ "關閉從此實例對共享記憶體的存取。為了確保正確清理資源,一旦實例不再被需要," +#~ "所有實例都應該呼叫 :meth:`close`。請注意,呼叫 :meth:`!close` 不會使得共享" +#~ "記憶體區塊本身被銷毀。" + +#~ msgid "" +#~ "Request that the underlying shared memory block be destroyed. In order " +#~ "to ensure proper cleanup of resources, :meth:`unlink` should be called " +#~ "once (and only once) across all processes which have need for the shared " +#~ "memory block. After requesting its destruction, a shared memory block " +#~ "may or may not be immediately destroyed and this behavior may differ " +#~ "across platforms. Attempts to access data inside the shared memory block " +#~ "after :meth:`!unlink` has been called may result in memory access " +#~ "errors. Note: the last process relinquishing its hold on a shared memory " +#~ "block may call :meth:`!unlink` and :meth:`close` in either order." +#~ msgstr "" +#~ "請求銷毀底層共享記憶體區塊。為了確保正確清理資源,應該在需要共享記憶體區塊" +#~ "的所有行程中呼叫一次(且僅一次)\\ :meth:`unlink`。請求銷毀後,共享記憶體" +#~ "區塊可能會也可能不會立即銷毀,此行為可能因平台而異。呼叫 :meth:`!unlink` " +#~ "後嘗試存取共享記憶體區塊內的資料可能會導致記憶體存取錯誤。注意:最後一個放" +#~ "棄持有某共享記憶體區塊的行程可以按任意順序呼叫 :meth:`!unlink` 和 :meth:" +#~ "`close`。" diff --git a/library/optparse.po b/library/optparse.po index 60c0664fed..7f39b49f93 100644 --- a/library/optparse.po +++ b/library/optparse.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,11 +28,11 @@ msgstr "**原始碼:**\\ :source:`Lib/optparse.py`" #: ../../library/optparse.rst:13 msgid "" -"The :mod:`optparse` module is deprecated and will not be developed further; " -"development will continue with the :mod:`argparse` module." +"The :mod:`optparse` module is :term:`soft deprecated` and will not be " +"developed further; development will continue with the :mod:`argparse` module." msgstr "" -#: ../../library/optparse.rst:19 +#: ../../library/optparse.rst:20 msgid "" ":mod:`optparse` is a more convenient, flexible, and powerful library for " "parsing command-line options than the old :mod:`getopt` module. :mod:" @@ -43,11 +43,11 @@ msgid "" "messages for you." msgstr "" -#: ../../library/optparse.rst:26 +#: ../../library/optparse.rst:27 msgid "Here's an example of using :mod:`optparse` in a simple script::" msgstr "" -#: ../../library/optparse.rst:28 +#: ../../library/optparse.rst:29 msgid "" "from optparse import OptionParser\n" "...\n" @@ -61,17 +61,17 @@ msgid "" "(options, args) = parser.parse_args()" msgstr "" -#: ../../library/optparse.rst:39 +#: ../../library/optparse.rst:40 msgid "" "With these few lines of code, users of your script can now do the \"usual " "thing\" on the command-line, for example::" msgstr "" -#: ../../library/optparse.rst:42 +#: ../../library/optparse.rst:43 msgid " --file=outfile -q" msgstr "" -#: ../../library/optparse.rst:44 +#: ../../library/optparse.rst:45 msgid "" "As it parses the command line, :mod:`optparse` sets attributes of the " "``options`` object returned by :meth:`~OptionParser.parse_args` based on " @@ -84,7 +84,7 @@ msgid "" "the above example::" msgstr "" -#: ../../library/optparse.rst:53 +#: ../../library/optparse.rst:54 msgid "" " -f outfile --quiet\n" " --quiet --file outfile\n" @@ -92,22 +92,22 @@ msgid "" " -qfoutfile" msgstr "" -#: ../../library/optparse.rst:58 +#: ../../library/optparse.rst:59 msgid "Additionally, users can run one of the following ::" msgstr "" -#: ../../library/optparse.rst:60 +#: ../../library/optparse.rst:61 msgid "" " -h\n" " --help" msgstr "" -#: ../../library/optparse.rst:63 +#: ../../library/optparse.rst:64 msgid "" "and :mod:`optparse` will print out a brief summary of your script's options:" msgstr "" -#: ../../library/optparse.rst:65 +#: ../../library/optparse.rst:66 msgid "" "Usage: [options]\n" "\n" @@ -117,17 +117,17 @@ msgid "" " -q, --quiet don't print status messages to stdout" msgstr "" -#: ../../library/optparse.rst:74 +#: ../../library/optparse.rst:75 msgid "" "where the value of *yourscript* is determined at runtime (normally from " "``sys.argv[0]``)." msgstr "" -#: ../../library/optparse.rst:81 +#: ../../library/optparse.rst:82 msgid "Background" msgstr "背景" -#: ../../library/optparse.rst:83 +#: ../../library/optparse.rst:84 msgid "" ":mod:`optparse` was explicitly designed to encourage the creation of " "programs with straightforward, conventional command-line interfaces. To " @@ -136,15 +136,15 @@ msgid "" "conventions, read this section to acquaint yourself with them." msgstr "" -#: ../../library/optparse.rst:93 +#: ../../library/optparse.rst:94 msgid "Terminology" msgstr "術語" -#: ../../library/optparse.rst:95 +#: ../../library/optparse.rst:96 msgid "argument" msgstr "" -#: ../../library/optparse.rst:96 +#: ../../library/optparse.rst:97 msgid "" "a string entered on the command-line, and passed by the shell to ``execl()`` " "or ``execv()``. In Python, arguments are elements of ``sys.argv[1:]`` " @@ -152,7 +152,7 @@ msgid "" "also use the term \"word\"." msgstr "" -#: ../../library/optparse.rst:101 +#: ../../library/optparse.rst:102 msgid "" "It is occasionally desirable to substitute an argument list other than ``sys." "argv[1:]``, so you should read \"argument\" as \"an element of ``sys." @@ -160,11 +160,11 @@ msgid "" "argv[1:]``\"." msgstr "" -#: ../../library/optparse.rst:106 +#: ../../library/optparse.rst:107 msgid "option" msgstr "" -#: ../../library/optparse.rst:107 +#: ../../library/optparse.rst:108 msgid "" "an argument used to supply extra information to guide or customize the " "execution of a program. There are many different syntaxes for options; the " @@ -176,36 +176,36 @@ msgid "" "option syntaxes provided by :mod:`optparse`." msgstr "" -#: ../../library/optparse.rst:116 +#: ../../library/optparse.rst:117 msgid "Some other option syntaxes that the world has seen include:" msgstr "" -#: ../../library/optparse.rst:118 +#: ../../library/optparse.rst:119 msgid "" "a hyphen followed by a few letters, e.g. ``-pf`` (this is *not* the same as " "multiple options merged into a single argument)" msgstr "" -#: ../../library/optparse.rst:121 +#: ../../library/optparse.rst:122 msgid "" "a hyphen followed by a whole word, e.g. ``-file`` (this is technically " "equivalent to the previous syntax, but they aren't usually seen in the same " "program)" msgstr "" -#: ../../library/optparse.rst:125 +#: ../../library/optparse.rst:126 msgid "" "a plus sign followed by a single letter, or a few letters, or a word, e.g. " "``+f``, ``+rgb``" msgstr "" -#: ../../library/optparse.rst:128 +#: ../../library/optparse.rst:129 msgid "" "a slash followed by a letter, or a few letters, or a word, e.g. ``/f``, ``/" "file``" msgstr "" -#: ../../library/optparse.rst:131 +#: ../../library/optparse.rst:132 msgid "" "These option syntaxes are not supported by :mod:`optparse`, and they never " "will be. This is deliberate: the first three are non-standard on any " @@ -213,11 +213,11 @@ msgid "" "Windows or certain legacy platforms (e.g. VMS, MS-DOS)." msgstr "" -#: ../../library/optparse.rst:136 +#: ../../library/optparse.rst:137 msgid "option argument" msgstr "" -#: ../../library/optparse.rst:137 +#: ../../library/optparse.rst:138 msgid "" "an argument that follows an option, is closely associated with that option, " "and is consumed from the argument list when that option is. With :mod:" @@ -225,23 +225,23 @@ msgid "" "option:" msgstr "" -#: ../../library/optparse.rst:142 +#: ../../library/optparse.rst:143 msgid "" "-f foo\n" "--file foo" msgstr "" -#: ../../library/optparse.rst:147 +#: ../../library/optparse.rst:148 msgid "or included in the same argument:" msgstr "" -#: ../../library/optparse.rst:149 +#: ../../library/optparse.rst:150 msgid "" "-ffoo\n" "--file=foo" msgstr "" -#: ../../library/optparse.rst:154 +#: ../../library/optparse.rst:155 msgid "" "Typically, a given option either takes an argument or it doesn't. Lots of " "people want an \"optional option arguments\" feature, meaning that some " @@ -252,22 +252,22 @@ msgid "" "support this feature." msgstr "" -#: ../../library/optparse.rst:162 +#: ../../library/optparse.rst:163 msgid "positional argument" msgstr "" -#: ../../library/optparse.rst:163 +#: ../../library/optparse.rst:164 msgid "" "something leftover in the argument list after options have been parsed, i.e. " "after options and their arguments have been parsed and removed from the " "argument list." msgstr "" -#: ../../library/optparse.rst:167 +#: ../../library/optparse.rst:168 msgid "required option" msgstr "" -#: ../../library/optparse.rst:168 +#: ../../library/optparse.rst:169 msgid "" "an option that must be supplied on the command-line; note that the phrase " "\"required option\" is self-contradictory in English. :mod:`optparse` " @@ -275,26 +275,26 @@ msgid "" "much help at it either." msgstr "" -#: ../../library/optparse.rst:173 +#: ../../library/optparse.rst:174 msgid "For example, consider this hypothetical command-line::" msgstr "" -#: ../../library/optparse.rst:175 +#: ../../library/optparse.rst:176 msgid "prog -v --report report.txt foo bar" msgstr "" -#: ../../library/optparse.rst:177 +#: ../../library/optparse.rst:178 msgid "" "``-v`` and ``--report`` are both options. Assuming that ``--report`` takes " "one argument, ``report.txt`` is an option argument. ``foo`` and ``bar`` are " "positional arguments." msgstr "" -#: ../../library/optparse.rst:185 +#: ../../library/optparse.rst:186 msgid "What are options for?" msgstr "" -#: ../../library/optparse.rst:187 +#: ../../library/optparse.rst:188 msgid "" "Options are used to provide extra information to tune or customize the " "execution of a program. In case it wasn't clear, options are usually " @@ -306,7 +306,7 @@ msgid "" "interfaces.)" msgstr "" -#: ../../library/optparse.rst:195 +#: ../../library/optparse.rst:196 msgid "" "Lots of people want their programs to have \"required options\". Think " "about it. If it's required, then it's *not optional*! If there is a piece " @@ -314,7 +314,7 @@ msgid "" "successfully, that's what positional arguments are for." msgstr "" -#: ../../library/optparse.rst:200 +#: ../../library/optparse.rst:201 msgid "" "As an example of good command-line interface design, consider the humble " "``cp`` utility, for copying files. It doesn't make much sense to try to " @@ -323,13 +323,13 @@ msgid "" "useful syntax that does not require any options at all::" msgstr "" -#: ../../library/optparse.rst:206 +#: ../../library/optparse.rst:207 msgid "" "cp SOURCE DEST\n" "cp SOURCE ... DEST-DIR" msgstr "" -#: ../../library/optparse.rst:209 +#: ../../library/optparse.rst:210 msgid "" "You can get pretty far with just that. Most ``cp`` implementations provide " "a bunch of options to tweak exactly how the files are copied: you can " @@ -339,17 +339,17 @@ msgid "" "files to another directory." msgstr "" -#: ../../library/optparse.rst:220 +#: ../../library/optparse.rst:221 msgid "What are positional arguments for?" msgstr "" -#: ../../library/optparse.rst:222 +#: ../../library/optparse.rst:223 msgid "" "Positional arguments are for those pieces of information that your program " "absolutely, positively requires to run." msgstr "" -#: ../../library/optparse.rst:225 +#: ../../library/optparse.rst:226 msgid "" "A good user interface should have as few absolute requirements as possible. " "If your program requires 17 distinct pieces of information in order to run " @@ -360,7 +360,7 @@ msgid "" "most of them will simply give up." msgstr "" -#: ../../library/optparse.rst:233 +#: ../../library/optparse.rst:234 msgid "" "In short, try to minimize the amount of information that users are " "absolutely required to supply---use sensible defaults whenever possible. Of " @@ -373,65 +373,65 @@ msgid "" "make your code much harder to maintain." msgstr "" -#: ../../library/optparse.rst:246 +#: ../../library/optparse.rst:247 msgid "Tutorial" msgstr "教學" -#: ../../library/optparse.rst:248 +#: ../../library/optparse.rst:249 msgid "" "While :mod:`optparse` is quite flexible and powerful, it's also " "straightforward to use in most cases. This section covers the code patterns " "that are common to any :mod:`optparse`\\ -based program." msgstr "" -#: ../../library/optparse.rst:252 +#: ../../library/optparse.rst:253 msgid "" "First, you need to import the OptionParser class; then, early in the main " "program, create an OptionParser instance::" msgstr "" -#: ../../library/optparse.rst:255 +#: ../../library/optparse.rst:256 msgid "" "from optparse import OptionParser\n" "...\n" "parser = OptionParser()" msgstr "" -#: ../../library/optparse.rst:259 +#: ../../library/optparse.rst:260 msgid "Then you can start defining options. The basic syntax is::" msgstr "" -#: ../../library/optparse.rst:261 +#: ../../library/optparse.rst:262 msgid "" "parser.add_option(opt_str, ...,\n" " attr=value, ...)" msgstr "" -#: ../../library/optparse.rst:264 +#: ../../library/optparse.rst:265 msgid "" "Each option has one or more option strings, such as ``-f`` or ``--file``, " "and several option attributes that tell :mod:`optparse` what to expect and " "what to do when it encounters that option on the command line." msgstr "" -#: ../../library/optparse.rst:268 +#: ../../library/optparse.rst:269 msgid "" "Typically, each option will have one short option string and one long option " "string, e.g.::" msgstr "" -#: ../../library/optparse.rst:271 +#: ../../library/optparse.rst:272 msgid "parser.add_option(\"-f\", \"--file\", ...)" msgstr "" -#: ../../library/optparse.rst:273 +#: ../../library/optparse.rst:274 msgid "" "You're free to define as many short option strings and as many long option " "strings as you like (including zero), as long as there is at least one " "option string overall." msgstr "" -#: ../../library/optparse.rst:277 +#: ../../library/optparse.rst:278 msgid "" "The option strings passed to :meth:`OptionParser.add_option` are effectively " "labels for the option defined by that call. For brevity, we will frequently " @@ -439,28 +439,28 @@ msgid "" "`optparse` encounters *option strings* and looks up options from them." msgstr "" -#: ../../library/optparse.rst:283 +#: ../../library/optparse.rst:284 msgid "" "Once all of your options are defined, instruct :mod:`optparse` to parse your " "program's command line::" msgstr "" -#: ../../library/optparse.rst:286 +#: ../../library/optparse.rst:287 msgid "(options, args) = parser.parse_args()" msgstr "" -#: ../../library/optparse.rst:288 +#: ../../library/optparse.rst:289 msgid "" "(If you like, you can pass a custom argument list to :meth:`~OptionParser." "parse_args`, but that's rarely necessary: by default it uses ``sys." "argv[1:]``.)" msgstr "" -#: ../../library/optparse.rst:291 +#: ../../library/optparse.rst:292 msgid ":meth:`~OptionParser.parse_args` returns two values:" msgstr ":meth:`~OptionParser.parse_args` 回傳兩個值:" -#: ../../library/optparse.rst:293 +#: ../../library/optparse.rst:294 msgid "" "``options``, an object containing values for all of your options---e.g. if " "``--file`` takes a single string argument, then ``options.file`` will be the " @@ -468,12 +468,12 @@ msgid "" "option" msgstr "" -#: ../../library/optparse.rst:298 +#: ../../library/optparse.rst:299 msgid "" "``args``, the list of positional arguments leftover after parsing options" msgstr "" -#: ../../library/optparse.rst:300 +#: ../../library/optparse.rst:301 msgid "" "This tutorial section only covers the four most important option " "attributes: :attr:`~Option.action`, :attr:`~Option.type`, :attr:`~Option." @@ -481,11 +481,11 @@ msgid "" "action` is the most fundamental." msgstr "" -#: ../../library/optparse.rst:309 +#: ../../library/optparse.rst:310 msgid "Understanding option actions" msgstr "" -#: ../../library/optparse.rst:311 +#: ../../library/optparse.rst:312 msgid "" "Actions tell :mod:`optparse` what to do when it encounters an option on the " "command line. There is a fixed set of actions hard-coded into :mod:" @@ -495,44 +495,44 @@ msgid "" "and store it in an attribute of ``options``." msgstr "" -#: ../../library/optparse.rst:318 +#: ../../library/optparse.rst:319 msgid "" "If you don't specify an option action, :mod:`optparse` defaults to ``store``." msgstr "" -#: ../../library/optparse.rst:324 +#: ../../library/optparse.rst:325 msgid "The store action" msgstr "" -#: ../../library/optparse.rst:326 +#: ../../library/optparse.rst:327 msgid "" "The most common option action is ``store``, which tells :mod:`optparse` to " "take the next argument (or the remainder of the current argument), ensure " "that it is of the correct type, and store it to your chosen destination." msgstr "" -#: ../../library/optparse.rst:330 +#: ../../library/optparse.rst:331 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/optparse.rst:332 +#: ../../library/optparse.rst:333 msgid "" "parser.add_option(\"-f\", \"--file\",\n" " action=\"store\", type=\"string\", dest=\"filename\")" msgstr "" -#: ../../library/optparse.rst:335 +#: ../../library/optparse.rst:336 msgid "" "Now let's make up a fake command line and ask :mod:`optparse` to parse it::" msgstr "" -#: ../../library/optparse.rst:337 +#: ../../library/optparse.rst:338 msgid "" "args = [\"-f\", \"foo.txt\"]\n" "(options, args) = parser.parse_args(args)" msgstr "" -#: ../../library/optparse.rst:340 +#: ../../library/optparse.rst:341 msgid "" "When :mod:`optparse` sees the option string ``-f``, it consumes the next " "argument, ``foo.txt``, and stores it in ``options.filename``. So, after " @@ -540,51 +540,51 @@ msgid "" "``\"foo.txt\"``." msgstr "" -#: ../../library/optparse.rst:344 +#: ../../library/optparse.rst:345 msgid "" "Some other option types supported by :mod:`optparse` are ``int`` and " "``float``. Here's an option that expects an integer argument::" msgstr "" -#: ../../library/optparse.rst:347 +#: ../../library/optparse.rst:348 msgid "parser.add_option(\"-n\", type=\"int\", dest=\"num\")" msgstr "" -#: ../../library/optparse.rst:349 +#: ../../library/optparse.rst:350 msgid "" "Note that this option has no long option string, which is perfectly " "acceptable. Also, there's no explicit action, since the default is ``store``." msgstr "" -#: ../../library/optparse.rst:352 +#: ../../library/optparse.rst:353 msgid "" "Let's parse another fake command-line. This time, we'll jam the option " "argument right up against the option: since ``-n42`` (one argument) is " "equivalent to ``-n 42`` (two arguments), the code ::" msgstr "" -#: ../../library/optparse.rst:356 +#: ../../library/optparse.rst:357 msgid "" "(options, args) = parser.parse_args([\"-n42\"])\n" "print(options.num)" msgstr "" -#: ../../library/optparse.rst:359 +#: ../../library/optparse.rst:360 msgid "will print ``42``." msgstr "" -#: ../../library/optparse.rst:361 +#: ../../library/optparse.rst:362 msgid "" "If you don't specify a type, :mod:`optparse` assumes ``string``. Combined " "with the fact that the default action is ``store``, that means our first " "example can be a lot shorter::" msgstr "" -#: ../../library/optparse.rst:365 +#: ../../library/optparse.rst:366 msgid "parser.add_option(\"-f\", \"--file\", dest=\"filename\")" msgstr "" -#: ../../library/optparse.rst:367 +#: ../../library/optparse.rst:368 msgid "" "If you don't supply a destination, :mod:`optparse` figures out a sensible " "default from the option strings: if the first long option string is ``--foo-" @@ -593,17 +593,17 @@ msgid "" "default destination for ``-f`` is ``f``." msgstr "" -#: ../../library/optparse.rst:373 +#: ../../library/optparse.rst:374 msgid "" ":mod:`optparse` also includes the built-in ``complex`` type. Adding types " "is covered in section :ref:`optparse-extending-optparse`." msgstr "" -#: ../../library/optparse.rst:380 +#: ../../library/optparse.rst:381 msgid "Handling boolean (flag) options" msgstr "" -#: ../../library/optparse.rst:382 +#: ../../library/optparse.rst:383 msgid "" "Flag options---set a variable to true or false when a particular option is " "seen---are quite common. :mod:`optparse` supports them with two separate " @@ -611,77 +611,77 @@ msgid "" "``verbose`` flag that is turned on with ``-v`` and off with ``-q``::" msgstr "" -#: ../../library/optparse.rst:387 +#: ../../library/optparse.rst:388 msgid "" "parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\")\n" "parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\")" msgstr "" -#: ../../library/optparse.rst:390 +#: ../../library/optparse.rst:391 msgid "" "Here we have two different options with the same destination, which is " "perfectly OK. (It just means you have to be a bit careful when setting " "default values---see below.)" msgstr "" -#: ../../library/optparse.rst:394 +#: ../../library/optparse.rst:395 msgid "" "When :mod:`optparse` encounters ``-v`` on the command line, it sets " "``options.verbose`` to ``True``; when it encounters ``-q``, ``options." "verbose`` is set to ``False``." msgstr "" -#: ../../library/optparse.rst:402 +#: ../../library/optparse.rst:403 msgid "Other actions" msgstr "" -#: ../../library/optparse.rst:404 +#: ../../library/optparse.rst:405 msgid "Some other actions supported by :mod:`optparse` are:" msgstr "" -#: ../../library/optparse.rst:406 ../../library/optparse.rst:928 +#: ../../library/optparse.rst:407 ../../library/optparse.rst:929 msgid "``\"store_const\"``" msgstr "``\"store_const\"``" -#: ../../library/optparse.rst:407 ../../library/optparse.rst:929 +#: ../../library/optparse.rst:408 ../../library/optparse.rst:930 msgid "store a constant value, pre-set via :attr:`Option.const`" msgstr "" -#: ../../library/optparse.rst:409 ../../library/optparse.rst:937 +#: ../../library/optparse.rst:410 ../../library/optparse.rst:938 msgid "``\"append\"``" msgstr "``\"append\"``" -#: ../../library/optparse.rst:410 ../../library/optparse.rst:938 +#: ../../library/optparse.rst:411 ../../library/optparse.rst:939 msgid "append this option's argument to a list" msgstr "" -#: ../../library/optparse.rst:412 ../../library/optparse.rst:943 +#: ../../library/optparse.rst:413 ../../library/optparse.rst:944 msgid "``\"count\"``" msgstr "``\"count\"``" -#: ../../library/optparse.rst:413 ../../library/optparse.rst:944 +#: ../../library/optparse.rst:414 ../../library/optparse.rst:945 msgid "increment a counter by one" msgstr "" -#: ../../library/optparse.rst:415 ../../library/optparse.rst:946 +#: ../../library/optparse.rst:416 ../../library/optparse.rst:947 msgid "``\"callback\"``" msgstr "``\"callback\"``" -#: ../../library/optparse.rst:416 ../../library/optparse.rst:947 +#: ../../library/optparse.rst:417 ../../library/optparse.rst:948 msgid "call a specified function" msgstr "" -#: ../../library/optparse.rst:418 +#: ../../library/optparse.rst:419 msgid "" "These are covered in section :ref:`optparse-reference-guide`, and section :" "ref:`optparse-option-callbacks`." msgstr "" -#: ../../library/optparse.rst:425 +#: ../../library/optparse.rst:426 msgid "Default values" msgstr "" -#: ../../library/optparse.rst:427 +#: ../../library/optparse.rst:428 msgid "" "All of the above examples involve setting some variable (the " "\"destination\") when certain command-line options are seen. What happens " @@ -691,38 +691,38 @@ msgid "" "destination, which is assigned before the command line is parsed." msgstr "" -#: ../../library/optparse.rst:434 +#: ../../library/optparse.rst:435 msgid "" "First, consider the verbose/quiet example. If we want :mod:`optparse` to " "set ``verbose`` to ``True`` unless ``-q`` is seen, then we can do this::" msgstr "" -#: ../../library/optparse.rst:437 +#: ../../library/optparse.rst:438 msgid "" "parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\", " "default=True)\n" "parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\")" msgstr "" -#: ../../library/optparse.rst:440 +#: ../../library/optparse.rst:441 msgid "" "Since default values apply to the *destination* rather than to any " "particular option, and these two options happen to have the same " "destination, this is exactly equivalent::" msgstr "" -#: ../../library/optparse.rst:444 +#: ../../library/optparse.rst:445 msgid "" "parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\")\n" "parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\", " "default=True)" msgstr "" -#: ../../library/optparse.rst:447 +#: ../../library/optparse.rst:448 msgid "Consider this::" msgstr "" -#: ../../library/optparse.rst:449 +#: ../../library/optparse.rst:450 msgid "" "parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\", " "default=False)\n" @@ -730,38 +730,38 @@ msgid "" "default=True)" msgstr "" -#: ../../library/optparse.rst:452 +#: ../../library/optparse.rst:453 msgid "" "Again, the default value for ``verbose`` will be ``True``: the last default " "value supplied for any particular destination is the one that counts." msgstr "" -#: ../../library/optparse.rst:455 +#: ../../library/optparse.rst:456 msgid "" "A clearer way to specify default values is the :meth:`set_defaults` method " "of OptionParser, which you can call at any time before calling :meth:" "`~OptionParser.parse_args`::" msgstr "" -#: ../../library/optparse.rst:459 +#: ../../library/optparse.rst:460 msgid "" "parser.set_defaults(verbose=True)\n" "parser.add_option(...)\n" "(options, args) = parser.parse_args()" msgstr "" -#: ../../library/optparse.rst:463 +#: ../../library/optparse.rst:464 msgid "" "As before, the last value specified for a given option destination is the " "one that counts. For clarity, try to use one method or the other of setting " "default values, not both." msgstr "" -#: ../../library/optparse.rst:471 +#: ../../library/optparse.rst:472 msgid "Generating help" msgstr "" -#: ../../library/optparse.rst:473 +#: ../../library/optparse.rst:474 msgid "" ":mod:`optparse`'s ability to generate help and usage text automatically is " "useful for creating user-friendly command-line interfaces. All you have to " @@ -770,7 +770,7 @@ msgid "" "populated with user-friendly (documented) options::" msgstr "" -#: ../../library/optparse.rst:479 +#: ../../library/optparse.rst:480 msgid "" "usage = \"usage: %prog [options] arg1 arg2\"\n" "parser = OptionParser(usage=usage)\n" @@ -788,14 +788,14 @@ msgid "" " \"or expert [default: %default]\")" msgstr "" -#: ../../library/optparse.rst:494 +#: ../../library/optparse.rst:495 msgid "" "If :mod:`optparse` encounters either ``-h`` or ``--help`` on the command-" "line, or if you just call :meth:`parser.print_help`, it prints the following " "to standard output:" msgstr "" -#: ../../library/optparse.rst:498 +#: ../../library/optparse.rst:499 msgid "" "Usage: [options] arg1 arg2\n" "\n" @@ -809,58 +809,58 @@ msgid "" " expert [default: intermediate]" msgstr "" -#: ../../library/optparse.rst:511 +#: ../../library/optparse.rst:512 msgid "" "(If the help output is triggered by a help option, :mod:`optparse` exits " "after printing the help text.)" msgstr "" -#: ../../library/optparse.rst:514 +#: ../../library/optparse.rst:515 msgid "" "There's a lot going on here to help :mod:`optparse` generate the best " "possible help message:" msgstr "" -#: ../../library/optparse.rst:517 +#: ../../library/optparse.rst:518 msgid "the script defines its own usage message::" msgstr "" -#: ../../library/optparse.rst:519 +#: ../../library/optparse.rst:520 msgid "usage = \"usage: %prog [options] arg1 arg2\"" msgstr "" -#: ../../library/optparse.rst:521 +#: ../../library/optparse.rst:522 msgid "" ":mod:`optparse` expands ``%prog`` in the usage string to the name of the " "current program, i.e. ``os.path.basename(sys.argv[0])``. The expanded " "string is then printed before the detailed option help." msgstr "" -#: ../../library/optparse.rst:525 +#: ../../library/optparse.rst:526 msgid "" "If you don't supply a usage string, :mod:`optparse` uses a bland but " "sensible default: ``\"Usage: %prog [options]\"``, which is fine if your " "script doesn't take any positional arguments." msgstr "" -#: ../../library/optparse.rst:529 +#: ../../library/optparse.rst:530 msgid "" "every option defines a help string, and doesn't worry about line-wrapping---" "\\ :mod:`optparse` takes care of wrapping lines and making the help output " "look good." msgstr "" -#: ../../library/optparse.rst:533 +#: ../../library/optparse.rst:534 msgid "" "options that take a value indicate this fact in their automatically " "generated help message, e.g. for the \"mode\" option::" msgstr "" -#: ../../library/optparse.rst:536 +#: ../../library/optparse.rst:537 msgid "-m MODE, --mode=MODE" msgstr "" -#: ../../library/optparse.rst:538 +#: ../../library/optparse.rst:539 msgid "" "Here, \"MODE\" is called the meta-variable: it stands for the argument that " "the user is expected to supply to ``-m``/``--mode``. By default, :mod:" @@ -870,11 +870,11 @@ msgid "" "this automatically generated option description::" msgstr "" -#: ../../library/optparse.rst:545 +#: ../../library/optparse.rst:546 msgid "-f FILE, --filename=FILE" msgstr "" -#: ../../library/optparse.rst:547 +#: ../../library/optparse.rst:548 msgid "" "This is important for more than just saving space, though: the manually " "written help text uses the meta-variable ``FILE`` to clue the user in that " @@ -884,7 +884,7 @@ msgid "" "users." msgstr "" -#: ../../library/optparse.rst:553 +#: ../../library/optparse.rst:554 msgid "" "options that have a default value can include ``%default`` in the help " "string---\\ :mod:`optparse` will replace it with :func:`str` of the option's " @@ -892,58 +892,58 @@ msgid "" "``None``), ``%default`` expands to ``none``." msgstr "" -#: ../../library/optparse.rst:559 +#: ../../library/optparse.rst:560 msgid "Grouping Options" msgstr "" -#: ../../library/optparse.rst:561 +#: ../../library/optparse.rst:562 msgid "" "When dealing with many options, it is convenient to group these options for " "better help output. An :class:`OptionParser` can contain several option " "groups, each of which can contain several options." msgstr "" -#: ../../library/optparse.rst:565 +#: ../../library/optparse.rst:566 msgid "An option group is obtained using the class :class:`OptionGroup`:" msgstr "" -#: ../../library/optparse.rst:569 ../../library/optparse.rst:1640 +#: ../../library/optparse.rst:570 ../../library/optparse.rst:1641 msgid "where" msgstr "" -#: ../../library/optparse.rst:571 +#: ../../library/optparse.rst:572 msgid "" "parser is the :class:`OptionParser` instance the group will be inserted in to" msgstr "" -#: ../../library/optparse.rst:573 +#: ../../library/optparse.rst:574 msgid "title is the group title" msgstr "" -#: ../../library/optparse.rst:574 +#: ../../library/optparse.rst:575 msgid "description, optional, is a long description of the group" msgstr "" -#: ../../library/optparse.rst:576 +#: ../../library/optparse.rst:577 msgid "" ":class:`OptionGroup` inherits from :class:`OptionContainer` (like :class:" "`OptionParser`) and so the :meth:`add_option` method can be used to add an " "option to the group." msgstr "" -#: ../../library/optparse.rst:580 +#: ../../library/optparse.rst:581 msgid "" "Once all the options are declared, using the :class:`OptionParser` method :" "meth:`add_option_group` the group is added to the previously defined parser." msgstr "" -#: ../../library/optparse.rst:583 +#: ../../library/optparse.rst:584 msgid "" "Continuing with the parser defined in the previous section, adding an :class:" "`OptionGroup` to a parser is easy::" msgstr "" -#: ../../library/optparse.rst:586 +#: ../../library/optparse.rst:587 msgid "" "group = OptionGroup(parser, \"Dangerous Options\",\n" " \"Caution: use these options at your own risk. \"\n" @@ -952,11 +952,11 @@ msgid "" "parser.add_option_group(group)" msgstr "" -#: ../../library/optparse.rst:592 +#: ../../library/optparse.rst:593 msgid "This would result in the following help output:" msgstr "" -#: ../../library/optparse.rst:594 +#: ../../library/optparse.rst:595 msgid "" "Usage: [options] arg1 arg2\n" "\n" @@ -976,13 +976,13 @@ msgid "" " -g Group option." msgstr "" -#: ../../library/optparse.rst:613 +#: ../../library/optparse.rst:614 msgid "" "A bit more complete example might involve using more than one group: still " "extending the previous example::" msgstr "" -#: ../../library/optparse.rst:616 +#: ../../library/optparse.rst:617 msgid "" "group = OptionGroup(parser, \"Dangerous Options\",\n" " \"Caution: use these options at your own risk. \"\n" @@ -1000,11 +1000,11 @@ msgid "" "parser.add_option_group(group)" msgstr "" -#: ../../library/optparse.rst:630 +#: ../../library/optparse.rst:631 msgid "that results in the following output:" msgstr "" -#: ../../library/optparse.rst:632 +#: ../../library/optparse.rst:633 msgid "" "Usage: [options] arg1 arg2\n" "\n" @@ -1029,35 +1029,35 @@ msgid "" " -e Print every action done" msgstr "" -#: ../../library/optparse.rst:656 +#: ../../library/optparse.rst:657 msgid "" "Another interesting method, in particular when working programmatically with " "option groups is:" msgstr "" -#: ../../library/optparse.rst:661 +#: ../../library/optparse.rst:662 msgid "" "Return the :class:`OptionGroup` to which the short or long option string " "*opt_str* (e.g. ``'-o'`` or ``'--option'``) belongs. If there's no such :" "class:`OptionGroup`, return ``None``." msgstr "" -#: ../../library/optparse.rst:668 +#: ../../library/optparse.rst:669 msgid "Printing a version string" msgstr "" -#: ../../library/optparse.rst:670 +#: ../../library/optparse.rst:671 msgid "" "Similar to the brief usage string, :mod:`optparse` can also print a version " "string for your program. You have to supply the string as the ``version`` " "argument to OptionParser::" msgstr "" -#: ../../library/optparse.rst:674 +#: ../../library/optparse.rst:675 msgid "parser = OptionParser(usage=\"%prog [-f] [-q]\", version=\"%prog 1.0\")" msgstr "" -#: ../../library/optparse.rst:676 +#: ../../library/optparse.rst:677 msgid "" "``%prog`` is expanded just like it is in ``usage``. Apart from that, " "``version`` can contain anything you like. When you supply it, :mod:" @@ -1066,23 +1066,23 @@ msgid "" "string (by replacing ``%prog``), prints it to stdout, and exits." msgstr "" -#: ../../library/optparse.rst:682 +#: ../../library/optparse.rst:683 msgid "For example, if your script is called ``/usr/bin/foo``:" msgstr "" -#: ../../library/optparse.rst:684 +#: ../../library/optparse.rst:685 msgid "" "$ /usr/bin/foo --version\n" "foo 1.0" msgstr "" -#: ../../library/optparse.rst:689 +#: ../../library/optparse.rst:690 msgid "" "The following two methods can be used to print and get the ``version`` " "string:" msgstr "" -#: ../../library/optparse.rst:693 +#: ../../library/optparse.rst:694 msgid "" "Print the version message for the current program (``self.version``) to " "*file* (default stdout). As with :meth:`print_usage`, any occurrence of " @@ -1090,17 +1090,17 @@ msgid "" "program. Does nothing if ``self.version`` is empty or undefined." msgstr "" -#: ../../library/optparse.rst:700 +#: ../../library/optparse.rst:701 msgid "" "Same as :meth:`print_version` but returns the version string instead of " "printing it." msgstr "" -#: ../../library/optparse.rst:707 +#: ../../library/optparse.rst:708 msgid "How :mod:`optparse` handles errors" msgstr "" -#: ../../library/optparse.rst:709 +#: ../../library/optparse.rst:710 msgid "" "There are two broad classes of errors that :mod:`optparse` has to worry " "about: programmer errors and user errors. Programmer errors are usually " @@ -1110,7 +1110,7 @@ msgid "" "OptionError` or :exc:`TypeError`) and let the program crash." msgstr "" -#: ../../library/optparse.rst:716 +#: ../../library/optparse.rst:717 msgid "" "Handling user errors is much more important, since they are guaranteed to " "happen no matter how stable your code is. :mod:`optparse` can automatically " @@ -1121,7 +1121,7 @@ msgid "" "error condition::" msgstr "" -#: ../../library/optparse.rst:724 +#: ../../library/optparse.rst:725 msgid "" "(options, args) = parser.parse_args()\n" "...\n" @@ -1129,20 +1129,20 @@ msgid "" " parser.error(\"options -a and -b are mutually exclusive\")" msgstr "" -#: ../../library/optparse.rst:729 +#: ../../library/optparse.rst:730 msgid "" "In either case, :mod:`optparse` handles the error the same way: it prints " "the program's usage message and an error message to standard error and exits " "with error status 2." msgstr "" -#: ../../library/optparse.rst:733 +#: ../../library/optparse.rst:734 msgid "" "Consider the first example above, where the user passes ``4x`` to an option " "that takes an integer:" msgstr "" -#: ../../library/optparse.rst:736 +#: ../../library/optparse.rst:737 msgid "" "$ /usr/bin/foo -n 4x\n" "Usage: foo [options]\n" @@ -1150,11 +1150,11 @@ msgid "" "foo: error: option -n: invalid integer value: '4x'" msgstr "" -#: ../../library/optparse.rst:743 +#: ../../library/optparse.rst:744 msgid "Or, where the user fails to pass a value at all:" msgstr "" -#: ../../library/optparse.rst:745 +#: ../../library/optparse.rst:746 msgid "" "$ /usr/bin/foo -n\n" "Usage: foo [options]\n" @@ -1162,29 +1162,29 @@ msgid "" "foo: error: -n option requires an argument" msgstr "" -#: ../../library/optparse.rst:752 +#: ../../library/optparse.rst:753 msgid "" ":mod:`optparse`\\ -generated error messages take care always to mention the " "option involved in the error; be sure to do the same when calling :func:" "`OptionParser.error` from your application code." msgstr "" -#: ../../library/optparse.rst:756 +#: ../../library/optparse.rst:757 msgid "" "If :mod:`optparse`'s default error-handling behaviour does not suit your " "needs, you'll need to subclass OptionParser and override its :meth:" "`~OptionParser.exit` and/or :meth:`~OptionParser.error` methods." msgstr "" -#: ../../library/optparse.rst:764 +#: ../../library/optparse.rst:765 msgid "Putting it all together" msgstr "" -#: ../../library/optparse.rst:766 +#: ../../library/optparse.rst:767 msgid "Here's what :mod:`optparse`\\ -based scripts usually look like::" msgstr "" -#: ../../library/optparse.rst:768 +#: ../../library/optparse.rst:769 msgid "" "from optparse import OptionParser\n" "...\n" @@ -1209,32 +1209,32 @@ msgid "" " main()" msgstr "" -#: ../../library/optparse.rst:794 +#: ../../library/optparse.rst:795 msgid "Reference Guide" msgstr "" -#: ../../library/optparse.rst:800 +#: ../../library/optparse.rst:801 msgid "Creating the parser" msgstr "" -#: ../../library/optparse.rst:802 +#: ../../library/optparse.rst:803 msgid "" "The first step in using :mod:`optparse` is to create an OptionParser " "instance." msgstr "" -#: ../../library/optparse.rst:806 +#: ../../library/optparse.rst:807 msgid "" "The OptionParser constructor has no required arguments, but a number of " "optional keyword arguments. You should always pass them as keyword " "arguments, i.e. do not rely on the order in which the arguments are declared." msgstr "" -#: ../../library/optparse.rst:810 +#: ../../library/optparse.rst:811 msgid "``usage`` (default: ``\"%prog [options]\"``)" msgstr "" -#: ../../library/optparse.rst:811 +#: ../../library/optparse.rst:812 msgid "" "The usage summary to print when your program is run incorrectly or with a " "help option. When :mod:`optparse` prints the usage string, it expands " @@ -1243,11 +1243,11 @@ msgid "" "value :const:`optparse.SUPPRESS_USAGE`." msgstr "" -#: ../../library/optparse.rst:817 +#: ../../library/optparse.rst:818 msgid "``option_list`` (default: ``[]``)" msgstr "" -#: ../../library/optparse.rst:818 +#: ../../library/optparse.rst:819 msgid "" "A list of Option objects to populate the parser with. The options in " "``option_list`` are added after any options in ``standard_option_list`` (a " @@ -1256,19 +1256,19 @@ msgid "" "the parser instead." msgstr "" -#: ../../library/optparse.rst:824 +#: ../../library/optparse.rst:825 msgid "``option_class`` (default: optparse.Option)" msgstr "" -#: ../../library/optparse.rst:825 +#: ../../library/optparse.rst:826 msgid "Class to use when adding options to the parser in :meth:`add_option`." msgstr "" -#: ../../library/optparse.rst:827 +#: ../../library/optparse.rst:828 msgid "``version`` (default: ``None``)" msgstr "" -#: ../../library/optparse.rst:828 +#: ../../library/optparse.rst:829 msgid "" "A version string to print when the user supplies a version option. If you " "supply a true value for ``version``, :mod:`optparse` automatically adds a " @@ -1276,21 +1276,21 @@ msgid "" "``%prog`` is expanded the same as for ``usage``." msgstr "" -#: ../../library/optparse.rst:833 +#: ../../library/optparse.rst:834 msgid "``conflict_handler`` (default: ``\"error\"``)" msgstr "" -#: ../../library/optparse.rst:834 +#: ../../library/optparse.rst:835 msgid "" "Specifies what to do when options with conflicting option strings are added " "to the parser; see section :ref:`optparse-conflicts-between-options`." msgstr "" -#: ../../library/optparse.rst:838 +#: ../../library/optparse.rst:839 msgid "``description`` (default: ``None``)" msgstr "" -#: ../../library/optparse.rst:839 +#: ../../library/optparse.rst:840 msgid "" "A paragraph of text giving a brief overview of your program. :mod:`optparse` " "reformats this paragraph to fit the current terminal width and prints it " @@ -1298,74 +1298,74 @@ msgid "" "options)." msgstr "" -#: ../../library/optparse.rst:844 +#: ../../library/optparse.rst:845 msgid "``formatter`` (default: a new :class:`IndentedHelpFormatter`)" msgstr "" -#: ../../library/optparse.rst:845 +#: ../../library/optparse.rst:846 msgid "" "An instance of optparse.HelpFormatter that will be used for printing help " "text. :mod:`optparse` provides two concrete classes for this purpose: " "IndentedHelpFormatter and TitledHelpFormatter." msgstr "" -#: ../../library/optparse.rst:849 +#: ../../library/optparse.rst:850 msgid "``add_help_option`` (default: ``True``)" msgstr "" -#: ../../library/optparse.rst:850 +#: ../../library/optparse.rst:851 msgid "" "If true, :mod:`optparse` will add a help option (with option strings ``-h`` " "and ``--help``) to the parser." msgstr "" -#: ../../library/optparse.rst:853 +#: ../../library/optparse.rst:854 msgid "``prog``" msgstr "``prog``" -#: ../../library/optparse.rst:854 +#: ../../library/optparse.rst:855 msgid "" "The string to use when expanding ``%prog`` in ``usage`` and ``version`` " "instead of ``os.path.basename(sys.argv[0])``." msgstr "" -#: ../../library/optparse.rst:857 +#: ../../library/optparse.rst:858 msgid "``epilog`` (default: ``None``)" msgstr "" -#: ../../library/optparse.rst:858 +#: ../../library/optparse.rst:859 msgid "A paragraph of help text to print after the option help." msgstr "" -#: ../../library/optparse.rst:863 +#: ../../library/optparse.rst:864 msgid "Populating the parser" msgstr "" -#: ../../library/optparse.rst:865 +#: ../../library/optparse.rst:866 msgid "" "There are several ways to populate the parser with options. The preferred " "way is by using :meth:`OptionParser.add_option`, as shown in section :ref:" "`optparse-tutorial`. :meth:`add_option` can be called in one of two ways:" msgstr "" -#: ../../library/optparse.rst:869 +#: ../../library/optparse.rst:870 msgid "pass it an Option instance (as returned by :func:`make_option`)" msgstr "" -#: ../../library/optparse.rst:871 +#: ../../library/optparse.rst:872 msgid "" "pass it any combination of positional and keyword arguments that are " "acceptable to :func:`make_option` (i.e., to the Option constructor), and it " "will create the Option instance for you" msgstr "" -#: ../../library/optparse.rst:875 +#: ../../library/optparse.rst:876 msgid "" "The other alternative is to pass a list of pre-constructed Option instances " "to the OptionParser constructor, as in::" msgstr "" -#: ../../library/optparse.rst:878 +#: ../../library/optparse.rst:879 msgid "" "option_list = [\n" " make_option(\"-f\", \"--filename\",\n" @@ -1376,7 +1376,7 @@ msgid "" "parser = OptionParser(option_list=option_list)" msgstr "" -#: ../../library/optparse.rst:886 +#: ../../library/optparse.rst:887 msgid "" "(:func:`make_option` is a factory function for creating Option instances; " "currently it is an alias for the Option constructor. A future version of :" @@ -1385,40 +1385,40 @@ msgid "" "Option directly.)" msgstr "" -#: ../../library/optparse.rst:895 +#: ../../library/optparse.rst:896 msgid "Defining options" msgstr "" -#: ../../library/optparse.rst:897 +#: ../../library/optparse.rst:898 msgid "" "Each Option instance represents a set of synonymous command-line option " "strings, e.g. ``-f`` and ``--file``. You can specify any number of short or " "long option strings, but you must specify at least one overall option string." msgstr "" -#: ../../library/optparse.rst:901 +#: ../../library/optparse.rst:902 msgid "" "The canonical way to create an :class:`Option` instance is with the :meth:" "`add_option` method of :class:`OptionParser`." msgstr "" -#: ../../library/optparse.rst:907 +#: ../../library/optparse.rst:908 msgid "To define an option with only a short option string::" msgstr "" -#: ../../library/optparse.rst:909 +#: ../../library/optparse.rst:910 msgid "parser.add_option(\"-f\", attr=value, ...)" msgstr "" -#: ../../library/optparse.rst:911 +#: ../../library/optparse.rst:912 msgid "And to define an option with only a long option string::" msgstr "" -#: ../../library/optparse.rst:913 +#: ../../library/optparse.rst:914 msgid "parser.add_option(\"--foo\", attr=value, ...)" msgstr "" -#: ../../library/optparse.rst:915 +#: ../../library/optparse.rst:916 msgid "" "The keyword arguments define attributes of the new Option object. The most " "important option attribute is :attr:`~Option.action`, and it largely " @@ -1427,69 +1427,69 @@ msgid "" "raises an :exc:`OptionError` exception explaining your mistake." msgstr "" -#: ../../library/optparse.rst:921 +#: ../../library/optparse.rst:922 msgid "" "An option's *action* determines what :mod:`optparse` does when it encounters " "this option on the command-line. The standard option actions hard-coded " "into :mod:`optparse` are:" msgstr "" -#: ../../library/optparse.rst:925 +#: ../../library/optparse.rst:926 msgid "``\"store\"``" msgstr "``\"store\"``" -#: ../../library/optparse.rst:926 +#: ../../library/optparse.rst:927 msgid "store this option's argument (default)" msgstr "" -#: ../../library/optparse.rst:931 +#: ../../library/optparse.rst:932 msgid "``\"store_true\"``" msgstr "``\"store_true\"``" -#: ../../library/optparse.rst:932 +#: ../../library/optparse.rst:933 msgid "store ``True``" msgstr "" -#: ../../library/optparse.rst:934 +#: ../../library/optparse.rst:935 msgid "``\"store_false\"``" msgstr "``\"store_false\"``" -#: ../../library/optparse.rst:935 +#: ../../library/optparse.rst:936 msgid "store ``False``" msgstr "" -#: ../../library/optparse.rst:940 +#: ../../library/optparse.rst:941 msgid "``\"append_const\"``" msgstr "``\"append_const\"``" -#: ../../library/optparse.rst:941 +#: ../../library/optparse.rst:942 msgid "append a constant value to a list, pre-set via :attr:`Option.const`" msgstr "" -#: ../../library/optparse.rst:949 ../../library/optparse.rst:1244 +#: ../../library/optparse.rst:950 ../../library/optparse.rst:1245 msgid "``\"help\"``" msgstr "``\"help\"``" -#: ../../library/optparse.rst:950 +#: ../../library/optparse.rst:951 msgid "" "print a usage message including all options and the documentation for them" msgstr "" -#: ../../library/optparse.rst:952 +#: ../../library/optparse.rst:953 msgid "" "(If you don't supply an action, the default is ``\"store\"``. For this " "action, you may also supply :attr:`~Option.type` and :attr:`~Option.dest` " "option attributes; see :ref:`optparse-standard-option-actions`.)" msgstr "" -#: ../../library/optparse.rst:956 +#: ../../library/optparse.rst:957 msgid "" "As you can see, most actions involve storing or updating a value somewhere. :" "mod:`optparse` always creates a special object for this, conventionally " "called ``options``, which is an instance of :class:`optparse.Values`." msgstr "" -#: ../../library/optparse.rst:962 +#: ../../library/optparse.rst:963 msgid "" "An object holding parsed argument names and values as attributes. Normally " "created by calling when calling :meth:`OptionParser.parse_args`, and can be " @@ -1498,35 +1498,35 @@ msgid "" "arguments`)." msgstr "" -#: ../../library/optparse.rst:967 +#: ../../library/optparse.rst:968 msgid "" "Option arguments (and various other values) are stored as attributes of this " "object, according to the :attr:`~Option.dest` (destination) option attribute." msgstr "" -#: ../../library/optparse.rst:971 +#: ../../library/optparse.rst:972 msgid "For example, when you call ::" msgstr "例如說,當你呼叫: ::" -#: ../../library/optparse.rst:973 +#: ../../library/optparse.rst:974 msgid "parser.parse_args()" msgstr "parser.parse_args()" -#: ../../library/optparse.rst:975 +#: ../../library/optparse.rst:976 msgid "" "one of the first things :mod:`optparse` does is create the ``options`` " "object::" msgstr "" -#: ../../library/optparse.rst:977 +#: ../../library/optparse.rst:978 msgid "options = Values()" msgstr "options = Values()" -#: ../../library/optparse.rst:979 +#: ../../library/optparse.rst:980 msgid "If one of the options in this parser is defined with ::" msgstr "" -#: ../../library/optparse.rst:981 +#: ../../library/optparse.rst:982 msgid "" "parser.add_option(\"-f\", \"--file\", action=\"store\", type=\"string\", " "dest=\"filename\")" @@ -1534,11 +1534,11 @@ msgstr "" "parser.add_option(\"-f\", \"--file\", action=\"store\", type=\"string\", " "dest=\"filename\")" -#: ../../library/optparse.rst:983 +#: ../../library/optparse.rst:984 msgid "and the command-line being parsed includes any of the following::" msgstr "" -#: ../../library/optparse.rst:985 +#: ../../library/optparse.rst:986 msgid "" "-ffoo\n" "-f foo\n" @@ -1550,27 +1550,27 @@ msgstr "" "--file=foo\n" "--file foo" -#: ../../library/optparse.rst:990 +#: ../../library/optparse.rst:991 msgid "" "then :mod:`optparse`, on seeing this option, will do the equivalent of ::" msgstr "" -#: ../../library/optparse.rst:992 +#: ../../library/optparse.rst:993 msgid "options.filename = \"foo\"" msgstr "options.filename = \"foo\"" -#: ../../library/optparse.rst:994 +#: ../../library/optparse.rst:995 msgid "" "The :attr:`~Option.type` and :attr:`~Option.dest` option attributes are " "almost as important as :attr:`~Option.action`, but :attr:`~Option.action` is " "the only one that makes sense for *all* options." msgstr "" -#: ../../library/optparse.rst:1002 +#: ../../library/optparse.rst:1003 msgid "Option attributes" msgstr "" -#: ../../library/optparse.rst:1006 +#: ../../library/optparse.rst:1007 msgid "" "A single command line argument, with various attributes passed by keyword to " "the constructor. Normally created with :meth:`OptionParser.add_option` " @@ -1578,7 +1578,7 @@ msgid "" "*option_class* argument to :class:`OptionParser`." msgstr "" -#: ../../library/optparse.rst:1012 +#: ../../library/optparse.rst:1013 msgid "" "The following option attributes may be passed as keyword arguments to :meth:" "`OptionParser.add_option`. If you pass an option attribute that is not " @@ -1586,33 +1586,33 @@ msgid "" "attribute, :mod:`optparse` raises :exc:`OptionError`." msgstr "" -#: ../../library/optparse.rst:1019 +#: ../../library/optparse.rst:1020 msgid "(default: ``\"store\"``)" msgstr "(預設值: ``\"store\"`` )" -#: ../../library/optparse.rst:1021 +#: ../../library/optparse.rst:1022 msgid "" "Determines :mod:`optparse`'s behaviour when this option is seen on the " "command line; the available options are documented :ref:`here `." msgstr "" -#: ../../library/optparse.rst:1027 +#: ../../library/optparse.rst:1028 msgid "(default: ``\"string\"``)" msgstr "(預設值: ``\"string\"`` )" -#: ../../library/optparse.rst:1029 +#: ../../library/optparse.rst:1030 msgid "" "The argument type expected by this option (e.g., ``\"string\"`` or " "``\"int\"``); the available option types are documented :ref:`here `." msgstr "" -#: ../../library/optparse.rst:1035 ../../library/optparse.rst:1085 +#: ../../library/optparse.rst:1036 ../../library/optparse.rst:1086 msgid "(default: derived from option strings)" msgstr "" -#: ../../library/optparse.rst:1037 +#: ../../library/optparse.rst:1038 msgid "" "If the option's action implies writing or modifying a value somewhere, this " "tells :mod:`optparse` where to write it: :attr:`~Option.dest` names an " @@ -1620,47 +1620,47 @@ msgid "" "the command line." msgstr "" -#: ../../library/optparse.rst:1044 +#: ../../library/optparse.rst:1045 msgid "" "The value to use for this option's destination if the option is not seen on " "the command line. See also :meth:`OptionParser.set_defaults`." msgstr "" -#: ../../library/optparse.rst:1049 +#: ../../library/optparse.rst:1050 msgid "(default: 1)" msgstr "(預設值:1)" -#: ../../library/optparse.rst:1051 +#: ../../library/optparse.rst:1052 msgid "" "How many arguments of type :attr:`~Option.type` should be consumed when this " "option is seen. If > 1, :mod:`optparse` will store a tuple of values to :" "attr:`~Option.dest`." msgstr "" -#: ../../library/optparse.rst:1057 +#: ../../library/optparse.rst:1058 msgid "For actions that store a constant value, the constant value to store." msgstr "" -#: ../../library/optparse.rst:1061 +#: ../../library/optparse.rst:1062 msgid "" "For options of type ``\"choice\"``, the list of strings the user may choose " "from." msgstr "" -#: ../../library/optparse.rst:1066 +#: ../../library/optparse.rst:1067 msgid "" "For options with action ``\"callback\"``, the callable to call when this " "option is seen. See section :ref:`optparse-option-callbacks` for detail on " "the arguments passed to the callable." msgstr "" -#: ../../library/optparse.rst:1073 +#: ../../library/optparse.rst:1074 msgid "" "Additional positional and keyword arguments to pass to ``callback`` after " "the four standard callback arguments." msgstr "" -#: ../../library/optparse.rst:1078 +#: ../../library/optparse.rst:1079 msgid "" "Help text to print for this option when listing all available options after " "the user supplies a :attr:`~Option.help` option (such as ``--help``). If no " @@ -1668,17 +1668,17 @@ msgid "" "this option, use the special value :const:`optparse.SUPPRESS_HELP`." msgstr "" -#: ../../library/optparse.rst:1087 +#: ../../library/optparse.rst:1088 msgid "" "Stand-in for the option argument(s) to use when printing help text. See " "section :ref:`optparse-tutorial` for an example." msgstr "" -#: ../../library/optparse.rst:1094 +#: ../../library/optparse.rst:1095 msgid "Standard option actions" msgstr "" -#: ../../library/optparse.rst:1096 +#: ../../library/optparse.rst:1097 msgid "" "The various option actions all have slightly different requirements and " "effects. Most actions have several relevant option attributes which you may " @@ -1686,13 +1686,13 @@ msgid "" "attributes, which you must specify for any option using that action." msgstr "" -#: ../../library/optparse.rst:1101 +#: ../../library/optparse.rst:1102 msgid "" "``\"store\"`` [relevant: :attr:`~Option.type`, :attr:`~Option.dest`, :attr:" "`~Option.nargs`, :attr:`~Option.choices`]" msgstr "" -#: ../../library/optparse.rst:1104 +#: ../../library/optparse.rst:1105 msgid "" "The option must be followed by an argument, which is converted to a value " "according to :attr:`~Option.type` and stored in :attr:`~Option.dest`. If :" @@ -1702,17 +1702,17 @@ msgid "" "option-types` section." msgstr "" -#: ../../library/optparse.rst:1111 +#: ../../library/optparse.rst:1112 msgid "" "If :attr:`~Option.choices` is supplied (a list or tuple of strings), the " "type defaults to ``\"choice\"``." msgstr "" -#: ../../library/optparse.rst:1114 +#: ../../library/optparse.rst:1115 msgid "If :attr:`~Option.type` is not supplied, it defaults to ``\"string\"``." msgstr "" -#: ../../library/optparse.rst:1116 +#: ../../library/optparse.rst:1117 msgid "" "If :attr:`~Option.dest` is not supplied, :mod:`optparse` derives a " "destination from the first long option string (e.g., ``--foo-bar`` implies " @@ -1720,13 +1720,13 @@ msgid "" "destination from the first short option string (e.g., ``-f`` implies ``f``)." msgstr "" -#: ../../library/optparse.rst:1121 ../../library/optparse.rst:1141 -#: ../../library/optparse.rst:1163 ../../library/optparse.rst:1181 -#: ../../library/optparse.rst:1220 ../../library/optparse.rst:1258 +#: ../../library/optparse.rst:1122 ../../library/optparse.rst:1142 +#: ../../library/optparse.rst:1164 ../../library/optparse.rst:1182 +#: ../../library/optparse.rst:1221 ../../library/optparse.rst:1259 msgid "Example::" msgstr "範例: ::" -#: ../../library/optparse.rst:1123 +#: ../../library/optparse.rst:1124 msgid "" "parser.add_option(\"-f\")\n" "parser.add_option(\"-p\", type=\"float\", nargs=3, dest=\"point\")" @@ -1734,19 +1734,19 @@ msgstr "" "parser.add_option(\"-f\")\n" "parser.add_option(\"-p\", type=\"float\", nargs=3, dest=\"point\")" -#: ../../library/optparse.rst:1126 +#: ../../library/optparse.rst:1127 msgid "As it parses the command line ::" msgstr "" -#: ../../library/optparse.rst:1128 +#: ../../library/optparse.rst:1129 msgid "-f foo.txt -p 1 -3.5 4 -fbar.txt" msgstr "-f foo.txt -p 1 -3.5 4 -fbar.txt" -#: ../../library/optparse.rst:1130 +#: ../../library/optparse.rst:1131 msgid ":mod:`optparse` will set ::" msgstr "" -#: ../../library/optparse.rst:1132 +#: ../../library/optparse.rst:1133 msgid "" "options.f = \"foo.txt\"\n" "options.point = (1.0, -3.5, 4.0)\n" @@ -1756,17 +1756,17 @@ msgstr "" "options.point = (1.0, -3.5, 4.0)\n" "options.f = \"bar.txt\"" -#: ../../library/optparse.rst:1136 +#: ../../library/optparse.rst:1137 msgid "" "``\"store_const\"`` [required: :attr:`~Option.const`; relevant: :attr:" "`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1139 +#: ../../library/optparse.rst:1140 msgid "The value :attr:`~Option.const` is stored in :attr:`~Option.dest`." msgstr "" -#: ../../library/optparse.rst:1143 +#: ../../library/optparse.rst:1144 msgid "" "parser.add_option(\"-q\", \"--quiet\",\n" " action=\"store_const\", const=0, dest=\"verbose\")\n" @@ -1782,33 +1782,33 @@ msgstr "" "parser.add_option(\"--noisy\",\n" " action=\"store_const\", const=2, dest=\"verbose\")" -#: ../../library/optparse.rst:1150 +#: ../../library/optparse.rst:1151 msgid "If ``--noisy`` is seen, :mod:`optparse` will set ::" msgstr "" -#: ../../library/optparse.rst:1152 +#: ../../library/optparse.rst:1153 msgid "options.verbose = 2" msgstr "options.verbose = 2" -#: ../../library/optparse.rst:1154 +#: ../../library/optparse.rst:1155 msgid "``\"store_true\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1156 +#: ../../library/optparse.rst:1157 msgid "" "A special case of ``\"store_const\"`` that stores ``True`` to :attr:`~Option." "dest`." msgstr "" -#: ../../library/optparse.rst:1159 +#: ../../library/optparse.rst:1160 msgid "``\"store_false\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1161 +#: ../../library/optparse.rst:1162 msgid "Like ``\"store_true\"``, but stores ``False``." msgstr "" -#: ../../library/optparse.rst:1165 +#: ../../library/optparse.rst:1166 msgid "" "parser.add_option(\"--clobber\", action=\"store_true\", dest=\"clobber\")\n" "parser.add_option(\"--no-clobber\", action=\"store_false\", dest=\"clobber\")" @@ -1816,13 +1816,13 @@ msgstr "" "parser.add_option(\"--clobber\", action=\"store_true\", dest=\"clobber\")\n" "parser.add_option(\"--no-clobber\", action=\"store_false\", dest=\"clobber\")" -#: ../../library/optparse.rst:1168 +#: ../../library/optparse.rst:1169 msgid "" "``\"append\"`` [relevant: :attr:`~Option.type`, :attr:`~Option.dest`, :attr:" "`~Option.nargs`, :attr:`~Option.choices`]" msgstr "" -#: ../../library/optparse.rst:1171 +#: ../../library/optparse.rst:1172 msgid "" "The option must be followed by an argument, which is appended to the list " "in :attr:`~Option.dest`. If no default value for :attr:`~Option.dest` is " @@ -1832,25 +1832,25 @@ msgid "" "is appended to :attr:`~Option.dest`." msgstr "" -#: ../../library/optparse.rst:1178 +#: ../../library/optparse.rst:1179 msgid "" "The defaults for :attr:`~Option.type` and :attr:`~Option.dest` are the same " "as for the ``\"store\"`` action." msgstr "" -#: ../../library/optparse.rst:1183 +#: ../../library/optparse.rst:1184 msgid "" "parser.add_option(\"-t\", \"--tracks\", action=\"append\", type=\"int\")" msgstr "" "parser.add_option(\"-t\", \"--tracks\", action=\"append\", type=\"int\")" -#: ../../library/optparse.rst:1185 +#: ../../library/optparse.rst:1186 msgid "" "If ``-t3`` is seen on the command-line, :mod:`optparse` does the equivalent " "of::" msgstr "" -#: ../../library/optparse.rst:1188 +#: ../../library/optparse.rst:1189 msgid "" "options.tracks = []\n" "options.tracks.append(int(\"3\"))" @@ -1858,15 +1858,15 @@ msgstr "" "options.tracks = []\n" "options.tracks.append(int(\"3\"))" -#: ../../library/optparse.rst:1191 +#: ../../library/optparse.rst:1192 msgid "If, a little later on, ``--tracks=4`` is seen, it does::" msgstr "" -#: ../../library/optparse.rst:1193 +#: ../../library/optparse.rst:1194 msgid "options.tracks.append(int(\"4\"))" msgstr "options.tracks.append(int(\"4\"))" -#: ../../library/optparse.rst:1195 +#: ../../library/optparse.rst:1196 msgid "" "The ``append`` action calls the ``append`` method on the current value of " "the option. This means that any default value specified must have an " @@ -1875,7 +1875,7 @@ msgid "" "with any values from the command line appended after those default values::" msgstr "" -#: ../../library/optparse.rst:1201 +#: ../../library/optparse.rst:1202 msgid "" ">>> parser.add_option(\"--files\", action=\"append\", default=['~/.mypkg/" "defaults'])\n" @@ -1889,13 +1889,13 @@ msgstr "" ">>> opts.files\n" "['~/.mypkg/defaults', 'overrides.mypkg']" -#: ../../library/optparse.rst:1206 +#: ../../library/optparse.rst:1207 msgid "" "``\"append_const\"`` [required: :attr:`~Option.const`; relevant: :attr:" "`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1209 +#: ../../library/optparse.rst:1210 msgid "" "Like ``\"store_const\"``, but the value :attr:`~Option.const` is appended " "to :attr:`~Option.dest`; as with ``\"append\"``, :attr:`~Option.dest` " @@ -1903,28 +1903,28 @@ msgid "" "time the option is encountered." msgstr "" -#: ../../library/optparse.rst:1214 +#: ../../library/optparse.rst:1215 msgid "``\"count\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1216 +#: ../../library/optparse.rst:1217 msgid "" "Increment the integer stored at :attr:`~Option.dest`. If no default value " "is supplied, :attr:`~Option.dest` is set to zero before being incremented " "the first time." msgstr "" -#: ../../library/optparse.rst:1222 +#: ../../library/optparse.rst:1223 msgid "parser.add_option(\"-v\", action=\"count\", dest=\"verbosity\")" msgstr "parser.add_option(\"-v\", action=\"count\", dest=\"verbosity\")" -#: ../../library/optparse.rst:1224 +#: ../../library/optparse.rst:1225 msgid "" "The first time ``-v`` is seen on the command line, :mod:`optparse` does the " "equivalent of::" msgstr "" -#: ../../library/optparse.rst:1227 +#: ../../library/optparse.rst:1228 msgid "" "options.verbosity = 0\n" "options.verbosity += 1" @@ -1932,36 +1932,36 @@ msgstr "" "options.verbosity = 0\n" "options.verbosity += 1" -#: ../../library/optparse.rst:1230 +#: ../../library/optparse.rst:1231 msgid "Every subsequent occurrence of ``-v`` results in ::" msgstr "" -#: ../../library/optparse.rst:1232 +#: ../../library/optparse.rst:1233 msgid "options.verbosity += 1" msgstr "options.verbosity += 1" -#: ../../library/optparse.rst:1234 +#: ../../library/optparse.rst:1235 msgid "" "``\"callback\"`` [required: :attr:`~Option.callback`; relevant: :attr:" "`~Option.type`, :attr:`~Option.nargs`, :attr:`~Option.callback_args`, :attr:" "`~Option.callback_kwargs`]" msgstr "" -#: ../../library/optparse.rst:1238 +#: ../../library/optparse.rst:1239 msgid "" "Call the function specified by :attr:`~Option.callback`, which is called " "as ::" msgstr "" -#: ../../library/optparse.rst:1240 ../../library/optparse.rst:1638 +#: ../../library/optparse.rst:1241 ../../library/optparse.rst:1639 msgid "func(option, opt_str, value, parser, *args, **kwargs)" msgstr "func(option, opt_str, value, parser, *args, **kwargs)" -#: ../../library/optparse.rst:1242 +#: ../../library/optparse.rst:1243 msgid "See section :ref:`optparse-option-callbacks` for more detail." msgstr "更多細節請見 :ref:`optparse-option-callbacks`。" -#: ../../library/optparse.rst:1246 +#: ../../library/optparse.rst:1247 msgid "" "Prints a complete help message for all the options in the current option " "parser. The help message is constructed from the ``usage`` string passed to " @@ -1969,20 +1969,20 @@ msgid "" "every option." msgstr "" -#: ../../library/optparse.rst:1251 +#: ../../library/optparse.rst:1252 msgid "" "If no :attr:`~Option.help` string is supplied for an option, it will still " "be listed in the help message. To omit an option entirely, use the special " "value :const:`optparse.SUPPRESS_HELP`." msgstr "" -#: ../../library/optparse.rst:1255 +#: ../../library/optparse.rst:1256 msgid "" ":mod:`optparse` automatically adds a :attr:`~Option.help` option to all " "OptionParsers, so you do not normally need to create one." msgstr "" -#: ../../library/optparse.rst:1260 +#: ../../library/optparse.rst:1261 msgid "" "from optparse import OptionParser, SUPPRESS_HELP\n" "\n" @@ -1998,14 +1998,14 @@ msgid "" "parser.add_option(\"--secret\", help=SUPPRESS_HELP)" msgstr "" -#: ../../library/optparse.rst:1273 +#: ../../library/optparse.rst:1274 msgid "" "If :mod:`optparse` sees either ``-h`` or ``--help`` on the command line, it " "will print something like the following help message to stdout (assuming " "``sys.argv[0]`` is ``\"foo.py\"``):" msgstr "" -#: ../../library/optparse.rst:1277 +#: ../../library/optparse.rst:1278 msgid "" "Usage: foo.py [options]\n" "\n" @@ -2021,17 +2021,17 @@ msgstr "" " -v Be moderately verbose\n" " --file=FILENAME Input file to read data from" -#: ../../library/optparse.rst:1286 +#: ../../library/optparse.rst:1287 msgid "" "After printing the help message, :mod:`optparse` terminates your process " "with ``sys.exit(0)``." msgstr "" -#: ../../library/optparse.rst:1289 +#: ../../library/optparse.rst:1290 msgid "``\"version\"``" msgstr "``\"version\"``" -#: ../../library/optparse.rst:1291 +#: ../../library/optparse.rst:1292 msgid "" "Prints the version number supplied to the OptionParser to stdout and exits. " "The version number is actually formatted and printed by the " @@ -2041,58 +2041,58 @@ msgid "" "since :mod:`optparse` automatically adds them when needed." msgstr "" -#: ../../library/optparse.rst:1302 +#: ../../library/optparse.rst:1303 msgid "Standard option types" msgstr "" -#: ../../library/optparse.rst:1304 +#: ../../library/optparse.rst:1305 msgid "" ":mod:`optparse` has five built-in option types: ``\"string\"``, ``\"int\"``, " "``\"choice\"``, ``\"float\"`` and ``\"complex\"``. If you need to add new " "option types, see section :ref:`optparse-extending-optparse`." msgstr "" -#: ../../library/optparse.rst:1308 +#: ../../library/optparse.rst:1309 msgid "" "Arguments to string options are not checked or converted in any way: the " "text on the command line is stored in the destination (or passed to the " "callback) as-is." msgstr "" -#: ../../library/optparse.rst:1311 +#: ../../library/optparse.rst:1312 msgid "Integer arguments (type ``\"int\"``) are parsed as follows:" msgstr "" -#: ../../library/optparse.rst:1313 +#: ../../library/optparse.rst:1314 msgid "if the number starts with ``0x``, it is parsed as a hexadecimal number" msgstr "" -#: ../../library/optparse.rst:1315 +#: ../../library/optparse.rst:1316 msgid "if the number starts with ``0``, it is parsed as an octal number" msgstr "" -#: ../../library/optparse.rst:1317 +#: ../../library/optparse.rst:1318 msgid "if the number starts with ``0b``, it is parsed as a binary number" msgstr "" -#: ../../library/optparse.rst:1319 +#: ../../library/optparse.rst:1320 msgid "otherwise, the number is parsed as a decimal number" msgstr "" -#: ../../library/optparse.rst:1322 +#: ../../library/optparse.rst:1323 msgid "" "The conversion is done by calling :func:`int` with the appropriate base (2, " "8, 10, or 16). If this fails, so will :mod:`optparse`, although with a more " "useful error message." msgstr "" -#: ../../library/optparse.rst:1326 +#: ../../library/optparse.rst:1327 msgid "" "``\"float\"`` and ``\"complex\"`` option arguments are converted directly " "with :func:`float` and :func:`complex`, with similar error-handling." msgstr "" -#: ../../library/optparse.rst:1329 +#: ../../library/optparse.rst:1330 msgid "" "``\"choice\"`` options are a subtype of ``\"string\"`` options. The :attr:" "`~Option.choices` option attribute (a sequence of strings) defines the set " @@ -2101,63 +2101,63 @@ msgid "" "`OptionValueError` if an invalid string is given." msgstr "" -#: ../../library/optparse.rst:1339 +#: ../../library/optparse.rst:1340 msgid "Parsing arguments" msgstr "剖析引數" -#: ../../library/optparse.rst:1341 +#: ../../library/optparse.rst:1342 msgid "" "The whole point of creating and populating an OptionParser is to call its :" "meth:`~OptionParser.parse_args` method." msgstr "" -#: ../../library/optparse.rst:1346 +#: ../../library/optparse.rst:1347 msgid "Parse the command-line options found in *args*." msgstr "" -#: ../../library/optparse.rst:1348 +#: ../../library/optparse.rst:1349 msgid "The input parameters are" msgstr "" -#: ../../library/optparse.rst:1350 ../../library/optparse.rst:1364 -#: ../../library/optparse.rst:1682 +#: ../../library/optparse.rst:1351 ../../library/optparse.rst:1365 +#: ../../library/optparse.rst:1683 msgid "``args``" msgstr "``args``" -#: ../../library/optparse.rst:1351 +#: ../../library/optparse.rst:1352 msgid "the list of arguments to process (default: ``sys.argv[1:]``)" msgstr "" -#: ../../library/optparse.rst:1353 +#: ../../library/optparse.rst:1354 msgid "``values``" msgstr "``values``" -#: ../../library/optparse.rst:1354 +#: ../../library/optparse.rst:1355 msgid "" "a :class:`Values` object to store option arguments in (default: a new " "instance of :class:`Values`) -- if you give an existing object, the option " "defaults will not be initialized on it" msgstr "" -#: ../../library/optparse.rst:1358 +#: ../../library/optparse.rst:1359 msgid "and the return value is a pair ``(options, args)`` where" msgstr "" -#: ../../library/optparse.rst:1360 +#: ../../library/optparse.rst:1361 msgid "``options``" msgstr "``options``" -#: ../../library/optparse.rst:1361 +#: ../../library/optparse.rst:1362 msgid "" "the same object that was passed in as *values*, or the ``optparse.Values`` " "instance created by :mod:`optparse`" msgstr "" -#: ../../library/optparse.rst:1365 +#: ../../library/optparse.rst:1366 msgid "the leftover positional arguments after all options have been processed" msgstr "" -#: ../../library/optparse.rst:1367 +#: ../../library/optparse.rst:1368 msgid "" "The most common usage is to supply neither keyword argument. If you supply " "``values``, it will be modified with repeated :func:`setattr` calls (roughly " @@ -2165,7 +2165,7 @@ msgid "" "by :meth:`~OptionParser.parse_args`." msgstr "" -#: ../../library/optparse.rst:1372 +#: ../../library/optparse.rst:1373 msgid "" "If :meth:`~OptionParser.parse_args` encounters any errors in the argument " "list, it calls the OptionParser's :meth:`error` method with an appropriate " @@ -2173,69 +2173,69 @@ msgid "" "status of 2 (the traditional Unix exit status for command-line errors)." msgstr "" -#: ../../library/optparse.rst:1381 +#: ../../library/optparse.rst:1382 msgid "Querying and manipulating your option parser" msgstr "" -#: ../../library/optparse.rst:1383 +#: ../../library/optparse.rst:1384 msgid "" "The default behavior of the option parser can be customized slightly, and " "you can also poke around your option parser and see what's there. " "OptionParser provides several methods to help you out:" msgstr "" -#: ../../library/optparse.rst:1389 +#: ../../library/optparse.rst:1390 msgid "" "Set parsing to stop on the first non-option. For example, if ``-a`` and ``-" "b`` are both simple options that take no arguments, :mod:`optparse` normally " "accepts this syntax::" msgstr "" -#: ../../library/optparse.rst:1393 +#: ../../library/optparse.rst:1394 msgid "prog -a arg1 -b arg2" msgstr "prog -a arg1 -b arg2" -#: ../../library/optparse.rst:1395 +#: ../../library/optparse.rst:1396 msgid "and treats it as equivalent to ::" msgstr "" -#: ../../library/optparse.rst:1397 +#: ../../library/optparse.rst:1398 msgid "prog -a -b arg1 arg2" msgstr "prog -a -b arg1 arg2" -#: ../../library/optparse.rst:1399 +#: ../../library/optparse.rst:1400 msgid "" "To disable this feature, call :meth:`disable_interspersed_args`. This " "restores traditional Unix syntax, where option parsing stops with the first " "non-option argument." msgstr "" -#: ../../library/optparse.rst:1403 +#: ../../library/optparse.rst:1404 msgid "" "Use this if you have a command processor which runs another command which " "has options of its own and you want to make sure these options don't get " "confused. For example, each command might have a different set of options." msgstr "" -#: ../../library/optparse.rst:1409 +#: ../../library/optparse.rst:1410 msgid "" "Set parsing to not stop on the first non-option, allowing interspersing " "switches with command arguments. This is the default behavior." msgstr "" -#: ../../library/optparse.rst:1414 +#: ../../library/optparse.rst:1415 msgid "" "Returns the Option instance with the option string *opt_str*, or ``None`` if " "no options have that option string." msgstr "" -#: ../../library/optparse.rst:1419 +#: ../../library/optparse.rst:1420 msgid "" "Return ``True`` if the OptionParser has an option with option string " "*opt_str* (e.g., ``-q`` or ``--verbose``)." msgstr "" -#: ../../library/optparse.rst:1424 +#: ../../library/optparse.rst:1425 msgid "" "If the :class:`OptionParser` has an option corresponding to *opt_str*, that " "option is removed. If that option provided any other option strings, all of " @@ -2243,17 +2243,17 @@ msgid "" "option belonging to this :class:`OptionParser`, raises :exc:`ValueError`." msgstr "" -#: ../../library/optparse.rst:1433 +#: ../../library/optparse.rst:1434 msgid "Conflicts between options" msgstr "" -#: ../../library/optparse.rst:1435 +#: ../../library/optparse.rst:1436 msgid "" "If you're not careful, it's easy to define options with conflicting option " "strings::" msgstr "" -#: ../../library/optparse.rst:1438 +#: ../../library/optparse.rst:1439 msgid "" "parser.add_option(\"-n\", \"--dry-run\", ...)\n" "...\n" @@ -2263,13 +2263,13 @@ msgstr "" "...\n" "parser.add_option(\"-n\", \"--noisy\", ...)" -#: ../../library/optparse.rst:1442 +#: ../../library/optparse.rst:1443 msgid "" "(This is particularly true if you've defined your own OptionParser subclass " "with some standard options.)" msgstr "" -#: ../../library/optparse.rst:1445 +#: ../../library/optparse.rst:1446 msgid "" "Every time you add an option, :mod:`optparse` checks for conflicts with " "existing options. If it finds any, it invokes the current conflict-handling " @@ -2277,47 +2277,47 @@ msgid "" "constructor::" msgstr "" -#: ../../library/optparse.rst:1449 +#: ../../library/optparse.rst:1450 msgid "parser = OptionParser(..., conflict_handler=handler)" msgstr "parser = OptionParser(..., conflict_handler=handler)" -#: ../../library/optparse.rst:1451 +#: ../../library/optparse.rst:1452 msgid "or with a separate call::" msgstr "" -#: ../../library/optparse.rst:1453 +#: ../../library/optparse.rst:1454 msgid "parser.set_conflict_handler(handler)" msgstr "parser.set_conflict_handler(handler)" -#: ../../library/optparse.rst:1455 +#: ../../library/optparse.rst:1456 msgid "The available conflict handlers are:" msgstr "" -#: ../../library/optparse.rst:1457 +#: ../../library/optparse.rst:1458 msgid "``\"error\"`` (default)" msgstr "" -#: ../../library/optparse.rst:1458 +#: ../../library/optparse.rst:1459 msgid "" "assume option conflicts are a programming error and raise :exc:" "`OptionConflictError`" msgstr "" -#: ../../library/optparse.rst:1461 +#: ../../library/optparse.rst:1462 msgid "``\"resolve\"``" msgstr "``\"resolve\"``" -#: ../../library/optparse.rst:1462 +#: ../../library/optparse.rst:1463 msgid "resolve option conflicts intelligently (see below)" msgstr "" -#: ../../library/optparse.rst:1465 +#: ../../library/optparse.rst:1466 msgid "" "As an example, let's define an :class:`OptionParser` that resolves conflicts " "intelligently and add conflicting options to it::" msgstr "" -#: ../../library/optparse.rst:1468 +#: ../../library/optparse.rst:1469 msgid "" "parser = OptionParser(conflict_handler=\"resolve\")\n" "parser.add_option(\"-n\", \"--dry-run\", ..., help=\"do no harm\")\n" @@ -2327,7 +2327,7 @@ msgstr "" "parser.add_option(\"-n\", \"--dry-run\", ..., help=\"do no harm\")\n" "parser.add_option(\"-n\", \"--noisy\", ..., help=\"be noisy\")" -#: ../../library/optparse.rst:1472 +#: ../../library/optparse.rst:1473 msgid "" "At this point, :mod:`optparse` detects that a previously added option is " "already using the ``-n`` option string. Since ``conflict_handler`` is " @@ -2337,7 +2337,7 @@ msgid "" "message will reflect that::" msgstr "" -#: ../../library/optparse.rst:1478 +#: ../../library/optparse.rst:1479 msgid "" "Options:\n" " --dry-run do no harm\n" @@ -2345,7 +2345,7 @@ msgid "" " -n, --noisy be noisy" msgstr "" -#: ../../library/optparse.rst:1483 +#: ../../library/optparse.rst:1484 msgid "" "It's possible to whittle away the option strings for a previously added " "option until there are none left, and the user has no way of invoking that " @@ -2354,17 +2354,17 @@ msgid "" "Carrying on with our existing OptionParser::" msgstr "" -#: ../../library/optparse.rst:1489 +#: ../../library/optparse.rst:1490 msgid "parser.add_option(\"--dry-run\", ..., help=\"new dry-run option\")" msgstr "parser.add_option(\"--dry-run\", ..., help=\"new dry-run option\")" -#: ../../library/optparse.rst:1491 +#: ../../library/optparse.rst:1492 msgid "" "At this point, the original ``-n``/``--dry-run`` option is no longer " "accessible, so :mod:`optparse` removes it, leaving this help text::" msgstr "" -#: ../../library/optparse.rst:1494 +#: ../../library/optparse.rst:1495 msgid "" "Options:\n" " ...\n" @@ -2376,11 +2376,11 @@ msgstr "" " -n, --noisy be noisy\n" " --dry-run new dry-run option" -#: ../../library/optparse.rst:1503 +#: ../../library/optparse.rst:1504 msgid "Cleanup" msgstr "" -#: ../../library/optparse.rst:1505 +#: ../../library/optparse.rst:1506 msgid "" "OptionParser instances have several cyclic references. This should not be a " "problem for Python's garbage collector, but you may wish to break the cyclic " @@ -2390,15 +2390,15 @@ msgid "" "OptionParser." msgstr "" -#: ../../library/optparse.rst:1516 +#: ../../library/optparse.rst:1517 msgid "Other methods" msgstr "其他方法" -#: ../../library/optparse.rst:1518 +#: ../../library/optparse.rst:1519 msgid "OptionParser supports several other public methods:" msgstr "" -#: ../../library/optparse.rst:1522 +#: ../../library/optparse.rst:1523 msgid "" "Set the usage string according to the rules described above for the " "``usage`` constructor keyword argument. Passing ``None`` sets the default " @@ -2406,7 +2406,7 @@ msgid "" "message." msgstr "" -#: ../../library/optparse.rst:1528 +#: ../../library/optparse.rst:1529 msgid "" "Print the usage message for the current program (``self.usage``) to *file* " "(default stdout). Any occurrence of the string ``%prog`` in ``self.usage`` " @@ -2414,13 +2414,13 @@ msgid "" "usage`` is empty or not defined." msgstr "" -#: ../../library/optparse.rst:1535 +#: ../../library/optparse.rst:1536 msgid "" "Same as :meth:`print_usage` but returns the usage string instead of printing " "it." msgstr "" -#: ../../library/optparse.rst:1540 +#: ../../library/optparse.rst:1541 msgid "" "Set default values for several option destinations at once. Using :meth:" "`set_defaults` is the preferred way to set default values for options, since " @@ -2429,7 +2429,7 @@ msgid "" "default, and the last one wins::" msgstr "" -#: ../../library/optparse.rst:1546 +#: ../../library/optparse.rst:1547 msgid "" "parser.add_option(\"--advanced\", action=\"store_const\",\n" " dest=\"mode\", const=\"advanced\",\n" @@ -2439,11 +2439,11 @@ msgid "" " default=\"advanced\") # overrides above setting" msgstr "" -#: ../../library/optparse.rst:1553 +#: ../../library/optparse.rst:1554 msgid "To avoid this confusion, use :meth:`set_defaults`::" msgstr "" -#: ../../library/optparse.rst:1555 +#: ../../library/optparse.rst:1556 msgid "" "parser.set_defaults(mode=\"advanced\")\n" "parser.add_option(\"--advanced\", action=\"store_const\",\n" @@ -2457,11 +2457,11 @@ msgstr "" "parser.add_option(\"--novice\", action=\"store_const\",\n" " dest=\"mode\", const=\"novice\")" -#: ../../library/optparse.rst:1565 +#: ../../library/optparse.rst:1566 msgid "Option Callbacks" msgstr "" -#: ../../library/optparse.rst:1567 +#: ../../library/optparse.rst:1568 msgid "" "When :mod:`optparse`'s built-in actions and types aren't quite enough for " "your needs, you have two choices: extend :mod:`optparse` or define a " @@ -2469,25 +2469,25 @@ msgid "" "a lot of simple cases. Quite often a simple callback is all you need." msgstr "" -#: ../../library/optparse.rst:1572 +#: ../../library/optparse.rst:1573 msgid "There are two steps to defining a callback option:" msgstr "" -#: ../../library/optparse.rst:1574 +#: ../../library/optparse.rst:1575 msgid "define the option itself using the ``\"callback\"`` action" msgstr "" -#: ../../library/optparse.rst:1576 +#: ../../library/optparse.rst:1577 msgid "" "write the callback; this is a function (or method) that takes at least four " "arguments, as described below" msgstr "" -#: ../../library/optparse.rst:1583 +#: ../../library/optparse.rst:1584 msgid "Defining a callback option" msgstr "" -#: ../../library/optparse.rst:1585 +#: ../../library/optparse.rst:1586 msgid "" "As always, the easiest way to define a callback option is by using the :meth:" "`OptionParser.add_option` method. Apart from :attr:`~Option.action`, the " @@ -2495,11 +2495,11 @@ msgid "" "call::" msgstr "" -#: ../../library/optparse.rst:1589 +#: ../../library/optparse.rst:1590 msgid "parser.add_option(\"-c\", action=\"callback\", callback=my_callback)" msgstr "parser.add_option(\"-c\", action=\"callback\", callback=my_callback)" -#: ../../library/optparse.rst:1591 +#: ../../library/optparse.rst:1592 msgid "" "``callback`` is a function (or other callable object), so you must have " "already defined ``my_callback()`` when you create this callback option. In " @@ -2511,7 +2511,7 @@ msgid "" "tricky; it's covered later in this section." msgstr "" -#: ../../library/optparse.rst:1600 +#: ../../library/optparse.rst:1601 msgid "" ":mod:`optparse` always passes four particular arguments to your callback, " "and it will only pass additional arguments if you specify them via :attr:" @@ -2519,25 +2519,25 @@ msgid "" "minimal callback function signature is::" msgstr "" -#: ../../library/optparse.rst:1605 +#: ../../library/optparse.rst:1606 msgid "def my_callback(option, opt, value, parser):" msgstr "def my_callback(option, opt, value, parser):" -#: ../../library/optparse.rst:1607 +#: ../../library/optparse.rst:1608 msgid "The four arguments to a callback are described below." msgstr "" -#: ../../library/optparse.rst:1609 +#: ../../library/optparse.rst:1610 msgid "" "There are several other option attributes that you can supply when you " "define a callback option:" msgstr "" -#: ../../library/optparse.rst:1612 +#: ../../library/optparse.rst:1613 msgid ":attr:`~Option.type`" msgstr ":attr:`~Option.type`" -#: ../../library/optparse.rst:1613 +#: ../../library/optparse.rst:1614 msgid "" "has its usual meaning: as with the ``\"store\"`` or ``\"append\"`` actions, " "it instructs :mod:`optparse` to consume one argument and convert it to :attr:" @@ -2545,11 +2545,11 @@ msgid "" "though, :mod:`optparse` passes it to your callback function." msgstr "" -#: ../../library/optparse.rst:1618 +#: ../../library/optparse.rst:1619 msgid ":attr:`~Option.nargs`" msgstr ":attr:`~Option.nargs`" -#: ../../library/optparse.rst:1619 +#: ../../library/optparse.rst:1620 msgid "" "also has its usual meaning: if it is supplied and > 1, :mod:`optparse` will " "consume :attr:`~Option.nargs` arguments, each of which must be convertible " @@ -2557,43 +2557,43 @@ msgid "" "callback." msgstr "" -#: ../../library/optparse.rst:1624 +#: ../../library/optparse.rst:1625 msgid ":attr:`~Option.callback_args`" msgstr ":attr:`~Option.callback_args`" -#: ../../library/optparse.rst:1625 +#: ../../library/optparse.rst:1626 msgid "a tuple of extra positional arguments to pass to the callback" msgstr "" -#: ../../library/optparse.rst:1627 +#: ../../library/optparse.rst:1628 msgid ":attr:`~Option.callback_kwargs`" msgstr ":attr:`~Option.callback_kwargs`" -#: ../../library/optparse.rst:1628 +#: ../../library/optparse.rst:1629 msgid "a dictionary of extra keyword arguments to pass to the callback" msgstr "" -#: ../../library/optparse.rst:1634 +#: ../../library/optparse.rst:1635 msgid "How callbacks are called" msgstr "" -#: ../../library/optparse.rst:1636 +#: ../../library/optparse.rst:1637 msgid "All callbacks are called as follows::" msgstr "" -#: ../../library/optparse.rst:1642 +#: ../../library/optparse.rst:1643 msgid "``option``" msgstr "``option``" -#: ../../library/optparse.rst:1643 +#: ../../library/optparse.rst:1644 msgid "is the Option instance that's calling the callback" msgstr "" -#: ../../library/optparse.rst:1645 +#: ../../library/optparse.rst:1646 msgid "``opt_str``" msgstr "``opt_str``" -#: ../../library/optparse.rst:1646 +#: ../../library/optparse.rst:1647 msgid "" "is the option string seen on the command-line that's triggering the " "callback. (If an abbreviated long option was used, ``opt_str`` will be the " @@ -2602,11 +2602,11 @@ msgid "" "``\"--foobar\"``.)" msgstr "" -#: ../../library/optparse.rst:1652 +#: ../../library/optparse.rst:1653 msgid "``value``" msgstr "``value``" -#: ../../library/optparse.rst:1653 +#: ../../library/optparse.rst:1654 msgid "" "is the argument to this option seen on the command-line. :mod:`optparse` " "will only expect an argument if :attr:`~Option.type` is set; the type of " @@ -2616,21 +2616,21 @@ msgid "" "of values of the appropriate type." msgstr "" -#: ../../library/optparse.rst:1659 +#: ../../library/optparse.rst:1660 msgid "``parser``" msgstr "``parser``" -#: ../../library/optparse.rst:1660 +#: ../../library/optparse.rst:1661 msgid "" "is the OptionParser instance driving the whole thing, mainly useful because " "you can access some other interesting data through its instance attributes:" msgstr "" -#: ../../library/optparse.rst:1663 +#: ../../library/optparse.rst:1664 msgid "``parser.largs``" msgstr "``parser.largs``" -#: ../../library/optparse.rst:1664 +#: ../../library/optparse.rst:1665 msgid "" "the current list of leftover arguments, ie. arguments that have been " "consumed but are neither options nor option arguments. Feel free to modify " @@ -2639,22 +2639,22 @@ msgid "" "parse_args`.)" msgstr "" -#: ../../library/optparse.rst:1669 +#: ../../library/optparse.rst:1670 msgid "``parser.rargs``" msgstr "``parser.rargs``" -#: ../../library/optparse.rst:1670 +#: ../../library/optparse.rst:1671 msgid "" "the current list of remaining arguments, ie. with ``opt_str`` and ``value`` " "(if applicable) removed, and only the arguments following them still there. " "Feel free to modify ``parser.rargs``, e.g. by consuming more arguments." msgstr "" -#: ../../library/optparse.rst:1675 +#: ../../library/optparse.rst:1676 msgid "``parser.values``" msgstr "``parser.values``" -#: ../../library/optparse.rst:1676 +#: ../../library/optparse.rst:1677 msgid "" "the object where option values are by default stored (an instance of " "optparse.OptionValues). This lets callbacks use the same mechanism as the " @@ -2663,27 +2663,27 @@ msgid "" "of any options already encountered on the command-line." msgstr "" -#: ../../library/optparse.rst:1683 +#: ../../library/optparse.rst:1684 msgid "" "is a tuple of arbitrary positional arguments supplied via the :attr:`~Option." "callback_args` option attribute." msgstr "" -#: ../../library/optparse.rst:1686 +#: ../../library/optparse.rst:1687 msgid "``kwargs``" msgstr "``kwargs``" -#: ../../library/optparse.rst:1687 +#: ../../library/optparse.rst:1688 msgid "" "is a dictionary of arbitrary keyword arguments supplied via :attr:`~Option." "callback_kwargs`." msgstr "" -#: ../../library/optparse.rst:1694 +#: ../../library/optparse.rst:1695 msgid "Raising errors in a callback" msgstr "" -#: ../../library/optparse.rst:1696 +#: ../../library/optparse.rst:1697 msgid "" "The callback function should raise :exc:`OptionValueError` if there are any " "problems with the option or its argument(s). :mod:`optparse` catches this " @@ -2693,17 +2693,17 @@ msgid "" "they did wrong." msgstr "" -#: ../../library/optparse.rst:1706 +#: ../../library/optparse.rst:1707 msgid "Callback example 1: trivial callback" msgstr "" -#: ../../library/optparse.rst:1708 +#: ../../library/optparse.rst:1709 msgid "" "Here's an example of a callback option that takes no arguments, and simply " "records that the option was seen::" msgstr "" -#: ../../library/optparse.rst:1711 +#: ../../library/optparse.rst:1712 msgid "" "def record_foo_seen(option, opt_str, value, parser):\n" " parser.values.saw_foo = True\n" @@ -2715,21 +2715,21 @@ msgstr "" "\n" "parser.add_option(\"--foo\", action=\"callback\", callback=record_foo_seen)" -#: ../../library/optparse.rst:1716 +#: ../../library/optparse.rst:1717 msgid "Of course, you could do that with the ``\"store_true\"`` action." msgstr "" -#: ../../library/optparse.rst:1722 +#: ../../library/optparse.rst:1723 msgid "Callback example 2: check option order" msgstr "" -#: ../../library/optparse.rst:1724 +#: ../../library/optparse.rst:1725 msgid "" "Here's a slightly more interesting example: record the fact that ``-a`` is " "seen, but blow up if it comes after ``-b`` in the command-line. ::" msgstr "" -#: ../../library/optparse.rst:1727 +#: ../../library/optparse.rst:1728 msgid "" "def check_order(option, opt_str, value, parser):\n" " if parser.values.b:\n" @@ -2747,18 +2747,18 @@ msgstr "" "parser.add_option(\"-a\", action=\"callback\", callback=check_order)\n" "parser.add_option(\"-b\", action=\"store_true\", dest=\"b\")" -#: ../../library/optparse.rst:1739 +#: ../../library/optparse.rst:1740 msgid "Callback example 3: check option order (generalized)" msgstr "" -#: ../../library/optparse.rst:1741 +#: ../../library/optparse.rst:1742 msgid "" "If you want to reuse this callback for several similar options (set a flag, " "but blow up if ``-b`` has already been seen), it needs a bit of work: the " "error message and the flag that it sets must be generalized. ::" msgstr "" -#: ../../library/optparse.rst:1745 +#: ../../library/optparse.rst:1746 msgid "" "def check_order(option, opt_str, value, parser):\n" " if parser.values.b:\n" @@ -2782,11 +2782,11 @@ msgstr "" "parser.add_option(\"-c\", action=\"callback\", callback=check_order, " "dest='c')" -#: ../../library/optparse.rst:1758 +#: ../../library/optparse.rst:1759 msgid "Callback example 4: check arbitrary condition" msgstr "" -#: ../../library/optparse.rst:1760 +#: ../../library/optparse.rst:1761 msgid "" "Of course, you could put any condition in there---you're not limited to " "checking the values of already-defined options. For example, if you have " @@ -2794,7 +2794,7 @@ msgid "" "is this::" msgstr "" -#: ../../library/optparse.rst:1764 +#: ../../library/optparse.rst:1765 msgid "" "def check_moon(option, opt_str, value, parser):\n" " if is_moon_full():\n" @@ -2814,16 +2814,16 @@ msgstr "" "parser.add_option(\"--foo\",\n" " action=\"callback\", callback=check_moon, dest=\"foo\")" -#: ../../library/optparse.rst:1773 +#: ../../library/optparse.rst:1774 msgid "" "(The definition of ``is_moon_full()`` is left as an exercise for the reader.)" msgstr "" -#: ../../library/optparse.rst:1779 +#: ../../library/optparse.rst:1780 msgid "Callback example 5: fixed arguments" msgstr "" -#: ../../library/optparse.rst:1781 +#: ../../library/optparse.rst:1782 msgid "" "Things get slightly more interesting when you define callback options that " "take a fixed number of arguments. Specifying that a callback option takes " @@ -2833,12 +2833,12 @@ msgid "" "nargs`, then the option takes :attr:`~Option.nargs` arguments." msgstr "" -#: ../../library/optparse.rst:1788 +#: ../../library/optparse.rst:1789 msgid "" "Here's an example that just emulates the standard ``\"store\"`` action::" msgstr "" -#: ../../library/optparse.rst:1790 +#: ../../library/optparse.rst:1791 msgid "" "def store_value(option, opt_str, value, parser):\n" " setattr(parser.values, option.dest, value)\n" @@ -2854,18 +2854,18 @@ msgstr "" " action=\"callback\", callback=store_value,\n" " type=\"int\", nargs=3, dest=\"foo\")" -#: ../../library/optparse.rst:1797 +#: ../../library/optparse.rst:1798 msgid "" "Note that :mod:`optparse` takes care of consuming 3 arguments and converting " "them to integers for you; all you have to do is store them. (Or whatever; " "obviously you don't need a callback for this example.)" msgstr "" -#: ../../library/optparse.rst:1805 +#: ../../library/optparse.rst:1806 msgid "Callback example 6: variable arguments" msgstr "" -#: ../../library/optparse.rst:1807 +#: ../../library/optparse.rst:1808 msgid "" "Things get hairy when you want an option to take a variable number of " "arguments. For this case, you must write a callback, as :mod:`optparse` " @@ -2875,23 +2875,23 @@ msgid "" "implement the conventional rules for bare ``--`` and ``-`` arguments:" msgstr "" -#: ../../library/optparse.rst:1814 +#: ../../library/optparse.rst:1815 msgid "either ``--`` or ``-`` can be option arguments" msgstr "" -#: ../../library/optparse.rst:1816 +#: ../../library/optparse.rst:1817 msgid "" "bare ``--`` (if not the argument to some option): halt command-line " "processing and discard the ``--``" msgstr "" -#: ../../library/optparse.rst:1819 +#: ../../library/optparse.rst:1820 msgid "" "bare ``-`` (if not the argument to some option): halt command-line " "processing but keep the ``-`` (append it to ``parser.largs``)" msgstr "" -#: ../../library/optparse.rst:1822 +#: ../../library/optparse.rst:1823 msgid "" "If you want an option that takes a variable number of arguments, there are " "several subtle, tricky issues to worry about. The exact implementation you " @@ -2900,13 +2900,13 @@ msgid "" "directly)." msgstr "" -#: ../../library/optparse.rst:1828 +#: ../../library/optparse.rst:1829 msgid "" "Nevertheless, here's a stab at a callback for an option with variable " "arguments::" msgstr "" -#: ../../library/optparse.rst:1831 +#: ../../library/optparse.rst:1832 msgid "" "def vararg_callback(option, opt_str, value, parser):\n" " assert value is None\n" @@ -2936,22 +2936,22 @@ msgid "" " action=\"callback\", callback=vararg_callback)" msgstr "" -#: ../../library/optparse.rst:1862 +#: ../../library/optparse.rst:1863 msgid "Extending :mod:`optparse`" msgstr "" -#: ../../library/optparse.rst:1864 +#: ../../library/optparse.rst:1865 msgid "" "Since the two major controlling factors in how :mod:`optparse` interprets " "command-line options are the action and type of each option, the most likely " "direction of extension is to add new actions and new types." msgstr "" -#: ../../library/optparse.rst:1872 +#: ../../library/optparse.rst:1873 msgid "Adding new types" msgstr "" -#: ../../library/optparse.rst:1874 +#: ../../library/optparse.rst:1875 msgid "" "To add new types, you need to define your own subclass of :mod:`optparse`'s :" "class:`Option` class. This class has a couple of attributes that define :" @@ -2959,23 +2959,23 @@ msgid "" "TYPE_CHECKER`." msgstr "" -#: ../../library/optparse.rst:1880 +#: ../../library/optparse.rst:1881 msgid "" "A tuple of type names; in your subclass, simply define a new tuple :attr:" "`TYPES` that builds on the standard one." msgstr "" -#: ../../library/optparse.rst:1885 +#: ../../library/optparse.rst:1886 msgid "" "A dictionary mapping type names to type-checking functions. A type-checking " "function has the following signature::" msgstr "" -#: ../../library/optparse.rst:1888 +#: ../../library/optparse.rst:1889 msgid "def check_mytype(option, opt, value)" msgstr "def check_mytype(option, opt, value)" -#: ../../library/optparse.rst:1890 +#: ../../library/optparse.rst:1891 msgid "" "where ``option`` is an :class:`Option` instance, ``opt`` is an option string " "(e.g., ``-f``), and ``value`` is the string from the command line that must " @@ -2986,7 +2986,7 @@ msgid "" "``value`` parameter." msgstr "" -#: ../../library/optparse.rst:1898 +#: ../../library/optparse.rst:1899 msgid "" "Your type-checking function should raise :exc:`OptionValueError` if it " "encounters any problems. :exc:`OptionValueError` takes a single string " @@ -2995,7 +2995,7 @@ msgid "" "\"`` and prints everything to stderr before terminating the process." msgstr "" -#: ../../library/optparse.rst:1904 +#: ../../library/optparse.rst:1905 msgid "" "Here's a silly example that demonstrates adding a ``\"complex\"`` option " "type to parse Python-style complex numbers on the command line. (This is " @@ -3003,11 +3003,11 @@ msgid "" "support for complex numbers, but never mind.)" msgstr "" -#: ../../library/optparse.rst:1909 +#: ../../library/optparse.rst:1910 msgid "First, the necessary imports::" msgstr "" -#: ../../library/optparse.rst:1911 +#: ../../library/optparse.rst:1912 msgid "" "from copy import copy\n" "from optparse import Option, OptionValueError" @@ -3015,13 +3015,13 @@ msgstr "" "from copy import copy\n" "from optparse import Option, OptionValueError" -#: ../../library/optparse.rst:1914 +#: ../../library/optparse.rst:1915 msgid "" "You need to define your type-checker first, since it's referred to later (in " "the :attr:`~Option.TYPE_CHECKER` class attribute of your Option subclass)::" msgstr "" -#: ../../library/optparse.rst:1917 +#: ../../library/optparse.rst:1918 msgid "" "def check_complex(option, opt, value):\n" " try:\n" @@ -3037,11 +3037,11 @@ msgstr "" " raise OptionValueError(\n" " \"option %s: invalid complex value: %r\" % (opt, value))" -#: ../../library/optparse.rst:1924 +#: ../../library/optparse.rst:1925 msgid "Finally, the Option subclass::" msgstr "" -#: ../../library/optparse.rst:1926 +#: ../../library/optparse.rst:1927 msgid "" "class MyOption (Option):\n" " TYPES = Option.TYPES + (\"complex\",)\n" @@ -3053,7 +3053,7 @@ msgstr "" " TYPE_CHECKER = copy(Option.TYPE_CHECKER)\n" " TYPE_CHECKER[\"complex\"] = check_complex" -#: ../../library/optparse.rst:1931 +#: ../../library/optparse.rst:1932 msgid "" "(If we didn't make a :func:`copy` of :attr:`Option.TYPE_CHECKER`, we would " "end up modifying the :attr:`~Option.TYPE_CHECKER` attribute of :mod:" @@ -3061,14 +3061,14 @@ msgid "" "that except good manners and common sense.)" msgstr "" -#: ../../library/optparse.rst:1936 +#: ../../library/optparse.rst:1937 msgid "" "That's it! Now you can write a script that uses the new option type just " "like any other :mod:`optparse`\\ -based script, except you have to instruct " "your OptionParser to use MyOption instead of Option::" msgstr "" -#: ../../library/optparse.rst:1940 +#: ../../library/optparse.rst:1941 msgid "" "parser = OptionParser(option_class=MyOption)\n" "parser.add_option(\"-c\", type=\"complex\")" @@ -3076,14 +3076,14 @@ msgstr "" "parser = OptionParser(option_class=MyOption)\n" "parser.add_option(\"-c\", type=\"complex\")" -#: ../../library/optparse.rst:1943 +#: ../../library/optparse.rst:1944 msgid "" "Alternately, you can build your own option list and pass it to OptionParser; " "if you don't use :meth:`add_option` in the above way, you don't need to tell " "OptionParser which option class to use::" msgstr "" -#: ../../library/optparse.rst:1947 +#: ../../library/optparse.rst:1948 msgid "" "option_list = [MyOption(\"-c\", action=\"store\", type=\"complex\", " "dest=\"c\")]\n" @@ -3093,32 +3093,32 @@ msgstr "" "dest=\"c\")]\n" "parser = OptionParser(option_list=option_list)" -#: ../../library/optparse.rst:1954 +#: ../../library/optparse.rst:1955 msgid "Adding new actions" msgstr "" -#: ../../library/optparse.rst:1956 +#: ../../library/optparse.rst:1957 msgid "" "Adding new actions is a bit trickier, because you have to understand that :" "mod:`optparse` has a couple of classifications for actions:" msgstr "" -#: ../../library/optparse.rst:1959 +#: ../../library/optparse.rst:1960 msgid "\"store\" actions" msgstr "" -#: ../../library/optparse.rst:1960 +#: ../../library/optparse.rst:1961 msgid "" "actions that result in :mod:`optparse` storing a value to an attribute of " "the current OptionValues instance; these options require a :attr:`~Option." "dest` attribute to be supplied to the Option constructor." msgstr "" -#: ../../library/optparse.rst:1964 +#: ../../library/optparse.rst:1965 msgid "\"typed\" actions" msgstr "" -#: ../../library/optparse.rst:1965 +#: ../../library/optparse.rst:1966 msgid "" "actions that take a value from the command line and expect it to be of a " "certain type; or rather, a string that can be converted to a certain type. " @@ -3126,7 +3126,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/optparse.rst:1970 +#: ../../library/optparse.rst:1971 msgid "" "These are overlapping sets: some default \"store\" actions are " "``\"store\"``, ``\"store_const\"``, ``\"append\"``, and ``\"count\"``, while " @@ -3134,25 +3134,25 @@ msgid "" "``\"callback\"``." msgstr "" -#: ../../library/optparse.rst:1974 +#: ../../library/optparse.rst:1975 msgid "" "When you add an action, you need to categorize it by listing it in at least " "one of the following class attributes of Option (all are lists of strings):" msgstr "" -#: ../../library/optparse.rst:1979 +#: ../../library/optparse.rst:1980 msgid "All actions must be listed in ACTIONS." msgstr "" -#: ../../library/optparse.rst:1983 +#: ../../library/optparse.rst:1984 msgid "\"store\" actions are additionally listed here." msgstr "" -#: ../../library/optparse.rst:1987 +#: ../../library/optparse.rst:1988 msgid "\"typed\" actions are additionally listed here." msgstr "" -#: ../../library/optparse.rst:1991 +#: ../../library/optparse.rst:1992 msgid "" "Actions that always take a type (i.e. whose options always take a value) are " "additionally listed here. The only effect of this is that :mod:`optparse` " @@ -3160,13 +3160,13 @@ msgid "" "whose action is listed in :attr:`ALWAYS_TYPED_ACTIONS`." msgstr "" -#: ../../library/optparse.rst:1996 +#: ../../library/optparse.rst:1997 msgid "" "In order to actually implement your new action, you must override Option's :" "meth:`take_action` method and add a case that recognizes your action." msgstr "" -#: ../../library/optparse.rst:1999 +#: ../../library/optparse.rst:2000 msgid "" "For example, let's add an ``\"extend\"`` action. This is similar to the " "standard ``\"append\"`` action, but instead of taking a single value from " @@ -3176,23 +3176,23 @@ msgid "" "option of type ``\"string\"``, the command line ::" msgstr "" -#: ../../library/optparse.rst:2006 +#: ../../library/optparse.rst:2007 msgid "--names=foo,bar --names blah --names ding,dong" msgstr "--names=foo,bar --names blah --names ding,dong" -#: ../../library/optparse.rst:2008 +#: ../../library/optparse.rst:2009 msgid "would result in a list ::" msgstr "" -#: ../../library/optparse.rst:2010 +#: ../../library/optparse.rst:2011 msgid "[\"foo\", \"bar\", \"blah\", \"ding\", \"dong\"]" msgstr "[\"foo\", \"bar\", \"blah\", \"ding\", \"dong\"]" -#: ../../library/optparse.rst:2012 +#: ../../library/optparse.rst:2013 msgid "Again we define a subclass of Option::" msgstr "" -#: ../../library/optparse.rst:2014 +#: ../../library/optparse.rst:2015 msgid "" "class MyOption(Option):\n" "\n" @@ -3224,43 +3224,43 @@ msgstr "" " Option.take_action(\n" " self, action, dest, opt, value, values, parser)" -#: ../../library/optparse.rst:2029 +#: ../../library/optparse.rst:2030 msgid "Features of note:" msgstr "" -#: ../../library/optparse.rst:2031 +#: ../../library/optparse.rst:2032 msgid "" "``\"extend\"`` both expects a value on the command-line and stores that " "value somewhere, so it goes in both :attr:`~Option.STORE_ACTIONS` and :attr:" "`~Option.TYPED_ACTIONS`." msgstr "" -#: ../../library/optparse.rst:2035 +#: ../../library/optparse.rst:2036 msgid "" "to ensure that :mod:`optparse` assigns the default type of ``\"string\"`` to " "``\"extend\"`` actions, we put the ``\"extend\"`` action in :attr:`~Option." "ALWAYS_TYPED_ACTIONS` as well." msgstr "" -#: ../../library/optparse.rst:2039 +#: ../../library/optparse.rst:2040 msgid "" ":meth:`MyOption.take_action` implements just this one new action, and passes " "control back to :meth:`Option.take_action` for the standard :mod:`optparse` " "actions." msgstr "" -#: ../../library/optparse.rst:2043 +#: ../../library/optparse.rst:2044 msgid "" "``values`` is an instance of the optparse_parser.Values class, which " "provides the very useful :meth:`ensure_value` method. :meth:`ensure_value` " "is essentially :func:`getattr` with a safety valve; it is called as ::" msgstr "" -#: ../../library/optparse.rst:2047 +#: ../../library/optparse.rst:2048 msgid "values.ensure_value(attr, value)" msgstr "values.ensure_value(attr, value)" -#: ../../library/optparse.rst:2049 +#: ../../library/optparse.rst:2050 msgid "" "If the ``attr`` attribute of ``values`` doesn't exist or is ``None``, then " "ensure_value() first sets it to ``value``, and then returns ``value``. This " @@ -3273,28 +3273,28 @@ msgid "" "meth:`ensure_value` will take care of getting it right when it's needed." msgstr "" -#: ../../library/optparse.rst:2060 +#: ../../library/optparse.rst:2061 msgid "Exceptions" msgstr "例外" -#: ../../library/optparse.rst:2064 +#: ../../library/optparse.rst:2065 msgid "" "Raised if an :class:`Option` instance is created with invalid or " "inconsistent arguments." msgstr "" -#: ../../library/optparse.rst:2069 +#: ../../library/optparse.rst:2070 msgid "Raised if conflicting options are added to an :class:`OptionParser`." msgstr "" -#: ../../library/optparse.rst:2073 +#: ../../library/optparse.rst:2074 msgid "Raised if an invalid option value is encountered on the command line." msgstr "" -#: ../../library/optparse.rst:2077 +#: ../../library/optparse.rst:2078 msgid "Raised if an invalid option is passed on the command line." msgstr "" -#: ../../library/optparse.rst:2081 +#: ../../library/optparse.rst:2082 msgid "Raised if an ambiguous option is passed on the command line." msgstr "" diff --git a/library/os.path.po b/library/os.path.po index a84dfbd3d8..7480d8c542 100644 --- a/library/os.path.po +++ b/library/os.path.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-07-13 14:06+0800\n" "Last-Translator: Po-Chuan Chen \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -109,18 +109,18 @@ msgstr "" "func:`normpath` 函式:``normpath(join(os.getcwd(), path))``。" #: ../../library/os.path.rst:63 ../../library/os.path.rst:76 -#: ../../library/os.path.rst:114 ../../library/os.path.rst:123 -#: ../../library/os.path.rst:139 ../../library/os.path.rst:149 -#: ../../library/os.path.rst:175 ../../library/os.path.rst:195 -#: ../../library/os.path.rst:212 ../../library/os.path.rst:224 -#: ../../library/os.path.rst:233 ../../library/os.path.rst:243 -#: ../../library/os.path.rst:253 ../../library/os.path.rst:263 -#: ../../library/os.path.rst:282 ../../library/os.path.rst:301 -#: ../../library/os.path.rst:350 ../../library/os.path.rst:370 -#: ../../library/os.path.rst:393 ../../library/os.path.rst:413 -#: ../../library/os.path.rst:429 ../../library/os.path.rst:440 -#: ../../library/os.path.rst:454 ../../library/os.path.rst:470 -#: ../../library/os.path.rst:495 ../../library/os.path.rst:559 +#: ../../library/os.path.rst:117 ../../library/os.path.rst:126 +#: ../../library/os.path.rst:142 ../../library/os.path.rst:152 +#: ../../library/os.path.rst:178 ../../library/os.path.rst:198 +#: ../../library/os.path.rst:215 ../../library/os.path.rst:227 +#: ../../library/os.path.rst:236 ../../library/os.path.rst:246 +#: ../../library/os.path.rst:260 ../../library/os.path.rst:270 +#: ../../library/os.path.rst:289 ../../library/os.path.rst:308 +#: ../../library/os.path.rst:380 ../../library/os.path.rst:400 +#: ../../library/os.path.rst:423 ../../library/os.path.rst:443 +#: ../../library/os.path.rst:459 ../../library/os.path.rst:470 +#: ../../library/os.path.rst:484 ../../library/os.path.rst:500 +#: ../../library/os.path.rst:525 ../../library/os.path.rst:589 msgid "Accepts a :term:`path-like object`." msgstr "接受一個 :term:`path-like object`。" @@ -138,8 +138,9 @@ msgstr "" "`basename` 函式回傳空字串(``''``)。" #: ../../library/os.path.rst:82 +#, fuzzy msgid "" -"Return the longest common sub-path of each pathname in the sequence " +"Return the longest common sub-path of each pathname in the iterable " "*paths*. Raise :exc:`ValueError` if *paths* contain both absolute and " "relative pathnames, if *paths* are on different drives, or if *paths* is " "empty. Unlike :func:`commonprefix`, this returns a valid path." @@ -152,7 +153,11 @@ msgstr "" msgid "Accepts a sequence of :term:`path-like objects `." msgstr "接受一個\\ :term:`類路徑物件 `\\ 的序列。" -#: ../../library/os.path.rst:96 +#: ../../library/os.path.rst:93 +msgid "Any iterable can now be passed, rather than just sequences." +msgstr "" + +#: ../../library/os.path.rst:99 msgid "" "Return the longest path prefix (taken character-by-character) that is a " "prefix of all paths in *list*. If *list* is empty, return the empty string " @@ -161,7 +166,7 @@ msgstr "" "回傳 *list* 中所有路徑的最長路徑前綴(逐字元比較)。如果 *list* 為空,則回傳" "空字串(``''``)。" -#: ../../library/os.path.rst:102 +#: ../../library/os.path.rst:105 msgid "" "This function may return invalid paths because it works a character at a " "time. To obtain a valid path, see :func:`commonpath`." @@ -169,7 +174,7 @@ msgstr "" "由於此函式是逐字元比較,因此可能會回傳無效的路徑。若要獲得有效的路徑,請參" "考 :func:`commonpath` 函式。" -#: ../../library/os.path.rst:108 +#: ../../library/os.path.rst:111 msgid "" ">>> os.path.commonprefix(['/usr/lib', '/usr/local/lib'])\n" "'/usr/l'\n" @@ -183,7 +188,7 @@ msgstr "" ">>> os.path.commonpath(['/usr/lib', '/usr/local/lib'])\n" "'/usr'" -#: ../../library/os.path.rst:120 +#: ../../library/os.path.rst:123 msgid "" "Return the directory name of pathname *path*. This is the first element of " "the pair returned by passing *path* to the function :func:`split`." @@ -191,7 +196,7 @@ msgstr "" "回傳路徑名 *path* 的目錄名稱。這是將 *path* 傳遞給函式 :func:`split` 後回傳之" "成對結果中的第一個元素。" -#: ../../library/os.path.rst:129 +#: ../../library/os.path.rst:132 msgid "" "Return ``True`` if *path* refers to an existing path or an open file " "descriptor. Returns ``False`` for broken symbolic links. On some " @@ -203,7 +208,7 @@ msgstr "" "的符號連結則回傳 ``False``。在某些平台上,即使 *path* 實際存在,如果未被授予" "執行 :func:`os.stat` 的權限,此函式仍可能回傳 ``False``。" -#: ../../library/os.path.rst:135 +#: ../../library/os.path.rst:138 msgid "" "*path* can now be an integer: ``True`` is returned if it is an open file " "descriptor, ``False`` otherwise." @@ -211,7 +216,7 @@ msgstr "" "現在 *path* 可以是一個整數:如果它是一個開啟的檔案描述器,則回傳 ``True``;否" "則回傳 ``False``。" -#: ../../library/os.path.rst:145 +#: ../../library/os.path.rst:148 msgid "" "Return ``True`` if *path* refers to an existing path, including broken " "symbolic links. Equivalent to :func:`exists` on platforms lacking :func:" @@ -220,7 +225,7 @@ msgstr "" "如果 *path* 是一個存在的路徑則回傳 ``True``,對已損壞的符號連結也是。在缺乏 :" "func:`os.lstat` 的平台上,與 :func:`exists` 函式等效。" -#: ../../library/os.path.rst:157 +#: ../../library/os.path.rst:160 msgid "" "On Unix and Windows, return the argument with an initial component of ``~`` " "or ``~user`` replaced by that *user*'s home directory." @@ -228,7 +233,7 @@ msgstr "" "在 Unix 和 Windows 上,將引數中以 ``~`` 或 ``~user`` 開頭的部分替換為該 " "*user* 的家目錄。" -#: ../../library/os.path.rst:162 +#: ../../library/os.path.rst:165 msgid "" "On Unix, an initial ``~`` is replaced by the environment variable :envvar:" "`HOME` if it is set; otherwise the current user's home directory is looked " @@ -239,7 +244,7 @@ msgstr "" "數的值;否則將使用內建模組 :mod:`pwd` 在密碼目錄中查找當前使用者的家目錄。對" "於初始的 ``~user``,直接在密碼目錄中查找該使用者的家目錄。" -#: ../../library/os.path.rst:167 +#: ../../library/os.path.rst:170 msgid "" "On Windows, :envvar:`USERPROFILE` will be used if set, otherwise a " "combination of :envvar:`HOMEPATH` and :envvar:`HOMEDRIVE` will be used. An " @@ -252,18 +257,18 @@ msgstr "" "當前使用者的家目錄的最後一個目錄元件是否與 :envvar:`USERNAME` 相符,如果相符" "則替換它。" -#: ../../library/os.path.rst:172 +#: ../../library/os.path.rst:175 msgid "" "If the expansion fails or if the path does not begin with a tilde, the path " "is returned unchanged." msgstr "" "如果展開失敗或路徑不以波浪符號 (tilde) 開頭,則回傳原始路徑,不做任何變更。" -#: ../../library/os.path.rst:178 +#: ../../library/os.path.rst:181 msgid "No longer uses :envvar:`HOME` on Windows." msgstr "在 Windows 上不再使用 :envvar:`HOME` 變數。" -#: ../../library/os.path.rst:187 +#: ../../library/os.path.rst:190 msgid "" "Return the argument with environment variables expanded. Substrings of the " "form ``$name`` or ``${name}`` are replaced by the value of environment " @@ -273,7 +278,7 @@ msgstr "" "回傳已展開環境變數的引數。形如 ``$name`` 或 ``${name}`` 的子字串會被替換為環" "境變數 *name* 的值。無效的變數名稱和對不存在變數的引用保持不變。" -#: ../../library/os.path.rst:192 +#: ../../library/os.path.rst:195 msgid "" "On Windows, ``%name%`` expansions are supported in addition to ``$name`` and " "``${name}``." @@ -281,7 +286,7 @@ msgstr "" "在 Windows 上,除了支援 ``$name`` 和 ``${name}`` 形式的展開外,還支援 " "``%name%`` 形式的展開。" -#: ../../library/os.path.rst:201 +#: ../../library/os.path.rst:204 msgid "" "Return the time of last access of *path*. The return value is a floating-" "point number giving the number of seconds since the epoch (see the :mod:" @@ -291,7 +296,7 @@ msgstr "" "回傳 *path* 的最後存取時間。回傳值是一個浮點數,表示自紀元(參見 :mod:`time` " "模組)以來的秒數。如果檔案不存在或無法存取,則引發 :exc:`OSError`。" -#: ../../library/os.path.rst:208 +#: ../../library/os.path.rst:211 msgid "" "Return the time of last modification of *path*. The return value is a " "floating-point number giving the number of seconds since the epoch (see " @@ -301,7 +306,7 @@ msgstr "" "回傳 *path* 的最後修改時間。回傳值是一個浮點數,表示自紀元(參見 :mod:`time` " "模組)以來的秒數。如果檔案不存在或無法存取,則引發 :exc:`OSError`。" -#: ../../library/os.path.rst:218 +#: ../../library/os.path.rst:221 msgid "" "Return the system's ctime which, on some systems (like Unix) is the time of " "the last metadata change, and, on others (like Windows), is the creation " @@ -314,7 +319,7 @@ msgstr "" "數,表示自紀元(參見 :mod:`time` 模組)以來的秒數。如果檔案不存在或無法存" "取),則引發 :exc:`OSError`。" -#: ../../library/os.path.rst:230 +#: ../../library/os.path.rst:233 msgid "" "Return the size, in bytes, of *path*. Raise :exc:`OSError` if the file does " "not exist or is inaccessible." @@ -322,17 +327,24 @@ msgstr "" "回傳 *path* 的大小(以位元組為單位)。如果檔案不存在或無法存取,則引發 :exc:" "`OSError`。" -#: ../../library/os.path.rst:239 +#: ../../library/os.path.rst:242 +#, fuzzy msgid "" "Return ``True`` if *path* is an absolute pathname. On Unix, that means it " -"begins with a slash, on Windows that it begins with a (back)slash after " -"chopping off a potential drive letter." +"begins with a slash, on Windows that it begins with two (back)slashes, or a " +"drive letter, colon, and (back)slash together." msgstr "" "如果 *path* 是絕對路徑名,則回傳 ``True``。在 Unix 上,這表示它以斜線開頭;" "在 Windows 上,表示在去除可能的驅動機字母後,以(反)斜線開頭。" #: ../../library/os.path.rst:249 msgid "" +"On Windows, returns ``False`` if the given path starts with exactly one " +"(back)slash." +msgstr "" + +#: ../../library/os.path.rst:256 +msgid "" "Return ``True`` if *path* is an :func:`existing ` regular file. This " "follows symbolic links, so both :func:`islink` and :func:`isfile` can be " "true for the same path." @@ -341,7 +353,7 @@ msgstr "" "這將跟隨符號連結,因此同一個路徑可以同時回傳 :func:`islink` 和 :func:" "`isfile` 的結果為真。" -#: ../../library/os.path.rst:259 +#: ../../library/os.path.rst:266 msgid "" "Return ``True`` if *path* is an :func:`existing ` directory. This " "follows symbolic links, so both :func:`islink` and :func:`isdir` can be true " @@ -351,7 +363,7 @@ msgstr "" "跟隨符號連結,因此同一個路徑可以同時回傳 :func:`islink` 和 :func:`isfile` 的" "結果為真。" -#: ../../library/os.path.rst:269 +#: ../../library/os.path.rst:276 msgid "" "Return ``True`` if *path* refers to an :func:`existing ` directory " "entry that is a junction. Always return ``False`` if junctions are not " @@ -360,7 +372,7 @@ msgstr "" "如果 *path* 是指向\\ :func:`已存在的 `\\ 目錄條目且為聯接點 " "(junction),則回傳 ``True``。如果目前平台不支援聯接點,則始終返回 ``False``。" -#: ../../library/os.path.rst:278 +#: ../../library/os.path.rst:285 msgid "" "Return ``True`` if *path* refers to an :func:`existing ` directory " "entry that is a symbolic link. Always ``False`` if symbolic links are not " @@ -369,7 +381,7 @@ msgstr "" "如果 *path* 是指向\\ :func:`已存在的 `\\ 目錄項目且為符號連結,則回" "傳 ``True``。如果 Python 執行時不支援符號連結,則始終回傳 ``False``。" -#: ../../library/os.path.rst:288 +#: ../../library/os.path.rst:295 msgid "" "Return ``True`` if pathname *path* is a :dfn:`mount point`: a point in a " "file system where a different file system has been mounted. On POSIX, the " @@ -389,11 +401,11 @@ msgstr "" "上,以驅動機字母開頭的根目錄和 UNC 共享路徑始終是掛載點,對於任何其他路徑,會" "呼叫 ``GetVolumePathName`` 函式來檢查它是否與輸入路徑不同。" -#: ../../library/os.path.rst:298 +#: ../../library/os.path.rst:305 msgid "Added support for detecting non-root mount points on Windows." msgstr "新增在 Windows 上檢測非根目錄掛載點的支援。" -#: ../../library/os.path.rst:307 +#: ../../library/os.path.rst:314 msgid "" "Return ``True`` if pathname *path* is located on a Windows Dev Drive. A Dev " "Drive is optimized for developer scenarios, and offers faster performance " @@ -405,7 +417,7 @@ msgstr "" "開發人員場景進行了優化,提供更快的讀寫檔案性能。建議將其用於原始程式碼、臨時" "建置目錄、封包快取和其他 I/O 密集型操作。" -#: ../../library/os.path.rst:313 +#: ../../library/os.path.rst:320 msgid "" "May raise an error for an invalid path, for example, one without a " "recognizable drive, but returns ``False`` on platforms that do not support " @@ -416,11 +428,38 @@ msgstr "" "碟機的平台上返回 ``False``。請參閱 `Windows 文件 `_\\ 以了解有關啟用和建立 Dev 驅動機的資訊。" -#: ../../library/os.path.rst:318 +#: ../../library/os.path.rst:327 +msgid "" +"The function is now available on all platforms, and will always return " +"``False`` on those that have no support for Dev Drives" +msgstr "" + +#: ../../library/os.path.rst:333 +msgid "Return ``True`` if *path* is a reserved pathname on the current system." +msgstr "" + +#: ../../library/os.path.rst:335 +msgid "" +"On Windows, reserved filenames include those that end with a space or dot; " +"those that contain colons (i.e. file streams such as \"name:stream\"), " +"wildcard characters (i.e. ``'*?\"<>'``), pipe, or ASCII control characters; " +"as well as DOS device names such as \"NUL\", \"CON\", \"CONIN$\", \"CONOUT$" +"\", \"AUX\", \"PRN\", \"COM1\", and \"LPT1\"." +msgstr "" + +#: ../../library/os.path.rst:343 +msgid "" +"This function approximates rules for reserved paths on most Windows systems. " +"These rules change over time in various Windows releases. This function may " +"be updated in future Python releases as changes to the rules become broadly " +"available." +msgstr "" + +#: ../../library/os.path.rst:348 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/os.path.rst:325 +#: ../../library/os.path.rst:355 msgid "" "Join one or more path segments intelligently. The return value is the " "concatenation of *path* and all members of *\\*paths*, with exactly one " @@ -435,7 +474,7 @@ msgstr "" "個部分為空或以分隔符號結尾,結果只會以分隔符號結尾。如果一個段是絕對路徑(在 " "Windows 上需要驅動機和根),則忽略所有之前的段,並從絕對路徑段繼續連接。" -#: ../../library/os.path.rst:333 +#: ../../library/os.path.rst:363 msgid "" "On Windows, the drive is not reset when a rooted path segment (e.g., " "``r'\\foo'``) is encountered. If a segment is on a different drive or is an " @@ -450,11 +489,11 @@ msgstr "" "對於驅動機 :file:`C:` 的當前目錄的路徑(即 :file:`c:foo`),而不是 :file:`c:" "\\\\foo`。" -#: ../../library/os.path.rst:340 +#: ../../library/os.path.rst:370 msgid "Accepts a :term:`path-like object` for *path* and *paths*." msgstr "*path* 和 *paths* 接受 :term:`path-like object` 作為參數。" -#: ../../library/os.path.rst:346 +#: ../../library/os.path.rst:376 msgid "" "Normalize the case of a pathname. On Windows, convert all characters in the " "pathname to lowercase, and also convert forward slashes to backward slashes. " @@ -463,7 +502,7 @@ msgstr "" "將路徑名的大小寫規範化。在 Windows 上,將路徑名中的所有字元轉換為小寫,並將正" "斜線轉換為反斜線。在其他作業系統上,回傳原始路徑。" -#: ../../library/os.path.rst:356 +#: ../../library/os.path.rst:386 msgid "" "Normalize a pathname by collapsing redundant separators and up-level " "references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all " @@ -476,7 +515,7 @@ msgstr "" "結的路徑的含義。在 Windows 上,它將正斜線轉換為反斜線。要標準化大小寫,請使" "用 :func:`normcase`。" -#: ../../library/os.path.rst:363 +#: ../../library/os.path.rst:393 msgid "" "On POSIX systems, in accordance with `IEEE Std 1003.1 2013 Edition; 4.13 " "Pathname Resolution >> splitdrive(\"c:/dir\")\n" "(\"c:\", \"/dir\")" @@ -638,12 +680,12 @@ msgstr "" ">>> splitdrive(\"c:/dir\")\n" "(\"c:\", \"/dir\")" -#: ../../library/os.path.rst:489 +#: ../../library/os.path.rst:519 msgid "" "If the path contains a UNC path, drive will contain the host name and share::" msgstr "如果路徑包含 UNC 路徑,則驅動機將包含主機名和共享名: ::" -#: ../../library/os.path.rst:492 +#: ../../library/os.path.rst:522 msgid "" ">>> splitdrive(\"//host/computer/dir\")\n" "(\"//host/computer\", \"/dir\")" @@ -651,7 +693,7 @@ msgstr "" ">>> splitdrive(\"//host/computer/dir\")\n" "(\"//host/computer\", \"/dir\")" -#: ../../library/os.path.rst:501 +#: ../../library/os.path.rst:531 msgid "" "Split the pathname *path* into a 3-item tuple ``(drive, root, tail)`` where " "*drive* is a device name or mount point, *root* is a string of separators " @@ -664,7 +706,7 @@ msgstr "" "這些項目中的任何一個都可能是空字串。在所有情況下,``drive + root + tail`` 將" "與 *path* 相同。" -#: ../../library/os.path.rst:507 +#: ../../library/os.path.rst:537 msgid "" "On POSIX systems, *drive* is always empty. The *root* may be empty (if " "*path* is relative), a single forward slash (if *path* is absolute), or two " @@ -678,7 +720,7 @@ msgstr "" "onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>`_ 的實作定義)。例" "如: ::" -#: ../../library/os.path.rst:513 +#: ../../library/os.path.rst:543 msgid "" ">>> splitroot('/home/sam')\n" "('', '/', 'home/sam')\n" @@ -694,7 +736,7 @@ msgstr "" ">>> splitroot('///home/sam')\n" "('', '/', '//home/sam')" -#: ../../library/os.path.rst:520 +#: ../../library/os.path.rst:550 msgid "" "On Windows, *drive* may be empty, a drive-letter name, a UNC share, or a " "device name. The *root* may be empty, a forward slash, or a backward slash. " @@ -703,7 +745,7 @@ msgstr "" "在 Windows 上,*drive* 可能為空、驅動機名稱、UNC 共享或設備名稱。*root* 可能" "為空,斜線或反斜線。例如: ::" -#: ../../library/os.path.rst:524 +#: ../../library/os.path.rst:554 msgid "" ">>> splitroot('C:/Users/Sam')\n" "('C:', '/', 'Users/Sam')\n" @@ -715,7 +757,7 @@ msgstr "" ">>> splitroot('//Server/Share/Users/Sam')\n" "('//Server/Share', '/', 'Users/Sam')" -#: ../../library/os.path.rst:534 +#: ../../library/os.path.rst:564 msgid "" "Split the pathname *path* into a pair ``(root, ext)`` such that ``root + " "ext == path``, and the extension, *ext*, is empty or begins with a period " @@ -724,11 +766,11 @@ msgstr "" "將路徑名 *path* 拆分為一對 ``(root, ext)``,使得 ``root + ext == path``,且副" "檔名 *ext* 為空或以點開頭且最多包含一個點 (period)。" -#: ../../library/os.path.rst:538 +#: ../../library/os.path.rst:568 msgid "If the path contains no extension, *ext* will be ``''``::" msgstr "如果路徑不包含副檔名,則 *ext* 將為 ``''``: ::" -#: ../../library/os.path.rst:540 +#: ../../library/os.path.rst:570 msgid "" ">>> splitext('bar')\n" "('bar', '')" @@ -736,7 +778,7 @@ msgstr "" ">>> splitext('bar')\n" "('bar', '')" -#: ../../library/os.path.rst:543 +#: ../../library/os.path.rst:573 msgid "" "If the path contains an extension, then *ext* will be set to this extension, " "including the leading period. Note that previous periods will be ignored::" @@ -744,7 +786,7 @@ msgstr "" "如果路徑包含副檔名,則 *ext* 將設置為該副檔名,包括前導的點。請注意,前面的點" "將被忽略: ::" -#: ../../library/os.path.rst:546 +#: ../../library/os.path.rst:576 msgid "" ">>> splitext('foo.bar.exe')\n" "('foo.bar', '.exe')\n" @@ -756,13 +798,13 @@ msgstr "" ">>> splitext('/foo/bar.exe')\n" "('/foo/bar', '.exe')" -#: ../../library/os.path.rst:551 +#: ../../library/os.path.rst:581 msgid "" "Leading periods of the last component of the path are considered to be part " "of the root::" msgstr "路徑的最後一個部份的前導點被認為是根的一部分: ::" -#: ../../library/os.path.rst:554 +#: ../../library/os.path.rst:584 msgid "" ">>> splitext('.cshrc')\n" "('.cshrc', '')\n" @@ -774,7 +816,7 @@ msgstr "" ">>> splitext('/foo/....jpg')\n" "('/foo/....jpg', '')" -#: ../../library/os.path.rst:565 +#: ../../library/os.path.rst:595 msgid "" "``True`` if arbitrary Unicode strings can be used as file names (within " "limitations imposed by the file system)." @@ -790,34 +832,34 @@ msgstr "path(路徑)" msgid "operations" msgstr "operations(操作)" -#: ../../library/os.path.rst:153 +#: ../../library/os.path.rst:156 msgid "~ (tilde)" msgstr "~ (波浪號)" -#: ../../library/os.path.rst:153 +#: ../../library/os.path.rst:156 msgid "home directory expansion" msgstr "home directory expansion(家目錄展開)" -#: ../../library/os.path.rst:160 +#: ../../library/os.path.rst:163 msgid "module" msgstr "module(模組)" -#: ../../library/os.path.rst:160 +#: ../../library/os.path.rst:163 msgid "pwd" msgstr "pwd" -#: ../../library/os.path.rst:181 +#: ../../library/os.path.rst:184 msgid "$ (dollar)" msgstr "$ (金錢符號)" -#: ../../library/os.path.rst:181 +#: ../../library/os.path.rst:184 msgid "environment variables expansion" msgstr "environment variables expansion(環境變數展開)" -#: ../../library/os.path.rst:181 +#: ../../library/os.path.rst:184 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/os.path.rst:181 +#: ../../library/os.path.rst:184 msgid "environment variables expansion (Windows)" msgstr "environment variables expansion (Windows)(環境變數展開 (Windows))" diff --git a/library/os.po b/library/os.po index 3e78aff562..8e1f1843ff 100644 --- a/library/os.po +++ b/library/os.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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-" @@ -82,13 +82,14 @@ msgid "" msgstr "在 VxWorks, 不支援 os.popen、os.fork、os.execv 和 os.spawn*p*。" #: ../../library/os.rst:37 +#, fuzzy msgid "" -"On WebAssembly platforms ``wasm32-emscripten`` and ``wasm32-wasi``, large " -"parts of the :mod:`os` module are not available or behave differently. API " -"related to processes (e.g. :func:`~os.fork`, :func:`~os.execve`), signals (e." -"g. :func:`~os.kill`, :func:`~os.wait`), and resources (e.g. :func:`~os." -"nice`) are not available. Others like :func:`~os.getuid` and :func:`~os." -"getpid` are emulated or stubs." +"On WebAssembly platforms, and on iOS, large parts of the :mod:`os` module " +"are not available or behave differently. API related to processes (e.g. :" +"func:`~os.fork`, :func:`~os.execve`) and resources (e.g. :func:`~os.nice`) " +"are not available. Others like :func:`~os.getuid` and :func:`~os.getpid` are " +"emulated or stubs. WebAssembly platforms also lack support for signals (e." +"g. :func:`~os.kill`, :func:`~os.wait`)." msgstr "" "在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上,大部分 :mod:" "`os` 模組無法使用或行為不同。與行程(Process)(例如 :func:`~os.fork`、:func:" @@ -313,35 +314,26 @@ msgstr "" #: ../../library/os.rst:602 ../../library/os.rst:652 ../../library/os.rst:661 #: ../../library/os.rst:678 ../../library/os.rst:687 ../../library/os.rst:694 #: ../../library/os.rst:703 ../../library/os.rst:712 ../../library/os.rst:719 -#: ../../library/os.rst:726 ../../library/os.rst:735 ../../library/os.rst:1161 -#: ../../library/os.rst:1345 ../../library/os.rst:1371 -#: ../../library/os.rst:1608 ../../library/os.rst:1628 -#: ../../library/os.rst:1637 ../../library/os.rst:2021 -#: ../../library/os.rst:2110 ../../library/os.rst:2150 -#: ../../library/os.rst:2440 ../../library/os.rst:2462 -#: ../../library/os.rst:4043 ../../library/os.rst:4050 -#: ../../library/os.rst:4057 ../../library/os.rst:4064 -#: ../../library/os.rst:4071 ../../library/os.rst:4078 -#: ../../library/os.rst:4085 ../../library/os.rst:4093 -#: ../../library/os.rst:4101 ../../library/os.rst:4108 -#: ../../library/os.rst:4115 ../../library/os.rst:4124 -#: ../../library/os.rst:4132 ../../library/os.rst:4140 -#: ../../library/os.rst:4147 ../../library/os.rst:4154 -#: ../../library/os.rst:4230 ../../library/os.rst:4270 -#: ../../library/os.rst:4277 ../../library/os.rst:4307 -#: ../../library/os.rst:4434 ../../library/os.rst:4483 -#: ../../library/os.rst:4720 ../../library/os.rst:4754 -#: ../../library/os.rst:4815 ../../library/os.rst:4829 -#: ../../library/os.rst:4846 ../../library/os.rst:4861 -#: ../../library/os.rst:4872 ../../library/os.rst:4884 -#: ../../library/os.rst:4897 ../../library/os.rst:4906 -#: ../../library/os.rst:4916 ../../library/os.rst:4929 -#: ../../library/os.rst:4980 ../../library/os.rst:4991 -#: ../../library/os.rst:5003 ../../library/os.rst:5010 -#: ../../library/os.rst:5019 ../../library/os.rst:5028 -#: ../../library/os.rst:5037 ../../library/os.rst:5046 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." -msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" +#: ../../library/os.rst:726 ../../library/os.rst:735 ../../library/os.rst:1139 +#: ../../library/os.rst:1183 ../../library/os.rst:1367 +#: ../../library/os.rst:1393 ../../library/os.rst:1463 +#: ../../library/os.rst:1535 ../../library/os.rst:1662 +#: ../../library/os.rst:1682 ../../library/os.rst:1691 +#: ../../library/os.rst:1772 ../../library/os.rst:1780 +#: ../../library/os.rst:1800 ../../library/os.rst:2087 +#: ../../library/os.rst:2181 ../../library/os.rst:2221 +#: ../../library/os.rst:2514 ../../library/os.rst:2536 +#: ../../library/os.rst:4330 ../../library/os.rst:4337 +#: ../../library/os.rst:4344 ../../library/os.rst:4351 +#: ../../library/os.rst:4358 ../../library/os.rst:4365 +#: ../../library/os.rst:4372 ../../library/os.rst:4380 +#: ../../library/os.rst:4388 ../../library/os.rst:4395 +#: ../../library/os.rst:4402 ../../library/os.rst:4411 +#: ../../library/os.rst:4419 ../../library/os.rst:4427 +#: ../../library/os.rst:4434 ../../library/os.rst:4441 +#: ../../library/os.rst:4564 +msgid ":ref:`Availability `: Unix, not WASI." +msgstr ":ref:`適用 `:Unix、非 WASI。" #: ../../library/os.rst:186 msgid "" @@ -494,13 +486,14 @@ msgid "" "like to use a different encoding." msgstr "" -#: ../../library/os.rst:322 ../../library/os.rst:1086 ../../library/os.rst:1097 -#: ../../library/os.rst:1110 ../../library/os.rst:1357 -#: ../../library/os.rst:1649 ../../library/os.rst:1797 -#: ../../library/os.rst:2540 ../../library/os.rst:3382 -#: ../../library/os.rst:3419 ../../library/os.rst:4035 -#: ../../library/os.rst:4571 ../../library/os.rst:4582 -#: ../../library/os.rst:4699 +#: ../../library/os.rst:322 ../../library/os.rst:1009 ../../library/os.rst:1094 +#: ../../library/os.rst:1105 ../../library/os.rst:1118 +#: ../../library/os.rst:1379 ../../library/os.rst:1703 +#: ../../library/os.rst:1864 ../../library/os.rst:2271 +#: ../../library/os.rst:2614 ../../library/os.rst:3456 +#: ../../library/os.rst:3493 ../../library/os.rst:4322 +#: ../../library/os.rst:4871 ../../library/os.rst:4882 +#: ../../library/os.rst:4999 msgid ":ref:`Availability `: Unix, Windows." msgstr ":ref:`適用 `:Unix、Windows。" @@ -520,20 +513,20 @@ msgid "" msgstr "" #: ../../library/os.rst:337 ../../library/os.rst:376 ../../library/os.rst:533 -#: ../../library/os.rst:787 ../../library/os.rst:1004 ../../library/os.rst:1019 -#: ../../library/os.rst:1030 ../../library/os.rst:1053 -#: ../../library/os.rst:1074 ../../library/os.rst:1138 -#: ../../library/os.rst:1150 ../../library/os.rst:1396 -#: ../../library/os.rst:1411 ../../library/os.rst:1424 -#: ../../library/os.rst:1493 ../../library/os.rst:1708 -#: ../../library/os.rst:1735 ../../library/os.rst:1770 -#: ../../library/os.rst:2093 ../../library/os.rst:2124 -#: ../../library/os.rst:2181 ../../library/os.rst:2506 -#: ../../library/os.rst:2518 ../../library/os.rst:3248 -#: ../../library/os.rst:3405 ../../library/os.rst:3638 -#: ../../library/os.rst:5194 ../../library/os.rst:5203 -#: ../../library/os.rst:5224 ../../library/os.rst:5234 -#: ../../library/os.rst:5243 +#: ../../library/os.rst:792 ../../library/os.rst:1027 ../../library/os.rst:1038 +#: ../../library/os.rst:1061 ../../library/os.rst:1082 +#: ../../library/os.rst:1160 ../../library/os.rst:1172 +#: ../../library/os.rst:1403 ../../library/os.rst:1418 +#: ../../library/os.rst:1433 ../../library/os.rst:1446 +#: ../../library/os.rst:1547 ../../library/os.rst:1762 +#: ../../library/os.rst:1789 ../../library/os.rst:1837 +#: ../../library/os.rst:2164 ../../library/os.rst:2195 +#: ../../library/os.rst:2255 ../../library/os.rst:2580 +#: ../../library/os.rst:2592 ../../library/os.rst:3322 +#: ../../library/os.rst:3479 ../../library/os.rst:3712 +#: ../../library/os.rst:5496 ../../library/os.rst:5505 +#: ../../library/os.rst:5529 ../../library/os.rst:5556 +#: ../../library/os.rst:5565 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" @@ -562,8 +555,8 @@ msgstr "" #: ../../library/os.rst:378 ../../library/os.rst:451 ../../library/os.rst:535 #: ../../library/os.rst:758 msgid "" -"The function is a stub on Emscripten and WASI, see :ref:`wasm-availability` " -"for more information." +"The function is a stub on WASI, see :ref:`wasm-availability` for more " +"information." msgstr "" #: ../../library/os.rst:384 @@ -605,13 +598,10 @@ msgid "" "getpwuid(os.getuid())[0]`` to get the login name of the current real user id." msgstr "" -#: ../../library/os.rst:426 ../../library/os.rst:462 ../../library/os.rst:4000 -#: ../../library/os.rst:4254 ../../library/os.rst:4552 -#: ../../library/os.rst:4676 ../../library/os.rst:4795 -#: ../../library/os.rst:4964 -msgid "" -":ref:`Availability `: Unix, Windows, not Emscripten, not WASI." -msgstr ":ref:`適用 `:Unix、Windows、非 Emscripten、非 WASI。" +#: ../../library/os.rst:426 ../../library/os.rst:462 +#, fuzzy +msgid ":ref:`Availability `: Unix, Windows, not WASI." +msgstr ":ref:`適用 `:Unix、非 WASI。" #: ../../library/os.rst:431 msgid "" @@ -916,20 +906,28 @@ msgid "" "or even ``socket.gethostbyaddr(socket.gethostname())``." msgstr "" -#: ../../library/os.rst:789 ../../library/os.rst:4701 +#: ../../library/os.rst:787 +msgid "" +"On macOS, iOS and Android, this returns the *kernel* name and version (i.e., " +"``'Darwin'`` on macOS and iOS; ``'Linux'`` on Android). :func:`platform." +"uname` can be used to get the user-facing operating system name and version " +"on iOS and Android." +msgstr "" + +#: ../../library/os.rst:794 ../../library/os.rst:5001 msgid "" "Return type changed from a tuple to a tuple-like object with named " "attributes." msgstr "" -#: ../../library/os.rst:798 +#: ../../library/os.rst:803 msgid "" "Unset (delete) the environment variable named *key*. Such changes to the " "environment affect subprocesses started with :func:`os.system`, :func:" "`popen` or :func:`fork` and :func:`execv`." msgstr "" -#: ../../library/os.rst:802 +#: ../../library/os.rst:807 msgid "" "Deletion of items in :data:`os.environ` is automatically translated into a " "corresponding call to :func:`unsetenv`; however, calls to :func:`unsetenv` " @@ -937,18 +935,18 @@ msgid "" "items of :data:`os.environ`." msgstr "" -#: ../../library/os.rst:807 +#: ../../library/os.rst:812 msgid "" "Raises an :ref:`auditing event ` ``os.unsetenv`` with argument " "``key``." msgstr "" "引發一個附帶引數 ``key`` 的\\ :ref:`稽核事件 ` ``os.unsetenv``。" -#: ../../library/os.rst:809 +#: ../../library/os.rst:814 msgid "The function is now always available and is also available on Windows." msgstr "" -#: ../../library/os.rst:815 +#: ../../library/os.rst:820 msgid "" "Disassociate parts of the process execution context, and move them into a " "newly created namespace. See the :manpage:`unshare(2)` man page for more " @@ -959,32 +957,32 @@ msgid "" "are made to the calling process's execution context." msgstr "" -#: ../../library/os.rst:826 +#: ../../library/os.rst:831 msgid ":ref:`Availability `: Linux >= 2.6.16." msgstr ":ref:`適用 `:Linux 2.6.16 以上。" -#: ../../library/os.rst:832 +#: ../../library/os.rst:837 msgid "The :func:`~os.setns` function." msgstr ":func:`~os.setns` 函式。" -#: ../../library/os.rst:836 +#: ../../library/os.rst:841 msgid "" "Flags to the :func:`unshare` function, if the implementation supports them. " "See :manpage:`unshare(2)` in the Linux manual for their exact effect and " "availability." msgstr "" -#: ../../library/os.rst:859 +#: ../../library/os.rst:864 msgid "File Object Creation" msgstr "" -#: ../../library/os.rst:861 +#: ../../library/os.rst:866 msgid "" "These functions create new :term:`file objects `. (See also :" "func:`~os.open` for opening file descriptors.)" msgstr "" -#: ../../library/os.rst:867 +#: ../../library/os.rst:872 msgid "" "Return an open file object connected to the file descriptor *fd*. This is " "an alias of the :func:`open` built-in function and accepts the same " @@ -992,16 +990,16 @@ msgid "" "must always be an integer." msgstr "" -#: ../../library/os.rst:876 +#: ../../library/os.rst:881 msgid "File Descriptor Operations" msgstr "" -#: ../../library/os.rst:878 +#: ../../library/os.rst:883 msgid "" "These functions operate on I/O streams referenced using file descriptors." msgstr "" -#: ../../library/os.rst:880 +#: ../../library/os.rst:885 msgid "" "File descriptors are small integers corresponding to a file that has been " "opened by the current process. For example, standard input is usually file " @@ -1011,7 +1009,7 @@ msgid "" "pipes are also referenced by file descriptors." msgstr "" -#: ../../library/os.rst:887 +#: ../../library/os.rst:892 msgid "" "The :meth:`~io.IOBase.fileno` method can be used to obtain the file " "descriptor associated with a :term:`file object` when required. Note that " @@ -1019,11 +1017,11 @@ msgid "" "ignoring aspects such as internal buffering of data." msgstr "" -#: ../../library/os.rst:895 +#: ../../library/os.rst:900 msgid "Close file descriptor *fd*." msgstr "" -#: ../../library/os.rst:899 +#: ../../library/os.rst:904 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To close a " @@ -1031,13 +1029,13 @@ msgid "" "`popen` or :func:`fdopen`, use its :meth:`~io.IOBase.close` method." msgstr "" -#: ../../library/os.rst:907 +#: ../../library/os.rst:912 msgid "" "Close all file descriptors from *fd_low* (inclusive) to *fd_high* " "(exclusive), ignoring errors. Equivalent to (but much faster than)::" msgstr "" -#: ../../library/os.rst:910 +#: ../../library/os.rst:915 msgid "" "for fd in range(fd_low, fd_high):\n" " try:\n" @@ -1051,7 +1049,7 @@ msgstr "" " except OSError:\n" " pass" -#: ../../library/os.rst:919 +#: ../../library/os.rst:924 msgid "" "Copy *count* bytes from file descriptor *src*, starting from offset " "*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. " @@ -1059,14 +1057,14 @@ msgid "" "respectively for *offset_dst*." msgstr "" -#: ../../library/os.rst:924 +#: ../../library/os.rst:929 msgid "" "In Linux kernel older than 5.3, the files pointed to by *src* and *dst* must " "reside in the same filesystem, otherwise an :exc:`OSError` is raised with :" "attr:`~OSError.errno` set to :const:`errno.EXDEV`." msgstr "" -#: ../../library/os.rst:928 +#: ../../library/os.rst:933 msgid "" "This copy is done without the additional cost of transferring data from the " "kernel to user space and then back into the kernel. Additionally, some " @@ -1076,19 +1074,19 @@ msgid "" "(in the case of NFS)." msgstr "" -#: ../../library/os.rst:935 +#: ../../library/os.rst:940 msgid "" "The function copies bytes between two file descriptors. Text options, like " "the encoding and the line ending, are ignored." msgstr "" -#: ../../library/os.rst:938 +#: ../../library/os.rst:943 msgid "" "The return value is the amount of bytes copied. This could be less than the " "amount requested." msgstr "" -#: ../../library/os.rst:943 +#: ../../library/os.rst:948 msgid "" "On Linux, :func:`os.copy_file_range` should not be used for copying a range " "of a pseudo file from a special filesystem like procfs and sysfs. It will " @@ -1096,47 +1094,47 @@ msgid "" "known Linux kernel issue." msgstr "" -#: ../../library/os.rst:948 +#: ../../library/os.rst:953 msgid ":ref:`Availability `: Linux >= 4.5 with glibc >= 2.27." msgstr ":ref:`適用 `:Linux 4.5 以上且具有 glibc 2.27 以上。" -#: ../../library/os.rst:955 +#: ../../library/os.rst:960 msgid "" "Return a string describing the encoding of the device associated with *fd* " "if it is connected to a terminal; else return :const:`None`." msgstr "" -#: ../../library/os.rst:958 +#: ../../library/os.rst:963 msgid "" "On Unix, if the :ref:`Python UTF-8 Mode ` is enabled, return " "``'UTF-8'`` rather than the device encoding." msgstr "" -#: ../../library/os.rst:961 +#: ../../library/os.rst:966 msgid "On Unix, the function now implements the Python UTF-8 Mode." msgstr "" -#: ../../library/os.rst:967 +#: ../../library/os.rst:972 msgid "" "Return a duplicate of file descriptor *fd*. The new file descriptor is :ref:" "`non-inheritable `." msgstr "" -#: ../../library/os.rst:970 +#: ../../library/os.rst:975 msgid "" "On Windows, when duplicating a standard stream (0: stdin, 1: stdout, 2: " "stderr), the new file descriptor is :ref:`inheritable `." msgstr "" -#: ../../library/os.rst:974 ../../library/os.rst:987 +#: ../../library/os.rst:979 ../../library/os.rst:992 msgid ":ref:`Availability `: not WASI." msgstr ":ref:`適用 `:非 WASI。" -#: ../../library/os.rst:976 ../../library/os.rst:1244 +#: ../../library/os.rst:981 ../../library/os.rst:1266 msgid "The new file descriptor is now non-inheritable." msgstr "" -#: ../../library/os.rst:982 +#: ../../library/os.rst:987 msgid "" "Duplicate file descriptor *fd* to *fd2*, closing the latter first if " "necessary. Return *fd2*. The new file descriptor is :ref:`inheritable " @@ -1144,23 +1142,23 @@ msgid "" "``False``." msgstr "" -#: ../../library/os.rst:989 +#: ../../library/os.rst:994 msgid "Add the optional *inheritable* parameter." msgstr "" -#: ../../library/os.rst:992 +#: ../../library/os.rst:997 msgid "Return *fd2* on success. Previously, ``None`` was always returned." msgstr "" -#: ../../library/os.rst:998 +#: ../../library/os.rst:1003 msgid "" "Change the mode of the file given by *fd* to the numeric *mode*. See the " "docs for :func:`chmod` for possible values of *mode*. As of Python 3.3, " "this is equivalent to ``os.chmod(fd, mode)``." msgstr "" -#: ../../library/os.rst:1002 ../../library/os.rst:2069 -#: ../../library/os.rst:2166 +#: ../../library/os.rst:1007 ../../library/os.rst:2136 +#: ../../library/os.rst:2237 msgid "" "Raises an :ref:`auditing event ` ``os.chmod`` with arguments " "``path``, ``mode``, ``dir_fd``." @@ -1168,24 +1166,29 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.chmod``。" -#: ../../library/os.rst:1006 ../../library/os.rst:1021 -#: ../../library/os.rst:1112 ../../library/os.rst:1651 -#: ../../library/os.rst:2066 ../../library/os.rst:2095 -#: ../../library/os.rst:3384 +#: ../../library/os.rst:1011 ../../library/os.rst:1029 +#: ../../library/os.rst:1120 ../../library/os.rst:1705 +#: ../../library/os.rst:2133 ../../library/os.rst:2166 +#: ../../library/os.rst:3458 msgid "" -"The function is limited on Emscripten and WASI, see :ref:`wasm-availability` " -"for more information." +"The function is limited on WASI, see :ref:`wasm-availability` for more " +"information." msgstr "" -#: ../../library/os.rst:1012 +#: ../../library/os.rst:1014 ../../library/os.rst:2244 +#, fuzzy +msgid "Added support on Windows." +msgstr "新增對 Windows 的支援。" + +#: ../../library/os.rst:1020 msgid "" "Change the owner and group id of the file given by *fd* to the numeric *uid* " "and *gid*. To leave one of the ids unchanged, set it to -1. See :func:" "`chown`. As of Python 3.3, this is equivalent to ``os.chown(fd, uid, gid)``." msgstr "" -#: ../../library/os.rst:1017 ../../library/os.rst:2091 -#: ../../library/os.rst:2179 +#: ../../library/os.rst:1025 ../../library/os.rst:2162 +#: ../../library/os.rst:2253 msgid "" "Raises an :ref:`auditing event ` ``os.chown`` with arguments " "``path``, ``uid``, ``gid``, ``dir_fd``." @@ -1193,17 +1196,17 @@ msgstr "" "引發一個附帶引數 ``path``、``uid``、``gid``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.chown``。" -#: ../../library/os.rst:1027 +#: ../../library/os.rst:1035 msgid "" "Force write of file with filedescriptor *fd* to disk. Does not force update " "of metadata." msgstr "" -#: ../../library/os.rst:1033 +#: ../../library/os.rst:1041 msgid "This function is not available on MacOS." msgstr "" -#: ../../library/os.rst:1038 +#: ../../library/os.rst:1046 msgid "" "Return system configuration information relevant to an open file. *name* " "specifies the configuration value to retrieve; it may be a string which is " @@ -1214,7 +1217,7 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:1046 ../../library/os.rst:2498 +#: ../../library/os.rst:1054 ../../library/os.rst:2572 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 " @@ -1222,53 +1225,53 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:1051 +#: ../../library/os.rst:1059 msgid "As of Python 3.3, this is equivalent to ``os.pathconf(fd, name)``." msgstr "" -#: ../../library/os.rst:1058 +#: ../../library/os.rst:1066 msgid "" "Get the status of the file descriptor *fd*. Return a :class:`stat_result` " "object." msgstr "" -#: ../../library/os.rst:1061 +#: ../../library/os.rst:1069 msgid "As of Python 3.3, this is equivalent to ``os.stat(fd)``." msgstr "" -#: ../../library/os.rst:1065 ../../library/os.rst:2326 +#: ../../library/os.rst:1073 ../../library/os.rst:2400 msgid "The :func:`.stat` function." msgstr "" -#: ../../library/os.rst:1070 +#: ../../library/os.rst:1078 msgid "" "Return information about the filesystem containing the file associated with " "file descriptor *fd*, like :func:`statvfs`. As of Python 3.3, this is " "equivalent to ``os.statvfs(fd)``." msgstr "" -#: ../../library/os.rst:1079 +#: ../../library/os.rst:1087 msgid "" "Force write of file with filedescriptor *fd* to disk. On Unix, this calls " "the native :c:func:`!fsync` function; on Windows, the MS :c:func:`!_commit` " "function." msgstr "" -#: ../../library/os.rst:1082 +#: ../../library/os.rst:1090 msgid "" "If you're starting with a buffered Python :term:`file object` *f*, first do " "``f.flush()``, and then do ``os.fsync(f.fileno())``, to ensure that all " "internal buffers associated with *f* are written to disk." msgstr "" -#: ../../library/os.rst:1091 +#: ../../library/os.rst:1099 msgid "" "Truncate the file corresponding to file descriptor *fd*, so that it is at " "most *length* bytes in size. As of Python 3.3, this is equivalent to ``os." "truncate(fd, length)``." msgstr "" -#: ../../library/os.rst:1095 +#: ../../library/os.rst:1103 msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``fd``, ``length``." @@ -1276,35 +1279,46 @@ msgstr "" "引發一個附帶引數 ``fd``、``length`` 的\\ :ref:`稽核事件 ` ``os." "truncate``。" -#: ../../library/os.rst:1099 ../../library/os.rst:3423 +#: ../../library/os.rst:1107 ../../library/os.rst:3497 msgid "Added support for Windows" msgstr "新增對 Windows 的支援" -#: ../../library/os.rst:1105 +#: ../../library/os.rst:1113 msgid "" "Get the blocking mode of the file descriptor: ``False`` if the :data:" "`O_NONBLOCK` flag is set, ``True`` if the flag is cleared." msgstr "" -#: ../../library/os.rst:1108 +#: ../../library/os.rst:1116 msgid "See also :func:`set_blocking` and :meth:`socket.socket.setblocking`." msgstr "另請參閱 :func:`set_blocking` 與 :meth:`socket.socket.setblocking`。" -#: ../../library/os.rst:1115 ../../library/os.rst:1654 +#: ../../library/os.rst:1123 ../../library/os.rst:1708 msgid "On Windows, this function is limited to pipes." msgstr "" -#: ../../library/os.rst:1119 ../../library/os.rst:1658 +#: ../../library/os.rst:1127 ../../library/os.rst:1712 msgid "Added support for pipes on Windows." msgstr "新增對 Windows 上的 pipe 支援。" -#: ../../library/os.rst:1124 +#: ../../library/os.rst:1133 +msgid "" +"Grant access to the slave pseudo-terminal device associated with the master " +"pseudo-terminal device to which the file descriptor *fd* refers. The file " +"descriptor *fd* is not closed upon failure." +msgstr "" + +#: ../../library/os.rst:1137 +msgid "Calls the C standard library function :c:func:`grantpt`." +msgstr "" + +#: ../../library/os.rst:1146 msgid "" "Return ``True`` if the file descriptor *fd* is open and connected to a tty(-" "like) device, else ``False``." msgstr "" -#: ../../library/os.rst:1130 +#: ../../library/os.rst:1152 msgid "" "Apply, test or remove a POSIX lock on an open file descriptor. *fd* is an " "open file descriptor. *cmd* specifies the command to use - one of :data:" @@ -1312,7 +1326,7 @@ msgid "" "specifies the section of the file to lock." msgstr "" -#: ../../library/os.rst:1136 +#: ../../library/os.rst:1158 msgid "" "Raises an :ref:`auditing event ` ``os.lockf`` with arguments " "``fd``, ``cmd``, ``len``." @@ -1320,123 +1334,123 @@ msgstr "" "引發一個附帶引數 ``fd``、``cmd``、``len`` 的\\ :ref:`稽核事件 ` " "``os.lockf``。" -#: ../../library/os.rst:1148 +#: ../../library/os.rst:1170 msgid "Flags that specify what action :func:`lockf` will take." msgstr "" -#: ../../library/os.rst:1157 +#: ../../library/os.rst:1179 msgid "" "Prepare the tty of which fd is a file descriptor for a new login session. " "Make the calling process a session leader; make the tty the controlling tty, " "the stdin, the stdout, and the stderr of the calling process; close fd." msgstr "" -#: ../../library/os.rst:1168 +#: ../../library/os.rst:1190 msgid "" "Set the current position of file descriptor *fd* to position *pos*, modified " "by *whence*, and return the new position in bytes relative to the start of " "the file. Valid values for *whence* are:" msgstr "" -#: ../../library/os.rst:1173 +#: ../../library/os.rst:1195 msgid "" ":const:`SEEK_SET` or ``0`` -- set *pos* relative to the beginning of the file" msgstr "" -#: ../../library/os.rst:1174 +#: ../../library/os.rst:1196 msgid "" ":const:`SEEK_CUR` or ``1`` -- set *pos* relative to the current file position" msgstr "" -#: ../../library/os.rst:1175 +#: ../../library/os.rst:1197 msgid ":const:`SEEK_END` or ``2`` -- set *pos* relative to the end of the file" msgstr "" -#: ../../library/os.rst:1176 +#: ../../library/os.rst:1198 msgid "" ":const:`SEEK_HOLE` -- set *pos* to the next data location, relative to *pos*" msgstr "" -#: ../../library/os.rst:1177 +#: ../../library/os.rst:1199 msgid "" ":const:`SEEK_DATA` -- set *pos* to the next data hole, relative to *pos*" msgstr "" -#: ../../library/os.rst:1181 +#: ../../library/os.rst:1203 msgid "Add support for :const:`!SEEK_HOLE` and :const:`!SEEK_DATA`." msgstr "" -#: ../../library/os.rst:1188 +#: ../../library/os.rst:1210 msgid "" "Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` " "method on :term:`file-like objects `, for whence to adjust the " "file position indicator." msgstr "" -#: ../../library/os.rst:1192 +#: ../../library/os.rst:1214 msgid ":const:`SEEK_SET`" msgstr ":const:`SEEK_SET`" -#: ../../library/os.rst:1193 +#: ../../library/os.rst:1215 msgid "Adjust the file position relative to the beginning of the file." msgstr "" -#: ../../library/os.rst:1194 +#: ../../library/os.rst:1216 msgid ":const:`SEEK_CUR`" msgstr ":const:`SEEK_CUR`" -#: ../../library/os.rst:1195 +#: ../../library/os.rst:1217 msgid "Adjust the file position relative to the current file position." msgstr "" -#: ../../library/os.rst:1196 +#: ../../library/os.rst:1218 msgid ":const:`SEEK_END`" msgstr ":const:`SEEK_END`" -#: ../../library/os.rst:1197 +#: ../../library/os.rst:1219 msgid "Adjust the file position relative to the end of the file." msgstr "" -#: ../../library/os.rst:1199 +#: ../../library/os.rst:1221 msgid "Their values are 0, 1, and 2, respectively." msgstr "" -#: ../../library/os.rst:1205 +#: ../../library/os.rst:1227 msgid "" "Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` " "method on :term:`file-like objects `, for seeking file data and " "holes on sparsely allocated files." msgstr "" -#: ../../library/os.rst:1209 +#: ../../library/os.rst:1231 msgid ":data:`!SEEK_DATA`" msgstr ":data:`!SEEK_DATA`" -#: ../../library/os.rst:1210 +#: ../../library/os.rst:1232 msgid "" "Adjust the file offset to the next location containing data, relative to the " "seek position." msgstr "" -#: ../../library/os.rst:1213 +#: ../../library/os.rst:1235 msgid ":data:`!SEEK_HOLE`" msgstr ":data:`!SEEK_HOLE`" -#: ../../library/os.rst:1214 +#: ../../library/os.rst:1236 msgid "" "Adjust the file offset to the next location containing a hole, relative to " "the seek position. A hole is defined as a sequence of zeros." msgstr "" -#: ../../library/os.rst:1220 +#: ../../library/os.rst:1242 msgid "These operations only make sense for filesystems that support them." msgstr "" -#: ../../library/os.rst:1222 +#: ../../library/os.rst:1244 msgid ":ref:`Availability `: Linux >= 3.1, macOS, Unix" msgstr ":ref:`適用 `:Linux 3.1 以上、macOS、Unix。" -#: ../../library/os.rst:1229 +#: ../../library/os.rst:1251 msgid "" "Open the file *path* and set various flags according to *flags* and possibly " "its mode according to *mode*. When computing *mode*, the current umask " @@ -1444,7 +1458,7 @@ msgid "" "file. The new file descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:1234 +#: ../../library/os.rst:1256 msgid "" "For a description of the flag and mode values, see the C run-time " "documentation; flag constants (like :const:`O_RDONLY` and :const:`O_WRONLY`) " @@ -1452,13 +1466,13 @@ msgid "" "const:`O_BINARY` is needed to open files in binary mode." msgstr "" -#: ../../library/os.rst:1239 +#: ../../library/os.rst:1261 msgid "" "This function can support :ref:`paths relative to directory descriptors " "` with the *dir_fd* parameter." msgstr "" -#: ../../library/os.rst:1242 +#: ../../library/os.rst:1264 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." @@ -1466,7 +1480,7 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " "` ``open``。" -#: ../../library/os.rst:1249 +#: ../../library/os.rst:1271 msgid "" "This function is intended for low-level I/O. For normal usage, use the " "built-in function :func:`open`, which returns a :term:`file object` with :" @@ -1474,41 +1488,41 @@ msgid "" "a file descriptor in a file object, use :func:`fdopen`." msgstr "" -#: ../../library/os.rst:1254 ../../library/os.rst:2331 -#: ../../library/os.rst:2371 ../../library/os.rst:2442 -#: ../../library/os.rst:2464 ../../library/os.rst:2545 -#: ../../library/os.rst:2575 ../../library/os.rst:2682 -#: ../../library/os.rst:3439 +#: ../../library/os.rst:1276 ../../library/os.rst:2405 +#: ../../library/os.rst:2445 ../../library/os.rst:2516 +#: ../../library/os.rst:2538 ../../library/os.rst:2619 +#: ../../library/os.rst:2649 ../../library/os.rst:2756 +#: ../../library/os.rst:3513 msgid "Added the *dir_fd* parameter." msgstr "新增 *dir_fd* 參數。" -#: ../../library/os.rst:1257 ../../library/os.rst:1576 -#: ../../library/os.rst:1752 ../../library/os.rst:4797 +#: ../../library/os.rst:1279 ../../library/os.rst:1630 +#: ../../library/os.rst:1819 ../../library/os.rst:5097 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the function now retries the system call instead of raising an :" "exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -#: ../../library/os.rst:1262 ../../library/os.rst:1963 -#: ../../library/os.rst:1995 ../../library/os.rst:2026 -#: ../../library/os.rst:2075 ../../library/os.rst:2112 -#: ../../library/os.rst:2152 ../../library/os.rst:2170 -#: ../../library/os.rst:2183 ../../library/os.rst:2242 -#: ../../library/os.rst:2334 ../../library/os.rst:2374 -#: ../../library/os.rst:2418 ../../library/os.rst:2445 -#: ../../library/os.rst:2467 ../../library/os.rst:2508 -#: ../../library/os.rst:2578 ../../library/os.rst:2597 -#: ../../library/os.rst:2685 ../../library/os.rst:2975 -#: ../../library/os.rst:3262 ../../library/os.rst:3426 -#: ../../library/os.rst:3442 ../../library/os.rst:3482 -#: ../../library/os.rst:3581 ../../library/os.rst:3642 -#: ../../library/os.rst:3826 ../../library/os.rst:4006 -#: ../../library/os.rst:4559 +#: ../../library/os.rst:1284 ../../library/os.rst:2029 +#: ../../library/os.rst:2061 ../../library/os.rst:2092 +#: ../../library/os.rst:2142 ../../library/os.rst:2183 +#: ../../library/os.rst:2223 ../../library/os.rst:2241 +#: ../../library/os.rst:2257 ../../library/os.rst:2316 +#: ../../library/os.rst:2408 ../../library/os.rst:2448 +#: ../../library/os.rst:2492 ../../library/os.rst:2519 +#: ../../library/os.rst:2541 ../../library/os.rst:2582 +#: ../../library/os.rst:2652 ../../library/os.rst:2671 +#: ../../library/os.rst:2759 ../../library/os.rst:3049 +#: ../../library/os.rst:3336 ../../library/os.rst:3500 +#: ../../library/os.rst:3516 ../../library/os.rst:3556 +#: ../../library/os.rst:3655 ../../library/os.rst:3716 +#: ../../library/os.rst:4113 ../../library/os.rst:4293 +#: ../../library/os.rst:4859 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:1265 +#: ../../library/os.rst:1287 msgid "" "The following constants are options for the *flags* parameter to the :func:" "`~os.open` function. They can be combined using the bitwise OR operator ``|" @@ -1518,45 +1532,45 @@ msgid "" "on Windows." msgstr "" -#: ../../library/os.rst:1280 +#: ../../library/os.rst:1302 msgid "The above constants are available on Unix and Windows." msgstr "" -#: ../../library/os.rst:1291 +#: ../../library/os.rst:1313 msgid "The above constants are only available on Unix." msgstr "" -#: ../../library/os.rst:1293 +#: ../../library/os.rst:1315 msgid "Add :data:`O_CLOEXEC` constant." msgstr "" -#: ../../library/os.rst:1304 +#: ../../library/os.rst:1326 msgid "The above constants are only available on Windows." msgstr "" -#: ../../library/os.rst:1311 +#: ../../library/os.rst:1333 msgid "The above constants are only available on macOS." msgstr "" -#: ../../library/os.rst:1313 +#: ../../library/os.rst:1335 msgid "" "Add :data:`O_EVTONLY`, :data:`O_FSYNC`, :data:`O_SYMLINK` and :data:" "`O_NOFOLLOW_ANY` constants." msgstr "" -#: ../../library/os.rst:1327 +#: ../../library/os.rst:1349 msgid "" "The above constants are extensions and not present if they are not defined " "by the C library." msgstr "" -#: ../../library/os.rst:1330 +#: ../../library/os.rst:1352 msgid "" "Add :data:`O_PATH` on systems that support it. Add :data:`O_TMPFILE`, only " "available on Linux Kernel 3.11 or newer." msgstr "" -#: ../../library/os.rst:1340 +#: ../../library/os.rst:1362 msgid "" "Open a new pseudo-terminal pair. Return a pair of file descriptors " "``(master, slave)`` for the pty and the tty, respectively. The new file " @@ -1564,18 +1578,18 @@ msgid "" "more portable approach, use the :mod:`pty` module." msgstr "" -#: ../../library/os.rst:1347 ../../library/os.rst:1359 +#: ../../library/os.rst:1369 ../../library/os.rst:1381 msgid "The new file descriptors are now non-inheritable." msgstr "" -#: ../../library/os.rst:1353 +#: ../../library/os.rst:1375 msgid "" "Create a pipe. Return a pair of file descriptors ``(r, w)`` usable for " "reading and writing, respectively. The new file descriptor is :ref:`non-" "inheritable `." msgstr "" -#: ../../library/os.rst:1365 +#: ../../library/os.rst:1387 msgid "" "Create a pipe with *flags* set atomically. *flags* can be constructed by " "ORing together one or more of these values: :data:`O_NONBLOCK`, :data:" @@ -1583,17 +1597,13 @@ msgid "" "and writing, respectively." msgstr "" -#: ../../library/os.rst:1378 +#: ../../library/os.rst:1400 msgid "" "Ensures that enough disk space is allocated for the file specified by *fd* " "starting from *offset* and continuing for *len* bytes." msgstr "" -#: ../../library/os.rst:1381 -msgid ":ref:`Availability `: Unix, not Emscripten." -msgstr ":ref:`適用 `:Unix、非 Emscripten。" - -#: ../../library/os.rst:1388 +#: ../../library/os.rst:1410 msgid "" "Announces an intention to access data in a specific pattern thus allowing " "the kernel to make optimizations. The advice applies to the region of the " @@ -1604,25 +1614,43 @@ msgid "" "`POSIX_FADV_DONTNEED`." msgstr "" -#: ../../library/os.rst:1408 +#: ../../library/os.rst:1430 msgid "" "Flags that can be used in *advice* in :func:`posix_fadvise` that specify the " "access pattern that is likely to be used." msgstr "" -#: ../../library/os.rst:1418 +#: ../../library/os.rst:1440 msgid "" "Read at most *n* bytes from file descriptor *fd* at a position of *offset*, " "leaving the file offset unchanged." msgstr "" -#: ../../library/os.rst:1421 ../../library/os.rst:1565 +#: ../../library/os.rst:1443 ../../library/os.rst:1619 msgid "" "Return a bytestring containing the bytes read. If the end of the file " "referred to by *fd* has been reached, an empty bytes object is returned." msgstr "" -#: ../../library/os.rst:1431 +#: ../../library/os.rst:1453 +msgid "Open and return a file descriptor for a master pseudo-terminal device." +msgstr "" + +#: ../../library/os.rst:1455 +msgid "" +"Calls the C standard library function :c:func:`posix_openpt`. The *oflag* " +"argument is used to set file status flags and file access modes as specified " +"in the manual page of :c:func:`posix_openpt` of your system." +msgstr "" + +#: ../../library/os.rst:1459 +msgid "" +"The returned file descriptor is :ref:`non-inheritable `. If " +"the value :data:`O_CLOEXEC` is available on the system, it is added to " +"*oflag*." +msgstr "" + +#: ../../library/os.rst:1470 msgid "" "Read from a file descriptor *fd* at a position of *offset* into mutable :" "term:`bytes-like objects ` *buffers*, leaving the file " @@ -1630,38 +1658,38 @@ msgid "" "move on to the next buffer in the sequence to hold the rest of the data." msgstr "" -#: ../../library/os.rst:1436 ../../library/os.rst:1506 +#: ../../library/os.rst:1475 ../../library/os.rst:1560 msgid "" "The flags argument contains a bitwise OR of zero or more of the following " "flags:" msgstr "" -#: ../../library/os.rst:1439 +#: ../../library/os.rst:1478 msgid ":data:`RWF_HIPRI`" msgstr ":data:`RWF_HIPRI`" -#: ../../library/os.rst:1440 +#: ../../library/os.rst:1479 msgid ":data:`RWF_NOWAIT`" msgstr ":data:`RWF_NOWAIT`" -#: ../../library/os.rst:1442 ../../library/os.rst:1702 +#: ../../library/os.rst:1481 ../../library/os.rst:1756 msgid "" "Return the total number of bytes actually read which can be less than the " "total capacity of all the objects." msgstr "" -#: ../../library/os.rst:1445 ../../library/os.rst:1515 -#: ../../library/os.rst:1705 ../../library/os.rst:1767 +#: ../../library/os.rst:1484 ../../library/os.rst:1569 +#: ../../library/os.rst:1759 ../../library/os.rst:1834 msgid "" "The operating system may set a limit (:func:`sysconf` value " "``'SC_IOV_MAX'``) on the number of buffers that can be used." msgstr "" -#: ../../library/os.rst:1448 +#: ../../library/os.rst:1487 msgid "Combine the functionality of :func:`os.readv` and :func:`os.pread`." msgstr "" -#: ../../library/os.rst:1450 ../../library/os.rst:1520 +#: ../../library/os.rst:1489 ../../library/os.rst:1574 msgid "" ":ref:`Availability `: Linux >= 2.6.30, FreeBSD >= 6.0, OpenBSD " ">= 2.7, AIX >= 7.1." @@ -1669,55 +1697,69 @@ msgstr "" ":ref:`適用 `:Linux 2.6.30 以上、FreeBSD 6.0 以上、OpenBSD 2.7 " "以上、AIX 7.1 以上。" -#: ../../library/os.rst:1452 ../../library/os.rst:1522 +#: ../../library/os.rst:1491 ../../library/os.rst:1576 msgid "Using flags requires Linux >= 4.6." msgstr "" -#: ../../library/os.rst:1459 +#: ../../library/os.rst:1498 msgid "" "Do not wait for data which is not immediately available. If this flag is " "specified, the system call will return instantly if it would have to read " "data from the backing storage or wait for a lock." msgstr "" -#: ../../library/os.rst:1463 +#: ../../library/os.rst:1502 msgid "" "If some data was successfully read, it will return the number of bytes read. " "If no bytes were read, it will return ``-1`` and set errno to :const:`errno." "EAGAIN`." msgstr "" -#: ../../library/os.rst:1467 +#: ../../library/os.rst:1506 msgid ":ref:`Availability `: Linux >= 4.14." msgstr ":ref:`適用 `:Linux 4.14 以上。" -#: ../../library/os.rst:1474 +#: ../../library/os.rst:1513 msgid "" "High priority read/write. Allows block-based filesystems to use polling of " "the device, which provides lower latency, but may use additional resources." msgstr "" -#: ../../library/os.rst:1478 +#: ../../library/os.rst:1517 msgid "" "Currently, on Linux, this feature is usable only on a file descriptor opened " "using the :data:`O_DIRECT` flag." msgstr "" -#: ../../library/os.rst:1481 +#: ../../library/os.rst:1520 msgid ":ref:`Availability `: Linux >= 4.6." msgstr ":ref:`適用 `:Linux 4.6 以上。" -#: ../../library/os.rst:1488 +#: ../../library/os.rst:1527 +msgid "" +"Return the name of the slave pseudo-terminal device associated with the " +"master pseudo-terminal device to which the file descriptor *fd* refers. The " +"file descriptor *fd* is not closed upon failure." +msgstr "" + +#: ../../library/os.rst:1531 +msgid "" +"Calls the reentrant C standard library function :c:func:`ptsname_r` if it is " +"available; otherwise, the C standard library function :c:func:`ptsname`, " +"which is not guaranteed to be thread-safe, is called." +msgstr "" + +#: ../../library/os.rst:1542 msgid "" "Write the bytestring in *str* to file descriptor *fd* at position of " "*offset*, leaving the file offset unchanged." msgstr "" -#: ../../library/os.rst:1491 ../../library/os.rst:1742 +#: ../../library/os.rst:1545 ../../library/os.rst:1809 msgid "Return the number of bytes actually written." msgstr "" -#: ../../library/os.rst:1500 +#: ../../library/os.rst:1554 msgid "" "Write the *buffers* contents to file descriptor *fd* at an offset *offset*, " "leaving the file offset unchanged. *buffers* must be a sequence of :term:" @@ -1726,43 +1768,43 @@ msgid "" "the second, and so on." msgstr "" -#: ../../library/os.rst:1509 +#: ../../library/os.rst:1563 msgid ":data:`RWF_DSYNC`" msgstr ":data:`RWF_DSYNC`" -#: ../../library/os.rst:1510 +#: ../../library/os.rst:1564 msgid ":data:`RWF_SYNC`" msgstr ":data:`RWF_SYNC`" -#: ../../library/os.rst:1511 +#: ../../library/os.rst:1565 msgid ":data:`RWF_APPEND`" msgstr ":data:`RWF_APPEND`" -#: ../../library/os.rst:1513 +#: ../../library/os.rst:1567 msgid "Return the total number of bytes actually written." msgstr "" -#: ../../library/os.rst:1518 +#: ../../library/os.rst:1572 msgid "Combine the functionality of :func:`os.writev` and :func:`os.pwrite`." msgstr "" -#: ../../library/os.rst:1529 +#: ../../library/os.rst:1583 msgid "" "Provide a per-write equivalent of the :data:`O_DSYNC` :func:`os.open` flag. " "This flag effect applies only to the data range written by the system call." msgstr "" -#: ../../library/os.rst:1532 ../../library/os.rst:1542 +#: ../../library/os.rst:1586 ../../library/os.rst:1596 msgid ":ref:`Availability `: Linux >= 4.7." msgstr ":ref:`適用 `:Linux 4.7 以上。" -#: ../../library/os.rst:1539 +#: ../../library/os.rst:1593 msgid "" "Provide a per-write equivalent of the :data:`O_SYNC` :func:`os.open` flag. " "This flag effect applies only to the data range written by the system call." msgstr "" -#: ../../library/os.rst:1549 +#: ../../library/os.rst:1603 msgid "" "Provide a per-write equivalent of the :data:`O_APPEND` :func:`os.open` flag. " "This flag is meaningful only for :func:`os.pwritev`, and its effect applies " @@ -1772,15 +1814,15 @@ msgid "" "*offset* is updated." msgstr "" -#: ../../library/os.rst:1556 +#: ../../library/os.rst:1610 msgid ":ref:`Availability `: Linux >= 4.16." msgstr ":ref:`適用 `:Linux 4.16 以上。" -#: ../../library/os.rst:1563 +#: ../../library/os.rst:1617 msgid "Read at most *n* bytes from file descriptor *fd*." msgstr "" -#: ../../library/os.rst:1570 +#: ../../library/os.rst:1624 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To read a \"file " @@ -1789,26 +1831,26 @@ msgid "" "`~file.readline` methods." msgstr "" -#: ../../library/os.rst:1585 +#: ../../library/os.rst:1639 msgid "" "Copy *count* bytes from file descriptor *in_fd* to file descriptor *out_fd* " "starting at *offset*. Return the number of bytes sent. When EOF is reached " "return ``0``." msgstr "" -#: ../../library/os.rst:1589 +#: ../../library/os.rst:1643 msgid "" "The first function notation is supported by all platforms that define :func:" "`sendfile`." msgstr "" -#: ../../library/os.rst:1592 +#: ../../library/os.rst:1646 msgid "" "On Linux, if *offset* is given as ``None``, the bytes are read from the " "current position of *in_fd* and the position of *in_fd* is updated." msgstr "" -#: ../../library/os.rst:1595 +#: ../../library/os.rst:1649 msgid "" "The second case may be used on macOS and FreeBSD where *headers* and " "*trailers* are arbitrary sequences of buffers that are written before and " @@ -1816,58 +1858,58 @@ msgid "" "case." msgstr "" -#: ../../library/os.rst:1599 +#: ../../library/os.rst:1653 msgid "" "On macOS and FreeBSD, a value of ``0`` for *count* specifies to send until " "the end of *in_fd* is reached." msgstr "" -#: ../../library/os.rst:1602 +#: ../../library/os.rst:1656 msgid "" "All platforms support sockets as *out_fd* file descriptor, and some " "platforms allow other types (e.g. regular file, pipe) as well." msgstr "" -#: ../../library/os.rst:1605 +#: ../../library/os.rst:1659 msgid "" "Cross-platform applications should not use *headers*, *trailers* and *flags* " "arguments." msgstr "" -#: ../../library/os.rst:1612 +#: ../../library/os.rst:1666 msgid "" "For a higher-level wrapper of :func:`sendfile`, see :meth:`socket.socket." "sendfile`." msgstr "" -#: ../../library/os.rst:1617 +#: ../../library/os.rst:1671 msgid "Parameters *out* and *in* was renamed to *out_fd* and *in_fd*." msgstr "" -#: ../../library/os.rst:1625 +#: ../../library/os.rst:1679 msgid "" "Parameters to the :func:`sendfile` function, if the implementation supports " "them." msgstr "" -#: ../../library/os.rst:1634 +#: ../../library/os.rst:1688 msgid "" "Parameter to the :func:`sendfile` function, if the implementation supports " "it. The data won't be cached in the virtual memory and will be freed " "afterwards." msgstr "" -#: ../../library/os.rst:1644 +#: ../../library/os.rst:1698 msgid "" "Set the blocking mode of the specified file descriptor. Set the :data:" "`O_NONBLOCK` flag if blocking is ``False``, clear the flag otherwise." msgstr "" -#: ../../library/os.rst:1647 +#: ../../library/os.rst:1701 msgid "See also :func:`get_blocking` and :meth:`socket.socket.setblocking`." msgstr "另請參閱 :func:`get_blocking` 與 :meth:`socket.socket.setblocking`。" -#: ../../library/os.rst:1664 +#: ../../library/os.rst:1718 msgid "" "Transfer *count* bytes from file descriptor *src*, starting from offset " "*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. " @@ -1879,7 +1921,7 @@ msgid "" "`~OSError.errno` set to :const:`errno.EXDEV`." msgstr "" -#: ../../library/os.rst:1673 +#: ../../library/os.rst:1727 msgid "" "This copy is done without the additional cost of transferring data from the " "kernel to user space and then back into the kernel. Additionally, some " @@ -1887,7 +1929,7 @@ msgid "" "files are opened as binary." msgstr "" -#: ../../library/os.rst:1678 +#: ../../library/os.rst:1732 msgid "" "Upon successful completion, returns the number of bytes spliced to or from " "the pipe. A return value of 0 means end of input. If *src* refers to a pipe, " @@ -1896,11 +1938,11 @@ msgid "" "the pipe." msgstr "" -#: ../../library/os.rst:1684 +#: ../../library/os.rst:1738 msgid ":ref:`Availability `: Linux >= 2.6.17 with glibc >= 2.5" msgstr ":ref:`適用 `:Linux 2.6.17 以上且具有 glibc 2.5 以上" -#: ../../library/os.rst:1697 +#: ../../library/os.rst:1751 msgid "" "Read from a file descriptor *fd* into a number of mutable :term:`bytes-like " "objects ` *buffers*. Transfer data into each buffer until " @@ -1908,34 +1950,41 @@ msgid "" "rest of the data." msgstr "" -#: ../../library/os.rst:1715 +#: ../../library/os.rst:1769 msgid "" "Return the process group associated with the terminal given by *fd* (an open " "file descriptor as returned by :func:`os.open`)." msgstr "" -#: ../../library/os.rst:1718 ../../library/os.rst:1726 -msgid ":ref:`Availability `: Unix, not WASI." -msgstr ":ref:`適用 `:Unix、非 WASI。" - -#: ../../library/os.rst:1723 +#: ../../library/os.rst:1777 msgid "" "Set the process group associated with the terminal given by *fd* (an open " "file descriptor as returned by :func:`os.open`) to *pg*." msgstr "" -#: ../../library/os.rst:1731 +#: ../../library/os.rst:1785 msgid "" "Return a string which specifies the terminal device associated with file " "descriptor *fd*. If *fd* is not associated with a terminal device, an " "exception is raised." msgstr "" -#: ../../library/os.rst:1740 +#: ../../library/os.rst:1794 +msgid "" +"Unlock the slave pseudo-terminal device associated with the master pseudo-" +"terminal device to which the file descriptor *fd* refers. The file " +"descriptor *fd* is not closed upon failure." +msgstr "" + +#: ../../library/os.rst:1798 +msgid "Calls the C standard library function :c:func:`unlockpt`." +msgstr "" + +#: ../../library/os.rst:1807 msgid "Write the bytestring in *str* to file descriptor *fd*." msgstr "" -#: ../../library/os.rst:1746 +#: ../../library/os.rst:1813 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To write a " @@ -1944,7 +1993,7 @@ msgid "" "its :meth:`~file.write` method." msgstr "" -#: ../../library/os.rst:1760 +#: ../../library/os.rst:1827 msgid "" "Write the contents of *buffers* to file descriptor *fd*. *buffers* must be a " "sequence of :term:`bytes-like objects `. Buffers are " @@ -1952,70 +2001,70 @@ msgid "" "before proceeding to the second, and so on." msgstr "" -#: ../../library/os.rst:1765 +#: ../../library/os.rst:1832 msgid "Returns the total number of bytes actually written." msgstr "" -#: ../../library/os.rst:1778 +#: ../../library/os.rst:1845 msgid "Querying the size of a terminal" msgstr "" -#: ../../library/os.rst:1784 +#: ../../library/os.rst:1851 msgid "" "Return the size of the terminal window as ``(columns, lines)``, tuple of " "type :class:`terminal_size`." msgstr "" -#: ../../library/os.rst:1787 +#: ../../library/os.rst:1854 msgid "" "The optional argument ``fd`` (default ``STDOUT_FILENO``, or standard output) " "specifies which file descriptor should be queried." msgstr "" -#: ../../library/os.rst:1790 +#: ../../library/os.rst:1857 msgid "" "If the file descriptor is not connected to a terminal, an :exc:`OSError` is " "raised." msgstr "" -#: ../../library/os.rst:1793 +#: ../../library/os.rst:1860 msgid "" ":func:`shutil.get_terminal_size` is the high-level function which should " "normally be used, ``os.get_terminal_size`` is the low-level implementation." msgstr "" -#: ../../library/os.rst:1801 +#: ../../library/os.rst:1868 msgid "" "A subclass of tuple, holding ``(columns, lines)`` of the terminal window " "size." msgstr "" -#: ../../library/os.rst:1805 +#: ../../library/os.rst:1872 msgid "Width of the terminal window in characters." msgstr "" -#: ../../library/os.rst:1809 +#: ../../library/os.rst:1876 msgid "Height of the terminal window in characters." msgstr "" -#: ../../library/os.rst:1815 +#: ../../library/os.rst:1882 msgid "Inheritance of File Descriptors" msgstr "" -#: ../../library/os.rst:1819 +#: ../../library/os.rst:1886 msgid "" "A file descriptor has an \"inheritable\" flag which indicates if the file " "descriptor can be inherited by child processes. Since Python 3.4, file " "descriptors created by Python are non-inheritable by default." msgstr "" -#: ../../library/os.rst:1823 +#: ../../library/os.rst:1890 msgid "" "On UNIX, non-inheritable file descriptors are closed in child processes at " "the execution of a new program, other file descriptors are inherited." msgstr "" -#: ../../library/os.rst:1826 +#: ../../library/os.rst:1893 msgid "" "On Windows, non-inheritable handles and file descriptors are closed in child " "processes, except for standard streams (file descriptors 0, 1 and 2: stdin, " @@ -2026,46 +2075,44 @@ msgid "" "only inherited if the *close_fds* parameter is ``False``." msgstr "" -#: ../../library/os.rst:1834 -msgid "" -"On WebAssembly platforms ``wasm32-emscripten`` and ``wasm32-wasi``, the file " -"descriptor cannot be modified." +#: ../../library/os.rst:1901 +msgid "On WebAssembly platforms, the file descriptor cannot be modified." msgstr "" -#: ../../library/os.rst:1839 +#: ../../library/os.rst:1905 msgid "" "Get the \"inheritable\" flag of the specified file descriptor (a boolean)." msgstr "" -#: ../../library/os.rst:1843 +#: ../../library/os.rst:1909 msgid "Set the \"inheritable\" flag of the specified file descriptor." msgstr "" -#: ../../library/os.rst:1847 +#: ../../library/os.rst:1913 msgid "Get the \"inheritable\" flag of the specified handle (a boolean)." msgstr "" -#: ../../library/os.rst:1849 ../../library/os.rst:1855 -#: ../../library/os.rst:3931 ../../library/os.rst:4594 -#: ../../library/os.rst:4639 +#: ../../library/os.rst:1915 ../../library/os.rst:1921 +#: ../../library/os.rst:4218 ../../library/os.rst:4894 +#: ../../library/os.rst:4939 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/os.rst:1853 +#: ../../library/os.rst:1919 msgid "Set the \"inheritable\" flag of the specified handle." msgstr "" -#: ../../library/os.rst:1861 +#: ../../library/os.rst:1927 msgid "Files and Directories" msgstr "" -#: ../../library/os.rst:1863 +#: ../../library/os.rst:1929 msgid "" "On some Unix platforms, many of these functions support one or more of these " "features:" msgstr "" -#: ../../library/os.rst:1868 +#: ../../library/os.rst:1934 msgid "" "**specifying a file descriptor:** Normally the *path* argument provided to " "functions in the :mod:`os` module must be a string specifying a file path. " @@ -2076,7 +2123,7 @@ msgid "" "``chdir``).)" msgstr "" -#: ../../library/os.rst:1876 +#: ../../library/os.rst:1942 msgid "" "You can check whether or not *path* can be specified as a file descriptor " "for a particular function on your platform using :data:`os.supports_fd`. If " @@ -2084,13 +2131,13 @@ msgid "" "`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1881 +#: ../../library/os.rst:1947 msgid "" "If the function also supports *dir_fd* or *follow_symlinks* arguments, it's " "an error to specify one of those when supplying *path* as a file descriptor." msgstr "" -#: ../../library/os.rst:1886 +#: ../../library/os.rst:1952 msgid "" "**paths relative to directory descriptors:** If *dir_fd* is not ``None``, it " "should be a file descriptor referring to a directory, and the path to " @@ -2101,14 +2148,14 @@ msgid "" "``access``)." msgstr "" -#: ../../library/os.rst:1893 +#: ../../library/os.rst:1959 msgid "" "You can check whether or not *dir_fd* is supported for a particular function " "on your platform using :data:`os.supports_dir_fd`. If it's unavailable, " "using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1899 +#: ../../library/os.rst:1965 msgid "" "**not following symlinks:** If *follow_symlinks* is ``False``, and the last " "element of the path to operate on is a symbolic link, the function will " @@ -2117,14 +2164,14 @@ msgid "" "function.)" msgstr "" -#: ../../library/os.rst:1905 +#: ../../library/os.rst:1971 msgid "" "You can check whether or not *follow_symlinks* is supported for a particular " "function on your platform using :data:`os.supports_follow_symlinks`. If it's " "unavailable, using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1913 +#: ../../library/os.rst:1979 msgid "" "Use the real uid/gid to test for access to *path*. Note that most " "operations will use the effective uid/gid, therefore this routine can be " @@ -2136,13 +2183,13 @@ msgid "" "manpage:`access(2)` for more information." msgstr "" -#: ../../library/os.rst:1922 +#: ../../library/os.rst:1988 msgid "" "This function can support specifying :ref:`paths relative to directory " "descriptors ` and :ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:1925 +#: ../../library/os.rst:1991 msgid "" "If *effective_ids* is ``True``, :func:`access` will perform its access " "checks using the effective uid/gid instead of the real uid/gid. " @@ -2151,7 +2198,7 @@ msgid "" "unavailable, using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1933 +#: ../../library/os.rst:1999 msgid "" "Using :func:`access` to check if a user is authorized to e.g. open a file " "before actually doing so using :func:`open` creates a security hole, because " @@ -2160,7 +2207,7 @@ msgid "" "For example::" msgstr "" -#: ../../library/os.rst:1939 +#: ../../library/os.rst:2005 msgid "" "if os.access(\"myfile\", os.R_OK):\n" " with open(\"myfile\") as fp:\n" @@ -2172,11 +2219,11 @@ msgstr "" " return fp.read()\n" "return \"some default data\"" -#: ../../library/os.rst:1944 +#: ../../library/os.rst:2010 msgid "is better written as::" msgstr "" -#: ../../library/os.rst:1946 +#: ../../library/os.rst:2012 msgid "" "try:\n" " fp = open(\"myfile\")\n" @@ -2194,113 +2241,113 @@ msgstr "" " with fp:\n" " return fp.read()" -#: ../../library/os.rst:1956 +#: ../../library/os.rst:2022 msgid "" "I/O operations may fail even when :func:`access` indicates that they would " "succeed, particularly for operations on network filesystems which may have " "permissions semantics beyond the usual POSIX permission-bit model." msgstr "" -#: ../../library/os.rst:1960 +#: ../../library/os.rst:2026 msgid "Added the *dir_fd*, *effective_ids*, and *follow_symlinks* parameters." msgstr "新增 *dir_fd*、*effective_ids* 與 *follow_symlinks* 參數。" -#: ../../library/os.rst:1972 +#: ../../library/os.rst:2038 msgid "" "Values to pass as the *mode* parameter of :func:`access` to test the " "existence, readability, writability and executability of *path*, " "respectively." msgstr "" -#: ../../library/os.rst:1981 +#: ../../library/os.rst:2047 msgid "Change the current working directory to *path*." msgstr "" -#: ../../library/os.rst:1983 +#: ../../library/os.rst:2049 msgid "" "This function can support :ref:`specifying a file descriptor `. " "The descriptor must refer to an opened directory, not an open file." msgstr "" -#: ../../library/os.rst:1986 +#: ../../library/os.rst:2052 msgid "" "This function can raise :exc:`OSError` and subclasses such as :exc:" "`FileNotFoundError`, :exc:`PermissionError`, and :exc:`NotADirectoryError`." msgstr "" -#: ../../library/os.rst:1989 ../../library/os.rst:2122 +#: ../../library/os.rst:2055 ../../library/os.rst:2193 msgid "" "Raises an :ref:`auditing event ` ``os.chdir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.chdir``。" -#: ../../library/os.rst:1991 +#: ../../library/os.rst:2057 msgid "" "Added support for specifying *path* as a file descriptor on some platforms." msgstr "" -#: ../../library/os.rst:2001 +#: ../../library/os.rst:2067 msgid "" "Set the flags of *path* to the numeric *flags*. *flags* may take a " "combination (bitwise OR) of the following values (as defined in the :mod:" "`stat` module):" msgstr "" -#: ../../library/os.rst:2004 +#: ../../library/os.rst:2070 msgid ":const:`stat.UF_NODUMP`" msgstr ":const:`stat.UF_NODUMP`" -#: ../../library/os.rst:2005 +#: ../../library/os.rst:2071 msgid ":const:`stat.UF_IMMUTABLE`" msgstr ":const:`stat.UF_IMMUTABLE`" -#: ../../library/os.rst:2006 +#: ../../library/os.rst:2072 msgid ":const:`stat.UF_APPEND`" msgstr ":const:`stat.UF_APPEND`" -#: ../../library/os.rst:2007 +#: ../../library/os.rst:2073 msgid ":const:`stat.UF_OPAQUE`" msgstr ":const:`stat.UF_OPAQUE`" -#: ../../library/os.rst:2008 +#: ../../library/os.rst:2074 msgid ":const:`stat.UF_NOUNLINK`" msgstr ":const:`stat.UF_NOUNLINK`" -#: ../../library/os.rst:2009 +#: ../../library/os.rst:2075 msgid ":const:`stat.UF_COMPRESSED`" msgstr ":const:`stat.UF_COMPRESSED`" -#: ../../library/os.rst:2010 +#: ../../library/os.rst:2076 msgid ":const:`stat.UF_HIDDEN`" msgstr ":const:`stat.UF_HIDDEN`" -#: ../../library/os.rst:2011 +#: ../../library/os.rst:2077 msgid ":const:`stat.SF_ARCHIVED`" msgstr ":const:`stat.SF_ARCHIVED`" -#: ../../library/os.rst:2012 +#: ../../library/os.rst:2078 msgid ":const:`stat.SF_IMMUTABLE`" msgstr ":const:`stat.SF_IMMUTABLE`" -#: ../../library/os.rst:2013 +#: ../../library/os.rst:2079 msgid ":const:`stat.SF_APPEND`" msgstr ":const:`stat.SF_APPEND`" -#: ../../library/os.rst:2014 +#: ../../library/os.rst:2080 msgid ":const:`stat.SF_NOUNLINK`" msgstr ":const:`stat.SF_NOUNLINK`" -#: ../../library/os.rst:2015 +#: ../../library/os.rst:2081 msgid ":const:`stat.SF_SNAPSHOT`" msgstr ":const:`stat.SF_SNAPSHOT`" -#: ../../library/os.rst:2017 +#: ../../library/os.rst:2083 msgid "" "This function can support :ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:2019 ../../library/os.rst:2148 +#: ../../library/os.rst:2085 ../../library/os.rst:2219 msgid "" "Raises an :ref:`auditing event ` ``os.chflags`` with arguments " "``path``, ``flags``." @@ -2308,164 +2355,171 @@ msgstr "" "引發一個附帶引數 ``path``、``flags`` 的\\ :ref:`稽核事件 ` ``os." "chflags``。" -#: ../../library/os.rst:2023 +#: ../../library/os.rst:2089 msgid "Added the *follow_symlinks* parameter." msgstr "新增 *follow_symlinks* 參數。" -#: ../../library/os.rst:2032 +#: ../../library/os.rst:2098 msgid "" "Change the mode of *path* to the numeric *mode*. *mode* may take one of the " "following values (as defined in the :mod:`stat` module) or bitwise ORed " "combinations of them:" msgstr "" -#: ../../library/os.rst:2036 +#: ../../library/os.rst:2102 msgid ":const:`stat.S_ISUID`" msgstr ":const:`stat.S_ISUID`" -#: ../../library/os.rst:2037 +#: ../../library/os.rst:2103 msgid ":const:`stat.S_ISGID`" msgstr ":const:`stat.S_ISGID`" -#: ../../library/os.rst:2038 +#: ../../library/os.rst:2104 msgid ":const:`stat.S_ENFMT`" msgstr ":const:`stat.S_ENFMT`" -#: ../../library/os.rst:2039 +#: ../../library/os.rst:2105 msgid ":const:`stat.S_ISVTX`" msgstr ":const:`stat.S_ISVTX`" -#: ../../library/os.rst:2040 +#: ../../library/os.rst:2106 msgid ":const:`stat.S_IREAD`" msgstr ":const:`stat.S_IREAD`" -#: ../../library/os.rst:2041 +#: ../../library/os.rst:2107 msgid ":const:`stat.S_IWRITE`" msgstr ":const:`stat.S_IWRITE`" -#: ../../library/os.rst:2042 +#: ../../library/os.rst:2108 msgid ":const:`stat.S_IEXEC`" msgstr ":const:`stat.S_IEXEC`" -#: ../../library/os.rst:2043 +#: ../../library/os.rst:2109 msgid ":const:`stat.S_IRWXU`" msgstr ":const:`stat.S_IRWXU`" -#: ../../library/os.rst:2044 +#: ../../library/os.rst:2110 msgid ":const:`stat.S_IRUSR`" msgstr ":const:`stat.S_IRUSR`" -#: ../../library/os.rst:2045 +#: ../../library/os.rst:2111 msgid ":const:`stat.S_IWUSR`" msgstr ":const:`stat.S_IWUSR`" -#: ../../library/os.rst:2046 +#: ../../library/os.rst:2112 msgid ":const:`stat.S_IXUSR`" msgstr ":const:`stat.S_IXUSR`" -#: ../../library/os.rst:2047 +#: ../../library/os.rst:2113 msgid ":const:`stat.S_IRWXG`" msgstr ":const:`stat.S_IRWXG`" -#: ../../library/os.rst:2048 +#: ../../library/os.rst:2114 msgid ":const:`stat.S_IRGRP`" msgstr ":const:`stat.S_IRGRP`" -#: ../../library/os.rst:2049 +#: ../../library/os.rst:2115 msgid ":const:`stat.S_IWGRP`" msgstr ":const:`stat.S_IWGRP`" -#: ../../library/os.rst:2050 +#: ../../library/os.rst:2116 msgid ":const:`stat.S_IXGRP`" msgstr ":const:`stat.S_IXGRP`" -#: ../../library/os.rst:2051 +#: ../../library/os.rst:2117 msgid ":const:`stat.S_IRWXO`" msgstr ":const:`stat.S_IRWXO`" -#: ../../library/os.rst:2052 +#: ../../library/os.rst:2118 msgid ":const:`stat.S_IROTH`" msgstr ":const:`stat.S_IROTH`" -#: ../../library/os.rst:2053 +#: ../../library/os.rst:2119 msgid ":const:`stat.S_IWOTH`" msgstr ":const:`stat.S_IWOTH`" -#: ../../library/os.rst:2054 +#: ../../library/os.rst:2120 msgid ":const:`stat.S_IXOTH`" msgstr ":const:`stat.S_IXOTH`" -#: ../../library/os.rst:2056 ../../library/os.rst:2084 -#: ../../library/os.rst:3472 +#: ../../library/os.rst:2122 ../../library/os.rst:2155 +#: ../../library/os.rst:3546 msgid "" "This function can support :ref:`specifying a file descriptor `, :" "ref:`paths relative to directory descriptors ` and :ref:`not " "following symlinks `." msgstr "" -#: ../../library/os.rst:2062 +#: ../../library/os.rst:2128 msgid "" "Although Windows supports :func:`chmod`, you can only set the file's read-" "only flag with it (via the ``stat.S_IWRITE`` and ``stat.S_IREAD`` constants " -"or a corresponding integer value). All other bits are ignored." +"or a corresponding integer value). All other bits are ignored. The default " +"value of *follow_symlinks* is ``False`` on Windows." msgstr "" -#: ../../library/os.rst:2071 ../../library/os.rst:2098 +#: ../../library/os.rst:2138 ../../library/os.rst:2169 msgid "" "Added support for specifying *path* as an open file descriptor, and the " "*dir_fd* and *follow_symlinks* arguments." msgstr "" -#: ../../library/os.rst:2081 +#: ../../library/os.rst:2145 +msgid "" +"Added support for a file descriptor and the *follow_symlinks* argument on " +"Windows." +msgstr "" + +#: ../../library/os.rst:2152 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. To " "leave one of the ids unchanged, set it to -1." msgstr "" -#: ../../library/os.rst:2088 +#: ../../library/os.rst:2159 msgid "" "See :func:`shutil.chown` for a higher-level function that accepts names in " "addition to numeric ids." msgstr "" -#: ../../library/os.rst:2102 +#: ../../library/os.rst:2173 msgid "Supports a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:2108 +#: ../../library/os.rst:2179 msgid "Change the root directory of the current process to *path*." msgstr "" -#: ../../library/os.rst:2118 +#: ../../library/os.rst:2189 msgid "" "Change the current working directory to the directory represented by the " "file descriptor *fd*. The descriptor must refer to an opened directory, not " "an open file. As of Python 3.3, this is equivalent to ``os.chdir(fd)``." msgstr "" -#: ../../library/os.rst:2129 +#: ../../library/os.rst:2200 msgid "Return a string representing the current working directory." msgstr "" -#: ../../library/os.rst:2134 +#: ../../library/os.rst:2205 msgid "Return a bytestring representing the current working directory." msgstr "" -#: ../../library/os.rst:2136 +#: ../../library/os.rst:2207 msgid "" "The function now uses the UTF-8 encoding on Windows, rather than the ANSI " "code page: see :pep:`529` for the rationale. The function is no longer " "deprecated on Windows." msgstr "" -#: ../../library/os.rst:2144 +#: ../../library/os.rst:2215 msgid "" "Set the flags of *path* to the numeric *flags*, like :func:`chflags`, but do " "not follow symbolic links. As of Python 3.3, this is equivalent to ``os." "chflags(path, flags, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2158 +#: ../../library/os.rst:2229 msgid "" "Change the mode of *path* to the numeric *mode*. If path is a symlink, this " "affects the symlink rather than the target. See the docs for :func:`chmod` " @@ -2473,39 +2527,40 @@ msgid "" "chmod(path, mode, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2163 +#: ../../library/os.rst:2234 msgid "" "``lchmod()`` is not part of POSIX, but Unix implementations may have it if " "changing the mode of symbolic links is supported." msgstr "" -#: ../../library/os.rst:2168 +#: ../../library/os.rst:2239 +#, fuzzy msgid "" -":ref:`Availability `: Unix, not Linux, FreeBSD >= 1.3, NetBSD " -">= 1.3, not OpenBSD" +":ref:`Availability `: Unix, Windows, not Linux, FreeBSD >= " +"1.3, NetBSD >= 1.3, not OpenBSD" msgstr "" ":ref:`適用 `:Unix、非 Linux、FreeBSD 1.3 以上、NetBSD 1.3 以" "上、非 OpenBSD。" -#: ../../library/os.rst:2175 +#: ../../library/os.rst:2249 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. " "This function will not follow symbolic links. As of Python 3.3, this is " "equivalent to ``os.chown(path, uid, gid, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2189 +#: ../../library/os.rst:2263 msgid "Create a hard link pointing to *src* named *dst*." msgstr "" -#: ../../library/os.rst:2191 +#: ../../library/os.rst:2265 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " "supply :ref:`paths relative to directory descriptors `, and :ref:" "`not following symlinks `." msgstr "" -#: ../../library/os.rst:2195 +#: ../../library/os.rst:2269 msgid "" "Raises an :ref:`auditing event ` ``os.link`` with arguments " "``src``, ``dst``, ``src_dir_fd``, ``dst_dir_fd``." @@ -2513,24 +2568,20 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``src_dir_fd``、``dst_dir_fd`` 的\\ :ref:`" "稽核事件 ` ``os.link``。" -#: ../../library/os.rst:2197 -msgid ":ref:`Availability `: Unix, Windows, not Emscripten." -msgstr ":ref:`適用 `:Unix、Windows、非 Emscripten。" - -#: ../../library/os.rst:2199 ../../library/os.rst:4256 +#: ../../library/os.rst:2273 ../../library/os.rst:4543 msgid "Added Windows support." msgstr "新支援 Windows。" -#: ../../library/os.rst:2202 +#: ../../library/os.rst:2276 msgid "Added the *src_dir_fd*, *dst_dir_fd*, and *follow_symlinks* parameters." msgstr "新增 *src_dir_fd*、*dst_dir_fd* 與 *follow_symlinks* 參數。" -#: ../../library/os.rst:2205 ../../library/os.rst:2629 -#: ../../library/os.rst:2666 ../../library/os.rst:3394 +#: ../../library/os.rst:2279 ../../library/os.rst:2703 +#: ../../library/os.rst:2740 ../../library/os.rst:3468 msgid "Accepts a :term:`path-like object` for *src* and *dst*." msgstr "" -#: ../../library/os.rst:2211 +#: ../../library/os.rst:2285 msgid "" "Return a list containing the names of the entries in the directory given by " "*path*. The list is in arbitrary order, and does not include the special " @@ -2539,7 +2590,7 @@ msgid "" "function, whether a name for that file be included is unspecified." msgstr "" -#: ../../library/os.rst:2217 +#: ../../library/os.rst:2291 msgid "" "*path* may be a :term:`path-like object`. If *path* is of type ``bytes`` " "(directly or indirectly through the :class:`PathLike` interface), the " @@ -2547,42 +2598,42 @@ msgid "" "circumstances, they will be of type ``str``." msgstr "" -#: ../../library/os.rst:2222 ../../library/os.rst:2714 +#: ../../library/os.rst:2296 ../../library/os.rst:2788 msgid "" "This function can also support :ref:`specifying a file descriptor " "`; the file descriptor must refer to a directory." msgstr "" -#: ../../library/os.rst:2225 +#: ../../library/os.rst:2299 msgid "" "Raises an :ref:`auditing event ` ``os.listdir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.listdir``。" -#: ../../library/os.rst:2228 +#: ../../library/os.rst:2302 msgid "To encode ``str`` filenames to ``bytes``, use :func:`~os.fsencode`." msgstr "" -#: ../../library/os.rst:2232 +#: ../../library/os.rst:2306 msgid "" "The :func:`scandir` function returns directory entries along with file " "attribute information, giving better performance for many common use cases." msgstr "" -#: ../../library/os.rst:2236 +#: ../../library/os.rst:2310 msgid "The *path* parameter became optional." msgstr "" -#: ../../library/os.rst:2239 ../../library/os.rst:3253 +#: ../../library/os.rst:2313 ../../library/os.rst:3327 msgid "Added support for specifying *path* as an open file descriptor." msgstr "" -#: ../../library/os.rst:2248 +#: ../../library/os.rst:2322 msgid "Return a list containing the names of drives on a Windows system." msgstr "" -#: ../../library/os.rst:2250 +#: ../../library/os.rst:2324 msgid "" "A drive name typically looks like ``'C:\\\\'``. Not every drive name will be " "associated with a volume, and some may be inaccessible for a variety of " @@ -2590,27 +2641,27 @@ msgid "" "function does not test for access." msgstr "" -#: ../../library/os.rst:2255 +#: ../../library/os.rst:2329 msgid "May raise :exc:`OSError` if an error occurs collecting the drive names." msgstr "" -#: ../../library/os.rst:2258 +#: ../../library/os.rst:2332 msgid "" "Raises an :ref:`auditing event ` ``os.listdrives`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.listdrives``。" -#: ../../library/os.rst:2260 ../../library/os.rst:2284 -#: ../../library/os.rst:2304 +#: ../../library/os.rst:2334 ../../library/os.rst:2358 +#: ../../library/os.rst:2378 msgid ":ref:`Availability `: Windows" msgstr ":ref:`適用 `:Windows。" -#: ../../library/os.rst:2267 +#: ../../library/os.rst:2341 msgid "" "Return a list containing the mount points for a volume on a Windows system." msgstr "" -#: ../../library/os.rst:2270 +#: ../../library/os.rst:2344 msgid "" "*volume* must be represented as a GUID path, like those returned by :func:" "`os.listvolumes`. Volumes may be mounted in multiple locations or not at " @@ -2618,19 +2669,19 @@ msgid "" "associated with a volume will not be returned by this function." msgstr "" -#: ../../library/os.rst:2276 +#: ../../library/os.rst:2350 msgid "" "The mount points return by this function will be absolute paths, and may be " "longer than the drive name." msgstr "" -#: ../../library/os.rst:2279 +#: ../../library/os.rst:2353 msgid "" "Raises :exc:`OSError` if the volume is not recognized or if an error occurs " "collecting the paths." msgstr "" -#: ../../library/os.rst:2282 +#: ../../library/os.rst:2356 msgid "" "Raises an :ref:`auditing event ` ``os.listmounts`` with argument " "``volume``." @@ -2638,11 +2689,11 @@ msgstr "" "引發一個附帶引數 ``volume`` 的\\ :ref:`稽核事件 ` ``os." "listmounts``。" -#: ../../library/os.rst:2291 +#: ../../library/os.rst:2365 msgid "Return a list containing the volumes in the system." msgstr "" -#: ../../library/os.rst:2293 +#: ../../library/os.rst:2367 msgid "" "Volumes are typically represented as a GUID path that looks like ``\\\\?" "\\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\\``. Files can usually be " @@ -2651,49 +2702,49 @@ msgid "" "function is to retrieve mount points using :func:`os.listmounts`." msgstr "" -#: ../../library/os.rst:2300 +#: ../../library/os.rst:2374 msgid "May raise :exc:`OSError` if an error occurs collecting the volumes." msgstr "" -#: ../../library/os.rst:2302 +#: ../../library/os.rst:2376 msgid "" "Raises an :ref:`auditing event ` ``os.listvolumes`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.listvolumes``。" -#: ../../library/os.rst:2311 +#: ../../library/os.rst:2385 msgid "" "Perform the equivalent of an :c:func:`!lstat` system call on the given path. " "Similar to :func:`~os.stat`, but does not follow symbolic links. Return a :" "class:`stat_result` object." msgstr "" -#: ../../library/os.rst:2315 +#: ../../library/os.rst:2389 msgid "" "On platforms that do not support symbolic links, this is an alias for :func:" "`~os.stat`." msgstr "" -#: ../../library/os.rst:2318 +#: ../../library/os.rst:2392 msgid "" "As of Python 3.3, this is equivalent to ``os.stat(path, dir_fd=dir_fd, " "follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2321 ../../library/os.rst:2363 -#: ../../library/os.rst:2431 ../../library/os.rst:2459 -#: ../../library/os.rst:2533 +#: ../../library/os.rst:2395 ../../library/os.rst:2437 +#: ../../library/os.rst:2505 ../../library/os.rst:2533 +#: ../../library/os.rst:2607 msgid "" "This function can also support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: ../../library/os.rst:2328 ../../library/os.rst:2542 -#: ../../library/os.rst:3387 +#: ../../library/os.rst:2402 ../../library/os.rst:2616 +#: ../../library/os.rst:3461 msgid "Added support for Windows 6.0 (Vista) symbolic links." msgstr "" -#: ../../library/os.rst:2337 +#: ../../library/os.rst:2411 msgid "" "On Windows, now opens reparse points that represent another path (name " "surrogates), including symbolic links and directory junctions. Other kinds " @@ -2701,18 +2752,18 @@ msgid "" "stat`." msgstr "" -#: ../../library/os.rst:2346 +#: ../../library/os.rst:2420 msgid "Create a directory named *path* with numeric mode *mode*." msgstr "" -#: ../../library/os.rst:2348 +#: ../../library/os.rst:2422 msgid "" "If the directory already exists, :exc:`FileExistsError` is raised. If a " "parent directory in the path does not exist, :exc:`FileNotFoundError` is " "raised." msgstr "" -#: ../../library/os.rst:2353 +#: ../../library/os.rst:2427 msgid "" "On some systems, *mode* is ignored. Where it is used, the current umask " "value is first masked out. If bits other than the last 9 (i.e. the last 3 " @@ -2721,20 +2772,20 @@ msgid "" "call :func:`chmod` explicitly to set them." msgstr "" -#: ../../library/os.rst:2359 +#: ../../library/os.rst:2433 msgid "" "On Windows, a *mode* of ``0o700`` is specifically handled to apply access " "control to the new directory such that only the current user and " "administrators have access. Other values of *mode* are ignored." msgstr "" -#: ../../library/os.rst:2366 +#: ../../library/os.rst:2440 msgid "" "It is also possible to create temporary directories; see the :mod:`tempfile` " "module's :func:`tempfile.mkdtemp` function." msgstr "" -#: ../../library/os.rst:2369 ../../library/os.rst:2406 +#: ../../library/os.rst:2443 ../../library/os.rst:2480 msgid "" "Raises an :ref:`auditing event ` ``os.mkdir`` with arguments " "``path``, ``mode``, ``dir_fd``." @@ -2742,17 +2793,17 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.mkdir``。" -#: ../../library/os.rst:2377 +#: ../../library/os.rst:2451 msgid "Windows now handles a *mode* of ``0o700``." msgstr "" -#: ../../library/os.rst:2387 +#: ../../library/os.rst:2461 msgid "" "Recursive directory creation function. Like :func:`mkdir`, but makes all " "intermediate-level directories needed to contain the leaf directory." msgstr "" -#: ../../library/os.rst:2390 +#: ../../library/os.rst:2464 msgid "" "The *mode* parameter is passed to :func:`mkdir` for creating the leaf " "directory; see :ref:`the mkdir() description ` for how it is " @@ -2761,27 +2812,27 @@ msgid "" "file permission bits of existing parent directories are not changed." msgstr "" -#: ../../library/os.rst:2396 +#: ../../library/os.rst:2470 msgid "" "If *exist_ok* is ``False`` (the default), a :exc:`FileExistsError` is raised " "if the target directory already exists." msgstr "" -#: ../../library/os.rst:2401 +#: ../../library/os.rst:2475 msgid "" ":func:`makedirs` will become confused if the path elements to create " "include :data:`pardir` (eg. \"..\" on UNIX systems)." msgstr "" -#: ../../library/os.rst:2404 +#: ../../library/os.rst:2478 msgid "This function handles UNC paths correctly." msgstr "" -#: ../../library/os.rst:2408 +#: ../../library/os.rst:2482 msgid "Added the *exist_ok* parameter." msgstr "新增 *exist_ok* 參數。" -#: ../../library/os.rst:2413 +#: ../../library/os.rst:2487 msgid "" "Before Python 3.4.1, if *exist_ok* was ``True`` and the directory existed, :" "func:`makedirs` would still raise an error if *mode* did not match the mode " @@ -2789,19 +2840,19 @@ msgid "" "safely, it was removed in Python 3.4.1. See :issue:`21082`." msgstr "" -#: ../../library/os.rst:2421 +#: ../../library/os.rst:2495 msgid "" "The *mode* argument no longer affects the file permission bits of newly " "created intermediate-level directories." msgstr "" -#: ../../library/os.rst:2428 +#: ../../library/os.rst:2502 msgid "" "Create a FIFO (a named pipe) named *path* with numeric mode *mode*. The " "current umask value is first masked out from the mode." msgstr "" -#: ../../library/os.rst:2434 +#: ../../library/os.rst:2508 msgid "" "FIFOs are pipes that can be accessed like regular files. FIFOs exist until " "they are deleted (for example with :func:`os.unlink`). Generally, FIFOs are " @@ -2811,7 +2862,7 @@ msgid "" "rendezvous point." msgstr "" -#: ../../library/os.rst:2451 +#: ../../library/os.rst:2525 msgid "" "Create a filesystem node (file, device special file or named pipe) named " "*path*. *mode* specifies both the permissions to use and the type of node to " @@ -2822,23 +2873,23 @@ msgid "" "`os.makedev`), otherwise it is ignored." msgstr "" -#: ../../library/os.rst:2473 +#: ../../library/os.rst:2547 msgid "" "Extract the device major number from a raw device number (usually the :attr:" "`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." msgstr "" -#: ../../library/os.rst:2479 +#: ../../library/os.rst:2553 msgid "" "Extract the device minor number from a raw device number (usually the :attr:" "`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." msgstr "" -#: ../../library/os.rst:2485 +#: ../../library/os.rst:2559 msgid "Compose a raw device number from the major and minor device numbers." msgstr "" -#: ../../library/os.rst:2490 +#: ../../library/os.rst:2564 msgid "" "Return system configuration information relevant to a named file. *name* " "specifies the configuration value to retrieve; it may be a string which is " @@ -2849,20 +2900,20 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:2503 ../../library/os.rst:3246 -#: ../../library/os.rst:3415 +#: ../../library/os.rst:2577 ../../library/os.rst:3320 +#: ../../library/os.rst:3489 msgid "" "This function can support :ref:`specifying a file descriptor `." msgstr "" -#: ../../library/os.rst:2514 +#: ../../library/os.rst:2588 msgid "" "Dictionary mapping names accepted by :func:`pathconf` and :func:`fpathconf` " "to the integer values defined for those names by the host operating system. " "This can be used to determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:2523 +#: ../../library/os.rst:2597 msgid "" "Return a string representing the path to which the symbolic link points. " "The result may be either an absolute or relative pathname; if it is " @@ -2870,7 +2921,7 @@ msgid "" "join(os.path.dirname(path), result)``." msgstr "" -#: ../../library/os.rst:2528 +#: ../../library/os.rst:2602 msgid "" "If the *path* is a string object (directly or indirectly through a :class:" "`PathLike` interface), the result will also be a string object, and the call " @@ -2878,42 +2929,42 @@ msgid "" "indirectly), the result will be a bytes object." msgstr "" -#: ../../library/os.rst:2536 +#: ../../library/os.rst:2610 msgid "" "When trying to resolve a path that may contain links, use :func:`~os.path." "realpath` to properly handle recursion and platform differences." msgstr "" -#: ../../library/os.rst:2548 +#: ../../library/os.rst:2622 msgid "Accepts a :term:`path-like object` on Unix." msgstr "" -#: ../../library/os.rst:2551 +#: ../../library/os.rst:2625 msgid "Accepts a :term:`path-like object` and a bytes object on Windows." msgstr "" -#: ../../library/os.rst:2554 +#: ../../library/os.rst:2628 msgid "" "Added support for directory junctions, and changed to return the " "substitution path (which typically includes ``\\\\?\\`` prefix) rather than " "the optional \"print name\" field that was previously returned." msgstr "" -#: ../../library/os.rst:2560 +#: ../../library/os.rst:2634 msgid "" "Remove (delete) the file *path*. If *path* is a directory, an :exc:" "`OSError` is raised. Use :func:`rmdir` to remove directories. If the file " "does not exist, a :exc:`FileNotFoundError` is raised." msgstr "" -#: ../../library/os.rst:2564 ../../library/os.rst:2677 -#: ../../library/os.rst:3366 +#: ../../library/os.rst:2638 ../../library/os.rst:2751 +#: ../../library/os.rst:3440 msgid "" "This function can support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: ../../library/os.rst:2567 +#: ../../library/os.rst:2641 msgid "" "On Windows, attempting to remove a file that is in use causes an exception " "to be raised; on Unix, the directory entry is removed but the storage " @@ -2921,12 +2972,12 @@ msgid "" "longer in use." msgstr "" -#: ../../library/os.rst:2571 +#: ../../library/os.rst:2645 msgid "This function is semantically identical to :func:`unlink`." msgstr "" -#: ../../library/os.rst:2573 ../../library/os.rst:2595 -#: ../../library/os.rst:3437 +#: ../../library/os.rst:2647 ../../library/os.rst:2669 +#: ../../library/os.rst:3511 msgid "" "Raises an :ref:`auditing event ` ``os.remove`` with arguments " "``path``, ``dir_fd``." @@ -2934,7 +2985,7 @@ msgstr "" "引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` ``os." "remove``。" -#: ../../library/os.rst:2586 +#: ../../library/os.rst:2660 msgid "" "Remove directories recursively. Works like :func:`rmdir` except that, if " "the leaf directory is successfully removed, :func:`removedirs` tries to " @@ -2946,20 +2997,20 @@ msgid "" "could not be successfully removed." msgstr "" -#: ../../library/os.rst:2603 +#: ../../library/os.rst:2677 msgid "" "Rename the file or directory *src* to *dst*. If *dst* exists, the operation " "will fail with an :exc:`OSError` subclass in a number of cases:" msgstr "" -#: ../../library/os.rst:2606 +#: ../../library/os.rst:2680 msgid "" "On Windows, if *dst* exists a :exc:`FileExistsError` is always raised. The " "operation may fail if *src* and *dst* are on different filesystems. Use :" "func:`shutil.move` to support moves to a different filesystem." msgstr "" -#: ../../library/os.rst:2610 +#: ../../library/os.rst:2684 msgid "" "On Unix, if *src* is a file and *dst* is a directory or vice-versa, an :exc:" "`IsADirectoryError` or a :exc:`NotADirectoryError` will be raised " @@ -2971,20 +3022,20 @@ msgid "" "operation (this is a POSIX requirement)." msgstr "" -#: ../../library/os.rst:2619 ../../library/os.rst:2659 +#: ../../library/os.rst:2693 ../../library/os.rst:2733 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " "supply :ref:`paths relative to directory descriptors `." msgstr "" -#: ../../library/os.rst:2622 +#: ../../library/os.rst:2696 msgid "" "If you want cross-platform overwriting of the destination, use :func:" "`replace`." msgstr "" -#: ../../library/os.rst:2624 ../../library/os.rst:2645 -#: ../../library/os.rst:2662 +#: ../../library/os.rst:2698 ../../library/os.rst:2719 +#: ../../library/os.rst:2736 msgid "" "Raises an :ref:`auditing event ` ``os.rename`` with arguments " "``src``, ``dst``, ``src_dir_fd``, ``dst_dir_fd``." @@ -2992,11 +3043,11 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``src_dir_fd``、``dst_dir_fd`` 的\\ :ref:`" "稽核事件 ` ``os.rename``。" -#: ../../library/os.rst:2626 +#: ../../library/os.rst:2700 msgid "Added the *src_dir_fd* and *dst_dir_fd* parameters." msgstr "新增 *src_dir_fd* 與 *dst_dir_fd* 參數。" -#: ../../library/os.rst:2635 +#: ../../library/os.rst:2709 msgid "" "Recursive directory or file renaming function. Works like :func:`rename`, " "except creation of any intermediate directories needed to make the new " @@ -3005,17 +3056,17 @@ msgid "" "using :func:`removedirs`." msgstr "" -#: ../../library/os.rst:2642 +#: ../../library/os.rst:2716 msgid "" "This function can fail with the new directory structure made if you lack " "permissions needed to remove the leaf directory or file." msgstr "" -#: ../../library/os.rst:2647 +#: ../../library/os.rst:2721 msgid "Accepts a :term:`path-like object` for *old* and *new*." msgstr "" -#: ../../library/os.rst:2653 +#: ../../library/os.rst:2727 msgid "" "Rename the file or directory *src* to *dst*. If *dst* is a non-empty " "directory, :exc:`OSError` will be raised. If *dst* exists and is a file, it " @@ -3024,7 +3075,7 @@ msgid "" "renaming will be an atomic operation (this is a POSIX requirement)." msgstr "" -#: ../../library/os.rst:2672 +#: ../../library/os.rst:2746 msgid "" "Remove (delete) the directory *path*. If the directory does not exist or is " "not empty, a :exc:`FileNotFoundError` or an :exc:`OSError` is raised " @@ -3032,7 +3083,7 @@ msgid "" "rmtree` can be used." msgstr "" -#: ../../library/os.rst:2680 +#: ../../library/os.rst:2754 msgid "" "Raises an :ref:`auditing event ` ``os.rmdir`` with arguments " "``path``, ``dir_fd``." @@ -3040,7 +3091,7 @@ msgstr "" "引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` ``os." "rmdir``。" -#: ../../library/os.rst:2691 +#: ../../library/os.rst:2765 msgid "" "Return an iterator of :class:`os.DirEntry` objects corresponding to the " "entries in the directory given by *path*. The entries are yielded in " @@ -3050,7 +3101,7 @@ msgid "" "unspecified." msgstr "" -#: ../../library/os.rst:2698 +#: ../../library/os.rst:2772 msgid "" "Using :func:`scandir` instead of :func:`listdir` can significantly increase " "the performance of code that also needs file type or file attribute " @@ -3062,7 +3113,7 @@ msgid "" "Unix but only requires one for symbolic links on Windows." msgstr "" -#: ../../library/os.rst:2708 +#: ../../library/os.rst:2782 msgid "" "*path* may be a :term:`path-like object`. If *path* is of type ``bytes`` " "(directly or indirectly through the :class:`PathLike` interface), the type " @@ -3071,31 +3122,31 @@ msgid "" "they will be of type ``str``." msgstr "" -#: ../../library/os.rst:2717 +#: ../../library/os.rst:2791 msgid "" "Raises an :ref:`auditing event ` ``os.scandir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.scandir``。" -#: ../../library/os.rst:2719 +#: ../../library/os.rst:2793 msgid "" "The :func:`scandir` iterator supports the :term:`context manager` protocol " "and has the following method:" msgstr "" -#: ../../library/os.rst:2724 +#: ../../library/os.rst:2798 msgid "Close the iterator and free acquired resources." msgstr "" -#: ../../library/os.rst:2726 +#: ../../library/os.rst:2800 msgid "" "This is called automatically when the iterator is exhausted or garbage " "collected, or when an error happens during iterating. However it is " "advisable to call it explicitly or use the :keyword:`with` statement." msgstr "" -#: ../../library/os.rst:2733 +#: ../../library/os.rst:2807 msgid "" "The following example shows a simple use of :func:`scandir` to display all " "the files (excluding directories) in the given *path* that don't start with " @@ -3103,7 +3154,7 @@ msgid "" "system call::" msgstr "" -#: ../../library/os.rst:2738 +#: ../../library/os.rst:2812 msgid "" "with os.scandir(path) as it:\n" " for entry in it:\n" @@ -3115,7 +3166,7 @@ msgstr "" " if not entry.name.startswith('.') and entry.is_file():\n" " print(entry.name)" -#: ../../library/os.rst:2745 +#: ../../library/os.rst:2819 msgid "" "On Unix-based systems, :func:`scandir` uses the system's `opendir() `_ and " @@ -3126,7 +3177,7 @@ msgid "" "desktop/aa364428(v=vs.85).aspx>`_ functions." msgstr "" -#: ../../library/os.rst:2757 +#: ../../library/os.rst:2831 msgid "" "Added support for the :term:`context manager` protocol and the :func:" "`~scandir.close` method. If a :func:`scandir` iterator is neither exhausted " @@ -3134,28 +3185,28 @@ msgid "" "destructor." msgstr "" -#: ../../library/os.rst:2763 +#: ../../library/os.rst:2837 msgid "The function accepts a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:2765 +#: ../../library/os.rst:2839 msgid "Added support for :ref:`file descriptors ` on Unix." msgstr "" -#: ../../library/os.rst:2771 +#: ../../library/os.rst:2845 msgid "" "Object yielded by :func:`scandir` to expose the file path and other file " "attributes of a directory entry." msgstr "" -#: ../../library/os.rst:2774 +#: ../../library/os.rst:2848 msgid "" ":func:`scandir` will provide as much of this information as possible without " "making additional system calls. When a ``stat()`` or ``lstat()`` system call " "is made, the ``os.DirEntry`` object will cache the result." msgstr "" -#: ../../library/os.rst:2778 +#: ../../library/os.rst:2852 msgid "" "``os.DirEntry`` instances are not intended to be stored in long-lived data " "structures; if you know the file metadata has changed or if a long time has " @@ -3163,7 +3214,7 @@ msgid "" "up-to-date information." msgstr "" -#: ../../library/os.rst:2783 +#: ../../library/os.rst:2857 msgid "" "Because the ``os.DirEntry`` methods can make operating system calls, they " "may also raise :exc:`OSError`. If you need very fine-grained control over " @@ -3171,29 +3222,29 @@ msgid "" "methods and handle as appropriate." msgstr "" -#: ../../library/os.rst:2788 +#: ../../library/os.rst:2862 msgid "" "To be directly usable as a :term:`path-like object`, ``os.DirEntry`` " "implements the :class:`PathLike` interface." msgstr "" -#: ../../library/os.rst:2791 +#: ../../library/os.rst:2865 msgid "Attributes and methods on a ``os.DirEntry`` instance are as follows:" msgstr "" -#: ../../library/os.rst:2795 +#: ../../library/os.rst:2869 msgid "" "The entry's base filename, relative to the :func:`scandir` *path* argument." msgstr "" -#: ../../library/os.rst:2798 +#: ../../library/os.rst:2872 msgid "" "The :attr:`name` attribute will be ``bytes`` if the :func:`scandir` *path* " "argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." "fsdecode` to decode byte filenames." msgstr "" -#: ../../library/os.rst:2804 +#: ../../library/os.rst:2878 msgid "" "The entry's full path name: equivalent to ``os.path.join(scandir_path, entry." "name)`` where *scandir_path* is the :func:`scandir` *path* argument. The " @@ -3203,51 +3254,51 @@ msgid "" "attribute." msgstr "" -#: ../../library/os.rst:2811 +#: ../../library/os.rst:2885 msgid "" "The :attr:`path` attribute will be ``bytes`` if the :func:`scandir` *path* " "argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." "fsdecode` to decode byte filenames." msgstr "" -#: ../../library/os.rst:2817 +#: ../../library/os.rst:2891 msgid "Return the inode number of the entry." msgstr "" -#: ../../library/os.rst:2819 +#: ../../library/os.rst:2893 msgid "" "The result is cached on the ``os.DirEntry`` object. Use ``os.stat(entry." "path, follow_symlinks=False).st_ino`` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2823 +#: ../../library/os.rst:2897 msgid "" "On the first, uncached call, a system call is required on Windows but not on " "Unix." msgstr "" -#: ../../library/os.rst:2828 +#: ../../library/os.rst:2902 msgid "" "Return ``True`` if this entry is a directory or a symbolic link pointing to " "a directory; return ``False`` if the entry is or points to any other kind of " "file, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2832 +#: ../../library/os.rst:2906 msgid "" "If *follow_symlinks* is ``False``, return ``True`` only if this entry is a " "directory (without following symlinks); return ``False`` if the entry is any " "other kind of file or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2836 +#: ../../library/os.rst:2910 msgid "" "The result is cached on the ``os.DirEntry`` object, with a separate cache " "for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` along " "with :func:`stat.S_ISDIR` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2840 +#: ../../library/os.rst:2914 msgid "" "On the first, uncached call, no system call is required in most cases. " "Specifically, for non-symlinks, neither Windows or Unix require a system " @@ -3257,46 +3308,46 @@ msgid "" "is ``False``." msgstr "" -#: ../../library/os.rst:2847 ../../library/os.rst:2877 +#: ../../library/os.rst:2921 ../../library/os.rst:2951 msgid "" "This method can raise :exc:`OSError`, such as :exc:`PermissionError`, but :" "exc:`FileNotFoundError` is caught and not raised." msgstr "" -#: ../../library/os.rst:2852 +#: ../../library/os.rst:2926 msgid "" "Return ``True`` if this entry is a file or a symbolic link pointing to a " "file; return ``False`` if the entry is or points to a directory or other non-" "file entry, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2856 +#: ../../library/os.rst:2930 msgid "" "If *follow_symlinks* is ``False``, return ``True`` only if this entry is a " "file (without following symlinks); return ``False`` if the entry is a " "directory or other non-file entry, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2860 +#: ../../library/os.rst:2934 msgid "" "The result is cached on the ``os.DirEntry`` object. Caching, system calls " "made, and exceptions raised are as per :func:`~os.DirEntry.is_dir`." msgstr "" -#: ../../library/os.rst:2865 +#: ../../library/os.rst:2939 msgid "" "Return ``True`` if this entry is a symbolic link (even if broken); return " "``False`` if the entry points to a directory or any kind of file, or if it " "doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2869 +#: ../../library/os.rst:2943 msgid "" "The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." "islink` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2872 +#: ../../library/os.rst:2946 msgid "" "On the first, uncached call, no system call is required in most cases. " "Specifically, neither Windows or Unix require a system call, except on " @@ -3304,48 +3355,48 @@ msgid "" "``dirent.d_type == DT_UNKNOWN``." msgstr "" -#: ../../library/os.rst:2882 +#: ../../library/os.rst:2956 msgid "" "Return ``True`` if this entry is a junction (even if broken); return " "``False`` if the entry points to a regular directory, any kind of file, a " "symlink, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2886 +#: ../../library/os.rst:2960 msgid "" "The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." "isjunction` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2893 +#: ../../library/os.rst:2967 msgid "" "Return a :class:`stat_result` object for this entry. This method follows " "symbolic links by default; to stat a symbolic link add the " "``follow_symlinks=False`` argument." msgstr "" -#: ../../library/os.rst:2897 +#: ../../library/os.rst:2971 msgid "" "On Unix, this method always requires a system call. On Windows, it only " "requires a system call if *follow_symlinks* is ``True`` and the entry is a " "reparse point (for example, a symbolic link or directory junction)." msgstr "" -#: ../../library/os.rst:2902 +#: ../../library/os.rst:2976 msgid "" "On Windows, the ``st_ino``, ``st_dev`` and ``st_nlink`` attributes of the :" "class:`stat_result` are always set to zero. Call :func:`os.stat` to get " "these attributes." msgstr "" -#: ../../library/os.rst:2906 +#: ../../library/os.rst:2980 msgid "" "The result is cached on the ``os.DirEntry`` object, with a separate cache " "for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` to fetch " "up-to-date information." msgstr "" -#: ../../library/os.rst:2910 +#: ../../library/os.rst:2984 msgid "" "Note that there is a nice correspondence between several attributes and " "methods of ``os.DirEntry`` and of :class:`pathlib.Path`. In particular, the " @@ -3353,13 +3404,13 @@ msgid "" "``is_file()``, ``is_symlink()``, ``is_junction()``, and ``stat()`` methods." msgstr "" -#: ../../library/os.rst:2918 +#: ../../library/os.rst:2992 msgid "" "Added support for the :class:`~os.PathLike` interface. Added support for :" "class:`bytes` paths on Windows." msgstr "" -#: ../../library/os.rst:2922 +#: ../../library/os.rst:2996 msgid "" "The ``st_ctime`` attribute of a stat result is deprecated on Windows. The " "file creation time is properly available as ``st_birthtime``, and in the " @@ -3367,7 +3418,7 @@ msgid "" "time, if available." msgstr "" -#: ../../library/os.rst:2931 +#: ../../library/os.rst:3005 msgid "" "Get the status of a file or a file descriptor. Perform the equivalent of a :" "c:func:`stat` system call on the given path. *path* may be specified as " @@ -3376,21 +3427,21 @@ msgid "" "`stat_result` object." msgstr "" -#: ../../library/os.rst:2937 +#: ../../library/os.rst:3011 msgid "" "This function normally follows symlinks; to stat a symlink add the argument " "``follow_symlinks=False``, or use :func:`lstat`." msgstr "" -#: ../../library/os.rst:2940 ../../library/os.rst:3805 -#: ../../library/os.rst:3821 ../../library/os.rst:3837 -#: ../../library/os.rst:3857 +#: ../../library/os.rst:3014 ../../library/os.rst:4092 +#: ../../library/os.rst:4108 ../../library/os.rst:4124 +#: ../../library/os.rst:4144 msgid "" "This function can support :ref:`specifying a file descriptor ` and :" "ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:2943 +#: ../../library/os.rst:3017 msgid "" "On Windows, passing ``follow_symlinks=False`` will disable following all " "name-surrogate reparse points, which includes symlinks and directory " @@ -3404,11 +3455,11 @@ msgid "" "junction points, which will raise the usual exceptions." msgstr "" -#: ../../library/os.rst:2956 ../../library/os.rst:3725 +#: ../../library/os.rst:3030 ../../library/os.rst:3799 msgid "Example::" msgstr "範例: ::" -#: ../../library/os.rst:2958 +#: ../../library/os.rst:3032 msgid "" ">>> import os\n" ">>> statinfo = os.stat('somefile.txt')\n" @@ -3428,17 +3479,17 @@ msgstr "" ">>> statinfo.st_size\n" "264" -#: ../../library/os.rst:2969 +#: ../../library/os.rst:3043 msgid ":func:`fstat` and :func:`lstat` functions." msgstr ":func:`fstat` 和 :func:`lstat` 函式。" -#: ../../library/os.rst:2971 +#: ../../library/os.rst:3045 msgid "" "Added the *dir_fd* and *follow_symlinks* parameters, specifying a file " "descriptor instead of a path." msgstr "新增 *dir_fd* 與 *follow_symlinks* 參數,指定一個檔案描述器而非路徑。" -#: ../../library/os.rst:2978 +#: ../../library/os.rst:3052 msgid "" "On Windows, all reparse points that can be resolved by the operating system " "are now followed, and passing ``follow_symlinks=False`` disables following " @@ -3448,122 +3499,122 @@ msgid "" "of raising an error." msgstr "" -#: ../../library/os.rst:2989 +#: ../../library/os.rst:3063 msgid "" "Object whose attributes correspond roughly to the members of the :c:struct:" "`stat` structure. It is used for the result of :func:`os.stat`, :func:`os." "fstat` and :func:`os.lstat`." msgstr "" -#: ../../library/os.rst:2993 +#: ../../library/os.rst:3067 msgid "Attributes:" msgstr "屬性:" -#: ../../library/os.rst:2997 +#: ../../library/os.rst:3071 msgid "File mode: file type and file mode bits (permissions)." msgstr "" -#: ../../library/os.rst:3001 +#: ../../library/os.rst:3075 msgid "" "Platform dependent, but if non-zero, uniquely identifies the file for a " "given value of ``st_dev``. Typically:" msgstr "" -#: ../../library/os.rst:3004 +#: ../../library/os.rst:3078 msgid "the inode number on Unix," msgstr "" -#: ../../library/os.rst:3005 +#: ../../library/os.rst:3079 msgid "" "the `file index `_ on " "Windows" msgstr "" -#: ../../library/os.rst:3011 +#: ../../library/os.rst:3085 msgid "Identifier of the device on which this file resides." msgstr "" -#: ../../library/os.rst:3015 +#: ../../library/os.rst:3089 msgid "Number of hard links." msgstr "" -#: ../../library/os.rst:3019 +#: ../../library/os.rst:3093 msgid "User identifier of the file owner." msgstr "" -#: ../../library/os.rst:3023 +#: ../../library/os.rst:3097 msgid "Group identifier of the file owner." msgstr "" -#: ../../library/os.rst:3027 +#: ../../library/os.rst:3101 msgid "" "Size of the file in bytes, if it is a regular file or a symbolic link. The " "size of a symbolic link is the length of the pathname it contains, without a " "terminating null byte." msgstr "" -#: ../../library/os.rst:3031 +#: ../../library/os.rst:3105 msgid "Timestamps:" msgstr "" -#: ../../library/os.rst:3035 +#: ../../library/os.rst:3109 msgid "Time of most recent access expressed in seconds." msgstr "" -#: ../../library/os.rst:3039 +#: ../../library/os.rst:3113 msgid "Time of most recent content modification expressed in seconds." msgstr "" -#: ../../library/os.rst:3043 +#: ../../library/os.rst:3117 msgid "Time of most recent metadata change expressed in seconds." msgstr "" -#: ../../library/os.rst:3045 +#: ../../library/os.rst:3119 msgid "" "``st_ctime`` is deprecated on Windows. Use ``st_birthtime`` for the file " "creation time. In the future, ``st_ctime`` will contain the time of the most " "recent metadata change, as for other platforms." msgstr "" -#: ../../library/os.rst:3052 +#: ../../library/os.rst:3126 msgid "Time of most recent access expressed in nanoseconds as an integer." msgstr "" -#: ../../library/os.rst:3058 +#: ../../library/os.rst:3132 msgid "" "Time of most recent content modification expressed in nanoseconds as an " "integer." msgstr "" -#: ../../library/os.rst:3065 +#: ../../library/os.rst:3139 msgid "" "Time of most recent metadata change expressed in nanoseconds as an integer." msgstr "" -#: ../../library/os.rst:3070 +#: ../../library/os.rst:3144 msgid "" "``st_ctime_ns`` is deprecated on Windows. Use ``st_birthtime_ns`` for the " "file creation time. In the future, ``st_ctime`` will contain the time of the " "most recent metadata change, as for other platforms." msgstr "" -#: ../../library/os.rst:3077 +#: ../../library/os.rst:3151 msgid "" "Time of file creation expressed in seconds. This attribute is not always " "available, and may raise :exc:`AttributeError`." msgstr "" -#: ../../library/os.rst:3080 +#: ../../library/os.rst:3154 msgid "``st_birthtime`` is now available on Windows." msgstr "" -#: ../../library/os.rst:3085 +#: ../../library/os.rst:3159 msgid "" "Time of file creation expressed in nanoseconds as an integer. This attribute " "is not always available, and may raise :exc:`AttributeError`." msgstr "" -#: ../../library/os.rst:3093 +#: ../../library/os.rst:3167 msgid "" "The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, :" "attr:`st_ctime` and :attr:`st_birthtime` attributes depend on the operating " @@ -3573,7 +3624,7 @@ msgid "" "details." msgstr "" -#: ../../library/os.rst:3100 +#: ../../library/os.rst:3174 msgid "" "Similarly, although :attr:`st_atime_ns`, :attr:`st_mtime_ns`, :attr:" "`st_ctime_ns` and :attr:`st_birthtime_ns` are always expressed in " @@ -3586,74 +3637,74 @@ msgid "" "`st_birthtime_ns`." msgstr "" -#: ../../library/os.rst:3110 +#: ../../library/os.rst:3184 msgid "" "On some Unix systems (such as Linux), the following attributes may also be " "available:" msgstr "" -#: ../../library/os.rst:3115 +#: ../../library/os.rst:3189 msgid "" "Number of 512-byte blocks allocated for file. This may be smaller than :attr:" "`st_size`/512 when the file has holes." msgstr "" -#: ../../library/os.rst:3120 +#: ../../library/os.rst:3194 msgid "" "\"Preferred\" blocksize for efficient file system I/O. Writing to a file in " "smaller chunks may cause an inefficient read-modify-rewrite." msgstr "" -#: ../../library/os.rst:3125 +#: ../../library/os.rst:3199 msgid "Type of device if an inode device." msgstr "" -#: ../../library/os.rst:3129 +#: ../../library/os.rst:3203 msgid "User defined flags for file." msgstr "" -#: ../../library/os.rst:3131 +#: ../../library/os.rst:3205 msgid "" "On other Unix systems (such as FreeBSD), the following attributes may be " "available (but may be only filled out if root tries to use them):" msgstr "" -#: ../../library/os.rst:3136 +#: ../../library/os.rst:3210 msgid "File generation number." msgstr "" -#: ../../library/os.rst:3138 +#: ../../library/os.rst:3212 msgid "" "On Solaris and derivatives, the following attributes may also be available:" msgstr "" -#: ../../library/os.rst:3143 +#: ../../library/os.rst:3217 msgid "" "String that uniquely identifies the type of the filesystem that contains the " "file." msgstr "" -#: ../../library/os.rst:3146 +#: ../../library/os.rst:3220 msgid "On macOS systems, the following attributes may also be available:" msgstr "" -#: ../../library/os.rst:3150 +#: ../../library/os.rst:3224 msgid "Real size of the file." msgstr "" -#: ../../library/os.rst:3154 +#: ../../library/os.rst:3228 msgid "Creator of the file." msgstr "" -#: ../../library/os.rst:3158 +#: ../../library/os.rst:3232 msgid "File type." msgstr "" -#: ../../library/os.rst:3160 +#: ../../library/os.rst:3234 msgid "On Windows systems, the following attributes are also available:" msgstr "" -#: ../../library/os.rst:3164 +#: ../../library/os.rst:3238 msgid "" "Windows file attributes: ``dwFileAttributes`` member of the " "``BY_HANDLE_FILE_INFORMATION`` structure returned by :c:func:`!" @@ -3661,7 +3712,7 @@ msgid "" "FILE_ATTRIBUTE_ARCHIVE>` constants in the :mod:`stat` module." msgstr "" -#: ../../library/os.rst:3174 +#: ../../library/os.rst:3248 msgid "" "When :attr:`st_file_attributes` has the :const:`~stat." "FILE_ATTRIBUTE_REPARSE_POINT` set, this field contains the tag identifying " @@ -3669,14 +3720,14 @@ msgid "" "IO_REPARSE_TAG_SYMLINK>` constants in the :mod:`stat` module." msgstr "" -#: ../../library/os.rst:3179 +#: ../../library/os.rst:3253 msgid "" "The standard module :mod:`stat` defines functions and constants that are " "useful for extracting information from a :c:struct:`stat` structure. (On " "Windows, some items are filled with dummy values.)" msgstr "" -#: ../../library/os.rst:3183 +#: ../../library/os.rst:3257 msgid "" "For backward compatibility, a :class:`stat_result` instance is also " "accessible as a tuple of at least 10 integers giving the most important (and " @@ -3688,49 +3739,49 @@ msgid "" "class:`stat_result` as a tuple always returns integers." msgstr "" -#: ../../library/os.rst:3192 +#: ../../library/os.rst:3266 msgid "Windows now returns the file index as :attr:`st_ino` when available." msgstr "" -#: ../../library/os.rst:3196 +#: ../../library/os.rst:3270 msgid "Added the :attr:`st_fstype` member to Solaris/derivatives." msgstr "" -#: ../../library/os.rst:3199 +#: ../../library/os.rst:3273 msgid "Added the :attr:`st_reparse_tag` member on Windows." msgstr "在 Windows 上新增 :attr:`st_reparse_tag` 成員。" -#: ../../library/os.rst:3202 +#: ../../library/os.rst:3276 msgid "" "On Windows, the :attr:`st_mode` member now identifies special files as :" "const:`S_IFCHR`, :const:`S_IFIFO` or :const:`S_IFBLK` as appropriate." msgstr "" -#: ../../library/os.rst:3207 +#: ../../library/os.rst:3281 msgid "" "On Windows, :attr:`st_ctime` is deprecated. Eventually, it will contain the " "last metadata change time, for consistency with other platforms, but for now " "still contains creation time. Use :attr:`st_birthtime` for the creation time." msgstr "" -#: ../../library/os.rst:3213 +#: ../../library/os.rst:3287 msgid "" "On Windows, :attr:`st_ino` may now be up to 128 bits, depending on the file " "system. Previously it would not be above 64 bits, and larger file " "identifiers would be arbitrarily packed." msgstr "" -#: ../../library/os.rst:3217 +#: ../../library/os.rst:3291 msgid "" "On Windows, :attr:`st_rdev` no longer returns a value. Previously it would " "contain the same as :attr:`st_dev`, which was incorrect." msgstr "" -#: ../../library/os.rst:3220 +#: ../../library/os.rst:3294 msgid "Added the :attr:`st_birthtime` member on Windows." msgstr "在 Windows 上新增 :attr:`st_birthtime` 成員。" -#: ../../library/os.rst:3225 +#: ../../library/os.rst:3299 msgid "" "Perform a :c:func:`!statvfs` system call on the given path. The return " "value is an object whose attributes describe the filesystem on the given " @@ -3740,7 +3791,7 @@ msgid "" "`f_favail`, :attr:`f_flag`, :attr:`f_namemax`, :attr:`f_fsid`." msgstr "" -#: ../../library/os.rst:3232 +#: ../../library/os.rst:3306 msgid "" "Two module-level constants are defined for the :attr:`f_flag` attribute's " "bit-flags: if :const:`ST_RDONLY` is set, the filesystem is mounted read-" @@ -3748,7 +3799,7 @@ msgid "" "are disabled or not supported." msgstr "" -#: ../../library/os.rst:3237 +#: ../../library/os.rst:3311 msgid "" "Additional module-level constants are defined for GNU/glibc based systems. " "These are :const:`ST_NODEV` (disallow access to device special files), :" @@ -3761,11 +3812,11 @@ msgid "" "relative to mtime/ctime)." msgstr "" -#: ../../library/os.rst:3250 +#: ../../library/os.rst:3324 msgid "The :const:`ST_RDONLY` and :const:`ST_NOSUID` constants were added." msgstr "新增 :const:`ST_RDONLY` 與 :const:`ST_NOSUID` 常數。" -#: ../../library/os.rst:3256 +#: ../../library/os.rst:3330 msgid "" "The :const:`ST_NODEV`, :const:`ST_NOEXEC`, :const:`ST_SYNCHRONOUS`, :const:" "`ST_MANDLOCK`, :const:`ST_WRITE`, :const:`ST_APPEND`, :const:" @@ -3773,11 +3824,11 @@ msgid "" "`ST_RELATIME` constants were added." msgstr "" -#: ../../library/os.rst:3265 +#: ../../library/os.rst:3339 msgid "Added the :attr:`f_fsid` attribute." msgstr "新增 :attr:`f_fsid` 屬性。" -#: ../../library/os.rst:3271 +#: ../../library/os.rst:3345 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "accept an open file descriptor for their *dir_fd* parameter. Different " @@ -3789,7 +3840,7 @@ msgid "" "(Specifying ``None`` for *dir_fd* is always supported on all platforms.)" msgstr "" -#: ../../library/os.rst:3281 +#: ../../library/os.rst:3355 msgid "" "To check whether a particular function accepts an open file descriptor for " "its *dir_fd* parameter, use the ``in`` operator on ``supports_dir_fd``. As " @@ -3797,17 +3848,17 @@ msgid "" "open file descriptors for *dir_fd* on the local platform::" msgstr "" -#: ../../library/os.rst:3286 +#: ../../library/os.rst:3360 msgid "os.stat in os.supports_dir_fd" msgstr "os.stat in os.supports_dir_fd" -#: ../../library/os.rst:3288 +#: ../../library/os.rst:3362 msgid "" "Currently *dir_fd* parameters only work on Unix platforms; none of them work " "on Windows." msgstr "" -#: ../../library/os.rst:3296 +#: ../../library/os.rst:3370 msgid "" "A :class:`set` object indicating whether :func:`os.access` permits " "specifying ``True`` for its *effective_ids* parameter on the local platform. " @@ -3816,23 +3867,23 @@ msgid "" "func:`os.access`; otherwise it will be empty." msgstr "" -#: ../../library/os.rst:3302 +#: ../../library/os.rst:3376 msgid "" "This expression evaluates to ``True`` if :func:`os.access` supports " "``effective_ids=True`` on the local platform::" msgstr "" -#: ../../library/os.rst:3305 +#: ../../library/os.rst:3379 msgid "os.access in os.supports_effective_ids" msgstr "os.access in os.supports_effective_ids" -#: ../../library/os.rst:3307 +#: ../../library/os.rst:3381 msgid "" "Currently *effective_ids* is only supported on Unix platforms; it does not " "work on Windows." msgstr "" -#: ../../library/os.rst:3315 +#: ../../library/os.rst:3389 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "permit specifying their *path* parameter as an open file descriptor on the " @@ -3841,7 +3892,7 @@ msgid "" "*path* arguments is not available on all platforms Python supports." msgstr "" -#: ../../library/os.rst:3322 +#: ../../library/os.rst:3396 msgid "" "To determine whether a particular function permits specifying an open file " "descriptor for its *path* parameter, use the ``in`` operator on " @@ -3850,11 +3901,11 @@ msgid "" "platform::" msgstr "" -#: ../../library/os.rst:3328 +#: ../../library/os.rst:3402 msgid "os.chdir in os.supports_fd" msgstr "os.chdir in os.supports_fd" -#: ../../library/os.rst:3335 +#: ../../library/os.rst:3409 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "accept ``False`` for their *follow_symlinks* parameter on the local " @@ -3867,7 +3918,7 @@ msgid "" "on all platforms.)" msgstr "" -#: ../../library/os.rst:3345 +#: ../../library/os.rst:3419 msgid "" "To check whether a particular function accepts ``False`` for its " "*follow_symlinks* parameter, use the ``in`` operator on " @@ -3876,15 +3927,15 @@ msgid "" "stat` on the local platform::" msgstr "" -#: ../../library/os.rst:3351 +#: ../../library/os.rst:3425 msgid "os.stat in os.supports_follow_symlinks" msgstr "os.stat in os.supports_follow_symlinks" -#: ../../library/os.rst:3358 +#: ../../library/os.rst:3432 msgid "Create a symbolic link pointing to *src* named *dst*." msgstr "" -#: ../../library/os.rst:3360 +#: ../../library/os.rst:3434 msgid "" "On Windows, a symlink represents either a file or a directory, and does not " "morph to the target dynamically. If the target is present, the type of the " @@ -3894,7 +3945,7 @@ msgid "" "ignored." msgstr "" -#: ../../library/os.rst:3371 +#: ../../library/os.rst:3445 msgid "" "On newer versions of Windows 10, unprivileged accounts can create symlinks " "if Developer Mode is enabled. When Developer Mode is not available/enabled, " @@ -3902,12 +3953,12 @@ msgid "" "must be run as an administrator." msgstr "" -#: ../../library/os.rst:3377 +#: ../../library/os.rst:3451 msgid "" ":exc:`OSError` is raised when the function is called by an unprivileged user." msgstr "" -#: ../../library/os.rst:3380 +#: ../../library/os.rst:3454 msgid "" "Raises an :ref:`auditing event ` ``os.symlink`` with arguments " "``src``, ``dst``, ``dir_fd``." @@ -3915,27 +3966,27 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.symlink``。" -#: ../../library/os.rst:3390 +#: ../../library/os.rst:3464 msgid "" "Added the *dir_fd* parameter, and now allow *target_is_directory* on non-" "Windows platforms." msgstr "" -#: ../../library/os.rst:3397 +#: ../../library/os.rst:3471 msgid "Added support for unelevated symlinks on Windows with Developer Mode." msgstr "" -#: ../../library/os.rst:3403 +#: ../../library/os.rst:3477 msgid "Force write of everything to disk." msgstr "" -#: ../../library/os.rst:3412 +#: ../../library/os.rst:3486 msgid "" "Truncate the file corresponding to *path*, so that it is at most *length* " "bytes in size." msgstr "" -#: ../../library/os.rst:3417 +#: ../../library/os.rst:3491 msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``path``, ``length``." @@ -3943,46 +3994,46 @@ msgstr "" "引發一個附帶引數 ``path``、``length`` 的\\ :ref:`稽核事件 ` ``os." "truncate``。" -#: ../../library/os.rst:3432 +#: ../../library/os.rst:3506 msgid "" "Remove (delete) the file *path*. This function is semantically identical " "to :func:`remove`; the ``unlink`` name is its traditional Unix name. Please " "see the documentation for :func:`remove` for further information." msgstr "" -#: ../../library/os.rst:3448 +#: ../../library/os.rst:3522 msgid "Set the access and modified times of the file specified by *path*." msgstr "" -#: ../../library/os.rst:3450 +#: ../../library/os.rst:3524 msgid "" ":func:`utime` takes two optional parameters, *times* and *ns*. These specify " "the times set on *path* and are used as follows:" msgstr "" -#: ../../library/os.rst:3453 +#: ../../library/os.rst:3527 msgid "" "If *ns* is specified, it must be a 2-tuple of the form ``(atime_ns, " "mtime_ns)`` where each member is an int expressing nanoseconds." msgstr "" -#: ../../library/os.rst:3456 +#: ../../library/os.rst:3530 msgid "" "If *times* is not ``None``, it must be a 2-tuple of the form ``(atime, " "mtime)`` where each member is an int or float expressing seconds." msgstr "" -#: ../../library/os.rst:3459 +#: ../../library/os.rst:3533 msgid "" "If *times* is ``None`` and *ns* is unspecified, this is equivalent to " "specifying ``ns=(atime_ns, mtime_ns)`` where both times are the current time." msgstr "" -#: ../../library/os.rst:3463 +#: ../../library/os.rst:3537 msgid "It is an error to specify tuples for both *times* and *ns*." msgstr "" -#: ../../library/os.rst:3465 +#: ../../library/os.rst:3539 msgid "" "Note that the exact times you set here may not be returned by a subsequent :" "func:`~os.stat` call, depending on the resolution with which your operating " @@ -3992,7 +4043,7 @@ msgid "" "func:`utime`." msgstr "" -#: ../../library/os.rst:3476 +#: ../../library/os.rst:3550 msgid "" "Raises an :ref:`auditing event ` ``os.utime`` with arguments " "``path``, ``times``, ``ns``, ``dir_fd``." @@ -4000,13 +4051,13 @@ msgstr "" "引發一個附帶引數 ``path``、``times``、``ns``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.utime``。" -#: ../../library/os.rst:3478 +#: ../../library/os.rst:3552 msgid "" "Added support for specifying *path* as an open file descriptor, and the " "*dir_fd*, *follow_symlinks*, and *ns* parameters." msgstr "" -#: ../../library/os.rst:3492 +#: ../../library/os.rst:3566 msgid "" "Generate the file names in a directory tree by walking the tree either top-" "down or bottom-up. For each directory in the tree rooted at directory *top* " @@ -4014,7 +4065,7 @@ msgid "" "filenames)``." msgstr "" -#: ../../library/os.rst:3497 +#: ../../library/os.rst:3571 msgid "" "*dirpath* is a string, the path to the directory. *dirnames* is a list of " "the names of the subdirectories in *dirpath* (including symlinks to " @@ -4028,7 +4079,7 @@ msgid "" "unspecified." msgstr "" -#: ../../library/os.rst:3508 +#: ../../library/os.rst:3582 msgid "" "If optional argument *topdown* is ``True`` or not specified, the triple for " "a directory is generated before the triples for any of its subdirectories " @@ -4039,7 +4090,7 @@ msgid "" "its subdirectories are generated." msgstr "" -#: ../../library/os.rst:3516 +#: ../../library/os.rst:3590 msgid "" "When *topdown* is ``True``, the caller can modify the *dirnames* list in-" "place (perhaps using :keyword:`del` or slice assignment), and :func:`walk` " @@ -4052,7 +4103,7 @@ msgid "" "itself is generated." msgstr "" -#: ../../library/os.rst:3525 +#: ../../library/os.rst:3599 msgid "" "By default, errors from the :func:`scandir` call are ignored. If optional " "argument *onerror* is specified, it should be a function; it will be called " @@ -4062,35 +4113,35 @@ msgid "" "object." msgstr "" -#: ../../library/os.rst:3531 +#: ../../library/os.rst:3605 msgid "" "By default, :func:`walk` will not walk down into symbolic links that resolve " "to directories. Set *followlinks* to ``True`` to visit directories pointed " "to by symlinks, on systems that support them." msgstr "" -#: ../../library/os.rst:3537 +#: ../../library/os.rst:3611 msgid "" "Be aware that setting *followlinks* to ``True`` can lead to infinite " "recursion if a link points to a parent directory of itself. :func:`walk` " "does not keep track of the directories it visited already." msgstr "" -#: ../../library/os.rst:3543 +#: ../../library/os.rst:3617 msgid "" "If you pass a relative pathname, don't change the current working directory " "between resumptions of :func:`walk`. :func:`walk` never changes the current " "directory, and assumes that its caller doesn't either." msgstr "" -#: ../../library/os.rst:3547 ../../library/os.rst:3608 +#: ../../library/os.rst:3621 ../../library/os.rst:3682 msgid "" "This example displays the number of bytes taken by non-directory files in " "each directory under the starting directory, except that it doesn't look " "under any CVS subdirectory::" msgstr "" -#: ../../library/os.rst:3551 +#: ../../library/os.rst:3625 msgid "" "import os\n" "from os.path import join, getsize\n" @@ -4102,14 +4153,14 @@ msgid "" " dirs.remove('CVS') # don't visit CVS directories" msgstr "" -#: ../../library/os.rst:3560 +#: ../../library/os.rst:3634 msgid "" "In the next example (simple implementation of :func:`shutil.rmtree`), " "walking the tree bottom-up is essential, :func:`rmdir` doesn't allow " "deleting a directory before the directory is empty::" msgstr "" -#: ../../library/os.rst:3564 +#: ../../library/os.rst:3638 msgid "" "# Delete everything reachable from the directory named in \"top\",\n" "# assuming there are no symbolic links.\n" @@ -4123,7 +4174,7 @@ msgid "" " os.rmdir(os.path.join(root, name))" msgstr "" -#: ../../library/os.rst:3575 +#: ../../library/os.rst:3649 msgid "" "Raises an :ref:`auditing event ` ``os.walk`` with arguments " "``top``, ``topdown``, ``onerror``, ``followlinks``." @@ -4131,25 +4182,25 @@ msgstr "" "引發一個附帶引數 ``top``、``topdown``、``onerror``、``followlinks`` 的\\ :" "ref:`稽核事件 ` ``os.walk``。" -#: ../../library/os.rst:3577 +#: ../../library/os.rst:3651 msgid "" "This function now calls :func:`os.scandir` instead of :func:`os.listdir`, " "making it faster by reducing the number of calls to :func:`os.stat`." msgstr "" -#: ../../library/os.rst:3591 +#: ../../library/os.rst:3665 msgid "" "This behaves exactly like :func:`walk`, except that it yields a 4-tuple " "``(dirpath, dirnames, filenames, dirfd)``, and it supports ``dir_fd``." msgstr "" -#: ../../library/os.rst:3594 +#: ../../library/os.rst:3668 msgid "" "*dirpath*, *dirnames* and *filenames* are identical to :func:`walk` output, " "and *dirfd* is a file descriptor referring to the directory *dirpath*." msgstr "" -#: ../../library/os.rst:3597 +#: ../../library/os.rst:3671 msgid "" "This function always supports :ref:`paths relative to directory descriptors " "` and :ref:`not following symlinks `. Note however " @@ -4157,14 +4208,14 @@ msgid "" "*follow_symlinks* is ``False``." msgstr "" -#: ../../library/os.rst:3604 +#: ../../library/os.rst:3678 msgid "" "Since :func:`fwalk` yields file descriptors, those are only valid until the " "next iteration step, so you should duplicate them (e.g. with :func:`dup`) if " "you want to keep them longer." msgstr "" -#: ../../library/os.rst:3612 +#: ../../library/os.rst:3686 msgid "" "import os\n" "for root, dirs, files, rootfd in os.fwalk('python/Lib/email'):\n" @@ -4176,13 +4227,13 @@ msgid "" " dirs.remove('CVS') # don't visit CVS directories" msgstr "" -#: ../../library/os.rst:3621 +#: ../../library/os.rst:3695 msgid "" "In the next example, walking the tree bottom-up is essential: :func:`rmdir` " "doesn't allow deleting a directory before the directory is empty::" msgstr "" -#: ../../library/os.rst:3625 +#: ../../library/os.rst:3699 msgid "" "# Delete everything reachable from the directory named in \"top\",\n" "# assuming there are no symbolic links.\n" @@ -4196,7 +4247,7 @@ msgid "" " os.rmdir(name, dir_fd=rootfd)" msgstr "" -#: ../../library/os.rst:3636 +#: ../../library/os.rst:3710 msgid "" "Raises an :ref:`auditing event ` ``os.fwalk`` with arguments " "``top``, ``topdown``, ``onerror``, ``follow_symlinks``, ``dir_fd``." @@ -4204,11 +4255,11 @@ msgstr "" "引發一個附帶引數 ``top``、``topdown``、``onerror``、``follow_symlinks``、" "``dir_fd`` 的\\ :ref:`稽核事件 ` ``os.fwalk``。" -#: ../../library/os.rst:3645 +#: ../../library/os.rst:3719 msgid "Added support for :class:`bytes` paths." msgstr "新增對 :class:`bytes` 路徑的支援。" -#: ../../library/os.rst:3651 +#: ../../library/os.rst:3725 msgid "" "Create an anonymous file and return a file descriptor that refers to it. " "*flags* must be one of the ``os.MFD_*`` constants available on the system " @@ -4216,7 +4267,7 @@ msgid "" "descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3656 +#: ../../library/os.rst:3730 msgid "" "The name supplied in *name* is used as a filename and will be displayed as " "the target of the corresponding symbolic link in the directory ``/proc/self/" @@ -4226,23 +4277,23 @@ msgid "" "side effects." msgstr "" -#: ../../library/os.rst:3663 +#: ../../library/os.rst:3737 msgid ":ref:`Availability `: Linux >= 3.17 with glibc >= 2.27." msgstr ":ref:`適用 `:Linux 3.17 以上且具有 glibc 2.27 以上。" -#: ../../library/os.rst:3686 +#: ../../library/os.rst:3760 msgid "These flags can be passed to :func:`memfd_create`." msgstr "這些旗標可以傳給 :func:`memfd_create`。" -#: ../../library/os.rst:3688 +#: ../../library/os.rst:3762 msgid ":ref:`Availability `: Linux >= 3.17 with glibc >= 2.27" msgstr ":ref:`適用 `:Linux 3.17 以上且具有 glibc 2.27 以上" -#: ../../library/os.rst:3690 +#: ../../library/os.rst:3764 msgid "The ``MFD_HUGE*`` flags are only available since Linux 4.14." msgstr "``MFD_HUGE*`` 旗標僅在 Linux 4.14 以上可用。" -#: ../../library/os.rst:3697 +#: ../../library/os.rst:3771 msgid "" "Create and return an event file descriptor. The file descriptors supports " "raw :func:`read` and :func:`write` with a buffer size of 8, :func:`~select." @@ -4251,7 +4302,7 @@ msgid "" "ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3703 +#: ../../library/os.rst:3777 msgid "" "*initval* is the initial value of the event counter. The initial value must " "be a 32 bit unsigned integer. Please note that the initial value is limited " @@ -4259,39 +4310,39 @@ msgid "" "integer with a maximum value of 2\\ :sup:`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3708 +#: ../../library/os.rst:3782 msgid "" "*flags* can be constructed from :const:`EFD_CLOEXEC`, :const:`EFD_NONBLOCK`, " "and :const:`EFD_SEMAPHORE`." msgstr "" -#: ../../library/os.rst:3711 +#: ../../library/os.rst:3785 msgid "" "If :const:`EFD_SEMAPHORE` is specified and the event counter is non-zero, :" "func:`eventfd_read` returns 1 and decrements the counter by one." msgstr "" -#: ../../library/os.rst:3714 +#: ../../library/os.rst:3788 msgid "" "If :const:`EFD_SEMAPHORE` is not specified and the event counter is non-" "zero, :func:`eventfd_read` returns the current event counter value and " "resets the counter to zero." msgstr "" -#: ../../library/os.rst:3718 +#: ../../library/os.rst:3792 msgid "" "If the event counter is zero and :const:`EFD_NONBLOCK` is not specified, :" "func:`eventfd_read` blocks." msgstr "" -#: ../../library/os.rst:3721 +#: ../../library/os.rst:3795 msgid "" ":func:`eventfd_write` increments the event counter. Write blocks if the " "write operation would increment the counter to a value larger than 2\\ :sup:" "`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3727 +#: ../../library/os.rst:3801 msgid "" "import os\n" "\n" @@ -4309,55 +4360,345 @@ msgid "" " os.close(fd)" msgstr "" -#: ../../library/os.rst:3742 +#: ../../library/os.rst:3816 ../../library/os.rst:3932 +#: ../../library/os.rst:3995 ../../library/os.rst:4005 +#: ../../library/os.rst:4023 ../../library/os.rst:4032 +#: ../../library/os.rst:4042 ../../library/os.rst:4052 +#: ../../library/os.rst:4062 ../../library/os.rst:4073 msgid ":ref:`Availability `: Linux >= 2.6.27 with glibc >= 2.8" msgstr ":ref:`適用 `:Linux 2.6.27 以上且具有 glibc 2.8 以上" -#: ../../library/os.rst:3748 +#: ../../library/os.rst:3822 msgid "" "Read value from an :func:`eventfd` file descriptor and return a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3751 ../../library/os.rst:3760 -#: ../../library/os.rst:3768 ../../library/os.rst:3777 +#: ../../library/os.rst:3825 ../../library/os.rst:3834 +#: ../../library/os.rst:3842 ../../library/os.rst:3851 msgid ":ref:`Availability `: Linux >= 2.6.27" msgstr ":ref:`適用 `:Linux 2.6.27 以上" -#: ../../library/os.rst:3757 +#: ../../library/os.rst:3831 msgid "" "Add value to an :func:`eventfd` file descriptor. *value* must be a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3766 +#: ../../library/os.rst:3840 msgid "Set close-on-exec flag for new :func:`eventfd` file descriptor." msgstr "" -#: ../../library/os.rst:3774 +#: ../../library/os.rst:3848 msgid "" "Set :const:`O_NONBLOCK` status flag for new :func:`eventfd` file descriptor." msgstr "設定新的 :func:`eventfd` 檔案描述器的 :const:`O_NONBLOCK` 狀態旗標。" -#: ../../library/os.rst:3783 +#: ../../library/os.rst:3857 msgid "" "Provide semaphore-like semantics for reads from an :func:`eventfd` file " "descriptor. On read the internal counter is decremented by one." msgstr "" -#: ../../library/os.rst:3786 +#: ../../library/os.rst:3860 msgid ":ref:`Availability `: Linux >= 2.6.30" msgstr ":ref:`適用 `:Linux 2.6.30 以上" -#: ../../library/os.rst:3792 +#: ../../library/os.rst:3868 +msgid "Timer File Descriptors" +msgstr "" + +#: ../../library/os.rst:3872 +msgid "" +"These functions provide support for Linux's *timer file descriptor* API. " +"Naturally, they are all only available on Linux." +msgstr "" + +#: ../../library/os.rst:3877 +msgid "Create and return a timer file descriptor (*timerfd*)." +msgstr "" + +#: ../../library/os.rst:3879 +msgid "The file descriptor returned by :func:`timerfd_create` supports:" +msgstr "" + +#: ../../library/os.rst:3881 +msgid ":func:`read`" +msgstr "" + +#: ../../library/os.rst:3882 +msgid ":func:`~select.select`" +msgstr "" + +#: ../../library/os.rst:3883 +msgid ":func:`~select.poll`" +msgstr "" + +#: ../../library/os.rst:3885 +msgid "" +"The file descriptor's :func:`read` method can be called with a buffer size " +"of 8. If the timer has already expired one or more times, :func:`read` " +"returns the number of expirations with the host's endianness, which may be " +"converted to an :class:`int` by ``int.from_bytes(x, byteorder=sys." +"byteorder)``." +msgstr "" + +#: ../../library/os.rst:3890 +msgid "" +":func:`~select.select` and :func:`~select.poll` can be used to wait until " +"timer expires and the file descriptor is readable." +msgstr "" + +#: ../../library/os.rst:3893 +msgid "" +"*clockid* must be a valid :ref:`clock ID `, as " +"defined in the :py:mod:`time` module:" +msgstr "" + +#: ../../library/os.rst:3896 +#, fuzzy +msgid ":const:`time.CLOCK_REALTIME`" +msgstr ":const:`stat.S_IREAD`" + +#: ../../library/os.rst:3897 +msgid ":const:`time.CLOCK_MONOTONIC`" +msgstr "" + +#: ../../library/os.rst:3898 +msgid ":const:`time.CLOCK_BOOTTIME` (Since Linux 3.15 for timerfd_create)" +msgstr "" + +#: ../../library/os.rst:3900 +msgid "" +"If *clockid* is :const:`time.CLOCK_REALTIME`, a settable system-wide real-" +"time clock is used. If system clock is changed, timer setting need to be " +"updated. To cancel timer when system clock is changed, see :const:" +"`TFD_TIMER_CANCEL_ON_SET`." +msgstr "" + +#: ../../library/os.rst:3905 +msgid "" +"If *clockid* is :const:`time.CLOCK_MONOTONIC`, a non-settable monotonically " +"increasing clock is used. Even if the system clock is changed, the timer " +"setting will not be affected." +msgstr "" + +#: ../../library/os.rst:3909 +msgid "" +"If *clockid* is :const:`time.CLOCK_BOOTTIME`, same as :const:`time." +"CLOCK_MONOTONIC` except it includes any time that the system is suspended." +msgstr "" + +#: ../../library/os.rst:3912 +msgid "" +"The file descriptor's behaviour can be modified by specifying a *flags* " +"value. Any of the following variables may used, combined using bitwise OR " +"(the ``|`` operator):" +msgstr "" + +#: ../../library/os.rst:3916 +#, fuzzy +msgid ":const:`TFD_NONBLOCK`" +msgstr ":const:`stat.UF_NOUNLINK`" + +#: ../../library/os.rst:3917 +#, fuzzy +msgid ":const:`TFD_CLOEXEC`" +msgstr ":const:`stat.S_IEXEC`" + +#: ../../library/os.rst:3919 +msgid "" +"If :const:`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks until the " +"timer expires. If it is set as a flag, :func:`read` doesn't block, but If " +"there hasn't been an expiration since the last call to read, :func:`read` " +"raises :class:`OSError` with ``errno`` is set to :const:`errno.EAGAIN`." +msgstr "" + +#: ../../library/os.rst:3925 +msgid ":const:`TFD_CLOEXEC` is always set by Python automatically." +msgstr "" + +#: ../../library/os.rst:3927 +msgid "" +"The file descriptor must be closed with :func:`os.close` when it is no " +"longer needed, or else the file descriptor will be leaked." +msgstr "" + +#: ../../library/os.rst:3930 +#, fuzzy +msgid "The :manpage:`timerfd_create(2)` man page." +msgstr "更多細節請見 :manpage:`pidfd_open(2)` 手冊頁。" + +#: ../../library/os.rst:3939 +msgid "" +"Alter a timer file descriptor's internal timer. This function operates the " +"same interval timer as :func:`timerfd_settime_ns`." +msgstr "" + +#: ../../library/os.rst:3942 +msgid "*fd* must be a valid timer file descriptor." +msgstr "" + +#: ../../library/os.rst:3944 +msgid "" +"The timer's behaviour can be modified by specifying a *flags* value. Any of " +"the following variables may used, combined using bitwise OR (the ``|`` " +"operator):" +msgstr "" + +#: ../../library/os.rst:3948 +#, fuzzy +msgid ":const:`TFD_TIMER_ABSTIME`" +msgstr ":const:`stat.UF_IMMUTABLE`" + +#: ../../library/os.rst:3949 +#, fuzzy +msgid ":const:`TFD_TIMER_CANCEL_ON_SET`" +msgstr ":const:`SEEK_SET`" + +#: ../../library/os.rst:3951 +msgid "" +"The timer is disabled by setting *initial* to zero (``0``). If *initial* is " +"equal to or greater than zero, the timer is enabled. If *initial* is less " +"than zero, it raises an :class:`OSError` exception with ``errno`` set to :" +"const:`errno.EINVAL`" +msgstr "" + +#: ../../library/os.rst:3956 +msgid "" +"By default the timer will fire when *initial* seconds have elapsed. (If " +"*initial* is zero, timer will fire immediately.)" +msgstr "" + +#: ../../library/os.rst:3959 +msgid "" +"However, if the :const:`TFD_TIMER_ABSTIME` flag is set, the timer will fire " +"when the timer's clock (set by *clockid* in :func:`timerfd_create`) reaches " +"*initial* seconds." +msgstr "" + +#: ../../library/os.rst:3963 +msgid "" +"The timer's interval is set by the *interval* :py:class:`float`. If " +"*interval* is zero, the timer only fires once, on the initial expiration. If " +"*interval* is greater than zero, the timer fires every time *interval* " +"seconds have elapsed since the previous expiration. If *interval* is less " +"than zero, it raises :class:`OSError` with ``errno`` set to :const:`errno." +"EINVAL`" +msgstr "" + +#: ../../library/os.rst:3970 +msgid "" +"If the :const:`TFD_TIMER_CANCEL_ON_SET` flag is set along with :const:" +"`TFD_TIMER_ABSTIME` and the clock for this timer is :const:`time." +"CLOCK_REALTIME`, the timer is marked as cancelable if the real-time clock is " +"changed discontinuously. Reading the descriptor is aborted with the error " +"ECANCELED." +msgstr "" + +#: ../../library/os.rst:3976 +msgid "" +"Linux manages system clock as UTC. A daylight-savings time transition is " +"done by changing time offset only and doesn't cause discontinuous system " +"clock change." +msgstr "" + +#: ../../library/os.rst:3980 +msgid "" +"Discontinuous system clock change will be caused by the following events:" +msgstr "" + +#: ../../library/os.rst:3982 +msgid "``settimeofday``" +msgstr "" + +#: ../../library/os.rst:3983 +msgid "``clock_settime``" +msgstr "" + +#: ../../library/os.rst:3984 +msgid "set the system date and time by ``date`` command" +msgstr "" + +#: ../../library/os.rst:3986 +msgid "" +"Return a two-item tuple of (``next_expiration``, ``interval``) from the " +"previous timer state, before this function executed." +msgstr "" + +#: ../../library/os.rst:3991 +msgid "" +":manpage:`timerfd_create(2)`, :manpage:`timerfd_settime(2)`, :manpage:" +"`settimeofday(2)`, :manpage:`clock_settime(2)`, and :manpage:`date(1)`." +msgstr "" + +#: ../../library/os.rst:4002 +msgid "" +"Similar to :func:`timerfd_settime`, but use time as nanoseconds. This " +"function operates the same interval timer as :func:`timerfd_settime`." +msgstr "" + +#: ../../library/os.rst:4012 +msgid "Return a two-item tuple of floats (``next_expiration``, ``interval``)." +msgstr "" + +#: ../../library/os.rst:4014 +msgid "" +"``next_expiration`` denotes the relative time until next the timer next " +"fires, regardless of if the :const:`TFD_TIMER_ABSTIME` flag is set." +msgstr "" + +#: ../../library/os.rst:4017 +msgid "" +"``interval`` denotes the timer's interval. If zero, the timer will only fire " +"once, after ``next_expiration`` seconds have elapsed." +msgstr "" + +#: ../../library/os.rst:4021 +msgid ":manpage:`timerfd_gettime(2)`" +msgstr "" + +#: ../../library/os.rst:4030 +msgid "Similar to :func:`timerfd_gettime`, but return time as nanoseconds." +msgstr "" + +#: ../../library/os.rst:4038 +msgid "" +"A flag for the :func:`timerfd_create` function, which sets the :const:" +"`O_NONBLOCK` status flag for the new timer file descriptor. If :const:" +"`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks." +msgstr "" + +#: ../../library/os.rst:4048 +msgid "" +"A flag for the :func:`timerfd_create` function, If :const:`TFD_CLOEXEC` is " +"set as a flag, set close-on-exec flag for new file descriptor." +msgstr "" + +#: ../../library/os.rst:4058 +msgid "" +"A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " +"functions. If this flag is set, *initial* is interpreted as an absolute " +"value on the timer's clock (in UTC seconds or nanoseconds since the Unix " +"Epoch)." +msgstr "" + +#: ../../library/os.rst:4068 +msgid "" +"A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " +"functions along with :const:`TFD_TIMER_ABSTIME`. The timer is cancelled when " +"the time of the underlying clock changes discontinuously." +msgstr "" + +#: ../../library/os.rst:4079 msgid "Linux extended attributes" msgstr "" -#: ../../library/os.rst:3796 +#: ../../library/os.rst:4083 msgid "These functions are all available on Linux only." msgstr "" -#: ../../library/os.rst:3800 +#: ../../library/os.rst:4087 msgid "" "Return the value of the extended filesystem attribute *attribute* for " "*path*. *attribute* can be bytes or str (directly or indirectly through the :" @@ -4365,7 +4706,7 @@ msgid "" "encoding." msgstr "" -#: ../../library/os.rst:3808 +#: ../../library/os.rst:4095 msgid "" "Raises an :ref:`auditing event ` ``os.getxattr`` with arguments " "``path``, ``attribute``." @@ -4373,12 +4714,12 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute`` 的\\ :ref:`稽核事件 ` " "``os.getxattr``。" -#: ../../library/os.rst:3810 ../../library/os.rst:3842 -#: ../../library/os.rst:3867 +#: ../../library/os.rst:4097 ../../library/os.rst:4129 +#: ../../library/os.rst:4154 msgid "Accepts a :term:`path-like object` for *path* and *attribute*." msgstr "" -#: ../../library/os.rst:3816 +#: ../../library/os.rst:4103 msgid "" "Return a list of the extended filesystem attributes on *path*. The " "attributes in the list are represented as strings decoded with the " @@ -4386,14 +4727,14 @@ msgid "" "the current directory." msgstr "" -#: ../../library/os.rst:3824 +#: ../../library/os.rst:4111 msgid "" "Raises an :ref:`auditing event ` ``os.listxattr`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.listxattr``。" -#: ../../library/os.rst:3832 +#: ../../library/os.rst:4119 msgid "" "Removes the extended filesystem attribute *attribute* from *path*. " "*attribute* should be bytes or str (directly or indirectly through the :" @@ -4401,7 +4742,7 @@ msgid "" "`filesystem encoding and error handler`." msgstr "" -#: ../../library/os.rst:3840 +#: ../../library/os.rst:4127 msgid "" "Raises an :ref:`auditing event ` ``os.removexattr`` with arguments " "``path``, ``attribute``." @@ -4409,7 +4750,7 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute`` 的\\ :ref:`稽核事件 ` " "``os.removexattr``。" -#: ../../library/os.rst:3848 +#: ../../library/os.rst:4135 msgid "" "Set the extended filesystem attribute *attribute* on *path* to *value*. " "*attribute* must be a bytes or str with no embedded NULs (directly or " @@ -4421,13 +4762,13 @@ msgid "" "will not be created and ``EEXISTS`` will be raised." msgstr "" -#: ../../library/os.rst:3862 +#: ../../library/os.rst:4149 msgid "" "A bug in Linux kernel versions less than 2.6.39 caused the flags argument to " "be ignored on some filesystems." msgstr "" -#: ../../library/os.rst:3865 +#: ../../library/os.rst:4152 msgid "" "Raises an :ref:`auditing event ` ``os.setxattr`` with arguments " "``path``, ``attribute``, ``value``, ``flags``." @@ -4435,33 +4776,33 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute``、``value``、``flags`` 的\\ :ref:`稽" "核事件 ` ``os.setxattr``。" -#: ../../library/os.rst:3873 +#: ../../library/os.rst:4160 msgid "" "The maximum size the value of an extended attribute can be. Currently, this " "is 64 KiB on Linux." msgstr "" -#: ../../library/os.rst:3879 +#: ../../library/os.rst:4166 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must create an attribute." msgstr "" -#: ../../library/os.rst:3885 +#: ../../library/os.rst:4172 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must replace an existing attribute." msgstr "" -#: ../../library/os.rst:3892 +#: ../../library/os.rst:4179 msgid "Process Management" msgstr "行程管理" -#: ../../library/os.rst:3894 +#: ../../library/os.rst:4181 msgid "These functions may be used to create and manage processes." msgstr "" -#: ../../library/os.rst:3896 +#: ../../library/os.rst:4183 msgid "" "The various :func:`exec\\* ` functions take a list of arguments for " "the new program loaded into the process. In each case, the first of these " @@ -4472,7 +4813,7 @@ msgid "" "standard output; ``foo`` will seem to be ignored." msgstr "" -#: ../../library/os.rst:3907 +#: ../../library/os.rst:4194 msgid "" "Generate a :const:`SIGABRT` signal to the current process. On Unix, the " "default behavior is to produce a core dump; on Windows, the process " @@ -4481,31 +4822,31 @@ msgid "" "`SIGABRT` with :func:`signal.signal`." msgstr "" -#: ../../library/os.rst:3916 +#: ../../library/os.rst:4203 msgid "Add a path to the DLL search path." msgstr "" -#: ../../library/os.rst:3918 +#: ../../library/os.rst:4205 msgid "" "This search path is used when resolving dependencies for imported extension " "modules (the module itself is resolved through :data:`sys.path`), and also " "by :mod:`ctypes`." msgstr "" -#: ../../library/os.rst:3922 +#: ../../library/os.rst:4209 msgid "" "Remove the directory by calling **close()** on the returned object or using " "it in a :keyword:`with` statement." msgstr "" -#: ../../library/os.rst:3925 +#: ../../library/os.rst:4212 msgid "" "See the `Microsoft documentation `_ for more information about how " "DLLs are loaded." msgstr "" -#: ../../library/os.rst:3929 +#: ../../library/os.rst:4216 msgid "" "Raises an :ref:`auditing event ` ``os.add_dll_directory`` with " "argument ``path``." @@ -4513,7 +4854,7 @@ msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os." "add_dll_directory``。" -#: ../../library/os.rst:3933 +#: ../../library/os.rst:4220 msgid "" "Previous versions of CPython would resolve DLLs using the default behavior " "for the current process. This led to inconsistencies, such as only sometimes " @@ -4521,14 +4862,14 @@ msgid "" "such as ``AddDllDirectory`` having no effect." msgstr "" -#: ../../library/os.rst:3940 +#: ../../library/os.rst:4227 msgid "" "In 3.8, the two primary ways DLLs are loaded now explicitly override the " "process-wide behavior to ensure consistency. See the :ref:`porting notes " "` for information on updating libraries." msgstr "" -#: ../../library/os.rst:3955 +#: ../../library/os.rst:4242 msgid "" "These functions all execute a new program, replacing the current process; " "they do not return. On Unix, the new executable is loaded into the current " @@ -4536,7 +4877,7 @@ msgid "" "reported as :exc:`OSError` exceptions." msgstr "" -#: ../../library/os.rst:3960 +#: ../../library/os.rst:4247 msgid "" "The current process is replaced immediately. Open file objects and " "descriptors are not flushed, so if there may be data buffered on these open " @@ -4544,7 +4885,7 @@ msgid "" "fsync` before calling an :func:`exec\\* ` function." msgstr "" -#: ../../library/os.rst:3966 +#: ../../library/os.rst:4253 msgid "" "The \"l\" and \"v\" variants of the :func:`exec\\* ` functions differ " "in how command-line arguments are passed. The \"l\" variants are perhaps " @@ -4557,7 +4898,7 @@ msgid "" "is not enforced." msgstr "" -#: ../../library/os.rst:3975 +#: ../../library/os.rst:4262 msgid "" "The variants which include a \"p\" near the end (:func:`execlp`, :func:" "`execlpe`, :func:`execvp`, and :func:`execvpe`) will use the :envvar:`PATH` " @@ -4571,7 +4912,7 @@ msgid "" "even on Windows, as plain names will not be resolved." msgstr "" -#: ../../library/os.rst:3986 +#: ../../library/os.rst:4273 msgid "" "For :func:`execle`, :func:`execlpe`, :func:`execve`, and :func:`execvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -4581,7 +4922,7 @@ msgid "" "process to inherit the environment of the current process." msgstr "" -#: ../../library/os.rst:3993 +#: ../../library/os.rst:4280 msgid "" "For :func:`execve` on some platforms, *path* may also be specified as an " "open file descriptor. This functionality may not be supported on your " @@ -4590,7 +4931,7 @@ msgid "" "`NotImplementedError`." msgstr "" -#: ../../library/os.rst:3998 +#: ../../library/os.rst:4285 msgid "" "Raises an :ref:`auditing event ` ``os.exec`` with arguments " "``path``, ``args``, ``env``." @@ -4598,25 +4939,32 @@ msgstr "" "引發一個附帶引數 ``path``、``args``、``env`` 的\\ :ref:`稽核事件 ` " "``os.exec``。" -#: ../../library/os.rst:4002 +#: ../../library/os.rst:4287 ../../library/os.rst:4541 +#: ../../library/os.rst:4852 ../../library/os.rst:4976 +#: ../../library/os.rst:5095 ../../library/os.rst:5264 +#, fuzzy +msgid ":ref:`Availability `: Unix, Windows, not WASI, not iOS." +msgstr ":ref:`適用 `:Unix、Windows、非 Emscripten、非 WASI。" + +#: ../../library/os.rst:4289 msgid "" "Added support for specifying *path* as an open file descriptor for :func:" "`execve`." msgstr "" -#: ../../library/os.rst:4011 +#: ../../library/os.rst:4298 msgid "" "Exit the process with status *n*, without calling cleanup handlers, flushing " "stdio buffers, etc." msgstr "" -#: ../../library/os.rst:4016 +#: ../../library/os.rst:4303 msgid "" "The standard way to exit is :func:`sys.exit(n) `. :func:`!_exit` " "should normally only be used in the child process after a :func:`fork`." msgstr "" -#: ../../library/os.rst:4019 +#: ../../library/os.rst:4306 msgid "" "The following exit codes are defined and can be used with :func:`_exit`, " "although they are not required. These are typically used for system " @@ -4624,139 +4972,139 @@ msgid "" "delivery program." msgstr "" -#: ../../library/os.rst:4025 +#: ../../library/os.rst:4312 msgid "" "Some of these may not be available on all Unix platforms, since there is " "some variation. These constants are defined where they are defined by the " "underlying platform." msgstr "" -#: ../../library/os.rst:4032 +#: ../../library/os.rst:4319 msgid "" "Exit code that means no error occurred. May be taken from the defined value " "of ``EXIT_SUCCESS`` on some platforms. Generally has a value of zero." msgstr "" -#: ../../library/os.rst:4040 +#: ../../library/os.rst:4327 msgid "" "Exit code that means the command was used incorrectly, such as when the " "wrong number of arguments are given." msgstr "" -#: ../../library/os.rst:4048 +#: ../../library/os.rst:4335 msgid "Exit code that means the input data was incorrect." msgstr "" -#: ../../library/os.rst:4055 +#: ../../library/os.rst:4342 msgid "Exit code that means an input file did not exist or was not readable." msgstr "" -#: ../../library/os.rst:4062 +#: ../../library/os.rst:4349 msgid "Exit code that means a specified user did not exist." msgstr "" -#: ../../library/os.rst:4069 +#: ../../library/os.rst:4356 msgid "Exit code that means a specified host did not exist." msgstr "" -#: ../../library/os.rst:4076 +#: ../../library/os.rst:4363 msgid "Exit code that means that a required service is unavailable." msgstr "" -#: ../../library/os.rst:4083 +#: ../../library/os.rst:4370 msgid "Exit code that means an internal software error was detected." msgstr "" -#: ../../library/os.rst:4090 +#: ../../library/os.rst:4377 msgid "" "Exit code that means an operating system error was detected, such as the " "inability to fork or create a pipe." msgstr "" -#: ../../library/os.rst:4098 +#: ../../library/os.rst:4385 msgid "" "Exit code that means some system file did not exist, could not be opened, or " "had some other kind of error." msgstr "" -#: ../../library/os.rst:4106 +#: ../../library/os.rst:4393 msgid "Exit code that means a user specified output file could not be created." msgstr "" -#: ../../library/os.rst:4113 +#: ../../library/os.rst:4400 msgid "" "Exit code that means that an error occurred while doing I/O on some file." msgstr "" -#: ../../library/os.rst:4120 +#: ../../library/os.rst:4407 msgid "" "Exit code that means a temporary failure occurred. This indicates something " "that may not really be an error, such as a network connection that couldn't " "be made during a retryable operation." msgstr "" -#: ../../library/os.rst:4129 +#: ../../library/os.rst:4416 msgid "" "Exit code that means that a protocol exchange was illegal, invalid, or not " "understood." msgstr "" -#: ../../library/os.rst:4137 +#: ../../library/os.rst:4424 msgid "" "Exit code that means that there were insufficient permissions to perform the " "operation (but not intended for file system problems)." msgstr "" -#: ../../library/os.rst:4145 +#: ../../library/os.rst:4432 msgid "Exit code that means that some kind of configuration error occurred." msgstr "" -#: ../../library/os.rst:4152 +#: ../../library/os.rst:4439 msgid "Exit code that means something like \"an entry was not found\"." msgstr "" -#: ../../library/os.rst:4159 +#: ../../library/os.rst:4446 msgid "" "Fork a child process. Return ``0`` in the child and the child's process id " "in the parent. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:4162 +#: ../../library/os.rst:4449 msgid "" "Note that some platforms including FreeBSD <= 6.3 and Cygwin have known " "issues when using ``fork()`` from a thread." msgstr "" -#: ../../library/os.rst:4165 +#: ../../library/os.rst:4452 msgid "" "Raises an :ref:`auditing event ` ``os.fork`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.fork``。" -#: ../../library/os.rst:4169 +#: ../../library/os.rst:4456 msgid "" "If you use TLS sockets in an application calling ``fork()``, see the warning " "in the :mod:`ssl` documentation." msgstr "" -#: ../../library/os.rst:4174 ../../library/os.rst:4218 +#: ../../library/os.rst:4461 ../../library/os.rst:4505 msgid "" "On macOS the use of this function is unsafe when mixed with using higher-" "level system APIs, and that includes using :mod:`urllib.request`." msgstr "" -#: ../../library/os.rst:4177 +#: ../../library/os.rst:4464 msgid "" "Calling ``fork()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:4181 +#: ../../library/os.rst:4468 msgid "" "If Python is able to detect that your process has multiple threads, :func:" "`os.fork` now raises a :exc:`DeprecationWarning`." msgstr "" -#: ../../library/os.rst:4185 +#: ../../library/os.rst:4472 msgid "" "We chose to surface this as a warning, when detectable, to better inform " "developers of a design problem that the POSIX platform specifically notes as " @@ -4767,25 +5115,26 @@ msgid "" "``free``)." msgstr "" -#: ../../library/os.rst:4194 +#: ../../library/os.rst:4481 msgid "" "Users of macOS or users of libc or malloc implementations other than those " "typically found in glibc to date are among those already more likely to " "experience deadlocks running such code." msgstr "" -#: ../../library/os.rst:4198 +#: ../../library/os.rst:4485 msgid "" "See `this discussion on fork being incompatible with threads `_ for technical details of why we're surfacing " "this longstanding platform compatibility problem to developers." msgstr "" -#: ../../library/os.rst:4203 ../../library/os.rst:4450 -msgid ":ref:`Availability `: POSIX, not Emscripten, not WASI." +#: ../../library/os.rst:4490 ../../library/os.rst:4750 +#, fuzzy +msgid ":ref:`Availability `: POSIX, not WASI, not iOS." msgstr ":ref:`適用 `:POSIX、非 Emscripten、非 WASI。" -#: ../../library/os.rst:4208 +#: ../../library/os.rst:4495 msgid "" "Fork a child process, using a new pseudo-terminal as the child's controlling " "terminal. Return a pair of ``(pid, fd)``, where *pid* is ``0`` in the child, " @@ -4794,31 +5143,48 @@ msgid "" "the :mod:`pty` module. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:4214 +#: ../../library/os.rst:4501 msgid "" "Raises an :ref:`auditing event ` ``os.forkpty`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.forkpty``。" -#: ../../library/os.rst:4221 +#: ../../library/os.rst:4508 msgid "" "Calling ``forkpty()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:4225 +#: ../../library/os.rst:4512 msgid "" "If Python is able to detect that your process has multiple threads, this now " "raises a :exc:`DeprecationWarning`. See the longer explanation on :func:`os." "fork`." msgstr "" -#: ../../library/os.rst:4239 +#: ../../library/os.rst:4517 ../../library/os.rst:4557 +#: ../../library/os.rst:4594 ../../library/os.rst:4734 +#: ../../library/os.rst:4783 ../../library/os.rst:5020 +#: ../../library/os.rst:5054 ../../library/os.rst:5115 +#: ../../library/os.rst:5129 ../../library/os.rst:5146 +#: ../../library/os.rst:5161 ../../library/os.rst:5172 +#: ../../library/os.rst:5184 ../../library/os.rst:5197 +#: ../../library/os.rst:5206 ../../library/os.rst:5216 +#: ../../library/os.rst:5229 ../../library/os.rst:5280 +#: ../../library/os.rst:5291 ../../library/os.rst:5303 +#: ../../library/os.rst:5310 ../../library/os.rst:5319 +#: ../../library/os.rst:5328 ../../library/os.rst:5337 +#: ../../library/os.rst:5346 +#, fuzzy +msgid ":ref:`Availability `: Unix, not WASI, not iOS." +msgstr ":ref:`適用 `:Unix、非 WASI。" + +#: ../../library/os.rst:4526 msgid "" "Send signal *sig* to the process *pid*. Constants for the specific signals " "available on the host platform are defined in the :mod:`signal` module." msgstr "" -#: ../../library/os.rst:4242 +#: ../../library/os.rst:4529 msgid "" "Windows: The :const:`signal.CTRL_C_EVENT` and :const:`signal." "CTRL_BREAK_EVENT` signals are special signals which can only be sent to " @@ -4829,11 +5195,11 @@ msgid "" "process handles to be killed." msgstr "" -#: ../../library/os.rst:4250 +#: ../../library/os.rst:4537 msgid "See also :func:`signal.pthread_kill`." msgstr "另請參閱 :func:`signal.pthread_kill`。" -#: ../../library/os.rst:4252 +#: ../../library/os.rst:4539 msgid "" "Raises an :ref:`auditing event ` ``os.kill`` with arguments " "``pid``, ``sig``." @@ -4841,11 +5207,11 @@ msgstr "" "引發一個附帶引數 ``pid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." "kill``。" -#: ../../library/os.rst:4266 +#: ../../library/os.rst:4553 msgid "Send the signal *sig* to the process group *pgid*." msgstr "" -#: ../../library/os.rst:4268 +#: ../../library/os.rst:4555 msgid "" "Raises an :ref:`auditing event ` ``os.killpg`` with arguments " "``pgid``, ``sig``." @@ -4853,27 +5219,27 @@ msgstr "" "引發一個附帶引數 ``pgid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." "killpg``。" -#: ../../library/os.rst:4275 +#: ../../library/os.rst:4562 msgid "" "Add *increment* to the process's \"niceness\". Return the new niceness." msgstr "" -#: ../../library/os.rst:4282 +#: ../../library/os.rst:4569 msgid "" "Return a file descriptor referring to the process *pid* with *flags* set. " "This descriptor can be used to perform process management without races and " "signals." msgstr "" -#: ../../library/os.rst:4286 +#: ../../library/os.rst:4573 msgid "See the :manpage:`pidfd_open(2)` man page for more details." msgstr "更多細節請見 :manpage:`pidfd_open(2)` 手冊頁。" -#: ../../library/os.rst:4288 +#: ../../library/os.rst:4575 msgid ":ref:`Availability `: Linux >= 5.3" msgstr ":ref:`適用 `:Linux 5.3 以上" -#: ../../library/os.rst:4293 +#: ../../library/os.rst:4580 msgid "" "This flag indicates that the file descriptor will be non-blocking. If the " "process referred to by the file descriptor has not yet terminated, then an " @@ -4881,17 +5247,17 @@ msgid "" "immediately return the error :const:`~errno.EAGAIN` rather than blocking." msgstr "" -#: ../../library/os.rst:4298 +#: ../../library/os.rst:4585 msgid ":ref:`Availability `: Linux >= 5.10" msgstr ":ref:`適用 `:Linux 5.10 以上" -#: ../../library/os.rst:4304 +#: ../../library/os.rst:4591 msgid "" "Lock program segments into memory. The value of *op* (defined in ````) determines which segments are locked." msgstr "" -#: ../../library/os.rst:4312 +#: ../../library/os.rst:4599 msgid "" "Open a pipe to or from command *cmd*. The return value is an open file " "object connected to the pipe, which can be read or written depending on " @@ -4901,7 +5267,7 @@ msgid "" "rather than bytes." msgstr "" -#: ../../library/os.rst:4320 +#: ../../library/os.rst:4607 msgid "" "The ``close`` method returns :const:`None` if the subprocess exited " "successfully, or the subprocess's return code if there was an error. On " @@ -4913,60 +5279,62 @@ msgid "" "contains the signed integer return code from the child process." msgstr "" -#: ../../library/os.rst:4330 +#: ../../library/os.rst:4617 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the ``close`` " "method result (exit status) into an exit code if it is not ``None``. On " "Windows, the ``close`` method result is directly the exit code (or ``None``)." msgstr "" -#: ../../library/os.rst:4335 +#: ../../library/os.rst:4622 msgid "" "This is implemented using :class:`subprocess.Popen`; see that class's " "documentation for more powerful ways to manage and communicate with " "subprocesses." msgstr "" -#: ../../library/os.rst:4339 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr ":ref:`適用 `:非 Emscripten、非 WASI。" +#: ../../library/os.rst:4626 +#, fuzzy +msgid ":ref:`Availability `: not WASI, not iOS." +msgstr ":ref:`適用 `:非 WASI。" -#: ../../library/os.rst:4342 +#: ../../library/os.rst:4629 msgid "" "The :ref:`Python UTF-8 Mode ` affects encodings used for *cmd* " "and pipe contents." msgstr "" -#: ../../library/os.rst:4345 +#: ../../library/os.rst:4632 msgid "" ":func:`popen` is a simple wrapper around :class:`subprocess.Popen`. Use :" "class:`subprocess.Popen` or :func:`subprocess.run` to control options like " "encodings." msgstr "" -#: ../../library/os.rst:4354 +#: ../../library/os.rst:4641 msgid "Wraps the :c:func:`!posix_spawn` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4356 +#: ../../library/os.rst:4643 msgid "" "Most users should use :func:`subprocess.run` instead of :func:`posix_spawn`." msgstr "" -#: ../../library/os.rst:4358 +#: ../../library/os.rst:4645 msgid "" "The positional-only arguments *path*, *args*, and *env* are similar to :func:" -"`execve`." +"`execve`. *env* is allowed to be ``None``, in which case current process' " +"environment is used." msgstr "" -#: ../../library/os.rst:4361 +#: ../../library/os.rst:4649 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:4365 +#: ../../library/os.rst:4653 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 " @@ -4975,40 +5343,50 @@ msgid "" "describing the remaining tuple elements:" msgstr "" -#: ../../library/os.rst:4373 +#: ../../library/os.rst:4661 msgid "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" msgstr "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" -#: ../../library/os.rst:4375 +#: ../../library/os.rst:4663 msgid "Performs ``os.dup2(os.open(path, flags, mode), fd)``." msgstr "" -#: ../../library/os.rst:4379 +#: ../../library/os.rst:4667 msgid "(``os.POSIX_SPAWN_CLOSE``, *fd*)" msgstr "(``os.POSIX_SPAWN_CLOSE``, *fd*)" -#: ../../library/os.rst:4381 +#: ../../library/os.rst:4669 msgid "Performs ``os.close(fd)``." msgstr "" -#: ../../library/os.rst:4385 +#: ../../library/os.rst:4673 msgid "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" msgstr "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" -#: ../../library/os.rst:4387 +#: ../../library/os.rst:4675 msgid "Performs ``os.dup2(fd, new_fd)``." msgstr "" -#: ../../library/os.rst:4389 +#: ../../library/os.rst:4679 +#, fuzzy +msgid "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" +msgstr "(``os.POSIX_SPAWN_CLOSE``, *fd*)" + +#: ../../library/os.rst:4681 +msgid "Performs ``os.closerange(fd, INF)``." +msgstr "" + +#: ../../library/os.rst:4683 msgid "" "These tuples correspond to the C library :c:func:`!" "posix_spawn_file_actions_addopen`, :c:func:`!" -"posix_spawn_file_actions_addclose`, and :c:func:`!" -"posix_spawn_file_actions_adddup2` API calls used to prepare for the :c:func:" -"`!posix_spawn` call itself." +"posix_spawn_file_actions_addclose`, :c:func:`!" +"posix_spawn_file_actions_adddup2`, and :c:func:`!" +"posix_spawn_file_actions_addclosefrom_np` API calls used to prepare for the :" +"c:func:`!posix_spawn` call itself." msgstr "" -#: ../../library/os.rst:4395 +#: ../../library/os.rst:4690 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 " @@ -5017,7 +5395,7 @@ msgid "" "corresponds to the C library :c:macro:`!POSIX_SPAWN_SETPGROUP` flag." msgstr "" -#: ../../library/os.rst:4401 +#: ../../library/os.rst:4696 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 " @@ -5028,7 +5406,7 @@ msgid "" "library :c:macro:`!POSIX_SPAWN_RESETIDS` flag." msgstr "" -#: ../../library/os.rst:4409 +#: ../../library/os.rst:4704 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:" @@ -5036,7 +5414,7 @@ msgid "" "is raised." msgstr "" -#: ../../library/os.rst:4414 +#: ../../library/os.rst:4709 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 " @@ -5044,14 +5422,14 @@ msgid "" "POSIX_SPAWN_SETSIGMASK` flag." msgstr "" -#: ../../library/os.rst:4419 +#: ../../library/os.rst:4714 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:4423 +#: ../../library/os.rst:4718 msgid "" "The *scheduler* argument must be a tuple containing the (optional) scheduler " "policy and an instance of :class:`sched_param` with the scheduler " @@ -5061,7 +5439,7 @@ msgid "" "POSIX_SPAWN_SETSCHEDULER` flags." msgstr "" -#: ../../library/os.rst:4430 ../../library/os.rst:4446 +#: ../../library/os.rst:4725 ../../library/os.rst:4746 msgid "" "Raises an :ref:`auditing event ` ``os.posix_spawn`` with arguments " "``path``, ``argv``, ``env``." @@ -5069,72 +5447,79 @@ msgstr "" "引發一個附帶引數 ``path``、``argv``、``env`` 的\\ :ref:`稽核事件 ` " "``os.posix_spawn``。" -#: ../../library/os.rst:4440 +#: ../../library/os.rst:4729 +msgid "" +"*env* parameter accepts ``None``. ``os.POSIX_SPAWN_CLOSEFROM`` is available " +"on platforms where :c:func:`!posix_spawn_file_actions_addclosefrom_np` " +"exists." +msgstr "" + +#: ../../library/os.rst:4740 msgid "Wraps the :c:func:`!posix_spawnp` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4442 +#: ../../library/os.rst:4742 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:4452 +#: ../../library/os.rst:4752 msgid "See :func:`posix_spawn` documentation." msgstr "見 :func:`posix_spawn` 文件。" -#: ../../library/os.rst:4458 +#: ../../library/os.rst:4758 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:4463 +#: ../../library/os.rst:4763 msgid "*before* is a function called before forking a child process." msgstr "" -#: ../../library/os.rst:4464 +#: ../../library/os.rst:4764 msgid "" "*after_in_parent* is a function called from the parent process after forking " "a child process." msgstr "" -#: ../../library/os.rst:4466 +#: ../../library/os.rst:4766 msgid "*after_in_child* is a function called from the child process." msgstr "" -#: ../../library/os.rst:4468 +#: ../../library/os.rst:4768 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:4472 +#: ../../library/os.rst:4772 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:4477 +#: ../../library/os.rst:4777 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:4481 +#: ../../library/os.rst:4781 msgid "There is no way to unregister a function." msgstr "" -#: ../../library/os.rst:4497 +#: ../../library/os.rst:4797 msgid "Execute the program *path* in a new process." msgstr "" -#: ../../library/os.rst:4499 +#: ../../library/os.rst:4799 msgid "" "(Note that the :mod:`subprocess` module provides more powerful facilities " "for spawning new processes and retrieving their results; using that module " @@ -5142,7 +5527,7 @@ msgid "" "`subprocess-replacements` section.)" msgstr "" -#: ../../library/os.rst:4504 +#: ../../library/os.rst:4804 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 " @@ -5151,13 +5536,13 @@ msgid "" "handle, so can be used with the :func:`waitpid` function." msgstr "" -#: ../../library/os.rst:4510 +#: ../../library/os.rst:4810 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:4513 +#: ../../library/os.rst:4813 msgid "" "The \"l\" and \"v\" variants of the :func:`spawn\\* ` functions " "differ in how command-line arguments are passed. The \"l\" variants are " @@ -5169,7 +5554,7 @@ msgid "" "to the child process must start with the name of the command being run." msgstr "" -#: ../../library/os.rst:4522 +#: ../../library/os.rst:4822 msgid "" "The variants which include a second \"p\" near the end (:func:`spawnlp`, :" "func:`spawnlpe`, :func:`spawnvp`, and :func:`spawnvpe`) will use the :envvar:" @@ -5182,7 +5567,7 @@ msgid "" "appropriate absolute or relative path." msgstr "" -#: ../../library/os.rst:4532 +#: ../../library/os.rst:4832 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 " @@ -5194,13 +5579,13 @@ msgid "" "values will cause the function to fail, with a return value of ``127``." msgstr "" -#: ../../library/os.rst:4541 +#: ../../library/os.rst:4841 msgid "" "As an example, the following calls to :func:`spawnlp` and :func:`spawnvpe` " "are equivalent::" msgstr "" -#: ../../library/os.rst:4544 +#: ../../library/os.rst:4844 msgid "" "import os\n" "os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')\n" @@ -5214,7 +5599,7 @@ msgstr "" "L = ['cp', 'index.html', '/dev/null']\n" "os.spawnvpe(os.P_WAIT, 'cp', L, os.environ)" -#: ../../library/os.rst:4550 +#: ../../library/os.rst:4850 msgid "" "Raises an :ref:`auditing event ` ``os.spawn`` with arguments " "``mode``, ``path``, ``args``, ``env``." @@ -5222,7 +5607,7 @@ msgstr "" "引發一個附帶引數 ``mode``、``path``、``args``、``env`` 的\\ :ref:`稽核事件 " "` ``os.spawn``。" -#: ../../library/os.rst:4554 +#: ../../library/os.rst:4854 msgid "" ":func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp` and :func:`spawnvpe` are " "not available on Windows. :func:`spawnle` and :func:`spawnve` are not " @@ -5230,7 +5615,7 @@ msgid "" "instead." msgstr "" -#: ../../library/os.rst:4566 +#: ../../library/os.rst:4866 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If either of these values is given, the :func:" @@ -5238,7 +5623,7 @@ msgid "" "been created, with the process id as the return value." msgstr "" -#: ../../library/os.rst:4576 +#: ../../library/os.rst:4876 msgid "" "Possible value for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If this is given as *mode*, the :func:`spawn\\* " @@ -5247,7 +5632,7 @@ msgid "" "successful, or ``-signal`` if a signal kills the process." msgstr "" -#: ../../library/os.rst:4588 +#: ../../library/os.rst:4888 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. These are less portable than those listed above. :" @@ -5257,11 +5642,11 @@ msgid "" "function will not return." msgstr "" -#: ../../library/os.rst:4599 +#: ../../library/os.rst:4899 msgid "Start a file with its associated application." msgstr "" -#: ../../library/os.rst:4601 +#: ../../library/os.rst:4901 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:" @@ -5269,7 +5654,7 @@ msgid "" "whatever application (if any) its extension is associated." msgstr "" -#: ../../library/os.rst:4606 +#: ../../library/os.rst:4906 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 " @@ -5277,28 +5662,28 @@ msgid "" "as well as ``'explore'`` and ``'find'`` (to be used on directories)." msgstr "" -#: ../../library/os.rst:4611 +#: ../../library/os.rst:4911 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:4615 +#: ../../library/os.rst:4915 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:4619 +#: ../../library/os.rst:4919 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:4623 +#: ../../library/os.rst:4923 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 " @@ -5309,14 +5694,14 @@ msgid "" "encoded for Win32." msgstr "" -#: ../../library/os.rst:4631 +#: ../../library/os.rst:4931 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:4635 +#: ../../library/os.rst:4935 msgid "" "Raises an :ref:`auditing event ` ``os.startfile`` with arguments " "``path``, ``operation``." @@ -5324,7 +5709,7 @@ msgstr "" "引發一個附帶引數 ``path``、``operation`` 的\\ :ref:`稽核事件 ` " "``os.startfile``。" -#: ../../library/os.rst:4637 +#: ../../library/os.rst:4937 msgid "" "Raises an :ref:`auditing event ` ``os.startfile/2`` with arguments " "``path``, ``operation``, ``arguments``, ``cwd``, ``show_cmd``." @@ -5332,13 +5717,13 @@ msgstr "" "引發一個附帶引數 ``path``、``operation``、``arguments``、``cwd``、" "``show_cmd`` 的\\ :ref:`稽核事件 ` ``os.startfile/2``。" -#: ../../library/os.rst:4641 +#: ../../library/os.rst:4941 msgid "" "Added the *arguments*, *cwd* and *show_cmd* arguments, and the ``os." "startfile/2`` audit event." msgstr "" -#: ../../library/os.rst:4648 +#: ../../library/os.rst:4948 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 " @@ -5349,13 +5734,13 @@ msgid "" "value of the Python function is system-dependent." msgstr "" -#: ../../library/os.rst:4656 +#: ../../library/os.rst:4956 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:4659 +#: ../../library/os.rst:4959 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 :" @@ -5364,7 +5749,7 @@ msgid "" "shell documentation." msgstr "" -#: ../../library/os.rst:4665 +#: ../../library/os.rst:4965 msgid "" "The :mod:`subprocess` module provides more powerful facilities for spawning " "new processes and retrieving their results; using that module is preferable " @@ -5372,54 +5757,54 @@ msgid "" "the :mod:`subprocess` documentation for some helpful recipes." msgstr "" -#: ../../library/os.rst:4670 +#: ../../library/os.rst:4970 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:4674 +#: ../../library/os.rst:4974 msgid "" "Raises an :ref:`auditing event ` ``os.system`` with argument " "``command``." msgstr "" "引發一個附帶引數 ``command`` 的\\ :ref:`稽核事件 ` ``os.system``。" -#: ../../library/os.rst:4681 +#: ../../library/os.rst:4981 msgid "" "Returns the current global process times. The return value is an object with " "five attributes:" msgstr "" -#: ../../library/os.rst:4684 +#: ../../library/os.rst:4984 msgid ":attr:`!user` - user time" msgstr ":attr:`!user` - 使用者時間" -#: ../../library/os.rst:4685 +#: ../../library/os.rst:4985 msgid ":attr:`!system` - system time" msgstr ":attr:`!system` - 系統時間" -#: ../../library/os.rst:4686 +#: ../../library/os.rst:4986 msgid ":attr:`!children_user` - user time of all child processes" msgstr ":attr:`!children_user` - 所有子行程的使用者時間" -#: ../../library/os.rst:4687 +#: ../../library/os.rst:4987 msgid ":attr:`!children_system` - system time of all child processes" msgstr ":attr:`!children_system` - 所有子行程的系統時間" -#: ../../library/os.rst:4688 +#: ../../library/os.rst:4988 msgid ":attr:`!elapsed` - elapsed real time since a fixed point in the past" msgstr "" -#: ../../library/os.rst:4690 +#: ../../library/os.rst:4990 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:4694 +#: ../../library/os.rst:4994 msgid "" "See the Unix manual page :manpage:`times(2)` and `times(3) `_ manual page on Unix or `the " @@ -5429,7 +5814,7 @@ msgid "" "attributes are zero." msgstr "" -#: ../../library/os.rst:4708 +#: ../../library/os.rst:5008 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 " @@ -5438,87 +5823,87 @@ msgid "" "if a core file was produced." msgstr "" -#: ../../library/os.rst:4714 +#: ../../library/os.rst:5014 msgid "" "If there are no children that could be waited for, :exc:`ChildProcessError` " "is raised." msgstr "" -#: ../../library/os.rst:4717 ../../library/os.rst:4792 +#: ../../library/os.rst:5017 ../../library/os.rst:5092 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exit code." msgstr "" -#: ../../library/os.rst:4724 +#: ../../library/os.rst:5024 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:4731 +#: ../../library/os.rst:5031 msgid "Wait for the completion of a child process." msgstr "" -#: ../../library/os.rst:4733 +#: ../../library/os.rst:5033 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:4736 +#: ../../library/os.rst:5036 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:4740 +#: ../../library/os.rst:5040 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:4743 +#: ../../library/os.rst:5043 msgid ":attr:`!si_pid` (process ID)" msgstr "" -#: ../../library/os.rst:4744 +#: ../../library/os.rst:5044 msgid ":attr:`!si_uid` (real user ID of the child)" msgstr "" -#: ../../library/os.rst:4745 +#: ../../library/os.rst:5045 msgid ":attr:`!si_signo` (always :const:`~signal.SIGCHLD`)" msgstr "" -#: ../../library/os.rst:4746 +#: ../../library/os.rst:5046 msgid "" ":attr:`!si_status` (the exit status or signal number, depending on :attr:`!" "si_code`)" msgstr "" -#: ../../library/os.rst:4747 +#: ../../library/os.rst:5047 msgid ":attr:`!si_code` (see :data:`CLD_EXITED` for possible values)" msgstr "" -#: ../../library/os.rst:4749 +#: ../../library/os.rst:5049 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:4757 -msgid "This function is not available on macOS." +#: ../../library/os.rst:5058 +msgid "This function is now available on macOS as well." msgstr "" -#: ../../library/os.rst:4764 +#: ../../library/os.rst:5064 msgid "The details of this function differ on Unix and Windows." msgstr "" -#: ../../library/os.rst:4766 +#: ../../library/os.rst:5066 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 " @@ -5527,7 +5912,7 @@ msgid "" "operation." msgstr "" -#: ../../library/os.rst:4771 +#: ../../library/os.rst:5071 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 " @@ -5537,7 +5922,7 @@ msgid "" "group ``-pid`` (the absolute value of *pid*)." msgstr "" -#: ../../library/os.rst:4778 +#: ../../library/os.rst:5078 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 " @@ -5546,7 +5931,7 @@ msgid "" "are :data:`WUNTRACED` and :data:`WCONTINUED`." msgstr "" -#: ../../library/os.rst:4784 +#: ../../library/os.rst:5084 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 " @@ -5558,7 +5943,7 @@ msgid "" "process handles." msgstr "" -#: ../../library/os.rst:4805 +#: ../../library/os.rst:5105 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 " @@ -5567,13 +5952,13 @@ msgid "" "same as that provided to :func:`waitpid` and :func:`wait4`." msgstr "" -#: ../../library/os.rst:4812 ../../library/os.rst:4826 +#: ../../library/os.rst:5112 ../../library/os.rst:5126 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exitcode." msgstr "" -#: ../../library/os.rst:4820 +#: ../../library/os.rst:5120 msgid "" "Similar to :func:`waitpid`, except a 3-element tuple, containing the child's " "process id, exit status indication, and resource usage information is " @@ -5582,118 +5967,118 @@ msgid "" "to :func:`waitpid`." msgstr "" -#: ../../library/os.rst:4837 +#: ../../library/os.rst:5137 msgid "" "These are the possible values for *idtype* in :func:`waitid`. They affect " "how *id* is interpreted:" msgstr "" -#: ../../library/os.rst:4840 +#: ../../library/os.rst:5140 msgid ":data:`!P_PID` - wait for the child whose PID is *id*." msgstr "" -#: ../../library/os.rst:4841 +#: ../../library/os.rst:5141 msgid ":data:`!P_PGID` - wait for any child whose progress group ID is *id*." msgstr "" -#: ../../library/os.rst:4842 +#: ../../library/os.rst:5142 msgid ":data:`!P_ALL` - wait for any child; *id* is ignored." msgstr "" -#: ../../library/os.rst:4843 +#: ../../library/os.rst:5143 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:4848 +#: ../../library/os.rst:5148 msgid ":data:`!P_PIDFD` is only available on Linux >= 5.4." msgstr "" -#: ../../library/os.rst:4851 +#: ../../library/os.rst:5151 msgid "The :data:`!P_PIDFD` constant." msgstr "" -#: ../../library/os.rst:4857 +#: ../../library/os.rst:5157 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:4866 +#: ../../library/os.rst:5166 msgid "" "This *options* flag for :func:`waitid` causes child processes that have " "terminated to be reported." msgstr "" -#: ../../library/os.rst:4869 +#: ../../library/os.rst:5169 msgid "" "The other ``wait*`` functions always report children that have terminated, " "so this option is not available for them." msgstr "" -#: ../../library/os.rst:4879 +#: ../../library/os.rst:5179 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:4882 ../../library/os.rst:4914 +#: ../../library/os.rst:5182 ../../library/os.rst:5214 msgid "This option is not available for the other ``wait*`` functions." msgstr "" -#: ../../library/os.rst:4891 +#: ../../library/os.rst:5191 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:4895 +#: ../../library/os.rst:5195 msgid "This option is not available for :func:`waitid`." msgstr "" -#: ../../library/os.rst:4902 +#: ../../library/os.rst:5202 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:4911 +#: ../../library/os.rst:5211 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:4926 +#: ../../library/os.rst:5226 msgid "" "These are the possible values for :attr:`!si_code` in the result returned " "by :func:`waitid`." msgstr "" -#: ../../library/os.rst:4933 +#: ../../library/os.rst:5233 msgid "Added :data:`CLD_KILLED` and :data:`CLD_STOPPED` values." msgstr "" -#: ../../library/os.rst:4939 +#: ../../library/os.rst:5239 msgid "Convert a wait status to an exit code." msgstr "" -#: ../../library/os.rst:4941 +#: ../../library/os.rst:5241 msgid "On Unix:" msgstr "" -#: ../../library/os.rst:4943 +#: ../../library/os.rst:5243 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:4946 +#: ../../library/os.rst:5246 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 " @@ -5701,15 +6086,15 @@ msgid "" "than 0." msgstr "" -#: ../../library/os.rst:4950 +#: ../../library/os.rst:5250 msgid "Otherwise, raise a :exc:`ValueError`." msgstr "" -#: ../../library/os.rst:4952 +#: ../../library/os.rst:5252 msgid "On Windows, return *status* shifted right by 8 bits." msgstr "" -#: ../../library/os.rst:4954 +#: ../../library/os.rst:5254 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 " @@ -5717,221 +6102,226 @@ msgid "" "``WIFSTOPPED(status)`` is true." msgstr "" -#: ../../library/os.rst:4961 +#: ../../library/os.rst:5261 msgid "" ":func:`WIFEXITED`, :func:`WEXITSTATUS`, :func:`WIFSIGNALED`, :func:" "`WTERMSIG`, :func:`WIFSTOPPED`, :func:`WSTOPSIG` functions." msgstr "" -#: ../../library/os.rst:4969 +#: ../../library/os.rst:5269 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:4975 +#: ../../library/os.rst:5275 msgid "" "Return ``True`` if a core dump was generated for the process, otherwise " "return ``False``." msgstr "" -#: ../../library/os.rst:4978 ../../library/os.rst:5044 +#: ../../library/os.rst:5278 ../../library/os.rst:5344 msgid "This function should be employed only if :func:`WIFSIGNALED` is true." msgstr "" -#: ../../library/os.rst:4985 +#: ../../library/os.rst:5285 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:4989 +#: ../../library/os.rst:5289 msgid "See :data:`WCONTINUED` option." msgstr "參閱 :data:`WCONTINUED` 選項。" -#: ../../library/os.rst:4996 +#: ../../library/os.rst:5296 msgid "" "Return ``True`` if the process was stopped by delivery of a signal, " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:4999 +#: ../../library/os.rst:5299 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:5007 +#: ../../library/os.rst:5307 msgid "" "Return ``True`` if the process was terminated by a signal, otherwise return " "``False``." msgstr "" -#: ../../library/os.rst:5015 +#: ../../library/os.rst:5315 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:5024 +#: ../../library/os.rst:5324 msgid "Return the process exit status." msgstr "" -#: ../../library/os.rst:5026 +#: ../../library/os.rst:5326 msgid "This function should be employed only if :func:`WIFEXITED` is true." msgstr "" -#: ../../library/os.rst:5033 +#: ../../library/os.rst:5333 msgid "Return the signal which caused the process to stop." msgstr "" -#: ../../library/os.rst:5035 +#: ../../library/os.rst:5335 msgid "This function should be employed only if :func:`WIFSTOPPED` is true." msgstr "" -#: ../../library/os.rst:5042 +#: ../../library/os.rst:5342 msgid "Return the number of the signal that caused the process to terminate." msgstr "" -#: ../../library/os.rst:5050 +#: ../../library/os.rst:5350 msgid "Interface to the scheduler" msgstr "" -#: ../../library/os.rst:5052 +#: ../../library/os.rst:5352 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:5058 +#: ../../library/os.rst:5358 msgid "" "The following scheduling policies are exposed if they are supported by the " "operating system." msgstr "" -#: ../../library/os.rst:5063 +#: ../../library/os.rst:5363 msgid "The default scheduling policy." msgstr "" -#: ../../library/os.rst:5067 +#: ../../library/os.rst:5367 msgid "" "Scheduling policy for CPU-intensive processes that tries to preserve " "interactivity on the rest of the computer." msgstr "" -#: ../../library/os.rst:5072 +#: ../../library/os.rst:5372 msgid "Scheduling policy for extremely low priority background tasks." msgstr "" -#: ../../library/os.rst:5076 +#: ../../library/os.rst:5376 msgid "Scheduling policy for sporadic server programs." msgstr "" -#: ../../library/os.rst:5080 +#: ../../library/os.rst:5380 msgid "A First In First Out scheduling policy." msgstr "" -#: ../../library/os.rst:5084 +#: ../../library/os.rst:5384 msgid "A round-robin scheduling policy." msgstr "" -#: ../../library/os.rst:5088 +#: ../../library/os.rst:5388 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:5095 +#: ../../library/os.rst:5395 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:5099 +#: ../../library/os.rst:5399 msgid "At the moment, there is only one possible parameter:" msgstr "" -#: ../../library/os.rst:5103 +#: ../../library/os.rst:5403 msgid "The scheduling priority for a scheduling policy." msgstr "" -#: ../../library/os.rst:5108 +#: ../../library/os.rst:5408 msgid "" "Get the minimum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5114 +#: ../../library/os.rst:5414 msgid "" "Get the maximum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5120 +#: ../../library/os.rst:5420 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:5127 +#: ../../library/os.rst:5427 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:5134 +#: ../../library/os.rst:5434 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:5140 +#: ../../library/os.rst:5440 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:5146 +#: ../../library/os.rst:5446 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:5152 +#: ../../library/os.rst:5452 msgid "Voluntarily relinquish the CPU." msgstr "" -#: ../../library/os.rst:5157 +#: ../../library/os.rst:5457 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:5164 +#: ../../library/os.rst:5464 msgid "Return the set of CPUs the process with PID *pid* is restricted to." msgstr "" -#: ../../library/os.rst:5166 +#: ../../library/os.rst:5466 msgid "" "If *pid* is zero, return the set of CPUs the calling thread of the current " "process is restricted to." msgstr "" -#: ../../library/os.rst:5173 +#: ../../library/os.rst:5469 +#, fuzzy +msgid "See also the :func:`process_cpu_count` function." +msgstr ":func:`~os.setns` 函式。" + +#: ../../library/os.rst:5475 msgid "Miscellaneous System Information" msgstr "" -#: ../../library/os.rst:5178 +#: ../../library/os.rst:5480 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 " @@ -5942,13 +6332,13 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:5186 +#: ../../library/os.rst:5488 msgid "" "If the configuration value specified by *name* isn't defined, ``None`` is " "returned." msgstr "" -#: ../../library/os.rst:5189 +#: ../../library/os.rst:5491 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 " @@ -5956,34 +6346,63 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:5199 +#: ../../library/os.rst:5501 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:5208 +#: ../../library/os.rst:5510 msgid "" -"Return the number of logical CPUs in the system. Returns ``None`` if " +"Return the number of logical CPUs in the **system**. Returns ``None`` if " "undetermined." msgstr "" -#: ../../library/os.rst:5211 +#: ../../library/os.rst:5513 +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:5518 msgid "" -"This number is not equivalent to the number of logical CPUs the current " -"process can use. ``len(os.sched_getaffinity(0))`` gets the number of logical " -"CPUs the calling thread of the current process is restricted to" +"If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " +"set, :func:`cpu_count` returns the overridden value *n*." msgstr "" -#: ../../library/os.rst:5220 +#: ../../library/os.rst:5525 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:5229 +#: ../../library/os.rst:5534 +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:5538 +msgid "" +"The :func:`cpu_count` function can be used to get the number of logical CPUs " +"in the **system**." +msgstr "" + +#: ../../library/os.rst:5541 +msgid "" +"If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " +"set, :func:`process_cpu_count` returns the overridden value *n*." +msgstr "" + +#: ../../library/os.rst:5544 +#, fuzzy +msgid "See also the :func:`sched_getaffinity` functions." +msgstr ":func:`~os.setns` 函式。" + +#: ../../library/os.rst:5551 msgid "" "Return integer-valued system configuration values. If the configuration " "value specified by *name* isn't defined, ``-1`` is returned. The comments " @@ -5992,44 +6411,44 @@ msgid "" "``sysconf_names``." msgstr "" -#: ../../library/os.rst:5239 +#: ../../library/os.rst:5561 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:5245 +#: ../../library/os.rst:5567 msgid "Add ``'SC_MINSIGSTKSZ'`` name." msgstr "" -#: ../../library/os.rst:5248 +#: ../../library/os.rst:5570 msgid "" "The following data values are used to support path manipulation operations. " "These are defined for all platforms." msgstr "" -#: ../../library/os.rst:5251 +#: ../../library/os.rst:5573 msgid "" "Higher-level operations on pathnames are defined in the :mod:`os.path` " "module." msgstr "" -#: ../../library/os.rst:5257 +#: ../../library/os.rst:5579 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:5265 +#: ../../library/os.rst:5587 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:5274 +#: ../../library/os.rst:5596 msgid "" "The character used by the operating system to separate pathname components. " "This is ``'/'`` for POSIX and ``'\\\\'`` for Windows. Note that knowing " @@ -6038,7 +6457,7 @@ msgid "" "useful. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5284 +#: ../../library/os.rst:5606 msgid "" "An alternative character used by the operating system to separate pathname " "components, or ``None`` if only one separator character exists. This is set " @@ -6046,27 +6465,27 @@ msgid "" "via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5293 +#: ../../library/os.rst:5615 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:5301 +#: ../../library/os.rst:5623 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:5308 +#: ../../library/os.rst:5630 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:5315 +#: ../../library/os.rst:5637 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 " @@ -6075,36 +6494,36 @@ msgid "" "default); use a single ``'\\n'`` instead, on all platforms." msgstr "" -#: ../../library/os.rst:5324 +#: ../../library/os.rst:5646 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:5335 +#: ../../library/os.rst:5657 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:5343 +#: ../../library/os.rst:5665 msgid "Random numbers" msgstr "" -#: ../../library/os.rst:5348 +#: ../../library/os.rst:5670 msgid "" "Get up to *size* random bytes. The function can return less bytes than " "requested." msgstr "" -#: ../../library/os.rst:5351 +#: ../../library/os.rst:5673 msgid "" "These bytes can be used to seed user-space random number generators or for " "cryptographic purposes." msgstr "" -#: ../../library/os.rst:5354 +#: ../../library/os.rst:5676 msgid "" "``getrandom()`` relies on entropy gathered from device drivers and other " "sources of environmental noise. Unnecessarily reading large quantities of " @@ -6112,36 +6531,36 @@ msgid "" "``/dev/urandom`` devices." msgstr "" -#: ../../library/os.rst:5359 +#: ../../library/os.rst:5681 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:5363 +#: ../../library/os.rst:5685 msgid "" "See also the `Linux getrandom() manual page `_." msgstr "" -#: ../../library/os.rst:5366 +#: ../../library/os.rst:5688 msgid ":ref:`Availability `: Linux >= 3.17." msgstr ":ref:`適用 `:Linux 3.17 以上。" -#: ../../library/os.rst:5372 +#: ../../library/os.rst:5694 msgid "" "Return a bytestring of *size* random bytes suitable for cryptographic use." msgstr "" -#: ../../library/os.rst:5374 +#: ../../library/os.rst:5696 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:5378 +#: ../../library/os.rst:5700 msgid "" "On Linux, if the ``getrandom()`` syscall is available, it is used in " "blocking mode: block until the system urandom entropy pool is initialized " @@ -6151,63 +6570,63 @@ msgid "" "to poll until the system urandom entropy pool is initialized." msgstr "" -#: ../../library/os.rst:5385 +#: ../../library/os.rst:5707 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:5389 +#: ../../library/os.rst:5711 msgid "On Windows, it will use ``BCryptGenRandom()``." msgstr "" -#: ../../library/os.rst:5392 +#: ../../library/os.rst:5714 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:5396 +#: ../../library/os.rst:5718 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:5402 +#: ../../library/os.rst:5724 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:5406 +#: ../../library/os.rst:5728 msgid "" "On Linux, ``getrandom()`` is now used in blocking mode to increase the " "security." msgstr "" -#: ../../library/os.rst:5410 +#: ../../library/os.rst:5732 msgid "" "On Windows, ``BCryptGenRandom()`` is used instead of ``CryptGenRandom()`` " "which is deprecated." msgstr "" -#: ../../library/os.rst:5416 +#: ../../library/os.rst:5738 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:5420 +#: ../../library/os.rst:5742 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:5427 +#: ../../library/os.rst:5749 msgid "" "If this bit is set, then random bytes are drawn from the ``/dev/" "random`` pool instead of the ``/dev/urandom`` pool." @@ -6223,7 +6642,7 @@ msgstr "" #: ../../library/os.rst:372 ../../library/os.rst:438 ../../library/os.rst:447 #: ../../library/os.rst:456 ../../library/os.rst:470 ../../library/os.rst:666 -#: ../../library/os.rst:4235 ../../library/os.rst:4262 +#: ../../library/os.rst:4522 ../../library/os.rst:4549 msgid "process" msgstr "process" @@ -6243,7 +6662,7 @@ msgstr "" msgid "scheduling priority" msgstr "scheduling priority(排程優先權)" -#: ../../library/os.rst:552 ../../library/os.rst:796 +#: ../../library/os.rst:552 ../../library/os.rst:801 msgid "environment variables" msgstr "environment variables(環境變數)" @@ -6263,94 +6682,106 @@ msgstr "gethostname()(於 socket 模組)" msgid "gethostbyaddr() (in module socket)" msgstr "gethostbyaddr()(於 socket 模組)" -#: ../../library/os.rst:796 ../../library/os.rst:2584 +#: ../../library/os.rst:801 ../../library/os.rst:2658 msgid "deleting" msgstr "deleting(刪除)" -#: ../../library/os.rst:1338 ../../library/os.rst:2954 +#: ../../library/os.rst:1360 ../../library/os.rst:3028 msgid "module" msgstr "module(模組)" -#: ../../library/os.rst:1338 +#: ../../library/os.rst:1360 msgid "pty" msgstr "pty" -#: ../../library/os.rst:1979 ../../library/os.rst:2383 -#: ../../library/os.rst:2584 ../../library/os.rst:3488 -#: ../../library/os.rst:3587 +#: ../../library/os.rst:2045 ../../library/os.rst:2457 +#: ../../library/os.rst:2658 ../../library/os.rst:3562 +#: ../../library/os.rst:3661 msgid "directory" msgstr "directory(目錄)" -#: ../../library/os.rst:1979 +#: ../../library/os.rst:2045 msgid "changing" msgstr "changing(改變)" -#: ../../library/os.rst:2383 +#: ../../library/os.rst:2457 msgid "creating" msgstr "creating(建立)" -#: ../../library/os.rst:2383 +#: ../../library/os.rst:2457 msgid "UNC paths" msgstr "UNC paths(UNC 路徑)" -#: ../../library/os.rst:2383 +#: ../../library/os.rst:2457 msgid "and os.makedirs()" msgstr "以及 os.makedirs()" -#: ../../library/os.rst:2954 +#: ../../library/os.rst:3028 msgid "stat" msgstr "stat" -#: ../../library/os.rst:3488 ../../library/os.rst:3587 +#: ../../library/os.rst:3562 ../../library/os.rst:3661 msgid "walking" msgstr "" -#: ../../library/os.rst:3488 ../../library/os.rst:3587 +#: ../../library/os.rst:3562 ../../library/os.rst:3661 msgid "traversal" msgstr "traversal(遍歷)" -#: ../../library/os.rst:4235 ../../library/os.rst:4262 +#: ../../library/os.rst:4522 ../../library/os.rst:4549 msgid "killing" msgstr "" -#: ../../library/os.rst:4235 ../../library/os.rst:4262 +#: ../../library/os.rst:4522 ../../library/os.rst:4549 msgid "signalling" msgstr "signalling(信號)" -#: ../../library/os.rst:5254 ../../library/os.rst:5290 +#: ../../library/os.rst:5576 ../../library/os.rst:5612 msgid ". (dot)" msgstr ". (點)" -#: ../../library/os.rst:5254 ../../library/os.rst:5262 -#: ../../library/os.rst:5270 ../../library/os.rst:5281 -#: ../../library/os.rst:5290 +#: ../../library/os.rst:5576 ../../library/os.rst:5584 +#: ../../library/os.rst:5592 ../../library/os.rst:5603 +#: ../../library/os.rst:5612 msgid "in pathnames" msgstr "於 pathnames(路徑名稱)中" -#: ../../library/os.rst:5262 +#: ../../library/os.rst:5584 msgid ".." msgstr ".." -#: ../../library/os.rst:5270 ../../library/os.rst:5281 +#: ../../library/os.rst:5592 ../../library/os.rst:5603 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../library/os.rst:5271 +#: ../../library/os.rst:5593 msgid "\\ (backslash)" msgstr "\\ (反斜線)" -#: ../../library/os.rst:5271 +#: ../../library/os.rst:5593 msgid "in pathnames (Windows)" msgstr "in pathnames (Windows)(在路徑名稱中 (Windows))" -#: ../../library/os.rst:5297 +#: ../../library/os.rst:5619 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/os.rst:5297 +#: ../../library/os.rst:5619 msgid "path separator (POSIX)" msgstr "path separator (POSIX)(路徑分隔器 (POSIX))" -#: ../../library/os.rst:5297 +#: ../../library/os.rst:5619 msgid "; (semicolon)" msgstr "; (分號)" + +#~ msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +#~ msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" + +#~ msgid ":ref:`Availability `: Unix, not Emscripten." +#~ msgstr ":ref:`適用 `:Unix、非 Emscripten。" + +#~ msgid ":ref:`Availability `: Unix, Windows, not Emscripten." +#~ msgstr ":ref:`適用 `:Unix、Windows、非 Emscripten。" + +#~ msgid ":ref:`Availability `: not Emscripten, not WASI." +#~ msgstr ":ref:`適用 `:非 Emscripten、非 WASI。" diff --git a/library/pathlib.po b/library/pathlib.po index 08d2f54ae4..43323de507 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-02-29 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,7 +23,8 @@ msgid ":mod:`!pathlib` --- Object-oriented filesystem paths" msgstr ":mod:`!pathlib` --- 物件導向檔案系統路徑" #: ../../library/pathlib.rst:9 -msgid "**Source code:** :source:`Lib/pathlib.py`" +#, fuzzy +msgid "**Source code:** :source:`Lib/pathlib/`" msgstr "**原始碼:**\\ :source:`Lib/pathlib.py`" #: ../../library/pathlib.rst:15 @@ -186,11 +187,22 @@ msgstr "" "...\n" "'#!/bin/bash\\n'" -#: ../../library/pathlib.rst:99 +#: ../../library/pathlib.rst:97 +#, fuzzy +msgid "Exceptions" +msgstr "operations(操作)" + +#: ../../library/pathlib.rst:101 +msgid "" +"An exception inheriting :exc:`NotImplementedError` that is raised when an " +"unsupported operation is called on a path object." +msgstr "" + +#: ../../library/pathlib.rst:110 msgid "Pure paths" msgstr "純路徑" -#: ../../library/pathlib.rst:101 +#: ../../library/pathlib.rst:112 msgid "" "Pure path objects provide path-handling operations which don't actually " "access a filesystem. There are three ways to access these classes, which we " @@ -199,7 +211,7 @@ msgstr "" "純路徑物件提供處理路徑的操作,實際上不會存取檔案系統。有三種方式可以存取這些" "類別,我們也稱之為\\ *類型 (flavours)*:" -#: ../../library/pathlib.rst:107 +#: ../../library/pathlib.rst:118 msgid "" "A generic class that represents the system's path flavour (instantiating it " "creates either a :class:`PurePosixPath` or a :class:`PureWindowsPath`)::" @@ -207,13 +219,13 @@ msgstr "" "一個通用的類別,表示系統的路徑類型(實例化時會建立一個 :class:" "`PurePosixPath` 或 :class:`PureWindowsPath`): ::" -#: ../../library/pathlib.rst:110 +#: ../../library/pathlib.rst:121 msgid "" ">>> PurePath('setup.py') # Running on a Unix machine\n" "PurePosixPath('setup.py')" msgstr "" -#: ../../library/pathlib.rst:113 +#: ../../library/pathlib.rst:124 msgid "" "Each element of *pathsegments* can be either a string representing a path " "segment, or an object implementing the :class:`os.PathLike` interface where " @@ -224,7 +236,7 @@ msgstr "" "個物件,它實作了 :class:`os.PathLike` 介面且其中的 :meth:`~os.PathLike." "__fspath__` 方法會回傳字串,就像是另一個路徑物件: ::" -#: ../../library/pathlib.rst:118 +#: ../../library/pathlib.rst:129 msgid "" ">>> PurePath('foo', 'some/path', 'bar')\n" "PurePosixPath('foo/some/path/bar')\n" @@ -236,11 +248,11 @@ msgstr "" ">>> PurePath(Path('foo'), Path('bar'))\n" "PurePosixPath('foo/bar')" -#: ../../library/pathlib.rst:123 +#: ../../library/pathlib.rst:134 msgid "When *pathsegments* is empty, the current directory is assumed::" msgstr "當沒有給 *pathsegments* 的時候,會假設是目前的目錄: ::" -#: ../../library/pathlib.rst:125 +#: ../../library/pathlib.rst:136 msgid "" ">>> PurePath()\n" "PurePosixPath('.')" @@ -248,7 +260,7 @@ msgstr "" ">>> PurePath()\n" "PurePosixPath('.')" -#: ../../library/pathlib.rst:128 +#: ../../library/pathlib.rst:139 msgid "" "If a segment is an absolute path, all previous segments are ignored (like :" "func:`os.path.join`)::" @@ -256,7 +268,7 @@ msgstr "" "如果一個片段是絕對路徑,則所有之前的片段會被忽略(類似 :func:`os.path." "join`): ::" -#: ../../library/pathlib.rst:131 +#: ../../library/pathlib.rst:142 msgid "" ">>> PurePath('/etc', '/usr', 'lib64')\n" "PurePosixPath('/usr/lib64')\n" @@ -268,7 +280,7 @@ msgstr "" ">>> PureWindowsPath('c:/Windows', 'd:bar')\n" "PureWindowsPath('d:bar')" -#: ../../library/pathlib.rst:136 +#: ../../library/pathlib.rst:147 msgid "" "On Windows, the drive is not reset when a rooted relative path segment (e." "g., ``r'\\foo'``) is encountered::" @@ -276,7 +288,7 @@ msgstr "" "在 Windows 系統上,當遇到具有根目錄的相對路徑片段(例如 ``r'\\foo'``)時,磁" "碟機 (drive) 部分不會被重置: ::" -#: ../../library/pathlib.rst:139 +#: ../../library/pathlib.rst:150 msgid "" ">>> PureWindowsPath('c:/Windows', '/Program Files')\n" "PureWindowsPath('c:/Program Files')" @@ -284,7 +296,7 @@ msgstr "" ">>> PureWindowsPath('c:/Windows', '/Program Files')\n" "PureWindowsPath('c:/Program Files')" -#: ../../library/pathlib.rst:142 +#: ../../library/pathlib.rst:153 msgid "" "Spurious slashes and single dots are collapsed, but double dots (``'..'``) " "and leading double slashes (``'//'``) are not, since this would change the " @@ -294,7 +306,7 @@ msgstr "" "被合併,因為這樣會因為各種原因改變路徑的意義(例如符號連結 (symbolic links)、" "UNC 路徑): ::" -#: ../../library/pathlib.rst:146 +#: ../../library/pathlib.rst:157 msgid "" ">>> PurePath('foo//bar')\n" "PurePosixPath('foo/bar')\n" @@ -314,7 +326,7 @@ msgstr "" ">>> PurePath('foo/../bar')\n" "PurePosixPath('foo/../bar')" -#: ../../library/pathlib.rst:155 +#: ../../library/pathlib.rst:166 msgid "" "(a naïve approach would make ``PurePosixPath('foo/../bar')`` equivalent to " "``PurePosixPath('bar')``, which is wrong if ``foo`` is a symbolic link to " @@ -323,7 +335,7 @@ msgstr "" "(一個使得 ``PurePosixPath('foo/../bar')`` 等同於 ``PurePosixPath('bar')`` 的" "單純方法,但如果 ``foo`` 是指到另一個目錄的符號連結,就會是錯誤的。)" -#: ../../library/pathlib.rst:159 +#: ../../library/pathlib.rst:170 msgid "" "Pure path objects implement the :class:`os.PathLike` interface, allowing " "them to be used anywhere the interface is accepted." @@ -331,18 +343,18 @@ msgstr "" "純路徑物件實作了 :class:`os.PathLike` 介面,使得它們可以在任何接受該介面的地" "方使用。" -#: ../../library/pathlib.rst:162 +#: ../../library/pathlib.rst:173 msgid "Added support for the :class:`os.PathLike` interface." msgstr "新增了對於 :class:`os.PathLike` 介面的支援。" -#: ../../library/pathlib.rst:167 +#: ../../library/pathlib.rst:178 msgid "" "A subclass of :class:`PurePath`, this path flavour represents non-Windows " "filesystem paths::" msgstr "" ":class:`PurePath` 的一個子類別,該路徑類型表示非 Windows 檔案系統的路徑: ::" -#: ../../library/pathlib.rst:170 +#: ../../library/pathlib.rst:181 msgid "" ">>> PurePosixPath('/etc/hosts')\n" "PurePosixPath('/etc/hosts')" @@ -350,13 +362,13 @@ msgstr "" ">>> PurePosixPath('/etc/hosts')\n" "PurePosixPath('/etc/hosts')" -#: ../../library/pathlib.rst:173 ../../library/pathlib.rst:185 -#: ../../library/pathlib.rst:758 ../../library/pathlib.rst:768 -#: ../../library/pathlib.rst:778 +#: ../../library/pathlib.rst:184 ../../library/pathlib.rst:196 +#: ../../library/pathlib.rst:766 ../../library/pathlib.rst:776 +#: ../../library/pathlib.rst:791 msgid "*pathsegments* is specified similarly to :class:`PurePath`." msgstr "*pathsegments* 的指定方式與 :class:`PurePath` 類似。" -#: ../../library/pathlib.rst:177 +#: ../../library/pathlib.rst:188 msgid "" "A subclass of :class:`PurePath`, this path flavour represents Windows " "filesystem paths, including `UNC paths`_::" @@ -364,7 +376,7 @@ msgstr "" ":class:`PurePath` 的一個子類別,該路徑類型表示 Windows 檔案系統的路徑,包括 " "`UNC paths`_: ::" -#: ../../library/pathlib.rst:180 +#: ../../library/pathlib.rst:191 msgid "" ">>> PureWindowsPath('c:/', 'Users', 'Ximénez')\n" "PureWindowsPath('c:/Users/Ximénez')\n" @@ -376,7 +388,7 @@ msgstr "" ">>> PureWindowsPath('//server/share/file')\n" "PureWindowsPath('//server/share/file')" -#: ../../library/pathlib.rst:189 +#: ../../library/pathlib.rst:200 msgid "" "Regardless of the system you're running on, you can instantiate all of these " "classes, since they don't provide any operation that does system calls." @@ -384,11 +396,11 @@ msgstr "" "不論你使用的是什麼系統,你都可以實例化這些類別,因為它們不提供任何涉及系統呼" "叫的操作。" -#: ../../library/pathlib.rst:194 +#: ../../library/pathlib.rst:205 msgid "General properties" msgstr "通用屬性" -#: ../../library/pathlib.rst:196 +#: ../../library/pathlib.rst:207 msgid "" "Paths are immutable and :term:`hashable`. Paths of a same flavour are " "comparable and orderable. These properties respect the flavour's case-" @@ -397,7 +409,7 @@ msgstr "" "路徑物件是不可變 (immutable) 且可雜湊 (:term:`hashable`) 的。相同類型的路徑物" "件可以被比較和排序。這些屬性遵守該類型的大小寫語意規則: ::" -#: ../../library/pathlib.rst:200 +#: ../../library/pathlib.rst:211 msgid "" ">>> PurePosixPath('foo') == PurePosixPath('FOO')\n" "False\n" @@ -417,11 +429,11 @@ msgstr "" ">>> PureWindowsPath('C:') < PureWindowsPath('d:')\n" "True" -#: ../../library/pathlib.rst:209 +#: ../../library/pathlib.rst:220 msgid "Paths of a different flavour compare unequal and cannot be ordered::" msgstr "不同類型的路徑物件在比較時視為不相等且無法被排序: ::" -#: ../../library/pathlib.rst:211 +#: ../../library/pathlib.rst:222 msgid "" ">>> PureWindowsPath('foo') == PurePosixPath('foo')\n" "False\n" @@ -439,11 +451,11 @@ msgstr "" "TypeError: '<' not supported between instances of 'PureWindowsPath' and " "'PurePosixPath'" -#: ../../library/pathlib.rst:220 +#: ../../library/pathlib.rst:231 msgid "Operators" msgstr "運算子" -#: ../../library/pathlib.rst:222 +#: ../../library/pathlib.rst:233 msgid "" "The slash operator helps create child paths, like :func:`os.path.join`. If " "the argument is an absolute path, the previous path is ignored. On Windows, " @@ -454,7 +466,7 @@ msgstr "" "一樣。如果引數是絕對路徑,則忽略前一個路徑。在 Windows 系統上,當引數是具有根" "目錄的相對路徑(例如,``r'\\foo'``),磁碟機部分不會被重置: ::" -#: ../../library/pathlib.rst:227 +#: ../../library/pathlib.rst:238 msgid "" ">>> p = PurePath('/etc')\n" ">>> p\n" @@ -482,14 +494,14 @@ msgstr "" ">>> PureWindowsPath('c:/Windows', '/Program Files')\n" "PureWindowsPath('c:/Program Files')" -#: ../../library/pathlib.rst:240 +#: ../../library/pathlib.rst:251 msgid "" "A path object can be used anywhere an object implementing :class:`os." "PathLike` is accepted::" msgstr "" "路徑物件可以被用在任何可以接受實作 :class:`os.PathLike` 的物件的地方: ::" -#: ../../library/pathlib.rst:243 +#: ../../library/pathlib.rst:254 msgid "" ">>> import os\n" ">>> p = PurePath('/etc')\n" @@ -501,7 +513,7 @@ msgstr "" ">>> os.fspath(p)\n" "'/etc'" -#: ../../library/pathlib.rst:248 +#: ../../library/pathlib.rst:259 msgid "" "The string representation of a path is the raw filesystem path itself (in " "native form, e.g. with backslashes under Windows), which you can pass to any " @@ -510,7 +522,7 @@ msgstr "" "路徑的字串表示是原始的檔案系統路徑本身(以原生的形式,例如在 Windows 下是反斜" "線),你可以將其傳入任何將檔案路徑當作字串傳入的函式: ::" -#: ../../library/pathlib.rst:252 +#: ../../library/pathlib.rst:263 msgid "" ">>> p = PurePath('/etc')\n" ">>> str(p)\n" @@ -526,7 +538,7 @@ msgstr "" ">>> str(p)\n" "'c:\\\\Program Files'" -#: ../../library/pathlib.rst:259 +#: ../../library/pathlib.rst:270 msgid "" "Similarly, calling :class:`bytes` on a path gives the raw filesystem path as " "a bytes object, as encoded by :func:`os.fsencode`::" @@ -534,7 +546,7 @@ msgstr "" "類似地,對路徑呼叫 :class:`bytes` 會得到原始檔案系統路徑的 bytes 物件,就像使" "用 :func:`os.fsencode` 編碼過的一樣: ::" -#: ../../library/pathlib.rst:262 +#: ../../library/pathlib.rst:273 msgid "" ">>> bytes(p)\n" "b'/etc'" @@ -542,7 +554,7 @@ msgstr "" ">>> bytes(p)\n" "b'/etc'" -#: ../../library/pathlib.rst:266 +#: ../../library/pathlib.rst:277 msgid "" "Calling :class:`bytes` is only recommended under Unix. Under Windows, the " "unicode form is the canonical representation of filesystem paths." @@ -550,21 +562,21 @@ msgstr "" "只建議在 Unix 下呼叫 :class:`bytes`。在 Windows 裡,unicode 形式是檔案系統路" "徑的權威表示方式。" -#: ../../library/pathlib.rst:271 +#: ../../library/pathlib.rst:282 msgid "Accessing individual parts" msgstr "對個別組成的存取" -#: ../../library/pathlib.rst:273 +#: ../../library/pathlib.rst:284 msgid "" "To access the individual \"parts\" (components) of a path, use the following " "property:" msgstr "可以使用下列屬性來存取路徑的個別「組成」(parts, components):" -#: ../../library/pathlib.rst:278 +#: ../../library/pathlib.rst:289 msgid "A tuple giving access to the path's various components::" msgstr "一個可存取路徑的各組成的元組: ::" -#: ../../library/pathlib.rst:280 +#: ../../library/pathlib.rst:291 msgid "" ">>> p = PurePath('/usr/bin/python3')\n" ">>> p.parts\n" @@ -582,25 +594,31 @@ msgstr "" ">>> p.parts\n" "('c:\\\\', 'Program Files', 'PSF')" -#: ../../library/pathlib.rst:288 +#: ../../library/pathlib.rst:299 msgid "(note how the drive and local root are regrouped in a single part)" msgstr "(特別注意磁碟機跟本地根目錄是如何被重新組合成一個單一組成)" -#: ../../library/pathlib.rst:292 +#: ../../library/pathlib.rst:303 msgid "Methods and properties" msgstr "方法與屬性" -#: ../../library/pathlib.rst:298 +#: ../../library/pathlib.rst:309 msgid "Pure paths provide the following methods and properties:" msgstr "純路徑提供以下方法與屬性:" -#: ../../library/pathlib.rst:302 +#: ../../library/pathlib.rst:313 +msgid "" +"The implementation of the :mod:`os.path` module used for low-level path " +"parsing and joining: either :mod:`posixpath` or :mod:`ntpath`." +msgstr "" + +#: ../../library/pathlib.rst:320 msgid "A string representing the drive letter or name, if any::" msgstr "" "若存在則為一個表示磁碟機字母 (drive letter) 或磁碟機名稱 (drive name) 的字" "串: ::" -#: ../../library/pathlib.rst:304 +#: ../../library/pathlib.rst:322 msgid "" ">>> PureWindowsPath('c:/Program Files/').drive\n" "'c:'\n" @@ -616,11 +634,11 @@ msgstr "" ">>> PurePosixPath('/etc').drive\n" "''" -#: ../../library/pathlib.rst:311 +#: ../../library/pathlib.rst:329 msgid "UNC shares are also considered drives::" msgstr "UNC shares 也被視為磁碟機: ::" -#: ../../library/pathlib.rst:313 +#: ../../library/pathlib.rst:331 msgid "" ">>> PureWindowsPath('//host/share/foo.txt').drive\n" "'\\\\\\\\host\\\\share'" @@ -628,11 +646,11 @@ msgstr "" ">>> PureWindowsPath('//host/share/foo.txt').drive\n" "'\\\\\\\\host\\\\share'" -#: ../../library/pathlib.rst:318 +#: ../../library/pathlib.rst:336 msgid "A string representing the (local or global) root, if any::" msgstr "若存在則為一個表示(本地或全域)根目錄的字串: ::" -#: ../../library/pathlib.rst:320 +#: ../../library/pathlib.rst:338 msgid "" ">>> PureWindowsPath('c:/Program Files/').root\n" "'\\\\'\n" @@ -648,11 +666,11 @@ msgstr "" ">>> PurePosixPath('/etc').root\n" "'/'" -#: ../../library/pathlib.rst:327 +#: ../../library/pathlib.rst:345 msgid "UNC shares always have a root::" msgstr "UNC shares 都會有一個根目錄: ::" -#: ../../library/pathlib.rst:329 +#: ../../library/pathlib.rst:347 msgid "" ">>> PureWindowsPath('//host/share').root\n" "'\\\\'" @@ -660,7 +678,7 @@ msgstr "" ">>> PureWindowsPath('//host/share').root\n" "'\\\\'" -#: ../../library/pathlib.rst:332 +#: ../../library/pathlib.rst:350 msgid "" "If the path starts with more than two successive slashes, :class:`~pathlib." "PurePosixPath` collapses them::" @@ -668,7 +686,7 @@ msgstr "" "如果路徑以超過兩個連續的斜線開頭,:class:`~pathlib.PurePosixPath` 會合併它" "們: ::" -#: ../../library/pathlib.rst:335 +#: ../../library/pathlib.rst:353 msgid "" ">>> PurePosixPath('//etc').root\n" "'//'\n" @@ -684,7 +702,7 @@ msgstr "" ">>> PurePosixPath('////etc').root\n" "'/'" -#: ../../library/pathlib.rst:344 +#: ../../library/pathlib.rst:362 msgid "" "This behavior conforms to *The Open Group Base Specifications Issue 6*, " "paragraph `4.11 Pathname Resolution `_:" -#: ../../library/pathlib.rst:348 +#: ../../library/pathlib.rst:366 msgid "" "*\"A pathname that begins with two successive slashes may be interpreted in " "an implementation-defined manner, although more than two leading slashes " @@ -703,11 +721,11 @@ msgstr "" "*「以兩個連續斜線開頭的路徑名稱可以根據實作定義的方式來解讀,儘管如此,開頭超" "過兩個斜線應該視為單一斜線。」*" -#: ../../library/pathlib.rst:354 +#: ../../library/pathlib.rst:372 msgid "The concatenation of the drive and root::" msgstr "磁碟機與根目錄的結合: ::" -#: ../../library/pathlib.rst:356 +#: ../../library/pathlib.rst:374 msgid "" ">>> PureWindowsPath('c:/Program Files/').anchor\n" "'c:\\\\'\n" @@ -727,12 +745,12 @@ msgstr "" ">>> PureWindowsPath('//host/share').anchor\n" "'\\\\\\\\host\\\\share\\\\'" -#: ../../library/pathlib.rst:368 +#: ../../library/pathlib.rst:386 msgid "" "An immutable sequence providing access to the logical ancestors of the path::" msgstr "一個不可變的序列,為路徑邏輯上的祖先 (logical ancestors) 提供存取: ::" -#: ../../library/pathlib.rst:371 +#: ../../library/pathlib.rst:389 msgid "" ">>> p = PureWindowsPath('c:/foo/bar/setup.py')\n" ">>> p.parents[0]\n" @@ -750,17 +768,17 @@ msgstr "" ">>> p.parents[2]\n" "PureWindowsPath('c:/')" -#: ../../library/pathlib.rst:379 +#: ../../library/pathlib.rst:397 msgid "" "The parents sequence now supports :term:`slices ` and negative index " "values." msgstr "父序列現在支援 :term:`slices ` 及負的索引值。" -#: ../../library/pathlib.rst:384 +#: ../../library/pathlib.rst:402 msgid "The logical parent of the path::" msgstr "邏輯上的父路徑: ::" -#: ../../library/pathlib.rst:386 +#: ../../library/pathlib.rst:404 msgid "" ">>> p = PurePosixPath('/a/b/c/d')\n" ">>> p.parent\n" @@ -770,11 +788,11 @@ msgstr "" ">>> p.parent\n" "PurePosixPath('/a/b/c')" -#: ../../library/pathlib.rst:390 +#: ../../library/pathlib.rst:408 msgid "You cannot go past an anchor, or empty path::" msgstr "你不能越過一個 anchor 或空路徑: ::" -#: ../../library/pathlib.rst:392 +#: ../../library/pathlib.rst:410 msgid "" ">>> p = PurePosixPath('/')\n" ">>> p.parent\n" @@ -790,11 +808,11 @@ msgstr "" ">>> p.parent\n" "PurePosixPath('.')" -#: ../../library/pathlib.rst:400 +#: ../../library/pathlib.rst:418 msgid "This is a purely lexical operation, hence the following behaviour::" msgstr "這是一個純粹字句上的 (lexical) 運算,因此會有以下行為: ::" -#: ../../library/pathlib.rst:402 +#: ../../library/pathlib.rst:420 msgid "" ">>> p = PurePosixPath('foo/..')\n" ">>> p.parent\n" @@ -804,7 +822,7 @@ msgstr "" ">>> p.parent\n" "PurePosixPath('foo')" -#: ../../library/pathlib.rst:406 +#: ../../library/pathlib.rst:424 msgid "" "If you want to walk an arbitrary filesystem path upwards, it is recommended " "to first call :meth:`Path.resolve` so as to resolve symlinks and eliminate " @@ -813,7 +831,7 @@ msgstr "" "如果你想要沿任意的檔案系統路徑往上走,建議要先呼叫 :meth:`Path.resolve` 來解" "析符號連結 (symlink) 及去除其中的 ``”..”``。" -#: ../../library/pathlib.rst:413 +#: ../../library/pathlib.rst:431 msgid "" "A string representing the final path component, excluding the drive and " "root, if any::" @@ -821,7 +839,7 @@ msgstr "" "最後的路徑組成 (final path component) 的字串表示,不包含任何磁碟機或根目" "錄: ::" -#: ../../library/pathlib.rst:416 +#: ../../library/pathlib.rst:434 msgid "" ">>> PurePosixPath('my/library/setup.py').name\n" "'setup.py'" @@ -829,11 +847,11 @@ msgstr "" ">>> PurePosixPath('my/library/setup.py').name\n" "'setup.py'" -#: ../../library/pathlib.rst:419 +#: ../../library/pathlib.rst:437 msgid "UNC drive names are not considered::" msgstr "UNC 磁碟機名稱並沒有算在內: ::" -#: ../../library/pathlib.rst:421 +#: ../../library/pathlib.rst:439 msgid "" ">>> PureWindowsPath('//some/share/setup.py').name\n" "'setup.py'\n" @@ -845,11 +863,12 @@ msgstr "" ">>> PureWindowsPath('//some/share').name\n" "''" -#: ../../library/pathlib.rst:429 -msgid "The file extension of the final component, if any::" +#: ../../library/pathlib.rst:447 +#, fuzzy +msgid "The last dot-separated portion of the final component, if any::" msgstr "若存在則為最後的路徑組成的檔案副檔名: ::" -#: ../../library/pathlib.rst:431 +#: ../../library/pathlib.rst:449 msgid "" ">>> PurePosixPath('my/library/setup.py').suffix\n" "'.py'\n" @@ -865,11 +884,17 @@ msgstr "" ">>> PurePosixPath('my/library').suffix\n" "''" -#: ../../library/pathlib.rst:441 -msgid "A list of the path's file extensions::" +#: ../../library/pathlib.rst:456 +#, fuzzy +msgid "This is commonly called the file extension." +msgstr "路徑檔案副檔名的串列: ::" + +#: ../../library/pathlib.rst:460 +#, fuzzy +msgid "A list of the path's suffixes, often called file extensions::" msgstr "路徑檔案副檔名的串列: ::" -#: ../../library/pathlib.rst:443 +#: ../../library/pathlib.rst:462 msgid "" ">>> PurePosixPath('my/library.tar.gar').suffixes\n" "['.tar', '.gar']\n" @@ -885,11 +910,11 @@ msgstr "" ">>> PurePosixPath('my/library').suffixes\n" "[]" -#: ../../library/pathlib.rst:453 +#: ../../library/pathlib.rst:472 msgid "The final path component, without its suffix::" msgstr "最後的路徑組成,不包括後綴 (suffix): ::" -#: ../../library/pathlib.rst:455 +#: ../../library/pathlib.rst:474 msgid "" ">>> PurePosixPath('my/library.tar.gz').stem\n" "'library.tar'\n" @@ -905,12 +930,12 @@ msgstr "" ">>> PurePosixPath('my/library').stem\n" "'library'" -#: ../../library/pathlib.rst:465 +#: ../../library/pathlib.rst:484 msgid "" "Return a string representation of the path with forward slashes (``/``)::" msgstr "回傳一個使用正斜線 (``/``) 的路徑的字串表示: ::" -#: ../../library/pathlib.rst:467 +#: ../../library/pathlib.rst:486 msgid "" ">>> p = PureWindowsPath('c:\\\\windows')\n" ">>> str(p)\n" @@ -924,14 +949,7 @@ msgstr "" ">>> p.as_posix()\n" "'c:/windows'" -#: ../../library/pathlib.rst:476 -msgid "" -"Represent the path as a ``file`` URI. :exc:`ValueError` is raised if the " -"path isn't absolute." -msgstr "" -"以 ``file`` URI 來表示一個路徑。如果不是絕對路徑會引發 :exc:`ValueError`。" - -#: ../../library/pathlib.rst:489 +#: ../../library/pathlib.rst:495 msgid "" "Return whether the path is absolute or not. A path is considered absolute " "if it has both a root and (if the flavour allows) a drive::" @@ -939,7 +957,7 @@ msgstr "" "回傳一個路徑是否是絕對路徑。一個路徑被視為絕對路徑的條件是它同時有根目錄及" "(如果該系統類型允許的話)磁碟機: ::" -#: ../../library/pathlib.rst:492 +#: ../../library/pathlib.rst:498 msgid "" ">>> PurePosixPath('/a/b').is_absolute()\n" "True\n" @@ -969,11 +987,11 @@ msgstr "" ">>> PureWindowsPath('//some/share').is_absolute()\n" "True" -#: ../../library/pathlib.rst:509 +#: ../../library/pathlib.rst:515 msgid "Return whether or not this path is relative to the *other* path." msgstr "回傳此路徑是否為 *other* 路徑的相對路徑。" -#: ../../library/pathlib.rst:517 +#: ../../library/pathlib.rst:523 msgid "" "This method is string-based; it neither accesses the filesystem nor treats " "\"``..``\" segments specially. The following code is equivalent:" @@ -981,13 +999,13 @@ msgstr "" "該方法是基於字串的;它既不存取檔案系統,也不特別處理 \"``..``\" 片段。以下程" "式碼是等效的:" -#: ../../library/pathlib.rst:528 +#: ../../library/pathlib.rst:534 msgid "" "Passing additional arguments is deprecated; if supplied, they are joined " "with *other*." msgstr "額外引數的傳入已棄用;如果有的話,它們會與 *other* 連接在一起。" -#: ../../library/pathlib.rst:533 +#: ../../library/pathlib.rst:539 msgid "" "With :class:`PureWindowsPath`, return ``True`` if the path is considered " "reserved under Windows, ``False`` otherwise. With :class:`PurePosixPath`, " @@ -997,19 +1015,25 @@ msgstr "" "``True``,否則回傳 ``False``。對 :class:`PurePosixPath` 來說,總是回傳 " "``False``。" -#: ../../library/pathlib.rst:542 +#: ../../library/pathlib.rst:543 msgid "" -"File system calls on reserved paths can fail mysteriously or have unintended " -"effects." -msgstr "在保留路徑上的檔案系統呼叫會神秘地失敗或有意外的效果。" +"Windows path names that contain a colon, or end with a dot or a space, are " +"considered reserved. UNC paths may be reserved." +msgstr "" -#: ../../library/pathlib.rst:548 +#: ../../library/pathlib.rst:547 +msgid "" +"This method is deprecated; use :func:`os.path.isreserved` to detect reserved " +"paths on Windows." +msgstr "" + +#: ../../library/pathlib.rst:553 msgid "" "Calling this method is equivalent to combining the path with each of the " "given *pathsegments* in turn::" msgstr "呼叫此方法會依序結合每個所給定的 *pathsegments* 到路徑上: ::" -#: ../../library/pathlib.rst:551 +#: ../../library/pathlib.rst:556 msgid "" ">>> PurePosixPath('/etc').joinpath('passwd')\n" "PurePosixPath('/etc/passwd')\n" @@ -1029,30 +1053,26 @@ msgstr "" ">>> PureWindowsPath('c:').joinpath('/Program Files')\n" "PureWindowsPath('c:/Program Files')" -#: ../../library/pathlib.rst:563 +#: ../../library/pathlib.rst:568 +#, fuzzy msgid "" "Match this path against the provided glob-style pattern. Return ``True`` if " -"matching is successful, ``False`` otherwise." +"matching is successful, ``False`` otherwise. For example::" msgstr "" "將路徑與 glob 形式的樣式 (glob-style pattern) 做比對。如果比對成功則回傳 " "``True``,否則回傳 ``False``。" -#: ../../library/pathlib.rst:566 +#: ../../library/pathlib.rst:571 +#, fuzzy msgid "" -"If *pattern* is relative, the path can be either relative or absolute, and " -"matching is done from the right::" -msgstr "" -"如果 *pattern* 是相對的,則路徑可以是相對或絕對的,而且會從右邊來完成比" -"對: ::" - -#: ../../library/pathlib.rst:569 -msgid "" -">>> PurePath('a/b.py').match('*.py')\n" +">>> PurePath('a/b.py').full_match('a/*.py')\n" "True\n" -">>> PurePath('/a/b/c.py').match('b/*.py')\n" +">>> PurePath('a/b.py').full_match('*.py')\n" +"False\n" +">>> PurePath('/a/b/c.py').full_match('/a/**')\n" "True\n" -">>> PurePath('/a/b/c.py').match('a/*.py')\n" -"False" +">>> PurePath('/a/b/c.py').full_match('**/*.py')\n" +"True" msgstr "" ">>> PurePath('a/b.py').match('*.py')\n" "True\n" @@ -1061,59 +1081,20 @@ msgstr "" ">>> PurePath('/a/b/c.py').match('a/*.py')\n" "False" -#: ../../library/pathlib.rst:576 -msgid "" -"If *pattern* is absolute, the path must be absolute, and the whole path must " -"match::" -msgstr "如果 *pattern* 是絕對的,則路徑必須是絕對的,且整個路徑都要比對到: ::" - -#: ../../library/pathlib.rst:579 -msgid "" -">>> PurePath('/a.py').match('/*.py')\n" -"True\n" -">>> PurePath('a/b.py').match('/*.py')\n" -"False" -msgstr "" -">>> PurePath('/a.py').match('/*.py')\n" -"True\n" -">>> PurePath('a/b.py').match('/*.py')\n" -"False" - -#: ../../library/pathlib.rst:584 -msgid "" -"The *pattern* may be another path object; this speeds up matching the same " -"pattern against multiple files::" -msgstr "*pattern* 可以是另一個路徑物件;這會加速對多個檔案比對相同的樣式: ::" - -#: ../../library/pathlib.rst:587 -msgid "" -">>> pattern = PurePath('*.py')\n" -">>> PurePath('a/b.py').match(pattern)\n" -"True" -msgstr "" -">>> pattern = PurePath('*.py')\n" -">>> PurePath('a/b.py').match(pattern)\n" -"True" - -#: ../../library/pathlib.rst:592 -msgid "" -"The recursive wildcard \"``**``\" isn't supported by this method (it acts " -"like non-recursive \"``*``\".)" +#: ../../library/pathlib.rst:581 ../../library/pathlib.rst:1291 +msgid ":ref:`pathlib-pattern-language` documentation." msgstr "" -#: ../../library/pathlib.rst:595 -msgid "Accepts an object implementing the :class:`os.PathLike` interface." -msgstr "接受一個有實作 :class:`os.PathLike` 介面的物件。" - -#: ../../library/pathlib.rst:598 +#: ../../library/pathlib.rst:583 msgid "As with other methods, case-sensitivity follows platform defaults::" msgstr "像其它方法一樣,是否區分大小寫會遵循平台的預設行為: ::" -#: ../../library/pathlib.rst:600 +#: ../../library/pathlib.rst:585 +#, fuzzy msgid "" -">>> PurePosixPath('b.py').match('*.PY')\n" +">>> PurePosixPath('b.py').full_match('*.PY')\n" "False\n" -">>> PureWindowsPath('b.py').match('*.PY')\n" +">>> PureWindowsPath('b.py').full_match('*.PY')\n" "True" msgstr "" ">>> PurePosixPath('b.py').match('*.PY')\n" @@ -1121,17 +1102,55 @@ msgstr "" ">>> PureWindowsPath('b.py').match('*.PY')\n" "True" -#: ../../library/pathlib.rst:605 +#: ../../library/pathlib.rst:590 msgid "" "Set *case_sensitive* to ``True`` or ``False`` to override this behaviour." msgstr "將 *case_sensitive* 設定成 ``True`` 或 ``False`` 會覆蓋這個行為。" -#: ../../library/pathlib.rst:607 ../../library/pathlib.rst:1212 -#: ../../library/pathlib.rst:1240 +#: ../../library/pathlib.rst:597 +#, fuzzy +msgid "" +"Match this path against the provided non-recursive glob-style pattern. " +"Return ``True`` if matching is successful, ``False`` otherwise." +msgstr "" +"將路徑與 glob 形式的樣式 (glob-style pattern) 做比對。如果比對成功則回傳 " +"``True``,否則回傳 ``False``。" + +#: ../../library/pathlib.rst:600 +msgid "" +"This method is similar to :meth:`~PurePath.full_match`, but empty patterns " +"aren't allowed (:exc:`ValueError` is raised), the recursive wildcard " +"\"``**``\" isn't supported (it acts like non-recursive \"``*``\"), and if a " +"relative pattern is provided, then matching is done from the right::" +msgstr "" + +#: ../../library/pathlib.rst:605 +msgid "" +">>> PurePath('a/b.py').match('*.py')\n" +"True\n" +">>> PurePath('/a/b/c.py').match('b/*.py')\n" +"True\n" +">>> PurePath('/a/b/c.py').match('a/*.py')\n" +"False" +msgstr "" +">>> PurePath('a/b.py').match('*.py')\n" +"True\n" +">>> PurePath('/a/b/c.py').match('b/*.py')\n" +"True\n" +">>> PurePath('/a/b/c.py').match('a/*.py')\n" +"False" + +#: ../../library/pathlib.rst:612 ../../library/pathlib.rst:1310 +#: ../../library/pathlib.rst:1335 +msgid "The *pattern* parameter accepts a :term:`path-like object`." +msgstr "" + +#: ../../library/pathlib.rst:615 ../../library/pathlib.rst:1304 +#: ../../library/pathlib.rst:1329 msgid "The *case_sensitive* parameter was added." msgstr "新增 *case_sensitive* 參數。" -#: ../../library/pathlib.rst:613 +#: ../../library/pathlib.rst:621 msgid "" "Compute a version of this path relative to the path represented by *other*. " "If it's impossible, :exc:`ValueError` is raised::" @@ -1139,7 +1158,7 @@ msgstr "" "計算這個路徑相對於 *other* 所表示路徑的版本。如果做不到會引發 :exc:" "`ValueError`: ::" -#: ../../library/pathlib.rst:616 +#: ../../library/pathlib.rst:624 msgid "" ">>> p = PurePosixPath('/etc/passwd')\n" ">>> p.relative_to('/')\n" @@ -1167,7 +1186,7 @@ msgstr "" "ValueError: '/etc/passwd' is not in the subpath of '/usr' OR one path is " "relative and the other is absolute." -#: ../../library/pathlib.rst:628 +#: ../../library/pathlib.rst:636 msgid "" "When *walk_up* is false (the default), the path must start with *other*. " "When the argument is true, ``..`` entries may be added to form the relative " @@ -1178,7 +1197,7 @@ msgstr "" "可能會加入 ``..`` 以組成相對路徑。在其他情況下,例如路徑參考到不同的磁碟機," "則會引發 :exc:`ValueError`: ::" -#: ../../library/pathlib.rst:633 +#: ../../library/pathlib.rst:641 msgid "" ">>> p.relative_to('/usr', walk_up=True)\n" "PurePosixPath('../etc/passwd')\n" @@ -1200,7 +1219,7 @@ msgstr "" "ValueError: '/etc/passwd' is not on the same drive as 'foo' OR one path is " "relative and the other is absolute." -#: ../../library/pathlib.rst:643 +#: ../../library/pathlib.rst:651 msgid "" "This function is part of :class:`PurePath` and works with strings. It does " "not check or access the underlying file structure. This can impact the " @@ -1211,19 +1230,19 @@ msgstr "" "的檔案架構。這會影響到 *walk_up* 選項,因為它假設路徑中沒有符號連結;如果需要" "解析符號連結的話可以先呼叫 :meth:`~Path.resolve`。" -#: ../../library/pathlib.rst:649 +#: ../../library/pathlib.rst:657 msgid "" "The *walk_up* parameter was added (old behavior is the same as " "``walk_up=False``)." msgstr "加入 *walk_up* 參數(舊的行為和 ``walk_up=False`` 相同)。" -#: ../../library/pathlib.rst:654 +#: ../../library/pathlib.rst:662 msgid "" "Passing additional positional arguments is deprecated; if supplied, they are " "joined with *other*." msgstr "額外位置引數的傳入已棄用;如果有的話,它們會與 *other* 連接在一起。" -#: ../../library/pathlib.rst:659 +#: ../../library/pathlib.rst:667 msgid "" "Return a new path with the :attr:`name` changed. If the original path " "doesn't have a name, ValueError is raised::" @@ -1231,7 +1250,7 @@ msgstr "" "回傳一個修改 :attr:`name` 後的新路徑。如果原始路徑沒有名稱則引發 " "ValueError: ::" -#: ../../library/pathlib.rst:662 +#: ../../library/pathlib.rst:670 msgid "" ">>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')\n" ">>> p.with_name('setup.py')\n" @@ -1257,7 +1276,7 @@ msgstr "" " raise ValueError(\"%r has an empty name\" % (self,))\n" "ValueError: PureWindowsPath('c:/') has an empty name" -#: ../../library/pathlib.rst:676 +#: ../../library/pathlib.rst:684 msgid "" "Return a new path with the :attr:`stem` changed. If the original path " "doesn't have a name, ValueError is raised::" @@ -1265,7 +1284,7 @@ msgstr "" "回傳一個修改 :attr:`stem` 後的新路徑。如果原始路徑沒有名稱則引發 " "ValueError: ::" -#: ../../library/pathlib.rst:679 +#: ../../library/pathlib.rst:687 msgid "" ">>> p = PureWindowsPath('c:/Downloads/draft.txt')\n" ">>> p.with_stem('final')\n" @@ -1303,7 +1322,7 @@ msgstr "" " raise ValueError(\"%r has an empty name\" % (self,))\n" "ValueError: PureWindowsPath('c:/') has an empty name" -#: ../../library/pathlib.rst:700 +#: ../../library/pathlib.rst:708 msgid "" "Return a new path with the :attr:`suffix` changed. If the original path " "doesn't have a suffix, the new *suffix* is appended instead. If the " @@ -1312,7 +1331,7 @@ msgstr "" "回傳一個修改 :attr:`suffix` 後的新路徑。如果原始路徑沒有後綴,新的 *suffix* " "會附加在後面。如果 *suffix* 是一個空字串,原來的後綴會被移除: ::" -#: ../../library/pathlib.rst:704 +#: ../../library/pathlib.rst:712 msgid "" ">>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')\n" ">>> p.with_suffix('.bz2')\n" @@ -1334,7 +1353,7 @@ msgstr "" ">>> p.with_suffix('')\n" "PureWindowsPath('README')" -#: ../../library/pathlib.rst:717 +#: ../../library/pathlib.rst:725 msgid "" "Create a new path object of the same type by combining the given " "*pathsegments*. This method is called whenever a derivative path is created, " @@ -1345,7 +1364,7 @@ msgstr "" "建立的時候會呼叫這個方法,例如從 :attr:`parent` 和 :meth:`relative_to` 建立衍" "生路徑。子類別可以覆寫此方法來傳遞資訊給衍生路徑,例如: ::" -#: ../../library/pathlib.rst:722 +#: ../../library/pathlib.rst:730 msgid "" "from pathlib import PurePosixPath\n" "\n" @@ -1375,11 +1394,11 @@ msgstr "" "hosts = etc / 'hosts'\n" "print(hosts.session_id) # 42" -#: ../../library/pathlib.rst:743 +#: ../../library/pathlib.rst:751 msgid "Concrete paths" msgstr "實體路徑" -#: ../../library/pathlib.rst:745 +#: ../../library/pathlib.rst:753 msgid "" "Concrete paths are subclasses of the pure path classes. In addition to " "operations provided by the latter, they also provide methods to do system " @@ -1388,7 +1407,7 @@ msgstr "" "實體路徑是純路徑類別的子類別。除了後者本來就有提供的操作,它們也提供方法可以" "對路徑物件做系統呼叫。有三種方式可以實例化實體路徑:" -#: ../../library/pathlib.rst:751 +#: ../../library/pathlib.rst:759 msgid "" "A subclass of :class:`PurePath`, this class represents concrete paths of the " "system's path flavour (instantiating it creates either a :class:`PosixPath` " @@ -1397,7 +1416,7 @@ msgstr "" ":class:`PurePath` 的子類別,此類別表示系統的路徑類型的實體路徑(實例化時會建" "立一個 :class:`PosixPath` 或 :class:`WindowsPath`): ::" -#: ../../library/pathlib.rst:755 +#: ../../library/pathlib.rst:763 msgid "" ">>> Path('setup.py')\n" "PosixPath('setup.py')" @@ -1405,7 +1424,7 @@ msgstr "" ">>> Path('setup.py')\n" "PosixPath('setup.py')" -#: ../../library/pathlib.rst:762 +#: ../../library/pathlib.rst:770 msgid "" "A subclass of :class:`Path` and :class:`PurePosixPath`, this class " "represents concrete non-Windows filesystem paths::" @@ -1413,7 +1432,7 @@ msgstr "" ":class:`Path` 和 :class:`PurePosixPath` 的子類別,此類別表示實體非 Windows 檔" "案系統路徑: ::" -#: ../../library/pathlib.rst:765 +#: ../../library/pathlib.rst:773 msgid "" ">>> PosixPath('/etc/hosts')\n" "PosixPath('/etc/hosts')" @@ -1421,7 +1440,13 @@ msgstr "" ">>> PosixPath('/etc/hosts')\n" "PosixPath('/etc/hosts')" -#: ../../library/pathlib.rst:772 +#: ../../library/pathlib.rst:778 +msgid "" +"Raises :exc:`UnsupportedOperation` on Windows. In previous versions, :exc:" +"`NotImplementedError` was raised instead." +msgstr "" + +#: ../../library/pathlib.rst:785 msgid "" "A subclass of :class:`Path` and :class:`PureWindowsPath`, this class " "represents concrete Windows filesystem paths::" @@ -1429,7 +1454,7 @@ msgstr "" ":class:`Path` 和 :class:`PureWindowsPath` 的子類別,此類別表示實體 Windows 檔" "案系統路徑: ::" -#: ../../library/pathlib.rst:775 +#: ../../library/pathlib.rst:788 msgid "" ">>> WindowsPath('c:/', 'Users', 'Ximénez')\n" "WindowsPath('c:/Users/Ximénez')" @@ -1437,7 +1462,13 @@ msgstr "" ">>> WindowsPath('c:/', 'Users', 'Ximénez')\n" "WindowsPath('c:/Users/Ximénez')" -#: ../../library/pathlib.rst:780 +#: ../../library/pathlib.rst:793 +msgid "" +"Raises :exc:`UnsupportedOperation` on non-Windows platforms. In previous " +"versions, :exc:`NotImplementedError` was raised instead." +msgstr "" + +#: ../../library/pathlib.rst:798 msgid "" "You can only instantiate the class flavour that corresponds to your system " "(allowing system calls on non-compatible path flavours could lead to bugs or " @@ -1446,7 +1477,8 @@ msgstr "" "你只能實例化對應你的系統的類別類型(允許在不相容的路徑類型上做系統呼叫可能在" "你的應用程式導致漏洞或故障): ::" -#: ../../library/pathlib.rst:784 +#: ../../library/pathlib.rst:802 +#, fuzzy msgid "" ">>> import os\n" ">>> os.name\n" @@ -1460,7 +1492,7 @@ msgid "" " File \"\", line 1, in \n" " File \"pathlib.py\", line 798, in __new__\n" " % (cls.__name__,))\n" -"NotImplementedError: cannot instantiate 'WindowsPath' on your system" +"UnsupportedOperation: cannot instantiate 'WindowsPath' on your system" msgstr "" ">>> import os\n" ">>> os.name\n" @@ -1476,18 +1508,117 @@ msgstr "" " % (cls.__name__,))\n" "NotImplementedError: cannot instantiate 'WindowsPath' on your system" -#: ../../library/pathlib.rst:798 +#: ../../library/pathlib.rst:816 msgid "" "Some concrete path methods can raise an :exc:`OSError` if a system call " "fails (for example because the path doesn't exist)." msgstr "" "有些實體路徑方法會在系統呼叫失敗(例如因為路徑不存在)時引發 :exc:`OSError`" -#: ../../library/pathlib.rst:803 +#: ../../library/pathlib.rst:821 +msgid "Parsing and generating URIs" +msgstr "" + +#: ../../library/pathlib.rst:823 +msgid "" +"Concrete path objects can be created from, and represented as, 'file' URIs " +"conforming to :rfc:`8089`." +msgstr "" + +#: ../../library/pathlib.rst:828 +msgid "" +"File URIs are not portable across machines with different :ref:`filesystem " +"encodings `." +msgstr "" + +#: ../../library/pathlib.rst:833 +msgid "Return a new path object from parsing a 'file' URI. For example::" +msgstr "" + +#: ../../library/pathlib.rst:835 +#, fuzzy +msgid "" +">>> p = Path.from_uri('file:///etc/hosts')\n" +"PosixPath('/etc/hosts')" +msgstr "" +">>> PosixPath('/etc/hosts')\n" +"PosixPath('/etc/hosts')" + +#: ../../library/pathlib.rst:838 +msgid "On Windows, DOS device and UNC paths may be parsed from URIs::" +msgstr "" + +#: ../../library/pathlib.rst:840 +#, fuzzy +msgid "" +">>> p = Path.from_uri('file:///c:/windows')\n" +"WindowsPath('c:/windows')\n" +">>> p = Path.from_uri('file://server/share')\n" +"WindowsPath('//server/share')" +msgstr "" +">>> PureWindowsPath('c:/', 'Users', 'Ximénez')\n" +"PureWindowsPath('c:/Users/Ximénez')\n" +">>> PureWindowsPath('//server/share/file')\n" +"PureWindowsPath('//server/share/file')" + +#: ../../library/pathlib.rst:845 +msgid "Several variant forms are supported::" +msgstr "" + +#: ../../library/pathlib.rst:847 +msgid "" +">>> p = Path.from_uri('file:////server/share')\n" +"WindowsPath('//server/share')\n" +">>> p = Path.from_uri('file://///server/share')\n" +"WindowsPath('//server/share')\n" +">>> p = Path.from_uri('file:c:/windows')\n" +"WindowsPath('c:/windows')\n" +">>> p = Path.from_uri('file:/c|/windows')\n" +"WindowsPath('c:/windows')" +msgstr "" + +#: ../../library/pathlib.rst:856 +msgid "" +":exc:`ValueError` is raised if the URI does not start with ``file:``, or the " +"parsed path isn't absolute." +msgstr "" + +#: ../../library/pathlib.rst:864 +#, fuzzy +msgid "" +"Represent the path as a 'file' URI. :exc:`ValueError` is raised if the path " +"isn't absolute." +msgstr "" +"以 ``file`` URI 來表示一個路徑。如果不是絕對路徑會引發 :exc:`ValueError`。" + +#: ../../library/pathlib.rst:867 +#, fuzzy +msgid "" +">>> p = PosixPath('/etc/passwd')\n" +">>> p.as_uri()\n" +"'file:///etc/passwd'\n" +">>> p = WindowsPath('c:/Windows')\n" +">>> p.as_uri()\n" +"'file:///c:/Windows'" +msgstr "" +">>> p = PurePath('/etc')\n" +">>> str(p)\n" +"'/etc'\n" +">>> p = PureWindowsPath('c:/Program Files')\n" +">>> str(p)\n" +"'c:\\\\Program Files'" + +#: ../../library/pathlib.rst:876 +msgid "" +"For historical reasons, this method is also available from :class:`PurePath` " +"objects. However, its use of :func:`os.fsencode` makes it strictly impure." +msgstr "" + +#: ../../library/pathlib.rst:882 msgid "Expanding and resolving paths" msgstr "" -#: ../../library/pathlib.rst:807 +#: ../../library/pathlib.rst:886 msgid "" "Return a new path object representing the user's home directory (as returned " "by :func:`os.path.expanduser` with ``~`` construct). If the home directory " @@ -1496,7 +1627,7 @@ msgstr "" "回傳一個代表使用者家目錄的新的路徑物件(像以 ``~`` 構成的 :func:`os.path." "expanduser` 的回傳一樣)。如果無法解析家目錄,會引發 :exc:`RuntimeError`。" -#: ../../library/pathlib.rst:813 +#: ../../library/pathlib.rst:892 msgid "" ">>> Path.home()\n" "PosixPath('/home/antoine')" @@ -1504,7 +1635,7 @@ msgstr "" ">>> Path.home()\n" "PosixPath('/home/antoine')" -#: ../../library/pathlib.rst:821 +#: ../../library/pathlib.rst:900 msgid "" "Return a new path with expanded ``~`` and ``~user`` constructs, as returned " "by :meth:`os.path.expanduser`. If a home directory can't be resolved, :exc:" @@ -1513,7 +1644,7 @@ msgstr "" "回傳一個展開 ``~`` 和 ``~user`` 構成的新路徑,像 :meth:`os.path.expanduser` " "回傳的一樣。如果無法解析家目錄,會引發 :exc:`RuntimeError`。" -#: ../../library/pathlib.rst:827 +#: ../../library/pathlib.rst:906 msgid "" ">>> p = PosixPath('~/films/Monty Python')\n" ">>> p.expanduser()\n" @@ -1523,14 +1654,14 @@ msgstr "" ">>> p.expanduser()\n" "PosixPath('/home/eric/films/Monty Python')" -#: ../../library/pathlib.rst:836 +#: ../../library/pathlib.rst:915 msgid "" "Return a new path object representing the current directory (as returned by :" "func:`os.getcwd`)::" msgstr "" "回傳一個代表目前目錄的新的路徑物件(像 :func:`os.getcwd` 回傳的一樣): ::" -#: ../../library/pathlib.rst:839 +#: ../../library/pathlib.rst:918 msgid "" ">>> Path.cwd()\n" "PosixPath('/home/antoine/pathlib')" @@ -1538,14 +1669,14 @@ msgstr "" ">>> Path.cwd()\n" "PosixPath('/home/antoine/pathlib')" -#: ../../library/pathlib.rst:845 +#: ../../library/pathlib.rst:924 msgid "" "Make the path absolute, without normalization or resolving symlinks. Returns " "a new path object::" msgstr "" "將路徑轉換為絕對路徑,不進行標準化或解析符號連結。回傳一個新的路徑物件: ::" -#: ../../library/pathlib.rst:848 +#: ../../library/pathlib.rst:927 msgid "" ">>> p = Path('tests')\n" ">>> p\n" @@ -1559,13 +1690,13 @@ msgstr "" ">>> p.absolute()\n" "PosixPath('/home/antoine/pathlib/tests')" -#: ../../library/pathlib.rst:857 +#: ../../library/pathlib.rst:936 msgid "" "Make the path absolute, resolving any symlinks. A new path object is " "returned::" msgstr "將路徑轉換為絕對路徑,解析所有符號連結。回傳一個新的路徑物件: ::" -#: ../../library/pathlib.rst:860 +#: ../../library/pathlib.rst:939 msgid "" ">>> p = Path()\n" ">>> p\n" @@ -1579,13 +1710,13 @@ msgstr "" ">>> p.resolve()\n" "PosixPath('/home/antoine/pathlib')" -#: ../../library/pathlib.rst:866 +#: ../../library/pathlib.rst:945 msgid "" "\"``..``\" components are also eliminated (this is the only method to do " "so)::" msgstr "同時也會消除 \"``..``\" 的路徑組成(只有此方法這樣做): ::" -#: ../../library/pathlib.rst:868 +#: ../../library/pathlib.rst:947 msgid "" ">>> p = Path('docs/../setup.py')\n" ">>> p.resolve()\n" @@ -1595,29 +1726,36 @@ msgstr "" ">>> p.resolve()\n" "PosixPath('/home/antoine/pathlib/setup.py')" -#: ../../library/pathlib.rst:872 +#: ../../library/pathlib.rst:951 +#, fuzzy msgid "" -"If the path doesn't exist and *strict* is ``True``, :exc:`FileNotFoundError` " -"is raised. If *strict* is ``False``, the path is resolved as far as " -"possible and any remainder is appended without checking whether it exists. " -"If an infinite loop is encountered along the resolution path, :exc:" -"`RuntimeError` is raised." +"If a path doesn't exist or a symlink loop is encountered, and *strict* is " +"``True``, :exc:`OSError` is raised. If *strict* is ``False``, the path is " +"resolved as far as possible and any remainder is appended without checking " +"whether it exists." msgstr "" "如果路徑不存在且 *strict* 為 ``True``,則引發 :exc:`FileNotFoundError`。如果 " "*strict* 為 ``False``,則將盡可能解析該路徑,並將任何剩餘部分追加到路徑中,而" "不檢查其是否存在。如果在解析過程中遇到無窮迴圈,則引發 :exc:`RuntimeError`。" -#: ../../library/pathlib.rst:878 +#: ../../library/pathlib.rst:956 msgid "The *strict* parameter was added (pre-3.6 behavior is strict)." msgstr "新增 *strict* 參數(在 3.6 版本之前的行為是嚴格的)。" -#: ../../library/pathlib.rst:884 +#: ../../library/pathlib.rst:959 +msgid "" +"Symlink loops are treated like other errors: :exc:`OSError` is raised in " +"strict mode, and no exception is raised in non-strict mode. In previous " +"versions, :exc:`RuntimeError` is raised no matter the value of *strict*." +msgstr "" + +#: ../../library/pathlib.rst:967 msgid "" "Return the path to which the symbolic link points (as returned by :func:`os." "readlink`)::" msgstr "回傳符號連結指向的路徑(如 :func:`os.readlink` 的回傳值): ::" -#: ../../library/pathlib.rst:887 +#: ../../library/pathlib.rst:970 msgid "" ">>> p = Path('mylink')\n" ">>> p.symlink_to('setup.py')\n" @@ -1629,11 +1767,17 @@ msgstr "" ">>> p.readlink()\n" "PosixPath('setup.py')" -#: ../../library/pathlib.rst:896 +#: ../../library/pathlib.rst:977 +msgid "" +"Raises :exc:`UnsupportedOperation` if :func:`os.readlink` is not available. " +"In previous versions, :exc:`NotImplementedError` was raised." +msgstr "" + +#: ../../library/pathlib.rst:983 msgid "Querying file type and status" msgstr "" -#: ../../library/pathlib.rst:900 +#: ../../library/pathlib.rst:987 msgid "" ":meth:`~Path.exists`, :meth:`~Path.is_dir`, :meth:`~Path.is_file`, :meth:" "`~Path.is_mount`, :meth:`~Path.is_symlink`, :meth:`~Path.is_block_device`, :" @@ -1646,7 +1790,7 @@ msgstr "" "meth:`~Path.is_char_device`、:meth:`~Path.is_fifo`、:meth:`~Path.is_socket` " "遇到路徑包含 OS 層無法表示的字元時現在會回傳 ``False`` 而不是引發例外。" -#: ../../library/pathlib.rst:910 +#: ../../library/pathlib.rst:997 msgid "" "Return an :class:`os.stat_result` object containing information about this " "path, like :func:`os.stat`. The result is looked up at each call to this " @@ -1655,7 +1799,7 @@ msgstr "" "回傳一個包含該路徑資訊的 :class:`os.stat_result` 物件,像 :func:`os.stat` 一" "樣。每次呼叫此方法都會重新查詢結果。" -#: ../../library/pathlib.rst:913 +#: ../../library/pathlib.rst:1000 msgid "" "This method normally follows symlinks; to stat a symlink add the argument " "``follow_symlinks=False``, or use :meth:`~Path.lstat`." @@ -1663,7 +1807,7 @@ msgstr "" "此方法通常會跟隨 (follow) 符號連結;想要取得符號連結的資訊,可以加上引數 " "``follow_symlinks=False`` 或使用 :meth:`~Path.lstat`。" -#: ../../library/pathlib.rst:918 +#: ../../library/pathlib.rst:1005 msgid "" ">>> p = Path('setup.py')\n" ">>> p.stat().st_size\n" @@ -1677,12 +1821,14 @@ msgstr "" ">>> p.stat().st_mtime\n" "1327883547.852554" -#: ../../library/pathlib.rst:924 ../../library/pathlib.rst:952 -#: ../../library/pathlib.rst:1514 +#: ../../library/pathlib.rst:1011 ../../library/pathlib.rst:1039 +#: ../../library/pathlib.rst:1054 ../../library/pathlib.rst:1069 +#: ../../library/pathlib.rst:1600 ../../library/pathlib.rst:1616 +#: ../../library/pathlib.rst:1637 msgid "The *follow_symlinks* parameter was added." msgstr "新增 *follow_symlinks* 參數。" -#: ../../library/pathlib.rst:930 +#: ../../library/pathlib.rst:1017 msgid "" "Like :meth:`Path.stat` but, if the path points to a symbolic link, return " "the symbolic link's information rather than its target's." @@ -1690,11 +1836,11 @@ msgstr "" "類似 :meth:`Path.stat`,但如果該路徑指向一個符號連結,則回傳符號連結的資訊而" "不是其指向的目標。" -#: ../../library/pathlib.rst:936 +#: ../../library/pathlib.rst:1023 msgid "Return ``True`` if the path points to an existing file or directory." msgstr "如果路徑指向存在的檔案或目錄則回傳 ``True``。" -#: ../../library/pathlib.rst:938 +#: ../../library/pathlib.rst:1025 msgid "" "This method normally follows symlinks; to check if a symlink exists, add the " "argument ``follow_symlinks=False``." @@ -1702,7 +1848,7 @@ msgstr "" "此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " "``follow_symlinks=False``。" -#: ../../library/pathlib.rst:943 +#: ../../library/pathlib.rst:1030 msgid "" ">>> Path('.').exists()\n" "True\n" @@ -1722,17 +1868,18 @@ msgstr "" ">>> Path('nonexistentfile').exists()\n" "False" -#: ../../library/pathlib.rst:958 +#: ../../library/pathlib.rst:1045 +#, fuzzy msgid "" -"Return ``True`` if the path points to a regular file (or a symbolic link " -"pointing to a regular file), ``False`` if it points to another kind of file." +"Return ``True`` if the path points to a regular file, ``False`` if it points " +"to another kind of file." msgstr "" "如果該路徑指向一個普通檔案(或者是一個指向普通檔案的符號連結)則回傳 " "``True``,如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:961 ../../library/pathlib.rst:970 -#: ../../library/pathlib.rst:1012 ../../library/pathlib.rst:1021 -#: ../../library/pathlib.rst:1030 ../../library/pathlib.rst:1039 +#: ../../library/pathlib.rst:1048 ../../library/pathlib.rst:1063 +#: ../../library/pathlib.rst:1111 ../../library/pathlib.rst:1120 +#: ../../library/pathlib.rst:1129 ../../library/pathlib.rst:1138 msgid "" "``False`` is also returned if the path doesn't exist or is a broken symlink; " "other errors (such as permission errors) are propagated." @@ -1740,27 +1887,46 @@ msgstr "" "如果路徑不存在或者是一個斷掉的符號連結則也會回傳 ``False``;其他錯誤(例如權" "限錯誤)則會傳遞出來。" -#: ../../library/pathlib.rst:967 +#: ../../library/pathlib.rst:1051 +#, fuzzy +msgid "" +"This method normally follows symlinks; to exclude symlinks, add the argument " +"``follow_symlinks=False``." +msgstr "" +"此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " +"``follow_symlinks=False``。" + +#: ../../library/pathlib.rst:1060 +#, fuzzy msgid "" -"Return ``True`` if the path points to a directory (or a symbolic link " -"pointing to a directory), ``False`` if it points to another kind of file." +"Return ``True`` if the path points to a directory, ``False`` if it points to " +"another kind of file." msgstr "" "如果該路徑指向一個目錄(或者是一個指向目錄的符號連結)則回傳 ``True``,如果指" "向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:976 +#: ../../library/pathlib.rst:1066 +#, fuzzy +msgid "" +"This method normally follows symlinks; to exclude symlinks to directories, " +"add the argument ``follow_symlinks=False``." +msgstr "" +"此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " +"``follow_symlinks=False``。" + +#: ../../library/pathlib.rst:1075 msgid "" "Return ``True`` if the path points to a symbolic link, ``False`` otherwise." msgstr "如果該路徑指向一個符號連結則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/pathlib.rst:978 +#: ../../library/pathlib.rst:1077 msgid "" "``False`` is also returned if the path doesn't exist; other errors (such as " "permission errors) are propagated." msgstr "" "如果該路徑不存在也會回傳 ``False``;其他錯誤(例如權限錯誤)則會傳遞出來。" -#: ../../library/pathlib.rst:984 +#: ../../library/pathlib.rst:1083 msgid "" "Return ``True`` if the path points to a junction, and ``False`` for any " "other type of file. Currently only Windows supports junctions." @@ -1768,7 +1934,7 @@ msgstr "" "如果該路徑指向一個連接點 (junction) 則回傳 ``True``,對其他類型的檔案則回傳 " "``False``。目前只有 Windows 支援連接點。" -#: ../../library/pathlib.rst:992 +#: ../../library/pathlib.rst:1091 msgid "" "Return ``True`` if the path is a :dfn:`mount point`: a point in a file " "system where a different file system has been mounted. On POSIX, the " @@ -1786,11 +1952,11 @@ msgstr "" "Windows 上,一個掛載點被視為一個根磁碟機字母(例如 ``c:\\``)、一個 UNC share" "(例如 ``\\\\server\\share``)或是掛載的檔案系統目錄。" -#: ../../library/pathlib.rst:1003 +#: ../../library/pathlib.rst:1102 msgid "Windows support was added." msgstr "加入對 Windows 的支援。" -#: ../../library/pathlib.rst:1009 +#: ../../library/pathlib.rst:1108 msgid "" "Return ``True`` if the path points to a Unix socket (or a symbolic link " "pointing to a Unix socket), ``False`` if it points to another kind of file." @@ -1798,7 +1964,7 @@ msgstr "" "如果該路徑指向一個 Unix socket(或者是一個指向 Unix socket 的符號連結)則會回" "傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:1018 +#: ../../library/pathlib.rst:1117 msgid "" "Return ``True`` if the path points to a FIFO (or a symbolic link pointing to " "a FIFO), ``False`` if it points to another kind of file." @@ -1806,7 +1972,7 @@ msgstr "" "如果該路徑指向一個 FIFO(或者是一個指向 FIFO 的符號連結)則會回傳 ``True``," "如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:1027 +#: ../../library/pathlib.rst:1126 msgid "" "Return ``True`` if the path points to a block device (or a symbolic link " "pointing to a block device), ``False`` if it points to another kind of file." @@ -1814,7 +1980,7 @@ msgstr "" "如果該路徑指向一個區塊裝置 (block device)(或者是一個指向區塊裝置的符號連結)" "則會回傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:1036 +#: ../../library/pathlib.rst:1135 msgid "" "Return ``True`` if the path points to a character device (or a symbolic link " "pointing to a character device), ``False`` if it points to another kind of " @@ -1823,7 +1989,7 @@ msgstr "" "如果該路徑指向一個字元裝置 (character device)(或者是一個指向字元裝置的符號連" "結)則會回傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:1045 +#: ../../library/pathlib.rst:1144 msgid "" "Return whether this path points to the same file as *other_path*, which can " "be either a Path object, or a string. The semantics are similar to :func:" @@ -1833,13 +1999,13 @@ msgstr "" "物件或字串。其語義類似於 :func:`os.path.samefile` 和 :func:`os.path." "samestat`。" -#: ../../library/pathlib.rst:1049 +#: ../../library/pathlib.rst:1148 msgid "" "An :exc:`OSError` can be raised if either file cannot be accessed for some " "reason." msgstr "若任何一個檔案因為某些原因無法存取,則引發 :exc:`OSError`。" -#: ../../library/pathlib.rst:1054 +#: ../../library/pathlib.rst:1153 msgid "" ">>> p = Path('spam')\n" ">>> q = Path('eggs')\n" @@ -1855,17 +2021,17 @@ msgstr "" ">>> p.samefile('spam')\n" "True" -#: ../../library/pathlib.rst:1065 +#: ../../library/pathlib.rst:1164 msgid "Reading and writing files" msgstr "" -#: ../../library/pathlib.rst:1070 +#: ../../library/pathlib.rst:1169 msgid "" "Open the file pointed to by the path, like the built-in :func:`open` " "function does::" msgstr "開啟該路徑指向的檔案,像內建的 :func:`open` 函式做的一樣: ::" -#: ../../library/pathlib.rst:1073 +#: ../../library/pathlib.rst:1172 msgid "" ">>> p = Path('setup.py')\n" ">>> with p.open() as f:\n" @@ -1879,11 +2045,11 @@ msgstr "" "...\n" "'#!/usr/bin/env python3\\n'" -#: ../../library/pathlib.rst:1082 +#: ../../library/pathlib.rst:1181 msgid "Return the decoded contents of the pointed-to file as a string::" msgstr "將路徑指向的檔案的解碼內容以字串形式回傳: ::" -#: ../../library/pathlib.rst:1084 ../../library/pathlib.rst:1114 +#: ../../library/pathlib.rst:1183 ../../library/pathlib.rst:1216 msgid "" ">>> p = Path('my_text_file')\n" ">>> p.write_text('Text file contents')\n" @@ -1897,17 +2063,21 @@ msgstr "" ">>> p.read_text()\n" "'Text file contents'" -#: ../../library/pathlib.rst:1090 +#: ../../library/pathlib.rst:1189 msgid "" "The file is opened and then closed. The optional parameters have the same " "meaning as in :func:`open`." msgstr "該檔案被打開並且隨後關閉。可選參數的含義與 :func:`open` 中的相同。" -#: ../../library/pathlib.rst:1098 +#: ../../library/pathlib.rst:1194 ../../library/pathlib.rst:1227 +msgid "The *newline* parameter was added." +msgstr "新增 *newline* 參數。" + +#: ../../library/pathlib.rst:1200 msgid "Return the binary contents of the pointed-to file as a bytes object::" msgstr "將路徑指向的檔案的二進位內容以一個位元組物件回傳: ::" -#: ../../library/pathlib.rst:1100 ../../library/pathlib.rst:1134 +#: ../../library/pathlib.rst:1202 ../../library/pathlib.rst:1236 msgid "" ">>> p = Path('my_binary_file')\n" ">>> p.write_bytes(b'Binary file contents')\n" @@ -1921,44 +2091,40 @@ msgstr "" ">>> p.read_bytes()\n" "b'Binary file contents'" -#: ../../library/pathlib.rst:1111 +#: ../../library/pathlib.rst:1213 msgid "" "Open the file pointed to in text mode, write *data* to it, and close the " "file::" msgstr "以文字模式開啟指向的檔案,將 *data* 寫到檔案,並關閉檔案:: :" -#: ../../library/pathlib.rst:1120 +#: ../../library/pathlib.rst:1222 msgid "" "An existing file of the same name is overwritten. The optional parameters " "have the same meaning as in :func:`open`." msgstr "" "一個名稱相同的已存在檔案會被覆寫。可選參數和 :func:`open` 的參數有相同意義。" -#: ../../library/pathlib.rst:1125 -msgid "The *newline* parameter was added." -msgstr "新增 *newline* 參數。" - -#: ../../library/pathlib.rst:1131 +#: ../../library/pathlib.rst:1233 msgid "" "Open the file pointed to in bytes mode, write *data* to it, and close the " "file::" msgstr "以位元組模式開啟指向的檔案,將 *data* 寫到檔案,並關閉檔案:: :" -#: ../../library/pathlib.rst:1140 +#: ../../library/pathlib.rst:1242 msgid "An existing file of the same name is overwritten." msgstr "一個名稱相同的已存在檔案會被覆寫。" -#: ../../library/pathlib.rst:1146 +#: ../../library/pathlib.rst:1248 msgid "Reading directories" msgstr "讀取目錄" -#: ../../library/pathlib.rst:1150 +#: ../../library/pathlib.rst:1252 msgid "" "When the path points to a directory, yield path objects of the directory " "contents::" msgstr "當該路徑指向一個目錄,會 yield 目錄裡面的路徑物件: ::" -#: ../../library/pathlib.rst:1153 +#: ../../library/pathlib.rst:1255 msgid "" ">>> p = Path('docs')\n" ">>> for child in p.iterdir(): child\n" @@ -1982,7 +2148,7 @@ msgstr "" "PosixPath('docs/_static')\n" "PosixPath('docs/Makefile')" -#: ../../library/pathlib.rst:1164 +#: ../../library/pathlib.rst:1266 msgid "" "The children are yielded in arbitrary order, and the special entries ``'.'`` " "and ``'..'`` are not included. If a file is removed from or added to the " @@ -1993,13 +2159,13 @@ msgstr "" "檔案在建立這個疊代器之後加到該目錄或從目錄刪除,這個檔案的路徑物件是否會被包" "含是沒有明定的。" -#: ../../library/pathlib.rst:1169 +#: ../../library/pathlib.rst:1271 msgid "" "If the path is not a directory or otherwise inaccessible, :exc:`OSError` is " "raised." msgstr "" -#: ../../library/pathlib.rst:1174 +#: ../../library/pathlib.rst:1276 msgid "" "Glob the given relative *pattern* in the directory represented by this path, " "yielding all matching files (of any kind)::" @@ -2007,31 +2173,14 @@ msgstr "" "在該路徑表示的目錄裡,以 glob 方式比對所給定的相對 *pattern*,並 yield 所有比" "對到的檔案(任意類型): ::" -#: ../../library/pathlib.rst:1177 +#: ../../library/pathlib.rst:1279 +#, fuzzy msgid "" ">>> sorted(Path('.').glob('*.py'))\n" "[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." "py')]\n" ">>> sorted(Path('.').glob('*/*.py'))\n" -"[PosixPath('docs/conf.py')]" -msgstr "" -">>> sorted(Path('.').glob('*.py'))\n" -"[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." -"py')]\n" -">>> sorted(Path('.').glob('*/*.py'))\n" -"[PosixPath('docs/conf.py')]" - -#: ../../library/pathlib.rst:1182 -msgid "" -"Patterns are the same as for :mod:`fnmatch`, with the addition of \"``**``\" " -"which means \"this directory and all subdirectories, recursively\". In " -"other words, it enables recursive globbing::" -msgstr "" -"模式 (pattern) 和給 :mod:`fnmatch` 的一樣,加上 \"``**``\" 代表「目前目錄及所" -"有遞迴的子目錄」。也就是說它能夠做遞迴的 glob 比對: ::" - -#: ../../library/pathlib.rst:1186 -msgid "" +"[PosixPath('docs/conf.py')]\n" ">>> sorted(Path('.').glob('**/*.py'))\n" "[PosixPath('build/lib/pathlib.py'),\n" " PosixPath('docs/conf.py'),\n" @@ -2046,16 +2195,7 @@ msgstr "" " PosixPath('setup.py'),\n" " PosixPath('test_pathlib.py')]" -#: ../../library/pathlib.rst:1193 -msgid "" -"This method calls :meth:`Path.is_dir` on the top-level directory and " -"propagates any :exc:`OSError` exception that is raised. Subsequent :exc:" -"`OSError` exceptions from scanning directories are suppressed." -msgstr "" -"此方法在頂層目錄上呼叫 :meth:`Path.is_dir` 並傳遞引發的任何 :exc:`OSError` 例" -"外。將會抑制在目錄對於 :exc:`OSError` 例外的後續掃描。" - -#: ../../library/pathlib.rst:1197 ../../library/pathlib.rst:1229 +#: ../../library/pathlib.rst:1293 msgid "" "By default, or when the *case_sensitive* keyword-only argument is set to " "``None``, this method matches paths using platform-specific casing rules: " @@ -2067,13 +2207,14 @@ msgstr "" "在 Windows 上不區分大小寫。將 *case_sensitive* 設成 ``True`` 或 ``False`` 會" "覆寫這個行為。" -#: ../../library/pathlib.rst:1203 +#: ../../library/pathlib.rst:1298 msgid "" -"Using the \"``**``\" pattern in large directory trees may consume an " -"inordinate amount of time." -msgstr "在很大的目錄樹裡使用 \"``**``\" 可能會耗費過多的時間。" +"By default, or when the *recurse_symlinks* keyword-only argument is set to " +"``False``, this method follows symlinks except when expanding \"``**``\" " +"wildcards. Set *recurse_symlinks* to ``True`` to always follow symlinks." +msgstr "" -#: ../../library/pathlib.rst:1206 +#: ../../library/pathlib.rst:1302 msgid "" "Raises an :ref:`auditing event ` ``pathlib.Path.glob`` with " "arguments ``self``, ``pattern``." @@ -2081,41 +2222,33 @@ msgstr "" "引發一個附帶引數 ``self``、``pattern`` 的\\ :ref:`稽核事件 ` " "``pathlib.Path.glob``。" -#: ../../library/pathlib.rst:1208 ../../library/pathlib.rst:1236 +#: ../../library/pathlib.rst:1307 ../../library/pathlib.rst:1332 +#, fuzzy +msgid "The *recurse_symlinks* parameter was added." +msgstr "新增 *follow_symlinks* 參數。" + +#: ../../library/pathlib.rst:1313 msgid "" -"Return only directories if *pattern* ends with a pathname components " -"separator (:data:`~os.sep` or :data:`~os.altsep`)." +"Any :exc:`OSError` exceptions raised from scanning the filesystem are " +"suppressed. In previous versions, such exceptions are suppressed in many " +"cases, but not all." msgstr "" -"如果 *pattern* 以路徑名稱組成的分隔符號(:data:`~os.sep` 或 :data:`~os." -"altsep`)作結尾則只會回傳目錄。" -#: ../../library/pathlib.rst:1218 +#: ../../library/pathlib.rst:1321 +#, fuzzy msgid "" "Glob the given relative *pattern* recursively. This is like calling :func:" -"`Path.glob` with \"``**/``\" added in front of the *pattern*, where " -"*patterns* are the same as for :mod:`fnmatch`::" +"`Path.glob` with \"``**/``\" added in front of the *pattern*." msgstr "" "遞迴地 glob 給定的相對 *pattern*。這相當於在給定的相對 *pattern* 前面加上 " "\"``**/``\" 並呼叫 :func:`Path.glob`,其中 *patterns* 和給 :mod:`fnmatch` 的" "相同: ::" -#: ../../library/pathlib.rst:1222 -msgid "" -">>> sorted(Path().rglob(\"*.py\"))\n" -"[PosixPath('build/lib/pathlib.py'),\n" -" PosixPath('docs/conf.py'),\n" -" PosixPath('pathlib.py'),\n" -" PosixPath('setup.py'),\n" -" PosixPath('test_pathlib.py')]" +#: ../../library/pathlib.rst:1325 +msgid ":ref:`pathlib-pattern-language` and :meth:`Path.glob` documentation." msgstr "" -">>> sorted(Path().rglob(\"*.py\"))\n" -"[PosixPath('build/lib/pathlib.py'),\n" -" PosixPath('docs/conf.py'),\n" -" PosixPath('pathlib.py'),\n" -" PosixPath('setup.py'),\n" -" PosixPath('test_pathlib.py')]" -#: ../../library/pathlib.rst:1234 +#: ../../library/pathlib.rst:1327 msgid "" "Raises an :ref:`auditing event ` ``pathlib.Path.rglob`` with " "arguments ``self``, ``pattern``." @@ -2123,13 +2256,13 @@ msgstr "" "引發一個附帶引數 ``self``、``pattern`` 的\\ :ref:`稽核事件 ` " "``pathlib.Path.rglob``。" -#: ../../library/pathlib.rst:1246 +#: ../../library/pathlib.rst:1341 msgid "" "Generate the file names in a directory tree by walking the tree either top-" "down or bottom-up." msgstr "透過由上而下或由下而上地走訪目錄樹產生目錄樹裡的檔案名稱。" -#: ../../library/pathlib.rst:1249 +#: ../../library/pathlib.rst:1344 msgid "" "For each directory in the directory tree rooted at *self* (including *self* " "but excluding '.' and '..'), the method yields a 3-tuple of ``(dirpath, " @@ -2138,7 +2271,7 @@ msgstr "" "對每個以 *self* 為根且在目錄樹裡的目錄(包含 *self* 但不包含 '.' 和 '..' )," "此方法會 yield 一個 ``(dirpath, dirnames, filenames)`` 的三元素元組。" -#: ../../library/pathlib.rst:1253 +#: ../../library/pathlib.rst:1348 msgid "" "*dirpath* is a :class:`Path` to the directory currently being walked, " "*dirnames* is a list of strings for the names of subdirectories in *dirpath* " @@ -2153,7 +2286,7 @@ msgstr "" "裡檔案或目錄的完整路徑(以 *self* 開頭),可以使用 ``dirpath / name``。會根據" "檔案系統來決定串列是否有排序。" -#: ../../library/pathlib.rst:1261 +#: ../../library/pathlib.rst:1356 msgid "" "If the optional argument *top_down* is true (which is the default), the " "triple for a directory is generated before the triples for any of its " @@ -2169,7 +2302,7 @@ msgstr "" "不論 *top_down* 的值是什麼,子目錄的串列會在走訪該目錄及其子目錄的三元素元組" "之前取得。" -#: ../../library/pathlib.rst:1269 +#: ../../library/pathlib.rst:1364 msgid "" "When *top_down* is true, the caller can modify the *dirnames* list in-place " "(for example, using :keyword:`del` or slice assignment), and :meth:`Path." @@ -2189,7 +2322,7 @@ msgstr "" "*dirnames* 對 :meth:`Path.walk` 的行為沒有影響,因為 *dirnames* 裡的目錄已經" "在 *dirnames* yield 給呼叫者之前被產生。" -#: ../../library/pathlib.rst:1279 +#: ../../library/pathlib.rst:1374 msgid "" "By default, errors from :func:`os.scandir` are ignored. If the optional " "argument *on_error* is specified, it should be a callable; it will be called " @@ -2202,7 +2335,7 @@ msgstr "" "這個可呼叫物件可以處理錯誤以繼續走訪,或者再次引發錯誤來停止走訪。注意,檔案" "名稱可以從例外物件的 ``filename`` 屬性來取得。" -#: ../../library/pathlib.rst:1285 +#: ../../library/pathlib.rst:1380 msgid "" "By default, :meth:`Path.walk` does not follow symbolic links, and instead " "adds them to the *filenames* list. Set *follow_symlinks* to true to resolve " @@ -2215,7 +2348,7 @@ msgstr "" "適當的 *dirnames* 和 *filenames*,而因此訪問到符號連結指向的目錄(在有支援符" "號連結的地方)。" -#: ../../library/pathlib.rst:1292 +#: ../../library/pathlib.rst:1387 msgid "" "Be aware that setting *follow_symlinks* to true can lead to infinite " "recursion if a link points to a parent directory of itself. :meth:`Path." @@ -2224,7 +2357,7 @@ msgstr "" "需要注意的是如果符號連結指向一個其本身的父目錄,則將 *follow_symlinks* 設定" "為 true 會導致無窮的遞迴。:meth:`Path.walk` 不會紀錄其已經訪問過的目錄。" -#: ../../library/pathlib.rst:1297 +#: ../../library/pathlib.rst:1392 msgid "" ":meth:`Path.walk` assumes the directories it walks are not modified during " "execution. For example, if a directory from *dirnames* has been replaced " @@ -2237,7 +2370,7 @@ msgstr "" "meth:`Path.walk` 依然會試著往下進入它。為了防止這樣的行為,可以從 *dirnames* " "適當地移除目錄。" -#: ../../library/pathlib.rst:1305 +#: ../../library/pathlib.rst:1400 msgid "" "Unlike :func:`os.walk`, :meth:`Path.walk` lists symlinks to directories in " "*filenames* if *follow_symlinks* is false." @@ -2245,7 +2378,7 @@ msgstr "" "如果 *follow_symlinks* 是 false,和 :func:`os.walk` 行為不同的是 :meth:`Path." "walk` 會將指向目錄的符號連結放在 *filenames* 串列。" -#: ../../library/pathlib.rst:1308 +#: ../../library/pathlib.rst:1403 msgid "" "This example displays the number of bytes used by all files in each " "directory, while ignoring ``__pycache__`` directories::" @@ -2253,7 +2386,7 @@ msgstr "" "這個範例會顯示在每個目錄裡所有檔案使用的位元組數量,同時間忽略 " "``__pycache__`` 目錄: ::" -#: ../../library/pathlib.rst:1311 +#: ../../library/pathlib.rst:1406 msgid "" "from pathlib import Path\n" "for root, dirs, files in Path(\"cpython/Lib/concurrent\")." @@ -2283,7 +2416,7 @@ msgstr "" " if '__pycache__' in dirs:\n" " dirs.remove('__pycache__')" -#: ../../library/pathlib.rst:1324 +#: ../../library/pathlib.rst:1419 msgid "" "This next example is a simple implementation of :func:`shutil.rmtree`. " "Walking the tree bottom-up is essential as :func:`rmdir` doesn't allow " @@ -2292,7 +2425,7 @@ msgstr "" "下一個範例是 :func:`shutil.rmtree` 的一個簡單的實作方式。由下而上走訪目錄樹是" "必要的,因為 :func:`rmdir` 不允許在目錄為空之前刪除它: ::" -#: ../../library/pathlib.rst:1328 +#: ../../library/pathlib.rst:1423 msgid "" "# Delete everything reachable from the directory \"top\".\n" "# CAUTION: This is dangerous! For example, if top == Path('/'),\n" @@ -2304,11 +2437,11 @@ msgid "" " (root / name).rmdir()" msgstr "" -#: ../../library/pathlib.rst:1341 +#: ../../library/pathlib.rst:1436 msgid "Creating files and directories" msgstr "建立檔案與目錄" -#: ../../library/pathlib.rst:1345 +#: ../../library/pathlib.rst:1440 msgid "" "Create a file at this given path. If *mode* is given, it is combined with " "the process's ``umask`` value to determine the file mode and access flags. " @@ -2320,13 +2453,13 @@ msgstr "" "合,以確定檔案模式和存取旗標。當檔案已經存在時,若 *exist_ok* 為 true 則函式" "不會失敗(其變更時間會被更新為當下時間),否則會引發 :exc:`FileExistsError`。" -#: ../../library/pathlib.rst:1352 +#: ../../library/pathlib.rst:1447 msgid "" "The :meth:`~Path.open`, :meth:`~Path.write_text` and :meth:`~Path." "write_bytes` methods are often used to create files." msgstr "" -#: ../../library/pathlib.rst:1358 +#: ../../library/pathlib.rst:1453 msgid "" "Create a new directory at this given path. If *mode* is given, it is " "combined with the process's ``umask`` value to determine the file mode and " @@ -2336,7 +2469,7 @@ msgstr "" "``umask`` 值來決定檔案模式與存取旗標 (access flag)。如果路徑已經存在,會引" "發 :exc:`FileExistsError`。" -#: ../../library/pathlib.rst:1363 +#: ../../library/pathlib.rst:1458 msgid "" "If *parents* is true, any missing parents of this path are created as " "needed; they are created with the default permissions without taking *mode* " @@ -2345,7 +2478,7 @@ msgstr "" "如果 *parents* 是 true,則任何缺少的父路徑都會依需要被建立;它們不考慮 " "*mode* 而會以預設的權限來建立(模仿 POSIX 的 ``mkdir -p`` 指令)。" -#: ../../library/pathlib.rst:1367 +#: ../../library/pathlib.rst:1462 msgid "" "If *parents* is false (the default), a missing parent raises :exc:" "`FileNotFoundError`." @@ -2353,7 +2486,7 @@ msgstr "" "如果 *parents* 是 false(預設值),缺少的父路徑會引發 :exc:" "`FileNotFoundError`。" -#: ../../library/pathlib.rst:1370 +#: ../../library/pathlib.rst:1465 msgid "" "If *exist_ok* is false (the default), :exc:`FileExistsError` is raised if " "the target directory already exists." @@ -2361,7 +2494,7 @@ msgstr "" "如果 *exist_ok* 是 false(預設值),則當目標目錄已經存在的話會引發 :exc:" "`FileExistsError`。" -#: ../../library/pathlib.rst:1373 +#: ../../library/pathlib.rst:1468 msgid "" "If *exist_ok* is true, :exc:`FileExistsError` will not be raised unless the " "given path already exists in the file system and is not a directory (same " @@ -2370,15 +2503,15 @@ msgstr "" "如果 *exist_ok* 是 true,只有當最後的路徑組成不是一個已存在的非目錄檔案,:" "exc:`FileExistsError` 例外會被忽略(與 POSIX 的 ``mkdir -p`` 指令行為相同)。" -#: ../../library/pathlib.rst:1377 +#: ../../library/pathlib.rst:1472 msgid "The *exist_ok* parameter was added." msgstr "新增 *exist_ok* 參數。" -#: ../../library/pathlib.rst:1383 +#: ../../library/pathlib.rst:1478 msgid "Make this path a symbolic link pointing to *target*." msgstr "使這個路徑成為一個指向 *target* 的符號連結。" -#: ../../library/pathlib.rst:1385 +#: ../../library/pathlib.rst:1480 msgid "" "On Windows, a symlink represents either a file or a directory, and does not " "morph to the target dynamically. If the target is present, the type of the " @@ -2391,7 +2524,7 @@ msgstr "" "*target_is_directory* 是 true,該符號連結會被建立成目錄,如果不是則建立成檔案" "(預設值)。在非 Windows 平台上,*target_is_directory* 會被忽略。" -#: ../../library/pathlib.rst:1393 +#: ../../library/pathlib.rst:1488 msgid "" ">>> p = Path('mylink')\n" ">>> p.symlink_to('setup.py')\n" @@ -2411,25 +2544,37 @@ msgstr "" ">>> p.lstat().st_size\n" "8" -#: ../../library/pathlib.rst:1403 +#: ../../library/pathlib.rst:1498 msgid "" "The order of arguments (link, target) is the reverse of :func:`os.symlink`'s." msgstr "引數的順序 (link, target) 和 :func:`os.symlink` 相反。" -#: ../../library/pathlib.rst:1409 +#: ../../library/pathlib.rst:1501 +msgid "" +"Raises :exc:`UnsupportedOperation` if :func:`os.symlink` is not available. " +"In previous versions, :exc:`NotImplementedError` was raised." +msgstr "" + +#: ../../library/pathlib.rst:1508 msgid "Make this path a hard link to the same file as *target*." msgstr "使這個路徑成為與 *target* 相同檔案的一個硬連結 (hard link)。" -#: ../../library/pathlib.rst:1412 +#: ../../library/pathlib.rst:1511 msgid "" "The order of arguments (link, target) is the reverse of :func:`os.link`'s." msgstr "引數的順序 (link, target) 和 :func:`os.link` 相反。" -#: ../../library/pathlib.rst:1419 +#: ../../library/pathlib.rst:1516 +msgid "" +"Raises :exc:`UnsupportedOperation` if :func:`os.link` is not available. In " +"previous versions, :exc:`NotImplementedError` was raised." +msgstr "" + +#: ../../library/pathlib.rst:1522 msgid "Renaming and deleting" msgstr "" -#: ../../library/pathlib.rst:1423 +#: ../../library/pathlib.rst:1526 msgid "" "Rename this file or directory to the given *target*, and return a new :class:" "`!Path` instance pointing to *target*. On Unix, if *target* exists and is a " @@ -2442,7 +2587,7 @@ msgstr "" "限,則會在不顯示訊息的情況下進行取代。在 Windows 系統上,若 *target* 存在,則" "會引發 :exc:`FileExistsError` 錯誤。*target* 可以是字串或另一個路徑物件: ::" -#: ../../library/pathlib.rst:1429 +#: ../../library/pathlib.rst:1532 msgid "" ">>> p = Path('foo')\n" ">>> p.open('w').write('some text')\n" @@ -2462,7 +2607,7 @@ msgstr "" ">>> target.open().read()\n" "'some text'" -#: ../../library/pathlib.rst:1438 ../../library/pathlib.rst:1454 +#: ../../library/pathlib.rst:1541 ../../library/pathlib.rst:1557 msgid "" "The target path may be absolute or relative. Relative paths are interpreted " "relative to the current working directory, *not* the directory of the :class:" @@ -2471,17 +2616,17 @@ msgstr "" "目標路徑可以是絕對路徑或相對路徑。相對路徑會相對於當前的工作目錄進行解釋,*而" "不是*\\ 相對於 :class:`!Path` 物件所在的目錄。" -#: ../../library/pathlib.rst:1442 +#: ../../library/pathlib.rst:1545 msgid "" "It is implemented in terms of :func:`os.rename` and gives the same " "guarantees." msgstr "此功能是使用 :func:`os.rename` 實現的,並提供相同的保證。" -#: ../../library/pathlib.rst:1444 ../../library/pathlib.rst:1458 +#: ../../library/pathlib.rst:1547 ../../library/pathlib.rst:1561 msgid "Added return value, return the new :class:`!Path` instance." msgstr "新增了回傳值,回傳新的 :class:`!Path` 實例。" -#: ../../library/pathlib.rst:1450 +#: ../../library/pathlib.rst:1553 msgid "" "Rename this file or directory to the given *target*, and return a new :class:" "`!Path` instance pointing to *target*. If *target* points to an existing " @@ -2490,13 +2635,13 @@ msgstr "" "將此檔案或目錄重新命名為給定的 *target*,並回傳一個指向 *target* 的新 :class:" "`!Path` 實例。如果 *target* 指向一個現有的檔案或空目錄,它將被無條件地取代。" -#: ../../library/pathlib.rst:1464 +#: ../../library/pathlib.rst:1567 msgid "" "Remove this file or symbolic link. If the path points to a directory, use :" "func:`Path.rmdir` instead." msgstr "移除這個檔案或符號連結。如果路徑指向目錄,請改用 :func:`Path.rmdir`。" -#: ../../library/pathlib.rst:1467 +#: ../../library/pathlib.rst:1570 msgid "" "If *missing_ok* is false (the default), :exc:`FileNotFoundError` is raised " "if the path does not exist." @@ -2504,7 +2649,7 @@ msgstr "" "如果 *missing_ok* 是 false(預設值),:exc:`FileNotFoundError` 會在路徑不存在" "時被引發。" -#: ../../library/pathlib.rst:1470 +#: ../../library/pathlib.rst:1573 msgid "" "If *missing_ok* is true, :exc:`FileNotFoundError` exceptions will be ignored " "(same behavior as the POSIX ``rm -f`` command)." @@ -2512,39 +2657,71 @@ msgstr "" "如果 *missing_ok* 是 true,:exc:`FileNotFoundError` 例外會被忽略(行為與 " "POSIX ``rm -f`` 指令相同)。" -#: ../../library/pathlib.rst:1473 +#: ../../library/pathlib.rst:1576 msgid "The *missing_ok* parameter was added." msgstr "新增 *missing_ok* 參數。" -#: ../../library/pathlib.rst:1479 +#: ../../library/pathlib.rst:1582 msgid "Remove this directory. The directory must be empty." msgstr "移除此目錄。該目錄必須為空。" -#: ../../library/pathlib.rst:1483 +#: ../../library/pathlib.rst:1586 msgid "Permissions and ownership" msgstr "" -#: ../../library/pathlib.rst:1487 +#: ../../library/pathlib.rst:1590 +#, fuzzy msgid "" -"Return the name of the user owning the file. :exc:`KeyError` is raised if " +"Return the name of the user owning the file. :exc:`KeyError` is raised if " "the file's user identifier (UID) isn't found in the system database." msgstr "" "回傳擁有該檔案的用戶名稱。如果在系統資料庫中找不到該檔案的使用者識別字 " "(UID),則會引發 :exc:`KeyError`。" -#: ../../library/pathlib.rst:1493 +#: ../../library/pathlib.rst:1593 +#, fuzzy msgid "" -"Return the name of the group owning the file. :exc:`KeyError` is raised if " +"This method normally follows symlinks; to get the owner of the symlink, add " +"the argument ``follow_symlinks=False``." +msgstr "" +"此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " +"``follow_symlinks=False``。" + +#: ../../library/pathlib.rst:1596 +msgid "" +"Raises :exc:`UnsupportedOperation` if the :mod:`pwd` module is not " +"available. In earlier versions, :exc:`NotImplementedError` was raised." +msgstr "" + +#: ../../library/pathlib.rst:1606 +#, fuzzy +msgid "" +"Return the name of the group owning the file. :exc:`KeyError` is raised if " "the file's group identifier (GID) isn't found in the system database." msgstr "" "回傳擁有該檔案的群組名稱。如果在系統資料庫裡找不到檔案的群組識別字 (GID) 會引" "發 :exc:`KeyError`。" -#: ../../library/pathlib.rst:1499 +#: ../../library/pathlib.rst:1609 +#, fuzzy +msgid "" +"This method normally follows symlinks; to get the group of the symlink, add " +"the argument ``follow_symlinks=False``." +msgstr "" +"此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " +"``follow_symlinks=False``。" + +#: ../../library/pathlib.rst:1612 +msgid "" +"Raises :exc:`UnsupportedOperation` if the :mod:`grp` module is not " +"available. In earlier versions, :exc:`NotImplementedError` was raised." +msgstr "" + +#: ../../library/pathlib.rst:1622 msgid "Change the file mode and permissions, like :func:`os.chmod`." msgstr "修改檔案模式 (file mode) 與權限,像 :func:`os.chmod` 一樣。" -#: ../../library/pathlib.rst:1501 +#: ../../library/pathlib.rst:1624 msgid "" "This method normally follows symlinks. Some Unix flavours support changing " "permissions on the symlink itself; on these platforms you may add the " @@ -2553,7 +2730,7 @@ msgstr "" "此方法通常會跟隨符號連結。一些 Unix 類型支援修改符號連結本身的權限;在這些平" "台上你可以加上引數 ``follow_symlinks=False`` 或使用 :meth:`~Path.lchmod`。" -#: ../../library/pathlib.rst:1507 +#: ../../library/pathlib.rst:1630 msgid "" ">>> p = Path('setup.py')\n" ">>> p.stat().st_mode\n" @@ -2569,7 +2746,7 @@ msgstr "" ">>> p.stat().st_mode\n" "33060" -#: ../../library/pathlib.rst:1520 +#: ../../library/pathlib.rst:1643 msgid "" "Like :meth:`Path.chmod` but, if the path points to a symbolic link, the " "symbolic link's mode is changed rather than its target's." @@ -2577,11 +2754,264 @@ msgstr "" "類似 :meth:`Path.chmod`,但如果該路徑指向一個符號連結,則符號連結的模式 " "(mode) 會被改變而不是其指向的目標。" -#: ../../library/pathlib.rst:1525 -msgid "Correspondence to tools in the :mod:`os` module" +#: ../../library/pathlib.rst:1650 +msgid "Pattern language" +msgstr "" + +#: ../../library/pathlib.rst:1652 +msgid "" +"The following wildcards are supported in patterns for :meth:`~PurePath." +"full_match`, :meth:`~Path.glob` and :meth:`~Path.rglob`:" +msgstr "" + +#: ../../library/pathlib.rst:1655 +msgid "``**`` (entire segment)" +msgstr "" + +#: ../../library/pathlib.rst:1656 +msgid "Matches any number of file or directory segments, including zero." +msgstr "" + +#: ../../library/pathlib.rst:1657 +msgid "``*`` (entire segment)" +msgstr "" + +#: ../../library/pathlib.rst:1658 +msgid "Matches one file or directory segment." +msgstr "" + +#: ../../library/pathlib.rst:1659 +msgid "``*`` (part of a segment)" +msgstr "" + +#: ../../library/pathlib.rst:1660 +msgid "Matches any number of non-separator characters, including zero." +msgstr "" + +#: ../../library/pathlib.rst:1661 +msgid "``?``" +msgstr "" + +#: ../../library/pathlib.rst:1662 +msgid "Matches one non-separator character." +msgstr "" + +#: ../../library/pathlib.rst:1663 +msgid "``[seq]``" +msgstr "" + +#: ../../library/pathlib.rst:1664 +msgid "Matches one character in *seq*." +msgstr "" + +#: ../../library/pathlib.rst:1665 +msgid "``[!seq]``" +msgstr "" + +#: ../../library/pathlib.rst:1666 +msgid "Matches one character not in *seq*." +msgstr "" + +#: ../../library/pathlib.rst:1668 +msgid "" +"For a literal match, wrap the meta-characters in brackets. For example, " +"``\"[?]\"`` matches the character ``\"?\"``." +msgstr "" + +#: ../../library/pathlib.rst:1671 +msgid "The \"``**``\" wildcard enables recursive globbing. A few examples:" +msgstr "" + +#: ../../library/pathlib.rst:1674 +msgid "Pattern" +msgstr "" + +#: ../../library/pathlib.rst:1674 +msgid "Meaning" +msgstr "" + +#: ../../library/pathlib.rst:1676 +msgid "\"``**/*``\"" +msgstr "" + +#: ../../library/pathlib.rst:1676 +msgid "Any path with at least one segment." +msgstr "" + +#: ../../library/pathlib.rst:1677 +msgid "\"``**/*.py``\"" +msgstr "" + +#: ../../library/pathlib.rst:1677 +msgid "Any path with a final segment ending \"``.py``\"." +msgstr "" + +#: ../../library/pathlib.rst:1678 +msgid "\"``assets/**``\"" +msgstr "" + +#: ../../library/pathlib.rst:1678 +msgid "Any path starting with \"``assets/``\"." +msgstr "" + +#: ../../library/pathlib.rst:1679 +msgid "\"``assets/**/*``\"" +msgstr "" + +#: ../../library/pathlib.rst:1679 +msgid "" +"Any path starting with \"``assets/``\", excluding \"``assets/``\" itself." +msgstr "" + +#: ../../library/pathlib.rst:1683 +msgid "" +"Globbing with the \"``**``\" wildcard visits every directory in the tree. " +"Large directory trees may take a long time to search." +msgstr "" + +#: ../../library/pathlib.rst:1686 +msgid "" +"Globbing with a pattern that ends with \"``**``\" returns both files and " +"directories. In previous versions, only directories were returned." +msgstr "" + +#: ../../library/pathlib.rst:1690 +msgid "" +"In :meth:`Path.glob` and :meth:`~Path.rglob`, a trailing slash may be added " +"to the pattern to match only directories." +msgstr "" + +#: ../../library/pathlib.rst:1693 +#, fuzzy +msgid "" +"Globbing with a pattern that ends with a pathname components separator (:" +"data:`~os.sep` or :data:`~os.altsep`) returns only directories." +msgstr "" +"如果 *pattern* 以路徑名稱組成的分隔符號(:data:`~os.sep` 或 :data:`~os." +"altsep`)作結尾則只會回傳目錄。" + +#: ../../library/pathlib.rst:1699 +#, fuzzy +msgid "Comparison to the :mod:`glob` module" msgstr "與 :mod:`os` 模組裡的工具的對應關係" -#: ../../library/pathlib.rst:1527 +#: ../../library/pathlib.rst:1701 +msgid "" +"The patterns accepted and results generated by :meth:`Path.glob` and :meth:" +"`Path.rglob` differ slightly from those by the :mod:`glob` module:" +msgstr "" + +#: ../../library/pathlib.rst:1704 +msgid "" +"Files beginning with a dot are not special in pathlib. This is like passing " +"``include_hidden=True`` to :func:`glob.glob`." +msgstr "" + +#: ../../library/pathlib.rst:1706 +msgid "" +"\"``**``\" pattern components are always recursive in pathlib. This is like " +"passing ``recursive=True`` to :func:`glob.glob`." +msgstr "" + +#: ../../library/pathlib.rst:1708 +msgid "" +"\"``**``\" pattern components do not follow symlinks by default in pathlib. " +"This behaviour has no equivalent in :func:`glob.glob`, but you can pass " +"``recurse_symlinks=True`` to :meth:`Path.glob` for compatible behaviour." +msgstr "" + +#: ../../library/pathlib.rst:1711 +msgid "" +"Like all :class:`PurePath` and :class:`Path` objects, the values returned " +"from :meth:`Path.glob` and :meth:`Path.rglob` don't include trailing slashes." +msgstr "" + +#: ../../library/pathlib.rst:1714 +msgid "" +"The values returned from pathlib's ``path.glob()`` and ``path.rglob()`` " +"include the *path* as a prefix, unlike the results of ``glob." +"glob(root_dir=path)``." +msgstr "" + +#: ../../library/pathlib.rst:1717 +msgid "" +"The values returned from pathlib's ``path.glob()`` and ``path.rglob()`` may " +"include *path* itself, for example when globbing \"``**``\", whereas the " +"results of ``glob.glob(root_dir=path)`` never include an empty string that " +"would correspond to *path*." +msgstr "" + +#: ../../library/pathlib.rst:1724 +#, fuzzy +msgid "Comparison to the :mod:`os` and :mod:`os.path` modules" +msgstr ":mod:`os` 和 :mod:`os.path`" + +#: ../../library/pathlib.rst:1726 +msgid "" +"pathlib implements path operations using :class:`PurePath` and :class:`Path` " +"objects, and so it's said to be *object-oriented*. On the other hand, the :" +"mod:`os` and :mod:`os.path` modules supply functions that work with low-" +"level ``str`` and ``bytes`` objects, which is a more *procedural* approach. " +"Some users consider the object-oriented style to be more readable." +msgstr "" + +#: ../../library/pathlib.rst:1732 +msgid "" +"Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths and :" +"ref:`paths relative to directory descriptors `. These features " +"aren't available in pathlib." +msgstr "" + +#: ../../library/pathlib.rst:1736 +msgid "" +"Python's ``str`` and ``bytes`` types, and portions of the :mod:`os` and :mod:" +"`os.path` modules, are written in C and are very speedy. pathlib is written " +"in pure Python and is often slower, but rarely slow enough to matter." +msgstr "" + +#: ../../library/pathlib.rst:1740 +msgid "" +"pathlib's path normalization is slightly more opinionated and consistent " +"than :mod:`os.path`. For example, whereas :func:`os.path.abspath` eliminates " +"\"``..``\" segments from a path, which may change its meaning if symlinks " +"are involved, :meth:`Path.absolute` preserves these segments for greater " +"safety." +msgstr "" + +#: ../../library/pathlib.rst:1745 +msgid "" +"pathlib's path normalization may render it unsuitable for some applications:" +msgstr "" + +#: ../../library/pathlib.rst:1747 +msgid "" +"pathlib normalizes ``Path(\"my_folder/\")`` to ``Path(\"my_folder\")``, " +"which changes a path's meaning when supplied to various operating system " +"APIs and command-line utilities. Specifically, the absence of a trailing " +"separator may allow the path to be resolved as either a file or directory, " +"rather than a directory only." +msgstr "" + +#: ../../library/pathlib.rst:1752 +msgid "" +"pathlib normalizes ``Path(\"./my_program\")`` to ``Path(\"my_program\")``, " +"which changes a path's meaning when used as an executable search path, such " +"as in a shell or when spawning a child process. Specifically, the absence of " +"a separator in the path may force it to be looked up in :envvar:`PATH` " +"rather than the current directory." +msgstr "" + +#: ../../library/pathlib.rst:1758 +msgid "" +"As a consequence of these differences, pathlib is not a drop-in replacement " +"for :mod:`os.path`." +msgstr "" + +#: ../../library/pathlib.rst:1763 +msgid "Corresponding tools" +msgstr "" + +#: ../../library/pathlib.rst:1765 msgid "" "Below is a table mapping various :mod:`os` functions to their corresponding :" "class:`PurePath`/:class:`Path` equivalent." @@ -2589,267 +3019,267 @@ msgstr "" "以下是一張表格,對應許多 :mod:`os` 函式及其相符於 :class:`PurePath`/:class:" "`Path` 的項目。" -#: ../../library/pathlib.rst:1531 +#: ../../library/pathlib.rst:1769 msgid ":mod:`os` and :mod:`os.path`" msgstr ":mod:`os` 和 :mod:`os.path`" -#: ../../library/pathlib.rst:1531 +#: ../../library/pathlib.rst:1769 msgid ":mod:`pathlib`" msgstr ":mod:`pathlib`" -#: ../../library/pathlib.rst:1533 +#: ../../library/pathlib.rst:1771 msgid ":func:`os.path.dirname`" msgstr ":func:`os.path.dirname`" -#: ../../library/pathlib.rst:1533 +#: ../../library/pathlib.rst:1771 msgid ":attr:`PurePath.parent`" msgstr ":attr:`PurePath.parent`" -#: ../../library/pathlib.rst:1534 +#: ../../library/pathlib.rst:1772 msgid ":func:`os.path.basename`" msgstr ":func:`os.path.basename`" -#: ../../library/pathlib.rst:1534 +#: ../../library/pathlib.rst:1772 msgid ":attr:`PurePath.name`" msgstr ":attr:`PurePath.name`" -#: ../../library/pathlib.rst:1535 +#: ../../library/pathlib.rst:1773 msgid ":func:`os.path.splitext`" msgstr ":func:`os.path.splitext`" -#: ../../library/pathlib.rst:1535 +#: ../../library/pathlib.rst:1773 msgid ":attr:`PurePath.stem`, :attr:`PurePath.suffix`" msgstr ":attr:`PurePath.stem` 和 :attr:`PurePath.suffix`" -#: ../../library/pathlib.rst:1536 +#: ../../library/pathlib.rst:1774 msgid ":func:`os.path.join`" msgstr ":func:`os.path.join`" -#: ../../library/pathlib.rst:1536 +#: ../../library/pathlib.rst:1774 msgid ":meth:`PurePath.joinpath`" msgstr ":meth:`PurePath.joinpath`" -#: ../../library/pathlib.rst:1537 +#: ../../library/pathlib.rst:1775 msgid ":func:`os.path.isabs`" msgstr ":func:`os.path.isabs`" -#: ../../library/pathlib.rst:1537 +#: ../../library/pathlib.rst:1775 msgid ":meth:`PurePath.is_absolute`" msgstr ":meth:`PurePath.is_absolute`" -#: ../../library/pathlib.rst:1538 +#: ../../library/pathlib.rst:1776 msgid ":func:`os.path.relpath`" msgstr ":func:`os.path.relpath`" -#: ../../library/pathlib.rst:1538 +#: ../../library/pathlib.rst:1776 msgid ":meth:`PurePath.relative_to` [1]_" msgstr ":meth:`PurePath.relative_to` [1]_" -#: ../../library/pathlib.rst:1539 +#: ../../library/pathlib.rst:1777 msgid ":func:`os.path.expanduser`" msgstr ":func:`os.path.expanduser`" -#: ../../library/pathlib.rst:1539 +#: ../../library/pathlib.rst:1777 msgid ":meth:`Path.expanduser` [2]_" msgstr ":meth:`Path.expanduser` [2]_" -#: ../../library/pathlib.rst:1540 +#: ../../library/pathlib.rst:1778 msgid ":func:`os.path.realpath`" msgstr ":func:`os.path.realpath`" -#: ../../library/pathlib.rst:1540 +#: ../../library/pathlib.rst:1778 msgid ":meth:`Path.resolve`" msgstr ":meth:`Path.resolve`" -#: ../../library/pathlib.rst:1541 +#: ../../library/pathlib.rst:1779 msgid ":func:`os.path.abspath`" msgstr ":func:`os.path.abspath`" -#: ../../library/pathlib.rst:1541 +#: ../../library/pathlib.rst:1779 msgid ":meth:`Path.absolute` [3]_" msgstr ":meth:`Path.absolute` [3]_" -#: ../../library/pathlib.rst:1542 +#: ../../library/pathlib.rst:1780 msgid ":func:`os.path.exists`" msgstr ":func:`os.path.exists`" -#: ../../library/pathlib.rst:1542 +#: ../../library/pathlib.rst:1780 msgid ":meth:`Path.exists`" msgstr ":meth:`Path.exists`" -#: ../../library/pathlib.rst:1543 +#: ../../library/pathlib.rst:1781 msgid ":func:`os.path.isfile`" msgstr ":func:`os.path.isfile`" -#: ../../library/pathlib.rst:1543 +#: ../../library/pathlib.rst:1781 msgid ":meth:`Path.is_file`" msgstr ":meth:`Path.is_file`" -#: ../../library/pathlib.rst:1544 +#: ../../library/pathlib.rst:1782 msgid ":func:`os.path.isdir`" msgstr ":func:`os.path.isdir`" -#: ../../library/pathlib.rst:1544 +#: ../../library/pathlib.rst:1782 msgid ":meth:`Path.is_dir`" msgstr ":meth:`Path.is_dir`" -#: ../../library/pathlib.rst:1545 +#: ../../library/pathlib.rst:1783 msgid ":func:`os.path.islink`" msgstr ":func:`os.path.islink`" -#: ../../library/pathlib.rst:1545 +#: ../../library/pathlib.rst:1783 msgid ":meth:`Path.is_symlink`" msgstr ":meth:`Path.is_symlink`" -#: ../../library/pathlib.rst:1546 +#: ../../library/pathlib.rst:1784 msgid ":func:`os.path.isjunction`" msgstr ":func:`os.path.isjunction`" -#: ../../library/pathlib.rst:1546 +#: ../../library/pathlib.rst:1784 msgid ":meth:`Path.is_junction`" msgstr ":meth:`Path.is_junction`" -#: ../../library/pathlib.rst:1547 +#: ../../library/pathlib.rst:1785 msgid ":func:`os.path.ismount`" msgstr ":func:`os.path.ismount`" -#: ../../library/pathlib.rst:1547 +#: ../../library/pathlib.rst:1785 msgid ":meth:`Path.is_mount`" msgstr ":meth:`Path.is_mount`" -#: ../../library/pathlib.rst:1548 +#: ../../library/pathlib.rst:1786 msgid ":func:`os.path.samefile`" msgstr ":func:`os.path.samefile`" -#: ../../library/pathlib.rst:1548 +#: ../../library/pathlib.rst:1786 msgid ":meth:`Path.samefile`" msgstr ":meth:`Path.samefile`" -#: ../../library/pathlib.rst:1549 +#: ../../library/pathlib.rst:1787 msgid ":func:`os.getcwd`" msgstr ":func:`os.getcwd`" -#: ../../library/pathlib.rst:1549 +#: ../../library/pathlib.rst:1787 msgid ":meth:`Path.cwd`" msgstr ":meth:`Path.cwd`" -#: ../../library/pathlib.rst:1550 +#: ../../library/pathlib.rst:1788 msgid ":func:`os.stat`" msgstr ":func:`os.stat`" -#: ../../library/pathlib.rst:1550 +#: ../../library/pathlib.rst:1788 msgid ":meth:`Path.stat`" msgstr ":meth:`Path.stat`" -#: ../../library/pathlib.rst:1551 +#: ../../library/pathlib.rst:1789 msgid ":func:`os.lstat`" msgstr ":func:`os.lstat`" -#: ../../library/pathlib.rst:1551 +#: ../../library/pathlib.rst:1789 msgid ":meth:`Path.lstat`" msgstr ":meth:`Path.lstat`" -#: ../../library/pathlib.rst:1552 +#: ../../library/pathlib.rst:1790 msgid ":func:`os.listdir`" msgstr ":func:`os.listdir`" -#: ../../library/pathlib.rst:1552 +#: ../../library/pathlib.rst:1790 msgid ":meth:`Path.iterdir`" msgstr ":meth:`Path.iterdir`" -#: ../../library/pathlib.rst:1553 +#: ../../library/pathlib.rst:1791 msgid ":func:`os.walk`" msgstr ":func:`os.walk`" -#: ../../library/pathlib.rst:1553 +#: ../../library/pathlib.rst:1791 msgid ":meth:`Path.walk` [4]_" msgstr ":meth:`Path.walk` [4]_" -#: ../../library/pathlib.rst:1554 +#: ../../library/pathlib.rst:1792 msgid ":func:`os.mkdir`, :func:`os.makedirs`" msgstr ":func:`os.mkdir`、:func:`os.makedirs`" -#: ../../library/pathlib.rst:1554 +#: ../../library/pathlib.rst:1792 msgid ":meth:`Path.mkdir`" msgstr ":meth:`Path.mkdir`" -#: ../../library/pathlib.rst:1555 +#: ../../library/pathlib.rst:1793 msgid ":func:`os.link`" msgstr ":func:`os.link`" -#: ../../library/pathlib.rst:1555 +#: ../../library/pathlib.rst:1793 msgid ":meth:`Path.hardlink_to`" msgstr ":meth:`Path.hardlink_to`" -#: ../../library/pathlib.rst:1556 +#: ../../library/pathlib.rst:1794 msgid ":func:`os.symlink`" msgstr ":func:`os.symlink`" -#: ../../library/pathlib.rst:1556 +#: ../../library/pathlib.rst:1794 msgid ":meth:`Path.symlink_to`" msgstr ":meth:`Path.symlink_to`" -#: ../../library/pathlib.rst:1557 +#: ../../library/pathlib.rst:1795 msgid ":func:`os.readlink`" msgstr ":func:`os.readlink`" -#: ../../library/pathlib.rst:1557 +#: ../../library/pathlib.rst:1795 msgid ":meth:`Path.readlink`" msgstr ":meth:`Path.readlink`" -#: ../../library/pathlib.rst:1558 +#: ../../library/pathlib.rst:1796 msgid ":func:`os.rename`" msgstr ":func:`os.rename`" -#: ../../library/pathlib.rst:1558 +#: ../../library/pathlib.rst:1796 msgid ":meth:`Path.rename`" msgstr ":meth:`Path.rename`" -#: ../../library/pathlib.rst:1559 +#: ../../library/pathlib.rst:1797 msgid ":func:`os.replace`" msgstr ":func:`os.replace`" -#: ../../library/pathlib.rst:1559 +#: ../../library/pathlib.rst:1797 msgid ":meth:`Path.replace`" msgstr ":meth:`Path.replace`" -#: ../../library/pathlib.rst:1560 +#: ../../library/pathlib.rst:1798 msgid ":func:`os.remove`, :func:`os.unlink`" msgstr ":func:`os.remove`、:func:`os.unlink`" -#: ../../library/pathlib.rst:1560 +#: ../../library/pathlib.rst:1798 msgid ":meth:`Path.unlink`" msgstr ":meth:`Path.unlink`" -#: ../../library/pathlib.rst:1561 +#: ../../library/pathlib.rst:1799 msgid ":func:`os.rmdir`" msgstr ":func:`os.rmdir`" -#: ../../library/pathlib.rst:1561 +#: ../../library/pathlib.rst:1799 msgid ":meth:`Path.rmdir`" msgstr ":meth:`Path.rmdir`" -#: ../../library/pathlib.rst:1562 +#: ../../library/pathlib.rst:1800 msgid ":func:`os.chmod`" msgstr ":func:`os.chmod`" -#: ../../library/pathlib.rst:1562 +#: ../../library/pathlib.rst:1800 msgid ":meth:`Path.chmod`" msgstr ":meth:`Path.chmod`" -#: ../../library/pathlib.rst:1563 +#: ../../library/pathlib.rst:1801 msgid ":func:`os.lchmod`" msgstr ":func:`os.lchmod`" -#: ../../library/pathlib.rst:1563 +#: ../../library/pathlib.rst:1801 msgid ":meth:`Path.lchmod`" msgstr ":meth:`Path.lchmod`" -#: ../../library/pathlib.rst:1567 +#: ../../library/pathlib.rst:1805 msgid "Footnotes" msgstr "註解" -#: ../../library/pathlib.rst:1568 +#: ../../library/pathlib.rst:1806 msgid "" ":func:`os.path.relpath` calls :func:`~os.path.abspath` to make paths " "absolute and remove \"``..``\" parts, whereas :meth:`PurePath.relative_to` " @@ -2857,21 +3287,21 @@ msgid "" "anchors differ (e.g. if one path is absolute and the other relative.)" msgstr "" -#: ../../library/pathlib.rst:1572 +#: ../../library/pathlib.rst:1810 msgid "" ":func:`os.path.expanduser` returns the path unchanged if the home directory " "can't be resolved, whereas :meth:`Path.expanduser` raises :exc:" "`RuntimeError`." msgstr "" -#: ../../library/pathlib.rst:1575 +#: ../../library/pathlib.rst:1813 msgid "" ":func:`os.path.abspath` removes \"``..``\" components without resolving " "symlinks, which may change the meaning of the path, whereas :meth:`Path." "absolute` leaves any \"``..``\" components in the path." msgstr "" -#: ../../library/pathlib.rst:1578 +#: ../../library/pathlib.rst:1816 msgid "" ":func:`os.walk` always follows symlinks when categorizing paths into " "*dirnames* and *filenames*, whereas :meth:`Path.walk` categorizes all " @@ -2885,3 +3315,99 @@ msgstr "path(路徑)" #: ../../library/pathlib.rst:11 msgid "operations" msgstr "operations(操作)" + +#~ msgid "" +#~ "File system calls on reserved paths can fail mysteriously or have " +#~ "unintended effects." +#~ msgstr "在保留路徑上的檔案系統呼叫會神秘地失敗或有意外的效果。" + +#~ msgid "" +#~ "If *pattern* is relative, the path can be either relative or absolute, " +#~ "and matching is done from the right::" +#~ msgstr "" +#~ "如果 *pattern* 是相對的,則路徑可以是相對或絕對的,而且會從右邊來完成比" +#~ "對: ::" + +#~ msgid "" +#~ "If *pattern* is absolute, the path must be absolute, and the whole path " +#~ "must match::" +#~ msgstr "" +#~ "如果 *pattern* 是絕對的,則路徑必須是絕對的,且整個路徑都要比對到: ::" + +#~ msgid "" +#~ ">>> PurePath('/a.py').match('/*.py')\n" +#~ "True\n" +#~ ">>> PurePath('a/b.py').match('/*.py')\n" +#~ "False" +#~ msgstr "" +#~ ">>> PurePath('/a.py').match('/*.py')\n" +#~ "True\n" +#~ ">>> PurePath('a/b.py').match('/*.py')\n" +#~ "False" + +#~ msgid "" +#~ "The *pattern* may be another path object; this speeds up matching the " +#~ "same pattern against multiple files::" +#~ msgstr "" +#~ "*pattern* 可以是另一個路徑物件;這會加速對多個檔案比對相同的樣式: ::" + +#~ msgid "" +#~ ">>> pattern = PurePath('*.py')\n" +#~ ">>> PurePath('a/b.py').match(pattern)\n" +#~ "True" +#~ msgstr "" +#~ ">>> pattern = PurePath('*.py')\n" +#~ ">>> PurePath('a/b.py').match(pattern)\n" +#~ "True" + +#~ msgid "Accepts an object implementing the :class:`os.PathLike` interface." +#~ msgstr "接受一個有實作 :class:`os.PathLike` 介面的物件。" + +#~ msgid "" +#~ ">>> sorted(Path('.').glob('*.py'))\n" +#~ "[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." +#~ "py')]\n" +#~ ">>> sorted(Path('.').glob('*/*.py'))\n" +#~ "[PosixPath('docs/conf.py')]" +#~ msgstr "" +#~ ">>> sorted(Path('.').glob('*.py'))\n" +#~ "[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." +#~ "py')]\n" +#~ ">>> sorted(Path('.').glob('*/*.py'))\n" +#~ "[PosixPath('docs/conf.py')]" + +#~ msgid "" +#~ "Patterns are the same as for :mod:`fnmatch`, with the addition of " +#~ "\"``**``\" which means \"this directory and all subdirectories, " +#~ "recursively\". In other words, it enables recursive globbing::" +#~ msgstr "" +#~ "模式 (pattern) 和給 :mod:`fnmatch` 的一樣,加上 \"``**``\" 代表「目前目錄" +#~ "及所有遞迴的子目錄」。也就是說它能夠做遞迴的 glob 比對: ::" + +#~ msgid "" +#~ "This method calls :meth:`Path.is_dir` on the top-level directory and " +#~ "propagates any :exc:`OSError` exception that is raised. Subsequent :exc:" +#~ "`OSError` exceptions from scanning directories are suppressed." +#~ msgstr "" +#~ "此方法在頂層目錄上呼叫 :meth:`Path.is_dir` 並傳遞引發的任何 :exc:" +#~ "`OSError` 例外。將會抑制在目錄對於 :exc:`OSError` 例外的後續掃描。" + +#~ msgid "" +#~ "Using the \"``**``\" pattern in large directory trees may consume an " +#~ "inordinate amount of time." +#~ msgstr "在很大的目錄樹裡使用 \"``**``\" 可能會耗費過多的時間。" + +#~ msgid "" +#~ ">>> sorted(Path().rglob(\"*.py\"))\n" +#~ "[PosixPath('build/lib/pathlib.py'),\n" +#~ " PosixPath('docs/conf.py'),\n" +#~ " PosixPath('pathlib.py'),\n" +#~ " PosixPath('setup.py'),\n" +#~ " PosixPath('test_pathlib.py')]" +#~ msgstr "" +#~ ">>> sorted(Path().rglob(\"*.py\"))\n" +#~ "[PosixPath('build/lib/pathlib.py'),\n" +#~ " PosixPath('docs/conf.py'),\n" +#~ " PosixPath('pathlib.py'),\n" +#~ " PosixPath('setup.py'),\n" +#~ " PosixPath('test_pathlib.py')]" diff --git a/library/pdb.po b/library/pdb.po index 152baf4aca..bd47a844d5 100644 --- a/library/pdb.po +++ b/library/pdb.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -108,8 +108,8 @@ msgstr "" #: ../../library/pdb.rst:65 msgid "" -"> ...(3)double()\n" -"-> return x * 2\n" +"> ...(2)double()\n" +"-> breakpoint()\n" "(Pdb) p x\n" "3\n" "(Pdb) continue\n" @@ -193,13 +193,20 @@ msgid "" "(Pdb)" msgstr "" -#: ../../library/pdb.rst:127 +#: ../../library/pdb.rst:126 +msgid "" +"The implementation of :pep:`667` means that name assignments made via " +"``pdb`` will immediately affect the active scope, even when running inside " +"an :term:`optimized scope`." +msgstr "" + +#: ../../library/pdb.rst:132 msgid "" "The module defines the following functions; each enters the debugger in a " "slightly different way:" msgstr "" -#: ../../library/pdb.rst:132 +#: ../../library/pdb.rst:137 msgid "" "Execute the *statement* (given as a string or a code object) under debugger " "control. The debugger prompt appears before any code is executed; you can " @@ -211,14 +218,14 @@ msgid "" "`exec` or :func:`eval` functions.)" msgstr "" -#: ../../library/pdb.rst:144 +#: ../../library/pdb.rst:149 msgid "" "Evaluate the *expression* (given as a string or a code object) under " "debugger control. When :func:`runeval` returns, it returns the value of the " "*expression*. Otherwise this function is similar to :func:`run`." msgstr "" -#: ../../library/pdb.rst:151 +#: ../../library/pdb.rst:156 msgid "" "Call the *function* (a function or method object, not a string) with the " "given arguments. When :func:`runcall` returns, it returns whatever the " @@ -226,7 +233,7 @@ msgid "" "is entered." msgstr "" -#: ../../library/pdb.rst:159 +#: ../../library/pdb.rst:164 msgid "" "Enter the debugger at the calling stack frame. This is useful to hard-code " "a breakpoint at a given point in a program, even if the code is not " @@ -234,11 +241,17 @@ msgid "" "is printed to the console just before debugging begins." msgstr "" -#: ../../library/pdb.rst:164 +#: ../../library/pdb.rst:169 msgid "The keyword-only argument *header*." msgstr "" -#: ../../library/pdb.rst:170 +#: ../../library/pdb.rst:172 +msgid "" +":func:`set_trace` will enter the debugger immediately, rather than on the " +"next line of code to be executed." +msgstr "" + +#: ../../library/pdb.rst:178 msgid "" "Enter post-mortem debugging of the given *traceback* object. If no " "*traceback* is given, it uses the one of the exception that is currently " @@ -246,37 +259,36 @@ msgid "" "used)." msgstr "" -#: ../../library/pdb.rst:178 +#: ../../library/pdb.rst:186 msgid "" -"Enter post-mortem debugging of the traceback found in :data:`sys." -"last_traceback`." +"Enter post-mortem debugging of the exception found in :data:`sys.last_exc`." msgstr "" -#: ../../library/pdb.rst:182 +#: ../../library/pdb.rst:190 msgid "" "The ``run*`` functions and :func:`set_trace` are aliases for instantiating " "the :class:`Pdb` class and calling the method of the same name. If you want " "to access further features, you have to do this yourself:" msgstr "" -#: ../../library/pdb.rst:189 +#: ../../library/pdb.rst:197 msgid ":class:`Pdb` is the debugger class." msgstr "" -#: ../../library/pdb.rst:191 +#: ../../library/pdb.rst:199 msgid "" "The *completekey*, *stdin* and *stdout* arguments are passed to the " "underlying :class:`cmd.Cmd` class; see the description there." msgstr "" -#: ../../library/pdb.rst:194 +#: ../../library/pdb.rst:202 msgid "" "The *skip* argument, if given, must be an iterable of glob-style module name " "patterns. The debugger will not step into frames that originate in a module " "that matches one of these patterns. [1]_" msgstr "" -#: ../../library/pdb.rst:198 +#: ../../library/pdb.rst:206 msgid "" "By default, Pdb sets a handler for the SIGINT signal (which is sent when the " "user presses :kbd:`Ctrl-C` on the console) when you give a :pdbcmd:" @@ -285,48 +297,48 @@ msgid "" "set *nosigint* to true." msgstr "" -#: ../../library/pdb.rst:203 +#: ../../library/pdb.rst:211 msgid "" "The *readrc* argument defaults to true and controls whether Pdb will load ." "pdbrc files from the filesystem." msgstr "" -#: ../../library/pdb.rst:206 +#: ../../library/pdb.rst:214 msgid "Example call to enable tracing with *skip*::" msgstr "" -#: ../../library/pdb.rst:208 +#: ../../library/pdb.rst:216 msgid "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" msgstr "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" -#: ../../library/pdb.rst:210 +#: ../../library/pdb.rst:218 msgid "" "Raises an :ref:`auditing event ` ``pdb.Pdb`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``pdb.Pdb``。" -#: ../../library/pdb.rst:212 +#: ../../library/pdb.rst:220 msgid "Added the *skip* parameter." msgstr "" -#: ../../library/pdb.rst:215 +#: ../../library/pdb.rst:223 msgid "" "Added the *nosigint* parameter. Previously, a SIGINT handler was never set " "by Pdb." msgstr "" -#: ../../library/pdb.rst:219 +#: ../../library/pdb.rst:227 msgid "The *readrc* argument." msgstr "*readrc* 引數。" -#: ../../library/pdb.rst:227 +#: ../../library/pdb.rst:235 msgid "See the documentation for the functions explained above." msgstr "" -#: ../../library/pdb.rst:233 +#: ../../library/pdb.rst:241 msgid "Debugger Commands" msgstr "" -#: ../../library/pdb.rst:235 +#: ../../library/pdb.rst:243 msgid "" "The commands recognized by the debugger are listed below. Most commands can " "be abbreviated to one or two letters as indicated; e.g. ``h(elp)`` means " @@ -338,13 +350,13 @@ msgid "" "are separated by a vertical bar (``|``)." msgstr "" -#: ../../library/pdb.rst:244 +#: ../../library/pdb.rst:252 msgid "" "Entering a blank line repeats the last command entered. Exception: if the " "last command was a :pdbcmd:`list` command, the next 11 lines are listed." msgstr "" -#: ../../library/pdb.rst:247 +#: ../../library/pdb.rst:255 msgid "" "Commands that the debugger doesn't recognize are assumed to be Python " "statements and are executed in the context of the program being debugged. " @@ -355,14 +367,20 @@ msgid "" "is not changed." msgstr "" -#: ../../library/pdb.rst:255 +#: ../../library/pdb.rst:263 +msgid "" +"Expressions/Statements whose prefix is a pdb command are now correctly " +"identified and executed." +msgstr "" + +#: ../../library/pdb.rst:267 msgid "" "The debugger supports :ref:`aliases `. Aliases can have " "parameters which allows one a certain level of adaptability to the context " "under examination." msgstr "" -#: ../../library/pdb.rst:259 +#: ../../library/pdb.rst:271 msgid "" "Multiple commands may be entered on a single line, separated by ``;;``. (A " "single ``;`` is not used as it is the separator for multiple commands in a " @@ -373,7 +391,7 @@ msgid "" "\"\";\"``." msgstr "" -#: ../../library/pdb.rst:266 +#: ../../library/pdb.rst:278 msgid "" "To set a temporary global variable, use a *convenience variable*. A " "*convenience variable* is a variable whose name starts with ``$``. For " @@ -383,27 +401,27 @@ msgid "" "compared to using normal variables like ``foo = 1``." msgstr "" -#: ../../library/pdb.rst:273 +#: ../../library/pdb.rst:285 msgid "There are three preset *convenience variables*:" msgstr "" -#: ../../library/pdb.rst:275 +#: ../../library/pdb.rst:287 msgid "``$_frame``: the current frame you are debugging" msgstr "" -#: ../../library/pdb.rst:276 +#: ../../library/pdb.rst:288 msgid "``$_retval``: the return value if the frame is returning" msgstr "" -#: ../../library/pdb.rst:277 +#: ../../library/pdb.rst:289 msgid "``$_exception``: the exception if the frame is raising an exception" msgstr "" -#: ../../library/pdb.rst:281 +#: ../../library/pdb.rst:293 msgid "Added the *convenience variable* feature." msgstr "" -#: ../../library/pdb.rst:287 +#: ../../library/pdb.rst:299 msgid "" "If a file :file:`.pdbrc` exists in the user's home directory or in the " "current directory, it is read with ``'utf-8'`` encoding and executed as if " @@ -413,20 +431,20 @@ msgid "" "read first and aliases defined there can be overridden by the local file." msgstr "" -#: ../../library/pdb.rst:294 +#: ../../library/pdb.rst:306 msgid "" ":file:`.pdbrc` can now contain commands that continue debugging, such as :" "pdbcmd:`continue` or :pdbcmd:`next`. Previously, these commands had no " "effect." msgstr "" -#: ../../library/pdb.rst:299 +#: ../../library/pdb.rst:311 msgid "" ":file:`.pdbrc` is now read with ``'utf-8'`` encoding. Previously, it was " "read with the system locale encoding." msgstr "" -#: ../../library/pdb.rst:306 +#: ../../library/pdb.rst:318 msgid "" "Without argument, print the list of available commands. With a *command* as " "argument, print help about that command. ``help pdb`` displays the full " @@ -435,63 +453,75 @@ msgid "" "the ``!`` command." msgstr "" -#: ../../library/pdb.rst:314 +#: ../../library/pdb.rst:326 msgid "" "Print a stack trace, with the most recent frame at the bottom. An arrow " "(``>``) indicates the current frame, which determines the context of most " "commands." msgstr "" -#: ../../library/pdb.rst:319 +#: ../../library/pdb.rst:331 msgid "" "Move the current frame *count* (default one) levels down in the stack trace " "(to a newer frame)." msgstr "" -#: ../../library/pdb.rst:324 +#: ../../library/pdb.rst:336 msgid "" "Move the current frame *count* (default one) levels up in the stack trace " "(to an older frame)." msgstr "" -#: ../../library/pdb.rst:329 +#: ../../library/pdb.rst:341 msgid "" -"With a *lineno* argument, set a break there in the current file. With a " -"*function* argument, set a break at the first executable statement within " -"that function. The line number may be prefixed with a filename and a colon, " -"to specify a breakpoint in another file (probably one that hasn't been " -"loaded yet). The file is searched on :data:`sys.path`. Note that each " -"breakpoint is assigned a number to which all the other breakpoint commands " -"refer." +"With a *lineno* argument, set a break at line *lineno* in the current file. " +"The line number may be prefixed with a *filename* and a colon, to specify a " +"breakpoint in another file (possibly one that hasn't been loaded yet). The " +"file is searched on :data:`sys.path`. Accepatable forms of *filename* are " +"``/abspath/to/file.py``, ``relpath/file.py``, ``module`` and ``package." +"module``." msgstr "" -#: ../../library/pdb.rst:336 +#: ../../library/pdb.rst:348 +msgid "" +"With a *function* argument, set a break at the first executable statement " +"within that function. *function* can be any expression that evaluates to a " +"function in the current namespace." +msgstr "" + +#: ../../library/pdb.rst:352 msgid "" "If a second argument is present, it is an expression which must evaluate to " "true before the breakpoint is honored." msgstr "" -#: ../../library/pdb.rst:339 +#: ../../library/pdb.rst:355 msgid "" "Without argument, list all breaks, including for each breakpoint, the number " "of times that breakpoint has been hit, the current ignore count, and the " "associated condition if any." msgstr "" -#: ../../library/pdb.rst:345 +#: ../../library/pdb.rst:359 +msgid "" +"Each breakpoint is assigned a number to which all the other breakpoint " +"commands refer." +msgstr "" + +#: ../../library/pdb.rst:364 msgid "" "Temporary breakpoint, which is removed automatically when it is first hit. " "The arguments are the same as for :pdbcmd:`break`." msgstr "" -#: ../../library/pdb.rst:350 +#: ../../library/pdb.rst:369 msgid "" "With a *filename:lineno* argument, clear all the breakpoints at this line. " "With a space separated list of breakpoint numbers, clear those breakpoints. " "Without argument, clear all breaks (but first ask confirmation)." msgstr "" -#: ../../library/pdb.rst:356 +#: ../../library/pdb.rst:375 msgid "" "Disable the breakpoints given as a space separated list of breakpoint " "numbers. Disabling a breakpoint means it cannot cause the program to stop " @@ -499,11 +529,11 @@ msgid "" "breakpoints and can be (re-)enabled." msgstr "" -#: ../../library/pdb.rst:363 +#: ../../library/pdb.rst:382 msgid "Enable the breakpoints specified." msgstr "" -#: ../../library/pdb.rst:367 +#: ../../library/pdb.rst:386 msgid "" "Set the ignore count for the given breakpoint number. If *count* is " "omitted, the ignore count is set to 0. A breakpoint becomes active when the " @@ -512,21 +542,21 @@ msgid "" "associated condition evaluates to true." msgstr "" -#: ../../library/pdb.rst:375 +#: ../../library/pdb.rst:394 msgid "" "Set a new *condition* for the breakpoint, an expression which must evaluate " "to true before the breakpoint is honored. If *condition* is absent, any " "existing condition is removed; i.e., the breakpoint is made unconditional." msgstr "" -#: ../../library/pdb.rst:381 +#: ../../library/pdb.rst:400 msgid "" "Specify a list of commands for breakpoint number *bpnumber*. The commands " "themselves appear on the following lines. Type a line containing just " "``end`` to terminate the commands. An example::" msgstr "" -#: ../../library/pdb.rst:385 +#: ../../library/pdb.rst:404 msgid "" "(Pdb) commands 1\n" "(com) p some_variable\n" @@ -534,25 +564,25 @@ msgid "" "(Pdb)" msgstr "" -#: ../../library/pdb.rst:390 +#: ../../library/pdb.rst:409 msgid "" "To remove all commands from a breakpoint, type ``commands`` and follow it " "immediately with ``end``; that is, give no commands." msgstr "" -#: ../../library/pdb.rst:393 +#: ../../library/pdb.rst:412 msgid "" "With no *bpnumber* argument, ``commands`` refers to the last breakpoint set." msgstr "" -#: ../../library/pdb.rst:395 +#: ../../library/pdb.rst:414 msgid "" "You can use breakpoint commands to start your program up again. Simply use " "the :pdbcmd:`continue` command, or :pdbcmd:`step`, or any other command that " "resumes execution." msgstr "" -#: ../../library/pdb.rst:399 +#: ../../library/pdb.rst:418 msgid "" "Specifying any command resuming execution (currently :pdbcmd:`continue`, :" "pdbcmd:`step`, :pdbcmd:`next`, :pdbcmd:`return`, :pdbcmd:`jump`, :pdbcmd:" @@ -563,7 +593,7 @@ msgid "" "ambiguities about which list to execute." msgstr "" -#: ../../library/pdb.rst:408 +#: ../../library/pdb.rst:427 msgid "" "If you use the ``silent`` command in the command list, the usual message " "about stopping at a breakpoint is not printed. This may be desirable for " @@ -572,13 +602,13 @@ msgid "" "was reached." msgstr "" -#: ../../library/pdb.rst:415 +#: ../../library/pdb.rst:434 msgid "" "Execute the current line, stop at the first possible occasion (either in a " "function that is called or on the next line in the current function)." msgstr "" -#: ../../library/pdb.rst:420 +#: ../../library/pdb.rst:439 msgid "" "Continue execution until the next line in the current function is reached or " "it returns. (The difference between :pdbcmd:`next` and :pdbcmd:`step` is " @@ -587,46 +617,46 @@ msgid "" "line in the current function.)" msgstr "" -#: ../../library/pdb.rst:428 +#: ../../library/pdb.rst:447 msgid "" "Without argument, continue execution until the line with a number greater " "than the current one is reached." msgstr "" -#: ../../library/pdb.rst:431 +#: ../../library/pdb.rst:450 msgid "" "With *lineno*, continue execution until a line with a number greater or " "equal to *lineno* is reached. In both cases, also stop when the current " "frame returns." msgstr "" -#: ../../library/pdb.rst:435 +#: ../../library/pdb.rst:454 msgid "Allow giving an explicit line number." msgstr "" -#: ../../library/pdb.rst:440 +#: ../../library/pdb.rst:459 msgid "Continue execution until the current function returns." msgstr "" -#: ../../library/pdb.rst:444 +#: ../../library/pdb.rst:463 msgid "Continue execution, only stop when a breakpoint is encountered." msgstr "" -#: ../../library/pdb.rst:448 +#: ../../library/pdb.rst:467 msgid "" "Set the next line that will be executed. Only available in the bottom-most " "frame. This lets you jump back and execute code again, or jump forward to " "skip code that you don't want to run." msgstr "" -#: ../../library/pdb.rst:452 +#: ../../library/pdb.rst:471 msgid "" "It should be noted that not all jumps are allowed -- for instance it is not " "possible to jump into the middle of a :keyword:`for` loop or out of a :" "keyword:`finally` clause." msgstr "" -#: ../../library/pdb.rst:458 +#: ../../library/pdb.rst:477 msgid "" "List source code for the current file. Without arguments, list 11 lines " "around the current line or continue the previous listing. With ``.`` as " @@ -635,7 +665,7 @@ msgid "" "second argument is less than the first, it is interpreted as a count." msgstr "" -#: ../../library/pdb.rst:464 +#: ../../library/pdb.rst:483 msgid "" "The current line in the current frame is indicated by ``->``. If an " "exception is being debugged, the line where the exception was originally " @@ -643,67 +673,67 @@ msgid "" "line." msgstr "" -#: ../../library/pdb.rst:469 +#: ../../library/pdb.rst:488 msgid "Added the ``>>`` marker." msgstr "" -#: ../../library/pdb.rst:474 +#: ../../library/pdb.rst:493 msgid "" "List all source code for the current function or frame. Interesting lines " "are marked as for :pdbcmd:`list`." msgstr "" -#: ../../library/pdb.rst:481 +#: ../../library/pdb.rst:500 msgid "Print the arguments of the current function and their current values." msgstr "" -#: ../../library/pdb.rst:485 +#: ../../library/pdb.rst:504 msgid "Evaluate *expression* in the current context and print its value." msgstr "" -#: ../../library/pdb.rst:489 +#: ../../library/pdb.rst:508 msgid "" "``print()`` can also be used, but is not a debugger command --- this " "executes the Python :func:`print` function." msgstr "" -#: ../../library/pdb.rst:495 +#: ../../library/pdb.rst:514 msgid "" "Like the :pdbcmd:`p` command, except the value of *expression* is pretty-" "printed using the :mod:`pprint` module." msgstr "" -#: ../../library/pdb.rst:500 +#: ../../library/pdb.rst:519 msgid "Print the type of *expression*." msgstr "" -#: ../../library/pdb.rst:504 +#: ../../library/pdb.rst:523 msgid "Try to get source code of *expression* and display it." msgstr "" -#: ../../library/pdb.rst:510 +#: ../../library/pdb.rst:529 msgid "" "Display the value of *expression* if it changed, each time execution stops " "in the current frame." msgstr "" -#: ../../library/pdb.rst:513 +#: ../../library/pdb.rst:532 msgid "" "Without *expression*, list all display expressions for the current frame." msgstr "" -#: ../../library/pdb.rst:517 +#: ../../library/pdb.rst:536 msgid "" "Display evaluates *expression* and compares to the result of the previous " "evaluation of *expression*, so when the result is mutable, display may not " "be able to pick up the changes." msgstr "" -#: ../../library/pdb.rst:521 +#: ../../library/pdb.rst:540 ../../library/pdb.rst:690 msgid "Example::" msgstr "範例: ::" -#: ../../library/pdb.rst:523 +#: ../../library/pdb.rst:542 msgid "" "lst = []\n" "breakpoint()\n" @@ -712,13 +742,13 @@ msgid "" "print(lst)" msgstr "" -#: ../../library/pdb.rst:529 +#: ../../library/pdb.rst:548 msgid "" "Display won't realize ``lst`` has been changed because the result of " "evaluation is modified in place by ``lst.append(1)`` before being compared::" msgstr "" -#: ../../library/pdb.rst:532 +#: ../../library/pdb.rst:551 msgid "" "> example.py(3)()\n" "-> pass\n" @@ -733,11 +763,11 @@ msgid "" "(Pdb)" msgstr "" -#: ../../library/pdb.rst:544 +#: ../../library/pdb.rst:563 msgid "You can do some tricks with copy mechanism to make it work::" msgstr "" -#: ../../library/pdb.rst:546 +#: ../../library/pdb.rst:565 msgid "" "> example.py(3)()\n" "-> pass\n" @@ -753,29 +783,49 @@ msgid "" "(Pdb)" msgstr "" -#: ../../library/pdb.rst:563 +#: ../../library/pdb.rst:582 msgid "" "Do not display *expression* anymore in the current frame. Without " "*expression*, clear all display expressions for the current frame." msgstr "" -#: ../../library/pdb.rst:570 +#: ../../library/pdb.rst:589 +msgid "" +"Start an interactive interpreter (using the :mod:`code` module) in a new " +"global namespace initialised from the local and global namespaces for the " +"current scope. Use ``exit()`` or ``quit()`` to exit the interpreter and " +"return to the debugger." +msgstr "" + +#: ../../library/pdb.rst:596 +msgid "" +"As ``interact`` creates a new dedicated namespace for code execution, " +"assignments to variables will not affect the original namespaces. However, " +"modifications to any referenced mutable objects will be reflected in the " +"original namespaces as usual." +msgstr "" + +#: ../../library/pdb.rst:603 +msgid "" +"``exit()`` and ``quit()`` can be used to exit the :pdbcmd:`interact` command." +msgstr "" + +#: ../../library/pdb.rst:607 msgid "" -"Start an interactive interpreter (using the :mod:`code` module) whose global " -"namespace contains all the (global and local) names found in the current " -"scope." +":pdbcmd:`interact` directs its output to the debugger's output channel " +"rather than :data:`sys.stderr`." msgstr "" -#: ../../library/pdb.rst:580 +#: ../../library/pdb.rst:615 msgid "" "Create an alias called *name* that executes *command*. The *command* must " "*not* be enclosed in quotes. Replaceable parameters can be indicated by " -"``%1``, ``%2``, and so on, while ``%*`` is replaced by all the parameters. " -"If *command* is omitted, the current alias for *name* is shown. If no " -"arguments are given, all aliases are listed." +"``%1``, ``%2``, ... and ``%9``, while ``%*`` is replaced by all the " +"parameters. If *command* is omitted, the current alias for *name* is shown. " +"If no arguments are given, all aliases are listed." msgstr "" -#: ../../library/pdb.rst:586 +#: ../../library/pdb.rst:621 msgid "" "Aliases may be nested and can contain anything that can be legally typed at " "the pdb prompt. Note that internal pdb commands *can* be overridden by " @@ -784,13 +834,13 @@ msgid "" "other words in the line are left alone." msgstr "" -#: ../../library/pdb.rst:592 +#: ../../library/pdb.rst:627 msgid "" "As an example, here are two useful aliases (especially when placed in the :" "file:`.pdbrc` file)::" msgstr "" -#: ../../library/pdb.rst:595 +#: ../../library/pdb.rst:630 msgid "" "# Print instance variables (usage \"pi classInst\")\n" "alias pi for k in %1.__dict__.keys(): print(f\"%1.{k} = {%1.__dict__[k]}\")\n" @@ -798,36 +848,36 @@ msgid "" "alias ps pi self" msgstr "" -#: ../../library/pdb.rst:602 +#: ../../library/pdb.rst:637 msgid "Delete the specified alias *name*." msgstr "" -#: ../../library/pdb.rst:606 +#: ../../library/pdb.rst:641 msgid "" "Execute the (one-line) *statement* in the context of the current stack " "frame. The exclamation point can be omitted unless the first word of the " "statement resembles a debugger command, e.g.:" msgstr "" -#: ../../library/pdb.rst:610 +#: ../../library/pdb.rst:645 msgid "" "(Pdb) ! n=42\n" "(Pdb)" msgstr "" -#: ../../library/pdb.rst:615 +#: ../../library/pdb.rst:650 msgid "" "To set a global variable, you can prefix the assignment command with a :" "keyword:`global` statement on the same line, e.g.:" msgstr "" -#: ../../library/pdb.rst:618 +#: ../../library/pdb.rst:653 msgid "" "(Pdb) global list_options; list_options = ['-l']\n" "(Pdb)" msgstr "" -#: ../../library/pdb.rst:626 +#: ../../library/pdb.rst:661 msgid "" "Restart the debugged Python program. If *args* is supplied, it is split " "with :mod:`shlex` and the result is used as the new :data:`sys.argv`. " @@ -835,25 +885,80 @@ msgid "" "`restart` is an alias for :pdbcmd:`run`." msgstr "" -#: ../../library/pdb.rst:633 +#: ../../library/pdb.rst:668 msgid "Quit from the debugger. The program being executed is aborted." msgstr "" -#: ../../library/pdb.rst:637 +#: ../../library/pdb.rst:672 msgid "" "Enter a recursive debugger that steps through *code* (which is an arbitrary " "expression or statement to be executed in the current environment)." msgstr "" -#: ../../library/pdb.rst:643 +#: ../../library/pdb.rst:678 msgid "Print the return value for the last return of the current function." msgstr "" -#: ../../library/pdb.rst:646 +#: ../../library/pdb.rst:682 +msgid "List or jump between chained exceptions." +msgstr "" + +#: ../../library/pdb.rst:684 +msgid "" +"When using ``pdb.pm()`` or ``Pdb.post_mortem(...)`` with a chained " +"exception instead of a traceback, it allows the user to move between the " +"chained exceptions using ``exceptions`` command to list exceptions, and " +"``exception `` to switch to that exception." +msgstr "" + +#: ../../library/pdb.rst:692 +msgid "" +"def out():\n" +" try:\n" +" middle()\n" +" except Exception as e:\n" +" raise ValueError(\"reraise middle() error\") from e\n" +"\n" +"def middle():\n" +" try:\n" +" return inner(0)\n" +" except Exception as e:\n" +" raise ValueError(\"Middle fail\")\n" +"\n" +"def inner(x):\n" +" 1 / x\n" +"\n" +" out()" +msgstr "" + +#: ../../library/pdb.rst:709 +msgid "calling ``pdb.pm()`` will allow to move between exceptions::" +msgstr "" + +#: ../../library/pdb.rst:711 +msgid "" +"> example.py(5)out()\n" +"-> raise ValueError(\"reraise middle() error\") from e\n" +"\n" +"(Pdb) exceptions\n" +" 0 ZeroDivisionError('division by zero')\n" +" 1 ValueError('Middle fail')\n" +"> 2 ValueError('reraise middle() error')\n" +"\n" +"(Pdb) exceptions 0\n" +"> example.py(16)inner()\n" +"-> 1 / x\n" +"\n" +"(Pdb) up\n" +"> example.py(10)middle()\n" +"-> return inner(0)" +msgstr "" + +#: ../../library/pdb.rst:730 msgid "Footnotes" msgstr "註解" -#: ../../library/pdb.rst:647 +#: ../../library/pdb.rst:731 msgid "" "Whether a frame is considered to originate in a certain module is determined " "by the ``__name__`` in the frame globals." @@ -879,18 +984,18 @@ msgstr "bdb" msgid "cmd" msgstr "cmd" -#: ../../library/pdb.rst:283 +#: ../../library/pdb.rst:295 msgid ".pdbrc" msgstr ".pdbrc" -#: ../../library/pdb.rst:283 +#: ../../library/pdb.rst:295 msgid "file" msgstr "file(檔案)" -#: ../../library/pdb.rst:283 +#: ../../library/pdb.rst:295 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/pdb.rst:283 +#: ../../library/pdb.rst:295 msgid "configuration" msgstr "configuration(設定)" diff --git a/library/pickle.po b/library/pickle.po index 091777c3d3..c512db8eb2 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -179,9 +179,8 @@ msgstr "" msgid "" "The data format used by :mod:`pickle` is Python-specific. This has the " "advantage that there are no restrictions imposed by external standards such " -"as JSON or XDR (which can't represent pointer sharing); however it means " -"that non-Python programs may not be able to reconstruct pickled Python " -"objects." +"as JSON (which can't represent pointer sharing); however it means that non-" +"Python programs may not be able to reconstruct pickled Python objects." msgstr "" #: ../../library/pickle.rst:131 @@ -356,7 +355,7 @@ msgid "" msgstr "" #: ../../library/pickle.rst:252 ../../library/pickle.rst:267 -#: ../../library/pickle.rst:429 +#: ../../library/pickle.rst:433 msgid "The *buffers* argument was added." msgstr "新增 *buffer* 引數。" @@ -479,11 +478,17 @@ msgid "" "by :meth:`persistent_id` cannot itself have a persistent ID." msgstr "" -#: ../../library/pickle.rst:346 ../../library/pickle.rst:447 +#: ../../library/pickle.rst:346 ../../library/pickle.rst:451 msgid "See :ref:`pickle-persistent` for details and examples of uses." msgstr "關於細節與用法範例請見 :ref:`pickle-persistent`。" -#: ../../library/pickle.rst:350 +#: ../../library/pickle.rst:348 +msgid "" +"Add the default implementation of this method in the C implementation of :" +"class:`!Pickler`." +msgstr "" + +#: ../../library/pickle.rst:354 msgid "" "A pickler object's dispatch table is a registry of *reduction functions* of " "the kind which can be declared using :func:`copyreg.pickle`. It is a " @@ -492,7 +497,7 @@ msgid "" "should conform to the same interface as a :meth:`~object.__reduce__` method." msgstr "" -#: ../../library/pickle.rst:358 +#: ../../library/pickle.rst:362 msgid "" "By default, a pickler object will not have a :attr:`dispatch_table` " "attribute, and it will instead use the global dispatch table managed by the :" @@ -503,11 +508,11 @@ msgid "" "table for instances of that class." msgstr "" -#: ../../library/pickle.rst:367 +#: ../../library/pickle.rst:371 msgid "See :ref:`pickle-dispatch` for usage examples." msgstr "關於用法範例請見 :ref:`pickle-dispatch`。" -#: ../../library/pickle.rst:373 +#: ../../library/pickle.rst:377 msgid "" "Special reducer that can be defined in :class:`Pickler` subclasses. This " "method has priority over any reducer in the :attr:`dispatch_table`. It " @@ -516,11 +521,11 @@ msgid "" "`dispatch_table`-registered reducers to pickle ``obj``." msgstr "" -#: ../../library/pickle.rst:379 +#: ../../library/pickle.rst:383 msgid "For a detailed example, see :ref:`reducer_override`." msgstr "" -#: ../../library/pickle.rst:385 +#: ../../library/pickle.rst:389 msgid "" "Deprecated. Enable fast mode if set to a true value. The fast mode disables " "the usage of memo, therefore speeding the pickling process by not generating " @@ -528,21 +533,21 @@ msgid "" "objects, doing otherwise will cause :class:`Pickler` to recurse infinitely." msgstr "" -#: ../../library/pickle.rst:391 +#: ../../library/pickle.rst:395 msgid "Use :func:`pickletools.optimize` if you need more compact pickles." msgstr "" -#: ../../library/pickle.rst:396 +#: ../../library/pickle.rst:400 msgid "This takes a binary file for reading a pickle data stream." msgstr "" -#: ../../library/pickle.rst:398 +#: ../../library/pickle.rst:402 msgid "" "The protocol version of the pickle is detected automatically, so no protocol " "argument is needed." msgstr "" -#: ../../library/pickle.rst:401 +#: ../../library/pickle.rst:405 msgid "" "The argument *file* must have three methods, a read() method that takes an " "integer argument, a readinto() method that takes a buffer argument and a " @@ -552,7 +557,7 @@ msgid "" "that meets this interface." msgstr "" -#: ../../library/pickle.rst:408 +#: ../../library/pickle.rst:412 msgid "" "The optional arguments *fix_imports*, *encoding* and *errors* are used to " "control compatibility support for pickle stream generated by Python 2. If " @@ -566,7 +571,7 @@ msgid "" "Python 2." msgstr "" -#: ../../library/pickle.rst:419 +#: ../../library/pickle.rst:423 msgid "" "If *buffers* is ``None`` (the default), then all data necessary for " "deserialization must be contained in the pickle stream. This means that the " @@ -574,7 +579,7 @@ msgid "" "instantiated (or when :func:`dump` or :func:`dumps` was called)." msgstr "" -#: ../../library/pickle.rst:424 +#: ../../library/pickle.rst:428 msgid "" "If *buffers* is not ``None``, it should be an iterable of buffer-enabled " "objects that is consumed each time the pickle stream references an :ref:`out-" @@ -582,25 +587,31 @@ msgid "" "the *buffer_callback* of a Pickler object." msgstr "" -#: ../../library/pickle.rst:434 +#: ../../library/pickle.rst:438 msgid "" "Read the pickled representation of an object from the open file object given " "in the constructor, and return the reconstituted object hierarchy specified " "therein. Bytes past the pickled representation of the object are ignored." msgstr "" -#: ../../library/pickle.rst:441 +#: ../../library/pickle.rst:445 msgid "Raise an :exc:`UnpicklingError` by default." msgstr "" -#: ../../library/pickle.rst:443 +#: ../../library/pickle.rst:447 msgid "" "If defined, :meth:`persistent_load` should return the object specified by " "the persistent ID *pid*. If an invalid persistent ID is encountered, an :" "exc:`UnpicklingError` should be raised." msgstr "" -#: ../../library/pickle.rst:451 +#: ../../library/pickle.rst:453 +msgid "" +"Add the default implementation of this method in the C implementation of :" +"class:`!Unpickler`." +msgstr "" + +#: ../../library/pickle.rst:459 msgid "" "Import *module* if necessary and return the object called *name* from it, " "where the *module* and *name* arguments are :class:`str` objects. Note, " @@ -608,14 +619,14 @@ msgid "" "functions." msgstr "" -#: ../../library/pickle.rst:456 +#: ../../library/pickle.rst:464 msgid "" "Subclasses may override this to gain control over what type of objects and " "how they can be loaded, potentially reducing security risks. Refer to :ref:" "`pickle-restrict` for details." msgstr "" -#: ../../library/pickle.rst:460 +#: ../../library/pickle.rst:468 msgid "" "Raises an :ref:`auditing event ` ``pickle.find_class`` with " "arguments ``module``, ``name``." @@ -623,28 +634,28 @@ msgstr "" "引發一個附帶引數 ``module``、``name`` 的\\ :ref:`稽核事件 ` " "``pickle.find_class``。" -#: ../../library/pickle.rst:464 +#: ../../library/pickle.rst:472 msgid "" "A wrapper for a buffer representing picklable data. *buffer* must be a :ref:" "`buffer-providing ` object, such as a :term:`bytes-like " "object` or a N-dimensional array." msgstr "" -#: ../../library/pickle.rst:468 +#: ../../library/pickle.rst:476 msgid "" ":class:`PickleBuffer` is itself a buffer provider, therefore it is possible " "to pass it to other APIs expecting a buffer-providing object, such as :class:" "`memoryview`." msgstr "" -#: ../../library/pickle.rst:472 +#: ../../library/pickle.rst:480 msgid "" ":class:`PickleBuffer` objects can only be serialized using pickle protocol 5 " "or higher. They are eligible for :ref:`out-of-band serialization `." msgstr "" -#: ../../library/pickle.rst:480 +#: ../../library/pickle.rst:488 msgid "" "Return a :class:`memoryview` of the memory area underlying this buffer. The " "returned object is a one-dimensional, C-contiguous memoryview with format " @@ -652,54 +663,54 @@ msgid "" "neither C- nor Fortran-contiguous." msgstr "" -#: ../../library/pickle.rst:487 +#: ../../library/pickle.rst:495 msgid "Release the underlying buffer exposed by the PickleBuffer object." msgstr "" -#: ../../library/pickle.rst:493 +#: ../../library/pickle.rst:501 msgid "What can be pickled and unpickled?" msgstr "" -#: ../../library/pickle.rst:495 +#: ../../library/pickle.rst:503 msgid "The following types can be pickled:" msgstr "" -#: ../../library/pickle.rst:497 +#: ../../library/pickle.rst:505 msgid "" "built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, and :data:" "`NotImplemented`);" msgstr "" -#: ../../library/pickle.rst:500 +#: ../../library/pickle.rst:508 msgid "integers, floating-point numbers, complex numbers;" msgstr "" -#: ../../library/pickle.rst:502 +#: ../../library/pickle.rst:510 msgid "strings, bytes, bytearrays;" msgstr "" -#: ../../library/pickle.rst:504 +#: ../../library/pickle.rst:512 msgid "" "tuples, lists, sets, and dictionaries containing only picklable objects;" msgstr "" -#: ../../library/pickle.rst:506 +#: ../../library/pickle.rst:514 msgid "" "functions (built-in and user-defined) accessible from the top level of a " "module (using :keyword:`def`, not :keyword:`lambda`);" msgstr "" -#: ../../library/pickle.rst:509 +#: ../../library/pickle.rst:517 msgid "classes accessible from the top level of a module;" msgstr "" -#: ../../library/pickle.rst:511 +#: ../../library/pickle.rst:519 msgid "" "instances of such classes whose the result of calling :meth:`~object." "__getstate__` is picklable (see section :ref:`pickle-inst` for details)." msgstr "" -#: ../../library/pickle.rst:514 +#: ../../library/pickle.rst:522 msgid "" "Attempts to pickle unpicklable objects will raise the :exc:`PicklingError` " "exception; when this happens, an unspecified number of bytes may have " @@ -709,7 +720,7 @@ msgid "" "limit with :func:`sys.setrecursionlimit`." msgstr "" -#: ../../library/pickle.rst:521 +#: ../../library/pickle.rst:529 msgid "" "Note that functions (built-in and user-defined) are pickled by fully :term:" "`qualified name`, not by value. [#]_ This means that only the function name " @@ -720,7 +731,7 @@ msgid "" "exception will be raised. [#]_" msgstr "" -#: ../../library/pickle.rst:528 +#: ../../library/pickle.rst:536 msgid "" "Similarly, classes are pickled by fully qualified name, so the same " "restrictions in the unpickling environment apply. Note that none of the " @@ -728,7 +739,7 @@ msgid "" "attribute ``attr`` is not restored in the unpickling environment::" msgstr "" -#: ../../library/pickle.rst:533 +#: ../../library/pickle.rst:541 msgid "" "class Foo:\n" " attr = 'A class attribute'\n" @@ -740,13 +751,13 @@ msgstr "" "\n" "picklestring = pickle.dumps(Foo)" -#: ../../library/pickle.rst:538 +#: ../../library/pickle.rst:546 msgid "" "These restrictions are why picklable functions and classes must be defined " "at the top level of a module." msgstr "" -#: ../../library/pickle.rst:541 +#: ../../library/pickle.rst:549 msgid "" "Similarly, when class instances are pickled, their class's code and data are " "not pickled along with them. Only the instance data are pickled. This is " @@ -758,17 +769,17 @@ msgid "" "__setstate__` method." msgstr "" -#: ../../library/pickle.rst:553 +#: ../../library/pickle.rst:561 msgid "Pickling Class Instances" msgstr "" -#: ../../library/pickle.rst:557 +#: ../../library/pickle.rst:565 msgid "" "In this section, we describe the general mechanisms available to you to " "define, customize, and control how class instances are pickled and unpickled." msgstr "" -#: ../../library/pickle.rst:560 +#: ../../library/pickle.rst:568 msgid "" "In most cases, no additional code is needed to make instances picklable. By " "default, pickle will retrieve the class and the attributes of an instance " @@ -778,7 +789,7 @@ msgid "" "The following code shows an implementation of this behaviour::" msgstr "" -#: ../../library/pickle.rst:567 +#: ../../library/pickle.rst:575 msgid "" "def save(obj):\n" " return (obj.__class__, obj.__dict__)\n" @@ -796,13 +807,13 @@ msgstr "" " obj.__dict__.update(attributes)\n" " return obj" -#: ../../library/pickle.rst:575 +#: ../../library/pickle.rst:583 msgid "" "Classes can alter the default behaviour by providing one or several special " "methods:" msgstr "" -#: ../../library/pickle.rst:580 +#: ../../library/pickle.rst:588 msgid "" "In protocols 2 and newer, classes that implements the :meth:" "`__getnewargs_ex__` method can dictate the values passed to the :meth:" @@ -812,37 +823,37 @@ msgid "" "passed to the :meth:`__new__` method upon unpickling." msgstr "" -#: ../../library/pickle.rst:588 +#: ../../library/pickle.rst:596 msgid "" "You should implement this method if the :meth:`__new__` method of your class " "requires keyword-only arguments. Otherwise, it is recommended for " "compatibility to implement :meth:`__getnewargs__`." msgstr "" -#: ../../library/pickle.rst:592 +#: ../../library/pickle.rst:600 msgid ":meth:`__getnewargs_ex__` is now used in protocols 2 and 3." msgstr "" -#: ../../library/pickle.rst:598 +#: ../../library/pickle.rst:606 msgid "" "This method serves a similar purpose as :meth:`__getnewargs_ex__`, but " "supports only positional arguments. It must return a tuple of arguments " "``args`` which will be passed to the :meth:`__new__` method upon unpickling." msgstr "" -#: ../../library/pickle.rst:602 +#: ../../library/pickle.rst:610 msgid "" ":meth:`__getnewargs__` will not be called if :meth:`__getnewargs_ex__` is " "defined." msgstr "" -#: ../../library/pickle.rst:605 +#: ../../library/pickle.rst:613 msgid "" "Before Python 3.6, :meth:`__getnewargs__` was called instead of :meth:" "`__getnewargs_ex__` in protocols 2 and 3." msgstr "" -#: ../../library/pickle.rst:612 +#: ../../library/pickle.rst:620 msgid "" "Classes can further influence how their instances are pickled by overriding " "the method :meth:`__getstate__`. It is called and the returned object is " @@ -850,19 +861,19 @@ msgid "" "are several cases:" msgstr "" -#: ../../library/pickle.rst:617 +#: ../../library/pickle.rst:625 msgid "" "For a class that has no instance :attr:`~object.__dict__` and no :attr:" "`~object.__slots__`, the default state is ``None``." msgstr "" -#: ../../library/pickle.rst:620 +#: ../../library/pickle.rst:628 msgid "" "For a class that has an instance :attr:`~object.__dict__` and no :attr:" "`~object.__slots__`, the default state is ``self.__dict__``." msgstr "" -#: ../../library/pickle.rst:623 +#: ../../library/pickle.rst:631 msgid "" "For a class that has an instance :attr:`~object.__dict__` and :attr:`~object." "__slots__`, the default state is a tuple consisting of two dictionaries: " @@ -870,7 +881,7 @@ msgid "" "slots that have a value are included in the latter." msgstr "" -#: ../../library/pickle.rst:629 +#: ../../library/pickle.rst:637 msgid "" "For a class that has :attr:`~object.__slots__` and no instance :attr:" "`~object.__dict__`, the default state is a tuple whose first item is " @@ -878,13 +889,13 @@ msgid "" "values described in the previous bullet." msgstr "" -#: ../../library/pickle.rst:634 +#: ../../library/pickle.rst:642 msgid "" "Added the default implementation of the ``__getstate__()`` method in the :" "class:`object` class." msgstr "" -#: ../../library/pickle.rst:641 +#: ../../library/pickle.rst:649 msgid "" "Upon unpickling, if the class defines :meth:`__setstate__`, it is called " "with the unpickled state. In that case, there is no requirement for the " @@ -892,20 +903,20 @@ msgid "" "dictionary and its items are assigned to the new instance's dictionary." msgstr "" -#: ../../library/pickle.rst:648 +#: ../../library/pickle.rst:656 msgid "" "If :meth:`__reduce__` returns a state with value ``None`` at pickling, the :" "meth:`__setstate__` method will not be called upon unpickling." msgstr "" -#: ../../library/pickle.rst:652 +#: ../../library/pickle.rst:660 msgid "" "Refer to the section :ref:`pickle-state` for more information about how to " "use the methods :meth:`~object.__getstate__` and :meth:`~object." "__setstate__`." msgstr "" -#: ../../library/pickle.rst:657 +#: ../../library/pickle.rst:665 msgid "" "At unpickling time, some methods like :meth:`~object.__getattr__`, :meth:" "`~object.__getattribute__`, or :meth:`~object.__setattr__` may be called " @@ -915,7 +926,7 @@ msgid "" "an instance." msgstr "" -#: ../../library/pickle.rst:666 +#: ../../library/pickle.rst:674 msgid "" "As we shall see, pickle does not use directly the methods described above. " "In fact, these methods are part of the copy protocol which implements the :" @@ -924,7 +935,7 @@ msgid "" "objects. [#]_" msgstr "" -#: ../../library/pickle.rst:672 +#: ../../library/pickle.rst:680 msgid "" "Although powerful, implementing :meth:`~object.__reduce__` directly in your " "classes is error prone. For this reason, class designers should use the " @@ -934,14 +945,14 @@ msgid "" "option or leads to more efficient pickling or both." msgstr "" -#: ../../library/pickle.rst:681 +#: ../../library/pickle.rst:689 msgid "" "The interface is currently defined as follows. The :meth:`__reduce__` " "method takes no argument and shall return either a string or preferably a " "tuple (the returned object is often referred to as the \"reduce value\")." msgstr "" -#: ../../library/pickle.rst:685 +#: ../../library/pickle.rst:693 msgid "" "If a string is returned, the string should be interpreted as the name of a " "global variable. It should be the object's local name relative to its " @@ -949,26 +960,26 @@ msgid "" "object's module. This behaviour is typically useful for singletons." msgstr "" -#: ../../library/pickle.rst:690 +#: ../../library/pickle.rst:698 msgid "" "When a tuple is returned, it must be between two and six items long. " "Optional items can either be omitted, or ``None`` can be provided as their " "value. The semantics of each item are in order:" msgstr "" -#: ../../library/pickle.rst:696 +#: ../../library/pickle.rst:704 msgid "" "A callable object that will be called to create the initial version of the " "object." msgstr "" -#: ../../library/pickle.rst:699 +#: ../../library/pickle.rst:707 msgid "" "A tuple of arguments for the callable object. An empty tuple must be given " "if the callable does not accept any argument." msgstr "" -#: ../../library/pickle.rst:702 +#: ../../library/pickle.rst:710 msgid "" "Optionally, the object's state, which will be passed to the object's :meth:" "`__setstate__` method as previously described. If the object has no such " @@ -976,7 +987,7 @@ msgid "" "object's :attr:`~object.__dict__` attribute." msgstr "" -#: ../../library/pickle.rst:707 +#: ../../library/pickle.rst:715 msgid "" "Optionally, an iterator (and not a sequence) yielding successive items. " "These items will be appended to the object either using ``obj.append(item)`` " @@ -988,7 +999,7 @@ msgid "" "append, so both must be supported.)" msgstr "" -#: ../../library/pickle.rst:717 +#: ../../library/pickle.rst:725 msgid "" "Optionally, an iterator (not a sequence) yielding successive key-value " "pairs. These items will be stored to the object using ``obj[key] = " @@ -996,7 +1007,7 @@ msgid "" "by other classes as long as they implement :meth:`__setitem__`." msgstr "" -#: ../../library/pickle.rst:722 +#: ../../library/pickle.rst:730 msgid "" "Optionally, a callable with a ``(obj, state)`` signature. This callable " "allows the user to programmatically control the state-updating behavior of a " @@ -1005,11 +1016,11 @@ msgid "" "meth:`__setstate__`." msgstr "" -#: ../../library/pickle.rst:728 +#: ../../library/pickle.rst:736 msgid "The optional sixth tuple item, ``(obj, state)``, was added." msgstr "" -#: ../../library/pickle.rst:734 +#: ../../library/pickle.rst:742 msgid "" "Alternatively, a :meth:`__reduce_ex__` method may be defined. The only " "difference is this method should take a single integer argument, the " @@ -1019,11 +1030,11 @@ msgid "" "provide backwards-compatible reduce values for older Python releases." msgstr "" -#: ../../library/pickle.rst:746 +#: ../../library/pickle.rst:754 msgid "Persistence of External Objects" msgstr "" -#: ../../library/pickle.rst:752 +#: ../../library/pickle.rst:760 msgid "" "For the benefit of object persistence, the :mod:`pickle` module supports the " "notion of a reference to an object outside the pickled data stream. Such " @@ -1032,7 +1043,7 @@ msgid "" "(for any newer protocol)." msgstr "" -#: ../../library/pickle.rst:758 +#: ../../library/pickle.rst:766 msgid "" "The resolution of such persistent IDs is not defined by the :mod:`pickle` " "module; it will delegate this resolution to the user-defined methods on the " @@ -1040,7 +1051,7 @@ msgid "" "persistent_load` respectively." msgstr "" -#: ../../library/pickle.rst:763 +#: ../../library/pickle.rst:771 msgid "" "To pickle objects that have an external persistent ID, the pickler must have " "a custom :meth:`~Pickler.persistent_id` method that takes an object as an " @@ -1051,20 +1062,20 @@ msgid "" "persistent ID." msgstr "" -#: ../../library/pickle.rst:770 +#: ../../library/pickle.rst:778 msgid "" "To unpickle external objects, the unpickler must have a custom :meth:" "`~Unpickler.persistent_load` method that takes a persistent ID object and " "returns the referenced object." msgstr "" -#: ../../library/pickle.rst:774 +#: ../../library/pickle.rst:782 msgid "" "Here is a comprehensive example presenting how persistent ID can be used to " "pickle external objects by reference." msgstr "" -#: ../../library/pickle.rst:777 +#: ../../library/pickle.rst:785 msgid "" "# Simple example presenting how persistent ID can be used to pickle\n" "# external objects by reference.\n" @@ -1162,29 +1173,29 @@ msgid "" " main()\n" msgstr "" -#: ../../library/pickle.rst:782 +#: ../../library/pickle.rst:790 msgid "Dispatch Tables" msgstr "" -#: ../../library/pickle.rst:784 +#: ../../library/pickle.rst:792 msgid "" "If one wants to customize pickling of some classes without disturbing any " "other code which depends on pickling, then one can create a pickler with a " "private dispatch table." msgstr "" -#: ../../library/pickle.rst:788 +#: ../../library/pickle.rst:796 msgid "" "The global dispatch table managed by the :mod:`copyreg` module is available " "as :data:`!copyreg.dispatch_table`. Therefore, one may choose to use a " "modified copy of :data:`!copyreg.dispatch_table` as a private dispatch table." msgstr "" -#: ../../library/pickle.rst:793 +#: ../../library/pickle.rst:801 msgid "For example ::" msgstr "舉例來說: ::" -#: ../../library/pickle.rst:795 +#: ../../library/pickle.rst:803 msgid "" "f = io.BytesIO()\n" "p = pickle.Pickler(f)\n" @@ -1196,13 +1207,13 @@ msgstr "" "p.dispatch_table = copyreg.dispatch_table.copy()\n" "p.dispatch_table[SomeClass] = reduce_SomeClass" -#: ../../library/pickle.rst:800 +#: ../../library/pickle.rst:808 msgid "" "creates an instance of :class:`pickle.Pickler` with a private dispatch table " "which handles the ``SomeClass`` class specially. Alternatively, the code ::" msgstr "" -#: ../../library/pickle.rst:804 +#: ../../library/pickle.rst:812 msgid "" "class MyPickler(pickle.Pickler):\n" " dispatch_table = copyreg.dispatch_table.copy()\n" @@ -1216,13 +1227,13 @@ msgstr "" "f = io.BytesIO()\n" "p = MyPickler(f)" -#: ../../library/pickle.rst:810 +#: ../../library/pickle.rst:818 msgid "" "does the same but all instances of ``MyPickler`` will by default share the " "private dispatch table. On the other hand, the code ::" msgstr "" -#: ../../library/pickle.rst:813 +#: ../../library/pickle.rst:821 msgid "" "copyreg.pickle(SomeClass, reduce_SomeClass)\n" "f = io.BytesIO()\n" @@ -1232,17 +1243,17 @@ msgstr "" "f = io.BytesIO()\n" "p = pickle.Pickler(f)" -#: ../../library/pickle.rst:817 +#: ../../library/pickle.rst:825 msgid "" "modifies the global dispatch table shared by all users of the :mod:`copyreg` " "module." msgstr "" -#: ../../library/pickle.rst:822 +#: ../../library/pickle.rst:830 msgid "Handling Stateful Objects" msgstr "" -#: ../../library/pickle.rst:828 +#: ../../library/pickle.rst:836 msgid "" "Here's an example that shows how to modify pickling behavior for a class. " "The :class:`!TextReader` class below opens a text file, and returns the line " @@ -1254,7 +1265,7 @@ msgid "" "behavior. ::" msgstr "" -#: ../../library/pickle.rst:836 +#: ../../library/pickle.rst:844 msgid "" "class TextReader:\n" " \"\"\"Print and number lines in a text file.\"\"\"\n" @@ -1294,11 +1305,11 @@ msgid "" " self.file = file" msgstr "" -#: ../../library/pickle.rst:874 +#: ../../library/pickle.rst:882 msgid "A sample usage might be something like this::" msgstr "" -#: ../../library/pickle.rst:876 +#: ../../library/pickle.rst:884 msgid "" ">>> reader = TextReader(\"hello.txt\")\n" ">>> reader.readline()\n" @@ -1318,11 +1329,11 @@ msgstr "" ">>> new_reader.readline()\n" "'3: Goodbye!'" -#: ../../library/pickle.rst:888 +#: ../../library/pickle.rst:896 msgid "Custom Reduction for Types, Functions, and Other Objects" msgstr "" -#: ../../library/pickle.rst:892 +#: ../../library/pickle.rst:900 msgid "" "Sometimes, :attr:`~Pickler.dispatch_table` may not be flexible enough. In " "particular we may want to customize pickling based on another criterion than " @@ -1330,7 +1341,7 @@ msgid "" "classes." msgstr "" -#: ../../library/pickle.rst:897 +#: ../../library/pickle.rst:905 msgid "" "For those cases, it is possible to subclass from the :class:`Pickler` class " "and implement a :meth:`~Pickler.reducer_override` method. This method can " @@ -1339,14 +1350,14 @@ msgid "" "behavior." msgstr "" -#: ../../library/pickle.rst:902 +#: ../../library/pickle.rst:910 msgid "" "If both the :attr:`~Pickler.dispatch_table` and :meth:`~Pickler." "reducer_override` are defined, then :meth:`~Pickler.reducer_override` method " "takes priority." msgstr "" -#: ../../library/pickle.rst:907 +#: ../../library/pickle.rst:915 msgid "" "For performance reasons, :meth:`~Pickler.reducer_override` may not be called " "for the following objects: ``None``, ``True``, ``False``, and exact " @@ -1355,13 +1366,13 @@ msgid "" "`tuple`." msgstr "" -#: ../../library/pickle.rst:913 +#: ../../library/pickle.rst:921 msgid "" "Here is a simple example where we allow pickling and reconstructing a given " "class::" msgstr "" -#: ../../library/pickle.rst:916 +#: ../../library/pickle.rst:924 msgid "" "import io\n" "import pickle\n" @@ -1392,11 +1403,11 @@ msgid "" "assert unpickled_class.my_attribute == 1" msgstr "" -#: ../../library/pickle.rst:948 +#: ../../library/pickle.rst:956 msgid "Out-of-band Buffers" msgstr "" -#: ../../library/pickle.rst:952 +#: ../../library/pickle.rst:960 msgid "" "In some contexts, the :mod:`pickle` module is used to transfer massive " "amounts of data. Therefore, it can be important to minimize the number of " @@ -1406,7 +1417,7 @@ msgid "" "involves copying data to and from the pickle stream." msgstr "" -#: ../../library/pickle.rst:959 +#: ../../library/pickle.rst:967 msgid "" "This constraint can be eschewed if both the *provider* (the implementation " "of the object types to be transferred) and the *consumer* (the " @@ -1414,11 +1425,11 @@ msgid "" "transfer facilities provided by pickle protocol 5 and higher." msgstr "" -#: ../../library/pickle.rst:965 +#: ../../library/pickle.rst:973 msgid "Provider API" msgstr "" -#: ../../library/pickle.rst:967 +#: ../../library/pickle.rst:975 msgid "" "The large data objects to be pickled must implement a :meth:`~object." "__reduce_ex__` method specialized for protocol 5 and higher, which returns " @@ -1426,7 +1437,7 @@ msgid "" "for any large data." msgstr "" -#: ../../library/pickle.rst:972 +#: ../../library/pickle.rst:980 msgid "" "A :class:`PickleBuffer` object *signals* that the underlying buffer is " "eligible for out-of-band data transfer. Those objects remain compatible " @@ -1435,17 +1446,17 @@ msgid "" "themselves." msgstr "" -#: ../../library/pickle.rst:979 +#: ../../library/pickle.rst:987 msgid "Consumer API" msgstr "" -#: ../../library/pickle.rst:981 +#: ../../library/pickle.rst:989 msgid "" "A communications system can enable custom handling of the :class:" "`PickleBuffer` objects generated when serializing an object graph." msgstr "" -#: ../../library/pickle.rst:984 +#: ../../library/pickle.rst:992 msgid "" "On the sending side, it needs to pass a *buffer_callback* argument to :class:" "`Pickler` (or to the :func:`dump` or :func:`dumps` function), which will be " @@ -1454,7 +1465,7 @@ msgid "" "copied into the pickle stream, only a cheap marker will be inserted." msgstr "" -#: ../../library/pickle.rst:991 +#: ../../library/pickle.rst:999 msgid "" "On the receiving side, it needs to pass a *buffers* argument to :class:" "`Unpickler` (or to the :func:`load` or :func:`loads` function), which is an " @@ -1465,7 +1476,7 @@ msgid "" "`PickleBuffer` objects." msgstr "" -#: ../../library/pickle.rst:999 +#: ../../library/pickle.rst:1007 msgid "" "Between the sending side and the receiving side, the communications system " "is free to implement its own transfer mechanism for out-of-band buffers. " @@ -1473,17 +1484,17 @@ msgid "" "dependent compression." msgstr "" -#: ../../library/pickle.rst:1005 +#: ../../library/pickle.rst:1013 msgid "Example" msgstr "範例" -#: ../../library/pickle.rst:1007 +#: ../../library/pickle.rst:1015 msgid "" "Here is a trivial example where we implement a :class:`bytearray` subclass " "able to participate in out-of-band buffer pickling::" msgstr "" -#: ../../library/pickle.rst:1010 +#: ../../library/pickle.rst:1018 msgid "" "class ZeroCopyByteArray(bytearray):\n" "\n" @@ -1507,20 +1518,20 @@ msgid "" " return cls(obj)" msgstr "" -#: ../../library/pickle.rst:1031 +#: ../../library/pickle.rst:1039 msgid "" "The reconstructor (the ``_reconstruct`` class method) returns the buffer's " "providing object if it has the right type. This is an easy way to simulate " "zero-copy behaviour on this toy example." msgstr "" -#: ../../library/pickle.rst:1035 +#: ../../library/pickle.rst:1043 msgid "" "On the consumer side, we can pickle those objects the usual way, which when " "unserialized will give us a copy of the original object::" msgstr "" -#: ../../library/pickle.rst:1038 +#: ../../library/pickle.rst:1046 msgid "" "b = ZeroCopyByteArray(b\"abc\")\n" "data = pickle.dumps(b, protocol=5)\n" @@ -1529,13 +1540,13 @@ msgid "" "print(b is new_b) # False: a copy was made" msgstr "" -#: ../../library/pickle.rst:1044 +#: ../../library/pickle.rst:1052 msgid "" "But if we pass a *buffer_callback* and then give back the accumulated " "buffers when unserializing, we are able to get back the original object::" msgstr "" -#: ../../library/pickle.rst:1047 +#: ../../library/pickle.rst:1055 msgid "" "b = ZeroCopyByteArray(b\"abc\")\n" "buffers = []\n" @@ -1545,7 +1556,7 @@ msgid "" "print(b is new_b) # True: no copy was made" msgstr "" -#: ../../library/pickle.rst:1054 +#: ../../library/pickle.rst:1062 msgid "" "This example is limited by the fact that :class:`bytearray` allocates its " "own memory: you cannot create a :class:`bytearray` instance that is backed " @@ -1555,15 +1566,15 @@ msgid "" "processes or systems." msgstr "" -#: ../../library/pickle.rst:1061 +#: ../../library/pickle.rst:1069 msgid ":pep:`574` -- Pickle protocol 5 with out-of-band data" msgstr "" -#: ../../library/pickle.rst:1067 +#: ../../library/pickle.rst:1075 msgid "Restricting Globals" msgstr "" -#: ../../library/pickle.rst:1072 +#: ../../library/pickle.rst:1080 msgid "" "By default, unpickling will import any class or function that it finds in " "the pickle data. For many applications, this behaviour is unacceptable as " @@ -1571,7 +1582,7 @@ msgid "" "what this hand-crafted pickle data stream does when loaded::" msgstr "" -#: ../../library/pickle.rst:1077 +#: ../../library/pickle.rst:1085 msgid "" ">>> import pickle\n" ">>> pickle.loads(b\"cos\\nsystem\\n(S'echo hello world'\\ntR.\")\n" @@ -1583,7 +1594,7 @@ msgstr "" "hello world\n" "0" -#: ../../library/pickle.rst:1082 +#: ../../library/pickle.rst:1090 msgid "" "In this example, the unpickler imports the :func:`os.system` function and " "then apply the string argument \"echo hello world\". Although this example " @@ -1591,7 +1602,7 @@ msgid "" "system." msgstr "" -#: ../../library/pickle.rst:1086 +#: ../../library/pickle.rst:1094 msgid "" "For this reason, you may want to control what gets unpickled by customizing :" "meth:`Unpickler.find_class`. Unlike its name suggests, :meth:`Unpickler." @@ -1600,13 +1611,13 @@ msgid "" "restrict them to a safe subset." msgstr "" -#: ../../library/pickle.rst:1092 +#: ../../library/pickle.rst:1100 msgid "" "Here is an example of an unpickler allowing only few safe classes from the :" "mod:`builtins` module to be loaded::" msgstr "" -#: ../../library/pickle.rst:1095 +#: ../../library/pickle.rst:1103 msgid "" "import builtins\n" "import io\n" @@ -1635,11 +1646,11 @@ msgid "" " return RestrictedUnpickler(io.BytesIO(s)).load()" msgstr "" -#: ../../library/pickle.rst:1121 +#: ../../library/pickle.rst:1129 msgid "A sample usage of our unpickler working as intended::" msgstr "" -#: ../../library/pickle.rst:1123 +#: ../../library/pickle.rst:1131 msgid "" ">>> restricted_loads(pickle.dumps([1, 2, range(15)]))\n" "[1, 2, range(0, 15)]\n" @@ -1667,7 +1678,7 @@ msgstr "" " ...\n" "pickle.UnpicklingError: global 'builtins.eval' is forbidden" -#: ../../library/pickle.rst:1140 +#: ../../library/pickle.rst:1148 msgid "" "As our examples shows, you have to be careful with what you allow to be " "unpickled. Therefore if security is a concern, you may want to consider " @@ -1675,27 +1686,27 @@ msgid "" "party solutions." msgstr "" -#: ../../library/pickle.rst:1147 +#: ../../library/pickle.rst:1155 msgid "Performance" msgstr "" -#: ../../library/pickle.rst:1149 +#: ../../library/pickle.rst:1157 msgid "" "Recent versions of the pickle protocol (from protocol 2 and upwards) feature " "efficient binary encodings for several common features and built-in types. " "Also, the :mod:`pickle` module has a transparent optimizer written in C." msgstr "" -#: ../../library/pickle.rst:1157 +#: ../../library/pickle.rst:1165 msgid "Examples" msgstr "範例" -#: ../../library/pickle.rst:1159 +#: ../../library/pickle.rst:1167 msgid "" "For the simplest code, use the :func:`dump` and :func:`load` functions. ::" msgstr "" -#: ../../library/pickle.rst:1161 +#: ../../library/pickle.rst:1169 msgid "" "import pickle\n" "\n" @@ -1711,11 +1722,11 @@ msgid "" " pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)" msgstr "" -#: ../../library/pickle.rst:1175 +#: ../../library/pickle.rst:1183 msgid "The following example reads the resulting pickled data. ::" msgstr "" -#: ../../library/pickle.rst:1177 +#: ../../library/pickle.rst:1185 msgid "" "import pickle\n" "\n" @@ -1725,73 +1736,73 @@ msgid "" " data = pickle.load(f)" msgstr "" -#: ../../library/pickle.rst:1191 +#: ../../library/pickle.rst:1199 msgid "Module :mod:`copyreg`" msgstr ":mod:`copyreg` 模組" -#: ../../library/pickle.rst:1192 +#: ../../library/pickle.rst:1200 msgid "Pickle interface constructor registration for extension types." msgstr "" -#: ../../library/pickle.rst:1194 +#: ../../library/pickle.rst:1202 msgid "Module :mod:`pickletools`" msgstr ":mod:`pickletools` 模組" -#: ../../library/pickle.rst:1195 +#: ../../library/pickle.rst:1203 msgid "Tools for working with and analyzing pickled data." msgstr "" -#: ../../library/pickle.rst:1197 +#: ../../library/pickle.rst:1205 msgid "Module :mod:`shelve`" msgstr ":mod:`shelve` 模組" -#: ../../library/pickle.rst:1198 +#: ../../library/pickle.rst:1206 msgid "Indexed databases of objects; uses :mod:`pickle`." msgstr "" -#: ../../library/pickle.rst:1200 +#: ../../library/pickle.rst:1208 msgid "Module :mod:`copy`" msgstr ":mod:`copy` 模組" -#: ../../library/pickle.rst:1201 +#: ../../library/pickle.rst:1209 msgid "Shallow and deep object copying." msgstr "" -#: ../../library/pickle.rst:1203 +#: ../../library/pickle.rst:1211 msgid "Module :mod:`marshal`" msgstr ":mod:`marshal` 模組" -#: ../../library/pickle.rst:1204 +#: ../../library/pickle.rst:1212 msgid "High-performance serialization of built-in types." msgstr "" -#: ../../library/pickle.rst:1208 +#: ../../library/pickle.rst:1216 msgid "Footnotes" msgstr "註解" -#: ../../library/pickle.rst:1209 +#: ../../library/pickle.rst:1217 msgid "Don't confuse this with the :mod:`marshal` module" msgstr "" -#: ../../library/pickle.rst:1211 +#: ../../library/pickle.rst:1219 msgid "" "This is why :keyword:`lambda` functions cannot be pickled: all :keyword:`!" "lambda` functions share the same name: ````." msgstr "" -#: ../../library/pickle.rst:1214 +#: ../../library/pickle.rst:1222 msgid "" "The exception raised will likely be an :exc:`ImportError` or an :exc:" "`AttributeError` but it could be something else." msgstr "" -#: ../../library/pickle.rst:1217 +#: ../../library/pickle.rst:1225 msgid "" "The :mod:`copy` module uses this protocol for shallow and deep copying " "operations." msgstr "" -#: ../../library/pickle.rst:1220 +#: ../../library/pickle.rst:1228 msgid "" "The limitation on alphanumeric characters is due to the fact that persistent " "IDs in protocol 0 are delimited by the newline character. Therefore if any " @@ -1831,30 +1842,30 @@ msgstr "pickling" msgid "External Data Representation" msgstr "External Data Representation(外部資料表示法)" -#: ../../library/pickle.rst:664 +#: ../../library/pickle.rst:672 msgid "copy" msgstr "copy(複製)" -#: ../../library/pickle.rst:664 +#: ../../library/pickle.rst:672 msgid "protocol" msgstr "protocol(協定)" -#: ../../library/pickle.rst:748 +#: ../../library/pickle.rst:756 msgid "persistent_id (pickle protocol)" msgstr "persistent_id(pickle 協定)" -#: ../../library/pickle.rst:748 +#: ../../library/pickle.rst:756 msgid "persistent_load (pickle protocol)" msgstr "persistent_load(pickle 協定)" -#: ../../library/pickle.rst:824 +#: ../../library/pickle.rst:832 msgid "__getstate__() (copy protocol)" msgstr "__getstate__()(copy 協定)" -#: ../../library/pickle.rst:824 +#: ../../library/pickle.rst:832 msgid "__setstate__() (copy protocol)" msgstr "__setstate__()(copy 協定)" -#: ../../library/pickle.rst:1069 +#: ../../library/pickle.rst:1077 msgid "find_class() (pickle protocol)" msgstr "find_class()(pickle 協定)" diff --git a/library/platform.po b/library/platform.po index cd50812c59..de5e532153 100644 --- a/library/platform.po +++ b/library/platform.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-06-11 14:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -231,7 +231,14 @@ msgstr "" "回傳系統/OS 的名稱,例如 ``'Linux'``、``'Darwin'``、``'Java'``、" "``'Windows'``。如果該值無法確定則回傳一個空字串。" -#: ../../library/platform.rst:154 +#: ../../library/platform.rst:151 +msgid "" +"On iOS and Android, this returns the user-facing OS name (i.e, ``'iOS``, " +"``'iPadOS'`` or ``'Android'``). To obtain the kernel name (``'Darwin'`` or " +"``'Linux'``), use :func:`os.uname`." +msgstr "" + +#: ../../library/platform.rst:157 msgid "" "Returns ``(system, release, version)`` aliased to common marketing names " "used for some systems. It also does some reordering of the information in " @@ -240,7 +247,7 @@ msgstr "" "回傳做為某些系統所使用的常見行銷名稱之別名的 ``(system, release, version)``。" "它還會在可能導致混淆的情況下對資訊進行一些重新排序。" -#: ../../library/platform.rst:161 +#: ../../library/platform.rst:164 msgid "" "Returns the system's release version, e.g. ``'#3 on degas'``. An empty " "string is returned if the value cannot be determined." @@ -250,6 +257,12 @@ msgstr "" #: ../../library/platform.rst:167 msgid "" +"On iOS and Android, this is the user-facing OS version. To obtain the Darwin " +"or Linux kernel version, use :func:`os.uname`." +msgstr "" + +#: ../../library/platform.rst:172 +msgid "" "Fairly portable uname interface. Returns a :func:`~collections.namedtuple` " "containing six attributes: :attr:`system`, :attr:`node`, :attr:`release`, :" "attr:`version`, :attr:`machine`, and :attr:`processor`." @@ -258,11 +271,11 @@ msgstr "" "`~collections.namedtuple`::attr:`system`、:attr:`node`、:attr:`release`、:" "attr:`version`、:attr:`machine` 和 :attr:`processor`。" -#: ../../library/platform.rst:171 +#: ../../library/platform.rst:176 msgid ":attr:`processor` is resolved late, on demand." msgstr ":attr:`processor` 會延遲解析,有需求時才會解析" -#: ../../library/platform.rst:173 +#: ../../library/platform.rst:178 msgid "" "Note: the first two attribute names differ from the names presented by :func:" "`os.uname`, where they are named :attr:`sysname` and :attr:`nodename`." @@ -270,27 +283,27 @@ msgstr "" "注意:前兩個屬性名稱與 :func:`os.uname` 提供的名稱不同,它們分別命名為 :attr:" "`sysname` 和 :attr:`nodename`。" -#: ../../library/platform.rst:177 +#: ../../library/platform.rst:182 msgid "Entries which cannot be determined are set to ``''``." msgstr "無法確定的條目會被設為 ``''``。" -#: ../../library/platform.rst:179 +#: ../../library/platform.rst:184 msgid "Result changed from a tuple to a :func:`~collections.namedtuple`." msgstr "將結果從 tuple 改為 :func:`~collections.namedtuple`。" -#: ../../library/platform.rst:182 +#: ../../library/platform.rst:187 msgid ":attr:`processor` is resolved late instead of immediately." msgstr ":attr:`processor` 會延遲解析,並非立即解析。" -#: ../../library/platform.rst:187 +#: ../../library/platform.rst:192 msgid "Java Platform" msgstr "Java 平台" -#: ../../library/platform.rst:192 +#: ../../library/platform.rst:197 msgid "Version interface for Jython." msgstr "Jython 的版本介面。" -#: ../../library/platform.rst:194 +#: ../../library/platform.rst:199 msgid "" "Returns a tuple ``(release, vendor, vminfo, osinfo)`` with *vminfo* being a " "tuple ``(vm_name, vm_release, vm_vendor)`` and *osinfo* being a tuple " @@ -302,11 +315,17 @@ msgstr "" "os_version, os_arch)``。無法確定的值將被設為由參數所給定的預設值(預設均為 " "``''``\\ )。" -#: ../../library/platform.rst:201 +#: ../../library/platform.rst:204 +msgid "" +"It was largely untested, had a confusing API, and was only useful for Jython " +"support." +msgstr "" + +#: ../../library/platform.rst:210 msgid "Windows Platform" msgstr "Windows 平台" -#: ../../library/platform.rst:206 +#: ../../library/platform.rst:215 msgid "" "Get additional version information from the Windows Registry and return a " "tuple ``(release, version, csd, ptype)`` referring to OS release, version " @@ -318,7 +337,7 @@ msgstr "" "``(release, version, csd, ptype)``,它代表 OS 發行版、版本號、CSD 級別 " "(service pack) 和 OS 類型(多個/單個處理器)。" -#: ../../library/platform.rst:212 +#: ../../library/platform.rst:221 msgid "" "As a hint: *ptype* is ``'Uniprocessor Free'`` on single processor NT " "machines and ``'Multiprocessor Free'`` on multi processor machines. The " @@ -331,7 +350,7 @@ msgstr "" "錯程式。它也可能以 ``'Checked'`` 表示,代表該 OS 版本使用了除錯程式,即檢查引" "數、範圍等的程式。" -#: ../../library/platform.rst:220 +#: ../../library/platform.rst:229 msgid "" "Returns a string representing the current Windows edition, or ``None`` if " "the value cannot be determined. Possible values include but are not limited " @@ -341,7 +360,7 @@ msgstr "" "回傳一個代表當前 Windows 版本的字串。可能的值包括但不限於 ``'Enterprise'``、" "``'IoTUAP'``、``'ServerStandard'`` 和 ``'nanoserver'``。" -#: ../../library/platform.rst:228 +#: ../../library/platform.rst:237 msgid "" "Return ``True`` if the Windows edition returned by :func:`win32_edition` is " "recognized as an IoT edition." @@ -349,11 +368,11 @@ msgstr "" "如果 :func:`win32_edition` 回傳的 Windows 版本被識別為 IoT 版則回傳 " "``True``。" -#: ../../library/platform.rst:235 +#: ../../library/platform.rst:244 msgid "macOS Platform" msgstr "macOS 平台" -#: ../../library/platform.rst:240 +#: ../../library/platform.rst:248 msgid "" "Get macOS version information and return it as tuple ``(release, " "versioninfo, machine)`` with *versioninfo* being a tuple ``(version, " @@ -363,17 +382,54 @@ msgstr "" "其中 *versioninfo* 是一個 tuple ``(version, dev_stage, " "non_release_version)``。" -#: ../../library/platform.rst:244 +#: ../../library/platform.rst:252 msgid "" "Entries which cannot be determined are set to ``''``. All tuple entries are " "strings." msgstr "無法確定的條目會被設為 ``''``。所有 tuple 條目均為字串。" -#: ../../library/platform.rst:249 +#: ../../library/platform.rst:256 +msgid "iOS Platform" +msgstr "iOS 平台" + +#: ../../library/platform.rst:260 +msgid "" +"Get iOS version information and return it as a :func:`~collections." +"namedtuple` with the following attributes:" +msgstr "" + +#: ../../library/platform.rst:263 +msgid "``system`` is the OS name; either ``'iOS'`` or ``'iPadOS'``." +msgstr "" + +#: ../../library/platform.rst:264 +msgid "``release`` is the iOS version number as a string (e.g., ``'17.2'``)." +msgstr "" + +#: ../../library/platform.rst:265 +msgid "" +"``model`` is the device model identifier; this will be a string like " +"``'iPhone13,2'`` for a physical device, or ``'iPhone'`` on a simulator." +msgstr "" + +#: ../../library/platform.rst:267 +msgid "" +"``is_simulator`` is a boolean describing if the app is running on a " +"simulator or a physical device." +msgstr "" + +#: ../../library/platform.rst:270 +#, fuzzy +msgid "" +"Entries which cannot be determined are set to the defaults given as " +"parameters." +msgstr "無法確定的條目會被設為 ``''``。所有 tuple 條目均為字串。" + +#: ../../library/platform.rst:275 msgid "Unix Platforms" msgstr "Unix 平台" -#: ../../library/platform.rst:253 +#: ../../library/platform.rst:279 msgid "" "Tries to determine the libc version against which the file executable " "(defaults to the Python interpreter) is linked. Returns a tuple of strings " @@ -383,7 +439,7 @@ msgstr "" "嘗試確認可執行檔案(預設為 Python 直譯器)所連結到的 libc 版本。回傳一個字串 " "tuple ``(lib, version)``,當查詢失敗時其預設值將被設為給定的參數值。" -#: ../../library/platform.rst:257 +#: ../../library/platform.rst:283 msgid "" "Note that this function has intimate knowledge of how different libc " "versions add symbols to the executable is probably only usable for " @@ -392,15 +448,15 @@ msgstr "" "請注意,此函式對於不同 libc 版本如何為可執行檔案新增符號的方式有深層的關聯," "可能僅適用於以 :program:`gcc` 編譯出來的可執行檔案。" -#: ../../library/platform.rst:261 +#: ../../library/platform.rst:287 msgid "The file is read and scanned in chunks of *chunksize* bytes." msgstr "檔案會以 *chunksize* 位元組大小的分塊 (chunk) 來讀取和掃描。" -#: ../../library/platform.rst:265 +#: ../../library/platform.rst:291 msgid "Linux Platforms" msgstr "Linux 平台" -#: ../../library/platform.rst:269 +#: ../../library/platform.rst:295 msgid "" "Get operating system identification from ``os-release`` file and return it " "as a dict. The ``os-release`` file is a `freedesktop.org standard `_、並在大多數 Linux 發行版上可用。一個重要的例外" "是 Android 和基於 Android 的發行版。" -#: ../../library/platform.rst:275 +#: ../../library/platform.rst:301 msgid "" "Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor ``/" "usr/lib/os-release`` can be read." @@ -421,7 +477,7 @@ msgstr "" "當 ``/etc/os-release`` 與 ``/usr/lib/os-release`` 均無法被讀取時將引發 :exc:" "`OSError` 或其子類別。" -#: ../../library/platform.rst:278 +#: ../../library/platform.rst:304 msgid "" "On success, the function returns a dictionary where keys and values are " "strings. Values have their special characters like ``\"`` and ``$`` " @@ -434,7 +490,7 @@ msgstr "" "``PRETTY_NAME`` 總會按照標準來定義。所有其他欄位都是可選的。根據不同廠商可能" "會包括額外的欄位。" -#: ../../library/platform.rst:284 +#: ../../library/platform.rst:310 msgid "" "Note that fields like ``NAME``, ``VERSION``, and ``VARIANT`` are strings " "suitable for presentation to users. Programs should use fields like ``ID``, " @@ -445,11 +501,11 @@ msgstr "" "串。程式應當使用 ``ID``、``ID_LIKE``、``VERSION_ID`` 或 ``VARIANT_ID`` 等欄位" "來標識 Linux 發行版。" -#: ../../library/platform.rst:289 +#: ../../library/platform.rst:315 msgid "Example::" msgstr "範例: ::" -#: ../../library/platform.rst:291 +#: ../../library/platform.rst:317 msgid "" "def get_like_distro():\n" " info = platform.freedesktop_os_release()\n" @@ -459,3 +515,55 @@ msgid "" " ids.extend(info[\"ID_LIKE\"].split())\n" " return ids" msgstr "" + +#: ../../library/platform.rst:329 +msgid "Android Platform" +msgstr "Android 平台" + +#: ../../library/platform.rst:334 +msgid "" +"Get Android device information. Returns a :func:`~collections.namedtuple` " +"with the following attributes. Values which cannot be determined are set to " +"the defaults given as parameters." +msgstr "" + +#: ../../library/platform.rst:338 +msgid "``release`` - Android version, as a string (e.g. ``\"14\"``)." +msgstr "" + +#: ../../library/platform.rst:340 +msgid "" +"``api_level`` - API level of the running device, as an integer (e.g. ``34`` " +"for Android 14). To get the API level which Python was built against, see :" +"func:`sys.getandroidapilevel`." +msgstr "" + +#: ../../library/platform.rst:344 +msgid "" +"``manufacturer`` - `Manufacturer name `__." +msgstr "" + +#: ../../library/platform.rst:347 +msgid "" +"``model`` - `Model name `__ – typically the marketing name or model number." +msgstr "" + +#: ../../library/platform.rst:351 +msgid "" +"``device`` - `Device name `__ – typically the model number or a codename." +msgstr "" + +#: ../../library/platform.rst:355 +msgid "" +"``is_emulator`` - ``True`` if the device is an emulator; ``False`` if it's a " +"physical device." +msgstr "" + +#: ../../library/platform.rst:358 +msgid "" +"Google maintains a `list of known model and device names `__." +msgstr "" diff --git a/library/plistlib.po b/library/plistlib.po index 5f182c6e90..282baf27aa 100644 --- a/library/plistlib.po +++ b/library/plistlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2016-01-31 07:27+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -48,8 +48,8 @@ msgstr "" #: ../../library/plistlib.rst:30 msgid "" -"To work with plist data in bytes objects, use :func:`dumps` and :func:" -"`loads`." +"To work with plist data in bytes or string objects, use :func:`dumps` and :" +"func:`loads`." msgstr "" #: ../../library/plistlib.rst:33 @@ -117,111 +117,133 @@ msgstr "" #: ../../library/plistlib.rst:72 msgid "" +"When *aware_datetime* is true, fields with type ``datetime.datetime`` will " +"be created as :ref:`aware object `, with :attr:`!" +"tzinfo` as :attr:`datetime.UTC`." +msgstr "" + +#: ../../library/plistlib.rst:76 +msgid "" "XML data for the :data:`FMT_XML` format is parsed using the Expat parser " "from :mod:`xml.parsers.expat` -- see its documentation for possible " "exceptions on ill-formed XML. Unknown elements will simply be ignored by " "the plist parser." msgstr "" -#: ../../library/plistlib.rst:77 +#: ../../library/plistlib.rst:81 msgid "" "The parser for the binary format raises :exc:`InvalidFileException` when the " "file cannot be parsed." msgstr "" -#: ../../library/plistlib.rst:85 +#: ../../library/plistlib.rst:86 ../../library/plistlib.rst:131 +msgid "The keyword-only parameter *aware_datetime* has been added." +msgstr "" + +#: ../../library/plistlib.rst:92 msgid "" -"Load a plist from a bytes object. See :func:`load` for an explanation of the " -"keyword arguments." +"Load a plist from a bytes or string object. See :func:`load` for an " +"explanation of the keyword arguments." +msgstr "" + +#: ../../library/plistlib.rst:97 +msgid "*data* can be a string when *fmt* equals :data:`FMT_XML`." msgstr "" -#: ../../library/plistlib.rst:93 +#: ../../library/plistlib.rst:102 msgid "" "Write *value* to a plist file. *Fp* should be a writable, binary file object." msgstr "" -#: ../../library/plistlib.rst:96 +#: ../../library/plistlib.rst:105 msgid "" "The *fmt* argument specifies the format of the plist file and can be one of " "the following values:" msgstr "" -#: ../../library/plistlib.rst:99 +#: ../../library/plistlib.rst:108 msgid ":data:`FMT_XML`: XML formatted plist file" msgstr "" -#: ../../library/plistlib.rst:101 +#: ../../library/plistlib.rst:110 msgid ":data:`FMT_BINARY`: Binary formatted plist file" msgstr "" -#: ../../library/plistlib.rst:103 +#: ../../library/plistlib.rst:112 msgid "" "When *sort_keys* is true (the default) the keys for dictionaries will be " "written to the plist in sorted order, otherwise they will be written in the " "iteration order of the dictionary." msgstr "" -#: ../../library/plistlib.rst:107 +#: ../../library/plistlib.rst:116 msgid "" "When *skipkeys* is false (the default) the function raises :exc:`TypeError` " "when a key of a dictionary is not a string, otherwise such keys are skipped." msgstr "" -#: ../../library/plistlib.rst:110 +#: ../../library/plistlib.rst:119 +msgid "" +"When *aware_datetime* is true and any field with type ``datetime.datetime`` " +"is set as an :ref:`aware object `, it will convert to " +"UTC timezone before writing it." +msgstr "" + +#: ../../library/plistlib.rst:123 msgid "" "A :exc:`TypeError` will be raised if the object is of an unsupported type or " "a container that contains objects of unsupported types." msgstr "" -#: ../../library/plistlib.rst:113 +#: ../../library/plistlib.rst:126 msgid "" "An :exc:`OverflowError` will be raised for integer values that cannot be " "represented in (binary) plist files." msgstr "" -#: ../../library/plistlib.rst:121 +#: ../../library/plistlib.rst:137 msgid "" "Return *value* as a plist-formatted bytes object. See the documentation for :" "func:`dump` for an explanation of the keyword arguments of this function." msgstr "" -#: ../../library/plistlib.rst:128 +#: ../../library/plistlib.rst:144 msgid "The following classes are available:" msgstr "" -#: ../../library/plistlib.rst:132 +#: ../../library/plistlib.rst:148 msgid "" "Wraps an :class:`int`. This is used when reading or writing NSKeyedArchiver " "encoded data, which contains UID (see PList manual)." msgstr "" -#: ../../library/plistlib.rst:135 +#: ../../library/plistlib.rst:151 msgid "" "It has one attribute, :attr:`data`, which can be used to retrieve the int " "value of the UID. :attr:`data` must be in the range ``0 <= data < 2**64``." msgstr "" -#: ../../library/plistlib.rst:141 +#: ../../library/plistlib.rst:157 msgid "The following constants are available:" msgstr "" -#: ../../library/plistlib.rst:145 +#: ../../library/plistlib.rst:161 msgid "The XML format for plist files." msgstr "" -#: ../../library/plistlib.rst:152 +#: ../../library/plistlib.rst:168 msgid "The binary format for plist files" msgstr "" -#: ../../library/plistlib.rst:158 +#: ../../library/plistlib.rst:174 msgid "Examples" msgstr "範例" -#: ../../library/plistlib.rst:160 +#: ../../library/plistlib.rst:176 msgid "Generating a plist::" msgstr "" -#: ../../library/plistlib.rst:162 +#: ../../library/plistlib.rst:178 msgid "" "import datetime\n" "import plistlib\n" @@ -263,11 +285,11 @@ msgstr "" ")\n" "print(plistlib.dumps(pl).decode())" -#: ../../library/plistlib.rst:182 +#: ../../library/plistlib.rst:198 msgid "Parsing a plist::" msgstr "" -#: ../../library/plistlib.rst:184 +#: ../../library/plistlib.rst:200 msgid "" "import plistlib\n" "\n" diff --git a/library/poplib.po b/library/poplib.po index 7e4a2dde67..56f717a4f5 100644 --- a/library/poplib.po +++ b/library/poplib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -52,14 +52,14 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid ":ref:`Availability `: not WASI." msgstr "" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/profile.po b/library/profile.po index 2c93bffa6c..aa480c4282 100644 --- a/library/profile.po +++ b/library/profile.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -422,8 +422,7 @@ msgstr "" #: ../../library/profile.rst:236 msgid "" "This function is similar to :func:`run`, with added arguments to supply the " -"globals and locals dictionaries for the *command* string. This routine " -"executes::" +"globals and locals mappings for the *command* string. This routine executes::" msgstr "" #: ../../library/profile.rst:240 @@ -522,25 +521,36 @@ msgid "" "print the results to stdout." msgstr "" -#: ../../library/profile.rst:304 +#: ../../library/profile.rst:302 +msgid "" +"The *sort* parameter specifies the sorting order of the displayed " +"statistics. It accepts a single key or a tuple of keys to enable multi-level " +"sorting, as in :func:`Stats.sort_stats `." +msgstr "" + +#: ../../library/profile.rst:306 +msgid ":meth:`~Profile.print_stats` now accepts a tuple of keys." +msgstr "" + +#: ../../library/profile.rst:311 msgid "Write the results of the current profile to *filename*." msgstr "" -#: ../../library/profile.rst:308 +#: ../../library/profile.rst:315 msgid "Profile the cmd via :func:`exec`." msgstr "" -#: ../../library/profile.rst:312 +#: ../../library/profile.rst:319 msgid "" "Profile the cmd via :func:`exec` with the specified global and local " "environment." msgstr "" -#: ../../library/profile.rst:317 +#: ../../library/profile.rst:324 msgid "Profile ``func(*args, **kwargs)``" msgstr "" -#: ../../library/profile.rst:319 +#: ../../library/profile.rst:326 msgid "" "Note that profiling will only work if the called command/function actually " "returns. If the interpreter is terminated (e.g. via a :func:`sys.exit` call " @@ -548,23 +558,23 @@ msgid "" "printed." msgstr "" -#: ../../library/profile.rst:327 +#: ../../library/profile.rst:334 msgid "The :class:`Stats` Class" msgstr "" -#: ../../library/profile.rst:329 +#: ../../library/profile.rst:336 msgid "" "Analysis of the profiler data is done using the :class:`~pstats.Stats` class." msgstr "" -#: ../../library/profile.rst:336 +#: ../../library/profile.rst:343 msgid "" "This class constructor creates an instance of a \"statistics object\" from a " "*filename* (or list of filenames) or from a :class:`Profile` instance. " "Output will be printed to the stream specified by *stream*." msgstr "" -#: ../../library/profile.rst:340 +#: ../../library/profile.rst:347 msgid "" "The file selected by the above constructor must have been created by the " "corresponding version of :mod:`profile` or :mod:`cProfile`. To be specific, " @@ -578,17 +588,17 @@ msgid "" "can be used." msgstr "" -#: ../../library/profile.rst:351 +#: ../../library/profile.rst:358 msgid "" "Instead of reading the profile data from a file, a :class:`cProfile.Profile` " "or :class:`profile.Profile` object can be used as the profile data source." msgstr "" -#: ../../library/profile.rst:354 +#: ../../library/profile.rst:361 msgid ":class:`Stats` objects have the following methods:" msgstr "" -#: ../../library/profile.rst:358 +#: ../../library/profile.rst:365 msgid "" "This method for the :class:`Stats` class removes all leading path " "information from file names. It is very useful in reducing the size of the " @@ -602,7 +612,7 @@ msgid "" "single entry." msgstr "" -#: ../../library/profile.rst:372 +#: ../../library/profile.rst:379 msgid "" "This method of the :class:`Stats` class accumulates additional profiling " "information into the current profiling object. Its arguments should refer " @@ -611,7 +621,7 @@ msgid "" "functions are automatically accumulated into single function statistics." msgstr "" -#: ../../library/profile.rst:382 +#: ../../library/profile.rst:389 msgid "" "Save the data loaded into the :class:`Stats` object to a file named " "*filename*. The file is created if it does not exist, and is overwritten if " @@ -619,7 +629,7 @@ msgid "" "the :class:`profile.Profile` and :class:`cProfile.Profile` classes." msgstr "" -#: ../../library/profile.rst:390 +#: ../../library/profile.rst:397 msgid "" "This method modifies the :class:`Stats` object by sorting it according to " "the supplied criteria. The argument can be either a string or a SortKey " @@ -629,7 +639,7 @@ msgid "" "prone." msgstr "" -#: ../../library/profile.rst:397 +#: ../../library/profile.rst:404 msgid "" "When more than one key is provided, then additional keys are used as " "secondary criteria when there is equality in all keys selected before them. " @@ -638,164 +648,164 @@ msgid "" "function names) by sorting by file name." msgstr "" -#: ../../library/profile.rst:403 +#: ../../library/profile.rst:410 msgid "" "For the string argument, abbreviations can be used for any key names, as " "long as the abbreviation is unambiguous." msgstr "" -#: ../../library/profile.rst:406 +#: ../../library/profile.rst:413 msgid "The following are the valid string and SortKey:" msgstr "" -#: ../../library/profile.rst:409 +#: ../../library/profile.rst:416 msgid "Valid String Arg" msgstr "" -#: ../../library/profile.rst:409 +#: ../../library/profile.rst:416 msgid "Valid enum Arg" msgstr "" -#: ../../library/profile.rst:409 +#: ../../library/profile.rst:416 msgid "Meaning" msgstr "含義" -#: ../../library/profile.rst:411 +#: ../../library/profile.rst:418 msgid "``'calls'``" msgstr "``'calls'``" -#: ../../library/profile.rst:411 +#: ../../library/profile.rst:418 msgid "SortKey.CALLS" msgstr "SortKey.CALLS" -#: ../../library/profile.rst:411 ../../library/profile.rst:423 +#: ../../library/profile.rst:418 ../../library/profile.rst:430 msgid "call count" msgstr "" -#: ../../library/profile.rst:413 +#: ../../library/profile.rst:420 msgid "``'cumulative'``" msgstr "``'cumulative'``" -#: ../../library/profile.rst:413 +#: ../../library/profile.rst:420 msgid "SortKey.CUMULATIVE" msgstr "SortKey.CUMULATIVE" -#: ../../library/profile.rst:413 ../../library/profile.rst:415 +#: ../../library/profile.rst:420 ../../library/profile.rst:422 msgid "cumulative time" msgstr "" -#: ../../library/profile.rst:415 +#: ../../library/profile.rst:422 msgid "``'cumtime'``" msgstr "``'cumtime'``" -#: ../../library/profile.rst:415 ../../library/profile.rst:417 -#: ../../library/profile.rst:421 ../../library/profile.rst:423 -#: ../../library/profile.rst:437 +#: ../../library/profile.rst:422 ../../library/profile.rst:424 +#: ../../library/profile.rst:428 ../../library/profile.rst:430 +#: ../../library/profile.rst:444 msgid "N/A" msgstr "N/A" -#: ../../library/profile.rst:417 +#: ../../library/profile.rst:424 msgid "``'file'``" msgstr "``'file'``" -#: ../../library/profile.rst:417 ../../library/profile.rst:419 -#: ../../library/profile.rst:421 +#: ../../library/profile.rst:424 ../../library/profile.rst:426 +#: ../../library/profile.rst:428 msgid "file name" msgstr "file name(檔案名稱)" -#: ../../library/profile.rst:419 +#: ../../library/profile.rst:426 msgid "``'filename'``" msgstr "``'filename'``" -#: ../../library/profile.rst:419 +#: ../../library/profile.rst:426 msgid "SortKey.FILENAME" msgstr "SortKey.FILENAME" -#: ../../library/profile.rst:421 +#: ../../library/profile.rst:428 msgid "``'module'``" msgstr "``'module'``" -#: ../../library/profile.rst:423 +#: ../../library/profile.rst:430 msgid "``'ncalls'``" msgstr "``'ncalls'``" -#: ../../library/profile.rst:425 +#: ../../library/profile.rst:432 msgid "``'pcalls'``" msgstr "``'pcalls'``" -#: ../../library/profile.rst:425 +#: ../../library/profile.rst:432 msgid "SortKey.PCALLS" msgstr "SortKey.PCALLS" -#: ../../library/profile.rst:425 +#: ../../library/profile.rst:432 msgid "primitive call count" msgstr "" -#: ../../library/profile.rst:427 +#: ../../library/profile.rst:434 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/profile.rst:427 +#: ../../library/profile.rst:434 msgid "SortKey.LINE" msgstr "SortKey.LINE" -#: ../../library/profile.rst:427 +#: ../../library/profile.rst:434 msgid "line number" msgstr "列號" -#: ../../library/profile.rst:429 +#: ../../library/profile.rst:436 msgid "``'name'``" msgstr "``'name'``" -#: ../../library/profile.rst:429 +#: ../../library/profile.rst:436 msgid "SortKey.NAME" msgstr "SortKey.NAME" -#: ../../library/profile.rst:429 +#: ../../library/profile.rst:436 msgid "function name" msgstr "" -#: ../../library/profile.rst:431 +#: ../../library/profile.rst:438 msgid "``'nfl'``" msgstr "``'nfl'``" -#: ../../library/profile.rst:431 +#: ../../library/profile.rst:438 msgid "SortKey.NFL" msgstr "SortKey.NFL" -#: ../../library/profile.rst:431 +#: ../../library/profile.rst:438 msgid "name/file/line" msgstr "" -#: ../../library/profile.rst:433 +#: ../../library/profile.rst:440 msgid "``'stdname'``" msgstr "``'stdname'``" -#: ../../library/profile.rst:433 +#: ../../library/profile.rst:440 msgid "SortKey.STDNAME" msgstr "SortKey.STDNAME" -#: ../../library/profile.rst:433 +#: ../../library/profile.rst:440 msgid "standard name" msgstr "" -#: ../../library/profile.rst:435 +#: ../../library/profile.rst:442 msgid "``'time'``" msgstr "``'time'``" -#: ../../library/profile.rst:435 +#: ../../library/profile.rst:442 msgid "SortKey.TIME" msgstr "SortKey.TIME" -#: ../../library/profile.rst:435 ../../library/profile.rst:437 +#: ../../library/profile.rst:442 ../../library/profile.rst:444 msgid "internal time" msgstr "" -#: ../../library/profile.rst:437 +#: ../../library/profile.rst:444 msgid "``'tottime'``" msgstr "``'tottime'``" -#: ../../library/profile.rst:440 +#: ../../library/profile.rst:447 msgid "" "Note that all sorts on statistics are in descending order (placing most time " "consuming items first), where as name, file, and line number searches are in " @@ -809,7 +819,7 @@ msgid "" "SortKey.FILENAME, SortKey.LINE)``." msgstr "" -#: ../../library/profile.rst:451 +#: ../../library/profile.rst:458 msgid "" "For backward-compatibility reasons, the numeric arguments ``-1``, ``0``, " "``1``, and ``2`` are permitted. They are interpreted as ``'stdname'``, " @@ -818,31 +828,31 @@ msgid "" "used, and additional arguments will be silently ignored." msgstr "" -#: ../../library/profile.rst:459 +#: ../../library/profile.rst:466 msgid "Added the SortKey enum." msgstr "" -#: ../../library/profile.rst:464 +#: ../../library/profile.rst:471 msgid "" "This method for the :class:`Stats` class reverses the ordering of the basic " "list within the object. Note that by default ascending vs descending order " "is properly selected based on the sort key of choice." msgstr "" -#: ../../library/profile.rst:474 +#: ../../library/profile.rst:481 msgid "" "This method for the :class:`Stats` class prints out a report as described in " "the :func:`profile.run` definition." msgstr "" -#: ../../library/profile.rst:477 +#: ../../library/profile.rst:484 msgid "" "The order of the printing is based on the last :meth:`~pstats.Stats." "sort_stats` operation done on the object (subject to caveats in :meth:" "`~pstats.Stats.add` and :meth:`~pstats.Stats.strip_dirs`)." msgstr "" -#: ../../library/profile.rst:482 +#: ../../library/profile.rst:489 msgid "" "The arguments provided (if any) can be used to limit the list down to the " "significant entries. Initially, the list is taken to be the complete set of " @@ -854,28 +864,28 @@ msgid "" "example::" msgstr "" -#: ../../library/profile.rst:491 +#: ../../library/profile.rst:498 msgid "print_stats(.1, 'foo:')" msgstr "print_stats(.1, 'foo:')" -#: ../../library/profile.rst:493 +#: ../../library/profile.rst:500 msgid "" "would first limit the printing to first 10% of list, and then only print " "functions that were part of filename :file:`.\\*foo:`. In contrast, the " "command::" msgstr "" -#: ../../library/profile.rst:497 +#: ../../library/profile.rst:504 msgid "print_stats('foo:', .1)" msgstr "print_stats('foo:', .1)" -#: ../../library/profile.rst:499 +#: ../../library/profile.rst:506 msgid "" "would limit the list to all functions having file names :file:`.\\*foo:`, " "and then proceed to only print the first 10% of them." msgstr "" -#: ../../library/profile.rst:505 +#: ../../library/profile.rst:512 msgid "" "This method for the :class:`Stats` class prints a list of all functions that " "called each function in the profiled database. The ordering is identical to " @@ -885,7 +895,7 @@ msgid "" "produced the stats:" msgstr "" -#: ../../library/profile.rst:512 +#: ../../library/profile.rst:519 msgid "" "With :mod:`profile`, a number is shown in parentheses after each caller to " "show how many times this specific call was made. For convenience, a second " @@ -893,14 +903,14 @@ msgid "" "at the right." msgstr "" -#: ../../library/profile.rst:517 +#: ../../library/profile.rst:524 msgid "" "With :mod:`cProfile`, each caller is preceded by three numbers: the number " "of times this specific call was made, and the total and cumulative times " "spent in the current function while it was invoked by this specific caller." msgstr "" -#: ../../library/profile.rst:525 +#: ../../library/profile.rst:532 msgid "" "This method for the :class:`Stats` class prints a list of all function that " "were called by the indicated function. Aside from this reversal of " @@ -908,7 +918,7 @@ msgid "" "are identical to the :meth:`~pstats.Stats.print_callers` method." msgstr "" -#: ../../library/profile.rst:533 +#: ../../library/profile.rst:540 msgid "" "This method returns an instance of StatsProfile, which contains a mapping of " "function names to instances of FunctionProfile. Each FunctionProfile " @@ -916,17 +926,17 @@ msgid "" "long the function took to run, how many times it was called, etc..." msgstr "" -#: ../../library/profile.rst:538 +#: ../../library/profile.rst:545 msgid "" "Added the following dataclasses: StatsProfile, FunctionProfile. Added the " "following function: get_stats_profile." msgstr "" -#: ../../library/profile.rst:545 +#: ../../library/profile.rst:552 msgid "What Is Deterministic Profiling?" msgstr "" -#: ../../library/profile.rst:547 +#: ../../library/profile.rst:554 msgid "" ":dfn:`Deterministic profiling` is meant to reflect the fact that all " "*function call*, *function return*, and *exception* events are monitored, " @@ -939,7 +949,7 @@ msgid "" "being spent." msgstr "" -#: ../../library/profile.rst:556 +#: ../../library/profile.rst:563 msgid "" "In Python, since there is an interpreter active during execution, the " "presence of instrumented code is not required in order to do deterministic " @@ -951,7 +961,7 @@ msgid "" "time statistics about the execution of a Python program." msgstr "" -#: ../../library/profile.rst:565 +#: ../../library/profile.rst:572 msgid "" "Call count statistics can be used to identify bugs in code (surprising " "counts), and to identify possible inline-expansion points (high call " @@ -963,11 +973,11 @@ msgid "" "compared to iterative implementations." msgstr "" -#: ../../library/profile.rst:578 +#: ../../library/profile.rst:585 msgid "Limitations" msgstr "限制" -#: ../../library/profile.rst:580 +#: ../../library/profile.rst:587 msgid "" "One limitation has to do with accuracy of timing information. There is a " "fundamental problem with deterministic profilers involving accuracy. The " @@ -978,7 +988,7 @@ msgid "" "first error induces a second source of error." msgstr "" -#: ../../library/profile.rst:588 +#: ../../library/profile.rst:595 msgid "" "The second problem is that it \"takes a while\" from when an event is " "dispatched until the profiler's call to get the time actually *gets* the " @@ -991,7 +1001,7 @@ msgid "" "clock tick), but it *can* accumulate and become very significant." msgstr "" -#: ../../library/profile.rst:598 +#: ../../library/profile.rst:605 msgid "" "The problem is more important with :mod:`profile` than with the lower-" "overhead :mod:`cProfile`. For this reason, :mod:`profile` provides a means " @@ -1005,11 +1015,11 @@ msgid "" "calibration." msgstr "" -#: ../../library/profile.rst:612 +#: ../../library/profile.rst:619 msgid "Calibration" msgstr "校正" -#: ../../library/profile.rst:614 +#: ../../library/profile.rst:621 msgid "" "The profiler of the :mod:`profile` module subtracts a constant from each " "event handling time to compensate for the overhead of calling the time " @@ -1018,7 +1028,7 @@ msgid "" "platform (see :ref:`profile-limitations`). ::" msgstr "" -#: ../../library/profile.rst:620 +#: ../../library/profile.rst:627 msgid "" "import profile\n" "pr = profile.Profile()\n" @@ -1030,7 +1040,7 @@ msgstr "" "for i in range(5):\n" " print(pr.calibrate(10000))" -#: ../../library/profile.rst:625 +#: ../../library/profile.rst:632 msgid "" "The method executes the number of Python calls given by the argument, " "directly and again under the profiler, measuring the time for both. It then " @@ -1040,19 +1050,19 @@ msgid "" "4.04e-6." msgstr "" -#: ../../library/profile.rst:631 +#: ../../library/profile.rst:638 msgid "" "The object of this exercise is to get a fairly consistent result. If your " "computer is *very* fast, or your timer function has poor resolution, you " "might have to pass 100000, or even 1000000, to get consistent results." msgstr "" -#: ../../library/profile.rst:635 +#: ../../library/profile.rst:642 msgid "" "When you have a consistent answer, there are three ways you can use it::" msgstr "" -#: ../../library/profile.rst:637 +#: ../../library/profile.rst:644 msgid "" "import profile\n" "\n" @@ -1067,40 +1077,40 @@ msgid "" "pr = profile.Profile(bias=your_computed_bias)" msgstr "" -#: ../../library/profile.rst:649 +#: ../../library/profile.rst:656 msgid "" "If you have a choice, you are better off choosing a smaller constant, and " "then your results will \"less often\" show up as negative in profile " "statistics." msgstr "" -#: ../../library/profile.rst:655 +#: ../../library/profile.rst:662 msgid "Using a custom timer" msgstr "" -#: ../../library/profile.rst:657 +#: ../../library/profile.rst:664 msgid "" "If you want to change how current time is determined (for example, to force " "use of wall-clock time or elapsed process time), pass the timing function " "you want to the :class:`Profile` class constructor::" msgstr "" -#: ../../library/profile.rst:661 +#: ../../library/profile.rst:668 msgid "pr = profile.Profile(your_time_func)" msgstr "pr = profile.Profile(your_time_func)" -#: ../../library/profile.rst:663 +#: ../../library/profile.rst:670 msgid "" "The resulting profiler will then call ``your_time_func``. Depending on " "whether you are using :class:`profile.Profile` or :class:`cProfile.Profile`, " "``your_time_func``'s return value will be interpreted differently:" msgstr "" -#: ../../library/profile.rst:667 +#: ../../library/profile.rst:674 msgid ":class:`profile.Profile`" msgstr ":class:`profile.Profile`" -#: ../../library/profile.rst:668 +#: ../../library/profile.rst:675 msgid "" "``your_time_func`` should return a single number, or a list of numbers whose " "sum is the current time (like what :func:`os.times` returns). If the " @@ -1109,7 +1119,7 @@ msgid "" "routine." msgstr "" -#: ../../library/profile.rst:674 +#: ../../library/profile.rst:681 msgid "" "Be warned that you should calibrate the profiler class for the timer " "function that you choose (see :ref:`profile-calibration`). For most " @@ -1121,11 +1131,11 @@ msgid "" "along with the appropriate calibration constant." msgstr "" -#: ../../library/profile.rst:683 +#: ../../library/profile.rst:690 msgid ":class:`cProfile.Profile`" msgstr ":class:`cProfile.Profile`" -#: ../../library/profile.rst:684 +#: ../../library/profile.rst:691 msgid "" "``your_time_func`` should return a single number. If it returns integers, " "you can also invoke the class constructor with a second argument specifying " @@ -1134,11 +1144,11 @@ msgid "" "you would construct the :class:`Profile` instance as follows::" msgstr "" -#: ../../library/profile.rst:690 +#: ../../library/profile.rst:697 msgid "pr = cProfile.Profile(your_integer_time_func, 0.001)" msgstr "pr = cProfile.Profile(your_integer_time_func, 0.001)" -#: ../../library/profile.rst:692 +#: ../../library/profile.rst:699 msgid "" "As the :class:`cProfile.Profile` class cannot be calibrated, custom timer " "functions should be used with care and should be as fast as possible. For " @@ -1146,7 +1156,7 @@ msgid "" "in the C source of the internal :mod:`!_lsprof` module." msgstr "" -#: ../../library/profile.rst:697 +#: ../../library/profile.rst:704 msgid "" "Python 3.3 adds several new functions in :mod:`time` that can be used to " "make precise measurements of process or wall-clock time. For example, see :" diff --git a/library/pwd.po b/library/pwd.po index 688e42e08f..29507dc008 100644 --- a/library/pwd.po +++ b/library/pwd.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-05-20 16:08+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,7 +31,8 @@ msgstr "" "此模組提供對 Unix 使用者帳戶和密碼資料庫的存取介面。它適用於所有 Unix 版本。" #: ../../library/pwd.rst:13 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +#, fuzzy +msgid ":ref:`Availability `: Unix, not WASI, not iOS." msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" #: ../../library/pwd.rst:15 @@ -147,16 +148,16 @@ msgstr "" "uid 和 gid 項目為整數,其他項目都是字串。如果找不到請求的條目,則會引發 :exc:" "`KeyError`。" -#: ../../library/pwd.rst:44 +#: ../../library/pwd.rst:42 +#, fuzzy msgid "" "In traditional Unix the field ``pw_passwd`` usually contains a password " -"encrypted with a DES derived algorithm (see module :mod:`crypt`). However " -"most modern unices use a so-called *shadow password* system. On those " -"unices the *pw_passwd* field only contains an asterisk (``'*'``) or the " -"letter ``'x'`` where the encrypted password is stored in a file :file:`/etc/" -"shadow` which is not world readable. Whether the *pw_passwd* field contains " -"anything useful is system-dependent. If available, the :mod:`spwd` module " -"should be used where access to the encrypted password is required." +"encrypted with a DES derived algorithm. However most modern unices use a " +"so-called *shadow password* system. On those unices the *pw_passwd* field " +"only contains an asterisk (``'*'``) or the letter ``'x'`` where the " +"encrypted password is stored in a file :file:`/etc/shadow` which is not " +"world readable. Whether the *pw_passwd* field contains anything useful is " +"system-dependent." msgstr "" "在傳統的 Unix 中,``pw_passwd`` 欄位通常包含一個使用 DES 衍生演算法加密的密碼" "(參見模組 :mod:`crypt`)。然而,大多數現代 Unix 是使用所謂的 *shadow " @@ -165,46 +166,42 @@ msgstr "" "shadow` 文件中。 *pw_passwd* 欄位是否包含任何有用的內容取決於系統。如果可用," "應該要在需要存取加密密碼的地方使用 :mod:`spwd` 模組。" -#: ../../library/pwd.rst:53 +#: ../../library/pwd.rst:50 msgid "It defines the following items:" msgstr "它定義了以下項目:" -#: ../../library/pwd.rst:58 +#: ../../library/pwd.rst:55 msgid "Return the password database entry for the given numeric user ID." msgstr "回傳給定數值使用者 ID 的密碼資料庫條目。" -#: ../../library/pwd.rst:63 +#: ../../library/pwd.rst:60 msgid "Return the password database entry for the given user name." msgstr "回傳給定使用者名稱的密碼資料庫條目。" -#: ../../library/pwd.rst:68 +#: ../../library/pwd.rst:65 msgid "" "Return a list of all available password database entries, in arbitrary order." msgstr "以任意順序回傳所有可用密碼資料庫條目的 list。" -#: ../../library/pwd.rst:73 +#: ../../library/pwd.rst:70 msgid "Module :mod:`grp`" msgstr ":mod:`grp` 模組" -#: ../../library/pwd.rst:74 +#: ../../library/pwd.rst:71 msgid "An interface to the group database, similar to this." msgstr "群組資料庫的介面,與此模組類似。" -#: ../../library/pwd.rst:76 -msgid "Module :mod:`spwd`" -msgstr ":mod:`spwd` 模組" +#~ msgid "Module :mod:`spwd`" +#~ msgstr ":mod:`spwd` 模組" -#: ../../library/pwd.rst:77 -msgid "An interface to the shadow password database, similar to this." -msgstr "Shadow 密碼資料庫的介面,與此模組類似。" +#~ msgid "An interface to the shadow password database, similar to this." +#~ msgstr "Shadow 密碼資料庫的介面,與此模組類似。" -#: ../../library/pwd.rst:42 -msgid "module" -msgstr "module(模組)" +#~ msgid "module" +#~ msgstr "module(模組)" -#: ../../library/pwd.rst:42 -msgid "crypt" -msgstr "crypt" +#~ msgid "crypt" +#~ msgstr "crypt" #~ msgid "" #~ "This module does not work or is not available on WebAssembly platforms " diff --git a/library/queue.po b/library/queue.po index 0787568472..489a62d536 100644 --- a/library/queue.po +++ b/library/queue.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-09-27 00:12+0800\n" "Last-Translator: Allen Wu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -174,11 +174,20 @@ msgstr "" "當對一個已滿的 :class:`Queue` 物件呼叫非阻塞的 :meth:`~Queue.put`\\ (或 :" "meth:`~Queue.put_nowait`\\ )將引發此例外。" -#: ../../library/queue.rst:99 +#: ../../library/queue.rst:98 +#, fuzzy +msgid "" +"Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on " +"a :class:`Queue` object which has been shut down." +msgstr "" +"當對一個空的 :class:`Queue` 物件呼叫非阻塞的 (non-blocking) :meth:`~Queue." +"get`\\ (或 :meth:`~Queue.get_nowait`\\ )將引發此例外。" + +#: ../../library/queue.rst:107 msgid "Queue Objects" msgstr "佇列物件" -#: ../../library/queue.rst:101 +#: ../../library/queue.rst:109 msgid "" "Queue objects (:class:`Queue`, :class:`LifoQueue`, or :class:" "`PriorityQueue`) provide the public methods described below." @@ -186,7 +195,7 @@ msgstr "" "佇列物件(:class:`Queue`、:class:`LifoQueue`、:class:`PriorityQueue`)提供下" "面描述的公用 method。" -#: ../../library/queue.rst:107 +#: ../../library/queue.rst:115 msgid "" "Return the approximate size of the queue. Note, qsize() > 0 doesn't " "guarantee that a subsequent get() will not block, nor will qsize() < maxsize " @@ -195,7 +204,7 @@ msgstr "" "回傳佇列的近似大小。注意,qsize() > 0 並不能保證後續的 get() 不會阻塞," "qsize() < maxsize 也不會保證 put() 不會阻塞。" -#: ../../library/queue.rst:114 +#: ../../library/queue.rst:122 msgid "" "Return ``True`` if the queue is empty, ``False`` otherwise. If empty() " "returns ``True`` it doesn't guarantee that a subsequent call to put() will " @@ -206,7 +215,7 @@ msgstr "" "``True``,則不保證後續呼叫 put() 不會阻塞。同樣,如果 empty() 回傳 " "``False``,則不保證後續呼叫 get() 不會阻塞。" -#: ../../library/queue.rst:122 +#: ../../library/queue.rst:130 msgid "" "Return ``True`` if the queue is full, ``False`` otherwise. If full() " "returns ``True`` it doesn't guarantee that a subsequent call to get() will " @@ -217,7 +226,7 @@ msgstr "" "``True``,則不保證後續呼叫 get() 不會阻塞。同樣,如果 full() 回傳 ``False``," "則不保證後續呼叫 put() 不會阻塞。" -#: ../../library/queue.rst:130 +#: ../../library/queue.rst:138 msgid "" "Put *item* into the queue. If optional args *block* is true and *timeout* " "is ``None`` (the default), block if necessary until a free slot is " @@ -233,11 +242,15 @@ msgstr "" "引發 :exc:`Full` 例外。否則(*block* 為 false),如果自由槽立即可用,則將項目" "放在佇列中,否則引發 :exc:`Full` 例外(在這種情況下,*timeout* 將被忽略)。" -#: ../../library/queue.rst:141 +#: ../../library/queue.rst:146 +msgid "Raises :exc:`ShutDown` if the queue has been shut down." +msgstr "" + +#: ../../library/queue.rst:151 msgid "Equivalent to ``put(item, block=False)``." msgstr "等效於 ``put(item, block=False)``。" -#: ../../library/queue.rst:146 ../../library/queue.rst:258 +#: ../../library/queue.rst:156 ../../library/queue.rst:297 msgid "" "Remove and return an item from the queue. If optional args *block* is true " "and *timeout* is ``None`` (the default), block if necessary until an item is " @@ -253,7 +266,7 @@ msgstr "" "`Empty` 例外。否則(*block* 為 false),如果立即可用,則回傳一個項目,否則引" "發 :exc:`Empty` 例外(在這種情況下,*timeout* 將被忽略)。" -#: ../../library/queue.rst:153 +#: ../../library/queue.rst:163 msgid "" "Prior to 3.0 on POSIX systems, and for all versions on Windows, if *block* " "is true and *timeout* is ``None``, this operation goes into an " @@ -265,11 +278,17 @@ msgstr "" "*timeout* 為 ``None``,則此操作將在底層鎖上進入不間斷等待。這意味著不會發生例" "外,特別是 SIGINT(中斷訊號)不會觸發 :exc:`KeyboardInterrupt`。" -#: ../../library/queue.rst:161 ../../library/queue.rst:268 +#: ../../library/queue.rst:168 +msgid "" +"Raises :exc:`ShutDown` if the queue has been shut down and is empty, or if " +"the queue has been shut down immediately." +msgstr "" + +#: ../../library/queue.rst:174 ../../library/queue.rst:307 msgid "Equivalent to ``get(False)``." msgstr "等效於 ``get(False)``。" -#: ../../library/queue.rst:163 +#: ../../library/queue.rst:176 msgid "" "Two methods are offered to support tracking whether enqueued tasks have been " "fully processed by daemon consumer threads." @@ -277,7 +296,7 @@ msgstr "" "有兩個 method 可以支援追蹤放入佇列的任務是否已由常駐消費者執行緒 (daemon " "consumer threads) 完全處理。" -#: ../../library/queue.rst:169 +#: ../../library/queue.rst:182 msgid "" "Indicate that a formerly enqueued task is complete. Used by queue consumer " "threads. For each :meth:`get` used to fetch a task, a subsequent call to :" @@ -286,7 +305,7 @@ msgstr "" "表示先前放入佇列的任務已完成。由佇列消費者執行緒使用。對於用來提取任務的每" "個 :meth:`get`,隨後呼叫 :meth:`task_done` 告訴佇列任務的處理已完成。" -#: ../../library/queue.rst:173 +#: ../../library/queue.rst:186 msgid "" "If a :meth:`join` is currently blocking, it will resume when all items have " "been processed (meaning that a :meth:`task_done` call was received for every " @@ -295,17 +314,23 @@ msgstr "" "如果目前 :meth:`join` 阻塞,它將會在所有項目都已處理完畢後恢復(代表對於以 :" "meth:`put` 放進佇列的每個項目,都要收到 :meth:`task_done` 的呼叫)。" -#: ../../library/queue.rst:177 +#: ../../library/queue.rst:190 +msgid "" +"``shutdown(immediate=True)`` calls :meth:`task_done` for each remaining item " +"in the queue." +msgstr "" + +#: ../../library/queue.rst:193 msgid "" "Raises a :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "如果呼叫次數超過佇列中放置的項目數量,則引發 :exc:`ValueError`。" -#: ../../library/queue.rst:183 +#: ../../library/queue.rst:199 msgid "Blocks until all items in the queue have been gotten and processed." msgstr "持續阻塞直到佇列中的所有項目都已被獲取並處理完畢。" -#: ../../library/queue.rst:185 +#: ../../library/queue.rst:201 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " "queue. The count goes down whenever a consumer thread calls :meth:" @@ -317,11 +342,11 @@ msgstr "" "`task_done` 以指示該項目已被取出並且對其的所有工作都已完成時,計數就會下降。" "當未完成任務的計數降至零時,:meth:`join` 將停止阻塞。" -#: ../../library/queue.rst:191 +#: ../../library/queue.rst:207 msgid "Example of how to wait for enqueued tasks to be completed::" msgstr "如何等待放入佇列的任務完成的範例: ::" -#: ../../library/queue.rst:193 +#: ../../library/queue.rst:209 msgid "" "import threading\n" "import queue\n" @@ -347,23 +372,54 @@ msgid "" "print('All work completed')" msgstr "" -#: ../../library/queue.rst:218 +#: ../../library/queue.rst:234 +msgid "Terminating queues" +msgstr "" + +#: ../../library/queue.rst:236 +msgid "" +":class:`Queue` objects can be made to prevent further interaction by " +"shutting them down." +msgstr "" + +#: ../../library/queue.rst:241 +msgid "" +"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` raise :" +"exc:`ShutDown`." +msgstr "" + +#: ../../library/queue.rst:244 +msgid "" +"By default, :meth:`~Queue.get` on a shut down queue will only raise once the " +"queue is empty. Set *immediate* to true to make :meth:`~Queue.get` raise " +"immediately instead." +msgstr "" + +#: ../../library/queue.rst:248 +msgid "" +"All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be " +"unblocked. If *immediate* is true, a task will be marked as done for each " +"remaining item in the queue, which may unblock callers of :meth:`~Queue." +"join`." +msgstr "" + +#: ../../library/queue.rst:257 msgid "SimpleQueue Objects" msgstr "SimpleQueue 物件" -#: ../../library/queue.rst:220 +#: ../../library/queue.rst:259 msgid "" ":class:`SimpleQueue` objects provide the public methods described below." msgstr ":class:`SimpleQueue` 物件提供下面描述的公用 method。" -#: ../../library/queue.rst:224 +#: ../../library/queue.rst:263 msgid "" "Return the approximate size of the queue. Note, qsize() > 0 doesn't " "guarantee that a subsequent get() will not block." msgstr "" "傳回佇列的近似大小。注意,qsize() > 0 並不能保證後續的 get() 不會阻塞。" -#: ../../library/queue.rst:230 +#: ../../library/queue.rst:269 msgid "" "Return ``True`` if the queue is empty, ``False`` otherwise. If empty() " "returns ``False`` it doesn't guarantee that a subsequent call to get() will " @@ -372,7 +428,7 @@ msgstr "" "如果佇列為空,則回傳 ``True``,否則回傳 ``False``。如果 empty() 回傳 " "``False``,則不保證後續呼叫 get() 不會阻塞。" -#: ../../library/queue.rst:237 +#: ../../library/queue.rst:276 msgid "" "Put *item* into the queue. The method never blocks and always succeeds " "(except for potential low-level errors such as failure to allocate memory). " @@ -383,7 +439,7 @@ msgstr "" "像是分配記憶體失敗)。可選的 args *block* 和 *timeout* 會被忽略,它們僅是為了" "與 :meth:`Queue.put` 相容才存在。" -#: ../../library/queue.rst:243 +#: ../../library/queue.rst:282 msgid "" "This method has a C implementation which is reentrant. That is, a ``put()`` " "or ``get()`` call can be interrupted by another ``put()`` call in the same " @@ -396,18 +452,18 @@ msgstr "" "鎖 (deadlock) 或損壞佇列中的內部狀態。這使得它適合在解構子 (destructor) 中使" "用,像是 ``__del__`` method 或 :mod:`weakref` 回呼函式 (callback)。" -#: ../../library/queue.rst:252 +#: ../../library/queue.rst:291 msgid "" "Equivalent to ``put(item, block=False)``, provided for compatibility with :" "meth:`Queue.put_nowait`." msgstr "" "等效於 ``put(item, block=False)``,用於與 :meth:`Queue.put_nowait` 相容。" -#: ../../library/queue.rst:273 +#: ../../library/queue.rst:312 msgid "Class :class:`multiprocessing.Queue`" msgstr "Class :class:`multiprocessing.Queue`" -#: ../../library/queue.rst:274 +#: ../../library/queue.rst:313 msgid "" "A queue class for use in a multi-processing (rather than multi-threading) " "context." @@ -415,7 +471,7 @@ msgstr "" "用於多行程處理 (multi-processing)(而非多執行緒)情境 (context) 的佇列 " "class。" -#: ../../library/queue.rst:277 +#: ../../library/queue.rst:316 msgid "" ":class:`collections.deque` is an alternative implementation of unbounded " "queues with fast atomic :meth:`~collections.deque.append` and :meth:" diff --git a/library/random.po b/library/random.po index c647b731dd..470f0084d7 100644 --- a/library/random.po +++ b/library/random.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-01-23 22:47+0800\n" "Last-Translator: Allen Wu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -129,15 +129,24 @@ msgstr "" "activestate.com/recipes/576707-long-period-random-number-generator/>`_,可作" "為隨機數產生器的一個可相容替代方案,具有較長的週期和相對簡單的更新操作。" -#: ../../library/random.rst:64 +#: ../../library/random.rst:63 +msgid "" +"The global random number generator and instances of :class:`Random` are " +"thread-safe. However, in the free-threaded build, concurrent calls to the " +"global generator or to the same instance of :class:`Random` may encounter " +"contention and poor performance. Consider using separate instances of :class:" +"`Random` per thread instead." +msgstr "" + +#: ../../library/random.rst:70 msgid "Bookkeeping functions" msgstr "簿記函式 (bookkeeping functions)" -#: ../../library/random.rst:68 +#: ../../library/random.rst:74 msgid "Initialize the random number generator." msgstr "初始化隨機數產生器。" -#: ../../library/random.rst:70 +#: ../../library/random.rst:76 msgid "" "If *a* is omitted or ``None``, the current system time is used. If " "randomness sources are provided by the operating system, they are used " @@ -148,11 +157,11 @@ msgstr "" "供,則使用它們而不是系統時間(有關可用性的詳細資訊,請參考 :func:`os." "urandom` 函式)。" -#: ../../library/random.rst:75 +#: ../../library/random.rst:81 msgid "If *a* is an int, it is used directly." msgstr "如果 *a* 為 int(整數),則直接使用它。" -#: ../../library/random.rst:77 +#: ../../library/random.rst:83 msgid "" "With version 2 (the default), a :class:`str`, :class:`bytes`, or :class:" "`bytearray` object gets converted to an :class:`int` and all of its bits are " @@ -161,7 +170,7 @@ msgstr "" "如使用版本 2(預設值),:class:`str`、:class:`bytes` 或 :class:`bytearray` 物" "件將轉換為 :class:`int`,並使用其所有位元。" -#: ../../library/random.rst:80 +#: ../../library/random.rst:86 msgid "" "With version 1 (provided for reproducing random sequences from older " "versions of Python), the algorithm for :class:`str` and :class:`bytes` " @@ -170,12 +179,12 @@ msgstr "" "若使用版本 1(為復現於舊版本 Python 中產生隨機序列而提供),:class:`str` 和 :" "class:`bytes` 的演算法會生成範圍更窄的種子 (seed)。" -#: ../../library/random.rst:84 +#: ../../library/random.rst:90 msgid "" "Moved to the version 2 scheme which uses all of the bits in a string seed." msgstr "移至版本 2 方案,該方案使用字串種子中的所有位元。" -#: ../../library/random.rst:87 +#: ../../library/random.rst:93 msgid "" "The *seed* must be one of the following types: ``None``, :class:`int`, :" "class:`float`, :class:`str`, :class:`bytes`, or :class:`bytearray`." @@ -183,7 +192,7 @@ msgstr "" "*seed* 必須是以下型別之一:``None``、:class:`int`、:class:`float`、:class:" "`str`、:class:`bytes`、:class:`bytearray`。" -#: ../../library/random.rst:94 +#: ../../library/random.rst:100 msgid "" "Return an object capturing the current internal state of the generator. " "This object can be passed to :func:`setstate` to restore the state." @@ -191,7 +200,7 @@ msgstr "" "回傳一個物件,捕獲產生器的當前內部狀態。此物件可以傳遞給 :func:`setstate` 以" "恢復狀態。" -#: ../../library/random.rst:100 +#: ../../library/random.rst:106 msgid "" "*state* should have been obtained from a previous call to :func:`getstate`, " "and :func:`setstate` restores the internal state of the generator to what it " @@ -200,30 +209,30 @@ msgstr "" "*state* 應該要從之前對 :func:`getstate` 的呼叫中獲得,並且以 :func:" "`setstate` 將產生器的內部狀態恢復到呼叫 :func:`getstate` 時的狀態。" -#: ../../library/random.rst:106 +#: ../../library/random.rst:112 msgid "Functions for bytes" msgstr "回傳位元組的函式" -#: ../../library/random.rst:110 +#: ../../library/random.rst:116 msgid "Generate *n* random bytes." msgstr "產生 *n* 個隨機位元組。" -#: ../../library/random.rst:112 +#: ../../library/random.rst:118 msgid "" "This method should not be used for generating security tokens. Use :func:" "`secrets.token_bytes` instead." msgstr "" "此方法不應使用於產生安全性權杖 (Token)。請改用 :func:`secrets.token_bytes`。" -#: ../../library/random.rst:119 +#: ../../library/random.rst:125 msgid "Functions for integers" msgstr "回傳整數的函式" -#: ../../library/random.rst:124 +#: ../../library/random.rst:130 msgid "Return a randomly selected element from ``range(start, stop, step)``." msgstr "傳回從 ``range(start, stop, step)`` 中隨機選擇的元素。" -#: ../../library/random.rst:126 +#: ../../library/random.rst:132 msgid "" "This is roughly equivalent to ``choice(range(start, stop, step))`` but " "supports arbitrarily large ranges and is optimized for common cases." @@ -231,11 +240,11 @@ msgstr "" "這大致相當於 ``choice(range(start, stop, step))``,但支援任意大的範圍,並針對" "常見情況進行了最佳化。" -#: ../../library/random.rst:129 +#: ../../library/random.rst:135 msgid "The positional argument pattern matches the :func:`range` function." msgstr "位置引數模式與 :func:`range` 函式相符。" -#: ../../library/random.rst:131 +#: ../../library/random.rst:137 msgid "" "Keyword arguments should not be used because they can be interpreted in " "unexpected ways. For example ``randrange(start=100)`` is interpreted as " @@ -244,7 +253,7 @@ msgstr "" "不應使用關鍵字引數,因為它們可能會以意想不到的方式被直譯。例如 " "``randrange(start=100)`` 會被直譯為 ``randrange(0, 100, 1)``。" -#: ../../library/random.rst:135 +#: ../../library/random.rst:141 msgid "" ":meth:`randrange` is more sophisticated about producing equally distributed " "values. Formerly it used a style like ``int(random()*n)`` which could " @@ -253,7 +262,7 @@ msgstr "" ":meth:`randrange` 在產生均勻分佈的值方面更為複雜。以前,它使用像 " "``int(random()*n)`` 這樣的樣式,這可能會產生稍微不均勻的分佈。" -#: ../../library/random.rst:140 +#: ../../library/random.rst:146 msgid "" "Automatic conversion of non-integer types is no longer supported. Calls such " "as ``randrange(10.0)`` and ``randrange(Fraction(10, 1))`` now raise a :exc:" @@ -262,14 +271,14 @@ msgstr "" "已經不再支援非整數類型到等效整數的自動轉換。像是 ``randrange(10.0)`` 和 " "``randrange(Fraction(10, 1))`` 的呼叫將會引發 :exc:`TypeError`。" -#: ../../library/random.rst:147 +#: ../../library/random.rst:153 msgid "" "Return a random integer *N* such that ``a <= N <= b``. Alias for " "``randrange(a, b+1)``." msgstr "" "回傳一個隨機整數 *N*,使得 ``a <= N <= b``。為 ``randrange(a, b+1)`` 的別名。" -#: ../../library/random.rst:152 +#: ../../library/random.rst:158 msgid "" "Returns a non-negative Python integer with *k* random bits. This method is " "supplied with the Mersenne Twister generator and some other generators may " @@ -280,15 +289,15 @@ msgstr "" "生器一起提供,一些其他的產生器也可能將其作為 API 的可選部分。如果可用,:meth:" "`getrandbits` 使 :meth:`randrange` 能夠處理任意大的範圍。" -#: ../../library/random.rst:158 +#: ../../library/random.rst:164 msgid "This method now accepts zero for *k*." msgstr "此方法現在接受 *k* 為零。" -#: ../../library/random.rst:163 +#: ../../library/random.rst:169 msgid "Functions for sequences" msgstr "回傳序列的函式" -#: ../../library/random.rst:167 +#: ../../library/random.rst:173 msgid "" "Return a random element from the non-empty sequence *seq*. If *seq* is " "empty, raises :exc:`IndexError`." @@ -296,7 +305,7 @@ msgstr "" "從非空序列 *seq* 回傳一個隨機元素。如果 *seq* 為空,則引發 :exc:" "`IndexError`。" -#: ../../library/random.rst:172 +#: ../../library/random.rst:178 msgid "" "Return a *k* sized list of elements chosen from the *population* with " "replacement. If the *population* is empty, raises :exc:`IndexError`." @@ -304,7 +313,7 @@ msgstr "" "回傳從 *population* 中重置取樣出的一個大小為 *k* 的元素 list。如果 " "*population* 為空,則引發 :exc:`IndexError`。" -#: ../../library/random.rst:175 +#: ../../library/random.rst:181 msgid "" "If a *weights* sequence is specified, selections are made according to the " "relative weights. Alternatively, if a *cum_weights* sequence is given, the " @@ -320,7 +329,7 @@ msgstr "" "15, 45, 50]``。在內部,相對權重在進行選擇之前會轉換為累積權重,因此提供累積權" "重可以節省工作。" -#: ../../library/random.rst:184 +#: ../../library/random.rst:190 msgid "" "If neither *weights* nor *cum_weights* are specified, selections are made " "with equal probability. If a weights sequence is supplied, it must be the " @@ -331,7 +340,7 @@ msgstr "" "供了加權序列,則該序列的長度必須與 *population* 序列的長度相同。它是一個 :" "exc:`TypeError` 來指定 *weights* 和 *cum_weights*。" -#: ../../library/random.rst:189 +#: ../../library/random.rst:195 msgid "" "The *weights* or *cum_weights* can use any numeric type that interoperates " "with the :class:`float` values returned by :func:`random` (that includes " @@ -344,7 +353,7 @@ msgstr "" "數值類型。權重假定為非負數和有限的。如果所有權重均為零,則引發 :exc:" "`ValueError`。" -#: ../../library/random.rst:195 +#: ../../library/random.rst:201 msgid "" "For a given seed, the :func:`choices` function with equal weighting " "typically produces a different sequence than repeated calls to :func:" @@ -358,15 +367,15 @@ msgstr "" "和速度。:func:`choice` 使用的演算法預設為整數運算和重複選擇,以避免捨入誤差產" "生的小偏差。" -#: ../../library/random.rst:204 +#: ../../library/random.rst:210 msgid "Raises a :exc:`ValueError` if all weights are zero." msgstr "如果所有權重均為零,則引發 :exc:`ValueError`。" -#: ../../library/random.rst:210 +#: ../../library/random.rst:216 msgid "Shuffle the sequence *x* in place." msgstr "將序列 *x* 原地 (in place) 隨機打亂位置。" -#: ../../library/random.rst:212 +#: ../../library/random.rst:218 msgid "" "To shuffle an immutable sequence and return a new shuffled list, use " "``sample(x, k=len(x))`` instead." @@ -374,7 +383,7 @@ msgstr "" "要打亂一個不可變的序列並回傳一個新的被打亂的 list(串列),請使用 " "``sample(x, k=len(x))``。" -#: ../../library/random.rst:215 +#: ../../library/random.rst:221 msgid "" "Note that even for small ``len(x)``, the total number of permutations of *x* " "can quickly grow larger than the period of most random number generators. " @@ -386,11 +395,11 @@ msgstr "" "數產生器的週期。這意味著長序列的大多數置換永遠無法產生。例如,長度為 2080 的" "序列是 Mersenne Twister 隨機數產生器週期內可以容納的最大序列。" -#: ../../library/random.rst:221 +#: ../../library/random.rst:227 msgid "Removed the optional parameter *random*." msgstr "移除可選參數 *random*。" -#: ../../library/random.rst:227 +#: ../../library/random.rst:233 msgid "" "Return a *k* length list of unique elements chosen from the population " "sequence. Used for random sampling without replacement." @@ -398,7 +407,7 @@ msgstr "" "回傳從母體序列中選擇出的一個包含獨特元素、長度為 *k* 的 list。用於不重置的隨" "機取樣。" -#: ../../library/random.rst:230 +#: ../../library/random.rst:236 msgid "" "Returns a new list containing elements from the population while leaving the " "original population unchanged. The resulting list is in selection order so " @@ -410,7 +419,7 @@ msgstr "" "此所有子切片也會是有效的隨機樣本。這允許抽獎獲獎者(樣本)分為大獎和第二名獲" "獎者(子切片)。" -#: ../../library/random.rst:236 +#: ../../library/random.rst:242 msgid "" "Members of the population need not be :term:`hashable` or unique. If the " "population contains repeats, then each occurrence is a possible selection in " @@ -419,7 +428,7 @@ msgstr "" "母體成員不必是 :term:`hashable` 或唯一的。如果母體包含重複項,則每次出現都是" "樣本中可能出現的一個選擇。" -#: ../../library/random.rst:239 +#: ../../library/random.rst:245 msgid "" "Repeated elements can be specified one at a time or with the optional " "keyword-only *counts* parameter. For example, ``sample(['red', 'blue'], " @@ -430,7 +439,7 @@ msgstr "" "素。例如 ``sample(['red', 'blue'], counts=[4, 2], k=5)`` 等同於 " "``sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5)``。" -#: ../../library/random.rst:244 +#: ../../library/random.rst:250 msgid "" "To choose a sample from a range of integers, use a :func:`range` object as " "an argument. This is especially fast and space efficient for sampling from " @@ -439,31 +448,31 @@ msgstr "" "若要從整數範圍中選擇範例,請使用 :func:`range` 物件作為引數。這對於從大型母體" "中取樣特別快速且節省空間:``sample(range(10000000), k=60)``。" -#: ../../library/random.rst:248 +#: ../../library/random.rst:254 msgid "" "If the sample size is larger than the population size, a :exc:`ValueError` " "is raised." msgstr "如果樣本大小大於母體大小,:exc:`ValueError` 會被引發。" -#: ../../library/random.rst:251 +#: ../../library/random.rst:257 msgid "Added the *counts* parameter." msgstr "新增 *counts* 參數。" -#: ../../library/random.rst:256 +#: ../../library/random.rst:262 msgid "" "The *population* must be a sequence. Automatic conversion of sets to lists " "is no longer supported." msgstr "*population* 必須是一個序列。不再支援將 set 自動轉換為 list。" -#: ../../library/random.rst:260 +#: ../../library/random.rst:266 msgid "Discrete distributions" msgstr "離散分布" -#: ../../library/random.rst:262 +#: ../../library/random.rst:268 msgid "The following function generates a discrete distribution." msgstr "以下函式產生離散分佈。" -#: ../../library/random.rst:266 +#: ../../library/random.rst:272 msgid "" "`Binomial distribution `_. Return the number of successes for *n* independent trials with the " @@ -473,15 +482,15 @@ msgstr "" "BinomialDistribution.html>`_。回傳 *n* 個獨立試驗的成功次數,每個試驗的成功機" "率為 *p*:" -#: ../../library/random.rst:271 +#: ../../library/random.rst:277 msgid "Mathematically equivalent to::" msgstr "數學上等價於: ::" -#: ../../library/random.rst:273 +#: ../../library/random.rst:279 msgid "sum(random() < p for i in range(n))" msgstr "sum(random() < p for i in range(n))" -#: ../../library/random.rst:275 +#: ../../library/random.rst:281 msgid "" "The number of trials *n* should be a non-negative integer. The probability " "of success *p* should be between ``0.0 <= p <= 1.0``. The result is an " @@ -490,11 +499,11 @@ msgstr "" "試驗次數 *n* 應為非負整數。成功的機率 *p* 應在 ``0.0 <= p <= 1.0`` 之間。結果" "是 ``0 <= X <= n`` 範圍內的整數。" -#: ../../library/random.rst:285 +#: ../../library/random.rst:291 msgid "Real-valued distributions" msgstr "實數分布" -#: ../../library/random.rst:287 +#: ../../library/random.rst:293 msgid "" "The following functions generate specific real-valued distributions. " "Function parameters are named after the corresponding variables in the " @@ -504,12 +513,12 @@ msgstr "" "以下函式產生特定的實數分佈。函式參數以分佈方程中的對應變數命名,如常見的數學" "實踐所示;這些方程式中的大多數都可以在任意統計文本中找到。" -#: ../../library/random.rst:295 +#: ../../library/random.rst:301 msgid "" "Return the next random floating-point number in the range ``0.0 <= X < 1.0``" msgstr "回傳範圍 ``0.0 <= X < 1.0`` 中的下一個隨機浮點數" -#: ../../library/random.rst:300 +#: ../../library/random.rst:306 msgid "" "Return a random floating-point number *N* such that ``a <= N <= b`` for ``a " "<= b`` and ``b <= N <= a`` for ``b < a``." @@ -517,7 +526,7 @@ msgstr "" "回傳一個隨機浮點數 *N*,當 ``a <= b`` 時確保 N 為 ``a <= N <= b`` 、``b < " "a`` 時確保 N 為 ``b <= N <= a``。" -#: ../../library/random.rst:303 +#: ../../library/random.rst:309 msgid "" "The end-point value ``b`` may or may not be included in the range depending " "on floating-point rounding in the expression ``a + (b-a) * random()``." @@ -525,7 +534,7 @@ msgstr "" "終點值 ``b`` 可能包含在範圍內,也可能不包含在範圍內,取決於運算式 ``a + (b-" "a) * random()`` 中的浮點捨入。" -#: ../../library/random.rst:310 +#: ../../library/random.rst:316 msgid "" "Return a random floating-point number *N* such that ``low <= N <= high`` and " "with the specified *mode* between those bounds. The *low* and *high* bounds " @@ -536,7 +545,7 @@ msgstr "" "的 *mode*。*low* 和 *high* 邊界預設為零和一。*mode* 引數預設為邊界之間的中" "點,從而給出對稱分佈。" -#: ../../library/random.rst:318 +#: ../../library/random.rst:324 msgid "" "Beta distribution. Conditions on the parameters are ``alpha > 0`` and " "``beta > 0``. Returned values range between 0 and 1." @@ -544,7 +553,7 @@ msgstr "" "Beta(貝它)分布。參數的條件為 ``alpha > 0`` 和 ``beta > 0``。回傳值的範圍介" "於 0 和 1 之間。" -#: ../../library/random.rst:324 +#: ../../library/random.rst:330 msgid "" "Exponential distribution. *lambd* is 1.0 divided by the desired mean. It " "should be nonzero. (The parameter would be called \"lambda\", but that is a " @@ -556,11 +565,11 @@ msgstr "" "\"lambda\",但這是 Python 中的保留字)如果 *lambd* 為正,則回傳值的範圍從 0 " "到正無窮大;如果 *lambd* 為負,則回傳值的範圍從負無窮大到 0。" -#: ../../library/random.rst:330 +#: ../../library/random.rst:336 msgid "Added the default value for ``lambd``." msgstr "新增 ``lambd`` 的預設值。" -#: ../../library/random.rst:336 +#: ../../library/random.rst:342 msgid "" "Gamma distribution. (*Not* the gamma function!) The shape and scale " "parameters, *alpha* and *beta*, must have positive values. (Calling " @@ -570,11 +579,11 @@ msgstr "" "*alpha* 和 *beta* 必須具有正值。(根據呼叫習慣不同,部分來源會將 'beta' 定義" "為比例的倒數)。" -#: ../../library/random.rst:341 +#: ../../library/random.rst:347 msgid "The probability distribution function is::" msgstr "Probability distribution function(機率密度函式)是: ::" -#: ../../library/random.rst:343 +#: ../../library/random.rst:349 msgid "" " x ** (alpha - 1) * math.exp(-x / beta)\n" "pdf(x) = --------------------------------------\n" @@ -584,7 +593,7 @@ msgstr "" "pdf(x) = --------------------------------------\n" " math.gamma(alpha) * beta ** alpha" -#: ../../library/random.rst:350 +#: ../../library/random.rst:356 msgid "" "Normal distribution, also called the Gaussian distribution. *mu* is the " "mean, and *sigma* is the standard deviation. This is slightly faster than " @@ -593,7 +602,7 @@ msgstr "" "常態分佈,也稱為高斯分佈。*mu* 是平均數,*sigma* 是標準差。這比下面定義的 :" "func:`normalvariate` 函式快一點。" -#: ../../library/random.rst:355 +#: ../../library/random.rst:361 msgid "" "Multithreading note: When two threads call this function simultaneously, it " "is possible that they will receive the same return value. This can be " @@ -605,11 +614,11 @@ msgstr "" "可以透過三種方式避免。1)讓每個執行緒使用隨機數產生器的不同實例。2)在所有呼" "叫周圍加鎖。3)使用較慢但執行緒安全的 :func:`normalvariate` 函式代替。" -#: ../../library/random.rst:362 ../../library/random.rst:378 +#: ../../library/random.rst:368 ../../library/random.rst:384 msgid "*mu* and *sigma* now have default arguments." msgstr "*mu* 和 *sigma* 現在有預設引數。" -#: ../../library/random.rst:368 +#: ../../library/random.rst:374 msgid "" "Log normal distribution. If you take the natural logarithm of this " "distribution, you'll get a normal distribution with mean *mu* and standard " @@ -619,13 +628,13 @@ msgstr "" "對數常態分佈。如果你取此分佈的自然對數,你將獲得一個具有平均數 *mu* 和標準差 " "*sigma* 的常態分佈。*mu* 可以為任何值,並且 *sigma* 必須大於零。" -#: ../../library/random.rst:376 +#: ../../library/random.rst:382 msgid "" "Normal distribution. *mu* is the mean, and *sigma* is the standard " "deviation." msgstr "常態分佈。*mu* 是平均數,*sigma* 是標準差。" -#: ../../library/random.rst:384 +#: ../../library/random.rst:390 msgid "" "*mu* is the mean angle, expressed in radians between 0 and 2\\*\\ *pi*, and " "*kappa* is the concentration parameter, which must be greater than or equal " @@ -636,28 +645,28 @@ msgstr "" "大於或等於零。如果 *kappa* 等於零,則此分佈在 0 到 2\\*\\ *pi* 的範圍內將減小" "為均勻的隨機角度。" -#: ../../library/random.rst:392 +#: ../../library/random.rst:398 msgid "Pareto distribution. *alpha* is the shape parameter." msgstr "Pareto distribution(柏拉圖分佈)。*alpha* 是形狀參數。" -#: ../../library/random.rst:397 +#: ../../library/random.rst:403 msgid "" "Weibull distribution. *alpha* is the scale parameter and *beta* is the " "shape parameter." msgstr "" "Weibull distribution(韋伯分佈)。*alpha* 是比例參數,*beta* 是形狀參數。" -#: ../../library/random.rst:402 +#: ../../library/random.rst:408 msgid "Alternative Generator" msgstr "替代產生器" -#: ../../library/random.rst:406 +#: ../../library/random.rst:412 msgid "" "Class that implements the default pseudo-random number generator used by " "the :mod:`random` module." msgstr "實現 :mod:`random` 模組使用的預設偽隨機數產生器的 class。" -#: ../../library/random.rst:409 +#: ../../library/random.rst:415 msgid "" "Formerly the *seed* could be any hashable object. Now it is limited to: " "``None``, :class:`int`, :class:`float`, :class:`str`, :class:`bytes`, or :" @@ -666,14 +675,14 @@ msgstr "" "過去 *seed* 可以是任何可雜湊物件,但現在必須是以下類型之一:``None``、:class:" "`int`、:class:`float`、:class:`str`、:class:`bytes`、:class:`bytearray`。" -#: ../../library/random.rst:414 +#: ../../library/random.rst:420 msgid "" "Subclasses of :class:`!Random` should override the following methods if they " "wish to make use of a different basic generator:" msgstr "" "如果 :class:`!Random` 的子類別希望使用不同的基礎產生器,則應該覆寫以下方法:" -#: ../../library/random.rst:419 +#: ../../library/random.rst:425 msgid "" "Override this method in subclasses to customise the :meth:`~random.seed` " "behaviour of :class:`!Random` instances." @@ -681,7 +690,7 @@ msgstr "" "在子類別中覆寫此方法以自訂 :class:`!Random` 實例的 :meth:`~random.seed` 行" "為。" -#: ../../library/random.rst:424 +#: ../../library/random.rst:430 msgid "" "Override this method in subclasses to customise the :meth:`~random.getstate` " "behaviour of :class:`!Random` instances." @@ -689,7 +698,7 @@ msgstr "" "在子類別中覆寫此方法以自訂 :class:`!Random` 實例的 :meth:`~random.getstate` " "行為。" -#: ../../library/random.rst:429 +#: ../../library/random.rst:435 msgid "" "Override this method in subclasses to customise the :meth:`~random.setstate` " "behaviour of :class:`!Random` instances." @@ -697,7 +706,7 @@ msgstr "" "在子類別中覆寫此方法以自訂 :class:`!Random` 實例的 :meth:`~random.setstate` " "行為。" -#: ../../library/random.rst:434 +#: ../../library/random.rst:440 msgid "" "Override this method in subclasses to customise the :meth:`~random.random` " "behaviour of :class:`!Random` instances." @@ -705,12 +714,12 @@ msgstr "" "在子類別中覆寫此方法以自訂 :class:`!Random` 實例的 :meth:`~random.random` 行" "為。" -#: ../../library/random.rst:437 +#: ../../library/random.rst:443 msgid "" "Optionally, a custom generator subclass can also supply the following method:" msgstr "或者,自訂產生器子類別還可以提供以下方法:" -#: ../../library/random.rst:441 +#: ../../library/random.rst:447 msgid "" "Override this method in subclasses to customise the :meth:`~random." "getrandbits` behaviour of :class:`!Random` instances." @@ -718,7 +727,7 @@ msgstr "" "在子類別中覆寫此方法以自訂 :class:`!Random` 實例的 :meth:`~random." "getrandbits` 行為。" -#: ../../library/random.rst:447 +#: ../../library/random.rst:453 msgid "" "Class that uses the :func:`os.urandom` function for generating random " "numbers from sources provided by the operating system. Not available on all " @@ -732,11 +741,11 @@ msgstr "" "有效果且被忽略。如果呼叫 :meth:`getstate` 和 :meth:`setstate` 方法會引發 :" "exc:`NotImplementedError`。" -#: ../../library/random.rst:456 +#: ../../library/random.rst:462 msgid "Notes on Reproducibility" msgstr "關於 Reproducibility(復現性)的注意事項" -#: ../../library/random.rst:458 +#: ../../library/random.rst:464 msgid "" "Sometimes it is useful to be able to reproduce the sequences given by a " "pseudo-random number generator. By reusing a seed value, the same sequence " @@ -746,7 +755,7 @@ msgstr "" "有時,能夠重現偽隨機數產生器給出的序列很有用。只要多執行緒未運行,透過重複使" "用種子值,同一序列就應該可以被復現。" -#: ../../library/random.rst:462 +#: ../../library/random.rst:468 msgid "" "Most of the random module's algorithms and seeding functions are subject to " "change across Python versions, but two aspects are guaranteed not to change:" @@ -754,13 +763,13 @@ msgstr "" "大多數隨機 module 的演算法和 seed 設定函式在 Python 版本中可能會發生變化,但" "可以保證兩個方面不會改變:" -#: ../../library/random.rst:465 +#: ../../library/random.rst:471 msgid "" "If a new seeding method is added, then a backward compatible seeder will be " "offered." msgstr "如果增加了新的 seed 設定函式,則將提供向後相容的播種器 (seeder)。" -#: ../../library/random.rst:468 +#: ../../library/random.rst:474 msgid "" "The generator's :meth:`~Random.random` method will continue to produce the " "same sequence when the compatible seeder is given the same seed." @@ -768,15 +777,15 @@ msgstr "" "當相容的播種器被賦予相同的種子時,產生器的 :meth:`~Random.random` 方法將持續" "產生相同的序列。" -#: ../../library/random.rst:474 +#: ../../library/random.rst:480 msgid "Examples" msgstr "範例" -#: ../../library/random.rst:476 +#: ../../library/random.rst:482 msgid "Basic examples::" msgstr "基礎範例: ::" -#: ../../library/random.rst:478 +#: ../../library/random.rst:484 msgid "" ">>> random() # Random float: 0.0 <= x < 1.0\n" "0.37444887175646646\n" @@ -808,11 +817,11 @@ msgid "" "[40, 10, 50, 30]" msgstr "" -#: ../../library/random.rst:504 +#: ../../library/random.rst:510 msgid "Simulations::" msgstr "模擬: ::" -#: ../../library/random.rst:506 +#: ../../library/random.rst:512 msgid "" ">>> # Six roulette wheel spins (weighted sampling with replacement)\n" ">>> choices(['red', 'black', 'green'], [18, 18, 2], k=6)\n" @@ -838,7 +847,7 @@ msgid "" "0.7958" msgstr "" -#: ../../library/random.rst:529 +#: ../../library/random.rst:535 msgid "" "Example of `statistical bootstrapping `_ using resampling with replacement to estimate " @@ -848,7 +857,7 @@ msgstr "" "Bootstrapping_(statistics)>`_\\ 的範例,使用有重置的重新取樣來估計樣本平均數" "的信賴區間: ::" -#: ../../library/random.rst:533 +#: ../../library/random.rst:539 msgid "" "# https://www.thoughtco.com/example-of-bootstrapping-3126155\n" "from statistics import fmean as mean\n" @@ -868,7 +877,7 @@ msgstr "" "print(f'The sample mean of {mean(data):.1f} has a 90% confidence '\n" " f'interval from {means[5]:.1f} to {means[94]:.1f}')" -#: ../../library/random.rst:542 +#: ../../library/random.rst:548 msgid "" "Example of a `resampling permutation test `_ to determine the statistical " @@ -880,7 +889,7 @@ msgstr "" "慰劑之間差異的統計學意義或 `p 值 `_\\ " ": ::" -#: ../../library/random.rst:548 +#: ../../library/random.rst:554 msgid "" "# Example from \"Statistics is Easy\" by Dennis Shasha and Manda Wilson\n" "from statistics import fmean as mean\n" @@ -908,12 +917,12 @@ msgid "" "placebo.')" msgstr "" -#: ../../library/random.rst:569 +#: ../../library/random.rst:575 msgid "" "Simulation of arrival times and service deliveries for a multiserver queue::" msgstr "模擬多伺服器佇列 (queue) 的到達時間與服務交付: ::" -#: ../../library/random.rst:571 +#: ../../library/random.rst:577 msgid "" "from heapq import heapify, heapreplace\n" "from random import expovariate, gauss\n" @@ -942,7 +951,7 @@ msgid "" "print('Quartiles:', [round(q, 1) for q in quantiles(waits)])" msgstr "" -#: ../../library/random.rst:598 +#: ../../library/random.rst:604 msgid "" "`Statistics for Hackers `_ a " "video tutorial by `Jake Vanderplas `_ 製作的教" "學影片,僅使用幾個基本概念(包括模擬、取樣、洗牌、交叉驗證)進行統計分析。" -#: ../../library/random.rst:604 +#: ../../library/random.rst:610 msgid "" "`Economics Simulation `_ a simulation of a marketplace by `Peter Norvig `_ a tutorial by `Peter Norvig " @@ -977,11 +986,11 @@ msgstr "" "Probability.ipynb>`_\\ 為 `Peter Norvig `_ 的教" "學課程,涵蓋了機率理論的基礎知識與如何模擬以及使用 Python 執行數據分析。" -#: ../../library/random.rst:619 +#: ../../library/random.rst:625 msgid "Recipes" msgstr "使用方案" -#: ../../library/random.rst:621 +#: ../../library/random.rst:627 msgid "" "These recipes show how to efficiently make random selections from the " "combinatoric iterators in the :mod:`itertools` module:" @@ -989,7 +998,7 @@ msgstr "" "這些使用方案展示了如何有效地從 :mod:`itertools` 模組的組合疊代器 " "(combinatoric iterators) 中進行隨機選擇:" -#: ../../library/random.rst:624 +#: ../../library/random.rst:630 msgid "" "def random_product(*args, repeat=1):\n" " \"Random selection from itertools.product(*args, **kwds)\"\n" @@ -1020,7 +1029,7 @@ msgid "" " return tuple(pool[i] for i in indices)" msgstr "" -#: ../../library/random.rst:653 +#: ../../library/random.rst:659 msgid "" "The default :func:`.random` returns multiples of 2⁻⁵³ in the range *0.0 ≤ x " "< 1.0*. All such numbers are evenly spaced and are exactly representable as " @@ -1032,7 +1041,7 @@ msgstr "" "均勻分佈的,並且可以完全表示為 Python float。但是,該間隔中的許多其他可表示" "的 float 不是可能的選擇。 例如 ``0.05954861408025609`` 不是 2⁻⁵³ 的整數倍。" -#: ../../library/random.rst:659 +#: ../../library/random.rst:665 msgid "" "The following recipe takes a different approach. All floats in the interval " "are possible selections. The mantissa comes from a uniform distribution of " @@ -1044,7 +1053,7 @@ msgstr "" "數 < 2⁵³* 範圍內的整數均勻分佈。指數來自幾何分佈,其中小於 *-53* 的指數的出現" "頻率是下一個較大指數的一半。" -#: ../../library/random.rst:667 +#: ../../library/random.rst:673 msgid "" "from random import Random\n" "from math import ldexp\n" @@ -1074,7 +1083,7 @@ msgstr "" " exponent += x.bit_length() - 32\n" " return ldexp(mantissa, exponent)" -#: ../../library/random.rst:681 +#: ../../library/random.rst:687 msgid "" "All :ref:`real valued distributions ` in the " "class will use the new method::" @@ -1082,7 +1091,7 @@ msgstr "" "Class 中的所有\\ :ref:`實數分佈 `\\ 都將使用新方" "法: ::" -#: ../../library/random.rst:684 +#: ../../library/random.rst:690 msgid "" ">>> fr = FullRandom()\n" ">>> fr.random()\n" @@ -1096,7 +1105,7 @@ msgstr "" ">>> fr.expovariate(0.25)\n" "8.87925541791544" -#: ../../library/random.rst:690 +#: ../../library/random.rst:696 msgid "" "The recipe is conceptually equivalent to an algorithm that chooses from all " "the multiples of 2⁻¹⁰⁷⁴ in the range *0.0 ≤ x < 1.0*. All such numbers are " @@ -1109,7 +1118,7 @@ msgstr "" "示的 Python float。(2⁻¹⁰⁷⁴ 是最小為正的非正規化 float,等於 ``math." "ulp(0.0)``)" -#: ../../library/random.rst:699 +#: ../../library/random.rst:705 msgid "" "`Generating Pseudo-random Floating-Point Values `_ a paper by Allen B. Downey describing " @@ -1119,3 +1128,97 @@ msgstr "" "`產生偽隨機浮點值 `_ Allen B. Downey 的一篇論文描述了產生比通常由 :func:`.random` 產生的 " "float 更 fine-grained(細粒的)的方法。" + +#: ../../library/random.rst:713 +msgid "Command-line usage" +msgstr "" + +#: ../../library/random.rst:717 +msgid "The :mod:`!random` module can be executed from the command line." +msgstr "" + +#: ../../library/random.rst:719 +msgid "" +"python -m random [-h] [-c CHOICE [CHOICE ...] | -i N | -f N] [input ...]" +msgstr "" + +#: ../../library/random.rst:723 +#, fuzzy +msgid "The following options are accepted:" +msgstr "以下函式產生離散分佈。" + +#: ../../library/random.rst:729 +msgid "Show the help message and exit." +msgstr "" + +#: ../../library/random.rst:734 +msgid "Print a random choice, using :meth:`choice`." +msgstr "" + +#: ../../library/random.rst:739 +msgid "" +"Print a random integer between 1 and N inclusive, using :meth:`randint`." +msgstr "" + +#: ../../library/random.rst:744 +msgid "" +"Print a random floating-point number between 1 and N inclusive, using :meth:" +"`uniform`." +msgstr "" + +#: ../../library/random.rst:747 +msgid "If no options are given, the output depends on the input:" +msgstr "" + +#: ../../library/random.rst:749 +msgid "String or multiple: same as :option:`--choice`." +msgstr "" + +#: ../../library/random.rst:750 +msgid "Integer: same as :option:`--integer`." +msgstr "" + +#: ../../library/random.rst:751 +msgid "Float: same as :option:`--float`." +msgstr "" + +#: ../../library/random.rst:756 +msgid "Command-line example" +msgstr "" + +#: ../../library/random.rst:758 +msgid "Here are some examples of the :mod:`!random` command-line interface:" +msgstr "" + +#: ../../library/random.rst:760 +msgid "" +"$ # Choose one at random\n" +"$ python -m random egg bacon sausage spam \"Lobster Thermidor aux crevettes " +"with a Mornay sauce\"\n" +"Lobster Thermidor aux crevettes with a Mornay sauce\n" +"\n" +"$ # Random integer\n" +"$ python -m random 6\n" +"6\n" +"\n" +"$ # Random floating-point number\n" +"$ python -m random 1.8\n" +"1.7080016272295635\n" +"\n" +"$ # With explicit arguments\n" +"$ python -m random --choice egg bacon sausage spam \"Lobster Thermidor aux " +"crevettes with a Mornay sauce\"\n" +"egg\n" +"\n" +"$ python -m random --integer 6\n" +"3\n" +"\n" +"$ python -m random --float 1.8\n" +"1.5666339105010318\n" +"\n" +"$ python -m random --integer 6\n" +"5\n" +"\n" +"$ python -m random --float 6\n" +"3.1942323316565915" +msgstr "" diff --git a/library/re.po b/library/re.po index 5f3d918f57..5059b8501a 100644 --- a/library/re.po +++ b/library/re.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-09-16 14:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -169,7 +169,7 @@ msgstr "" msgid "The special characters are:" msgstr "" -#: ../../library/re.rst:101 ../../library/re.rst:1637 +#: ../../library/re.rst:101 ../../library/re.rst:1643 msgid "``.``" msgstr "``.``" @@ -1224,9 +1224,9 @@ msgid "" msgstr "" #: ../../library/re.rst:881 ../../library/re.rst:913 ../../library/re.rst:931 -#: ../../library/re.rst:942 ../../library/re.rst:988 ../../library/re.rst:1017 -#: ../../library/re.rst:1032 ../../library/re.rst:1091 -#: ../../library/re.rst:1130 +#: ../../library/re.rst:942 ../../library/re.rst:988 ../../library/re.rst:1022 +#: ../../library/re.rst:1037 ../../library/re.rst:1096 +#: ../../library/re.rst:1132 msgid "" "The expression's behaviour can be modified by specifying a *flags* value. " "Values can be any of the `flags`_ variables, combined using bitwise OR (the " @@ -1312,12 +1312,13 @@ msgid "" msgstr "" #: ../../library/re.rst:957 +#, fuzzy msgid "" ">>> re.split(r'\\W+', 'Words, words, words.')\n" "['Words', 'words', 'words', '']\n" ">>> re.split(r'(\\W+)', 'Words, words, words.')\n" "['Words', ', ', 'words', ', ', 'words', '.', '']\n" -">>> re.split(r'\\W+', 'Words, words, words.', 1)\n" +">>> re.split(r'\\W+', 'Words, words, words.', maxsplit=1)\n" "['Words', 'words, words.']\n" ">>> re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE)\n" "['0', '3', '9']" @@ -1376,7 +1377,7 @@ msgstr "" "['', '...', '', '', 'w', '', 'o', '', 'r', '', 'd', '', 's', '...', '', '', " "'']" -#: ../../library/re.rst:992 ../../library/re.rst:1095 ../../library/re.rst:1124 +#: ../../library/re.rst:992 ../../library/re.rst:1100 msgid "Added the optional flags argument." msgstr "新增可選的旗標引數。" @@ -1385,14 +1386,21 @@ msgid "" "Added support of splitting on a pattern that could match an empty string." msgstr "" -#: ../../library/re.rst:1001 +#: ../../library/re.rst:998 +msgid "" +"Passing *maxsplit* and *flags* as positional arguments is deprecated. In " +"future Python versions they will be :ref:`keyword-only parameters `." +msgstr "" + +#: ../../library/re.rst:1006 msgid "" "Return all non-overlapping matches of *pattern* in *string*, as a list of " "strings or tuples. The *string* is scanned left-to-right, and matches are " "returned in the order found. Empty matches are included in the result." msgstr "" -#: ../../library/re.rst:1005 +#: ../../library/re.rst:1010 msgid "" "The result depends on the number of capturing groups in the pattern. If " "there are no groups, return a list of strings matching the whole pattern. " @@ -1402,11 +1410,11 @@ msgid "" "result." msgstr "" -#: ../../library/re.rst:1021 ../../library/re.rst:1036 +#: ../../library/re.rst:1026 ../../library/re.rst:1041 msgid "Non-empty matches can now start just after a previous empty match." msgstr "" -#: ../../library/re.rst:1027 +#: ../../library/re.rst:1032 msgid "" "Return an :term:`iterator` yielding :class:`~re.Match` objects over all non-" "overlapping matches for the RE *pattern* in *string*. The *string* is " @@ -1414,7 +1422,7 @@ msgid "" "matches are included in the result." msgstr "" -#: ../../library/re.rst:1042 +#: ../../library/re.rst:1047 msgid "" "Return the string obtained by replacing the leftmost non-overlapping " "occurrences of *pattern* in *string* by the replacement *repl*. If the " @@ -1428,7 +1436,7 @@ msgid "" "For example::" msgstr "" -#: ../../library/re.rst:1053 +#: ../../library/re.rst:1058 msgid "" ">>> re.sub(r'def\\s+([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\(\\s*\\):',\n" "... r'static PyObject*\\npy_\\1(void)\\n{',\n" @@ -1440,14 +1448,14 @@ msgstr "" "... 'def myfunc():')\n" "'static PyObject*\\npy_myfunc(void)\\n{'" -#: ../../library/re.rst:1058 +#: ../../library/re.rst:1063 msgid "" "If *repl* is a function, it is called for every non-overlapping occurrence " "of *pattern*. The function takes a single :class:`~re.Match` argument, and " "returns the replacement string. For example::" msgstr "" -#: ../../library/re.rst:1062 +#: ../../library/re.rst:1067 msgid "" ">>> def dashrepl(matchobj):\n" "... if matchobj.group(0) == '-': return ' '\n" @@ -1469,11 +1477,11 @@ msgstr "" "IGNORECASE)\n" "'Baked Beans & Spam'" -#: ../../library/re.rst:1071 +#: ../../library/re.rst:1076 msgid "The pattern may be a string or a :class:`~re.Pattern`." msgstr "" -#: ../../library/re.rst:1073 +#: ../../library/re.rst:1078 msgid "" "The optional argument *count* is the maximum number of pattern occurrences " "to be replaced; *count* must be a non-negative integer. If omitted or zero, " @@ -1482,7 +1490,7 @@ msgid "" "'abxd')`` returns ``'-a-b--d-'``." msgstr "" -#: ../../library/re.rst:1081 +#: ../../library/re.rst:1086 msgid "" "In string-type *repl* arguments, in addition to the character escapes and " "backreferences described above, ``\\g`` will use the substring matched " @@ -1495,30 +1503,24 @@ msgid "" "RE." msgstr "" -#: ../../library/re.rst:1098 ../../library/re.rst:1127 -#: ../../library/re.rst:1375 +#: ../../library/re.rst:1103 ../../library/re.rst:1381 msgid "Unmatched groups are replaced with an empty string." msgstr "" -#: ../../library/re.rst:1101 +#: ../../library/re.rst:1106 msgid "" "Unknown escapes in *pattern* consisting of ``'\\'`` and an ASCII letter now " "are errors." msgstr "" -#: ../../library/re.rst:1105 +#: ../../library/re.rst:1110 msgid "" "Unknown escapes in *repl* consisting of ``'\\'`` and an ASCII letter now are " -"errors." +"errors. Empty matches for the pattern are replaced when adjacent to a " +"previous non-empty match." msgstr "" -#: ../../library/re.rst:1109 -msgid "" -"Empty matches for the pattern are replaced when adjacent to a previous non-" -"empty match." -msgstr "" - -#: ../../library/re.rst:1113 +#: ../../library/re.rst:1116 msgid "" "Group *id* can only contain ASCII digits. In :class:`bytes` replacement " "strings, group *name* can only contain bytes in the ASCII range " @@ -1527,18 +1529,25 @@ msgstr "" #: ../../library/re.rst:1121 msgid "" +"Passing *count* and *flags* as positional arguments is deprecated. In future " +"Python versions they will be :ref:`keyword-only parameters `." +msgstr "" + +#: ../../library/re.rst:1129 +msgid "" "Perform the same operation as :func:`sub`, but return a tuple ``(new_string, " "number_of_subs_made)``." msgstr "" -#: ../../library/re.rst:1137 +#: ../../library/re.rst:1139 msgid "" "Escape special characters in *pattern*. This is useful if you want to match " "an arbitrary literal string that may have regular expression metacharacters " "in it. For example::" msgstr "" -#: ../../library/re.rst:1141 +#: ../../library/re.rst:1143 msgid "" ">>> print(re.escape('https://www.python.org/'))\n" "https://www//.python//.org/n" @@ -1564,13 +1573,13 @@ msgstr "" ">>> print('|'.join(map(re.escape, sorted(operators, reverse=True))))\n" "/|\\-|\\+|\\*\\*|\\*" -#: ../../library/re.rst:1152 +#: ../../library/re.rst:1154 msgid "" "This function must not be used for the replacement string in :func:`sub` " "and :func:`subn`, only backslashes should be escaped. For example::" msgstr "" -#: ../../library/re.rst:1155 +#: ../../library/re.rst:1157 msgid "" ">>> digits_re = r'\\d+'\n" ">>> sample = '/usr/sbin/sendmail - 0 errors, 12 warnings'\n" @@ -1582,11 +1591,11 @@ msgstr "" ">>> print(re.sub(digits_re, digits_re.replace('\\\\', r'\\\\'), sample))\n" "/usr/sbin/sendmail - \\d+ errors, \\d+ warnings" -#: ../../library/re.rst:1160 +#: ../../library/re.rst:1162 msgid "The ``'_'`` character is no longer escaped." msgstr "" -#: ../../library/re.rst:1163 +#: ../../library/re.rst:1165 msgid "" "Only characters that can have special meaning in a regular expression are " "escaped. As a result, ``'!'``, ``'\"'``, ``'%'``, ``\"'\"``, ``','``, " @@ -1594,62 +1603,69 @@ msgid "" "are no longer escaped." msgstr "" -#: ../../library/re.rst:1172 +#: ../../library/re.rst:1174 msgid "Clear the regular expression cache." msgstr "" -#: ../../library/re.rst:1176 +#: ../../library/re.rst:1178 msgid "Exceptions" msgstr "" -#: ../../library/re.rst:1180 +#: ../../library/re.rst:1182 msgid "" "Exception raised when a string passed to one of the functions here is not a " "valid regular expression (for example, it might contain unmatched " "parentheses) or when some other error occurs during compilation or " "matching. It is never an error if a string contains no match for a " -"pattern. The error instance has the following additional attributes:" +"pattern. The ``PatternError`` instance has the following additional " +"attributes:" msgstr "" -#: ../../library/re.rst:1188 +#: ../../library/re.rst:1190 msgid "The unformatted error message." msgstr "" -#: ../../library/re.rst:1192 +#: ../../library/re.rst:1194 msgid "The regular expression pattern." msgstr "" -#: ../../library/re.rst:1196 +#: ../../library/re.rst:1198 msgid "The index in *pattern* where compilation failed (may be ``None``)." msgstr "" -#: ../../library/re.rst:1200 +#: ../../library/re.rst:1202 msgid "The line corresponding to *pos* (may be ``None``)." msgstr "" -#: ../../library/re.rst:1204 +#: ../../library/re.rst:1206 msgid "The column corresponding to *pos* (may be ``None``)." msgstr "" -#: ../../library/re.rst:1206 +#: ../../library/re.rst:1208 msgid "Added additional attributes." msgstr "新增額外屬性。" -#: ../../library/re.rst:1212 +#: ../../library/re.rst:1211 +msgid "" +"``PatternError`` was originally named ``error``; the latter is kept as an " +"alias for backward compatibility." +msgstr "" + +#: ../../library/re.rst:1218 msgid "Regular Expression Objects" msgstr "" -#: ../../library/re.rst:1216 +#: ../../library/re.rst:1222 msgid "Compiled regular expression object returned by :func:`re.compile`." msgstr "" -#: ../../library/re.rst:1218 +#: ../../library/re.rst:1224 msgid "" ":py:class:`re.Pattern` supports ``[]`` to indicate a Unicode (str) or bytes " "pattern. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1224 +#: ../../library/re.rst:1230 msgid "" "Scan through *string* looking for the first location where this regular " "expression produces a match, and return a corresponding :class:`~re.Match`. " @@ -1658,7 +1674,7 @@ msgid "" "string." msgstr "" -#: ../../library/re.rst:1229 +#: ../../library/re.rst:1235 msgid "" "The optional second parameter *pos* gives an index in the string where the " "search is to start; it defaults to ``0``. This is not completely equivalent " @@ -1667,7 +1683,7 @@ msgid "" "necessarily at the index where the search is to start." msgstr "" -#: ../../library/re.rst:1235 +#: ../../library/re.rst:1241 msgid "" "The optional parameter *endpos* limits how far the string will be searched; " "it will be as if the string is *endpos* characters long, so only the " @@ -1677,7 +1693,7 @@ msgid "" "equivalent to ``rx.search(string[:50], 0)``. ::" msgstr "" -#: ../../library/re.rst:1242 +#: ../../library/re.rst:1248 msgid "" ">>> pattern = re.compile(\"d\")\n" ">>> pattern.search(\"dog\") # Match at index 0\n" @@ -1685,7 +1701,7 @@ msgid "" ">>> pattern.search(\"dog\", 1) # No match; search doesn't include the \"d\"" msgstr "" -#: ../../library/re.rst:1250 +#: ../../library/re.rst:1256 msgid "" "If zero or more characters at the *beginning* of *string* match this regular " "expression, return a corresponding :class:`~re.Match`. Return ``None`` if " @@ -1693,13 +1709,13 @@ msgid "" "zero-length match." msgstr "" -#: ../../library/re.rst:1255 ../../library/re.rst:1273 +#: ../../library/re.rst:1261 ../../library/re.rst:1279 msgid "" "The optional *pos* and *endpos* parameters have the same meaning as for the :" "meth:`~Pattern.search` method. ::" msgstr "" -#: ../../library/re.rst:1258 +#: ../../library/re.rst:1264 msgid "" ">>> pattern = re.compile(\"o\")\n" ">>> pattern.match(\"dog\") # No match as \"o\" is not at the start of " @@ -1709,20 +1725,20 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1263 +#: ../../library/re.rst:1269 msgid "" "If you want to locate a match anywhere in *string*, use :meth:`~Pattern." "search` instead (see also :ref:`search-vs-match`)." msgstr "" -#: ../../library/re.rst:1269 +#: ../../library/re.rst:1275 msgid "" "If the whole *string* matches this regular expression, return a " "corresponding :class:`~re.Match`. Return ``None`` if the string does not " "match the pattern; note that this is different from a zero-length match." msgstr "" -#: ../../library/re.rst:1276 +#: ../../library/re.rst:1282 msgid "" ">>> pattern = re.compile(\"o[gh]\")\n" ">>> pattern.fullmatch(\"dog\") # No match as \"o\" is not at the start " @@ -1733,72 +1749,72 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1287 +#: ../../library/re.rst:1293 msgid "Identical to the :func:`split` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1292 +#: ../../library/re.rst:1298 msgid "" "Similar to the :func:`findall` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1299 +#: ../../library/re.rst:1305 msgid "" "Similar to the :func:`finditer` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1306 +#: ../../library/re.rst:1312 msgid "Identical to the :func:`sub` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1311 +#: ../../library/re.rst:1317 msgid "Identical to the :func:`subn` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1316 +#: ../../library/re.rst:1322 msgid "" "The regex matching flags. This is a combination of the flags given to :func:" "`.compile`, any ``(?...)`` inline flags in the pattern, and implicit flags " "such as :py:const:`~re.UNICODE` if the pattern is a Unicode string." msgstr "" -#: ../../library/re.rst:1323 +#: ../../library/re.rst:1329 msgid "The number of capturing groups in the pattern." msgstr "" -#: ../../library/re.rst:1328 +#: ../../library/re.rst:1334 msgid "" "A dictionary mapping any symbolic group names defined by ``(?P)`` to " "group numbers. The dictionary is empty if no symbolic groups were used in " "the pattern." msgstr "" -#: ../../library/re.rst:1335 +#: ../../library/re.rst:1341 msgid "The pattern string from which the pattern object was compiled." msgstr "" -#: ../../library/re.rst:1338 +#: ../../library/re.rst:1344 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Compiled " "regular expression objects are considered atomic." msgstr "" -#: ../../library/re.rst:1346 +#: ../../library/re.rst:1352 msgid "Match Objects" msgstr "" -#: ../../library/re.rst:1348 +#: ../../library/re.rst:1354 msgid "" "Match objects always have a boolean value of ``True``. Since :meth:`~Pattern." "match` and :meth:`~Pattern.search` return ``None`` when there is no match, " "you can test whether there was a match with a simple ``if`` statement::" msgstr "" -#: ../../library/re.rst:1353 +#: ../../library/re.rst:1359 msgid "" "match = re.search(pattern, string)\n" "if match:\n" @@ -1808,17 +1824,17 @@ msgstr "" "if match:\n" " process(match)" -#: ../../library/re.rst:1359 +#: ../../library/re.rst:1365 msgid "Match object returned by successful ``match``\\ es and ``search``\\ es." msgstr "" -#: ../../library/re.rst:1361 +#: ../../library/re.rst:1367 msgid "" ":py:class:`re.Match` supports ``[]`` to indicate a Unicode (str) or bytes " "match. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1367 +#: ../../library/re.rst:1373 msgid "" "Return the string obtained by doing backslash substitution on the template " "string *template*, as done by the :meth:`~Pattern.sub` method. Escapes such " @@ -1828,7 +1844,7 @@ msgid "" "backreference ``\\g<0>`` will be replaced by the entire match." msgstr "" -#: ../../library/re.rst:1380 +#: ../../library/re.rst:1386 msgid "" "Returns one or more subgroups of the match. If there is a single argument, " "the result is a single string; if there are multiple arguments, the result " @@ -1843,7 +1859,7 @@ msgid "" "the pattern that matched multiple times, the last match is returned. ::" msgstr "" -#: ../../library/re.rst:1392 +#: ../../library/re.rst:1398 msgid "" ">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" ">>> m.group(0) # The entire match\n" @@ -1856,7 +1872,7 @@ msgid "" "('Isaac', 'Newton')" msgstr "" -#: ../../library/re.rst:1402 +#: ../../library/re.rst:1408 msgid "" "If the regular expression uses the ``(?P...)`` syntax, the *groupN* " "arguments may also be strings identifying groups by their group name. If a " @@ -1864,11 +1880,11 @@ msgid "" "`IndexError` exception is raised." msgstr "" -#: ../../library/re.rst:1407 +#: ../../library/re.rst:1413 msgid "A moderately complicated example::" msgstr "" -#: ../../library/re.rst:1409 +#: ../../library/re.rst:1415 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " "Reynolds\")\n" @@ -1884,11 +1900,11 @@ msgstr "" ">>> m.group('last_name')\n" "'Reynolds'" -#: ../../library/re.rst:1415 +#: ../../library/re.rst:1421 msgid "Named groups can also be referred to by their index::" msgstr "" -#: ../../library/re.rst:1417 +#: ../../library/re.rst:1423 msgid "" ">>> m.group(1)\n" "'Malcolm'\n" @@ -1900,24 +1916,24 @@ msgstr "" ">>> m.group(2)\n" "'Reynolds'" -#: ../../library/re.rst:1422 +#: ../../library/re.rst:1428 msgid "If a group matches multiple times, only the last match is accessible::" msgstr "" -#: ../../library/re.rst:1424 +#: ../../library/re.rst:1430 msgid "" ">>> m = re.match(r\"(..)+\", \"a1b2c3\") # Matches 3 times.\n" ">>> m.group(1) # Returns only the last match.\n" "'c3'" msgstr "" -#: ../../library/re.rst:1431 +#: ../../library/re.rst:1437 msgid "" "This is identical to ``m.group(g)``. This allows easier access to an " "individual group from a match::" msgstr "" -#: ../../library/re.rst:1434 +#: ../../library/re.rst:1440 msgid "" ">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" ">>> m[0] # The entire match\n" @@ -1928,11 +1944,11 @@ msgid "" "'Newton'" msgstr "" -#: ../../library/re.rst:1442 +#: ../../library/re.rst:1448 msgid "Named groups are supported as well::" msgstr "" -#: ../../library/re.rst:1444 +#: ../../library/re.rst:1450 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Isaac " "Newton\")\n" @@ -1948,18 +1964,18 @@ msgstr "" ">>> m['last_name']\n" "'Newton'" -#: ../../library/re.rst:1455 +#: ../../library/re.rst:1461 msgid "" "Return a tuple containing all the subgroups of the match, from 1 up to " "however many groups are in the pattern. The *default* argument is used for " "groups that did not participate in the match; it defaults to ``None``." msgstr "" -#: ../../library/re.rst:1459 ../../library/re.rst:1684 +#: ../../library/re.rst:1465 ../../library/re.rst:1690 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/re.rst:1461 +#: ../../library/re.rst:1467 msgid "" ">>> m = re.match(r\"(\\d+)\\.(\\d+)\", \"24.1632\")\n" ">>> m.groups()\n" @@ -1969,14 +1985,14 @@ msgstr "" ">>> m.groups()\n" "('24', '1632')" -#: ../../library/re.rst:1465 +#: ../../library/re.rst:1471 msgid "" "If we make the decimal place and everything after it optional, not all " "groups might participate in the match. These groups will default to " "``None`` unless the *default* argument is given::" msgstr "" -#: ../../library/re.rst:1469 +#: ../../library/re.rst:1475 msgid "" ">>> m = re.match(r\"(\\d+)\\.?(\\d+)?\", \"24\")\n" ">>> m.groups() # Second group defaults to None.\n" @@ -1985,14 +2001,14 @@ msgid "" "('24', '0')" msgstr "" -#: ../../library/re.rst:1478 +#: ../../library/re.rst:1484 msgid "" "Return a dictionary containing all the *named* subgroups of the match, keyed " "by the subgroup name. The *default* argument is used for groups that did " "not participate in the match; it defaults to ``None``. For example::" msgstr "" -#: ../../library/re.rst:1482 +#: ../../library/re.rst:1488 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " "Reynolds\")\n" @@ -2004,7 +2020,7 @@ msgstr "" ">>> m.groupdict()\n" "{'first_name': 'Malcolm', 'last_name': 'Reynolds'}" -#: ../../library/re.rst:1490 +#: ../../library/re.rst:1496 msgid "" "Return the indices of the start and end of the substring matched by *group*; " "*group* defaults to zero (meaning the whole matched substring). Return " @@ -2013,11 +2029,11 @@ msgid "" "matched by group *g* (equivalent to ``m.group(g)``) is ::" msgstr "" -#: ../../library/re.rst:1496 +#: ../../library/re.rst:1502 msgid "m.string[m.start(g):m.end(g)]" msgstr "m.string[m.start(g):m.end(g)]" -#: ../../library/re.rst:1498 +#: ../../library/re.rst:1504 msgid "" "Note that ``m.start(group)`` will equal ``m.end(group)`` if *group* matched " "a null string. For example, after ``m = re.search('b(c?)', 'cba')``, ``m." @@ -2025,11 +2041,11 @@ msgid "" "2, and ``m.start(2)`` raises an :exc:`IndexError` exception." msgstr "" -#: ../../library/re.rst:1503 +#: ../../library/re.rst:1509 msgid "An example that will remove *remove_this* from email addresses::" msgstr "" -#: ../../library/re.rst:1505 +#: ../../library/re.rst:1511 msgid "" ">>> email = \"tony@tiremove_thisger.net\"\n" ">>> m = re.search(\"remove_this\", email)\n" @@ -2041,28 +2057,28 @@ msgstr "" ">>> email[:m.start()] + email[m.end():]\n" "'tony@tiger.net'" -#: ../../library/re.rst:1513 +#: ../../library/re.rst:1519 msgid "" "For a match *m*, return the 2-tuple ``(m.start(group), m.end(group))``. Note " "that if *group* did not contribute to the match, this is ``(-1, -1)``. " "*group* defaults to zero, the entire match." msgstr "" -#: ../../library/re.rst:1520 +#: ../../library/re.rst:1526 msgid "" "The value of *pos* which was passed to the :meth:`~Pattern.search` or :meth:" "`~Pattern.match` method of a :ref:`regex object `. This is the " "index into the string at which the RE engine started looking for a match." msgstr "" -#: ../../library/re.rst:1527 +#: ../../library/re.rst:1533 msgid "" "The value of *endpos* which was passed to the :meth:`~Pattern.search` or :" "meth:`~Pattern.match` method of a :ref:`regex object `. This is " "the index into the string beyond which the RE engine will not go." msgstr "" -#: ../../library/re.rst:1534 +#: ../../library/re.rst:1540 msgid "" "The integer index of the last matched capturing group, or ``None`` if no " "group was matched at all. For example, the expressions ``(a)b``, ``((a)" @@ -2071,43 +2087,43 @@ msgid "" "applied to the same string." msgstr "" -#: ../../library/re.rst:1543 +#: ../../library/re.rst:1549 msgid "" "The name of the last matched capturing group, or ``None`` if the group " "didn't have a name, or if no group was matched at all." msgstr "" -#: ../../library/re.rst:1549 +#: ../../library/re.rst:1555 msgid "" "The :ref:`regular expression object ` whose :meth:`~Pattern." "match` or :meth:`~Pattern.search` method produced this match instance." msgstr "" -#: ../../library/re.rst:1555 +#: ../../library/re.rst:1561 msgid "The string passed to :meth:`~Pattern.match` or :meth:`~Pattern.search`." msgstr "" -#: ../../library/re.rst:1558 +#: ../../library/re.rst:1564 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Match objects " "are considered atomic." msgstr "" -#: ../../library/re.rst:1566 +#: ../../library/re.rst:1572 msgid "Regular Expression Examples" msgstr "" -#: ../../library/re.rst:1570 +#: ../../library/re.rst:1576 msgid "Checking for a Pair" msgstr "" -#: ../../library/re.rst:1572 +#: ../../library/re.rst:1578 msgid "" "In this example, we'll use the following helper function to display match " "objects a little more gracefully::" msgstr "" -#: ../../library/re.rst:1575 +#: ../../library/re.rst:1581 msgid "" "def displaymatch(match):\n" " if match is None:\n" @@ -2119,7 +2135,7 @@ msgstr "" " return None\n" " return '' % (match.group(), match.groups())" -#: ../../library/re.rst:1580 +#: ../../library/re.rst:1586 msgid "" "Suppose you are writing a poker program where a player's hand is represented " "as a 5-character string with each character representing a card, \"a\" for " @@ -2127,11 +2143,11 @@ msgid "" "\"2\" through \"9\" representing the card with that value." msgstr "" -#: ../../library/re.rst:1585 +#: ../../library/re.rst:1591 msgid "To see if a given string is a valid hand, one could do the following::" msgstr "" -#: ../../library/re.rst:1587 +#: ../../library/re.rst:1593 msgid "" ">>> valid = re.compile(r\"^[a2-9tjqk]{5}$\")\n" ">>> displaymatch(valid.match(\"akt5q\")) # Valid.\n" @@ -2142,14 +2158,14 @@ msgid "" "\"\"" msgstr "" -#: ../../library/re.rst:1595 +#: ../../library/re.rst:1601 msgid "" "That last hand, ``\"727ak\"``, contained a pair, or two of the same valued " "cards. To match this with a regular expression, one could use backreferences " "as such::" msgstr "" -#: ../../library/re.rst:1598 +#: ../../library/re.rst:1604 msgid "" ">>> pair = re.compile(r\".*(.).*\\1\")\n" ">>> displaymatch(pair.match(\"717ak\")) # Pair of 7s.\n" @@ -2159,13 +2175,13 @@ msgid "" "\"\"" msgstr "" -#: ../../library/re.rst:1605 +#: ../../library/re.rst:1611 msgid "" "To find out what card the pair consists of, one could use the :meth:`~Match." "group` method of the match object in the following manner::" msgstr "" -#: ../../library/re.rst:1608 +#: ../../library/re.rst:1614 msgid "" ">>> pair = re.compile(r\".*(.).*\\1\")\n" ">>> pair.match(\"717ak\").group(1)\n" @@ -2183,11 +2199,11 @@ msgid "" "'a'" msgstr "" -#: ../../library/re.rst:1624 +#: ../../library/re.rst:1630 msgid "Simulating scanf()" msgstr "模擬 scanf()" -#: ../../library/re.rst:1628 +#: ../../library/re.rst:1634 msgid "" "Python does not currently have an equivalent to :c:func:`!scanf`. Regular " "expressions are generally more powerful, though also more verbose, than :c:" @@ -2196,130 +2212,130 @@ msgid "" "expressions." msgstr "" -#: ../../library/re.rst:1635 +#: ../../library/re.rst:1641 msgid ":c:func:`!scanf` Token" msgstr "" -#: ../../library/re.rst:1635 +#: ../../library/re.rst:1641 msgid "Regular Expression" msgstr "" -#: ../../library/re.rst:1637 +#: ../../library/re.rst:1643 msgid "``%c``" msgstr "``%c``" -#: ../../library/re.rst:1639 +#: ../../library/re.rst:1645 msgid "``%5c``" msgstr "``%5c``" -#: ../../library/re.rst:1639 +#: ../../library/re.rst:1645 msgid "``.{5}``" msgstr "``.{5}``" -#: ../../library/re.rst:1641 +#: ../../library/re.rst:1647 msgid "``%d``" msgstr "``%d``" -#: ../../library/re.rst:1641 +#: ../../library/re.rst:1647 msgid "``[-+]?\\d+``" msgstr "``[-+]?\\d+``" -#: ../../library/re.rst:1643 +#: ../../library/re.rst:1649 msgid "``%e``, ``%E``, ``%f``, ``%g``" msgstr "``%e``, ``%E``, ``%f``, ``%g``" -#: ../../library/re.rst:1643 +#: ../../library/re.rst:1649 msgid "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" msgstr "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" -#: ../../library/re.rst:1645 +#: ../../library/re.rst:1651 msgid "``%i``" msgstr "``%i``" -#: ../../library/re.rst:1645 +#: ../../library/re.rst:1651 msgid "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" msgstr "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" -#: ../../library/re.rst:1647 +#: ../../library/re.rst:1653 msgid "``%o``" msgstr "``%o``" -#: ../../library/re.rst:1647 +#: ../../library/re.rst:1653 msgid "``[-+]?[0-7]+``" msgstr "``[-+]?[0-7]+``" -#: ../../library/re.rst:1649 +#: ../../library/re.rst:1655 msgid "``%s``" msgstr "``%s``" -#: ../../library/re.rst:1649 +#: ../../library/re.rst:1655 msgid "``\\S+``" msgstr "``\\S+``" -#: ../../library/re.rst:1651 +#: ../../library/re.rst:1657 msgid "``%u``" msgstr "``%u``" -#: ../../library/re.rst:1651 +#: ../../library/re.rst:1657 msgid "``\\d+``" msgstr "``\\d+``" -#: ../../library/re.rst:1653 +#: ../../library/re.rst:1659 msgid "``%x``, ``%X``" msgstr "``%x``、``%X``" -#: ../../library/re.rst:1653 +#: ../../library/re.rst:1659 msgid "``[-+]?(0[xX])?[\\dA-Fa-f]+``" msgstr "``[-+]?(0[xX])?[\\dA-Fa-f]+``" -#: ../../library/re.rst:1656 +#: ../../library/re.rst:1662 msgid "To extract the filename and numbers from a string like ::" msgstr "" -#: ../../library/re.rst:1658 +#: ../../library/re.rst:1664 msgid "/usr/sbin/sendmail - 0 errors, 4 warnings" msgstr "/usr/sbin/sendmail - 0 errors, 4 warnings" -#: ../../library/re.rst:1660 +#: ../../library/re.rst:1666 msgid "you would use a :c:func:`!scanf` format like ::" msgstr "" -#: ../../library/re.rst:1662 +#: ../../library/re.rst:1668 msgid "%s - %d errors, %d warnings" msgstr "" -#: ../../library/re.rst:1664 +#: ../../library/re.rst:1670 msgid "The equivalent regular expression would be ::" msgstr "" -#: ../../library/re.rst:1666 +#: ../../library/re.rst:1672 msgid "(\\S+) - (\\d+) errors, (\\d+) warnings" msgstr "" -#: ../../library/re.rst:1672 +#: ../../library/re.rst:1678 msgid "search() vs. match()" msgstr "search() vs. match()" -#: ../../library/re.rst:1676 +#: ../../library/re.rst:1682 msgid "" "Python offers different primitive operations based on regular expressions:" msgstr "" -#: ../../library/re.rst:1678 +#: ../../library/re.rst:1684 msgid ":func:`re.match` checks for a match only at the beginning of the string" msgstr "" -#: ../../library/re.rst:1679 +#: ../../library/re.rst:1685 msgid "" ":func:`re.search` checks for a match anywhere in the string (this is what " "Perl does by default)" msgstr "" -#: ../../library/re.rst:1681 +#: ../../library/re.rst:1687 msgid ":func:`re.fullmatch` checks for entire string to be a match" msgstr "" -#: ../../library/re.rst:1686 +#: ../../library/re.rst:1692 msgid "" ">>> re.match(\"c\", \"abcdef\") # No match\n" ">>> re.search(\"c\", \"abcdef\") # Match\n" @@ -2329,13 +2345,13 @@ msgid "" ">>> re.fullmatch(\"r.*n\", \"python\") # No match" msgstr "" -#: ../../library/re.rst:1693 +#: ../../library/re.rst:1699 msgid "" "Regular expressions beginning with ``'^'`` can be used with :func:`search` " "to restrict the match at the beginning of the string::" msgstr "" -#: ../../library/re.rst:1696 +#: ../../library/re.rst:1702 msgid "" ">>> re.match(\"c\", \"abcdef\") # No match\n" ">>> re.search(\"^c\", \"abcdef\") # No match\n" @@ -2343,7 +2359,7 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1701 +#: ../../library/re.rst:1707 msgid "" "Note however that in :const:`MULTILINE` mode :func:`match` only matches at " "the beginning of the string, whereas using :func:`search` with a regular " @@ -2351,18 +2367,18 @@ msgid "" "line. ::" msgstr "" -#: ../../library/re.rst:1705 +#: ../../library/re.rst:1711 msgid "" ">>> re.match(\"X\", \"A\\nB\\nX\", re.MULTILINE) # No match\n" ">>> re.search(\"^X\", \"A\\nB\\nX\", re.MULTILINE) # Match\n" "" msgstr "" -#: ../../library/re.rst:1711 +#: ../../library/re.rst:1717 msgid "Making a Phonebook" msgstr "" -#: ../../library/re.rst:1713 +#: ../../library/re.rst:1719 msgid "" ":func:`split` splits a string into a list delimited by the passed pattern. " "The method is invaluable for converting textual data into data structures " @@ -2370,13 +2386,13 @@ msgid "" "following example that creates a phonebook." msgstr "" -#: ../../library/re.rst:1718 +#: ../../library/re.rst:1724 msgid "" "First, here is the input. Normally it may come from a file, here we are " "using triple-quoted string syntax" msgstr "" -#: ../../library/re.rst:1721 +#: ../../library/re.rst:1727 msgid "" ">>> text = \"\"\"Ross McFluff: 834.345.1254 155 Elm Street\n" "...\n" @@ -2394,13 +2410,13 @@ msgstr "" "...\n" "... Heather Albrecht: 548.326.4584 919 Park Place\"\"\"" -#: ../../library/re.rst:1731 +#: ../../library/re.rst:1737 msgid "" "The entries are separated by one or more newlines. Now we convert the string " "into a list with each nonempty line having its own entry:" msgstr "" -#: ../../library/re.rst:1734 +#: ../../library/re.rst:1740 msgid "" ">>> entries = re.split(\"\\n+\", text)\n" ">>> entries\n" @@ -2416,16 +2432,17 @@ msgstr "" "'Frank Burger: 925.541.7625 662 South Dogwood Way',\n" "'Heather Albrecht: 548.326.4584 919 Park Place']" -#: ../../library/re.rst:1744 +#: ../../library/re.rst:1750 msgid "" "Finally, split each entry into a list with first name, last name, telephone " "number, and address. We use the ``maxsplit`` parameter of :func:`split` " "because the address has spaces, our splitting pattern, in it:" msgstr "" -#: ../../library/re.rst:1748 +#: ../../library/re.rst:1754 +#, fuzzy msgid "" -">>> [re.split(\":? \", entry, 3) for entry in entries]\n" +">>> [re.split(\":? \", entry, maxsplit=3) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155 Elm Street'],\n" "['Ronald', 'Heathmore', '892.345.3428', '436 Finley Avenue'],\n" "['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],\n" @@ -2437,16 +2454,17 @@ msgstr "" "['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919 Park Place']]" -#: ../../library/re.rst:1757 +#: ../../library/re.rst:1763 msgid "" "The ``:?`` pattern matches the colon after the last name, so that it does " "not occur in the result list. With a ``maxsplit`` of ``4``, we could " "separate the house number from the street name:" msgstr "" -#: ../../library/re.rst:1761 +#: ../../library/re.rst:1767 +#, fuzzy msgid "" -">>> [re.split(\":? \", entry, 4) for entry in entries]\n" +">>> [re.split(\":? \", entry, maxsplit=4) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155', 'Elm Street'],\n" "['Ronald', 'Heathmore', '892.345.3428', '436', 'Finley Avenue'],\n" "['Frank', 'Burger', '925.541.7625', '662', 'South Dogwood Way'],\n" @@ -2458,11 +2476,11 @@ msgstr "" "['Frank', 'Burger', '925.541.7625', '662', 'South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919', 'Park Place']]" -#: ../../library/re.rst:1772 +#: ../../library/re.rst:1778 msgid "Text Munging" msgstr "" -#: ../../library/re.rst:1774 +#: ../../library/re.rst:1780 msgid "" ":func:`sub` replaces every occurrence of a pattern with a string or the " "result of a function. This example demonstrates using :func:`sub` with a " @@ -2470,7 +2488,7 @@ msgid "" "each word of a sentence except for the first and last characters::" msgstr "" -#: ../../library/re.rst:1779 +#: ../../library/re.rst:1785 msgid "" ">>> def repl(m):\n" "... inner_word = list(m.group(2))\n" @@ -2494,11 +2512,11 @@ msgstr "" ">>> re.sub(r\"(\\w)(\\w+)(\\w)\", repl, text)\n" "'Pofsroser Aodlambelk, plasee reoprt yuor asnebces potlmrpy.'" -#: ../../library/re.rst:1792 +#: ../../library/re.rst:1798 msgid "Finding all Adverbs" msgstr "" -#: ../../library/re.rst:1794 +#: ../../library/re.rst:1800 msgid "" ":func:`findall` matches *all* occurrences of a pattern, not just the first " "one as :func:`search` does. For example, if a writer wanted to find all of " @@ -2506,7 +2524,7 @@ msgid "" "manner::" msgstr "" -#: ../../library/re.rst:1799 +#: ../../library/re.rst:1805 msgid "" ">>> text = \"He was carefully disguised but captured quickly by police.\"\n" ">>> re.findall(r\"\\w+ly\\b\", text)\n" @@ -2516,11 +2534,11 @@ msgstr "" ">>> re.findall(r\"\\w+ly\\b\", text)\n" "['carefully', 'quickly']" -#: ../../library/re.rst:1805 +#: ../../library/re.rst:1811 msgid "Finding all Adverbs and their Positions" msgstr "" -#: ../../library/re.rst:1807 +#: ../../library/re.rst:1813 msgid "" "If one wants more information about all matches of a pattern than the " "matched text, :func:`finditer` is useful as it provides :class:`~re.Match` " @@ -2529,7 +2547,7 @@ msgid "" "they would use :func:`finditer` in the following manner::" msgstr "" -#: ../../library/re.rst:1813 +#: ../../library/re.rst:1819 msgid "" ">>> text = \"He was carefully disguised but captured quickly by police.\"\n" ">>> for m in re.finditer(r\"\\w+ly\\b\", text):\n" @@ -2543,11 +2561,11 @@ msgstr "" "07-16: carefully\n" "40-47: quickly" -#: ../../library/re.rst:1821 +#: ../../library/re.rst:1827 msgid "Raw String Notation" msgstr "" -#: ../../library/re.rst:1823 +#: ../../library/re.rst:1829 msgid "" "Raw string notation (``r\"text\"``) keeps regular expressions sane. Without " "it, every backslash (``'\\'``) in a regular expression would have to be " @@ -2555,7 +2573,7 @@ msgid "" "lines of code are functionally identical::" msgstr "" -#: ../../library/re.rst:1828 +#: ../../library/re.rst:1834 msgid "" ">>> re.match(r\"\\W(.)\\1\\W\", \" ff \")\n" "\n" @@ -2567,7 +2585,7 @@ msgstr "" ">>> re.match(\"\\\\W(.)\\\\1\\\\W\", \" ff \")\n" "" -#: ../../library/re.rst:1833 +#: ../../library/re.rst:1839 msgid "" "When one wants to match a literal backslash, it must be escaped in the " "regular expression. With raw string notation, this means ``r\"\\\\\"``. " @@ -2575,7 +2593,7 @@ msgid "" "following lines of code functionally identical::" msgstr "" -#: ../../library/re.rst:1838 +#: ../../library/re.rst:1844 msgid "" ">>> re.match(r\"\\\\\", r\"\\\\\")\n" "\n" @@ -2587,25 +2605,25 @@ msgstr "" ">>> re.match(\"\\\\\\\\\", r\"\\\\\")\n" "" -#: ../../library/re.rst:1845 +#: ../../library/re.rst:1851 msgid "Writing a Tokenizer" msgstr "" -#: ../../library/re.rst:1847 +#: ../../library/re.rst:1853 msgid "" "A `tokenizer or scanner `_ " "analyzes a string to categorize groups of characters. This is a useful " "first step in writing a compiler or interpreter." msgstr "" -#: ../../library/re.rst:1851 +#: ../../library/re.rst:1857 msgid "" "The text categories are specified with regular expressions. The technique " "is to combine those into a single master regular expression and to loop over " "successive matches::" msgstr "" -#: ../../library/re.rst:1855 +#: ../../library/re.rst:1861 msgid "" "from typing import NamedTuple\n" "import re\n" @@ -2661,11 +2679,11 @@ msgid "" " print(token)" msgstr "" -#: ../../library/re.rst:1907 +#: ../../library/re.rst:1913 msgid "The tokenizer produces the following output::" msgstr "" -#: ../../library/re.rst:1909 +#: ../../library/re.rst:1915 msgid "" "Token(type='IF', value='IF', line=2, column=4)\n" "Token(type='ID', value='quantity', line=2, column=7)\n" @@ -2707,7 +2725,7 @@ msgstr "" "Token(type='ENDIF', value='ENDIF', line=5, column=4)\n" "Token(type='END', value=';', line=5, column=9)" -#: ../../library/re.rst:1930 +#: ../../library/re.rst:1936 msgid "" "Friedl, Jeffrey. Mastering Regular Expressions. 3rd ed., O'Reilly Media, " "2009. The third edition of the book no longer covers Python at all, but the " @@ -2732,7 +2750,7 @@ msgstr ". (點)" #: ../../library/re.rst:575 ../../library/re.rst:591 ../../library/re.rst:599 #: ../../library/re.rst:613 ../../library/re.rst:621 ../../library/re.rst:638 #: ../../library/re.rst:652 ../../library/re.rst:657 ../../library/re.rst:848 -#: ../../library/re.rst:1079 +#: ../../library/re.rst:1084 msgid "in regular expressions" msgstr "於正規表示式中" @@ -2932,11 +2950,11 @@ msgstr "\\\\" msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/re.rst:1079 +#: ../../library/re.rst:1084 msgid "\\g" msgstr "\\g" -#: ../../library/re.rst:1626 +#: ../../library/re.rst:1632 msgid "scanf (C function)" msgstr "scanf(C 函式)" diff --git a/library/readline.po b/library/readline.po index 1fed428ff6..258923d199 100644 --- a/library/readline.po +++ b/library/readline.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,30 +43,41 @@ msgid "" "general." msgstr "" -#: ../../library/readline.rst:29 +#: ../../includes/wasm-ios-notavail.rst:3 +msgid ":ref:`Availability `: not WASI, not iOS." +msgstr "" + +#: ../../includes/wasm-ios-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly platforms, or " +"on iOS. See :ref:`wasm-availability` for more information on WASM " +"availability; see :ref:`iOS-availability` for more information on iOS " +"availability." +msgstr "" + +#: ../../library/readline.rst:31 msgid "" -"The underlying Readline library API may be implemented by the ``libedit`` " -"library instead of GNU readline. On macOS the :mod:`readline` module detects " -"which library is being used at run time." +"The underlying Readline library API may be implemented by the ``editline`` " +"(``libedit``) library instead of GNU readline. On macOS the :mod:`readline` " +"module detects which library is being used at run time." msgstr "" -#: ../../library/readline.rst:34 +#: ../../library/readline.rst:36 msgid "" -"The configuration file for ``libedit`` is different from that of GNU " -"readline. If you programmatically load configuration strings you can check " -"for the text \"libedit\" in :const:`readline.__doc__` to differentiate " -"between GNU readline and libedit." +"The configuration file for ``editline`` is different from that of GNU " +"readline. If you programmatically load configuration strings you can use :" +"data:`backend` to determine which library is being used." msgstr "" -#: ../../library/readline.rst:39 +#: ../../library/readline.rst:40 msgid "" -"If you use *editline*/``libedit`` readline emulation on macOS, the " +"If you use ``editline``/``libedit`` readline emulation on macOS, the " "initialization file located in your home directory is named ``.editrc``. For " "example, the following content in ``~/.editrc`` will turn ON *vi* " "keybindings and TAB completion::" msgstr "" -#: ../../library/readline.rst:44 +#: ../../library/readline.rst:45 msgid "" "python:bind -v\n" "python:bind ^I rl_complete" @@ -74,83 +85,89 @@ msgstr "" "python:bind -v\n" "python:bind ^I rl_complete" -#: ../../library/readline.rst:47 +#: ../../library/readline.rst:48 msgid "" "Also note that different libraries may use different history file formats. " "When switching the underlying library, existing history files may become " "unusable." msgstr "" -#: ../../library/readline.rst:53 +#: ../../library/readline.rst:54 +msgid "" +"The name of the underlying Readline library being used, either " +"``\"readline\"`` or ``\"editline\"``." +msgstr "" + +#: ../../library/readline.rst:60 msgid "Init file" msgstr "" -#: ../../library/readline.rst:55 +#: ../../library/readline.rst:62 msgid "The following functions relate to the init file and user configuration:" msgstr "" -#: ../../library/readline.rst:60 +#: ../../library/readline.rst:67 msgid "" "Execute the init line provided in the *string* argument. This calls :c:func:" "`rl_parse_and_bind` in the underlying library." msgstr "" -#: ../../library/readline.rst:66 +#: ../../library/readline.rst:73 msgid "" "Execute a readline initialization file. The default filename is the last " "filename used. This calls :c:func:`rl_read_init_file` in the underlying " "library." msgstr "" -#: ../../library/readline.rst:71 +#: ../../library/readline.rst:78 msgid "Line buffer" msgstr "" -#: ../../library/readline.rst:73 +#: ../../library/readline.rst:80 msgid "The following functions operate on the line buffer:" msgstr "" -#: ../../library/readline.rst:78 +#: ../../library/readline.rst:85 msgid "" "Return the current contents of the line buffer (:c:data:`rl_line_buffer` in " "the underlying library)." msgstr "" -#: ../../library/readline.rst:84 +#: ../../library/readline.rst:91 msgid "" "Insert text into the line buffer at the cursor position. This calls :c:func:" "`rl_insert_text` in the underlying library, but ignores the return value." msgstr "" -#: ../../library/readline.rst:91 +#: ../../library/readline.rst:98 msgid "" "Change what's displayed on the screen to reflect the current contents of the " "line buffer. This calls :c:func:`rl_redisplay` in the underlying library." msgstr "" -#: ../../library/readline.rst:96 +#: ../../library/readline.rst:103 msgid "History file" msgstr "" -#: ../../library/readline.rst:98 +#: ../../library/readline.rst:105 msgid "The following functions operate on a history file:" msgstr "" -#: ../../library/readline.rst:103 +#: ../../library/readline.rst:110 msgid "" "Load a readline history file, and append it to the history list. The default " "filename is :file:`~/.history`. This calls :c:func:`read_history` in the " "underlying library." msgstr "" -#: ../../library/readline.rst:110 +#: ../../library/readline.rst:117 msgid "" "Save the history list to a readline history file, overwriting any existing " "file. The default filename is :file:`~/.history`. This calls :c:func:" "`write_history` in the underlying library." msgstr "" -#: ../../library/readline.rst:117 +#: ../../library/readline.rst:124 msgid "" "Append the last *nelements* items of history to a file. The default " "filename is :file:`~/.history`. The file must already exist. This calls :c:" @@ -158,7 +175,7 @@ msgid "" "if Python was compiled for a version of the library that supports it." msgstr "" -#: ../../library/readline.rst:129 +#: ../../library/readline.rst:136 msgid "" "Set or return the desired number of lines to save in the history file. The :" "func:`write_history_file` function uses this value to truncate the history " @@ -166,72 +183,72 @@ msgid "" "Negative values imply unlimited history file size." msgstr "" -#: ../../library/readline.rst:137 +#: ../../library/readline.rst:144 msgid "History list" msgstr "" -#: ../../library/readline.rst:139 +#: ../../library/readline.rst:146 msgid "The following functions operate on a global history list:" msgstr "" -#: ../../library/readline.rst:144 +#: ../../library/readline.rst:151 msgid "" "Clear the current history. This calls :c:func:`clear_history` in the " "underlying library. The Python function only exists if Python was compiled " "for a version of the library that supports it." msgstr "" -#: ../../library/readline.rst:151 +#: ../../library/readline.rst:158 msgid "" "Return the number of items currently in the history. (This is different " "from :func:`get_history_length`, which returns the maximum number of lines " "that will be written to a history file.)" msgstr "" -#: ../../library/readline.rst:158 +#: ../../library/readline.rst:165 msgid "" "Return the current contents of history item at *index*. The item index is " "one-based. This calls :c:func:`history_get` in the underlying library." msgstr "" -#: ../../library/readline.rst:164 +#: ../../library/readline.rst:171 msgid "" "Remove history item specified by its position from the history. The position " "is zero-based. This calls :c:func:`remove_history` in the underlying " "library." msgstr "" -#: ../../library/readline.rst:171 +#: ../../library/readline.rst:178 msgid "" "Replace history item specified by its position with *line*. The position is " "zero-based. This calls :c:func:`replace_history_entry` in the underlying " "library." msgstr "" -#: ../../library/readline.rst:178 +#: ../../library/readline.rst:185 msgid "" "Append *line* to the history buffer, as if it was the last line typed. This " "calls :c:func:`add_history` in the underlying library." msgstr "" -#: ../../library/readline.rst:184 +#: ../../library/readline.rst:191 msgid "" "Enable or disable automatic calls to :c:func:`add_history` when reading " "input via readline. The *enabled* argument should be a Boolean value that " "when true, enables auto history, and that when false, disables auto history." msgstr "" -#: ../../library/readline.rst:192 +#: ../../library/readline.rst:199 msgid "" "Auto history is enabled by default, and changes to this do not persist " "across multiple sessions." msgstr "" -#: ../../library/readline.rst:197 +#: ../../library/readline.rst:204 msgid "Startup hooks" msgstr "" -#: ../../library/readline.rst:202 +#: ../../library/readline.rst:209 msgid "" "Set or remove the function invoked by the :c:data:`rl_startup_hook` callback " "of the underlying library. If *function* is specified, it will be used as " @@ -240,7 +257,7 @@ msgid "" "readline prints the first prompt." msgstr "" -#: ../../library/readline.rst:211 +#: ../../library/readline.rst:218 msgid "" "Set or remove the function invoked by the :c:data:`rl_pre_input_hook` " "callback of the underlying library. If *function* is specified, it will be " @@ -251,11 +268,11 @@ msgid "" "of the library that supports it." msgstr "" -#: ../../library/readline.rst:223 +#: ../../library/readline.rst:230 msgid "Completion" msgstr "" -#: ../../library/readline.rst:225 +#: ../../library/readline.rst:232 msgid "" "The following functions relate to implementing a custom word completion " "function. This is typically operated by the Tab key, and can suggest and " @@ -265,7 +282,7 @@ msgid "" "custom completer, a different set of word delimiters should be set." msgstr "" -#: ../../library/readline.rst:235 +#: ../../library/readline.rst:242 msgid "" "Set or remove the completer function. If *function* is specified, it will " "be used as the new completer function; if omitted or ``None``, any completer " @@ -275,7 +292,7 @@ msgid "" "starting with *text*." msgstr "" -#: ../../library/readline.rst:242 +#: ../../library/readline.rst:249 msgid "" "The installed completer function is invoked by the *entry_func* callback " "passed to :c:func:`rl_completion_matches` in the underlying library. The " @@ -283,19 +300,19 @@ msgid "" "`rl_attempted_completion_function` callback of the underlying library." msgstr "" -#: ../../library/readline.rst:251 +#: ../../library/readline.rst:258 msgid "" "Get the completer function, or ``None`` if no completer function has been " "set." msgstr "" -#: ../../library/readline.rst:256 +#: ../../library/readline.rst:263 msgid "" "Get the type of completion being attempted. This returns the :c:data:" "`rl_completion_type` variable in the underlying library as an integer." msgstr "" -#: ../../library/readline.rst:264 +#: ../../library/readline.rst:271 msgid "" "Get the beginning or ending index of the completion scope. These indexes are " "the *start* and *end* arguments passed to the :c:data:" @@ -305,7 +322,7 @@ msgid "" "differently than libreadline." msgstr "" -#: ../../library/readline.rst:275 +#: ../../library/readline.rst:282 msgid "" "Set or get the word delimiters for completion. These determine the start of " "the word to be considered for completion (the completion scope). These " @@ -313,7 +330,7 @@ msgid "" "in the underlying library." msgstr "" -#: ../../library/readline.rst:283 +#: ../../library/readline.rst:290 msgid "" "Set or remove the completion display function. If *function* is specified, " "it will be used as the new completion display function; if omitted or " @@ -324,11 +341,11 @@ msgid "" "each time matches need to be displayed." msgstr "" -#: ../../library/readline.rst:296 +#: ../../library/readline.rst:303 msgid "Example" msgstr "範例" -#: ../../library/readline.rst:298 +#: ../../library/readline.rst:305 msgid "" "The following example demonstrates how to use the :mod:`readline` module's " "history reading and writing functions to automatically load and save a " @@ -337,7 +354,7 @@ msgid "" "sessions from the user's :envvar:`PYTHONSTARTUP` file. ::" msgstr "" -#: ../../library/readline.rst:304 +#: ../../library/readline.rst:311 msgid "" "import atexit\n" "import os\n" @@ -354,19 +371,19 @@ msgid "" "atexit.register(readline.write_history_file, histfile)" msgstr "" -#: ../../library/readline.rst:318 +#: ../../library/readline.rst:325 msgid "" "This code is actually automatically run when Python is run in :ref:" "`interactive mode ` (see :ref:`rlcompleter-config`)." msgstr "" -#: ../../library/readline.rst:321 +#: ../../library/readline.rst:328 msgid "" "The following example achieves the same goal but supports concurrent " "interactive sessions, by only appending the new history. ::" msgstr "" -#: ../../library/readline.rst:324 +#: ../../library/readline.rst:331 msgid "" "import atexit\n" "import os\n" @@ -404,13 +421,13 @@ msgstr "" " readline.append_history_file(new_h_len - prev_h_len, histfile)\n" "atexit.register(save, h_len, histfile)" -#: ../../library/readline.rst:342 +#: ../../library/readline.rst:349 msgid "" "The following example extends the :class:`code.InteractiveConsole` class to " "support history save/restore. ::" msgstr "" -#: ../../library/readline.rst:345 +#: ../../library/readline.rst:352 msgid "" "import atexit\n" "import code\n" diff --git a/library/resource.po b/library/resource.po index e87a2dccbe..f1f4e4a90c 100644 --- a/library/resource.po +++ b/library/resource.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,7 +28,8 @@ msgid "" msgstr "" #: ../../library/resource.rst:16 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +#, fuzzy +msgid ":ref:`Availability `: Unix, not WASI." msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" #: ../../library/resource.rst:18 diff --git a/library/runpy.po b/library/runpy.po index 8d10dcc661..3b338bcfc3 100644 --- a/library/runpy.po +++ b/library/runpy.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2016-11-19 00:33+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -55,7 +55,7 @@ msgstr "" #: ../../library/runpy.rst:35 msgid "" -"Execute the code of the specified module and return the resulting module " +"Execute the code of the specified module and return the resulting module's " "globals dictionary. The module's code is first located using the standard " "import mechanism (refer to :pep:`302` for details) and then executed in a " "fresh module namespace." @@ -72,19 +72,19 @@ msgstr "" #: ../../library/runpy.rst:46 msgid "" "The optional dictionary argument *init_globals* may be used to pre-populate " -"the module's globals dictionary before the code is executed. The supplied " -"dictionary will not be modified. If any of the special global variables " -"below are defined in the supplied dictionary, those definitions are " -"overridden by :func:`run_module`." +"the module's globals dictionary before the code is executed. *init_globals* " +"will not be modified. If any of the special global variables below are " +"defined in *init_globals*, those definitions are overridden by :func:" +"`run_module`." msgstr "" #: ../../library/runpy.rst:52 ../../library/runpy.rst:127 msgid "" "The special global variables ``__name__``, ``__spec__``, ``__file__``, " "``__cached__``, ``__loader__`` and ``__package__`` are set in the globals " -"dictionary before the module code is executed (Note that this is a minimal " +"dictionary before the module code is executed. (Note that this is a minimal " "set of variables - other variables may be set implicitly as an interpreter " -"implementation detail)." +"implementation detail.)" msgstr "" #: ../../library/runpy.rst:58 @@ -98,7 +98,7 @@ msgstr "" msgid "" "``__spec__`` will be set appropriately for the *actually* imported module " "(that is, ``__spec__.name`` will always be *mod_name* or ``mod_name + '." -"__main__``, never *run_name*)." +"__main__'``, never *run_name*)." msgstr "" #: ../../library/runpy.rst:66 @@ -156,11 +156,10 @@ msgstr "" #: ../../library/runpy.rst:106 msgid "" "Execute the code at the named filesystem location and return the resulting " -"module globals dictionary. As with a script name supplied to the CPython " -"command line, the supplied path may refer to a Python source file, a " -"compiled bytecode file or a valid :data:`sys.path` entry containing a :mod:" -"`__main__` module (e.g. a zipfile containing a top-level ``__main__.py`` " -"file)." +"module's globals dictionary. As with a script name supplied to the CPython " +"command line, *file_path* may refer to a Python source file, a compiled " +"bytecode file or a valid :data:`sys.path` entry containing a :mod:`__main__` " +"module (e.g. a zipfile containing a top-level :file:`__main__.py` file)." msgstr "" #: ../../library/runpy.rst:113 @@ -177,10 +176,10 @@ msgstr "" #: ../../library/runpy.rst:121 msgid "" "The optional dictionary argument *init_globals* may be used to pre-populate " -"the module's globals dictionary before the code is executed. The supplied " -"dictionary will not be modified. If any of the special global variables " -"below are defined in the supplied dictionary, those definitions are " -"overridden by :func:`run_path`." +"the module's globals dictionary before the code is executed. *init_globals* " +"will not be modified. If any of the special global variables below are " +"defined in *init_globals*, those definitions are overridden by :func:" +"`run_path`." msgstr "" #: ../../library/runpy.rst:133 @@ -191,15 +190,15 @@ msgstr "" #: ../../library/runpy.rst:136 msgid "" -"If the supplied path directly references a script file (whether as source or " -"as precompiled byte code), then ``__file__`` will be set to the supplied " -"path, and ``__spec__``, ``__cached__``, ``__loader__`` and ``__package__`` " -"will all be set to :const:`None`." +"If *file_path* directly references a script file (whether as source or as " +"precompiled byte code), then ``__file__`` will be set to *file_path*, and " +"``__spec__``, ``__cached__``, ``__loader__`` and ``__package__`` will all be " +"set to :const:`None`." msgstr "" #: ../../library/runpy.rst:141 msgid "" -"If the supplied path is a reference to a valid :data:`sys.path` entry, then " +"If *file_path* is a reference to a valid :data:`sys.path` entry, then " "``__spec__`` will be set appropriately for the imported :mod:`__main__` " "module (that is, ``__spec__.name`` will always be ``__main__``). " "``__file__``, ``__cached__``, ``__loader__`` and ``__package__`` will be :" @@ -210,7 +209,7 @@ msgstr "" msgid "" "A number of alterations are also made to the :mod:`sys` module. Firstly, :" "data:`sys.path` may be altered as described above. ``sys.argv[0]`` is " -"updated with the value of ``path_name`` and ``sys.modules[__name__]`` is " +"updated with the value of *file_path* and ``sys.modules[__name__]`` is " "updated with a temporary module object for the module being executed. All " "modifications to items in :mod:`sys` are reverted before the function " "returns." diff --git a/library/secrets.po b/library/secrets.po index 26688ee0ce..2a0d0b4b79 100644 --- a/library/secrets.po +++ b/library/secrets.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-09 14:12+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-11-30 13:42+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -78,7 +78,7 @@ msgid "Return a random int in the range [0, *exclusive_upper_bound*)." msgstr "回傳一個 [0, *exclusive_upper_bound*) 範圍之內的隨機整數。" #: ../../library/secrets.rst:55 -msgid "Return a non-negative int with *k* random bits." +msgid "Return an int with *k* random bits." msgstr "回傳一個具 *k* 個隨機位元的非負整數。" #: ../../library/secrets.rst:59 diff --git a/library/security_warnings.po b/library/security_warnings.po index 76240d9dcf..711aca08ae 100644 --- a/library/security_warnings.po +++ b/library/security_warnings.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-08-21 02:41+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,10 +34,6 @@ msgstr "" "`4648`" #: ../../library/security_warnings.rst:12 -msgid ":mod:`cgi`: :ref:`CGI security considerations `" -msgstr ":mod:`cgi`::ref:`CGI 安全性注意事項 `" - -#: ../../library/security_warnings.rst:13 msgid "" ":mod:`hashlib`: :ref:`all constructors take a \"usedforsecurity\" keyword-" "only argument disabling known insecure and blocked algorithms `" -#: ../../library/security_warnings.rst:16 +#: ../../library/security_warnings.rst:15 msgid "" ":mod:`http.server` is not suitable for production use, only implementing " "basic security checks. See the :ref:`security considerations `。" -#: ../../library/security_warnings.rst:18 +#: ../../library/security_warnings.rst:17 msgid "" ":mod:`logging`: :ref:`Logging configuration uses eval() `" msgstr ":mod:`logging`::ref:`日誌配置使用 eval() `" -#: ../../library/security_warnings.rst:20 +#: ../../library/security_warnings.rst:19 msgid "" ":mod:`multiprocessing`: :ref:`Connection.recv() uses pickle `" @@ -69,17 +65,17 @@ msgstr "" ":mod:`multiprocessing`::ref:`Connection.recv() 使用 pickle `" -#: ../../library/security_warnings.rst:22 +#: ../../library/security_warnings.rst:21 msgid ":mod:`pickle`: :ref:`Restricting globals in pickle `" msgstr ":mod:`pickle`::ref:`限制 pickle 中的全域變數 `" -#: ../../library/security_warnings.rst:23 +#: ../../library/security_warnings.rst:22 msgid "" ":mod:`random` shouldn't be used for security purposes, use :mod:`secrets` " "instead" msgstr ":mod:`random` 不該用於安全性相關用途,請改用 :mod:`secrets`" -#: ../../library/security_warnings.rst:25 +#: ../../library/security_warnings.rst:24 msgid "" ":mod:`shelve`: :ref:`shelve is based on pickle and thus unsuitable for " "dealing with untrusted sources `" @@ -87,17 +83,17 @@ msgstr "" ":mod:`shelve`::ref:`shelve 為基於 pickle,因此不適合用來處理不受信任的來源 " "`" -#: ../../library/security_warnings.rst:27 +#: ../../library/security_warnings.rst:26 msgid ":mod:`ssl`: :ref:`SSL/TLS security considerations `" msgstr ":mod:`ssl`::ref:`SSL/TLS 安全性注意事項 `" -#: ../../library/security_warnings.rst:28 +#: ../../library/security_warnings.rst:27 msgid "" ":mod:`subprocess`: :ref:`Subprocess security considerations `" msgstr ":mod:`subprocess`::ref:`子行程安全性注意事項 `" -#: ../../library/security_warnings.rst:30 +#: ../../library/security_warnings.rst:29 msgid "" ":mod:`tempfile`: :ref:`mktemp is deprecated due to vulnerability to race " "conditions `" @@ -105,11 +101,11 @@ msgstr "" ":mod:`tempfile`::ref:`mktemp 由於存在競爭條件 (race condition) 漏洞而被棄用 " "`" -#: ../../library/security_warnings.rst:32 +#: ../../library/security_warnings.rst:31 msgid ":mod:`xml`: :ref:`XML vulnerabilities `" msgstr ":mod:`xml`::ref:`XML 漏洞 `" -#: ../../library/security_warnings.rst:33 +#: ../../library/security_warnings.rst:32 msgid "" ":mod:`zipfile`: :ref:`maliciously prepared .zip files can cause disk volume " "exhaustion `" @@ -117,7 +113,7 @@ msgstr "" ":mod:`zipfile`::ref:`惡意準備的 .zip 檔案可能會導致硬碟空間耗盡 `" -#: ../../library/security_warnings.rst:36 +#: ../../library/security_warnings.rst:35 msgid "" "The :option:`-I` command line option can be used to run Python in isolated " "mode. When it cannot be used, the :option:`-P` option or the :envvar:" @@ -132,3 +128,6 @@ msgstr "" #: ../../library/security_warnings.rst:3 msgid "security considerations" msgstr "security considerations(安全性注意事項)" + +#~ msgid ":mod:`cgi`: :ref:`CGI security considerations `" +#~ msgstr ":mod:`cgi`::ref:`CGI 安全性注意事項 `" diff --git a/library/select.po b/library/select.po index bf240e3708..9c9f95c416 100644 --- a/library/select.po +++ b/library/select.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,14 +42,15 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +#, fuzzy +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:Unix。" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/selectors.po b/library/selectors.po index c627e1d333..4ef9e9b455 100644 --- a/library/selectors.po +++ b/library/selectors.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -70,14 +70,14 @@ msgid "Low-level I/O multiplexing module." msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid ":ref:`Availability `: not WASI." msgstr "" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/shutil.po b/library/shutil.po index a9177fabbc..ab9054224c 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -115,7 +115,7 @@ msgstr "" #: ../../library/shutil.rst:81 ../../library/shutil.rst:185 #: ../../library/shutil.rst:217 ../../library/shutil.rst:287 -#: ../../library/shutil.rst:390 +#: ../../library/shutil.rst:396 msgid "" "Platform-specific fast-copy syscalls may be used internally in order to copy " "the file more efficiently. See :ref:`shutil-platform-dependent-efficient-" @@ -449,33 +449,40 @@ msgstr "新增 *dir_fd* 參數。" msgid "Added the *onexc* parameter, deprecated *onerror*." msgstr "新增 *onexc* 參數並棄用 *onerror*。" -#: ../../library/shutil.rst:348 +#: ../../library/shutil.rst:346 +msgid "" +":func:`!rmtree` now ignores :exc:`FileNotFoundError` exceptions for all but " +"the top-level path. Exceptions other than :exc:`OSError` and subclasses of :" +"exc:`!OSError` are now always propagated to the caller." +msgstr "" + +#: ../../library/shutil.rst:354 msgid "" "Indicates whether the current platform and implementation provides a symlink " "attack resistant version of :func:`rmtree`. Currently this is only true for " "platforms supporting fd-based directory access functions." msgstr "" -#: ../../library/shutil.rst:357 +#: ../../library/shutil.rst:363 msgid "" "Recursively move a file or directory (*src*) to another location and return " "the destination." msgstr "" -#: ../../library/shutil.rst:360 +#: ../../library/shutil.rst:366 msgid "" "If *dst* is an existing directory or a symlink to a directory, then *src* is " "moved inside that directory. The destination path in that directory must not " "already exist." msgstr "" -#: ../../library/shutil.rst:364 +#: ../../library/shutil.rst:370 msgid "" "If *dst* already exists but is not a directory, it may be overwritten " "depending on :func:`os.rename` semantics." msgstr "" -#: ../../library/shutil.rst:367 +#: ../../library/shutil.rst:373 msgid "" "If the destination is on the current filesystem, then :func:`os.rename` is " "used. Otherwise, *src* is copied to the destination using *copy_function* " @@ -483,7 +490,7 @@ msgid "" "of *src* will be created as the destination and *src* will be removed." msgstr "" -#: ../../library/shutil.rst:372 +#: ../../library/shutil.rst:378 msgid "" "If *copy_function* is given, it must be a callable that takes two arguments, " "*src* and the destination, and will be used to copy *src* to the destination " @@ -494,7 +501,7 @@ msgid "" "copy the metadata, at the expense of not copying any of the metadata." msgstr "" -#: ../../library/shutil.rst:380 +#: ../../library/shutil.rst:386 msgid "" "Raises an :ref:`auditing event ` ``shutil.move`` with arguments " "``src``, ``dst``." @@ -502,57 +509,57 @@ msgstr "" "引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." "move``。" -#: ../../library/shutil.rst:382 +#: ../../library/shutil.rst:388 msgid "" "Added explicit symlink handling for foreign filesystems, thus adapting it to " "the behavior of GNU's :program:`mv`. Now returns *dst*." msgstr "" -#: ../../library/shutil.rst:387 +#: ../../library/shutil.rst:393 msgid "Added the *copy_function* keyword argument." msgstr "新增 *copy_function* 關鍵字引數。" -#: ../../library/shutil.rst:395 +#: ../../library/shutil.rst:401 msgid "Accepts a :term:`path-like object` for both *src* and *dst*." msgstr "" -#: ../../library/shutil.rst:400 +#: ../../library/shutil.rst:406 msgid "" "Return disk usage statistics about the given path as a :term:`named tuple` " "with the attributes *total*, *used* and *free*, which are the amount of " "total, used and free space, in bytes. *path* may be a file or a directory." msgstr "" -#: ../../library/shutil.rst:407 +#: ../../library/shutil.rst:413 msgid "" "On Unix filesystems, *path* must point to a path within a **mounted** " "filesystem partition. On those platforms, CPython doesn't attempt to " "retrieve disk usage information from non-mounted filesystems." msgstr "" -#: ../../library/shutil.rst:413 +#: ../../library/shutil.rst:419 msgid "On Windows, *path* can now be a file or directory." msgstr "" -#: ../../library/shutil.rst:416 +#: ../../library/shutil.rst:422 msgid ":ref:`Availability `: Unix, Windows." msgstr ":ref:`適用 `:Unix、Windows。" -#: ../../library/shutil.rst:420 +#: ../../library/shutil.rst:427 msgid "Change owner *user* and/or *group* of the given *path*." msgstr "" -#: ../../library/shutil.rst:422 +#: ../../library/shutil.rst:429 msgid "" "*user* can be a system user name or a uid; the same applies to *group*. At " "least one argument is required." msgstr "" -#: ../../library/shutil.rst:425 +#: ../../library/shutil.rst:432 msgid "See also :func:`os.chown`, the underlying function." msgstr "" -#: ../../library/shutil.rst:427 +#: ../../library/shutil.rst:434 msgid "" "Raises an :ref:`auditing event ` ``shutil.chown`` with arguments " "``path``, ``user``, ``group``." @@ -560,29 +567,35 @@ msgstr "" "引發一個附帶引數 ``path``、``user``、``group`` 的\\ :ref:`稽核事件 " "` ``shutil.chown``。" -#: ../../library/shutil.rst:429 +#: ../../library/shutil.rst:436 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" -#: ../../library/shutil.rst:436 +#: ../../library/shutil.rst:440 +#, fuzzy +msgid "Added *dir_fd* and *follow_symlinks* parameters." +msgstr "新增 *follow_symlinks* 引數。" + +#: ../../library/shutil.rst:446 msgid "" "Return the path to an executable which would be run if the given *cmd* was " "called. If no *cmd* would be called, return ``None``." msgstr "" -#: ../../library/shutil.rst:439 +#: ../../library/shutil.rst:449 msgid "" "*mode* is a permission mask passed to :func:`os.access`, by default " "determining if the file exists and is executable." msgstr "" -#: ../../library/shutil.rst:442 +#: ../../library/shutil.rst:452 msgid "" -"When no *path* is specified, the results of :func:`os.environ` are used, " +"*path* is a \"``PATH`` string\" specifying the lookup directory list. When " +"no *path* is specified, the results of :func:`os.environ` are used, " "returning either the \"PATH\" value or a fallback of :data:`os.defpath`." msgstr "" -#: ../../library/shutil.rst:445 +#: ../../library/shutil.rst:456 msgid "" "On Windows, the current directory is prepended to the *path* if *mode* does " "not include ``os.X_OK``. When the *mode* does include ``os.X_OK``, the " @@ -592,7 +605,7 @@ msgid "" "environment variable ``NoDefaultCurrentDirectoryInExePath``." msgstr "" -#: ../../library/shutil.rst:452 +#: ../../library/shutil.rst:463 msgid "" "Also on Windows, the ``PATHEXT`` variable is used to resolve commands that " "may not already include an extension. For example, if you call ``shutil." @@ -601,7 +614,7 @@ msgid "" "on Windows::" msgstr "" -#: ../../library/shutil.rst:458 +#: ../../library/shutil.rst:469 msgid "" ">>> shutil.which(\"python\")\n" "'C:\\\\Python33\\\\python.EXE'" @@ -609,25 +622,25 @@ msgstr "" ">>> shutil.which(\"python\")\n" "'C:\\\\Python33\\\\python.EXE'" -#: ../../library/shutil.rst:461 +#: ../../library/shutil.rst:472 msgid "" "This is also applied when *cmd* is a path that contains a directory " "component::" msgstr "" -#: ../../library/shutil.rst:464 +#: ../../library/shutil.rst:475 msgid "" ">> shutil.which(\"C:\\\\Python33\\\\python\")\n" "'C:\\\\Python33\\\\python.EXE'" msgstr "" -#: ../../library/shutil.rst:469 +#: ../../library/shutil.rst:480 msgid "" "The :class:`bytes` type is now accepted. If *cmd* type is :class:`bytes`, " "the result type is also :class:`bytes`." msgstr "" -#: ../../library/shutil.rst:473 +#: ../../library/shutil.rst:484 msgid "" "On Windows, the current directory is no longer prepended to the search path " "if *mode* includes ``os.X_OK`` and WinAPI " @@ -638,25 +651,25 @@ msgid "" "now be found." msgstr "" -#: ../../library/shutil.rst:482 +#: ../../library/shutil.rst:493 msgid "" "On Windows, if *mode* includes ``os.X_OK``, executables with an extension in " "``PATHEXT`` will be preferred over executables without a matching extension. " "This brings behavior closer to that of Python 3.11." msgstr "" -#: ../../library/shutil.rst:490 +#: ../../library/shutil.rst:501 msgid "" "This exception collects exceptions that are raised during a multi-file " "operation. For :func:`copytree`, the exception argument is a list of 3-" "tuples (*srcname*, *dstname*, *exception*)." msgstr "" -#: ../../library/shutil.rst:497 +#: ../../library/shutil.rst:508 msgid "Platform-dependent efficient copy operations" msgstr "" -#: ../../library/shutil.rst:499 +#: ../../library/shutil.rst:510 msgid "" "Starting from Python 3.8, all functions involving a file copy (:func:" "`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, and :func:" @@ -666,37 +679,37 @@ msgid "" "buffers in Python as in \"``outfd.write(infd.read())``\"." msgstr "" -#: ../../library/shutil.rst:507 +#: ../../library/shutil.rst:518 msgid "On macOS `fcopyfile`_ is used to copy the file content (not metadata)." msgstr "" -#: ../../library/shutil.rst:509 +#: ../../library/shutil.rst:520 msgid "On Linux :func:`os.sendfile` is used." msgstr "" -#: ../../library/shutil.rst:511 +#: ../../library/shutil.rst:522 msgid "" "On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " "instead of 64 KiB) and a :func:`memoryview`-based variant of :func:`shutil." "copyfileobj` is used." msgstr "" -#: ../../library/shutil.rst:515 +#: ../../library/shutil.rst:526 msgid "" "If the fast-copy operation fails and no data was written in the destination " "file then shutil will silently fallback on using less efficient :func:" "`copyfileobj` function internally." msgstr "" -#: ../../library/shutil.rst:524 +#: ../../library/shutil.rst:535 msgid "copytree example" msgstr "" -#: ../../library/shutil.rst:526 +#: ../../library/shutil.rst:537 msgid "An example that uses the :func:`ignore_patterns` helper::" msgstr "" -#: ../../library/shutil.rst:528 +#: ../../library/shutil.rst:539 msgid "" "from shutil import copytree, ignore_patterns\n" "\n" @@ -706,17 +719,17 @@ msgstr "" "\n" "copytree(source, destination, ignore=ignore_patterns('*.pyc', 'tmp*'))" -#: ../../library/shutil.rst:532 +#: ../../library/shutil.rst:543 msgid "" "This will copy everything except ``.pyc`` files and files or directories " "whose name starts with ``tmp``." msgstr "" -#: ../../library/shutil.rst:535 +#: ../../library/shutil.rst:546 msgid "Another example that uses the *ignore* argument to add a logging call::" msgstr "" -#: ../../library/shutil.rst:537 +#: ../../library/shutil.rst:548 msgid "" "from shutil import copytree\n" "import logging\n" @@ -728,11 +741,11 @@ msgid "" "copytree(source, destination, ignore=_logpath)" msgstr "" -#: ../../library/shutil.rst:550 +#: ../../library/shutil.rst:561 msgid "rmtree example" msgstr "rmtree 範例" -#: ../../library/shutil.rst:552 +#: ../../library/shutil.rst:563 msgid "" "This example shows how to remove a directory tree on Windows where some of " "the files have their read-only bit set. It uses the onexc callback to clear " @@ -740,7 +753,7 @@ msgid "" "propagate. ::" msgstr "" -#: ../../library/shutil.rst:557 +#: ../../library/shutil.rst:568 msgid "" "import os, stat\n" "import shutil\n" @@ -753,31 +766,31 @@ msgid "" "shutil.rmtree(directory, onexc=remove_readonly)" msgstr "" -#: ../../library/shutil.rst:570 +#: ../../library/shutil.rst:581 msgid "Archiving operations" msgstr "" -#: ../../library/shutil.rst:574 +#: ../../library/shutil.rst:585 msgid "Added support for the *xztar* format." msgstr "新增 *xztar* 格式的支援。" -#: ../../library/shutil.rst:578 +#: ../../library/shutil.rst:589 msgid "" "High-level utilities to create and read compressed and archived files are " "also provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules." msgstr "" -#: ../../library/shutil.rst:583 +#: ../../library/shutil.rst:594 msgid "Create an archive file (such as zip or tar) and return its name." msgstr "" -#: ../../library/shutil.rst:585 +#: ../../library/shutil.rst:596 msgid "" "*base_name* is the name of the file to create, including the path, minus any " "format-specific extension." msgstr "" -#: ../../library/shutil.rst:588 +#: ../../library/shutil.rst:599 msgid "" "*format* is the archive format: one of \"zip\" (if the :mod:`zlib` module is " "available), \"tar\", \"gztar\" (if the :mod:`zlib` module is available), " @@ -785,14 +798,14 @@ msgid "" "`lzma` module is available)." msgstr "" -#: ../../library/shutil.rst:593 +#: ../../library/shutil.rst:604 msgid "" "*root_dir* is a directory that will be the root directory of the archive, " "all paths in the archive will be relative to it; for example, we typically " "chdir into *root_dir* before creating the archive." msgstr "" -#: ../../library/shutil.rst:597 +#: ../../library/shutil.rst:608 msgid "" "*base_dir* is the directory where we start archiving from; i.e. *base_dir* " "will be the common prefix of all files and directories in the archive. " @@ -800,33 +813,33 @@ msgid "" "example-with-basedir` for how to use *base_dir* and *root_dir* together." msgstr "" -#: ../../library/shutil.rst:603 +#: ../../library/shutil.rst:614 msgid "*root_dir* and *base_dir* both default to the current directory." msgstr "" -#: ../../library/shutil.rst:605 +#: ../../library/shutil.rst:616 msgid "" "If *dry_run* is true, no archive is created, but the operations that would " "be executed are logged to *logger*." msgstr "" -#: ../../library/shutil.rst:608 +#: ../../library/shutil.rst:619 msgid "" "*owner* and *group* are used when creating a tar archive. By default, uses " "the current owner and group." msgstr "" -#: ../../library/shutil.rst:611 +#: ../../library/shutil.rst:622 msgid "" "*logger* must be an object compatible with :pep:`282`, usually an instance " "of :class:`logging.Logger`." msgstr "" -#: ../../library/shutil.rst:614 +#: ../../library/shutil.rst:625 msgid "The *verbose* argument is unused and deprecated." msgstr "" -#: ../../library/shutil.rst:616 +#: ../../library/shutil.rst:627 msgid "" "Raises an :ref:`auditing event ` ``shutil.make_archive`` with " "arguments ``base_name``, ``format``, ``root_dir``, ``base_dir``." @@ -834,7 +847,7 @@ msgstr "" "引發一個附帶引數 ``base_name``、``format``、``root_dir``、``base_dir`` 的\\ :" "ref:`稽核事件 ` ``shutil.make_archive``。" -#: ../../library/shutil.rst:620 +#: ../../library/shutil.rst:631 msgid "" "This function is not thread-safe when custom archivers registered with :func:" "`register_archive_format` do not support the *root_dir* argument. In this " @@ -842,60 +855,60 @@ msgid "" "*root_dir* to perform archiving." msgstr "" -#: ../../library/shutil.rst:626 +#: ../../library/shutil.rst:637 msgid "" "The modern pax (POSIX.1-2001) format is now used instead of the legacy GNU " "format for archives created with ``format=\"tar\"``." msgstr "" -#: ../../library/shutil.rst:630 +#: ../../library/shutil.rst:641 msgid "" "This function is now made thread-safe during creation of standard ``.zip`` " "and tar archives." msgstr "" -#: ../../library/shutil.rst:636 +#: ../../library/shutil.rst:647 msgid "" "Return a list of supported formats for archiving. Each element of the " "returned sequence is a tuple ``(name, description)``." msgstr "" -#: ../../library/shutil.rst:639 ../../library/shutil.rst:750 +#: ../../library/shutil.rst:650 ../../library/shutil.rst:761 msgid "By default :mod:`shutil` provides these formats:" msgstr "" -#: ../../library/shutil.rst:641 +#: ../../library/shutil.rst:652 msgid "*zip*: ZIP file (if the :mod:`zlib` module is available)." msgstr "" -#: ../../library/shutil.rst:642 +#: ../../library/shutil.rst:653 msgid "" "*tar*: Uncompressed tar file. Uses POSIX.1-2001 pax format for new archives." msgstr "" -#: ../../library/shutil.rst:643 ../../library/shutil.rst:755 +#: ../../library/shutil.rst:654 ../../library/shutil.rst:766 msgid "*gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available)." msgstr "" -#: ../../library/shutil.rst:644 ../../library/shutil.rst:756 +#: ../../library/shutil.rst:655 ../../library/shutil.rst:767 msgid "*bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available)." msgstr "" -#: ../../library/shutil.rst:645 ../../library/shutil.rst:757 +#: ../../library/shutil.rst:656 ../../library/shutil.rst:768 msgid "*xztar*: xz'ed tar-file (if the :mod:`lzma` module is available)." msgstr "" -#: ../../library/shutil.rst:647 +#: ../../library/shutil.rst:658 msgid "" "You can register new formats or provide your own archiver for any existing " "formats, by using :func:`register_archive_format`." msgstr "" -#: ../../library/shutil.rst:653 +#: ../../library/shutil.rst:664 msgid "Register an archiver for the format *name*." msgstr "" -#: ../../library/shutil.rst:655 +#: ../../library/shutil.rst:666 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive the *base_name* of the file to create, followed by the " @@ -904,7 +917,7 @@ msgid "" "*dry_run* and *logger* (as passed in :func:`make_archive`)." msgstr "" -#: ../../library/shutil.rst:661 +#: ../../library/shutil.rst:672 msgid "" "If *function* has the custom attribute ``function.supports_root_dir`` set to " "``True``, the *root_dir* argument is passed as a keyword argument. Otherwise " @@ -913,37 +926,37 @@ msgid "" "not thread-safe." msgstr "" -#: ../../library/shutil.rst:667 +#: ../../library/shutil.rst:678 msgid "" "If given, *extra_args* is a sequence of ``(name, value)`` pairs that will be " "used as extra keywords arguments when the archiver callable is used." msgstr "" -#: ../../library/shutil.rst:670 +#: ../../library/shutil.rst:681 msgid "" "*description* is used by :func:`get_archive_formats` which returns the list " "of archivers. Defaults to an empty string." msgstr "" -#: ../../library/shutil.rst:673 +#: ../../library/shutil.rst:684 msgid "Added support for functions supporting the *root_dir* argument." msgstr "" -#: ../../library/shutil.rst:679 +#: ../../library/shutil.rst:690 msgid "Remove the archive format *name* from the list of supported formats." msgstr "" -#: ../../library/shutil.rst:684 +#: ../../library/shutil.rst:695 msgid "Unpack an archive. *filename* is the full path of the archive." msgstr "" -#: ../../library/shutil.rst:686 +#: ../../library/shutil.rst:697 msgid "" "*extract_dir* is the name of the target directory where the archive is " "unpacked. If not provided, the current working directory is used." msgstr "" -#: ../../library/shutil.rst:689 +#: ../../library/shutil.rst:700 msgid "" "*format* is the archive format: one of \"zip\", \"tar\", \"gztar\", " "\"bztar\", or \"xztar\". Or any other format registered with :func:" @@ -952,7 +965,7 @@ msgid "" "that extension. In case none is found, a :exc:`ValueError` is raised." msgstr "" -#: ../../library/shutil.rst:696 +#: ../../library/shutil.rst:707 msgid "" "The keyword-only *filter* argument is passed to the underlying unpacking " "function. For zip files, *filter* is not accepted. For tar files, it is " @@ -962,7 +975,7 @@ msgid "" "Python 3.14." msgstr "" -#: ../../library/shutil.rst:704 +#: ../../library/shutil.rst:715 msgid "" "Raises an :ref:`auditing event ` ``shutil.unpack_archive`` with " "arguments ``filename``, ``extract_dir``, ``format``." @@ -970,7 +983,7 @@ msgstr "" "引發一個附帶引數 ``filename``、``extract_dir``、``format`` 的\\ :ref:`稽核事" "件 ` ``shutil.unpack_archive``。" -#: ../../library/shutil.rst:708 +#: ../../library/shutil.rst:719 msgid "" "Never extract archives from untrusted sources without prior inspection. It " "is possible that files are created outside of the path specified in the " @@ -978,91 +991,91 @@ msgid "" "with \"/\" or filenames with two dots \"..\"." msgstr "" -#: ../../library/shutil.rst:713 +#: ../../library/shutil.rst:724 msgid "Accepts a :term:`path-like object` for *filename* and *extract_dir*." msgstr "" -#: ../../library/shutil.rst:716 +#: ../../library/shutil.rst:727 msgid "Added the *filter* argument." msgstr "新增 *filter* 引數。" -#: ../../library/shutil.rst:721 +#: ../../library/shutil.rst:732 msgid "" "Registers an unpack format. *name* is the name of the format and " "*extensions* is a list of extensions corresponding to the format, like ``." "zip`` for Zip files." msgstr "" -#: ../../library/shutil.rst:725 +#: ../../library/shutil.rst:736 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive:" msgstr "" -#: ../../library/shutil.rst:728 +#: ../../library/shutil.rst:739 msgid "the path of the archive, as a positional argument;" msgstr "" -#: ../../library/shutil.rst:729 +#: ../../library/shutil.rst:740 msgid "" "the directory the archive must be extracted to, as a positional argument;" msgstr "" -#: ../../library/shutil.rst:730 +#: ../../library/shutil.rst:741 msgid "" "possibly a *filter* keyword argument, if it was given to :func:" "`unpack_archive`;" msgstr "" -#: ../../library/shutil.rst:732 +#: ../../library/shutil.rst:743 msgid "" "additional keyword arguments, specified by *extra_args* as a sequence of " "``(name, value)`` tuples." msgstr "" -#: ../../library/shutil.rst:735 +#: ../../library/shutil.rst:746 msgid "" "*description* can be provided to describe the format, and will be returned " "by the :func:`get_unpack_formats` function." msgstr "" -#: ../../library/shutil.rst:741 +#: ../../library/shutil.rst:752 msgid "Unregister an unpack format. *name* is the name of the format." msgstr "" -#: ../../library/shutil.rst:746 +#: ../../library/shutil.rst:757 msgid "" "Return a list of all registered formats for unpacking. Each element of the " "returned sequence is a tuple ``(name, extensions, description)``." msgstr "" -#: ../../library/shutil.rst:752 +#: ../../library/shutil.rst:763 msgid "" "*zip*: ZIP file (unpacking compressed files works only if the corresponding " "module is available)." msgstr "" -#: ../../library/shutil.rst:754 +#: ../../library/shutil.rst:765 msgid "*tar*: uncompressed tar file." msgstr "" -#: ../../library/shutil.rst:759 +#: ../../library/shutil.rst:770 msgid "" "You can register new formats or provide your own unpacker for any existing " "formats, by using :func:`register_unpack_format`." msgstr "" -#: ../../library/shutil.rst:766 +#: ../../library/shutil.rst:777 msgid "Archiving example" msgstr "" -#: ../../library/shutil.rst:768 +#: ../../library/shutil.rst:779 msgid "" "In this example, we create a gzip'ed tar-file archive containing all files " "found in the :file:`.ssh` directory of the user::" msgstr "" -#: ../../library/shutil.rst:771 +#: ../../library/shutil.rst:782 msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1072,11 +1085,11 @@ msgid "" "'/Users/tarek/myarchive.tar.gz'" msgstr "" -#: ../../library/shutil.rst:778 +#: ../../library/shutil.rst:789 msgid "The resulting archive contains:" msgstr "" -#: ../../library/shutil.rst:780 +#: ../../library/shutil.rst:791 msgid "" "$ tar -tzvf /Users/tarek/myarchive.tar.gz\n" "drwx------ tarek/staff 0 2010-02-01 16:23:40 ./\n" @@ -1098,18 +1111,18 @@ msgstr "" "-rw-r--r-- tarek/staff 397 2008-06-09 13:26:54 ./id_rsa.pub\n" "-rw-r--r-- tarek/staff 37192 2010-02-06 18:23:10 ./known_hosts" -#: ../../library/shutil.rst:796 +#: ../../library/shutil.rst:807 msgid "Archiving example with *base_dir*" msgstr "" -#: ../../library/shutil.rst:798 +#: ../../library/shutil.rst:809 msgid "" "In this example, similar to the `one above `_, we " "show how to use :func:`make_archive`, but this time with the usage of " "*base_dir*. We now have the following directory structure:" msgstr "" -#: ../../library/shutil.rst:802 +#: ../../library/shutil.rst:813 msgid "" "$ tree tmp\n" "tmp\n" @@ -1127,13 +1140,13 @@ msgstr "" " └── please_add.txt\n" " └── do_not_add.txt" -#: ../../library/shutil.rst:812 +#: ../../library/shutil.rst:823 msgid "" "In the final archive, :file:`please_add.txt` should be included, but :file:" "`do_not_add.txt` should not. Therefore we use the following::" msgstr "" -#: ../../library/shutil.rst:815 +#: ../../library/shutil.rst:826 msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1157,11 +1170,11 @@ msgstr "" "... )\n" "'/Users/tarek/my_archive.tar'" -#: ../../library/shutil.rst:826 +#: ../../library/shutil.rst:837 msgid "Listing the files in the resulting archive gives us:" msgstr "" -#: ../../library/shutil.rst:828 +#: ../../library/shutil.rst:839 msgid "" "$ python -m tarfile -l /Users/tarek/myarchive.tar\n" "structure/content/\n" @@ -1171,29 +1184,29 @@ msgstr "" "structure/content/\n" "structure/content/please_add.txt" -#: ../../library/shutil.rst:836 +#: ../../library/shutil.rst:847 msgid "Querying the size of the output terminal" msgstr "" -#: ../../library/shutil.rst:840 +#: ../../library/shutil.rst:851 msgid "Get the size of the terminal window." msgstr "" -#: ../../library/shutil.rst:842 +#: ../../library/shutil.rst:853 msgid "" "For each of the two dimensions, the environment variable, ``COLUMNS`` and " "``LINES`` respectively, is checked. If the variable is defined and the value " "is a positive integer, it is used." msgstr "" -#: ../../library/shutil.rst:846 +#: ../../library/shutil.rst:857 msgid "" "When ``COLUMNS`` or ``LINES`` is not defined, which is the common case, the " "terminal connected to :data:`sys.__stdout__` is queried by invoking :func:" "`os.get_terminal_size`." msgstr "" -#: ../../library/shutil.rst:850 +#: ../../library/shutil.rst:861 msgid "" "If the terminal size cannot be successfully queried, either because the " "system doesn't support querying, or because we are not connected to a " @@ -1202,17 +1215,17 @@ msgid "" "emulators." msgstr "" -#: ../../library/shutil.rst:856 +#: ../../library/shutil.rst:867 msgid "The value returned is a named tuple of type :class:`os.terminal_size`." msgstr "" -#: ../../library/shutil.rst:858 +#: ../../library/shutil.rst:869 msgid "" "See also: The Single UNIX Specification, Version 2, `Other Environment " "Variables`_." msgstr "" -#: ../../library/shutil.rst:863 +#: ../../library/shutil.rst:874 msgid "" "The ``fallback`` values are also used if :func:`os.get_terminal_size` " "returns zeroes." diff --git a/library/signal.po b/library/signal.po index 0533ccb814..12239bc8b0 100644 --- a/library/signal.po +++ b/library/signal.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -53,9 +53,9 @@ msgstr "" #: ../../library/signal.rst:29 msgid "" -"On WebAssembly platforms ``wasm32-emscripten`` and ``wasm32-wasi``, signals " -"are emulated and therefore behave differently. Several functions and signals " -"are not available on these platforms." +"On WebAssembly platforms, signals are emulated and therefore behave " +"differently. Several functions and signals are not available on these " +"platforms." msgstr "" #: ../../library/signal.rst:34 diff --git a/library/site.po b/library/site.po index a38f3ab8d0..89fbfeb209 100644 --- a/library/site.po +++ b/library/site.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -55,18 +55,27 @@ msgid "" "It starts by constructing up to four directories from a head and a tail " "part. For the head part, it uses ``sys.prefix`` and ``sys.exec_prefix``; " "empty heads are skipped. For the tail part, it uses the empty string and " -"then :file:`lib/site-packages` (on Windows) or :file:`lib/python{X.Y}/site-" -"packages` (on Unix and macOS). For each of the distinct head-tail " +"then :file:`lib/site-packages` (on Windows) or :file:`lib/python{X.Y[t]}/" +"site-packages` (on Unix and macOS). (The optional suffix \"t\" indicates " +"the :term:`free threading` build, and is appended if ``\"t\"`` is present in " +"the :attr:`sys.abiflags` constant.) For each of the distinct head-tail " "combinations, it sees if it refers to an existing directory, and if so, adds " "it to ``sys.path`` and also inspects the newly added path for configuration " "files." msgstr "" -#: ../../library/site.rst:41 +#: ../../library/site.rst:44 msgid "Support for the \"site-python\" directory has been removed." msgstr "" -#: ../../library/site.rst:44 +#: ../../library/site.rst:47 +msgid "" +"On Unix, :term:`Free threading ` Python installations are " +"identified by the \"t\" suffix in the version-specific directory name, such " +"as :file:`lib/python3.13t/`." +msgstr "" + +#: ../../library/site.rst:52 msgid "" "If a file named \"pyvenv.cfg\" exists one directory above sys.executable, " "sys.prefix and sys.exec_prefix are set to that directory and it is also " @@ -78,7 +87,7 @@ msgid "" "will." msgstr "" -#: ../../library/site.rst:57 +#: ../../library/site.rst:65 msgid "" "A path configuration file is a file whose name has the form :file:`{name}." "pth` and exists in one of the four directories mentioned above; its contents " @@ -90,7 +99,7 @@ msgid "" "executed." msgstr "" -#: ../../library/site.rst:67 +#: ../../library/site.rst:75 msgid "" "An executable line in a :file:`.pth` file is run at every Python startup, " "regardless of whether a particular module is actually going to be used. Its " @@ -102,7 +111,13 @@ msgid "" "putting anything more complex here." msgstr "" -#: ../../library/site.rst:82 +#: ../../library/site.rst:86 +msgid "" +"The :file:`.pth` files are now decoded by UTF-8 at first and then by the :" +"term:`locale encoding` if it fails." +msgstr "" + +#: ../../library/site.rst:94 msgid "" "For example, suppose ``sys.prefix`` and ``sys.exec_prefix`` are set to :file:" "`/usr/local`. The Python X.Y library is then installed in :file:`/usr/local/" @@ -112,7 +127,7 @@ msgid "" "and :file:`bar.pth`. Assume :file:`foo.pth` contains the following::" msgstr "" -#: ../../library/site.rst:90 +#: ../../library/site.rst:102 msgid "" "# foo package configuration\n" "\n" @@ -121,24 +136,24 @@ msgid "" "bletch" msgstr "" -#: ../../library/site.rst:96 +#: ../../library/site.rst:108 msgid "and :file:`bar.pth` contains::" msgstr "" -#: ../../library/site.rst:98 +#: ../../library/site.rst:110 msgid "" "# bar package configuration\n" "\n" "bar" msgstr "" -#: ../../library/site.rst:102 +#: ../../library/site.rst:114 msgid "" "Then the following version-specific directories are added to ``sys.path``, " "in this order::" msgstr "" -#: ../../library/site.rst:105 +#: ../../library/site.rst:117 msgid "" "/usr/local/lib/pythonX.Y/site-packages/bar\n" "/usr/local/lib/pythonX.Y/site-packages/foo" @@ -146,7 +161,7 @@ msgstr "" "/usr/local/lib/pythonX.Y/site-packages/bar\n" "/usr/local/lib/pythonX.Y/site-packages/foo" -#: ../../library/site.rst:108 +#: ../../library/site.rst:120 msgid "" "Note that :file:`bletch` is omitted because it doesn't exist; the :file:" "`bar` directory precedes the :file:`foo` directory because :file:`bar.pth` " @@ -154,11 +169,11 @@ msgid "" "because it is not mentioned in either path configuration file." msgstr "" -#: ../../library/site.rst:114 +#: ../../library/site.rst:126 msgid ":mod:`sitecustomize`" msgstr ":mod:`sitecustomize`" -#: ../../library/site.rst:118 +#: ../../library/site.rst:130 msgid "" "After these path manipulations, an attempt is made to import a module named :" "mod:`sitecustomize`, which can perform arbitrary site-specific " @@ -172,11 +187,11 @@ msgid "" "mysterious failure of the process." msgstr "" -#: ../../library/site.rst:130 +#: ../../library/site.rst:142 msgid ":mod:`usercustomize`" msgstr ":mod:`usercustomize`" -#: ../../library/site.rst:134 +#: ../../library/site.rst:146 msgid "" "After this, an attempt is made to import a module named :mod:" "`usercustomize`, which can perform arbitrary user-specific customizations, " @@ -188,18 +203,18 @@ msgid "" "ignored." msgstr "" -#: ../../library/site.rst:142 +#: ../../library/site.rst:154 msgid "" "Note that for some non-Unix systems, ``sys.prefix`` and ``sys.exec_prefix`` " "are empty, and the path manipulations are skipped; however the import of :" "mod:`sitecustomize` and :mod:`usercustomize` is still attempted." msgstr "" -#: ../../library/site.rst:151 +#: ../../library/site.rst:163 msgid "Readline configuration" msgstr "" -#: ../../library/site.rst:153 +#: ../../library/site.rst:165 msgid "" "On systems that support :mod:`readline`, this module will also import and " "configure the :mod:`rlcompleter` module, if Python is started in :ref:" @@ -211,19 +226,19 @@ msgid "" "`PYTHONSTARTUP` file." msgstr "" -#: ../../library/site.rst:162 +#: ../../library/site.rst:174 msgid "Activation of rlcompleter and history was made automatic." msgstr "" -#: ../../library/site.rst:167 +#: ../../library/site.rst:179 msgid "Module contents" msgstr "模組內容" -#: ../../library/site.rst:171 +#: ../../library/site.rst:183 msgid "A list of prefixes for site-packages directories." msgstr "" -#: ../../library/site.rst:176 +#: ../../library/site.rst:188 msgid "" "Flag showing the status of the user site-packages directory. ``True`` means " "that it is enabled and was added to ``sys.path``. ``False`` means that it " @@ -232,18 +247,19 @@ msgid "" "(mismatch between user or group id and effective id) or by an administrator." msgstr "" -#: ../../library/site.rst:186 +#: ../../library/site.rst:198 msgid "" "Path to the user site-packages for the running Python. Can be ``None`` if :" "func:`getusersitepackages` hasn't been called yet. Default value is :file:" -"`~/.local/lib/python{X.Y}/site-packages` for UNIX and non-framework macOS " +"`~/.local/lib/python{X.Y}[t]/site-packages` for UNIX and non-framework macOS " "builds, :file:`~/Library/Python/{X.Y}/lib/python/site-packages` for macOS " "framework builds, and :file:`{%APPDATA%}\\\\Python\\\\Python{XY}\\\\site-" -"packages` on Windows. This directory is a site directory, which means that :" -"file:`.pth` files in it will be processed." +"packages` on Windows. The optional \"t\" indicates the free-threaded " +"build. This directory is a site directory, which means that :file:`.pth` " +"files in it will be processed." msgstr "" -#: ../../library/site.rst:197 +#: ../../library/site.rst:210 msgid "" "Path to the base directory for the user site-packages. Can be ``None`` if :" "func:`getuserbase` hasn't been called yet. Default value is :file:`~/." @@ -254,35 +270,35 @@ msgid "" "scheme `. See also :envvar:`PYTHONUSERBASE`." msgstr "" -#: ../../library/site.rst:209 +#: ../../library/site.rst:222 msgid "" "Adds all the standard site-specific directories to the module search path. " "This function is called automatically when this module is imported, unless " "the Python interpreter was started with the :option:`-S` flag." msgstr "" -#: ../../library/site.rst:213 +#: ../../library/site.rst:226 msgid "This function used to be called unconditionally." msgstr "" -#: ../../library/site.rst:219 +#: ../../library/site.rst:232 msgid "" "Add a directory to sys.path and process its :file:`.pth` files. Typically " "used in :mod:`sitecustomize` or :mod:`usercustomize` (see above)." msgstr "" -#: ../../library/site.rst:225 +#: ../../library/site.rst:238 msgid "Return a list containing all global site-packages directories." msgstr "" -#: ../../library/site.rst:232 +#: ../../library/site.rst:245 msgid "" "Return the path of the user base directory, :data:`USER_BASE`. If it is not " "initialized yet, this function will also set it, respecting :envvar:" "`PYTHONUSERBASE`." msgstr "" -#: ../../library/site.rst:241 +#: ../../library/site.rst:254 msgid "" "Return the path of the user-specific site-packages directory, :data:" "`USER_SITE`. If it is not initialized yet, this function will also set it, " @@ -290,17 +306,17 @@ msgid "" "packages was added to ``sys.path`` :data:`ENABLE_USER_SITE` should be used." msgstr "" -#: ../../library/site.rst:253 +#: ../../library/site.rst:266 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/site.rst:257 +#: ../../library/site.rst:270 msgid "" "The :mod:`site` module also provides a way to get the user directories from " "the command line:" msgstr "" -#: ../../library/site.rst:260 +#: ../../library/site.rst:273 msgid "" "$ python -m site --user-site\n" "/home/user/.local/lib/python3.11/site-packages" @@ -308,7 +324,7 @@ msgstr "" "$ python -m site --user-site\n" "/home/user/.local/lib/python3.11/site-packages" -#: ../../library/site.rst:265 +#: ../../library/site.rst:278 msgid "" "If it is called without arguments, it will print the contents of :data:`sys." "path` on the standard output, followed by the value of :data:`USER_BASE` and " @@ -316,21 +332,21 @@ msgid "" "finally the value of :data:`ENABLE_USER_SITE`." msgstr "" -#: ../../library/site.rst:272 +#: ../../library/site.rst:285 msgid "Print the path to the user base directory." msgstr "" -#: ../../library/site.rst:276 +#: ../../library/site.rst:289 msgid "Print the path to the user site-packages directory." msgstr "" -#: ../../library/site.rst:278 +#: ../../library/site.rst:291 msgid "" "If both options are given, user base and user site will be printed (always " "in this order), separated by :data:`os.pathsep`." msgstr "" -#: ../../library/site.rst:281 +#: ../../library/site.rst:294 msgid "" "If any option is given, the script will exit with one of these values: ``0`` " "if the user site-packages directory is enabled, ``1`` if it was disabled by " @@ -338,11 +354,11 @@ msgid "" "administrator, and a value greater than 2 if there is an error." msgstr "" -#: ../../library/site.rst:288 +#: ../../library/site.rst:301 msgid ":pep:`370` -- Per user site-packages directory" msgstr "" -#: ../../library/site.rst:289 +#: ../../library/site.rst:302 msgid ":ref:`sys-path-init` -- The initialization of :data:`sys.path`." msgstr "" @@ -354,7 +370,7 @@ msgstr "module(模組)" msgid "search" msgstr "search(搜尋)" -#: ../../library/site.rst:16 ../../library/site.rst:78 +#: ../../library/site.rst:16 ../../library/site.rst:90 msgid "path" msgstr "path(路徑)" @@ -366,30 +382,30 @@ msgstr "site-packages" msgid "directory" msgstr "directory(目錄)" -#: ../../library/site.rst:53 +#: ../../library/site.rst:61 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/site.rst:53 +#: ../../library/site.rst:61 msgid "comment" msgstr "comment(註解)" -#: ../../library/site.rst:53 +#: ../../library/site.rst:61 msgid "statement" msgstr "statement(陳述式)" -#: ../../library/site.rst:53 +#: ../../library/site.rst:61 msgid "import" msgstr "import(引入)" -#: ../../library/site.rst:78 +#: ../../library/site.rst:90 msgid "package" msgstr "package(套件)" -#: ../../library/site.rst:78 +#: ../../library/site.rst:90 msgid "configuration" msgstr "configuration(設定)" -#: ../../library/site.rst:78 +#: ../../library/site.rst:90 msgid "file" msgstr "file(檔案)" diff --git a/library/smtplib.po b/library/smtplib.po index b023cde473..1f438f383e 100644 --- a/library/smtplib.po +++ b/library/smtplib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,14 +35,14 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid ":ref:`Availability `: not WASI." msgstr "" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/socket.po b/library/socket.po index 71021479c9..d365183971 100644 --- a/library/socket.po +++ b/library/socket.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -38,15 +38,23 @@ msgid "" "operating system socket APIs." msgstr "" -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr ":ref:`適用 `:非 Emscripten、非 WASI。" +#: ../../library/socket.rst:709 ../../library/socket.rst:994 +#: ../../library/socket.rst:1010 ../../library/socket.rst:1023 +#: ../../library/socket.rst:1038 ../../library/socket.rst:1055 +#: ../../library/socket.rst:1066 ../../library/socket.rst:1077 +#: ../../library/socket.rst:1088 ../../library/socket.rst:1412 +#: ../../library/socket.rst:1459 ../../library/socket.rst:1473 +#: ../../library/socket.rst:1493 ../../library/socket.rst:1540 +#: ../../library/socket.rst:1585 ../../library/socket.rst:1969 +#: ../../library/socket.rst:1979 ../../includes/wasm-notavail.rst:3 +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" @@ -112,8 +120,8 @@ msgid "" "Previously, :const:`AF_UNIX` socket paths were assumed to use UTF-8 encoding." msgstr "" -#: ../../library/socket.rst:66 ../../library/socket.rst:1155 -#: ../../library/socket.rst:1197 ../../library/socket.rst:1958 +#: ../../library/socket.rst:66 ../../library/socket.rst:1160 +#: ../../library/socket.rst:1202 ../../library/socket.rst:1963 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" @@ -287,8 +295,8 @@ msgstr "" msgid "*feat* and *mask* are unsigned 32bit integers." msgstr "" -#: ../../library/socket.rst:171 ../../library/socket.rst:589 -#: ../../library/socket.rst:1880 +#: ../../library/socket.rst:171 ../../library/socket.rst:594 +#: ../../library/socket.rst:1885 msgid ":ref:`Availability `: Linux >= 2.6.38." msgstr ":ref:`適用 `:Linux >= 2.6.38。" @@ -303,7 +311,7 @@ msgid "" "context ID or CID and port are integers." msgstr "" -#: ../../library/socket.rst:181 ../../library/socket.rst:662 +#: ../../library/socket.rst:181 ../../library/socket.rst:667 msgid ":ref:`Availability `: Linux >= 3.9" msgstr ":ref:`適用 `:Linux 3.9 以上。" @@ -368,7 +376,7 @@ msgid "" "address, whose interpretation depends on the device." msgstr "" -#: ../../library/socket.rst:209 ../../library/socket.rst:537 +#: ../../library/socket.rst:209 ../../library/socket.rst:542 msgid ":ref:`Availability `: Linux >= 2.2." msgstr ":ref:`適用 `:Linux >= 2.2。" @@ -380,7 +388,7 @@ msgid "" "*port* are non-negative integers." msgstr "" -#: ../../library/socket.rst:216 ../../library/socket.rst:638 +#: ../../library/socket.rst:216 ../../library/socket.rst:643 msgid ":ref:`Availability `: Linux >= 4.7." msgstr ":ref:`適用 `:Linux >= 4.7。" @@ -652,166 +660,173 @@ msgid "" "``IP_DROP_SOURCE_MEMBERSHIP``." msgstr "" -#: ../../library/socket.rst:453 ../../library/socket.rst:534 -#: ../../library/socket.rst:558 +#: ../../library/socket.rst:448 +msgid "" +"Added ``SO_BINDTOIFINDEX``. On Linux this constant can be used in the same " +"way that ``SO_BINDTODEVICE`` is used, but with the index of a network " +"interface instead of its name." +msgstr "" + +#: ../../library/socket.rst:458 ../../library/socket.rst:539 +#: ../../library/socket.rst:563 msgid "" "Many constants of these forms, documented in the Linux documentation, are " "also defined in the socket module." msgstr "" -#: ../../library/socket.rst:456 +#: ../../library/socket.rst:461 msgid ":ref:`Availability `: Linux >= 2.6.25, NetBSD >= 8." msgstr ":ref:`適用 `:Linux 2.6.25 以上、NetBSD 8 以上。" -#: ../../library/socket.rst:460 +#: ../../library/socket.rst:465 msgid "NetBSD support was added." msgstr "" -#: ../../library/socket.rst:466 +#: ../../library/socket.rst:471 msgid "" "CAN_BCM, in the CAN protocol family, is the broadcast manager (BCM) " "protocol. Broadcast manager constants, documented in the Linux " "documentation, are also defined in the socket module." msgstr "" -#: ../../library/socket.rst:470 ../../library/socket.rst:505 +#: ../../library/socket.rst:475 ../../library/socket.rst:510 msgid ":ref:`Availability `: Linux >= 2.6.25." msgstr ":ref:`適用 `:Linux >= 2.6.25。" -#: ../../library/socket.rst:473 +#: ../../library/socket.rst:478 msgid "" "The :data:`CAN_BCM_CAN_FD_FRAME` flag is only available on Linux >= 4.8." msgstr "" -#: ../../library/socket.rst:479 +#: ../../library/socket.rst:484 msgid "" "Enables CAN FD support in a CAN_RAW socket. This is disabled by default. " "This allows your application to send both CAN and CAN FD frames; however, " "you must accept both CAN and CAN FD frames when reading from the socket." msgstr "" -#: ../../library/socket.rst:483 ../../library/socket.rst:494 +#: ../../library/socket.rst:488 ../../library/socket.rst:499 msgid "This constant is documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:485 +#: ../../library/socket.rst:490 msgid ":ref:`Availability `: Linux >= 3.6." msgstr ":ref:`適用 `:Linux >= 3.6。" -#: ../../library/socket.rst:491 +#: ../../library/socket.rst:496 msgid "" "Joins the applied CAN filters such that only CAN frames that match all given " "CAN filters are passed to user space." msgstr "" -#: ../../library/socket.rst:496 +#: ../../library/socket.rst:501 msgid ":ref:`Availability `: Linux >= 4.1." msgstr ":ref:`適用 `:Linux >= 4.1。" -#: ../../library/socket.rst:502 +#: ../../library/socket.rst:507 msgid "" "CAN_ISOTP, in the CAN protocol family, is the ISO-TP (ISO 15765-2) protocol. " "ISO-TP constants, documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:511 +#: ../../library/socket.rst:516 msgid "" "CAN_J1939, in the CAN protocol family, is the SAE J1939 protocol. J1939 " "constants, documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:514 +#: ../../library/socket.rst:519 msgid ":ref:`Availability `: Linux >= 5.4." msgstr ":ref:`適用 `:Linux >= 5.4。" -#: ../../library/socket.rst:522 +#: ../../library/socket.rst:527 msgid "" "These two constants, documented in the FreeBSD divert(4) manual page, are " "also defined in the socket module." msgstr "" -#: ../../library/socket.rst:525 +#: ../../library/socket.rst:530 msgid ":ref:`Availability `: FreeBSD >= 14.0." msgstr ":ref:`適用 `:FreeBSD >= 14.0。" -#: ../../library/socket.rst:542 +#: ../../library/socket.rst:547 msgid "" ":data:`!ETH_P_ALL` can be used in the :class:`~socket.socket` constructor as " "*proto* for the :const:`AF_PACKET` family in order to capture every packet, " "regardless of protocol." msgstr "" -#: ../../library/socket.rst:546 +#: ../../library/socket.rst:551 msgid "For more information, see the :manpage:`packet(7)` manpage." msgstr "" -#: ../../library/socket.rst:548 +#: ../../library/socket.rst:553 msgid ":ref:`Availability `: Linux." msgstr ":ref:`適用 `:Linux。" -#: ../../library/socket.rst:561 +#: ../../library/socket.rst:566 msgid ":ref:`Availability `: Linux >= 2.6.30." msgstr ":ref:`適用 `:Linux >= 2.6.30。" -#: ../../library/socket.rst:571 +#: ../../library/socket.rst:576 msgid "" "Constants for Windows' WSAIoctl(). The constants are used as arguments to " "the :meth:`~socket.socket.ioctl` method of socket objects." msgstr "" -#: ../../library/socket.rst:574 ../../library/socket.rst:1570 +#: ../../library/socket.rst:579 ../../library/socket.rst:1575 msgid "``SIO_LOOPBACK_FAST_PATH`` was added." msgstr "加入 ``SIO_LOOPBACK_FAST_PATH``。" -#: ../../library/socket.rst:580 +#: ../../library/socket.rst:585 msgid "" "TIPC related constants, matching the ones exported by the C socket API. See " "the TIPC documentation for more information." msgstr "" -#: ../../library/socket.rst:587 +#: ../../library/socket.rst:592 msgid "Constants for Linux Kernel cryptography." msgstr "" -#: ../../library/socket.rst:599 +#: ../../library/socket.rst:604 msgid "Constants for Linux host/guest communication." msgstr "" -#: ../../library/socket.rst:601 +#: ../../library/socket.rst:606 msgid ":ref:`Availability `: Linux >= 4.8." msgstr ":ref:`適用 `:Linux >= 4.8。" -#: ../../library/socket.rst:607 +#: ../../library/socket.rst:612 msgid ":ref:`Availability `: BSD, macOS." msgstr ":ref:`適用 `:BSD、macOS。" -#: ../../library/socket.rst:613 +#: ../../library/socket.rst:618 msgid "" "This constant contains a boolean value which indicates if IPv6 is supported " "on this platform." msgstr "" -#: ../../library/socket.rst:619 +#: ../../library/socket.rst:624 msgid "" "These are string constants containing Bluetooth addresses with special " "meanings. For example, :const:`BDADDR_ANY` can be used to indicate any " "address when specifying the binding socket with :const:`BTPROTO_RFCOMM`." msgstr "" -#: ../../library/socket.rst:628 +#: ../../library/socket.rst:633 msgid "" "For use with :const:`BTPROTO_HCI`. :const:`HCI_FILTER` is not available for " "NetBSD or DragonFlyBSD. :const:`HCI_TIME_STAMP` and :const:`HCI_DATA_DIR` " "are not available for FreeBSD, NetBSD, or DragonFlyBSD." msgstr "" -#: ../../library/socket.rst:635 +#: ../../library/socket.rst:640 msgid "" "Constant for Qualcomm's IPC router protocol, used to communicate with " "service providing remote processors." msgstr "" -#: ../../library/socket.rst:644 +#: ../../library/socket.rst:649 msgid "" "LOCAL_CREDS and LOCAL_CREDS_PERSISTENT can be used with SOCK_DGRAM, " "SOCK_STREAM sockets, equivalent to Linux/DragonFlyBSD SO_PASSCRED, while " @@ -820,67 +835,55 @@ msgid "" "message type." msgstr "" -#: ../../library/socket.rst:653 +#: ../../library/socket.rst:658 msgid ":ref:`Availability `: FreeBSD." msgstr ":ref:`適用 `:FreeBSD。" -#: ../../library/socket.rst:657 +#: ../../library/socket.rst:662 msgid "" "Constant to optimize CPU locality, to be used in conjunction with :data:" "`SO_REUSEPORT`." msgstr "" -#: ../../library/socket.rst:677 +#: ../../library/socket.rst:682 msgid "Constants for Windows Hyper-V sockets for host/guest communications." msgstr "" -#: ../../library/socket.rst:679 ../../library/socket.rst:893 -#: ../../library/socket.rst:1986 +#: ../../library/socket.rst:684 ../../library/socket.rst:898 +#: ../../library/socket.rst:1991 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/socket.rst:690 +#: ../../library/socket.rst:695 msgid "" "`IEEE 802.3 protocol number `_. constants." msgstr "" -#: ../../library/socket.rst:694 +#: ../../library/socket.rst:699 msgid ":ref:`Availability `: Linux, FreeBSD, macOS." msgstr ":ref:`適用 `:Linux、FreeBSD、macOS。" -#: ../../library/socket.rst:702 +#: ../../library/socket.rst:707 msgid "" "These constants are used by the :meth:`~socket.socket.shutdown` method of " "socket objects." msgstr "" -#: ../../library/socket.rst:704 ../../library/socket.rst:989 -#: ../../library/socket.rst:1005 ../../library/socket.rst:1018 -#: ../../library/socket.rst:1033 ../../library/socket.rst:1050 -#: ../../library/socket.rst:1061 ../../library/socket.rst:1072 -#: ../../library/socket.rst:1083 ../../library/socket.rst:1407 -#: ../../library/socket.rst:1454 ../../library/socket.rst:1468 -#: ../../library/socket.rst:1488 ../../library/socket.rst:1535 -#: ../../library/socket.rst:1580 ../../library/socket.rst:1964 -#: ../../library/socket.rst:1974 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" - -#: ../../library/socket.rst:707 +#: ../../library/socket.rst:712 msgid "Functions" msgstr "函式" -#: ../../library/socket.rst:710 +#: ../../library/socket.rst:715 msgid "Creating sockets" msgstr "建立 sockets" -#: ../../library/socket.rst:712 +#: ../../library/socket.rst:717 msgid "" "The following functions all create :ref:`socket objects `." msgstr "" -#: ../../library/socket.rst:717 +#: ../../library/socket.rst:722 msgid "" "Create a new socket using the given address family, socket type and protocol " "number. The address family should be :const:`AF_INET` (the default), :const:" @@ -893,7 +896,7 @@ msgid "" "`CAN_J1939`." msgstr "" -#: ../../library/socket.rst:727 +#: ../../library/socket.rst:732 msgid "" "If *fileno* is specified, the values for *family*, *type*, and *proto* are " "auto-detected from the specified file descriptor. Auto-detection can be " @@ -904,12 +907,12 @@ msgid "" "This may help close a detached socket using :meth:`socket.close`." msgstr "" -#: ../../library/socket.rst:736 ../../library/socket.rst:882 -#: ../../library/socket.rst:1389 ../../library/socket.rst:1483 +#: ../../library/socket.rst:741 ../../library/socket.rst:887 +#: ../../library/socket.rst:1394 ../../library/socket.rst:1488 msgid "The newly created socket is :ref:`non-inheritable `." msgstr "" -#: ../../library/socket.rst:738 +#: ../../library/socket.rst:743 msgid "" "Raises an :ref:`auditing event ` ``socket.__new__`` with arguments " "``self``, ``family``, ``type``, ``protocol``." @@ -917,30 +920,30 @@ msgstr "" "引發一個附帶引數 ``self``、``family``、``type``、``protocol`` 的\\ :ref:`稽核" "事件 ` ``socket.__new__``。" -#: ../../library/socket.rst:740 +#: ../../library/socket.rst:745 msgid "The AF_CAN family was added. The AF_RDS family was added." msgstr "" -#: ../../library/socket.rst:744 +#: ../../library/socket.rst:749 msgid "The CAN_BCM protocol was added." msgstr "新增 CAN_BCM 協定。" -#: ../../library/socket.rst:747 ../../library/socket.rst:884 +#: ../../library/socket.rst:752 ../../library/socket.rst:889 msgid "The returned socket is now non-inheritable." msgstr "" -#: ../../library/socket.rst:750 +#: ../../library/socket.rst:755 msgid "The CAN_ISOTP protocol was added." msgstr "新增 CAN_ISOTP 協定。" -#: ../../library/socket.rst:753 +#: ../../library/socket.rst:758 msgid "" "When :const:`SOCK_NONBLOCK` or :const:`SOCK_CLOEXEC` bit flags are applied " "to *type* they are cleared, and :attr:`socket.type` will not reflect them. " "They are still passed to the underlying system ``socket()`` call. Therefore," msgstr "" -#: ../../library/socket.rst:761 +#: ../../library/socket.rst:766 msgid "" "sock = socket.socket(\n" " socket.AF_INET,\n" @@ -950,21 +953,21 @@ msgstr "" " socket.AF_INET,\n" " socket.SOCK_STREAM | socket.SOCK_NONBLOCK)" -#: ../../library/socket.rst:765 +#: ../../library/socket.rst:770 msgid "" "will still create a non-blocking socket on OSes that support " "``SOCK_NONBLOCK``, but ``sock.type`` will be set to ``socket.SOCK_STREAM``." msgstr "" -#: ../../library/socket.rst:769 +#: ../../library/socket.rst:774 msgid "The CAN_J1939 protocol was added." msgstr "新增 CAN_J1939 協定。" -#: ../../library/socket.rst:772 +#: ../../library/socket.rst:777 msgid "The IPPROTO_MPTCP protocol was added." msgstr "新增 IPPROTO_MPTCP 協定。" -#: ../../library/socket.rst:777 +#: ../../library/socket.rst:782 msgid "" "Build a pair of connected socket objects using the given address family, " "socket type, and protocol number. Address family, socket type, and protocol " @@ -973,25 +976,25 @@ msgid "" "default is :const:`AF_INET`." msgstr "" -#: ../../library/socket.rst:782 +#: ../../library/socket.rst:787 msgid "The newly created sockets are :ref:`non-inheritable `." msgstr "" -#: ../../library/socket.rst:784 +#: ../../library/socket.rst:789 msgid "" "The returned socket objects now support the whole socket API, rather than a " "subset." msgstr "" -#: ../../library/socket.rst:788 +#: ../../library/socket.rst:793 msgid "The returned sockets are now non-inheritable." msgstr "" -#: ../../library/socket.rst:791 +#: ../../library/socket.rst:796 msgid "Windows support added." msgstr "新增對 Windows 的支援。" -#: ../../library/socket.rst:797 +#: ../../library/socket.rst:802 msgid "" "Connect to a TCP service listening on the internet *address* (a 2-tuple " "``(host, port)``), and return the socket object. This is a higher-level " @@ -1002,21 +1005,21 @@ msgid "" "IPv4 and IPv6." msgstr "" -#: ../../library/socket.rst:805 +#: ../../library/socket.rst:810 msgid "" "Passing the optional *timeout* parameter will set the timeout on the socket " "instance before attempting to connect. If no *timeout* is supplied, the " "global default timeout setting returned by :func:`getdefaulttimeout` is used." msgstr "" -#: ../../library/socket.rst:810 +#: ../../library/socket.rst:815 msgid "" "If supplied, *source_address* must be a 2-tuple ``(host, port)`` for the " "socket to bind to as its source address before connecting. If host or port " "are '' or 0 respectively the OS default behavior will be used." msgstr "" -#: ../../library/socket.rst:814 +#: ../../library/socket.rst:819 msgid "" "When a connection cannot be created, an exception is raised. By default, it " "is the exception from the last address in the list. If *all_errors* is " @@ -1024,21 +1027,21 @@ msgid "" "attempts." msgstr "" -#: ../../library/socket.rst:819 +#: ../../library/socket.rst:824 msgid "*source_address* was added." msgstr "新增 *source_address*。" -#: ../../library/socket.rst:822 +#: ../../library/socket.rst:827 msgid "*all_errors* was added." msgstr "新增 *all_errors*。" -#: ../../library/socket.rst:828 +#: ../../library/socket.rst:833 msgid "" "Convenience function which creates a TCP socket bound to *address* (a 2-" "tuple ``(host, port)``) and returns the socket object." msgstr "" -#: ../../library/socket.rst:831 +#: ../../library/socket.rst:836 msgid "" "*family* should be either :data:`AF_INET` or :data:`AF_INET6`. *backlog* is " "the queue size passed to :meth:`socket.listen`; if not specified , a default " @@ -1046,7 +1049,7 @@ msgid "" "`SO_REUSEPORT` socket option." msgstr "" -#: ../../library/socket.rst:836 +#: ../../library/socket.rst:841 msgid "" "If *dualstack_ipv6* is true and the platform supports it the socket will be " "able to accept both IPv4 and IPv6 connections, else it will raise :exc:" @@ -1059,7 +1062,7 @@ msgid "" "func:`has_dualstack_ipv6`:" msgstr "" -#: ../../library/socket.rst:849 +#: ../../library/socket.rst:854 msgid "" "import socket\n" "\n" @@ -1079,20 +1082,20 @@ msgstr "" "else:\n" " s = socket.create_server(addr)" -#: ../../library/socket.rst:858 +#: ../../library/socket.rst:863 msgid "" "On POSIX platforms the :data:`SO_REUSEADDR` socket option is set in order to " "immediately reuse previous sockets which were bound on the same *address* " "and remained in TIME_WAIT state." msgstr "" -#: ../../library/socket.rst:866 +#: ../../library/socket.rst:871 msgid "" "Return ``True`` if the platform supports creating a TCP socket which can " "handle both IPv4 and IPv6 connections." msgstr "" -#: ../../library/socket.rst:873 +#: ../../library/socket.rst:878 msgid "" "Duplicate the file descriptor *fd* (an integer as returned by a file " "object's :meth:`~io.IOBase.fileno` method) and build a socket object from " @@ -1105,34 +1108,34 @@ msgid "" "daemon). The socket is assumed to be in blocking mode." msgstr "" -#: ../../library/socket.rst:890 +#: ../../library/socket.rst:895 msgid "" "Instantiate a socket from data obtained from the :meth:`socket.share` " "method. The socket is assumed to be in blocking mode." msgstr "" -#: ../../library/socket.rst:900 +#: ../../library/socket.rst:905 msgid "" "This is a Python type object that represents the socket object type. It is " "the same as ``type(socket(...))``." msgstr "" -#: ../../library/socket.rst:905 +#: ../../library/socket.rst:910 msgid "Other functions" msgstr "其他函式" -#: ../../library/socket.rst:907 +#: ../../library/socket.rst:912 msgid "The :mod:`socket` module also offers various network-related services:" msgstr "" -#: ../../library/socket.rst:912 +#: ../../library/socket.rst:917 msgid "" "Close a socket file descriptor. This is like :func:`os.close`, but for " "sockets. On some platforms (most noticeable Windows) :func:`os.close` does " "not work for socket file descriptors." msgstr "" -#: ../../library/socket.rst:920 +#: ../../library/socket.rst:925 msgid "" "Translate the *host*/*port* argument into a sequence of 5-tuples that " "contain all the necessary arguments for creating a socket connected to that " @@ -1142,7 +1145,7 @@ msgid "" "and *port*, you can pass ``NULL`` to the underlying C API." msgstr "" -#: ../../library/socket.rst:927 +#: ../../library/socket.rst:932 msgid "" "The *family*, *type* and *proto* arguments can be optionally specified in " "order to narrow the list of addresses returned. Passing zero as a value for " @@ -1153,15 +1156,15 @@ msgid "" "domain name." msgstr "" -#: ../../library/socket.rst:935 +#: ../../library/socket.rst:940 msgid "The function returns a list of 5-tuples with the following structure:" msgstr "" -#: ../../library/socket.rst:937 +#: ../../library/socket.rst:942 msgid "``(family, type, proto, canonname, sockaddr)``" msgstr "``(family, type, proto, canonname, sockaddr)``" -#: ../../library/socket.rst:939 +#: ../../library/socket.rst:944 msgid "" "In these tuples, *family*, *type*, *proto* are all integers and are meant to " "be passed to the :func:`~socket.socket` function. *canonname* will be a " @@ -1173,7 +1176,7 @@ msgid "" "`AF_INET6`), and is meant to be passed to the :meth:`socket.connect` method." msgstr "" -#: ../../library/socket.rst:949 +#: ../../library/socket.rst:954 msgid "" "Raises an :ref:`auditing event ` ``socket.getaddrinfo`` with " "arguments ``host``, ``port``, ``family``, ``type``, ``protocol``." @@ -1181,14 +1184,14 @@ msgstr "" "引發一個附帶引數 ``host``、``port``、``family``、``type``、``protocol`` 的" "\\ :ref:`稽核事件 ` ``socket.getaddrinfo``。" -#: ../../library/socket.rst:951 +#: ../../library/socket.rst:956 msgid "" "The following example fetches address information for a hypothetical TCP " "connection to ``example.org`` on port 80 (results may differ on your system " "if IPv6 isn't enabled)::" msgstr "" -#: ../../library/socket.rst:955 +#: ../../library/socket.rst:960 msgid "" ">>> socket.getaddrinfo(\"example.org\", 80, proto=socket.IPPROTO_TCP)\n" "[(socket.AF_INET6, socket.SOCK_STREAM,\n" @@ -1202,17 +1205,17 @@ msgstr "" " (socket.AF_INET, socket.SOCK_STREAM,\n" " 6, '', ('93.184.216.34', 80))]" -#: ../../library/socket.rst:961 +#: ../../library/socket.rst:966 msgid "parameters can now be passed using keyword arguments." msgstr "" -#: ../../library/socket.rst:964 +#: ../../library/socket.rst:969 msgid "" "for IPv6 multicast addresses, string representing an address will not " "contain ``%scope_id`` part." msgstr "" -#: ../../library/socket.rst:970 +#: ../../library/socket.rst:975 msgid "" "Return a fully qualified domain name for *name*. If *name* is omitted or " "empty, it is interpreted as the local host. To find the fully qualified " @@ -1223,7 +1226,7 @@ msgid "" "``'0.0.0.0'``, the hostname from :func:`gethostname` is returned." msgstr "" -#: ../../library/socket.rst:981 +#: ../../library/socket.rst:986 msgid "" "Translate a host name to IPv4 address format. The IPv4 address is returned " "as a string, such as ``'100.50.200.5'``. If the host name is an IPv4 " @@ -1233,7 +1236,7 @@ msgid "" "stack support." msgstr "" -#: ../../library/socket.rst:987 ../../library/socket.rst:1003 +#: ../../library/socket.rst:992 ../../library/socket.rst:1008 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyname`` with " "argument ``hostname``." @@ -1241,7 +1244,7 @@ msgstr "" "引發一個附帶引數 ``hostname`` 的\\ :ref:`稽核事件 ` ``socket." "gethostbyname``。" -#: ../../library/socket.rst:994 +#: ../../library/socket.rst:999 msgid "" "Translate a host name to IPv4 address format, extended interface. Return a 3-" "tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the host's " @@ -1253,26 +1256,26 @@ msgid "" "stack support." msgstr "" -#: ../../library/socket.rst:1010 +#: ../../library/socket.rst:1015 msgid "" "Return a string containing the hostname of the machine where the Python " "interpreter is currently executing." msgstr "" -#: ../../library/socket.rst:1013 +#: ../../library/socket.rst:1018 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostname`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``socket.gethostname``。" -#: ../../library/socket.rst:1015 +#: ../../library/socket.rst:1020 msgid "" "Note: :func:`gethostname` doesn't always return the fully qualified domain " "name; use :func:`getfqdn` for that." msgstr "" -#: ../../library/socket.rst:1023 +#: ../../library/socket.rst:1028 msgid "" "Return a 3-tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is " "the primary host name responding to the given *ip_address*, *aliaslist* is a " @@ -1283,7 +1286,7 @@ msgid "" "`gethostbyaddr` supports both IPv4 and IPv6." msgstr "" -#: ../../library/socket.rst:1031 +#: ../../library/socket.rst:1036 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyaddr`` with " "argument ``ip_address``." @@ -1291,7 +1294,7 @@ msgstr "" "引發一個附帶引數 ``ip_address`` 的\\ :ref:`稽核事件 ` ``socket." "gethostbyaddr``。" -#: ../../library/socket.rst:1038 +#: ../../library/socket.rst:1043 msgid "" "Translate a socket address *sockaddr* into a 2-tuple ``(host, port)``. " "Depending on the settings of *flags*, the result can contain a fully " @@ -1299,18 +1302,18 @@ msgid "" "Similarly, *port* can contain a string port name or a numeric port number." msgstr "" -#: ../../library/socket.rst:1043 +#: ../../library/socket.rst:1048 msgid "" "For IPv6 addresses, ``%scope_id`` is appended to the host part if *sockaddr* " "contains meaningful *scope_id*. Usually this happens for multicast addresses." msgstr "" -#: ../../library/socket.rst:1046 +#: ../../library/socket.rst:1051 msgid "" "For more information about *flags* you can consult :manpage:`getnameinfo(3)`." msgstr "" -#: ../../library/socket.rst:1048 +#: ../../library/socket.rst:1053 msgid "" "Raises an :ref:`auditing event ` ``socket.getnameinfo`` with " "argument ``sockaddr``." @@ -1318,7 +1321,7 @@ msgstr "" "引發一個附帶引數 ``sockaddr`` 的\\ :ref:`稽核事件 ` ``socket." "getnameinfo``。" -#: ../../library/socket.rst:1055 +#: ../../library/socket.rst:1060 msgid "" "Translate an internet protocol name (for example, ``'icmp'``) to a constant " "suitable for passing as the (optional) third argument to the :func:`~socket." @@ -1327,14 +1330,14 @@ msgid "" "is chosen automatically if the protocol is omitted or zero." msgstr "" -#: ../../library/socket.rst:1066 +#: ../../library/socket.rst:1071 msgid "" "Translate an internet service name and protocol name to a port number for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: ../../library/socket.rst:1070 +#: ../../library/socket.rst:1075 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyname`` with " "arguments ``servicename``, ``protocolname``." @@ -1342,14 +1345,14 @@ msgstr "" "引發一個附帶引數 ``sockaddr``、``protocolname`` 的\\ :ref:`稽核事件 " "` ``socket.getservbyname``。" -#: ../../library/socket.rst:1077 +#: ../../library/socket.rst:1082 msgid "" "Translate an internet port number and protocol name to a service name for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: ../../library/socket.rst:1081 +#: ../../library/socket.rst:1086 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyport`` with " "arguments ``port``, ``protocolname``." @@ -1357,40 +1360,40 @@ msgstr "" "引發一個附帶引數 ``port``、``protocolname`` 的\\ :ref:`稽核事件 ` " "``socket.getservbyport``。" -#: ../../library/socket.rst:1088 +#: ../../library/socket.rst:1093 msgid "" "Convert 32-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: ../../library/socket.rst:1095 +#: ../../library/socket.rst:1100 msgid "" "Convert 16-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: ../../library/socket.rst:1099 ../../library/socket.rst:1117 +#: ../../library/socket.rst:1104 ../../library/socket.rst:1122 msgid "" "Raises :exc:`OverflowError` if *x* does not fit in a 16-bit unsigned integer." msgstr "" -#: ../../library/socket.rst:1106 +#: ../../library/socket.rst:1111 msgid "" "Convert 32-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: ../../library/socket.rst:1113 +#: ../../library/socket.rst:1118 msgid "" "Convert 16-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: ../../library/socket.rst:1124 +#: ../../library/socket.rst:1129 msgid "" "Convert an IPv4 address from dotted-quad string format (for example, " "'123.45.67.89') to 32-bit packed binary format, as a bytes object four " @@ -1399,26 +1402,26 @@ msgid "" "which is the C type for the 32-bit packed binary this function returns." msgstr "" -#: ../../library/socket.rst:1130 +#: ../../library/socket.rst:1135 msgid "" ":func:`inet_aton` also accepts strings with less than three dots; see the " "Unix manual page :manpage:`inet(3)` for details." msgstr "" -#: ../../library/socket.rst:1133 +#: ../../library/socket.rst:1138 msgid "" "If the IPv4 address string passed to this function is invalid, :exc:" "`OSError` will be raised. Note that exactly what is valid depends on the " "underlying C implementation of :c:func:`inet_aton`." msgstr "" -#: ../../library/socket.rst:1137 +#: ../../library/socket.rst:1142 msgid "" ":func:`inet_aton` does not support IPv6, and :func:`inet_pton` should be " "used instead for IPv4/v6 dual stack support." msgstr "" -#: ../../library/socket.rst:1143 +#: ../../library/socket.rst:1148 msgid "" "Convert a 32-bit packed IPv4 address (a :term:`bytes-like object` four bytes " "in length) to its standard dotted-quad string representation (for example, " @@ -1428,7 +1431,7 @@ msgid "" "argument." msgstr "" -#: ../../library/socket.rst:1150 +#: ../../library/socket.rst:1155 msgid "" "If the byte sequence passed to this function is not exactly 4 bytes in " "length, :exc:`OSError` will be raised. :func:`inet_ntoa` does not support " @@ -1436,7 +1439,7 @@ msgid "" "support." msgstr "" -#: ../../library/socket.rst:1161 +#: ../../library/socket.rst:1166 msgid "" "Convert an IP address from its family-specific string format to a packed, " "binary format. :func:`inet_pton` is useful when a library or network " @@ -1444,7 +1447,7 @@ msgid "" "`inet_aton`) or :c:struct:`in6_addr`." msgstr "" -#: ../../library/socket.rst:1166 +#: ../../library/socket.rst:1171 msgid "" "Supported values for *address_family* are currently :const:`AF_INET` and :" "const:`AF_INET6`. If the IP address string *ip_string* is invalid, :exc:" @@ -1453,15 +1456,15 @@ msgid "" "`inet_pton`." msgstr "" -#: ../../library/socket.rst:1172 ../../library/socket.rst:1192 +#: ../../library/socket.rst:1177 ../../library/socket.rst:1197 msgid ":ref:`Availability `: Unix, Windows." msgstr ":ref:`適用 `:Unix、Windows。" -#: ../../library/socket.rst:1174 ../../library/socket.rst:1194 +#: ../../library/socket.rst:1179 ../../library/socket.rst:1199 msgid "Windows support added" msgstr "" -#: ../../library/socket.rst:1180 +#: ../../library/socket.rst:1185 msgid "" "Convert a packed IP address (a :term:`bytes-like object` of some number of " "bytes) to its standard, family-specific string representation (for example, " @@ -1470,7 +1473,7 @@ msgid "" "(similar to :func:`inet_ntoa`) or :c:struct:`in6_addr`." msgstr "" -#: ../../library/socket.rst:1187 +#: ../../library/socket.rst:1192 msgid "" "Supported values for *address_family* are currently :const:`AF_INET` and :" "const:`AF_INET6`. If the bytes object *packed_ip* is not the correct length " @@ -1478,7 +1481,7 @@ msgid "" "`OSError` is raised for errors from the call to :func:`inet_ntop`." msgstr "" -#: ../../library/socket.rst:1209 +#: ../../library/socket.rst:1214 msgid "" "Return the total length, without trailing padding, of an ancillary data item " "with associated data of the given *length*. This value can often be used as " @@ -1489,16 +1492,17 @@ msgid "" "the permissible range of values." msgstr "" -#: ../../library/socket.rst:1218 ../../library/socket.rst:1241 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." -msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" +#: ../../library/socket.rst:1223 ../../library/socket.rst:1246 +#: ../../library/socket.rst:1867 +msgid ":ref:`Availability `: Unix, not WASI." +msgstr ":ref:`適用 `:Unix、非 WASI。" -#: ../../library/socket.rst:1220 ../../library/socket.rst:1712 -#: ../../library/socket.rst:1756 ../../library/socket.rst:1864 +#: ../../library/socket.rst:1225 ../../library/socket.rst:1717 +#: ../../library/socket.rst:1761 ../../library/socket.rst:1869 msgid "Most Unix platforms." msgstr "" -#: ../../library/socket.rst:1227 +#: ../../library/socket.rst:1232 msgid "" "Return the buffer size needed for :meth:`~socket.recvmsg` to receive an " "ancillary data item with associated data of the given *length*, along with " @@ -1508,7 +1512,7 @@ msgid "" "values." msgstr "" -#: ../../library/socket.rst:1235 +#: ../../library/socket.rst:1240 msgid "" "Note that some systems might support ancillary data without providing this " "function. Also note that setting the buffer size using the results of this " @@ -1516,31 +1520,31 @@ msgid "" "received, since additional data may be able to fit into the padding area." msgstr "" -#: ../../library/socket.rst:1243 +#: ../../library/socket.rst:1248 msgid "most Unix platforms." msgstr "" -#: ../../library/socket.rst:1250 +#: ../../library/socket.rst:1255 msgid "" "Return the default timeout in seconds (float) for new socket objects. A " "value of ``None`` indicates that new socket objects have no timeout. When " "the socket module is first imported, the default is ``None``." msgstr "" -#: ../../library/socket.rst:1257 +#: ../../library/socket.rst:1262 msgid "" "Set the default timeout in seconds (float) for new socket objects. When the " "socket module is first imported, the default is ``None``. See :meth:" "`~socket.settimeout` for possible values and their respective meanings." msgstr "" -#: ../../library/socket.rst:1265 +#: ../../library/socket.rst:1270 msgid "" "Set the machine's hostname to *name*. This will raise an :exc:`OSError` if " "you don't have enough rights." msgstr "" -#: ../../library/socket.rst:1268 +#: ../../library/socket.rst:1273 msgid "" "Raises an :ref:`auditing event ` ``socket.sethostname`` with " "argument ``name``." @@ -1548,114 +1552,114 @@ msgstr "" "引發一個附帶引數 ``name`` 的\\ :ref:`稽核事件 ` ``socket." "sethostname``。" -#: ../../library/socket.rst:1270 ../../library/socket.rst:1710 -#: ../../library/socket.rst:1754 +#: ../../library/socket.rst:1275 ../../library/socket.rst:1715 +#: ../../library/socket.rst:1759 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" -#: ../../library/socket.rst:1277 +#: ../../library/socket.rst:1282 msgid "" "Return a list of network interface information (index int, name string) " "tuples. :exc:`OSError` if the system call fails." msgstr "" -#: ../../library/socket.rst:1281 ../../library/socket.rst:1308 -#: ../../library/socket.rst:1325 ../../library/socket.rst:1342 -#: ../../library/socket.rst:1356 -msgid "" -":ref:`Availability `: Unix, Windows, not Emscripten, not WASI." -msgstr ":ref:`適用 `:Unix、Windows、非 Emscripten、非 WASI。" +#: ../../library/socket.rst:1286 ../../library/socket.rst:1313 +#: ../../library/socket.rst:1330 ../../library/socket.rst:1347 +#: ../../library/socket.rst:1361 +#, fuzzy +msgid ":ref:`Availability `: Unix, Windows, not WASI." +msgstr ":ref:`適用 `:Unix、非 WASI。" -#: ../../library/socket.rst:1285 ../../library/socket.rst:1312 -#: ../../library/socket.rst:1329 +#: ../../library/socket.rst:1290 ../../library/socket.rst:1317 +#: ../../library/socket.rst:1334 msgid "Windows support was added." msgstr "增加對 Windows 的支援。" -#: ../../library/socket.rst:1290 +#: ../../library/socket.rst:1295 msgid "" "On Windows network interfaces have different names in different contexts " "(all names are examples):" msgstr "" -#: ../../library/socket.rst:1293 +#: ../../library/socket.rst:1298 msgid "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" msgstr "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" -#: ../../library/socket.rst:1294 +#: ../../library/socket.rst:1299 msgid "name: ``ethernet_32770``" msgstr "" -#: ../../library/socket.rst:1295 +#: ../../library/socket.rst:1300 msgid "friendly name: ``vEthernet (nat)``" msgstr "" -#: ../../library/socket.rst:1296 +#: ../../library/socket.rst:1301 msgid "description: ``Hyper-V Virtual Ethernet Adapter``" msgstr "" -#: ../../library/socket.rst:1298 +#: ../../library/socket.rst:1303 msgid "" "This function returns names of the second form from the list, " "``ethernet_32770`` in this example case." msgstr "" -#: ../../library/socket.rst:1304 +#: ../../library/socket.rst:1309 msgid "" "Return a network interface index number corresponding to an interface name. :" "exc:`OSError` if no interface with the given name exists." msgstr "" -#: ../../library/socket.rst:1316 ../../library/socket.rst:1333 +#: ../../library/socket.rst:1321 ../../library/socket.rst:1338 msgid "\"Interface name\" is a name as documented in :func:`if_nameindex`." msgstr "" -#: ../../library/socket.rst:1321 +#: ../../library/socket.rst:1326 msgid "" "Return a network interface name corresponding to an interface index number. :" "exc:`OSError` if no interface with the given index exists." msgstr "" -#: ../../library/socket.rst:1338 +#: ../../library/socket.rst:1343 msgid "" "Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket " "*sock*. The *fds* parameter is a sequence of file descriptors. Consult :meth:" "`~socket.sendmsg` for the documentation of these parameters." msgstr "" -#: ../../library/socket.rst:1344 ../../library/socket.rst:1358 +#: ../../library/socket.rst:1349 ../../library/socket.rst:1363 msgid "" "Unix platforms supporting :meth:`~socket.sendmsg` and :const:`SCM_RIGHTS` " "mechanism." msgstr "" -#: ../../library/socket.rst:1352 +#: ../../library/socket.rst:1357 msgid "" "Receive up to *maxfds* file descriptors from an :const:`AF_UNIX` socket " "*sock*. Return ``(msg, list(fds), flags, addr)``. Consult :meth:`~socket." "recvmsg` for the documentation of these parameters." msgstr "" -#: ../../library/socket.rst:1365 +#: ../../library/socket.rst:1370 msgid "Any truncated integers at the end of the list of file descriptors." msgstr "" -#: ../../library/socket.rst:1371 +#: ../../library/socket.rst:1376 msgid "Socket Objects" msgstr "Socket 物件" -#: ../../library/socket.rst:1373 +#: ../../library/socket.rst:1378 msgid "" "Socket objects have the following methods. Except for :meth:`~socket." "makefile`, these correspond to Unix system calls applicable to sockets." msgstr "" -#: ../../library/socket.rst:1377 +#: ../../library/socket.rst:1382 msgid "" "Support for the :term:`context manager` protocol was added. Exiting the " "context manager is equivalent to calling :meth:`~socket.close`." msgstr "" -#: ../../library/socket.rst:1384 +#: ../../library/socket.rst:1389 msgid "" "Accept a connection. The socket must be bound to an address and listening " "for connections. The return value is a pair ``(conn, address)`` where *conn* " @@ -1664,27 +1668,27 @@ msgid "" "connection." msgstr "" -#: ../../library/socket.rst:1391 ../../library/socket.rst:1485 +#: ../../library/socket.rst:1396 ../../library/socket.rst:1490 msgid "The socket is now non-inheritable." msgstr "" -#: ../../library/socket.rst:1394 ../../library/socket.rst:1625 -#: ../../library/socket.rst:1639 ../../library/socket.rst:1716 -#: ../../library/socket.rst:1789 ../../library/socket.rst:1808 -#: ../../library/socket.rst:1825 ../../library/socket.rst:1870 +#: ../../library/socket.rst:1399 ../../library/socket.rst:1630 +#: ../../library/socket.rst:1644 ../../library/socket.rst:1721 +#: ../../library/socket.rst:1794 ../../library/socket.rst:1813 +#: ../../library/socket.rst:1830 ../../library/socket.rst:1875 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the method now retries the system call instead of raising an :exc:" "`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -#: ../../library/socket.rst:1402 +#: ../../library/socket.rst:1407 msgid "" "Bind the socket to *address*. The socket must not already be bound. (The " "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1405 +#: ../../library/socket.rst:1410 msgid "" "Raises an :ref:`auditing event ` ``socket.bind`` with arguments " "``self``, ``address``." @@ -1692,7 +1696,7 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.bind``。" -#: ../../library/socket.rst:1412 +#: ../../library/socket.rst:1417 msgid "" "Mark the socket closed. The underlying system resource (e.g. a file " "descriptor) is also closed when all file objects from :meth:`makefile` are " @@ -1701,33 +1705,33 @@ msgid "" "flushed)." msgstr "" -#: ../../library/socket.rst:1418 +#: ../../library/socket.rst:1423 msgid "" "Sockets are automatically closed when they are garbage-collected, but it is " "recommended to :meth:`close` them explicitly, or to use a :keyword:`with` " "statement around them." msgstr "" -#: ../../library/socket.rst:1422 +#: ../../library/socket.rst:1427 msgid "" ":exc:`OSError` is now raised if an error occurs when the underlying :c:func:" "`close` call is made." msgstr "" -#: ../../library/socket.rst:1428 +#: ../../library/socket.rst:1433 msgid "" ":meth:`close` releases the resource associated with a connection but does " "not necessarily close the connection immediately. If you want to close the " "connection in a timely fashion, call :meth:`shutdown` before :meth:`close`." msgstr "" -#: ../../library/socket.rst:1436 +#: ../../library/socket.rst:1441 msgid "" "Connect to a remote socket at *address*. (The format of *address* depends on " "the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1439 +#: ../../library/socket.rst:1444 msgid "" "If the connection is interrupted by a signal, the method waits until the " "connection completes, or raise a :exc:`TimeoutError` on timeout, if the " @@ -1737,7 +1741,7 @@ msgid "" "(or the exception raised by the signal handler)." msgstr "" -#: ../../library/socket.rst:1446 ../../library/socket.rst:1466 +#: ../../library/socket.rst:1451 ../../library/socket.rst:1471 msgid "" "Raises an :ref:`auditing event ` ``socket.connect`` with arguments " "``self``, ``address``." @@ -1745,7 +1749,7 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.connect``。" -#: ../../library/socket.rst:1448 +#: ../../library/socket.rst:1453 msgid "" "The method now waits until the connection completes instead of raising an :" "exc:`InterruptedError` exception if the connection is interrupted by a " @@ -1753,7 +1757,7 @@ msgid "" "blocking or has a timeout (see the :pep:`475` for the rationale)." msgstr "" -#: ../../library/socket.rst:1459 +#: ../../library/socket.rst:1464 msgid "" "Like ``connect(address)``, but return an error indicator instead of raising " "an exception for errors returned by the C-level :c:func:`connect` call " @@ -1763,38 +1767,38 @@ msgid "" "asynchronous connects." msgstr "" -#: ../../library/socket.rst:1472 +#: ../../library/socket.rst:1477 msgid "" "Put the socket object into closed state without actually closing the " "underlying file descriptor. The file descriptor is returned, and can be " "reused for other purposes." msgstr "" -#: ../../library/socket.rst:1481 +#: ../../library/socket.rst:1486 msgid "Duplicate the socket." msgstr "" -#: ../../library/socket.rst:1493 +#: ../../library/socket.rst:1498 msgid "" "Return the socket's file descriptor (a small integer), or -1 on failure. " "This is useful with :func:`select.select`." msgstr "" -#: ../../library/socket.rst:1496 +#: ../../library/socket.rst:1501 msgid "" "Under Windows the small integer returned by this method cannot be used where " "a file descriptor can be used (such as :func:`os.fdopen`). Unix does not " "have this limitation." msgstr "" -#: ../../library/socket.rst:1502 +#: ../../library/socket.rst:1507 msgid "" "Get the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle: ``True`` if the socket can be inherited in " "child processes, ``False`` if it cannot." msgstr "" -#: ../../library/socket.rst:1511 +#: ../../library/socket.rst:1516 msgid "" "Return the remote address to which the socket is connected. This is useful " "to find out the port number of a remote IPv4/v6 socket, for instance. (The " @@ -1802,14 +1806,14 @@ msgid "" "above.) On some systems this function is not supported." msgstr "" -#: ../../library/socket.rst:1519 +#: ../../library/socket.rst:1524 msgid "" "Return the socket's own address. This is useful to find out the port number " "of an IPv4/v6 socket, for instance. (The format of the address returned " "depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1526 +#: ../../library/socket.rst:1531 msgid "" "Return the value of the given socket option (see the Unix man page :manpage:" "`getsockopt(2)`). The needed symbolic constants (:ref:`SO_\\* etc. `_ for more information." msgstr "" -#: ../../library/socket.rst:1564 +#: ../../library/socket.rst:1569 msgid "" "On other platforms, the generic :func:`fcntl.fcntl` and :func:`fcntl.ioctl` " "functions may be used; they accept a socket object as their first argument." msgstr "" -#: ../../library/socket.rst:1567 +#: ../../library/socket.rst:1572 msgid "" "Currently only the following control codes are supported: ``SIO_RCVALL``, " "``SIO_KEEPALIVE_VALS``, and ``SIO_LOOPBACK_FAST_PATH``." msgstr "" -#: ../../library/socket.rst:1575 +#: ../../library/socket.rst:1580 msgid "" "Enable a server to accept connections. If *backlog* is specified, it must " "be at least 0 (if it is lower, it is set to 0); it specifies the number of " @@ -1873,11 +1877,11 @@ msgid "" "connections. If not specified, a default reasonable value is chosen." msgstr "" -#: ../../library/socket.rst:1582 +#: ../../library/socket.rst:1587 msgid "The *backlog* parameter is now optional." msgstr "" -#: ../../library/socket.rst:1591 +#: ../../library/socket.rst:1596 msgid "" "Return a :term:`file object` associated with the socket. The exact returned " "type depends on the arguments given to :meth:`makefile`. These arguments " @@ -1886,28 +1890,28 @@ msgid "" "``'b'``, or a combination of those." msgstr "" -#: ../../library/socket.rst:1597 +#: ../../library/socket.rst:1602 msgid "" "The socket must be in blocking mode; it can have a timeout, but the file " "object's internal buffer may end up in an inconsistent state if a timeout " "occurs." msgstr "" -#: ../../library/socket.rst:1601 +#: ../../library/socket.rst:1606 msgid "" "Closing the file object returned by :meth:`makefile` won't close the " "original socket unless all other file objects have been closed and :meth:" "`socket.close` has been called on the socket object." msgstr "" -#: ../../library/socket.rst:1607 +#: ../../library/socket.rst:1612 msgid "" "On Windows, the file-like object created by :meth:`makefile` cannot be used " "where a file object with a file descriptor is expected, such as the stream " "arguments of :meth:`subprocess.Popen`." msgstr "" -#: ../../library/socket.rst:1614 +#: ../../library/socket.rst:1619 msgid "" "Receive data from the socket. The return value is a bytes object " "representing the data received. The maximum amount of data to be received " @@ -1917,13 +1921,13 @@ msgid "" "zero." msgstr "" -#: ../../library/socket.rst:1622 +#: ../../library/socket.rst:1627 msgid "" "For best match with hardware and network realities, the value of *bufsize* " "should be a relatively small power of 2, for example, 4096." msgstr "" -#: ../../library/socket.rst:1633 +#: ../../library/socket.rst:1638 msgid "" "Receive data from the socket. The return value is a pair ``(bytes, " "address)`` where *bytes* is a bytes object representing the data received " @@ -1933,14 +1937,14 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1644 +#: ../../library/socket.rst:1649 msgid "" "For multicast IPv6 address, first item of *address* does not contain " "``%scope_id`` part anymore. In order to get full IPv6 address use :func:" "`getnameinfo`." msgstr "" -#: ../../library/socket.rst:1651 +#: ../../library/socket.rst:1656 msgid "" "Receive normal data (up to *bufsize* bytes) and ancillary data from the " "socket. The *ancbufsize* argument sets the size in bytes of the internal " @@ -1951,7 +1955,7 @@ msgid "" "*flags* argument defaults to 0 and has the same meaning as for :meth:`recv`." msgstr "" -#: ../../library/socket.rst:1661 +#: ../../library/socket.rst:1666 msgid "" "The return value is a 4-tuple: ``(data, ancdata, msg_flags, address)``. The " "*data* item is a :class:`bytes` object holding the non-ancillary data " @@ -1966,7 +1970,7 @@ msgid "" "socket, if available; otherwise, its value is unspecified." msgstr "" -#: ../../library/socket.rst:1675 +#: ../../library/socket.rst:1680 msgid "" "On some systems, :meth:`sendmsg` and :meth:`recvmsg` can be used to pass " "file descriptors between processes over an :const:`AF_UNIX` socket. When " @@ -1979,7 +1983,7 @@ msgid "" "descriptors received via this mechanism." msgstr "" -#: ../../library/socket.rst:1686 +#: ../../library/socket.rst:1691 msgid "" "Some systems do not indicate the truncated length of ancillary data items " "which have been only partially received. If an item appears to extend " @@ -1988,7 +1992,7 @@ msgid "" "provided it has not been truncated before the start of its associated data." msgstr "" -#: ../../library/socket.rst:1693 +#: ../../library/socket.rst:1698 msgid "" "On systems which support the :const:`SCM_RIGHTS` mechanism, the following " "function will receive up to *maxfds* file descriptors, returning the message " @@ -1997,7 +2001,7 @@ msgid "" "meth:`sendmsg`. ::" msgstr "" -#: ../../library/socket.rst:1699 +#: ../../library/socket.rst:1704 msgid "" "import socket, array\n" "\n" @@ -2014,7 +2018,7 @@ msgid "" " return msg, list(fds)" msgstr "" -#: ../../library/socket.rst:1724 +#: ../../library/socket.rst:1729 msgid "" "Receive normal data and ancillary data from the socket, behaving as :meth:" "`recvmsg` would, but scatter the non-ancillary data into a series of buffers " @@ -2027,7 +2031,7 @@ msgid "" "arguments have the same meaning as for :meth:`recvmsg`." msgstr "" -#: ../../library/socket.rst:1735 +#: ../../library/socket.rst:1740 msgid "" "The return value is a 4-tuple: ``(nbytes, ancdata, msg_flags, address)``, " "where *nbytes* is the total number of bytes of non-ancillary data written " @@ -2035,11 +2039,11 @@ msgid "" "for :meth:`recvmsg`." msgstr "" -#: ../../library/socket.rst:1740 +#: ../../library/socket.rst:1745 msgid "Example::" msgstr "範例: ::" -#: ../../library/socket.rst:1742 +#: ../../library/socket.rst:1747 msgid "" ">>> import socket\n" ">>> s1, s2 = socket.socketpair()\n" @@ -2065,7 +2069,7 @@ msgstr "" ">>> [b1, b2, b3]\n" "[bytearray(b'Mary'), bytearray(b'01 had a 9'), bytearray(b'little lamb---')]" -#: ../../library/socket.rst:1763 +#: ../../library/socket.rst:1768 msgid "" "Receive data from the socket, writing it into *buffer* instead of creating a " "new bytestring. The return value is a pair ``(nbytes, address)`` where " @@ -2075,7 +2079,7 @@ msgid "" "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1773 +#: ../../library/socket.rst:1778 msgid "" "Receive up to *nbytes* bytes from the socket, storing the data into a buffer " "rather than creating a new bytestring. If *nbytes* is not specified (or 0), " @@ -2084,7 +2088,7 @@ msgid "" "of the optional argument *flags*; it defaults to zero." msgstr "" -#: ../../library/socket.rst:1782 +#: ../../library/socket.rst:1787 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -2094,7 +2098,7 @@ msgid "" "data. For further information on this topic, consult the :ref:`socket-howto`." msgstr "" -#: ../../library/socket.rst:1797 +#: ../../library/socket.rst:1802 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -2104,13 +2108,13 @@ msgid "" "to determine how much data, if any, was successfully sent." msgstr "" -#: ../../library/socket.rst:1804 +#: ../../library/socket.rst:1809 msgid "" "The socket timeout is no longer reset each time data is sent successfully. " "The socket timeout is now the maximum total duration to send all data." msgstr "" -#: ../../library/socket.rst:1817 +#: ../../library/socket.rst:1822 msgid "" "Send data to the socket. The socket should not be connected to a remote " "socket, since the destination socket is specified by *address*. The " @@ -2119,7 +2123,7 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1823 +#: ../../library/socket.rst:1828 msgid "" "Raises an :ref:`auditing event ` ``socket.sendto`` with arguments " "``self``, ``address``." @@ -2127,7 +2131,7 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.sendto``。" -#: ../../library/socket.rst:1833 +#: ../../library/socket.rst:1838 msgid "" "Send normal and ancillary data to the socket, gathering the non-ancillary " "data from a series of buffers and concatenating it into a single message. " @@ -2147,14 +2151,14 @@ msgid "" "bytes of non-ancillary data sent." msgstr "" -#: ../../library/socket.rst:1853 +#: ../../library/socket.rst:1858 msgid "" "The following function sends the list of file descriptors *fds* over an :" "const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` " "mechanism. See also :meth:`recvmsg`. ::" msgstr "" -#: ../../library/socket.rst:1857 +#: ../../library/socket.rst:1862 msgid "" "import socket, array\n" "\n" @@ -2168,11 +2172,7 @@ msgstr "" " return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array." "array(\"i\", fds))])" -#: ../../library/socket.rst:1862 -msgid ":ref:`Availability `: Unix, not WASI." -msgstr ":ref:`適用 `:Unix、非 WASI。" - -#: ../../library/socket.rst:1866 +#: ../../library/socket.rst:1871 msgid "" "Raises an :ref:`auditing event ` ``socket.sendmsg`` with arguments " "``self``, ``address``." @@ -2180,14 +2180,14 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.sendmsg``。" -#: ../../library/socket.rst:1877 +#: ../../library/socket.rst:1882 msgid "" "Specialized version of :meth:`~socket.sendmsg` for :const:`AF_ALG` socket. " "Set mode, IV, AEAD associated data length and flags for :const:`AF_ALG` " "socket." msgstr "" -#: ../../library/socket.rst:1886 +#: ../../library/socket.rst:1891 msgid "" "Send a file until EOF is reached by using high-performance :mod:`os." "sendfile` and return the total number of bytes which were sent. *file* must " @@ -2201,38 +2201,38 @@ msgid "" "be of :const:`SOCK_STREAM` type. Non-blocking sockets are not supported." msgstr "" -#: ../../library/socket.rst:1902 +#: ../../library/socket.rst:1907 msgid "" "Set the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle." msgstr "" -#: ../../library/socket.rst:1910 +#: ../../library/socket.rst:1915 msgid "" "Set blocking or non-blocking mode of the socket: if *flag* is false, the " "socket is set to non-blocking, else to blocking mode." msgstr "" -#: ../../library/socket.rst:1913 +#: ../../library/socket.rst:1918 msgid "" "This method is a shorthand for certain :meth:`~socket.settimeout` calls:" msgstr "" -#: ../../library/socket.rst:1915 +#: ../../library/socket.rst:1920 msgid "``sock.setblocking(True)`` is equivalent to ``sock.settimeout(None)``" msgstr "``sock.setblocking(True)`` 等價於 ``sock.settimeout(None)``" -#: ../../library/socket.rst:1917 +#: ../../library/socket.rst:1922 msgid "``sock.setblocking(False)`` is equivalent to ``sock.settimeout(0.0)``" msgstr "``sock.setblocking(False)`` 等價於 ``sock.settimeout(0.0)``" -#: ../../library/socket.rst:1919 +#: ../../library/socket.rst:1924 msgid "" "The method no longer applies :const:`SOCK_NONBLOCK` flag on :attr:`socket." "type`." msgstr "" -#: ../../library/socket.rst:1926 +#: ../../library/socket.rst:1931 msgid "" "Set a timeout on blocking socket operations. The *value* argument can be a " "nonnegative floating-point number expressing seconds, or ``None``. If a non-" @@ -2242,19 +2242,19 @@ msgid "" "blocking mode. If ``None`` is given, the socket is put in blocking mode." msgstr "" -#: ../../library/socket.rst:1933 +#: ../../library/socket.rst:1938 msgid "" "For further information, please consult the :ref:`notes on socket timeouts " "`." msgstr "" -#: ../../library/socket.rst:1935 +#: ../../library/socket.rst:1940 msgid "" "The method no longer toggles :const:`SOCK_NONBLOCK` flag on :attr:`socket." "type`." msgstr "" -#: ../../library/socket.rst:1948 +#: ../../library/socket.rst:1953 msgid "" "Set the value of the given socket option (see the Unix manual page :manpage:" "`setsockopt(2)`). The needed symbolic constants are defined in this module " @@ -2267,11 +2267,11 @@ msgid "" "C function with ``optval=NULL`` and ``optlen=optlen``." msgstr "" -#: ../../library/socket.rst:1961 +#: ../../library/socket.rst:1966 msgid "setsockopt(level, optname, None, optlen: int) form added." msgstr "" -#: ../../library/socket.rst:1969 +#: ../../library/socket.rst:1974 msgid "" "Shut down one or both halves of the connection. If *how* is :const:" "`SHUT_RD`, further receives are disallowed. If *how* is :const:`SHUT_WR`, " @@ -2279,7 +2279,7 @@ msgid "" "and receives are disallowed." msgstr "" -#: ../../library/socket.rst:1979 +#: ../../library/socket.rst:1984 msgid "" "Duplicate a socket and prepare it for sharing with a target process. The " "target process must be provided with *process_id*. The resulting bytes " @@ -2290,48 +2290,48 @@ msgid "" "process." msgstr "" -#: ../../library/socket.rst:1991 +#: ../../library/socket.rst:1996 msgid "" "Note that there are no methods :meth:`read` or :meth:`write`; use :meth:" "`~socket.recv` and :meth:`~socket.send` without *flags* argument instead." msgstr "" -#: ../../library/socket.rst:1994 +#: ../../library/socket.rst:1999 msgid "" "Socket objects also have these (read-only) attributes that correspond to the " "values given to the :class:`~socket.socket` constructor." msgstr "" -#: ../../library/socket.rst:2000 +#: ../../library/socket.rst:2005 msgid "The socket family." msgstr "" -#: ../../library/socket.rst:2005 +#: ../../library/socket.rst:2010 msgid "The socket type." msgstr "" -#: ../../library/socket.rst:2010 +#: ../../library/socket.rst:2015 msgid "The socket protocol." msgstr "" -#: ../../library/socket.rst:2017 +#: ../../library/socket.rst:2022 msgid "Notes on socket timeouts" msgstr "" -#: ../../library/socket.rst:2019 +#: ../../library/socket.rst:2024 msgid "" "A socket object can be in one of three modes: blocking, non-blocking, or " "timeout. Sockets are by default always created in blocking mode, but this " "can be changed by calling :func:`setdefaulttimeout`." msgstr "" -#: ../../library/socket.rst:2023 +#: ../../library/socket.rst:2028 msgid "" "In *blocking mode*, operations block until complete or the system returns an " "error (such as connection timed out)." msgstr "" -#: ../../library/socket.rst:2026 +#: ../../library/socket.rst:2031 msgid "" "In *non-blocking mode*, operations fail (with an error that is unfortunately " "system-dependent) if they cannot be completed immediately: functions from " @@ -2339,14 +2339,14 @@ msgid "" "available for reading or writing." msgstr "" -#: ../../library/socket.rst:2031 +#: ../../library/socket.rst:2036 msgid "" "In *timeout mode*, operations fail if they cannot be completed within the " "timeout specified for the socket (they raise a :exc:`timeout` exception) or " "if the system returns an error." msgstr "" -#: ../../library/socket.rst:2036 +#: ../../library/socket.rst:2041 msgid "" "At the operating system level, sockets in *timeout mode* are internally set " "in non-blocking mode. Also, the blocking and timeout modes are shared " @@ -2355,11 +2355,11 @@ msgid "" "you decide to use the :meth:`~socket.fileno` of a socket." msgstr "" -#: ../../library/socket.rst:2043 +#: ../../library/socket.rst:2048 msgid "Timeouts and the ``connect`` method" msgstr "" -#: ../../library/socket.rst:2045 +#: ../../library/socket.rst:2050 msgid "" "The :meth:`~socket.connect` operation is also subject to the timeout " "setting, and in general it is recommended to call :meth:`~socket.settimeout` " @@ -2369,24 +2369,24 @@ msgid "" "setting." msgstr "" -#: ../../library/socket.rst:2053 +#: ../../library/socket.rst:2058 msgid "Timeouts and the ``accept`` method" msgstr "" -#: ../../library/socket.rst:2055 +#: ../../library/socket.rst:2060 msgid "" "If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by the :" "meth:`~socket.accept` method inherit that timeout. Otherwise, the behaviour " "depends on settings of the listening socket:" msgstr "" -#: ../../library/socket.rst:2059 +#: ../../library/socket.rst:2064 msgid "" "if the listening socket is in *blocking mode* or in *timeout mode*, the " "socket returned by :meth:`~socket.accept` is in *blocking mode*;" msgstr "" -#: ../../library/socket.rst:2062 +#: ../../library/socket.rst:2067 msgid "" "if the listening socket is in *non-blocking mode*, whether the socket " "returned by :meth:`~socket.accept` is in blocking or non-blocking mode is " @@ -2394,11 +2394,11 @@ msgid "" "it is recommended you manually override this setting." msgstr "" -#: ../../library/socket.rst:2071 +#: ../../library/socket.rst:2076 msgid "Example" msgstr "範例" -#: ../../library/socket.rst:2073 +#: ../../library/socket.rst:2078 msgid "" "Here are four minimal example programs using the TCP/IP protocol: a server " "that echoes all data that it receives back (servicing only one client), and " @@ -2411,11 +2411,11 @@ msgid "" "on the new socket returned by :meth:`~socket.accept`." msgstr "" -#: ../../library/socket.rst:2083 +#: ../../library/socket.rst:2088 msgid "The first two examples support IPv4 only. ::" msgstr "前兩個範例只支援 IPv4: ::" -#: ../../library/socket.rst:2085 +#: ../../library/socket.rst:2090 msgid "" "# Echo server program\n" "import socket\n" @@ -2434,7 +2434,7 @@ msgid "" " conn.sendall(data)" msgstr "" -#: ../../library/socket.rst:2103 +#: ../../library/socket.rst:2108 msgid "" "# Echo client program\n" "import socket\n" @@ -2448,7 +2448,7 @@ msgid "" "print('Received', repr(data))" msgstr "" -#: ../../library/socket.rst:2114 +#: ../../library/socket.rst:2119 msgid "" "The next two examples are identical to the above two, but support both IPv4 " "and IPv6. The server side will listen to the first address family available " @@ -2458,7 +2458,7 @@ msgid "" "resolution, and sends traffic to the first one connected successfully. ::" msgstr "" -#: ../../library/socket.rst:2121 +#: ../../library/socket.rst:2126 msgid "" "# Echo server program\n" "import socket\n" @@ -2495,7 +2495,7 @@ msgid "" " conn.send(data)" msgstr "" -#: ../../library/socket.rst:2157 +#: ../../library/socket.rst:2162 msgid "" "# Echo client program\n" "import socket\n" @@ -2528,14 +2528,14 @@ msgid "" "print('Received', repr(data))" msgstr "" -#: ../../library/socket.rst:2186 +#: ../../library/socket.rst:2191 msgid "" "The next example shows how to write a very simple network sniffer with raw " "sockets on Windows. The example requires administrator privileges to modify " "the interface::" msgstr "" -#: ../../library/socket.rst:2190 +#: ../../library/socket.rst:2195 msgid "" "import socket\n" "\n" @@ -2559,29 +2559,29 @@ msgid "" "s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)" msgstr "" -#: ../../library/socket.rst:2211 +#: ../../library/socket.rst:2216 msgid "" "The next example shows how to use the socket interface to communicate to a " "CAN network using the raw socket protocol. To use CAN with the broadcast " "manager protocol instead, open a socket with::" msgstr "" -#: ../../library/socket.rst:2215 +#: ../../library/socket.rst:2220 msgid "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" msgstr "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" -#: ../../library/socket.rst:2217 +#: ../../library/socket.rst:2222 msgid "" "After binding (:const:`CAN_RAW`) or connecting (:const:`CAN_BCM`) the " "socket, you can use the :meth:`socket.send` and :meth:`socket.recv` " "operations (and their counterparts) on the socket object as usual." msgstr "" -#: ../../library/socket.rst:2221 +#: ../../library/socket.rst:2226 msgid "This last example might require special privileges::" msgstr "" -#: ../../library/socket.rst:2223 +#: ../../library/socket.rst:2228 msgid "" "import socket\n" "import struct\n" @@ -2623,29 +2623,29 @@ msgid "" " print('Error sending CAN frame')" msgstr "" -#: ../../library/socket.rst:2261 +#: ../../library/socket.rst:2266 msgid "" "Running an example several times with too small delay between executions, " "could lead to this error::" msgstr "" -#: ../../library/socket.rst:2264 +#: ../../library/socket.rst:2269 msgid "OSError: [Errno 98] Address already in use" msgstr "OSError: [Errno 98] Address already in use" -#: ../../library/socket.rst:2266 +#: ../../library/socket.rst:2271 msgid "" "This is because the previous execution has left the socket in a " "``TIME_WAIT`` state, and can't be immediately reused." msgstr "" -#: ../../library/socket.rst:2269 +#: ../../library/socket.rst:2274 msgid "" "There is a :mod:`socket` flag to set, in order to prevent this, :const:" "`socket.SO_REUSEADDR`::" msgstr "" -#: ../../library/socket.rst:2272 +#: ../../library/socket.rst:2277 msgid "" "s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" @@ -2655,30 +2655,30 @@ msgstr "" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" "s.bind((HOST, PORT))" -#: ../../library/socket.rst:2276 +#: ../../library/socket.rst:2281 msgid "" "the :data:`SO_REUSEADDR` flag tells the kernel to reuse a local socket in " "``TIME_WAIT`` state, without waiting for its natural timeout to expire." msgstr "" -#: ../../library/socket.rst:2282 +#: ../../library/socket.rst:2287 msgid "" "For an introduction to socket programming (in C), see the following papers:" msgstr "" -#: ../../library/socket.rst:2284 +#: ../../library/socket.rst:2289 msgid "" "*An Introductory 4.3BSD Interprocess Communication Tutorial*, by Stuart " "Sechrest" msgstr "" -#: ../../library/socket.rst:2286 +#: ../../library/socket.rst:2291 msgid "" "*An Advanced 4.3BSD Interprocess Communication Tutorial*, by Samuel J. " "Leffler et al," msgstr "" -#: ../../library/socket.rst:2289 +#: ../../library/socket.rst:2294 msgid "" "both in the UNIX Programmer's Manual, Supplementary Documents 1 (sections " "PS1:7 and PS1:8). The platform-specific reference material for the various " @@ -2697,18 +2697,29 @@ msgstr "object(物件)" msgid "socket" msgstr "socket" -#: ../../library/socket.rst:1589 +#: ../../library/socket.rst:1594 msgid "I/O control" msgstr "I/O control(I/O 控制)" -#: ../../library/socket.rst:1589 +#: ../../library/socket.rst:1594 msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/socket.rst:1946 +#: ../../library/socket.rst:1951 msgid "module" msgstr "module(模組)" -#: ../../library/socket.rst:1946 +#: ../../library/socket.rst:1951 msgid "struct" msgstr "struct" + +#~ msgid ":ref:`Availability `: not Emscripten, not WASI." +#~ msgstr ":ref:`適用 `:非 Emscripten、非 WASI。" + +#~ msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +#~ msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" + +#~ msgid "" +#~ ":ref:`Availability `: Unix, Windows, not Emscripten, not " +#~ "WASI." +#~ msgstr ":ref:`適用 `:Unix、Windows、非 Emscripten、非 WASI。" diff --git a/library/socketserver.po b/library/socketserver.po index b2355fec4b..656edd79ce 100644 --- a/library/socketserver.po +++ b/library/socketserver.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,14 +32,14 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid ":ref:`Availability `: not WASI." msgstr "" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/sqlite3.po b/library/sqlite3.po index 1c2b2b0449..547e4c0846 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -39,7 +39,7 @@ msgstr "" msgid "" "The :mod:`!sqlite3` module was written by Gerhard Häring. It provides an " "SQL interface compliant with the DB-API 2.0 specification described by :pep:" -"`249`, and requires SQLite 3.7.15 or newer." +"`249`, and requires SQLite 3.15.2 or newer." msgstr "" #: ../../library/sqlite3.rst:36 @@ -356,7 +356,7 @@ msgstr ":ref:`sqlite3-adapters`" msgid ":ref:`sqlite3-converters`" msgstr ":ref:`sqlite3-converters`" -#: ../../library/sqlite3.rst:244 ../../library/sqlite3.rst:609 +#: ../../library/sqlite3.rst:244 ../../library/sqlite3.rst:616 msgid ":ref:`sqlite3-connection-context-manager`" msgstr ":ref:`sqlite3-connection-context-manager`" @@ -499,7 +499,14 @@ msgstr "新增 ``sqlite3.connect/handle`` 稽核事件。" msgid "Added the *autocommit* parameter." msgstr "新增 *autocommit* 參數。" -#: ../../library/sqlite3.rst:363 +#: ../../library/sqlite3.rst:361 +msgid "" +"Positional use of the parameters *timeout*, *detect_types*, " +"*isolation_level*, *check_same_thread*, *factory*, *cached_statements*, and " +"*uri* is deprecated. They will become keyword-only parameters in Python 3.15." +msgstr "" + +#: ../../library/sqlite3.rst:369 msgid "" "Return ``True`` if the string *statement* appears to contain one or more " "complete SQL statements. No syntactic verification or parsing of any kind is " @@ -507,11 +514,11 @@ msgid "" "and the statement is terminated by a semicolon." msgstr "" -#: ../../library/sqlite3.rst:369 +#: ../../library/sqlite3.rst:375 msgid "For example:" msgstr "範例:" -#: ../../library/sqlite3.rst:371 +#: ../../library/sqlite3.rst:377 msgid "" ">>> sqlite3.complete_statement(\"SELECT foo FROM bar;\")\n" "True\n" @@ -523,20 +530,20 @@ msgstr "" ">>> sqlite3.complete_statement(\"SELECT foo\")\n" "False" -#: ../../library/sqlite3.rst:378 +#: ../../library/sqlite3.rst:384 msgid "" "This function may be useful during command-line input to determine if the " "entered text seems to form a complete SQL statement, or if additional input " "is needed before calling :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:382 +#: ../../library/sqlite3.rst:388 msgid "" "See :func:`!runsource` in :source:`Lib/sqlite3/__main__.py` for real-world " "use." msgstr "" -#: ../../library/sqlite3.rst:387 +#: ../../library/sqlite3.rst:393 msgid "" "Enable or disable callback tracebacks. By default you will not get any " "tracebacks in user-defined functions, aggregates, converters, authorizer " @@ -545,14 +552,14 @@ msgid "" "on :data:`sys.stderr`. Use ``False`` to disable the feature again." msgstr "" -#: ../../library/sqlite3.rst:396 +#: ../../library/sqlite3.rst:402 msgid "" "Errors in user-defined function callbacks are logged as unraisable " "exceptions. Use an :func:`unraisable hook handler ` for " "introspection of the failed callback." msgstr "" -#: ../../library/sqlite3.rst:402 +#: ../../library/sqlite3.rst:408 msgid "" "Register an *adapter* :term:`callable` to adapt the Python type *type* into " "an SQLite type. The adapter is called with a Python object of type *type* as " @@ -560,7 +567,7 @@ msgid "" "natively understands `." msgstr "" -#: ../../library/sqlite3.rst:410 +#: ../../library/sqlite3.rst:416 msgid "" "Register the *converter* :term:`callable` to convert SQLite objects of type " "*typename* into a Python object of a specific type. The converter is invoked " @@ -570,24 +577,24 @@ msgid "" "type detection works." msgstr "" -#: ../../library/sqlite3.rst:418 +#: ../../library/sqlite3.rst:424 msgid "" "Note: *typename* and the name of the type in your query are matched case-" "insensitively." msgstr "" -#: ../../library/sqlite3.rst:425 +#: ../../library/sqlite3.rst:431 msgid "Module constants" msgstr "" -#: ../../library/sqlite3.rst:429 +#: ../../library/sqlite3.rst:435 msgid "" "Set :attr:`~Connection.autocommit` to this constant to select old style (pre-" "Python 3.12) transaction control behaviour. See :ref:`sqlite3-transaction-" "control-isolation-level` for more information." msgstr "" -#: ../../library/sqlite3.rst:435 +#: ../../library/sqlite3.rst:441 msgid "" "Pass this flag value to the *detect_types* parameter of :func:`connect` to " "look up a converter function by using the type name, parsed from the query " @@ -595,18 +602,18 @@ msgid "" "in square brackets (``[]``)." msgstr "" -#: ../../library/sqlite3.rst:441 +#: ../../library/sqlite3.rst:447 msgid "" "SELECT p as \"p [point]\" FROM test; ! will look up converter \"point\"" msgstr "" -#: ../../library/sqlite3.rst:445 +#: ../../library/sqlite3.rst:451 msgid "" "This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:450 +#: ../../library/sqlite3.rst:456 msgid "" "Pass this flag value to the *detect_types* parameter of :func:`connect` to " "look up a converter function using the declared types for each column. The " @@ -615,7 +622,7 @@ msgid "" "the converter dictionary key. For example:" msgstr "" -#: ../../library/sqlite3.rst:458 +#: ../../library/sqlite3.rst:464 msgid "" "CREATE TABLE test(\n" " i integer primary key, ! will look up a converter named \"integer\"\n" @@ -624,61 +631,61 @@ msgid "" " )" msgstr "" -#: ../../library/sqlite3.rst:466 +#: ../../library/sqlite3.rst:472 msgid "" "This flag may be combined with :const:`PARSE_COLNAMES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:473 +#: ../../library/sqlite3.rst:479 msgid "" "Flags that should be returned by the *authorizer_callback* :term:`callable` " "passed to :meth:`Connection.set_authorizer`, to indicate whether:" msgstr "" -#: ../../library/sqlite3.rst:476 +#: ../../library/sqlite3.rst:482 msgid "Access is allowed (:const:`!SQLITE_OK`)," msgstr "" -#: ../../library/sqlite3.rst:477 +#: ../../library/sqlite3.rst:483 msgid "" "The SQL statement should be aborted with an error (:const:`!SQLITE_DENY`)" msgstr "" -#: ../../library/sqlite3.rst:478 +#: ../../library/sqlite3.rst:484 msgid "" "The column should be treated as a ``NULL`` value (:const:`!SQLITE_IGNORE`)" msgstr "" -#: ../../library/sqlite3.rst:482 +#: ../../library/sqlite3.rst:488 msgid "" "String constant stating the supported DB-API level. Required by the DB-API. " "Hard-coded to ``\"2.0\"``." msgstr "" -#: ../../library/sqlite3.rst:487 +#: ../../library/sqlite3.rst:493 msgid "" "String constant stating the type of parameter marker formatting expected by " "the :mod:`!sqlite3` module. Required by the DB-API. Hard-coded to " "``\"qmark\"``." msgstr "" -#: ../../library/sqlite3.rst:493 +#: ../../library/sqlite3.rst:499 msgid "The ``named`` DB-API parameter style is also supported." msgstr "" -#: ../../library/sqlite3.rst:497 +#: ../../library/sqlite3.rst:503 msgid "" "Version number of the runtime SQLite library as a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:501 +#: ../../library/sqlite3.rst:507 msgid "" "Version number of the runtime SQLite library as a :class:`tuple` of :class:" "`integers `." msgstr "" -#: ../../library/sqlite3.rst:506 +#: ../../library/sqlite3.rst:512 msgid "" "Integer constant required by the DB-API 2.0, stating the level of thread " "safety the :mod:`!sqlite3` module supports. This attribute is set based on " @@ -686,181 +693,187 @@ msgid "" "underlying SQLite library is compiled with. The SQLite threading modes are:" msgstr "" -#: ../../library/sqlite3.rst:511 +#: ../../library/sqlite3.rst:517 msgid "" "**Single-thread**: In this mode, all mutexes are disabled and SQLite is " "unsafe to use in more than a single thread at once." msgstr "" -#: ../../library/sqlite3.rst:513 +#: ../../library/sqlite3.rst:519 msgid "" "**Multi-thread**: In this mode, SQLite can be safely used by multiple " "threads provided that no single database connection is used simultaneously " "in two or more threads." msgstr "" -#: ../../library/sqlite3.rst:516 +#: ../../library/sqlite3.rst:522 msgid "" "**Serialized**: In serialized mode, SQLite can be safely used by multiple " "threads with no restriction." msgstr "" -#: ../../library/sqlite3.rst:519 +#: ../../library/sqlite3.rst:525 msgid "" "The mappings from SQLite threading modes to DB-API 2.0 threadsafety levels " "are as follows:" msgstr "" -#: ../../library/sqlite3.rst:523 +#: ../../library/sqlite3.rst:529 msgid "SQLite threading mode" msgstr "" -#: ../../library/sqlite3.rst:523 -msgid ":pep:`threadsafety <0249#threadsafety>`" -msgstr "" +#: ../../library/sqlite3.rst:529 +msgid "`threadsafety`_" +msgstr "`threadsafety`_" -#: ../../library/sqlite3.rst:523 +#: ../../library/sqlite3.rst:529 msgid "`SQLITE_THREADSAFE`_" msgstr "`SQLITE_THREADSAFE`_" -#: ../../library/sqlite3.rst:523 +#: ../../library/sqlite3.rst:529 msgid "DB-API 2.0 meaning" msgstr "" -#: ../../library/sqlite3.rst:526 +#: ../../library/sqlite3.rst:532 msgid "single-thread" msgstr "" -#: ../../library/sqlite3.rst:526 +#: ../../library/sqlite3.rst:532 msgid "0" msgstr "0" -#: ../../library/sqlite3.rst:526 +#: ../../library/sqlite3.rst:532 msgid "Threads may not share the module" msgstr "" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:535 msgid "multi-thread" msgstr "" -#: ../../library/sqlite3.rst:529 ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:535 ../../library/sqlite3.rst:538 msgid "1" msgstr "1" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:535 msgid "2" msgstr "2" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:535 msgid "Threads may share the module, but not connections" msgstr "" -#: ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:538 msgid "serialized" msgstr "" -#: ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:538 msgid "3" msgstr "3" -#: ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:538 msgid "Threads may share the module, connections and cursors" msgstr "" -#: ../../library/sqlite3.rst:538 +#: ../../library/sqlite3.rst:545 msgid "Set *threadsafety* dynamically instead of hard-coding it to ``1``." msgstr "" -#: ../../library/sqlite3.rst:543 +#: ../../library/sqlite3.rst:550 msgid "" "Version number of this module as a :class:`string `. This is not the " "version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:546 ../../library/sqlite3.rst:556 +#: ../../library/sqlite3.rst:553 ../../library/sqlite3.rst:563 msgid "" "This constant used to reflect the version number of the ``pysqlite`` " "package, a third-party library which used to upstream changes to :mod:`!" "sqlite3`. Today, it carries no meaning or practical value." msgstr "" -#: ../../library/sqlite3.rst:553 +#: ../../library/sqlite3.rst:560 msgid "" "Version number of this module as a :class:`tuple` of :class:`integers " "`. This is not the version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:580 +#: ../../library/sqlite3.rst:587 msgid "" "These constants are used for the :meth:`Connection.setconfig` and :meth:" "`~Connection.getconfig` methods." msgstr "" -#: ../../library/sqlite3.rst:583 +#: ../../library/sqlite3.rst:590 msgid "" "The availability of these constants varies depending on the version of " "SQLite Python was compiled with." msgstr "" -#: ../../library/sqlite3.rst:590 +#: ../../library/sqlite3.rst:597 msgid "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" msgstr "" -#: ../../library/sqlite3.rst:591 +#: ../../library/sqlite3.rst:598 msgid "SQLite docs: Database Connection Configuration Options" msgstr "" -#: ../../library/sqlite3.rst:597 +#: ../../library/sqlite3.rst:604 msgid "Connection objects" msgstr "Connection 物件" -#: ../../library/sqlite3.rst:601 +#: ../../library/sqlite3.rst:608 msgid "" "Each open SQLite database is represented by a ``Connection`` object, which " "is created using :func:`sqlite3.connect`. Their main purpose is creating :" "class:`Cursor` objects, and :ref:`sqlite3-controlling-transactions`." msgstr "" -#: ../../library/sqlite3.rst:608 +#: ../../library/sqlite3.rst:615 msgid ":ref:`sqlite3-connection-shortcuts`" msgstr ":ref:`sqlite3-connection-shortcuts`" -#: ../../library/sqlite3.rst:611 +#: ../../library/sqlite3.rst:621 +msgid "" +"A :exc:`ResourceWarning` is emitted if :meth:`close` is not called before a :" +"class:`!Connection` object is deleted." +msgstr "" + +#: ../../library/sqlite3.rst:624 msgid "An SQLite database connection has the following attributes and methods:" msgstr "" -#: ../../library/sqlite3.rst:615 +#: ../../library/sqlite3.rst:628 msgid "" "Create and return a :class:`Cursor` object. The cursor method accepts a " "single optional parameter *factory*. If supplied, this must be a :term:" "`callable` returning an instance of :class:`Cursor` or its subclasses." msgstr "" -#: ../../library/sqlite3.rst:622 +#: ../../library/sqlite3.rst:635 msgid "" "Open a :class:`Blob` handle to an existing :abbr:`BLOB (Binary Large " "OBject)`." msgstr "" -#: ../../library/sqlite3.rst:625 +#: ../../library/sqlite3.rst:638 msgid "The name of the table where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:628 +#: ../../library/sqlite3.rst:641 msgid "The name of the column where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:631 +#: ../../library/sqlite3.rst:644 msgid "The name of the row where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:634 +#: ../../library/sqlite3.rst:647 msgid "" "Set to ``True`` if the blob should be opened without write permissions. " "Defaults to ``False``." msgstr "" -#: ../../library/sqlite3.rst:639 +#: ../../library/sqlite3.rst:652 msgid "" "The name of the database where the blob is located. Defaults to ``\"main\"``." msgstr "" @@ -869,17 +882,17 @@ msgstr "" msgid "Raises" msgstr "" -#: ../../library/sqlite3.rst:643 +#: ../../library/sqlite3.rst:656 msgid "When trying to open a blob in a ``WITHOUT ROWID`` table." msgstr "" -#: ../../library/sqlite3.rst:650 +#: ../../library/sqlite3.rst:663 msgid "" "The blob size cannot be changed using the :class:`Blob` class. Use the SQL " "function ``zeroblob`` to create a blob with a fixed size." msgstr "" -#: ../../library/sqlite3.rst:657 +#: ../../library/sqlite3.rst:670 msgid "" "Commit any pending transaction to the database. If :attr:`autocommit` is " "``True``, or there is no open transaction, this method does nothing. If :" @@ -887,7 +900,7 @@ msgid "" "pending transaction was committed by this method." msgstr "" -#: ../../library/sqlite3.rst:665 +#: ../../library/sqlite3.rst:678 msgid "" "Roll back to the start of any pending transaction. If :attr:`autocommit` is " "``True``, or there is no open transaction, this method does nothing. If :" @@ -895,7 +908,7 @@ msgid "" "pending transaction was rolled back by this method." msgstr "" -#: ../../library/sqlite3.rst:673 +#: ../../library/sqlite3.rst:686 msgid "" "Close the database connection. If :attr:`autocommit` is ``False``, any " "pending transaction is implicitly rolled back. If :attr:`!autocommit` is " @@ -904,67 +917,63 @@ msgid "" "losing pending changes." msgstr "" -#: ../../library/sqlite3.rst:683 +#: ../../library/sqlite3.rst:696 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.execute` on it " "with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:689 +#: ../../library/sqlite3.rst:702 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executemany` on " "it with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:695 +#: ../../library/sqlite3.rst:708 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executescript` " "on it with the given *sql_script*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:701 +#: ../../library/sqlite3.rst:714 msgid "Create or remove a user-defined SQL function." msgstr "" -#: ../../library/sqlite3.rst:703 +#: ../../library/sqlite3.rst:716 msgid "The name of the SQL function." msgstr "" -#: ../../library/sqlite3.rst:706 +#: ../../library/sqlite3.rst:719 msgid "" "The number of arguments the SQL function can accept. If ``-1``, it may take " "any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:710 +#: ../../library/sqlite3.rst:723 msgid "" "A :term:`callable` that is called when the SQL function is invoked. The " "callable must return :ref:`a type natively supported by SQLite `. Set to ``None`` to remove an existing SQL function." msgstr "" -#: ../../library/sqlite3.rst:717 +#: ../../library/sqlite3.rst:730 msgid "" "If ``True``, the created SQL function is marked as `deterministic `_, which allows SQLite to perform additional " "optimizations." msgstr "" -#: ../../library/sqlite3.rst:722 -msgid "If *deterministic* is used with SQLite versions older than 3.8.3." -msgstr "" - -#: ../../library/sqlite3.rst:725 +#: ../../library/sqlite3.rst:735 msgid "Added the *deterministic* parameter." msgstr "新增 *deterministic* 參數。" -#: ../../library/sqlite3.rst:728 ../../library/sqlite3.rst:767 -#: ../../library/sqlite3.rst:830 ../../library/sqlite3.rst:1090 -#: ../../library/sqlite3.rst:1510 ../../library/sqlite3.rst:1553 +#: ../../library/sqlite3.rst:738 ../../library/sqlite3.rst:782 +#: ../../library/sqlite3.rst:850 ../../library/sqlite3.rst:1129 +#: ../../library/sqlite3.rst:1551 ../../library/sqlite3.rst:1594 msgid "Example:" msgstr "範例:" -#: ../../library/sqlite3.rst:730 +#: ../../library/sqlite3.rst:740 msgid "" ">>> import hashlib\n" ">>> def md5sum(t):\n" @@ -986,21 +995,27 @@ msgstr "" "('acbd18db4cc2f85cedef654fccc4a4d8',)\n" ">>> con.close()" -#: ../../library/sqlite3.rst:745 +#: ../../library/sqlite3.rst:754 +msgid "" +"Passing *name*, *narg*, and *func* as keyword arguments is deprecated. These " +"parameters will become positional-only in Python 3.15." +msgstr "" + +#: ../../library/sqlite3.rst:760 msgid "Create or remove a user-defined SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:747 +#: ../../library/sqlite3.rst:762 msgid "The name of the SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:750 +#: ../../library/sqlite3.rst:765 msgid "" "The number of arguments the SQL aggregate function can accept. If ``-1``, it " "may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:754 +#: ../../library/sqlite3.rst:769 msgid "" "A class must implement the following methods: * ``step()``: Add a row to " "the aggregate. * ``finalize()``: Return the final result of the aggregate " @@ -1009,31 +1024,31 @@ msgid "" "*n_arg*. Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:755 +#: ../../library/sqlite3.rst:770 msgid "A class must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:757 +#: ../../library/sqlite3.rst:772 msgid "``step()``: Add a row to the aggregate." msgstr "" -#: ../../library/sqlite3.rst:758 ../../library/sqlite3.rst:814 +#: ../../library/sqlite3.rst:773 ../../library/sqlite3.rst:834 msgid "" "``finalize()``: Return the final result of the aggregate as :ref:`a type " "natively supported by SQLite `." msgstr "" -#: ../../library/sqlite3.rst:761 +#: ../../library/sqlite3.rst:776 msgid "" "The number of arguments that the ``step()`` method must accept is controlled " "by *n_arg*." msgstr "" -#: ../../library/sqlite3.rst:764 +#: ../../library/sqlite3.rst:779 msgid "Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:769 +#: ../../library/sqlite3.rst:784 msgid "" "class MySum:\n" " def __init__(self):\n" @@ -1075,21 +1090,27 @@ msgstr "" "\n" "con.close()" -#: ../../library/sqlite3.rst:799 +#: ../../library/sqlite3.rst:813 +msgid "" +"Passing *name*, *n_arg*, and *aggregate_class* as keyword arguments is " +"deprecated. These parameters will become positional-only in Python 3.15." +msgstr "" + +#: ../../library/sqlite3.rst:819 msgid "Create or remove a user-defined aggregate window function." msgstr "" -#: ../../library/sqlite3.rst:801 +#: ../../library/sqlite3.rst:821 msgid "The name of the SQL aggregate window function to create or remove." msgstr "" -#: ../../library/sqlite3.rst:804 +#: ../../library/sqlite3.rst:824 msgid "" "The number of arguments the SQL aggregate window function can accept. If " "``-1``, it may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:808 +#: ../../library/sqlite3.rst:828 msgid "" "A class that must implement the following methods: * ``step()``: Add a row " "to the current window. * ``value()``: Return the current value of the " @@ -1101,39 +1122,39 @@ msgid "" "function." msgstr "" -#: ../../library/sqlite3.rst:809 +#: ../../library/sqlite3.rst:829 msgid "A class that must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:811 +#: ../../library/sqlite3.rst:831 msgid "``step()``: Add a row to the current window." msgstr "" -#: ../../library/sqlite3.rst:812 +#: ../../library/sqlite3.rst:832 msgid "``value()``: Return the current value of the aggregate." msgstr "" -#: ../../library/sqlite3.rst:813 +#: ../../library/sqlite3.rst:833 msgid "``inverse()``: Remove a row from the current window." msgstr "" -#: ../../library/sqlite3.rst:817 +#: ../../library/sqlite3.rst:837 msgid "" "The number of arguments that the ``step()`` and ``value()`` methods must " "accept is controlled by *num_params*." msgstr "" -#: ../../library/sqlite3.rst:820 +#: ../../library/sqlite3.rst:840 msgid "Set to ``None`` to remove an existing SQL aggregate window function." msgstr "" -#: ../../library/sqlite3.rst:822 +#: ../../library/sqlite3.rst:842 msgid "" "If used with a version of SQLite older than 3.25.0, which does not support " "aggregate window functions." msgstr "" -#: ../../library/sqlite3.rst:832 +#: ../../library/sqlite3.rst:852 msgid "" "# Example taken from https://www.sqlite.org/windowfunctions.html#udfwinfunc\n" "class WindowSumInt:\n" @@ -1181,30 +1202,30 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:886 +#: ../../library/sqlite3.rst:906 msgid "" "Create a collation named *name* using the collating function *callable*. " "*callable* is passed two :class:`string ` arguments, and it should " "return an :class:`integer `:" msgstr "" -#: ../../library/sqlite3.rst:890 +#: ../../library/sqlite3.rst:910 msgid "``1`` if the first is ordered higher than the second" msgstr "" -#: ../../library/sqlite3.rst:891 +#: ../../library/sqlite3.rst:911 msgid "``-1`` if the first is ordered lower than the second" msgstr "" -#: ../../library/sqlite3.rst:892 +#: ../../library/sqlite3.rst:912 msgid "``0`` if they are ordered equal" msgstr "" -#: ../../library/sqlite3.rst:894 +#: ../../library/sqlite3.rst:914 msgid "The following example shows a reverse sorting collation:" msgstr "" -#: ../../library/sqlite3.rst:896 +#: ../../library/sqlite3.rst:916 msgid "" "def collate_reverse(string1, string2):\n" " if string1 == string2:\n" @@ -1242,24 +1263,24 @@ msgstr "" " print(row)\n" "con.close()" -#: ../../library/sqlite3.rst:922 +#: ../../library/sqlite3.rst:942 msgid "Remove a collation function by setting *callable* to ``None``." msgstr "" -#: ../../library/sqlite3.rst:924 +#: ../../library/sqlite3.rst:944 msgid "" "The collation name can contain any Unicode character. Earlier, only ASCII " "characters were allowed." msgstr "" -#: ../../library/sqlite3.rst:931 +#: ../../library/sqlite3.rst:951 msgid "" "Call this method from a different thread to abort any queries that might be " "executing on the connection. Aborted queries will raise an :exc:" "`OperationalError`." msgstr "" -#: ../../library/sqlite3.rst:938 +#: ../../library/sqlite3.rst:958 msgid "" "Register :term:`callable` *authorizer_callback* to be invoked for each " "attempt to access a column of a table in the database. The callback should " @@ -1268,7 +1289,7 @@ msgid "" "underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:945 +#: ../../library/sqlite3.rst:965 msgid "" "The first argument to the callback signifies what kind of operation is to be " "authorized. The second and third argument will be arguments or ``None`` " @@ -1278,7 +1299,7 @@ msgid "" "attempt or ``None`` if this access attempt is directly from input SQL code." msgstr "" -#: ../../library/sqlite3.rst:952 +#: ../../library/sqlite3.rst:972 msgid "" "Please consult the SQLite documentation about the possible values for the " "first argument and the meaning of the second and third argument depending on " @@ -1286,15 +1307,21 @@ msgid "" "module." msgstr "" -#: ../../library/sqlite3.rst:956 +#: ../../library/sqlite3.rst:976 msgid "Passing ``None`` as *authorizer_callback* will disable the authorizer." msgstr "" -#: ../../library/sqlite3.rst:958 +#: ../../library/sqlite3.rst:978 msgid "Added support for disabling the authorizer using ``None``." msgstr "" -#: ../../library/sqlite3.rst:964 +#: ../../library/sqlite3.rst:981 +msgid "" +"Passing *authorizer_callback* as a keyword argument is deprecated. The " +"parameter will become positional-only in Python 3.15." +msgstr "" + +#: ../../library/sqlite3.rst:988 msgid "" "Register :term:`callable` *progress_handler* to be invoked for every *n* " "instructions of the SQLite virtual machine. This is useful if you want to " @@ -1302,26 +1329,32 @@ msgid "" "a GUI." msgstr "" -#: ../../library/sqlite3.rst:969 +#: ../../library/sqlite3.rst:993 msgid "" "If you want to clear any previously installed progress handler, call the " "method with ``None`` for *progress_handler*." msgstr "" -#: ../../library/sqlite3.rst:972 +#: ../../library/sqlite3.rst:996 msgid "" "Returning a non-zero value from the handler function will terminate the " "currently executing query and cause it to raise a :exc:`DatabaseError` " "exception." msgstr "" -#: ../../library/sqlite3.rst:979 +#: ../../library/sqlite3.rst:1000 +msgid "" +"Passing *progress_handler* as a keyword argument is deprecated. The " +"parameter will become positional-only in Python 3.15." +msgstr "" + +#: ../../library/sqlite3.rst:1007 msgid "" "Register :term:`callable` *trace_callback* to be invoked for each SQL " "statement that is actually executed by the SQLite backend." msgstr "" -#: ../../library/sqlite3.rst:982 +#: ../../library/sqlite3.rst:1010 msgid "" "The only argument passed to the callback is the statement (as :class:`str`) " "that is being executed. The return value of the callback is ignored. Note " @@ -1331,18 +1364,24 @@ msgid "" "execution of triggers defined in the current database." msgstr "" -#: ../../library/sqlite3.rst:990 +#: ../../library/sqlite3.rst:1018 msgid "Passing ``None`` as *trace_callback* will disable the trace callback." msgstr "" -#: ../../library/sqlite3.rst:993 +#: ../../library/sqlite3.rst:1021 msgid "" "Exceptions raised in the trace callback are not propagated. As a development " "and debugging aid, use :meth:`~sqlite3.enable_callback_tracebacks` to enable " "printing tracebacks from exceptions raised in the trace callback." msgstr "" -#: ../../library/sqlite3.rst:1003 +#: ../../library/sqlite3.rst:1028 +msgid "" +"Passing *trace_callback* as a keyword argument is deprecated. The parameter " +"will become positional-only in Python 3.15." +msgstr "" + +#: ../../library/sqlite3.rst:1035 msgid "" "Enable the SQLite engine to load SQLite extensions from shared libraries if " "*enabled* is ``True``; else, disallow loading SQLite extensions. SQLite " @@ -1351,7 +1390,7 @@ msgid "" "distributed with SQLite." msgstr "" -#: ../../library/sqlite3.rst:1012 +#: ../../library/sqlite3.rst:1044 msgid "" "The :mod:`!sqlite3` module is not built with loadable extension support by " "default, because some platforms (notably macOS) have SQLite libraries which " @@ -1360,7 +1399,7 @@ msgid "" "program:`configure`." msgstr "" -#: ../../library/sqlite3.rst:1019 +#: ../../library/sqlite3.rst:1051 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." @@ -1368,11 +1407,11 @@ msgstr "" "引發一個附帶引數 ``connection``、``enabled`` 的\\ :ref:`稽核事件 ` " "``sqlite3.enable_load_extension``。" -#: ../../library/sqlite3.rst:1023 +#: ../../library/sqlite3.rst:1055 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "加入 ``sqlite3.enable_load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1029 +#: ../../library/sqlite3.rst:1061 msgid "" "con.enable_load_extension(True)\n" "\n" @@ -1402,24 +1441,24 @@ msgid "" " print(row)" msgstr "" -#: ../../library/sqlite3.rst:1055 +#: ../../library/sqlite3.rst:1087 msgid "" "Load an SQLite extension from a shared library. Enable extension loading " "with :meth:`enable_load_extension` before calling this method." msgstr "" -#: ../../library/sqlite3.rst:1059 +#: ../../library/sqlite3.rst:1091 msgid "The path to the SQLite extension." msgstr "" -#: ../../library/sqlite3.rst:1063 +#: ../../library/sqlite3.rst:1095 msgid "" "Entry point name. If ``None`` (the default), SQLite will come up with an " "entry point name of its own; see the SQLite docs `Loading an Extension`_ for " "details." msgstr "" -#: ../../library/sqlite3.rst:1072 +#: ../../library/sqlite3.rst:1104 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." @@ -1427,22 +1466,29 @@ msgstr "" "引發一個附帶引數 ``connection``、``path`` 的\\ :ref:`稽核事件 ` " "``sqlite3.load_extension``。" -#: ../../library/sqlite3.rst:1076 +#: ../../library/sqlite3.rst:1108 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "加入 ``sqlite3.load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1079 +#: ../../library/sqlite3.rst:1111 msgid "Added the *entrypoint* parameter." msgstr "新增 *entrypoint* 參數。" -#: ../../library/sqlite3.rst:1086 +#: ../../library/sqlite3.rst:1118 msgid "" "Return an :term:`iterator` to dump the database as SQL source code. Useful " "when saving an in-memory database for later restoration. Similar to the ``." "dump`` command in the :program:`sqlite3` shell." msgstr "" -#: ../../library/sqlite3.rst:1092 +#: ../../library/sqlite3.rst:1122 +msgid "" +"An optional ``LIKE`` pattern for database objects to dump, e.g. " +"``prefix_%``. If ``None`` (the default), all database objects will be " +"included." +msgstr "" + +#: ../../library/sqlite3.rst:1131 msgid "" "# Convert file example.db to SQL dump file dump.sql\n" "con = sqlite3.connect('example.db')\n" @@ -1452,31 +1498,36 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:1103 ../../library/sqlite3.rst:1175 +#: ../../library/sqlite3.rst:1142 ../../library/sqlite3.rst:1216 msgid ":ref:`sqlite3-howto-encoding`" msgstr ":ref:`sqlite3-howto-encoding`" -#: ../../library/sqlite3.rst:1108 +#: ../../library/sqlite3.rst:1144 +#, fuzzy +msgid "Added the *filter* parameter." +msgstr "新增 *uri* 參數。" + +#: ../../library/sqlite3.rst:1149 msgid "Create a backup of an SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1110 +#: ../../library/sqlite3.rst:1151 msgid "" "Works even if the database is being accessed by other clients or " "concurrently by the same connection." msgstr "" -#: ../../library/sqlite3.rst:1113 +#: ../../library/sqlite3.rst:1154 msgid "The database connection to save the backup to." msgstr "" -#: ../../library/sqlite3.rst:1116 +#: ../../library/sqlite3.rst:1157 msgid "" "The number of pages to copy at a time. If equal to or less than ``0``, the " "entire database is copied in a single step. Defaults to ``-1``." msgstr "" -#: ../../library/sqlite3.rst:1122 +#: ../../library/sqlite3.rst:1163 msgid "" "If set to a :term:`callable`, it is invoked with three integer arguments for " "every backup iteration: the *status* of the last iteration, the *remaining* " @@ -1484,24 +1535,24 @@ msgid "" "Defaults to ``None``." msgstr "" -#: ../../library/sqlite3.rst:1131 +#: ../../library/sqlite3.rst:1172 msgid "" "The name of the database to back up. Either ``\"main\"`` (the default) for " "the main database, ``\"temp\"`` for the temporary database, or the name of a " "custom database as attached using the ``ATTACH DATABASE`` SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1138 +#: ../../library/sqlite3.rst:1179 msgid "" "The number of seconds to sleep between successive attempts to back up " "remaining pages." msgstr "" -#: ../../library/sqlite3.rst:1142 +#: ../../library/sqlite3.rst:1183 msgid "Example 1, copy an existing database into another:" msgstr "" -#: ../../library/sqlite3.rst:1144 +#: ../../library/sqlite3.rst:1185 msgid "" "def progress(status, remaining, total):\n" " print(f'Copied {total-remaining} of {total} pages...')\n" @@ -1523,11 +1574,11 @@ msgstr "" "dst.close()\n" "src.close()" -#: ../../library/sqlite3.rst:1161 +#: ../../library/sqlite3.rst:1202 msgid "Example 2, copy an existing database into a transient copy:" msgstr "" -#: ../../library/sqlite3.rst:1163 +#: ../../library/sqlite3.rst:1204 msgid "" "src = sqlite3.connect('example.db')\n" "dst = sqlite3.connect(':memory:')\n" @@ -1541,25 +1592,25 @@ msgstr "" "dst.close()\n" "src.close()" -#: ../../library/sqlite3.rst:1179 +#: ../../library/sqlite3.rst:1220 msgid "Get a connection runtime limit." msgstr "" -#: ../../library/sqlite3.rst:1181 +#: ../../library/sqlite3.rst:1222 msgid "The `SQLite limit category`_ to be queried." msgstr "" -#: ../../library/sqlite3.rst:1186 ../../library/sqlite3.rst:1223 +#: ../../library/sqlite3.rst:1227 ../../library/sqlite3.rst:1264 msgid "If *category* is not recognised by the underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:1189 +#: ../../library/sqlite3.rst:1230 msgid "" "Example, query the maximum length of an SQL statement for :class:" "`Connection` ``con`` (the default is 1000000000):" msgstr "" -#: ../../library/sqlite3.rst:1199 +#: ../../library/sqlite3.rst:1240 msgid "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" "1000000000" @@ -1567,7 +1618,7 @@ msgstr "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" "1000000000" -#: ../../library/sqlite3.rst:1209 +#: ../../library/sqlite3.rst:1250 msgid "" "Set a connection runtime limit. Attempts to increase a limit above its hard " "upper bound are silently truncated to the hard upper bound. Regardless of " @@ -1575,22 +1626,22 @@ msgid "" "returned." msgstr "" -#: ../../library/sqlite3.rst:1214 +#: ../../library/sqlite3.rst:1255 msgid "The `SQLite limit category`_ to be set." msgstr "" -#: ../../library/sqlite3.rst:1217 +#: ../../library/sqlite3.rst:1258 msgid "" "The value of the new limit. If negative, the current limit is unchanged." msgstr "" -#: ../../library/sqlite3.rst:1226 +#: ../../library/sqlite3.rst:1267 msgid "" "Example, limit the number of attached databases to 1 for :class:`Connection` " "``con`` (the default limit is 10):" msgstr "" -#: ../../library/sqlite3.rst:1229 +#: ../../library/sqlite3.rst:1270 msgid "" ">>> con.setlimit(sqlite3.SQLITE_LIMIT_ATTACHED, 1)\n" "10\n" @@ -1602,25 +1653,25 @@ msgstr "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_ATTACHED)\n" "1" -#: ../../library/sqlite3.rst:1247 +#: ../../library/sqlite3.rst:1288 msgid "Query a boolean connection configuration option." msgstr "" -#: ../../library/sqlite3.rst:1249 ../../library/sqlite3.rst:1260 +#: ../../library/sqlite3.rst:1290 ../../library/sqlite3.rst:1301 msgid "A :ref:`SQLITE_DBCONFIG code `." msgstr "" -#: ../../library/sqlite3.rst:1258 +#: ../../library/sqlite3.rst:1299 msgid "Set a boolean connection configuration option." msgstr "" -#: ../../library/sqlite3.rst:1263 +#: ../../library/sqlite3.rst:1304 msgid "" "``True`` if the configuration option should be enabled (default); ``False`` " "if it should be disabled." msgstr "" -#: ../../library/sqlite3.rst:1271 +#: ../../library/sqlite3.rst:1312 msgid "" "Serialize a database into a :class:`bytes` object. For an ordinary on-disk " "database file, the serialization is just a copy of the disk file. For an in-" @@ -1629,17 +1680,17 @@ msgid "" "backed up to disk." msgstr "" -#: ../../library/sqlite3.rst:1277 +#: ../../library/sqlite3.rst:1318 msgid "The database name to be serialized. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1285 +#: ../../library/sqlite3.rst:1326 msgid "" "This method is only available if the underlying SQLite library has the " "serialize API." msgstr "" -#: ../../library/sqlite3.rst:1293 +#: ../../library/sqlite3.rst:1334 msgid "" "Deserialize a :meth:`serialized ` database into a :class:" "`Connection`. This method causes the database connection to disconnect from " @@ -1647,96 +1698,96 @@ msgid "" "serialization contained in *data*." msgstr "" -#: ../../library/sqlite3.rst:1299 +#: ../../library/sqlite3.rst:1340 msgid "A serialized database." msgstr "" -#: ../../library/sqlite3.rst:1302 +#: ../../library/sqlite3.rst:1343 msgid "The database name to deserialize into. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1306 +#: ../../library/sqlite3.rst:1347 msgid "" "If the database connection is currently involved in a read transaction or a " "backup operation." msgstr "" -#: ../../library/sqlite3.rst:1310 +#: ../../library/sqlite3.rst:1351 msgid "If *data* does not contain a valid SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1313 +#: ../../library/sqlite3.rst:1354 msgid "If :func:`len(data) ` is larger than ``2**63 - 1``." msgstr "" -#: ../../library/sqlite3.rst:1318 +#: ../../library/sqlite3.rst:1359 msgid "" "This method is only available if the underlying SQLite library has the " "deserialize API." msgstr "" -#: ../../library/sqlite3.rst:1325 +#: ../../library/sqlite3.rst:1366 msgid "" "This attribute controls :pep:`249`-compliant transaction behaviour. :attr:`!" "autocommit` has three allowed values:" msgstr "" -#: ../../library/sqlite3.rst:1328 +#: ../../library/sqlite3.rst:1369 msgid "" "``False``: Select :pep:`249`-compliant transaction behaviour, implying that :" "mod:`!sqlite3` ensures a transaction is always open. Use :meth:`commit` and :" "meth:`rollback` to close transactions." msgstr "" -#: ../../library/sqlite3.rst:1332 +#: ../../library/sqlite3.rst:1373 msgid "This is the recommended value of :attr:`!autocommit`." msgstr "" -#: ../../library/sqlite3.rst:1334 +#: ../../library/sqlite3.rst:1375 msgid "" "``True``: Use SQLite's `autocommit mode`_. :meth:`commit` and :meth:" "`rollback` have no effect in this mode." msgstr "" -#: ../../library/sqlite3.rst:1337 +#: ../../library/sqlite3.rst:1378 msgid "" ":data:`LEGACY_TRANSACTION_CONTROL`: Pre-Python 3.12 (non-:pep:`249`-" "compliant) transaction control. See :attr:`isolation_level` for more details." msgstr "" -#: ../../library/sqlite3.rst:1341 +#: ../../library/sqlite3.rst:1382 msgid "This is currently the default value of :attr:`!autocommit`." msgstr "" -#: ../../library/sqlite3.rst:1343 +#: ../../library/sqlite3.rst:1384 msgid "" "Changing :attr:`!autocommit` to ``False`` will open a new transaction, and " "changing it to ``True`` will commit any pending transaction." msgstr "" -#: ../../library/sqlite3.rst:1346 +#: ../../library/sqlite3.rst:1387 msgid "See :ref:`sqlite3-transaction-control-autocommit` for more details." msgstr "更多詳情請見 :ref:`sqlite3-transaction-control-autocommit`。" -#: ../../library/sqlite3.rst:1350 +#: ../../library/sqlite3.rst:1391 msgid "" "The :attr:`isolation_level` attribute has no effect unless :attr:" "`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." msgstr "" -#: ../../library/sqlite3.rst:1357 +#: ../../library/sqlite3.rst:1398 msgid "" "This read-only attribute corresponds to the low-level SQLite `autocommit " "mode`_." msgstr "" -#: ../../library/sqlite3.rst:1360 +#: ../../library/sqlite3.rst:1401 msgid "" "``True`` if a transaction is active (there are uncommitted changes), " "``False`` otherwise." msgstr "" -#: ../../library/sqlite3.rst:1367 +#: ../../library/sqlite3.rst:1408 msgid "" "Controls the :ref:`legacy transaction handling mode ` of :mod:`!sqlite3`. If set to ``None``, " @@ -1746,13 +1797,13 @@ msgid "" "` is performed." msgstr "" -#: ../../library/sqlite3.rst:1375 +#: ../../library/sqlite3.rst:1416 msgid "" "If not overridden by the *isolation_level* parameter of :func:`connect`, the " "default is ``\"\"``, which is an alias for ``\"DEFERRED\"``." msgstr "" -#: ../../library/sqlite3.rst:1380 +#: ../../library/sqlite3.rst:1421 msgid "" "Using :attr:`autocommit` to control transaction handling is recommended over " "using :attr:`!isolation_level`. :attr:`!isolation_level` has no effect " @@ -1760,7 +1811,7 @@ msgid "" "default)." msgstr "" -#: ../../library/sqlite3.rst:1387 +#: ../../library/sqlite3.rst:1428 msgid "" "The initial :attr:`~Cursor.row_factory` for :class:`Cursor` objects created " "from this connection. Assigning to this attribute does not affect the :attr:" @@ -1769,33 +1820,33 @@ msgid "" "`tuple`." msgstr "" -#: ../../library/sqlite3.rst:1394 ../../library/sqlite3.rst:1680 -#: ../../library/sqlite3.rst:1703 +#: ../../library/sqlite3.rst:1435 ../../library/sqlite3.rst:1721 +#: ../../library/sqlite3.rst:1744 msgid "See :ref:`sqlite3-howto-row-factory` for more details." msgstr "更多詳情請見 :ref:`sqlite3-howto-row-factory`。" -#: ../../library/sqlite3.rst:1398 +#: ../../library/sqlite3.rst:1439 msgid "" "A :term:`callable` that accepts a :class:`bytes` parameter and returns a " "text representation of it. The callable is invoked for SQLite values with " "the ``TEXT`` data type. By default, this attribute is set to :class:`str`." msgstr "" -#: ../../library/sqlite3.rst:1403 +#: ../../library/sqlite3.rst:1444 msgid "See :ref:`sqlite3-howto-encoding` for more details." msgstr "更多詳情請見 :ref:`sqlite3-howto-encoding`。" -#: ../../library/sqlite3.rst:1407 +#: ../../library/sqlite3.rst:1448 msgid "" "Return the total number of database rows that have been modified, inserted, " "or deleted since the database connection was opened." msgstr "" -#: ../../library/sqlite3.rst:1414 +#: ../../library/sqlite3.rst:1455 msgid "Cursor objects" msgstr "Cursor 物件" -#: ../../library/sqlite3.rst:1416 +#: ../../library/sqlite3.rst:1457 msgid "" "A ``Cursor`` object represents a `database cursor`_ which is used to execute " "SQL statements, and manage the context of a fetch operation. Cursors are " @@ -1803,14 +1854,14 @@ msgid "" "`connection shortcut methods `." msgstr "" -#: ../../library/sqlite3.rst:1423 +#: ../../library/sqlite3.rst:1464 msgid "" "Cursor objects are :term:`iterators `, meaning that if you :meth:" "`~Cursor.execute` a ``SELECT`` query, you can simply iterate over the cursor " "to fetch the resulting rows:" msgstr "" -#: ../../library/sqlite3.rst:1434 +#: ../../library/sqlite3.rst:1475 msgid "" "for row in cur.execute(\"SELECT t FROM data\"):\n" " print(row)" @@ -1818,32 +1869,32 @@ msgstr "" "for row in cur.execute(\"SELECT t FROM data\"):\n" " print(row)" -#: ../../library/sqlite3.rst:1448 +#: ../../library/sqlite3.rst:1489 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr "" -#: ../../library/sqlite3.rst:1455 +#: ../../library/sqlite3.rst:1496 msgid "" "Execute a single SQL statement, optionally binding Python values using :ref:" "`placeholders `." msgstr "" -#: ../../library/sqlite3.rst:1459 +#: ../../library/sqlite3.rst:1500 msgid "A single SQL statement." msgstr "單一個 SQL 陳述式。" -#: ../../library/sqlite3.rst:1462 +#: ../../library/sqlite3.rst:1503 msgid "" "Python values to bind to placeholders in *sql*. A :class:`!dict` if named " "placeholders are used. A :term:`!sequence` if unnamed placeholders are used. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1469 +#: ../../library/sqlite3.rst:1510 msgid "If *sql* contains more than one SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1472 +#: ../../library/sqlite3.rst:1513 msgid "" "If :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`, :" "attr:`~Connection.isolation_level` is not ``None``, *sql* is an ``INSERT``, " @@ -1851,7 +1902,7 @@ msgid "" "transaction, a transaction is implicitly opened before executing *sql*." msgstr "" -#: ../../library/sqlite3.rst:1481 +#: ../../library/sqlite3.rst:1522 msgid "" ":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and *parameters* is a sequence instead of a :class:" @@ -1859,37 +1910,37 @@ msgid "" "instead." msgstr "" -#: ../../library/sqlite3.rst:1487 +#: ../../library/sqlite3.rst:1528 msgid "Use :meth:`executescript` to execute multiple SQL statements." msgstr "" -#: ../../library/sqlite3.rst:1491 +#: ../../library/sqlite3.rst:1532 msgid "" "For every item in *parameters*, repeatedly execute the :ref:`parameterized " "` :abbr:`DML (Data Manipulation Language)` SQL " "statement *sql*." msgstr "" -#: ../../library/sqlite3.rst:1495 +#: ../../library/sqlite3.rst:1536 msgid "Uses the same implicit transaction handling as :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:1497 +#: ../../library/sqlite3.rst:1538 msgid "A single SQL DML statement." msgstr "" -#: ../../library/sqlite3.rst:1500 +#: ../../library/sqlite3.rst:1541 msgid "" "An :term:`!iterable` of parameters to bind with the placeholders in *sql*. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1506 +#: ../../library/sqlite3.rst:1547 msgid "" "If *sql* contains more than one SQL statement, or is not a DML statement." msgstr "" -#: ../../library/sqlite3.rst:1512 +#: ../../library/sqlite3.rst:1553 msgid "" "rows = [\n" " (\"row1\",),\n" @@ -1905,13 +1956,13 @@ msgstr "" "# cur 是一個 sqlite3.Cursor 物件\n" "cur.executemany(\"INSERT INTO data VALUES(?)\", rows)" -#: ../../library/sqlite3.rst:1527 +#: ../../library/sqlite3.rst:1568 msgid "" "Any resulting rows are discarded, including DML statements with `RETURNING " "clauses`_." msgstr "" -#: ../../library/sqlite3.rst:1534 +#: ../../library/sqlite3.rst:1575 msgid "" ":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and the items in *parameters* are sequences instead " @@ -1919,7 +1970,7 @@ msgid "" "be raised instead." msgstr "" -#: ../../library/sqlite3.rst:1543 +#: ../../library/sqlite3.rst:1584 msgid "" "Execute the SQL statements in *sql_script*. If the :attr:`~Connection." "autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and there is a pending " @@ -1928,11 +1979,11 @@ msgid "" "added to *sql_script*." msgstr "" -#: ../../library/sqlite3.rst:1551 +#: ../../library/sqlite3.rst:1592 msgid "*sql_script* must be a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:1555 +#: ../../library/sqlite3.rst:1596 msgid "" "# cur is an sqlite3.Cursor object\n" "cur.executescript(\"\"\"\n" @@ -1952,20 +2003,20 @@ msgstr "" " COMMIT;\n" "\"\"\")" -#: ../../library/sqlite3.rst:1568 +#: ../../library/sqlite3.rst:1609 msgid "" "If :attr:`~Cursor.row_factory` is ``None``, return the next row query result " "set as a :class:`tuple`. Else, pass it to the row factory and return its " "result. Return ``None`` if no more data is available." msgstr "" -#: ../../library/sqlite3.rst:1576 +#: ../../library/sqlite3.rst:1617 msgid "" "Return the next set of rows of a query result as a :class:`list`. Return an " "empty list if no more rows are available." msgstr "" -#: ../../library/sqlite3.rst:1579 +#: ../../library/sqlite3.rst:1620 msgid "" "The number of rows to fetch per call is specified by the *size* parameter. " "If *size* is not given, :attr:`arraysize` determines the number of rows to " @@ -1973,7 +2024,7 @@ msgid "" "available are returned." msgstr "" -#: ../../library/sqlite3.rst:1585 +#: ../../library/sqlite3.rst:1626 msgid "" "Note there are performance considerations involved with the *size* " "parameter. For optimal performance, it is usually best to use the arraysize " @@ -1981,36 +2032,36 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:1592 +#: ../../library/sqlite3.rst:1633 msgid "" "Return all (remaining) rows of a query result as a :class:`list`. Return an " "empty list if no rows are available. Note that the :attr:`arraysize` " "attribute can affect the performance of this operation." msgstr "" -#: ../../library/sqlite3.rst:1599 +#: ../../library/sqlite3.rst:1640 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:1601 +#: ../../library/sqlite3.rst:1642 msgid "" "The cursor will be unusable from this point forward; a :exc:" "`ProgrammingError` exception will be raised if any operation is attempted " "with the cursor." msgstr "" -#: ../../library/sqlite3.rst:1606 ../../library/sqlite3.rst:1610 +#: ../../library/sqlite3.rst:1647 ../../library/sqlite3.rst:1651 msgid "Required by the DB-API. Does nothing in :mod:`!sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:1614 +#: ../../library/sqlite3.rst:1655 msgid "" "Read/write attribute that controls the number of rows returned by :meth:" "`fetchmany`. The default value is 1 which means a single row would be " "fetched per call." msgstr "" -#: ../../library/sqlite3.rst:1619 +#: ../../library/sqlite3.rst:1660 msgid "" "Read-only attribute that provides the SQLite database :class:`Connection` " "belonging to the cursor. A :class:`Cursor` object created by calling :meth:" @@ -2018,7 +2069,7 @@ msgid "" "that refers to *con*:" msgstr "" -#: ../../library/sqlite3.rst:1624 +#: ../../library/sqlite3.rst:1665 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> cur = con.cursor()\n" @@ -2032,18 +2083,18 @@ msgstr "" "True\n" ">>> con.close()" -#: ../../library/sqlite3.rst:1634 +#: ../../library/sqlite3.rst:1675 msgid "" "Read-only attribute that provides the column names of the last query. To " "remain compatible with the Python DB API, it returns a 7-tuple for each " "column where the last six items of each tuple are ``None``." msgstr "" -#: ../../library/sqlite3.rst:1638 +#: ../../library/sqlite3.rst:1679 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: ../../library/sqlite3.rst:1642 +#: ../../library/sqlite3.rst:1683 msgid "" "Read-only attribute that provides the row id of the last inserted row. It is " "only updated after successful ``INSERT`` or ``REPLACE`` statements using " @@ -2053,15 +2104,15 @@ msgid "" "``None``." msgstr "" -#: ../../library/sqlite3.rst:1650 +#: ../../library/sqlite3.rst:1691 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: ../../library/sqlite3.rst:1652 +#: ../../library/sqlite3.rst:1693 msgid "Added support for the ``REPLACE`` statement." msgstr "新增 ``REPLACE`` 陳述式的支援。" -#: ../../library/sqlite3.rst:1657 +#: ../../library/sqlite3.rst:1698 msgid "" "Read-only attribute that provides the number of modified rows for " "``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " @@ -2071,7 +2122,7 @@ msgid "" "resulting rows must be fetched in order for :attr:`!rowcount` to be updated." msgstr "" -#: ../../library/sqlite3.rst:1668 +#: ../../library/sqlite3.rst:1709 msgid "" "Control how a row fetched from this :class:`!Cursor` is represented. If " "``None``, a row is represented as a :class:`tuple`. Can be set to the " @@ -2080,18 +2131,18 @@ msgid "" "and returns a custom object representing an SQLite row." msgstr "" -#: ../../library/sqlite3.rst:1675 +#: ../../library/sqlite3.rst:1716 msgid "" "Defaults to what :attr:`Connection.row_factory` was set to when the :class:`!" "Cursor` was created. Assigning to this attribute does not affect :attr:" "`Connection.row_factory` of the parent connection." msgstr "" -#: ../../library/sqlite3.rst:1691 +#: ../../library/sqlite3.rst:1732 msgid "Row objects" msgstr "Row 物件" -#: ../../library/sqlite3.rst:1695 +#: ../../library/sqlite3.rst:1736 msgid "" "A :class:`!Row` instance serves as a highly optimized :attr:`~Connection." "row_factory` for :class:`Connection` objects. It supports iteration, " @@ -2099,28 +2150,28 @@ msgid "" "index." msgstr "" -#: ../../library/sqlite3.rst:1700 +#: ../../library/sqlite3.rst:1741 msgid "" "Two :class:`!Row` objects compare equal if they have identical column names " "and values." msgstr "" -#: ../../library/sqlite3.rst:1707 +#: ../../library/sqlite3.rst:1748 msgid "" "Return a :class:`list` of column names as :class:`strings `. " "Immediately after a query, it is the first member of each tuple in :attr:" "`Cursor.description`." msgstr "" -#: ../../library/sqlite3.rst:1711 +#: ../../library/sqlite3.rst:1752 msgid "Added support of slicing." msgstr "新增對切片的支援。" -#: ../../library/sqlite3.rst:1718 +#: ../../library/sqlite3.rst:1759 msgid "Blob objects" msgstr "Blob 物件" -#: ../../library/sqlite3.rst:1724 +#: ../../library/sqlite3.rst:1765 msgid "" "A :class:`Blob` instance is a :term:`file-like object` that can read and " "write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. Call :func:" @@ -2128,13 +2179,13 @@ msgid "" "and :term:`slices ` for direct access to the blob data." msgstr "" -#: ../../library/sqlite3.rst:1729 +#: ../../library/sqlite3.rst:1770 msgid "" "Use the :class:`Blob` as a :term:`context manager` to ensure that the blob " "handle is closed after use." msgstr "" -#: ../../library/sqlite3.rst:1732 +#: ../../library/sqlite3.rst:1773 msgid "" "con = sqlite3.connect(\":memory:\")\n" "con.execute(\"CREATE TABLE test(blob_col blob)\")\n" @@ -2156,18 +2207,18 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:1760 +#: ../../library/sqlite3.rst:1801 msgid "Close the blob." msgstr "" -#: ../../library/sqlite3.rst:1762 +#: ../../library/sqlite3.rst:1803 msgid "" "The blob will be unusable from this point onward. An :class:`~sqlite3." "Error` (or subclass) exception will be raised if any further operation is " "attempted with the blob." msgstr "" -#: ../../library/sqlite3.rst:1768 +#: ../../library/sqlite3.rst:1809 msgid "" "Read *length* bytes of data from the blob at the current offset position. If " "the end of the blob is reached, the data up to :abbr:`EOF (End of File)` " @@ -2175,18 +2226,18 @@ msgid "" "`~Blob.read` will read until the end of the blob." msgstr "" -#: ../../library/sqlite3.rst:1776 +#: ../../library/sqlite3.rst:1817 msgid "" "Write *data* to the blob at the current offset. This function cannot change " "the blob length. Writing beyond the end of the blob will raise :exc:" "`ValueError`." msgstr "" -#: ../../library/sqlite3.rst:1782 +#: ../../library/sqlite3.rst:1823 msgid "Return the current access position of the blob." msgstr "" -#: ../../library/sqlite3.rst:1786 +#: ../../library/sqlite3.rst:1827 msgid "" "Set the current access position of the blob to *offset*. The *origin* " "argument defaults to :const:`os.SEEK_SET` (absolute blob positioning). Other " @@ -2194,26 +2245,26 @@ msgid "" "position) and :const:`os.SEEK_END` (seek relative to the blob’s end)." msgstr "" -#: ../../library/sqlite3.rst:1794 +#: ../../library/sqlite3.rst:1835 msgid "PrepareProtocol objects" msgstr "PrepareProtocol 物件" -#: ../../library/sqlite3.rst:1798 +#: ../../library/sqlite3.rst:1839 msgid "" "The PrepareProtocol type's single purpose is to act as a :pep:`246` style " "adaption protocol for objects that can :ref:`adapt themselves ` to :ref:`native SQLite types `." msgstr "" -#: ../../library/sqlite3.rst:1806 +#: ../../library/sqlite3.rst:1847 msgid "Exceptions" msgstr "例外" -#: ../../library/sqlite3.rst:1808 +#: ../../library/sqlite3.rst:1849 msgid "The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`)." msgstr "" -#: ../../library/sqlite3.rst:1812 +#: ../../library/sqlite3.rst:1853 msgid "" "This exception is not currently raised by the :mod:`!sqlite3` module, but " "may be raised by applications using :mod:`!sqlite3`, for example if a user-" @@ -2221,39 +2272,39 @@ msgid "" "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1819 +#: ../../library/sqlite3.rst:1860 msgid "" "The base class of the other exceptions in this module. Use this to catch all " "errors with one single :keyword:`except` statement. ``Error`` is a subclass " "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1823 +#: ../../library/sqlite3.rst:1864 msgid "" "If the exception originated from within the SQLite library, the following " "two attributes are added to the exception:" msgstr "" -#: ../../library/sqlite3.rst:1828 +#: ../../library/sqlite3.rst:1869 msgid "" "The numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1835 +#: ../../library/sqlite3.rst:1876 msgid "" "The symbolic name of the numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1842 +#: ../../library/sqlite3.rst:1883 msgid "" "Exception raised for misuse of the low-level SQLite C API. In other words, " "if this exception is raised, it probably indicates a bug in the :mod:`!" "sqlite3` module. ``InterfaceError`` is a subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1849 +#: ../../library/sqlite3.rst:1890 msgid "" "Exception raised for errors that are related to the database. This serves as " "the base exception for several types of database errors. It is only raised " @@ -2261,14 +2312,14 @@ msgid "" "subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1856 +#: ../../library/sqlite3.rst:1897 msgid "" "Exception raised for errors caused by problems with the processed data, like " "numeric values out of range, and strings which are too long. ``DataError`` " "is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1862 +#: ../../library/sqlite3.rst:1903 msgid "" "Exception raised for errors that are related to the database's operation, " "and not necessarily under the control of the programmer. For example, the " @@ -2276,20 +2327,20 @@ msgid "" "``OperationalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1870 +#: ../../library/sqlite3.rst:1911 msgid "" "Exception raised when the relational integrity of the database is affected, " "e.g. a foreign key check fails. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1875 +#: ../../library/sqlite3.rst:1916 msgid "" "Exception raised when SQLite encounters an internal error. If this is " "raised, it may indicate that there is a problem with the runtime SQLite " "library. ``InternalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1882 +#: ../../library/sqlite3.rst:1923 msgid "" "Exception raised for :mod:`!sqlite3` API programming errors, for example " "supplying the wrong number of bindings to a query, or trying to operate on a " @@ -2297,7 +2348,7 @@ msgid "" "`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1889 +#: ../../library/sqlite3.rst:1930 msgid "" "Exception raised in case a method or database API is not supported by the " "underlying SQLite library. For example, setting *deterministic* to ``True`` " @@ -2306,78 +2357,78 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1899 +#: ../../library/sqlite3.rst:1940 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:1901 +#: ../../library/sqlite3.rst:1942 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:1904 +#: ../../library/sqlite3.rst:1945 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:1907 ../../library/sqlite3.rst:1924 +#: ../../library/sqlite3.rst:1948 ../../library/sqlite3.rst:1965 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:1907 ../../library/sqlite3.rst:1924 +#: ../../library/sqlite3.rst:1948 ../../library/sqlite3.rst:1965 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:1909 ../../library/sqlite3.rst:1926 +#: ../../library/sqlite3.rst:1950 ../../library/sqlite3.rst:1967 msgid "``None``" msgstr "``None``" -#: ../../library/sqlite3.rst:1909 ../../library/sqlite3.rst:1926 +#: ../../library/sqlite3.rst:1950 ../../library/sqlite3.rst:1967 msgid "``NULL``" msgstr "``NULL``" -#: ../../library/sqlite3.rst:1911 ../../library/sqlite3.rst:1928 +#: ../../library/sqlite3.rst:1952 ../../library/sqlite3.rst:1969 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../library/sqlite3.rst:1911 ../../library/sqlite3.rst:1928 +#: ../../library/sqlite3.rst:1952 ../../library/sqlite3.rst:1969 msgid "``INTEGER``" msgstr "``INTEGER``" -#: ../../library/sqlite3.rst:1913 ../../library/sqlite3.rst:1930 +#: ../../library/sqlite3.rst:1954 ../../library/sqlite3.rst:1971 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/sqlite3.rst:1913 ../../library/sqlite3.rst:1930 +#: ../../library/sqlite3.rst:1954 ../../library/sqlite3.rst:1971 msgid "``REAL``" msgstr "``REAL``" -#: ../../library/sqlite3.rst:1915 +#: ../../library/sqlite3.rst:1956 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/sqlite3.rst:1915 ../../library/sqlite3.rst:1932 +#: ../../library/sqlite3.rst:1956 ../../library/sqlite3.rst:1973 msgid "``TEXT``" msgstr "``TEXT``" -#: ../../library/sqlite3.rst:1917 ../../library/sqlite3.rst:1935 +#: ../../library/sqlite3.rst:1958 ../../library/sqlite3.rst:1976 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../library/sqlite3.rst:1917 ../../library/sqlite3.rst:1935 +#: ../../library/sqlite3.rst:1958 ../../library/sqlite3.rst:1976 msgid "``BLOB``" msgstr "``BLOB``" -#: ../../library/sqlite3.rst:1921 +#: ../../library/sqlite3.rst:1962 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:1932 +#: ../../library/sqlite3.rst:1973 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:1938 +#: ../../library/sqlite3.rst:1979 msgid "" "The type system of the :mod:`!sqlite3` module is extensible in two ways: you " "can store additional Python types in an SQLite database via :ref:`object " @@ -2386,47 +2437,47 @@ msgid "" "converters>`." msgstr "" -#: ../../library/sqlite3.rst:1948 +#: ../../library/sqlite3.rst:1989 msgid "Default adapters and converters (deprecated)" msgstr "" -#: ../../library/sqlite3.rst:1952 +#: ../../library/sqlite3.rst:1993 msgid "" "The default adapters and converters are deprecated as of Python 3.12. " "Instead, use the :ref:`sqlite3-adapter-converter-recipes` and tailor them to " "your needs." msgstr "" -#: ../../library/sqlite3.rst:1956 +#: ../../library/sqlite3.rst:1997 msgid "The deprecated default adapters and converters consist of:" msgstr "" -#: ../../library/sqlite3.rst:1958 +#: ../../library/sqlite3.rst:1999 msgid "" "An adapter for :class:`datetime.date` objects to :class:`strings ` in " "`ISO 8601`_ format." msgstr "" -#: ../../library/sqlite3.rst:1960 +#: ../../library/sqlite3.rst:2001 msgid "" "An adapter for :class:`datetime.datetime` objects to strings in ISO 8601 " "format." msgstr "" -#: ../../library/sqlite3.rst:1962 +#: ../../library/sqlite3.rst:2003 msgid "" "A converter for :ref:`declared ` \"date\" types to :" "class:`datetime.date` objects." msgstr "" -#: ../../library/sqlite3.rst:1964 +#: ../../library/sqlite3.rst:2005 msgid "" "A converter for declared \"timestamp\" types to :class:`datetime.datetime` " "objects. Fractional parts will be truncated to 6 digits (microsecond " "precision)." msgstr "" -#: ../../library/sqlite3.rst:1970 +#: ../../library/sqlite3.rst:2011 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -2434,42 +2485,42 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:1983 +#: ../../library/sqlite3.rst:2024 msgid "Command-line interface" msgstr "命令列介面" -#: ../../library/sqlite3.rst:1985 +#: ../../library/sqlite3.rst:2026 msgid "" "The :mod:`!sqlite3` module can be invoked as a script, using the " "interpreter's :option:`-m` switch, in order to provide a simple SQLite " "shell. The argument signature is as follows::" msgstr "" -#: ../../library/sqlite3.rst:1990 +#: ../../library/sqlite3.rst:2031 msgid "python -m sqlite3 [-h] [-v] [filename] [sql]" msgstr "python -m sqlite3 [-h] [-v] [filename] [sql]" -#: ../../library/sqlite3.rst:1992 +#: ../../library/sqlite3.rst:2033 msgid "Type ``.quit`` or CTRL-D to exit the shell." msgstr "" -#: ../../library/sqlite3.rst:1998 +#: ../../library/sqlite3.rst:2039 msgid "Print CLI help." msgstr "" -#: ../../library/sqlite3.rst:2002 +#: ../../library/sqlite3.rst:2043 msgid "Print underlying SQLite library version." msgstr "" -#: ../../library/sqlite3.rst:2010 +#: ../../library/sqlite3.rst:2051 msgid "How-to guides" msgstr "" -#: ../../library/sqlite3.rst:2015 +#: ../../library/sqlite3.rst:2056 msgid "How to use placeholders to bind values in SQL queries" msgstr "" -#: ../../library/sqlite3.rst:2017 +#: ../../library/sqlite3.rst:2058 msgid "" "SQL operations usually need to use values from Python variables. However, " "beware of using Python's string operations to assemble queries, as they are " @@ -2477,7 +2528,7 @@ msgid "" "close the single quote and inject ``OR TRUE`` to select all rows::" msgstr "" -#: ../../library/sqlite3.rst:2022 +#: ../../library/sqlite3.rst:2063 msgid "" ">>> # Never do this -- insecure!\n" ">>> symbol = input()\n" @@ -2488,7 +2539,7 @@ msgid "" ">>> cur.execute(sql)" msgstr "" -#: ../../library/sqlite3.rst:2030 +#: ../../library/sqlite3.rst:2071 msgid "" "Instead, use the DB-API's parameter substitution. To insert a variable into " "a query string, use a placeholder in the string, and substitute the actual " @@ -2496,7 +2547,7 @@ msgid "" "second argument of the cursor's :meth:`~Cursor.execute` method." msgstr "" -#: ../../library/sqlite3.rst:2035 +#: ../../library/sqlite3.rst:2076 msgid "" "An SQL statement may use one of two kinds of placeholders: question marks " "(qmark style) or named placeholders (named style). For the qmark style, " @@ -2507,7 +2558,7 @@ msgid "" "ignored. Here's an example of both styles:" msgstr "" -#: ../../library/sqlite3.rst:2046 +#: ../../library/sqlite3.rst:2087 msgid "" "con = sqlite3.connect(\":memory:\")\n" "cur = con.execute(\"CREATE TABLE lang(name, first_appeared)\")\n" @@ -2528,24 +2579,24 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2073 +#: ../../library/sqlite3.rst:2114 msgid "" ":pep:`249` numeric placeholders are *not* supported. If used, they will be " "interpreted as named placeholders." msgstr "" -#: ../../library/sqlite3.rst:2080 +#: ../../library/sqlite3.rst:2121 msgid "How to adapt custom Python types to SQLite values" msgstr "" -#: ../../library/sqlite3.rst:2082 +#: ../../library/sqlite3.rst:2123 msgid "" "SQLite supports only a limited set of data types natively. To store custom " "Python types in SQLite databases, *adapt* them to one of the :ref:`Python " "types SQLite natively understands `." msgstr "" -#: ../../library/sqlite3.rst:2086 +#: ../../library/sqlite3.rst:2127 msgid "" "There are two ways to adapt Python objects to SQLite types: letting your " "object adapt itself, or using an *adapter callable*. The latter will take " @@ -2555,11 +2606,11 @@ msgid "" "custom adapter functions." msgstr "" -#: ../../library/sqlite3.rst:2098 +#: ../../library/sqlite3.rst:2139 msgid "How to write adaptable objects" msgstr "" -#: ../../library/sqlite3.rst:2100 +#: ../../library/sqlite3.rst:2141 msgid "" "Suppose we have a :class:`!Point` class that represents a pair of " "coordinates, ``x`` and ``y``, in a Cartesian coordinate system. The " @@ -2569,7 +2620,7 @@ msgid "" "object passed to *protocol* will be of type :class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:2108 +#: ../../library/sqlite3.rst:2149 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2601,18 +2652,18 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2132 +#: ../../library/sqlite3.rst:2173 msgid "How to register adapter callables" msgstr "" -#: ../../library/sqlite3.rst:2134 +#: ../../library/sqlite3.rst:2175 msgid "" "The other possibility is to create a function that converts the Python " "object to an SQLite-compatible type. This function can then be registered " "using :func:`register_adapter`." msgstr "" -#: ../../library/sqlite3.rst:2138 +#: ../../library/sqlite3.rst:2179 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2646,36 +2697,36 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2165 +#: ../../library/sqlite3.rst:2206 msgid "How to convert SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:2167 +#: ../../library/sqlite3.rst:2208 msgid "" "Writing an adapter lets you convert *from* custom Python types *to* SQLite " "values. To be able to convert *from* SQLite values *to* custom Python types, " "we use *converters*." msgstr "" -#: ../../library/sqlite3.rst:2172 +#: ../../library/sqlite3.rst:2213 msgid "" "Let's go back to the :class:`!Point` class. We stored the x and y " "coordinates separated via semicolons as strings in SQLite." msgstr "" -#: ../../library/sqlite3.rst:2175 +#: ../../library/sqlite3.rst:2216 msgid "" "First, we'll define a converter function that accepts the string as a " "parameter and constructs a :class:`!Point` object from it." msgstr "" -#: ../../library/sqlite3.rst:2180 +#: ../../library/sqlite3.rst:2221 msgid "" "Converter functions are **always** passed a :class:`bytes` object, no matter " "the underlying SQLite data type." msgstr "" -#: ../../library/sqlite3.rst:2183 +#: ../../library/sqlite3.rst:2224 msgid "" "def convert_point(s):\n" " x, y = map(float, s.split(b\";\"))\n" @@ -2685,32 +2736,32 @@ msgstr "" " x, y = map(float, s.split(b\";\"))\n" " return Point(x, y)" -#: ../../library/sqlite3.rst:2189 +#: ../../library/sqlite3.rst:2230 msgid "" "We now need to tell :mod:`!sqlite3` when it should convert a given SQLite " "value. This is done when connecting to a database, using the *detect_types* " "parameter of :func:`connect`. There are three options:" msgstr "" -#: ../../library/sqlite3.rst:2193 +#: ../../library/sqlite3.rst:2234 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" msgstr "" -#: ../../library/sqlite3.rst:2194 +#: ../../library/sqlite3.rst:2235 msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`" msgstr "" -#: ../../library/sqlite3.rst:2195 +#: ../../library/sqlite3.rst:2236 msgid "" "Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." "PARSE_COLNAMES``. Column names take precedence over declared types." msgstr "" -#: ../../library/sqlite3.rst:2199 +#: ../../library/sqlite3.rst:2240 msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" -#: ../../library/sqlite3.rst:2201 +#: ../../library/sqlite3.rst:2242 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2752,15 +2803,15 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2252 +#: ../../library/sqlite3.rst:2293 msgid "Adapter and converter recipes" msgstr "" -#: ../../library/sqlite3.rst:2254 +#: ../../library/sqlite3.rst:2295 msgid "This section shows recipes for common adapters and converters." msgstr "" -#: ../../library/sqlite3.rst:2256 +#: ../../library/sqlite3.rst:2297 msgid "" "import datetime\n" "import sqlite3\n" @@ -2798,11 +2849,11 @@ msgid "" "sqlite3.register_converter(\"timestamp\", convert_timestamp)" msgstr "" -#: ../../library/sqlite3.rst:2316 +#: ../../library/sqlite3.rst:2357 msgid "How to use connection shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:2318 +#: ../../library/sqlite3.rst:2359 msgid "" "Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :" "meth:`~Connection.executescript` methods of the :class:`Connection` class, " @@ -2814,7 +2865,7 @@ msgid "" "object." msgstr "" -#: ../../library/sqlite3.rst:2327 +#: ../../library/sqlite3.rst:2368 msgid "" "# Create and fill the table.\n" "con = sqlite3.connect(\":memory:\")\n" @@ -2838,11 +2889,11 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2359 +#: ../../library/sqlite3.rst:2400 msgid "How to use the connection context manager" msgstr "" -#: ../../library/sqlite3.rst:2361 +#: ../../library/sqlite3.rst:2402 msgid "" "A :class:`Connection` object can be used as a context manager that " "automatically commits or rolls back open transactions when leaving the body " @@ -2854,21 +2905,21 @@ msgid "" "rolling back." msgstr "" -#: ../../library/sqlite3.rst:2372 +#: ../../library/sqlite3.rst:2413 msgid "" "If there is no open transaction upon leaving the body of the ``with`` " "statement, or if :attr:`~Connection.autocommit` is ``True``, the context " "manager does nothing." msgstr "" -#: ../../library/sqlite3.rst:2377 +#: ../../library/sqlite3.rst:2418 msgid "" "The context manager neither implicitly opens a new transaction nor closes " "the connection. If you need a closing context manager, consider using :meth:" "`contextlib.closing`." msgstr "" -#: ../../library/sqlite3.rst:2381 +#: ../../library/sqlite3.rst:2422 msgid "" "con = sqlite3.connect(\":memory:\")\n" "con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR " @@ -2892,19 +2943,19 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2411 +#: ../../library/sqlite3.rst:2452 msgid "How to work with SQLite URIs" msgstr "" -#: ../../library/sqlite3.rst:2413 +#: ../../library/sqlite3.rst:2454 msgid "Some useful URI tricks include:" msgstr "" -#: ../../library/sqlite3.rst:2415 +#: ../../library/sqlite3.rst:2456 msgid "Open a database in read-only mode:" msgstr "" -#: ../../library/sqlite3.rst:2417 +#: ../../library/sqlite3.rst:2458 msgid "" ">>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n" ">>> con.execute(\"CREATE TABLE readonly(data)\")\n" @@ -2916,13 +2967,13 @@ msgstr "" "Traceback (most recent call last):\n" "OperationalError: attempt to write a readonly database" -#: ../../library/sqlite3.rst:2424 +#: ../../library/sqlite3.rst:2465 msgid "" "Do not implicitly create a new database file if it does not already exist; " "will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:" msgstr "" -#: ../../library/sqlite3.rst:2427 +#: ../../library/sqlite3.rst:2468 msgid "" ">>> con = sqlite3.connect(\"file:nosuchdb.db?mode=rw\", uri=True)\n" "Traceback (most recent call last):\n" @@ -2932,11 +2983,11 @@ msgstr "" "Traceback (most recent call last):\n" "OperationalError: unable to open database file" -#: ../../library/sqlite3.rst:2434 +#: ../../library/sqlite3.rst:2475 msgid "Create a shared named in-memory database:" msgstr "" -#: ../../library/sqlite3.rst:2436 +#: ../../library/sqlite3.rst:2477 msgid "" "db = \"file:mem1?mode=memory&cache=shared\"\n" "con1 = sqlite3.connect(db, uri=True)\n" @@ -2962,24 +3013,24 @@ msgstr "" "con1.close()\n" "con2.close()" -#: ../../library/sqlite3.rst:2450 +#: ../../library/sqlite3.rst:2491 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:2459 +#: ../../library/sqlite3.rst:2500 msgid "How to create and use row factories" msgstr "" -#: ../../library/sqlite3.rst:2461 +#: ../../library/sqlite3.rst:2502 msgid "" "By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If a :" "class:`!tuple` does not suit your needs, you can use the :class:`sqlite3." "Row` class or a custom :attr:`~Cursor.row_factory`." msgstr "" -#: ../../library/sqlite3.rst:2466 +#: ../../library/sqlite3.rst:2507 msgid "" "While :attr:`!row_factory` exists as an attribute both on the :class:" "`Cursor` and the :class:`Connection`, it is recommended to set :class:" @@ -2987,7 +3038,7 @@ msgid "" "use the same row factory." msgstr "" -#: ../../library/sqlite3.rst:2471 +#: ../../library/sqlite3.rst:2512 msgid "" ":class:`!Row` provides indexed and case-insensitive named access to columns, " "with minimal memory overhead and performance impact over a :class:`!tuple`. " @@ -2995,7 +3046,7 @@ msgid "" "attribute:" msgstr "" -#: ../../library/sqlite3.rst:2476 +#: ../../library/sqlite3.rst:2517 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" @@ -3003,11 +3054,11 @@ msgstr "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" -#: ../../library/sqlite3.rst:2481 +#: ../../library/sqlite3.rst:2522 msgid "Queries now return :class:`!Row` objects:" msgstr "" -#: ../../library/sqlite3.rst:2483 +#: ../../library/sqlite3.rst:2524 msgid "" ">>> res = con.execute(\"SELECT 'Earth' AS name, 6378 AS radius\")\n" ">>> row = res.fetchone()\n" @@ -3022,7 +3073,7 @@ msgid "" ">>> con.close()" msgstr "" -#: ../../library/sqlite3.rst:2499 +#: ../../library/sqlite3.rst:2540 msgid "" "The ``FROM`` clause can be omitted in the ``SELECT`` statement, as in the " "above example. In such cases, SQLite returns a single row with columns " @@ -3030,13 +3081,13 @@ msgid "" "alias``." msgstr "" -#: ../../library/sqlite3.rst:2504 +#: ../../library/sqlite3.rst:2545 msgid "" "You can create a custom :attr:`~Cursor.row_factory` that returns each row as " "a :class:`dict`, with column names mapped to values:" msgstr "" -#: ../../library/sqlite3.rst:2507 +#: ../../library/sqlite3.rst:2548 msgid "" "def dict_factory(cursor, row):\n" " fields = [column[0] for column in cursor.description]\n" @@ -3046,12 +3097,12 @@ msgstr "" " fields = [column[0] for column in cursor.description]\n" " return {key: value for key, value in zip(fields, row)}" -#: ../../library/sqlite3.rst:2513 +#: ../../library/sqlite3.rst:2554 msgid "" "Using it, queries now return a :class:`!dict` instead of a :class:`!tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2515 +#: ../../library/sqlite3.rst:2556 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = dict_factory\n" @@ -3067,11 +3118,11 @@ msgstr "" "{'a': 1, 'b': 2}\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2524 +#: ../../library/sqlite3.rst:2565 msgid "The following row factory returns a :term:`named tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2526 +#: ../../library/sqlite3.rst:2567 msgid "" "from collections import namedtuple\n" "\n" @@ -3087,11 +3138,11 @@ msgstr "" " cls = namedtuple(\"Row\", fields)\n" " return cls._make(row)" -#: ../../library/sqlite3.rst:2535 +#: ../../library/sqlite3.rst:2576 msgid ":func:`!namedtuple_factory` can be used as follows:" msgstr "" -#: ../../library/sqlite3.rst:2537 +#: ../../library/sqlite3.rst:2578 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = namedtuple_factory\n" @@ -3117,18 +3168,18 @@ msgstr "" "2\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2551 +#: ../../library/sqlite3.rst:2592 msgid "" "With some adjustments, the above recipe can be adapted to use a :class:" "`~dataclasses.dataclass`, or any other custom class, instead of a :class:" "`~collections.namedtuple`." msgstr "" -#: ../../library/sqlite3.rst:2559 +#: ../../library/sqlite3.rst:2600 msgid "How to handle non-UTF-8 text encodings" msgstr "" -#: ../../library/sqlite3.rst:2561 +#: ../../library/sqlite3.rst:2602 msgid "" "By default, :mod:`!sqlite3` uses :class:`str` to adapt SQLite values with " "the ``TEXT`` data type. This works well for UTF-8 encoded text, but it might " @@ -3136,7 +3187,7 @@ msgid "" "`~Connection.text_factory` to handle such cases." msgstr "" -#: ../../library/sqlite3.rst:2567 +#: ../../library/sqlite3.rst:2608 msgid "" "Because of SQLite's `flexible typing`_, it is not uncommon to encounter " "table columns with the ``TEXT`` data type containing non-UTF-8 encodings, or " @@ -3147,39 +3198,39 @@ msgid "" "text using this :attr:`~Connection.text_factory`:" msgstr "" -#: ../../library/sqlite3.rst:2576 +#: ../../library/sqlite3.rst:2617 msgid "con.text_factory = lambda data: str(data, encoding=\"latin2\")" msgstr "con.text_factory = lambda data: str(data, encoding=\"latin2\")" -#: ../../library/sqlite3.rst:2580 +#: ../../library/sqlite3.rst:2621 msgid "" "For invalid UTF-8 or arbitrary data in stored in ``TEXT`` table columns, you " "can use the following technique, borrowed from the :ref:`unicode-howto`:" msgstr "" -#: ../../library/sqlite3.rst:2583 +#: ../../library/sqlite3.rst:2624 msgid "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" msgstr "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" -#: ../../library/sqlite3.rst:2589 +#: ../../library/sqlite3.rst:2630 msgid "" "The :mod:`!sqlite3` module API does not support strings containing " "surrogates." msgstr "" -#: ../../library/sqlite3.rst:2594 +#: ../../library/sqlite3.rst:2635 msgid ":ref:`unicode-howto`" msgstr ":ref:`unicode-howto`" -#: ../../library/sqlite3.rst:2600 +#: ../../library/sqlite3.rst:2641 msgid "Explanation" msgstr "解釋" -#: ../../library/sqlite3.rst:2606 +#: ../../library/sqlite3.rst:2647 msgid "Transaction control" msgstr "" -#: ../../library/sqlite3.rst:2608 +#: ../../library/sqlite3.rst:2649 msgid "" ":mod:`!sqlite3` offers multiple methods of controlling whether, when and how " "database transactions are opened and closed. :ref:`sqlite3-transaction-" @@ -3187,24 +3238,24 @@ msgid "" "isolation-level` retains the pre-Python 3.12 behaviour." msgstr "" -#: ../../library/sqlite3.rst:2617 +#: ../../library/sqlite3.rst:2658 msgid "Transaction control via the ``autocommit`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2619 +#: ../../library/sqlite3.rst:2660 msgid "" "The recommended way of controlling transaction behaviour is through the :" "attr:`Connection.autocommit` attribute, which should preferably be set using " "the *autocommit* parameter of :func:`connect`." msgstr "" -#: ../../library/sqlite3.rst:2624 +#: ../../library/sqlite3.rst:2665 msgid "" "It is suggested to set *autocommit* to ``False``, which implies :pep:`249`-" "compliant transaction control. This means:" msgstr "" -#: ../../library/sqlite3.rst:2628 +#: ../../library/sqlite3.rst:2669 msgid "" ":mod:`!sqlite3` ensures that a transaction is always open, so :func:" "`connect`, :meth:`Connection.commit`, and :meth:`Connection.rollback` will " @@ -3213,21 +3264,21 @@ msgid "" "when opening transactions." msgstr "" -#: ../../library/sqlite3.rst:2633 +#: ../../library/sqlite3.rst:2674 msgid "Transactions should be committed explicitly using :meth:`!commit`." msgstr "" -#: ../../library/sqlite3.rst:2634 +#: ../../library/sqlite3.rst:2675 msgid "Transactions should be rolled back explicitly using :meth:`!rollback`." msgstr "" -#: ../../library/sqlite3.rst:2635 +#: ../../library/sqlite3.rst:2676 msgid "" "An implicit rollback is performed if the database is :meth:`~Connection." "close`-ed with pending changes." msgstr "" -#: ../../library/sqlite3.rst:2638 +#: ../../library/sqlite3.rst:2679 msgid "" "Set *autocommit* to ``True`` to enable SQLite's `autocommit mode`_. In this " "mode, :meth:`Connection.commit` and :meth:`Connection.rollback` have no " @@ -3236,25 +3287,25 @@ msgid "" "in_transaction` to query the low-level SQLite autocommit mode." msgstr "" -#: ../../library/sqlite3.rst:2646 +#: ../../library/sqlite3.rst:2687 msgid "" "Set *autocommit* to :data:`LEGACY_TRANSACTION_CONTROL` to leave transaction " "control behaviour to the :attr:`Connection.isolation_level` attribute. See :" "ref:`sqlite3-transaction-control-isolation-level` for more information." msgstr "" -#: ../../library/sqlite3.rst:2655 +#: ../../library/sqlite3.rst:2696 msgid "Transaction control via the ``isolation_level`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2659 +#: ../../library/sqlite3.rst:2700 msgid "" "The recommended way of controlling transactions is via the :attr:" "`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-control-" "autocommit`." msgstr "" -#: ../../library/sqlite3.rst:2663 +#: ../../library/sqlite3.rst:2704 msgid "" "If :attr:`Connection.autocommit` is set to :data:" "`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour is " @@ -3262,7 +3313,7 @@ msgid "" "Otherwise, :attr:`!isolation_level` has no effect." msgstr "" -#: ../../library/sqlite3.rst:2669 +#: ../../library/sqlite3.rst:2710 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " "``None``, new transactions are implicitly opened before :meth:`~Cursor." @@ -3276,7 +3327,7 @@ msgid "" "attribute." msgstr "" -#: ../../library/sqlite3.rst:2682 +#: ../../library/sqlite3.rst:2723 msgid "" "If :attr:`~Connection.isolation_level` is set to ``None``, no transactions " "are implicitly opened at all. This leaves the underlying SQLite library in " @@ -3286,36 +3337,33 @@ msgid "" "in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:2690 +#: ../../library/sqlite3.rst:2731 msgid "" "The :meth:`~Cursor.executescript` method implicitly commits any pending " "transaction before execution of the given SQL script, regardless of the " "value of :attr:`~Connection.isolation_level`." msgstr "" -#: ../../library/sqlite3.rst:2694 +#: ../../library/sqlite3.rst:2735 msgid "" ":mod:`!sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:2698 +#: ../../library/sqlite3.rst:2739 msgid "" "The recommended way of controlling transactions is now via the :attr:" "`~Connection.autocommit` attribute." msgstr "" -#: ../../library/sqlite3.rst:1450 +#: ../../library/sqlite3.rst:1491 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/sqlite3.rst:1450 ../../library/sqlite3.rst:1451 +#: ../../library/sqlite3.rst:1491 ../../library/sqlite3.rst:1492 msgid "in SQL statements" msgstr "於 SQL 陳述式中" -#: ../../library/sqlite3.rst:1451 +#: ../../library/sqlite3.rst:1492 msgid ": (colon)" msgstr ": (冒號)" - -#~ msgid "`threadsafety`_" -#~ msgstr "`threadsafety`_" diff --git a/library/ssl.po b/library/ssl.po index 3f6db0b048..17af83b322 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-08-28 00:43+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -60,14 +60,15 @@ msgstr "" "安全性認知,因為 ssl 模組的預設設定未必適合你的應用程式。" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr ":ref:`適用 `: 非 Emscripten、非 WASI。" +#, fuzzy +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:只有 Windows。" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" @@ -82,13 +83,16 @@ msgstr "" "可以去參考此章節底部的「詳情」部分。" #: ../../library/ssl.rst:42 +#, fuzzy msgid "" "This module provides a class, :class:`ssl.SSLSocket`, which is derived from " "the :class:`socket.socket` type, and provides a socket-like wrapper that " "also encrypts and decrypts the data going over the socket with SSL. It " "supports additional methods such as :meth:`getpeercert`, which retrieves the " -"certificate of the other side of the connection, and :meth:`cipher`, which " -"retrieves the cipher being used for the secure connection." +"certificate of the other side of the connection, :meth:`cipher`, which " +"retrieves the cipher being used for the secure connection or :meth:" +"`get_verified_chain`, :meth:`get_unverified_chain` which retrieves " +"certificate chain." msgstr "" "此模組提供了一個 :class:`ssl.SSLSocket` 類別,它是從 :class:`socket.socket` " "衍生出來的,並且提供類似 socket 的包裝器,讓使用 SSL 進行資料傳輸時,可以進行" @@ -96,7 +100,7 @@ msgstr "" "連結另一端的憑證,以及 :meth:`cipher`,用於搜尋用於安全連接的加密方法 " "(cipher)。" -#: ../../library/ssl.rst:49 +#: ../../library/ssl.rst:51 msgid "" "For more sophisticated applications, the :class:`ssl.SSLContext` class helps " "manage settings and certificates, which can then be inherited by SSL sockets " @@ -106,11 +110,11 @@ msgstr "" "可以透過 :meth:`SSLContext.wrap_socket` 方法建立的 SSL socket 繼承這些設定和" "認證。" -#: ../../library/ssl.rst:53 +#: ../../library/ssl.rst:55 msgid "Updated to support linking with OpenSSL 1.1.0" msgstr "更新以支援與 OpenSSL 1.1.0 進行連結" -#: ../../library/ssl.rst:58 +#: ../../library/ssl.rst:60 msgid "" "OpenSSL 0.9.8, 1.0.0 and 1.0.1 are deprecated and no longer supported. In " "the future the ssl module will require at least OpenSSL 1.0.2 or 1.1.0." @@ -118,26 +122,26 @@ msgstr "" "OpenSSL 0.9.8, 1.0.0 及 1.0.1 版本已被棄用且不再支援。在未來 ssl 模組將需要至" "少 OpenSSL 1.0.2 版本或 1.1.0 版本。" -#: ../../library/ssl.rst:64 +#: ../../library/ssl.rst:66 msgid "" ":pep:`644` has been implemented. The ssl module requires OpenSSL 1.1.1 or " "newer." msgstr ":pep:`644` 已經被實作。ssl 模組需要 OpenSSL 1.1.1 以上的版本才能使用。" -#: ../../library/ssl.rst:67 +#: ../../library/ssl.rst:69 msgid "" "Use of deprecated constants and functions result in deprecation warnings." msgstr "使用已經被棄用的常數或函式將會導致棄用警示。" -#: ../../library/ssl.rst:71 +#: ../../library/ssl.rst:73 msgid "Functions, Constants, and Exceptions" msgstr "函式、常數與例外" -#: ../../library/ssl.rst:75 +#: ../../library/ssl.rst:77 msgid "Socket creation" msgstr "Socket 建立" -#: ../../library/ssl.rst:77 +#: ../../library/ssl.rst:79 msgid "" "Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." "wrap_socket` method. The helper function :func:`create_default_context` " @@ -147,11 +151,11 @@ msgstr "" "助函式 :func:`create_default_context` 會回傳有安全預設設定的新語境 " "(context)。" -#: ../../library/ssl.rst:82 +#: ../../library/ssl.rst:84 msgid "Client socket example with default context and IPv4/IPv6 dual stack::" msgstr "使用預設語境及 IPv4/IPv6 雙協定堆疊的客戶端 socket 範例: ::" -#: ../../library/ssl.rst:84 +#: ../../library/ssl.rst:86 msgid "" "import socket\n" "import ssl\n" @@ -173,11 +177,11 @@ msgstr "" " with context.wrap_socket(sock, server_hostname=hostname) as ssock:\n" " print(ssock.version())" -#: ../../library/ssl.rst:95 +#: ../../library/ssl.rst:97 msgid "Client socket example with custom context and IPv4::" msgstr "使用自訂語境及 IPv4 的客戶端 socket範例: ::" -#: ../../library/ssl.rst:97 +#: ../../library/ssl.rst:99 msgid "" "hostname = 'www.python.org'\n" "# PROTOCOL_TLS_CLIENT requires valid cert chain and hostname\n" @@ -189,11 +193,11 @@ msgid "" " print(ssock.version())" msgstr "" -#: ../../library/ssl.rst:107 +#: ../../library/ssl.rst:109 msgid "Server socket example listening on localhost IPv4::" msgstr "在本地 IPv4 上監聽伺服器 socket 的範例: ::" -#: ../../library/ssl.rst:109 +#: ../../library/ssl.rst:111 msgid "" "context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)\n" "context.load_cert_chain('/path/to/certchain.pem', '/path/to/private.key')\n" @@ -215,17 +219,17 @@ msgstr "" " conn, addr = ssock.accept()\n" " ..." -#: ../../library/ssl.rst:121 +#: ../../library/ssl.rst:123 msgid "Context creation" msgstr "語境建立" -#: ../../library/ssl.rst:123 +#: ../../library/ssl.rst:125 msgid "" "A convenience function helps create :class:`SSLContext` objects for common " "purposes." msgstr "一個可以幫忙建立出 :class:`SSLContext` 物件以用於一般目的的方便函式。" -#: ../../library/ssl.rst:128 +#: ../../library/ssl.rst:130 msgid "" "Return a new :class:`SSLContext` object with default settings for the given " "*purpose*. The settings are chosen by the :mod:`ssl` module, and usually " @@ -235,7 +239,7 @@ msgstr "" "回傳一個新的 :class:`SSLContext` 物件,使用給定 *purpose* 的預設值。這些設定" "是由 :mod:`ssl` 選擇,通常比直接呼叫 :class:`SSLContext` 有更高的安全性。" -#: ../../library/ssl.rst:133 +#: ../../library/ssl.rst:135 msgid "" "*cafile*, *capath*, *cadata* represent optional CA certificates to trust for " "certificate verification, as in :meth:`SSLContext.load_verify_locations`. " @@ -249,7 +253,7 @@ msgstr "" # Skylull: `high encryption cipher` 可能是指 https://superuser.com/questions/1751902/how-to-check-which-ciphers-are-included-in-high-ciphers-constant # 其文中表示可能是指 128bit 以上 key length 的加密算法,需要其他來源佐證。 # 或是 https://help.fortinet.com/fweb/582/Content/FortiWeb/fortiweb-admin/supported_cipher_suites.htm#ssl_414712646_1189301 -#: ../../library/ssl.rst:139 +#: ../../library/ssl.rst:141 msgid "" "The settings are: :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` with " @@ -268,7 +272,7 @@ msgstr "" "個值有被設定時) 或使用預設的 CA 憑證 :meth:`SSLContext." "load_default_certs` 。" -#: ../../library/ssl.rst:148 +#: ../../library/ssl.rst:150 msgid "" "When :attr:`~SSLContext.keylog_filename` is supported and the environment " "variable :envvar:`SSLKEYLOGFILE` is set, :func:`create_default_context` " @@ -278,7 +282,16 @@ msgstr "" "`SSLKEYLOGFILE` 時 :func:`create_default_context` 會啟用密鑰日誌記錄 " "(logging)。" -#: ../../library/ssl.rst:153 +#: ../../library/ssl.rst:154 +msgid "" +"The default settings for this context include :data:" +"`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. These make the " +"underlying OpenSSL implementation behave more like a conforming " +"implementation of :rfc:`5280`, in exchange for a small amount of " +"incompatibility with older X.509 certificates." +msgstr "" + +#: ../../library/ssl.rst:161 msgid "" "The protocol, options, cipher and other settings may change to more " "restrictive values anytime without prior deprecation. The values represent " @@ -287,7 +300,7 @@ msgstr "" "協定、選項、加密方式和其它設定可以在不捨棄舊值的情況下直接更改成新的值,這些" "值代表了在相容性和安全性之間取得的合理平衡。" -#: ../../library/ssl.rst:157 +#: ../../library/ssl.rst:165 msgid "" "If your application needs specific settings, you should create a :class:" "`SSLContext` and apply the settings yourself." @@ -295,7 +308,7 @@ msgstr "" "如果你的應用程式需要特殊的設定,你應該要自行建立一個 :class:`SSLContext` 並自" "行調整設定。" -#: ../../library/ssl.rst:161 +#: ../../library/ssl.rst:169 msgid "" "If you find that when certain older clients or servers attempt to connect " "with a :class:`SSLContext` created by this function that they get an error " @@ -311,7 +324,7 @@ msgstr "" "SSL3.0 已經\\ `被完全破解 `_。如果你仍" "然希望在允許 SSL3.0 連線的情況下使用此函式,可以使用下面的方法: ::" -#: ../../library/ssl.rst:170 +#: ../../library/ssl.rst:178 msgid "" "ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)\n" "ctx.options &= ~ssl.OP_NO_SSLv3" @@ -319,23 +332,40 @@ msgstr "" "ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)\n" "ctx.options &= ~ssl.OP_NO_SSLv3" -#: ../../library/ssl.rst:177 +#: ../../library/ssl.rst:182 +msgid "" +"This context enables :data:`VERIFY_X509_STRICT` by default, which may reject " +"pre-:rfc:`5280` or malformed certificates that the underlying OpenSSL " +"implementation otherwise would accept. While disabling this is not " +"recommended, you can do so using::" +msgstr "" + +#: ../../library/ssl.rst:187 +#, fuzzy +msgid "" +"ctx = ssl.create_default_context()\n" +"ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" +msgstr "" +"ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)\n" +"ctx.options &= ~ssl.OP_NO_SSLv3" + +#: ../../library/ssl.rst:194 msgid "RC4 was dropped from the default cipher string." msgstr "把 RC4 從預設加密方法字串中捨棄。" -#: ../../library/ssl.rst:181 +#: ../../library/ssl.rst:198 msgid "ChaCha20/Poly1305 was added to the default cipher string." msgstr "把 ChaCha20/Poly1305 加入預設加密方法字串。" -#: ../../library/ssl.rst:183 +#: ../../library/ssl.rst:200 msgid "3DES was dropped from the default cipher string." msgstr "把 3DES 從預設加密方法字串中捨棄。" -#: ../../library/ssl.rst:187 +#: ../../library/ssl.rst:204 msgid "Support for key logging to :envvar:`SSLKEYLOGFILE` was added." msgstr "增加了 :envvar:`SSLKEYLOGFILE` 對密鑰日誌記錄 (logging) 的支援。" -#: ../../library/ssl.rst:191 +#: ../../library/ssl.rst:208 msgid "" "The context now uses :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER` protocol instead of generic :data:`PROTOCOL_TLS`." @@ -343,11 +373,17 @@ msgstr "" "當前語境使用 :data:`PROTOCOL_TLS_CLIENT` 協定或 :data:`PROTOCOL_TLS_SERVER` " "協定而非通用的 :data:`PROTOCOL_TLS`。" -#: ../../library/ssl.rst:197 +#: ../../library/ssl.rst:214 +msgid "" +"The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:" +"`VERIFY_X509_STRICT` in its default verify flags." +msgstr "" + +#: ../../library/ssl.rst:219 msgid "Exceptions" msgstr "例外" -#: ../../library/ssl.rst:201 +#: ../../library/ssl.rst:223 msgid "" "Raised to signal an error from the underlying SSL implementation (currently " "provided by the OpenSSL library). This signifies some problem in the higher-" @@ -361,11 +397,11 @@ msgstr "" "`OSError` 的一個子型別。:exc:`SSLError` 實例的錯誤程式代碼和訊息是由 OpenSSL " "函式庫提供。" -#: ../../library/ssl.rst:208 +#: ../../library/ssl.rst:230 msgid ":exc:`SSLError` used to be a subtype of :exc:`socket.error`." msgstr ":exc:`SSLError` 曾經是 :exc:`socket.error` 的一個子型別。" -#: ../../library/ssl.rst:213 +#: ../../library/ssl.rst:235 msgid "" "A string mnemonic designating the OpenSSL submodule in which the error " "occurred, such as ``SSL``, ``PEM`` or ``X509``. The range of possible " @@ -374,7 +410,7 @@ msgstr "" "一個字串符號 (string mnemonic),用來指定發生錯誤的 OpenSSL 子模組,如:" "``SSL``、``PEM`` 或 ``X509``。可能值的範圍取決於 OpenSSL 的版本。" -#: ../../library/ssl.rst:221 +#: ../../library/ssl.rst:243 msgid "" "A string mnemonic designating the reason this error occurred, for example " "``CERTIFICATE_VERIFY_FAILED``. The range of possible values depends on the " @@ -383,7 +419,7 @@ msgstr "" "一個字串符號,用來指定發生錯誤的原因,如:``CERTIFICATE_VERIFY_FAILED``。可能" "值的範圍取決於 OpenSSL 的版本。" -#: ../../library/ssl.rst:229 +#: ../../library/ssl.rst:251 msgid "" "A subclass of :exc:`SSLError` raised when trying to read or write and the " "SSL connection has been closed cleanly. Note that this doesn't mean that " @@ -392,7 +428,7 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當嘗試去讀寫已經被完全關閉的 SSL 連線時會被引" "發。請注意,這並不表示底層傳輸(例如 TCP)已經被關閉。" -#: ../../library/ssl.rst:237 +#: ../../library/ssl.rst:259 msgid "" "A subclass of :exc:`SSLError` raised by a :ref:`non-blocking SSL socket ` when trying to read or write data, but more data needs to be " @@ -401,7 +437,7 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當嘗試去讀寫資料前,底層 TCP 傳輸需要先接收更" "多資料時會由\\ :ref:`非阻塞的 SSL socket ` 引發該錯誤。" -#: ../../library/ssl.rst:246 +#: ../../library/ssl.rst:268 msgid "" "A subclass of :exc:`SSLError` raised by a :ref:`non-blocking SSL socket ` when trying to read or write data, but more data needs to be " @@ -410,7 +446,7 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當嘗試去讀寫資料前,底層 TCP 傳輸需要先發送更" "多資料時會由\\ :ref:`非阻塞的 SSL socket ` 引發該錯誤。" -#: ../../library/ssl.rst:255 +#: ../../library/ssl.rst:277 msgid "" "A subclass of :exc:`SSLError` raised when a system error was encountered " "while trying to fulfill an operation on a SSL socket. Unfortunately, there " @@ -419,7 +455,7 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當嘗試去操作 SSL socket 時有系統錯誤產生會引發" "此錯誤。不幸的是,目前沒有任何簡單的方法可以去檢查原本的的 errno 編號。" -#: ../../library/ssl.rst:263 +#: ../../library/ssl.rst:285 msgid "" "A subclass of :exc:`SSLError` raised when the SSL connection has been " "terminated abruptly. Generally, you shouldn't try to reuse the underlying " @@ -428,32 +464,32 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當 SSL 連線被突然終止時會引發此錯誤。通常,當" "此錯誤發生時,你不該再去重新使用底層傳輸。" -#: ../../library/ssl.rst:271 +#: ../../library/ssl.rst:293 msgid "" "A subclass of :exc:`SSLError` raised when certificate validation has failed." msgstr "當憑證驗證失敗時會引發的一個 :exc:`SSLError` 子類別。" -#: ../../library/ssl.rst:278 +#: ../../library/ssl.rst:300 msgid "A numeric error number that denotes the verification error." msgstr "一個表示驗證錯誤的錯誤數值編號。" -#: ../../library/ssl.rst:282 +#: ../../library/ssl.rst:304 msgid "A human readable string of the verification error." msgstr "一個人類可讀的驗證錯誤字串。" -#: ../../library/ssl.rst:286 +#: ../../library/ssl.rst:308 msgid "An alias for :exc:`SSLCertVerificationError`." msgstr ":exc:`SSLCertVerificationError` 的別名。" -#: ../../library/ssl.rst:288 +#: ../../library/ssl.rst:310 msgid "The exception is now an alias for :exc:`SSLCertVerificationError`." msgstr "此例外現在是 :exc:`SSLCertVerificationError` 的別名。" -#: ../../library/ssl.rst:293 +#: ../../library/ssl.rst:315 msgid "Random generation" msgstr "隨機產生" -#: ../../library/ssl.rst:297 +#: ../../library/ssl.rst:319 msgid "" "Return *num* cryptographically strong pseudo-random bytes. Raises an :class:" "`SSLError` if the PRNG has not been seeded with enough data or if the " @@ -466,11 +502,11 @@ msgstr "" "func:`RAND_status` 函式可以用來檢查 PRNG 函式,而 :func:`RAND_add` 則可以用來" "為 PRNG 設定隨機種子。" -#: ../../library/ssl.rst:303 +#: ../../library/ssl.rst:325 msgid "For almost all applications :func:`os.urandom` is preferable." msgstr "在幾乎所有的應用程式中,:func:`os.urandom` 會是較好的選擇。" -#: ../../library/ssl.rst:305 +#: ../../library/ssl.rst:327 msgid "" "Read the Wikipedia article, `Cryptographically secure pseudorandom number " "generator (CSPRNG) `_\\ 文章來了" "解密碼學安全偽隨機數產生器的需求。" -#: ../../library/ssl.rst:314 +#: ../../library/ssl.rst:336 msgid "" "Return ``True`` if the SSL pseudo-random number generator has been seeded " "with 'enough' randomness, and ``False`` otherwise. You can use :func:`ssl." @@ -492,7 +528,7 @@ msgstr "" "``True`` ,否則回傳 ``False``。你可以使用 :func:`ssl.RAND_egd` 函式和 :func:" "`ssl.RAND_add` 函式來增加偽隨機數產生器的隨機性。" -#: ../../library/ssl.rst:321 +#: ../../library/ssl.rst:343 msgid "" "Mix the given *bytes* into the SSL pseudo-random number generator. The " "parameter *entropy* (a float) is a lower bound on the entropy contained in " @@ -503,15 +539,15 @@ msgstr "" "指字串中包含熵值的下限(因此你可以將其設為 ``0.0``\\ )。請參閱 :rfc:`1750` " "了解有關熵源的更多資訊。" -#: ../../library/ssl.rst:326 +#: ../../library/ssl.rst:348 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "可寫入的\\ :term:`類位元組物件 `\\ 現在可被接受。" -#: ../../library/ssl.rst:330 +#: ../../library/ssl.rst:352 msgid "Certificate handling" msgstr "認證處理" -#: ../../library/ssl.rst:338 +#: ../../library/ssl.rst:360 msgid "" "Return the time in seconds since the Epoch, given the ``cert_time`` string " "representing the \"notBefore\" or \"notAfter\" date from a certificate in " @@ -521,11 +557,11 @@ msgstr "" "\"notAfter\" 日期,字串採用 ``\"%b %d %H:%M:%S %Y %Z\"`` 格式(C 語言區域設" "定)。" -#: ../../library/ssl.rst:343 +#: ../../library/ssl.rst:365 msgid "Here's an example:" msgstr "以下是一個範例:" -#: ../../library/ssl.rst:345 +#: ../../library/ssl.rst:367 msgid "" ">>> import ssl\n" ">>> timestamp = ssl.cert_time_to_seconds(\"Jan 5 09:34:43 2018 GMT\")\n" @@ -543,11 +579,11 @@ msgstr "" ">>> print(datetime.utcfromtimestamp(timestamp)) \n" "2018-01-05 09:34:43" -#: ../../library/ssl.rst:355 +#: ../../library/ssl.rst:377 msgid "\"notBefore\" or \"notAfter\" dates must use GMT (:rfc:`5280`)." msgstr "\"notBefore\" 或 \"notAfter\" 日期必須使用 GMT (:rfc:`5280`)。" -#: ../../library/ssl.rst:357 +#: ../../library/ssl.rst:379 msgid "" "Interpret the input time as a time in UTC as specified by 'GMT' timezone in " "the input string. Local timezone was used previously. Return an integer (no " @@ -556,7 +592,7 @@ msgstr "" "將輸入的時間直譯為 UTC 時間,如輸入字串中指定的 'GMT' 時區。在之前是使用本地" "的時區。回傳一個整數(在輸入格式中不包括秒的小數部分)。" -#: ../../library/ssl.rst:366 +#: ../../library/ssl.rst:388 msgid "" "Given the address ``addr`` of an SSL-protected server, as a (*hostname*, " "*port-number*) pair, fetches the server's certificate, and returns it as a " @@ -577,11 +613,11 @@ msgstr "" "組根憑證對伺服器憑證進行驗證,如果驗證失敗,呼叫將失敗。可以使用 ``timeout`` " "參數指定超時時間。" -#: ../../library/ssl.rst:377 +#: ../../library/ssl.rst:399 msgid "This function is now IPv6-compatible." msgstr "此函式現在是與 IPv6 相容的。" -#: ../../library/ssl.rst:380 +#: ../../library/ssl.rst:402 msgid "" "The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` to :data:" "`PROTOCOL_TLS` for maximum compatibility with modern servers." @@ -589,11 +625,11 @@ msgstr "" "預設的 *ssl_version* 已經從 :data:`PROTOCOL_SSLv3` 改為 :data:" "`PROTOCOL_TLS`,已確保與現今的伺服器有最大的相容性。" -#: ../../library/ssl.rst:384 +#: ../../library/ssl.rst:406 msgid "The *timeout* parameter was added." msgstr "新增 *timeout* 參數。" -#: ../../library/ssl.rst:389 +#: ../../library/ssl.rst:411 msgid "" "Given a certificate as a DER-encoded blob of bytes, returns a PEM-encoded " "string version of the same certificate." @@ -601,14 +637,14 @@ msgstr "" "給定一個以 DER 編碼的位元組 blob 作為憑證,回傳以 PEM 編碼字串版本的相同憑" "證。" -#: ../../library/ssl.rst:394 +#: ../../library/ssl.rst:416 msgid "" "Given a certificate as an ASCII PEM string, returns a DER-encoded sequence " "of bytes for that same certificate." msgstr "" "給定一個以 ASCII PEM 的字串作為憑證,回傳以 DER 編碼的位元組序列的相同憑證。" -#: ../../library/ssl.rst:399 +#: ../../library/ssl.rst:421 msgid "" "Returns a named tuple with paths to OpenSSL's default cafile and capath. The " "paths are the same as used by :meth:`SSLContext.set_default_verify_paths`. " @@ -618,39 +654,39 @@ msgstr "" "meth:`SSLContext.set_default_verify_paths` 使用的相同。回傳值是一個 :term:" "`named tuple` ``DefaultVerifyPaths``:" -#: ../../library/ssl.rst:404 +#: ../../library/ssl.rst:426 msgid "" ":attr:`cafile` - resolved path to cafile or ``None`` if the file doesn't " "exist," msgstr ":attr:`cafile` - 解析後的 cafile 路徑,如果檔案不存在則為 ``None``," -#: ../../library/ssl.rst:405 +#: ../../library/ssl.rst:427 msgid "" ":attr:`capath` - resolved path to capath or ``None`` if the directory " "doesn't exist," msgstr ":attr:`capath` - 解析後的 capath 路徑,如果目錄不存在則為 ``None``," -#: ../../library/ssl.rst:406 +#: ../../library/ssl.rst:428 msgid "" ":attr:`openssl_cafile_env` - OpenSSL's environment key that points to a " "cafile," msgstr ":attr:`openssl_cafile_env` - 指向 cafile 的 OpenSSL 環境密鑰," -#: ../../library/ssl.rst:407 +#: ../../library/ssl.rst:429 msgid ":attr:`openssl_cafile` - hard coded path to a cafile," msgstr ":attr:`openssl_cafile` - hard coded 的 cafile 路徑," -#: ../../library/ssl.rst:408 +#: ../../library/ssl.rst:430 msgid "" ":attr:`openssl_capath_env` - OpenSSL's environment key that points to a " "capath," msgstr ":attr:`openssl_capath_env` - 指向 capath 的 OpenSSL 環境密鑰," -#: ../../library/ssl.rst:409 +#: ../../library/ssl.rst:431 msgid ":attr:`openssl_capath` - hard coded path to a capath directory" msgstr ":attr:`openssl_capath` - hard coded 的 capath 目錄路徑" -#: ../../library/ssl.rst:415 +#: ../../library/ssl.rst:437 msgid "" "Retrieve certificates from Windows' system cert store. *store_name* may be " "one of ``CA``, ``ROOT`` or ``MY``. Windows may provide additional cert " @@ -659,7 +695,7 @@ msgstr "" "從 Windows 的系統憑證儲存庫中搜尋憑證。*store_name* 可以是 ``CA``、``ROOT`` " "或 ``MY`` 的其中一個。Windows 也可能會提供額外的憑證儲存庫。" -#: ../../library/ssl.rst:419 +#: ../../library/ssl.rst:441 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " "The encoding_type specifies the encoding of cert_bytes. It is either :const:" @@ -672,12 +708,12 @@ msgstr "" "`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。Trust 通過一" "組 OIDS 來指定憑證的用途,或是如果憑證對所有用途都可以使用則回傳 ``True``。" -#: ../../library/ssl.rst:426 ../../library/ssl.rst:1555 -#: ../../library/ssl.rst:1853 +#: ../../library/ssl.rst:448 ../../library/ssl.rst:1599 +#: ../../library/ssl.rst:1898 msgid "Example::" msgstr "範例: ::" -#: ../../library/ssl.rst:428 +#: ../../library/ssl.rst:450 msgid "" ">>> ssl.enum_certificates(\"CA\")\n" "[(b'data...', 'x509_asn', {'1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2'}),\n" @@ -687,11 +723,11 @@ msgstr "" "[(b'data...', 'x509_asn', {'1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2'}),\n" " (b'data...', 'x509_asn', True)]" -#: ../../library/ssl.rst:432 ../../library/ssl.rst:447 +#: ../../library/ssl.rst:454 ../../library/ssl.rst:469 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:只有 Windows。" -#: ../../library/ssl.rst:438 +#: ../../library/ssl.rst:460 msgid "" "Retrieve CRLs from Windows' system cert store. *store_name* may be one of " "``CA``, ``ROOT`` or ``MY``. Windows may provide additional cert stores, too." @@ -699,7 +735,7 @@ msgstr "" "從 Windows 的系統憑證儲存庫中搜尋 CRLs。*store_name* 可以是 ``CA``、``ROOT`` " "或 ``MY`` 的其中一個。Windows 也可能會提供額外的憑證儲存庫。" -#: ../../library/ssl.rst:442 +#: ../../library/ssl.rst:464 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " "The encoding_type specifies the encoding of cert_bytes. It is either :const:" @@ -709,18 +745,18 @@ msgstr "" "指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料的 :const:" "`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" -#: ../../library/ssl.rst:453 +#: ../../library/ssl.rst:475 msgid "Constants" msgstr "常數" -#: ../../library/ssl.rst:455 +#: ../../library/ssl.rst:477 msgid "" "All constants are now :class:`enum.IntEnum` or :class:`enum.IntFlag` " "collections." msgstr "" "所有的常數現在都是 :class:`enum.IntEnum` 或 :class:`enum.IntFlag` 的集合。" -#: ../../library/ssl.rst:461 +#: ../../library/ssl.rst:483 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. Except for :const:" "`PROTOCOL_TLS_CLIENT`, it is the default mode. With client-side sockets, " @@ -731,7 +767,7 @@ msgstr "" "外,這是預設的模式。對於客戶端的 sockets,幾乎任何憑證都能被允許。驗證錯誤," "像是不被信任或是過期的憑證,會被忽略並不會中止 TLS/SSL 握手。" -#: ../../library/ssl.rst:467 +#: ../../library/ssl.rst:489 msgid "" "In server mode, no certificate is requested from the client, so the client " "does not send any for client cert authentication." @@ -739,11 +775,11 @@ msgstr "" "在伺服器模式下,不會從客戶端請求任何憑證,所以客戶端不用發送任何用於客戶端憑" "證身分驗證的憑證。" -#: ../../library/ssl.rst:470 ../../library/ssl.rst:2261 +#: ../../library/ssl.rst:492 ../../library/ssl.rst:2400 msgid "See the discussion of :ref:`ssl-security` below." msgstr "參閱下方 :ref:`ssl-security` 的討論。" -#: ../../library/ssl.rst:474 +#: ../../library/ssl.rst:496 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In client mode, :const:" "`CERT_OPTIONAL` has the same meaning as :const:`CERT_REQUIRED`. It is " @@ -753,7 +789,7 @@ msgstr "" "`CERT_OPTIONAL` 具有與 :const:`CERT_REQUIRED` 相同的含意。對於客戶端 sockets " "推薦改用 :const:`CERT_REQUIRED`。" -#: ../../library/ssl.rst:479 +#: ../../library/ssl.rst:501 msgid "" "In server mode, a client certificate request is sent to the client. The " "client may either ignore the request or send a certificate in order perform " @@ -765,7 +801,7 @@ msgstr "" "發送憑證來執行 TLS 客戶端憑證身分驗證。如果客戶端選擇發送憑證,則會對其進行驗" "證。任何驗證錯誤都會立刻終止 TLS 握手。" -#: ../../library/ssl.rst:485 ../../library/ssl.rst:504 +#: ../../library/ssl.rst:507 ../../library/ssl.rst:526 msgid "" "Use of this setting requires a valid set of CA certificates to be passed to :" "meth:`SSLContext.load_verify_locations`." @@ -773,7 +809,7 @@ msgstr "" "使用此設定需要將一組有效的 CA 憑證傳送給 :meth:`SSLContext." "load_verify_locations`。" -#: ../../library/ssl.rst:490 +#: ../../library/ssl.rst:512 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In this mode, " "certificates are required from the other side of the socket connection; an :" @@ -791,7 +827,7 @@ msgstr "" "`PROTOCOL_TLS_CLIENT` 會使用 :const:`CERT_REQUIRED` 並預設開啟 :attr:" "`~SSLContext.check_hostname`。" -#: ../../library/ssl.rst:500 +#: ../../library/ssl.rst:522 msgid "" "With server socket, this mode provides mandatory TLS client cert " "authentication. A client certificate request is sent to the client and the " @@ -800,11 +836,11 @@ msgstr "" "對於 socket 伺服器,此模式會提供強制的 TLS 客戶端憑證驗證。客戶端憑證請求會被" "發送給客戶端並且客戶端必須提供有效且被信任的憑證。" -#: ../../library/ssl.rst:509 +#: ../../library/ssl.rst:531 msgid ":class:`enum.IntEnum` collection of CERT_* constants." msgstr ":class:`enum.IntEnum` 為 CERT_* 常數的一個集合。" -#: ../../library/ssl.rst:515 +#: ../../library/ssl.rst:537 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, " "certificate revocation lists (CRLs) are not checked. By default OpenSSL does " @@ -813,7 +849,7 @@ msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。在此模式下,不會檢查憑證吊銷列表 " "(CRLs)。預設的 OpenSSL 並不會請求及驗證 CRLs。" -#: ../../library/ssl.rst:523 +#: ../../library/ssl.rst:545 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, only the " "peer cert is checked but none of the intermediate CA certificates. The mode " @@ -826,7 +862,7 @@ msgstr "" "效的 CRL 簽名。如果沒有用 :attr:`SSLContext.load_verify_locations` 載入適當" "的 CRL,則會驗證失敗。" -#: ../../library/ssl.rst:533 +#: ../../library/ssl.rst:555 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, CRLs of " "all certificates in the peer cert chain are checked." @@ -834,7 +870,7 @@ msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。在此模式下,會檢查對等憑證鍊中所有" "憑證的 CRLs。" -#: ../../library/ssl.rst:540 +#: ../../library/ssl.rst:562 msgid "" "Possible value for :attr:`SSLContext.verify_flags` to disable workarounds " "for broken X.509 certificates." @@ -842,13 +878,13 @@ msgstr "" ":attr:`SSLContext.verify_flags` 可能的值,用來禁用已損壞的 X.509 憑證的解決方" "法。" -#: ../../library/ssl.rst:547 +#: ../../library/ssl.rst:569 msgid "" "Possible value for :attr:`SSLContext.verify_flags` to enables proxy " "certificate verification." msgstr ":attr:`SSLContext.verify_flags` 可能的值,用來啟用憑證代理驗證。" -#: ../../library/ssl.rst:554 +#: ../../library/ssl.rst:576 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to " "prefer trusted certificates when building the trust chain to validate a " @@ -857,7 +893,7 @@ msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。它指示 OpenSSL 在構建信任鍊來驗證憑" "證時會優先使用被信任的憑證。此旗標預設開啟。" -#: ../../library/ssl.rst:562 +#: ../../library/ssl.rst:584 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to " "accept intermediate CAs in the trust store to be treated as trust-anchors, " @@ -869,11 +905,11 @@ msgstr "" "間 CAs 作為信任錨,就像自簽名的根 CA 憑證。這樣就能去信任中間 CA 所頒發的憑" "證,而不一定非要去信任其祖先的根 CA。" -#: ../../library/ssl.rst:573 +#: ../../library/ssl.rst:595 msgid ":class:`enum.IntFlag` collection of VERIFY_* constants." msgstr ":class:`enum.IntFlag` 為 VERIFY_* 常數的其中一個集合。" -#: ../../library/ssl.rst:579 +#: ../../library/ssl.rst:601 msgid "" "Selects the highest protocol version that both the client and server " "support. Despite the name, this option can select both \"SSL\" and \"TLS\" " @@ -882,7 +918,7 @@ msgstr "" "選擇客戶端及伺服器均可以支援最高協定版本。儘管名稱只有 「TLS」,但實際上" "「SSL」和「TLS」均可以選擇。" -#: ../../library/ssl.rst:586 +#: ../../library/ssl.rst:608 msgid "" "TLS clients and servers require different default settings for secure " "communication. The generic TLS protocol constant is deprecated in favor of :" @@ -891,7 +927,7 @@ msgstr "" "TLS 的客戶端及伺服器端需要不同的預設值來實現安全通訊。通用的 TLS 協定常數已被" "廢除,並改用 :data:`PROTOCOL_TLS_CLIENT` 和 :data:`PROTOCOL_TLS_SERVER`。" -#: ../../library/ssl.rst:592 +#: ../../library/ssl.rst:614 msgid "" "Auto-negotiate the highest protocol version that both the client and server " "support, and configure the context client-side connections. The protocol " @@ -901,35 +937,35 @@ msgstr "" "自動協商客戶端和服務器都支援的最高協議版本,並配置客戶端語境連線。該協定預設" "啟用 :data:`CERT_REQUIRED` 和 :attr:`~SSLContext.check_hostname`。" -#: ../../library/ssl.rst:601 +#: ../../library/ssl.rst:623 msgid "" "Auto-negotiate the highest protocol version that both the client and server " "support, and configure the context server-side connections." msgstr "自動協商客戶端和服務器都支援的最高協議版本,並配置客戶端語境連線。" -#: ../../library/ssl.rst:608 +#: ../../library/ssl.rst:630 msgid "Alias for :data:`PROTOCOL_TLS`." msgstr ":data:`PROTOCOL_TLS` 的別名。" -#: ../../library/ssl.rst:612 +#: ../../library/ssl.rst:634 msgid "Use :data:`PROTOCOL_TLS` instead." msgstr "請改用 :data:`PROTOCOL_TLS`。" -#: ../../library/ssl.rst:616 +#: ../../library/ssl.rst:638 msgid "Selects SSL version 3 as the channel encryption protocol." msgstr "選擇第三版的 SSL 做為通道加密協定。" -#: ../../library/ssl.rst:618 +#: ../../library/ssl.rst:640 msgid "" "This protocol is not available if OpenSSL is compiled with the ``no-ssl3`` " "option." msgstr "如果 OpenSSL 是用 ``no-ssl3`` 編譯的,則此項協議無法使用。" -#: ../../library/ssl.rst:623 +#: ../../library/ssl.rst:645 msgid "SSL version 3 is insecure. Its use is highly discouraged." msgstr "第三版的 SSL 是不安全的,強烈建議不要使用。" -#: ../../library/ssl.rst:627 +#: ../../library/ssl.rst:649 msgid "" "OpenSSL has deprecated all version specific protocols. Use the default " "protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` with :" @@ -940,16 +976,16 @@ msgstr "" "`PROTOCOL_TLS_SERVER` 協定或帶有 :attr:`SSLContext.minimum_version` 和 :attr:" "`SSLContext.maximum_version` 的 :data:`PROTOCOL_TLS_CLIENT`。" -#: ../../library/ssl.rst:635 +#: ../../library/ssl.rst:657 msgid "Selects TLS version 1.0 as the channel encryption protocol." msgstr "選擇 1.0 版的 TLS 做為通道加密協定。" -#: ../../library/ssl.rst:639 ../../library/ssl.rst:650 -#: ../../library/ssl.rst:661 +#: ../../library/ssl.rst:661 ../../library/ssl.rst:672 +#: ../../library/ssl.rst:683 msgid "OpenSSL has deprecated all version specific protocols." msgstr "OpenSSL 已經將所有版本特定的協定棄用。" -#: ../../library/ssl.rst:643 +#: ../../library/ssl.rst:665 msgid "" "Selects TLS version 1.1 as the channel encryption protocol. Available only " "with openssl version 1.0.1+." @@ -957,7 +993,7 @@ msgstr "" "選擇 1.1 版的 TLS 做為通道加密協定。只有在 1.0.1 版本以上的 OpenSSL 才可以選" "用。" -#: ../../library/ssl.rst:654 +#: ../../library/ssl.rst:676 msgid "" "Selects TLS version 1.2 as the channel encryption protocol. Available only " "with openssl version 1.0.1+." @@ -965,7 +1001,7 @@ msgstr "" "選擇 1.2 版的 TLS 做為通道加密協定。只有在 1.0.1 版本以上的 OpenSSL 才可以選" "用。" -#: ../../library/ssl.rst:665 +#: ../../library/ssl.rst:687 msgid "" "Enables workarounds for various bugs present in other SSL implementations. " "This option is set by default. It does not necessarily set the same flags " @@ -974,7 +1010,7 @@ msgstr "" "啟用對 SSL 實作時所產生的各種錯誤的緩解措施。此選項預設被設定。它不一定設定" "與 OpenSSL 的 ``SSL_OP_ALL`` 常數相同的旗標。" -#: ../../library/ssl.rst:673 +#: ../../library/ssl.rst:695 msgid "" "Prevents an SSLv2 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing SSLv2 as " @@ -983,11 +1019,11 @@ msgstr "" "防止 SSLv2 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同級 " "(peer)選用 SSLv2 做為協定版本。" -#: ../../library/ssl.rst:681 +#: ../../library/ssl.rst:703 msgid "SSLv2 is deprecated" msgstr "SSLv2 已被棄用" -#: ../../library/ssl.rst:685 +#: ../../library/ssl.rst:707 msgid "" "Prevents an SSLv3 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing SSLv3 as " @@ -996,11 +1032,11 @@ msgstr "" "防止 SSLv3 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同級" "選用 SSLv3 做為協定版本。" -#: ../../library/ssl.rst:693 +#: ../../library/ssl.rst:715 msgid "SSLv3 is deprecated" msgstr "SSLv3 已被棄用" -#: ../../library/ssl.rst:697 +#: ../../library/ssl.rst:719 msgid "" "Prevents a TLSv1 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1 as " @@ -1009,7 +1045,7 @@ msgstr "" "防止 TLSv1 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同級" "選用 TLSv1 做為協定版本。" -#: ../../library/ssl.rst:703 +#: ../../library/ssl.rst:725 msgid "" "The option is deprecated since OpenSSL 1.1.0, use the new :attr:`SSLContext." "minimum_version` and :attr:`SSLContext.maximum_version` instead." @@ -1017,7 +1053,7 @@ msgstr "" "該選項自從 OpenSSL 1.1.0 以後已被棄用,請改用新的 :attr:`SSLContext." "minimum_version` 及 :attr:`SSLContext.maximum_version` 代替。" -#: ../../library/ssl.rst:710 +#: ../../library/ssl.rst:732 msgid "" "Prevents a TLSv1.1 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.1 as " @@ -1026,11 +1062,11 @@ msgstr "" "防止 TLSv1.1 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同" "級選用 TLSv1.1 做為協定版本。只有 1.0.1 版後的 OpenSSL 版本才能使用。" -#: ../../library/ssl.rst:716 ../../library/ssl.rst:727 +#: ../../library/ssl.rst:738 ../../library/ssl.rst:749 msgid "The option is deprecated since OpenSSL 1.1.0." msgstr "此選項自 OpenSSL 1.1.0 版已被棄用。" -#: ../../library/ssl.rst:721 +#: ../../library/ssl.rst:743 msgid "" "Prevents a TLSv1.2 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.2 as " @@ -1039,7 +1075,7 @@ msgstr "" "防止 TLSv1.2 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同" "級選用 TLSv1.2 做為協定版本。只有 1.0.1 版後的 OpenSSL 版本才能使用。" -#: ../../library/ssl.rst:732 +#: ../../library/ssl.rst:754 msgid "" "Prevents a TLSv1.3 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.3 as " @@ -1051,7 +1087,7 @@ msgstr "" "級選用 TLSv1.3 做為協定版本。TSL1.3 只適用於 1.1.1 版以後的 OpenSSL。當使用 " "Python 編譯舊版的 OpenSSL 時,該標志預設為 *0*。" -#: ../../library/ssl.rst:740 +#: ../../library/ssl.rst:762 msgid "" "The option is deprecated since OpenSSL 1.1.0. It was added to 2.7.15 and " "3.6.3 for backwards compatibility with OpenSSL 1.0.2." @@ -1059,7 +1095,7 @@ msgstr "" "此選項自 OpenSSL 1.1.0 以後已被棄用。它被添加到 2.7.15 和 3.6.3 中,以向後相" "容 OpenSSL 1.0.2。" -#: ../../library/ssl.rst:746 +#: ../../library/ssl.rst:768 msgid "" "Disable all renegotiation in TLSv1.2 and earlier. Do not send HelloRequest " "messages, and ignore renegotiation requests via ClientHello." @@ -1067,11 +1103,11 @@ msgstr "" "停用所有在 TLSv1.2 及更早版本的重協商 (renegotiation)。不發送 HelloRequest 訊" "息,並忽略通過 ClientHello 的重協商請求。" -#: ../../library/ssl.rst:749 +#: ../../library/ssl.rst:771 msgid "This option is only available with OpenSSL 1.1.0h and later." msgstr "此選項僅適用於 OpenSSL 1.1.0h 及更新版本。" -#: ../../library/ssl.rst:755 +#: ../../library/ssl.rst:777 msgid "" "Use the server's cipher ordering preference, rather than the client's. This " "option has no effect on client sockets and SSLv2 server sockets." @@ -1079,7 +1115,7 @@ msgstr "" "使用伺服器的加密方法名稱字串排序優先順序,而不是客戶端的。此選項並不會影響到" "客戶端及 SSLv2 伺服器的 sockets。" -#: ../../library/ssl.rst:762 +#: ../../library/ssl.rst:784 msgid "" "Prevents reuse of the same DH key for distinct SSL sessions. This improves " "forward secrecy but requires more computational resources. This option only " @@ -1088,7 +1124,7 @@ msgstr "" "防止對不同的 SSL 會談重複使用相同的 DH 密鑰。這會加強向前保密但需要更多的運算" "資源。此選項只適用於伺服器 sockets。" -#: ../../library/ssl.rst:770 +#: ../../library/ssl.rst:792 msgid "" "Prevents reuse of the same ECDH key for distinct SSL sessions. This " "improves forward secrecy but requires more computational resources. This " @@ -1097,7 +1133,7 @@ msgstr "" "防止對不同的 SSL 會談重複使用相同的 ECDH 密鑰。這會加強向前保密但需要更多的運" "算資源。此選項只適用於伺服器 sockets。" -#: ../../library/ssl.rst:778 +#: ../../library/ssl.rst:800 msgid "" "Send dummy Change Cipher Spec (CCS) messages in TLS 1.3 handshake to make a " "TLS 1.3 connection look more like a TLS 1.2 connection." @@ -1105,34 +1141,34 @@ msgstr "" "在 TLS 1.3 握手中發送虛擬的變更加密方法規範 (CCS) 消息,以使 TLS 1.3 連接看起" "來更像 TLS 1.2 連線。" -#: ../../library/ssl.rst:781 +#: ../../library/ssl.rst:803 msgid "This option is only available with OpenSSL 1.1.1 and later." msgstr "此選項僅適用於 OpenSSL 1.1.1 及更新版本。" -#: ../../library/ssl.rst:787 +#: ../../library/ssl.rst:809 msgid "" "Disable compression on the SSL channel. This is useful if the application " "protocol supports its own compression scheme." msgstr "" "在 SSL 通道上禁用壓縮。如果應用程序協定支援自己的壓縮方案,這會很有用。" -#: ../../library/ssl.rst:794 +#: ../../library/ssl.rst:816 msgid ":class:`enum.IntFlag` collection of OP_* constants." msgstr ":class:`enum.IntFlag` 為 OP_* 常數中的一個集合。" -#: ../../library/ssl.rst:798 +#: ../../library/ssl.rst:820 msgid "Prevent client side from requesting a session ticket." msgstr "防止客戶端請求會談票據。" -#: ../../library/ssl.rst:804 +#: ../../library/ssl.rst:826 msgid "Ignore unexpected shutdown of TLS connections." msgstr "忽略意外關閉的 TLS 連線。" -#: ../../library/ssl.rst:806 ../../library/ssl.rst:822 +#: ../../library/ssl.rst:828 ../../library/ssl.rst:844 msgid "This option is only available with OpenSSL 3.0.0 and later." msgstr "此選項僅適用於 OpenSSL 3.0.0 及更新版本。" -#: ../../library/ssl.rst:812 +#: ../../library/ssl.rst:834 msgid "" "Enable the use of the kernel TLS. To benefit from the feature, OpenSSL must " "have been compiled with support for it, and the negotiated cipher suites and " @@ -1143,7 +1179,7 @@ msgstr "" "的加密套件及擴充套件也必須被該功能支援 (該功能所支援的列表可能會因平台及核心" "而有所差異)。" -#: ../../library/ssl.rst:817 +#: ../../library/ssl.rst:839 msgid "" "Note that with enabled kernel TLS some cryptographic operations are " "performed by the kernel directly and not via any available OpenSSL " @@ -1154,13 +1190,13 @@ msgstr "" "的 OpenSSL 所提供的程序,而這可能並非你所想使用的,例如:當應用程式要求所有的" "加密操作由 FIPS 提供執行。" -#: ../../library/ssl.rst:828 +#: ../../library/ssl.rst:850 msgid "" "Allow legacy insecure renegotiation between OpenSSL and unpatched servers " "only." msgstr "只允許 OpenSSL 與未修補的伺服器進行遺留 (legacy) 不安全重協商。" -#: ../../library/ssl.rst:835 +#: ../../library/ssl.rst:857 msgid "" "Whether the OpenSSL library has built-in support for the *Application-Layer " "Protocol Negotiation* TLS extension as described in :rfc:`7301`." @@ -1168,7 +1204,7 @@ msgstr "" "OpenSSL 函式庫是否內建支援 *應用層協定協商* TLS 擴充套件,該擴充套件描述在 :" "rfc:`7301` 中。" -#: ../../library/ssl.rst:842 +#: ../../library/ssl.rst:864 msgid "" "Whether the OpenSSL library has built-in support not checking subject common " "name and :attr:`SSLContext.hostname_checks_common_name` is writeable." @@ -1176,7 +1212,7 @@ msgstr "" "OpenSSL 函式庫是否內建支援不檢查主題通用名稱及 :attr:`SSLContext." "hostname_checks_common_name` 是否可寫。" -#: ../../library/ssl.rst:850 +#: ../../library/ssl.rst:872 msgid "" "Whether the OpenSSL library has built-in support for the Elliptic Curve-" "based Diffie-Hellman key exchange. This should be true unless the feature " @@ -1185,7 +1221,7 @@ msgstr "" "OpenSSL 函式庫是否內建支援基於橢圓曲線的 (Elliptic Curve-based) Diffie-" "Hellman 金鑰交換。此回傳值應該要為 true 除非發布者明確禁用此功能。" -#: ../../library/ssl.rst:858 +#: ../../library/ssl.rst:880 msgid "" "Whether the OpenSSL library has built-in support for the *Server Name " "Indication* extension (as defined in :rfc:`6066`)." @@ -1193,7 +1229,7 @@ msgstr "" "OpenSSL 函式庫是否內建支援 *伺服器名稱提示* 擴充套件 (在 :rfc:`6066` 中定" "義)。" -#: ../../library/ssl.rst:865 +#: ../../library/ssl.rst:887 msgid "" "Whether the OpenSSL library has built-in support for the *Next Protocol " "Negotiation* as described in the `Application Layer Protocol Negotiation " @@ -1206,37 +1242,42 @@ msgstr "" "描述。當此值為 true 時,你可以使用 :meth:`SSLContext.set_npn_protocols` 方法" "來公告你想支援的協定。" -#: ../../library/ssl.rst:875 +#: ../../library/ssl.rst:897 msgid "" "Whether the OpenSSL library has built-in support for the SSL 2.0 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 SSL 2.0 協定。" -#: ../../library/ssl.rst:881 +#: ../../library/ssl.rst:903 msgid "" "Whether the OpenSSL library has built-in support for the SSL 3.0 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 SSL 3.0 協定。" -#: ../../library/ssl.rst:887 +#: ../../library/ssl.rst:909 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.0 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.0 協定。" -#: ../../library/ssl.rst:893 +#: ../../library/ssl.rst:915 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.1 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.1 協定。" -#: ../../library/ssl.rst:899 +#: ../../library/ssl.rst:921 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.2 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.2 協定。" -#: ../../library/ssl.rst:905 +#: ../../library/ssl.rst:927 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.3 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.3 協定。" -#: ../../library/ssl.rst:911 +#: ../../library/ssl.rst:933 +#, fuzzy +msgid "Whether the OpenSSL library has built-in support for TLS-PSK." +msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.0 協定。" + +#: ../../library/ssl.rst:939 msgid "" "List of supported TLS channel binding types. Strings in this list can be " "used as arguments to :meth:`SSLSocket.get_channel_binding`." @@ -1244,11 +1285,11 @@ msgstr "" "支援的 TLS 通道綁定類型列表。列表中的字串可以作為 :meth:`SSLSocket." "get_channel_binding` 的參數。" -#: ../../library/ssl.rst:918 +#: ../../library/ssl.rst:946 msgid "The version string of the OpenSSL library loaded by the interpreter::" msgstr "直譯器所加載的 OpenSSL 函式庫的版本字串::" -#: ../../library/ssl.rst:920 +#: ../../library/ssl.rst:948 msgid "" ">>> ssl.OPENSSL_VERSION\n" "'OpenSSL 1.0.2k 26 Jan 2017'" @@ -1256,13 +1297,13 @@ msgstr "" ">>> ssl.OPENSSL_VERSION\n" "'OpenSSL 1.0.2k 26 Jan 2017'" -#: ../../library/ssl.rst:927 +#: ../../library/ssl.rst:955 msgid "" "A tuple of five integers representing version information about the OpenSSL " "library::" msgstr "代表 OpenSSL 函式庫版本資訊的五個整數的元組: ::" -#: ../../library/ssl.rst:930 +#: ../../library/ssl.rst:958 msgid "" ">>> ssl.OPENSSL_VERSION_INFO\n" "(1, 0, 2, 11, 15)" @@ -1270,11 +1311,11 @@ msgstr "" ">>> ssl.OPENSSL_VERSION_INFO\n" "(1, 0, 2, 11, 15)" -#: ../../library/ssl.rst:937 +#: ../../library/ssl.rst:965 msgid "The raw version number of the OpenSSL library, as a single integer::" msgstr "OpenSSL 函式庫的初始版本,以單一整數表示::" -#: ../../library/ssl.rst:939 +#: ../../library/ssl.rst:967 msgid "" ">>> ssl.OPENSSL_VERSION_NUMBER\n" "268443839\n" @@ -1286,7 +1327,7 @@ msgstr "" ">>> hex(ssl.OPENSSL_VERSION_NUMBER)\n" "'0x100020bf'" -#: ../../library/ssl.rst:950 +#: ../../library/ssl.rst:978 msgid "" "Alert Descriptions from :rfc:`5246` and others. The `IANA TLS Alert Registry " "`_ 包" "含了此列表以及其含義定義所在的 RFC 的引用。" -#: ../../library/ssl.rst:954 +#: ../../library/ssl.rst:982 msgid "" "Used as the return value of the callback function in :meth:`SSLContext." "set_servername_callback`." msgstr "" "被用來做為 :meth:`SSLContext.set_servername_callback` 中回呼函式的回傳值。" -#: ../../library/ssl.rst:961 +#: ../../library/ssl.rst:989 msgid ":class:`enum.IntEnum` collection of ALERT_DESCRIPTION_* constants." msgstr ":class:`enum.IntEnum` 為 ALERT_DESCRIPTION_* 常數中的一個集合。" -#: ../../library/ssl.rst:967 +#: ../../library/ssl.rst:995 msgid "" "Option for :func:`create_default_context` and :meth:`SSLContext." "load_default_certs`. This value indicates that the context may be used to " @@ -1318,7 +1359,7 @@ msgstr "" ":func:`create_default_context` 和 :meth:`SSLContext.load_default_certs` 的選" "項。此值表示該語境可能會用於驗證網頁伺服器 (因此它將用於建立用戶端 socket)。" -#: ../../library/ssl.rst:976 +#: ../../library/ssl.rst:1004 msgid "" "Option for :func:`create_default_context` and :meth:`SSLContext." "load_default_certs`. This value indicates that the context may be used to " @@ -1329,11 +1370,11 @@ msgstr "" "項。此值表示該語境可能會用於驗證網頁用戶端 (因此,它將用於建立伺服器端的 " "socket)。" -#: ../../library/ssl.rst:985 +#: ../../library/ssl.rst:1013 msgid ":class:`enum.IntEnum` collection of SSL_ERROR_* constants." msgstr ":class:`enum.IntEnum` 為 SSL_ERROR_* 常數中的一個集合。" -#: ../../library/ssl.rst:991 +#: ../../library/ssl.rst:1019 msgid "" ":class:`enum.IntEnum` collection of SSL and TLS versions for :attr:" "`SSLContext.maximum_version` and :attr:`SSLContext.minimum_version`." @@ -1341,7 +1382,7 @@ msgstr "" "用於 :attr:`SSLContext.maximum_version` 和 :attr:`SSLContext." "minimum_version` 的 SSL 和 TLS 版本 :class:`enum.IntEnum` 集合。" -#: ../../library/ssl.rst:999 +#: ../../library/ssl.rst:1027 msgid "" "The minimum or maximum supported SSL or TLS version. These are magic " "constants. Their values don't reflect the lowest and highest available TLS/" @@ -1350,11 +1391,11 @@ msgstr "" "最低或最高支援的 SSL 或 TLS 版本。這些是特殊常數。它們的值並不反映可用的最低" "和最高 TLS/SSL 版本。" -#: ../../library/ssl.rst:1009 +#: ../../library/ssl.rst:1037 msgid "SSL 3.0 to TLS 1.3." msgstr "SSL 3.0 到 TLS 1.3。" -#: ../../library/ssl.rst:1013 +#: ../../library/ssl.rst:1041 msgid "" "All :class:`TLSVersion` members except :attr:`TLSVersion.TLSv1_2` and :attr:" "`TLSVersion.TLSv1_3` are deprecated." @@ -1362,47 +1403,47 @@ msgstr "" "除了 :attr:`TLSVersion.TLSv1_2` 和 :attr:`TLSVersion.TLSv1_3` 之外,所有的 :" "class:`TLSVersion` 成員都已被棄用。" -#: ../../library/ssl.rst:1018 +#: ../../library/ssl.rst:1046 msgid "SSL Sockets" msgstr "SSL Sockets" -#: ../../library/ssl.rst:1022 +#: ../../library/ssl.rst:1050 msgid "SSL sockets provide the following methods of :ref:`socket-objects`:" msgstr "SSL sockets 提供以下 :ref:`socket-objects` 方法:" -#: ../../library/ssl.rst:1024 +#: ../../library/ssl.rst:1052 msgid ":meth:`~socket.socket.accept`" msgstr ":meth:`~socket.socket.accept`" -#: ../../library/ssl.rst:1025 +#: ../../library/ssl.rst:1053 msgid ":meth:`~socket.socket.bind`" msgstr ":meth:`~socket.socket.bind`" -#: ../../library/ssl.rst:1026 +#: ../../library/ssl.rst:1054 msgid ":meth:`~socket.socket.close`" msgstr ":meth:`~socket.socket.close`" -#: ../../library/ssl.rst:1027 +#: ../../library/ssl.rst:1055 msgid ":meth:`~socket.socket.connect`" msgstr ":meth:`~socket.socket.connect`" -#: ../../library/ssl.rst:1028 +#: ../../library/ssl.rst:1056 msgid ":meth:`~socket.socket.detach`" msgstr ":meth:`~socket.socket.detach`" -#: ../../library/ssl.rst:1029 +#: ../../library/ssl.rst:1057 msgid ":meth:`~socket.socket.fileno`" msgstr ":meth:`~socket.socket.fileno`" -#: ../../library/ssl.rst:1030 +#: ../../library/ssl.rst:1058 msgid ":meth:`~socket.socket.getpeername`, :meth:`~socket.socket.getsockname`" msgstr ":meth:`~socket.socket.getpeername`、:meth:`~socket.socket.getsockname`" -#: ../../library/ssl.rst:1031 +#: ../../library/ssl.rst:1059 msgid ":meth:`~socket.socket.getsockopt`, :meth:`~socket.socket.setsockopt`" msgstr ":meth:`~socket.socket.getsockopt`、:meth:`~socket.socket.setsockopt`" -#: ../../library/ssl.rst:1032 +#: ../../library/ssl.rst:1060 msgid "" ":meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`, :meth:" "`~socket.socket.setblocking`" @@ -1410,15 +1451,15 @@ msgstr "" ":meth:`~socket.socket.gettimeout`、:meth:`~socket.socket.settimeout`、:meth:" "`~socket.socket.setblocking`" -#: ../../library/ssl.rst:1034 +#: ../../library/ssl.rst:1062 msgid ":meth:`~socket.socket.listen`" msgstr ":meth:`~socket.socket.listen`" -#: ../../library/ssl.rst:1035 +#: ../../library/ssl.rst:1063 msgid ":meth:`~socket.socket.makefile`" msgstr ":meth:`~socket.socket.makefile`" -#: ../../library/ssl.rst:1036 +#: ../../library/ssl.rst:1064 msgid "" ":meth:`~socket.socket.recv`, :meth:`~socket.socket.recv_into` (but passing a " "non-zero ``flags`` argument is not allowed)" @@ -1426,7 +1467,7 @@ msgstr "" ":meth:`~socket.socket.recv`、:meth:`~socket.socket.recv_into` (但不允許傳遞" "非零的 ``flags`` 引數)" -#: ../../library/ssl.rst:1038 +#: ../../library/ssl.rst:1066 msgid "" ":meth:`~socket.socket.send`, :meth:`~socket.socket.sendall` (with the same " "limitation)" @@ -1434,7 +1475,7 @@ msgstr "" ":meth:`~socket.socket.send`、:meth:`~socket.socket.sendall` (同樣不允許傳遞" "非零的 ``flags`` 引數)" -#: ../../library/ssl.rst:1040 +#: ../../library/ssl.rst:1068 msgid "" ":meth:`~socket.socket.sendfile` (but :mod:`os.sendfile` will be used for " "plain-text sockets only, else :meth:`~socket.socket.send` will be used)" @@ -1442,11 +1483,11 @@ msgstr "" ":meth:`~socket.socket.sendfile` (但 :mod:`os.sendfile` 只能用於純文本 " "sockets,其餘則會使用 :meth:`~socket.socket.send`)" -#: ../../library/ssl.rst:1042 +#: ../../library/ssl.rst:1070 msgid ":meth:`~socket.socket.shutdown`" msgstr ":meth:`~socket.socket.shutdown`" -#: ../../library/ssl.rst:1044 +#: ../../library/ssl.rst:1072 msgid "" "However, since the SSL (and TLS) protocol has its own framing atop of TCP, " "the SSL sockets abstraction can, in certain respects, diverge from the " @@ -1457,18 +1498,18 @@ msgstr "" "sockets 的抽象可能會與普通操作系統級別的 sockets 規範有所不同。特別是請參閱" "\\ :ref:`關於 non-blocking sockets 的說明 `。" -#: ../../library/ssl.rst:1049 +#: ../../library/ssl.rst:1077 msgid "" "Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." "wrap_socket` method." msgstr "" ":class:`SSLSocket` 的實例必須使用 :meth:`SSLContext.wrap_socket` 方法建立。" -#: ../../library/ssl.rst:1052 +#: ../../library/ssl.rst:1080 msgid "The :meth:`sendfile` method was added." msgstr "新增 :meth:`sendfile` 方法。" -#: ../../library/ssl.rst:1055 +#: ../../library/ssl.rst:1083 msgid "" "The :meth:`shutdown` does not reset the socket timeout each time bytes are " "received or sent. The socket timeout is now the maximum total duration of " @@ -1477,7 +1518,7 @@ msgstr "" ":meth:`shutdown` 不會在每次接收或發送位元組時重置 socket 超時時間。現在," "socket 超時時間是關閉操作的最大總持續時間。" -#: ../../library/ssl.rst:1060 +#: ../../library/ssl.rst:1088 msgid "" "It is deprecated to create a :class:`SSLSocket` instance directly, use :meth:" "`SSLContext.wrap_socket` to wrap a socket." @@ -1485,7 +1526,7 @@ msgstr "" "直接建立 :class:`SSLSocket` 實例的方式已被棄用,請使用 :meth:`SSLContext." "wrap_socket` 來包裝 socket。" -#: ../../library/ssl.rst:1064 +#: ../../library/ssl.rst:1092 msgid "" ":class:`SSLSocket` instances must to created with :meth:`~SSLContext." "wrap_socket`. In earlier versions, it was possible to create instances " @@ -1494,7 +1535,7 @@ msgstr "" ":class:`SSLSocket` 實例必須使用 :meth:`~SSLContext.wrap_socket` 建立。在較早" "的版本中可以直接建立實例,但這從未被記錄或正式支援。" -#: ../../library/ssl.rst:1070 +#: ../../library/ssl.rst:1098 msgid "" "Python now uses ``SSL_read_ex`` and ``SSL_write_ex`` internally. The " "functions support reading and writing of data larger than 2 GB. Writing zero-" @@ -1503,11 +1544,11 @@ msgstr "" "Python 現在內部使用了 ``SSL_read_ex`` 和 ``SSL_write_ex`` 函式。這些函式支援" "讀取和寫入大於 2 GB 的資料。寫入零長度的資料不再會導致協定違規錯誤。" -#: ../../library/ssl.rst:1075 +#: ../../library/ssl.rst:1103 msgid "SSL sockets also have the following additional methods and attributes:" msgstr "SSL sockets 還具有以下附加方法和屬性:" -#: ../../library/ssl.rst:1079 +#: ../../library/ssl.rst:1107 msgid "" "Read up to *len* bytes of data from the SSL socket and return the result as " "a ``bytes`` instance. If *buffer* is specified, then read into the buffer " @@ -1516,7 +1557,7 @@ msgstr "" "從 SSL socket 讀取 *len* 位元組的資料,並將結果以 ``bytes`` 實例的形式回傳。" "如果指定了 *buffer*,則將資料讀入緩衝區,並回傳讀取的位元組。" -#: ../../library/ssl.rst:1083 +#: ../../library/ssl.rst:1111 msgid "" "Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" "ref:`non-blocking ` and the read would block." @@ -1524,14 +1565,14 @@ msgstr "" "如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" "`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且讀取操作將會被阻塞。" -#: ../../library/ssl.rst:1086 +#: ../../library/ssl.rst:1114 msgid "" "As at any time a re-negotiation is possible, a call to :meth:`read` can also " "cause write operations." msgstr "" "由於在任何時刻都可能發生重新協商,呼叫 :meth:`read` 也可能觸發寫入操作。" -#: ../../library/ssl.rst:1089 +#: ../../library/ssl.rst:1117 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " "The socket timeout is now the maximum total duration to read up to *len* " @@ -1540,11 +1581,11 @@ msgstr "" "當接收或發送位元組時,socket 的超時時間將不再重置。現在,socket 超時時間是讀" "取最多 *len* 位元組的總最大持續時間。" -#: ../../library/ssl.rst:1094 +#: ../../library/ssl.rst:1122 msgid "Use :meth:`~SSLSocket.recv` instead of :meth:`~SSLSocket.read`." msgstr "請改用 :meth:`~SSLSocket.recv` 來替換掉 :meth:`~SSLSocket.read`。" -#: ../../library/ssl.rst:1099 +#: ../../library/ssl.rst:1127 msgid "" "Write *buf* to the SSL socket and return the number of bytes written. The " "*buf* argument must be an object supporting the buffer interface." @@ -1552,7 +1593,7 @@ msgstr "" "將 *buf* 寫入 SSL socket 並回傳寫入的位元組數量。*buf* 引數必須是支援緩衝區介" "面的物件。" -#: ../../library/ssl.rst:1102 +#: ../../library/ssl.rst:1130 msgid "" "Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" "ref:`non-blocking ` and the write would block." @@ -1560,14 +1601,14 @@ msgstr "" "如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" "`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且寫入操作將會被阻塞。" -#: ../../library/ssl.rst:1105 +#: ../../library/ssl.rst:1133 msgid "" "As at any time a re-negotiation is possible, a call to :meth:`write` can " "also cause read operations." msgstr "" "由於在任何時刻都可能發生重新協商,呼叫 :meth:`write` 也可能觸發讀取操作。" -#: ../../library/ssl.rst:1108 +#: ../../library/ssl.rst:1136 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " "The socket timeout is now the maximum total duration to write *buf*." @@ -1575,11 +1616,11 @@ msgstr "" "當接收或發送位元組時,socket 的超時時間將不再重置。現在,socket 超時時間是寫" "入 *buf* 的總最大持續時間。" -#: ../../library/ssl.rst:1112 +#: ../../library/ssl.rst:1140 msgid "Use :meth:`~SSLSocket.send` instead of :meth:`~SSLSocket.write`." msgstr "請改用 :meth:`~SSLSocket.send` 來替換掉 :meth:`~SSLSocket.write`。" -#: ../../library/ssl.rst:1117 +#: ../../library/ssl.rst:1145 msgid "" "The :meth:`~SSLSocket.read` and :meth:`~SSLSocket.write` methods are the low-" "level methods that read and write unencrypted, application-level data and " @@ -1591,7 +1632,7 @@ msgstr "" "讀取和寫入未加密的應用層資料,並將其加密/解密為加密的寫入層資料。這些方法需要" "一個已建立的 SSL 連接,即握手已完成,且未呼叫 :meth:`SSLSocket.unwrap`。" -#: ../../library/ssl.rst:1123 +#: ../../library/ssl.rst:1151 msgid "" "Normally you should use the socket API methods like :meth:`~socket.socket." "recv` and :meth:`~socket.socket.send` instead of these methods." @@ -1599,11 +1640,11 @@ msgstr "" "通常你應該使用像 :meth:`~socket.socket.recv` 和 :meth:`~socket.socket.send` " "這樣的 socket API 方法,而不是直接使用這些方法。" -#: ../../library/ssl.rst:1129 +#: ../../library/ssl.rst:1157 msgid "Perform the SSL setup handshake." msgstr "執行 SSL 設定握手。" -#: ../../library/ssl.rst:1131 +#: ../../library/ssl.rst:1159 msgid "" "The handshake method also performs :func:`match_hostname` when the :attr:" "`~SSLContext.check_hostname` attribute of the socket's :attr:`~SSLSocket." @@ -1612,7 +1653,7 @@ msgstr "" "當 socket 的 :attr:`~SSLSocket.context` 的 :attr:`~SSLContext." "check_hostname` 屬性質為 true 時,握手方法也會執行 :func:`match_hostname`。" -#: ../../library/ssl.rst:1136 +#: ../../library/ssl.rst:1164 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " "The socket timeout is now the maximum total duration of the handshake." @@ -1620,7 +1661,7 @@ msgstr "" "Socket 超時時間已經不會在每次接收或傳送位元組時重置。現在,超時時間是握手過程" "的最大總持續時間。" -#: ../../library/ssl.rst:1140 +#: ../../library/ssl.rst:1168 msgid "" "Hostname or IP address is matched by OpenSSL during handshake. The function :" "func:`match_hostname` is no longer used. In case OpenSSL refuses a hostname " @@ -1631,7 +1672,7 @@ msgstr "" "`match_hostname` 函式。如果 OpenSSL 拒絕某個主機名稱或 IP 地址,握手將會提前" "中止,並向對方發送 TLS 警報訊息。" -#: ../../library/ssl.rst:1148 +#: ../../library/ssl.rst:1176 msgid "" "If there is no certificate for the peer on the other end of the connection, " "return ``None``. If the SSL handshake hasn't been done yet, raise :exc:" @@ -1640,7 +1681,7 @@ msgstr "" "如果連線端沒有證書,則回傳 ``None``。如果 SSL 握手尚未完成,則引發 :exc:" "`ValueError`。" -#: ../../library/ssl.rst:1152 +#: ../../library/ssl.rst:1180 msgid "" "If the ``binary_form`` parameter is :const:`False`, and a certificate was " "received from the peer, this method returns a :class:`dict` instance. If " @@ -1657,7 +1698,7 @@ msgstr "" "``issuer`` (簽發證書的主體)。如果證書中包含 *Subject Alternative Name* 擴充 " "(參考\\ :rfc:`3280`\\ ),字典中還會有一個 ``subjectAltName`` 鍵。" -#: ../../library/ssl.rst:1161 +#: ../../library/ssl.rst:1189 msgid "" "The ``subject`` and ``issuer`` fields are tuples containing the sequence of " "relative distinguished names (RDNs) given in the certificate's data " @@ -1668,7 +1709,7 @@ msgstr "" "names, RDNs) 序列的元組,這些 RDN 來自證書資料結構中的相應欄位。每個 RDN 都是" "一組名稱與值的對。以下是現實中的範例: ::" -#: ../../library/ssl.rst:1166 +#: ../../library/ssl.rst:1194 msgid "" "{'issuer': ((('countryName', 'IL'),),\n" " (('organizationName', 'StartCom Ltd.'),),\n" @@ -1710,7 +1751,7 @@ msgstr "" " 'subjectAltName': (('DNS', '*.eff.org'), ('DNS', 'eff.org')),\n" " 'version': 3}" -#: ../../library/ssl.rst:1185 +#: ../../library/ssl.rst:1213 msgid "" "If the ``binary_form`` parameter is :const:`True`, and a certificate was " "provided, this method returns the DER-encoded form of the entire certificate " @@ -1719,16 +1760,16 @@ msgid "" "socket's role:" msgstr "" "如果 ``binary_form`` 參數設定為 :const:`True`,且對等提供了證書,則該方法會" -"以 DER 編碼形式 將整個證書以位元組序列形式回傳。如果對等未提供證書,則回傳:" +"以 DER 編碼形式 將整個證書以位元組序列形式回傳。如果對等未提供證書,則回傳 :" "const:`None`。對等是否提供證書取決於 SSL socket 的腳色:" -#: ../../library/ssl.rst:1191 +#: ../../library/ssl.rst:1219 msgid "" "for a client SSL socket, the server will always provide a certificate, " "regardless of whether validation was required;" msgstr "對於客戶端 SSL socket,伺服器將永遠提供證書,無論是否需要進行驗證;" -#: ../../library/ssl.rst:1194 +#: ../../library/ssl.rst:1222 msgid "" "for a server SSL socket, the client will only provide a certificate when " "requested by the server; therefore :meth:`getpeercert` will return :const:" @@ -1739,28 +1780,41 @@ msgstr "" "是 :const:`CERT_NONE` (而非 :const:`CERT_OPTIONAL` 或 :const:" "`CERT_REQUIRED`),則 :meth:`getpeercert` 會回傳 :const:`None`。" -#: ../../library/ssl.rst:1199 +#: ../../library/ssl.rst:1227 msgid "See also :attr:`SSLContext.check_hostname`." msgstr "請見 :attr:`SSLContext.check_hostname`。" -#: ../../library/ssl.rst:1201 +#: ../../library/ssl.rst:1229 msgid "" "The returned dictionary includes additional items such as ``issuer`` and " "``notBefore``." msgstr "" -#: ../../library/ssl.rst:1205 +#: ../../library/ssl.rst:1233 msgid "" ":exc:`ValueError` is raised when the handshake isn't done. The returned " "dictionary includes additional X509v3 extension items such as " "``crlDistributionPoints``, ``caIssuers`` and ``OCSP`` URIs." msgstr "" -#: ../../library/ssl.rst:1210 +#: ../../library/ssl.rst:1238 msgid "IPv6 address strings no longer have a trailing new line." msgstr "" -#: ../../library/ssl.rst:1215 +#: ../../library/ssl.rst:1243 +msgid "" +"Returns verified certificate chain provided by the other end of the SSL " +"channel as a list of DER-encoded bytes. If certificate verification was " +"disabled method acts the same as :meth:`~SSLSocket.get_unverified_chain`." +msgstr "" + +#: ../../library/ssl.rst:1252 +msgid "" +"Returns raw certificate chain provided by the other end of the SSL channel " +"as a list of DER-encoded bytes." +msgstr "" + +#: ../../library/ssl.rst:1259 msgid "" "Returns a three-value tuple containing the name of the cipher being used, " "the version of the SSL protocol that defines its use, and the number of " @@ -1768,7 +1822,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/ssl.rst:1221 +#: ../../library/ssl.rst:1265 msgid "" "Return the list of ciphers available in both the client and server. Each " "entry of the returned list is a three-value tuple containing the name of the " @@ -1778,25 +1832,25 @@ msgid "" "socket." msgstr "" -#: ../../library/ssl.rst:1232 +#: ../../library/ssl.rst:1276 msgid "" "Return the compression algorithm being used as a string, or ``None`` if the " "connection isn't compressed." msgstr "" -#: ../../library/ssl.rst:1235 +#: ../../library/ssl.rst:1279 msgid "" "If the higher-level protocol supports its own compression mechanism, you can " "use :data:`OP_NO_COMPRESSION` to disable SSL-level compression." msgstr "" -#: ../../library/ssl.rst:1242 +#: ../../library/ssl.rst:1286 msgid "" "Get channel binding data for current connection, as a bytes object. Returns " "``None`` if not connected or the handshake has not been completed." msgstr "" -#: ../../library/ssl.rst:1245 +#: ../../library/ssl.rst:1289 msgid "" "The *cb_type* parameter allow selection of the desired channel binding type. " "Valid channel binding types are listed in the :data:`CHANNEL_BINDING_TYPES` " @@ -1805,7 +1859,7 @@ msgid "" "channel binding type is requested." msgstr "" -#: ../../library/ssl.rst:1255 +#: ../../library/ssl.rst:1299 msgid "" "Return the protocol that was selected during the TLS handshake. If :meth:" "`SSLContext.set_alpn_protocols` was not called, if the other party does not " @@ -1813,7 +1867,7 @@ msgid "" "protocols, or if the handshake has not happened yet, ``None`` is returned." msgstr "" -#: ../../library/ssl.rst:1265 +#: ../../library/ssl.rst:1309 msgid "" "Return the higher-level protocol that was selected during the TLS/SSL " "handshake. If :meth:`SSLContext.set_npn_protocols` was not called, or if the " @@ -1821,11 +1875,11 @@ msgid "" "this will return ``None``." msgstr "" -#: ../../library/ssl.rst:1274 ../../library/ssl.rst:1643 +#: ../../library/ssl.rst:1318 ../../library/ssl.rst:1687 msgid "NPN has been superseded by ALPN" msgstr "" -#: ../../library/ssl.rst:1278 +#: ../../library/ssl.rst:1322 msgid "" "Performs the SSL shutdown handshake, which removes the TLS layer from the " "underlying socket, and returns the underlying socket object. This can be " @@ -1834,7 +1888,7 @@ msgid "" "other side of the connection, rather than the original socket." msgstr "" -#: ../../library/ssl.rst:1286 +#: ../../library/ssl.rst:1330 msgid "" "Requests post-handshake authentication (PHA) from a TLS 1.3 client. PHA can " "only be initiated for a TLS 1.3 connection from a server-side socket, after " @@ -1842,26 +1896,26 @@ msgid "" "`SSLContext.post_handshake_auth`." msgstr "" -#: ../../library/ssl.rst:1291 +#: ../../library/ssl.rst:1335 msgid "" "The method does not perform a cert exchange immediately. The server-side " "sends a CertificateRequest during the next write event and expects the " "client to respond with a certificate on the next read event." msgstr "" -#: ../../library/ssl.rst:1295 +#: ../../library/ssl.rst:1339 msgid "" "If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), an :exc:" "`SSLError` is raised." msgstr "" -#: ../../library/ssl.rst:1299 +#: ../../library/ssl.rst:1343 msgid "" "Only available with OpenSSL 1.1.1 and TLS 1.3 enabled. Without TLS 1.3 " "support, the method raises :exc:`NotImplementedError`." msgstr "" -#: ../../library/ssl.rst:1306 +#: ../../library/ssl.rst:1350 msgid "" "Return the actual SSL protocol version negotiated by the connection as a " "string, or ``None`` if no secure connection is established. As of this " @@ -1870,29 +1924,29 @@ msgid "" "may define more return values." msgstr "" -#: ../../library/ssl.rst:1316 +#: ../../library/ssl.rst:1360 msgid "" "Returns the number of already decrypted bytes available for read, pending on " "the connection." msgstr "" -#: ../../library/ssl.rst:1321 +#: ../../library/ssl.rst:1365 msgid "The :class:`SSLContext` object this SSL socket is tied to." msgstr "" -#: ../../library/ssl.rst:1327 +#: ../../library/ssl.rst:1371 msgid "" "A boolean which is ``True`` for server-side sockets and ``False`` for client-" "side sockets." msgstr "" -#: ../../library/ssl.rst:1334 +#: ../../library/ssl.rst:1378 msgid "" "Hostname of the server: :class:`str` type, or ``None`` for server-side " "socket or if the hostname was not specified in the constructor." msgstr "" -#: ../../library/ssl.rst:1339 +#: ../../library/ssl.rst:1383 msgid "" "The attribute is now always ASCII text. When ``server_hostname`` is an " "internationalized domain name (IDN), this attribute now stores the A-label " @@ -1900,7 +1954,7 @@ msgid "" "org\"``)." msgstr "" -#: ../../library/ssl.rst:1347 +#: ../../library/ssl.rst:1391 msgid "" "The :class:`SSLSession` for this SSL connection. The session is available " "for client and server side sockets after the TLS handshake has been " @@ -1908,11 +1962,11 @@ msgid "" "`~SSLSocket.do_handshake` has been called to reuse a session." msgstr "" -#: ../../library/ssl.rst:1360 +#: ../../library/ssl.rst:1404 msgid "SSL Contexts" msgstr "" -#: ../../library/ssl.rst:1364 +#: ../../library/ssl.rst:1408 msgid "" "An SSL context holds various data longer-lived than single SSL connections, " "such as SSL configuration options, certificate(s) and private key(s). It " @@ -1920,7 +1974,7 @@ msgid "" "speed up repeated connections from the same clients." msgstr "" -#: ../../library/ssl.rst:1371 +#: ../../library/ssl.rst:1415 msgid "" "Create a new SSL context. You may pass *protocol* which must be one of the " "``PROTOCOL_*`` constants defined in this module. The parameter specifies " @@ -1931,109 +1985,109 @@ msgid "" "provides the most compatibility with other versions." msgstr "" -#: ../../library/ssl.rst:1380 +#: ../../library/ssl.rst:1424 msgid "" "Here's a table showing which versions in a client (down the side) can " "connect to which versions in a server (along the top):" msgstr "" -#: ../../library/ssl.rst:1386 +#: ../../library/ssl.rst:1430 msgid "*client* / **server**" msgstr "*client* / **server**" -#: ../../library/ssl.rst:1386 +#: ../../library/ssl.rst:1430 msgid "**SSLv2**" msgstr "**SSLv2**" -#: ../../library/ssl.rst:1386 +#: ../../library/ssl.rst:1430 msgid "**SSLv3**" msgstr "**SSLv3**" -#: ../../library/ssl.rst:1386 +#: ../../library/ssl.rst:1430 msgid "**TLS** [3]_" msgstr "**TLS** [3]_" -#: ../../library/ssl.rst:1386 +#: ../../library/ssl.rst:1430 msgid "**TLSv1**" msgstr "**TLSv1**" -#: ../../library/ssl.rst:1386 +#: ../../library/ssl.rst:1430 msgid "**TLSv1.1**" msgstr "**TLSv1.1**" -#: ../../library/ssl.rst:1386 +#: ../../library/ssl.rst:1430 msgid "**TLSv1.2**" msgstr "**TLSv1.2**" -#: ../../library/ssl.rst:1388 +#: ../../library/ssl.rst:1432 msgid "*SSLv2*" msgstr "*SSLv2*" -#: ../../library/ssl.rst:1388 ../../library/ssl.rst:1389 -#: ../../library/ssl.rst:1390 ../../library/ssl.rst:1391 -#: ../../library/ssl.rst:1392 ../../library/ssl.rst:1393 +#: ../../library/ssl.rst:1432 ../../library/ssl.rst:1433 +#: ../../library/ssl.rst:1434 ../../library/ssl.rst:1435 +#: ../../library/ssl.rst:1436 ../../library/ssl.rst:1437 msgid "yes" msgstr "" -#: ../../library/ssl.rst:1388 ../../library/ssl.rst:1389 -#: ../../library/ssl.rst:1391 ../../library/ssl.rst:1392 -#: ../../library/ssl.rst:1393 +#: ../../library/ssl.rst:1432 ../../library/ssl.rst:1433 +#: ../../library/ssl.rst:1435 ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1437 msgid "no" msgstr "" -#: ../../library/ssl.rst:1388 ../../library/ssl.rst:1390 +#: ../../library/ssl.rst:1432 ../../library/ssl.rst:1434 msgid "no [1]_" msgstr "" -#: ../../library/ssl.rst:1389 +#: ../../library/ssl.rst:1433 msgid "*SSLv3*" msgstr "*SSLv3*" -#: ../../library/ssl.rst:1389 ../../library/ssl.rst:1390 +#: ../../library/ssl.rst:1433 ../../library/ssl.rst:1434 msgid "no [2]_" msgstr "" -#: ../../library/ssl.rst:1390 +#: ../../library/ssl.rst:1434 msgid "*TLS* (*SSLv23*) [3]_" msgstr "*TLS* (*SSLv23*) [3]_" -#: ../../library/ssl.rst:1391 +#: ../../library/ssl.rst:1435 msgid "*TLSv1*" msgstr "*TLSv1*" -#: ../../library/ssl.rst:1392 +#: ../../library/ssl.rst:1436 msgid "*TLSv1.1*" msgstr "*TLSv1.1*" -#: ../../library/ssl.rst:1393 +#: ../../library/ssl.rst:1437 msgid "*TLSv1.2*" msgstr "*TLSv1.2*" -#: ../../library/ssl.rst:1396 +#: ../../library/ssl.rst:1440 msgid "Footnotes" msgstr "註解" -#: ../../library/ssl.rst:1397 +#: ../../library/ssl.rst:1441 msgid ":class:`SSLContext` disables SSLv2 with :data:`OP_NO_SSLv2` by default." msgstr ":class:`SSLContext` 預設會關閉 SSLv2 的 :data:`OP_NO_SSLv2`。" -#: ../../library/ssl.rst:1398 +#: ../../library/ssl.rst:1442 msgid ":class:`SSLContext` disables SSLv3 with :data:`OP_NO_SSLv3` by default." msgstr ":class:`SSLContext` 預設會關閉 SSLv3 的 :data:`OP_NO_SSLv3`。" -#: ../../library/ssl.rst:1399 +#: ../../library/ssl.rst:1443 msgid "" "TLS 1.3 protocol will be available with :data:`PROTOCOL_TLS` in OpenSSL >= " "1.1.1. There is no dedicated PROTOCOL constant for just TLS 1.3." msgstr "" -#: ../../library/ssl.rst:1404 +#: ../../library/ssl.rst:1448 msgid "" ":func:`create_default_context` lets the :mod:`ssl` module choose security " "settings for a given purpose." msgstr "" -#: ../../library/ssl.rst:1409 +#: ../../library/ssl.rst:1453 msgid "" "The context is created with secure default values. The options :data:" "`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:" @@ -2043,14 +2097,14 @@ msgid "" "ciphers and no ``MD5`` ciphers." msgstr "" -#: ../../library/ssl.rst:1419 +#: ../../library/ssl.rst:1463 msgid "" ":class:`SSLContext` without protocol argument is deprecated. The context " "class will either require :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER` protocol in the future." msgstr "" -#: ../../library/ssl.rst:1425 +#: ../../library/ssl.rst:1469 msgid "" "The default cipher suites now include only secure AES and ChaCha20 ciphers " "with forward secrecy and security level 2. RSA and DH keys with less than " @@ -2059,7 +2113,7 @@ msgid "" "use TLS 1.2 as minimum TLS version." msgstr "" -#: ../../library/ssl.rst:1433 +#: ../../library/ssl.rst:1477 msgid "" ":class:`SSLContext` only supports limited mutation once it has been used by " "a connection. Adding new certificates to the internal trust store is " @@ -2067,29 +2121,29 @@ msgid "" "may result in surprising behavior." msgstr "" -#: ../../library/ssl.rst:1440 +#: ../../library/ssl.rst:1484 msgid "" ":class:`SSLContext` is designed to be shared and used by multiple " "connections. Thus, it is thread-safe as long as it is not reconfigured after " "being used by a connection." msgstr "" -#: ../../library/ssl.rst:1445 +#: ../../library/ssl.rst:1489 msgid ":class:`SSLContext` objects have the following methods and attributes:" msgstr "" -#: ../../library/ssl.rst:1449 +#: ../../library/ssl.rst:1493 msgid "" "Get statistics about quantities of loaded X.509 certificates, count of X.509 " "certificates flagged as CA certificates and certificate revocation lists as " "dictionary." msgstr "" -#: ../../library/ssl.rst:1453 +#: ../../library/ssl.rst:1497 msgid "Example for a context with one CA cert and one other cert::" msgstr "" -#: ../../library/ssl.rst:1455 +#: ../../library/ssl.rst:1499 msgid "" ">>> context.cert_store_stats()\n" "{'crl': 0, 'x509_ca': 1, 'x509': 2}" @@ -2097,7 +2151,7 @@ msgstr "" ">>> context.cert_store_stats()\n" "{'crl': 0, 'x509_ca': 1, 'x509': 2}" -#: ../../library/ssl.rst:1463 +#: ../../library/ssl.rst:1507 msgid "" "Load a private key and the corresponding certificate. The *certfile* string " "must be the path to a single file in PEM format containing the certificate " @@ -2108,7 +2162,7 @@ msgid "" "more information on how the certificate is stored in the *certfile*." msgstr "" -#: ../../library/ssl.rst:1472 +#: ../../library/ssl.rst:1516 msgid "" "The *password* argument may be a function to call to get the password for " "decrypting the private key. It will only be called if the private key is " @@ -2120,24 +2174,24 @@ msgid "" "encrypted and no password is needed." msgstr "" -#: ../../library/ssl.rst:1481 +#: ../../library/ssl.rst:1525 msgid "" "If the *password* argument is not specified and a password is required, " "OpenSSL's built-in password prompting mechanism will be used to " "interactively prompt the user for a password." msgstr "" -#: ../../library/ssl.rst:1485 +#: ../../library/ssl.rst:1529 msgid "" "An :class:`SSLError` is raised if the private key doesn't match with the " "certificate." msgstr "" -#: ../../library/ssl.rst:1488 +#: ../../library/ssl.rst:1532 msgid "New optional argument *password*." msgstr "" -#: ../../library/ssl.rst:1493 +#: ../../library/ssl.rst:1537 msgid "" "Load a set of default \"certification authority\" (CA) certificates from " "default locations. On Windows it loads CA certs from the ``CA`` and ``ROOT`` " @@ -2146,7 +2200,7 @@ msgid "" "from other locations, too." msgstr "" -#: ../../library/ssl.rst:1499 +#: ../../library/ssl.rst:1543 msgid "" "The *purpose* flag specifies what kind of CA certificates are loaded. The " "default settings :const:`Purpose.SERVER_AUTH` loads certificates, that are " @@ -2155,35 +2209,36 @@ msgid "" "certificate verification on the server side." msgstr "" -#: ../../library/ssl.rst:1509 +#: ../../library/ssl.rst:1553 msgid "" "Load a set of \"certification authority\" (CA) certificates used to validate " "other peers' certificates when :data:`verify_mode` is other than :data:" "`CERT_NONE`. At least one of *cafile* or *capath* must be specified." msgstr "" -#: ../../library/ssl.rst:1513 +#: ../../library/ssl.rst:1557 msgid "" "This method can also load certification revocation lists (CRLs) in PEM or " "DER format. In order to make use of CRLs, :attr:`SSLContext.verify_flags` " "must be configured properly." msgstr "" -#: ../../library/ssl.rst:1517 +#: ../../library/ssl.rst:1561 msgid "" "The *cafile* string, if present, is the path to a file of concatenated CA " "certificates in PEM format. See the discussion of :ref:`ssl-certificates` " "for more information about how to arrange the certificates in this file." msgstr "" -#: ../../library/ssl.rst:1522 +#: ../../library/ssl.rst:1566 msgid "" "The *capath* string, if present, is the path to a directory containing " "several CA certificates in PEM format, following an `OpenSSL specific layout " -"`_." +"`_." msgstr "" -#: ../../library/ssl.rst:1527 +#: ../../library/ssl.rst:1571 msgid "" "The *cadata* object, if present, is either an ASCII string of one or more " "PEM-encoded certificates or a :term:`bytes-like object` of DER-encoded " @@ -2191,11 +2246,11 @@ msgid "" "are ignored but at least one certificate must be present." msgstr "" -#: ../../library/ssl.rst:1532 +#: ../../library/ssl.rst:1576 msgid "New optional argument *cadata*" msgstr "" -#: ../../library/ssl.rst:1537 +#: ../../library/ssl.rst:1581 msgid "" "Get a list of loaded \"certification authority\" (CA) certificates. If the " "``binary_form`` parameter is :const:`False` each list entry is a dict like " @@ -2205,19 +2260,19 @@ msgid "" "a SSL connection." msgstr "" -#: ../../library/ssl.rst:1545 +#: ../../library/ssl.rst:1589 msgid "" "Certificates in a capath directory aren't loaded unless they have been used " "at least once." msgstr "" -#: ../../library/ssl.rst:1552 +#: ../../library/ssl.rst:1596 msgid "" "Get a list of enabled ciphers. The list is in order of cipher priority. See :" "meth:`SSLContext.set_ciphers`." msgstr "" -#: ../../library/ssl.rst:1557 +#: ../../library/ssl.rst:1601 msgid "" ">>> ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)\n" ">>> ctx.set_ciphers('ECDHE+AESGCM:!ECDSA')\n" @@ -2275,7 +2330,7 @@ msgstr "" " 'strength_bits': 128,\n" " 'symmetric': 'aes-128-gcm'}]" -#: ../../library/ssl.rst:1589 +#: ../../library/ssl.rst:1633 msgid "" "Load a set of default \"certification authority\" (CA) certificates from a " "filesystem path defined when building the OpenSSL library. Unfortunately, " @@ -2285,28 +2340,28 @@ msgid "" "configured properly." msgstr "" -#: ../../library/ssl.rst:1598 +#: ../../library/ssl.rst:1642 msgid "" "Set the available ciphers for sockets created with this context. It should " -"be a string in the `OpenSSL cipher list format `_. If no cipher can be selected (because compile-time " -"options or other configuration forbids use of all the specified ciphers), " -"an :class:`SSLError` will be raised." +"be a string in the `OpenSSL cipher list format `_. If no cipher can be selected (because " +"compile-time options or other configuration forbids use of all the specified " +"ciphers), an :class:`SSLError` will be raised." msgstr "" -#: ../../library/ssl.rst:1606 +#: ../../library/ssl.rst:1650 msgid "" "when connected, the :meth:`SSLSocket.cipher` method of SSL sockets will give " "the currently selected cipher." msgstr "" -#: ../../library/ssl.rst:1609 +#: ../../library/ssl.rst:1653 msgid "" "TLS 1.3 cipher suites cannot be disabled with :meth:`~SSLContext." "set_ciphers`." msgstr "" -#: ../../library/ssl.rst:1614 +#: ../../library/ssl.rst:1658 msgid "" "Specify which protocols the socket should advertise during the SSL/TLS " "handshake. It should be a list of ASCII strings, like ``['http/1.1', " @@ -2316,13 +2371,13 @@ msgid "" "will return the agreed-upon protocol." msgstr "" -#: ../../library/ssl.rst:1621 +#: ../../library/ssl.rst:1665 msgid "" "This method will raise :exc:`NotImplementedError` if :data:`HAS_ALPN` is " "``False``." msgstr "" -#: ../../library/ssl.rst:1628 +#: ../../library/ssl.rst:1672 msgid "" "Specify which protocols the socket should advertise during the SSL/TLS " "handshake. It should be a list of strings, like ``['http/1.1', 'spdy/2']``, " @@ -2334,13 +2389,13 @@ msgid "" "protocol." msgstr "" -#: ../../library/ssl.rst:1636 +#: ../../library/ssl.rst:1680 msgid "" "This method will raise :exc:`NotImplementedError` if :data:`HAS_NPN` is " "``False``." msgstr "" -#: ../../library/ssl.rst:1647 +#: ../../library/ssl.rst:1691 msgid "" "Register a callback function that will be called after the TLS Client Hello " "handshake message has been received by the SSL/TLS server when the TLS " @@ -2348,14 +2403,14 @@ msgid "" "mechanism is specified in :rfc:`6066` section 3 - Server Name Indication." msgstr "" -#: ../../library/ssl.rst:1652 +#: ../../library/ssl.rst:1696 msgid "" "Only one callback can be set per ``SSLContext``. If *sni_callback* is set " "to ``None`` then the callback is disabled. Calling this function a " "subsequent time will disable the previously registered callback." msgstr "" -#: ../../library/ssl.rst:1656 +#: ../../library/ssl.rst:1700 msgid "" "The callback function will be called with three arguments; the first being " "the :class:`ssl.SSLSocket`, the second is a string that represents the " @@ -2366,25 +2421,26 @@ msgid "" "pythn-mua.org\"``)." msgstr "" -#: ../../library/ssl.rst:1664 +#: ../../library/ssl.rst:1708 msgid "" "A typical use of this callback is to change the :class:`ssl.SSLSocket`'s :" "attr:`SSLSocket.context` attribute to a new object of type :class:" "`SSLContext` representing a certificate chain that matches the server name." msgstr "" -#: ../../library/ssl.rst:1669 +#: ../../library/ssl.rst:1713 msgid "" "Due to the early negotiation phase of the TLS connection, only limited " "methods and attributes are usable like :meth:`SSLSocket." "selected_alpn_protocol` and :attr:`SSLSocket.context`. The :meth:`SSLSocket." -"getpeercert`, :meth:`SSLSocket.cipher` and :meth:`SSLSocket.compression` " -"methods require that the TLS connection has progressed beyond the TLS Client " -"Hello and therefore will not return meaningful values nor can they be called " -"safely." +"getpeercert`, :meth:`SSLSocket.get_verified_chain`, :meth:`SSLSocket." +"get_unverified_chain` :meth:`SSLSocket.cipher` and :meth:`SSLSocket." +"compression` methods require that the TLS connection has progressed beyond " +"the TLS Client Hello and therefore will not return meaningful values nor can " +"they be called safely." msgstr "" -#: ../../library/ssl.rst:1677 +#: ../../library/ssl.rst:1722 msgid "" "The *sni_callback* function must return ``None`` to allow the TLS " "negotiation to continue. If a TLS failure is required, a constant :const:" @@ -2393,20 +2449,20 @@ msgid "" "`ALERT_DESCRIPTION_INTERNAL_ERROR`." msgstr "" -#: ../../library/ssl.rst:1683 +#: ../../library/ssl.rst:1728 msgid "" "If an exception is raised from the *sni_callback* function the TLS " "connection will terminate with a fatal TLS alert message :const:" "`ALERT_DESCRIPTION_HANDSHAKE_FAILURE`." msgstr "" -#: ../../library/ssl.rst:1687 +#: ../../library/ssl.rst:1732 msgid "" "This method will raise :exc:`NotImplementedError` if the OpenSSL library had " "OPENSSL_NO_TLSEXT defined when it was built." msgstr "" -#: ../../library/ssl.rst:1694 +#: ../../library/ssl.rst:1739 msgid "" "This is a legacy API retained for backwards compatibility. When possible, " "you should use :attr:`sni_callback` instead. The given " @@ -2415,14 +2471,14 @@ msgid "" "*server_name_callback* receives a decoded U-label (``\"pythön.org\"``)." msgstr "" -#: ../../library/ssl.rst:1700 +#: ../../library/ssl.rst:1745 msgid "" "If there is a decoding error on the server name, the TLS connection will " "terminate with an :const:`ALERT_DESCRIPTION_INTERNAL_ERROR` fatal TLS alert " "message to the client." msgstr "" -#: ../../library/ssl.rst:1708 +#: ../../library/ssl.rst:1753 msgid "" "Load the key generation parameters for Diffie-Hellman (DH) key exchange. " "Using DH key exchange improves forward secrecy at the expense of " @@ -2431,13 +2487,13 @@ msgid "" "format." msgstr "" -#: ../../library/ssl.rst:1714 +#: ../../library/ssl.rst:1759 msgid "" "This setting doesn't apply to client sockets. You can also use the :data:" "`OP_SINGLE_DH_USE` option to further improve security." msgstr "" -#: ../../library/ssl.rst:1721 +#: ../../library/ssl.rst:1766 msgid "" "Set the curve name for Elliptic Curve-based Diffie-Hellman (ECDH) key " "exchange. ECDH is significantly faster than regular DH while arguably as " @@ -2446,27 +2502,27 @@ msgid "" "curve." msgstr "" -#: ../../library/ssl.rst:1727 +#: ../../library/ssl.rst:1772 msgid "" "This setting doesn't apply to client sockets. You can also use the :data:" "`OP_SINGLE_ECDH_USE` option to further improve security." msgstr "" -#: ../../library/ssl.rst:1730 +#: ../../library/ssl.rst:1775 msgid "This method is not available if :data:`HAS_ECDH` is ``False``." msgstr "" -#: ../../library/ssl.rst:1735 +#: ../../library/ssl.rst:1780 msgid "" "`SSL/TLS & Perfect Forward Secrecy `_" msgstr "" -#: ../../library/ssl.rst:1736 +#: ../../library/ssl.rst:1781 msgid "Vincent Bernat." msgstr "" -#: ../../library/ssl.rst:1742 +#: ../../library/ssl.rst:1787 msgid "" "Wrap an existing Python socket *sock* and return an instance of :attr:" "`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The returned SSL " @@ -2474,13 +2530,13 @@ msgid "" "a :const:`~socket.SOCK_STREAM` socket; other socket types are unsupported." msgstr "" -#: ../../library/ssl.rst:1748 +#: ../../library/ssl.rst:1793 msgid "" "The parameter ``server_side`` is a boolean which identifies whether server-" "side or client-side behavior is desired from this socket." msgstr "" -#: ../../library/ssl.rst:1751 +#: ../../library/ssl.rst:1796 msgid "" "For client-side sockets, the context construction is lazy; if the underlying " "socket isn't connected yet, the context construction will be performed " @@ -2491,7 +2547,7 @@ msgid "" "exc:`SSLError`." msgstr "" -#: ../../library/ssl.rst:1759 +#: ../../library/ssl.rst:1804 msgid "" "On client connections, the optional parameter *server_hostname* specifies " "the hostname of the service which we are connecting to. This allows a " @@ -2500,7 +2556,7 @@ msgid "" "*server_hostname* will raise a :exc:`ValueError` if *server_side* is true." msgstr "" -#: ../../library/ssl.rst:1765 +#: ../../library/ssl.rst:1810 msgid "" "The parameter ``do_handshake_on_connect`` specifies whether to do the SSL " "handshake automatically after doing a :meth:`socket.connect`, or whether the " @@ -2510,7 +2566,7 @@ msgid "" "socket I/O involved in the handshake." msgstr "" -#: ../../library/ssl.rst:1772 +#: ../../library/ssl.rst:1817 msgid "" "The parameter ``suppress_ragged_eofs`` specifies how the :meth:`SSLSocket." "recv` method should signal unexpected EOF from the other end of the " @@ -2520,40 +2576,40 @@ msgid "" "exceptions back to the caller." msgstr "" -#: ../../library/ssl.rst:1779 +#: ../../library/ssl.rst:1824 msgid "*session*, see :attr:`~SSLSocket.session`." msgstr "" -#: ../../library/ssl.rst:1781 +#: ../../library/ssl.rst:1826 msgid "" "To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, use :meth:" "`SSLContext.wrap_bio`." msgstr "" -#: ../../library/ssl.rst:1784 +#: ../../library/ssl.rst:1829 msgid "" "Always allow a server_hostname to be passed, even if OpenSSL does not have " "SNI." msgstr "" -#: ../../library/ssl.rst:1788 ../../library/ssl.rst:1814 +#: ../../library/ssl.rst:1833 ../../library/ssl.rst:1859 msgid "*session* argument was added." msgstr "新增 *session* 引數。" -#: ../../library/ssl.rst:1791 +#: ../../library/ssl.rst:1836 msgid "" "The method returns an instance of :attr:`SSLContext.sslsocket_class` instead " "of hard-coded :class:`SSLSocket`." msgstr "" -#: ../../library/ssl.rst:1797 +#: ../../library/ssl.rst:1842 msgid "" "The return type of :meth:`SSLContext.wrap_socket`, defaults to :class:" "`SSLSocket`. The attribute can be overridden on instance of class in order " "to return a custom subclass of :class:`SSLSocket`." msgstr "" -#: ../../library/ssl.rst:1806 +#: ../../library/ssl.rst:1851 msgid "" "Wrap the BIO objects *incoming* and *outgoing* and return an instance of :" "attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " @@ -2561,35 +2617,35 @@ msgid "" "outgoing BIO." msgstr "" -#: ../../library/ssl.rst:1811 +#: ../../library/ssl.rst:1856 msgid "" "The *server_side*, *server_hostname* and *session* parameters have the same " "meaning as in :meth:`SSLContext.wrap_socket`." msgstr "" -#: ../../library/ssl.rst:1817 +#: ../../library/ssl.rst:1862 msgid "" "The method returns an instance of :attr:`SSLContext.sslobject_class` instead " "of hard-coded :class:`SSLObject`." msgstr "" -#: ../../library/ssl.rst:1823 +#: ../../library/ssl.rst:1868 msgid "" "The return type of :meth:`SSLContext.wrap_bio`, defaults to :class:" "`SSLObject`. The attribute can be overridden on instance of class in order " "to return a custom subclass of :class:`SSLObject`." msgstr "" -#: ../../library/ssl.rst:1831 +#: ../../library/ssl.rst:1876 msgid "" "Get statistics about the SSL sessions created or managed by this context. A " "dictionary is returned which maps the names of each `piece of information " -"`_ to their " -"numeric values. For example, here is the total number of hits and misses in " -"the session cache since the context was created::" +"`_ to " +"their numeric values. For example, here is the total number of hits and " +"misses in the session cache since the context was created::" msgstr "" -#: ../../library/ssl.rst:1836 +#: ../../library/ssl.rst:1881 msgid "" ">>> stats = context.session_stats()\n" ">>> stats['hits'], stats['misses']\n" @@ -2599,7 +2655,7 @@ msgstr "" ">>> stats['hits'], stats['misses']\n" "(0, 0)" -#: ../../library/ssl.rst:1842 +#: ../../library/ssl.rst:1887 msgid "" "Whether to match the peer cert's hostname in :meth:`SSLSocket.do_handshake`. " "The context's :attr:`~SSLContext.verify_mode` must be set to :data:" @@ -2612,7 +2668,7 @@ msgid "" "With other protocols, hostname checking must be enabled explicitly." msgstr "" -#: ../../library/ssl.rst:1855 +#: ../../library/ssl.rst:1900 msgid "" "import socket, ssl\n" "\n" @@ -2636,7 +2692,7 @@ msgstr "" "ssl_sock = context.wrap_socket(s, server_hostname='www.verisign.com')\n" "ssl_sock.connect(('www.verisign.com', 443))" -#: ../../library/ssl.rst:1870 +#: ../../library/ssl.rst:1915 msgid "" ":attr:`~SSLContext.verify_mode` is now automatically changed to :data:" "`CERT_REQUIRED` when hostname checking is enabled and :attr:`~SSLContext." @@ -2644,7 +2700,7 @@ msgid "" "failed with a :exc:`ValueError`." msgstr "" -#: ../../library/ssl.rst:1877 +#: ../../library/ssl.rst:1922 msgid "" "Write TLS keys to a keylog file, whenever key material is generated or " "received. The keylog file is designed for debugging purposes only. The file " @@ -2653,7 +2709,7 @@ msgid "" "synchronized between threads, but not between processes." msgstr "" -#: ../../library/ssl.rst:1887 +#: ../../library/ssl.rst:1932 msgid "" "A :class:`TLSVersion` enum member representing the highest supported TLS " "version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`. The " @@ -2661,7 +2717,7 @@ msgid "" "`PROTOCOL_TLS_CLIENT`, and :attr:`PROTOCOL_TLS_SERVER`." msgstr "" -#: ../../library/ssl.rst:1892 +#: ../../library/ssl.rst:1937 msgid "" "The attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext." "minimum_version` and :attr:`SSLContext.options` all affect the supported SSL " @@ -2671,38 +2727,38 @@ msgid "" "`TLSVersion.TLSv1_2` will not be able to establish a TLS 1.2 connection." msgstr "" -#: ../../library/ssl.rst:1905 +#: ../../library/ssl.rst:1950 msgid "" "Like :attr:`SSLContext.maximum_version` except it is the lowest supported " "version or :attr:`TLSVersion.MINIMUM_SUPPORTED`." msgstr "" -#: ../../library/ssl.rst:1912 +#: ../../library/ssl.rst:1957 msgid "" "Control the number of TLS 1.3 session tickets of a :attr:" "`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 to 1.2 " "connections." msgstr "" -#: ../../library/ssl.rst:1920 +#: ../../library/ssl.rst:1965 msgid "" "An integer representing the set of SSL options enabled on this context. The " "default value is :data:`OP_ALL`, but you can specify other options such as :" "data:`OP_NO_SSLv2` by ORing them together." msgstr "" -#: ../../library/ssl.rst:1924 +#: ../../library/ssl.rst:1969 msgid ":attr:`SSLContext.options` returns :class:`Options` flags:" msgstr "" -#: ../../library/ssl.rst:1932 +#: ../../library/ssl.rst:1977 msgid "" "All ``OP_NO_SSL*`` and ``OP_NO_TLS*`` options have been deprecated since " "Python 3.7. Use :attr:`SSLContext.minimum_version` and :attr:`SSLContext." "maximum_version` instead." msgstr "" -#: ../../library/ssl.rst:1938 +#: ../../library/ssl.rst:1983 msgid "" "Enable TLS 1.3 post-handshake client authentication. Post-handshake auth is " "disabled by default and a server can only request a TLS client certificate " @@ -2710,13 +2766,13 @@ msgid "" "client certificate at any time after the handshake." msgstr "" -#: ../../library/ssl.rst:1943 +#: ../../library/ssl.rst:1988 msgid "" "When enabled on client-side sockets, the client signals the server that it " "supports post-handshake authentication." msgstr "" -#: ../../library/ssl.rst:1946 +#: ../../library/ssl.rst:1991 msgid "" "When enabled on server-side sockets, :attr:`SSLContext.verify_mode` must be " "set to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, too. The actual " @@ -2724,59 +2780,176 @@ msgid "" "verify_client_post_handshake` is called and some I/O is performed." msgstr "" -#: ../../library/ssl.rst:1956 +#: ../../library/ssl.rst:2001 msgid "" "The protocol version chosen when constructing the context. This attribute " "is read-only." msgstr "" -#: ../../library/ssl.rst:1961 +#: ../../library/ssl.rst:2006 msgid "" "Whether :attr:`~SSLContext.check_hostname` falls back to verify the cert's " "subject common name in the absence of a subject alternative name extension " "(default: true)." msgstr "" -#: ../../library/ssl.rst:1969 +#: ../../library/ssl.rst:2014 msgid "" "The flag had no effect with OpenSSL before version 1.1.1l. Python 3.8.9, " "3.9.3, and 3.10 include workarounds for previous versions." msgstr "" -#: ../../library/ssl.rst:1974 +#: ../../library/ssl.rst:2019 msgid "" -"An integer representing the `security level `_ for the context. This attribute is read-" -"only." +"An integer representing the `security level `_ for the context. This " +"attribute is read-only." msgstr "" -#: ../../library/ssl.rst:1982 +#: ../../library/ssl.rst:2027 msgid "" "The flags for certificate verification operations. You can set flags like :" "data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default OpenSSL does " "neither require nor verify certificate revocation lists (CRLs)." msgstr "" -#: ../../library/ssl.rst:1988 +#: ../../library/ssl.rst:2033 msgid ":attr:`SSLContext.verify_flags` returns :class:`VerifyFlags` flags:" msgstr "" -#: ../../library/ssl.rst:1996 +#: ../../library/ssl.rst:2041 msgid "" "Whether to try to verify other peers' certificates and how to behave if " "verification fails. This attribute must be one of :data:`CERT_NONE`, :data:" "`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." msgstr "" -#: ../../library/ssl.rst:2000 +#: ../../library/ssl.rst:2045 msgid ":attr:`SSLContext.verify_mode` returns :class:`VerifyMode` enum:" msgstr "" -#: ../../library/ssl.rst:2013 +#: ../../library/ssl.rst:2053 +msgid "" +"Enables TLS-PSK (pre-shared key) authentication on a client-side connection." +msgstr "" + +#: ../../library/ssl.rst:2055 ../../library/ssl.rst:2104 +msgid "" +"In general, certificate based authentication should be preferred over this " +"method." +msgstr "" + +#: ../../library/ssl.rst:2057 +msgid "" +"The parameter ``callback`` is a callable object with the signature: ``def " +"callback(hint: str | None) -> tuple[str | None, bytes]``. The ``hint`` " +"parameter is an optional identity hint sent by the server. The return value " +"is a tuple in the form (client-identity, psk). Client-identity is an " +"optional string which may be used by the server to select a corresponding " +"PSK for the client. The string must be less than or equal to ``256`` octets " +"when UTF-8 encoded. PSK is a :term:`bytes-like object` representing the pre-" +"shared key. Return a zero length PSK to reject the connection." +msgstr "" + +#: ../../library/ssl.rst:2067 ../../library/ssl.rst:2113 +msgid "Setting ``callback`` to :const:`None` removes any existing callback." +msgstr "" + +#: ../../library/ssl.rst:2070 +msgid "When using TLS 1.3:" +msgstr "" + +#: ../../library/ssl.rst:2072 +msgid "the ``hint`` parameter is always :const:`None`." +msgstr "" + +#: ../../library/ssl.rst:2073 +msgid "client-identity must be a non-empty string." +msgstr "" + +#: ../../library/ssl.rst:2075 ../../library/ssl.rst:2122 +#, fuzzy +msgid "Example usage::" +msgstr "範例: ::" + +#: ../../library/ssl.rst:2077 +msgid "" +"context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" +"context.check_hostname = False\n" +"context.verify_mode = ssl.CERT_NONE\n" +"context.maximum_version = ssl.TLSVersion.TLSv1_2\n" +"context.set_ciphers('PSK')\n" +"\n" +"# A simple lambda:\n" +"psk = bytes.fromhex('c0ffee')\n" +"context.set_psk_client_callback(lambda hint: (None, psk))\n" +"\n" +"# A table using the hint from the server:\n" +"psk_table = { 'ServerId_1': bytes.fromhex('c0ffee'),\n" +" 'ServerId_2': bytes.fromhex('facade')\n" +"}\n" +"def callback(hint):\n" +" return 'ClientId_1', psk_table.get(hint, b'')\n" +"context.set_psk_client_callback(callback)" +msgstr "" + +#: ../../library/ssl.rst:2095 ../../library/ssl.rst:2140 +msgid "" +"This method will raise :exc:`NotImplementedError` if :data:`HAS_PSK` is " +"``False``." +msgstr "" + +#: ../../library/ssl.rst:2102 +msgid "" +"Enables TLS-PSK (pre-shared key) authentication on a server-side connection." +msgstr "" + +#: ../../library/ssl.rst:2106 +msgid "" +"The parameter ``callback`` is a callable object with the signature: ``def " +"callback(identity: str | None) -> bytes``. The ``identity`` parameter is an " +"optional identity sent by the client which can be used to select a " +"corresponding PSK. The return value is a :term:`bytes-like object` " +"representing the pre-shared key. Return a zero length PSK to reject the " +"connection." +msgstr "" + +#: ../../library/ssl.rst:2115 +msgid "" +"The parameter ``identity_hint`` is an optional identity hint string sent to " +"the client. The string must be less than or equal to ``256`` octets when " +"UTF-8 encoded." +msgstr "" + +#: ../../library/ssl.rst:2120 +msgid "" +"When using TLS 1.3 the ``identity_hint`` parameter is not sent to the client." +msgstr "" + +#: ../../library/ssl.rst:2124 +msgid "" +"context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)\n" +"context.maximum_version = ssl.TLSVersion.TLSv1_2\n" +"context.set_ciphers('PSK')\n" +"\n" +"# A simple lambda:\n" +"psk = bytes.fromhex('c0ffee')\n" +"context.set_psk_server_callback(lambda identity: psk)\n" +"\n" +"# A table using the identity of the client:\n" +"psk_table = { 'ClientId_1': bytes.fromhex('c0ffee'),\n" +" 'ClientId_2': bytes.fromhex('facade')\n" +"}\n" +"def callback(identity):\n" +" return psk_table.get(identity, b'')\n" +"context.set_psk_server_callback(callback, 'ServerId_1')" +msgstr "" + +#: ../../library/ssl.rst:2152 msgid "Certificates" msgstr "" -#: ../../library/ssl.rst:2015 +#: ../../library/ssl.rst:2154 msgid "" "Certificates in general are part of a public-key / private-key system. In " "this system, each *principal*, (which may be a machine, or a person, or an " @@ -2787,7 +2960,7 @@ msgid "" "other part, and **only** with the other part." msgstr "" -#: ../../library/ssl.rst:2023 +#: ../../library/ssl.rst:2162 msgid "" "A certificate contains information about two principals. It contains the " "name of a *subject*, and the subject's public key. It also contains a " @@ -2801,7 +2974,7 @@ msgid "" "as two fields, called \"notBefore\" and \"notAfter\"." msgstr "" -#: ../../library/ssl.rst:2033 +#: ../../library/ssl.rst:2172 msgid "" "In the Python use of certificates, a client or server can use a certificate " "to prove who they are. The other side of a network connection can also be " @@ -2814,14 +2987,14 @@ msgid "" "take place." msgstr "" -#: ../../library/ssl.rst:2043 +#: ../../library/ssl.rst:2182 msgid "" "Python uses files to contain certificates. They should be formatted as " "\"PEM\" (see :rfc:`1422`), which is a base-64 encoded form wrapped with a " "header line and a footer line::" msgstr "" -#: ../../library/ssl.rst:2047 +#: ../../library/ssl.rst:2186 msgid "" "-----BEGIN CERTIFICATE-----\n" "... (certificate in base64 PEM encoding) ...\n" @@ -2831,11 +3004,11 @@ msgstr "" "... (certificate in base64 PEM encoding) ...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2052 +#: ../../library/ssl.rst:2191 msgid "Certificate chains" msgstr "" -#: ../../library/ssl.rst:2054 +#: ../../library/ssl.rst:2193 msgid "" "The Python files which contain certificates can contain a sequence of " "certificates, sometimes called a *certificate chain*. This chain should " @@ -2851,7 +3024,7 @@ msgid "" "agency which issued the certification authority's certificate::" msgstr "" -#: ../../library/ssl.rst:2067 +#: ../../library/ssl.rst:2206 msgid "" "-----BEGIN CERTIFICATE-----\n" "... (certificate for your server)...\n" @@ -2873,11 +3046,11 @@ msgstr "" "... (the root certificate for the CA's issuer)...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2078 +#: ../../library/ssl.rst:2217 msgid "CA certificates" msgstr "" -#: ../../library/ssl.rst:2080 +#: ../../library/ssl.rst:2219 msgid "" "If you are going to require validation of the other side of the connection's " "certificate, you need to provide a \"CA certs\" file, filled with the " @@ -2889,11 +3062,11 @@ msgid "" "create_default_context`." msgstr "" -#: ../../library/ssl.rst:2089 +#: ../../library/ssl.rst:2228 msgid "Combined key and certificate" msgstr "" -#: ../../library/ssl.rst:2091 +#: ../../library/ssl.rst:2230 msgid "" "Often the private key is stored in the same file as the certificate; in this " "case, only the ``certfile`` parameter to :meth:`SSLContext.load_cert_chain` " @@ -2901,7 +3074,7 @@ msgid "" "should come before the first certificate in the certificate chain::" msgstr "" -#: ../../library/ssl.rst:2097 +#: ../../library/ssl.rst:2236 msgid "" "-----BEGIN RSA PRIVATE KEY-----\n" "... (private key in base64 encoding) ...\n" @@ -2917,11 +3090,11 @@ msgstr "" "... (certificate in base64 PEM encoding) ...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2105 +#: ../../library/ssl.rst:2244 msgid "Self-signed certificates" msgstr "" -#: ../../library/ssl.rst:2107 +#: ../../library/ssl.rst:2246 msgid "" "If you are going to create a server that provides SSL-encrypted connection " "services, you will need to acquire a certificate for that service. There " @@ -2931,7 +3104,7 @@ msgid "" "package, using something like the following::" msgstr "" -#: ../../library/ssl.rst:2114 +#: ../../library/ssl.rst:2253 msgid "" "% openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem\n" "Generating a 1024 bit RSA private key\n" @@ -2957,28 +3130,28 @@ msgid "" "%" msgstr "" -#: ../../library/ssl.rst:2136 +#: ../../library/ssl.rst:2275 msgid "" "The disadvantage of a self-signed certificate is that it is its own root " "certificate, and no one else will have it in their cache of known (and " "trusted) root certificates." msgstr "" -#: ../../library/ssl.rst:2142 +#: ../../library/ssl.rst:2281 msgid "Examples" msgstr "範例" -#: ../../library/ssl.rst:2145 +#: ../../library/ssl.rst:2284 msgid "Testing for SSL support" msgstr "" -#: ../../library/ssl.rst:2147 +#: ../../library/ssl.rst:2286 msgid "" "To test for the presence of SSL support in a Python installation, user code " "should use the following idiom::" msgstr "" -#: ../../library/ssl.rst:2150 +#: ../../library/ssl.rst:2289 msgid "" "try:\n" " import ssl\n" @@ -2988,27 +3161,27 @@ msgid "" " ... # do something that requires SSL support" msgstr "" -#: ../../library/ssl.rst:2158 +#: ../../library/ssl.rst:2297 msgid "Client-side operation" msgstr "" -#: ../../library/ssl.rst:2160 +#: ../../library/ssl.rst:2299 msgid "" "This example creates a SSL context with the recommended security settings " "for client sockets, including automatic certificate verification::" msgstr "" -#: ../../library/ssl.rst:2163 +#: ../../library/ssl.rst:2302 msgid ">>> context = ssl.create_default_context()" msgstr ">>> context = ssl.create_default_context()" -#: ../../library/ssl.rst:2165 +#: ../../library/ssl.rst:2304 msgid "" "If you prefer to tune security settings yourself, you might create a context " "from scratch (but beware that you might not get the settings right)::" msgstr "" -#: ../../library/ssl.rst:2169 +#: ../../library/ssl.rst:2308 msgid "" ">>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> context.load_verify_locations(\"/etc/ssl/certs/ca-bundle.crt\")" @@ -3016,14 +3189,14 @@ msgstr "" ">>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> context.load_verify_locations(\"/etc/ssl/certs/ca-bundle.crt\")" -#: ../../library/ssl.rst:2172 +#: ../../library/ssl.rst:2311 msgid "" "(this snippet assumes your operating system places a bundle of all CA " "certificates in ``/etc/ssl/certs/ca-bundle.crt``; if not, you'll get an " "error and have to adjust the location)" msgstr "" -#: ../../library/ssl.rst:2176 +#: ../../library/ssl.rst:2315 msgid "" "The :data:`PROTOCOL_TLS_CLIENT` protocol configures the context for cert " "validation and hostname verification. :attr:`~SSLContext.verify_mode` is set " @@ -3031,7 +3204,7 @@ msgid "" "``True``. All other protocols create SSL contexts with insecure defaults." msgstr "" -#: ../../library/ssl.rst:2181 +#: ../../library/ssl.rst:2320 msgid "" "When you use the context to connect to a server, :const:`CERT_REQUIRED` and :" "attr:`~SSLContext.check_hostname` validate the server certificate: it " @@ -3040,7 +3213,7 @@ msgid "" "properties like validity and identity of the hostname::" msgstr "" -#: ../../library/ssl.rst:2187 +#: ../../library/ssl.rst:2326 msgid "" ">>> conn = context.wrap_socket(socket.socket(socket.AF_INET),\n" "... server_hostname=\"www.python.org\")\n" @@ -3050,21 +3223,21 @@ msgstr "" "... server_hostname=\"www.python.org\")\n" ">>> conn.connect((\"www.python.org\", 443))" -#: ../../library/ssl.rst:2191 +#: ../../library/ssl.rst:2330 msgid "You may then fetch the certificate::" msgstr "" -#: ../../library/ssl.rst:2193 +#: ../../library/ssl.rst:2332 msgid ">>> cert = conn.getpeercert()" msgstr ">>> cert = conn.getpeercert()" -#: ../../library/ssl.rst:2195 +#: ../../library/ssl.rst:2334 msgid "" "Visual inspection shows that the certificate does identify the desired " "service (that is, the HTTPS host ``www.python.org``)::" msgstr "" -#: ../../library/ssl.rst:2198 +#: ../../library/ssl.rst:2337 msgid "" ">>> pprint.pprint(cert)\n" "{'OCSP': ('http://ocsp.digicert.com/',),\n" @@ -3154,13 +3327,13 @@ msgstr "" " ('DNS', 'id.python.org')),\n" " 'version': 3}" -#: ../../library/ssl.rst:2238 +#: ../../library/ssl.rst:2377 msgid "" "Now the SSL channel is established and the certificate verified, you can " "proceed to talk with the server::" msgstr "" -#: ../../library/ssl.rst:2241 +#: ../../library/ssl.rst:2380 msgid "" ">>> conn.sendall(b\"HEAD / HTTP/1.0\\r\\nHost: linuxfr.org\\r\\n\\r\\n\")\n" ">>> pprint.pprint(conn.recv(1024).split(b\"\\r\\n\"))\n" @@ -3202,11 +3375,11 @@ msgstr "" " b'',\n" " b'']" -#: ../../library/ssl.rst:2265 +#: ../../library/ssl.rst:2404 msgid "Server-side operation" msgstr "" -#: ../../library/ssl.rst:2267 +#: ../../library/ssl.rst:2406 msgid "" "For server operation, typically you'll need to have a server certificate, " "and private key, each in a file. You'll first create a context holding the " @@ -3215,7 +3388,7 @@ msgid "" "start waiting for clients to connect::" msgstr "" -#: ../../library/ssl.rst:2273 +#: ../../library/ssl.rst:2412 msgid "" "import socket, ssl\n" "\n" @@ -3235,14 +3408,14 @@ msgstr "" "bindsocket.bind(('myaddr.example.com', 10023))\n" "bindsocket.listen(5)" -#: ../../library/ssl.rst:2282 +#: ../../library/ssl.rst:2421 msgid "" "When a client connects, you'll call :meth:`accept` on the socket to get the " "new socket from the other end, and use the context's :meth:`SSLContext." "wrap_socket` method to create a server-side SSL socket for the connection::" msgstr "" -#: ../../library/ssl.rst:2286 +#: ../../library/ssl.rst:2425 msgid "" "while True:\n" " newsocket, fromaddr = bindsocket.accept()\n" @@ -3262,13 +3435,13 @@ msgstr "" " connstream.shutdown(socket.SHUT_RDWR)\n" " connstream.close()" -#: ../../library/ssl.rst:2295 +#: ../../library/ssl.rst:2434 msgid "" "Then you'll read data from the ``connstream`` and do something with it till " "you are finished with the client (or the client is finished with you)::" msgstr "" -#: ../../library/ssl.rst:2298 +#: ../../library/ssl.rst:2437 msgid "" "def deal_with_client(connstream):\n" " data = connstream.recv(1024)\n" @@ -3282,7 +3455,7 @@ msgid "" " # finished with client" msgstr "" -#: ../../library/ssl.rst:2309 +#: ../../library/ssl.rst:2448 msgid "" "And go back to listening for new client connections (of course, a real " "server would probably handle each client connection in a separate thread, or " @@ -3290,18 +3463,18 @@ msgid "" "event loop)." msgstr "" -#: ../../library/ssl.rst:2317 +#: ../../library/ssl.rst:2456 msgid "Notes on non-blocking sockets" msgstr "" -#: ../../library/ssl.rst:2319 +#: ../../library/ssl.rst:2458 msgid "" "SSL sockets behave slightly different than regular sockets in non-blocking " "mode. When working with non-blocking sockets, there are thus several things " "you need to be aware of:" msgstr "" -#: ../../library/ssl.rst:2323 +#: ../../library/ssl.rst:2462 msgid "" "Most :class:`SSLSocket` methods will raise either :exc:`SSLWantWriteError` " "or :exc:`SSLWantReadError` instead of :exc:`BlockingIOError` if an I/O " @@ -3313,13 +3486,13 @@ msgid "" "require a prior *write* to the underlying socket." msgstr "" -#: ../../library/ssl.rst:2335 +#: ../../library/ssl.rst:2474 msgid "" "In earlier Python versions, the :meth:`!SSLSocket.send` method returned zero " "instead of raising :exc:`SSLWantWriteError` or :exc:`SSLWantReadError`." msgstr "" -#: ../../library/ssl.rst:2339 +#: ../../library/ssl.rst:2478 msgid "" "Calling :func:`~select.select` tells you that the OS-level socket can be " "read from (or written to), but it does not imply that there is sufficient " @@ -3329,7 +3502,7 @@ msgid "" "`~select.select`." msgstr "" -#: ../../library/ssl.rst:2346 +#: ../../library/ssl.rst:2485 msgid "" "Conversely, since the SSL layer has its own framing, a SSL socket may still " "have data available for reading without :func:`~select.select` being aware " @@ -3338,13 +3511,13 @@ msgid "" "call if still necessary." msgstr "" -#: ../../library/ssl.rst:2352 +#: ../../library/ssl.rst:2491 msgid "" "(of course, similar provisions apply when using other primitives such as :" "func:`~select.poll`, or those in the :mod:`selectors` module)" msgstr "" -#: ../../library/ssl.rst:2355 +#: ../../library/ssl.rst:2494 msgid "" "The SSL handshake itself will be non-blocking: the :meth:`SSLSocket." "do_handshake` method has to be retried until it returns successfully. Here " @@ -3352,7 +3525,7 @@ msgid "" "readiness::" msgstr "" -#: ../../library/ssl.rst:2360 +#: ../../library/ssl.rst:2499 msgid "" "while True:\n" " try:\n" @@ -3372,7 +3545,7 @@ msgstr "" " except ssl.SSLWantWriteError:\n" " select.select([], [sock], [])" -#: ../../library/ssl.rst:2371 +#: ../../library/ssl.rst:2510 msgid "" "The :mod:`asyncio` module supports :ref:`non-blocking SSL sockets ` and provides a higher level API. It polls for events using " @@ -3381,26 +3554,26 @@ msgid "" "handshake asynchronously as well." msgstr "" -#: ../../library/ssl.rst:2380 +#: ../../library/ssl.rst:2519 msgid "Memory BIO Support" msgstr "" -#: ../../library/ssl.rst:2384 +#: ../../library/ssl.rst:2523 msgid "" "Ever since the SSL module was introduced in Python 2.6, the :class:" "`SSLSocket` class has provided two related but distinct areas of " "functionality:" msgstr "" -#: ../../library/ssl.rst:2387 +#: ../../library/ssl.rst:2526 msgid "SSL protocol handling" msgstr "" -#: ../../library/ssl.rst:2388 +#: ../../library/ssl.rst:2527 msgid "Network IO" msgstr "" -#: ../../library/ssl.rst:2390 +#: ../../library/ssl.rst:2529 msgid "" "The network IO API is identical to that provided by :class:`socket.socket`, " "from which :class:`SSLSocket` also inherits. This allows an SSL socket to be " @@ -3408,7 +3581,7 @@ msgid "" "add SSL support to an existing application." msgstr "" -#: ../../library/ssl.rst:2395 +#: ../../library/ssl.rst:2534 msgid "" "Combining SSL protocol handling and network IO usually works well, but there " "are some cases where it doesn't. An example is async IO frameworks that want " @@ -3420,7 +3593,7 @@ msgid "" "`SSLObject` is provided." msgstr "" -#: ../../library/ssl.rst:2406 +#: ../../library/ssl.rst:2545 msgid "" "A reduced-scope variant of :class:`SSLSocket` representing an SSL protocol " "instance that does not contain any network IO methods. This class is " @@ -3428,7 +3601,7 @@ msgid "" "for SSL through memory buffers." msgstr "" -#: ../../library/ssl.rst:2411 +#: ../../library/ssl.rst:2550 msgid "" "This class implements an interface on top of a low-level SSL object as " "implemented by OpenSSL. This object captures the state of an SSL connection " @@ -3436,7 +3609,7 @@ msgid "" "separate \"BIO\" objects which are OpenSSL's IO abstraction layer." msgstr "" -#: ../../library/ssl.rst:2416 +#: ../../library/ssl.rst:2555 msgid "" "This class has no public constructor. An :class:`SSLObject` instance must " "be created using the :meth:`~SSLContext.wrap_bio` method. This method will " @@ -3445,207 +3618,217 @@ msgid "" "instance, while the *outgoing* BIO is used to pass data the other way around." msgstr "" -#: ../../library/ssl.rst:2423 +#: ../../library/ssl.rst:2562 msgid "The following methods are available:" msgstr "" -#: ../../library/ssl.rst:2425 +#: ../../library/ssl.rst:2564 msgid ":attr:`~SSLSocket.context`" msgstr ":attr:`~SSLSocket.context`" -#: ../../library/ssl.rst:2426 +#: ../../library/ssl.rst:2565 msgid ":attr:`~SSLSocket.server_side`" msgstr ":attr:`~SSLSocket.server_side`" -#: ../../library/ssl.rst:2427 +#: ../../library/ssl.rst:2566 msgid ":attr:`~SSLSocket.server_hostname`" msgstr ":attr:`~SSLSocket.server_hostname`" -#: ../../library/ssl.rst:2428 +#: ../../library/ssl.rst:2567 msgid ":attr:`~SSLSocket.session`" msgstr ":attr:`~SSLSocket.session`" -#: ../../library/ssl.rst:2429 +#: ../../library/ssl.rst:2568 msgid ":attr:`~SSLSocket.session_reused`" msgstr ":attr:`~SSLSocket.session_reused`" -#: ../../library/ssl.rst:2430 +#: ../../library/ssl.rst:2569 msgid ":meth:`~SSLSocket.read`" msgstr ":meth:`~SSLSocket.read`" -#: ../../library/ssl.rst:2431 +#: ../../library/ssl.rst:2570 msgid ":meth:`~SSLSocket.write`" msgstr ":meth:`~SSLSocket.write`" -#: ../../library/ssl.rst:2432 +#: ../../library/ssl.rst:2571 msgid ":meth:`~SSLSocket.getpeercert`" msgstr ":meth:`~SSLSocket.getpeercert`" -#: ../../library/ssl.rst:2433 +#: ../../library/ssl.rst:2572 +#, fuzzy +msgid ":meth:`~SSLSocket.get_verified_chain`" +msgstr ":meth:`~SSLSocket.version`" + +#: ../../library/ssl.rst:2573 +#, fuzzy +msgid ":meth:`~SSLSocket.get_unverified_chain`" +msgstr ":meth:`~SSLSocket.get_channel_binding`" + +#: ../../library/ssl.rst:2574 msgid ":meth:`~SSLSocket.selected_alpn_protocol`" msgstr ":meth:`~SSLSocket.selected_alpn_protocol`" -#: ../../library/ssl.rst:2434 +#: ../../library/ssl.rst:2575 msgid ":meth:`~SSLSocket.selected_npn_protocol`" msgstr ":meth:`~SSLSocket.selected_npn_protocol`" -#: ../../library/ssl.rst:2435 +#: ../../library/ssl.rst:2576 msgid ":meth:`~SSLSocket.cipher`" msgstr ":meth:`~SSLSocket.cipher`" -#: ../../library/ssl.rst:2436 +#: ../../library/ssl.rst:2577 msgid ":meth:`~SSLSocket.shared_ciphers`" msgstr ":meth:`~SSLSocket.shared_ciphers`" -#: ../../library/ssl.rst:2437 +#: ../../library/ssl.rst:2578 msgid ":meth:`~SSLSocket.compression`" msgstr ":meth:`~SSLSocket.compression`" -#: ../../library/ssl.rst:2438 +#: ../../library/ssl.rst:2579 msgid ":meth:`~SSLSocket.pending`" msgstr ":meth:`~SSLSocket.pending`" -#: ../../library/ssl.rst:2439 +#: ../../library/ssl.rst:2580 msgid ":meth:`~SSLSocket.do_handshake`" msgstr ":meth:`~SSLSocket.do_handshake`" -#: ../../library/ssl.rst:2440 +#: ../../library/ssl.rst:2581 msgid ":meth:`~SSLSocket.verify_client_post_handshake`" msgstr ":meth:`~SSLSocket.verify_client_post_handshake`" -#: ../../library/ssl.rst:2441 +#: ../../library/ssl.rst:2582 msgid ":meth:`~SSLSocket.unwrap`" msgstr ":meth:`~SSLSocket.unwrap`" -#: ../../library/ssl.rst:2442 +#: ../../library/ssl.rst:2583 msgid ":meth:`~SSLSocket.get_channel_binding`" msgstr ":meth:`~SSLSocket.get_channel_binding`" -#: ../../library/ssl.rst:2443 +#: ../../library/ssl.rst:2584 msgid ":meth:`~SSLSocket.version`" msgstr ":meth:`~SSLSocket.version`" -#: ../../library/ssl.rst:2445 +#: ../../library/ssl.rst:2586 msgid "" "When compared to :class:`SSLSocket`, this object lacks the following " "features:" msgstr "" -#: ../../library/ssl.rst:2448 +#: ../../library/ssl.rst:2589 msgid "" "Any form of network IO; ``recv()`` and ``send()`` read and write only to the " "underlying :class:`MemoryBIO` buffers." msgstr "" -#: ../../library/ssl.rst:2451 +#: ../../library/ssl.rst:2592 msgid "" "There is no *do_handshake_on_connect* machinery. You must always manually " "call :meth:`~SSLSocket.do_handshake` to start the handshake." msgstr "" -#: ../../library/ssl.rst:2454 +#: ../../library/ssl.rst:2595 msgid "" "There is no handling of *suppress_ragged_eofs*. All end-of-file conditions " "that are in violation of the protocol are reported via the :exc:" "`SSLEOFError` exception." msgstr "" -#: ../../library/ssl.rst:2458 +#: ../../library/ssl.rst:2599 msgid "" "The method :meth:`~SSLSocket.unwrap` call does not return anything, unlike " "for an SSL socket where it returns the underlying socket." msgstr "" -#: ../../library/ssl.rst:2461 +#: ../../library/ssl.rst:2602 msgid "" "The *server_name_callback* callback passed to :meth:`SSLContext." "set_servername_callback` will get an :class:`SSLObject` instance instead of " "a :class:`SSLSocket` instance as its first parameter." msgstr "" -#: ../../library/ssl.rst:2465 +#: ../../library/ssl.rst:2606 msgid "Some notes related to the use of :class:`SSLObject`:" msgstr "" -#: ../../library/ssl.rst:2467 +#: ../../library/ssl.rst:2608 msgid "" "All IO on an :class:`SSLObject` is :ref:`non-blocking `. " "This means that for example :meth:`~SSLSocket.read` will raise an :exc:" "`SSLWantReadError` if it needs more data than the incoming BIO has available." msgstr "" -#: ../../library/ssl.rst:2472 +#: ../../library/ssl.rst:2613 msgid "" ":class:`SSLObject` instances must be created with :meth:`~SSLContext." "wrap_bio`. In earlier versions, it was possible to create instances " "directly. This was never documented or officially supported." msgstr "" -#: ../../library/ssl.rst:2478 +#: ../../library/ssl.rst:2619 msgid "" "An SSLObject communicates with the outside world using memory buffers. The " "class :class:`MemoryBIO` provides a memory buffer that can be used for this " "purpose. It wraps an OpenSSL memory BIO (Basic IO) object:" msgstr "" -#: ../../library/ssl.rst:2484 +#: ../../library/ssl.rst:2625 msgid "" "A memory buffer that can be used to pass data between Python and an SSL " "protocol instance." msgstr "" -#: ../../library/ssl.rst:2489 +#: ../../library/ssl.rst:2630 msgid "Return the number of bytes currently in the memory buffer." msgstr "" -#: ../../library/ssl.rst:2493 +#: ../../library/ssl.rst:2634 msgid "" "A boolean indicating whether the memory BIO is current at the end-of-file " "position." msgstr "" -#: ../../library/ssl.rst:2498 +#: ../../library/ssl.rst:2639 msgid "" "Read up to *n* bytes from the memory buffer. If *n* is not specified or " "negative, all bytes are returned." msgstr "" -#: ../../library/ssl.rst:2503 +#: ../../library/ssl.rst:2644 msgid "" "Write the bytes from *buf* to the memory BIO. The *buf* argument must be an " "object supporting the buffer protocol." msgstr "" -#: ../../library/ssl.rst:2506 +#: ../../library/ssl.rst:2647 msgid "" "The return value is the number of bytes written, which is always equal to " "the length of *buf*." msgstr "" -#: ../../library/ssl.rst:2511 +#: ../../library/ssl.rst:2652 msgid "" "Write an EOF marker to the memory BIO. After this method has been called, it " "is illegal to call :meth:`~MemoryBIO.write`. The attribute :attr:`eof` will " "become true after all data currently in the buffer has been read." msgstr "" -#: ../../library/ssl.rst:2517 +#: ../../library/ssl.rst:2658 msgid "SSL session" msgstr "" -#: ../../library/ssl.rst:2523 +#: ../../library/ssl.rst:2664 msgid "Session object used by :attr:`~SSLSocket.session`." msgstr "" -#: ../../library/ssl.rst:2535 +#: ../../library/ssl.rst:2676 msgid "Security considerations" msgstr "" -#: ../../library/ssl.rst:2538 +#: ../../library/ssl.rst:2679 msgid "Best defaults" msgstr "" -#: ../../library/ssl.rst:2540 +#: ../../library/ssl.rst:2681 msgid "" "For **client use**, if you don't have any special requirements for your " "security policy, it is highly recommended that you use the :func:" @@ -3655,13 +3838,13 @@ msgid "" "settings." msgstr "" -#: ../../library/ssl.rst:2547 +#: ../../library/ssl.rst:2688 msgid "" "For example, here is how you would use the :class:`smtplib.SMTP` class to " "create a trusted, secure connection to a SMTP server::" msgstr "" -#: ../../library/ssl.rst:2550 +#: ../../library/ssl.rst:2691 msgid "" ">>> import ssl, smtplib\n" ">>> smtp = smtplib.SMTP(\"mail.python.org\", port=587)\n" @@ -3675,13 +3858,13 @@ msgstr "" ">>> smtp.starttls(context=context)\n" "(220, b'2.0.0 Ready to start TLS')" -#: ../../library/ssl.rst:2556 +#: ../../library/ssl.rst:2697 msgid "" "If a client certificate is needed for the connection, it can be added with :" "meth:`SSLContext.load_cert_chain`." msgstr "" -#: ../../library/ssl.rst:2559 +#: ../../library/ssl.rst:2700 msgid "" "By contrast, if you create the SSL context by calling the :class:" "`SSLContext` constructor yourself, it will not have certificate validation " @@ -3689,15 +3872,15 @@ msgid "" "paragraphs below to achieve a good security level." msgstr "" -#: ../../library/ssl.rst:2565 +#: ../../library/ssl.rst:2706 msgid "Manual settings" msgstr "手動設定" -#: ../../library/ssl.rst:2568 +#: ../../library/ssl.rst:2709 msgid "Verifying certificates" msgstr "驗證憑證" -#: ../../library/ssl.rst:2570 +#: ../../library/ssl.rst:2711 msgid "" "When calling the :class:`SSLContext` constructor directly, :const:" "`CERT_NONE` is the default. Since it does not authenticate the other peer, " @@ -3712,13 +3895,13 @@ msgid "" "enabled." msgstr "" -#: ../../library/ssl.rst:2582 +#: ../../library/ssl.rst:2723 msgid "" "Hostname matchings is now performed by OpenSSL. Python no longer uses :func:" "`match_hostname`." msgstr "" -#: ../../library/ssl.rst:2586 +#: ../../library/ssl.rst:2727 msgid "" "In server mode, if you want to authenticate your clients using the SSL layer " "(rather than using a higher-level authentication mechanism), you'll also " @@ -3726,11 +3909,11 @@ msgid "" "certificate." msgstr "" -#: ../../library/ssl.rst:2592 +#: ../../library/ssl.rst:2733 msgid "Protocol versions" msgstr "協定版本" -#: ../../library/ssl.rst:2594 +#: ../../library/ssl.rst:2735 msgid "" "SSL versions 2 and 3 are considered insecure and are therefore dangerous to " "use. If you want maximum compatibility between clients and servers, it is " @@ -3739,7 +3922,7 @@ msgid "" "by default." msgstr "" -#: ../../library/ssl.rst:2602 +#: ../../library/ssl.rst:2743 msgid "" ">>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3\n" @@ -3749,7 +3932,7 @@ msgstr "" ">>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3\n" ">>> client_context.maximum_version = ssl.TLSVersion.TLSv1_3" -#: ../../library/ssl.rst:2607 +#: ../../library/ssl.rst:2748 msgid "" "The SSL context created above will only allow TLSv1.3 and later (if " "supported by your system) connections to a server. :const:" @@ -3757,28 +3940,28 @@ msgid "" "default. You have to load certificates into the context." msgstr "" -#: ../../library/ssl.rst:2614 +#: ../../library/ssl.rst:2755 msgid "Cipher selection" msgstr "" -#: ../../library/ssl.rst:2616 +#: ../../library/ssl.rst:2757 msgid "" "If you have advanced security requirements, fine-tuning of the ciphers " "enabled when negotiating a SSL session is possible through the :meth:" "`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the ssl module " "disables certain weak ciphers by default, but you may want to further " "restrict the cipher choice. Be sure to read OpenSSL's documentation about " -"the `cipher list format `_. If you want to check which ciphers are enabled by a given " -"cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl ciphers`` " -"command on your system." +"the `cipher list format `_. If you want to check which ciphers are enabled " +"by a given cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl " +"ciphers`` command on your system." msgstr "" -#: ../../library/ssl.rst:2627 +#: ../../library/ssl.rst:2768 msgid "Multi-processing" msgstr "" -#: ../../library/ssl.rst:2629 +#: ../../library/ssl.rst:2770 msgid "" "If using this module as part of a multi-processed application (using, for " "example the :mod:`multiprocessing` or :mod:`concurrent.futures` modules), be " @@ -3789,17 +3972,17 @@ msgid "" "sufficient." msgstr "" -#: ../../library/ssl.rst:2641 +#: ../../library/ssl.rst:2782 msgid "TLS 1.3" msgstr "TLS 1.3" -#: ../../library/ssl.rst:2645 +#: ../../library/ssl.rst:2786 msgid "" "The TLS 1.3 protocol behaves slightly differently than previous version of " "TLS/SSL. Some new TLS 1.3 features are not yet available." msgstr "" -#: ../../library/ssl.rst:2648 +#: ../../library/ssl.rst:2789 msgid "" "TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and ChaCha20 " "cipher suites are enabled by default. The method :meth:`SSLContext." @@ -3807,14 +3990,14 @@ msgid "" "`SSLContext.get_ciphers` returns them." msgstr "" -#: ../../library/ssl.rst:2652 +#: ../../library/ssl.rst:2793 msgid "" "Session tickets are no longer sent as part of the initial handshake and are " "handled differently. :attr:`SSLSocket.session` and :class:`SSLSession` are " "not compatible with TLS 1.3." msgstr "" -#: ../../library/ssl.rst:2655 +#: ../../library/ssl.rst:2796 msgid "" "Client-side certificates are also no longer verified during the initial " "handshake. A server can request a certificate at any time. Clients process " @@ -3822,21 +4005,21 @@ msgid "" "server." msgstr "" -#: ../../library/ssl.rst:2659 +#: ../../library/ssl.rst:2800 msgid "" "TLS 1.3 features like early data, deferred TLS client cert request, " "signature algorithm configuration, and rekeying are not supported yet." msgstr "" -#: ../../library/ssl.rst:2665 +#: ../../library/ssl.rst:2806 msgid "Class :class:`socket.socket`" msgstr ":class:`socket.socket` 類別" -#: ../../library/ssl.rst:2666 +#: ../../library/ssl.rst:2807 msgid "Documentation of underlying :mod:`socket` class" msgstr "底層 :mod:`socket` 類別的文件" -#: ../../library/ssl.rst:2668 +#: ../../library/ssl.rst:2809 msgid "" "`SSL/TLS Strong Encryption: An Introduction `_" @@ -3844,11 +4027,11 @@ msgstr "" "`SSL/TLS Strong Encryption: An Introduction `_" -#: ../../library/ssl.rst:2669 +#: ../../library/ssl.rst:2810 msgid "Intro from the Apache HTTP Server documentation" msgstr "Apache HTTP Server 文件的介紹" -#: ../../library/ssl.rst:2671 +#: ../../library/ssl.rst:2812 msgid "" ":rfc:`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: " "Certificate-Based Key Management <1422>`" @@ -3856,19 +4039,19 @@ msgstr "" ":rfc:`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: " "Certificate-Based Key Management <1422>`" -#: ../../library/ssl.rst:2672 +#: ../../library/ssl.rst:2813 msgid "Steve Kent" msgstr "Steve Kent" -#: ../../library/ssl.rst:2674 +#: ../../library/ssl.rst:2815 msgid ":rfc:`RFC 4086: Randomness Requirements for Security <4086>`" msgstr ":rfc:`RFC 4086: Randomness Requirements for Security <4086>`" -#: ../../library/ssl.rst:2675 +#: ../../library/ssl.rst:2816 msgid "Donald E., Jeffrey I. Schiller" msgstr "Donald E., Jeffrey I. Schiller" -#: ../../library/ssl.rst:2677 +#: ../../library/ssl.rst:2818 msgid "" ":rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and " "Certificate Revocation List (CRL) Profile <5280>`" @@ -3876,11 +4059,11 @@ msgstr "" ":rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and " "Certificate Revocation List (CRL) Profile <5280>`" -#: ../../library/ssl.rst:2678 +#: ../../library/ssl.rst:2819 msgid "D. Cooper" msgstr "D. Cooper" -#: ../../library/ssl.rst:2680 +#: ../../library/ssl.rst:2821 msgid "" ":rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 " "<5246>`" @@ -3888,19 +4071,19 @@ msgstr "" ":rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 " "<5246>`" -#: ../../library/ssl.rst:2681 +#: ../../library/ssl.rst:2822 msgid "T. Dierks et. al." msgstr "T. Dierks et. al." -#: ../../library/ssl.rst:2683 +#: ../../library/ssl.rst:2824 msgid ":rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`" msgstr ":rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`" -#: ../../library/ssl.rst:2684 +#: ../../library/ssl.rst:2825 msgid "D. Eastlake" msgstr "D. Eastlake" -#: ../../library/ssl.rst:2686 +#: ../../library/ssl.rst:2827 msgid "" "`IANA TLS: Transport Layer Security (TLS) Parameters `_" @@ -3908,11 +4091,11 @@ msgstr "" "`IANA TLS: Transport Layer Security (TLS) Parameters `_" -#: ../../library/ssl.rst:2687 +#: ../../library/ssl.rst:2828 msgid "IANA" msgstr "IANA" -#: ../../library/ssl.rst:2689 +#: ../../library/ssl.rst:2830 msgid "" ":rfc:`RFC 7525: Recommendations for Secure Use of Transport Layer Security " "(TLS) and Datagram Transport Layer Security (DTLS) <7525>`" @@ -3920,11 +4103,11 @@ msgstr "" ":rfc:`RFC 7525: Recommendations for Secure Use of Transport Layer Security " "(TLS) and Datagram Transport Layer Security (DTLS) <7525>`" -#: ../../library/ssl.rst:2690 +#: ../../library/ssl.rst:2831 msgid "IETF" msgstr "IETF" -#: ../../library/ssl.rst:2692 +#: ../../library/ssl.rst:2833 msgid "" "`Mozilla's Server Side TLS recommendations `_" @@ -3932,7 +4115,7 @@ msgstr "" "`Mozilla's Server Side TLS recommendations `_" -#: ../../library/ssl.rst:2693 +#: ../../library/ssl.rst:2834 msgid "Mozilla" msgstr "Mozilla" @@ -3960,10 +4143,13 @@ msgstr "Transport Layer Security(傳輸層安全)" msgid "Secure Sockets Layer" msgstr "Secure Sockets Layer(安全 socket 層)" -#: ../../library/ssl.rst:2006 +#: ../../library/ssl.rst:2145 msgid "certificates" msgstr "certificates(憑證)" -#: ../../library/ssl.rst:2008 +#: ../../library/ssl.rst:2147 msgid "X509 certificate" msgstr "X509 certificate(X509 憑證)" + +#~ msgid ":ref:`Availability `: not Emscripten, not WASI." +#~ msgstr ":ref:`適用 `: 非 Emscripten、非 WASI。" diff --git a/library/stat.po b/library/stat.po index a186ac2d47..83b937fed9 100644 --- a/library/stat.po +++ b/library/stat.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2016-11-19 00:34+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -381,48 +381,88 @@ msgid "" msgstr "" #: ../../library/stat.rst:355 +msgid "All user settable flags." +msgstr "" + +#: ../../library/stat.rst:361 msgid "Do not dump the file." msgstr "" -#: ../../library/stat.rst:359 ../../library/stat.rst:387 +#: ../../library/stat.rst:365 ../../library/stat.rst:427 msgid "The file may not be changed." msgstr "" -#: ../../library/stat.rst:363 ../../library/stat.rst:391 +#: ../../library/stat.rst:369 ../../library/stat.rst:431 msgid "The file may only be appended to." msgstr "" -#: ../../library/stat.rst:367 +#: ../../library/stat.rst:373 msgid "The directory is opaque when viewed through a union stack." msgstr "" -#: ../../library/stat.rst:371 ../../library/stat.rst:395 +#: ../../library/stat.rst:377 ../../library/stat.rst:441 msgid "The file may not be renamed or deleted." msgstr "" -#: ../../library/stat.rst:375 +#: ../../library/stat.rst:381 msgid "The file is stored compressed (macOS 10.6+)." msgstr "" -#: ../../library/stat.rst:379 +#: ../../library/stat.rst:385 +msgid "Used for handling document IDs (macOS)" +msgstr "" + +#: ../../library/stat.rst:391 +msgid "The file needs an entitlement for reading or writing (macOS 10.13+)" +msgstr "" + +#: ../../library/stat.rst:397 msgid "The file should not be displayed in a GUI (macOS 10.5+)." msgstr "" -#: ../../library/stat.rst:383 +#: ../../library/stat.rst:401 +msgid "All super-user changeable flags" +msgstr "" + +#: ../../library/stat.rst:407 +msgid "All super-user supported flags" +msgstr "" + +#: ../../library/stat.rst:409 ../../library/stat.rst:417 +msgid ":ref:`Availability `: macOS" +msgstr "" + +#: ../../library/stat.rst:415 +msgid "All super-user read-only synthetic flags" +msgstr "" + +#: ../../library/stat.rst:423 msgid "The file may be archived." msgstr "" -#: ../../library/stat.rst:399 +#: ../../library/stat.rst:435 +msgid "The file needs an entitlement to write to (macOS 10.13+)" +msgstr "" + +#: ../../library/stat.rst:445 msgid "The file is a snapshot file." msgstr "" -#: ../../library/stat.rst:401 +#: ../../library/stat.rst:449 +msgid "The file is a firmlink (macOS 10.15+)" +msgstr "" + +#: ../../library/stat.rst:455 +msgid "The file is a dataless object (macOS 10.15+)" +msgstr "" + +#: ../../library/stat.rst:459 msgid "" "See the \\*BSD or macOS systems man page :manpage:`chflags(2)` for more " "information." msgstr "" -#: ../../library/stat.rst:403 +#: ../../library/stat.rst:461 msgid "" "On Windows, the following file attribute constants are available for use " "when testing bits in the ``st_file_attributes`` member returned by :func:`os." @@ -431,7 +471,7 @@ msgid "" "these constants." msgstr "" -#: ../../library/stat.rst:429 +#: ../../library/stat.rst:487 msgid "" "On Windows, the following constants are available for comparing against the " "``st_reparse_tag`` member returned by :func:`os.lstat`. These are well-known " diff --git a/library/statistics.po b/library/statistics.po index b2eb33b837..54f51c864f 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-07-22 21:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -143,143 +143,161 @@ msgid "Harmonic mean of data." msgstr "資料的調和平均數。" #: ../../library/statistics.rst:79 +#, fuzzy +msgid ":func:`kde`" +msgstr ":func:`mode`" + +#: ../../library/statistics.rst:79 +msgid "Estimate the probability density distribution of the data." +msgstr "" + +#: ../../library/statistics.rst:80 +#, fuzzy +msgid ":func:`kde_random`" +msgstr ":func:`mean`" + +#: ../../library/statistics.rst:80 +msgid "Random sampling from the PDF generated by kde()." +msgstr "" + +#: ../../library/statistics.rst:81 msgid ":func:`median`" msgstr ":func:`median`" -#: ../../library/statistics.rst:79 +#: ../../library/statistics.rst:81 msgid "Median (middle value) of data." msgstr "資料的中位數(中間值)。" -#: ../../library/statistics.rst:80 +#: ../../library/statistics.rst:82 msgid ":func:`median_low`" msgstr ":func:`median_low`" -#: ../../library/statistics.rst:80 +#: ../../library/statistics.rst:82 msgid "Low median of data." msgstr "資料中較小的中位數。" -#: ../../library/statistics.rst:81 +#: ../../library/statistics.rst:83 msgid ":func:`median_high`" msgstr ":func:`median_high`" -#: ../../library/statistics.rst:81 +#: ../../library/statistics.rst:83 msgid "High median of data." msgstr "資料中較大的中位數。" -#: ../../library/statistics.rst:82 +#: ../../library/statistics.rst:84 msgid ":func:`median_grouped`" msgstr ":func:`median_grouped`" -#: ../../library/statistics.rst:82 +#: ../../library/statistics.rst:84 msgid "Median (50th percentile) of grouped data." msgstr "分組資料的中位數(第 50 百分位數)。" -#: ../../library/statistics.rst:83 +#: ../../library/statistics.rst:85 msgid ":func:`mode`" msgstr ":func:`mode`" -#: ../../library/statistics.rst:83 +#: ../../library/statistics.rst:85 msgid "Single mode (most common value) of discrete or nominal data." msgstr "" "離散 (discrete) 或名目 (nomial) 資料中的眾數(出現次數最多次的值),只回傳一" "個。" -#: ../../library/statistics.rst:84 +#: ../../library/statistics.rst:86 msgid ":func:`multimode`" msgstr ":func:`multimode`" -#: ../../library/statistics.rst:84 +#: ../../library/statistics.rst:86 msgid "List of modes (most common values) of discrete or nominal data." msgstr "離散或名目資料中的眾數(出現次數最多次的值)組成的 list。" -#: ../../library/statistics.rst:85 +#: ../../library/statistics.rst:87 msgid ":func:`quantiles`" msgstr ":func:`quantiles`" -#: ../../library/statistics.rst:85 +#: ../../library/statistics.rst:87 msgid "Divide data into intervals with equal probability." msgstr "將資料分成數個具有相等機率的區間,即分位數 (quantile)。" -#: ../../library/statistics.rst:89 +#: ../../library/statistics.rst:91 msgid "Measures of spread" msgstr "離度 (spread) 的測量" -#: ../../library/statistics.rst:91 +#: ../../library/statistics.rst:93 msgid "" "These functions calculate a measure of how much the population or sample " "tends to deviate from the typical or average values." msgstr "這些函式計算母體或樣本偏離平均值的程度。" -#: ../../library/statistics.rst:95 +#: ../../library/statistics.rst:97 msgid ":func:`pstdev`" msgstr ":func:`pstdev`" -#: ../../library/statistics.rst:95 +#: ../../library/statistics.rst:97 msgid "Population standard deviation of data." msgstr "資料的母體標準差。" -#: ../../library/statistics.rst:96 +#: ../../library/statistics.rst:98 msgid ":func:`pvariance`" msgstr ":func:`pvariance`" -#: ../../library/statistics.rst:96 +#: ../../library/statistics.rst:98 msgid "Population variance of data." msgstr "資料的母體變異數。" -#: ../../library/statistics.rst:97 +#: ../../library/statistics.rst:99 msgid ":func:`stdev`" msgstr ":func:`stdev`" -#: ../../library/statistics.rst:97 +#: ../../library/statistics.rst:99 msgid "Sample standard deviation of data." msgstr "資料的樣本標準差。" -#: ../../library/statistics.rst:98 +#: ../../library/statistics.rst:100 msgid ":func:`variance`" msgstr ":func:`variance`" -#: ../../library/statistics.rst:98 +#: ../../library/statistics.rst:100 msgid "Sample variance of data." msgstr "資料的樣本變異數。" -#: ../../library/statistics.rst:102 +#: ../../library/statistics.rst:104 msgid "Statistics for relations between two inputs" msgstr "兩個輸入之間的關係統計" -#: ../../library/statistics.rst:104 +#: ../../library/statistics.rst:106 msgid "" "These functions calculate statistics regarding relations between two inputs." msgstr "這些函式計算兩個輸入之間的關係統計數據。" -#: ../../library/statistics.rst:107 +#: ../../library/statistics.rst:109 msgid ":func:`covariance`" msgstr ":func:`covariance`" -#: ../../library/statistics.rst:107 +#: ../../library/statistics.rst:109 msgid "Sample covariance for two variables." msgstr "兩變數的樣本共變異數。" -#: ../../library/statistics.rst:108 +#: ../../library/statistics.rst:110 msgid ":func:`correlation`" msgstr ":func:`correlation`" -#: ../../library/statistics.rst:108 +#: ../../library/statistics.rst:110 msgid "Pearson and Spearman's correlation coefficients." msgstr "Pearson 與 Spearman 相關係數 (correlation coefficient)。" -#: ../../library/statistics.rst:109 +#: ../../library/statistics.rst:111 msgid ":func:`linear_regression`" msgstr ":func:`linear_regression`" -#: ../../library/statistics.rst:109 +#: ../../library/statistics.rst:111 msgid "Slope and intercept for simple linear regression." msgstr "簡單線性迴歸的斜率和截距。" -#: ../../library/statistics.rst:114 +#: ../../library/statistics.rst:116 msgid "Function details" msgstr "函式細節" -#: ../../library/statistics.rst:116 +#: ../../library/statistics.rst:118 msgid "" "Note: The functions do not require the data given to them to be sorted. " "However, for reading convenience, most of the examples show sorted sequences." @@ -287,13 +305,13 @@ msgstr "" "註:這些函數並不要求輸入的資料必須排序過。為了閱讀方便,大部份的範例仍已排序" "過。" -#: ../../library/statistics.rst:121 +#: ../../library/statistics.rst:123 msgid "" "Return the sample arithmetic mean of *data* which can be a sequence or " "iterable." msgstr "回傳 *data* 的樣本算數平均數,輸入可為一個 sequence 或者 iterable。" -#: ../../library/statistics.rst:123 +#: ../../library/statistics.rst:125 msgid "" "The arithmetic mean is the sum of the data divided by the number of data " "points. It is commonly called \"the average\", although it is only one of " @@ -303,15 +321,15 @@ msgstr "" "算數平均數為資料總和除以資料點的數目。他通常被稱為「平均值」,儘管它只是眾多" "不同的數學平均值之一。它是衡量資料集中位置的一種指標。" -#: ../../library/statistics.rst:128 +#: ../../library/statistics.rst:130 msgid "If *data* is empty, :exc:`StatisticsError` will be raised." msgstr "若 *data* 為空,則會引發 :exc:`StatisticsError`。" -#: ../../library/statistics.rst:130 +#: ../../library/statistics.rst:132 msgid "Some examples of use:" msgstr "使用範例:" -#: ../../library/statistics.rst:132 +#: ../../library/statistics.rst:134 msgid "" ">>> mean([1, 2, 3, 4, 4])\n" "2.8\n" @@ -339,7 +357,7 @@ msgstr "" ">>> mean([D(\"0.5\"), D(\"0.75\"), D(\"0.625\"), D(\"0.375\")])\n" "Decimal('0.5625')" -#: ../../library/statistics.rst:149 +#: ../../library/statistics.rst:151 msgid "" "The mean is strongly affected by `outliers `_ and is not necessarily a typical example of the data points. For " @@ -351,7 +369,7 @@ msgstr "" "低的\\ `集中趨勢 (central tendency) `_ 度量,請參考 :func:`median`。" -#: ../../library/statistics.rst:155 +#: ../../library/statistics.rst:157 msgid "" "The sample mean gives an unbiased estimate of the true population mean, so " "that when taken on average over all the possible samples, ``mean(sample)`` " @@ -364,11 +382,11 @@ msgstr "" "*data* 為整個母體而非單一樣本,則 ``mean(data)`` 等同於計算真實的母體平均數 " "μ。" -#: ../../library/statistics.rst:164 +#: ../../library/statistics.rst:166 msgid "Convert *data* to floats and compute the arithmetic mean." msgstr "將 *data* 轉換為浮點數並計算其算數平均數。" -#: ../../library/statistics.rst:166 +#: ../../library/statistics.rst:168 msgid "" "This runs faster than the :func:`mean` function and it always returns a :" "class:`float`. The *data* may be a sequence or iterable. If the input " @@ -378,7 +396,7 @@ msgstr "" "可以是一個 sequence 或者 iterable。如果輸入的資料為空,則引發 :exc:" "`StatisticsError`。" -#: ../../library/statistics.rst:170 +#: ../../library/statistics.rst:172 msgid "" ">>> fmean([3.5, 4.0, 5.25])\n" "4.25" @@ -386,7 +404,7 @@ msgstr "" ">>> fmean([3.5, 4.0, 5.25])\n" "4.25" -#: ../../library/statistics.rst:175 +#: ../../library/statistics.rst:177 msgid "" "Optional weighting is supported. For example, a professor assigns a grade " "for a course by weighting quizzes at 20%, homework at 20%, a midterm exam at " @@ -395,7 +413,7 @@ msgstr "" "支援選擇性的加權。例如,一位教授以 20% 的比重計算小考分數,20% 的比重計算作業" "分數,30% 的比重計算期中考試分數,以及 30% 的比重計算期末考試分數:" -#: ../../library/statistics.rst:179 +#: ../../library/statistics.rst:181 msgid "" ">>> grades = [85, 92, 83, 91]\n" ">>> weights = [0.20, 0.20, 0.30, 0.30]\n" @@ -407,7 +425,7 @@ msgstr "" ">>> fmean(grades, weights)\n" "87.6" -#: ../../library/statistics.rst:186 +#: ../../library/statistics.rst:188 msgid "" "If *weights* is supplied, it must be the same length as the *data* or a :exc:" "`ValueError` will be raised." @@ -415,15 +433,15 @@ msgstr "" "如果有提供 *weights*,它必須與 *data* 長度相同,否則將引發 :exc:" "`ValueError`。" -#: ../../library/statistics.rst:191 ../../library/statistics.rst:259 +#: ../../library/statistics.rst:193 ../../library/statistics.rst:261 msgid "Added support for *weights*." msgstr "新增 *weights* 的支援。" -#: ../../library/statistics.rst:197 +#: ../../library/statistics.rst:199 msgid "Convert *data* to floats and compute the geometric mean." msgstr "將 *data* 轉換成浮點數並計算其幾何平均數。" -#: ../../library/statistics.rst:199 +#: ../../library/statistics.rst:201 msgid "" "The geometric mean indicates the central tendency or typical value of the " "*data* using the product of the values (as opposed to the arithmetic mean " @@ -432,7 +450,7 @@ msgstr "" "幾何平均數使用數值的乘積(與之對照,算數平均數使用的是數值的和)來表示 " "*data* 的集中趨勢或典型值。" -#: ../../library/statistics.rst:203 +#: ../../library/statistics.rst:205 msgid "" "Raises a :exc:`StatisticsError` if the input dataset is empty, if it " "contains a zero, or if it contains a negative value. The *data* may be a " @@ -441,19 +459,19 @@ msgstr "" "若輸入的資料集為空、包含零、包含負值,則引發 :exc:`StatisticsError`。*data* " "可為 sequence 或者 iterable。" -#: ../../library/statistics.rst:207 +#: ../../library/statistics.rst:209 msgid "" "No special efforts are made to achieve exact results. (However, this may " "change in the future.)" msgstr "目前沒有特別為了精確結果而特別多下什麼工夫。(然而,未來或許會有。)" -#: ../../library/statistics.rst:210 +#: ../../library/statistics.rst:212 msgid "" ">>> round(geometric_mean([54, 24, 36]), 1)\n" "36.0" msgstr "" -#: ../../library/statistics.rst:220 +#: ../../library/statistics.rst:222 msgid "" "Return the harmonic mean of *data*, a sequence or iterable of real-valued " "numbers. If *weights* is omitted or ``None``, then equal weighting is " @@ -462,7 +480,7 @@ msgstr "" "回傳 *data* 的調和平均數。*data* 可為實數 (real-valued) sequence 或者 " "iterable。如果省略 *weights* 或者 *weights* 為 ``None``,則假設各權重相等。" -#: ../../library/statistics.rst:224 +#: ../../library/statistics.rst:226 msgid "" "The harmonic mean is the reciprocal of the arithmetic :func:`mean` of the " "reciprocals of the data. For example, the harmonic mean of three values *a*, " @@ -473,7 +491,7 @@ msgstr "" "三個數 *a*,*b* 與 *c* 的調和平均數等於 ``3/(1/a + 1/b + 1/c)``。若其中一個值" "為零,結果將為零。" -#: ../../library/statistics.rst:229 +#: ../../library/statistics.rst:231 msgid "" "The harmonic mean is a type of average, a measure of the central location of " "the data. It is often appropriate when averaging ratios or rates, for " @@ -482,7 +500,7 @@ msgstr "" "調和平均數是一種平均數,是衡量資料中心位置的一種方法。它通常用於計算比率 " "(ratio) 或率 (rate) 的平均,例如速率(speed)。" -#: ../../library/statistics.rst:233 +#: ../../library/statistics.rst:235 msgid "" "Suppose a car travels 10 km at 40 km/hr, then another 10 km at 60 km/hr. " "What is the average speed?" @@ -490,7 +508,7 @@ msgstr "" "假設一輛汽車以時速 40 公里的速率行駛 10 公里,然後再以時速 60 公里的速率行駛 " "10 公里,求汽車的平均速率?" -#: ../../library/statistics.rst:236 +#: ../../library/statistics.rst:238 msgid "" ">>> harmonic_mean([40, 60])\n" "48.0" @@ -498,7 +516,7 @@ msgstr "" ">>> harmonic_mean([40, 60])\n" "48.0" -#: ../../library/statistics.rst:241 +#: ../../library/statistics.rst:243 msgid "" "Suppose a car travels 40 km/hr for 5 km, and when traffic clears, speeds-up " "to 60 km/hr for the remaining 30 km of the journey. What is the average " @@ -507,7 +525,7 @@ msgstr "" "假設一輛汽車以時速 40 公里的速率行駛 5 公里,然後在交通順暢時,加速到時速 60 " "公里,以此速度行駛剩下的 30 公里。求汽車的平均速率?" -#: ../../library/statistics.rst:245 +#: ../../library/statistics.rst:247 msgid "" ">>> harmonic_mean([40, 60], weights=[5, 30])\n" "56.0" @@ -515,7 +533,7 @@ msgstr "" ">>> harmonic_mean([40, 60], weights=[5, 30])\n" "56.0" -#: ../../library/statistics.rst:250 +#: ../../library/statistics.rst:252 msgid "" ":exc:`StatisticsError` is raised if *data* is empty, any element is less " "than zero, or if the weighted sum isn't positive." @@ -523,7 +541,7 @@ msgstr "" "若 *data* 為空、含有任何小於零的元素、或者加權總和不為正數,則引發 :exc:" "`StatisticsError`。" -#: ../../library/statistics.rst:253 +#: ../../library/statistics.rst:255 msgid "" "The current algorithm has an early-out when it encounters a zero in the " "input. This means that the subsequent inputs are not tested for validity. " @@ -532,7 +550,113 @@ msgstr "" "目前的演算法設計為,若在輸入當中遇到零,則會提前退出。這意味著後續的輸入並未" "進行有效性檢查。(這種行為在未來可能會改變。)" -#: ../../library/statistics.rst:264 +#: ../../library/statistics.rst:267 +msgid "" +"`Kernel Density Estimation (KDE) `_: Create a continuous " +"probability density function or cumulative distribution function from " +"discrete samples." +msgstr "" + +#: ../../library/statistics.rst:272 +msgid "" +"The basic idea is to smooth the data using `a kernel function `_. to help draw inferences about a " +"population from a sample." +msgstr "" + +#: ../../library/statistics.rst:276 +msgid "" +"The degree of smoothing is controlled by the scaling parameter *h* which is " +"called the bandwidth. Smaller values emphasize local features while larger " +"values give smoother results." +msgstr "" + +#: ../../library/statistics.rst:280 +msgid "" +"The *kernel* determines the relative weights of the sample data points. " +"Generally, the choice of kernel shape does not matter as much as the more " +"influential bandwidth smoothing parameter." +msgstr "" + +#: ../../library/statistics.rst:284 +msgid "" +"Kernels that give some weight to every sample point include *normal* " +"(*gauss*), *logistic*, and *sigmoid*." +msgstr "" + +#: ../../library/statistics.rst:287 +msgid "" +"Kernels that only give weight to sample points within the bandwidth include " +"*rectangular* (*uniform*), *triangular*, *parabolic* (*epanechnikov*), " +"*quartic* (*biweight*), *triweight*, and *cosine*." +msgstr "" + +#: ../../library/statistics.rst:291 +msgid "" +"If *cumulative* is true, will return a cumulative distribution function." +msgstr "" + +#: ../../library/statistics.rst:293 ../../library/statistics.rst:324 +#, fuzzy +msgid "" +"A :exc:`StatisticsError` will be raised if the *data* sequence is empty." +msgstr "若 *data* 為空,則引發 :exc:`StatisticsError`。" + +#: ../../library/statistics.rst:295 +#, fuzzy +msgid "" +"`Wikipedia has an example `_ where we can use :func:`kde` to " +"generate and plot a probability density function estimated from a small " +"sample:" +msgstr "" +"`維基百科有一個範例 `_,我們可以使用 ``kde_normal()`` 這個錦囊" +"妙計來生成並繪製從小樣本估計的機率密度函式:" + +#: ../../library/statistics.rst:300 +#, fuzzy +msgid "" +">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" +">>> f_hat = kde(sample, h=1.5)\n" +">>> xarr = [i/100 for i in range(-750, 1100)]\n" +">>> yarr = [f_hat(x) for x in xarr]" +msgstr "" +">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" +">>> pdf, cdf, rand = kde_normal(sample, h=1.5)\n" +">>> xarr = [i/100 for i in range(-750, 1100)]\n" +">>> yarr = [pdf(x) for x in xarr]" + +#: ../../library/statistics.rst:307 +msgid "The points in ``xarr`` and ``yarr`` can be used to make a PDF plot:" +msgstr "``xarr`` 和 ``yarr`` 中的點可用於繪製 PDF 圖:" + +#: ../../library/statistics.rst:309 +msgid "Scatter plot of the estimated probability density function." +msgstr "估計機率密度函式的散點圖 (scatter plot)。" + +#: ../../library/statistics.rst:317 +msgid "" +"Return a function that makes a random selection from the estimated " +"probability density function produced by ``kde(data, h, kernel)``." +msgstr "" + +#: ../../library/statistics.rst:320 +msgid "" +"Providing a *seed* allows reproducible selections. In the future, the values " +"may change slightly as more accurate kernel inverse CDF estimates are " +"implemented. The seed may be an integer, float, str, or bytes." +msgstr "" + +#: ../../library/statistics.rst:326 +msgid "" +"Continuing the example for :func:`kde`, we can use :func:`kde_random` to " +"generate new random selections from an estimated probability density " +"function:" +msgstr "" + +#: ../../library/statistics.rst:341 msgid "" "Return the median (middle value) of numeric data, using the common \"mean of " "middle two\" method. If *data* is empty, :exc:`StatisticsError` is raised. " @@ -541,7 +665,7 @@ msgstr "" "使用常見的「中間兩數取平均」方法回傳數值資料的中位數 (中間值)。若 *data* 為" "空,則會引發 :exc:`StatisticsError`。*data* 可為一個 sequence 或者 iterable。" -#: ../../library/statistics.rst:268 +#: ../../library/statistics.rst:345 msgid "" "The median is a robust measure of central location and is less affected by " "the presence of outliers. When the number of data points is odd, the middle " @@ -550,7 +674,7 @@ msgstr "" "中位數是一種穩健的衡量資料中心位置的方法,較不易被離群值影響。當資料點數量為" "奇數時,會回傳中間的資料點:" -#: ../../library/statistics.rst:272 +#: ../../library/statistics.rst:349 msgid "" ">>> median([1, 3, 5])\n" "3" @@ -558,13 +682,13 @@ msgstr "" ">>> median([1, 3, 5])\n" "3" -#: ../../library/statistics.rst:277 +#: ../../library/statistics.rst:354 msgid "" "When the number of data points is even, the median is interpolated by taking " "the average of the two middle values:" msgstr "當資料點數量為偶數時,中位數透過中間兩個值的平均數來插值計算:" -#: ../../library/statistics.rst:280 +#: ../../library/statistics.rst:357 msgid "" ">>> median([1, 3, 5, 7])\n" "4.0" @@ -572,7 +696,7 @@ msgstr "" ">>> median([1, 3, 5, 7])\n" "4.0" -#: ../../library/statistics.rst:285 +#: ../../library/statistics.rst:362 msgid "" "This is suited for when your data is discrete, and you don't mind that the " "median may not be an actual data point." @@ -580,7 +704,7 @@ msgstr "" "若你的資料為離散資料,並且你不介意中位數可能並非真實的資料點,那這函式適合" "你。" -#: ../../library/statistics.rst:288 +#: ../../library/statistics.rst:365 msgid "" "If the data is ordinal (supports order operations) but not numeric (doesn't " "support addition), consider using :func:`median_low` or :func:`median_high` " @@ -589,7 +713,7 @@ msgstr "" "若你的資料為順序 (ordinal) 資料(支援排序操作)但並非數值型(不支援加法),可" "以考慮改用 :func:`median_low` 或是 :func:`median_high` 代替。" -#: ../../library/statistics.rst:294 +#: ../../library/statistics.rst:371 msgid "" "Return the low median of numeric data. If *data* is empty, :exc:" "`StatisticsError` is raised. *data* can be a sequence or iterable." @@ -597,7 +721,7 @@ msgstr "" "回傳數值型資料的低中位數 (low median)。若 *data* 為空,則引發 :exc:" "`StatisticsError`。*data* 可為 sequence 或者 iterable。" -#: ../../library/statistics.rst:297 +#: ../../library/statistics.rst:374 msgid "" "The low median is always a member of the data set. When the number of data " "points is odd, the middle value is returned. When it is even, the smaller " @@ -606,7 +730,7 @@ msgstr "" "低中位數一定會在原本的資料集當中。當資料點數量為奇數時,回傳中間值。當數量為" "偶數時,回傳兩個中間值當中較小的值。" -#: ../../library/statistics.rst:301 +#: ../../library/statistics.rst:378 msgid "" ">>> median_low([1, 3, 5])\n" "3\n" @@ -618,7 +742,7 @@ msgstr "" ">>> median_low([1, 3, 5, 7])\n" "3" -#: ../../library/statistics.rst:308 +#: ../../library/statistics.rst:385 msgid "" "Use the low median when your data are discrete and you prefer the median to " "be an actual data point rather than interpolated." @@ -626,7 +750,7 @@ msgstr "" "當你的資料為離散資料,且你希望中位數是實際的資料點而不是插值時,可以用低中位" "數。" -#: ../../library/statistics.rst:314 +#: ../../library/statistics.rst:391 msgid "" "Return the high median of data. If *data* is empty, :exc:`StatisticsError` " "is raised. *data* can be a sequence or iterable." @@ -634,7 +758,7 @@ msgstr "" "回傳數值型資料的高中位數 (high median)。若 *data* 為空,則引發 :exc:" "`StatisticsError`。*data* 可為 sequence 或者 iterable。" -#: ../../library/statistics.rst:317 +#: ../../library/statistics.rst:394 msgid "" "The high median is always a member of the data set. When the number of data " "points is odd, the middle value is returned. When it is even, the larger of " @@ -643,7 +767,7 @@ msgstr "" "高中位數一定會在原本的資料集當中。當資料點數量為奇數時,回傳中間值。當數量為" "偶數時,回傳兩個中間值當中較大的值。" -#: ../../library/statistics.rst:321 +#: ../../library/statistics.rst:398 msgid "" ">>> median_high([1, 3, 5])\n" "3\n" @@ -655,7 +779,7 @@ msgstr "" ">>> median_high([1, 3, 5, 7])\n" "5" -#: ../../library/statistics.rst:328 +#: ../../library/statistics.rst:405 msgid "" "Use the high median when your data are discrete and you prefer the median to " "be an actual data point rather than interpolated." @@ -663,31 +787,31 @@ msgstr "" "當你的資料為離散資料,且你希望中位數是實際的資料點而不是插值時,可以用高中位" "數。" -#: ../../library/statistics.rst:334 +#: ../../library/statistics.rst:411 msgid "" "Estimates the median for numeric data that has been `grouped or binned " "`_ around the midpoints of " "consecutive, fixed-width intervals." msgstr "" -#: ../../library/statistics.rst:338 +#: ../../library/statistics.rst:415 msgid "" "The *data* can be any iterable of numeric data with each value being exactly " "the midpoint of a bin. At least one value must be present." msgstr "" -#: ../../library/statistics.rst:341 +#: ../../library/statistics.rst:418 msgid "The *interval* is the width of each bin." msgstr "" -#: ../../library/statistics.rst:343 +#: ../../library/statistics.rst:420 msgid "" "For example, demographic information may have been summarized into " "consecutive ten-year age groups with each group being represented by the 5-" "year midpoints of the intervals:" msgstr "" -#: ../../library/statistics.rst:347 +#: ../../library/statistics.rst:424 msgid "" ">>> from collections import Counter\n" ">>> demographics = Counter({\n" @@ -709,13 +833,13 @@ msgstr "" "... })\n" "..." -#: ../../library/statistics.rst:359 +#: ../../library/statistics.rst:436 msgid "" "The 50th percentile (median) is the 536th person out of the 1071 member " "cohort. That person is in the 30 to 40 year old age group." msgstr "" -#: ../../library/statistics.rst:362 +#: ../../library/statistics.rst:439 msgid "" "The regular :func:`median` function would assume that everyone in the " "tricenarian age group was exactly 35 years old. A more tenable assumption " @@ -723,7 +847,7 @@ msgid "" "and 40. For that, we use :func:`median_grouped`:" msgstr "" -#: ../../library/statistics.rst:368 +#: ../../library/statistics.rst:445 msgid "" ">>> data = list(demographics.elements())\n" ">>> median(data)\n" @@ -737,20 +861,20 @@ msgstr "" ">>> round(median_grouped(data, interval=10), 1)\n" "37.5" -#: ../../library/statistics.rst:376 +#: ../../library/statistics.rst:453 msgid "" "The caller is responsible for making sure the data points are separated by " "exact multiples of *interval*. This is essential for getting a correct " "result. The function does not check this precondition." msgstr "" -#: ../../library/statistics.rst:380 +#: ../../library/statistics.rst:457 msgid "" "Inputs may be any numeric type that can be coerced to a float during the " "interpolation step." msgstr "" -#: ../../library/statistics.rst:386 +#: ../../library/statistics.rst:463 msgid "" "Return the single most common data point from discrete or nominal *data*. " "The mode (when it exists) is the most typical value and serves as a measure " @@ -759,7 +883,7 @@ msgstr "" "回傳離散或名目 *data* 中出現次數最多次的值,只回傳一個。眾數(如果存在)是最" "典型的值,並用來衡量資料的中心位置。" -#: ../../library/statistics.rst:390 +#: ../../library/statistics.rst:467 msgid "" "If there are multiple modes with the same frequency, returns the first one " "encountered in the *data*. If the smallest or largest of those is desired " @@ -771,14 +895,14 @@ msgstr "" "``max(multimode(data))``。如果輸入的 *data* 為空,則會引發 :exc:" "`StatisticsError`。" -#: ../../library/statistics.rst:395 +#: ../../library/statistics.rst:472 msgid "" "``mode`` assumes discrete data and returns a single value. This is the " "standard treatment of the mode as commonly taught in schools:" msgstr "" "``mode`` 假定為離散資料,並回傳單一的值。這也是一般學校教授的標準眾數定義:" -#: ../../library/statistics.rst:398 +#: ../../library/statistics.rst:475 msgid "" ">>> mode([1, 1, 2, 3, 3, 3, 3, 4])\n" "3" @@ -786,13 +910,13 @@ msgstr "" ">>> mode([1, 1, 2, 3, 3, 3, 3, 4])\n" "3" -#: ../../library/statistics.rst:403 +#: ../../library/statistics.rst:480 msgid "" "The mode is unique in that it is the only statistic in this package that " "also applies to nominal (non-numeric) data:" msgstr "眾數特別之處在於它是此套件中唯一也適用於名目(非數值型)資料的統計量:" -#: ../../library/statistics.rst:406 +#: ../../library/statistics.rst:483 msgid "" ">>> mode([\"red\", \"blue\", \"blue\", \"red\", \"green\", \"red\", " "\"red\"])\n" @@ -802,7 +926,7 @@ msgstr "" "\"red\"])\n" "'red'" -#: ../../library/statistics.rst:411 +#: ../../library/statistics.rst:488 msgid "" "Only hashable inputs are supported. To handle type :class:`set`, consider " "casting to :class:`frozenset`. To handle type :class:`list`, consider " @@ -811,7 +935,7 @@ msgid "" "key=data.count)``." msgstr "" -#: ../../library/statistics.rst:417 +#: ../../library/statistics.rst:494 msgid "" "Now handles multimodal datasets by returning the first mode encountered. " "Formerly, it raised :exc:`StatisticsError` when more than one mode was found." @@ -819,7 +943,7 @@ msgstr "" "現在,遇到資料中有多個眾數時,會回傳第一個遇到的眾數。在以前,當找到大於一個" "眾數時,會引發 :exc:`StatisticsError`。" -#: ../../library/statistics.rst:425 +#: ../../library/statistics.rst:502 msgid "" "Return a list of the most frequently occurring values in the order they were " "first encountered in the *data*. Will return more than one result if there " @@ -829,7 +953,7 @@ msgstr "" "次出現的順序排列。如果有多個眾數,將會回傳所有結果。若 *data* 為空,則回傳空" "的 list:" -#: ../../library/statistics.rst:429 +#: ../../library/statistics.rst:506 msgid "" ">>> multimode('aabbbbccddddeeffffgg')\n" "['b', 'd', 'f']\n" @@ -841,7 +965,7 @@ msgstr "" ">>> multimode('')\n" "[]" -#: ../../library/statistics.rst:441 +#: ../../library/statistics.rst:518 msgid "" "Return the population standard deviation (the square root of the population " "variance). See :func:`pvariance` for arguments and other details." @@ -849,7 +973,7 @@ msgstr "" "回傳母體標準差(即母體變異數的平方根)。有關引數以及其他細節,請參見 :func:" "`pvariance`。" -#: ../../library/statistics.rst:444 +#: ../../library/statistics.rst:521 msgid "" ">>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])\n" "0.986893273527251" @@ -857,7 +981,7 @@ msgstr "" ">>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])\n" "0.986893273527251" -#: ../../library/statistics.rst:452 +#: ../../library/statistics.rst:529 msgid "" "Return the population variance of *data*, a non-empty sequence or iterable " "of real-valued numbers. Variance, or second moment about the mean, is a " @@ -869,7 +993,7 @@ msgstr "" "數,或者以平均數為中心的二階動差,用於衡量資料的變異性(離度或分散程度)。變" "異數大表示資料分散,變異數小表示資料集中在平均數附近。" -#: ../../library/statistics.rst:458 +#: ../../library/statistics.rst:535 msgid "" "If the optional second argument *mu* is given, it should be the *population* " "mean of the *data*. It can also be used to compute the second moment around " @@ -880,7 +1004,7 @@ msgstr "" "(population mean)。它也可以用於計算非以平均值為中心的第二動差。如果沒有傳入此" "引數或者引數為 ``None`` (預設值),則自動計算資料的算數平均數。" -#: ../../library/statistics.rst:463 +#: ../../library/statistics.rst:540 msgid "" "Use this function to calculate the variance from the entire population. To " "estimate the variance from a sample, the :func:`variance` function is " @@ -889,16 +1013,16 @@ msgstr "" "使用此函式來計算整個母體的變異數。如果要從樣本估算變異數,:func:`variance` 通" "常是較好的選擇。" -#: ../../library/statistics.rst:467 +#: ../../library/statistics.rst:544 msgid "Raises :exc:`StatisticsError` if *data* is empty." msgstr "若 *data* 為空,則引發 :exc:`StatisticsError`。" -#: ../../library/statistics.rst:469 ../../library/statistics.rst:539 -#: ../../library/statistics.rst:643 +#: ../../library/statistics.rst:546 ../../library/statistics.rst:616 +#: ../../library/statistics.rst:725 msgid "Examples:" msgstr "範例:" -#: ../../library/statistics.rst:471 +#: ../../library/statistics.rst:548 msgid "" ">>> data = [0.0, 0.25, 0.25, 1.25, 1.5, 1.75, 2.75, 3.25]\n" ">>> pvariance(data)\n" @@ -908,7 +1032,7 @@ msgstr "" ">>> pvariance(data)\n" "1.25" -#: ../../library/statistics.rst:477 +#: ../../library/statistics.rst:554 msgid "" "If you have already calculated the mean of your data, you can pass it as the " "optional second argument *mu* to avoid recalculation:" @@ -916,7 +1040,7 @@ msgstr "" "如果已經計算出資料的平均值,你可以將其作為選擇性的第二個引數 *mu* 傳遞以避免" "重新計算:" -#: ../../library/statistics.rst:480 +#: ../../library/statistics.rst:557 msgid "" ">>> mu = mean(data)\n" ">>> pvariance(data, mu)\n" @@ -926,11 +1050,11 @@ msgstr "" ">>> pvariance(data, mu)\n" "1.25" -#: ../../library/statistics.rst:486 +#: ../../library/statistics.rst:563 msgid "Decimals and Fractions are supported:" msgstr "支援小數 (decimal) 與分數 (fraction):" -#: ../../library/statistics.rst:488 +#: ../../library/statistics.rst:565 msgid "" ">>> from decimal import Decimal as D\n" ">>> pvariance([D(\"27.5\"), D(\"30.25\"), D(\"30.25\"), D(\"34.5\"), " @@ -950,7 +1074,7 @@ msgstr "" ">>> pvariance([F(1, 4), F(5, 4), F(1, 2)])\n" "Fraction(13, 72)" -#: ../../library/statistics.rst:500 +#: ../../library/statistics.rst:577 msgid "" "When called with the entire population, this gives the population variance " "σ². When called on a sample instead, this is the biased sample variance s², " @@ -959,7 +1083,7 @@ msgstr "" "當在整個母體上呼叫此函式時,會回傳母體變異數 σ²。當在樣本上呼叫此函式時,會回" "傳有偏差的樣本變異數 s²,也就是具有 N 個自由度的變異數。" -#: ../../library/statistics.rst:504 +#: ../../library/statistics.rst:581 msgid "" "If you somehow know the true population mean μ, you may use this function to " "calculate the variance of a sample, giving the known population mean as the " @@ -971,7 +1095,7 @@ msgstr "" "引數提供給此函式,用以計算樣本的變異數。只要資料點是母體的隨機樣本,結果將是" "母體變異數的不偏估計。" -#: ../../library/statistics.rst:513 +#: ../../library/statistics.rst:590 msgid "" "Return the sample standard deviation (the square root of the sample " "variance). See :func:`variance` for arguments and other details." @@ -979,7 +1103,7 @@ msgstr "" "回傳樣本標準差(即樣本變異數的平方根)。有關引數以及其他細節,請參見 :func:" "`variance`。" -#: ../../library/statistics.rst:516 +#: ../../library/statistics.rst:593 msgid "" ">>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])\n" "1.0810874155219827" @@ -987,7 +1111,7 @@ msgstr "" ">>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])\n" "1.0810874155219827" -#: ../../library/statistics.rst:524 +#: ../../library/statistics.rst:601 msgid "" "Return the sample variance of *data*, an iterable of at least two real-" "valued numbers. Variance, or second moment about the mean, is a measure of " @@ -999,7 +1123,7 @@ msgstr "" "平均數為中心的二階動差,用於衡量資料的變異性(離度或分散程度)。變異數大表示" "資料分散,變異數小表示資料集中在平均數附近。" -#: ../../library/statistics.rst:530 +#: ../../library/statistics.rst:607 msgid "" "If the optional second argument *xbar* is given, it should be the *sample* " "mean of *data*. If it is missing or ``None`` (the default), the mean is " @@ -1009,7 +1133,7 @@ msgstr "" "(sample mean)。如果沒有傳入或者為 ``None`` (預設值),則自動計算資料的平均" "值。" -#: ../../library/statistics.rst:534 +#: ../../library/statistics.rst:611 msgid "" "Use this function when your data is a sample from a population. To calculate " "the variance from the entire population, see :func:`pvariance`." @@ -1017,11 +1141,11 @@ msgstr "" "當你的資料是來自母體的樣本時,請使用此函式。若要從整個母體計算變異數,請參" "見 :func:`pvariance`。" -#: ../../library/statistics.rst:537 +#: ../../library/statistics.rst:614 msgid "Raises :exc:`StatisticsError` if *data* has fewer than two values." msgstr "若 *data* 內少於兩個值,則引發 :exc:`StatisticsError`。" -#: ../../library/statistics.rst:541 +#: ../../library/statistics.rst:618 msgid "" ">>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]\n" ">>> variance(data)\n" @@ -1031,7 +1155,7 @@ msgstr "" ">>> variance(data)\n" "1.3720238095238095" -#: ../../library/statistics.rst:547 +#: ../../library/statistics.rst:624 msgid "" "If you have already calculated the sample mean of your data, you can pass it " "as the optional second argument *xbar* to avoid recalculation:" @@ -1039,7 +1163,7 @@ msgstr "" "如果已經計算出資料的樣本平均值,你可以將其作為選擇性的第二個引數 *mu* 傳遞以" "避免重新計算:" -#: ../../library/statistics.rst:550 +#: ../../library/statistics.rst:627 msgid "" ">>> m = mean(data)\n" ">>> variance(data, m)\n" @@ -1049,7 +1173,7 @@ msgstr "" ">>> variance(data, m)\n" "1.3720238095238095" -#: ../../library/statistics.rst:556 +#: ../../library/statistics.rst:633 msgid "" "This function does not attempt to verify that you have passed the actual " "mean as *xbar*. Using arbitrary values for *xbar* can lead to invalid or " @@ -1058,11 +1182,11 @@ msgstr "" "此函式不會驗證你傳入的 *xbar* 是否為實際的平均數。傳入任意的 *xbar* 會導致無" "效或不可能的結果。" -#: ../../library/statistics.rst:560 +#: ../../library/statistics.rst:637 msgid "Decimal and Fraction values are supported:" msgstr "支援小數 (decimal) 與分數 (fraction):" -#: ../../library/statistics.rst:562 +#: ../../library/statistics.rst:639 msgid "" ">>> from decimal import Decimal as D\n" ">>> variance([D(\"27.5\"), D(\"30.25\"), D(\"30.25\"), D(\"34.5\"), " @@ -1082,7 +1206,7 @@ msgstr "" ">>> variance([F(1, 6), F(1, 2), F(5, 3)])\n" "Fraction(67, 108)" -#: ../../library/statistics.rst:574 +#: ../../library/statistics.rst:651 msgid "" "This is the sample variance s² with Bessel's correction, also known as " "variance with N-1 degrees of freedom. Provided that the data points are " @@ -1093,7 +1217,7 @@ msgstr "" "為 N-1 的變異數。只要資料點具有代表性(例如:獨立且具有相同分布),結果應該會" "是對真實母體變異數的不偏估計。" -#: ../../library/statistics.rst:579 +#: ../../library/statistics.rst:656 msgid "" "If you somehow know the actual population mean μ you should pass it to the :" "func:`pvariance` function as the *mu* parameter to get the variance of a " @@ -1102,7 +1226,7 @@ msgstr "" "若你剛好知道真正的母體平均數 μ,你應該將其作為 *mu* 參數傳入 :func:" "`pvariance` 函式來計算樣本變異數。" -#: ../../library/statistics.rst:585 +#: ../../library/statistics.rst:662 msgid "" "Divide *data* into *n* continuous intervals with equal probability. Returns " "a list of ``n - 1`` cut points separating the intervals." @@ -1110,7 +1234,7 @@ msgstr "" "將 *data* 分成 *n* 個具有相等機率的連續區間。回傳一個包含 ``n - 1`` 個用於切" "分各區間的分隔點的 list。" -#: ../../library/statistics.rst:588 +#: ../../library/statistics.rst:665 msgid "" "Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set " "*n* to 100 for percentiles which gives the 99 cuts points that separate " @@ -1121,16 +1245,17 @@ msgstr "" "分位數 (percentile),這將給出 99 個分隔點將 *data* 分成 100 個大小相等的組。" "如果 *n* 不是至少為 1,則引發 :exc:`StatisticsError`。" -#: ../../library/statistics.rst:593 +#: ../../library/statistics.rst:670 +#, fuzzy msgid "" "The *data* can be any iterable containing sample data. For meaningful " "results, the number of data points in *data* should be larger than *n*. " -"Raises :exc:`StatisticsError` if there are not at least two data points." +"Raises :exc:`StatisticsError` if there is not at least one data point." msgstr "" "*data* 可以是包含樣本資料的任何 iterable。為了取得有意義的結果,*data* 中的資" "料點數量應大於 *n*。如果資料點少於兩個,則引發 :exc:`StatisticsError`。" -#: ../../library/statistics.rst:597 +#: ../../library/statistics.rst:674 msgid "" "The cut points are linearly interpolated from the two nearest data points. " "For example, if a cut point falls one-third of the distance between two " @@ -1139,7 +1264,7 @@ msgstr "" "分隔點是從兩個最近的資料點線性內插值計算出來的。舉例來說,如果分隔點落在兩個" "樣本值 ``100`` 與 ``112`` 之間的距離三分之一處,則分隔點的值將為 ``104``。" -#: ../../library/statistics.rst:602 +#: ../../library/statistics.rst:679 msgid "" "The *method* for computing quantiles can be varied depending on whether the " "*data* includes or excludes the lowest and highest possible values from the " @@ -1148,7 +1273,7 @@ msgstr "" "計算分位數的 *method* 可以根據 *data* 是否包含或排除來自母體的最小與最大可能" "的值而改變。" -#: ../../library/statistics.rst:606 +#: ../../library/statistics.rst:683 msgid "" "The default *method* is \"exclusive\" and is used for data sampled from a " "population that can have more extreme values than found in the samples. The " @@ -1162,7 +1287,7 @@ msgstr "" "1)``。給定九個樣本資料,此方法將對資料排序且計算下列百分位數:10%、20%、30%、" "40%、50%、60%、70%、80%、90%。" -#: ../../library/statistics.rst:613 +#: ../../library/statistics.rst:690 msgid "" "Setting the *method* to \"inclusive\" is used for describing population data " "or for samples that are known to include the most extreme values from the " @@ -1179,7 +1304,7 @@ msgstr "" "給定十一個個樣本資料,此方法將對資料排序且計算下列百分位數:0%、10%、20%、" "30%、40%、50%、60%、70%、80%、90%、100%。" -#: ../../library/statistics.rst:622 +#: ../../library/statistics.rst:699 msgid "" "# Decile cut points for empirically sampled data\n" ">>> data = [105, 129, 87, 86, 111, 111, 89, 81, 108, 92, 110,\n" @@ -1191,7 +1316,14 @@ msgid "" "[81.0, 86.2, 89.0, 99.4, 102.5, 103.6, 106.0, 109.8, 111.0]" msgstr "" -#: ../../library/statistics.rst:637 +#: ../../library/statistics.rst:712 +msgid "" +"No longer raises an exception for an input with only a single data point. " +"This allows quantile estimates to be built up one sample point at a time " +"becoming gradually more refined with each new data point." +msgstr "" + +#: ../../library/statistics.rst:719 msgid "" "Return the sample covariance of two inputs *x* and *y*. Covariance is a " "measure of the joint variability of two inputs." @@ -1199,14 +1331,14 @@ msgstr "" "回傳兩輸入 *x* 與 *y* 的樣本共變異數 (sample covariance)。共變異數是衡量兩輸" "入的聯合變異性 (joint variability) 的指標。" -#: ../../library/statistics.rst:640 +#: ../../library/statistics.rst:722 msgid "" "Both inputs must be of the same length (no less than two), otherwise :exc:" "`StatisticsError` is raised." msgstr "" "兩輸入必須具有相同長度(至少兩個),否則會引發 :exc:`StatisticsError`。" -#: ../../library/statistics.rst:645 +#: ../../library/statistics.rst:727 msgid "" ">>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n" ">>> y = [1, 2, 3, 1, 2, 3, 1, 2, 3]\n" @@ -1228,7 +1360,7 @@ msgstr "" ">>> covariance(z, x)\n" "-7.5" -#: ../../library/statistics.rst:661 +#: ../../library/statistics.rst:743 msgid "" "Return the `Pearson's correlation coefficient `_ for two inputs. Pearson's correlation " @@ -1239,7 +1371,7 @@ msgstr "" "en.wikipedia.org/wiki/Pearson_correlation_coefficient>`_。Pearson 相關係數 " "*r* 的值介於 -1 與 +1 之間。它衡量線性關係的強度與方向。" -#: ../../library/statistics.rst:667 +#: ../../library/statistics.rst:749 msgid "" "If *method* is \"ranked\", computes `Spearman's rank correlation coefficient " "`_ " @@ -1253,7 +1385,7 @@ msgstr "" "則取平均,令相同的值排名也相同。所得係數衡量單調關係 (monotonic " "relationship) 的強度。" -#: ../../library/statistics.rst:673 +#: ../../library/statistics.rst:755 msgid "" "Spearman's correlation coefficient is appropriate for ordinal data or for " "continuous data that doesn't meet the linear proportion requirement for " @@ -1262,7 +1394,7 @@ msgstr "" "Spearman 相關係數適用於順序型資料,或者不符合 Pearson 相關係數要求的線性比例" "關係的連續型 (continuous) 資料。" -#: ../../library/statistics.rst:677 +#: ../../library/statistics.rst:759 msgid "" "Both inputs must be of the same length (no less than two), and need not to " "be constant, otherwise :exc:`StatisticsError` is raised." @@ -1270,7 +1402,7 @@ msgstr "" "兩輸入必須具有相同長度(至少兩個),且不須為常數,否則會引發 :exc:" "`StatisticsError`。" -#: ../../library/statistics.rst:680 +#: ../../library/statistics.rst:762 msgid "" "Example with `Kepler's laws of planetary motion `_:" @@ -1278,7 +1410,7 @@ msgstr "" "以 `Kepler 行星運動定律 `_\\ 為例:" -#: ../../library/statistics.rst:683 +#: ../../library/statistics.rst:765 msgid "" ">>> # Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, and Neptune\n" ">>> orbital_period = [88, 225, 365, 687, 4331, 10_756, 30_687, 60_190] # " @@ -1303,11 +1435,11 @@ msgid "" "1.0" msgstr "" -#: ../../library/statistics.rst:707 +#: ../../library/statistics.rst:789 msgid "Added support for Spearman's rank correlation coefficient." msgstr "新增了對 Spearman 等級相關係數的支援。" -#: ../../library/statistics.rst:712 +#: ../../library/statistics.rst:794 msgid "" "Return the slope and intercept of `simple linear regression `_ parameters estimated using " @@ -1321,11 +1453,11 @@ msgstr "" "迴歸描述自變數 (independent variable) *x* 與應變數 (dependent variable) *y* " "之間的關係,用以下的線性函式表示:" -#: ../../library/statistics.rst:718 +#: ../../library/statistics.rst:800 msgid "*y = slope \\* x + intercept + noise*" msgstr "*y = slope \\* x + intercept + noise*" -#: ../../library/statistics.rst:720 +#: ../../library/statistics.rst:802 msgid "" "where ``slope`` and ``intercept`` are the regression parameters that are " "estimated, and ``noise`` represents the variability of the data that was not " @@ -1335,7 +1467,7 @@ msgstr "" "其中 ``slope`` 和 ``intercept`` 是被估計的迴歸參數,而 ``noise`` 表示由線性迴" "歸未解釋的資料變異性(它等於應變數的預測值與實際值之差)。" -#: ../../library/statistics.rst:726 +#: ../../library/statistics.rst:808 msgid "" "Both inputs must be of the same length (no less than two), and the " "independent variable *x* cannot be constant; otherwise a :exc:" @@ -1344,7 +1476,7 @@ msgstr "" "兩輸入必須具有相同長度(至少兩個),且自變數 *x* 不得為常數,否則會引發 :exc:" "`StatisticsError`。" -#: ../../library/statistics.rst:730 +#: ../../library/statistics.rst:812 msgid "" "For example, we can use the `release dates of the Monty Python films " "`_ to predict the " @@ -1355,7 +1487,7 @@ msgstr "" "wikipedia.org/wiki/Monty_Python#Films>`_\\ 來預測至 2019 年為止,假設他們保持" "固定的製作速度,應該會產生的 Monty Python 電影的累計數量。" -#: ../../library/statistics.rst:736 +#: ../../library/statistics.rst:818 msgid "" ">>> year = [1971, 1975, 1979, 1982, 1983]\n" ">>> films_total = [1, 2, 3, 4, 5]\n" @@ -1369,7 +1501,7 @@ msgstr "" ">>> round(slope * 2019 + intercept)\n" "16" -#: ../../library/statistics.rst:744 +#: ../../library/statistics.rst:826 msgid "" "If *proportional* is true, the independent variable *x* and the dependent " "variable *y* are assumed to be directly proportional. The data is fit to a " @@ -1380,11 +1512,11 @@ msgstr "" "資料座落在通過原點的一直線上。由於 *intercept* 始終為 0.0,因此線性函式可簡化" "如下:" -#: ../../library/statistics.rst:750 +#: ../../library/statistics.rst:832 msgid "*y = slope \\* x + noise*" msgstr "*y = slope \\* x + noise*" -#: ../../library/statistics.rst:752 +#: ../../library/statistics.rst:834 msgid "" "Continuing the example from :func:`correlation`, we look to see how well a " "model based on major planets can predict the orbital distances for dwarf " @@ -1393,7 +1525,7 @@ msgstr "" "繼續 :func:`correlation` 中的範例,我們看看基於主要行星的模型可以如何很好地預" "測矮行星的軌道距離:" -#: ../../library/statistics.rst:756 +#: ../../library/statistics.rst:838 msgid "" ">>> model = linear_regression(period_squared, dist_cubed, " "proportional=True)\n" @@ -1409,27 +1541,27 @@ msgid "" "[5906, 10152, 6796, 6450, 414]" msgstr "" -#: ../../library/statistics.rst:772 +#: ../../library/statistics.rst:854 msgid "Added support for *proportional*." msgstr "新增 *proportional* 的支援。" -#: ../../library/statistics.rst:776 +#: ../../library/statistics.rst:858 msgid "Exceptions" msgstr "例外" -#: ../../library/statistics.rst:778 +#: ../../library/statistics.rst:860 msgid "A single exception is defined:" msgstr "定義了一個單一的例外:" -#: ../../library/statistics.rst:782 +#: ../../library/statistics.rst:864 msgid "Subclass of :exc:`ValueError` for statistics-related exceptions." msgstr ":exc:`ValueError` 的子類別,用於和統計相關的例外。" -#: ../../library/statistics.rst:786 +#: ../../library/statistics.rst:868 msgid ":class:`NormalDist` objects" msgstr ":class:`NormalDist` 物件" -#: ../../library/statistics.rst:788 +#: ../../library/statistics.rst:870 msgid "" ":class:`NormalDist` is a tool for creating and manipulating normal " "distributions of a `random variable `_ 的常態分布的工" "具。它是一個將量測資料的平均數與標準差視為單一實體的類別。" -#: ../../library/statistics.rst:794 +#: ../../library/statistics.rst:876 msgid "" "Normal distributions arise from the `Central Limit Theorem `_ and have a wide range of " @@ -1449,7 +1581,7 @@ msgstr "" "常態分布源自於\\ `中央極限定理 (Central Limit Theorem) `_,在統計學中有著廣泛的應用。" -#: ../../library/statistics.rst:800 +#: ../../library/statistics.rst:882 msgid "" "Returns a new *NormalDist* object where *mu* represents the `arithmetic mean " "`_ and *sigma* represents the " @@ -1459,11 +1591,11 @@ msgstr "" "en.wikipedia.org/wiki/Arithmetic_mean>`_\\ 而 *sigma* 代表\\ `標準差 " "`_。" -#: ../../library/statistics.rst:805 +#: ../../library/statistics.rst:887 msgid "If *sigma* is negative, raises :exc:`StatisticsError`." msgstr "若 *sigma* 為負值,則引發 :exc:`StatisticsError`。" -#: ../../library/statistics.rst:809 +#: ../../library/statistics.rst:891 msgid "" "A read-only property for the `arithmetic mean `_ of a normal distribution." @@ -1471,14 +1603,14 @@ msgstr "" "常態分布中的\\ `算數平均數 `_\\ 唯讀屬性。" -#: ../../library/statistics.rst:815 +#: ../../library/statistics.rst:897 msgid "" "A read-only property for the `median `_ of a normal distribution." msgstr "" "常態分布中的\\ `中位數 `_\\ 唯讀屬性。" -#: ../../library/statistics.rst:821 +#: ../../library/statistics.rst:903 msgid "" "A read-only property for the `mode `_ of a normal distribution." @@ -1486,7 +1618,7 @@ msgstr "" "常態分布中的\\ `眾數 `_\\ 唯" "讀屬性。" -#: ../../library/statistics.rst:827 +#: ../../library/statistics.rst:909 msgid "" "A read-only property for the `standard deviation `_ of a normal distribution." @@ -1494,7 +1626,7 @@ msgstr "" "常態分布中的\\ `標準差 `_\\ 唯讀屬性。" -#: ../../library/statistics.rst:833 +#: ../../library/statistics.rst:915 msgid "" "A read-only property for the `variance `_ of a normal distribution. Equal to the square of the standard " @@ -1503,7 +1635,7 @@ msgstr "" "常態分布中的\\ `變異數 `_\\ 唯讀屬" "性。" -#: ../../library/statistics.rst:839 +#: ../../library/statistics.rst:921 msgid "" "Makes a normal distribution instance with *mu* and *sigma* parameters " "estimated from the *data* using :func:`fmean` and :func:`stdev`." @@ -1511,7 +1643,7 @@ msgstr "" "利用 :func:`fmean` 與 :func:`stdev` 函式,估計 *data* 的 *mu* 與 *sigma* 參" "數,建立一個常態分布的實例。" -#: ../../library/statistics.rst:842 +#: ../../library/statistics.rst:924 msgid "" "The *data* can be any :term:`iterable` and should consist of values that can " "be converted to type :class:`float`. If *data* does not contain at least " @@ -1523,7 +1655,7 @@ msgstr "" "若 *data* 沒有包含至少兩個以上的元素在內,則引發 :exc:`StatisticsError`,因為" "至少需要一個點來估計中央值且至少需要兩個點來估計分散情形。" -#: ../../library/statistics.rst:850 +#: ../../library/statistics.rst:932 msgid "" "Generates *n* random samples for a given mean and standard deviation. " "Returns a :class:`list` of :class:`float` values." @@ -1531,7 +1663,7 @@ msgstr "" "給定平均值與標準差,產生 *n* 個隨機樣本。回傳一個由 :class:`float` 組成的 :" "class:`list`。" -#: ../../library/statistics.rst:853 +#: ../../library/statistics.rst:935 msgid "" "If *seed* is given, creates a new instance of the underlying random number " "generator. This is useful for creating reproducible results, even in a " @@ -1540,7 +1672,13 @@ msgstr "" "若有給定 *seed*,則會建立一個以此為基礎的亂數產生器實例。這對於建立可重現的結" "果很有幫助,即使在多執行緒情境下也是如此。" -#: ../../library/statistics.rst:859 +#: ../../library/statistics.rst:941 +msgid "" +"Switched to a faster algorithm. To reproduce samples from previous " +"versions, use :func:`random.seed` and :func:`random.gauss`." +msgstr "" + +#: ../../library/statistics.rst:946 msgid "" "Using a `probability density function (pdf) `_, compute the relative likelihood that a " @@ -1552,7 +1690,7 @@ msgstr "" "值 *x* 的相對概度 (relative likelihood)。數學上,它是比率 ``P(x <= X < " "x+dx) / dx`` 在 *dx* 趨近於零時的極限值。" -#: ../../library/statistics.rst:865 +#: ../../library/statistics.rst:952 msgid "" "The relative likelihood is computed as the probability of a sample occurring " "in a narrow range divided by the width of the range (hence the word " @@ -1562,7 +1700,7 @@ msgstr "" "相對概度是樣本出現在狹窄範圍的機率,除以該範圍的寬度(故稱為「密度」)計算而" "得。由於概度是相對於其它點,故其值可大於 ``1.0``。" -#: ../../library/statistics.rst:872 +#: ../../library/statistics.rst:959 msgid "" "Using a `cumulative distribution function (cdf) `_, compute the probability that a " @@ -1573,7 +1711,7 @@ msgstr "" "wikipedia.org/wiki/Cumulative_distribution_function>`_ 計算隨機變數 *X* 小於" "或等於 *x* 的機率。數學上,它記為 ``P(X <= x)``。" -#: ../../library/statistics.rst:879 +#: ../../library/statistics.rst:966 msgid "" "Compute the inverse cumulative distribution function, also known as the " "`quantile function `_ or " @@ -1587,7 +1725,7 @@ msgstr "" "org/web/20190203145224/https://www.statisticshowto.datasciencecentral.com/" "inverse-distribution-function/>`_ 函式。數學上記為 ``x : P(X <= x) = p``。" -#: ../../library/statistics.rst:885 +#: ../../library/statistics.rst:972 msgid "" "Finds the value *x* of the random variable *X* such that the probability of " "the variable being less than or equal to that value equals the given " @@ -1595,7 +1733,7 @@ msgid "" msgstr "" "找出一個值 *x*,使得隨機變數 *X* 小於或等於該值的機率等於給定的機率 *p*。" -#: ../../library/statistics.rst:891 +#: ../../library/statistics.rst:978 msgid "" "Measures the agreement between two normal probability distributions. Returns " "a value between 0.0 and 1.0 giving `the overlapping area for the two " @@ -1604,7 +1742,7 @@ msgstr "" "衡量兩常態分布之間的一致性。回傳一個介於 0.0 與 1.0 之間的值,表示\\ `兩機率" "密度函式的重疊區域 `_。" -#: ../../library/statistics.rst:898 +#: ../../library/statistics.rst:985 msgid "" "Divide the normal distribution into *n* continuous intervals with equal " "probability. Returns a list of (n - 1) cut points separating the intervals." @@ -1612,7 +1750,7 @@ msgstr "" "將常態分布分割成 *n* 個具有相等機率的連續區間。回傳一個 list,包含 (n-1) 個切" "割區間的分隔點。" -#: ../../library/statistics.rst:902 +#: ../../library/statistics.rst:989 msgid "" "Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set " "*n* to 100 for percentiles which gives the 99 cuts points that separate the " @@ -1622,7 +1760,7 @@ msgstr "" "*n* 設定為 100 表示百分位數,這會產生 99 個分隔點,將常態分布切割成大小相等的" "群組。" -#: ../../library/statistics.rst:908 +#: ../../library/statistics.rst:995 msgid "" "Compute the `Standard Score `_ describing *x* in terms of the number of standard " @@ -1633,7 +1771,7 @@ msgstr "" "probability-and-statistics/z-score/>`_,用以描述在常態分布中,*x* 高出或低於" "平均數幾個標準差:``(x - mean) / stdev``。" -#: ../../library/statistics.rst:916 +#: ../../library/statistics.rst:1003 msgid "" "Instances of :class:`NormalDist` support addition, subtraction, " "multiplication and division by a constant. These operations are used for " @@ -1642,21 +1780,21 @@ msgstr "" ":class:`NormalDist` 的實例支援對常數的加法、減法、乘法與除法。這些操作用於平" "移與縮放。例如:" -#: ../../library/statistics.rst:920 +#: ../../library/statistics.rst:1007 msgid "" ">>> temperature_february = NormalDist(5, 2.5) # Celsius\n" ">>> temperature_february * (9/5) + 32 # Fahrenheit\n" "NormalDist(mu=41.0, sigma=4.5)" msgstr "" -#: ../../library/statistics.rst:926 +#: ../../library/statistics.rst:1013 msgid "" "Dividing a constant by an instance of :class:`NormalDist` is not supported " "because the result wouldn't be normally distributed." msgstr "" "不支援將常數除以 :class:`NormalDist` 的實例,因為結果將不符合常態分布。" -#: ../../library/statistics.rst:929 +#: ../../library/statistics.rst:1016 msgid "" "Since normal distributions arise from additive effects of independent " "variables, it is possible to `add and subtract two independent normally " @@ -1669,7 +1807,7 @@ msgstr "" "Sum_of_normally_distributed_random_variables>`_,並且表示為 :class:" "`NormalDist` 的實例。例如:" -#: ../../library/statistics.rst:935 +#: ../../library/statistics.rst:1022 msgid "" ">>> birth_weights = NormalDist.from_samples([2.5, 3.1, 2.1, 2.4, 2.7, 3.5])\n" ">>> drug_effects = NormalDist(0.4, 0.15)\n" @@ -1687,19 +1825,19 @@ msgstr "" ">>> round(combined.stdev, 1)\n" "0.5" -#: ../../library/statistics.rst:949 +#: ../../library/statistics.rst:1036 msgid "Examples and Recipes" msgstr "範例與錦囊妙計" -#: ../../library/statistics.rst:953 +#: ../../library/statistics.rst:1040 msgid "Classic probability problems" msgstr "經典機率問題" -#: ../../library/statistics.rst:955 +#: ../../library/statistics.rst:1042 msgid ":class:`NormalDist` readily solves classic probability problems." msgstr ":class:`NormalDist` 可以輕易地解決經典的機率問題。" -#: ../../library/statistics.rst:957 +#: ../../library/statistics.rst:1044 msgid "" "For example, given `historical data for SAT exams `_ showing that scores are " @@ -1711,7 +1849,7 @@ msgstr "" "tables/dt17_226.40.asp>`_,顯示成績為平均 1060、標準差 195 的常態分布。我們要" "求出分數在 1100 與 1200 之間(四捨五入至最接近的整數)的學生的百分比:" -#: ../../library/statistics.rst:963 +#: ../../library/statistics.rst:1050 msgid "" ">>> sat = NormalDist(1060, 195)\n" ">>> fraction = sat.cdf(1200 + 0.5) - sat.cdf(1100 - 0.5)\n" @@ -1723,7 +1861,7 @@ msgstr "" ">>> round(fraction * 100.0, 1)\n" "18.4" -#: ../../library/statistics.rst:970 +#: ../../library/statistics.rst:1057 msgid "" "Find the `quartiles `_ and `deciles " "`_ for the SAT scores:" @@ -1731,7 +1869,7 @@ msgstr "" "找出 SAT 分數的\\ `四分位數 `_\\ 以及" "\\ `十分位數 `_:" -#: ../../library/statistics.rst:973 +#: ../../library/statistics.rst:1060 msgid "" ">>> list(map(round, sat.quantiles()))\n" "[928, 1060, 1192]\n" @@ -1743,11 +1881,11 @@ msgstr "" ">>> list(map(round, sat.quantiles(n=10)))\n" "[810, 896, 958, 1011, 1060, 1109, 1162, 1224, 1310]" -#: ../../library/statistics.rst:982 +#: ../../library/statistics.rst:1069 msgid "Monte Carlo inputs for simulations" msgstr "用於模擬的蒙地卡羅 (Monte Carlo) 輸入" -#: ../../library/statistics.rst:984 +#: ../../library/statistics.rst:1071 msgid "" "To estimate the distribution for a model that isn't easy to solve " "analytically, :class:`NormalDist` can generate input samples for a `Monte " @@ -1757,7 +1895,7 @@ msgstr "" "樣本以進行\\ `蒙地卡羅模擬 `_:" -#: ../../library/statistics.rst:988 +#: ../../library/statistics.rst:1075 msgid "" ">>> def model(x, y, z):\n" "... return (3*x + 7*x*y - 5*y) / (11 * z)\n" @@ -1779,11 +1917,11 @@ msgstr "" ">>> quantiles(map(model, X, Y, Z)) \n" "[1.4591308524824727, 1.8035946855390597, 2.175091447274739]" -#: ../../library/statistics.rst:1001 +#: ../../library/statistics.rst:1088 msgid "Approximating binomial distributions" msgstr "近似二項分布" -#: ../../library/statistics.rst:1003 +#: ../../library/statistics.rst:1090 msgid "" "Normal distributions can be used to approximate `Binomial distributions " "`_ when the sample " @@ -1793,7 +1931,7 @@ msgstr "" "(Binomial distributions) `_。" -#: ../../library/statistics.rst:1008 +#: ../../library/statistics.rst:1095 msgid "" "For example, an open source conference has 750 attendees and two rooms with " "a 500 person capacity. There is a talk about Python and another about Ruby. " @@ -1806,7 +1944,7 @@ msgstr "" "向參與 Python 講座。假設參與者的偏好沒有改變,那麼 Python 會議室未超過自身容" "量限制的機率是?" -#: ../../library/statistics.rst:1014 +#: ../../library/statistics.rst:1101 msgid "" ">>> n = 750 # Sample size\n" ">>> p = 0.65 # Preference for Python\n" @@ -1830,15 +1968,15 @@ msgid "" "0.8406" msgstr "" -#: ../../library/statistics.rst:1039 +#: ../../library/statistics.rst:1126 msgid "Naive bayesian classifier" msgstr "單純貝氏分類器 (Naive bayesian classifier)" -#: ../../library/statistics.rst:1041 +#: ../../library/statistics.rst:1128 msgid "Normal distributions commonly arise in machine learning problems." msgstr "常態分布常在機器學習問題中出現。" -#: ../../library/statistics.rst:1043 +#: ../../library/statistics.rst:1130 msgid "" "Wikipedia has a `nice example of a Naive Bayesian Classifier `_. The " @@ -1849,7 +1987,7 @@ msgstr "" "wiki/Naive_Bayes_classifier#Person_classification>`_。課題為從身高、體重與鞋" "子尺寸等符合常態分布的特徵量測值中判斷一個人的性別。" -#: ../../library/statistics.rst:1048 +#: ../../library/statistics.rst:1135 msgid "" "We're given a training dataset with measurements for eight people. The " "measurements are assumed to be normally distributed, so we summarize the " @@ -1858,7 +1996,7 @@ msgstr "" "給定一組包含八個人的量測值的訓練資料集。假設這些量測值服從常態分布,我們可以" "利用 :class:`NormalDist` 來總結資料:" -#: ../../library/statistics.rst:1052 +#: ../../library/statistics.rst:1139 msgid "" ">>> height_male = NormalDist.from_samples([6, 5.92, 5.58, 5.92])\n" ">>> height_female = NormalDist.from_samples([5, 5.5, 5.42, 5.75])\n" @@ -1874,20 +2012,20 @@ msgstr "" ">>> foot_size_male = NormalDist.from_samples([12, 11, 12, 10])\n" ">>> foot_size_female = NormalDist.from_samples([6, 8, 7, 9])" -#: ../../library/statistics.rst:1061 +#: ../../library/statistics.rst:1148 msgid "" "Next, we encounter a new person whose feature measurements are known but " "whose gender is unknown:" msgstr "接著,我們遇到一個新的人,他的特徵量測值已知,但性別未知:" -#: ../../library/statistics.rst:1064 +#: ../../library/statistics.rst:1151 msgid "" ">>> ht = 6.0 # height\n" ">>> wt = 130 # weight\n" ">>> fs = 8 # foot size" msgstr "" -#: ../../library/statistics.rst:1070 +#: ../../library/statistics.rst:1157 msgid "" "Starting with a 50% `prior probability `_ of being male or female, we compute the posterior as " @@ -1898,7 +2036,7 @@ msgstr "" "org/wiki/Prior_probability>`_ 為開端,我們將後驗機率 (posterior probability) " "計算為先驗機率乘以給定性別下,各特徵量測值的概度乘積:" -#: ../../library/statistics.rst:1075 +#: ../../library/statistics.rst:1162 msgid "" ">>> prior_male = 0.5\n" ">>> prior_female = 0.5\n" @@ -1916,7 +2054,7 @@ msgstr "" ">>> posterior_female = (prior_female * height_female.pdf(ht) *\n" "... weight_female.pdf(wt) * foot_size_female.pdf(fs))" -#: ../../library/statistics.rst:1085 +#: ../../library/statistics.rst:1172 msgid "" "The final prediction goes to the largest posterior. This is known as the " "`maximum a posteriori `_ 或者 MAP:" -#: ../../library/statistics.rst:1089 +#: ../../library/statistics.rst:1176 msgid "" ">>> 'male' if posterior_male > posterior_female else 'female'\n" "'female'" @@ -1934,117 +2072,42 @@ msgstr "" ">>> 'male' if posterior_male > posterior_female else 'female'\n" "'female'" -#: ../../library/statistics.rst:1096 -msgid "Kernel density estimation" -msgstr "核密度估計 (Kernel density estimation)" - -#: ../../library/statistics.rst:1098 -msgid "" -"It is possible to estimate a continuous probability distribution from a " -"fixed number of discrete samples." -msgstr "可以從固定數量的離散樣本估計出連續機率分布。" - -#: ../../library/statistics.rst:1101 -msgid "" -"The basic idea is to smooth the data using `a kernel function such as a " -"normal distribution, triangular distribution, or uniform distribution " -"`_. The degree of " -"smoothing is controlled by a scaling parameter, ``h``, which is called the " -"*bandwidth*." -msgstr "" -"基本想法是使用\\ `一個核函式如常態分布、三角分布或均勻分布 `_\\ 來" -"使資料更加平滑。平滑程度由一個縮放參數 ``h`` 控制,被稱為 *bandwidth*。" - -#: ../../library/statistics.rst:1107 -msgid "" -"from random import choice, random\n" -"\n" -"def kde_normal(data, h):\n" -" \"Create a continuous probability distribution from discrete samples.\"\n" -"\n" -" # Smooth the data with a normal distribution kernel scaled by h.\n" -" K_h = NormalDist(0.0, h)\n" -"\n" -" def pdf(x):\n" -" 'Probability density function. P(x <= X < x+dx) / dx'\n" -" return sum(K_h.pdf(x - x_i) for x_i in data) / len(data)\n" -"\n" -" def cdf(x):\n" -" 'Cumulative distribution function. P(X <= x)'\n" -" return sum(K_h.cdf(x - x_i) for x_i in data) / len(data)\n" -"\n" -" def rand():\n" -" 'Random selection from the probability distribution.'\n" -" return choice(data) + K_h.inv_cdf(random())\n" -"\n" -" return pdf, cdf, rand" -msgstr "" - -#: ../../library/statistics.rst:1131 -msgid "" -"`Wikipedia has an example `_ where we can use the ``kde_normal()`` " -"recipe to generate and plot a probability density function estimated from a " -"small sample:" -msgstr "" -"`維基百科有一個範例 `_,我們可以使用 ``kde_normal()`` 這個錦囊" -"妙計來生成並繪製從小樣本估計的機率密度函式:" - -#: ../../library/statistics.rst:1136 -msgid "" -">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" -">>> pdf, cdf, rand = kde_normal(sample, h=1.5)\n" -">>> xarr = [i/100 for i in range(-750, 1100)]\n" -">>> yarr = [pdf(x) for x in xarr]" -msgstr "" -">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" -">>> pdf, cdf, rand = kde_normal(sample, h=1.5)\n" -">>> xarr = [i/100 for i in range(-750, 1100)]\n" -">>> yarr = [pdf(x) for x in xarr]" - -#: ../../library/statistics.rst:1143 -msgid "The points in ``xarr`` and ``yarr`` can be used to make a PDF plot:" -msgstr "``xarr`` 和 ``yarr`` 中的點可用於繪製 PDF 圖:" - -#: ../../library/statistics.rst:1145 -msgid "Scatter plot of the estimated probability density function." -msgstr "估計機率密度函式的散點圖 (scatter plot)。" - -#: ../../library/statistics.rst:1148 -msgid "" -"`Resample `_ the data " -"to produce 100 new selections:" -msgstr "" - -#: ../../library/statistics.rst:1151 -msgid ">>> new_selections = [rand() for i in range(100)]" -msgstr ">>> new_selections = [rand() for i in range(100)]" - -#: ../../library/statistics.rst:1155 -msgid "Determine the probability of a new selection being below ``2.0``:" -msgstr "" - -#: ../../library/statistics.rst:1157 -msgid "" -">>> round(cdf(2.0), 4)\n" -"0.5794" -msgstr "" -">>> round(cdf(2.0), 4)\n" -"0.5794" - -#: ../../library/statistics.rst:1162 -msgid "Add a new sample data point and find the new CDF at ``2.0``:" -msgstr "" - -#: ../../library/statistics.rst:1164 -msgid "" -">>> sample.append(4.9)\n" -">>> round(cdf(2.0), 4)\n" -"0.5005" -msgstr "" -">>> sample.append(4.9)\n" -">>> round(cdf(2.0), 4)\n" -"0.5005" +#~ msgid "Kernel density estimation" +#~ msgstr "核密度估計 (Kernel density estimation)" + +#~ msgid "" +#~ "It is possible to estimate a continuous probability distribution from a " +#~ "fixed number of discrete samples." +#~ msgstr "可以從固定數量的離散樣本估計出連續機率分布。" + +#~ msgid "" +#~ "The basic idea is to smooth the data using `a kernel function such as a " +#~ "normal distribution, triangular distribution, or uniform distribution " +#~ "`_. The degree of " +#~ "smoothing is controlled by a scaling parameter, ``h``, which is called " +#~ "the *bandwidth*." +#~ msgstr "" +#~ "基本想法是使用\\ `一個核函式如常態分布、三角分布或均勻分布 `_\\ 來使資料更加平滑。" +#~ "平滑程度由一個縮放參數 ``h`` 控制,被稱為 *bandwidth*。" + +#~ msgid ">>> new_selections = [rand() for i in range(100)]" +#~ msgstr ">>> new_selections = [rand() for i in range(100)]" + +#~ msgid "" +#~ ">>> round(cdf(2.0), 4)\n" +#~ "0.5794" +#~ msgstr "" +#~ ">>> round(cdf(2.0), 4)\n" +#~ "0.5794" + +#~ msgid "" +#~ ">>> sample.append(4.9)\n" +#~ ">>> round(cdf(2.0), 4)\n" +#~ "0.5005" +#~ msgstr "" +#~ ">>> sample.append(4.9)\n" +#~ ">>> round(cdf(2.0), 4)\n" +#~ "0.5005" diff --git a/library/stdtypes.po b/library/stdtypes.po index 6230b680d2..d677d5a401 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -135,8 +135,8 @@ msgstr "結果" #: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:276 #: ../../library/stdtypes.rst:416 ../../library/stdtypes.rst:965 -#: ../../library/stdtypes.rst:1170 ../../library/stdtypes.rst:2423 -#: ../../library/stdtypes.rst:3642 +#: ../../library/stdtypes.rst:1170 ../../library/stdtypes.rst:2432 +#: ../../library/stdtypes.rst:3651 msgid "Notes" msgstr "註解" @@ -150,7 +150,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:967 #: ../../library/stdtypes.rst:970 ../../library/stdtypes.rst:1181 -#: ../../library/stdtypes.rst:2429 ../../library/stdtypes.rst:3648 +#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 msgid "\\(1)" msgstr "\\(1)" @@ -164,8 +164,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:289 #: ../../library/stdtypes.rst:309 ../../library/stdtypes.rst:1209 -#: ../../library/stdtypes.rst:2433 ../../library/stdtypes.rst:2435 -#: ../../library/stdtypes.rst:3652 ../../library/stdtypes.rst:3654 +#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:2444 +#: ../../library/stdtypes.rst:3661 ../../library/stdtypes.rst:3663 msgid "\\(2)" msgstr "\\(2)" @@ -178,18 +178,18 @@ msgid "if *x* is false, then ``True``, else ``False``" msgstr "假如 *x* 為假,則 ``True``,否則 ``False``" #: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:979 -#: ../../library/stdtypes.rst:1212 ../../library/stdtypes.rst:2437 -#: ../../library/stdtypes.rst:2439 ../../library/stdtypes.rst:2441 -#: ../../library/stdtypes.rst:2443 ../../library/stdtypes.rst:3656 -#: ../../library/stdtypes.rst:3658 ../../library/stdtypes.rst:3660 -#: ../../library/stdtypes.rst:3662 +#: ../../library/stdtypes.rst:1212 ../../library/stdtypes.rst:2446 +#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:2450 +#: ../../library/stdtypes.rst:2452 ../../library/stdtypes.rst:3665 +#: ../../library/stdtypes.rst:3667 ../../library/stdtypes.rst:3669 +#: ../../library/stdtypes.rst:3671 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:320 #: ../../library/stdtypes.rst:434 ../../library/stdtypes.rst:1016 -#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:2469 -#: ../../library/stdtypes.rst:3692 +#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:2478 +#: ../../library/stdtypes.rst:3701 msgid "Notes:" msgstr "註解:" @@ -236,9 +236,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2400 -#: ../../library/stdtypes.rst:2423 ../../library/stdtypes.rst:3619 -#: ../../library/stdtypes.rst:3642 +#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2409 +#: ../../library/stdtypes.rst:2432 ../../library/stdtypes.rst:3628 +#: ../../library/stdtypes.rst:3651 msgid "Meaning" msgstr "含義" @@ -559,7 +559,7 @@ msgid "" msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" #: ../../library/stdtypes.rst:302 ../../library/stdtypes.rst:1202 -#: ../../library/stdtypes.rst:2431 ../../library/stdtypes.rst:3679 +#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3688 msgid "\\(6)" msgstr "\\(6)" @@ -597,9 +597,9 @@ msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:311 ../../library/stdtypes.rst:313 #: ../../library/stdtypes.rst:1191 ../../library/stdtypes.rst:1194 -#: ../../library/stdtypes.rst:2456 ../../library/stdtypes.rst:2459 -#: ../../library/stdtypes.rst:2462 ../../library/stdtypes.rst:3675 -#: ../../library/stdtypes.rst:3682 +#: ../../library/stdtypes.rst:2465 ../../library/stdtypes.rst:2468 +#: ../../library/stdtypes.rst:2471 ../../library/stdtypes.rst:3684 +#: ../../library/stdtypes.rst:3691 msgid "\\(5)" msgstr "\\(5)" @@ -758,8 +758,8 @@ msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:418 ../../library/stdtypes.rst:421 #: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:2445 ../../library/stdtypes.rst:2449 -#: ../../library/stdtypes.rst:3664 ../../library/stdtypes.rst:3668 +#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:2458 +#: ../../library/stdtypes.rst:3673 ../../library/stdtypes.rst:3677 msgid "\\(4)" msgstr "\\(4)" @@ -1684,7 +1684,7 @@ msgid "" "before index *j*)" msgstr "" -#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3650 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3659 msgid "\\(8)" msgstr "\\(8)" @@ -2592,7 +2592,7 @@ msgstr "" msgid "" "The casefolding algorithm is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." +"Unicode15.1.0/ch03.pdf>`__." msgstr "" #: ../../library/stdtypes.rst:1653 @@ -2619,7 +2619,7 @@ msgstr "" msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1673 ../../library/stdtypes.rst:2815 +#: ../../library/stdtypes.rst:1673 ../../library/stdtypes.rst:2824 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." @@ -2641,11 +2641,11 @@ msgid "" "ref:`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:1688 ../../library/stdtypes.rst:2834 +#: ../../library/stdtypes.rst:1688 ../../library/stdtypes.rst:2843 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1691 ../../library/stdtypes.rst:2837 +#: ../../library/stdtypes.rst:1691 ../../library/stdtypes.rst:2846 msgid "" "The value of the *errors* argument is now checked in :ref:`devmode` and in :" "ref:`debug mode `." @@ -2759,7 +2759,7 @@ msgid "" "e., those with general category property being one of \"Lm\", \"Lt\", " "\"Lu\", \"Ll\", or \"Lo\". Note that this is different from the `Alphabetic " "property defined in the section 4.10 'Letters, Alphabetic, and Ideographic' " -"of the Unicode Standard `_." msgstr "" @@ -2900,7 +2900,7 @@ msgstr "" msgid "" "The lowercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." +"Unicode15.1.0/ch03.pdf>`__." msgstr "" #: ../../library/stdtypes.rst:1951 @@ -3012,31 +3012,37 @@ msgstr "" #: ../../library/stdtypes.rst:2023 msgid "" "Return a copy of the string with all occurrences of substring *old* replaced " -"by *new*. If the optional argument *count* is given, only the first *count* " -"occurrences are replaced." +"by *new*. If *count* is given, only the first *count* occurrences are " +"replaced. If *count* is not specified or ``-1``, then all occurrences are " +"replaced." msgstr "" -#: ../../library/stdtypes.rst:2030 +#: ../../library/stdtypes.rst:2027 +#, fuzzy +msgid "*count* is now supported as a keyword argument." +msgstr "新增關鍵字引數的支援。" + +#: ../../library/stdtypes.rst:2033 msgid "" "Return the highest index in the string where substring *sub* is found, such " "that *sub* is contained within ``s[start:end]``. Optional arguments *start* " "and *end* are interpreted as in slice notation. Return ``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2037 +#: ../../library/stdtypes.rst:2040 msgid "" "Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is " "not found." msgstr "" -#: ../../library/stdtypes.rst:2043 +#: ../../library/stdtypes.rst:2046 msgid "" "Return the string right justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2050 +#: ../../library/stdtypes.rst:2053 msgid "" "Split the string at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -3044,7 +3050,7 @@ msgid "" "containing two empty strings, followed by the string itself." msgstr "" -#: ../../library/stdtypes.rst:2058 +#: ../../library/stdtypes.rst:2061 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done, the " @@ -3053,7 +3059,7 @@ msgid "" "behaves like :meth:`split` which is described in detail below." msgstr "" -#: ../../library/stdtypes.rst:2067 +#: ../../library/stdtypes.rst:2070 msgid "" "Return a copy of the string with trailing characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -3062,7 +3068,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2072 +#: ../../library/stdtypes.rst:2075 msgid "" ">>> ' spacious '.rstrip()\n" "' spacious'\n" @@ -3074,13 +3080,13 @@ msgstr "" ">>> 'mississippi'.rstrip('ipz')\n" "'mississ'" -#: ../../library/stdtypes.rst:2077 +#: ../../library/stdtypes.rst:2080 msgid "" "See :meth:`str.removesuffix` for a method that will remove a single suffix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2080 +#: ../../library/stdtypes.rst:2083 msgid "" ">>> 'Monty Python'.rstrip(' Python')\n" "'M'\n" @@ -3092,7 +3098,7 @@ msgstr "" ">>> 'Monty Python'.removesuffix(' Python')\n" "'Monty'" -#: ../../library/stdtypes.rst:2087 +#: ../../library/stdtypes.rst:2090 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, " @@ -3101,7 +3107,7 @@ msgid "" "possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:2093 +#: ../../library/stdtypes.rst:2096 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " @@ -3111,20 +3117,20 @@ msgid "" "``['']``." msgstr "" -#: ../../library/stdtypes.rst:2100 ../../library/stdtypes.rst:2118 -#: ../../library/stdtypes.rst:2170 ../../library/stdtypes.rst:2238 -#: ../../library/stdtypes.rst:2306 ../../library/stdtypes.rst:3152 -#: ../../library/stdtypes.rst:3170 ../../library/stdtypes.rst:3261 -#: ../../library/stdtypes.rst:3277 ../../library/stdtypes.rst:3302 -#: ../../library/stdtypes.rst:3316 ../../library/stdtypes.rst:3344 -#: ../../library/stdtypes.rst:3358 ../../library/stdtypes.rst:3376 -#: ../../library/stdtypes.rst:3403 ../../library/stdtypes.rst:3426 -#: ../../library/stdtypes.rst:3453 ../../library/stdtypes.rst:3495 -#: ../../library/stdtypes.rst:3519 +#: ../../library/stdtypes.rst:2103 ../../library/stdtypes.rst:2121 +#: ../../library/stdtypes.rst:2173 ../../library/stdtypes.rst:2241 +#: ../../library/stdtypes.rst:2309 ../../library/stdtypes.rst:3161 +#: ../../library/stdtypes.rst:3179 ../../library/stdtypes.rst:3270 +#: ../../library/stdtypes.rst:3286 ../../library/stdtypes.rst:3311 +#: ../../library/stdtypes.rst:3325 ../../library/stdtypes.rst:3353 +#: ../../library/stdtypes.rst:3367 ../../library/stdtypes.rst:3385 +#: ../../library/stdtypes.rst:3412 ../../library/stdtypes.rst:3435 +#: ../../library/stdtypes.rst:3462 ../../library/stdtypes.rst:3504 +#: ../../library/stdtypes.rst:3528 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/stdtypes.rst:2102 +#: ../../library/stdtypes.rst:2105 msgid "" ">>> '1,2,3'.split(',')\n" "['1', '2', '3']\n" @@ -3144,7 +3150,7 @@ msgstr "" ">>> '1<>2<>3<4'.split('<>')\n" "['1', '2', '3<4']" -#: ../../library/stdtypes.rst:2111 +#: ../../library/stdtypes.rst:2114 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive whitespace are regarded as a single separator, " @@ -3154,7 +3160,7 @@ msgid "" "returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:2120 +#: ../../library/stdtypes.rst:2123 msgid "" ">>> '1 2 3'.split()\n" "['1', '2', '3']\n" @@ -3170,120 +3176,120 @@ msgstr "" ">>> ' 1 2 3 '.split()\n" "['1', '2', '3']" -#: ../../library/stdtypes.rst:2133 +#: ../../library/stdtypes.rst:2136 msgid "" "Return a list of the lines in the string, breaking at line boundaries. Line " "breaks are not included in the resulting list unless *keepends* is given and " "true." msgstr "" -#: ../../library/stdtypes.rst:2137 +#: ../../library/stdtypes.rst:2140 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2141 +#: ../../library/stdtypes.rst:2144 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2141 +#: ../../library/stdtypes.rst:2144 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2143 +#: ../../library/stdtypes.rst:2146 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2143 +#: ../../library/stdtypes.rst:2146 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2145 +#: ../../library/stdtypes.rst:2148 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2145 +#: ../../library/stdtypes.rst:2148 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2147 +#: ../../library/stdtypes.rst:2150 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2147 +#: ../../library/stdtypes.rst:2150 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2149 +#: ../../library/stdtypes.rst:2152 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2149 +#: ../../library/stdtypes.rst:2152 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2151 +#: ../../library/stdtypes.rst:2154 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2151 +#: ../../library/stdtypes.rst:2154 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2153 +#: ../../library/stdtypes.rst:2156 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2153 +#: ../../library/stdtypes.rst:2156 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2155 +#: ../../library/stdtypes.rst:2158 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2155 +#: ../../library/stdtypes.rst:2158 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2157 +#: ../../library/stdtypes.rst:2160 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2157 +#: ../../library/stdtypes.rst:2160 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2159 +#: ../../library/stdtypes.rst:2162 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2159 +#: ../../library/stdtypes.rst:2162 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2161 +#: ../../library/stdtypes.rst:2164 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2161 +#: ../../library/stdtypes.rst:2164 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2163 +#: ../../library/stdtypes.rst:2166 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2163 +#: ../../library/stdtypes.rst:2166 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2168 +#: ../../library/stdtypes.rst:2171 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2172 +#: ../../library/stdtypes.rst:2175 msgid "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "['ab c', '', 'de fg', 'kl']\n" @@ -3295,14 +3301,14 @@ msgstr "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']" -#: ../../library/stdtypes.rst:2177 +#: ../../library/stdtypes.rst:2180 msgid "" "Unlike :meth:`~str.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:2181 +#: ../../library/stdtypes.rst:2184 msgid "" ">>> \"\".splitlines()\n" "[]\n" @@ -3314,11 +3320,11 @@ msgstr "" ">>> \"One line\\n\".splitlines()\n" "['One line']" -#: ../../library/stdtypes.rst:2186 +#: ../../library/stdtypes.rst:2189 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2188 +#: ../../library/stdtypes.rst:2191 msgid "" ">>> ''.split('\\n')\n" "['']\n" @@ -3330,7 +3336,7 @@ msgstr "" ">>> 'Two lines\\n'.split('\\n')\n" "['Two lines', '']" -#: ../../library/stdtypes.rst:2196 +#: ../../library/stdtypes.rst:2199 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -3338,7 +3344,7 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2204 +#: ../../library/stdtypes.rst:2207 msgid "" "Return a copy of the string with the leading and trailing characters " "removed. The *chars* argument is a string specifying the set of characters " @@ -3347,7 +3353,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2210 +#: ../../library/stdtypes.rst:2213 msgid "" ">>> ' spacious '.strip()\n" "'spacious'\n" @@ -3359,7 +3365,7 @@ msgstr "" ">>> 'www.example.com'.strip('cmowz.')\n" "'example'" -#: ../../library/stdtypes.rst:2215 +#: ../../library/stdtypes.rst:2218 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -3367,7 +3373,7 @@ msgid "" "A similar action takes place on the trailing end. For example::" msgstr "" -#: ../../library/stdtypes.rst:2221 +#: ../../library/stdtypes.rst:2224 msgid "" ">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" ">>> comment_string.strip('.#! ')\n" @@ -3377,20 +3383,20 @@ msgstr "" ">>> comment_string.strip('.#! ')\n" "'Section 3.2.1 Issue #32'" -#: ../../library/stdtypes.rst:2228 +#: ../../library/stdtypes.rst:2231 msgid "" "Return a copy of the string with uppercase characters converted to lowercase " "and vice versa. Note that it is not necessarily true that ``s.swapcase()." "swapcase() == s``." msgstr "" -#: ../../library/stdtypes.rst:2235 +#: ../../library/stdtypes.rst:2238 msgid "" "Return a titlecased version of the string where words start with an " "uppercase character and the remaining characters are lowercase." msgstr "" -#: ../../library/stdtypes.rst:2240 +#: ../../library/stdtypes.rst:2243 msgid "" ">>> 'Hello world'.title()\n" "'Hello World'" @@ -3398,7 +3404,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2243 ../../library/stdtypes.rst:3463 +#: ../../library/stdtypes.rst:2246 ../../library/stdtypes.rst:3472 msgid "" "The algorithm uses a simple language-independent definition of a word as " "groups of consecutive letters. The definition works in many contexts but it " @@ -3406,7 +3412,7 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2248 +#: ../../library/stdtypes.rst:2251 msgid "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" @@ -3414,19 +3420,19 @@ msgstr "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:2251 +#: ../../library/stdtypes.rst:2254 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2254 +#: ../../library/stdtypes.rst:2257 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2257 +#: ../../library/stdtypes.rst:2260 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -3446,7 +3452,7 @@ msgstr "" ">>> titlecase(\"they're bill's friends.\")\n" "\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:2269 +#: ../../library/stdtypes.rst:2272 msgid "" "Return a copy of the string in which each character has been mapped through " "the given translation table. The table must be an object that implements " @@ -3458,19 +3464,19 @@ msgid "" "exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2278 +#: ../../library/stdtypes.rst:2281 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2281 +#: ../../library/stdtypes.rst:2284 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2287 +#: ../../library/stdtypes.rst:2290 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s`` " @@ -3479,14 +3485,14 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2293 +#: ../../library/stdtypes.rst:2296 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." +"Unicode15.1.0/ch03.pdf>`__." msgstr "" -#: ../../library/stdtypes.rst:2300 +#: ../../library/stdtypes.rst:2303 msgid "" "Return a copy of the string left filled with ASCII ``'0'`` digits to make a " "string of length *width*. A leading sign prefix (``'+'``/``'-'``) is handled " @@ -3494,7 +3500,7 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2308 +#: ../../library/stdtypes.rst:2311 msgid "" ">>> \"42\".zfill(5)\n" "'00042'\n" @@ -3506,11 +3512,11 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2318 +#: ../../library/stdtypes.rst:2321 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:2331 +#: ../../library/stdtypes.rst:2334 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -3521,17 +3527,23 @@ msgid "" "or extensibility." msgstr "" -#: ../../library/stdtypes.rst:2339 +#: ../../library/stdtypes.rst:2342 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " "operator. Given ``format % values`` (where *format* is a string), ``%`` " "conversion specifications in *format* are replaced with zero or more " "elements of *values*. The effect is similar to using the :c:func:`sprintf` " -"in the C language." +"function in the C language. For example:" +msgstr "" + +#: ../../library/stdtypes.rst:2349 +msgid "" +">>> print('%s has %d quote types.' % ('Python', 2))\n" +"Python has 2 quote types." msgstr "" -#: ../../library/stdtypes.rst:2345 +#: ../../library/stdtypes.rst:2354 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -3539,36 +3551,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:2355 ../../library/stdtypes.rst:3574 +#: ../../library/stdtypes.rst:2364 ../../library/stdtypes.rst:3583 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:2358 ../../library/stdtypes.rst:3577 +#: ../../library/stdtypes.rst:2367 ../../library/stdtypes.rst:3586 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:2360 ../../library/stdtypes.rst:3579 +#: ../../library/stdtypes.rst:2369 ../../library/stdtypes.rst:3588 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:2363 ../../library/stdtypes.rst:3582 +#: ../../library/stdtypes.rst:2372 ../../library/stdtypes.rst:3591 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:2366 ../../library/stdtypes.rst:3585 +#: ../../library/stdtypes.rst:2375 ../../library/stdtypes.rst:3594 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is read from the next element of the tuple in *values*, and the " "object to convert comes after the minimum field width and optional precision." msgstr "" -#: ../../library/stdtypes.rst:2370 ../../library/stdtypes.rst:3589 +#: ../../library/stdtypes.rst:2379 ../../library/stdtypes.rst:3598 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -3576,15 +3588,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:2375 ../../library/stdtypes.rst:3594 +#: ../../library/stdtypes.rst:2384 ../../library/stdtypes.rst:3603 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:2377 ../../library/stdtypes.rst:3596 +#: ../../library/stdtypes.rst:2386 ../../library/stdtypes.rst:3605 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:2379 +#: ../../library/stdtypes.rst:2388 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the string *must* include a parenthesised mapping key into that " @@ -3592,279 +3604,279 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:2388 ../../library/stdtypes.rst:3607 +#: ../../library/stdtypes.rst:2397 ../../library/stdtypes.rst:3616 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:2391 ../../library/stdtypes.rst:3610 +#: ../../library/stdtypes.rst:2400 ../../library/stdtypes.rst:3619 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:2400 ../../library/stdtypes.rst:3619 +#: ../../library/stdtypes.rst:2409 ../../library/stdtypes.rst:3628 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:2411 ../../library/stdtypes.rst:3630 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:2411 ../../library/stdtypes.rst:3630 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:2405 ../../library/stdtypes.rst:3624 +#: ../../library/stdtypes.rst:2414 ../../library/stdtypes.rst:3633 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:2405 ../../library/stdtypes.rst:3624 +#: ../../library/stdtypes.rst:2414 ../../library/stdtypes.rst:3633 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:2407 ../../library/stdtypes.rst:3626 +#: ../../library/stdtypes.rst:2416 ../../library/stdtypes.rst:3635 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:2407 ../../library/stdtypes.rst:3626 +#: ../../library/stdtypes.rst:2416 ../../library/stdtypes.rst:3635 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:2410 ../../library/stdtypes.rst:3629 +#: ../../library/stdtypes.rst:2419 ../../library/stdtypes.rst:3638 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2410 ../../library/stdtypes.rst:3629 +#: ../../library/stdtypes.rst:2419 ../../library/stdtypes.rst:3638 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:2413 ../../library/stdtypes.rst:3632 +#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:3641 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:2413 ../../library/stdtypes.rst:3632 +#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:3641 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:2417 ../../library/stdtypes.rst:3636 +#: ../../library/stdtypes.rst:2426 ../../library/stdtypes.rst:3645 msgid "" "A length modifier (``h``, ``l``, or ``L``) may be present, but is ignored as " "it is not necessary for Python -- so e.g. ``%ld`` is identical to ``%d``." msgstr "" -#: ../../library/stdtypes.rst:2420 ../../library/stdtypes.rst:3639 +#: ../../library/stdtypes.rst:2429 ../../library/stdtypes.rst:3648 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:2423 ../../library/stdtypes.rst:3642 +#: ../../library/stdtypes.rst:2432 ../../library/stdtypes.rst:3651 msgid "Conversion" msgstr "" -#: ../../library/stdtypes.rst:2425 ../../library/stdtypes.rst:3644 +#: ../../library/stdtypes.rst:2434 ../../library/stdtypes.rst:3653 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:2425 ../../library/stdtypes.rst:2427 -#: ../../library/stdtypes.rst:3644 ../../library/stdtypes.rst:3646 +#: ../../library/stdtypes.rst:2434 ../../library/stdtypes.rst:2436 +#: ../../library/stdtypes.rst:3653 ../../library/stdtypes.rst:3655 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:2427 ../../library/stdtypes.rst:3646 +#: ../../library/stdtypes.rst:2436 ../../library/stdtypes.rst:3655 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:2429 ../../library/stdtypes.rst:3648 +#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:2429 ../../library/stdtypes.rst:3648 +#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:2431 ../../library/stdtypes.rst:3650 +#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3659 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:2431 ../../library/stdtypes.rst:3650 +#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3659 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:2433 ../../library/stdtypes.rst:3652 +#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:3661 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:2433 ../../library/stdtypes.rst:3652 +#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:3661 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2435 ../../library/stdtypes.rst:3654 +#: ../../library/stdtypes.rst:2444 ../../library/stdtypes.rst:3663 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:2435 ../../library/stdtypes.rst:3654 +#: ../../library/stdtypes.rst:2444 ../../library/stdtypes.rst:3663 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2437 ../../library/stdtypes.rst:3656 +#: ../../library/stdtypes.rst:2446 ../../library/stdtypes.rst:3665 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:2437 ../../library/stdtypes.rst:3656 +#: ../../library/stdtypes.rst:2446 ../../library/stdtypes.rst:3665 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2439 ../../library/stdtypes.rst:3658 +#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:3667 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:2439 ../../library/stdtypes.rst:3658 +#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:3667 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2441 ../../library/stdtypes.rst:3660 +#: ../../library/stdtypes.rst:2450 ../../library/stdtypes.rst:3669 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:2441 ../../library/stdtypes.rst:2443 -#: ../../library/stdtypes.rst:3660 ../../library/stdtypes.rst:3662 +#: ../../library/stdtypes.rst:2450 ../../library/stdtypes.rst:2452 +#: ../../library/stdtypes.rst:3669 ../../library/stdtypes.rst:3671 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:2443 ../../library/stdtypes.rst:3662 +#: ../../library/stdtypes.rst:2452 ../../library/stdtypes.rst:3671 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:2445 ../../library/stdtypes.rst:3664 +#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:3673 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2445 ../../library/stdtypes.rst:3664 +#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:3673 msgid "" "Floating-point format. Uses lowercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2449 ../../library/stdtypes.rst:3668 +#: ../../library/stdtypes.rst:2458 ../../library/stdtypes.rst:3677 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2449 ../../library/stdtypes.rst:3668 +#: ../../library/stdtypes.rst:2458 ../../library/stdtypes.rst:3677 msgid "" "Floating-point format. Uses uppercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2453 ../../library/stdtypes.rst:3672 +#: ../../library/stdtypes.rst:2462 ../../library/stdtypes.rst:3681 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:2453 +#: ../../library/stdtypes.rst:2462 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:2456 ../../library/stdtypes.rst:3685 +#: ../../library/stdtypes.rst:2465 ../../library/stdtypes.rst:3694 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:2456 +#: ../../library/stdtypes.rst:2465 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:2459 ../../library/stdtypes.rst:3679 +#: ../../library/stdtypes.rst:2468 ../../library/stdtypes.rst:3688 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:2459 +#: ../../library/stdtypes.rst:2468 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:2462 ../../library/stdtypes.rst:3682 +#: ../../library/stdtypes.rst:2471 ../../library/stdtypes.rst:3691 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:2462 +#: ../../library/stdtypes.rst:2471 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:2465 ../../library/stdtypes.rst:3688 +#: ../../library/stdtypes.rst:2474 ../../library/stdtypes.rst:3697 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:2465 ../../library/stdtypes.rst:3688 +#: ../../library/stdtypes.rst:2474 ../../library/stdtypes.rst:3697 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:2472 ../../library/stdtypes.rst:3695 +#: ../../library/stdtypes.rst:2481 ../../library/stdtypes.rst:3704 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:2476 ../../library/stdtypes.rst:3699 +#: ../../library/stdtypes.rst:2485 ../../library/stdtypes.rst:3708 msgid "" "The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on " "whether the ``'x'`` or ``'X'`` format was used) to be inserted before the " "first digit." msgstr "" -#: ../../library/stdtypes.rst:2480 ../../library/stdtypes.rst:3703 +#: ../../library/stdtypes.rst:2489 ../../library/stdtypes.rst:3712 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:2483 ../../library/stdtypes.rst:3706 +#: ../../library/stdtypes.rst:2492 ../../library/stdtypes.rst:3715 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2487 ../../library/stdtypes.rst:3710 +#: ../../library/stdtypes.rst:2496 ../../library/stdtypes.rst:3719 msgid "" "The alternate form causes the result to always contain a decimal point, and " "trailing zeroes are not removed as they would otherwise be." msgstr "" -#: ../../library/stdtypes.rst:2490 ../../library/stdtypes.rst:3713 +#: ../../library/stdtypes.rst:2499 ../../library/stdtypes.rst:3722 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2494 ../../library/stdtypes.rst:3717 +#: ../../library/stdtypes.rst:2503 ../../library/stdtypes.rst:3726 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:2497 ../../library/stdtypes.rst:3726 +#: ../../library/stdtypes.rst:2506 ../../library/stdtypes.rst:3735 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:2499 +#: ../../library/stdtypes.rst:2508 msgid "" "Since Python strings have an explicit length, ``%s`` conversions do not " "assume that ``'\\0'`` is the end of the string." msgstr "" -#: ../../library/stdtypes.rst:2504 +#: ../../library/stdtypes.rst:2513 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:2515 +#: ../../library/stdtypes.rst:2524 msgid "" "Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" "`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:2523 +#: ../../library/stdtypes.rst:2532 msgid "" "The core built-in types for manipulating binary data are :class:`bytes` and :" "class:`bytearray`. They are supported by :class:`memoryview` which uses the :" @@ -3872,17 +3884,17 @@ msgid "" "objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:2528 +#: ../../library/stdtypes.rst:2537 msgid "" "The :mod:`array` module supports efficient storage of basic data types like " "32-bit integers and IEEE754 double-precision floating values." msgstr "" -#: ../../library/stdtypes.rst:2534 +#: ../../library/stdtypes.rst:2543 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:2538 +#: ../../library/stdtypes.rst:2547 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -3890,40 +3902,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:2545 +#: ../../library/stdtypes.rst:2554 msgid "" "Firstly, the syntax for bytes literals is largely the same as that for " "string literals, except that a ``b`` prefix is added:" msgstr "" -#: ../../library/stdtypes.rst:2548 +#: ../../library/stdtypes.rst:2557 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:2549 +#: ../../library/stdtypes.rst:2558 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:2550 +#: ../../library/stdtypes.rst:2559 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:2552 +#: ../../library/stdtypes.rst:2561 msgid "" "Only ASCII characters are permitted in bytes literals (regardless of the " "declared source code encoding). Any binary values over 127 must be entered " "into bytes literals using the appropriate escape sequence." msgstr "" -#: ../../library/stdtypes.rst:2556 +#: ../../library/stdtypes.rst:2565 msgid "" "As with string literals, bytes literals may also use a ``r`` prefix to " "disable processing of escape sequences. See :ref:`strings` for more about " "the various forms of bytes literal, including supported escape sequences." msgstr "" -#: ../../library/stdtypes.rst:2560 +#: ../../library/stdtypes.rst:2569 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -3936,29 +3948,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:2570 +#: ../../library/stdtypes.rst:2579 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:2573 +#: ../../library/stdtypes.rst:2582 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:2574 +#: ../../library/stdtypes.rst:2583 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2575 +#: ../../library/stdtypes.rst:2584 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:2577 +#: ../../library/stdtypes.rst:2586 msgid "Also see the :ref:`bytes ` built-in." msgstr "" -#: ../../library/stdtypes.rst:2579 +#: ../../library/stdtypes.rst:2588 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -3966,32 +3978,32 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2594 msgid "" "This :class:`bytes` class method returns a bytes object, decoding the given " "string object. The string must contain two hexadecimal digits per byte, " "with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2592 +#: ../../library/stdtypes.rst:2601 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:2596 +#: ../../library/stdtypes.rst:2605 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2601 ../../library/stdtypes.rst:2686 +#: ../../library/stdtypes.rst:2610 ../../library/stdtypes.rst:2695 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:2607 +#: ../../library/stdtypes.rst:2616 msgid "" "If you want to make the hex string easier to read, you can specify a single " "character separator *sep* parameter to include in the output. By default, " @@ -4000,13 +4012,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:2624 +#: ../../library/stdtypes.rst:2633 msgid "" ":meth:`bytes.hex` now supports optional *sep* and *bytes_per_sep* parameters " "to insert separators between bytes in the hex output." msgstr "" -#: ../../library/stdtypes.rst:2628 +#: ../../library/stdtypes.rst:2637 msgid "" "Since bytes objects are sequences of integers (akin to a tuple), for a bytes " "object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes " @@ -4014,58 +4026,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2633 +#: ../../library/stdtypes.rst:2642 msgid "" "The representation of bytes objects uses the literal format (``b'...'``) " "since it is often more useful than e.g. ``bytes([46, 46, 46])``. You can " "always convert a bytes object into a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2641 +#: ../../library/stdtypes.rst:2650 msgid "Bytearray Objects" msgstr "" -#: ../../library/stdtypes.rst:2645 +#: ../../library/stdtypes.rst:2654 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:2650 +#: ../../library/stdtypes.rst:2659 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:2653 +#: ../../library/stdtypes.rst:2662 msgid "Creating an empty instance: ``bytearray()``" msgstr "" -#: ../../library/stdtypes.rst:2654 +#: ../../library/stdtypes.rst:2663 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:2655 +#: ../../library/stdtypes.rst:2664 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2656 +#: ../../library/stdtypes.rst:2665 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:2658 +#: ../../library/stdtypes.rst:2667 msgid "" "As bytearray objects are mutable, they support the :ref:`mutable ` sequence operations in addition to the common bytes and bytearray " "operations described in :ref:`bytes-methods`." msgstr "" -#: ../../library/stdtypes.rst:2662 +#: ../../library/stdtypes.rst:2671 msgid "Also see the :ref:`bytearray ` built-in." msgstr "" -#: ../../library/stdtypes.rst:2664 +#: ../../library/stdtypes.rst:2673 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4073,33 +4085,33 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:2670 +#: ../../library/stdtypes.rst:2679 msgid "" "This :class:`bytearray` class method returns bytearray object, decoding the " "given string object. The string must contain two hexadecimal digits per " "byte, with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2677 +#: ../../library/stdtypes.rst:2686 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:2681 +#: ../../library/stdtypes.rst:2690 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2694 +#: ../../library/stdtypes.rst:2703 msgid "" "Similar to :meth:`bytes.hex`, :meth:`bytearray.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:2699 +#: ../../library/stdtypes.rst:2708 msgid "" "Since bytearray objects are sequences of integers (akin to a list), for a " "bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be " @@ -4107,7 +4119,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2704 +#: ../../library/stdtypes.rst:2713 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -4115,11 +4127,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2713 +#: ../../library/stdtypes.rst:2722 msgid "Bytes and Bytearray Operations" msgstr "" -#: ../../library/stdtypes.rst:2718 +#: ../../library/stdtypes.rst:2727 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -4128,14 +4140,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:2726 +#: ../../library/stdtypes.rst:2735 msgid "" "The methods on bytes and bytearray objects don't accept strings as their " "arguments, just as the methods on strings don't accept bytes as their " "arguments. For example, you have to write::" msgstr "" -#: ../../library/stdtypes.rst:2730 +#: ../../library/stdtypes.rst:2739 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -4143,11 +4155,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:2733 +#: ../../library/stdtypes.rst:2742 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:2735 +#: ../../library/stdtypes.rst:2744 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -4155,60 +4167,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:2738 +#: ../../library/stdtypes.rst:2747 msgid "" "Some bytes and bytearray operations assume the use of ASCII compatible " "binary formats, and hence should be avoided when working with arbitrary " "binary data. These restrictions are covered below." msgstr "" -#: ../../library/stdtypes.rst:2743 +#: ../../library/stdtypes.rst:2752 msgid "" "Using these ASCII based operations to manipulate binary data that is not " "stored in an ASCII based format may lead to data corruption." msgstr "" -#: ../../library/stdtypes.rst:2746 +#: ../../library/stdtypes.rst:2755 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:2752 +#: ../../library/stdtypes.rst:2761 msgid "" "Return the number of non-overlapping occurrences of subsequence *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" -#: ../../library/stdtypes.rst:2756 ../../library/stdtypes.rst:2861 -#: ../../library/stdtypes.rst:2883 ../../library/stdtypes.rst:2949 -#: ../../library/stdtypes.rst:2962 +#: ../../library/stdtypes.rst:2765 ../../library/stdtypes.rst:2870 +#: ../../library/stdtypes.rst:2892 ../../library/stdtypes.rst:2958 +#: ../../library/stdtypes.rst:2971 msgid "" "The subsequence to search for may be any :term:`bytes-like object` or an " "integer in the range 0 to 255." msgstr "" -#: ../../library/stdtypes.rst:2759 +#: ../../library/stdtypes.rst:2768 msgid "" "If *sub* is empty, returns the number of empty slices between characters " "which is the length of the bytes object plus one." msgstr "" -#: ../../library/stdtypes.rst:2762 ../../library/stdtypes.rst:2873 -#: ../../library/stdtypes.rst:2886 ../../library/stdtypes.rst:2952 -#: ../../library/stdtypes.rst:2965 +#: ../../library/stdtypes.rst:2771 ../../library/stdtypes.rst:2882 +#: ../../library/stdtypes.rst:2895 ../../library/stdtypes.rst:2961 +#: ../../library/stdtypes.rst:2974 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:2769 +#: ../../library/stdtypes.rst:2778 msgid "" "If the binary data starts with the *prefix* string, return " "``bytes[len(prefix):]``. Otherwise, return a copy of the original binary " "data::" msgstr "" -#: ../../library/stdtypes.rst:2773 +#: ../../library/stdtypes.rst:2782 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -4220,32 +4232,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:2778 +#: ../../library/stdtypes.rst:2787 msgid "The *prefix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2782 ../../library/stdtypes.rst:2804 -#: ../../library/stdtypes.rst:2937 ../../library/stdtypes.rst:3030 -#: ../../library/stdtypes.rst:3044 ../../library/stdtypes.rst:3075 -#: ../../library/stdtypes.rst:3089 ../../library/stdtypes.rst:3131 -#: ../../library/stdtypes.rst:3202 ../../library/stdtypes.rst:3220 -#: ../../library/stdtypes.rst:3248 ../../library/stdtypes.rst:3387 -#: ../../library/stdtypes.rst:3442 ../../library/stdtypes.rst:3485 -#: ../../library/stdtypes.rst:3506 ../../library/stdtypes.rst:3528 -#: ../../library/stdtypes.rst:3730 +#: ../../library/stdtypes.rst:2791 ../../library/stdtypes.rst:2813 +#: ../../library/stdtypes.rst:2946 ../../library/stdtypes.rst:3039 +#: ../../library/stdtypes.rst:3053 ../../library/stdtypes.rst:3084 +#: ../../library/stdtypes.rst:3098 ../../library/stdtypes.rst:3140 +#: ../../library/stdtypes.rst:3211 ../../library/stdtypes.rst:3229 +#: ../../library/stdtypes.rst:3257 ../../library/stdtypes.rst:3396 +#: ../../library/stdtypes.rst:3451 ../../library/stdtypes.rst:3494 +#: ../../library/stdtypes.rst:3515 ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:3739 msgid "" "The bytearray version of this method does *not* operate in place - it always " "produces a new object, even if no changes were made." msgstr "" -#: ../../library/stdtypes.rst:2791 +#: ../../library/stdtypes.rst:2800 msgid "" "If the binary data ends with the *suffix* string and that *suffix* is not " "empty, return ``bytes[:-len(suffix)]``. Otherwise, return a copy of the " "original binary data::" msgstr "" -#: ../../library/stdtypes.rst:2795 +#: ../../library/stdtypes.rst:2804 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -4257,15 +4269,15 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:2800 +#: ../../library/stdtypes.rst:2809 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2813 +#: ../../library/stdtypes.rst:2822 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:2818 +#: ../../library/stdtypes.rst:2827 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -4273,21 +4285,21 @@ msgid "" "`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:2824 +#: ../../library/stdtypes.rst:2833 msgid "" "For performance reasons, the value of *errors* is not checked for validity " "unless a decoding error actually occurs, :ref:`devmode` is enabled or a :ref:" "`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:2830 +#: ../../library/stdtypes.rst:2839 msgid "" "Passing the *encoding* argument to :class:`str` allows decoding any :term:" "`bytes-like object` directly, without needing to make a temporary :class:`!" "bytes` or :class:`!bytearray` object." msgstr "" -#: ../../library/stdtypes.rst:2845 +#: ../../library/stdtypes.rst:2854 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -4295,11 +4307,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:2850 +#: ../../library/stdtypes.rst:2859 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2856 +#: ../../library/stdtypes.rst:2865 msgid "" "Return the lowest index in the data where the subsequence *sub* is found, " "such that *sub* is contained in the slice ``s[start:end]``. Optional " @@ -4307,14 +4319,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:2866 +#: ../../library/stdtypes.rst:2875 msgid "" "The :meth:`~bytes.find` method should be used only if you need to know the " "position of *sub*. To check if *sub* is a substring or not, use the :" "keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:2870 +#: ../../library/stdtypes.rst:2879 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -4322,13 +4334,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:2880 +#: ../../library/stdtypes.rst:2889 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2902 msgid "" "Return a bytes or bytearray object which is the concatenation of the binary " "data sequences in *iterable*. A :exc:`TypeError` will be raised if there " @@ -4338,7 +4350,7 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:2904 +#: ../../library/stdtypes.rst:2913 msgid "" "This static method returns a translation table usable for :meth:`bytes." "translate` that will map each character in *from* into the character at the " @@ -4346,7 +4358,7 @@ msgid "" "objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:2915 +#: ../../library/stdtypes.rst:2924 msgid "" "Split the sequence at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -4355,24 +4367,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:2922 ../../library/stdtypes.rst:2979 +#: ../../library/stdtypes.rst:2931 ../../library/stdtypes.rst:2988 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2928 +#: ../../library/stdtypes.rst:2937 msgid "" "Return a copy of the sequence with all occurrences of subsequence *old* " "replaced by *new*. If the optional argument *count* is given, only the " "first *count* occurrences are replaced." msgstr "" -#: ../../library/stdtypes.rst:2932 +#: ../../library/stdtypes.rst:2941 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:2944 +#: ../../library/stdtypes.rst:2953 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -4380,13 +4392,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2959 +#: ../../library/stdtypes.rst:2968 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:2972 +#: ../../library/stdtypes.rst:2981 msgid "" "Split the sequence at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -4395,7 +4407,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:2985 +#: ../../library/stdtypes.rst:2994 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -4403,11 +4415,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:2990 +#: ../../library/stdtypes.rst:2999 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2996 +#: ../../library/stdtypes.rst:3005 msgid "" "Return a copy of the bytes or bytearray object where all bytes occurring in " "the optional argument *delete* are removed, and the remaining bytes have " @@ -4415,18 +4427,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3001 +#: ../../library/stdtypes.rst:3010 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3004 +#: ../../library/stdtypes.rst:3013 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3007 +#: ../../library/stdtypes.rst:3016 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -4434,11 +4446,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3010 +#: ../../library/stdtypes.rst:3019 msgid "*delete* is now supported as a keyword argument." msgstr "" -#: ../../library/stdtypes.rst:3014 +#: ../../library/stdtypes.rst:3023 msgid "" "The following methods on bytes and bytearray objects have default behaviours " "that assume the use of ASCII compatible binary formats, but can still be " @@ -4447,7 +4459,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3023 +#: ../../library/stdtypes.rst:3032 msgid "" "Return a copy of the object centered in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4455,7 +4467,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3037 +#: ../../library/stdtypes.rst:3046 msgid "" "Return a copy of the object left justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4463,7 +4475,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3051 +#: ../../library/stdtypes.rst:3060 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " "*chars* argument is a binary sequence specifying the set of byte values to " @@ -4473,7 +4485,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3058 +#: ../../library/stdtypes.rst:3067 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -4485,14 +4497,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3063 +#: ../../library/stdtypes.rst:3072 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removeprefix` for a method that will remove a " "single prefix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3068 +#: ../../library/stdtypes.rst:3077 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -4504,7 +4516,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3082 +#: ../../library/stdtypes.rst:3091 msgid "" "Return a copy of the object right justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4512,7 +4524,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3096 +#: ../../library/stdtypes.rst:3105 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are " @@ -4522,7 +4534,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3107 +#: ../../library/stdtypes.rst:3116 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " "*chars* argument is a binary sequence specifying the set of byte values to " @@ -4532,7 +4544,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3114 +#: ../../library/stdtypes.rst:3123 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -4544,14 +4556,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3119 +#: ../../library/stdtypes.rst:3128 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removesuffix` for a method that will remove a " "single suffix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3124 +#: ../../library/stdtypes.rst:3133 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -4563,7 +4575,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3138 +#: ../../library/stdtypes.rst:3147 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given and non-negative, at most " @@ -4572,7 +4584,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3144 +#: ../../library/stdtypes.rst:3153 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty subsequences (for example, ``b'1,,2'.split(b',')`` " @@ -4583,7 +4595,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3154 +#: ../../library/stdtypes.rst:3163 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -4603,7 +4615,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3163 +#: ../../library/stdtypes.rst:3172 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive ASCII whitespace are regarded as a single " @@ -4613,7 +4625,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3173 +#: ../../library/stdtypes.rst:3182 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -4629,7 +4641,7 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3184 +#: ../../library/stdtypes.rst:3193 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " "removed. The *chars* argument is a binary sequence specifying the set of " @@ -4639,7 +4651,7 @@ msgid "" "a prefix or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3192 +#: ../../library/stdtypes.rst:3201 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -4651,13 +4663,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3197 +#: ../../library/stdtypes.rst:3206 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3206 +#: ../../library/stdtypes.rst:3215 msgid "" "The following methods on bytes and bytearray objects assume the use of ASCII " "compatible binary formats and should not be applied to arbitrary binary " @@ -4665,14 +4677,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3214 +#: ../../library/stdtypes.rst:3223 msgid "" "Return a copy of the sequence with each byte interpreted as an ASCII " "character, and the first byte capitalized and the rest lowercased. Non-ASCII " "byte values are passed through unchanged." msgstr "" -#: ../../library/stdtypes.rst:3227 +#: ../../library/stdtypes.rst:3236 msgid "" "Return a copy of the sequence where all ASCII tab characters are replaced by " "one or more ASCII spaces, depending on the current column and the given tab " @@ -4688,7 +4700,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3241 +#: ../../library/stdtypes.rst:3250 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -4700,7 +4712,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:3255 +#: ../../library/stdtypes.rst:3264 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -4709,7 +4721,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3263 +#: ../../library/stdtypes.rst:3272 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -4721,7 +4733,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:3272 +#: ../../library/stdtypes.rst:3281 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -4729,7 +4741,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3279 +#: ../../library/stdtypes.rst:3288 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -4741,20 +4753,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:3288 +#: ../../library/stdtypes.rst:3297 msgid "" "Return ``True`` if the sequence is empty or all bytes in the sequence are " "ASCII, ``False`` otherwise. ASCII bytes are in the range 0-0x7F." msgstr "" -#: ../../library/stdtypes.rst:3298 +#: ../../library/stdtypes.rst:3307 msgid "" "Return ``True`` if all bytes in the sequence are ASCII decimal digits and " "the sequence is not empty, ``False`` otherwise. ASCII decimal digits are " "those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3304 +#: ../../library/stdtypes.rst:3313 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -4766,13 +4778,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:3313 +#: ../../library/stdtypes.rst:3322 msgid "" "Return ``True`` if there is at least one lowercase ASCII character in the " "sequence and no uppercase ASCII characters, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:3318 +#: ../../library/stdtypes.rst:3327 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -4784,16 +4796,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:3323 ../../library/stdtypes.rst:3365 -#: ../../library/stdtypes.rst:3381 ../../library/stdtypes.rst:3431 -#: ../../library/stdtypes.rst:3500 +#: ../../library/stdtypes.rst:3332 ../../library/stdtypes.rst:3374 +#: ../../library/stdtypes.rst:3390 ../../library/stdtypes.rst:3440 +#: ../../library/stdtypes.rst:3509 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " "values in the sequence ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3331 +#: ../../library/stdtypes.rst:3340 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -4801,14 +4813,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:3340 +#: ../../library/stdtypes.rst:3349 msgid "" "Return ``True`` if the sequence is ASCII titlecase and the sequence is not " "empty, ``False`` otherwise. See :meth:`bytes.title` for more details on the " "definition of \"titlecase\"." msgstr "" -#: ../../library/stdtypes.rst:3346 +#: ../../library/stdtypes.rst:3355 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -4820,14 +4832,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:3355 +#: ../../library/stdtypes.rst:3364 msgid "" "Return ``True`` if there is at least one uppercase alphabetic ASCII " "character in the sequence and no lowercase ASCII characters, ``False`` " "otherwise." msgstr "" -#: ../../library/stdtypes.rst:3360 +#: ../../library/stdtypes.rst:3369 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -4839,13 +4851,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:3373 +#: ../../library/stdtypes.rst:3382 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3378 +#: ../../library/stdtypes.rst:3387 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -4853,7 +4865,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:3398 +#: ../../library/stdtypes.rst:3407 msgid "" "Return a list of the lines in the binary sequence, breaking at ASCII line " "boundaries. This method uses the :term:`universal newlines` approach to " @@ -4861,7 +4873,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:3405 +#: ../../library/stdtypes.rst:3414 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -4873,14 +4885,14 @@ msgstr "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']" -#: ../../library/stdtypes.rst:3410 +#: ../../library/stdtypes.rst:3419 msgid "" "Unlike :meth:`~bytes.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:3414 +#: ../../library/stdtypes.rst:3423 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -4892,13 +4904,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:3423 +#: ../../library/stdtypes.rst:3432 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart and vice-versa." msgstr "" -#: ../../library/stdtypes.rst:3428 +#: ../../library/stdtypes.rst:3437 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -4906,7 +4918,7 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:3435 +#: ../../library/stdtypes.rst:3444 msgid "" "Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " @@ -4914,14 +4926,14 @@ msgid "" "Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:3449 +#: ../../library/stdtypes.rst:3458 msgid "" "Return a titlecased version of the binary sequence where words start with an " "uppercase ASCII character and the remaining characters are lowercase. " "Uncased byte values are left unmodified." msgstr "" -#: ../../library/stdtypes.rst:3455 +#: ../../library/stdtypes.rst:3464 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -4929,7 +4941,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:3458 +#: ../../library/stdtypes.rst:3467 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -4937,7 +4949,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:3468 +#: ../../library/stdtypes.rst:3477 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -4945,12 +4957,12 @@ msgstr "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:3471 +#: ../../library/stdtypes.rst:3480 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:3473 +#: ../../library/stdtypes.rst:3482 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -4972,13 +4984,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:3492 +#: ../../library/stdtypes.rst:3501 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3497 +#: ../../library/stdtypes.rst:3506 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -4986,7 +4998,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:3513 +#: ../../library/stdtypes.rst:3522 msgid "" "Return a copy of the sequence left filled with ASCII ``b'0'`` digits to make " "a sequence of length *width*. A leading sign prefix (``b'+'``/ ``b'-'``) is " @@ -4995,7 +5007,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:3521 +#: ../../library/stdtypes.rst:3530 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -5007,11 +5019,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:3535 +#: ../../library/stdtypes.rst:3544 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:3552 +#: ../../library/stdtypes.rst:3561 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -5019,7 +5031,7 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:3557 +#: ../../library/stdtypes.rst:3566 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " @@ -5029,7 +5041,7 @@ msgid "" "func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:3564 +#: ../../library/stdtypes.rst:3573 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -5037,7 +5049,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:3598 +#: ../../library/stdtypes.rst:3607 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the bytes object *must* include a parenthesised mapping key into " @@ -5045,73 +5057,73 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:3672 +#: ../../library/stdtypes.rst:3681 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:3675 +#: ../../library/stdtypes.rst:3684 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:3675 +#: ../../library/stdtypes.rst:3684 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:3679 +#: ../../library/stdtypes.rst:3688 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3682 +#: ../../library/stdtypes.rst:3691 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:3685 +#: ../../library/stdtypes.rst:3694 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3685 +#: ../../library/stdtypes.rst:3694 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:3720 +#: ../../library/stdtypes.rst:3729 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "" -#: ../../library/stdtypes.rst:3723 +#: ../../library/stdtypes.rst:3732 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "" -#: ../../library/stdtypes.rst:3735 +#: ../../library/stdtypes.rst:3744 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:3742 +#: ../../library/stdtypes.rst:3751 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:3744 +#: ../../library/stdtypes.rst:3753 msgid "" ":class:`memoryview` objects allow Python code to access the internal data of " "an object that supports the :ref:`buffer protocol ` without " "copying." msgstr "" -#: ../../library/stdtypes.rst:3750 +#: ../../library/stdtypes.rst:3759 msgid "" "Create a :class:`memoryview` that references *object*. *object* must " "support the buffer protocol. Built-in objects that support the buffer " "protocol include :class:`bytes` and :class:`bytearray`." msgstr "" -#: ../../library/stdtypes.rst:3754 +#: ../../library/stdtypes.rst:3763 msgid "" "A :class:`memoryview` has the notion of an *element*, which is the atomic " "memory unit handled by the originating *object*. For many simple types such " @@ -5119,32 +5131,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:3759 +#: ../../library/stdtypes.rst:3768 msgid "" "``len(view)`` is equal to the length of :class:`~memoryview.tolist`, which " "is the nested list representation of the view. If ``view.ndim = 1``, this is " "equal to the number of elements in the view." msgstr "" -#: ../../library/stdtypes.rst:3763 +#: ../../library/stdtypes.rst:3772 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:3766 +#: ../../library/stdtypes.rst:3775 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:3769 +#: ../../library/stdtypes.rst:3778 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:3772 +#: ../../library/stdtypes.rst:3781 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -5166,7 +5178,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:3782 +#: ../../library/stdtypes.rst:3791 msgid "" "If :class:`~memoryview.format` is one of the native format specifiers from " "the :mod:`struct` module, indexing with an integer or a tuple of integers is " @@ -5177,11 +5189,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:3791 +#: ../../library/stdtypes.rst:3800 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:3793 +#: ../../library/stdtypes.rst:3802 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -5203,13 +5215,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:3803 +#: ../../library/stdtypes.rst:3812 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:3806 +#: ../../library/stdtypes.rst:3815 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -5249,14 +5261,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:3824 +#: ../../library/stdtypes.rst:3833 msgid "" "One-dimensional memoryviews of :term:`hashable` (read-only) types with " "formats 'B', 'b' or 'c' are also hashable. The hash is defined as ``hash(m) " "== hash(m.tobytes())``::" msgstr "" -#: ../../library/stdtypes.rst:3828 +#: ../../library/stdtypes.rst:3837 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -5274,40 +5286,40 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:3836 +#: ../../library/stdtypes.rst:3845 msgid "" "One-dimensional memoryviews can now be sliced. One-dimensional memoryviews " "with formats 'B', 'b' or 'c' are now :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:3840 +#: ../../library/stdtypes.rst:3849 msgid "" "memoryview is now registered automatically with :class:`collections.abc." "Sequence`" msgstr "" -#: ../../library/stdtypes.rst:3844 +#: ../../library/stdtypes.rst:3853 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:3847 +#: ../../library/stdtypes.rst:3856 msgid ":class:`memoryview` has several methods:" msgstr "" -#: ../../library/stdtypes.rst:3851 +#: ../../library/stdtypes.rst:3860 msgid "" "A memoryview and a :pep:`3118` exporter are equal if their shapes are " "equivalent and if all corresponding values are equal when the operands' " "respective format codes are interpreted using :mod:`struct` syntax." msgstr "" -#: ../../library/stdtypes.rst:3855 +#: ../../library/stdtypes.rst:3864 msgid "" "For the subset of :mod:`struct` format strings currently supported by :meth:" "`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == w.tolist()``::" msgstr "" -#: ../../library/stdtypes.rst:3858 +#: ../../library/stdtypes.rst:3867 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -5341,14 +5353,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:3874 +#: ../../library/stdtypes.rst:3883 msgid "" "If either format string is not supported by the :mod:`struct` module, then " "the objects will always compare as unequal (even if the format strings and " "buffer contents are identical)::" msgstr "" -#: ../../library/stdtypes.rst:3878 +#: ../../library/stdtypes.rst:3887 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -5374,25 +5386,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:3890 +#: ../../library/stdtypes.rst:3899 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:3893 +#: ../../library/stdtypes.rst:3902 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:3899 +#: ../../library/stdtypes.rst:3908 msgid "" "Return the data in the buffer as a bytestring. This is equivalent to " "calling the :class:`bytes` constructor on the memoryview. ::" msgstr "" -#: ../../library/stdtypes.rst:3902 +#: ../../library/stdtypes.rst:3911 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -5406,7 +5418,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:3908 +#: ../../library/stdtypes.rst:3917 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -5414,7 +5426,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:3913 +#: ../../library/stdtypes.rst:3922 msgid "" "*order* can be {'C', 'F', 'A'}. When *order* is 'C' or 'F', the data of the " "original array is converted to C or Fortran order. For contiguous views, 'A' " @@ -5423,13 +5435,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:3922 +#: ../../library/stdtypes.rst:3931 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:3925 +#: ../../library/stdtypes.rst:3934 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -5439,18 +5451,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:3931 +#: ../../library/stdtypes.rst:3940 msgid "" "Similar to :meth:`bytes.hex`, :meth:`memoryview.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:3938 +#: ../../library/stdtypes.rst:3947 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:3940 +#: ../../library/stdtypes.rst:3949 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -5468,19 +5480,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:3948 +#: ../../library/stdtypes.rst:3957 msgid "" ":meth:`tolist` now supports all single character native formats in :mod:" "`struct` module syntax as well as multi-dimensional representations." msgstr "" -#: ../../library/stdtypes.rst:3955 +#: ../../library/stdtypes.rst:3964 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:3958 +#: ../../library/stdtypes.rst:3967 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -5506,7 +5518,7 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:3974 +#: ../../library/stdtypes.rst:3983 msgid "" "Release the underlying buffer exposed by the memoryview object. Many " "objects take special actions when a view is held on them (for example, a :" @@ -5515,14 +5527,14 @@ msgid "" "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:3980 +#: ../../library/stdtypes.rst:3989 msgid "" "After this method has been called, any further operation on the view raises " "a :class:`ValueError` (except :meth:`release` itself which can be called " "multiple times)::" msgstr "" -#: ../../library/stdtypes.rst:3984 +#: ../../library/stdtypes.rst:3993 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -5538,13 +5550,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:3991 +#: ../../library/stdtypes.rst:4000 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:3994 +#: ../../library/stdtypes.rst:4003 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -5564,7 +5576,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4007 +#: ../../library/stdtypes.rst:4016 msgid "" "Cast a memoryview to a new format or shape. *shape* defaults to " "``[byte_length//new_itemsize]``, which means that the result view will be " @@ -5573,7 +5585,7 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4013 +#: ../../library/stdtypes.rst:4022 msgid "" "The destination format is restricted to a single element native format in :" "mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' or " @@ -5581,11 +5593,11 @@ msgid "" "Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4019 +#: ../../library/stdtypes.rst:4028 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4021 +#: ../../library/stdtypes.rst:4030 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -5629,11 +5641,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4042 +#: ../../library/stdtypes.rst:4051 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4044 +#: ../../library/stdtypes.rst:4053 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -5657,11 +5669,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4055 +#: ../../library/stdtypes.rst:4064 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4057 +#: ../../library/stdtypes.rst:4066 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -5711,11 +5723,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4081 +#: ../../library/stdtypes.rst:4090 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4083 +#: ../../library/stdtypes.rst:4092 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -5737,19 +5749,19 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4095 +#: ../../library/stdtypes.rst:4104 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4098 +#: ../../library/stdtypes.rst:4107 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4102 +#: ../../library/stdtypes.rst:4111 msgid "The underlying object of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4104 +#: ../../library/stdtypes.rst:4113 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -5761,14 +5773,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4113 +#: ../../library/stdtypes.rst:4122 msgid "" "``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is the " "amount of space in bytes that the array would use in a contiguous " "representation. It is not necessarily equal to ``len(m)``::" msgstr "" -#: ../../library/stdtypes.rst:4117 +#: ../../library/stdtypes.rst:4126 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -5800,11 +5812,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4132 +#: ../../library/stdtypes.rst:4141 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4134 +#: ../../library/stdtypes.rst:4143 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -5828,11 +5840,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4149 +#: ../../library/stdtypes.rst:4158 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4153 +#: ../../library/stdtypes.rst:4162 msgid "" "A string containing the format (in :mod:`struct` module style) for each " "element in the view. A memoryview can be created from exporters with " @@ -5840,17 +5852,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4158 +#: ../../library/stdtypes.rst:4167 msgid "" "format ``'B'`` is now handled according to the struct module syntax. This " "means that ``memoryview(b'abc')[0] == b'abc'[0] == 97``." msgstr "" -#: ../../library/stdtypes.rst:4164 +#: ../../library/stdtypes.rst:4173 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4166 +#: ../../library/stdtypes.rst:4175 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -5870,49 +5882,49 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:4177 +#: ../../library/stdtypes.rst:4186 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4182 +#: ../../library/stdtypes.rst:4191 msgid "" "A tuple of integers the length of :attr:`ndim` giving the shape of the " "memory as an N-dimensional array." msgstr "" -#: ../../library/stdtypes.rst:4185 ../../library/stdtypes.rst:4193 +#: ../../library/stdtypes.rst:4194 ../../library/stdtypes.rst:4202 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4190 +#: ../../library/stdtypes.rst:4199 msgid "" "A tuple of integers the length of :attr:`ndim` giving the size in bytes to " "access each element for each dimension of the array." msgstr "" -#: ../../library/stdtypes.rst:4198 +#: ../../library/stdtypes.rst:4207 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4202 +#: ../../library/stdtypes.rst:4211 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4208 +#: ../../library/stdtypes.rst:4217 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4214 +#: ../../library/stdtypes.rst:4223 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4222 +#: ../../library/stdtypes.rst:4231 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4226 +#: ../../library/stdtypes.rst:4235 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -5922,7 +5934,7 @@ msgid "" "`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4233 +#: ../../library/stdtypes.rst:4242 msgid "" "Like other collections, sets support ``x in set``, ``len(set)``, and ``for x " "in set``. Being an unordered collection, sets do not record element " @@ -5930,7 +5942,7 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4238 +#: ../../library/stdtypes.rst:4247 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " @@ -5942,18 +5954,18 @@ msgid "" "of another set." msgstr "" -#: ../../library/stdtypes.rst:4246 +#: ../../library/stdtypes.rst:4255 msgid "" "Non-empty sets (not frozensets) can be created by placing a comma-separated " "list of elements within braces, for example: ``{'jack', 'sjoerd'}``, in " "addition to the :class:`set` constructor." msgstr "" -#: ../../library/stdtypes.rst:4250 +#: ../../library/stdtypes.rst:4259 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4255 +#: ../../library/stdtypes.rst:4264 msgid "" "Return a new set or frozenset object whose elements are taken from " "*iterable*. The elements of a set must be :term:`hashable`. To represent " @@ -5961,92 +5973,92 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4261 +#: ../../library/stdtypes.rst:4270 msgid "Sets can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4263 +#: ../../library/stdtypes.rst:4272 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4264 +#: ../../library/stdtypes.rst:4273 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4265 +#: ../../library/stdtypes.rst:4274 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4267 +#: ../../library/stdtypes.rst:4276 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4272 +#: ../../library/stdtypes.rst:4281 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4276 +#: ../../library/stdtypes.rst:4285 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4280 +#: ../../library/stdtypes.rst:4289 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4284 +#: ../../library/stdtypes.rst:4293 msgid "" "Return ``True`` if the set has no elements in common with *other*. Sets are " "disjoint if and only if their intersection is the empty set." msgstr "" -#: ../../library/stdtypes.rst:4290 +#: ../../library/stdtypes.rst:4299 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4294 +#: ../../library/stdtypes.rst:4303 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4300 +#: ../../library/stdtypes.rst:4309 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4304 +#: ../../library/stdtypes.rst:4313 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4310 +#: ../../library/stdtypes.rst:4319 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4315 +#: ../../library/stdtypes.rst:4324 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4320 +#: ../../library/stdtypes.rst:4329 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4325 +#: ../../library/stdtypes.rst:4334 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4329 +#: ../../library/stdtypes.rst:4338 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4332 +#: ../../library/stdtypes.rst:4341 msgid "" "Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" "meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" @@ -6056,7 +6068,7 @@ msgid "" "the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4339 +#: ../../library/stdtypes.rst:4348 msgid "" "Both :class:`set` and :class:`frozenset` support set to set comparisons. Two " "sets are equal if and only if every element of each set is contained in the " @@ -6066,14 +6078,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4346 +#: ../../library/stdtypes.rst:4355 msgid "" "Instances of :class:`set` are compared to instances of :class:`frozenset` " "based on their members. For example, ``set('abc') == frozenset('abc')`` " "returns ``True`` and so does ``set('abc') in set([frozenset('abc')])``." msgstr "" -#: ../../library/stdtypes.rst:4350 +#: ../../library/stdtypes.rst:4359 msgid "" "The subset and equality comparisons do not generalize to a total ordering " "function. For example, any two nonempty disjoint sets are not equal and are " @@ -6081,71 +6093,71 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4355 +#: ../../library/stdtypes.rst:4364 msgid "" "Since sets only define partial ordering (subset relationships), the output " "of the :meth:`list.sort` method is undefined for lists of sets." msgstr "" -#: ../../library/stdtypes.rst:4358 +#: ../../library/stdtypes.rst:4367 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4360 +#: ../../library/stdtypes.rst:4369 msgid "" "Binary operations that mix :class:`set` instances with :class:`frozenset` " "return the type of the first operand. For example: ``frozenset('ab') | " "set('bc')`` returns an instance of :class:`frozenset`." msgstr "" -#: ../../library/stdtypes.rst:4364 +#: ../../library/stdtypes.rst:4373 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4370 +#: ../../library/stdtypes.rst:4379 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4375 +#: ../../library/stdtypes.rst:4384 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4380 +#: ../../library/stdtypes.rst:4389 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4385 +#: ../../library/stdtypes.rst:4394 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4389 +#: ../../library/stdtypes.rst:4398 msgid "Add element *elem* to the set." msgstr "" -#: ../../library/stdtypes.rst:4393 +#: ../../library/stdtypes.rst:4402 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4398 +#: ../../library/stdtypes.rst:4407 msgid "Remove element *elem* from the set if it is present." msgstr "" -#: ../../library/stdtypes.rst:4402 +#: ../../library/stdtypes.rst:4411 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4407 +#: ../../library/stdtypes.rst:4416 msgid "Remove all elements from the set." msgstr "" -#: ../../library/stdtypes.rst:4410 +#: ../../library/stdtypes.rst:4419 msgid "" "Note, the non-operator versions of the :meth:`update`, :meth:" "`intersection_update`, :meth:`difference_update`, and :meth:" @@ -6153,18 +6165,18 @@ msgid "" "argument." msgstr "" -#: ../../library/stdtypes.rst:4415 +#: ../../library/stdtypes.rst:4424 msgid "" "Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:" "`remove`, and :meth:`discard` methods may be a set. To support searching " "for an equivalent frozenset, a temporary one is created from *elem*." msgstr "" -#: ../../library/stdtypes.rst:4424 +#: ../../library/stdtypes.rst:4433 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4434 +#: ../../library/stdtypes.rst:4443 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -6173,7 +6185,7 @@ msgid "" "module.)" msgstr "" -#: ../../library/stdtypes.rst:4440 +#: ../../library/stdtypes.rst:4449 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -6182,33 +6194,33 @@ msgid "" "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:4451 +#: ../../library/stdtypes.rst:4460 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4454 +#: ../../library/stdtypes.rst:4463 msgid "Dictionaries can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4456 +#: ../../library/stdtypes.rst:4465 msgid "" "Use a comma-separated list of ``key: value`` pairs within braces: ``{'jack': " "4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4458 +#: ../../library/stdtypes.rst:4467 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4459 +#: ../../library/stdtypes.rst:4468 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:4462 +#: ../../library/stdtypes.rst:4471 msgid "" "If no positional argument is given, an empty dictionary is created. If a " "positional argument is given and it is a mapping object, a dictionary is " @@ -6220,7 +6232,7 @@ msgid "" "value for that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:4472 +#: ../../library/stdtypes.rst:4481 msgid "" "If keyword arguments are given, the keyword arguments and their values are " "added to the dictionary created from the positional argument. If a key " @@ -6228,13 +6240,13 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:4477 +#: ../../library/stdtypes.rst:4486 msgid "" "To illustrate, the following examples all return a dictionary equal to " "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:4480 +#: ../../library/stdtypes.rst:4489 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -6254,33 +6266,33 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:4489 +#: ../../library/stdtypes.rst:4498 msgid "" "Providing keyword arguments as in the first example only works for keys that " "are valid Python identifiers. Otherwise, any valid keys can be used." msgstr "" -#: ../../library/stdtypes.rst:4493 +#: ../../library/stdtypes.rst:4502 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:4498 +#: ../../library/stdtypes.rst:4507 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4502 +#: ../../library/stdtypes.rst:4511 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4506 +#: ../../library/stdtypes.rst:4515 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:4511 +#: ../../library/stdtypes.rst:4520 msgid "" "If a subclass of dict defines a method :meth:`__missing__` and *key* is not " "present, the ``d[key]`` operation calls that method with the key *key* as " @@ -6291,7 +6303,7 @@ msgid "" "an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:4519 +#: ../../library/stdtypes.rst:4528 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -6315,51 +6327,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:4530 +#: ../../library/stdtypes.rst:4539 msgid "" "The example above shows part of the implementation of :class:`collections." "Counter`. A different ``__missing__`` method is used by :class:`collections." "defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:4536 +#: ../../library/stdtypes.rst:4545 msgid "Set ``d[key]`` to *value*." msgstr "" -#: ../../library/stdtypes.rst:4540 +#: ../../library/stdtypes.rst:4549 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." msgstr "" -#: ../../library/stdtypes.rst:4545 +#: ../../library/stdtypes.rst:4554 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "" -#: ../../library/stdtypes.rst:4549 +#: ../../library/stdtypes.rst:4558 msgid "Equivalent to ``not key in d``." msgstr "" -#: ../../library/stdtypes.rst:4553 +#: ../../library/stdtypes.rst:4562 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4558 +#: ../../library/stdtypes.rst:4567 msgid "Remove all items from the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4562 +#: ../../library/stdtypes.rst:4571 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4566 +#: ../../library/stdtypes.rst:4575 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:4568 +#: ../../library/stdtypes.rst:4577 msgid "" ":meth:`fromkeys` is a class method that returns a new dictionary. *value* " "defaults to ``None``. All of the values refer to just a single instance, so " @@ -6368,70 +6380,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:4576 +#: ../../library/stdtypes.rst:4585 msgid "" "Return the value for *key* if *key* is in the dictionary, else *default*. If " "*default* is not given, it defaults to ``None``, so that this method never " "raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4582 +#: ../../library/stdtypes.rst:4591 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4587 +#: ../../library/stdtypes.rst:4596 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:4592 +#: ../../library/stdtypes.rst:4601 msgid "" "If *key* is in the dictionary, remove it and return its value, else return " "*default*. If *default* is not given and *key* is not in the dictionary, a :" "exc:`KeyError` is raised." msgstr "" -#: ../../library/stdtypes.rst:4598 +#: ../../library/stdtypes.rst:4607 msgid "" "Remove and return a ``(key, value)`` pair from the dictionary. Pairs are " "returned in :abbr:`LIFO (last-in, first-out)` order." msgstr "" -#: ../../library/stdtypes.rst:4601 +#: ../../library/stdtypes.rst:4610 msgid "" ":meth:`popitem` is useful to destructively iterate over a dictionary, as " "often used in set algorithms. If the dictionary is empty, calling :meth:" "`popitem` raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4605 +#: ../../library/stdtypes.rst:4614 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:4611 +#: ../../library/stdtypes.rst:4620 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4618 +#: ../../library/stdtypes.rst:4627 msgid "" "If *key* is in the dictionary, return its value. If not, insert *key* with " "a value of *default* and return *default*. *default* defaults to ``None``." msgstr "" -#: ../../library/stdtypes.rst:4624 +#: ../../library/stdtypes.rst:4633 msgid "" "Update the dictionary with the key/value pairs from *other*, overwriting " "existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:4627 +#: ../../library/stdtypes.rst:4636 msgid "" ":meth:`update` accepts either another dictionary object or an iterable of " "key/value pairs (as tuples or other iterables of length two). If keyword " @@ -6439,20 +6451,20 @@ msgid "" "pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:4634 +#: ../../library/stdtypes.rst:4643 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4637 +#: ../../library/stdtypes.rst:4646 msgid "" "An equality comparison between one ``dict.values()`` view and another will " "always return ``False``. This also applies when comparing ``dict.values()`` " "to itself::" msgstr "" -#: ../../library/stdtypes.rst:4641 +#: ../../library/stdtypes.rst:4650 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -6462,34 +6474,34 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:4647 +#: ../../library/stdtypes.rst:4656 msgid "" "Create a new dictionary with the merged keys and values of *d* and *other*, " "which must both be dictionaries. The values of *other* take priority when " "*d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4655 +#: ../../library/stdtypes.rst:4664 msgid "" "Update the dictionary *d* with keys and values from *other*, which may be " "either a :term:`mapping` or an :term:`iterable` of key/value pairs. The " "values of *other* take priority when *d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4661 +#: ../../library/stdtypes.rst:4670 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " "'>') raise :exc:`TypeError`." msgstr "" -#: ../../library/stdtypes.rst:4665 +#: ../../library/stdtypes.rst:4674 msgid "" "Dictionaries preserve insertion order. Note that updating a key does not " "affect the order. Keys added after deletion are inserted at the end. ::" msgstr "" -#: ../../library/stdtypes.rst:4668 +#: ../../library/stdtypes.rst:4677 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6521,17 +6533,17 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:4683 +#: ../../library/stdtypes.rst:4692 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:4687 +#: ../../library/stdtypes.rst:4696 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:4689 +#: ../../library/stdtypes.rst:4698 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6553,21 +6565,21 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:4699 +#: ../../library/stdtypes.rst:4708 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4704 +#: ../../library/stdtypes.rst:4713 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:4711 +#: ../../library/stdtypes.rst:4720 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:4713 +#: ../../library/stdtypes.rst:4722 msgid "" "The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" "`dict.items` are *view objects*. They provide a dynamic view on the " @@ -6575,23 +6587,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:4718 +#: ../../library/stdtypes.rst:4727 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:4723 +#: ../../library/stdtypes.rst:4732 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4727 +#: ../../library/stdtypes.rst:4736 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4730 +#: ../../library/stdtypes.rst:4739 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -6599,39 +6611,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:4735 +#: ../../library/stdtypes.rst:4744 msgid "" "Iterating views while adding or deleting entries in the dictionary may raise " "a :exc:`RuntimeError` or fail to iterate over all entries." msgstr "" -#: ../../library/stdtypes.rst:4738 +#: ../../library/stdtypes.rst:4747 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:4743 +#: ../../library/stdtypes.rst:4752 msgid "" "Return ``True`` if *x* is in the underlying dictionary's keys, values or " "items (in the latter case, *x* should be a ``(key, value)`` tuple)." msgstr "" -#: ../../library/stdtypes.rst:4748 +#: ../../library/stdtypes.rst:4757 msgid "" "Return a reverse iterator over the keys, values or items of the dictionary. " "The view will be iterated in reverse order of the insertion." msgstr "" -#: ../../library/stdtypes.rst:4751 +#: ../../library/stdtypes.rst:4760 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4756 +#: ../../library/stdtypes.rst:4765 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:4761 +#: ../../library/stdtypes.rst:4770 msgid "" "Keys views are set-like since their entries are unique and :term:`hashable`. " "Items views also have set-like operations since the (key, value) pairs are " @@ -6645,11 +6657,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:4773 +#: ../../library/stdtypes.rst:4782 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:4775 +#: ../../library/stdtypes.rst:4784 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -6690,11 +6702,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:4817 +#: ../../library/stdtypes.rst:4826 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:4824 +#: ../../library/stdtypes.rst:4833 msgid "" "Python's :keyword:`with` statement supports the concept of a runtime context " "defined by a context manager. This is implemented using a pair of methods " @@ -6705,7 +6717,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:4832 +#: ../../library/stdtypes.rst:4841 msgid "" "Enter the runtime context and return either this object or another object " "related to the runtime context. The value returned by this method is bound " @@ -6716,7 +6728,7 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:4837 +#: ../../library/stdtypes.rst:4846 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to allow :func:" @@ -6725,7 +6737,7 @@ msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:4841 +#: ../../library/stdtypes.rst:4850 msgid "" "An example of a context manager that returns a related object is the one " "returned by :func:`decimal.localcontext`. These managers set the active " @@ -6739,7 +6751,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的當前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:4851 +#: ../../library/stdtypes.rst:4860 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -6751,7 +6763,7 @@ msgstr "" "keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:4856 +#: ../../library/stdtypes.rst:4865 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -6766,7 +6778,7 @@ msgstr "" "(propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體中發生" "的任何例外。" -#: ../../library/stdtypes.rst:4863 +#: ../../library/stdtypes.rst:4872 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -6778,7 +6790,7 @@ msgstr "" "已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" "`__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:4869 +#: ../../library/stdtypes.rst:4878 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -6790,7 +6802,7 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:4875 +#: ../../library/stdtypes.rst:4884 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -6805,7 +6817,7 @@ msgstr "" "`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" "理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:4882 +#: ../../library/stdtypes.rst:4891 msgid "" "Note that there is no specific slot for any of these methods in the type " "structure for Python objects in the Python/C API. Extension types wanting to " @@ -6817,7 +6829,7 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:4890 +#: ../../library/stdtypes.rst:4899 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" @@ -6825,7 +6837,7 @@ msgstr "" "型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" "ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:4895 +#: ../../library/stdtypes.rst:4904 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." @@ -6833,11 +6845,11 @@ msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:4902 +#: ../../library/stdtypes.rst:4911 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:4908 +#: ../../library/stdtypes.rst:4917 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -6852,7 +6864,7 @@ msgstr "" "物件,它是透過使用引數 :class:`int` 來下標 ``list`` 類別而建立的。" "``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使用。" -#: ../../library/stdtypes.rst:4918 +#: ../../library/stdtypes.rst:4927 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -6860,7 +6872,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:4921 +#: ../../library/stdtypes.rst:4930 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -6868,7 +6880,7 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:4924 +#: ../../library/stdtypes.rst:4933 msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " @@ -6880,7 +6892,7 @@ msgstr "" "物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" "`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:4930 +#: ../../library/stdtypes.rst:4939 msgid "" "For a class which defines :meth:`~object.__class_getitem__` but is not a " "container, the argument(s) supplied to a subscription of the class will " @@ -6892,7 +6904,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:4936 +#: ../../library/stdtypes.rst:4945 msgid "" "If ``x = re.search('foo', 'foo')``, ``x`` will be a :ref:`re.Match ` object where the return values of ``x.group(0)`` and ``x[0]`` will " @@ -6904,7 +6916,7 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:4942 +#: ../../library/stdtypes.rst:4951 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " "``y`` will also be an instance of ``re.Match``, but the return values of ``y." @@ -6917,7 +6929,7 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:4948 +#: ../../library/stdtypes.rst:4957 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " @@ -6926,7 +6938,7 @@ msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:4954 +#: ../../library/stdtypes.rst:4963 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " @@ -6936,7 +6948,7 @@ msgstr "" "所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" "class:`list`: ::" -#: ../../library/stdtypes.rst:4959 +#: ../../library/stdtypes.rst:4968 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -6944,7 +6956,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:4962 +#: ../../library/stdtypes.rst:4971 msgid "" "Another example for :term:`mapping` objects, using a :class:`dict`, which is " "a generic type expecting two type parameters representing the key type and " @@ -6955,7 +6967,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:4967 +#: ../../library/stdtypes.rst:4976 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -6963,7 +6975,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:4970 +#: ../../library/stdtypes.rst:4979 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -6971,7 +6983,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:4973 +#: ../../library/stdtypes.rst:4982 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -6983,7 +6995,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:4978 +#: ../../library/stdtypes.rst:4987 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -6995,7 +7007,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:4984 +#: ../../library/stdtypes.rst:4993 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -7005,13 +7017,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:4988 +#: ../../library/stdtypes.rst:4997 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:4991 +#: ../../library/stdtypes.rst:5000 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -7029,13 +7041,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:4999 +#: ../../library/stdtypes.rst:5008 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5001 +#: ../../library/stdtypes.rst:5010 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -7049,7 +7061,7 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5007 +#: ../../library/stdtypes.rst:5016 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" @@ -7057,7 +7069,7 @@ msgstr "" "為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." "__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5010 +#: ../../library/stdtypes.rst:5019 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -7069,7 +7081,7 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5015 +#: ../../library/stdtypes.rst:5024 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " @@ -7079,7 +7091,7 @@ msgstr "" "的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." "__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5019 +#: ../../library/stdtypes.rst:5028 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -7091,245 +7103,245 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5026 +#: ../../library/stdtypes.rst:5035 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5028 +#: ../../library/stdtypes.rst:5037 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5031 +#: ../../library/stdtypes.rst:5040 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5032 +#: ../../library/stdtypes.rst:5041 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5033 +#: ../../library/stdtypes.rst:5042 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5034 +#: ../../library/stdtypes.rst:5043 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5035 +#: ../../library/stdtypes.rst:5044 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5036 +#: ../../library/stdtypes.rst:5045 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5037 +#: ../../library/stdtypes.rst:5046 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5038 +#: ../../library/stdtypes.rst:5047 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5039 +#: ../../library/stdtypes.rst:5048 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5040 +#: ../../library/stdtypes.rst:5049 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5041 +#: ../../library/stdtypes.rst:5050 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5042 +#: ../../library/stdtypes.rst:5051 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5043 +#: ../../library/stdtypes.rst:5052 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5044 +#: ../../library/stdtypes.rst:5053 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5045 +#: ../../library/stdtypes.rst:5054 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5046 +#: ../../library/stdtypes.rst:5055 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5047 +#: ../../library/stdtypes.rst:5056 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5048 +#: ../../library/stdtypes.rst:5057 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5049 +#: ../../library/stdtypes.rst:5058 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5050 +#: ../../library/stdtypes.rst:5059 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5051 +#: ../../library/stdtypes.rst:5060 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5052 +#: ../../library/stdtypes.rst:5061 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5053 +#: ../../library/stdtypes.rst:5062 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5054 +#: ../../library/stdtypes.rst:5063 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5055 +#: ../../library/stdtypes.rst:5064 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5056 +#: ../../library/stdtypes.rst:5065 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5057 +#: ../../library/stdtypes.rst:5066 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5058 +#: ../../library/stdtypes.rst:5067 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5059 +#: ../../library/stdtypes.rst:5068 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5060 +#: ../../library/stdtypes.rst:5069 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5061 +#: ../../library/stdtypes.rst:5070 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5062 +#: ../../library/stdtypes.rst:5071 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5063 +#: ../../library/stdtypes.rst:5072 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5064 +#: ../../library/stdtypes.rst:5073 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5065 +#: ../../library/stdtypes.rst:5074 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5066 +#: ../../library/stdtypes.rst:5075 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5067 +#: ../../library/stdtypes.rst:5076 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5068 +#: ../../library/stdtypes.rst:5077 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5069 +#: ../../library/stdtypes.rst:5078 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5070 +#: ../../library/stdtypes.rst:5079 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5071 +#: ../../library/stdtypes.rst:5080 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5072 +#: ../../library/stdtypes.rst:5081 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5073 +#: ../../library/stdtypes.rst:5082 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5074 +#: ../../library/stdtypes.rst:5083 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5075 +#: ../../library/stdtypes.rst:5084 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5076 +#: ../../library/stdtypes.rst:5085 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5077 +#: ../../library/stdtypes.rst:5086 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5078 +#: ../../library/stdtypes.rst:5087 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5079 +#: ../../library/stdtypes.rst:5088 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5080 +#: ../../library/stdtypes.rst:5089 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5081 +#: ../../library/stdtypes.rst:5090 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5082 +#: ../../library/stdtypes.rst:5091 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5083 +#: ../../library/stdtypes.rst:5092 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5084 +#: ../../library/stdtypes.rst:5093 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5089 +#: ../../library/stdtypes.rst:5098 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5091 +#: ../../library/stdtypes.rst:5100 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5095 +#: ../../library/stdtypes.rst:5104 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5097 +#: ../../library/stdtypes.rst:5106 msgid "" ">>> list[int].__origin__\n" "" @@ -7337,7 +7349,7 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5103 +#: ../../library/stdtypes.rst:5112 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " @@ -7346,7 +7358,7 @@ msgstr "" "此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" "class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5107 +#: ../../library/stdtypes.rst:5116 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -7354,7 +7366,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5113 +#: ../../library/stdtypes.rst:5122 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -7362,7 +7374,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5116 +#: ../../library/stdtypes.rst:5125 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -7376,7 +7388,7 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5124 +#: ../../library/stdtypes.rst:5133 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." @@ -7386,7 +7398,7 @@ msgstr "" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5131 +#: ../../library/stdtypes.rst:5140 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." @@ -7394,19 +7406,19 @@ msgstr "" "如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" "`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5139 +#: ../../library/stdtypes.rst:5148 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5140 +#: ../../library/stdtypes.rst:5149 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5142 +#: ../../library/stdtypes.rst:5151 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5143 +#: ../../library/stdtypes.rst:5152 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." @@ -7415,7 +7427,7 @@ msgstr "" "引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" "`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5147 +#: ../../library/stdtypes.rst:5156 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" @@ -7423,18 +7435,18 @@ msgstr "" ":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" "`typing.Generic`" -#: ../../library/stdtypes.rst:5148 +#: ../../library/stdtypes.rst:5157 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" "有關如何實作可以在 runtime 參數化並能被靜態型別檢查器理解的泛型類別的文件。" -#: ../../library/stdtypes.rst:5157 +#: ../../library/stdtypes.rst:5166 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5163 +#: ../../library/stdtypes.rst:5172 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -7447,7 +7459,7 @@ msgstr "" "釋 (type annotation) `。與 :data:`typing.Union` 相比,聯合型別運" "算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5170 +#: ../../library/stdtypes.rst:5179 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " @@ -7458,7 +7470,7 @@ msgstr "" "``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" "class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5175 +#: ../../library/stdtypes.rst:5184 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -7466,7 +7478,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5180 +#: ../../library/stdtypes.rst:5189 msgid "" "The ``|`` operand cannot be used at runtime to define unions where one or " "more members is a forward reference. For example, ``int | \"Foo\"``, where " @@ -7479,58 +7491,58 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5188 +#: ../../library/stdtypes.rst:5197 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5190 +#: ../../library/stdtypes.rst:5199 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5192 +#: ../../library/stdtypes.rst:5201 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5194 +#: ../../library/stdtypes.rst:5203 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5196 +#: ../../library/stdtypes.rst:5205 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5198 +#: ../../library/stdtypes.rst:5207 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5200 +#: ../../library/stdtypes.rst:5209 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5202 +#: ../../library/stdtypes.rst:5211 msgid "It is compatible with :data:`typing.Union`::" msgstr "它與 :data:`typing.Union` 相容: ::" -#: ../../library/stdtypes.rst:5204 +#: ../../library/stdtypes.rst:5213 msgid "int | str == typing.Union[int, str]" msgstr "int | str == typing.Union[int, str]" -#: ../../library/stdtypes.rst:5206 +#: ../../library/stdtypes.rst:5215 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:5217 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5213 +#: ../../library/stdtypes.rst:5222 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5216 +#: ../../library/stdtypes.rst:5225 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -7538,14 +7550,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5219 +#: ../../library/stdtypes.rst:5228 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5222 +#: ../../library/stdtypes.rst:5231 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -7555,7 +7567,7 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5229 +#: ../../library/stdtypes.rst:5238 msgid "" "The user-exposed type for the union object can be accessed from :data:`types." "UnionType` and used for :func:`isinstance` checks. An object cannot be " @@ -7564,7 +7576,7 @@ msgstr "" "構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`types." "UnionType` 存取並用於 :func:`isinstance` 檢查。物件不能以型別來實例化: ::" -#: ../../library/stdtypes.rst:5233 +#: ../../library/stdtypes.rst:5242 msgid "" ">>> import types\n" ">>> isinstance(int | str, types.UnionType)\n" @@ -7582,7 +7594,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'types.UnionType' instances" -#: ../../library/stdtypes.rst:5242 +#: ../../library/stdtypes.rst:5251 msgid "" "The :meth:`!__or__` method for type objects was added to support the syntax " "``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may " @@ -7591,7 +7603,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5246 +#: ../../library/stdtypes.rst:5255 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -7617,25 +7629,25 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5262 +#: ../../library/stdtypes.rst:5271 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5270 +#: ../../library/stdtypes.rst:5279 msgid "Other Built-in Types" msgstr "" -#: ../../library/stdtypes.rst:5272 +#: ../../library/stdtypes.rst:5281 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5279 +#: ../../library/stdtypes.rst:5288 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5281 +#: ../../library/stdtypes.rst:5290 msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " @@ -7646,7 +7658,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5288 +#: ../../library/stdtypes.rst:5297 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -7657,32 +7669,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:5296 +#: ../../library/stdtypes.rst:5305 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5304 +#: ../../library/stdtypes.rst:5313 msgid "Classes and Class Instances" msgstr "" -#: ../../library/stdtypes.rst:5306 +#: ../../library/stdtypes.rst:5315 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "" -#: ../../library/stdtypes.rst:5312 +#: ../../library/stdtypes.rst:5321 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5314 +#: ../../library/stdtypes.rst:5323 msgid "" "Function objects are created by function definitions. The only operation on " "a function object is to call it: ``func(argument-list)``." msgstr "" -#: ../../library/stdtypes.rst:5317 +#: ../../library/stdtypes.rst:5326 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -7690,15 +7702,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5321 +#: ../../library/stdtypes.rst:5330 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5327 +#: ../../library/stdtypes.rst:5336 msgid "Methods" msgstr "" -#: ../../library/stdtypes.rst:5331 +#: ../../library/stdtypes.rst:5340 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such as :meth:" @@ -7706,7 +7718,7 @@ msgid "" "Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5336 +#: ../../library/stdtypes.rst:5345 msgid "" "If you access a method (a function defined in a class namespace) through an " "instance, you get a special object: a :dfn:`bound method` (also called :ref:" @@ -7719,7 +7731,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5347 +#: ../../library/stdtypes.rst:5356 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -7730,7 +7742,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5355 +#: ../../library/stdtypes.rst:5364 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -7758,15 +7770,15 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5370 +#: ../../library/stdtypes.rst:5379 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5378 +#: ../../library/stdtypes.rst:5387 msgid "Code Objects" msgstr "" -#: ../../library/stdtypes.rst:5384 +#: ../../library/stdtypes.rst:5393 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -7776,7 +7788,7 @@ msgid "" "`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5391 +#: ../../library/stdtypes.rst:5400 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -7785,21 +7797,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5398 +#: ../../library/stdtypes.rst:5407 msgid "" "A code object can be executed or evaluated by passing it (instead of a " "source string) to the :func:`exec` or :func:`eval` built-in functions." msgstr "" -#: ../../library/stdtypes.rst:5401 +#: ../../library/stdtypes.rst:5410 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5407 +#: ../../library/stdtypes.rst:5416 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5413 +#: ../../library/stdtypes.rst:5422 msgid "" "Type objects represent the various object types. An object's type is " "accessed by the built-in function :func:`type`. There are no special " @@ -7807,30 +7819,30 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5418 +#: ../../library/stdtypes.rst:5427 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5424 +#: ../../library/stdtypes.rst:5433 msgid "The Null Object" msgstr "" -#: ../../library/stdtypes.rst:5426 +#: ../../library/stdtypes.rst:5435 msgid "" "This object is returned by functions that don't explicitly return a value. " "It supports no special operations. There is exactly one null object, named " "``None`` (a built-in name). ``type(None)()`` produces the same singleton." msgstr "" -#: ../../library/stdtypes.rst:5430 +#: ../../library/stdtypes.rst:5439 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5437 +#: ../../library/stdtypes.rst:5446 msgid "The Ellipsis Object" msgstr "" -#: ../../library/stdtypes.rst:5439 +#: ../../library/stdtypes.rst:5448 msgid "" "This object is commonly used by slicing (see :ref:`slicings`). It supports " "no special operations. There is exactly one ellipsis object, named :const:" @@ -7838,15 +7850,15 @@ msgid "" "`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5444 +#: ../../library/stdtypes.rst:5453 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:5450 +#: ../../library/stdtypes.rst:5459 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:5452 +#: ../../library/stdtypes.rst:5461 msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " @@ -7854,84 +7866,84 @@ msgid "" "`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5457 +#: ../../library/stdtypes.rst:5466 msgid "It is written as :code:`NotImplemented`." msgstr "" -#: ../../library/stdtypes.rst:5463 +#: ../../library/stdtypes.rst:5472 msgid "Internal Objects" msgstr "" -#: ../../library/stdtypes.rst:5465 +#: ../../library/stdtypes.rst:5474 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:5473 +#: ../../library/stdtypes.rst:5482 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:5475 +#: ../../library/stdtypes.rst:5484 msgid "" "The implementation adds a few special read-only attributes to several object " "types, where they are relevant. Some of these are not reported by the :func:" "`dir` built-in function." msgstr "" -#: ../../library/stdtypes.rst:5482 +#: ../../library/stdtypes.rst:5491 msgid "" "A dictionary or other mapping object used to store an object's (writable) " "attributes." msgstr "" -#: ../../library/stdtypes.rst:5488 +#: ../../library/stdtypes.rst:5497 msgid "The class to which a class instance belongs." msgstr "" -#: ../../library/stdtypes.rst:5493 +#: ../../library/stdtypes.rst:5502 msgid "The tuple of base classes of a class object." msgstr "" -#: ../../library/stdtypes.rst:5498 +#: ../../library/stdtypes.rst:5507 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5504 +#: ../../library/stdtypes.rst:5513 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5512 +#: ../../library/stdtypes.rst:5521 msgid "" "The :ref:`type parameters ` of generic classes, functions, and :" "ref:`type aliases `." msgstr "" -#: ../../library/stdtypes.rst:5520 +#: ../../library/stdtypes.rst:5529 msgid "" "This attribute is a tuple of classes that are considered when looking for " "base classes during method resolution." msgstr "" -#: ../../library/stdtypes.rst:5526 +#: ../../library/stdtypes.rst:5535 msgid "" "This method can be overridden by a metaclass to customize the method " "resolution order for its instances. It is called at class instantiation, " "and its result is stored in :attr:`~class.__mro__`." msgstr "" -#: ../../library/stdtypes.rst:5533 +#: ../../library/stdtypes.rst:5542 msgid "" "Each class keeps a list of weak references to its immediate subclasses. " "This method returns a list of all those references still alive. The list is " "in definition order. Example::" msgstr "" -#: ../../library/stdtypes.rst:5537 +#: ../../library/stdtypes.rst:5546 msgid "" ">>> int.__subclasses__()\n" "[, , , , , , ]" -#: ../../library/stdtypes.rst:5544 +#: ../../library/stdtypes.rst:5552 +msgid "" +"A tuple containing names of attributes of this class which are accessed " +"through ``self.X`` from any function in its body." +msgstr "" + +#: ../../library/stdtypes.rst:5560 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:5546 +#: ../../library/stdtypes.rst:5562 msgid "" "CPython has a global limit for converting between :class:`int` and :class:" "`str` to mitigate denial of service attacks. This limit *only* applies to " @@ -7953,7 +7971,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:5551 +#: ../../library/stdtypes.rst:5567 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -7963,24 +7981,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:5558 +#: ../../library/stdtypes.rst:5574 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:5560 +#: ../../library/stdtypes.rst:5576 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" -#: ../../library/stdtypes.rst:5564 +#: ../../library/stdtypes.rst:5580 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:5566 +#: ../../library/stdtypes.rst:5582 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -8004,7 +8022,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:5586 +#: ../../library/stdtypes.rst:5602 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -8012,11 +8030,11 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:5591 +#: ../../library/stdtypes.rst:5607 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:5593 +#: ../../library/stdtypes.rst:5609 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8027,84 +8045,84 @@ msgid "" "..." msgstr "" -#: ../../library/stdtypes.rst:5606 +#: ../../library/stdtypes.rst:5622 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:5608 +#: ../../library/stdtypes.rst:5624 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:5611 +#: ../../library/stdtypes.rst:5627 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:5612 +#: ../../library/stdtypes.rst:5628 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:5613 +#: ../../library/stdtypes.rst:5629 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:5614 +#: ../../library/stdtypes.rst:5630 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:5615 +#: ../../library/stdtypes.rst:5631 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:5618 +#: ../../library/stdtypes.rst:5634 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:5620 +#: ../../library/stdtypes.rst:5636 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:5621 +#: ../../library/stdtypes.rst:5637 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:5622 +#: ../../library/stdtypes.rst:5638 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:5623 +#: ../../library/stdtypes.rst:5639 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:5624 +#: ../../library/stdtypes.rst:5640 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:5625 +#: ../../library/stdtypes.rst:5641 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:5628 +#: ../../library/stdtypes.rst:5644 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:5630 +#: ../../library/stdtypes.rst:5646 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" -#: ../../library/stdtypes.rst:5633 +#: ../../library/stdtypes.rst:5649 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" -#: ../../library/stdtypes.rst:5636 +#: ../../library/stdtypes.rst:5652 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -8112,7 +8130,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:5638 +#: ../../library/stdtypes.rst:5654 msgid "" ":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" "`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " @@ -8121,38 +8139,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:5644 +#: ../../library/stdtypes.rst:5660 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:5647 +#: ../../library/stdtypes.rst:5663 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" -#: ../../library/stdtypes.rst:5651 +#: ../../library/stdtypes.rst:5667 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:5653 +#: ../../library/stdtypes.rst:5669 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:5655 +#: ../../library/stdtypes.rst:5671 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" -#: ../../library/stdtypes.rst:5662 +#: ../../library/stdtypes.rst:5678 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -8164,7 +8182,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:5671 +#: ../../library/stdtypes.rst:5687 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " @@ -8172,11 +8190,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:5677 +#: ../../library/stdtypes.rst:5693 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:5679 +#: ../../library/stdtypes.rst:5695 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " @@ -8184,11 +8202,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:5684 +#: ../../library/stdtypes.rst:5700 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:5686 +#: ../../library/stdtypes.rst:5702 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -8201,38 +8219,38 @@ msgid "" "... sys.set_int_max_str_digits(lower_bound)" msgstr "" -#: ../../library/stdtypes.rst:5696 +#: ../../library/stdtypes.rst:5712 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:5700 +#: ../../library/stdtypes.rst:5716 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:5701 +#: ../../library/stdtypes.rst:5717 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5704 +#: ../../library/stdtypes.rst:5720 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5707 +#: ../../library/stdtypes.rst:5723 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5709 +#: ../../library/stdtypes.rst:5725 msgid "" "Cased characters are those with general category property being one of " "\"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:5712 +#: ../../library/stdtypes.rst:5728 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -8245,13 +8263,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:316 #: ../../library/stdtypes.rst:393 ../../library/stdtypes.rst:950 #: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:1139 -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4426 -#: ../../library/stdtypes.rst:5409 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:5418 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1154 -#: ../../library/stdtypes.rst:4426 +#: ../../library/stdtypes.rst:4435 msgid "statement" msgstr "statement(陳述式)" @@ -8373,11 +8391,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:1260 #: ../../library/stdtypes.rst:1339 ../../library/stdtypes.rst:1383 #: ../../library/stdtypes.rst:1504 ../../library/stdtypes.rst:1540 -#: ../../library/stdtypes.rst:2517 ../../library/stdtypes.rst:2536 -#: ../../library/stdtypes.rst:2643 ../../library/stdtypes.rst:4224 -#: ../../library/stdtypes.rst:4426 ../../library/stdtypes.rst:4904 -#: ../../library/stdtypes.rst:5159 ../../library/stdtypes.rst:5329 -#: ../../library/stdtypes.rst:5373 +#: ../../library/stdtypes.rst:2526 ../../library/stdtypes.rst:2545 +#: ../../library/stdtypes.rst:2652 ../../library/stdtypes.rst:4233 +#: ../../library/stdtypes.rst:4435 ../../library/stdtypes.rst:4913 +#: ../../library/stdtypes.rst:5168 ../../library/stdtypes.rst:5338 +#: ../../library/stdtypes.rst:5382 msgid "object" msgstr "object(物件)" @@ -8469,9 +8487,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:950 -#: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4426 -#: ../../library/stdtypes.rst:5380 ../../library/stdtypes.rst:5394 -#: ../../library/stdtypes.rst:5409 +#: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:5389 ../../library/stdtypes.rst:5403 +#: ../../library/stdtypes.rst:5418 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -8487,8 +8505,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2393 -#: ../../library/stdtypes.rst:3612 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2402 +#: ../../library/stdtypes.rst:3621 msgid "+ (plus)" msgstr "+ (加號)" @@ -8500,13 +8518,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2393 -#: ../../library/stdtypes.rst:3612 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2402 +#: ../../library/stdtypes.rst:3621 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2350 -#: ../../library/stdtypes.rst:3569 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2359 +#: ../../library/stdtypes.rst:3578 msgid "* (asterisk)" msgstr "* (星號)" @@ -8518,8 +8536,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2320 -#: ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:3546 msgid "% (percent)" msgstr "% (百分號)" @@ -8529,7 +8547,7 @@ msgstr "**" #: ../../library/stdtypes.rst:316 ../../library/stdtypes.rst:393 #: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:1154 -#: ../../library/stdtypes.rst:4426 +#: ../../library/stdtypes.rst:4435 msgid "operations on" msgstr "operations on(操作於)" @@ -8538,7 +8556,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:335 ../../library/stdtypes.rst:1606 -#: ../../library/stdtypes.rst:2517 ../../library/stdtypes.rst:5409 +#: ../../library/stdtypes.rst:2526 ../../library/stdtypes.rst:5418 msgid "module" msgstr "模組" @@ -8606,7 +8624,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4819 +#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4828 msgid "protocol" msgstr "protocol(協定)" @@ -8632,7 +8650,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4426 +#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4435 msgid "len" msgstr "len" @@ -8709,14 +8727,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:2517 -#: ../../library/stdtypes.rst:2643 ../../library/stdtypes.rst:2715 -#: ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:2526 +#: ../../library/stdtypes.rst:2652 ../../library/stdtypes.rst:2724 +#: ../../library/stdtypes.rst:3546 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4426 -#: ../../library/stdtypes.rst:5159 ../../library/stdtypes.rst:5409 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:5168 ../../library/stdtypes.rst:5418 msgid "type" msgstr "type(型別)" @@ -8724,7 +8742,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4426 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 msgid "del" msgstr "del" @@ -8765,7 +8783,7 @@ msgid "range" msgstr "range" #: ../../library/stdtypes.rst:1504 ../../library/stdtypes.rst:1553 -#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2320 +#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2323 msgid "string" msgstr "string(字串)" @@ -8786,17 +8804,17 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2509 +#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2518 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2517 -#: ../../library/stdtypes.rst:2536 ../../library/stdtypes.rst:2715 -#: ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2526 +#: ../../library/stdtypes.rst:2545 ../../library/stdtypes.rst:2724 +#: ../../library/stdtypes.rst:3546 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2715 +#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2724 msgid "methods" msgstr "methods(方法)" @@ -8804,183 +8822,183 @@ msgstr "methods(方法)" msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2128 ../../library/stdtypes.rst:3391 +#: ../../library/stdtypes.rst:2131 ../../library/stdtypes.rst:3400 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/stdtypes.rst:2128 +#: ../../library/stdtypes.rst:2131 msgid "str.splitlines method" msgstr "str.splitlines 方法" -#: ../../library/stdtypes.rst:2320 +#: ../../library/stdtypes.rst:2323 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:2320 +#: ../../library/stdtypes.rst:2323 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:2320 +#: ../../library/stdtypes.rst:2323 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:2320 +#: ../../library/stdtypes.rst:2323 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:2320 ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:2323 ../../library/stdtypes.rst:3546 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:2320 ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:2323 ../../library/stdtypes.rst:3546 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:2350 ../../library/stdtypes.rst:3569 +#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:3578 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:2350 ../../library/stdtypes.rst:2393 -#: ../../library/stdtypes.rst:3569 ../../library/stdtypes.rst:3612 +#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:2402 +#: ../../library/stdtypes.rst:3578 ../../library/stdtypes.rst:3621 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:2350 ../../library/stdtypes.rst:3569 +#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:3578 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:2393 ../../library/stdtypes.rst:3612 +#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:3621 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:2393 ../../library/stdtypes.rst:3612 +#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:3621 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:2509 +#: ../../library/stdtypes.rst:2518 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:2517 +#: ../../library/stdtypes.rst:2526 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:2517 +#: ../../library/stdtypes.rst:2526 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:3391 +#: ../../library/stdtypes.rst:3400 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:3391 +#: ../../library/stdtypes.rst:3400 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:3546 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:3546 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:3546 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:3546 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4224 +#: ../../library/stdtypes.rst:4233 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:4426 +#: ../../library/stdtypes.rst:4435 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:4426 +#: ../../library/stdtypes.rst:4435 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:4509 +#: ../../library/stdtypes.rst:4518 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:4819 +#: ../../library/stdtypes.rst:4828 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:4819 +#: ../../library/stdtypes.rst:4828 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:4819 +#: ../../library/stdtypes.rst:4828 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:4892 +#: ../../library/stdtypes.rst:4901 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:4892 +#: ../../library/stdtypes.rst:4901 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:4904 +#: ../../library/stdtypes.rst:4913 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:4904 +#: ../../library/stdtypes.rst:4913 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:4904 +#: ../../library/stdtypes.rst:4913 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5159 +#: ../../library/stdtypes.rst:5168 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5159 +#: ../../library/stdtypes.rst:5168 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5329 +#: ../../library/stdtypes.rst:5338 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5373 +#: ../../library/stdtypes.rst:5382 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5373 +#: ../../library/stdtypes.rst:5382 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5380 +#: ../../library/stdtypes.rst:5389 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5380 +#: ../../library/stdtypes.rst:5389 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5394 +#: ../../library/stdtypes.rst:5403 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5394 +#: ../../library/stdtypes.rst:5403 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5433 +#: ../../library/stdtypes.rst:5442 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5433 +#: ../../library/stdtypes.rst:5442 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" diff --git a/library/struct.po b/library/struct.po index 4ba997ca45..812644b7bc 100644 --- a/library/struct.po +++ b/library/struct.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,11 +22,11 @@ msgstr "" msgid ":mod:`!struct` --- Interpret bytes as packed binary data" msgstr ":mod:`!struct` --- 將位元組直譯為打包起來的二進位資料" -#: ../../library/struct.rst:7 +#: ../../library/struct.rst:11 msgid "**Source code:** :source:`Lib/struct.py`" msgstr "**原始碼:**\\ :source:`Lib/struct.py`" -#: ../../library/struct.rst:15 +#: ../../library/struct.rst:19 msgid "" "This module converts between Python values and C structs represented as " "Python :class:`bytes` objects. Compact :ref:`format strings `, which " @@ -138,11 +138,11 @@ msgid "" "characters which describe the actual data values and padding." msgstr "" -#: ../../library/struct.rst:121 +#: ../../library/struct.rst:125 msgid "Byte Order, Size, and Alignment" msgstr "" -#: ../../library/struct.rst:123 +#: ../../library/struct.rst:127 msgid "" "By default, C types are represented in the machine's native format and byte " "order, and properly aligned by skipping pad bytes if necessary (according to " @@ -152,98 +152,98 @@ msgid "" "standard formats depends on the application." msgstr "" -#: ../../library/struct.rst:139 +#: ../../library/struct.rst:143 msgid "" "Alternatively, the first character of the format string can be used to " "indicate the byte order, size and alignment of the packed data, according to " "the following table:" msgstr "" -#: ../../library/struct.rst:144 +#: ../../library/struct.rst:148 msgid "Character" msgstr "" -#: ../../library/struct.rst:144 +#: ../../library/struct.rst:148 msgid "Byte order" msgstr "" -#: ../../library/struct.rst:144 +#: ../../library/struct.rst:148 msgid "Size" msgstr "" -#: ../../library/struct.rst:144 +#: ../../library/struct.rst:148 msgid "Alignment" msgstr "" -#: ../../library/struct.rst:146 +#: ../../library/struct.rst:150 msgid "``@``" msgstr "``@``" -#: ../../library/struct.rst:146 ../../library/struct.rst:148 +#: ../../library/struct.rst:150 ../../library/struct.rst:152 msgid "native" msgstr "" -#: ../../library/struct.rst:148 +#: ../../library/struct.rst:152 msgid "``=``" msgstr "``=``" -#: ../../library/struct.rst:148 ../../library/struct.rst:150 #: ../../library/struct.rst:152 ../../library/struct.rst:154 +#: ../../library/struct.rst:156 ../../library/struct.rst:158 msgid "standard" msgstr "" -#: ../../library/struct.rst:148 ../../library/struct.rst:150 #: ../../library/struct.rst:152 ../../library/struct.rst:154 +#: ../../library/struct.rst:156 ../../library/struct.rst:158 msgid "none" msgstr "" -#: ../../library/struct.rst:150 +#: ../../library/struct.rst:154 msgid "``<``" msgstr "``<``" -#: ../../library/struct.rst:150 +#: ../../library/struct.rst:154 msgid "little-endian" msgstr "" -#: ../../library/struct.rst:152 +#: ../../library/struct.rst:156 msgid "``>``" msgstr "``>``" -#: ../../library/struct.rst:152 +#: ../../library/struct.rst:156 msgid "big-endian" msgstr "" -#: ../../library/struct.rst:154 +#: ../../library/struct.rst:158 msgid "``!``" msgstr "``!``" -#: ../../library/struct.rst:154 +#: ../../library/struct.rst:158 msgid "network (= big-endian)" msgstr "" -#: ../../library/struct.rst:157 +#: ../../library/struct.rst:161 msgid "If the first character is not one of these, ``'@'`` is assumed." msgstr "" -#: ../../library/struct.rst:161 +#: ../../library/struct.rst:165 msgid "" "The number 1023 (``0x3ff`` in hexadecimal) has the following byte " "representations:" msgstr "" -#: ../../library/struct.rst:163 +#: ../../library/struct.rst:167 msgid "``03 ff`` in big-endian (``>``)" msgstr "" -#: ../../library/struct.rst:164 +#: ../../library/struct.rst:168 msgid "``ff 03`` in little-endian (``<``)" msgstr "" -#: ../../library/struct.rst:166 +#: ../../library/struct.rst:170 msgid "Python example:" msgstr "" -#: ../../library/struct.rst:174 +#: ../../library/struct.rst:178 msgid "" "Native byte order is big-endian or little-endian, depending on the host " "system. For example, Intel x86, AMD64 (x86-64), and Apple M1 are little-" @@ -251,64 +251,64 @@ msgid "" "byteorder` to check the endianness of your system." msgstr "" -#: ../../library/struct.rst:179 +#: ../../library/struct.rst:183 msgid "" "Native size and alignment are determined using the C compiler's ``sizeof`` " "expression. This is always combined with native byte order." msgstr "" -#: ../../library/struct.rst:182 +#: ../../library/struct.rst:186 msgid "" "Standard size depends only on the format character; see the table in the :" "ref:`format-characters` section." msgstr "" -#: ../../library/struct.rst:185 +#: ../../library/struct.rst:189 msgid "" "Note the difference between ``'@'`` and ``'='``: both use native byte order, " "but the size and alignment of the latter is standardized." msgstr "" -#: ../../library/struct.rst:188 +#: ../../library/struct.rst:192 msgid "" "The form ``'!'`` represents the network byte order which is always big-" "endian as defined in `IETF RFC 1700 `_." msgstr "" -#: ../../library/struct.rst:191 +#: ../../library/struct.rst:195 msgid "" "There is no way to indicate non-native byte order (force byte-swapping); use " "the appropriate choice of ``'<'`` or ``'>'``." msgstr "" -#: ../../library/struct.rst:194 ../../library/struct.rst:273 +#: ../../library/struct.rst:198 ../../library/struct.rst:277 msgid "Notes:" msgstr "註解:" -#: ../../library/struct.rst:196 +#: ../../library/struct.rst:200 msgid "" "Padding is only automatically added between successive structure members. No " "padding is added at the beginning or the end of the encoded struct." msgstr "" -#: ../../library/struct.rst:199 +#: ../../library/struct.rst:203 msgid "" "No padding is added when using non-native size and alignment, e.g. with '<', " "'>', '=', and '!'." msgstr "" -#: ../../library/struct.rst:202 +#: ../../library/struct.rst:206 msgid "" "To align the end of a structure to the alignment requirement of a particular " "type, end the format with the code for that type with a repeat count of " "zero. See :ref:`struct-examples`." msgstr "" -#: ../../library/struct.rst:210 +#: ../../library/struct.rst:214 msgid "Format Characters" msgstr "" -#: ../../library/struct.rst:212 +#: ../../library/struct.rst:216 msgid "" "Format characters have the following meaning; the conversion between C and " "Python values should be obvious given their types. The 'Standard size' " @@ -318,309 +318,309 @@ msgid "" "platform-dependent." msgstr "" -#: ../../library/struct.rst:220 +#: ../../library/struct.rst:224 msgid "Format" msgstr "" -#: ../../library/struct.rst:220 +#: ../../library/struct.rst:224 msgid "C Type" msgstr "C Type" -#: ../../library/struct.rst:220 +#: ../../library/struct.rst:224 msgid "Python type" msgstr "" -#: ../../library/struct.rst:220 +#: ../../library/struct.rst:224 msgid "Standard size" msgstr "" -#: ../../library/struct.rst:220 +#: ../../library/struct.rst:224 msgid "Notes" msgstr "註解" -#: ../../library/struct.rst:222 +#: ../../library/struct.rst:226 msgid "``x``" msgstr "``x``" -#: ../../library/struct.rst:222 +#: ../../library/struct.rst:226 msgid "pad byte" msgstr "" -#: ../../library/struct.rst:222 +#: ../../library/struct.rst:226 msgid "no value" msgstr "" -#: ../../library/struct.rst:222 +#: ../../library/struct.rst:226 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/struct.rst:224 +#: ../../library/struct.rst:228 msgid "``c``" msgstr "``c``" -#: ../../library/struct.rst:224 +#: ../../library/struct.rst:228 msgid ":c:expr:`char`" msgstr ":c:expr:`char`" -#: ../../library/struct.rst:224 +#: ../../library/struct.rst:228 msgid "bytes of length 1" msgstr "" -#: ../../library/struct.rst:224 ../../library/struct.rst:226 #: ../../library/struct.rst:228 ../../library/struct.rst:230 +#: ../../library/struct.rst:232 ../../library/struct.rst:234 msgid "1" msgstr "1" -#: ../../library/struct.rst:226 +#: ../../library/struct.rst:230 msgid "``b``" msgstr "``b``" -#: ../../library/struct.rst:226 +#: ../../library/struct.rst:230 msgid ":c:expr:`signed char`" msgstr ":c:expr:`signed char`" -#: ../../library/struct.rst:226 ../../library/struct.rst:228 -#: ../../library/struct.rst:232 ../../library/struct.rst:234 +#: ../../library/struct.rst:230 ../../library/struct.rst:232 #: ../../library/struct.rst:236 ../../library/struct.rst:238 #: ../../library/struct.rst:240 ../../library/struct.rst:242 #: ../../library/struct.rst:244 ../../library/struct.rst:246 -#: ../../library/struct.rst:249 ../../library/struct.rst:251 -#: ../../library/struct.rst:263 +#: ../../library/struct.rst:248 ../../library/struct.rst:250 +#: ../../library/struct.rst:253 ../../library/struct.rst:255 +#: ../../library/struct.rst:267 msgid "integer" msgstr "" -#: ../../library/struct.rst:226 +#: ../../library/struct.rst:230 msgid "\\(1), \\(2)" msgstr "\\(1), \\(2)" -#: ../../library/struct.rst:228 +#: ../../library/struct.rst:232 msgid "``B``" msgstr "``B``" -#: ../../library/struct.rst:228 +#: ../../library/struct.rst:232 msgid ":c:expr:`unsigned char`" msgstr ":c:expr:`unsigned char`" -#: ../../library/struct.rst:228 ../../library/struct.rst:232 -#: ../../library/struct.rst:234 ../../library/struct.rst:236 +#: ../../library/struct.rst:232 ../../library/struct.rst:236 #: ../../library/struct.rst:238 ../../library/struct.rst:240 #: ../../library/struct.rst:242 ../../library/struct.rst:244 -#: ../../library/struct.rst:246 +#: ../../library/struct.rst:246 ../../library/struct.rst:248 +#: ../../library/struct.rst:250 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/struct.rst:230 +#: ../../library/struct.rst:234 msgid "``?``" msgstr "``?``" -#: ../../library/struct.rst:230 +#: ../../library/struct.rst:234 msgid ":c:expr:`_Bool`" msgstr ":c:expr:`_Bool`" -#: ../../library/struct.rst:230 +#: ../../library/struct.rst:234 msgid "bool" msgstr "bool" -#: ../../library/struct.rst:230 +#: ../../library/struct.rst:234 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/struct.rst:232 +#: ../../library/struct.rst:236 msgid "``h``" msgstr "``h``" -#: ../../library/struct.rst:232 +#: ../../library/struct.rst:236 msgid ":c:expr:`short`" msgstr ":c:expr:`short`" -#: ../../library/struct.rst:232 ../../library/struct.rst:234 -#: ../../library/struct.rst:253 +#: ../../library/struct.rst:236 ../../library/struct.rst:238 +#: ../../library/struct.rst:257 msgid "2" msgstr "2" -#: ../../library/struct.rst:234 +#: ../../library/struct.rst:238 msgid "``H``" msgstr "``H``" -#: ../../library/struct.rst:234 +#: ../../library/struct.rst:238 msgid ":c:expr:`unsigned short`" msgstr ":c:expr:`unsigned short`" -#: ../../library/struct.rst:236 +#: ../../library/struct.rst:240 msgid "``i``" msgstr "``i``" -#: ../../library/struct.rst:236 +#: ../../library/struct.rst:240 msgid ":c:expr:`int`" msgstr ":c:expr:`int`" -#: ../../library/struct.rst:236 ../../library/struct.rst:238 #: ../../library/struct.rst:240 ../../library/struct.rst:242 -#: ../../library/struct.rst:255 +#: ../../library/struct.rst:244 ../../library/struct.rst:246 +#: ../../library/struct.rst:259 msgid "4" msgstr "4" -#: ../../library/struct.rst:238 +#: ../../library/struct.rst:242 msgid "``I``" msgstr "``I``" -#: ../../library/struct.rst:238 +#: ../../library/struct.rst:242 msgid ":c:expr:`unsigned int`" msgstr ":c:expr:`unsigned int`" -#: ../../library/struct.rst:240 +#: ../../library/struct.rst:244 msgid "``l``" msgstr "``l``" -#: ../../library/struct.rst:240 +#: ../../library/struct.rst:244 msgid ":c:expr:`long`" msgstr ":c:expr:`long`" -#: ../../library/struct.rst:242 +#: ../../library/struct.rst:246 msgid "``L``" msgstr "``L``" -#: ../../library/struct.rst:242 +#: ../../library/struct.rst:246 msgid ":c:expr:`unsigned long`" msgstr ":c:expr:`unsigned long`" -#: ../../library/struct.rst:244 +#: ../../library/struct.rst:248 msgid "``q``" msgstr "``q``" -#: ../../library/struct.rst:244 +#: ../../library/struct.rst:248 msgid ":c:expr:`long long`" msgstr ":c:expr:`long long`" -#: ../../library/struct.rst:244 ../../library/struct.rst:246 -#: ../../library/struct.rst:257 +#: ../../library/struct.rst:248 ../../library/struct.rst:250 +#: ../../library/struct.rst:261 msgid "8" msgstr "8" -#: ../../library/struct.rst:246 +#: ../../library/struct.rst:250 msgid "``Q``" msgstr "``Q``" -#: ../../library/struct.rst:246 +#: ../../library/struct.rst:250 msgid ":c:expr:`unsigned long long`" msgstr ":c:expr:`unsigned long long`" -#: ../../library/struct.rst:249 +#: ../../library/struct.rst:253 msgid "``n``" msgstr "``n``" -#: ../../library/struct.rst:249 +#: ../../library/struct.rst:253 msgid ":c:type:`ssize_t`" msgstr ":c:type:`ssize_t`" -#: ../../library/struct.rst:249 ../../library/struct.rst:251 +#: ../../library/struct.rst:253 ../../library/struct.rst:255 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/struct.rst:251 +#: ../../library/struct.rst:255 msgid "``N``" msgstr "``N``" -#: ../../library/struct.rst:251 +#: ../../library/struct.rst:255 msgid ":c:type:`size_t`" msgstr ":c:type:`size_t`" -#: ../../library/struct.rst:253 +#: ../../library/struct.rst:257 msgid "``e``" msgstr "``e``" -#: ../../library/struct.rst:253 +#: ../../library/struct.rst:257 msgid "\\(6)" msgstr "\\(6)" -#: ../../library/struct.rst:253 ../../library/struct.rst:255 -#: ../../library/struct.rst:257 +#: ../../library/struct.rst:257 ../../library/struct.rst:259 +#: ../../library/struct.rst:261 msgid "float" msgstr "float" -#: ../../library/struct.rst:253 ../../library/struct.rst:255 -#: ../../library/struct.rst:257 +#: ../../library/struct.rst:257 ../../library/struct.rst:259 +#: ../../library/struct.rst:261 msgid "\\(4)" msgstr "\\(4)" -#: ../../library/struct.rst:255 +#: ../../library/struct.rst:259 msgid "``f``" msgstr "``f``" -#: ../../library/struct.rst:255 +#: ../../library/struct.rst:259 msgid ":c:expr:`float`" msgstr ":c:expr:`float`" -#: ../../library/struct.rst:257 +#: ../../library/struct.rst:261 msgid "``d``" msgstr "``d``" -#: ../../library/struct.rst:257 +#: ../../library/struct.rst:261 msgid ":c:expr:`double`" msgstr ":c:expr:`double`" -#: ../../library/struct.rst:259 +#: ../../library/struct.rst:263 msgid "``s``" msgstr "``s``" -#: ../../library/struct.rst:259 ../../library/struct.rst:261 +#: ../../library/struct.rst:263 ../../library/struct.rst:265 msgid ":c:expr:`char[]`" msgstr ":c:expr:`char[]`" -#: ../../library/struct.rst:259 ../../library/struct.rst:261 +#: ../../library/struct.rst:263 ../../library/struct.rst:265 msgid "bytes" msgstr "" -#: ../../library/struct.rst:259 +#: ../../library/struct.rst:263 msgid "\\(9)" msgstr "\\(9)" -#: ../../library/struct.rst:261 +#: ../../library/struct.rst:265 msgid "``p``" msgstr "``p``" -#: ../../library/struct.rst:261 +#: ../../library/struct.rst:265 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/struct.rst:263 +#: ../../library/struct.rst:267 msgid "``P``" msgstr "``P``" -#: ../../library/struct.rst:263 +#: ../../library/struct.rst:267 msgid ":c:expr:`void \\*`" msgstr ":c:expr:`void \\*`" -#: ../../library/struct.rst:263 +#: ../../library/struct.rst:267 msgid "\\(5)" msgstr "\\(5)" -#: ../../library/struct.rst:266 +#: ../../library/struct.rst:270 msgid "Added support for the ``'n'`` and ``'N'`` formats." msgstr "新增 ``'n'`` 與 ``'N'`` 格式的支援。" -#: ../../library/struct.rst:269 +#: ../../library/struct.rst:273 msgid "Added support for the ``'e'`` format." msgstr "新增 ``'e'`` 格式的支援。" -#: ../../library/struct.rst:278 +#: ../../library/struct.rst:282 msgid "" "The ``'?'`` conversion code corresponds to the :c:expr:`_Bool` type defined " "by C standards since C99. In standard mode, it is represented by one byte." msgstr "" -#: ../../library/struct.rst:283 +#: ../../library/struct.rst:287 msgid "" "When attempting to pack a non-integer using any of the integer conversion " "codes, if the non-integer has a :meth:`~object.__index__` method then that " "method is called to convert the argument to an integer before packing." msgstr "" -#: ../../library/struct.rst:287 +#: ../../library/struct.rst:291 msgid "Added use of the :meth:`~object.__index__` method for non-integers." msgstr "" -#: ../../library/struct.rst:291 +#: ../../library/struct.rst:295 msgid "" "The ``'n'`` and ``'N'`` conversion codes are only available for the native " "size (selected as the default or with the ``'@'`` byte order character). For " @@ -628,7 +628,7 @@ msgid "" "your application." msgstr "" -#: ../../library/struct.rst:297 +#: ../../library/struct.rst:301 msgid "" "For the ``'f'``, ``'d'`` and ``'e'`` conversion codes, the packed " "representation uses the IEEE 754 binary32, binary64 or binary16 format (for " @@ -636,7 +636,7 @@ msgid "" "format used by the platform." msgstr "" -#: ../../library/struct.rst:303 +#: ../../library/struct.rst:307 msgid "" "The ``'P'`` format character is only available for the native byte ordering " "(selected as the default or with the ``'@'`` byte order character). The byte " @@ -645,7 +645,7 @@ msgid "" "ordering, so the ``'P'`` format is not available." msgstr "" -#: ../../library/struct.rst:310 +#: ../../library/struct.rst:314 msgid "" "The IEEE 754 binary16 \"half precision\" type was introduced in the 2008 " "revision of the `IEEE 754 standard `_. It has a sign " @@ -657,11 +657,11 @@ msgid "" "format `_ for more information." msgstr "" -#: ../../library/struct.rst:320 +#: ../../library/struct.rst:324 msgid "When packing, ``'x'`` inserts one NUL byte." msgstr "" -#: ../../library/struct.rst:323 +#: ../../library/struct.rst:327 msgid "" "The ``'p'`` format character encodes a \"Pascal string\", meaning a short " "variable-length string stored in a *fixed number of bytes*, given by the " @@ -675,7 +675,7 @@ msgid "" "more than 255 bytes." msgstr "" -#: ../../library/struct.rst:335 +#: ../../library/struct.rst:339 msgid "" "For the ``'s'`` format character, the count is interpreted as the length of " "the bytes, not a repeat count like for the other format characters; for " @@ -690,19 +690,19 @@ msgid "" "(while ``'0c'`` means 0 characters)." msgstr "" -#: ../../library/struct.rst:348 +#: ../../library/struct.rst:352 msgid "" "A format character may be preceded by an integral repeat count. For " "example, the format string ``'4h'`` means exactly the same as ``'hhhh'``." msgstr "" -#: ../../library/struct.rst:351 +#: ../../library/struct.rst:355 msgid "" "Whitespace characters between formats are ignored; a count and its format " "must not contain whitespace though." msgstr "" -#: ../../library/struct.rst:354 +#: ../../library/struct.rst:358 msgid "" "When packing a value ``x`` using one of the integer formats (``'b'``, " "``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, ``'l'``, ``'L'``, ``'q'``, " @@ -710,13 +710,13 @@ msgid "" "`struct.error` is raised." msgstr "" -#: ../../library/struct.rst:359 +#: ../../library/struct.rst:363 msgid "" "Previously, some of the integer formats wrapped out-of-range values and " "raised :exc:`DeprecationWarning` instead of :exc:`struct.error`." msgstr "" -#: ../../library/struct.rst:365 +#: ../../library/struct.rst:369 msgid "" "For the ``'?'`` format character, the return value is either :const:`True` " "or :const:`False`. When packing, the truth value of the argument object is " @@ -724,24 +724,24 @@ msgid "" "packed, and any non-zero value will be ``True`` when unpacking." msgstr "" -#: ../../library/struct.rst:375 +#: ../../library/struct.rst:379 msgid "Examples" msgstr "範例" -#: ../../library/struct.rst:378 +#: ../../library/struct.rst:382 msgid "" "Native byte order examples (designated by the ``'@'`` format prefix or lack " "of any prefix character) may not match what the reader's machine produces as " "that depends on the platform and compiler." msgstr "" -#: ../../library/struct.rst:383 +#: ../../library/struct.rst:387 msgid "" "Pack and unpack integers of three different sizes, using big endian " "ordering::" msgstr "" -#: ../../library/struct.rst:386 +#: ../../library/struct.rst:390 msgid "" ">>> from struct import *\n" ">>> pack(\">bhl\", 1, 2, 3)\n" @@ -759,11 +759,11 @@ msgstr "" ">>> calcsize('>bhl')\n" "7" -#: ../../library/struct.rst:394 +#: ../../library/struct.rst:398 msgid "Attempt to pack an integer which is too large for the defined field::" msgstr "" -#: ../../library/struct.rst:396 +#: ../../library/struct.rst:400 msgid "" ">>> pack(\">h\", 99999)\n" "Traceback (most recent call last):\n" @@ -775,12 +775,12 @@ msgstr "" " File \"\", line 1, in \n" "struct.error: 'h' format requires -32768 <= number <= 32767" -#: ../../library/struct.rst:401 +#: ../../library/struct.rst:405 msgid "" "Demonstrate the difference between ``'s'`` and ``'c'`` format characters::" msgstr "" -#: ../../library/struct.rst:404 +#: ../../library/struct.rst:408 msgid "" ">>> pack(\"@ccc\", b'1', b'2', b'3')\n" "b'123'\n" @@ -792,13 +792,13 @@ msgstr "" ">>> pack(\"@3s\", b'123')\n" "b'123'" -#: ../../library/struct.rst:409 +#: ../../library/struct.rst:413 msgid "" "Unpacked fields can be named by assigning them to variables or by wrapping " "the result in a named tuple::" msgstr "" -#: ../../library/struct.rst:412 +#: ../../library/struct.rst:416 msgid "" ">>> record = b'raymond \\x32\\x12\\x08\\x01\\x08'\n" ">>> name, serialnum, school, gradelevel = unpack('<10sHHb', record)\n" @@ -816,7 +816,7 @@ msgstr "" ">>> Student._make(unpack('<10sHHb', record))\n" "Student(name=b'raymond ', serialnum=4658, school=264, gradelevel=8)" -#: ../../library/struct.rst:420 +#: ../../library/struct.rst:424 msgid "" "The ordering of format characters may have an impact on size in native mode " "since padding is implicit. In standard mode, the user is responsible for " @@ -826,7 +826,7 @@ msgid "" "a little endian machine::" msgstr "" -#: ../../library/struct.rst:428 +#: ../../library/struct.rst:432 msgid "" ">>> pack('@ci', b'#', 0x12131415)\n" "b'#\\x00\\x00\\x00\\x15\\x14\\x13\\x12'\n" @@ -846,13 +846,13 @@ msgstr "" ">>> calcsize('@ic')\n" "5" -#: ../../library/struct.rst:437 +#: ../../library/struct.rst:441 msgid "" "The following format ``'llh0l'`` results in two pad bytes being added at the " "end, assuming the platform's longs are aligned on 4-byte boundaries::" msgstr "" -#: ../../library/struct.rst:440 +#: ../../library/struct.rst:444 msgid "" ">>> pack('@llh0l', 1, 2, 3)\n" "b'\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x02\\x00\\x03\\x00\\x00'" @@ -860,35 +860,35 @@ msgstr "" ">>> pack('@llh0l', 1, 2, 3)\n" "b'\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x02\\x00\\x03\\x00\\x00'" -#: ../../library/struct.rst:446 +#: ../../library/struct.rst:450 msgid "Module :mod:`array`" msgstr ":mod:`array` 模組" -#: ../../library/struct.rst:447 +#: ../../library/struct.rst:451 msgid "Packed binary storage of homogeneous data." msgstr "" -#: ../../library/struct.rst:449 +#: ../../library/struct.rst:453 msgid "Module :mod:`json`" msgstr ":mod:`json` 模組" -#: ../../library/struct.rst:450 +#: ../../library/struct.rst:454 msgid "JSON encoder and decoder." msgstr "" -#: ../../library/struct.rst:452 +#: ../../library/struct.rst:456 msgid "Module :mod:`pickle`" msgstr ":mod:`pickle` 模組" -#: ../../library/struct.rst:453 +#: ../../library/struct.rst:457 msgid "Python object serialization." msgstr "" -#: ../../library/struct.rst:459 +#: ../../library/struct.rst:463 msgid "Applications" msgstr "" -#: ../../library/struct.rst:461 +#: ../../library/struct.rst:465 msgid "" "Two main applications for the :mod:`struct` module exist, data interchange " "between Python and C code within an application or another application " @@ -898,11 +898,11 @@ msgid "" "speaking, the format strings constructed for these two domains are distinct." msgstr "" -#: ../../library/struct.rst:472 +#: ../../library/struct.rst:476 msgid "Native Formats" msgstr "" -#: ../../library/struct.rst:474 +#: ../../library/struct.rst:478 msgid "" "When constructing format strings which mimic native layouts, the compiler " "and machine architecture determine byte ordering and padding. In such cases, " @@ -913,12 +913,12 @@ msgid "" "of consecutive chunks of data." msgstr "" -#: ../../library/struct.rst:482 +#: ../../library/struct.rst:486 msgid "" "Consider these two simple examples (on a 64-bit, little-endian machine)::" msgstr "" -#: ../../library/struct.rst:485 +#: ../../library/struct.rst:489 msgid "" ">>> calcsize('@lhl')\n" "24\n" @@ -930,14 +930,14 @@ msgstr "" ">>> calcsize('@llh')\n" "18" -#: ../../library/struct.rst:490 +#: ../../library/struct.rst:494 msgid "" "Data is not padded to an 8-byte boundary at the end of the second format " "string without the use of extra padding. A zero-repeat format code solves " "that problem::" msgstr "" -#: ../../library/struct.rst:494 +#: ../../library/struct.rst:498 msgid "" ">>> calcsize('@llh0l')\n" "24" @@ -945,23 +945,23 @@ msgstr "" ">>> calcsize('@llh0l')\n" "24" -#: ../../library/struct.rst:497 +#: ../../library/struct.rst:501 msgid "" "The ``'x'`` format code can be used to specify the repeat, but for native " "formats it is better to use a zero-repeat format like ``'0l'``." msgstr "" -#: ../../library/struct.rst:500 +#: ../../library/struct.rst:504 msgid "" "By default, native byte ordering and alignment is used, but it is better to " "be explicit and use the ``'@'`` prefix character." msgstr "" -#: ../../library/struct.rst:507 +#: ../../library/struct.rst:511 msgid "Standard Formats" msgstr "" -#: ../../library/struct.rst:509 +#: ../../library/struct.rst:513 msgid "" "When exchanging data beyond your process such as networking or storage, be " "precise. Specify the exact byte order, size, and alignment. Do not assume " @@ -975,7 +975,7 @@ msgid "" "from the previous section, we have::" msgstr "" -#: ../../library/struct.rst:521 +#: ../../library/struct.rst:525 msgid "" ">>> calcsize('>> pack('@llh0l', 1, 2, 3) == pack('>> calcsize('>> pack('@llh0l', 1, 2, 3) == pack(' (greater)" msgstr "> (大於)" -#: ../../library/struct.rst:132 +#: ../../library/struct.rst:136 msgid "! (exclamation)" msgstr "! (驚嘆號)" -#: ../../library/struct.rst:276 ../../library/struct.rst:363 +#: ../../library/struct.rst:280 ../../library/struct.rst:367 msgid "? (question mark)" msgstr "? (問號)" diff --git a/library/subprocess.po b/library/subprocess.po index 4367fb0ff2..a6c58c0908 100644 --- a/library/subprocess.po +++ b/library/subprocess.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -50,15 +50,18 @@ msgstr "" msgid ":pep:`324` -- PEP proposing the subprocess module" msgstr ":pep:`324` -- 提議 subprocess 模組的 PEP" -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +#: ../../includes/wasm-ios-notavail.rst:3 +#, fuzzy +msgid ":ref:`Availability `: not WASI, not iOS." +msgstr ":ref:`適用 `:Unix 和 Windows。" -#: ../../includes/wasm-notavail.rst:5 +#: ../../includes/wasm-ios-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly platforms, or " +"on iOS. See :ref:`wasm-availability` for more information on WASM " +"availability; see :ref:`iOS-availability` for more information on iOS " +"availability." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" @@ -190,8 +193,8 @@ msgid "" msgstr "" #: ../../library/subprocess.rst:122 ../../library/subprocess.rst:506 -#: ../../library/subprocess.rst:1198 ../../library/subprocess.rst:1238 -#: ../../library/subprocess.rst:1301 +#: ../../library/subprocess.rst:1214 ../../library/subprocess.rst:1254 +#: ../../library/subprocess.rst:1317 msgid "" "Changed Windows shell search order for ``shell=True``. The current directory " "and ``%PATH%`` are replaced with ``%COMSPEC%`` and ``%SystemRoot%" @@ -392,8 +395,8 @@ msgid "" "binary streams. No encoding or line ending conversion is performed." msgstr "" -#: ../../library/subprocess.rst:314 ../../library/subprocess.rst:1553 -#: ../../library/subprocess.rst:1571 +#: ../../library/subprocess.rst:314 ../../library/subprocess.rst:1569 +#: ../../library/subprocess.rst:1587 msgid "Added the *encoding* and *errors* parameters." msgstr "新增 *encoding* 與 *errors* 參數。" @@ -863,7 +866,7 @@ msgstr "" msgid "*encoding* and *errors* were added." msgstr "新增 *encoding* 與 *errors*。" -#: ../../library/subprocess.rst:665 ../../library/subprocess.rst:1296 +#: ../../library/subprocess.rst:665 ../../library/subprocess.rst:1312 msgid "*text* was added as a more readable alias for *universal_newlines*." msgstr "" @@ -1100,8 +1103,8 @@ msgid "" msgstr "" #: ../../library/subprocess.rst:811 ../../library/subprocess.rst:852 -#: ../../library/subprocess.rst:1193 ../../library/subprocess.rst:1233 -#: ../../library/subprocess.rst:1287 +#: ../../library/subprocess.rst:1209 ../../library/subprocess.rst:1249 +#: ../../library/subprocess.rst:1303 msgid "*timeout* was added." msgstr "新增 *timeout*。" @@ -1422,52 +1425,65 @@ msgstr "" #: ../../library/subprocess.rst:1071 msgid "" +"A :attr:`STARTUPINFO.dwFlags` parameter to specify that the *Working in " +"Background* mouse cursor will be displayed while a process is launching. " +"This is the default behavior for GUI processes." +msgstr "" + +#: ../../library/subprocess.rst:1080 +msgid "" +"A :attr:`STARTUPINFO.dwFlags` parameter to specify that the mouse cursor " +"will not be changed when launching a process." +msgstr "" + +#: ../../library/subprocess.rst:1087 +msgid "" "The new process has a new console, instead of inheriting its parent's " "console (the default)." msgstr "" -#: ../../library/subprocess.rst:1076 +#: ../../library/subprocess.rst:1092 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "group will be created. This flag is necessary for using :func:`os.kill` on " "the subprocess." msgstr "" -#: ../../library/subprocess.rst:1080 +#: ../../library/subprocess.rst:1096 msgid "This flag is ignored if :data:`CREATE_NEW_CONSOLE` is specified." msgstr "" -#: ../../library/subprocess.rst:1084 +#: ../../library/subprocess.rst:1100 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have an above average priority." msgstr "" -#: ../../library/subprocess.rst:1091 +#: ../../library/subprocess.rst:1107 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have a below average priority." msgstr "" -#: ../../library/subprocess.rst:1098 +#: ../../library/subprocess.rst:1114 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have a high priority." msgstr "" -#: ../../library/subprocess.rst:1105 +#: ../../library/subprocess.rst:1121 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have an idle (lowest) priority." msgstr "" -#: ../../library/subprocess.rst:1112 +#: ../../library/subprocess.rst:1128 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have a normal priority. (default)" msgstr "" -#: ../../library/subprocess.rst:1119 +#: ../../library/subprocess.rst:1135 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have realtime priority. You should almost never use " @@ -1477,20 +1493,20 @@ msgid "" "perform brief tasks that should have limited interruptions." msgstr "" -#: ../../library/subprocess.rst:1130 +#: ../../library/subprocess.rst:1146 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will not create a window." msgstr "" -#: ../../library/subprocess.rst:1137 +#: ../../library/subprocess.rst:1153 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will not inherit its parent's console. This value cannot be used with " "CREATE_NEW_CONSOLE." msgstr "" -#: ../../library/subprocess.rst:1145 +#: ../../library/subprocess.rst:1161 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "does not inherit the error mode of the calling process. Instead, the new " @@ -1498,43 +1514,43 @@ msgid "" "multithreaded shell applications that run with hard errors disabled." msgstr "" -#: ../../library/subprocess.rst:1155 +#: ../../library/subprocess.rst:1171 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "is not associated with the job." msgstr "" -#: ../../library/subprocess.rst:1163 +#: ../../library/subprocess.rst:1179 msgid "Older high-level API" msgstr "" -#: ../../library/subprocess.rst:1165 +#: ../../library/subprocess.rst:1181 msgid "" "Prior to Python 3.5, these three functions comprised the high level API to " "subprocess. You can now use :func:`run` in many cases, but lots of existing " "code calls these functions." msgstr "" -#: ../../library/subprocess.rst:1172 +#: ../../library/subprocess.rst:1188 msgid "" "Run the command described by *args*. Wait for command to complete, then " "return the :attr:`~Popen.returncode` attribute." msgstr "" -#: ../../library/subprocess.rst:1175 ../../library/subprocess.rst:1215 +#: ../../library/subprocess.rst:1191 ../../library/subprocess.rst:1231 msgid "" "Code needing to capture stdout or stderr should use :func:`run` instead::" msgstr "" -#: ../../library/subprocess.rst:1177 +#: ../../library/subprocess.rst:1193 msgid "run(...).returncode" msgstr "run(...).returncode" -#: ../../library/subprocess.rst:1179 ../../library/subprocess.rst:1219 +#: ../../library/subprocess.rst:1195 ../../library/subprocess.rst:1235 msgid "To suppress stdout or stderr, supply a value of :data:`DEVNULL`." msgstr "" -#: ../../library/subprocess.rst:1181 ../../library/subprocess.rst:1221 +#: ../../library/subprocess.rst:1197 ../../library/subprocess.rst:1237 msgid "" "The arguments shown above are merely some common ones. The full function " "signature is the same as that of the :class:`Popen` constructor - this " @@ -1542,14 +1558,14 @@ msgid "" "to that interface." msgstr "" -#: ../../library/subprocess.rst:1188 ../../library/subprocess.rst:1228 +#: ../../library/subprocess.rst:1204 ../../library/subprocess.rst:1244 msgid "" "Do not use ``stdout=PIPE`` or ``stderr=PIPE`` with this function. The child " "process will block if it generates enough output to a pipe to fill up the OS " "pipe buffer as the pipes are not being read from." msgstr "" -#: ../../library/subprocess.rst:1208 +#: ../../library/subprocess.rst:1224 msgid "" "Run command with arguments. Wait for command to complete. If the return " "code was zero then return, otherwise raise :exc:`CalledProcessError`. The :" @@ -1558,15 +1574,15 @@ msgid "" "to start the process it will propagate the exception that was raised." msgstr "" -#: ../../library/subprocess.rst:1217 +#: ../../library/subprocess.rst:1233 msgid "run(..., check=True)" msgstr "run(..., check=True)" -#: ../../library/subprocess.rst:1250 +#: ../../library/subprocess.rst:1266 msgid "Run command with arguments and return its output." msgstr "" -#: ../../library/subprocess.rst:1252 +#: ../../library/subprocess.rst:1268 msgid "" "If the return code was non-zero it raises a :exc:`CalledProcessError`. The :" "exc:`CalledProcessError` object will have the return code in the :attr:" @@ -1574,15 +1590,15 @@ msgid "" "`~CalledProcessError.output` attribute." msgstr "" -#: ../../library/subprocess.rst:1257 +#: ../../library/subprocess.rst:1273 msgid "This is equivalent to::" msgstr "這等同於: ::" -#: ../../library/subprocess.rst:1259 +#: ../../library/subprocess.rst:1275 msgid "run(..., check=True, stdout=PIPE).stdout" msgstr "run(..., check=True, stdout=PIPE).stdout" -#: ../../library/subprocess.rst:1261 +#: ../../library/subprocess.rst:1277 msgid "" "The arguments shown above are merely some common ones. The full function " "signature is largely the same as that of :func:`run` - most arguments are " @@ -1592,27 +1608,27 @@ msgid "" "using the parent's standard input file handle." msgstr "" -#: ../../library/subprocess.rst:1268 +#: ../../library/subprocess.rst:1284 msgid "" "By default, this function will return the data as encoded bytes. The actual " "encoding of the output data may depend on the command being invoked, so the " "decoding to text will often need to be handled at the application level." msgstr "" -#: ../../library/subprocess.rst:1272 +#: ../../library/subprocess.rst:1288 msgid "" "This behaviour may be overridden by setting *text*, *encoding*, *errors*, or " "*universal_newlines* to ``True`` as described in :ref:`frequently-used-" "arguments` and :func:`run`." msgstr "" -#: ../../library/subprocess.rst:1276 +#: ../../library/subprocess.rst:1292 msgid "" "To also capture standard error in the result, use ``stderr=subprocess." "STDOUT``::" msgstr "" -#: ../../library/subprocess.rst:1279 +#: ../../library/subprocess.rst:1295 msgid "" ">>> subprocess.check_output(\n" "... \"ls non_existent_file; exit 0\",\n" @@ -1626,32 +1642,32 @@ msgstr "" "... shell=True)\n" "'ls: non_existent_file: No such file or directory\\n'" -#: ../../library/subprocess.rst:1290 +#: ../../library/subprocess.rst:1306 msgid "Support for the *input* keyword argument was added." msgstr "新增 *input* 關鍵字引數的支援。" -#: ../../library/subprocess.rst:1293 +#: ../../library/subprocess.rst:1309 msgid "*encoding* and *errors* were added. See :func:`run` for details." msgstr "新增 *encoding* 與 *errors*。細節請見 :func:`run`。" -#: ../../library/subprocess.rst:1311 +#: ../../library/subprocess.rst:1327 msgid "Replacing Older Functions with the :mod:`subprocess` Module" msgstr "" -#: ../../library/subprocess.rst:1313 +#: ../../library/subprocess.rst:1329 msgid "" "In this section, \"a becomes b\" means that b can be used as a replacement " "for a." msgstr "" -#: ../../library/subprocess.rst:1317 +#: ../../library/subprocess.rst:1333 msgid "" "All \"a\" functions in this section fail (more or less) silently if the " "executed program cannot be found; the \"b\" replacements raise :exc:" "`OSError` instead." msgstr "" -#: ../../library/subprocess.rst:1321 +#: ../../library/subprocess.rst:1337 msgid "" "In addition, the replacements using :func:`check_output` will fail with a :" "exc:`CalledProcessError` if the requested operation produces a non-zero " @@ -1659,38 +1675,38 @@ msgid "" "output` attribute of the raised exception." msgstr "" -#: ../../library/subprocess.rst:1326 +#: ../../library/subprocess.rst:1342 msgid "" "In the following examples, we assume that the relevant functions have " "already been imported from the :mod:`subprocess` module." msgstr "" -#: ../../library/subprocess.rst:1331 +#: ../../library/subprocess.rst:1347 msgid "Replacing :program:`/bin/sh` shell command substitution" msgstr "" -#: ../../library/subprocess.rst:1333 +#: ../../library/subprocess.rst:1349 msgid "output=$(mycmd myarg)" msgstr "output=$(mycmd myarg)" -#: ../../library/subprocess.rst:1337 ../../library/subprocess.rst:1348 -#: ../../library/subprocess.rst:1365 +#: ../../library/subprocess.rst:1353 ../../library/subprocess.rst:1364 +#: ../../library/subprocess.rst:1381 msgid "becomes::" msgstr "變成: ::" -#: ../../library/subprocess.rst:1339 +#: ../../library/subprocess.rst:1355 msgid "output = check_output([\"mycmd\", \"myarg\"])" msgstr "output = check_output([\"mycmd\", \"myarg\"])" -#: ../../library/subprocess.rst:1342 +#: ../../library/subprocess.rst:1358 msgid "Replacing shell pipeline" msgstr "" -#: ../../library/subprocess.rst:1344 ../../library/subprocess.rst:1361 +#: ../../library/subprocess.rst:1360 ../../library/subprocess.rst:1377 msgid "output=$(dmesg | grep hda)" msgstr "output=$(dmesg | grep hda)" -#: ../../library/subprocess.rst:1350 +#: ../../library/subprocess.rst:1366 msgid "" "p1 = Popen([\"dmesg\"], stdout=PIPE)\n" "p2 = Popen([\"grep\", \"hda\"], stdin=p1.stdout, stdout=PIPE)\n" @@ -1698,27 +1714,27 @@ msgid "" "output = p2.communicate()[0]" msgstr "" -#: ../../library/subprocess.rst:1355 +#: ../../library/subprocess.rst:1371 msgid "" "The ``p1.stdout.close()`` call after starting the p2 is important in order " "for p1 to receive a SIGPIPE if p2 exits before p1." msgstr "" -#: ../../library/subprocess.rst:1358 +#: ../../library/subprocess.rst:1374 msgid "" "Alternatively, for trusted input, the shell's own pipeline support may still " "be used directly:" msgstr "" -#: ../../library/subprocess.rst:1367 +#: ../../library/subprocess.rst:1383 msgid "output = check_output(\"dmesg | grep hda\", shell=True)" msgstr "output = check_output(\"dmesg | grep hda\", shell=True)" -#: ../../library/subprocess.rst:1371 +#: ../../library/subprocess.rst:1387 msgid "Replacing :func:`os.system`" msgstr "" -#: ../../library/subprocess.rst:1375 +#: ../../library/subprocess.rst:1391 msgid "" "sts = os.system(\"mycmd\" + \" myarg\")\n" "# becomes\n" @@ -1728,32 +1744,32 @@ msgstr "" "# 變成\n" "retcode = call(\"mycmd\" + \" myarg\", shell=True)" -#: ../../library/subprocess.rst:1379 +#: ../../library/subprocess.rst:1395 msgid "Notes:" msgstr "註解:" -#: ../../library/subprocess.rst:1381 +#: ../../library/subprocess.rst:1397 msgid "Calling the program through the shell is usually not required." msgstr "" -#: ../../library/subprocess.rst:1382 +#: ../../library/subprocess.rst:1398 msgid "" "The :func:`call` return value is encoded differently to that of :func:`os." "system`." msgstr "" -#: ../../library/subprocess.rst:1385 +#: ../../library/subprocess.rst:1401 msgid "" "The :func:`os.system` function ignores SIGINT and SIGQUIT signals while the " "command is running, but the caller must do this separately when using the :" "mod:`subprocess` module." msgstr "" -#: ../../library/subprocess.rst:1389 +#: ../../library/subprocess.rst:1405 msgid "A more realistic example would look like this::" msgstr "" -#: ../../library/subprocess.rst:1391 +#: ../../library/subprocess.rst:1407 msgid "" "try:\n" " retcode = call(\"mycmd\" + \" myarg\", shell=True)\n" @@ -1775,15 +1791,15 @@ msgstr "" "except OSError as e:\n" " print(\"Execution failed:\", e, file=sys.stderr)" -#: ../../library/subprocess.rst:1402 +#: ../../library/subprocess.rst:1418 msgid "Replacing the :func:`os.spawn ` family" msgstr "" -#: ../../library/subprocess.rst:1404 +#: ../../library/subprocess.rst:1420 msgid "P_NOWAIT example::" msgstr "P_NOWAIT 範例: ::" -#: ../../library/subprocess.rst:1406 +#: ../../library/subprocess.rst:1422 msgid "" "pid = os.spawnlp(os.P_NOWAIT, \"/bin/mycmd\", \"mycmd\", \"myarg\")\n" "==>\n" @@ -1793,11 +1809,11 @@ msgstr "" "==>\n" "pid = Popen([\"/bin/mycmd\", \"myarg\"]).pid" -#: ../../library/subprocess.rst:1410 +#: ../../library/subprocess.rst:1426 msgid "P_WAIT example::" msgstr "P_WAIT 範例: ::" -#: ../../library/subprocess.rst:1412 +#: ../../library/subprocess.rst:1428 msgid "" "retcode = os.spawnlp(os.P_WAIT, \"/bin/mycmd\", \"mycmd\", \"myarg\")\n" "==>\n" @@ -1807,11 +1823,11 @@ msgstr "" "==>\n" "retcode = call([\"/bin/mycmd\", \"myarg\"])" -#: ../../library/subprocess.rst:1416 +#: ../../library/subprocess.rst:1432 msgid "Vector example::" msgstr "" -#: ../../library/subprocess.rst:1418 +#: ../../library/subprocess.rst:1434 msgid "" "os.spawnvp(os.P_NOWAIT, path, args)\n" "==>\n" @@ -1821,11 +1837,11 @@ msgstr "" "==>\n" "Popen([path] + args[1:])" -#: ../../library/subprocess.rst:1422 +#: ../../library/subprocess.rst:1438 msgid "Environment example::" msgstr "" -#: ../../library/subprocess.rst:1424 +#: ../../library/subprocess.rst:1440 msgid "" "os.spawnlpe(os.P_NOWAIT, \"/bin/mycmd\", \"mycmd\", \"myarg\", env)\n" "==>\n" @@ -1835,11 +1851,11 @@ msgstr "" "==>\n" "Popen([\"/bin/mycmd\", \"myarg\"], env={\"PATH\": \"/usr/bin\"})" -#: ../../library/subprocess.rst:1431 +#: ../../library/subprocess.rst:1447 msgid "Replacing :func:`os.popen`, :func:`os.popen2`, :func:`os.popen3`" msgstr "" -#: ../../library/subprocess.rst:1435 +#: ../../library/subprocess.rst:1451 msgid "" "(child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize)\n" "==>\n" @@ -1853,7 +1869,7 @@ msgstr "" " stdin=PIPE, stdout=PIPE, close_fds=True)\n" "(child_stdin, child_stdout) = (p.stdin, p.stdout)" -#: ../../library/subprocess.rst:1443 +#: ../../library/subprocess.rst:1459 msgid "" "(child_stdin,\n" " child_stdout,\n" @@ -1875,7 +1891,7 @@ msgstr "" " child_stdout,\n" " child_stderr) = (p.stdin, p.stdout, p.stderr)" -#: ../../library/subprocess.rst:1455 +#: ../../library/subprocess.rst:1471 msgid "" "(child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize)\n" "==>\n" @@ -1889,11 +1905,11 @@ msgstr "" " stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)\n" "(child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout)" -#: ../../library/subprocess.rst:1461 +#: ../../library/subprocess.rst:1477 msgid "Return code handling translates as follows::" msgstr "" -#: ../../library/subprocess.rst:1463 +#: ../../library/subprocess.rst:1479 msgid "" "pipe = os.popen(cmd, 'w')\n" "...\n" @@ -1919,17 +1935,17 @@ msgstr "" "if process.wait() != 0:\n" " print(\"There were some errors\")" -#: ../../library/subprocess.rst:1477 +#: ../../library/subprocess.rst:1493 msgid "Replacing functions from the :mod:`!popen2` module" msgstr "" -#: ../../library/subprocess.rst:1481 +#: ../../library/subprocess.rst:1497 msgid "" "If the cmd argument to popen2 functions is a string, the command is executed " "through /bin/sh. If it is a list, the command is directly executed." msgstr "" -#: ../../library/subprocess.rst:1486 +#: ../../library/subprocess.rst:1502 msgid "" "(child_stdout, child_stdin) = popen2.popen2(\"somestring\", bufsize, mode)\n" "==>\n" @@ -1943,7 +1959,7 @@ msgstr "" " stdin=PIPE, stdout=PIPE, close_fds=True)\n" "(child_stdout, child_stdin) = (p.stdout, p.stdin)" -#: ../../library/subprocess.rst:1494 +#: ../../library/subprocess.rst:1510 msgid "" "(child_stdout, child_stdin) = popen2.popen2([\"mycmd\", \"myarg\"], bufsize, " "mode)\n" @@ -1959,36 +1975,36 @@ msgstr "" " stdin=PIPE, stdout=PIPE, close_fds=True)\n" "(child_stdout, child_stdin) = (p.stdout, p.stdin)" -#: ../../library/subprocess.rst:1500 +#: ../../library/subprocess.rst:1516 msgid "" ":class:`popen2.Popen3` and :class:`popen2.Popen4` basically work as :class:" "`subprocess.Popen`, except that:" msgstr "" -#: ../../library/subprocess.rst:1503 +#: ../../library/subprocess.rst:1519 msgid ":class:`Popen` raises an exception if the execution fails." msgstr "" -#: ../../library/subprocess.rst:1505 +#: ../../library/subprocess.rst:1521 msgid "The *capturestderr* argument is replaced with the *stderr* argument." msgstr "" -#: ../../library/subprocess.rst:1507 +#: ../../library/subprocess.rst:1523 msgid "``stdin=PIPE`` and ``stdout=PIPE`` must be specified." msgstr "" -#: ../../library/subprocess.rst:1509 +#: ../../library/subprocess.rst:1525 msgid "" "popen2 closes all file descriptors by default, but you have to specify " "``close_fds=True`` with :class:`Popen` to guarantee this behavior on all " "platforms or past Python versions." msgstr "" -#: ../../library/subprocess.rst:1515 +#: ../../library/subprocess.rst:1531 msgid "Legacy Shell Invocation Functions" msgstr "" -#: ../../library/subprocess.rst:1517 +#: ../../library/subprocess.rst:1533 msgid "" "This module also provides the following legacy functions from the 2.x " "``commands`` module. These operations implicitly invoke the system shell and " @@ -1996,11 +2012,11 @@ msgid "" "handling consistency are valid for these functions." msgstr "" -#: ../../library/subprocess.rst:1524 +#: ../../library/subprocess.rst:1540 msgid "Return ``(exitcode, output)`` of executing *cmd* in a shell." msgstr "" -#: ../../library/subprocess.rst:1526 +#: ../../library/subprocess.rst:1542 msgid "" "Execute the string *cmd* in a shell with :meth:`Popen.check_output` and " "return a 2-tuple ``(exitcode, output)``. *encoding* and *errors* are used to " @@ -2008,13 +2024,13 @@ msgid "" "details." msgstr "" -#: ../../library/subprocess.rst:1531 +#: ../../library/subprocess.rst:1547 msgid "" "A trailing newline is stripped from the output. The exit code for the " "command can be interpreted as the return code of subprocess. Example::" msgstr "" -#: ../../library/subprocess.rst:1535 +#: ../../library/subprocess.rst:1551 msgid "" ">>> subprocess.getstatusoutput('ls /bin/ls')\n" "(0, '/bin/ls')\n" @@ -2034,32 +2050,32 @@ msgstr "" ">>> subprocess.getstatusoutput('/bin/kill $$')\n" "(-15, '')" -#: ../../library/subprocess.rst:1544 ../../library/subprocess.rst:1566 +#: ../../library/subprocess.rst:1560 ../../library/subprocess.rst:1582 msgid ":ref:`Availability `: Unix, Windows." msgstr ":ref:`適用 `:Unix 和 Windows。" -#: ../../library/subprocess.rst:1546 +#: ../../library/subprocess.rst:1562 msgid "Windows support was added." msgstr "新增對 Windows 的支援。" -#: ../../library/subprocess.rst:1549 +#: ../../library/subprocess.rst:1565 msgid "" "The function now returns (exitcode, output) instead of (status, output) as " "it did in Python 3.3.3 and earlier. exitcode has the same value as :attr:" "`~Popen.returncode`." msgstr "" -#: ../../library/subprocess.rst:1558 +#: ../../library/subprocess.rst:1574 msgid "Return output (stdout and stderr) of executing *cmd* in a shell." msgstr "" -#: ../../library/subprocess.rst:1560 +#: ../../library/subprocess.rst:1576 msgid "" "Like :func:`getstatusoutput`, except the exit code is ignored and the return " "value is a string containing the command's output. Example::" msgstr "" -#: ../../library/subprocess.rst:1563 +#: ../../library/subprocess.rst:1579 msgid "" ">>> subprocess.getoutput('ls /bin/ls')\n" "'/bin/ls'" @@ -2067,50 +2083,50 @@ msgstr "" ">>> subprocess.getoutput('ls /bin/ls')\n" "'/bin/ls'" -#: ../../library/subprocess.rst:1568 +#: ../../library/subprocess.rst:1584 msgid "Windows support added" msgstr "新增對 Windows 的支援" -#: ../../library/subprocess.rst:1576 +#: ../../library/subprocess.rst:1592 msgid "Notes" msgstr "註解" -#: ../../library/subprocess.rst:1581 +#: ../../library/subprocess.rst:1597 msgid "Converting an argument sequence to a string on Windows" msgstr "" -#: ../../library/subprocess.rst:1583 +#: ../../library/subprocess.rst:1599 msgid "" "On Windows, an *args* sequence is converted to a string that can be parsed " "using the following rules (which correspond to the rules used by the MS C " "runtime):" msgstr "" -#: ../../library/subprocess.rst:1587 +#: ../../library/subprocess.rst:1603 msgid "" "Arguments are delimited by white space, which is either a space or a tab." msgstr "" -#: ../../library/subprocess.rst:1590 +#: ../../library/subprocess.rst:1606 msgid "" "A string surrounded by double quotation marks is interpreted as a single " "argument, regardless of white space contained within. A quoted string can " "be embedded in an argument." msgstr "" -#: ../../library/subprocess.rst:1595 +#: ../../library/subprocess.rst:1611 msgid "" "A double quotation mark preceded by a backslash is interpreted as a literal " "double quotation mark." msgstr "" -#: ../../library/subprocess.rst:1598 +#: ../../library/subprocess.rst:1614 msgid "" "Backslashes are interpreted literally, unless they immediately precede a " "double quotation mark." msgstr "" -#: ../../library/subprocess.rst:1601 +#: ../../library/subprocess.rst:1617 msgid "" "If backslashes immediately precede a double quotation mark, every pair of " "backslashes is interpreted as a literal backslash. If the number of " @@ -2118,19 +2134,19 @@ msgid "" "mark as described in rule 3." msgstr "" -#: ../../library/subprocess.rst:1610 +#: ../../library/subprocess.rst:1626 msgid ":mod:`shlex`" msgstr ":mod:`shlex`" -#: ../../library/subprocess.rst:1611 +#: ../../library/subprocess.rst:1627 msgid "Module which provides function to parse and escape command lines." msgstr "" -#: ../../library/subprocess.rst:1618 +#: ../../library/subprocess.rst:1634 msgid "Disabling use of ``vfork()`` or ``posix_spawn()``" msgstr "停用 ``vfork()`` 或 ``posix_spawn()``" -#: ../../library/subprocess.rst:1620 +#: ../../library/subprocess.rst:1636 msgid "" "On Linux, :mod:`subprocess` defaults to using the ``vfork()`` system call " "internally when it is safe to do so rather than ``fork()``. This greatly " @@ -2139,7 +2155,7 @@ msgstr "" "在 Linux 上,:mod:`subprocess` 在安全的情況下預設會在內部使用 ``vfork()`` 系" "統呼叫,而不是 ``fork()``,這顯著地提高了性能。" -#: ../../library/subprocess.rst:1624 +#: ../../library/subprocess.rst:1640 msgid "" "If you ever encounter a presumed highly unusual situation where you need to " "prevent ``vfork()`` from being used by Python, you can set the :const:" @@ -2148,11 +2164,11 @@ msgstr "" "如果你遇到了一個推定為極異常的情況,需要防止 Python 使用 ``vfork()``,你可以" "將 :const:`subprocess._USE_VFORK` 屬性設為 false 值。" -#: ../../library/subprocess.rst:1630 +#: ../../library/subprocess.rst:1646 msgid "subprocess._USE_VFORK = False # See CPython issue gh-NNNNNN." msgstr "subprocess._USE_VFORK = False # 見 CPython 問題 gh-NNNNNN." -#: ../../library/subprocess.rst:1632 +#: ../../library/subprocess.rst:1648 msgid "" "Setting this has no impact on use of ``posix_spawn()`` which could use " "``vfork()`` internally within its libc implementation. There is a similar :" @@ -2163,11 +2179,11 @@ msgstr "" "``vfork()``。如果你需要封鎖該屬性的使用,則有一個類似的 :const:`subprocess." "_USE_POSIX_SPAWN` 屬性。" -#: ../../library/subprocess.rst:1639 +#: ../../library/subprocess.rst:1655 msgid "subprocess._USE_POSIX_SPAWN = False # See CPython issue gh-NNNNNN." msgstr "subprocess._USE_POSIX_SPAWN = False # 見 CPython 問題 gh-NNNNNN." -#: ../../library/subprocess.rst:1641 +#: ../../library/subprocess.rst:1657 msgid "" "It is safe to set these to false on any Python version. They will have no " "effect on older versions when unsupported. Do not assume the attributes are " @@ -2178,7 +2194,7 @@ msgstr "" "沒有影響。不要假設屬性可供讀取。儘管有它們的名稱,真實值並不表示將使用相應的" "函式,而只是表示可能會使用。" -#: ../../library/subprocess.rst:1646 +#: ../../library/subprocess.rst:1662 msgid "" "Please file issues any time you have to use these private knobs with a way " "to reproduce the issue you were seeing. Link to that issue from a comment in " @@ -2187,11 +2203,11 @@ msgstr "" "每當你需要使用這些私有開關以重現你所看到的問題時,請隨時提出問題 (file " "issues)。從程式碼中的註解連結到該問題。" -#: ../../library/subprocess.rst:1650 +#: ../../library/subprocess.rst:1666 msgid "``_USE_POSIX_SPAWN``" msgstr "``_USE_POSIX_SPAWN``" -#: ../../library/subprocess.rst:1651 +#: ../../library/subprocess.rst:1667 msgid "``_USE_VFORK``" msgstr "``_USE_VFORK``" diff --git a/library/superseded.po b/library/superseded.po index d8e34d57c6..179f3bcb8a 100644 --- a/library/superseded.po +++ b/library/superseded.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-26 18:54+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-02-15 20:45+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -24,9 +24,11 @@ msgid "Superseded Modules" msgstr "已被取代的模組" #: ../../library/superseded.rst:7 +#, fuzzy msgid "" -"The modules described in this chapter are deprecated and only kept for " -"backwards compatibility. They have been superseded by other modules." +"The modules described in this chapter are deprecated or :term:`soft " +"deprecated` and only kept for backwards compatibility. They have been " +"superseded by other modules." msgstr "" "此章節所描述的模組 (modules) 均已被棄用,僅為了向後相容性而被保留下來。它們已" "經被其他模組所取代。" diff --git a/library/symtable.po b/library/symtable.po index a4dfc937f9..48c873ff47 100644 --- a/library/symtable.po +++ b/library/symtable.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -55,24 +55,63 @@ msgid "Examining Symbol Tables" msgstr "檢查符號表" #: ../../library/symtable.rst:36 +msgid "An enumeration indicating the type of a :class:`SymbolTable` object." +msgstr "" + +#: ../../library/symtable.rst:41 +msgid "Used for the symbol table of a module." +msgstr "" + +#: ../../library/symtable.rst:46 +msgid "Used for the symbol table of a function." +msgstr "" + +#: ../../library/symtable.rst:51 +msgid "Used for the symbol table of a class." +msgstr "" + +#: ../../library/symtable.rst:53 +msgid "" +"The following members refer to different flavors of :ref:`annotation scopes " +"`." +msgstr "" + +#: ../../library/symtable.rst:59 +msgid "" +"Used for annotations if ``from __future__ import annotations`` is active." +msgstr "" + +#: ../../library/symtable.rst:64 +msgid "Used for the symbol table of :keyword:`type` constructions." +msgstr "" + +#: ../../library/symtable.rst:69 +msgid "" +"Used for the symbol table of :ref:`generic functions ` " +"or :ref:`generic classes `." +msgstr "" + +#: ../../library/symtable.rst:75 +msgid "" +"Used for the symbol table of the bound, the constraint tuple or the default " +"value of a single type variable in the formal sense, i.e., a TypeVar, a " +"TypeVarTuple or a ParamSpec object (the latter two do not support a bound or " +"a constraint tuple)." +msgstr "" + +#: ../../library/symtable.rst:84 msgid "A namespace table for a block. The constructor is not public." msgstr "" "一個區塊 (block) 的命名空間表 (namespace table) 。建構函式 (constructor) 並不" "公開。" -#: ../../library/symtable.rst:40 +#: ../../library/symtable.rst:88 msgid "" -"Return the type of the symbol table. Possible values are ``'class'``, " -"``'module'``, ``'function'``, ``'annotation'``, ``'TypeVar bound'``, ``'type " -"alias'``, and ``'type parameter'``. The latter four refer to different " -"flavors of :ref:`annotation scopes `." +"Return the type of the symbol table. Possible values are members of the :" +"class:`SymbolTableType` enumeration." msgstr "" -"回傳符號表的種類。可能的值為 ``'class'``、``'module'``、``'function'``、" -"``'annotation'``、``'TypeVar bound'``、``'type alias'`` 和 ``'type " -"parameter'``。後四個是指不同的\\ :ref:`註釋範圍 (annotation scopes) " -"`。" -#: ../../library/symtable.rst:45 +#: ../../library/symtable.rst:91 msgid "" "Added ``'annotation'``, ``'TypeVar bound'``, ``'type alias'``, and ``'type " "parameter'`` as possible return values." @@ -80,11 +119,22 @@ msgstr "" "新增了 ``'annotation'``、``'TypeVar bound'``、``'type alias'`` 和 ``'type " "parameter'`` 作為可能的回傳值。" -#: ../../library/symtable.rst:51 +#: ../../library/symtable.rst:95 +msgid "Return values are members of the :class:`SymbolTableType` enumeration." +msgstr "" + +#: ../../library/symtable.rst:98 +msgid "" +"The exact values of the returned string may change in the future, and thus, " +"it is recommended to use :class:`SymbolTableType` members instead of hard-" +"coded strings." +msgstr "" + +#: ../../library/symtable.rst:104 msgid "Return the table's identifier." msgstr "回傳表的識別器。" -#: ../../library/symtable.rst:55 +#: ../../library/symtable.rst:108 msgid "" "Return the table's name. This is the name of the class if the table is for " "a class, the name of the function if the table is for a function, or " @@ -100,19 +150,19 @@ msgstr "" "類別、函式或型別別名的名稱。對於型別別名作用域,它是型別別名的名稱。對於 :" "class:`~typing.TypeVar` 綁定範圍,它會是 ``TypeVar`` 的名稱。" -#: ../../library/symtable.rst:65 +#: ../../library/symtable.rst:118 msgid "Return the number of the first line in the block this table represents." msgstr "回傳此表所代表的區塊中第一行的編號。" -#: ../../library/symtable.rst:69 +#: ../../library/symtable.rst:122 msgid "Return ``True`` if the locals in this table can be optimized." msgstr "如果可以最佳化該表中的區域變數,則回傳 ``True``。" -#: ../../library/symtable.rst:73 +#: ../../library/symtable.rst:126 msgid "Return ``True`` if the block is a nested class or function." msgstr "如果區塊是巢狀類別或函式,則回傳 ``True``。" -#: ../../library/symtable.rst:77 +#: ../../library/symtable.rst:130 msgid "" "Return ``True`` if the block has nested namespaces within it. These can be " "obtained with :meth:`get_children`." @@ -120,7 +170,7 @@ msgstr "" "如果區塊內有巢狀命名空間,則回傳 ``True``。這些可以通過 :meth:`get_children` " "獲得。" -#: ../../library/symtable.rst:82 +#: ../../library/symtable.rst:135 msgid "" "Return a view object containing the names of symbols in the table. See the :" "ref:`documentation of view objects `." @@ -128,121 +178,121 @@ msgstr "" "回傳包含表中符號之名稱的視圖物件 (view object)。請參閱\\ :ref:`視圖物件的文" "件 `。" -#: ../../library/symtable.rst:87 +#: ../../library/symtable.rst:140 msgid "Lookup *name* in the table and return a :class:`Symbol` instance." msgstr "在表中查找 *name* 並回傳一個 :class:`Symbol` 實例。" -#: ../../library/symtable.rst:91 +#: ../../library/symtable.rst:144 msgid "Return a list of :class:`Symbol` instances for names in the table." msgstr "回傳表中名稱的 :class:`Symbol` 實例串列。" -#: ../../library/symtable.rst:95 +#: ../../library/symtable.rst:148 msgid "Return a list of the nested symbol tables." msgstr "回傳巢狀符號表的串列。" -#: ../../library/symtable.rst:100 +#: ../../library/symtable.rst:153 msgid "" "A namespace for a function or method. This class inherits from :class:" "`SymbolTable`." msgstr "一個函式或方法的命名空間。該類別繼承自 :class:`SymbolTable`。" -#: ../../library/symtable.rst:105 +#: ../../library/symtable.rst:158 msgid "Return a tuple containing names of parameters to this function." msgstr "回傳一個包含此函式參數名稱的元組 (tuple)。" -#: ../../library/symtable.rst:109 +#: ../../library/symtable.rst:162 msgid "Return a tuple containing names of locals in this function." msgstr "回傳一個包含此函式中區域變數 (locals) 名稱的元組。" -#: ../../library/symtable.rst:113 +#: ../../library/symtable.rst:166 msgid "Return a tuple containing names of globals in this function." msgstr "回傳一個包含此函式中全域變數 (globals) 名稱的元組。" -#: ../../library/symtable.rst:117 +#: ../../library/symtable.rst:170 msgid "Return a tuple containing names of nonlocals in this function." msgstr "回傳一個包含此函式中非區域變數 (nonlocals) 名稱的元組。" -#: ../../library/symtable.rst:121 +#: ../../library/symtable.rst:174 msgid "Return a tuple containing names of free variables in this function." msgstr "回傳一個包含此函式中自由變數 (free variables) 名稱的元組。" -#: ../../library/symtable.rst:126 +#: ../../library/symtable.rst:179 msgid "A namespace of a class. This class inherits from :class:`SymbolTable`." msgstr "一個類別的命名空間。該類別繼承自 :class:`SymbolTable`。" -#: ../../library/symtable.rst:130 +#: ../../library/symtable.rst:183 msgid "" "Return a tuple containing the names of method-like functions declared in the " "class." msgstr "回傳一個包含類別中聲明的類似方法之函式名稱的元組。" -#: ../../library/symtable.rst:133 +#: ../../library/symtable.rst:186 msgid "" "Here, the term 'method' designates *any* function defined in the class body " "via :keyword:`def` or :keyword:`async def`." msgstr "" -#: ../../library/symtable.rst:136 +#: ../../library/symtable.rst:189 msgid "" "Functions defined in a deeper scope (e.g., in an inner class) are not picked " "up by :meth:`get_methods`." msgstr "" -#: ../../library/symtable.rst:139 +#: ../../library/symtable.rst:192 msgid "For example:" msgstr "舉例來說:" -#: ../../library/symtable.rst:161 +#: ../../library/symtable.rst:214 msgid "" "Although ``A().f()`` raises :exc:`TypeError` at runtime, ``A.f`` is still " "considered as a method-like function." msgstr "" -#: ../../library/symtable.rst:166 +#: ../../library/symtable.rst:219 msgid "" "An entry in a :class:`SymbolTable` corresponding to an identifier in the " "source. The constructor is not public." msgstr "" ":class:`SymbolTable` 中的條目對應於來源中的識別器。建構函式不是公開的。" -#: ../../library/symtable.rst:171 +#: ../../library/symtable.rst:224 msgid "Return the symbol's name." msgstr "回傳符號的名稱。" -#: ../../library/symtable.rst:175 +#: ../../library/symtable.rst:228 msgid "Return ``True`` if the symbol is used in its block." msgstr "如果該符號在其區塊中使用,則回傳 ``True``。" -#: ../../library/symtable.rst:179 +#: ../../library/symtable.rst:232 msgid "Return ``True`` if the symbol is created from an import statement." msgstr "如果符號是從 import 陳述式建立的,則回傳 ``True``。" -#: ../../library/symtable.rst:183 +#: ../../library/symtable.rst:236 msgid "Return ``True`` if the symbol is a parameter." msgstr "如果符號是一個參數,則回傳 ``True``。" -#: ../../library/symtable.rst:187 +#: ../../library/symtable.rst:240 msgid "Return ``True`` if the symbol is global." msgstr "如果符號是全域的,則回傳 ``True``。" -#: ../../library/symtable.rst:191 +#: ../../library/symtable.rst:244 msgid "Return ``True`` if the symbol is nonlocal." msgstr "如果符號是非區域的,則回傳 ``True``。" -#: ../../library/symtable.rst:195 +#: ../../library/symtable.rst:248 msgid "" "Return ``True`` if the symbol is declared global with a global statement." msgstr "如果使用全域陳述式將符號聲明為全域的,則回傳 ``True``。" -#: ../../library/symtable.rst:199 +#: ../../library/symtable.rst:252 msgid "Return ``True`` if the symbol is local to its block." msgstr "如果符號是其區塊的區域符號,則回傳 ``True``。" -#: ../../library/symtable.rst:203 +#: ../../library/symtable.rst:256 msgid "Return ``True`` if the symbol is annotated." msgstr "如果符號有被註釋,則回傳 ``True``。" -#: ../../library/symtable.rst:209 +#: ../../library/symtable.rst:262 msgid "" "Return ``True`` if the symbol is referenced in its block, but not assigned " "to." @@ -250,25 +300,25 @@ msgstr "" "如果該符號在其區塊中被參照 (referenced) 但未被賦值 (assigned),則回傳 " "``True``。" -#: ../../library/symtable.rst:214 +#: ../../library/symtable.rst:267 msgid "Return ``True`` if the symbol is assigned to in its block." msgstr "如果該符號被賦值到其區塊中,則回傳 ``True``。" -#: ../../library/symtable.rst:218 +#: ../../library/symtable.rst:271 msgid "Return ``True`` if name binding introduces new namespace." msgstr "如果名稱綁定引入 (introduce) 新的命名空間,則回傳 ``True``。" -#: ../../library/symtable.rst:220 +#: ../../library/symtable.rst:273 msgid "" "If the name is used as the target of a function or class statement, this " "will be true." msgstr "如果名稱用作函式或類別陳述式的目標,則這將會是 true。" -#: ../../library/symtable.rst:223 +#: ../../library/symtable.rst:276 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/symtable.rst:225 +#: ../../library/symtable.rst:278 msgid "" ">>> table = symtable.symtable(\"def some_func(): pass\", \"string\", " "\"exec\")\n" @@ -280,7 +330,7 @@ msgstr "" ">>> table.lookup(\"some_func\").is_namespace()\n" "True" -#: ../../library/symtable.rst:229 +#: ../../library/symtable.rst:282 msgid "" "Note that a single name can be bound to multiple objects. If the result is " "``True``, the name may also be bound to other objects, like an int or list, " @@ -289,14 +339,44 @@ msgstr "" "請注意,單個名稱可以綁定到多個物件。如果結果為 ``True``,則該名稱也可能被綁定" "到其他物件,例如 int 或 list,而不會引入新的命名空間。" -#: ../../library/symtable.rst:235 +#: ../../library/symtable.rst:288 msgid "Return a list of namespaces bound to this name." msgstr "回傳綁定到該名稱的命名空間的串列。" -#: ../../library/symtable.rst:239 +#: ../../library/symtable.rst:292 msgid "" "Return the namespace bound to this name. If more than one or no namespace is " "bound to this name, a :exc:`ValueError` is raised." msgstr "" "回傳綁定到該名稱的命名空間。如果該名稱綁定了多個命名空間或沒有命名空間,則會" "引發 :exc:`ValueError`。" + +#: ../../library/symtable.rst:299 +msgid "Command-Line Usage" +msgstr "" + +#: ../../library/symtable.rst:303 +msgid "" +"The :mod:`symtable` module can be executed as a script from the command line." +msgstr "" + +#: ../../library/symtable.rst:305 +msgid "python -m symtable [infile...]" +msgstr "" + +#: ../../library/symtable.rst:309 +msgid "" +"Symbol tables are generated for the specified Python source files and dumped " +"to stdout. If no input file is specified, the content is read from stdin." +msgstr "" + +#~ msgid "" +#~ "Return the type of the symbol table. Possible values are ``'class'``, " +#~ "``'module'``, ``'function'``, ``'annotation'``, ``'TypeVar bound'``, " +#~ "``'type alias'``, and ``'type parameter'``. The latter four refer to " +#~ "different flavors of :ref:`annotation scopes `." +#~ msgstr "" +#~ "回傳符號表的種類。可能的值為 ``'class'``、``'module'``、``'function'``、" +#~ "``'annotation'``、``'TypeVar bound'``、``'type alias'`` 和 ``'type " +#~ "parameter'``。後四個是指不同的\\ :ref:`註釋範圍 (annotation scopes) " +#~ "`。" diff --git a/library/sys.monitoring.po b/library/sys.monitoring.po index 7845ea8083..67cae05d1b 100644 --- a/library/sys.monitoring.po +++ b/library/sys.monitoring.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -121,114 +121,107 @@ msgstr "" "sys.monitoring.PROFILER_ID = 2\n" "sys.monitoring.OPTIMIZER_ID = 5" -#: ../../library/sys.monitoring.rst:78 -msgid "" -"There is no obligation to set an ID, nor is there anything preventing a tool " -"from using an ID even it is already in use. However, tools are encouraged to " -"use a unique ID and respect other tools." -msgstr "" - -#: ../../library/sys.monitoring.rst:83 +#: ../../library/sys.monitoring.rst:80 msgid "Events" msgstr "事件" -#: ../../library/sys.monitoring.rst:85 +#: ../../library/sys.monitoring.rst:82 msgid "The following events are supported:" msgstr "" -#: ../../library/sys.monitoring.rst:89 +#: ../../library/sys.monitoring.rst:86 msgid "A conditional branch is taken (or not)." msgstr "" -#: ../../library/sys.monitoring.rst:93 +#: ../../library/sys.monitoring.rst:90 msgid "A call in Python code (event occurs before the call)." msgstr "" -#: ../../library/sys.monitoring.rst:97 +#: ../../library/sys.monitoring.rst:94 msgid "" "An exception raised from any callable, except for Python functions (event " "occurs after the exit)." msgstr "" -#: ../../library/sys.monitoring.rst:101 +#: ../../library/sys.monitoring.rst:98 msgid "" "Return from any callable, except for Python functions (event occurs after " "the return)." msgstr "" -#: ../../library/sys.monitoring.rst:105 +#: ../../library/sys.monitoring.rst:102 msgid "An exception is handled." msgstr "" -#: ../../library/sys.monitoring.rst:109 +#: ../../library/sys.monitoring.rst:106 msgid "A VM instruction is about to be executed." msgstr "" -#: ../../library/sys.monitoring.rst:113 +#: ../../library/sys.monitoring.rst:110 msgid "An unconditional jump in the control flow graph is made." msgstr "" -#: ../../library/sys.monitoring.rst:117 +#: ../../library/sys.monitoring.rst:114 msgid "" "An instruction is about to be executed that has a different line number from " "the preceding instruction." msgstr "" -#: ../../library/sys.monitoring.rst:121 +#: ../../library/sys.monitoring.rst:118 msgid "" "Resumption of a Python function (for generator and coroutine functions), " "except for ``throw()`` calls." msgstr "" -#: ../../library/sys.monitoring.rst:125 +#: ../../library/sys.monitoring.rst:122 msgid "" "Return from a Python function (occurs immediately before the return, the " "callee's frame will be on the stack)." msgstr "" -#: ../../library/sys.monitoring.rst:129 +#: ../../library/sys.monitoring.rst:126 msgid "" "Start of a Python function (occurs immediately after the call, the callee's " "frame will be on the stack)" msgstr "" -#: ../../library/sys.monitoring.rst:133 +#: ../../library/sys.monitoring.rst:130 msgid "A Python function is resumed by a ``throw()`` call." msgstr "" -#: ../../library/sys.monitoring.rst:137 +#: ../../library/sys.monitoring.rst:134 msgid "Exit from a Python function during exception unwinding." msgstr "" -#: ../../library/sys.monitoring.rst:141 +#: ../../library/sys.monitoring.rst:138 msgid "" "Yield from a Python function (occurs immediately before the yield, the " "callee's frame will be on the stack)." msgstr "" -#: ../../library/sys.monitoring.rst:145 +#: ../../library/sys.monitoring.rst:142 msgid "" "An exception is raised, except those that cause a :monitoring-event:" "`STOP_ITERATION` event." msgstr "" -#: ../../library/sys.monitoring.rst:149 +#: ../../library/sys.monitoring.rst:146 msgid "" "An exception is re-raised, for example at the end of a :keyword:`finally` " "block." msgstr "" -#: ../../library/sys.monitoring.rst:153 +#: ../../library/sys.monitoring.rst:150 msgid "" "An artificial :exc:`StopIteration` is raised; see `the STOP_ITERATION " "event`_." msgstr "" -#: ../../library/sys.monitoring.rst:156 +#: ../../library/sys.monitoring.rst:153 msgid "More events may be added in the future." msgstr "" -#: ../../library/sys.monitoring.rst:158 +#: ../../library/sys.monitoring.rst:155 msgid "" "These events are attributes of the :mod:`!sys.monitoring.events` namespace. " "Each event is represented as a power-of-2 integer constant. To define a set " @@ -237,11 +230,11 @@ msgid "" "events, use the expression ``PY_RETURN | PY_START``." msgstr "" -#: ../../library/sys.monitoring.rst:166 +#: ../../library/sys.monitoring.rst:163 msgid "An alias for ``0`` so users can do explicit comparisons like::" msgstr "" -#: ../../library/sys.monitoring.rst:168 +#: ../../library/sys.monitoring.rst:165 msgid "" "if get_events(DEBUGGER_ID) == NO_EVENTS:\n" " ..." @@ -249,80 +242,80 @@ msgstr "" "if get_events(DEBUGGER_ID) == NO_EVENTS:\n" " ..." -#: ../../library/sys.monitoring.rst:171 +#: ../../library/sys.monitoring.rst:168 msgid "Events are divided into three groups:" msgstr "" -#: ../../library/sys.monitoring.rst:174 +#: ../../library/sys.monitoring.rst:171 msgid "Local events" msgstr "" -#: ../../library/sys.monitoring.rst:176 +#: ../../library/sys.monitoring.rst:173 msgid "" "Local events are associated with normal execution of the program and happen " "at clearly defined locations. All local events can be disabled. The local " "events are:" msgstr "" -#: ../../library/sys.monitoring.rst:180 +#: ../../library/sys.monitoring.rst:177 msgid ":monitoring-event:`PY_START`" msgstr ":monitoring-event:`PY_START`" -#: ../../library/sys.monitoring.rst:181 +#: ../../library/sys.monitoring.rst:178 msgid ":monitoring-event:`PY_RESUME`" msgstr ":monitoring-event:`PY_RESUME`" -#: ../../library/sys.monitoring.rst:182 +#: ../../library/sys.monitoring.rst:179 msgid ":monitoring-event:`PY_RETURN`" msgstr ":monitoring-event:`PY_RETURN`" -#: ../../library/sys.monitoring.rst:183 +#: ../../library/sys.monitoring.rst:180 msgid ":monitoring-event:`PY_YIELD`" msgstr ":monitoring-event:`PY_YIELD`" -#: ../../library/sys.monitoring.rst:184 +#: ../../library/sys.monitoring.rst:181 msgid ":monitoring-event:`CALL`" msgstr ":monitoring-event:`CALL`" -#: ../../library/sys.monitoring.rst:185 +#: ../../library/sys.monitoring.rst:182 msgid ":monitoring-event:`LINE`" msgstr ":monitoring-event:`LINE`" -#: ../../library/sys.monitoring.rst:186 +#: ../../library/sys.monitoring.rst:183 msgid ":monitoring-event:`INSTRUCTION`" msgstr ":monitoring-event:`INSTRUCTION`" -#: ../../library/sys.monitoring.rst:187 +#: ../../library/sys.monitoring.rst:184 msgid ":monitoring-event:`JUMP`" msgstr ":monitoring-event:`JUMP`" -#: ../../library/sys.monitoring.rst:188 +#: ../../library/sys.monitoring.rst:185 msgid ":monitoring-event:`BRANCH`" msgstr ":monitoring-event:`BRANCH`" -#: ../../library/sys.monitoring.rst:189 +#: ../../library/sys.monitoring.rst:186 msgid ":monitoring-event:`STOP_ITERATION`" msgstr ":monitoring-event:`STOP_ITERATION`" -#: ../../library/sys.monitoring.rst:192 +#: ../../library/sys.monitoring.rst:189 msgid "Ancillary events" msgstr "輔助事件" -#: ../../library/sys.monitoring.rst:194 +#: ../../library/sys.monitoring.rst:191 msgid "" "Ancillary events can be monitored like other events, but are controlled by " "another event:" msgstr "" -#: ../../library/sys.monitoring.rst:197 +#: ../../library/sys.monitoring.rst:194 msgid ":monitoring-event:`C_RAISE`" msgstr ":monitoring-event:`C_RAISE`" -#: ../../library/sys.monitoring.rst:198 +#: ../../library/sys.monitoring.rst:195 msgid ":monitoring-event:`C_RETURN`" msgstr ":monitoring-event:`C_RETURN`" -#: ../../library/sys.monitoring.rst:200 +#: ../../library/sys.monitoring.rst:197 msgid "" "The :monitoring-event:`C_RETURN` and :monitoring-event:`C_RAISE` events are " "controlled by the :monitoring-event:`CALL` event. :monitoring-event:" @@ -330,41 +323,41 @@ msgid "" "corresponding :monitoring-event:`CALL` event is being monitored." msgstr "" -#: ../../library/sys.monitoring.rst:206 +#: ../../library/sys.monitoring.rst:203 msgid "Other events" msgstr "其他事件" -#: ../../library/sys.monitoring.rst:208 +#: ../../library/sys.monitoring.rst:205 msgid "" "Other events are not necessarily tied to a specific location in the program " "and cannot be individually disabled." msgstr "" -#: ../../library/sys.monitoring.rst:211 +#: ../../library/sys.monitoring.rst:208 msgid "The other events that can be monitored are:" msgstr "" -#: ../../library/sys.monitoring.rst:213 +#: ../../library/sys.monitoring.rst:210 msgid ":monitoring-event:`PY_THROW`" msgstr ":monitoring-event:`PY_THROW`" -#: ../../library/sys.monitoring.rst:214 +#: ../../library/sys.monitoring.rst:211 msgid ":monitoring-event:`PY_UNWIND`" msgstr ":monitoring-event:`PY_UNWIND`" -#: ../../library/sys.monitoring.rst:215 +#: ../../library/sys.monitoring.rst:212 msgid ":monitoring-event:`RAISE`" msgstr ":monitoring-event:`RAISE`" -#: ../../library/sys.monitoring.rst:216 +#: ../../library/sys.monitoring.rst:213 msgid ":monitoring-event:`EXCEPTION_HANDLED`" msgstr ":monitoring-event:`EXCEPTION_HANDLED`" -#: ../../library/sys.monitoring.rst:220 +#: ../../library/sys.monitoring.rst:217 msgid "The STOP_ITERATION event" msgstr "" -#: ../../library/sys.monitoring.rst:222 +#: ../../library/sys.monitoring.rst:219 msgid "" ":pep:`PEP 380 <380#use-of-stopiteration-to-return-values>` specifies that a :" "exc:`StopIteration` exception is raised when returning a value from a " @@ -373,7 +366,7 @@ msgid "" "an exception unless it would be visible to other code." msgstr "" -#: ../../library/sys.monitoring.rst:228 +#: ../../library/sys.monitoring.rst:225 msgid "" "To allow tools to monitor for real exceptions without slowing down " "generators and coroutines, the :monitoring-event:`STOP_ITERATION` event is " @@ -381,47 +374,51 @@ msgid "" "unlike :monitoring-event:`RAISE`." msgstr "" -#: ../../library/sys.monitoring.rst:234 +#: ../../library/sys.monitoring.rst:231 msgid "Turning events on and off" msgstr "" -#: ../../library/sys.monitoring.rst:236 +#: ../../library/sys.monitoring.rst:233 msgid "" "In order to monitor an event, it must be turned on and a corresponding " "callback must be registered. Events can be turned on or off by setting the " "events either globally or for a particular code object." msgstr "" -#: ../../library/sys.monitoring.rst:243 +#: ../../library/sys.monitoring.rst:240 msgid "Setting events globally" msgstr "" -#: ../../library/sys.monitoring.rst:245 +#: ../../library/sys.monitoring.rst:242 msgid "" "Events can be controlled globally by modifying the set of events being " "monitored." msgstr "" -#: ../../library/sys.monitoring.rst:249 +#: ../../library/sys.monitoring.rst:246 msgid "Returns the ``int`` representing all the active events." msgstr "" -#: ../../library/sys.monitoring.rst:253 +#: ../../library/sys.monitoring.rst:250 msgid "" "Activates all events which are set in *event_set*. Raises a :exc:" "`ValueError` if *tool_id* is not in use." msgstr "" -#: ../../library/sys.monitoring.rst:256 +#: ../../library/sys.monitoring.rst:253 msgid "No events are active by default." msgstr "" -#: ../../library/sys.monitoring.rst:259 +#: ../../library/sys.monitoring.rst:256 msgid "Per code object events" msgstr "" -#: ../../library/sys.monitoring.rst:261 -msgid "Events can also be controlled on a per code object basis." +#: ../../library/sys.monitoring.rst:258 +msgid "" +"Events can also be controlled on a per code object basis. The functions " +"defined below which accept a :class:`types.CodeType` should be prepared to " +"accept a look-alike object from functions which are not defined in Python " +"(see :ref:`monitoring`)." msgstr "" #: ../../library/sys.monitoring.rst:265 diff --git a/library/sys.po b/library/sys.po index e82894aa18..77f594eaca 100644 --- a/library/sys.po +++ b/library/sys.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-04-26 02:54+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,8 +42,8 @@ msgid "" "removed)." msgstr "" -#: ../../library/sys.rst:25 ../../library/sys.rst:765 -#: ../../library/sys.rst:1459 +#: ../../library/sys.rst:25 ../../library/sys.rst:778 +#: ../../library/sys.rst:1489 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" @@ -248,13 +248,23 @@ msgid "" "during reference leak debugging." msgstr "" -#: ../../library/sys.rst:196 ../../library/sys.rst:212 -#: ../../library/sys.rst:225 +#: ../../library/sys.rst:196 ../../library/sys.rst:223 +#: ../../library/sys.rst:236 msgid "" "This function should be used for internal and specialized purposes only." msgstr "" -#: ../../library/sys.rst:201 +#: ../../library/sys.rst:198 +msgid "Use the more general :func:`_clear_internal_caches` function instead." +msgstr "" + +#: ../../library/sys.rst:204 +msgid "" +"Clear all internal performance-related caches. Use this function *only* to " +"release unnecessary references and memory blocks when hunting for leaks." +msgstr "" + +#: ../../library/sys.rst:212 msgid "" "Return a dictionary mapping each thread's identifier to the topmost stack " "frame currently active in that thread at the time the function is called. " @@ -262,7 +272,7 @@ msgid "" "given such a frame." msgstr "" -#: ../../library/sys.rst:206 +#: ../../library/sys.rst:217 msgid "" "This is most useful for debugging deadlock: this function does not require " "the deadlocked threads' cooperation, and such threads' call stacks are " @@ -271,14 +281,14 @@ msgid "" "by the time calling code examines the frame." msgstr "" -#: ../../library/sys.rst:214 +#: ../../library/sys.rst:225 msgid "" "Raises an :ref:`auditing event ` ``sys._current_frames`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys._current_frames``。" -#: ../../library/sys.rst:218 +#: ../../library/sys.rst:229 msgid "" "Return a dictionary mapping each thread's identifier to the topmost " "exception currently active in that thread at the time the function is " @@ -286,11 +296,11 @@ msgid "" "included in the result dictionary." msgstr "" -#: ../../library/sys.rst:223 +#: ../../library/sys.rst:234 msgid "This is most useful for statistical profiling." msgstr "" -#: ../../library/sys.rst:227 +#: ../../library/sys.rst:238 msgid "" "Raises an :ref:`auditing event ` ``sys._current_exceptions`` with " "no arguments." @@ -298,20 +308,20 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." "_current_exceptions``。" -#: ../../library/sys.rst:229 +#: ../../library/sys.rst:240 msgid "" "Each value in the dictionary is now a single exception instance, rather than " "a 3-tuple as returned from ``sys.exc_info()``." msgstr "" -#: ../../library/sys.rst:235 +#: ../../library/sys.rst:246 msgid "" "This hook function is called by built-in :func:`breakpoint`. By default, it " "drops you into the :mod:`pdb` debugger, but it can be set to any other " "function so that you can choose which debugger gets used." msgstr "" -#: ../../library/sys.rst:239 +#: ../../library/sys.rst:250 msgid "" "The signature of this function is dependent on what it calls. For example, " "the default binding (e.g. ``pdb.set_trace()``) expects no arguments, but you " @@ -321,7 +331,7 @@ msgid "" "returns is returned from ``breakpoint()``." msgstr "" -#: ../../library/sys.rst:246 +#: ../../library/sys.rst:257 msgid "" "The default implementation first consults the environment variable :envvar:" "`PYTHONBREAKPOINT`. If that is set to ``\"0\"`` then this function returns " @@ -335,48 +345,48 @@ msgid "" "breakpointhook()`` returns to the built-in :func:`breakpoint` function." msgstr "" -#: ../../library/sys.rst:258 +#: ../../library/sys.rst:269 msgid "" "Note that if anything goes wrong while importing the callable named by :" "envvar:`PYTHONBREAKPOINT`, a :exc:`RuntimeWarning` is reported and the " "breakpoint is ignored." msgstr "" -#: ../../library/sys.rst:262 +#: ../../library/sys.rst:273 msgid "" "Also note that if ``sys.breakpointhook()`` is overridden programmatically, :" "envvar:`PYTHONBREAKPOINT` is *not* consulted." msgstr "" -#: ../../library/sys.rst:269 +#: ../../library/sys.rst:280 msgid "" "Print low-level information to stderr about the state of CPython's memory " "allocator." msgstr "" -#: ../../library/sys.rst:272 +#: ../../library/sys.rst:283 msgid "" "If Python is :ref:`built in debug mode ` (:option:`configure --" "with-pydebug option <--with-pydebug>`), it also performs some expensive " "internal consistency checks." msgstr "" -#: ../../library/sys.rst:280 +#: ../../library/sys.rst:291 msgid "" "This function is specific to CPython. The exact output format is not " "defined here, and may change." msgstr "" -#: ../../library/sys.rst:286 +#: ../../library/sys.rst:297 msgid "Integer specifying the handle of the Python DLL." msgstr "" -#: ../../library/sys.rst:288 ../../library/sys.rst:978 -#: ../../library/sys.rst:1745 ../../library/sys.rst:1981 +#: ../../library/sys.rst:299 ../../library/sys.rst:991 +#: ../../library/sys.rst:1769 ../../library/sys.rst:2013 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/sys.rst:293 +#: ../../library/sys.rst:304 msgid "" "If *value* is not ``None``, this function prints ``repr(value)`` to ``sys." "stdout``, and saves *value* in ``builtins._``. If ``repr(value)`` is not " @@ -385,7 +395,7 @@ msgid "" "encoding`` with ``'backslashreplace'`` error handler." msgstr "" -#: ../../library/sys.rst:299 +#: ../../library/sys.rst:310 msgid "" "``sys.displayhook`` is called on the result of evaluating an :term:" "`expression` entered in an interactive Python session. The display of these " @@ -393,11 +403,11 @@ msgid "" "displayhook``." msgstr "" -#: ../../library/sys.rst:303 +#: ../../library/sys.rst:314 msgid "Pseudo-code::" msgstr "" -#: ../../library/sys.rst:305 +#: ../../library/sys.rst:316 msgid "" "def displayhook(value):\n" " if value is None:\n" @@ -418,11 +428,11 @@ msgid "" " builtins._ = value" msgstr "" -#: ../../library/sys.rst:323 +#: ../../library/sys.rst:334 msgid "Use ``'backslashreplace'`` error handler on :exc:`UnicodeEncodeError`." msgstr "" -#: ../../library/sys.rst:329 +#: ../../library/sys.rst:340 msgid "" "If this is true, Python won't try to write ``.pyc`` files on the import of " "source modules. This value is initially set to ``True`` or ``False`` " @@ -431,20 +441,20 @@ msgid "" "to control bytecode file generation." msgstr "" -#: ../../library/sys.rst:338 +#: ../../library/sys.rst:349 msgid "" "A :term:`named tuple` holding information about the environment on the " "*wasm32-emscripten* platform. The named tuple is provisional and may change " "in the future." msgstr "" -#: ../../library/sys.rst:344 +#: ../../library/sys.rst:355 msgid "" "Emscripten version as tuple of ints (major, minor, micro), e.g. ``(3, 1, " "8)``." msgstr "" -#: ../../library/sys.rst:348 +#: ../../library/sys.rst:359 msgid "" "Runtime string, e.g. browser user agent, ``'Node.js v14.18.2'``, or " "``'UNKNOWN'``." @@ -452,19 +462,19 @@ msgstr "" "運行環境字串,例如瀏覽器使用者代理 (browser user agent) ``'Node.js " "v14.18.2'`` 或 ``'UNKNOWN'``。" -#: ../../library/sys.rst:352 +#: ../../library/sys.rst:363 msgid "``True`` if Python is compiled with Emscripten pthreads support." msgstr "" -#: ../../library/sys.rst:356 +#: ../../library/sys.rst:367 msgid "``True`` if Python is compiled with shared memory support." msgstr "" -#: ../../library/sys.rst:358 +#: ../../library/sys.rst:369 msgid ":ref:`Availability `: Emscripten." msgstr ":ref:`適用 `:Emscripten。" -#: ../../library/sys.rst:365 +#: ../../library/sys.rst:376 msgid "" "If this is set (not ``None``), Python will write bytecode-cache ``.pyc`` " "files to (and read them from) a parallel directory tree rooted at this " @@ -475,12 +485,12 @@ msgid "" "with the same pycache prefix (if any) that you will use at runtime." msgstr "" -#: ../../library/sys.rst:373 +#: ../../library/sys.rst:384 msgid "" "A relative path is interpreted relative to the current working directory." msgstr "" -#: ../../library/sys.rst:375 +#: ../../library/sys.rst:386 msgid "" "This value is initially set based on the value of the :option:`-X` " "``pycache_prefix=PATH`` command-line option or the :envvar:" @@ -488,12 +498,12 @@ msgid "" "If neither are set, it is ``None``." msgstr "" -#: ../../library/sys.rst:385 +#: ../../library/sys.rst:396 msgid "" "This function prints out a given traceback and exception to ``sys.stderr``." msgstr "" -#: ../../library/sys.rst:387 +#: ../../library/sys.rst:398 msgid "" "When an exception other than :exc:`SystemExit` is raised and uncaught, the " "interpreter calls ``sys.excepthook`` with three arguments, the exception " @@ -504,7 +514,7 @@ msgid "" "argument function to ``sys.excepthook``." msgstr "" -#: ../../library/sys.rst:394 ../../library/sys.rst:396 +#: ../../library/sys.rst:405 ../../library/sys.rst:407 msgid "" "Raise an auditing event ``sys.excepthook`` with arguments ``hook``, " "``type``, ``value``, ``traceback`` when an uncaught exception occurs. If no " @@ -514,14 +524,14 @@ msgid "" "excepthook`` will be called." msgstr "" -#: ../../library/sys.rst:405 +#: ../../library/sys.rst:416 msgid "" "The :func:`sys.unraisablehook` function handles unraisable exceptions and " "the :func:`threading.excepthook` function handles exception raised by :func:" "`threading.Thread.run`." msgstr "" -#: ../../library/sys.rst:415 +#: ../../library/sys.rst:426 msgid "" "These objects contain the original values of ``breakpointhook``, " "``displayhook``, ``excepthook``, and ``unraisablehook`` at the start of the " @@ -530,15 +540,15 @@ msgid "" "get replaced with broken or alternative objects." msgstr "" -#: ../../library/sys.rst:421 +#: ../../library/sys.rst:432 msgid "__breakpointhook__" msgstr "__breakpointhook__" -#: ../../library/sys.rst:424 +#: ../../library/sys.rst:435 msgid "__unraisablehook__" msgstr "__unraisablehook__" -#: ../../library/sys.rst:430 +#: ../../library/sys.rst:441 msgid "" "This function, when called while an exception handler is executing (such as " "an ``except`` or ``except*`` clause), returns the exception instance that " @@ -546,11 +556,11 @@ msgid "" "another, only the exception handled by the innermost handler is accessible." msgstr "" -#: ../../library/sys.rst:435 +#: ../../library/sys.rst:446 msgid "If no exception handler is executing, this function returns ``None``." msgstr "" -#: ../../library/sys.rst:442 +#: ../../library/sys.rst:453 msgid "" "This function returns the old-style representation of the handled exception. " "If an exception ``e`` is currently handled (so :func:`exception` would " @@ -561,13 +571,13 @@ msgid "" "stack at the point where the exception last occurred." msgstr "" -#: ../../library/sys.rst:453 +#: ../../library/sys.rst:464 msgid "" "If no exception is being handled anywhere on the stack, this function return " "a tuple containing three ``None`` values." msgstr "" -#: ../../library/sys.rst:456 +#: ../../library/sys.rst:467 msgid "" "The ``type`` and ``traceback`` fields are now derived from the ``value`` " "(the exception instance), so when an exception is modified while it is being " @@ -575,7 +585,7 @@ msgid "" "func:`exc_info`." msgstr "" -#: ../../library/sys.rst:464 +#: ../../library/sys.rst:475 msgid "" "A string giving the site-specific directory prefix where the platform-" "dependent Python files are installed; by default, this is also ``'/usr/" @@ -587,7 +597,7 @@ msgid "" "is the version number of Python, for example ``3.2``." msgstr "" -#: ../../library/sys.rst:475 +#: ../../library/sys.rst:486 msgid "" "If a :ref:`virtual environment ` is in effect, this value will be " "changed in ``site.py`` to point to the virtual environment. The value for " @@ -595,7 +605,7 @@ msgid "" "`base_exec_prefix`." msgstr "" -#: ../../library/sys.rst:483 +#: ../../library/sys.rst:494 msgid "" "A string giving the absolute path of the executable binary for the Python " "interpreter, on systems where this makes sense. If Python is unable to " @@ -603,13 +613,13 @@ msgid "" "empty string or ``None``." msgstr "" -#: ../../library/sys.rst:491 +#: ../../library/sys.rst:502 msgid "" "Raise a :exc:`SystemExit` exception, signaling an intention to exit the " "interpreter." msgstr "" -#: ../../library/sys.rst:493 +#: ../../library/sys.rst:504 msgid "" "The optional argument *arg* can be an integer giving the exit status " "(defaulting to zero), or another type of object. If it is an integer, zero " @@ -625,7 +635,7 @@ msgid "" "way to exit a program when an error occurs." msgstr "" -#: ../../library/sys.rst:506 +#: ../../library/sys.rst:517 msgid "" "Since :func:`exit` ultimately \"only\" raises an exception, it will only " "exit the process when called from the main thread, and the exception is not " @@ -634,113 +644,113 @@ msgid "" "an outer level." msgstr "" -#: ../../library/sys.rst:511 +#: ../../library/sys.rst:522 msgid "" "If an error occurs in the cleanup after the Python interpreter has caught :" "exc:`SystemExit` (such as an error flushing buffered data in the standard " "streams), the exit status is changed to 120." msgstr "" -#: ../../library/sys.rst:519 +#: ../../library/sys.rst:530 msgid "" "The :term:`named tuple` *flags* exposes the status of command line flags. " "The attributes are read only." msgstr "" -#: ../../library/sys.rst:525 +#: ../../library/sys.rst:536 msgid ":option:`-d`" msgstr ":option:`-d`" -#: ../../library/sys.rst:528 ../../library/sys.rst:531 +#: ../../library/sys.rst:539 ../../library/sys.rst:542 msgid ":option:`-i`" msgstr ":option:`-i`" -#: ../../library/sys.rst:534 +#: ../../library/sys.rst:545 msgid ":option:`-I`" msgstr ":option:`-I`" -#: ../../library/sys.rst:537 +#: ../../library/sys.rst:548 msgid ":option:`-O` or :option:`-OO`" msgstr ":option:`-O` 或 :option:`-OO`" -#: ../../library/sys.rst:540 +#: ../../library/sys.rst:551 msgid ":option:`-B`" msgstr ":option:`-B`" -#: ../../library/sys.rst:543 +#: ../../library/sys.rst:554 msgid ":option:`-s`" msgstr ":option:`-s`" -#: ../../library/sys.rst:546 +#: ../../library/sys.rst:557 msgid ":option:`-S`" msgstr ":option:`-S`" -#: ../../library/sys.rst:549 +#: ../../library/sys.rst:560 msgid ":option:`-E`" msgstr ":option:`-E`" -#: ../../library/sys.rst:552 +#: ../../library/sys.rst:563 msgid ":option:`-v`" msgstr ":option:`-v`" -#: ../../library/sys.rst:555 +#: ../../library/sys.rst:566 msgid ":option:`-b`" msgstr ":option:`-b`" -#: ../../library/sys.rst:558 +#: ../../library/sys.rst:569 msgid ":option:`-q`" msgstr ":option:`-q`" -#: ../../library/sys.rst:561 +#: ../../library/sys.rst:572 msgid ":option:`-R`" msgstr ":option:`-R`" -#: ../../library/sys.rst:564 +#: ../../library/sys.rst:575 msgid ":option:`-X dev <-X>` (:ref:`Python Development Mode `)" msgstr ":option:`-X dev <-X>` (:ref:`Python 開發模式 `)" -#: ../../library/sys.rst:567 +#: ../../library/sys.rst:578 msgid ":option:`-X utf8 <-X>`" msgstr ":option:`-X utf8 <-X>`" -#: ../../library/sys.rst:570 +#: ../../library/sys.rst:581 msgid ":option:`-P`" msgstr ":option:`-P`" -#: ../../library/sys.rst:573 +#: ../../library/sys.rst:584 msgid "" ":option:`-X int_max_str_digits <-X>` (:ref:`integer string conversion length " "limitation `)" msgstr "" -#: ../../library/sys.rst:577 +#: ../../library/sys.rst:588 msgid ":option:`-X warn_default_encoding <-X>`" msgstr ":option:`-X warn_default_encoding <-X>`" -#: ../../library/sys.rst:579 +#: ../../library/sys.rst:590 msgid "Added ``quiet`` attribute for the new :option:`-q` flag." msgstr "新增 ``quiet`` 屬性,用於新的 :option:`-q` 旗標。" -#: ../../library/sys.rst:582 +#: ../../library/sys.rst:593 msgid "The ``hash_randomization`` attribute." msgstr "``hash_randomization`` 屬性。" -#: ../../library/sys.rst:585 +#: ../../library/sys.rst:596 msgid "Removed obsolete ``division_warning`` attribute." msgstr "移除過時的 ``division_warning`` 屬性。" -#: ../../library/sys.rst:588 +#: ../../library/sys.rst:599 msgid "Added ``isolated`` attribute for :option:`-I` ``isolated`` flag." msgstr "新增 ``isolated`` 屬性,用於 :option:`-I` ``isolated`` 旗標。" -#: ../../library/sys.rst:591 +#: ../../library/sys.rst:602 msgid "" "Added the ``dev_mode`` attribute for the new :ref:`Python Development Mode " "` and the ``utf8_mode`` attribute for the new :option:`-X` " "``utf8`` flag." msgstr "" -#: ../../library/sys.rst:596 +#: ../../library/sys.rst:607 msgid "" "Added ``warn_default_encoding`` attribute for :option:`-X` " "``warn_default_encoding`` flag." @@ -748,15 +758,15 @@ msgstr "" "新增 ``warn_default_encoding`` 屬性,用於 :option:`-X` " "``warn_default_encoding`` 旗標。" -#: ../../library/sys.rst:599 +#: ../../library/sys.rst:610 msgid "Added the ``safe_path`` attribute for :option:`-P` option." msgstr "新增 ``safe_path`` 屬性,用於 :option:`-P` 選項。" -#: ../../library/sys.rst:602 +#: ../../library/sys.rst:613 msgid "Added the ``int_max_str_digits`` attribute." msgstr "新增 ``int_max_str_digits`` 屬性。" -#: ../../library/sys.rst:608 +#: ../../library/sys.rst:619 msgid "" "A :term:`named tuple` holding information about the float type. It contains " "low level information about the precision and internal representation. The " @@ -766,161 +776,161 @@ msgid "" "floating types', for details." msgstr "" -#: ../../library/sys.rst:615 +#: ../../library/sys.rst:626 msgid "Attributes of the :data:`!float_info` :term:`named tuple`" msgstr "" -#: ../../library/sys.rst:618 +#: ../../library/sys.rst:629 msgid "attribute" msgstr "屬性" -#: ../../library/sys.rst:619 +#: ../../library/sys.rst:630 msgid "float.h macro" msgstr "float.h macro" -#: ../../library/sys.rst:620 +#: ../../library/sys.rst:631 msgid "explanation" msgstr "解釋" -#: ../../library/sys.rst:623 +#: ../../library/sys.rst:634 msgid ":c:macro:`!DBL_EPSILON`" msgstr ":c:macro:`!DBL_EPSILON`" -#: ../../library/sys.rst:624 +#: ../../library/sys.rst:635 msgid "" "difference between 1.0 and the least value greater than 1.0 that is " "representable as a float." msgstr "" -#: ../../library/sys.rst:627 +#: ../../library/sys.rst:638 msgid "See also :func:`math.ulp`." msgstr "另請參閱 :func:`math.ulp`。" -#: ../../library/sys.rst:630 +#: ../../library/sys.rst:641 msgid ":c:macro:`!DBL_DIG`" msgstr ":c:macro:`!DBL_DIG`" -#: ../../library/sys.rst:631 +#: ../../library/sys.rst:642 msgid "" "The maximum number of decimal digits that can be faithfully represented in a " "float; see below." msgstr "" -#: ../../library/sys.rst:635 +#: ../../library/sys.rst:646 msgid ":c:macro:`!DBL_MANT_DIG`" msgstr ":c:macro:`!DBL_MANT_DIG`" -#: ../../library/sys.rst:636 +#: ../../library/sys.rst:647 msgid "" "Float precision: the number of base-``radix`` digits in the significand of a " "float." msgstr "" -#: ../../library/sys.rst:640 +#: ../../library/sys.rst:651 msgid ":c:macro:`!DBL_MAX`" msgstr ":c:macro:`!DBL_MAX`" -#: ../../library/sys.rst:641 +#: ../../library/sys.rst:652 msgid "The maximum representable positive finite float." msgstr "" -#: ../../library/sys.rst:644 +#: ../../library/sys.rst:655 msgid ":c:macro:`!DBL_MAX_EXP`" msgstr ":c:macro:`!DBL_MAX_EXP`" -#: ../../library/sys.rst:645 +#: ../../library/sys.rst:656 msgid "" "The maximum integer *e* such that ``radix**(e-1)`` is a representable finite " "float." msgstr "" -#: ../../library/sys.rst:649 +#: ../../library/sys.rst:660 msgid ":c:macro:`!DBL_MAX_10_EXP`" msgstr ":c:macro:`!DBL_MAX_10_EXP`" -#: ../../library/sys.rst:650 +#: ../../library/sys.rst:661 msgid "" "The maximum integer *e* such that ``10**e`` is in the range of representable " "finite floats." msgstr "" -#: ../../library/sys.rst:654 +#: ../../library/sys.rst:665 msgid ":c:macro:`!DBL_MIN`" msgstr ":c:macro:`!DBL_MIN`" -#: ../../library/sys.rst:655 +#: ../../library/sys.rst:666 msgid "The minimum representable positive *normalized* float." msgstr "" -#: ../../library/sys.rst:657 +#: ../../library/sys.rst:668 msgid "" "Use :func:`math.ulp(0.0) ` to get the smallest positive " "*denormalized* representable float." msgstr "" -#: ../../library/sys.rst:661 +#: ../../library/sys.rst:672 msgid ":c:macro:`!DBL_MIN_EXP`" msgstr ":c:macro:`!DBL_MIN_EXP`" -#: ../../library/sys.rst:662 +#: ../../library/sys.rst:673 msgid "" "The minimum integer *e* such that ``radix**(e-1)`` is a normalized float." msgstr "" -#: ../../library/sys.rst:666 +#: ../../library/sys.rst:677 msgid ":c:macro:`!DBL_MIN_10_EXP`" msgstr ":c:macro:`!DBL_MIN_10_EXP`" -#: ../../library/sys.rst:667 +#: ../../library/sys.rst:678 msgid "The minimum integer *e* such that ``10**e`` is a normalized float." msgstr "" -#: ../../library/sys.rst:670 +#: ../../library/sys.rst:681 msgid ":c:macro:`!FLT_RADIX`" msgstr ":c:macro:`!FLT_RADIX`" -#: ../../library/sys.rst:671 +#: ../../library/sys.rst:682 msgid "The radix of exponent representation." msgstr "" -#: ../../library/sys.rst:674 +#: ../../library/sys.rst:685 msgid ":c:macro:`!FLT_ROUNDS`" msgstr ":c:macro:`!FLT_ROUNDS`" -#: ../../library/sys.rst:675 +#: ../../library/sys.rst:686 msgid "" "An integer representing the rounding mode for floating-point arithmetic. " "This reflects the value of the system :c:macro:`!FLT_ROUNDS` macro at " "interpreter startup time:" msgstr "" -#: ../../library/sys.rst:679 +#: ../../library/sys.rst:690 msgid "``-1``: indeterminable" msgstr "" -#: ../../library/sys.rst:680 +#: ../../library/sys.rst:691 msgid "``0``: toward zero" msgstr "" -#: ../../library/sys.rst:681 +#: ../../library/sys.rst:692 msgid "``1``: to nearest" msgstr "" -#: ../../library/sys.rst:682 +#: ../../library/sys.rst:693 msgid "``2``: toward positive infinity" msgstr "" -#: ../../library/sys.rst:683 +#: ../../library/sys.rst:694 msgid "``3``: toward negative infinity" msgstr "" -#: ../../library/sys.rst:685 +#: ../../library/sys.rst:696 msgid "" "All other values for :c:macro:`!FLT_ROUNDS` characterize implementation-" "defined rounding behavior." msgstr "" -#: ../../library/sys.rst:688 +#: ../../library/sys.rst:699 msgid "" "The attribute :attr:`sys.float_info.dig` needs further explanation. If " "``s`` is any string representing a decimal number with at most :attr:`!sys." @@ -928,7 +938,7 @@ msgid "" "back again will recover a string representing the same decimal value::" msgstr "" -#: ../../library/sys.rst:694 +#: ../../library/sys.rst:705 msgid "" ">>> import sys\n" ">>> sys.float_info.dig\n" @@ -938,20 +948,20 @@ msgid "" "'3.14159265358979'" msgstr "" -#: ../../library/sys.rst:701 +#: ../../library/sys.rst:712 msgid "" "But for strings with more than :attr:`sys.float_info.dig` significant " "digits, this isn't always true::" msgstr "" -#: ../../library/sys.rst:704 +#: ../../library/sys.rst:715 msgid "" ">>> s = '9876543211234567' # 16 significant digits is too many!\n" ">>> format(float(s), '.16g') # conversion changes value\n" "'9876543211234568'" msgstr "" -#: ../../library/sys.rst:710 +#: ../../library/sys.rst:721 msgid "" "A string indicating how the :func:`repr` function behaves for floats. If " "the string has value ``'short'`` then for a finite float ``x``, ``repr(x)`` " @@ -961,47 +971,51 @@ msgid "" "same way as it did in versions of Python prior to 3.1." msgstr "" -#: ../../library/sys.rst:723 +#: ../../library/sys.rst:734 msgid "" "Return the number of memory blocks currently allocated by the interpreter, " "regardless of their size. This function is mainly useful for tracking and " "debugging memory leaks. Because of the interpreter's internal caches, the " "result can vary from call to call; you may have to call :func:" -"`_clear_type_cache` and :func:`gc.collect` to get more predictable results." +"`_clear_internal_caches` and :func:`gc.collect` to get more predictable " +"results." msgstr "" -#: ../../library/sys.rst:730 +#: ../../library/sys.rst:741 msgid "" "If a Python build or implementation cannot reasonably compute this " "information, :func:`getallocatedblocks` is allowed to return 0 instead." msgstr "" -#: ../../library/sys.rst:738 +#: ../../library/sys.rst:749 msgid "Return the number of unicode objects that have been interned." msgstr "" -#: ../../library/sys.rst:745 -msgid "Return the build time API version of Android as an integer." +#: ../../library/sys.rst:756 +msgid "" +"Return the build-time API level of Android as an integer. This represents " +"the minimum version of Android this build of Python can run on. For runtime " +"version information, see :func:`platform.android_ver`." msgstr "" -#: ../../library/sys.rst:747 +#: ../../library/sys.rst:760 msgid ":ref:`Availability `: Android." msgstr ":ref:`適用 `:Android。" -#: ../../library/sys.rst:754 +#: ../../library/sys.rst:767 msgid "" "Return the name of the current default string encoding used by the Unicode " "implementation." msgstr "" -#: ../../library/sys.rst:760 +#: ../../library/sys.rst:773 msgid "" "Return the current value of the flags that are used for :c:func:`dlopen` " "calls. Symbolic names for the flag values can be found in the :mod:`os` " "module (:samp:`RTLD_{xxx}` constants, e.g. :const:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:770 +#: ../../library/sys.rst:783 msgid "" "Get the :term:`filesystem encoding `: " "the encoding used with the :term:`filesystem error handler ` is enabled." msgstr "" -#: ../../library/sys.rst:803 +#: ../../library/sys.rst:816 msgid "" "Get the :term:`filesystem error handler `: the error handler used with the :term:`filesystem encoding " @@ -1056,35 +1070,35 @@ msgid "" "func:`getfilesystemencoding`." msgstr "" -#: ../../library/sys.rst:821 +#: ../../library/sys.rst:834 msgid "" "Returns the current value for the :ref:`integer string conversion length " "limitation `. See also :func:`set_int_max_str_digits`." msgstr "" -#: ../../library/sys.rst:828 +#: ../../library/sys.rst:841 msgid "" "Return the reference count of the *object*. The count returned is generally " "one higher than you might expect, because it includes the (temporary) " "reference as an argument to :func:`getrefcount`." msgstr "" -#: ../../library/sys.rst:832 +#: ../../library/sys.rst:845 msgid "" "Note that the returned value may not actually reflect how many references to " -"the object are actually held. For example, some objects are \"immortal\" " -"and have a very high refcount that does not reflect the actual number of " -"references. Consequently, do not rely on the returned value to be accurate, " -"other than a value of 0 or 1." +"the object are actually held. For example, some objects are :term:" +"`immortal` and have a very high refcount that does not reflect the actual " +"number of references. Consequently, do not rely on the returned value to be " +"accurate, other than a value of 0 or 1." msgstr "" -#: ../../library/sys.rst:838 +#: ../../library/sys.rst:851 msgid "" "Immortal objects have very large refcounts that do not match the actual " "number of references to the object." msgstr "" -#: ../../library/sys.rst:844 +#: ../../library/sys.rst:857 msgid "" "Return the current value of the recursion limit, the maximum depth of the " "Python interpreter stack. This limit prevents infinite recursion from " @@ -1092,33 +1106,33 @@ msgid "" "func:`setrecursionlimit`." msgstr "" -#: ../../library/sys.rst:852 +#: ../../library/sys.rst:865 msgid "" "Return the size of an object in bytes. The object can be any type of object. " "All built-in objects will return correct results, but this does not have to " "hold true for third-party extensions as it is implementation specific." msgstr "" -#: ../../library/sys.rst:857 +#: ../../library/sys.rst:870 msgid "" "Only the memory consumption directly attributed to the object is accounted " "for, not the memory consumption of objects it refers to." msgstr "" -#: ../../library/sys.rst:860 +#: ../../library/sys.rst:873 msgid "" "If given, *default* will be returned if the object does not provide means to " "retrieve the size. Otherwise a :exc:`TypeError` will be raised." msgstr "" -#: ../../library/sys.rst:863 +#: ../../library/sys.rst:876 msgid "" ":func:`getsizeof` calls the object's ``__sizeof__`` method and adds an " "additional garbage collector overhead if the object is managed by the " "garbage collector." msgstr "" -#: ../../library/sys.rst:867 +#: ../../library/sys.rst:880 msgid "" "See `recursive sizeof recipe `_ for an example of " @@ -1126,13 +1140,13 @@ msgid "" "their contents." msgstr "" -#: ../../library/sys.rst:873 +#: ../../library/sys.rst:886 msgid "" "Return the interpreter's \"thread switch interval\"; see :func:" "`setswitchinterval`." msgstr "" -#: ../../library/sys.rst:881 +#: ../../library/sys.rst:894 msgid "" "Return a frame object from the call stack. If optional integer *depth* is " "given, return the frame object that many calls below the top of the stack. " @@ -1141,7 +1155,7 @@ msgid "" "stack." msgstr "" -#: ../../library/sys.rst:886 +#: ../../library/sys.rst:899 msgid "" "Raises an :ref:`auditing event ` ``sys._getframe`` with argument " "``frame``." @@ -1149,13 +1163,13 @@ msgstr "" "引發一個附帶引數 ``frame`` 的\\ :ref:`稽核事件 ` ``sys." "_getframe``。" -#: ../../library/sys.rst:890 ../../library/sys.rst:906 +#: ../../library/sys.rst:903 ../../library/sys.rst:919 msgid "" "This function should be used for internal and specialized purposes only. It " "is not guaranteed to exist in all implementations of Python." msgstr "" -#: ../../library/sys.rst:896 +#: ../../library/sys.rst:909 msgid "" "Return the name of a module from the call stack. If optional integer " "*depth* is given, return the module that many calls below the top of the " @@ -1164,7 +1178,7 @@ msgid "" "returning the module at the top of the call stack." msgstr "" -#: ../../library/sys.rst:902 +#: ../../library/sys.rst:915 msgid "" "Raises an :ref:`auditing event ` ``sys._getframemodulename`` with " "argument ``depth``." @@ -1172,15 +1186,15 @@ msgstr "" "引發一個附帶引數 ``depth`` 的\\ :ref:`稽核事件 ` ``sys." "_getframemodulename``。" -#: ../../library/sys.rst:916 +#: ../../library/sys.rst:929 msgid "Get the profiler function as set by :func:`setprofile`." msgstr "" -#: ../../library/sys.rst:925 +#: ../../library/sys.rst:938 msgid "Get the trace function as set by :func:`settrace`." msgstr "" -#: ../../library/sys.rst:929 +#: ../../library/sys.rst:942 msgid "" "The :func:`gettrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -1188,7 +1202,7 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:937 +#: ../../library/sys.rst:950 msgid "" "Return a named tuple describing the Windows version currently running. The " "named elements are *major*, *minor*, *build*, *platform*, *service_pack*, " @@ -1200,54 +1214,54 @@ msgid "" "first 5 elements are retrievable by indexing." msgstr "" -#: ../../library/sys.rst:948 +#: ../../library/sys.rst:961 msgid "*platform* will be ``2`` (VER_PLATFORM_WIN32_NT)." msgstr "" -#: ../../library/sys.rst:950 +#: ../../library/sys.rst:963 msgid "*product_type* may be one of the following values:" msgstr "" -#: ../../library/sys.rst:953 +#: ../../library/sys.rst:966 msgid "Constant" msgstr "" -#: ../../library/sys.rst:953 +#: ../../library/sys.rst:966 msgid "Meaning" msgstr "含義" -#: ../../library/sys.rst:955 +#: ../../library/sys.rst:968 msgid "``1`` (VER_NT_WORKSTATION)" msgstr "``1`` (VER_NT_WORKSTATION)" -#: ../../library/sys.rst:955 +#: ../../library/sys.rst:968 msgid "The system is a workstation." msgstr "" -#: ../../library/sys.rst:957 +#: ../../library/sys.rst:970 msgid "``2`` (VER_NT_DOMAIN_CONTROLLER)" msgstr "``2`` (VER_NT_DOMAIN_CONTROLLER)" -#: ../../library/sys.rst:957 +#: ../../library/sys.rst:970 msgid "The system is a domain controller." msgstr "" -#: ../../library/sys.rst:960 +#: ../../library/sys.rst:973 msgid "``3`` (VER_NT_SERVER)" msgstr "``3`` (VER_NT_SERVER)" -#: ../../library/sys.rst:960 +#: ../../library/sys.rst:973 msgid "The system is a server, but not a domain controller." msgstr "" -#: ../../library/sys.rst:964 +#: ../../library/sys.rst:977 msgid "" "This function wraps the Win32 :c:func:`!GetVersionEx` function; see the " "Microsoft documentation on :c:func:`!OSVERSIONINFOEX` for more information " "about these fields." msgstr "" -#: ../../library/sys.rst:968 +#: ../../library/sys.rst:981 msgid "" "*platform_version* returns the major version, minor version and build number " "of the current operating system, rather than the version that is being " @@ -1255,24 +1269,24 @@ msgid "" "feature detection." msgstr "" -#: ../../library/sys.rst:974 +#: ../../library/sys.rst:987 msgid "" "*platform_version* derives the version from kernel32.dll which can be of a " "different version than the OS version. Please use :mod:`platform` module for " "achieving accurate OS version." msgstr "" -#: ../../library/sys.rst:980 +#: ../../library/sys.rst:993 msgid "" "Changed to a named tuple and added *service_pack_minor*, " "*service_pack_major*, *suite_mask*, and *product_type*." msgstr "" -#: ../../library/sys.rst:984 +#: ../../library/sys.rst:997 msgid "Added *platform_version*" msgstr "新增 *platform_version*" -#: ../../library/sys.rst:990 +#: ../../library/sys.rst:1003 msgid "" "Returns an *asyncgen_hooks* object, which is similar to a :class:" "`~collections.namedtuple` of the form ``(firstiter, finalizer)``, where " @@ -1282,71 +1296,71 @@ msgid "" "loop." msgstr "" -#: ../../library/sys.rst:997 +#: ../../library/sys.rst:1010 msgid "See :pep:`525` for more details." msgstr "更多細節請見 :pep:`525`。" -#: ../../library/sys.rst:1001 ../../library/sys.rst:1677 +#: ../../library/sys.rst:1014 ../../library/sys.rst:1701 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.)" msgstr "" -#: ../../library/sys.rst:1007 +#: ../../library/sys.rst:1020 msgid "" "Get the current coroutine origin tracking depth, as set by :func:" "`set_coroutine_origin_tracking_depth`." msgstr "" -#: ../../library/sys.rst:1013 ../../library/sys.rst:1698 +#: ../../library/sys.rst:1026 ../../library/sys.rst:1722 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.) Use it only for debugging purposes." msgstr "" -#: ../../library/sys.rst:1019 +#: ../../library/sys.rst:1032 msgid "" "A :term:`named tuple` giving parameters of the numeric hash implementation. " "For more details about hashing of numeric types, see :ref:`numeric-hash`." msgstr "" -#: ../../library/sys.rst:1025 +#: ../../library/sys.rst:1038 msgid "The width in bits used for hash values" msgstr "" -#: ../../library/sys.rst:1029 +#: ../../library/sys.rst:1042 msgid "The prime modulus P used for numeric hash scheme" msgstr "" -#: ../../library/sys.rst:1033 +#: ../../library/sys.rst:1046 msgid "The hash value returned for a positive infinity" msgstr "" -#: ../../library/sys.rst:1037 +#: ../../library/sys.rst:1050 msgid "(This attribute is no longer used)" msgstr "" -#: ../../library/sys.rst:1041 +#: ../../library/sys.rst:1054 msgid "The multiplier used for the imaginary part of a complex number" msgstr "" -#: ../../library/sys.rst:1045 +#: ../../library/sys.rst:1058 msgid "The name of the algorithm for hashing of str, bytes, and memoryview" msgstr "" -#: ../../library/sys.rst:1049 +#: ../../library/sys.rst:1062 msgid "The internal output size of the hash algorithm" msgstr "" -#: ../../library/sys.rst:1053 +#: ../../library/sys.rst:1066 msgid "The size of the seed key of the hash algorithm" msgstr "" -#: ../../library/sys.rst:1057 +#: ../../library/sys.rst:1070 msgid "Added *algorithm*, *hash_bits* and *seed_bits*" msgstr "新增 *algorithm*、*hash_bits* 與 *seed_bits*" -#: ../../library/sys.rst:1063 +#: ../../library/sys.rst:1076 msgid "" "The version number encoded as a single integer. This is guaranteed to " "increase with each version, including proper support for non-production " @@ -1354,7 +1368,7 @@ msgid "" "version 1.5.2, use::" msgstr "" -#: ../../library/sys.rst:1067 +#: ../../library/sys.rst:1080 msgid "" "if sys.hexversion >= 0x010502F0:\n" " # use some advanced feature\n" @@ -1364,7 +1378,7 @@ msgid "" " ..." msgstr "" -#: ../../library/sys.rst:1074 +#: ../../library/sys.rst:1087 msgid "" "This is called ``hexversion`` since it only really looks meaningful when " "viewed as the result of passing it to the built-in :func:`hex` function. " @@ -1372,25 +1386,25 @@ msgid "" "human-friendly encoding of the same information." msgstr "" -#: ../../library/sys.rst:1079 +#: ../../library/sys.rst:1092 msgid "More details of ``hexversion`` can be found at :ref:`apiabiversion`." msgstr "" -#: ../../library/sys.rst:1084 +#: ../../library/sys.rst:1097 msgid "" "An object containing information about the implementation of the currently " "running Python interpreter. The following attributes are required to exist " "in all Python implementations." msgstr "" -#: ../../library/sys.rst:1088 +#: ../../library/sys.rst:1101 msgid "" "*name* is the implementation's identifier, e.g. ``'cpython'``. The actual " "string is defined by the Python implementation, but it is guaranteed to be " "lower case." msgstr "" -#: ../../library/sys.rst:1092 +#: ../../library/sys.rst:1105 msgid "" "*version* is a named tuple, in the same format as :data:`sys.version_info`. " "It represents the version of the Python *implementation*. This has a " @@ -1402,13 +1416,13 @@ msgid "" "the same value, since it is the reference implementation." msgstr "" -#: ../../library/sys.rst:1102 +#: ../../library/sys.rst:1115 msgid "" "*hexversion* is the implementation version in hexadecimal format, like :data:" "`sys.hexversion`." msgstr "" -#: ../../library/sys.rst:1105 +#: ../../library/sys.rst:1118 msgid "" "*cache_tag* is the tag used by the import machinery in the filenames of " "cached modules. By convention, it would be a composite of the " @@ -1417,7 +1431,7 @@ msgid "" "set to ``None``, it indicates that module caching should be disabled." msgstr "" -#: ../../library/sys.rst:1112 +#: ../../library/sys.rst:1125 msgid "" ":data:`sys.implementation` may contain additional attributes specific to the " "Python implementation. These non-standard attributes must start with an " @@ -1427,41 +1441,41 @@ msgid "" "versions, however.) See :pep:`421` for more information." msgstr "" -#: ../../library/sys.rst:1123 +#: ../../library/sys.rst:1136 msgid "" "The addition of new required attributes must go through the normal PEP " "process. See :pep:`421` for more information." msgstr "" -#: ../../library/sys.rst:1128 +#: ../../library/sys.rst:1141 msgid "" "A :term:`named tuple` that holds information about Python's internal " "representation of integers. The attributes are read only." msgstr "" -#: ../../library/sys.rst:1133 +#: ../../library/sys.rst:1146 msgid "" "The number of bits held in each digit. Python integers are stored internally " "in base ``2**int_info.bits_per_digit``." msgstr "" -#: ../../library/sys.rst:1138 +#: ../../library/sys.rst:1151 msgid "The size in bytes of the C type used to represent a digit." msgstr "" -#: ../../library/sys.rst:1142 +#: ../../library/sys.rst:1155 msgid "" "The default value for :func:`sys.get_int_max_str_digits` when it is not " "otherwise explicitly configured." msgstr "" -#: ../../library/sys.rst:1147 +#: ../../library/sys.rst:1160 msgid "" "The minimum non-zero value for :func:`sys.set_int_max_str_digits`, :envvar:" "`PYTHONINTMAXSTRDIGITS`, or :option:`-X int_max_str_digits <-X>`." msgstr "" -#: ../../library/sys.rst:1154 +#: ../../library/sys.rst:1167 msgid "" "Added :attr:`~int_info.default_max_str_digits` and :attr:`~int_info." "str_digits_check_threshold`." @@ -1469,7 +1483,7 @@ msgstr "" "新增 :attr:`~int_info.default_max_str_digits` 和 :attr:`~int_info." "str_digits_check_threshold`。" -#: ../../library/sys.rst:1160 +#: ../../library/sys.rst:1173 msgid "" "When this attribute exists, its value is automatically called (with no " "arguments) when the interpreter is launched in :ref:`interactive mode `." msgstr "" -#: ../../library/sys.rst:1166 ../../library/sys.rst:1168 +#: ../../library/sys.rst:1179 ../../library/sys.rst:1181 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_interactivehook`` " "with the hook object as the argument when the hook is called on startup." msgstr "" -#: ../../library/sys.rst:1177 +#: ../../library/sys.rst:1190 msgid "" "Enter *string* in the table of \"interned\" strings and return the interned " "string -- which is *string* itself or a copy. Interning strings is useful to " @@ -1496,19 +1510,29 @@ msgid "" "attributes have interned keys." msgstr "" -#: ../../library/sys.rst:1185 +#: ../../library/sys.rst:1198 msgid "" -"Interned strings are not immortal; you must keep a reference to the return " -"value of :func:`intern` around to benefit from it." +"Interned strings are not :term:`immortal`; you must keep a reference to the " +"return value of :func:`intern` around to benefit from it." msgstr "" -#: ../../library/sys.rst:1191 +#: ../../library/sys.rst:1204 msgid "" -"Return :const:`True` if the Python interpreter is :term:`shutting down " -"`, :const:`False` otherwise." +"Return :const:`True` if the :term:`GIL` is enabled and :const:`False` if it " +"is disabled." msgstr "" -#: ../../library/sys.rst:1198 +#: ../../library/sys.rst:1212 +msgid "" +"Return :const:`True` if the main Python interpreter is :term:`shutting down " +"`. Return :const:`False` otherwise." +msgstr "" + +#: ../../library/sys.rst:1215 +msgid "See also the :exc:`PythonFinalizationError` exception." +msgstr "" + +#: ../../library/sys.rst:1221 msgid "" "This variable is not always defined; it is set to the exception instance " "when an exception is not handled and the interpreter prints an error message " @@ -1519,34 +1543,44 @@ msgid "" "more information.)" msgstr "" -#: ../../library/sys.rst:1212 +#: ../../library/sys.rst:1233 +msgid "" +"Return :const:`True` if the given string is \"interned\", :const:`False` " +"otherwise." +msgstr "" + +#: ../../library/sys.rst:1240 +msgid "It is not guaranteed to exist in all implementations of Python." +msgstr "" + +#: ../../library/sys.rst:1247 msgid "" "These three variables are deprecated; use :data:`sys.last_exc` instead. They " "hold the legacy representation of ``sys.last_exc``, as returned from :func:" "`exc_info` above." msgstr "" -#: ../../library/sys.rst:1218 +#: ../../library/sys.rst:1253 msgid "" "An integer giving the maximum value a variable of type :c:type:`Py_ssize_t` " "can take. It's usually ``2**31 - 1`` on a 32-bit platform and ``2**63 - 1`` " "on a 64-bit platform." msgstr "" -#: ../../library/sys.rst:1225 +#: ../../library/sys.rst:1260 msgid "" "An integer giving the value of the largest Unicode code point, i.e. " "``1114111`` (``0x10FFFF`` in hexadecimal)." msgstr "" -#: ../../library/sys.rst:1228 +#: ../../library/sys.rst:1263 msgid "" "Before :pep:`393`, ``sys.maxunicode`` used to be either ``0xFFFF`` or " "``0x10FFFF``, depending on the configuration option that specified whether " "Unicode characters were stored as UCS-2 or UCS-4." msgstr "" -#: ../../library/sys.rst:1236 +#: ../../library/sys.rst:1271 msgid "" "A list of :term:`meta path finder` objects that have their :meth:`~importlib." "abc.MetaPathFinder.find_spec` methods called to see if one of the objects " @@ -1559,40 +1593,40 @@ msgid "" "if the module cannot be found." msgstr "" -#: ../../library/sys.rst:1248 +#: ../../library/sys.rst:1283 msgid ":class:`importlib.abc.MetaPathFinder`" msgstr ":class:`importlib.abc.MetaPathFinder`" -#: ../../library/sys.rst:1249 +#: ../../library/sys.rst:1284 msgid "" "The abstract base class defining the interface of finder objects on :data:" "`meta_path`." msgstr "" -#: ../../library/sys.rst:1251 +#: ../../library/sys.rst:1286 msgid ":class:`importlib.machinery.ModuleSpec`" msgstr ":class:`importlib.machinery.ModuleSpec`" -#: ../../library/sys.rst:1252 +#: ../../library/sys.rst:1287 msgid "" "The concrete class which :meth:`~importlib.abc.MetaPathFinder.find_spec` " "should return instances of." msgstr "" -#: ../../library/sys.rst:1258 +#: ../../library/sys.rst:1293 msgid "" ":term:`Module specs ` were introduced in Python 3.4, by :pep:" "`451`." msgstr "" -#: ../../library/sys.rst:1263 +#: ../../library/sys.rst:1298 msgid "" "Removed the fallback that looked for a :meth:`!find_module` method if a :" "data:`meta_path` entry didn't have a :meth:`~importlib.abc.MetaPathFinder." "find_spec` method." msgstr "" -#: ../../library/sys.rst:1269 +#: ../../library/sys.rst:1304 msgid "" "This is a dictionary that maps module names to modules which have already " "been loaded. This can be manipulated to force reloading of modules and " @@ -1604,13 +1638,13 @@ msgid "" "other threads." msgstr "" -#: ../../library/sys.rst:1281 +#: ../../library/sys.rst:1316 msgid "" "The list of the original command line arguments passed to the Python " "executable." msgstr "" -#: ../../library/sys.rst:1284 +#: ../../library/sys.rst:1319 msgid "" "The elements of :data:`sys.orig_argv` are the arguments to the Python " "interpreter, while the elements of :data:`sys.argv` are the arguments to the " @@ -1618,68 +1652,68 @@ msgid "" "in :data:`sys.orig_argv` and missing from :data:`sys.argv`." msgstr "" -#: ../../library/sys.rst:1296 +#: ../../library/sys.rst:1331 msgid "" "A list of strings that specifies the search path for modules. Initialized " "from the environment variable :envvar:`PYTHONPATH`, plus an installation-" "dependent default." msgstr "" -#: ../../library/sys.rst:1300 +#: ../../library/sys.rst:1335 msgid "" "By default, as initialized upon program startup, a potentially unsafe path " "is prepended to :data:`sys.path` (*before* the entries inserted as a result " "of :envvar:`PYTHONPATH`):" msgstr "" -#: ../../library/sys.rst:1304 +#: ../../library/sys.rst:1339 msgid "" "``python -m module`` command line: prepend the current working directory." msgstr "" -#: ../../library/sys.rst:1306 +#: ../../library/sys.rst:1341 msgid "" "``python script.py`` command line: prepend the script's directory. If it's a " "symbolic link, resolve symbolic links." msgstr "" -#: ../../library/sys.rst:1308 +#: ../../library/sys.rst:1343 msgid "" "``python -c code`` and ``python`` (REPL) command lines: prepend an empty " "string, which means the current working directory." msgstr "" -#: ../../library/sys.rst:1311 +#: ../../library/sys.rst:1346 msgid "" "To not prepend this potentially unsafe path, use the :option:`-P` command " "line option or the :envvar:`PYTHONSAFEPATH` environment variable." msgstr "" -#: ../../library/sys.rst:1314 +#: ../../library/sys.rst:1349 msgid "" "A program is free to modify this list for its own purposes. Only strings " "should be added to :data:`sys.path`; all other data types are ignored during " "import." msgstr "" -#: ../../library/sys.rst:1320 +#: ../../library/sys.rst:1355 msgid "" "Module :mod:`site` This describes how to use .pth files to extend :data:`sys." "path`." msgstr "" -#: ../../library/sys.rst:1325 +#: ../../library/sys.rst:1360 msgid "" "A list of callables that take a path argument to try to create a :term:" "`finder` for the path. If a finder can be created, it is to be returned by " "the callable, else raise :exc:`ImportError`." msgstr "" -#: ../../library/sys.rst:1329 ../../library/sys.rst:1340 +#: ../../library/sys.rst:1364 ../../library/sys.rst:1375 msgid "Originally specified in :pep:`302`." msgstr "" -#: ../../library/sys.rst:1334 +#: ../../library/sys.rst:1369 msgid "" "A dictionary acting as a cache for :term:`finder` objects. The keys are " "paths that have been passed to :data:`sys.path_hooks` and the values are the " @@ -1687,166 +1721,175 @@ msgid "" "is found on :data:`sys.path_hooks` then ``None`` is stored." msgstr "" -#: ../../library/sys.rst:1345 -msgid "" -"This string contains a platform identifier that can be used to append " -"platform-specific components to :data:`sys.path`, for instance." -msgstr "" - -#: ../../library/sys.rst:1348 -msgid "" -"For Unix systems, except on Linux and AIX, this is the lowercased OS name as " -"returned by ``uname -s`` with the first part of the version as returned by " -"``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, *at the time " -"when Python was built*. Unless you want to test for a specific system " -"version, it is therefore recommended to use the following idiom::" -msgstr "" - -#: ../../library/sys.rst:1354 -msgid "" -"if sys.platform.startswith('freebsd'):\n" -" # FreeBSD-specific code here...\n" -"elif sys.platform.startswith('linux'):\n" -" # Linux-specific code here...\n" -"elif sys.platform.startswith('aix'):\n" -" # AIX-specific code here..." -msgstr "" - -#: ../../library/sys.rst:1361 -msgid "For other systems, the values are:" +#: ../../library/sys.rst:1380 +msgid "A string containing a platform identifier. Known values are:" msgstr "" -#: ../../library/sys.rst:1364 +#: ../../library/sys.rst:1383 msgid "System" msgstr "" -#: ../../library/sys.rst:1364 +#: ../../library/sys.rst:1383 msgid "``platform`` value" msgstr "" -#: ../../library/sys.rst:1366 +#: ../../library/sys.rst:1385 msgid "AIX" msgstr "AIX" -#: ../../library/sys.rst:1366 +#: ../../library/sys.rst:1385 msgid "``'aix'``" msgstr "``'aix'``" -#: ../../library/sys.rst:1367 +#: ../../library/sys.rst:1386 +msgid "Android" +msgstr "" + +#: ../../library/sys.rst:1386 +#, fuzzy +msgid "``'android'``" +msgstr "``'aix'``" + +#: ../../library/sys.rst:1387 msgid "Emscripten" msgstr "Emscripten" -#: ../../library/sys.rst:1367 +#: ../../library/sys.rst:1387 msgid "``'emscripten'``" msgstr "``'emscripten'``" -#: ../../library/sys.rst:1368 +#: ../../library/sys.rst:1388 +msgid "iOS" +msgstr "" + +#: ../../library/sys.rst:1388 +msgid "``'ios'``" +msgstr "" + +#: ../../library/sys.rst:1389 msgid "Linux" msgstr "Linux" -#: ../../library/sys.rst:1368 +#: ../../library/sys.rst:1389 msgid "``'linux'``" msgstr "``'linux'``" -#: ../../library/sys.rst:1369 -msgid "WASI" -msgstr "WASI" +#: ../../library/sys.rst:1390 +msgid "macOS" +msgstr "macOS" -#: ../../library/sys.rst:1369 -msgid "``'wasi'``" -msgstr "``'wasi'``" +#: ../../library/sys.rst:1390 +msgid "``'darwin'``" +msgstr "``'darwin'``" -#: ../../library/sys.rst:1370 +#: ../../library/sys.rst:1391 msgid "Windows" msgstr "Windows" -#: ../../library/sys.rst:1370 +#: ../../library/sys.rst:1391 msgid "``'win32'``" msgstr "``'win32'``" -#: ../../library/sys.rst:1371 +#: ../../library/sys.rst:1392 msgid "Windows/Cygwin" msgstr "Windows/Cygwin" -#: ../../library/sys.rst:1371 +#: ../../library/sys.rst:1392 msgid "``'cygwin'``" msgstr "``'cygwin'``" -#: ../../library/sys.rst:1372 -msgid "macOS" -msgstr "macOS" +#: ../../library/sys.rst:1393 +msgid "WASI" +msgstr "WASI" -#: ../../library/sys.rst:1372 -msgid "``'darwin'``" -msgstr "``'darwin'``" +#: ../../library/sys.rst:1393 +msgid "``'wasi'``" +msgstr "``'wasi'``" + +#: ../../library/sys.rst:1396 +msgid "" +"On Unix systems not listed in the table, the value is the lowercased OS name " +"as returned by ``uname -s``, with the first part of the version as returned " +"by ``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, *at the time " +"when Python was built*. Unless you want to test for a specific system " +"version, it is therefore recommended to use the following idiom::" +msgstr "" -#: ../../library/sys.rst:1375 +#: ../../library/sys.rst:1402 +msgid "" +"if sys.platform.startswith('freebsd'):\n" +" # FreeBSD-specific code here..." +msgstr "" + +#: ../../library/sys.rst:1405 msgid "" "On Linux, :data:`sys.platform` doesn't contain the major version anymore. It " -"is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``. Since older " -"Python versions include the version number, it is recommended to always use " -"the ``startswith`` idiom presented above." +"is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``." msgstr "" -#: ../../library/sys.rst:1381 +#: ../../library/sys.rst:1409 msgid "" "On AIX, :data:`sys.platform` doesn't contain the major version anymore. It " -"is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``. Since older " -"Python versions include the version number, it is recommended to always use " -"the ``startswith`` idiom presented above." +"is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``." msgstr "" -#: ../../library/sys.rst:1389 +#: ../../library/sys.rst:1413 +msgid "" +"On Android, :data:`sys.platform` now returns ``'android'`` rather than " +"``'linux'``." +msgstr "" + +#: ../../library/sys.rst:1419 msgid "" ":data:`os.name` has a coarser granularity. :func:`os.uname` gives system-" "dependent version information." msgstr "" -#: ../../library/sys.rst:1392 +#: ../../library/sys.rst:1422 msgid "" "The :mod:`platform` module provides detailed checks for the system's " "identity." msgstr "" -#: ../../library/sys.rst:1398 +#: ../../library/sys.rst:1428 msgid "" "Name of the platform-specific library directory. It is used to build the " "path of standard library and the paths of installed extension modules." msgstr "" -#: ../../library/sys.rst:1401 +#: ../../library/sys.rst:1431 msgid "" "It is equal to ``\"lib\"`` on most platforms. On Fedora and SuSE, it is " "equal to ``\"lib64\"`` on 64-bit platforms which gives the following ``sys." "path`` paths (where ``X.Y`` is the Python ``major.minor`` version):" msgstr "" -#: ../../library/sys.rst:1405 +#: ../../library/sys.rst:1435 msgid "" "``/usr/lib64/pythonX.Y/``: Standard library (like ``os.py`` of the :mod:`os` " "module)" msgstr "" -#: ../../library/sys.rst:1407 +#: ../../library/sys.rst:1437 msgid "" "``/usr/lib64/pythonX.Y/lib-dynload/``: C extension modules of the standard " "library (like the :mod:`errno` module, the exact filename is platform " "specific)" msgstr "" -#: ../../library/sys.rst:1410 +#: ../../library/sys.rst:1440 msgid "" "``/usr/lib/pythonX.Y/site-packages/`` (always use ``lib``, not :data:`sys." "platlibdir`): Third-party modules" msgstr "" -#: ../../library/sys.rst:1412 +#: ../../library/sys.rst:1442 msgid "" "``/usr/lib64/pythonX.Y/site-packages/``: C extension modules of third-party " "packages" msgstr "" -#: ../../library/sys.rst:1420 +#: ../../library/sys.rst:1450 msgid "" "A string giving the site-specific directory prefix where the platform " "independent Python files are installed; on Unix, the default is :file:`/usr/" @@ -1855,14 +1898,14 @@ msgid "" "derived paths." msgstr "" -#: ../../library/sys.rst:1426 +#: ../../library/sys.rst:1456 msgid "" "If a :ref:`virtual environment ` is in effect, this value will be " "changed in ``site.py`` to point to the virtual environment. The value for " "the Python installation will still be available, via :data:`base_prefix`." msgstr "" -#: ../../library/sys.rst:1441 +#: ../../library/sys.rst:1471 msgid "" "Strings specifying the primary and secondary prompt of the interpreter. " "These are only defined if the interpreter is in interactive mode. Their " @@ -1872,7 +1915,7 @@ msgid "" "used to implement a dynamic prompt." msgstr "" -#: ../../library/sys.rst:1451 +#: ../../library/sys.rst:1481 msgid "" "Set the flags used by the interpreter for :c:func:`dlopen` calls, such as " "when the interpreter loads extension modules. Among other things, this will " @@ -1883,14 +1926,14 @@ msgid "" "g. :const:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:1463 +#: ../../library/sys.rst:1493 msgid "" "Set the :ref:`integer string conversion length limitation " "` used by this interpreter. See also :func:" "`get_int_max_str_digits`." msgstr "" -#: ../../library/sys.rst:1475 +#: ../../library/sys.rst:1505 msgid "" "Set the system's profile function, which allows you to implement a Python " "source code profiler in Python. See chapter :ref:`profile` for more " @@ -1905,14 +1948,14 @@ msgid "" "in the profile function will cause itself unset." msgstr "" -#: ../../library/sys.rst:1487 +#: ../../library/sys.rst:1517 msgid "" "The same tracing mechanism is used for :func:`!setprofile` as :func:" "`settrace`. To trace calls with :func:`!setprofile` inside a tracing " "function (e.g. in a debugger breakpoint), see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1491 +#: ../../library/sys.rst:1521 msgid "" "Profile functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -1920,71 +1963,71 @@ msgid "" "depends on the event type." msgstr "" -#: ../../library/sys.rst:1496 ../../library/sys.rst:1583 +#: ../../library/sys.rst:1526 ../../library/sys.rst:1613 msgid "The events have the following meaning:" msgstr "" -#: ../../library/sys.rst:1498 ../../library/sys.rst:1585 +#: ../../library/sys.rst:1528 ../../library/sys.rst:1615 msgid "``'call'``" msgstr "``'call'``" -#: ../../library/sys.rst:1499 +#: ../../library/sys.rst:1529 msgid "" "A function is called (or some other code block entered). The profile " "function is called; *arg* is ``None``." msgstr "" -#: ../../library/sys.rst:1502 ../../library/sys.rst:1600 +#: ../../library/sys.rst:1532 ../../library/sys.rst:1630 msgid "``'return'``" msgstr "``'return'``" -#: ../../library/sys.rst:1503 +#: ../../library/sys.rst:1533 msgid "" "A function (or other code block) is about to return. The profile function " "is called; *arg* is the value that will be returned, or ``None`` if the " "event is caused by an exception being raised." msgstr "" -#: ../../library/sys.rst:1507 +#: ../../library/sys.rst:1537 msgid "``'c_call'``" msgstr "``'c_call'``" -#: ../../library/sys.rst:1508 +#: ../../library/sys.rst:1538 msgid "" "A C function is about to be called. This may be an extension function or a " "built-in. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1511 +#: ../../library/sys.rst:1541 msgid "``'c_return'``" msgstr "``'c_return'``" -#: ../../library/sys.rst:1512 +#: ../../library/sys.rst:1542 msgid "A C function has returned. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1514 +#: ../../library/sys.rst:1544 msgid "``'c_exception'``" msgstr "``'c_exception'``" -#: ../../library/sys.rst:1515 +#: ../../library/sys.rst:1545 msgid "A C function has raised an exception. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1517 +#: ../../library/sys.rst:1547 msgid "" "Raises an :ref:`auditing event ` ``sys.setprofile`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.setprofile``。" -#: ../../library/sys.rst:1522 +#: ../../library/sys.rst:1552 msgid "" "Set the maximum depth of the Python interpreter stack to *limit*. This " "limit prevents infinite recursion from causing an overflow of the C stack " "and crashing Python." msgstr "" -#: ../../library/sys.rst:1526 +#: ../../library/sys.rst:1556 msgid "" "The highest possible limit is platform-dependent. A user may need to set " "the limit higher when they have a program that requires deep recursion and a " @@ -1992,19 +2035,19 @@ msgid "" "because a too-high limit can lead to a crash." msgstr "" -#: ../../library/sys.rst:1531 +#: ../../library/sys.rst:1561 msgid "" "If the new limit is too low at the current recursion depth, a :exc:" "`RecursionError` exception is raised." msgstr "" -#: ../../library/sys.rst:1534 +#: ../../library/sys.rst:1564 msgid "" "A :exc:`RecursionError` exception is now raised if the new limit is too low " "at the current recursion depth." msgstr "" -#: ../../library/sys.rst:1541 +#: ../../library/sys.rst:1571 msgid "" "Set the interpreter's thread switch interval (in seconds). This floating-" "point value determines the ideal duration of the \"timeslices\" allocated to " @@ -2015,7 +2058,7 @@ msgid "" "scheduler." msgstr "" -#: ../../library/sys.rst:1558 +#: ../../library/sys.rst:1588 msgid "" "Set the system's trace function, which allows you to implement a Python " "source code debugger in Python. The function is thread-specific; for a " @@ -2024,7 +2067,7 @@ msgid "" "`threading.settrace`." msgstr "" -#: ../../library/sys.rst:1563 +#: ../../library/sys.rst:1593 msgid "" "Trace functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -2032,7 +2075,7 @@ msgid "" "the event type." msgstr "" -#: ../../library/sys.rst:1568 +#: ../../library/sys.rst:1598 msgid "" "The trace function is invoked (with *event* set to ``'call'``) whenever a " "new local scope is entered; it should return a reference to a local trace " @@ -2040,36 +2083,36 @@ msgid "" "traced." msgstr "" -#: ../../library/sys.rst:1573 +#: ../../library/sys.rst:1603 msgid "" "The local trace function should return a reference to itself, or to another " "function which would then be used as the local trace function for the scope." msgstr "" -#: ../../library/sys.rst:1576 +#: ../../library/sys.rst:1606 msgid "" "If there is any error occurred in the trace function, it will be unset, just " "like ``settrace(None)`` is called." msgstr "" -#: ../../library/sys.rst:1580 +#: ../../library/sys.rst:1610 msgid "" "Tracing is disabled while calling the trace function (e.g. a function set " "by :func:`!settrace`). For recursive tracing see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1586 +#: ../../library/sys.rst:1616 msgid "" "A function is called (or some other code block entered). The global trace " "function is called; *arg* is ``None``; the return value specifies the local " "trace function." msgstr "" -#: ../../library/sys.rst:1590 +#: ../../library/sys.rst:1620 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/sys.rst:1591 +#: ../../library/sys.rst:1621 msgid "" "The interpreter is about to execute a new line of code or re-execute the " "condition of a loop. The local trace function is called; *arg* is ``None``; " @@ -2079,7 +2122,7 @@ msgid "" "to :const:`False` on that :ref:`frame `." msgstr "" -#: ../../library/sys.rst:1601 +#: ../../library/sys.rst:1631 msgid "" "A function (or other code block) is about to return. The local trace " "function is called; *arg* is the value that will be returned, or ``None`` if " @@ -2087,22 +2130,22 @@ msgid "" "return value is ignored." msgstr "" -#: ../../library/sys.rst:1606 +#: ../../library/sys.rst:1636 msgid "``'exception'``" msgstr "``'exception'``" -#: ../../library/sys.rst:1607 +#: ../../library/sys.rst:1637 msgid "" "An exception has occurred. The local trace function is called; *arg* is a " "tuple ``(exception, value, traceback)``; the return value specifies the new " "local trace function." msgstr "" -#: ../../library/sys.rst:1611 +#: ../../library/sys.rst:1641 msgid "``'opcode'``" msgstr "``'opcode'``" -#: ../../library/sys.rst:1612 +#: ../../library/sys.rst:1642 msgid "" "The interpreter is about to execute a new opcode (see :mod:`dis` for opcode " "details). The local trace function is called; *arg* is ``None``; the return " @@ -2112,13 +2155,13 @@ msgid "" "objects>`." msgstr "" -#: ../../library/sys.rst:1619 +#: ../../library/sys.rst:1649 msgid "" "Note that as an exception is propagated down the chain of callers, an " "``'exception'`` event is generated at each level." msgstr "" -#: ../../library/sys.rst:1622 +#: ../../library/sys.rst:1652 msgid "" "For more fine-grained usage, it's possible to set a trace function by " "assigning ``frame.f_trace = tracefunc`` explicitly, rather than relying on " @@ -2132,17 +2175,17 @@ msgid "" "on each frame)." msgstr "" -#: ../../library/sys.rst:1633 +#: ../../library/sys.rst:1663 msgid "For more information on code and frame objects, refer to :ref:`types`." msgstr "" -#: ../../library/sys.rst:1635 +#: ../../library/sys.rst:1665 msgid "" "Raises an :ref:`auditing event ` ``sys.settrace`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.settrace``。" -#: ../../library/sys.rst:1639 +#: ../../library/sys.rst:1669 msgid "" "The :func:`settrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -2150,21 +2193,13 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:1646 +#: ../../library/sys.rst:1676 msgid "" "``'opcode'`` event type added; :attr:`~frame.f_trace_lines` and :attr:" "`~frame.f_trace_opcodes` attributes added to frames" msgstr "" -#: ../../library/sys.rst:1649 -msgid "" -"``'opcode'`` event will only be emitted if :attr:`~frame.f_trace_opcodes` of " -"at least one frame has been set to :const:`True` before :func:`settrace` is " -"called. This behavior will be changed back in 3.13 to be consistent with " -"previous versions." -msgstr "" - -#: ../../library/sys.rst:1657 +#: ../../library/sys.rst:1681 msgid "" "Accepts two optional keyword arguments which are callables that accept an :" "term:`asynchronous generator iterator` as an argument. The *firstiter* " @@ -2173,7 +2208,7 @@ msgid "" "about to be garbage collected." msgstr "" -#: ../../library/sys.rst:1663 +#: ../../library/sys.rst:1687 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_firstiter`` with no arguments." @@ -2181,7 +2216,7 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." "set_asyncgen_hooks_firstiter``。" -#: ../../library/sys.rst:1665 +#: ../../library/sys.rst:1689 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_finalizer`` with no arguments." @@ -2189,20 +2224,20 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." "set_asyncgen_hooks_finalizer``。" -#: ../../library/sys.rst:1667 +#: ../../library/sys.rst:1691 msgid "" "Two auditing events are raised because the underlying API consists of two " "calls, each of which must raise its own event." msgstr "" -#: ../../library/sys.rst:1670 +#: ../../library/sys.rst:1694 msgid "" "See :pep:`525` for more details, and for a reference example of a " "*finalizer* method see the implementation of ``asyncio.Loop." "shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`" msgstr "" -#: ../../library/sys.rst:1682 +#: ../../library/sys.rst:1706 msgid "" "Allows enabling or disabling coroutine origin tracking. When enabled, the " "``cr_origin`` attribute on coroutine objects will contain a tuple of " @@ -2211,105 +2246,116 @@ msgid "" "disabled, ``cr_origin`` will be ``None``." msgstr "" -#: ../../library/sys.rst:1689 +#: ../../library/sys.rst:1713 msgid "" "To enable, pass a *depth* value greater than zero; this sets the number of " "frames whose information will be captured. To disable, pass set *depth* to " "zero." msgstr "" -#: ../../library/sys.rst:1693 +#: ../../library/sys.rst:1717 msgid "This setting is thread-specific." msgstr "" -#: ../../library/sys.rst:1703 +#: ../../library/sys.rst:1727 msgid "" "Activate the stack profiler trampoline *backend*. The only supported backend " "is ``\"perf\"``." msgstr "" -#: ../../library/sys.rst:1706 ../../library/sys.rst:1721 -#: ../../library/sys.rst:1729 +#: ../../library/sys.rst:1730 ../../library/sys.rst:1745 +#: ../../library/sys.rst:1753 msgid ":ref:`Availability `: Linux." msgstr ":ref:`適用 `:Linux。" -#: ../../library/sys.rst:1712 +#: ../../library/sys.rst:1736 msgid ":ref:`perf_profiling`" msgstr ":ref:`perf_profiling`" -#: ../../library/sys.rst:1713 +#: ../../library/sys.rst:1737 msgid "https://perf.wiki.kernel.org/" msgstr "https://perf.wiki.kernel.org/" -#: ../../library/sys.rst:1717 +#: ../../library/sys.rst:1741 msgid "Deactivate the current stack profiler trampoline backend." msgstr "" -#: ../../library/sys.rst:1719 +#: ../../library/sys.rst:1743 msgid "If no stack profiler is activated, this function has no effect." msgstr "" -#: ../../library/sys.rst:1727 +#: ../../library/sys.rst:1751 msgid "Return ``True`` if a stack profiler trampoline is active." msgstr "" -#: ../../library/sys.rst:1735 +#: ../../library/sys.rst:1759 msgid "" "Changes the :term:`filesystem encoding and error handler` to 'mbcs' and " "'replace' respectively, for consistency with versions of Python prior to 3.6." msgstr "" -#: ../../library/sys.rst:1739 +#: ../../library/sys.rst:1763 msgid "" "This is equivalent to defining the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable before launching Python." msgstr "" -#: ../../library/sys.rst:1742 +#: ../../library/sys.rst:1766 msgid "" "See also :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors`." msgstr "" -#: ../../library/sys.rst:1747 +#: ../../library/sys.rst:1772 +msgid "" +"Changing the filesystem encoding after Python startup is risky because the " +"old fsencoding or paths encoded by the old fsencoding may be cached " +"somewhere. Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." +msgstr "" + +#: ../../library/sys.rst:1776 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`。" -#: ../../library/sys.rst:1754 +#: ../../library/sys.rst:1779 +msgid "Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." +msgstr "" + +#: ../../library/sys.rst:1786 msgid "" ":term:`File objects ` used by the interpreter for standard " "input, output and errors:" msgstr "" -#: ../../library/sys.rst:1757 +#: ../../library/sys.rst:1789 msgid "" "``stdin`` is used for all interactive input (including calls to :func:" "`input`);" msgstr "" -#: ../../library/sys.rst:1759 +#: ../../library/sys.rst:1791 msgid "" "``stdout`` is used for the output of :func:`print` and :term:`expression` " "statements and for the prompts of :func:`input`;" msgstr "" -#: ../../library/sys.rst:1761 +#: ../../library/sys.rst:1793 msgid "The interpreter's own prompts and its error messages go to ``stderr``." msgstr "" -#: ../../library/sys.rst:1763 +#: ../../library/sys.rst:1795 msgid "" "These streams are regular :term:`text files ` like those returned " "by the :func:`open` function. Their parameters are chosen as follows:" msgstr "" -#: ../../library/sys.rst:1767 +#: ../../library/sys.rst:1799 msgid "" "The encoding and error handling are is initialized from :c:member:`PyConfig." "stdio_encoding` and :c:member:`PyConfig.stdio_errors`." msgstr "" -#: ../../library/sys.rst:1770 +#: ../../library/sys.rst:1802 msgid "" "On Windows, UTF-8 is used for the console device. Non-character devices " "such as disk files and pipes use the system locale encoding (i.e. the ANSI " @@ -2320,14 +2366,14 @@ msgid "" "initially attached to a console." msgstr "" -#: ../../library/sys.rst:1779 +#: ../../library/sys.rst:1811 msgid "" "The special behaviour of the console can be overridden by setting the " "environment variable PYTHONLEGACYWINDOWSSTDIO before starting Python. In " "that case, the console codepages are used as for any other character device." msgstr "" -#: ../../library/sys.rst:1784 +#: ../../library/sys.rst:1816 msgid "" "Under all platforms, you can override the character encoding by setting the :" "envvar:`PYTHONIOENCODING` environment variable before starting Python or by " @@ -2336,7 +2382,7 @@ msgid "" "only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set." msgstr "" -#: ../../library/sys.rst:1791 +#: ../../library/sys.rst:1823 msgid "" "When interactive, the ``stdout`` stream is line-buffered. Otherwise, it is " "block-buffered like regular text files. The ``stderr`` stream is line-" @@ -2345,19 +2391,19 @@ msgid "" "`PYTHONUNBUFFERED` environment variable." msgstr "" -#: ../../library/sys.rst:1797 +#: ../../library/sys.rst:1829 msgid "" "Non-interactive ``stderr`` is now line-buffered instead of fully buffered." msgstr "" -#: ../../library/sys.rst:1803 +#: ../../library/sys.rst:1835 msgid "" "To write or read binary data from/to the standard streams, use the " "underlying binary :data:`~io.TextIOBase.buffer` object. For example, to " "write bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``." msgstr "" -#: ../../library/sys.rst:1807 +#: ../../library/sys.rst:1839 msgid "" "However, if you are writing a library (and do not control in which context " "its code will be executed), be aware that the standard streams may be " @@ -2365,7 +2411,7 @@ msgid "" "support the :attr:`!buffer` attribute." msgstr "" -#: ../../library/sys.rst:1817 +#: ../../library/sys.rst:1849 msgid "" "These objects contain the original values of ``stdin``, ``stderr`` and " "``stdout`` at the start of the program. They are used during finalization, " @@ -2373,7 +2419,7 @@ msgid "" "``sys.std*`` object has been redirected." msgstr "" -#: ../../library/sys.rst:1822 +#: ../../library/sys.rst:1854 msgid "" "It can also be used to restore the actual files to known working file " "objects in case they have been overwritten with a broken object. However, " @@ -2381,7 +2427,7 @@ msgid "" "before replacing it, and restore the saved object." msgstr "" -#: ../../library/sys.rst:1828 +#: ../../library/sys.rst:1860 msgid "" "Under some conditions ``stdin``, ``stdout`` and ``stderr`` as well as the " "original values ``__stdin__``, ``__stdout__`` and ``__stderr__`` can be " @@ -2389,12 +2435,12 @@ msgid "" "to a console and Python apps started with :program:`pythonw`." msgstr "" -#: ../../library/sys.rst:1836 +#: ../../library/sys.rst:1868 msgid "" "A frozenset of strings containing the names of standard library modules." msgstr "" -#: ../../library/sys.rst:1838 +#: ../../library/sys.rst:1870 msgid "" "It is the same on all platforms. Modules which are not available on some " "platforms and modules disabled at Python build are also listed. All module " @@ -2402,7 +2448,7 @@ msgid "" "modules are excluded." msgstr "" -#: ../../library/sys.rst:1843 +#: ../../library/sys.rst:1875 msgid "" "For packages, only the main package is listed: sub-packages and sub-modules " "are not listed. For example, the ``email`` package is listed, but the " @@ -2410,60 +2456,60 @@ msgid "" "listed." msgstr "" -#: ../../library/sys.rst:1848 +#: ../../library/sys.rst:1880 msgid "See also the :data:`sys.builtin_module_names` list." msgstr "另請參閱 :attr:`sys.builtin_module_names` 清單。" -#: ../../library/sys.rst:1855 +#: ../../library/sys.rst:1887 msgid "" "A :term:`named tuple` holding information about the thread implementation." msgstr "" -#: ../../library/sys.rst:1860 +#: ../../library/sys.rst:1892 msgid "The name of the thread implementation:" msgstr "" -#: ../../library/sys.rst:1862 +#: ../../library/sys.rst:1894 msgid "``\"nt\"``: Windows threads" msgstr "``\"nt\"``: Windows 執行緒" -#: ../../library/sys.rst:1863 +#: ../../library/sys.rst:1895 msgid "``\"pthread\"``: POSIX threads" msgstr "``\"pthread\"``: POSIX 執行緒" -#: ../../library/sys.rst:1864 +#: ../../library/sys.rst:1896 msgid "" "``\"pthread-stubs\"``: stub POSIX threads (on WebAssembly platforms without " "threading support)" msgstr "" -#: ../../library/sys.rst:1866 +#: ../../library/sys.rst:1898 msgid "``\"solaris\"``: Solaris threads" msgstr "" -#: ../../library/sys.rst:1870 +#: ../../library/sys.rst:1902 msgid "The name of the lock implementation:" msgstr "" -#: ../../library/sys.rst:1872 +#: ../../library/sys.rst:1904 msgid "``\"semaphore\"``: a lock uses a semaphore" msgstr "" -#: ../../library/sys.rst:1873 +#: ../../library/sys.rst:1905 msgid "``\"mutex+cond\"``: a lock uses a mutex and a condition variable" msgstr "" -#: ../../library/sys.rst:1874 +#: ../../library/sys.rst:1906 msgid "``None`` if this information is unknown" msgstr "為 ``None`` 表示此資訊未知" -#: ../../library/sys.rst:1878 +#: ../../library/sys.rst:1910 msgid "" "The name and version of the thread library. It is a string, or ``None`` if " "this information is unknown." msgstr "" -#: ../../library/sys.rst:1886 +#: ../../library/sys.rst:1918 msgid "" "When this variable is set to an integer value, it determines the maximum " "number of levels of traceback information printed when an unhandled " @@ -2472,73 +2518,73 @@ msgid "" "are printed." msgstr "" -#: ../../library/sys.rst:1894 +#: ../../library/sys.rst:1926 msgid "Handle an unraisable exception." msgstr "處理一個不可被引發的例外。" -#: ../../library/sys.rst:1896 +#: ../../library/sys.rst:1928 msgid "" "Called when an exception has occurred but there is no way for Python to " "handle it. For example, when a destructor raises an exception or during " "garbage collection (:func:`gc.collect`)." msgstr "" -#: ../../library/sys.rst:1900 +#: ../../library/sys.rst:1932 msgid "The *unraisable* argument has the following attributes:" msgstr "" -#: ../../library/sys.rst:1902 +#: ../../library/sys.rst:1934 msgid ":attr:`!exc_type`: Exception type." msgstr ":attr:`!exc_type`: 例外型別。" -#: ../../library/sys.rst:1903 +#: ../../library/sys.rst:1935 msgid ":attr:`!exc_value`: Exception value, can be ``None``." msgstr ":attr:`!exc_value`: 例外值,可以為 ``None``。" -#: ../../library/sys.rst:1904 +#: ../../library/sys.rst:1936 msgid ":attr:`!exc_traceback`: Exception traceback, can be ``None``." msgstr ":attr:`!exc_traceback`: 例外追蹤,可以為 ``None``。" -#: ../../library/sys.rst:1905 +#: ../../library/sys.rst:1937 msgid ":attr:`!err_msg`: Error message, can be ``None``." msgstr ":attr:`!err_msg`: 錯誤訊息,可以為 ``None``。" -#: ../../library/sys.rst:1906 +#: ../../library/sys.rst:1938 msgid ":attr:`!object`: Object causing the exception, can be ``None``." msgstr ":attr:`!object`: 導致例外的物件,可以為 ``None``。" -#: ../../library/sys.rst:1908 +#: ../../library/sys.rst:1940 msgid "" "The default hook formats :attr:`!err_msg` and :attr:`!object` as: " "``f'{err_msg}: {object!r}'``; use \"Exception ignored in\" error message if :" "attr:`!err_msg` is ``None``." msgstr "" -#: ../../library/sys.rst:1912 +#: ../../library/sys.rst:1944 msgid "" ":func:`sys.unraisablehook` can be overridden to control how unraisable " "exceptions are handled." msgstr "" -#: ../../library/sys.rst:1917 +#: ../../library/sys.rst:1949 msgid ":func:`excepthook` which handles uncaught exceptions." msgstr "處理未被捕捉到例外的 :func:`excepthook`。" -#: ../../library/sys.rst:1921 +#: ../../library/sys.rst:1953 msgid "" "Storing :attr:`!exc_value` using a custom hook can create a reference cycle. " "It should be cleared explicitly to break the reference cycle when the " "exception is no longer needed." msgstr "" -#: ../../library/sys.rst:1925 +#: ../../library/sys.rst:1957 msgid "" "Storing :attr:`!object` using a custom hook can resurrect it if it is set to " "an object which is being finalized. Avoid storing :attr:`!object` after the " "custom hook completes to avoid resurrecting objects." msgstr "" -#: ../../library/sys.rst:1929 ../../library/sys.rst:1931 +#: ../../library/sys.rst:1961 ../../library/sys.rst:1963 msgid "" "Raise an auditing event ``sys.unraisablehook`` with arguments *hook*, " "*unraisable* when an exception that cannot be handled occurs. The " @@ -2546,7 +2592,7 @@ msgid "" "hook has been set, *hook* may be ``None``." msgstr "" -#: ../../library/sys.rst:1940 +#: ../../library/sys.rst:1972 msgid "" "A string containing the version number of the Python interpreter plus " "additional information on the build number and compiler used. This string " @@ -2555,13 +2601,13 @@ msgid "" "functions provided by the :mod:`platform` module." msgstr "" -#: ../../library/sys.rst:1949 +#: ../../library/sys.rst:1981 msgid "" "The C API version for this interpreter. Programmers may find this useful " "when debugging version conflicts between Python and extension modules." msgstr "" -#: ../../library/sys.rst:1955 +#: ../../library/sys.rst:1987 msgid "" "A tuple containing the five components of the version number: *major*, " "*minor*, *micro*, *releaselevel*, and *serial*. All values except " @@ -2572,18 +2618,18 @@ msgid "" "version_info.major`` and so on." msgstr "" -#: ../../library/sys.rst:1963 +#: ../../library/sys.rst:1995 msgid "Added named component attributes." msgstr "新增了附名的元件屬性。" -#: ../../library/sys.rst:1968 +#: ../../library/sys.rst:2000 msgid "" "This is an implementation detail of the warnings framework; do not modify " "this value. Refer to the :mod:`warnings` module for more information on the " "warnings framework." msgstr "" -#: ../../library/sys.rst:1975 +#: ../../library/sys.rst:2007 msgid "" "The version number used to form registry keys on Windows platforms. This is " "stored as string resource 1000 in the Python DLL. The value is normally the " @@ -2592,20 +2638,20 @@ msgid "" "has no effect on the registry keys used by Python." msgstr "" -#: ../../library/sys.rst:1987 +#: ../../library/sys.rst:2019 msgid "" "Namespace containing functions and constants for register callbacks and " "controlling monitoring events. See :mod:`sys.monitoring` for details." msgstr "" -#: ../../library/sys.rst:1993 +#: ../../library/sys.rst:2025 msgid "" "A dictionary of the various implementation-specific flags passed through " "the :option:`-X` command-line option. Option names are either mapped to " "their values, if given explicitly, or to :const:`True`. Example:" msgstr "" -#: ../../library/sys.rst:1997 +#: ../../library/sys.rst:2029 msgid "" "$ ./python -Xa=b -Xc\n" "Python 3.2a3+ (py3k, Oct 16 2010, 20:14:50)\n" @@ -2625,18 +2671,18 @@ msgstr "" ">>> sys._xoptions\n" "{'a': 'b', 'c': True}" -#: ../../library/sys.rst:2009 +#: ../../library/sys.rst:2041 msgid "" "This is a CPython-specific way of accessing options passed through :option:`-" "X`. Other implementations may export them through other means, or not at " "all." msgstr "" -#: ../../library/sys.rst:2017 +#: ../../library/sys.rst:2049 msgid "Citations" msgstr "引用" -#: ../../library/sys.rst:2018 +#: ../../library/sys.rst:2050 msgid "" "ISO/IEC 9899:1999. \"Programming languages -- C.\" A public draft of this " "standard is available at https://www.open-std.org/jtc1/sc22/wg14/www/docs/" @@ -2649,58 +2695,58 @@ msgstr "" msgid "auditing" msgstr "" -#: ../../library/sys.rst:451 +#: ../../library/sys.rst:462 msgid "object" msgstr "object(物件)" -#: ../../library/sys.rst:451 +#: ../../library/sys.rst:462 msgid "traceback" msgstr "traceback" -#: ../../library/sys.rst:912 ../../library/sys.rst:1471 +#: ../../library/sys.rst:925 ../../library/sys.rst:1501 msgid "profile function" msgstr "" -#: ../../library/sys.rst:912 ../../library/sys.rst:1471 +#: ../../library/sys.rst:925 ../../library/sys.rst:1501 msgid "profiler" msgstr "" -#: ../../library/sys.rst:921 ../../library/sys.rst:1554 +#: ../../library/sys.rst:934 ../../library/sys.rst:1584 msgid "trace function" msgstr "" -#: ../../library/sys.rst:921 ../../library/sys.rst:1554 +#: ../../library/sys.rst:934 ../../library/sys.rst:1584 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/sys.rst:1294 +#: ../../library/sys.rst:1329 msgid "module" msgstr "module(模組)" -#: ../../library/sys.rst:1294 +#: ../../library/sys.rst:1329 msgid "search" msgstr "search(搜尋)" -#: ../../library/sys.rst:1294 +#: ../../library/sys.rst:1329 msgid "path" msgstr "path(路徑)" -#: ../../library/sys.rst:1435 +#: ../../library/sys.rst:1465 msgid "interpreter prompts" msgstr "interpreter prompts(直譯器提示)" -#: ../../library/sys.rst:1435 +#: ../../library/sys.rst:1465 msgid "prompts, interpreter" msgstr "prompts, interpreter(提示、直譯器)" -#: ../../library/sys.rst:1435 +#: ../../library/sys.rst:1465 msgid ">>>" msgstr ">>>" -#: ../../library/sys.rst:1435 +#: ../../library/sys.rst:1465 msgid "interpreter prompt" msgstr "interpreter prompt(直譯器提示)" -#: ../../library/sys.rst:1435 +#: ../../library/sys.rst:1465 msgid "..." msgstr "..." diff --git a/library/sys_path_init.po b/library/sys_path_init.po index 53ad456c13..4e699203ea 100644 --- a/library/sys_path_init.po +++ b/library/sys_path_init.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -171,14 +171,13 @@ msgid "" "If Python is embedded within another application :c:func:" "`Py_InitializeFromConfig` and the :c:type:`PyConfig` structure can be used " "to initialize Python. The path specific details are described at :ref:`init-" -"path-config`. Alternatively the older :c:func:`Py_SetPath` can be used to " -"bypass the initialization of the module search path." +"path-config`." msgstr "" -#: ../../library/sys_path_init.rst:107 +#: ../../library/sys_path_init.rst:106 msgid ":ref:`windows_finding_modules` for detailed Windows notes." msgstr "" -#: ../../library/sys_path_init.rst:108 +#: ../../library/sys_path_init.rst:107 msgid ":ref:`using-on-unix` for Unix details." msgstr "" diff --git a/library/sysconfig.po b/library/sysconfig.po index 10ce77971d..7a2c3ec0df 100644 --- a/library/sysconfig.po +++ b/library/sysconfig.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,7 +23,8 @@ msgid "" msgstr ":mod:`!sysconfig` --- 提供 Python 設定資訊的存取" #: ../../library/sysconfig.rst:12 -msgid "**Source code:** :source:`Lib/sysconfig.py`" +#, fuzzy +msgid "**Source code:** :source:`Lib/sysconfig`" msgstr "**原始碼:**\\ :source:`Lib/sysconfig.py`" #: ../../library/sysconfig.rst:19 diff --git a/library/syslog.po b/library/syslog.po index 40f2b0a829..9fb0489e10 100644 --- a/library/syslog.po +++ b/library/syslog.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,14 +30,15 @@ msgid "" msgstr "" #: ../../library/syslog.rst:14 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +#, fuzzy +msgid ":ref:`Availability `: Unix, not WASI, not iOS." msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" #: ../../library/syslog.rst:16 msgid "" "This module wraps the system ``syslog`` family of routines. A pure Python " "library that can speak to a syslog server is available in the :mod:`logging." -"handlers` module as :class:`SysLogHandler`." +"handlers` module as :class:`~logging.handlers.SysLogHandler`." msgstr "" #: ../../library/syslog.rst:20 @@ -165,53 +166,42 @@ msgstr "" msgid "The module defines the following constants:" msgstr "" -#: ../../library/syslog.rst:110 -msgid "Priority levels (high to low):" +#: ../../library/syslog.rst:120 +msgid "Priority levels (high to low)." msgstr "" -#: ../../library/syslog.rst:111 +#: ../../library/syslog.rst:149 msgid "" -":const:`LOG_EMERG`, :const:`LOG_ALERT`, :const:`LOG_CRIT`, :const:" -"`LOG_ERR`, :const:`LOG_WARNING`, :const:`LOG_NOTICE`, :const:`LOG_INFO`, :" -"const:`LOG_DEBUG`." +"Facilities, depending on availability in ```` for :const:" +"`LOG_AUTHPRIV`, :const:`LOG_FTP`, :const:`LOG_NETINFO`, :const:" +"`LOG_REMOTEAUTH`, :const:`LOG_INSTALL` and :const:`LOG_RAS`." msgstr "" -#: ../../library/syslog.rst:115 -msgid "Facilities:" -msgstr "" - -#: ../../library/syslog.rst:116 +#: ../../library/syslog.rst:153 msgid "" -":const:`LOG_KERN`, :const:`LOG_USER`, :const:`LOG_MAIL`, :const:" -"`LOG_DAEMON`, :const:`LOG_AUTH`, :const:`LOG_LPR`, :const:`LOG_NEWS`, :const:" -"`LOG_UUCP`, :const:`LOG_CRON`, :const:`LOG_SYSLOG`, :const:`LOG_LOCAL0` to :" -"const:`LOG_LOCAL7`, and, if defined in ````, :const:`LOG_AUTHPRIV`." -msgstr "" - -#: ../../library/syslog.rst:122 -msgid "Log options:" +"Added :const:`LOG_FTP`, :const:`LOG_NETINFO`, :const:`LOG_REMOTEAUTH`, :" +"const:`LOG_INSTALL`, :const:`LOG_RAS`, and :const:`LOG_LAUNCHD`." msgstr "" -#: ../../library/syslog.rst:123 +#: ../../library/syslog.rst:164 msgid "" -":const:`LOG_PID`, :const:`LOG_CONS`, :const:`LOG_NDELAY`, and, if defined in " -"````, :const:`LOG_ODELAY`, :const:`LOG_NOWAIT`, and :const:" -"`LOG_PERROR`." +"Log options, depending on availability in ```` for :const:" +"`LOG_ODELAY`, :const:`LOG_NOWAIT` and :const:`LOG_PERROR`." msgstr "" -#: ../../library/syslog.rst:129 +#: ../../library/syslog.rst:169 msgid "Examples" msgstr "範例" -#: ../../library/syslog.rst:132 +#: ../../library/syslog.rst:172 msgid "Simple example" msgstr "簡單範例" -#: ../../library/syslog.rst:134 +#: ../../library/syslog.rst:174 msgid "A simple set of examples::" msgstr "一組簡單範例: ::" -#: ../../library/syslog.rst:136 +#: ../../library/syslog.rst:176 msgid "" "import syslog\n" "\n" @@ -225,14 +215,14 @@ msgstr "" "if error:\n" " syslog.syslog(syslog.LOG_ERR, 'Processing started')" -#: ../../library/syslog.rst:142 +#: ../../library/syslog.rst:182 msgid "" "An example of setting some log options, these would include the process ID " "in logged messages, and write the messages to the destination facility used " "for mail logging::" msgstr "" -#: ../../library/syslog.rst:146 +#: ../../library/syslog.rst:186 msgid "" "syslog.openlog(logoption=syslog.LOG_PID, facility=syslog.LOG_MAIL)\n" "syslog.syslog('E-mail processing initiated...')" diff --git a/library/tarfile.po b/library/tarfile.po index a624f2c74e..285f869c65 100644 --- a/library/tarfile.po +++ b/library/tarfile.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -343,12 +343,12 @@ msgstr "``'w|xz'``" msgid "Open an lzma compressed *stream* for writing." msgstr "" -#: ../../library/tarfile.rst:158 ../../library/tarfile.rst:422 +#: ../../library/tarfile.rst:158 ../../library/tarfile.rst:425 msgid "The ``'x'`` (exclusive creation) mode was added." msgstr "" -#: ../../library/tarfile.rst:161 ../../library/tarfile.rst:425 -#: ../../library/tarfile.rst:660 +#: ../../library/tarfile.rst:161 ../../library/tarfile.rst:428 +#: ../../library/tarfile.rst:673 msgid "The *name* parameter accepts a :term:`path-like object`." msgstr "" @@ -668,41 +668,51 @@ msgid "" "be added as a pax global header if *format* is :const:`PAX_FORMAT`." msgstr "" -#: ../../library/tarfile.rst:419 ../../library/tarfile.rst:729 +#: ../../library/tarfile.rst:419 +msgid "" +"If *stream* is set to :const:`True` then while reading the archive info " +"about files in the archive are not cached, saving memory." +msgstr "" + +#: ../../library/tarfile.rst:422 ../../library/tarfile.rst:742 msgid "Use ``'surrogateescape'`` as the default for the *errors* argument." msgstr "" #: ../../library/tarfile.rst:431 +msgid "Add the *stream* parameter." +msgstr "新增 *stream* 參數。" + +#: ../../library/tarfile.rst:436 msgid "" "Alternative constructor. The :func:`tarfile.open` function is actually a " "shortcut to this classmethod." msgstr "" -#: ../../library/tarfile.rst:437 +#: ../../library/tarfile.rst:442 msgid "" "Return a :class:`TarInfo` object for member *name*. If *name* can not be " "found in the archive, :exc:`KeyError` is raised." msgstr "" -#: ../../library/tarfile.rst:442 +#: ../../library/tarfile.rst:447 msgid "" "If a member occurs more than once in the archive, its last occurrence is " "assumed to be the most up-to-date version." msgstr "" -#: ../../library/tarfile.rst:448 +#: ../../library/tarfile.rst:453 msgid "" "Return the members of the archive as a list of :class:`TarInfo` objects. The " "list has the same order as the members in the archive." msgstr "" -#: ../../library/tarfile.rst:454 +#: ../../library/tarfile.rst:459 msgid "" "Return the members as a list of their names. It has the same order as the " "list returned by :meth:`getmembers`." msgstr "" -#: ../../library/tarfile.rst:460 +#: ../../library/tarfile.rst:465 msgid "" "Print a table of contents to ``sys.stdout``. If *verbose* is :const:`False`, " "only the names of the members are printed. If it is :const:`True`, output " @@ -710,18 +720,18 @@ msgid "" "given, it must be a subset of the list returned by :meth:`getmembers`." msgstr "" -#: ../../library/tarfile.rst:465 +#: ../../library/tarfile.rst:470 msgid "Added the *members* parameter." msgstr "新增 *members* 參數。" -#: ../../library/tarfile.rst:471 +#: ../../library/tarfile.rst:476 msgid "" "Return the next member of the archive as a :class:`TarInfo` object, when :" "class:`TarFile` is opened for reading. Return :const:`None` if there is no " "more available." msgstr "" -#: ../../library/tarfile.rst:478 +#: ../../library/tarfile.rst:483 msgid "" "Extract all members from the archive to the current working directory or " "directory *path*. If optional *members* is given, it must be a subset of the " @@ -733,14 +743,14 @@ msgid "" "fail." msgstr "" -#: ../../library/tarfile.rst:486 +#: ../../library/tarfile.rst:491 msgid "" "If *numeric_owner* is :const:`True`, the uid and gid numbers from the " "tarfile are used to set the owner/group for the extracted files. Otherwise, " "the named values from the tarfile are used." msgstr "" -#: ../../library/tarfile.rst:490 +#: ../../library/tarfile.rst:495 msgid "" "The *filter* argument specifies how ``members`` are modified or rejected " "before extraction. See :ref:`tarfile-extraction-filter` for details. It is " @@ -748,7 +758,7 @@ msgid "" "need to support." msgstr "" -#: ../../library/tarfile.rst:498 +#: ../../library/tarfile.rst:503 msgid "" "Never extract archives from untrusted sources without prior inspection. It " "is possible that files are created outside of *path*, e.g. members that have " @@ -756,26 +766,26 @@ msgid "" "\"``." msgstr "" -#: ../../library/tarfile.rst:503 ../../library/tarfile.rst:536 +#: ../../library/tarfile.rst:508 ../../library/tarfile.rst:541 msgid "" "Set ``filter='data'`` to prevent the most dangerous security issues, and " "read the :ref:`tarfile-extraction-filter` section for details." msgstr "" -#: ../../library/tarfile.rst:506 ../../library/tarfile.rst:542 +#: ../../library/tarfile.rst:511 ../../library/tarfile.rst:547 msgid "Added the *numeric_owner* parameter." msgstr "新增 *numeric_owner* 參數。" -#: ../../library/tarfile.rst:509 ../../library/tarfile.rst:545 +#: ../../library/tarfile.rst:514 ../../library/tarfile.rst:550 msgid "The *path* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/tarfile.rst:512 ../../library/tarfile.rst:548 -#: ../../library/tarfile.rst:626 +#: ../../library/tarfile.rst:517 ../../library/tarfile.rst:553 +#: ../../library/tarfile.rst:635 msgid "Added the *filter* parameter." msgstr "新增 *filter* 參數。" -#: ../../library/tarfile.rst:518 +#: ../../library/tarfile.rst:523 msgid "" "Extract a member from the archive to the current working directory, using " "its full name. Its file information is extracted as accurately as possible. " @@ -784,27 +794,27 @@ msgid "" "File attributes (owner, mtime, mode) are set unless *set_attrs* is false." msgstr "" -#: ../../library/tarfile.rst:524 +#: ../../library/tarfile.rst:529 msgid "" "The *numeric_owner* and *filter* arguments are the same as for :meth:" "`extractall`." msgstr "" -#: ../../library/tarfile.rst:529 +#: ../../library/tarfile.rst:534 msgid "" "The :meth:`extract` method does not take care of several extraction issues. " "In most cases you should consider using the :meth:`extractall` method." msgstr "" -#: ../../library/tarfile.rst:534 +#: ../../library/tarfile.rst:539 msgid "See the warning for :meth:`extractall`." msgstr "參閱 :meth:`extractall` 的警告。" -#: ../../library/tarfile.rst:539 +#: ../../library/tarfile.rst:544 msgid "Added the *set_attrs* parameter." msgstr "增加 *set_attrs* 參數。" -#: ../../library/tarfile.rst:554 +#: ../../library/tarfile.rst:559 msgid "" "Extract a member from the archive as a file object. *member* may be a " "filename or a :class:`TarInfo` object. If *member* is a regular file or a " @@ -813,11 +823,17 @@ msgid "" "the archive, :exc:`KeyError` is raised." msgstr "" -#: ../../library/tarfile.rst:560 +#: ../../library/tarfile.rst:565 msgid "Return an :class:`io.BufferedReader` object." msgstr "" -#: ../../library/tarfile.rst:566 +#: ../../library/tarfile.rst:568 +msgid "" +"The returned :class:`io.BufferedReader` object has the :attr:`!mode` " +"attribute which is always equal to ``'rb'``." +msgstr "" + +#: ../../library/tarfile.rst:575 msgid "" "If *errorlevel* is ``0``, errors are ignored when using :meth:`TarFile." "extract` and :meth:`TarFile.extractall`. Nevertheless, they appear as error " @@ -827,39 +843,39 @@ msgid "" "exc:`TarError` exceptions as well." msgstr "" -#: ../../library/tarfile.rst:574 +#: ../../library/tarfile.rst:583 msgid "" "Some exceptions, e.g. ones caused by wrong argument types or data " "corruption, are always raised." msgstr "" -#: ../../library/tarfile.rst:577 +#: ../../library/tarfile.rst:586 msgid "" "Custom :ref:`extraction filters ` should raise :" "exc:`FilterError` for *fatal* errors and :exc:`ExtractError` for *non-fatal* " "ones." msgstr "" -#: ../../library/tarfile.rst:581 +#: ../../library/tarfile.rst:590 msgid "" "Note that when an exception is raised, the archive may be partially " "extracted. It is the user’s responsibility to clean up." msgstr "" -#: ../../library/tarfile.rst:588 +#: ../../library/tarfile.rst:597 msgid "" "The :ref:`extraction filter ` used as a default " "for the *filter* argument of :meth:`~TarFile.extract` and :meth:`~TarFile." "extractall`." msgstr "" -#: ../../library/tarfile.rst:592 +#: ../../library/tarfile.rst:601 msgid "" "The attribute may be ``None`` or a callable. String names are not allowed " "for this attribute, unlike the *filter* argument to :meth:`~TarFile.extract`." msgstr "" -#: ../../library/tarfile.rst:596 +#: ../../library/tarfile.rst:605 msgid "" "If ``extraction_filter`` is ``None`` (the default), calling an extraction " "method without a *filter* argument will raise a ``DeprecationWarning``, and " @@ -867,13 +883,13 @@ msgid "" "dangerous behavior matches previous versions of Python." msgstr "" -#: ../../library/tarfile.rst:602 +#: ../../library/tarfile.rst:611 msgid "" "In Python 3.14+, leaving ``extraction_filter=None`` will cause extraction " "methods to use the :func:`data ` filter by default." msgstr "" -#: ../../library/tarfile.rst:605 +#: ../../library/tarfile.rst:614 msgid "" "The attribute may be set on instances or overridden in subclasses. It also " "is possible to set it on the ``TarFile`` class itself to set a global " @@ -883,7 +899,7 @@ msgid "" "wrapped in :func:`staticmethod` to prevent injection of a ``self`` argument." msgstr "" -#: ../../library/tarfile.rst:615 +#: ../../library/tarfile.rst:624 msgid "" "Add the file *name* to the archive. *name* may be any type of file " "(directory, fifo, symbolic link, etc.). If given, *arcname* specifies an " @@ -896,19 +912,24 @@ msgid "" "ref:`tar-examples` for an example." msgstr "" -#: ../../library/tarfile.rst:629 +#: ../../library/tarfile.rst:638 msgid "Recursion adds entries in sorted order." msgstr "" -#: ../../library/tarfile.rst:635 +#: ../../library/tarfile.rst:644 msgid "" -"Add the :class:`TarInfo` object *tarinfo* to the archive. If *fileobj* is " -"given, it should be a :term:`binary file`, and ``tarinfo.size`` bytes are " -"read from it and added to the archive. You can create :class:`TarInfo` " -"objects directly, or by using :meth:`gettarinfo`." +"Add the :class:`TarInfo` object *tarinfo* to the archive. If *tarinfo* " +"represents a non zero-size regular file, the *fileobj* argument should be a :" +"term:`binary file`, and ``tarinfo.size`` bytes are read from it and added to " +"the archive. You can create :class:`TarInfo` objects directly, or by using :" +"meth:`gettarinfo`." +msgstr "" + +#: ../../library/tarfile.rst:651 +msgid "*fileobj* must be given for non-zero-sized regular files." msgstr "" -#: ../../library/tarfile.rst:643 +#: ../../library/tarfile.rst:656 msgid "" "Create a :class:`TarInfo` object from the result of :func:`os.stat` or " "equivalent on an existing file. The file is either named by *name*, or " @@ -919,7 +940,7 @@ msgid "" "The name should be a text string." msgstr "" -#: ../../library/tarfile.rst:652 +#: ../../library/tarfile.rst:665 msgid "" "You can modify some of the :class:`TarInfo`’s attributes before you add it " "using :meth:`addfile`. If the file object is not an ordinary file object " @@ -929,21 +950,21 @@ msgid "" "case *arcname* could be a dummy string." msgstr "" -#: ../../library/tarfile.rst:666 +#: ../../library/tarfile.rst:679 msgid "" "Close the :class:`TarFile`. In write mode, two finishing zero blocks are " "appended to the archive." msgstr "" -#: ../../library/tarfile.rst:673 +#: ../../library/tarfile.rst:686 msgid "A dictionary containing key-value pairs of pax global headers." msgstr "" -#: ../../library/tarfile.rst:680 +#: ../../library/tarfile.rst:693 msgid "TarInfo Objects" msgstr "TarInfo 物件" -#: ../../library/tarfile.rst:682 +#: ../../library/tarfile.rst:695 msgid "" "A :class:`TarInfo` object represents one member in a :class:`TarFile`. Aside " "from storing all required attributes of a file (like file type, size, time, " @@ -951,14 +972,14 @@ msgid "" "type. It does *not* contain the file's data itself." msgstr "" -#: ../../library/tarfile.rst:687 +#: ../../library/tarfile.rst:700 msgid "" ":class:`TarInfo` objects are returned by :class:`TarFile`'s methods :meth:" "`~TarFile.getmember`, :meth:`~TarFile.getmembers` and :meth:`~TarFile." "gettarinfo`." msgstr "" -#: ../../library/tarfile.rst:691 +#: ../../library/tarfile.rst:704 msgid "" "Modifying the objects returned by :meth:`~TarFile.getmember` or :meth:" "`~TarFile.getmembers` will affect all subsequent operations on the archive. " @@ -967,82 +988,82 @@ msgid "" "step." msgstr "" -#: ../../library/tarfile.rst:697 +#: ../../library/tarfile.rst:710 msgid "" "Several attributes can be set to ``None`` to indicate that a piece of " "metadata is unused or unknown. Different :class:`TarInfo` methods handle " "``None`` differently:" msgstr "" -#: ../../library/tarfile.rst:701 +#: ../../library/tarfile.rst:714 msgid "" "The :meth:`~TarFile.extract` or :meth:`~TarFile.extractall` methods will " "ignore the corresponding metadata, leaving it set to a default." msgstr "" -#: ../../library/tarfile.rst:703 +#: ../../library/tarfile.rst:716 msgid ":meth:`~TarFile.addfile` will fail." msgstr "" -#: ../../library/tarfile.rst:704 +#: ../../library/tarfile.rst:717 msgid ":meth:`~TarFile.list` will print a placeholder string." msgstr "" -#: ../../library/tarfile.rst:708 +#: ../../library/tarfile.rst:721 msgid "Create a :class:`TarInfo` object." msgstr "" -#: ../../library/tarfile.rst:713 +#: ../../library/tarfile.rst:726 msgid "Create and return a :class:`TarInfo` object from string buffer *buf*." msgstr "" -#: ../../library/tarfile.rst:715 +#: ../../library/tarfile.rst:728 msgid "Raises :exc:`HeaderError` if the buffer is invalid." msgstr "" -#: ../../library/tarfile.rst:720 +#: ../../library/tarfile.rst:733 msgid "" "Read the next member from the :class:`TarFile` object *tarfile* and return " "it as a :class:`TarInfo` object." msgstr "" -#: ../../library/tarfile.rst:726 +#: ../../library/tarfile.rst:739 msgid "" "Create a string buffer from a :class:`TarInfo` object. For information on " "the arguments see the constructor of the :class:`TarFile` class." msgstr "" -#: ../../library/tarfile.rst:733 +#: ../../library/tarfile.rst:746 msgid "A ``TarInfo`` object has the following public data attributes:" msgstr "" -#: ../../library/tarfile.rst:739 +#: ../../library/tarfile.rst:752 msgid "Name of the archive member." msgstr "" -#: ../../library/tarfile.rst:745 +#: ../../library/tarfile.rst:758 msgid "Size in bytes." msgstr "" -#: ../../library/tarfile.rst:751 +#: ../../library/tarfile.rst:764 msgid "" "Time of last modification in seconds since the :ref:`epoch `, as in :" "attr:`os.stat_result.st_mtime`." msgstr "" -#: ../../library/tarfile.rst:756 ../../library/tarfile.rst:767 -#: ../../library/tarfile.rst:799 ../../library/tarfile.rst:810 -#: ../../library/tarfile.rst:821 ../../library/tarfile.rst:832 +#: ../../library/tarfile.rst:769 ../../library/tarfile.rst:780 +#: ../../library/tarfile.rst:812 ../../library/tarfile.rst:823 +#: ../../library/tarfile.rst:834 ../../library/tarfile.rst:845 msgid "" "Can be set to ``None`` for :meth:`~TarFile.extract` and :meth:`~TarFile." "extractall`, causing extraction to skip applying this attribute." msgstr "" -#: ../../library/tarfile.rst:763 +#: ../../library/tarfile.rst:776 msgid "Permission bits, as for :func:`os.chmod`." msgstr "" -#: ../../library/tarfile.rst:773 +#: ../../library/tarfile.rst:786 msgid "" "File type. *type* is usually one of these constants: :const:`REGTYPE`, :" "const:`AREGTYPE`, :const:`LNKTYPE`, :const:`SYMTYPE`, :const:`DIRTYPE`, :" @@ -1051,128 +1072,128 @@ msgid "" "more conveniently, use the ``is*()`` methods below." msgstr "" -#: ../../library/tarfile.rst:783 +#: ../../library/tarfile.rst:796 msgid "" "Name of the target file name, which is only present in :class:`TarInfo` " "objects of type :const:`LNKTYPE` and :const:`SYMTYPE`." msgstr "" -#: ../../library/tarfile.rst:786 +#: ../../library/tarfile.rst:799 msgid "" "For symbolic links (``SYMTYPE``), the *linkname* is relative to the " "directory that contains the link. For hard links (``LNKTYPE``), the " "*linkname* is relative to the root of the archive." msgstr "" -#: ../../library/tarfile.rst:795 +#: ../../library/tarfile.rst:808 msgid "User ID of the user who originally stored this member." msgstr "" -#: ../../library/tarfile.rst:806 +#: ../../library/tarfile.rst:819 msgid "Group ID of the user who originally stored this member." msgstr "" -#: ../../library/tarfile.rst:817 +#: ../../library/tarfile.rst:830 msgid "User name." msgstr "" -#: ../../library/tarfile.rst:828 +#: ../../library/tarfile.rst:841 msgid "Group name." msgstr "" -#: ../../library/tarfile.rst:839 +#: ../../library/tarfile.rst:852 msgid "Header checksum." msgstr "" -#: ../../library/tarfile.rst:845 +#: ../../library/tarfile.rst:858 msgid "Device major number." msgstr "" -#: ../../library/tarfile.rst:851 +#: ../../library/tarfile.rst:864 msgid "Device minor number." msgstr "" -#: ../../library/tarfile.rst:857 +#: ../../library/tarfile.rst:870 msgid "The tar header starts here." msgstr "" -#: ../../library/tarfile.rst:863 +#: ../../library/tarfile.rst:876 msgid "The file's data starts here." msgstr "" -#: ../../library/tarfile.rst:868 +#: ../../library/tarfile.rst:881 msgid "Sparse member information." msgstr "" -#: ../../library/tarfile.rst:874 +#: ../../library/tarfile.rst:887 msgid "" "A dictionary containing key-value pairs of an associated pax extended header." msgstr "" -#: ../../library/tarfile.rst:882 +#: ../../library/tarfile.rst:895 msgid "" "Return a *new* copy of the :class:`!TarInfo` object with the given " "attributes changed. For example, to return a ``TarInfo`` with the group name " "set to ``'staff'``, use::" msgstr "" -#: ../../library/tarfile.rst:886 +#: ../../library/tarfile.rst:899 msgid "new_tarinfo = old_tarinfo.replace(gname='staff')" msgstr "new_tarinfo = old_tarinfo.replace(gname='staff')" -#: ../../library/tarfile.rst:888 +#: ../../library/tarfile.rst:901 msgid "" "By default, a deep copy is made. If *deep* is false, the copy is shallow, i." "e. ``pax_headers`` and any custom attributes are shared with the original " "``TarInfo`` object." msgstr "" -#: ../../library/tarfile.rst:892 +#: ../../library/tarfile.rst:905 msgid "A :class:`TarInfo` object also provides some convenient query methods:" msgstr "" -#: ../../library/tarfile.rst:897 +#: ../../library/tarfile.rst:910 msgid "Return :const:`True` if the :class:`TarInfo` object is a regular file." msgstr "" -#: ../../library/tarfile.rst:902 +#: ../../library/tarfile.rst:915 msgid "Same as :meth:`isfile`." msgstr "" -#: ../../library/tarfile.rst:907 +#: ../../library/tarfile.rst:920 msgid "Return :const:`True` if it is a directory." msgstr "" -#: ../../library/tarfile.rst:912 +#: ../../library/tarfile.rst:925 msgid "Return :const:`True` if it is a symbolic link." msgstr "" -#: ../../library/tarfile.rst:917 +#: ../../library/tarfile.rst:930 msgid "Return :const:`True` if it is a hard link." msgstr "" -#: ../../library/tarfile.rst:922 +#: ../../library/tarfile.rst:935 msgid "Return :const:`True` if it is a character device." msgstr "" -#: ../../library/tarfile.rst:927 +#: ../../library/tarfile.rst:940 msgid "Return :const:`True` if it is a block device." msgstr "" -#: ../../library/tarfile.rst:932 +#: ../../library/tarfile.rst:945 msgid "Return :const:`True` if it is a FIFO." msgstr "" -#: ../../library/tarfile.rst:937 +#: ../../library/tarfile.rst:950 msgid "" "Return :const:`True` if it is one of character device, block device or FIFO." msgstr "" -#: ../../library/tarfile.rst:943 +#: ../../library/tarfile.rst:956 msgid "Extraction filters" msgstr "" -#: ../../library/tarfile.rst:947 +#: ../../library/tarfile.rst:960 msgid "" "The *tar* format is designed to capture all details of a UNIX-like " "filesystem, which makes it very powerful. Unfortunately, the features make " @@ -1182,66 +1203,66 @@ msgid "" "components, or symlinks that affect later members)." msgstr "" -#: ../../library/tarfile.rst:955 +#: ../../library/tarfile.rst:968 msgid "" "In most cases, the full functionality is not needed. Therefore, *tarfile* " "supports extraction filters: a mechanism to limit functionality, and thus " "mitigate some of the security issues." msgstr "" -#: ../../library/tarfile.rst:961 +#: ../../library/tarfile.rst:974 msgid ":pep:`706`" msgstr ":pep:`706`" -#: ../../library/tarfile.rst:962 +#: ../../library/tarfile.rst:975 msgid "Contains further motivation and rationale behind the design." msgstr "" -#: ../../library/tarfile.rst:964 +#: ../../library/tarfile.rst:977 msgid "" "The *filter* argument to :meth:`TarFile.extract` or :meth:`~TarFile." "extractall` can be:" msgstr "" -#: ../../library/tarfile.rst:967 +#: ../../library/tarfile.rst:980 msgid "" "the string ``'fully_trusted'``: Honor all metadata as specified in the " "archive. Should be used if the user trusts the archive completely, or " "implements their own complex verification." msgstr "" -#: ../../library/tarfile.rst:972 +#: ../../library/tarfile.rst:985 msgid "" "the string ``'tar'``: Honor most *tar*-specific features (i.e. features of " "UNIX-like filesystems), but block features that are very likely to be " "surprising or malicious. See :func:`tar_filter` for details." msgstr "" -#: ../../library/tarfile.rst:976 +#: ../../library/tarfile.rst:989 msgid "" "the string ``'data'``: Ignore or block most features specific to UNIX-like " "filesystems. Intended for extracting cross-platform data archives. See :func:" "`data_filter` for details." msgstr "" -#: ../../library/tarfile.rst:980 +#: ../../library/tarfile.rst:993 msgid "``None`` (default): Use :attr:`TarFile.extraction_filter`." msgstr "" -#: ../../library/tarfile.rst:982 +#: ../../library/tarfile.rst:995 msgid "" "If that is also ``None`` (the default), raise a ``DeprecationWarning``, and " "fall back to the ``'fully_trusted'`` filter, whose dangerous behavior " "matches previous versions of Python." msgstr "" -#: ../../library/tarfile.rst:986 +#: ../../library/tarfile.rst:999 msgid "" "In Python 3.14, the ``'data'`` filter will become the default instead. It's " "possible to switch earlier; see :attr:`TarFile.extraction_filter`." msgstr "" -#: ../../library/tarfile.rst:989 +#: ../../library/tarfile.rst:1002 msgid "" "A callable which will be called for each extracted member with a :ref:" "`TarInfo ` describing the member and the destination path " @@ -1249,27 +1270,27 @@ msgid "" "members)::" msgstr "" -#: ../../library/tarfile.rst:994 +#: ../../library/tarfile.rst:1007 msgid "filter(member: TarInfo, path: str, /) -> TarInfo | None" msgstr "filter(member: TarInfo, path: str, /) -> TarInfo | None" -#: ../../library/tarfile.rst:996 +#: ../../library/tarfile.rst:1009 msgid "" "The callable is called just before each member is extracted, so it can take " "the current state of the disk into account. It can:" msgstr "" -#: ../../library/tarfile.rst:1000 +#: ../../library/tarfile.rst:1013 msgid "" "return a :class:`TarInfo` object which will be used instead of the metadata " "in the archive, or" msgstr "" -#: ../../library/tarfile.rst:1002 +#: ../../library/tarfile.rst:1015 msgid "return ``None``, in which case the member will be skipped, or" msgstr "" -#: ../../library/tarfile.rst:1003 +#: ../../library/tarfile.rst:1016 msgid "" "raise an exception to abort the operation or skip the member, depending on :" "attr:`~TarFile.errorlevel`. Note that when extraction is aborted, :meth:" @@ -1277,118 +1298,118 @@ msgid "" "attempt to clean up." msgstr "" -#: ../../library/tarfile.rst:1009 +#: ../../library/tarfile.rst:1022 msgid "Default named filters" msgstr "" -#: ../../library/tarfile.rst:1011 +#: ../../library/tarfile.rst:1024 msgid "" "The pre-defined, named filters are available as functions, so they can be " "reused in custom filters:" msgstr "" -#: ../../library/tarfile.rst:1016 +#: ../../library/tarfile.rst:1029 msgid "Return *member* unchanged." msgstr "" -#: ../../library/tarfile.rst:1018 +#: ../../library/tarfile.rst:1031 msgid "This implements the ``'fully_trusted'`` filter." msgstr "" -#: ../../library/tarfile.rst:1022 +#: ../../library/tarfile.rst:1035 msgid "Implements the ``'tar'`` filter." msgstr "" -#: ../../library/tarfile.rst:1024 +#: ../../library/tarfile.rst:1037 msgid "Strip leading slashes (``/`` and :data:`os.sep`) from filenames." msgstr "" -#: ../../library/tarfile.rst:1025 +#: ../../library/tarfile.rst:1038 msgid "" ":ref:`Refuse ` to extract files with absolute " "paths (in case the name is absolute even after stripping slashes, e.g. ``C:/" "foo`` on Windows). This raises :class:`~tarfile.AbsolutePathError`." msgstr "" -#: ../../library/tarfile.rst:1029 +#: ../../library/tarfile.rst:1042 msgid "" ":ref:`Refuse ` to extract files whose absolute " "path (after following symlinks) would end up outside the destination. This " "raises :class:`~tarfile.OutsideDestinationError`." msgstr "" -#: ../../library/tarfile.rst:1032 +#: ../../library/tarfile.rst:1045 msgid "" "Clear high mode bits (setuid, setgid, sticky) and group/other write bits (:" "const:`~stat.S_IWGRP` | :const:`~stat.S_IWOTH`)." msgstr "" -#: ../../library/tarfile.rst:1035 ../../library/tarfile.rst:1068 +#: ../../library/tarfile.rst:1048 ../../library/tarfile.rst:1081 msgid "Return the modified ``TarInfo`` member." msgstr "" -#: ../../library/tarfile.rst:1039 +#: ../../library/tarfile.rst:1052 msgid "" "Implements the ``'data'`` filter. In addition to what ``tar_filter`` does:" msgstr "" -#: ../../library/tarfile.rst:1042 +#: ../../library/tarfile.rst:1055 msgid "" ":ref:`Refuse ` to extract links (hard or soft) " "that link to absolute paths, or ones that link outside the destination." msgstr "" -#: ../../library/tarfile.rst:1045 +#: ../../library/tarfile.rst:1058 msgid "" "This raises :class:`~tarfile.AbsoluteLinkError` or :class:`~tarfile." "LinkOutsideDestinationError`." msgstr "" -#: ../../library/tarfile.rst:1048 +#: ../../library/tarfile.rst:1061 msgid "" "Note that such files are refused even on platforms that do not support " "symbolic links." msgstr "" -#: ../../library/tarfile.rst:1051 +#: ../../library/tarfile.rst:1064 msgid "" ":ref:`Refuse ` to extract device files (including " "pipes). This raises :class:`~tarfile.SpecialFileError`." msgstr "" -#: ../../library/tarfile.rst:1055 +#: ../../library/tarfile.rst:1068 msgid "For regular files, including hard links:" msgstr "" -#: ../../library/tarfile.rst:1057 +#: ../../library/tarfile.rst:1070 msgid "" "Set the owner read and write permissions (:const:`~stat.S_IRUSR` | :const:" "`~stat.S_IWUSR`)." msgstr "" -#: ../../library/tarfile.rst:1059 +#: ../../library/tarfile.rst:1072 msgid "" "Remove the group & other executable permission (:const:`~stat.S_IXGRP` | :" "const:`~stat.S_IXOTH`) if the owner doesn’t have it (:const:`~stat.S_IXUSR`)." msgstr "" -#: ../../library/tarfile.rst:1063 +#: ../../library/tarfile.rst:1076 msgid "" "For other files (directories), set ``mode`` to ``None``, so that extraction " "methods skip applying permission bits." msgstr "" -#: ../../library/tarfile.rst:1065 +#: ../../library/tarfile.rst:1078 msgid "" "Set user and group info (``uid``, ``gid``, ``uname``, ``gname``) to " "``None``, so that extraction methods skip setting it." msgstr "" -#: ../../library/tarfile.rst:1074 +#: ../../library/tarfile.rst:1087 msgid "Filter errors" msgstr "" -#: ../../library/tarfile.rst:1076 +#: ../../library/tarfile.rst:1089 msgid "" "When a filter refuses to extract a file, it will raise an appropriate " "exception, a subclass of :class:`~tarfile.FilterError`. This will abort the " @@ -1397,11 +1418,11 @@ msgid "" "continue." msgstr "" -#: ../../library/tarfile.rst:1084 +#: ../../library/tarfile.rst:1097 msgid "Hints for further verification" msgstr "" -#: ../../library/tarfile.rst:1086 +#: ../../library/tarfile.rst:1099 msgid "" "Even with ``filter='data'``, *tarfile* is not suited for extracting " "untrusted files without prior inspection. Among other issues, the pre-" @@ -1409,69 +1430,69 @@ msgid "" "additional checks." msgstr "" -#: ../../library/tarfile.rst:1091 +#: ../../library/tarfile.rst:1104 msgid "Here is an incomplete list of things to consider:" msgstr "" -#: ../../library/tarfile.rst:1093 +#: ../../library/tarfile.rst:1106 msgid "" "Extract to a :func:`new temporary directory ` to prevent e." "g. exploiting pre-existing links, and to make it easier to clean up after a " "failed extraction." msgstr "" -#: ../../library/tarfile.rst:1096 +#: ../../library/tarfile.rst:1109 msgid "" "When working with untrusted data, use external (e.g. OS-level) limits on " "disk, memory and CPU usage." msgstr "" -#: ../../library/tarfile.rst:1098 +#: ../../library/tarfile.rst:1111 msgid "" "Check filenames against an allow-list of characters (to filter out control " "characters, confusables, foreign path separators, etc.)." msgstr "" -#: ../../library/tarfile.rst:1101 +#: ../../library/tarfile.rst:1114 msgid "" "Check that filenames have expected extensions (discouraging files that " "execute when you “click on them”, or extension-less files like Windows " "special device names)." msgstr "" -#: ../../library/tarfile.rst:1103 +#: ../../library/tarfile.rst:1116 msgid "" "Limit the number of extracted files, total size of extracted data, filename " "length (including symlink length), and size of individual files." msgstr "" -#: ../../library/tarfile.rst:1105 +#: ../../library/tarfile.rst:1118 msgid "Check for files that would be shadowed on case-insensitive filesystems." msgstr "" -#: ../../library/tarfile.rst:1107 +#: ../../library/tarfile.rst:1120 msgid "Also note that:" msgstr "" -#: ../../library/tarfile.rst:1109 +#: ../../library/tarfile.rst:1122 msgid "" "Tar files may contain multiple versions of the same file. Later ones are " "expected to overwrite any earlier ones. This feature is crucial to allow " "updating tape archives, but can be abused maliciously." msgstr "" -#: ../../library/tarfile.rst:1113 +#: ../../library/tarfile.rst:1126 msgid "" "*tarfile* does not protect against issues with “live” data, e.g. an attacker " "tinkering with the destination (or source) directory while extraction (or " "archiving) is in progress." msgstr "" -#: ../../library/tarfile.rst:1119 +#: ../../library/tarfile.rst:1132 msgid "Supporting older Python versions" msgstr "" -#: ../../library/tarfile.rst:1121 +#: ../../library/tarfile.rst:1134 msgid "" "Extraction filters were added to Python 3.12, but may be backported to older " "versions as security updates. To check whether the feature is available, use " @@ -1479,18 +1500,18 @@ msgid "" "version." msgstr "" -#: ../../library/tarfile.rst:1126 +#: ../../library/tarfile.rst:1139 msgid "" "The following examples show how to support Python versions with and without " "the feature. Note that setting ``extraction_filter`` will affect any " "subsequent operations." msgstr "" -#: ../../library/tarfile.rst:1130 +#: ../../library/tarfile.rst:1143 msgid "Fully trusted archive::" msgstr "" -#: ../../library/tarfile.rst:1132 +#: ../../library/tarfile.rst:1145 msgid "" "my_tarfile.extraction_filter = (lambda member, path: member)\n" "my_tarfile.extractall()" @@ -1498,13 +1519,13 @@ msgstr "" "my_tarfile.extraction_filter = (lambda member, path: member)\n" "my_tarfile.extractall()" -#: ../../library/tarfile.rst:1135 +#: ../../library/tarfile.rst:1148 msgid "" "Use the ``'data'`` filter if available, but revert to Python 3.11 behavior " "(``'fully_trusted'``) if this feature is not available::" msgstr "" -#: ../../library/tarfile.rst:1138 +#: ../../library/tarfile.rst:1151 msgid "" "my_tarfile.extraction_filter = getattr(tarfile, 'data_filter',\n" " (lambda member, path: member))\n" @@ -1514,19 +1535,19 @@ msgstr "" " (lambda member, path: member))\n" "my_tarfile.extractall()" -#: ../../library/tarfile.rst:1142 +#: ../../library/tarfile.rst:1155 msgid "Use the ``'data'`` filter; *fail* if it is not available::" msgstr "" -#: ../../library/tarfile.rst:1144 +#: ../../library/tarfile.rst:1157 msgid "my_tarfile.extractall(filter=tarfile.data_filter)" msgstr "my_tarfile.extractall(filter=tarfile.data_filter)" -#: ../../library/tarfile.rst:1146 +#: ../../library/tarfile.rst:1159 msgid "or::" msgstr "或: ::" -#: ../../library/tarfile.rst:1148 +#: ../../library/tarfile.rst:1161 msgid "" "my_tarfile.extraction_filter = tarfile.data_filter\n" "my_tarfile.extractall()" @@ -1534,11 +1555,11 @@ msgstr "" "my_tarfile.extraction_filter = tarfile.data_filter\n" "my_tarfile.extractall()" -#: ../../library/tarfile.rst:1151 +#: ../../library/tarfile.rst:1164 msgid "Use the ``'data'`` filter; *warn* if it is not available::" msgstr "" -#: ../../library/tarfile.rst:1153 +#: ../../library/tarfile.rst:1166 msgid "" "if hasattr(tarfile, 'data_filter'):\n" " my_tarfile.extractall(filter='data')\n" @@ -1548,18 +1569,18 @@ msgid "" " my_tarfile.extractall()" msgstr "" -#: ../../library/tarfile.rst:1162 +#: ../../library/tarfile.rst:1175 msgid "Stateful extraction filter example" msgstr "" -#: ../../library/tarfile.rst:1164 +#: ../../library/tarfile.rst:1177 msgid "" "While *tarfile*'s extraction methods take a simple *filter* callable, custom " "filters may be more complex objects with an internal state. It may be useful " "to write these as context managers, to be used like this::" msgstr "" -#: ../../library/tarfile.rst:1168 +#: ../../library/tarfile.rst:1181 msgid "" "with StatefulFilter() as filter_func:\n" " tar.extractall(path, filter=filter_func)" @@ -1567,11 +1588,11 @@ msgstr "" "with StatefulFilter() as filter_func:\n" " tar.extractall(path, filter=filter_func)" -#: ../../library/tarfile.rst:1171 +#: ../../library/tarfile.rst:1184 msgid "Such a filter can be written as, for example::" msgstr "" -#: ../../library/tarfile.rst:1173 +#: ../../library/tarfile.rst:1186 msgid "" "class StatefulFilter:\n" " def __init__(self):\n" @@ -1588,103 +1609,103 @@ msgid "" " print(f'{self.file_count} files extracted')" msgstr "" -#: ../../library/tarfile.rst:1193 +#: ../../library/tarfile.rst:1206 msgid "Command-Line Interface" msgstr "" -#: ../../library/tarfile.rst:1197 +#: ../../library/tarfile.rst:1210 msgid "" "The :mod:`tarfile` module provides a simple command-line interface to " "interact with tar archives." msgstr "" -#: ../../library/tarfile.rst:1200 +#: ../../library/tarfile.rst:1213 msgid "" "If you want to create a new tar archive, specify its name after the :option:" "`-c` option and then list the filename(s) that should be included:" msgstr "" -#: ../../library/tarfile.rst:1203 +#: ../../library/tarfile.rst:1216 msgid "$ python -m tarfile -c monty.tar spam.txt eggs.txt" msgstr "$ python -m tarfile -c monty.tar spam.txt eggs.txt" -#: ../../library/tarfile.rst:1207 +#: ../../library/tarfile.rst:1220 msgid "Passing a directory is also acceptable:" msgstr "" -#: ../../library/tarfile.rst:1209 +#: ../../library/tarfile.rst:1222 msgid "$ python -m tarfile -c monty.tar life-of-brian_1979/" msgstr "$ python -m tarfile -c monty.tar life-of-brian_1979/" -#: ../../library/tarfile.rst:1213 +#: ../../library/tarfile.rst:1226 msgid "" "If you want to extract a tar archive into the current directory, use the :" "option:`-e` option:" msgstr "" -#: ../../library/tarfile.rst:1216 +#: ../../library/tarfile.rst:1229 msgid "$ python -m tarfile -e monty.tar" msgstr "$ python -m tarfile -e monty.tar" -#: ../../library/tarfile.rst:1220 +#: ../../library/tarfile.rst:1233 msgid "" "You can also extract a tar archive into a different directory by passing the " "directory's name:" msgstr "" -#: ../../library/tarfile.rst:1223 +#: ../../library/tarfile.rst:1236 msgid "$ python -m tarfile -e monty.tar other-dir/" msgstr "$ python -m tarfile -e monty.tar other-dir/" -#: ../../library/tarfile.rst:1227 +#: ../../library/tarfile.rst:1240 msgid "For a list of the files in a tar archive, use the :option:`-l` option:" msgstr "" -#: ../../library/tarfile.rst:1229 +#: ../../library/tarfile.rst:1242 msgid "$ python -m tarfile -l monty.tar" msgstr "$ python -m tarfile -l monty.tar" -#: ../../library/tarfile.rst:1235 +#: ../../library/tarfile.rst:1248 msgid "Command-line options" msgstr "命令列選項" -#: ../../library/tarfile.rst:1240 +#: ../../library/tarfile.rst:1253 msgid "List files in a tarfile." msgstr "" -#: ../../library/tarfile.rst:1245 +#: ../../library/tarfile.rst:1258 msgid "Create tarfile from source files." msgstr "" -#: ../../library/tarfile.rst:1250 +#: ../../library/tarfile.rst:1263 msgid "" "Extract tarfile into the current directory if *output_dir* is not specified." msgstr "" -#: ../../library/tarfile.rst:1255 +#: ../../library/tarfile.rst:1268 msgid "Test whether the tarfile is valid or not." msgstr "" -#: ../../library/tarfile.rst:1259 +#: ../../library/tarfile.rst:1272 msgid "Verbose output." msgstr "" -#: ../../library/tarfile.rst:1263 +#: ../../library/tarfile.rst:1276 msgid "" "Specifies the *filter* for ``--extract``. See :ref:`tarfile-extraction-" "filter` for details. Only string names are accepted (that is, " "``fully_trusted``, ``tar``, and ``data``)." msgstr "" -#: ../../library/tarfile.rst:1271 +#: ../../library/tarfile.rst:1284 msgid "Examples" msgstr "範例" -#: ../../library/tarfile.rst:1273 +#: ../../library/tarfile.rst:1286 msgid "How to extract an entire tar archive to the current working directory::" msgstr "" -#: ../../library/tarfile.rst:1275 +#: ../../library/tarfile.rst:1288 msgid "" "import tarfile\n" "tar = tarfile.open(\"sample.tar.gz\")\n" @@ -1696,13 +1717,13 @@ msgstr "" "tar.extractall(filter='data')\n" "tar.close()" -#: ../../library/tarfile.rst:1280 +#: ../../library/tarfile.rst:1293 msgid "" "How to extract a subset of a tar archive with :meth:`TarFile.extractall` " "using a generator function instead of a list::" msgstr "" -#: ../../library/tarfile.rst:1283 +#: ../../library/tarfile.rst:1296 msgid "" "import os\n" "import tarfile\n" @@ -1728,11 +1749,11 @@ msgstr "" "tar.extractall(members=py_files(tar))\n" "tar.close()" -#: ../../library/tarfile.rst:1295 +#: ../../library/tarfile.rst:1308 msgid "How to create an uncompressed tar archive from a list of filenames::" msgstr "" -#: ../../library/tarfile.rst:1297 +#: ../../library/tarfile.rst:1310 msgid "" "import tarfile\n" "tar = tarfile.open(\"sample.tar\", \"w\")\n" @@ -1746,11 +1767,11 @@ msgstr "" " tar.add(name)\n" "tar.close()" -#: ../../library/tarfile.rst:1303 +#: ../../library/tarfile.rst:1316 msgid "The same example using the :keyword:`with` statement::" msgstr "" -#: ../../library/tarfile.rst:1305 +#: ../../library/tarfile.rst:1318 msgid "" "import tarfile\n" "with tarfile.open(\"sample.tar\", \"w\") as tar:\n" @@ -1762,13 +1783,13 @@ msgstr "" " for name in [\"foo\", \"bar\", \"quux\"]:\n" " tar.add(name)" -#: ../../library/tarfile.rst:1310 +#: ../../library/tarfile.rst:1323 msgid "" "How to read a gzip compressed tar archive and display some member " "information::" msgstr "" -#: ../../library/tarfile.rst:1312 +#: ../../library/tarfile.rst:1325 msgid "" "import tarfile\n" "tar = tarfile.open(\"sample.tar.gz\", \"r:gz\")\n" @@ -1784,13 +1805,13 @@ msgid "" "tar.close()" msgstr "" -#: ../../library/tarfile.rst:1324 +#: ../../library/tarfile.rst:1337 msgid "" "How to create an archive and reset the user information using the *filter* " "parameter in :meth:`TarFile.add`::" msgstr "" -#: ../../library/tarfile.rst:1327 +#: ../../library/tarfile.rst:1340 msgid "" "import tarfile\n" "def reset(tarinfo):\n" @@ -1810,17 +1831,17 @@ msgstr "" "tar.add(\"foo\", filter=reset)\n" "tar.close()" -#: ../../library/tarfile.rst:1340 +#: ../../library/tarfile.rst:1353 msgid "Supported tar formats" msgstr "" -#: ../../library/tarfile.rst:1342 +#: ../../library/tarfile.rst:1355 msgid "" "There are three tar formats that can be created with the :mod:`tarfile` " "module:" msgstr "" -#: ../../library/tarfile.rst:1344 +#: ../../library/tarfile.rst:1357 msgid "" "The POSIX.1-1988 ustar format (:const:`USTAR_FORMAT`). It supports filenames " "up to a length of at best 256 characters and linknames up to 100 characters. " @@ -1828,7 +1849,7 @@ msgid "" "supported format." msgstr "" -#: ../../library/tarfile.rst:1349 +#: ../../library/tarfile.rst:1362 msgid "" "The GNU tar format (:const:`GNU_FORMAT`). It supports long filenames and " "linknames, files bigger than 8 GiB and sparse files. It is the de facto " @@ -1836,7 +1857,7 @@ msgid "" "extensions for long names, sparse file support is read-only." msgstr "" -#: ../../library/tarfile.rst:1354 +#: ../../library/tarfile.rst:1367 msgid "" "The POSIX.1-2001 pax format (:const:`PAX_FORMAT`). It is the most flexible " "format with virtually no limits. It supports long filenames and linknames, " @@ -1847,7 +1868,7 @@ msgid "" "*ustar* format. It is the current default format for new archives." msgstr "" -#: ../../library/tarfile.rst:1362 +#: ../../library/tarfile.rst:1375 msgid "" "It extends the existing *ustar* format with extra headers for information " "that cannot be stored otherwise. There are two flavours of pax headers: " @@ -1856,13 +1877,13 @@ msgid "" "in a pax header is encoded in *UTF-8* for portability reasons." msgstr "" -#: ../../library/tarfile.rst:1368 +#: ../../library/tarfile.rst:1381 msgid "" "There are some more variants of the tar format which can be read, but not " "created:" msgstr "" -#: ../../library/tarfile.rst:1371 +#: ../../library/tarfile.rst:1384 msgid "" "The ancient V7 format. This is the first tar format from Unix Seventh " "Edition, storing only regular files and directories. Names must not be " @@ -1871,17 +1892,17 @@ msgid "" "ASCII characters." msgstr "" -#: ../../library/tarfile.rst:1376 +#: ../../library/tarfile.rst:1389 msgid "" "The SunOS tar extended format. This format is a variant of the POSIX.1-2001 " "pax format, but is not compatible." msgstr "" -#: ../../library/tarfile.rst:1382 +#: ../../library/tarfile.rst:1395 msgid "Unicode issues" msgstr "" -#: ../../library/tarfile.rst:1384 +#: ../../library/tarfile.rst:1397 msgid "" "The tar format was originally conceived to make backups on tape drives with " "the main focus on preserving file system information. Nowadays tar archives " @@ -1896,13 +1917,13 @@ msgid "" "It stores non-ASCII metadata using the universal character encoding *UTF-8*." msgstr "" -#: ../../library/tarfile.rst:1396 +#: ../../library/tarfile.rst:1409 msgid "" "The details of character conversion in :mod:`tarfile` are controlled by the " "*encoding* and *errors* keyword arguments of the :class:`TarFile` class." msgstr "" -#: ../../library/tarfile.rst:1399 +#: ../../library/tarfile.rst:1412 msgid "" "*encoding* defines the character encoding to use for the metadata in the " "archive. The default value is :func:`sys.getfilesystemencoding` or " @@ -1911,7 +1932,7 @@ msgid "" "not set appropriately, this conversion may fail." msgstr "" -#: ../../library/tarfile.rst:1405 +#: ../../library/tarfile.rst:1418 msgid "" "The *errors* argument defines how characters are treated that cannot be " "converted. Possible values are listed in section :ref:`error-handlers`. The " @@ -1919,7 +1940,7 @@ msgid "" "system calls, see :ref:`os-filenames`." msgstr "" -#: ../../library/tarfile.rst:1410 +#: ../../library/tarfile.rst:1423 msgid "" "For :const:`PAX_FORMAT` archives (the default), *encoding* is generally not " "needed because all the metadata is stored using *UTF-8*. *encoding* is only " diff --git a/library/test.po b/library/test.po index 81011e2c7f..a3d5c4d723 100644 --- a/library/test.po +++ b/library/test.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -784,7 +784,7 @@ msgid "Context manager to swap out an attribute with a new object." msgstr "" #: ../../library/test.rst:607 ../../library/test.rst:625 -#: ../../library/test.rst:860 ../../library/test.rst:1326 +#: ../../library/test.rst:866 ../../library/test.rst:1332 msgid "Usage::" msgstr "用法: ::" @@ -927,54 +927,60 @@ msgid "" msgstr "" #: ../../library/test.rst:736 +msgid "" +"Decorator for skipping tests on the free-threaded build. If the :term:`GIL` " +"is disabled, the test is skipped." +msgstr "" + +#: ../../library/test.rst:742 msgid "Decorator for skipping tests on non-IEEE 754 platforms." msgstr "" -#: ../../library/test.rst:741 +#: ../../library/test.rst:747 msgid "Decorator for skipping tests if :mod:`zlib` doesn't exist." msgstr "如果 :mod:`zlib` 不存在則跳過測試的裝飾器。" -#: ../../library/test.rst:746 +#: ../../library/test.rst:752 msgid "Decorator for skipping tests if :mod:`gzip` doesn't exist." msgstr "如果 :mod:`gzip` 不存在則跳過測試的裝飾器。" -#: ../../library/test.rst:751 +#: ../../library/test.rst:757 msgid "Decorator for skipping tests if :mod:`bz2` doesn't exist." msgstr "如果 :mod:`bz2` 不存在則跳過測試的裝飾器。" -#: ../../library/test.rst:756 +#: ../../library/test.rst:762 msgid "Decorator for skipping tests if :mod:`lzma` doesn't exist." msgstr "如果 :mod:`lzma` 不存在則跳過測試的裝飾器。" -#: ../../library/test.rst:761 +#: ../../library/test.rst:767 msgid "Decorator for skipping tests if *resource* is not available." msgstr "如果 *resource* 不可用則跳過測試的裝飾器。" -#: ../../library/test.rst:766 +#: ../../library/test.rst:772 msgid "Decorator for only running the test if :data:`HAVE_DOCSTRINGS`." msgstr "" -#: ../../library/test.rst:771 +#: ../../library/test.rst:777 msgid "" "Decorator for only running the test if :ref:`Limited C API ` " "is available." msgstr "" -#: ../../library/test.rst:777 +#: ../../library/test.rst:783 msgid "Decorator for tests only applicable to CPython." msgstr "" -#: ../../library/test.rst:782 +#: ../../library/test.rst:788 msgid "" "Decorator for invoking :func:`check_impl_detail` on *guards*. If that " "returns ``False``, then uses *msg* as the reason for skipping the test." msgstr "" -#: ../../library/test.rst:788 +#: ../../library/test.rst:794 msgid "Decorator to temporarily turn off tracing for the duration of the test." msgstr "" -#: ../../library/test.rst:793 +#: ../../library/test.rst:799 msgid "" "Decorator for tests which involve reference counting. The decorator does " "not run the test if it is not run by CPython. Any trace function is unset " @@ -982,11 +988,11 @@ msgid "" "trace function." msgstr "" -#: ../../library/test.rst:801 +#: ../../library/test.rst:807 msgid "Decorator for bigmem tests." msgstr "大記憶體測試的裝飾器。" -#: ../../library/test.rst:803 +#: ../../library/test.rst:809 msgid "" "*size* is a requested size for the test (in arbitrary, test-interpreted " "units.) *memuse* is the number of bytes per unit for the test, or a good " @@ -994,7 +1000,7 @@ msgid "" "each, could be decorated with ``@bigmemtest(size=_4G, memuse=2)``." msgstr "" -#: ../../library/test.rst:808 +#: ../../library/test.rst:814 msgid "" "The *size* argument is normally passed to the decorated test method as an " "extra argument. If *dry_run* is ``True``, the value passed to the test " @@ -1002,11 +1008,11 @@ msgid "" "means the test doesn't support dummy runs when ``-M`` is not specified." msgstr "" -#: ../../library/test.rst:816 +#: ../../library/test.rst:822 msgid "Decorator for tests that fill the address space." msgstr "" -#: ../../library/test.rst:821 +#: ../../library/test.rst:827 msgid "" "Test for syntax errors in *statement* by attempting to compile *statement*. " "*testcase* is the :mod:`unittest` instance for the test. *errtext* is the " @@ -1016,44 +1022,44 @@ msgid "" "of the exception." msgstr "" -#: ../../library/test.rst:831 +#: ../../library/test.rst:837 msgid "Open *url*. If open fails, raises :exc:`TestFailed`." msgstr "" -#: ../../library/test.rst:836 +#: ../../library/test.rst:842 msgid "" "Use this at the end of ``test_main`` whenever sub-processes are started. " "This will help ensure that no extra children (zombies) stick around to hog " "resources and create problems when looking for refleaks." msgstr "" -#: ../../library/test.rst:843 +#: ../../library/test.rst:849 msgid "" "Get an attribute, raising :exc:`unittest.SkipTest` if :exc:`AttributeError` " "is raised." msgstr "" -#: ../../library/test.rst:849 +#: ../../library/test.rst:855 msgid "" "Context manager catching unraisable exception using :func:`sys." "unraisablehook`." msgstr "" -#: ../../library/test.rst:852 +#: ../../library/test.rst:858 msgid "" "Storing the exception value (``cm.unraisable.exc_value``) creates a " "reference cycle. The reference cycle is broken explicitly when the context " "manager exits." msgstr "" -#: ../../library/test.rst:856 +#: ../../library/test.rst:862 msgid "" "Storing the object (``cm.unraisable.object``) can resurrect it if it is set " "to an object which is being finalized. Exiting the context manager clears " "the stored object." msgstr "" -#: ../../library/test.rst:862 +#: ../../library/test.rst:868 msgid "" "with support.catch_unraisable_exception() as cm:\n" " # code creating an \"unraisable exception\"\n" @@ -1066,7 +1072,7 @@ msgid "" "# (to break a reference cycle)" msgstr "" -#: ../../library/test.rst:877 +#: ../../library/test.rst:883 msgid "" "Generic implementation of the :mod:`unittest` ``load_tests`` protocol for " "use in test packages. *pkg_dir* is the root directory of the package; " @@ -1075,7 +1081,7 @@ msgid "" "the following::" msgstr "" -#: ../../library/test.rst:883 +#: ../../library/test.rst:889 msgid "" "import os\n" "from test.support import load_package_tests\n" @@ -1089,14 +1095,14 @@ msgstr "" "def load_tests(*args):\n" " return load_package_tests(os.path.dirname(__file__), *args)" -#: ../../library/test.rst:892 +#: ../../library/test.rst:898 msgid "" "Returns the set of attributes, functions or methods of *ref_api* not found " "on *other_api*, except for a defined list of items to be ignored in this " "check specified in *ignore*." msgstr "" -#: ../../library/test.rst:896 +#: ../../library/test.rst:902 msgid "" "By default this skips private attributes beginning with '_' but includes all " "magic methods, i.e. those starting and ending in '__'." @@ -1104,42 +1110,42 @@ msgstr "" "這預設會跳過以 '_' 開頭的私有屬性,但會包含所有魔術方法,即以 '__' 開頭和結尾" "的方法。" -#: ../../library/test.rst:904 +#: ../../library/test.rst:910 msgid "" "Override *object_to_patch.attr_name* with *new_value*. Also add cleanup " "procedure to *test_instance* to restore *object_to_patch* for *attr_name*. " "The *attr_name* should be a valid attribute for *object_to_patch*." msgstr "" -#: ../../library/test.rst:912 +#: ../../library/test.rst:918 msgid "" "Run *code* in subinterpreter. Raise :exc:`unittest.SkipTest` if :mod:" "`tracemalloc` is enabled." msgstr "" -#: ../../library/test.rst:918 +#: ../../library/test.rst:924 msgid "Assert instances of *cls* are deallocated after iterating." msgstr "" -#: ../../library/test.rst:923 +#: ../../library/test.rst:929 msgid "" "Check for the existence of the compiler executables whose names are listed " "in *cmd_names* or all the compiler executables when *cmd_names* is empty and " "return the first missing executable or ``None`` when none is found missing." msgstr "" -#: ../../library/test.rst:931 +#: ../../library/test.rst:937 msgid "" "Assert that the ``__all__`` variable of *module* contains all public names." msgstr "" -#: ../../library/test.rst:933 +#: ../../library/test.rst:939 msgid "" "The module's public names (its API) are detected automatically based on " "whether they match the public name convention and were defined in *module*." msgstr "" -#: ../../library/test.rst:937 +#: ../../library/test.rst:943 msgid "" "The *name_of_module* argument can specify (as a string or tuple thereof) " "what module(s) an API could be defined in order to be detected as a public " @@ -1147,7 +1153,7 @@ msgid "" "other modules, possibly a C backend (like ``csv`` and its ``_csv``)." msgstr "" -#: ../../library/test.rst:942 +#: ../../library/test.rst:948 msgid "" "The *extra* argument can be a set of names that wouldn't otherwise be " "automatically detected as \"public\", like objects without a proper " @@ -1155,17 +1161,17 @@ msgid "" "detected ones." msgstr "" -#: ../../library/test.rst:946 +#: ../../library/test.rst:952 msgid "" "The *not_exported* argument can be a set of names that must not be treated " "as part of the public API even though their names indicate otherwise." msgstr "" -#: ../../library/test.rst:949 ../../library/test.rst:1576 +#: ../../library/test.rst:955 ../../library/test.rst:1582 msgid "Example use::" msgstr "用法範例: ::" -#: ../../library/test.rst:951 +#: ../../library/test.rst:957 msgid "" "import bar\n" "import foo\n" @@ -1185,18 +1191,18 @@ msgid "" " extra=extra, not_exported=not_exported)" msgstr "" -#: ../../library/test.rst:972 +#: ../../library/test.rst:978 msgid "" "Skip tests if the :mod:`multiprocessing.synchronize` module is missing, if " "there is no available semaphore implementation, or if creating a lock raises " "an :exc:`OSError`." msgstr "" -#: ../../library/test.rst:981 +#: ../../library/test.rst:987 msgid "Assert that type *tp* cannot be instantiated using *args* and *kwds*." msgstr "" -#: ../../library/test.rst:988 +#: ../../library/test.rst:994 msgid "" "This function returns a context manager that will change the global :func:" "`sys.set_int_max_str_digits` setting for the duration of the context to " @@ -1204,73 +1210,73 @@ msgid "" "digits when converting between an integer and string." msgstr "" -#: ../../library/test.rst:996 +#: ../../library/test.rst:1002 msgid "The :mod:`test.support` module defines the following classes:" msgstr ":mod:`test.support` 模組定義了以下類別:" -#: ../../library/test.rst:1001 +#: ../../library/test.rst:1007 msgid "" "A context manager used to try to prevent crash dialog popups on tests that " "are expected to crash a subprocess." msgstr "" -#: ../../library/test.rst:1004 +#: ../../library/test.rst:1010 msgid "" "On Windows, it disables Windows Error Reporting dialogs using `SetErrorMode " "`_." msgstr "" -#: ../../library/test.rst:1007 +#: ../../library/test.rst:1013 msgid "" "On UNIX, :func:`resource.setrlimit` is used to set :const:`resource." "RLIMIT_CORE`'s soft limit to 0 to prevent coredump file creation." msgstr "" -#: ../../library/test.rst:1011 +#: ../../library/test.rst:1017 msgid "" "On both platforms, the old value is restored by :meth:`~object.__exit__`." msgstr "在兩個平台上,舊值會被 :meth:`~object.__exit__` 還原。" -#: ../../library/test.rst:1016 +#: ../../library/test.rst:1022 msgid "" "Class to save and restore signal handlers registered by the Python signal " "handler." msgstr "" -#: ../../library/test.rst:1021 +#: ../../library/test.rst:1027 msgid "" "Save the signal handlers to a dictionary mapping signal numbers to the " "current signal handler." msgstr "" -#: ../../library/test.rst:1026 +#: ../../library/test.rst:1032 msgid "" "Set the signal numbers from the :meth:`save` dictionary to the saved handler." msgstr "" -#: ../../library/test.rst:1034 +#: ../../library/test.rst:1040 msgid "Try to match a single dict with the supplied arguments." msgstr "" -#: ../../library/test.rst:1039 +#: ../../library/test.rst:1045 msgid "Try to match a single stored value (*dv*) with a supplied value (*v*)." msgstr "" -#: ../../library/test.rst:1043 +#: ../../library/test.rst:1049 msgid ":mod:`test.support.socket_helper` --- Utilities for socket tests" msgstr ":mod:`test.support.socket_helper` --- 用於 socket 測試的工具" -#: ../../library/test.rst:1049 +#: ../../library/test.rst:1055 msgid "" "The :mod:`test.support.socket_helper` module provides support for socket " "tests." msgstr "" -#: ../../library/test.rst:1056 +#: ../../library/test.rst:1062 msgid "Set to ``True`` if IPv6 is enabled on this host, ``False`` otherwise." msgstr "" -#: ../../library/test.rst:1061 +#: ../../library/test.rst:1067 msgid "" "Returns an unused port that should be suitable for binding. This is " "achieved by creating a temporary socket with the same family and type as the " @@ -1281,7 +1287,7 @@ msgid "" "port is returned." msgstr "" -#: ../../library/test.rst:1070 +#: ../../library/test.rst:1076 msgid "" "Either this method or :func:`bind_port` should be used for any tests where a " "server socket needs to be bound to a particular port for the duration of the " @@ -1294,7 +1300,7 @@ msgid "" "simultaneously, which is a problem for buildbots." msgstr "" -#: ../../library/test.rst:1084 +#: ../../library/test.rst:1090 msgid "" "Bind the socket to a free port and return the port number. Relies on " "ephemeral ports in order to ensure we are using an unbound port. This is " @@ -1307,7 +1313,7 @@ msgid "" "testing multicasting via multiple UDP sockets." msgstr "" -#: ../../library/test.rst:1095 +#: ../../library/test.rst:1101 msgid "" "Additionally, if the :const:`~socket.SO_EXCLUSIVEADDRUSE` socket option is " "available (i.e. on Windows), it will be set on the socket. This will " @@ -1315,59 +1321,59 @@ msgid "" "test." msgstr "" -#: ../../library/test.rst:1103 +#: ../../library/test.rst:1109 msgid "" "Bind a Unix socket, raising :exc:`unittest.SkipTest` if :exc:" "`PermissionError` is raised." msgstr "" -#: ../../library/test.rst:1109 +#: ../../library/test.rst:1115 msgid "" "A decorator for running tests that require a functional ``bind()`` for Unix " "sockets." msgstr "" -#: ../../library/test.rst:1115 +#: ../../library/test.rst:1121 msgid "" "A context manager that raises :exc:`~test.support.ResourceDenied` when " "various issues with the internet connection manifest themselves as " "exceptions." msgstr "" -#: ../../library/test.rst:1121 +#: ../../library/test.rst:1127 msgid "" ":mod:`test.support.script_helper` --- Utilities for the Python execution " "tests" msgstr ":mod:`test.support.script_helper` --- 用於 Python 執行測試的工具" -#: ../../library/test.rst:1127 +#: ../../library/test.rst:1133 msgid "" "The :mod:`test.support.script_helper` module provides support for Python's " "script execution tests." msgstr "" ":mod:`test.support.script_helper` 模組提供 Python 的腳本執行測試的支援。" -#: ../../library/test.rst:1132 +#: ../../library/test.rst:1138 msgid "" "Return ``True`` if ``sys.executable interpreter`` requires environment " "variables in order to be able to run at all." msgstr "" -#: ../../library/test.rst:1135 +#: ../../library/test.rst:1141 msgid "" "This is designed to be used with ``@unittest.skipIf()`` to annotate tests " "that need to use an ``assert_python*()`` function to launch an isolated mode " "(``-I``) or no environment mode (``-E``) sub-interpreter process." msgstr "" -#: ../../library/test.rst:1139 +#: ../../library/test.rst:1145 msgid "" "A normal build & test does not run into this situation but it can happen " "when trying to run the standard library test suite from an interpreter that " "doesn't have an obvious home with Python's current home finding logic." msgstr "" -#: ../../library/test.rst:1143 +#: ../../library/test.rst:1149 msgid "" "Setting :envvar:`PYTHONHOME` is one way to get most of the testsuite to run " "in that situation. :envvar:`PYTHONPATH` or :envvar:`PYTHONUSERSITE` are " @@ -1375,85 +1381,85 @@ msgid "" "interpreter can start." msgstr "" -#: ../../library/test.rst:1151 +#: ../../library/test.rst:1157 msgid "" "Set up the environment based on *env_vars* for running the interpreter in a " "subprocess. The values can include ``__isolated``, ``__cleanenv``, " "``__cwd``, and ``TERM``." msgstr "" -#: ../../library/test.rst:1155 ../../library/test.rst:1171 -#: ../../library/test.rst:1183 +#: ../../library/test.rst:1161 ../../library/test.rst:1177 +#: ../../library/test.rst:1189 msgid "The function no longer strips whitespaces from *stderr*." msgstr "此函式不再從 *stderr* 中移除空白。" -#: ../../library/test.rst:1161 +#: ../../library/test.rst:1167 msgid "" "Assert that running the interpreter with *args* and optional environment " "variables *env_vars* succeeds (``rc == 0``) and return a ``(return code, " "stdout, stderr)`` tuple." msgstr "" -#: ../../library/test.rst:1165 +#: ../../library/test.rst:1171 msgid "" "If the *__cleanenv* keyword-only parameter is set, *env_vars* is used as a " "fresh environment." msgstr "" -#: ../../library/test.rst:1168 +#: ../../library/test.rst:1174 msgid "" "Python is started in isolated mode (command line option ``-I``), except if " "the *__isolated* keyword-only parameter is set to ``False``." msgstr "" -#: ../../library/test.rst:1177 +#: ../../library/test.rst:1183 msgid "" "Assert that running the interpreter with *args* and optional environment " "variables *env_vars* fails (``rc != 0``) and return a ``(return code, " "stdout, stderr)`` tuple." msgstr "" -#: ../../library/test.rst:1181 +#: ../../library/test.rst:1187 msgid "See :func:`assert_python_ok` for more options." msgstr "更多選項請見 :func:`assert_python_ok`。" -#: ../../library/test.rst:1189 +#: ../../library/test.rst:1195 msgid "Run a Python subprocess with the given arguments." msgstr "" -#: ../../library/test.rst:1191 +#: ../../library/test.rst:1197 msgid "" "*kw* is extra keyword args to pass to :func:`subprocess.Popen`. Returns a :" "class:`subprocess.Popen` object." msgstr "" -#: ../../library/test.rst:1197 +#: ../../library/test.rst:1203 msgid "" "Run the given :class:`subprocess.Popen` process until completion and return " "stdout." msgstr "" -#: ../../library/test.rst:1203 +#: ../../library/test.rst:1209 msgid "" "Create script containing *source* in path *script_dir* and " "*script_basename*. If *omit_suffix* is ``False``, append ``.py`` to the " "name. Return the full script path." msgstr "" -#: ../../library/test.rst:1210 +#: ../../library/test.rst:1216 msgid "" "Create zip file at *zip_dir* and *zip_basename* with extension ``zip`` which " "contains the files in *script_name*. *name_in_zip* is the archive name. " "Return a tuple containing ``(full path, full path of archive name)``." msgstr "" -#: ../../library/test.rst:1217 +#: ../../library/test.rst:1223 msgid "" "Create a directory named *pkg_dir* containing an ``__init__`` file with " "*init_source* as its contents." msgstr "" -#: ../../library/test.rst:1224 +#: ../../library/test.rst:1230 msgid "" "Create a zip package directory with a path of *zip_dir* and *zip_basename* " "containing an empty ``__init__`` file and a file *script_basename* " @@ -1462,62 +1468,62 @@ msgid "" "path and the archive name for the zip file." msgstr "" -#: ../../library/test.rst:1232 +#: ../../library/test.rst:1238 msgid "" ":mod:`test.support.bytecode_helper` --- Support tools for testing correct " "bytecode generation" msgstr "" ":mod:`test.support.bytecode_helper` --- 用於測試位元組碼能正確產生的支援工具" -#: ../../library/test.rst:1237 +#: ../../library/test.rst:1243 msgid "" "The :mod:`test.support.bytecode_helper` module provides support for testing " "and inspecting bytecode generation." msgstr "" ":mod:`test.support.bytecode_helper` 模組提供測試和檢查位元組碼產生的支援。" -#: ../../library/test.rst:1242 +#: ../../library/test.rst:1248 msgid "The module defines the following class:" msgstr "此模組定義了以下類別:" -#: ../../library/test.rst:1246 +#: ../../library/test.rst:1252 msgid "This class has custom assertion methods for inspecting bytecode." msgstr "" -#: ../../library/test.rst:1250 +#: ../../library/test.rst:1256 msgid "Return the disassembly of *co* as string." msgstr "" -#: ../../library/test.rst:1255 +#: ../../library/test.rst:1261 msgid "" "Return instr if *opname* is found, otherwise throws :exc:`AssertionError`." msgstr "" -#: ../../library/test.rst:1260 +#: ../../library/test.rst:1266 msgid "Throws :exc:`AssertionError` if *opname* is found." msgstr "" -#: ../../library/test.rst:1264 +#: ../../library/test.rst:1270 msgid ":mod:`test.support.threading_helper` --- Utilities for threading tests" msgstr "" -#: ../../library/test.rst:1269 +#: ../../library/test.rst:1275 msgid "" "The :mod:`test.support.threading_helper` module provides support for " "threading tests." msgstr "" -#: ../../library/test.rst:1276 +#: ../../library/test.rst:1282 msgid "" "Join a *thread* within *timeout*. Raise an :exc:`AssertionError` if thread " "is still alive after *timeout* seconds." msgstr "" -#: ../../library/test.rst:1282 +#: ../../library/test.rst:1288 msgid "Decorator to ensure the threads are cleaned up even if the test fails." msgstr "" -#: ../../library/test.rst:1287 +#: ../../library/test.rst:1293 msgid "" "Context manager to start *threads*, which is a sequence of threads. *unlock* " "is a function called after the threads are started, even if an exception was " @@ -1525,57 +1531,57 @@ msgid "" "will attempt to join the started threads upon exit." msgstr "" -#: ../../library/test.rst:1295 +#: ../../library/test.rst:1301 msgid "" "Cleanup up threads not specified in *original_values*. Designed to emit a " "warning if a test leaves running threads in the background." msgstr "" -#: ../../library/test.rst:1301 +#: ../../library/test.rst:1307 msgid "Return current thread count and copy of dangling threads." msgstr "" -#: ../../library/test.rst:1306 +#: ../../library/test.rst:1312 msgid "" "Context manager to wait until all threads created in the ``with`` statement " "exit." msgstr "" -#: ../../library/test.rst:1312 +#: ../../library/test.rst:1318 msgid "" "Context manager catching :class:`threading.Thread` exception using :func:" "`threading.excepthook`." msgstr "" -#: ../../library/test.rst:1315 +#: ../../library/test.rst:1321 msgid "Attributes set when an exception is caught:" msgstr "當捕捉到例外時會設定的屬性:" -#: ../../library/test.rst:1317 +#: ../../library/test.rst:1323 msgid "``exc_type``" msgstr "``exc_type``" -#: ../../library/test.rst:1318 +#: ../../library/test.rst:1324 msgid "``exc_value``" msgstr "``exc_value``" -#: ../../library/test.rst:1319 +#: ../../library/test.rst:1325 msgid "``exc_traceback``" msgstr "``exc_traceback``" -#: ../../library/test.rst:1320 +#: ../../library/test.rst:1326 msgid "``thread``" msgstr "``thread``" -#: ../../library/test.rst:1322 +#: ../../library/test.rst:1328 msgid "See :func:`threading.excepthook` documentation." msgstr "參閱 :func:`threading.excepthook` 文件。" -#: ../../library/test.rst:1324 +#: ../../library/test.rst:1330 msgid "These attributes are deleted at the context manager exit." msgstr "這些屬性會在離開情境管理器時被刪除。" -#: ../../library/test.rst:1328 +#: ../../library/test.rst:1334 msgid "" "with threading_helper.catch_threading_exception() as cm:\n" " # code spawning a thread which raises an exception\n" @@ -1590,29 +1596,29 @@ msgid "" "# (to avoid reference cycles)" msgstr "" -#: ../../library/test.rst:1344 +#: ../../library/test.rst:1350 msgid ":mod:`test.support.os_helper` --- Utilities for os tests" msgstr ":mod:`test.support.os_helper` --- 用於 os 測試的工具" -#: ../../library/test.rst:1349 +#: ../../library/test.rst:1355 msgid "The :mod:`test.support.os_helper` module provides support for os tests." msgstr ":mod:`test.support.os_helper` 模組提供 os 測試的支援。" -#: ../../library/test.rst:1356 +#: ../../library/test.rst:1362 msgid "A non-ASCII character encodable by :func:`os.fsencode`." msgstr "" -#: ../../library/test.rst:1361 +#: ../../library/test.rst:1367 msgid "Set to :func:`os.getcwd`." msgstr "設定為 :func:`os.getcwd`。" -#: ../../library/test.rst:1366 +#: ../../library/test.rst:1372 msgid "" "Set to a name that is safe to use as the name of a temporary file. Any " "temporary file that is created should be closed and unlinked (removed)." msgstr "" -#: ../../library/test.rst:1372 +#: ../../library/test.rst:1378 msgid "" "Set to a filename containing the :data:`FS_NONASCII` character, if it " "exists. This guarantees that if the filename exists, it can be encoded and " @@ -1620,25 +1626,25 @@ msgid "" "a non-ASCII filename to be easily skipped on platforms where they can't work." msgstr "" -#: ../../library/test.rst:1380 +#: ../../library/test.rst:1386 msgid "" "Set to a filename (str type) that should not be able to be encoded by file " "system encoding in strict mode. It may be ``None`` if it's not possible to " "generate such a filename." msgstr "" -#: ../../library/test.rst:1387 +#: ../../library/test.rst:1393 msgid "" "Set to a filename (bytes type) that should not be able to be decoded by file " "system encoding in strict mode. It may be ``None`` if it's not possible to " "generate such a filename." msgstr "" -#: ../../library/test.rst:1394 +#: ../../library/test.rst:1400 msgid "Set to a non-ASCII name for a temporary file." msgstr "" -#: ../../library/test.rst:1399 +#: ../../library/test.rst:1405 msgid "" "Class used to temporarily set or unset environment variables. Instances can " "be used as a context manager and have a complete dictionary interface for " @@ -1647,75 +1653,75 @@ msgid "" "instance will be rolled back." msgstr "" -#: ../../library/test.rst:1405 +#: ../../library/test.rst:1411 msgid "Added dictionary interface." msgstr "新增字典介面。" -#: ../../library/test.rst:1411 +#: ../../library/test.rst:1417 msgid "" "Simple :term:`path-like object`. It implements the :meth:`~os.PathLike." "__fspath__` method which just returns the *path* argument. If *path* is an " "exception, it will be raised in :meth:`!__fspath__`." msgstr "" -#: ../../library/test.rst:1419 +#: ../../library/test.rst:1425 msgid "" "Temporarily set the environment variable ``envvar`` to the value of " "``value``." msgstr "" -#: ../../library/test.rst:1425 +#: ../../library/test.rst:1431 msgid "Temporarily unset the environment variable ``envvar``." msgstr "暫時取消環境變數 ``envvar``。" -#: ../../library/test.rst:1430 +#: ../../library/test.rst:1436 msgid "Return ``True`` if the OS supports symbolic links, ``False`` otherwise." msgstr "如果作業系統支援符號連結則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/test.rst:1436 +#: ../../library/test.rst:1442 msgid "Return ``True`` if the OS supports xattr, ``False`` otherwise." msgstr "如果作業系統支援 xattr 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/test.rst:1442 +#: ../../library/test.rst:1448 msgid "" "A context manager that temporarily changes the current working directory to " "*path* and yields the directory." msgstr "" -#: ../../library/test.rst:1445 +#: ../../library/test.rst:1451 msgid "" "If *quiet* is ``False``, the context manager raises an exception on error. " "Otherwise, it issues only a warning and keeps the current working directory " "the same." msgstr "" -#: ../../library/test.rst:1452 +#: ../../library/test.rst:1458 msgid "" "Create an empty file with *filename*. If it already exists, truncate it." msgstr "" -#: ../../library/test.rst:1457 +#: ../../library/test.rst:1463 msgid "Count the number of open file descriptors." msgstr "" -#: ../../library/test.rst:1462 +#: ../../library/test.rst:1468 msgid "Return ``True`` if the file system for *directory* is case-insensitive." msgstr "" -#: ../../library/test.rst:1467 +#: ../../library/test.rst:1473 msgid "" "Create an invalid file descriptor by opening and closing a temporary file, " "and returning its descriptor." msgstr "" -#: ../../library/test.rst:1473 +#: ../../library/test.rst:1479 msgid "" "Call :func:`os.rmdir` on *filename*. On Windows platforms, this is wrapped " "with a wait loop that checks for the existence of the file, which is needed " "due to antivirus programs that can hold files open and prevent deletion." msgstr "" -#: ../../library/test.rst:1481 +#: ../../library/test.rst:1487 msgid "" "Call :func:`shutil.rmtree` on *path* or call :func:`os.lstat` and :func:`os." "rmdir` to remove a path and its contents. As with :func:`rmdir`, on Windows " @@ -1723,21 +1729,21 @@ msgid "" "the files." msgstr "" -#: ../../library/test.rst:1489 +#: ../../library/test.rst:1495 msgid "A decorator for running tests that require support for symbolic links." msgstr "" -#: ../../library/test.rst:1494 +#: ../../library/test.rst:1500 msgid "A decorator for running tests that require support for xattr." msgstr "" -#: ../../library/test.rst:1499 +#: ../../library/test.rst:1505 msgid "" "A context manager that temporarily creates a new directory and changes the " "current working directory (CWD)." msgstr "" -#: ../../library/test.rst:1502 +#: ../../library/test.rst:1508 msgid "" "The context manager creates a temporary directory in the current directory " "with name *name* before temporarily changing the current working directory. " @@ -1745,20 +1751,20 @@ msgid "" "`tempfile.mkdtemp`." msgstr "" -#: ../../library/test.rst:1507 +#: ../../library/test.rst:1513 msgid "" "If *quiet* is ``False`` and it is not possible to create or change the CWD, " "an error is raised. Otherwise, only a warning is raised and the original " "CWD is used." msgstr "" -#: ../../library/test.rst:1514 +#: ../../library/test.rst:1520 msgid "" "A context manager that creates a temporary directory at *path* and yields " "the directory." msgstr "" -#: ../../library/test.rst:1517 +#: ../../library/test.rst:1523 msgid "" "If *path* is ``None``, the temporary directory is created using :func:" "`tempfile.mkdtemp`. If *quiet* is ``False``, the context manager raises an " @@ -1766,34 +1772,34 @@ msgid "" "created, only a warning is issued." msgstr "" -#: ../../library/test.rst:1525 +#: ../../library/test.rst:1531 msgid "A context manager that temporarily sets the process umask." msgstr "" -#: ../../library/test.rst:1530 +#: ../../library/test.rst:1536 msgid "" "Call :func:`os.unlink` on *filename*. As with :func:`rmdir`, on Windows " "platforms, this is wrapped with a wait loop that checks for the existence of " "the file." msgstr "" -#: ../../library/test.rst:1536 +#: ../../library/test.rst:1542 msgid ":mod:`test.support.import_helper` --- Utilities for import tests" msgstr ":mod:`test.support.import_helper` --- 用於 import 測試的工具" -#: ../../library/test.rst:1541 +#: ../../library/test.rst:1547 msgid "" "The :mod:`test.support.import_helper` module provides support for import " "tests." msgstr ":mod:`test.support.import_helper` 模組提供 import 測試的支援。" -#: ../../library/test.rst:1548 +#: ../../library/test.rst:1554 msgid "" "Remove the module named *module_name* from ``sys.modules`` and delete any " "byte-compiled files of the module." msgstr "" -#: ../../library/test.rst:1554 +#: ../../library/test.rst:1560 msgid "" "This function imports and returns a fresh copy of the named Python module by " "removing the named module from ``sys.modules`` before doing the import. Note " @@ -1801,39 +1807,39 @@ msgid "" "operation." msgstr "" -#: ../../library/test.rst:1559 +#: ../../library/test.rst:1565 msgid "" "*fresh* is an iterable of additional module names that are also removed from " "the ``sys.modules`` cache before doing the import." msgstr "" -#: ../../library/test.rst:1562 +#: ../../library/test.rst:1568 msgid "" "*blocked* is an iterable of module names that are replaced with ``None`` in " "the module cache during the import to ensure that attempts to import them " "raise :exc:`ImportError`." msgstr "" -#: ../../library/test.rst:1566 +#: ../../library/test.rst:1572 msgid "" "The named module and any modules named in the *fresh* and *blocked* " "parameters are saved before starting the import and then reinserted into " "``sys.modules`` when the fresh import is complete." msgstr "" -#: ../../library/test.rst:1570 +#: ../../library/test.rst:1576 msgid "" "Module and package deprecation messages are suppressed during this import if " "*deprecated* is ``True``." msgstr "" -#: ../../library/test.rst:1573 +#: ../../library/test.rst:1579 msgid "" "This function will raise :exc:`ImportError` if the named module cannot be " "imported." msgstr "如果無法引入指定的模組則此函式會引發 :exc:`ImportError`。" -#: ../../library/test.rst:1578 +#: ../../library/test.rst:1584 msgid "" "# Get copies of the warnings module for testing without affecting the\n" "# version being used by the rest of the test suite. One copy uses the\n" @@ -1843,14 +1849,14 @@ msgid "" "c_warnings = import_fresh_module('warnings', fresh=['_warnings'])" msgstr "" -#: ../../library/test.rst:1590 +#: ../../library/test.rst:1596 msgid "" "This function imports and returns the named module. Unlike a normal import, " "this function raises :exc:`unittest.SkipTest` if the module cannot be " "imported." msgstr "" -#: ../../library/test.rst:1594 +#: ../../library/test.rst:1600 msgid "" "Module and package deprecation messages are suppressed during this import if " "*deprecated* is ``True``. If a module is required on a platform but " @@ -1858,21 +1864,21 @@ msgid "" "which will be compared against :data:`sys.platform`." msgstr "" -#: ../../library/test.rst:1604 +#: ../../library/test.rst:1610 msgid "Return a copy of :data:`sys.modules`." msgstr "回傳 :data:`sys.modules` 的複本。" -#: ../../library/test.rst:1609 +#: ../../library/test.rst:1615 msgid "" "Remove modules except for *oldmodules* and ``encodings`` in order to " "preserve internal cache." msgstr "" -#: ../../library/test.rst:1615 +#: ../../library/test.rst:1621 msgid "Delete *name* from ``sys.modules``." msgstr "從 ``sys.modules`` 中刪除 *name*。" -#: ../../library/test.rst:1620 +#: ../../library/test.rst:1626 msgid "" "Move a :pep:`3147`/:pep:`488` pyc file to its legacy pyc location and return " "the file system path to the legacy pyc file. The *source* value is the file " @@ -1880,48 +1886,48 @@ msgid "" "3147/488 pyc file must exist." msgstr "" -#: ../../library/test.rst:1628 +#: ../../library/test.rst:1634 msgid "" "A context manager to force import to return a new module reference. This is " "useful for testing module-level behaviors, such as the emission of a :exc:" "`DeprecationWarning` on import. Example usage::" msgstr "" -#: ../../library/test.rst:1632 +#: ../../library/test.rst:1638 msgid "" "with CleanImport('foo'):\n" " importlib.import_module('foo') # New reference." msgstr "" -#: ../../library/test.rst:1638 +#: ../../library/test.rst:1644 msgid "A context manager to temporarily add directories to :data:`sys.path`." msgstr "" -#: ../../library/test.rst:1640 +#: ../../library/test.rst:1646 msgid "" "This makes a copy of :data:`sys.path`, appends any directories given as " "positional arguments, then reverts :data:`sys.path` to the copied settings " "when the context ends." msgstr "" -#: ../../library/test.rst:1644 +#: ../../library/test.rst:1650 msgid "" "Note that *all* :data:`sys.path` modifications in the body of the context " "manager, including replacement of the object, will be reverted at the end of " "the block." msgstr "" -#: ../../library/test.rst:1650 +#: ../../library/test.rst:1656 msgid ":mod:`test.support.warnings_helper` --- Utilities for warnings tests" msgstr ":mod:`test.support.warnings_helper` --- 用於 warnings 測試的工具" -#: ../../library/test.rst:1655 +#: ../../library/test.rst:1661 msgid "" "The :mod:`test.support.warnings_helper` module provides support for warnings " "tests." msgstr ":mod:`test.support.warnings_helper` 模組提供 warnings 測試的支援。" -#: ../../library/test.rst:1662 +#: ../../library/test.rst:1668 msgid "" "Suppress warnings that are instances of *category*, which must be :exc:" "`Warning` or a subclass. Roughly equivalent to :func:`warnings." @@ -1929,21 +1935,21 @@ msgid "" "category=category) `. For example::" msgstr "" -#: ../../library/test.rst:1668 +#: ../../library/test.rst:1674 msgid "" "@warning_helper.ignore_warnings(category=DeprecationWarning)\n" "def test_suppress_warning():\n" " # do something" msgstr "" -#: ../../library/test.rst:1677 +#: ../../library/test.rst:1683 msgid "" "Context manager to check that no :exc:`ResourceWarning` was raised. You " "must remove the object which may emit :exc:`ResourceWarning` before the end " "of the context manager." msgstr "" -#: ../../library/test.rst:1684 +#: ../../library/test.rst:1690 msgid "" "Test for syntax warning in *statement* by attempting to compile *statement*. " "Test also that the :exc:`SyntaxWarning` is emitted only once, and that it " @@ -1955,7 +1961,7 @@ msgid "" "``None``, compares to the offset of the exception." msgstr "" -#: ../../library/test.rst:1698 +#: ../../library/test.rst:1704 msgid "" "A convenience wrapper for :func:`warnings.catch_warnings` that makes it " "easier to test that a warning was correctly raised. It is approximately " @@ -1964,7 +1970,7 @@ msgid "" "automatically validate the results that are recorded." msgstr "" -#: ../../library/test.rst:1704 +#: ../../library/test.rst:1710 msgid "" "``check_warnings`` accepts 2-tuples of the form ``(\"message regexp\", " "WarningCategory)`` as positional arguments. If one or more *filters* are " @@ -1976,19 +1982,19 @@ msgid "" "*quiet* to ``True``." msgstr "" -#: ../../library/test.rst:1713 +#: ../../library/test.rst:1719 msgid "If no arguments are specified, it defaults to::" msgstr "如果沒有指定引數,預設為: ::" -#: ../../library/test.rst:1715 +#: ../../library/test.rst:1721 msgid "check_warnings((\"\", Warning), quiet=True)" msgstr "check_warnings((\"\", Warning), quiet=True)" -#: ../../library/test.rst:1717 +#: ../../library/test.rst:1723 msgid "In this case all warnings are caught and no errors are raised." msgstr "" -#: ../../library/test.rst:1719 +#: ../../library/test.rst:1725 msgid "" "On entry to the context manager, a :class:`WarningRecorder` instance is " "returned. The underlying warnings list from :func:`~warnings.catch_warnings` " @@ -2000,17 +2006,17 @@ msgid "" "return ``None``." msgstr "" -#: ../../library/test.rst:1728 +#: ../../library/test.rst:1734 msgid "" "The recorder object also has a :meth:`reset` method, which clears the " "warnings list." msgstr "" -#: ../../library/test.rst:1731 +#: ../../library/test.rst:1737 msgid "The context manager is designed to be used like this::" msgstr "" -#: ../../library/test.rst:1733 +#: ../../library/test.rst:1739 msgid "" "with check_warnings((\"assertion is always true\", SyntaxWarning),\n" " (\"\", UserWarning)):\n" @@ -2018,19 +2024,19 @@ msgid "" " warnings.warn(UserWarning(\"Hide me!\"))" msgstr "" -#: ../../library/test.rst:1738 +#: ../../library/test.rst:1744 msgid "" "In this case if either warning was not raised, or some other warning was " "raised, :func:`check_warnings` would raise an error." msgstr "" -#: ../../library/test.rst:1741 +#: ../../library/test.rst:1747 msgid "" "When a test needs to look more deeply into the warnings, rather than just " "checking whether or not they occurred, code like this can be used::" msgstr "" -#: ../../library/test.rst:1744 +#: ../../library/test.rst:1750 msgid "" "with check_warnings(quiet=True) as w:\n" " warnings.warn(\"foo\")\n" @@ -2052,17 +2058,17 @@ msgstr "" " w.reset()\n" " assert len(w.warnings) == 0" -#: ../../library/test.rst:1755 +#: ../../library/test.rst:1761 msgid "" "Here all warnings will be caught, and the test code tests the captured " "warnings directly." msgstr "" -#: ../../library/test.rst:1758 +#: ../../library/test.rst:1764 msgid "New optional arguments *filters* and *quiet*." msgstr "新的可選引數 *filters* 和 *quiet*。" -#: ../../library/test.rst:1764 +#: ../../library/test.rst:1770 msgid "" "Class used to record warnings for unit tests. See documentation of :func:" "`check_warnings` above for more details." diff --git a/library/threading.po b/library/threading.po index 9b75b44677..82ec8c7c3b 100644 --- a/library/threading.po +++ b/library/threading.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -74,14 +74,15 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +#, fuzzy +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" @@ -196,13 +197,17 @@ msgid "" "after which the value may be recycled by the OS)." msgstr "" -#: ../../library/threading.rst:130 ../../library/threading.rst:465 +#: ../../library/threading.rst:130 msgid "" ":ref:`Availability `: Windows, FreeBSD, Linux, macOS, OpenBSD, " -"NetBSD, AIX, DragonFlyBSD." +"NetBSD, AIX, DragonFlyBSD, GNU/kFreeBSD." +msgstr "" + +#: ../../library/threading.rst:134 +msgid "Added support for GNU/kFreeBSD." msgstr "" -#: ../../library/threading.rst:137 +#: ../../library/threading.rst:140 msgid "" "Return a list of all :class:`Thread` objects currently active. The list " "includes daemonic threads and dummy thread objects created by :func:" @@ -211,59 +216,59 @@ msgid "" "even when terminated." msgstr "" -#: ../../library/threading.rst:146 +#: ../../library/threading.rst:149 msgid "" "Return the main :class:`Thread` object. In normal conditions, the main " "thread is the thread from which the Python interpreter was started." msgstr "" -#: ../../library/threading.rst:157 +#: ../../library/threading.rst:160 msgid "" "Set a trace function for all threads started from the :mod:`threading` " "module. The *func* will be passed to :func:`sys.settrace` for each thread, " "before its :meth:`~Thread.run` method is called." msgstr "" -#: ../../library/threading.rst:163 +#: ../../library/threading.rst:166 msgid "" "Set a trace function for all threads started from the :mod:`threading` " "module and all Python threads that are currently executing." msgstr "" -#: ../../library/threading.rst:166 +#: ../../library/threading.rst:169 msgid "" "The *func* will be passed to :func:`sys.settrace` for each thread, before " "its :meth:`~Thread.run` method is called." msgstr "" -#: ../../library/threading.rst:177 +#: ../../library/threading.rst:180 msgid "Get the trace function as set by :func:`settrace`." msgstr "" -#: ../../library/threading.rst:186 +#: ../../library/threading.rst:189 msgid "" "Set a profile function for all threads started from the :mod:`threading` " "module. The *func* will be passed to :func:`sys.setprofile` for each " "thread, before its :meth:`~Thread.run` method is called." msgstr "" -#: ../../library/threading.rst:192 +#: ../../library/threading.rst:195 msgid "" "Set a profile function for all threads started from the :mod:`threading` " "module and all Python threads that are currently executing." msgstr "" -#: ../../library/threading.rst:195 +#: ../../library/threading.rst:198 msgid "" "The *func* will be passed to :func:`sys.setprofile` for each thread, before " "its :meth:`~Thread.run` method is called." msgstr "" -#: ../../library/threading.rst:204 +#: ../../library/threading.rst:207 msgid "Get the profiler function as set by :func:`setprofile`." msgstr "" -#: ../../library/threading.rst:211 +#: ../../library/threading.rst:214 msgid "" "Return the thread stack size used when creating new threads. The optional " "*size* argument specifies the stack size to be used for subsequently created " @@ -282,19 +287,19 @@ msgid "" "information)." msgstr "" -#: ../../library/threading.rst:226 +#: ../../library/threading.rst:229 msgid ":ref:`Availability `: Windows, pthreads." msgstr ":ref:`適用 `:Windows, pthreads。" -#: ../../library/threading.rst:228 +#: ../../library/threading.rst:231 msgid "Unix platforms with POSIX threads support." msgstr "" -#: ../../library/threading.rst:231 +#: ../../library/threading.rst:234 msgid "This module also defines the following constant:" msgstr "" -#: ../../library/threading.rst:235 +#: ../../library/threading.rst:238 msgid "" "The maximum value allowed for the *timeout* parameter of blocking functions " "(:meth:`Lock.acquire`, :meth:`RLock.acquire`, :meth:`Condition.wait`, etc.). " @@ -302,13 +307,13 @@ msgid "" "`OverflowError`." msgstr "" -#: ../../library/threading.rst:243 +#: ../../library/threading.rst:246 msgid "" "This module defines a number of classes, which are detailed in the sections " "below." msgstr "" -#: ../../library/threading.rst:246 +#: ../../library/threading.rst:249 msgid "" "The design of this module is loosely based on Java's threading model. " "However, where Java makes locks and condition variables basic behavior of " @@ -319,22 +324,22 @@ msgid "" "Thread class, when implemented, are mapped to module-level functions." msgstr "" -#: ../../library/threading.rst:254 +#: ../../library/threading.rst:257 msgid "All of the methods described below are executed atomically." msgstr "" -#: ../../library/threading.rst:258 +#: ../../library/threading.rst:261 msgid "Thread-Local Data" msgstr "" -#: ../../library/threading.rst:260 +#: ../../library/threading.rst:263 msgid "" "Thread-local data is data whose values are thread specific. To manage " "thread-local data, just create an instance of :class:`local` (or a subclass) " "and store attributes on it::" msgstr "" -#: ../../library/threading.rst:264 +#: ../../library/threading.rst:267 msgid "" "mydata = threading.local()\n" "mydata.x = 1" @@ -342,25 +347,25 @@ msgstr "" "mydata = threading.local()\n" "mydata.x = 1" -#: ../../library/threading.rst:267 +#: ../../library/threading.rst:270 msgid "The instance's values will be different for separate threads." msgstr "" -#: ../../library/threading.rst:272 +#: ../../library/threading.rst:275 msgid "A class that represents thread-local data." msgstr "" -#: ../../library/threading.rst:274 +#: ../../library/threading.rst:277 msgid "" "For more details and extensive examples, see the documentation string of " "the :mod:`!_threading_local` module: :source:`Lib/_threading_local.py`." msgstr "" -#: ../../library/threading.rst:281 +#: ../../library/threading.rst:284 msgid "Thread Objects" msgstr "" -#: ../../library/threading.rst:283 +#: ../../library/threading.rst:286 msgid "" "The :class:`Thread` class represents an activity that is run in a separate " "thread of control. There are two ways to specify the activity: by passing a " @@ -370,14 +375,14 @@ msgid "" "``__init__()`` and :meth:`~Thread.run` methods of this class." msgstr "" -#: ../../library/threading.rst:290 +#: ../../library/threading.rst:293 msgid "" "Once a thread object is created, its activity must be started by calling the " "thread's :meth:`~Thread.start` method. This invokes the :meth:`~Thread.run` " "method in a separate thread of control." msgstr "" -#: ../../library/threading.rst:294 +#: ../../library/threading.rst:297 msgid "" "Once the thread's activity is started, the thread is considered 'alive'. It " "stops being alive when its :meth:`~Thread.run` method terminates -- either " @@ -385,27 +390,27 @@ msgid "" "is_alive` method tests whether the thread is alive." msgstr "" -#: ../../library/threading.rst:299 +#: ../../library/threading.rst:302 msgid "" "Other threads can call a thread's :meth:`~Thread.join` method. This blocks " "the calling thread until the thread whose :meth:`~Thread.join` method is " "called is terminated." msgstr "" -#: ../../library/threading.rst:303 +#: ../../library/threading.rst:306 msgid "" "A thread has a name. The name can be passed to the constructor, and read or " "changed through the :attr:`~Thread.name` attribute." msgstr "" -#: ../../library/threading.rst:306 +#: ../../library/threading.rst:309 msgid "" "If the :meth:`~Thread.run` method raises an exception, :func:`threading." "excepthook` is called to handle it. By default, :func:`threading.excepthook` " "ignores silently :exc:`SystemExit`." msgstr "" -#: ../../library/threading.rst:310 +#: ../../library/threading.rst:313 msgid "" "A thread can be flagged as a \"daemon thread\". The significance of this " "flag is that the entire Python program exits when only daemon threads are " @@ -414,7 +419,7 @@ msgid "" "constructor argument." msgstr "" -#: ../../library/threading.rst:317 +#: ../../library/threading.rst:320 msgid "" "Daemon threads are abruptly stopped at shutdown. Their resources (such as " "open files, database transactions, etc.) may not be released properly. If " @@ -422,13 +427,13 @@ msgid "" "suitable signalling mechanism such as an :class:`Event`." msgstr "" -#: ../../library/threading.rst:322 +#: ../../library/threading.rst:325 msgid "" "There is a \"main thread\" object; this corresponds to the initial thread of " "control in the Python program. It is not a daemon thread." msgstr "" -#: ../../library/threading.rst:325 +#: ../../library/threading.rst:328 msgid "" "There is the possibility that \"dummy thread objects\" are created. These " "are thread objects corresponding to \"alien threads\", which are threads of " @@ -439,25 +444,25 @@ msgid "" "threads." msgstr "" -#: ../../library/threading.rst:336 +#: ../../library/threading.rst:339 msgid "" "This constructor should always be called with keyword arguments. Arguments " "are:" msgstr "" -#: ../../library/threading.rst:339 +#: ../../library/threading.rst:342 msgid "" "*group* should be ``None``; reserved for future extension when a :class:`!" "ThreadGroup` class is implemented." msgstr "" -#: ../../library/threading.rst:342 +#: ../../library/threading.rst:345 msgid "" "*target* is the callable object to be invoked by the :meth:`run` method. " "Defaults to ``None``, meaning nothing is called." msgstr "" -#: ../../library/threading.rst:345 +#: ../../library/threading.rst:348 msgid "" "*name* is the thread name. By default, a unique name is constructed of the " "form \"Thread-*N*\" where *N* is a small decimal number, or \"Thread-*N* " @@ -465,62 +470,62 @@ msgid "" "is specified." msgstr "" -#: ../../library/threading.rst:350 +#: ../../library/threading.rst:353 msgid "" "*args* is a list or tuple of arguments for the target invocation. Defaults " "to ``()``." msgstr "" -#: ../../library/threading.rst:352 +#: ../../library/threading.rst:355 msgid "" "*kwargs* is a dictionary of keyword arguments for the target invocation. " "Defaults to ``{}``." msgstr "" -#: ../../library/threading.rst:355 +#: ../../library/threading.rst:358 msgid "" "If not ``None``, *daemon* explicitly sets whether the thread is daemonic. If " "``None`` (the default), the daemonic property is inherited from the current " "thread." msgstr "" -#: ../../library/threading.rst:359 +#: ../../library/threading.rst:362 msgid "" "If the subclass overrides the constructor, it must make sure to invoke the " "base class constructor (``Thread.__init__()``) before doing anything else to " "the thread." msgstr "" -#: ../../library/threading.rst:363 +#: ../../library/threading.rst:366 msgid "Added the *daemon* parameter." msgstr "新增 *daemon* 參數。" -#: ../../library/threading.rst:366 +#: ../../library/threading.rst:369 msgid "Use the *target* name if *name* argument is omitted." msgstr "" -#: ../../library/threading.rst:371 +#: ../../library/threading.rst:374 msgid "Start the thread's activity." msgstr "" -#: ../../library/threading.rst:373 +#: ../../library/threading.rst:376 msgid "" "It must be called at most once per thread object. It arranges for the " "object's :meth:`~Thread.run` method to be invoked in a separate thread of " "control." msgstr "" -#: ../../library/threading.rst:377 +#: ../../library/threading.rst:380 msgid "" "This method will raise a :exc:`RuntimeError` if called more than once on the " "same thread object." msgstr "" -#: ../../library/threading.rst:382 +#: ../../library/threading.rst:385 msgid "Method representing the thread's activity." msgstr "" -#: ../../library/threading.rst:384 +#: ../../library/threading.rst:387 msgid "" "You may override this method in a subclass. The standard :meth:`run` method " "invokes the callable object passed to the object's constructor as the " @@ -528,17 +533,17 @@ msgid "" "the *args* and *kwargs* arguments, respectively." msgstr "" -#: ../../library/threading.rst:389 +#: ../../library/threading.rst:392 msgid "" "Using list or tuple as the *args* argument which passed to the :class:" "`Thread` could achieve the same effect." msgstr "" -#: ../../library/threading.rst:392 +#: ../../library/threading.rst:395 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/threading.rst:394 +#: ../../library/threading.rst:397 msgid "" ">>> from threading import Thread\n" ">>> t = Thread(target=print, args=[1])\n" @@ -556,7 +561,7 @@ msgstr "" ">>> t.run()\n" "1" -#: ../../library/threading.rst:406 +#: ../../library/threading.rst:409 msgid "" "Wait until the thread terminates. This blocks the calling thread until the " "thread whose :meth:`~Thread.join` method is called terminates -- either " @@ -564,7 +569,7 @@ msgid "" "occurs." msgstr "" -#: ../../library/threading.rst:411 +#: ../../library/threading.rst:414 msgid "" "When the *timeout* argument is present and not ``None``, it should be a " "floating-point number specifying a timeout for the operation in seconds (or " @@ -574,17 +579,17 @@ msgid "" "`~Thread.join` call timed out." msgstr "" -#: ../../library/threading.rst:418 +#: ../../library/threading.rst:421 msgid "" "When the *timeout* argument is not present or ``None``, the operation will " "block until the thread terminates." msgstr "" -#: ../../library/threading.rst:421 +#: ../../library/threading.rst:424 msgid "A thread can be joined many times." msgstr "" -#: ../../library/threading.rst:423 +#: ../../library/threading.rst:426 msgid "" ":meth:`~Thread.join` raises a :exc:`RuntimeError` if an attempt is made to " "join the current thread as that would cause a deadlock. It is also an error " @@ -592,20 +597,20 @@ msgid "" "do so raise the same exception." msgstr "" -#: ../../library/threading.rst:430 +#: ../../library/threading.rst:433 msgid "" "A string used for identification purposes only. It has no semantics. " "Multiple threads may be given the same name. The initial name is set by the " "constructor." msgstr "" -#: ../../library/threading.rst:437 +#: ../../library/threading.rst:440 msgid "" "Deprecated getter/setter API for :attr:`~Thread.name`; use it directly as a " "property instead." msgstr "" -#: ../../library/threading.rst:444 +#: ../../library/threading.rst:447 msgid "" "The 'thread identifier' of this thread or ``None`` if the thread has not " "been started. This is a nonzero integer. See the :func:`get_ident` " @@ -614,7 +619,7 @@ msgid "" "thread has exited." msgstr "" -#: ../../library/threading.rst:452 +#: ../../library/threading.rst:455 msgid "" "The Thread ID (``TID``) of this thread, as assigned by the OS (kernel). This " "is a non-negative integer, or ``None`` if the thread has not been started. " @@ -623,25 +628,31 @@ msgid "" "after which the value may be recycled by the OS)." msgstr "" -#: ../../library/threading.rst:461 +#: ../../library/threading.rst:464 msgid "" "Similar to Process IDs, Thread IDs are only valid (guaranteed unique system-" "wide) from the time the thread is created until the thread has been " "terminated." msgstr "" -#: ../../library/threading.rst:471 +#: ../../library/threading.rst:468 +msgid "" +":ref:`Availability `: Windows, FreeBSD, Linux, macOS, OpenBSD, " +"NetBSD, AIX, DragonFlyBSD." +msgstr "" + +#: ../../library/threading.rst:474 msgid "Return whether the thread is alive." msgstr "" -#: ../../library/threading.rst:473 +#: ../../library/threading.rst:476 msgid "" "This method returns ``True`` just before the :meth:`~Thread.run` method " "starts until just after the :meth:`~Thread.run` method terminates. The " "module function :func:`.enumerate` returns a list of all alive threads." msgstr "" -#: ../../library/threading.rst:479 +#: ../../library/threading.rst:482 msgid "" "A boolean value indicating whether this thread is a daemon thread (``True``) " "or not (``False``). This must be set before :meth:`~Thread.start` is " @@ -651,22 +662,22 @@ msgid "" "`~Thread.daemon` = ``False``." msgstr "" -#: ../../library/threading.rst:486 +#: ../../library/threading.rst:489 msgid "" "The entire Python program exits when no alive non-daemon threads are left." msgstr "" -#: ../../library/threading.rst:491 +#: ../../library/threading.rst:494 msgid "" "Deprecated getter/setter API for :attr:`~Thread.daemon`; use it directly as " "a property instead." msgstr "" -#: ../../library/threading.rst:500 +#: ../../library/threading.rst:503 msgid "Lock Objects" msgstr "" -#: ../../library/threading.rst:502 +#: ../../library/threading.rst:505 msgid "" "A primitive lock is a synchronization primitive that is not owned by a " "particular thread when locked. In Python, it is currently the lowest level " @@ -674,7 +685,7 @@ msgid "" "`_thread` extension module." msgstr "" -#: ../../library/threading.rst:507 +#: ../../library/threading.rst:510 msgid "" "A primitive lock is in one of two states, \"locked\" or \"unlocked\". It is " "created in the unlocked state. It has two basic methods, :meth:`~Lock." @@ -688,11 +699,11 @@ msgid "" "an unlocked lock, a :exc:`RuntimeError` will be raised." msgstr "" -#: ../../library/threading.rst:518 +#: ../../library/threading.rst:521 msgid "Locks also support the :ref:`context management protocol `." msgstr "" -#: ../../library/threading.rst:520 +#: ../../library/threading.rst:523 msgid "" "When more than one thread is blocked in :meth:`~Lock.acquire` waiting for " "the state to turn to unlocked, only one thread proceeds when a :meth:`~Lock." @@ -700,42 +711,41 @@ msgid "" "proceeds is not defined, and may vary across implementations." msgstr "" -#: ../../library/threading.rst:525 +#: ../../library/threading.rst:528 msgid "All methods are executed atomically." msgstr "" -#: ../../library/threading.rst:530 +#: ../../library/threading.rst:533 msgid "" "The class implementing primitive lock objects. Once a thread has acquired a " "lock, subsequent attempts to acquire it block, until it is released; any " "thread may release it." msgstr "" -#: ../../library/threading.rst:534 +#: ../../library/threading.rst:537 msgid "" -"Note that ``Lock`` is actually a factory function which returns an instance " -"of the most efficient version of the concrete Lock class that is supported " -"by the platform." +"``Lock`` is now a class. In earlier Pythons, ``Lock`` was a factory function " +"which returned an instance of the underlying private lock type." msgstr "" -#: ../../library/threading.rst:541 ../../library/threading.rst:632 +#: ../../library/threading.rst:545 ../../library/threading.rst:636 msgid "Acquire a lock, blocking or non-blocking." msgstr "" -#: ../../library/threading.rst:543 +#: ../../library/threading.rst:547 msgid "" "When invoked with the *blocking* argument set to ``True`` (the default), " "block until the lock is unlocked, then set it to locked and return ``True``." msgstr "" -#: ../../library/threading.rst:546 +#: ../../library/threading.rst:550 msgid "" "When invoked with the *blocking* argument set to ``False``, do not block. If " "a call with *blocking* set to ``True`` would block, return ``False`` " "immediately; otherwise, set the lock to locked and return ``True``." msgstr "" -#: ../../library/threading.rst:550 +#: ../../library/threading.rst:554 msgid "" "When invoked with the floating-point *timeout* argument set to a positive " "value, block for at most the number of seconds specified by *timeout* and as " @@ -744,53 +754,53 @@ msgid "" "*blocking* is ``False``." msgstr "" -#: ../../library/threading.rst:556 +#: ../../library/threading.rst:560 msgid "" "The return value is ``True`` if the lock is acquired successfully, ``False`` " "if not (for example if the *timeout* expired)." msgstr "" -#: ../../library/threading.rst:559 ../../library/threading.rst:670 -#: ../../library/threading.rst:917 +#: ../../library/threading.rst:563 ../../library/threading.rst:674 +#: ../../library/threading.rst:921 msgid "The *timeout* parameter is new." msgstr "" -#: ../../library/threading.rst:562 +#: ../../library/threading.rst:566 msgid "" "Lock acquisition can now be interrupted by signals on POSIX if the " "underlying threading implementation supports it." msgstr "" -#: ../../library/threading.rst:569 +#: ../../library/threading.rst:573 msgid "" "Release a lock. This can be called from any thread, not only the thread " "which has acquired the lock." msgstr "" -#: ../../library/threading.rst:572 +#: ../../library/threading.rst:576 msgid "" "When the lock is locked, reset it to unlocked, and return. If any other " "threads are blocked waiting for the lock to become unlocked, allow exactly " "one of them to proceed." msgstr "" -#: ../../library/threading.rst:576 +#: ../../library/threading.rst:580 msgid "When invoked on an unlocked lock, a :exc:`RuntimeError` is raised." msgstr "" -#: ../../library/threading.rst:578 ../../library/threading.rst:686 +#: ../../library/threading.rst:582 ../../library/threading.rst:690 msgid "There is no return value." msgstr "" -#: ../../library/threading.rst:582 +#: ../../library/threading.rst:586 msgid "Return ``True`` if the lock is acquired." msgstr "" -#: ../../library/threading.rst:589 +#: ../../library/threading.rst:593 msgid "RLock Objects" msgstr "RLock 物件" -#: ../../library/threading.rst:591 +#: ../../library/threading.rst:595 msgid "" "A reentrant lock is a synchronization primitive that may be acquired " "multiple times by the same thread. Internally, it uses the concepts of " @@ -799,13 +809,13 @@ msgid "" "lock; in the unlocked state, no thread owns it." msgstr "" -#: ../../library/threading.rst:597 +#: ../../library/threading.rst:601 msgid "" "Threads call a lock's :meth:`~RLock.acquire` method to lock it, and its :" "meth:`~Lock.release` method to unlock it." msgstr "" -#: ../../library/threading.rst:602 +#: ../../library/threading.rst:606 msgid "" "Reentrant locks support the :ref:`context management protocol `, " "so it is recommended to use :keyword:`with` instead of manually calling :" @@ -813,7 +823,7 @@ msgid "" "releasing the lock for a block of code." msgstr "" -#: ../../library/threading.rst:607 +#: ../../library/threading.rst:611 msgid "" "RLock's :meth:`~RLock.acquire`/:meth:`~RLock.release` call pairs may be " "nested, unlike Lock's :meth:`~Lock.acquire`/:meth:`~Lock.release`. Only the " @@ -822,7 +832,7 @@ msgid "" "in :meth:`~RLock.acquire` to proceed." msgstr "" -#: ../../library/threading.rst:613 +#: ../../library/threading.rst:617 msgid "" ":meth:`~RLock.acquire`/:meth:`~RLock.release` must be used in pairs: each " "acquire must have a release in the thread that has acquired the lock. " @@ -830,7 +840,7 @@ msgid "" "deadlock." msgstr "" -#: ../../library/threading.rst:620 +#: ../../library/threading.rst:624 msgid "" "This class implements reentrant lock objects. A reentrant lock must be " "released by the thread that acquired it. Once a thread has acquired a " @@ -838,39 +848,39 @@ msgid "" "thread must release it once for each time it has acquired it." msgstr "" -#: ../../library/threading.rst:625 +#: ../../library/threading.rst:629 msgid "" "Note that ``RLock`` is actually a factory function which returns an instance " "of the most efficient version of the concrete RLock class that is supported " "by the platform." msgstr "" -#: ../../library/threading.rst:636 +#: ../../library/threading.rst:640 msgid ":ref:`Using RLock as a context manager `" msgstr "" -#: ../../library/threading.rst:637 +#: ../../library/threading.rst:641 msgid "" "Recommended over manual :meth:`!acquire` and :meth:`release` calls whenever " "practical." msgstr "" -#: ../../library/threading.rst:641 +#: ../../library/threading.rst:645 msgid "" "When invoked with the *blocking* argument set to ``True`` (the default):" msgstr "" -#: ../../library/threading.rst:643 ../../library/threading.rst:655 +#: ../../library/threading.rst:647 ../../library/threading.rst:659 msgid "If no thread owns the lock, acquire the lock and return immediately." msgstr "" -#: ../../library/threading.rst:645 +#: ../../library/threading.rst:649 msgid "" "If another thread owns the lock, block until we are able to acquire lock, or " "*timeout*, if set to a positive float value." msgstr "" -#: ../../library/threading.rst:648 +#: ../../library/threading.rst:652 msgid "" "If the same thread owns the lock, acquire the lock again, and return " "immediately. This is the difference between :class:`Lock` and :class:`!" @@ -878,35 +888,35 @@ msgid "" "until the lock can be acquired." msgstr "" -#: ../../library/threading.rst:653 +#: ../../library/threading.rst:657 msgid "When invoked with the *blocking* argument set to ``False``:" msgstr "" -#: ../../library/threading.rst:657 +#: ../../library/threading.rst:661 msgid "If another thread owns the lock, return immediately." msgstr "" -#: ../../library/threading.rst:659 +#: ../../library/threading.rst:663 msgid "" "If the same thread owns the lock, acquire the lock again and return " "immediately." msgstr "" -#: ../../library/threading.rst:662 +#: ../../library/threading.rst:666 msgid "" "In all cases, if the thread was able to acquire the lock, return ``True``. " "If the thread was unable to acquire the lock (i.e. if not blocking or the " "timeout was reached) return ``False``." msgstr "" -#: ../../library/threading.rst:666 +#: ../../library/threading.rst:670 msgid "" "If called multiple times, failing to call :meth:`~RLock.release` as many " "times may lead to deadlock. Consider using :class:`!RLock` as a context " "manager rather than calling acquire/release directly." msgstr "" -#: ../../library/threading.rst:676 +#: ../../library/threading.rst:680 msgid "" "Release a lock, decrementing the recursion level. If after the decrement it " "is zero, reset the lock to unlocked (not owned by any thread), and if any " @@ -915,18 +925,18 @@ msgid "" "is still nonzero, the lock remains locked and owned by the calling thread." msgstr "" -#: ../../library/threading.rst:682 +#: ../../library/threading.rst:686 msgid "" "Only call this method when the calling thread owns the lock. A :exc:" "`RuntimeError` is raised if this method is called when the lock is not " "acquired." msgstr "" -#: ../../library/threading.rst:692 +#: ../../library/threading.rst:696 msgid "Condition Objects" msgstr "" -#: ../../library/threading.rst:694 +#: ../../library/threading.rst:698 msgid "" "A condition variable is always associated with some kind of lock; this can " "be passed in or one will be created by default. Passing one in is useful " @@ -934,7 +944,7 @@ msgid "" "of the condition object: you don't have to track it separately." msgstr "" -#: ../../library/threading.rst:699 +#: ../../library/threading.rst:703 msgid "" "A condition variable obeys the :ref:`context management protocol `: using the ``with`` statement acquires the associated lock for the " @@ -943,7 +953,7 @@ msgid "" "associated lock." msgstr "" -#: ../../library/threading.rst:705 +#: ../../library/threading.rst:709 msgid "" "Other methods must be called with the associated lock held. The :meth:" "`~Condition.wait` method releases the lock, and then blocks until another " @@ -952,14 +962,14 @@ msgid "" "and returns. It is also possible to specify a timeout." msgstr "" -#: ../../library/threading.rst:711 +#: ../../library/threading.rst:715 msgid "" "The :meth:`~Condition.notify` method wakes up one of the threads waiting for " "the condition variable, if any are waiting. The :meth:`~Condition." "notify_all` method wakes up all threads waiting for the condition variable." msgstr "" -#: ../../library/threading.rst:715 +#: ../../library/threading.rst:719 msgid "" "Note: the :meth:`~Condition.notify` and :meth:`~Condition.notify_all` " "methods don't release the lock; this means that the thread or threads " @@ -968,7 +978,7 @@ msgid "" "or :meth:`~Condition.notify_all` finally relinquishes ownership of the lock." msgstr "" -#: ../../library/threading.rst:721 +#: ../../library/threading.rst:725 msgid "" "The typical programming style using condition variables uses the lock to " "synchronize access to some shared state; threads that are interested in a " @@ -980,7 +990,7 @@ msgid "" "situation with unlimited buffer capacity::" msgstr "" -#: ../../library/threading.rst:730 +#: ../../library/threading.rst:734 msgid "" "# Consume one item\n" "with cv:\n" @@ -994,7 +1004,7 @@ msgid "" " cv.notify()" msgstr "" -#: ../../library/threading.rst:741 +#: ../../library/threading.rst:745 msgid "" "The ``while`` loop checking for the application's condition is necessary " "because :meth:`~Condition.wait` can return after an arbitrary long time, and " @@ -1004,7 +1014,7 @@ msgid "" "checking, and eases the computation of timeouts::" msgstr "" -#: ../../library/threading.rst:748 +#: ../../library/threading.rst:752 msgid "" "# Consume an item\n" "with cv:\n" @@ -1012,7 +1022,7 @@ msgid "" " get_an_available_item()" msgstr "" -#: ../../library/threading.rst:753 +#: ../../library/threading.rst:757 msgid "" "To choose between :meth:`~Condition.notify` and :meth:`~Condition." "notify_all`, consider whether one state change can be interesting for only " @@ -1021,45 +1031,45 @@ msgid "" "thread." msgstr "" -#: ../../library/threading.rst:761 +#: ../../library/threading.rst:765 msgid "" "This class implements condition variable objects. A condition variable " "allows one or more threads to wait until they are notified by another thread." msgstr "" -#: ../../library/threading.rst:764 +#: ../../library/threading.rst:768 msgid "" "If the *lock* argument is given and not ``None``, it must be a :class:`Lock` " "or :class:`RLock` object, and it is used as the underlying lock. Otherwise, " "a new :class:`RLock` object is created and used as the underlying lock." msgstr "" -#: ../../library/threading.rst:768 ../../library/threading.rst:892 -#: ../../library/threading.rst:938 ../../library/threading.rst:990 -#: ../../library/threading.rst:1058 +#: ../../library/threading.rst:772 ../../library/threading.rst:896 +#: ../../library/threading.rst:942 ../../library/threading.rst:994 +#: ../../library/threading.rst:1062 msgid "changed from a factory function to a class." msgstr "" -#: ../../library/threading.rst:773 +#: ../../library/threading.rst:777 msgid "" "Acquire the underlying lock. This method calls the corresponding method on " "the underlying lock; the return value is whatever that method returns." msgstr "" -#: ../../library/threading.rst:778 +#: ../../library/threading.rst:782 msgid "" "Release the underlying lock. This method calls the corresponding method on " "the underlying lock; there is no return value." msgstr "" -#: ../../library/threading.rst:783 +#: ../../library/threading.rst:787 msgid "" "Wait until notified or until a timeout occurs. If the calling thread has not " "acquired the lock when this method is called, a :exc:`RuntimeError` is " "raised." msgstr "" -#: ../../library/threading.rst:787 +#: ../../library/threading.rst:791 msgid "" "This method releases the underlying lock, and then blocks until it is " "awakened by a :meth:`notify` or :meth:`notify_all` call for the same " @@ -1067,14 +1077,14 @@ msgid "" "Once awakened or timed out, it re-acquires the lock and returns." msgstr "" -#: ../../library/threading.rst:792 +#: ../../library/threading.rst:796 msgid "" "When the *timeout* argument is present and not ``None``, it should be a " "floating-point number specifying a timeout for the operation in seconds (or " "fractions thereof)." msgstr "" -#: ../../library/threading.rst:796 +#: ../../library/threading.rst:800 msgid "" "When the underlying lock is an :class:`RLock`, it is not released using its :" "meth:`release` method, since this may not actually unlock the lock when it " @@ -1084,24 +1094,24 @@ msgid "" "used to restore the recursion level when the lock is reacquired." msgstr "" -#: ../../library/threading.rst:804 +#: ../../library/threading.rst:808 msgid "" "The return value is ``True`` unless a given *timeout* expired, in which case " "it is ``False``." msgstr "" -#: ../../library/threading.rst:807 ../../library/threading.rst:1023 +#: ../../library/threading.rst:811 ../../library/threading.rst:1027 msgid "Previously, the method always returned ``None``." msgstr "" -#: ../../library/threading.rst:812 +#: ../../library/threading.rst:816 msgid "" "Wait until a condition evaluates to true. *predicate* should be a callable " "which result will be interpreted as a boolean value. A *timeout* may be " "provided giving the maximum time to wait." msgstr "" -#: ../../library/threading.rst:816 +#: ../../library/threading.rst:820 msgid "" "This utility method may call :meth:`wait` repeatedly until the predicate is " "satisfied, or until a timeout occurs. The return value is the last return " @@ -1109,13 +1119,13 @@ msgid "" "out." msgstr "" -#: ../../library/threading.rst:821 +#: ../../library/threading.rst:825 msgid "" "Ignoring the timeout feature, calling this method is roughly equivalent to " "writing::" msgstr "" -#: ../../library/threading.rst:824 +#: ../../library/threading.rst:828 msgid "" "while not predicate():\n" " cv.wait()" @@ -1123,27 +1133,27 @@ msgstr "" "while not predicate():\n" " cv.wait()" -#: ../../library/threading.rst:827 +#: ../../library/threading.rst:831 msgid "" "Therefore, the same rules apply as with :meth:`wait`: The lock must be held " "when called and is re-acquired on return. The predicate is evaluated with " "the lock held." msgstr "" -#: ../../library/threading.rst:835 +#: ../../library/threading.rst:839 msgid "" "By default, wake up one thread waiting on this condition, if any. If the " "calling thread has not acquired the lock when this method is called, a :exc:" "`RuntimeError` is raised." msgstr "" -#: ../../library/threading.rst:839 +#: ../../library/threading.rst:843 msgid "" "This method wakes up at most *n* of the threads waiting for the condition " "variable; it is a no-op if no threads are waiting." msgstr "" -#: ../../library/threading.rst:842 +#: ../../library/threading.rst:846 msgid "" "The current implementation wakes up exactly *n* threads, if at least *n* " "threads are waiting. However, it's not safe to rely on this behavior. A " @@ -1151,14 +1161,14 @@ msgid "" "threads." msgstr "" -#: ../../library/threading.rst:847 +#: ../../library/threading.rst:851 msgid "" "Note: an awakened thread does not actually return from its :meth:`wait` call " "until it can reacquire the lock. Since :meth:`notify` does not release the " "lock, its caller should." msgstr "" -#: ../../library/threading.rst:853 +#: ../../library/threading.rst:857 msgid "" "Wake up all threads waiting on this condition. This method acts like :meth:" "`notify`, but wakes up all waiting threads instead of one. If the calling " @@ -1166,15 +1176,15 @@ msgid "" "`RuntimeError` is raised." msgstr "" -#: ../../library/threading.rst:858 +#: ../../library/threading.rst:862 msgid "The method ``notifyAll`` is a deprecated alias for this method." msgstr "" -#: ../../library/threading.rst:864 +#: ../../library/threading.rst:868 msgid "Semaphore Objects" msgstr "" -#: ../../library/threading.rst:866 +#: ../../library/threading.rst:870 msgid "" "This is one of the oldest synchronization primitives in the history of " "computer science, invented by the early Dutch computer scientist Edsger W. " @@ -1182,7 +1192,7 @@ msgid "" "acquire` and :meth:`~Semaphore.release`)." msgstr "" -#: ../../library/threading.rst:871 +#: ../../library/threading.rst:875 msgid "" "A semaphore manages an internal counter which is decremented by each :meth:" "`~Semaphore.acquire` call and incremented by each :meth:`~Semaphore.release` " @@ -1191,12 +1201,12 @@ msgid "" "meth:`~Semaphore.release`." msgstr "" -#: ../../library/threading.rst:877 +#: ../../library/threading.rst:881 msgid "" "Semaphores also support the :ref:`context management protocol `." msgstr "" -#: ../../library/threading.rst:882 +#: ../../library/threading.rst:886 msgid "" "This class implements semaphore objects. A semaphore manages an atomic " "counter representing the number of :meth:`release` calls minus the number " @@ -1205,28 +1215,28 @@ msgid "" "If not given, *value* defaults to 1." msgstr "" -#: ../../library/threading.rst:888 +#: ../../library/threading.rst:892 msgid "" "The optional argument gives the initial *value* for the internal counter; it " "defaults to ``1``. If the *value* given is less than 0, :exc:`ValueError` is " "raised." msgstr "" -#: ../../library/threading.rst:897 +#: ../../library/threading.rst:901 msgid "Acquire a semaphore." msgstr "" -#: ../../library/threading.rst:899 +#: ../../library/threading.rst:903 msgid "When invoked without arguments:" msgstr "" -#: ../../library/threading.rst:901 +#: ../../library/threading.rst:905 msgid "" "If the internal counter is larger than zero on entry, decrement it by one " "and return ``True`` immediately." msgstr "" -#: ../../library/threading.rst:903 +#: ../../library/threading.rst:907 msgid "" "If the internal counter is zero on entry, block until awoken by a call to :" "meth:`~Semaphore.release`. Once awoken (and the counter is greater than 0), " @@ -1235,32 +1245,32 @@ msgid "" "threads are awoken should not be relied on." msgstr "" -#: ../../library/threading.rst:909 +#: ../../library/threading.rst:913 msgid "" "When invoked with *blocking* set to ``False``, do not block. If a call " "without an argument would block, return ``False`` immediately; otherwise, do " "the same thing as when called without arguments, and return ``True``." msgstr "" -#: ../../library/threading.rst:913 +#: ../../library/threading.rst:917 msgid "" "When invoked with a *timeout* other than ``None``, it will block for at most " "*timeout* seconds. If acquire does not complete successfully in that " "interval, return ``False``. Return ``True`` otherwise." msgstr "" -#: ../../library/threading.rst:922 +#: ../../library/threading.rst:926 msgid "" "Release a semaphore, incrementing the internal counter by *n*. When it was " "zero on entry and other threads are waiting for it to become larger than " "zero again, wake up *n* of those threads." msgstr "" -#: ../../library/threading.rst:926 +#: ../../library/threading.rst:930 msgid "Added the *n* parameter to release multiple waiting threads at once." msgstr "" -#: ../../library/threading.rst:932 +#: ../../library/threading.rst:936 msgid "" "Class implementing bounded semaphore objects. A bounded semaphore checks to " "make sure its current value doesn't exceed its initial value. If it does, :" @@ -1269,11 +1279,11 @@ msgid "" "times it's a sign of a bug. If not given, *value* defaults to 1." msgstr "" -#: ../../library/threading.rst:945 +#: ../../library/threading.rst:949 msgid ":class:`Semaphore` Example" msgstr ":class:`Semaphore` 範例" -#: ../../library/threading.rst:947 +#: ../../library/threading.rst:951 msgid "" "Semaphores are often used to guard resources with limited capacity, for " "example, a database server. In any situation where the size of the resource " @@ -1281,7 +1291,7 @@ msgid "" "threads, your main thread would initialize the semaphore::" msgstr "" -#: ../../library/threading.rst:952 +#: ../../library/threading.rst:956 msgid "" "maxconnections = 5\n" "# ...\n" @@ -1291,13 +1301,13 @@ msgstr "" "# ...\n" "pool_sema = BoundedSemaphore(value=maxconnections)" -#: ../../library/threading.rst:956 +#: ../../library/threading.rst:960 msgid "" "Once spawned, worker threads call the semaphore's acquire and release " "methods when they need to connect to the server::" msgstr "" -#: ../../library/threading.rst:959 +#: ../../library/threading.rst:963 msgid "" "with pool_sema:\n" " conn = connectdb()\n" @@ -1313,31 +1323,31 @@ msgstr "" " finally:\n" " conn.close()" -#: ../../library/threading.rst:966 +#: ../../library/threading.rst:970 msgid "" "The use of a bounded semaphore reduces the chance that a programming error " "which causes the semaphore to be released more than it's acquired will go " "undetected." msgstr "" -#: ../../library/threading.rst:973 +#: ../../library/threading.rst:977 msgid "Event Objects" msgstr "" -#: ../../library/threading.rst:975 +#: ../../library/threading.rst:979 msgid "" "This is one of the simplest mechanisms for communication between threads: " "one thread signals an event and other threads wait for it." msgstr "" -#: ../../library/threading.rst:978 +#: ../../library/threading.rst:982 msgid "" "An event object manages an internal flag that can be set to true with the :" "meth:`~Event.set` method and reset to false with the :meth:`~Event.clear` " "method. The :meth:`~Event.wait` method blocks until the flag is true." msgstr "" -#: ../../library/threading.rst:985 +#: ../../library/threading.rst:989 msgid "" "Class implementing event objects. An event manages a flag that can be set " "to true with the :meth:`~Event.set` method and reset to false with the :meth:" @@ -1345,29 +1355,29 @@ msgid "" "flag is initially false." msgstr "" -#: ../../library/threading.rst:995 +#: ../../library/threading.rst:999 msgid "Return ``True`` if and only if the internal flag is true." msgstr "" -#: ../../library/threading.rst:997 +#: ../../library/threading.rst:1001 msgid "The method ``isSet`` is a deprecated alias for this method." msgstr "" -#: ../../library/threading.rst:1001 +#: ../../library/threading.rst:1005 msgid "" "Set the internal flag to true. All threads waiting for it to become true are " "awakened. Threads that call :meth:`wait` once the flag is true will not " "block at all." msgstr "" -#: ../../library/threading.rst:1007 +#: ../../library/threading.rst:1011 msgid "" "Reset the internal flag to false. Subsequently, threads calling :meth:`wait` " "will block until :meth:`.set` is called to set the internal flag to true " "again." msgstr "" -#: ../../library/threading.rst:1013 +#: ../../library/threading.rst:1017 msgid "" "Block as long as the internal flag is false and the timeout, if given, has " "not expired. The return value represents the reason that this blocking " @@ -1376,18 +1386,18 @@ msgid "" "become true within the given wait time." msgstr "" -#: ../../library/threading.rst:1019 +#: ../../library/threading.rst:1023 msgid "" "When the timeout argument is present and not ``None``, it should be a " "floating-point number specifying a timeout for the operation in seconds, or " "fractions thereof." msgstr "" -#: ../../library/threading.rst:1030 +#: ../../library/threading.rst:1034 msgid "Timer Objects" msgstr "" -#: ../../library/threading.rst:1032 +#: ../../library/threading.rst:1036 msgid "" "This class represents an action that should be run only after a certain " "amount of time has passed --- a timer. :class:`Timer` is a subclass of :" @@ -1395,7 +1405,7 @@ msgid "" "threads." msgstr "" -#: ../../library/threading.rst:1036 +#: ../../library/threading.rst:1040 msgid "" "Timers are started, as with threads, by calling their :meth:`Timer.start " "` method. The timer can be stopped (before its action has " @@ -1404,11 +1414,11 @@ msgid "" "interval specified by the user." msgstr "" -#: ../../library/threading.rst:1042 +#: ../../library/threading.rst:1046 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/threading.rst:1044 +#: ../../library/threading.rst:1048 msgid "" "def hello():\n" " print(\"hello, world\")\n" @@ -1422,7 +1432,7 @@ msgstr "" "t = Timer(30.0, hello)\n" "t.start() # 30 秒後會印出 \"hello, world\"" -#: ../../library/threading.rst:1053 +#: ../../library/threading.rst:1057 msgid "" "Create a timer that will run *function* with arguments *args* and keyword " "arguments *kwargs*, after *interval* seconds have passed. If *args* is " @@ -1430,17 +1440,17 @@ msgid "" "``None`` (the default) then an empty dict will be used." msgstr "" -#: ../../library/threading.rst:1063 +#: ../../library/threading.rst:1067 msgid "" "Stop the timer, and cancel the execution of the timer's action. This will " "only work if the timer is still in its waiting stage." msgstr "" -#: ../../library/threading.rst:1068 +#: ../../library/threading.rst:1072 msgid "Barrier Objects" msgstr "" -#: ../../library/threading.rst:1072 +#: ../../library/threading.rst:1076 msgid "" "This class provides a simple synchronization primitive for use by a fixed " "number of threads that need to wait for each other. Each of the threads " @@ -1449,18 +1459,18 @@ msgid "" "calls. At this point, the threads are released simultaneously." msgstr "" -#: ../../library/threading.rst:1078 +#: ../../library/threading.rst:1082 msgid "" "The barrier can be reused any number of times for the same number of threads." msgstr "" -#: ../../library/threading.rst:1080 +#: ../../library/threading.rst:1084 msgid "" "As an example, here is a simple way to synchronize a client and server " "thread::" msgstr "" -#: ../../library/threading.rst:1082 +#: ../../library/threading.rst:1086 msgid "" "b = Barrier(2, timeout=5)\n" "\n" @@ -1492,7 +1502,7 @@ msgstr "" " connection = make_connection()\n" " process_client_connection(connection)" -#: ../../library/threading.rst:1100 +#: ../../library/threading.rst:1104 msgid "" "Create a barrier object for *parties* number of threads. An *action*, when " "provided, is a callable to be called by one of the threads when they are " @@ -1500,7 +1510,7 @@ msgid "" "the :meth:`wait` method." msgstr "" -#: ../../library/threading.rst:1107 +#: ../../library/threading.rst:1111 msgid "" "Pass the barrier. When all the threads party to the barrier have called " "this function, they are all released simultaneously. If a *timeout* is " @@ -1508,14 +1518,14 @@ msgid "" "constructor." msgstr "" -#: ../../library/threading.rst:1112 +#: ../../library/threading.rst:1116 msgid "" "The return value is an integer in the range 0 to *parties* -- 1, different " "for each thread. This can be used to select a thread to do some special " "housekeeping, e.g.::" msgstr "" -#: ../../library/threading.rst:1116 +#: ../../library/threading.rst:1120 msgid "" "i = barrier.wait()\n" "if i == 0:\n" @@ -1527,37 +1537,37 @@ msgstr "" " # 只會有一個執行緒會印出這個\n" " print(\"passed the barrier\")" -#: ../../library/threading.rst:1121 +#: ../../library/threading.rst:1125 msgid "" "If an *action* was provided to the constructor, one of the threads will have " "called it prior to being released. Should this call raise an error, the " "barrier is put into the broken state." msgstr "" -#: ../../library/threading.rst:1125 +#: ../../library/threading.rst:1129 msgid "If the call times out, the barrier is put into the broken state." msgstr "" -#: ../../library/threading.rst:1127 +#: ../../library/threading.rst:1131 msgid "" "This method may raise a :class:`BrokenBarrierError` exception if the barrier " "is broken or reset while a thread is waiting." msgstr "" -#: ../../library/threading.rst:1132 +#: ../../library/threading.rst:1136 msgid "" "Return the barrier to the default, empty state. Any threads waiting on it " "will receive the :class:`BrokenBarrierError` exception." msgstr "" -#: ../../library/threading.rst:1135 +#: ../../library/threading.rst:1139 msgid "" "Note that using this function may require some external synchronization if " "there are other threads whose state is unknown. If a barrier is broken it " "may be better to just leave it and create a new one." msgstr "" -#: ../../library/threading.rst:1141 +#: ../../library/threading.rst:1145 msgid "" "Put the barrier into a broken state. This causes any active or future calls " "to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use this for " @@ -1565,36 +1575,36 @@ msgid "" "application." msgstr "" -#: ../../library/threading.rst:1146 +#: ../../library/threading.rst:1150 msgid "" "It may be preferable to simply create the barrier with a sensible *timeout* " "value to automatically guard against one of the threads going awry." msgstr "" -#: ../../library/threading.rst:1152 +#: ../../library/threading.rst:1156 msgid "The number of threads required to pass the barrier." msgstr "" -#: ../../library/threading.rst:1156 +#: ../../library/threading.rst:1160 msgid "The number of threads currently waiting in the barrier." msgstr "" -#: ../../library/threading.rst:1160 +#: ../../library/threading.rst:1164 msgid "A boolean that is ``True`` if the barrier is in the broken state." msgstr "" -#: ../../library/threading.rst:1165 +#: ../../library/threading.rst:1169 msgid "" "This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:" "`Barrier` object is reset or broken." msgstr "" -#: ../../library/threading.rst:1172 +#: ../../library/threading.rst:1176 msgid "" "Using locks, conditions, and semaphores in the :keyword:`!with` statement" msgstr "" -#: ../../library/threading.rst:1174 +#: ../../library/threading.rst:1178 msgid "" "All of the objects provided by this module that have ``acquire`` and " "``release`` methods can be used as context managers for a :keyword:`with` " @@ -1603,7 +1613,7 @@ msgid "" "following snippet::" msgstr "" -#: ../../library/threading.rst:1180 +#: ../../library/threading.rst:1184 msgid "" "with some_lock:\n" " # do something..." @@ -1611,11 +1621,11 @@ msgstr "" "with some_lock:\n" " # 做某些事情..." -#: ../../library/threading.rst:1183 +#: ../../library/threading.rst:1187 msgid "is equivalent to::" msgstr "" -#: ../../library/threading.rst:1185 +#: ../../library/threading.rst:1189 msgid "" "some_lock.acquire()\n" "try:\n" @@ -1629,21 +1639,21 @@ msgstr "" "finally:\n" " some_lock.release()" -#: ../../library/threading.rst:1191 +#: ../../library/threading.rst:1195 msgid "" "Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`, :class:" "`Semaphore`, and :class:`BoundedSemaphore` objects may be used as :keyword:" "`with` statement context managers." msgstr "" -#: ../../library/threading.rst:155 ../../library/threading.rst:173 +#: ../../library/threading.rst:158 ../../library/threading.rst:176 msgid "trace function" msgstr "" -#: ../../library/threading.rst:173 +#: ../../library/threading.rst:176 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/threading.rst:184 ../../library/threading.rst:202 +#: ../../library/threading.rst:187 ../../library/threading.rst:205 msgid "profile function" msgstr "" diff --git a/library/time.po b/library/time.po index 5c2bb1a36f..8b03cadcce 100644 --- a/library/time.po +++ b/library/time.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-08-14 16:05+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -283,9 +283,9 @@ msgstr "" #: ../../library/time.rst:161 ../../library/time.rst:174 #: ../../library/time.rst:183 ../../library/time.rst:196 -#: ../../library/time.rst:205 ../../library/time.rst:716 -#: ../../library/time.rst:833 ../../library/time.rst:852 -#: ../../library/time.rst:880 ../../library/time.rst:915 +#: ../../library/time.rst:205 ../../library/time.rst:745 +#: ../../library/time.rst:862 ../../library/time.rst:890 +#: ../../library/time.rst:918 ../../library/time.rst:962 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" @@ -474,25 +474,51 @@ msgstr "" "示)。該時鐘不受系統時鐘更新的影響。回傳值的參考點沒有定義,因此只有兩次呼叫" "結果之間的差異才是有效的。" -#: ../../library/time.rst:290 +#: ../../library/time.rst:290 ../../library/time.rst:687 +msgid "Clock:" +msgstr "" + +#: ../../library/time.rst:292 +msgid "" +"On Windows, call ``QueryPerformanceCounter()`` and " +"``QueryPerformanceFrequency()``." +msgstr "" + +#: ../../library/time.rst:294 +msgid "On macOS, call ``mach_absolute_time()`` and ``mach_timebase_info()``." +msgstr "" + +#: ../../library/time.rst:295 +msgid "On HP-UX, call ``gethrtime()``." +msgstr "" + +#: ../../library/time.rst:296 +msgid "Call ``clock_gettime(CLOCK_HIGHRES)`` if available." +msgstr "" + +#: ../../library/time.rst:297 +msgid "Otherwise, call ``clock_gettime(CLOCK_MONOTONIC)``." +msgstr "" + +#: ../../library/time.rst:299 msgid "" "Use :func:`monotonic_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "使用 :func:`monotonic_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:295 +#: ../../library/time.rst:304 msgid "The function is now always available and always system-wide." msgstr "此函式現在始終可用且涵蓋整個系統。" -#: ../../library/time.rst:298 +#: ../../library/time.rst:307 msgid "On macOS, the function is now system-wide." msgstr "在 macOS 上,此函式現在涵蓋整個系統。" -#: ../../library/time.rst:304 +#: ../../library/time.rst:313 msgid "Similar to :func:`monotonic`, but return time as nanoseconds." msgstr "類似於 :func:`monotonic`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:313 +#: ../../library/time.rst:322 msgid "" "Return the value (in fractional seconds) of a performance counter, i.e. a " "clock with the highest available resolution to measure a short duration. It " @@ -504,22 +530,33 @@ msgstr "" "間隔的時鐘。它包括睡眠時經過的時間,並且涵蓋整個系統。回傳值的參考點沒有定" "義,因此只有兩次呼叫結果之間的差異才是有效的。" -#: ../../library/time.rst:319 +#: ../../library/time.rst:330 +msgid "" +"On CPython, use the same clock than :func:`time.monotonic` and is a " +"monotonic clock, i.e. a clock that cannot go backwards." +msgstr "" + +#: ../../library/time.rst:333 msgid "" "Use :func:`perf_counter_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" "使用 :func:`perf_counter_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:324 +#: ../../library/time.rst:338 msgid "On Windows, the function is now system-wide." msgstr "在 Windows 上,此函式現在涵蓋整個系統。" -#: ../../library/time.rst:329 +#: ../../library/time.rst:341 +#, fuzzy +msgid "Use the same clock than :func:`time.monotonic`." +msgstr "``'monotonic'``::func:`time.monotonic`" + +#: ../../library/time.rst:347 msgid "Similar to :func:`perf_counter`, but return time as nanoseconds." msgstr "類似於 :func:`perf_counter`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:341 +#: ../../library/time.rst:359 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current process. It does not include time elapsed during " @@ -531,18 +568,18 @@ msgstr "" "經過的時間。根據定義,它涵蓋整個行程。回傳值的參考點沒有定義,因此只有兩次呼" "叫結果之間的差異才是有效的。" -#: ../../library/time.rst:347 +#: ../../library/time.rst:365 msgid "" "Use :func:`process_time_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" "使用 :func:`process_time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:354 +#: ../../library/time.rst:372 msgid "Similar to :func:`process_time` but return time as nanoseconds." msgstr "類似於 :func:`process_time`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:360 +#: ../../library/time.rst:378 msgid "" "Suspend execution of the calling thread for the given number of seconds. The " "argument may be a floating-point number to indicate a more precise sleep " @@ -551,7 +588,7 @@ msgstr "" "在一個給定的秒數內暫停呼叫執行緒 (calling thread) 的執行。引數可以是浮點數," "以表示更精確的睡眠時間。" -#: ../../library/time.rst:364 +#: ../../library/time.rst:382 msgid "" "If the sleep is interrupted by a signal and no exception is raised by the " "signal handler, the sleep is restarted with a recomputed timeout." @@ -559,13 +596,13 @@ msgstr "" "如果睡眠被訊號中斷且訊號處理器未引發例外,則睡眠將以重新計算過的逾時 " "(timeout) 重新開始。" -#: ../../library/time.rst:367 +#: ../../library/time.rst:385 msgid "" "The suspension time may be longer than requested by an arbitrary amount, " "because of the scheduling of other activity in the system." msgstr "由於系統中其他活動的調度,暫停時間可能會比請求的時間長任意的量。" -#: ../../library/time.rst:370 +#: ../../library/time.rst:388 msgid "" "On Windows, if *secs* is zero, the thread relinquishes the remainder of its " "time slice to any other thread that is ready to run. If there are no other " @@ -581,23 +618,29 @@ msgstr "" "docs.microsoft.com/en-us/windows-hardware/drivers/kernel/high-resolution-" "timers>`_,其解析度為 100 奈秒。如果 *secs* 為零,則使用 ``Sleep(0)``。" -#: ../../library/time.rst:378 +#: ../../library/time.rst:396 msgid "Unix implementation:" msgstr "Unix 實作:" -#: ../../library/time.rst:380 +#: ../../library/time.rst:398 msgid "Use ``clock_nanosleep()`` if available (resolution: 1 nanosecond);" msgstr "如果可以,使用 ``clock_nanosleep()``\\ (解析度:1 奈秒);" -#: ../../library/time.rst:381 +#: ../../library/time.rst:399 msgid "Or use ``nanosleep()`` if available (resolution: 1 nanosecond);" msgstr "或者使用 ``nanosleep()``\\ (解析度:1 奈秒);" -#: ../../library/time.rst:382 +#: ../../library/time.rst:400 msgid "Or use ``select()`` (resolution: 1 microsecond)." msgstr "或使用 ``select()``\\ (解析度:1 微秒)。" -#: ../../library/time.rst:384 +#: ../../library/time.rst:402 +msgid "" +"Raises an :ref:`auditing event ` ``time.sleep`` with argument " +"``secs``." +msgstr "" + +#: ../../library/time.rst:404 msgid "" "The function now sleeps at least *secs* even if the sleep is interrupted by " "a signal, except if the signal handler raises an exception (see :pep:`475` " @@ -606,7 +649,7 @@ msgstr "" "即使睡眠被訊號中斷,此函式現在至少還是會睡眠 *secs*,除非訊號處理器引發例外" "(理由請參閱 :pep:`475`)。" -#: ../../library/time.rst:389 +#: ../../library/time.rst:409 msgid "" "On Unix, the ``clock_nanosleep()`` and ``nanosleep()`` functions are now " "used if available. On Windows, a waitable timer is now used." @@ -614,7 +657,11 @@ msgstr "" "在 Unix 上,如果可以的話現在會使用 ``clock_nanosleep()`` 和 ``nanosleep()`` " "函式。在 Windows 上,現在使用可等待的計時器。" -#: ../../library/time.rst:398 +#: ../../library/time.rst:413 +msgid "Raises an auditing event." +msgstr "" + +#: ../../library/time.rst:421 msgid "" "Convert a tuple or :class:`struct_time` representing a time as returned by :" "func:`gmtime` or :func:`localtime` to a string as specified by the *format* " @@ -627,7 +674,7 @@ msgstr "" "func:`localtime` 回傳的當前時間。*format* 必須是一個字串。如果 *t* 中的任何欄" "位超出允許範圍,將會引發 :exc:`ValueError`。" -#: ../../library/time.rst:404 +#: ../../library/time.rst:427 msgid "" "0 is a legal argument for any position in the time tuple; if it is normally " "illegal the value is forced to a correct one." @@ -635,7 +682,7 @@ msgstr "" "0 在時間元組中的任何位置都是合法引數;如果元組中出現常見的錯誤,該值將被強制" "更改為正確的值。" -#: ../../library/time.rst:407 +#: ../../library/time.rst:430 msgid "" "The following directives can be embedded in the *format* string. They are " "shown without the optional field width and precision specification, and are " @@ -644,151 +691,151 @@ msgstr "" "以下指令可以嵌入在 *format* 字串中。它們顯示時不帶可選的欄位寬度和精度規範," "並在 :func:`strftime` 的結果中被標示的字元替換:" -#: ../../library/time.rst:412 +#: ../../library/time.rst:435 msgid "Directive" msgstr "指令" -#: ../../library/time.rst:412 +#: ../../library/time.rst:435 msgid "Meaning" msgstr "意義" -#: ../../library/time.rst:412 +#: ../../library/time.rst:435 msgid "Notes" msgstr "註解" -#: ../../library/time.rst:414 +#: ../../library/time.rst:437 msgid "``%a``" msgstr "``%a``" -#: ../../library/time.rst:414 +#: ../../library/time.rst:437 msgid "Locale's abbreviated weekday name." msgstr "區域設定的週間日 (weekday) 縮寫名稱。" -#: ../../library/time.rst:417 +#: ../../library/time.rst:440 msgid "``%A``" msgstr "``%A``" -#: ../../library/time.rst:417 +#: ../../library/time.rst:440 msgid "Locale's full weekday name." msgstr "區域設定的完整週間日名稱。" -#: ../../library/time.rst:419 +#: ../../library/time.rst:442 msgid "``%b``" msgstr "``%b``" -#: ../../library/time.rst:419 +#: ../../library/time.rst:442 msgid "Locale's abbreviated month name." msgstr "區域設定的縮寫月份名稱。" -#: ../../library/time.rst:422 +#: ../../library/time.rst:445 msgid "``%B``" msgstr "``%B``" -#: ../../library/time.rst:422 +#: ../../library/time.rst:445 msgid "Locale's full month name." msgstr "區域設定的完整月份名稱。" -#: ../../library/time.rst:424 +#: ../../library/time.rst:447 msgid "``%c``" msgstr "``%c``" -#: ../../library/time.rst:424 +#: ../../library/time.rst:447 msgid "Locale's appropriate date and time representation." msgstr "區域設定的合適的日期和時間的表示法。" -#: ../../library/time.rst:427 +#: ../../library/time.rst:450 msgid "``%d``" msgstr "``%d``" -#: ../../library/time.rst:427 +#: ../../library/time.rst:450 msgid "Day of the month as a decimal number [01,31]." msgstr "月份中的日期,表示為十進位數 [01,31]。" -#: ../../library/time.rst:430 +#: ../../library/time.rst:453 msgid "``%f``" msgstr "``%f``" -#: ../../library/time.rst:430 +#: ../../library/time.rst:453 msgid "Microseconds as a decimal number" msgstr "微秒,表示為十進位數" -#: ../../library/time.rst:431 +#: ../../library/time.rst:454 msgid "[000000,999999]." msgstr "[000000,999999]。" -#: ../../library/time.rst:430 +#: ../../library/time.rst:453 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/time.rst:434 +#: ../../library/time.rst:457 msgid "``%H``" msgstr "``%H``" -#: ../../library/time.rst:434 +#: ../../library/time.rst:457 msgid "Hour (24-hour clock) as a decimal number [00,23]." msgstr "小時(24 小時制),表示為十進位數 [00,23]。" -#: ../../library/time.rst:437 +#: ../../library/time.rst:460 msgid "``%I``" msgstr "``%I``" -#: ../../library/time.rst:437 +#: ../../library/time.rst:460 msgid "Hour (12-hour clock) as a decimal number [01,12]." msgstr "小時(12 小時制),表示為十進位數 [01,12]。" -#: ../../library/time.rst:440 +#: ../../library/time.rst:463 msgid "``%j``" msgstr "``%j``" -#: ../../library/time.rst:440 +#: ../../library/time.rst:463 msgid "Day of the year as a decimal number [001,366]." msgstr "一年中的第幾天,表示為十進位數 [001,366]。" -#: ../../library/time.rst:443 +#: ../../library/time.rst:466 msgid "``%m``" msgstr "``%m``" -#: ../../library/time.rst:443 +#: ../../library/time.rst:466 msgid "Month as a decimal number [01,12]." msgstr "月份,表示為十進位數 [01,12]。" -#: ../../library/time.rst:446 +#: ../../library/time.rst:469 msgid "``%M``" msgstr "``%M``" -#: ../../library/time.rst:446 +#: ../../library/time.rst:469 msgid "Minute as a decimal number [00,59]." msgstr "分鐘,表示為十進位數 [00,59]。" -#: ../../library/time.rst:449 +#: ../../library/time.rst:472 msgid "``%p``" msgstr "``%p``" -#: ../../library/time.rst:449 +#: ../../library/time.rst:472 msgid "Locale's equivalent of either AM or PM." msgstr "區域設定中相當於 AM 或 PM 的表示。" -#: ../../library/time.rst:449 +#: ../../library/time.rst:472 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/time.rst:452 +#: ../../library/time.rst:475 msgid "``%S``" msgstr "``%S``" -#: ../../library/time.rst:452 +#: ../../library/time.rst:475 msgid "Second as a decimal number [00,61]." msgstr "秒,表示為十進位數 [00,61]。" -#: ../../library/time.rst:452 +#: ../../library/time.rst:475 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/time.rst:455 +#: ../../library/time.rst:478 msgid "``%U``" msgstr "``%U``" -#: ../../library/time.rst:455 +#: ../../library/time.rst:478 msgid "" "Week number of the year (Sunday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Sunday are " @@ -797,23 +844,23 @@ msgstr "" "一年中的週數(星期天作為一週的第一天),表示為十進位數 [00,53]。新的一年中," "在第一個星期天之前的所有日子都被認定為第 0 週。" -#: ../../library/time.rst:455 ../../library/time.rst:466 +#: ../../library/time.rst:478 ../../library/time.rst:489 msgid "\\(4)" msgstr "\\(4)" -#: ../../library/time.rst:463 +#: ../../library/time.rst:486 msgid "``%w``" msgstr "``%w``" -#: ../../library/time.rst:463 +#: ../../library/time.rst:486 msgid "Weekday as a decimal number [0(Sunday),6]." msgstr "週間日,表示為十進位數 [0(星期天),6]。" -#: ../../library/time.rst:466 +#: ../../library/time.rst:489 msgid "``%W``" msgstr "``%W``" -#: ../../library/time.rst:466 +#: ../../library/time.rst:489 msgid "" "Week number of the year (Monday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Monday are " @@ -822,43 +869,43 @@ msgstr "" "一年中的週數(星期一作為一週的第一天),表示為十進位數 [00,53]。新的一年中," "在第一個星期一之前的所有日子都被認定為第 0 週。" -#: ../../library/time.rst:474 +#: ../../library/time.rst:497 msgid "``%x``" msgstr "``%x``" -#: ../../library/time.rst:474 +#: ../../library/time.rst:497 msgid "Locale's appropriate date representation." msgstr "區域設定的合適的日期表示法。" -#: ../../library/time.rst:477 +#: ../../library/time.rst:500 msgid "``%X``" msgstr "``%X``" -#: ../../library/time.rst:477 +#: ../../library/time.rst:500 msgid "Locale's appropriate time representation." msgstr "區域設定的合適的時間表示法。" -#: ../../library/time.rst:480 +#: ../../library/time.rst:503 msgid "``%y``" msgstr "``%y``" -#: ../../library/time.rst:480 +#: ../../library/time.rst:503 msgid "Year without century as a decimal number [00,99]." msgstr "去掉世紀的年份,表示為十進位數 [00,99]。" -#: ../../library/time.rst:483 +#: ../../library/time.rst:506 msgid "``%Y``" msgstr "``%Y``" -#: ../../library/time.rst:483 +#: ../../library/time.rst:506 msgid "Year with century as a decimal number." msgstr "帶世紀的年份,表示為十進位數。" -#: ../../library/time.rst:486 +#: ../../library/time.rst:509 msgid "``%z``" msgstr "``%z``" -#: ../../library/time.rst:486 +#: ../../library/time.rst:509 msgid "" "Time zone offset indicating a positive or negative time difference from UTC/" "GMT of the form +HHMM or -HHMM, where H represents decimal hour digits and M " @@ -867,27 +914,27 @@ msgstr "" "時區偏移量,表示與 UTC/GMT 的正或負時間差,形式為 +HHMM 或 -HHMM,其中 H 代表" "十進位的小時數碼 (digits),M 代表十進位的分鐘數碼 [-23:59, +23:59]。 [1]_" -#: ../../library/time.rst:492 +#: ../../library/time.rst:515 msgid "``%Z``" msgstr "``%Z``" -#: ../../library/time.rst:492 +#: ../../library/time.rst:515 msgid "Time zone name (no characters if no time zone exists). Deprecated. [1]_" msgstr "時區名稱(如果不存在時區,則無字元)。已被棄用。 [1]_" -#: ../../library/time.rst:495 +#: ../../library/time.rst:518 msgid "``%%``" msgstr "``%%``" -#: ../../library/time.rst:495 +#: ../../library/time.rst:518 msgid "A literal ``'%'`` character." msgstr "字面意義上的 ``'%'`` 字元。" -#: ../../library/time.rst:498 +#: ../../library/time.rst:521 msgid "Notes:" msgstr "註解:" -#: ../../library/time.rst:501 +#: ../../library/time.rst:524 msgid "" "The ``%f`` format directive only applies to :func:`strptime`, not to :func:" "`strftime`. However, see also :meth:`datetime.datetime.strptime` and :meth:" @@ -898,7 +945,7 @@ msgstr "" "在 :meth:`datetime.datetime.strptime` 和 :meth:`datetime.datetime.strftime` " "其中的 ``%f`` 格式的指令\\ :ref:`適用於微秒 `。" -#: ../../library/time.rst:507 +#: ../../library/time.rst:530 msgid "" "When used with the :func:`strptime` function, the ``%p`` directive only " "affects the output hour field if the ``%I`` directive is used to parse the " @@ -907,7 +954,7 @@ msgstr "" "當與 :func:`strptime` 函式一起使用時,``%p`` 指令僅在使用 ``%I`` 指令剖析小時" "時影響輸出小時的欄位。" -#: ../../library/time.rst:513 +#: ../../library/time.rst:536 msgid "" "The range really is ``0`` to ``61``; value ``60`` is valid in timestamps " "representing `leap seconds`_ and value ``61`` is supported for historical " @@ -916,7 +963,7 @@ msgstr "" "範圍確實是從 ``0`` 到 ``61``;數值 ``60`` 在表示 `leap seconds`_ 的時間戳中是" "有效的,而數值 ``61`` 是出於歷史因素而被支援。" -#: ../../library/time.rst:518 +#: ../../library/time.rst:541 msgid "" "When used with the :func:`strptime` function, ``%U`` and ``%W`` are only " "used in calculations when the day of the week and the year are specified." @@ -924,7 +971,7 @@ msgstr "" "當與 :func:`strptime` 函式一起使用時,``%U`` 和 ``%W`` 僅在指定週間的某天和年" "份時用於計算中。" -#: ../../library/time.rst:521 +#: ../../library/time.rst:544 msgid "" "Here is an example, a format for dates compatible with that specified in " "the :rfc:`2822` Internet email standard. [1]_ ::" @@ -932,7 +979,7 @@ msgstr "" "以下是一個範例,其為一種與 :rfc:`2822` 網際網路電子郵件標準中指定的日期格式兼" "容的格式。 [1]_: ::" -#: ../../library/time.rst:524 +#: ../../library/time.rst:547 msgid "" ">>> from time import gmtime, strftime\n" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" @@ -942,7 +989,7 @@ msgstr "" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" "'Thu, 28 Jun 2001 14:17:15 +0000'" -#: ../../library/time.rst:528 +#: ../../library/time.rst:551 msgid "" "Additional directives may be supported on certain platforms, but only the " "ones listed here have a meaning standardized by ANSI C. To see the full set " @@ -952,7 +999,7 @@ msgstr "" "某些平台可能支援額外的指令,但只有這裡列出的指令具有 ANSI C 標準化的意義。要" "查看你的平台上支援的完整格式碼集,請參閱 :manpage:`strftime(3)` 文件。" -#: ../../library/time.rst:533 +#: ../../library/time.rst:556 msgid "" "On some platforms, an optional field width and precision specification can " "immediately follow the initial ``'%'`` of a directive in the following " @@ -962,7 +1009,7 @@ msgstr "" "在某些平台上,可選的欄位寬度和精度規範可以以此順序緊跟在指令初始的 ``'%'`` 之" "後;這也是不可攜 (portable) 的。欄位寬度通常為 2,除了 ``%j`` 為 3。" -#: ../../library/time.rst:544 +#: ../../library/time.rst:567 msgid "" "Parse a string representing a time according to a format. The return value " "is a :class:`struct_time` as returned by :func:`gmtime` or :func:`localtime`." @@ -970,7 +1017,7 @@ msgstr "" "根據格式剖析表示時間的字串。回傳值是 :class:`struct_time`,如同由 :func:" "`gmtime` 或 :func:`localtime` 回傳的一樣。" -#: ../../library/time.rst:548 +#: ../../library/time.rst:571 msgid "" "The *format* parameter uses the same directives as those used by :func:" "`strftime`; it defaults to ``\"%a %b %d %H:%M:%S %Y\"`` which matches the " @@ -986,11 +1033,11 @@ msgstr "" "時,用來填充任何缺失資料的預設值為 ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)``。" "*string* 和 *format* 都必須是字串。" -#: ../../library/time.rst:556 +#: ../../library/time.rst:579 msgid "For example:" msgstr "例如:" -#: ../../library/time.rst:563 +#: ../../library/time.rst:586 msgid "" "Support for the ``%Z`` directive is based on the values contained in " "``tzname`` and whether ``daylight`` is true. Because of this, it is " @@ -1001,7 +1048,7 @@ msgstr "" "因此,除了識別始終已知的 UTC 和 GMT(且被考慮為非日光節約時區)外,這是特定於" "平台的。" -#: ../../library/time.rst:568 +#: ../../library/time.rst:591 msgid "" "Only the directives specified in the documentation are supported. Because " "``strftime()`` is implemented per platform it can sometimes offer more " @@ -1013,7 +1060,7 @@ msgstr "" "提供比列出的還要更多的指令。但是 ``strptime()`` 與任何平台無關,因此不一定支" "援所有未記載為支援的指令。" -#: ../../library/time.rst:577 +#: ../../library/time.rst:600 msgid "" "The type of the time value sequence returned by :func:`gmtime`, :func:" "`localtime`, and :func:`strptime`. It is an object with a :term:`named " @@ -1024,110 +1071,110 @@ msgstr "" "別。它是一個具有 :term:`named tuple` 介面的物件:值可以通過索引和屬性名稱存" "取。包含以下值:" -#: ../../library/time.rst:584 +#: ../../library/time.rst:607 msgid "Index" msgstr "索引" -#: ../../library/time.rst:585 +#: ../../library/time.rst:608 msgid "Attribute" msgstr "屬性" -#: ../../library/time.rst:586 +#: ../../library/time.rst:609 msgid "Values" msgstr "值" -#: ../../library/time.rst:588 +#: ../../library/time.rst:611 msgid "0" msgstr "0" -#: ../../library/time.rst:590 +#: ../../library/time.rst:613 msgid "(for example, 1993)" msgstr "(例如 1993)" -#: ../../library/time.rst:592 +#: ../../library/time.rst:615 msgid "1" msgstr "1" -#: ../../library/time.rst:594 +#: ../../library/time.rst:617 msgid "range [1, 12]" msgstr "範圍 [1, 12]" -#: ../../library/time.rst:596 +#: ../../library/time.rst:619 msgid "2" msgstr "2" -#: ../../library/time.rst:598 +#: ../../library/time.rst:621 msgid "range [1, 31]" msgstr "範圍 [1, 31]" -#: ../../library/time.rst:600 +#: ../../library/time.rst:623 msgid "3" msgstr "3" -#: ../../library/time.rst:602 +#: ../../library/time.rst:625 msgid "range [0, 23]" msgstr "範圍 [0, 23]" -#: ../../library/time.rst:604 +#: ../../library/time.rst:627 msgid "4" msgstr "4" -#: ../../library/time.rst:606 +#: ../../library/time.rst:629 msgid "range [0, 59]" msgstr "範圍 [0, 59]" -#: ../../library/time.rst:608 +#: ../../library/time.rst:631 msgid "5" msgstr "5" -#: ../../library/time.rst:610 +#: ../../library/time.rst:633 msgid "range [0, 61]; see :ref:`Note (2) ` in :func:`strftime`" msgstr "" "範圍 [0, 61];參見 :func:`strftime` 中的\\ :ref:`註釋 (2) `" -#: ../../library/time.rst:612 +#: ../../library/time.rst:635 msgid "6" msgstr "6" -#: ../../library/time.rst:614 +#: ../../library/time.rst:637 msgid "range [0, 6]; Monday is 0" msgstr "範圍 [0, 6];星期一是 0" -#: ../../library/time.rst:616 +#: ../../library/time.rst:639 msgid "7" msgstr "7" -#: ../../library/time.rst:618 +#: ../../library/time.rst:641 msgid "range [1, 366]" msgstr "範圍 [1, 366]" -#: ../../library/time.rst:620 +#: ../../library/time.rst:643 msgid "8" msgstr "8" -#: ../../library/time.rst:622 +#: ../../library/time.rst:645 msgid "0, 1 or -1; see below" msgstr "0、1 或 -1;見下文" -#: ../../library/time.rst:624 ../../library/time.rst:628 +#: ../../library/time.rst:647 ../../library/time.rst:651 msgid "N/A" msgstr "N/A" -#: ../../library/time.rst:626 +#: ../../library/time.rst:649 msgid "abbreviation of timezone name" msgstr "時區名稱的縮寫" -#: ../../library/time.rst:630 +#: ../../library/time.rst:653 msgid "offset east of UTC in seconds" msgstr "UTC 向東的偏移量(以秒為單位)" -#: ../../library/time.rst:632 +#: ../../library/time.rst:655 msgid "" "Note that unlike the C structure, the month value is a range of [1, 12], not " "[0, 11]." msgstr "請注意,與 C 結構不同,月份值的範圍是 [1, 12],而不是 [0, 11]。" -#: ../../library/time.rst:635 +#: ../../library/time.rst:658 msgid "" "In calls to :func:`mktime`, :attr:`tm_isdst` may be set to 1 when daylight " "savings time is in effect, and 0 when it is not. A value of -1 indicates " @@ -1137,7 +1184,7 @@ msgstr "" "在呼叫 :func:`mktime` 時,當日光節約時間生效的時候,:attr:`tm_isdst` 可以設定" "為 1,不生效時設定為 0。值 -1 表示未知是否生效,通常結果會填入正確的狀態。" -#: ../../library/time.rst:639 +#: ../../library/time.rst:662 msgid "" "When a tuple with an incorrect length is passed to a function expecting a :" "class:`struct_time`, or having elements of the wrong type, a :exc:" @@ -1146,7 +1193,7 @@ msgstr "" "當一個長度不正確的元組被傳遞給預期得到 :class:`struct_time` 的函式時,或者其" "中有元素型別錯誤時,將引發 :exc:`TypeError`。" -#: ../../library/time.rst:645 +#: ../../library/time.rst:668 msgid "" "Return the time in seconds since the epoch_ as a floating-point number. The " "handling of `leap seconds`_ is platform dependent. On Windows and most Unix " @@ -1158,7 +1205,7 @@ msgstr "" "關的。在 Windows 和大多數 Unix 系統上,閏秒不計入自 epoch_ 起的秒數中。這通常" "被稱為 `Unix 時間 `_。" -#: ../../library/time.rst:651 +#: ../../library/time.rst:674 msgid "" "Note that even though the time is always returned as a floating-point " "number, not all systems provide time with a better precision than 1 second. " @@ -1170,7 +1217,7 @@ msgstr "" "間。雖然此函式通常回傳非遞減的值,但如果在兩次呼叫之間系統時鐘被回調,則它可" "能回傳比之前呼叫更小的值。" -#: ../../library/time.rst:657 +#: ../../library/time.rst:680 msgid "" "The number returned by :func:`.time` may be converted into a more common " "time format (i.e. year, month, day, hour, etc...) in UTC by passing it to :" @@ -1184,19 +1231,31 @@ msgstr "" "為當地時間。在這兩種情況下都會回傳一個 :class:`struct_time` 物件,從中可以作" "為屬性存取日曆日期的組成部分。" -#: ../../library/time.rst:664 +#: ../../library/time.rst:689 +msgid "On Windows, call ``GetSystemTimeAsFileTime()``." +msgstr "" + +#: ../../library/time.rst:690 +msgid "Call ``clock_gettime(CLOCK_REALTIME)`` if available." +msgstr "" + +#: ../../library/time.rst:691 +msgid "Otherwise, call ``gettimeofday()``." +msgstr "" + +#: ../../library/time.rst:693 msgid "" "Use :func:`time_ns` to avoid the precision loss caused by the :class:`float` " "type." msgstr "使用 :func:`time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:670 +#: ../../library/time.rst:699 msgid "" "Similar to :func:`~time.time` but returns time as an integer number of " "nanoseconds since the epoch_." msgstr "類似於 :func:`~time.time`,但回傳自 epoch_ 起的以奈秒為單位的整數。" -#: ../../library/time.rst:683 +#: ../../library/time.rst:712 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current thread. It does not include time elapsed during " @@ -1205,25 +1264,25 @@ msgid "" "of two calls in the same thread is valid." msgstr "" -#: ../../library/time.rst:689 +#: ../../library/time.rst:718 msgid "" "Use :func:`thread_time_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" -#: ../../library/time.rst:692 +#: ../../library/time.rst:721 msgid ":ref:`Availability `: Linux, Unix, Windows." msgstr ":ref:`適用 `:Linux、Unix、Windows。" -#: ../../library/time.rst:694 +#: ../../library/time.rst:723 msgid "Unix systems supporting ``CLOCK_THREAD_CPUTIME_ID``." msgstr "" -#: ../../library/time.rst:701 +#: ../../library/time.rst:730 msgid "Similar to :func:`thread_time` but return time as nanoseconds." msgstr "" -#: ../../library/time.rst:708 +#: ../../library/time.rst:737 msgid "" "Reset the time conversion rules used by the library routines. The " "environment variable :envvar:`TZ` specifies how this is done. It will also " @@ -1234,46 +1293,46 @@ msgid "" "when daylight saving time applies)." msgstr "" -#: ../../library/time.rst:720 +#: ../../library/time.rst:749 msgid "" "Although in many cases, changing the :envvar:`TZ` environment variable may " "affect the output of functions like :func:`localtime` without calling :func:" "`tzset`, this behavior should not be relied on." msgstr "" -#: ../../library/time.rst:724 +#: ../../library/time.rst:753 msgid "The :envvar:`TZ` environment variable should contain no whitespace." msgstr "" -#: ../../library/time.rst:726 +#: ../../library/time.rst:755 msgid "" "The standard format of the :envvar:`TZ` environment variable is (whitespace " "added for clarity)::" msgstr "" -#: ../../library/time.rst:729 +#: ../../library/time.rst:758 msgid "std offset [dst [offset [,start[/time], end[/time]]]]" msgstr "std offset [dst [offset [,start[/time], end[/time]]]]" -#: ../../library/time.rst:731 +#: ../../library/time.rst:760 msgid "Where the components are:" msgstr "" -#: ../../library/time.rst:733 +#: ../../library/time.rst:762 msgid "``std`` and ``dst``" msgstr "``std`` 和 ``dst``" -#: ../../library/time.rst:734 +#: ../../library/time.rst:763 msgid "" "Three or more alphanumerics giving the timezone abbreviations. These will be " "propagated into time.tzname" msgstr "" -#: ../../library/time.rst:737 +#: ../../library/time.rst:766 msgid "``offset``" msgstr "``offset``" -#: ../../library/time.rst:738 +#: ../../library/time.rst:767 msgid "" "The offset has the form: ``± hh[:mm[:ss]]``. This indicates the value added " "the local time to arrive at UTC. If preceded by a '-', the timezone is east " @@ -1281,41 +1340,41 @@ msgid "" "summer time is assumed to be one hour ahead of standard time." msgstr "" -#: ../../library/time.rst:743 +#: ../../library/time.rst:772 msgid "``start[/time], end[/time]``" msgstr "``start[/time], end[/time]``" -#: ../../library/time.rst:744 +#: ../../library/time.rst:773 msgid "" "Indicates when to change to and back from DST. The format of the start and " "end dates are one of the following:" msgstr "" -#: ../../library/time.rst:747 +#: ../../library/time.rst:776 msgid ":samp:`J{n}`" msgstr ":samp:`J{n}`" -#: ../../library/time.rst:748 +#: ../../library/time.rst:777 msgid "" "The Julian day *n* (1 <= *n* <= 365). Leap days are not counted, so in all " "years February 28 is day 59 and March 1 is day 60." msgstr "" -#: ../../library/time.rst:751 +#: ../../library/time.rst:780 msgid ":samp:`{n}`" msgstr ":samp:`{n}`" -#: ../../library/time.rst:752 +#: ../../library/time.rst:781 msgid "" "The zero-based Julian day (0 <= *n* <= 365). Leap days are counted, and it " "is possible to refer to February 29." msgstr "" -#: ../../library/time.rst:755 +#: ../../library/time.rst:784 msgid ":samp:`M{m}.{n}.{d}`" msgstr ":samp:`M{m}.{n}.{d}`" -#: ../../library/time.rst:756 +#: ../../library/time.rst:785 msgid "" "The *d*'th day (0 <= *d* <= 6) of week *n* of month *m* of the year (1 <= " "*n* <= 5, 1 <= *m* <= 12, where week 5 means \"the last *d* day in month " @@ -1323,13 +1382,13 @@ msgid "" "first week in which the *d*'th day occurs. Day zero is a Sunday." msgstr "" -#: ../../library/time.rst:762 +#: ../../library/time.rst:791 msgid "" "``time`` has the same format as ``offset`` except that no leading sign ('-' " "or '+') is allowed. The default, if time is not given, is 02:00:00." msgstr "" -#: ../../library/time.rst:767 +#: ../../library/time.rst:796 msgid "" ">>> os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0'\n" ">>> time.tzset()\n" @@ -1349,7 +1408,7 @@ msgstr "" ">>> time.strftime('%X %x %Z')\n" "'16:08:12 05/08/03 AEST'" -#: ../../library/time.rst:776 +#: ../../library/time.rst:805 msgid "" "On many Unix systems (including \\*BSD, Linux, Solaris, and Darwin), it is " "more convenient to use the system's zoneinfo (:manpage:`tzfile(5)`) " @@ -1360,7 +1419,7 @@ msgid "" "``'Australia/Melbourne'``, ``'Egypt'`` or ``'Europe/Amsterdam'``. ::" msgstr "" -#: ../../library/time.rst:784 +#: ../../library/time.rst:813 msgid "" ">>> os.environ['TZ'] = 'US/Eastern'\n" ">>> time.tzset()\n" @@ -1372,23 +1431,23 @@ msgid "" "('EET', 'EEST')" msgstr "" -#: ../../library/time.rst:797 +#: ../../library/time.rst:826 msgid "Clock ID Constants" msgstr "" -#: ../../library/time.rst:799 +#: ../../library/time.rst:828 msgid "" "These constants are used as parameters for :func:`clock_getres` and :func:" "`clock_gettime`." msgstr "" -#: ../../library/time.rst:804 +#: ../../library/time.rst:833 msgid "" "Identical to :data:`CLOCK_MONOTONIC`, except it also includes any time that " "the system is suspended." msgstr "" -#: ../../library/time.rst:807 +#: ../../library/time.rst:836 msgid "" "This allows applications to get a suspend-aware monotonic clock without " "having to deal with the complications of :data:`CLOCK_REALTIME`, which may " @@ -1396,103 +1455,116 @@ msgid "" "similar." msgstr "" -#: ../../library/time.rst:812 +#: ../../library/time.rst:841 msgid ":ref:`Availability `: Linux >= 2.6.39." msgstr ":ref:`適用 `:Linux 2.6.39 以上。" -#: ../../library/time.rst:819 +#: ../../library/time.rst:848 msgid "" "The Solaris OS has a ``CLOCK_HIGHRES`` timer that attempts to use an optimal " "hardware source, and may give close to nanosecond resolution. " "``CLOCK_HIGHRES`` is the nonadjustable, high-resolution clock." msgstr "" -#: ../../library/time.rst:823 +#: ../../library/time.rst:852 msgid ":ref:`Availability `: Solaris." msgstr ":ref:`適用 `:Solaris。" -#: ../../library/time.rst:830 +#: ../../library/time.rst:859 msgid "" "Clock that cannot be set and represents monotonic time since some " "unspecified starting point." msgstr "" -#: ../../library/time.rst:840 +#: ../../library/time.rst:869 msgid "" "Similar to :data:`CLOCK_MONOTONIC`, but provides access to a raw hardware-" "based time that is not subject to NTP adjustments." msgstr "" -#: ../../library/time.rst:843 +#: ../../library/time.rst:872 msgid ":ref:`Availability `: Linux >= 2.6.28, macOS >= 10.12." msgstr ":ref:`適用 `:Linux 2.6.28 以上、macOS 10.12 以上。" -#: ../../library/time.rst:850 ../../library/time.rst:859 +#: ../../library/time.rst:878 +msgid "" +"Similar to :data:`CLOCK_MONOTONIC_RAW`, but reads a value cached by the " +"system at context switch and hence has less accuracy." +msgstr "" + +#: ../../library/time.rst:881 ../../library/time.rst:940 +#: ../../library/time.rst:949 +msgid ":ref:`Availability `: macOS >= 10.12." +msgstr ":ref:`適用 `:macOS 10.12 以上。" + +#: ../../library/time.rst:888 ../../library/time.rst:897 msgid "High-resolution per-process timer from the CPU." msgstr "" -#: ../../library/time.rst:861 +#: ../../library/time.rst:899 msgid ":ref:`Availability `: FreeBSD, NetBSD >= 7, OpenBSD." msgstr ":ref:`適用 `:FreeBSD、NetBSD 7 以上、OpenBSD。" -#: ../../library/time.rst:867 +#: ../../library/time.rst:905 msgid "" "`International Atomic Time `_" msgstr "" -#: ../../library/time.rst:869 +#: ../../library/time.rst:907 msgid "" "The system must have a current leap second table in order for this to give " "the correct answer. PTP or NTP software can maintain a leap second table." msgstr "" -#: ../../library/time.rst:872 +#: ../../library/time.rst:910 msgid ":ref:`Availability `: Linux." msgstr ":ref:`適用 `:Linux。" -#: ../../library/time.rst:878 +#: ../../library/time.rst:916 msgid "Thread-specific CPU-time clock." msgstr "" -#: ../../library/time.rst:887 +#: ../../library/time.rst:925 msgid "" "Time whose absolute value is the time the system has been running and not " "suspended, providing accurate uptime measurement, both absolute and interval." msgstr "" -#: ../../library/time.rst:891 +#: ../../library/time.rst:929 msgid ":ref:`Availability `: FreeBSD, OpenBSD >= 5.5." msgstr ":ref:`適用 `:FreeBSD、OpenBSD 5.5 以上。" -#: ../../library/time.rst:898 +#: ../../library/time.rst:936 msgid "" "Clock that increments monotonically, tracking the time since an arbitrary " "point, unaffected by frequency or time adjustments and not incremented while " "the system is asleep." msgstr "" -#: ../../library/time.rst:902 -msgid ":ref:`Availability `: macOS >= 10.12." -msgstr ":ref:`適用 `:macOS 10.12 以上。" +#: ../../library/time.rst:946 +msgid "" +"Like :data:`CLOCK_UPTIME_RAW`, but the value is cached by the system at " +"context switches and therefore has less accuracy." +msgstr "" -#: ../../library/time.rst:906 +#: ../../library/time.rst:953 msgid "" "The following constant is the only parameter that can be sent to :func:" "`clock_settime`." msgstr "" -#: ../../library/time.rst:912 +#: ../../library/time.rst:959 msgid "" "System-wide real-time clock. Setting this clock requires appropriate " "privileges." msgstr "" -#: ../../library/time.rst:923 +#: ../../library/time.rst:970 msgid "Timezone Constants" msgstr "" -#: ../../library/time.rst:927 +#: ../../library/time.rst:974 msgid "" "The offset of the local DST timezone, in seconds west of UTC, if one is " "defined. This is negative if the local DST timezone is east of UTC (as in " @@ -1500,25 +1572,25 @@ msgid "" "nonzero. See note below." msgstr "" -#: ../../library/time.rst:933 +#: ../../library/time.rst:980 msgid "Nonzero if a DST timezone is defined. See note below." msgstr "" -#: ../../library/time.rst:937 +#: ../../library/time.rst:984 msgid "" "The offset of the local (non-DST) timezone, in seconds west of UTC (negative " "in most of Western Europe, positive in the US, zero in the UK). See note " "below." msgstr "" -#: ../../library/time.rst:942 +#: ../../library/time.rst:989 msgid "" "A tuple of two strings: the first is the name of the local non-DST timezone, " "the second is the name of the local DST timezone. If no DST timezone is " "defined, the second string should not be used. See note below." msgstr "" -#: ../../library/time.rst:948 +#: ../../library/time.rst:995 msgid "" "For the above Timezone constants (:data:`altzone`, :data:`daylight`, :data:" "`timezone`, and :data:`tzname`), the value is determined by the timezone " @@ -1528,40 +1600,40 @@ msgid "" "func:`localtime` to obtain timezone information." msgstr "" -#: ../../library/time.rst:957 +#: ../../library/time.rst:1004 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/time.rst:958 +#: ../../library/time.rst:1005 msgid "More object-oriented interface to dates and times." msgstr "" -#: ../../library/time.rst:960 +#: ../../library/time.rst:1007 msgid "Module :mod:`locale`" msgstr ":mod:`locale` 模組" -#: ../../library/time.rst:961 +#: ../../library/time.rst:1008 msgid "" "Internationalization services. The locale setting affects the " "interpretation of many format specifiers in :func:`strftime` and :func:" "`strptime`." msgstr "" -#: ../../library/time.rst:964 +#: ../../library/time.rst:1011 msgid "Module :mod:`calendar`" msgstr ":mod:`calendar` 模組" -#: ../../library/time.rst:965 +#: ../../library/time.rst:1012 msgid "" "General calendar-related functions. :func:`~calendar.timegm` is the " "inverse of :func:`gmtime` from this module." msgstr "" -#: ../../library/time.rst:969 +#: ../../library/time.rst:1016 msgid "Footnotes" msgstr "註解" -#: ../../library/time.rst:970 +#: ../../library/time.rst:1017 msgid "" "The use of ``%Z`` is now deprecated, but the ``%z`` escape that expands to " "the preferred hour/minute offset is not supported by all ANSI C libraries. " @@ -1600,24 +1672,24 @@ msgstr "Greenwich Mean Time(格林威治標準時間)" msgid "Daylight Saving Time" msgstr "Daylight Saving Time(日光節約時間)" -#: ../../library/time.rst:310 ../../library/time.rst:336 -#: ../../library/time.rst:678 +#: ../../library/time.rst:319 ../../library/time.rst:354 +#: ../../library/time.rst:707 msgid "benchmarking" msgstr "benchmarking(基準測試)" -#: ../../library/time.rst:336 ../../library/time.rst:678 +#: ../../library/time.rst:354 ../../library/time.rst:707 msgid "CPU time" msgstr "CPU time(CPU 時間)" -#: ../../library/time.rst:336 ../../library/time.rst:678 +#: ../../library/time.rst:354 ../../library/time.rst:707 msgid "processor time" msgstr "processor time(處理器時間)" -#: ../../library/time.rst:393 ../../library/time.rst:539 +#: ../../library/time.rst:416 ../../library/time.rst:562 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/time.rst:393 ../../library/time.rst:539 +#: ../../library/time.rst:416 ../../library/time.rst:562 msgid "datetime format" msgstr "datetime format(日期時間格式)" diff --git a/library/tk.po b/library/tk.po index 492b8d11eb..7b366eefa0 100644 --- a/library/tk.po +++ b/library/tk.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-06-24 17:09+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,17 +25,18 @@ msgid "Graphical User Interfaces with Tk" msgstr "以 Tk 打造圖形使用者介面 (Graphical User Interfaces)" #: ../../library/tk.rst:13 +#, fuzzy msgid "" "Tk/Tcl has long been an integral part of Python. It provides a robust and " "platform independent windowing toolkit, that is available to Python " "programmers using the :mod:`tkinter` package, and its extension, the :mod:" -"`tkinter.tix` and the :mod:`tkinter.ttk` modules." +"`tkinter.ttk` module." msgstr "" "Tk/Tcl 長期以來一直是 Python 不可或缺的一部分。它提供了一個強大且獨立於平台的" "視窗工具包,可供使用 :mod:`tkinter` 套件及其擴充套件 :mod:`tkinter.tix` 和 :" "mod:`tkinter.ttk` 模組的 Python 開發者使用。" -#: ../../library/tk.rst:18 +#: ../../library/tk.rst:17 msgid "" "The :mod:`tkinter` package is a thin object-oriented layer on top of Tcl/Tk. " "To use :mod:`tkinter`, you don't need to write Tcl code, but you will need " @@ -47,7 +48,7 @@ msgstr "" "`tkinter`,你不需要編寫 Tcl 程式,但會需要查閱 Tk 文件和部份 Tcl 文件。:mod:" "`tkinter` 是一組將 Tk 小工具 (widget) 實作為 Python 類別的包裝器。" -#: ../../library/tk.rst:24 +#: ../../library/tk.rst:23 msgid "" ":mod:`tkinter`'s chief virtues are that it is fast, and that it usually " "comes bundled with Python. Although its standard documentation is weak, good " diff --git a/library/tkinter.po b/library/tkinter.po index 772fb19175..60989d08ac 100644 --- a/library/tkinter.po +++ b/library/tkinter.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -125,9 +125,10 @@ msgid "By Mark Roseman. (ISBN 978-1999149567)" msgstr "由 Mark Roseman 所著。(ISBN 978-1999149567)" #: ../../library/tkinter.rst:61 +#, fuzzy msgid "" -"`Python GUI programming with Tkinter `_" +"`Python GUI programming with Tkinter `_" msgstr "" "`Python GUI programming with Tkinter `_" @@ -190,7 +191,7 @@ msgid "" "difference (see `Threading model`_ for details)." msgstr "" -#: ../../library/tkinter.rst:92 ../../library/tkinter.rst:911 +#: ../../library/tkinter.rst:92 ../../library/tkinter.rst:907 msgid "Tk" msgstr "Tk" @@ -503,28 +504,18 @@ msgid "" msgstr "" #: ../../library/tkinter.rst:258 -msgid ":mod:`tkinter.tix`" -msgstr ":mod:`tkinter.tix`" - -#: ../../library/tkinter.rst:259 -msgid "" -"(deprecated) An older third-party Tcl/Tk package that adds several new " -"widgets. Better alternatives for most can be found in :mod:`tkinter.ttk`." -msgstr "" - -#: ../../library/tkinter.rst:262 msgid ":mod:`turtle`" msgstr ":mod:`turtle`" -#: ../../library/tkinter.rst:263 +#: ../../library/tkinter.rst:259 msgid "Turtle graphics in a Tk window." msgstr "" -#: ../../library/tkinter.rst:267 +#: ../../library/tkinter.rst:263 msgid "Tkinter Life Preserver" msgstr "" -#: ../../library/tkinter.rst:269 +#: ../../library/tkinter.rst:265 msgid "" "This section is not designed to be an exhaustive tutorial on either Tk or " "Tkinter. For that, refer to one of the external resources noted earlier. " @@ -533,7 +524,7 @@ msgid "" "how the Tkinter wrapper is structured." msgstr "" -#: ../../library/tkinter.rst:275 +#: ../../library/tkinter.rst:271 msgid "" "The remainder of this section will help you to identify the classes, " "methods, and options you'll need in your Tkinter application, and where to " @@ -541,18 +532,18 @@ msgid "" "reference manual." msgstr "" -#: ../../library/tkinter.rst:282 +#: ../../library/tkinter.rst:278 msgid "A Hello World Program" msgstr "" -#: ../../library/tkinter.rst:284 +#: ../../library/tkinter.rst:280 msgid "" "We'll start by walking through a \"Hello World\" application in Tkinter. " "This isn't the smallest one we could write, but has enough to illustrate " "some key concepts you'll need to know." msgstr "" -#: ../../library/tkinter.rst:290 +#: ../../library/tkinter.rst:286 msgid "" "from tkinter import *\n" "from tkinter import ttk\n" @@ -572,7 +563,7 @@ msgstr "" "ttk.Button(frm, text=\"Quit\", command=root.destroy).grid(column=1, row=0)\n" "root.mainloop()" -#: ../../library/tkinter.rst:300 +#: ../../library/tkinter.rst:296 msgid "" "After the imports, the next line creates an instance of the :class:`Tk` " "class, which initializes Tk and creates its associated Tcl interpreter. It " @@ -580,56 +571,56 @@ msgid "" "the main window of the application." msgstr "" -#: ../../library/tkinter.rst:305 +#: ../../library/tkinter.rst:301 msgid "" "The following line creates a frame widget, which in this case will contain a " "label and a button we'll create next. The frame is fit inside the root " "window." msgstr "" -#: ../../library/tkinter.rst:309 +#: ../../library/tkinter.rst:305 msgid "" "The next line creates a label widget holding a static text string. The :meth:" "`grid` method is used to specify the relative layout (position) of the label " "within its containing frame widget, similar to how tables in HTML work." msgstr "" -#: ../../library/tkinter.rst:313 +#: ../../library/tkinter.rst:309 msgid "" "A button widget is then created, and placed to the right of the label. When " "pressed, it will call the :meth:`destroy` method of the root window." msgstr "" -#: ../../library/tkinter.rst:316 +#: ../../library/tkinter.rst:312 msgid "" "Finally, the :meth:`mainloop` method puts everything on the display, and " "responds to user input until the program terminates." msgstr "" -#: ../../library/tkinter.rst:322 +#: ../../library/tkinter.rst:318 msgid "Important Tk Concepts" msgstr "" -#: ../../library/tkinter.rst:324 +#: ../../library/tkinter.rst:320 msgid "Even this simple program illustrates the following key Tk concepts:" msgstr "" -#: ../../library/tkinter.rst:326 +#: ../../library/tkinter.rst:322 msgid "widgets" msgstr "" -#: ../../library/tkinter.rst:327 +#: ../../library/tkinter.rst:323 msgid "" "A Tkinter user interface is made up of individual *widgets*. Each widget is " "represented as a Python object, instantiated from classes like :class:`ttk." "Frame`, :class:`ttk.Label`, and :class:`ttk.Button`." msgstr "" -#: ../../library/tkinter.rst:331 +#: ../../library/tkinter.rst:327 msgid "widget hierarchy" msgstr "" -#: ../../library/tkinter.rst:332 +#: ../../library/tkinter.rst:328 msgid "" "Widgets are arranged in a *hierarchy*. The label and button were contained " "within a frame, which in turn was contained within the root window. When " @@ -637,44 +628,44 @@ msgid "" "argument to the widget constructor." msgstr "" -#: ../../library/tkinter.rst:337 +#: ../../library/tkinter.rst:333 msgid "configuration options" msgstr "" -#: ../../library/tkinter.rst:338 +#: ../../library/tkinter.rst:334 msgid "" "Widgets have *configuration options*, which modify their appearance and " "behavior, such as the text to display in a label or button. Different " "classes of widgets will have different sets of options." msgstr "" -#: ../../library/tkinter.rst:342 +#: ../../library/tkinter.rst:338 msgid "geometry management" msgstr "" -#: ../../library/tkinter.rst:343 +#: ../../library/tkinter.rst:339 msgid "" "Widgets aren't automatically added to the user interface when they are " "created. A *geometry manager* like ``grid`` controls where in the user " "interface they are placed." msgstr "" -#: ../../library/tkinter.rst:347 +#: ../../library/tkinter.rst:343 msgid "event loop" msgstr "" -#: ../../library/tkinter.rst:348 +#: ../../library/tkinter.rst:344 msgid "" "Tkinter reacts to user input, changes from your program, and even refreshes " "the display only when actively running an *event loop*. If your program " "isn't running the event loop, your user interface won't update." msgstr "" -#: ../../library/tkinter.rst:354 +#: ../../library/tkinter.rst:350 msgid "Understanding How Tkinter Wraps Tcl/Tk" msgstr "" -#: ../../library/tkinter.rst:356 +#: ../../library/tkinter.rst:352 msgid "" "When your application uses Tkinter's classes and methods, internally Tkinter " "is assembling strings representing Tcl/Tk commands, and executing those " @@ -682,7 +673,7 @@ msgid "" "instance." msgstr "" -#: ../../library/tkinter.rst:361 +#: ../../library/tkinter.rst:357 msgid "" "Whether it's trying to navigate reference documentation, trying to find the " "right method or option, adapting some existing code, or debugging your " @@ -690,13 +681,13 @@ msgid "" "what those underlying Tcl/Tk commands look like." msgstr "" -#: ../../library/tkinter.rst:366 +#: ../../library/tkinter.rst:362 msgid "" "To illustrate, here is the Tcl/Tk equivalent of the main part of the Tkinter " "script above." msgstr "" -#: ../../library/tkinter.rst:371 +#: ../../library/tkinter.rst:367 msgid "" "ttk::frame .frm -padding 10\n" "grid .frm\n" @@ -710,7 +701,7 @@ msgstr "" "grid [ttk::button .frm.btn -text \"Quit\" -command \"destroy .\"] -column 1 -" "row 0" -#: ../../library/tkinter.rst:377 +#: ../../library/tkinter.rst:373 msgid "" "Tcl's syntax is similar to many shell languages, where the first word is the " "command to be executed, with arguments to that command following it, " @@ -718,25 +709,25 @@ msgid "" "following:" msgstr "" -#: ../../library/tkinter.rst:381 +#: ../../library/tkinter.rst:377 msgid "" "The commands used to create widgets (like ``ttk::frame``) correspond to " "widget classes in Tkinter." msgstr "" -#: ../../library/tkinter.rst:384 +#: ../../library/tkinter.rst:380 msgid "" "Tcl widget options (like ``-text``) correspond to keyword arguments in " "Tkinter." msgstr "" -#: ../../library/tkinter.rst:387 +#: ../../library/tkinter.rst:383 msgid "" "Widgets are referred to by a *pathname* in Tcl (like ``.frm.btn``), whereas " "Tkinter doesn't use names but object references." msgstr "" -#: ../../library/tkinter.rst:390 +#: ../../library/tkinter.rst:386 msgid "" "A widget's place in the widget hierarchy is encoded in its (hierarchical) " "pathname, which uses a ``.`` (dot) as a path separator. The pathname for the " @@ -744,7 +735,7 @@ msgid "" "pathname but by specifying the parent widget when creating each child widget." msgstr "" -#: ../../library/tkinter.rst:396 +#: ../../library/tkinter.rst:392 msgid "" "Operations which are implemented as separate *commands* in Tcl (like " "``grid`` or ``destroy``) are represented as *methods* on Tkinter widget " @@ -753,18 +744,18 @@ msgid "" "in Tkinter." msgstr "" -#: ../../library/tkinter.rst:404 +#: ../../library/tkinter.rst:400 msgid "How do I...? What option does...?" msgstr "" -#: ../../library/tkinter.rst:406 +#: ../../library/tkinter.rst:402 msgid "" "If you're not sure how to do something in Tkinter, and you can't immediately " "find it in the tutorial or reference documentation you're using, there are a " "few strategies that can be helpful." msgstr "" -#: ../../library/tkinter.rst:410 +#: ../../library/tkinter.rst:406 msgid "" "First, remember that the details of how individual widgets work may vary " "across different versions of both Tkinter and Tcl/Tk. If you're searching " @@ -772,7 +763,7 @@ msgid "" "installed on your system." msgstr "" -#: ../../library/tkinter.rst:415 +#: ../../library/tkinter.rst:411 msgid "" "When searching for how to use an API, it helps to know the exact name of the " "class, option, or method that you're using. Introspection, either in an " @@ -780,7 +771,7 @@ msgid "" "you need." msgstr "" -#: ../../library/tkinter.rst:420 +#: ../../library/tkinter.rst:416 msgid "" "To find out what configuration options are available on any widget, call " "its :meth:`configure` method, which returns a dictionary containing a " @@ -788,7 +779,7 @@ msgid "" "values. Use :meth:`keys` to get just the names of each option." msgstr "" -#: ../../library/tkinter.rst:427 +#: ../../library/tkinter.rst:423 msgid "" "btn = ttk.Button(frm, ...)\n" "print(btn.configure().keys())" @@ -796,7 +787,7 @@ msgstr "" "btn = ttk.Button(frm, ...)\n" "print(btn.configure().keys())" -#: ../../library/tkinter.rst:430 +#: ../../library/tkinter.rst:426 msgid "" "As most widgets have many configuration options in common, it can be useful " "to find out which are specific to a particular widget class. Comparing the " @@ -804,11 +795,11 @@ msgid "" "that." msgstr "" -#: ../../library/tkinter.rst:437 +#: ../../library/tkinter.rst:433 msgid "print(set(btn.configure().keys()) - set(frm.configure().keys()))" msgstr "print(set(btn.configure().keys()) - set(frm.configure().keys()))" -#: ../../library/tkinter.rst:439 +#: ../../library/tkinter.rst:435 msgid "" "Similarly, you can find the available methods for a widget object using the " "standard :func:`dir` function. If you try it, you'll see there are over 200 " @@ -816,7 +807,7 @@ msgid "" "is helpful." msgstr "" -#: ../../library/tkinter.rst:446 +#: ../../library/tkinter.rst:442 msgid "" "print(dir(btn))\n" "print(set(dir(btn)) - set(dir(frm)))" @@ -824,11 +815,11 @@ msgstr "" "print(dir(btn))\n" "print(set(dir(btn)) - set(dir(frm)))" -#: ../../library/tkinter.rst:451 +#: ../../library/tkinter.rst:447 msgid "Navigating the Tcl/Tk Reference Manual" msgstr "" -#: ../../library/tkinter.rst:453 +#: ../../library/tkinter.rst:449 msgid "" "As noted, the official `Tk commands `_ reference manual (man pages) is often the most accurate " @@ -837,7 +828,7 @@ msgid "" "places to look." msgstr "" -#: ../../library/tkinter.rst:458 +#: ../../library/tkinter.rst:454 msgid "" "While all operations in Tkinter are implemented as method calls on widget " "objects, you've seen that many Tcl/Tk operations appear as commands that " @@ -845,7 +836,7 @@ msgid "" "parameters, e.g." msgstr "" -#: ../../library/tkinter.rst:465 +#: ../../library/tkinter.rst:461 msgid "" "destroy .\n" "grid .frm.btn -column 0 -row 0" @@ -853,7 +844,7 @@ msgstr "" "destroy .\n" "grid .frm.btn -column 0 -row 0" -#: ../../library/tkinter.rst:468 +#: ../../library/tkinter.rst:464 msgid "" "Others, however, look more like methods called on a widget object (in fact, " "when you create a widget in Tcl/Tk, it creates a Tcl command with the name " @@ -861,7 +852,7 @@ msgid "" "name of a method to call)." msgstr "" -#: ../../library/tkinter.rst:475 +#: ../../library/tkinter.rst:471 msgid "" ".frm.btn invoke\n" ".frm.lbl configure -text \"Goodbye\"" @@ -869,7 +860,7 @@ msgstr "" ".frm.btn invoke\n" ".frm.lbl configure -text \"Goodbye\"" -#: ../../library/tkinter.rst:479 +#: ../../library/tkinter.rst:475 msgid "" "In the official Tcl/Tk reference documentation, you'll find most operations " "that look like method calls on the man page for a specific widget (e.g., " @@ -879,7 +870,7 @@ msgid "" "www.tcl.tk/man/tcl8.6/TkCmd/grid.htm>`_)." msgstr "" -#: ../../library/tkinter.rst:487 +#: ../../library/tkinter.rst:483 msgid "" "You'll find many common options and methods in the `options `_ or `ttk::widget `_ man page." msgstr "" -#: ../../library/tkinter.rst:498 +#: ../../library/tkinter.rst:494 msgid "" "Somewhat confusingly, there are also methods on all Tkinter widgets that " "don't actually operate on the widget, but operate at a global scope, " @@ -904,17 +895,17 @@ msgid "" "class:`Widget` class that all Tkinter widgets inherit from)." msgstr "" -#: ../../library/tkinter.rst:507 +#: ../../library/tkinter.rst:503 msgid "Threading model" msgstr "" -#: ../../library/tkinter.rst:509 +#: ../../library/tkinter.rst:505 msgid "" "Python and Tcl/Tk have very different threading models, which :mod:`tkinter` " "tries to bridge. If you use threads, you may need to be aware of this." msgstr "" -#: ../../library/tkinter.rst:512 +#: ../../library/tkinter.rst:508 msgid "" "A Python interpreter may have many threads associated with it. In Tcl, " "multiple threads can be created, but each thread has a separate Tcl " @@ -923,7 +914,7 @@ msgid "" "by the one thread that created it." msgstr "" -#: ../../library/tkinter.rst:517 +#: ../../library/tkinter.rst:513 msgid "" "Each :class:`Tk` object created by :mod:`tkinter` contains a Tcl " "interpreter. It also keeps track of which thread created that interpreter. " @@ -933,7 +924,7 @@ msgid "" "executed, the result is returned to the calling Python thread." msgstr "" -#: ../../library/tkinter.rst:524 +#: ../../library/tkinter.rst:520 msgid "" "Tcl/Tk applications are normally event-driven, meaning that after " "initialization, the interpreter runs an event loop (i.e. :func:`Tk." @@ -946,18 +937,18 @@ msgid "" "event handlers." msgstr "" -#: ../../library/tkinter.rst:533 +#: ../../library/tkinter.rst:529 msgid "" "If the Tcl interpreter is not running the event loop and processing events, " "any :mod:`tkinter` calls made from threads other than the one running the " "Tcl interpreter will fail." msgstr "" -#: ../../library/tkinter.rst:537 +#: ../../library/tkinter.rst:533 msgid "A number of special cases exist:" msgstr "" -#: ../../library/tkinter.rst:539 +#: ../../library/tkinter.rst:535 msgid "" "Tcl/Tk libraries can be built so they are not thread-aware. In this case, :" "mod:`tkinter` calls the library from the originating Python thread, even if " @@ -965,7 +956,7 @@ msgid "" "lock ensures only one call occurs at a time." msgstr "" -#: ../../library/tkinter.rst:544 +#: ../../library/tkinter.rst:540 msgid "" "While :mod:`tkinter` allows you to create more than one instance of a :class:" "`Tk` object (with its own interpreter), all interpreters that are part of " @@ -975,7 +966,7 @@ msgid "" "running a thread-aware Tcl/Tk build." msgstr "" -#: ../../library/tkinter.rst:550 +#: ../../library/tkinter.rst:546 msgid "" "Blocking event handlers are not the only way to prevent the Tcl interpreter " "from reentering the event loop. It is even possible to run multiple nested " @@ -983,39 +974,39 @@ msgid "" "tricky when it comes to events or threads, be aware of these possibilities." msgstr "" -#: ../../library/tkinter.rst:555 +#: ../../library/tkinter.rst:551 msgid "" "There are a few select :mod:`tkinter` functions that presently work only " "when called from the thread that created the Tcl interpreter." msgstr "" -#: ../../library/tkinter.rst:560 +#: ../../library/tkinter.rst:556 msgid "Handy Reference" msgstr "" -#: ../../library/tkinter.rst:566 +#: ../../library/tkinter.rst:562 msgid "Setting Options" msgstr "" -#: ../../library/tkinter.rst:568 +#: ../../library/tkinter.rst:564 msgid "" "Options control things like the color and border width of a widget. Options " "can be set in three ways:" msgstr "" -#: ../../library/tkinter.rst:571 +#: ../../library/tkinter.rst:567 msgid "At object creation time, using keyword arguments" msgstr "" -#: ../../library/tkinter.rst:574 +#: ../../library/tkinter.rst:570 msgid "fred = Button(self, fg=\"red\", bg=\"blue\")" msgstr "fred = Button(self, fg=\"red\", bg=\"blue\")" -#: ../../library/tkinter.rst:576 +#: ../../library/tkinter.rst:572 msgid "After object creation, treating the option name like a dictionary index" msgstr "" -#: ../../library/tkinter.rst:579 +#: ../../library/tkinter.rst:575 msgid "" "fred[\"fg\"] = \"red\"\n" "fred[\"bg\"] = \"blue\"" @@ -1023,23 +1014,23 @@ msgstr "" "fred[\"fg\"] = \"red\"\n" "fred[\"bg\"] = \"blue\"" -#: ../../library/tkinter.rst:582 +#: ../../library/tkinter.rst:578 msgid "" "Use the config() method to update multiple attrs subsequent to object " "creation" msgstr "" -#: ../../library/tkinter.rst:585 +#: ../../library/tkinter.rst:581 msgid "fred.config(fg=\"red\", bg=\"blue\")" msgstr "fred.config(fg=\"red\", bg=\"blue\")" -#: ../../library/tkinter.rst:587 +#: ../../library/tkinter.rst:583 msgid "" "For a complete explanation of a given option and its behavior, see the Tk " "man pages for the widget in question." msgstr "" -#: ../../library/tkinter.rst:590 +#: ../../library/tkinter.rst:586 msgid "" "Note that the man pages list \"STANDARD OPTIONS\" and \"WIDGET SPECIFIC " "OPTIONS\" for each widget. The former is a list of options that are common " @@ -1048,7 +1039,7 @@ msgid "" "`options(3)` man page." msgstr "" -#: ../../library/tkinter.rst:596 +#: ../../library/tkinter.rst:592 msgid "" "No distinction between standard and widget-specific options is made in this " "document. Some options don't apply to some kinds of widgets. Whether a " @@ -1056,7 +1047,7 @@ msgid "" "widget; buttons have a ``command`` option, labels do not." msgstr "" -#: ../../library/tkinter.rst:601 +#: ../../library/tkinter.rst:597 msgid "" "The options supported by a given widget are listed in that widget's man " "page, or can be queried at runtime by calling the :meth:`config` method " @@ -1065,7 +1056,7 @@ msgid "" "option as a string (for example, ``'relief'``) and whose values are 5-tuples." msgstr "" -#: ../../library/tkinter.rst:607 +#: ../../library/tkinter.rst:603 msgid "" "Some options, like ``bg`` are synonyms for common options with long names " "(``bg`` is shorthand for \"background\"). Passing the ``config()`` method " @@ -1074,79 +1065,79 @@ msgid "" "option (such as ``('bg', 'background')``)." msgstr "" -#: ../../library/tkinter.rst:614 +#: ../../library/tkinter.rst:610 msgid "Index" msgstr "" -#: ../../library/tkinter.rst:614 +#: ../../library/tkinter.rst:610 msgid "Meaning" msgstr "含義" -#: ../../library/tkinter.rst:614 +#: ../../library/tkinter.rst:610 msgid "Example" msgstr "範例" -#: ../../library/tkinter.rst:616 +#: ../../library/tkinter.rst:612 msgid "0" msgstr "0" -#: ../../library/tkinter.rst:616 +#: ../../library/tkinter.rst:612 msgid "option name" msgstr "" -#: ../../library/tkinter.rst:616 ../../library/tkinter.rst:618 +#: ../../library/tkinter.rst:612 ../../library/tkinter.rst:614 msgid "``'relief'``" msgstr "``'relief'``" -#: ../../library/tkinter.rst:618 +#: ../../library/tkinter.rst:614 msgid "1" msgstr "1" -#: ../../library/tkinter.rst:618 +#: ../../library/tkinter.rst:614 msgid "option name for database lookup" msgstr "" -#: ../../library/tkinter.rst:620 +#: ../../library/tkinter.rst:616 msgid "2" msgstr "2" -#: ../../library/tkinter.rst:620 +#: ../../library/tkinter.rst:616 msgid "option class for database lookup" msgstr "" -#: ../../library/tkinter.rst:620 +#: ../../library/tkinter.rst:616 msgid "``'Relief'``" msgstr "``'Relief'``" -#: ../../library/tkinter.rst:623 +#: ../../library/tkinter.rst:619 msgid "3" msgstr "3" -#: ../../library/tkinter.rst:623 +#: ../../library/tkinter.rst:619 msgid "default value" msgstr "" -#: ../../library/tkinter.rst:623 +#: ../../library/tkinter.rst:619 msgid "``'raised'``" msgstr "``'raised'``" -#: ../../library/tkinter.rst:625 +#: ../../library/tkinter.rst:621 msgid "4" msgstr "4" -#: ../../library/tkinter.rst:625 +#: ../../library/tkinter.rst:621 msgid "current value" msgstr "" -#: ../../library/tkinter.rst:625 +#: ../../library/tkinter.rst:621 msgid "``'groove'``" msgstr "``'groove'``" -#: ../../library/tkinter.rst:628 +#: ../../library/tkinter.rst:624 msgid "Example::" msgstr "範例: ::" -#: ../../library/tkinter.rst:630 +#: ../../library/tkinter.rst:626 msgid "" ">>> print(fred.config())\n" "{'relief': ('relief', 'relief', 'Relief', 'raised', 'groove')}" @@ -1154,17 +1145,17 @@ msgstr "" ">>> print(fred.config())\n" "{'relief': ('relief', 'relief', 'Relief', 'raised', 'groove')}" -#: ../../library/tkinter.rst:633 +#: ../../library/tkinter.rst:629 msgid "" "Of course, the dictionary printed will include all the options available and " "their values. This is meant only as an example." msgstr "" -#: ../../library/tkinter.rst:638 +#: ../../library/tkinter.rst:634 msgid "The Packer" msgstr "" -#: ../../library/tkinter.rst:642 +#: ../../library/tkinter.rst:638 msgid "" "The packer is one of Tk's geometry-management mechanisms. Geometry " "managers are used to specify the relative positioning of widgets within " @@ -1175,7 +1166,7 @@ msgid "" "coordinates for you." msgstr "" -#: ../../library/tkinter.rst:649 +#: ../../library/tkinter.rst:645 msgid "" "The size of any *master* widget is determined by the size of the \"slave " "widgets\" inside. The packer is used to control where slave widgets appear " @@ -1185,7 +1176,7 @@ msgid "" "accommodate incremental changes to the configuration, once it is packed." msgstr "" -#: ../../library/tkinter.rst:656 +#: ../../library/tkinter.rst:652 msgid "" "Note that widgets do not appear until they have had their geometry specified " "with a geometry manager. It's a common early mistake to leave out the " @@ -1194,86 +1185,86 @@ msgid "" "the packer's :meth:`pack` method applied to it." msgstr "" -#: ../../library/tkinter.rst:662 +#: ../../library/tkinter.rst:658 msgid "" "The pack() method can be called with keyword-option/value pairs that control " "where the widget is to appear within its container, and how it is to behave " "when the main application window is resized. Here are some examples::" msgstr "" -#: ../../library/tkinter.rst:666 +#: ../../library/tkinter.rst:662 msgid "" "fred.pack() # defaults to side = \"top\"\n" "fred.pack(side=\"left\")\n" "fred.pack(expand=1)" msgstr "" -#: ../../library/tkinter.rst:672 +#: ../../library/tkinter.rst:668 msgid "Packer Options" msgstr "" -#: ../../library/tkinter.rst:674 +#: ../../library/tkinter.rst:670 msgid "" "For more extensive information on the packer and the options that it can " "take, see the man pages and page 183 of John Ousterhout's book." msgstr "" -#: ../../library/tkinter.rst:677 ../../library/tkinter.rst:796 +#: ../../library/tkinter.rst:673 ../../library/tkinter.rst:792 msgid "anchor" msgstr "" -#: ../../library/tkinter.rst:678 +#: ../../library/tkinter.rst:674 msgid "" "Anchor type. Denotes where the packer is to place each slave in its parcel." msgstr "" -#: ../../library/tkinter.rst:680 +#: ../../library/tkinter.rst:676 msgid "expand" msgstr "" -#: ../../library/tkinter.rst:681 +#: ../../library/tkinter.rst:677 msgid "Boolean, ``0`` or ``1``." msgstr "" -#: ../../library/tkinter.rst:683 +#: ../../library/tkinter.rst:679 msgid "fill" msgstr "" -#: ../../library/tkinter.rst:684 +#: ../../library/tkinter.rst:680 msgid "Legal values: ``'x'``, ``'y'``, ``'both'``, ``'none'``." msgstr "" -#: ../../library/tkinter.rst:686 +#: ../../library/tkinter.rst:682 msgid "ipadx and ipady" msgstr "" -#: ../../library/tkinter.rst:687 +#: ../../library/tkinter.rst:683 msgid "" "A distance - designating internal padding on each side of the slave widget." msgstr "" -#: ../../library/tkinter.rst:689 +#: ../../library/tkinter.rst:685 msgid "padx and pady" msgstr "" -#: ../../library/tkinter.rst:690 +#: ../../library/tkinter.rst:686 msgid "" "A distance - designating external padding on each side of the slave widget." msgstr "" -#: ../../library/tkinter.rst:692 +#: ../../library/tkinter.rst:688 msgid "side" msgstr "" -#: ../../library/tkinter.rst:693 +#: ../../library/tkinter.rst:689 msgid "Legal values are: ``'left'``, ``'right'``, ``'top'``, ``'bottom'``." msgstr "" -#: ../../library/tkinter.rst:697 +#: ../../library/tkinter.rst:693 msgid "Coupling Widget Variables" msgstr "" -#: ../../library/tkinter.rst:699 +#: ../../library/tkinter.rst:695 msgid "" "The current-value setting of some widgets (like text entry widgets) can be " "connected directly to application variables by using special options. These " @@ -1283,7 +1274,7 @@ msgid "" "value." msgstr "" -#: ../../library/tkinter.rst:705 +#: ../../library/tkinter.rst:701 msgid "" "Unfortunately, in the current implementation of :mod:`tkinter` it is not " "possible to hand over an arbitrary Python variable to a widget through a " @@ -1292,7 +1283,7 @@ msgid "" "Variable, defined in :mod:`tkinter`." msgstr "" -#: ../../library/tkinter.rst:711 +#: ../../library/tkinter.rst:707 msgid "" "There are many useful subclasses of Variable already defined: :class:" "`StringVar`, :class:`IntVar`, :class:`DoubleVar`, and :class:`BooleanVar`. " @@ -1302,11 +1293,11 @@ msgid "" "no further intervention on your part." msgstr "" -#: ../../library/tkinter.rst:718 ../../library/tkinter.rst:898 +#: ../../library/tkinter.rst:714 ../../library/tkinter.rst:894 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/tkinter.rst:720 +#: ../../library/tkinter.rst:716 msgid "" "import tkinter as tk\n" "\n" @@ -1339,11 +1330,11 @@ msgid "" "myapp.mainloop()" msgstr "" -#: ../../library/tkinter.rst:751 +#: ../../library/tkinter.rst:747 msgid "The Window Manager" msgstr "" -#: ../../library/tkinter.rst:755 +#: ../../library/tkinter.rst:751 msgid "" "In Tk, there is a utility command, ``wm``, for interacting with the window " "manager. Options to the ``wm`` command allow you to control things like " @@ -1353,7 +1344,7 @@ msgid "" "the :class:`Wm` methods directly." msgstr "" -#: ../../library/tkinter.rst:762 +#: ../../library/tkinter.rst:758 msgid "" "To get at the toplevel window that contains a given widget, you can often " "just refer to the widget's master. Of course if the widget has been packed " @@ -1364,11 +1355,11 @@ msgid "" "to Tk functionality." msgstr "" -#: ../../library/tkinter.rst:769 +#: ../../library/tkinter.rst:765 msgid "Here are some examples of typical usage::" msgstr "以下是一些常見用法範例: ::" -#: ../../library/tkinter.rst:771 +#: ../../library/tkinter.rst:767 msgid "" "import tkinter as tk\n" "\n" @@ -1390,22 +1381,22 @@ msgid "" "myapp.mainloop()" msgstr "" -#: ../../library/tkinter.rst:792 ../../library/tkinter.rst:794 +#: ../../library/tkinter.rst:788 ../../library/tkinter.rst:790 msgid "Tk Option Data Types" msgstr "" -#: ../../library/tkinter.rst:797 +#: ../../library/tkinter.rst:793 msgid "" "Legal values are points of the compass: ``\"n\"``, ``\"ne\"``, ``\"e\"``, " "``\"se\"``, ``\"s\"``, ``\"sw\"``, ``\"w\"``, ``\"nw\"``, and also " "``\"center\"``." msgstr "" -#: ../../library/tkinter.rst:800 +#: ../../library/tkinter.rst:796 msgid "bitmap" msgstr "" -#: ../../library/tkinter.rst:801 +#: ../../library/tkinter.rst:797 msgid "" "There are eight built-in, named bitmaps: ``'error'``, ``'gray25'``, " "``'gray50'``, ``'hourglass'``, ``'info'``, ``'questhead'``, ``'question'``, " @@ -1413,23 +1404,23 @@ msgid "" "file, preceded with an ``@``, as in ``\"@/usr/contrib/bitmap/gumby.bit\"``." msgstr "" -#: ../../library/tkinter.rst:806 +#: ../../library/tkinter.rst:802 msgid "boolean" msgstr "" -#: ../../library/tkinter.rst:807 +#: ../../library/tkinter.rst:803 msgid "You can pass integers 0 or 1 or the strings ``\"yes\"`` or ``\"no\"``." msgstr "" -#: ../../library/tkinter.rst:809 +#: ../../library/tkinter.rst:805 msgid "callback" msgstr "" -#: ../../library/tkinter.rst:810 +#: ../../library/tkinter.rst:806 msgid "This is any Python function that takes no arguments. For example::" msgstr "" -#: ../../library/tkinter.rst:812 +#: ../../library/tkinter.rst:808 msgid "" "def print_it():\n" " print(\"hi there\")\n" @@ -1439,11 +1430,11 @@ msgstr "" " print(\"hi there\")\n" "fred[\"command\"] = print_it" -#: ../../library/tkinter.rst:816 +#: ../../library/tkinter.rst:812 msgid "color" msgstr "" -#: ../../library/tkinter.rst:817 +#: ../../library/tkinter.rst:813 msgid "" "Colors can be given as the names of X colors in the rgb.txt file, or as " "strings representing RGB values in 4 bit: ``\"#RGB\"``, 8 bit: " @@ -1452,11 +1443,11 @@ msgid "" "digit. See page 160 of Ousterhout's book for details." msgstr "" -#: ../../library/tkinter.rst:822 +#: ../../library/tkinter.rst:818 msgid "cursor" msgstr "" -#: ../../library/tkinter.rst:823 +#: ../../library/tkinter.rst:819 msgid "" "The standard X cursor names from :file:`cursorfont.h` can be used, without " "the ``XC_`` prefix. For example to get a hand cursor (:const:`XC_hand2`), " @@ -1464,11 +1455,11 @@ msgid "" "of your own. See page 179 of Ousterhout's book." msgstr "" -#: ../../library/tkinter.rst:828 +#: ../../library/tkinter.rst:824 msgid "distance" msgstr "" -#: ../../library/tkinter.rst:829 +#: ../../library/tkinter.rst:825 msgid "" "Screen distances can be specified in either pixels or absolute distances. " "Pixels are given as numbers and absolute distances as strings, with the " @@ -1477,124 +1468,124 @@ msgid "" "is expressed as ``\"3.5i\"``." msgstr "" -#: ../../library/tkinter.rst:835 +#: ../../library/tkinter.rst:831 msgid "font" msgstr "" -#: ../../library/tkinter.rst:836 +#: ../../library/tkinter.rst:832 msgid "" "Tk uses a list font name format, such as ``{courier 10 bold}``. Font sizes " "with positive numbers are measured in points; sizes with negative numbers " "are measured in pixels." msgstr "" -#: ../../library/tkinter.rst:840 +#: ../../library/tkinter.rst:836 msgid "geometry" msgstr "" -#: ../../library/tkinter.rst:841 +#: ../../library/tkinter.rst:837 msgid "" "This is a string of the form ``widthxheight``, where width and height are " "measured in pixels for most widgets (in characters for widgets displaying " "text). For example: ``fred[\"geometry\"] = \"200x100\"``." msgstr "" -#: ../../library/tkinter.rst:845 +#: ../../library/tkinter.rst:841 msgid "justify" msgstr "" -#: ../../library/tkinter.rst:846 +#: ../../library/tkinter.rst:842 msgid "" "Legal values are the strings: ``\"left\"``, ``\"center\"``, ``\"right\"``, " "and ``\"fill\"``." msgstr "" -#: ../../library/tkinter.rst:849 +#: ../../library/tkinter.rst:845 msgid "region" msgstr "" -#: ../../library/tkinter.rst:850 +#: ../../library/tkinter.rst:846 msgid "" "This is a string with four space-delimited elements, each of which is a " "legal distance (see above). For example: ``\"2 3 4 5\"`` and ``\"3i 2i 4.5i " "2i\"`` and ``\"3c 2c 4c 10.43c\"`` are all legal regions." msgstr "" -#: ../../library/tkinter.rst:854 +#: ../../library/tkinter.rst:850 msgid "relief" msgstr "" -#: ../../library/tkinter.rst:855 +#: ../../library/tkinter.rst:851 msgid "" "Determines what the border style of a widget will be. Legal values are: " "``\"raised\"``, ``\"sunken\"``, ``\"flat\"``, ``\"groove\"``, and " "``\"ridge\"``." msgstr "" -#: ../../library/tkinter.rst:858 +#: ../../library/tkinter.rst:854 msgid "scrollcommand" msgstr "" -#: ../../library/tkinter.rst:859 +#: ../../library/tkinter.rst:855 msgid "" "This is almost always the :meth:`!set` method of some scrollbar widget, but " "can be any widget method that takes a single argument." msgstr "" -#: ../../library/tkinter.rst:862 +#: ../../library/tkinter.rst:858 msgid "wrap" msgstr "" -#: ../../library/tkinter.rst:863 +#: ../../library/tkinter.rst:859 msgid "Must be one of: ``\"none\"``, ``\"char\"``, or ``\"word\"``." msgstr "" -#: ../../library/tkinter.rst:868 +#: ../../library/tkinter.rst:864 msgid "Bindings and Events" msgstr "" -#: ../../library/tkinter.rst:874 +#: ../../library/tkinter.rst:870 msgid "" "The bind method from the widget command allows you to watch for certain " "events and to have a callback function trigger when that event type occurs. " "The form of the bind method is::" msgstr "" -#: ../../library/tkinter.rst:878 +#: ../../library/tkinter.rst:874 msgid "def bind(self, sequence, func, add=''):" msgstr "def bind(self, sequence, func, add=''):" -#: ../../library/tkinter.rst:880 +#: ../../library/tkinter.rst:876 msgid "where:" msgstr "" -#: ../../library/tkinter.rst:882 +#: ../../library/tkinter.rst:878 msgid "sequence" msgstr "sequence(序列)" -#: ../../library/tkinter.rst:883 +#: ../../library/tkinter.rst:879 msgid "" "is a string that denotes the target kind of event. (See the :manpage:" "`bind(3tk)` man page, and page 201 of John Ousterhout's book, :title-" "reference:`Tcl and the Tk Toolkit (2nd edition)`, for details)." msgstr "" -#: ../../library/tkinter.rst:887 +#: ../../library/tkinter.rst:883 msgid "func" msgstr "" -#: ../../library/tkinter.rst:888 +#: ../../library/tkinter.rst:884 msgid "" "is a Python function, taking one argument, to be invoked when the event " "occurs. An Event instance will be passed as the argument. (Functions " "deployed this way are commonly known as *callbacks*.)" msgstr "" -#: ../../library/tkinter.rst:892 +#: ../../library/tkinter.rst:888 msgid "add" msgstr "" -#: ../../library/tkinter.rst:893 +#: ../../library/tkinter.rst:889 msgid "" "is optional, either ``''`` or ``'+'``. Passing an empty string denotes that " "this binding is to replace any other bindings that this event is associated " @@ -1602,7 +1593,7 @@ msgid "" "of functions bound to this event type." msgstr "" -#: ../../library/tkinter.rst:900 +#: ../../library/tkinter.rst:896 msgid "" "def turn_red(self, event):\n" " event.widget[\"activeforeground\"] = \"red\"\n" @@ -1614,7 +1605,7 @@ msgstr "" "\n" "self.button.bind(\"\", self.turn_red)" -#: ../../library/tkinter.rst:905 +#: ../../library/tkinter.rst:901 msgid "" "Notice how the widget field of the event is being accessed in the " "``turn_red()`` callback. This field contains the widget that caught the X " @@ -1623,209 +1614,209 @@ msgid "" "pages." msgstr "" -#: ../../library/tkinter.rst:911 +#: ../../library/tkinter.rst:907 msgid "Tkinter Event Field" msgstr "" -#: ../../library/tkinter.rst:913 +#: ../../library/tkinter.rst:909 msgid "%f" msgstr "%f" -#: ../../library/tkinter.rst:913 +#: ../../library/tkinter.rst:909 msgid "focus" msgstr "" -#: ../../library/tkinter.rst:913 +#: ../../library/tkinter.rst:909 msgid "%A" msgstr "%A" -#: ../../library/tkinter.rst:913 +#: ../../library/tkinter.rst:909 msgid "char" msgstr "char" -#: ../../library/tkinter.rst:915 +#: ../../library/tkinter.rst:911 msgid "%h" msgstr "%h" -#: ../../library/tkinter.rst:915 +#: ../../library/tkinter.rst:911 msgid "height" msgstr "" -#: ../../library/tkinter.rst:915 +#: ../../library/tkinter.rst:911 msgid "%E" msgstr "%E" -#: ../../library/tkinter.rst:915 +#: ../../library/tkinter.rst:911 msgid "send_event" msgstr "send_event" -#: ../../library/tkinter.rst:917 +#: ../../library/tkinter.rst:913 msgid "%k" msgstr "%k" -#: ../../library/tkinter.rst:917 +#: ../../library/tkinter.rst:913 msgid "keycode" msgstr "" -#: ../../library/tkinter.rst:917 +#: ../../library/tkinter.rst:913 msgid "%K" msgstr "%K" -#: ../../library/tkinter.rst:917 +#: ../../library/tkinter.rst:913 msgid "keysym" msgstr "" -#: ../../library/tkinter.rst:919 +#: ../../library/tkinter.rst:915 msgid "%s" msgstr "%s" -#: ../../library/tkinter.rst:919 +#: ../../library/tkinter.rst:915 msgid "state" msgstr "" -#: ../../library/tkinter.rst:919 +#: ../../library/tkinter.rst:915 msgid "%N" msgstr "%N" -#: ../../library/tkinter.rst:919 +#: ../../library/tkinter.rst:915 msgid "keysym_num" msgstr "keysym_num" -#: ../../library/tkinter.rst:921 +#: ../../library/tkinter.rst:917 msgid "%t" msgstr "%t" -#: ../../library/tkinter.rst:921 +#: ../../library/tkinter.rst:917 msgid "time" msgstr "" -#: ../../library/tkinter.rst:921 +#: ../../library/tkinter.rst:917 msgid "%T" msgstr "%T" -#: ../../library/tkinter.rst:921 +#: ../../library/tkinter.rst:917 msgid "type" msgstr "" -#: ../../library/tkinter.rst:923 +#: ../../library/tkinter.rst:919 msgid "%w" msgstr "%w" -#: ../../library/tkinter.rst:923 +#: ../../library/tkinter.rst:919 msgid "width" msgstr "" -#: ../../library/tkinter.rst:923 +#: ../../library/tkinter.rst:919 msgid "%W" msgstr "%W" -#: ../../library/tkinter.rst:923 +#: ../../library/tkinter.rst:919 msgid "widget" msgstr "" -#: ../../library/tkinter.rst:925 +#: ../../library/tkinter.rst:921 msgid "%x" msgstr "%x" -#: ../../library/tkinter.rst:925 +#: ../../library/tkinter.rst:921 msgid "x" msgstr "x" -#: ../../library/tkinter.rst:925 +#: ../../library/tkinter.rst:921 msgid "%X" msgstr "%X" -#: ../../library/tkinter.rst:925 +#: ../../library/tkinter.rst:921 msgid "x_root" msgstr "x_root" -#: ../../library/tkinter.rst:927 +#: ../../library/tkinter.rst:923 msgid "%y" msgstr "%y" -#: ../../library/tkinter.rst:927 +#: ../../library/tkinter.rst:923 msgid "y" msgstr "y" -#: ../../library/tkinter.rst:927 +#: ../../library/tkinter.rst:923 msgid "%Y" msgstr "%Y" -#: ../../library/tkinter.rst:927 +#: ../../library/tkinter.rst:923 msgid "y_root" msgstr "y_root" -#: ../../library/tkinter.rst:932 +#: ../../library/tkinter.rst:928 msgid "The index Parameter" msgstr "" -#: ../../library/tkinter.rst:934 +#: ../../library/tkinter.rst:930 msgid "" "A number of widgets require \"index\" parameters to be passed. These are " "used to point at a specific place in a Text widget, or to particular " "characters in an Entry widget, or to particular menu items in a Menu widget." msgstr "" -#: ../../library/tkinter.rst:938 +#: ../../library/tkinter.rst:934 msgid "Entry widget indexes (index, view index, etc.)" msgstr "" -#: ../../library/tkinter.rst:939 +#: ../../library/tkinter.rst:935 msgid "" "Entry widgets have options that refer to character positions in the text " "being displayed. You can use these :mod:`tkinter` functions to access these " "special points in text widgets:" msgstr "" -#: ../../library/tkinter.rst:943 +#: ../../library/tkinter.rst:939 msgid "Text widget indexes" msgstr "" -#: ../../library/tkinter.rst:944 +#: ../../library/tkinter.rst:940 msgid "" "The index notation for Text widgets is very rich and is best described in " "the Tk man pages." msgstr "" -#: ../../library/tkinter.rst:947 +#: ../../library/tkinter.rst:943 msgid "Menu indexes (menu.invoke(), menu.entryconfig(), etc.)" msgstr "" -#: ../../library/tkinter.rst:948 +#: ../../library/tkinter.rst:944 msgid "" "Some options and methods for menus manipulate specific menu entries. Anytime " "a menu index is needed for an option or a parameter, you may pass in:" msgstr "" -#: ../../library/tkinter.rst:951 +#: ../../library/tkinter.rst:947 msgid "" "an integer which refers to the numeric position of the entry in the widget, " "counted from the top, starting with 0;" msgstr "" -#: ../../library/tkinter.rst:954 +#: ../../library/tkinter.rst:950 msgid "" "the string ``\"active\"``, which refers to the menu position that is " "currently under the cursor;" msgstr "" -#: ../../library/tkinter.rst:957 +#: ../../library/tkinter.rst:953 msgid "the string ``\"last\"`` which refers to the last menu item;" msgstr "" -#: ../../library/tkinter.rst:959 +#: ../../library/tkinter.rst:955 msgid "" "An integer preceded by ``@``, as in ``@6``, where the integer is interpreted " "as a y pixel coordinate in the menu's coordinate system;" msgstr "" -#: ../../library/tkinter.rst:962 +#: ../../library/tkinter.rst:958 msgid "" "the string ``\"none\"``, which indicates no menu entry at all, most often " "used with menu.activate() to deactivate all entries, and finally," msgstr "" -#: ../../library/tkinter.rst:965 +#: ../../library/tkinter.rst:961 msgid "" "a text string that is pattern matched against the label of the menu entry, " "as scanned from the top of the menu to the bottom. Note that this index " @@ -1834,33 +1825,42 @@ msgid "" "above literals, instead." msgstr "" -#: ../../library/tkinter.rst:973 +#: ../../library/tkinter.rst:969 msgid "Images" msgstr "" -#: ../../library/tkinter.rst:975 +#: ../../library/tkinter.rst:971 msgid "" "Images of different formats can be created through the corresponding " "subclass of :class:`tkinter.Image`:" msgstr "" -#: ../../library/tkinter.rst:978 +#: ../../library/tkinter.rst:974 msgid ":class:`BitmapImage` for images in XBM format." msgstr "" -#: ../../library/tkinter.rst:980 +#: ../../library/tkinter.rst:976 msgid "" ":class:`PhotoImage` for images in PGM, PPM, GIF and PNG formats. The latter " "is supported starting with Tk 8.6." msgstr "" -#: ../../library/tkinter.rst:983 +#: ../../library/tkinter.rst:979 msgid "" "Either type of image is created through either the ``file`` or the ``data`` " "option (other options are available as well)." msgstr "" -#: ../../library/tkinter.rst:986 +#: ../../library/tkinter.rst:982 +msgid "" +"Added the :class:`!PhotoImage` method :meth:`!copy_replace` to copy a region " +"from one image to other image, possibly with pixel zooming and/or " +"subsampling. Add *from_coords* parameter to :class:`!PhotoImage` methods :" +"meth:`!copy`, :meth:`!zoom` and :meth:`!subsample`. Add *zoom* and " +"*subsample* parameters to :class:`!PhotoImage` method :meth:`!copy`." +msgstr "" + +#: ../../library/tkinter.rst:991 msgid "" "The image object can then be used wherever an ``image`` option is supported " "by some widget (e.g. labels, buttons, menus). In these cases, Tk will not " @@ -1869,24 +1869,24 @@ msgid "" "empty box wherever the image was used." msgstr "" -#: ../../library/tkinter.rst:994 +#: ../../library/tkinter.rst:999 msgid "" "The `Pillow `_ package adds support for formats " "such as BMP, JPEG, TIFF, and WebP, among others." msgstr "" -#: ../../library/tkinter.rst:1000 +#: ../../library/tkinter.rst:1005 msgid "File Handlers" msgstr "" -#: ../../library/tkinter.rst:1002 +#: ../../library/tkinter.rst:1007 msgid "" "Tk allows you to register and unregister a callback function which will be " "called from the Tk mainloop when I/O is possible on a file descriptor. Only " "one handler may be registered per file descriptor. Example code::" msgstr "" -#: ../../library/tkinter.rst:1006 +#: ../../library/tkinter.rst:1011 msgid "" "import tkinter\n" "widget = tkinter.Tk()\n" @@ -1902,11 +1902,11 @@ msgstr "" "...\n" "widget.tk.deletefilehandler(file)" -#: ../../library/tkinter.rst:1013 +#: ../../library/tkinter.rst:1018 msgid "This feature is not available on Windows." msgstr "" -#: ../../library/tkinter.rst:1015 +#: ../../library/tkinter.rst:1020 msgid "" "Since you don't know how many bytes are available for reading, you may not " "want to use the :class:`~io.BufferedIOBase` or :class:`~io.TextIOBase` :meth:" @@ -1917,7 +1917,7 @@ msgid "" "maxbytecount)``." msgstr "" -#: ../../library/tkinter.rst:1026 +#: ../../library/tkinter.rst:1031 msgid "" "Registers the file handler callback function *func*. The *file* argument may " "either be an object with a :meth:`~io.IOBase.fileno` method (such as a file " @@ -1926,30 +1926,33 @@ msgid "" "as follows::" msgstr "" -#: ../../library/tkinter.rst:1032 +#: ../../library/tkinter.rst:1037 msgid "callback(file, mask)" msgstr "callback(file, mask)" -#: ../../library/tkinter.rst:1037 +#: ../../library/tkinter.rst:1042 msgid "Unregisters a file handler." msgstr "" -#: ../../library/tkinter.rst:1044 +#: ../../library/tkinter.rst:1049 msgid "Constants used in the *mask* arguments." msgstr "" -#: ../../library/tkinter.rst:640 +#: ../../library/tkinter.rst:636 msgid "packing (widgets)" msgstr "" -#: ../../library/tkinter.rst:753 +#: ../../library/tkinter.rst:749 msgid "window manager (widgets)" msgstr "" -#: ../../library/tkinter.rst:870 +#: ../../library/tkinter.rst:866 msgid "bind (widgets)" msgstr "" -#: ../../library/tkinter.rst:870 +#: ../../library/tkinter.rst:866 msgid "events (widgets)" msgstr "" + +#~ msgid ":mod:`tkinter.tix`" +#~ msgstr ":mod:`tkinter.tix`" diff --git a/library/tkinter.ttk.po b/library/tkinter.ttk.po index 2497bc1d7a..52ae5a7140 100644 --- a/library/tkinter.ttk.po +++ b/library/tkinter.ttk.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1532,7 +1532,7 @@ msgid "" msgstr "" #: ../../library/tkinter.ttk.rst:987 ../../library/tkinter.ttk.rst:1042 -#: ../../library/tkinter.ttk.rst:1520 +#: ../../library/tkinter.ttk.rst:1578 msgid "The valid options/values are:" msgstr "有效的選項/值為:" @@ -2120,71 +2120,73 @@ msgstr "" #: ../../library/tkinter.ttk.rst:1393 msgid "" "Create a new element in the current theme, of the given *etype* which is " -"expected to be either \"image\" or \"from\"." +"expected to be either \"image\", \"from\" or \"vsapi\". The latter is only " +"available in Tk 8.6 on Windows." msgstr "" -#: ../../library/tkinter.ttk.rst:1396 +#: ../../library/tkinter.ttk.rst:1397 msgid "" "If \"image\" is used, *args* should contain the default image name followed " "by statespec/value pairs (this is the imagespec), and *kw* may have the " "following options:" msgstr "" -#: ../../library/tkinter.ttk.rst:1400 +#: ../../library/tkinter.ttk.rst:1401 msgid "border=padding" msgstr "border=padding" -#: ../../library/tkinter.ttk.rst:1401 +#: ../../library/tkinter.ttk.rst:1402 msgid "" "padding is a list of up to four integers, specifying the left, top, right, " "and bottom borders, respectively." msgstr "" -#: ../../library/tkinter.ttk.rst:1404 +#: ../../library/tkinter.ttk.rst:1405 ../../library/tkinter.ttk.rst:1479 msgid "height=height" msgstr "height=height" -#: ../../library/tkinter.ttk.rst:1405 +#: ../../library/tkinter.ttk.rst:1406 msgid "" "Specifies a minimum height for the element. If less than zero, the base " "image's height is used as a default." msgstr "" -#: ../../library/tkinter.ttk.rst:1408 +#: ../../library/tkinter.ttk.rst:1409 ../../library/tkinter.ttk.rst:1453 msgid "padding=padding" msgstr "padding=padding" -#: ../../library/tkinter.ttk.rst:1409 +#: ../../library/tkinter.ttk.rst:1410 msgid "" "Specifies the element's interior padding. Defaults to border's value if not " "specified." msgstr "" -#: ../../library/tkinter.ttk.rst:1412 +#: ../../library/tkinter.ttk.rst:1413 msgid "sticky=spec" msgstr "sticky=spec" -#: ../../library/tkinter.ttk.rst:1413 +#: ../../library/tkinter.ttk.rst:1414 msgid "" "Specifies how the image is placed within the final parcel. spec contains " "zero or more characters \"n\", \"s\", \"w\", or \"e\"." msgstr "" -#: ../../library/tkinter.ttk.rst:1416 +#: ../../library/tkinter.ttk.rst:1417 ../../library/tkinter.ttk.rst:1471 msgid "width=width" msgstr "width=width" -#: ../../library/tkinter.ttk.rst:1417 +#: ../../library/tkinter.ttk.rst:1418 msgid "" "Specifies a minimum width for the element. If less than zero, the base " "image's width is used as a default." msgstr "" -#: ../../library/tkinter.ttk.rst:1420 ../../library/tkinter.ttk.rst:1437 +#: ../../library/tkinter.ttk.rst:1421 ../../library/tkinter.ttk.rst:1438 +#: ../../library/tkinter.ttk.rst:1483 msgid "Example::" msgstr "範例: ::" -#: ../../library/tkinter.ttk.rst:1422 +#: ../../library/tkinter.ttk.rst:1423 msgid "" "img1 = tkinter.PhotoImage(master=root, file='button.png')\n" "img1 = tkinter.PhotoImage(master=root, file='button-pressed.png')\n" @@ -2202,7 +2204,7 @@ msgstr "" " img1, ('pressed', img2), ('active', img3),\n" " border=(2, 4), sticky='we')" -#: ../../library/tkinter.ttk.rst:1430 +#: ../../library/tkinter.ttk.rst:1431 msgid "" "If \"from\" is used as the value of *etype*, :meth:`element_create` will " "clone an existing element. *args* is expected to contain a themename, from " @@ -2211,7 +2213,7 @@ msgid "" "used. *kw* is discarded." msgstr "" -#: ../../library/tkinter.ttk.rst:1439 +#: ../../library/tkinter.ttk.rst:1440 msgid "" "style = ttk.Style(root)\n" "style.element_create('plain.background', 'from', 'default')" @@ -2219,19 +2221,86 @@ msgstr "" "style = ttk.Style(root)\n" "style.element_create('plain.background', 'from', 'default')" -#: ../../library/tkinter.ttk.rst:1445 +#: ../../library/tkinter.ttk.rst:1443 +msgid "" +"If \"vsapi\" is used as the value of *etype*, :meth:`element_create` will " +"create a new element in the current theme whose visual appearance is drawn " +"using the Microsoft Visual Styles API which is responsible for the themed " +"styles on Windows XP and Vista. *args* is expected to contain the Visual " +"Styles class and part as given in the Microsoft documentation followed by an " +"optional sequence of tuples of ttk states and the corresponding Visual " +"Styles API state value. *kw* may have the following options:" +msgstr "" + +#: ../../library/tkinter.ttk.rst:1454 +msgid "" +"Specify the element's interior padding. *padding* is a list of up to four " +"integers specifying the left, top, right and bottom padding quantities " +"respectively. If fewer than four elements are specified, bottom defaults to " +"top, right defaults to left, and top defaults to left. In other words, a " +"list of three numbers specify the left, vertical, and right padding; a list " +"of two numbers specify the horizontal and the vertical padding; a single " +"number specifies the same padding all the way around the widget. This option " +"may not be mixed with any other options." +msgstr "" + +#: ../../library/tkinter.ttk.rst:1465 +#, fuzzy +msgid "margins=padding" +msgstr "padding=padding" + +#: ../../library/tkinter.ttk.rst:1466 +msgid "" +"Specifies the elements exterior padding. *padding* is a list of up to four " +"integers specifying the left, top, right and bottom padding quantities " +"respectively. This option may not be mixed with any other options." +msgstr "" + +#: ../../library/tkinter.ttk.rst:1472 +msgid "" +"Specifies the width for the element. If this option is set then the Visual " +"Styles API will not be queried for the recommended size or the part. If this " +"option is set then *height* should also be set. The *width* and *height* " +"options cannot be mixed with the *padding* or *margins* options." +msgstr "" + +#: ../../library/tkinter.ttk.rst:1480 +msgid "Specifies the height of the element. See the comments for *width*." +msgstr "" + +#: ../../library/tkinter.ttk.rst:1485 +msgid "" +"style = ttk.Style(root)\n" +"style.element_create('pin', 'vsapi', 'EXPLORERBAR', 3, [\n" +" ('pressed', '!selected', 3),\n" +" ('active', '!selected', 2),\n" +" ('pressed', 'selected', 6),\n" +" ('active', 'selected', 5),\n" +" ('selected', 4),\n" +" ('', 1)])\n" +"style.layout('Explorer.Pin',\n" +" [('Explorer.Pin.pin', {'sticky': 'news'})])\n" +"pin = ttk.Checkbutton(style='Explorer.Pin')\n" +"pin.pack(expand=True, fill='both')" +msgstr "" + +#: ../../library/tkinter.ttk.rst:1498 +msgid "Added support of the \"vsapi\" element factory." +msgstr "" + +#: ../../library/tkinter.ttk.rst:1503 msgid "Returns the list of elements defined in the current theme." msgstr "" -#: ../../library/tkinter.ttk.rst:1450 +#: ../../library/tkinter.ttk.rst:1508 msgid "Returns the list of *elementname*'s options." msgstr "" -#: ../../library/tkinter.ttk.rst:1455 +#: ../../library/tkinter.ttk.rst:1513 msgid "Create a new theme." msgstr "" -#: ../../library/tkinter.ttk.rst:1457 +#: ../../library/tkinter.ttk.rst:1515 msgid "" "It is an error if *themename* already exists. If *parent* is specified, the " "new theme will inherit styles, elements and layouts from the parent theme. " @@ -2239,13 +2308,13 @@ msgid "" "for :meth:`theme_settings`." msgstr "" -#: ../../library/tkinter.ttk.rst:1465 +#: ../../library/tkinter.ttk.rst:1523 msgid "" "Temporarily sets the current theme to *themename*, apply specified " "*settings* and then restore the previous theme." msgstr "" -#: ../../library/tkinter.ttk.rst:1468 +#: ../../library/tkinter.ttk.rst:1526 msgid "" "Each key in *settings* is a style and each value may contain the keys " "'configure', 'map', 'layout' and 'element create' and they are expected to " @@ -2254,11 +2323,11 @@ msgid "" "respectively." msgstr "" -#: ../../library/tkinter.ttk.rst:1474 +#: ../../library/tkinter.ttk.rst:1532 msgid "As an example, let's change the Combobox for the default theme a bit::" msgstr "" -#: ../../library/tkinter.ttk.rst:1476 +#: ../../library/tkinter.ttk.rst:1534 msgid "" "from tkinter import ttk\n" "import tkinter\n" @@ -2306,22 +2375,22 @@ msgstr "" "\n" "root.mainloop()" -#: ../../library/tkinter.ttk.rst:1502 +#: ../../library/tkinter.ttk.rst:1560 msgid "Returns a list of all known themes." msgstr "回傳所有已知的主題。" -#: ../../library/tkinter.ttk.rst:1507 +#: ../../library/tkinter.ttk.rst:1565 msgid "" "If *themename* is not given, returns the theme in use. Otherwise, sets the " "current theme to *themename*, refreshes all widgets and emits a " "<> event." msgstr "" -#: ../../library/tkinter.ttk.rst:1513 +#: ../../library/tkinter.ttk.rst:1571 msgid "Layouts" msgstr "" -#: ../../library/tkinter.ttk.rst:1515 +#: ../../library/tkinter.ttk.rst:1573 msgid "" "A layout can be just ``None``, if it takes no options, or a dict of options " "specifying how to arrange the element. The layout mechanism uses a " @@ -2329,40 +2398,40 @@ msgid "" "each element is allocated a parcel." msgstr "" -#: ../../library/tkinter.ttk.rst:1522 +#: ../../library/tkinter.ttk.rst:1580 msgid "*side*: whichside" msgstr "" -#: ../../library/tkinter.ttk.rst:1523 +#: ../../library/tkinter.ttk.rst:1581 msgid "" "Specifies which side of the cavity to place the element; one of top, right, " "bottom or left. If omitted, the element occupies the entire cavity." msgstr "" -#: ../../library/tkinter.ttk.rst:1527 +#: ../../library/tkinter.ttk.rst:1585 msgid "*sticky*: nswe" msgstr "" -#: ../../library/tkinter.ttk.rst:1528 +#: ../../library/tkinter.ttk.rst:1586 msgid "Specifies where the element is placed inside its allocated parcel." msgstr "" -#: ../../library/tkinter.ttk.rst:1530 +#: ../../library/tkinter.ttk.rst:1588 msgid "*unit*: 0 or 1" msgstr "*unit*:0 或 1" -#: ../../library/tkinter.ttk.rst:1531 +#: ../../library/tkinter.ttk.rst:1589 msgid "" "If set to 1, causes the element and all of its descendants to be treated as " "a single element for the purposes of :meth:`Widget.identify` et al. It's " "used for things like scrollbar thumbs with grips." msgstr "" -#: ../../library/tkinter.ttk.rst:1535 +#: ../../library/tkinter.ttk.rst:1593 msgid "*children*: [sublayout... ]" msgstr "" -#: ../../library/tkinter.ttk.rst:1536 +#: ../../library/tkinter.ttk.rst:1594 msgid "" "Specifies a list of elements to place inside the element. Each element is a " "tuple (or other sequence type) where the first item is the layout name, and " diff --git a/library/token.po b/library/token.po index 063d07f920..bd30000c13 100644 --- a/library/token.po +++ b/library/token.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-30 18:24+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -288,7 +288,7 @@ msgid "" msgstr "" #: ../../library/token.rst:82 -msgid "Added :data:`AWAIT` and :data:`ASYNC` tokens." +msgid "Added :data:`!AWAIT` and :data:`!ASYNC` tokens." msgstr "" #: ../../library/token.rst:85 @@ -297,14 +297,18 @@ msgstr "" #: ../../library/token.rst:88 msgid "" -"Removed :data:`AWAIT` and :data:`ASYNC` tokens. \"async\" and \"await\" are " -"now tokenized as :data:`NAME` tokens." +"Removed :data:`!AWAIT` and :data:`!ASYNC` tokens. \"async\" and \"await\" " +"are now tokenized as :data:`NAME` tokens." msgstr "" #: ../../library/token.rst:92 msgid "" "Added :data:`TYPE_COMMENT`, :data:`TYPE_IGNORE`, :data:`COLONEQUAL`. Added :" -"data:`AWAIT` and :data:`ASYNC` tokens back (they're needed to support " +"data:`!AWAIT` and :data:`!ASYNC` tokens back (they're needed to support " "parsing older Python versions for :func:`ast.parse` with ``feature_version`` " "set to 6 or lower)." msgstr "" + +#: ../../library/token.rst:98 +msgid "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens again." +msgstr "" diff --git a/library/tomllib.po b/library/tomllib.po index e2c41e707a..438b4e5eb0 100644 --- a/library/tomllib.po +++ b/library/tomllib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-11 21:40+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-11-18 01:56+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,10 +27,11 @@ msgid "**Source code:** :source:`Lib/tomllib`" msgstr "**原始碼:**\\ :source:`Lib/tomllib`" #: ../../library/tomllib.rst:16 +#, fuzzy msgid "" -"This module provides an interface for parsing TOML 1.0.0 (Tom's Obvious " -"Minimal Language, `https://toml.io `_). This module " -"does not support writing TOML." +"This module provides an interface for parsing TOML (Tom's Obvious Minimal " +"Language, `https://toml.io `_). This module does not " +"support writing TOML." msgstr "" "此模組提供了剖析 TOML 1.0.0 (Tom's Obvious Minimal Language, `https://toml." "io `_) 的一個介面,此模組並不支援寫入 TOML。" diff --git a/library/trace.po b/library/trace.po index 8b5970193c..6149b689ae 100644 --- a/library/trace.po +++ b/library/trace.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -232,7 +232,7 @@ msgstr "" msgid "Merge in data from another :class:`CoverageResults` object." msgstr "" -#: ../../library/trace.rst:192 +#: ../../library/trace.rst:193 msgid "" "Write coverage results. Set *show_missing* to show lines that had no hits. " "Set *summary* to include in the output the coverage summary per module. " @@ -241,11 +241,22 @@ msgid "" "directory." msgstr "" -#: ../../library/trace.rst:198 +#: ../../library/trace.rst:199 +msgid "" +"If *ignore_missing_files* is ``True``, coverage counts for files that no " +"longer exist are silently ignored. Otherwise, a missing file will raise a :" +"exc:`FileNotFoundError`." +msgstr "" + +#: ../../library/trace.rst:203 +msgid "Added *ignore_missing_files* parameter." +msgstr "" + +#: ../../library/trace.rst:206 msgid "A simple example demonstrating the use of the programmatic interface::" msgstr "" -#: ../../library/trace.rst:200 +#: ../../library/trace.rst:208 msgid "" "import sys\n" "import trace\n" diff --git a/library/traceback.po b/library/traceback.po index aacd761710..5d2a56c436 100644 --- a/library/traceback.po +++ b/library/traceback.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -128,11 +128,11 @@ msgid "" "when printing an unhandled exception." msgstr "" -#: ../../library/traceback.rst:87 ../../library/traceback.rst:184 +#: ../../library/traceback.rst:87 ../../library/traceback.rst:191 msgid "The *etype* argument is ignored and inferred from the type of *value*." msgstr "" -#: ../../library/traceback.rst:90 ../../library/traceback.rst:167 +#: ../../library/traceback.rst:90 ../../library/traceback.rst:171 msgid "" "The *etype* parameter has been renamed to *exc* and is now positional-only." msgstr "" @@ -209,13 +209,24 @@ msgid "" "ignored in order to provide backwards compatibility." msgstr "" -#: ../../library/traceback.rst:171 +#: ../../library/traceback.rst:167 ../../library/traceback.rst:394 +msgid "" +"When *show_group* is ``True``, and the exception is an instance of :exc:" +"`BaseExceptionGroup`, the nested exceptions are included as well, " +"recursively, with indentation relative to their nesting depth." +msgstr "" + +#: ../../library/traceback.rst:175 msgid "" "The returned list now includes any :attr:`notes ` " "attached to the exception." msgstr "" -#: ../../library/traceback.rst:178 +#: ../../library/traceback.rst:179 +msgid "*show_group* parameter was added." +msgstr "" + +#: ../../library/traceback.rst:185 msgid "" "Format a stack trace and the exception information. The arguments have the " "same meaning as the corresponding arguments to :func:`print_exception`. The " @@ -224,68 +235,68 @@ msgid "" "printed, exactly the same text is printed as does :func:`print_exception`." msgstr "" -#: ../../library/traceback.rst:187 +#: ../../library/traceback.rst:194 msgid "" "This function's behavior and signature were modified to match :func:" "`print_exception`." msgstr "" -#: ../../library/traceback.rst:194 +#: ../../library/traceback.rst:201 msgid "" "This is like ``print_exc(limit)`` but returns a string instead of printing " "to a file." msgstr "" -#: ../../library/traceback.rst:200 +#: ../../library/traceback.rst:207 msgid "A shorthand for ``format_list(extract_tb(tb, limit))``." msgstr "``format_list(extract_tb(tb, limit))`` 的簡寫。" -#: ../../library/traceback.rst:205 +#: ../../library/traceback.rst:212 msgid "A shorthand for ``format_list(extract_stack(f, limit))``." msgstr "``format_list(extract_stack(f, limit))`` 的簡寫。" -#: ../../library/traceback.rst:209 +#: ../../library/traceback.rst:216 msgid "" "Clears the local variables of all the stack frames in a :ref:`traceback " "` *tb* by calling the :meth:`~frame.clear` method of " "each :ref:`frame object `." msgstr "" -#: ../../library/traceback.rst:218 +#: ../../library/traceback.rst:225 msgid "" "Walk a stack following :attr:`f.f_back ` from the given frame, " "yielding the frame and line number for each frame. If *f* is ``None``, the " "current stack is used. This helper is used with :meth:`StackSummary.extract`." msgstr "" -#: ../../library/traceback.rst:227 +#: ../../library/traceback.rst:234 msgid "" "Walk a traceback following :attr:`~traceback.tb_next` yielding the frame and " "line number for each frame. This helper is used with :meth:`StackSummary." "extract`." msgstr "" -#: ../../library/traceback.rst:233 +#: ../../library/traceback.rst:240 msgid "The module also defines the following classes:" msgstr "" -#: ../../library/traceback.rst:236 +#: ../../library/traceback.rst:243 msgid ":class:`!TracebackException` Objects" msgstr ":class:`!TracebackException` 物件" -#: ../../library/traceback.rst:240 +#: ../../library/traceback.rst:247 msgid "" ":class:`!TracebackException` objects are created from actual exceptions to " "capture data for later printing in a lightweight fashion." msgstr "" -#: ../../library/traceback.rst:245 ../../library/traceback.rst:344 +#: ../../library/traceback.rst:252 ../../library/traceback.rst:359 msgid "" "Capture an exception for later rendering. *limit*, *lookup_lines* and " "*capture_locals* are as for the :class:`StackSummary` class." msgstr "" -#: ../../library/traceback.rst:248 +#: ../../library/traceback.rst:255 msgid "" "If *compact* is true, only data that is required by :class:`!" "TracebackException`'s :meth:`format` method is saved in the class " @@ -293,12 +304,12 @@ msgid "" "if :attr:`__cause__` is ``None`` and :attr:`__suppress_context__` is false." msgstr "" -#: ../../library/traceback.rst:254 ../../library/traceback.rst:347 +#: ../../library/traceback.rst:261 ../../library/traceback.rst:362 msgid "" "Note that when locals are captured, they are also shown in the traceback." msgstr "" -#: ../../library/traceback.rst:256 +#: ../../library/traceback.rst:263 msgid "" "*max_group_width* and *max_group_depth* control the formatting of exception " "groups (see :exc:`BaseExceptionGroup`). The depth refers to the nesting " @@ -307,147 +318,157 @@ msgid "" "limit is exceeded." msgstr "" -#: ../../library/traceback.rst:262 +#: ../../library/traceback.rst:269 msgid "Added the *compact* parameter." msgstr "新增 *compact* 參數。" -#: ../../library/traceback.rst:265 +#: ../../library/traceback.rst:272 msgid "Added the *max_group_width* and *max_group_depth* parameters." msgstr "新增 *max_group_width* 和 *max_group_depth* 參數。" -#: ../../library/traceback.rst:270 +#: ../../library/traceback.rst:277 msgid "" "A :class:`!TracebackException` of the original :attr:`~BaseException." "__cause__`." msgstr "" -#: ../../library/traceback.rst:275 +#: ../../library/traceback.rst:282 msgid "" "A :class:`!TracebackException` of the original :attr:`~BaseException." "__context__`." msgstr "" -#: ../../library/traceback.rst:280 +#: ../../library/traceback.rst:287 msgid "" "If ``self`` represents an :exc:`ExceptionGroup`, this field holds a list of :" "class:`!TracebackException` instances representing the nested exceptions. " "Otherwise it is ``None``." msgstr "" -#: ../../library/traceback.rst:288 +#: ../../library/traceback.rst:295 msgid "" "The :attr:`~BaseException.__suppress_context__` value from the original " "exception." msgstr "" -#: ../../library/traceback.rst:293 +#: ../../library/traceback.rst:300 msgid "" "The :attr:`~BaseException.__notes__` value from the original exception, or " "``None`` if the exception does not have any notes. If it is not ``None`` is " "it formatted in the traceback after the exception string." msgstr "" -#: ../../library/traceback.rst:302 +#: ../../library/traceback.rst:309 msgid "A :class:`StackSummary` representing the traceback." msgstr "" -#: ../../library/traceback.rst:306 +#: ../../library/traceback.rst:313 msgid "The class of the original traceback." msgstr "" -#: ../../library/traceback.rst:310 +#: ../../library/traceback.rst:319 +msgid "String display of the class of the original exception." +msgstr "" + +#: ../../library/traceback.rst:325 msgid "For syntax errors - the file name where the error occurred." msgstr "" -#: ../../library/traceback.rst:314 +#: ../../library/traceback.rst:329 msgid "For syntax errors - the line number where the error occurred." msgstr "" -#: ../../library/traceback.rst:318 +#: ../../library/traceback.rst:333 msgid "" "For syntax errors - the end line number where the error occurred. Can be " "``None`` if not present." msgstr "" -#: ../../library/traceback.rst:325 +#: ../../library/traceback.rst:340 msgid "For syntax errors - the text where the error occurred." msgstr "" -#: ../../library/traceback.rst:329 +#: ../../library/traceback.rst:344 msgid "For syntax errors - the offset into the text where the error occurred." msgstr "" -#: ../../library/traceback.rst:333 +#: ../../library/traceback.rst:348 msgid "" "For syntax errors - the end offset into the text where the error occurred. " "Can be ``None`` if not present." msgstr "" -#: ../../library/traceback.rst:340 +#: ../../library/traceback.rst:355 msgid "For syntax errors - the compiler error message." msgstr "" -#: ../../library/traceback.rst:351 +#: ../../library/traceback.rst:366 msgid "" "Print to *file* (default ``sys.stderr``) the exception information returned " "by :meth:`format`." msgstr "" -#: ../../library/traceback.rst:358 +#: ../../library/traceback.rst:373 msgid "Format the exception." msgstr "" -#: ../../library/traceback.rst:360 +#: ../../library/traceback.rst:375 msgid "" "If *chain* is not ``True``, :attr:`__cause__` and :attr:`__context__` will " "not be formatted." msgstr "" -#: ../../library/traceback.rst:363 +#: ../../library/traceback.rst:378 msgid "" "The return value is a generator of strings, each ending in a newline and " "some containing internal newlines. :func:`~traceback.print_exception` is a " "wrapper around this method which just prints the lines to a file." msgstr "" -#: ../../library/traceback.rst:369 +#: ../../library/traceback.rst:384 msgid "Format the exception part of the traceback." msgstr "" -#: ../../library/traceback.rst:371 +#: ../../library/traceback.rst:386 msgid "The return value is a generator of strings, each ending in a newline." msgstr "" -#: ../../library/traceback.rst:373 +#: ../../library/traceback.rst:388 msgid "" -"The generator emits the exception's message followed by its notes (if it has " -"any). The exception message is normally a single string; however, for :exc:" -"`SyntaxError` exceptions, it consists of several lines that (when printed) " -"display detailed information about where the syntax error occurred." +"When *show_group* is ``False``, the generator emits the exception's message " +"followed by its notes (if it has any). The exception message is normally a " +"single string; however, for :exc:`SyntaxError` exceptions, it consists of " +"several lines that (when printed) display detailed information about where " +"the syntax error occurred." msgstr "" -#: ../../library/traceback.rst:379 +#: ../../library/traceback.rst:398 msgid "" "The exception's :attr:`notes ` are now included in " "the output." msgstr "" -#: ../../library/traceback.rst:386 +#: ../../library/traceback.rst:402 +#, fuzzy +msgid "Added the *show_group* parameter." +msgstr "新增 *compact* 參數。" + +#: ../../library/traceback.rst:407 msgid ":class:`!StackSummary` Objects" msgstr ":class:`!StackSummary` 物件" -#: ../../library/traceback.rst:390 +#: ../../library/traceback.rst:411 msgid "" ":class:`!StackSummary` objects represent a call stack ready for formatting." msgstr "" -#: ../../library/traceback.rst:396 +#: ../../library/traceback.rst:417 msgid "" "Construct a :class:`!StackSummary` object from a frame generator (such as is " "returned by :func:`~traceback.walk_stack` or :func:`~traceback.walk_tb`)." msgstr "" -#: ../../library/traceback.rst:400 +#: ../../library/traceback.rst:421 msgid "" "If *limit* is supplied, only this many frames are taken from *frame_gen*. If " "*lookup_lines* is ``False``, the returned :class:`FrameSummary` objects will " @@ -457,20 +478,20 @@ msgid "" "class:`!FrameSummary` are captured as object representations." msgstr "" -#: ../../library/traceback.rst:408 +#: ../../library/traceback.rst:429 msgid "" "Exceptions raised from :func:`repr` on a local variable (when " "*capture_locals* is ``True``) are no longer propagated to the caller." msgstr "" -#: ../../library/traceback.rst:414 +#: ../../library/traceback.rst:435 msgid "" "Construct a :class:`!StackSummary` object from a supplied list of :class:" "`FrameSummary` objects or old-style list of tuples. Each tuple should be a " "4-tuple with *filename*, *lineno*, *name*, *line* as the elements." msgstr "" -#: ../../library/traceback.rst:421 +#: ../../library/traceback.rst:442 msgid "" "Returns a list of strings ready for printing. Each string in the resulting " "list corresponds to a single :ref:`frame ` from the stack. " @@ -478,18 +499,18 @@ msgid "" "well, for those items with source text lines." msgstr "" -#: ../../library/traceback.rst:427 +#: ../../library/traceback.rst:448 msgid "" "For long sequences of the same frame and line, the first few repetitions are " "shown, followed by a summary line stating the exact number of further " "repetitions." msgstr "" -#: ../../library/traceback.rst:431 +#: ../../library/traceback.rst:452 msgid "Long sequences of repeated frames are now abbreviated." msgstr "" -#: ../../library/traceback.rst:436 +#: ../../library/traceback.rst:457 msgid "" "Returns a string for printing one of the :ref:`frames ` " "involved in the stack. This method is called for each :class:`FrameSummary` " @@ -497,17 +518,17 @@ msgid "" "the frame is omitted from the output." msgstr "" -#: ../../library/traceback.rst:446 +#: ../../library/traceback.rst:467 msgid ":class:`!FrameSummary` Objects" msgstr ":class:`!FrameSummary` 物件" -#: ../../library/traceback.rst:450 +#: ../../library/traceback.rst:471 msgid "" "A :class:`!FrameSummary` object represents a single :ref:`frame ` in a :ref:`traceback `." msgstr "" -#: ../../library/traceback.rst:455 +#: ../../library/traceback.rst:476 msgid "" "Represents a single :ref:`frame ` in the :ref:`traceback " "` or stack that is being formatted or printed. It may " @@ -516,43 +537,43 @@ msgid "" "class:`!FrameSummary` has the :attr:`~FrameSummary.line` attribute accessed " "(which also happens when casting it to a :class:`tuple`). :attr:" "`~FrameSummary.line` may be directly provided, and will prevent line lookups " -"happening at all. *locals* is an optional local variable dictionary, and if " +"happening at all. *locals* is an optional local variable mapping, and if " "supplied the variable representations are stored in the summary for later " "display." msgstr "" -#: ../../library/traceback.rst:466 +#: ../../library/traceback.rst:487 msgid ":class:`!FrameSummary` instances have the following attributes:" msgstr "" -#: ../../library/traceback.rst:470 +#: ../../library/traceback.rst:491 msgid "" "The filename of the source code for this frame. Equivalent to accessing :" "attr:`f.f_code.co_filename ` on a :ref:`frame object " "` *f*." msgstr "" -#: ../../library/traceback.rst:476 +#: ../../library/traceback.rst:497 msgid "The line number of the source code for this frame." msgstr "" -#: ../../library/traceback.rst:480 +#: ../../library/traceback.rst:501 msgid "" "Equivalent to accessing :attr:`f.f_code.co_name ` on a :" "ref:`frame object ` *f*." msgstr "" -#: ../../library/traceback.rst:485 +#: ../../library/traceback.rst:506 msgid "" "A string representing the source code for this frame, with leading and " "trailing whitespace stripped. If the source is not available, it is ``None``." msgstr "" -#: ../../library/traceback.rst:492 +#: ../../library/traceback.rst:513 msgid "Traceback Examples" msgstr "" -#: ../../library/traceback.rst:494 +#: ../../library/traceback.rst:515 msgid "" "This simple example implements a basic read-eval-print loop, similar to (but " "less useful than) the standard Python interactive interpreter loop. For a " @@ -560,7 +581,7 @@ msgid "" "`code` module. ::" msgstr "" -#: ../../library/traceback.rst:499 +#: ../../library/traceback.rst:520 msgid "" "import sys, traceback\n" "\n" @@ -579,13 +600,13 @@ msgid "" " run_user_code(envdir)" msgstr "" -#: ../../library/traceback.rst:516 +#: ../../library/traceback.rst:537 msgid "" "The following example demonstrates the different ways to print and format " "the exception and traceback:" msgstr "" -#: ../../library/traceback.rst:519 +#: ../../library/traceback.rst:540 msgid "" "import sys, traceback\n" "\n" @@ -618,28 +639,33 @@ msgid "" " print(\"*** tb_lineno:\", exc.__traceback__.tb_lineno)" msgstr "" -#: ../../library/traceback.rst:551 +#: ../../library/traceback.rst:572 msgid "The output for the example would look similar to this:" msgstr "" -#: ../../library/traceback.rst:553 +#: ../../library/traceback.rst:574 msgid "" "*** print_tb:\n" " File \"\", line 10, in \n" " lumberjack()\n" +" ~~~~~~~~~~^^\n" "*** print_exception:\n" "Traceback (most recent call last):\n" " File \"\", line 10, in \n" " lumberjack()\n" +" ~~~~~~~~~~^^\n" " File \"\", line 4, in lumberjack\n" " bright_side_of_life()\n" +" ~~~~~~~~~~~~~~~~~~~^^\n" "IndexError: tuple index out of range\n" "*** print_exc:\n" "Traceback (most recent call last):\n" " File \"\", line 10, in \n" " lumberjack()\n" +" ~~~~~~~~~~^^\n" " File \"\", line 4, in lumberjack\n" " bright_side_of_life()\n" +" ~~~~~~~~~~~~~~~~~~~^^\n" "IndexError: tuple index out of range\n" "*** format_exc, first and last line:\n" "Traceback (most recent call last):\n" @@ -647,9 +673,9 @@ msgid "" "*** format_exception:\n" "['Traceback (most recent call last):\\n',\n" " ' File \"\", line 10, in \\n " -"lumberjack()\\n',\n" +"lumberjack()\\n ~~~~~~~~~~^^\\n',\n" " ' File \"\", line 4, in lumberjack\\n " -"bright_side_of_life()\\n',\n" +"bright_side_of_life()\\n ~~~~~~~~~~~~~~~~~~~^^\\n',\n" " ' File \"\", line 7, in bright_side_of_life\\n " "return tuple()[0]\\n ~~~~~~~^^^\\n',\n" " 'IndexError: tuple index out of range\\n']\n" @@ -659,21 +685,21 @@ msgid "" " , line 7 in bright_side_of_life>]\n" "*** format_tb:\n" "[' File \"\", line 10, in \\n " -"lumberjack()\\n',\n" +"lumberjack()\\n ~~~~~~~~~~^^\\n',\n" " ' File \"\", line 4, in lumberjack\\n " -"bright_side_of_life()\\n',\n" +"bright_side_of_life()\\n ~~~~~~~~~~~~~~~~~~~^^\\n',\n" " ' File \"\", line 7, in bright_side_of_life\\n " "return tuple()[0]\\n ~~~~~~~^^^\\n']\n" "*** tb_lineno: 10" msgstr "" -#: ../../library/traceback.rst:593 +#: ../../library/traceback.rst:619 msgid "" "The following example shows the different ways to print and format the " "stack::" msgstr "" -#: ../../library/traceback.rst:595 +#: ../../library/traceback.rst:621 msgid "" ">>> import traceback\n" ">>> def another_function():\n" @@ -725,11 +751,11 @@ msgstr "" " ' File \"\", line 8, in lumberstack\\n print(repr(traceback." "format_stack()))\\n']" -#: ../../library/traceback.rst:619 +#: ../../library/traceback.rst:645 msgid "This last example demonstrates the final few formatting functions:" msgstr "" -#: ../../library/traceback.rst:621 +#: ../../library/traceback.rst:647 msgid "" ">>> import traceback\n" ">>> traceback.format_list([('spam.py', 3, '', 'spam.eggs()'),\n" diff --git a/library/turtle.po b/library/turtle.po index 64b4995071..3a6d1eb7aa 100644 --- a/library/turtle.po +++ b/library/turtle.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,25 +41,38 @@ msgstr "" "org/wiki/Turtle_ (robot)>`_。" #: ../../library/turtle.rst:29 +msgid "Get started" +msgstr "" + +#: ../../library/turtle.rst:31 +msgid "" +"Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an " +"``import turtle``, give it the command ``turtle.forward(15)``, and it moves " +"(on-screen!) 15 pixels in the direction it is facing, drawing a line as it " +"moves. Give it the command ``turtle.right(25)``, and it rotates in-place 25 " +"degrees clockwise." +msgstr "" + +#: ../../library/turtle.rst:38 msgid "" "Turtle can draw intricate shapes using programs that repeat simple moves." msgstr "龜可以使用重複簡單動作之程式來畫出複雜的形狀。" -#: ../../library/turtle.rst:35 +#: ../../library/turtle.rst:44 msgid "" "In Python, turtle graphics provides a representation of a physical " "\"turtle\" (a little robot with a pen) that draws on a sheet of paper on the " "floor." msgstr "" -#: ../../library/turtle.rst:38 +#: ../../library/turtle.rst:47 msgid "" "It's an effective and well-proven way for learners to encounter programming " "concepts and interaction with software, as it provides instant, visible " "feedback. It also provides convenient access to graphical output in general." msgstr "" -#: ../../library/turtle.rst:43 +#: ../../library/turtle.rst:52 msgid "" "Turtle drawing was originally created as an educational tool, to be used by " "teachers in the classroom. For the programmer who needs to produce some " @@ -67,62 +80,62 @@ msgid "" "introducing more complex or external libraries into their work." msgstr "" -#: ../../library/turtle.rst:52 +#: ../../library/turtle.rst:61 msgid "Tutorial" msgstr "教學" -#: ../../library/turtle.rst:54 +#: ../../library/turtle.rst:63 msgid "" "New users should start here. In this tutorial we'll explore some of the " "basics of turtle drawing." msgstr "" -#: ../../library/turtle.rst:59 +#: ../../library/turtle.rst:68 msgid "Starting a turtle environment" msgstr "啟動一個烏龜環境" -#: ../../library/turtle.rst:61 +#: ../../library/turtle.rst:70 msgid "In a Python shell, import all the objects of the ``turtle`` module::" msgstr "在 Python shell 中,引入 ``turtle`` 模組中所有物件: ::" -#: ../../library/turtle.rst:63 +#: ../../library/turtle.rst:72 msgid "from turtle import *" msgstr "from turtle import *" -#: ../../library/turtle.rst:65 +#: ../../library/turtle.rst:74 msgid "" "If you run into a ``No module named '_tkinter'`` error, you'll have to " "install the :mod:`Tk interface package ` on your system." msgstr "" -#: ../../library/turtle.rst:70 +#: ../../library/turtle.rst:79 msgid "Basic drawing" msgstr "基本繪圖" -#: ../../library/turtle.rst:72 +#: ../../library/turtle.rst:81 msgid "Send the turtle forward 100 steps::" msgstr "" -#: ../../library/turtle.rst:74 +#: ../../library/turtle.rst:83 msgid "forward(100)" msgstr "forward(100)" -#: ../../library/turtle.rst:76 +#: ../../library/turtle.rst:85 msgid "" "You should see (most likely, in a new window on your display) a line drawn " "by the turtle, heading East. Change the direction of the turtle, so that it " "turns 120 degrees left (anti-clockwise)::" msgstr "" -#: ../../library/turtle.rst:80 +#: ../../library/turtle.rst:89 msgid "left(120)" msgstr "left(120)" -#: ../../library/turtle.rst:82 +#: ../../library/turtle.rst:91 msgid "Let's continue by drawing a triangle::" msgstr "" -#: ../../library/turtle.rst:84 +#: ../../library/turtle.rst:93 msgid "" "forward(100)\n" "left(120)\n" @@ -132,81 +145,81 @@ msgstr "" "left(120)\n" "forward(100)" -#: ../../library/turtle.rst:88 +#: ../../library/turtle.rst:97 msgid "" "Notice how the turtle, represented by an arrow, points in different " "directions as you steer it." msgstr "" -#: ../../library/turtle.rst:91 +#: ../../library/turtle.rst:100 msgid "" "Experiment with those commands, and also with ``backward()`` and ``right()``." msgstr "" -#: ../../library/turtle.rst:96 ../../library/turtle.rst:325 -#: ../../library/turtle.rst:1016 +#: ../../library/turtle.rst:105 ../../library/turtle.rst:334 +#: ../../library/turtle.rst:1024 msgid "Pen control" msgstr "" -#: ../../library/turtle.rst:98 +#: ../../library/turtle.rst:107 msgid "" "Try changing the color - for example, ``color('blue')`` - and width of the " "line - for example, ``width(3)`` - and then drawing again." msgstr "" -#: ../../library/turtle.rst:101 +#: ../../library/turtle.rst:110 msgid "" "You can also move the turtle around without drawing, by lifting up the pen: " "``up()`` before moving. To start drawing again, use ``down()``." msgstr "" -#: ../../library/turtle.rst:106 +#: ../../library/turtle.rst:115 msgid "The turtle's position" msgstr "" -#: ../../library/turtle.rst:108 +#: ../../library/turtle.rst:117 msgid "" "Send your turtle back to its starting-point (useful if it has disappeared " "off-screen)::" msgstr "" -#: ../../library/turtle.rst:111 +#: ../../library/turtle.rst:120 msgid "home()" msgstr "home()" -#: ../../library/turtle.rst:113 +#: ../../library/turtle.rst:122 msgid "" "The home position is at the center of the turtle's screen. If you ever need " "to know them, get the turtle's x-y coordinates with::" msgstr "" -#: ../../library/turtle.rst:116 +#: ../../library/turtle.rst:125 msgid "pos()" msgstr "pos()" -#: ../../library/turtle.rst:118 +#: ../../library/turtle.rst:127 msgid "Home is at ``(0, 0)``." msgstr "" -#: ../../library/turtle.rst:120 +#: ../../library/turtle.rst:129 msgid "" "And after a while, it will probably help to clear the window so we can start " "anew::" msgstr "" -#: ../../library/turtle.rst:123 +#: ../../library/turtle.rst:132 msgid "clearscreen()" msgstr "clearscreen()" -#: ../../library/turtle.rst:127 +#: ../../library/turtle.rst:136 msgid "Making algorithmic patterns" msgstr "" -#: ../../library/turtle.rst:129 +#: ../../library/turtle.rst:138 msgid "Using loops, it's possible to build up geometric patterns::" msgstr "" -#: ../../library/turtle.rst:131 +#: ../../library/turtle.rst:140 msgid "" "for steps in range(100):\n" " for c in ('blue', 'red', 'green'):\n" @@ -220,17 +233,17 @@ msgstr "" " forward(steps)\n" " right(30)" -#: ../../library/turtle.rst:138 +#: ../../library/turtle.rst:147 msgid "\\ - which of course, are limited only by the imagination!" msgstr "" -#: ../../library/turtle.rst:140 +#: ../../library/turtle.rst:149 msgid "" "Let's draw the star shape at the top of this page. We want red lines, filled " "in with yellow::" msgstr "" -#: ../../library/turtle.rst:143 +#: ../../library/turtle.rst:152 msgid "" "color('red')\n" "fillcolor('yellow')" @@ -238,21 +251,21 @@ msgstr "" "color('red')\n" "fillcolor('yellow')" -#: ../../library/turtle.rst:146 +#: ../../library/turtle.rst:155 msgid "" "Just as ``up()`` and ``down()`` determine whether lines will be drawn, " "filling can be turned on and off::" msgstr "" -#: ../../library/turtle.rst:149 +#: ../../library/turtle.rst:158 msgid "begin_fill()" msgstr "begin_fill()" -#: ../../library/turtle.rst:151 +#: ../../library/turtle.rst:160 msgid "Next we'll create a loop::" msgstr "" -#: ../../library/turtle.rst:153 +#: ../../library/turtle.rst:162 msgid "" "while True:\n" " forward(200)\n" @@ -266,39 +279,39 @@ msgstr "" " if abs(pos()) < 1:\n" " break" -#: ../../library/turtle.rst:159 +#: ../../library/turtle.rst:168 msgid "" "``abs(pos()) < 1`` is a good way to know when the turtle is back at its home " "position." msgstr "" -#: ../../library/turtle.rst:162 +#: ../../library/turtle.rst:171 msgid "Finally, complete the filling::" msgstr "" -#: ../../library/turtle.rst:164 +#: ../../library/turtle.rst:173 msgid "end_fill()" msgstr "end_fill()" -#: ../../library/turtle.rst:166 +#: ../../library/turtle.rst:175 msgid "" "(Note that filling only actually takes place when you give the " "``end_fill()`` command.)" msgstr "" -#: ../../library/turtle.rst:173 +#: ../../library/turtle.rst:182 msgid "How to..." msgstr "" -#: ../../library/turtle.rst:175 +#: ../../library/turtle.rst:184 msgid "This section covers some typical turtle use-cases and approaches." msgstr "" -#: ../../library/turtle.rst:179 +#: ../../library/turtle.rst:188 msgid "Get started as quickly as possible" msgstr "" -#: ../../library/turtle.rst:181 +#: ../../library/turtle.rst:190 msgid "" "One of the joys of turtle graphics is the immediate, visual feedback that's " "available from simple commands - it's an excellent way to introduce children " @@ -306,21 +319,21 @@ msgid "" "course)." msgstr "" -#: ../../library/turtle.rst:186 +#: ../../library/turtle.rst:195 msgid "" "The turtle module makes this possible by exposing all its basic " "functionality as functions, available with ``from turtle import *``. The :" "ref:`turtle graphics tutorial ` covers this approach." msgstr "" -#: ../../library/turtle.rst:190 +#: ../../library/turtle.rst:199 msgid "" "It's worth noting that many of the turtle commands also have even more terse " "equivalents, such as ``fd()`` for :func:`forward`. These are especially " "useful when working with learners for whom typing is not a skill." msgstr "" -#: ../../library/turtle.rst:196 +#: ../../library/turtle.rst:205 msgid "" "You'll need to have the :mod:`Tk interface package ` installed on " "your system for turtle graphics to work. Be warned that this is not always " @@ -328,11 +341,11 @@ msgid "" "graphics with a learner." msgstr "" -#: ../../library/turtle.rst:203 +#: ../../library/turtle.rst:212 msgid "Use the ``turtle`` module namespace" msgstr "" -#: ../../library/turtle.rst:205 +#: ../../library/turtle.rst:214 msgid "" "Using ``from turtle import *`` is convenient - but be warned that it imports " "a rather large collection of objects, and if you're doing anything but " @@ -341,7 +354,7 @@ msgid "" "might be imported)." msgstr "" -#: ../../library/turtle.rst:211 +#: ../../library/turtle.rst:220 msgid "" "The solution is to use ``import turtle`` - ``fd()`` becomes ``turtle.fd()``, " "``width()`` becomes ``turtle.width()`` and so on. (If typing \"turtle\" over " @@ -349,17 +362,17 @@ msgid "" "instead.)" msgstr "" -#: ../../library/turtle.rst:218 +#: ../../library/turtle.rst:227 msgid "Use turtle graphics in a script" msgstr "" -#: ../../library/turtle.rst:220 +#: ../../library/turtle.rst:229 msgid "" "It's recommended to use the ``turtle`` module namespace as described " "immediately above, for example::" msgstr "" -#: ../../library/turtle.rst:223 +#: ../../library/turtle.rst:232 msgid "" "import turtle as t\n" "from random import random\n" @@ -379,33 +392,33 @@ msgstr "" " t.right(angle)\n" " t.fd(steps)" -#: ../../library/turtle.rst:232 +#: ../../library/turtle.rst:241 msgid "" "Another step is also required though - as soon as the script ends, Python " "will also close the turtle's window. Add::" msgstr "" -#: ../../library/turtle.rst:235 +#: ../../library/turtle.rst:244 msgid "t.mainloop()" msgstr "t.mainloop()" -#: ../../library/turtle.rst:237 +#: ../../library/turtle.rst:246 msgid "" "to the end of the script. The script will now wait to be dismissed and will " "not exit until it is terminated, for example by closing the turtle graphics " "window." msgstr "" -#: ../../library/turtle.rst:243 +#: ../../library/turtle.rst:252 msgid "Use object-oriented turtle graphics" msgstr "" -#: ../../library/turtle.rst:245 +#: ../../library/turtle.rst:254 msgid "" ":ref:`Explanation of the object-oriented interface `" msgstr "" -#: ../../library/turtle.rst:247 +#: ../../library/turtle.rst:256 msgid "" "Other than for very basic introductory purposes, or for trying things out as " "quickly as possible, it's more usual and much more powerful to use the " @@ -413,18 +426,18 @@ msgid "" "multiple turtles on screen at once." msgstr "" -#: ../../library/turtle.rst:252 +#: ../../library/turtle.rst:261 msgid "" "In this approach, the various turtle commands are methods of objects (mostly " "of ``Turtle`` objects). You *can* use the object-oriented approach in the " "shell, but it would be more typical in a Python script." msgstr "" -#: ../../library/turtle.rst:256 +#: ../../library/turtle.rst:265 msgid "The example above then becomes::" msgstr "" -#: ../../library/turtle.rst:258 +#: ../../library/turtle.rst:267 msgid "" "from turtle import Turtle\n" "from random import random\n" @@ -450,43 +463,43 @@ msgstr "" "\n" "t.screen.mainloop()" -#: ../../library/turtle.rst:270 +#: ../../library/turtle.rst:279 msgid "" "Note the last line. ``t.screen`` is an instance of the :class:`Screen` that " "a Turtle instance exists on; it's created automatically along with the " "turtle." msgstr "" -#: ../../library/turtle.rst:274 +#: ../../library/turtle.rst:283 msgid "The turtle's screen can be customised, for example::" msgstr "" -#: ../../library/turtle.rst:276 +#: ../../library/turtle.rst:285 msgid "" "t.screen.title('Object-oriented turtle demo')\n" "t.screen.bgcolor(\"orange\")" msgstr "" -#: ../../library/turtle.rst:281 +#: ../../library/turtle.rst:290 msgid "Turtle graphics reference" msgstr "" -#: ../../library/turtle.rst:285 +#: ../../library/turtle.rst:294 msgid "" "In the following documentation the argument list for functions is given. " "Methods, of course, have the additional first argument *self* which is " "omitted here." msgstr "" -#: ../../library/turtle.rst:291 +#: ../../library/turtle.rst:300 msgid "Turtle methods" msgstr "" -#: ../../library/turtle.rst:293 ../../library/turtle.rst:433 +#: ../../library/turtle.rst:302 ../../library/turtle.rst:441 msgid "Turtle motion" msgstr "" -#: ../../library/turtle.rst:294 +#: ../../library/turtle.rst:303 msgid "Move and draw" msgstr "" @@ -530,7 +543,7 @@ msgstr ":func:`setheading` | :func:`seth`" msgid ":func:`home`" msgstr ":func:`home`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2723 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2709 msgid ":func:`circle`" msgstr ":func:`circle`" @@ -538,7 +551,7 @@ msgstr ":func:`circle`" msgid ":func:`dot`" msgstr ":func:`dot`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2701 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2687 msgid ":func:`stamp`" msgstr ":func:`stamp`" @@ -558,7 +571,7 @@ msgstr ":func:`undo`" msgid ":func:`speed`" msgstr ":func:`speed`" -#: ../../library/turtle.rst:313 ../../library/turtle.rst:865 +#: ../../library/turtle.rst:322 ../../library/turtle.rst:873 msgid "Tell Turtle's state" msgstr "" @@ -586,7 +599,7 @@ msgstr ":func:`heading`" msgid ":func:`distance`" msgstr ":func:`distance`" -#: ../../library/turtle.rst:321 +#: ../../library/turtle.rst:330 msgid "Setting and measurement" msgstr "" @@ -598,7 +611,7 @@ msgstr ":func:`degrees`" msgid ":func:`radians`" msgstr ":func:`radians`" -#: ../../library/turtle.rst:326 ../../library/turtle.rst:1019 +#: ../../library/turtle.rst:335 ../../library/turtle.rst:1027 msgid "Drawing state" msgstr "" @@ -622,7 +635,7 @@ msgstr ":func:`pen`" msgid ":func:`isdown`" msgstr ":func:`isdown`" -#: ../../library/turtle.rst:333 ../../library/turtle.rst:1111 +#: ../../library/turtle.rst:342 ../../library/turtle.rst:1119 msgid "Color control" msgstr "" @@ -638,7 +651,7 @@ msgstr ":func:`pencolor`" msgid ":func:`fillcolor`" msgstr ":func:`fillcolor`" -#: ../../library/turtle.rst:338 ../../library/turtle.rst:1243 +#: ../../library/turtle.rst:347 ../../library/turtle.rst:1251 msgid "Filling" msgstr "" @@ -654,7 +667,7 @@ msgstr ":func:`begin_fill`" msgid ":func:`end_fill`" msgstr ":func:`end_fill`" -#: ../../library/turtle.rst:343 ../../library/turtle.rst:1290 +#: ../../library/turtle.rst:352 ../../library/turtle.rst:1298 msgid "More drawing control" msgstr "" @@ -670,11 +683,11 @@ msgstr ":func:`clear`" msgid ":func:`write`" msgstr ":func:`write`" -#: ../../library/turtle.rst:348 ../../library/turtle.rst:1336 +#: ../../library/turtle.rst:357 ../../library/turtle.rst:1344 msgid "Turtle state" msgstr "" -#: ../../library/turtle.rst:349 ../../library/turtle.rst:1339 +#: ../../library/turtle.rst:358 ../../library/turtle.rst:1347 msgid "Visibility" msgstr "" @@ -690,7 +703,7 @@ msgstr ":func:`hideturtle` | :func:`ht`" msgid ":func:`isvisible`" msgstr ":func:`isvisible`" -#: ../../library/turtle.rst:354 ../../library/turtle.rst:1378 +#: ../../library/turtle.rst:363 ../../library/turtle.rst:1386 msgid "Appearance" msgstr "" @@ -710,10 +723,6 @@ msgstr ":func:`shapesize` | :func:`turtlesize`" msgid ":func:`shearfactor`" msgstr ":func:`shearfactor`" -#: ../../library/turtle.rst:0 -msgid ":func:`settiltangle`" -msgstr ":func:`settiltangle`" - #: ../../library/turtle.rst:0 msgid ":func:`tiltangle`" msgstr ":func:`tiltangle`" @@ -730,11 +739,11 @@ msgstr ":func:`shapetransform`" msgid ":func:`get_shapepoly`" msgstr ":func:`get_shapepoly`" -#: ../../library/turtle.rst:365 ../../library/turtle.rst:1583 +#: ../../library/turtle.rst:373 ../../library/turtle.rst:1569 msgid "Using events" msgstr "" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2695 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2681 msgid ":func:`onclick`" msgstr ":func:`onclick`" @@ -742,11 +751,11 @@ msgstr ":func:`onclick`" msgid ":func:`onrelease`" msgstr ":func:`onrelease`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2678 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2664 msgid ":func:`ondrag`" msgstr ":func:`ondrag`" -#: ../../library/turtle.rst:370 ../../library/turtle.rst:1657 +#: ../../library/turtle.rst:378 ../../library/turtle.rst:1643 msgid "Special Turtle methods" msgstr "" @@ -762,7 +771,7 @@ msgstr ":func:`end_poly`" msgid ":func:`get_poly`" msgstr ":func:`get_poly`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2717 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2703 msgid ":func:`clone`" msgstr ":func:`clone`" @@ -782,11 +791,11 @@ msgstr ":func:`setundobuffer`" msgid ":func:`undobufferentries`" msgstr ":func:`undobufferentries`" -#: ../../library/turtle.rst:382 +#: ../../library/turtle.rst:390 msgid "Methods of TurtleScreen/Screen" msgstr "" -#: ../../library/turtle.rst:384 ../../library/turtle.rst:1811 +#: ../../library/turtle.rst:392 ../../library/turtle.rst:1797 msgid "Window control" msgstr "" @@ -814,7 +823,7 @@ msgstr ":func:`screensize`" msgid ":func:`setworldcoordinates`" msgstr ":func:`setworldcoordinates`" -#: ../../library/turtle.rst:392 ../../library/turtle.rst:1934 +#: ../../library/turtle.rst:400 ../../library/turtle.rst:1920 msgid "Animation control" msgstr "" @@ -830,7 +839,7 @@ msgstr ":func:`tracer`" msgid ":func:`update`" msgstr ":func:`update`" -#: ../../library/turtle.rst:397 ../../library/turtle.rst:1987 +#: ../../library/turtle.rst:405 ../../library/turtle.rst:1973 msgid "Using screen events" msgstr "" @@ -858,7 +867,7 @@ msgstr ":func:`ontimer`" msgid ":func:`mainloop` | :func:`done`" msgstr ":func:`mainloop` | :func:`done`" -#: ../../library/turtle.rst:405 ../../library/turtle.rst:2132 +#: ../../library/turtle.rst:413 ../../library/turtle.rst:2118 msgid "Settings and special methods" msgstr "" @@ -894,7 +903,7 @@ msgstr ":func:`window_height`" msgid ":func:`window_width`" msgstr ":func:`window_width`" -#: ../../library/turtle.rst:415 ../../library/turtle.rst:2096 +#: ../../library/turtle.rst:423 ../../library/turtle.rst:2082 msgid "Input methods" msgstr "" @@ -906,7 +915,7 @@ msgstr ":func:`textinput`" msgid ":func:`numinput`" msgstr ":func:`numinput`" -#: ../../library/turtle.rst:419 +#: ../../library/turtle.rst:427 msgid "Methods specific to Screen" msgstr "" @@ -926,11 +935,11 @@ msgstr ":func:`setup`" msgid ":func:`title`" msgstr ":func:`title`" -#: ../../library/turtle.rst:427 +#: ../../library/turtle.rst:435 msgid "Methods of RawTurtle/Turtle and corresponding functions" msgstr "" -#: ../../library/turtle.rst:429 +#: ../../library/turtle.rst:437 msgid "" "Most of the examples in this section refer to a Turtle instance called " "``turtle``." @@ -940,19 +949,19 @@ msgstr "" msgid "Parameters" msgstr "參數" -#: ../../library/turtle.rst:438 ../../library/turtle.rst:483 -#: ../../library/turtle.rst:508 ../../library/turtle.rst:606 -#: ../../library/turtle.rst:629 ../../library/turtle.rst:652 +#: ../../library/turtle.rst:446 ../../library/turtle.rst:491 +#: ../../library/turtle.rst:516 ../../library/turtle.rst:614 +#: ../../library/turtle.rst:637 ../../library/turtle.rst:660 msgid "a number (integer or float)" msgstr "" -#: ../../library/turtle.rst:440 +#: ../../library/turtle.rst:448 msgid "" "Move the turtle forward by the specified *distance*, in the direction the " "turtle is headed." msgstr "" -#: ../../library/turtle.rst:443 +#: ../../library/turtle.rst:451 msgid "" ">>> turtle.position()\n" "(0.00,0.00)\n" @@ -972,19 +981,18 @@ msgstr "" ">>> turtle.position()\n" "(-50.00,0.00)" -#: ../../library/turtle.rst:460 ../../library/turtle.rst:702 -#: ../../library/turtle.rst:969 ../../library/turtle.rst:1477 -#: ../../library/turtle.rst:1496 +#: ../../library/turtle.rst:468 ../../library/turtle.rst:710 +#: ../../library/turtle.rst:977 ../../library/turtle.rst:1485 msgid "a number" msgstr "" -#: ../../library/turtle.rst:462 +#: ../../library/turtle.rst:470 msgid "" "Move the turtle backward by *distance*, opposite to the direction the turtle " "is headed. Do not change the turtle's heading." msgstr "" -#: ../../library/turtle.rst:470 +#: ../../library/turtle.rst:478 msgid "" ">>> turtle.position()\n" "(0.00,0.00)\n" @@ -998,14 +1006,14 @@ msgstr "" ">>> turtle.position()\n" "(-30.00,0.00)" -#: ../../library/turtle.rst:485 +#: ../../library/turtle.rst:493 msgid "" "Turn turtle right by *angle* units. (Units are by default degrees, but can " "be set via the :func:`degrees` and :func:`radians` functions.) Angle " "orientation depends on the turtle mode, see :func:`mode`." msgstr "" -#: ../../library/turtle.rst:495 +#: ../../library/turtle.rst:503 msgid "" ">>> turtle.heading()\n" "22.0\n" @@ -1019,14 +1027,14 @@ msgstr "" ">>> turtle.heading()\n" "337.0" -#: ../../library/turtle.rst:510 +#: ../../library/turtle.rst:518 msgid "" "Turn turtle left by *angle* units. (Units are by default degrees, but can " "be set via the :func:`degrees` and :func:`radians` functions.) Angle " "orientation depends on the turtle mode, see :func:`mode`." msgstr "" -#: ../../library/turtle.rst:520 +#: ../../library/turtle.rst:528 msgid "" ">>> turtle.heading()\n" "22.0\n" @@ -1040,28 +1048,28 @@ msgstr "" ">>> turtle.heading()\n" "67.0" -#: ../../library/turtle.rst:534 +#: ../../library/turtle.rst:542 msgid "a number or a pair/vector of numbers" msgstr "" -#: ../../library/turtle.rst:535 ../../library/turtle.rst:568 -#: ../../library/turtle.rst:569 +#: ../../library/turtle.rst:543 ../../library/turtle.rst:576 +#: ../../library/turtle.rst:577 msgid "a number or ``None``" msgstr "" -#: ../../library/turtle.rst:537 +#: ../../library/turtle.rst:545 msgid "" "If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` (e." "g. as returned by :func:`pos`)." msgstr "" -#: ../../library/turtle.rst:540 +#: ../../library/turtle.rst:548 msgid "" "Move turtle to an absolute position. If the pen is down, draw line. Do not " "change the turtle's orientation." msgstr "" -#: ../../library/turtle.rst:549 +#: ../../library/turtle.rst:557 msgid "" ">>> tp = turtle.pos()\n" ">>> tp\n" @@ -1089,11 +1097,11 @@ msgstr "" ">>> turtle.pos()\n" "(0.00,0.00)" -#: ../../library/turtle.rst:570 +#: ../../library/turtle.rst:578 msgid "a boolean" msgstr "" -#: ../../library/turtle.rst:572 +#: ../../library/turtle.rst:580 msgid "" "Move turtle to an absolute position. Unlike goto(x, y), a line will not be " "drawn. The turtle's orientation does not change. If currently filling, the " @@ -1103,7 +1111,7 @@ msgid "" "barrier like in goto(x, y)." msgstr "" -#: ../../library/turtle.rst:585 +#: ../../library/turtle.rst:593 msgid "" ">>> tp = turtle.pos()\n" ">>> tp\n" @@ -1131,12 +1139,12 @@ msgstr "" ">>> turtle.pos()\n" "(20.00,30.00)" -#: ../../library/turtle.rst:608 +#: ../../library/turtle.rst:616 msgid "" "Set the turtle's first coordinate to *x*, leave second coordinate unchanged." msgstr "" -#: ../../library/turtle.rst:617 +#: ../../library/turtle.rst:625 msgid "" ">>> turtle.position()\n" "(0.00,240.00)\n" @@ -1150,12 +1158,12 @@ msgstr "" ">>> turtle.position()\n" "(10.00,240.00)" -#: ../../library/turtle.rst:631 +#: ../../library/turtle.rst:639 msgid "" "Set the turtle's second coordinate to *y*, leave first coordinate unchanged." msgstr "" -#: ../../library/turtle.rst:639 +#: ../../library/turtle.rst:647 msgid "" ">>> turtle.position()\n" "(0.00,40.00)\n" @@ -1169,53 +1177,53 @@ msgstr "" ">>> turtle.position()\n" "(0.00,-10.00)" -#: ../../library/turtle.rst:654 +#: ../../library/turtle.rst:662 msgid "" "Set the orientation of the turtle to *to_angle*. Here are some common " "directions in degrees:" msgstr "" -#: ../../library/turtle.rst:658 +#: ../../library/turtle.rst:666 msgid "standard mode" msgstr "" -#: ../../library/turtle.rst:658 +#: ../../library/turtle.rst:666 msgid "logo mode" msgstr "" -#: ../../library/turtle.rst:660 +#: ../../library/turtle.rst:668 msgid "0 - east" msgstr "" -#: ../../library/turtle.rst:660 +#: ../../library/turtle.rst:668 msgid "0 - north" msgstr "" -#: ../../library/turtle.rst:661 +#: ../../library/turtle.rst:669 msgid "90 - north" msgstr "" -#: ../../library/turtle.rst:661 +#: ../../library/turtle.rst:669 msgid "90 - east" msgstr "" -#: ../../library/turtle.rst:662 +#: ../../library/turtle.rst:670 msgid "180 - west" msgstr "" -#: ../../library/turtle.rst:662 +#: ../../library/turtle.rst:670 msgid "180 - south" msgstr "" -#: ../../library/turtle.rst:663 +#: ../../library/turtle.rst:671 msgid "270 - south" msgstr "" -#: ../../library/turtle.rst:663 +#: ../../library/turtle.rst:671 msgid "270 - west" msgstr "" -#: ../../library/turtle.rst:666 +#: ../../library/turtle.rst:674 msgid "" ">>> turtle.setheading(90)\n" ">>> turtle.heading()\n" @@ -1225,13 +1233,13 @@ msgstr "" ">>> turtle.heading()\n" "90.0" -#: ../../library/turtle.rst:676 +#: ../../library/turtle.rst:684 msgid "" "Move turtle to the origin -- coordinates (0,0) -- and set its heading to its " "start-orientation (which depends on the mode, see :func:`mode`)." msgstr "" -#: ../../library/turtle.rst:686 +#: ../../library/turtle.rst:694 msgid "" ">>> turtle.heading()\n" "90.0\n" @@ -1253,15 +1261,15 @@ msgstr "" ">>> turtle.heading()\n" "0.0" -#: ../../library/turtle.rst:703 +#: ../../library/turtle.rst:711 msgid "a number (or ``None``)" msgstr "" -#: ../../library/turtle.rst:704 ../../library/turtle.rst:797 +#: ../../library/turtle.rst:712 ../../library/turtle.rst:805 msgid "an integer (or ``None``)" msgstr "" -#: ../../library/turtle.rst:706 +#: ../../library/turtle.rst:714 msgid "" "Draw a circle with given *radius*. The center is *radius* units left of the " "turtle; *extent* -- an angle -- determines which part of the circle is " @@ -1272,14 +1280,14 @@ msgid "" "changed by the amount of *extent*." msgstr "" -#: ../../library/turtle.rst:714 +#: ../../library/turtle.rst:722 msgid "" "As the circle is approximated by an inscribed regular polygon, *steps* " "determines the number of steps to use. If not given, it will be calculated " "automatically. May be used to draw regular polygons." msgstr "" -#: ../../library/turtle.rst:718 +#: ../../library/turtle.rst:726 msgid "" ">>> turtle.home()\n" ">>> turtle.position()\n" @@ -1298,21 +1306,21 @@ msgid "" "180.0" msgstr "" -#: ../../library/turtle.rst:740 +#: ../../library/turtle.rst:748 msgid "an integer >= 1 (if given)" msgstr "" -#: ../../library/turtle.rst:741 +#: ../../library/turtle.rst:749 msgid "a colorstring or a numeric color tuple" msgstr "" -#: ../../library/turtle.rst:743 +#: ../../library/turtle.rst:751 msgid "" "Draw a circular dot with diameter *size*, using *color*. If *size* is not " "given, the maximum of pensize+4 and 2*pensize is used." msgstr "" -#: ../../library/turtle.rst:747 +#: ../../library/turtle.rst:755 msgid "" ">>> turtle.home()\n" ">>> turtle.dot()\n" @@ -1330,14 +1338,14 @@ msgstr "" ">>> turtle.heading()\n" "0.0" -#: ../../library/turtle.rst:761 +#: ../../library/turtle.rst:769 msgid "" "Stamp a copy of the turtle shape onto the canvas at the current turtle " "position. Return a stamp_id for that stamp, which can be used to delete it " "by calling ``clearstamp(stamp_id)``." msgstr "" -#: ../../library/turtle.rst:765 +#: ../../library/turtle.rst:773 msgid "" ">>> turtle.color(\"blue\")\n" ">>> stamp_id = turtle.stamp()\n" @@ -1347,15 +1355,15 @@ msgstr "" ">>> stamp_id = turtle.stamp()\n" ">>> turtle.fd(50)" -#: ../../library/turtle.rst:775 +#: ../../library/turtle.rst:783 msgid "an integer, must be return value of previous :func:`stamp` call" msgstr "" -#: ../../library/turtle.rst:778 +#: ../../library/turtle.rst:786 msgid "Delete stamp with given *stampid*." msgstr "" -#: ../../library/turtle.rst:780 +#: ../../library/turtle.rst:788 msgid "" ">>> turtle.position()\n" "(150.00,-0.00)\n" @@ -1379,14 +1387,14 @@ msgstr "" ">>> turtle.position()\n" "(200.00,-0.00)" -#: ../../library/turtle.rst:799 +#: ../../library/turtle.rst:807 msgid "" "Delete all or first/last *n* of turtle's stamps. If *n* is ``None``, delete " "all stamps, if *n* > 0 delete first *n* stamps, else if *n* < 0 delete last " "*n* stamps." msgstr "" -#: ../../library/turtle.rst:803 +#: ../../library/turtle.rst:811 msgid "" ">>> for i in range(8):\n" "... unused_stamp_id = turtle.stamp()\n" @@ -1402,13 +1410,13 @@ msgstr "" ">>> turtle.clearstamps(-2)\n" ">>> turtle.clearstamps()" -#: ../../library/turtle.rst:815 +#: ../../library/turtle.rst:823 msgid "" "Undo (repeatedly) the last turtle action(s). Number of available undo " "actions is determined by the size of the undobuffer." msgstr "" -#: ../../library/turtle.rst:818 +#: ../../library/turtle.rst:826 msgid "" ">>> for i in range(4):\n" "... turtle.fd(50); turtle.lt(80)\n" @@ -1422,55 +1430,55 @@ msgstr "" ">>> for i in range(8):\n" "... turtle.undo()" -#: ../../library/turtle.rst:830 +#: ../../library/turtle.rst:838 msgid "an integer in the range 0..10 or a speedstring (see below)" msgstr "" -#: ../../library/turtle.rst:832 +#: ../../library/turtle.rst:840 msgid "" "Set the turtle's speed to an integer value in the range 0..10. If no " "argument is given, return current speed." msgstr "" -#: ../../library/turtle.rst:835 +#: ../../library/turtle.rst:843 msgid "" "If input is a number greater than 10 or smaller than 0.5, speed is set to " "0. Speedstrings are mapped to speedvalues as follows:" msgstr "" -#: ../../library/turtle.rst:838 +#: ../../library/turtle.rst:846 msgid "\"fastest\": 0" msgstr "" -#: ../../library/turtle.rst:839 +#: ../../library/turtle.rst:847 msgid "\"fast\": 10" msgstr "" -#: ../../library/turtle.rst:840 +#: ../../library/turtle.rst:848 msgid "\"normal\": 6" msgstr "" -#: ../../library/turtle.rst:841 +#: ../../library/turtle.rst:849 msgid "\"slow\": 3" msgstr "" -#: ../../library/turtle.rst:842 +#: ../../library/turtle.rst:850 msgid "\"slowest\": 1" msgstr "" -#: ../../library/turtle.rst:844 +#: ../../library/turtle.rst:852 msgid "" "Speeds from 1 to 10 enforce increasingly faster animation of line drawing " "and turtle turning." msgstr "" -#: ../../library/turtle.rst:847 +#: ../../library/turtle.rst:855 msgid "" "Attention: *speed* = 0 means that *no* animation takes place. forward/back " "makes turtle jump and likewise left/right make the turtle turn instantly." msgstr "" -#: ../../library/turtle.rst:851 +#: ../../library/turtle.rst:859 msgid "" ">>> turtle.speed()\n" "3\n" @@ -1490,12 +1498,12 @@ msgstr "" ">>> turtle.speed()\n" "9" -#: ../../library/turtle.rst:870 +#: ../../library/turtle.rst:878 msgid "" "Return the turtle's current location (x,y) (as a :class:`Vec2D` vector)." msgstr "" -#: ../../library/turtle.rst:872 +#: ../../library/turtle.rst:880 msgid "" ">>> turtle.pos()\n" "(440.00,-0.00)" @@ -1503,15 +1511,15 @@ msgstr "" ">>> turtle.pos()\n" "(440.00,-0.00)" -#: ../../library/turtle.rst:881 ../../library/turtle.rst:944 +#: ../../library/turtle.rst:889 ../../library/turtle.rst:952 msgid "a number or a pair/vector of numbers or a turtle instance" msgstr "" -#: ../../library/turtle.rst:882 ../../library/turtle.rst:945 +#: ../../library/turtle.rst:890 ../../library/turtle.rst:953 msgid "a number if *x* is a number, else ``None``" msgstr "" -#: ../../library/turtle.rst:884 +#: ../../library/turtle.rst:892 msgid "" "Return the angle between the line from turtle position to position specified " "by (x,y), the vector or the other turtle. This depends on the turtle's " @@ -1519,7 +1527,7 @@ msgid "" "\"logo\"." msgstr "" -#: ../../library/turtle.rst:888 +#: ../../library/turtle.rst:896 msgid "" ">>> turtle.goto(10, 10)\n" ">>> turtle.towards(0,0)\n" @@ -1529,11 +1537,11 @@ msgstr "" ">>> turtle.towards(0,0)\n" "225.0" -#: ../../library/turtle.rst:898 +#: ../../library/turtle.rst:906 msgid "Return the turtle's x coordinate." msgstr "" -#: ../../library/turtle.rst:900 +#: ../../library/turtle.rst:908 msgid "" ">>> turtle.home()\n" ">>> turtle.left(50)\n" @@ -1551,11 +1559,11 @@ msgstr "" ">>> print(round(turtle.xcor(), 5))\n" "64.27876" -#: ../../library/turtle.rst:914 +#: ../../library/turtle.rst:922 msgid "Return the turtle's y coordinate." msgstr "" -#: ../../library/turtle.rst:916 +#: ../../library/turtle.rst:924 msgid "" ">>> turtle.home()\n" ">>> turtle.left(60)\n" @@ -1573,13 +1581,13 @@ msgstr "" ">>> print(round(turtle.ycor(), 5))\n" "86.60254" -#: ../../library/turtle.rst:930 +#: ../../library/turtle.rst:938 msgid "" "Return the turtle's current heading (value depends on the turtle mode, see :" "func:`mode`)." msgstr "" -#: ../../library/turtle.rst:933 +#: ../../library/turtle.rst:941 msgid "" ">>> turtle.home()\n" ">>> turtle.left(67)\n" @@ -1591,13 +1599,13 @@ msgstr "" ">>> turtle.heading()\n" "67.0" -#: ../../library/turtle.rst:947 +#: ../../library/turtle.rst:955 msgid "" "Return the distance from the turtle to (x,y), the given vector, or the given " "other turtle, in turtle step units." msgstr "" -#: ../../library/turtle.rst:950 +#: ../../library/turtle.rst:958 msgid "" ">>> turtle.home()\n" ">>> turtle.distance(30,40)\n" @@ -1619,17 +1627,17 @@ msgstr "" ">>> turtle.distance(joe)\n" "77.0" -#: ../../library/turtle.rst:965 +#: ../../library/turtle.rst:973 msgid "Settings for measurement" msgstr "" -#: ../../library/turtle.rst:971 +#: ../../library/turtle.rst:979 msgid "" "Set angle measurement units, i.e. set number of \"degrees\" for a full " "circle. Default value is 360 degrees." msgstr "" -#: ../../library/turtle.rst:974 +#: ../../library/turtle.rst:982 msgid "" ">>> turtle.home()\n" ">>> turtle.left(90)\n" @@ -1646,13 +1654,13 @@ msgid "" "90.0" msgstr "" -#: ../../library/turtle.rst:994 +#: ../../library/turtle.rst:1002 msgid "" "Set the angle measurement units to radians. Equivalent to ``degrees(2*math." "pi)``." msgstr "" -#: ../../library/turtle.rst:997 +#: ../../library/turtle.rst:1005 msgid "" ">>> turtle.home()\n" ">>> turtle.left(90)\n" @@ -1670,87 +1678,87 @@ msgstr "" ">>> turtle.heading()\n" "1.5707963267948966" -#: ../../library/turtle.rst:1025 +#: ../../library/turtle.rst:1033 msgid "Pull the pen down -- drawing when moving." msgstr "" -#: ../../library/turtle.rst:1032 +#: ../../library/turtle.rst:1040 msgid "Pull the pen up -- no drawing when moving." msgstr "" -#: ../../library/turtle.rst:1038 +#: ../../library/turtle.rst:1046 msgid "a positive number" msgstr "" -#: ../../library/turtle.rst:1040 +#: ../../library/turtle.rst:1048 msgid "" "Set the line thickness to *width* or return it. If resizemode is set to " "\"auto\" and turtleshape is a polygon, that polygon is drawn with the same " "line thickness. If no argument is given, the current pensize is returned." msgstr "" -#: ../../library/turtle.rst:1044 +#: ../../library/turtle.rst:1052 msgid "" ">>> turtle.pensize()\n" "1\n" ">>> turtle.pensize(10) # from here on lines of width 10 are drawn" msgstr "" -#: ../../library/turtle.rst:1054 +#: ../../library/turtle.rst:1062 msgid "a dictionary with some or all of the below listed keys" msgstr "" -#: ../../library/turtle.rst:1055 +#: ../../library/turtle.rst:1063 msgid "one or more keyword-arguments with the below listed keys as keywords" msgstr "" -#: ../../library/turtle.rst:1057 +#: ../../library/turtle.rst:1065 msgid "" "Return or set the pen's attributes in a \"pen-dictionary\" with the " "following key/value pairs:" msgstr "" -#: ../../library/turtle.rst:1060 +#: ../../library/turtle.rst:1068 msgid "\"shown\": True/False" msgstr "" -#: ../../library/turtle.rst:1061 +#: ../../library/turtle.rst:1069 msgid "\"pendown\": True/False" msgstr "" -#: ../../library/turtle.rst:1062 +#: ../../library/turtle.rst:1070 msgid "\"pencolor\": color-string or color-tuple" msgstr "" -#: ../../library/turtle.rst:1063 +#: ../../library/turtle.rst:1071 msgid "\"fillcolor\": color-string or color-tuple" msgstr "" -#: ../../library/turtle.rst:1064 +#: ../../library/turtle.rst:1072 msgid "\"pensize\": positive number" msgstr "" -#: ../../library/turtle.rst:1065 +#: ../../library/turtle.rst:1073 msgid "\"speed\": number in range 0..10" msgstr "" -#: ../../library/turtle.rst:1066 +#: ../../library/turtle.rst:1074 msgid "\"resizemode\": \"auto\" or \"user\" or \"noresize\"" msgstr "" -#: ../../library/turtle.rst:1067 +#: ../../library/turtle.rst:1075 msgid "\"stretchfactor\": (positive number, positive number)" msgstr "" -#: ../../library/turtle.rst:1068 +#: ../../library/turtle.rst:1076 msgid "\"outline\": positive number" msgstr "" -#: ../../library/turtle.rst:1069 +#: ../../library/turtle.rst:1077 msgid "\"tilt\": number" msgstr "" -#: ../../library/turtle.rst:1071 +#: ../../library/turtle.rst:1079 msgid "" "This dictionary can be used as argument for a subsequent call to :func:`pen` " "to restore the former pen-state. Moreover one or more of these attributes " @@ -1758,7 +1766,7 @@ msgid "" "attributes in one statement." msgstr "" -#: ../../library/turtle.rst:1076 +#: ../../library/turtle.rst:1084 msgid "" ">>> turtle.pen(fillcolor=\"black\", pencolor=\"red\", pensize=10)\n" ">>> sorted(turtle.pen().items())\n" @@ -1790,11 +1798,11 @@ msgstr "" ">>> sorted(turtle.pen().items())[:3]\n" "[('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red')]" -#: ../../library/turtle.rst:1097 +#: ../../library/turtle.rst:1105 msgid "Return ``True`` if pen is down, ``False`` if it's up." msgstr "" -#: ../../library/turtle.rst:1099 +#: ../../library/turtle.rst:1107 msgid "" ">>> turtle.penup()\n" ">>> turtle.isdown()\n" @@ -1810,62 +1818,62 @@ msgstr "" ">>> turtle.isdown()\n" "True" -#: ../../library/turtle.rst:1115 +#: ../../library/turtle.rst:1123 msgid "Return or set the pencolor." msgstr "" -#: ../../library/turtle.rst:1117 ../../library/turtle.rst:1166 +#: ../../library/turtle.rst:1125 ../../library/turtle.rst:1174 msgid "Four input formats are allowed:" msgstr "" -#: ../../library/turtle.rst:1119 +#: ../../library/turtle.rst:1127 msgid "``pencolor()``" msgstr "``pencolor()``" -#: ../../library/turtle.rst:1120 +#: ../../library/turtle.rst:1128 msgid "" "Return the current pencolor as color specification string or as a tuple (see " "example). May be used as input to another color/pencolor/fillcolor call." msgstr "" -#: ../../library/turtle.rst:1124 +#: ../../library/turtle.rst:1132 msgid "``pencolor(colorstring)``" msgstr "``pencolor(colorstring)``" -#: ../../library/turtle.rst:1125 +#: ../../library/turtle.rst:1133 msgid "" "Set pencolor to *colorstring*, which is a Tk color specification string, " "such as ``\"red\"``, ``\"yellow\"``, or ``\"#33cc8c\"``." msgstr "" -#: ../../library/turtle.rst:1128 +#: ../../library/turtle.rst:1136 msgid "``pencolor((r, g, b))``" msgstr "``pencolor((r, g, b))``" -#: ../../library/turtle.rst:1129 +#: ../../library/turtle.rst:1137 msgid "" "Set pencolor to the RGB color represented by the tuple of *r*, *g*, and " "*b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where " "colormode is either 1.0 or 255 (see :func:`colormode`)." msgstr "" -#: ../../library/turtle.rst:1133 +#: ../../library/turtle.rst:1141 msgid "``pencolor(r, g, b)``" msgstr "``pencolor(r, g, b)``" -#: ../../library/turtle.rst:1134 +#: ../../library/turtle.rst:1142 msgid "" "Set pencolor to the RGB color represented by *r*, *g*, and *b*. Each of " "*r*, *g*, and *b* must be in the range 0..colormode." msgstr "" -#: ../../library/turtle.rst:1137 +#: ../../library/turtle.rst:1145 msgid "" "If turtleshape is a polygon, the outline of that polygon is drawn with the " "newly set pencolor." msgstr "" -#: ../../library/turtle.rst:1140 +#: ../../library/turtle.rst:1148 msgid "" ">>> colormode()\n" "1.0\n" @@ -1903,59 +1911,59 @@ msgstr "" ">>> turtle.pencolor()\n" "(50.0, 193.0, 143.0)" -#: ../../library/turtle.rst:1164 +#: ../../library/turtle.rst:1172 msgid "Return or set the fillcolor." msgstr "" -#: ../../library/turtle.rst:1168 +#: ../../library/turtle.rst:1176 msgid "``fillcolor()``" msgstr "``fillcolor()``" -#: ../../library/turtle.rst:1169 +#: ../../library/turtle.rst:1177 msgid "" "Return the current fillcolor as color specification string, possibly in " "tuple format (see example). May be used as input to another color/pencolor/" "fillcolor call." msgstr "" -#: ../../library/turtle.rst:1173 +#: ../../library/turtle.rst:1181 msgid "``fillcolor(colorstring)``" msgstr "``fillcolor(colorstring)``" -#: ../../library/turtle.rst:1174 +#: ../../library/turtle.rst:1182 msgid "" "Set fillcolor to *colorstring*, which is a Tk color specification string, " "such as ``\"red\"``, ``\"yellow\"``, or ``\"#33cc8c\"``." msgstr "" -#: ../../library/turtle.rst:1177 +#: ../../library/turtle.rst:1185 msgid "``fillcolor((r, g, b))``" msgstr "``fillcolor((r, g, b))``" -#: ../../library/turtle.rst:1178 +#: ../../library/turtle.rst:1186 msgid "" "Set fillcolor to the RGB color represented by the tuple of *r*, *g*, and " "*b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where " "colormode is either 1.0 or 255 (see :func:`colormode`)." msgstr "" -#: ../../library/turtle.rst:1182 +#: ../../library/turtle.rst:1190 msgid "``fillcolor(r, g, b)``" msgstr "``fillcolor(r, g, b)``" -#: ../../library/turtle.rst:1183 +#: ../../library/turtle.rst:1191 msgid "" "Set fillcolor to the RGB color represented by *r*, *g*, and *b*. Each of " "*r*, *g*, and *b* must be in the range 0..colormode." msgstr "" -#: ../../library/turtle.rst:1186 +#: ../../library/turtle.rst:1194 msgid "" "If turtleshape is a polygon, the interior of that polygon is drawn with the " "newly set fillcolor." msgstr "" -#: ../../library/turtle.rst:1189 +#: ../../library/turtle.rst:1197 msgid "" ">>> turtle.fillcolor(\"violet\")\n" ">>> turtle.fillcolor()\n" @@ -1981,55 +1989,55 @@ msgstr "" ">>> turtle.fillcolor()\n" "(255.0, 255.0, 255.0)" -#: ../../library/turtle.rst:1207 +#: ../../library/turtle.rst:1215 msgid "Return or set pencolor and fillcolor." msgstr "" -#: ../../library/turtle.rst:1209 +#: ../../library/turtle.rst:1217 msgid "" "Several input formats are allowed. They use 0 to 3 arguments as follows:" msgstr "" -#: ../../library/turtle.rst:1212 +#: ../../library/turtle.rst:1220 msgid "``color()``" msgstr "``color()``" -#: ../../library/turtle.rst:1213 +#: ../../library/turtle.rst:1221 msgid "" "Return the current pencolor and the current fillcolor as a pair of color " "specification strings or tuples as returned by :func:`pencolor` and :func:" "`fillcolor`." msgstr "" -#: ../../library/turtle.rst:1217 +#: ../../library/turtle.rst:1225 msgid "``color(colorstring)``, ``color((r,g,b))``, ``color(r,g,b)``" msgstr "``color(colorstring)``, ``color((r,g,b))``, ``color(r,g,b)``" -#: ../../library/turtle.rst:1218 +#: ../../library/turtle.rst:1226 msgid "" "Inputs as in :func:`pencolor`, set both, fillcolor and pencolor, to the " "given value." msgstr "" -#: ../../library/turtle.rst:1221 +#: ../../library/turtle.rst:1229 msgid "" "``color(colorstring1, colorstring2)``, ``color((r1,g1,b1), (r2,g2,b2))``" msgstr "" "``color(colorstring1, colorstring2)``, ``color((r1,g1,b1), (r2,g2,b2))``" -#: ../../library/turtle.rst:1222 +#: ../../library/turtle.rst:1230 msgid "" "Equivalent to ``pencolor(colorstring1)`` and ``fillcolor(colorstring2)`` and " "analogously if the other input format is used." msgstr "" -#: ../../library/turtle.rst:1225 +#: ../../library/turtle.rst:1233 msgid "" "If turtleshape is a polygon, outline and interior of that polygon is drawn " "with the newly set colors." msgstr "" -#: ../../library/turtle.rst:1228 +#: ../../library/turtle.rst:1236 msgid "" ">>> turtle.color(\"red\", \"green\")\n" ">>> turtle.color()\n" @@ -2045,15 +2053,15 @@ msgstr "" ">>> color()\n" "((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))" -#: ../../library/turtle.rst:1239 +#: ../../library/turtle.rst:1247 msgid "See also: Screen method :func:`colormode`." msgstr "" -#: ../../library/turtle.rst:1253 +#: ../../library/turtle.rst:1261 msgid "Return fillstate (``True`` if filling, ``False`` else)." msgstr "" -#: ../../library/turtle.rst:1255 +#: ../../library/turtle.rst:1263 msgid "" ">>> turtle.begin_fill()\n" ">>> if turtle.filling():\n" @@ -2067,15 +2075,15 @@ msgstr "" "... else:\n" "... turtle.pensize(3)" -#: ../../library/turtle.rst:1268 +#: ../../library/turtle.rst:1276 msgid "To be called just before drawing a shape to be filled." msgstr "" -#: ../../library/turtle.rst:1273 +#: ../../library/turtle.rst:1281 msgid "Fill the shape drawn after the last call to :func:`begin_fill`." msgstr "" -#: ../../library/turtle.rst:1275 +#: ../../library/turtle.rst:1283 msgid "" "Whether or not overlap regions for self-intersecting polygons or multiple " "shapes are filled depends on the operating system graphics, type of overlap, " @@ -2083,7 +2091,7 @@ msgid "" "all yellow or have some white regions." msgstr "" -#: ../../library/turtle.rst:1280 +#: ../../library/turtle.rst:1288 msgid "" ">>> turtle.color(\"black\", \"red\")\n" ">>> turtle.begin_fill()\n" @@ -2095,13 +2103,13 @@ msgstr "" ">>> turtle.circle(80)\n" ">>> turtle.end_fill()" -#: ../../library/turtle.rst:1294 +#: ../../library/turtle.rst:1302 msgid "" "Delete the turtle's drawings from the screen, re-center the turtle and set " "variables to the default values." msgstr "" -#: ../../library/turtle.rst:1297 +#: ../../library/turtle.rst:1305 msgid "" ">>> turtle.goto(0,-22)\n" ">>> turtle.left(100)\n" @@ -2127,30 +2135,30 @@ msgstr "" ">>> turtle.heading()\n" "0.0" -#: ../../library/turtle.rst:1315 +#: ../../library/turtle.rst:1323 msgid "" "Delete the turtle's drawings from the screen. Do not move turtle. State " "and position of the turtle as well as drawings of other turtles are not " "affected." msgstr "" -#: ../../library/turtle.rst:1321 +#: ../../library/turtle.rst:1329 msgid "object to be written to the TurtleScreen" msgstr "" -#: ../../library/turtle.rst:1322 +#: ../../library/turtle.rst:1330 msgid "True/False" msgstr "True/False" -#: ../../library/turtle.rst:1323 +#: ../../library/turtle.rst:1331 msgid "one of the strings \"left\", \"center\" or right\"" msgstr "" -#: ../../library/turtle.rst:1324 +#: ../../library/turtle.rst:1332 msgid "a triple (fontname, fontsize, fonttype)" msgstr "" -#: ../../library/turtle.rst:1326 +#: ../../library/turtle.rst:1334 msgid "" "Write text - the string representation of *arg* - at the current turtle " "position according to *align* (\"left\", \"center\" or \"right\") and with " @@ -2158,34 +2166,34 @@ msgid "" "corner of the text. By default, *move* is ``False``." msgstr "" -#: ../../library/turtle.rst:1344 +#: ../../library/turtle.rst:1352 msgid "" "Make the turtle invisible. It's a good idea to do this while you're in the " "middle of doing some complex drawing, because hiding the turtle speeds up " "the drawing observably." msgstr "" -#: ../../library/turtle.rst:1348 +#: ../../library/turtle.rst:1356 msgid ">>> turtle.hideturtle()" msgstr ">>> turtle.hideturtle()" -#: ../../library/turtle.rst:1357 +#: ../../library/turtle.rst:1365 msgid "Make the turtle visible." msgstr "" -#: ../../library/turtle.rst:1359 +#: ../../library/turtle.rst:1367 msgid ">>> turtle.showturtle()" msgstr ">>> turtle.showturtle()" -#: ../../library/turtle.rst:1367 +#: ../../library/turtle.rst:1375 msgid "Return ``True`` if the Turtle is shown, ``False`` if it's hidden." msgstr "" -#: ../../library/turtle.rst:1382 +#: ../../library/turtle.rst:1390 msgid "a string which is a valid shapename" msgstr "" -#: ../../library/turtle.rst:1384 +#: ../../library/turtle.rst:1392 msgid "" "Set turtle shape to shape with given *name* or, if name is not given, return " "name of current shape. Shape with *name* must exist in the TurtleScreen's " @@ -2195,7 +2203,7 @@ msgid "" "`register_shape`." msgstr "" -#: ../../library/turtle.rst:1390 +#: ../../library/turtle.rst:1398 msgid "" ">>> turtle.shape()\n" "'classic'\n" @@ -2209,40 +2217,40 @@ msgstr "" ">>> turtle.shape()\n" "'turtle'" -#: ../../library/turtle.rst:1402 +#: ../../library/turtle.rst:1410 msgid "one of the strings \"auto\", \"user\", \"noresize\"" msgstr "" -#: ../../library/turtle.rst:1404 +#: ../../library/turtle.rst:1412 msgid "" "Set resizemode to one of the values: \"auto\", \"user\", \"noresize\". If " "*rmode* is not given, return current resizemode. Different resizemodes have " "the following effects:" msgstr "" -#: ../../library/turtle.rst:1408 +#: ../../library/turtle.rst:1416 msgid "" "\"auto\": adapts the appearance of the turtle corresponding to the value of " "pensize." msgstr "" -#: ../../library/turtle.rst:1409 +#: ../../library/turtle.rst:1417 msgid "" "\"user\": adapts the appearance of the turtle according to the values of " "stretchfactor and outlinewidth (outline), which are set by :func:`shapesize`." msgstr "" -#: ../../library/turtle.rst:1412 +#: ../../library/turtle.rst:1420 msgid "\"noresize\": no adaption of the turtle's appearance takes place." msgstr "" -#: ../../library/turtle.rst:1414 +#: ../../library/turtle.rst:1422 msgid "" "``resizemode(\"user\")`` is called by :func:`shapesize` when used with " "arguments." msgstr "" -#: ../../library/turtle.rst:1416 +#: ../../library/turtle.rst:1424 msgid "" ">>> turtle.resizemode()\n" "'noresize'\n" @@ -2256,12 +2264,12 @@ msgstr "" ">>> turtle.resizemode()\n" "'auto'" -#: ../../library/turtle.rst:1429 ../../library/turtle.rst:1430 -#: ../../library/turtle.rst:1431 +#: ../../library/turtle.rst:1437 ../../library/turtle.rst:1438 +#: ../../library/turtle.rst:1439 msgid "positive number" msgstr "" -#: ../../library/turtle.rst:1433 +#: ../../library/turtle.rst:1441 msgid "" "Return or set the pen's attributes x/y-stretchfactors and/or outline. Set " "resizemode to \"user\". If and only if resizemode is set to \"user\", the " @@ -2271,7 +2279,7 @@ msgid "" "determines the width of the shape's outline." msgstr "" -#: ../../library/turtle.rst:1440 +#: ../../library/turtle.rst:1448 msgid "" ">>> turtle.shapesize()\n" "(1.0, 1.0, 1)\n" @@ -2293,12 +2301,12 @@ msgstr "" ">>> turtle.shapesize()\n" "(5, 5, 8)" -#: ../../library/turtle.rst:1456 ../../library/turtle.rst:2115 -#: ../../library/turtle.rst:2116 ../../library/turtle.rst:2117 +#: ../../library/turtle.rst:1464 ../../library/turtle.rst:2101 +#: ../../library/turtle.rst:2102 ../../library/turtle.rst:2103 msgid "number (optional)" msgstr "" -#: ../../library/turtle.rst:1458 +#: ../../library/turtle.rst:1466 msgid "" "Set or return the current shearfactor. Shear the turtleshape according to " "the given shearfactor shear, which is the tangent of the shear angle. Do " @@ -2307,7 +2315,7 @@ msgid "" "by which lines parallel to the heading of the turtle are sheared." msgstr "" -#: ../../library/turtle.rst:1465 +#: ../../library/turtle.rst:1473 msgid "" ">>> turtle.shape(\"circle\")\n" ">>> turtle.shapesize(5,2)\n" @@ -2321,13 +2329,13 @@ msgstr "" ">>> turtle.shearfactor()\n" "0.5" -#: ../../library/turtle.rst:1479 +#: ../../library/turtle.rst:1487 msgid "" "Rotate the turtleshape by *angle* from its current tilt-angle, but do *not* " "change the turtle's heading (direction of movement)." msgstr "" -#: ../../library/turtle.rst:1482 +#: ../../library/turtle.rst:1490 msgid "" ">>> turtle.reset()\n" ">>> turtle.shape(\"circle\")\n" @@ -2345,38 +2353,13 @@ msgstr "" ">>> turtle.tilt(30)\n" ">>> turtle.fd(50)" -#: ../../library/turtle.rst:1498 -msgid "" -"Rotate the turtleshape to point in the direction specified by *angle*, " -"regardless of its current tilt-angle. *Do not* change the turtle's heading " -"(direction of movement)." -msgstr "" - -#: ../../library/turtle.rst:1502 -msgid "" -">>> turtle.reset()\n" -">>> turtle.shape(\"circle\")\n" -">>> turtle.shapesize(5,2)\n" -">>> turtle.settiltangle(45)\n" -">>> turtle.fd(50)\n" -">>> turtle.settiltangle(-45)\n" -">>> turtle.fd(50)" -msgstr "" -">>> turtle.reset()\n" -">>> turtle.shape(\"circle\")\n" -">>> turtle.shapesize(5,2)\n" -">>> turtle.settiltangle(45)\n" -">>> turtle.fd(50)\n" -">>> turtle.settiltangle(-45)\n" -">>> turtle.fd(50)" - -#: ../../library/turtle.rst:1518 ../../library/turtle.rst:1541 -#: ../../library/turtle.rst:1542 ../../library/turtle.rst:1543 -#: ../../library/turtle.rst:1544 +#: ../../library/turtle.rst:1504 ../../library/turtle.rst:1527 +#: ../../library/turtle.rst:1528 ../../library/turtle.rst:1529 +#: ../../library/turtle.rst:1530 msgid "a number (optional)" msgstr "" -#: ../../library/turtle.rst:1520 +#: ../../library/turtle.rst:1506 msgid "" "Set or return the current tilt-angle. If angle is given, rotate the " "turtleshape to point in the direction specified by angle, regardless of its " @@ -2386,7 +2369,7 @@ msgid "" "turtle (its direction of movement)." msgstr "" -#: ../../library/turtle.rst:1528 +#: ../../library/turtle.rst:1514 msgid "" ">>> turtle.reset()\n" ">>> turtle.shape(\"circle\")\n" @@ -2402,11 +2385,11 @@ msgstr "" ">>> turtle.tiltangle()\n" "45.0" -#: ../../library/turtle.rst:1546 +#: ../../library/turtle.rst:1532 msgid "Set or return the current transformation matrix of the turtle shape." msgstr "" -#: ../../library/turtle.rst:1548 +#: ../../library/turtle.rst:1534 msgid "" "If none of the matrix elements are given, return the transformation matrix " "as a tuple of 4 elements. Otherwise set the given elements and transform the " @@ -2416,7 +2399,7 @@ msgid "" "tiltangle according to the given matrix." msgstr "" -#: ../../library/turtle.rst:1557 +#: ../../library/turtle.rst:1543 msgid "" ">>> turtle = Turtle()\n" ">>> turtle.shape(\"square\")\n" @@ -2432,13 +2415,13 @@ msgstr "" ">>> turtle.shapetransform()\n" "(4.0, -1.0, -0.0, 2.0)" -#: ../../library/turtle.rst:1570 +#: ../../library/turtle.rst:1556 msgid "" "Return the current shape polygon as tuple of coordinate pairs. This can be " "used to define a new shape or components of a compound shape." msgstr "" -#: ../../library/turtle.rst:1573 +#: ../../library/turtle.rst:1559 msgid "" ">>> turtle.shape(\"square\")\n" ">>> turtle.shapetransform(4, -1, 0, 2)\n" @@ -2450,33 +2433,33 @@ msgstr "" ">>> turtle.get_shapepoly()\n" "((50, -20), (30, 20), (-50, 20), (-30, -20))" -#: ../../library/turtle.rst:1588 ../../library/turtle.rst:1610 -#: ../../library/turtle.rst:1635 ../../library/turtle.rst:2039 +#: ../../library/turtle.rst:1574 ../../library/turtle.rst:1596 +#: ../../library/turtle.rst:1621 ../../library/turtle.rst:2025 msgid "" "a function with two arguments which will be called with the coordinates of " "the clicked point on the canvas" msgstr "" -#: ../../library/turtle.rst:1590 ../../library/turtle.rst:1612 -#: ../../library/turtle.rst:1637 ../../library/turtle.rst:2041 +#: ../../library/turtle.rst:1576 ../../library/turtle.rst:1598 +#: ../../library/turtle.rst:1623 ../../library/turtle.rst:2027 msgid "number of the mouse-button, defaults to 1 (left mouse button)" msgstr "" -#: ../../library/turtle.rst:1591 ../../library/turtle.rst:1613 -#: ../../library/turtle.rst:1638 ../../library/turtle.rst:2042 +#: ../../library/turtle.rst:1577 ../../library/turtle.rst:1599 +#: ../../library/turtle.rst:1624 ../../library/turtle.rst:2028 msgid "" "``True`` or ``False`` -- if ``True``, a new binding will be added, otherwise " "it will replace a former binding" msgstr "" -#: ../../library/turtle.rst:1594 +#: ../../library/turtle.rst:1580 msgid "" "Bind *fun* to mouse-click events on this turtle. If *fun* is ``None``, " "existing bindings are removed. Example for the anonymous turtle, i.e. the " "procedural way:" msgstr "" -#: ../../library/turtle.rst:1598 +#: ../../library/turtle.rst:1584 msgid "" ">>> def turn(x, y):\n" "... left(180)\n" @@ -2485,13 +2468,13 @@ msgid "" ">>> onclick(None) # event-binding will be removed" msgstr "" -#: ../../library/turtle.rst:1616 +#: ../../library/turtle.rst:1602 msgid "" "Bind *fun* to mouse-button-release events on this turtle. If *fun* is " "``None``, existing bindings are removed." msgstr "" -#: ../../library/turtle.rst:1619 +#: ../../library/turtle.rst:1605 msgid "" ">>> class MyTurtle(Turtle):\n" "... def glow(self,x,y):\n" @@ -2505,45 +2488,45 @@ msgid "" ">>> turtle.onrelease(turtle.unglow) # releasing turns it to transparent." msgstr "" -#: ../../library/turtle.rst:1641 +#: ../../library/turtle.rst:1627 msgid "" "Bind *fun* to mouse-move events on this turtle. If *fun* is ``None``, " "existing bindings are removed." msgstr "" -#: ../../library/turtle.rst:1644 +#: ../../library/turtle.rst:1630 msgid "" "Remark: Every sequence of mouse-move-events on a turtle is preceded by a " "mouse-click event on that turtle." msgstr "" -#: ../../library/turtle.rst:1647 +#: ../../library/turtle.rst:1633 msgid ">>> turtle.ondrag(turtle.goto)" msgstr ">>> turtle.ondrag(turtle.goto)" -#: ../../library/turtle.rst:1652 +#: ../../library/turtle.rst:1638 msgid "" "Subsequently, clicking and dragging the Turtle will move it across the " "screen thereby producing handdrawings (if pen is down)." msgstr "" -#: ../../library/turtle.rst:1661 +#: ../../library/turtle.rst:1647 msgid "" "Start recording the vertices of a polygon. Current turtle position is first " "vertex of polygon." msgstr "" -#: ../../library/turtle.rst:1667 +#: ../../library/turtle.rst:1653 msgid "" "Stop recording the vertices of a polygon. Current turtle position is last " "vertex of polygon. This will be connected with the first vertex." msgstr "" -#: ../../library/turtle.rst:1673 +#: ../../library/turtle.rst:1659 msgid "Return the last recorded polygon." msgstr "" -#: ../../library/turtle.rst:1675 +#: ../../library/turtle.rst:1661 msgid "" ">>> turtle.home()\n" ">>> turtle.begin_poly()\n" @@ -2567,13 +2550,13 @@ msgstr "" ">>> p = turtle.get_poly()\n" ">>> register_shape(\"myFavouriteShape\", p)" -#: ../../library/turtle.rst:1692 +#: ../../library/turtle.rst:1678 msgid "" "Create and return a clone of the turtle with same position, heading and " "turtle properties." msgstr "" -#: ../../library/turtle.rst:1695 +#: ../../library/turtle.rst:1681 msgid "" ">>> mick = Turtle()\n" ">>> joe = mick.clone()" @@ -2581,13 +2564,13 @@ msgstr "" ">>> mick = Turtle()\n" ">>> joe = mick.clone()" -#: ../../library/turtle.rst:1705 +#: ../../library/turtle.rst:1691 msgid "" "Return the Turtle object itself. Only reasonable use: as a function to " "return the \"anonymous turtle\":" msgstr "" -#: ../../library/turtle.rst:1708 +#: ../../library/turtle.rst:1694 msgid "" ">>> pet = getturtle()\n" ">>> pet.fd(50)\n" @@ -2599,13 +2582,13 @@ msgstr "" ">>> pet\n" "" -#: ../../library/turtle.rst:1719 +#: ../../library/turtle.rst:1705 msgid "" "Return the :class:`TurtleScreen` object the turtle is drawing on. " "TurtleScreen methods can then be called for that object." msgstr "" -#: ../../library/turtle.rst:1722 +#: ../../library/turtle.rst:1708 msgid "" ">>> ts = turtle.getscreen()\n" ">>> ts\n" @@ -2617,11 +2600,11 @@ msgstr "" "\n" ">>> ts.bgcolor(\"pink\")" -#: ../../library/turtle.rst:1733 +#: ../../library/turtle.rst:1719 msgid "an integer or ``None``" msgstr "一個整數或 ``None``" -#: ../../library/turtle.rst:1735 +#: ../../library/turtle.rst:1721 msgid "" "Set or disable undobuffer. If *size* is an integer, an empty undobuffer of " "given size is installed. *size* gives the maximum number of turtle actions " @@ -2629,15 +2612,15 @@ msgid "" "``None``, the undobuffer is disabled." msgstr "" -#: ../../library/turtle.rst:1740 +#: ../../library/turtle.rst:1726 msgid ">>> turtle.setundobuffer(42)" msgstr ">>> turtle.setundobuffer(42)" -#: ../../library/turtle.rst:1748 +#: ../../library/turtle.rst:1734 msgid "Return number of entries in the undobuffer." msgstr "" -#: ../../library/turtle.rst:1750 +#: ../../library/turtle.rst:1736 msgid "" ">>> while undobufferentries():\n" "... undo()" @@ -2645,32 +2628,32 @@ msgstr "" ">>> while undobufferentries():\n" "... undo()" -#: ../../library/turtle.rst:1761 +#: ../../library/turtle.rst:1747 msgid "Compound shapes" msgstr "" -#: ../../library/turtle.rst:1763 +#: ../../library/turtle.rst:1749 msgid "" "To use compound turtle shapes, which consist of several polygons of " "different color, you must use the helper class :class:`Shape` explicitly as " "described below:" msgstr "" -#: ../../library/turtle.rst:1767 +#: ../../library/turtle.rst:1753 msgid "Create an empty Shape object of type \"compound\"." msgstr "" -#: ../../library/turtle.rst:1768 +#: ../../library/turtle.rst:1754 msgid "" "Add as many components to this object as desired, using the :meth:`~Shape." "addcomponent` method." msgstr "" -#: ../../library/turtle.rst:1771 +#: ../../library/turtle.rst:1757 msgid "For example:" msgstr "舉例來說:" -#: ../../library/turtle.rst:1773 +#: ../../library/turtle.rst:1759 msgid "" ">>> s = Shape(\"compound\")\n" ">>> poly1 = ((0,0),(10,-5),(0,10),(-10,-5))\n" @@ -2684,11 +2667,11 @@ msgstr "" ">>> poly2 = ((0,0),(10,-5),(-10,-5))\n" ">>> s.addcomponent(poly2, \"blue\", \"red\")" -#: ../../library/turtle.rst:1782 +#: ../../library/turtle.rst:1768 msgid "Now add the Shape to the Screen's shapelist and use it:" msgstr "" -#: ../../library/turtle.rst:1784 +#: ../../library/turtle.rst:1770 msgid "" ">>> register_shape(\"myshape\", s)\n" ">>> shape(\"myshape\")" @@ -2696,34 +2679,34 @@ msgstr "" ">>> register_shape(\"myshape\", s)\n" ">>> shape(\"myshape\")" -#: ../../library/turtle.rst:1793 +#: ../../library/turtle.rst:1779 msgid "" "The :class:`Shape` class is used internally by the :func:`register_shape` " "method in different ways. The application programmer has to deal with the " "Shape class *only* when using compound shapes like shown above!" msgstr "" -#: ../../library/turtle.rst:1799 +#: ../../library/turtle.rst:1785 msgid "Methods of TurtleScreen/Screen and corresponding functions" msgstr "" -#: ../../library/turtle.rst:1801 +#: ../../library/turtle.rst:1787 msgid "" "Most of the examples in this section refer to a TurtleScreen instance called " "``screen``." msgstr "" -#: ../../library/turtle.rst:1815 +#: ../../library/turtle.rst:1801 msgid "" "a color string or three numbers in the range 0..colormode or a 3-tuple of " "such numbers" msgstr "" -#: ../../library/turtle.rst:1819 +#: ../../library/turtle.rst:1805 msgid "Set or return background color of the TurtleScreen." msgstr "" -#: ../../library/turtle.rst:1821 +#: ../../library/turtle.rst:1807 msgid "" ">>> screen.bgcolor(\"orange\")\n" ">>> screen.bgcolor()\n" @@ -2739,11 +2722,11 @@ msgstr "" ">>> screen.bgcolor()\n" "(128.0, 0.0, 128.0)" -#: ../../library/turtle.rst:1834 +#: ../../library/turtle.rst:1820 msgid "a string, name of a gif-file or ``\"nopic\"``, or ``None``" msgstr "" -#: ../../library/turtle.rst:1836 +#: ../../library/turtle.rst:1822 msgid "" "Set background image or return name of current backgroundimage. If " "*picname* is a filename, set the corresponding image as background. If " @@ -2751,7 +2734,7 @@ msgid "" "*picname* is ``None``, return the filename of the current backgroundimage. ::" msgstr "" -#: ../../library/turtle.rst:1841 +#: ../../library/turtle.rst:1827 msgid "" ">>> screen.bgpic()\n" "'nopic'\n" @@ -2765,44 +2748,44 @@ msgstr "" ">>> screen.bgpic()\n" "\"landscape.gif\"" -#: ../../library/turtle.rst:1852 +#: ../../library/turtle.rst:1838 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``clearscreen``. The global function ``clear`` is a different one " "derived from the Turtle method ``clear``." msgstr "" -#: ../../library/turtle.rst:1859 +#: ../../library/turtle.rst:1845 msgid "" "Delete all drawings and all turtles from the TurtleScreen. Reset the now " "empty TurtleScreen to its initial state: white background, no background " "image, no event bindings and tracing on." msgstr "" -#: ../../library/turtle.rst:1868 +#: ../../library/turtle.rst:1854 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``resetscreen``. The global function ``reset`` is another one derived " "from the Turtle method ``reset``." msgstr "" -#: ../../library/turtle.rst:1875 +#: ../../library/turtle.rst:1861 msgid "Reset all Turtles on the Screen to their initial state." msgstr "" -#: ../../library/turtle.rst:1880 +#: ../../library/turtle.rst:1866 msgid "positive integer, new width of canvas in pixels" msgstr "" -#: ../../library/turtle.rst:1881 +#: ../../library/turtle.rst:1867 msgid "positive integer, new height of canvas in pixels" msgstr "" -#: ../../library/turtle.rst:1882 +#: ../../library/turtle.rst:1868 msgid "colorstring or color-tuple, new background color" msgstr "" -#: ../../library/turtle.rst:1884 +#: ../../library/turtle.rst:1870 msgid "" "If no arguments are given, return current (canvaswidth, canvasheight). Else " "resize the canvas the turtles are drawing on. Do not alter the drawing " @@ -2811,40 +2794,40 @@ msgid "" "outside the canvas before." msgstr "" -#: ../../library/turtle.rst:1896 +#: ../../library/turtle.rst:1882 msgid "e.g. to search for an erroneously escaped turtle ;-)" msgstr "" -#: ../../library/turtle.rst:1901 +#: ../../library/turtle.rst:1887 msgid "a number, x-coordinate of lower left corner of canvas" msgstr "" -#: ../../library/turtle.rst:1902 +#: ../../library/turtle.rst:1888 msgid "a number, y-coordinate of lower left corner of canvas" msgstr "" -#: ../../library/turtle.rst:1903 +#: ../../library/turtle.rst:1889 msgid "a number, x-coordinate of upper right corner of canvas" msgstr "" -#: ../../library/turtle.rst:1904 +#: ../../library/turtle.rst:1890 msgid "a number, y-coordinate of upper right corner of canvas" msgstr "" -#: ../../library/turtle.rst:1906 +#: ../../library/turtle.rst:1892 msgid "" "Set up user-defined coordinate system and switch to mode \"world\" if " "necessary. This performs a ``screen.reset()``. If mode \"world\" is " "already active, all drawings are redrawn according to the new coordinates." msgstr "" -#: ../../library/turtle.rst:1910 +#: ../../library/turtle.rst:1896 msgid "" "**ATTENTION**: in user-defined coordinate systems angles may appear " "distorted." msgstr "" -#: ../../library/turtle.rst:1913 +#: ../../library/turtle.rst:1899 msgid "" ">>> screen.reset()\n" ">>> screen.setworldcoordinates(-50,-7.5,50,7.5)\n" @@ -2855,22 +2838,22 @@ msgid "" "... left(45); fd(2) # a regular octagon" msgstr "" -#: ../../library/turtle.rst:1938 +#: ../../library/turtle.rst:1924 msgid "positive integer" msgstr "" -#: ../../library/turtle.rst:1940 +#: ../../library/turtle.rst:1926 msgid "" "Set or return the drawing *delay* in milliseconds. (This is approximately " "the time interval between two consecutive canvas updates.) The longer the " "drawing delay, the slower the animation." msgstr "" -#: ../../library/turtle.rst:1944 +#: ../../library/turtle.rst:1930 msgid "Optional argument:" msgstr "" -#: ../../library/turtle.rst:1946 +#: ../../library/turtle.rst:1932 msgid "" ">>> screen.delay()\n" "10\n" @@ -2884,11 +2867,11 @@ msgstr "" ">>> screen.delay()\n" "5" -#: ../../library/turtle.rst:1958 ../../library/turtle.rst:1959 +#: ../../library/turtle.rst:1944 ../../library/turtle.rst:1945 msgid "nonnegative integer" msgstr "" -#: ../../library/turtle.rst:1961 +#: ../../library/turtle.rst:1947 msgid "" "Turn turtle animation on/off and set delay for update drawings. If *n* is " "given, only each n-th regular screen update is really performed. (Can be " @@ -2897,7 +2880,7 @@ msgid "" "delay value (see :func:`delay`)." msgstr "" -#: ../../library/turtle.rst:1968 +#: ../../library/turtle.rst:1954 msgid "" ">>> screen.tracer(8, 25)\n" ">>> dist = 2\n" @@ -2913,37 +2896,37 @@ msgstr "" "... rt(90)\n" "... dist += 2" -#: ../../library/turtle.rst:1981 +#: ../../library/turtle.rst:1967 msgid "Perform a TurtleScreen update. To be used when tracer is turned off." msgstr "" -#: ../../library/turtle.rst:1983 +#: ../../library/turtle.rst:1969 msgid "See also the RawTurtle/Turtle method :func:`speed`." msgstr "" -#: ../../library/turtle.rst:1991 +#: ../../library/turtle.rst:1977 msgid "" "Set focus on TurtleScreen (in order to collect key-events). Dummy arguments " "are provided in order to be able to pass :func:`listen` to the onclick " "method." msgstr "" -#: ../../library/turtle.rst:1998 ../../library/turtle.rst:2018 +#: ../../library/turtle.rst:1984 ../../library/turtle.rst:2004 msgid "a function with no arguments or ``None``" msgstr "" -#: ../../library/turtle.rst:1999 ../../library/turtle.rst:2019 +#: ../../library/turtle.rst:1985 ../../library/turtle.rst:2005 msgid "a string: key (e.g. \"a\") or key-symbol (e.g. \"space\")" msgstr "" -#: ../../library/turtle.rst:2001 +#: ../../library/turtle.rst:1987 msgid "" "Bind *fun* to key-release event of key. If *fun* is ``None``, event " "bindings are removed. Remark: in order to be able to register key-events, " "TurtleScreen must have the focus. (See method :func:`listen`.)" msgstr "" -#: ../../library/turtle.rst:2005 +#: ../../library/turtle.rst:1991 msgid "" ">>> def f():\n" "... fd(50)\n" @@ -2959,14 +2942,14 @@ msgstr "" ">>> screen.onkey(f, \"Up\")\n" ">>> screen.listen()" -#: ../../library/turtle.rst:2021 +#: ../../library/turtle.rst:2007 msgid "" "Bind *fun* to key-press event of key if key is given, or to any key-press-" "event if no key is given. Remark: in order to be able to register key-" "events, TurtleScreen must have focus. (See method :func:`listen`.)" msgstr "" -#: ../../library/turtle.rst:2026 +#: ../../library/turtle.rst:2012 msgid "" ">>> def f():\n" "... fd(50)\n" @@ -2980,19 +2963,19 @@ msgstr "" ">>> screen.onkey(f, \"Up\")\n" ">>> screen.listen()" -#: ../../library/turtle.rst:2045 +#: ../../library/turtle.rst:2031 msgid "" "Bind *fun* to mouse-click events on this screen. If *fun* is ``None``, " "existing bindings are removed." msgstr "" -#: ../../library/turtle.rst:2048 +#: ../../library/turtle.rst:2034 msgid "" "Example for a TurtleScreen instance named ``screen`` and a Turtle instance " "named ``turtle``:" msgstr "" -#: ../../library/turtle.rst:2051 +#: ../../library/turtle.rst:2037 msgid "" ">>> screen.onclick(turtle.goto) # Subsequently clicking into the " "TurtleScreen will\n" @@ -3001,26 +2984,26 @@ msgid "" ">>> screen.onclick(None) # remove event binding again" msgstr "" -#: ../../library/turtle.rst:2059 +#: ../../library/turtle.rst:2045 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``onscreenclick``. The global function ``onclick`` is another one " "derived from the Turtle method ``onclick``." msgstr "" -#: ../../library/turtle.rst:2066 +#: ../../library/turtle.rst:2052 msgid "a function with no arguments" msgstr "" -#: ../../library/turtle.rst:2067 +#: ../../library/turtle.rst:2053 msgid "a number >= 0" msgstr "" -#: ../../library/turtle.rst:2069 +#: ../../library/turtle.rst:2055 msgid "Install a timer that calls *fun* after *t* milliseconds." msgstr "" -#: ../../library/turtle.rst:2071 +#: ../../library/turtle.rst:2057 msgid "" ">>> running = True\n" ">>> def f():\n" @@ -3032,7 +3015,7 @@ msgid "" ">>> running = False" msgstr "" -#: ../../library/turtle.rst:2087 +#: ../../library/turtle.rst:2073 msgid "" "Starts event loop - calling Tkinter's mainloop function. Must be the last " "statement in a turtle graphics program. Must *not* be used if a script is " @@ -3040,16 +3023,16 @@ msgid "" "turtle graphics. ::" msgstr "" -#: ../../library/turtle.rst:2092 +#: ../../library/turtle.rst:2078 msgid ">>> screen.mainloop()" msgstr ">>> screen.mainloop()" -#: ../../library/turtle.rst:2100 ../../library/turtle.rst:2101 -#: ../../library/turtle.rst:2113 ../../library/turtle.rst:2114 +#: ../../library/turtle.rst:2086 ../../library/turtle.rst:2087 +#: ../../library/turtle.rst:2099 ../../library/turtle.rst:2100 msgid "string" msgstr "string(字串)" -#: ../../library/turtle.rst:2103 +#: ../../library/turtle.rst:2089 msgid "" "Pop up a dialog window for input of a string. Parameter title is the title " "of the dialog window, prompt is a text mostly describing what information to " @@ -3057,11 +3040,11 @@ msgid "" "``None``. ::" msgstr "" -#: ../../library/turtle.rst:2108 +#: ../../library/turtle.rst:2094 msgid ">>> screen.textinput(\"NIM\", \"Name of first player:\")" msgstr ">>> screen.textinput(\"NIM\", \"Name of first player:\")" -#: ../../library/turtle.rst:2119 +#: ../../library/turtle.rst:2105 msgid "" "Pop up a dialog window for input of a number. title is the title of the " "dialog window, prompt is a text mostly describing what numerical information " @@ -3072,7 +3055,7 @@ msgid "" "return ``None``. ::" msgstr "" -#: ../../library/turtle.rst:2128 +#: ../../library/turtle.rst:2114 msgid "" ">>> screen.numinput(\"Poker\", \"Your stakes:\", 1000, minval=10, " "maxval=10000)" @@ -3080,17 +3063,17 @@ msgstr "" ">>> screen.numinput(\"Poker\", \"Your stakes:\", 1000, minval=10, " "maxval=10000)" -#: ../../library/turtle.rst:2136 +#: ../../library/turtle.rst:2122 msgid "one of the strings \"standard\", \"logo\" or \"world\"" msgstr "" -#: ../../library/turtle.rst:2138 +#: ../../library/turtle.rst:2124 msgid "" "Set turtle mode (\"standard\", \"logo\" or \"world\") and perform reset. If " "mode is not given, current mode is returned." msgstr "" -#: ../../library/turtle.rst:2141 +#: ../../library/turtle.rst:2127 msgid "" "Mode \"standard\" is compatible with old :mod:`turtle`. Mode \"logo\" is " "compatible with most Logo turtle graphics. Mode \"world\" uses user-defined " @@ -3098,60 +3081,60 @@ msgid "" "if ``x/y`` unit-ratio doesn't equal 1." msgstr "" -#: ../../library/turtle.rst:2147 +#: ../../library/turtle.rst:2133 msgid "Mode" msgstr "" -#: ../../library/turtle.rst:2147 +#: ../../library/turtle.rst:2133 msgid "Initial turtle heading" msgstr "" -#: ../../library/turtle.rst:2147 +#: ../../library/turtle.rst:2133 msgid "positive angles" msgstr "" -#: ../../library/turtle.rst:2149 +#: ../../library/turtle.rst:2135 msgid "\"standard\"" msgstr "" -#: ../../library/turtle.rst:2149 +#: ../../library/turtle.rst:2135 msgid "to the right (east)" msgstr "" -#: ../../library/turtle.rst:2149 +#: ../../library/turtle.rst:2135 msgid "counterclockwise" msgstr "" -#: ../../library/turtle.rst:2150 +#: ../../library/turtle.rst:2136 msgid "\"logo\"" msgstr "" -#: ../../library/turtle.rst:2150 +#: ../../library/turtle.rst:2136 msgid "upward (north)" msgstr "" -#: ../../library/turtle.rst:2150 +#: ../../library/turtle.rst:2136 msgid "clockwise" msgstr "" -#: ../../library/turtle.rst:2153 +#: ../../library/turtle.rst:2139 msgid "" ">>> mode(\"logo\") # resets turtle heading to north\n" ">>> mode()\n" "'logo'" msgstr "" -#: ../../library/turtle.rst:2163 +#: ../../library/turtle.rst:2149 msgid "one of the values 1.0 or 255" msgstr "" -#: ../../library/turtle.rst:2165 +#: ../../library/turtle.rst:2151 msgid "" "Return the colormode or set it to 1.0 or 255. Subsequently *r*, *g*, *b* " "values of color triples have to be in the range 0..*cmode*." msgstr "" -#: ../../library/turtle.rst:2168 +#: ../../library/turtle.rst:2154 msgid "" ">>> screen.colormode(1)\n" ">>> turtle.pencolor(240, 160, 80)\n" @@ -3177,13 +3160,13 @@ msgstr "" "255\n" ">>> turtle.pencolor(240,160,80)" -#: ../../library/turtle.rst:2186 +#: ../../library/turtle.rst:2172 msgid "" "Return the Canvas of this TurtleScreen. Useful for insiders who know what " "to do with a Tkinter Canvas." msgstr "" -#: ../../library/turtle.rst:2189 +#: ../../library/turtle.rst:2175 msgid "" ">>> cv = screen.getcanvas()\n" ">>> cv\n" @@ -3193,11 +3176,11 @@ msgstr "" ">>> cv\n" "" -#: ../../library/turtle.rst:2199 +#: ../../library/turtle.rst:2185 msgid "Return a list of names of all currently available turtle shapes." msgstr "" -#: ../../library/turtle.rst:2201 +#: ../../library/turtle.rst:2187 msgid "" ">>> screen.getshapes()\n" "['arrow', 'blank', 'circle', ..., 'turtle']" @@ -3205,53 +3188,53 @@ msgstr "" ">>> screen.getshapes()\n" "['arrow', 'blank', 'circle', ..., 'turtle']" -#: ../../library/turtle.rst:2211 +#: ../../library/turtle.rst:2197 msgid "There are three different ways to call this function:" msgstr "" -#: ../../library/turtle.rst:2213 +#: ../../library/turtle.rst:2199 msgid "" "*name* is the name of a gif-file and *shape* is ``None``: Install the " "corresponding image shape. ::" msgstr "" -#: ../../library/turtle.rst:2216 +#: ../../library/turtle.rst:2202 msgid ">>> screen.register_shape(\"turtle.gif\")" msgstr ">>> screen.register_shape(\"turtle.gif\")" -#: ../../library/turtle.rst:2219 +#: ../../library/turtle.rst:2205 msgid "" "Image shapes *do not* rotate when turning the turtle, so they do not display " "the heading of the turtle!" msgstr "" -#: ../../library/turtle.rst:2222 +#: ../../library/turtle.rst:2208 msgid "" "*name* is an arbitrary string and *shape* is a tuple of pairs of " "coordinates: Install the corresponding polygon shape." msgstr "" -#: ../../library/turtle.rst:2225 +#: ../../library/turtle.rst:2211 msgid ">>> screen.register_shape(\"triangle\", ((5,-3), (0,5), (-5,-3)))" msgstr ">>> screen.register_shape(\"triangle\", ((5,-3), (0,5), (-5,-3)))" -#: ../../library/turtle.rst:2230 +#: ../../library/turtle.rst:2216 msgid "" "*name* is an arbitrary string and *shape* is a (compound) :class:`Shape` " "object: Install the corresponding compound shape." msgstr "" -#: ../../library/turtle.rst:2233 +#: ../../library/turtle.rst:2219 msgid "" "Add a turtle shape to TurtleScreen's shapelist. Only thusly registered " "shapes can be used by issuing the command ``shape(shapename)``." msgstr "" -#: ../../library/turtle.rst:2239 +#: ../../library/turtle.rst:2225 msgid "Return the list of turtles on the screen." msgstr "" -#: ../../library/turtle.rst:2241 +#: ../../library/turtle.rst:2227 msgid "" ">>> for turtle in screen.turtles():\n" "... turtle.color(\"red\")" @@ -3259,11 +3242,11 @@ msgstr "" ">>> for turtle in screen.turtles():\n" "... turtle.color(\"red\")" -#: ../../library/turtle.rst:2250 +#: ../../library/turtle.rst:2236 msgid "Return the height of the turtle window. ::" msgstr "" -#: ../../library/turtle.rst:2252 +#: ../../library/turtle.rst:2238 msgid "" ">>> screen.window_height()\n" "480" @@ -3271,11 +3254,11 @@ msgstr "" ">>> screen.window_height()\n" "480" -#: ../../library/turtle.rst:2258 +#: ../../library/turtle.rst:2244 msgid "Return the width of the turtle window. ::" msgstr "" -#: ../../library/turtle.rst:2260 +#: ../../library/turtle.rst:2246 msgid "" ">>> screen.window_width()\n" "640" @@ -3283,19 +3266,19 @@ msgstr "" ">>> screen.window_width()\n" "640" -#: ../../library/turtle.rst:2267 +#: ../../library/turtle.rst:2253 msgid "Methods specific to Screen, not inherited from TurtleScreen" msgstr "" -#: ../../library/turtle.rst:2271 +#: ../../library/turtle.rst:2257 msgid "Shut the turtlegraphics window." msgstr "" -#: ../../library/turtle.rst:2276 +#: ../../library/turtle.rst:2262 msgid "Bind ``bye()`` method to mouse clicks on the Screen." msgstr "" -#: ../../library/turtle.rst:2279 +#: ../../library/turtle.rst:2265 msgid "" "If the value \"using_IDLE\" in the configuration dictionary is ``False`` " "(default value), also enter mainloop. Remark: If IDLE with the ``-n`` " @@ -3304,38 +3287,38 @@ msgid "" "client script." msgstr "" -#: ../../library/turtle.rst:2288 +#: ../../library/turtle.rst:2274 msgid "" "Set the size and position of the main window. Default values of arguments " "are stored in the configuration dictionary and can be changed via a :file:" "`turtle.cfg` file." msgstr "" -#: ../../library/turtle.rst:2292 +#: ../../library/turtle.rst:2278 msgid "" "if an integer, a size in pixels, if a float, a fraction of the screen; " "default is 50% of screen" msgstr "" -#: ../../library/turtle.rst:2294 +#: ../../library/turtle.rst:2280 msgid "" "if an integer, the height in pixels, if a float, a fraction of the screen; " "default is 75% of screen" msgstr "" -#: ../../library/turtle.rst:2296 +#: ../../library/turtle.rst:2282 msgid "" "if positive, starting position in pixels from the left edge of the screen, " "if negative from the right edge, if ``None``, center window horizontally" msgstr "" -#: ../../library/turtle.rst:2299 +#: ../../library/turtle.rst:2285 msgid "" "if positive, starting position in pixels from the top edge of the screen, if " "negative from the bottom edge, if ``None``, center window vertically" msgstr "" -#: ../../library/turtle.rst:2303 +#: ../../library/turtle.rst:2289 msgid "" ">>> screen.setup (width=200, height=200, startx=0, starty=0)\n" ">>> # sets window to 200x200 pixels, in upper left of screen\n" @@ -3343,128 +3326,128 @@ msgid "" ">>> # sets window to 75% of screen by 50% of screen and centers" msgstr "" -#: ../../library/turtle.rst:2314 +#: ../../library/turtle.rst:2300 msgid "a string that is shown in the titlebar of the turtle graphics window" msgstr "" -#: ../../library/turtle.rst:2317 +#: ../../library/turtle.rst:2303 msgid "Set title of turtle window to *titlestring*." msgstr "" -#: ../../library/turtle.rst:2319 +#: ../../library/turtle.rst:2305 msgid ">>> screen.title(\"Welcome to the turtle zoo!\")" msgstr ">>> screen.title(\"Welcome to the turtle zoo!\")" -#: ../../library/turtle.rst:2326 +#: ../../library/turtle.rst:2312 msgid "Public classes" msgstr "" -#: ../../library/turtle.rst:2332 +#: ../../library/turtle.rst:2318 msgid "" "a :class:`!tkinter.Canvas`, a :class:`ScrolledCanvas` or a :class:" "`TurtleScreen`" msgstr "" -#: ../../library/turtle.rst:2335 +#: ../../library/turtle.rst:2321 msgid "" "Create a turtle. The turtle has all methods described above as \"methods of " "Turtle/RawTurtle\"." msgstr "" -#: ../../library/turtle.rst:2341 +#: ../../library/turtle.rst:2327 msgid "" "Subclass of RawTurtle, has the same interface but draws on a default :class:" "`Screen` object created automatically when needed for the first time." msgstr "" -#: ../../library/turtle.rst:2347 +#: ../../library/turtle.rst:2333 msgid "a :class:`!tkinter.Canvas`" msgstr "" -#: ../../library/turtle.rst:2349 +#: ../../library/turtle.rst:2335 msgid "" "Provides screen oriented methods like :func:`bgcolor` etc. that are " "described above." msgstr "" -#: ../../library/turtle.rst:2354 +#: ../../library/turtle.rst:2340 msgid "" "Subclass of TurtleScreen, with :ref:`four methods added `." msgstr "" -#: ../../library/turtle.rst:2359 +#: ../../library/turtle.rst:2345 msgid "" "some Tkinter widget to contain the ScrolledCanvas, i.e. a Tkinter-canvas " "with scrollbars added" msgstr "" -#: ../../library/turtle.rst:2362 +#: ../../library/turtle.rst:2348 msgid "" "Used by class Screen, which thus automatically provides a ScrolledCanvas as " "playground for the turtles." msgstr "" -#: ../../library/turtle.rst:2367 +#: ../../library/turtle.rst:2353 msgid "one of the strings \"polygon\", \"image\", \"compound\"" msgstr "" -#: ../../library/turtle.rst:2369 +#: ../../library/turtle.rst:2355 msgid "" "Data structure modeling shapes. The pair ``(type_, data)`` must follow this " "specification:" msgstr "" -#: ../../library/turtle.rst:2374 +#: ../../library/turtle.rst:2360 msgid "*type_*" msgstr "*type_*" -#: ../../library/turtle.rst:2374 +#: ../../library/turtle.rst:2360 msgid "*data*" msgstr "*data*" -#: ../../library/turtle.rst:2376 +#: ../../library/turtle.rst:2362 msgid "\"polygon\"" msgstr "\"polygon\"" -#: ../../library/turtle.rst:2376 +#: ../../library/turtle.rst:2362 msgid "a polygon-tuple, i.e. a tuple of pairs of coordinates" msgstr "" -#: ../../library/turtle.rst:2377 +#: ../../library/turtle.rst:2363 msgid "\"image\"" msgstr "\"image\"" -#: ../../library/turtle.rst:2377 +#: ../../library/turtle.rst:2363 msgid "an image (in this form only used internally!)" msgstr "" -#: ../../library/turtle.rst:2378 +#: ../../library/turtle.rst:2364 msgid "\"compound\"" msgstr "\"compound\"" -#: ../../library/turtle.rst:2378 +#: ../../library/turtle.rst:2364 msgid "" "``None`` (a compound shape has to be constructed using the :meth:" "`addcomponent` method)" msgstr "" -#: ../../library/turtle.rst:2384 +#: ../../library/turtle.rst:2370 msgid "a polygon, i.e. a tuple of pairs of numbers" msgstr "" -#: ../../library/turtle.rst:2385 +#: ../../library/turtle.rst:2371 msgid "a color the *poly* will be filled with" msgstr "" -#: ../../library/turtle.rst:2386 +#: ../../library/turtle.rst:2372 msgid "a color for the poly's outline (if given)" msgstr "" -#: ../../library/turtle.rst:2388 +#: ../../library/turtle.rst:2374 msgid "Example:" msgstr "例如:" -#: ../../library/turtle.rst:2390 +#: ../../library/turtle.rst:2376 msgid "" ">>> poly = ((0,0),(10,-5),(0,10),(-10,-5))\n" ">>> s = Shape(\"compound\")\n" @@ -3472,63 +3455,63 @@ msgid "" ">>> # ... add more components and then use register_shape()" msgstr "" -#: ../../library/turtle.rst:2398 +#: ../../library/turtle.rst:2384 msgid "See :ref:`compoundshapes`." msgstr "請見\\ :ref:`compoundshapes`。" -#: ../../library/turtle.rst:2403 +#: ../../library/turtle.rst:2389 msgid "" "A two-dimensional vector class, used as a helper class for implementing " "turtle graphics. May be useful for turtle graphics programs too. Derived " "from tuple, so a vector is a tuple!" msgstr "" -#: ../../library/turtle.rst:2407 +#: ../../library/turtle.rst:2393 msgid "Provides (for *a*, *b* vectors, *k* number):" msgstr "" -#: ../../library/turtle.rst:2409 +#: ../../library/turtle.rst:2395 msgid "``a + b`` vector addition" msgstr "``a + b`` 向量加法" -#: ../../library/turtle.rst:2410 +#: ../../library/turtle.rst:2396 msgid "``a - b`` vector subtraction" msgstr "``a - b`` 向量減法" -#: ../../library/turtle.rst:2411 +#: ../../library/turtle.rst:2397 msgid "``a * b`` inner product" msgstr "``a * b`` 內積" -#: ../../library/turtle.rst:2412 +#: ../../library/turtle.rst:2398 msgid "``k * a`` and ``a * k`` multiplication with scalar" msgstr "" -#: ../../library/turtle.rst:2413 +#: ../../library/turtle.rst:2399 msgid "``abs(a)`` absolute value of a" msgstr "``abs(a)`` a 的絕對值" -#: ../../library/turtle.rst:2414 +#: ../../library/turtle.rst:2400 msgid "``a.rotate(angle)`` rotation" msgstr "``a.rotate(angle)`` 旋轉" -#: ../../library/turtle.rst:2420 +#: ../../library/turtle.rst:2406 msgid "Explanation" msgstr "解釋" -#: ../../library/turtle.rst:2422 +#: ../../library/turtle.rst:2408 msgid "" "A turtle object draws on a screen object, and there a number of key classes " "in the turtle object-oriented interface that can be used to create them and " "relate them to each other." msgstr "" -#: ../../library/turtle.rst:2426 +#: ../../library/turtle.rst:2412 msgid "" "A :class:`Turtle` instance will automatically create a :class:`Screen` " "instance if one is not already present." msgstr "" -#: ../../library/turtle.rst:2429 +#: ../../library/turtle.rst:2415 msgid "" "``Turtle`` is a subclass of :class:`RawTurtle`, which *doesn't* " "automatically create a drawing surface - a *canvas* will need to be provided " @@ -3536,7 +3519,7 @@ msgid "" "`ScrolledCanvas` or :class:`TurtleScreen`." msgstr "" -#: ../../library/turtle.rst:2435 +#: ../../library/turtle.rst:2421 msgid "" ":class:`TurtleScreen` is the basic drawing surface for a turtle. :class:" "`Screen` is a subclass of ``TurtleScreen``, and includes :ref:`some " @@ -3545,7 +3528,7 @@ msgid "" "`!tkinter.Canvas` or a :class:`ScrolledCanvas` as an argument." msgstr "" -#: ../../library/turtle.rst:2442 +#: ../../library/turtle.rst:2428 msgid "" "The functional interface for turtle graphics uses the various methods of " "``Turtle`` and ``TurtleScreen``/``Screen``. Behind the scenes, a screen " @@ -3554,38 +3537,38 @@ msgid "" "created whenever any of the functions derived from a Turtle method is called." msgstr "" -#: ../../library/turtle.rst:2448 +#: ../../library/turtle.rst:2434 msgid "" "To use multiple turtles on a screen, the object-oriented interface must be " "used." msgstr "" -#: ../../library/turtle.rst:2453 +#: ../../library/turtle.rst:2439 msgid "Help and configuration" msgstr "" -#: ../../library/turtle.rst:2456 +#: ../../library/turtle.rst:2442 msgid "How to use help" msgstr "" -#: ../../library/turtle.rst:2458 +#: ../../library/turtle.rst:2444 msgid "" "The public methods of the Screen and Turtle classes are documented " "extensively via docstrings. So these can be used as online-help via the " "Python help facilities:" msgstr "" -#: ../../library/turtle.rst:2462 +#: ../../library/turtle.rst:2448 msgid "" "When using IDLE, tooltips show the signatures and first lines of the " "docstrings of typed in function-/method calls." msgstr "" -#: ../../library/turtle.rst:2465 +#: ../../library/turtle.rst:2451 msgid "Calling :func:`help` on methods or functions displays the docstrings::" msgstr "" -#: ../../library/turtle.rst:2467 +#: ../../library/turtle.rst:2453 msgid "" ">>> help(Screen.bgcolor)\n" "Help on method bgcolor in module turtle:\n" @@ -3645,13 +3628,13 @@ msgstr "" "\n" " >>> turtle.penup()" -#: ../../library/turtle.rst:2496 +#: ../../library/turtle.rst:2482 msgid "" "The docstrings of the functions which are derived from methods have a " "modified form::" msgstr "" -#: ../../library/turtle.rst:2499 +#: ../../library/turtle.rst:2485 msgid "" ">>> help(bgcolor)\n" "Help on function bgcolor in module turtle:\n" @@ -3715,28 +3698,28 @@ msgstr "" " Example:\n" " >>> penup()" -#: ../../library/turtle.rst:2530 +#: ../../library/turtle.rst:2516 msgid "" "These modified docstrings are created automatically together with the " "function definitions that are derived from the methods at import time." msgstr "" -#: ../../library/turtle.rst:2535 +#: ../../library/turtle.rst:2521 msgid "Translation of docstrings into different languages" msgstr "" -#: ../../library/turtle.rst:2537 +#: ../../library/turtle.rst:2523 msgid "" "There is a utility to create a dictionary the keys of which are the method " "names and the values of which are the docstrings of the public methods of " "the classes Screen and Turtle." msgstr "" -#: ../../library/turtle.rst:2543 +#: ../../library/turtle.rst:2529 msgid "a string, used as filename" msgstr "" -#: ../../library/turtle.rst:2545 +#: ../../library/turtle.rst:2531 msgid "" "Create and write docstring-dictionary to a Python script with the given " "filename. This function has to be called explicitly (it is not used by the " @@ -3745,37 +3728,37 @@ msgid "" "for translation of the docstrings into different languages." msgstr "" -#: ../../library/turtle.rst:2551 +#: ../../library/turtle.rst:2537 msgid "" "If you (or your students) want to use :mod:`turtle` with online help in your " "native language, you have to translate the docstrings and save the resulting " "file as e.g. :file:`turtle_docstringdict_german.py`." msgstr "" -#: ../../library/turtle.rst:2555 +#: ../../library/turtle.rst:2541 msgid "" "If you have an appropriate entry in your :file:`turtle.cfg` file this " "dictionary will be read in at import time and will replace the original " "English docstrings." msgstr "" -#: ../../library/turtle.rst:2558 +#: ../../library/turtle.rst:2544 msgid "" "At the time of this writing there are docstring dictionaries in German and " "in Italian. (Requests please to glingl@aon.at.)" msgstr "" -#: ../../library/turtle.rst:2564 +#: ../../library/turtle.rst:2550 msgid "How to configure Screen and Turtles" msgstr "" -#: ../../library/turtle.rst:2566 +#: ../../library/turtle.rst:2552 msgid "" "The built-in default configuration mimics the appearance and behaviour of " "the old turtle module in order to retain best possible compatibility with it." msgstr "" -#: ../../library/turtle.rst:2569 +#: ../../library/turtle.rst:2555 msgid "" "If you want to use a different configuration which better reflects the " "features of this module or which better fits to your needs, e.g. for use in " @@ -3784,12 +3767,12 @@ msgid "" "settings." msgstr "" -#: ../../library/turtle.rst:2574 +#: ../../library/turtle.rst:2560 msgid "" "The built in configuration would correspond to the following ``turtle.cfg``:" msgstr "" -#: ../../library/turtle.rst:2576 +#: ../../library/turtle.rst:2562 msgid "" "width = 0.5\n" "height = 0.75\n" @@ -3833,49 +3816,49 @@ msgstr "" "title = Python Turtle Graphics\n" "using_IDLE = False" -#: ../../library/turtle.rst:2599 +#: ../../library/turtle.rst:2585 msgid "Short explanation of selected entries:" msgstr "" -#: ../../library/turtle.rst:2601 +#: ../../library/turtle.rst:2587 msgid "" "The first four lines correspond to the arguments of the :func:`Screen.setup " "` method." msgstr "" -#: ../../library/turtle.rst:2603 +#: ../../library/turtle.rst:2589 msgid "" "Line 5 and 6 correspond to the arguments of the method :func:`Screen." "screensize `." msgstr "" -#: ../../library/turtle.rst:2605 +#: ../../library/turtle.rst:2591 msgid "" "*shape* can be any of the built-in shapes, e.g: arrow, turtle, etc. For " "more info try ``help(shape)``." msgstr "" -#: ../../library/turtle.rst:2607 +#: ../../library/turtle.rst:2593 msgid "" "If you want to use no fill color (i.e. make the turtle transparent), you " "have to write ``fillcolor = \"\"`` (but all nonempty strings must not have " "quotes in the cfg file)." msgstr "" -#: ../../library/turtle.rst:2610 +#: ../../library/turtle.rst:2596 msgid "" "If you want to reflect the turtle its state, you have to use ``resizemode = " "auto``." msgstr "" -#: ../../library/turtle.rst:2612 +#: ../../library/turtle.rst:2598 msgid "" "If you set e.g. ``language = italian`` the docstringdict :file:" "`turtle_docstringdict_italian.py` will be loaded at import time (if present " "on the import path, e.g. in the same directory as :mod:`turtle`)." msgstr "" -#: ../../library/turtle.rst:2615 +#: ../../library/turtle.rst:2601 msgid "" "The entries *exampleturtle* and *examplescreen* define the names of these " "objects as they occur in the docstrings. The transformation of method-" @@ -3883,309 +3866,309 @@ msgid "" "docstrings." msgstr "" -#: ../../library/turtle.rst:2619 +#: ../../library/turtle.rst:2605 msgid "" "*using_IDLE*: Set this to ``True`` if you regularly work with IDLE and its " "``-n`` switch (\"no subprocess\"). This will prevent :func:`exitonclick` to " "enter the mainloop." msgstr "" -#: ../../library/turtle.rst:2623 +#: ../../library/turtle.rst:2609 msgid "" "There can be a :file:`turtle.cfg` file in the directory where :mod:`turtle` " "is stored and an additional one in the current working directory. The " "latter will override the settings of the first one." msgstr "" -#: ../../library/turtle.rst:2627 +#: ../../library/turtle.rst:2613 msgid "" "The :file:`Lib/turtledemo` directory contains a :file:`turtle.cfg` file. " "You can study it as an example and see its effects when running the demos " "(preferably not from within the demo-viewer)." msgstr "" -#: ../../library/turtle.rst:2633 +#: ../../library/turtle.rst:2619 msgid ":mod:`turtledemo` --- Demo scripts" msgstr "" -#: ../../library/turtle.rst:2638 +#: ../../library/turtle.rst:2624 msgid "" "The :mod:`turtledemo` package includes a set of demo scripts. These scripts " "can be run and viewed using the supplied demo viewer as follows::" msgstr "" -#: ../../library/turtle.rst:2641 +#: ../../library/turtle.rst:2627 msgid "python -m turtledemo" msgstr "python -m turtledemo" -#: ../../library/turtle.rst:2643 +#: ../../library/turtle.rst:2629 msgid "" "Alternatively, you can run the demo scripts individually. For example, ::" msgstr "" -#: ../../library/turtle.rst:2645 +#: ../../library/turtle.rst:2631 msgid "python -m turtledemo.bytedesign" msgstr "python -m turtledemo.bytedesign" -#: ../../library/turtle.rst:2647 +#: ../../library/turtle.rst:2633 msgid "The :mod:`turtledemo` package directory contains:" msgstr "" -#: ../../library/turtle.rst:2649 +#: ../../library/turtle.rst:2635 msgid "" "A demo viewer :file:`__main__.py` which can be used to view the sourcecode " "of the scripts and run them at the same time." msgstr "" -#: ../../library/turtle.rst:2651 +#: ../../library/turtle.rst:2637 msgid "" "Multiple scripts demonstrating different features of the :mod:`turtle` " "module. Examples can be accessed via the Examples menu. They can also be " "run standalone." msgstr "" -#: ../../library/turtle.rst:2654 +#: ../../library/turtle.rst:2640 msgid "" "A :file:`turtle.cfg` file which serves as an example of how to write and use " "such files." msgstr "" -#: ../../library/turtle.rst:2657 +#: ../../library/turtle.rst:2643 msgid "The demo scripts are:" msgstr "" -#: ../../library/turtle.rst:2664 +#: ../../library/turtle.rst:2650 msgid "Name" msgstr "" -#: ../../library/turtle.rst:2664 +#: ../../library/turtle.rst:2650 msgid "Description" msgstr "描述" -#: ../../library/turtle.rst:2664 +#: ../../library/turtle.rst:2650 msgid "Features" msgstr "" -#: ../../library/turtle.rst:2666 +#: ../../library/turtle.rst:2652 msgid "bytedesign" msgstr "" -#: ../../library/turtle.rst:2666 +#: ../../library/turtle.rst:2652 msgid "complex classical turtle graphics pattern" msgstr "" -#: ../../library/turtle.rst:2666 +#: ../../library/turtle.rst:2652 msgid ":func:`tracer`, delay, :func:`update`" msgstr "" -#: ../../library/turtle.rst:2669 +#: ../../library/turtle.rst:2655 msgid "chaos" msgstr "" -#: ../../library/turtle.rst:2669 +#: ../../library/turtle.rst:2655 msgid "" "graphs Verhulst dynamics, shows that computer's computations can generate " "results sometimes against the common sense expectations" msgstr "" -#: ../../library/turtle.rst:2669 +#: ../../library/turtle.rst:2655 msgid "world coordinates" msgstr "" -#: ../../library/turtle.rst:2675 +#: ../../library/turtle.rst:2661 msgid "clock" msgstr "" -#: ../../library/turtle.rst:2675 +#: ../../library/turtle.rst:2661 msgid "analog clock showing time of your computer" msgstr "" -#: ../../library/turtle.rst:2675 +#: ../../library/turtle.rst:2661 msgid "turtles as clock's hands, ontimer" msgstr "" -#: ../../library/turtle.rst:2678 +#: ../../library/turtle.rst:2664 msgid "colormixer" msgstr "" -#: ../../library/turtle.rst:2678 +#: ../../library/turtle.rst:2664 msgid "experiment with r, g, b" msgstr "" -#: ../../library/turtle.rst:2680 +#: ../../library/turtle.rst:2666 msgid "forest" msgstr "" -#: ../../library/turtle.rst:2680 +#: ../../library/turtle.rst:2666 msgid "3 breadth-first trees" msgstr "" -#: ../../library/turtle.rst:2680 +#: ../../library/turtle.rst:2666 msgid "randomization" msgstr "" -#: ../../library/turtle.rst:2682 +#: ../../library/turtle.rst:2668 msgid "fractalcurves" msgstr "" -#: ../../library/turtle.rst:2682 +#: ../../library/turtle.rst:2668 msgid "Hilbert & Koch curves" msgstr "" -#: ../../library/turtle.rst:2682 +#: ../../library/turtle.rst:2668 msgid "recursion" msgstr "" -#: ../../library/turtle.rst:2684 +#: ../../library/turtle.rst:2670 msgid "lindenmayer" msgstr "" -#: ../../library/turtle.rst:2684 +#: ../../library/turtle.rst:2670 msgid "ethnomathematics (indian kolams)" msgstr "" -#: ../../library/turtle.rst:2684 +#: ../../library/turtle.rst:2670 msgid "L-System" msgstr "" -#: ../../library/turtle.rst:2687 +#: ../../library/turtle.rst:2673 msgid "minimal_hanoi" msgstr "minimal_hanoi" -#: ../../library/turtle.rst:2687 +#: ../../library/turtle.rst:2673 msgid "Towers of Hanoi" msgstr "" -#: ../../library/turtle.rst:2687 +#: ../../library/turtle.rst:2673 msgid "Rectangular Turtles as Hanoi discs (shape, shapesize)" msgstr "" -#: ../../library/turtle.rst:2691 +#: ../../library/turtle.rst:2677 msgid "nim" msgstr "" -#: ../../library/turtle.rst:2691 +#: ../../library/turtle.rst:2677 msgid "" "play the classical nim game with three heaps of sticks against the computer." msgstr "" -#: ../../library/turtle.rst:2691 +#: ../../library/turtle.rst:2677 msgid "turtles as nimsticks, event driven (mouse, keyboard)" msgstr "" -#: ../../library/turtle.rst:2695 +#: ../../library/turtle.rst:2681 msgid "paint" msgstr "" -#: ../../library/turtle.rst:2695 +#: ../../library/turtle.rst:2681 msgid "super minimalistic drawing program" msgstr "" -#: ../../library/turtle.rst:2698 +#: ../../library/turtle.rst:2684 msgid "peace" msgstr "" -#: ../../library/turtle.rst:2698 +#: ../../library/turtle.rst:2684 msgid "elementary" msgstr "" -#: ../../library/turtle.rst:2698 +#: ../../library/turtle.rst:2684 msgid "turtle: appearance and animation" msgstr "" -#: ../../library/turtle.rst:2701 +#: ../../library/turtle.rst:2687 msgid "penrose" msgstr "" -#: ../../library/turtle.rst:2701 +#: ../../library/turtle.rst:2687 msgid "aperiodic tiling with kites and darts" msgstr "" -#: ../../library/turtle.rst:2704 +#: ../../library/turtle.rst:2690 msgid "planet_and_moon" msgstr "planet_and_moon" -#: ../../library/turtle.rst:2704 +#: ../../library/turtle.rst:2690 msgid "simulation of gravitational system" msgstr "" -#: ../../library/turtle.rst:2704 +#: ../../library/turtle.rst:2690 msgid "compound shapes, :class:`Vec2D`" msgstr "" -#: ../../library/turtle.rst:2707 +#: ../../library/turtle.rst:2693 msgid "rosette" msgstr "" -#: ../../library/turtle.rst:2707 +#: ../../library/turtle.rst:2693 msgid "a pattern from the wikipedia article on turtle graphics" msgstr "" -#: ../../library/turtle.rst:2707 +#: ../../library/turtle.rst:2693 msgid ":func:`clone`, :func:`undo`" msgstr ":func:`clone`, :func:`undo`" -#: ../../library/turtle.rst:2710 +#: ../../library/turtle.rst:2696 msgid "round_dance" msgstr "round_dance" -#: ../../library/turtle.rst:2710 +#: ../../library/turtle.rst:2696 msgid "dancing turtles rotating pairwise in opposite direction" msgstr "" -#: ../../library/turtle.rst:2710 +#: ../../library/turtle.rst:2696 msgid "compound shapes, clone shapesize, tilt, get_shapepoly, update" msgstr "" -#: ../../library/turtle.rst:2714 +#: ../../library/turtle.rst:2700 msgid "sorting_animate" msgstr "sorting_animate" -#: ../../library/turtle.rst:2714 +#: ../../library/turtle.rst:2700 msgid "visual demonstration of different sorting methods" msgstr "" -#: ../../library/turtle.rst:2714 +#: ../../library/turtle.rst:2700 msgid "simple alignment, randomization" msgstr "" -#: ../../library/turtle.rst:2717 +#: ../../library/turtle.rst:2703 msgid "tree" msgstr "" -#: ../../library/turtle.rst:2717 +#: ../../library/turtle.rst:2703 msgid "a (graphical) breadth first tree (using generators)" msgstr "" -#: ../../library/turtle.rst:2720 +#: ../../library/turtle.rst:2706 msgid "two_canvases" msgstr "two_canvases" -#: ../../library/turtle.rst:2720 +#: ../../library/turtle.rst:2706 msgid "simple design" msgstr "" -#: ../../library/turtle.rst:2720 +#: ../../library/turtle.rst:2706 msgid "turtles on two canvases" msgstr "" -#: ../../library/turtle.rst:2723 +#: ../../library/turtle.rst:2709 msgid "yinyang" msgstr "" -#: ../../library/turtle.rst:2723 +#: ../../library/turtle.rst:2709 msgid "another elementary example" msgstr "" -#: ../../library/turtle.rst:2726 +#: ../../library/turtle.rst:2712 msgid "Have fun!" msgstr "" -#: ../../library/turtle.rst:2730 +#: ../../library/turtle.rst:2716 msgid "Changes since Python 2.6" msgstr "" -#: ../../library/turtle.rst:2732 +#: ../../library/turtle.rst:2718 msgid "" "The methods :func:`Turtle.tracer `, :func:`Turtle.window_width " "` and :func:`Turtle.window_height ` have been " @@ -4196,14 +4179,14 @@ msgid "" "methods.)" msgstr "" -#: ../../library/turtle.rst:2740 +#: ../../library/turtle.rst:2726 msgid "" "The method :func:`!Turtle.fill` has been eliminated. The behaviour of :func:" "`begin_fill` and :func:`end_fill` have changed slightly: now every filling " "process must be completed with an ``end_fill()`` call." msgstr "" -#: ../../library/turtle.rst:2745 +#: ../../library/turtle.rst:2731 msgid "" "A method :func:`Turtle.filling ` has been added. It returns a " "boolean value: ``True`` if a filling process is under way, ``False`` " @@ -4211,42 +4194,62 @@ msgid "" "in Python 2.6." msgstr "" -#: ../../library/turtle.rst:2751 +#: ../../library/turtle.rst:2737 msgid "Changes since Python 3.0" msgstr "" -#: ../../library/turtle.rst:2753 +#: ../../library/turtle.rst:2739 msgid "" "The :class:`Turtle` methods :func:`shearfactor`, :func:`shapetransform` and :" "func:`get_shapepoly` have been added. Thus the full range of regular linear " "transforms is now available for transforming turtle shapes. :func:" "`tiltangle` has been enhanced in functionality: it now can be used to get or " -"set the tilt angle. :func:`settiltangle` has been deprecated." +"set the tilt angle." msgstr "" -#: ../../library/turtle.rst:2760 +#: ../../library/turtle.rst:2745 msgid "" "The :class:`Screen` method :func:`onkeypress` has been added as a complement " "to :func:`onkey`. As the latter binds actions to the key release event, an " "alias: :func:`onkeyrelease` was also added for it." msgstr "" -#: ../../library/turtle.rst:2764 +#: ../../library/turtle.rst:2749 msgid "" "The method :func:`Screen.mainloop ` has been added, so there is no " "longer a need to use the standalone :func:`mainloop` function when working " "with :class:`Screen` and :class:`Turtle` objects." msgstr "" -#: ../../library/turtle.rst:2768 +#: ../../library/turtle.rst:2753 msgid "" "Two input methods have been added: :func:`Screen.textinput ` and :" "func:`Screen.numinput `. These pop up input dialogs and return " "strings and numbers respectively." msgstr "" -#: ../../library/turtle.rst:2772 +#: ../../library/turtle.rst:2757 msgid "" "Two example scripts :file:`tdemo_nim.py` and :file:`tdemo_round_dance.py` " "have been added to the :file:`Lib/turtledemo` directory." msgstr "" + +#~ msgid ":func:`settiltangle`" +#~ msgstr ":func:`settiltangle`" + +#~ msgid "" +#~ ">>> turtle.reset()\n" +#~ ">>> turtle.shape(\"circle\")\n" +#~ ">>> turtle.shapesize(5,2)\n" +#~ ">>> turtle.settiltangle(45)\n" +#~ ">>> turtle.fd(50)\n" +#~ ">>> turtle.settiltangle(-45)\n" +#~ ">>> turtle.fd(50)" +#~ msgstr "" +#~ ">>> turtle.reset()\n" +#~ ">>> turtle.shape(\"circle\")\n" +#~ ">>> turtle.shapesize(5,2)\n" +#~ ">>> turtle.settiltangle(45)\n" +#~ ">>> turtle.fd(50)\n" +#~ ">>> turtle.settiltangle(-45)\n" +#~ ">>> turtle.fd(50)" diff --git a/library/types.po b/library/types.po index 66e2125f0b..6cae9bb452 100644 --- a/library/types.po +++ b/library/types.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -586,30 +586,45 @@ msgid "Return a hash of the underlying mapping." msgstr "" #: ../../library/types.rst:471 +msgid "The type of :ref:`capsule objects `." +msgstr "" + +#: ../../library/types.rst:477 msgid "Additional Utility Classes and Functions" msgstr "" -#: ../../library/types.rst:475 +#: ../../library/types.rst:481 msgid "" "A simple :class:`object` subclass that provides attribute access to its " "namespace, as well as a meaningful repr." msgstr "" -#: ../../library/types.rst:478 +#: ../../library/types.rst:484 +msgid "" +"Unlike :class:`object`, with :class:`!SimpleNamespace` you can add and " +"remove attributes." +msgstr "" + +#: ../../library/types.rst:487 msgid "" -"Unlike :class:`object`, with ``SimpleNamespace`` you can add and remove " -"attributes. If a ``SimpleNamespace`` object is initialized with keyword " -"arguments, those are directly added to the underlying namespace." +":py:class:`SimpleNamespace` objects may be initialized in the same way as :" +"class:`dict`: either with keyword arguments, with a single positional " +"argument, or with both. When initialized with keyword arguments, those are " +"directly added to the underlying namespace. Alternatively, when initialized " +"with a positional argument, the underlying namespace will be updated with " +"key-value pairs from that argument (either a mapping object or an :term:" +"`iterable` object producing key-value pairs). All such keys must be strings." msgstr "" -#: ../../library/types.rst:482 +#: ../../library/types.rst:498 msgid "The type is roughly equivalent to the following code::" msgstr "" -#: ../../library/types.rst:484 +#: ../../library/types.rst:500 msgid "" "class SimpleNamespace:\n" -" def __init__(self, /, **kwargs):\n" +" def __init__(self, mapping_or_iterable=(), /, **kwargs):\n" +" self.__dict__.update(mapping_or_iterable)\n" " self.__dict__.update(kwargs)\n" "\n" " def __repr__(self):\n" @@ -623,7 +638,8 @@ msgid "" " return NotImplemented" msgstr "" "class SimpleNamespace:\n" -" def __init__(self, /, **kwargs):\n" +" def __init__(self, mapping_or_iterable=(), /, **kwargs):\n" +" self.__dict__.update(mapping_or_iterable)\n" " self.__dict__.update(kwargs)\n" "\n" " def __repr__(self):\n" @@ -636,24 +652,33 @@ msgstr "" " return self.__dict__ == other.__dict__\n" " return NotImplemented" -#: ../../library/types.rst:497 +#: ../../library/types.rst:514 msgid "" "``SimpleNamespace`` may be useful as a replacement for ``class NS: pass``. " "However, for a structured record type use :func:`~collections.namedtuple` " "instead." msgstr "" -#: ../../library/types.rst:503 +#: ../../library/types.rst:518 +msgid "" +":class:`!SimpleNamespace` objects are supported by :func:`copy.replace`." +msgstr "" + +#: ../../library/types.rst:522 msgid "" "Attribute order in the repr changed from alphabetical to insertion (like " "``dict``)." msgstr "" -#: ../../library/types.rst:509 +#: ../../library/types.rst:526 +msgid "Added support for an optional positional argument." +msgstr "" + +#: ../../library/types.rst:531 msgid "Route attribute access on a class to __getattr__." msgstr "" -#: ../../library/types.rst:511 +#: ../../library/types.rst:533 msgid "" "This is a descriptor, used to define attributes that act differently when " "accessed through an instance and through a class. Instance access remains " @@ -661,18 +686,18 @@ msgid "" "class's __getattr__ method; this is done by raising AttributeError." msgstr "" -#: ../../library/types.rst:516 +#: ../../library/types.rst:538 msgid "" "This allows one to have properties active on an instance, and have virtual " "attributes on the class with the same name (see :class:`enum.Enum` for an " "example)." msgstr "" -#: ../../library/types.rst:523 +#: ../../library/types.rst:545 msgid "Coroutine Utility Functions" msgstr "" -#: ../../library/types.rst:527 +#: ../../library/types.rst:549 msgid "" "This function transforms a :term:`generator` function into a :term:" "`coroutine function` which returns a generator-based coroutine. The " @@ -682,11 +707,11 @@ msgid "" "method." msgstr "" -#: ../../library/types.rst:534 +#: ../../library/types.rst:556 msgid "If *gen_func* is a generator function, it will be modified in-place." msgstr "" -#: ../../library/types.rst:536 +#: ../../library/types.rst:558 msgid "" "If *gen_func* is not a generator function, it will be wrapped. If it returns " "an instance of :class:`collections.abc.Generator`, the instance will be " diff --git a/library/typing.po b/library/typing.po index 774bc2e9d1..0840c1c64a 100644 --- a/library/typing.po +++ b/library/typing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\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-" @@ -387,8 +387,8 @@ msgstr "" "str]`` 象徵為一個函式,可以接受一個型別為 :class:`int` 的引數,並回傳一個 :" "class:`str`。" -#: ../../library/typing.rst:215 ../../library/typing.rst:2897 -#: ../../library/typing.rst:3043 +#: ../../library/typing.rst:215 ../../library/typing.rst:3109 +#: ../../library/typing.rst:3287 msgid "For example:" msgstr "舉例來說:" @@ -492,7 +492,7 @@ msgstr "" "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " "ReturnType]`` 的形式。" -#: ../../library/typing.rst:285 ../../library/typing.rst:3522 +#: ../../library/typing.rst:285 ../../library/typing.rst:3777 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" "pep:`612` for more details." @@ -772,11 +772,22 @@ msgstr "" #: ../../library/typing.rst:464 msgid "" -"If your generator will only yield values, set the ``SendType`` and " -"``ReturnType`` to ``None``::" +"The ``SendType`` and ``ReturnType`` parameters default to :const:`!None`::" msgstr "" -#: ../../library/typing.rst:467 +#: ../../library/typing.rst:466 +msgid "" +"def infinite_stream(start: int) -> Generator[int]:\n" +" while True:\n" +" yield start\n" +" start += 1" +msgstr "" + +#: ../../library/typing.rst:471 +msgid "It is also possible to set these types explicitly::" +msgstr "" + +#: ../../library/typing.rst:473 msgid "" "def infinite_stream(start: int) -> Generator[int, None, None]:\n" " while True:\n" @@ -784,13 +795,14 @@ msgid "" " start += 1" msgstr "" -#: ../../library/typing.rst:472 +#: ../../library/typing.rst:478 msgid "" -"Alternatively, annotate your generator as having a return type of either " -"``Iterable[YieldType]`` or ``Iterator[YieldType]``::" +"Simple generators that only ever yield values can also be annotated as " +"having a return type of either :class:`Iterable[YieldType] ` or :class:`Iterator[YieldType] `::" msgstr "" -#: ../../library/typing.rst:475 +#: ../../library/typing.rst:483 msgid "" "def infinite_stream(start: int) -> Iterator[int]:\n" " while True:\n" @@ -798,29 +810,35 @@ msgid "" " start += 1" msgstr "" -#: ../../library/typing.rst:480 +#: ../../library/typing.rst:488 msgid "" "Async generators are handled in a similar fashion, but don't expect a " "``ReturnType`` type argument (:class:`AsyncGenerator[YieldType, SendType] " -"`)::" +"`). The ``SendType`` argument defaults to :" +"const:`!None`, so the following definitions are equivalent::" msgstr "" -#: ../../library/typing.rst:484 +#: ../../library/typing.rst:494 msgid "" +"async def infinite_stream(start: int) -> AsyncGenerator[int]:\n" +" while True:\n" +" yield start\n" +" start = await increment(start)\n" +"\n" "async def infinite_stream(start: int) -> AsyncGenerator[int, None]:\n" " while True:\n" " yield start\n" " start = await increment(start)" msgstr "" -#: ../../library/typing.rst:489 +#: ../../library/typing.rst:504 msgid "" "As in the synchronous case, :class:`AsyncIterable[YieldType] ` and :class:`AsyncIterator[YieldType] ` are available as well::" msgstr "" -#: ../../library/typing.rst:494 +#: ../../library/typing.rst:509 msgid "" "async def infinite_stream(start: int) -> AsyncIterator[int]:\n" " while True:\n" @@ -828,14 +846,14 @@ msgid "" " start = await increment(start)" msgstr "" -#: ../../library/typing.rst:499 +#: ../../library/typing.rst:514 msgid "" "Coroutines can be annotated using :class:`Coroutine[YieldType, SendType, " "ReturnType] `. Generic arguments correspond to " "those of :class:`~collections.abc.Generator`, for example::" msgstr "" -#: ../../library/typing.rst:504 +#: ../../library/typing.rst:519 msgid "" "from collections.abc import Coroutine\n" "c: Coroutine[list[str], str, int] # Some coroutine defined elsewhere\n" @@ -844,15 +862,15 @@ msgid "" " y = await c # Inferred type of 'y' is int" msgstr "" -#: ../../library/typing.rst:513 +#: ../../library/typing.rst:528 msgid "User-defined generic types" msgstr "使用者定義泛型型別" -#: ../../library/typing.rst:515 +#: ../../library/typing.rst:530 msgid "A user-defined class can be defined as a generic class." msgstr "一個使用者定義的類別可以被定義成一個泛型類別。" -#: ../../library/typing.rst:519 +#: ../../library/typing.rst:534 msgid "" "from logging import Logger\n" "\n" @@ -874,7 +892,7 @@ msgid "" " self.logger.info('%s: %s', self.name, message)" msgstr "" -#: ../../library/typing.rst:538 +#: ../../library/typing.rst:553 msgid "" "This syntax indicates that the class ``LoggedVar`` is parameterised around a " "single :ref:`type variable ` ``T`` . This also makes ``T`` valid as " @@ -883,7 +901,7 @@ msgstr "" "這個語法指出類別 ``LoggedVar`` 透過一個單一的 :ref:`型別變數 ` " "``T`` 進行參數化 (parameterised)。這使得 ``T`` 在類別中有效的成為型別。" -#: ../../library/typing.rst:542 +#: ../../library/typing.rst:557 msgid "" "Generic classes implicitly inherit from :class:`Generic`. For compatibility " "with Python 3.11 and lower, it is also possible to inherit explicitly from :" @@ -892,7 +910,7 @@ msgstr "" "泛型類別隱性繼承了 :class:`Generic`。為了相容 Python 3.11 及更早版本,也可以" "明確的繼承 :class:`Generic` 並指出是一個泛型類別: ::" -#: ../../library/typing.rst:546 +#: ../../library/typing.rst:561 msgid "" "from typing import TypeVar, Generic\n" "\n" @@ -902,7 +920,7 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:553 +#: ../../library/typing.rst:568 msgid "" "Generic classes have :meth:`~object.__class_getitem__` methods, meaning they " "can be parameterised at runtime (e.g. ``LoggedVar[int]`` below)::" @@ -910,7 +928,7 @@ msgstr "" "泛型類別有 :meth:`~object.__class_getitem__` 方法,其意味著可以在 runtime 進" "行參數化(如下述的 ``LoggedVar[int]``): ::" -#: ../../library/typing.rst:556 +#: ../../library/typing.rst:571 msgid "" "from collections.abc import Iterable\n" "\n" @@ -919,7 +937,7 @@ msgid "" " var.set(0)" msgstr "" -#: ../../library/typing.rst:562 +#: ../../library/typing.rst:577 msgid "" "A generic type can have any number of type variables. All varieties of :" "class:`TypeVar` are permissible as parameters for a generic type::" @@ -927,7 +945,7 @@ msgstr "" "一個泛型型別可以有任意數量的型別變數。所有種類的 :class:`TypeVar` 都可以作為" "泛型型別的參數: ::" -#: ../../library/typing.rst:565 +#: ../../library/typing.rst:580 msgid "" "from typing import TypeVar, Generic, Sequence\n" "\n" @@ -942,13 +960,13 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:577 +#: ../../library/typing.rst:592 msgid "" "Each type variable argument to :class:`Generic` must be distinct. This is " "thus invalid::" msgstr ":class:`Generic` 的每個型別變數引數必不相同。因此以下是無效的: ::" -#: ../../library/typing.rst:580 +#: ../../library/typing.rst:595 msgid "" "from typing import TypeVar, Generic\n" "...\n" @@ -962,11 +980,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:591 +#: ../../library/typing.rst:606 msgid "Generic classes can also inherit from other classes::" msgstr "泛型類別亦可以繼承其他類別: ::" -#: ../../library/typing.rst:593 +#: ../../library/typing.rst:608 msgid "" "from collections.abc import Sized\n" "\n" @@ -974,12 +992,12 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:598 +#: ../../library/typing.rst:613 msgid "" "When inheriting from generic classes, some type parameters could be fixed::" msgstr "當繼承泛型類別時,部份的型別參數可固定: ::" -#: ../../library/typing.rst:600 +#: ../../library/typing.rst:615 msgid "" "from collections.abc import Mapping\n" "\n" @@ -987,11 +1005,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:605 +#: ../../library/typing.rst:620 msgid "In this case ``MyDict`` has a single parameter, ``T``." msgstr "在這種情況下 ``MyDict`` 有一個單一的參數 ``T``。" -#: ../../library/typing.rst:607 +#: ../../library/typing.rst:622 msgid "" "Using a generic class without specifying type parameters assumes :data:`Any` " "for each position. In the following example, ``MyIterable`` is not generic " @@ -1000,7 +1018,7 @@ msgstr "" "若使用泛型類別卻沒有特指型別參數,則會將每個位置視為 :data:`Any`。在下列的範" "例中 ``MyIterable`` 不是泛型,但隱性繼承了 ``Iterable[Any]``: ::" -#: ../../library/typing.rst:611 +#: ../../library/typing.rst:626 msgid "" "from collections.abc import Iterable\n" "\n" @@ -1008,11 +1026,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:618 +#: ../../library/typing.rst:633 msgid "User-defined generic type aliases are also supported. Examples::" msgstr "使用者定義的泛型型別別名也有支援。例如: ::" -#: ../../library/typing.rst:620 +#: ../../library/typing.rst:635 msgid "" "from collections.abc import Iterable\n" "\n" @@ -1029,13 +1047,13 @@ msgid "" " return sum(x*y for x, y in v)" msgstr "" -#: ../../library/typing.rst:633 +#: ../../library/typing.rst:648 msgid "" "For backward compatibility, generic type aliases can also be created through " "a simple assignment::" msgstr "為了向後相容性,泛型型別別名可以透過簡單的賦值來建立: ::" -#: ../../library/typing.rst:636 +#: ../../library/typing.rst:651 msgid "" "from collections.abc import Iterable\n" "from typing import TypeVar\n" @@ -1044,11 +1062,11 @@ msgid "" "Response = Iterable[S] | int" msgstr "" -#: ../../library/typing.rst:642 +#: ../../library/typing.rst:657 msgid ":class:`Generic` no longer has a custom metaclass." msgstr ":class:`Generic` 不再是一個自訂的 metaclass。" -#: ../../library/typing.rst:645 +#: ../../library/typing.rst:660 msgid "" "Syntactic support for generics and type aliases is new in version 3.12. " "Previously, generic classes had to explicitly inherit from :class:`Generic` " @@ -1057,7 +1075,7 @@ msgstr "" "在版本 3.12 新增了泛型及型別別名的語法支援。在之前的版本中,泛型類別必須顯性" "繼承 :class:`Generic` 或是包含一個型別變數在基底類別 (base) 當中。" -#: ../../library/typing.rst:650 +#: ../../library/typing.rst:665 msgid "" "User-defined generics for parameter expressions are also supported via " "parameter specification variables in the form ``[**P]``. The behavior is " @@ -1071,7 +1089,7 @@ msgstr "" "別模組視為一個特定的型別變數。對此,其中一個例外是一個型別列表可以替代 :" "class:`ParamSpec`: ::" -#: ../../library/typing.rst:656 +#: ../../library/typing.rst:671 msgid "" ">>> class Z[T, **P]: ... # T is a TypeVar; P is a ParamSpec\n" "...\n" @@ -1079,7 +1097,7 @@ msgid "" "__main__.Z[int, [dict, float]]" msgstr "" -#: ../../library/typing.rst:661 +#: ../../library/typing.rst:676 msgid "" "Classes generic over a :class:`ParamSpec` can also be created using explicit " "inheritance from :class:`Generic`. In this case, ``**`` is not used::" @@ -1087,7 +1105,7 @@ msgstr "" "具有 :class:`ParamSpec` 的泛型類別可以透過顯性繼承 :class:`Generic` 進行建" "立。在這種情況下,不需要使用 ``**``: ::" -#: ../../library/typing.rst:664 +#: ../../library/typing.rst:679 msgid "" "from typing import ParamSpec, Generic\n" "\n" @@ -1097,7 +1115,7 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:671 +#: ../../library/typing.rst:686 msgid "" "Another difference between :class:`TypeVar` and :class:`ParamSpec` is that a " "generic with only one parameter specification variable will accept parameter " @@ -1110,7 +1128,7 @@ msgstr "" "``X[Type1, Type2, ...]`` 的參數列表。在內部中,後者會被轉換為前者,所以在下方" "的範例中為相等的: ::" -#: ../../library/typing.rst:677 +#: ../../library/typing.rst:692 msgid "" ">>> class X[**P]: ...\n" "...\n" @@ -1120,7 +1138,7 @@ msgid "" "__main__.X[[int, str]]" msgstr "" -#: ../../library/typing.rst:684 +#: ../../library/typing.rst:699 msgid "" "Note that generics with :class:`ParamSpec` may not have correct " "``__parameters__`` after substitution in some cases because they are " @@ -1129,7 +1147,7 @@ msgstr "" "請記得,具有 :class:`ParamSpec` 的泛型在某些情況下替換之後可能不會有正確的 " "``__parameters__``,因為參數規格主要還是用於靜態型別檢查。" -#: ../../library/typing.rst:688 +#: ../../library/typing.rst:703 msgid "" ":class:`Generic` can now be parameterized over parameter expressions. See :" "class:`ParamSpec` and :pep:`612` for more details." @@ -1137,7 +1155,7 @@ msgstr "" ":class:`Generic` 現在可以透過參數運算式來進行參數化。詳細內容請見 :class:" "`ParamSpec` 以及 :pep:`612`。" -#: ../../library/typing.rst:692 +#: ../../library/typing.rst:707 msgid "" "A user-defined generic class can have ABCs as base classes without a " "metaclass conflict. Generic metaclasses are not supported. The outcome of " @@ -1148,11 +1166,11 @@ msgstr "" "突。泛型的 metaclass 則不支援。參數化泛型的輸出將被存為快取,而在型別模組中多" "數的型別皆為 :term:`hashable` 且可以比較相等性。" -#: ../../library/typing.rst:699 +#: ../../library/typing.rst:714 msgid "The :data:`Any` type" msgstr ":data:`Any` 型別" -#: ../../library/typing.rst:701 +#: ../../library/typing.rst:716 msgid "" "A special kind of type is :data:`Any`. A static type checker will treat " "every type as being compatible with :data:`Any` and :data:`Any` as being " @@ -1161,7 +1179,7 @@ msgstr "" ":data:`Any` 是一種特別的型別。一個靜態型別檢查器會將每個型別視為可相容於 :" "data:`Any` 且 :data:`Any` 也可以相容於每個型別。" -#: ../../library/typing.rst:705 +#: ../../library/typing.rst:720 msgid "" "This means that it is possible to perform any operation or method call on a " "value of type :data:`Any` and assign it to any variable::" @@ -1169,7 +1187,7 @@ msgstr "" "這意味著如果在一個為 :data:`Any` 的值上執行任何操作或呼叫方法是可行的,且可以" "賦值給任意變數: ::" -#: ../../library/typing.rst:708 +#: ../../library/typing.rst:723 msgid "" "from typing import Any\n" "\n" @@ -1187,7 +1205,7 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:723 +#: ../../library/typing.rst:738 msgid "" "Notice that no type checking is performed when assigning a value of type :" "data:`Any` to a more precise type. For example, the static type checker did " @@ -1199,13 +1217,13 @@ msgstr "" "舉例來說,靜態型別檢查器不會在 runtime 中,將 ``a`` 賦值給 ``s`` 的情況下回報" "錯誤,儘管 ``s`` 是被宣告為型別 :class:`str` 卻接收到 :class:`int` 的值!" -#: ../../library/typing.rst:729 +#: ../../library/typing.rst:744 msgid "" "Furthermore, all functions without a return type or parameter types will " "implicitly default to using :data:`Any`::" msgstr "另外,所有缺少回傳型別或參數型別的函式將會隱性預設為 :data:`Any`: ::" -#: ../../library/typing.rst:732 +#: ../../library/typing.rst:747 msgid "" "def legacy_parser(text):\n" " ...\n" @@ -1218,7 +1236,7 @@ msgid "" " return data" msgstr "" -#: ../../library/typing.rst:742 +#: ../../library/typing.rst:757 msgid "" "This behavior allows :data:`Any` to be used as an *escape hatch* when you " "need to mix dynamically and statically typed code." @@ -1226,7 +1244,7 @@ msgstr "" "當你需要混和動態及靜態的型別程式碼,這個行為允許 :data:`Any` 被當作一個\\ *緊" "急出口 (escape hatch)*\\使用。" -#: ../../library/typing.rst:745 +#: ../../library/typing.rst:760 msgid "" "Contrast the behavior of :data:`Any` with the behavior of :class:`object`. " "Similar to :data:`Any`, every type is a subtype of :class:`object`. However, " @@ -1237,7 +1255,7 @@ msgstr "" "別會作為 :class:`object` 的子型別。然而,不像 :data:`Any`,反之不亦然::" "class:`object` 並\\ *不是*\\一個其他型別的子型別。" -#: ../../library/typing.rst:750 +#: ../../library/typing.rst:765 msgid "" "That means when the type of a value is :class:`object`, a type checker will " "reject almost all operations on it, and assigning it to a variable (or using " @@ -1248,7 +1266,7 @@ msgstr "" "並將賦予這個值到一個特定型別變數(或是當作回傳值使用)視為一個型別錯誤。舉例" "來說: ::" -#: ../../library/typing.rst:754 +#: ../../library/typing.rst:769 msgid "" "def hash_a(item: object) -> int:\n" " # Fails type checking; an object does not have a 'magic' method.\n" @@ -1269,7 +1287,7 @@ msgid "" "hash_b(\"foo\")" msgstr "" -#: ../../library/typing.rst:772 +#: ../../library/typing.rst:787 msgid "" "Use :class:`object` to indicate that a value could be any type in a typesafe " "manner. Use :data:`Any` to indicate that a value is dynamically typed." @@ -1277,11 +1295,11 @@ msgstr "" "使用 :class:`object` ,將指出在型別安全 (typesafe) 的習慣之下一個值可以為任意" "型別。使用 :data:`Any`,將指出這個值是個動態型別。" -#: ../../library/typing.rst:777 +#: ../../library/typing.rst:792 msgid "Nominal vs structural subtyping" msgstr "標稱 (nominal) 子型別 vs 結構子型別" -#: ../../library/typing.rst:779 +#: ../../library/typing.rst:794 msgid "" "Initially :pep:`484` defined the Python static type system as using *nominal " "subtyping*. This means that a class ``A`` is allowed where a class ``B`` is " @@ -1290,7 +1308,7 @@ msgstr "" "最初 :pep:`484` 定義 Python 靜態型別系統使用\\ *標稱子型別*。這意味著只有 " "``A`` 為 ``B`` 的子類別時,``A`` 才被允許使用在預期是類別 ``B`` 出現的地方。" -#: ../../library/typing.rst:783 +#: ../../library/typing.rst:798 msgid "" "This requirement previously also applied to abstract base classes, such as :" "class:`~collections.abc.Iterable`. The problem with this approach is that a " @@ -1303,7 +1321,7 @@ msgstr "" "格,也不像一個常見的慣用動態型別 Python 程式碼。舉例來說,下列程式碼符合 :" "pep:`484`: ::" -#: ../../library/typing.rst:789 +#: ../../library/typing.rst:804 msgid "" "from collections.abc import Sized, Iterable, Iterator\n" "\n" @@ -1313,7 +1331,7 @@ msgid "" " def __iter__(self) -> Iterator[int]: ..." msgstr "" -#: ../../library/typing.rst:796 +#: ../../library/typing.rst:811 msgid "" ":pep:`544` allows to solve this problem by allowing users to write the above " "code without explicit base classes in the class definition, allowing " @@ -1326,7 +1344,7 @@ msgstr "" "``Iterable[int]`` 兩者的子型別。這就是眾所周知的\\ *結構子型別*\\ (或是靜態" "鴨子型別): ::" -#: ../../library/typing.rst:802 +#: ../../library/typing.rst:817 msgid "" "from collections.abc import Iterator, Iterable\n" "\n" @@ -1339,7 +1357,7 @@ msgid "" "result = collect(Bucket()) # Passes type check" msgstr "" -#: ../../library/typing.rst:812 +#: ../../library/typing.rst:827 msgid "" "Moreover, by subclassing a special class :class:`Protocol`, a user can " "define new custom protocols to fully enjoy structural subtyping (see " @@ -1348,43 +1366,43 @@ msgstr "" "而且,基於一個特別的型別 :class:`Protocol` 建立子型別時,使用者可以定義新的" "協定並充份發揮結構子型別的優勢(請見下方範例)。" -#: ../../library/typing.rst:817 +#: ../../library/typing.rst:832 msgid "Module contents" msgstr "模組內容" -#: ../../library/typing.rst:819 +#: ../../library/typing.rst:834 msgid "" "The ``typing`` module defines the following classes, functions and " "decorators." msgstr "模組 ``typing`` 定義了下列的類別、函式以及裝飾器。" -#: ../../library/typing.rst:822 +#: ../../library/typing.rst:837 msgid "Special typing primitives" msgstr "特別型別原語 (primitive)" -#: ../../library/typing.rst:825 +#: ../../library/typing.rst:840 msgid "Special types" msgstr "特別型別" -#: ../../library/typing.rst:827 +#: ../../library/typing.rst:842 msgid "" "These can be used as types in annotations. They do not support subscription " "using ``[]``." msgstr "這些可以在註釋中做為型別。他們並不支援 ``[]`` 的下標使用。" -#: ../../library/typing.rst:832 +#: ../../library/typing.rst:847 msgid "Special type indicating an unconstrained type." msgstr "特別型別,指出一個不受約束 (unconstrained) 的型別。" -#: ../../library/typing.rst:834 +#: ../../library/typing.rst:849 msgid "Every type is compatible with :data:`Any`." msgstr "所有型別皆與 :data:`Any` 相容。" -#: ../../library/typing.rst:835 +#: ../../library/typing.rst:850 msgid ":data:`Any` is compatible with every type." msgstr ":data:`Any` 相容於所有型別。" -#: ../../library/typing.rst:837 +#: ../../library/typing.rst:852 msgid "" ":data:`Any` can now be used as a base class. This can be useful for avoiding " "type checker errors with classes that can duck type anywhere or are highly " @@ -1393,19 +1411,19 @@ msgstr "" ":data:`Any` 可以作為一個基礎類別。這對於在任何地方使用鴨子型別或是高度動態的" "型別,避免型別檢查器的錯誤是非常有用的。" -#: ../../library/typing.rst:844 +#: ../../library/typing.rst:859 msgid "A :ref:`constrained type variable `." msgstr "一個\\ :ref:`不受約束的型別變數 `。" -#: ../../library/typing.rst:846 +#: ../../library/typing.rst:861 msgid "Definition::" msgstr "定義: ::" -#: ../../library/typing.rst:848 +#: ../../library/typing.rst:863 msgid "AnyStr = TypeVar('AnyStr', str, bytes)" msgstr "" -#: ../../library/typing.rst:850 +#: ../../library/typing.rst:865 msgid "" "``AnyStr`` is meant to be used for functions that may accept :class:`str` " "or :class:`bytes` arguments but cannot allow the two to mix." @@ -1413,14 +1431,15 @@ msgstr "" "``AnyStr`` 是對於函式有用的,他可以接受 :class:`str` 或 :class:`bytes` 引數但" "不可以將此兩種混合。" -#: ../../library/typing.rst:853 ../../library/typing.rst:961 -#: ../../library/typing.rst:1018 ../../library/typing.rst:1184 -#: ../../library/typing.rst:1241 ../../library/typing.rst:1450 -#: ../../library/typing.rst:2837 +#: ../../library/typing.rst:868 ../../library/typing.rst:986 +#: ../../library/typing.rst:1043 ../../library/typing.rst:1209 +#: ../../library/typing.rst:1270 ../../library/typing.rst:1312 +#: ../../library/typing.rst:1510 ../../library/typing.rst:1571 +#: ../../library/typing.rst:3046 ../../library/typing.rst:3272 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/typing.rst:855 +#: ../../library/typing.rst:870 msgid "" "def concat(a: AnyStr, b: AnyStr) -> AnyStr:\n" " return a + b\n" @@ -1430,7 +1449,7 @@ msgid "" "concat(\"foo\", b\"bar\") # Error, cannot mix str and bytes" msgstr "" -#: ../../library/typing.rst:862 +#: ../../library/typing.rst:877 msgid "" "Note that, despite its name, ``AnyStr`` has nothing to do with the :class:" "`Any` type, nor does it mean \"any string\". In particular, ``AnyStr`` and " @@ -1440,7 +1459,7 @@ msgstr "" "何字串」的意思。尤其,``AnyStr`` 與 ``str | bytes`` 兩者不同且具有不同的使用" "情境: ::" -#: ../../library/typing.rst:867 +#: ../../library/typing.rst:882 msgid "" "# Invalid use of AnyStr:\n" "# The type variable is used only once in the function signature,\n" @@ -1453,11 +1472,26 @@ msgid "" " return \"hi there!\" if cond else b\"greetings!\"" msgstr "" -#: ../../library/typing.rst:879 +#: ../../library/typing.rst:892 +msgid "" +"Deprecated in favor of the new :ref:`type parameter syntax `. " +"Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. See :" +"pep:`695` for more details." +msgstr "" + +#: ../../library/typing.rst:897 +msgid "" +"In Python 3.16, ``AnyStr`` will be removed from ``typing.__all__``, and " +"deprecation warnings will be emitted at runtime when it is accessed or " +"imported from ``typing``. ``AnyStr`` will be removed from ``typing`` in " +"Python 3.18." +msgstr "" + +#: ../../library/typing.rst:904 msgid "Special type that includes only literal strings." msgstr "特別型別,只包含文本字串。" -#: ../../library/typing.rst:881 +#: ../../library/typing.rst:906 msgid "" "Any string literal is compatible with ``LiteralString``, as is another " "``LiteralString``. However, an object typed as just ``str`` is not. A string " @@ -1468,11 +1502,11 @@ msgstr "" "此。然而,若是一個型別僅為 ``str`` 的物件則不相容。一個字串若是透過組合多個 " "``LiteralString`` 型別的物件建立,則此字串也可以視為 ``LiteralString``。" -#: ../../library/typing.rst:887 ../../library/typing.rst:1965 +#: ../../library/typing.rst:912 ../../library/typing.rst:2142 msgid "Example:" msgstr "舉例來說: ::" -#: ../../library/typing.rst:889 +#: ../../library/typing.rst:914 msgid "" "def run_query(sql: LiteralString) -> None:\n" " ...\n" @@ -1487,7 +1521,7 @@ msgid "" " )" msgstr "" -#: ../../library/typing.rst:903 +#: ../../library/typing.rst:928 msgid "" "``LiteralString`` is useful for sensitive APIs where arbitrary user-" "generated strings could generate problems. For example, the two cases above " @@ -1498,11 +1532,11 @@ msgstr "" "會產生問題。舉例來說,上面兩個案例中產生的型別檢查器錯誤是脆弱的且容易受到 " "SQL 注入攻擊。" -#: ../../library/typing.rst:908 +#: ../../library/typing.rst:933 msgid "See :pep:`675` for more details." msgstr "更多細節請見 :pep:`675`。" -#: ../../library/typing.rst:915 +#: ../../library/typing.rst:940 msgid "" ":data:`!Never` and :data:`!NoReturn` represent the `bottom type `_, a type that has no members." @@ -1510,13 +1544,13 @@ msgstr "" ":data:`!Never` 和 :data:`!NoReturn` 表示\\ `底部型別 (bottom type) `_,為一個沒有任何成員的型別。" -#: ../../library/typing.rst:919 +#: ../../library/typing.rst:944 msgid "" "They can be used to indicate that a function never returns, such as :func:" "`sys.exit`::" msgstr "它們可以被用來代表一個不會回傳的函式,像是 :func:`sys.exit`: ::" -#: ../../library/typing.rst:922 +#: ../../library/typing.rst:947 msgid "" "from typing import Never # or NoReturn\n" "\n" @@ -1524,7 +1558,7 @@ msgid "" " raise RuntimeError('no way')" msgstr "" -#: ../../library/typing.rst:927 +#: ../../library/typing.rst:952 msgid "" "Or to define a function that should never be called, as there are no valid " "arguments, such as :func:`assert_never`::" @@ -1532,7 +1566,7 @@ msgstr "" "或被用來定義一個不應被呼叫的函式,因為不會有有效的引數,、像是 :func:" "`assert_never`: ::" -#: ../../library/typing.rst:931 +#: ../../library/typing.rst:956 msgid "" "from typing import Never # or NoReturn\n" "\n" @@ -1550,7 +1584,7 @@ msgid "" " never_call_me(arg) # OK, arg is of type Never (or NoReturn)" msgstr "" -#: ../../library/typing.rst:946 +#: ../../library/typing.rst:971 msgid "" ":data:`!Never` and :data:`!NoReturn` have the same meaning in the type " "system and static type checkers treat both equivalently." @@ -1558,19 +1592,19 @@ msgstr "" ":data:`!Never` 以及 :data:`!NoReturn` 在型別系統中具有相同的意義且靜態型別檢" "查器會將兩者視為相等。" -#: ../../library/typing.rst:951 +#: ../../library/typing.rst:976 msgid "Added :data:`NoReturn`." msgstr "新增 :data:`NoReturn`。" -#: ../../library/typing.rst:955 +#: ../../library/typing.rst:980 msgid "Added :data:`Never`." msgstr "新增 :data:`Never`。" -#: ../../library/typing.rst:959 +#: ../../library/typing.rst:984 msgid "Special type to represent the current enclosed class." msgstr "特別型別,用來表示當前類別之內 (enclosed class)。" -#: ../../library/typing.rst:963 +#: ../../library/typing.rst:988 msgid "" "from typing import Self, reveal_type\n" "\n" @@ -1586,13 +1620,13 @@ msgid "" "\"SubclassOfFoo\"" msgstr "" -#: ../../library/typing.rst:975 +#: ../../library/typing.rst:1000 msgid "" "This annotation is semantically equivalent to the following, albeit in a " "more succinct fashion::" msgstr "這個註釋在語意上相等於下列內容,且形式更為簡潔: ::" -#: ../../library/typing.rst:978 +#: ../../library/typing.rst:1003 msgid "" "from typing import TypeVar\n" "\n" @@ -1612,7 +1646,7 @@ msgstr "" " ...\n" " return self" -#: ../../library/typing.rst:987 +#: ../../library/typing.rst:1012 msgid "" "In general, if something returns ``self``, as in the above examples, you " "should use ``Self`` as the return annotation. If ``Foo.return_self`` was " @@ -1625,11 +1659,11 @@ msgstr "" "器應該推論這個從 ``SubclassOfFoo.return_self`` 回傳的物件為 ``Foo`` 型別,而" "並非回傳 ``SubclassOfFoo`` 型別。" -#: ../../library/typing.rst:993 +#: ../../library/typing.rst:1018 msgid "Other common use cases include:" msgstr "其他常見的使用案例包含: ::" -#: ../../library/typing.rst:995 +#: ../../library/typing.rst:1020 msgid "" ":class:`classmethod`\\s that are used as alternative constructors and return " "instances of the ``cls`` parameter." @@ -1637,11 +1671,11 @@ msgstr "" ":class:`classmethod` 被用來作為替代的建構函式 (constructor) 並回傳 ``cls`` 參" "數的實例。" -#: ../../library/typing.rst:997 +#: ../../library/typing.rst:1022 msgid "Annotating an :meth:`~object.__enter__` method which returns self." msgstr "註釋一個回傳自己的 :meth:`~object.__enter__` 方法。" -#: ../../library/typing.rst:999 +#: ../../library/typing.rst:1024 msgid "" "You should not use ``Self`` as the return annotation if the method is not " "guaranteed to return an instance of a subclass when the class is subclassed::" @@ -1649,7 +1683,7 @@ msgstr "" "當類別被子類別化時,若方法不保證回傳一個子類別的實例,你不應該使用 ``Self`` " "作為回傳註釋: ::" -#: ../../library/typing.rst:1003 +#: ../../library/typing.rst:1028 msgid "" "class Eggs:\n" " # Self would be an incorrect return annotation here,\n" @@ -1659,17 +1693,17 @@ msgid "" " return Eggs()" msgstr "" -#: ../../library/typing.rst:1010 +#: ../../library/typing.rst:1035 msgid "See :pep:`673` for more details." msgstr "更多細節請見 :pep:`673`。" -#: ../../library/typing.rst:1016 +#: ../../library/typing.rst:1041 msgid "" "Special annotation for explicitly declaring a :ref:`type alias `." msgstr "做為明確宣告一個\\ :ref:`型別別名 ` 的特別註釋。" -#: ../../library/typing.rst:1020 +#: ../../library/typing.rst:1045 msgid "" "from typing import TypeAlias\n" "\n" @@ -1679,7 +1713,7 @@ msgstr "" "\n" "Factors: TypeAlias = list[int]" -#: ../../library/typing.rst:1024 +#: ../../library/typing.rst:1049 msgid "" "``TypeAlias`` is particularly useful on older Python versions for annotating " "aliases that make use of forward references, as it can be hard for type " @@ -1689,7 +1723,7 @@ msgstr "" "(forward reference),因為對於型別檢查器來說,分辨這些別名與一般的變數賦值相當" "困難: ::" -#: ../../library/typing.rst:1028 +#: ../../library/typing.rst:1053 msgid "" "from typing import Generic, TypeAlias, TypeVar\n" "\n" @@ -1707,11 +1741,11 @@ msgid "" " def make_box_of_strings(cls) -> BoxOfStrings: ..." msgstr "" -#: ../../library/typing.rst:1044 +#: ../../library/typing.rst:1069 msgid "See :pep:`613` for more details." msgstr "更多細節請見 :pep:`613`。" -#: ../../library/typing.rst:1048 +#: ../../library/typing.rst:1073 msgid "" ":data:`TypeAlias` is deprecated in favor of the :keyword:`type` statement, " "which creates instances of :class:`TypeAliasType` and which natively " @@ -1727,11 +1761,11 @@ msgstr "" "是不同的,且後者不是前者的型別。現在還沒有移除 :data:`TypeAlias` 的計畫,但鼓" "勵使用者們遷移 (migrate) 至 :keyword:`type` 陳述式。" -#: ../../library/typing.rst:1059 +#: ../../library/typing.rst:1084 msgid "Special forms" msgstr "特別型式" -#: ../../library/typing.rst:1061 +#: ../../library/typing.rst:1086 msgid "" "These can be used as types in annotations. They all support subscription " "using ``[]``, but each has a unique syntax." @@ -1739,14 +1773,14 @@ msgstr "" "這些在註釋中可以當作型別使用。他們全都支援 ``[]`` 的下標使用,但每個都具有獨" "特的語法。" -#: ../../library/typing.rst:1066 +#: ../../library/typing.rst:1091 msgid "" "Union type; ``Union[X, Y]`` is equivalent to ``X | Y`` and means either X or " "Y." msgstr "" "聯集型別;``Union[X, Y]`` 與 ``X | Y`` 是相等的,且都意味著 X 或 Y 兩者其一。" -#: ../../library/typing.rst:1068 +#: ../../library/typing.rst:1093 msgid "" "To define a union, use e.g. ``Union[int, str]`` or the shorthand ``int | " "str``. Using that shorthand is recommended. Details:" @@ -1754,66 +1788,66 @@ msgstr "" "為了定義聯集,例如可以使用 ``Union[int, str]`` 或是使用簡寫 (shorthand) " "``int | str``。使用這種簡寫是非常推薦的。詳細請看: ::" -#: ../../library/typing.rst:1070 +#: ../../library/typing.rst:1095 msgid "The arguments must be types and there must be at least one." msgstr "引數必須為型別且必須有至少一個。" -#: ../../library/typing.rst:1072 +#: ../../library/typing.rst:1097 msgid "Unions of unions are flattened, e.g.::" msgstr "聯集中的聯集會是扁平化的 (flattened),舉例來說: ::" -#: ../../library/typing.rst:1074 +#: ../../library/typing.rst:1099 msgid "Union[Union[int, str], float] == Union[int, str, float]" msgstr "Union[Union[int, str], float] == Union[int, str, float]" -#: ../../library/typing.rst:1076 +#: ../../library/typing.rst:1101 msgid "Unions of a single argument vanish, e.g.::" msgstr "單一引數的聯集會消失不見,舉例來說: ::" -#: ../../library/typing.rst:1078 +#: ../../library/typing.rst:1103 msgid "Union[int] == int # The constructor actually returns int" msgstr "Union[int] == int # The constructor actually returns int" -#: ../../library/typing.rst:1080 +#: ../../library/typing.rst:1105 msgid "Redundant arguments are skipped, e.g.::" msgstr "多餘的引數會被略過,舉例來說: ::" -#: ../../library/typing.rst:1082 +#: ../../library/typing.rst:1107 msgid "Union[int, str, int] == Union[int, str] == int | str" msgstr "" -#: ../../library/typing.rst:1084 +#: ../../library/typing.rst:1109 msgid "When comparing unions, the argument order is ignored, e.g.::" msgstr "當比較聯集時,引數的順序會被忽略,舉例來說: ::" -#: ../../library/typing.rst:1086 +#: ../../library/typing.rst:1111 msgid "Union[int, str] == Union[str, int]" msgstr "Union[int, str] == Union[str, int]" -#: ../../library/typing.rst:1088 +#: ../../library/typing.rst:1113 msgid "You cannot subclass or instantiate a ``Union``." msgstr "你不能建立 ``Union`` 的子類別或是實例。" -#: ../../library/typing.rst:1090 +#: ../../library/typing.rst:1115 msgid "You cannot write ``Union[X][Y]``." msgstr "你不能寫成 ``Union[X][Y]``。" -#: ../../library/typing.rst:1092 +#: ../../library/typing.rst:1117 msgid "Don't remove explicit subclasses from unions at runtime." msgstr "請勿在 runtime 中將顯性子類別從聯集中移除。" -#: ../../library/typing.rst:1095 +#: ../../library/typing.rst:1120 msgid "" "Unions can now be written as ``X | Y``. See :ref:`union type " "expressions`." msgstr "" "現在可以將聯集寫成 ``X | Y``。請見\\ :ref:`聯集型別運算式 `。" -#: ../../library/typing.rst:1101 +#: ../../library/typing.rst:1126 msgid "``Optional[X]`` is equivalent to ``X | None`` (or ``Union[X, None]``)." msgstr "``Optional[X]`` 與 ``X | None`` 是相等的(或是 ``Union[X, None]``)。" -#: ../../library/typing.rst:1103 +#: ../../library/typing.rst:1128 msgid "" "Note that this is not the same concept as an optional argument, which is one " "that has a default. An optional argument with a default does not require " @@ -1824,7 +1858,7 @@ msgstr "" "有預設值的選擇性引數的型別註釋中不具有 ``Optional`` 限定符 (qualifier),單純" "的因為它就是選擇性的。舉例來說: ::" -#: ../../library/typing.rst:1108 +#: ../../library/typing.rst:1133 msgid "" "def foo(arg: int = 0) -> None:\n" " ..." @@ -1832,7 +1866,7 @@ msgstr "" "def foo(arg: int = 0) -> None:\n" " ..." -#: ../../library/typing.rst:1111 +#: ../../library/typing.rst:1136 msgid "" "On the other hand, if an explicit value of ``None`` is allowed, the use of " "``Optional`` is appropriate, whether the argument is optional or not. For " @@ -1841,7 +1875,7 @@ msgstr "" "另一方面,如果一個顯性的值 ``None`` 是被允許的,不論引數是不是選擇性的," "``Optional`` 都適用。舉例來說: ::" -#: ../../library/typing.rst:1115 +#: ../../library/typing.rst:1140 msgid "" "def foo(arg: Optional[int] = None) -> None:\n" " ..." @@ -1849,7 +1883,7 @@ msgstr "" "def foo(arg: Optional[int] = None) -> None:\n" " ..." -#: ../../library/typing.rst:1118 +#: ../../library/typing.rst:1143 msgid "" "Optional can now be written as ``X | None``. See :ref:`union type " "expressions`." @@ -1857,11 +1891,11 @@ msgstr "" "現在可以將 Optional 寫成 ``X | None``。請見\\ :ref:`聯集型別運算式 `。" -#: ../../library/typing.rst:1124 +#: ../../library/typing.rst:1149 msgid "Special form for annotating higher-order functions." msgstr "用於註釋高階函式的特別型式。" -#: ../../library/typing.rst:1126 +#: ../../library/typing.rst:1151 msgid "" "``Concatenate`` can be used in conjunction with :ref:`Callable ` and :class:`ParamSpec` to annotate a higher-order callable which " @@ -1879,7 +1913,7 @@ msgstr "" "效。``Concatenate`` 的最後一個參數必須為一個 :class:`ParamSpec` 或是刪節號 " "(``...``)。" -#: ../../library/typing.rst:1135 +#: ../../library/typing.rst:1160 msgid "" "For example, to annotate a decorator ``with_lock`` which provides a :class:" "`threading.Lock` to the decorated function, ``Concatenate`` can be used to " @@ -1895,7 +1929,7 @@ msgstr "" "Callable 物件。在這種情況下,:class:`ParamSpec` 指出回傳的 Callable 物件的參" "數型別會依賴傳遞的 Callable 物件的參數型別: ::" -#: ../../library/typing.rst:1143 +#: ../../library/typing.rst:1168 msgid "" "from collections.abc import Callable\n" "from threading import Lock\n" @@ -1923,32 +1957,32 @@ msgid "" "sum_threadsafe([1.1, 2.2, 3.3])" msgstr "" -#: ../../library/typing.rst:1171 ../../library/typing.rst:1933 +#: ../../library/typing.rst:1196 ../../library/typing.rst:2110 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)" msgstr ":pep:`612` -- 參數技術規範變數" -#: ../../library/typing.rst:1173 +#: ../../library/typing.rst:1198 msgid ":class:`ParamSpec`" msgstr ":class:`ParamSpec`" -#: ../../library/typing.rst:1174 ../../library/typing.rst:1936 +#: ../../library/typing.rst:1199 ../../library/typing.rst:2113 msgid ":ref:`annotating-callables`" msgstr ":ref:`annotating-callables`" -#: ../../library/typing.rst:1178 +#: ../../library/typing.rst:1203 msgid "Special typing form to define \"literal types\"." msgstr "特殊型別格式,用於定義「文本型別 (literal type)」。" -#: ../../library/typing.rst:1180 +#: ../../library/typing.rst:1205 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:1186 +#: ../../library/typing.rst:1211 msgid "" "def validate_simple(data: Any) -> Literal[True]: # always returns True\n" " ...\n" @@ -1961,7 +1995,7 @@ msgid "" "open_helper('/other/path', 'typo') # Error in type checker" msgstr "" -#: ../../library/typing.rst:1196 +#: ../../library/typing.rst:1221 msgid "" "``Literal[...]`` cannot be subclassed. At runtime, an arbitrary value is " "allowed as type argument to ``Literal[...]``, but type checkers may impose " @@ -1971,7 +2005,7 @@ msgstr "" "``Literal[...]`` 的型別引數,但型別檢查器可能會加強限制。更多有關文本型別的詳" "細資訊請看 :pep:`586`。" -#: ../../library/typing.rst:1202 +#: ../../library/typing.rst:1227 msgid "" "``Literal`` now de-duplicates parameters. Equality comparisons of " "``Literal`` objects are no longer order dependent. ``Literal`` objects will " @@ -1982,11 +2016,11 @@ msgstr "" "比較不再依照相依性排序。``Literal`` 物件現在會在相等性比較期間,若任一個其中" "的參數無法 :term:`hashable` 時,則會引發一個 :exc:`TypeError` 例外。" -#: ../../library/typing.rst:1210 +#: ../../library/typing.rst:1235 msgid "Special type construct to mark class variables." msgstr "特殊型別建構,用來標記類別變數。" -#: ../../library/typing.rst:1212 +#: ../../library/typing.rst:1237 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 " @@ -1996,18 +2030,18 @@ msgstr "" "定的屬性 (attribute) 意圖被當作類別變數使用,且不該被設定成該類別的實例。使用" "方法如下: ::" -#: ../../library/typing.rst:1216 +#: ../../library/typing.rst:1241 msgid "" "class Starship:\n" " stats: ClassVar[dict[str, int]] = {} # class variable\n" " damage: int = 10 # instance variable" msgstr "" -#: ../../library/typing.rst:1220 +#: ../../library/typing.rst:1245 msgid ":data:`ClassVar` accepts only types and cannot be further subscribed." msgstr ":data:`ClassVar` 只接受型別請不得使用下標。" -#: ../../library/typing.rst:1222 +#: ../../library/typing.rst:1247 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 " @@ -2019,18 +2053,22 @@ msgstr "" "但它可以被第三方的型別檢查器使用。舉例來說,一個型別檢查器可能會標記下方的程" "式碼為一個錯誤: ::" -#: ../../library/typing.rst:1228 +#: ../../library/typing.rst:1253 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:1236 +#: ../../library/typing.rst:1261 +msgid ":data:`ClassVar` can now be nested in :data:`Final` and vice versa." +msgstr "" + +#: ../../library/typing.rst:1265 msgid "Special typing construct to indicate final names to type checkers." msgstr "特殊型別建構,用來指出最終名稱給型別檢查器。" -#: ../../library/typing.rst:1238 +#: ../../library/typing.rst:1267 msgid "" "Final names cannot be reassigned in any scope. Final names declared in class " "scopes cannot be overridden in subclasses." @@ -2038,7 +2076,7 @@ msgstr "" "最終名稱不可以在任何作用域 (scope) 中重新賦值。在類別作用域中宣告的最終名稱," "不得在子類別中進行覆寫 (override)。" -#: ../../library/typing.rst:1243 +#: ../../library/typing.rst:1272 msgid "" "MAX_SIZE: Final = 9000\n" "MAX_SIZE += 1 # Error reported by type checker\n" @@ -2050,18 +2088,22 @@ msgid "" " TIMEOUT = 1 # Error reported by type checker" msgstr "" -#: ../../library/typing.rst:1252 ../../library/typing.rst:2853 +#: ../../library/typing.rst:1281 ../../library/typing.rst:3062 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." msgstr "" "這些屬性 (property) 不會在 runtime 時進行檢查。更多詳細資訊請看 :pep:`591`。" -#: ../../library/typing.rst:1259 +#: ../../library/typing.rst:1288 +msgid ":data:`Final` can now be nested in :data:`ClassVar` and vice versa." +msgstr "" + +#: ../../library/typing.rst:1292 msgid "Special typing construct to mark a :class:`TypedDict` key as required." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是必須的。" -#: ../../library/typing.rst:1261 +#: ../../library/typing.rst:1294 msgid "" "This is mainly useful for ``total=False`` TypedDicts. See :class:`TypedDict` " "and :pep:`655` for more details." @@ -2069,21 +2111,50 @@ msgstr "" "主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` 與 :" "pep:`655`。" -#: ../../library/typing.rst:1268 +#: ../../library/typing.rst:1301 msgid "" "Special typing construct to mark a :class:`TypedDict` key as potentially " "missing." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是可能消失的。" -#: ../../library/typing.rst:1271 +#: ../../library/typing.rst:1304 msgid "See :class:`TypedDict` and :pep:`655` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" -#: ../../library/typing.rst:1277 +#: ../../library/typing.rst:1310 +#, fuzzy +msgid "" +"A special typing construct to mark an item of a :class:`TypedDict` as read-" +"only." +msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是必須的。" + +#: ../../library/typing.rst:1314 +msgid "" +"class Movie(TypedDict):\n" +" title: ReadOnly[str]\n" +" year: int\n" +"\n" +"def mutate_movie(m: Movie) -> None:\n" +" m[\"year\"] = 1992 # allowed\n" +" m[\"title\"] = \"The Matrix\" # typechecker error" +msgstr "" + +#: ../../library/typing.rst:1322 +#, fuzzy +msgid "There is no runtime checking for this property." +msgstr "" +"這些屬性 (property) 不會在 runtime 時進行檢查。更多詳細資訊請看 :pep:`591`。" + +#: ../../library/typing.rst:1324 +#, fuzzy +msgid "See :class:`TypedDict` and :pep:`705` for more details." +msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" + +#: ../../library/typing.rst:1330 msgid "Special typing form to add context-specific metadata to an annotation." msgstr "" -#: ../../library/typing.rst:1279 +#: ../../library/typing.rst:1332 msgid "" "Add metadata ``x`` to a given type ``T`` by using the annotation " "``Annotated[T, x]``. Metadata added using ``Annotated`` can be used by " @@ -2091,7 +2162,7 @@ msgid "" "a :attr:`!__metadata__` attribute." msgstr "" -#: ../../library/typing.rst:1284 +#: ../../library/typing.rst:1337 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 " @@ -2100,7 +2171,7 @@ msgid "" "system." msgstr "" -#: ../../library/typing.rst:1290 +#: ../../library/typing.rst:1343 msgid "" "Using ``Annotated[T, x]`` as an annotation still allows for static " "typechecking of ``T``, as type checkers will simply ignore the metadata " @@ -2110,7 +2181,7 @@ msgid "" "for a function or class." msgstr "" -#: ../../library/typing.rst:1297 +#: ../../library/typing.rst:1350 msgid "" "The responsibility of how to interpret the metadata lies with the tool or " "library encountering an ``Annotated`` annotation. A tool or library " @@ -2118,13 +2189,13 @@ msgid "" "determine if they are of interest (e.g., using :func:`isinstance`)." msgstr "" -#: ../../library/typing.rst:1305 +#: ../../library/typing.rst:1358 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:1308 +#: ../../library/typing.rst:1361 msgid "" "@dataclass\n" "class ValueRange:\n" @@ -2142,21 +2213,21 @@ msgstr "" "T1 = Annotated[int, ValueRange(-10, 5)]\n" "T2 = Annotated[T1, ValueRange(-20, 3)]" -#: ../../library/typing.rst:1318 +#: ../../library/typing.rst:1371 msgid "Details of the syntax:" msgstr "" -#: ../../library/typing.rst:1320 +#: ../../library/typing.rst:1373 msgid "The first argument to ``Annotated`` must be a valid type" msgstr "" -#: ../../library/typing.rst:1322 +#: ../../library/typing.rst:1375 msgid "" "Multiple metadata elements can be supplied (``Annotated`` supports variadic " "arguments)::" msgstr "" -#: ../../library/typing.rst:1325 +#: ../../library/typing.rst:1378 msgid "" "@dataclass\n" "class ctype:\n" @@ -2170,26 +2241,26 @@ msgstr "" "\n" "Annotated[int, ValueRange(3, 10), ctype(\"char\")]" -#: ../../library/typing.rst:1331 +#: ../../library/typing.rst:1384 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:1335 +#: ../../library/typing.rst:1388 msgid "" "``Annotated`` must be subscripted with at least two arguments " "( ``Annotated[int]`` is not valid)" msgstr "" -#: ../../library/typing.rst:1338 +#: ../../library/typing.rst:1391 msgid "" "The order of the metadata elements is preserved and matters for equality " "checks::" msgstr "" -#: ../../library/typing.rst:1341 +#: ../../library/typing.rst:1394 msgid "" "assert Annotated[int, ValueRange(3, 10), ctype(\"char\")] != Annotated[\n" " int, ctype(\"char\"), ValueRange(3, 10)\n" @@ -2199,13 +2270,13 @@ msgstr "" " int, ctype(\"char\"), ValueRange(3, 10)\n" "]" -#: ../../library/typing.rst:1345 +#: ../../library/typing.rst:1398 msgid "" "Nested ``Annotated`` types are flattened. The order of the metadata elements " "starts with the innermost annotation::" msgstr "" -#: ../../library/typing.rst:1348 +#: ../../library/typing.rst:1401 msgid "" "assert Annotated[Annotated[int, ValueRange(3, 10)], ctype(\"char\")] == " "Annotated[\n" @@ -2217,11 +2288,11 @@ msgstr "" " int, ValueRange(3, 10), ctype(\"char\")\n" "]" -#: ../../library/typing.rst:1352 +#: ../../library/typing.rst:1405 msgid "Duplicated metadata elements are not removed::" msgstr "" -#: ../../library/typing.rst:1354 +#: ../../library/typing.rst:1407 msgid "" "assert Annotated[int, ValueRange(3, 10)] != Annotated[\n" " int, ValueRange(3, 10), ValueRange(3, 10)\n" @@ -2231,11 +2302,11 @@ msgstr "" " int, ValueRange(3, 10), ValueRange(3, 10)\n" "]" -#: ../../library/typing.rst:1358 +#: ../../library/typing.rst:1411 msgid "``Annotated`` can be used with nested and generic aliases:" msgstr "" -#: ../../library/typing.rst:1360 +#: ../../library/typing.rst:1413 msgid "" "@dataclass\n" "class MaxLen:\n" @@ -2249,35 +2320,35 @@ msgid "" "type V = Vec[int]" msgstr "" -#: ../../library/typing.rst:1372 +#: ../../library/typing.rst:1425 msgid "``Annotated`` cannot be used with an unpacked :class:`TypeVarTuple`::" msgstr "" -#: ../../library/typing.rst:1374 +#: ../../library/typing.rst:1427 msgid "type Variadic[*Ts] = Annotated[*Ts, Ann1] # NOT valid" msgstr "" -#: ../../library/typing.rst:1376 +#: ../../library/typing.rst:1429 msgid "This would be equivalent to::" msgstr "這會等價於: ::" -#: ../../library/typing.rst:1378 +#: ../../library/typing.rst:1431 msgid "Annotated[T1, T2, T3, ..., Ann1]" msgstr "Annotated[T1, T2, T3, ..., Ann1]" -#: ../../library/typing.rst:1380 +#: ../../library/typing.rst:1433 msgid "" "where ``T1``, ``T2``, etc. are :class:`TypeVars `. This would be " "invalid: only one type should be passed to Annotated." msgstr "" -#: ../../library/typing.rst:1383 +#: ../../library/typing.rst:1436 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:1386 +#: ../../library/typing.rst:1439 msgid "" ">>> from typing import Annotated, get_type_hints\n" ">>> def func(x: Annotated[int, \"metadata\"]) -> None: pass\n" @@ -2295,13 +2366,13 @@ msgstr "" ">>> get_type_hints(func, include_extras=True)\n" "{'x': typing.Annotated[int, 'metadata'], 'return': }" -#: ../../library/typing.rst:1396 +#: ../../library/typing.rst:1449 msgid "" "At runtime, the metadata associated with an ``Annotated`` type can be " "retrieved via the :attr:`!__metadata__` attribute:" msgstr "" -#: ../../library/typing.rst:1399 +#: ../../library/typing.rst:1452 msgid "" ">>> from typing import Annotated\n" ">>> X = Annotated[int, \"very\", \"important\", \"metadata\"]\n" @@ -2317,38 +2388,42 @@ msgstr "" ">>> X.__metadata__\n" "('very', 'important', 'metadata')" -#: ../../library/typing.rst:1410 +#: ../../library/typing.rst:1463 msgid ":pep:`593` - Flexible function and variable annotations" msgstr "" -#: ../../library/typing.rst:1411 +#: ../../library/typing.rst:1464 msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "" -#: ../../library/typing.rst:1418 -msgid "Special typing construct for marking user-defined type guard functions." -msgstr "" +#: ../../library/typing.rst:1471 ../../library/typing.rst:1555 +#, fuzzy +msgid "" +"Special typing construct for marking user-defined type predicate functions." +msgstr "特殊型別建構,用來指出最終名稱給型別檢查器。" -#: ../../library/typing.rst:1420 +#: ../../library/typing.rst:1473 msgid "" -"``TypeGuard`` can be used to annotate the return type of a user-defined type " -"guard function. ``TypeGuard`` only accepts a single type argument. At " -"runtime, functions marked this way should return a boolean." +"``TypeIs`` can be used to annotate the return type of a user-defined type " +"predicate function. ``TypeIs`` only accepts a single type argument. At " +"runtime, functions marked this way should return a boolean and take at least " +"one positional argument." msgstr "" -#: ../../library/typing.rst:1424 +#: ../../library/typing.rst:1478 msgid "" -"``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static " +"``TypeIs`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " "program's code flow. Usually type narrowing is done by analyzing " "conditional code flow and applying the narrowing to a block of code. The " -"conditional expression here is sometimes referred to as a \"type guard\"::" +"conditional expression here is sometimes referred to as a \"type " +"predicate\"::" msgstr "" -#: ../../library/typing.rst:1430 +#: ../../library/typing.rst:1484 msgid "" "def is_str(val: str | float):\n" -" # \"isinstance\" type guard\n" +" # \"isinstance\" type predicate\n" " if isinstance(val, str):\n" " # Type of ``val`` is narrowed to ``str``\n" " ...\n" @@ -2357,30 +2432,119 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1439 +#: ../../library/typing.rst:1493 msgid "" "Sometimes it would be convenient to use a user-defined boolean function as a " -"type guard. Such a function should use ``TypeGuard[...]`` as its return " -"type to alert static type checkers to this intention." +"type predicate. Such a function should use ``TypeIs[...]`` or :data:" +"`TypeGuard` as its return type to alert static type checkers to this " +"intention. ``TypeIs`` usually has more intuitive behavior than " +"``TypeGuard``, but it cannot be used when the input and output types are " +"incompatible (e.g., ``list[object]`` to ``list[int]``) or when the function " +"does not return ``True`` for all instances of the narrowed type." msgstr "" -#: ../../library/typing.rst:1443 +#: ../../library/typing.rst:1501 msgid "" -"Using ``-> TypeGuard`` tells the static type checker that for a given " -"function:" +"Using ``-> TypeIs[NarrowedType]`` tells the static type checker that for a " +"given function:" msgstr "" -#: ../../library/typing.rst:1446 +#: ../../library/typing.rst:1504 ../../library/typing.rst:1565 msgid "The return value is a boolean." msgstr "" -#: ../../library/typing.rst:1447 +#: ../../library/typing.rst:1505 +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:1507 +msgid "" +"If the return value is ``False``, the type of its argument is narrowed to " +"exclude ``NarrowedType``." +msgstr "" + +#: ../../library/typing.rst:1512 +msgid "" +"from typing import assert_type, final, TypeIs\n" +"\n" +"class Parent: pass\n" +"class Child(Parent): pass\n" +"@final\n" +"class Unrelated: pass\n" +"\n" +"def is_parent(val: object) -> TypeIs[Parent]:\n" +" return isinstance(val, Parent)\n" +"\n" +"def run(arg: Child | Unrelated):\n" +" if is_parent(arg):\n" +" # Type of ``arg`` is narrowed to the intersection\n" +" # of ``Parent`` and ``Child``, which is equivalent to\n" +" # ``Child``.\n" +" assert_type(arg, Child)\n" +" else:\n" +" # Type of ``arg`` is narrowed to exclude ``Parent``,\n" +" # so only ``Unrelated`` is left.\n" +" assert_type(arg, Unrelated)" +msgstr "" + +#: ../../library/typing.rst:1533 +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 " +"error. An incorrectly written ``TypeIs`` function can lead to unsound " +"behavior in the type system; it is the user's responsibility to write such " +"functions in a type-safe manner." +msgstr "" + +#: ../../library/typing.rst:1539 +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:1543 +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:1547 +msgid "" +"``TypeIs`` also works with type variables. For more information, see :pep:" +"`742` (Narrowing types with ``TypeIs``)." +msgstr "" + +#: ../../library/typing.rst:1557 +msgid "" +"Type predicate functions are user-defined functions that return whether " +"their argument is an instance of a particular type. ``TypeGuard`` works " +"similarly to :data:`TypeIs`, but has subtly different effects on type " +"checking behavior (see below)." +msgstr "" + +#: ../../library/typing.rst:1562 +msgid "" +"Using ``-> TypeGuard`` tells the static type checker that for a given " +"function:" +msgstr "" + +#: ../../library/typing.rst:1566 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1452 +#: ../../library/typing.rst:1569 +msgid "" +"``TypeGuard`` also works with type variables. See :pep:`647` for more " +"details." +msgstr "" + +#: ../../library/typing.rst:1573 msgid "" "def is_str_list(val: list[object]) -> TypeGuard[list[str]]:\n" " '''Determines whether all objects in the list are strings'''\n" @@ -2395,47 +2559,47 @@ msgid "" " print(\"Not a list of strings!\")" msgstr "" -#: ../../library/typing.rst:1464 -msgid "" -"If ``is_str_list`` is a class or instance method, then the type in " -"``TypeGuard`` maps to the type of the second parameter (after ``cls`` or " -"``self``)." +#: ../../library/typing.rst:1585 +msgid "``TypeIs`` and ``TypeGuard`` differ in the following ways:" msgstr "" -#: ../../library/typing.rst:1468 +#: ../../library/typing.rst:1587 msgid "" -"In short, the form ``def foo(arg: TypeA) -> TypeGuard[TypeB]: ...``, means " -"that if ``foo(arg)`` returns ``True``, then ``arg`` narrows from ``TypeA`` " -"to ``TypeB``." +"``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 " +"narrowing ``list[object]`` to ``list[str]`` even though the latter is not a " +"subtype of the former, since ``list`` is invariant." msgstr "" -#: ../../library/typing.rst:1474 +#: ../../library/typing.rst:1591 msgid "" -"``TypeB`` need not be a narrower form of ``TypeA`` -- it can even be a wider " -"form. The main reason is to allow for things like narrowing ``list[object]`` " -"to ``list[str]`` even though the latter is not a subtype of the former, " -"since ``list`` is invariant. The responsibility of writing type-safe type " -"guards is left to the user." +"When a ``TypeGuard`` function returns ``True``, type checkers narrow the " +"type of the variable to exactly the ``TypeGuard`` type. When a ``TypeIs`` " +"function returns ``True``, type checkers can infer a more precise type " +"combining the previously known type of the variable with the ``TypeIs`` " +"type. (Technically, this is known as an intersection type.)" msgstr "" -#: ../../library/typing.rst:1480 +#: ../../library/typing.rst:1595 msgid "" -"``TypeGuard`` also works with type variables. See :pep:`647` for more " -"details." +"When a ``TypeGuard`` function returns ``False``, type checkers cannot narrow " +"the type of the variable at all. When a ``TypeIs`` function returns " +"``False``, type checkers can narrow the type of the variable to exclude the " +"``TypeIs`` type." msgstr "" -#: ../../library/typing.rst:1487 +#: ../../library/typing.rst:1604 msgid "Typing operator to conceptually mark an object as having been unpacked." msgstr "" -#: ../../library/typing.rst:1489 +#: ../../library/typing.rst:1606 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:1493 +#: ../../library/typing.rst:1610 msgid "" "Ts = TypeVarTuple('Ts')\n" "tup: tuple[*Ts]\n" @@ -2443,7 +2607,7 @@ msgid "" "tup: tuple[Unpack[Ts]]" msgstr "" -#: ../../library/typing.rst:1498 +#: ../../library/typing.rst:1615 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " @@ -2451,7 +2615,7 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" -#: ../../library/typing.rst:1504 +#: ../../library/typing.rst:1621 msgid "" "# In older versions of Python, TypeVarTuple and Unpack\n" "# are located in the `typing_extensions` backports package.\n" @@ -2462,13 +2626,13 @@ msgid "" "tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible" msgstr "" -#: ../../library/typing.rst:1512 +#: ../../library/typing.rst:1629 msgid "" "``Unpack`` can also be used along with :class:`typing.TypedDict` for typing " "``**kwargs`` in a function signature::" msgstr "" -#: ../../library/typing.rst:1515 +#: ../../library/typing.rst:1632 msgid "" "from typing import TypedDict, Unpack\n" "\n" @@ -2481,23 +2645,23 @@ msgid "" "def foo(**kwargs: Unpack[Movie]): ..." msgstr "" -#: ../../library/typing.rst:1525 +#: ../../library/typing.rst:1642 msgid "" "See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` typing." msgstr "" -#: ../../library/typing.rst:1530 +#: ../../library/typing.rst:1647 msgid "Building generic types and type aliases" msgstr "" -#: ../../library/typing.rst:1532 +#: ../../library/typing.rst:1649 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:1536 +#: ../../library/typing.rst:1653 msgid "" "These objects can be created through special syntax (:ref:`type parameter " "lists ` and the :keyword:`type` statement). For compatibility " @@ -2505,17 +2669,17 @@ msgid "" "syntax, as documented below." msgstr "" -#: ../../library/typing.rst:1543 +#: ../../library/typing.rst:1660 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1545 +#: ../../library/typing.rst:1662 msgid "" "A generic type is typically declared by adding a list of type parameters " "after the class name::" msgstr "" -#: ../../library/typing.rst:1548 +#: ../../library/typing.rst:1665 msgid "" "class Mapping[KT, VT]:\n" " def __getitem__(self, key: KT) -> VT:\n" @@ -2523,17 +2687,17 @@ msgid "" " # Etc." msgstr "" -#: ../../library/typing.rst:1553 +#: ../../library/typing.rst:1670 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:1557 +#: ../../library/typing.rst:1674 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1559 +#: ../../library/typing.rst:1676 msgid "" "def lookup_name[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:\n" " try:\n" @@ -2547,20 +2711,20 @@ msgstr "" " except KeyError:\n" " return default" -#: ../../library/typing.rst:1565 +#: ../../library/typing.rst:1682 msgid "" "Here the brackets after the function name indicate a :ref:`generic function " "`." msgstr "" -#: ../../library/typing.rst:1568 +#: ../../library/typing.rst:1685 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:1573 +#: ../../library/typing.rst:1690 msgid "" "KT = TypeVar('KT')\n" "VT = TypeVar('VT')\n" @@ -2578,18 +2742,18 @@ msgstr "" " ...\n" " # Etc." -#: ../../library/typing.rst:1585 +#: ../../library/typing.rst:1702 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1587 +#: ../../library/typing.rst:1704 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:1592 +#: ../../library/typing.rst:1709 msgid "" "class Sequence[T]: # T is a TypeVar\n" " ..." @@ -2597,12 +2761,12 @@ msgstr "" "class Sequence[T]: # T 是一個 TypeVar\n" " ..." -#: ../../library/typing.rst:1595 +#: ../../library/typing.rst:1712 msgid "" "This syntax can also be used to create bound and constrained type variables::" msgstr "" -#: ../../library/typing.rst:1598 +#: ../../library/typing.rst:1715 msgid "" "class StrSequence[S: str]: # S is a TypeVar bound to str\n" " ...\n" @@ -2613,20 +2777,20 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1605 +#: ../../library/typing.rst:1722 msgid "" "However, if desired, reusable type variables can also be constructed " "manually, like so::" msgstr "" -#: ../../library/typing.rst:1607 +#: ../../library/typing.rst:1724 msgid "" "T = TypeVar('T') # Can be anything\n" "S = TypeVar('S', bound=str) # Can be any subtype of str\n" "A = TypeVar('A', str, bytes) # Must be exactly str or bytes" msgstr "" -#: ../../library/typing.rst:1611 +#: ../../library/typing.rst:1728 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 " @@ -2634,7 +2798,7 @@ msgid "" "information on generic types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1617 +#: ../../library/typing.rst:1734 msgid "" "def repeat[T](x: T, n: int) -> Sequence[T]:\n" " \"\"\"Return a list containing n references to x.\"\"\"\n" @@ -2652,13 +2816,13 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:1632 +#: ../../library/typing.rst:1749 msgid "" "Note that type variables can be *bound*, *constrained*, or neither, but " "cannot be both bound *and* constrained." msgstr "" -#: ../../library/typing.rst:1635 +#: ../../library/typing.rst:1752 msgid "" "The variance of type variables is inferred by type checkers when they are " "created through the :ref:`type parameter syntax ` or when " @@ -2668,14 +2832,14 @@ msgid "" "invariant. See :pep:`484` and :pep:`695` for more details." msgstr "" -#: ../../library/typing.rst:1643 +#: ../../library/typing.rst:1760 msgid "" "Bound type variables and constrained type variables have different semantics " "in several important ways. Using a *bound* type variable means that the " "``TypeVar`` will be solved using the most specific type possible::" msgstr "" -#: ../../library/typing.rst:1647 +#: ../../library/typing.rst:1764 msgid "" "x = print_capitalized('a string')\n" "reveal_type(x) # revealed type is str\n" @@ -2689,13 +2853,13 @@ msgid "" "z = print_capitalized(45) # error: int is not a subtype of str" msgstr "" -#: ../../library/typing.rst:1658 +#: ../../library/typing.rst:1775 msgid "" "Type variables can be bound to concrete types, abstract types (ABCs or " "protocols), and even unions of types::" msgstr "" -#: ../../library/typing.rst:1661 +#: ../../library/typing.rst:1778 msgid "" "# Can be anything with an __abs__ method\n" "def print_abs[T: SupportsAbs](arg: T) -> None:\n" @@ -2706,13 +2870,13 @@ msgid "" "V = TypeVar('V', bound=SupportsAbs) # Can be anything with an __abs__ method" msgstr "" -#: ../../library/typing.rst:1670 +#: ../../library/typing.rst:1787 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:1673 +#: ../../library/typing.rst:1790 msgid "" "a = concatenate('one', 'two')\n" "reveal_type(a) # revealed type is str\n" @@ -2725,69 +2889,88 @@ msgid "" "or bytes in a function call, but not both" msgstr "" -#: ../../library/typing.rst:1681 +#: ../../library/typing.rst:1798 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." msgstr "" -#: ../../library/typing.rst:1685 +#: ../../library/typing.rst:1802 msgid "The name of the type variable." msgstr "" -#: ../../library/typing.rst:1689 +#: ../../library/typing.rst:1806 msgid "Whether the type var has been explicitly marked as covariant." msgstr "" -#: ../../library/typing.rst:1693 +#: ../../library/typing.rst:1810 msgid "Whether the type var has been explicitly marked as contravariant." msgstr "" -#: ../../library/typing.rst:1697 +#: ../../library/typing.rst:1814 msgid "" "Whether the type variable's variance should be inferred by type checkers." msgstr "" -#: ../../library/typing.rst:1703 +#: ../../library/typing.rst:1820 msgid "The bound of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1707 +#: ../../library/typing.rst:1824 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:1713 +#: ../../library/typing.rst:1830 msgid "A tuple containing the constraints of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1717 +#: ../../library/typing.rst:1834 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:1723 +#: ../../library/typing.rst:1840 +msgid "" +"The default value of the type variable, or :data:`typing.NoDefault` if it " +"has no default." +msgstr "" + +#: ../../library/typing.rst:1847 +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." +"NoDefault` singleton, except that it does not force evaluation of the :ref:" +"`lazily evaluated ` default value." +msgstr "" + +#: ../../library/typing.rst:1856 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:1731 +#: ../../library/typing.rst:1862 ../../library/typing.rst:2001 +#: ../../library/typing.rst:2103 +msgid "Support for default values was added." +msgstr "" + +#: ../../library/typing.rst:1868 msgid "" "Type variable tuple. A specialized form of :ref:`type variable ` " "that enables *variadic* generics." msgstr "" -#: ../../library/typing.rst:1734 +#: ../../library/typing.rst:1871 msgid "" "Type variable tuples can be declared in :ref:`type parameter lists ` using a single asterisk (``*``) before the name::" msgstr "" -#: ../../library/typing.rst:1737 +#: ../../library/typing.rst:1874 msgid "" "def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, " "T]:\n" @@ -2797,11 +2980,11 @@ msgstr "" "T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1740 +#: ../../library/typing.rst:1877 msgid "Or by explicitly invoking the ``TypeVarTuple`` constructor::" msgstr "" -#: ../../library/typing.rst:1742 +#: ../../library/typing.rst:1879 msgid "" "T = TypeVar(\"T\")\n" "Ts = TypeVarTuple(\"Ts\")\n" @@ -2815,7 +2998,7 @@ msgstr "" "def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1748 +#: ../../library/typing.rst:1885 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " @@ -2823,7 +3006,7 @@ msgid "" "wrapped in a tuple. For example::" msgstr "" -#: ../../library/typing.rst:1753 +#: ../../library/typing.rst:1890 msgid "" "# T is bound to int, Ts is bound to ()\n" "# Return value is (1,), which has type tuple[int]\n" @@ -2843,7 +3026,7 @@ msgid "" "move_first_element_to_last(tup=())" msgstr "" -#: ../../library/typing.rst:1770 +#: ../../library/typing.rst:1907 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, " @@ -2853,26 +3036,26 @@ msgid "" "` instead, as ``Unpack[Ts]``.)" msgstr "" -#: ../../library/typing.rst:1778 +#: ../../library/typing.rst:1915 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" -#: ../../library/typing.rst:1781 +#: ../../library/typing.rst:1918 msgid "" "x: Ts # Not valid\n" "x: tuple[Ts] # Not valid\n" "x: tuple[*Ts] # The correct way to do it" msgstr "" -#: ../../library/typing.rst:1785 +#: ../../library/typing.rst:1922 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:1788 +#: ../../library/typing.rst:1925 msgid "" "class Array[*Shape]:\n" " def __getitem__(self, key: tuple[*Shape]) -> float: ...\n" @@ -2884,12 +3067,12 @@ msgstr "" " def __abs__(self) -> \"Array[*Shape]\": ...\n" " def get_shape(self) -> tuple[*Shape]: ..." -#: ../../library/typing.rst:1793 +#: ../../library/typing.rst:1930 msgid "" "Type variable tuples can be happily combined with normal type variables:" msgstr "" -#: ../../library/typing.rst:1795 +#: ../../library/typing.rst:1932 msgid "" "class Array[DType, *Shape]: # This is fine\n" " pass\n" @@ -2904,26 +3087,26 @@ msgid "" "int_array_2d: Array[int, Height, Width] = Array() # Yup, fine too" msgstr "" -#: ../../library/typing.rst:1809 +#: ../../library/typing.rst:1946 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:1812 +#: ../../library/typing.rst:1949 msgid "" "x: tuple[*Ts, *Ts] # Not valid\n" "class Array[*Shape, *Shape]: # Not valid\n" " pass" msgstr "" -#: ../../library/typing.rst:1816 +#: ../../library/typing.rst:1953 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" -#: ../../library/typing.rst:1819 +#: ../../library/typing.rst:1956 msgid "" "def call_soon[*Ts](\n" " callback: Callable[[*Ts], None],\n" @@ -2939,7 +3122,7 @@ msgstr "" " ...\n" " callback(*args)" -#: ../../library/typing.rst:1826 +#: ../../library/typing.rst:1963 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -2948,47 +3131,61 @@ msgid "" "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" -#: ../../library/typing.rst:1833 +#: ../../library/typing.rst:1970 msgid "See :pep:`646` for more details on type variable tuples." msgstr "" -#: ../../library/typing.rst:1837 +#: ../../library/typing.rst:1974 msgid "The name of the type variable tuple." msgstr "" -#: ../../library/typing.rst:1843 +#: ../../library/typing.rst:1978 +msgid "" +"The default value of the type variable tuple, or :data:`typing.NoDefault` if " +"it has no default." +msgstr "" + +#: ../../library/typing.rst:1985 +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." +"NoDefault` singleton, except that it does not force evaluation of the :ref:" +"`lazily evaluated ` default value." +msgstr "" + +#: ../../library/typing.rst:1996 msgid "" "Type variable tuples can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:1848 +#: ../../library/typing.rst:2005 msgid "" "Parameter specification variable. A specialized version of :ref:`type " "variables `." msgstr "" -#: ../../library/typing.rst:1851 +#: ../../library/typing.rst:2008 msgid "" "In :ref:`type parameter lists `, parameter specifications can " "be declared with two asterisks (``**``)::" msgstr "" -#: ../../library/typing.rst:1854 +#: ../../library/typing.rst:2011 msgid "type IntFunc[**P] = Callable[P, int]" msgstr "type IntFunc[**P] = Callable[P, int]" -#: ../../library/typing.rst:1856 +#: ../../library/typing.rst:2013 msgid "" "For compatibility with Python 3.11 and earlier, ``ParamSpec`` objects can " "also be created as follows::" msgstr "" -#: ../../library/typing.rst:1859 +#: ../../library/typing.rst:2016 msgid "P = ParamSpec('P')" msgstr "P = ParamSpec('P')" -#: ../../library/typing.rst:1861 +#: ../../library/typing.rst:2018 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -2998,7 +3195,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:1868 +#: ../../library/typing.rst:2025 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 " @@ -3006,7 +3203,7 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:1873 +#: ../../library/typing.rst:2030 msgid "" "from collections.abc import Callable\n" "import logging\n" @@ -3024,27 +3221,27 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:1888 +#: ../../library/typing.rst:2045 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " "use a :class:`TypeVar` with bound ``Callable[..., Any]``. However this " "causes two problems:" msgstr "" -#: ../../library/typing.rst:1892 +#: ../../library/typing.rst:2049 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:1894 +#: ../../library/typing.rst:2051 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:1901 +#: ../../library/typing.rst:2058 msgid "" "Since ``ParamSpec`` captures both positional and keyword parameters, ``P." "args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " @@ -3057,11 +3254,25 @@ msgid "" "`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:1913 +#: ../../library/typing.rst:2070 msgid "The name of the parameter specification." msgstr "" -#: ../../library/typing.rst:1915 +#: ../../library/typing.rst:2074 +msgid "" +"The default value of the parameter specification, or :data:`typing." +"NoDefault` if it has no default." +msgstr "" + +#: ../../library/typing.rst:2081 +msgid "" +"Return whether or not the parameter specification has a default value. This " +"is equivalent to checking whether :attr:`__default__` is not the :data:" +"`typing.NoDefault` singleton, except that it does not force evaluation of " +"the :ref:`lazily evaluated ` default value." +msgstr "" + +#: ../../library/typing.rst:2088 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " @@ -3070,23 +3281,23 @@ msgid "" "decided." msgstr "" -#: ../../library/typing.rst:1925 +#: ../../library/typing.rst:2098 msgid "" "Parameter specifications can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:1929 +#: ../../library/typing.rst:2106 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:1935 +#: ../../library/typing.rst:2112 msgid ":data:`Concatenate`" msgstr ":data:`Concatenate`" -#: ../../library/typing.rst:1941 +#: ../../library/typing.rst:2118 msgid "" "Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." "args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " @@ -3094,13 +3305,13 @@ msgid "" "runtime introspection and have no special meaning to static type checkers." msgstr "" -#: ../../library/typing.rst:1946 +#: ../../library/typing.rst:2123 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" -#: ../../library/typing.rst:1949 +#: ../../library/typing.rst:2126 msgid "" ">>> from typing import ParamSpec, get_origin\n" ">>> P = ParamSpec(\"P\")\n" @@ -3116,11 +3327,11 @@ msgstr "" ">>> get_origin(P.kwargs) is P\n" "True" -#: ../../library/typing.rst:1963 +#: ../../library/typing.rst:2140 msgid "The type of type aliases created through the :keyword:`type` statement." msgstr "" -#: ../../library/typing.rst:1967 +#: ../../library/typing.rst:2144 msgid "" ">>> type Alias = int\n" ">>> type(Alias)\n" @@ -3130,11 +3341,11 @@ msgstr "" ">>> type(Alias)\n" "" -#: ../../library/typing.rst:1977 +#: ../../library/typing.rst:2154 msgid "The name of the type alias:" msgstr "" -#: ../../library/typing.rst:1979 +#: ../../library/typing.rst:2156 msgid "" ">>> type Alias = int\n" ">>> Alias.__name__\n" @@ -3144,11 +3355,11 @@ msgstr "" ">>> Alias.__name__\n" "'Alias'" -#: ../../library/typing.rst:1987 +#: ../../library/typing.rst:2164 msgid "The module in which the type alias was defined::" msgstr "" -#: ../../library/typing.rst:1989 +#: ../../library/typing.rst:2166 msgid "" ">>> type Alias = int\n" ">>> Alias.__module__\n" @@ -3158,13 +3369,13 @@ msgstr "" ">>> Alias.__module__\n" "'__main__'" -#: ../../library/typing.rst:1995 +#: ../../library/typing.rst:2172 msgid "" "The type parameters of the type alias, or an empty tuple if the alias is not " "generic:" msgstr "" -#: ../../library/typing.rst:1998 +#: ../../library/typing.rst:2175 msgid "" ">>> type ListOrSet[T] = list[T] | set[T]\n" ">>> ListOrSet.__type_params__\n" @@ -3180,14 +3391,14 @@ msgstr "" ">>> NotGeneric.__type_params__\n" "()" -#: ../../library/typing.rst:2009 +#: ../../library/typing.rst:2186 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:2013 +#: ../../library/typing.rst:2190 msgid "" ">>> type Mutually = Recursive\n" ">>> type Recursive = Mutually\n" @@ -3211,27 +3422,27 @@ msgstr "" ">>> Recursive.__value__\n" "Mutually" -#: ../../library/typing.rst:2027 +#: ../../library/typing.rst:2204 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:2029 +#: ../../library/typing.rst:2206 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:2035 +#: ../../library/typing.rst:2212 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:2037 ../../library/typing.rst:2114 -#: ../../library/typing.rst:3083 +#: ../../library/typing.rst:2214 ../../library/typing.rst:2304 +#: ../../library/typing.rst:3343 msgid "Usage::" msgstr "" -#: ../../library/typing.rst:2039 +#: ../../library/typing.rst:2216 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3241,20 +3452,20 @@ msgstr "" " name: str\n" " id: int" -#: ../../library/typing.rst:2043 +#: ../../library/typing.rst:2220 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../library/typing.rst:2045 +#: ../../library/typing.rst:2222 msgid "Employee = collections.namedtuple('Employee', ['name', 'id'])" msgstr "Employee = collections.namedtuple('Employee', ['name', 'id'])" -#: ../../library/typing.rst:2047 +#: ../../library/typing.rst:2224 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:2049 +#: ../../library/typing.rst:2226 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3270,12 +3481,12 @@ msgstr "" "employee = Employee('Guido')\n" "assert employee.id == 3" -#: ../../library/typing.rst:2056 +#: ../../library/typing.rst:2233 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:2058 +#: ../../library/typing.rst:2235 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 " @@ -3284,11 +3495,11 @@ msgid "" "API.)" msgstr "" -#: ../../library/typing.rst:2064 +#: ../../library/typing.rst:2241 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:2066 +#: ../../library/typing.rst:2243 msgid "" "class Employee(NamedTuple):\n" " \"\"\"Represents an employee.\"\"\"\n" @@ -3299,11 +3510,11 @@ msgid "" " return f''" msgstr "" -#: ../../library/typing.rst:2074 +#: ../../library/typing.rst:2251 msgid "``NamedTuple`` subclasses can be generic::" msgstr "" -#: ../../library/typing.rst:2076 +#: ../../library/typing.rst:2253 msgid "" "class Group[T](NamedTuple):\n" " key: T\n" @@ -3313,11 +3524,11 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2080 +#: ../../library/typing.rst:2257 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:2082 +#: ../../library/typing.rst:2259 msgid "" "# For creating a generic NamedTuple on Python 3.11 or lower\n" "class Group(NamedTuple, Generic[T]):\n" @@ -3328,72 +3539,89 @@ msgid "" "Employee = NamedTuple('Employee', [('name', str), ('id', int)])" msgstr "" -#: ../../library/typing.rst:2090 +#: ../../library/typing.rst:2267 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:2093 +#: ../../library/typing.rst:2270 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:2096 +#: ../../library/typing.rst:2273 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:2100 +#: ../../library/typing.rst:2277 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:2104 +#: ../../library/typing.rst:2281 msgid "Added support for generic namedtuples." msgstr "" -#: ../../library/typing.rst:2109 +#: ../../library/typing.rst:2284 +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:2289 +msgid "" +"When using the functional syntax to create a NamedTuple class, failing to " +"pass a value to the 'fields' parameter (``NT = NamedTuple(\"NT\")``) is " +"deprecated. Passing ``None`` to the 'fields' parameter (``NT = " +"NamedTuple(\"NT\", None)``) is also deprecated. Both will be disallowed in " +"Python 3.15. To create a NamedTuple class with 0 fields, use ``class " +"NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", [])``." +msgstr "" + +#: ../../library/typing.rst:2299 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" -#: ../../library/typing.rst:2111 +#: ../../library/typing.rst:2301 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:2116 +#: ../../library/typing.rst:2306 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:2121 +#: ../../library/typing.rst:2311 msgid "The module in which the new type is defined." msgstr "" -#: ../../library/typing.rst:2125 +#: ../../library/typing.rst:2315 msgid "The name of the new type." msgstr "" -#: ../../library/typing.rst:2129 +#: ../../library/typing.rst:2319 msgid "The type that the new type is based on." msgstr "" -#: ../../library/typing.rst:2133 +#: ../../library/typing.rst:2323 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:2138 +#: ../../library/typing.rst:2328 msgid "Base class for protocol classes." msgstr "" -#: ../../library/typing.rst:2140 +#: ../../library/typing.rst:2330 msgid "Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:2142 +#: ../../library/typing.rst:2332 msgid "" "class Proto(Protocol):\n" " def meth(self) -> int:\n" @@ -3403,13 +3631,13 @@ msgstr "" " def meth(self) -> int:\n" " ..." -#: ../../library/typing.rst:2146 +#: ../../library/typing.rst:2336 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:2149 +#: ../../library/typing.rst:2339 msgid "" "class C:\n" " def meth(self) -> int:\n" @@ -3421,7 +3649,7 @@ msgid "" "func(C()) # Passes static type check" msgstr "" -#: ../../library/typing.rst:2158 +#: ../../library/typing.rst:2348 msgid "" "See :pep:`544` for more details. Protocol classes decorated with :func:" "`runtime_checkable` (described later) act as simple-minded runtime protocols " @@ -3429,11 +3657,11 @@ msgid "" "signatures." msgstr "" -#: ../../library/typing.rst:2163 +#: ../../library/typing.rst:2353 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:2165 +#: ../../library/typing.rst:2355 msgid "" "class GenProto[T](Protocol):\n" " def meth(self) -> T:\n" @@ -3443,13 +3671,13 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2169 +#: ../../library/typing.rst:2359 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:2172 +#: ../../library/typing.rst:2362 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -3463,11 +3691,11 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2182 +#: ../../library/typing.rst:2372 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:2184 +#: ../../library/typing.rst:2374 msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " "This raises :exc:`TypeError` when applied to a non-protocol class. This " @@ -3476,7 +3704,7 @@ msgid "" "Iterable`. For example::" msgstr "" -#: ../../library/typing.rst:2189 +#: ../../library/typing.rst:2379 msgid "" "@runtime_checkable\n" "class Closable(Protocol):\n" @@ -3504,7 +3732,7 @@ msgstr "" "import threading\n" "assert isinstance(threading.Thread(name='Bob'), Named)" -#: ../../library/typing.rst:2204 +#: ../../library/typing.rst:2394 msgid "" ":func:`!runtime_checkable` will check only the presence of the required " "methods or attributes, not their type signatures or types. For example, :" @@ -3515,7 +3743,7 @@ msgid "" "(instantiate) :class:`ssl.SSLObject`." msgstr "" -#: ../../library/typing.rst:2215 +#: ../../library/typing.rst:2405 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" @@ -3523,7 +3751,7 @@ msgid "" "calls for structural checks in performance-sensitive code." msgstr "" -#: ../../library/typing.rst:2223 +#: ../../library/typing.rst:2413 msgid "" "The internal implementation of :func:`isinstance` checks against runtime-" "checkable protocols now uses :func:`inspect.getattr_static` to look up " @@ -3533,7 +3761,7 @@ msgid "" "versa. Most users are unlikely to be affected by this change." msgstr "" -#: ../../library/typing.rst:2232 +#: ../../library/typing.rst:2422 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 " @@ -3542,13 +3770,13 @@ msgid "" "`\"What's new in Python 3.12\" ` for more details." msgstr "" -#: ../../library/typing.rst:2243 +#: ../../library/typing.rst:2433 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: ../../library/typing.rst:2246 +#: ../../library/typing.rst:2436 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 " @@ -3556,7 +3784,7 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:2252 +#: ../../library/typing.rst:2442 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3569,43 +3797,24 @@ msgid "" "assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')" msgstr "" -#: ../../library/typing.rst:2262 +#: ../../library/typing.rst:2452 msgid "" -"To allow using this feature with older versions of Python that do not " -"support :pep:`526`, ``TypedDict`` supports two additional equivalent " -"syntactic forms:" +"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:2266 -msgid "Using a literal :class:`dict` as the second argument::" -msgstr "" - -#: ../../library/typing.rst:2268 +#: ../../library/typing.rst:2455 msgid "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" msgstr "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" -#: ../../library/typing.rst:2270 -msgid "Using keyword arguments::" -msgstr "" - -#: ../../library/typing.rst:2272 -msgid "Point2D = TypedDict('Point2D', x=int, y=int, label=str)" -msgstr "Point2D = TypedDict('Point2D', x=int, y=int, label=str)" - -#: ../../library/typing.rst:2274 -msgid "" -"The keyword-argument syntax is deprecated in 3.11 and will be removed in " -"3.13. It may also be unsupported by static type checkers." -msgstr "" - -#: ../../library/typing.rst:2278 +#: ../../library/typing.rst:2457 msgid "" -"The functional syntax should also be used when any of the keys are not " -"valid :ref:`identifiers `, for example because they are " -"keywords or contain hyphens. Example::" +"This functional syntax allows defining keys which are not valid :ref:" +"`identifiers `, for example because they are keywords or " +"contain hyphens::" msgstr "" -#: ../../library/typing.rst:2282 +#: ../../library/typing.rst:2461 msgid "" "# raises SyntaxError\n" "class Point2D(TypedDict):\n" @@ -3616,13 +3825,13 @@ msgid "" "Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})" msgstr "" -#: ../../library/typing.rst:2290 +#: ../../library/typing.rst:2469 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:2293 +#: ../../library/typing.rst:2472 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3634,19 +3843,19 @@ msgid "" "NotRequired[str]})" msgstr "" -#: ../../library/typing.rst:2301 +#: ../../library/typing.rst:2480 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." msgstr "" -#: ../../library/typing.rst:2304 +#: ../../library/typing.rst:2483 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" -#: ../../library/typing.rst:2307 +#: ../../library/typing.rst:2486 msgid "" "class Point2D(TypedDict, total=False):\n" " x: int\n" @@ -3656,7 +3865,7 @@ msgid "" "Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" msgstr "" -#: ../../library/typing.rst:2314 +#: ../../library/typing.rst:2493 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 " @@ -3664,13 +3873,13 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:2319 +#: ../../library/typing.rst:2498 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" -#: ../../library/typing.rst:2322 +#: ../../library/typing.rst:2501 msgid "" "class Point2D(TypedDict, total=False):\n" " x: Required[int]\n" @@ -3685,13 +3894,13 @@ msgid "" "}, total=False)" msgstr "" -#: ../../library/typing.rst:2334 +#: ../../library/typing.rst:2513 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:2338 +#: ../../library/typing.rst:2517 msgid "" "class Point3D(Point2D):\n" " z: int" @@ -3699,13 +3908,13 @@ msgstr "" "class Point3D(Point2D):\n" " z: int" -#: ../../library/typing.rst:2341 +#: ../../library/typing.rst:2520 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:2344 +#: ../../library/typing.rst:2523 msgid "" "class Point3D(TypedDict):\n" " x: int\n" @@ -3717,13 +3926,13 @@ msgstr "" " y: int\n" " z: int" -#: ../../library/typing.rst:2349 +#: ../../library/typing.rst:2528 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:2352 +#: ../../library/typing.rst:2531 msgid "" "class X(TypedDict):\n" " x: int\n" @@ -3738,11 +3947,11 @@ msgid "" "class XZ(X, Z): pass # raises TypeError" msgstr "" -#: ../../library/typing.rst:2364 +#: ../../library/typing.rst:2543 msgid "A ``TypedDict`` can be generic::" msgstr "" -#: ../../library/typing.rst:2366 +#: ../../library/typing.rst:2545 msgid "" "class Group[T](TypedDict):\n" " key: T\n" @@ -3752,13 +3961,13 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2370 +#: ../../library/typing.rst:2549 msgid "" "To create a generic ``TypedDict`` that is compatible with Python 3.11 or " "lower, inherit from :class:`Generic` explicitly:" msgstr "" -#: ../../library/typing.rst:2373 +#: ../../library/typing.rst:2552 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -3772,19 +3981,19 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2381 +#: ../../library/typing.rst:2560 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:2387 +#: ../../library/typing.rst:2566 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" -#: ../../library/typing.rst:2390 +#: ../../library/typing.rst:2569 msgid "" ">>> from typing import TypedDict\n" ">>> class Point2D(TypedDict): pass\n" @@ -3808,7 +4017,7 @@ msgstr "" ">>> Point3D.__total__\n" "True" -#: ../../library/typing.rst:2403 +#: ../../library/typing.rst:2582 msgid "" "This attribute reflects *only* the value of the ``total`` argument to the " "current ``TypedDict`` class, not whether the class is semantically total. " @@ -3819,21 +4028,21 @@ msgid "" "introspection." msgstr "" -#: ../../library/typing.rst:2416 +#: ../../library/typing.rst:2595 msgid "" "``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" "class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" -#: ../../library/typing.rst:2419 +#: ../../library/typing.rst:2598 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:2422 +#: ../../library/typing.rst:2601 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 " @@ -3842,7 +4051,7 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: ../../library/typing.rst:2429 +#: ../../library/typing.rst:2608 msgid "" ">>> class Point2D(TypedDict, total=False):\n" "... x: int\n" @@ -3868,7 +4077,7 @@ msgstr "" ">>> Point3D.__optional_keys__ == frozenset({'x', 'y'})\n" "True" -#: ../../library/typing.rst:2447 +#: ../../library/typing.rst:2626 msgid "" "If ``from __future__ import annotations`` is used or if annotations are " "given as strings, annotations are not evaluated when the ``TypedDict`` is " @@ -3877,121 +4086,157 @@ msgid "" "attributes may be incorrect." msgstr "" -#: ../../library/typing.rst:2453 +#: ../../library/typing.rst:2632 +msgid "Support for :data:`ReadOnly` is reflected in the following attributes:" +msgstr "" + +#: ../../library/typing.rst:2636 +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:2643 +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:2648 msgid "" "See :pep:`589` for more examples and detailed rules of using ``TypedDict``." msgstr "" -#: ../../library/typing.rst:2457 +#: ../../library/typing.rst:2652 msgid "" "Added support for marking individual keys as :data:`Required` or :data:" "`NotRequired`. See :pep:`655`." msgstr "" -#: ../../library/typing.rst:2461 +#: ../../library/typing.rst:2656 msgid "Added support for generic ``TypedDict``\\ s." msgstr "" -#: ../../library/typing.rst:2465 +#: ../../library/typing.rst:2659 +msgid "" +"Removed support for the keyword-argument method of creating ``TypedDict``\\ " +"s." +msgstr "" + +#: ../../library/typing.rst:2662 +msgid "Support for the :data:`ReadOnly` qualifier was added." +msgstr "" + +#: ../../library/typing.rst:2665 +msgid "" +"When using the functional syntax to create a TypedDict class, failing to " +"pass a value to the 'fields' parameter (``TD = TypedDict(\"TD\")``) is " +"deprecated. Passing ``None`` to the 'fields' parameter (``TD = " +"TypedDict(\"TD\", None)``) is also deprecated. Both will be disallowed in " +"Python 3.15. To create a TypedDict class with 0 fields, use ``class " +"TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." +msgstr "" + +#: ../../library/typing.rst:2674 msgid "Protocols" msgstr "協定" -#: ../../library/typing.rst:2467 +#: ../../library/typing.rst:2676 msgid "" "The following protocols are provided by the typing module. All are decorated " "with :func:`@runtime_checkable `." msgstr "" -#: ../../library/typing.rst:2472 +#: ../../library/typing.rst:2681 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:2477 +#: ../../library/typing.rst:2686 msgid "An ABC with one abstract method ``__bytes__``." msgstr "一個有抽象方法 ``__bytes__`` 的 ABC。" -#: ../../library/typing.rst:2481 +#: ../../library/typing.rst:2690 msgid "An ABC with one abstract method ``__complex__``." msgstr "一個有抽象方法 ``__complex__`` 的 ABC。" -#: ../../library/typing.rst:2485 +#: ../../library/typing.rst:2694 msgid "An ABC with one abstract method ``__float__``." msgstr "一個有抽象方法 ``__float__`` 的 ABC。" -#: ../../library/typing.rst:2489 +#: ../../library/typing.rst:2698 msgid "An ABC with one abstract method ``__index__``." msgstr "一個有抽象方法 ``__index__`` 的 ABC。" -#: ../../library/typing.rst:2495 +#: ../../library/typing.rst:2704 msgid "An ABC with one abstract method ``__int__``." msgstr "一個有抽象方法 ``__int__`` 的 ABC。" -#: ../../library/typing.rst:2499 +#: ../../library/typing.rst:2708 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2503 +#: ../../library/typing.rst:2712 msgid "ABCs for working with IO" msgstr "" -#: ../../library/typing.rst:2509 +#: ../../library/typing.rst:2718 msgid "" "Generic type ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " "by :func:`open`." msgstr "" -#: ../../library/typing.rst:2515 +#: ../../library/typing.rst:2724 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2519 +#: ../../library/typing.rst:2728 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2521 +#: ../../library/typing.rst:2730 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:2528 +#: ../../library/typing.rst:2737 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" -#: ../../library/typing.rst:2530 +#: ../../library/typing.rst:2739 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:2533 +#: ../../library/typing.rst:2742 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:2536 +#: ../../library/typing.rst:2745 msgid "" "def greet(name: str) -> None:\n" " assert_type(name, str) # OK, inferred type of `name` is `str`\n" " assert_type(name, int) # type checker error" msgstr "" -#: ../../library/typing.rst:2540 +#: ../../library/typing.rst:2749 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:2543 +#: ../../library/typing.rst:2752 msgid "" "def complex_function(arg: object):\n" " # Do some complex type-narrowing logic,\n" @@ -4001,16 +4246,16 @@ msgid "" " assert_type(arg, int)" msgstr "" -#: ../../library/typing.rst:2554 +#: ../../library/typing.rst:2763 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" -#: ../../library/typing.rst:2556 +#: ../../library/typing.rst:2765 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/typing.rst:2558 +#: ../../library/typing.rst:2767 msgid "" "def int_or_str(arg: int | str) -> None:\n" " match arg:\n" @@ -4030,14 +4275,14 @@ msgstr "" " case _ as unreachable:\n" " assert_never(unreachable)" -#: ../../library/typing.rst:2567 +#: ../../library/typing.rst:2776 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:2572 +#: ../../library/typing.rst:2781 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 " @@ -4047,47 +4292,47 @@ msgid "" "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" -#: ../../library/typing.rst:2580 +#: ../../library/typing.rst:2789 msgid "At runtime, this throws an exception when called." msgstr "" -#: ../../library/typing.rst:2583 +#: ../../library/typing.rst:2792 msgid "" "`Unreachable Code and Exhaustiveness Checking `__ has more information about " +"en/latest/source/unreachable.html>`__ has more information about " "exhaustiveness checking with static typing." msgstr "" -#: ../../library/typing.rst:2591 +#: ../../library/typing.rst:2800 msgid "Ask a static type checker to reveal the inferred type of an expression." msgstr "" -#: ../../library/typing.rst:2593 +#: ../../library/typing.rst:2802 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:2596 +#: ../../library/typing.rst:2805 msgid "" "x: int = 1\n" "reveal_type(x) # Revealed type is \"builtins.int\"" msgstr "" -#: ../../library/typing.rst:2599 +#: ../../library/typing.rst:2808 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" -#: ../../library/typing.rst:2602 +#: ../../library/typing.rst:2811 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:2606 +#: ../../library/typing.rst:2815 msgid "" "x = reveal_type(1) # prints \"Runtime type is int\"\n" "print(x) # prints \"1\"" @@ -4095,13 +4340,13 @@ msgstr "" "x = reveal_type(1) # 印出 \"Runtime type is int\"\n" "print(x) # 印出 \"1\"" -#: ../../library/typing.rst:2609 +#: ../../library/typing.rst:2818 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:2612 +#: ../../library/typing.rst:2821 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing``, however, " @@ -4109,13 +4354,13 @@ msgid "" "clearly." msgstr "" -#: ../../library/typing.rst:2623 +#: ../../library/typing.rst:2832 msgid "" "Decorator to mark an object as providing :func:`dataclass `-like behavior." msgstr "" -#: ../../library/typing.rst:2626 +#: ../../library/typing.rst:2835 msgid "" "``dataclass_transform`` may be used to decorate a class, metaclass, or a " "function that is itself a decorator. The presence of " @@ -4124,11 +4369,11 @@ msgid "" "to :func:`@dataclasses.dataclass `." msgstr "" -#: ../../library/typing.rst:2633 +#: ../../library/typing.rst:2842 msgid "Example usage with a decorator function:" msgstr "" -#: ../../library/typing.rst:2635 +#: ../../library/typing.rst:2844 msgid "" "@dataclass_transform()\n" "def create_model[T](cls: type[T]) -> type[T]:\n" @@ -4150,11 +4395,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2647 +#: ../../library/typing.rst:2856 msgid "On a base class::" msgstr "" -#: ../../library/typing.rst:2649 +#: ../../library/typing.rst:2858 msgid "" "@dataclass_transform()\n" "class ModelBase: ...\n" @@ -4170,11 +4415,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2656 +#: ../../library/typing.rst:2865 msgid "On a metaclass::" msgstr "" -#: ../../library/typing.rst:2658 +#: ../../library/typing.rst:2867 msgid "" "@dataclass_transform()\n" "class ModelMeta(type): ...\n" @@ -4194,7 +4439,7 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2667 +#: ../../library/typing.rst:2876 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " "similarly to classes created with :func:`@dataclasses.dataclass None:\n" @@ -4400,24 +4645,24 @@ msgid "" " ... # actual implementation goes here" msgstr "" -#: ../../library/typing.rst:2795 +#: ../../library/typing.rst:3004 msgid "" "See :pep:`484` for more details and comparison with other typing semantics." msgstr "" -#: ../../library/typing.rst:2797 +#: ../../library/typing.rst:3006 msgid "" "Overloaded functions can now be introspected at runtime using :func:" "`get_overloads`." msgstr "" -#: ../../library/typing.rst:2804 +#: ../../library/typing.rst:3013 msgid "" "Return a sequence of :func:`@overload `-decorated definitions for " "*func*." msgstr "" -#: ../../library/typing.rst:2807 +#: ../../library/typing.rst:3016 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " @@ -4427,32 +4672,32 @@ msgid "" "returns an empty sequence." msgstr "" -#: ../../library/typing.rst:2814 +#: ../../library/typing.rst:3023 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" -#: ../../library/typing.rst:2822 +#: ../../library/typing.rst:3031 msgid "Clear all registered overloads in the internal registry." msgstr "" -#: ../../library/typing.rst:2824 +#: ../../library/typing.rst:3033 msgid "This can be used to reclaim the memory used by the registry." msgstr "" -#: ../../library/typing.rst:2831 +#: ../../library/typing.rst:3040 msgid "Decorator to indicate final methods and final classes." msgstr "" -#: ../../library/typing.rst:2833 +#: ../../library/typing.rst:3042 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:2839 +#: ../../library/typing.rst:3048 msgid "" "class Base:\n" " @final\n" @@ -4469,7 +4714,7 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:2858 +#: ../../library/typing.rst:3067 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__\", " @@ -4479,11 +4724,11 @@ msgid "" "exception." msgstr "" -#: ../../library/typing.rst:2869 +#: ../../library/typing.rst:3078 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:2871 +#: ../../library/typing.rst:3080 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 " @@ -4491,34 +4736,40 @@ msgid "" "will ignore all annotations in a function or class with this decorator." msgstr "" -#: ../../library/typing.rst:2877 +#: ../../library/typing.rst:3086 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" -#: ../../library/typing.rst:2881 +#: ../../library/typing.rst:3090 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:2883 +#: ../../library/typing.rst:3092 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:2889 +#: ../../library/typing.rst:3095 +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:3101 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:2892 +#: ../../library/typing.rst:3104 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:2899 +#: ../../library/typing.rst:3111 msgid "" "class Base:\n" " def log_status(self) -> None:\n" @@ -4534,11 +4785,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:2914 +#: ../../library/typing.rst:3126 msgid "There is no runtime checking of this property." msgstr "" -#: ../../library/typing.rst:2916 +#: ../../library/typing.rst:3128 msgid "" "The decorator will attempt to set an ``__override__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, " @@ -4548,22 +4799,22 @@ msgid "" "without raising an exception." msgstr "" -#: ../../library/typing.rst:2923 +#: ../../library/typing.rst:3135 msgid "See :pep:`698` for more details." msgstr "更多細節請見 :pep:`698`。" -#: ../../library/typing.rst:2930 +#: ../../library/typing.rst:3142 msgid "Decorator to mark a class or function as unavailable at runtime." msgstr "" -#: ../../library/typing.rst:2932 +#: ../../library/typing.rst:3144 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:2936 +#: ../../library/typing.rst:3148 msgid "" "@type_check_only\n" "class Response: # private or not available at runtime\n" @@ -4573,29 +4824,29 @@ msgid "" "def fetch_response() -> Response: ..." msgstr "" -#: ../../library/typing.rst:2943 +#: ../../library/typing.rst:3155 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:2947 +#: ../../library/typing.rst:3159 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:2951 +#: ../../library/typing.rst:3163 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: ../../library/typing.rst:2954 +#: ../../library/typing.rst:3166 msgid "" "This is often the same as ``obj.__annotations__``, but this function makes " "the following changes to the annotations dictionary:" msgstr "" -#: ../../library/typing.rst:2957 +#: ../../library/typing.rst:3169 msgid "" "Forward references encoded as string literals or :class:`ForwardRef` objects " "are handled by evaluating them in *globalns*, *localns*, and (where " @@ -4604,17 +4855,17 @@ msgid "" "inferred from *obj*." msgstr "" -#: ../../library/typing.rst:2962 +#: ../../library/typing.rst:3174 msgid "``None`` is replaced with :class:`types.NoneType`." msgstr "" -#: ../../library/typing.rst:2963 +#: ../../library/typing.rst:3175 msgid "" "If :func:`@no_type_check ` has been applied to *obj*, an " "empty dictionary is returned." msgstr "" -#: ../../library/typing.rst:2965 +#: ../../library/typing.rst:3177 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 " @@ -4624,20 +4875,20 @@ msgid "" "annotations on classes appearing later in the method resolution order." msgstr "" -#: ../../library/typing.rst:2971 +#: ../../library/typing.rst:3183 msgid "" "The function recursively replaces all occurrences of ``Annotated[T, ...]`` " "with ``T``, unless *include_extras* is set to ``True`` (see :class:" "`Annotated` for more information)." msgstr "" -#: ../../library/typing.rst:2975 +#: ../../library/typing.rst:3187 msgid "" "See also :func:`inspect.get_annotations`, a lower-level function that " "returns annotations more directly." msgstr "" -#: ../../library/typing.rst:2980 +#: ../../library/typing.rst:3192 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 :" @@ -4646,7 +4897,7 @@ msgid "" "imported under :data:`if TYPE_CHECKING `." msgstr "" -#: ../../library/typing.rst:2986 +#: ../../library/typing.rst:3198 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." @@ -4654,20 +4905,20 @@ msgstr "" "新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" "`Annotated` 的文件。" -#: ../../library/typing.rst:2990 +#: ../../library/typing.rst:3202 msgid "" "Previously, ``Optional[t]`` was added for function and method annotations if " "a default value equal to ``None`` was set. Now the annotation is returned " "unchanged." msgstr "" -#: ../../library/typing.rst:2997 +#: ../../library/typing.rst:3209 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:3000 +#: ../../library/typing.rst:3212 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 :" @@ -4675,11 +4926,11 @@ msgid "" "class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:3006 ../../library/typing.rst:3029 +#: ../../library/typing.rst:3218 ../../library/typing.rst:3241 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:3008 +#: ../../library/typing.rst:3220 msgid "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" @@ -4695,13 +4946,13 @@ msgstr "" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" -#: ../../library/typing.rst:3021 +#: ../../library/typing.rst:3233 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:3024 +#: ../../library/typing.rst:3236 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 " @@ -4709,7 +4960,7 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:3031 +#: ../../library/typing.rst:3243 msgid "" "assert get_args(int) == ()\n" "assert get_args(Dict[int, str]) == (int, str)\n" @@ -4719,11 +4970,44 @@ msgstr "" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" -#: ../../library/typing.rst:3041 +#: ../../library/typing.rst:3253 +msgid "Return the set of members defined in a :class:`Protocol`." +msgstr "" + +#: ../../library/typing.rst:3255 +msgid "" +">>> from typing import Protocol, get_protocol_members\n" +">>> class P(Protocol):\n" +"... def a(self) -> str: ...\n" +"... b: int\n" +">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" +"True" +msgstr "" + +#: ../../library/typing.rst:3264 +msgid "Raise :exc:`TypeError` for arguments that are not Protocols." +msgstr "" + +#: ../../library/typing.rst:3270 +#, fuzzy +msgid "Determine if a type is a :class:`Protocol`." +msgstr "棄用 :class:`tuple` 的別名。" + +#: ../../library/typing.rst:3274 +msgid "" +"class P(Protocol):\n" +" def a(self) -> str: ...\n" +" b: int\n" +"\n" +"is_protocol(P) # => True\n" +"is_protocol(int) # => False" +msgstr "" + +#: ../../library/typing.rst:3285 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:3045 +#: ../../library/typing.rst:3289 msgid "" "class Film(TypedDict):\n" " title: str\n" @@ -4737,36 +5021,52 @@ msgid "" "assert not is_typeddict(TypedDict)" msgstr "" -#: ../../library/typing.rst:3062 +#: ../../library/typing.rst:3306 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:3064 +#: ../../library/typing.rst:3308 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. ``ForwardRef`` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:3069 +#: ../../library/typing.rst:3313 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:3076 +#: ../../library/typing.rst:3321 +msgid "" +"A sentinel object used to indicate that a type parameter has no default " +"value. For example:" +msgstr "" + +#: ../../library/typing.rst:3324 +msgid "" +">>> T = TypeVar(\"T\")\n" +">>> T.__default__ is typing.NoDefault\n" +"True\n" +">>> S = TypeVar(\"S\", default=None)\n" +">>> S.__default__ is None\n" +"True" +msgstr "" + +#: ../../library/typing.rst:3336 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:3080 +#: ../../library/typing.rst:3340 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It is ``False`` at runtime." msgstr "" -#: ../../library/typing.rst:3085 +#: ../../library/typing.rst:3345 msgid "" "if TYPE_CHECKING:\n" " import expensive_mod\n" @@ -4780,7 +5080,7 @@ msgstr "" "def fun(arg: 'expensive_mod.SomeType') -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" -#: ../../library/typing.rst:3091 +#: ../../library/typing.rst:3351 msgid "" "The first type annotation must be enclosed in quotes, making it a \"forward " "reference\", to hide the ``expensive_mod`` reference from the interpreter " @@ -4788,7 +5088,7 @@ msgid "" "second annotation does not need to be enclosed in quotes." msgstr "" -#: ../../library/typing.rst:3098 +#: ../../library/typing.rst:3358 msgid "" "If ``from __future__ import annotations`` is used, annotations are not " "evaluated at function definition time. Instead, they are stored as strings " @@ -4796,11 +5096,11 @@ msgid "" "annotation (see :pep:`563`)." msgstr "" -#: ../../library/typing.rst:3110 +#: ../../library/typing.rst:3370 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:3112 +#: ../../library/typing.rst:3372 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the typing module in " @@ -4809,7 +5109,7 @@ msgid "" "existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:3119 +#: ../../library/typing.rst:3379 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 " @@ -4817,7 +5117,7 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:3124 +#: ../../library/typing.rst:3384 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 " @@ -4825,38 +5125,38 @@ msgid "" "typing module without deprecation warnings until at least Python 3.14." msgstr "" -#: ../../library/typing.rst:3129 +#: ../../library/typing.rst:3389 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:3135 +#: ../../library/typing.rst:3395 msgid "Aliases to built-in types" msgstr "內建型別的別名" -#: ../../library/typing.rst:3139 +#: ../../library/typing.rst:3399 msgid "Deprecated alias to :class:`dict`." msgstr "棄用 :class:`dict` 的別名。" -#: ../../library/typing.rst:3141 +#: ../../library/typing.rst:3401 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:3145 +#: ../../library/typing.rst:3405 msgid "" ":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3151 +#: ../../library/typing.rst:3411 msgid "Deprecated alias to :class:`list`." msgstr "棄用 :class:`list` 的別名。" -#: ../../library/typing.rst:3153 +#: ../../library/typing.rst:3413 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Sequence` or :class:" @@ -4864,142 +5164,136 @@ msgid "" "typing.List`." msgstr "" -#: ../../library/typing.rst:3158 +#: ../../library/typing.rst:3418 msgid "" ":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3164 +#: ../../library/typing.rst:3424 msgid "Deprecated alias to :class:`builtins.set `." msgstr "棄用 :class:`builtins.set ` 的別名。" -#: ../../library/typing.rst:3166 +#: ../../library/typing.rst:3426 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:3170 +#: ../../library/typing.rst:3430 msgid "" ":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3176 +#: ../../library/typing.rst:3436 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "棄用 :class:`builtins.frozenset ` 的別名。" -#: ../../library/typing.rst:3178 +#: ../../library/typing.rst:3438 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3185 +#: ../../library/typing.rst:3445 msgid "Deprecated alias for :class:`tuple`." msgstr "棄用 :class:`tuple` 的別名。" -#: ../../library/typing.rst:3187 +#: ../../library/typing.rst:3447 msgid "" ":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" "`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:3190 +#: ../../library/typing.rst:3450 msgid "" ":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3196 +#: ../../library/typing.rst:3456 msgid "Deprecated alias to :class:`type`." msgstr "棄用 :class:`type` 的別名。" -#: ../../library/typing.rst:3198 +#: ../../library/typing.rst:3458 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:3203 +#: ../../library/typing.rst:3463 msgid "" ":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3210 +#: ../../library/typing.rst:3470 msgid "Aliases to types in :mod:`collections`" msgstr ":mod:`collections` 中型別的別名" -#: ../../library/typing.rst:3214 +#: ../../library/typing.rst:3474 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "棄用 :class:`collections.defaultdict` 的別名。" -#: ../../library/typing.rst:3218 +#: ../../library/typing.rst:3478 msgid "" ":class:`collections.defaultdict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3224 +#: ../../library/typing.rst:3484 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "棄用 :class:`collections.OrderedDict` 的別名。" -#: ../../library/typing.rst:3228 +#: ../../library/typing.rst:3488 msgid "" ":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3234 +#: ../../library/typing.rst:3494 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "棄用 :class:`collections.ChainMap` 的別名。" -#: ../../library/typing.rst:3238 +#: ../../library/typing.rst:3498 msgid "" ":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3244 +#: ../../library/typing.rst:3504 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "棄用 :class:`collections.Counter` 的別名。" -#: ../../library/typing.rst:3248 +#: ../../library/typing.rst:3508 msgid "" ":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3254 +#: ../../library/typing.rst:3514 msgid "Deprecated alias to :class:`collections.deque`." msgstr "棄用 :class:`collections.deque` 的別名。" -#: ../../library/typing.rst:3258 +#: ../../library/typing.rst:3518 msgid "" ":class:`collections.deque` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3265 +#: ../../library/typing.rst:3525 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:3267 -msgid "" -"The ``typing.io`` namespace is deprecated and will be removed. These types " -"should be directly imported from ``typing`` instead." -msgstr "" - -#: ../../library/typing.rst:3274 +#: ../../library/typing.rst:3530 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3277 +#: ../../library/typing.rst:3533 msgid "" "These types (and the corresponding functions) are generic over :data:" "`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " @@ -5007,361 +5301,387 @@ msgid "" "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:3282 -msgid "" -"The ``typing.re`` namespace is deprecated and will be removed. These types " -"should be directly imported from ``typing`` instead." -msgstr "" - -#: ../../library/typing.rst:3286 +#: ../../library/typing.rst:3538 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3292 +#: ../../library/typing.rst:3544 msgid "Deprecated alias for :class:`str`." msgstr "棄用 :class:`str` 的別名。" -#: ../../library/typing.rst:3294 +#: ../../library/typing.rst:3546 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:3298 +#: ../../library/typing.rst:3550 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:3301 +#: ../../library/typing.rst:3553 msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" msgstr "" -#: ../../library/typing.rst:3306 +#: ../../library/typing.rst:3558 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:3316 +#: ../../library/typing.rst:3568 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中容器 ABC 的別名" -#: ../../library/typing.rst:3320 +#: ../../library/typing.rst:3572 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "棄用 :class:`collections.abc.Set` 的別名。" -#: ../../library/typing.rst:3322 +#: ../../library/typing.rst:3574 msgid "" ":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3328 +#: ../../library/typing.rst:3580 msgid "" "This type represents the types :class:`bytes`, :class:`bytearray`, and :" "class:`memoryview` of byte sequences." msgstr "" -#: ../../library/typing.rst:3331 +#: ../../library/typing.rst:3583 msgid "" "Prefer :class:`collections.abc.Buffer`, or a union like ``bytes | bytearray " "| memoryview``." msgstr "" -#: ../../library/typing.rst:3336 +#: ../../library/typing.rst:3588 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "棄用 :class:`collections.abc.Collection` 的別名。" -#: ../../library/typing.rst:3340 +#: ../../library/typing.rst:3592 msgid "" ":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3346 +#: ../../library/typing.rst:3598 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "棄用 :class:`collections.abc.Container` 的別名。" -#: ../../library/typing.rst:3348 +#: ../../library/typing.rst:3600 msgid "" ":class:`collections.abc.Container` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3354 +#: ../../library/typing.rst:3606 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "棄用 :class:`collections.abc.ItemsView` 的別名。" -#: ../../library/typing.rst:3356 +#: ../../library/typing.rst:3608 msgid "" ":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3362 +#: ../../library/typing.rst:3614 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "棄用 :class:`collections.abc.KeysView` 的別名。" -#: ../../library/typing.rst:3364 +#: ../../library/typing.rst:3616 msgid "" ":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3370 +#: ../../library/typing.rst:3622 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "棄用 :class:`collections.abc.Mapping` 的別名。" -#: ../../library/typing.rst:3372 +#: ../../library/typing.rst:3624 msgid "" ":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3378 +#: ../../library/typing.rst:3630 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "棄用 :class:`collections.abc.MappingView` 的別名。" -#: ../../library/typing.rst:3380 +#: ../../library/typing.rst:3632 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3386 +#: ../../library/typing.rst:3638 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "棄用 :class:`collections.abc.MutableMapping` 的別名。" -#: ../../library/typing.rst:3388 +#: ../../library/typing.rst:3640 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3395 +#: ../../library/typing.rst:3647 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "棄用 :class:`collections.abc.MutableSequence` 的別名。" -#: ../../library/typing.rst:3397 +#: ../../library/typing.rst:3649 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3404 +#: ../../library/typing.rst:3656 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "棄用 :class:`collections.abc.MutableSet` 的別名。" -#: ../../library/typing.rst:3406 +#: ../../library/typing.rst:3658 msgid "" ":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3412 +#: ../../library/typing.rst:3664 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "棄用 :class:`collections.abc.Sequence` 的別名。" -#: ../../library/typing.rst:3414 +#: ../../library/typing.rst:3666 msgid "" ":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3420 +#: ../../library/typing.rst:3672 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "棄用 :class:`collections.abc.ValuesView` 的別名。" -#: ../../library/typing.rst:3422 +#: ../../library/typing.rst:3674 msgid "" ":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3429 +#: ../../library/typing.rst:3681 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3433 +#: ../../library/typing.rst:3685 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "棄用 :class:`collections.abc.Coroutine` 的別名。" -#: ../../library/typing.rst:3435 +#: ../../library/typing.rst:3687 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:3441 +#: ../../library/typing.rst:3693 msgid "" ":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3447 +#: ../../library/typing.rst:3699 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "棄用 :class:`collections.abc.AsyncGenerator` 的別名。" -#: ../../library/typing.rst:3449 +#: ../../library/typing.rst:3701 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:3455 +#: ../../library/typing.rst:3707 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3462 +#: ../../library/typing.rst:3712 +msgid "The ``SendType`` parameter now has a default." +msgstr "" + +#: ../../library/typing.rst:3717 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "棄用 :class:`collections.abc.AsyncIterable` 的別名。" -#: ../../library/typing.rst:3466 +#: ../../library/typing.rst:3721 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3472 +#: ../../library/typing.rst:3727 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "棄用 :class:`collections.abc.AsyncIterator` 的別名。" -#: ../../library/typing.rst:3476 +#: ../../library/typing.rst:3731 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3482 +#: ../../library/typing.rst:3737 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "棄用 :class:`collections.abc.Awaitable` 的別名。" -#: ../../library/typing.rst:3486 +#: ../../library/typing.rst:3741 msgid "" ":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3493 +#: ../../library/typing.rst:3748 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3497 +#: ../../library/typing.rst:3752 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "棄用 :class:`collections.abc.Iterable` 的別名。" -#: ../../library/typing.rst:3499 +#: ../../library/typing.rst:3754 msgid "" ":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3505 +#: ../../library/typing.rst:3760 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "棄用 :class:`collections.abc.Iterator` 的別名。" -#: ../../library/typing.rst:3507 +#: ../../library/typing.rst:3762 msgid "" ":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3513 +#: ../../library/typing.rst:3768 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "棄用 :class:`collections.abc.Callable` 的別名。" -#: ../../library/typing.rst:3515 +#: ../../library/typing.rst:3770 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:3518 +#: ../../library/typing.rst:3773 msgid "" ":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3528 +#: ../../library/typing.rst:3783 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "棄用 :class:`collections.abc.Generator` 的別名。" -#: ../../library/typing.rst:3530 +#: ../../library/typing.rst:3785 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:3534 +#: ../../library/typing.rst:3789 msgid "" ":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3540 +#: ../../library/typing.rst:3793 +msgid "Default values for the send and return types were added." +msgstr "" + +#: ../../library/typing.rst:3798 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "棄用 :class:`collections.abc.Hashable` 的別名。" -#: ../../library/typing.rst:3542 +#: ../../library/typing.rst:3800 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "改為直接使用 :class:`collections.abc.Hashable`。" -#: ../../library/typing.rst:3547 +#: ../../library/typing.rst:3805 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "棄用 :class:`collections.abc.Reversible` 的別名。" -#: ../../library/typing.rst:3549 +#: ../../library/typing.rst:3807 msgid "" ":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3555 +#: ../../library/typing.rst:3813 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "棄用 :class:`collections.abc.Sized` 的別名。" -#: ../../library/typing.rst:3557 +#: ../../library/typing.rst:3815 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "改為直接使用 :class:`collections.abc.Sized`。" -#: ../../library/typing.rst:3563 +#: ../../library/typing.rst:3821 msgid "Aliases to :mod:`contextlib` ABCs" msgstr ":mod:`contextlib` ABC 的別名" -#: ../../library/typing.rst:3567 +#: ../../library/typing.rst:3825 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:3571 +#: ../../library/typing.rst:3827 +msgid "" +"The first type parameter, ``T_co``, represents the type returned by the :" +"meth:`~object.__enter__` method. The optional second type parameter, " +"``ExitT_co``, which defaults to ``bool | None``, represents the type " +"returned by the :meth:`~object.__exit__` method." +msgstr "" + +#: ../../library/typing.rst:3834 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3578 +#: ../../library/typing.rst:3839 +msgid "Added the optional second type parameter, ``ExitT_co``." +msgstr "" + +#: ../../library/typing.rst:3844 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:3582 +#: ../../library/typing.rst:3846 +msgid "" +"The first type parameter, ``T_co``, represents the type returned by the :" +"meth:`~object.__aenter__` method. The optional second type parameter, " +"``AExitT_co``, which defaults to ``bool | None``, represents the type " +"returned by the :meth:`~object.__aexit__` method." +msgstr "" + +#: ../../library/typing.rst:3853 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3588 +#: ../../library/typing.rst:3858 +msgid "Added the optional second type parameter, ``AExitT_co``." +msgstr "" + +#: ../../library/typing.rst:3862 msgid "Deprecation Timeline of Major Features" msgstr "" -#: ../../library/typing.rst:3590 +#: ../../library/typing.rst:3864 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -5369,103 +5689,130 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:3597 +#: ../../library/typing.rst:3871 msgid "Feature" msgstr "" -#: ../../library/typing.rst:3598 +#: ../../library/typing.rst:3872 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:3599 +#: ../../library/typing.rst:3873 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:3600 +#: ../../library/typing.rst:3874 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:3601 -msgid "``typing.io`` and ``typing.re`` submodules" -msgstr "``typing.io`` 和 ``typing.re`` 子模組" - -#: ../../library/typing.rst:3602 -msgid "3.8" -msgstr "3.8" - -#: ../../library/typing.rst:3603 -msgid "3.13" -msgstr "3.13" - -#: ../../library/typing.rst:3604 -msgid ":issue:`38291`" -msgstr ":issue:`38291`" - -#: ../../library/typing.rst:3605 +#: ../../library/typing.rst:3875 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:3606 ../../library/typing.rst:3610 +#: ../../library/typing.rst:3876 ../../library/typing.rst:3880 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:3607 +#: ../../library/typing.rst:3877 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:3608 +#: ../../library/typing.rst:3878 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:3609 +#: ../../library/typing.rst:3879 msgid ":class:`typing.ByteString`" msgstr ":class:`typing.ByteString`" -#: ../../library/typing.rst:3611 +#: ../../library/typing.rst:3881 msgid "3.14" msgstr "3.14" -#: ../../library/typing.rst:3612 +#: ../../library/typing.rst:3882 msgid ":gh:`91896`" msgstr ":gh:`91896`" -#: ../../library/typing.rst:3613 +#: ../../library/typing.rst:3883 msgid ":data:`typing.Text`" msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:3614 +#: ../../library/typing.rst:3884 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:3615 ../../library/typing.rst:3619 -#: ../../library/typing.rst:3623 +#: ../../library/typing.rst:3885 ../../library/typing.rst:3889 +#: ../../library/typing.rst:3893 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:3616 +#: ../../library/typing.rst:3886 msgid ":gh:`92332`" msgstr ":gh:`92332`" -#: ../../library/typing.rst:3617 +#: ../../library/typing.rst:3887 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" -#: ../../library/typing.rst:3618 ../../library/typing.rst:3622 +#: ../../library/typing.rst:3888 ../../library/typing.rst:3892 msgid "3.12" msgstr "" -#: ../../library/typing.rst:3620 +#: ../../library/typing.rst:3890 msgid ":gh:`94309`" msgstr ":gh:`94309`" -#: ../../library/typing.rst:3621 +#: ../../library/typing.rst:3891 msgid ":data:`typing.TypeAlias`" msgstr ":data:`typing.TypeAlias`" -#: ../../library/typing.rst:3624 +#: ../../library/typing.rst:3894 msgid ":pep:`695`" msgstr ":pep:`695`" +#: ../../library/typing.rst:3895 +msgid ":func:`@typing.no_type_check_decorator `" +msgstr "" + +#: ../../library/typing.rst:3896 ../../library/typing.rst:3900 +msgid "3.13" +msgstr "3.13" + +#: ../../library/typing.rst:3897 +msgid "3.15" +msgstr "" + +#: ../../library/typing.rst:3898 +#, fuzzy +msgid ":gh:`106309`" +msgstr ":gh:`94309`" + +#: ../../library/typing.rst:3899 +#, fuzzy +msgid ":data:`typing.AnyStr`" +msgstr ":data:`typing.Text`" + +#: ../../library/typing.rst:3901 +msgid "3.18" +msgstr "" + +#: ../../library/typing.rst:3902 +#, fuzzy +msgid ":gh:`105578`" +msgstr ":gh:`91896`" + +#~ msgid "Point2D = TypedDict('Point2D', x=int, y=int, label=str)" +#~ msgstr "Point2D = TypedDict('Point2D', x=int, y=int, label=str)" + +#~ msgid "``typing.io`` and ``typing.re`` submodules" +#~ msgstr "``typing.io`` 和 ``typing.re`` 子模組" + +#~ msgid "3.8" +#~ msgstr "3.8" + +#~ msgid ":issue:`38291`" +#~ msgstr ":issue:`38291`" + #~ msgid "" #~ "On older Python versions, :data:`NoReturn` may be used to express the " #~ "same concept. ``Never`` was added to make the intended meaning more " diff --git a/library/unicodedata.po b/library/unicodedata.po index 7905b56fa6..2e2e5479be 100644 --- a/library/unicodedata.po +++ b/library/unicodedata.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -26,8 +26,8 @@ msgstr ":mod:`!unicodedata` --- Unicode 資料庫" msgid "" "This module provides access to the Unicode Character Database (UCD) which " "defines character properties for all Unicode characters. The data contained " -"in this database is compiled from the `UCD version 15.0.0 `_." +"in this database is compiled from the `UCD version 15.1.0 `_." msgstr "" #: ../../library/unicodedata.rst:23 @@ -188,11 +188,13 @@ msgid "Footnotes" msgstr "註解" #: ../../library/unicodedata.rst:178 -msgid "https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt" +#, fuzzy +msgid "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" msgstr "https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt" #: ../../library/unicodedata.rst:180 -msgid "https://www.unicode.org/Public/15.0.0/ucd/NamedSequences.txt" +#, fuzzy +msgid "https://www.unicode.org/Public/15.1.0/ucd/NamedSequences.txt" msgstr "https://www.unicode.org/Public/15.0.0/ucd/NamedSequences.txt" #: ../../library/unicodedata.rst:11 diff --git a/library/unittest.mock-examples.po b/library/unittest.mock-examples.po index 5dd01545b7..1b709b5160 100644 --- a/library/unittest.mock-examples.po +++ b/library/unittest.mock-examples.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-05-06 08:22+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1154,7 +1154,7 @@ msgstr "" "如果你的 mock 只被呼叫一次,你可以使用 :meth:`~Mock.assert_called_once_with` " "方法,其也斷言 :attr:`~Mock.call_count` 是1。" -#: ../../library/unittest.mock-examples.rst:803 +#: ../../library/unittest.mock-examples.rst:804 msgid "" "Both ``assert_called_with`` and ``assert_called_once_with`` make assertions " "about the *most recent* call. If your mock is going to be called several " @@ -1165,7 +1165,7 @@ msgstr "" "呼叫做出斷言。如果你的 mock 將被多次呼叫,並且你想要對\\ *所有*\\ 這些呼叫進" "行斷言,你可以使用 :attr:`~Mock.call_args_list`:" -#: ../../library/unittest.mock-examples.rst:815 +#: ../../library/unittest.mock-examples.rst:816 msgid "" "The :data:`call` helper makes it easy to make assertions about these calls. " "You can build up a list of expected calls and compare it to " @@ -1176,11 +1176,11 @@ msgstr "" "將其與 ``call_args_list`` 進行比較。這看起來與 ``call_args_list`` 的 repr 非" "常相似:" -#: ../../library/unittest.mock-examples.rst:825 +#: ../../library/unittest.mock-examples.rst:826 msgid "Coping with mutable arguments" msgstr "應對可變引數" -#: ../../library/unittest.mock-examples.rst:827 +#: ../../library/unittest.mock-examples.rst:828 msgid "" "Another situation is rare, but can bite you, is when your mock is called " "with mutable arguments. ``call_args`` and ``call_args_list`` store " @@ -1192,13 +1192,13 @@ msgstr "" "``call_args`` 和 ``call_args_list`` 儲存對引數的\\ *參照*。如果引數被測試中的" "程式碼改變,那麼你將無法再對 mock 被呼叫時的值進行斷言。" -#: ../../library/unittest.mock-examples.rst:832 +#: ../../library/unittest.mock-examples.rst:833 msgid "" "Here's some example code that shows the problem. Imagine the following " "functions defined in 'mymodule'::" msgstr "這是一些秀出問題的程式碼範例。 想像 'mymodule' 中定義以下函式: ::" -#: ../../library/unittest.mock-examples.rst:835 +#: ../../library/unittest.mock-examples.rst:836 msgid "" "def frob(val):\n" " pass\n" @@ -1209,14 +1209,14 @@ msgid "" " val.clear()" msgstr "" -#: ../../library/unittest.mock-examples.rst:843 +#: ../../library/unittest.mock-examples.rst:844 msgid "" "When we try to test that ``grob`` calls ``frob`` with the correct argument " "look what happens::" msgstr "" "當我們嘗試測試 ``grob`` 使用正確的引數呼叫 ``frob`` 時,看看會發生什麼: ::" -#: ../../library/unittest.mock-examples.rst:846 +#: ../../library/unittest.mock-examples.rst:847 msgid "" ">>> with patch('mymodule.frob') as mock_frob:\n" "... val = {6}\n" @@ -1242,7 +1242,7 @@ msgstr "" "AssertionError: Expected: (({6},), {})\n" "Called with: ((set(),), {})" -#: ../../library/unittest.mock-examples.rst:858 +#: ../../library/unittest.mock-examples.rst:859 msgid "" "One possibility would be for mock to copy the arguments you pass in. This " "could then cause problems if you do assertions that rely on object identity " @@ -1251,7 +1251,7 @@ msgstr "" "一種可能是讓 mock 複製你傳入的引數。如果你進行的斷言依賴於物件識別性來確定相" "等性,這就可能導致問題。" -#: ../../library/unittest.mock-examples.rst:862 +#: ../../library/unittest.mock-examples.rst:863 msgid "" "Here's one solution that uses the :attr:`~Mock.side_effect` functionality. " "If you provide a ``side_effect`` function for a mock then ``side_effect`` " @@ -1267,7 +1267,7 @@ msgstr "" "* mock 來儲存引數,以便我們可以使用 mock 方法來執行斷言。同樣的,有一個輔助函" "式為我們設定了這些。: ::" -#: ../../library/unittest.mock-examples.rst:870 +#: ../../library/unittest.mock-examples.rst:871 msgid "" ">>> from copy import deepcopy\n" ">>> from unittest.mock import Mock, patch, DEFAULT\n" @@ -1311,7 +1311,7 @@ msgstr "" ">>> new_mock.call_args\n" "call({6})" -#: ../../library/unittest.mock-examples.rst:891 +#: ../../library/unittest.mock-examples.rst:892 msgid "" "``copy_call_args`` is called with the mock that will be called. It returns a " "new mock that we do the assertion on. The ``side_effect`` function makes a " @@ -1321,7 +1321,7 @@ msgstr "" "言的新的 mock。``side_effect`` 函式建立引數們的副本,並用該副本呼叫我們的 " "``new_mock``。" -#: ../../library/unittest.mock-examples.rst:897 +#: ../../library/unittest.mock-examples.rst:898 msgid "" "If your mock is only going to be used once there is an easier way of " "checking arguments at the point they are called. You can simply do the " @@ -1330,7 +1330,7 @@ msgstr "" "如果你的 mock 只會被使用一次,則有一種更簡單的方法可以在呼叫引數時檢查它們。" "你可以簡單地在 ``side_effect`` 函式內進行檢查。" -#: ../../library/unittest.mock-examples.rst:911 +#: ../../library/unittest.mock-examples.rst:912 msgid "" "An alternative approach is to create a subclass of :class:`Mock` or :class:" "`MagicMock` that copies (using :func:`copy.deepcopy`) the arguments. Here's " @@ -1339,7 +1339,7 @@ msgstr "" "另一種方法是建立 :class:`Mock` 或 :class:`MagicMock` 的子類別來複製(使用 :" "func:`copy.deepcopy`\\ )引數。這是一個實作的例子:" -#: ../../library/unittest.mock-examples.rst:935 +#: ../../library/unittest.mock-examples.rst:937 msgid "" "When you subclass ``Mock`` or ``MagicMock`` all dynamically created " "attributes, and the ``return_value`` will use your subclass automatically. " @@ -1350,11 +1350,11 @@ msgstr "" "``return_value`` 會自動使用你的子類別。這代表著 ``CopyingMock`` 的所有子代 " "(child) 也會具有 ``CopyingMock`` 型別。" -#: ../../library/unittest.mock-examples.rst:941 +#: ../../library/unittest.mock-examples.rst:943 msgid "Nesting Patches" msgstr "巢狀使用 Patch" -#: ../../library/unittest.mock-examples.rst:943 +#: ../../library/unittest.mock-examples.rst:945 msgid "" "Using patch as a context manager is nice, but if you do multiple patches you " "can end up with nested with statements indenting further and further to the " @@ -1363,7 +1363,7 @@ msgstr "" "將 patch 作為情境管理器使用很好,但是如果你使用複數個 patch,你最終可能會得到" "巢狀的 with 陳述式,並且越來越向右縮排: ::" -#: ../../library/unittest.mock-examples.rst:947 +#: ../../library/unittest.mock-examples.rst:949 msgid "" ">>> class MyTest(unittest.TestCase):\n" "...\n" @@ -1393,7 +1393,7 @@ msgstr "" ">>> MyTest('test_foo').test_foo()\n" ">>> assert mymodule.Foo is original" -#: ../../library/unittest.mock-examples.rst:961 +#: ../../library/unittest.mock-examples.rst:963 msgid "" "With unittest ``cleanup`` functions and the :ref:`start-and-stop` we can " "achieve the same effect without the nested indentation. A simple helper " @@ -1404,7 +1404,7 @@ msgstr "" "同的效果,而不會出現因巢狀導致的縮排。一個簡單的輔助方法 ``create_patch`` 會" "將 patch 放置到位並為我們回傳被建立的 mock: ::" -#: ../../library/unittest.mock-examples.rst:966 +#: ../../library/unittest.mock-examples.rst:968 msgid "" ">>> class MyTest(unittest.TestCase):\n" "...\n" @@ -1448,11 +1448,11 @@ msgstr "" ">>> MyTest('test_foo').run()\n" ">>> assert mymodule.Foo is original" -#: ../../library/unittest.mock-examples.rst:989 +#: ../../library/unittest.mock-examples.rst:991 msgid "Mocking a dictionary with MagicMock" msgstr "使用 MagicMock 來 mock 字典" -#: ../../library/unittest.mock-examples.rst:991 +#: ../../library/unittest.mock-examples.rst:993 msgid "" "You may want to mock a dictionary, or other container object, recording all " "access to it whilst having it still behave like a dictionary." @@ -1460,7 +1460,7 @@ msgstr "" "你可能會想要 mock 字典或其他容器物件,記錄對它的所有存取,同時讓它仍然像字典" "一樣運作。" -#: ../../library/unittest.mock-examples.rst:994 +#: ../../library/unittest.mock-examples.rst:996 msgid "" "We can do this with :class:`MagicMock`, which will behave like a dictionary, " "and using :data:`~Mock.side_effect` to delegate dictionary access to a real " @@ -1469,7 +1469,7 @@ msgstr "" "我們可以使用 :class:`MagicMock` 來做到這一點,它的行為會與字典一致,並使用 :" "data:`~Mock.side_effect` 將字典存取委託給我們控制下的真實底層字典。" -#: ../../library/unittest.mock-examples.rst:998 +#: ../../library/unittest.mock-examples.rst:1000 msgid "" "When the :meth:`~object.__getitem__` and :meth:`~object.__setitem__` methods " "of our ``MagicMock`` are called (normal dictionary access) then " @@ -1481,7 +1481,7 @@ msgstr "" "(key) 來呼叫 (在 ``__setitem__`` 的情況也會使用值 (value))。我們也可以控制" "回傳的內容。" -#: ../../library/unittest.mock-examples.rst:1003 +#: ../../library/unittest.mock-examples.rst:1005 msgid "" "After the ``MagicMock`` has been used we can use attributes like :data:" "`~Mock.call_args_list` to assert about how the dictionary was used:" @@ -1489,7 +1489,7 @@ msgstr "" "使用 ``MagicMock`` 後,我們可以使用諸如 :data:`~Mock.call_args_list` 之類的屬" "性來斷言字典被使用的方式:" -#: ../../library/unittest.mock-examples.rst:1019 +#: ../../library/unittest.mock-examples.rst:1021 msgid "" "An alternative to using ``MagicMock`` is to use ``Mock`` and *only* provide " "the magic methods you specifically want:" @@ -1497,7 +1497,7 @@ msgstr "" "不使用 ``MagicMock`` 的替代方案是使用 ``Mock`` 並且\\ *只*\\ 提供你特別想要的" "魔術方法:" -#: ../../library/unittest.mock-examples.rst:1026 +#: ../../library/unittest.mock-examples.rst:1028 msgid "" "A *third* option is to use ``MagicMock`` but passing in ``dict`` as the " "*spec* (or *spec_set*) argument so that the ``MagicMock`` created only has " @@ -1506,7 +1506,7 @@ msgstr "" "*第三個*\\ 選擇是使用 ``MagicMock``,但傳入 ``dict`` 作為 *spec* (或 " "*spec_set*\\ )引數,以使被建立的 ``MagicMock`` 僅具有字典可用的魔術方法:" -#: ../../library/unittest.mock-examples.rst:1034 +#: ../../library/unittest.mock-examples.rst:1036 msgid "" "With these side effect functions in place, the ``mock`` will behave like a " "normal dictionary but recording the access. It even raises a :exc:`KeyError` " @@ -1515,17 +1515,17 @@ msgstr "" "有了這些 side effect 函式,``mock`` 會像一般的字典一樣運作,但會記錄存取。如" "果你嘗試存取不存在的鍵,它甚至會引發一個 :exc:`KeyError`。" -#: ../../library/unittest.mock-examples.rst:1053 +#: ../../library/unittest.mock-examples.rst:1055 msgid "" "After it has been used you can make assertions about the access using the " "normal mock methods and attributes:" msgstr "在上述方式被使用後,你就可以使用普通的 mock 方法和屬性對存取進行斷言:" -#: ../../library/unittest.mock-examples.rst:1065 +#: ../../library/unittest.mock-examples.rst:1067 msgid "Mock subclasses and their attributes" msgstr "Mock 子類別及其屬性" -#: ../../library/unittest.mock-examples.rst:1067 +#: ../../library/unittest.mock-examples.rst:1069 msgid "" "There are various reasons why you might want to subclass :class:`Mock`. One " "reason might be to add helper methods. Here's a silly example:" @@ -1533,7 +1533,7 @@ msgstr "" "你會想子類別化 :class:`Mock` 的原因可能有很多種。其中之一是增加輔助方法。以下" "是一個有點笨的例子:" -#: ../../library/unittest.mock-examples.rst:1083 +#: ../../library/unittest.mock-examples.rst:1085 msgid "" "The standard behaviour for ``Mock`` instances is that attributes and the " "return value mocks are of the same type as the mock they are accessed on. " @@ -1547,7 +1547,7 @@ msgstr "" "``MagicMocks`` [#]_。因此,如果你要子類別化以新增輔助方法,那麼它們也可用於子" "類別實例的屬性 mock 和回傳值 mock。" -#: ../../library/unittest.mock-examples.rst:1099 +#: ../../library/unittest.mock-examples.rst:1101 msgid "" "Sometimes this is inconvenient. For example, `one user `_ is subclassing mock to created a `Twisted " @@ -1559,7 +1559,7 @@ msgstr "" "twisted.org/documents/11.0.0/api/twisted.python.components.html>`_。將其應用" "於屬性實際上會導致錯誤。" -#: ../../library/unittest.mock-examples.rst:1105 +#: ../../library/unittest.mock-examples.rst:1107 msgid "" "``Mock`` (in all its flavours) uses a method called ``_get_child_mock`` to " "create these \"sub-mocks\" for attributes and return values. You can prevent " @@ -1571,7 +1571,7 @@ msgstr "" "建立這些 \"子 mock\"。你可以透過置換此方法來防止你的子類別被用為屬性。其簽名" "是取用任意的關鍵字引數(``**kwargs``\\ ),然後將其傳遞給 mock 建構函式:" -#: ../../library/unittest.mock-examples.rst:1122 +#: ../../library/unittest.mock-examples.rst:1124 msgid "" "An exception to this rule are the non-callable mocks. Attributes use the " "callable variant because otherwise non-callable mocks couldn't have callable " @@ -1580,11 +1580,11 @@ msgstr "" "此規則的例外是非可呼叫物件的 mock。屬性使用可呼叫物件的變體,否則非可呼叫物件" "的 mock 無法具有可呼叫的方法。" -#: ../../library/unittest.mock-examples.rst:1128 +#: ../../library/unittest.mock-examples.rst:1130 msgid "Mocking imports with patch.dict" msgstr "使用 patch.dict 來 mock import" -#: ../../library/unittest.mock-examples.rst:1130 +#: ../../library/unittest.mock-examples.rst:1132 msgid "" "One situation where mocking can be hard is where you have a local import " "inside a function. These are harder to mock because they aren't using an " @@ -1593,7 +1593,7 @@ msgstr "" "可能會讓 mock 很困難的一種情況是在函式內部進行區域 import。這些狀況會更難進" "行 mock,因為它們沒有使用我們可以 patch out 的模組命名空間中的物件。" -#: ../../library/unittest.mock-examples.rst:1134 +#: ../../library/unittest.mock-examples.rst:1136 msgid "" "Generally local imports are to be avoided. They are sometimes done to " "prevent circular dependencies, for which there is *usually* a much better " @@ -1608,7 +1608,7 @@ msgstr "" "件的區域 import 更好的方式來解決(例如將模組儲存為類別或模組屬性,並且僅在第" "一次使用時進行 import)。" -#: ../../library/unittest.mock-examples.rst:1141 +#: ../../library/unittest.mock-examples.rst:1143 msgid "" "That aside there is a way to use ``mock`` to affect the results of an " "import. Importing fetches an *object* from the :data:`sys.modules` " @@ -1622,7 +1622,7 @@ msgstr "" "該物件不需要是一個模組。初次 import 模組會導致模組物件被放入 ``sys.modules`` " "中,因此通常當你 import 某些東西時,你會得到一個模組。但並非一定要如此。" -#: ../../library/unittest.mock-examples.rst:1148 +#: ../../library/unittest.mock-examples.rst:1150 msgid "" "This means you can use :func:`patch.dict` to *temporarily* put a mock in " "place in :data:`sys.modules`. Any imports whilst this patch is active will " @@ -1635,11 +1635,11 @@ msgstr "" "成時(被裝飾的函式結束、with 陳述式主體完成或 ``patcher.stop()`` 被呼叫),那" "麼之前在 ``sys.modules`` 中的任何內容都會被安全地復原。" -#: ../../library/unittest.mock-examples.rst:1154 +#: ../../library/unittest.mock-examples.rst:1156 msgid "Here's an example that mocks out the 'fooble' module." msgstr "下面是一個 mock out 'fooble' 模組的例子。" -#: ../../library/unittest.mock-examples.rst:1166 +#: ../../library/unittest.mock-examples.rst:1168 msgid "" "As you can see the ``import fooble`` succeeds, but on exit there is no " "'fooble' left in :data:`sys.modules`." @@ -1647,19 +1647,19 @@ msgstr "" "如你所見,``import fooble`` 成功了,但在離開之後,:data:`sys.modules` 中就沒" "有 'fooble' 了。" -#: ../../library/unittest.mock-examples.rst:1169 +#: ../../library/unittest.mock-examples.rst:1171 msgid "This also works for the ``from module import name`` form:" msgstr "這也適用於 ``from module import name`` 形式:" -#: ../../library/unittest.mock-examples.rst:1179 +#: ../../library/unittest.mock-examples.rst:1181 msgid "With slightly more work you can also mock package imports:" msgstr "透過稍微多一點的處理,你也可以 mock 套件的引入:" -#: ../../library/unittest.mock-examples.rst:1192 +#: ../../library/unittest.mock-examples.rst:1194 msgid "Tracking order of calls and less verbose call assertions" msgstr "追蹤呼叫順序與更簡潔的呼叫斷言" -#: ../../library/unittest.mock-examples.rst:1194 +#: ../../library/unittest.mock-examples.rst:1196 msgid "" "The :class:`Mock` class allows you to track the *order* of method calls on " "your mock objects through the :attr:`~Mock.method_calls` attribute. This " @@ -1670,7 +1670,7 @@ msgstr "" "上方法呼叫的\\ *順序*。這不會讓你可以追蹤不同的 mock 物件之間的呼叫順序,然而" "我們可以使用 :attr:`~Mock.mock_calls` 來達到相同的效果。" -#: ../../library/unittest.mock-examples.rst:1199 +#: ../../library/unittest.mock-examples.rst:1201 msgid "" "Because mocks track calls to child mocks in ``mock_calls``, and accessing an " "arbitrary attribute of a mock creates a child mock, we can create our " @@ -1681,7 +1681,7 @@ msgstr "" "會建立一個子 mock,所以我們可以從父 mock 建立不同的 mock。之後對這些子 mock " "的呼叫將依序全部記錄在父 mock 的 ``mock_calls`` 中:" -#: ../../library/unittest.mock-examples.rst:1216 +#: ../../library/unittest.mock-examples.rst:1218 msgid "" "We can then assert about the calls, including the order, by comparing with " "the ``mock_calls`` attribute on the manager mock:" @@ -1689,7 +1689,7 @@ msgstr "" "之後我們可以透過與管理器 (manager) mock 上的 ``mock_calls`` 屬性進行比較來斷" "言呼叫及其順序:" -#: ../../library/unittest.mock-examples.rst:1223 +#: ../../library/unittest.mock-examples.rst:1225 msgid "" "If ``patch`` is creating, and putting in place, your mocks then you can " "attach them to a manager mock using the :meth:`~Mock.attach_mock` method. " @@ -1699,7 +1699,7 @@ msgstr "" "attach_mock` 方法將它們附加到管理器 mock。附加之後,呼叫將被記錄在管理器的 " "``mock_calls`` 中。: ::" -#: ../../library/unittest.mock-examples.rst:1227 +#: ../../library/unittest.mock-examples.rst:1229 msgid "" ">>> manager = MagicMock()\n" ">>> with patch('mymodule.Class1') as MockClass1:\n" @@ -1731,7 +1731,7 @@ msgstr "" "call.MockClass2(),\n" "call.MockClass2().bar()]" -#: ../../library/unittest.mock-examples.rst:1242 +#: ../../library/unittest.mock-examples.rst:1244 msgid "" "If many calls have been made, but you're only interested in a particular " "sequence of them then an alternative is to use the :meth:`~Mock." @@ -1743,7 +1743,7 @@ msgstr "" "`~Mock.assert_has_calls` 方法。這需要一個呼叫串列(使用 :data:`call` 物件建" "構)。如果該呼叫序列位於 :attr:`~Mock.mock_calls` 中,則斷言成功。" -#: ../../library/unittest.mock-examples.rst:1256 +#: ../../library/unittest.mock-examples.rst:1258 msgid "" "Even though the chained call ``m.one().two().three()`` aren't the only calls " "that have been made to the mock, the assert still succeeds." @@ -1751,7 +1751,7 @@ msgstr "" "儘管鍊接呼叫 ``m.one().two().three()`` 並不是對 mock 進行的唯一呼叫,斷言仍會" "成功。" -#: ../../library/unittest.mock-examples.rst:1259 +#: ../../library/unittest.mock-examples.rst:1261 msgid "" "Sometimes a mock may have several calls made to it, and you are only " "interested in asserting about *some* of those calls. You may not even care " @@ -1762,11 +1762,11 @@ msgstr "" "你甚至可能不關心順序。在這種情況下,你可以將 ``any_order=True`` 傳遞給 " "``assert_has_calls``:" -#: ../../library/unittest.mock-examples.rst:1271 +#: ../../library/unittest.mock-examples.rst:1273 msgid "More complex argument matching" msgstr "更複雜的引數匹配" -#: ../../library/unittest.mock-examples.rst:1273 +#: ../../library/unittest.mock-examples.rst:1275 msgid "" "Using the same basic concept as :data:`ANY` we can implement matchers to do " "more complex assertions on objects used as arguments to mocks." @@ -1774,7 +1774,7 @@ msgstr "" "使用與 :data:`ANY` 相同的基本概念,我們可以實作匹配器 (matcher),對用來作為 " "mock 引數的物件進行更複雜的斷言。" -#: ../../library/unittest.mock-examples.rst:1276 +#: ../../library/unittest.mock-examples.rst:1278 msgid "" "Suppose we expect some object to be passed to a mock that by default " "compares equal based on object identity (which is the Python default for " @@ -1788,29 +1788,29 @@ msgstr "" "assert_called_with`,我們需要傳入完全相同的物件。如果我們只對該物件的某些屬性" "感興趣,那麼我們可以建立一個匹配器來為我們檢查這些屬性。" -#: ../../library/unittest.mock-examples.rst:1283 +#: ../../library/unittest.mock-examples.rst:1285 msgid "" "You can see in this example how a 'standard' call to ``assert_called_with`` " "isn't sufficient:" msgstr "" "你可以在這個範例中看到對 ``assert_called_with`` 的一個「標準」呼叫是不夠的:" -#: ../../library/unittest.mock-examples.rst:1298 +#: ../../library/unittest.mock-examples.rst:1301 msgid "" "A comparison function for our ``Foo`` class might look something like this:" msgstr "對我們的 ``Foo`` 類別的比較函式看起來可能會像這樣:" -#: ../../library/unittest.mock-examples.rst:1310 +#: ../../library/unittest.mock-examples.rst:1313 msgid "" "And a matcher object that can use comparison functions like this for its " "equality operation would look something like this:" msgstr "而可以使用像這樣的比較函式進行其相等性運算的匹配器物件會長得像這樣:" -#: ../../library/unittest.mock-examples.rst:1321 +#: ../../library/unittest.mock-examples.rst:1324 msgid "Putting all this together:" msgstr "把這些都放在一起:" -#: ../../library/unittest.mock-examples.rst:1326 +#: ../../library/unittest.mock-examples.rst:1329 msgid "" "The ``Matcher`` is instantiated with our compare function and the ``Foo`` " "object we want to compare against. In ``assert_called_with`` the ``Matcher`` " @@ -1825,7 +1825,7 @@ msgstr "" "``assert_called_with`` 會通過,如果它們不匹配,則會引發 :exc:" "`AssertionError`:" -#: ../../library/unittest.mock-examples.rst:1339 +#: ../../library/unittest.mock-examples.rst:1342 msgid "" "With a bit of tweaking you could have the comparison function raise the :exc:" "`AssertionError` directly and provide a more useful failure message." @@ -1833,7 +1833,7 @@ msgstr "" "透過一些調整,你可以讓比較函式直接引發 :exc:`AssertionError` 並提供更有用的失" "敗訊息。" -#: ../../library/unittest.mock-examples.rst:1342 +#: ../../library/unittest.mock-examples.rst:1345 msgid "" "As of version 1.5, the Python testing library `PyHamcrest `_ provides similar functionality, that may be " diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 80a2302135..46210eedbc 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-02-19 21:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -246,7 +246,7 @@ msgstr "" msgid "The Mock Class" msgstr "Mock 類別" -#: ../../library/unittest.mock.rst:211 +#: ../../library/unittest.mock.rst:213 msgid "" ":class:`Mock` is a flexible mock object intended to replace the use of stubs " "and test doubles throughout your code. Mocks are callable and create " @@ -259,7 +259,7 @@ msgstr "" "的 mock [#]_。存取相同的屬性將永遠回傳相同的 mock。Mock 記錄了你如何使用它" "們,允許你判定你的程式碼對 mock 的行為。" -#: ../../library/unittest.mock.rst:217 +#: ../../library/unittest.mock.rst:219 msgid "" ":class:`MagicMock` is a subclass of :class:`Mock` with all the magic methods " "pre-created and ready to use. There are also non-callable variants, useful " @@ -270,7 +270,7 @@ msgstr "" "可供使用。也有不可呼叫的變體,在你 mock 無法呼叫的物件時很有用::class:" "`NonCallableMock` 和 :class:`NonCallableMagicMock`" -#: ../../library/unittest.mock.rst:222 +#: ../../library/unittest.mock.rst:224 msgid "" "The :func:`patch` decorators makes it easy to temporarily replace classes in " "a particular module with a :class:`Mock` object. By default :func:`patch` " @@ -281,7 +281,7 @@ msgstr "" "預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使用 :" "func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。" -#: ../../library/unittest.mock.rst:230 +#: ../../library/unittest.mock.rst:232 msgid "" "Create a new :class:`Mock` object. :class:`Mock` takes several optional " "arguments that specify the behaviour of the Mock object:" @@ -289,7 +289,7 @@ msgstr "" "建立一個新的 :class:`Mock` 物件。:class:`Mock` 接受數個可選的引數來指定 Mock " "物件的行為:" -#: ../../library/unittest.mock.rst:233 +#: ../../library/unittest.mock.rst:235 msgid "" "*spec*: This can be either a list of strings or an existing object (a class " "or instance) that acts as the specification for the mock object. If you pass " @@ -302,7 +302,7 @@ msgstr "" "不支援的魔術屬性和方法)。存取不在此串列中的任何屬性都會引發 :exc:" "`AttributeError`。" -#: ../../library/unittest.mock.rst:239 +#: ../../library/unittest.mock.rst:241 msgid "" "If *spec* is an object (rather than a list of strings) then :attr:`~instance." "__class__` returns the class of the spec object. This allows mocks to pass :" @@ -312,7 +312,7 @@ msgstr "" "__class__` 會回傳 spec 物件的類別。這允許 mocks 通過 :func:`isinstance` 測" "試。" -#: ../../library/unittest.mock.rst:243 +#: ../../library/unittest.mock.rst:245 msgid "" "*spec_set*: A stricter variant of *spec*. If used, attempting to *set* or " "get an attribute on the mock that isn't on the object passed as *spec_set* " @@ -322,7 +322,7 @@ msgstr "" "*set* 或取得不在傳遞給 *spec_set* 的物件上的屬性將會引發 :exc:" "`AttributeError`。" -#: ../../library/unittest.mock.rst:247 +#: ../../library/unittest.mock.rst:249 msgid "" "*side_effect*: A function to be called whenever the Mock is called. See the :" "attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " @@ -334,7 +334,7 @@ msgstr "" "屬性,用於引發例外或動態變更回傳值。該函式使用與 mock 相同的引數呼叫,且除非" "它回傳 :data:`DEFAULT`,否則此函式的回傳值將用作回傳值。" -#: ../../library/unittest.mock.rst:253 +#: ../../library/unittest.mock.rst:255 msgid "" "Alternatively *side_effect* can be an exception class or instance. In this " "case the exception will be raised when the mock is called." @@ -342,7 +342,7 @@ msgstr "" "*side_effect* 也可以是一個例外的類別或實例。在這種情況下,當呼叫 mock 時,該" "例外將被引發。" -#: ../../library/unittest.mock.rst:256 +#: ../../library/unittest.mock.rst:258 msgid "" "If *side_effect* is an iterable then each call to the mock will return the " "next value from the iterable." @@ -350,11 +350,11 @@ msgstr "" "如果 *side_effect* 是一個可疊代物件,那麼對 mock 的每次呼叫將回傳可疊代物件中" "的下一個值。" -#: ../../library/unittest.mock.rst:259 +#: ../../library/unittest.mock.rst:261 msgid "A *side_effect* can be cleared by setting it to ``None``." msgstr "*side_effect* 可以通過將其設置為 ``None`` 來清除。" -#: ../../library/unittest.mock.rst:261 +#: ../../library/unittest.mock.rst:263 msgid "" "*return_value*: The value returned when the mock is called. By default this " "is a new Mock (created on first access). See the :attr:`return_value` " @@ -363,7 +363,7 @@ msgstr "" "*return_value*:當呼叫 mock 時回傳的值。預設情況下,這是一個新的 Mock(在首次" "存取時建立)。參見 :attr:`return_value` 屬性。" -#: ../../library/unittest.mock.rst:265 +#: ../../library/unittest.mock.rst:267 msgid "" "*unsafe*: By default, accessing any attribute whose name starts with " "*assert*, *assret*, *asert*, *aseert* or *assrt* will raise an :exc:" @@ -374,7 +374,7 @@ msgstr "" "*assrt* 開頭的屬性將引發 :exc:`AttributeError`。如果傳遞 ``unsafe=True``,將" "會允許存取這些屬性。" -#: ../../library/unittest.mock.rst:272 +#: ../../library/unittest.mock.rst:274 msgid "" "*wraps*: Item for the mock object to wrap. If *wraps* is not ``None`` then " "calling the Mock will pass the call through to the wrapped object (returning " @@ -388,7 +388,7 @@ msgstr "" "物件包裝了被包裝物件的對應屬性(因此嘗試存取不存在的屬性將引發 :exc:" "`AttributeError`\\ )。" -#: ../../library/unittest.mock.rst:279 +#: ../../library/unittest.mock.rst:281 msgid "" "If the mock has an explicit *return_value* set then calls are not passed to " "the wrapped object and the *return_value* is returned instead." @@ -396,7 +396,7 @@ msgstr "" "如果 mock 已經明確設定了 *return_value*,那麼呼叫並不會被傳遞到被包裝的物件," "而是回傳已設定好的 *return_value*。" -#: ../../library/unittest.mock.rst:282 +#: ../../library/unittest.mock.rst:284 msgid "" "*name*: If the mock has a name then it will be used in the repr of the mock. " "This can be useful for debugging. The name is propagated to child mocks." @@ -404,7 +404,7 @@ msgstr "" "*name*:如果 mock 有一個名稱,那麼它會被用於 mock 的 repr。這對於除錯很有用。" "此名稱將被傳播到子 mocks。" -#: ../../library/unittest.mock.rst:286 +#: ../../library/unittest.mock.rst:288 msgid "" "Mocks can also be called with arbitrary keyword arguments. These will be " "used to set attributes on the mock after it is created. See the :meth:" @@ -413,31 +413,31 @@ msgstr "" "Mocks 還可以使用任意的關鍵字引數進行呼叫。這些關鍵字引數將在建立 mock 之後用" "於設定 mock 的屬性。欲知更多,請參見 :meth:`configure_mock` 方法。" -#: ../../library/unittest.mock.rst:292 +#: ../../library/unittest.mock.rst:294 msgid "Assert that the mock was called at least once." msgstr "確認 mock 至少被呼叫一次。" -#: ../../library/unittest.mock.rst:303 +#: ../../library/unittest.mock.rst:305 msgid "Assert that the mock was called exactly once." msgstr "確認 mock 只被呼叫一次。" -#: ../../library/unittest.mock.rst:321 +#: ../../library/unittest.mock.rst:324 msgid "" "This method is a convenient way of asserting that the last call has been " "made in a particular way:" msgstr "這個方法是一個便利的方式,用來斷言最後一次呼叫是以特定方式進行的:" -#: ../../library/unittest.mock.rst:331 +#: ../../library/unittest.mock.rst:334 msgid "" "Assert that the mock was called exactly once and that call was with the " "specified arguments." msgstr "確認 mock 只被呼叫一次,且該次呼叫使用了指定的引數。" -#: ../../library/unittest.mock.rst:346 +#: ../../library/unittest.mock.rst:349 msgid "assert the mock has been called with the specified arguments." msgstr "斷言 mock 已經被使用指定的引數呼叫。" -#: ../../library/unittest.mock.rst:348 +#: ../../library/unittest.mock.rst:351 msgid "" "The assert passes if the mock has *ever* been called, unlike :meth:" "`assert_called_with` and :meth:`assert_called_once_with` that only pass if " @@ -448,7 +448,7 @@ msgstr "" "meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對於 :meth:" "`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。" -#: ../../library/unittest.mock.rst:361 +#: ../../library/unittest.mock.rst:364 msgid "" "assert the mock has been called with the specified calls. The :attr:" "`mock_calls` list is checked for the calls." @@ -456,7 +456,7 @@ msgstr "" "斷言 mock 已經使用指定的呼叫方式來呼叫。此斷言會檢查 :attr:`mock_calls` 串列" "中的呼叫。" -#: ../../library/unittest.mock.rst:364 +#: ../../library/unittest.mock.rst:367 msgid "" "If *any_order* is false then the calls must be sequential. There can be " "extra calls before or after the specified calls." @@ -464,7 +464,7 @@ msgstr "" "如果 *any_order* 為 false,那麼這些呼叫必須按照順序。在指定的呼叫之前或之後可" "以有額外的呼叫。" -#: ../../library/unittest.mock.rst:368 +#: ../../library/unittest.mock.rst:371 msgid "" "If *any_order* is true then the calls can be in any order, but they must all " "appear in :attr:`mock_calls`." @@ -472,19 +472,19 @@ msgstr "" "如果 *any_order* 為 true,那麼這些呼叫可以以任何順序出現,但它們必須全部出現" "在 :attr:`mock_calls` 中。" -#: ../../library/unittest.mock.rst:383 +#: ../../library/unittest.mock.rst:386 msgid "Assert the mock was never called." msgstr "斷言 mock 從未被呼叫。" -#: ../../library/unittest.mock.rst:398 +#: ../../library/unittest.mock.rst:402 msgid "The reset_mock method resets all the call attributes on a mock object:" msgstr "reset_mock 方法重置 mock 物件上的所有呼叫屬性:" -#: ../../library/unittest.mock.rst:408 +#: ../../library/unittest.mock.rst:412 msgid "Added two keyword-only arguments to the reset_mock function." msgstr "reset_mock 函式新增了兩個僅限關鍵字引數 (keyword-only arguments)。" -#: ../../library/unittest.mock.rst:411 +#: ../../library/unittest.mock.rst:415 msgid "" "This can be useful where you want to make a series of assertions that reuse " "the same object. Note that :meth:`reset_mock` *doesn't* clear the :attr:" @@ -500,11 +500,11 @@ msgstr "" "`side_effect`,則將相應的參數設置為 ``True``。Child mock 和回傳值 mock(如果" "有的話)也會被重置。" -#: ../../library/unittest.mock.rst:419 +#: ../../library/unittest.mock.rst:423 msgid "*return_value*, and *side_effect* are keyword-only arguments." msgstr "*return_value* 和 *side_effect* 是僅限關鍵字引數。" -#: ../../library/unittest.mock.rst:425 +#: ../../library/unittest.mock.rst:429 msgid "" "Add a spec to a mock. *spec* can either be an object or a list of strings. " "Only attributes on the *spec* can be fetched as attributes from the mock." @@ -512,11 +512,11 @@ msgstr "" "向 mock 增加一個規格 (spec)。*spec* 可以是一個物件或一個字串串列 (list of " "strings)。只有在 *spec* 上的屬性才能作為 mock 的屬性被取得。" -#: ../../library/unittest.mock.rst:429 +#: ../../library/unittest.mock.rst:433 msgid "If *spec_set* is true then only attributes on the spec can be set." msgstr "如果 *spec_set* 為 true,那麼只能設定在規格中的屬性。" -#: ../../library/unittest.mock.rst:434 +#: ../../library/unittest.mock.rst:438 msgid "" "Attach a mock as an attribute of this one, replacing its name and parent. " "Calls to the attached mock will be recorded in the :attr:`method_calls` and :" @@ -526,11 +526,11 @@ msgstr "" "mock 的呼叫將被記錄在這個 Mock 的 :attr:`method_calls` 和 :attr:`mock_calls` " "屬性中。" -#: ../../library/unittest.mock.rst:441 +#: ../../library/unittest.mock.rst:445 msgid "Set attributes on the mock through keyword arguments." msgstr "透過關鍵字引數在 mock 上設定屬性。" -#: ../../library/unittest.mock.rst:443 +#: ../../library/unittest.mock.rst:447 msgid "" "Attributes plus return values and side effects can be set on child mocks " "using standard dot notation and unpacking a dictionary in the method call:" @@ -538,18 +538,18 @@ msgstr "" "可以在使用 method(方法)呼叫時,使用標準點記法 (dot notation) 並將字典拆開," "為 child mock 設定屬性、回傳值和 side effects:" -#: ../../library/unittest.mock.rst:457 +#: ../../library/unittest.mock.rst:461 msgid "The same thing can be achieved in the constructor call to mocks:" msgstr "同樣的事情可以在 mock 的建構函式呼叫中實現:" -#: ../../library/unittest.mock.rst:470 +#: ../../library/unittest.mock.rst:474 msgid "" ":meth:`configure_mock` exists to make it easier to do configuration after " "the mock has been created." msgstr "" ":meth:`configure_mock` 的存在是為了在 mock 被建立後更容易進行組態設定。" -#: ../../library/unittest.mock.rst:476 +#: ../../library/unittest.mock.rst:480 msgid "" ":class:`Mock` objects limit the results of ``dir(some_mock)`` to useful " "results. For mocks with a *spec* this includes all the permitted attributes " @@ -558,13 +558,13 @@ msgstr "" ":class:`Mock` 物件限制了 ``dir(some_mock)`` 僅顯示有用的結果。對於具有 " "*spec* 的 mock,這包含所有被允許的 mock 屬性。" -#: ../../library/unittest.mock.rst:480 +#: ../../library/unittest.mock.rst:484 msgid "" "See :data:`FILTER_DIR` for what this filtering does, and how to switch it " "off." msgstr "請參閱 :data:`FILTER_DIR` 以了解這種過濾行為的作用,以及如何關閉它。" -#: ../../library/unittest.mock.rst:486 +#: ../../library/unittest.mock.rst:490 msgid "" "Create the child mocks for attributes and return value. By default child " "mocks will be the same type as the parent. Subclasses of Mock may want to " @@ -573,35 +573,35 @@ msgstr "" "建立為了得到屬性和回傳值的 child mock。預設情況下,child mock 將與其上代是相" "同的型別。Mock 的子類別可能會想要置換此行為,以自定義 child mock 的建立方式。" -#: ../../library/unittest.mock.rst:491 +#: ../../library/unittest.mock.rst:495 msgid "" "For non-callable mocks the callable variant will be used (rather than any " "custom subclass)." msgstr "對於不可呼叫的 mock,將使用可呼叫的變體,而不是任何的自定義子類別。" -#: ../../library/unittest.mock.rst:497 +#: ../../library/unittest.mock.rst:501 msgid "A boolean representing whether or not the mock object has been called:" msgstr "一個 boolean(布林),表述 mock 物件是否已經被呼叫:" -#: ../../library/unittest.mock.rst:508 +#: ../../library/unittest.mock.rst:512 msgid "An integer telling you how many times the mock object has been called:" msgstr "一個整數,告訴你 mock 物件被呼叫的次數:" -#: ../../library/unittest.mock.rst:520 +#: ../../library/unittest.mock.rst:524 msgid "Set this to configure the value returned by calling the mock:" msgstr "設定此值以配置呼叫 mock 時回傳的值:" -#: ../../library/unittest.mock.rst:527 +#: ../../library/unittest.mock.rst:531 msgid "" "The default return value is a mock object and you can configure it in the " "normal way:" msgstr "預設的回傳值是一個 mock 物件,你也可以按照正常的方式配置它:" -#: ../../library/unittest.mock.rst:536 +#: ../../library/unittest.mock.rst:540 msgid ":attr:`return_value` can also be set in the constructor:" msgstr ":attr:`return_value` 也可以在建構函式中設定:" -#: ../../library/unittest.mock.rst:547 +#: ../../library/unittest.mock.rst:551 msgid "" "This can either be a function to be called when the mock is called, an " "iterable or an exception (class or instance) to be raised." @@ -609,7 +609,7 @@ msgstr "" "這可以是一個在呼叫 mock 時要呼叫的函式、一個可疊代物件,或者要引發的例外(類" "別或實例)。" -#: ../../library/unittest.mock.rst:550 +#: ../../library/unittest.mock.rst:554 msgid "" "If you pass in a function it will be called with same arguments as the mock " "and unless the function returns the :data:`DEFAULT` singleton the call to " @@ -622,7 +622,7 @@ msgstr "" "式回傳 :data:`DEFAULT`,那麼 mock 將回傳其正常的回傳值(從 :attr:" "`return_value` 得到)。" -#: ../../library/unittest.mock.rst:556 +#: ../../library/unittest.mock.rst:560 msgid "" "If you pass in an iterable, it is used to retrieve an iterator which must " "yield a value on every call. This value can either be an exception instance " @@ -633,21 +633,21 @@ msgstr "" "產出 (yield) 一個值。這個值可以是要引發的例外實例,或者是對 mock 呼叫時要回傳" "的值(處理 :data:`DEFAULT` 的方式與函式的狀況相同)。" -#: ../../library/unittest.mock.rst:561 +#: ../../library/unittest.mock.rst:565 msgid "" "An example of a mock that raises an exception (to test exception handling of " "an API):" msgstr "以下是一個引發例外的 mock 的範例(用於測試 API 的例外處理):" -#: ../../library/unittest.mock.rst:571 +#: ../../library/unittest.mock.rst:575 msgid "Using :attr:`side_effect` to return a sequence of values:" msgstr "使用 :attr:`side_effect` 回傳一連串值的範例:" -#: ../../library/unittest.mock.rst:578 +#: ../../library/unittest.mock.rst:582 msgid "Using a callable:" msgstr "使用可被呼叫物件的範例:" -#: ../../library/unittest.mock.rst:588 +#: ../../library/unittest.mock.rst:592 msgid "" ":attr:`side_effect` can be set in the constructor. Here's an example that " "adds one to the value the mock is called with and returns it:" @@ -655,11 +655,11 @@ msgstr "" ":attr:`side_effect` 可以在建構函式中設定。以下是一個範例,它將 mock 被呼叫時" "給的值加一並回傳:" -#: ../../library/unittest.mock.rst:598 +#: ../../library/unittest.mock.rst:602 msgid "Setting :attr:`side_effect` to ``None`` clears it:" msgstr "將 :attr:`side_effect` 設定為 ``None`` 可以清除它:" -#: ../../library/unittest.mock.rst:612 +#: ../../library/unittest.mock.rst:616 msgid "" "This is either ``None`` (if the mock hasn't been called), or the arguments " "that the mock was last called with. This will be in the form of a tuple: the " @@ -673,7 +673,7 @@ msgstr "" "是 mock 被呼叫時傳遞的所有有序引數(或一個空元組)。第二個成員,其可以通過 " "``kwargs`` 屬性訪問,是所有關鍵字引數(或一個空字典)。" -#: ../../library/unittest.mock.rst:645 +#: ../../library/unittest.mock.rst:649 msgid "" ":attr:`call_args`, along with members of the lists :attr:`call_args_list`, :" "attr:`method_calls` and :attr:`mock_calls` are :data:`call` objects. These " @@ -685,11 +685,11 @@ msgstr "" "獲取各個引數並進行更複雜的斷言。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:651 +#: ../../library/unittest.mock.rst:655 msgid "Added ``args`` and ``kwargs`` properties." msgstr "新增 ``args`` 與 ``kwargs`` 特性。" -#: ../../library/unittest.mock.rst:657 +#: ../../library/unittest.mock.rst:661 msgid "" "This is a list of all the calls made to the mock object in sequence (so the " "length of the list is the number of times it has been called). Before any " @@ -701,7 +701,7 @@ msgstr "" "在任何呼叫發生之前,它會是一個空的串列。 :data:`call` 物件可用於方便地建構呼" "叫的串列,以便與 :attr:`call_args_list` 進行比較。" -#: ../../library/unittest.mock.rst:673 +#: ../../library/unittest.mock.rst:677 msgid "" "Members of :attr:`call_args_list` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " @@ -710,7 +710,7 @@ msgstr "" ":attr:`call_args_list` 的成員都是 :data:`call` 物件。這些物件可以被拆包為元" "組,以取得各個引數。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:680 +#: ../../library/unittest.mock.rst:684 msgid "" "As well as tracking calls to themselves, mocks also track calls to methods " "and attributes, and *their* methods and attributes:" @@ -718,7 +718,7 @@ msgstr "" "除了追蹤對自身的呼叫之外,mock 還會追蹤對方法和屬性的呼叫,以及\\ *它們(這些" "方法和屬性)*\\ 的方法和屬性:" -#: ../../library/unittest.mock.rst:691 +#: ../../library/unittest.mock.rst:695 msgid "" "Members of :attr:`method_calls` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " @@ -727,7 +727,7 @@ msgstr "" ":attr:`method_calls` 的成員都是 :data:`call` 物件。這些物件可以拆包為元組,以" "取得各個引數。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:698 +#: ../../library/unittest.mock.rst:702 msgid "" ":attr:`mock_calls` records *all* calls to the mock object, its methods, " "magic methods *and* return value mocks." @@ -735,7 +735,7 @@ msgstr "" ":attr:`mock_calls` 記錄了 *所有* 對 mock 物件的呼叫,包含其方法、魔術方法以及" "回傳值 mock。" -#: ../../library/unittest.mock.rst:716 +#: ../../library/unittest.mock.rst:720 msgid "" "Members of :attr:`mock_calls` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " @@ -744,7 +744,7 @@ msgstr "" ":attr:`method_calls` 的成員都是 :data:`call` 物件。這些物件可以拆包為元組,以" "取得各個引數。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:722 +#: ../../library/unittest.mock.rst:726 msgid "" "The way :attr:`mock_calls` are recorded means that where nested calls are " "made, the parameters of ancestor calls are not recorded and so will always " @@ -753,7 +753,7 @@ msgstr "" ":attr:`mock_calls` 記錄的方式意味著在進行巢狀呼叫時,上代 (ancestor) 呼叫的參" "數不會被記錄,因此在比較時它們將始終相等:" -#: ../../library/unittest.mock.rst:736 +#: ../../library/unittest.mock.rst:740 msgid "" "Normally the :attr:`__class__` attribute of an object will return its type. " "For a mock object with a :attr:`spec`, ``__class__`` returns the spec class " @@ -764,7 +764,7 @@ msgstr "" "的 mock 物件,``__class__`` 會回傳 spec 的類別。這允許 mock 物件通過對它們所" "替代或偽裝的物件進行的 :func:`isinstance` 測試:" -#: ../../library/unittest.mock.rst:745 +#: ../../library/unittest.mock.rst:749 msgid "" ":attr:`__class__` is assignable to, this allows a mock to pass an :func:" "`isinstance` check without forcing you to use a spec:" @@ -772,7 +772,7 @@ msgstr "" ":attr:`__class__` 可以被指定,這允許 mock 通過 :func:`isinstance` 檢查,而不" "需要強制使用 spec:" -#: ../../library/unittest.mock.rst:755 +#: ../../library/unittest.mock.rst:759 msgid "" "A non-callable version of :class:`Mock`. The constructor parameters have the " "same meaning of :class:`Mock`, with the exception of *return_value* and " @@ -781,7 +781,7 @@ msgstr "" ":class:`Mock` 的一個不可呼叫版本。建構函式參數的意義與 :class:`Mock` 相同,其" "例外為 *return_value* 和 *side_effect* 在不可呼叫的 mock 上無意義。" -#: ../../library/unittest.mock.rst:759 +#: ../../library/unittest.mock.rst:763 msgid "" "Mock objects that use a class or an instance as a :attr:`spec` or :attr:" "`spec_set` are able to pass :func:`isinstance` tests:" @@ -789,7 +789,7 @@ msgstr "" "使用類別或實例作為 :attr:`spec` 或 :attr:`spec_set` 的 mock 物件能夠通過 :" "func:`isinstance` 測試:" -#: ../../library/unittest.mock.rst:769 +#: ../../library/unittest.mock.rst:773 msgid "" "The :class:`Mock` classes have support for mocking magic methods. See :ref:" "`magic methods ` for the full details." @@ -797,7 +797,7 @@ msgstr "" ":class:`Mock` 類別支援 mock 魔術方法。細節請參考\\ :ref:`魔術方法 `。" -#: ../../library/unittest.mock.rst:772 +#: ../../library/unittest.mock.rst:776 msgid "" "The mock classes and the :func:`patch` decorators all take arbitrary keyword " "arguments for configuration. For the :func:`patch` decorators the keywords " @@ -808,7 +808,7 @@ msgstr "" "`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵字引數用" "於配置 mock 的屬性:" -#: ../../library/unittest.mock.rst:783 +#: ../../library/unittest.mock.rst:787 msgid "" "The return value and side effect of child mocks can be set in the same way, " "using dotted notation. As you can't use dotted names directly in a call you " @@ -817,7 +817,7 @@ msgstr "" "Child mock 的回傳值和 side effect 可以使用使用點記法進行設置。由於你無法直接" "在呼叫中使用帶有點 (.) 的名稱,因此你必須建立一個字典並使用 ``**`` 解包:" -#: ../../library/unittest.mock.rst:798 +#: ../../library/unittest.mock.rst:802 msgid "" "A callable mock which was created with a *spec* (or a *spec_set*) will " "introspect the specification object's signature when matching calls to the " @@ -828,7 +828,7 @@ msgstr "" "將會內省 (introspect) 規格物件的簽名 (signature)。因此,它可以匹配實際呼叫的" "引數,無論它們是按位置傳遞還是按名稱傳遞: ::" -#: ../../library/unittest.mock.rst:803 +#: ../../library/unittest.mock.rst:807 msgid "" ">>> def f(a, b, c): pass\n" "...\n" @@ -846,7 +846,7 @@ msgstr "" ">>> mock.assert_called_with(1, 2, 3)\n" ">>> mock.assert_called_with(a=1, b=2, c=3)" -#: ../../library/unittest.mock.rst:811 +#: ../../library/unittest.mock.rst:815 msgid "" "This applies to :meth:`~Mock.assert_called_with`, :meth:`~Mock." "assert_called_once_with`, :meth:`~Mock.assert_has_calls` and :meth:`~Mock." @@ -858,13 +858,13 @@ msgstr "" "assert_any_call`。在使用 :ref:`auto-speccing` 時,它還適用於 mock 物件的方法" "呼叫。" -#: ../../library/unittest.mock.rst:816 +#: ../../library/unittest.mock.rst:820 msgid "Added signature introspection on specced and autospecced mock objects." msgstr "" "對於已經設置了規格(spec)和自動規格(autospec)的 mock 物件,新增簽名內省功" "能。" -#: ../../library/unittest.mock.rst:822 +#: ../../library/unittest.mock.rst:826 msgid "" "A mock intended to be used as a :class:`property`, or other :term:" "`descriptor`, on a class. :class:`PropertyMock` provides :meth:`~object." @@ -875,7 +875,7 @@ msgstr "" "class:`PropertyMock` 提供了 :meth:`~object.__get__` 和 :meth:`~object." "__set__` 方法,因此你可以在它被提取時指定回傳值。" -#: ../../library/unittest.mock.rst:827 +#: ../../library/unittest.mock.rst:831 msgid "" "Fetching a :class:`PropertyMock` instance from an object calls the mock, " "with no args. Setting it calls the mock with the value being set. ::" @@ -883,7 +883,7 @@ msgstr "" "從物件中提取 :class:`PropertyMock` 實例會不帶任何引數呼叫 mock。設定它則會用" "設定的值來呼叫 mock: ::" -#: ../../library/unittest.mock.rst:830 +#: ../../library/unittest.mock.rst:834 msgid "" ">>> class Foo:\n" "... @property\n" @@ -921,7 +921,7 @@ msgstr "" ">>> mock_foo.mock_calls\n" "[call(), call(6)]" -#: ../../library/unittest.mock.rst:848 +#: ../../library/unittest.mock.rst:852 msgid "" "Because of the way mock attributes are stored you can't directly attach a :" "class:`PropertyMock` to a mock object. Instead you can attach it to the mock " @@ -930,7 +930,7 @@ msgstr "" "由於 mock 屬性的儲存方式,你無法直接將 :class:`PropertyMock` 附加到 mock 物" "件。但是你可以將其附加到 mock 型別的物件: ::" -#: ../../library/unittest.mock.rst:852 +#: ../../library/unittest.mock.rst:856 msgid "" ">>> m = MagicMock()\n" ">>> p = PropertyMock(return_value=3)\n" @@ -946,14 +946,14 @@ msgstr "" "3\n" ">>> p.assert_called_once_with()" -#: ../../library/unittest.mock.rst:861 +#: ../../library/unittest.mock.rst:865 msgid "" "If an :exc:`AttributeError` is raised by :class:`PropertyMock`, it will be " "interpreted as a missing descriptor and :meth:`~object.__getattr__` will be " "called on the parent mock::" msgstr "" -#: ../../library/unittest.mock.rst:865 +#: ../../library/unittest.mock.rst:869 msgid "" ">>> m = MagicMock()\n" ">>> no_attribute = PropertyMock(side_effect=AttributeError)\n" @@ -967,11 +967,11 @@ msgstr "" ">>> m.my_property\n" "" -#: ../../library/unittest.mock.rst:871 +#: ../../library/unittest.mock.rst:875 msgid "See :meth:`~object.__getattr__` for details." msgstr "詳情請見 :meth:`~object.__getattr__`。" -#: ../../library/unittest.mock.rst:876 +#: ../../library/unittest.mock.rst:880 msgid "" "An asynchronous version of :class:`MagicMock`. The :class:`AsyncMock` object " "will behave so the object is recognized as an async function, and the result " @@ -980,7 +980,7 @@ msgstr "" ":class:`MagicMock` 的非同步版本。:class:`AsyncMock` 物件的表現將被視為非同步" "函式,並且呼叫的結果是一個可等待物件。" -#: ../../library/unittest.mock.rst:886 +#: ../../library/unittest.mock.rst:890 msgid "" "The result of ``mock()`` is an async function which will have the outcome of " "``side_effect`` or ``return_value`` after it has been awaited:" @@ -988,19 +988,19 @@ msgstr "" "``mock()`` 的結果是一個非同步函式,在它被等待後將具有 ``side_effect`` 或 " "``return_value`` 的結果:" -#: ../../library/unittest.mock.rst:889 +#: ../../library/unittest.mock.rst:893 msgid "" "if ``side_effect`` is a function, the async function will return the result " "of that function," msgstr "如果 ``side_effect`` 是一個函式,非同步函式將回傳該函式的結果," -#: ../../library/unittest.mock.rst:891 +#: ../../library/unittest.mock.rst:895 msgid "" "if ``side_effect`` is an exception, the async function will raise the " "exception," msgstr "如果 ``side_effect`` 是一個例外,則非同步函式將引發該例外," -#: ../../library/unittest.mock.rst:893 +#: ../../library/unittest.mock.rst:897 msgid "" "if ``side_effect`` is an iterable, the async function will return the next " "value of the iterable, however, if the sequence of result is exhausted, " @@ -1009,7 +1009,7 @@ msgstr "" "如果 ``side_effect`` 是一個可疊代物件,非同步函式將回傳可疊代物件的下一個值," "但如果結果序列耗盡,將立即引發 ``StopAsyncIteration``," -#: ../../library/unittest.mock.rst:896 +#: ../../library/unittest.mock.rst:900 msgid "" "if ``side_effect`` is not defined, the async function will return the value " "defined by ``return_value``, hence, by default, the async function returns a " @@ -1018,7 +1018,7 @@ msgstr "" "如果 ``side_effect`` 沒有被定義,非同步函式將回傳由 ``return_value`` 定義的" "值,因此在預設情況下,非同步函式回傳一個新的 :class:`AsyncMock` 物件。" -#: ../../library/unittest.mock.rst:901 +#: ../../library/unittest.mock.rst:905 msgid "" "Setting the *spec* of a :class:`Mock` or :class:`MagicMock` to an async " "function will result in a coroutine object being returned after calling." @@ -1026,7 +1026,7 @@ msgstr "" "將 :class:`Mock` 或 :class:`MagicMock` 的 *spec* 設定為非同步函式將導致在呼叫" "後回傳一個協程物件。" -#: ../../library/unittest.mock.rst:913 +#: ../../library/unittest.mock.rst:917 msgid "" "Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, or :class:" "`AsyncMock` to a class with asynchronous and synchronous functions will " @@ -1041,7 +1041,7 @@ msgstr "" "`MagicMock`\\ )或 :class:`Mock`\\ (如果上代 mock 為 :class:`Mock`\\ )。所" "有非同步函式將被設定為 :class:`AsyncMock`。" -#: ../../library/unittest.mock.rst:941 +#: ../../library/unittest.mock.rst:945 msgid "" "Assert that the mock was awaited at least once. Note that this is separate " "from the object having been called, the ``await`` keyword must be used:" @@ -1049,25 +1049,25 @@ msgstr "" "斷言 mock 至少被等待過一次。請注意這與物件是否被呼叫是分開的,``await`` 關鍵" "字必須被使用:" -#: ../../library/unittest.mock.rst:960 +#: ../../library/unittest.mock.rst:964 msgid "Assert that the mock was awaited exactly once." msgstr "斷言 mock 正好被等待了一次。" -#: ../../library/unittest.mock.rst:976 +#: ../../library/unittest.mock.rst:980 msgid "Assert that the last await was with the specified arguments." msgstr "斷言最後一次等待使用了指定的引數。" -#: ../../library/unittest.mock.rst:993 +#: ../../library/unittest.mock.rst:997 msgid "" "Assert that the mock was awaited exactly once and with the specified " "arguments." msgstr "斷言 mock 只被等待了一次並使用了指定的引數。" -#: ../../library/unittest.mock.rst:1010 +#: ../../library/unittest.mock.rst:1014 msgid "Assert the mock has ever been awaited with the specified arguments." msgstr "斷言 mock 曾經被使用指定的引數等待過。" -#: ../../library/unittest.mock.rst:1026 +#: ../../library/unittest.mock.rst:1030 msgid "" "Assert the mock has been awaited with the specified calls. The :attr:" "`await_args_list` list is checked for the awaits." @@ -1075,7 +1075,7 @@ msgstr "" "斷言 mock 已被使用指定的呼叫進行等待。:attr:`await_args_list` 串列將被檢查以" "確認等待的內容。" -#: ../../library/unittest.mock.rst:1029 +#: ../../library/unittest.mock.rst:1033 msgid "" "If *any_order* is false then the awaits must be sequential. There can be " "extra calls before or after the specified awaits." @@ -1083,7 +1083,7 @@ msgstr "" "如果 *any_order* 為 false,則等待必須按照順序。指定的等待之前或之後可以有額外" "的呼叫。" -#: ../../library/unittest.mock.rst:1033 +#: ../../library/unittest.mock.rst:1037 msgid "" "If *any_order* is true then the awaits can be in any order, but they must " "all appear in :attr:`await_args_list`." @@ -1091,11 +1091,11 @@ msgstr "" "如果 *any_order* 為 true,則等待可以以任何順序出現,但它們必須全部出現在 :" "attr:`await_args_list` 中。" -#: ../../library/unittest.mock.rst:1053 +#: ../../library/unittest.mock.rst:1057 msgid "Assert that the mock was never awaited." msgstr "斷言 mock 從未被等待。" -#: ../../library/unittest.mock.rst:1060 +#: ../../library/unittest.mock.rst:1064 msgid "" "See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to 0, :attr:" "`await_args` to None, and clears the :attr:`await_args_list`." @@ -1103,12 +1103,12 @@ msgstr "" "參見 :func:`Mock.reset_mock`。同時將 :attr:`await_count` 設定為 0,:attr:" "`await_args` 設定為 None,並清除 :attr:`await_args_list`。" -#: ../../library/unittest.mock.rst:1065 +#: ../../library/unittest.mock.rst:1069 msgid "" "An integer keeping track of how many times the mock object has been awaited." msgstr "一個整數,用來記錄 mock 物件已被等待的次數。" -#: ../../library/unittest.mock.rst:1080 +#: ../../library/unittest.mock.rst:1084 msgid "" "This is either ``None`` (if the mock hasn’t been awaited), or the arguments " "that the mock was last awaited with. Functions the same as :attr:`Mock." @@ -1117,7 +1117,7 @@ msgstr "" "這可能是 ``None``\\ (如果 mock 尚未被等待),或者是上次等待 mock 時使用的引" "數。與 :attr:`Mock.call_args` 的功能相同。" -#: ../../library/unittest.mock.rst:1098 +#: ../../library/unittest.mock.rst:1102 msgid "" "This is a list of all the awaits made to the mock object in sequence (so the " "length of the list is the number of times it has been awaited). Before any " @@ -1126,11 +1126,60 @@ msgstr "" "這是一個按照順序記錄 mock 物件所有等待的串列(因此串列的長度表示該物件已被等" "待的次數)。在進行任何等待之前,此串列為空。" -#: ../../library/unittest.mock.rst:1117 +#: ../../library/unittest.mock.rst:1122 +msgid "" +"A version of :class:`MagicMock` for multithreading tests. The :class:" +"`ThreadingMock` object provides extra methods to wait for a call to be " +"invoked, rather than assert on it immediately." +msgstr "" + +#: ../../library/unittest.mock.rst:1126 +msgid "" +"The default timeout is specified by the ``timeout`` argument, or if unset by " +"the :attr:`ThreadingMock.DEFAULT_TIMEOUT` attribute, which defaults to " +"blocking (``None``)." +msgstr "" + +#: ../../library/unittest.mock.rst:1129 +msgid "" +"You can configure the global default timeout by setting :attr:`ThreadingMock." +"DEFAULT_TIMEOUT`." +msgstr "" + +#: ../../library/unittest.mock.rst:1133 +#, fuzzy +msgid "Waits until the mock is called." +msgstr "斷言 mock 從未被呼叫。" + +#: ../../library/unittest.mock.rst:1135 +msgid "" +"If a timeout was passed at the creation of the mock or if a timeout argument " +"is passed to this function, the function raises an :exc:`AssertionError` if " +"the call is not performed in time." +msgstr "" + +#: ../../library/unittest.mock.rst:1147 +#, fuzzy +msgid "Waits until the mock is called with the specified arguments." +msgstr "斷言 mock 已經被使用指定的引數呼叫。" + +#: ../../library/unittest.mock.rst:1149 +msgid "" +"If a timeout was passed at the creation of the mock the function raises an :" +"exc:`AssertionError` if the call is not performed in time." +msgstr "" + +#: ../../library/unittest.mock.rst:1160 +msgid "" +"Global default timeout in seconds to create instances of :class:" +"`ThreadingMock`." +msgstr "" + +#: ../../library/unittest.mock.rst:1166 msgid "Calling" msgstr "呼叫" -#: ../../library/unittest.mock.rst:1119 +#: ../../library/unittest.mock.rst:1168 msgid "" "Mock objects are callable. The call will return the value set as the :attr:" "`~Mock.return_value` attribute. The default return value is a new Mock " @@ -1142,7 +1191,7 @@ msgstr "" "的回傳值是一個新的 Mock 物件;它會在第一次存取回傳值時(無論是顯式存取還是透" "過呼叫 Mock)被建立,但是這個回傳值會被儲存,之後每次都回傳同一個值。" -#: ../../library/unittest.mock.rst:1125 +#: ../../library/unittest.mock.rst:1174 msgid "" "Calls made to the object will be recorded in the attributes like :attr:" "`~Mock.call_args` and :attr:`~Mock.call_args_list`." @@ -1150,7 +1199,7 @@ msgstr "" "對物件的呼叫會被記錄在如 :attr:`~Mock.call_args` 和 :attr:`~Mock." "call_args_list` 等屬性中。" -#: ../../library/unittest.mock.rst:1128 +#: ../../library/unittest.mock.rst:1177 msgid "" "If :attr:`~Mock.side_effect` is set then it will be called after the call " "has been recorded, so if :attr:`side_effect` raises an exception the call is " @@ -1159,7 +1208,7 @@ msgstr "" "如果 :attr:`~Mock.side_effect` 被設定,那麼在呼叫被記錄後它才會被呼叫,所以如" "果 :attr:`side_effect` 引發例外,呼叫仍然會被記錄。" -#: ../../library/unittest.mock.rst:1132 +#: ../../library/unittest.mock.rst:1181 msgid "" "The simplest way to make a mock raise an exception when called is to make :" "attr:`~Mock.side_effect` an exception class or instance:" @@ -1167,7 +1216,7 @@ msgstr "" "呼叫 mock 時引發例外的最簡單方式是將 :attr:`~Mock.side_effect` 設定為例外類別" "或實例:" -#: ../../library/unittest.mock.rst:1150 +#: ../../library/unittest.mock.rst:1199 msgid "" "If :attr:`side_effect` is a function then whatever that function returns is " "what calls to the mock return. The :attr:`side_effect` function is called " @@ -1178,7 +1227,7 @@ msgstr "" "傳的值。:attr:`side_effect` 函式會使用與 mock 相同的引數被呼叫。這讓你可以根" "據輸入動態地變更呼叫的回傳值:" -#: ../../library/unittest.mock.rst:1166 +#: ../../library/unittest.mock.rst:1215 msgid "" "If you want the mock to still return the default return value (a new mock), " "or any set return value, then there are two ways of doing this. Either " @@ -1189,7 +1238,7 @@ msgstr "" "值,有兩種方法可以實現。從 :attr:`side_effect` 內部回傳 :attr:`mock." "return_value`,或回傳 :data:`DEFAULT`:" -#: ../../library/unittest.mock.rst:1185 +#: ../../library/unittest.mock.rst:1234 msgid "" "To remove a :attr:`side_effect`, and return to the default behaviour, set " "the :attr:`side_effect` to ``None``:" @@ -1197,7 +1246,7 @@ msgstr "" "要刪除 :attr:`side_effect`,並恢復預設行為,將 :attr:`side_effect` 設為 " "``None``:" -#: ../../library/unittest.mock.rst:1199 +#: ../../library/unittest.mock.rst:1248 msgid "" "The :attr:`side_effect` can also be any iterable object. Repeated calls to " "the mock will return values from the iterable (until the iterable is " @@ -1206,13 +1255,13 @@ msgstr "" ":attr:`side_effect` 也可以是任何可疊代的物件。對 mock 的重複呼叫將從可疊代物" "件中回傳值(直到疊代物件耗盡並引發 :exc:`StopIteration` 為止):" -#: ../../library/unittest.mock.rst:1215 +#: ../../library/unittest.mock.rst:1264 msgid "" "If any members of the iterable are exceptions they will be raised instead of " "returned::" msgstr "如果可疊代物件中的任何成員是例外,則它們將被引發而不是被回傳: ::" -#: ../../library/unittest.mock.rst:1218 +#: ../../library/unittest.mock.rst:1267 msgid "" ">>> iterable = (33, ValueError, 66)\n" ">>> m = MagicMock(side_effect=iterable)\n" @@ -1236,17 +1285,17 @@ msgstr "" ">>> m()\n" "66" -#: ../../library/unittest.mock.rst:1233 +#: ../../library/unittest.mock.rst:1282 msgid "Deleting Attributes" msgstr "刪除屬性" -#: ../../library/unittest.mock.rst:1235 +#: ../../library/unittest.mock.rst:1284 msgid "" "Mock objects create attributes on demand. This allows them to pretend to be " "objects of any type." msgstr "Mock 物件會在需要時建立屬性。這使得它們可以假裝成任何種類的物件。" -#: ../../library/unittest.mock.rst:1238 +#: ../../library/unittest.mock.rst:1287 msgid "" "You may want a mock object to return ``False`` to a :func:`hasattr` call, or " "raise an :exc:`AttributeError` when an attribute is fetched. You can do this " @@ -1257,7 +1306,7 @@ msgstr "" "提取時引發 :exc:`AttributeError`。你可以通過將物件提供為 mock 的 :attr:" "`spec` 來實現這一點,但這並不總是那麼好用。" -#: ../../library/unittest.mock.rst:1242 +#: ../../library/unittest.mock.rst:1291 msgid "" "You \"block\" attributes by deleting them. Once deleted, accessing an " "attribute will raise an :exc:`AttributeError`." @@ -1265,11 +1314,11 @@ msgstr "" "你可以通過刪除屬性來「阻擋」它們。一旦刪除,再次存取該屬性將會引發 :exc:" "`AttributeError`。" -#: ../../library/unittest.mock.rst:1259 +#: ../../library/unittest.mock.rst:1308 msgid "Mock names and the name attribute" msgstr "Mock 名稱與名稱屬性" -#: ../../library/unittest.mock.rst:1261 +#: ../../library/unittest.mock.rst:1310 msgid "" "Since \"name\" is an argument to the :class:`Mock` constructor, if you want " "your mock object to have a \"name\" attribute you can't just pass it in at " @@ -1280,7 +1329,7 @@ msgstr "" "擁有 \"name\" 屬性,你不能在建立時直接傳遞它。有兩種替代方法。其中一個選擇是" "使用 :meth:`~Mock.configure_mock`: ::" -#: ../../library/unittest.mock.rst:1266 +#: ../../library/unittest.mock.rst:1315 msgid "" ">>> mock = MagicMock()\n" ">>> mock.configure_mock(name='my_name')\n" @@ -1292,13 +1341,13 @@ msgstr "" ">>> mock.name\n" "'my_name'" -#: ../../library/unittest.mock.rst:1271 +#: ../../library/unittest.mock.rst:1320 msgid "" "A simpler option is to simply set the \"name\" attribute after mock " "creation::" msgstr "更簡單的方法是在 mock 建立後直接設定 \"name\" 屬性: ::" -#: ../../library/unittest.mock.rst:1273 +#: ../../library/unittest.mock.rst:1322 msgid "" ">>> mock = MagicMock()\n" ">>> mock.name = \"foo\"" @@ -1306,11 +1355,11 @@ msgstr "" ">>> mock = MagicMock()\n" ">>> mock.name = \"foo\"" -#: ../../library/unittest.mock.rst:1278 +#: ../../library/unittest.mock.rst:1327 msgid "Attaching Mocks as Attributes" msgstr "如同屬性一般附加 mock" -#: ../../library/unittest.mock.rst:1280 +#: ../../library/unittest.mock.rst:1329 msgid "" "When you attach a mock as an attribute of another mock (or as the return " "value) it becomes a \"child\" of that mock. Calls to the child are recorded " @@ -1326,7 +1375,7 @@ msgstr "" "mock 附加到記錄所有對子代的呼叫的上代並允許你對 mock 間的呼叫順序進行斷言非常" "有用:" -#: ../../library/unittest.mock.rst:1298 +#: ../../library/unittest.mock.rst:1347 msgid "" "The exception to this is if the mock has a name. This allows you to prevent " "the \"parenting\" if for some reason you don't want it to happen." @@ -1334,7 +1383,7 @@ msgstr "" "如果 mock 有 name 引數,則上述規則會有例外。這使你可以防止「親屬關係 " "(parenting)」的建立,假設因為某些原因你不希望這種狀況發生。" -#: ../../library/unittest.mock.rst:1309 +#: ../../library/unittest.mock.rst:1358 msgid "" "Mocks created for you by :func:`patch` are automatically given names. To " "attach mocks that have names to a parent you use the :meth:`~Mock." @@ -1343,7 +1392,7 @@ msgstr "" "由 :func:`patch` 為你建立的 mock 會自動被賦予名稱。若要將具有名稱的 mock 附加" "到上代,你可以使用 :meth:`~Mock.attach_mock` 方法: ::" -#: ../../library/unittest.mock.rst:1313 +#: ../../library/unittest.mock.rst:1362 msgid "" ">>> thing1 = object()\n" ">>> thing2 = object()\n" @@ -1371,7 +1420,7 @@ msgstr "" ">>> parent.mock_calls\n" "[call.child1('one'), call.child2('two')]" -#: ../../library/unittest.mock.rst:1327 +#: ../../library/unittest.mock.rst:1376 msgid "" "The only exceptions are magic methods and attributes (those that have " "leading and trailing double underscores). Mock doesn't create these but " @@ -1385,11 +1434,11 @@ msgstr "" "魔術方法卻獲得一個新的 Mock 物件時,會讓直譯器\\ *非常*\\ 困惑。如果你需要魔" "術方法的支援,請參閱\\ :ref:`魔術方法 `。" -#: ../../library/unittest.mock.rst:1336 +#: ../../library/unittest.mock.rst:1385 msgid "The patchers" msgstr "Patchers" -#: ../../library/unittest.mock.rst:1338 +#: ../../library/unittest.mock.rst:1387 msgid "" "The patch decorators are used for patching objects only within the scope of " "the function they decorate. They automatically handle the unpatching for " @@ -1400,17 +1449,17 @@ msgstr "" "patch 的中止,即使有異常被引發也是如此。所有這些函式也可以在 with 陳述式中使" "用,或者作為類別裝飾器使用。" -#: ../../library/unittest.mock.rst:1345 +#: ../../library/unittest.mock.rst:1394 msgid "patch" msgstr "patch" -#: ../../library/unittest.mock.rst:1349 +#: ../../library/unittest.mock.rst:1398 msgid "" "The key is to do the patching in the right namespace. See the section `where " "to patch`_." msgstr "關鍵是要在正確的命名空間進行 patch。請參閱 `where to patch`_ 一節。" -#: ../../library/unittest.mock.rst:1353 +#: ../../library/unittest.mock.rst:1402 msgid "" ":func:`patch` acts as a function decorator, class decorator or a context " "manager. Inside the body of the function or with statement, the *target* is " @@ -1421,7 +1470,7 @@ msgstr "" "內部,*目標*\\ 會被 patch 成一個\\ *新的*\\ 物件。當函式或 with 陳述式結束" "時,patch 就會被解除。" -#: ../../library/unittest.mock.rst:1358 +#: ../../library/unittest.mock.rst:1407 msgid "" "If *new* is omitted, then the target is replaced with an :class:`AsyncMock` " "if the patched object is an async function or a :class:`MagicMock` " @@ -1435,7 +1484,7 @@ msgstr "" "用且省略了 *new*,則所建立的 mock 會作為額外的引數傳遞給被裝飾的函式。如果 :" "func:`patch` 作為情境管理器使用,則所建立的 mock 將由情境管理器回傳。" -#: ../../library/unittest.mock.rst:1366 +#: ../../library/unittest.mock.rst:1415 msgid "" "*target* should be a string in the form ``'package.module.ClassName'``. The " "*target* is imported and the specified object replaced with the *new* " @@ -1448,7 +1497,7 @@ msgstr "" "`patch` 的環境中引入。target 在執行被裝飾的函式時被引入,而不是在裝飾器作用" "時 (decoration time)。" -#: ../../library/unittest.mock.rst:1372 +#: ../../library/unittest.mock.rst:1421 msgid "" "The *spec* and *spec_set* keyword arguments are passed to the :class:" "`MagicMock` if patch is creating one for you." @@ -1456,7 +1505,7 @@ msgstr "" "*spec* 和 *spec_set* 關鍵字引數會傳遞給 :class:`MagicMock`,如果 patch 正在為" "你建立一個。" -#: ../../library/unittest.mock.rst:1375 +#: ../../library/unittest.mock.rst:1424 msgid "" "In addition you can pass ``spec=True`` or ``spec_set=True``, which causes " "patch to pass in the object being mocked as the spec/spec_set object." @@ -1464,7 +1513,7 @@ msgstr "" "此外,你還可以傳遞 ``spec=True`` 或 ``spec_set=True``,這將導致 patch 將被 " "mock 的物件作為 spec/spec_set 物件傳遞。" -#: ../../library/unittest.mock.rst:1378 +#: ../../library/unittest.mock.rst:1427 msgid "" "*new_callable* allows you to specify a different class, or callable object, " "that will be called to create the *new* object. By default :class:" @@ -1474,7 +1523,7 @@ msgstr "" "*new* 物件。預設情況下,對於非同步函式使用 :class:`AsyncMock`,而對於其他情況" "則使用 :class:`MagicMock`。" -#: ../../library/unittest.mock.rst:1382 +#: ../../library/unittest.mock.rst:1431 msgid "" "A more powerful form of *spec* is *autospec*. If you set ``autospec=True`` " "then the mock will be created with a spec from the object being replaced. " @@ -1492,7 +1541,7 @@ msgstr "" "mock,它們的回傳值(即 'instance')將具有與類別相同的規格。請參閱 :func:" "`create_autospec` 函式和 :ref:`auto-speccing`。" -#: ../../library/unittest.mock.rst:1392 +#: ../../library/unittest.mock.rst:1441 msgid "" "Instead of ``autospec=True`` you can pass ``autospec=some_object`` to use an " "arbitrary object as the spec instead of the one being replaced." @@ -1500,7 +1549,7 @@ msgstr "" "你可以用 ``autospec=some_object`` 替代 ``autospec=True``,以使用任意物件作為" "規格,而不是被替換的物件。" -#: ../../library/unittest.mock.rst:1395 +#: ../../library/unittest.mock.rst:1444 msgid "" "By default :func:`patch` will fail to replace attributes that don't exist. " "If you pass in ``create=True``, and the attribute doesn't exist, patch will " @@ -1516,7 +1565,7 @@ msgstr "" "行環境建立的屬性的測試時非常有用。此功能預設為關閉,因為這可能會相當危險。開" "啟這個功能後,你可以對於實際上不存在的 API 撰寫會通過的測試!" -#: ../../library/unittest.mock.rst:1405 +#: ../../library/unittest.mock.rst:1454 msgid "" "If you are patching builtins in a module then you don't need to pass " "``create=True``, it will be added by default." @@ -1524,7 +1573,7 @@ msgstr "" "如果你正在 patch 模組中的內建函式,那麼你不需要傳遞 ``create=True``,它預設會" "被加入。" -#: ../../library/unittest.mock.rst:1409 +#: ../../library/unittest.mock.rst:1458 msgid "" "Patch can be used as a :class:`TestCase` class decorator. It works by " "decorating each test method in the class. This reduces the boilerplate code " @@ -1540,7 +1589,7 @@ msgstr "" "是 ``'test'``,這與 :mod:`unittest` 尋找測試的方式相匹配。你可以通過設定 " "``patch.TEST_PREFIX`` 來指定別的前綴。" -#: ../../library/unittest.mock.rst:1416 +#: ../../library/unittest.mock.rst:1465 msgid "" "Patch can be used as a context manager, with the with statement. Here the " "patching applies to the indented block after the with statement. If you use " @@ -1551,7 +1600,7 @@ msgstr "" "的縮排區塊。如果你使用 \"as\",則被 patch 的物件將被綁定到 \"as\" 後面的名" "稱;如果 :func:`patch` 正在為你建立一個 mock 物件,這會非常有用。" -#: ../../library/unittest.mock.rst:1421 +#: ../../library/unittest.mock.rst:1470 msgid "" ":func:`patch` takes arbitrary keyword arguments. These will be passed to :" "class:`AsyncMock` if the patched object is asynchronous, to :class:" @@ -1561,7 +1610,7 @@ msgstr "" "傳遞給 :class:`AsyncMock`,如果是同步的則會傳遞給 :class:`MagicMock`,或如果" "指定了 *new_callable*,則傳遞給它。" -#: ../../library/unittest.mock.rst:1425 +#: ../../library/unittest.mock.rst:1474 msgid "" "``patch.dict(...)``, ``patch.multiple(...)`` and ``patch.object(...)`` are " "available for alternate use-cases." @@ -1569,14 +1618,14 @@ msgstr "" "``patch.dict(...)``、``patch.multiple(...)`` 和 ``patch.object(...)`` 可用於" "其餘的使用情境。" -#: ../../library/unittest.mock.rst:1428 +#: ../../library/unittest.mock.rst:1477 msgid "" ":func:`patch` as function decorator, creating the mock for you and passing " "it into the decorated function::" msgstr "" ":func:`patch` 作為函式裝飾器,為你建立 mock 並將其傳遞給被裝飾的函式: ::" -#: ../../library/unittest.mock.rst:1431 +#: ../../library/unittest.mock.rst:1480 msgid "" ">>> @patch('__main__.SomeClass')\n" "... def function(normal_argument, mock_class):\n" @@ -1592,7 +1641,7 @@ msgstr "" ">>> function(None)\n" "True" -#: ../../library/unittest.mock.rst:1438 +#: ../../library/unittest.mock.rst:1487 msgid "" "Patching a class replaces the class with a :class:`MagicMock` *instance*. If " "the class is instantiated in the code under test then it will be the :attr:" @@ -1602,7 +1651,7 @@ msgstr "" "測試的程式碼中實例化,那麼它將是會被使用的 mock 的 :attr:`~Mock." "return_value`。" -#: ../../library/unittest.mock.rst:1442 +#: ../../library/unittest.mock.rst:1491 msgid "" "If the class is instantiated multiple times you could use :attr:`~Mock." "side_effect` to return a new mock each time. Alternatively you can set the " @@ -1611,7 +1660,7 @@ msgstr "" "如果該類別被實例化多次,你可以使用 :attr:`~Mock.side_effect` 來每次回傳一個新" "的 mock。 或者你可以將 *return_value* 設定成你想要的任何值。" -#: ../../library/unittest.mock.rst:1446 +#: ../../library/unittest.mock.rst:1495 msgid "" "To configure return values on methods of *instances* on the patched class " "you must do this on the :attr:`return_value`. For example::" @@ -1619,7 +1668,7 @@ msgstr "" "若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須在 :attr:" "`return_value` 上進行配置。 例如: ::" -#: ../../library/unittest.mock.rst:1449 +#: ../../library/unittest.mock.rst:1498 msgid "" ">>> class Class:\n" "... def method(self):\n" @@ -1643,7 +1692,7 @@ msgstr "" "... assert Class().method() == 'foo'\n" "..." -#: ../../library/unittest.mock.rst:1460 +#: ../../library/unittest.mock.rst:1509 msgid "" "If you use *spec* or *spec_set* and :func:`patch` is replacing a *class*, " "then the return value of the created mock will have the same spec. ::" @@ -1651,7 +1700,7 @@ msgstr "" "如果你使用 *spec* 或 *spec_set* 且 :func:`patch` 正在取代一個\\ *類別*,那麼" "被建立的 mock 的回傳值將具有相同的規格。: ::" -#: ../../library/unittest.mock.rst:1463 +#: ../../library/unittest.mock.rst:1512 msgid "" ">>> Original = Class\n" ">>> patcher = patch('__main__.Class', spec=True)\n" @@ -1667,7 +1716,7 @@ msgstr "" ">>> assert isinstance(instance, Original)\n" ">>> patcher.stop()" -#: ../../library/unittest.mock.rst:1470 +#: ../../library/unittest.mock.rst:1519 msgid "" "The *new_callable* argument is useful where you want to use an alternative " "class to the default :class:`MagicMock` for the created mock. For example, " @@ -1677,7 +1726,7 @@ msgstr "" "*new_callable* 引數非常有用。例如,如果你想要一個 :class:`NonCallableMock` 被" "使用: ::" -#: ../../library/unittest.mock.rst:1474 +#: ../../library/unittest.mock.rst:1523 msgid "" ">>> thing = object()\n" ">>> with patch('__main__.thing', new_callable=NonCallableMock) as " @@ -1699,13 +1748,13 @@ msgstr "" " ...\n" "TypeError: 'NonCallableMock' object is not callable" -#: ../../library/unittest.mock.rst:1483 +#: ../../library/unittest.mock.rst:1532 msgid "" "Another use case might be to replace an object with an :class:`io.StringIO` " "instance::" msgstr "另一個用法是用一個 :class:`io.StringIO` 實例替換一個物件: ::" -#: ../../library/unittest.mock.rst:1485 +#: ../../library/unittest.mock.rst:1534 msgid "" ">>> from io import StringIO\n" ">>> def foo():\n" @@ -1729,7 +1778,7 @@ msgstr "" "...\n" ">>> test()" -#: ../../library/unittest.mock.rst:1496 +#: ../../library/unittest.mock.rst:1545 msgid "" "When :func:`patch` is creating a mock for you, it is common that the first " "thing you need to do is to configure the mock. Some of that configuration " @@ -1740,7 +1789,7 @@ msgstr "" "一些配置可以在對 patch 的呼叫中完成。你傳遞到呼叫中的任何關鍵字都將用於在被建" "立的 mock 上設定屬性: ::" -#: ../../library/unittest.mock.rst:1501 +#: ../../library/unittest.mock.rst:1550 msgid "" ">>> patcher = patch('__main__.thing', first='one', second='two')\n" ">>> mock_thing = patcher.start()\n" @@ -1756,7 +1805,7 @@ msgstr "" ">>> mock_thing.second\n" "'two'" -#: ../../library/unittest.mock.rst:1508 +#: ../../library/unittest.mock.rst:1557 msgid "" "As well as attributes on the created mock attributes, like the :attr:`~Mock." "return_value` and :attr:`~Mock.side_effect`, of child mocks can also be " @@ -1769,7 +1818,7 @@ msgstr "" "數傳入,但是以它們作為鍵的字典仍然可以使用 ``**`` 擴充為一個 :func:`patch` 呼" "叫: ::" -#: ../../library/unittest.mock.rst:1514 +#: ../../library/unittest.mock.rst:1563 msgid "" ">>> config = {'method.return_value': 3, 'other.side_effect': KeyError}\n" ">>> patcher = patch('__main__.thing', **config)\n" @@ -1791,7 +1840,7 @@ msgstr "" " ...\n" "KeyError" -#: ../../library/unittest.mock.rst:1524 +#: ../../library/unittest.mock.rst:1573 msgid "" "By default, attempting to patch a function in a module (or a method or an " "attribute in a class) that does not exist will fail with :exc:" @@ -1800,7 +1849,7 @@ msgstr "" "預設情況下,嘗試 patch 模組中不存在的函式(或類別中的方法或屬性)將會失敗,並" "引發 :exc:`AttributeError`: ::" -#: ../../library/unittest.mock.rst:1527 +#: ../../library/unittest.mock.rst:1576 msgid "" ">>> @patch('sys.non_existing_attribute', 42)\n" "... def test():\n" @@ -1822,7 +1871,7 @@ msgstr "" "AttributeError: does not have the attribute " "'non_existing_attribute'" -#: ../../library/unittest.mock.rst:1536 +#: ../../library/unittest.mock.rst:1585 msgid "" "but adding ``create=True`` in the call to :func:`patch` will make the " "previous example work as expected::" @@ -1830,7 +1879,7 @@ msgstr "" "但是在對 :func:`patch` 的呼叫中增加 ``create=True`` 將使前面的範例按照預期運" "作: ::" -#: ../../library/unittest.mock.rst:1539 +#: ../../library/unittest.mock.rst:1588 msgid "" ">>> @patch('sys.non_existing_attribute', 42, create=True)\n" "... def test(mock_stdout):\n" @@ -1844,18 +1893,18 @@ msgstr "" "...\n" ">>> test()" -#: ../../library/unittest.mock.rst:1547 +#: ../../library/unittest.mock.rst:1596 msgid "" ":func:`patch` now returns an :class:`AsyncMock` if the target is an async " "function." msgstr "" "如果目標是一個非同步函式,:func:`patch` 現在會回傳一個 :class:`AsyncMock`。" -#: ../../library/unittest.mock.rst:1551 +#: ../../library/unittest.mock.rst:1600 msgid "patch.object" msgstr "patch.object" -#: ../../library/unittest.mock.rst:1555 +#: ../../library/unittest.mock.rst:1604 msgid "" "patch the named member (*attribute*) on an object (*target*) with a mock " "object." @@ -1863,7 +1912,7 @@ msgstr "" "使用一個 mock 物件 patch 一個物件(\\ *目標*\\ )上的命名成員(\\ *屬性" "*\\ )。" -#: ../../library/unittest.mock.rst:1558 +#: ../../library/unittest.mock.rst:1607 msgid "" ":func:`patch.object` can be used as a decorator, class decorator or a " "context manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* " @@ -1876,7 +1925,7 @@ msgstr "" "`patch` 中的引數具有相同的意義。與 :func:`patch` 一樣,:func:`patch.object` " "接受任意關鍵字引數來配置它所建立的 mock 物件。" -#: ../../library/unittest.mock.rst:1564 +#: ../../library/unittest.mock.rst:1613 msgid "" "When used as a class decorator :func:`patch.object` honours ``patch." "TEST_PREFIX`` for choosing which methods to wrap." @@ -1884,7 +1933,7 @@ msgstr "" "當作為類別裝飾器使用時,:func:`patch.object` 會遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" -#: ../../library/unittest.mock.rst:1567 +#: ../../library/unittest.mock.rst:1616 msgid "" "You can either call :func:`patch.object` with three arguments or two " "arguments. The three argument form takes the object to be patched, the " @@ -1893,7 +1942,7 @@ msgstr "" "你可以使用三個引數或兩個引數來呼叫 :func:`patch.object`。三個引數的形式接受要" "被 patch 的物件、屬性名稱和要替換掉屬性的物件。" -#: ../../library/unittest.mock.rst:1571 +#: ../../library/unittest.mock.rst:1620 msgid "" "When calling with the two argument form you omit the replacement object, and " "a mock is created for you and passed in as an extra argument to the " @@ -1902,7 +1951,7 @@ msgstr "" "當使用兩個引數的形式呼叫時,你會省略要替換的物件,一個 mock 會為你建立並將其" "作為額外的引數傳遞給被裝飾的函式:" -#: ../../library/unittest.mock.rst:1582 +#: ../../library/unittest.mock.rst:1631 msgid "" "*spec*, *create* and the other arguments to :func:`patch.object` have the " "same meaning as they do for :func:`patch`." @@ -1910,17 +1959,17 @@ msgstr "" "*spec*、*create* 和 :func:`patch.object` 的其他引數與在 :func:`patch` 中的引" "數具有相同的意義。" -#: ../../library/unittest.mock.rst:1587 +#: ../../library/unittest.mock.rst:1636 msgid "patch.dict" msgstr "patch.dict" -#: ../../library/unittest.mock.rst:1591 +#: ../../library/unittest.mock.rst:1640 msgid "" "Patch a dictionary, or dictionary like object, and restore the dictionary to " "its original state after the test." msgstr "Patch 字典或類字典的物件,並在測試後將字典回復到其原本的狀態。" -#: ../../library/unittest.mock.rst:1594 +#: ../../library/unittest.mock.rst:1643 msgid "" "*in_dict* can be a dictionary or a mapping like container. If it is a " "mapping then it must at least support getting, setting and deleting items " @@ -1929,13 +1978,13 @@ msgstr "" "*in_dict* 可以是一個字典或一個類對映的容器。如果它是一個對映,那麼它至少必須" "支援獲取、設定、刪除項目以及對鍵的疊代。" -#: ../../library/unittest.mock.rst:1598 +#: ../../library/unittest.mock.rst:1647 msgid "" "*in_dict* can also be a string specifying the name of the dictionary, which " "will then be fetched by importing it." msgstr "*in_dict* 也可以是指定字典名稱的字串,然後透過 import 來取得該字典。" -#: ../../library/unittest.mock.rst:1601 +#: ../../library/unittest.mock.rst:1650 msgid "" "*values* can be a dictionary of values to set in the dictionary. *values* " "can also be an iterable of ``(key, value)`` pairs." @@ -1943,31 +1992,31 @@ msgstr "" "*values* 可以是要設定的值的字典。*values* 也可以是 ``(key, value)`` 對 " "(pairs) 的可疊代物件。" -#: ../../library/unittest.mock.rst:1604 +#: ../../library/unittest.mock.rst:1653 msgid "" "If *clear* is true then the dictionary will be cleared before the new values " "are set." msgstr "如果 *clear* 為 true,則在設定新值之前字典將被清除。" -#: ../../library/unittest.mock.rst:1607 +#: ../../library/unittest.mock.rst:1656 msgid "" ":func:`patch.dict` can also be called with arbitrary keyword arguments to " "set values in the dictionary." msgstr "也可以使用任意關鍵字引數呼叫 :func:`patch.dict` 以在字典中設定值。" -#: ../../library/unittest.mock.rst:1612 +#: ../../library/unittest.mock.rst:1661 msgid "" ":func:`patch.dict` now returns the patched dictionary when used as a context " "manager." msgstr ":func:`patch.dict` 現在在做為情境管理器使用時回傳被 patch 的字典。" -#: ../../library/unittest.mock.rst:1615 +#: ../../library/unittest.mock.rst:1664 msgid "" ":func:`patch.dict` can be used as a context manager, decorator or class " "decorator:" msgstr ":func:`patch.dict` 可以做為情境管理器、裝飾器或類別裝飾器使用:" -#: ../../library/unittest.mock.rst:1626 +#: ../../library/unittest.mock.rst:1675 msgid "" "When used as a class decorator :func:`patch.dict` honours ``patch." "TEST_PREFIX`` (default to ``'test'``) for choosing which methods to wrap:" @@ -1975,7 +2024,7 @@ msgstr "" "當作為類別裝飾器使用時,:func:`patch.dict` 會遵循 ``patch.TEST_PREFIX``\\ " "(預設為 ``'test'``\\ )來選擇要包裝的方法:" -#: ../../library/unittest.mock.rst:1637 +#: ../../library/unittest.mock.rst:1686 msgid "" "If you want to use a different prefix for your test, you can inform the " "patchers of the different prefix by setting ``patch.TEST_PREFIX``. For more " @@ -1985,7 +2034,7 @@ msgstr "" "patcher 使用不同的前綴。請參閱 :ref:`test-prefix` 以得知如何修改前綴的更多內" "容。" -#: ../../library/unittest.mock.rst:1641 +#: ../../library/unittest.mock.rst:1690 msgid "" ":func:`patch.dict` can be used to add members to a dictionary, or simply let " "a test change a dictionary, and ensure the dictionary is restored when the " @@ -1994,13 +2043,13 @@ msgstr "" ":func:`patch.dict` 可用於在字典中新增成員,或單純地讓測試更改字典,並確保在測" "試結束時將字典回復原狀。" -#: ../../library/unittest.mock.rst:1662 +#: ../../library/unittest.mock.rst:1711 msgid "" "Keywords can be used in the :func:`patch.dict` call to set values in the " "dictionary:" msgstr "可以在 :func:`patch.dict` 呼叫中使用關鍵字來設定字典中的值:" -#: ../../library/unittest.mock.rst:1672 +#: ../../library/unittest.mock.rst:1721 msgid "" ":func:`patch.dict` can be used with dictionary like objects that aren't " "actually dictionaries. At the very minimum they must support item getting, " @@ -2015,11 +2064,11 @@ msgstr "" "__delitem__` 以及 :meth:`~container.__iter__` 或 :meth:`~object." "__contains__`。" -#: ../../library/unittest.mock.rst:1702 +#: ../../library/unittest.mock.rst:1751 msgid "patch.multiple" msgstr "patch.multiple" -#: ../../library/unittest.mock.rst:1706 +#: ../../library/unittest.mock.rst:1755 msgid "" "Perform multiple patches in a single call. It takes the object to be patched " "(either as an object or a string to fetch the object by importing) and " @@ -2028,7 +2077,7 @@ msgstr "" "在一次呼叫中執行多個 patch。它接受被 patch 的物件(作為物件或透過 import 取得" "物件的字串)和 patch 的關鍵字引數: ::" -#: ../../library/unittest.mock.rst:1710 +#: ../../library/unittest.mock.rst:1759 msgid "" "with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):\n" " ..." @@ -2036,7 +2085,7 @@ msgstr "" "with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):\n" " ..." -#: ../../library/unittest.mock.rst:1713 +#: ../../library/unittest.mock.rst:1762 msgid "" "Use :data:`DEFAULT` as the value if you want :func:`patch.multiple` to " "create mocks for you. In this case the created mocks are passed into a " @@ -2047,7 +2096,7 @@ msgstr "" "值。在這種情況下,被建立的 mock 會透過關鍵字傳遞到被裝飾的函式中,並且當 :" "func:`patch.multiple` 作為情境管理器時會回傳字典。" -#: ../../library/unittest.mock.rst:1718 +#: ../../library/unittest.mock.rst:1767 msgid "" ":func:`patch.multiple` can be used as a decorator, class decorator or a " "context manager. The arguments *spec*, *spec_set*, *create*, *autospec* and " @@ -2059,7 +2108,7 @@ msgstr "" "`patch` 中的引數具有相同的意義。這些引數將應用於由 :func:`patch.multiple` 完" "成的\\ *所有* patch。" -#: ../../library/unittest.mock.rst:1723 +#: ../../library/unittest.mock.rst:1772 msgid "" "When used as a class decorator :func:`patch.multiple` honours ``patch." "TEST_PREFIX`` for choosing which methods to wrap." @@ -2067,7 +2116,7 @@ msgstr "" "當作為類別裝飾器使用時,:func:`patch.multiple` 遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" -#: ../../library/unittest.mock.rst:1726 +#: ../../library/unittest.mock.rst:1775 msgid "" "If you want :func:`patch.multiple` to create mocks for you, then you can " "use :data:`DEFAULT` as the value. If you use :func:`patch.multiple` as a " @@ -2078,7 +2127,7 @@ msgstr "" "`DEFAULT` 作為值。如果你使用 :func:`patch.multiple` 作為裝飾器,那麼被建立的 " "mock 將透過關鍵字傳遞到被裝飾的函式中。: ::" -#: ../../library/unittest.mock.rst:1730 +#: ../../library/unittest.mock.rst:1779 msgid "" ">>> thing = object()\n" ">>> other = object()\n" @@ -2100,7 +2149,7 @@ msgstr "" "...\n" ">>> test_function()" -#: ../../library/unittest.mock.rst:1740 +#: ../../library/unittest.mock.rst:1789 msgid "" ":func:`patch.multiple` can be nested with other ``patch`` decorators, but " "put arguments passed by keyword *after* any of the standard arguments " @@ -2109,7 +2158,7 @@ msgstr "" ":func:`patch.multiple` 可以與其他 ``patch`` 裝飾器巢狀使用,但需要將透過關鍵" "字傳遞的引數放在 :func:`patch` 建立的任何標準引數\\ *之後*: ::" -#: ../../library/unittest.mock.rst:1743 +#: ../../library/unittest.mock.rst:1792 msgid "" ">>> @patch('sys.exit')\n" "... @patch.multiple('__main__', thing=DEFAULT, other=DEFAULT)\n" @@ -2129,7 +2178,7 @@ msgstr "" "...\n" ">>> test_function()" -#: ../../library/unittest.mock.rst:1752 +#: ../../library/unittest.mock.rst:1801 msgid "" "If :func:`patch.multiple` is used as a context manager, the value returned " "by the context manager is a dictionary where created mocks are keyed by " @@ -2138,7 +2187,7 @@ msgstr "" "如果 :func:`patch.multiple` 作為情境管理器使用,則情境管理器回傳的值是一個字" "典,其中被建立的 mock 會按名稱作為其鍵值: ::" -#: ../../library/unittest.mock.rst:1755 +#: ../../library/unittest.mock.rst:1804 msgid "" ">>> with patch.multiple('__main__', thing=DEFAULT, other=DEFAULT) as " "values:\n" @@ -2156,11 +2205,11 @@ msgstr "" "... assert values['other'] is other\n" "..." -#: ../../library/unittest.mock.rst:1766 +#: ../../library/unittest.mock.rst:1815 msgid "patch methods: start and stop" msgstr "patch 方法:啟動與停止" -#: ../../library/unittest.mock.rst:1768 +#: ../../library/unittest.mock.rst:1817 msgid "" "All the patchers have :meth:`start` and :meth:`stop` methods. These make it " "simpler to do patching in ``setUp`` methods or where you want to do multiple " @@ -2170,7 +2219,7 @@ msgstr "" "法中進行 patch 或在你想要在沒有巢狀使用裝飾器或 with 陳述式的情況下進行多個 " "patch 時變得更簡單。" -#: ../../library/unittest.mock.rst:1772 +#: ../../library/unittest.mock.rst:1821 msgid "" "To use them call :func:`patch`, :func:`patch.object` or :func:`patch.dict` " "as normal and keep a reference to the returned ``patcher`` object. You can " @@ -2181,7 +2230,7 @@ msgstr "" "`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼叫 :meth:" "`start` 將 patch 準備就緒,並呼叫 :meth:`stop` 來取消 patch。" -#: ../../library/unittest.mock.rst:1776 +#: ../../library/unittest.mock.rst:1825 msgid "" "If you are using :func:`patch` to create a mock for you then it will be " "returned by the call to ``patcher.start``. ::" @@ -2189,7 +2238,7 @@ msgstr "" "如果你使用 :func:`patch` 為你建立 mock,那麼它將透過呼叫 ``patcher.start`` 回" "傳。: ::" -#: ../../library/unittest.mock.rst:1779 +#: ../../library/unittest.mock.rst:1828 msgid "" ">>> patcher = patch('package.module.ClassName')\n" ">>> from package import module\n" @@ -2211,7 +2260,7 @@ msgstr "" ">>> assert module.ClassName is original\n" ">>> assert module.ClassName is not new_mock" -#: ../../library/unittest.mock.rst:1790 +#: ../../library/unittest.mock.rst:1839 msgid "" "A typical use case for this might be for doing multiple patches in the " "``setUp`` method of a :class:`TestCase`::" @@ -2219,7 +2268,7 @@ msgstr "" "一個典型的用法是在一個 :class:`TestCase` 的 ``setUp`` 方法中執行多個 " "patch: ::" -#: ../../library/unittest.mock.rst:1793 +#: ../../library/unittest.mock.rst:1842 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -2255,7 +2304,7 @@ msgstr "" "...\n" ">>> MyTest('test_something').run()" -#: ../../library/unittest.mock.rst:1812 +#: ../../library/unittest.mock.rst:1861 msgid "" "If you use this technique you must ensure that the patching is \"undone\" by " "calling ``stop``. This can be fiddlier than you might think, because if an " @@ -2266,7 +2315,7 @@ msgstr "" "你想像的還要複雜一點,因為如果有例外在 ``setUp`` 中被引發,則 ``tearDown`` 就" "不會被呼叫。:meth:`unittest.TestCase.addCleanup` 會讓這稍微簡單一點: ::" -#: ../../library/unittest.mock.rst:1817 +#: ../../library/unittest.mock.rst:1866 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -2288,34 +2337,34 @@ msgstr "" "... assert package.module.Class is self.MockClass\n" "..." -#: ../../library/unittest.mock.rst:1827 +#: ../../library/unittest.mock.rst:1876 msgid "" "As an added bonus you no longer need to keep a reference to the ``patcher`` " "object." msgstr "作為額外的好處,你不再需要保留對 ``patcher`` 物件的參照。" -#: ../../library/unittest.mock.rst:1830 +#: ../../library/unittest.mock.rst:1879 msgid "" "It is also possible to stop all patches which have been started by using :" "func:`patch.stopall`." msgstr "也可以使用 :func:`patch.stopall` 來停止所有已啟動的 patch。" -#: ../../library/unittest.mock.rst:1835 +#: ../../library/unittest.mock.rst:1884 msgid "Stop all active patches. Only stops patches started with ``start``." msgstr "停止所有運作的 patch。只停止以 ``start`` 啟動的 patch。" -#: ../../library/unittest.mock.rst:1841 +#: ../../library/unittest.mock.rst:1890 msgid "patch builtins" msgstr "patch 內建函式" -#: ../../library/unittest.mock.rst:1842 +#: ../../library/unittest.mock.rst:1891 msgid "" "You can patch any builtins within a module. The following example patches " "builtin :func:`ord`::" msgstr "" "你可以 patch 模組內的任何內建函式。以下範例 patch 內建函式 :func:`ord`: ::" -#: ../../library/unittest.mock.rst:1845 +#: ../../library/unittest.mock.rst:1894 msgid "" ">>> @patch('__main__.ord')\n" "... def test(mock_ord):\n" @@ -2333,11 +2382,11 @@ msgstr "" ">>> test()\n" "101" -#: ../../library/unittest.mock.rst:1857 +#: ../../library/unittest.mock.rst:1906 msgid "TEST_PREFIX" msgstr "TEST_PREFIX" -#: ../../library/unittest.mock.rst:1859 +#: ../../library/unittest.mock.rst:1908 msgid "" "All of the patchers can be used as class decorators. When used in this way " "they wrap every test method on the class. The patchers recognise methods " @@ -2348,7 +2397,7 @@ msgstr "" "個測試方法。Patcher 將 ``'test'`` 開頭的方法認定為測試方法。這與 :class:" "`unittest.TestLoader` 預設尋找測試方法的方式相同。" -#: ../../library/unittest.mock.rst:1864 +#: ../../library/unittest.mock.rst:1913 msgid "" "It is possible that you want to use a different prefix for your tests. You " "can inform the patchers of the different prefix by setting ``patch." @@ -2357,7 +2406,7 @@ msgstr "" "你可能會想為你的測試使用不同的前綴。你可以透過設定 ``patch.TEST_PREFIX`` 來告" "知 patcher 使用不同的前綴: ::" -#: ../../library/unittest.mock.rst:1867 +#: ../../library/unittest.mock.rst:1916 msgid "" ">>> patch.TEST_PREFIX = 'foo'\n" ">>> value = 3\n" @@ -2395,21 +2444,21 @@ msgstr "" ">>> value\n" "3" -#: ../../library/unittest.mock.rst:1887 +#: ../../library/unittest.mock.rst:1936 msgid "Nesting Patch Decorators" msgstr "巢狀使用 Patch 裝飾器" -#: ../../library/unittest.mock.rst:1889 +#: ../../library/unittest.mock.rst:1938 msgid "" "If you want to perform multiple patches then you can simply stack up the " "decorators." msgstr "如果你想執行多個 patch,那麼你可以簡單地堆疊裝飾器。" -#: ../../library/unittest.mock.rst:1892 +#: ../../library/unittest.mock.rst:1941 msgid "You can stack up multiple patch decorators using this pattern:" msgstr "你可以使用這個模式來堆疊多個 patch 裝飾器:" -#: ../../library/unittest.mock.rst:1908 +#: ../../library/unittest.mock.rst:1957 msgid "" "Note that the decorators are applied from the bottom upwards. This is the " "standard way that Python applies decorators. The order of the created mocks " @@ -2418,11 +2467,11 @@ msgstr "" "請注意,裝飾器是從底部向上應用的。這是 Python 應用裝飾器的標準方式。被建立的 " "mock 傳遞到測試函式中的順序與此順序相同。" -#: ../../library/unittest.mock.rst:1916 +#: ../../library/unittest.mock.rst:1965 msgid "Where to patch" msgstr "該 patch 何處" -#: ../../library/unittest.mock.rst:1918 +#: ../../library/unittest.mock.rst:1967 msgid "" ":func:`patch` works by (temporarily) changing the object that a *name* " "points to with another one. There can be many names pointing to any " @@ -2433,7 +2482,7 @@ msgstr "" "有許多 name 指向任何單一物件,因此為了使 patch 起作用,你必須確保你 patch 了" "被測試系統使用的 name。" -#: ../../library/unittest.mock.rst:1923 +#: ../../library/unittest.mock.rst:1972 msgid "" "The basic principle is that you patch where an object is *looked up*, which " "is not necessarily the same place as where it is defined. A couple of " @@ -2442,12 +2491,12 @@ msgstr "" "基本原則是在物件\\ *被查找*\\ 的位置進行 patch,該位置不一定與其被定義的位置" "相同。幾個範例將有助於闡明這一點。" -#: ../../library/unittest.mock.rst:1927 +#: ../../library/unittest.mock.rst:1976 msgid "" "Imagine we have a project that we want to test with the following structure::" msgstr "想像一下,我們想要測試一個專案,其結構如下: ::" -#: ../../library/unittest.mock.rst:1929 +#: ../../library/unittest.mock.rst:1978 msgid "" "a.py\n" " -> Defines SomeClass\n" @@ -2457,7 +2506,7 @@ msgid "" " -> some_function instantiates SomeClass" msgstr "" -#: ../../library/unittest.mock.rst:1936 +#: ../../library/unittest.mock.rst:1985 msgid "" "Now we want to test ``some_function`` but we want to mock out ``SomeClass`` " "using :func:`patch`. The problem is that when we import module b, which we " @@ -2472,7 +2521,7 @@ msgstr "" "那麼它對我們的測試就不會有任何影響;模組 b 已經有了一個\\ *真實的*\\ " "``SomeClass`` 的參照 ,看起來我們的 patch 並沒有任何效果。" -#: ../../library/unittest.mock.rst:1943 +#: ../../library/unittest.mock.rst:1992 msgid "" "The key is to patch out ``SomeClass`` where it is used (or where it is " "looked up). In this case ``some_function`` will actually look up " @@ -2483,11 +2532,11 @@ msgstr "" "``some_function`` 實際上會在我們 import 它的模組 b 中查找 ``SomeClass``。這裡" "的 patch 應該長得像這樣: ::" -#: ../../library/unittest.mock.rst:1947 +#: ../../library/unittest.mock.rst:1996 msgid "@patch('b.SomeClass')" msgstr "@patch('b.SomeClass')" -#: ../../library/unittest.mock.rst:1949 +#: ../../library/unittest.mock.rst:1998 msgid "" "However, consider the alternative scenario where instead of ``from a import " "SomeClass`` module b does ``import a`` and ``some_function`` uses ``a." @@ -2500,15 +2549,15 @@ msgstr "" "形式都很常見。在這種情況下,我們想要 patch 的類別正在其模組中被查找,因此我們" "必須 patch ``a.SomeClass``: ::" -#: ../../library/unittest.mock.rst:1954 +#: ../../library/unittest.mock.rst:2003 msgid "@patch('a.SomeClass')" msgstr "@patch('a.SomeClass')" -#: ../../library/unittest.mock.rst:1958 +#: ../../library/unittest.mock.rst:2007 msgid "Patching Descriptors and Proxy Objects" msgstr "Patch 描述器與代理物件 (Proxy Objects)" -#: ../../library/unittest.mock.rst:1960 +#: ../../library/unittest.mock.rst:2009 msgid "" "Both patch_ and patch.object_ correctly patch and restore descriptors: class " "methods, static methods and properties. You should patch these on the " @@ -2523,15 +2572,15 @@ msgstr "" "web/20200603181648/http://www.voidspace.org.uk/python/weblog/ " "arch_d7_2010_12_04.shtml#e1198>`_。" -#: ../../library/unittest.mock.rst:1968 +#: ../../library/unittest.mock.rst:2017 msgid "MagicMock and magic method support" msgstr "MagicMock 以及魔術方法支援" -#: ../../library/unittest.mock.rst:1973 +#: ../../library/unittest.mock.rst:2022 msgid "Mocking Magic Methods" msgstr "Mock 魔術方法" -#: ../../library/unittest.mock.rst:1975 +#: ../../library/unittest.mock.rst:2024 msgid "" ":class:`Mock` supports mocking the Python protocol methods, also known as :" "term:`\"magic methods\" `. This allows mock objects to replace " @@ -2540,7 +2589,7 @@ msgstr "" ":class:`Mock` 支援 mock Python 協定方法,其也被稱作 :term:`\"魔術方法\" " "`。這允許 mock 物件替換容器或實作 Python 協定的其他物件。" -#: ../../library/unittest.mock.rst:1979 +#: ../../library/unittest.mock.rst:2028 msgid "" "Because magic methods are looked up differently from normal methods [#]_, " "this support has been specially implemented. This means that only specific " @@ -2551,7 +2600,7 @@ msgstr "" "代表著僅有特定的魔術方法被此方式支援。現在已支援清單中已經\\ *幾乎*\\ 包含了" "所有魔術方法。如果你需要 mock 任何魔術方法而其尚未被支援,請讓我們知道。" -#: ../../library/unittest.mock.rst:1984 +#: ../../library/unittest.mock.rst:2033 msgid "" "You mock magic methods by setting the method you are interested in to a " "function or a mock instance. If you are using a function then it *must* take " @@ -2560,13 +2609,13 @@ msgstr "" "你可以透過將你感興趣的方法設定為函式或 mock 實例來 mock 魔術方法。如果你使用" "函式,那麼它\\ *必須*\\ 將 ``self`` 作為第一個引數 [#]_。" -#: ../../library/unittest.mock.rst:2007 +#: ../../library/unittest.mock.rst:2056 msgid "" "One use case for this is for mocking objects used as context managers in a :" "keyword:`with` statement:" msgstr "一個用法是在 :keyword:`with` 陳述式中 mock 作為情境管理器使用的物件:" -#: ../../library/unittest.mock.rst:2019 +#: ../../library/unittest.mock.rst:2068 msgid "" "Calls to magic methods do not appear in :attr:`~Mock.method_calls`, but they " "are recorded in :attr:`~Mock.mock_calls`." @@ -2574,7 +2623,7 @@ msgstr "" "對魔術方法的呼叫並不會出現在 :attr:`~Mock.method_calls` 中,它們會被記錄在 :" "attr:`~Mock.mock_calls` 內。" -#: ../../library/unittest.mock.rst:2024 +#: ../../library/unittest.mock.rst:2073 msgid "" "If you use the *spec* keyword argument to create a mock then attempting to " "set a magic method that isn't in the spec will raise an :exc:" @@ -2583,23 +2632,23 @@ msgstr "" "如果你使用\\ *spec*\\ 關鍵字引數來建立一個 mock,則嘗試設定規格中未包含的魔術" "方法將引發一個 :exc:`AttributeError`。" -#: ../../library/unittest.mock.rst:2027 +#: ../../library/unittest.mock.rst:2076 msgid "The full list of supported magic methods is:" msgstr "已支援的魔術方法的完整列表是:" -#: ../../library/unittest.mock.rst:2029 +#: ../../library/unittest.mock.rst:2078 msgid "``__hash__``, ``__sizeof__``, ``__repr__`` and ``__str__``" msgstr "``__hash__``、``__sizeof__``、 ``__repr__`` 和 ``__str__``" -#: ../../library/unittest.mock.rst:2030 +#: ../../library/unittest.mock.rst:2079 msgid "``__dir__``, ``__format__`` and ``__subclasses__``" msgstr "``__dir__``、 ``__format__`` 和 ``__subclasses__``" -#: ../../library/unittest.mock.rst:2031 +#: ../../library/unittest.mock.rst:2080 msgid "``__round__``, ``__floor__``, ``__trunc__`` and ``__ceil__``" msgstr "``__round__``、``__floor__``、``__trunc__`` 和 ``__ceil__``" -#: ../../library/unittest.mock.rst:2032 +#: ../../library/unittest.mock.rst:2081 msgid "" "Comparisons: ``__lt__``, ``__gt__``, ``__le__``, ``__ge__``, ``__eq__`` and " "``__ne__``" @@ -2607,7 +2656,7 @@ msgstr "" "比較方法:``__lt__``、``__gt__``、``__le__``、``__ge__``、``__eq__`` 和 " "``__ne__``" -#: ../../library/unittest.mock.rst:2034 +#: ../../library/unittest.mock.rst:2083 msgid "" "Container methods: ``__getitem__``, ``__setitem__``, ``__delitem__``, " "``__contains__``, ``__len__``, ``__iter__``, ``__reversed__`` and " @@ -2617,18 +2666,18 @@ msgstr "" "``__contains__``、``__len__``、``__iter__``、``__reversed__`` 和 " "``__missing__``" -#: ../../library/unittest.mock.rst:2037 +#: ../../library/unittest.mock.rst:2086 msgid "" "Context manager: ``__enter__``, ``__exit__``, ``__aenter__`` and " "``__aexit__``" msgstr "" "情境管理器:``__enter__``、``__exit__``、``__aenter__`` 和 ``__aexit__``" -#: ../../library/unittest.mock.rst:2038 +#: ../../library/unittest.mock.rst:2087 msgid "Unary numeric methods: ``__neg__``, ``__pos__`` and ``__invert__``" msgstr "一元數值方法:``__neg__``、``__pos__`` 和 ``__invert__``" -#: ../../library/unittest.mock.rst:2039 +#: ../../library/unittest.mock.rst:2088 msgid "" "The numeric methods (including right hand and in-place variants): " "``__add__``, ``__sub__``, ``__mul__``, ``__matmul__``, ``__truediv__``, " @@ -2640,18 +2689,18 @@ msgstr "" "``__mod__``、``__divmod__``、``__lshift__``、``__rshift__``、``__and__``、" "``__xor__``、``__or__`` 和 ``__pow__``" -#: ../../library/unittest.mock.rst:2043 +#: ../../library/unittest.mock.rst:2092 msgid "" "Numeric conversion methods: ``__complex__``, ``__int__``, ``__float__`` and " "``__index__``" msgstr "" "數值轉換方法:``__complex__``、``__int__``、``__float__`` 和 ``__index__``" -#: ../../library/unittest.mock.rst:2045 +#: ../../library/unittest.mock.rst:2094 msgid "Descriptor methods: ``__get__``, ``__set__`` and ``__delete__``" msgstr "描述器方法:``__get__``、``__set__`` 和 ``__delete__``" -#: ../../library/unittest.mock.rst:2046 +#: ../../library/unittest.mock.rst:2095 msgid "" "Pickling: ``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, " "``__getnewargs__``, ``__getstate__`` and ``__setstate__``" @@ -2659,19 +2708,19 @@ msgstr "" "Pickling:``__reduce__``、``__reduce_ex__``、``__getinitargs__``、" "``__getnewargs__``、``__getstate__`` 和 ``__setstate__``" -#: ../../library/unittest.mock.rst:2048 +#: ../../library/unittest.mock.rst:2097 msgid "File system path representation: ``__fspath__``" msgstr "檔案系統路徑表示法:``__fspath__``" -#: ../../library/unittest.mock.rst:2049 +#: ../../library/unittest.mock.rst:2098 msgid "Asynchronous iteration methods: ``__aiter__`` and ``__anext__``" msgstr "非同步疊代方法:``__aiter__`` 和 ``__anext__``" -#: ../../library/unittest.mock.rst:2051 +#: ../../library/unittest.mock.rst:2100 msgid "Added support for :func:`os.PathLike.__fspath__`." msgstr "新增對於 :func:`os.PathLike.__fspath__` 的支援。" -#: ../../library/unittest.mock.rst:2054 +#: ../../library/unittest.mock.rst:2103 msgid "" "Added support for ``__aenter__``, ``__aexit__``, ``__aiter__`` and " "``__anext__``." @@ -2679,7 +2728,7 @@ msgstr "" "新增對於 ``__aenter__``、``__aexit__``、``__aiter__`` 和 ``__anext__`` 的支" "援。" -#: ../../library/unittest.mock.rst:2058 +#: ../../library/unittest.mock.rst:2107 msgid "" "The following methods exist but are *not* supported as they are either in " "use by mock, can't be set dynamically, or can cause problems:" @@ -2687,21 +2736,21 @@ msgstr "" "以下方法存在,但「不」被支援,因為它們在被 mock 使用時,會無法動態設定,或可" "能導致問題:" -#: ../../library/unittest.mock.rst:2061 +#: ../../library/unittest.mock.rst:2110 msgid "``__getattr__``, ``__setattr__``, ``__init__`` and ``__new__``" msgstr "``__getattr__``、``__setattr__``、``__init__`` 和 ``__new__``" -#: ../../library/unittest.mock.rst:2062 +#: ../../library/unittest.mock.rst:2111 msgid "" "``__prepare__``, ``__instancecheck__``, ``__subclasscheck__``, ``__del__``" msgstr "" "``__prepare__``、``__instancecheck__``、``__subclasscheck__``、``__del__``" -#: ../../library/unittest.mock.rst:2067 +#: ../../library/unittest.mock.rst:2116 msgid "Magic Mock" msgstr "Magic Mock" -#: ../../library/unittest.mock.rst:2069 +#: ../../library/unittest.mock.rst:2118 msgid "" "There are two ``MagicMock`` variants: :class:`MagicMock` and :class:" "`NonCallableMagicMock`." @@ -2709,7 +2758,7 @@ msgstr "" "``MagicMock`` 有兩個變體::class:`MagicMock` 和 :class:" "`NonCallableMagicMock`。" -#: ../../library/unittest.mock.rst:2074 +#: ../../library/unittest.mock.rst:2123 msgid "" "``MagicMock`` is a subclass of :class:`Mock` with default implementations of " "most of the :term:`magic methods `. You can use ``MagicMock`` " @@ -2718,11 +2767,11 @@ msgstr "" "``MagicMock`` 是 :class:`Mock` 的子類別,其預設具有大多數\\ :term:`魔術方法 " "`\\ 的實作。你可以使用 ``MagicMock``,而無需自行配置魔術方法。" -#: ../../library/unittest.mock.rst:2078 +#: ../../library/unittest.mock.rst:2127 msgid "The constructor parameters have the same meaning as for :class:`Mock`." msgstr "建構函式參數的意義與 :class:`Mock` 中的參數相同。" -#: ../../library/unittest.mock.rst:2080 +#: ../../library/unittest.mock.rst:2129 msgid "" "If you use the *spec* or *spec_set* arguments then *only* magic methods that " "exist in the spec will be created." @@ -2730,11 +2779,11 @@ msgstr "" "如果你使用 *spec* 或 *spec_set* 引數,那麼\\ *只有*\\ 規格中存在的魔術方法會" "被建立。" -#: ../../library/unittest.mock.rst:2086 +#: ../../library/unittest.mock.rst:2135 msgid "A non-callable version of :class:`MagicMock`." msgstr ":class:`MagicMock` 的不可呼叫版本。" -#: ../../library/unittest.mock.rst:2088 +#: ../../library/unittest.mock.rst:2137 msgid "" "The constructor parameters have the same meaning as for :class:`MagicMock`, " "with the exception of *return_value* and *side_effect* which have no meaning " @@ -2743,7 +2792,7 @@ msgstr "" "建構函式參數的意義與 :class:`MagicMock` 中的參數相同,但 *return_value* 和 " "*side_effect* 除外,它們對不可呼叫的 mock 來說沒有任何意義。" -#: ../../library/unittest.mock.rst:2092 +#: ../../library/unittest.mock.rst:2141 msgid "" "The magic methods are setup with :class:`MagicMock` objects, so you can " "configure them and use them in the usual way:" @@ -2751,7 +2800,7 @@ msgstr "" "魔術方法是使用 :class:`MagicMock` 物件設定的,因此你可以配置它們並以一般的方" "法來使用它們:" -#: ../../library/unittest.mock.rst:2102 +#: ../../library/unittest.mock.rst:2151 msgid "" "By default many of the protocol methods are required to return objects of a " "specific type. These methods are preconfigured with a default return value, " @@ -2763,83 +2812,83 @@ msgstr "" "值,因此如果你對回傳值不感興趣,則無需執行任何操作即可使用它們。如果你想更改" "預設值,你仍然可以手動\\ *設定*\\ 回傳值。" -#: ../../library/unittest.mock.rst:2108 +#: ../../library/unittest.mock.rst:2157 msgid "Methods and their defaults:" msgstr "方法及其預設值:" -#: ../../library/unittest.mock.rst:2110 +#: ../../library/unittest.mock.rst:2159 msgid "``__lt__``: :data:`NotImplemented`" msgstr "``__lt__``::data:`NotImplemented`" -#: ../../library/unittest.mock.rst:2111 +#: ../../library/unittest.mock.rst:2160 msgid "``__gt__``: :data:`!NotImplemented`" msgstr "``__gt__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2112 +#: ../../library/unittest.mock.rst:2161 msgid "``__le__``: :data:`!NotImplemented`" msgstr "``__le__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2113 +#: ../../library/unittest.mock.rst:2162 msgid "``__ge__``: :data:`!NotImplemented`" msgstr "``__ge__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2114 +#: ../../library/unittest.mock.rst:2163 msgid "``__int__``: ``1``" msgstr "``__int__``:``1``" -#: ../../library/unittest.mock.rst:2115 +#: ../../library/unittest.mock.rst:2164 msgid "``__contains__``: ``False``" msgstr "``__contains__``:``False``" -#: ../../library/unittest.mock.rst:2116 +#: ../../library/unittest.mock.rst:2165 msgid "``__len__``: ``0``" msgstr "``__len__``:``0``" -#: ../../library/unittest.mock.rst:2117 +#: ../../library/unittest.mock.rst:2166 msgid "``__iter__``: ``iter([])``" msgstr "``__iter__``:``iter([])``" -#: ../../library/unittest.mock.rst:2118 +#: ../../library/unittest.mock.rst:2167 msgid "``__exit__``: ``False``" msgstr "``__exit__``:``False``" -#: ../../library/unittest.mock.rst:2119 +#: ../../library/unittest.mock.rst:2168 msgid "``__aexit__``: ``False``" msgstr "``__aexit__``:``False``" -#: ../../library/unittest.mock.rst:2120 +#: ../../library/unittest.mock.rst:2169 msgid "``__complex__``: ``1j``" msgstr "``__complex__``:``1j``" -#: ../../library/unittest.mock.rst:2121 +#: ../../library/unittest.mock.rst:2170 msgid "``__float__``: ``1.0``" msgstr "``__float__``:``1.0``" -#: ../../library/unittest.mock.rst:2122 +#: ../../library/unittest.mock.rst:2171 msgid "``__bool__``: ``True``" msgstr "``__bool__``:``True``" -#: ../../library/unittest.mock.rst:2123 +#: ../../library/unittest.mock.rst:2172 msgid "``__index__``: ``1``" msgstr "``__index__``:``1``" -#: ../../library/unittest.mock.rst:2124 +#: ../../library/unittest.mock.rst:2173 msgid "``__hash__``: default hash for the mock" msgstr "``__hash__``:mock 的預設雜湊" -#: ../../library/unittest.mock.rst:2125 +#: ../../library/unittest.mock.rst:2174 msgid "``__str__``: default str for the mock" msgstr "``__str__``:mock 的預設字串" -#: ../../library/unittest.mock.rst:2126 +#: ../../library/unittest.mock.rst:2175 msgid "``__sizeof__``: default sizeof for the mock" msgstr "``__sizeof__``:mock 的預設 sizeof" -#: ../../library/unittest.mock.rst:2128 +#: ../../library/unittest.mock.rst:2177 msgid "For example:" msgstr "舉例來說:" -#: ../../library/unittest.mock.rst:2140 +#: ../../library/unittest.mock.rst:2189 msgid "" "The two equality methods, :meth:`!__eq__` and :meth:`!__ne__`, are special. " "They do the default equality comparison on identity, using the :attr:`~Mock." @@ -2850,7 +2899,7 @@ msgstr "" "`~Mock.side_effect` 屬性對識別性 (identity) 進行預設的相等比較,除非你變更它" "們的回傳值以回傳其他內容: ::" -#: ../../library/unittest.mock.rst:2145 +#: ../../library/unittest.mock.rst:2194 msgid "" ">>> MagicMock() == 3\n" "False\n" @@ -2870,14 +2919,14 @@ msgstr "" ">>> mock == 3\n" "True" -#: ../../library/unittest.mock.rst:2154 +#: ../../library/unittest.mock.rst:2203 msgid "" "The return value of :meth:`MagicMock.__iter__` can be any iterable object " "and isn't required to be an iterator:" msgstr "" ":meth:`MagicMock.__iter__` 的回傳值可以是任何可疊代物件,且不需是一個疊代器:" -#: ../../library/unittest.mock.rst:2164 +#: ../../library/unittest.mock.rst:2213 msgid "" "If the return value *is* an iterator, then iterating over it once will " "consume it and subsequent iterations will result in an empty list:" @@ -2885,7 +2934,7 @@ msgstr "" "如果回傳值\\ *是*\\ 一個疊代器,那麼對其進行一次疊代將消耗它,並且後續疊代將" "產生一個空串列:" -#: ../../library/unittest.mock.rst:2173 +#: ../../library/unittest.mock.rst:2222 msgid "" "``MagicMock`` has all of the supported magic methods configured except for " "some of the obscure and obsolete ones. You can still set these up if you " @@ -2894,33 +2943,33 @@ msgstr "" "``MagicMock`` 配置了所有支援的魔術方法,除了一些少見和過時的方法。如果你想" "要,你仍然可以設定這些魔術方法。" -#: ../../library/unittest.mock.rst:2176 +#: ../../library/unittest.mock.rst:2225 msgid "" "Magic methods that are supported but not setup by default in ``MagicMock`` " "are:" msgstr "``MagicMock`` 中支援但預設未設置的魔術方法包含:" -#: ../../library/unittest.mock.rst:2178 +#: ../../library/unittest.mock.rst:2227 msgid "``__subclasses__``" msgstr "``__subclasses__``" -#: ../../library/unittest.mock.rst:2179 +#: ../../library/unittest.mock.rst:2228 msgid "``__dir__``" msgstr "``__dir__``" -#: ../../library/unittest.mock.rst:2180 +#: ../../library/unittest.mock.rst:2229 msgid "``__format__``" msgstr "``__format__``" -#: ../../library/unittest.mock.rst:2181 +#: ../../library/unittest.mock.rst:2230 msgid "``__get__``, ``__set__`` and ``__delete__``" msgstr "``__get__``、``__set__`` 和 ``__delete__``" -#: ../../library/unittest.mock.rst:2182 +#: ../../library/unittest.mock.rst:2231 msgid "``__reversed__`` and ``__missing__``" msgstr "``__reversed__`` 和 ``__missing__``" -#: ../../library/unittest.mock.rst:2183 +#: ../../library/unittest.mock.rst:2232 msgid "" "``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, ``__getnewargs__``, " "``__getstate__`` and ``__setstate__``" @@ -2928,11 +2977,11 @@ msgstr "" "``__reduce__``、``__reduce_ex__``、``__getinitargs__``、``__getnewargs__``、" "``__getstate__`` 和 ``__setstate__``" -#: ../../library/unittest.mock.rst:2185 +#: ../../library/unittest.mock.rst:2234 msgid "``__getformat__``" msgstr "``__getformat__``" -#: ../../library/unittest.mock.rst:2189 +#: ../../library/unittest.mock.rst:2238 msgid "" "Magic methods *should* be looked up on the class rather than the instance. " "Different versions of Python are inconsistent about applying this rule. The " @@ -2941,27 +2990,27 @@ msgstr "" "魔術方法\\ *應該*\\ 在類別而不是實例上被查找。不同版本的 Python 對於這條規則" "的適用並不一致。支援的協定方法應適用於所有支援的 Python 版本。" -#: ../../library/unittest.mock.rst:2193 +#: ../../library/unittest.mock.rst:2242 msgid "" "The function is basically hooked up to the class, but each ``Mock`` instance " "is kept isolated from the others." msgstr "該函式基本上與類別掛鉤,但每個 ``Mock`` 實例都與其他實例保持隔離。" -#: ../../library/unittest.mock.rst:2198 +#: ../../library/unittest.mock.rst:2247 msgid "Helpers" msgstr "輔助函式" -#: ../../library/unittest.mock.rst:2201 +#: ../../library/unittest.mock.rst:2250 msgid "sentinel" msgstr "sentinel(哨兵)" -#: ../../library/unittest.mock.rst:2205 +#: ../../library/unittest.mock.rst:2254 msgid "" "The ``sentinel`` object provides a convenient way of providing unique " "objects for your tests." msgstr "``哨兵``\\ 物件提供了一種為你的測試提供獨特物件的便利方式。" -#: ../../library/unittest.mock.rst:2208 +#: ../../library/unittest.mock.rst:2257 msgid "" "Attributes are created on demand when you access them by name. Accessing the " "same attribute will always return the same object. The objects returned have " @@ -2970,7 +3019,7 @@ msgstr "" "當你使用名稱存取屬性時,屬性會根據需要被建立。存取相同的屬性將始終回傳相同的" "物件。回傳的物件會具有合適的 repr,讓測試失敗的訊息是可閱讀的。" -#: ../../library/unittest.mock.rst:2212 +#: ../../library/unittest.mock.rst:2261 msgid "" "The ``sentinel`` attributes now preserve their identity when they are :mod:" "`copied ` or :mod:`pickled `." @@ -2978,7 +3027,7 @@ msgstr "" "``哨兵``\\ 屬性現在當被\\ :mod:`複製 `\\ 或\\ :mod:`序列化 `\\ " "時會保留其識別性。" -#: ../../library/unittest.mock.rst:2216 +#: ../../library/unittest.mock.rst:2265 msgid "" "Sometimes when testing you need to test that a specific object is passed as " "an argument to another method, or returned. It can be common to create named " @@ -2989,18 +3038,18 @@ msgstr "" "名的哨兵物件來測試這一點是常見的。:data:`sentinel` 提供了一種此類建立和測試物" "件識別性的便利方式。" -#: ../../library/unittest.mock.rst:2221 +#: ../../library/unittest.mock.rst:2270 msgid "" "In this example we monkey patch ``method`` to return ``sentinel." "some_object``:" msgstr "" "在這個例子中,我們 monkey patch ``method`` 以回傳 ``sentinel.some_object``:" -#: ../../library/unittest.mock.rst:2233 +#: ../../library/unittest.mock.rst:2282 msgid "DEFAULT" msgstr "DEFAULT" -#: ../../library/unittest.mock.rst:2238 +#: ../../library/unittest.mock.rst:2287 msgid "" "The :data:`DEFAULT` object is a pre-created sentinel (actually ``sentinel." "DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions to " @@ -3010,11 +3059,11 @@ msgstr "" "DEFAULT``\\ )。它可以被 :attr:`~Mock.side_effect` 函式使用來表示正常的回傳值" "應該被使用。" -#: ../../library/unittest.mock.rst:2244 +#: ../../library/unittest.mock.rst:2293 msgid "call" msgstr "call" -#: ../../library/unittest.mock.rst:2248 +#: ../../library/unittest.mock.rst:2297 msgid "" ":func:`call` is a helper object for making simpler assertions, for comparing " "with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock." @@ -3026,7 +3075,7 @@ msgstr "" "簡單的斷言的輔助物件。:func:`call` 也可以與 :meth:`~Mock.assert_has_calls` 一" "起使用。" -#: ../../library/unittest.mock.rst:2261 +#: ../../library/unittest.mock.rst:2310 msgid "" "For a call object that represents multiple calls, :meth:`call_list` returns " "a list of all the intermediate calls as well as the final call." @@ -3034,7 +3083,7 @@ msgstr "" "對於表示多個呼叫的 call 物件,:meth:`call_list` 回傳所有中間呼叫以及最終呼叫" "的串列。" -#: ../../library/unittest.mock.rst:2265 +#: ../../library/unittest.mock.rst:2314 msgid "" "``call_list`` is particularly useful for making assertions on \"chained " "calls\". A chained call is multiple calls on a single line of code. This " @@ -3045,13 +3094,13 @@ msgstr "" "在單行程式碼進行的多次呼叫。這會導致 mock 上的 :attr:`~Mock.mock_calls` 中出" "現多個項目。手動建構呼叫序列會相當單調乏味。" -#: ../../library/unittest.mock.rst:2270 +#: ../../library/unittest.mock.rst:2319 msgid "" ":meth:`~call.call_list` can construct the sequence of calls from the same " "chained call:" msgstr ":meth:`~call.call_list` 可以從同一個鍊接呼叫建構呼叫序列:" -#: ../../library/unittest.mock.rst:2287 +#: ../../library/unittest.mock.rst:2336 msgid "" "A ``call`` object is either a tuple of (positional args, keyword args) or " "(name, positional args, keyword args) depending on how it was constructed. " @@ -3065,7 +3114,7 @@ msgstr "" "趣,但是 :attr:`Mock.call_args`、:attr:`Mock.call_args_list` 和 :attr:`Mock." "mock_calls` 屬性中的 ``call`` 物件可以被內省以取得它們包含的各個引數。" -#: ../../library/unittest.mock.rst:2294 +#: ../../library/unittest.mock.rst:2343 msgid "" "The ``call`` objects in :attr:`Mock.call_args` and :attr:`Mock." "call_args_list` are two-tuples of (positional args, keyword args) whereas " @@ -3077,7 +3126,7 @@ msgstr "" "(位置引數, 關鍵字引數)的二元組,而 :attr:`Mock.mock_calls` 中的 ``call`` 物" "件以及你自己建立的 ``call`` 物件是(名稱, 位置引數, 關鍵字引數)的三元組。" -#: ../../library/unittest.mock.rst:2299 +#: ../../library/unittest.mock.rst:2348 msgid "" "You can use their \"tupleness\" to pull out the individual arguments for " "more complex introspection and assertions. The positional arguments are a " @@ -3087,11 +3136,11 @@ msgstr "" "你可以利用它們作為元組的特性來提取單個引數,以進行更複雜的內省和斷言。位置引" "數是一個元組(如果沒有位置引數則為空元組),關鍵字引數是一個字典:" -#: ../../library/unittest.mock.rst:2332 +#: ../../library/unittest.mock.rst:2381 msgid "create_autospec" msgstr "create_autospec" -#: ../../library/unittest.mock.rst:2336 +#: ../../library/unittest.mock.rst:2385 msgid "" "Create a mock object using another object as a spec. Attributes on the mock " "will use the corresponding attribute on the *spec* object as their spec." @@ -3099,13 +3148,13 @@ msgstr "" "使用另一個物件作為規格建立一個 mock 物件。Mock 上的屬性將使用 *spec* 物件上的" "對應屬性作為其規格。" -#: ../../library/unittest.mock.rst:2340 +#: ../../library/unittest.mock.rst:2389 msgid "" "Functions or methods being mocked will have their arguments checked to " "ensure that they are called with the correct signature." msgstr "被 mock 的函式或方法將檢查其引數,以確保他們被使用正確的簽名來呼叫。" -#: ../../library/unittest.mock.rst:2343 +#: ../../library/unittest.mock.rst:2392 msgid "" "If *spec_set* is ``True`` then attempting to set attributes that don't exist " "on the spec object will raise an :exc:`AttributeError`." @@ -3113,7 +3162,7 @@ msgstr "" "如果 *spec_set* 為 ``True``,則嘗試設定規格物件上不存在的屬性將引發 :exc:" "`AttributeError`。" -#: ../../library/unittest.mock.rst:2346 +#: ../../library/unittest.mock.rst:2395 msgid "" "If a class is used as a spec then the return value of the mock (the instance " "of the class) will have the same spec. You can use a class as the spec for " @@ -3124,7 +3173,7 @@ msgstr "" "可以透過傳遞 ``instance=True`` 來使用一個類別作為一個實例物件的規格。只有當 " "mock 的實例是可呼叫物件時,回傳的 mock 才會是可呼叫物件。" -#: ../../library/unittest.mock.rst:2351 +#: ../../library/unittest.mock.rst:2400 msgid "" ":func:`create_autospec` also takes arbitrary keyword arguments that are " "passed to the constructor of the created mock." @@ -3132,7 +3181,7 @@ msgstr "" ":func:`create_autospec` 也接受任意的關鍵字引數,這些引數會傳遞給已建立的 " "mock 的建構函式。" -#: ../../library/unittest.mock.rst:2354 +#: ../../library/unittest.mock.rst:2403 msgid "" "See :ref:`auto-speccing` for examples of how to use auto-speccing with :func:" "`create_autospec` and the *autospec* argument to :func:`patch`." @@ -3140,7 +3189,7 @@ msgstr "" "請參閱 :ref:`auto-speccing` 以得知如何以 :func:`create_autospec` 使用自動規格" "以及如何在 :func:`patch` 中使用 *autospec* 引數的範例。" -#: ../../library/unittest.mock.rst:2360 +#: ../../library/unittest.mock.rst:2409 msgid "" ":func:`create_autospec` now returns an :class:`AsyncMock` if the target is " "an async function." @@ -3148,11 +3197,11 @@ msgstr "" "如果目標是一個非同步函式,:func:`create_autospec` 現在會回傳一個 :class:" "`AsyncMock`。" -#: ../../library/unittest.mock.rst:2365 +#: ../../library/unittest.mock.rst:2414 msgid "ANY" msgstr "ANY" -#: ../../library/unittest.mock.rst:2369 +#: ../../library/unittest.mock.rst:2418 msgid "" "Sometimes you may need to make assertions about *some* of the arguments in a " "call to mock, but either not care about some of the arguments or want to " @@ -3162,7 +3211,7 @@ msgstr "" "有時你可能需要對 mock 的呼叫中的\\ *某些*\\ 引數進行斷言,但你不在意其他的某" "些引數,或想將它們單獨從 :attr:`~Mock.call_args` 中取出並進行更加複雜的斷言。" -#: ../../library/unittest.mock.rst:2374 +#: ../../library/unittest.mock.rst:2423 msgid "" "To ignore certain arguments you can pass in objects that compare equal to " "*everything*. Calls to :meth:`~Mock.assert_called_with` and :meth:`~Mock." @@ -3172,20 +3221,20 @@ msgstr "" "麼內容,對 :meth:`~Mock.assert_used_with` 和 :meth:`~Mock." "assert_used_once_with` 的呼叫都會成功。" -#: ../../library/unittest.mock.rst:2383 +#: ../../library/unittest.mock.rst:2432 msgid "" ":data:`ANY` can also be used in comparisons with call lists like :attr:" "`~Mock.mock_calls`:" msgstr "" ":data:`ANY` 也可以用來與呼叫串列進行比較,例如 :attr:`~Mock.mock_calls`:" -#: ../../library/unittest.mock.rst:2393 +#: ../../library/unittest.mock.rst:2442 msgid "" ":data:`ANY` is not limited to comparisons with call objects and so can also " "be used in test assertions::" msgstr ":data:`ANY` 不只能與呼叫物件比較,其也可以在測試斷言中使用: ::" -#: ../../library/unittest.mock.rst:2396 +#: ../../library/unittest.mock.rst:2445 msgid "" "class TestStringMethods(unittest.TestCase):\n" "\n" @@ -3199,11 +3248,11 @@ msgstr "" " s = 'hello world'\n" " self.assertEqual(s.split(), ['hello', ANY])" -#: ../../library/unittest.mock.rst:2404 +#: ../../library/unittest.mock.rst:2453 msgid "FILTER_DIR" msgstr "FILTER_DIR" -#: ../../library/unittest.mock.rst:2408 +#: ../../library/unittest.mock.rst:2457 msgid "" ":data:`FILTER_DIR` is a module level variable that controls the way mock " "objects respond to :func:`dir`. The default is ``True``, which uses the " @@ -3216,7 +3265,7 @@ msgstr "" "你不喜歡這個過濾方式,或由於診斷意圖而需要將其關閉,請設定 ``mock.FILTER_DIR " "= False``。" -#: ../../library/unittest.mock.rst:2414 +#: ../../library/unittest.mock.rst:2463 msgid "" "With filtering on, ``dir(some_mock)`` shows only useful attributes and will " "include any dynamically created attributes that wouldn't normally be shown. " @@ -3228,7 +3277,7 @@ msgstr "" "的任何動態建立的屬性。如果 mock 是使用 *spec*\\ (或 *autospec*\\ )來建立" "的,那麼源頭的所有屬性都會顯示,即使它們尚未被存取:" -#: ../../library/unittest.mock.rst:2420 +#: ../../library/unittest.mock.rst:2469 msgid "" ">>> dir(Mock())\n" "['assert_any_call',\n" @@ -3266,7 +3315,7 @@ msgstr "" " 'BaseHandler',\n" " ..." -#: ../../library/unittest.mock.rst:2441 +#: ../../library/unittest.mock.rst:2490 msgid "" "Many of the not-very-useful (private to :class:`Mock` rather than the thing " "being mocked) underscore and double underscore prefixed attributes have been " @@ -3278,7 +3327,7 @@ msgstr "" "雙底線前綴屬性已從在 :class:`Mock` 上呼叫 :func:`dir` 的結果中濾除。如果你不" "喜歡這種特性,可以透過設定模組級別開關 :data:`FILTER_DIR` 來將其關閉:" -#: ../../library/unittest.mock.rst:2447 +#: ../../library/unittest.mock.rst:2496 msgid "" ">>> from unittest import mock\n" ">>> mock.FILTER_DIR = False\n" @@ -3304,7 +3353,7 @@ msgstr "" " '__class__',\n" " ..." -#: ../../library/unittest.mock.rst:2462 +#: ../../library/unittest.mock.rst:2511 msgid "" "Alternatively you can just use ``vars(my_mock)`` (instance members) and " "``dir(type(my_mock))`` (type members) to bypass the filtering irrespective " @@ -3314,11 +3363,11 @@ msgstr "" "``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考慮 :const:`mock." "FILTER_DIR`。" -#: ../../library/unittest.mock.rst:2468 +#: ../../library/unittest.mock.rst:2517 msgid "mock_open" msgstr "mock_open" -#: ../../library/unittest.mock.rst:2472 +#: ../../library/unittest.mock.rst:2521 msgid "" "A helper function to create a mock to replace the use of :func:`open`. It " "works for :func:`open` called directly or used as a context manager." @@ -3326,7 +3375,7 @@ msgstr "" "用於建立取代 :func:`open` 用途的 mock 的輔助函式。它適用於直接呼叫或用作情境" "管理器的 :func:`open`。" -#: ../../library/unittest.mock.rst:2475 +#: ../../library/unittest.mock.rst:2524 msgid "" "The *mock* argument is the mock object to configure. If ``None`` (the " "default) then a :class:`MagicMock` will be created for you, with the API " @@ -3335,7 +3384,7 @@ msgstr "" "*mock* 引數是要配置的 mock 物件。如果其為 ``None``\\ (預設值),那麼就會為你" "建立一個 :class:`MagicMock`,其 API 限制在標準檔案處理上可用的方法或屬性。" -#: ../../library/unittest.mock.rst:2479 +#: ../../library/unittest.mock.rst:2528 msgid "" "*read_data* is a string for the :meth:`~io.IOBase.read`, :meth:`~io.IOBase." "readline`, and :meth:`~io.IOBase.readlines` methods of the file handle to " @@ -3355,7 +3404,7 @@ msgstr "" "org>`_ 上的其中一個記憶體內檔案系統 (in-memory filesystem) 套件可以提供用於測" "試的真實檔案系統。" -#: ../../library/unittest.mock.rst:2489 +#: ../../library/unittest.mock.rst:2538 msgid "" "Added :meth:`~io.IOBase.readline` and :meth:`~io.IOBase.readlines` support. " "The mock of :meth:`~io.IOBase.read` changed to consume *read_data* rather " @@ -3365,11 +3414,11 @@ msgstr "" "meth:`~io.IOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼叫時回傳" "它。" -#: ../../library/unittest.mock.rst:2494 +#: ../../library/unittest.mock.rst:2543 msgid "*read_data* is now reset on each call to the *mock*." msgstr "現在,每次呼叫 *mock* 時都會重置 *read_data*。" -#: ../../library/unittest.mock.rst:2497 +#: ../../library/unittest.mock.rst:2546 msgid "" "Added :meth:`~container.__iter__` to implementation so that iteration (such " "as in for loops) correctly consumes *read_data*." @@ -3377,7 +3426,7 @@ msgstr "" "新增 :meth:`~container.__iter__` 到實作中,以便使疊代(例如在 for 迴圈中)正" "確地消耗 *read_data*。" -#: ../../library/unittest.mock.rst:2501 +#: ../../library/unittest.mock.rst:2550 msgid "" "Using :func:`open` as a context manager is a great way to ensure your file " "handles are closed properly and is becoming common::" @@ -3385,7 +3434,7 @@ msgstr "" "使用 :func:`open` 作為情境管理器是確保檔案處理正確關閉的好方式,且這種方式正" "在變得普遍: ::" -#: ../../library/unittest.mock.rst:2504 +#: ../../library/unittest.mock.rst:2553 msgid "" "with open('/some/path', 'w') as f:\n" " f.write('something')" @@ -3393,7 +3442,7 @@ msgstr "" "with open('/some/path', 'w') as f:\n" " f.write('something')" -#: ../../library/unittest.mock.rst:2507 +#: ../../library/unittest.mock.rst:2556 msgid "" "The issue is that even if you mock out the call to :func:`open` it is the " "*returned object* that is used as a context manager (and has :meth:`~object." @@ -3403,7 +3452,7 @@ msgstr "" "回傳物件*\\ (且其 :meth:`~object.__enter__` 和 :meth:`~ object.__exit__` 已" "被呼叫)。" -#: ../../library/unittest.mock.rst:2511 +#: ../../library/unittest.mock.rst:2560 msgid "" "Mocking context managers with a :class:`MagicMock` is common enough and " "fiddly enough that a helper function is useful. ::" @@ -3411,7 +3460,7 @@ msgstr "" "使用 :class:`MagicMock` mock 情境管理器相當常見並且精細,因此輔助函式就非常有" "用: ::" -#: ../../library/unittest.mock.rst:2514 +#: ../../library/unittest.mock.rst:2563 msgid "" ">>> m = mock_open()\n" ">>> with patch('__main__.open', m):\n" @@ -3441,11 +3490,11 @@ msgstr "" ">>> handle = m()\n" ">>> handle.write.assert_called_once_with('some stuff')" -#: ../../library/unittest.mock.rst:2528 +#: ../../library/unittest.mock.rst:2577 msgid "And for reading files::" msgstr "以及讀取檔案: ::" -#: ../../library/unittest.mock.rst:2530 +#: ../../library/unittest.mock.rst:2579 msgid "" ">>> with patch('__main__.open', mock_open(read_data='bibble')) as m:\n" "... with open('foo') as h:\n" @@ -3461,11 +3510,11 @@ msgstr "" ">>> m.assert_called_once_with('foo')\n" ">>> assert result == 'bibble'" -#: ../../library/unittest.mock.rst:2541 +#: ../../library/unittest.mock.rst:2590 msgid "Autospeccing" msgstr "Autospeccing(自動規格)" -#: ../../library/unittest.mock.rst:2543 +#: ../../library/unittest.mock.rst:2592 msgid "" "Autospeccing is based on the existing :attr:`spec` feature of mock. It " "limits the api of mocks to the api of an original object (the spec), but it " @@ -3479,11 +3528,11 @@ msgstr "" "有與規格的屬性相同的 api。此外,被 mock 的函式/方法具有與原始的函式/方法相同" "的呼叫簽名,因此如果它們被不正確地呼叫,就會引發 :exc:`TypeError`。" -#: ../../library/unittest.mock.rst:2550 +#: ../../library/unittest.mock.rst:2599 msgid "Before I explain how auto-speccing works, here's why it is needed." msgstr "在解釋自動規格如何運作之前,我們先解釋為什麼需要它。" -#: ../../library/unittest.mock.rst:2552 +#: ../../library/unittest.mock.rst:2601 msgid "" ":class:`Mock` is a very powerful and flexible object, but it suffers from a " "flaw which is general to mocking. If you refactor some of your code, rename " @@ -3496,7 +3545,7 @@ msgstr "" "實物件的程式碼測試仍然會通過。這意味著即使你的程式碼壞了,但測試仍可以全部通" "過。" -#: ../../library/unittest.mock.rst:2560 +#: ../../library/unittest.mock.rst:2609 msgid "" "Before 3.5, tests with a typo in the word assert would silently pass when " "they should raise an error. You can still achieve this behavior by passing " @@ -3505,7 +3554,7 @@ msgstr "" "在 3.5 之前,當測試應該引發錯誤時,斷言單字中存在拼字錯誤的測驗會默默地通過。" "你仍可以透過將 ``unsafe=True`` 傳遞給 Mock 來實作此行為。" -#: ../../library/unittest.mock.rst:2563 +#: ../../library/unittest.mock.rst:2612 msgid "" "Note that this is another reason why you need integration tests as well as " "unit tests. Testing everything in isolation is all fine and dandy, but if " @@ -3515,7 +3564,7 @@ msgstr "" "謹記這是你需要有整合測試和單元測試的另一個原因。單獨測試所有內容都很好,但如" "果你不測試你的單元是如何「連接在一起」的,那麼測試還是有機會發現很多錯誤。" -#: ../../library/unittest.mock.rst:2568 +#: ../../library/unittest.mock.rst:2617 msgid "" ":mod:`mock` already provides a feature to help with this, called speccing. " "If you use a class or instance as the :attr:`spec` for a mock then you can " @@ -3525,13 +3574,13 @@ msgstr "" "類別或實例作為 mock 的 :attr:`spec`,那麼你在 mock 上只能存取真實類別中存在的" "屬性:" -#: ../../library/unittest.mock.rst:2579 +#: ../../library/unittest.mock.rst:2628 msgid "" "The spec only applies to the mock itself, so we still have the same issue " "with any methods on the mock:" msgstr "該規格僅適用於 mock 本身,因此在 mock 上的任何方法仍然有相同的問題:" -#: ../../library/unittest.mock.rst:2582 +#: ../../library/unittest.mock.rst:2631 msgid "" ">>> mock.has_data()\n" "\n" @@ -3541,7 +3590,7 @@ msgstr "" "\n" ">>> mock.has_data.assret_called_with() # 故意的錯字!" -#: ../../library/unittest.mock.rst:2588 +#: ../../library/unittest.mock.rst:2637 msgid "" "Auto-speccing solves this problem. You can either pass ``autospec=True`` to :" "func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " @@ -3559,11 +3608,11 @@ msgstr "" "的),所以你可以將它與非常複雜或深度巢狀使用的物件(例如連續引用的模組)一起" "使用,而不會過於影響性能。" -#: ../../library/unittest.mock.rst:2597 +#: ../../library/unittest.mock.rst:2646 msgid "Here's an example of it in use::" msgstr "這是一個正在使用的例子: ::" -#: ../../library/unittest.mock.rst:2599 +#: ../../library/unittest.mock.rst:2648 msgid "" ">>> from urllib import request\n" ">>> patcher = patch('__main__.request', autospec=True)\n" @@ -3581,7 +3630,7 @@ msgstr "" ">>> mock_request.Request\n" "" -#: ../../library/unittest.mock.rst:2607 +#: ../../library/unittest.mock.rst:2656 msgid "" "You can see that :class:`request.Request` has a spec. :class:`request." "Request` takes two arguments in the constructor (one of which is *self*). " @@ -3591,7 +3640,7 @@ msgstr "" "構函式中接受兩個引數(其中之一是 *self*\\ )。如果我們錯誤地呼叫它,會發生以" "下情況: ::" -#: ../../library/unittest.mock.rst:2611 +#: ../../library/unittest.mock.rst:2660 msgid "" ">>> req = request.Request()\n" "Traceback (most recent call last):\n" @@ -3603,13 +3652,13 @@ msgstr "" " ...\n" "TypeError: () takes at least 2 arguments (1 given)" -#: ../../library/unittest.mock.rst:2616 +#: ../../library/unittest.mock.rst:2665 msgid "" "The spec also applies to instantiated classes (i.e. the return value of " "specced mocks)::" msgstr "此規格也適用於實例化的類別(即有規格的 mock 的回傳值): ::" -#: ../../library/unittest.mock.rst:2619 +#: ../../library/unittest.mock.rst:2668 msgid "" ">>> req = request.Request('foo')\n" ">>> req\n" @@ -3619,7 +3668,7 @@ msgstr "" ">>> req\n" "" -#: ../../library/unittest.mock.rst:2623 +#: ../../library/unittest.mock.rst:2672 msgid "" ":class:`Request` objects are not callable, so the return value of " "instantiating our mocked out :class:`request.Request` is a non-callable " @@ -3630,7 +3679,7 @@ msgstr "" "`request.Request` 的回傳值是不可呼叫的 mock。規格到位後,斷言中的任何拼字錯誤" "都會引發正確的錯誤: ::" -#: ../../library/unittest.mock.rst:2627 +#: ../../library/unittest.mock.rst:2676 msgid "" ">>> req.add_header('spam', 'eggs')\n" "\n" @@ -3648,7 +3697,7 @@ msgstr "" "AttributeError: Mock object has no attribute 'assret_called_with'\n" ">>> req.add_header.assert_called_with('spam', 'eggs')" -#: ../../library/unittest.mock.rst:2635 +#: ../../library/unittest.mock.rst:2684 msgid "" "In many cases you will just be able to add ``autospec=True`` to your " "existing :func:`patch` calls and then be protected against bugs due to typos " @@ -3657,7 +3706,7 @@ msgstr "" "在許多情況下,你只需要將 ``autospec=True`` 新增至現有的 :func:`patch` 呼叫" "中,然後就可以防止因拼字錯誤和 api 變更而導致的錯誤。" -#: ../../library/unittest.mock.rst:2639 +#: ../../library/unittest.mock.rst:2688 msgid "" "As well as using *autospec* through :func:`patch` there is a :func:" "`create_autospec` for creating autospecced mocks directly:" @@ -3665,7 +3714,7 @@ msgstr "" "除了透過 :func:`patch` 使用 *autospec* 之外,還有一個 :func:" "`create_autospec` 用於直接建立有自動規格的 mock:" -#: ../../library/unittest.mock.rst:2647 +#: ../../library/unittest.mock.rst:2696 msgid "" "This isn't without caveats and limitations however, which is why it is not " "the default behaviour. In order to know what attributes are available on the " @@ -3682,7 +3731,7 @@ msgstr "" "描述器,那麼你可能無法使用 autospec。換句話說,設計你的物件讓內省是安全的 " "[#]_ 會比較好。" -#: ../../library/unittest.mock.rst:2656 +#: ../../library/unittest.mock.rst:2705 msgid "" "A more serious problem is that it is common for instance attributes to be " "created in the :meth:`~object.__init__` method and not to exist on the class " @@ -3693,7 +3742,7 @@ msgstr "" "而其根本不存在於類別中。*autospec* 無法知道任何動態建立的屬性,並將 api 限制" "為可見的屬性。: ::" -#: ../../library/unittest.mock.rst:2661 +#: ../../library/unittest.mock.rst:2710 msgid "" ">>> class Something:\n" "... def __init__(self):\n" @@ -3719,7 +3768,7 @@ msgstr "" " ...\n" "AttributeError: Mock object has no attribute 'a'" -#: ../../library/unittest.mock.rst:2673 +#: ../../library/unittest.mock.rst:2722 msgid "" "There are a few different ways of resolving this problem. The easiest, but " "not necessarily the least annoying, way is to simply set the required " @@ -3731,7 +3780,7 @@ msgstr "" "在 mock 上設定所需的屬性。因為雖然 *autospec* 不允許你取得規格中不存在的屬" "性,但是它不會阻止你設定它們: ::" -#: ../../library/unittest.mock.rst:2679 +#: ../../library/unittest.mock.rst:2728 msgid "" ">>> with patch('__main__.Something', autospec=True):\n" "... thing = Something()\n" @@ -3743,7 +3792,7 @@ msgstr "" "... thing.a = 33\n" "..." -#: ../../library/unittest.mock.rst:2684 +#: ../../library/unittest.mock.rst:2733 msgid "" "There is a more aggressive version of both *spec* and *autospec* that *does* " "prevent you setting non-existent attributes. This is useful if you want to " @@ -3754,7 +3803,7 @@ msgstr "" "屬性。如果你想確保你的程式碼僅能\\ *設定*\\ 有效的屬性,那麼這會很有用,但顯" "然它也順便阻止了這個特殊情況:" -#: ../../library/unittest.mock.rst:2697 +#: ../../library/unittest.mock.rst:2746 msgid "" "Probably the best way of solving the problem is to add class attributes as " "default values for instance members initialised in :meth:`~object.__init__`. " @@ -3766,7 +3815,7 @@ msgstr "" "的實例成員的預設值。請注意,如果你僅在 :meth:`!__init__` 中設定預設屬性,那麼" "透過類別屬性(當然在實例之間共用)提供它們也會更快。例如:" -#: ../../library/unittest.mock.rst:2703 +#: ../../library/unittest.mock.rst:2752 msgid "" "class Something:\n" " a = 33" @@ -3774,7 +3823,7 @@ msgstr "" "class Something:\n" " a = 33" -#: ../../library/unittest.mock.rst:2708 +#: ../../library/unittest.mock.rst:2757 msgid "" "This brings up another issue. It is relatively common to provide a default " "value of ``None`` for members that will later be an object of a different " @@ -3790,7 +3839,7 @@ msgstr "" "他型別的成員,因此自動規格不會對設定為 ``None`` 的成員使用規格。這些會只是普" "通的 mock(通常是 MagicMocks):" -#: ../../library/unittest.mock.rst:2723 +#: ../../library/unittest.mock.rst:2772 msgid "" "If modifying your production classes to add defaults isn't to your liking " "then there are more options. One of these is simply to use an instance as " @@ -3806,7 +3855,7 @@ msgstr "" "你使用替代物件作為規格。值得慶幸的是 :func:`patch` 支援這一點 - 你可以簡單地" "將替代物件作為 *autospec* 引數傳遞: ::" -#: ../../library/unittest.mock.rst:2731 +#: ../../library/unittest.mock.rst:2780 msgid "" ">>> class Something:\n" "... def __init__(self):\n" @@ -3832,7 +3881,7 @@ msgstr "" ">>> mock.a\n" "" -#: ../../library/unittest.mock.rst:2744 +#: ../../library/unittest.mock.rst:2793 msgid "" "This only applies to classes or already instantiated objects. Calling a " "mocked class to create a mock instance *does not* create a real instance. It " @@ -3841,11 +3890,11 @@ msgstr "" "這只適用於類別或已經實例化的物件。呼叫一個被 mock 的類別來建立一個 mock 實例" "\\ *不會*\\ 建立真的實例。它僅查找屬性及對 :func:`dir` 的呼叫。" -#: ../../library/unittest.mock.rst:2749 +#: ../../library/unittest.mock.rst:2798 msgid "Sealing mocks" msgstr "密封 mock" -#: ../../library/unittest.mock.rst:2758 +#: ../../library/unittest.mock.rst:2807 msgid "" "Seal will disable the automatic creation of mocks when accessing an " "attribute of the mock being sealed or any of its attributes that are already " @@ -3854,7 +3903,7 @@ msgstr "" "當存取被密封的 mock 的屬性或其任何已經遞迴 mock 的屬性時,seal 將停用 mock 的" "自動建立。" -#: ../../library/unittest.mock.rst:2761 +#: ../../library/unittest.mock.rst:2810 msgid "" "If a mock instance with a name or a spec is assigned to an attribute it " "won't be considered in the sealing chain. This allows one to prevent seal " @@ -3863,7 +3912,7 @@ msgstr "" "如果將具有名稱或規格的 mock 實例指派給屬性,則不會出現在密封鏈中。這表示可藉" "由固定 mock 物件的一部分來防止密封。: ::" -#: ../../library/unittest.mock.rst:2765 +#: ../../library/unittest.mock.rst:2814 msgid "" ">>> mock = Mock()\n" ">>> mock.submock.attribute1 = 2\n" @@ -3881,28 +3930,28 @@ msgstr "" ">>> mock.submock.attribute2 # This will raise AttributeError.\n" ">>> mock.not_submock.attribute2 # This won't raise." -#: ../../library/unittest.mock.rst:2777 +#: ../../library/unittest.mock.rst:2826 msgid "" "Order of precedence of :attr:`side_effect`, :attr:`return_value` and *wraps*" msgstr ":attr:`side_effect`、:attr:`return_value` 和 *wraps* 的優先順序" -#: ../../library/unittest.mock.rst:2779 +#: ../../library/unittest.mock.rst:2828 msgid "The order of their precedence is:" msgstr "它們的優先順序是:" -#: ../../library/unittest.mock.rst:2781 +#: ../../library/unittest.mock.rst:2830 msgid ":attr:`~Mock.side_effect`" msgstr ":attr:`~Mock.side_effect`" -#: ../../library/unittest.mock.rst:2782 +#: ../../library/unittest.mock.rst:2831 msgid ":attr:`~Mock.return_value`" msgstr ":attr:`~Mock.return_value`" -#: ../../library/unittest.mock.rst:2783 +#: ../../library/unittest.mock.rst:2832 msgid "*wraps*" msgstr "*wraps*" -#: ../../library/unittest.mock.rst:2785 +#: ../../library/unittest.mock.rst:2834 msgid "" "If all three are set, mock will return the value from :attr:`~Mock." "side_effect`, ignoring :attr:`~Mock.return_value` and the wrapped object " @@ -3914,7 +3963,7 @@ msgstr "" "略 :attr:`~Mock.return_value` 和被包裝物件。如果設定了任兩項,則優先順序較高" "的一項將回傳該值。無論先設定哪個順序,優先順序都保持不變。" -#: ../../library/unittest.mock.rst:2803 +#: ../../library/unittest.mock.rst:2852 msgid "" "As ``None`` is the default value of :attr:`~Mock.side_effect`, if you " "reassign its value back to ``None``, the order of precedence will be checked " @@ -3925,7 +3974,7 @@ msgstr "" "``None``,則會檢查 :attr:`~Mock.return_value` 和被包裝物件之間的優先順序,忽" "略 :attr:`~Mock.side_effect`。" -#: ../../library/unittest.mock.rst:2812 +#: ../../library/unittest.mock.rst:2861 msgid "" "If the value being returned by :attr:`~Mock.side_effect` is :data:`DEFAULT`, " "it is ignored and the order of precedence moves to the successor to obtain " @@ -3934,7 +3983,7 @@ msgstr "" "如果 :attr:`~Mock.side_effect` 回傳的值是 :data:`DEFAULT`,它將被忽略,並且優" "先順序被移動到後面一個以獲得要回傳的值。" -#: ../../library/unittest.mock.rst:2821 +#: ../../library/unittest.mock.rst:2870 msgid "" "When :class:`Mock` wraps an object, the default value of :attr:`~Mock." "return_value` will be :data:`DEFAULT`." @@ -3942,13 +3991,13 @@ msgstr "" "當 :class:`Mock` 包裝一個物件時,:attr:`~Mock.return_value` 的預設值將為 :" "data:`DEFAULT`。" -#: ../../library/unittest.mock.rst:2830 +#: ../../library/unittest.mock.rst:2879 msgid "" "The order of precedence will ignore this value and it will move to the last " "successor which is the wrapped object." msgstr "優先順序將忽略該值,並將移動到最後一個,即被包裝物件。" -#: ../../library/unittest.mock.rst:2833 +#: ../../library/unittest.mock.rst:2882 msgid "" "As the real call is being made to the wrapped object, creating an instance " "of this mock will return the real instance of the class. The positional " @@ -3957,7 +4006,7 @@ msgstr "" "當對被包裝物件進行真正的呼叫時,建立此 mock 的實例將回傳該類別的真實實例。必" "須傳遞被包裝物件所需的位置引數(如果存在)。" -#: ../../library/unittest.mock.rst:2851 +#: ../../library/unittest.mock.rst:2900 msgid "" "But if you assign ``None`` to it, this will not be ignored as it is an " "explicit assignment. So, the order of precedence will not move to the " @@ -3966,13 +4015,13 @@ msgstr "" "但如果你為其賦予 ``None`` 則不會被忽略,因為它是明確賦值。因此,優先順序不會" "移至被包裝物件。" -#: ../../library/unittest.mock.rst:2859 +#: ../../library/unittest.mock.rst:2908 msgid "" "Even if you set all three at once when initializing the mock, the order of " "precedence remains the same:" msgstr "即使你在初始化 mock 時同時設定所有三個,優先順序也保持不變:" -#: ../../library/unittest.mock.rst:2876 +#: ../../library/unittest.mock.rst:2925 msgid "" "If :attr:`~Mock.side_effect` is exhausted, the order of precedence will not " "cause a value to be obtained from the successors. Instead, ``StopIteration`` " diff --git a/library/unittest.po b/library/unittest.po index 07a29017bd..bd134aa24b 100644 --- a/library/unittest.po +++ b/library/unittest.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-10-16 06:03+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2376,6 +2376,12 @@ msgstr "" #: ../../library/unittest.rst:1576 msgid "" +"The *loop_factory* passed to :class:`asyncio.Runner`. Override in subclasses " +"with :class:`asyncio.EventLoop` to avoid using the asyncio policy system." +msgstr "" + +#: ../../library/unittest.rst:1584 +msgid "" "Method called to prepare the test fixture. This is called after :meth:" "`setUp`. This is called immediately before calling the test method; other " "than :exc:`AssertionError` or :exc:`SkipTest`, any exception raised by this " @@ -2383,7 +2389,7 @@ msgid "" "implementation does nothing." msgstr "" -#: ../../library/unittest.rst:1584 +#: ../../library/unittest.rst:1592 msgid "" "Method called immediately after the test method has been called and the " "result recorded. This is called before :meth:`tearDown`. This is called " @@ -2396,11 +2402,11 @@ msgid "" "the outcome of the test method. The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:1596 +#: ../../library/unittest.rst:1604 msgid "This method accepts a coroutine that can be used as a cleanup function." msgstr "" -#: ../../library/unittest.rst:1600 +#: ../../library/unittest.rst:1608 msgid "" "Enter the supplied :term:`asynchronous context manager`. If successful, " "also add its :meth:`~object.__aexit__` method as a cleanup function by :meth:" @@ -2408,7 +2414,7 @@ msgid "" "method." msgstr "" -#: ../../library/unittest.rst:1610 +#: ../../library/unittest.rst:1618 msgid "" "Sets up a new event loop to run the test, collecting the result into the :" "class:`TestResult` object passed as *result*. If *result* is omitted or " @@ -2418,11 +2424,11 @@ msgid "" "cancelled." msgstr "" -#: ../../library/unittest.rst:1618 +#: ../../library/unittest.rst:1626 msgid "An example illustrating the order::" msgstr "" -#: ../../library/unittest.rst:1620 +#: ../../library/unittest.rst:1628 msgid "" "from unittest import IsolatedAsyncioTestCase\n" "\n" @@ -2494,14 +2500,14 @@ msgstr "" "if __name__ == \"__main__\":\n" " unittest.main()" -#: ../../library/unittest.rst:1654 +#: ../../library/unittest.rst:1662 msgid "" "After running the test, ``events`` would contain ``[\"setUp\", " "\"asyncSetUp\", \"test_response\", \"asyncTearDown\", \"tearDown\", " "\"cleanup\"]``." msgstr "" -#: ../../library/unittest.rst:1659 +#: ../../library/unittest.rst:1667 msgid "" "This class implements the portion of the :class:`TestCase` interface which " "allows the test runner to drive the test, but does not provide the methods " @@ -2510,11 +2516,11 @@ msgid "" "`unittest`-based test framework." msgstr "" -#: ../../library/unittest.rst:1669 +#: ../../library/unittest.rst:1677 msgid "Grouping tests" msgstr "" -#: ../../library/unittest.rst:1673 +#: ../../library/unittest.rst:1681 msgid "" "This class represents an aggregation of individual test cases and test " "suites. The class presents the interface needed by the test runner to allow " @@ -2522,14 +2528,14 @@ msgid "" "is the same as iterating over the suite, running each test individually." msgstr "" -#: ../../library/unittest.rst:1678 +#: ../../library/unittest.rst:1686 msgid "" "If *tests* is given, it must be an iterable of individual test cases or " "other test suites that will be used to build the suite initially. Additional " "methods are provided to add test cases and suites to the collection later on." msgstr "" -#: ../../library/unittest.rst:1682 +#: ../../library/unittest.rst:1690 msgid "" ":class:`TestSuite` objects behave much like :class:`TestCase` objects, " "except they do not actually implement a test. Instead, they are used to " @@ -2538,47 +2544,47 @@ msgid "" "instances:" msgstr "" -#: ../../library/unittest.rst:1690 +#: ../../library/unittest.rst:1698 msgid "Add a :class:`TestCase` or :class:`TestSuite` to the suite." msgstr "" -#: ../../library/unittest.rst:1695 +#: ../../library/unittest.rst:1703 msgid "" "Add all the tests from an iterable of :class:`TestCase` and :class:" "`TestSuite` instances to this test suite." msgstr "" -#: ../../library/unittest.rst:1698 +#: ../../library/unittest.rst:1706 msgid "" "This is equivalent to iterating over *tests*, calling :meth:`addTest` for " "each element." msgstr "" -#: ../../library/unittest.rst:1701 +#: ../../library/unittest.rst:1709 msgid ":class:`TestSuite` shares the following methods with :class:`TestCase`:" msgstr "" -#: ../../library/unittest.rst:1706 +#: ../../library/unittest.rst:1714 msgid "" "Run the tests associated with this suite, collecting the result into the " "test result object passed as *result*. Note that unlike :meth:`TestCase." "run`, :meth:`TestSuite.run` requires the result object to be passed in." msgstr "" -#: ../../library/unittest.rst:1714 +#: ../../library/unittest.rst:1722 msgid "" "Run the tests associated with this suite without collecting the result. This " "allows exceptions raised by the test to be propagated to the caller and can " "be used to support running tests under a debugger." msgstr "" -#: ../../library/unittest.rst:1721 +#: ../../library/unittest.rst:1729 msgid "" "Return the number of tests represented by this test object, including all " "individual tests and sub-suites." msgstr "" -#: ../../library/unittest.rst:1727 +#: ../../library/unittest.rst:1735 msgid "" "Tests grouped by a :class:`TestSuite` are always accessed by iteration. " "Subclasses can lazily provide tests by overriding :meth:`!__iter__`. Note " @@ -2590,31 +2596,31 @@ msgid "" "overrides :meth:`TestSuite._removeTestAtIndex` to preserve test references." msgstr "" -#: ../../library/unittest.rst:1737 +#: ../../library/unittest.rst:1745 msgid "" "In earlier versions the :class:`TestSuite` accessed tests directly rather " "than through iteration, so overriding :meth:`!__iter__` wasn't sufficient " "for providing tests." msgstr "" -#: ../../library/unittest.rst:1742 +#: ../../library/unittest.rst:1750 msgid "" "In earlier versions the :class:`TestSuite` held references to each :class:" "`TestCase` after :meth:`TestSuite.run`. Subclasses can restore that behavior " "by overriding :meth:`TestSuite._removeTestAtIndex`." msgstr "" -#: ../../library/unittest.rst:1747 +#: ../../library/unittest.rst:1755 msgid "" "In the typical usage of a :class:`TestSuite` object, the :meth:`run` method " "is invoked by a :class:`TestRunner` rather than by the end-user test harness." msgstr "" -#: ../../library/unittest.rst:1752 +#: ../../library/unittest.rst:1760 msgid "Loading and running tests" msgstr "" -#: ../../library/unittest.rst:1756 +#: ../../library/unittest.rst:1764 msgid "" "The :class:`TestLoader` class is used to create test suites from classes and " "modules. Normally, there is no need to create an instance of this class; " @@ -2623,11 +2629,11 @@ msgid "" "customization of some configurable properties." msgstr "" -#: ../../library/unittest.rst:1762 +#: ../../library/unittest.rst:1770 msgid ":class:`TestLoader` objects have the following attributes:" msgstr "" -#: ../../library/unittest.rst:1767 +#: ../../library/unittest.rst:1775 msgid "" "A list of the non-fatal errors encountered while loading tests. Not reset by " "the loader at any point. Fatal errors are signalled by the relevant method " @@ -2635,17 +2641,17 @@ msgid "" "synthetic test that will raise the original error when run." msgstr "" -#: ../../library/unittest.rst:1776 +#: ../../library/unittest.rst:1784 msgid ":class:`TestLoader` objects have the following methods:" msgstr "" -#: ../../library/unittest.rst:1781 +#: ../../library/unittest.rst:1789 msgid "" "Return a suite of all test cases contained in the :class:`TestCase`\\ -" "derived :class:`testCaseClass`." msgstr "" -#: ../../library/unittest.rst:1784 +#: ../../library/unittest.rst:1792 msgid "" "A test case instance is created for each method named by :meth:" "`getTestCaseNames`. By default these are the method names beginning with " @@ -2654,14 +2660,14 @@ msgid "" "method instead." msgstr "" -#: ../../library/unittest.rst:1793 +#: ../../library/unittest.rst:1801 msgid "" "Return a suite of all test cases contained in the given module. This method " "searches *module* for classes derived from :class:`TestCase` and creates an " "instance of the class for each test method defined for the class." msgstr "" -#: ../../library/unittest.rst:1800 +#: ../../library/unittest.rst:1808 msgid "" "While using a hierarchy of :class:`TestCase`\\ -derived classes can be " "convenient in sharing fixtures and helper functions, defining test methods " @@ -2670,7 +2676,7 @@ msgid "" "fixtures are different and defined in subclasses." msgstr "" -#: ../../library/unittest.rst:1806 +#: ../../library/unittest.rst:1814 msgid "" "If a module provides a ``load_tests`` function it will be called to load the " "tests. This allows modules to customize test loading. This is the " @@ -2678,24 +2684,24 @@ msgid "" "argument to ``load_tests``." msgstr "" -#: ../../library/unittest.rst:1811 +#: ../../library/unittest.rst:1819 msgid "Support for ``load_tests`` added." msgstr "" -#: ../../library/unittest.rst:1814 +#: ../../library/unittest.rst:1822 msgid "Support for a keyword-only argument *pattern* has been added." msgstr "" -#: ../../library/unittest.rst:1817 +#: ../../library/unittest.rst:1825 msgid "" "The undocumented and unofficial *use_load_tests* parameter has been removed." msgstr "" -#: ../../library/unittest.rst:1824 +#: ../../library/unittest.rst:1832 msgid "Return a suite of all test cases given a string specifier." msgstr "" -#: ../../library/unittest.rst:1826 +#: ../../library/unittest.rst:1834 msgid "" "The specifier *name* is a \"dotted name\" that may resolve either to a " "module, a test case class, a test method within a test case class, a :class:" @@ -2706,7 +2712,7 @@ msgid "" "object\"." msgstr "" -#: ../../library/unittest.rst:1834 +#: ../../library/unittest.rst:1842 msgid "" "For example, if you have a module :mod:`SampleTests` containing a :class:" "`TestCase`\\ -derived class :class:`SampleTestCase` with three test methods " @@ -2719,31 +2725,31 @@ msgid "" "a side-effect." msgstr "" -#: ../../library/unittest.rst:1844 +#: ../../library/unittest.rst:1852 msgid "The method optionally resolves *name* relative to the given *module*." msgstr "" -#: ../../library/unittest.rst:1846 +#: ../../library/unittest.rst:1854 msgid "" "If an :exc:`ImportError` or :exc:`AttributeError` occurs while traversing " "*name* then a synthetic test that raises that error when run will be " "returned. These errors are included in the errors accumulated by self.errors." msgstr "" -#: ../../library/unittest.rst:1855 +#: ../../library/unittest.rst:1863 msgid "" "Similar to :meth:`loadTestsFromName`, but takes a sequence of names rather " "than a single name. The return value is a test suite which supports all the " "tests defined for each name." msgstr "" -#: ../../library/unittest.rst:1862 +#: ../../library/unittest.rst:1870 msgid "" "Return a sorted sequence of method names found within *testCaseClass*; this " "should be a subclass of :class:`TestCase`." msgstr "" -#: ../../library/unittest.rst:1868 +#: ../../library/unittest.rst:1876 msgid "" "Find all the test modules by recursing into subdirectories from the " "specified start directory, and return a TestSuite object containing them. " @@ -2752,14 +2758,14 @@ msgid "" "Python identifiers) will be loaded." msgstr "" -#: ../../library/unittest.rst:1874 +#: ../../library/unittest.rst:1882 msgid "" "All test modules must be importable from the top level of the project. If " "the start directory is not the top level directory then *top_level_dir* must " "be specified separately." msgstr "" -#: ../../library/unittest.rst:1878 +#: ../../library/unittest.rst:1886 msgid "" "If importing a module fails, for example due to a syntax error, then this " "will be recorded as a single error and discovery will continue. If the " @@ -2767,7 +2773,7 @@ msgid "" "as a skip instead of an error." msgstr "" -#: ../../library/unittest.rst:1883 +#: ../../library/unittest.rst:1891 msgid "" "If a package (a directory containing a file named :file:`__init__.py`) is " "found, the package will be checked for a ``load_tests`` function. If this " @@ -2777,103 +2783,103 @@ msgid "" "itself calls ``loader.discover``." msgstr "" -#: ../../library/unittest.rst:1891 +#: ../../library/unittest.rst:1899 msgid "" "If ``load_tests`` exists then discovery does *not* recurse into the package, " "``load_tests`` is responsible for loading all tests in the package." msgstr "" -#: ../../library/unittest.rst:1895 +#: ../../library/unittest.rst:1903 msgid "" "The pattern is deliberately not stored as a loader attribute so that " "packages can continue discovery themselves." msgstr "" -#: ../../library/unittest.rst:1898 +#: ../../library/unittest.rst:1906 msgid "" "*top_level_dir* is stored internally, and used as a default to any nested " "calls to ``discover()``. That is, if a package's ``load_tests`` calls " "``loader.discover()``, it does not need to pass this argument." msgstr "" -#: ../../library/unittest.rst:1902 +#: ../../library/unittest.rst:1910 msgid "*start_dir* can be a dotted module name as well as a directory." msgstr "" -#: ../../library/unittest.rst:1906 +#: ../../library/unittest.rst:1914 msgid "" "Modules that raise :exc:`SkipTest` on import are recorded as skips, not " "errors." msgstr "" -#: ../../library/unittest.rst:1910 +#: ../../library/unittest.rst:1918 msgid "*start_dir* can be a :term:`namespace packages `." msgstr "" -#: ../../library/unittest.rst:1913 +#: ../../library/unittest.rst:1921 msgid "" "Paths are sorted before being imported so that execution order is the same " "even if the underlying file system's ordering is not dependent on file name." msgstr "" -#: ../../library/unittest.rst:1918 +#: ../../library/unittest.rst:1926 msgid "" "Found packages are now checked for ``load_tests`` regardless of whether " "their path matches *pattern*, because it is impossible for a package name to " "match the default pattern." msgstr "" -#: ../../library/unittest.rst:1923 +#: ../../library/unittest.rst:1931 msgid "" "*start_dir* can not be a :term:`namespace packages `. It " "has been broken since Python 3.7 and Python 3.11 officially remove it." msgstr "" -#: ../../library/unittest.rst:1927 +#: ../../library/unittest.rst:1935 msgid "*top_level_dir* is only stored for the duration of *discover* call." msgstr "" -#: ../../library/unittest.rst:1931 +#: ../../library/unittest.rst:1939 msgid "" "The following attributes of a :class:`TestLoader` can be configured either " "by subclassing or assignment on an instance:" msgstr "" -#: ../../library/unittest.rst:1937 +#: ../../library/unittest.rst:1945 msgid "" "String giving the prefix of method names which will be interpreted as test " "methods. The default value is ``'test'``." msgstr "" -#: ../../library/unittest.rst:1940 +#: ../../library/unittest.rst:1948 msgid "" "This affects :meth:`getTestCaseNames` and all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1946 +#: ../../library/unittest.rst:1954 msgid "" "Function to be used to compare method names when sorting them in :meth:" "`getTestCaseNames` and all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1952 +#: ../../library/unittest.rst:1960 msgid "" "Callable object that constructs a test suite from a list of tests. No " "methods on the resulting object are needed. The default value is the :class:" "`TestSuite` class." msgstr "" -#: ../../library/unittest.rst:1956 ../../library/unittest.rst:1969 +#: ../../library/unittest.rst:1964 ../../library/unittest.rst:1977 msgid "This affects all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1960 +#: ../../library/unittest.rst:1968 msgid "" "List of Unix shell-style wildcard test name patterns that test methods have " "to match to be included in test suites (see ``-k`` option)." msgstr "" -#: ../../library/unittest.rst:1963 +#: ../../library/unittest.rst:1971 msgid "" "If this attribute is not ``None`` (the default), all test methods to be " "included in test suites must match one of the patterns in this list. Note " @@ -2882,13 +2888,13 @@ msgid "" "have to be converted using ``*`` wildcards." msgstr "" -#: ../../library/unittest.rst:1976 +#: ../../library/unittest.rst:1984 msgid "" "This class is used to compile information about which tests have succeeded " "and which have failed." msgstr "" -#: ../../library/unittest.rst:1979 +#: ../../library/unittest.rst:1987 msgid "" "A :class:`TestResult` object stores the results of a set of tests. The :" "class:`TestCase` and :class:`TestSuite` classes ensure that results are " @@ -2896,7 +2902,7 @@ msgid "" "outcome of tests." msgstr "" -#: ../../library/unittest.rst:1984 +#: ../../library/unittest.rst:1992 msgid "" "Testing frameworks built on top of :mod:`unittest` may want access to the :" "class:`TestResult` object generated by running a set of tests for reporting " @@ -2904,61 +2910,61 @@ msgid "" "`TestRunner.run` method for this purpose." msgstr "" -#: ../../library/unittest.rst:1989 +#: ../../library/unittest.rst:1997 msgid "" ":class:`TestResult` instances have the following attributes that will be of " "interest when inspecting the results of running a set of tests:" msgstr "" -#: ../../library/unittest.rst:1995 +#: ../../library/unittest.rst:2003 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents a test which raised an " "unexpected exception." msgstr "" -#: ../../library/unittest.rst:2001 +#: ../../library/unittest.rst:2009 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents a test where a failure " "was explicitly signalled using the :ref:`assert\\* methods `." msgstr "" -#: ../../library/unittest.rst:2007 +#: ../../library/unittest.rst:2015 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding the reason for skipping the test." msgstr "" -#: ../../library/unittest.rst:2014 +#: ../../library/unittest.rst:2022 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents an expected failure or " "error of the test case." msgstr "" -#: ../../library/unittest.rst:2020 +#: ../../library/unittest.rst:2028 msgid "" "A list containing :class:`TestCase` instances that were marked as expected " "failures, but succeeded." msgstr "" -#: ../../library/unittest.rst:2025 +#: ../../library/unittest.rst:2033 msgid "" "A list containing 2-tuples of test case names and floats representing the " "elapsed time of each test which was run." msgstr "" -#: ../../library/unittest.rst:2032 +#: ../../library/unittest.rst:2040 msgid "" "Set to ``True`` when the execution of tests should stop by :meth:`stop`." msgstr "" -#: ../../library/unittest.rst:2036 +#: ../../library/unittest.rst:2044 msgid "The total number of tests run so far." msgstr "" -#: ../../library/unittest.rst:2040 +#: ../../library/unittest.rst:2048 msgid "" "If set to true, ``sys.stdout`` and ``sys.stderr`` will be buffered in " "between :meth:`startTest` and :meth:`stopTest` being called. Collected " @@ -2967,29 +2973,29 @@ msgid "" "error message." msgstr "" -#: ../../library/unittest.rst:2049 +#: ../../library/unittest.rst:2057 msgid "" "If set to true :meth:`stop` will be called on the first failure or error, " "halting the test run." msgstr "" -#: ../../library/unittest.rst:2056 +#: ../../library/unittest.rst:2064 msgid "If set to true then local variables will be shown in tracebacks." msgstr "" -#: ../../library/unittest.rst:2062 +#: ../../library/unittest.rst:2070 msgid "" "Return ``True`` if all tests run so far have passed, otherwise returns " "``False``." msgstr "" -#: ../../library/unittest.rst:2065 +#: ../../library/unittest.rst:2073 msgid "" "Returns ``False`` if there were any :attr:`unexpectedSuccesses` from tests " "marked with the :func:`expectedFailure` decorator." msgstr "" -#: ../../library/unittest.rst:2071 +#: ../../library/unittest.rst:2079 msgid "" "This method can be called to signal that the set of tests being run should " "be aborted by setting the :attr:`shouldStop` attribute to ``True``. :class:" @@ -2997,7 +3003,7 @@ msgid "" "additional tests." msgstr "" -#: ../../library/unittest.rst:2076 +#: ../../library/unittest.rst:2084 msgid "" "For example, this feature is used by the :class:`TextTestRunner` class to " "stop the test framework when the user signals an interrupt from the " @@ -3005,7 +3011,7 @@ msgid "" "implementations can use this in a similar manner." msgstr "" -#: ../../library/unittest.rst:2081 +#: ../../library/unittest.rst:2089 msgid "" "The following methods of the :class:`TestResult` class are used to maintain " "the internal data structures, and may be extended in subclasses to support " @@ -3013,141 +3019,141 @@ msgid "" "tools which support interactive reporting while tests are being run." msgstr "" -#: ../../library/unittest.rst:2089 +#: ../../library/unittest.rst:2097 msgid "Called when the test case *test* is about to be run." msgstr "" -#: ../../library/unittest.rst:2093 +#: ../../library/unittest.rst:2101 msgid "" "Called after the test case *test* has been executed, regardless of the " "outcome." msgstr "" -#: ../../library/unittest.rst:2098 +#: ../../library/unittest.rst:2106 msgid "Called once before any tests are executed." msgstr "" -#: ../../library/unittest.rst:2105 +#: ../../library/unittest.rst:2113 msgid "Called once after all tests are executed." msgstr "" -#: ../../library/unittest.rst:2112 +#: ../../library/unittest.rst:2120 msgid "" "Called when the test case *test* raises an unexpected exception. *err* is a " "tuple of the form returned by :func:`sys.exc_info`: ``(type, value, " "traceback)``." msgstr "" -#: ../../library/unittest.rst:2116 +#: ../../library/unittest.rst:2124 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`errors` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2123 +#: ../../library/unittest.rst:2131 msgid "" "Called when the test case *test* signals a failure. *err* is a tuple of the " "form returned by :func:`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -#: ../../library/unittest.rst:2126 +#: ../../library/unittest.rst:2134 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`failures` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2133 +#: ../../library/unittest.rst:2141 msgid "Called when the test case *test* succeeds." msgstr "" -#: ../../library/unittest.rst:2135 +#: ../../library/unittest.rst:2143 msgid "The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:2140 +#: ../../library/unittest.rst:2148 msgid "" "Called when the test case *test* is skipped. *reason* is the reason the " "test gave for skipping." msgstr "" -#: ../../library/unittest.rst:2143 +#: ../../library/unittest.rst:2151 msgid "" "The default implementation appends a tuple ``(test, reason)`` to the " "instance's :attr:`skipped` attribute." msgstr "" -#: ../../library/unittest.rst:2149 +#: ../../library/unittest.rst:2157 msgid "" "Called when the test case *test* fails or errors, but was marked with the :" "func:`expectedFailure` decorator." msgstr "" -#: ../../library/unittest.rst:2152 +#: ../../library/unittest.rst:2160 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`expectedFailures` attribute, where *formatted_err* is a " "formatted traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2159 +#: ../../library/unittest.rst:2167 msgid "" "Called when the test case *test* was marked with the :func:`expectedFailure` " "decorator, but succeeded." msgstr "" -#: ../../library/unittest.rst:2162 +#: ../../library/unittest.rst:2170 msgid "" "The default implementation appends the test to the instance's :attr:" "`unexpectedSuccesses` attribute." msgstr "" -#: ../../library/unittest.rst:2168 +#: ../../library/unittest.rst:2176 msgid "" "Called when a subtest finishes. *test* is the test case corresponding to " "the test method. *subtest* is a custom :class:`TestCase` instance " "describing the subtest." msgstr "" -#: ../../library/unittest.rst:2172 +#: ../../library/unittest.rst:2180 msgid "" "If *outcome* is :const:`None`, the subtest succeeded. Otherwise, it failed " "with an exception where *outcome* is a tuple of the form returned by :func:" "`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -#: ../../library/unittest.rst:2176 +#: ../../library/unittest.rst:2184 msgid "" "The default implementation does nothing when the outcome is a success, and " "records subtest failures as normal failures." msgstr "" -#: ../../library/unittest.rst:2183 +#: ../../library/unittest.rst:2191 msgid "" "Called when the test case finishes. *elapsed* is the time represented in " "seconds, and it includes the execution of cleanup functions." msgstr "" -#: ../../library/unittest.rst:2190 +#: ../../library/unittest.rst:2198 msgid "" "A concrete implementation of :class:`TestResult` used by the :class:" "`TextTestRunner`. Subclasses should accept ``**kwargs`` to ensure " "compatibility as the interface changes." msgstr "" -#: ../../library/unittest.rst:2196 +#: ../../library/unittest.rst:2204 msgid "Added the *durations* keyword parameter." msgstr "新增 *durations* 關鍵字參數。" -#: ../../library/unittest.rst:2201 +#: ../../library/unittest.rst:2209 msgid "" "Instance of the :class:`TestLoader` class intended to be shared. If no " "customization of the :class:`TestLoader` is needed, this instance can be " "used instead of repeatedly creating new instances." msgstr "" -#: ../../library/unittest.rst:2210 +#: ../../library/unittest.rst:2218 msgid "" "A basic test runner implementation that outputs results to a stream. If " "*stream* is ``None``, the default, :data:`sys.stderr` is used as the output " @@ -3158,7 +3164,7 @@ msgid "" "unittest." msgstr "" -#: ../../library/unittest.rst:2217 +#: ../../library/unittest.rst:2225 msgid "" "By default this runner shows :exc:`DeprecationWarning`, :exc:" "`PendingDeprecationWarning`, :exc:`ResourceWarning` and :exc:`ImportWarning` " @@ -3168,32 +3174,32 @@ msgid "" "``None``." msgstr "" -#: ../../library/unittest.rst:2225 +#: ../../library/unittest.rst:2233 msgid "Added the *warnings* parameter." msgstr "新增 *warnings* 參數。" -#: ../../library/unittest.rst:2228 +#: ../../library/unittest.rst:2236 msgid "" "The default stream is set to :data:`sys.stderr` at instantiation time rather " "than import time." msgstr "" -#: ../../library/unittest.rst:2232 +#: ../../library/unittest.rst:2240 msgid "Added the *tb_locals* parameter." msgstr "新增 *tb_locals* 參數。" -#: ../../library/unittest.rst:2235 +#: ../../library/unittest.rst:2243 msgid "Added the *durations* parameter." msgstr "新增 *durations* 參數。" -#: ../../library/unittest.rst:2240 +#: ../../library/unittest.rst:2248 msgid "" "This method returns the instance of ``TestResult`` used by :meth:`run`. It " "is not intended to be called directly, but can be overridden in subclasses " "to provide a custom ``TestResult``." msgstr "" -#: ../../library/unittest.rst:2244 +#: ../../library/unittest.rst:2252 msgid "" "``_makeResult()`` instantiates the class or callable passed in the " "``TextTestRunner`` constructor as the ``resultclass`` argument. It defaults " @@ -3201,11 +3207,11 @@ msgid "" "class is instantiated with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2249 +#: ../../library/unittest.rst:2257 msgid "stream, descriptions, verbosity" msgstr "" -#: ../../library/unittest.rst:2253 +#: ../../library/unittest.rst:2261 msgid "" "This method is the main public interface to the ``TextTestRunner``. This " "method takes a :class:`TestSuite` or :class:`TestCase` instance. A :class:" @@ -3213,7 +3219,7 @@ msgid "" "run and the results printed to stdout." msgstr "" -#: ../../library/unittest.rst:2264 +#: ../../library/unittest.rst:2272 msgid "" "A command-line program that loads a set of tests from *module* and runs " "them; this is primarily for making test modules conveniently executable. The " @@ -3221,7 +3227,7 @@ msgid "" "of a test script::" msgstr "" -#: ../../library/unittest.rst:2269 +#: ../../library/unittest.rst:2277 msgid "" "if __name__ == '__main__':\n" " unittest.main()" @@ -3229,13 +3235,13 @@ msgstr "" "if __name__ == '__main__':\n" " unittest.main()" -#: ../../library/unittest.rst:2272 +#: ../../library/unittest.rst:2280 msgid "" "You can run tests with more detailed information by passing in the verbosity " "argument::" msgstr "" -#: ../../library/unittest.rst:2275 +#: ../../library/unittest.rst:2283 msgid "" "if __name__ == '__main__':\n" " unittest.main(verbosity=2)" @@ -3243,7 +3249,7 @@ msgstr "" "if __name__ == '__main__':\n" " unittest.main(verbosity=2)" -#: ../../library/unittest.rst:2278 +#: ../../library/unittest.rst:2286 msgid "" "The *defaultTest* argument is either the name of a single test or an " "iterable of test names to run if no test names are specified via *argv*. If " @@ -3251,14 +3257,14 @@ msgid "" "tests found in *module* are run." msgstr "" -#: ../../library/unittest.rst:2283 +#: ../../library/unittest.rst:2291 msgid "" "The *argv* argument can be a list of options passed to the program, with the " "first element being the program name. If not specified or ``None``, the " "values of :data:`sys.argv` are used." msgstr "" -#: ../../library/unittest.rst:2287 +#: ../../library/unittest.rst:2295 msgid "" "The *testRunner* argument can either be a test runner class or an already " "created instance of it. By default ``main`` calls :func:`sys.exit` with an " @@ -3266,20 +3272,20 @@ msgid "" "code of 5 indicates that no tests were run or skipped." msgstr "" -#: ../../library/unittest.rst:2292 +#: ../../library/unittest.rst:2300 msgid "" "The *testLoader* argument has to be a :class:`TestLoader` instance, and " "defaults to :data:`defaultTestLoader`." msgstr "" -#: ../../library/unittest.rst:2295 +#: ../../library/unittest.rst:2303 msgid "" "``main`` supports being used from the interactive interpreter by passing in " "the argument ``exit=False``. This displays the result on standard output " "without calling :func:`sys.exit`::" msgstr "" -#: ../../library/unittest.rst:2299 +#: ../../library/unittest.rst:2307 msgid "" ">>> from unittest import main\n" ">>> main(module='test_module', exit=False)" @@ -3287,13 +3293,13 @@ msgstr "" ">>> from unittest import main\n" ">>> main(module='test_module', exit=False)" -#: ../../library/unittest.rst:2302 +#: ../../library/unittest.rst:2310 msgid "" "The *failfast*, *catchbreak* and *buffer* parameters have the same effect as " "the same-name `command-line options`_." msgstr "" -#: ../../library/unittest.rst:2305 +#: ../../library/unittest.rst:2313 msgid "" "The *warnings* argument specifies the :ref:`warning filter ` " "that should be used while running the tests. If it's not specified, it will " @@ -3302,60 +3308,60 @@ msgid "" "to ``'default'``." msgstr "" -#: ../../library/unittest.rst:2311 +#: ../../library/unittest.rst:2319 msgid "" "Calling ``main`` returns an object with the ``result`` attribute that " "contains the result of the tests run as a :class:`unittest.TestResult`." msgstr "" -#: ../../library/unittest.rst:2314 +#: ../../library/unittest.rst:2322 msgid "The *exit* parameter was added." msgstr "新增 *exit* 參數。" -#: ../../library/unittest.rst:2317 +#: ../../library/unittest.rst:2325 msgid "" "The *verbosity*, *failfast*, *catchbreak*, *buffer* and *warnings* " "parameters were added." msgstr "" -#: ../../library/unittest.rst:2321 +#: ../../library/unittest.rst:2329 msgid "" "The *defaultTest* parameter was changed to also accept an iterable of test " "names." msgstr "" -#: ../../library/unittest.rst:2329 +#: ../../library/unittest.rst:2337 msgid "load_tests Protocol" msgstr "" -#: ../../library/unittest.rst:2333 +#: ../../library/unittest.rst:2341 msgid "" "Modules or packages can customize how tests are loaded from them during " "normal test runs or test discovery by implementing a function called " "``load_tests``." msgstr "" -#: ../../library/unittest.rst:2336 +#: ../../library/unittest.rst:2344 msgid "" "If a test module defines ``load_tests`` it will be called by :meth:" "`TestLoader.loadTestsFromModule` with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2339 ../../library/unittest.rst:2371 +#: ../../library/unittest.rst:2347 ../../library/unittest.rst:2379 msgid "load_tests(loader, standard_tests, pattern)" msgstr "load_tests(loader, standard_tests, pattern)" -#: ../../library/unittest.rst:2341 +#: ../../library/unittest.rst:2349 msgid "" "where *pattern* is passed straight through from ``loadTestsFromModule``. It " "defaults to ``None``." msgstr "" -#: ../../library/unittest.rst:2344 +#: ../../library/unittest.rst:2352 msgid "It should return a :class:`TestSuite`." msgstr "" -#: ../../library/unittest.rst:2346 +#: ../../library/unittest.rst:2354 msgid "" "*loader* is the instance of :class:`TestLoader` doing the loading. " "*standard_tests* are the tests that would be loaded by default from the " @@ -3364,13 +3370,13 @@ msgid "" "packages as part of test discovery." msgstr "" -#: ../../library/unittest.rst:2352 +#: ../../library/unittest.rst:2360 msgid "" "A typical ``load_tests`` function that loads tests from a specific set of :" "class:`TestCase` classes may look like::" msgstr "" -#: ../../library/unittest.rst:2355 +#: ../../library/unittest.rst:2363 msgid "" "test_cases = (TestCase1, TestCase2, TestCase3)\n" "\n" @@ -3390,7 +3396,7 @@ msgstr "" " suite.addTests(tests)\n" " return suite" -#: ../../library/unittest.rst:2364 +#: ../../library/unittest.rst:2372 msgid "" "If discovery is started in a directory containing a package, either from the " "command line or by calling :meth:`TestLoader.discover`, then the package :" @@ -3400,21 +3406,21 @@ msgid "" "left up to ``load_tests`` which is called with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2373 +#: ../../library/unittest.rst:2381 msgid "" "This should return a :class:`TestSuite` representing all the tests from the " "package. (``standard_tests`` will only contain tests collected from :file:" "`__init__.py`.)" msgstr "" -#: ../../library/unittest.rst:2377 +#: ../../library/unittest.rst:2385 msgid "" "Because the pattern is passed into ``load_tests`` the package is free to " "continue (and potentially modify) test discovery. A 'do nothing' " "``load_tests`` function for a test package would look like::" msgstr "" -#: ../../library/unittest.rst:2381 +#: ../../library/unittest.rst:2389 msgid "" "def load_tests(loader, standard_tests, pattern):\n" " # top level directory cached on loader instance\n" @@ -3424,17 +3430,17 @@ msgid "" " return standard_tests" msgstr "" -#: ../../library/unittest.rst:2388 +#: ../../library/unittest.rst:2396 msgid "" "Discovery no longer checks package names for matching *pattern* due to the " "impossibility of package names matching the default pattern." msgstr "" -#: ../../library/unittest.rst:2395 +#: ../../library/unittest.rst:2403 msgid "Class and Module Fixtures" msgstr "" -#: ../../library/unittest.rst:2397 +#: ../../library/unittest.rst:2405 msgid "" "Class and module level fixtures are implemented in :class:`TestSuite`. When " "the test suite encounters a test from a new class then :meth:`tearDownClass` " @@ -3442,27 +3448,27 @@ msgid "" "`setUpClass` from the new class." msgstr "" -#: ../../library/unittest.rst:2402 +#: ../../library/unittest.rst:2410 msgid "" "Similarly if a test is from a different module from the previous test then " "``tearDownModule`` from the previous module is run, followed by " "``setUpModule`` from the new module." msgstr "" -#: ../../library/unittest.rst:2406 +#: ../../library/unittest.rst:2414 msgid "" "After all the tests have run the final ``tearDownClass`` and " "``tearDownModule`` are run." msgstr "" -#: ../../library/unittest.rst:2409 +#: ../../library/unittest.rst:2417 msgid "" "Note that shared fixtures do not play well with [potential] features like " "test parallelization and they break test isolation. They should be used with " "care." msgstr "" -#: ../../library/unittest.rst:2412 +#: ../../library/unittest.rst:2420 msgid "" "The default ordering of tests created by the unittest test loaders is to " "group all tests from the same modules and classes together. This will lead " @@ -3472,14 +3478,14 @@ msgid "" "functions may be called multiple times in a single test run." msgstr "" -#: ../../library/unittest.rst:2419 +#: ../../library/unittest.rst:2427 msgid "" "Shared fixtures are not intended to work with suites with non-standard " "ordering. A ``BaseTestSuite`` still exists for frameworks that don't want to " "support shared fixtures." msgstr "" -#: ../../library/unittest.rst:2423 +#: ../../library/unittest.rst:2431 msgid "" "If there are any exceptions raised during one of the shared fixture " "functions the test is reported as an error. Because there is no " @@ -3489,15 +3495,15 @@ msgid "" "matter, but if you are a framework author it may be relevant." msgstr "" -#: ../../library/unittest.rst:2432 +#: ../../library/unittest.rst:2440 msgid "setUpClass and tearDownClass" msgstr "" -#: ../../library/unittest.rst:2434 +#: ../../library/unittest.rst:2442 msgid "These must be implemented as class methods::" msgstr "" -#: ../../library/unittest.rst:2436 +#: ../../library/unittest.rst:2444 msgid "" "import unittest\n" "\n" @@ -3521,14 +3527,14 @@ msgstr "" " def tearDownClass(cls):\n" " cls._connection.destroy()" -#: ../../library/unittest.rst:2447 +#: ../../library/unittest.rst:2455 msgid "" "If you want the ``setUpClass`` and ``tearDownClass`` on base classes called " "then you must call up to them yourself. The implementations in :class:" "`TestCase` are empty." msgstr "" -#: ../../library/unittest.rst:2451 +#: ../../library/unittest.rst:2459 msgid "" "If an exception is raised during a ``setUpClass`` then the tests in the " "class are not run and the ``tearDownClass`` is not run. Skipped classes will " @@ -3537,15 +3543,15 @@ msgid "" "instead of as an error." msgstr "" -#: ../../library/unittest.rst:2459 +#: ../../library/unittest.rst:2467 msgid "setUpModule and tearDownModule" msgstr "" -#: ../../library/unittest.rst:2461 +#: ../../library/unittest.rst:2469 msgid "These should be implemented as functions::" msgstr "" -#: ../../library/unittest.rst:2463 +#: ../../library/unittest.rst:2471 msgid "" "def setUpModule():\n" " createConnection()\n" @@ -3559,7 +3565,7 @@ msgstr "" "def tearDownModule():\n" " closeConnection()" -#: ../../library/unittest.rst:2469 +#: ../../library/unittest.rst:2477 msgid "" "If an exception is raised in a ``setUpModule`` then none of the tests in the " "module will be run and the ``tearDownModule`` will not be run. If the " @@ -3567,13 +3573,13 @@ msgid "" "having been skipped instead of as an error." msgstr "" -#: ../../library/unittest.rst:2474 +#: ../../library/unittest.rst:2482 msgid "" "To add cleanup code that must be run even in the case of an exception, use " "``addModuleCleanup``:" msgstr "" -#: ../../library/unittest.rst:2480 +#: ../../library/unittest.rst:2488 msgid "" "Add a function to be called after :func:`tearDownModule` to cleanup " "resources used during the test class. Functions will be called in reverse " @@ -3582,13 +3588,13 @@ msgid "" "`addModuleCleanup` when they are added." msgstr "" -#: ../../library/unittest.rst:2486 +#: ../../library/unittest.rst:2494 msgid "" "If :meth:`setUpModule` fails, meaning that :func:`tearDownModule` is not " "called, then any cleanup functions added will still be called." msgstr "" -#: ../../library/unittest.rst:2494 +#: ../../library/unittest.rst:2502 msgid "" "Enter the supplied :term:`context manager`. If successful, also add its :" "meth:`~object.__exit__` method as a cleanup function by :func:" @@ -3596,30 +3602,30 @@ msgid "" "method." msgstr "" -#: ../../library/unittest.rst:2504 +#: ../../library/unittest.rst:2512 msgid "" "This function is called unconditionally after :func:`tearDownModule`, or " "after :func:`setUpModule` if :func:`setUpModule` raises an exception." msgstr "" -#: ../../library/unittest.rst:2507 +#: ../../library/unittest.rst:2515 msgid "" "It is responsible for calling all the cleanup functions added by :func:" "`addModuleCleanup`. If you need cleanup functions to be called *prior* to :" "func:`tearDownModule` then you can call :func:`doModuleCleanups` yourself." msgstr "" -#: ../../library/unittest.rst:2512 +#: ../../library/unittest.rst:2520 msgid "" ":func:`doModuleCleanups` pops methods off the stack of cleanup functions one " "at a time, so it can be called at any time." msgstr "" -#: ../../library/unittest.rst:2519 +#: ../../library/unittest.rst:2527 msgid "Signal Handling" msgstr "" -#: ../../library/unittest.rst:2523 +#: ../../library/unittest.rst:2531 msgid "" "The :option:`-c/--catch ` command-line option to unittest, " "along with the ``catchbreak`` parameter to :func:`unittest.main`, provide " @@ -3629,7 +3635,7 @@ msgid "" "A second control-c will raise a :exc:`KeyboardInterrupt` in the usual way." msgstr "" -#: ../../library/unittest.rst:2530 +#: ../../library/unittest.rst:2538 msgid "" "The control-c handling signal handler attempts to remain compatible with " "code or tests that install their own :const:`signal.SIGINT` handler. If the " @@ -3641,48 +3647,48 @@ msgid "" "disabled the :func:`removeHandler` decorator can be used." msgstr "" -#: ../../library/unittest.rst:2539 +#: ../../library/unittest.rst:2547 msgid "" "There are a few utility functions for framework authors to enable control-c " "handling functionality within test frameworks." msgstr "" -#: ../../library/unittest.rst:2544 +#: ../../library/unittest.rst:2552 msgid "" "Install the control-c handler. When a :const:`signal.SIGINT` is received " "(usually in response to the user pressing control-c) all registered results " "have :meth:`~TestResult.stop` called." msgstr "" -#: ../../library/unittest.rst:2551 +#: ../../library/unittest.rst:2559 msgid "" "Register a :class:`TestResult` object for control-c handling. Registering a " "result stores a weak reference to it, so it doesn't prevent the result from " "being garbage collected." msgstr "" -#: ../../library/unittest.rst:2555 +#: ../../library/unittest.rst:2563 msgid "" "Registering a :class:`TestResult` object has no side-effects if control-c " "handling is not enabled, so test frameworks can unconditionally register all " "results they create independently of whether or not handling is enabled." msgstr "" -#: ../../library/unittest.rst:2562 +#: ../../library/unittest.rst:2570 msgid "" "Remove a registered result. Once a result has been removed then :meth:" "`~TestResult.stop` will no longer be called on that result object in " "response to a control-c." msgstr "" -#: ../../library/unittest.rst:2569 +#: ../../library/unittest.rst:2577 msgid "" "When called without arguments this function removes the control-c handler if " "it has been installed. This function can also be used as a test decorator to " "temporarily remove the handler while the test is being executed::" msgstr "" -#: ../../library/unittest.rst:2573 +#: ../../library/unittest.rst:2581 msgid "" "@unittest.removeHandler\n" "def test_signal_handling(self):\n" diff --git a/library/urllib.parse.po b/library/urllib.parse.po index b16410cf2d..d522fd40ff 100644 --- a/library/urllib.parse.po +++ b/library/urllib.parse.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,20 +37,29 @@ msgstr "" msgid "" "The module has been designed to match the internet RFC on Relative Uniform " "Resource Locators. It supports the following URL schemes: ``file``, ``ftp``, " -"``gopher``, ``hdl``, ``http``, ``https``, ``imap``, ``mailto``, ``mms``, " -"``news``, ``nntp``, ``prospero``, ``rsync``, ``rtsp``, ``rtsps``, ``rtspu``, " -"``sftp``, ``shttp``, ``sip``, ``sips``, ``snews``, ``svn``, ``svn+ssh``, " -"``telnet``, ``wais``, ``ws``, ``wss``." +"``gopher``, ``hdl``, ``http``, ``https``, ``imap``, ``itms-services``, " +"``mailto``, ``mms``, ``news``, ``nntp``, ``prospero``, ``rsync``, ``rtsp``, " +"``rtsps``, ``rtspu``, ``sftp``, ``shttp``, ``sip``, ``sips``, ``snews``, " +"``svn``, ``svn+ssh``, ``telnet``, ``wais``, ``ws``, ``wss``." msgstr "" -#: ../../library/urllib.parse.rst:30 +#: ../../library/urllib.parse.rst:32 +msgid "" +"The inclusion of the ``itms-services`` URL scheme can prevent an app from " +"passing Apple's App Store review process for the macOS and iOS App Stores. " +"Handling for the ``itms-services`` scheme is always removed on iOS; on " +"macOS, it *may* be removed if CPython has been built with the :option:`--" +"with-app-store-compliance` option." +msgstr "" + +#: ../../library/urllib.parse.rst:38 msgid "" "The :mod:`urllib.parse` module defines functions that fall into two broad " "categories: URL parsing and URL quoting. These are covered in detail in the " "following sections." msgstr "" -#: ../../library/urllib.parse.rst:34 +#: ../../library/urllib.parse.rst:42 msgid "" "This module's functions use the deprecated term ``netloc`` (or ``net_loc``), " "which was introduced in :rfc:`1808`. However, this term has been obsoleted " @@ -58,17 +67,17 @@ msgid "" "The use of ``netloc`` is continued for backward compatibility." msgstr "" -#: ../../library/urllib.parse.rst:40 +#: ../../library/urllib.parse.rst:48 msgid "URL Parsing" msgstr "" -#: ../../library/urllib.parse.rst:42 +#: ../../library/urllib.parse.rst:50 msgid "" "The URL parsing functions focus on splitting a URL string into its " "components, or on combining URL components into a URL string." msgstr "" -#: ../../library/urllib.parse.rst:47 +#: ../../library/urllib.parse.rst:55 msgid "" "Parse a URL into six components, returning a 6-item :term:`named tuple`. " "This corresponds to the general structure of a URL: ``scheme://netloc/path;" @@ -79,7 +88,7 @@ msgid "" "slash in the *path* component, which is retained if present. For example:" msgstr "" -#: ../../library/urllib.parse.rst:56 +#: ../../library/urllib.parse.rst:64 msgid "" ">>> from urllib.parse import urlparse\n" ">>> urlparse(\"scheme://netloc/path;parameters?query#fragment\")\n" @@ -125,14 +134,14 @@ msgstr "" ">>> o._replace(fragment=\"\").geturl()\n" "'http://docs.python.org/3/library/urllib.parse.html?highlight=params'" -#: ../../library/urllib.parse.rst:80 +#: ../../library/urllib.parse.rst:88 msgid "" "Following the syntax specifications in :rfc:`1808`, urlparse recognizes a " "netloc only if it is properly introduced by '//'. Otherwise the input is " "presumed to be a relative URL and thus to start with a path component." msgstr "" -#: ../../library/urllib.parse.rst:85 +#: ../../library/urllib.parse.rst:93 msgid "" ">>> from urllib.parse import urlparse\n" ">>> urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" @@ -158,7 +167,7 @@ msgstr "" "ParseResult(scheme='', netloc='', path='help/Python.html', params='',\n" " query='', fragment='')" -#: ../../library/urllib.parse.rst:99 +#: ../../library/urllib.parse.rst:107 msgid "" "The *scheme* argument gives the default addressing scheme, to be used only " "if the URL does not specify one. It should be the same type (text or bytes) " @@ -166,7 +175,7 @@ msgid "" "is automatically converted to ``b''`` if appropriate." msgstr "" -#: ../../library/urllib.parse.rst:104 +#: ../../library/urllib.parse.rst:112 msgid "" "If the *allow_fragments* argument is false, fragment identifiers are not " "recognized. Instead, they are parsed as part of the path, parameters or " @@ -174,174 +183,174 @@ msgid "" "return value." msgstr "" -#: ../../library/urllib.parse.rst:109 +#: ../../library/urllib.parse.rst:117 msgid "" "The return value is a :term:`named tuple`, which means that its items can be " "accessed by index or as named attributes, which are:" msgstr "" -#: ../../library/urllib.parse.rst:113 ../../library/urllib.parse.rst:302 -#: ../../library/urllib.parse.rst:415 +#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 +#: ../../library/urllib.parse.rst:423 msgid "Attribute" msgstr "屬性" -#: ../../library/urllib.parse.rst:113 ../../library/urllib.parse.rst:302 -#: ../../library/urllib.parse.rst:415 +#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 +#: ../../library/urllib.parse.rst:423 msgid "Index" msgstr "" -#: ../../library/urllib.parse.rst:113 ../../library/urllib.parse.rst:302 -#: ../../library/urllib.parse.rst:415 +#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 +#: ../../library/urllib.parse.rst:423 msgid "Value" msgstr "" -#: ../../library/urllib.parse.rst:113 ../../library/urllib.parse.rst:302 -#: ../../library/urllib.parse.rst:415 +#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 +#: ../../library/urllib.parse.rst:423 msgid "Value if not present" msgstr "" -#: ../../library/urllib.parse.rst:115 ../../library/urllib.parse.rst:304 +#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:312 msgid ":attr:`scheme`" msgstr ":attr:`scheme`" -#: ../../library/urllib.parse.rst:115 ../../library/urllib.parse.rst:304 -#: ../../library/urllib.parse.rst:417 +#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:312 +#: ../../library/urllib.parse.rst:425 msgid "0" msgstr "0" -#: ../../library/urllib.parse.rst:115 ../../library/urllib.parse.rst:304 +#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:312 msgid "URL scheme specifier" msgstr "" -#: ../../library/urllib.parse.rst:115 ../../library/urllib.parse.rst:304 +#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:312 msgid "*scheme* parameter" msgstr "" -#: ../../library/urllib.parse.rst:117 ../../library/urllib.parse.rst:306 +#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:314 msgid ":attr:`netloc`" msgstr ":attr:`netloc`" -#: ../../library/urllib.parse.rst:117 ../../library/urllib.parse.rst:306 -#: ../../library/urllib.parse.rst:419 +#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:314 +#: ../../library/urllib.parse.rst:427 msgid "1" msgstr "1" -#: ../../library/urllib.parse.rst:117 ../../library/urllib.parse.rst:306 +#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:314 msgid "Network location part" msgstr "" -#: ../../library/urllib.parse.rst:117 ../../library/urllib.parse.rst:119 -#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:124 -#: ../../library/urllib.parse.rst:126 ../../library/urllib.parse.rst:306 -#: ../../library/urllib.parse.rst:308 ../../library/urllib.parse.rst:310 -#: ../../library/urllib.parse.rst:312 ../../library/urllib.parse.rst:417 -#: ../../library/urllib.parse.rst:419 +#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:127 +#: ../../library/urllib.parse.rst:129 ../../library/urllib.parse.rst:132 +#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:314 +#: ../../library/urllib.parse.rst:316 ../../library/urllib.parse.rst:318 +#: ../../library/urllib.parse.rst:320 ../../library/urllib.parse.rst:425 +#: ../../library/urllib.parse.rst:427 msgid "empty string" msgstr "" -#: ../../library/urllib.parse.rst:119 ../../library/urllib.parse.rst:308 +#: ../../library/urllib.parse.rst:127 ../../library/urllib.parse.rst:316 msgid ":attr:`path`" msgstr ":attr:`path`" -#: ../../library/urllib.parse.rst:119 ../../library/urllib.parse.rst:308 +#: ../../library/urllib.parse.rst:127 ../../library/urllib.parse.rst:316 msgid "2" msgstr "2" -#: ../../library/urllib.parse.rst:119 ../../library/urllib.parse.rst:308 +#: ../../library/urllib.parse.rst:127 ../../library/urllib.parse.rst:316 msgid "Hierarchical path" msgstr "" -#: ../../library/urllib.parse.rst:121 +#: ../../library/urllib.parse.rst:129 msgid ":attr:`params`" msgstr ":attr:`params`" -#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 +#: ../../library/urllib.parse.rst:129 ../../library/urllib.parse.rst:318 msgid "3" msgstr "3" -#: ../../library/urllib.parse.rst:121 +#: ../../library/urllib.parse.rst:129 msgid "Parameters for last path element" msgstr "" -#: ../../library/urllib.parse.rst:124 ../../library/urllib.parse.rst:310 +#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:318 msgid ":attr:`query`" msgstr ":attr:`query`" -#: ../../library/urllib.parse.rst:124 ../../library/urllib.parse.rst:312 +#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:320 msgid "4" msgstr "4" -#: ../../library/urllib.parse.rst:124 ../../library/urllib.parse.rst:310 +#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:318 msgid "Query component" msgstr "" -#: ../../library/urllib.parse.rst:126 ../../library/urllib.parse.rst:312 -#: ../../library/urllib.parse.rst:419 +#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:320 +#: ../../library/urllib.parse.rst:427 msgid ":attr:`fragment`" msgstr ":attr:`fragment`" -#: ../../library/urllib.parse.rst:126 +#: ../../library/urllib.parse.rst:134 msgid "5" msgstr "5" -#: ../../library/urllib.parse.rst:126 ../../library/urllib.parse.rst:312 -#: ../../library/urllib.parse.rst:419 +#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:320 +#: ../../library/urllib.parse.rst:427 msgid "Fragment identifier" msgstr "" -#: ../../library/urllib.parse.rst:128 ../../library/urllib.parse.rst:314 +#: ../../library/urllib.parse.rst:136 ../../library/urllib.parse.rst:322 msgid ":attr:`username`" msgstr ":attr:`username`" -#: ../../library/urllib.parse.rst:128 ../../library/urllib.parse.rst:314 +#: ../../library/urllib.parse.rst:136 ../../library/urllib.parse.rst:322 msgid "User name" msgstr "" -#: ../../library/urllib.parse.rst:128 ../../library/urllib.parse.rst:130 -#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:134 -#: ../../library/urllib.parse.rst:314 ../../library/urllib.parse.rst:316 -#: ../../library/urllib.parse.rst:318 ../../library/urllib.parse.rst:320 +#: ../../library/urllib.parse.rst:136 ../../library/urllib.parse.rst:138 +#: ../../library/urllib.parse.rst:140 ../../library/urllib.parse.rst:142 +#: ../../library/urllib.parse.rst:322 ../../library/urllib.parse.rst:324 +#: ../../library/urllib.parse.rst:326 ../../library/urllib.parse.rst:328 msgid ":const:`None`" msgstr ":const:`None`" -#: ../../library/urllib.parse.rst:130 ../../library/urllib.parse.rst:316 +#: ../../library/urllib.parse.rst:138 ../../library/urllib.parse.rst:324 msgid ":attr:`password`" msgstr ":attr:`password`" -#: ../../library/urllib.parse.rst:130 ../../library/urllib.parse.rst:316 +#: ../../library/urllib.parse.rst:138 ../../library/urllib.parse.rst:324 msgid "Password" msgstr "" -#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:318 +#: ../../library/urllib.parse.rst:140 ../../library/urllib.parse.rst:326 msgid ":attr:`hostname`" msgstr ":attr:`hostname`" -#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:318 +#: ../../library/urllib.parse.rst:140 ../../library/urllib.parse.rst:326 msgid "Host name (lower case)" msgstr "" -#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:320 +#: ../../library/urllib.parse.rst:142 ../../library/urllib.parse.rst:328 msgid ":attr:`port`" msgstr ":attr:`port`" -#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:320 +#: ../../library/urllib.parse.rst:142 ../../library/urllib.parse.rst:328 msgid "Port number as integer, if present" msgstr "" -#: ../../library/urllib.parse.rst:138 ../../library/urllib.parse.rst:324 +#: ../../library/urllib.parse.rst:146 ../../library/urllib.parse.rst:332 msgid "" "Reading the :attr:`port` attribute will raise a :exc:`ValueError` if an " "invalid port is specified in the URL. See section :ref:`urlparse-result-" "object` for more information on the result object." msgstr "" -#: ../../library/urllib.parse.rst:142 ../../library/urllib.parse.rst:328 +#: ../../library/urllib.parse.rst:150 ../../library/urllib.parse.rst:336 msgid "" "Unmatched square brackets in the :attr:`netloc` attribute will raise a :exc:" "`ValueError`." msgstr "" -#: ../../library/urllib.parse.rst:145 ../../library/urllib.parse.rst:331 +#: ../../library/urllib.parse.rst:153 ../../library/urllib.parse.rst:339 msgid "" "Characters in the :attr:`netloc` attribute that decompose under NFKC " "normalization (as used by the IDNA encoding) into any of ``/``, ``?``, " @@ -349,7 +358,7 @@ msgid "" "decomposed before parsing, no error will be raised." msgstr "" -#: ../../library/urllib.parse.rst:150 +#: ../../library/urllib.parse.rst:158 msgid "" "As is the case with all named tuples, the subclass has a few additional " "methods and attributes that are particularly useful. One such method is :" @@ -357,7 +366,7 @@ msgid "" "object replacing specified fields with new values." msgstr "" -#: ../../library/urllib.parse.rst:155 +#: ../../library/urllib.parse.rst:163 msgid "" ">>> from urllib.parse import urlparse\n" ">>> u = urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" @@ -381,36 +390,36 @@ msgstr "" "html',\n" " params='', query='', fragment='')" -#: ../../library/urllib.parse.rst:169 +#: ../../library/urllib.parse.rst:177 msgid "" ":func:`urlparse` does not perform validation. See :ref:`URL parsing " "security ` for details." msgstr "" -#: ../../library/urllib.parse.rst:172 +#: ../../library/urllib.parse.rst:180 msgid "Added IPv6 URL parsing capabilities." msgstr "新增剖析 IPv6 URL 的能力。" -#: ../../library/urllib.parse.rst:175 +#: ../../library/urllib.parse.rst:183 msgid "" "The fragment is now parsed for all URL schemes (unless *allow_fragments* is " "false), in accordance with :rfc:`3986`. Previously, an allowlist of schemes " "that support fragments existed." msgstr "" -#: ../../library/urllib.parse.rst:180 ../../library/urllib.parse.rst:345 +#: ../../library/urllib.parse.rst:188 ../../library/urllib.parse.rst:353 msgid "" "Out-of-range port numbers now raise :exc:`ValueError`, instead of returning :" "const:`None`." msgstr "" -#: ../../library/urllib.parse.rst:184 ../../library/urllib.parse.rst:349 +#: ../../library/urllib.parse.rst:192 ../../library/urllib.parse.rst:357 msgid "" "Characters that affect netloc parsing under NFKC normalization will now " "raise :exc:`ValueError`." msgstr "" -#: ../../library/urllib.parse.rst:191 +#: ../../library/urllib.parse.rst:199 msgid "" "Parse a query string given as a string argument (data of type :mimetype:" "`application/x-www-form-urlencoded`). Data are returned as a dictionary. " @@ -418,7 +427,7 @@ msgid "" "lists of values for each name." msgstr "" -#: ../../library/urllib.parse.rst:196 ../../library/urllib.parse.rst:241 +#: ../../library/urllib.parse.rst:204 ../../library/urllib.parse.rst:249 msgid "" "The optional argument *keep_blank_values* is a flag indicating whether blank " "values in percent-encoded queries should be treated as blank strings. A true " @@ -427,48 +436,48 @@ msgid "" "treated as if they were not included." msgstr "" -#: ../../library/urllib.parse.rst:202 ../../library/urllib.parse.rst:247 +#: ../../library/urllib.parse.rst:210 ../../library/urllib.parse.rst:255 msgid "" "The optional argument *strict_parsing* is a flag indicating what to do with " "parsing errors. If false (the default), errors are silently ignored. If " "true, errors raise a :exc:`ValueError` exception." msgstr "" -#: ../../library/urllib.parse.rst:206 ../../library/urllib.parse.rst:251 +#: ../../library/urllib.parse.rst:214 ../../library/urllib.parse.rst:259 msgid "" "The optional *encoding* and *errors* parameters specify how to decode " "percent-encoded sequences into Unicode characters, as accepted by the :meth:" "`bytes.decode` method." msgstr "" -#: ../../library/urllib.parse.rst:210 ../../library/urllib.parse.rst:255 +#: ../../library/urllib.parse.rst:218 ../../library/urllib.parse.rst:263 msgid "" "The optional argument *max_num_fields* is the maximum number of fields to " "read. If set, then throws a :exc:`ValueError` if there are more than " "*max_num_fields* fields read." msgstr "" -#: ../../library/urllib.parse.rst:214 ../../library/urllib.parse.rst:259 +#: ../../library/urllib.parse.rst:222 ../../library/urllib.parse.rst:267 msgid "" "The optional argument *separator* is the symbol to use for separating the " "query arguments. It defaults to ``&``." msgstr "" -#: ../../library/urllib.parse.rst:217 +#: ../../library/urllib.parse.rst:225 msgid "" "Use the :func:`urllib.parse.urlencode` function (with the ``doseq`` " "parameter set to ``True``) to convert such dictionaries into query strings." msgstr "" -#: ../../library/urllib.parse.rst:222 ../../library/urllib.parse.rst:265 +#: ../../library/urllib.parse.rst:230 ../../library/urllib.parse.rst:273 msgid "Add *encoding* and *errors* parameters." msgstr "" -#: ../../library/urllib.parse.rst:225 ../../library/urllib.parse.rst:268 +#: ../../library/urllib.parse.rst:233 ../../library/urllib.parse.rst:276 msgid "Added *max_num_fields* parameter." msgstr "新增 *max_num_fields* 參數。" -#: ../../library/urllib.parse.rst:228 ../../library/urllib.parse.rst:271 +#: ../../library/urllib.parse.rst:236 ../../library/urllib.parse.rst:279 msgid "" "Added *separator* parameter with the default value of ``&``. Python versions " "earlier than Python 3.10 allowed using both ``;`` and ``&`` as query " @@ -476,20 +485,20 @@ msgid "" "key, with ``&`` as the default separator." msgstr "" -#: ../../library/urllib.parse.rst:237 +#: ../../library/urllib.parse.rst:245 msgid "" "Parse a query string given as a string argument (data of type :mimetype:" "`application/x-www-form-urlencoded`). Data are returned as a list of name, " "value pairs." msgstr "" -#: ../../library/urllib.parse.rst:262 +#: ../../library/urllib.parse.rst:270 msgid "" "Use the :func:`urllib.parse.urlencode` function to convert such lists of " "pairs into query strings." msgstr "" -#: ../../library/urllib.parse.rst:280 +#: ../../library/urllib.parse.rst:288 msgid "" "Construct a URL from a tuple as returned by ``urlparse()``. The *parts* " "argument can be any six-item iterable. This may result in a slightly " @@ -498,7 +507,7 @@ msgid "" "states that these are equivalent)." msgstr "" -#: ../../library/urllib.parse.rst:289 +#: ../../library/urllib.parse.rst:297 msgid "" "This is similar to :func:`urlparse`, but does not split the params from the " "URL. This should generally be used instead of :func:`urlparse` if the more " @@ -508,41 +517,41 @@ msgid "" "returns a 5-item :term:`named tuple`::" msgstr "" -#: ../../library/urllib.parse.rst:296 +#: ../../library/urllib.parse.rst:304 msgid "" "(addressing scheme, network location, path, query, fragment identifier)." msgstr "" "(addressing scheme, network location, path, query, fragment identifier)." -#: ../../library/urllib.parse.rst:298 ../../library/urllib.parse.rst:411 +#: ../../library/urllib.parse.rst:306 ../../library/urllib.parse.rst:419 msgid "" "The return value is a :term:`named tuple`, its items can be accessed by " "index or as named attributes:" msgstr "" -#: ../../library/urllib.parse.rst:336 +#: ../../library/urllib.parse.rst:344 msgid "" "Following some of the `WHATWG spec`_ that updates RFC 3986, leading C0 " "control and space characters are stripped from the URL. ``\\n``, ``\\r`` and " "tab ``\\t`` characters are removed from the URL at any position." msgstr "" -#: ../../library/urllib.parse.rst:342 +#: ../../library/urllib.parse.rst:350 msgid "" ":func:`urlsplit` does not perform validation. See :ref:`URL parsing " "security ` for details." msgstr "" -#: ../../library/urllib.parse.rst:353 +#: ../../library/urllib.parse.rst:361 msgid "ASCII newline and tab characters are stripped from the URL." msgstr "" -#: ../../library/urllib.parse.rst:356 +#: ../../library/urllib.parse.rst:364 msgid "" "Leading WHATWG C0 control and space characters are stripped from the URL." msgstr "" -#: ../../library/urllib.parse.rst:363 +#: ../../library/urllib.parse.rst:371 msgid "" "Combine the elements of a tuple as returned by :func:`urlsplit` into a " "complete URL as a string. The *parts* argument can be any five-item " @@ -551,7 +560,7 @@ msgid "" "a ? with an empty query; the RFC states that these are equivalent)." msgstr "" -#: ../../library/urllib.parse.rst:372 +#: ../../library/urllib.parse.rst:380 msgid "" "Construct a full (\"absolute\") URL by combining a \"base URL\" (*base*) " "with another URL (*url*). Informally, this uses components of the base URL, " @@ -559,20 +568,20 @@ msgid "" "path, to provide missing components in the relative URL. For example:" msgstr "" -#: ../../library/urllib.parse.rst:381 +#: ../../library/urllib.parse.rst:389 msgid "" "The *allow_fragments* argument has the same meaning and default as for :func:" "`urlparse`." msgstr "" -#: ../../library/urllib.parse.rst:386 +#: ../../library/urllib.parse.rst:394 msgid "" "If *url* is an absolute URL (that is, it starts with ``//`` or ``scheme://" "``), the *url*'s hostname and/or scheme will be present in the result. For " "example:" msgstr "" -#: ../../library/urllib.parse.rst:389 +#: ../../library/urllib.parse.rst:397 msgid "" ">>> urljoin('http://www.cwi.nl/%7Eguido/Python.html',\n" "... '//www.python.org/%7Eguido')\n" @@ -582,17 +591,17 @@ msgstr "" "... '//www.python.org/%7Eguido')\n" "'http://www.python.org/%7Eguido'" -#: ../../library/urllib.parse.rst:395 +#: ../../library/urllib.parse.rst:403 msgid "" "If you do not want that behavior, preprocess the *url* with :func:`urlsplit` " "and :func:`urlunsplit`, removing possible *scheme* and *netloc* parts." msgstr "" -#: ../../library/urllib.parse.rst:401 +#: ../../library/urllib.parse.rst:409 msgid "Behavior updated to match the semantics defined in :rfc:`3986`." msgstr "" -#: ../../library/urllib.parse.rst:406 +#: ../../library/urllib.parse.rst:414 msgid "" "If *url* contains a fragment identifier, return a modified version of *url* " "with no fragment identifier, and the fragment identifier as a separate " @@ -600,25 +609,25 @@ msgid "" "unmodified and an empty string." msgstr "" -#: ../../library/urllib.parse.rst:417 +#: ../../library/urllib.parse.rst:425 msgid ":attr:`url`" msgstr ":attr:`url`" -#: ../../library/urllib.parse.rst:417 +#: ../../library/urllib.parse.rst:425 msgid "URL with no fragment" msgstr "" -#: ../../library/urllib.parse.rst:422 +#: ../../library/urllib.parse.rst:430 msgid "" "See section :ref:`urlparse-result-object` for more information on the result " "object." msgstr "" -#: ../../library/urllib.parse.rst:425 +#: ../../library/urllib.parse.rst:433 msgid "Result is a structured object rather than a simple 2-tuple." msgstr "" -#: ../../library/urllib.parse.rst:430 +#: ../../library/urllib.parse.rst:438 msgid "" "Extract the url from a wrapped URL (that is, a string formatted as ````, ````, ``URL:scheme://host/path`` " @@ -626,11 +635,11 @@ msgid "" "without changes." msgstr "" -#: ../../library/urllib.parse.rst:438 +#: ../../library/urllib.parse.rst:446 msgid "URL parsing security" msgstr "" -#: ../../library/urllib.parse.rst:440 +#: ../../library/urllib.parse.rst:448 msgid "" "The :func:`urlsplit` and :func:`urlparse` APIs do not perform **validation** " "of inputs. They may not raise errors on inputs that other applications " @@ -639,14 +648,14 @@ msgid "" "rather than purity." msgstr "" -#: ../../library/urllib.parse.rst:446 +#: ../../library/urllib.parse.rst:454 msgid "" "Instead of raising an exception on unusual input, they may instead return " "some component parts as empty strings. Or components may contain more than " "perhaps they should." msgstr "" -#: ../../library/urllib.parse.rst:450 +#: ../../library/urllib.parse.rst:458 msgid "" "We recommend that users of these APIs where the values may be used anywhere " "with security implications code defensively. Do some verification within " @@ -655,7 +664,7 @@ msgid "" "that ``hostname``? etc." msgstr "" -#: ../../library/urllib.parse.rst:456 +#: ../../library/urllib.parse.rst:464 msgid "" "What constitutes a URL is not universally well defined. Different " "applications have different needs and desired constraints. For instance the " @@ -667,11 +676,11 @@ msgid "" "API behavior changes." msgstr "" -#: ../../library/urllib.parse.rst:467 +#: ../../library/urllib.parse.rst:475 msgid "Parsing ASCII Encoded Bytes" msgstr "" -#: ../../library/urllib.parse.rst:469 +#: ../../library/urllib.parse.rst:477 msgid "" "The URL parsing functions were originally designed to operate on character " "strings only. In practice, it is useful to be able to manipulate properly " @@ -680,14 +689,14 @@ msgid "" "`bytearray` objects in addition to :class:`str` objects." msgstr "" -#: ../../library/urllib.parse.rst:475 +#: ../../library/urllib.parse.rst:483 msgid "" "If :class:`str` data is passed in, the result will also contain only :class:" "`str` data. If :class:`bytes` or :class:`bytearray` data is passed in, the " "result will contain only :class:`bytes` data." msgstr "" -#: ../../library/urllib.parse.rst:479 +#: ../../library/urllib.parse.rst:487 msgid "" "Attempting to mix :class:`str` data with :class:`bytes` or :class:" "`bytearray` in a single function call will result in a :exc:`TypeError` " @@ -695,7 +704,7 @@ msgid "" "trigger :exc:`UnicodeDecodeError`." msgstr "" -#: ../../library/urllib.parse.rst:484 +#: ../../library/urllib.parse.rst:492 msgid "" "To support easier conversion of result objects between :class:`str` and :" "class:`bytes`, all return values from URL parsing functions provide either " @@ -708,14 +717,14 @@ msgid "" "`str` data (for :meth:`decode` methods)." msgstr "" -#: ../../library/urllib.parse.rst:495 +#: ../../library/urllib.parse.rst:503 msgid "" "Applications that need to operate on potentially improperly quoted URLs that " "may contain non-ASCII data will need to do their own decoding from bytes to " "characters before invoking the URL parsing methods." msgstr "" -#: ../../library/urllib.parse.rst:499 +#: ../../library/urllib.parse.rst:507 msgid "" "The behaviour described in this section applies only to the URL parsing " "functions. The URL quoting functions use their own rules when producing or " @@ -723,15 +732,15 @@ msgid "" "URL quoting functions." msgstr "" -#: ../../library/urllib.parse.rst:504 +#: ../../library/urllib.parse.rst:512 msgid "URL parsing functions now accept ASCII encoded byte sequences" msgstr "" -#: ../../library/urllib.parse.rst:511 +#: ../../library/urllib.parse.rst:519 msgid "Structured Parse Results" msgstr "" -#: ../../library/urllib.parse.rst:513 +#: ../../library/urllib.parse.rst:521 msgid "" "The result objects from the :func:`urlparse`, :func:`urlsplit` and :func:" "`urldefrag` functions are subclasses of the :class:`tuple` type. These " @@ -740,7 +749,7 @@ msgid "" "section, as well as an additional method:" msgstr "" -#: ../../library/urllib.parse.rst:521 +#: ../../library/urllib.parse.rst:529 msgid "" "Return the re-combined version of the original URL as a string. This may " "differ from the original URL in that the scheme may be normalized to lower " @@ -748,72 +757,72 @@ msgid "" "queries, and fragment identifiers will be removed." msgstr "" -#: ../../library/urllib.parse.rst:526 +#: ../../library/urllib.parse.rst:534 msgid "" "For :func:`urldefrag` results, only empty fragment identifiers will be " "removed. For :func:`urlsplit` and :func:`urlparse` results, all noted " "changes will be made to the URL returned by this method." msgstr "" -#: ../../library/urllib.parse.rst:530 +#: ../../library/urllib.parse.rst:538 msgid "" "The result of this method remains unchanged if passed back through the " "original parsing function:" msgstr "" -#: ../../library/urllib.parse.rst:543 +#: ../../library/urllib.parse.rst:551 msgid "" "The following classes provide the implementations of the structured parse " "results when operating on :class:`str` objects:" msgstr "" -#: ../../library/urllib.parse.rst:548 +#: ../../library/urllib.parse.rst:556 msgid "" "Concrete class for :func:`urldefrag` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`DefragResultBytes` instance." msgstr "" -#: ../../library/urllib.parse.rst:556 +#: ../../library/urllib.parse.rst:564 msgid "" "Concrete class for :func:`urlparse` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`ParseResultBytes` instance." msgstr "" -#: ../../library/urllib.parse.rst:562 +#: ../../library/urllib.parse.rst:570 msgid "" "Concrete class for :func:`urlsplit` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`SplitResultBytes` instance." msgstr "" -#: ../../library/urllib.parse.rst:567 +#: ../../library/urllib.parse.rst:575 msgid "" "The following classes provide the implementations of the parse results when " "operating on :class:`bytes` or :class:`bytearray` objects:" msgstr "" -#: ../../library/urllib.parse.rst:572 +#: ../../library/urllib.parse.rst:580 msgid "" "Concrete class for :func:`urldefrag` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`DefragResult` instance." msgstr "" -#: ../../library/urllib.parse.rst:580 +#: ../../library/urllib.parse.rst:588 msgid "" "Concrete class for :func:`urlparse` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`ParseResult` instance." msgstr "" -#: ../../library/urllib.parse.rst:588 +#: ../../library/urllib.parse.rst:596 msgid "" "Concrete class for :func:`urlsplit` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`SplitResult` instance." msgstr "" -#: ../../library/urllib.parse.rst:596 +#: ../../library/urllib.parse.rst:604 msgid "URL Quoting" msgstr "" -#: ../../library/urllib.parse.rst:598 +#: ../../library/urllib.parse.rst:606 msgid "" "The URL quoting functions focus on taking program data and making it safe " "for use as URL components by quoting special characters and appropriately " @@ -822,7 +831,7 @@ msgid "" "isn't already covered by the URL parsing functions above." msgstr "" -#: ../../library/urllib.parse.rst:606 +#: ../../library/urllib.parse.rst:614 msgid "" "Replace special characters in *string* using the :samp:`%{xx}` escape. " "Letters, digits, and the characters ``'_.-~'`` are never quoted. By default, " @@ -831,18 +840,18 @@ msgid "" "not be quoted --- its default value is ``'/'``." msgstr "" -#: ../../library/urllib.parse.rst:612 ../../library/urllib.parse.rst:658 -#: ../../library/urllib.parse.rst:687 +#: ../../library/urllib.parse.rst:620 ../../library/urllib.parse.rst:666 +#: ../../library/urllib.parse.rst:695 msgid "*string* may be either a :class:`str` or a :class:`bytes` object." msgstr "" -#: ../../library/urllib.parse.rst:614 +#: ../../library/urllib.parse.rst:622 msgid "" "Moved from :rfc:`2396` to :rfc:`3986` for quoting URL strings. \"~\" is now " "included in the set of unreserved characters." msgstr "" -#: ../../library/urllib.parse.rst:618 +#: ../../library/urllib.parse.rst:626 msgid "" "The optional *encoding* and *errors* parameters specify how to deal with non-" "ASCII characters, as accepted by the :meth:`str.encode` method. *encoding* " @@ -852,17 +861,17 @@ msgid "" "`TypeError` is raised." msgstr "" -#: ../../library/urllib.parse.rst:626 +#: ../../library/urllib.parse.rst:634 msgid "" "Note that ``quote(string, safe, encoding, errors)`` is equivalent to " "``quote_from_bytes(string.encode(encoding, errors), safe)``." msgstr "" -#: ../../library/urllib.parse.rst:629 +#: ../../library/urllib.parse.rst:637 msgid "Example: ``quote('/El Niño/')`` yields ``'/El%20Ni%C3%B1o/'``." msgstr "" -#: ../../library/urllib.parse.rst:634 +#: ../../library/urllib.parse.rst:642 msgid "" "Like :func:`quote`, but also replace spaces with plus signs, as required for " "quoting HTML form values when building up a query string to go into a URL. " @@ -870,21 +879,21 @@ msgid "" "*safe*. It also does not have *safe* default to ``'/'``." msgstr "" -#: ../../library/urllib.parse.rst:639 +#: ../../library/urllib.parse.rst:647 msgid "Example: ``quote_plus('/El Niño/')`` yields ``'%2FEl+Ni%C3%B1o%2F'``." msgstr "" -#: ../../library/urllib.parse.rst:644 +#: ../../library/urllib.parse.rst:652 msgid "" "Like :func:`quote`, but accepts a :class:`bytes` object rather than a :class:" "`str`, and does not perform string-to-bytes encoding." msgstr "" -#: ../../library/urllib.parse.rst:647 +#: ../../library/urllib.parse.rst:655 msgid "Example: ``quote_from_bytes(b'a&\\xef')`` yields ``'a%26%EF'``." msgstr "" -#: ../../library/urllib.parse.rst:653 +#: ../../library/urllib.parse.rst:661 msgid "" "Replace :samp:`%{xx}` escapes with their single-character equivalent. The " "optional *encoding* and *errors* parameters specify how to decode percent-" @@ -892,52 +901,52 @@ msgid "" "decode` method." msgstr "" -#: ../../library/urllib.parse.rst:660 +#: ../../library/urllib.parse.rst:668 msgid "" "*encoding* defaults to ``'utf-8'``. *errors* defaults to ``'replace'``, " "meaning invalid sequences are replaced by a placeholder character." msgstr "" -#: ../../library/urllib.parse.rst:664 +#: ../../library/urllib.parse.rst:672 msgid "Example: ``unquote('/El%20Ni%C3%B1o/')`` yields ``'/El Niño/'``." msgstr "" -#: ../../library/urllib.parse.rst:666 +#: ../../library/urllib.parse.rst:674 msgid "" "*string* parameter supports bytes and str objects (previously only str)." msgstr "" -#: ../../library/urllib.parse.rst:674 +#: ../../library/urllib.parse.rst:682 msgid "" "Like :func:`unquote`, but also replace plus signs with spaces, as required " "for unquoting HTML form values." msgstr "" -#: ../../library/urllib.parse.rst:677 +#: ../../library/urllib.parse.rst:685 msgid "*string* must be a :class:`str`." msgstr "" -#: ../../library/urllib.parse.rst:679 +#: ../../library/urllib.parse.rst:687 msgid "Example: ``unquote_plus('/El+Ni%C3%B1o/')`` yields ``'/El Niño/'``." msgstr "" -#: ../../library/urllib.parse.rst:684 +#: ../../library/urllib.parse.rst:692 msgid "" "Replace :samp:`%{xx}` escapes with their single-octet equivalent, and return " "a :class:`bytes` object." msgstr "" -#: ../../library/urllib.parse.rst:689 +#: ../../library/urllib.parse.rst:697 msgid "" "If it is a :class:`str`, unescaped non-ASCII characters in *string* are " "encoded into UTF-8 bytes." msgstr "" -#: ../../library/urllib.parse.rst:692 +#: ../../library/urllib.parse.rst:700 msgid "Example: ``unquote_to_bytes('a%26%EF')`` yields ``b'a&\\xef'``." msgstr "" -#: ../../library/urllib.parse.rst:698 +#: ../../library/urllib.parse.rst:706 msgid "" "Convert a mapping object or a sequence of two-element tuples, which may " "contain :class:`str` or :class:`bytes` objects, to a percent-encoded ASCII " @@ -946,7 +955,7 @@ msgid "" "be encoded to bytes, otherwise it would result in a :exc:`TypeError`." msgstr "" -#: ../../library/urllib.parse.rst:705 +#: ../../library/urllib.parse.rst:713 msgid "" "The resulting string is a series of ``key=value`` pairs separated by ``'&'`` " "characters, where both *key* and *value* are quoted using the *quote_via* " @@ -959,7 +968,7 @@ msgid "" "``quote`` and specify a value for *safe*." msgstr "" -#: ../../library/urllib.parse.rst:715 +#: ../../library/urllib.parse.rst:723 msgid "" "When a sequence of two-element tuples is used as the *query* argument, the " "first element of each tuple is a key and the second is a value. The value " @@ -970,49 +979,49 @@ msgid "" "order of parameter tuples in the sequence." msgstr "" -#: ../../library/urllib.parse.rst:723 +#: ../../library/urllib.parse.rst:731 msgid "" "The *safe*, *encoding*, and *errors* parameters are passed down to " "*quote_via* (the *encoding* and *errors* parameters are only passed when a " "query element is a :class:`str`)." msgstr "" -#: ../../library/urllib.parse.rst:727 +#: ../../library/urllib.parse.rst:735 msgid "" "To reverse this encoding process, :func:`parse_qs` and :func:`parse_qsl` are " "provided in this module to parse query strings into Python data structures." msgstr "" -#: ../../library/urllib.parse.rst:730 +#: ../../library/urllib.parse.rst:738 msgid "" "Refer to :ref:`urllib examples ` to find out how the :func:" "`urllib.parse.urlencode` method can be used for generating the query string " "of a URL or data for a POST request." msgstr "" -#: ../../library/urllib.parse.rst:734 +#: ../../library/urllib.parse.rst:742 msgid "*query* supports bytes and string objects." msgstr "" -#: ../../library/urllib.parse.rst:737 +#: ../../library/urllib.parse.rst:745 msgid "Added the *quote_via* parameter." msgstr "新增 *quote_via* 參數。" -#: ../../library/urllib.parse.rst:743 +#: ../../library/urllib.parse.rst:751 msgid "`WHATWG`_ - URL Living standard" msgstr "" -#: ../../library/urllib.parse.rst:744 +#: ../../library/urllib.parse.rst:752 msgid "" "Working Group for the URL Standard that defines URLs, domains, IP addresses, " "the application/x-www-form-urlencoded format, and their API." msgstr "" -#: ../../library/urllib.parse.rst:747 +#: ../../library/urllib.parse.rst:755 msgid ":rfc:`3986` - Uniform Resource Identifiers" msgstr "" -#: ../../library/urllib.parse.rst:748 +#: ../../library/urllib.parse.rst:756 msgid "" "This is the current standard (STD66). Any changes to urllib.parse module " "should conform to this. Certain deviations could be observed, which are " @@ -1020,49 +1029,49 @@ msgid "" "requirements as commonly observed in major browsers." msgstr "" -#: ../../library/urllib.parse.rst:753 +#: ../../library/urllib.parse.rst:761 msgid ":rfc:`2732` - Format for Literal IPv6 Addresses in URL's." msgstr "" -#: ../../library/urllib.parse.rst:754 +#: ../../library/urllib.parse.rst:762 msgid "This specifies the parsing requirements of IPv6 URLs." msgstr "" -#: ../../library/urllib.parse.rst:756 +#: ../../library/urllib.parse.rst:764 msgid ":rfc:`2396` - Uniform Resource Identifiers (URI): Generic Syntax" msgstr "" -#: ../../library/urllib.parse.rst:757 +#: ../../library/urllib.parse.rst:765 msgid "" "Document describing the generic syntactic requirements for both Uniform " "Resource Names (URNs) and Uniform Resource Locators (URLs)." msgstr "" -#: ../../library/urllib.parse.rst:760 +#: ../../library/urllib.parse.rst:768 msgid ":rfc:`2368` - The mailto URL scheme." msgstr "" -#: ../../library/urllib.parse.rst:761 +#: ../../library/urllib.parse.rst:769 msgid "Parsing requirements for mailto URL schemes." msgstr "" -#: ../../library/urllib.parse.rst:763 +#: ../../library/urllib.parse.rst:771 msgid ":rfc:`1808` - Relative Uniform Resource Locators" msgstr "" ":rfc:`1808` - 相對的統一資源定位器 (Relative Uniform Resource Locators)" -#: ../../library/urllib.parse.rst:764 +#: ../../library/urllib.parse.rst:772 msgid "" "This Request For Comments includes the rules for joining an absolute and a " "relative URL, including a fair number of \"Abnormal Examples\" which govern " "the treatment of border cases." msgstr "" -#: ../../library/urllib.parse.rst:768 +#: ../../library/urllib.parse.rst:776 msgid ":rfc:`1738` - Uniform Resource Locators (URL)" msgstr ":rfc:`1738` - 統一資源定位器 (URL, Uniform Resource Locators)" -#: ../../library/urllib.parse.rst:769 +#: ../../library/urllib.parse.rst:777 msgid "This specifies the formal syntax and semantics of absolute URLs." msgstr "" diff --git a/library/urllib.request.po b/library/urllib.request.po index 74cd6963ad..3fb995ae69 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-04-21 17:59+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -54,14 +54,14 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." +msgid ":ref:`Availability `: not WASI." msgstr "" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" @@ -117,23 +117,6 @@ msgstr "" #: ../../library/urllib.request.rst:58 msgid "" -"The optional *cafile* and *capath* parameters specify a set of trusted CA " -"certificates for HTTPS requests. *cafile* should point to a single file " -"containing a bundle of CA certificates, whereas *capath* should point to a " -"directory of hashed certificate files. More information can be found in :" -"meth:`ssl.SSLContext.load_verify_locations`." -msgstr "" -"選擇性參數 *cafile* 與 *capath* 用來指定一組 HTTPS 請求中所需之受信任 CA 憑" -"證。*cafile* 的值應該指向內容包含一堆 CA 憑證的單一檔案,而 *capath* 則指向存" -"放一堆雜湊後的憑證檔案的目錄。欲瞭解更多的資訊請參見 :meth:`ssl.SSLContext." -"load_verify_locations`。" - -#: ../../library/urllib.request.rst:64 -msgid "The *cadefault* parameter is ignored." -msgstr "參數 *cadefault* 已被忽略。" - -#: ../../library/urllib.request.rst:66 -msgid "" "This function always returns an object which can work as a :term:`context " "manager` and has the properties *url*, *headers*, and *status*. See :class:" "`urllib.response.addinfourl` for more detail on these properties." @@ -142,7 +125,7 @@ msgstr "" "(property) *url*、*headers* 與 *status*。欲知更多這些特性細節請參見 :class:" "`urllib.response.addinfourl`。" -#: ../../library/urllib.request.rst:70 +#: ../../library/urllib.request.rst:62 msgid "" "For HTTP and HTTPS URLs, this function returns a :class:`http.client." "HTTPResponse` object slightly modified. In addition to the three new methods " @@ -157,7 +140,7 @@ msgstr "" "(reason phrase),而不是在 :class:`~http.client.HTTPResponse` 文件中提到的回" "應 headers。" -#: ../../library/urllib.request.rst:78 +#: ../../library/urllib.request.rst:70 msgid "" "For FTP, file, and data URLs and requests explicitly handled by legacy :" "class:`URLopener` and :class:`FancyURLopener` classes, this function returns " @@ -167,11 +150,11 @@ msgstr "" "class:`FancyURLopener` 所處理的請求,這個函式會回傳一個 :class:`urllib." "response.addinfourl` 物件。" -#: ../../library/urllib.request.rst:82 +#: ../../library/urllib.request.rst:74 msgid "Raises :exc:`~urllib.error.URLError` on protocol errors." msgstr "當遇到協定上的錯誤時會引發 :exc:`~urllib.error.URLError`。" -#: ../../library/urllib.request.rst:84 +#: ../../library/urllib.request.rst:76 msgid "" "Note that ``None`` may be returned if no handler handles the request (though " "the default installed global :class:`OpenerDirector` uses :class:" @@ -181,7 +164,7 @@ msgstr "" "別 :class:`OpenerDirector` 使用 :class:`UnknownHandler` 來確保這種情況不會發" "生)" -#: ../../library/urllib.request.rst:88 +#: ../../library/urllib.request.rst:80 msgid "" "In addition, if proxy settings are detected (for example, when a ``*_proxy`` " "environment variable like :envvar:`!http_proxy` is set), :class:" @@ -192,7 +175,7 @@ msgstr "" "http_proxy` 有被設置時),:class:`ProxyHandler` 會被預設使用以確保請求有透過" "代理服務來處理。" -#: ../../library/urllib.request.rst:93 +#: ../../library/urllib.request.rst:85 msgid "" "The legacy ``urllib.urlopen`` function from Python 2.6 and earlier has been " "discontinued; :func:`urllib.request.urlopen` corresponds to the old " @@ -205,7 +188,7 @@ msgstr "" "的處理,以往是透過傳遞 dictionary(字典)參數給 ``urllib.urlopen`` 來取得的," "現在則可以透過 :class:`ProxyHandler` 物件來取得。" -#: ../../library/urllib.request.rst:99 ../../library/urllib.request.rst:101 +#: ../../library/urllib.request.rst:91 ../../library/urllib.request.rst:93 msgid "" "The default opener raises an :ref:`auditing event ` ``urllib." "Request`` with arguments ``fullurl``, ``data``, ``headers``, ``method`` " @@ -214,11 +197,11 @@ msgstr "" "預設的 opener 會觸發一個 :ref:`auditing event ` ``urllib.Request`` " "與其從請求物件中所獲得的引數 ``fullurl``、``data``、``headers``、``method``。" -#: ../../library/urllib.request.rst:105 +#: ../../library/urllib.request.rst:97 msgid "*cafile* and *capath* were added." msgstr "新增 *cafile* 與 *capath*。" -#: ../../library/urllib.request.rst:108 +#: ../../library/urllib.request.rst:100 msgid "" "HTTPS virtual hosts are now supported if possible (that is, if :const:`ssl." "HAS_SNI` is true)." @@ -226,19 +209,19 @@ msgstr "" "HTTPS 虛擬主機 (virtual hosts) 現已支援,只要 :const:`ssl.HAS_SNI` 的值為 " "true。" -#: ../../library/urllib.request.rst:111 +#: ../../library/urllib.request.rst:103 msgid "*data* can be an iterable object." msgstr "*data* 可以是一個可疊代物件。" -#: ../../library/urllib.request.rst:113 +#: ../../library/urllib.request.rst:105 msgid "*cadefault* was added." msgstr "*cadefault* 被新增。" -#: ../../library/urllib.request.rst:116 +#: ../../library/urllib.request.rst:108 msgid "*context* was added." msgstr "*context* 被新增。" -#: ../../library/urllib.request.rst:119 +#: ../../library/urllib.request.rst:111 msgid "" "HTTPS connection now send an ALPN extension with protocol indicator " "``http/1.1`` when no *context* is given. Custom *context* should set ALPN " @@ -248,17 +231,13 @@ msgstr "" "``http/1.1`` 的 ALPN 擴充 (extension)。自訂的 *context* 應該利用 :meth:`~ssl." "SSLContext.set_alpn_protocols` 來自行設定 ALPN 協定。" -#: ../../library/urllib.request.rst:126 +#: ../../library/urllib.request.rst:116 msgid "" -"*cafile*, *capath* and *cadefault* are deprecated in favor of *context*. " -"Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let :func:`ssl." -"create_default_context` select the system's trusted CA certificates for you." +"Remove *cafile*, *capath* and *cadefault* parameters: use the *context* " +"parameter instead." msgstr "" -"*cafile*、*capath*、*cadefault* 已經被棄用並應改為使用 *context*。請改用 :" -"meth:`ssl.SSLContext.load_cert_chain`,或是讓 :func:`ssl." -"create_default_context` 選取系統中受信任的 CA 憑證。" -#: ../../library/urllib.request.rst:134 +#: ../../library/urllib.request.rst:123 msgid "" "Install an :class:`OpenerDirector` instance as the default global opener. " "Installing an opener is only necessary if you want urlopen to use that " @@ -272,7 +251,7 @@ msgstr "" "class 是否真的為 :class:`OpenerDirector`,而是任何具有正確介面的 class 都能適" "用。" -#: ../../library/urllib.request.rst:144 +#: ../../library/urllib.request.rst:133 msgid "" "Return an :class:`OpenerDirector` instance, which chains the handlers in the " "order given. *handler*\\s can be either instances of :class:`BaseHandler`, " @@ -294,7 +273,7 @@ msgstr "" "`HTTPDefaultErrorHandler`、:class:`HTTPRedirectHandler`、:class:" "`FTPHandler`、:class:`FileHandler`、:class:`HTTPErrorProcessor`。" -#: ../../library/urllib.request.rst:154 +#: ../../library/urllib.request.rst:143 msgid "" "If the Python installation has SSL support (i.e., if the :mod:`ssl` module " "can be imported), :class:`HTTPSHandler` will also be added." @@ -302,7 +281,7 @@ msgstr "" "如果 Python 安裝時已帶有 SSL 支援(如果 :mod:`ssl` module 能夠被 import)," "則 :class:`HTTPSHandler` 也在上述 class 之中。" -#: ../../library/urllib.request.rst:157 +#: ../../library/urllib.request.rst:146 msgid "" "A :class:`BaseHandler` subclass may also change its :attr:`handler_order` " "attribute to modify its position in the handlers list." @@ -310,7 +289,7 @@ msgstr "" "一個 :class:`BaseHandler` 的 subclass 可能透過改變其 :attr:`handler_order` 屬" "性來調整它在 handlers list 中的位置。" -#: ../../library/urllib.request.rst:163 +#: ../../library/urllib.request.rst:152 msgid "" "Convert the pathname *path* from the local syntax for a path to the form " "used in the path component of a URL. This does not produce a complete URL. " @@ -321,7 +300,7 @@ msgstr "" "component(路徑元件)格式。本函式並不會產生完整的 URL。回傳值將使用 :func:" "`~urllib.parse.quote` 函式先進行編碼過。" -#: ../../library/urllib.request.rst:170 +#: ../../library/urllib.request.rst:159 msgid "" "Convert the path component *path* from a percent-encoded URL to the local " "syntax for a path. This does not accept a complete URL. This function " @@ -331,7 +310,7 @@ msgstr "" "(local syntax)。本函式並不接受完整的 URL。本函式使用 :func:`~urllib.parse." "unquote` 來將 *path* 解碼。" -#: ../../library/urllib.request.rst:176 +#: ../../library/urllib.request.rst:165 msgid "" "This helper function returns a dictionary of scheme to proxy server URL " "mappings. It scans the environment for variables named ``_proxy``, " @@ -346,7 +325,7 @@ msgstr "" "Configuration) 或是 Windows 系統中的 Windows Systems Registry 尋找代理服務設" "定。如果大小寫的環境變數同時存在且值有不同,小寫的環境變數會被選用。" -#: ../../library/urllib.request.rst:186 +#: ../../library/urllib.request.rst:175 msgid "" "If the environment variable ``REQUEST_METHOD`` is set, which usually " "indicates your script is running in a CGI environment, the environment " @@ -363,19 +342,19 @@ msgstr "" "``ProxyHandler``,亦或是確認變數名稱是小寫的(或至少 ``_proxy`` 後綴是小寫" "的)。" -#: ../../library/urllib.request.rst:195 +#: ../../library/urllib.request.rst:184 msgid "The following classes are provided:" msgstr "提供了以下的 classes:" -#: ../../library/urllib.request.rst:199 +#: ../../library/urllib.request.rst:188 msgid "This class is an abstraction of a URL request." msgstr "這個 class 是一個 URL 請求的抽象 class。" -#: ../../library/urllib.request.rst:201 +#: ../../library/urllib.request.rst:190 msgid "*url* should be a string containing a valid, properly encoded URL." msgstr "*url* 是一個包含有效且適當編碼的 URL 字串。" -#: ../../library/urllib.request.rst:203 +#: ../../library/urllib.request.rst:192 msgid "" "*data* must be an object specifying additional data to send to the server, " "or ``None`` if no such data is needed. Currently HTTP requests are the only " @@ -396,7 +375,7 @@ msgstr "" "``Transfer-Encoding: chunked`` 則會被用來傳送檔案或是其它可疊代物件 " "(iterables)。" -#: ../../library/urllib.request.rst:213 +#: ../../library/urllib.request.rst:202 msgid "" "For an HTTP POST request method, *data* should be a buffer in the standard :" "mimetype:`application/x-www-form-urlencoded` format. The :func:`urllib." @@ -409,7 +388,7 @@ msgstr "" "個 mapping 或是 sequence(序列)的 2-tuples,並回傳一個對應格式的 ASCII 字" "串。在被作為 *data* 參數前它應該被編碼成位元組串。" -#: ../../library/urllib.request.rst:219 +#: ../../library/urllib.request.rst:208 msgid "" "*headers* should be a dictionary, and will be treated as if :meth:" "`add_header` was called with each key and value as arguments. This is often " @@ -430,7 +409,7 @@ msgstr "" "(在 Python 2.6 上)。所有 header 的鍵都會以 camel case(駝峰式大小寫)來傳" "送。" -#: ../../library/urllib.request.rst:230 +#: ../../library/urllib.request.rst:219 msgid "" "An appropriate ``Content-Type`` header should be included if the *data* " "argument is present. If this header has not been provided and *data* is not " @@ -441,14 +420,14 @@ msgstr "" "個 header 沒有被提供且 *data* 也不為 ``None`` 時,預設值 ``Content-Type: " "application/x-www-form-urlencoded`` 會被新增至請求中。" -#: ../../library/urllib.request.rst:235 +#: ../../library/urllib.request.rst:224 msgid "" "The next two arguments are only of interest for correct handling of third-" "party HTTP cookies:" msgstr "" "接下來的兩個引數的介紹提供給那些有興趣正確處理第三方 HTTP cookies 的使用者:" -#: ../../library/urllib.request.rst:238 +#: ../../library/urllib.request.rst:227 msgid "" "*origin_req_host* should be the request-host of the origin transaction, as " "defined by :rfc:`2965`. It defaults to ``http.cookiejar." @@ -462,7 +441,7 @@ msgstr "" "起的原始請求的主機名稱或是 IP 位址。例如當請求是要求一個 HTML 文件中的一個影" "像,則這個屬性應為請求包含影像頁面的請求主機。" -#: ../../library/urllib.request.rst:246 +#: ../../library/urllib.request.rst:235 msgid "" "*unverifiable* should indicate whether the request is unverifiable, as " "defined by :rfc:`2965`. It defaults to ``False``. An unverifiable request " @@ -475,7 +454,7 @@ msgstr "" "URL,例如一個對於 HTML 文件中的影像所做的請求,而使用者沒有機會去批准是否能自" "動擷取影像,則這個值應該為 true。" -#: ../../library/urllib.request.rst:253 +#: ../../library/urllib.request.rst:242 msgid "" "*method* should be a string that indicates the HTTP request method that will " "be used (e.g. ``'HEAD'``). If provided, its value is stored in the :attr:" @@ -490,7 +469,7 @@ msgstr "" "Subclasses 可以透過設置其 :attr:`~Request.method` 屬性來設定不一樣的預設請求" "方法。" -#: ../../library/urllib.request.rst:261 +#: ../../library/urllib.request.rst:250 msgid "" "The request will not work as expected if the data object is unable to " "deliver its content more than once (e.g. a file or an iterable that can " @@ -504,15 +483,15 @@ msgstr "" "新嘗試傳送,則該請求不會正常運作。*data* 會接在 headers 之後被送至 HTTP 伺服" "器。此函式庫沒有支援 100-continue expectation。" -#: ../../library/urllib.request.rst:268 +#: ../../library/urllib.request.rst:257 msgid ":attr:`Request.method` argument is added to the Request class." msgstr "新增 :attr:`Request.method` 引數到 Request class。" -#: ../../library/urllib.request.rst:271 +#: ../../library/urllib.request.rst:260 msgid "Default :attr:`Request.method` may be indicated at the class level." msgstr "能夠在 class 中設置預設的 :attr:`Request.method`。" -#: ../../library/urllib.request.rst:274 +#: ../../library/urllib.request.rst:263 msgid "" "Do not raise an error if the ``Content-Length`` has not been provided and " "*data* is neither ``None`` nor a bytes object. Fall back to use chunked " @@ -522,34 +501,34 @@ msgstr "" "串物件,則不會觸發錯誤,並 fall back(後備)使用分塊傳輸編碼 (chunked " "transfer encoding)。" -#: ../../library/urllib.request.rst:281 +#: ../../library/urllib.request.rst:270 msgid "" "The :class:`OpenerDirector` class opens URLs via :class:`BaseHandler`\\ s " "chained together. It manages the chaining of handlers, and recovery from " "errors." msgstr "" -#: ../../library/urllib.request.rst:287 +#: ../../library/urllib.request.rst:276 msgid "" "This is the base class for all registered handlers --- and handles only the " "simple mechanics of registration." msgstr "" -#: ../../library/urllib.request.rst:293 +#: ../../library/urllib.request.rst:282 msgid "" "A class which defines a default handler for HTTP error responses; all " "responses are turned into :exc:`~urllib.error.HTTPError` exceptions." msgstr "" -#: ../../library/urllib.request.rst:299 +#: ../../library/urllib.request.rst:288 msgid "A class to handle redirections." msgstr "" -#: ../../library/urllib.request.rst:304 +#: ../../library/urllib.request.rst:293 msgid "A class to handle HTTP Cookies." msgstr "" -#: ../../library/urllib.request.rst:309 +#: ../../library/urllib.request.rst:298 msgid "" "Cause requests to go through a proxy. If *proxies* is given, it must be a " "dictionary mapping protocol names to URLs of proxies. The default is to read " @@ -560,11 +539,11 @@ msgid "" "Configuration Framework." msgstr "" -#: ../../library/urllib.request.rst:317 +#: ../../library/urllib.request.rst:306 msgid "To disable autodetected proxy pass an empty dictionary." msgstr "" -#: ../../library/urllib.request.rst:319 +#: ../../library/urllib.request.rst:308 msgid "" "The :envvar:`no_proxy` environment variable can be used to specify hosts " "which shouldn't be reached via proxy; if set, it should be a comma-separated " @@ -572,24 +551,24 @@ msgid "" "``cern.ch,ncsa.uiuc.edu,some.host:8080``." msgstr "" -#: ../../library/urllib.request.rst:326 +#: ../../library/urllib.request.rst:315 msgid "" "``HTTP_PROXY`` will be ignored if a variable ``REQUEST_METHOD`` is set; see " "the documentation on :func:`~urllib.request.getproxies`." msgstr "" -#: ../../library/urllib.request.rst:332 +#: ../../library/urllib.request.rst:321 msgid "Keep a database of ``(realm, uri) -> (user, password)`` mappings." msgstr "" -#: ../../library/urllib.request.rst:337 +#: ../../library/urllib.request.rst:326 msgid "" "Keep a database of ``(realm, uri) -> (user, password)`` mappings. A realm " "of ``None`` is considered a catch-all realm, which is searched if no other " "realm fits." msgstr "" -#: ../../library/urllib.request.rst:344 +#: ../../library/urllib.request.rst:333 msgid "" "A variant of :class:`HTTPPasswordMgrWithDefaultRealm` that also has a " "database of ``uri -> is_authenticated`` mappings. Can be used by a " @@ -597,7 +576,7 @@ msgid "" "immediately instead of waiting for a ``401`` response first." msgstr "" -#: ../../library/urllib.request.rst:354 +#: ../../library/urllib.request.rst:343 msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " @@ -616,11 +595,11 @@ msgid "" "will automatically include the authentication credentials." msgstr "" -#: ../../library/urllib.request.rst:371 +#: ../../library/urllib.request.rst:360 msgid "Added ``is_authenticated`` support." msgstr "新增 ``is_authenticated`` 的支援。" -#: ../../library/urllib.request.rst:377 +#: ../../library/urllib.request.rst:366 msgid "" "Handle authentication with the remote host. *password_mgr*, if given, should " "be something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -629,7 +608,7 @@ msgid "" "presented with a wrong Authentication scheme." msgstr "" -#: ../../library/urllib.request.rst:386 ../../library/urllib.request.rst:420 +#: ../../library/urllib.request.rst:375 ../../library/urllib.request.rst:409 msgid "" "Handle authentication with the proxy. *password_mgr*, if given, should be " "something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -637,7 +616,7 @@ msgid "" "be supported." msgstr "" -#: ../../library/urllib.request.rst:394 +#: ../../library/urllib.request.rst:383 msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " @@ -645,7 +624,7 @@ msgid "" "`http-password-mgr` for information on the interface that must be supported." msgstr "" -#: ../../library/urllib.request.rst:403 +#: ../../library/urllib.request.rst:392 msgid "" "Handle authentication with the remote host. *password_mgr*, if given, should " "be something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -658,108 +637,108 @@ msgid "" "Digest or Basic." msgstr "" -#: ../../library/urllib.request.rst:413 +#: ../../library/urllib.request.rst:402 msgid "Raise :exc:`ValueError` on unsupported Authentication Scheme." msgstr "" -#: ../../library/urllib.request.rst:428 +#: ../../library/urllib.request.rst:417 msgid "A class to handle opening of HTTP URLs." msgstr "" -#: ../../library/urllib.request.rst:433 +#: ../../library/urllib.request.rst:422 msgid "" "A class to handle opening of HTTPS URLs. *context* and *check_hostname* " "have the same meaning as in :class:`http.client.HTTPSConnection`." msgstr "" -#: ../../library/urllib.request.rst:436 +#: ../../library/urllib.request.rst:425 msgid "*context* and *check_hostname* were added." msgstr "新增 *context* 與 *check_hostname*。" -#: ../../library/urllib.request.rst:442 +#: ../../library/urllib.request.rst:431 msgid "Open local files." msgstr "" -#: ../../library/urllib.request.rst:446 +#: ../../library/urllib.request.rst:435 msgid "Open data URLs." msgstr "" -#: ../../library/urllib.request.rst:452 +#: ../../library/urllib.request.rst:441 msgid "Open FTP URLs." msgstr "" -#: ../../library/urllib.request.rst:457 +#: ../../library/urllib.request.rst:446 msgid "" "Open FTP URLs, keeping a cache of open FTP connections to minimize delays." msgstr "" -#: ../../library/urllib.request.rst:462 +#: ../../library/urllib.request.rst:451 msgid "A catch-all class to handle unknown URLs." msgstr "" -#: ../../library/urllib.request.rst:467 ../../library/urllib.request.rst:1173 +#: ../../library/urllib.request.rst:456 ../../library/urllib.request.rst:1162 msgid "Process HTTP error responses." msgstr "" -#: ../../library/urllib.request.rst:473 +#: ../../library/urllib.request.rst:462 msgid "Request Objects" msgstr "" -#: ../../library/urllib.request.rst:475 +#: ../../library/urllib.request.rst:464 msgid "" "The following methods describe :class:`Request`'s public interface, and so " "all may be overridden in subclasses. It also defines several public " "attributes that can be used by clients to inspect the parsed request." msgstr "" -#: ../../library/urllib.request.rst:482 +#: ../../library/urllib.request.rst:471 msgid "The original URL passed to the constructor." msgstr "" -#: ../../library/urllib.request.rst:486 +#: ../../library/urllib.request.rst:475 msgid "" "Request.full_url is a property with setter, getter and a deleter. Getting :" "attr:`~Request.full_url` returns the original request URL with the fragment, " "if it was present." msgstr "" -#: ../../library/urllib.request.rst:492 +#: ../../library/urllib.request.rst:481 msgid "The URI scheme." msgstr "" -#: ../../library/urllib.request.rst:496 +#: ../../library/urllib.request.rst:485 msgid "" "The URI authority, typically a host, but may also contain a port separated " "by a colon." msgstr "" -#: ../../library/urllib.request.rst:501 +#: ../../library/urllib.request.rst:490 msgid "The original host for the request, without port." msgstr "" -#: ../../library/urllib.request.rst:505 +#: ../../library/urllib.request.rst:494 msgid "" "The URI path. If the :class:`Request` uses a proxy, then selector will be " "the full URL that is passed to the proxy." msgstr "" -#: ../../library/urllib.request.rst:510 +#: ../../library/urllib.request.rst:499 msgid "The entity body for the request, or ``None`` if not specified." msgstr "" -#: ../../library/urllib.request.rst:512 +#: ../../library/urllib.request.rst:501 msgid "" "Changing value of :attr:`Request.data` now deletes \"Content-Length\" header " "if it was previously set or calculated." msgstr "" -#: ../../library/urllib.request.rst:518 +#: ../../library/urllib.request.rst:507 msgid "" "boolean, indicates whether the request is unverifiable as defined by :rfc:" "`2965`." msgstr "" -#: ../../library/urllib.request.rst:523 +#: ../../library/urllib.request.rst:512 msgid "" "The HTTP request method to use. By default its value is :const:`None`, " "which means that :meth:`~Request.get_method` will do its normal computation " @@ -770,13 +749,13 @@ msgid "" "argument." msgstr "" -#: ../../library/urllib.request.rst:533 +#: ../../library/urllib.request.rst:522 msgid "" "A default value can now be set in subclasses; previously it could only be " "set via the constructor argument." msgstr "" -#: ../../library/urllib.request.rst:540 +#: ../../library/urllib.request.rst:529 msgid "" "Return a string indicating the HTTP request method. If :attr:`Request." "method` is not ``None``, return its value, otherwise return ``'GET'`` if :" @@ -784,11 +763,11 @@ msgid "" "meaningful for HTTP requests." msgstr "" -#: ../../library/urllib.request.rst:545 +#: ../../library/urllib.request.rst:534 msgid "get_method now looks at the value of :attr:`Request.method`." msgstr "" -#: ../../library/urllib.request.rst:551 +#: ../../library/urllib.request.rst:540 msgid "" "Add another header to the request. Headers are currently ignored by all " "handlers except HTTP handlers, where they are added to the list of headers " @@ -800,64 +779,64 @@ msgid "" "headers added using this method are also added to redirected requests." msgstr "" -#: ../../library/urllib.request.rst:563 +#: ../../library/urllib.request.rst:552 msgid "Add a header that will not be added to a redirected request." msgstr "" -#: ../../library/urllib.request.rst:568 +#: ../../library/urllib.request.rst:557 msgid "" "Return whether the instance has the named header (checks both regular and " "unredirected)." msgstr "" -#: ../../library/urllib.request.rst:574 +#: ../../library/urllib.request.rst:563 msgid "" "Remove named header from the request instance (both from regular and " "unredirected headers)." msgstr "" -#: ../../library/urllib.request.rst:582 +#: ../../library/urllib.request.rst:571 msgid "Return the URL given in the constructor." msgstr "" -#: ../../library/urllib.request.rst:586 +#: ../../library/urllib.request.rst:575 msgid "Returns :attr:`Request.full_url`" msgstr "" -#: ../../library/urllib.request.rst:591 +#: ../../library/urllib.request.rst:580 msgid "" "Prepare the request by connecting to a proxy server. The *host* and *type* " "will replace those of the instance, and the instance's selector will be the " "original URL given in the constructor." msgstr "" -#: ../../library/urllib.request.rst:598 +#: ../../library/urllib.request.rst:587 msgid "" "Return the value of the given header. If the header is not present, return " "the default value." msgstr "" -#: ../../library/urllib.request.rst:604 +#: ../../library/urllib.request.rst:593 msgid "" "Return a list of tuples (header_name, header_value) of the Request headers." msgstr "" -#: ../../library/urllib.request.rst:606 +#: ../../library/urllib.request.rst:595 msgid "" "The request methods add_data, has_data, get_data, get_type, get_host, " "get_selector, get_origin_req_host and is_unverifiable that were deprecated " "since 3.3 have been removed." msgstr "" -#: ../../library/urllib.request.rst:615 +#: ../../library/urllib.request.rst:604 msgid "OpenerDirector Objects" msgstr "OpenerDirector 物件" -#: ../../library/urllib.request.rst:617 +#: ../../library/urllib.request.rst:606 msgid ":class:`OpenerDirector` instances have the following methods:" msgstr "" -#: ../../library/urllib.request.rst:622 +#: ../../library/urllib.request.rst:611 msgid "" "*handler* should be an instance of :class:`BaseHandler`. The following " "methods are searched, and added to the possible chains (note that HTTP " @@ -868,53 +847,53 @@ msgid "" "`http_error_404` would handle HTTP 404 errors." msgstr "" -#: ../../library/urllib.request.rst:630 +#: ../../library/urllib.request.rst:619 msgid "" ":meth:`!_open` --- signal that the handler knows how to open " "*protocol* URLs." msgstr "" -#: ../../library/urllib.request.rst:633 +#: ../../library/urllib.request.rst:622 msgid "See |protocol_open|_ for more information." msgstr "更多資訊請見 |protocol_open|_。" -#: ../../library/urllib.request.rst:635 +#: ../../library/urllib.request.rst:624 msgid "" ":meth:`!http_error_\\` --- signal that the handler knows how to " "handle HTTP errors with HTTP error code *type*." msgstr "" -#: ../../library/urllib.request.rst:638 +#: ../../library/urllib.request.rst:627 msgid "See |http_error_nnn|_ for more information." msgstr "更多資訊請見 |http_error_nnn|_。" -#: ../../library/urllib.request.rst:640 +#: ../../library/urllib.request.rst:629 msgid "" ":meth:`!_error` --- signal that the handler knows how to handle " "errors from (non-\\ ``http``) *protocol*." msgstr "" -#: ../../library/urllib.request.rst:643 +#: ../../library/urllib.request.rst:632 msgid "" ":meth:`!_request` --- signal that the handler knows how to pre-" "process *protocol* requests." msgstr "" -#: ../../library/urllib.request.rst:646 +#: ../../library/urllib.request.rst:635 msgid "See |protocol_request|_ for more information." msgstr "更多資訊請見 |protocol_request|_。" -#: ../../library/urllib.request.rst:648 +#: ../../library/urllib.request.rst:637 msgid "" ":meth:`!_response` --- signal that the handler knows how to post-" "process *protocol* responses." msgstr "" -#: ../../library/urllib.request.rst:651 +#: ../../library/urllib.request.rst:640 msgid "See |protocol_response|_ for more information." msgstr "更多資訊請見 |protocol_response|_。" -#: ../../library/urllib.request.rst:660 +#: ../../library/urllib.request.rst:649 msgid "" "Open the given *url* (which can be a request object or a string), optionally " "passing the given *data*. Arguments, return values and exceptions raised are " @@ -926,7 +905,7 @@ msgid "" "HTTP, HTTPS and FTP connections." msgstr "" -#: ../../library/urllib.request.rst:672 +#: ../../library/urllib.request.rst:661 msgid "" "Handle an error of the given protocol. This will call the registered error " "handlers for the given protocol with the given arguments (which are protocol " @@ -935,28 +914,28 @@ msgid "" "http_error_\\` methods of the handler classes." msgstr "" -#: ../../library/urllib.request.rst:678 +#: ../../library/urllib.request.rst:667 msgid "" "Return values and exceptions raised are the same as those of :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:680 +#: ../../library/urllib.request.rst:669 msgid "OpenerDirector objects open URLs in three stages:" msgstr "" -#: ../../library/urllib.request.rst:682 +#: ../../library/urllib.request.rst:671 msgid "" "The order in which these methods are called within each stage is determined " "by sorting the handler instances." msgstr "" -#: ../../library/urllib.request.rst:685 +#: ../../library/urllib.request.rst:674 msgid "" "Every handler with a method named like :meth:`!_request` has that " "method called to pre-process the request." msgstr "" -#: ../../library/urllib.request.rst:688 +#: ../../library/urllib.request.rst:677 msgid "" "Handlers with a method named like :meth:`!_open` are called to " "handle the request. This stage ends when a handler either returns a non-\\ :" @@ -964,7 +943,7 @@ msgid "" "`~urllib.error.URLError`). Exceptions are allowed to propagate." msgstr "" -#: ../../library/urllib.request.rst:693 +#: ../../library/urllib.request.rst:682 msgid "" "In fact, the above algorithm is first tried for methods named :meth:" "`~BaseHandler.default_open`. If all such methods return :const:`None`, the " @@ -973,64 +952,64 @@ msgid "" "named :meth:`~BaseHandler.unknown_open`." msgstr "" -#: ../../library/urllib.request.rst:699 +#: ../../library/urllib.request.rst:688 msgid "" "Note that the implementation of these methods may involve calls of the " "parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` and :" "meth:`~OpenerDirector.error` methods." msgstr "" -#: ../../library/urllib.request.rst:703 +#: ../../library/urllib.request.rst:692 msgid "" "Every handler with a method named like :meth:`!_response` has that " "method called to post-process the response." msgstr "" -#: ../../library/urllib.request.rst:710 +#: ../../library/urllib.request.rst:699 msgid "BaseHandler Objects" msgstr "BaseHandler 物件" -#: ../../library/urllib.request.rst:712 +#: ../../library/urllib.request.rst:701 msgid "" ":class:`BaseHandler` objects provide a couple of methods that are directly " "useful, and others that are meant to be used by derived classes. These are " "intended for direct use:" msgstr "" -#: ../../library/urllib.request.rst:719 +#: ../../library/urllib.request.rst:708 msgid "Add a director as parent." msgstr "" -#: ../../library/urllib.request.rst:724 +#: ../../library/urllib.request.rst:713 msgid "Remove any parents." msgstr "" -#: ../../library/urllib.request.rst:726 +#: ../../library/urllib.request.rst:715 msgid "" "The following attribute and methods should only be used by classes derived " "from :class:`BaseHandler`." msgstr "" -#: ../../library/urllib.request.rst:731 +#: ../../library/urllib.request.rst:720 msgid "" "The convention has been adopted that subclasses defining :meth:`!" "_request` or :meth:`!_response` methods are named :class:" "`!\\*Processor`; all others are named :class:`!\\*Handler`." msgstr "" -#: ../../library/urllib.request.rst:738 +#: ../../library/urllib.request.rst:727 msgid "" "A valid :class:`OpenerDirector`, which can be used to open using a different " "protocol, or handle errors." msgstr "" -#: ../../library/urllib.request.rst:744 +#: ../../library/urllib.request.rst:733 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to catch all URLs." msgstr "" -#: ../../library/urllib.request.rst:747 +#: ../../library/urllib.request.rst:736 msgid "" "This method, if implemented, will be called by the parent :class:" "`OpenerDirector`. It should return a file-like object as described in the " @@ -1040,38 +1019,38 @@ msgid "" "`MemoryError` should not be mapped to :exc:`~urllib.error.URLError`)." msgstr "" -#: ../../library/urllib.request.rst:754 +#: ../../library/urllib.request.rst:743 msgid "This method will be called before any protocol-specific open method." msgstr "" -#: ../../library/urllib.request.rst:761 +#: ../../library/urllib.request.rst:750 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to handle URLs with the given protocol." msgstr "" -#: ../../library/urllib.request.rst:764 +#: ../../library/urllib.request.rst:753 msgid "" "This method, if defined, will be called by the parent :class:" "`OpenerDirector`. Return values should be the same as for :meth:" "`~BaseHandler.default_open`." msgstr "" -#: ../../library/urllib.request.rst:770 +#: ../../library/urllib.request.rst:759 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to catch all URLs with no specific registered handler " "to open it." msgstr "" -#: ../../library/urllib.request.rst:774 +#: ../../library/urllib.request.rst:763 msgid "" "This method, if implemented, will be called by the :attr:`parent` :class:" "`OpenerDirector`. Return values should be the same as for :meth:" "`default_open`." msgstr "" -#: ../../library/urllib.request.rst:781 +#: ../../library/urllib.request.rst:770 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "override it if they intend to provide a catch-all for otherwise unhandled " @@ -1080,7 +1059,7 @@ msgid "" "other circumstances." msgstr "" -#: ../../library/urllib.request.rst:786 +#: ../../library/urllib.request.rst:775 msgid "" "*req* will be a :class:`Request` object, *fp* will be a file-like object " "with the HTTP error body, *code* will be the three-digit code of the error, " @@ -1088,49 +1067,49 @@ msgid "" "mapping object with the headers of the error." msgstr "" -#: ../../library/urllib.request.rst:791 +#: ../../library/urllib.request.rst:780 msgid "" "Return values and exceptions raised should be the same as those of :func:" "`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:798 +#: ../../library/urllib.request.rst:787 msgid "" "*nnn* should be a three-digit HTTP error code. This method is also not " "defined in :class:`BaseHandler`, but will be called, if it exists, on an " "instance of a subclass, when an HTTP error with code *nnn* occurs." msgstr "" -#: ../../library/urllib.request.rst:802 +#: ../../library/urllib.request.rst:791 msgid "Subclasses should override this method to handle specific HTTP errors." msgstr "" -#: ../../library/urllib.request.rst:804 +#: ../../library/urllib.request.rst:793 msgid "" "Arguments, return values and exceptions raised should be the same as for :" "meth:`~BaseHandler.http_error_default`." msgstr "" -#: ../../library/urllib.request.rst:812 +#: ../../library/urllib.request.rst:801 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to pre-process requests of the given protocol." msgstr "" -#: ../../library/urllib.request.rst:815 +#: ../../library/urllib.request.rst:804 msgid "" "This method, if defined, will be called by the parent :class:" "`OpenerDirector`. *req* will be a :class:`Request` object. The return value " "should be a :class:`Request` object." msgstr "" -#: ../../library/urllib.request.rst:824 +#: ../../library/urllib.request.rst:813 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to post-process responses of the given protocol." msgstr "" -#: ../../library/urllib.request.rst:827 +#: ../../library/urllib.request.rst:816 msgid "" "This method, if defined, will be called by the parent :class:" "`OpenerDirector`. *req* will be a :class:`Request` object. *response* will " @@ -1139,25 +1118,25 @@ msgid "" "return value of :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:837 +#: ../../library/urllib.request.rst:826 msgid "HTTPRedirectHandler Objects" msgstr "HTTPRedirectHandler 物件" -#: ../../library/urllib.request.rst:841 +#: ../../library/urllib.request.rst:830 msgid "" "Some HTTP redirections require action from this module's client code. If " "this is the case, :exc:`~urllib.error.HTTPError` is raised. See :rfc:`2616` " "for details of the precise meanings of the various redirection codes." msgstr "" -#: ../../library/urllib.request.rst:845 +#: ../../library/urllib.request.rst:834 msgid "" "An :exc:`~urllib.error.HTTPError` exception raised as a security " "consideration if the HTTPRedirectHandler is presented with a redirected URL " "which is not an HTTP, HTTPS or FTP URL." msgstr "" -#: ../../library/urllib.request.rst:852 +#: ../../library/urllib.request.rst:841 msgid "" "Return a :class:`Request` or ``None`` in response to a redirect. This is " "called by the default implementations of the :meth:`!http_error_30\\*` " @@ -1168,7 +1147,7 @@ msgid "" "URL, or return ``None`` if you can't but another handler might." msgstr "" -#: ../../library/urllib.request.rst:862 +#: ../../library/urllib.request.rst:851 msgid "" "The default implementation of this method does not strictly follow :rfc:" "`2616`, which says that 301 and 302 responses to ``POST`` requests must not " @@ -1177,54 +1156,54 @@ msgid "" "POST to a ``GET``, and the default implementation reproduces this behavior." msgstr "" -#: ../../library/urllib.request.rst:871 +#: ../../library/urllib.request.rst:860 msgid "" "Redirect to the ``Location:`` or ``URI:`` URL. This method is called by the " "parent :class:`OpenerDirector` when getting an HTTP 'moved permanently' " "response." msgstr "" -#: ../../library/urllib.request.rst:877 +#: ../../library/urllib.request.rst:866 msgid "" "The same as :meth:`http_error_301`, but called for the 'found' response." msgstr "" -#: ../../library/urllib.request.rst:882 +#: ../../library/urllib.request.rst:871 msgid "" "The same as :meth:`http_error_301`, but called for the 'see other' response." msgstr "" -#: ../../library/urllib.request.rst:887 +#: ../../library/urllib.request.rst:876 msgid "" "The same as :meth:`http_error_301`, but called for the 'temporary redirect' " "response. It does not allow changing the request method from ``POST`` to " "``GET``." msgstr "" -#: ../../library/urllib.request.rst:894 +#: ../../library/urllib.request.rst:883 msgid "" "The same as :meth:`http_error_301`, but called for the 'permanent redirect' " "response. It does not allow changing the request method from ``POST`` to " "``GET``." msgstr "" -#: ../../library/urllib.request.rst:904 +#: ../../library/urllib.request.rst:893 msgid "HTTPCookieProcessor Objects" msgstr "HTTPCookieProcessor 物件" -#: ../../library/urllib.request.rst:906 +#: ../../library/urllib.request.rst:895 msgid ":class:`HTTPCookieProcessor` instances have one attribute:" msgstr "" -#: ../../library/urllib.request.rst:910 +#: ../../library/urllib.request.rst:899 msgid "The :class:`http.cookiejar.CookieJar` in which cookies are stored." msgstr "" -#: ../../library/urllib.request.rst:916 +#: ../../library/urllib.request.rst:905 msgid "ProxyHandler Objects" msgstr "ProxyHandler 物件" -#: ../../library/urllib.request.rst:922 +#: ../../library/urllib.request.rst:911 msgid "" "The :class:`ProxyHandler` will have a method :meth:`!_open` for " "every *protocol* which has a proxy in the *proxies* dictionary given in the " @@ -1233,17 +1212,17 @@ msgid "" "actually execute the protocol." msgstr "" -#: ../../library/urllib.request.rst:932 +#: ../../library/urllib.request.rst:921 msgid "HTTPPasswordMgr Objects" msgstr "HTTPPasswordMgr 物件" -#: ../../library/urllib.request.rst:934 +#: ../../library/urllib.request.rst:923 msgid "" "These methods are available on :class:`HTTPPasswordMgr` and :class:" "`HTTPPasswordMgrWithDefaultRealm` objects." msgstr "" -#: ../../library/urllib.request.rst:940 +#: ../../library/urllib.request.rst:929 msgid "" "*uri* can be either a single URI, or a sequence of URIs. *realm*, *user* and " "*passwd* must be strings. This causes ``(user, passwd)`` to be used as " @@ -1251,30 +1230,30 @@ msgid "" "of the given URIs is given." msgstr "" -#: ../../library/urllib.request.rst:948 +#: ../../library/urllib.request.rst:937 msgid "" "Get user/password for given realm and URI, if any. This method will return " "``(None, None)`` if there is no matching user/password." msgstr "" -#: ../../library/urllib.request.rst:951 +#: ../../library/urllib.request.rst:940 msgid "" "For :class:`HTTPPasswordMgrWithDefaultRealm` objects, the realm ``None`` " "will be searched if the given *realm* has no matching user/password." msgstr "" -#: ../../library/urllib.request.rst:958 +#: ../../library/urllib.request.rst:947 msgid "HTTPPasswordMgrWithPriorAuth Objects" msgstr "HTTPPasswordMgrWithPriorAuth 物件" -#: ../../library/urllib.request.rst:960 +#: ../../library/urllib.request.rst:949 msgid "" "This password manager extends :class:`HTTPPasswordMgrWithDefaultRealm` to " "support tracking URIs for which authentication credentials should always be " "sent." msgstr "" -#: ../../library/urllib.request.rst:967 +#: ../../library/urllib.request.rst:956 msgid "" "*realm*, *uri*, *user*, *passwd* are as for :meth:`HTTPPasswordMgr." "add_password`. *is_authenticated* sets the initial value of the " @@ -1282,25 +1261,25 @@ msgid "" "*is_authenticated* is specified as ``True``, *realm* is ignored." msgstr "" -#: ../../library/urllib.request.rst:975 +#: ../../library/urllib.request.rst:964 msgid "Same as for :class:`HTTPPasswordMgrWithDefaultRealm` objects" msgstr "" -#: ../../library/urllib.request.rst:981 +#: ../../library/urllib.request.rst:970 msgid "" "Update the ``is_authenticated`` flag for the given *uri* or list of URIs." msgstr "" -#: ../../library/urllib.request.rst:987 +#: ../../library/urllib.request.rst:976 msgid "" "Returns the current state of the ``is_authenticated`` flag for the given URI." msgstr "" -#: ../../library/urllib.request.rst:994 +#: ../../library/urllib.request.rst:983 msgid "AbstractBasicAuthHandler Objects" msgstr "AbstractBasicAuthHandler 物件" -#: ../../library/urllib.request.rst:999 +#: ../../library/urllib.request.rst:988 msgid "" "Handle an authentication request by getting a user/password pair, and re-" "trying the request. *authreq* should be the name of the header where the " @@ -1309,7 +1288,7 @@ msgid "" "`Request` object, and *headers* should be the error headers." msgstr "" -#: ../../library/urllib.request.rst:1005 +#: ../../library/urllib.request.rst:994 msgid "" "*host* is either an authority (e.g. ``\"python.org\"``) or a URL containing " "an authority component (e.g. ``\"http://python.org//"``). In either case, " @@ -1317,24 +1296,24 @@ msgid "" "and ``\"python.org:80\"`` are fine, ``\"joe:password@python.org\"`` is not)." msgstr "" -#: ../../library/urllib.request.rst:1014 +#: ../../library/urllib.request.rst:1003 msgid "HTTPBasicAuthHandler Objects" msgstr "HTTPBasicAuthHandler 物件" -#: ../../library/urllib.request.rst:1019 ../../library/urllib.request.rst:1030 -#: ../../library/urllib.request.rst:1055 ../../library/urllib.request.rst:1066 +#: ../../library/urllib.request.rst:1008 ../../library/urllib.request.rst:1019 +#: ../../library/urllib.request.rst:1044 ../../library/urllib.request.rst:1055 msgid "Retry the request with authentication information, if available." msgstr "" -#: ../../library/urllib.request.rst:1025 +#: ../../library/urllib.request.rst:1014 msgid "ProxyBasicAuthHandler Objects" msgstr "ProxyBasicAuthHandler 物件" -#: ../../library/urllib.request.rst:1036 +#: ../../library/urllib.request.rst:1025 msgid "AbstractDigestAuthHandler Objects" msgstr "AbstractDigestAuthHandler 物件" -#: ../../library/urllib.request.rst:1041 +#: ../../library/urllib.request.rst:1030 msgid "" "*authreq* should be the name of the header where the information about the " "realm is included in the request, *host* should be the host to authenticate " @@ -1342,55 +1321,55 @@ msgid "" "should be the error headers." msgstr "" -#: ../../library/urllib.request.rst:1050 +#: ../../library/urllib.request.rst:1039 msgid "HTTPDigestAuthHandler Objects" msgstr "HTTPDigestAuthHandler 物件" -#: ../../library/urllib.request.rst:1061 +#: ../../library/urllib.request.rst:1050 msgid "ProxyDigestAuthHandler Objects" msgstr "ProxyDigestAuthHandler 物件" -#: ../../library/urllib.request.rst:1072 +#: ../../library/urllib.request.rst:1061 msgid "HTTPHandler Objects" msgstr "HTTPHandler 物件" -#: ../../library/urllib.request.rst:1077 +#: ../../library/urllib.request.rst:1066 msgid "" "Send an HTTP request, which can be either GET or POST, depending on ``req." "has_data()``." msgstr "" -#: ../../library/urllib.request.rst:1084 +#: ../../library/urllib.request.rst:1073 msgid "HTTPSHandler Objects" msgstr "HTTPSHandler 物件" -#: ../../library/urllib.request.rst:1089 +#: ../../library/urllib.request.rst:1078 msgid "" "Send an HTTPS request, which can be either GET or POST, depending on ``req." "has_data()``." msgstr "" -#: ../../library/urllib.request.rst:1096 +#: ../../library/urllib.request.rst:1085 msgid "FileHandler Objects" msgstr "FileHandler 物件" -#: ../../library/urllib.request.rst:1101 +#: ../../library/urllib.request.rst:1090 msgid "" "Open the file locally, if there is no host name, or the host name is " "``'localhost'``." msgstr "" -#: ../../library/urllib.request.rst:1104 +#: ../../library/urllib.request.rst:1093 msgid "" "This method is applicable only for local hostnames. When a remote hostname " "is given, a :exc:`~urllib.error.URLError` is raised." msgstr "" -#: ../../library/urllib.request.rst:1112 +#: ../../library/urllib.request.rst:1101 msgid "DataHandler Objects" msgstr "DataHandler 物件" -#: ../../library/urllib.request.rst:1116 +#: ../../library/urllib.request.rst:1105 msgid "" "Read a data URL. This kind of URL contains the content encoded in the URL " "itself. The data URL syntax is specified in :rfc:`2397`. This implementation " @@ -1400,51 +1379,51 @@ msgid "" "implementation will raise a :exc:`ValueError` in that case." msgstr "" -#: ../../library/urllib.request.rst:1127 +#: ../../library/urllib.request.rst:1116 msgid "FTPHandler Objects" msgstr "FTPHandler 物件" -#: ../../library/urllib.request.rst:1132 +#: ../../library/urllib.request.rst:1121 msgid "" "Open the FTP file indicated by *req*. The login is always done with empty " "username and password." msgstr "" -#: ../../library/urllib.request.rst:1139 +#: ../../library/urllib.request.rst:1128 msgid "CacheFTPHandler Objects" msgstr "CacheFTPHandler 物件" -#: ../../library/urllib.request.rst:1141 +#: ../../library/urllib.request.rst:1130 msgid "" ":class:`CacheFTPHandler` objects are :class:`FTPHandler` objects with the " "following additional methods:" msgstr "" -#: ../../library/urllib.request.rst:1147 +#: ../../library/urllib.request.rst:1136 msgid "Set timeout of connections to *t* seconds." msgstr "" -#: ../../library/urllib.request.rst:1152 +#: ../../library/urllib.request.rst:1141 msgid "Set maximum number of cached connections to *m*." msgstr "" -#: ../../library/urllib.request.rst:1158 +#: ../../library/urllib.request.rst:1147 msgid "UnknownHandler Objects" msgstr "UnknownHandler 物件" -#: ../../library/urllib.request.rst:1163 +#: ../../library/urllib.request.rst:1152 msgid "Raise a :exc:`~urllib.error.URLError` exception." msgstr "" -#: ../../library/urllib.request.rst:1169 +#: ../../library/urllib.request.rst:1158 msgid "HTTPErrorProcessor Objects" msgstr "HTTPErrorProcessor 物件" -#: ../../library/urllib.request.rst:1175 +#: ../../library/urllib.request.rst:1164 msgid "For 200 error codes, the response object is returned immediately." msgstr "" -#: ../../library/urllib.request.rst:1177 +#: ../../library/urllib.request.rst:1166 msgid "" "For non-200 error codes, this simply passes the job on to the :meth:`!" "http_error_\\` handler methods, via :meth:`OpenerDirector.error`. " @@ -1452,31 +1431,31 @@ msgid "" "error.HTTPError` if no other handler handles the error." msgstr "" -#: ../../library/urllib.request.rst:1185 +#: ../../library/urllib.request.rst:1174 msgid "Process HTTPS error responses." msgstr "" -#: ../../library/urllib.request.rst:1187 +#: ../../library/urllib.request.rst:1176 msgid "The behavior is same as :meth:`http_response`." msgstr "" -#: ../../library/urllib.request.rst:1193 +#: ../../library/urllib.request.rst:1182 msgid "Examples" msgstr "範例" -#: ../../library/urllib.request.rst:1195 +#: ../../library/urllib.request.rst:1184 msgid "" "In addition to the examples below, more examples are given in :ref:`urllib-" "howto`." msgstr "" -#: ../../library/urllib.request.rst:1198 +#: ../../library/urllib.request.rst:1187 msgid "" "This example gets the python.org main page and displays the first 300 bytes " "of it. ::" msgstr "" -#: ../../library/urllib.request.rst:1201 +#: ../../library/urllib.request.rst:1190 msgid "" ">>> import urllib.request\n" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" @@ -1502,7 +1481,7 @@ msgstr "" ">\\n\n" "Python Programming '" -#: ../../library/urllib.request.rst:1211 +#: ../../library/urllib.request.rst:1200 msgid "" "Note that urlopen returns a bytes object. This is because there is no way " "for urlopen to automatically determine the encoding of the byte stream it " @@ -1511,20 +1490,20 @@ msgid "" "appropriate encoding." msgstr "" -#: ../../library/urllib.request.rst:1217 +#: ../../library/urllib.request.rst:1206 msgid "" "The following W3C document, https://www.w3.org/International/O-charset\\ , " "lists the various ways in which an (X)HTML or an XML document could have " "specified its encoding information." msgstr "" -#: ../../library/urllib.request.rst:1221 +#: ../../library/urllib.request.rst:1210 msgid "" "As the python.org website uses *utf-8* encoding as specified in its meta " "tag, we will use the same for decoding the bytes object. ::" msgstr "" -#: ../../library/urllib.request.rst:1224 +#: ../../library/urllib.request.rst:1213 msgid "" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" "... print(f.read(100).decode('utf-8'))\n" @@ -1538,13 +1517,13 @@ msgstr "" "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" "\"http://www.w3.org/TR/xhtml1/DTD/xhtm" -#: ../../library/urllib.request.rst:1230 +#: ../../library/urllib.request.rst:1219 msgid "" "It is also possible to achieve the same result without using the :term:" "`context manager` approach. ::" msgstr "" -#: ../../library/urllib.request.rst:1233 +#: ../../library/urllib.request.rst:1222 msgid "" ">>> import urllib.request\n" ">>> f = urllib.request.urlopen('http://www.python.org/')\n" @@ -1558,14 +1537,14 @@ msgstr "" "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" "\"http://www.w3.org/TR/xhtml1/DTD/xhtm" -#: ../../library/urllib.request.rst:1239 +#: ../../library/urllib.request.rst:1228 msgid "" "In the following example, we are sending a data-stream to the stdin of a CGI " "and reading the data it returns to us. Note that this example will only work " "when the Python installation supports SSL. ::" msgstr "" -#: ../../library/urllib.request.rst:1243 +#: ../../library/urllib.request.rst:1232 msgid "" ">>> import urllib.request\n" ">>> req = urllib.request.Request(url='https://localhost/cgi-bin/test.cgi',\n" @@ -1576,11 +1555,11 @@ msgid "" "Got Data: \"This data is passed to stdin of the CGI\"" msgstr "" -#: ../../library/urllib.request.rst:1251 +#: ../../library/urllib.request.rst:1240 msgid "The code for the sample CGI used in the above example is::" msgstr "" -#: ../../library/urllib.request.rst:1253 +#: ../../library/urllib.request.rst:1242 msgid "" "#!/usr/bin/env python\n" "import sys\n" @@ -1592,11 +1571,11 @@ msgstr "" "data = sys.stdin.read()\n" "print('Content-type: text/plain\\n\\nGot Data: \"%s\"' % data)" -#: ../../library/urllib.request.rst:1258 +#: ../../library/urllib.request.rst:1247 msgid "Here is an example of doing a ``PUT`` request using :class:`Request`::" msgstr "" -#: ../../library/urllib.request.rst:1260 +#: ../../library/urllib.request.rst:1249 msgid "" "import urllib.request\n" "DATA = b'some data'\n" @@ -1616,11 +1595,11 @@ msgstr "" "print(f.status)\n" "print(f.reason)" -#: ../../library/urllib.request.rst:1268 +#: ../../library/urllib.request.rst:1257 msgid "Use of Basic HTTP Authentication::" msgstr "" -#: ../../library/urllib.request.rst:1270 +#: ../../library/urllib.request.rst:1259 msgid "" "import urllib.request\n" "# Create an OpenerDirector with support for Basic HTTP Authentication...\n" @@ -1635,7 +1614,7 @@ msgid "" "urllib.request.urlopen('http://www.example.com/login.html')" msgstr "" -#: ../../library/urllib.request.rst:1282 +#: ../../library/urllib.request.rst:1271 msgid "" ":func:`build_opener` provides many handlers by default, including a :class:" "`ProxyHandler`. By default, :class:`ProxyHandler` uses the environment " @@ -1644,14 +1623,14 @@ msgid "" "read to obtain the HTTP proxy's URL." msgstr "" -#: ../../library/urllib.request.rst:1288 +#: ../../library/urllib.request.rst:1277 msgid "" "This example replaces the default :class:`ProxyHandler` with one that uses " "programmatically supplied proxy URLs, and adds proxy authorization support " "with :class:`ProxyBasicAuthHandler`. ::" msgstr "" -#: ../../library/urllib.request.rst:1292 +#: ../../library/urllib.request.rst:1281 msgid "" "proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example./" "com:3128/'})\n" @@ -1671,15 +1650,15 @@ msgstr "" "# 這次我們直接使用它而不安裝 OpenerDirector:\n" "opener.open('http://www.example.com/login.html')" -#: ../../library/urllib.request.rst:1300 +#: ../../library/urllib.request.rst:1289 msgid "Adding HTTP headers:" msgstr "" -#: ../../library/urllib.request.rst:1302 +#: ../../library/urllib.request.rst:1291 msgid "Use the *headers* argument to the :class:`Request` constructor, or::" msgstr "" -#: ../../library/urllib.request.rst:1304 +#: ../../library/urllib.request.rst:1293 msgid "" "import urllib.request\n" "req = urllib.request.Request('http://www.example.com/')\n" @@ -1695,13 +1674,13 @@ msgstr "" "req.add_header('User-Agent', 'urllib-example/0.1 (Contact: . . .)')\n" "r = urllib.request.urlopen(req)" -#: ../../library/urllib.request.rst:1311 +#: ../../library/urllib.request.rst:1300 msgid "" ":class:`OpenerDirector` automatically adds a :mailheader:`User-Agent` header " "to every :class:`Request`. To change this::" msgstr "" -#: ../../library/urllib.request.rst:1314 +#: ../../library/urllib.request.rst:1303 msgid "" "import urllib.request\n" "opener = urllib.request.build_opener()\n" @@ -1713,20 +1692,20 @@ msgstr "" "opener.addheaders = [('User-agent', 'Mozilla/5.0')]\n" "opener.open('http://www.example.com/')" -#: ../../library/urllib.request.rst:1319 +#: ../../library/urllib.request.rst:1308 msgid "" "Also, remember that a few standard headers (:mailheader:`Content-Length`, :" "mailheader:`Content-Type` and :mailheader:`Host`) are added when the :class:" "`Request` is passed to :func:`urlopen` (or :meth:`OpenerDirector.open`)." msgstr "" -#: ../../library/urllib.request.rst:1326 +#: ../../library/urllib.request.rst:1315 msgid "" "Here is an example session that uses the ``GET`` method to retrieve a URL " "containing parameters::" msgstr "" -#: ../../library/urllib.request.rst:1329 +#: ../../library/urllib.request.rst:1318 msgid "" ">>> import urllib.request\n" ">>> import urllib.parse\n" @@ -1744,14 +1723,14 @@ msgstr "" "... print(f.read().decode('utf-8'))\n" "..." -#: ../../library/urllib.request.rst:1337 +#: ../../library/urllib.request.rst:1326 msgid "" "The following example uses the ``POST`` method instead. Note that params " "output from urlencode is encoded to bytes before it is sent to urlopen as " "data::" msgstr "" -#: ../../library/urllib.request.rst:1340 +#: ../../library/urllib.request.rst:1329 msgid "" ">>> import urllib.request\n" ">>> import urllib.parse\n" @@ -1771,13 +1750,13 @@ msgstr "" "... print(f.read().decode('utf-8'))\n" "..." -#: ../../library/urllib.request.rst:1348 +#: ../../library/urllib.request.rst:1337 msgid "" "The following example uses an explicitly specified HTTP proxy, overriding " "environment settings::" msgstr "" -#: ../../library/urllib.request.rst:1351 +#: ../../library/urllib.request.rst:1340 msgid "" ">>> import urllib.request\n" ">>> proxies = {'http': 'http://proxy.example.com:8080/'}\n" @@ -1793,13 +1772,13 @@ msgstr "" "... f.read().decode('utf-8')\n" "..." -#: ../../library/urllib.request.rst:1358 +#: ../../library/urllib.request.rst:1347 msgid "" "The following example uses no proxies at all, overriding environment " "settings::" msgstr "" -#: ../../library/urllib.request.rst:1360 +#: ../../library/urllib.request.rst:1349 msgid "" ">>> import urllib.request\n" ">>> opener = urllib.request.FancyURLopener({})\n" @@ -1813,18 +1792,18 @@ msgstr "" "... f.read().decode('utf-8')\n" "..." -#: ../../library/urllib.request.rst:1368 +#: ../../library/urllib.request.rst:1357 msgid "Legacy interface" msgstr "" -#: ../../library/urllib.request.rst:1370 +#: ../../library/urllib.request.rst:1359 msgid "" "The following functions and classes are ported from the Python 2 module " "``urllib`` (as opposed to ``urllib2``). They might become deprecated at " "some point in the future." msgstr "" -#: ../../library/urllib.request.rst:1376 +#: ../../library/urllib.request.rst:1365 msgid "" "Copy a network object denoted by a URL to a local file. If the URL points to " "a local file, the object will not be copied unless filename is supplied. " @@ -1834,7 +1813,7 @@ msgid "" "a remote object). Exceptions are the same as for :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:1383 +#: ../../library/urllib.request.rst:1372 msgid "" "The second argument, if present, specifies the file location to copy to (if " "absent, the location will be a tempfile with a generated name). The third " @@ -1846,11 +1825,11 @@ msgid "" "file size in response to a retrieval request." msgstr "" -#: ../../library/urllib.request.rst:1392 +#: ../../library/urllib.request.rst:1381 msgid "The following example illustrates the most common usage scenario::" msgstr "" -#: ../../library/urllib.request.rst:1394 +#: ../../library/urllib.request.rst:1383 msgid "" ">>> import urllib.request\n" ">>> local_filename, headers = urllib.request.urlretrieve('http://python./" @@ -1864,7 +1843,7 @@ msgstr "" ">>> html = open(local_filename)\n" ">>> html.close()" -#: ../../library/urllib.request.rst:1399 +#: ../../library/urllib.request.rst:1388 msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " @@ -1873,7 +1852,7 @@ msgid "" "parse.urlencode` function." msgstr "" -#: ../../library/urllib.request.rst:1405 +#: ../../library/urllib.request.rst:1394 msgid "" ":func:`urlretrieve` will raise :exc:`~urllib.error.ContentTooShortError` " "when it detects that the amount of data available was less than the " @@ -1881,40 +1860,40 @@ msgid "" "This can occur, for example, when the download is interrupted." msgstr "" -#: ../../library/urllib.request.rst:1410 +#: ../../library/urllib.request.rst:1399 msgid "" "The *Content-Length* is treated as a lower bound: if there's more data to " "read, urlretrieve reads more data, but if less data is available, it raises " "the exception." msgstr "" -#: ../../library/urllib.request.rst:1414 +#: ../../library/urllib.request.rst:1403 msgid "" "You can still retrieve the downloaded data in this case, it is stored in " "the :attr:`!content` attribute of the exception instance." msgstr "" -#: ../../library/urllib.request.rst:1417 +#: ../../library/urllib.request.rst:1406 msgid "" "If no *Content-Length* header was supplied, urlretrieve can not check the " "size of the data it has downloaded, and just returns it. In this case you " "just have to assume that the download was successful." msgstr "" -#: ../../library/urllib.request.rst:1423 +#: ../../library/urllib.request.rst:1412 msgid "" "Cleans up temporary files that may have been left behind by previous calls " "to :func:`urlretrieve`." msgstr "" -#: ../../library/urllib.request.rst:1430 +#: ../../library/urllib.request.rst:1419 msgid "" "Base class for opening and reading URLs. Unless you need to support opening " "objects using schemes other than :file:`http:`, :file:`ftp:`, or :file:`file:" "`, you probably want to use :class:`FancyURLopener`." msgstr "" -#: ../../library/urllib.request.rst:1434 +#: ../../library/urllib.request.rst:1423 msgid "" "By default, the :class:`URLopener` class sends a :mailheader:`User-Agent` " "header of ``urllib/VVV``, where *VVV* is the :mod:`urllib` version number. " @@ -1924,7 +1903,7 @@ msgid "" "subclass definition." msgstr "" -#: ../../library/urllib.request.rst:1440 +#: ../../library/urllib.request.rst:1429 msgid "" "The optional *proxies* parameter should be a dictionary mapping scheme names " "to proxy URLs, where an empty dictionary turns proxies off completely. Its " @@ -1932,7 +1911,7 @@ msgid "" "be used if present, as discussed in the definition of :func:`urlopen`, above." msgstr "" -#: ../../library/urllib.request.rst:1445 +#: ../../library/urllib.request.rst:1434 msgid "" "Additional keyword parameters, collected in *x509*, may be used for " "authentication of the client when using the :file:`https:` scheme. The " @@ -1940,13 +1919,13 @@ msgid "" "certificate; both are needed to support client authentication." msgstr "" -#: ../../library/urllib.request.rst:1450 +#: ../../library/urllib.request.rst:1439 msgid "" ":class:`URLopener` objects will raise an :exc:`OSError` exception if the " "server returns an error code." msgstr "" -#: ../../library/urllib.request.rst:1455 +#: ../../library/urllib.request.rst:1444 msgid "" "Open *fullurl* using the appropriate protocol. This method sets up cache " "and proxy information, then calls the appropriate open method with its input " @@ -1955,15 +1934,15 @@ msgid "" "`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:1461 +#: ../../library/urllib.request.rst:1450 msgid "This method always quotes *fullurl* using :func:`~urllib.parse.quote`." msgstr "" -#: ../../library/urllib.request.rst:1465 +#: ../../library/urllib.request.rst:1454 msgid "Overridable interface to open unknown URL types." msgstr "" -#: ../../library/urllib.request.rst:1470 +#: ../../library/urllib.request.rst:1459 msgid "" "Retrieves the contents of *url* and places it in *filename*. The return " "value is a tuple consisting of a local filename and either an :class:`email." @@ -1980,7 +1959,7 @@ msgid "" "*reporthook* is ignored for local URLs." msgstr "" -#: ../../library/urllib.request.rst:1483 +#: ../../library/urllib.request.rst:1472 msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " @@ -1989,7 +1968,7 @@ msgid "" "urlencode` function." msgstr "" -#: ../../library/urllib.request.rst:1492 +#: ../../library/urllib.request.rst:1481 msgid "" "Variable that specifies the user agent of the opener object. To get :mod:" "`urllib` to tell servers that it is a particular user agent, set this in a " @@ -1997,7 +1976,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/urllib.request.rst:1502 +#: ../../library/urllib.request.rst:1491 msgid "" ":class:`FancyURLopener` subclasses :class:`URLopener` providing default " "handling for the following HTTP response codes: 301, 302, 303, 307 and 401. " @@ -2008,14 +1987,14 @@ msgid "" "defaults to 10." msgstr "" -#: ../../library/urllib.request.rst:1509 +#: ../../library/urllib.request.rst:1498 msgid "" "For all other response codes, the method :meth:`~BaseHandler." "http_error_default` is called which you can override in subclasses to handle " "the error appropriately." msgstr "" -#: ../../library/urllib.request.rst:1514 +#: ../../library/urllib.request.rst:1503 msgid "" "According to the letter of :rfc:`2616`, 301 and 302 responses to POST " "requests must not be automatically redirected without confirmation by the " @@ -2024,13 +2003,13 @@ msgid "" "behaviour." msgstr "" -#: ../../library/urllib.request.rst:1519 +#: ../../library/urllib.request.rst:1508 msgid "" "The parameters to the constructor are the same as those for :class:" "`URLopener`." msgstr "" -#: ../../library/urllib.request.rst:1523 +#: ../../library/urllib.request.rst:1512 msgid "" "When performing basic authentication, a :class:`FancyURLopener` instance " "calls its :meth:`prompt_user_passwd` method. The default implementation " @@ -2039,59 +2018,59 @@ msgid "" "needed." msgstr "" -#: ../../library/urllib.request.rst:1528 +#: ../../library/urllib.request.rst:1517 msgid "" "The :class:`FancyURLopener` class offers one additional method that should " "be overloaded to provide the appropriate behavior:" msgstr "" -#: ../../library/urllib.request.rst:1533 +#: ../../library/urllib.request.rst:1522 msgid "" "Return information needed to authenticate the user at the given host in the " "specified security realm. The return value should be a tuple, ``(user, " "password)``, which can be used for basic authentication." msgstr "" -#: ../../library/urllib.request.rst:1537 +#: ../../library/urllib.request.rst:1526 msgid "" "The implementation prompts for this information on the terminal; an " "application should override this method to use an appropriate interaction " "model in the local environment." msgstr "" -#: ../../library/urllib.request.rst:1543 +#: ../../library/urllib.request.rst:1532 msgid ":mod:`urllib.request` Restrictions" msgstr "" -#: ../../library/urllib.request.rst:1549 +#: ../../library/urllib.request.rst:1538 msgid "" "Currently, only the following protocols are supported: HTTP (versions 0.9 " "and 1.0), FTP, local files, and data URLs." msgstr "" -#: ../../library/urllib.request.rst:1552 +#: ../../library/urllib.request.rst:1541 msgid "Added support for data URLs." msgstr "" -#: ../../library/urllib.request.rst:1554 +#: ../../library/urllib.request.rst:1543 msgid "" "The caching feature of :func:`urlretrieve` has been disabled until someone " "finds the time to hack proper processing of Expiration time headers." msgstr "" -#: ../../library/urllib.request.rst:1557 +#: ../../library/urllib.request.rst:1546 msgid "" "There should be a function to query whether a particular URL is in the cache." msgstr "" -#: ../../library/urllib.request.rst:1559 +#: ../../library/urllib.request.rst:1548 msgid "" "For backward compatibility, if a URL appears to point to a local file but " "the file can't be opened, the URL is re-interpreted using the FTP protocol. " "This can sometimes cause confusing error messages." msgstr "" -#: ../../library/urllib.request.rst:1563 +#: ../../library/urllib.request.rst:1552 msgid "" "The :func:`urlopen` and :func:`urlretrieve` functions can cause arbitrarily " "long delays while waiting for a network connection to be set up. This means " @@ -2099,7 +2078,7 @@ msgid "" "functions without using threads." msgstr "" -#: ../../library/urllib.request.rst:1572 +#: ../../library/urllib.request.rst:1561 msgid "" "The data returned by :func:`urlopen` or :func:`urlretrieve` is the raw data " "returned by the server. This may be binary data (such as an image), plain " @@ -2109,7 +2088,7 @@ msgid "" "module :mod:`html.parser` to parse it." msgstr "" -#: ../../library/urllib.request.rst:1581 +#: ../../library/urllib.request.rst:1570 msgid "" "The code handling the FTP protocol cannot differentiate between a file and a " "directory. This can lead to unexpected behavior when attempting to read a " @@ -2127,11 +2106,11 @@ msgid "" "meet your needs." msgstr "" -#: ../../library/urllib.request.rst:1598 +#: ../../library/urllib.request.rst:1587 msgid ":mod:`urllib.response` --- Response classes used by urllib" msgstr "" -#: ../../library/urllib.request.rst:1603 +#: ../../library/urllib.request.rst:1592 msgid "" "The :mod:`urllib.response` module defines functions and classes which define " "a minimal file-like interface, including ``read()`` and ``readline()``. " @@ -2140,50 +2119,75 @@ msgid "" "addinfourl` instance:" msgstr "" -#: ../../library/urllib.request.rst:1612 +#: ../../library/urllib.request.rst:1601 msgid "" "URL of the resource retrieved, commonly used to determine if a redirect was " "followed." msgstr "" -#: ../../library/urllib.request.rst:1616 +#: ../../library/urllib.request.rst:1605 msgid "" "Returns the headers of the response in the form of an :class:`~email.message." "EmailMessage` instance." msgstr "" -#: ../../library/urllib.request.rst:1622 +#: ../../library/urllib.request.rst:1611 msgid "Status code returned by server." msgstr "" -#: ../../library/urllib.request.rst:1626 +#: ../../library/urllib.request.rst:1615 msgid "Deprecated in favor of :attr:`~addinfourl.url`." msgstr "" -#: ../../library/urllib.request.rst:1631 +#: ../../library/urllib.request.rst:1620 msgid "Deprecated in favor of :attr:`~addinfourl.headers`." msgstr "" -#: ../../library/urllib.request.rst:1636 ../../library/urllib.request.rst:1641 +#: ../../library/urllib.request.rst:1625 ../../library/urllib.request.rst:1630 msgid "Deprecated in favor of :attr:`~addinfourl.status`." msgstr "" -#: ../../library/urllib.request.rst:1545 ../../library/urllib.request.rst:1568 +#: ../../library/urllib.request.rst:1534 ../../library/urllib.request.rst:1557 msgid "HTTP" msgstr "HTTP" -#: ../../library/urllib.request.rst:1545 ../../library/urllib.request.rst:1568 +#: ../../library/urllib.request.rst:1534 ../../library/urllib.request.rst:1557 msgid "protocol" msgstr "protocol(協定)" -#: ../../library/urllib.request.rst:1545 ../../library/urllib.request.rst:1579 +#: ../../library/urllib.request.rst:1534 ../../library/urllib.request.rst:1568 msgid "FTP" msgstr "FTP" -#: ../../library/urllib.request.rst:1568 +#: ../../library/urllib.request.rst:1557 msgid "HTML" msgstr "HTML" +#~ msgid "" +#~ "The optional *cafile* and *capath* parameters specify a set of trusted CA " +#~ "certificates for HTTPS requests. *cafile* should point to a single file " +#~ "containing a bundle of CA certificates, whereas *capath* should point to " +#~ "a directory of hashed certificate files. More information can be found " +#~ "in :meth:`ssl.SSLContext.load_verify_locations`." +#~ msgstr "" +#~ "選擇性參數 *cafile* 與 *capath* 用來指定一組 HTTPS 請求中所需之受信任 CA " +#~ "憑證。*cafile* 的值應該指向內容包含一堆 CA 憑證的單一檔案,而 *capath* 則" +#~ "指向存放一堆雜湊後的憑證檔案的目錄。欲瞭解更多的資訊請參見 :meth:`ssl." +#~ "SSLContext.load_verify_locations`。" + +#~ msgid "The *cadefault* parameter is ignored." +#~ msgstr "參數 *cadefault* 已被忽略。" + +#~ msgid "" +#~ "*cafile*, *capath* and *cadefault* are deprecated in favor of *context*. " +#~ "Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let :func:" +#~ "`ssl.create_default_context` select the system's trusted CA certificates " +#~ "for you." +#~ msgstr "" +#~ "*cafile*、*capath*、*cadefault* 已經被棄用並應改為使用 *context*。請改用 :" +#~ "meth:`ssl.SSLContext.load_cert_chain`,或是讓 :func:`ssl." +#~ "create_default_context` 選取系統中受信任的 CA 憑證。" + #, fuzzy #~ msgid "" #~ "The default opener raises an auditing event urllib.Request with arguments " diff --git a/library/venv.po b/library/venv.po index 03b0c5a9ed..f24d52177e 100644 --- a/library/venv.po +++ b/library/venv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-07-09 15:09+0800\n" "Last-Translator: Po-Chuan Chen <present90308@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -91,15 +91,17 @@ msgid "" "environments/#create-and-use-virtual-environments>`__" msgstr "" -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability <availability>`: not Emscripten, not WASI." +#: ../../includes/wasm-ios-notavail.rst:3 +msgid ":ref:`Availability <availability>`: not WASI, not iOS." msgstr "" -#: ../../includes/wasm-notavail.rst:5 +#: ../../includes/wasm-ios-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly platforms, or " +"on iOS. See :ref:`wasm-availability` for more information on WASM " +"availability; see :ref:`iOS-availability` for more information on iOS " +"availability." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" @@ -177,39 +179,43 @@ msgid "The command, if run with ``-h``, will show the available options::" msgstr "如果使用 ``-h`` 選項執行該命令,將會顯示可用的選項:" #: ../../using/venv-create.inc:38 +#, fuzzy msgid "" "usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear]\n" " [--upgrade] [--without-pip] [--prompt PROMPT] [--upgrade-deps]\n" +" [--without-scm-ignore-file]\n" " ENV_DIR [ENV_DIR ...]\n" "\n" "Creates virtual Python environments in one or more target directories.\n" "\n" "positional arguments:\n" -" ENV_DIR A directory to create the environment in.\n" +"ENV_DIR A directory to create the environment in.\n" "\n" -"optional arguments:\n" -" -h, --help show this help message and exit\n" -" --system-site-packages\n" +"options:\n" +"-h, --help show this help message and exit\n" +"--system-site-packages\n" " Give the virtual environment access to the system\n" " site-packages dir.\n" -" --symlinks Try to use symlinks rather than copies, when " -"symlinks\n" -" are not the default for the platform.\n" -" --copies Try to use copies rather than symlinks, even when\n" +"--symlinks Try to use symlinks rather than copies, when\n" +" symlinks are not the default for the platform.\n" +"--copies Try to use copies rather than symlinks, even when\n" " symlinks are the default for the platform.\n" -" --clear Delete the contents of the environment directory if " -"it\n" -" already exists, before environment creation.\n" -" --upgrade Upgrade the environment directory to use this " -"version\n" -" of Python, assuming Python has been upgraded in-" -"place.\n" -" --without-pip Skips installing or upgrading pip in the virtual\n" +"--clear Delete the contents of the environment directory if\n" +" it already exists, before environment creation.\n" +"--upgrade Upgrade the environment directory to use this\n" +" version of Python, assuming Python has been " +"upgraded\n" +" in-place.\n" +"--without-pip Skips installing or upgrading pip in the virtual\n" " environment (pip is bootstrapped by default)\n" -" --prompt PROMPT Provides an alternative prompt prefix for this\n" +"--prompt PROMPT Provides an alternative prompt prefix for this\n" " environment.\n" -" --upgrade-deps Upgrade core dependencies (pip) to the\n" -" latest version in PyPI\n" +"--upgrade-deps Upgrade core dependencies (pip) to the latest\n" +" version in PyPI\n" +"--without-scm-ignore-file\n" +" Skips adding the default SCM ignore file to the\n" +" environment directory (the default is a .gitignore\n" +" file).\n" "\n" "Once an environment has been created, you may wish to activate it, e.g. by\n" "sourcing an activate script in its bin directory." @@ -250,24 +256,30 @@ msgstr "" "Once an environment has been created, you may wish to activate it, e.g. by\n" "sourcing an activate script in its bin directory." -#: ../../library/venv.rst:313 ../../using/venv-create.inc:72 +#: ../../using/venv-create.inc:78 +msgid "" +"``--without-scm-ignore-file`` was added along with creating an ignore file " +"for ``git`` by default." +msgstr "" + +#: ../../library/venv.rst:323 ../../using/venv-create.inc:83 msgid "``setuptools`` is no longer a core venv dependency." msgstr "" -#: ../../using/venv-create.inc:74 +#: ../../using/venv-create.inc:85 msgid "" "Add ``--upgrade-deps`` option to upgrade pip + setuptools to the latest on " "PyPI" msgstr "" "新增 ``--upgrade-deps`` 選項以將 pip 和 setuptools 升級至 PyPI 上的最新版本" -#: ../../using/venv-create.inc:77 +#: ../../using/venv-create.inc:88 msgid "" "Installs pip by default, added the ``--without-pip`` and ``--copies`` " "options" msgstr "預設情況下安裝 pip,並新增了 ``--without-pip`` 和 ``--copies`` 選項" -#: ../../using/venv-create.inc:81 +#: ../../using/venv-create.inc:92 msgid "" "In earlier versions, if the target directory already existed, an error was " "raised, unless the ``--clear`` or ``--upgrade`` option was provided." @@ -275,7 +287,7 @@ msgstr "" "在較早的版本中,如果目標目錄已存在,除非提供了 ``--clear`` 或 ``--upgrade`` " "選項,否則會引發錯誤。" -#: ../../using/venv-create.inc:86 +#: ../../using/venv-create.inc:97 msgid "" "While symlinks are supported on Windows, they are not recommended. Of " "particular note is that double-clicking ``python.exe`` in File Explorer will " @@ -284,7 +296,7 @@ msgstr "" "雖然在 Windows 上支援符號連結,但並不建議使用。特別需要注意的是,在檔案總管中" "按兩下 ``python.exe`` 會急切地解析符號連結並忽略虛擬環境。" -#: ../../using/venv-create.inc:91 +#: ../../using/venv-create.inc:102 msgid "" "On Microsoft Windows, it may be required to enable the ``Activate.ps1`` " "script by setting the execution policy for the user. You can do this by " @@ -293,12 +305,12 @@ msgstr "" "在 Microsoft Windows 上,可能需要通過設置使用者的執行策略來啟用 ``Activate." "ps1`` 腳本。你可以發出以下 PowerShell 命令來執行此操作:" -#: ../../using/venv-create.inc:95 +#: ../../using/venv-create.inc:106 msgid "" "PS C:\\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser" msgstr "" -#: ../../using/venv-create.inc:97 +#: ../../using/venv-create.inc:108 msgid "" "See `About Execution Policies <https://go.microsoft.com/fwlink/?" "LinkID=135170>`_ for more information." @@ -306,7 +318,7 @@ msgstr "" "有關更多資訊,請參閱\\ `關於執行策略 <https://go.microsoft.com/fwlink/?" "LinkID=135170>`_。" -#: ../../using/venv-create.inc:101 +#: ../../using/venv-create.inc:112 msgid "" "The created ``pyvenv.cfg`` file also includes the ``include-system-site-" "packages`` key, set to ``true`` if ``venv`` is run with the ``--system-site-" @@ -316,7 +328,7 @@ msgstr "" "如果使用 ``venv`` 執行時帶有 ``--system-site-packages`` 選項,則設置為 " "``true``,否則設置為 ``false``。" -#: ../../using/venv-create.inc:105 +#: ../../using/venv-create.inc:116 msgid "" "Unless the ``--without-pip`` option is given, :mod:`ensurepip` will be " "invoked to bootstrap ``pip`` into the virtual environment." @@ -324,7 +336,7 @@ msgstr "" "除非 ``--without-pip`` 選項被提供,否則將調用 :mod:`ensurepip` 來啟動 " "``pip`` 到虛擬環境中。" -#: ../../using/venv-create.inc:108 +#: ../../using/venv-create.inc:119 msgid "" "Multiple paths can be given to ``venv``, in which case an identical virtual " "environment will be created, according to the given options, at each " @@ -528,13 +540,13 @@ msgstr "" "上述提到的高階 method(方法)透過簡單的 API 使用, 為第三方虛擬環境建立者提供" "可以依據他們需求來建立環境的客製化機制: :class:`EnvBuilder` class。" -#: ../../library/venv.rst:167 +#: ../../library/venv.rst:168 msgid "" "The :class:`EnvBuilder` class accepts the following keyword arguments on " "instantiation:" msgstr "進行實例化時,class :class:`EnvBuilder` 接受下列的關鍵字引數:" -#: ../../library/venv.rst:170 +#: ../../library/venv.rst:171 msgid "" "``system_site_packages`` -- a Boolean value indicating that the system " "Python site-packages should be available to the environment (defaults to " @@ -543,7 +555,7 @@ msgstr "" "``system_site_packages`` -- 為一個 Boolean (布林值),並表明系統的 Python " "site-packages 是否可以在環境中可用(預設為 ``False`` )。" -#: ../../library/venv.rst:173 +#: ../../library/venv.rst:174 msgid "" "``clear`` -- a Boolean value which, if true, will delete the contents of any " "existing target directory, before creating the environment." @@ -551,7 +563,7 @@ msgstr "" "``clear`` -- 為一個 Boolean,如果為 true,則在建立環境之前,刪除目標目錄內所" "有存在的內容。" -#: ../../library/venv.rst:176 +#: ../../library/venv.rst:177 msgid "" "``symlinks`` -- a Boolean value indicating whether to attempt to symlink the " "Python binary rather than copying." @@ -559,7 +571,7 @@ msgstr "" "``symlinks`` -- 為一個 Boolean,並表明是否嘗試與 Python 二進位檔案建立符號連" "結而不是複製該檔案。" -#: ../../library/venv.rst:179 +#: ../../library/venv.rst:180 msgid "" "``upgrade`` -- a Boolean value which, if true, will upgrade an existing " "environment with the running Python - for use when that Python has been " @@ -568,7 +580,7 @@ msgstr "" "``upgrade`` -- 為一個 Boolean,若為 true,則會在執行 Python 時為現有的環境進" "行升級。目的是讓 Python 可以升級到位(預設為 ``False``)。" -#: ../../library/venv.rst:183 +#: ../../library/venv.rst:184 msgid "" "``with_pip`` -- a Boolean value which, if true, ensures pip is installed in " "the virtual environment. This uses :mod:`ensurepip` with the ``--default-" @@ -577,7 +589,7 @@ msgstr "" "``with_pip`` -- 為一個 Boolean,若為 true,則確保 pip 有安裝至虛擬環境之中。" "當有 ``--default-pip`` 的選項時,會使用 :mod:`ensurepip`。" -#: ../../library/venv.rst:187 +#: ../../library/venv.rst:188 msgid "" "``prompt`` -- a String to be used after virtual environment is activated " "(defaults to ``None`` which means directory name of the environment would be " @@ -588,23 +600,36 @@ msgstr "" "為 ``None``,代表該環境的目錄名稱會被使用)倘若出現特殊字串 ``\".\"`` ,則當" "前目錄的 basename 會做為提示路徑使用。" -#: ../../library/venv.rst:192 +#: ../../library/venv.rst:193 msgid "``upgrade_deps`` -- Update the base venv modules to the latest on PyPI" msgstr "``upgrade_deps`` -- 更新基礎 venv 模組至 PyPI 的最新版本" -#: ../../library/venv.rst:194 ../../library/venv.rst:372 +#: ../../library/venv.rst:195 +msgid "" +"``scm_ignore_files`` -- Create ignore files based for the specified source " +"control managers (SCM) in the iterable. Support is defined by having a " +"method named ``create_{scm}_ignore_file``. The only value supported by " +"default is ``\"git\"`` via :meth:`create_git_ignore_file`." +msgstr "" + +#: ../../library/venv.rst:201 ../../library/venv.rst:389 msgid "Added the ``with_pip`` parameter" msgstr "新增 ``with_pip`` 參數" -#: ../../library/venv.rst:197 ../../library/venv.rst:375 +#: ../../library/venv.rst:204 ../../library/venv.rst:392 msgid "Added the ``prompt`` parameter" msgstr "新增 ``prompt`` 參數" -#: ../../library/venv.rst:200 ../../library/venv.rst:378 +#: ../../library/venv.rst:207 ../../library/venv.rst:395 msgid "Added the ``upgrade_deps`` parameter" msgstr "新增 ``upgrade_deps`` 參數" -#: ../../library/venv.rst:203 +#: ../../library/venv.rst:210 ../../library/venv.rst:398 +#, fuzzy +msgid "Added the ``scm_ignore_files`` parameter" +msgstr "新增 ``upgrade_deps`` 參數" + +#: ../../library/venv.rst:213 msgid "" "Creators of third-party virtual environment tools will be free to use the " "provided :class:`EnvBuilder` class as a base class." @@ -612,11 +637,11 @@ msgstr "" "第三方虛擬環境工具的建立者可以自由地使用 :class:`EnvBuilder` class 作為 base " "class(基底類別)使用." -#: ../../library/venv.rst:206 +#: ../../library/venv.rst:216 msgid "The returned env-builder is an object which has a method, ``create``:" msgstr "回傳的 env-builder 為一個物件,且帶有一個 method ``create``:" -#: ../../library/venv.rst:210 +#: ../../library/venv.rst:220 msgid "" "Create a virtual environment by specifying the target directory (absolute or " "relative to the current directory) which is to contain the virtual " @@ -627,7 +652,7 @@ msgstr "" "目錄),也就是在該目錄中容納虛擬環境。``create`` method 將會在指定的目錄下建" "立環境,或是觸發適當的例外。" -#: ../../library/venv.rst:216 +#: ../../library/venv.rst:226 msgid "" "The ``create`` method of the :class:`EnvBuilder` class illustrates the hooks " "available for subclass customization::" @@ -635,7 +660,7 @@ msgstr "" ":class:`EnvBuilder` class 的 ``create`` method 會闡述可用的 Hooks 以客製化 " "subclass (子類別)::" -#: ../../library/venv.rst:219 +#: ../../library/venv.rst:229 msgid "" "def create(self, env_dir):\n" " \"\"\"\n" @@ -650,7 +675,7 @@ msgid "" " self.post_setup(context)" msgstr "" -#: ../../library/venv.rst:231 +#: ../../library/venv.rst:241 msgid "" "Each of the methods :meth:`ensure_directories`, :meth:" "`create_configuration`, :meth:`setup_python`, :meth:`setup_scripts` and :" @@ -659,7 +684,7 @@ msgstr "" "每個 methods :meth:`ensure_directories`、:meth:`create_configuration`、:meth:" "`setup_python`、:meth:`setup_scripts` 及 :meth:`post_setup` 都可以被覆寫。" -#: ../../library/venv.rst:237 +#: ../../library/venv.rst:247 msgid "" "Creates the environment directory and all necessary subdirectories that " "don't already exist, and returns a context object. This context object is " @@ -673,7 +698,7 @@ msgstr "" "class:`EnvBuilder` 已被建立且帶有 ``clear=True`` 的引數,該環境目錄下的內容將" "被清空,以及所有必要的子目錄將被重新建立。" -#: ../../library/venv.rst:244 +#: ../../library/venv.rst:254 msgid "" "The returned context object is a :class:`types.SimpleNamespace` with the " "following attributes:" @@ -681,81 +706,81 @@ msgstr "" "回傳的情境物件(context object)其型別會是 :class:`types.SimpleNamespace`,並" "包含以下屬性:" -#: ../../library/venv.rst:247 +#: ../../library/venv.rst:257 msgid "" "``env_dir`` - The location of the virtual environment. Used for " "``__VENV_DIR__`` in activation scripts (see :meth:`install_scripts`)." msgstr "" -#: ../../library/venv.rst:250 +#: ../../library/venv.rst:260 msgid "" "``env_name`` - The name of the virtual environment. Used for " "``__VENV_NAME__`` in activation scripts (see :meth:`install_scripts`)." msgstr "" -#: ../../library/venv.rst:253 +#: ../../library/venv.rst:263 msgid "" "``prompt`` - The prompt to be used by the activation scripts. Used for " "``__VENV_PROMPT__`` in activation scripts (see :meth:`install_scripts`)." msgstr "" -#: ../../library/venv.rst:256 +#: ../../library/venv.rst:266 msgid "" "``executable`` - The underlying Python executable used by the virtual " "environment. This takes into account the case where a virtual environment is " "created from another virtual environment." msgstr "" -#: ../../library/venv.rst:260 +#: ../../library/venv.rst:270 msgid "``inc_path`` - The include path for the virtual environment." msgstr "" -#: ../../library/venv.rst:262 +#: ../../library/venv.rst:272 msgid "``lib_path`` - The purelib path for the virtual environment." msgstr "" -#: ../../library/venv.rst:264 +#: ../../library/venv.rst:274 msgid "``bin_path`` - The script path for the virtual environment." msgstr "" -#: ../../library/venv.rst:266 +#: ../../library/venv.rst:276 msgid "" "``bin_name`` - The name of the script path relative to the virtual " "environment location. Used for ``__VENV_BIN_NAME__`` in activation scripts " "(see :meth:`install_scripts`)." msgstr "" -#: ../../library/venv.rst:270 +#: ../../library/venv.rst:280 msgid "" "``env_exe`` - The name of the Python interpreter in the virtual environment. " "Used for ``__VENV_PYTHON__`` in activation scripts (see :meth:" "`install_scripts`)." msgstr "" -#: ../../library/venv.rst:274 +#: ../../library/venv.rst:284 msgid "" "``env_exec_cmd`` - The name of the Python interpreter, taking into account " "filesystem redirections. This can be used to run Python in the virtual " "environment." msgstr "" -#: ../../library/venv.rst:279 +#: ../../library/venv.rst:289 msgid "" "The *venv* :ref:`sysconfig installation scheme <installation_paths>` is used " "to construct the paths of the created directories." msgstr "" -#: ../../library/venv.rst:284 +#: ../../library/venv.rst:294 msgid "" "The attribute ``lib_path`` was added to the context, and the context object " "was documented." msgstr "" -#: ../../library/venv.rst:290 +#: ../../library/venv.rst:300 msgid "Creates the ``pyvenv.cfg`` configuration file in the environment." msgstr "" -#: ../../library/venv.rst:294 +#: ../../library/venv.rst:304 msgid "" "Creates a copy or symlink to the Python executable in the environment. On " "POSIX systems, if a specific executable ``python3.x`` was used, symlinks to " @@ -763,48 +788,48 @@ msgid "" "unless files with those names already exist." msgstr "" -#: ../../library/venv.rst:301 +#: ../../library/venv.rst:311 msgid "" "Installs activation scripts appropriate to the platform into the virtual " "environment." msgstr "" -#: ../../library/venv.rst:306 +#: ../../library/venv.rst:316 msgid "" "Upgrades the core venv dependency packages (currently ``pip``) in the " "environment. This is done by shelling out to the ``pip`` executable in the " "environment." msgstr "" -#: ../../library/venv.rst:317 +#: ../../library/venv.rst:327 msgid "" "A placeholder method which can be overridden in third party implementations " "to pre-install packages in the virtual environment or perform other post-" "creation steps." msgstr "" -#: ../../library/venv.rst:321 +#: ../../library/venv.rst:331 msgid "" "Windows now uses redirector scripts for ``python[w].exe`` instead of copying " "the actual binaries. In 3.7.2 only :meth:`setup_python` does nothing unless " "running from a build in the source tree." msgstr "" -#: ../../library/venv.rst:326 +#: ../../library/venv.rst:336 msgid "" "Windows copies the redirector scripts as part of :meth:`setup_python` " "instead of :meth:`setup_scripts`. This was not the case in 3.7.2. When using " "symlinks, the original executables will be linked." msgstr "" -#: ../../library/venv.rst:331 +#: ../../library/venv.rst:341 msgid "" "In addition, :class:`EnvBuilder` provides this utility method that can be " "called from :meth:`setup_scripts` or :meth:`post_setup` in subclasses to " "assist in installing custom scripts into the virtual environment." msgstr "" -#: ../../library/venv.rst:337 +#: ../../library/venv.rst:347 msgid "" "*path* is the path to a directory that should contain subdirectories " "\"common\", \"posix\", \"nt\", each containing scripts destined for the bin " @@ -813,64 +838,70 @@ msgid "" "placeholders:" msgstr "" -#: ../../library/venv.rst:343 +#: ../../library/venv.rst:353 msgid "" "``__VENV_DIR__`` is replaced with the absolute path of the environment " "directory." msgstr "" -#: ../../library/venv.rst:346 +#: ../../library/venv.rst:356 msgid "" "``__VENV_NAME__`` is replaced with the environment name (final path segment " "of environment directory)." msgstr "" -#: ../../library/venv.rst:349 +#: ../../library/venv.rst:359 msgid "" "``__VENV_PROMPT__`` is replaced with the prompt (the environment name " "surrounded by parentheses and with a following space)" msgstr "" -#: ../../library/venv.rst:352 +#: ../../library/venv.rst:362 msgid "" "``__VENV_BIN_NAME__`` is replaced with the name of the bin directory (either " "``bin`` or ``Scripts``)." msgstr "" -#: ../../library/venv.rst:355 +#: ../../library/venv.rst:365 msgid "" "``__VENV_PYTHON__`` is replaced with the absolute path of the environment's " "executable." msgstr "" -#: ../../library/venv.rst:358 +#: ../../library/venv.rst:368 msgid "" "The directories are allowed to exist (for when an existing environment is " "being upgraded)." msgstr "" -#: ../../library/venv.rst:361 +#: ../../library/venv.rst:373 +msgid "" +"Creates a ``.gitignore`` file within the virtual environment that causes the " +"entire directory to be ignored by the ``git`` source control manager." +msgstr "" + +#: ../../library/venv.rst:378 msgid "There is also a module-level convenience function:" msgstr "" -#: ../../library/venv.rst:367 +#: ../../library/venv.rst:384 msgid "" "Create an :class:`EnvBuilder` with the given keyword arguments, and call " "its :meth:`~EnvBuilder.create` method with the *env_dir* argument." msgstr "" -#: ../../library/venv.rst:382 +#: ../../library/venv.rst:402 msgid "An example of extending ``EnvBuilder``" msgstr "" -#: ../../library/venv.rst:384 +#: ../../library/venv.rst:404 msgid "" "The following script shows how to extend :class:`EnvBuilder` by implementing " "a subclass which installs setuptools and pip into a created virtual " "environment::" msgstr "" -#: ../../library/venv.rst:387 +#: ../../library/venv.rst:407 msgid "" "import os\n" "import os.path\n" @@ -1086,7 +1117,7 @@ msgid "" " sys.exit(rc)" msgstr "" -#: ../../library/venv.rst:595 +#: ../../library/venv.rst:615 msgid "" "This script is also available for download `online <https://gist.github.com/" "vsajip/4673395>`_." diff --git a/library/warnings.po b/library/warnings.po index 80ad7756fe..702e2744ea 100644 --- a/library/warnings.po +++ b/library/warnings.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -822,11 +822,72 @@ msgid "" "options and calls to :func:`simplefilter`." msgstr "" -#: ../../library/warnings.rst:526 +#: ../../library/warnings.rst:527 +msgid "Decorator to indicate that a class, function or overload is deprecated." +msgstr "" + +#: ../../library/warnings.rst:529 +msgid "" +"When this decorator is applied to an object, deprecation warnings may be " +"emitted at runtime when the object is used. :term:`static type checkers " +"<static type checker>` will also generate a diagnostic on usage of the " +"deprecated object." +msgstr "" + +#: ../../library/warnings.rst:534 +msgid "Usage::" +msgstr "" + +#: ../../library/warnings.rst:536 +msgid "" +"from warnings import deprecated\n" +"from typing import overload\n" +"\n" +"@deprecated(\"Use B instead\")\n" +"class A:\n" +" pass\n" +"\n" +"@deprecated(\"Use g instead\")\n" +"def f():\n" +" pass\n" +"\n" +"@overload\n" +"@deprecated(\"int support is deprecated\")\n" +"def g(x: int) -> int: ...\n" +"@overload\n" +"def g(x: str) -> int: ..." +msgstr "" + +#: ../../library/warnings.rst:553 +msgid "" +"The warning specified by *category* will be emitted at runtime on use of " +"deprecated objects. For functions, that happens on calls; for classes, on " +"instantiation and on creation of subclasses. If the *category* is ``None``, " +"no warning is emitted at runtime. The *stacklevel* determines where the " +"warning is emitted. If it is ``1`` (the default), the warning is emitted at " +"the direct caller of the deprecated object; if it is higher, it is emitted " +"further up the stack. Static type checker behavior is not affected by the " +"*category* and *stacklevel* arguments." +msgstr "" + +#: ../../library/warnings.rst:564 +msgid "" +"The deprecation message passed to the decorator is saved in the " +"``__deprecated__`` attribute on the decorated object. If applied to an " +"overload, the decorator must be after the :func:`@overload <typing." +"overload>` decorator for the attribute to exist on the overload as returned " +"by :func:`typing.get_overloads`." +msgstr "" + +#: ../../library/warnings.rst:571 +msgid "See :pep:`702`." +msgstr "" + +#: ../../library/warnings.rst:576 msgid "Available Context Managers" msgstr "" -#: ../../library/warnings.rst:530 +#: ../../library/warnings.rst:580 msgid "" "A context manager that copies and, upon exit, restores the warnings filter " "and the :func:`showwarning` function. If the *record* argument is :const:" @@ -837,21 +898,21 @@ msgid "" "has attributes with the same names as the arguments to :func:`showwarning`." msgstr "" -#: ../../library/warnings.rst:539 +#: ../../library/warnings.rst:589 msgid "" "The *module* argument takes a module that will be used instead of the module " "returned when you import :mod:`warnings` whose filter will be protected. " "This argument exists primarily for testing the :mod:`warnings` module itself." msgstr "" -#: ../../library/warnings.rst:544 +#: ../../library/warnings.rst:594 msgid "" "If the *action* argument is not ``None``, the remaining arguments are passed " "to :func:`simplefilter` as if it were called immediately on entering the " "context." msgstr "" -#: ../../library/warnings.rst:550 +#: ../../library/warnings.rst:600 msgid "" "The :class:`catch_warnings` manager works by replacing and then later " "restoring the module's :func:`showwarning` function and internal list of " @@ -859,7 +920,7 @@ msgid "" "state and therefore is not thread-safe." msgstr "" -#: ../../library/warnings.rst:558 +#: ../../library/warnings.rst:608 msgid "Added the *action*, *category*, *lineno*, and *append* parameters." msgstr "新增 *action*、*category*、*lineno* 和 *append* 參數。" diff --git a/library/wave.po b/library/wave.po index 37c5e0856c..d2fee008a9 100644 --- a/library/wave.po +++ b/library/wave.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -105,7 +105,7 @@ msgstr "" ":func:`.open` 函式可以在 :keyword:`with` 陳述式中使用。當 :keyword:`!with` 區" "塊完成時,會呼叫 :meth:`Wave_read.close` 或是 :meth:`Wave_write.close` 方法。" -#: ../../library/wave.rst:52 ../../library/wave.rst:176 +#: ../../library/wave.rst:52 ../../library/wave.rst:184 msgid "Added support for unseekable files." msgstr "增加對不可搜尋 (unseekable) 檔案的支援。" @@ -181,20 +181,28 @@ msgid "Rewind the file pointer to the beginning of the audio stream." msgstr "重置檔案指標至音訊流的開頭。" #: ../../library/wave.rst:126 +#, fuzzy msgid "" -"The following two methods are defined for compatibility with the :mod:`aifc` " -"module, and don't do anything interesting." +"The following two methods are defined for compatibility with the old :mod:`!" +"aifc` module, and don't do anything interesting." msgstr "以下兩個方法是為了與 :mod:`aifc` 模組的保持相容性,並不執行任何操作。" #: ../../library/wave.rst:132 msgid "Returns ``None``." msgstr "回傳 ``None``。" -#: ../../library/wave.rst:137 +#: ../../library/wave.rst:134 ../../library/wave.rst:143 +#, fuzzy +msgid "" +"The method only existed for compatibility with the :mod:`!aifc` module which " +"has been removed in Python 3.13." +msgstr "以下兩個方法是為了與 :mod:`aifc` 模組的保持相容性,並不執行任何操作。" + +#: ../../library/wave.rst:141 msgid "Raise an error." msgstr "引發錯誤。" -#: ../../library/wave.rst:139 +#: ../../library/wave.rst:147 msgid "" "The following two methods define a term \"position\" which is compatible " "between them, and is otherwise implementation dependent." @@ -202,27 +210,27 @@ msgstr "" "以下兩個方法所定義的「位置」,在它們之間是相容的,但其他情況下則取決於具體實" "作方式。" -#: ../../library/wave.rst:145 +#: ../../library/wave.rst:153 msgid "Set the file pointer to the specified position." msgstr "將檔案指標設定為指定的位置。" -#: ../../library/wave.rst:150 +#: ../../library/wave.rst:158 msgid "Return current file pointer position." msgstr "回傳目前的檔案指標位置。" -#: ../../library/wave.rst:156 +#: ../../library/wave.rst:164 msgid "Wave_write Objects" msgstr "Wave_write 物件" -#: ../../library/wave.rst:160 +#: ../../library/wave.rst:168 msgid "Write a WAV file." msgstr "寫入一個 WAV 檔案。" -#: ../../library/wave.rst:162 +#: ../../library/wave.rst:170 msgid "Wave_write objects, as returned by :func:`.open`." msgstr "Wave_write 物件,由 :func:`.open` 回傳。" -#: ../../library/wave.rst:164 +#: ../../library/wave.rst:172 msgid "" "For seekable output streams, the ``wave`` header will automatically be " "updated to reflect the number of frames actually written. For unseekable " @@ -243,11 +251,11 @@ msgstr "" "次性寫入所有的幀資料。在後一種情況下,:meth:`writeframes` 方法將計算資料中的" "幀數量,並在寫入幀資料之前相應地設定 *nframes* 的值。" -#: ../../library/wave.rst:179 +#: ../../library/wave.rst:187 msgid "Wave_write objects have the following methods:" msgstr "Wave_write 物件具有以下方法:" -#: ../../library/wave.rst:183 +#: ../../library/wave.rst:191 msgid "" "Make sure *nframes* is correct, and close the file if it was opened by :mod:" "`wave`. This method is called upon object collection. It will raise an " @@ -258,23 +266,23 @@ msgstr "" "在物件回收時被呼叫。如果輸出串流不可搜尋且 *nframes* 不符合實際寫入的幀數,則" "會引發例外。" -#: ../../library/wave.rst:191 +#: ../../library/wave.rst:199 msgid "Set the number of channels." msgstr "設定音訊的通道數量。" -#: ../../library/wave.rst:196 +#: ../../library/wave.rst:204 msgid "Set the sample width to *n* bytes." msgstr "設定取樣寬度為 *n* 個位元組。" -#: ../../library/wave.rst:201 +#: ../../library/wave.rst:209 msgid "Set the frame rate to *n*." msgstr "設定取樣頻率為 *n*。" -#: ../../library/wave.rst:203 +#: ../../library/wave.rst:211 msgid "A non-integral input to this method is rounded to the nearest integer." msgstr "此方法的非整數輸入會被將四捨五入到最接近的整數。" -#: ../../library/wave.rst:210 +#: ../../library/wave.rst:218 msgid "" "Set the number of frames to *n*. This will be changed later if the number " "of frames actually written is different (this update attempt will raise an " @@ -283,13 +291,13 @@ msgstr "" "設定幀數為 *n*。如果實際寫入的幀數不同,則稍後將進行更改(如果輸出串流不可搜" "尋,則此嘗試將引發錯誤)。" -#: ../../library/wave.rst:217 +#: ../../library/wave.rst:225 msgid "" "Set the compression type and description. At the moment, only compression " "type ``NONE`` is supported, meaning no compression." msgstr "設定壓縮類型和描述。目前只支援壓縮類型為 ``NONE``,表示無壓縮。" -#: ../../library/wave.rst:223 +#: ../../library/wave.rst:231 msgid "" "The *tuple* should be ``(nchannels, sampwidth, framerate, nframes, comptype, " "compname)``, with values valid for the ``set*()`` methods. Sets all " @@ -298,7 +306,7 @@ msgstr "" "這個 *tuple* 應該是 ``(nchannels, sampwidth, framerate, nframes, comptype, " "compname)``,值需要是符合 ``set*()`` 方法的參數。設定所有參數。" -#: ../../library/wave.rst:230 +#: ../../library/wave.rst:238 msgid "" "Return current position in the file, with the same disclaimer for the :meth:" "`Wave_read.tell` and :meth:`Wave_read.setpos` methods." @@ -306,15 +314,15 @@ msgstr "" "回傳檔案中的指標位置,其指標位置含意與 :meth:`Wave_read.tell` 和 :meth:" "`Wave_read.setpos` 是一致的。" -#: ../../library/wave.rst:236 +#: ../../library/wave.rst:244 msgid "Write audio frames, without correcting *nframes*." msgstr "寫入音訊幀,不修正 *nframes*。" -#: ../../library/wave.rst:238 ../../library/wave.rst:249 +#: ../../library/wave.rst:246 ../../library/wave.rst:257 msgid "Any :term:`bytes-like object` is now accepted." msgstr "現在可接受任何 :term:`bytes-like object`。" -#: ../../library/wave.rst:244 +#: ../../library/wave.rst:252 msgid "" "Write audio frames and make sure *nframes* is correct. It will raise an " "error if the output stream is not seekable and the total number of frames " @@ -324,7 +332,7 @@ msgstr "" "寫入音訊幀並確保 *nframes* 正確。如果輸出串流不可搜尋,並且在寫入 *data* 後已" "寫入的總幀數與先前設定的 *nframes* 值不符,則會引發錯誤。" -#: ../../library/wave.rst:252 +#: ../../library/wave.rst:260 msgid "" "Note that it is invalid to set any parameters after calling :meth:" "`writeframes` or :meth:`writeframesraw`, and any attempt to do so will " diff --git a/library/webbrowser.po b/library/webbrowser.po index 08cb5281b3..58e216d74c 100644 --- a/library/webbrowser.po +++ b/library/webbrowser.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -62,43 +62,64 @@ msgstr "" #: ../../library/webbrowser.rst:36 msgid "" +"On iOS, the :envvar:`BROWSER` environment variable, as well as any arguments " +"controlling autoraise, browser preference, and new tab/window creation will " +"be ignored. Web pages will *always* be opened in the user's preferred " +"browser, in a new tab, with the browser being brought to the foreground. The " +"use of the :mod:`webbrowser` module on iOS requires the :mod:`ctypes` " +"module. If :mod:`ctypes` isn't available, calls to :func:`.open` will fail." +msgstr "" + +#: ../../library/webbrowser.rst:43 +msgid "" "The script :program:`webbrowser` can be used as a command-line interface for " "the module. It accepts a URL as the argument. It accepts the following " -"optional parameters: ``-n`` opens the URL in a new browser window, if " -"possible; ``-t`` opens the URL in a new browser page (\"tab\"). The options " -"are, naturally, mutually exclusive. Usage example::" +"optional parameters:" +msgstr "" + +#: ../../library/webbrowser.rst:47 +msgid "" +"``-n``/``--new-window`` opens the URL in a new browser window, if possible." msgstr "" -#: ../../library/webbrowser.rst:42 +#: ../../library/webbrowser.rst:48 +msgid "``-t``/``--new-tab`` opens the URL in a new browser page (\"tab\")." +msgstr "" + +#: ../../library/webbrowser.rst:50 +msgid "The options are, naturally, mutually exclusive. Usage example::" +msgstr "" + +#: ../../library/webbrowser.rst:52 msgid "python -m webbrowser -t \"https://www.python.org/"" msgstr "python -m webbrowser -t \"https://www.python.org/"" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability <availability>`: not Emscripten, not WASI." +msgid ":ref:`Availability <availability>`: not WASI." msgstr "" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" -#: ../../library/webbrowser.rst:46 +#: ../../library/webbrowser.rst:56 msgid "The following exception is defined:" msgstr "" -#: ../../library/webbrowser.rst:51 +#: ../../library/webbrowser.rst:61 msgid "Exception raised when a browser control error occurs." msgstr "" -#: ../../library/webbrowser.rst:53 +#: ../../library/webbrowser.rst:63 msgid "The following functions are defined:" msgstr "" -#: ../../library/webbrowser.rst:58 +#: ../../library/webbrowser.rst:68 msgid "" "Display *url* using the default browser. If *new* is 0, the *url* is opened " "in the same browser window if possible. If *new* is 1, a new browser window " @@ -108,20 +129,20 @@ msgid "" "the setting of this variable)." msgstr "" -#: ../../library/webbrowser.rst:65 ../../library/webbrowser.rst:79 -#: ../../library/webbrowser.rst:87 +#: ../../library/webbrowser.rst:75 ../../library/webbrowser.rst:89 +#: ../../library/webbrowser.rst:97 msgid "" "Returns ``True`` if a browser was successfully launched, ``False`` otherwise." msgstr "" -#: ../../library/webbrowser.rst:67 +#: ../../library/webbrowser.rst:77 msgid "" "Note that on some platforms, trying to open a filename using this function, " "may work and start the operating system's associated program. However, this " "is neither supported nor portable." msgstr "" -#: ../../library/webbrowser.rst:71 +#: ../../library/webbrowser.rst:81 msgid "" "Raises an :ref:`auditing event <auditing>` ``webbrowser.open`` with argument " "``url``." @@ -129,26 +150,26 @@ msgstr "" "引發一個附帶引數 ``url`` 的\\ :ref:`稽核事件 <auditing>` ``webbrowser." "open``。" -#: ../../library/webbrowser.rst:76 +#: ../../library/webbrowser.rst:86 msgid "" "Open *url* in a new window of the default browser, if possible, otherwise, " "open *url* in the only browser window." msgstr "" -#: ../../library/webbrowser.rst:84 +#: ../../library/webbrowser.rst:94 msgid "" "Open *url* in a new page (\"tab\") of the default browser, if possible, " "otherwise equivalent to :func:`open_new`." msgstr "" -#: ../../library/webbrowser.rst:92 +#: ../../library/webbrowser.rst:102 msgid "" "Return a controller object for the browser type *using*. If *using* is " "``None``, return a controller for a default browser appropriate to the " "caller's environment." msgstr "" -#: ../../library/webbrowser.rst:99 +#: ../../library/webbrowser.rst:109 msgid "" "Register the browser type *name*. Once a browser type is registered, the :" "func:`get` function can return a controller for that browser type. If " @@ -157,7 +178,7 @@ msgid "" "provided, *constructor* will never be called, and may be ``None``." msgstr "" -#: ../../library/webbrowser.rst:105 +#: ../../library/webbrowser.rst:115 msgid "" "Setting *preferred* to ``True`` makes this browser a preferred result for a :" "func:`get` call with no argument. Otherwise, this entry point is only " @@ -166,217 +187,240 @@ msgid "" "declare." msgstr "" -#: ../../library/webbrowser.rst:111 +#: ../../library/webbrowser.rst:121 msgid "*preferred* keyword-only parameter was added." msgstr "" -#: ../../library/webbrowser.rst:114 +#: ../../library/webbrowser.rst:124 msgid "" "A number of browser types are predefined. This table gives the type names " "that may be passed to the :func:`get` function and the corresponding " "instantiations for the controller classes, all defined in this module." msgstr "" -#: ../../library/webbrowser.rst:119 +#: ../../library/webbrowser.rst:129 msgid "Type Name" msgstr "" -#: ../../library/webbrowser.rst:119 +#: ../../library/webbrowser.rst:129 msgid "Class Name" msgstr "" -#: ../../library/webbrowser.rst:119 +#: ../../library/webbrowser.rst:129 msgid "Notes" msgstr "註解" -#: ../../library/webbrowser.rst:121 +#: ../../library/webbrowser.rst:131 msgid "``'mozilla'``" msgstr "``'mozilla'``" -#: ../../library/webbrowser.rst:121 ../../library/webbrowser.rst:123 -msgid ":class:`Mozilla('mozilla')`" -msgstr ":class:`Mozilla('mozilla')`" +#: ../../library/webbrowser.rst:131 ../../library/webbrowser.rst:133 +msgid "``Mozilla('mozilla')``" +msgstr "``Mozilla('mozilla')``" -#: ../../library/webbrowser.rst:123 +#: ../../library/webbrowser.rst:133 msgid "``'firefox'``" msgstr "``'firefox'``" -#: ../../library/webbrowser.rst:125 +#: ../../library/webbrowser.rst:135 msgid "``'epiphany'``" msgstr "``'epiphany'``" -#: ../../library/webbrowser.rst:125 -msgid ":class:`Epiphany('epiphany')`" -msgstr ":class:`Epiphany('epiphany')`" +#: ../../library/webbrowser.rst:135 +msgid "``Epiphany('epiphany')``" +msgstr "``Epiphany('epiphany')``" -#: ../../library/webbrowser.rst:127 +#: ../../library/webbrowser.rst:137 msgid "``'kfmclient'``" msgstr "``'kfmclient'``" -#: ../../library/webbrowser.rst:127 ../../library/webbrowser.rst:129 -#: ../../library/webbrowser.rst:131 -msgid ":class:`Konqueror()`" -msgstr ":class:`Konqueror()`" +#: ../../library/webbrowser.rst:137 ../../library/webbrowser.rst:139 +#: ../../library/webbrowser.rst:141 +msgid "``Konqueror()``" +msgstr "``Konqueror()``" -#: ../../library/webbrowser.rst:127 ../../library/webbrowser.rst:129 -#: ../../library/webbrowser.rst:131 +#: ../../library/webbrowser.rst:137 ../../library/webbrowser.rst:139 +#: ../../library/webbrowser.rst:141 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/webbrowser.rst:129 +#: ../../library/webbrowser.rst:139 msgid "``'konqueror'``" msgstr "``'konqueror'``" -#: ../../library/webbrowser.rst:131 +#: ../../library/webbrowser.rst:141 msgid "``'kfm'``" msgstr "``'kfm'``" -#: ../../library/webbrowser.rst:133 +#: ../../library/webbrowser.rst:143 msgid "``'opera'``" msgstr "``'opera'``" -#: ../../library/webbrowser.rst:133 -msgid ":class:`Opera()`" -msgstr ":class:`Opera()`" +#: ../../library/webbrowser.rst:143 +msgid "``Opera()``" +msgstr "``Opera()``" -#: ../../library/webbrowser.rst:135 +#: ../../library/webbrowser.rst:145 msgid "``'links'``" msgstr "``'links'``" -#: ../../library/webbrowser.rst:135 -msgid ":class:`GenericBrowser('links')`" -msgstr ":class:`GenericBrowser('links')`" +#: ../../library/webbrowser.rst:145 +msgid "``GenericBrowser('links')``" +msgstr "``GenericBrowser('links')``" -#: ../../library/webbrowser.rst:137 +#: ../../library/webbrowser.rst:147 msgid "``'elinks'``" msgstr "``'elinks'``" -#: ../../library/webbrowser.rst:137 -msgid ":class:`Elinks('elinks')`" -msgstr ":class:`Elinks('elinks')`" +#: ../../library/webbrowser.rst:147 +msgid "``Elinks('elinks')``" +msgstr "``Elinks('elinks')``" -#: ../../library/webbrowser.rst:139 +#: ../../library/webbrowser.rst:149 msgid "``'lynx'``" msgstr "``'lynx'``" -#: ../../library/webbrowser.rst:139 -msgid ":class:`GenericBrowser('lynx')`" -msgstr ":class:`GenericBrowser('lynx')`" +#: ../../library/webbrowser.rst:149 +msgid "``GenericBrowser('lynx')``" +msgstr "``GenericBrowser('lynx')``" -#: ../../library/webbrowser.rst:141 +#: ../../library/webbrowser.rst:151 msgid "``'w3m'``" msgstr "``'w3m'``" -#: ../../library/webbrowser.rst:141 -msgid ":class:`GenericBrowser('w3m')`" -msgstr ":class:`GenericBrowser('w3m')`" +#: ../../library/webbrowser.rst:151 +msgid "``GenericBrowser('w3m')``" +msgstr "``GenericBrowser('w3m')``" -#: ../../library/webbrowser.rst:143 +#: ../../library/webbrowser.rst:153 msgid "``'windows-default'``" msgstr "``'windows-default'``" -#: ../../library/webbrowser.rst:143 -msgid ":class:`WindowsDefault`" -msgstr ":class:`WindowsDefault`" +#: ../../library/webbrowser.rst:153 +msgid "``WindowsDefault``" +msgstr "``WindowsDefault``" -#: ../../library/webbrowser.rst:143 +#: ../../library/webbrowser.rst:153 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/webbrowser.rst:145 +#: ../../library/webbrowser.rst:155 msgid "``'macosx'``" msgstr "``'macosx'``" -#: ../../library/webbrowser.rst:145 -msgid ":class:`MacOSXOSAScript('default')`" -msgstr ":class:`MacOSXOSAScript('default')`" +#: ../../library/webbrowser.rst:155 +msgid "``MacOSXOSAScript('default')``" +msgstr "``MacOSXOSAScript('default')``" -#: ../../library/webbrowser.rst:145 ../../library/webbrowser.rst:147 +#: ../../library/webbrowser.rst:155 ../../library/webbrowser.rst:157 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/webbrowser.rst:147 +#: ../../library/webbrowser.rst:157 msgid "``'safari'``" msgstr "``'safari'``" -#: ../../library/webbrowser.rst:147 -msgid ":class:`MacOSXOSAScript('safari')`" -msgstr ":class:`MacOSXOSAScript('safari')`" +#: ../../library/webbrowser.rst:157 +msgid "``MacOSXOSAScript('safari')``" +msgstr "``MacOSXOSAScript('safari')``" -#: ../../library/webbrowser.rst:149 +#: ../../library/webbrowser.rst:159 msgid "``'google-chrome'``" msgstr "``'google-chrome'``" -#: ../../library/webbrowser.rst:149 -msgid ":class:`Chrome('google-chrome')`" -msgstr ":class:`Chrome('google-chrome')`" +#: ../../library/webbrowser.rst:159 +msgid "``Chrome('google-chrome')``" +msgstr "``Chrome('google-chrome')``" -#: ../../library/webbrowser.rst:151 +#: ../../library/webbrowser.rst:161 msgid "``'chrome'``" msgstr "``'chrome'``" -#: ../../library/webbrowser.rst:151 -msgid ":class:`Chrome('chrome')`" -msgstr ":class:`Chrome('chrome')`" +#: ../../library/webbrowser.rst:161 +msgid "``Chrome('chrome')``" +msgstr "``Chrome('chrome')``" -#: ../../library/webbrowser.rst:153 +#: ../../library/webbrowser.rst:163 msgid "``'chromium'``" msgstr "``'chromium'``" -#: ../../library/webbrowser.rst:153 -msgid ":class:`Chromium('chromium')`" -msgstr ":class:`Chromium('chromium')`" +#: ../../library/webbrowser.rst:163 +msgid "``Chromium('chromium')``" +msgstr "``Chromium('chromium')``" -#: ../../library/webbrowser.rst:155 +#: ../../library/webbrowser.rst:165 msgid "``'chromium-browser'``" msgstr "``'chromium-browser'``" -#: ../../library/webbrowser.rst:155 -msgid ":class:`Chromium('chromium-browser')`" -msgstr ":class:`Chromium('chromium-browser')`" +#: ../../library/webbrowser.rst:165 +msgid "``Chromium('chromium-browser')``" +msgstr "``Chromium('chromium-browser')``" + +#: ../../library/webbrowser.rst:167 +msgid "``'iosbrowser'``" +msgstr "``'iosbrowser'``" -#: ../../library/webbrowser.rst:158 +#: ../../library/webbrowser.rst:167 +msgid "``IOSBrowser``" +msgstr "" + +#: ../../library/webbrowser.rst:167 +msgid "\\(4)" +msgstr "" + +#: ../../library/webbrowser.rst:170 msgid "Notes:" msgstr "註解:" -#: ../../library/webbrowser.rst:161 +#: ../../library/webbrowser.rst:173 msgid "" "\"Konqueror\" is the file manager for the KDE desktop environment for Unix, " "and only makes sense to use if KDE is running. Some way of reliably " -"detecting KDE would be nice; the :envvar:`KDEDIR` variable is not " +"detecting KDE would be nice; the :envvar:`!KDEDIR` variable is not " "sufficient. Note also that the name \"kfm\" is used even when using the :" "program:`konqueror` command with KDE 2 --- the implementation selects the " "best strategy for running Konqueror." msgstr "" -#: ../../library/webbrowser.rst:168 +#: ../../library/webbrowser.rst:180 msgid "Only on Windows platforms." msgstr "" -#: ../../library/webbrowser.rst:171 -msgid "Only on macOS platform." +#: ../../library/webbrowser.rst:183 +msgid "Only on macOS." msgstr "" -#: ../../library/webbrowser.rst:173 +#: ../../library/webbrowser.rst:186 +msgid "Only on iOS." +msgstr "" + +#: ../../library/webbrowser.rst:188 +msgid "" +"A new :class:`!MacOSXOSAScript` class has been added and is used on Mac " +"instead of the previous :class:`!MacOSX` class. This adds support for " +"opening browsers not currently set as the OS default." +msgstr "" + +#: ../../library/webbrowser.rst:193 msgid "Support for Chrome/Chromium has been added." msgstr "" -#: ../../library/webbrowser.rst:176 +#: ../../library/webbrowser.rst:196 msgid "" "Support for several obsolete browsers has been removed. Removed browsers " "include Grail, Mosaic, Netscape, Galeon, Skipstone, Iceape, and Firefox " "versions 35 and below." msgstr "" -#: ../../library/webbrowser.rst:181 -msgid ":class:`MacOSX` is deprecated, use :class:`MacOSXOSAScript` instead." +#: ../../library/webbrowser.rst:201 +msgid "Support for iOS has been added." msgstr "" -#: ../../library/webbrowser.rst:184 +#: ../../library/webbrowser.rst:204 msgid "Here are some simple examples::" msgstr "以下是一些簡單範例: ::" -#: ../../library/webbrowser.rst:186 +#: ../../library/webbrowser.rst:206 msgid "" "url = 'https://docs.python.org/'\n" "\n" @@ -387,46 +431,55 @@ msgid "" "webbrowser.open_new(url)" msgstr "" -#: ../../library/webbrowser.rst:198 +#: ../../library/webbrowser.rst:218 msgid "Browser Controller Objects" msgstr "" -#: ../../library/webbrowser.rst:200 +#: ../../library/webbrowser.rst:220 msgid "" "Browser controllers provide these methods which parallel three of the module-" "level convenience functions:" msgstr "" -#: ../../library/webbrowser.rst:206 +#: ../../library/webbrowser.rst:226 msgid "System-dependent name for the browser." msgstr "" -#: ../../library/webbrowser.rst:211 +#: ../../library/webbrowser.rst:231 msgid "" "Display *url* using the browser handled by this controller. If *new* is 1, a " "new browser window is opened if possible. If *new* is 2, a new browser page " "(\"tab\") is opened if possible." msgstr "" -#: ../../library/webbrowser.rst:218 +#: ../../library/webbrowser.rst:238 msgid "" "Open *url* in a new window of the browser handled by this controller, if " "possible, otherwise, open *url* in the only browser window. Alias :func:" "`open_new`." msgstr "" -#: ../../library/webbrowser.rst:225 +#: ../../library/webbrowser.rst:245 msgid "" "Open *url* in a new page (\"tab\") of the browser handled by this " "controller, if possible, otherwise equivalent to :func:`open_new`." msgstr "" -#: ../../library/webbrowser.rst:230 +#: ../../library/webbrowser.rst:250 msgid "Footnotes" msgstr "註解" -#: ../../library/webbrowser.rst:231 +#: ../../library/webbrowser.rst:251 msgid "" "Executables named here without a full path will be searched in the " "directories given in the :envvar:`PATH` environment variable." msgstr "" + +#~ msgid ":class:`Konqueror()`" +#~ msgstr ":class:`Konqueror()`" + +#~ msgid ":class:`Opera()`" +#~ msgstr ":class:`Opera()`" + +#~ msgid ":class:`WindowsDefault`" +#~ msgstr ":class:`WindowsDefault`" diff --git a/library/wsgiref.po b/library/wsgiref.po index 4cbbe03d50..364b60b0a9 100644 --- a/library/wsgiref.po +++ b/library/wsgiref.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-12-09 21:29+0800\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1207,9 +1207,10 @@ msgid "" msgstr "這個模組提供在 :pep:`3333` 中所描述的各種用於靜態型別檢查的型別。" #: ../../library/wsgiref.rst:786 +#, fuzzy msgid "" -"A :class:`typing.Protocol` describing :pep:`start_response() <3333#the-start-" -"response-callable>` callables (:pep:`3333`)." +"A :class:`typing.Protocol` describing `start_response() <https://peps.python." +"org/pep-3333/#the-start-response-callable>`_ callables (:pep:`3333`)." msgstr "" "一個描述 :pep:`start_response() <3333#the-start-response-callable>` 可呼叫物" "件的 :class:`typing.Protocol` (:pep:`3333`)。" @@ -1223,26 +1224,29 @@ msgid "A type alias describing a WSGI application callable." msgstr "一個描述 WSGI 應用程式可呼叫物件的型別別名。" #: ../../library/wsgiref.rst:800 +#, fuzzy msgid "" -"A :class:`typing.Protocol` describing a :pep:`WSGI Input Stream <3333#input-" -"and-error-streams>`." +"A :class:`typing.Protocol` describing a `WSGI Input Stream <https://peps." +"python.org/pep-3333/#input-and-error-streams>`_." msgstr "" "一個描述 :pep:`WSGI 輸入串流 <3333#input-and-error-streams>`\\ 的 :class:" "`typing.Protocol`。" #: ../../library/wsgiref.rst:805 +#, fuzzy msgid "" -"A :class:`typing.Protocol` describing a :pep:`WSGI Error Stream <3333#input-" -"and-error-streams>`." +"A :class:`typing.Protocol` describing a `WSGI Error Stream <https://peps." +"python.org/pep-3333/#input-and-error-streams>`_." msgstr "" "一個描述 :pep:`WSGI 錯誤串流 <3333#input-and-error-streams>`\\ 的 :class:" "`typing.Protocol`。" #: ../../library/wsgiref.rst:810 +#, fuzzy msgid "" -"A :class:`typing.Protocol` describing a :pep:`file wrapper <3333#optional-" -"platform-specific-file-handling>`. See :class:`wsgiref.util.FileWrapper` for " -"a concrete implementation of this protocol." +"A :class:`typing.Protocol` describing a `file wrapper <https://peps.python." +"org/pep-3333/#optional-platform-specific-file-handling>`_. See :class:" +"`wsgiref.util.FileWrapper` for a concrete implementation of this protocol." msgstr "" "一個描述\\ :pep:`檔案包裝器 <3333#optional-platform-specific-file-" "handling>`\\ 的 :class:`typing.Protocol`。請參閱 :class:`wsgiref.util." @@ -1312,7 +1316,7 @@ msgid "" " fn = os.path.join(path, environ[\"PATH_INFO\"][1:])\n" " if \".\" not in fn.split(os.path.sep)[-1]:\n" " fn = os.path.join(fn, \"index.html\")\n" -" mime_type = mimetypes.guess_type(fn)[0]\n" +" mime_type = mimetypes.guess_file_type(fn)[0]\n" "\n" " # Return 200 OK if file exists, otherwise 404 Not Found\n" " if os.path.exists(fn):\n" diff --git a/library/xml.etree.elementtree.po b/library/xml.etree.elementtree.po index f13b797352..cb631dab21 100644 --- a/library/xml.etree.elementtree.po +++ b/library/xml.etree.elementtree.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-21 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -670,7 +670,7 @@ msgid "" msgstr "" #: ../../library/xml.etree.elementtree.rst:383 -#: ../../library/xml.etree.elementtree.rst:777 +#: ../../library/xml.etree.elementtree.rst:782 msgid "Example" msgstr "範例" @@ -884,12 +884,12 @@ msgid "" msgstr "" #: ../../library/xml.etree.elementtree.rst:499 -#: ../../library/xml.etree.elementtree.rst:829 +#: ../../library/xml.etree.elementtree.rst:834 msgid "Reference" msgstr "" #: ../../library/xml.etree.elementtree.rst:504 -#: ../../library/xml.etree.elementtree.rst:834 +#: ../../library/xml.etree.elementtree.rst:839 msgid "Functions" msgstr "函式" @@ -1076,10 +1076,11 @@ msgid "" "the default :class:`TreeBuilder` as a target. Returns an :term:`iterator` " "providing ``(event, elem)`` pairs; it has a ``root`` attribute that " "references the root element of the resulting XML tree once *source* is fully " -"read." +"read. The iterator has the :meth:`!close` method that closes the internal " +"file object if *source* is a filename." msgstr "" -#: ../../library/xml.etree.elementtree.rst:634 +#: ../../library/xml.etree.elementtree.rst:636 msgid "" "Note that while :func:`iterparse` builds the tree incrementally, it issues " "blocking reads on *source* (or the file it names). As such, it's unsuitable " @@ -1087,7 +1088,7 @@ msgid "" "parsing, see :class:`XMLPullParser`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:641 +#: ../../library/xml.etree.elementtree.rst:643 msgid "" ":func:`iterparse` only guarantees that it has seen the \">\" character of a " "starting tag when it emits a \"start\" event, so the attributes are defined, " @@ -1096,21 +1097,25 @@ msgid "" "present." msgstr "" -#: ../../library/xml.etree.elementtree.rst:647 -#: ../../library/xml.etree.elementtree.rst:1517 +#: ../../library/xml.etree.elementtree.rst:649 +#: ../../library/xml.etree.elementtree.rst:1522 msgid "If you need a fully populated element, look for \"end\" events instead." msgstr "" -#: ../../library/xml.etree.elementtree.rst:649 +#: ../../library/xml.etree.elementtree.rst:651 msgid "The *parser* argument." msgstr "*parser* 引數。" -#: ../../library/xml.etree.elementtree.rst:652 -#: ../../library/xml.etree.elementtree.rst:1521 +#: ../../library/xml.etree.elementtree.rst:654 +#: ../../library/xml.etree.elementtree.rst:1526 msgid "The ``comment`` and ``pi`` events were added." msgstr "新增 *context* 與 *check_hostname* 事件。" -#: ../../library/xml.etree.elementtree.rst:658 +#: ../../library/xml.etree.elementtree.rst:657 +msgid "Added the :meth:`!close` method." +msgstr "" + +#: ../../library/xml.etree.elementtree.rst:663 msgid "" "Parses an XML section into an element tree. *source* is a filename or file " "object containing XML data. *parser* is an optional parser instance. If " @@ -1118,7 +1123,7 @@ msgid "" "class:`ElementTree` instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:666 +#: ../../library/xml.etree.elementtree.rst:671 msgid "" "PI element factory. This factory function creates a special element that " "will be serialized as an XML processing instruction. *target* is a string " @@ -1126,7 +1131,7 @@ msgid "" "given. Returns an element instance, representing a processing instruction." msgstr "" -#: ../../library/xml.etree.elementtree.rst:671 +#: ../../library/xml.etree.elementtree.rst:676 msgid "" "Note that :class:`XMLParser` skips over processing instructions in the input " "instead of creating PI objects for them. An :class:`ElementTree` will only " @@ -1134,7 +1139,7 @@ msgid "" "tree using one of the :class:`Element` methods." msgstr "" -#: ../../library/xml.etree.elementtree.rst:679 +#: ../../library/xml.etree.elementtree.rst:684 msgid "" "Registers a namespace prefix. The registry is global, and any existing " "mapping for either the given prefix or the namespace URI will be removed. " @@ -1143,13 +1148,13 @@ msgid "" "all possible." msgstr "" -#: ../../library/xml.etree.elementtree.rst:690 +#: ../../library/xml.etree.elementtree.rst:695 msgid "" "Subelement factory. This function creates an element instance, and appends " "it to an existing element." msgstr "" -#: ../../library/xml.etree.elementtree.rst:693 +#: ../../library/xml.etree.elementtree.rst:698 msgid "" "The element name, attribute names, and attribute values can be either " "bytestrings or Unicode strings. *parent* is the parent element. *tag* is " @@ -1158,7 +1163,7 @@ msgid "" "arguments. Returns an element instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:704 +#: ../../library/xml.etree.elementtree.rst:709 msgid "" "Generates a string representation of an XML element, including all " "subelements. *element* is an :class:`Element` instance. *encoding* [1]_ is " @@ -1170,24 +1175,24 @@ msgid "" "Returns an (optionally) encoded string containing the XML data." msgstr "" -#: ../../library/xml.etree.elementtree.rst:713 -#: ../../library/xml.etree.elementtree.rst:740 -#: ../../library/xml.etree.elementtree.rst:1194 +#: ../../library/xml.etree.elementtree.rst:718 +#: ../../library/xml.etree.elementtree.rst:745 +#: ../../library/xml.etree.elementtree.rst:1199 msgid "Added the *short_empty_elements* parameter." msgstr "新增 *short_empty_elements* 參數。" -#: ../../library/xml.etree.elementtree.rst:716 -#: ../../library/xml.etree.elementtree.rst:743 +#: ../../library/xml.etree.elementtree.rst:721 +#: ../../library/xml.etree.elementtree.rst:748 msgid "Added the *xml_declaration* and *default_namespace* parameters." msgstr "新增 *xml_declaration* 與 *default_namespace* 參數。" -#: ../../library/xml.etree.elementtree.rst:719 +#: ../../library/xml.etree.elementtree.rst:724 msgid "" "The :func:`tostring` function now preserves the attribute order specified by " "the user." msgstr "" -#: ../../library/xml.etree.elementtree.rst:728 +#: ../../library/xml.etree.elementtree.rst:733 msgid "" "Generates a string representation of an XML element, including all " "subelements. *element* is an :class:`Element` instance. *encoding* [1]_ is " @@ -1201,13 +1206,13 @@ msgid "" "join(tostringlist(element)) == tostring(element)``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:746 +#: ../../library/xml.etree.elementtree.rst:751 msgid "" "The :func:`tostringlist` function now preserves the attribute order " "specified by the user." msgstr "" -#: ../../library/xml.etree.elementtree.rst:753 +#: ../../library/xml.etree.elementtree.rst:758 msgid "" "Parses an XML section from a string constant. This function can be used to " "embed \"XML literals\" in Python code. *text* is a string containing XML " @@ -1215,7 +1220,7 @@ msgid "" "class:`XMLParser` parser is used. Returns an :class:`Element` instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:761 +#: ../../library/xml.etree.elementtree.rst:766 msgid "" "Parses an XML section from a string constant, and also returns a dictionary " "which maps from element id:s to elements. *text* is a string containing XML " @@ -1224,11 +1229,11 @@ msgid "" "`Element` instance and a dictionary." msgstr "" -#: ../../library/xml.etree.elementtree.rst:771 +#: ../../library/xml.etree.elementtree.rst:776 msgid "XInclude support" msgstr "" -#: ../../library/xml.etree.elementtree.rst:773 +#: ../../library/xml.etree.elementtree.rst:778 msgid "" "This module provides limited support for `XInclude directives <https://www." "w3.org/TR/xinclude/>`_, via the :mod:`xml.etree.ElementInclude` helper " @@ -1236,7 +1241,7 @@ msgid "" "element trees, based on information in the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:779 +#: ../../library/xml.etree.elementtree.rst:784 msgid "" "Here's an example that demonstrates use of the XInclude module. To include " "an XML document in the current document, use the ``{http://www.w3.org/2001/" @@ -1244,7 +1249,7 @@ msgid "" "and use the **href** attribute to specify the document to include." msgstr "" -#: ../../library/xml.etree.elementtree.rst:781 +#: ../../library/xml.etree.elementtree.rst:786 msgid "" "<?xml version=\"1.0\"?>\n" "<document xmlns:xi=\"http://www.w3.org/2001/XInclude/">\n" @@ -1256,20 +1261,20 @@ msgstr "" " <xi:include href=\"source.xml\" parse=\"xml\" />\n" "</document>" -#: ../../library/xml.etree.elementtree.rst:788 +#: ../../library/xml.etree.elementtree.rst:793 msgid "" "By default, the **href** attribute is treated as a file name. You can use " "custom loaders to override this behaviour. Also note that the standard " "helper does not support XPointer syntax." msgstr "" -#: ../../library/xml.etree.elementtree.rst:790 +#: ../../library/xml.etree.elementtree.rst:795 msgid "" "To process this file, load it as usual, and pass the root element to the :" "mod:`xml.etree.ElementTree` module:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:792 +#: ../../library/xml.etree.elementtree.rst:797 msgid "" "from xml.etree import ElementTree, ElementInclude\n" "\n" @@ -1285,14 +1290,14 @@ msgstr "" "\n" "ElementInclude.include(root)" -#: ../../library/xml.etree.elementtree.rst:801 +#: ../../library/xml.etree.elementtree.rst:806 msgid "" "The ElementInclude module replaces the ``{http://www.w3.org/2001/XInclude}" "include`` element with the root element from the **source.xml** document. " "The result might look something like this:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:803 +#: ../../library/xml.etree.elementtree.rst:808 msgid "" "<document xmlns:xi=\"http://www.w3.org/2001/XInclude/">\n" " <para>This is a paragraph.</para>\n" @@ -1302,19 +1307,19 @@ msgstr "" " <para>This is a paragraph.</para>\n" "</document>" -#: ../../library/xml.etree.elementtree.rst:809 +#: ../../library/xml.etree.elementtree.rst:814 msgid "" "If the **parse** attribute is omitted, it defaults to \"xml\". The href " "attribute is required." msgstr "" -#: ../../library/xml.etree.elementtree.rst:811 +#: ../../library/xml.etree.elementtree.rst:816 msgid "" "To include a text document, use the ``{http://www.w3.org/2001/XInclude}" "include`` element, and set the **parse** attribute to \"text\":" msgstr "" -#: ../../library/xml.etree.elementtree.rst:813 +#: ../../library/xml.etree.elementtree.rst:818 msgid "" "<?xml version=\"1.0\"?>\n" "<document xmlns:xi=\"http://www.w3.org/2001/XInclude/">\n" @@ -1326,11 +1331,11 @@ msgstr "" " Copyright (c) <xi:include href=\"year.txt\" parse=\"text\" />.\n" "</document>" -#: ../../library/xml.etree.elementtree.rst:820 +#: ../../library/xml.etree.elementtree.rst:825 msgid "The result might look something like:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:822 +#: ../../library/xml.etree.elementtree.rst:827 msgid "" "<document xmlns:xi=\"http://www.w3.org/2001/XInclude/">\n" " Copyright (c) 2003.\n" @@ -1340,7 +1345,7 @@ msgstr "" " Copyright (c) 2003.\n" "</document>" -#: ../../library/xml.etree.elementtree.rst:840 +#: ../../library/xml.etree.elementtree.rst:845 msgid "" "Default loader. This default loader reads an included resource from disk. " "*href* is a URL. *parse* is for parse mode either \"xml\" or \"text\". " @@ -1351,7 +1356,7 @@ msgid "" "``None`` or raise an exception." msgstr "" -#: ../../library/xml.etree.elementtree.rst:851 +#: ../../library/xml.etree.elementtree.rst:856 msgid "" "This function expands XInclude directives in-place in tree pointed by " "*elem*. *elem* is either the root :class:`~xml.etree.ElementTree.Element` or " @@ -1364,21 +1369,21 @@ msgid "" "malicious content explosion. Pass ``None`` to disable the limitation." msgstr "" -#: ../../library/xml.etree.elementtree.rst:861 +#: ../../library/xml.etree.elementtree.rst:866 msgid "Added the *base_url* and *max_depth* parameters." msgstr "新增 *base_url* 與 *max_depth* 參數。" -#: ../../library/xml.etree.elementtree.rst:868 +#: ../../library/xml.etree.elementtree.rst:873 msgid "Element Objects" msgstr "Element 物件" -#: ../../library/xml.etree.elementtree.rst:876 +#: ../../library/xml.etree.elementtree.rst:881 msgid "" "Element class. This class defines the Element interface, and provides a " "reference implementation of this interface." msgstr "" -#: ../../library/xml.etree.elementtree.rst:879 +#: ../../library/xml.etree.elementtree.rst:884 msgid "" "The element name, attribute names, and attribute values can be either " "bytestrings or Unicode strings. *tag* is the element name. *attrib* is an " @@ -1386,13 +1391,13 @@ msgid "" "additional attributes, given as keyword arguments." msgstr "" -#: ../../library/xml.etree.elementtree.rst:887 +#: ../../library/xml.etree.elementtree.rst:892 msgid "" "A string identifying what kind of data this element represents (the element " "type, in other words)." msgstr "" -#: ../../library/xml.etree.elementtree.rst:894 +#: ../../library/xml.etree.elementtree.rst:899 msgid "" "These attributes can be used to hold additional data associated with the " "element. Their values are usually strings but may be any application-" @@ -1403,11 +1408,11 @@ msgid "" "the XML data" msgstr "" -#: ../../library/xml.etree.elementtree.rst:902 +#: ../../library/xml.etree.elementtree.rst:907 msgid "<a><b>1<c>2<d/>3</c></b>4</a>" msgstr "<a><b>1<c>2<d/>3</c></b>4</a>" -#: ../../library/xml.etree.elementtree.rst:906 +#: ../../library/xml.etree.elementtree.rst:911 msgid "" "the *a* element has ``None`` for both *text* and *tail* attributes, the *b* " "element has *text* ``\"1\"`` and *tail* ``\"4\"``, the *c* element has " @@ -1415,17 +1420,17 @@ msgid "" "``None`` and *tail* ``\"3\"``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:911 +#: ../../library/xml.etree.elementtree.rst:916 msgid "" "To collect the inner text of an element, see :meth:`itertext`, for example " "``\"\".join(element.itertext())``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:914 +#: ../../library/xml.etree.elementtree.rst:919 msgid "Applications may store arbitrary objects in these attributes." msgstr "" -#: ../../library/xml.etree.elementtree.rst:919 +#: ../../library/xml.etree.elementtree.rst:924 msgid "" "A dictionary containing the element's attributes. Note that while the " "*attrib* value is always a real mutable Python dictionary, an ElementTree " @@ -1434,59 +1439,59 @@ msgid "" "implementations, use the dictionary methods below whenever possible." msgstr "" -#: ../../library/xml.etree.elementtree.rst:925 +#: ../../library/xml.etree.elementtree.rst:930 msgid "The following dictionary-like methods work on the element attributes." msgstr "" -#: ../../library/xml.etree.elementtree.rst:930 +#: ../../library/xml.etree.elementtree.rst:935 msgid "" "Resets an element. This function removes all subelements, clears all " "attributes, and sets the text and tail attributes to ``None``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:936 +#: ../../library/xml.etree.elementtree.rst:941 msgid "Gets the element attribute named *key*." msgstr "" -#: ../../library/xml.etree.elementtree.rst:938 +#: ../../library/xml.etree.elementtree.rst:943 msgid "" "Returns the attribute value, or *default* if the attribute was not found." msgstr "" -#: ../../library/xml.etree.elementtree.rst:943 +#: ../../library/xml.etree.elementtree.rst:948 msgid "" "Returns the element attributes as a sequence of (name, value) pairs. The " "attributes are returned in an arbitrary order." msgstr "" -#: ../../library/xml.etree.elementtree.rst:949 +#: ../../library/xml.etree.elementtree.rst:954 msgid "" "Returns the elements attribute names as a list. The names are returned in " "an arbitrary order." msgstr "" -#: ../../library/xml.etree.elementtree.rst:955 +#: ../../library/xml.etree.elementtree.rst:960 msgid "Set the attribute *key* on the element to *value*." msgstr "" -#: ../../library/xml.etree.elementtree.rst:957 +#: ../../library/xml.etree.elementtree.rst:962 msgid "The following methods work on the element's children (subelements)." msgstr "" -#: ../../library/xml.etree.elementtree.rst:962 +#: ../../library/xml.etree.elementtree.rst:967 msgid "" "Adds the element *subelement* to the end of this element's internal list of " "subelements. Raises :exc:`TypeError` if *subelement* is not an :class:" "`Element`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:969 +#: ../../library/xml.etree.elementtree.rst:974 msgid "" "Appends *subelements* from an iterable of elements. Raises :exc:`TypeError` " "if a subelement is not an :class:`Element`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:977 +#: ../../library/xml.etree.elementtree.rst:982 msgid "" "Finds the first subelement matching *match*. *match* may be a tag name or " "a :ref:`path <elementtree-xpath>`. Returns an element instance or " @@ -1495,7 +1500,7 @@ msgid "" "expression into the given namespace." msgstr "" -#: ../../library/xml.etree.elementtree.rst:986 +#: ../../library/xml.etree.elementtree.rst:991 msgid "" "Finds all matching subelements, by tag name or :ref:`path <elementtree-" "xpath>`. Returns a list containing all matching elements in document " @@ -1504,7 +1509,7 @@ msgid "" "expression into the given namespace." msgstr "" -#: ../../library/xml.etree.elementtree.rst:995 +#: ../../library/xml.etree.elementtree.rst:1000 msgid "" "Finds text for the first subelement matching *match*. *match* may be a tag " "name or a :ref:`path <elementtree-xpath>`. Returns the text content of the " @@ -1515,13 +1520,13 @@ msgid "" "into the given namespace." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1006 +#: ../../library/xml.etree.elementtree.rst:1011 msgid "" "Inserts *subelement* at the given position in this element. Raises :exc:" "`TypeError` if *subelement* is not an :class:`Element`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1012 +#: ../../library/xml.etree.elementtree.rst:1017 msgid "" "Creates a tree :term:`iterator` with the current element as the root. The " "iterator iterates over this element and all elements below it, in document " @@ -1530,7 +1535,7 @@ msgid "" "structure is modified during iteration, the result is undefined." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1023 +#: ../../library/xml.etree.elementtree.rst:1028 msgid "" "Finds all matching subelements, by tag name or :ref:`path <elementtree-" "xpath>`. Returns an iterable yielding all matching elements in document " @@ -1538,33 +1543,33 @@ msgid "" "name." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1034 +#: ../../library/xml.etree.elementtree.rst:1039 msgid "" "Creates a text iterator. The iterator loops over this element and all " "subelements, in document order, and returns all inner text." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1042 +#: ../../library/xml.etree.elementtree.rst:1047 msgid "" "Creates a new element object of the same type as this element. Do not call " "this method, use the :func:`SubElement` factory function instead." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1048 +#: ../../library/xml.etree.elementtree.rst:1053 msgid "" "Removes *subelement* from the element. Unlike the find\\* methods this " "method compares elements based on the instance identity, not on tag value or " "contents." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1052 +#: ../../library/xml.etree.elementtree.rst:1057 msgid "" ":class:`Element` objects also support the following sequence type methods " "for working with subelements: :meth:`~object.__delitem__`, :meth:`~object." "__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__len__`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1057 +#: ../../library/xml.etree.elementtree.rst:1062 msgid "" "Caution: Elements with no subelements will test as ``False``. In a future " "release of Python, all elements will test as ``True`` regardless of whether " @@ -1572,7 +1577,7 @@ msgid "" "None`` tests.::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1062 +#: ../../library/xml.etree.elementtree.rst:1067 msgid "" "element = root.find('foo')\n" "\n" @@ -1583,11 +1588,11 @@ msgid "" " print(\"element not found\")" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1070 +#: ../../library/xml.etree.elementtree.rst:1075 msgid "Testing the truth value of an Element emits :exc:`DeprecationWarning`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1073 +#: ../../library/xml.etree.elementtree.rst:1078 msgid "" "Prior to Python 3.8, the serialisation order of the XML attributes of " "elements was artificially made predictable by sorting the attributes by " @@ -1596,7 +1601,7 @@ msgid "" "attributes were originally parsed or created by user code." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1079 +#: ../../library/xml.etree.elementtree.rst:1084 msgid "" "In general, user code should try not to depend on a specific ordering of " "attributes, given that the `XML Information Set <https://www.w3.org/TR/xml-" @@ -1607,7 +1612,7 @@ msgid "" "func:`canonicalize` function." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1087 +#: ../../library/xml.etree.elementtree.rst:1092 msgid "" "In cases where canonical output is not applicable but a specific attribute " "order is still desirable on output, code should aim for creating the " @@ -1617,7 +1622,7 @@ msgid "" "independently from the Element creation::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1094 +#: ../../library/xml.etree.elementtree.rst:1099 msgid "" "def reorder_attributes(root):\n" " for el in root.iter():\n" @@ -1629,58 +1634,58 @@ msgid "" " attrib.update(attribs)" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1107 +#: ../../library/xml.etree.elementtree.rst:1112 msgid "ElementTree Objects" msgstr "ElementTree 物件" -#: ../../library/xml.etree.elementtree.rst:1112 +#: ../../library/xml.etree.elementtree.rst:1117 msgid "" "ElementTree wrapper class. This class represents an entire element " "hierarchy, and adds some extra support for serialization to and from " "standard XML." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1116 +#: ../../library/xml.etree.elementtree.rst:1121 msgid "" "*element* is the root element. The tree is initialized with the contents of " "the XML *file* if given." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1122 +#: ../../library/xml.etree.elementtree.rst:1127 msgid "" "Replaces the root element for this tree. This discards the current contents " "of the tree, and replaces it with the given element. Use with care. " "*element* is an element instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1129 +#: ../../library/xml.etree.elementtree.rst:1134 msgid "Same as :meth:`Element.find`, starting at the root of the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1134 +#: ../../library/xml.etree.elementtree.rst:1139 msgid "Same as :meth:`Element.findall`, starting at the root of the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1139 +#: ../../library/xml.etree.elementtree.rst:1144 msgid "Same as :meth:`Element.findtext`, starting at the root of the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1144 +#: ../../library/xml.etree.elementtree.rst:1149 msgid "Returns the root element for this tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1149 +#: ../../library/xml.etree.elementtree.rst:1154 msgid "" "Creates and returns a tree iterator for the root element. The iterator " "loops over all elements in this tree, in section order. *tag* is the tag to " "look for (default is to return all elements)." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1156 +#: ../../library/xml.etree.elementtree.rst:1161 msgid "Same as :meth:`Element.iterfind`, starting at the root of the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1163 +#: ../../library/xml.etree.elementtree.rst:1168 msgid "" "Loads an external XML section into this element tree. *source* is a file " "name or :term:`file object`. *parser* is an optional parser instance. If " @@ -1688,7 +1693,7 @@ msgid "" "section root element." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1173 +#: ../../library/xml.etree.elementtree.rst:1178 msgid "" "Writes the element tree to a file, as XML. *file* is a file name, or a :" "term:`file object` opened for writing. *encoding* [1]_ is the output " @@ -1703,7 +1708,7 @@ msgid "" "are emitted as a pair of start/end tags." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1187 +#: ../../library/xml.etree.elementtree.rst:1192 msgid "" "The output is either a string (:class:`str`) or binary (:class:`bytes`). " "This is controlled by the *encoding* argument. If *encoding* is " @@ -1713,17 +1718,17 @@ msgid "" "vice versa." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1197 +#: ../../library/xml.etree.elementtree.rst:1202 msgid "" "The :meth:`write` method now preserves the attribute order specified by the " "user." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1202 +#: ../../library/xml.etree.elementtree.rst:1207 msgid "This is the XML file that is going to be manipulated::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1204 +#: ../../library/xml.etree.elementtree.rst:1209 msgid "" "<html>\n" " <head>\n" @@ -1745,13 +1750,13 @@ msgstr "" " </body>\n" "</html>" -#: ../../library/xml.etree.elementtree.rst:1214 +#: ../../library/xml.etree.elementtree.rst:1219 msgid "" "Example of changing the attribute \"target\" of every link in first " "paragraph::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1216 +#: ../../library/xml.etree.elementtree.rst:1221 msgid "" ">>> from xml.etree.ElementTree import ElementTree\n" ">>> tree = ElementTree()\n" @@ -1769,11 +1774,11 @@ msgid "" ">>> tree.write(\"output.xhtml\")" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1234 +#: ../../library/xml.etree.elementtree.rst:1239 msgid "QName Objects" msgstr "QName 物件" -#: ../../library/xml.etree.elementtree.rst:1239 +#: ../../library/xml.etree.elementtree.rst:1244 msgid "" "QName wrapper. This can be used to wrap a QName attribute value, in order " "to get proper namespace handling on output. *text_or_uri* is a string " @@ -1783,11 +1788,11 @@ msgid "" "class:`QName` instances are opaque." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1251 +#: ../../library/xml.etree.elementtree.rst:1256 msgid "TreeBuilder Objects" msgstr "TreeBuilder 物件" -#: ../../library/xml.etree.elementtree.rst:1257 +#: ../../library/xml.etree.elementtree.rst:1262 msgid "" "Generic element structure builder. This builder converts a sequence of " "start, data, end, comment and pi method calls to a well-formed element " @@ -1795,14 +1800,14 @@ msgid "" "custom XML parser, or a parser for some other XML-like format." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1262 +#: ../../library/xml.etree.elementtree.rst:1267 msgid "" "*element_factory*, when given, must be a callable accepting two positional " "arguments: a tag and a dict of attributes. It is expected to return a new " "element instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1266 +#: ../../library/xml.etree.elementtree.rst:1271 msgid "" "The *comment_factory* and *pi_factory* functions, when given, should behave " "like the :func:`Comment` and :func:`ProcessingInstruction` functions to " @@ -1812,56 +1817,56 @@ msgid "" "element (but not outside of it)." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1275 +#: ../../library/xml.etree.elementtree.rst:1280 msgid "" "Flushes the builder buffers, and returns the toplevel document element. " "Returns an :class:`Element` instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1281 +#: ../../library/xml.etree.elementtree.rst:1286 msgid "" "Adds text to the current element. *data* is a string. This should be " "either a bytestring, or a Unicode string." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1287 +#: ../../library/xml.etree.elementtree.rst:1292 msgid "" "Closes the current element. *tag* is the element name. Returns the closed " "element." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1293 +#: ../../library/xml.etree.elementtree.rst:1298 msgid "" "Opens a new element. *tag* is the element name. *attrs* is a dictionary " "containing element attributes. Returns the opened element." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1299 +#: ../../library/xml.etree.elementtree.rst:1304 msgid "" "Creates a comment with the given *text*. If ``insert_comments`` is true, " "this will also add it to the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1307 +#: ../../library/xml.etree.elementtree.rst:1312 msgid "" "Creates a process instruction with the given *target* name and *text*. If " "``insert_pis`` is true, this will also add it to the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1313 +#: ../../library/xml.etree.elementtree.rst:1318 msgid "" "In addition, a custom :class:`TreeBuilder` object can provide the following " "methods:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1318 +#: ../../library/xml.etree.elementtree.rst:1323 msgid "" "Handles a doctype declaration. *name* is the doctype name. *pubid* is the " "public identifier. *system* is the system identifier. This method does not " "exist on the default :class:`TreeBuilder` class." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1326 +#: ../../library/xml.etree.elementtree.rst:1331 msgid "" "Is called whenever the parser encounters a new namespace declaration, before " "the ``start()`` callback for the opening element that defines it. *prefix* " @@ -1869,14 +1874,14 @@ msgid "" "otherwise. *uri* is the namespace URI." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1335 +#: ../../library/xml.etree.elementtree.rst:1340 msgid "" "Is called after the ``end()`` callback of an element that declared a " "namespace prefix mapping, with the name of the *prefix* that went out of " "scope." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1347 +#: ../../library/xml.etree.elementtree.rst:1352 msgid "" "A `C14N 2.0 <https://www.w3.org/TR/xml-c14n2/>`_ writer. Arguments are the " "same as for the :func:`canonicalize` function. This class does not build a " @@ -1884,11 +1889,11 @@ msgid "" "using the *write* function." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1358 +#: ../../library/xml.etree.elementtree.rst:1363 msgid "XMLParser Objects" msgstr "XMLParser 物件" -#: ../../library/xml.etree.elementtree.rst:1363 +#: ../../library/xml.etree.elementtree.rst:1368 msgid "" "This class is the low-level building block of the module. It uses :mod:`xml." "parsers.expat` for efficient, event-based parsing of XML. It can be fed XML " @@ -1899,25 +1904,25 @@ msgid "" "XML file." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1371 +#: ../../library/xml.etree.elementtree.rst:1376 msgid "" "Parameters are now :ref:`keyword-only <keyword-only_parameter>`. The *html* " -"argument is no longer supported." +"argument no longer supported." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1378 +#: ../../library/xml.etree.elementtree.rst:1383 msgid "" "Finishes feeding data to the parser. Returns the result of calling the " "``close()`` method of the *target* passed during construction; by default, " "this is the toplevel document element." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1385 +#: ../../library/xml.etree.elementtree.rst:1390 msgid "Feeds data to the parser. *data* is encoded data." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1390 -#: ../../library/xml.etree.elementtree.rst:1468 +#: ../../library/xml.etree.elementtree.rst:1395 +#: ../../library/xml.etree.elementtree.rst:1473 msgid "" "Triggers parsing of any previously fed unparsed data, which can be used to " "ensure more immediate feedback, in particular with Expat >=2.6.0. The " @@ -1927,15 +1932,15 @@ msgid "" "xmlparser.SetReparseDeferralEnabled` for details." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1397 -#: ../../library/xml.etree.elementtree.rst:1475 +#: ../../library/xml.etree.elementtree.rst:1402 +#: ../../library/xml.etree.elementtree.rst:1480 msgid "" "Note that :meth:`flush` has been backported to some prior releases of " "CPython as a security fix. Check for availability of :meth:`flush` using :" "func:`hasattr` if used in code running across a variety of Python versions." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1405 +#: ../../library/xml.etree.elementtree.rst:1410 msgid "" ":meth:`XMLParser.feed` calls *target*\\'s ``start(tag, attrs_dict)`` method " "for each opening tag, its ``end(tag)`` method for each closing tag, and data " @@ -1946,7 +1951,7 @@ msgid "" "of an XML file::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1413 +#: ../../library/xml.etree.elementtree.rst:1418 msgid "" ">>> from xml.etree.ElementTree import XMLParser\n" ">>> class MaxDepth: # The target object of the parser\n" @@ -1981,11 +1986,11 @@ msgid "" "4" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1449 +#: ../../library/xml.etree.elementtree.rst:1454 msgid "XMLPullParser Objects" msgstr "XMLPullParser 物件" -#: ../../library/xml.etree.elementtree.rst:1453 +#: ../../library/xml.etree.elementtree.rst:1458 msgid "" "A pull parser suitable for non-blocking applications. Its input-side API is " "similar to that of :class:`XMLParser`, but instead of pushing calls to a " @@ -1997,11 +2002,11 @@ msgid "" "If *events* is omitted, only ``\"end\"`` events are reported." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1464 +#: ../../library/xml.etree.elementtree.rst:1469 msgid "Feed the given bytes data to the parser." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1484 +#: ../../library/xml.etree.elementtree.rst:1489 msgid "" "Signal the parser that the data stream is terminated. Unlike :meth:" "`XMLParser.close`, this method always returns :const:`None`. Any events not " @@ -2009,7 +2014,7 @@ msgid "" "`read_events`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1491 +#: ../../library/xml.etree.elementtree.rst:1496 msgid "" "Return an iterator over the events which have been encountered in the data " "fed to the parser. The iterator yields ``(event, elem)`` pairs, where " @@ -2018,25 +2023,25 @@ msgid "" "follows." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1497 +#: ../../library/xml.etree.elementtree.rst:1502 msgid "``start``, ``end``: the current Element." msgstr "``start``、``end``:目前的 Element。" -#: ../../library/xml.etree.elementtree.rst:1498 +#: ../../library/xml.etree.elementtree.rst:1503 msgid "``comment``, ``pi``: the current comment / processing instruction" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1499 +#: ../../library/xml.etree.elementtree.rst:1504 msgid "" "``start-ns``: a tuple ``(prefix, uri)`` naming the declared namespace " "mapping." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1501 +#: ../../library/xml.etree.elementtree.rst:1506 msgid "``end-ns``: :const:`None` (this may change in a future version)" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1503 +#: ../../library/xml.etree.elementtree.rst:1508 msgid "" "Events provided in a previous call to :meth:`read_events` will not be " "yielded again. Events are consumed from the internal queue only when they " @@ -2045,7 +2050,7 @@ msgid "" "results." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1511 +#: ../../library/xml.etree.elementtree.rst:1516 msgid "" ":class:`XMLPullParser` only guarantees that it has seen the \">\" character " "of a starting tag when it emits a \"start\" event, so the attributes are " @@ -2054,11 +2059,11 @@ msgid "" "be present." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1526 +#: ../../library/xml.etree.elementtree.rst:1531 msgid "Exceptions" msgstr "例外" -#: ../../library/xml.etree.elementtree.rst:1530 +#: ../../library/xml.etree.elementtree.rst:1535 msgid "" "XML parse error, raised by the various parsing methods in this module when " "parsing fails. The string representation of an instance of this exception " @@ -2066,22 +2071,22 @@ msgid "" "following attributes available:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1537 +#: ../../library/xml.etree.elementtree.rst:1542 msgid "" "A numeric error code from the expat parser. See the documentation of :mod:" "`xml.parsers.expat` for the list of error codes and their meanings." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1542 +#: ../../library/xml.etree.elementtree.rst:1547 msgid "" "A tuple of *line*, *column* numbers, specifying where the error occurred." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1545 +#: ../../library/xml.etree.elementtree.rst:1550 msgid "Footnotes" msgstr "註解" -#: ../../library/xml.etree.elementtree.rst:1546 +#: ../../library/xml.etree.elementtree.rst:1551 msgid "" "The encoding string included in XML output should conform to the appropriate " "standards. For example, \"UTF-8\" is valid, but \"UTF8\" is not. See " diff --git a/library/xmlrpc.client.po b/library/xmlrpc.client.po index c84684df77..efbc83579f 100644 --- a/library/xmlrpc.client.po +++ b/library/xmlrpc.client.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -48,14 +48,14 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability <availability>`: not Emscripten, not WASI." +msgid ":ref:`Availability <availability>`: not WASI." msgstr "" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" @@ -282,7 +282,8 @@ msgstr "" #: ../../library/xmlrpc.client.rst:168 msgid "" -"`XML-RPC Introspection <https://xmlrpc-c.sourceforge.io/introspection.html>`_" +"`XML-RPC Introspection <https://xmlrpc-c.sourceforge.net/introspection." +"html>`_" msgstr "" #: ../../library/xmlrpc.client.rst:169 diff --git a/library/xmlrpc.server.po b/library/xmlrpc.server.po index 6d9d2a3716..c3daa17cde 100644 --- a/library/xmlrpc.server.po +++ b/library/xmlrpc.server.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,14 +42,14 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability <availability>`: not Emscripten, not WASI." +msgid ":ref:`Availability <availability>`: not WASI." msgstr "" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/zipfile.po b/library/zipfile.po index 18fa2bfe2f..acfa9acf15 100644 --- a/library/zipfile.po +++ b/library/zipfile.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -91,40 +91,47 @@ msgid "" "ref:`zipinfo-objects`." msgstr "" -#: ../../library/zipfile.rst:84 +#: ../../library/zipfile.rst:82 +msgid "" +"A public :attr:`!compress_level` attribute has been added to expose the " +"formerly protected :attr:`!_compresslevel`. The older protected name " +"continues to work as a property for backwards compatibility." +msgstr "" + +#: ../../library/zipfile.rst:89 msgid "" "Returns ``True`` if *filename* is a valid ZIP file based on its magic " "number, otherwise returns ``False``. *filename* may be a file or file-like " "object too." msgstr "" -#: ../../library/zipfile.rst:87 +#: ../../library/zipfile.rst:92 msgid "Support for file and file-like objects." msgstr "" -#: ../../library/zipfile.rst:93 +#: ../../library/zipfile.rst:98 msgid "The numeric constant for an uncompressed archive member." msgstr "" -#: ../../library/zipfile.rst:98 +#: ../../library/zipfile.rst:103 msgid "" "The numeric constant for the usual ZIP compression method. This requires " "the :mod:`zlib` module." msgstr "" -#: ../../library/zipfile.rst:104 +#: ../../library/zipfile.rst:109 msgid "" "The numeric constant for the BZIP2 compression method. This requires the :" "mod:`bz2` module." msgstr "" -#: ../../library/zipfile.rst:111 +#: ../../library/zipfile.rst:116 msgid "" "The numeric constant for the LZMA compression method. This requires the :" "mod:`lzma` module." msgstr "" -#: ../../library/zipfile.rst:118 +#: ../../library/zipfile.rst:123 msgid "" "The ZIP file format specification has included support for bzip2 compression " "since 2001, and for LZMA compression since 2006. However, some tools " @@ -133,37 +140,37 @@ msgid "" "individual files." msgstr "" -#: ../../library/zipfile.rst:127 +#: ../../library/zipfile.rst:132 msgid "`PKZIP Application Note`_" msgstr "" -#: ../../library/zipfile.rst:128 +#: ../../library/zipfile.rst:133 msgid "" "Documentation on the ZIP file format by Phil Katz, the creator of the format " "and algorithms used." msgstr "" -#: ../../library/zipfile.rst:131 +#: ../../library/zipfile.rst:136 msgid "`Info-ZIP Home Page <https://infozip.sourceforge.net/>`_" msgstr "`Info-ZIP 首頁 <https://infozip.sourceforge.net/>`_" -#: ../../library/zipfile.rst:132 +#: ../../library/zipfile.rst:137 msgid "" "Information about the Info-ZIP project's ZIP archive programs and " "development libraries." msgstr "" -#: ../../library/zipfile.rst:139 +#: ../../library/zipfile.rst:144 msgid "ZipFile Objects" msgstr "ZipFile 物件" -#: ../../library/zipfile.rst:146 +#: ../../library/zipfile.rst:151 msgid "" "Open a ZIP file, where *file* can be a path to a file (a string), a file-" "like object or a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:149 +#: ../../library/zipfile.rst:154 msgid "" "The *mode* parameter should be ``'r'`` to read an existing file, ``'w'`` to " "truncate and write a new file, ``'a'`` to append to an existing file, or " @@ -177,7 +184,7 @@ msgid "" "``'r'`` or ``'a'``, the file should be seekable." msgstr "" -#: ../../library/zipfile.rst:161 +#: ../../library/zipfile.rst:166 msgid "" "*compression* is the ZIP compression method to use when writing the archive, " "and should be :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`, :const:`ZIP_BZIP2` " @@ -188,7 +195,7 @@ msgid "" "is raised. The default is :const:`ZIP_STORED`." msgstr "" -#: ../../library/zipfile.rst:169 +#: ../../library/zipfile.rst:174 msgid "" "If *allowZip64* is ``True`` (the default) zipfile will create ZIP files that " "use the ZIP64 extensions when the zipfile is larger than 4 GiB. If it is " @@ -196,7 +203,7 @@ msgid "" "require ZIP64 extensions." msgstr "" -#: ../../library/zipfile.rst:174 +#: ../../library/zipfile.rst:179 msgid "" "The *compresslevel* parameter controls the compression level to use when " "writing files to the archive. When using :const:`ZIP_STORED` or :const:" @@ -206,7 +213,7 @@ msgid "" "accepted (see :class:`bz2 <bz2.BZ2File>` for more information)." msgstr "" -#: ../../library/zipfile.rst:182 ../../library/zipfile.rst:735 +#: ../../library/zipfile.rst:187 ../../library/zipfile.rst:760 msgid "" "The *strict_timestamps* argument, when set to ``False``, allows to zip files " "older than 1980-01-01 at the cost of setting the timestamp to 1980-01-01. " @@ -214,28 +221,28 @@ msgid "" "also set to the limit." msgstr "" -#: ../../library/zipfile.rst:188 +#: ../../library/zipfile.rst:193 msgid "" "When mode is ``'r'``, *metadata_encoding* may be set to the name of a codec, " "which will be used to decode metadata such as the names of members and ZIP " "comments." msgstr "" -#: ../../library/zipfile.rst:192 +#: ../../library/zipfile.rst:197 msgid "" "If the file is created with mode ``'w'``, ``'x'`` or ``'a'`` and then :meth:" "`closed <close>` without adding any files to the archive, the appropriate " "ZIP structures for an empty archive will be written to the file." msgstr "" -#: ../../library/zipfile.rst:196 +#: ../../library/zipfile.rst:201 msgid "" "ZipFile is also a context manager and therefore supports the :keyword:`with` " "statement. In the example, *myzip* is closed after the :keyword:`!with` " "statement's suite is finished---even if an exception occurs::" msgstr "" -#: ../../library/zipfile.rst:200 +#: ../../library/zipfile.rst:205 msgid "" "with ZipFile('spam.zip', 'w') as myzip:\n" " myzip.write('eggs.txt')" @@ -243,13 +250,13 @@ msgstr "" "with ZipFile('spam.zip', 'w') as myzip:\n" " myzip.write('eggs.txt')" -#: ../../library/zipfile.rst:205 +#: ../../library/zipfile.rst:210 msgid "" "*metadata_encoding* is an instance-wide setting for the ZipFile. It is not " "currently possible to set this on a per-member basis." msgstr "" -#: ../../library/zipfile.rst:208 +#: ../../library/zipfile.rst:213 msgid "" "This attribute is a workaround for legacy implementations which produce " "archives with names in the current locale encoding or code page (mostly on " @@ -259,73 +266,73 @@ msgid "" "is a Python-specific extension." msgstr "" -#: ../../library/zipfile.rst:216 +#: ../../library/zipfile.rst:221 msgid "Added the ability to use :class:`ZipFile` as a context manager." msgstr "新增 :class:`ZipFile` 作為情境管理器使用的能力。" -#: ../../library/zipfile.rst:219 +#: ../../library/zipfile.rst:224 msgid "Added support for :mod:`bzip2 <bz2>` and :mod:`lzma` compression." msgstr "新增對於 :mod:`bzip2 <bz2>` 和 :mod:`lzma` 壓縮的支援。" -#: ../../library/zipfile.rst:222 ../../library/zipfile.rst:648 +#: ../../library/zipfile.rst:227 ../../library/zipfile.rst:673 msgid "ZIP64 extensions are enabled by default." msgstr "" -#: ../../library/zipfile.rst:225 +#: ../../library/zipfile.rst:230 msgid "" "Added support for writing to unseekable streams. Added support for the " "``'x'`` mode." msgstr "" -#: ../../library/zipfile.rst:229 +#: ../../library/zipfile.rst:234 msgid "" "Previously, a plain :exc:`RuntimeError` was raised for unrecognized " "compression values." msgstr "" -#: ../../library/zipfile.rst:233 +#: ../../library/zipfile.rst:238 msgid "The *file* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:236 +#: ../../library/zipfile.rst:241 msgid "Add the *compresslevel* parameter." msgstr "" -#: ../../library/zipfile.rst:239 +#: ../../library/zipfile.rst:244 msgid "The *strict_timestamps* keyword-only parameter." msgstr "" -#: ../../library/zipfile.rst:242 +#: ../../library/zipfile.rst:247 msgid "" "Added support for specifying member name encoding for reading metadata in " "the zipfile's directory and file headers." msgstr "" -#: ../../library/zipfile.rst:249 +#: ../../library/zipfile.rst:254 msgid "" "Close the archive file. You must call :meth:`close` before exiting your " "program or essential records will not be written." msgstr "" -#: ../../library/zipfile.rst:255 +#: ../../library/zipfile.rst:260 msgid "" "Return a :class:`ZipInfo` object with information about the archive member " "*name*. Calling :meth:`getinfo` for a name not currently contained in the " "archive will raise a :exc:`KeyError`." msgstr "" -#: ../../library/zipfile.rst:262 +#: ../../library/zipfile.rst:267 msgid "" "Return a list containing a :class:`ZipInfo` object for each member of the " "archive. The objects are in the same order as their entries in the actual " "ZIP file on disk if an existing archive was opened." msgstr "" -#: ../../library/zipfile.rst:269 +#: ../../library/zipfile.rst:274 msgid "Return a list of archive members by name." msgstr "" -#: ../../library/zipfile.rst:274 +#: ../../library/zipfile.rst:279 msgid "" "Access a member of the archive as a binary file-like object. *name* can be " "either the name of a file within the archive or a :class:`ZipInfo` object. " @@ -334,13 +341,13 @@ msgid "" "class:`bytes` object." msgstr "" -#: ../../library/zipfile.rst:280 +#: ../../library/zipfile.rst:285 msgid "" ":meth:`~ZipFile.open` is also a context manager and therefore supports the :" "keyword:`with` statement::" msgstr "" -#: ../../library/zipfile.rst:283 +#: ../../library/zipfile.rst:288 msgid "" "with ZipFile('spam.zip') as myzip:\n" " with myzip.open('eggs.txt') as myfile:\n" @@ -350,7 +357,7 @@ msgstr "" " with myzip.open('eggs.txt') as myfile:\n" " print(myfile.read())" -#: ../../library/zipfile.rst:287 +#: ../../library/zipfile.rst:292 msgid "" "With *mode* ``'r'`` the file-like object (``ZipExtFile``) is read-only and " "provides the following methods: :meth:`~io.BufferedIOBase.read`, :meth:`~io." @@ -359,7 +366,7 @@ msgid "" "__next__`. These objects can operate independently of the ZipFile." msgstr "" -#: ../../library/zipfile.rst:294 +#: ../../library/zipfile.rst:299 msgid "" "With ``mode='w'``, a writable file handle is returned, which supports the :" "meth:`~io.BufferedIOBase.write` method. While a writable file handle is " @@ -367,7 +374,14 @@ msgid "" "exc:`ValueError`." msgstr "" -#: ../../library/zipfile.rst:299 +#: ../../library/zipfile.rst:304 +msgid "" +"In both cases the file-like object has also attributes :attr:`!name`, which " +"is equivalent to the name of a file within the archive, and :attr:`!mode`, " +"which is ``'rb'`` or ``'wb'`` depending on the input mode." +msgstr "" + +#: ../../library/zipfile.rst:308 msgid "" "When writing a file, if the file size is not known in advance but may exceed " "2 GiB, pass ``force_zip64=True`` to ensure that the header format is capable " @@ -376,32 +390,39 @@ msgid "" "as the *name* parameter." msgstr "" -#: ../../library/zipfile.rst:307 +#: ../../library/zipfile.rst:316 msgid "" "The :meth:`.open`, :meth:`read` and :meth:`extract` methods can take a " "filename or a :class:`ZipInfo` object. You will appreciate this when trying " "to read a ZIP file that contains members with duplicate names." msgstr "" -#: ../../library/zipfile.rst:311 +#: ../../library/zipfile.rst:320 msgid "" "Removed support of ``mode='U'``. Use :class:`io.TextIOWrapper` for reading " "compressed text files in :term:`universal newlines` mode." msgstr "" -#: ../../library/zipfile.rst:315 +#: ../../library/zipfile.rst:324 msgid "" ":meth:`ZipFile.open` can now be used to write files into the archive with " "the ``mode='w'`` option." msgstr "" -#: ../../library/zipfile.rst:319 +#: ../../library/zipfile.rst:328 msgid "" "Calling :meth:`.open` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/zipfile.rst:326 +#: ../../library/zipfile.rst:332 +msgid "" +"Added attributes :attr:`!name` and :attr:`!mode` for the writeable file-like " +"object. The value of the :attr:`!mode` attribute for the readable file-like " +"object was changed from ``'r'`` to ``'rb'``." +msgstr "" + +#: ../../library/zipfile.rst:341 msgid "" "Extract a member from the archive to the current working directory; *member* " "must be its full name or a :class:`ZipInfo` object. Its file information is " @@ -410,11 +431,11 @@ msgid "" "*pwd* is the password used for encrypted files as a :class:`bytes` object." msgstr "" -#: ../../library/zipfile.rst:332 +#: ../../library/zipfile.rst:347 msgid "Returns the normalized path created (a directory or new file)." msgstr "" -#: ../../library/zipfile.rst:336 +#: ../../library/zipfile.rst:351 msgid "" "If a member filename is an absolute path, a drive/UNC sharepoint and leading " "(back)slashes will be stripped, e.g.: ``///foo/bar`` becomes ``foo/bar`` on " @@ -425,17 +446,17 @@ msgid "" "(``_``)." msgstr "" -#: ../../library/zipfile.rst:344 +#: ../../library/zipfile.rst:359 msgid "" "Calling :meth:`extract` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/zipfile.rst:348 ../../library/zipfile.rst:371 +#: ../../library/zipfile.rst:363 ../../library/zipfile.rst:386 msgid "The *path* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:354 +#: ../../library/zipfile.rst:369 msgid "" "Extract all members from the archive to the current working directory. " "*path* specifies a different directory to extract to. *members* is optional " @@ -443,7 +464,7 @@ msgid "" "password used for encrypted files as a :class:`bytes` object." msgstr "" -#: ../../library/zipfile.rst:361 +#: ../../library/zipfile.rst:376 msgid "" "Never extract archives from untrusted sources without prior inspection. It " "is possible that files are created outside of *path*, e.g. members that have " @@ -451,23 +472,23 @@ msgid "" "\"``. This module attempts to prevent that. See :meth:`extract` note." msgstr "" -#: ../../library/zipfile.rst:367 +#: ../../library/zipfile.rst:382 msgid "" "Calling :meth:`extractall` on a closed ZipFile will raise a :exc:" "`ValueError`. Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/zipfile.rst:377 +#: ../../library/zipfile.rst:392 msgid "Print a table of contents for the archive to ``sys.stdout``." msgstr "" -#: ../../library/zipfile.rst:382 +#: ../../library/zipfile.rst:397 msgid "" "Set *pwd* (a :class:`bytes` object) as default password to extract encrypted " "files." msgstr "" -#: ../../library/zipfile.rst:387 +#: ../../library/zipfile.rst:402 msgid "" "Return the bytes of the file *name* in the archive. *name* is the name of " "the file in the archive, or a :class:`ZipInfo` object. The archive must be " @@ -480,25 +501,25 @@ msgid "" "compression module is not available." msgstr "" -#: ../../library/zipfile.rst:396 +#: ../../library/zipfile.rst:411 msgid "" "Calling :meth:`read` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/zipfile.rst:403 +#: ../../library/zipfile.rst:418 msgid "" "Read all the files in the archive and check their CRC's and file headers. " "Return the name of the first bad file, or else return ``None``." msgstr "" -#: ../../library/zipfile.rst:406 +#: ../../library/zipfile.rst:421 msgid "" "Calling :meth:`testzip` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/zipfile.rst:414 +#: ../../library/zipfile.rst:429 msgid "" "Write the file named *filename* to the archive, giving it the archive name " "*arcname* (by default, this will be the same as *filename*, but without a " @@ -509,7 +530,7 @@ msgid "" "``'x'`` or ``'a'``." msgstr "" -#: ../../library/zipfile.rst:424 +#: ../../library/zipfile.rst:439 msgid "" "The ZIP file standard historically did not specify a metadata encoding, but " "strongly recommended CP437 (the original IBM PC encoding) for " @@ -519,33 +540,33 @@ msgid "" "in any encoding other than ASCII or UTF-8." msgstr "" -#: ../../library/zipfile.rst:433 +#: ../../library/zipfile.rst:448 msgid "" "Archive names should be relative to the archive root, that is, they should " "not start with a path separator." msgstr "" -#: ../../library/zipfile.rst:438 +#: ../../library/zipfile.rst:453 msgid "" "If ``arcname`` (or ``filename``, if ``arcname`` is not given) contains a " "null byte, the name of the file in the archive will be truncated at the null " "byte." msgstr "" -#: ../../library/zipfile.rst:443 +#: ../../library/zipfile.rst:458 msgid "" "A leading slash in the filename may lead to the archive being impossible to " "open in some zip programs on Windows systems." msgstr "" -#: ../../library/zipfile.rst:446 +#: ../../library/zipfile.rst:461 msgid "" "Calling :meth:`write` on a ZipFile created with mode ``'r'`` or a closed " "ZipFile will raise a :exc:`ValueError`. Previously, a :exc:`RuntimeError` " "was raised." msgstr "" -#: ../../library/zipfile.rst:455 +#: ../../library/zipfile.rst:470 msgid "" "Write a file into the archive. The contents is *data*, which may be either " "a :class:`str` or a :class:`bytes` instance; if it is a :class:`str`, it is " @@ -556,7 +577,7 @@ msgid "" "must be opened with mode ``'w'``, ``'x'`` or ``'a'``." msgstr "" -#: ../../library/zipfile.rst:463 +#: ../../library/zipfile.rst:478 msgid "" "If given, *compress_type* overrides the value given for the *compression* " "parameter to the constructor for the new entry, or in the *zinfo_or_arcname* " @@ -564,7 +585,7 @@ msgid "" "override the constructor if given." msgstr "" -#: ../../library/zipfile.rst:470 +#: ../../library/zipfile.rst:485 msgid "" "When passing a :class:`ZipInfo` instance as the *zinfo_or_arcname* " "parameter, the compression method used will be that specified in the " @@ -572,18 +593,18 @@ msgid "" "the :class:`ZipInfo` constructor sets this member to :const:`ZIP_STORED`." msgstr "" -#: ../../library/zipfile.rst:475 +#: ../../library/zipfile.rst:490 msgid "The *compress_type* argument." msgstr "*compress_type* 引數。" -#: ../../library/zipfile.rst:478 +#: ../../library/zipfile.rst:493 msgid "" "Calling :meth:`writestr` on a ZipFile created with mode ``'r'`` or a closed " "ZipFile will raise a :exc:`ValueError`. Previously, a :exc:`RuntimeError` " "was raised." msgstr "" -#: ../../library/zipfile.rst:485 +#: ../../library/zipfile.rst:500 msgid "" "Create a directory inside the archive. If *zinfo_or_directory* is a string, " "a directory is created inside the archive with the mode that is specified in " @@ -591,26 +612,26 @@ msgid "" "instance then the *mode* argument is ignored." msgstr "" -#: ../../library/zipfile.rst:490 +#: ../../library/zipfile.rst:505 msgid "The archive must be opened with mode ``'w'``, ``'x'`` or ``'a'``." msgstr "" -#: ../../library/zipfile.rst:495 +#: ../../library/zipfile.rst:510 msgid "The following data attributes are also available:" msgstr "" -#: ../../library/zipfile.rst:499 +#: ../../library/zipfile.rst:514 msgid "Name of the ZIP file." msgstr "" -#: ../../library/zipfile.rst:503 +#: ../../library/zipfile.rst:518 msgid "" "The level of debug output to use. This may be set from ``0`` (the default, " "no output) to ``3`` (the most output). Debugging information is written to " "``sys.stdout``." msgstr "" -#: ../../library/zipfile.rst:509 +#: ../../library/zipfile.rst:524 msgid "" "The comment associated with the ZIP file as a :class:`bytes` object. If " "assigning a comment to a :class:`ZipFile` instance created with mode " @@ -618,37 +639,37 @@ msgid "" "Comments longer than this will be truncated." msgstr "" -#: ../../library/zipfile.rst:519 +#: ../../library/zipfile.rst:534 msgid "Path Objects" msgstr "" -#: ../../library/zipfile.rst:523 +#: ../../library/zipfile.rst:538 msgid "" "Construct a Path object from a ``root`` zipfile (which may be a :class:" "`ZipFile` instance or ``file`` suitable for passing to the :class:`ZipFile` " "constructor)." msgstr "" -#: ../../library/zipfile.rst:527 +#: ../../library/zipfile.rst:542 msgid "" "``at`` specifies the location of this Path within the zipfile, e.g. 'dir/" "file.txt', 'dir/', or ''. Defaults to the empty string, indicating the root." msgstr "" -#: ../../library/zipfile.rst:531 +#: ../../library/zipfile.rst:546 msgid "" "Path objects expose the following features of :mod:`pathlib.Path` objects:" msgstr "" -#: ../../library/zipfile.rst:534 +#: ../../library/zipfile.rst:549 msgid "Path objects are traversable using the ``/`` operator or ``joinpath``." msgstr "" -#: ../../library/zipfile.rst:538 +#: ../../library/zipfile.rst:553 msgid "The final path component." msgstr "" -#: ../../library/zipfile.rst:542 +#: ../../library/zipfile.rst:557 msgid "" "Invoke :meth:`ZipFile.open` on the current path. Allows opening for read or " "write, text or binary through supported modes: 'r', 'w', 'rb', 'wb'. " @@ -657,12 +678,12 @@ msgid "" "``pwd`` parameter to :meth:`ZipFile.open`." msgstr "" -#: ../../library/zipfile.rst:551 +#: ../../library/zipfile.rst:566 msgid "" "Added support for text and binary modes for open. Default mode is now text." msgstr "" -#: ../../library/zipfile.rst:555 ../../library/zipfile.rst:606 +#: ../../library/zipfile.rst:570 ../../library/zipfile.rst:631 msgid "" "The ``encoding`` parameter can be supplied as a positional argument without " "causing a :exc:`TypeError`. As it could in 3.9. Code needing to be " @@ -670,124 +691,134 @@ msgid "" "TextIOWrapper` arguments, ``encoding`` included, as keywords." msgstr "" -#: ../../library/zipfile.rst:563 +#: ../../library/zipfile.rst:578 msgid "Enumerate the children of the current directory." msgstr "" -#: ../../library/zipfile.rst:567 +#: ../../library/zipfile.rst:582 msgid "Return ``True`` if the current context references a directory." msgstr "" -#: ../../library/zipfile.rst:571 +#: ../../library/zipfile.rst:586 msgid "Return ``True`` if the current context references a file." msgstr "" -#: ../../library/zipfile.rst:575 +#: ../../library/zipfile.rst:590 +msgid "Return ``True`` if the current context references a symbolic link." +msgstr "" + +#: ../../library/zipfile.rst:594 +msgid "Previously, ``is_symlink`` would unconditionally return ``False``." +msgstr "" + +#: ../../library/zipfile.rst:599 msgid "" "Return ``True`` if the current context references a file or directory in the " "zip file." msgstr "" -#: ../../library/zipfile.rst:580 -msgid "The file extension of the final component." +#: ../../library/zipfile.rst:604 +msgid "" +"The last dot-separated portion of the final component, if any. This is " +"commonly called the file extension." msgstr "" -#: ../../library/zipfile.rst:582 +#: ../../library/zipfile.rst:607 msgid "Added :data:`Path.suffix` property." msgstr "新增 :data:`Path.suffix` 特性。" -#: ../../library/zipfile.rst:587 +#: ../../library/zipfile.rst:612 msgid "The final path component, without its suffix." msgstr "" -#: ../../library/zipfile.rst:589 +#: ../../library/zipfile.rst:614 msgid "Added :data:`Path.stem` property." msgstr "新增 :data:`Path.stem` 特性。" -#: ../../library/zipfile.rst:594 -msgid "A list of the path’s file extensions." +#: ../../library/zipfile.rst:619 +msgid "A list of the path’s suffixes, commonly called file extensions." msgstr "" -#: ../../library/zipfile.rst:596 +#: ../../library/zipfile.rst:621 msgid "Added :data:`Path.suffixes` property." msgstr "新增 :data:`Path.suffixes` 特性。" -#: ../../library/zipfile.rst:601 +#: ../../library/zipfile.rst:626 msgid "" "Read the current file as unicode text. Positional and keyword arguments are " "passed through to :class:`io.TextIOWrapper` (except ``buffer``, which is " "implied by the context)." msgstr "" -#: ../../library/zipfile.rst:614 +#: ../../library/zipfile.rst:639 msgid "Read the current file as bytes." msgstr "" -#: ../../library/zipfile.rst:618 +#: ../../library/zipfile.rst:643 msgid "" "Return a new Path object with each of the *other* arguments joined. The " "following are equivalent::" msgstr "" -#: ../../library/zipfile.rst:621 +#: ../../library/zipfile.rst:646 msgid "" ">>> Path(...).joinpath('child').joinpath('grandchild')\n" ">>> Path(...).joinpath('child', 'grandchild')\n" ">>> Path(...) / 'child' / 'grandchild'" msgstr "" -#: ../../library/zipfile.rst:625 +#: ../../library/zipfile.rst:650 msgid "" "Prior to 3.10, ``joinpath`` was undocumented and accepted exactly one " "parameter." msgstr "" -#: ../../library/zipfile.rst:629 +#: ../../library/zipfile.rst:654 msgid "" "The :pypi:`zipp` project provides backports of the latest path object " "functionality to older Pythons. Use ``zipp.Path`` in place of ``zipfile." "Path`` for early access to changes." msgstr "" -#: ../../library/zipfile.rst:637 +#: ../../library/zipfile.rst:662 msgid "PyZipFile Objects" msgstr "PyZipFile 物件" -#: ../../library/zipfile.rst:639 +#: ../../library/zipfile.rst:664 msgid "" "The :class:`PyZipFile` constructor takes the same parameters as the :class:" "`ZipFile` constructor, and one additional parameter, *optimize*." msgstr "" -#: ../../library/zipfile.rst:645 +#: ../../library/zipfile.rst:670 msgid "Added the *optimize* parameter." msgstr "新增 *optimize* 參數。" -#: ../../library/zipfile.rst:651 +#: ../../library/zipfile.rst:676 msgid "" "Instances have one method in addition to those of :class:`ZipFile` objects:" msgstr "" -#: ../../library/zipfile.rst:655 +#: ../../library/zipfile.rst:680 msgid "" "Search for files :file:`\\*.py` and add the corresponding file to the " "archive." msgstr "" -#: ../../library/zipfile.rst:658 +#: ../../library/zipfile.rst:683 msgid "" "If the *optimize* parameter to :class:`PyZipFile` was not given or ``-1``, " "the corresponding file is a :file:`\\*.pyc` file, compiling if necessary." msgstr "" -#: ../../library/zipfile.rst:661 +#: ../../library/zipfile.rst:686 msgid "" "If the *optimize* parameter to :class:`PyZipFile` was ``0``, ``1`` or ``2``, " "only files with that optimization level (see :func:`compile`) are added to " "the archive, compiling if necessary." msgstr "" -#: ../../library/zipfile.rst:665 +#: ../../library/zipfile.rst:690 msgid "" "If *pathname* is a file, the filename must end with :file:`.py`, and just " "the (corresponding :file:`\\*.pyc`) file is added at the top level (no path " @@ -800,11 +831,11 @@ msgid "" "in sorted order." msgstr "" -#: ../../library/zipfile.rst:675 +#: ../../library/zipfile.rst:700 msgid "*basename* is intended for internal use only." msgstr "" -#: ../../library/zipfile.rst:677 +#: ../../library/zipfile.rst:702 msgid "" "*filterfunc*, if given, must be a function taking a single string argument. " "It will be passed each path (including each individual full file path) " @@ -815,7 +846,7 @@ msgid "" "exclude them::" msgstr "" -#: ../../library/zipfile.rst:685 +#: ../../library/zipfile.rst:710 msgid "" ">>> zf = PyZipFile('myprog.zip')\n" ">>> def notests(s):\n" @@ -831,11 +862,11 @@ msgstr "" "...\n" ">>> zf.writepy('myprog', filterfunc=notests)" -#: ../../library/zipfile.rst:692 +#: ../../library/zipfile.rst:717 msgid "The :meth:`writepy` method makes archives with file names like this::" msgstr "" -#: ../../library/zipfile.rst:695 +#: ../../library/zipfile.rst:720 msgid "" "string.pyc # Top level name\n" "test/__init__.pyc # Package directory\n" @@ -844,302 +875,302 @@ msgid "" "test/bogus/myfile.pyc # Submodule test.bogus.myfile" msgstr "" -#: ../../library/zipfile.rst:701 +#: ../../library/zipfile.rst:726 msgid "Added the *filterfunc* parameter." msgstr "新增 *filterfunc* 參數。" -#: ../../library/zipfile.rst:704 +#: ../../library/zipfile.rst:729 msgid "The *pathname* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:707 +#: ../../library/zipfile.rst:732 msgid "Recursion sorts directory entries." msgstr "" -#: ../../library/zipfile.rst:714 +#: ../../library/zipfile.rst:739 msgid "ZipInfo Objects" msgstr "ZipInfo 物件" -#: ../../library/zipfile.rst:716 +#: ../../library/zipfile.rst:741 msgid "" "Instances of the :class:`ZipInfo` class are returned by the :meth:`.getinfo` " "and :meth:`.infolist` methods of :class:`ZipFile` objects. Each object " "stores information about a single member of the ZIP archive." msgstr "" -#: ../../library/zipfile.rst:720 +#: ../../library/zipfile.rst:745 msgid "" "There is one classmethod to make a :class:`ZipInfo` instance for a " "filesystem file:" msgstr "" -#: ../../library/zipfile.rst:726 +#: ../../library/zipfile.rst:751 msgid "" "Construct a :class:`ZipInfo` instance for a file on the filesystem, in " "preparation for adding it to a zip file." msgstr "" -#: ../../library/zipfile.rst:729 +#: ../../library/zipfile.rst:754 msgid "*filename* should be the path to a file or directory on the filesystem." msgstr "" -#: ../../library/zipfile.rst:731 +#: ../../library/zipfile.rst:756 msgid "" "If *arcname* is specified, it is used as the name within the archive. If " "*arcname* is not specified, the name will be the same as *filename*, but " "with any drive letter and leading path separators removed." msgstr "" -#: ../../library/zipfile.rst:743 +#: ../../library/zipfile.rst:768 msgid "The *filename* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:746 +#: ../../library/zipfile.rst:771 msgid "Added the *strict_timestamps* keyword-only parameter." msgstr "新增 *strict_timestamps* 僅限關鍵字參數。" -#: ../../library/zipfile.rst:750 +#: ../../library/zipfile.rst:775 msgid "Instances have the following methods and attributes:" msgstr "" -#: ../../library/zipfile.rst:754 +#: ../../library/zipfile.rst:779 msgid "Return ``True`` if this archive member is a directory." msgstr "" -#: ../../library/zipfile.rst:756 +#: ../../library/zipfile.rst:781 msgid "This uses the entry's name: directories should always end with ``/``." msgstr "" -#: ../../library/zipfile.rst:763 +#: ../../library/zipfile.rst:788 msgid "Name of the file in the archive." msgstr "" -#: ../../library/zipfile.rst:768 +#: ../../library/zipfile.rst:793 msgid "" "The time and date of the last modification to the archive member. This is a " "tuple of six values:" msgstr "" -#: ../../library/zipfile.rst:772 +#: ../../library/zipfile.rst:797 msgid "Index" msgstr "" -#: ../../library/zipfile.rst:772 +#: ../../library/zipfile.rst:797 msgid "Value" msgstr "" -#: ../../library/zipfile.rst:774 +#: ../../library/zipfile.rst:799 msgid "``0``" msgstr "``0``" -#: ../../library/zipfile.rst:774 +#: ../../library/zipfile.rst:799 msgid "Year (>= 1980)" msgstr "" -#: ../../library/zipfile.rst:776 +#: ../../library/zipfile.rst:801 msgid "``1``" msgstr "``1``" -#: ../../library/zipfile.rst:776 +#: ../../library/zipfile.rst:801 msgid "Month (one-based)" msgstr "" -#: ../../library/zipfile.rst:778 +#: ../../library/zipfile.rst:803 msgid "``2``" msgstr "``2``" -#: ../../library/zipfile.rst:778 +#: ../../library/zipfile.rst:803 msgid "Day of month (one-based)" msgstr "" -#: ../../library/zipfile.rst:780 +#: ../../library/zipfile.rst:805 msgid "``3``" msgstr "``3``" -#: ../../library/zipfile.rst:780 +#: ../../library/zipfile.rst:805 msgid "Hours (zero-based)" msgstr "" -#: ../../library/zipfile.rst:782 +#: ../../library/zipfile.rst:807 msgid "``4``" msgstr "``4``" -#: ../../library/zipfile.rst:782 +#: ../../library/zipfile.rst:807 msgid "Minutes (zero-based)" msgstr "" -#: ../../library/zipfile.rst:784 +#: ../../library/zipfile.rst:809 msgid "``5``" msgstr "``5``" -#: ../../library/zipfile.rst:784 +#: ../../library/zipfile.rst:809 msgid "Seconds (zero-based)" msgstr "" -#: ../../library/zipfile.rst:789 +#: ../../library/zipfile.rst:814 msgid "The ZIP file format does not support timestamps before 1980." msgstr "" -#: ../../library/zipfile.rst:794 +#: ../../library/zipfile.rst:819 msgid "Type of compression for the archive member." msgstr "" -#: ../../library/zipfile.rst:799 +#: ../../library/zipfile.rst:824 msgid "Comment for the individual archive member as a :class:`bytes` object." msgstr "" -#: ../../library/zipfile.rst:804 +#: ../../library/zipfile.rst:829 msgid "" "Expansion field data. The `PKZIP Application Note`_ contains some comments " "on the internal structure of the data contained in this :class:`bytes` " "object." msgstr "" -#: ../../library/zipfile.rst:811 +#: ../../library/zipfile.rst:836 msgid "System which created ZIP archive." msgstr "" -#: ../../library/zipfile.rst:816 +#: ../../library/zipfile.rst:841 msgid "PKZIP version which created ZIP archive." msgstr "" -#: ../../library/zipfile.rst:821 +#: ../../library/zipfile.rst:846 msgid "PKZIP version needed to extract archive." msgstr "" -#: ../../library/zipfile.rst:826 +#: ../../library/zipfile.rst:851 msgid "Must be zero." msgstr "" -#: ../../library/zipfile.rst:831 +#: ../../library/zipfile.rst:856 msgid "ZIP flag bits." msgstr "" -#: ../../library/zipfile.rst:836 +#: ../../library/zipfile.rst:861 msgid "Volume number of file header." msgstr "" -#: ../../library/zipfile.rst:841 +#: ../../library/zipfile.rst:866 msgid "Internal attributes." msgstr "" -#: ../../library/zipfile.rst:846 +#: ../../library/zipfile.rst:871 msgid "External file attributes." msgstr "" -#: ../../library/zipfile.rst:851 +#: ../../library/zipfile.rst:876 msgid "Byte offset to the file header." msgstr "" -#: ../../library/zipfile.rst:856 +#: ../../library/zipfile.rst:881 msgid "CRC-32 of the uncompressed file." msgstr "" -#: ../../library/zipfile.rst:861 +#: ../../library/zipfile.rst:886 msgid "Size of the compressed data." msgstr "" -#: ../../library/zipfile.rst:866 +#: ../../library/zipfile.rst:891 msgid "Size of the uncompressed file." msgstr "" -#: ../../library/zipfile.rst:873 +#: ../../library/zipfile.rst:898 msgid "Command-Line Interface" msgstr "" -#: ../../library/zipfile.rst:875 +#: ../../library/zipfile.rst:900 msgid "" "The :mod:`zipfile` module provides a simple command-line interface to " "interact with ZIP archives." msgstr "" -#: ../../library/zipfile.rst:878 +#: ../../library/zipfile.rst:903 msgid "" "If you want to create a new ZIP archive, specify its name after the :option:" "`-c` option and then list the filename(s) that should be included:" msgstr "" -#: ../../library/zipfile.rst:881 +#: ../../library/zipfile.rst:906 msgid "$ python -m zipfile -c monty.zip spam.txt eggs.txt" msgstr "$ python -m zipfile -c monty.zip spam.txt eggs.txt" -#: ../../library/zipfile.rst:885 +#: ../../library/zipfile.rst:910 msgid "Passing a directory is also acceptable:" msgstr "" -#: ../../library/zipfile.rst:887 +#: ../../library/zipfile.rst:912 msgid "$ python -m zipfile -c monty.zip life-of-brian_1979/" msgstr "$ python -m zipfile -c monty.zip life-of-brian_1979/" -#: ../../library/zipfile.rst:891 +#: ../../library/zipfile.rst:916 msgid "" "If you want to extract a ZIP archive into the specified directory, use the :" "option:`-e` option:" msgstr "" -#: ../../library/zipfile.rst:894 +#: ../../library/zipfile.rst:919 msgid "$ python -m zipfile -e monty.zip target-dir/" msgstr "$ python -m zipfile -e monty.zip target-dir/" -#: ../../library/zipfile.rst:898 +#: ../../library/zipfile.rst:923 msgid "For a list of the files in a ZIP archive, use the :option:`-l` option:" msgstr "" -#: ../../library/zipfile.rst:900 +#: ../../library/zipfile.rst:925 msgid "$ python -m zipfile -l monty.zip" msgstr "$ python -m zipfile -l monty.zip" -#: ../../library/zipfile.rst:906 +#: ../../library/zipfile.rst:931 msgid "Command-line options" msgstr "" -#: ../../library/zipfile.rst:911 +#: ../../library/zipfile.rst:936 msgid "List files in a zipfile." msgstr "" -#: ../../library/zipfile.rst:916 +#: ../../library/zipfile.rst:941 msgid "Create zipfile from source files." msgstr "" -#: ../../library/zipfile.rst:921 +#: ../../library/zipfile.rst:946 msgid "Extract zipfile into target directory." msgstr "" -#: ../../library/zipfile.rst:926 +#: ../../library/zipfile.rst:951 msgid "Test whether the zipfile is valid or not." msgstr "" -#: ../../library/zipfile.rst:930 +#: ../../library/zipfile.rst:955 msgid "" "Specify encoding of member names for :option:`-l`, :option:`-e` and :option:" "`-t`." msgstr "" -#: ../../library/zipfile.rst:937 +#: ../../library/zipfile.rst:962 msgid "Decompression pitfalls" msgstr "" -#: ../../library/zipfile.rst:939 +#: ../../library/zipfile.rst:964 msgid "" "The extraction in zipfile module might fail due to some pitfalls listed " "below." msgstr "" -#: ../../library/zipfile.rst:942 +#: ../../library/zipfile.rst:967 msgid "From file itself" msgstr "" -#: ../../library/zipfile.rst:944 +#: ../../library/zipfile.rst:969 msgid "" "Decompression may fail due to incorrect password / CRC checksum / ZIP format " "or unsupported compression method / decryption." msgstr "" -#: ../../library/zipfile.rst:948 +#: ../../library/zipfile.rst:973 msgid "File System limitations" msgstr "" -#: ../../library/zipfile.rst:950 +#: ../../library/zipfile.rst:975 msgid "" "Exceeding limitations on different file systems can cause decompression " "failed. Such as allowable characters in the directory entries, length of the " @@ -1147,33 +1178,33 @@ msgid "" "files, etc." msgstr "" -#: ../../library/zipfile.rst:957 +#: ../../library/zipfile.rst:982 msgid "Resources limitations" msgstr "" -#: ../../library/zipfile.rst:959 +#: ../../library/zipfile.rst:984 msgid "" "The lack of memory or disk volume would lead to decompression failed. For " "example, decompression bombs (aka `ZIP bomb`_) apply to zipfile library that " "can cause disk volume exhaustion." msgstr "" -#: ../../library/zipfile.rst:964 +#: ../../library/zipfile.rst:989 msgid "Interruption" msgstr "" -#: ../../library/zipfile.rst:966 +#: ../../library/zipfile.rst:991 msgid "" "Interruption during the decompression, such as pressing control-C or killing " "the decompression process may result in incomplete decompression of the " "archive." msgstr "" -#: ../../library/zipfile.rst:970 +#: ../../library/zipfile.rst:995 msgid "Default behaviors of extraction" msgstr "" -#: ../../library/zipfile.rst:972 +#: ../../library/zipfile.rst:997 msgid "" "Not knowing the default extraction behaviors can cause unexpected " "decompression results. For example, when extracting the same archive twice, " diff --git a/library/zipimport.po b/library/zipimport.po index b57334f240..f338c8d147 100644 --- a/library/zipimport.po +++ b/library/zipimport.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -57,26 +57,30 @@ msgid "" msgstr "" #: ../../library/zipimport.rst:33 +msgid "ZIP64 is supported" +msgstr "" + +#: ../../library/zipimport.rst:36 msgid "Previously, ZIP archives with an archive comment were not supported." msgstr "" -#: ../../library/zipimport.rst:38 +#: ../../library/zipimport.rst:41 msgid "" "`PKZIP Application Note <https://pkware.cachefly.net/webdocs/casestudies/" "APPNOTE.TXT>`_" msgstr "" -#: ../../library/zipimport.rst:39 +#: ../../library/zipimport.rst:42 msgid "" "Documentation on the ZIP file format by Phil Katz, the creator of the format " "and algorithms used." msgstr "" -#: ../../library/zipimport.rst:42 +#: ../../library/zipimport.rst:45 msgid ":pep:`273` - Import Modules from Zip Archives" msgstr "" -#: ../../library/zipimport.rst:43 +#: ../../library/zipimport.rst:46 msgid "" "Written by James C. Ahlstrom, who also provided an implementation. Python " "2.3 follows the specification in :pep:`273`, but uses an implementation " @@ -84,34 +88,34 @@ msgid "" "`302`." msgstr "" -#: ../../library/zipimport.rst:47 +#: ../../library/zipimport.rst:50 msgid ":mod:`importlib` - The implementation of the import machinery" msgstr "" -#: ../../library/zipimport.rst:48 +#: ../../library/zipimport.rst:51 msgid "" "Package providing the relevant protocols for all importers to implement." msgstr "" -#: ../../library/zipimport.rst:52 +#: ../../library/zipimport.rst:55 msgid "This module defines an exception:" msgstr "" -#: ../../library/zipimport.rst:56 +#: ../../library/zipimport.rst:59 msgid "" "Exception raised by zipimporter objects. It's a subclass of :exc:" "`ImportError`, so it can be caught as :exc:`ImportError`, too." msgstr "" -#: ../../library/zipimport.rst:63 +#: ../../library/zipimport.rst:66 msgid "zipimporter Objects" msgstr "zipimporter 物件" -#: ../../library/zipimport.rst:65 +#: ../../library/zipimport.rst:68 msgid ":class:`zipimporter` is the class for importing ZIP files." msgstr "" -#: ../../library/zipimport.rst:69 +#: ../../library/zipimport.rst:72 msgid "" "Create a new zipimporter instance. *archivepath* must be a path to a ZIP " "file, or to a specific path within a ZIP file. For example, an " @@ -120,114 +124,114 @@ msgid "" "exists)." msgstr "" -#: ../../library/zipimport.rst:74 +#: ../../library/zipimport.rst:77 msgid "" ":exc:`ZipImportError` is raised if *archivepath* doesn't point to a valid " "ZIP archive." msgstr "" -#: ../../library/zipimport.rst:79 +#: ../../library/zipimport.rst:82 msgid "" "Methods ``find_loader()`` and ``find_module()``, deprecated in 3.10 are now " "removed. Use :meth:`find_spec` instead." msgstr "" -#: ../../library/zipimport.rst:84 +#: ../../library/zipimport.rst:87 msgid "" "Implementation of :meth:`importlib.abc.Loader.create_module` that returns :" "const:`None` to explicitly request the default semantics." msgstr "" -#: ../../library/zipimport.rst:92 +#: ../../library/zipimport.rst:95 msgid "Implementation of :meth:`importlib.abc.Loader.exec_module`." msgstr "" -#: ../../library/zipimport.rst:99 +#: ../../library/zipimport.rst:102 msgid "An implementation of :meth:`importlib.abc.PathEntryFinder.find_spec`." msgstr "" -#: ../../library/zipimport.rst:106 +#: ../../library/zipimport.rst:109 msgid "" "Return the code object for the specified module. Raise :exc:`ZipImportError` " "if the module couldn't be imported." msgstr "" -#: ../../library/zipimport.rst:112 +#: ../../library/zipimport.rst:115 msgid "" "Return the data associated with *pathname*. Raise :exc:`OSError` if the file " "wasn't found." msgstr "" -#: ../../library/zipimport.rst:115 +#: ../../library/zipimport.rst:118 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "" -#: ../../library/zipimport.rst:121 +#: ../../library/zipimport.rst:124 msgid "" "Return the value ``__file__`` would be set to if the specified module was " "imported. Raise :exc:`ZipImportError` if the module couldn't be imported." msgstr "" -#: ../../library/zipimport.rst:130 +#: ../../library/zipimport.rst:133 msgid "" "Return the source code for the specified module. Raise :exc:`ZipImportError` " "if the module couldn't be found, return :const:`None` if the archive does " "contain the module, but has no source for it." msgstr "" -#: ../../library/zipimport.rst:138 +#: ../../library/zipimport.rst:141 msgid "" "Return ``True`` if the module specified by *fullname* is a package. Raise :" "exc:`ZipImportError` if the module couldn't be found." msgstr "" -#: ../../library/zipimport.rst:144 +#: ../../library/zipimport.rst:147 msgid "" "Load the module specified by *fullname*. *fullname* must be the fully " "qualified (dotted) module name. Returns the imported module on success, " "raises :exc:`ZipImportError` on failure." msgstr "" -#: ../../library/zipimport.rst:150 +#: ../../library/zipimport.rst:153 msgid "Use :meth:`exec_module` instead." msgstr "" -#: ../../library/zipimport.rst:155 +#: ../../library/zipimport.rst:158 msgid "" "Clear out the internal cache of information about files found within the ZIP " "archive." msgstr "" -#: ../../library/zipimport.rst:163 +#: ../../library/zipimport.rst:166 msgid "" "The file name of the importer's associated ZIP file, without a possible " "subpath." msgstr "" -#: ../../library/zipimport.rst:169 +#: ../../library/zipimport.rst:172 msgid "" "The subpath within the ZIP file where modules are searched. This is the " "empty string for zipimporter objects which point to the root of the ZIP file." msgstr "" -#: ../../library/zipimport.rst:173 +#: ../../library/zipimport.rst:176 msgid "" "The :attr:`archive` and :attr:`prefix` attributes, when combined with a " "slash, equal the original *archivepath* argument given to the :class:" "`zipimporter` constructor." msgstr "" -#: ../../library/zipimport.rst:181 +#: ../../library/zipimport.rst:184 msgid "Examples" msgstr "範例" -#: ../../library/zipimport.rst:183 +#: ../../library/zipimport.rst:186 msgid "" "Here is an example that imports a module from a ZIP archive - note that the :" "mod:`zipimport` module is not explicitly used." msgstr "" -#: ../../library/zipimport.rst:186 +#: ../../library/zipimport.rst:189 msgid "" "$ unzip -l example.zip\n" "Archive: example.zip\n" diff --git a/library/zoneinfo.po b/library/zoneinfo.po index f2782f72e7..3e5a4a6662 100644 --- a/library/zoneinfo.po +++ b/library/zoneinfo.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -55,14 +55,14 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability <availability>`: not Emscripten, not WASI." +msgid ":ref:`Availability <availability>`: not WASI." msgstr "" #: ../../includes/wasm-notavail.rst:5 +#, fuzzy msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" "或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/license.po b/license.po index 2024e8c7e0..de6467b90f 100644 --- a/license.po +++ b/license.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-06-27 09:40+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -264,6 +264,7 @@ msgid "PSF LICENSE AGREEMENT FOR PYTHON |release|" msgstr "用於 PYTHON |release| 的 PSF 授權合約" #: ../../license.rst:94 +#, fuzzy msgid "" "1. This LICENSE AGREEMENT is between the Python Software Foundation " "(\"PSF\"), and\n" @@ -282,7 +283,7 @@ msgid "" "derivative\n" " version, provided, however, that PSF's License Agreement and PSF's notice " "of\n" -" copyright, i.e., \"Copyright © 2001-2023 Python Software Foundation; All " +" copyright, i.e., \"Copyright © 2001-2024 Python Software Foundation; All " "Rights\n" " Reserved\" are retained in Python |release| alone or in any derivative " "version\n" @@ -1194,7 +1195,8 @@ msgid "UUencode and UUdecode functions" msgstr "UUencode 與 UUdecode 函式" #: ../../license.rst:479 -msgid "The :mod:`uu` module contains the following notice::" +#, fuzzy +msgid "The ``uu`` codec contains the following notice::" msgstr ":mod:`uu` 模組包含以下聲明: ::" #: ../../license.rst:481 @@ -1552,13 +1554,14 @@ msgid "OpenSSL" msgstr "OpenSSL" #: ../../license.rst:658 +#, fuzzy msgid "" -"The modules :mod:`hashlib`, :mod:`posix`, :mod:`ssl`, :mod:`crypt` use the " -"OpenSSL library for added performance if made available by the operating " -"system. Additionally, the Windows and macOS installers for Python may " -"include a copy of the OpenSSL libraries, so we include a copy of the OpenSSL " -"license here. For the OpenSSL 3.0 release, and later releases derived from " -"that, the Apache License v2 applies::" +"The modules :mod:`hashlib`, :mod:`posix` and :mod:`ssl` use the OpenSSL " +"library for added performance if made available by the operating system. " +"Additionally, the Windows and macOS installers for Python may include a copy " +"of the OpenSSL libraries, so we include a copy of the OpenSSL license here. " +"For the OpenSSL 3.0 release, and later releases derived from that, the " +"Apache License v2 applies::" msgstr "" "如果 OpenSSL 函式庫可被作業系統使用,則 :mod:`hashlib`、:mod:`posix`、:mod:" "`ssl`、:mod:`crypt` 模組會使用它來提升效能。此外,因為 Windows 和 macOS 的 " @@ -2321,62 +2324,70 @@ msgstr "" "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n" "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -#: ../../license.rst:1046 -msgid "Audioop" -msgstr "Audioop" - #: ../../license.rst:1048 -msgid "" -"The audioop module uses the code base in g771.c file of the SoX project. " -"https://sourceforge.net/projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz" -msgstr "" -"audioop 模組使用 SoX 專案的 g771.c 檔案中的程式碼。 https://sourceforge.net/" -"projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz" - -#: ../../license.rst:1051 -msgid "" -"This source code is a product of Sun Microsystems, Inc. and is provided for " -"unrestricted use. Users may copy or modify this source code without charge." -msgstr "" - -#: ../../license.rst:1055 -msgid "" -"SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING " -"THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR " -"PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE." -msgstr "" - -#: ../../license.rst:1059 -msgid "" -"Sun source code is provided with no support and without any obligation on " -"the part of Sun Microsystems, Inc. to assist in its use, correction, " -"modification or enhancement." +msgid "mimalloc" msgstr "" -#: ../../license.rst:1063 -msgid "" -"SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE " -"INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE OR " -"ANY PART THEREOF." -msgstr "" - -#: ../../license.rst:1067 -msgid "" -"In no event will Sun Microsystems, Inc. be liable for any lost revenue or " -"profits or other special, indirect and consequential damages, even if Sun " -"has been advised of the possibility of such damages." +#: ../../license.rst:1050 +msgid "MIT License::" msgstr "" -#: ../../license.rst:1071 +#: ../../license.rst:1052 +#, fuzzy msgid "" -"Sun Microsystems, Inc. 2550 Garcia Avenue Mountain View, California 94043" +"Copyright (c) 2018-2021 Microsoft Corporation, Daan Leijen\n" +"\n" +"Permission is hereby granted, free of charge, to any person obtaining a " +"copy\n" +"of this software and associated documentation files (the \"Software\"), to " +"deal\n" +"in the Software without restriction, including without limitation the " +"rights\n" +"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n" +"copies of the Software, and to permit persons to whom the Software is\n" +"furnished to do so, subject to the following conditions:\n" +"\n" +"The above copyright notice and this permission notice shall be included in " +"all\n" +"copies or substantial portions of the Software.\n" +"\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS " +"OR\n" +"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n" +"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n" +"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n" +"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING " +"FROM,\n" +"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN " +"THE\n" +"SOFTWARE." msgstr "" +"Copyright (c) 2001-2006 Twisted Matrix Laboratories.\n" +"\n" +"Permission is hereby granted, free of charge, to any person obtaining\n" +"a copy of this software and associated documentation files (the\n" +"\"Software\"), to deal in the Software without restriction, including\n" +"without limitation the rights to use, copy, modify, merge, publish,\n" +"distribute, sublicense, and/or sell copies of the Software, and to\n" +"permit persons to whom the Software is furnished to do so, subject to\n" +"the following conditions:\n" +"\n" +"The above copyright notice and this permission notice shall be\n" +"included in all copies or substantial portions of the Software.\n" +"\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" +"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" +"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" +"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n" +"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n" +"OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" +"WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." -#: ../../license.rst:1077 +#: ../../license.rst:1074 msgid "asyncio" msgstr "asyncio" -#: ../../license.rst:1079 +#: ../../license.rst:1076 msgid "" "Parts of the :mod:`asyncio` module are incorporated from `uvloop 0.16 " "<https://github.com/MagicStack/uvloop/tree/v0.16.0>`_, which is distributed " @@ -2385,7 +2396,7 @@ msgstr "" ":mod:`asyncio` 模組的部分內容是從 `uvloop 0.16 <https://github.com/" "MagicStack/uvloop/tree/v0.16.0>`_ 中收錄過來,其基於 MIT 授權來發佈: ::" -#: ../../license.rst:1083 +#: ../../license.rst:1080 msgid "" "Copyright (c) 2015-2021 MagicStack Inc. http://magic.io\n" "\n" @@ -2428,3 +2439,76 @@ msgstr "" "LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n" "OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" "WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." + +#: ../../license.rst:1103 +msgid "Global Unbounded Sequences (GUS)" +msgstr "" + +#: ../../license.rst:1105 +msgid "" +"The file :file:`Python/qsbr.c` is adapted from FreeBSD's \"Global Unbounded " +"Sequences\" safe memory reclamation scheme in `subr_smr.c <https://github." +"com/freebsd/freebsd-src/blob/main/sys/kern/subr_smr.c>`_. The file is " +"distributed under the 2-Clause BSD License::" +msgstr "" + +#: ../../license.rst:1110 +#, fuzzy +msgid "" +"Copyright (c) 2019,2020 Jeffrey Roberson <jeff@FreeBSD.org>\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice unmodified, this list of conditions, and the following\n" +" disclaimer.\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n" +"IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n" +"OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n" +"IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n" +"INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n" +"NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n" +"DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n" +"THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" +"(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n" +"THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +msgstr "" +"Copyright (c) 2008-2020 Stefan Krah. All rights reserved.\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS \"AS IS\" AND\n" +"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" +"ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" +"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" +"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" +"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" +"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" +"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" +"SUCH DAMAGE." + +#~ msgid "Audioop" +#~ msgstr "Audioop" + +#~ msgid "" +#~ "The audioop module uses the code base in g771.c file of the SoX project. " +#~ "https://sourceforge.net/projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz" +#~ msgstr "" +#~ "audioop 模組使用 SoX 專案的 g771.c 檔案中的程式碼。 https://sourceforge." +#~ "net/projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz" diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index 84bb0863bb..442b455961 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1543,7 +1543,7 @@ msgid ":class:`int`" msgstr ":class:`int`" #: ../../reference/compound_stmts.rst:1160 -#: ../../reference/compound_stmts.rst:1857 +#: ../../reference/compound_stmts.rst:1872 msgid ":class:`list`" msgstr ":class:`list`" @@ -1556,7 +1556,7 @@ msgid ":class:`str`" msgstr ":class:`str`" #: ../../reference/compound_stmts.rst:1163 -#: ../../reference/compound_stmts.rst:1860 +#: ../../reference/compound_stmts.rst:1875 msgid ":class:`tuple`" msgstr ":class:`tuple`" @@ -2164,14 +2164,18 @@ msgstr "" msgid "Type parameter lists" msgstr "" -#: ../../reference/compound_stmts.rst:1634 +#: ../../reference/compound_stmts.rst:1624 +msgid "Support for default values was added (see :pep:`696`)." +msgstr "" + +#: ../../reference/compound_stmts.rst:1637 msgid "" ":ref:`Functions <def>` (including :ref:`coroutines <async def>`), :ref:" "`classes <class>` and :ref:`type aliases <type>` may contain a type " "parameter list::" msgstr "" -#: ../../reference/compound_stmts.rst:1638 +#: ../../reference/compound_stmts.rst:1641 msgid "" "def max[T](args: list[T]) -> T:\n" " ...\n" @@ -2203,7 +2207,7 @@ msgstr "" "\n" "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1653 +#: ../../reference/compound_stmts.rst:1656 msgid "" "Semantically, this indicates that the function, class, or type alias is " "generic over a type variable. This information is primarily used by static " @@ -2211,7 +2215,7 @@ msgid "" "generic counterparts." msgstr "" -#: ../../reference/compound_stmts.rst:1658 +#: ../../reference/compound_stmts.rst:1661 msgid "" "Type parameters are declared in square brackets (``[]``) immediately after " "the name of the function, class, or type alias. The type parameters are " @@ -2223,36 +2227,36 @@ msgid "" "wraps the creation of the generic object." msgstr "" -#: ../../reference/compound_stmts.rst:1667 +#: ../../reference/compound_stmts.rst:1670 msgid "" "Generic functions, classes, and type aliases have a :attr:`!__type_params__` " "attribute listing their type parameters." msgstr "" -#: ../../reference/compound_stmts.rst:1670 +#: ../../reference/compound_stmts.rst:1673 msgid "Type parameters come in three kinds:" msgstr "" -#: ../../reference/compound_stmts.rst:1672 +#: ../../reference/compound_stmts.rst:1675 msgid "" ":data:`typing.TypeVar`, introduced by a plain name (e.g., ``T``). " "Semantically, this represents a single type to a type checker." msgstr "" -#: ../../reference/compound_stmts.rst:1674 +#: ../../reference/compound_stmts.rst:1677 msgid "" ":data:`typing.TypeVarTuple`, introduced by a name prefixed with a single " "asterisk (e.g., ``*Ts``). Semantically, this stands for a tuple of any " "number of types." msgstr "" -#: ../../reference/compound_stmts.rst:1677 +#: ../../reference/compound_stmts.rst:1680 msgid "" ":data:`typing.ParamSpec`, introduced by a name prefixed with two asterisks " "(e.g., ``**P``). Semantically, this stands for the parameters of a callable." msgstr "" -#: ../../reference/compound_stmts.rst:1680 +#: ../../reference/compound_stmts.rst:1683 msgid "" ":data:`typing.TypeVar` declarations can define *bounds* and *constraints* " "with a colon (``:``) followed by an expression. A single expression after " @@ -2264,7 +2268,7 @@ msgid "" "variables can only take on one of the types in the list of constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1689 +#: ../../reference/compound_stmts.rst:1692 msgid "" "For :data:`!typing.TypeVar`\\ s declared using the type parameter list " "syntax, the bound and constraints are not evaluated when the generic object " @@ -2274,63 +2278,81 @@ msgid "" "<annotation-scopes>`." msgstr "" -#: ../../reference/compound_stmts.rst:1695 +#: ../../reference/compound_stmts.rst:1698 msgid "" ":data:`typing.TypeVarTuple`\\ s and :data:`typing.ParamSpec`\\ s cannot have " "bounds or constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1698 +#: ../../reference/compound_stmts.rst:1701 +msgid "" +"All three flavors of type parameters can also have a *default value*, which " +"is used when the type parameter is not explicitly provided. This is added by " +"appending a single equals sign (``=``) followed by an expression. Like the " +"bounds and constraints of type variables, the default value is not evaluated " +"when the object is created, but only when the type parameter's " +"``__default__`` attribute is accessed. To this end, the default value is " +"evaluated in a separate :ref:`annotation scope <annotation-scopes>`. If no " +"default value is specified for a type parameter, the ``__default__`` " +"attribute is set to the special sentinel object :data:`typing.NoDefault`." +msgstr "" + +#: ../../reference/compound_stmts.rst:1711 msgid "" "The following example indicates the full set of allowed type parameter " "declarations::" msgstr "" -#: ../../reference/compound_stmts.rst:1700 +#: ../../reference/compound_stmts.rst:1713 msgid "" "def overly_generic[\n" " SimpleTypeVar,\n" +" TypeVarWithDefault = int,\n" " TypeVarWithBound: int,\n" " TypeVarWithConstraints: (str, bytes),\n" -" *SimpleTypeVarTuple,\n" -" **SimpleParamSpec,\n" +" *SimpleTypeVarTuple = (int, float),\n" +" **SimpleParamSpec = (str, bytearray),\n" "](\n" " a: SimpleTypeVar,\n" -" b: TypeVarWithBound,\n" -" c: Callable[SimpleParamSpec, TypeVarWithConstraints],\n" -" *d: SimpleTypeVarTuple,\n" +" b: TypeVarWithDefault,\n" +" c: TypeVarWithBound,\n" +" d: Callable[SimpleParamSpec, TypeVarWithConstraints],\n" +" *e: SimpleTypeVarTuple,\n" "): ..." msgstr "" "def overly_generic[\n" " SimpleTypeVar,\n" +" TypeVarWithDefault = int,\n" " TypeVarWithBound: int,\n" " TypeVarWithConstraints: (str, bytes),\n" -" *SimpleTypeVarTuple,\n" -" **SimpleParamSpec,\n" +" *SimpleTypeVarTuple = (int, float),\n" +" **SimpleParamSpec = (str, bytearray),\n" "](\n" " a: SimpleTypeVar,\n" -" b: TypeVarWithBound,\n" -" c: Callable[SimpleParamSpec, TypeVarWithConstraints],\n" -" *d: SimpleTypeVarTuple,\n" +" b: TypeVarWithDefault,\n" +" c: TypeVarWithBound,\n" +" d: Callable[SimpleParamSpec, TypeVarWithConstraints],\n" +" *e: SimpleTypeVarTuple,\n" +"): ..." -#: ../../reference/compound_stmts.rst:1716 +#: ../../reference/compound_stmts.rst:1731 msgid "Generic functions" msgstr "" -#: ../../reference/compound_stmts.rst:1718 +#: ../../reference/compound_stmts.rst:1733 msgid "Generic functions are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1720 +#: ../../reference/compound_stmts.rst:1735 msgid "def func[T](arg: T): ..." msgstr "def func[T](arg: T): ..." -#: ../../reference/compound_stmts.rst:1722 -#: ../../reference/compound_stmts.rst:1782 +#: ../../reference/compound_stmts.rst:1737 +#: ../../reference/compound_stmts.rst:1797 msgid "This syntax is equivalent to::" msgstr "語法大致等價於: ::" -#: ../../reference/compound_stmts.rst:1724 +#: ../../reference/compound_stmts.rst:1739 msgid "" "annotation-def TYPE_PARAMS_OF_func():\n" " T = typing.TypeVar(\"T\")\n" @@ -2346,7 +2368,7 @@ msgstr "" " return func\n" "func = TYPE_PARAMS_OF_func()" -#: ../../reference/compound_stmts.rst:1731 +#: ../../reference/compound_stmts.rst:1746 msgid "" "Here ``annotation-def`` indicates an :ref:`annotation scope <annotation-" "scopes>`, which is not actually bound to any name at runtime. (One other " @@ -2355,20 +2377,20 @@ msgid "" "data:`typing.TypeVar` directly.)" msgstr "" -#: ../../reference/compound_stmts.rst:1737 +#: ../../reference/compound_stmts.rst:1752 msgid "" "The annotations of generic functions are evaluated within the annotation " "scope used for declaring the type parameters, but the function's defaults " "and decorators are not." msgstr "" -#: ../../reference/compound_stmts.rst:1741 +#: ../../reference/compound_stmts.rst:1756 msgid "" "The following example illustrates the scoping rules for these cases, as well " "as for additional flavors of type parameters::" msgstr "" -#: ../../reference/compound_stmts.rst:1744 +#: ../../reference/compound_stmts.rst:1759 msgid "" "@decorator\n" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" @@ -2378,13 +2400,13 @@ msgstr "" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" " ..." -#: ../../reference/compound_stmts.rst:1748 +#: ../../reference/compound_stmts.rst:1763 msgid "" "Except for the :ref:`lazy evaluation <lazy-evaluation>` of the :class:" "`~typing.TypeVar` bound, this is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1751 +#: ../../reference/compound_stmts.rst:1766 msgid "" "DEFAULT_OF_arg = some_default\n" "\n" @@ -2406,25 +2428,25 @@ msgid "" "func = decorator(TYPE_PARAMS_OF_func())" msgstr "" -#: ../../reference/compound_stmts.rst:1770 +#: ../../reference/compound_stmts.rst:1785 msgid "" "The capitalized names like ``DEFAULT_OF_arg`` are not actually bound at " "runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1776 +#: ../../reference/compound_stmts.rst:1791 msgid "Generic classes" msgstr "" -#: ../../reference/compound_stmts.rst:1778 +#: ../../reference/compound_stmts.rst:1793 msgid "Generic classes are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1780 +#: ../../reference/compound_stmts.rst:1795 msgid "class Bag[T]: ..." msgstr "class Bag[T]: ..." -#: ../../reference/compound_stmts.rst:1784 +#: ../../reference/compound_stmts.rst:1799 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2442,14 +2464,14 @@ msgstr "" " return Bag\n" "Bag = TYPE_PARAMS_OF_Bag()" -#: ../../reference/compound_stmts.rst:1792 +#: ../../reference/compound_stmts.rst:1807 msgid "" "Here again ``annotation-def`` (not a real keyword) indicates an :ref:" "`annotation scope <annotation-scopes>`, and the name ``TYPE_PARAMS_OF_Bag`` " "is not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1796 +#: ../../reference/compound_stmts.rst:1811 msgid "" "Generic classes implicitly inherit from :data:`typing.Generic`. The base " "classes and keyword arguments of generic classes are evaluated within the " @@ -2457,7 +2479,7 @@ msgid "" "that scope. This is illustrated by this example::" msgstr "" -#: ../../reference/compound_stmts.rst:1802 +#: ../../reference/compound_stmts.rst:1817 msgid "" "@decorator\n" "class Bag(Base[T], arg=T): ..." @@ -2465,11 +2487,11 @@ msgstr "" "@decorator\n" "class Bag(Base[T], arg=T): ..." -#: ../../reference/compound_stmts.rst:1805 +#: ../../reference/compound_stmts.rst:1820 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../reference/compound_stmts.rst:1807 +#: ../../reference/compound_stmts.rst:1822 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2487,27 +2509,27 @@ msgstr "" " return Bag\n" "Bag = decorator(TYPE_PARAMS_OF_Bag())" -#: ../../reference/compound_stmts.rst:1818 +#: ../../reference/compound_stmts.rst:1833 msgid "Generic type aliases" msgstr "" -#: ../../reference/compound_stmts.rst:1820 +#: ../../reference/compound_stmts.rst:1835 msgid "" "The :keyword:`type` statement can also be used to create a generic type " "alias::" msgstr "" -#: ../../reference/compound_stmts.rst:1822 +#: ../../reference/compound_stmts.rst:1837 msgid "type ListOrSet[T] = list[T] | set[T]" msgstr "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1824 +#: ../../reference/compound_stmts.rst:1839 msgid "" "Except for the :ref:`lazy evaluation <lazy-evaluation>` of the value, this " "is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1827 +#: ../../reference/compound_stmts.rst:1842 msgid "" "annotation-def TYPE_PARAMS_OF_ListOrSet():\n" " T = typing.TypeVar(\"T\")\n" @@ -2520,105 +2542,105 @@ msgid "" "ListOrSet = TYPE_PARAMS_OF_ListOrSet()" msgstr "" -#: ../../reference/compound_stmts.rst:1836 +#: ../../reference/compound_stmts.rst:1851 msgid "" "Here, ``annotation-def`` (not a real keyword) indicates an :ref:`annotation " "scope <annotation-scopes>`. The capitalized names like " "``TYPE_PARAMS_OF_ListOrSet`` are not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1841 +#: ../../reference/compound_stmts.rst:1856 msgid "Footnotes" msgstr "註解" -#: ../../reference/compound_stmts.rst:1842 +#: ../../reference/compound_stmts.rst:1857 msgid "" "The exception is propagated to the invocation stack unless there is a :" "keyword:`finally` clause which happens to raise another exception. That new " "exception causes the old one to be lost." msgstr "" -#: ../../reference/compound_stmts.rst:1846 +#: ../../reference/compound_stmts.rst:1861 msgid "In pattern matching, a sequence is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1848 +#: ../../reference/compound_stmts.rst:1863 msgid "a class that inherits from :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1849 +#: ../../reference/compound_stmts.rst:1864 msgid "" "a Python class that has been registered as :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1850 +#: ../../reference/compound_stmts.rst:1865 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_SEQUENCE` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1851 -#: ../../reference/compound_stmts.rst:1870 +#: ../../reference/compound_stmts.rst:1866 +#: ../../reference/compound_stmts.rst:1885 msgid "a class that inherits from any of the above" msgstr "" -#: ../../reference/compound_stmts.rst:1853 +#: ../../reference/compound_stmts.rst:1868 msgid "The following standard library classes are sequences:" msgstr "" -#: ../../reference/compound_stmts.rst:1855 +#: ../../reference/compound_stmts.rst:1870 msgid ":class:`array.array`" msgstr ":class:`array.array`" -#: ../../reference/compound_stmts.rst:1856 +#: ../../reference/compound_stmts.rst:1871 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../reference/compound_stmts.rst:1858 +#: ../../reference/compound_stmts.rst:1873 msgid ":class:`memoryview`" msgstr ":class:`memoryview`" -#: ../../reference/compound_stmts.rst:1859 +#: ../../reference/compound_stmts.rst:1874 msgid ":class:`range`" msgstr ":class:`range`" -#: ../../reference/compound_stmts.rst:1862 +#: ../../reference/compound_stmts.rst:1877 msgid "" "Subject values of type ``str``, ``bytes``, and ``bytearray`` do not match " "sequence patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1865 +#: ../../reference/compound_stmts.rst:1880 msgid "In pattern matching, a mapping is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1867 +#: ../../reference/compound_stmts.rst:1882 msgid "a class that inherits from :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1868 +#: ../../reference/compound_stmts.rst:1883 msgid "" "a Python class that has been registered as :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1869 +#: ../../reference/compound_stmts.rst:1884 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_MAPPING` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1872 +#: ../../reference/compound_stmts.rst:1887 msgid "" "The standard library classes :class:`dict` and :class:`types." "MappingProxyType` are mappings." msgstr "" -#: ../../reference/compound_stmts.rst:1875 +#: ../../reference/compound_stmts.rst:1890 msgid "" "A string literal appearing as the first statement in the function body is " "transformed into the function's :attr:`~function.__doc__` attribute and " "therefore the function's :term:`docstring`." msgstr "" -#: ../../reference/compound_stmts.rst:1879 +#: ../../reference/compound_stmts.rst:1894 msgid "" "A string literal appearing as the first statement in the class body is " "transformed into the namespace's ``__doc__`` item and therefore the class's :" @@ -3025,6 +3047,6 @@ msgstr "async for" msgid "async with" msgstr "async with" -#: ../../reference/compound_stmts.rst:1624 +#: ../../reference/compound_stmts.rst:1627 msgid "type parameters" msgstr "type parameter(型別參數)" diff --git a/reference/datamodel.po b/reference/datamodel.po index 6126e7c52e..d9ac935995 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -604,8 +604,8 @@ msgid "" "containing the same number of items as the function's formal parameter list." msgstr "" -#: ../../reference/datamodel.rst:545 ../../reference/datamodel.rst:1124 -#: ../../reference/datamodel.rst:1319 +#: ../../reference/datamodel.rst:545 ../../reference/datamodel.rst:1133 +#: ../../reference/datamodel.rst:1330 msgid "Special read-only attributes" msgstr "特殊唯讀屬性" @@ -636,7 +636,7 @@ msgid "" "the value of the cell, as well as set the value." msgstr "" -#: ../../reference/datamodel.rst:571 ../../reference/datamodel.rst:1356 +#: ../../reference/datamodel.rst:571 ../../reference/datamodel.rst:1372 msgid "Special writable attributes" msgstr "特殊可寫屬性" @@ -738,7 +738,7 @@ msgid "" "callable object (normally a user-defined function)." msgstr "" -#: ../../reference/datamodel.rst:676 ../../reference/datamodel.rst:1447 +#: ../../reference/datamodel.rst:676 ../../reference/datamodel.rst:1468 msgid "Special read-only attributes:" msgstr "特殊唯讀屬性:" @@ -991,7 +991,7 @@ msgstr ":attr:`__name__`" msgid "The module's name." msgstr "" -#: ../../reference/datamodel.rst:888 ../../reference/datamodel.rst:986 +#: ../../reference/datamodel.rst:888 ../../reference/datamodel.rst:988 msgid ":attr:`__doc__`" msgstr ":attr:`__doc__`" @@ -1012,7 +1012,7 @@ msgid "" "library, it's the pathname of the shared library file." msgstr "" -#: ../../reference/datamodel.rst:901 ../../reference/datamodel.rst:989 +#: ../../reference/datamodel.rst:901 ../../reference/datamodel.rst:991 msgid ":attr:`__annotations__`" msgstr ":attr:`__annotations__`" @@ -1079,70 +1079,92 @@ msgid "" "below)." msgstr "" -#: ../../reference/datamodel.rst:971 +#: ../../reference/datamodel.rst:973 msgid "Special attributes:" msgstr "" -#: ../../reference/datamodel.rst:973 +#: ../../reference/datamodel.rst:975 msgid ":attr:`~definition.__name__`" msgstr ":attr:`~definition.__name__`" -#: ../../reference/datamodel.rst:974 +#: ../../reference/datamodel.rst:976 msgid "The class name." msgstr "" -#: ../../reference/datamodel.rst:976 +#: ../../reference/datamodel.rst:978 msgid ":attr:`__module__`" msgstr ":attr:`__module__`" -#: ../../reference/datamodel.rst:977 +#: ../../reference/datamodel.rst:979 msgid "The name of the module in which the class was defined." msgstr "" -#: ../../reference/datamodel.rst:979 +#: ../../reference/datamodel.rst:981 msgid ":attr:`~object.__dict__`" msgstr ":attr:`~object.__dict__`" -#: ../../reference/datamodel.rst:980 +#: ../../reference/datamodel.rst:982 msgid "The dictionary containing the class's namespace." msgstr "" -#: ../../reference/datamodel.rst:982 +#: ../../reference/datamodel.rst:984 msgid ":attr:`~class.__bases__`" msgstr ":attr:`~class.__bases__`" -#: ../../reference/datamodel.rst:983 +#: ../../reference/datamodel.rst:985 msgid "" "A tuple containing the base classes, in the order of their occurrence in the " "base class list." msgstr "" -#: ../../reference/datamodel.rst:987 +#: ../../reference/datamodel.rst:989 msgid "The class's documentation string, or ``None`` if undefined." msgstr "" -#: ../../reference/datamodel.rst:990 +#: ../../reference/datamodel.rst:992 msgid "" "A dictionary containing :term:`variable annotations <variable annotation>` " "collected during class body execution. For best practices on working with :" "attr:`__annotations__`, please see :ref:`annotations-howto`." msgstr "" -#: ../../reference/datamodel.rst:996 +#: ../../reference/datamodel.rst:998 msgid ":attr:`__type_params__`" msgstr ":attr:`__type_params__`" -#: ../../reference/datamodel.rst:997 +#: ../../reference/datamodel.rst:999 msgid "" "A tuple containing the :ref:`type parameters <type-params>` of a :ref:" "`generic class <generic-classes>`." msgstr "" #: ../../reference/datamodel.rst:1002 +#, fuzzy +msgid ":attr:`~class.__static_attributes__`" +msgstr ":attr:`~class.__bases__`" + +#: ../../reference/datamodel.rst:1003 +msgid "" +"A tuple containing names of attributes of this class which are assigned " +"through ``self.X`` from any function in its body." +msgstr "" + +#: ../../reference/datamodel.rst:1006 +#, fuzzy +msgid ":attr:`__firstlineno__`" +msgstr ":attr:`__file__`" + +#: ../../reference/datamodel.rst:1007 +msgid "" +"The line number of the first line of the class definition, including " +"decorators." +msgstr "" + +#: ../../reference/datamodel.rst:1011 msgid "Class instances" msgstr "" -#: ../../reference/datamodel.rst:1010 +#: ../../reference/datamodel.rst:1019 msgid "" "A class instance is created by calling a class object (see above). A class " "instance has a namespace implemented as a dictionary which is the first " @@ -1159,7 +1181,7 @@ msgid "" "__getattr__` method, that is called to satisfy the lookup." msgstr "" -#: ../../reference/datamodel.rst:1026 +#: ../../reference/datamodel.rst:1035 msgid "" "Attribute assignments and deletions update the instance's dictionary, never " "a class's dictionary. If the class has a :meth:`~object.__setattr__` or :" @@ -1167,23 +1189,23 @@ msgid "" "instance dictionary directly." msgstr "" -#: ../../reference/datamodel.rst:1036 +#: ../../reference/datamodel.rst:1045 msgid "" "Class instances can pretend to be numbers, sequences, or mappings if they " "have methods with certain special names. See section :ref:`specialnames`." msgstr "" -#: ../../reference/datamodel.rst:1043 +#: ../../reference/datamodel.rst:1052 msgid "" "Special attributes: :attr:`~object.__dict__` is the attribute dictionary; :" "attr:`~instance.__class__` is the instance's class." msgstr "" -#: ../../reference/datamodel.rst:1048 +#: ../../reference/datamodel.rst:1057 msgid "I/O objects (also known as file objects)" msgstr "" -#: ../../reference/datamodel.rst:1063 +#: ../../reference/datamodel.rst:1072 msgid "" "A :term:`file object` represents an open file. Various shortcuts are " "available to create file objects: the :func:`open` built-in function, and " @@ -1192,7 +1214,7 @@ msgid "" "methods provided by extension modules)." msgstr "" -#: ../../reference/datamodel.rst:1069 +#: ../../reference/datamodel.rst:1078 msgid "" "The objects ``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` are initialized " "to file objects corresponding to the interpreter's standard input, output " @@ -1200,22 +1222,22 @@ msgid "" "interface defined by the :class:`io.TextIOBase` abstract class." msgstr "" -#: ../../reference/datamodel.rst:1077 +#: ../../reference/datamodel.rst:1086 msgid "Internal types" msgstr "" -#: ../../reference/datamodel.rst:1083 +#: ../../reference/datamodel.rst:1092 msgid "" "A few types used internally by the interpreter are exposed to the user. " "Their definitions may change with future versions of the interpreter, but " "they are mentioned here for completeness." msgstr "" -#: ../../reference/datamodel.rst:1091 +#: ../../reference/datamodel.rst:1100 msgid "Code objects" msgstr "" -#: ../../reference/datamodel.rst:1095 +#: ../../reference/datamodel.rst:1104 msgid "" "Code objects represent *byte-compiled* executable Python code, or :term:" "`bytecode`. The difference between a code object and a function object is " @@ -1227,103 +1249,103 @@ msgid "" "no references (directly or indirectly) to mutable objects." msgstr "" -#: ../../reference/datamodel.rst:1129 +#: ../../reference/datamodel.rst:1138 msgid "The function name" msgstr "函式名稱" -#: ../../reference/datamodel.rst:1132 +#: ../../reference/datamodel.rst:1141 msgid "The fully qualified function name" msgstr "" -#: ../../reference/datamodel.rst:1137 +#: ../../reference/datamodel.rst:1146 msgid "" "The total number of positional :term:`parameters <parameter>` (including " "positional-only parameters and parameters with default values) that the " "function has" msgstr "" -#: ../../reference/datamodel.rst:1142 +#: ../../reference/datamodel.rst:1151 msgid "" "The number of positional-only :term:`parameters <parameter>` (including " "arguments with default values) that the function has" msgstr "" -#: ../../reference/datamodel.rst:1146 +#: ../../reference/datamodel.rst:1155 msgid "" "The number of keyword-only :term:`parameters <parameter>` (including " "arguments with default values) that the function has" msgstr "" -#: ../../reference/datamodel.rst:1150 +#: ../../reference/datamodel.rst:1159 msgid "" "The number of :ref:`local variables <naming>` used by the function " "(including parameters)" msgstr "" -#: ../../reference/datamodel.rst:1154 +#: ../../reference/datamodel.rst:1163 msgid "" "A :class:`tuple` containing the names of the local variables in the function " "(starting with the parameter names)" msgstr "" -#: ../../reference/datamodel.rst:1158 +#: ../../reference/datamodel.rst:1167 msgid "" "A :class:`tuple` containing the names of :ref:`local variables <naming>` " "that are referenced by nested functions inside the function" msgstr "" -#: ../../reference/datamodel.rst:1162 +#: ../../reference/datamodel.rst:1171 msgid "A :class:`tuple` containing the names of free variables in the function" msgstr "" -#: ../../reference/datamodel.rst:1165 +#: ../../reference/datamodel.rst:1174 msgid "" "A string representing the sequence of :term:`bytecode` instructions in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1169 +#: ../../reference/datamodel.rst:1178 msgid "" "A :class:`tuple` containing the literals used by the :term:`bytecode` in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1173 +#: ../../reference/datamodel.rst:1182 msgid "" "A :class:`tuple` containing the names used by the :term:`bytecode` in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1177 +#: ../../reference/datamodel.rst:1186 msgid "The name of the file from which the code was compiled" msgstr "" -#: ../../reference/datamodel.rst:1180 +#: ../../reference/datamodel.rst:1189 msgid "The line number of the first line of the function" msgstr "" -#: ../../reference/datamodel.rst:1183 +#: ../../reference/datamodel.rst:1192 msgid "" "A string encoding the mapping from :term:`bytecode` offsets to line numbers. " "For details, see the source code of the interpreter." msgstr "" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1195 msgid "" "This attribute of code objects is deprecated, and may be removed in Python " "3.14." msgstr "" -#: ../../reference/datamodel.rst:1191 +#: ../../reference/datamodel.rst:1200 msgid "The required stack size of the code object" msgstr "" -#: ../../reference/datamodel.rst:1194 +#: ../../reference/datamodel.rst:1203 msgid "" "An :class:`integer <int>` encoding a number of flags for the interpreter." msgstr "" -#: ../../reference/datamodel.rst:1199 +#: ../../reference/datamodel.rst:1208 msgid "" "The following flag bits are defined for :attr:`~codeobject.co_flags`: bit " "``0x04`` is set if the function uses the ``*arguments`` syntax to accept an " @@ -1334,7 +1356,7 @@ msgid "" "might be present." msgstr "" -#: ../../reference/datamodel.rst:1207 +#: ../../reference/datamodel.rst:1216 msgid "" "Future feature declarations (``from __future__ import division``) also use " "bits in :attr:`~codeobject.co_flags` to indicate whether a code object was " @@ -1343,29 +1365,29 @@ msgid "" "``0x1000`` were used in earlier versions of Python." msgstr "" -#: ../../reference/datamodel.rst:1213 +#: ../../reference/datamodel.rst:1222 msgid "" "Other bits in :attr:`~codeobject.co_flags` are reserved for internal use." msgstr "" -#: ../../reference/datamodel.rst:1217 +#: ../../reference/datamodel.rst:1226 msgid "" "If a code object represents a function, the first item in :attr:`~codeobject." "co_consts` is the documentation string of the function, or ``None`` if " "undefined." msgstr "" -#: ../../reference/datamodel.rst:1222 +#: ../../reference/datamodel.rst:1231 msgid "Methods on code objects" msgstr "用於程式碼物件的方法" -#: ../../reference/datamodel.rst:1226 +#: ../../reference/datamodel.rst:1235 msgid "" "Returns an iterable over the source code positions of each :term:`bytecode` " "instruction in the code object." msgstr "" -#: ../../reference/datamodel.rst:1229 +#: ../../reference/datamodel.rst:1238 msgid "" "The iterator returns :class:`tuple`\\s containing the ``(start_line, " "end_line, start_column, end_column)``. The *i-th* tuple corresponds to the " @@ -1373,37 +1395,37 @@ msgid "" "information is 0-indexed utf-8 byte offsets on the given source line." msgstr "" -#: ../../reference/datamodel.rst:1235 +#: ../../reference/datamodel.rst:1244 msgid "" "This positional information can be missing. A non-exhaustive lists of cases " "where this may happen:" msgstr "" -#: ../../reference/datamodel.rst:1238 +#: ../../reference/datamodel.rst:1247 msgid "Running the interpreter with :option:`-X` ``no_debug_ranges``." msgstr "" -#: ../../reference/datamodel.rst:1239 +#: ../../reference/datamodel.rst:1248 msgid "" "Loading a pyc file compiled while using :option:`-X` ``no_debug_ranges``." msgstr "" -#: ../../reference/datamodel.rst:1240 +#: ../../reference/datamodel.rst:1249 msgid "Position tuples corresponding to artificial instructions." msgstr "" -#: ../../reference/datamodel.rst:1241 +#: ../../reference/datamodel.rst:1250 msgid "" "Line and column numbers that can't be represented due to implementation " "specific limitations." msgstr "" -#: ../../reference/datamodel.rst:1244 +#: ../../reference/datamodel.rst:1253 msgid "" "When this occurs, some or all of the tuple elements can be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:1250 +#: ../../reference/datamodel.rst:1259 msgid "" "This feature requires storing column positions in code objects which may " "result in a small increase of disk usage of compiled Python files or " @@ -1413,95 +1435,100 @@ msgid "" "environment variable can be used." msgstr "" -#: ../../reference/datamodel.rst:1259 +#: ../../reference/datamodel.rst:1268 msgid "" "Returns an iterator that yields information about successive ranges of :term:" "`bytecode`\\s. Each item yielded is a ``(start, end, lineno)`` :class:" "`tuple`:" msgstr "" -#: ../../reference/datamodel.rst:1263 +#: ../../reference/datamodel.rst:1272 msgid "" "``start`` (an :class:`int`) represents the offset (inclusive) of the start " "of the :term:`bytecode` range" msgstr "" -#: ../../reference/datamodel.rst:1265 +#: ../../reference/datamodel.rst:1274 msgid "" "``end`` (an :class:`int`) represents the offset (exclusive) of the end of " "the :term:`bytecode` range" msgstr "" -#: ../../reference/datamodel.rst:1267 +#: ../../reference/datamodel.rst:1276 msgid "" "``lineno`` is an :class:`int` representing the line number of the :term:" "`bytecode` range, or ``None`` if the bytecodes in the given range have no " "line number" msgstr "" -#: ../../reference/datamodel.rst:1271 +#: ../../reference/datamodel.rst:1280 msgid "The items yielded will have the following properties:" msgstr "" -#: ../../reference/datamodel.rst:1273 +#: ../../reference/datamodel.rst:1282 msgid "The first range yielded will have a ``start`` of 0." msgstr "" -#: ../../reference/datamodel.rst:1274 +#: ../../reference/datamodel.rst:1283 msgid "" "The ``(start, end)`` ranges will be non-decreasing and consecutive. That is, " "for any pair of :class:`tuple`\\s, the ``start`` of the second will be equal " "to the ``end`` of the first." msgstr "" -#: ../../reference/datamodel.rst:1277 +#: ../../reference/datamodel.rst:1286 msgid "No range will be backwards: ``end >= start`` for all triples." msgstr "" -#: ../../reference/datamodel.rst:1278 +#: ../../reference/datamodel.rst:1287 msgid "" "The last :class:`tuple` yielded will have ``end`` equal to the size of the :" "term:`bytecode`." msgstr "" -#: ../../reference/datamodel.rst:1281 +#: ../../reference/datamodel.rst:1290 msgid "" "Zero-width ranges, where ``start == end``, are allowed. Zero-width ranges " "are used for lines that are present in the source code, but have been " "eliminated by the :term:`bytecode` compiler." msgstr "" -#: ../../reference/datamodel.rst:1289 +#: ../../reference/datamodel.rst:1298 msgid ":pep:`626` - Precise line numbers for debugging and other tools." msgstr "" -#: ../../reference/datamodel.rst:1290 +#: ../../reference/datamodel.rst:1299 msgid "The PEP that introduced the :meth:`!co_lines` method." msgstr "" -#: ../../reference/datamodel.rst:1294 +#: ../../reference/datamodel.rst:1303 msgid "" "Return a copy of the code object with new values for the specified fields." msgstr "" -#: ../../reference/datamodel.rst:1302 +#: ../../reference/datamodel.rst:1305 +msgid "" +"Code objects are also supported by the generic function :func:`copy.replace`." +msgstr "" + +#: ../../reference/datamodel.rst:1313 msgid "Frame objects" msgstr "" -#: ../../reference/datamodel.rst:1306 +#: ../../reference/datamodel.rst:1317 msgid "" "Frame objects represent execution frames. They may occur in :ref:`traceback " "objects <traceback-objects>`, and are also passed to registered trace " "functions." msgstr "" -#: ../../reference/datamodel.rst:1324 +#: ../../reference/datamodel.rst:1335 msgid "" "Points to the previous stack frame (towards the caller), or ``None`` if this " "is the bottom stack frame" msgstr "" -#: ../../reference/datamodel.rst:1328 +#: ../../reference/datamodel.rst:1339 msgid "" "The :ref:`code object <code-objects>` being executed in this frame. " "Accessing this attribute raises an :ref:`auditing event <auditing>` ``object." @@ -1511,49 +1538,55 @@ msgstr "" "這個屬性會引發一個附帶引數 ``obj`` 與 ``\"f_code\"`` 的\\ :ref:`稽核事件 " "<auditing>` ``object.__getattr__``。" -#: ../../reference/datamodel.rst:1333 +#: ../../reference/datamodel.rst:1344 msgid "" -"The dictionary used by the frame to look up :ref:`local variables <naming>`" +"The mapping used by the frame to look up :ref:`local variables <naming>`. If " +"the frame refers to an :term:`optimized scope`, this may return a write-" +"through proxy object." msgstr "" -#: ../../reference/datamodel.rst:1337 +#: ../../reference/datamodel.rst:1349 +msgid "Return a proxy for optimized scopes." +msgstr "" + +#: ../../reference/datamodel.rst:1353 msgid "" "The dictionary used by the frame to look up :ref:`global variables <naming>`" msgstr "" -#: ../../reference/datamodel.rst:1341 +#: ../../reference/datamodel.rst:1357 msgid "" "The dictionary used by the frame to look up :ref:`built-in (intrinsic) names " "<naming>`" msgstr "" -#: ../../reference/datamodel.rst:1345 +#: ../../reference/datamodel.rst:1361 msgid "" "The \"precise instruction\" of the frame object (this is an index into the :" "term:`bytecode` string of the :ref:`code object <code-objects>`)" msgstr "" -#: ../../reference/datamodel.rst:1361 +#: ../../reference/datamodel.rst:1377 msgid "" "If not ``None``, this is a function called for various events during code " "execution (this is used by debuggers). Normally an event is triggered for " "each new source line (see :attr:`~frame.f_trace_lines`)." msgstr "" -#: ../../reference/datamodel.rst:1366 +#: ../../reference/datamodel.rst:1382 msgid "" "Set this attribute to :const:`False` to disable triggering a tracing event " "for each source line." msgstr "" -#: ../../reference/datamodel.rst:1370 +#: ../../reference/datamodel.rst:1386 msgid "" "Set this attribute to :const:`True` to allow per-opcode events to be " "requested. Note that this may lead to undefined interpreter behaviour if " "exceptions raised by the trace function escape to the function being traced." msgstr "" -#: ../../reference/datamodel.rst:1376 +#: ../../reference/datamodel.rst:1392 msgid "" "The current line number of the frame -- writing to this from within a trace " "function jumps to the given line (only for the bottom-most frame). A " @@ -1561,15 +1594,15 @@ msgid "" "this attribute." msgstr "" -#: ../../reference/datamodel.rst:1382 +#: ../../reference/datamodel.rst:1398 msgid "Frame object methods" msgstr "" -#: ../../reference/datamodel.rst:1384 +#: ../../reference/datamodel.rst:1400 msgid "Frame objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1388 +#: ../../reference/datamodel.rst:1404 msgid "" "This method clears all references to :ref:`local variables <naming>` held by " "the frame. Also, if the frame belonged to a :term:`generator`, the " @@ -1578,26 +1611,34 @@ msgid "" "and storing its :ref:`traceback <traceback-objects>` for later use)." msgstr "" -#: ../../reference/datamodel.rst:1394 -msgid ":exc:`RuntimeError` is raised if the frame is currently executing." +#: ../../reference/datamodel.rst:1410 +msgid "" +":exc:`RuntimeError` is raised if the frame is currently executing or " +"suspended." msgstr "" -#: ../../reference/datamodel.rst:1402 +#: ../../reference/datamodel.rst:1415 +msgid "" +"Attempting to clear a suspended frame raises :exc:`RuntimeError` (as has " +"always been the case for executing frames)." +msgstr "" + +#: ../../reference/datamodel.rst:1423 msgid "Traceback objects" msgstr "" -#: ../../reference/datamodel.rst:1415 +#: ../../reference/datamodel.rst:1436 msgid "" "Traceback objects represent the stack trace of an :ref:`exception <tut-" "errors>`. A traceback object is implicitly created when an exception occurs, " "and may also be explicitly created by calling :class:`types.TracebackType`." msgstr "" -#: ../../reference/datamodel.rst:1420 +#: ../../reference/datamodel.rst:1441 msgid "Traceback objects can now be explicitly instantiated from Python code." msgstr "" -#: ../../reference/datamodel.rst:1423 +#: ../../reference/datamodel.rst:1444 msgid "" "For implicitly created tracebacks, when the search for an exception handler " "unwinds the execution stack, at each unwound level a traceback object is " @@ -1608,7 +1649,7 @@ msgid "" "the caught exception." msgstr "" -#: ../../reference/datamodel.rst:1432 +#: ../../reference/datamodel.rst:1453 msgid "" "When the program contains no suitable handler, the stack trace is written " "(nicely formatted) to the standard error stream; if the interpreter is " @@ -1616,19 +1657,19 @@ msgid "" "last_traceback`." msgstr "" -#: ../../reference/datamodel.rst:1437 +#: ../../reference/datamodel.rst:1458 msgid "" "For explicitly created tracebacks, it is up to the creator of the traceback " "to determine how the :attr:`~traceback.tb_next` attributes should be linked " "to form a full stack trace." msgstr "" -#: ../../reference/datamodel.rst:1452 +#: ../../reference/datamodel.rst:1473 msgid "" "Points to the execution :ref:`frame <frame-objects>` of the current level." msgstr "" -#: ../../reference/datamodel.rst:1455 +#: ../../reference/datamodel.rst:1476 msgid "" "Accessing this attribute raises an :ref:`auditing event <auditing>` ``object." "__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." @@ -1636,15 +1677,15 @@ msgstr "" "存取此屬性會引發一個附帶引數 ``obj`` 與 ``\"tb_frame\"`` 的\\ :ref:`稽核事件 " "<auditing>` ``object.__getattr__``。" -#: ../../reference/datamodel.rst:1460 +#: ../../reference/datamodel.rst:1481 msgid "Gives the line number where the exception occurred" msgstr "" -#: ../../reference/datamodel.rst:1463 +#: ../../reference/datamodel.rst:1484 msgid "Indicates the \"precise instruction\"." msgstr "" -#: ../../reference/datamodel.rst:1465 +#: ../../reference/datamodel.rst:1486 msgid "" "The line number and last instruction in the traceback may differ from the " "line number of its :ref:`frame object <frame-objects>` if the exception " @@ -1652,39 +1693,39 @@ msgid "" "with a :keyword:`finally` clause." msgstr "" -#: ../../reference/datamodel.rst:1476 +#: ../../reference/datamodel.rst:1497 msgid "" "The special writable attribute :attr:`!tb_next` is the next level in the " "stack trace (towards the frame where the exception occurred), or ``None`` if " "there is no next level." msgstr "" -#: ../../reference/datamodel.rst:1480 +#: ../../reference/datamodel.rst:1501 msgid "This attribute is now writable" msgstr "" -#: ../../reference/datamodel.rst:1485 +#: ../../reference/datamodel.rst:1506 msgid "Slice objects" msgstr "" -#: ../../reference/datamodel.rst:1489 +#: ../../reference/datamodel.rst:1510 msgid "" "Slice objects are used to represent slices for :meth:`~object.__getitem__` " "methods. They are also created by the built-in :func:`slice` function." msgstr "" -#: ../../reference/datamodel.rst:1498 +#: ../../reference/datamodel.rst:1519 msgid "" "Special read-only attributes: :attr:`~slice.start` is the lower bound; :attr:" "`~slice.stop` is the upper bound; :attr:`~slice.step` is the step value; " "each is ``None`` if omitted. These attributes can have any type." msgstr "" -#: ../../reference/datamodel.rst:1502 +#: ../../reference/datamodel.rst:1523 msgid "Slice objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1506 +#: ../../reference/datamodel.rst:1527 msgid "" "This method takes a single integer argument *length* and computes " "information about the slice that the slice object would describe if applied " @@ -1694,11 +1735,11 @@ msgid "" "a manner consistent with regular slices." msgstr "" -#: ../../reference/datamodel.rst:1515 +#: ../../reference/datamodel.rst:1536 msgid "Static method objects" msgstr "" -#: ../../reference/datamodel.rst:1517 +#: ../../reference/datamodel.rst:1538 msgid "" "Static method objects provide a way of defeating the transformation of " "function objects to method objects described above. A static method object " @@ -1709,11 +1750,11 @@ msgid "" "method objects are created by the built-in :func:`staticmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1527 +#: ../../reference/datamodel.rst:1548 msgid "Class method objects" msgstr "" -#: ../../reference/datamodel.rst:1529 +#: ../../reference/datamodel.rst:1550 msgid "" "A class method object, like a static method object, is a wrapper around " "another object that alters the way in which that object is retrieved from " @@ -1723,11 +1764,11 @@ msgid "" "`classmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1539 +#: ../../reference/datamodel.rst:1560 msgid "Special method names" msgstr "" -#: ../../reference/datamodel.rst:1545 +#: ../../reference/datamodel.rst:1566 msgid "" "A class can implement certain operations that are invoked by special syntax " "(such as arithmetic operations or subscripting and slicing) by defining " @@ -1741,7 +1782,7 @@ msgid "" "`TypeError`)." msgstr "" -#: ../../reference/datamodel.rst:1556 +#: ../../reference/datamodel.rst:1577 msgid "" "Setting a special method to ``None`` indicates that the corresponding " "operation is not available. For example, if a class sets :meth:`~object." @@ -1750,7 +1791,7 @@ msgid "" "`~object.__getitem__`). [#]_" msgstr "" -#: ../../reference/datamodel.rst:1562 +#: ../../reference/datamodel.rst:1583 msgid "" "When implementing a class that emulates any built-in type, it is important " "that the emulation only be implemented to the degree that it makes sense for " @@ -1760,11 +1801,11 @@ msgid "" "the W3C's Document Object Model.)" msgstr "" -#: ../../reference/datamodel.rst:1573 +#: ../../reference/datamodel.rst:1594 msgid "Basic customization" msgstr "" -#: ../../reference/datamodel.rst:1579 +#: ../../reference/datamodel.rst:1600 msgid "" "Called to create a new instance of class *cls*. :meth:`__new__` is a static " "method (special-cased so you need not declare it as such) that takes the " @@ -1774,7 +1815,7 @@ msgid "" "new object instance (usually an instance of *cls*)." msgstr "" -#: ../../reference/datamodel.rst:1586 +#: ../../reference/datamodel.rst:1607 msgid "" "Typical implementations create a new instance of the class by invoking the " "superclass's :meth:`__new__` method using ``super().__new__(cls[, ...])`` " @@ -1782,7 +1823,7 @@ msgid "" "necessary before returning it." msgstr "" -#: ../../reference/datamodel.rst:1591 +#: ../../reference/datamodel.rst:1612 msgid "" "If :meth:`__new__` is invoked during object construction and it returns an " "instance of *cls*, then the new instance’s :meth:`__init__` method will be " @@ -1791,13 +1832,13 @@ msgid "" "constructor." msgstr "" -#: ../../reference/datamodel.rst:1596 +#: ../../reference/datamodel.rst:1617 msgid "" "If :meth:`__new__` does not return an instance of *cls*, then the new " "instance's :meth:`__init__` method will not be invoked." msgstr "" -#: ../../reference/datamodel.rst:1599 +#: ../../reference/datamodel.rst:1620 msgid "" ":meth:`__new__` is intended mainly to allow subclasses of immutable types " "(like int, str, or tuple) to customize instance creation. It is also " @@ -1805,7 +1846,7 @@ msgid "" "creation." msgstr "" -#: ../../reference/datamodel.rst:1608 +#: ../../reference/datamodel.rst:1629 msgid "" "Called after the instance has been created (by :meth:`__new__`), but before " "it is returned to the caller. The arguments are those passed to the class " @@ -1815,7 +1856,7 @@ msgid "" "example: ``super().__init__([args...])``." msgstr "" -#: ../../reference/datamodel.rst:1615 +#: ../../reference/datamodel.rst:1636 msgid "" "Because :meth:`__new__` and :meth:`__init__` work together in constructing " "objects (:meth:`__new__` to create it, and :meth:`__init__` to customize " @@ -1823,7 +1864,7 @@ msgid "" "will cause a :exc:`TypeError` to be raised at runtime." msgstr "" -#: ../../reference/datamodel.rst:1628 +#: ../../reference/datamodel.rst:1649 msgid "" "Called when the instance is about to be destroyed. This is also called a " "finalizer or (improperly) a destructor. If a base class has a :meth:" @@ -1832,7 +1873,7 @@ msgid "" "instance." msgstr "" -#: ../../reference/datamodel.rst:1634 +#: ../../reference/datamodel.rst:1655 msgid "" "It is possible (though not recommended!) for the :meth:`__del__` method to " "postpone destruction of the instance by creating a new reference to it. " @@ -1842,7 +1883,7 @@ msgid "" "it once." msgstr "" -#: ../../reference/datamodel.rst:1641 +#: ../../reference/datamodel.rst:1662 msgid "" "It is not guaranteed that :meth:`__del__` methods are called for objects " "that still exist when the interpreter exits. :class:`weakref.finalize` " @@ -1850,14 +1891,14 @@ msgid "" "when an object is garbage collected." msgstr "" -#: ../../reference/datamodel.rst:1648 +#: ../../reference/datamodel.rst:1669 msgid "" "``del x`` doesn't directly call ``x.__del__()`` --- the former decrements " "the reference count for ``x`` by one, and the latter is only called when " "``x``'s reference count reaches zero." msgstr "" -#: ../../reference/datamodel.rst:1653 +#: ../../reference/datamodel.rst:1674 msgid "" "It is possible for a reference cycle to prevent the reference count of an " "object from going to zero. In this case, the cycle will be later detected " @@ -1868,18 +1909,18 @@ msgid "" "caught in the traceback." msgstr "" -#: ../../reference/datamodel.rst:1663 +#: ../../reference/datamodel.rst:1684 msgid "Documentation for the :mod:`gc` module." msgstr "" -#: ../../reference/datamodel.rst:1667 +#: ../../reference/datamodel.rst:1688 msgid "" "Due to the precarious circumstances under which :meth:`__del__` methods are " "invoked, exceptions that occur during their execution are ignored, and a " "warning is printed to ``sys.stderr`` instead. In particular:" msgstr "" -#: ../../reference/datamodel.rst:1671 +#: ../../reference/datamodel.rst:1692 msgid "" ":meth:`__del__` can be invoked when arbitrary code is being executed, " "including from any arbitrary thread. If :meth:`__del__` needs to take a " @@ -1888,7 +1929,7 @@ msgid "" "`__del__`." msgstr "" -#: ../../reference/datamodel.rst:1677 +#: ../../reference/datamodel.rst:1698 msgid "" ":meth:`__del__` can be executed during interpreter shutdown. As a " "consequence, the global variables it needs to access (including other " @@ -1899,7 +1940,7 @@ msgid "" "still available at the time when the :meth:`__del__` method is called." msgstr "" -#: ../../reference/datamodel.rst:1692 +#: ../../reference/datamodel.rst:1713 msgid "" "Called by the :func:`repr` built-in function to compute the \"official\" " "string representation of an object. If at all possible, this should look " @@ -1911,13 +1952,13 @@ msgid "" "an \"informal\" string representation of instances of that class is required." msgstr "" -#: ../../reference/datamodel.rst:1701 +#: ../../reference/datamodel.rst:1722 msgid "" "This is typically used for debugging, so it is important that the " "representation is information-rich and unambiguous." msgstr "" -#: ../../reference/datamodel.rst:1712 +#: ../../reference/datamodel.rst:1733 msgid "" "Called by :func:`str(object) <str>` and the built-in functions :func:" "`format` and :func:`print` to compute the \"informal\" or nicely printable " @@ -1925,26 +1966,26 @@ msgid "" "<textseq>` object." msgstr "" -#: ../../reference/datamodel.rst:1717 +#: ../../reference/datamodel.rst:1738 msgid "" "This method differs from :meth:`object.__repr__` in that there is no " "expectation that :meth:`__str__` return a valid Python expression: a more " "convenient or concise representation can be used." msgstr "" -#: ../../reference/datamodel.rst:1721 +#: ../../reference/datamodel.rst:1742 msgid "" "The default implementation defined by the built-in type :class:`object` " "calls :meth:`object.__repr__`." msgstr "" -#: ../../reference/datamodel.rst:1731 +#: ../../reference/datamodel.rst:1752 msgid "" "Called by :ref:`bytes <func-bytes>` to compute a byte-string representation " "of an object. This should return a :class:`bytes` object." msgstr "" -#: ../../reference/datamodel.rst:1742 +#: ../../reference/datamodel.rst:1763 msgid "" "Called by the :func:`format` built-in function, and by extension, evaluation " "of :ref:`formatted string literals <f-strings>` and the :meth:`str.format` " @@ -1956,28 +1997,28 @@ msgid "" "formatting option syntax." msgstr "" -#: ../../reference/datamodel.rst:1752 +#: ../../reference/datamodel.rst:1773 msgid "" "See :ref:`formatspec` for a description of the standard formatting syntax." msgstr "" -#: ../../reference/datamodel.rst:1754 +#: ../../reference/datamodel.rst:1775 msgid "The return value must be a string object." msgstr "" -#: ../../reference/datamodel.rst:1756 +#: ../../reference/datamodel.rst:1777 msgid "" "The __format__ method of ``object`` itself raises a :exc:`TypeError` if " "passed any non-empty string." msgstr "" -#: ../../reference/datamodel.rst:1760 +#: ../../reference/datamodel.rst:1781 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " "``format(str(x), '')``." msgstr "" -#: ../../reference/datamodel.rst:1776 +#: ../../reference/datamodel.rst:1797 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " "between operator symbols and method names is as follows: ``x<y`` calls ``x." @@ -1986,7 +2027,7 @@ msgid "" "calls ``x.__ge__(y)``." msgstr "" -#: ../../reference/datamodel.rst:1782 +#: ../../reference/datamodel.rst:1803 msgid "" "A rich comparison method may return the singleton :data:`NotImplemented` if " "it does not implement the operation for a given pair of arguments. By " @@ -1997,7 +2038,7 @@ msgid "" "result is true or false." msgstr "" -#: ../../reference/datamodel.rst:1789 +#: ../../reference/datamodel.rst:1810 msgid "" "By default, ``object`` implements :meth:`__eq__` by using ``is``, returning :" "data:`NotImplemented` in the case of a false comparison: ``True if x is y " @@ -2009,14 +2050,14 @@ msgid "" "operation, see :func:`functools.total_ordering`." msgstr "" -#: ../../reference/datamodel.rst:1798 +#: ../../reference/datamodel.rst:1819 msgid "" "See the paragraph on :meth:`__hash__` for some important notes on creating :" "term:`hashable` objects which support custom comparison operations and are " "usable as dictionary keys." msgstr "" -#: ../../reference/datamodel.rst:1802 +#: ../../reference/datamodel.rst:1823 msgid "" "There are no swapped-argument versions of these methods (to be used when the " "left argument does not support the operation but the right argument does); " @@ -2029,14 +2070,14 @@ msgid "" "Virtual subclassing is not considered." msgstr "" -#: ../../reference/datamodel.rst:1813 +#: ../../reference/datamodel.rst:1834 msgid "" "When no appropriate method returns any value other than :data:" "`NotImplemented`, the ``==`` and ``!=`` operators will fall back to ``is`` " "and ``is not``, respectively." msgstr "" -#: ../../reference/datamodel.rst:1822 +#: ../../reference/datamodel.rst:1843 msgid "" "Called by built-in function :func:`hash` and for operations on members of " "hashed collections including :class:`set`, :class:`frozenset`, and :class:" @@ -2047,7 +2088,7 @@ msgid "" "into a tuple and hashing the tuple. Example::" msgstr "" -#: ../../reference/datamodel.rst:1830 +#: ../../reference/datamodel.rst:1851 msgid "" "def __hash__(self):\n" " return hash((self.name, self.nick, self.color))" @@ -2055,7 +2096,7 @@ msgstr "" "def __hash__(self):\n" " return hash((self.name, self.nick, self.color))" -#: ../../reference/datamodel.rst:1835 +#: ../../reference/datamodel.rst:1856 msgid "" ":func:`hash` truncates the value returned from an object's custom :meth:" "`__hash__` method to the size of a :c:type:`Py_ssize_t`. This is typically " @@ -2065,7 +2106,7 @@ msgid "" "``python -c \"import sys; print(sys.hash_info.width)\"``." msgstr "" -#: ../../reference/datamodel.rst:1843 +#: ../../reference/datamodel.rst:1864 msgid "" "If a class does not define an :meth:`__eq__` method it should not define a :" "meth:`__hash__` operation either; if it defines :meth:`__eq__` but not :meth:" @@ -2077,7 +2118,7 @@ msgid "" "wrong hash bucket)." msgstr "" -#: ../../reference/datamodel.rst:1852 +#: ../../reference/datamodel.rst:1873 msgid "" "User-defined classes have :meth:`__eq__` and :meth:`__hash__` methods by " "default; with them, all objects compare unequal (except with themselves) and " @@ -2085,7 +2126,7 @@ msgid "" "both that ``x is y`` and ``hash(x) == hash(y)``." msgstr "" -#: ../../reference/datamodel.rst:1857 +#: ../../reference/datamodel.rst:1878 msgid "" "A class that overrides :meth:`__eq__` and does not define :meth:`__hash__` " "will have its :meth:`__hash__` implicitly set to ``None``. When the :meth:" @@ -2095,14 +2136,14 @@ msgid "" "checking ``isinstance(obj, collections.abc.Hashable)``." msgstr "" -#: ../../reference/datamodel.rst:1864 +#: ../../reference/datamodel.rst:1885 msgid "" "If a class that overrides :meth:`__eq__` needs to retain the implementation " "of :meth:`__hash__` from a parent class, the interpreter must be told this " "explicitly by setting ``__hash__ = <ParentClass>.__hash__``." msgstr "" -#: ../../reference/datamodel.rst:1868 +#: ../../reference/datamodel.rst:1889 msgid "" "If a class that does not override :meth:`__eq__` wishes to suppress hash " "support, it should include ``__hash__ = None`` in the class definition. A " @@ -2111,7 +2152,7 @@ msgid "" "``isinstance(obj, collections.abc.Hashable)`` call." msgstr "" -#: ../../reference/datamodel.rst:1877 +#: ../../reference/datamodel.rst:1898 msgid "" "By default, the :meth:`__hash__` values of str and bytes objects are " "\"salted\" with an unpredictable random value. Although they remain " @@ -2119,7 +2160,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: ../../reference/datamodel.rst:1882 +#: ../../reference/datamodel.rst:1903 msgid "" "This is intended to provide protection against a denial-of-service caused by " "carefully chosen inputs that exploit the worst case performance of a dict " @@ -2127,22 +2168,22 @@ msgid "" "advisories/ocert-2011-003.html for details." msgstr "" -#: ../../reference/datamodel.rst:1887 +#: ../../reference/datamodel.rst:1908 msgid "" "Changing hash values affects the iteration order of sets. Python has never " "made guarantees about this ordering (and it typically varies between 32-bit " "and 64-bit builds)." msgstr "" -#: ../../reference/datamodel.rst:1891 +#: ../../reference/datamodel.rst:1912 msgid "See also :envvar:`PYTHONHASHSEED`." msgstr "另請參閱 :envvar:`PYTHONHASHSEED`。" -#: ../../reference/datamodel.rst:1893 +#: ../../reference/datamodel.rst:1914 msgid "Hash randomization is enabled by default." msgstr "" -#: ../../reference/datamodel.rst:1901 +#: ../../reference/datamodel.rst:1922 msgid "" "Called to implement truth value testing and the built-in operation " "``bool()``; should return ``False`` or ``True``. When this method is not " @@ -2151,18 +2192,18 @@ msgid "" "meth:`!__len__` nor :meth:`!__bool__`, all its instances are considered true." msgstr "" -#: ../../reference/datamodel.rst:1912 +#: ../../reference/datamodel.rst:1933 msgid "Customizing attribute access" msgstr "" -#: ../../reference/datamodel.rst:1914 +#: ../../reference/datamodel.rst:1935 msgid "" "The following methods can be defined to customize the meaning of attribute " "access (use of, assignment to, or deletion of ``x.name``) for class " "instances." msgstr "" -#: ../../reference/datamodel.rst:1922 +#: ../../reference/datamodel.rst:1943 msgid "" "Called when the default attribute access fails with an :exc:`AttributeError` " "(either :meth:`__getattribute__` raises an :exc:`AttributeError` because " @@ -2172,20 +2213,20 @@ msgid "" "attribute value or raise an :exc:`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:1929 +#: ../../reference/datamodel.rst:1950 msgid "" "Note that if the attribute is found through the normal mechanism, :meth:" "`__getattr__` is not called. (This is an intentional asymmetry between :" "meth:`__getattr__` and :meth:`__setattr__`.) This is done both for " "efficiency reasons and because otherwise :meth:`__getattr__` would have no " "way to access other attributes of the instance. Note that at least for " -"instance variables, you can fake total control by not inserting any values " +"instance variables, you can take total control by not inserting any values " "in the instance attribute dictionary (but instead inserting them in another " "object). See the :meth:`__getattribute__` method below for a way to " "actually get total control over attribute access." msgstr "" -#: ../../reference/datamodel.rst:1942 +#: ../../reference/datamodel.rst:1963 msgid "" "Called unconditionally to implement attribute accesses for instances of the " "class. If the class also defines :meth:`__getattr__`, the latter will not be " @@ -2197,64 +2238,64 @@ msgid "" "example, ``object.__getattribute__(self, name)``." msgstr "" -#: ../../reference/datamodel.rst:1953 +#: ../../reference/datamodel.rst:1974 msgid "" "This method may still be bypassed when looking up special methods as the " "result of implicit invocation via language syntax or :ref:`built-in " "functions <builtin-functions>`. See :ref:`special-lookup`." msgstr "" -#: ../../reference/datamodel.rst:1958 ../../reference/datamodel.rst:1960 +#: ../../reference/datamodel.rst:1979 ../../reference/datamodel.rst:1981 msgid "" "For certain sensitive attribute accesses, raises an :ref:`auditing event " "<auditing>` ``object.__getattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:1967 +#: ../../reference/datamodel.rst:1988 msgid "" "Called when an attribute assignment is attempted. This is called instead of " "the normal mechanism (i.e. store the value in the instance dictionary). " "*name* is the attribute name, *value* is the value to be assigned to it." msgstr "" -#: ../../reference/datamodel.rst:1971 +#: ../../reference/datamodel.rst:1992 msgid "" "If :meth:`__setattr__` wants to assign to an instance attribute, it should " "call the base class method with the same name, for example, ``object." "__setattr__(self, name, value)``." msgstr "" -#: ../../reference/datamodel.rst:1975 ../../reference/datamodel.rst:1977 +#: ../../reference/datamodel.rst:1996 ../../reference/datamodel.rst:1998 msgid "" "For certain sensitive attribute assignments, raises an :ref:`auditing event " "<auditing>` ``object.__setattr__`` with arguments ``obj``, ``name``, " "``value``." msgstr "" -#: ../../reference/datamodel.rst:1984 +#: ../../reference/datamodel.rst:2005 msgid "" "Like :meth:`__setattr__` but for attribute deletion instead of assignment. " "This should only be implemented if ``del obj.name`` is meaningful for the " "object." msgstr "" -#: ../../reference/datamodel.rst:1987 ../../reference/datamodel.rst:1989 +#: ../../reference/datamodel.rst:2008 ../../reference/datamodel.rst:2010 msgid "" "For certain sensitive attribute deletions, raises an :ref:`auditing event " "<auditing>` ``object.__delattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:1996 +#: ../../reference/datamodel.rst:2017 msgid "" "Called when :func:`dir` is called on the object. An iterable must be " "returned. :func:`dir` converts the returned iterable to a list and sorts it." msgstr "" -#: ../../reference/datamodel.rst:2001 +#: ../../reference/datamodel.rst:2022 msgid "Customizing module attribute access" msgstr "" -#: ../../reference/datamodel.rst:2008 +#: ../../reference/datamodel.rst:2029 msgid "" "Special names ``__getattr__`` and ``__dir__`` can be also used to customize " "access to module attributes. The ``__getattr__`` function at the module " @@ -2266,21 +2307,21 @@ msgid "" "with the attribute name and the result is returned." msgstr "" -#: ../../reference/datamodel.rst:2017 +#: ../../reference/datamodel.rst:2038 msgid "" "The ``__dir__`` function should accept no arguments, and return an iterable " "of strings that represents the names accessible on module. If present, this " "function overrides the standard :func:`dir` search on a module." msgstr "" -#: ../../reference/datamodel.rst:2021 +#: ../../reference/datamodel.rst:2042 msgid "" "For a more fine grained customization of the module behavior (setting " "attributes, properties, etc.), one can set the ``__class__`` attribute of a " "module object to a subclass of :class:`types.ModuleType`. For example::" msgstr "" -#: ../../reference/datamodel.rst:2025 +#: ../../reference/datamodel.rst:2046 msgid "" "import sys\n" "from types import ModuleType\n" @@ -2308,7 +2349,7 @@ msgstr "" "\n" "sys.modules[__name__].__class__ = VerboseModule" -#: ../../reference/datamodel.rst:2039 +#: ../../reference/datamodel.rst:2060 msgid "" "Defining module ``__getattr__`` and setting module ``__class__`` only affect " "lookups made using the attribute access syntax -- directly accessing the " @@ -2316,27 +2357,27 @@ msgid "" "module's globals dictionary) is unaffected." msgstr "" -#: ../../reference/datamodel.rst:2044 +#: ../../reference/datamodel.rst:2065 msgid "``__class__`` module attribute is now writable." msgstr "" -#: ../../reference/datamodel.rst:2047 +#: ../../reference/datamodel.rst:2068 msgid "``__getattr__`` and ``__dir__`` module attributes." msgstr "" -#: ../../reference/datamodel.rst:2052 +#: ../../reference/datamodel.rst:2073 msgid ":pep:`562` - Module __getattr__ and __dir__" msgstr ":pep:`562` - 模組 __getattr__ 和 __dir__" -#: ../../reference/datamodel.rst:2053 +#: ../../reference/datamodel.rst:2074 msgid "Describes the ``__getattr__`` and ``__dir__`` functions on modules." msgstr "" -#: ../../reference/datamodel.rst:2059 +#: ../../reference/datamodel.rst:2080 msgid "Implementing Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2061 +#: ../../reference/datamodel.rst:2082 msgid "" "The following methods only apply when an instance of the class containing " "the method (a so-called *descriptor* class) appears in an *owner* class (the " @@ -2346,7 +2387,7 @@ msgid "" "the owner class' :attr:`~object.__dict__`." msgstr "" -#: ../../reference/datamodel.rst:2071 +#: ../../reference/datamodel.rst:2092 msgid "" "Called to get the attribute of the owner class (class attribute access) or " "of an instance of that class (instance attribute access). The optional " @@ -2355,13 +2396,13 @@ msgid "" "accessed through the *owner*." msgstr "" -#: ../../reference/datamodel.rst:2077 +#: ../../reference/datamodel.rst:2098 msgid "" "This method should return the computed attribute value or raise an :exc:" "`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:2080 +#: ../../reference/datamodel.rst:2101 msgid "" ":PEP:`252` specifies that :meth:`__get__` is callable with one or two " "arguments. Python's own built-in descriptors support this specification; " @@ -2371,31 +2412,31 @@ msgid "" "not." msgstr "" -#: ../../reference/datamodel.rst:2089 +#: ../../reference/datamodel.rst:2110 msgid "" "Called to set the attribute on an instance *instance* of the owner class to " "a new value, *value*." msgstr "" -#: ../../reference/datamodel.rst:2092 +#: ../../reference/datamodel.rst:2113 msgid "" "Note, adding :meth:`__set__` or :meth:`__delete__` changes the kind of " "descriptor to a \"data descriptor\". See :ref:`descriptor-invocation` for " "more details." msgstr "" -#: ../../reference/datamodel.rst:2098 +#: ../../reference/datamodel.rst:2119 msgid "" "Called to delete the attribute on an instance *instance* of the owner class." msgstr "" -#: ../../reference/datamodel.rst:2100 +#: ../../reference/datamodel.rst:2121 msgid "" "Instances of descriptors may also have the :attr:`!__objclass__` attribute " "present:" msgstr "" -#: ../../reference/datamodel.rst:2105 +#: ../../reference/datamodel.rst:2126 msgid "" "The attribute :attr:`!__objclass__` is interpreted by the :mod:`inspect` " "module as specifying the class where this object was defined (setting this " @@ -2406,11 +2447,11 @@ msgid "" "are implemented in C)." msgstr "" -#: ../../reference/datamodel.rst:2116 +#: ../../reference/datamodel.rst:2137 msgid "Invoking Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2118 +#: ../../reference/datamodel.rst:2139 msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " @@ -2419,7 +2460,7 @@ msgid "" "is said to be a descriptor." msgstr "" -#: ../../reference/datamodel.rst:2124 +#: ../../reference/datamodel.rst:2145 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " @@ -2427,7 +2468,7 @@ msgid "" "continuing through the base classes of ``type(a)`` excluding metaclasses." msgstr "" -#: ../../reference/datamodel.rst:2129 +#: ../../reference/datamodel.rst:2150 msgid "" "However, if the looked-up value is an object defining one of the descriptor " "methods, then Python may override the default behavior and invoke the " @@ -2435,54 +2476,54 @@ msgid "" "depends on which descriptor methods were defined and how they were called." msgstr "" -#: ../../reference/datamodel.rst:2134 +#: ../../reference/datamodel.rst:2155 msgid "" "The starting point for descriptor invocation is a binding, ``a.x``. How the " "arguments are assembled depends on ``a``:" msgstr "" -#: ../../reference/datamodel.rst:2137 +#: ../../reference/datamodel.rst:2158 msgid "Direct Call" msgstr "" -#: ../../reference/datamodel.rst:2138 +#: ../../reference/datamodel.rst:2159 msgid "" "The simplest and least common call is when user code directly invokes a " "descriptor method: ``x.__get__(a)``." msgstr "" -#: ../../reference/datamodel.rst:2141 +#: ../../reference/datamodel.rst:2162 msgid "Instance Binding" msgstr "" -#: ../../reference/datamodel.rst:2142 +#: ../../reference/datamodel.rst:2163 msgid "" "If binding to an object instance, ``a.x`` is transformed into the call: " "``type(a).__dict__['x'].__get__(a, type(a))``." msgstr "" -#: ../../reference/datamodel.rst:2145 +#: ../../reference/datamodel.rst:2166 msgid "Class Binding" msgstr "" -#: ../../reference/datamodel.rst:2146 +#: ../../reference/datamodel.rst:2167 msgid "" "If binding to a class, ``A.x`` is transformed into the call: ``A." "__dict__['x'].__get__(None, A)``." msgstr "" -#: ../../reference/datamodel.rst:2149 +#: ../../reference/datamodel.rst:2170 msgid "Super Binding" msgstr "" -#: ../../reference/datamodel.rst:2150 +#: ../../reference/datamodel.rst:2171 msgid "" "A dotted lookup such as ``super(A, a).x`` searches ``a.__class__.__mro__`` " "for a base class ``B`` following ``A`` and then returns ``B.__dict__['x']." "__get__(a, A)``. If not a descriptor, ``x`` is returned unchanged." msgstr "" -#: ../../reference/datamodel.rst:2187 +#: ../../reference/datamodel.rst:2208 msgid "" "For instance bindings, the precedence of descriptor invocation depends on " "which descriptor methods are defined. A descriptor can define any " @@ -2500,7 +2541,7 @@ msgid "" "instances." msgstr "" -#: ../../reference/datamodel.rst:2202 +#: ../../reference/datamodel.rst:2223 msgid "" "Python methods (including those decorated with :func:`@staticmethod " "<staticmethod>` and :func:`@classmethod <classmethod>`) are implemented as " @@ -2509,30 +2550,30 @@ msgid "" "from other instances of the same class." msgstr "" -#: ../../reference/datamodel.rst:2208 +#: ../../reference/datamodel.rst:2229 msgid "" "The :func:`property` function is implemented as a data descriptor. " "Accordingly, instances cannot override the behavior of a property." msgstr "" -#: ../../reference/datamodel.rst:2215 +#: ../../reference/datamodel.rst:2236 msgid "__slots__" msgstr "__slots__" -#: ../../reference/datamodel.rst:2217 +#: ../../reference/datamodel.rst:2238 msgid "" "*__slots__* allow us to explicitly declare data members (like properties) " "and deny the creation of :attr:`~object.__dict__` and *__weakref__* (unless " "explicitly declared in *__slots__* or available in a parent.)" msgstr "" -#: ../../reference/datamodel.rst:2221 +#: ../../reference/datamodel.rst:2242 msgid "" "The space saved over using :attr:`~object.__dict__` can be significant. " "Attribute lookup speed can be significantly improved as well." msgstr "" -#: ../../reference/datamodel.rst:2226 +#: ../../reference/datamodel.rst:2247 msgid "" "This class variable can be assigned a string, iterable, or sequence of " "strings with variable names used by instances. *__slots__* reserves space " @@ -2540,18 +2581,18 @@ msgid "" "`~object.__dict__` and *__weakref__* for each instance." msgstr "" -#: ../../reference/datamodel.rst:2235 +#: ../../reference/datamodel.rst:2256 msgid "Notes on using *__slots__*:" msgstr "" -#: ../../reference/datamodel.rst:2237 +#: ../../reference/datamodel.rst:2258 msgid "" "When inheriting from a class without *__slots__*, the :attr:`~object." "__dict__` and *__weakref__* attribute of the instances will always be " "accessible." msgstr "" -#: ../../reference/datamodel.rst:2241 +#: ../../reference/datamodel.rst:2262 msgid "" "Without a :attr:`~object.__dict__` variable, instances cannot be assigned " "new variables not listed in the *__slots__* definition. Attempts to assign " @@ -2560,7 +2601,7 @@ msgid "" "sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2248 +#: ../../reference/datamodel.rst:2269 msgid "" "Without a *__weakref__* variable for each instance, classes defining " "*__slots__* do not support :mod:`weak references <weakref>` to its " @@ -2568,7 +2609,7 @@ msgid "" "to the sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2254 +#: ../../reference/datamodel.rst:2275 msgid "" "*__slots__* are implemented at the class level by creating :ref:`descriptors " "<descriptors>` for each variable name. As a result, class attributes cannot " @@ -2576,7 +2617,7 @@ msgid "" "otherwise, the class attribute would overwrite the descriptor assignment." msgstr "" -#: ../../reference/datamodel.rst:2260 +#: ../../reference/datamodel.rst:2281 msgid "" "The action of a *__slots__* declaration is not limited to the class where it " "is defined. *__slots__* declared in parents are available in child classes. " @@ -2585,7 +2626,7 @@ msgid "" "names of any *additional* slots)." msgstr "" -#: ../../reference/datamodel.rst:2266 +#: ../../reference/datamodel.rst:2287 msgid "" "If a class defines a slot also defined in a base class, the instance " "variable defined by the base class slot is inaccessible (except by " @@ -2594,7 +2635,7 @@ msgid "" "prevent this." msgstr "" -#: ../../reference/datamodel.rst:2271 +#: ../../reference/datamodel.rst:2292 msgid "" ":exc:`TypeError` will be raised if nonempty *__slots__* are defined for a " "class derived from a :c:member:`\"variable-length\" built-in type " @@ -2602,11 +2643,11 @@ msgid "" "`tuple`." msgstr "" -#: ../../reference/datamodel.rst:2276 +#: ../../reference/datamodel.rst:2297 msgid "Any non-string :term:`iterable` may be assigned to *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2278 +#: ../../reference/datamodel.rst:2299 msgid "" "If a :class:`dictionary <dict>` is used to assign *__slots__*, the " "dictionary keys will be used as the slot names. The values of the dictionary " @@ -2614,13 +2655,13 @@ msgid "" "func:`inspect.getdoc` and displayed in the output of :func:`help`." msgstr "" -#: ../../reference/datamodel.rst:2283 +#: ../../reference/datamodel.rst:2304 msgid "" ":attr:`~instance.__class__` assignment works only if both classes have the " "same *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2286 +#: ../../reference/datamodel.rst:2307 msgid "" ":ref:`Multiple inheritance <tut-multiple>` with multiple slotted parent " "classes can be used, but only one parent is allowed to have attributes " @@ -2628,18 +2669,18 @@ msgid "" "raise :exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:2292 +#: ../../reference/datamodel.rst:2313 msgid "" "If an :term:`iterator` is used for *__slots__* then a :term:`descriptor` is " "created for each of the iterator's values. However, the *__slots__* " "attribute will be an empty iterator." msgstr "" -#: ../../reference/datamodel.rst:2300 +#: ../../reference/datamodel.rst:2321 msgid "Customizing class creation" msgstr "" -#: ../../reference/datamodel.rst:2302 +#: ../../reference/datamodel.rst:2323 msgid "" "Whenever a class inherits from another class, :meth:`~object." "__init_subclass__` is called on the parent class. This way, it is possible " @@ -2649,14 +2690,14 @@ msgid "" "future subclasses of the class defining the method." msgstr "" -#: ../../reference/datamodel.rst:2311 +#: ../../reference/datamodel.rst:2332 msgid "" "This method is called whenever the containing class is subclassed. *cls* is " "then the new subclass. If defined as a normal instance method, this method " "is implicitly converted to a class method." msgstr "" -#: ../../reference/datamodel.rst:2315 +#: ../../reference/datamodel.rst:2336 msgid "" "Keyword arguments which are given to a new class are passed to the parent " "class's ``__init_subclass__``. For compatibility with other classes using " @@ -2664,7 +2705,7 @@ msgid "" "pass the others over to the base class, as in::" msgstr "" -#: ../../reference/datamodel.rst:2321 +#: ../../reference/datamodel.rst:2342 msgid "" "class Philosopher:\n" " def __init_subclass__(cls, /, default_name, **kwargs):\n" @@ -2682,13 +2723,13 @@ msgstr "" "class AustralianPhilosopher(Philosopher, default_name=\"Bruce\"):\n" " pass" -#: ../../reference/datamodel.rst:2329 +#: ../../reference/datamodel.rst:2350 msgid "" "The default implementation ``object.__init_subclass__`` does nothing, but " "raises an error if it is called with any arguments." msgstr "" -#: ../../reference/datamodel.rst:2334 +#: ../../reference/datamodel.rst:2355 msgid "" "The metaclass hint ``metaclass`` is consumed by the rest of the type " "machinery, and is never passed to ``__init_subclass__`` implementations. The " @@ -2696,19 +2737,19 @@ msgid "" "``type(cls)``." msgstr "" -#: ../../reference/datamodel.rst:2342 +#: ../../reference/datamodel.rst:2363 msgid "" "When a class is created, :meth:`type.__new__` scans the class variables and " "makes callbacks to those with a :meth:`~object.__set_name__` hook." msgstr "" -#: ../../reference/datamodel.rst:2347 +#: ../../reference/datamodel.rst:2368 msgid "" "Automatically called at the time the owning class *owner* is created. The " "object has been assigned to *name* in that class::" msgstr "" -#: ../../reference/datamodel.rst:2350 +#: ../../reference/datamodel.rst:2371 msgid "" "class A:\n" " x = C() # Automatically calls: x.__set_name__(A, 'x')" @@ -2716,14 +2757,14 @@ msgstr "" "class A:\n" " x = C() # 自動呼叫:x.__set_name__(A, 'x')" -#: ../../reference/datamodel.rst:2353 +#: ../../reference/datamodel.rst:2374 msgid "" "If the class variable is assigned after the class is created, :meth:" "`__set_name__` will not be called automatically. If needed, :meth:" "`__set_name__` can be called directly::" msgstr "" -#: ../../reference/datamodel.rst:2357 +#: ../../reference/datamodel.rst:2378 msgid "" "class A:\n" " pass\n" @@ -2733,22 +2774,22 @@ msgid "" "c.__set_name__(A, 'x') # Manually invoke the hook" msgstr "" -#: ../../reference/datamodel.rst:2364 +#: ../../reference/datamodel.rst:2385 msgid "See :ref:`class-object-creation` for more details." msgstr "更多細節請見 :ref:`class-object-creation`。" -#: ../../reference/datamodel.rst:2372 +#: ../../reference/datamodel.rst:2393 msgid "Metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2379 +#: ../../reference/datamodel.rst:2400 msgid "" "By default, classes are constructed using :func:`type`. The class body is " "executed in a new namespace and the class name is bound locally to the " "result of ``type(name, bases, namespace)``." msgstr "" -#: ../../reference/datamodel.rst:2383 +#: ../../reference/datamodel.rst:2404 msgid "" "The class creation process can be customized by passing the ``metaclass`` " "keyword argument in the class definition line, or by inheriting from an " @@ -2756,7 +2797,7 @@ msgid "" "both ``MyClass`` and ``MySubclass`` are instances of ``Meta``::" msgstr "" -#: ../../reference/datamodel.rst:2388 +#: ../../reference/datamodel.rst:2409 msgid "" "class Meta(type):\n" " pass\n" @@ -2776,41 +2817,41 @@ msgstr "" "class MySubclass(MyClass):\n" " pass" -#: ../../reference/datamodel.rst:2397 +#: ../../reference/datamodel.rst:2418 msgid "" "Any other keyword arguments that are specified in the class definition are " "passed through to all metaclass operations described below." msgstr "" -#: ../../reference/datamodel.rst:2400 +#: ../../reference/datamodel.rst:2421 msgid "When a class definition is executed, the following steps occur:" msgstr "" -#: ../../reference/datamodel.rst:2402 +#: ../../reference/datamodel.rst:2423 msgid "MRO entries are resolved;" msgstr "" -#: ../../reference/datamodel.rst:2403 +#: ../../reference/datamodel.rst:2424 msgid "the appropriate metaclass is determined;" msgstr "" -#: ../../reference/datamodel.rst:2404 +#: ../../reference/datamodel.rst:2425 msgid "the class namespace is prepared;" msgstr "" -#: ../../reference/datamodel.rst:2405 +#: ../../reference/datamodel.rst:2426 msgid "the class body is executed;" msgstr "" -#: ../../reference/datamodel.rst:2406 +#: ../../reference/datamodel.rst:2427 msgid "the class object is created." msgstr "" -#: ../../reference/datamodel.rst:2410 +#: ../../reference/datamodel.rst:2431 msgid "Resolving MRO entries" msgstr "" -#: ../../reference/datamodel.rst:2414 +#: ../../reference/datamodel.rst:2435 msgid "" "If a base that appears in a class definition is not an instance of :class:" "`type`, then an :meth:`!__mro_entries__` method is searched on the base. If " @@ -2822,59 +2863,59 @@ msgid "" "is ignored." msgstr "" -#: ../../reference/datamodel.rst:2425 +#: ../../reference/datamodel.rst:2446 msgid ":func:`types.resolve_bases`" msgstr ":func:`types.resolve_bases`" -#: ../../reference/datamodel.rst:2426 +#: ../../reference/datamodel.rst:2447 msgid "Dynamically resolve bases that are not instances of :class:`type`." msgstr "" -#: ../../reference/datamodel.rst:2428 +#: ../../reference/datamodel.rst:2449 msgid ":func:`types.get_original_bases`" msgstr ":func:`types.get_original_bases`" -#: ../../reference/datamodel.rst:2429 +#: ../../reference/datamodel.rst:2450 msgid "" "Retrieve a class's \"original bases\" prior to modifications by :meth:" "`~object.__mro_entries__`." msgstr "" -#: ../../reference/datamodel.rst:2432 +#: ../../reference/datamodel.rst:2453 msgid ":pep:`560`" msgstr ":pep:`560`" -#: ../../reference/datamodel.rst:2433 +#: ../../reference/datamodel.rst:2454 msgid "Core support for typing module and generic types." msgstr "" -#: ../../reference/datamodel.rst:2437 +#: ../../reference/datamodel.rst:2458 msgid "Determining the appropriate metaclass" msgstr "" -#: ../../reference/datamodel.rst:2441 +#: ../../reference/datamodel.rst:2462 msgid "" "The appropriate metaclass for a class definition is determined as follows:" msgstr "" -#: ../../reference/datamodel.rst:2443 +#: ../../reference/datamodel.rst:2464 msgid "" "if no bases and no explicit metaclass are given, then :func:`type` is used;" msgstr "" -#: ../../reference/datamodel.rst:2444 +#: ../../reference/datamodel.rst:2465 msgid "" "if an explicit metaclass is given and it is *not* an instance of :func:" "`type`, then it is used directly as the metaclass;" msgstr "" -#: ../../reference/datamodel.rst:2446 +#: ../../reference/datamodel.rst:2467 msgid "" "if an instance of :func:`type` is given as the explicit metaclass, or bases " "are defined, then the most derived metaclass is used." msgstr "" -#: ../../reference/datamodel.rst:2449 +#: ../../reference/datamodel.rst:2470 msgid "" "The most derived metaclass is selected from the explicitly specified " "metaclass (if any) and the metaclasses (i.e. ``type(cls)``) of all specified " @@ -2883,11 +2924,11 @@ msgid "" "that criterion, then the class definition will fail with ``TypeError``." msgstr "" -#: ../../reference/datamodel.rst:2459 +#: ../../reference/datamodel.rst:2480 msgid "Preparing the class namespace" msgstr "" -#: ../../reference/datamodel.rst:2464 +#: ../../reference/datamodel.rst:2485 msgid "" "Once the appropriate metaclass has been identified, then the class namespace " "is prepared. If the metaclass has a ``__prepare__`` attribute, it is called " @@ -2899,25 +2940,25 @@ msgid "" "copied into a new ``dict``." msgstr "" -#: ../../reference/datamodel.rst:2473 +#: ../../reference/datamodel.rst:2494 msgid "" "If the metaclass has no ``__prepare__`` attribute, then the class namespace " "is initialised as an empty ordered mapping." msgstr "" -#: ../../reference/datamodel.rst:2478 +#: ../../reference/datamodel.rst:2499 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/datamodel.rst:2479 +#: ../../reference/datamodel.rst:2500 msgid "Introduced the ``__prepare__`` namespace hook" msgstr "" -#: ../../reference/datamodel.rst:2483 +#: ../../reference/datamodel.rst:2504 msgid "Executing the class body" msgstr "" -#: ../../reference/datamodel.rst:2488 +#: ../../reference/datamodel.rst:2509 msgid "" "The class body is executed (approximately) as ``exec(body, globals(), " "namespace)``. The key difference from a normal call to :func:`exec` is that " @@ -2926,7 +2967,7 @@ msgid "" "inside a function." msgstr "" -#: ../../reference/datamodel.rst:2494 +#: ../../reference/datamodel.rst:2515 msgid "" "However, even when the class definition occurs inside the function, methods " "defined inside the class still cannot see names defined at the class scope. " @@ -2935,11 +2976,11 @@ msgid "" "reference described in the next section." msgstr "" -#: ../../reference/datamodel.rst:2503 +#: ../../reference/datamodel.rst:2524 msgid "Creating the class object" msgstr "" -#: ../../reference/datamodel.rst:2510 +#: ../../reference/datamodel.rst:2531 msgid "" "Once the class namespace has been populated by executing the class body, the " "class object is created by calling ``metaclass(name, bases, namespace, " @@ -2947,7 +2988,7 @@ msgid "" "to ``__prepare__``)." msgstr "" -#: ../../reference/datamodel.rst:2515 +#: ../../reference/datamodel.rst:2536 msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " @@ -2958,7 +2999,7 @@ msgid "" "is identified based on the first argument passed to the method." msgstr "" -#: ../../reference/datamodel.rst:2525 +#: ../../reference/datamodel.rst:2546 msgid "" "In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass " "as a ``__classcell__`` entry in the class namespace. If present, this must " @@ -2967,39 +3008,39 @@ msgid "" "in Python 3.8." msgstr "" -#: ../../reference/datamodel.rst:2531 +#: ../../reference/datamodel.rst:2552 msgid "" "When using the default metaclass :class:`type`, or any metaclass that " "ultimately calls ``type.__new__``, the following additional customization " "steps are invoked after creating the class object:" msgstr "" -#: ../../reference/datamodel.rst:2535 +#: ../../reference/datamodel.rst:2556 msgid "" "The ``type.__new__`` method collects all of the attributes in the class " "namespace that define a :meth:`~object.__set_name__` method;" msgstr "" -#: ../../reference/datamodel.rst:2537 +#: ../../reference/datamodel.rst:2558 msgid "" "Those ``__set_name__`` methods are called with the class being defined and " "the assigned name of that particular attribute;" msgstr "" -#: ../../reference/datamodel.rst:2539 +#: ../../reference/datamodel.rst:2560 msgid "" "The :meth:`~object.__init_subclass__` hook is called on the immediate parent " "of the new class in its method resolution order." msgstr "" -#: ../../reference/datamodel.rst:2542 +#: ../../reference/datamodel.rst:2563 msgid "" "After the class object is created, it is passed to the class decorators " "included in the class definition (if any) and the resulting object is bound " "in the local namespace as the defined class." msgstr "" -#: ../../reference/datamodel.rst:2546 +#: ../../reference/datamodel.rst:2567 msgid "" "When a new class is created by ``type.__new__``, the object provided as the " "namespace parameter is copied to a new ordered mapping and the original " @@ -3007,19 +3048,19 @@ msgid "" "becomes the :attr:`~object.__dict__` attribute of the class object." msgstr "" -#: ../../reference/datamodel.rst:2553 +#: ../../reference/datamodel.rst:2574 msgid ":pep:`3135` - New super" msgstr "" -#: ../../reference/datamodel.rst:2554 +#: ../../reference/datamodel.rst:2575 msgid "Describes the implicit ``__class__`` closure reference" msgstr "" -#: ../../reference/datamodel.rst:2558 +#: ../../reference/datamodel.rst:2579 msgid "Uses for metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2560 +#: ../../reference/datamodel.rst:2581 msgid "" "The potential uses for metaclasses are boundless. Some ideas that have been " "explored include enum, logging, interface checking, automatic delegation, " @@ -3027,17 +3068,17 @@ msgid "" "locking/synchronization." msgstr "" -#: ../../reference/datamodel.rst:2567 +#: ../../reference/datamodel.rst:2588 msgid "Customizing instance and subclass checks" msgstr "" -#: ../../reference/datamodel.rst:2569 +#: ../../reference/datamodel.rst:2590 msgid "" "The following methods are used to override the default behavior of the :func:" "`isinstance` and :func:`issubclass` built-in functions." msgstr "" -#: ../../reference/datamodel.rst:2572 +#: ../../reference/datamodel.rst:2593 msgid "" "In particular, the metaclass :class:`abc.ABCMeta` implements these methods " "in order to allow the addition of Abstract Base Classes (ABCs) as \"virtual " @@ -3045,21 +3086,21 @@ msgid "" "other ABCs." msgstr "" -#: ../../reference/datamodel.rst:2579 +#: ../../reference/datamodel.rst:2600 msgid "" "Return true if *instance* should be considered a (direct or indirect) " "instance of *class*. If defined, called to implement ``isinstance(instance, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2586 +#: ../../reference/datamodel.rst:2607 msgid "" "Return true if *subclass* should be considered a (direct or indirect) " "subclass of *class*. If defined, called to implement ``issubclass(subclass, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2591 +#: ../../reference/datamodel.rst:2612 msgid "" "Note that these methods are looked up on the type (metaclass) of a class. " "They cannot be defined as class methods in the actual class. This is " @@ -3067,11 +3108,11 @@ msgid "" "only in this case the instance is itself a class." msgstr "" -#: ../../reference/datamodel.rst:2598 +#: ../../reference/datamodel.rst:2619 msgid ":pep:`3119` - Introducing Abstract Base Classes" msgstr "" -#: ../../reference/datamodel.rst:2599 +#: ../../reference/datamodel.rst:2620 msgid "" "Includes the specification for customizing :func:`isinstance` and :func:" "`issubclass` behavior through :meth:`~class.__instancecheck__` and :meth:" @@ -3080,11 +3121,11 @@ msgid "" "language." msgstr "" -#: ../../reference/datamodel.rst:2607 +#: ../../reference/datamodel.rst:2628 msgid "Emulating generic types" msgstr "" -#: ../../reference/datamodel.rst:2609 +#: ../../reference/datamodel.rst:2630 msgid "" "When using :term:`type annotations<annotation>`, it is often useful to " "*parameterize* a :term:`generic type` using Python's square-brackets " @@ -3092,65 +3133,65 @@ msgid "" "a :class:`list` in which all the elements are of type :class:`int`." msgstr "" -#: ../../reference/datamodel.rst:2616 +#: ../../reference/datamodel.rst:2637 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/datamodel.rst:2617 +#: ../../reference/datamodel.rst:2638 msgid "Introducing Python's framework for type annotations" msgstr "" -#: ../../reference/datamodel.rst:2619 +#: ../../reference/datamodel.rst:2640 msgid ":ref:`Generic Alias Types<types-genericalias>`" msgstr ":ref:`泛型別名型別 <types-genericalias>`" -#: ../../reference/datamodel.rst:2620 +#: ../../reference/datamodel.rst:2641 msgid "Documentation for objects representing parameterized generic classes" msgstr "" -#: ../../reference/datamodel.rst:2622 +#: ../../reference/datamodel.rst:2643 msgid "" ":ref:`Generics`, :ref:`user-defined generics<user-defined-generics>` and :" "class:`typing.Generic`" msgstr "" -#: ../../reference/datamodel.rst:2623 +#: ../../reference/datamodel.rst:2644 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" -#: ../../reference/datamodel.rst:2626 +#: ../../reference/datamodel.rst:2647 msgid "" "A class can *generally* only be parameterized if it defines the special " "class method ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2631 +#: ../../reference/datamodel.rst:2652 msgid "" "Return an object representing the specialization of a generic class by type " "arguments found in *key*." msgstr "" -#: ../../reference/datamodel.rst:2634 +#: ../../reference/datamodel.rst:2655 msgid "" "When defined on a class, ``__class_getitem__()`` is automatically a class " "method. As such, there is no need for it to be decorated with :func:" "`@classmethod<classmethod>` when it is defined." msgstr "" -#: ../../reference/datamodel.rst:2640 +#: ../../reference/datamodel.rst:2661 msgid "The purpose of *__class_getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2642 +#: ../../reference/datamodel.rst:2663 msgid "" "The purpose of :meth:`~object.__class_getitem__` is to allow runtime " "parameterization of standard-library generic classes in order to more easily " "apply :term:`type hints<type hint>` to these classes." msgstr "" -#: ../../reference/datamodel.rst:2646 +#: ../../reference/datamodel.rst:2667 msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " @@ -3159,7 +3200,7 @@ msgid "" "own implementation of ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2652 +#: ../../reference/datamodel.rst:2673 msgid "" "Custom implementations of :meth:`~object.__class_getitem__` on classes " "defined outside of the standard library may not be understood by third-party " @@ -3167,11 +3208,11 @@ msgid "" "purposes other than type hinting is discouraged." msgstr "" -#: ../../reference/datamodel.rst:2662 +#: ../../reference/datamodel.rst:2683 msgid "*__class_getitem__* versus *__getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2664 +#: ../../reference/datamodel.rst:2685 msgid "" "Usually, the :ref:`subscription<subscriptions>` of an object using square " "brackets will call the :meth:`~object.__getitem__` instance method defined " @@ -3181,14 +3222,14 @@ msgid "" "genericalias>` object if it is properly defined." msgstr "" -#: ../../reference/datamodel.rst:2671 +#: ../../reference/datamodel.rst:2692 msgid "" "Presented with the :term:`expression` ``obj[x]``, the Python interpreter " "follows something like the following process to decide whether :meth:" "`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" msgstr "" -#: ../../reference/datamodel.rst:2676 +#: ../../reference/datamodel.rst:2697 msgid "" "from inspect import isclass\n" "\n" @@ -3214,7 +3255,7 @@ msgid "" " )" msgstr "" -#: ../../reference/datamodel.rst:2699 +#: ../../reference/datamodel.rst:2720 msgid "" "In Python, all classes are themselves instances of other classes. The class " "of a class is known as that class's :term:`metaclass`, and most classes have " @@ -3224,7 +3265,7 @@ msgid "" "__class_getitem__` being called::" msgstr "" -#: ../../reference/datamodel.rst:2706 +#: ../../reference/datamodel.rst:2727 msgid "" ">>> # list has class \"type\" as its metaclass, like most classes:\n" ">>> type(list)\n" @@ -3239,14 +3280,14 @@ msgid "" "<class 'types.GenericAlias'>" msgstr "" -#: ../../reference/datamodel.rst:2718 +#: ../../reference/datamodel.rst:2739 msgid "" "However, if a class has a custom metaclass that defines :meth:`~object." "__getitem__`, subscribing the class may result in different behaviour. An " "example of this can be found in the :mod:`enum` module::" msgstr "" -#: ../../reference/datamodel.rst:2722 +#: ../../reference/datamodel.rst:2743 msgid "" ">>> from enum import Enum\n" ">>> class Menu(Enum):\n" @@ -3266,33 +3307,33 @@ msgid "" "<enum 'Menu'>" msgstr "" -#: ../../reference/datamodel.rst:2741 +#: ../../reference/datamodel.rst:2762 msgid ":pep:`560` - Core Support for typing module and generic types" msgstr "" -#: ../../reference/datamodel.rst:2742 +#: ../../reference/datamodel.rst:2763 msgid "" "Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" "`subscription<subscriptions>` results in ``__class_getitem__()`` being " "called instead of :meth:`~object.__getitem__`" msgstr "" -#: ../../reference/datamodel.rst:2750 +#: ../../reference/datamodel.rst:2771 msgid "Emulating callable objects" msgstr "" -#: ../../reference/datamodel.rst:2757 +#: ../../reference/datamodel.rst:2778 msgid "" "Called when the instance is \"called\" as a function; if this method is " "defined, ``x(arg1, arg2, ...)`` roughly translates to ``type(x).__call__(x, " "arg1, ...)``." msgstr "" -#: ../../reference/datamodel.rst:2764 +#: ../../reference/datamodel.rst:2785 msgid "Emulating container types" msgstr "" -#: ../../reference/datamodel.rst:2766 +#: ../../reference/datamodel.rst:2787 msgid "" "The following methods can be defined to implement container objects. " "Containers usually are :term:`sequences <sequence>` (such as :class:`lists " @@ -3328,7 +3369,7 @@ msgid "" "should iterate through the values." msgstr "" -#: ../../reference/datamodel.rst:2807 +#: ../../reference/datamodel.rst:2828 msgid "" "Called to implement the built-in function :func:`len`. Should return the " "length of the object, an integer ``>=`` 0. Also, an object that doesn't " @@ -3336,7 +3377,7 @@ msgid "" "returns zero is considered to be false in a Boolean context." msgstr "" -#: ../../reference/datamodel.rst:2814 +#: ../../reference/datamodel.rst:2835 msgid "" "In CPython, the length is required to be at most :data:`sys.maxsize`. If the " "length is larger than :data:`!sys.maxsize` some features (such as :func:" @@ -3345,7 +3386,7 @@ msgid "" "`~object.__bool__` method." msgstr "" -#: ../../reference/datamodel.rst:2823 +#: ../../reference/datamodel.rst:2844 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " @@ -3355,28 +3396,28 @@ msgid "" "never required for correctness." msgstr "" -#: ../../reference/datamodel.rst:2837 +#: ../../reference/datamodel.rst:2858 msgid "" "Slicing is done exclusively with the following three methods. A call like ::" msgstr "" -#: ../../reference/datamodel.rst:2839 +#: ../../reference/datamodel.rst:2860 msgid "a[1:2] = b" msgstr "a[1:2] = b" -#: ../../reference/datamodel.rst:2841 +#: ../../reference/datamodel.rst:2862 msgid "is translated to ::" msgstr "" -#: ../../reference/datamodel.rst:2843 +#: ../../reference/datamodel.rst:2864 msgid "a[slice(1, 2, None)] = b" msgstr "a[slice(1, 2, None)] = b" -#: ../../reference/datamodel.rst:2845 +#: ../../reference/datamodel.rst:2866 msgid "and so forth. Missing slice items are always filled in with ``None``." msgstr "" -#: ../../reference/datamodel.rst:2850 +#: ../../reference/datamodel.rst:2871 msgid "" "Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " "the accepted keys should be integers. Optionally, they may support :class:" @@ -3388,20 +3429,20 @@ msgid "" "`KeyError` should be raised." msgstr "" -#: ../../reference/datamodel.rst:2862 +#: ../../reference/datamodel.rst:2883 msgid "" ":keyword:`for` loops expect that an :exc:`IndexError` will be raised for " "illegal indexes to allow proper detection of the end of the sequence." msgstr "" -#: ../../reference/datamodel.rst:2867 +#: ../../reference/datamodel.rst:2888 msgid "" "When :ref:`subscripting<subscriptions>` a *class*, the special class method :" "meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " "See :ref:`classgetitem-versus-getitem` for more details." msgstr "" -#: ../../reference/datamodel.rst:2875 +#: ../../reference/datamodel.rst:2896 msgid "" "Called to implement assignment to ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3410,7 +3451,7 @@ msgid "" "for improper *key* values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2884 +#: ../../reference/datamodel.rst:2905 msgid "" "Called to implement deletion of ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3419,13 +3460,13 @@ msgid "" "values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2893 +#: ../../reference/datamodel.rst:2914 msgid "" "Called by :class:`dict`\\ .\\ :meth:`__getitem__` to implement ``self[key]`` " "for dict subclasses when key is not in the dictionary." msgstr "" -#: ../../reference/datamodel.rst:2899 +#: ../../reference/datamodel.rst:2920 msgid "" "This method is called when an :term:`iterator` is required for a container. " "This method should return a new iterator object that can iterate over all " @@ -3433,14 +3474,14 @@ msgid "" "of the container." msgstr "" -#: ../../reference/datamodel.rst:2907 +#: ../../reference/datamodel.rst:2928 msgid "" "Called (if present) by the :func:`reversed` built-in to implement reverse " "iteration. It should return a new iterator object that iterates over all " "the objects in the container in reverse order." msgstr "" -#: ../../reference/datamodel.rst:2911 +#: ../../reference/datamodel.rst:2932 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " "built-in will fall back to using the sequence protocol (:meth:`__len__` and :" @@ -3449,7 +3490,7 @@ msgid "" "more efficient than the one provided by :func:`reversed`." msgstr "" -#: ../../reference/datamodel.rst:2918 +#: ../../reference/datamodel.rst:2939 msgid "" "The membership test operators (:keyword:`in` and :keyword:`not in`) are " "normally implemented as an iteration through a container. However, container " @@ -3457,14 +3498,14 @@ msgid "" "implementation, which also does not require the object be iterable." msgstr "" -#: ../../reference/datamodel.rst:2925 +#: ../../reference/datamodel.rst:2946 msgid "" "Called to implement membership test operators. Should return true if *item* " "is in *self*, false otherwise. For mapping objects, this should consider " "the keys of the mapping rather than the values or the key-item pairs." msgstr "" -#: ../../reference/datamodel.rst:2929 +#: ../../reference/datamodel.rst:2950 msgid "" "For objects that don't define :meth:`__contains__`, the membership test " "first tries iteration via :meth:`__iter__`, then the old sequence iteration " @@ -3472,11 +3513,11 @@ msgid "" "reference <membership-test-details>`." msgstr "" -#: ../../reference/datamodel.rst:2938 +#: ../../reference/datamodel.rst:2959 msgid "Emulating numeric types" msgstr "" -#: ../../reference/datamodel.rst:2940 +#: ../../reference/datamodel.rst:2961 msgid "" "The following methods can be defined to emulate numeric objects. Methods " "corresponding to operations that are not supported by the particular kind of " @@ -3484,7 +3525,7 @@ msgid "" "should be left undefined." msgstr "" -#: ../../reference/datamodel.rst:2966 +#: ../../reference/datamodel.rst:2987 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3498,13 +3539,13 @@ msgid "" "function is to be supported." msgstr "" -#: ../../reference/datamodel.rst:2977 +#: ../../reference/datamodel.rst:2998 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return :data:`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3000 +#: ../../reference/datamodel.rst:3021 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3517,13 +3558,13 @@ msgid "" "`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3012 +#: ../../reference/datamodel.rst:3033 msgid "" "Note that ternary :func:`pow` will not try calling :meth:`__rpow__` (the " "coercion rules would become too complicated)." msgstr "" -#: ../../reference/datamodel.rst:3017 +#: ../../reference/datamodel.rst:3038 msgid "" "If the right operand's type is a subclass of the left operand's type and " "that subclass provides a different implementation of the reflected method " @@ -3532,7 +3573,7 @@ msgid "" "ancestors' operations." msgstr "" -#: ../../reference/datamodel.rst:3038 +#: ../../reference/datamodel.rst:3059 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -3550,19 +3591,19 @@ msgid "" "data model." msgstr "" -#: ../../reference/datamodel.rst:3061 +#: ../../reference/datamodel.rst:3082 msgid "" "Called to implement the unary arithmetic operations (``-``, ``+``, :func:" "`abs` and ``~``)." msgstr "" -#: ../../reference/datamodel.rst:3074 +#: ../../reference/datamodel.rst:3095 msgid "" "Called to implement the built-in functions :func:`complex`, :func:`int` and :" "func:`float`. Should return a value of the appropriate type." msgstr "" -#: ../../reference/datamodel.rst:3081 +#: ../../reference/datamodel.rst:3102 msgid "" "Called to implement :func:`operator.index`, and whenever Python needs to " "losslessly convert the numeric object to an integer object (such as in " @@ -3571,14 +3612,14 @@ msgid "" "integer type. Must return an integer." msgstr "" -#: ../../reference/datamodel.rst:3087 +#: ../../reference/datamodel.rst:3108 msgid "" "If :meth:`__int__`, :meth:`__float__` and :meth:`__complex__` are not " "defined then corresponding built-in functions :func:`int`, :func:`float` " "and :func:`complex` fall back to :meth:`__index__`." msgstr "" -#: ../../reference/datamodel.rst:3099 +#: ../../reference/datamodel.rst:3120 msgid "" "Called to implement the built-in function :func:`round` and :mod:`math` " "functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`. " @@ -3587,21 +3628,21 @@ msgid "" "(typically an :class:`int`)." msgstr "" -#: ../../reference/datamodel.rst:3105 +#: ../../reference/datamodel.rst:3126 msgid "" "The built-in function :func:`int` falls back to :meth:`__trunc__` if " "neither :meth:`__int__` nor :meth:`__index__` is defined." msgstr "" -#: ../../reference/datamodel.rst:3108 +#: ../../reference/datamodel.rst:3129 msgid "The delegation of :func:`int` to :meth:`__trunc__` is deprecated." msgstr "" -#: ../../reference/datamodel.rst:3115 +#: ../../reference/datamodel.rst:3136 msgid "With Statement Context Managers" msgstr "" -#: ../../reference/datamodel.rst:3117 +#: ../../reference/datamodel.rst:3138 msgid "" "A :dfn:`context manager` is an object that defines the runtime context to be " "established when executing a :keyword:`with` statement. The context manager " @@ -3611,32 +3652,32 @@ msgid "" "can also be used by directly invoking their methods." msgstr "" -#: ../../reference/datamodel.rst:3128 +#: ../../reference/datamodel.rst:3149 msgid "" "Typical uses of context managers include saving and restoring various kinds " "of global state, locking and unlocking resources, closing opened files, etc." msgstr "" -#: ../../reference/datamodel.rst:3131 +#: ../../reference/datamodel.rst:3152 msgid "" "For more information on context managers, see :ref:`typecontextmanager`." msgstr "" -#: ../../reference/datamodel.rst:3136 +#: ../../reference/datamodel.rst:3157 msgid "" "Enter the runtime context related to this object. The :keyword:`with` " "statement will bind this method's return value to the target(s) specified in " "the :keyword:`!as` clause of the statement, if any." msgstr "" -#: ../../reference/datamodel.rst:3143 +#: ../../reference/datamodel.rst:3164 msgid "" "Exit the runtime context related to this object. The parameters describe the " "exception that caused the context to be exited. If the context was exited " "without an exception, all three arguments will be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:3147 +#: ../../reference/datamodel.rst:3168 msgid "" "If an exception is supplied, and the method wishes to suppress the exception " "(i.e., prevent it from being propagated), it should return a true value. " @@ -3644,27 +3685,27 @@ msgid "" "method." msgstr "" -#: ../../reference/datamodel.rst:3151 +#: ../../reference/datamodel.rst:3172 msgid "" "Note that :meth:`~object.__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" -#: ../../reference/datamodel.rst:3157 +#: ../../reference/datamodel.rst:3178 msgid ":pep:`343` - The \"with\" statement" msgstr ":pep:`343` - \"with\" 陳述式" -#: ../../reference/datamodel.rst:3158 +#: ../../reference/datamodel.rst:3179 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3165 +#: ../../reference/datamodel.rst:3186 msgid "Customizing positional arguments in class pattern matching" msgstr "" -#: ../../reference/datamodel.rst:3167 +#: ../../reference/datamodel.rst:3188 msgid "" "When using a class name in a pattern, positional arguments in the pattern " "are not allowed by default, i.e. ``case MyClass(x, y)`` is typically invalid " @@ -3672,7 +3713,7 @@ msgid "" "pattern, the class needs to define a *__match_args__* attribute." msgstr "" -#: ../../reference/datamodel.rst:3174 +#: ../../reference/datamodel.rst:3195 msgid "" "This class variable can be assigned a tuple of strings. When this class is " "used in a class pattern with positional arguments, each positional argument " @@ -3681,7 +3722,7 @@ msgid "" "to setting it to ``()``." msgstr "" -#: ../../reference/datamodel.rst:3180 +#: ../../reference/datamodel.rst:3201 msgid "" "For example, if ``MyClass.__match_args__`` is ``(\"left\", \"center\", " "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " @@ -3691,19 +3732,19 @@ msgid "" "exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:3190 +#: ../../reference/datamodel.rst:3211 msgid ":pep:`634` - Structural Pattern Matching" msgstr "" -#: ../../reference/datamodel.rst:3191 +#: ../../reference/datamodel.rst:3212 msgid "The specification for the Python ``match`` statement." msgstr "" -#: ../../reference/datamodel.rst:3197 +#: ../../reference/datamodel.rst:3218 msgid "Emulating buffer types" msgstr "" -#: ../../reference/datamodel.rst:3199 +#: ../../reference/datamodel.rst:3220 msgid "" "The :ref:`buffer protocol <bufferobjects>` provides a way for Python objects " "to expose efficient access to a low-level memory array. This protocol is " @@ -3711,13 +3752,13 @@ msgid "" "and third-party libraries may define additional buffer types." msgstr "" -#: ../../reference/datamodel.rst:3204 +#: ../../reference/datamodel.rst:3225 msgid "" "While buffer types are usually implemented in C, it is also possible to " "implement the protocol in Python." msgstr "" -#: ../../reference/datamodel.rst:3209 +#: ../../reference/datamodel.rst:3230 msgid "" "Called when a buffer is requested from *self* (for example, by the :class:" "`memoryview` constructor). The *flags* argument is an integer representing " @@ -3727,7 +3768,7 @@ msgid "" "`memoryview` object." msgstr "" -#: ../../reference/datamodel.rst:3218 +#: ../../reference/datamodel.rst:3239 msgid "" "Called when a buffer is no longer needed. The *buffer* argument is a :class:" "`memoryview` object that was previously returned by :meth:`~object." @@ -3736,28 +3777,28 @@ msgid "" "to perform any cleanup are not required to implement this method." msgstr "" -#: ../../reference/datamodel.rst:3229 +#: ../../reference/datamodel.rst:3250 msgid ":pep:`688` - Making the buffer protocol accessible in Python" msgstr "" -#: ../../reference/datamodel.rst:3230 +#: ../../reference/datamodel.rst:3251 msgid "" "Introduces the Python ``__buffer__`` and ``__release_buffer__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3232 +#: ../../reference/datamodel.rst:3253 msgid ":class:`collections.abc.Buffer`" msgstr ":class:`collections.abc.Buffer`" -#: ../../reference/datamodel.rst:3233 +#: ../../reference/datamodel.rst:3254 msgid "ABC for buffer types." msgstr "" -#: ../../reference/datamodel.rst:3238 +#: ../../reference/datamodel.rst:3259 msgid "Special method lookup" msgstr "" -#: ../../reference/datamodel.rst:3240 +#: ../../reference/datamodel.rst:3261 msgid "" "For custom classes, implicit invocations of special methods are only " "guaranteed to work correctly if defined on an object's type, not in the " @@ -3765,7 +3806,7 @@ msgid "" "following code raises an exception::" msgstr "" -#: ../../reference/datamodel.rst:3245 +#: ../../reference/datamodel.rst:3266 msgid "" ">>> class C:\n" "... pass\n" @@ -3787,7 +3828,7 @@ msgstr "" " File \"<stdin>\", line 1, in <module>\n" "TypeError: object of type 'C' has no len()" -#: ../../reference/datamodel.rst:3255 +#: ../../reference/datamodel.rst:3276 msgid "" "The rationale behind this behaviour lies with a number of special methods " "such as :meth:`~object.__hash__` and :meth:`~object.__repr__` that are " @@ -3796,7 +3837,7 @@ msgid "" "invoked on the type object itself::" msgstr "" -#: ../../reference/datamodel.rst:3262 +#: ../../reference/datamodel.rst:3283 msgid "" ">>> 1 .__hash__() == hash(1)\n" "True\n" @@ -3812,14 +3853,14 @@ msgstr "" " File \"<stdin>\", line 1, in <module>\n" "TypeError: descriptor '__hash__' of 'int' object needs an argument" -#: ../../reference/datamodel.rst:3269 +#: ../../reference/datamodel.rst:3290 msgid "" "Incorrectly attempting to invoke an unbound method of a class in this way is " "sometimes referred to as 'metaclass confusion', and is avoided by bypassing " "the instance when looking up special methods::" msgstr "" -#: ../../reference/datamodel.rst:3273 +#: ../../reference/datamodel.rst:3294 msgid "" ">>> type(1).__hash__(1) == hash(1)\n" "True\n" @@ -3831,14 +3872,14 @@ msgstr "" ">>> type(int).__hash__(int) == hash(int)\n" "True" -#: ../../reference/datamodel.rst:3278 +#: ../../reference/datamodel.rst:3299 msgid "" "In addition to bypassing any instance attributes in the interest of " "correctness, implicit special method lookup generally also bypasses the :" "meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" -#: ../../reference/datamodel.rst:3282 +#: ../../reference/datamodel.rst:3303 msgid "" ">>> class Meta(type):\n" "... def __getattribute__(*args):\n" @@ -3863,7 +3904,7 @@ msgid "" "10" msgstr "" -#: ../../reference/datamodel.rst:3304 +#: ../../reference/datamodel.rst:3325 msgid "" "Bypassing the :meth:`~object.__getattribute__` machinery in this fashion " "provides significant scope for speed optimisations within the interpreter, " @@ -3872,36 +3913,36 @@ msgid "" "consistently invoked by the interpreter)." msgstr "" -#: ../../reference/datamodel.rst:3315 +#: ../../reference/datamodel.rst:3336 msgid "Coroutines" msgstr "協程" -#: ../../reference/datamodel.rst:3319 +#: ../../reference/datamodel.rst:3340 msgid "Awaitable Objects" msgstr "" -#: ../../reference/datamodel.rst:3321 +#: ../../reference/datamodel.rst:3342 msgid "" "An :term:`awaitable` object generally implements an :meth:`~object." "__await__` method. :term:`Coroutine objects <coroutine>` returned from :" "keyword:`async def` functions are awaitable." msgstr "" -#: ../../reference/datamodel.rst:3327 +#: ../../reference/datamodel.rst:3348 msgid "" "The :term:`generator iterator` objects returned from generators decorated " "with :func:`types.coroutine` are also awaitable, but they do not implement :" "meth:`~object.__await__`." msgstr "" -#: ../../reference/datamodel.rst:3333 +#: ../../reference/datamodel.rst:3354 msgid "" "Must return an :term:`iterator`. Should be used to implement :term:" "`awaitable` objects. For instance, :class:`asyncio.Future` implements this " "method to be compatible with the :keyword:`await` expression." msgstr "" -#: ../../reference/datamodel.rst:3339 +#: ../../reference/datamodel.rst:3360 msgid "" "The language doesn't place any restriction on the type or value of the " "objects yielded by the iterator returned by ``__await__``, as this is " @@ -3909,15 +3950,15 @@ msgid "" "g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." msgstr "" -#: ../../reference/datamodel.rst:3347 +#: ../../reference/datamodel.rst:3368 msgid ":pep:`492` for additional information about awaitable objects." msgstr "" -#: ../../reference/datamodel.rst:3353 +#: ../../reference/datamodel.rst:3374 msgid "Coroutine Objects" msgstr "" -#: ../../reference/datamodel.rst:3355 +#: ../../reference/datamodel.rst:3376 msgid "" ":term:`Coroutine objects <coroutine>` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`~object.__await__` " @@ -3928,18 +3969,18 @@ msgid "" "should not directly raise unhandled :exc:`StopIteration` exceptions." msgstr "" -#: ../../reference/datamodel.rst:3363 +#: ../../reference/datamodel.rst:3384 msgid "" "Coroutines also have the methods listed below, which are analogous to those " "of generators (see :ref:`generator-methods`). However, unlike generators, " "coroutines do not directly support iteration." msgstr "" -#: ../../reference/datamodel.rst:3367 +#: ../../reference/datamodel.rst:3388 msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" -#: ../../reference/datamodel.rst:3373 +#: ../../reference/datamodel.rst:3394 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " "is equivalent to advancing the iterator returned by :meth:`~object." @@ -3950,7 +3991,7 @@ msgid "" "value, described above." msgstr "" -#: ../../reference/datamodel.rst:3384 +#: ../../reference/datamodel.rst:3405 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " @@ -3961,13 +4002,13 @@ msgid "" "not caught in the coroutine, it propagates back to the caller." msgstr "" -#: ../../reference/datamodel.rst:3395 +#: ../../reference/datamodel.rst:3416 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" -#: ../../reference/datamodel.rst:3400 +#: ../../reference/datamodel.rst:3421 msgid "" "Causes the coroutine to clean itself up and exit. If the coroutine is " "suspended, this method first delegates to the :meth:`~generator.close` " @@ -3977,42 +4018,42 @@ msgid "" "is marked as having finished executing, even if it was never started." msgstr "" -#: ../../reference/datamodel.rst:3408 +#: ../../reference/datamodel.rst:3429 msgid "" "Coroutine objects are automatically closed using the above process when they " "are about to be destroyed." msgstr "" -#: ../../reference/datamodel.rst:3414 +#: ../../reference/datamodel.rst:3435 msgid "Asynchronous Iterators" msgstr "" -#: ../../reference/datamodel.rst:3416 +#: ../../reference/datamodel.rst:3437 msgid "" "An *asynchronous iterator* can call asynchronous code in its ``__anext__`` " "method." msgstr "" -#: ../../reference/datamodel.rst:3419 +#: ../../reference/datamodel.rst:3440 msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "" -#: ../../reference/datamodel.rst:3423 +#: ../../reference/datamodel.rst:3444 msgid "Must return an *asynchronous iterator* object." msgstr "" -#: ../../reference/datamodel.rst:3427 +#: ../../reference/datamodel.rst:3448 msgid "" "Must return an *awaitable* resulting in a next value of the iterator. " "Should raise a :exc:`StopAsyncIteration` error when the iteration is over." msgstr "" -#: ../../reference/datamodel.rst:3430 +#: ../../reference/datamodel.rst:3451 msgid "An example of an asynchronous iterable object::" msgstr "" -#: ../../reference/datamodel.rst:3432 +#: ../../reference/datamodel.rst:3453 msgid "" "class Reader:\n" " async def readline(self):\n" @@ -4040,53 +4081,53 @@ msgstr "" " raise StopAsyncIteration\n" " return val" -#: ../../reference/datamodel.rst:3447 +#: ../../reference/datamodel.rst:3468 msgid "" "Prior to Python 3.7, :meth:`~object.__aiter__` could return an *awaitable* " "that would resolve to an :term:`asynchronous iterator <asynchronous " "iterator>`." msgstr "" -#: ../../reference/datamodel.rst:3452 +#: ../../reference/datamodel.rst:3473 msgid "" "Starting with Python 3.7, :meth:`~object.__aiter__` must return an " "asynchronous iterator object. Returning anything else will result in a :exc:" "`TypeError` error." msgstr "" -#: ../../reference/datamodel.rst:3460 +#: ../../reference/datamodel.rst:3481 msgid "Asynchronous Context Managers" msgstr "" -#: ../../reference/datamodel.rst:3462 +#: ../../reference/datamodel.rst:3483 msgid "" "An *asynchronous context manager* is a *context manager* that is able to " "suspend execution in its ``__aenter__`` and ``__aexit__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3465 +#: ../../reference/datamodel.rst:3486 msgid "" "Asynchronous context managers can be used in an :keyword:`async with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3469 +#: ../../reference/datamodel.rst:3490 msgid "" "Semantically similar to :meth:`~object.__enter__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3474 +#: ../../reference/datamodel.rst:3495 msgid "" "Semantically similar to :meth:`~object.__exit__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3477 +#: ../../reference/datamodel.rst:3498 msgid "An example of an asynchronous context manager class::" msgstr "" -#: ../../reference/datamodel.rst:3479 +#: ../../reference/datamodel.rst:3500 msgid "" "class AsyncContextManager:\n" " async def __aenter__(self):\n" @@ -4102,26 +4143,27 @@ msgstr "" " async def __aexit__(self, exc_type, exc, tb):\n" " await log('exiting context')" -#: ../../reference/datamodel.rst:3490 +#: ../../reference/datamodel.rst:3511 msgid "Footnotes" msgstr "註解" -#: ../../reference/datamodel.rst:3491 +#: ../../reference/datamodel.rst:3512 msgid "" "It *is* possible in some cases to change an object's type, under certain " "controlled conditions. It generally isn't a good idea though, since it can " "lead to some very strange behaviour if it is handled incorrectly." msgstr "" -#: ../../reference/datamodel.rst:3495 +#: ../../reference/datamodel.rst:3516 msgid "" "The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." -"__reversed__`, and :meth:`~object.__contains__` methods have special " -"handling for this; others will still raise a :exc:`TypeError`, but may do so " +"__reversed__`, :meth:`~object.__contains__`, :meth:`~object." +"__class_getitem__` and :meth:`~os.PathLike.__fspath__` methods have special " +"handling for this. Others will still raise a :exc:`TypeError`, but may do so " "by relying on the behavior that ``None`` is not callable." msgstr "" -#: ../../reference/datamodel.rst:3501 +#: ../../reference/datamodel.rst:3523 msgid "" "\"Does not support\" here means that the class has no such method, or the " "method returns :data:`NotImplemented`. Do not set the method to ``None`` if " @@ -4129,7 +4171,7 @@ msgid "" "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" -#: ../../reference/datamodel.rst:3507 +#: ../../reference/datamodel.rst:3529 msgid "" "For operands of the same type, it is assumed that if the non-reflected " "method -- such as :meth:`~object.__add__` -- fails then the overall " @@ -4149,10 +4191,10 @@ msgstr "" #: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:661 #: ../../reference/datamodel.rst:799 ../../reference/datamodel.rst:823 #: ../../reference/datamodel.rst:856 ../../reference/datamodel.rst:935 -#: ../../reference/datamodel.rst:1004 ../../reference/datamodel.rst:1031 -#: ../../reference/datamodel.rst:1093 ../../reference/datamodel.rst:1197 -#: ../../reference/datamodel.rst:1304 ../../reference/datamodel.rst:1404 -#: ../../reference/datamodel.rst:1818 ../../reference/datamodel.rst:2833 +#: ../../reference/datamodel.rst:1013 ../../reference/datamodel.rst:1040 +#: ../../reference/datamodel.rst:1102 ../../reference/datamodel.rst:1206 +#: ../../reference/datamodel.rst:1315 ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1839 ../../reference/datamodel.rst:2854 msgid "object" msgstr "object(物件)" @@ -4163,13 +4205,13 @@ msgstr "data(資料)" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:296 #: ../../reference/datamodel.rst:343 ../../reference/datamodel.rst:427 #: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:799 -#: ../../reference/datamodel.rst:1050 ../../reference/datamodel.rst:1487 -#: ../../reference/datamodel.rst:1729 ../../reference/datamodel.rst:1734 -#: ../../reference/datamodel.rst:1818 ../../reference/datamodel.rst:2374 -#: ../../reference/datamodel.rst:2803 ../../reference/datamodel.rst:2961 -#: ../../reference/datamodel.rst:2996 ../../reference/datamodel.rst:3010 -#: ../../reference/datamodel.rst:3059 ../../reference/datamodel.rst:3069 -#: ../../reference/datamodel.rst:3097 +#: ../../reference/datamodel.rst:1059 ../../reference/datamodel.rst:1508 +#: ../../reference/datamodel.rst:1750 ../../reference/datamodel.rst:1755 +#: ../../reference/datamodel.rst:1839 ../../reference/datamodel.rst:2395 +#: ../../reference/datamodel.rst:2824 ../../reference/datamodel.rst:2982 +#: ../../reference/datamodel.rst:3017 ../../reference/datamodel.rst:3031 +#: ../../reference/datamodel.rst:3080 ../../reference/datamodel.rst:3090 +#: ../../reference/datamodel.rst:3118 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -4178,7 +4220,7 @@ msgid "id" msgstr "id" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:126 -#: ../../reference/datamodel.rst:2374 +#: ../../reference/datamodel.rst:2395 msgid "type" msgstr "type(型別)" @@ -4229,7 +4271,7 @@ msgstr "extension(擴充)" #: ../../reference/datamodel.rst:126 ../../reference/datamodel.rst:400 #: ../../reference/datamodel.rst:401 ../../reference/datamodel.rst:502 #: ../../reference/datamodel.rst:856 ../../reference/datamodel.rst:876 -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1059 msgid "module" msgstr "module(模組)" @@ -4244,8 +4286,8 @@ msgid "language" msgstr "language(語言)" #: ../../reference/datamodel.rst:139 ../../reference/datamodel.rst:935 -#: ../../reference/datamodel.rst:953 ../../reference/datamodel.rst:1004 -#: ../../reference/datamodel.rst:1024 +#: ../../reference/datamodel.rst:953 ../../reference/datamodel.rst:1013 +#: ../../reference/datamodel.rst:1033 msgid "attribute" msgstr "attribute(屬性)" @@ -4265,7 +4307,7 @@ msgstr "..." msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" -#: ../../reference/datamodel.rst:196 ../../reference/datamodel.rst:1031 +#: ../../reference/datamodel.rst:196 ../../reference/datamodel.rst:1040 msgid "numeric" msgstr "numeric(數值)" @@ -4302,16 +4344,16 @@ msgstr "number(數字)" msgid "Java" msgstr "Java" -#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3069 +#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3090 msgid "complex" msgstr "complex(複數)" #: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:427 -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:2803 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:2824 msgid "len" msgstr "len" -#: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:1031 +#: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:1040 msgid "sequence" msgstr "sequence(序列)" @@ -4340,8 +4382,8 @@ msgstr "immutable sequence(不可變序列)" msgid "immutable" msgstr "immutable(不可變)" -#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1704 -#: ../../reference/datamodel.rst:1734 +#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1725 +#: ../../reference/datamodel.rst:1755 msgid "string" msgstr "string(字串)" @@ -4377,7 +4419,7 @@ msgstr "singleton(單例)" msgid "empty" msgstr "empty(空的)" -#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:1729 +#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:1750 msgid "bytes" msgstr "bytes(位元組)" @@ -4394,13 +4436,13 @@ msgid "mutable" msgstr "mutable(可變的)" #: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:953 -#: ../../reference/datamodel.rst:1024 +#: ../../reference/datamodel.rst:1033 msgid "assignment" msgstr "assignment(賦值)" #: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:856 -#: ../../reference/datamodel.rst:1441 ../../reference/datamodel.rst:1623 -#: ../../reference/datamodel.rst:3124 +#: ../../reference/datamodel.rst:1462 ../../reference/datamodel.rst:1644 +#: ../../reference/datamodel.rst:3145 msgid "statement" msgstr "statement(陳述式)" @@ -4432,12 +4474,12 @@ msgstr "set(集合)" msgid "frozenset" msgstr "frozenset(凍結集合)" -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:1031 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:1040 msgid "mapping" msgstr "mapping(對映)" #: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:935 -#: ../../reference/datamodel.rst:1818 +#: ../../reference/datamodel.rst:1839 msgid "dictionary" msgstr "dictionary(字典)" @@ -4460,7 +4502,7 @@ msgid "function" msgstr "function (函式)" #: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:935 -#: ../../reference/datamodel.rst:958 ../../reference/datamodel.rst:2755 +#: ../../reference/datamodel.rst:958 ../../reference/datamodel.rst:2776 msgid "call" msgstr "call(呼叫)" @@ -4560,7 +4602,7 @@ msgstr "__name__ (方法屬性)" msgid "__module__ (method attribute)" msgstr "__module__ (方法屬性)" -#: ../../reference/datamodel.rst:743 ../../reference/datamodel.rst:1197 +#: ../../reference/datamodel.rst:743 ../../reference/datamodel.rst:1206 msgid "generator" msgstr "generator(產生器)" @@ -4568,7 +4610,7 @@ msgstr "generator(產生器)" msgid "iterator" msgstr "itorator(疊代器)" -#: ../../reference/datamodel.rst:761 ../../reference/datamodel.rst:3311 +#: ../../reference/datamodel.rst:761 ../../reference/datamodel.rst:3332 msgid "coroutine" msgstr "coroutine(協程)" @@ -4613,18 +4655,18 @@ msgid "__dict__ (module attribute)" msgstr "__dict__ (模組屬性)" #: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:953 -#: ../../reference/datamodel.rst:1004 ../../reference/datamodel.rst:1606 -#: ../../reference/datamodel.rst:2485 +#: ../../reference/datamodel.rst:1013 ../../reference/datamodel.rst:1627 +#: ../../reference/datamodel.rst:2506 msgid "class" msgstr "class(類別)" -#: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:1004 -#: ../../reference/datamodel.rst:1024 +#: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:1013 +#: ../../reference/datamodel.rst:1033 msgid "class instance" msgstr "class instance(類別實例)" -#: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:1004 -#: ../../reference/datamodel.rst:2755 +#: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:1013 +#: ../../reference/datamodel.rst:2776 msgid "instance" msgstr "instance(實例)" @@ -4660,431 +4702,441 @@ msgstr "__annotations__ (類別屬性)" msgid "__type_params__ (class attribute)" msgstr "__type_params__ (類別屬性)" -#: ../../reference/datamodel.rst:1039 +#: ../../reference/datamodel.rst:962 +#, fuzzy +msgid "__static_attributes__ (class attribute)" +msgstr "__annotations__ (類別屬性)" + +#: ../../reference/datamodel.rst:962 +#, fuzzy +msgid "__firstlineno__ (class attribute)" +msgstr "__name__ (類別屬性)" + +#: ../../reference/datamodel.rst:1048 msgid "__dict__ (instance attribute)" msgstr "__dict__ (實例屬性)" -#: ../../reference/datamodel.rst:1039 +#: ../../reference/datamodel.rst:1048 msgid "__class__ (instance attribute)" msgstr "__class__ (實例屬性)" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1059 msgid "open" msgstr "open" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1059 msgid "io" msgstr "io" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1059 msgid "popen() (in module os)" msgstr "popen() (於 os 模組中)" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1059 msgid "makefile() (socket method)" msgstr "makefile() (socket 方法)" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1059 msgid "sys.stdin" msgstr "sys.stdin" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1059 msgid "sys.stdout" msgstr "sys.stdout" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1059 msgid "sys.stderr" msgstr "sys.stderr" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1059 msgid "stdio" msgstr "stdio" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1059 msgid "stdin (in module sys)" msgstr "stdin (sys 模組中)" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1059 msgid "stdout (in module sys)" msgstr "stdout (sys 模組中)" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1059 msgid "stderr (in module sys)" msgstr "stderr (sys 模組中)" -#: ../../reference/datamodel.rst:1079 +#: ../../reference/datamodel.rst:1088 msgid "internal type" msgstr "internal type(內部型別)" -#: ../../reference/datamodel.rst:1079 +#: ../../reference/datamodel.rst:1088 msgid "types, internal" msgstr "types(型別), internal(內部)" -#: ../../reference/datamodel.rst:1093 +#: ../../reference/datamodel.rst:1102 msgid "bytecode" msgstr "bytecode(位元組碼)" -#: ../../reference/datamodel.rst:1093 +#: ../../reference/datamodel.rst:1102 msgid "code" msgstr "code(程式碼)" -#: ../../reference/datamodel.rst:1093 +#: ../../reference/datamodel.rst:1102 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_argcount (code object attribute)" msgstr "co_argcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_posonlyargcount (code object attribute)" msgstr "co_posonlyargcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_kwonlyargcount (code object attribute)" msgstr "co_kwonlyargcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_code (code object attribute)" msgstr "co_code (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_consts (code object attribute)" msgstr "co_consts (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_filename (code object attribute)" msgstr "co_filename (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_firstlineno (code object attribute)" msgstr "co_firstlineno (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_flags (code object attribute)" msgstr "co_flags (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_lnotab (code object attribute)" msgstr "co_lnotab (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_name (code object attribute)" msgstr "co_name (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_names (code object attribute)" msgstr "co_names (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_nlocals (code object attribute)" msgstr "co_nlocals (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_stacksize (code object attribute)" msgstr "co_stacksize (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_varnames (code object attribute)" msgstr "co_varnames (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_cellvars (code object attribute)" msgstr "co_cellvars (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_freevars (code object attribute)" msgstr "co_freevars (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1113 msgid "co_qualname (code object attribute)" msgstr "co_qualname (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1215 +#: ../../reference/datamodel.rst:1224 msgid "documentation string" msgstr "documentation string(文件字串)" -#: ../../reference/datamodel.rst:1304 +#: ../../reference/datamodel.rst:1315 msgid "frame" msgstr "frame" -#: ../../reference/datamodel.rst:1310 +#: ../../reference/datamodel.rst:1321 msgid "f_back (frame attribute)" msgstr "f_back (frame 屬性)" -#: ../../reference/datamodel.rst:1310 +#: ../../reference/datamodel.rst:1321 msgid "f_code (frame attribute)" msgstr "f_code (frame 屬性)" -#: ../../reference/datamodel.rst:1310 +#: ../../reference/datamodel.rst:1321 msgid "f_globals (frame attribute)" msgstr "f_globals (frame 屬性)" -#: ../../reference/datamodel.rst:1310 +#: ../../reference/datamodel.rst:1321 msgid "f_locals (frame attribute)" msgstr "f_locals (frame 屬性)" -#: ../../reference/datamodel.rst:1310 +#: ../../reference/datamodel.rst:1321 msgid "f_lasti (frame attribute)" msgstr "f_lasti (frame 屬性)" -#: ../../reference/datamodel.rst:1310 +#: ../../reference/datamodel.rst:1321 msgid "f_builtins (frame attribute)" msgstr "f_builtins (frame 屬性)" -#: ../../reference/datamodel.rst:1349 +#: ../../reference/datamodel.rst:1365 msgid "f_trace (frame attribute)" msgstr "f_trace (frame 屬性)" -#: ../../reference/datamodel.rst:1349 +#: ../../reference/datamodel.rst:1365 msgid "f_trace_lines (frame attribute)" msgstr "f_trace_lines (frame 屬性)" -#: ../../reference/datamodel.rst:1349 +#: ../../reference/datamodel.rst:1365 msgid "f_trace_opcodes (frame attribute)" msgstr "f_trace_opcodes (frame 屬性)" -#: ../../reference/datamodel.rst:1349 +#: ../../reference/datamodel.rst:1365 msgid "f_lineno (frame attribute)" msgstr "f_lineno (frame 屬性)" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1425 msgid "traceback" msgstr "traceback" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1425 msgid "stack" msgstr "stack(堆疊)" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1425 msgid "trace" msgstr "trace(追蹤)" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1425 msgid "exception" msgstr "exception(例外)" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1425 msgid "handler" msgstr "handler(處理器)" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1425 msgid "execution" msgstr "execution(執行)" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1425 msgid "exc_info (in module sys)" msgstr "exc_info (sys 模組中)" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1425 msgid "last_traceback (in module sys)" msgstr "last_traceback (sys 模組中)" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1425 msgid "sys.exc_info" msgstr "sys.exc_info" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1425 msgid "sys.exception" msgstr "sys.exception" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1425 msgid "sys.last_traceback" msgstr "sys.last_traceback" -#: ../../reference/datamodel.rst:1441 +#: ../../reference/datamodel.rst:1462 msgid "tb_frame (traceback attribute)" msgstr "tb_frame (traceback 屬性)" -#: ../../reference/datamodel.rst:1441 +#: ../../reference/datamodel.rst:1462 msgid "tb_lineno (traceback attribute)" msgstr "tb_lineno (traceback 屬性)" -#: ../../reference/datamodel.rst:1441 +#: ../../reference/datamodel.rst:1462 msgid "tb_lasti (traceback attribute)" msgstr "tb_lasti (traceback 屬性)" -#: ../../reference/datamodel.rst:1441 +#: ../../reference/datamodel.rst:1462 msgid "try" msgstr "try" -#: ../../reference/datamodel.rst:1471 +#: ../../reference/datamodel.rst:1492 msgid "tb_next (traceback attribute)" msgstr "tb_next (traceback 屬性)" -#: ../../reference/datamodel.rst:1487 ../../reference/datamodel.rst:2833 +#: ../../reference/datamodel.rst:1508 ../../reference/datamodel.rst:2854 msgid "slice" msgstr "slice(切片)" -#: ../../reference/datamodel.rst:1493 +#: ../../reference/datamodel.rst:1514 msgid "start (slice object attribute)" msgstr "start (slice 物件屬性)" -#: ../../reference/datamodel.rst:1493 +#: ../../reference/datamodel.rst:1514 msgid "stop (slice object attribute)" msgstr "stop (slice 物件屬性)" -#: ../../reference/datamodel.rst:1493 +#: ../../reference/datamodel.rst:1514 msgid "step (slice object attribute)" msgstr "step (slice 物件屬性)" -#: ../../reference/datamodel.rst:1541 +#: ../../reference/datamodel.rst:1562 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/datamodel.rst:1541 +#: ../../reference/datamodel.rst:1562 msgid "overloading" msgstr "overloading(多載)" -#: ../../reference/datamodel.rst:1541 +#: ../../reference/datamodel.rst:1562 msgid "__getitem__() (mapping object method)" msgstr "__getitem__() (對映物件方法)" -#: ../../reference/datamodel.rst:1577 +#: ../../reference/datamodel.rst:1598 msgid "subclassing" msgstr "subclassing(子類別化)" -#: ../../reference/datamodel.rst:1577 +#: ../../reference/datamodel.rst:1598 msgid "immutable types" msgstr "immutable types(不可變型別)" -#: ../../reference/datamodel.rst:1606 +#: ../../reference/datamodel.rst:1627 msgid "constructor" msgstr "constructor(建構函式)" -#: ../../reference/datamodel.rst:1623 +#: ../../reference/datamodel.rst:1644 msgid "destructor" msgstr "destructor(解構函式)" -#: ../../reference/datamodel.rst:1623 +#: ../../reference/datamodel.rst:1644 msgid "finalizer" msgstr "finalizer(終結函式)" -#: ../../reference/datamodel.rst:1623 +#: ../../reference/datamodel.rst:1644 msgid "del" msgstr "del" -#: ../../reference/datamodel.rst:1687 +#: ../../reference/datamodel.rst:1708 msgid "repr() (built-in function)" msgstr "repr() (內建函式)" -#: ../../reference/datamodel.rst:1687 +#: ../../reference/datamodel.rst:1708 msgid "__repr__() (object method)" msgstr "__repr__() (物件方法)" -#: ../../reference/datamodel.rst:1704 +#: ../../reference/datamodel.rst:1725 msgid "__str__() (object method)" msgstr "__str__() (物件方法)" -#: ../../reference/datamodel.rst:1704 +#: ../../reference/datamodel.rst:1725 msgid "format() (built-in function)" msgstr "format() (內建函式)" -#: ../../reference/datamodel.rst:1704 +#: ../../reference/datamodel.rst:1725 msgid "print() (built-in function)" msgstr "print() (內建函式)" -#: ../../reference/datamodel.rst:1734 +#: ../../reference/datamodel.rst:1755 msgid "__format__() (object method)" msgstr "__format__() (物件方法)" -#: ../../reference/datamodel.rst:1734 +#: ../../reference/datamodel.rst:1755 msgid "conversion" msgstr "conversion" -#: ../../reference/datamodel.rst:1734 +#: ../../reference/datamodel.rst:1755 msgid "print" msgstr "print" -#: ../../reference/datamodel.rst:1773 +#: ../../reference/datamodel.rst:1794 msgid "comparisons" msgstr "comparison(比較)" -#: ../../reference/datamodel.rst:1818 +#: ../../reference/datamodel.rst:1839 msgid "hash" msgstr "hash(雜湊)" -#: ../../reference/datamodel.rst:1899 +#: ../../reference/datamodel.rst:1920 msgid "__len__() (mapping object method)" msgstr "__len__() (對映物件方法)" -#: ../../reference/datamodel.rst:2003 +#: ../../reference/datamodel.rst:2024 msgid "__getattr__ (module attribute)" msgstr "__getattr__ (模組屬性)" -#: ../../reference/datamodel.rst:2003 +#: ../../reference/datamodel.rst:2024 msgid "__dir__ (module attribute)" msgstr "__dir__ (模組屬性)" -#: ../../reference/datamodel.rst:2003 +#: ../../reference/datamodel.rst:2024 msgid "__class__ (module attribute)" msgstr "__class__ (模組屬性)" -#: ../../reference/datamodel.rst:2374 +#: ../../reference/datamodel.rst:2395 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../reference/datamodel.rst:2374 +#: ../../reference/datamodel.rst:2395 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/datamodel.rst:2374 +#: ../../reference/datamodel.rst:2395 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/datamodel.rst:2438 +#: ../../reference/datamodel.rst:2459 msgid "metaclass hint" msgstr "metaclass hint(元類別提示)" -#: ../../reference/datamodel.rst:2461 +#: ../../reference/datamodel.rst:2482 msgid "__prepare__ (metaclass method)" msgstr "__prepare__ (元類別方法)" -#: ../../reference/datamodel.rst:2485 +#: ../../reference/datamodel.rst:2506 msgid "body" msgstr "body" -#: ../../reference/datamodel.rst:2505 +#: ../../reference/datamodel.rst:2526 msgid "__class__ (method cell)" msgstr "__class__ (方法 cell)" -#: ../../reference/datamodel.rst:2505 +#: ../../reference/datamodel.rst:2526 msgid "__classcell__ (class namespace entry)" msgstr "__classcell__ (類別命名空間項目)" -#: ../../reference/datamodel.rst:2803 +#: ../../reference/datamodel.rst:2824 msgid "__bool__() (object method)" msgstr "__bool__() (物件方法)" -#: ../../reference/datamodel.rst:2961 ../../reference/datamodel.rst:2996 +#: ../../reference/datamodel.rst:2982 ../../reference/datamodel.rst:3017 msgid "divmod" msgstr "divmod" -#: ../../reference/datamodel.rst:2961 ../../reference/datamodel.rst:2996 -#: ../../reference/datamodel.rst:3010 +#: ../../reference/datamodel.rst:2982 ../../reference/datamodel.rst:3017 +#: ../../reference/datamodel.rst:3031 msgid "pow" msgstr "pow" -#: ../../reference/datamodel.rst:3059 +#: ../../reference/datamodel.rst:3080 msgid "abs" msgstr "abs" -#: ../../reference/datamodel.rst:3069 +#: ../../reference/datamodel.rst:3090 msgid "int" msgstr "int" -#: ../../reference/datamodel.rst:3069 +#: ../../reference/datamodel.rst:3090 msgid "float" msgstr "float" -#: ../../reference/datamodel.rst:3097 +#: ../../reference/datamodel.rst:3118 msgid "round" msgstr "round" -#: ../../reference/datamodel.rst:3124 +#: ../../reference/datamodel.rst:3145 msgid "with" msgstr "with" -#: ../../reference/datamodel.rst:3124 +#: ../../reference/datamodel.rst:3145 msgid "context manager" msgstr "context manager(情境管理器)" diff --git a/reference/executionmodel.po b/reference/executionmodel.po index 06fb5bc862..63aff5c713 100644 --- a/reference/executionmodel.po +++ b/reference/executionmodel.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -305,8 +305,8 @@ msgstr "" #: ../../reference/executionmodel.rst:208 msgid "" -"The bounds and constraints for type variables (:ref:`lazily evaluated <lazy-" -"evaluation>`)." +"The bounds, constraints, and default values for type parameters (:ref:" +"`lazily evaluated <lazy-evaluation>`)." msgstr "" #: ../../reference/executionmodel.rst:210 @@ -356,25 +356,31 @@ msgstr "" msgid "Annotation scopes were introduced in Python 3.12 as part of :pep:`695`." msgstr "" -#: ../../reference/executionmodel.rst:238 +#: ../../reference/executionmodel.rst:235 +msgid "" +"Annotation scopes are also used for type parameter defaults, as introduced " +"by :pep:`696`." +msgstr "" + +#: ../../reference/executionmodel.rst:242 msgid "Lazy evaluation" msgstr "" -#: ../../reference/executionmodel.rst:240 +#: ../../reference/executionmodel.rst:244 msgid "" "The values of type aliases created through the :keyword:`type` statement are " -"*lazily evaluated*. The same applies to the bounds and constraints of type " -"variables created through the :ref:`type parameter syntax <type-params>`. " -"This means that they are not evaluated when the type alias or type variable " -"is created. Instead, they are only evaluated when doing so is necessary to " -"resolve an attribute access." +"*lazily evaluated*. The same applies to the bounds, constraints, and default " +"values of type variables created through the :ref:`type parameter syntax " +"<type-params>`. This means that they are not evaluated when the type alias " +"or type variable is created. Instead, they are only evaluated when doing so " +"is necessary to resolve an attribute access." msgstr "" -#: ../../reference/executionmodel.rst:247 +#: ../../reference/executionmodel.rst:251 msgid "Example:" msgstr "舉例來說:" -#: ../../reference/executionmodel.rst:249 +#: ../../reference/executionmodel.rst:253 msgid "" ">>> type Alias = 1/0\n" ">>> Alias.__value__\n" @@ -400,20 +406,20 @@ msgstr "" " ...\n" "ZeroDivisionError: division by zero" -#: ../../reference/executionmodel.rst:263 +#: ../../reference/executionmodel.rst:267 msgid "" "Here the exception is raised only when the ``__value__`` attribute of the " "type alias or the ``__bound__`` attribute of the type variable is accessed." msgstr "" -#: ../../reference/executionmodel.rst:267 +#: ../../reference/executionmodel.rst:271 msgid "" "This behavior is primarily useful for references to types that have not yet " "been defined when the type alias or type variable is created. For example, " "lazy evaluation enables creation of mutually recursive type aliases::" msgstr "" -#: ../../reference/executionmodel.rst:271 +#: ../../reference/executionmodel.rst:275 msgid "" "from typing import Literal\n" "\n" @@ -427,18 +433,18 @@ msgstr "" "type Parenthesized = tuple[Literal[\"(\"], Expr, Literal[\")\"]]\n" "type Expr = SimpleExpr | tuple[SimpleExpr, Literal[\"+\", \"-\"], Expr]" -#: ../../reference/executionmodel.rst:277 +#: ../../reference/executionmodel.rst:281 msgid "" "Lazily evaluated values are evaluated in :ref:`annotation scope <annotation-" "scopes>`, which means that names that appear inside the lazily evaluated " "value are looked up as if they were used in the immediately enclosing scope." msgstr "" -#: ../../reference/executionmodel.rst:286 +#: ../../reference/executionmodel.rst:290 msgid "Builtins and restricted execution" msgstr "" -#: ../../reference/executionmodel.rst:292 +#: ../../reference/executionmodel.rst:296 msgid "" "Users should not touch ``__builtins__``; it is strictly an implementation " "detail. Users wanting to override values in the builtins namespace should :" @@ -446,7 +452,7 @@ msgid "" "appropriately." msgstr "" -#: ../../reference/executionmodel.rst:297 +#: ../../reference/executionmodel.rst:301 msgid "" "The builtins namespace associated with the execution of a code block is " "actually found by looking up the name ``__builtins__`` in its global " @@ -457,17 +463,17 @@ msgid "" "`builtins` module itself." msgstr "" -#: ../../reference/executionmodel.rst:309 +#: ../../reference/executionmodel.rst:313 msgid "Interaction with dynamic features" msgstr "" -#: ../../reference/executionmodel.rst:311 +#: ../../reference/executionmodel.rst:315 msgid "" "Name resolution of free variables occurs at runtime, not at compile time. " "This means that the following code will print 42::" msgstr "" -#: ../../reference/executionmodel.rst:314 +#: ../../reference/executionmodel.rst:318 msgid "" "i = 10\n" "def f():\n" @@ -481,7 +487,7 @@ msgstr "" "i = 42\n" "f()" -#: ../../reference/executionmodel.rst:322 +#: ../../reference/executionmodel.rst:326 msgid "" "The :func:`eval` and :func:`exec` functions do not have access to the full " "environment for resolving names. Names may be resolved in the local and " @@ -492,11 +498,11 @@ msgid "" "for both." msgstr "" -#: ../../reference/executionmodel.rst:333 +#: ../../reference/executionmodel.rst:337 msgid "Exceptions" msgstr "例外" -#: ../../reference/executionmodel.rst:344 +#: ../../reference/executionmodel.rst:348 msgid "" "Exceptions are a means of breaking out of the normal flow of control of a " "code block in order to handle errors or other exceptional conditions. An " @@ -505,7 +511,7 @@ msgid "" "or indirectly invoked the code block where the error occurred." msgstr "" -#: ../../reference/executionmodel.rst:350 +#: ../../reference/executionmodel.rst:354 msgid "" "The Python interpreter raises an exception when it detects a run-time error " "(such as division by zero). A Python program can also explicitly raise an " @@ -516,7 +522,7 @@ msgid "" "exception occurred or not in the preceding code." msgstr "" -#: ../../reference/executionmodel.rst:360 +#: ../../reference/executionmodel.rst:364 msgid "" "Python uses the \"termination\" model of error handling: an exception " "handler can find out what happened and continue execution at an outer level, " @@ -524,7 +530,7 @@ msgid "" "(except by re-entering the offending piece of code from the top)." msgstr "" -#: ../../reference/executionmodel.rst:367 +#: ../../reference/executionmodel.rst:371 msgid "" "When an exception is not handled at all, the interpreter terminates " "execution of the program, or returns to its interactive main loop. In " @@ -532,7 +538,7 @@ msgid "" "`SystemExit`." msgstr "" -#: ../../reference/executionmodel.rst:371 +#: ../../reference/executionmodel.rst:375 msgid "" "Exceptions are identified by class instances. The :keyword:`except` clause " "is selected depending on the class of the instance: it must reference the " @@ -541,7 +547,7 @@ msgid "" "additional information about the exceptional condition." msgstr "" -#: ../../reference/executionmodel.rst:379 +#: ../../reference/executionmodel.rst:383 msgid "" "Exception messages are not part of the Python API. Their contents may " "change from one version of Python to the next without warning and should not " @@ -549,17 +555,17 @@ msgid "" "interpreter." msgstr "" -#: ../../reference/executionmodel.rst:383 +#: ../../reference/executionmodel.rst:387 msgid "" "See also the description of the :keyword:`try` statement in section :ref:" "`try` and :keyword:`raise` statement in section :ref:`raise`." msgstr "" -#: ../../reference/executionmodel.rst:388 +#: ../../reference/executionmodel.rst:392 msgid "Footnotes" msgstr "註解" -#: ../../reference/executionmodel.rst:389 +#: ../../reference/executionmodel.rst:393 msgid "" "This limitation occurs because the code that is executed by these operations " "is not available at the time the module is compiled." @@ -577,7 +583,7 @@ msgstr "code(程式碼)" msgid "block" msgstr "block" -#: ../../reference/executionmodel.rst:31 ../../reference/executionmodel.rst:288 +#: ../../reference/executionmodel.rst:31 ../../reference/executionmodel.rst:292 msgid "execution" msgstr "execution(執行)" @@ -637,38 +643,38 @@ msgstr "module(模組)" msgid "__main__" msgstr "__main__" -#: ../../reference/executionmodel.rst:288 +#: ../../reference/executionmodel.rst:292 msgid "restricted" msgstr "restricted(受限)" -#: ../../reference/executionmodel.rst:335 +#: ../../reference/executionmodel.rst:339 msgid "exception" msgstr "exception(例外)" -#: ../../reference/executionmodel.rst:337 +#: ../../reference/executionmodel.rst:341 msgid "raise an exception" msgstr "raise an exception(引發例外)" -#: ../../reference/executionmodel.rst:337 +#: ../../reference/executionmodel.rst:341 msgid "handle an exception" msgstr "handle an exception(處理例外)" -#: ../../reference/executionmodel.rst:337 +#: ../../reference/executionmodel.rst:341 msgid "exception handler" msgstr "exception handler(例外處理器)" -#: ../../reference/executionmodel.rst:337 +#: ../../reference/executionmodel.rst:341 msgid "errors" msgstr "errors(錯誤)" -#: ../../reference/executionmodel.rst:337 +#: ../../reference/executionmodel.rst:341 msgid "error handling" msgstr "error handling(錯誤處理)" -#: ../../reference/executionmodel.rst:358 +#: ../../reference/executionmodel.rst:362 msgid "termination model" msgstr "termination model(終止模型)" -#: ../../reference/executionmodel.rst:365 +#: ../../reference/executionmodel.rst:369 msgid "SystemExit (built-in exception)" msgstr "SystemExit(內建例外)" diff --git a/reference/expressions.po b/reference/expressions.po index 63c3f2e842..366629e070 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -715,7 +715,7 @@ msgid "" "*value* may be cleared." msgstr "" -#: ../../reference/expressions.rst:621 ../../reference/expressions.rst:795 +#: ../../reference/expressions.rst:621 ../../reference/expressions.rst:802 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." @@ -724,25 +724,33 @@ msgstr "" #: ../../reference/expressions.rst:629 msgid "" "Raises a :exc:`GeneratorExit` at the point where the generator function was " -"paused. If the generator function then exits gracefully, is already closed, " -"or raises :exc:`GeneratorExit` (by not catching the exception), close " -"returns to its caller. If the generator yields a value, a :exc:" -"`RuntimeError` is raised. If the generator raises any other exception, it " -"is propagated to the caller. :meth:`close` does nothing if the generator " -"has already exited due to an exception or normal exit." +"paused. If the generator function catches the exception and returns a " +"value, this value is returned from :meth:`close`. If the generator function " +"is already closed, or raises :exc:`GeneratorExit` (by not catching the " +"exception), :meth:`close` returns :const:`None`. If the generator yields a " +"value, a :exc:`RuntimeError` is raised. If the generator raises any other " +"exception, it is propagated to the caller. If the generator has already " +"exited due to an exception or normal exit, :meth:`close` returns :const:" +"`None` and has no other effect." msgstr "" -#: ../../reference/expressions.rst:640 +#: ../../reference/expressions.rst:641 +msgid "" +"If a generator returns a value upon being closed, the value is returned by :" +"meth:`close`." +msgstr "" + +#: ../../reference/expressions.rst:647 msgid "Examples" msgstr "模組" -#: ../../reference/expressions.rst:642 +#: ../../reference/expressions.rst:649 msgid "" "Here is a simple example that demonstrates the behavior of generators and " "generator functions::" msgstr "" -#: ../../reference/expressions.rst:645 +#: ../../reference/expressions.rst:652 msgid "" ">>> def echo(value=None):\n" "... print(\"Execution starts when 'next()' is called for the first time." @@ -770,24 +778,24 @@ msgid "" "Don't forget to clean up when 'close()' is called." msgstr "" -#: ../../reference/expressions.rst:669 +#: ../../reference/expressions.rst:676 msgid "" "For examples using ``yield from``, see :ref:`pep-380` in \"What's New in " "Python.\"" msgstr "" -#: ../../reference/expressions.rst:675 +#: ../../reference/expressions.rst:682 msgid "Asynchronous generator functions" msgstr "" -#: ../../reference/expressions.rst:677 +#: ../../reference/expressions.rst:684 msgid "" "The presence of a yield expression in a function or method defined using :" "keyword:`async def` further defines the function as an :term:`asynchronous " "generator` function." msgstr "" -#: ../../reference/expressions.rst:681 +#: ../../reference/expressions.rst:688 msgid "" "When an asynchronous generator function is called, it returns an " "asynchronous iterator known as an asynchronous generator object. That object " @@ -797,7 +805,7 @@ msgid "" "keyword:`for` statement." msgstr "" -#: ../../reference/expressions.rst:688 +#: ../../reference/expressions.rst:695 msgid "" "Calling one of the asynchronous generator's methods returns an :term:" "`awaitable` object, and the execution starts when this object is awaited on. " @@ -816,7 +824,7 @@ msgid "" "method." msgstr "" -#: ../../reference/expressions.rst:703 +#: ../../reference/expressions.rst:710 msgid "" "If an asynchronous generator happens to exit early by :keyword:`break`, the " "caller task being cancelled, or other exceptions, the generator's async " @@ -828,7 +836,7 @@ msgid "" "generator and ultimately detach it from the event loop." msgstr "" -#: ../../reference/expressions.rst:713 +#: ../../reference/expressions.rst:720 msgid "" "In an asynchronous generator function, yield expressions are allowed " "anywhere in a :keyword:`try` construct. However, if an asynchronous " @@ -842,7 +850,7 @@ msgid "" "finally` clauses to execute." msgstr "" -#: ../../reference/expressions.rst:724 +#: ../../reference/expressions.rst:731 msgid "" "To take care of finalization upon event loop termination, an event loop " "should define a *finalizer* function which takes an asynchronous generator-" @@ -855,23 +863,23 @@ msgid "" "asyncio/base_events.py`." msgstr "" -#: ../../reference/expressions.rst:733 +#: ../../reference/expressions.rst:740 msgid "" "The expression ``yield from <expr>`` is a syntax error when used in an " "asynchronous generator function." msgstr "" -#: ../../reference/expressions.rst:740 +#: ../../reference/expressions.rst:747 msgid "Asynchronous generator-iterator methods" msgstr "" -#: ../../reference/expressions.rst:742 +#: ../../reference/expressions.rst:749 msgid "" "This subsection describes the methods of an asynchronous generator iterator, " "which are used to control the execution of a generator function." msgstr "" -#: ../../reference/expressions.rst:750 +#: ../../reference/expressions.rst:757 msgid "" "Returns an awaitable which when run starts to execute the asynchronous " "generator or resumes it at the last executed yield expression. When an " @@ -886,12 +894,12 @@ msgid "" "has completed." msgstr "" -#: ../../reference/expressions.rst:762 +#: ../../reference/expressions.rst:769 msgid "" "This method is normally called implicitly by a :keyword:`async for` loop." msgstr "" -#: ../../reference/expressions.rst:767 +#: ../../reference/expressions.rst:774 msgid "" "Returns an awaitable which when run resumes the execution of the " "asynchronous generator. As with the :meth:`~generator.send` method for a " @@ -906,7 +914,7 @@ msgid "" "receive the value." msgstr "" -#: ../../reference/expressions.rst:783 +#: ../../reference/expressions.rst:790 msgid "" "Returns an awaitable that raises an exception of type ``type`` at the point " "where the asynchronous generator was paused, and returns the next value " @@ -918,7 +926,7 @@ msgid "" "that exception propagates to the caller of the awaitable." msgstr "" -#: ../../reference/expressions.rst:803 +#: ../../reference/expressions.rst:810 msgid "" "Returns an awaitable that when run will throw a :exc:`GeneratorExit` into " "the asynchronous generator function at the point where it was paused. If the " @@ -934,25 +942,25 @@ msgid "" "will return an awaitable that does nothing." msgstr "" -#: ../../reference/expressions.rst:819 +#: ../../reference/expressions.rst:826 msgid "Primaries" msgstr "" -#: ../../reference/expressions.rst:823 +#: ../../reference/expressions.rst:830 msgid "" "Primaries represent the most tightly bound operations of the language. Their " "syntax is:" msgstr "" -#: ../../reference/expressions.rst:833 +#: ../../reference/expressions.rst:840 msgid "Attribute references" msgstr "" -#: ../../reference/expressions.rst:839 +#: ../../reference/expressions.rst:846 msgid "An attribute reference is a primary followed by a period and a name:" msgstr "" -#: ../../reference/expressions.rst:849 +#: ../../reference/expressions.rst:856 msgid "" "The primary must evaluate to an object of a type that supports attribute " "references, which most objects do. This object is then asked to produce the " @@ -961,7 +969,7 @@ msgid "" "reference may yield different objects." msgstr "" -#: ../../reference/expressions.rst:855 +#: ../../reference/expressions.rst:862 msgid "" "This production can be customized by overriding the :meth:`~object." "__getattribute__` method or the :meth:`~object.__getattr__` method. The :" @@ -969,17 +977,17 @@ msgid "" "or raises :exc:`AttributeError` if the attribute is not available." msgstr "" -#: ../../reference/expressions.rst:861 +#: ../../reference/expressions.rst:868 msgid "" "If an :exc:`AttributeError` is raised and the object has a :meth:`!" "__getattr__` method, that method is called as a fallback." msgstr "" -#: ../../reference/expressions.rst:867 +#: ../../reference/expressions.rst:874 msgid "Subscriptions" msgstr "" -#: ../../reference/expressions.rst:882 +#: ../../reference/expressions.rst:889 msgid "" "The subscription of an instance of a :ref:`container class <sequence-types>` " "will generally select an element from the container. The subscription of a :" @@ -987,13 +995,13 @@ msgid "" "`GenericAlias <types-genericalias>` object." msgstr "" -#: ../../reference/expressions.rst:890 +#: ../../reference/expressions.rst:897 msgid "" "When an object is subscripted, the interpreter will evaluate the primary and " "the expression list." msgstr "" -#: ../../reference/expressions.rst:893 +#: ../../reference/expressions.rst:900 msgid "" "The primary must evaluate to an object that supports subscription. An object " "may support subscription through defining one or both of :meth:`~object." @@ -1003,20 +1011,20 @@ msgid "" "called instead of ``__getitem__``, see :ref:`classgetitem-versus-getitem`." msgstr "" -#: ../../reference/expressions.rst:900 +#: ../../reference/expressions.rst:907 msgid "" "If the expression list contains at least one comma, it will evaluate to a :" "class:`tuple` containing the items of the expression list. Otherwise, the " "expression list will evaluate to the value of the list's sole member." msgstr "" -#: ../../reference/expressions.rst:904 +#: ../../reference/expressions.rst:911 msgid "" "For built-in objects, there are two types of objects that support " "subscription via :meth:`~object.__getitem__`:" msgstr "" -#: ../../reference/expressions.rst:907 +#: ../../reference/expressions.rst:914 msgid "" "Mappings. If the primary is a :term:`mapping`, the expression list must " "evaluate to an object whose value is one of the keys of the mapping, and the " @@ -1024,7 +1032,7 @@ msgid "" "An example of a builtin mapping class is the :class:`dict` class." msgstr "" -#: ../../reference/expressions.rst:911 +#: ../../reference/expressions.rst:918 msgid "" "Sequences. If the primary is a :term:`sequence`, the expression list must " "evaluate to an :class:`int` or a :class:`slice` (as discussed in the " @@ -1032,7 +1040,7 @@ msgid "" "`str`, :class:`list` and :class:`tuple` classes." msgstr "" -#: ../../reference/expressions.rst:916 +#: ../../reference/expressions.rst:923 msgid "" "The formal syntax makes no special provision for negative indices in :term:" "`sequences <sequence>`. However, built-in sequences all provide a :meth:" @@ -1046,25 +1054,25 @@ msgid "" "explicitly add that support." msgstr "" -#: ../../reference/expressions.rst:930 +#: ../../reference/expressions.rst:937 msgid "" "A :class:`string <str>` is a special kind of sequence whose items are " "*characters*. A character is not a separate data type but a string of " "exactly one character." msgstr "" -#: ../../reference/expressions.rst:938 +#: ../../reference/expressions.rst:945 msgid "Slicings" msgstr "" -#: ../../reference/expressions.rst:952 +#: ../../reference/expressions.rst:959 msgid "" "A slicing selects a range of items in a sequence object (e.g., a string, " "tuple or list). Slicings may be used as expressions or as targets in " "assignment or :keyword:`del` statements. The syntax for a slicing:" msgstr "" -#: ../../reference/expressions.rst:965 +#: ../../reference/expressions.rst:972 msgid "" "There is ambiguity in the formal syntax here: anything that looks like an " "expression list also looks like a slice list, so any subscription can be " @@ -1074,7 +1082,7 @@ msgid "" "the case if the slice list contains no proper slice)." msgstr "" -#: ../../reference/expressions.rst:977 +#: ../../reference/expressions.rst:984 msgid "" "The semantics for a slicing are as follows. The primary is indexed (using " "the same :meth:`~object.__getitem__` method as normal subscription) with a " @@ -1089,23 +1097,23 @@ msgid "" "missing expressions." msgstr "" -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1008 msgid "Calls" msgstr "" -#: ../../reference/expressions.rst:1003 +#: ../../reference/expressions.rst:1010 msgid "" "A call calls a callable object (e.g., a :term:`function`) with a possibly " "empty series of :term:`arguments <argument>`:" msgstr "" -#: ../../reference/expressions.rst:1020 +#: ../../reference/expressions.rst:1027 msgid "" "An optional trailing comma may be present after the positional and keyword " "arguments but does not affect the semantics." msgstr "" -#: ../../reference/expressions.rst:1026 +#: ../../reference/expressions.rst:1033 msgid "" "The primary must evaluate to a callable object (user-defined functions, " "built-in functions, methods of built-in objects, class objects, methods of " @@ -1115,7 +1123,7 @@ msgid "" "formal :term:`parameter` lists." msgstr "" -#: ../../reference/expressions.rst:1034 +#: ../../reference/expressions.rst:1041 msgid "" "If keyword arguments are present, they are first converted to positional " "arguments, as follows. First, a list of unfilled slots is created for the " @@ -1136,7 +1144,7 @@ msgid "" "filled slots is used as the argument list for the call." msgstr "" -#: ../../reference/expressions.rst:1054 +#: ../../reference/expressions.rst:1061 msgid "" "An implementation may provide built-in functions whose positional parameters " "do not have names, even if they are 'named' for the purpose of " @@ -1145,7 +1153,7 @@ msgid "" "`PyArg_ParseTuple` to parse their arguments." msgstr "" -#: ../../reference/expressions.rst:1060 +#: ../../reference/expressions.rst:1067 msgid "" "If there are more positional arguments than there are formal parameter " "slots, a :exc:`TypeError` exception is raised, unless a formal parameter " @@ -1154,7 +1162,7 @@ msgid "" "empty tuple if there were no excess positional arguments)." msgstr "" -#: ../../reference/expressions.rst:1066 +#: ../../reference/expressions.rst:1073 msgid "" "If any keyword argument does not correspond to a formal parameter name, a :" "exc:`TypeError` exception is raised, unless a formal parameter using the " @@ -1164,7 +1172,7 @@ msgid "" "(new) empty dictionary if there were no excess keyword arguments." msgstr "" -#: ../../reference/expressions.rst:1077 +#: ../../reference/expressions.rst:1084 msgid "" "If the syntax ``*expression`` appears in the function call, ``expression`` " "must evaluate to an :term:`iterable`. Elements from these iterables are " @@ -1174,14 +1182,14 @@ msgid "" "*y1*, ..., *yM*, *x3*, *x4*." msgstr "" -#: ../../reference/expressions.rst:1084 +#: ../../reference/expressions.rst:1091 msgid "" "A consequence of this is that although the ``*expression`` syntax may appear " "*after* explicit keyword arguments, it is processed *before* the keyword " "arguments (and any ``**expression`` arguments -- see below). So::" msgstr "" -#: ../../reference/expressions.rst:1088 +#: ../../reference/expressions.rst:1095 msgid "" ">>> def f(a, b):\n" "... print(a, b)\n" @@ -1207,13 +1215,13 @@ msgstr "" ">>> f(1, *(2,))\n" "1 2" -#: ../../reference/expressions.rst:1100 +#: ../../reference/expressions.rst:1107 msgid "" "It is unusual for both keyword arguments and the ``*expression`` syntax to " "be used in the same call, so in practice this confusion does not often arise." msgstr "" -#: ../../reference/expressions.rst:1106 +#: ../../reference/expressions.rst:1113 msgid "" "If the syntax ``**expression`` appears in the function call, ``expression`` " "must evaluate to a :term:`mapping`, the contents of which are treated as " @@ -1222,7 +1230,7 @@ msgid "" "a :exc:`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1112 +#: ../../reference/expressions.rst:1119 msgid "" "When ``**expression`` is used, each key in this mapping must be a string. " "Each value from the mapping is assigned to the first formal parameter " @@ -1234,35 +1242,35 @@ msgid "" "is raised." msgstr "" -#: ../../reference/expressions.rst:1122 +#: ../../reference/expressions.rst:1129 msgid "" "Formal parameters using the syntax ``*identifier`` or ``**identifier`` " "cannot be used as positional argument slots or as keyword argument names." msgstr "" -#: ../../reference/expressions.rst:1125 +#: ../../reference/expressions.rst:1132 msgid "" "Function calls accept any number of ``*`` and ``**`` unpackings, positional " "arguments may follow iterable unpackings (``*``), and keyword arguments may " "follow dictionary unpackings (``**``). Originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1131 +#: ../../reference/expressions.rst:1138 msgid "" "A call always returns some value, possibly ``None``, unless it raises an " "exception. How this value is computed depends on the type of the callable " "object." msgstr "" -#: ../../reference/expressions.rst:1135 +#: ../../reference/expressions.rst:1142 msgid "If it is---" msgstr "" -#: ../../reference/expressions.rst:1137 +#: ../../reference/expressions.rst:1144 msgid "a user-defined function:" msgstr "" -#: ../../reference/expressions.rst:1144 +#: ../../reference/expressions.rst:1151 msgid "" "The code block for the function is executed, passing it the argument list. " "The first thing the code block will do is bind the formal parameters to the " @@ -1271,73 +1279,73 @@ msgid "" "value of the function call." msgstr "" -#: ../../reference/expressions.rst:1150 +#: ../../reference/expressions.rst:1157 msgid "a built-in function or method:" msgstr "" -#: ../../reference/expressions.rst:1161 +#: ../../reference/expressions.rst:1168 msgid "" "The result is up to the interpreter; see :ref:`built-in-funcs` for the " "descriptions of built-in functions and methods." msgstr "" -#: ../../reference/expressions.rst:1164 +#: ../../reference/expressions.rst:1171 msgid "a class object:" msgstr "" -#: ../../reference/expressions.rst:1169 +#: ../../reference/expressions.rst:1176 msgid "A new instance of that class is returned." msgstr "" -#: ../../reference/expressions.rst:1171 +#: ../../reference/expressions.rst:1178 msgid "a class instance method:" msgstr "" -#: ../../reference/expressions.rst:1177 +#: ../../reference/expressions.rst:1184 msgid "" "The corresponding user-defined function is called, with an argument list " "that is one longer than the argument list of the call: the instance becomes " "the first argument." msgstr "" -#: ../../reference/expressions.rst:1181 +#: ../../reference/expressions.rst:1188 msgid "a class instance:" msgstr "" -#: ../../reference/expressions.rst:1186 +#: ../../reference/expressions.rst:1193 msgid "" "The class must define a :meth:`~object.__call__` method; the effect is then " "the same as if that method was called." msgstr "" -#: ../../reference/expressions.rst:1194 ../../reference/expressions.rst:1987 +#: ../../reference/expressions.rst:1201 ../../reference/expressions.rst:1994 msgid "Await expression" msgstr "" -#: ../../reference/expressions.rst:1196 +#: ../../reference/expressions.rst:1203 msgid "" "Suspend the execution of :term:`coroutine` on an :term:`awaitable` object. " "Can only be used inside a :term:`coroutine function`." msgstr "" -#: ../../reference/expressions.rst:1208 +#: ../../reference/expressions.rst:1215 msgid "The power operator" msgstr "" -#: ../../reference/expressions.rst:1214 +#: ../../reference/expressions.rst:1221 msgid "" "The power operator binds more tightly than unary operators on its left; it " "binds less tightly than unary operators on its right. The syntax is:" msgstr "" -#: ../../reference/expressions.rst:1220 +#: ../../reference/expressions.rst:1227 msgid "" "Thus, in an unparenthesized sequence of power and unary operators, the " "operators are evaluated from right to left (this does not constrain the " "evaluation order for the operands): ``-1**2`` results in ``-1``." msgstr "" -#: ../../reference/expressions.rst:1224 +#: ../../reference/expressions.rst:1231 msgid "" "The power operator has the same semantics as the built-in :func:`pow` " "function, when called with two arguments: it yields its left argument raised " @@ -1345,7 +1353,7 @@ msgid "" "converted to a common type, and the result is of that type." msgstr "" -#: ../../reference/expressions.rst:1229 +#: ../../reference/expressions.rst:1236 msgid "" "For int operands, the result has the same type as the operands unless the " "second argument is negative; in that case, all arguments are converted to " @@ -1353,41 +1361,41 @@ msgid "" "``100``, but ``10**-2`` returns ``0.01``." msgstr "" -#: ../../reference/expressions.rst:1234 +#: ../../reference/expressions.rst:1241 msgid "" "Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`. " "Raising a negative number to a fractional power results in a :class:" "`complex` number. (In earlier versions it raised a :exc:`ValueError`.)" msgstr "" -#: ../../reference/expressions.rst:1238 +#: ../../reference/expressions.rst:1245 msgid "" "This operation can be customized using the special :meth:`~object.__pow__` " "and :meth:`~object.__rpow__` methods." msgstr "" -#: ../../reference/expressions.rst:1244 +#: ../../reference/expressions.rst:1251 msgid "Unary arithmetic and bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1250 +#: ../../reference/expressions.rst:1257 msgid "All unary arithmetic and bitwise operations have the same priority:" msgstr "" -#: ../../reference/expressions.rst:1261 +#: ../../reference/expressions.rst:1268 msgid "" "The unary ``-`` (minus) operator yields the negation of its numeric " "argument; the operation can be overridden with the :meth:`~object.__neg__` " "special method." msgstr "" -#: ../../reference/expressions.rst:1269 +#: ../../reference/expressions.rst:1276 msgid "" "The unary ``+`` (plus) operator yields its numeric argument unchanged; the " "operation can be overridden with the :meth:`~object.__pos__` special method." msgstr "" -#: ../../reference/expressions.rst:1276 +#: ../../reference/expressions.rst:1283 msgid "" "The unary ``~`` (invert) operator yields the bitwise inversion of its " "integer argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. " @@ -1395,17 +1403,17 @@ msgid "" "meth:`~object.__invert__` special method." msgstr "" -#: ../../reference/expressions.rst:1285 +#: ../../reference/expressions.rst:1292 msgid "" "In all three cases, if the argument does not have the proper type, a :exc:" "`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1292 +#: ../../reference/expressions.rst:1299 msgid "Binary arithmetic operations" msgstr "" -#: ../../reference/expressions.rst:1296 +#: ../../reference/expressions.rst:1303 msgid "" "The binary arithmetic operations have the conventional priority levels. " "Note that some of these operations also apply to certain non-numeric types. " @@ -1413,7 +1421,7 @@ msgid "" "multiplicative operators and one for additive operators:" msgstr "" -#: ../../reference/expressions.rst:1311 +#: ../../reference/expressions.rst:1318 msgid "" "The ``*`` (multiplication) operator yields the product of its arguments. " "The arguments must either both be numbers, or one argument must be an " @@ -1423,25 +1431,25 @@ msgid "" "an empty sequence." msgstr "" -#: ../../reference/expressions.rst:1317 +#: ../../reference/expressions.rst:1324 msgid "" "This operation can be customized using the special :meth:`~object.__mul__` " "and :meth:`~object.__rmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1324 +#: ../../reference/expressions.rst:1331 msgid "" "The ``@`` (at) operator is intended to be used for matrix multiplication. " "No builtin Python types implement this operator." msgstr "" -#: ../../reference/expressions.rst:1327 +#: ../../reference/expressions.rst:1334 msgid "" "This operation can be customized using the special :meth:`~object." "__matmul__` and :meth:`~object.__rmatmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1338 +#: ../../reference/expressions.rst:1345 msgid "" "The ``/`` (division) and ``//`` (floor division) operators yield the " "quotient of their arguments. The numeric arguments are first converted to a " @@ -1451,7 +1459,7 @@ msgid "" "the :exc:`ZeroDivisionError` exception." msgstr "" -#: ../../reference/expressions.rst:1345 +#: ../../reference/expressions.rst:1352 msgid "" "The division operation can be customized using the special :meth:`~object." "__truediv__` and :meth:`~object.__rtruediv__` methods. The floor division " @@ -1459,7 +1467,7 @@ msgid "" "and :meth:`~object.__rfloordiv__` methods." msgstr "" -#: ../../reference/expressions.rst:1354 +#: ../../reference/expressions.rst:1361 msgid "" "The ``%`` (modulo) operator yields the remainder from the division of the " "first argument by the second. The numeric arguments are first converted to " @@ -1471,7 +1479,7 @@ msgid "" "absolute value of the second operand [#]_." msgstr "" -#: ../../reference/expressions.rst:1363 +#: ../../reference/expressions.rst:1370 msgid "" "The floor division and modulo operators are connected by the following " "identity: ``x == (x//y)*y + (x%y)``. Floor division and modulo are also " @@ -1479,7 +1487,7 @@ msgid "" "y, x%y)``. [#]_." msgstr "" -#: ../../reference/expressions.rst:1368 +#: ../../reference/expressions.rst:1375 msgid "" "In addition to performing the modulo operation on numbers, the ``%`` " "operator is also overloaded by string objects to perform old-style string " @@ -1488,20 +1496,20 @@ msgid "" "formatting`." msgstr "" -#: ../../reference/expressions.rst:1373 +#: ../../reference/expressions.rst:1380 msgid "" "The *modulo* operation can be customized using the special :meth:`~object." "__mod__` and :meth:`~object.__rmod__` methods." msgstr "" -#: ../../reference/expressions.rst:1376 +#: ../../reference/expressions.rst:1383 msgid "" "The floor division operator, the modulo operator, and the :func:`divmod` " "function are not defined for complex numbers. Instead, convert to a " "floating-point number using the :func:`abs` function if appropriate." msgstr "" -#: ../../reference/expressions.rst:1385 +#: ../../reference/expressions.rst:1392 msgid "" "The ``+`` (addition) operator yields the sum of its arguments. The " "arguments must either both be numbers or both be sequences of the same " @@ -1509,40 +1517,40 @@ msgid "" "then added together. In the latter case, the sequences are concatenated." msgstr "" -#: ../../reference/expressions.rst:1390 +#: ../../reference/expressions.rst:1397 msgid "" "This operation can be customized using the special :meth:`~object.__add__` " "and :meth:`~object.__radd__` methods." msgstr "" -#: ../../reference/expressions.rst:1398 +#: ../../reference/expressions.rst:1405 msgid "" "The ``-`` (subtraction) operator yields the difference of its arguments. " "The numeric arguments are first converted to a common type." msgstr "" -#: ../../reference/expressions.rst:1401 +#: ../../reference/expressions.rst:1408 msgid "" "This operation can be customized using the special :meth:`~object.__sub__` " "and :meth:`~object.__rsub__` methods." msgstr "" -#: ../../reference/expressions.rst:1408 +#: ../../reference/expressions.rst:1415 msgid "Shifting operations" msgstr "" -#: ../../reference/expressions.rst:1415 +#: ../../reference/expressions.rst:1422 msgid "" "The shifting operations have lower priority than the arithmetic operations:" msgstr "" -#: ../../reference/expressions.rst:1420 +#: ../../reference/expressions.rst:1427 msgid "" "These operators accept integers as arguments. They shift the first argument " "to the left or right by the number of bits given by the second argument." msgstr "" -#: ../../reference/expressions.rst:1423 +#: ../../reference/expressions.rst:1430 msgid "" "The left shift operation can be customized using the special :meth:`~object." "__lshift__` and :meth:`~object.__rlshift__` methods. The right shift " @@ -1550,46 +1558,46 @@ msgid "" "and :meth:`~object.__rrshift__` methods." msgstr "" -#: ../../reference/expressions.rst:1430 +#: ../../reference/expressions.rst:1437 msgid "" "A right shift by *n* bits is defined as floor division by ``pow(2,n)``. A " "left shift by *n* bits is defined as multiplication with ``pow(2,n)``." msgstr "" -#: ../../reference/expressions.rst:1437 +#: ../../reference/expressions.rst:1444 msgid "Binary bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1441 +#: ../../reference/expressions.rst:1448 msgid "Each of the three bitwise operations has a different priority level:" msgstr "" -#: ../../reference/expressions.rst:1452 +#: ../../reference/expressions.rst:1459 msgid "" "The ``&`` operator yields the bitwise AND of its arguments, which must be " "integers or one of them must be a custom object overriding :meth:`~object." "__and__` or :meth:`~object.__rand__` special methods." msgstr "" -#: ../../reference/expressions.rst:1461 +#: ../../reference/expressions.rst:1468 msgid "" "The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, " "which must be integers or one of them must be a custom object overriding :" "meth:`~object.__xor__` or :meth:`~object.__rxor__` special methods." msgstr "" -#: ../../reference/expressions.rst:1470 +#: ../../reference/expressions.rst:1477 msgid "" "The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which " "must be integers or one of them must be a custom object overriding :meth:" "`~object.__or__` or :meth:`~object.__ror__` special methods." msgstr "" -#: ../../reference/expressions.rst:1478 +#: ../../reference/expressions.rst:1485 msgid "Comparisons" msgstr "" -#: ../../reference/expressions.rst:1490 +#: ../../reference/expressions.rst:1497 msgid "" "Unlike C, all comparison operations in Python have the same priority, which " "is lower than that of any arithmetic, shifting or bitwise operation. Also " @@ -1597,14 +1605,14 @@ msgid "" "conventional in mathematics:" msgstr "" -#: ../../reference/expressions.rst:1500 +#: ../../reference/expressions.rst:1507 msgid "" "Comparisons yield boolean values: ``True`` or ``False``. Custom :dfn:`rich " "comparison methods` may return non-boolean values. In this case Python will " "call :func:`bool` on such value in boolean contexts." msgstr "" -#: ../../reference/expressions.rst:1506 +#: ../../reference/expressions.rst:1513 msgid "" "Comparisons can be chained arbitrarily, e.g., ``x < y <= z`` is equivalent " "to ``x < y and y <= z``, except that ``y`` is evaluated only once (but in " @@ -1612,7 +1620,7 @@ msgid "" "false)." msgstr "" -#: ../../reference/expressions.rst:1510 +#: ../../reference/expressions.rst:1517 msgid "" "Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*, " "*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y opN " @@ -1620,24 +1628,24 @@ msgid "" "each expression is evaluated at most once." msgstr "" -#: ../../reference/expressions.rst:1515 +#: ../../reference/expressions.rst:1522 msgid "" "Note that ``a op1 b op2 c`` doesn't imply any kind of comparison between *a* " "and *c*, so that, e.g., ``x < y > z`` is perfectly legal (though perhaps not " "pretty)." msgstr "" -#: ../../reference/expressions.rst:1522 +#: ../../reference/expressions.rst:1529 msgid "Value comparisons" msgstr "" -#: ../../reference/expressions.rst:1524 +#: ../../reference/expressions.rst:1531 msgid "" "The operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare the " "values of two objects. The objects do not need to have the same type." msgstr "" -#: ../../reference/expressions.rst:1527 +#: ../../reference/expressions.rst:1534 msgid "" "Chapter :ref:`objects` states that objects have a value (in addition to type " "and identity). The value of an object is a rather abstract notion in " @@ -1649,7 +1657,7 @@ msgid "" "indirectly, by means of their comparison implementation." msgstr "" -#: ../../reference/expressions.rst:1536 +#: ../../reference/expressions.rst:1543 msgid "" "Because all types are (direct or indirect) subtypes of :class:`object`, they " "inherit the default comparison behavior from :class:`object`. Types can " @@ -1657,7 +1665,7 @@ msgid "" "methods` like :meth:`~object.__lt__`, described in :ref:`customization`." msgstr "" -#: ../../reference/expressions.rst:1542 +#: ../../reference/expressions.rst:1549 msgid "" "The default behavior for equality comparison (``==`` and ``!=``) is based on " "the identity of the objects. Hence, equality comparison of instances with " @@ -1667,14 +1675,14 @@ msgid "" "``x is y`` implies ``x == y``)." msgstr "" -#: ../../reference/expressions.rst:1549 +#: ../../reference/expressions.rst:1556 msgid "" "A default order comparison (``<``, ``>``, ``<=``, and ``>=``) is not " "provided; an attempt raises :exc:`TypeError`. A motivation for this default " "behavior is the lack of a similar invariant as for equality." msgstr "" -#: ../../reference/expressions.rst:1553 +#: ../../reference/expressions.rst:1560 msgid "" "The behavior of the default equality comparison, that instances with " "different identities are always unequal, may be in contrast to what types " @@ -1683,13 +1691,13 @@ msgid "" "in fact, a number of built-in types have done that." msgstr "" -#: ../../reference/expressions.rst:1559 +#: ../../reference/expressions.rst:1566 msgid "" "The following list describes the comparison behavior of the most important " "built-in types." msgstr "" -#: ../../reference/expressions.rst:1562 +#: ../../reference/expressions.rst:1569 msgid "" "Numbers of built-in numeric types (:ref:`typesnumeric`) and of the standard " "library types :class:`fractions.Fraction` and :class:`decimal.Decimal` can " @@ -1699,7 +1707,7 @@ msgid "" "of precision." msgstr "" -#: ../../reference/expressions.rst:1569 +#: ../../reference/expressions.rst:1576 msgid "" "The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are " "special. Any ordered comparison of a number to a not-a-number value is " @@ -1709,32 +1717,32 @@ msgid "" "is compliant with IEEE 754." msgstr "" -#: ../../reference/expressions.rst:1576 +#: ../../reference/expressions.rst:1583 msgid "" "``None`` and :data:`NotImplemented` are singletons. :PEP:`8` advises that " "comparisons for singletons should always be done with ``is`` or ``is not``, " "never the equality operators." msgstr "" -#: ../../reference/expressions.rst:1580 +#: ../../reference/expressions.rst:1587 msgid "" "Binary sequences (instances of :class:`bytes` or :class:`bytearray`) can be " "compared within and across their types. They compare lexicographically " "using the numeric values of their elements." msgstr "" -#: ../../reference/expressions.rst:1584 +#: ../../reference/expressions.rst:1591 msgid "" "Strings (instances of :class:`str`) compare lexicographically using the " "numerical Unicode code points (the result of the built-in function :func:" "`ord`) of their characters. [#]_" msgstr "" -#: ../../reference/expressions.rst:1588 +#: ../../reference/expressions.rst:1595 msgid "Strings and binary sequences cannot be directly compared." msgstr "" -#: ../../reference/expressions.rst:1590 +#: ../../reference/expressions.rst:1597 msgid "" "Sequences (instances of :class:`tuple`, :class:`list`, or :class:`range`) " "can be compared only within each of their types, with the restriction that " @@ -1743,7 +1751,7 @@ msgid "" "raises :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1596 +#: ../../reference/expressions.rst:1603 msgid "" "Sequences compare lexicographically using comparison of corresponding " "elements. The built-in containers typically assume identical objects are " @@ -1751,19 +1759,19 @@ msgid "" "objects to improve performance and to maintain their internal invariants." msgstr "" -#: ../../reference/expressions.rst:1601 +#: ../../reference/expressions.rst:1608 msgid "" "Lexicographical comparison between built-in collections works as follows:" msgstr "" -#: ../../reference/expressions.rst:1603 +#: ../../reference/expressions.rst:1610 msgid "" "For two collections to compare equal, they must be of the same type, have " "the same length, and each pair of corresponding elements must compare equal " "(for example, ``[1,2] == (1,2)`` is false because the type is not the same)." msgstr "" -#: ../../reference/expressions.rst:1608 +#: ../../reference/expressions.rst:1615 msgid "" "Collections that support order comparison are ordered the same as their " "first unequal elements (for example, ``[1,2,x] <= [1,2,y]`` has the same " @@ -1772,25 +1780,25 @@ msgid "" "true)." msgstr "" -#: ../../reference/expressions.rst:1614 +#: ../../reference/expressions.rst:1621 msgid "" "Mappings (instances of :class:`dict`) compare equal if and only if they have " "equal ``(key, value)`` pairs. Equality comparison of the keys and values " "enforces reflexivity." msgstr "" -#: ../../reference/expressions.rst:1618 +#: ../../reference/expressions.rst:1625 msgid "" "Order comparisons (``<``, ``>``, ``<=``, and ``>=``) raise :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1620 +#: ../../reference/expressions.rst:1627 msgid "" "Sets (instances of :class:`set` or :class:`frozenset`) can be compared " "within and across their types." msgstr "" -#: ../../reference/expressions.rst:1623 +#: ../../reference/expressions.rst:1630 msgid "" "They define order comparison operators to mean subset and superset tests. " "Those relations do not define total orderings (for example, the two sets " @@ -1801,110 +1809,110 @@ msgid "" "sets as inputs)." msgstr "" -#: ../../reference/expressions.rst:1631 +#: ../../reference/expressions.rst:1638 msgid "Comparison of sets enforces reflexivity of its elements." msgstr "" -#: ../../reference/expressions.rst:1633 +#: ../../reference/expressions.rst:1640 msgid "" "Most other built-in types have no comparison methods implemented, so they " "inherit the default comparison behavior." msgstr "" -#: ../../reference/expressions.rst:1636 +#: ../../reference/expressions.rst:1643 msgid "" "User-defined classes that customize their comparison behavior should follow " "some consistency rules, if possible:" msgstr "" -#: ../../reference/expressions.rst:1639 +#: ../../reference/expressions.rst:1646 msgid "" "Equality comparison should be reflexive. In other words, identical objects " "should compare equal:" msgstr "" -#: ../../reference/expressions.rst:1642 +#: ../../reference/expressions.rst:1649 msgid "``x is y`` implies ``x == y``" msgstr "" -#: ../../reference/expressions.rst:1644 +#: ../../reference/expressions.rst:1651 msgid "" "Comparison should be symmetric. In other words, the following expressions " "should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1647 +#: ../../reference/expressions.rst:1654 msgid "``x == y`` and ``y == x``" msgstr "``x == y`` 和 ``y == x``" -#: ../../reference/expressions.rst:1649 +#: ../../reference/expressions.rst:1656 msgid "``x != y`` and ``y != x``" msgstr "``x != y`` 和 ``y != x``" -#: ../../reference/expressions.rst:1651 +#: ../../reference/expressions.rst:1658 msgid "``x < y`` and ``y > x``" msgstr "``x < y`` 和 ``y > x``" -#: ../../reference/expressions.rst:1653 +#: ../../reference/expressions.rst:1660 msgid "``x <= y`` and ``y >= x``" msgstr "``x <= y`` 和 ``y >= x``" -#: ../../reference/expressions.rst:1655 +#: ../../reference/expressions.rst:1662 msgid "" "Comparison should be transitive. The following (non-exhaustive) examples " "illustrate that:" msgstr "" -#: ../../reference/expressions.rst:1658 +#: ../../reference/expressions.rst:1665 msgid "``x > y and y > z`` implies ``x > z``" msgstr "``x > y and y > z`` 暗示了 ``x > z``" -#: ../../reference/expressions.rst:1660 +#: ../../reference/expressions.rst:1667 msgid "``x < y and y <= z`` implies ``x < z``" msgstr "``x < y and y <= z`` 暗示了 ``x < z``" -#: ../../reference/expressions.rst:1662 +#: ../../reference/expressions.rst:1669 msgid "" "Inverse comparison should result in the boolean negation. In other words, " "the following expressions should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1665 +#: ../../reference/expressions.rst:1672 msgid "``x == y`` and ``not x != y``" msgstr "``x == y`` 和 ``not x != y``" -#: ../../reference/expressions.rst:1667 +#: ../../reference/expressions.rst:1674 msgid "``x < y`` and ``not x >= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1669 +#: ../../reference/expressions.rst:1676 msgid "``x > y`` and ``not x <= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1671 +#: ../../reference/expressions.rst:1678 msgid "" "The last two expressions apply to totally ordered collections (e.g. to " "sequences, but not to sets or mappings). See also the :func:`~functools." "total_ordering` decorator." msgstr "" -#: ../../reference/expressions.rst:1675 +#: ../../reference/expressions.rst:1682 msgid "" "The :func:`hash` result should be consistent with equality. Objects that are " "equal should either have the same hash value, or be marked as unhashable." msgstr "" -#: ../../reference/expressions.rst:1679 +#: ../../reference/expressions.rst:1686 msgid "" "Python does not enforce these consistency rules. In fact, the not-a-number " "values are an example for not following these rules." msgstr "" -#: ../../reference/expressions.rst:1688 +#: ../../reference/expressions.rst:1695 msgid "Membership test operations" msgstr "" -#: ../../reference/expressions.rst:1690 +#: ../../reference/expressions.rst:1697 msgid "" "The operators :keyword:`in` and :keyword:`not in` test for membership. ``x " "in s`` evaluates to ``True`` if *x* is a member of *s*, and ``False`` " @@ -1915,7 +1923,7 @@ msgid "" "expression ``x in y`` is equivalent to ``any(x is e or x == e for e in y)``." msgstr "" -#: ../../reference/expressions.rst:1698 +#: ../../reference/expressions.rst:1705 msgid "" "For the string and bytes types, ``x in y`` is ``True`` if and only if *x* is " "a substring of *y*. An equivalent test is ``y.find(x) != -1``. Empty " @@ -1923,14 +1931,14 @@ msgid "" "``\"\" in \"abc\"`` will return ``True``." msgstr "" -#: ../../reference/expressions.rst:1703 +#: ../../reference/expressions.rst:1710 msgid "" "For user-defined classes which define the :meth:`~object.__contains__` " "method, ``x in y`` returns ``True`` if ``y.__contains__(x)`` returns a true " "value, and ``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1707 +#: ../../reference/expressions.rst:1714 msgid "" "For user-defined classes which do not define :meth:`~object.__contains__` " "but do define :meth:`~object.__iter__`, ``x in y`` is ``True`` if some value " @@ -1939,7 +1947,7 @@ msgid "" "it is as if :keyword:`in` raised that exception." msgstr "" -#: ../../reference/expressions.rst:1713 +#: ../../reference/expressions.rst:1720 msgid "" "Lastly, the old-style iteration protocol is tried: if a class defines :meth:" "`~object.__getitem__`, ``x in y`` is ``True`` if and only if there is a non-" @@ -1948,17 +1956,17 @@ msgid "" "exception is raised, it is as if :keyword:`in` raised that exception)." msgstr "" -#: ../../reference/expressions.rst:1725 +#: ../../reference/expressions.rst:1732 msgid "" "The operator :keyword:`not in` is defined to have the inverse truth value " "of :keyword:`in`." msgstr "" -#: ../../reference/expressions.rst:1738 +#: ../../reference/expressions.rst:1745 msgid "Identity comparisons" msgstr "" -#: ../../reference/expressions.rst:1740 +#: ../../reference/expressions.rst:1747 msgid "" "The operators :keyword:`is` and :keyword:`is not` test for an object's " "identity: ``x is y`` is true if and only if *x* and *y* are the same " @@ -1966,11 +1974,11 @@ msgid "" "``x is not y`` yields the inverse truth value. [#]_" msgstr "" -#: ../../reference/expressions.rst:1752 +#: ../../reference/expressions.rst:1759 msgid "Boolean operations" msgstr "" -#: ../../reference/expressions.rst:1763 +#: ../../reference/expressions.rst:1770 msgid "" "In the context of Boolean operations, and also when expressions are used by " "control flow statements, the following values are interpreted as false: " @@ -1981,25 +1989,25 @@ msgid "" "__bool__` method." msgstr "" -#: ../../reference/expressions.rst:1772 +#: ../../reference/expressions.rst:1779 msgid "" "The operator :keyword:`not` yields ``True`` if its argument is false, " "``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1777 +#: ../../reference/expressions.rst:1784 msgid "" "The expression ``x and y`` first evaluates *x*; if *x* is false, its value " "is returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1782 +#: ../../reference/expressions.rst:1789 msgid "" "The expression ``x or y`` first evaluates *x*; if *x* is true, its value is " "returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1785 +#: ../../reference/expressions.rst:1792 msgid "" "Note that neither :keyword:`and` nor :keyword:`or` restrict the value and " "type they return to ``False`` and ``True``, but rather return the last " @@ -2010,11 +2018,11 @@ msgid "" "argument (for example, ``not 'foo'`` produces ``False`` rather than ``''``.)" msgstr "" -#: ../../reference/expressions.rst:1801 +#: ../../reference/expressions.rst:1808 msgid "Assignment expressions" msgstr "" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1813 msgid "" "An assignment expression (sometimes also called a \"named expression\" or " "\"walrus\") assigns an :token:`~python-grammar:expression` to an :token:" @@ -2022,11 +2030,11 @@ msgid "" "`~python-grammar:expression`." msgstr "" -#: ../../reference/expressions.rst:1811 +#: ../../reference/expressions.rst:1818 msgid "One common use case is when handling matched regular expressions:" msgstr "" -#: ../../reference/expressions.rst:1813 +#: ../../reference/expressions.rst:1820 msgid "" "if matching := pattern.search(data):\n" " do_something(matching)" @@ -2034,11 +2042,11 @@ msgstr "" "if matching := pattern.search(data):\n" " do_something(matching)" -#: ../../reference/expressions.rst:1818 +#: ../../reference/expressions.rst:1825 msgid "Or, when processing a file stream in chunks:" msgstr "" -#: ../../reference/expressions.rst:1820 +#: ../../reference/expressions.rst:1827 msgid "" "while chunk := file.read(9000):\n" " process(chunk)" @@ -2046,7 +2054,7 @@ msgstr "" "while chunk := file.read(9000):\n" " process(chunk)" -#: ../../reference/expressions.rst:1825 +#: ../../reference/expressions.rst:1832 msgid "" "Assignment expressions must be surrounded by parentheses when used as " "expression statements and when used as sub-expressions in slicing, " @@ -2056,36 +2064,36 @@ msgid "" "and ``while`` statements." msgstr "" -#: ../../reference/expressions.rst:1833 +#: ../../reference/expressions.rst:1840 msgid "See :pep:`572` for more details about assignment expressions." msgstr "" -#: ../../reference/expressions.rst:1840 +#: ../../reference/expressions.rst:1847 msgid "Conditional expressions" msgstr "" -#: ../../reference/expressions.rst:1852 +#: ../../reference/expressions.rst:1859 msgid "" "Conditional expressions (sometimes called a \"ternary operator\") have the " "lowest priority of all Python operations." msgstr "" -#: ../../reference/expressions.rst:1855 +#: ../../reference/expressions.rst:1862 msgid "" "The expression ``x if C else y`` first evaluates the condition, *C* rather " "than *x*. If *C* is true, *x* is evaluated and its value is returned; " "otherwise, *y* is evaluated and its value is returned." msgstr "" -#: ../../reference/expressions.rst:1859 +#: ../../reference/expressions.rst:1866 msgid "See :pep:`308` for more details about conditional expressions." msgstr "" -#: ../../reference/expressions.rst:1866 +#: ../../reference/expressions.rst:1873 msgid "Lambdas" msgstr "" -#: ../../reference/expressions.rst:1877 +#: ../../reference/expressions.rst:1884 msgid "" "Lambda expressions (sometimes called lambda forms) are used to create " "anonymous functions. The expression ``lambda parameters: expression`` yields " @@ -2093,7 +2101,7 @@ msgid "" "defined with:" msgstr "" -#: ../../reference/expressions.rst:1881 +#: ../../reference/expressions.rst:1888 msgid "" "def <lambda>(parameters):\n" " return expression" @@ -2101,25 +2109,25 @@ msgstr "" "def <lambda>(parameters):\n" " return expression" -#: ../../reference/expressions.rst:1886 +#: ../../reference/expressions.rst:1893 msgid "" "See section :ref:`function` for the syntax of parameter lists. Note that " "functions created with lambda expressions cannot contain statements or " "annotations." msgstr "" -#: ../../reference/expressions.rst:1894 +#: ../../reference/expressions.rst:1901 msgid "Expression lists" msgstr "" -#: ../../reference/expressions.rst:1908 +#: ../../reference/expressions.rst:1915 msgid "" "Except when part of a list or set display, an expression list containing at " "least one comma yields a tuple. The length of the tuple is the number of " "expressions in the list. The expressions are evaluated from left to right." msgstr "" -#: ../../reference/expressions.rst:1917 +#: ../../reference/expressions.rst:1924 msgid "" "An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be " "an :term:`iterable`. The iterable is expanded into a sequence of items, " @@ -2127,12 +2135,12 @@ msgid "" "unpacking." msgstr "" -#: ../../reference/expressions.rst:1922 +#: ../../reference/expressions.rst:1929 msgid "" "Iterable unpacking in expression lists, originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1927 +#: ../../reference/expressions.rst:1934 msgid "" "A trailing comma is required only to create a one-item tuple, such as ``1," "``; it is optional in all other cases. A single expression without a " @@ -2141,24 +2149,24 @@ msgid "" "``()``.)" msgstr "" -#: ../../reference/expressions.rst:1938 +#: ../../reference/expressions.rst:1945 msgid "Evaluation order" msgstr "" -#: ../../reference/expressions.rst:1942 +#: ../../reference/expressions.rst:1949 msgid "" "Python evaluates expressions from left to right. Notice that while " "evaluating an assignment, the right-hand side is evaluated before the left-" "hand side." msgstr "" -#: ../../reference/expressions.rst:1945 +#: ../../reference/expressions.rst:1952 msgid "" "In the following lines, expressions will be evaluated in the arithmetic " "order of their suffixes::" msgstr "" -#: ../../reference/expressions.rst:1948 +#: ../../reference/expressions.rst:1955 msgid "" "expr1, expr2, expr3, expr4\n" "(expr1, expr2, expr3, expr4)\n" @@ -2174,11 +2182,11 @@ msgstr "" "expr1(expr2, expr3, *expr4, **expr5)\n" "expr3, expr4 = expr1, expr2" -#: ../../reference/expressions.rst:1959 +#: ../../reference/expressions.rst:1966 msgid "Operator precedence" msgstr "" -#: ../../reference/expressions.rst:1964 +#: ../../reference/expressions.rst:1971 msgid "" "The following table summarizes the operator precedence in Python, from " "highest precedence (most binding) to lowest precedence (least binding). " @@ -2188,176 +2196,176 @@ msgid "" "group from right to left)." msgstr "" -#: ../../reference/expressions.rst:1970 +#: ../../reference/expressions.rst:1977 msgid "" "Note that comparisons, membership tests, and identity tests, all have the " "same precedence and have a left-to-right chaining feature as described in " "the :ref:`comparisons` section." msgstr "" -#: ../../reference/expressions.rst:1976 +#: ../../reference/expressions.rst:1983 msgid "Operator" msgstr "" -#: ../../reference/expressions.rst:1976 +#: ../../reference/expressions.rst:1983 msgid "Description" msgstr "描述" -#: ../../reference/expressions.rst:1978 +#: ../../reference/expressions.rst:1985 msgid "``(expressions...)``," msgstr "``(expressions...)``," -#: ../../reference/expressions.rst:1980 +#: ../../reference/expressions.rst:1987 msgid "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" msgstr "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" -#: ../../reference/expressions.rst:1978 +#: ../../reference/expressions.rst:1985 msgid "" "Binding or parenthesized expression, list display, dictionary display, set " "display" msgstr "" -#: ../../reference/expressions.rst:1984 +#: ../../reference/expressions.rst:1991 msgid "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" msgstr "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" -#: ../../reference/expressions.rst:1984 +#: ../../reference/expressions.rst:1991 msgid "Subscription, slicing, call, attribute reference" msgstr "" -#: ../../reference/expressions.rst:1987 +#: ../../reference/expressions.rst:1994 msgid ":keyword:`await x <await>`" msgstr ":keyword:`await x <await>`" -#: ../../reference/expressions.rst:1989 +#: ../../reference/expressions.rst:1996 msgid "``**``" msgstr "``**``" -#: ../../reference/expressions.rst:1989 +#: ../../reference/expressions.rst:1996 msgid "Exponentiation [#]_" msgstr "" -#: ../../reference/expressions.rst:1991 +#: ../../reference/expressions.rst:1998 msgid "``+x``, ``-x``, ``~x``" msgstr "``+x``, ``-x``, ``~x``" -#: ../../reference/expressions.rst:1991 +#: ../../reference/expressions.rst:1998 msgid "Positive, negative, bitwise NOT" msgstr "" -#: ../../reference/expressions.rst:1993 +#: ../../reference/expressions.rst:2000 msgid "``*``, ``@``, ``/``, ``//``, ``%``" msgstr "``*``, ``@``, ``/``, ``//``, ``%``" -#: ../../reference/expressions.rst:1993 +#: ../../reference/expressions.rst:2000 msgid "" "Multiplication, matrix multiplication, division, floor division, remainder " "[#]_" msgstr "" -#: ../../reference/expressions.rst:1997 +#: ../../reference/expressions.rst:2004 msgid "``+``, ``-``" msgstr "``+``, ``-``" -#: ../../reference/expressions.rst:1997 +#: ../../reference/expressions.rst:2004 msgid "Addition and subtraction" msgstr "" -#: ../../reference/expressions.rst:1999 +#: ../../reference/expressions.rst:2006 msgid "``<<``, ``>>``" msgstr "``<<``, ``>>``" -#: ../../reference/expressions.rst:1999 +#: ../../reference/expressions.rst:2006 msgid "Shifts" msgstr "" -#: ../../reference/expressions.rst:2001 +#: ../../reference/expressions.rst:2008 msgid "``&``" msgstr "``&``" -#: ../../reference/expressions.rst:2001 +#: ../../reference/expressions.rst:2008 msgid "Bitwise AND" msgstr "" -#: ../../reference/expressions.rst:2003 +#: ../../reference/expressions.rst:2010 msgid "``^``" msgstr "``^``" -#: ../../reference/expressions.rst:2003 +#: ../../reference/expressions.rst:2010 msgid "Bitwise XOR" msgstr "" -#: ../../reference/expressions.rst:2005 +#: ../../reference/expressions.rst:2012 msgid "``|``" msgstr "``|``" -#: ../../reference/expressions.rst:2005 +#: ../../reference/expressions.rst:2012 msgid "Bitwise OR" msgstr "" -#: ../../reference/expressions.rst:2007 +#: ../../reference/expressions.rst:2014 msgid "" ":keyword:`in`, :keyword:`not in`, :keyword:`is`, :keyword:`is not`, ``<``, " "``<=``, ``>``, ``>=``, ``!=``, ``==``" msgstr "" -#: ../../reference/expressions.rst:2007 +#: ../../reference/expressions.rst:2014 msgid "Comparisons, including membership tests and identity tests" msgstr "" -#: ../../reference/expressions.rst:2011 +#: ../../reference/expressions.rst:2018 msgid ":keyword:`not x <not>`" msgstr ":keyword:`not x <not>`" -#: ../../reference/expressions.rst:2011 +#: ../../reference/expressions.rst:2018 msgid "Boolean NOT" msgstr "" -#: ../../reference/expressions.rst:2013 +#: ../../reference/expressions.rst:2020 msgid ":keyword:`and`" msgstr ":keyword:`and`" -#: ../../reference/expressions.rst:2013 +#: ../../reference/expressions.rst:2020 msgid "Boolean AND" msgstr "" -#: ../../reference/expressions.rst:2015 +#: ../../reference/expressions.rst:2022 msgid ":keyword:`or`" msgstr ":keyword:`or`" -#: ../../reference/expressions.rst:2015 +#: ../../reference/expressions.rst:2022 msgid "Boolean OR" msgstr "" -#: ../../reference/expressions.rst:2017 +#: ../../reference/expressions.rst:2024 msgid ":keyword:`if <if_expr>` -- :keyword:`!else`" msgstr ":keyword:`if <if_expr>` -- :keyword:`!else`" -#: ../../reference/expressions.rst:2017 +#: ../../reference/expressions.rst:2024 msgid "Conditional expression" msgstr "" -#: ../../reference/expressions.rst:2019 +#: ../../reference/expressions.rst:2026 msgid ":keyword:`lambda`" msgstr ":keyword:`lambda`" -#: ../../reference/expressions.rst:2019 +#: ../../reference/expressions.rst:2026 msgid "Lambda expression" msgstr "" -#: ../../reference/expressions.rst:2021 +#: ../../reference/expressions.rst:2028 msgid "``:=``" msgstr "``:=``" -#: ../../reference/expressions.rst:2021 +#: ../../reference/expressions.rst:2028 msgid "Assignment expression" msgstr "" -#: ../../reference/expressions.rst:2026 +#: ../../reference/expressions.rst:2033 msgid "Footnotes" msgstr "註解" -#: ../../reference/expressions.rst:2027 +#: ../../reference/expressions.rst:2034 msgid "" "While ``abs(x%y) < abs(y)`` is true mathematically, for floats it may not be " "true numerically due to roundoff. For example, and assuming a platform on " @@ -2369,7 +2377,7 @@ msgid "" "approach is more appropriate depends on the application." msgstr "" -#: ../../reference/expressions.rst:2036 +#: ../../reference/expressions.rst:2043 msgid "" "If x is very close to an exact integer multiple of y, it's possible for ``x//" "y`` to be one larger than ``(x-x%y)//y`` due to rounding. In such cases, " @@ -2377,7 +2385,7 @@ msgid "" "* y + x % y`` be very close to ``x``." msgstr "" -#: ../../reference/expressions.rst:2041 +#: ../../reference/expressions.rst:2048 msgid "" "The Unicode standard distinguishes between :dfn:`code points` (e.g. U+0041) " "and :dfn:`abstract characters` (e.g. \"LATIN CAPITAL LETTER A\"). While most " @@ -2391,7 +2399,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: ../../reference/expressions.rst:2052 +#: ../../reference/expressions.rst:2059 msgid "" "The comparison operators on strings compare at the level of Unicode code " "points. This may be counter-intuitive to humans. For example, ``\"\\u00C7\" " @@ -2399,13 +2407,13 @@ msgid "" "same abstract character \"LATIN CAPITAL LETTER C WITH CEDILLA\"." msgstr "" -#: ../../reference/expressions.rst:2057 +#: ../../reference/expressions.rst:2064 msgid "" "To compare strings at the level of abstract characters (that is, in a way " "intuitive to humans), use :func:`unicodedata.normalize`." msgstr "" -#: ../../reference/expressions.rst:2060 +#: ../../reference/expressions.rst:2067 msgid "" "Due to automatic garbage-collection, free lists, and the dynamic nature of " "descriptors, you may notice seemingly unusual behaviour in certain uses of " @@ -2413,22 +2421,22 @@ msgid "" "instance methods, or constants. Check their documentation for more info." msgstr "" -#: ../../reference/expressions.rst:2065 +#: ../../reference/expressions.rst:2072 msgid "" "The power operator ``**`` binds less tightly than an arithmetic or bitwise " "unary operator on its right, that is, ``2**-1`` is ``0.5``." msgstr "" -#: ../../reference/expressions.rst:2068 +#: ../../reference/expressions.rst:2075 msgid "" "The ``%`` operator is also used for string formatting; the same precedence " "applies." msgstr "" #: ../../reference/expressions.rst:8 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1754 -#: ../../reference/expressions.rst:1842 ../../reference/expressions.rst:1868 -#: ../../reference/expressions.rst:1896 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1761 +#: ../../reference/expressions.rst:1849 ../../reference/expressions.rst:1875 +#: ../../reference/expressions.rst:1903 msgid "expression" msgstr "" @@ -2436,8 +2444,8 @@ msgstr "" msgid "BNF" msgstr "BNF" -#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1246 -#: ../../reference/expressions.rst:1294 +#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1253 +#: ../../reference/expressions.rst:1301 msgid "arithmetic" msgstr "" @@ -2458,10 +2466,10 @@ msgid "identifier" msgstr "" #: ../../reference/expressions.rst:74 ../../reference/expressions.rst:569 -#: ../../reference/expressions.rst:624 ../../reference/expressions.rst:746 -#: ../../reference/expressions.rst:798 ../../reference/expressions.rst:844 -#: ../../reference/expressions.rst:1283 ../../reference/expressions.rst:1332 -#: ../../reference/expressions.rst:1428 +#: ../../reference/expressions.rst:624 ../../reference/expressions.rst:753 +#: ../../reference/expressions.rst:805 ../../reference/expressions.rst:851 +#: ../../reference/expressions.rst:1290 ../../reference/expressions.rst:1339 +#: ../../reference/expressions.rst:1435 msgid "exception" msgstr "" @@ -2500,12 +2508,12 @@ msgstr "type(型別)" #: ../../reference/expressions.rst:146 ../../reference/expressions.rst:275 #: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 #: ../../reference/expressions.rst:372 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:557 ../../reference/expressions.rst:736 -#: ../../reference/expressions.rst:844 ../../reference/expressions.rst:873 -#: ../../reference/expressions.rst:946 ../../reference/expressions.rst:990 -#: ../../reference/expressions.rst:1138 ../../reference/expressions.rst:1151 -#: ../../reference/expressions.rst:1165 ../../reference/expressions.rst:1172 -#: ../../reference/expressions.rst:1719 ../../reference/expressions.rst:1906 +#: ../../reference/expressions.rst:557 ../../reference/expressions.rst:743 +#: ../../reference/expressions.rst:851 ../../reference/expressions.rst:880 +#: ../../reference/expressions.rst:953 ../../reference/expressions.rst:997 +#: ../../reference/expressions.rst:1145 ../../reference/expressions.rst:1158 +#: ../../reference/expressions.rst:1172 ../../reference/expressions.rst:1179 +#: ../../reference/expressions.rst:1726 ../../reference/expressions.rst:1913 msgid "object" msgstr "object(物件)" @@ -2514,7 +2522,7 @@ msgid "parenthesized form" msgstr "" #: ../../reference/expressions.rst:162 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:990 +#: ../../reference/expressions.rst:997 msgid "() (parentheses)" msgstr "() (圓括號)" @@ -2526,19 +2534,19 @@ msgstr "" msgid "empty" msgstr "" -#: ../../reference/expressions.rst:175 ../../reference/expressions.rst:873 -#: ../../reference/expressions.rst:946 ../../reference/expressions.rst:1906 +#: ../../reference/expressions.rst:175 ../../reference/expressions.rst:880 +#: ../../reference/expressions.rst:953 ../../reference/expressions.rst:1913 msgid "tuple" msgstr "" -#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1925 +#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1932 msgid "comma" msgstr "" #: ../../reference/expressions.rst:181 ../../reference/expressions.rst:275 #: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 -#: ../../reference/expressions.rst:940 ../../reference/expressions.rst:990 -#: ../../reference/expressions.rst:1896 +#: ../../reference/expressions.rst:947 ../../reference/expressions.rst:997 +#: ../../reference/expressions.rst:1903 msgid ", (comma)" msgstr ", (逗號)" @@ -2555,7 +2563,7 @@ msgstr "for" msgid "in comprehensions" msgstr "於 comprehensions(綜合運算)" -#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1842 +#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1849 msgid "if" msgstr "if" @@ -2563,13 +2571,13 @@ msgstr "if" msgid "async for" msgstr "async for" -#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1190 +#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1197 msgid "await" msgstr "await" -#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:844 -#: ../../reference/expressions.rst:873 ../../reference/expressions.rst:946 -#: ../../reference/expressions.rst:1896 +#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:851 +#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:953 +#: ../../reference/expressions.rst:1903 msgid "list" msgstr "list(串列)" @@ -2578,7 +2586,7 @@ msgstr "list(串列)" msgid "display" msgstr "" -#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:869 +#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:876 msgid "[] (square brackets)" msgstr "[] (方括號)" @@ -2587,7 +2595,7 @@ msgid "list expression" msgstr "list expression(串列運算式)" #: ../../reference/expressions.rst:275 ../../reference/expressions.rst:301 -#: ../../reference/expressions.rst:1896 +#: ../../reference/expressions.rst:1903 msgid "expression list" msgstr "expression list(運算式串列)" @@ -2604,7 +2612,7 @@ msgid "set expression" msgstr "set expression(集合運算式)" #: ../../reference/expressions.rst:329 ../../reference/expressions.rst:355 -#: ../../reference/expressions.rst:873 +#: ../../reference/expressions.rst:880 msgid "dictionary" msgstr "dictionary(字典)" @@ -2624,8 +2632,8 @@ msgstr "key/value pair(鍵/值對)" msgid "dictionary expression" msgstr "dictionary expression(字典運算式)" -#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:940 -#: ../../reference/expressions.rst:1868 +#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:947 +#: ../../reference/expressions.rst:1875 msgid ": (colon)" msgstr ": (冒號)" @@ -2637,13 +2645,13 @@ msgstr "於字典運算式" msgid "in dictionary displays" msgstr "於字典顯示" -#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1073 -#: ../../reference/expressions.rst:1913 +#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1080 +#: ../../reference/expressions.rst:1920 msgid "unpacking" msgstr "unpacking(解包)" -#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1103 -#: ../../reference/expressions.rst:1210 +#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1110 +#: ../../reference/expressions.rst:1217 msgid "**" msgstr "**" @@ -2660,11 +2668,11 @@ msgstr "generator(產生器)" msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1190 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1197 msgid "keyword" msgstr "keyword(關鍵字)" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:637 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:644 msgid "yield" msgstr "yield" @@ -2672,8 +2680,8 @@ msgstr "yield" msgid "from" msgstr "from" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1138 -#: ../../reference/expressions.rst:1151 ../../reference/expressions.rst:1868 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1145 +#: ../../reference/expressions.rst:1158 ../../reference/expressions.rst:1875 msgid "function" msgstr "function (函式)" @@ -2689,500 +2697,500 @@ msgstr "yield from expression(yield from 運算式)" msgid "StopIteration" msgstr "StopIteration" -#: ../../reference/expressions.rst:624 ../../reference/expressions.rst:798 +#: ../../reference/expressions.rst:624 ../../reference/expressions.rst:805 msgid "GeneratorExit" msgstr "GeneratorExit" -#: ../../reference/expressions.rst:637 +#: ../../reference/expressions.rst:644 msgid "examples" msgstr "範例" -#: ../../reference/expressions.rst:736 +#: ../../reference/expressions.rst:743 msgid "asynchronous-generator" msgstr "asynchronous-generator(非同步產生器)" -#: ../../reference/expressions.rst:746 +#: ../../reference/expressions.rst:753 msgid "StopAsyncIteration" msgstr "StopAsyncIteration" -#: ../../reference/expressions.rst:821 +#: ../../reference/expressions.rst:828 msgid "primary" msgstr "primary(主要)" -#: ../../reference/expressions.rst:835 +#: ../../reference/expressions.rst:842 msgid "attribute" msgstr "attribute(屬性)" -#: ../../reference/expressions.rst:835 +#: ../../reference/expressions.rst:842 msgid "reference" msgstr "reference(參照)" -#: ../../reference/expressions.rst:835 +#: ../../reference/expressions.rst:842 msgid ". (dot)" msgstr ". (點)" -#: ../../reference/expressions.rst:835 +#: ../../reference/expressions.rst:842 msgid "attribute reference" msgstr "attribute reference(屬性參照)" -#: ../../reference/expressions.rst:844 +#: ../../reference/expressions.rst:851 msgid "AttributeError" msgstr "AttributeError" -#: ../../reference/expressions.rst:844 +#: ../../reference/expressions.rst:851 msgid "module" msgstr "module(模組)" -#: ../../reference/expressions.rst:869 +#: ../../reference/expressions.rst:876 msgid "subscription" msgstr "subscription(下標)" -#: ../../reference/expressions.rst:873 ../../reference/expressions.rst:946 -#: ../../reference/expressions.rst:1719 +#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:953 +#: ../../reference/expressions.rst:1726 msgid "sequence" msgstr "sequence(序列)" -#: ../../reference/expressions.rst:873 +#: ../../reference/expressions.rst:880 msgid "mapping" msgstr "mapping(對映)" -#: ../../reference/expressions.rst:873 ../../reference/expressions.rst:926 -#: ../../reference/expressions.rst:946 +#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:933 +#: ../../reference/expressions.rst:953 msgid "string" msgstr "string(字串)" -#: ../../reference/expressions.rst:873 ../../reference/expressions.rst:926 +#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:933 msgid "item" msgstr "item(項目)" -#: ../../reference/expressions.rst:926 +#: ../../reference/expressions.rst:933 msgid "character" msgstr "character(字元)" -#: ../../reference/expressions.rst:940 +#: ../../reference/expressions.rst:947 msgid "slicing" msgstr "slicing(切片)" -#: ../../reference/expressions.rst:940 +#: ../../reference/expressions.rst:947 msgid "slice" msgstr "slice(切片)" -#: ../../reference/expressions.rst:972 +#: ../../reference/expressions.rst:979 msgid "start (slice object attribute)" msgstr "start(切片物件屬性)" -#: ../../reference/expressions.rst:972 +#: ../../reference/expressions.rst:979 msgid "stop (slice object attribute)" msgstr "stop(切片物件屬性)" -#: ../../reference/expressions.rst:972 +#: ../../reference/expressions.rst:979 msgid "step (slice object attribute)" msgstr "step(切片物件屬性)" -#: ../../reference/expressions.rst:990 +#: ../../reference/expressions.rst:997 msgid "callable" msgstr "callable(可呼叫物件)" -#: ../../reference/expressions.rst:990 ../../reference/expressions.rst:1138 -#: ../../reference/expressions.rst:1151 ../../reference/expressions.rst:1165 -#: ../../reference/expressions.rst:1172 ../../reference/expressions.rst:1182 +#: ../../reference/expressions.rst:997 ../../reference/expressions.rst:1145 +#: ../../reference/expressions.rst:1158 ../../reference/expressions.rst:1172 +#: ../../reference/expressions.rst:1179 ../../reference/expressions.rst:1189 msgid "call" msgstr "call(呼叫)" -#: ../../reference/expressions.rst:990 +#: ../../reference/expressions.rst:997 msgid "argument" msgstr "argument(引數)" -#: ../../reference/expressions.rst:990 ../../reference/expressions.rst:1023 +#: ../../reference/expressions.rst:997 ../../reference/expressions.rst:1030 msgid "call semantics" msgstr "call semantics(呼叫語意)" -#: ../../reference/expressions.rst:990 +#: ../../reference/expressions.rst:997 msgid "argument list" msgstr "argument list(引數列表)" -#: ../../reference/expressions.rst:990 +#: ../../reference/expressions.rst:997 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/expressions.rst:990 ../../reference/expressions.rst:1073 -#: ../../reference/expressions.rst:1103 +#: ../../reference/expressions.rst:997 ../../reference/expressions.rst:1080 +#: ../../reference/expressions.rst:1110 msgid "in function calls" msgstr "於函式呼叫中" -#: ../../reference/expressions.rst:1023 +#: ../../reference/expressions.rst:1030 msgid "parameter" msgstr "parameter(參數)" -#: ../../reference/expressions.rst:1073 ../../reference/expressions.rst:1307 -#: ../../reference/expressions.rst:1913 +#: ../../reference/expressions.rst:1080 ../../reference/expressions.rst:1314 +#: ../../reference/expressions.rst:1920 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/expressions.rst:1138 +#: ../../reference/expressions.rst:1145 msgid "user-defined" msgstr "user-defined(使用者定義)" -#: ../../reference/expressions.rst:1138 +#: ../../reference/expressions.rst:1145 msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" -#: ../../reference/expressions.rst:1151 +#: ../../reference/expressions.rst:1158 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../reference/expressions.rst:1151 +#: ../../reference/expressions.rst:1158 msgid "method" msgstr "method(方法)" -#: ../../reference/expressions.rst:1151 +#: ../../reference/expressions.rst:1158 msgid "built-in method" msgstr "built-in method(內建方法)" -#: ../../reference/expressions.rst:1165 +#: ../../reference/expressions.rst:1172 msgid "class" msgstr "class(類別)" -#: ../../reference/expressions.rst:1165 +#: ../../reference/expressions.rst:1172 msgid "class object" msgstr "class object(類別物件)" -#: ../../reference/expressions.rst:1172 +#: ../../reference/expressions.rst:1179 msgid "class instance" msgstr "class instance(類別實例)" -#: ../../reference/expressions.rst:1172 ../../reference/expressions.rst:1182 +#: ../../reference/expressions.rst:1179 ../../reference/expressions.rst:1189 msgid "instance" msgstr "instance(實例)" -#: ../../reference/expressions.rst:1182 +#: ../../reference/expressions.rst:1189 msgid "__call__() (object method)" msgstr "__call__() (物件方法)" -#: ../../reference/expressions.rst:1210 +#: ../../reference/expressions.rst:1217 msgid "power" msgstr "power(次方)" -#: ../../reference/expressions.rst:1210 ../../reference/expressions.rst:1246 -#: ../../reference/expressions.rst:1294 ../../reference/expressions.rst:1410 -#: ../../reference/expressions.rst:1439 ../../reference/expressions.rst:1754 +#: ../../reference/expressions.rst:1217 ../../reference/expressions.rst:1253 +#: ../../reference/expressions.rst:1301 ../../reference/expressions.rst:1417 +#: ../../reference/expressions.rst:1446 ../../reference/expressions.rst:1761 msgid "operation" msgstr "operation(操作)" -#: ../../reference/expressions.rst:1210 ../../reference/expressions.rst:1255 -#: ../../reference/expressions.rst:1264 ../../reference/expressions.rst:1272 -#: ../../reference/expressions.rst:1307 ../../reference/expressions.rst:1320 -#: ../../reference/expressions.rst:1332 ../../reference/expressions.rst:1350 -#: ../../reference/expressions.rst:1380 ../../reference/expressions.rst:1393 -#: ../../reference/expressions.rst:1410 ../../reference/expressions.rst:1448 -#: ../../reference/expressions.rst:1456 ../../reference/expressions.rst:1465 -#: ../../reference/expressions.rst:1480 ../../reference/expressions.rst:1719 -#: ../../reference/expressions.rst:1728 ../../reference/expressions.rst:1770 -#: ../../reference/expressions.rst:1775 ../../reference/expressions.rst:1780 -#: ../../reference/expressions.rst:1842 ../../reference/expressions.rst:1961 +#: ../../reference/expressions.rst:1217 ../../reference/expressions.rst:1262 +#: ../../reference/expressions.rst:1271 ../../reference/expressions.rst:1279 +#: ../../reference/expressions.rst:1314 ../../reference/expressions.rst:1327 +#: ../../reference/expressions.rst:1339 ../../reference/expressions.rst:1357 +#: ../../reference/expressions.rst:1387 ../../reference/expressions.rst:1400 +#: ../../reference/expressions.rst:1417 ../../reference/expressions.rst:1455 +#: ../../reference/expressions.rst:1463 ../../reference/expressions.rst:1472 +#: ../../reference/expressions.rst:1487 ../../reference/expressions.rst:1726 +#: ../../reference/expressions.rst:1735 ../../reference/expressions.rst:1777 +#: ../../reference/expressions.rst:1782 ../../reference/expressions.rst:1787 +#: ../../reference/expressions.rst:1849 ../../reference/expressions.rst:1968 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/expressions.rst:1246 +#: ../../reference/expressions.rst:1253 msgid "unary" msgstr "unary(一元)" -#: ../../reference/expressions.rst:1246 ../../reference/expressions.rst:1439 -#: ../../reference/expressions.rst:1448 ../../reference/expressions.rst:1456 -#: ../../reference/expressions.rst:1465 +#: ../../reference/expressions.rst:1253 ../../reference/expressions.rst:1446 +#: ../../reference/expressions.rst:1455 ../../reference/expressions.rst:1463 +#: ../../reference/expressions.rst:1472 msgid "bitwise" msgstr "bitwise(位元)" -#: ../../reference/expressions.rst:1255 +#: ../../reference/expressions.rst:1262 msgid "negation" msgstr "negation(否定)" -#: ../../reference/expressions.rst:1255 +#: ../../reference/expressions.rst:1262 msgid "minus" msgstr "minus(減)" -#: ../../reference/expressions.rst:1255 ../../reference/expressions.rst:1393 +#: ../../reference/expressions.rst:1262 ../../reference/expressions.rst:1400 msgid "- (minus)" msgstr "- (減號)" -#: ../../reference/expressions.rst:1255 ../../reference/expressions.rst:1264 +#: ../../reference/expressions.rst:1262 ../../reference/expressions.rst:1271 msgid "unary operator" msgstr "unary operator(一元運算子)" -#: ../../reference/expressions.rst:1264 +#: ../../reference/expressions.rst:1271 msgid "plus" msgstr "plus(加)" -#: ../../reference/expressions.rst:1264 ../../reference/expressions.rst:1380 +#: ../../reference/expressions.rst:1271 ../../reference/expressions.rst:1387 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../reference/expressions.rst:1272 +#: ../../reference/expressions.rst:1279 msgid "inversion" msgstr "inversion(反轉)" -#: ../../reference/expressions.rst:1272 +#: ../../reference/expressions.rst:1279 msgid "~ (tilde)" msgstr "~ (波浪號)" -#: ../../reference/expressions.rst:1283 +#: ../../reference/expressions.rst:1290 msgid "TypeError" msgstr "TypeError" -#: ../../reference/expressions.rst:1294 ../../reference/expressions.rst:1439 +#: ../../reference/expressions.rst:1301 ../../reference/expressions.rst:1446 msgid "binary" msgstr "binary(二進位)" -#: ../../reference/expressions.rst:1307 +#: ../../reference/expressions.rst:1314 msgid "multiplication" msgstr "multiplication(乘)" -#: ../../reference/expressions.rst:1320 +#: ../../reference/expressions.rst:1327 msgid "matrix multiplication" msgstr "matrix multiplication(矩陣乘法)" -#: ../../reference/expressions.rst:1320 +#: ../../reference/expressions.rst:1327 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/expressions.rst:1332 +#: ../../reference/expressions.rst:1339 msgid "ZeroDivisionError" msgstr "ZeroDivisionError" -#: ../../reference/expressions.rst:1332 +#: ../../reference/expressions.rst:1339 msgid "division" msgstr "division(除)" -#: ../../reference/expressions.rst:1332 +#: ../../reference/expressions.rst:1339 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/expressions.rst:1332 +#: ../../reference/expressions.rst:1339 msgid "//" msgstr "//" -#: ../../reference/expressions.rst:1350 +#: ../../reference/expressions.rst:1357 msgid "modulo" msgstr "modulo(餘數)" -#: ../../reference/expressions.rst:1350 +#: ../../reference/expressions.rst:1357 msgid "% (percent)" msgstr "% (百分號)" -#: ../../reference/expressions.rst:1380 +#: ../../reference/expressions.rst:1387 msgid "addition" msgstr "addition(加)" -#: ../../reference/expressions.rst:1380 ../../reference/expressions.rst:1393 +#: ../../reference/expressions.rst:1387 ../../reference/expressions.rst:1400 msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../reference/expressions.rst:1393 +#: ../../reference/expressions.rst:1400 msgid "subtraction" msgstr "subtraction(減)" -#: ../../reference/expressions.rst:1410 +#: ../../reference/expressions.rst:1417 msgid "shifting" msgstr "shifting(移動)" -#: ../../reference/expressions.rst:1410 +#: ../../reference/expressions.rst:1417 msgid "<<" msgstr "<<" -#: ../../reference/expressions.rst:1410 +#: ../../reference/expressions.rst:1417 msgid ">>" msgstr ">>" -#: ../../reference/expressions.rst:1428 +#: ../../reference/expressions.rst:1435 msgid "ValueError" msgstr "ValueError" -#: ../../reference/expressions.rst:1448 ../../reference/expressions.rst:1775 +#: ../../reference/expressions.rst:1455 ../../reference/expressions.rst:1782 msgid "and" msgstr "and" -#: ../../reference/expressions.rst:1448 +#: ../../reference/expressions.rst:1455 msgid "& (ampersand)" msgstr "& (和號)" -#: ../../reference/expressions.rst:1456 +#: ../../reference/expressions.rst:1463 msgid "xor" msgstr "xor" -#: ../../reference/expressions.rst:1456 +#: ../../reference/expressions.rst:1463 msgid "exclusive" msgstr "exclusive(排外)" -#: ../../reference/expressions.rst:1456 ../../reference/expressions.rst:1465 -#: ../../reference/expressions.rst:1780 +#: ../../reference/expressions.rst:1463 ../../reference/expressions.rst:1472 +#: ../../reference/expressions.rst:1787 msgid "or" msgstr "or" -#: ../../reference/expressions.rst:1456 +#: ../../reference/expressions.rst:1463 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../reference/expressions.rst:1465 +#: ../../reference/expressions.rst:1472 msgid "inclusive" msgstr "inclusive(包含)" -#: ../../reference/expressions.rst:1465 +#: ../../reference/expressions.rst:1472 msgid "| (vertical bar)" msgstr "| (垂直線)" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1487 msgid "comparison" msgstr "comparison(比較)" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1487 msgid "C" msgstr "C" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1487 msgid "language" msgstr "language(語言)" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1487 msgid "< (less)" msgstr "< (小於)" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1487 msgid "> (greater)" msgstr "> (大於)" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1487 msgid "<=" msgstr "<=" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1487 msgid ">=" msgstr ">=" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1487 msgid "==" msgstr "==" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1487 msgid "!=" msgstr "!=" -#: ../../reference/expressions.rst:1504 +#: ../../reference/expressions.rst:1511 msgid "chaining" msgstr "chaining(鏈接)" -#: ../../reference/expressions.rst:1504 +#: ../../reference/expressions.rst:1511 msgid "comparisons" msgstr "comparisons(比較)" -#: ../../reference/expressions.rst:1719 +#: ../../reference/expressions.rst:1726 msgid "in" msgstr "in" -#: ../../reference/expressions.rst:1719 +#: ../../reference/expressions.rst:1726 msgid "not in" msgstr "not in" -#: ../../reference/expressions.rst:1719 +#: ../../reference/expressions.rst:1726 msgid "membership" msgstr "membership(成員)" -#: ../../reference/expressions.rst:1719 ../../reference/expressions.rst:1728 +#: ../../reference/expressions.rst:1726 ../../reference/expressions.rst:1735 msgid "test" msgstr "test(測試)" -#: ../../reference/expressions.rst:1728 +#: ../../reference/expressions.rst:1735 msgid "is" msgstr "is" -#: ../../reference/expressions.rst:1728 +#: ../../reference/expressions.rst:1735 msgid "is not" msgstr "is not" -#: ../../reference/expressions.rst:1728 +#: ../../reference/expressions.rst:1735 msgid "identity" msgstr "identity" -#: ../../reference/expressions.rst:1754 +#: ../../reference/expressions.rst:1761 msgid "Conditional" msgstr "Conditional(條件式)" -#: ../../reference/expressions.rst:1754 +#: ../../reference/expressions.rst:1761 msgid "Boolean" msgstr "Boolean(布林)" -#: ../../reference/expressions.rst:1770 +#: ../../reference/expressions.rst:1777 msgid "not" msgstr "not" -#: ../../reference/expressions.rst:1794 +#: ../../reference/expressions.rst:1801 msgid ":= (colon equals)" msgstr ":= (冒號等於)" -#: ../../reference/expressions.rst:1794 +#: ../../reference/expressions.rst:1801 msgid "assignment expression" msgstr "assignment expression(賦值運算式)" -#: ../../reference/expressions.rst:1794 +#: ../../reference/expressions.rst:1801 msgid "walrus operator" msgstr "walrus operator(海象運算子)" -#: ../../reference/expressions.rst:1794 +#: ../../reference/expressions.rst:1801 msgid "named expression" msgstr "named expression(附名運算式)" -#: ../../reference/expressions.rst:1842 +#: ../../reference/expressions.rst:1849 msgid "conditional" msgstr "conditional(條件式)" -#: ../../reference/expressions.rst:1842 +#: ../../reference/expressions.rst:1849 msgid "ternary" msgstr "ternary(三元)" -#: ../../reference/expressions.rst:1842 +#: ../../reference/expressions.rst:1849 msgid "conditional expression" msgstr "conditional expression(條件運算式)" -#: ../../reference/expressions.rst:1842 +#: ../../reference/expressions.rst:1849 msgid "else" msgstr "else" -#: ../../reference/expressions.rst:1868 +#: ../../reference/expressions.rst:1875 msgid "lambda" msgstr "lambda" -#: ../../reference/expressions.rst:1868 +#: ../../reference/expressions.rst:1875 msgid "form" msgstr "form" -#: ../../reference/expressions.rst:1868 +#: ../../reference/expressions.rst:1875 msgid "anonymous" msgstr "anonymous(匿名)" -#: ../../reference/expressions.rst:1868 +#: ../../reference/expressions.rst:1875 msgid "lambda expression" msgstr "lambda expression(lambda 運算式)" -#: ../../reference/expressions.rst:1913 +#: ../../reference/expressions.rst:1920 msgid "iterable" msgstr "iterable(可疊代)" -#: ../../reference/expressions.rst:1913 +#: ../../reference/expressions.rst:1920 msgid "in expression lists" msgstr "於 expression list(運算式串列)" -#: ../../reference/expressions.rst:1925 +#: ../../reference/expressions.rst:1932 msgid "trailing" msgstr "trailing" -#: ../../reference/expressions.rst:1940 +#: ../../reference/expressions.rst:1947 msgid "evaluation" msgstr "evaluation" -#: ../../reference/expressions.rst:1940 +#: ../../reference/expressions.rst:1947 msgid "order" msgstr "order(順序)" -#: ../../reference/expressions.rst:1961 +#: ../../reference/expressions.rst:1968 msgid "precedence" msgstr "precedence(優先順序)" diff --git a/reference/grammar.po b/reference/grammar.po index 1a40b9af23..14222d9038 100644 --- a/reference/grammar.po +++ b/reference/grammar.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -133,6 +133,9 @@ msgid "" "# Fail if e can be parsed, without consuming any input.\n" "# ~\n" "# Commit to the current alternative, even if it fails to parse.\n" +"# &&e\n" +"# Eager parse e. The parser will not backtrack and will immediately \n" +"# fail with SyntaxError if e cannot be parsed.\n" "#\n" "\n" "# STARTING RULES\n" @@ -189,11 +192,11 @@ msgid "" " | &'nonlocal' nonlocal_stmt\n" "\n" "compound_stmt[stmt_ty]:\n" -" | &('def' | '@' | ASYNC) function_def\n" +" | &('def' | '@' | 'async') function_def\n" " | &'if' if_stmt\n" " | &('class' | '@') class_def\n" -" | &('with' | ASYNC) with_stmt\n" -" | &('for' | ASYNC) for_stmt\n" +" | &('with' | 'async') with_stmt\n" +" | &('for' | 'async') for_stmt\n" " | &'try' try_stmt\n" " | &'while' while_stmt\n" " | match_stmt\n" @@ -351,14 +354,14 @@ msgid "" "\n" "function_def_raw[stmt_ty]:\n" " | invalid_def_raw\n" -" | 'def' n=NAME t=[type_params] &&'(' params=[params] ')' a=['->' " -"z=expression { z }] &&':' tc=[func_type_comment] b=block {\n" +" | 'def' n=NAME t=[type_params] '(' params=[params] ')' a=['->' " +"z=expression { z }] ':' tc=[func_type_comment] b=block {\n" " _PyAST_FunctionDef(n->v.Name.id,\n" " (params) ? params : CHECK(arguments_ty, " "_PyPegen_empty_arguments(p)),\n" " b, NULL, a, NEW_TYPE_COMMENT(p, tc), t, EXTRA) }\n" -" | ASYNC 'def' n=NAME t=[type_params] &&'(' params=[params] ')' a=['->' " -"z=expression { z }] &&':' tc=[func_type_comment] b=block {\n" +" | 'async' 'def' n=NAME t=[type_params] '(' params=[params] ')' a=['->' " +"z=expression { z }] ':' tc=[func_type_comment] b=block {\n" " CHECK_VERSION(\n" " stmt_ty,\n" " 5,\n" @@ -496,7 +499,7 @@ msgid "" " | 'for' t=star_targets 'in' ~ ex=star_expressions ':' tc=[TYPE_COMMENT] " "b=block el=[else_block] {\n" " _PyAST_For(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" -" | ASYNC 'for' t=star_targets 'in' ~ ex=star_expressions ':' " +" | 'async' 'for' t=star_targets 'in' ~ ex=star_expressions ':' " "tc=[TYPE_COMMENT] b=block el=[else_block] {\n" " CHECK_VERSION(stmt_ty, 5, \"Async for loops are\", " "_PyAST_AsyncFor(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA)) }\n" @@ -507,17 +510,17 @@ msgid "" "\n" "with_stmt[stmt_ty]:\n" " | invalid_with_stmt_indent\n" -" | 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' b=block " -"{\n" -" _PyAST_With(a, b, NULL, EXTRA) }\n" +" | 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' " +"tc=[TYPE_COMMENT] b=block {\n" +" _PyAST_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" " | 'with' a[asdl_withitem_seq*]=','.with_item+ ':' tc=[TYPE_COMMENT] " "b=block {\n" " _PyAST_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" -" | ASYNC 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' " +" | 'async' 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' " "b=block {\n" " CHECK_VERSION(stmt_ty, 5, \"Async with statements are\", " "_PyAST_AsyncWith(a, b, NULL, EXTRA)) }\n" -" | ASYNC 'with' a[asdl_withitem_seq*]=','.with_item+ ':' " +" | 'async' 'with' a[asdl_withitem_seq*]=','.with_item+ ':' " "tc=[TYPE_COMMENT] b=block {\n" " CHECK_VERSION(stmt_ty, 5, \"Async with statements are\", " "_PyAST_AsyncWith(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA)) }\n" @@ -777,7 +780,9 @@ msgid "" "# Type parameter declaration\n" "# --------------------------\n" "\n" -"type_params[asdl_type_param_seq*]: '[' t=type_param_seq ']' {\n" +"type_params[asdl_type_param_seq*]: \n" +" | invalid_type_params\n" +" | '[' t=type_param_seq ']' {\n" " CHECK_VERSION(asdl_type_param_seq *, 12, \"Type parameter lists " "are\", t) }\n" "\n" @@ -785,22 +790,28 @@ msgid "" "type_param+ [','] { a }\n" "\n" "type_param[type_param_ty] (memo):\n" -" | a=NAME b=[type_param_bound] { _PyAST_TypeVar(a->v.Name.id, b, " -"EXTRA) }\n" +" | a=NAME b=[type_param_bound] c=[type_param_default] { _PyAST_TypeVar(a-" +">v.Name.id, b, c, EXTRA) }\n" " | '*' a=NAME colon=':' e=expression {\n" " RAISE_SYNTAX_ERROR_STARTING_FROM(colon, e->kind == Tuple_kind\n" " ? \"cannot use constraints with TypeVarTuple\"\n" " : \"cannot use bound with TypeVarTuple\")\n" " }\n" -" | '*' a=NAME { _PyAST_TypeVarTuple(a->v.Name.id, EXTRA) }\n" +" | '*' a=NAME b=[type_param_starred_default] { _PyAST_TypeVarTuple(a->v." +"Name.id, b, EXTRA) }\n" " | '**' a=NAME colon=':' e=expression {\n" " RAISE_SYNTAX_ERROR_STARTING_FROM(colon, e->kind == Tuple_kind\n" " ? \"cannot use constraints with ParamSpec\"\n" " : \"cannot use bound with ParamSpec\")\n" " }\n" -" | '**' a=NAME { _PyAST_ParamSpec(a->v.Name.id, EXTRA) }\n" +" | '**' a=NAME b=[type_param_default] { _PyAST_ParamSpec(a->v.Name.id, b, " +"EXTRA) }\n" "\n" "type_param_bound[expr_ty]: ':' e=expression { e }\n" +"type_param_default[expr_ty]: '=' e=expression {\n" +" CHECK_VERSION(expr_ty, 13, \"Type parameter defaults are\", e) }\n" +"type_param_starred_default[expr_ty]: '=' e=star_expression {\n" +" CHECK_VERSION(expr_ty, 13, \"Type parameter defaults are\", e) }\n" "\n" "# EXPRESSIONS\n" "# -----------\n" @@ -937,6 +948,7 @@ msgid "" "shift_expr[expr_ty]:\n" " | a=shift_expr '<<' b=sum { _PyAST_BinOp(a, LShift, b, EXTRA) }\n" " | a=shift_expr '>>' b=sum { _PyAST_BinOp(a, RShift, b, EXTRA) }\n" +" | invalid_arithmetic\n" " | sum\n" "\n" "# Arithmetic operators\n" @@ -954,6 +966,7 @@ msgid "" " | a=term '%' b=factor { _PyAST_BinOp(a, Mod, b, EXTRA) }\n" " | a=term '@' b=factor { CHECK_VERSION(expr_ty, 5, \"The '@' operator " "is\", _PyAST_BinOp(a, MatMult, b, EXTRA)) }\n" +" | invalid_factor\n" " | factor\n" "\n" "factor[expr_ty] (memo):\n" @@ -973,8 +986,8 @@ msgid "" "\"obj[something]\", \"obj(something)\", \"obj\" ...\n" "\n" "await_primary[expr_ty] (memo):\n" -" | AWAIT a=primary { CHECK_VERSION(expr_ty, 5, \"Await expressions are\", " -"_PyAST_Await(a, EXTRA)) }\n" +" | 'await' a=primary { CHECK_VERSION(expr_ty, 5, \"Await expressions " +"are\", _PyAST_Await(a, EXTRA)) }\n" " | primary\n" "\n" "primary[expr_ty]:\n" @@ -1095,9 +1108,8 @@ msgid "" " | fstring_replacement_field\n" " | t=FSTRING_MIDDLE { _PyPegen_constant_from_token(p, t) }\n" "fstring_replacement_field[expr_ty]:\n" -" | '{' a=(yield_expr | star_expressions) debug_expr='='? " -"conversion=[fstring_conversion] format=[fstring_full_format_spec] rbrace='}' " -"{\n" +" | '{' a=annotated_rhs debug_expr='='? conversion=[fstring_conversion] " +"format=[fstring_full_format_spec] rbrace='}' {\n" " _PyPegen_formatted_value(p, a, debug_expr, conversion, format, " "rbrace, EXTRA) }\n" " | invalid_replacement_field\n" @@ -1156,13 +1168,15 @@ msgid "" " | a[asdl_comprehension_seq*]=for_if_clause+ { a }\n" "\n" "for_if_clause[comprehension_ty]:\n" -" | ASYNC 'for' a=star_targets 'in' ~ b=disjunction " +" | 'async' 'for' a=star_targets 'in' ~ b=disjunction " "c[asdl_expr_seq*]=('if' z=disjunction { z })* {\n" " CHECK_VERSION(comprehension_ty, 6, \"Async comprehensions are\", " "_PyAST_comprehension(a, b, c, 1, p->arena)) }\n" " | 'for' a=star_targets 'in' ~ b=disjunction c[asdl_expr_seq*]=('if' " "z=disjunction { z })* {\n" " _PyAST_comprehension(a, b, c, 0, p->arena) }\n" +" | 'async'? 'for' (bitwise_or (',' bitwise_or)* [',']) !'in' {\n" +" RAISE_SYNTAX_ERROR(\"'in' expected after for-loop variables\") }\n" " | invalid_for_target\n" "\n" "listcomp[expr_ty]:\n" @@ -1454,7 +1468,7 @@ msgid "" " | (star_targets '=')* a=yield_expr '=' " "{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"assignment to yield expression not " "possible\") }\n" -" | a=star_expressions augassign (yield_expr | star_expressions) {\n" +" | a=star_expressions augassign annotated_rhs {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" " a,\n" " \"'%s' is an illegal expression for augmented assignment\",\n" @@ -1579,7 +1593,7 @@ msgid "" " RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }\n" "\n" "invalid_for_target:\n" -" | ASYNC? 'for' a=star_expressions {\n" +" | 'async'? 'for' a=star_expressions {\n" " RAISE_SYNTAX_ERROR_INVALID_TARGET(FOR_TARGETS, a) }\n" "\n" "invalid_group:\n" @@ -1593,23 +1607,29 @@ msgid "" " | a='import' ','.dotted_name+ 'from' dotted_name {\n" " RAISE_SYNTAX_ERROR_STARTING_FROM(a, \"Did you mean to use 'from ... " "import ...' instead?\") }\n" +" | 'import' token=NEWLINE { \n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(token, \"Expected one or more names " +"after 'import'\") }\n" "\n" "invalid_import_from_targets:\n" " | import_from_as_names ',' NEWLINE {\n" " RAISE_SYNTAX_ERROR(\"trailing comma not allowed without surrounding " "parentheses\") }\n" +" | token=NEWLINE { \n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(token, \"Expected one or more names " +"after 'import'\") }\n" "\n" "invalid_with_stmt:\n" -" | [ASYNC] 'with' ','.(expression ['as' star_target])+ NEWLINE " +" | ['async'] 'with' ','.(expression ['as' star_target])+ NEWLINE " "{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" -" | [ASYNC] 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' " +" | ['async'] 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' " "NEWLINE { RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" "invalid_with_stmt_indent:\n" -" | [ASYNC] a='with' ','.(expression ['as' star_target])+ ':' NEWLINE !" +" | ['async'] a='with' ','.(expression ['as' star_target])+ ':' NEWLINE !" "INDENT {\n" " RAISE_INDENTATION_ERROR(\"expected an indented block after 'with' " "statement on line %d\", a->lineno) }\n" -" | [ASYNC] a='with' '(' ','.(expressions ['as' star_target])+ ','? ')' " +" | ['async'] a='with' '(' ','.(expressions ['as' star_target])+ ','? ')' " "':' NEWLINE !INDENT {\n" " RAISE_INDENTATION_ERROR(\"expected an indented block after 'with' " "statement on line %d\", a->lineno) }\n" @@ -1700,17 +1720,19 @@ msgid "" " RAISE_INDENTATION_ERROR(\"expected an indented block after 'while' " "statement on line %d\", a->lineno) }\n" "invalid_for_stmt:\n" -" | [ASYNC] 'for' star_targets 'in' star_expressions NEWLINE " +" | ['async'] 'for' star_targets 'in' star_expressions NEWLINE " "{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" -" | [ASYNC] a='for' star_targets 'in' star_expressions ':' NEWLINE !INDENT " -"{\n" +" | ['async'] a='for' star_targets 'in' star_expressions ':' NEWLINE !" +"INDENT {\n" " RAISE_INDENTATION_ERROR(\"expected an indented block after 'for' " "statement on line %d\", a->lineno) }\n" "invalid_def_raw:\n" -" | [ASYNC] a='def' NAME [type_params] '(' [params] ')' ['->' expression] " -"':' NEWLINE !INDENT {\n" +" | ['async'] a='def' NAME [type_params] '(' [params] ')' ['->' " +"expression] ':' NEWLINE !INDENT {\n" " RAISE_INDENTATION_ERROR(\"expected an indented block after function " "definition on line %d\", a->lineno) }\n" +" | ['async'] 'def' NAME [type_params] &&'(' [params] ')' ['->' " +"expression] &&':' [func_type_comment] block\n" "invalid_class_def_raw:\n" " | 'class' NAME [type_params] ['(' [arguments] ')'] NEWLINE " "{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" @@ -1747,24 +1769,22 @@ msgid "" "expression required before ':'\") }\n" " | '{' a='}' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"f-string: valid " "expression required before '}'\") }\n" -" | '{' !(yield_expr | star_expressions) " -"{ RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: expecting a valid expression " -"after '{'\")}\n" -" | '{' (yield_expr | star_expressions) !('=' | '!' | ':' | '}') {\n" +" | '{' !annotated_rhs { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: " +"expecting a valid expression after '{'\")}\n" +" | '{' annotated_rhs !('=' | '!' | ':' | '}') {\n" " PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" "string: expecting '=', or '!', or ':', or '}'\") }\n" -" | '{' (yield_expr | star_expressions) '=' !('!' | ':' | '}') {\n" +" | '{' annotated_rhs '=' !('!' | ':' | '}') {\n" " PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" "string: expecting '!', or ':', or '}'\") }\n" -" | '{' (yield_expr | star_expressions) '='? invalid_conversion_character\n" -" | '{' (yield_expr | star_expressions) '='? ['!' NAME] !(':' | '}') {\n" +" | '{' annotated_rhs '='? invalid_conversion_character\n" +" | '{' annotated_rhs '='? ['!' NAME] !(':' | '}') {\n" " PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" "string: expecting ':' or '}'\") }\n" -" | '{' (yield_expr | star_expressions) '='? ['!' NAME] ':' " -"fstring_format_spec* !'}' {\n" +" | '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}' {\n" " PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" "string: expecting '}', or format specs\") }\n" -" | '{' (yield_expr | star_expressions) '='? ['!' NAME] !'}' {\n" +" | '{' annotated_rhs '='? ['!' NAME] !'}' {\n" " PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" "string: expecting '}'\") }\n" "\n" @@ -1773,4 +1793,18 @@ msgid "" "missing conversion character\") }\n" " | '!' !NAME { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: invalid " "conversion character\") }\n" +"\n" +"invalid_arithmetic:\n" +" | sum ('+'|'-'|'*'|'/'|'%'|'//'|'@') a='not' b=inversion " +"{ RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"'not' after an operator must be " +"parenthesized\") }\n" +"invalid_factor:\n" +" | ('+' | '-' | '~') a='not' b=factor { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"b, \"'not' after an operator must be parenthesized\") }\n" +"\n" +"invalid_type_params:\n" +" | '[' token=']' {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(\n" +" token, \n" +" \"Type parameter list cannot be empty\")}\n" msgstr "" diff --git a/reference/introduction.po b/reference/introduction.po index 65f31bc1f5..94633cbb7f 100644 --- a/reference/introduction.po +++ b/reference/introduction.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -137,8 +137,8 @@ msgid "" "support and a Just in Time compiler. One of the goals of the project is to " "encourage experimentation with the language itself by making it easier to " "modify the interpreter (since it is written in Python). Additional " -"information is available on `the PyPy project's home page <https://pypy.org/" -">`_." +"information is available on `the PyPy project's home page <https://www.pypy." +"org/>`_." msgstr "" #: ../../reference/introduction.rst:79 diff --git a/reference/lexical_analysis.po b/reference/lexical_analysis.po index 2a956d7cbb..00ed2f6f6f 100644 --- a/reference/lexical_analysis.po +++ b/reference/lexical_analysis.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -430,7 +430,7 @@ msgstr "" #: ../../reference/lexical_analysis.rst:316 msgid "" "*Other_ID_Start* - explicit list of characters in `PropList.txt <https://www." -"unicode.org/Public/15.0.0/ucd/PropList.txt>`_ to support backwards " +"unicode.org/Public/15.1.0/ucd/PropList.txt>`_ to support backwards " "compatibility" msgstr "" @@ -447,7 +447,7 @@ msgstr "" #: ../../reference/lexical_analysis.rst:324 msgid "" "A non-normative HTML file listing all valid identifier characters for " -"Unicode 15.0.0 can be found at https://www.unicode.org/Public/15.0.0/ucd/" +"Unicode 15.1.0 can be found at https://www.unicode.org/Public/15.1.0/ucd/" "DerivedCoreProperties.txt" msgstr "" @@ -1387,7 +1387,8 @@ msgid "Footnotes" msgstr "註解" #: ../../reference/lexical_analysis.rst:1047 -msgid "https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt" +#, fuzzy +msgid "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" msgstr "https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt" #: ../../reference/lexical_analysis.rst:8 diff --git a/sphinx.po b/sphinx.po index e5ef4f9b2f..2e0b49145c 100644 --- a/sphinx.po +++ b/sphinx.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-17 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-03-15 10:19+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -66,18 +66,38 @@ msgid "Packed as .tar.bz2" msgstr "打包成 .tar.bz2" #: ../../tools/templates/download.html:28 -msgid "PDF" -msgstr "" +msgid "PDF (US-Letter paper size)" +msgstr "PDF(美國信紙大小)" #: ../../tools/templates/download.html:29 msgid "" +"<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-letter.zip\">Download</a> " +"(ca. %(download_size)s MiB)" +msgstr "" +"<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-letter.zip\">下載</a> (ca. " +"%(download_size)s MiB)" + +#: ../../tools/templates/download.html:30 +msgid "" +"<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-letter.tar.bz2\">Download</" +"a> (ca. %(download_size)s MiB)" +msgstr "" +"<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-letter.tar.bz2\">下載</a> " +"(ca. %(download_size)s MiB)" + +#: ../../tools/templates/download.html:33 +msgid "PDF (A4 paper size)" +msgstr "PDF(A4 紙張大小)" + +#: ../../tools/templates/download.html:34 +msgid "" "<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-a4.zip\">Download</a> (ca. " "%(download_size)s MiB)" msgstr "" "<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-a4.zip\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:30 +#: ../../tools/templates/download.html:35 msgid "" "<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-a4.tar.bz2\">Download</a> " "(ca. %(download_size)s MiB)" @@ -85,11 +105,11 @@ msgstr "" "<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-a4.tar.bz2\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:33 +#: ../../tools/templates/download.html:38 msgid "HTML" msgstr "HTML" -#: ../../tools/templates/download.html:34 +#: ../../tools/templates/download.html:39 msgid "" "<a href=\"%(dlbase)s/python-%(release)s-docs-html.zip\">Download</a> (ca. " "%(download_size)s MiB)" @@ -97,7 +117,7 @@ msgstr "" "<a href=\"%(dlbase)s/python-%(release)s-docs-html.zip\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:35 +#: ../../tools/templates/download.html:40 msgid "" "<a href=\"%(dlbase)s/python-%(release)s-docs-html.tar.bz2\">Download</a> " "(ca. %(download_size)s MiB)" @@ -105,11 +125,11 @@ msgstr "" "<a href=\"%(dlbase)s/python-%(release)s-docs-html.tar.bz2\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:38 +#: ../../tools/templates/download.html:43 msgid "Plain text" msgstr "純文字" -#: ../../tools/templates/download.html:39 +#: ../../tools/templates/download.html:44 msgid "" "<a href=\"%(dlbase)s/python-%(release)s-docs-text.zip\">Download</a> (ca. " "%(download_size)s MiB)" @@ -117,7 +137,7 @@ msgstr "" "<a href=\"%(dlbase)s/python-%(release)s-docs-text.zip\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:40 +#: ../../tools/templates/download.html:45 msgid "" "<a href=\"%(dlbase)s/python-%(release)s-docs-text.tar.bz2\">Download</a> " "(ca. %(download_size)s MiB)" @@ -125,11 +145,11 @@ msgstr "" "<a href=\"%(dlbase)s/python-%(release)s-docs-text.tar.bz2\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:43 +#: ../../tools/templates/download.html:48 msgid "Texinfo" msgstr "Texinfo" -#: ../../tools/templates/download.html:44 +#: ../../tools/templates/download.html:49 msgid "" "<a href=\"%(dlbase)s/python-%(release)s-docs-texinfo.zip\">Download</a> (ca. " "%(download_size)s MiB)" @@ -137,7 +157,7 @@ msgstr "" "<a href=\"%(dlbase)s/python-%(release)s-docs-texinfo.zip\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:45 +#: ../../tools/templates/download.html:50 msgid "" "<a href=\"%(dlbase)s/python-%(release)s-docs-texinfo.tar.bz2\">Download</a> " "(ca. %(download_size)s MiB)" @@ -145,11 +165,11 @@ msgstr "" "<a href=\"%(dlbase)s/python-%(release)s-docs-texinfo.tar.bz2\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:48 +#: ../../tools/templates/download.html:53 msgid "EPUB" msgstr "EPUB" -#: ../../tools/templates/download.html:49 +#: ../../tools/templates/download.html:54 msgid "" "<a href=\"%(dlbase)s/python-%(release)s-docs.epub\">Download</a> (ca. " "%(download_size)s MiB)" @@ -157,15 +177,15 @@ msgstr "" "<a href=\"%(dlbase)s/python-%(release)s-docs.epub\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:54 +#: ../../tools/templates/download.html:59 msgid "These archives contain all the content in the documentation." msgstr "這些歸檔包含了說明文件中的所有內容。" -#: ../../tools/templates/download.html:57 +#: ../../tools/templates/download.html:62 msgid "Unpacking" msgstr "解壓縮" -#: ../../tools/templates/download.html:59 +#: ../../tools/templates/download.html:64 msgid "" "Unix users should download the .tar.bz2 archives; these are bzipped tar\n" "archives and can be handled in the usual way using tar and the bzip2\n" @@ -180,7 +200,7 @@ msgstr "" "net\">Info-ZIP</a> 解壓縮程式來處理 ZIP 歸檔。.tar.bz2 歸檔提供最佳壓縮率和最" "快的下載時間。" -#: ../../tools/templates/download.html:65 +#: ../../tools/templates/download.html:70 msgid "" "Windows users can use the ZIP archives since those are customary on that\n" "platform. These are created on Unix using the Info-ZIP zip program." @@ -188,11 +208,11 @@ msgstr "" "Windows 使用者可以使用 ZIP 歸檔,因為這在該平台上是常見的。這些是在 Unix 上使" "用 Info-ZIP zip 程式建立的。" -#: ../../tools/templates/download.html:69 +#: ../../tools/templates/download.html:74 msgid "Problems" msgstr "問題" -#: ../../tools/templates/download.html:71 +#: ../../tools/templates/download.html:76 msgid "" "If you have comments or suggestions for the Python documentation, please " "send\n" @@ -532,23 +552,3 @@ msgstr "" #: ../../tools/templates/layout.html:16 msgid "the current stable release" msgstr "當前的穩定發行版" - -#~ msgid "PDF (US-Letter paper size)" -#~ msgstr "PDF(美國信紙大小)" - -#~ msgid "" -#~ "<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-letter.zip\">Download</" -#~ "a> (ca. %(download_size)s MiB)" -#~ msgstr "" -#~ "<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-letter.zip\">下載</a> " -#~ "(ca. %(download_size)s MiB)" - -#~ msgid "" -#~ "<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-letter.tar." -#~ "bz2\">Download</a> (ca. %(download_size)s MiB)" -#~ msgstr "" -#~ "<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-letter.tar.bz2\">下載</" -#~ "a> (ca. %(download_size)s MiB)" - -#~ msgid "PDF (A4 paper size)" -#~ msgstr "PDF(A4 紙張大小)" diff --git a/tutorial/appendix.po b/tutorial/appendix.po index 8d7a25481d..703dc079b8 100644 --- a/tutorial/appendix.po +++ b/tutorial/appendix.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-07-05 14:35+0800\n" "Last-Translator: meowmeowcat <meowmeowcat1211@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,11 +28,43 @@ msgstr "附錄" msgid "Interactive Mode" msgstr "互動模式" -#: ../../tutorial/appendix.rst:16 +#: ../../tutorial/appendix.rst:13 +msgid "" +"There are two variants of the interactive :term:`REPL`. The classic basic " +"interpreter is supported on all platforms with minimal line control " +"capabilities." +msgstr "" + +#: ../../tutorial/appendix.rst:17 +msgid "" +"On Windows, or Unix-like systems with :mod:`curses` support, a new " +"interactive shell is used by default. This one supports color, multiline " +"editing, history browsing, and paste mode. To disable color, see :ref:" +"`using-on-controlling-color` for details. Function keys provide some " +"additional functionality. :kbd:`F1` enters the interactive help browser :mod:" +"`pydoc`. :kbd:`F2` allows for browsing command-line history without output " +"nor the :term:`>>>` and :term:`...` prompts. :kbd:`F3` enters \"paste " +"mode\", which makes pasting larger blocks of code easier. Press :kbd:`F3` to " +"return to the regular prompt." +msgstr "" + +#: ../../tutorial/appendix.rst:28 +msgid "" +"When using the new interactive shell, exit the shell by typing :kbd:`exit` " +"or :kbd:`quit`. Adding call parentheses after those commands is not required." +msgstr "" + +#: ../../tutorial/appendix.rst:32 +msgid "" +"If the new interactive shell is not desired, it can be disabled via the :" +"envvar:`PYTHON_BASIC_REPL` environment variable." +msgstr "" + +#: ../../tutorial/appendix.rst:38 msgid "Error Handling" msgstr "錯誤處理" -#: ../../tutorial/appendix.rst:18 +#: ../../tutorial/appendix.rst:40 msgid "" "When an error occurs, the interpreter prints an error message and a stack " "trace. In interactive mode, it then returns to the primary prompt; when " @@ -51,7 +83,7 @@ msgstr "" "內部不一致和一些記憶體耗盡的情況。所有的錯誤訊息都被寫入標準錯誤輸出;被執行" "指令的正常輸出被寫入標準輸出。" -#: ../../tutorial/appendix.rst:28 +#: ../../tutorial/appendix.rst:50 msgid "" "Typing the interrupt character (usually :kbd:`Control-C` or :kbd:`Delete`) " "to the primary or secondary prompt cancels the input and returns to the " @@ -64,11 +96,11 @@ msgstr "" "會引發 :exc:`KeyboardInterrupt` 例外,但可以通過 :keyword:`try` 陳述式來處" "理。" -#: ../../tutorial/appendix.rst:38 +#: ../../tutorial/appendix.rst:60 msgid "Executable Python Scripts" msgstr "可執行的 Python 腳本" -#: ../../tutorial/appendix.rst:40 +#: ../../tutorial/appendix.rst:62 msgid "" "On BSD'ish Unix systems, Python scripts can be made directly executable, " "like shell scripts, by putting the line ::" @@ -76,11 +108,11 @@ msgstr "" "在類 BSD 的 Unix 系統上,Python 腳本可以直接執行,就像 shell 腳本一樣,通過放" "置以下這行: ::" -#: ../../tutorial/appendix.rst:43 +#: ../../tutorial/appendix.rst:65 msgid "#!/usr/bin/env python3" msgstr "#!/usr/bin/env python3" -#: ../../tutorial/appendix.rst:45 +#: ../../tutorial/appendix.rst:67 msgid "" "(assuming that the interpreter is on the user's :envvar:`PATH`) at the " "beginning of the script and giving the file an executable mode. The ``#!`` " @@ -94,17 +126,17 @@ msgstr "" "(``'\\n'``) 結尾,而不是 Windows (``'\\r\\n'``) 換行。 請注意,井號 ``'#'`` " "用於在 Python 中開始註解。" -#: ../../tutorial/appendix.rst:52 +#: ../../tutorial/appendix.rst:74 msgid "" "The script can be given an executable mode, or permission, using the :" "program:`chmod` command." msgstr "可以使用 :program:`chmod` 指令為腳本賦予可執行模式或權限。" -#: ../../tutorial/appendix.rst:55 +#: ../../tutorial/appendix.rst:77 msgid "$ chmod +x myscript.py" msgstr "$ chmod +x myscript.py" -#: ../../tutorial/appendix.rst:59 +#: ../../tutorial/appendix.rst:81 msgid "" "On Windows systems, there is no notion of an \"executable mode\". The " "Python installer automatically associates ``.py`` files with ``python.exe`` " @@ -116,11 +148,11 @@ msgstr "" "py`` 檔案與 ``python.exe`` 聯繫起來,這樣雙擊 Python 檔案就會作為腳本運行。副" "檔名也可以是 ``.pyw``,在這種情況下,通常會出現的控制台視窗會被隱藏。" -#: ../../tutorial/appendix.rst:69 +#: ../../tutorial/appendix.rst:91 msgid "The Interactive Startup File" msgstr "互動式啟動檔案" -#: ../../tutorial/appendix.rst:71 +#: ../../tutorial/appendix.rst:93 msgid "" "When you use Python interactively, it is frequently handy to have some " "standard commands executed every time the interpreter is started. You can " @@ -132,7 +164,7 @@ msgstr "" "可以通過設置一個名為 :envvar:`PYTHONSTARTUP` 的環境變數來實現,該變數是一個包" "含啟動指令的檔案名。它的功能類似 Unix shell 的 :file:`.profile` 。" -#: ../../tutorial/appendix.rst:77 +#: ../../tutorial/appendix.rst:99 msgid "" "This file is only read in interactive sessions, not when Python reads " "commands from a script, and not when :file:`/dev/tty` is given as the " @@ -148,7 +180,7 @@ msgstr "" "動模式中不加限定地使用。你也可以在這個檔案中改變 ``sys.ps1`` 和 ``sys.ps2`` " "等提示字元。" -#: ../../tutorial/appendix.rst:85 +#: ../../tutorial/appendix.rst:107 msgid "" "If you want to read an additional start-up file from the current directory, " "you can program this in the global start-up file using code like ``if os." @@ -161,7 +193,7 @@ msgstr "" "式碼設定這個行為。如果你想在一個腳本中使用啟動檔案,你必須在腳本中明確地這樣" "做: ::" -#: ../../tutorial/appendix.rst:91 +#: ../../tutorial/appendix.rst:113 msgid "" "import os\n" "filename = os.environ.get('PYTHONSTARTUP')\n" @@ -177,11 +209,11 @@ msgstr "" " startup_file = fobj.read()\n" " exec(startup_file)" -#: ../../tutorial/appendix.rst:102 +#: ../../tutorial/appendix.rst:124 msgid "The Customization Modules" msgstr "客製化模組" -#: ../../tutorial/appendix.rst:104 +#: ../../tutorial/appendix.rst:126 msgid "" "Python provides two hooks to let you customize it: :index:`sitecustomize` " "and :index:`usercustomize`. To see how it works, you need first to find the " @@ -192,7 +224,7 @@ msgstr "" "index:`usercustomize` 。要看它是如何運作的,你首先需要找到你的 site-packages " "的位置。啟動 Python 並運行這段程式碼: ::" -#: ../../tutorial/appendix.rst:108 +#: ../../tutorial/appendix.rst:130 msgid "" ">>> import site\n" ">>> site.getusersitepackages()\n" @@ -202,7 +234,7 @@ msgstr "" ">>> site.getusersitepackages()\n" "'/home/user/.local/lib/python3.x/site-packages'" -#: ../../tutorial/appendix.rst:112 +#: ../../tutorial/appendix.rst:134 msgid "" "Now you can create a file named :file:`usercustomize.py` in that directory " "and put anything you want in it. It will affect every invocation of Python, " @@ -213,7 +245,7 @@ msgstr "" "要的任何內容放入其中。它會影響 Python 的每次呼叫,除非它以 :option:`-s` 選項" "啟動以禁用自動 import 。" -#: ../../tutorial/appendix.rst:116 +#: ../../tutorial/appendix.rst:138 msgid "" ":index:`sitecustomize` works in the same way, but is typically created by an " "administrator of the computer in the global site-packages directory, and is " @@ -224,10 +256,10 @@ msgstr "" "packages 目錄下建立,並在 :index:`usercustomize` 之前 import 。更多細節請參" "閱 :mod:`site` 模組的文件。" -#: ../../tutorial/appendix.rst:123 +#: ../../tutorial/appendix.rst:145 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/appendix.rst:124 +#: ../../tutorial/appendix.rst:146 msgid "A problem with the GNU Readline package may prevent this." msgstr "GNU Readline 套件的一個問題可能會阻止這一點。" diff --git a/tutorial/interpreter.po b/tutorial/interpreter.po index 55b6dc2444..24379ff4c5 100644 --- a/tutorial/interpreter.po +++ b/tutorial/interpreter.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-05-18 16:28+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,17 +29,19 @@ msgid "Invoking the Interpreter" msgstr "啟動直譯器" #: ../../tutorial/interpreter.rst:13 +#, fuzzy msgid "" -"The Python interpreter is usually installed as :file:`/usr/local/bin/" -"python3.12` on those machines where it is available; putting :file:`/usr/" -"local/bin` in your Unix shell's search path makes it possible to start it by " -"typing the command:" +"The Python interpreter is usually installed as |" +"usr_local_bin_python_x_dot_y_literal| on those machines where it is " +"available; putting :file:`/usr/local/bin` in your Unix shell's search path " +"makes it possible to start it by typing the command:" msgstr "" "Python 直譯器一般安裝在 :file:`/usr/local/bin/python3.12` 路徑下;將 :file:`/" "usr/local/bin` 加入Unix shell 的搜索路徑,輸入以下指令就可以啟動 Python:" #: ../../tutorial/interpreter.rst:17 -msgid "python3.12" +#, fuzzy +msgid "python3.13" msgstr "python3.12" #: ../../tutorial/interpreter.rst:21 @@ -54,12 +56,13 @@ msgstr "" "python` 是個很常見的另類存放路徑。)" #: ../../tutorial/interpreter.rst:26 +#, fuzzy msgid "" "On Windows machines where you have installed Python from the :ref:`Microsoft " -"Store <windows-store>`, the :file:`python3.12` command will be available. If " -"you have the :ref:`py.exe launcher <launcher>` installed, you can use the :" -"file:`py` command. See :ref:`setting-envvars` for other ways to launch " -"Python." +"Store <windows-store>`, the |python_x_dot_y_literal| command will be " +"available. If you have the :ref:`py.exe launcher <launcher>` installed, you " +"can use the :file:`py` command. See :ref:`setting-envvars` for other ways to " +"launch Python." msgstr "" "Windows 系統中,從 :ref:`Microsoft Store <windows-store>` 安裝 Python 後,就" "可以使用 :file:`python3.12` 命令了。如果安裝了 :ref:`py.exe launcher " @@ -189,9 +192,10 @@ msgstr "" "符: ::" #: ../../tutorial/interpreter.rst:98 +#, fuzzy msgid "" -"$ python3.12\n" -"Python 3.12 (default, April 4 2022, 09:25:04)\n" +"$ python3.13\n" +"Python 3.13 (default, April 4 2023, 09:25:04)\n" "[GCC 10.2.0] on linux\n" "Type \"help\", \"copyright\", \"credits\" or \"license\" for more " "information.\n" diff --git a/tutorial/stdlib.po b/tutorial/stdlib.po index c02c7c82b5..ed03a48a61 100644 --- a/tutorial/stdlib.po +++ b/tutorial/stdlib.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-01-31 18:14+0800\n" "Last-Translator: Phil Lin <linooohon@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -44,7 +44,7 @@ msgstr ":mod:`os` 模組提供了數十個與作業系統溝通的函式: ::" msgid "" ">>> import os\n" ">>> os.getcwd() # Return the current working directory\n" -"'C:\\\\Python312'\n" +"'C:\\\\Python313'\n" ">>> os.chdir('/server/accesslogs') # Change current working directory\n" ">>> os.system('mkdir today') # Run the command mkdir in the system shell\n" "0" @@ -298,7 +298,7 @@ msgid "" "'apple'\n" ">>> random.sample(range(100), 10) # sampling without replacement\n" "[30, 83, 16, 4, 8, 81, 41, 50, 18, 33]\n" -">>> random.random() # random float\n" +">>> random.random() # random float from the interval [0.0, 1.0)\n" "0.17970987693706186\n" ">>> random.randrange(6) # random integer chosen from range(6)\n" "4" diff --git a/tutorial/stdlib2.po b/tutorial/stdlib2.po index d766cd5038..1b2f36d17e 100644 --- a/tutorial/stdlib2.po +++ b/tutorial/stdlib2.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-06-19 14:24+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -537,7 +537,7 @@ msgid "" "Traceback (most recent call last):\n" " File \"<stdin>\", line 1, in <module>\n" " d['primary'] # entry was automatically removed\n" -" File \"C:/python312/lib/weakref.py\", line 46, in __getitem__\n" +" File \"C:/python313/lib/weakref.py\", line 46, in __getitem__\n" " o = self.data[key]()\n" "KeyError: 'primary'" msgstr "" diff --git a/using/cmdline.po b/using/cmdline.po index 2c892a596a..fdee4c513d 100644 --- a/using/cmdline.po +++ b/using/cmdline.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -73,40 +73,40 @@ msgid "" "When called with standard input connected to a tty device, it prompts for " "commands and executes them until an EOF (an end-of-file character, you can " "produce that with :kbd:`Ctrl-D` on UNIX or :kbd:`Ctrl-Z, Enter` on Windows) " -"is read." +"is read. For more on interactive mode, see :ref:`tut-interac`." msgstr "" -#: ../../using/cmdline.rst:45 +#: ../../using/cmdline.rst:46 msgid "" "When called with a file name argument or with a file as standard input, it " "reads and executes a script from that file." msgstr "" -#: ../../using/cmdline.rst:47 +#: ../../using/cmdline.rst:48 msgid "" "When called with a directory name argument, it reads and executes an " "appropriately named script from that directory." msgstr "" -#: ../../using/cmdline.rst:49 +#: ../../using/cmdline.rst:50 msgid "" "When called with ``-c command``, it executes the Python statement(s) given " "as *command*. Here *command* may contain multiple statements separated by " "newlines. Leading whitespace is significant in Python statements!" msgstr "" -#: ../../using/cmdline.rst:52 +#: ../../using/cmdline.rst:53 msgid "" "When called with ``-m module-name``, the given module is located on the " "Python module path and executed as a script." msgstr "" -#: ../../using/cmdline.rst:55 +#: ../../using/cmdline.rst:56 msgid "" "In non-interactive mode, the entire input is parsed before it is executed." msgstr "" -#: ../../using/cmdline.rst:57 +#: ../../using/cmdline.rst:58 msgid "" "An interface option terminates the list of options consumed by the " "interpreter, all consecutive arguments will end up in :data:`sys.argv` -- " @@ -114,14 +114,14 @@ msgid "" "reflecting the program's source." msgstr "" -#: ../../using/cmdline.rst:64 +#: ../../using/cmdline.rst:65 msgid "" "Execute the Python code in *command*. *command* can be one or more " "statements separated by newlines, with significant leading whitespace as in " "normal module code." msgstr "" -#: ../../using/cmdline.rst:68 +#: ../../using/cmdline.rst:69 msgid "" "If this option is given, the first element of :data:`sys.argv` will be ``\"-" "c\"`` and the current directory will be added to the start of :data:`sys." @@ -129,7 +129,7 @@ msgid "" "modules)." msgstr "" -#: ../../using/cmdline.rst:73 +#: ../../using/cmdline.rst:74 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_command`` with " "argument ``command``." @@ -137,13 +137,13 @@ msgstr "" "引發一個附帶引數 ``command`` 的\\ :ref:`稽核事件 <auditing>` ``cpython." "run_command``。" -#: ../../using/cmdline.rst:77 +#: ../../using/cmdline.rst:78 msgid "" "Search :data:`sys.path` for the named module and execute its contents as " "the :mod:`__main__` module." msgstr "" -#: ../../using/cmdline.rst:80 +#: ../../using/cmdline.rst:81 msgid "" "Since the argument is a *module* name, you must not give a file extension " "(``.py``). The module name should be a valid absolute Python module name, " @@ -151,7 +151,7 @@ msgid "" "use a name that includes a hyphen)." msgstr "" -#: ../../using/cmdline.rst:85 +#: ../../using/cmdline.rst:86 msgid "" "Package names (including namespace packages) are also permitted. When a " "package name is supplied instead of a normal module, the interpreter will " @@ -160,7 +160,7 @@ msgid "" "passed to the interpreter as the script argument." msgstr "" -#: ../../using/cmdline.rst:94 +#: ../../using/cmdline.rst:95 msgid "" "This option cannot be used with built-in modules and extension modules " "written in C, since they do not have Python module files. However, it can " @@ -168,7 +168,7 @@ msgid "" "not available." msgstr "" -#: ../../using/cmdline.rst:99 +#: ../../using/cmdline.rst:100 msgid "" "If this option is given, the first element of :data:`sys.argv` will be the " "full path to the module file (while the module file is being located, the " @@ -176,26 +176,26 @@ msgid "" "the current directory will be added to the start of :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:104 +#: ../../using/cmdline.rst:105 msgid "" ":option:`-I` option can be used to run the script in isolated mode where :" "data:`sys.path` contains neither the current directory nor the user's site-" "packages directory. All ``PYTHON*`` environment variables are ignored, too." msgstr "" -#: ../../using/cmdline.rst:109 +#: ../../using/cmdline.rst:110 msgid "" "Many standard library modules contain code that is invoked on their " "execution as a script. An example is the :mod:`timeit` module::" msgstr "" -#: ../../using/cmdline.rst:112 +#: ../../using/cmdline.rst:113 msgid "" "python -m timeit -s \"setup here\" \"benchmarked code here\"\n" "python -m timeit -h # for details" msgstr "" -#: ../../using/cmdline.rst:115 +#: ../../using/cmdline.rst:116 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_module`` with " "argument ``module-name``." @@ -203,47 +203,47 @@ msgstr "" "引發一個附帶引數 ``module-name`` 的\\ :ref:`稽核事件 <auditing>` ``cpython." "run_module``。" -#: ../../using/cmdline.rst:118 +#: ../../using/cmdline.rst:119 msgid ":func:`runpy.run_module`" msgstr ":func:`runpy.run_module`" -#: ../../using/cmdline.rst:119 ../../using/cmdline.rst:171 +#: ../../using/cmdline.rst:120 ../../using/cmdline.rst:172 msgid "Equivalent functionality directly available to Python code" msgstr "" -#: ../../using/cmdline.rst:121 +#: ../../using/cmdline.rst:122 msgid ":pep:`338` -- Executing modules as scripts" msgstr "" -#: ../../using/cmdline.rst:123 +#: ../../using/cmdline.rst:124 msgid "Supply the package name to run a ``__main__`` submodule." msgstr "" -#: ../../using/cmdline.rst:126 +#: ../../using/cmdline.rst:127 msgid "namespace packages are also supported" msgstr "" -#: ../../using/cmdline.rst:133 +#: ../../using/cmdline.rst:134 msgid "" "Read commands from standard input (:data:`sys.stdin`). If standard input is " "a terminal, :option:`-i` is implied." msgstr "" -#: ../../using/cmdline.rst:136 +#: ../../using/cmdline.rst:137 msgid "" "If this option is given, the first element of :data:`sys.argv` will be ``\"-" "\"`` and the current directory will be added to the start of :data:`sys." "path`." msgstr "" -#: ../../using/cmdline.rst:140 ../../using/cmdline.rst:723 +#: ../../using/cmdline.rst:141 ../../using/cmdline.rst:790 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_stdin`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 <auditing>` ``cpython.run_stdin``。" -#: ../../using/cmdline.rst:146 +#: ../../using/cmdline.rst:147 msgid "" "Execute the Python code contained in *script*, which must be a filesystem " "path (absolute or relative) referring to either a Python file, a directory " @@ -251,34 +251,34 @@ msgid "" "file." msgstr "" -#: ../../using/cmdline.rst:151 +#: ../../using/cmdline.rst:152 msgid "" "If this option is given, the first element of :data:`sys.argv` will be the " "script name as given on the command line." msgstr "" -#: ../../using/cmdline.rst:154 +#: ../../using/cmdline.rst:155 msgid "" "If the script name refers directly to a Python file, the directory " "containing that file is added to the start of :data:`sys.path`, and the file " "is executed as the :mod:`__main__` module." msgstr "" -#: ../../using/cmdline.rst:158 +#: ../../using/cmdline.rst:159 msgid "" "If the script name refers to a directory or zipfile, the script name is " "added to the start of :data:`sys.path` and the ``__main__.py`` file in that " "location is executed as the :mod:`__main__` module." msgstr "" -#: ../../using/cmdline.rst:162 +#: ../../using/cmdline.rst:163 msgid "" ":option:`-I` option can be used to run the script in isolated mode where :" "data:`sys.path` contains neither the script's directory nor the user's site-" "packages directory. All ``PYTHON*`` environment variables are ignored, too." msgstr "" -#: ../../using/cmdline.rst:167 +#: ../../using/cmdline.rst:168 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_file`` with " "argument ``filename``." @@ -286,11 +286,11 @@ msgstr "" "引發一個附帶引數 ``filename`` 的\\ :ref:`稽核事件 <auditing>` ``cpython." "run_file``。" -#: ../../using/cmdline.rst:170 +#: ../../using/cmdline.rst:171 msgid ":func:`runpy.run_path`" msgstr ":func:`runpy.run_path`" -#: ../../using/cmdline.rst:174 +#: ../../using/cmdline.rst:175 msgid "" "If no interface option is given, :option:`-i` is implied, ``sys.argv[0]`` is " "an empty string (``\"\"``) and the current directory will be added to the " @@ -299,51 +299,51 @@ msgid "" "config`)." msgstr "" -#: ../../using/cmdline.rst:180 +#: ../../using/cmdline.rst:181 msgid ":ref:`tut-invoking`" msgstr ":ref:`tut-invoking`" -#: ../../using/cmdline.rst:182 +#: ../../using/cmdline.rst:183 msgid "Automatic enabling of tab-completion and history editing." msgstr "" -#: ../../using/cmdline.rst:189 +#: ../../using/cmdline.rst:190 msgid "Generic options" msgstr "" -#: ../../using/cmdline.rst:195 +#: ../../using/cmdline.rst:196 msgid "" "Print a short description of all command line options and corresponding " "environment variables and exit." msgstr "" -#: ../../using/cmdline.rst:200 +#: ../../using/cmdline.rst:201 msgid "" "Print a short description of Python-specific environment variables and exit." msgstr "" -#: ../../using/cmdline.rst:207 +#: ../../using/cmdline.rst:208 msgid "" "Print a description of implementation-specific :option:`-X` options and exit." msgstr "" -#: ../../using/cmdline.rst:214 +#: ../../using/cmdline.rst:215 msgid "Print complete usage information and exit." msgstr "印出完整使用資訊並離開。" -#: ../../using/cmdline.rst:221 +#: ../../using/cmdline.rst:222 msgid "Print the Python version number and exit. Example output could be:" msgstr "" -#: ../../using/cmdline.rst:223 +#: ../../using/cmdline.rst:224 msgid "Python 3.8.0b2+" msgstr "Python 3.8.0b2+" -#: ../../using/cmdline.rst:227 +#: ../../using/cmdline.rst:228 msgid "When given twice, print more information about the build, like:" msgstr "" -#: ../../using/cmdline.rst:229 +#: ../../using/cmdline.rst:230 msgid "" "Python 3.8.0b2+ (3.8:0c076caaa8, Apr 20 2019, 21:55:00)\n" "[GCC 6.2.0 20161005]" @@ -351,15 +351,15 @@ msgstr "" "Python 3.8.0b2+ (3.8:0c076caaa8, Apr 20 2019, 21:55:00)\n" "[GCC 6.2.0 20161005]" -#: ../../using/cmdline.rst:234 +#: ../../using/cmdline.rst:235 msgid "The ``-VV`` option." msgstr "``-VV`` 選項" -#: ../../using/cmdline.rst:241 +#: ../../using/cmdline.rst:242 msgid "Miscellaneous options" msgstr "" -#: ../../using/cmdline.rst:245 +#: ../../using/cmdline.rst:246 msgid "" "Issue a warning when converting :class:`bytes` or :class:`bytearray` to :" "class:`str` without specifying encoding or comparing :class:`!bytes` or :" @@ -367,17 +367,17 @@ msgid "" "Issue an error when the option is given twice (:option:`!-bb`)." msgstr "" -#: ../../using/cmdline.rst:250 +#: ../../using/cmdline.rst:251 msgid "Affects also comparisons of :class:`bytes` with :class:`int`." msgstr "" -#: ../../using/cmdline.rst:255 +#: ../../using/cmdline.rst:256 msgid "" "If given, Python won't try to write ``.pyc`` files on the import of source " "modules. See also :envvar:`PYTHONDONTWRITEBYTECODE`." msgstr "" -#: ../../using/cmdline.rst:261 +#: ../../using/cmdline.rst:262 msgid "" "Control the validation behavior of hash-based ``.pyc`` files. See :ref:`pyc-" "invalidation`. When set to ``default``, checked and unchecked hash-based " @@ -388,35 +388,35 @@ msgid "" "corresponding source files." msgstr "" -#: ../../using/cmdline.rst:269 +#: ../../using/cmdline.rst:270 msgid "" "The semantics of timestamp-based ``.pyc`` files are unaffected by this " "option." msgstr "" -#: ../../using/cmdline.rst:275 +#: ../../using/cmdline.rst:276 msgid "" "Turn on parser debugging output (for expert only). See also the :envvar:" "`PYTHONDEBUG` environment variable." msgstr "" -#: ../../using/cmdline.rst:278 +#: ../../using/cmdline.rst:279 msgid "" "This option requires a :ref:`debug build of Python <debug-build>`, otherwise " "it's ignored." msgstr "" -#: ../../using/cmdline.rst:284 +#: ../../using/cmdline.rst:285 msgid "" "Ignore all ``PYTHON*`` environment variables, e.g. :envvar:`PYTHONPATH` and :" "envvar:`PYTHONHOME`, that might be set." msgstr "" -#: ../../using/cmdline.rst:287 +#: ../../using/cmdline.rst:288 msgid "See also the :option:`-P` and :option:`-I` (isolated) options." msgstr "另請參閱 :option:`-P` 和 :option:`-I` (isolated) 選項。" -#: ../../using/cmdline.rst:292 +#: ../../using/cmdline.rst:293 msgid "" "When a script is passed as first argument or the :option:`-c` option is " "used, enter interactive mode after executing the script or the command, even " @@ -424,19 +424,19 @@ msgid "" "`PYTHONSTARTUP` file is not read." msgstr "" -#: ../../using/cmdline.rst:297 +#: ../../using/cmdline.rst:298 msgid "" "This can be useful to inspect global variables or a stack trace when a " "script raises an exception. See also :envvar:`PYTHONINSPECT`." msgstr "" -#: ../../using/cmdline.rst:303 +#: ../../using/cmdline.rst:304 msgid "" "Run Python in isolated mode. This also implies :option:`-E`, :option:`-P` " "and :option:`-s` options." msgstr "" -#: ../../using/cmdline.rst:306 +#: ../../using/cmdline.rst:307 msgid "" "In isolated mode :data:`sys.path` contains neither the script's directory " "nor the user's site-packages directory. All ``PYTHON*`` environment " @@ -444,7 +444,7 @@ msgid "" "the user from injecting malicious code." msgstr "" -#: ../../using/cmdline.rst:316 +#: ../../using/cmdline.rst:317 msgid "" "Remove assert statements and any code conditional on the value of :const:" "`__debug__`. Augment the filename for compiled (:term:`bytecode`) files by " @@ -452,58 +452,58 @@ msgid "" "envvar:`PYTHONOPTIMIZE`." msgstr "" -#: ../../using/cmdline.rst:321 ../../using/cmdline.rst:331 +#: ../../using/cmdline.rst:322 ../../using/cmdline.rst:332 msgid "Modify ``.pyc`` filenames according to :pep:`488`." msgstr "根據 :pep:`488` 修改 ``.pyc`` 檔案名稱。" -#: ../../using/cmdline.rst:327 +#: ../../using/cmdline.rst:328 msgid "" "Do :option:`-O` and also discard docstrings. Augment the filename for " "compiled (:term:`bytecode`) files by adding ``.opt-2`` before the ``.pyc`` " "extension (see :pep:`488`)." msgstr "" -#: ../../using/cmdline.rst:337 +#: ../../using/cmdline.rst:338 msgid "Don't prepend a potentially unsafe path to :data:`sys.path`:" msgstr "" -#: ../../using/cmdline.rst:339 +#: ../../using/cmdline.rst:340 msgid "" "``python -m module`` command line: Don't prepend the current working " "directory." msgstr "" -#: ../../using/cmdline.rst:341 +#: ../../using/cmdline.rst:342 msgid "" "``python script.py`` command line: Don't prepend the script's directory. If " "it's a symbolic link, resolve symbolic links." msgstr "" -#: ../../using/cmdline.rst:343 +#: ../../using/cmdline.rst:344 msgid "" "``python -c code`` and ``python`` (REPL) command lines: Don't prepend an " "empty string, which means the current working directory." msgstr "" -#: ../../using/cmdline.rst:346 +#: ../../using/cmdline.rst:347 msgid "" "See also the :envvar:`PYTHONSAFEPATH` environment variable, and :option:`-E` " "and :option:`-I` (isolated) options." msgstr "" -#: ../../using/cmdline.rst:354 +#: ../../using/cmdline.rst:355 msgid "" "Don't display the copyright and version messages even in interactive mode." msgstr "" -#: ../../using/cmdline.rst:361 +#: ../../using/cmdline.rst:362 msgid "" "Turn on hash randomization. This option only has an effect if the :envvar:" "`PYTHONHASHSEED` environment variable is set to ``0``, since hash " "randomization is enabled by default." msgstr "" -#: ../../using/cmdline.rst:365 +#: ../../using/cmdline.rst:366 msgid "" "On previous versions of Python, this option turns on hash randomization, so " "that the :meth:`~object.__hash__` values of str and bytes objects are " @@ -512,7 +512,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: ../../using/cmdline.rst:371 +#: ../../using/cmdline.rst:372 msgid "" "Hash randomization is intended to provide protection against a denial-of-" "service caused by carefully chosen inputs that exploit the worst case " @@ -520,32 +520,32 @@ msgid "" "http://ocert.org/advisories/ocert-2011-003.html%20for%20details." msgstr "" -#: ../../using/cmdline.rst:376 +#: ../../using/cmdline.rst:377 msgid "" ":envvar:`PYTHONHASHSEED` allows you to set a fixed value for the hash seed " "secret." msgstr "" -#: ../../using/cmdline.rst:381 +#: ../../using/cmdline.rst:382 msgid "The option is no longer ignored." msgstr "" -#: ../../using/cmdline.rst:387 +#: ../../using/cmdline.rst:388 msgid "" "Don't add the :data:`user site-packages directory <site.USER_SITE>` to :data:" "`sys.path`." msgstr "" -#: ../../using/cmdline.rst:390 +#: ../../using/cmdline.rst:391 msgid "See also :envvar:`PYTHONNOUSERSITE`." msgstr "另請參閱 :envvar:`PYTHONNOUSERSITE`。" -#: ../../using/cmdline.rst:394 ../../using/cmdline.rst:816 -#: ../../using/cmdline.rst:828 +#: ../../using/cmdline.rst:395 ../../using/cmdline.rst:887 +#: ../../using/cmdline.rst:899 msgid ":pep:`370` -- Per user site-packages directory" msgstr "" -#: ../../using/cmdline.rst:399 +#: ../../using/cmdline.rst:400 msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " @@ -553,21 +553,21 @@ msgid "" "main` if you want them to be triggered)." msgstr "" -#: ../../using/cmdline.rst:407 +#: ../../using/cmdline.rst:408 msgid "" "Force the stdout and stderr streams to be unbuffered. This option has no " "effect on the stdin stream." msgstr "" -#: ../../using/cmdline.rst:410 +#: ../../using/cmdline.rst:411 msgid "See also :envvar:`PYTHONUNBUFFERED`." msgstr "另請參閱 :envvar:`PYTHONUNBUFFERED`。" -#: ../../using/cmdline.rst:412 +#: ../../using/cmdline.rst:413 msgid "The text layer of the stdout and stderr streams now is unbuffered." msgstr "" -#: ../../using/cmdline.rst:418 +#: ../../using/cmdline.rst:419 msgid "" "Print a message each time a module is initialized, showing the place " "(filename or built-in module) from which it is loaded. When given twice (:" @@ -575,30 +575,30 @@ msgid "" "searching for a module. Also provides information on module cleanup at exit." msgstr "" -#: ../../using/cmdline.rst:423 +#: ../../using/cmdline.rst:424 msgid "" "The :mod:`site` module reports the site-specific paths and :file:`.pth` " "files being processed." msgstr "" -#: ../../using/cmdline.rst:427 +#: ../../using/cmdline.rst:428 msgid "See also :envvar:`PYTHONVERBOSE`." msgstr "另請參閱 :envvar:`PYTHONVERBOSE`。" -#: ../../using/cmdline.rst:433 +#: ../../using/cmdline.rst:434 msgid "" "Warning control. Python's warning machinery by default prints warning " "messages to :data:`sys.stderr`." msgstr "" -#: ../../using/cmdline.rst:436 ../../using/cmdline.rst:844 +#: ../../using/cmdline.rst:437 ../../using/cmdline.rst:915 msgid "" "The simplest settings apply a particular action unconditionally to all " "warnings emitted by a process (even those that are otherwise ignored by " "default)::" msgstr "" -#: ../../using/cmdline.rst:440 +#: ../../using/cmdline.rst:441 msgid "" "-Wdefault # Warn once per call location\n" "-Werror # Convert to exceptions\n" @@ -609,41 +609,41 @@ msgid "" "-Wignore # Never warn" msgstr "" -#: ../../using/cmdline.rst:448 +#: ../../using/cmdline.rst:449 msgid "" "The action names can be abbreviated as desired and the interpreter will " "resolve them to the appropriate action name. For example, ``-Wi`` is the " "same as ``-Wignore``." msgstr "" -#: ../../using/cmdline.rst:452 +#: ../../using/cmdline.rst:453 msgid "The full form of argument is::" msgstr "完整的引數形式為: ::" -#: ../../using/cmdline.rst:454 +#: ../../using/cmdline.rst:455 msgid "action:message:category:module:lineno" msgstr "action:message:category:module:lineno" -#: ../../using/cmdline.rst:456 +#: ../../using/cmdline.rst:457 msgid "" "Empty fields match all values; trailing empty fields may be omitted. For " "example ``-W ignore::DeprecationWarning`` ignores all DeprecationWarning " "warnings." msgstr "" -#: ../../using/cmdline.rst:460 +#: ../../using/cmdline.rst:461 msgid "" "The *action* field is as explained above but only applies to warnings that " "match the remaining fields." msgstr "" -#: ../../using/cmdline.rst:463 +#: ../../using/cmdline.rst:464 msgid "" "The *message* field must match the whole warning message; this match is case-" "insensitive." msgstr "" -#: ../../using/cmdline.rst:466 +#: ../../using/cmdline.rst:467 msgid "" "The *category* field matches the warning category (ex: " "``DeprecationWarning``). This must be a class name; the match test whether " @@ -651,19 +651,19 @@ msgid "" "warning category." msgstr "" -#: ../../using/cmdline.rst:471 +#: ../../using/cmdline.rst:472 msgid "" "The *module* field matches the (fully qualified) module name; this match is " "case-sensitive." msgstr "" -#: ../../using/cmdline.rst:474 +#: ../../using/cmdline.rst:475 msgid "" "The *lineno* field matches the line number, where zero matches all line " "numbers and is thus equivalent to an omitted line number." msgstr "" -#: ../../using/cmdline.rst:477 +#: ../../using/cmdline.rst:478 msgid "" "Multiple :option:`-W` options can be given; when a warning matches more than " "one option, the action for the last matching option is performed. Invalid :" @@ -671,7 +671,7 @@ msgid "" "invalid options when the first warning is issued)." msgstr "" -#: ../../using/cmdline.rst:482 +#: ../../using/cmdline.rst:483 msgid "" "Warnings can also be controlled using the :envvar:`PYTHONWARNINGS` " "environment variable and from within a Python program using the :mod:" @@ -679,31 +679,31 @@ msgid "" "can be used to use a regular expression on the warning message." msgstr "" -#: ../../using/cmdline.rst:487 ../../using/cmdline.rst:856 +#: ../../using/cmdline.rst:488 ../../using/cmdline.rst:927 msgid "" "See :ref:`warning-filter` and :ref:`describing-warning-filters` for more " "details." msgstr "" -#: ../../using/cmdline.rst:493 +#: ../../using/cmdline.rst:494 msgid "" "Skip the first line of the source, allowing use of non-Unix forms of ``#!" "cmd``. This is intended for a DOS specific hack only." msgstr "" -#: ../../using/cmdline.rst:499 +#: ../../using/cmdline.rst:500 msgid "" "Reserved for various implementation-specific options. CPython currently " "defines the following possible values:" msgstr "" -#: ../../using/cmdline.rst:502 +#: ../../using/cmdline.rst:503 msgid "" "``-X faulthandler`` to enable :mod:`faulthandler`. See also :envvar:" "`PYTHONFAULTHANDLER`." msgstr "" -#: ../../using/cmdline.rst:507 +#: ../../using/cmdline.rst:508 msgid "" "``-X showrefcount`` to output the total reference count and number of used " "memory blocks when the program finishes or after each statement in the " @@ -711,7 +711,7 @@ msgid "" "build>`." msgstr "" -#: ../../using/cmdline.rst:514 +#: ../../using/cmdline.rst:515 msgid "" "``-X tracemalloc`` to start tracing Python memory allocations using the :mod:" "`tracemalloc` module. By default, only the most recent frame is stored in a " @@ -720,14 +720,14 @@ msgid "" "envvar:`PYTHONTRACEMALLOC` for more information." msgstr "" -#: ../../using/cmdline.rst:523 +#: ../../using/cmdline.rst:524 msgid "" "``-X int_max_str_digits`` configures the :ref:`integer string conversion " "length limitation <int_max_str_digits>`. See also :envvar:" "`PYTHONINTMAXSTRDIGITS`." msgstr "" -#: ../../using/cmdline.rst:529 +#: ../../using/cmdline.rst:530 msgid "" "``-X importtime`` to show how long each import takes. It shows module name, " "cumulative time (including nested imports) and self time (excluding nested " @@ -736,35 +736,35 @@ msgid "" "asyncio'``. See also :envvar:`PYTHONPROFILEIMPORTTIME`." msgstr "" -#: ../../using/cmdline.rst:537 +#: ../../using/cmdline.rst:538 msgid "" "``-X dev``: enable :ref:`Python Development Mode <devmode>`, introducing " "additional runtime checks that are too expensive to be enabled by default. " "See also :envvar:`PYTHONDEVMODE`." msgstr "" -#: ../../using/cmdline.rst:543 +#: ../../using/cmdline.rst:544 msgid "" "``-X utf8`` enables the :ref:`Python UTF-8 Mode <utf8-mode>`. ``-X utf8=0`` " "explicitly disables :ref:`Python UTF-8 Mode <utf8-mode>` (even when it would " "otherwise activate automatically). See also :envvar:`PYTHONUTF8`." msgstr "" -#: ../../using/cmdline.rst:550 +#: ../../using/cmdline.rst:551 msgid "" "``-X pycache_prefix=PATH`` enables writing ``.pyc`` files to a parallel tree " "rooted at the given directory instead of to the code tree. See also :envvar:" "`PYTHONPYCACHEPREFIX`." msgstr "" -#: ../../using/cmdline.rst:556 +#: ../../using/cmdline.rst:557 msgid "" "``-X warn_default_encoding`` issues a :class:`EncodingWarning` when the " "locale-specific default encoding is used for opening files. See also :envvar:" "`PYTHONWARNDEFAULTENCODING`." msgstr "" -#: ../../using/cmdline.rst:562 +#: ../../using/cmdline.rst:563 msgid "" "``-X no_debug_ranges`` disables the inclusion of the tables mapping extra " "location information (end line, start column offset and end column offset) " @@ -774,18 +774,19 @@ msgid "" "envvar:`PYTHONNODEBUGRANGES`." msgstr "" -#: ../../using/cmdline.rst:571 +#: ../../using/cmdline.rst:572 msgid "" "``-X frozen_modules`` determines whether or not frozen modules are ignored " -"by the import machinery. A value of \"on\" means they get imported and " -"\"off\" means they are ignored. The default is \"on\" if this is an " +"by the import machinery. A value of ``on`` means they get imported and " +"``off`` means they are ignored. The default is ``on`` if this is an " "installed Python (the normal case). If it's under development (running from " -"the source tree) then the default is \"off\". Note that the " -"\"importlib_bootstrap\" and \"importlib_bootstrap_external\" frozen modules " -"are always used, even if this flag is set to \"off\"." +"the source tree) then the default is ``off``. Note that the :mod:`!" +"importlib_bootstrap` and :mod:`!importlib_bootstrap_external` frozen modules " +"are always used, even if this flag is set to ``off``. See also :envvar:" +"`PYTHON_FROZEN_MODULES`." msgstr "" -#: ../../using/cmdline.rst:581 +#: ../../using/cmdline.rst:583 msgid "" "``-X perf`` enables support for the Linux ``perf`` profiler. When this " "option is provided, the ``perf`` profiler will be able to report Python " @@ -794,33 +795,108 @@ msgid "" "also :envvar:`PYTHONPERFSUPPORT` and :ref:`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:589 +#: ../../using/cmdline.rst:591 +msgid "" +"``-X perf_jit`` enables support for the Linux ``perf`` profiler with DWARF " +"support. When this option is provided, the ``perf`` profiler will be able to " +"report Python calls using DWARF information. This option is only available " +"on some platforms and will do nothing if is not supported on the current " +"system. The default value is \"off\". See also :envvar:" +"`PYTHON_PERF_JIT_SUPPORT` and :ref:`perf_profiling`." +msgstr "" + +#: ../../using/cmdline.rst:600 +msgid "" +":samp:`-X cpu_count={n}` overrides :func:`os.cpu_count`, :func:`os." +"process_cpu_count`, and :func:`multiprocessing.cpu_count`. *n* must be " +"greater than or equal to 1. This option may be useful for users who need to " +"limit CPU resources of a container system. See also :envvar:" +"`PYTHON_CPU_COUNT`. If *n* is ``default``, nothing is overridden." +msgstr "" + +#: ../../using/cmdline.rst:609 +msgid "" +":samp:`-X presite={package.module}` specifies a module that should be " +"imported before the :mod:`site` module is executed and before the :mod:" +"`__main__` module exists. Therefore, the imported module isn't :mod:" +"`__main__`. This can be used to execute code early during Python " +"initialization. Python needs to be :ref:`built in debug mode <debug-build>` " +"for this option to exist. See also :envvar:`PYTHON_PRESITE`." +msgstr "" + +#: ../../using/cmdline.rst:618 +msgid "" +":samp:`-X gil={0,1}` forces the GIL to be disabled or enabled, respectively. " +"Setting to ``0`` is only available in builds configured with :option:`--" +"disable-gil`. See also :envvar:`PYTHON_GIL` and :ref:`whatsnew313-free-" +"threaded-cpython`." +msgstr "" + +#: ../../using/cmdline.rst:625 msgid "" "It also allows passing arbitrary values and retrieving them through the :" "data:`sys._xoptions` dictionary." msgstr "" -#: ../../using/cmdline.rst:594 +#: ../../using/cmdline.rst:630 msgid "Removed the ``-X showalloccount`` option." msgstr "移除 ``-X showalloccount`` 選項。" -#: ../../using/cmdline.rst:597 +#: ../../using/cmdline.rst:633 msgid "Removed the ``-X oldparser`` option." msgstr "移除 ``-X oldparser`` 選項。" -#: ../../using/cmdline.rst:602 +#: ../../using/cmdline.rst:639 +msgid "Controlling color" +msgstr "" + +#: ../../using/cmdline.rst:641 +msgid "" +"The Python interpreter is configured by default to use colors to highlight " +"output in certain situations such as when displaying tracebacks. This " +"behavior can be controlled by setting different environment variables." +msgstr "" + +#: ../../using/cmdline.rst:645 +msgid "" +"Setting the environment variable ``TERM`` to ``dumb`` will disable color." +msgstr "" + +#: ../../using/cmdline.rst:647 +msgid "" +"If the |FORCE_COLOR|_ environment variable is set, then color will be " +"enabled regardless of the value of TERM. This is useful on CI systems which " +"aren’t terminals but can still display ANSI escape sequences." +msgstr "" + +#: ../../using/cmdline.rst:651 +msgid "" +"If the |NO_COLOR|_ environment variable is set, Python will disable all " +"color in the output. This takes precedence over ``FORCE_COLOR``." +msgstr "" + +#: ../../using/cmdline.rst:654 +msgid "" +"All these environment variables are used also by other tools to control " +"color output. To control the color output only in the Python interpreter, " +"the :envvar:`PYTHON_COLORS` environment variable can be used. This variable " +"takes precedence over ``NO_COLOR``, which in turn takes precedence over " +"``FORCE_COLOR``." +msgstr "" + +#: ../../using/cmdline.rst:669 msgid "Options you shouldn't use" msgstr "你不該使用的選項" -#: ../../using/cmdline.rst:606 +#: ../../using/cmdline.rst:673 msgid "Reserved for use by Jython_." msgstr "" -#: ../../using/cmdline.rst:614 +#: ../../using/cmdline.rst:681 msgid "Environment variables" msgstr "環境變數" -#: ../../using/cmdline.rst:616 +#: ../../using/cmdline.rst:683 msgid "" "These environment variables influence Python's behavior, they are processed " "before the command-line switches other than -E or -I. It is customary that " @@ -828,7 +904,7 @@ msgid "" "conflict." msgstr "" -#: ../../using/cmdline.rst:623 +#: ../../using/cmdline.rst:690 msgid "" "Change the location of the standard Python libraries. By default, the " "libraries are searched in :file:`{prefix}/lib/python{version}` and :file:" @@ -837,14 +913,14 @@ msgid "" "file:`/usr/local`." msgstr "" -#: ../../using/cmdline.rst:629 +#: ../../using/cmdline.rst:696 msgid "" "When :envvar:`PYTHONHOME` is set to a single directory, its value replaces " "both :file:`{prefix}` and :file:`{exec_prefix}`. To specify different " "values for these, set :envvar:`PYTHONHOME` to :file:`{prefix}:{exec_prefix}`." msgstr "" -#: ../../using/cmdline.rst:636 +#: ../../using/cmdline.rst:703 msgid "" "Augment the default search path for module files. The format is the same as " "the shell's :envvar:`PATH`: one or more directory pathnames separated by :" @@ -852,21 +928,21 @@ msgid "" "existent directories are silently ignored." msgstr "" -#: ../../using/cmdline.rst:641 +#: ../../using/cmdline.rst:708 msgid "" "In addition to normal directories, individual :envvar:`PYTHONPATH` entries " "may refer to zipfiles containing pure Python modules (in either source or " "compiled form). Extension modules cannot be imported from zipfiles." msgstr "" -#: ../../using/cmdline.rst:645 +#: ../../using/cmdline.rst:712 msgid "" "The default search path is installation dependent, but generally begins " "with :file:`{prefix}/lib/python{version}` (see :envvar:`PYTHONHOME` above). " "It is *always* appended to :envvar:`PYTHONPATH`." msgstr "" -#: ../../using/cmdline.rst:649 +#: ../../using/cmdline.rst:716 msgid "" "An additional directory will be inserted in the search path in front of :" "envvar:`PYTHONPATH` as described above under :ref:`using-on-interface-" @@ -874,19 +950,19 @@ msgid "" "the variable :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:657 +#: ../../using/cmdline.rst:724 msgid "" "If this is set to a non-empty string, don't prepend a potentially unsafe " "path to :data:`sys.path`: see the :option:`-P` option for details." msgstr "" -#: ../../using/cmdline.rst:665 +#: ../../using/cmdline.rst:732 msgid "" "If this is set to a non-empty string, it overrides the :data:`sys." "platlibdir` value." msgstr "" -#: ../../using/cmdline.rst:673 +#: ../../using/cmdline.rst:740 msgid "" "If this is the name of a readable file, the Python commands in that file are " "executed before the first prompt is displayed in interactive mode. The file " @@ -897,7 +973,7 @@ msgid "" "file." msgstr "" -#: ../../using/cmdline.rst:680 ../../using/cmdline.rst:682 +#: ../../using/cmdline.rst:747 ../../using/cmdline.rst:749 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_startup`` with the " "filename as the argument when called on startup." @@ -905,14 +981,14 @@ msgstr "" "引發一個附帶呼叫啟動時的檔案名稱為引數的\\ :ref:`稽核事件 <auditing>` " "``cpython.run_startup``。" -#: ../../using/cmdline.rst:688 +#: ../../using/cmdline.rst:755 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-O` option. If set to an integer, it is equivalent to specifying :" "option:`-O` multiple times." msgstr "" -#: ../../using/cmdline.rst:695 +#: ../../using/cmdline.rst:762 msgid "" "If this is set, it names a callable using dotted-path notation. The module " "containing the callable will be imported and then the callable will be run " @@ -923,62 +999,68 @@ msgid "" "breakpointhook` to do nothing but return immediately." msgstr "" -#: ../../using/cmdline.rst:707 +#: ../../using/cmdline.rst:774 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-d` option. If set to an integer, it is equivalent to specifying :" "option:`-d` multiple times." msgstr "" -#: ../../using/cmdline.rst:711 +#: ../../using/cmdline.rst:778 msgid "" "This environment variable requires a :ref:`debug build of Python <debug-" "build>`, otherwise it's ignored." msgstr "" -#: ../../using/cmdline.rst:717 +#: ../../using/cmdline.rst:784 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-i` option." msgstr "" -#: ../../using/cmdline.rst:720 +#: ../../using/cmdline.rst:787 msgid "" "This variable can also be modified by Python code using :data:`os.environ` " "to force inspect mode on program termination." msgstr "" -#: ../../using/cmdline.rst:725 +#: ../../using/cmdline.rst:792 msgid "(also 3.11.10, 3.10.15, 3.9.20, and 3.8.20) Emits audit events." msgstr "" -#: ../../using/cmdline.rst:731 +#: ../../using/cmdline.rst:795 +msgid "" +"Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also " +"executed. Emits audit events." +msgstr "" + +#: ../../using/cmdline.rst:802 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-u` option." msgstr "" -#: ../../using/cmdline.rst:737 +#: ../../using/cmdline.rst:808 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-v` option. If set to an integer, it is equivalent to specifying :" "option:`-v` multiple times." msgstr "" -#: ../../using/cmdline.rst:744 +#: ../../using/cmdline.rst:815 msgid "" "If this is set, Python ignores case in :keyword:`import` statements. This " "only works on Windows and macOS." msgstr "" -#: ../../using/cmdline.rst:750 +#: ../../using/cmdline.rst:821 msgid "" "If this is set to a non-empty string, Python won't try to write ``.pyc`` " "files on the import of source modules. This is equivalent to specifying " "the :option:`-B` option." msgstr "" -#: ../../using/cmdline.rst:757 +#: ../../using/cmdline.rst:828 msgid "" "If this is set, Python will write ``.pyc`` files in a mirror directory tree " "at this path, instead of in ``__pycache__`` directories within the source " @@ -986,40 +1068,40 @@ msgid "" "``pycache_prefix=PATH`` option." msgstr "" -#: ../../using/cmdline.rst:767 +#: ../../using/cmdline.rst:838 msgid "" "If this variable is not set or set to ``random``, a random value is used to " "seed the hashes of str and bytes objects." msgstr "" -#: ../../using/cmdline.rst:770 +#: ../../using/cmdline.rst:841 msgid "" "If :envvar:`PYTHONHASHSEED` is set to an integer value, it is used as a " "fixed seed for generating the hash() of the types covered by the hash " "randomization." msgstr "" -#: ../../using/cmdline.rst:774 +#: ../../using/cmdline.rst:845 msgid "" "Its purpose is to allow repeatable hashing, such as for selftests for the " "interpreter itself, or to allow a cluster of python processes to share hash " "values." msgstr "" -#: ../../using/cmdline.rst:778 +#: ../../using/cmdline.rst:849 msgid "" "The integer must be a decimal number in the range [0,4294967295]. " "Specifying the value 0 will disable hash randomization." msgstr "" -#: ../../using/cmdline.rst:785 +#: ../../using/cmdline.rst:856 msgid "" "If this variable is set to an integer, it is used to configure the " "interpreter's global :ref:`integer string conversion length limitation " "<int_max_str_digits>`." msgstr "" -#: ../../using/cmdline.rst:793 +#: ../../using/cmdline.rst:864 msgid "" "If this is set before running the interpreter, it overrides the encoding " "used for stdin/stdout/stderr, in the syntax ``encodingname:errorhandler``. " @@ -1027,17 +1109,17 @@ msgid "" "have the same meaning as in :func:`str.encode`." msgstr "" -#: ../../using/cmdline.rst:798 +#: ../../using/cmdline.rst:869 msgid "" "For stderr, the ``:errorhandler`` part is ignored; the handler will always " "be ``'backslashreplace'``." msgstr "" -#: ../../using/cmdline.rst:801 +#: ../../using/cmdline.rst:872 msgid "The ``encodingname`` part is now optional." msgstr "" -#: ../../using/cmdline.rst:804 +#: ../../using/cmdline.rst:875 msgid "" "On Windows, the encoding specified by this variable is ignored for " "interactive console buffers unless :envvar:`PYTHONLEGACYWINDOWSSTDIO` is " @@ -1045,13 +1127,13 @@ msgid "" "not affected." msgstr "" -#: ../../using/cmdline.rst:811 +#: ../../using/cmdline.rst:882 msgid "" "If this is set, Python won't add the :data:`user site-packages directory " "<site.USER_SITE>` to :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:821 +#: ../../using/cmdline.rst:892 msgid "" "Defines the :data:`user base directory <site.USER_BASE>`, which is used to " "compute the path of the :data:`user site-packages directory <site." @@ -1059,20 +1141,20 @@ msgid "" "``python -m pip install --user``." msgstr "" -#: ../../using/cmdline.rst:833 +#: ../../using/cmdline.rst:904 msgid "" "If this environment variable is set, ``sys.argv[0]`` will be set to its " "value instead of the value got through the C runtime. Only works on macOS." msgstr "" -#: ../../using/cmdline.rst:839 +#: ../../using/cmdline.rst:910 msgid "" "This is equivalent to the :option:`-W` option. If set to a comma separated " "string, it is equivalent to specifying :option:`-W` multiple times, with " "filters later in the list taking precedence over those earlier in the list." msgstr "" -#: ../../using/cmdline.rst:848 +#: ../../using/cmdline.rst:919 msgid "" "PYTHONWARNINGS=default # Warn once per call location\n" "PYTHONWARNINGS=error # Convert to exceptions\n" @@ -1083,7 +1165,7 @@ msgid "" "PYTHONWARNINGS=ignore # Never warn" msgstr "" -#: ../../using/cmdline.rst:862 +#: ../../using/cmdline.rst:933 msgid "" "If this environment variable is set to a non-empty string, :func:" "`faulthandler.enable` is called at startup: install a handler for :const:" @@ -1092,7 +1174,7 @@ msgid "" "traceback. This is equivalent to :option:`-X` ``faulthandler`` option." msgstr "" -#: ../../using/cmdline.rst:874 +#: ../../using/cmdline.rst:945 msgid "" "If this environment variable is set to a non-empty string, start tracing " "Python memory allocations using the :mod:`tracemalloc` module. The value of " @@ -1102,90 +1184,101 @@ msgid "" "is equivalent to setting the :option:`-X` ``tracemalloc`` option." msgstr "" -#: ../../using/cmdline.rst:887 +#: ../../using/cmdline.rst:958 msgid "" "If this environment variable is set to a non-empty string, Python will show " "how long each import takes. This is equivalent to setting the :option:`-X` " "``importtime`` option." msgstr "" -#: ../../using/cmdline.rst:896 +#: ../../using/cmdline.rst:967 msgid "" "If this environment variable is set to a non-empty string, enable the :ref:" "`debug mode <asyncio-debug-mode>` of the :mod:`asyncio` module." msgstr "" -#: ../../using/cmdline.rst:904 +#: ../../using/cmdline.rst:975 msgid "Set the Python memory allocators and/or install debug hooks." msgstr "" -#: ../../using/cmdline.rst:906 +#: ../../using/cmdline.rst:977 msgid "Set the family of memory allocators used by Python:" msgstr "" -#: ../../using/cmdline.rst:908 +#: ../../using/cmdline.rst:979 msgid "" "``default``: use the :ref:`default memory allocators <default-memory-" "allocators>`." msgstr "" -#: ../../using/cmdline.rst:910 +#: ../../using/cmdline.rst:981 msgid "" "``malloc``: use the :c:func:`malloc` function of the C library for all " "domains (:c:macro:`PYMEM_DOMAIN_RAW`, :c:macro:`PYMEM_DOMAIN_MEM`, :c:macro:" "`PYMEM_DOMAIN_OBJ`)." msgstr "" -#: ../../using/cmdline.rst:913 +#: ../../using/cmdline.rst:984 msgid "" "``pymalloc``: use the :ref:`pymalloc allocator <pymalloc>` for :c:macro:" "`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and use the :c:" "func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." msgstr "" -#: ../../using/cmdline.rst:917 +#: ../../using/cmdline.rst:987 +msgid "" +"``mimalloc``: use the :ref:`mimalloc allocator <mimalloc>` for :c:macro:" +"`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and use the :c:" +"func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." +msgstr "" + +#: ../../using/cmdline.rst:991 msgid "Install :ref:`debug hooks <pymem-debug-hooks>`:" msgstr "" -#: ../../using/cmdline.rst:919 +#: ../../using/cmdline.rst:993 msgid "" "``debug``: install debug hooks on top of the :ref:`default memory allocators " "<default-memory-allocators>`." msgstr "" -#: ../../using/cmdline.rst:921 +#: ../../using/cmdline.rst:995 msgid "``malloc_debug``: same as ``malloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:922 +#: ../../using/cmdline.rst:996 msgid "``pymalloc_debug``: same as ``pymalloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:926 +#: ../../using/cmdline.rst:997 +msgid "``mimalloc_debug``: same as ``mimalloc`` but also install debug hooks." +msgstr "" + +#: ../../using/cmdline.rst:1001 msgid "Added the ``\"default\"`` allocator." msgstr "" -#: ../../using/cmdline.rst:932 +#: ../../using/cmdline.rst:1007 msgid "" "If set to a non-empty string, Python will print statistics of the :ref:" "`pymalloc memory allocator <pymalloc>` every time a new pymalloc object " "arena is created, and on shutdown." msgstr "" -#: ../../using/cmdline.rst:936 +#: ../../using/cmdline.rst:1011 msgid "" "This variable is ignored if the :envvar:`PYTHONMALLOC` environment variable " "is used to force the :c:func:`malloc` allocator of the C library, or if " "Python is configured without ``pymalloc`` support." msgstr "" -#: ../../using/cmdline.rst:940 +#: ../../using/cmdline.rst:1015 msgid "" "This variable can now also be used on Python compiled in release mode. It " "now has no effect if set to an empty string." msgstr "" -#: ../../using/cmdline.rst:947 +#: ../../using/cmdline.rst:1022 msgid "" "If set to a non-empty string, the default :term:`filesystem encoding and " "error handler` mode will revert to their pre-3.6 values of 'mbcs' and " @@ -1193,41 +1286,41 @@ msgid "" "'surrogatepass' are used." msgstr "" -#: ../../using/cmdline.rst:952 +#: ../../using/cmdline.rst:1027 msgid "" "This may also be enabled at runtime with :func:`sys." "_enablelegacywindowsfsencoding`." msgstr "" -#: ../../using/cmdline.rst:955 ../../using/cmdline.rst:969 +#: ../../using/cmdline.rst:1030 ../../using/cmdline.rst:1044 msgid ":ref:`Availability <availability>`: Windows." msgstr ":ref:`適用 <availability>`:Windows。" -#: ../../using/cmdline.rst:957 +#: ../../using/cmdline.rst:1032 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`。" -#: ../../using/cmdline.rst:962 +#: ../../using/cmdline.rst:1037 msgid "" "If set to a non-empty string, does not use the new console reader and " "writer. This means that Unicode characters will be encoded according to the " "active console code page, rather than using utf-8." msgstr "" -#: ../../using/cmdline.rst:966 +#: ../../using/cmdline.rst:1041 msgid "" "This variable is ignored if the standard streams are redirected (to files or " "pipes) rather than referring to console buffers." msgstr "" -#: ../../using/cmdline.rst:976 +#: ../../using/cmdline.rst:1051 msgid "" "If set to the value ``0``, causes the main Python command line application " "to skip coercing the legacy ASCII-based C and POSIX locales to a more " "capable UTF-8 based alternative." msgstr "" -#: ../../using/cmdline.rst:980 +#: ../../using/cmdline.rst:1055 msgid "" "If this variable is *not* set (or is set to a value other than ``0``), the " "``LC_ALL`` locale override environment variable is also not set, and the " @@ -1238,19 +1331,19 @@ msgid "" "runtime:" msgstr "" -#: ../../using/cmdline.rst:988 +#: ../../using/cmdline.rst:1063 msgid "``C.UTF-8``" msgstr "``C.UTF-8``" -#: ../../using/cmdline.rst:989 +#: ../../using/cmdline.rst:1064 msgid "``C.utf8``" msgstr "``C.utf8``" -#: ../../using/cmdline.rst:990 +#: ../../using/cmdline.rst:1065 msgid "``UTF-8``" msgstr "``UTF-8``" -#: ../../using/cmdline.rst:992 +#: ../../using/cmdline.rst:1067 msgid "" "If setting one of these locale categories succeeds, then the ``LC_CTYPE`` " "environment variable will also be set accordingly in the current process " @@ -1263,7 +1356,7 @@ msgid "" "(such as Python's own :func:`locale.getdefaultlocale`)." msgstr "" -#: ../../using/cmdline.rst:1002 +#: ../../using/cmdline.rst:1077 msgid "" "Configuring one of these locales (either explicitly or via the above " "implicit locale coercion) automatically enables the ``surrogateescape`` :ref:" @@ -1273,7 +1366,7 @@ msgid "" "envvar:`PYTHONIOENCODING` as usual." msgstr "" -#: ../../using/cmdline.rst:1009 +#: ../../using/cmdline.rst:1084 msgid "" "For debugging purposes, setting ``PYTHONCOERCECLOCALE=warn`` will cause " "Python to emit warning messages on ``stderr`` if either the locale coercion " @@ -1281,7 +1374,7 @@ msgid "" "active when the Python runtime is initialized." msgstr "" -#: ../../using/cmdline.rst:1014 +#: ../../using/cmdline.rst:1089 msgid "" "Also note that even when locale coercion is disabled, or when it fails to " "find a suitable target locale, :envvar:`PYTHONUTF8` will still activate by " @@ -1290,15 +1383,15 @@ msgid "" "system interfaces." msgstr "" -#: ../../using/cmdline.rst:1020 +#: ../../using/cmdline.rst:1095 msgid ":ref:`Availability <availability>`: Unix." msgstr ":ref:`適用 <availability>`:Unix。" -#: ../../using/cmdline.rst:1022 +#: ../../using/cmdline.rst:1097 msgid "See :pep:`538` for more details." msgstr "更多細節請見 :pep:`538`。" -#: ../../using/cmdline.rst:1028 +#: ../../using/cmdline.rst:1103 msgid "" "If this environment variable is set to a non-empty string, enable :ref:" "`Python Development Mode <devmode>`, introducing additional runtime checks " @@ -1306,31 +1399,31 @@ msgid "" "setting the :option:`-X` ``dev`` option." msgstr "" -#: ../../using/cmdline.rst:1037 +#: ../../using/cmdline.rst:1112 msgid "If set to ``1``, enable the :ref:`Python UTF-8 Mode <utf8-mode>`." msgstr "如果設為 ``1``,則啟用 :ref:`Python UTF-8 Mode <utf8-mode>`。" -#: ../../using/cmdline.rst:1039 +#: ../../using/cmdline.rst:1114 msgid "If set to ``0``, disable the :ref:`Python UTF-8 Mode <utf8-mode>`." msgstr "如果設為 ``0``,則停用 :ref:`Python UTF-8 Mode <utf8-mode>`。" -#: ../../using/cmdline.rst:1041 +#: ../../using/cmdline.rst:1116 msgid "" "Setting any other non-empty string causes an error during interpreter " "initialisation." msgstr "" -#: ../../using/cmdline.rst:1048 +#: ../../using/cmdline.rst:1123 msgid "" "If this environment variable is set to a non-empty string, issue a :class:" "`EncodingWarning` when the locale-specific default encoding is used." msgstr "" -#: ../../using/cmdline.rst:1051 +#: ../../using/cmdline.rst:1126 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節請見 :ref:`io-encoding-warning`。" -#: ../../using/cmdline.rst:1057 +#: ../../using/cmdline.rst:1132 msgid "" "If this variable is set, it disables the inclusion of the tables mapping " "extra location information (end line, start column offset and end column " @@ -1339,39 +1432,142 @@ msgid "" "visual location indicators when the interpreter displays tracebacks." msgstr "" -#: ../../using/cmdline.rst:1067 +#: ../../using/cmdline.rst:1142 msgid "" "If this variable is set to a nonzero value, it enables support for the Linux " "``perf`` profiler so Python calls can be detected by it." msgstr "" -#: ../../using/cmdline.rst:1070 +#: ../../using/cmdline.rst:1145 ../../using/cmdline.rst:1158 msgid "If set to ``0``, disable Linux ``perf`` profiler support." msgstr "" -#: ../../using/cmdline.rst:1072 +#: ../../using/cmdline.rst:1147 msgid "" "See also the :option:`-X perf <-X>` command-line option and :ref:" "`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:1079 +#: ../../using/cmdline.rst:1154 +msgid "" +"If this variable is set to a nonzero value, it enables support for the Linux " +"``perf`` profiler so Python calls can be detected by it using DWARF " +"information." +msgstr "" + +#: ../../using/cmdline.rst:1160 +msgid "" +"See also the :option:`-X perf_jit <-X>` command-line option and :ref:" +"`perf_profiling`." +msgstr "" + +#: ../../using/cmdline.rst:1169 +msgid "" +"If this variable is set to a positive integer, it overrides the return " +"values of :func:`os.cpu_count` and :func:`os.process_cpu_count`." +msgstr "" + +#: ../../using/cmdline.rst:1172 +#, fuzzy +msgid "See also the :option:`-X cpu_count <-X>` command-line option." +msgstr "另請參閱 :option:`-P` 和 :option:`-I` (isolated) 選項。" + +#: ../../using/cmdline.rst:1178 +msgid "" +"If this variable is set to ``on`` or ``off``, it determines whether or not " +"frozen modules are ignored by the import machinery. A value of ``on`` means " +"they get imported and ``off`` means they are ignored. The default is ``on`` " +"for non-debug builds (the normal case) and ``off`` for debug builds. Note " +"that the :mod:`!importlib_bootstrap` and :mod:`!" +"importlib_bootstrap_external` frozen modules are always used, even if this " +"flag is set to ``off``." +msgstr "" + +#: ../../using/cmdline.rst:1186 +#, fuzzy +msgid "See also the :option:`-X frozen_modules <-X>` command-line option." +msgstr "另請參閱 :option:`-P` 和 :option:`-I` (isolated) 選項。" + +#: ../../using/cmdline.rst:1192 +msgid "" +"If this variable is set to ``1``, the interpreter will colorize various " +"kinds of output. Setting it to ``0`` deactivates this behavior. See also :" +"ref:`using-on-controlling-color`." +msgstr "" + +#: ../../using/cmdline.rst:1200 +msgid "" +"If this variable is set to ``1``, the interpreter will not attempt to load " +"the Python-based :term:`REPL` that requires :mod:`curses` and :mod:" +"`readline`, and will instead use the traditional parser-based :term:`REPL`." +msgstr "" + +#: ../../using/cmdline.rst:1209 +msgid "" +"This environment variable can be used to set the location of a ``." +"python_history`` file (by default, it is ``.python_history`` in the user's " +"home directory)." +msgstr "" + +#: ../../using/cmdline.rst:1217 +msgid "" +"If this variable is set to ``1``, the global interpreter lock (GIL) will be " +"forced on. Setting it to ``0`` forces the GIL off (needs Python configured " +"with the :option:`--disable-gil` build option)." +msgstr "" + +#: ../../using/cmdline.rst:1221 +msgid "" +"See also the :option:`-X gil <-X>` command-line option, which takes " +"precedence over this variable, and :ref:`whatsnew313-free-threaded-cpython`." +msgstr "" + +#: ../../using/cmdline.rst:1227 msgid "Debug-mode variables" msgstr "除錯模式變數" -#: ../../using/cmdline.rst:1083 +#: ../../using/cmdline.rst:1231 msgid "" "If set, Python will dump objects and reference counts still alive after " "shutting down the interpreter." msgstr "" -#: ../../using/cmdline.rst:1086 ../../using/cmdline.rst:1093 +#: ../../using/cmdline.rst:1234 ../../using/cmdline.rst:1242 msgid "" -"Need Python configured with the :option:`--with-trace-refs` build option." +"Needs Python configured with the :option:`--with-trace-refs` build option." msgstr "" -#: ../../using/cmdline.rst:1090 +#: ../../using/cmdline.rst:1238 msgid "" "If set, Python will dump objects and reference counts still alive after " -"shutting down the interpreter into a file called *FILENAME*." +"shutting down the interpreter into a file under the path given as the value " +"to this environment variable." +msgstr "" + +#: ../../using/cmdline.rst:1248 +msgid "" +"If this variable is set to a module, that module will be imported early in " +"the interpreter lifecycle, before the :mod:`site` module is executed, and " +"before the :mod:`__main__` module is created. Therefore, the imported module " +"is not treated as :mod:`__main__`." +msgstr "" + +#: ../../using/cmdline.rst:1253 +msgid "This can be used to execute code early during Python initialization." +msgstr "" + +#: ../../using/cmdline.rst:1255 +msgid "" +"To import a submodule, use ``package.module`` as the value, like in an " +"import statement." +msgstr "" + +#: ../../using/cmdline.rst:1258 +msgid "" +"See also the :option:`-X presite <-X>` command-line option, which takes " +"precedence over this variable." +msgstr "" + +#: ../../using/cmdline.rst:1261 +msgid "Needs Python configured with the :option:`--with-pydebug` build option." msgstr "" diff --git a/using/configure.po b/using/configure.po index 143bb3ba26..1b0328f205 100644 --- a/using/configure.po +++ b/using/configure.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,7 +27,8 @@ msgid "Build Requirements" msgstr "建置需求" #: ../../using/configure.rst:10 -msgid "Features required to build CPython:" +#, fuzzy +msgid "Features and minimum versions required to build CPython:" msgstr "建置 CPython 所需的功能:" #: ../../using/configure.rst:12 @@ -38,65 +39,96 @@ msgid "" msgstr "" #: ../../using/configure.rst:17 +msgid "On Windows, Microsoft Visual Studio 2017 or later is required." +msgstr "在 Windows 上需要 Microsoft Visual Studio 2017 或更新版本。" + +#: ../../using/configure.rst:19 msgid "" "Support for `IEEE 754 <https://en.wikipedia.org/wiki/IEEE_754>`_ floating-" "point numbers and `floating-point Not-a-Number (NaN) <https://en.wikipedia." "org/wiki/NaN#Floating_point>`_." msgstr "" -#: ../../using/configure.rst:21 +#: ../../using/configure.rst:23 msgid "Support for threads." msgstr "thread 的支援。" -#: ../../using/configure.rst:23 -msgid "OpenSSL 1.1.1 or newer for the :mod:`ssl` and :mod:`hashlib` modules." +#: ../../using/configure.rst:25 +msgid "" +"OpenSSL 1.1.1 is the minimum version and OpenSSL 3.0.9 is the recommended " +"minimum version for the :mod:`ssl` and :mod:`hashlib` extension modules." msgstr "" -#: ../../using/configure.rst:25 -msgid "On Windows, Microsoft Visual Studio 2017 or later is required." -msgstr "在 Windows 上需要 Microsoft Visual Studio 2017 或更新版本。" +#: ../../using/configure.rst:28 +#, fuzzy +msgid "SQLite 3.15.2 for the :mod:`sqlite3` extension module." +msgstr "請見 :mod:`ssl` 模組。" -#: ../../using/configure.rst:27 -msgid "On Windows, Visual Studio 2015 or later is required." +#: ../../using/configure.rst:30 +msgid "Tcl/Tk 8.5.12 for the :mod:`tkinter` module." +msgstr "" + +#: ../../using/configure.rst:32 +msgid "" +"Autoconf 2.71 and aclocal 1.16.4 are required to regenerate the :file:" +"`configure` script." +msgstr "" + +#: ../../using/configure.rst:35 +#, fuzzy +msgid "Tcl/Tk version 8.3.1 is now required." +msgstr "OpenSSL 1.1.1 現在是必要的。" + +#: ../../using/configure.rst:38 +#, fuzzy +msgid "" +"On Windows, Visual Studio 2015 or later is now required. Tcl/Tk version 8.4 " +"is now required." msgstr "在 Windows 上需要 Visual Studio 2015 或更新版本。" -#: ../../using/configure.rst:30 +#: ../../using/configure.rst:42 msgid "" "Selected C99 features are now required, like ``<stdint.h>`` and ``static " "inline`` functions." msgstr "" -#: ../../using/configure.rst:34 +#: ../../using/configure.rst:46 msgid "Thread support and OpenSSL 1.0.2 are now required." msgstr "對執行緒與 OpenSSL 1.0.2 的支援現在是必要的。" -#: ../../using/configure.rst:37 -msgid "OpenSSL 1.1.1 is now required." +#: ../../using/configure.rst:49 +#, fuzzy +msgid "OpenSSL 1.1.1 is now required. Require SQLite 3.7.15." msgstr "OpenSSL 1.1.1 現在是必要的。" -#: ../../using/configure.rst:40 +#: ../../using/configure.rst:53 msgid "" "C11 compiler, IEEE 754 and NaN support are now required. On Windows, Visual " -"Studio 2017 or later is required." +"Studio 2017 or later is required. Tcl/Tk version 8.5.12 is now required for " +"the :mod:`tkinter` module." +msgstr "" + +#: ../../using/configure.rst:58 +msgid "Autoconf 2.71, aclocal 1.16.4 and SQLite 3.15.2 are now required." msgstr "" -#: ../../using/configure.rst:44 +#: ../../using/configure.rst:61 msgid "" "See also :pep:`7` \"Style Guide for C Code\" and :pep:`11` \"CPython " "platform support\"." msgstr "" -#: ../../using/configure.rst:49 +#: ../../using/configure.rst:66 msgid "Generated files" msgstr "產生的檔案" -#: ../../using/configure.rst:51 +#: ../../using/configure.rst:68 msgid "" "To reduce build dependencies, Python source code contains multiple generated " "files. Commands to regenerate all generated files::" msgstr "" -#: ../../using/configure.rst:54 +#: ../../using/configure.rst:71 msgid "" "make regen-all\n" "make regen-stdlib-module-names\n" @@ -108,17 +140,17 @@ msgstr "" "make regen-limited-abi\n" "make regen-configure" -#: ../../using/configure.rst:59 +#: ../../using/configure.rst:76 msgid "" "The ``Makefile.pre.in`` file documents generated files, their inputs, and " "tools used to regenerate them. Search for ``regen-*`` make targets." msgstr "" -#: ../../using/configure.rst:63 +#: ../../using/configure.rst:80 msgid "configure script" msgstr "設定腳本" -#: ../../using/configure.rst:65 +#: ../../using/configure.rst:82 msgid "" "The ``make regen-configure`` command regenerates the ``aclocal.m4`` file and " "the ``configure`` script using the ``Tools/build/regen-configure.sh`` shell " @@ -126,50 +158,50 @@ msgid "" "have a reproducible output." msgstr "" -#: ../../using/configure.rst:70 +#: ../../using/configure.rst:87 msgid "The container is optional, the following command can be run locally::" msgstr "" -#: ../../using/configure.rst:72 +#: ../../using/configure.rst:89 msgid "autoreconf -ivf -Werror" msgstr "autoreconf -ivf -Werror" -#: ../../using/configure.rst:74 +#: ../../using/configure.rst:91 msgid "" "The generated files can change depending on the exact ``autoconf-archive``, " "``aclocal`` and ``pkg-config`` versions." msgstr "" -#: ../../using/configure.rst:81 +#: ../../using/configure.rst:98 msgid "Configure Options" msgstr "設定選項" -#: ../../using/configure.rst:83 -msgid "List all ``./configure`` script options using::" +#: ../../using/configure.rst:100 +msgid "List all :file:`configure` script options using::" msgstr "" -#: ../../using/configure.rst:85 +#: ../../using/configure.rst:102 #, fuzzy msgid "./configure --help" msgstr "設定腳本" -#: ../../using/configure.rst:87 +#: ../../using/configure.rst:104 msgid "" "See also the :file:`Misc/SpecialBuilds.txt` in the Python source " "distribution." msgstr "請見 Python 原始碼發行版中的 :file:`Misc/SpecialBuilds.txt`。" -#: ../../using/configure.rst:90 +#: ../../using/configure.rst:107 msgid "General Options" msgstr "一般選項" -#: ../../using/configure.rst:94 +#: ../../using/configure.rst:111 msgid "" "Support loadable extensions in the :mod:`!_sqlite` extension module (default " "is no) of the :mod:`sqlite3` module." msgstr "" -#: ../../using/configure.rst:97 +#: ../../using/configure.rst:114 msgid "" "See the :meth:`sqlite3.Connection.enable_load_extension` method of the :mod:" "`sqlite3` module." @@ -177,33 +209,33 @@ msgstr "" "請見 :mod:`sqlite3` 模組的 :meth:`sqlite3.Connection.enable_load_extension` " "方法。" -#: ../../using/configure.rst:104 +#: ../../using/configure.rst:121 msgid "" "Disable IPv6 support (enabled by default if supported), see the :mod:" "`socket` module." msgstr "停用 IPv6 支援(如果支援的話預設是啟用的),請見 :mod:`socket` 模組。" -#: ../../using/configure.rst:109 +#: ../../using/configure.rst:126 msgid "Define the size in bits of Python :class:`int` digits: 15 or 30 bits." msgstr "" -#: ../../using/configure.rst:111 +#: ../../using/configure.rst:128 msgid "By default, the digit size is 30." msgstr "" -#: ../../using/configure.rst:113 +#: ../../using/configure.rst:130 msgid "Define the ``PYLONG_BITS_IN_DIGIT`` to ``15`` or ``30``." msgstr "將 ``PYLONG_BITS_IN_DIGIT`` 定義為 ``15`` 或 ``30``。" -#: ../../using/configure.rst:115 +#: ../../using/configure.rst:132 msgid "See :data:`sys.int_info.bits_per_digit <sys.int_info>`." msgstr "參閱 :data:`sys.int_info.bits_per_digit <sys.int_info>`。" -#: ../../using/configure.rst:119 +#: ../../using/configure.rst:136 msgid "Set the Python executable suffix to *SUFFIX*." msgstr "將 Python 執行檔的後綴設定為 *SUFFIX*。" -#: ../../using/configure.rst:121 +#: ../../using/configure.rst:138 msgid "" "The default suffix is ``.exe`` on Windows and macOS (``python.exe`` " "executable), ``.js`` on Emscripten node, ``.html`` on Emscripten browser, ``." @@ -214,20 +246,20 @@ msgstr "" "Emscripten node 上為 ``.js``、在 Emscripten 瀏覽器為 ``.html``、在 WASI 上為 " "``.wasm``,以及在其他平台為空字串(``python`` 執行檔)。" -#: ../../using/configure.rst:126 +#: ../../using/configure.rst:143 msgid "" "The default suffix on WASM platform is one of ``.js``, ``.html`` or ``." "wasm``." msgstr "在 WASM 平台上預設的後綴是 ``.js``、``.html`` 或 ``.wasm`` 中的一個。" -#: ../../using/configure.rst:132 +#: ../../using/configure.rst:149 msgid "" "Select the default time zone search path for :const:`zoneinfo.TZPATH`. See " "the :ref:`Compile-time configuration <zoneinfo_data_compile_time_config>` of " "the :mod:`zoneinfo` module." msgstr "" -#: ../../using/configure.rst:136 +#: ../../using/configure.rst:153 msgid "" "Default: ``/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/" "etc/zoneinfo``." @@ -235,76 +267,76 @@ msgstr "" "預設值:``/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/" "zoneinfo``。" -#: ../../using/configure.rst:138 +#: ../../using/configure.rst:155 msgid "See :data:`os.pathsep` path separator." msgstr "請見 :data:`os.pathsep` 路徑分隔符號。" -#: ../../using/configure.rst:144 +#: ../../using/configure.rst:161 msgid "" "Build the ``_decimal`` extension module using a thread-local context rather " "than a coroutine-local context (default), see the :mod:`decimal` module." msgstr "" -#: ../../using/configure.rst:147 +#: ../../using/configure.rst:164 msgid "See :const:`decimal.HAVE_CONTEXTVAR` and the :mod:`contextvars` module." msgstr "請見 :const:`decimal.HAVE_CONTEXTVAR` 與 :mod:`contextvars` 模組。" -#: ../../using/configure.rst:153 +#: ../../using/configure.rst:170 msgid "Override order to check db backends for the :mod:`dbm` module" msgstr "" -#: ../../using/configure.rst:155 +#: ../../using/configure.rst:172 msgid "" "A valid value is a colon (``:``) separated string with the backend names:" msgstr "" -#: ../../using/configure.rst:157 +#: ../../using/configure.rst:174 msgid "``ndbm``;" msgstr "``ndbm``;" -#: ../../using/configure.rst:158 +#: ../../using/configure.rst:175 msgid "``gdbm``;" msgstr "``gdbm``;" -#: ../../using/configure.rst:159 +#: ../../using/configure.rst:176 msgid "``bdb``." msgstr "``bdb``." -#: ../../using/configure.rst:163 +#: ../../using/configure.rst:180 msgid "Disable C locale coercion to a UTF-8 based locale (enabled by default)." msgstr "" -#: ../../using/configure.rst:165 +#: ../../using/configure.rst:182 msgid "Don't define the ``PY_COERCE_C_LOCALE`` macro." msgstr "不要定義 ``PY_COERCE_C_LOCALE`` 巨集。" -#: ../../using/configure.rst:167 +#: ../../using/configure.rst:184 msgid "See :envvar:`PYTHONCOERCECLOCALE` and the :pep:`538`." msgstr "請見 :envvar:`PYTHONCOERCECLOCALE` 與 :pep:`538`。" -#: ../../using/configure.rst:171 +#: ../../using/configure.rst:188 msgid "Disable all freelists except the empty tuple singleton." msgstr "" -#: ../../using/configure.rst:177 +#: ../../using/configure.rst:194 msgid "Python library directory name (default is ``lib``)." msgstr "Python 函式庫目錄名稱(預設為 ``lib`` )。" -#: ../../using/configure.rst:179 +#: ../../using/configure.rst:196 msgid "Fedora and SuSE use ``lib64`` on 64-bit platforms." msgstr "Fedora 和 SuSE 在 64 位元平台上使用 ``lib64``。" -#: ../../using/configure.rst:181 +#: ../../using/configure.rst:198 msgid "See :data:`sys.platlibdir`." msgstr "參閱 :data:`sys.platlibdir`。" -#: ../../using/configure.rst:187 +#: ../../using/configure.rst:204 msgid "" "Directory of wheel packages used by the :mod:`ensurepip` module (none by " "default)." msgstr "" -#: ../../using/configure.rst:190 +#: ../../using/configure.rst:207 msgid "" "Some Linux distribution packaging policies recommend against bundling " "dependencies. For example, Fedora installs wheel packages in the ``/usr/" @@ -312,110 +344,428 @@ msgid "" "_bundled` package." msgstr "" -#: ../../using/configure.rst:199 +#: ../../using/configure.rst:216 msgid "" "Whether configure should use :program:`pkg-config` to detect build " "dependencies." msgstr "" -#: ../../using/configure.rst:202 +#: ../../using/configure.rst:219 msgid "``check`` (default): :program:`pkg-config` is optional" msgstr "``check`` (預設)::program:`pkg-config` 是可選的" -#: ../../using/configure.rst:203 +#: ../../using/configure.rst:220 msgid "``yes``: :program:`pkg-config` is mandatory" msgstr "``yes``::program:`pkg-config` 是必要的" -#: ../../using/configure.rst:204 +#: ../../using/configure.rst:221 msgid "``no``: configure does not use :program:`pkg-config` even when present" msgstr "``no``:即使存在也不使用 :program:`pkg-config` 來配置" -#: ../../using/configure.rst:210 -msgid "Turn on internal statistics gathering." +#: ../../using/configure.rst:227 +msgid "Turn on internal Python performance statistics gathering." +msgstr "" + +#: ../../using/configure.rst:229 +msgid "" +"By default, statistics gathering is off. Use ``python3 -X pystats`` command " +"or set ``PYTHONSTATS=1`` environment variable to turn on statistics " +"gathering at Python startup." msgstr "" -#: ../../using/configure.rst:212 +#: ../../using/configure.rst:233 +msgid "" +"At Python exit, dump statistics if statistics gathering was on and not " +"cleared." +msgstr "" + +#: ../../using/configure.rst:236 ../../using/configure.rst:708 +msgid "Effects:" +msgstr "效果:" + +#: ../../using/configure.rst:238 +#, fuzzy +msgid "Add :option:`-X pystats <-X>` command line option." +msgstr "新增 :option:`-X showrefcount <-X>` 命令列選項。" + +#: ../../using/configure.rst:239 +#, fuzzy +msgid "Add :envvar:`!PYTHONSTATS` environment variable." +msgstr "新增 :envvar:`PYTHONDUMPREFS` 環境變數。" + +#: ../../using/configure.rst:240 +#, fuzzy +msgid "Define the ``Py_STATS`` macro." +msgstr "定義 ``Py_TRACE_REFS`` 巨集。" + +#: ../../using/configure.rst:241 +#, fuzzy +msgid "Add functions to the :mod:`sys` module:" +msgstr "請見 :mod:`ssl` 模組。" + +#: ../../using/configure.rst:243 +msgid ":func:`!sys._stats_on`: Turns on statistics gathering." +msgstr "" + +#: ../../using/configure.rst:244 +msgid ":func:`!sys._stats_off`: Turns off statistics gathering." +msgstr "" + +#: ../../using/configure.rst:245 +msgid ":func:`!sys._stats_clear`: Clears the statistics." +msgstr "" + +#: ../../using/configure.rst:246 +msgid "" +":func:`!sys._stats_dump`: Dump statistics to file, and clears the statistics." +msgstr "" + +#: ../../using/configure.rst:248 msgid "" "The statistics will be dumped to a arbitrary (probably unique) file in ``/" -"tmp/py_stats/``, or ``C:\\temp\\py_stats\\`` on Windows. If that directory " -"does not exist, results will be printed on stdout." +"tmp/py_stats/`` (Unix) or ``C:\\temp\\py_stats\\`` (Windows). If that " +"directory does not exist, results will be printed on stderr." msgstr "" -#: ../../using/configure.rst:216 +#: ../../using/configure.rst:252 msgid "Use ``Tools/scripts/summarize_stats.py`` to read the stats." msgstr "使用 ``Tools/scripts/summarize_stats.py`` 來讀取統計資料。" -#: ../../using/configure.rst:221 +#: ../../using/configure.rst:254 +msgid "Statistics:" +msgstr "" + +#: ../../using/configure.rst:256 +msgid "Opcode:" +msgstr "" + +#: ../../using/configure.rst:258 +msgid "Specialization: success, failure, hit, deferred, miss, deopt, failures;" +msgstr "" + +#: ../../using/configure.rst:259 +msgid "Execution count;" +msgstr "" + +#: ../../using/configure.rst:260 +msgid "Pair count." +msgstr "" + +#: ../../using/configure.rst:262 +msgid "Call:" +msgstr "" + +#: ../../using/configure.rst:264 +msgid "Inlined Python calls;" +msgstr "" + +#: ../../using/configure.rst:265 +msgid "PyEval calls;" +msgstr "" + +#: ../../using/configure.rst:266 +msgid "Frames pushed;" +msgstr "" + +#: ../../using/configure.rst:267 +msgid "Frame object created;" +msgstr "" + +#: ../../using/configure.rst:268 +msgid "" +"Eval calls: vector, generator, legacy, function VECTORCALL, build class, " +"slot, function \"ex\", API, method." +msgstr "" + +#: ../../using/configure.rst:271 +msgid "Object:" +msgstr "" + +#: ../../using/configure.rst:273 +msgid "incref and decref;" +msgstr "" + +#: ../../using/configure.rst:274 +msgid "interpreter incref and decref;" +msgstr "" + +#: ../../using/configure.rst:275 +msgid "allocations: all, 512 bytes, 4 kiB, big;" +msgstr "" + +#: ../../using/configure.rst:276 +msgid "free;" +msgstr "" + +#: ../../using/configure.rst:277 +msgid "to/from free lists;" +msgstr "" + +#: ../../using/configure.rst:278 +msgid "dictionary materialized/dematerialized;" +msgstr "" + +#: ../../using/configure.rst:279 +msgid "type cache;" +msgstr "" + +#: ../../using/configure.rst:280 +#, fuzzy +msgid "optimization attempts;" +msgstr "最佳化旗標。" + +#: ../../using/configure.rst:281 +msgid "optimization traces created/executed;" +msgstr "" + +#: ../../using/configure.rst:282 +msgid "uops executed." +msgstr "" + +#: ../../using/configure.rst:284 +msgid "Garbage collector:" +msgstr "" + +#: ../../using/configure.rst:286 +msgid "Garbage collections;" +msgstr "" + +#: ../../using/configure.rst:287 +msgid "Objects visited;" +msgstr "" + +#: ../../using/configure.rst:288 +msgid "Objects collected." +msgstr "" + +#: ../../using/configure.rst:296 +msgid "" +"Enables **experimental** support for running Python without the :term:" +"`global interpreter lock` (GIL): free threading build." +msgstr "" + +#: ../../using/configure.rst:299 +msgid "" +"Defines the ``Py_GIL_DISABLED`` macro and adds ``\"t\"`` to :data:`sys." +"abiflags`." +msgstr "" + +#: ../../using/configure.rst:302 +msgid "See :ref:`whatsnew313-free-threaded-cpython` for more detail." +msgstr "" + +#: ../../using/configure.rst:308 +msgid "Path to ``pkg-config`` utility." +msgstr "" + +#: ../../using/configure.rst:313 +#, fuzzy +msgid "``pkg-config`` options." +msgstr "設定選項" + +#: ../../using/configure.rst:317 +#, fuzzy +msgid "C compiler options" +msgstr "C 編譯器指令。" + +#: ../../using/configure.rst:321 ../../using/configure.rst:1228 +msgid "C compiler command." +msgstr "C 編譯器指令。" + +#: ../../using/configure.rst:325 ../../using/configure.rst:1240 +msgid "C compiler flags." +msgstr "C 編譯器旗標。" + +#: ../../using/configure.rst:329 +#, fuzzy +msgid "C preprocessor command." +msgstr "C 編譯器指令。" + +#: ../../using/configure.rst:333 +msgid "C preprocessor flags, e.g. :samp:`-I{include_dir}`." +msgstr "" + +#: ../../using/configure.rst:337 ../../using/configure.rst:779 +msgid "Linker options" +msgstr "" + +#: ../../using/configure.rst:341 +msgid "Linker flags, e.g. :samp:`-L{library_directory}`." +msgstr "" + +#: ../../using/configure.rst:345 +msgid "Libraries to pass to the linker, e.g. :samp:`-l{library}`." +msgstr "" + +#: ../../using/configure.rst:349 +msgid "Name for machine-dependent library files." +msgstr "" + +#: ../../using/configure.rst:353 +msgid "Options for third-party dependencies" +msgstr "" + +#: ../../using/configure.rst:360 +msgid "" +"C compiler and linker flags to link Python to ``libbz2``, used by :mod:`bz2` " +"module, overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:366 +msgid "" +"C compiler and linker flags for ``libncurses`` or ``libncursesw``, used by :" +"mod:`curses` module, overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:372 +msgid "C compiler and linker flags for ``gdbm``." +msgstr "" + +#: ../../using/configure.rst:377 +msgid "" +"C compiler and linker flags for ``libb2`` (:ref:`BLAKE2 <hashlib-blake2>`), " +"used by :mod:`hashlib` module, overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:383 +msgid "" +"C compiler and linker flags for ``libedit``, used by :mod:`readline` module, " +"overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:389 +msgid "" +"C compiler and linker flags for ``libffi``, used by :mod:`ctypes` module, " +"overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:395 +msgid "" +"C compiler and linker flags for ``libmpdec``, used by :mod:`decimal` module, " +"overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:400 +msgid "" +"These environment variables have no effect unless :option:`--with-system-" +"libmpdec` is specified." +msgstr "" + +#: ../../using/configure.rst:406 +msgid "" +"C compiler and linker flags for ``liblzma``, used by :mod:`lzma` module, " +"overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:412 +msgid "" +"C compiler and linker flags for ``libreadline``, used by :mod:`readline` " +"module, overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:418 +msgid "" +"C compiler and linker flags for ``libsqlite3``, used by :mod:`sqlite3` " +"module, overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:424 +msgid "" +"C compiler and linker flags for ``libuuid``, used by :mod:`uuid` module, " +"overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:430 +msgid "C compiler and linker flags for PANEL, overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:432 +msgid "" +"C compiler and linker flags for ``libpanel`` or ``libpanelw``, used by :mod:" +"`curses.panel` module, overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:438 +msgid "C compiler and linker flags for TCLTK, overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:443 +msgid "" +"C compiler and linker flags for ``libzlib``, used by :mod:`gzip` module, " +"overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:448 msgid "WebAssembly Options" msgstr "WebAssembly 選項" -#: ../../using/configure.rst:225 +#: ../../using/configure.rst:452 msgid "Set build flavor for ``wasm32-emscripten``." msgstr "" -#: ../../using/configure.rst:227 +#: ../../using/configure.rst:454 msgid "``browser`` (default): preload minimal stdlib, default MEMFS." msgstr "" -#: ../../using/configure.rst:228 +#: ../../using/configure.rst:455 msgid "``node``: NODERAWFS and pthread support." msgstr "``node``:對 NODERAWFS 和 pthread 支援。" -#: ../../using/configure.rst:234 +#: ../../using/configure.rst:461 msgid "Turn on dynamic linking support for WASM." msgstr "" -#: ../../using/configure.rst:236 +#: ../../using/configure.rst:463 msgid "" "Dynamic linking enables ``dlopen``. File size of the executable increases " "due to limited dead code elimination and additional features." msgstr "" -#: ../../using/configure.rst:243 +#: ../../using/configure.rst:470 msgid "Turn on pthreads support for WASM." msgstr "" -#: ../../using/configure.rst:249 +#: ../../using/configure.rst:476 msgid "Install Options" msgstr "安裝選項" -#: ../../using/configure.rst:253 +#: ../../using/configure.rst:480 msgid "" "Install architecture-independent files in PREFIX. On Unix, it defaults to :" "file:`/usr/local`." msgstr "" -#: ../../using/configure.rst:256 +#: ../../using/configure.rst:483 msgid "This value can be retrieved at runtime using :data:`sys.prefix`." msgstr "這個值可以在 runtime 使用 :data:`sys.prefix` 取得。" -#: ../../using/configure.rst:258 +#: ../../using/configure.rst:485 msgid "" "As an example, one can use ``--prefix=\"$HOME/.local/\"`` to install a " "Python in its home directory." msgstr "" -#: ../../using/configure.rst:263 +#: ../../using/configure.rst:490 msgid "" "Install architecture-dependent files in EPREFIX, defaults to :option:`--" "prefix`." msgstr "" -#: ../../using/configure.rst:265 +#: ../../using/configure.rst:492 msgid "This value can be retrieved at runtime using :data:`sys.exec_prefix`." msgstr "這個值可以在 runtime 使用 :data:`sys.exec_prefix` 取得" -#: ../../using/configure.rst:269 +#: ../../using/configure.rst:496 msgid "" "Don't build nor install test modules, like the :mod:`test` package or the :" "mod:`!_testcapi` extension module (built and installed by default)." msgstr "" -#: ../../using/configure.rst:276 +#: ../../using/configure.rst:503 msgid "Select the :mod:`ensurepip` command run on Python installation:" msgstr "選擇在 Python 安裝時執行的 :mod:`ensurepip` 命令:" -#: ../../using/configure.rst:278 +#: ../../using/configure.rst:505 msgid "" "``upgrade`` (default): run ``python -m ensurepip --altinstall --upgrade`` " "command." @@ -423,45 +773,45 @@ msgstr "" "``upgrade`` (預設):執行 ``python -m ensurepip --altinstall --upgrade`` 命" "令。" -#: ../../using/configure.rst:280 +#: ../../using/configure.rst:507 msgid "``install``: run ``python -m ensurepip --altinstall`` command;" msgstr "``install``:執行 ``python -m ensurepip --altinstall`` 命令;" -#: ../../using/configure.rst:281 +#: ../../using/configure.rst:508 msgid "``no``: don't run ensurepip;" msgstr "``no``:不要執行 ensurepip;" -#: ../../using/configure.rst:287 +#: ../../using/configure.rst:514 msgid "Performance options" msgstr "" -#: ../../using/configure.rst:289 +#: ../../using/configure.rst:516 msgid "" "Configuring Python using ``--enable-optimizations --with-lto`` (PGO + LTO) " "is recommended for best performance. The experimental ``--enable-bolt`` flag " "can also be used to improve performance." msgstr "" -#: ../../using/configure.rst:295 +#: ../../using/configure.rst:522 msgid "" "Enable Profile Guided Optimization (PGO) using :envvar:`PROFILE_TASK` " "(disabled by default)." msgstr "" -#: ../../using/configure.rst:298 +#: ../../using/configure.rst:525 msgid "" "The C compiler Clang requires ``llvm-profdata`` program for PGO. On macOS, " "GCC also requires it: GCC is just an alias to Clang on macOS." msgstr "" -#: ../../using/configure.rst:301 +#: ../../using/configure.rst:528 msgid "" "Disable also semantic interposition in libpython if ``--enable-shared`` and " "GCC is used: add ``-fno-semantic-interposition`` to the compiler and linker " "flags." msgstr "" -#: ../../using/configure.rst:307 +#: ../../using/configure.rst:534 msgid "" "During the build, you may encounter compiler warnings about profile data not " "being available for some source files. These warnings are harmless, as only " @@ -470,54 +820,58 @@ msgid "" "profile-instr-unprofiled`` to :envvar:`CFLAGS`." msgstr "" -#: ../../using/configure.rst:316 +#: ../../using/configure.rst:543 msgid "Use ``-fno-semantic-interposition`` on GCC." msgstr "在 GCC 上使用 ``-fno-semantic-interposition``。" -#: ../../using/configure.rst:321 +#: ../../using/configure.rst:548 msgid "" "Environment variable used in the Makefile: Python command line arguments for " "the PGO generation task." msgstr "" -#: ../../using/configure.rst:324 +#: ../../using/configure.rst:551 msgid "Default: ``-m test --pgo --timeout=$(TESTTIMEOUT)``." msgstr "預設值:``-m test --pgo --timeout=$(TESTTIMEOUT)``。" -#: ../../using/configure.rst:330 +#: ../../using/configure.rst:555 +msgid "Task failure is no longer ignored silently." +msgstr "" + +#: ../../using/configure.rst:560 msgid "Enable Link Time Optimization (LTO) in any build (disabled by default)." msgstr "" -#: ../../using/configure.rst:332 +#: ../../using/configure.rst:562 msgid "" "The C compiler Clang requires ``llvm-ar`` for LTO (``ar`` on macOS), as well " "as an LTO-aware linker (``ld.gold`` or ``lld``)." msgstr "" -#: ../../using/configure.rst:337 +#: ../../using/configure.rst:567 msgid "To use ThinLTO feature, use ``--with-lto=thin`` on Clang." msgstr "" -#: ../../using/configure.rst:340 +#: ../../using/configure.rst:570 msgid "" "Use ThinLTO as the default optimization policy on Clang if the compiler " "accepts the flag." msgstr "" -#: ../../using/configure.rst:345 +#: ../../using/configure.rst:575 msgid "" "Enable usage of the `BOLT post-link binary optimizer <https://github.com/" "llvm/llvm-project/tree/main/bolt>`_ (disabled by default)." msgstr "" -#: ../../using/configure.rst:349 +#: ../../using/configure.rst:579 msgid "" "BOLT is part of the LLVM project but is not always included in their binary " "distributions. This flag requires that ``llvm-bolt`` and ``merge-fdata`` are " "available." msgstr "" -#: ../../using/configure.rst:353 +#: ../../using/configure.rst:583 msgid "" "BOLT is still a fairly new project so this flag should be considered " "experimental for now. Because this tool operates on machine code its success " @@ -528,7 +882,7 @@ msgid "" "encouraged." msgstr "" -#: ../../using/configure.rst:361 +#: ../../using/configure.rst:591 msgid "" "The :envvar:`!BOLT_INSTRUMENT_FLAGS` and :envvar:`!BOLT_APPLY_FLAGS` :" "program:`configure` variables can be defined to override the default set of " @@ -536,101 +890,116 @@ msgid "" "binaries, respectively." msgstr "" -#: ../../using/configure.rst:370 +#: ../../using/configure.rst:600 +msgid "" +"Arguments to ``llvm-bolt`` when creating a `BOLT optimized binary <https://" +"github.com/facebookarchive/BOLT>`_." +msgstr "" + +#: ../../using/configure.rst:607 +msgid "Arguments to ``llvm-bolt`` when instrumenting binaries." +msgstr "" + +#: ../../using/configure.rst:613 msgid "" "Enable computed gotos in evaluation loop (enabled by default on supported " "compilers)." msgstr "" -#: ../../using/configure.rst:375 +#: ../../using/configure.rst:618 msgid "" -"Disable the specialized Python memory allocator :ref:`pymalloc <pymalloc>` " -"(enabled by default)." +"Disable the fast :ref:`mimalloc <mimalloc>` allocator (enabled by default)." msgstr "" -#: ../../using/configure.rst:378 +#: ../../using/configure.rst:621 ../../using/configure.rst:628 msgid "See also :envvar:`PYTHONMALLOC` environment variable." msgstr "另請參閱 :envvar:`PYTHONMALLOC` 環境變數。" -#: ../../using/configure.rst:382 +#: ../../using/configure.rst:625 +msgid "" +"Disable the specialized Python memory allocator :ref:`pymalloc <pymalloc>` " +"(enabled by default)." +msgstr "" + +#: ../../using/configure.rst:632 msgid "" "Disable static documentation strings to reduce the memory footprint (enabled " "by default). Documentation strings defined in Python are not affected." msgstr "" -#: ../../using/configure.rst:385 +#: ../../using/configure.rst:635 msgid "Don't define the ``WITH_DOC_STRINGS`` macro." msgstr "不要定義 ``WITH_DOC_STRINGS`` 巨集。" -#: ../../using/configure.rst:387 +#: ../../using/configure.rst:637 msgid "See the ``PyDoc_STRVAR()`` macro." msgstr "請見 ``PyDoc_STRVAR()`` 巨集。" -#: ../../using/configure.rst:391 +#: ../../using/configure.rst:641 msgid "Enable C-level code profiling with ``gprof`` (disabled by default)." msgstr "" -#: ../../using/configure.rst:395 +#: ../../using/configure.rst:645 msgid "" "Add ``-fstrict-overflow`` to the C compiler flags (by default we add ``-fno-" "strict-overflow`` instead)." msgstr "" -#: ../../using/configure.rst:402 +#: ../../using/configure.rst:652 msgid "Python Debug Build" msgstr "" -#: ../../using/configure.rst:404 +#: ../../using/configure.rst:654 msgid "" "A debug build is Python built with the :option:`--with-pydebug` configure " "option." msgstr "" -#: ../../using/configure.rst:407 +#: ../../using/configure.rst:657 msgid "Effects of a debug build:" msgstr "" -#: ../../using/configure.rst:409 +#: ../../using/configure.rst:659 msgid "" "Display all warnings by default: the list of default warning filters is " "empty in the :mod:`warnings` module." msgstr "" -#: ../../using/configure.rst:411 +#: ../../using/configure.rst:661 msgid "Add ``d`` to :data:`sys.abiflags`." msgstr "新增 ``d`` 到 :data:`sys.abiflags`。" -#: ../../using/configure.rst:412 +#: ../../using/configure.rst:662 msgid "Add :func:`!sys.gettotalrefcount` function." msgstr "新增 :func:`!sys.gettotalrefcount` 函式。" -#: ../../using/configure.rst:413 +#: ../../using/configure.rst:663 msgid "Add :option:`-X showrefcount <-X>` command line option." msgstr "新增 :option:`-X showrefcount <-X>` 命令列選項。" -#: ../../using/configure.rst:414 +#: ../../using/configure.rst:664 msgid "" "Add :option:`-d` command line option and :envvar:`PYTHONDEBUG` environment " "variable to debug the parser." msgstr "" -#: ../../using/configure.rst:416 +#: ../../using/configure.rst:666 msgid "" "Add support for the ``__lltrace__`` variable: enable low-level tracing in " "the bytecode evaluation loop if the variable is defined." msgstr "" -#: ../../using/configure.rst:418 +#: ../../using/configure.rst:668 msgid "" "Install :ref:`debug hooks on memory allocators <default-memory-allocators>` " "to detect buffer overflow and other memory errors." msgstr "" -#: ../../using/configure.rst:420 +#: ../../using/configure.rst:670 msgid "Define ``Py_DEBUG`` and ``Py_REF_DEBUG`` macros." msgstr "定義 ``Py_DEBUG`` 和 ``Py_REF_DEBUG`` 巨集。" -#: ../../using/configure.rst:421 +#: ../../using/configure.rst:671 msgid "" "Add runtime checks: code surrounded by ``#ifdef Py_DEBUG`` and ``#endif``. " "Enable ``assert(...)`` and ``_PyObject_ASSERT(...)`` assertions: don't set " @@ -638,366 +1007,420 @@ msgid "" "option). Main runtime checks:" msgstr "" -#: ../../using/configure.rst:426 +#: ../../using/configure.rst:676 msgid "Add sanity checks on the function arguments." msgstr "" -#: ../../using/configure.rst:427 +#: ../../using/configure.rst:677 msgid "" "Unicode and int objects are created with their memory filled with a pattern " "to detect usage of uninitialized objects." msgstr "" -#: ../../using/configure.rst:429 +#: ../../using/configure.rst:679 msgid "" "Ensure that functions which can clear or replace the current exception are " "not called with an exception raised." msgstr "" -#: ../../using/configure.rst:431 +#: ../../using/configure.rst:681 msgid "Check that deallocator functions don't change the current exception." msgstr "" -#: ../../using/configure.rst:432 +#: ../../using/configure.rst:682 msgid "" "The garbage collector (:func:`gc.collect` function) runs some basic checks " "on objects consistency." msgstr "" -#: ../../using/configure.rst:434 +#: ../../using/configure.rst:684 msgid "" "The :c:macro:`!Py_SAFE_DOWNCAST()` macro checks for integer underflow and " "overflow when downcasting from wide types to narrow types." msgstr "" -#: ../../using/configure.rst:437 +#: ../../using/configure.rst:687 msgid "" "See also the :ref:`Python Development Mode <devmode>` and the :option:`--" "with-trace-refs` configure option." msgstr "" -#: ../../using/configure.rst:440 +#: ../../using/configure.rst:690 msgid "" "Release builds and debug builds are now ABI compatible: defining the " "``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` macro (see the :" -"option:`--with-trace-refs` option), which introduces the only ABI " -"incompatibility." +"option:`--with-trace-refs` option)." msgstr "" -#: ../../using/configure.rst:448 +#: ../../using/configure.rst:697 msgid "Debug options" msgstr "" -#: ../../using/configure.rst:452 +#: ../../using/configure.rst:701 msgid "" ":ref:`Build Python in debug mode <debug-build>`: define the ``Py_DEBUG`` " "macro (disabled by default)." msgstr "" -#: ../../using/configure.rst:457 +#: ../../using/configure.rst:706 msgid "Enable tracing references for debugging purpose (disabled by default)." msgstr "" -#: ../../using/configure.rst:459 -msgid "Effects:" -msgstr "效果:" - -#: ../../using/configure.rst:461 +#: ../../using/configure.rst:710 msgid "Define the ``Py_TRACE_REFS`` macro." msgstr "定義 ``Py_TRACE_REFS`` 巨集。" -#: ../../using/configure.rst:462 +#: ../../using/configure.rst:711 msgid "Add :func:`!sys.getobjects` function." msgstr "新增 :func:`!sys.getobjects` 函式。" -#: ../../using/configure.rst:463 +#: ../../using/configure.rst:712 msgid "Add :envvar:`PYTHONDUMPREFS` environment variable." msgstr "新增 :envvar:`PYTHONDUMPREFS` 環境變數。" -#: ../../using/configure.rst:465 +#: ../../using/configure.rst:714 msgid "" -"This build is not ABI compatible with release build (default build) or debug " -"build (``Py_DEBUG`` and ``Py_REF_DEBUG`` macros)." +"The :envvar:`PYTHONDUMPREFS` environment variable can be used to dump " +"objects and reference counts still alive at Python exit." msgstr "" -#: ../../using/configure.rst:472 +#: ../../using/configure.rst:717 +msgid ":ref:`Statically allocated objects <static-types>` are not traced." +msgstr "" + +#: ../../using/configure.rst:721 +msgid "" +"This build is now ABI compatible with release build and :ref:`debug build " +"<debug-build>`." +msgstr "" + +#: ../../using/configure.rst:727 msgid "" "Build with C assertions enabled (default is no): ``assert(...);`` and " "``_PyObject_ASSERT(...);``." msgstr "" -#: ../../using/configure.rst:475 +#: ../../using/configure.rst:730 msgid "" "If set, the ``NDEBUG`` macro is not defined in the :envvar:`OPT` compiler " "variable." msgstr "" -#: ../../using/configure.rst:478 +#: ../../using/configure.rst:733 msgid "" "See also the :option:`--with-pydebug` option (:ref:`debug build <debug-" "build>`) which also enables assertions." msgstr "" -#: ../../using/configure.rst:485 +#: ../../using/configure.rst:740 msgid "Enable Valgrind support (default is no)." msgstr "啟用 Valgrind 支援(預設不啟用)。" -#: ../../using/configure.rst:489 +#: ../../using/configure.rst:744 msgid "Enable DTrace support (default is no)." msgstr "啟用 DTrace 支援(預設不啟用)。" -#: ../../using/configure.rst:491 +#: ../../using/configure.rst:746 msgid "" "See :ref:`Instrumenting CPython with DTrace and SystemTap <instrumentation>`." msgstr "" -#: ../../using/configure.rst:498 +#: ../../using/configure.rst:753 msgid "" "Enable AddressSanitizer memory error detector, ``asan`` (default is no)." msgstr "" -#: ../../using/configure.rst:504 +#: ../../using/configure.rst:759 msgid "" "Enable MemorySanitizer allocation error detector, ``msan`` (default is no)." msgstr "" -#: ../../using/configure.rst:510 +#: ../../using/configure.rst:765 msgid "" "Enable UndefinedBehaviorSanitizer undefined behaviour detector, ``ubsan`` " "(default is no)." msgstr "" -#: ../../using/configure.rst:517 -msgid "Linker options" -msgstr "" +#: ../../using/configure.rst:772 +#, fuzzy +msgid "Enable ThreadSanitizer data race detector, ``tsan`` (default is no)." +msgstr "啟用 DTrace 支援(預設不啟用)。" -#: ../../using/configure.rst:521 +#: ../../using/configure.rst:783 msgid "Enable building a shared Python library: ``libpython`` (default is no)." msgstr "" -#: ../../using/configure.rst:525 +#: ../../using/configure.rst:787 msgid "" "Do not build ``libpythonMAJOR.MINOR.a`` and do not install ``python.o`` " "(built and enabled by default)." msgstr "" -#: ../../using/configure.rst:532 +#: ../../using/configure.rst:794 msgid "Libraries options" msgstr "函式庫選項" -#: ../../using/configure.rst:536 +#: ../../using/configure.rst:798 msgid "Link against additional libraries (default is no)." msgstr "" -#: ../../using/configure.rst:540 +#: ../../using/configure.rst:802 msgid "" "Build the :mod:`!pyexpat` module using an installed ``expat`` library " "(default is no)." msgstr "" -#: ../../using/configure.rst:545 +#: ../../using/configure.rst:807 msgid "" -"Build the ``_decimal`` extension module using an installed ``mpdec`` " -"library, see the :mod:`decimal` module (default is no)." +"Build the ``_decimal`` extension module using an installed ``mpdecimal`` " +"library, see the :mod:`decimal` module (default is yes)." msgstr "" -#: ../../using/configure.rst:552 -msgid "Use ``editline`` library for backend of the :mod:`readline` module." +#: ../../using/configure.rst:812 +msgid "Default to using the installed ``mpdecimal`` library." msgstr "" -#: ../../using/configure.rst:554 -msgid "Define the ``WITH_EDITLINE`` macro." -msgstr "定義 ``WITH_EDITLINE`` 巨集。" +#: ../../using/configure.rst:815 +msgid "" +"A copy of the ``mpdecimal`` library sources will no longer be distributed " +"with Python 3.15." +msgstr "" -#: ../../using/configure.rst:560 +#: ../../using/configure.rst:819 +msgid ":option:`LIBMPDEC_CFLAGS` and :option:`LIBMPDEC_LIBS`." +msgstr "" + +#: ../../using/configure.rst:823 +msgid "Designate a backend library for the :mod:`readline` module." +msgstr "" + +#: ../../using/configure.rst:825 +msgid "readline: Use readline as the backend." +msgstr "" + +#: ../../using/configure.rst:826 +msgid "editline: Use editline as the backend." +msgstr "" + +#: ../../using/configure.rst:832 msgid "Don't build the :mod:`readline` module (built by default)." msgstr "" -#: ../../using/configure.rst:562 +#: ../../using/configure.rst:834 msgid "Don't define the ``HAVE_LIBREADLINE`` macro." msgstr "不要定義 ``HAVE_LIBREADLINE`` 巨集。" -#: ../../using/configure.rst:568 +#: ../../using/configure.rst:840 msgid "" "Override ``libm`` math library to *STRING* (default is system-dependent)." msgstr "" -#: ../../using/configure.rst:572 +#: ../../using/configure.rst:844 msgid "Override ``libc`` C library to *STRING* (default is system-dependent)." msgstr "" -#: ../../using/configure.rst:576 +#: ../../using/configure.rst:848 msgid "Root of the OpenSSL directory." msgstr "" -#: ../../using/configure.rst:582 +#: ../../using/configure.rst:854 msgid "Set runtime library directory (rpath) for OpenSSL libraries:" msgstr "" -#: ../../using/configure.rst:584 +#: ../../using/configure.rst:856 msgid "``no`` (default): don't set rpath;" msgstr "" -#: ../../using/configure.rst:585 +#: ../../using/configure.rst:857 msgid "" "``auto``: auto-detect rpath from :option:`--with-openssl` and ``pkg-config``;" msgstr "" -#: ../../using/configure.rst:587 +#: ../../using/configure.rst:859 msgid "*DIR*: set an explicit rpath." msgstr "" -#: ../../using/configure.rst:593 +#: ../../using/configure.rst:865 msgid "Security Options" msgstr "" -#: ../../using/configure.rst:597 +#: ../../using/configure.rst:869 msgid "Select hash algorithm for use in ``Python/pyhash.c``:" msgstr "" -#: ../../using/configure.rst:599 +#: ../../using/configure.rst:871 msgid "``siphash13`` (default);" msgstr "" -#: ../../using/configure.rst:600 +#: ../../using/configure.rst:872 msgid "``siphash24``;" msgstr "``siphash24``;" -#: ../../using/configure.rst:601 +#: ../../using/configure.rst:873 msgid "``fnv``." msgstr "``fnv``。" -#: ../../using/configure.rst:605 +#: ../../using/configure.rst:877 msgid "``siphash13`` is added and it is the new default." msgstr "" -#: ../../using/configure.rst:610 +#: ../../using/configure.rst:882 msgid "Built-in hash modules:" msgstr "內建雜湊模組:" -#: ../../using/configure.rst:612 +#: ../../using/configure.rst:884 msgid "``md5``;" msgstr "``md5``;" -#: ../../using/configure.rst:613 +#: ../../using/configure.rst:885 msgid "``sha1``;" msgstr "``sha1``;" -#: ../../using/configure.rst:614 +#: ../../using/configure.rst:886 msgid "``sha256``;" msgstr "``sha256``;" -#: ../../using/configure.rst:615 +#: ../../using/configure.rst:887 msgid "``sha512``;" msgstr "``sha512``;" -#: ../../using/configure.rst:616 +#: ../../using/configure.rst:888 msgid "``sha3`` (with shake);" msgstr "" -#: ../../using/configure.rst:617 +#: ../../using/configure.rst:889 msgid "``blake2``." msgstr "``blake2``。" -#: ../../using/configure.rst:623 +#: ../../using/configure.rst:895 msgid "Override the OpenSSL default cipher suites string:" msgstr "" -#: ../../using/configure.rst:625 +#: ../../using/configure.rst:897 msgid "``python`` (default): use Python's preferred selection;" msgstr "" -#: ../../using/configure.rst:626 +#: ../../using/configure.rst:898 msgid "``openssl``: leave OpenSSL's defaults untouched;" msgstr "" -#: ../../using/configure.rst:627 +#: ../../using/configure.rst:899 msgid "*STRING*: use a custom string" msgstr "" -#: ../../using/configure.rst:629 +#: ../../using/configure.rst:901 msgid "See the :mod:`ssl` module." msgstr "請見 :mod:`ssl` 模組。" -#: ../../using/configure.rst:635 +#: ../../using/configure.rst:907 msgid "" "The settings ``python`` and *STRING* also set TLS 1.2 as minimum protocol " "version." msgstr "" -#: ../../using/configure.rst:639 +#: ../../using/configure.rst:911 msgid "macOS Options" msgstr "macOS 選項" -#: ../../using/configure.rst:641 -msgid "See ``Mac/README.rst``." +#: ../../using/configure.rst:913 +#, fuzzy +msgid "See :source:`Mac/README.rst`." msgstr "參閱 ``Mac/README.rst``。" -#: ../../using/configure.rst:646 +#: ../../using/configure.rst:918 msgid "" "Create a universal binary build. *SDKDIR* specifies which macOS SDK should " "be used to perform the build (default is no)." msgstr "" -#: ../../using/configure.rst:652 +#: ../../using/configure.rst:924 msgid "" "Create a Python.framework rather than a traditional Unix install. Optional " "*INSTALLDIR* specifies the installation path (default is no)." msgstr "" -#: ../../using/configure.rst:657 +#: ../../using/configure.rst:929 msgid "" "Specify the kind of universal binary that should be created. This option is " "only valid when :option:`--enable-universalsdk` is set." msgstr "" -#: ../../using/configure.rst:660 +#: ../../using/configure.rst:932 msgid "Options:" msgstr "選項:" -#: ../../using/configure.rst:662 +#: ../../using/configure.rst:934 msgid "``universal2``;" msgstr "``universal2``;" -#: ../../using/configure.rst:663 +#: ../../using/configure.rst:935 msgid "``32-bit``;" msgstr "``32-bit``;" -#: ../../using/configure.rst:664 +#: ../../using/configure.rst:936 msgid "``64-bit``;" msgstr "``64-bit``;" -#: ../../using/configure.rst:665 +#: ../../using/configure.rst:937 msgid "``3-way``;" msgstr "``3-way``;" -#: ../../using/configure.rst:666 +#: ../../using/configure.rst:938 msgid "``intel``;" msgstr "``intel``;" -#: ../../using/configure.rst:667 +#: ../../using/configure.rst:939 msgid "``intel-32``;" msgstr "``intel-32``;" -#: ../../using/configure.rst:668 +#: ../../using/configure.rst:940 msgid "``intel-64``;" msgstr "``intel-64``;" -#: ../../using/configure.rst:669 +#: ../../using/configure.rst:941 msgid "``all``." msgstr "``all``。" -#: ../../using/configure.rst:673 +#: ../../using/configure.rst:945 msgid "" "Specify the name for the python framework on macOS only valid when :option:" "`--enable-framework` is set (default: ``Python``)." msgstr "" -#: ../../using/configure.rst:678 +#: ../../using/configure.rst:951 +msgid "" +"The Python standard library contains strings that are known to trigger " +"automated inspection tool errors when submitted for distribution by the " +"macOS and iOS App Stores. If enabled, this option will apply the list of " +"patches that are known to correct app store compliance. A custom patch file " +"can also be specified. This option is disabled by default." +msgstr "" + +#: ../../using/configure.rst:960 +#, fuzzy +msgid "iOS Options" +msgstr "macOS 選項" + +#: ../../using/configure.rst:962 +#, fuzzy +msgid "See :source:`iOS/README.rst`." +msgstr "參閱 ``Mac/README.rst``。" + +#: ../../using/configure.rst:966 +msgid "" +"Create a Python.framework. Unlike macOS, the *INSTALLDIR* argument " +"specifying the installation path is mandatory." +msgstr "" + +#: ../../using/configure.rst:971 +msgid "Specify the name for the framework (default: ``Python``)." +msgstr "" + +#: ../../using/configure.rst:975 msgid "Cross Compiling Options" msgstr "" -#: ../../using/configure.rst:680 +#: ../../using/configure.rst:977 msgid "" "Cross compiling, also known as cross building, can be used to build Python " "for another CPU architecture or platform. Cross compiling requires a Python " @@ -1005,28 +1428,28 @@ msgid "" "match the version of the cross compiled host Python." msgstr "" -#: ../../using/configure.rst:687 +#: ../../using/configure.rst:984 msgid "" "configure for building on BUILD, usually guessed by :program:`config.guess`." msgstr "" -#: ../../using/configure.rst:691 +#: ../../using/configure.rst:988 msgid "cross-compile to build programs to run on HOST (target platform)" msgstr "" -#: ../../using/configure.rst:695 +#: ../../using/configure.rst:992 msgid "path to build ``python`` binary for cross compiling" msgstr "" -#: ../../using/configure.rst:701 +#: ../../using/configure.rst:998 msgid "An environment variable that points to a file with configure overrides." msgstr "" -#: ../../using/configure.rst:703 +#: ../../using/configure.rst:1000 msgid "Example *config.site* file:" msgstr "" -#: ../../using/configure.rst:705 +#: ../../using/configure.rst:1002 msgid "" "# config.site-aarch64\n" "ac_cv_buggy_getaddrinfo=no\n" @@ -1038,11 +1461,15 @@ msgstr "" "ac_cv_file__dev_ptmx=yes\n" "ac_cv_file__dev_ptc=no" -#: ../../using/configure.rst:713 +#: ../../using/configure.rst:1011 +msgid "Program to run CPython for the host platform for cross-compilation." +msgstr "" + +#: ../../using/configure.rst:1016 msgid "Cross compiling example::" msgstr "" -#: ../../using/configure.rst:715 +#: ../../using/configure.rst:1018 msgid "" "CONFIG_SITE=config.site-aarch64 ../configure \\\n" " --build=x86_64-pc-linux-gnu \\\n" @@ -1054,117 +1481,207 @@ msgstr "" " --host=aarch64-unknown-linux-gnu \\\n" " --with-build-python=../x86_64/python" -#: ../../using/configure.rst:722 +#: ../../using/configure.rst:1025 msgid "Python Build System" msgstr "" -#: ../../using/configure.rst:725 +#: ../../using/configure.rst:1028 msgid "Main files of the build system" msgstr "" -#: ../../using/configure.rst:727 +#: ../../using/configure.rst:1030 msgid ":file:`configure.ac` => :file:`configure`;" msgstr ":file:`configure.ac` => :file:`configure`\\ ;" -#: ../../using/configure.rst:728 +#: ../../using/configure.rst:1031 msgid "" ":file:`Makefile.pre.in` => :file:`Makefile` (created by :file:`configure`);" msgstr "" -#: ../../using/configure.rst:729 +#: ../../using/configure.rst:1032 msgid ":file:`pyconfig.h` (created by :file:`configure`);" msgstr ":file:`pyconfig.h` (created by :file:`configure`)\\ ;" -#: ../../using/configure.rst:730 +#: ../../using/configure.rst:1033 msgid "" ":file:`Modules/Setup`: C extensions built by the Makefile using :file:" "`Module/makesetup` shell script;" msgstr "" -#: ../../using/configure.rst:734 +#: ../../using/configure.rst:1037 msgid "Main build steps" msgstr "主要建置步驟" -#: ../../using/configure.rst:736 +#: ../../using/configure.rst:1039 msgid "C files (``.c``) are built as object files (``.o``)." msgstr "" -#: ../../using/configure.rst:737 +#: ../../using/configure.rst:1040 msgid "A static ``libpython`` library (``.a``) is created from objects files." msgstr "" -#: ../../using/configure.rst:738 +#: ../../using/configure.rst:1041 msgid "" "``python.o`` and the static ``libpython`` library are linked into the final " "``python`` program." msgstr "" -#: ../../using/configure.rst:740 +#: ../../using/configure.rst:1043 msgid "C extensions are built by the Makefile (see :file:`Modules/Setup`)." msgstr "" -#: ../../using/configure.rst:743 +#: ../../using/configure.rst:1046 msgid "Main Makefile targets" msgstr "主要 Makefile 目標" -#: ../../using/configure.rst:745 -msgid "``make``: Build Python with the standard library." +#: ../../using/configure.rst:1049 +msgid "make" msgstr "" -#: ../../using/configure.rst:746 +#: ../../using/configure.rst:1051 +msgid "" +"For the most part, when rebuilding after editing some code or refreshing " +"your checkout from upstream, all you need to do is execute ``make``, which " +"(per Make's semantics) builds the default target, the first one defined in " +"the Makefile. By tradition (including in the CPython project) this is " +"usually the ``all`` target. The ``configure`` script expands an ``autoconf`` " +"variable, ``@DEF_MAKE_ALL_RULE@`` to describe precisely which targets ``make " +"all`` will build. The three choices are:" +msgstr "" + +#: ../../using/configure.rst:1060 +msgid "``profile-opt`` (configured with ``--enable-optimizations``)" +msgstr "" + +#: ../../using/configure.rst:1061 +msgid "``build_wasm`` (configured with ``--with-emscripten-target``)" +msgstr "" + +#: ../../using/configure.rst:1062 msgid "" -"``make platform:``: build the ``python`` program, but don't build the " -"standard library extension modules." +"``build_all`` (configured without explicitly using either of the others)" msgstr "" -#: ../../using/configure.rst:748 +#: ../../using/configure.rst:1064 msgid "" -"``make profile-opt``: build Python using Profile Guided Optimization (PGO). " -"You can use the configure :option:`--enable-optimizations` option to make " -"this the default target of the ``make`` command (``make all`` or just " -"``make``)." +"Depending on the most recent source file changes, Make will rebuild any " +"targets (object files and executables) deemed out-of-date, including running " +"``configure`` again if necessary. Source/target dependencies are many and " +"maintained manually however, so Make sometimes doesn't have all the " +"information necessary to correctly detect all targets which need to be " +"rebuilt. Depending on which targets aren't rebuilt, you might experience a " +"number of problems. If you have build or test problems which you can't " +"otherwise explain, ``make clean && make`` should work around most dependency " +"problems, at the expense of longer build times." msgstr "" -#: ../../using/configure.rst:752 +#: ../../using/configure.rst:1077 +msgid "make platform" +msgstr "" + +#: ../../using/configure.rst:1079 msgid "" -"``make buildbottest``: Build Python and run the Python test suite, the same " -"way than buildbots test Python. Set ``TESTTIMEOUT`` variable (in seconds) to " -"change the test timeout (1200 by default: 20 minutes)." +"Build the ``python`` program, but don't build the standard library extension " +"modules. This generates a file named ``platform`` which contains a single " +"line describing the details of the build platform, e.g., ``macosx-14.3-" +"arm64-3.12`` or ``linux-x86_64-3.13``." msgstr "" -#: ../../using/configure.rst:755 -msgid "``make install``: Build and install Python." +#: ../../using/configure.rst:1086 +msgid "make profile-opt" msgstr "" -#: ../../using/configure.rst:756 +#: ../../using/configure.rst:1088 msgid "" -"``make regen-all``: Regenerate (almost) all generated files; ``make regen-" -"stdlib-module-names`` and ``autoconf`` must be run separately for the " -"remaining generated files." +"Build Python using profile-guided optimization (PGO). You can use the " +"configure :option:`--enable-optimizations` option to make this the default " +"target of the ``make`` command (``make all`` or just ``make``)." msgstr "" -#: ../../using/configure.rst:759 -msgid "``make clean``: Remove built files." +#: ../../using/configure.rst:1096 +msgid "make clean" +msgstr "" + +#: ../../using/configure.rst:1098 +msgid "Remove built files." +msgstr "" + +#: ../../using/configure.rst:1102 +msgid "make distclean" +msgstr "" + +#: ../../using/configure.rst:1104 +msgid "" +"In addition to the work done by ``make clean``, remove files created by the " +"configure script. ``configure`` will have to be run before building again. " +"[#]_" msgstr "" -#: ../../using/configure.rst:760 +#: ../../using/configure.rst:1110 +msgid "make install" +msgstr "" + +#: ../../using/configure.rst:1112 +msgid "Build the ``all`` target and install Python." +msgstr "" + +#: ../../using/configure.rst:1116 +msgid "make test" +msgstr "" + +#: ../../using/configure.rst:1118 msgid "" -"``make distclean``: Same than ``make clean``, but remove also files created " -"by the configure script." +"Build the ``all`` target and run the Python test suite with the ``--fast-" +"ci`` option. Variables:" +msgstr "" + +#: ../../using/configure.rst:1121 +msgid "``TESTOPTS``: additional regrtest command-line options." msgstr "" -#: ../../using/configure.rst:764 +#: ../../using/configure.rst:1122 +msgid "``TESTPYTHONOPTS``: additional Python command-line options." +msgstr "" + +#: ../../using/configure.rst:1123 +msgid "``TESTTIMEOUT``: timeout in seconds (default: 10 minutes)." +msgstr "" + +#: ../../using/configure.rst:1127 +#, fuzzy +msgid "make buildbottest" +msgstr "主要建置步驟" + +#: ../../using/configure.rst:1129 +msgid "" +"This is similar to ``make test``, but uses the ``--slow-ci`` option and " +"default timeout of 20 minutes, instead of ``--fast-ci`` option." +msgstr "" + +#: ../../using/configure.rst:1134 +msgid "make regen-all" +msgstr "" + +#: ../../using/configure.rst:1136 +msgid "" +"Regenerate (almost) all generated files. These include (but are not limited " +"to) bytecode cases, and parser generator file. ``make regen-stdlib-module-" +"names`` and ``autoconf`` must be run separately for the remaining `generated " +"files <#generated-files>`_." +msgstr "" + +#: ../../using/configure.rst:1143 msgid "C extensions" msgstr "C 擴充模組" -#: ../../using/configure.rst:766 +#: ../../using/configure.rst:1145 msgid "" "Some C extensions are built as built-in modules, like the ``sys`` module. " "They are built with the ``Py_BUILD_CORE_BUILTIN`` macro defined. Built-in " "modules have no ``__file__`` attribute:" msgstr "" -#: ../../using/configure.rst:770 +#: ../../using/configure.rst:1149 msgid "" ">>> import sys\n" ">>> sys\n" @@ -1175,14 +1692,14 @@ msgid "" "AttributeError: module 'sys' has no attribute '__file__'" msgstr "" -#: ../../using/configure.rst:780 +#: ../../using/configure.rst:1159 msgid "" "Other C extensions are built as dynamic libraries, like the ``_asyncio`` " "module. They are built with the ``Py_BUILD_CORE_MODULE`` macro defined. " "Example on Linux x86-64:" msgstr "" -#: ../../using/configure.rst:784 +#: ../../using/configure.rst:1163 msgid "" ">>> import _asyncio\n" ">>> _asyncio\n" @@ -1198,7 +1715,7 @@ msgstr "" ">>> _asyncio.__file__\n" "'/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'" -#: ../../using/configure.rst:792 +#: ../../using/configure.rst:1171 msgid "" ":file:`Modules/Setup` is used to generate Makefile targets to build C " "extensions. At the beginning of the files, C extensions are built as built-" @@ -1206,303 +1723,312 @@ msgid "" "dynamic libraries." msgstr "" -#: ../../using/configure.rst:796 +#: ../../using/configure.rst:1175 msgid "" "The :c:macro:`!PyAPI_FUNC()`, :c:macro:`!PyAPI_DATA()` and :c:macro:" "`PyMODINIT_FUNC` macros of :file:`Include/exports.h` are defined differently " "depending if the ``Py_BUILD_CORE_MODULE`` macro is defined:" msgstr "" -#: ../../using/configure.rst:800 +#: ../../using/configure.rst:1179 msgid "Use ``Py_EXPORTED_SYMBOL`` if the ``Py_BUILD_CORE_MODULE`` is defined" msgstr "如果定義了 ``Py_BUILD_CORE_MODULE``,則使用 ``Py_EXPORTED_SYMBOL``" -#: ../../using/configure.rst:801 +#: ../../using/configure.rst:1180 msgid "Use ``Py_IMPORTED_SYMBOL`` otherwise." msgstr "否則使用 ``Py_IMPORTED_SYMBOL``。" -#: ../../using/configure.rst:803 +#: ../../using/configure.rst:1182 msgid "" "If the ``Py_BUILD_CORE_BUILTIN`` macro is used by mistake on a C extension " "built as a shared library, its :samp:`PyInit_{xxx}()` function is not " "exported, causing an :exc:`ImportError` on import." msgstr "" -#: ../../using/configure.rst:809 +#: ../../using/configure.rst:1188 msgid "Compiler and linker flags" msgstr "" -#: ../../using/configure.rst:811 +#: ../../using/configure.rst:1190 msgid "" "Options set by the ``./configure`` script and environment variables and used " "by ``Makefile``." msgstr "" -#: ../../using/configure.rst:815 +#: ../../using/configure.rst:1194 msgid "Preprocessor flags" msgstr "" -#: ../../using/configure.rst:819 +#: ../../using/configure.rst:1198 msgid "" "Value of :envvar:`CPPFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:825 +#: ../../using/configure.rst:1204 msgid "" "(Objective) C/C++ preprocessor flags, e.g. :samp:`-I{include_dir}` if you " "have headers in a nonstandard directory *include_dir*." msgstr "" -#: ../../using/configure.rst:828 ../../using/configure.rst:1018 +#: ../../using/configure.rst:1207 ../../using/configure.rst:1397 msgid "" "Both :envvar:`CPPFLAGS` and :envvar:`LDFLAGS` need to contain the shell's " "value to be able to build extension modules using the directories specified " "in the environment variables." msgstr "" -#: ../../using/configure.rst:838 +#: ../../using/configure.rst:1217 msgid "" "Extra preprocessor flags added for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:840 +#: ../../using/configure.rst:1219 msgid "" "Default: ``$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) " "$(CPPFLAGS)``." msgstr "" -#: ../../using/configure.rst:845 +#: ../../using/configure.rst:1224 msgid "Compiler flags" msgstr "編譯器旗標" -#: ../../using/configure.rst:849 -msgid "C compiler command." -msgstr "C 編譯器指令。" - -#: ../../using/configure.rst:851 +#: ../../using/configure.rst:1230 msgid "Example: ``gcc -pthread``." msgstr "" -#: ../../using/configure.rst:855 +#: ../../using/configure.rst:1234 msgid "C++ compiler command." msgstr "C++ 編譯器指令。" -#: ../../using/configure.rst:857 +#: ../../using/configure.rst:1236 msgid "Example: ``g++ -pthread``." msgstr "範例:``g++ -pthread``。" -#: ../../using/configure.rst:861 -msgid "C compiler flags." -msgstr "C 編譯器旗標。" - -#: ../../using/configure.rst:865 +#: ../../using/configure.rst:1244 msgid "" ":envvar:`CFLAGS_NODIST` is used for building the interpreter and stdlib C " "extensions. Use it when a compiler flag should *not* be part of :envvar:" "`CFLAGS` once Python is installed (:gh:`65320`)." msgstr "" -#: ../../using/configure.rst:869 +#: ../../using/configure.rst:1248 msgid "In particular, :envvar:`CFLAGS` should not contain:" msgstr "" -#: ../../using/configure.rst:871 +#: ../../using/configure.rst:1250 msgid "" "the compiler flag ``-I`` (for setting the search path for include files). " "The ``-I`` flags are processed from left to right, and any flags in :envvar:" "`CFLAGS` would take precedence over user- and package-supplied ``-I`` flags." msgstr "" -#: ../../using/configure.rst:876 +#: ../../using/configure.rst:1255 msgid "" "hardening flags such as ``-Werror`` because distributions cannot control " "whether packages installed by users conform to such heightened standards." msgstr "" -#: ../../using/configure.rst:884 +#: ../../using/configure.rst:1263 msgid "" "Options passed to the :mod:`compileall` command line when building PYC files " "in ``make install``. Default: ``-j0``." msgstr "" -#: ../../using/configure.rst:891 +#: ../../using/configure.rst:1270 msgid "Extra C compiler flags." msgstr "額外的 C 編譯器旗標。" -#: ../../using/configure.rst:895 +#: ../../using/configure.rst:1274 msgid "" "Value of :envvar:`CFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:902 +#: ../../using/configure.rst:1281 msgid "" "Value of :envvar:`CFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: ../../using/configure.rst:909 +#: ../../using/configure.rst:1288 msgid "Base compiler flags." msgstr "基本編譯器旗標。" -#: ../../using/configure.rst:913 +#: ../../using/configure.rst:1292 msgid "Optimization flags." msgstr "最佳化旗標。" -#: ../../using/configure.rst:917 +#: ../../using/configure.rst:1296 msgid "Strict or non-strict aliasing flags used to compile ``Python/dtoa.c``." msgstr "" -#: ../../using/configure.rst:923 +#: ../../using/configure.rst:1302 msgid "Compiler flags used to build a shared library." msgstr "" -#: ../../using/configure.rst:925 +#: ../../using/configure.rst:1304 msgid "For example, ``-fPIC`` is used on Linux and on BSD." msgstr "例如說 ``-fPIC`` 被使用於 Linux 與 BSD 上。" -#: ../../using/configure.rst:929 +#: ../../using/configure.rst:1308 msgid "Extra C flags added for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:931 +#: ../../using/configure.rst:1310 msgid "" "Default: ``$(CCSHARED)`` when :option:`--enable-shared` is used, or an empty " "string otherwise." msgstr "" -#: ../../using/configure.rst:936 +#: ../../using/configure.rst:1315 msgid "" "Default: ``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) " "$(EXTRA_CFLAGS)``." msgstr "" -#: ../../using/configure.rst:940 +#: ../../using/configure.rst:1319 msgid "" "Default: ``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/" "internal``." msgstr "" -#: ../../using/configure.rst:946 +#: ../../using/configure.rst:1325 msgid "C flags used for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:948 +#: ../../using/configure.rst:1327 msgid "" "Default: ``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) " "$(CFLAGSFORSHARED)``." msgstr "" -#: ../../using/configure.rst:954 +#: ../../using/configure.rst:1333 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``." msgstr "" -#: ../../using/configure.rst:960 +#: ../../using/configure.rst:1339 msgid "" "Compiler flags to build a standard library extension module as a built-in " "module, like the :mod:`posix` module." msgstr "" -#: ../../using/configure.rst:963 +#: ../../using/configure.rst:1342 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``." msgstr "" -#: ../../using/configure.rst:969 +#: ../../using/configure.rst:1348 msgid "Purify command. Purify is a memory debugger program." msgstr "" -#: ../../using/configure.rst:971 +#: ../../using/configure.rst:1350 msgid "Default: empty string (not used)." msgstr "" -#: ../../using/configure.rst:975 +#: ../../using/configure.rst:1354 msgid "Linker flags" msgstr "" -#: ../../using/configure.rst:979 +#: ../../using/configure.rst:1358 msgid "" "Linker command used to build programs like ``python`` and ``_testembed``." msgstr "" -#: ../../using/configure.rst:981 +#: ../../using/configure.rst:1360 msgid "Default: ``$(PURIFY) $(CC)``." msgstr "" -#: ../../using/configure.rst:985 +#: ../../using/configure.rst:1364 msgid "" "Value of :envvar:`LDFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:987 +#: ../../using/configure.rst:1366 msgid "" "Avoid assigning :envvar:`CFLAGS`, :envvar:`LDFLAGS`, etc. so users can use " "them on the command line to append to these values without stomping the pre-" "set values." msgstr "" -#: ../../using/configure.rst:995 +#: ../../using/configure.rst:1374 msgid "" ":envvar:`LDFLAGS_NODIST` is used in the same manner as :envvar:" "`CFLAGS_NODIST`. Use it when a linker flag should *not* be part of :envvar:" "`LDFLAGS` once Python is installed (:gh:`65320`)." msgstr "" -#: ../../using/configure.rst:999 +#: ../../using/configure.rst:1378 msgid "In particular, :envvar:`LDFLAGS` should not contain:" msgstr "" -#: ../../using/configure.rst:1001 +#: ../../using/configure.rst:1380 msgid "" "the compiler flag ``-L`` (for setting the search path for libraries). The ``-" "L`` flags are processed from left to right, and any flags in :envvar:" "`LDFLAGS` would take precedence over user- and package-supplied ``-L`` flags." msgstr "" -#: ../../using/configure.rst:1008 +#: ../../using/configure.rst:1387 msgid "" "Value of :envvar:`LDFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: ../../using/configure.rst:1015 +#: ../../using/configure.rst:1394 msgid "" "Linker flags, e.g. :samp:`-L{lib_dir}` if you have libraries in a " "nonstandard directory *lib_dir*." msgstr "" -#: ../../using/configure.rst:1024 +#: ../../using/configure.rst:1403 msgid "" "Linker flags to pass libraries to the linker when linking the Python " "executable." msgstr "" -#: ../../using/configure.rst:1027 +#: ../../using/configure.rst:1406 msgid "Example: ``-lrt``." msgstr "範例:``-lrt``。" -#: ../../using/configure.rst:1031 +#: ../../using/configure.rst:1410 msgid "Command to build a shared library." msgstr "" -#: ../../using/configure.rst:1033 +#: ../../using/configure.rst:1412 msgid "Default: ``@LDSHARED@ $(PY_LDFLAGS)``." msgstr "預設值:``@LDSHARED@ $(PY_LDFLAGS)``。" -#: ../../using/configure.rst:1037 +#: ../../using/configure.rst:1416 msgid "Command to build ``libpython`` shared library." msgstr "" -#: ../../using/configure.rst:1039 +#: ../../using/configure.rst:1418 msgid "Default: ``@BLDSHARED@ $(PY_CORE_LDFLAGS)``." msgstr "預設值:``@BLDSHARED@ $(PY_CORE_LDFLAGS)``。" -#: ../../using/configure.rst:1043 +#: ../../using/configure.rst:1422 msgid "Default: ``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``." msgstr "預設值:``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``。" -#: ../../using/configure.rst:1047 +#: ../../using/configure.rst:1426 msgid "Default: ``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``." msgstr "預設值:``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``。" -#: ../../using/configure.rst:1053 +#: ../../using/configure.rst:1432 msgid "Linker flags used for building the interpreter object files." msgstr "" + +#: ../../using/configure.rst:1438 +msgid "Footnotes" +msgstr "" + +#: ../../using/configure.rst:1439 +msgid "" +"``git clean -fdx`` is an even more extreme way to \"clean\" your checkout. " +"It removes all files not known to Git. When bug hunting using ``git " +"bisect``, this is `recommended between probes <https://github.com/python/" +"cpython/issues/114505#issuecomment-1907021718>`_ to guarantee a completely " +"clean build. **Use with care**, as it will delete all files not checked into " +"Git, including your new, uncommitted work." +msgstr "" + +#~ msgid "Define the ``WITH_EDITLINE`` macro." +#~ msgstr "定義 ``WITH_EDITLINE`` 巨集。" diff --git a/using/ios.po b/using/ios.po new file mode 100644 index 0000000000..2d702dba27 --- /dev/null +++ b/using/ios.po @@ -0,0 +1,565 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../using/ios.rst:5 +msgid "Using Python on iOS" +msgstr "" + +#: ../../using/ios.rst:0 +msgid "Authors" +msgstr "" + +#: ../../using/ios.rst:8 +msgid "Russell Keith-Magee (2024-03)" +msgstr "" + +#: ../../using/ios.rst:10 +msgid "" +"Python on iOS is unlike Python on desktop platforms. On a desktop platform, " +"Python is generally installed as a system resource that can be used by any " +"user of that computer. Users then interact with Python by running a :program:" +"`python` executable and entering commands at an interactive prompt, or by " +"running a Python script." +msgstr "" + +#: ../../using/ios.rst:16 +msgid "" +"On iOS, there is no concept of installing as a system resource. The only " +"unit of software distribution is an \"app\". There is also no console where " +"you could run a :program:`python` executable, or interact with a Python REPL." +msgstr "" + +#: ../../using/ios.rst:20 +msgid "" +"As a result, the only way you can use Python on iOS is in embedded mode - " +"that is, by writing a native iOS application, and embedding a Python " +"interpreter using ``libPython``, and invoking Python code using the :ref:" +"`Python embedding API <embedding>`. The full Python interpreter, the " +"standard library, and all your Python code is then packaged as a standalone " +"bundle that can be distributed via the iOS App Store." +msgstr "" + +#: ../../using/ios.rst:27 +msgid "" +"If you're looking to experiment for the first time with writing an iOS app " +"in Python, projects such as `BeeWare <https://beeware.org>`__ and `Kivy " +"<https://kivy.org>`__ will provide a much more approachable user experience. " +"These projects manage the complexities associated with getting an iOS " +"project running, so you only need to deal with the Python code itself." +msgstr "" + +#: ../../using/ios.rst:34 +msgid "Python at runtime on iOS" +msgstr "" + +#: ../../using/ios.rst:37 +msgid "iOS version compatibility" +msgstr "" + +#: ../../using/ios.rst:39 +msgid "" +"The minimum supported iOS version is specified at compile time, using the :" +"option:`--host` option to ``configure``. By default, when compiled for iOS, " +"Python will be compiled with a minimum supported iOS version of 13.0. To use " +"a different minimum iOS version, provide the version number as part of the :" +"option:`!--host` argument - for example, ``--host=arm64-apple-ios15.4-" +"simulator`` would compile an ARM64 simulator build with a deployment target " +"of 15.4." +msgstr "" + +#: ../../using/ios.rst:48 +msgid "Platform identification" +msgstr "" + +#: ../../using/ios.rst:50 +msgid "" +"When executing on iOS, ``sys.platform`` will report as ``ios``. This value " +"will be returned on an iPhone or iPad, regardless of whether the app is " +"running on the simulator or a physical device." +msgstr "" + +#: ../../using/ios.rst:54 +msgid "" +"Information about the specific runtime environment, including the iOS " +"version, device model, and whether the device is a simulator, can be " +"obtained using :func:`platform.ios_ver`. :func:`platform.system` will report " +"``iOS`` or ``iPadOS``, depending on the device." +msgstr "" + +#: ../../using/ios.rst:59 +msgid "" +":func:`os.uname` reports kernel-level details; it will report a name of " +"``Darwin``." +msgstr "" + +#: ../../using/ios.rst:63 +msgid "Standard library availability" +msgstr "" + +#: ../../using/ios.rst:65 +msgid "" +"The Python standard library has some notable omissions and restrictions on " +"iOS. See the :ref:`API availability guide for iOS <iOS-availability>` for " +"details." +msgstr "" + +#: ../../using/ios.rst:70 +msgid "Binary extension modules" +msgstr "" + +#: ../../using/ios.rst:72 +msgid "" +"One notable difference about iOS as a platform is that App Store " +"distribution imposes hard requirements on the packaging of an application. " +"One of these requirements governs how binary extension modules are " +"distributed." +msgstr "" + +#: ../../using/ios.rst:76 +msgid "" +"The iOS App Store requires that *all* binary modules in an iOS app must be " +"dynamic libraries, contained in a framework with appropriate metadata, " +"stored in the ``Frameworks`` folder of the packaged app. There can be only a " +"single binary per framework, and there can be no executable binary material " +"outside the ``Frameworks`` folder." +msgstr "" + +#: ../../using/ios.rst:82 +msgid "" +"This conflicts with the usual Python approach for distributing binaries, " +"which allows a binary extension module to be loaded from any location on " +"``sys.path``. To ensure compliance with App Store policies, an iOS project " +"must post-process any Python packages, converting ``.so`` binary modules " +"into individual standalone frameworks with appropriate metadata and signing. " +"For details on how to perform this post-processing, see the guide for :ref:" +"`adding Python to your project <adding-ios>`." +msgstr "" + +#: ../../using/ios.rst:90 +msgid "" +"To help Python discover binaries in their new location, the original ``.so`` " +"file on ``sys.path`` is replaced with a ``.fwork`` file. This file is a text " +"file containing the location of the framework binary, relative to the app " +"bundle. To allow the framework to resolve back to the original location, the " +"framework must contain a ``.origin`` file that contains the location of the " +"``.fwork`` file, relative to the app bundle." +msgstr "" + +#: ../../using/ios.rst:97 +msgid "" +"For example, consider the case of an import ``from foo.bar import _whiz``, " +"where ``_whiz`` is implemented with the binary module ``sources/foo/bar/" +"_whiz.abi3.so``, with ``sources`` being the location registered on ``sys." +"path``, relative to the application bundle. This module *must* be " +"distributed as ``Frameworks/foo.bar._whiz.framework/foo.bar._whiz`` " +"(creating the framework name from the full import path of the module), with " +"an ``Info.plist`` file in the ``.framework`` directory identifying the " +"binary as a framework. The ``foo.bar._whiz`` module would be represented in " +"the original location with a ``sources/foo/bar/_whiz.abi3.fwork`` marker " +"file, containing the path ``Frameworks/foo.bar._whiz/foo.bar._whiz``. The " +"framework would also contain ``Frameworks/foo.bar._whiz.framework/foo.bar." +"_whiz.origin``, containing the path to the ``.fwork`` file." +msgstr "" + +#: ../../using/ios.rst:110 +msgid "" +"When running on iOS, the Python interpreter will install an :class:" +"`~importlib.machinery.AppleFrameworkLoader` that is able to read and import " +"``.fwork`` files. Once imported, the ``__file__`` attribute of the binary " +"module will report as the location of the ``.fwork`` file. However, the :" +"class:`~importlib.machinery.ModuleSpec` for the loaded module will report " +"the ``origin`` as the location of the binary in the framework folder." +msgstr "" + +#: ../../using/ios.rst:118 +msgid "Compiler stub binaries" +msgstr "" + +#: ../../using/ios.rst:120 +msgid "" +"Xcode doesn't expose explicit compilers for iOS; instead, it uses an " +"``xcrun`` script that resolves to a full compiler path (e.g., ``xcrun --sdk " +"iphoneos clang`` to get the ``clang`` for an iPhone device). However, using " +"this script poses two problems:" +msgstr "" + +#: ../../using/ios.rst:125 +msgid "" +"The output of ``xcrun`` includes paths that are machine specific, resulting " +"in a sysconfig module that cannot be shared between users; and" +msgstr "" + +#: ../../using/ios.rst:128 +msgid "" +"It results in ``CC``/``CPP``/``LD``/``AR`` definitions that include spaces. " +"There is a lot of C ecosystem tooling that assumes that you can split a " +"command line at the first space to get the path to the compiler executable; " +"this isn't the case when using ``xcrun``." +msgstr "" + +#: ../../using/ios.rst:133 +msgid "" +"To avoid these problems, Python provided stubs for these tools. These stubs " +"are shell script wrappers around the underingly ``xcrun`` tools, distributed " +"in a ``bin`` folder distributed alongside the compiled iOS framework. These " +"scripts are relocatable, and will always resolve to the appropriate local " +"system paths. By including these scripts in the bin folder that accompanies " +"a framework, the contents of the ``sysconfig`` module becomes useful for end-" +"users to compile their own modules. When compiling third-party Python " +"modules for iOS, you should ensure these stub binaries are on your path." +msgstr "" + +#: ../../using/ios.rst:143 +msgid "Installing Python on iOS" +msgstr "" + +#: ../../using/ios.rst:146 +msgid "Tools for building iOS apps" +msgstr "" + +#: ../../using/ios.rst:148 +msgid "" +"Building for iOS requires the use of Apple's Xcode tooling. It is strongly " +"recommended that you use the most recent stable release of Xcode. This will " +"require the use of the most (or second-most) recently released macOS " +"version, as Apple does not maintain Xcode for older macOS versions. The " +"Xcode Command Line Tools are not sufficient for iOS development; you need a " +"*full* Xcode install." +msgstr "" + +#: ../../using/ios.rst:155 +msgid "" +"If you want to run your code on the iOS simulator, you'll also need to " +"install an iOS Simulator Platform. You should be prompted to select an iOS " +"Simulator Platform when you first run Xcode. Alternatively, you can add an " +"iOS Simulator Platform by selecting from the Platforms tab of the Xcode " +"Settings panel." +msgstr "" + +#: ../../using/ios.rst:163 +msgid "Adding Python to an iOS project" +msgstr "" + +#: ../../using/ios.rst:165 +msgid "" +"Python can be added to any iOS project, using either Swift or Objective C. " +"The following examples will use Objective C; if you are using Swift, you may " +"find a library like `PythonKit <https://github.com/pvieito/PythonKit>`__ to " +"be helpful." +msgstr "" + +#: ../../using/ios.rst:170 +msgid "To add Python to an iOS Xcode project:" +msgstr "" + +#: ../../using/ios.rst:172 +msgid "" +"Build or obtain a Python ``XCFramework``. See the instructions in :source:" +"`iOS/README.rst` (in the CPython source distribution) for details on how to " +"build a Python ``XCFramework``. At a minimum, you will need a build that " +"supports ``arm64-apple-ios``, plus one of either ``arm64-apple-ios-" +"simulator`` or ``x86_64-apple-ios-simulator``." +msgstr "" + +#: ../../using/ios.rst:178 +msgid "" +"Drag the ``XCframework`` into your iOS project. In the following " +"instructions, we'll assume you've dropped the ``XCframework`` into the root " +"of your project; however, you can use any other location that you want by " +"adjusting paths as needed." +msgstr "" + +#: ../../using/ios.rst:183 +msgid "" +"Drag the ``iOS/Resources/dylib-Info-template.plist`` file into your project, " +"and ensure it is associated with the app target." +msgstr "" + +#: ../../using/ios.rst:186 +msgid "" +"Add your application code as a folder in your Xcode project. In the " +"following instructions, we'll assume that your user code is in a folder " +"named ``app`` in the root of your project; you can use any other location by " +"adjusting paths as needed. Ensure that this folder is associated with your " +"app target." +msgstr "" + +#: ../../using/ios.rst:192 +msgid "" +"Select the app target by selecting the root node of your Xcode project, then " +"the target name in the sidebar that appears." +msgstr "" + +#: ../../using/ios.rst:195 +msgid "" +"In the \"General\" settings, under \"Frameworks, Libraries and Embedded " +"Content\", add ``Python.xcframework``, with \"Embed & Sign\" selected." +msgstr "" + +#: ../../using/ios.rst:198 +msgid "In the \"Build Settings\" tab, modify the following:" +msgstr "" + +#: ../../using/ios.rst:200 +msgid "Build Options" +msgstr "" + +#: ../../using/ios.rst:202 +msgid "User Script Sandboxing: No" +msgstr "" + +#: ../../using/ios.rst:203 +msgid "Enable Testability: Yes" +msgstr "" + +#: ../../using/ios.rst:205 +msgid "Search Paths" +msgstr "" + +#: ../../using/ios.rst:207 +msgid "Framework Search Paths: ``$(PROJECT_DIR)``" +msgstr "" + +#: ../../using/ios.rst:208 +msgid "" +"Header Search Paths: ``\"$(BUILT_PRODUCTS_DIR)/Python.framework/Headers\"``" +msgstr "" + +#: ../../using/ios.rst:210 +msgid "Apple Clang - Warnings - All languages" +msgstr "" + +#: ../../using/ios.rst:212 +msgid "Quoted Include In Framework Header: No" +msgstr "" + +#: ../../using/ios.rst:214 +msgid "" +"Add a build step that copies the Python standard library into your app. In " +"the \"Build Phases\" tab, add a new \"Run Script\" build step *before* the " +"\"Embed Frameworks\" step, but *after* the \"Copy Bundle Resources\" step. " +"Name the step \"Install Target Specific Python Standard Library\", disable " +"the \"Based on dependency analysis\" checkbox, and set the script content to:" +msgstr "" + +#: ../../using/ios.rst:220 +msgid "" +"set -e\n" +"\n" +"mkdir -p \"$CODESIGNING_FOLDER_PATH/python/lib\"\n" +"if [ \"$EFFECTIVE_PLATFORM_NAME\" = \"-iphonesimulator\" ]; then\n" +" echo \"Installing Python modules for iOS Simulator\"\n" +" rsync -au --delete \"$PROJECT_DIR/Python.xcframework/ios-arm64_x86_64-" +"simulator/lib/\" \"$CODESIGNING_FOLDER_PATH/python/lib/\"\n" +"else\n" +" echo \"Installing Python modules for iOS Device\"\n" +" rsync -au --delete \"$PROJECT_DIR/Python.xcframework/ios-arm64/lib/\" " +"\"$CODESIGNING_FOLDER_PATH/python/lib/\"\n" +"fi" +msgstr "" + +#: ../../using/ios.rst:233 +msgid "" +"Note that the name of the simulator \"slice\" in the XCframework may be " +"different, depending the CPU architectures your ``XCFramework`` supports." +msgstr "" + +#: ../../using/ios.rst:236 +msgid "" +"Add a second build step that processes the binary extension modules in the " +"standard library into \"Framework\" format. Add a \"Run Script\" build step " +"*directly after* the one you added in step 8, named \"Prepare Python Binary " +"Modules\". It should also have \"Based on dependency analysis\" unchecked, " +"with the following script content:" +msgstr "" + +#: ../../using/ios.rst:242 +msgid "" +"set -e\n" +"\n" +"install_dylib () {\n" +" INSTALL_BASE=$1\n" +" FULL_EXT=$2\n" +"\n" +" # The name of the extension file\n" +" EXT=$(basename \"$FULL_EXT\")\n" +" # The location of the extension file, relative to the bundle\n" +" RELATIVE_EXT=${FULL_EXT#$CODESIGNING_FOLDER_PATH/}\n" +" # The path to the extension file, relative to the install base\n" +" PYTHON_EXT=${RELATIVE_EXT/$INSTALL_BASE/}\n" +" # The full dotted name of the extension module, constructed from the " +"file path.\n" +" FULL_MODULE_NAME=$(echo $PYTHON_EXT | cut -d \".\" -f 1 | tr \"/\" \"." +"\");\n" +" # A bundle identifier; not actually used, but required by Xcode " +"framework packaging\n" +" FRAMEWORK_BUNDLE_ID=$(echo $PRODUCT_BUNDLE_IDENTIFIER.$FULL_MODULE_NAME " +"| tr \"_\" \"-\")\n" +" # The name of the framework folder.\n" +" FRAMEWORK_FOLDER=\"Frameworks/$FULL_MODULE_NAME.framework\"\n" +"\n" +" # If the framework folder doesn't exist, create it.\n" +" if [ ! -d \"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER\" ]; then\n" +" echo \"Creating framework for $RELATIVE_EXT\"\n" +" mkdir -p \"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER\"\n" +" cp \"$CODESIGNING_FOLDER_PATH/dylib-Info-template.plist\" " +"\"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/Info.plist\"\n" +" plutil -replace CFBundleExecutable -string \"$FULL_MODULE_NAME\" " +"\"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/Info.plist\"\n" +" plutil -replace CFBundleIdentifier -string \"$FRAMEWORK_BUNDLE_ID\" " +"\"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/Info.plist\"\n" +" fi\n" +"\n" +" echo \"Installing binary for $FRAMEWORK_FOLDER/$FULL_MODULE_NAME\"\n" +" mv \"$FULL_EXT\" \"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/" +"$FULL_MODULE_NAME\"\n" +" # Create a placeholder .fwork file where the .so was\n" +" echo \"$FRAMEWORK_FOLDER/$FULL_MODULE_NAME\" > ${FULL_EXT%.so}.fwork\n" +" # Create a back reference to the .so file location in the framework\n" +" echo \"${RELATIVE_EXT%.so}.fwork\" > \"$CODESIGNING_FOLDER_PATH/" +"$FRAMEWORK_FOLDER/$FULL_MODULE_NAME.origin\"\n" +" }\n" +"\n" +" PYTHON_VER=$(ls -1 \"$CODESIGNING_FOLDER_PATH/python/lib\")\n" +" echo \"Install Python $PYTHON_VER standard library extension modules...\"\n" +" find \"$CODESIGNING_FOLDER_PATH/python/lib/$PYTHON_VER/lib-dynload\" -name " +"\"*.so\" | while read FULL_EXT; do\n" +" install_dylib python/lib/$PYTHON_VER/lib-dynload/ \"$FULL_EXT\"\n" +" done\n" +"\n" +" # Clean up dylib template\n" +" rm -f \"$CODESIGNING_FOLDER_PATH/dylib-Info-template.plist\"\n" +"\n" +" echo \"Signing frameworks as $EXPANDED_CODE_SIGN_IDENTITY_NAME " +"($EXPANDED_CODE_SIGN_IDENTITY)...\"\n" +" find \"$CODESIGNING_FOLDER_PATH/Frameworks\" -name \"*.framework\" -exec /" +"usr/bin/codesign --force --sign \"$EXPANDED_CODE_SIGN_IDENTITY\" " +"${OTHER_CODE_SIGN_FLAGS:-} -o runtime --timestamp=none --preserve-" +"metadata=identifier,entitlements,flags --generate-entitlement-der \"{}\" \\;" +msgstr "" + +#: ../../using/ios.rst:292 +msgid "" +"Add Objective C code to initialize and use a Python interpreter in embedded " +"mode. You should ensure that:" +msgstr "" + +#: ../../using/ios.rst:295 +msgid ":c:member:`UTF-8 mode <PyPreConfig.utf8_mode>` is *enabled*;" +msgstr "" + +#: ../../using/ios.rst:296 +msgid ":c:member:`Buffered stdio <PyConfig.buffered_stdio>` is *disabled*;" +msgstr "" + +#: ../../using/ios.rst:297 +msgid ":c:member:`Writing bytecode <PyConfig.write_bytecode>` is *disabled*;" +msgstr "" + +#: ../../using/ios.rst:298 +msgid "" +":c:member:`Signal handlers <PyConfig.install_signal_handlers>` are *enabled*;" +msgstr "" + +#: ../../using/ios.rst:299 +msgid "" +"``PYTHONHOME`` for the interpreter is configured to point at the ``python`` " +"subfolder of your app's bundle; and" +msgstr "" + +#: ../../using/ios.rst:301 +msgid "The ``PYTHONPATH`` for the interpreter includes:" +msgstr "" + +#: ../../using/ios.rst:303 +msgid "the ``python/lib/python3.X`` subfolder of your app's bundle," +msgstr "" + +#: ../../using/ios.rst:304 +msgid "" +"the ``python/lib/python3.X/lib-dynload`` subfolder of your app's bundle, and" +msgstr "" + +#: ../../using/ios.rst:305 +msgid "the ``app`` subfolder of your app's bundle" +msgstr "" + +#: ../../using/ios.rst:307 +msgid "" +"Your app's bundle location can be determined using ``[[NSBundle mainBundle] " +"resourcePath]``." +msgstr "" + +#: ../../using/ios.rst:310 +msgid "" +"Steps 8, 9 and 10 of these instructions assume that you have a single folder " +"of pure Python application code, named ``app``. If you have third-party " +"binary modules in your app, some additional steps will be required:" +msgstr "" + +#: ../../using/ios.rst:314 +msgid "" +"You need to ensure that any folders containing third-party binaries are " +"either associated with the app target, or copied in as part of step 8. Step " +"8 should also purge any binaries that are not appropriate for the platform a " +"specific build is targeting (i.e., delete any device binaries if you're " +"building an app targeting the simulator)." +msgstr "" + +#: ../../using/ios.rst:320 +msgid "" +"Any folders that contain third-party binaries must be processed into " +"framework form by step 9. The invocation of ``install_dylib`` that processes " +"the ``lib-dynload`` folder can be copied and adapted for this purpose." +msgstr "" + +#: ../../using/ios.rst:324 +msgid "" +"If you're using a separate folder for third-party packages, ensure that " +"folder is included as part of the ``PYTHONPATH`` configuration in step 10." +msgstr "" + +#: ../../using/ios.rst:328 +msgid "App Store Compliance" +msgstr "" + +#: ../../using/ios.rst:330 +msgid "" +"The only mechanism for distributing apps to third-party iOS devices is to " +"submit the app to the iOS App Store; apps submitted for distribution must " +"pass Apple's app review process. This process includes a set of automated " +"validation rules that inspect the submitted application bundle for " +"problematic code." +msgstr "" + +#: ../../using/ios.rst:335 +msgid "" +"The Python standard library contains some code that is known to violate " +"these automated rules. While these violations appear to be false positives, " +"Apple's review rules cannot be challenged; so, it is necessary to modify the " +"Python standard library for an app to pass App Store review." +msgstr "" + +#: ../../using/ios.rst:340 +msgid "" +"The Python source tree contains :source:`a patch file <Mac/Resources/app-" +"store-compliance.patch>` that will remove all code that is known to cause " +"issues with the App Store review process. This patch is applied " +"automatically when building for iOS." +msgstr "" diff --git a/using/mac.po b/using/mac.po index b54ac6db04..9ece55a5c4 100644 --- a/using/mac.po +++ b/using/mac.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-08-31 22:26+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -289,9 +289,10 @@ msgid "A number of alternative macOS GUI toolkits are available:" msgstr "有許多替代 macOS GUI 工具套件可用:" #: ../../using/mac.rst:157 +#, fuzzy msgid "" "`PySide <https://www.qt.io/qt-for-python>`__: Official Python bindings to " -"the `Qt GUI toolkit <https://www.qt.io>`__." +"the `Qt GUI toolkit <https://qt.io>`__." msgstr "" "`PySide <https://www.qt.io/qt-for-python>`__:`Qt GUI 工具包 <https://www.qt." "io>`__\\ 的官方 Python 繫結。" @@ -359,10 +360,47 @@ msgstr "" "案或資料夾打包成可分發的檔案。" #: ../../using/mac.rst:192 +msgid "App Store Compliance" +msgstr "" + +#: ../../using/mac.rst:194 +msgid "" +"Apps submitted for distribution through the macOS App Store must pass " +"Apple's app review process. This process includes a set of automated " +"validation rules that inspect the submitted application bundle for " +"problematic code." +msgstr "" + +#: ../../using/mac.rst:198 +msgid "" +"The Python standard library contains some code that is known to violate " +"these automated rules. While these violations appear to be false positives, " +"Apple's review rules cannot be challenged. Therefore, it is necessary to " +"modify the Python standard library for an app to pass App Store review." +msgstr "" + +#: ../../using/mac.rst:203 +msgid "" +"The Python source tree contains :source:`a patch file <Mac/Resources/app-" +"store-compliance.patch>` that will remove all code that is known to cause " +"issues with the App Store review process. This patch is applied " +"automatically when CPython is configured with the :option:`--with-app-store-" +"compliance` option." +msgstr "" + +#: ../../using/mac.rst:209 +msgid "" +"This patch is not normally required to use CPython on a Mac; nor is it " +"required if you are distributing an app *outside* the macOS App Store. It is " +"*only* required if you are using the macOS App Store as a distribution " +"channel." +msgstr "" + +#: ../../using/mac.rst:214 msgid "Other Resources" msgstr "其他資源" -#: ../../using/mac.rst:194 +#: ../../using/mac.rst:216 msgid "" "The Pythonmac-SIG mailing list is an excellent support resource for Python " "users and developers on the Mac:" @@ -370,14 +408,14 @@ msgstr "" "Pythonmac-SIG 郵件清單對於 Mac 上的 Python 使用者和開發者是一個極佳的支援資" "源:" -#: ../../using/mac.rst:197 +#: ../../using/mac.rst:219 msgid "https://www.python.org/community/sigs/current/pythonmac-sig/" msgstr "https://www.python.org/community/sigs/current/pythonmac-sig/" -#: ../../using/mac.rst:199 +#: ../../using/mac.rst:221 msgid "Another useful resource is the MacPython wiki:" msgstr "另一個好用資源是 MacPython wiki:" -#: ../../using/mac.rst:201 +#: ../../using/mac.rst:223 msgid "https://wiki.python.org/moin/MacPython" msgstr "https://wiki.python.org/moin/MacPython" diff --git a/using/windows.po b/using/windows.po index 020e5d495d..2ef76eb5e5 100644 --- a/using/windows.po +++ b/using/windows.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -235,12 +235,12 @@ msgid "" msgstr "" #: ../../using/windows.rst:133 ../../using/windows.rst:153 -#: ../../using/windows.rst:1082 +#: ../../using/windows.rst:1150 msgid "Name" msgstr "名稱" #: ../../using/windows.rst:133 ../../using/windows.rst:153 -#: ../../using/windows.rst:1082 +#: ../../using/windows.rst:1150 msgid "Description" msgstr "描述" @@ -682,30 +682,87 @@ msgid "" "`launcher`, which has its own entry in Programs and Features." msgstr "" -#: ../../using/windows.rst:314 +#: ../../using/windows.rst:313 +msgid "Installing Free-threaded Binaries" +msgstr "" + +#: ../../using/windows.rst:315 ../../using/windows.rst:501 +msgid "(Experimental)" +msgstr "" + +#: ../../using/windows.rst:319 ../../using/windows.rst:505 +msgid "" +"Everything described in this section is considered experimental, and should " +"be expected to change in future releases." +msgstr "" + +#: ../../using/windows.rst:322 +msgid "" +"To install pre-built binaries with free-threading enabled (see :pep:`703`), " +"you should select \"Customize installation\". The second page of options " +"includes the \"Download free-threaded binaries\" checkbox." +msgstr "" + +#: ../../using/windows.rst:328 +msgid "" +"Selecting this option will download and install additional binaries to the " +"same location as the main Python install. The main executable is called " +"``python3.13t.exe``, and other binaries either receive a ``t`` suffix or a " +"full ABI suffix. Python source files and bundled third-party dependencies " +"are shared with the main install." +msgstr "" + +#: ../../using/windows.rst:334 +msgid "" +"The free-threaded version is registered as a regular Python install with the " +"tag ``3.13t`` (with a ``-32`` or ``-arm64`` suffix as normal for those " +"platforms). This allows tools to discover it, and for the :ref:`launcher` to " +"support ``py.exe -3.13t``. Note that the launcher will interpret ``py.exe " +"-3`` (or a ``python3`` shebang) as \"the latest 3.x install\", which will " +"prefer the free-threaded binaries over the regular ones, while ``py.exe " +"-3.13`` will not. If you use the short style of option, you may prefer to " +"not install the free-threaded binaries at this time." +msgstr "" + +#: ../../using/windows.rst:343 +msgid "" +"To specify the install option at the command line, use " +"``Include_freethreaded=1``. See :ref:`install-layout-option` for " +"instructions on pre-emptively downloading the additional binaries for " +"offline install. The options to include debug symbols and binaries also " +"apply to the free-threaded builds." +msgstr "" + +#: ../../using/windows.rst:349 +msgid "" +"Free-threaded binaries are also available :ref:`on nuget.org <windows-" +"nuget>`." +msgstr "" + +#: ../../using/windows.rst:354 msgid "The Microsoft Store package" msgstr "" -#: ../../using/windows.rst:318 +#: ../../using/windows.rst:358 msgid "" "The Microsoft Store package is an easily installable Python interpreter that " "is intended mainly for interactive use, for example, by students." msgstr "" -#: ../../using/windows.rst:321 +#: ../../using/windows.rst:361 msgid "" "To install the package, ensure you have the latest Windows 10 updates and " "search the Microsoft Store app for \"Python |version|\". Ensure that the app " "you select is published by the Python Software Foundation, and install it." msgstr "" -#: ../../using/windows.rst:326 +#: ../../using/windows.rst:366 msgid "" "Python will always be available for free on the Microsoft Store. If you are " "asked to pay for it, you have not selected the correct package." msgstr "" -#: ../../using/windows.rst:329 +#: ../../using/windows.rst:369 msgid "" "After installation, Python may be launched by finding it in Start. " "Alternatively, it will be available from any Command Prompt or PowerShell " @@ -713,7 +770,7 @@ msgid "" "``pip`` or ``idle``. IDLE can also be found in Start." msgstr "" -#: ../../using/windows.rst:334 +#: ../../using/windows.rst:374 msgid "" "All three commands are also available with version number suffixes, for " "example, as ``python3.exe`` and ``python3.x.exe`` as well as ``python.exe`` " @@ -724,13 +781,13 @@ msgid "" "of ``python`` is selected." msgstr "" -#: ../../using/windows.rst:342 +#: ../../using/windows.rst:382 msgid "" "Virtual environments can be created with ``python -m venv`` and activated " "and used as normal." msgstr "" -#: ../../using/windows.rst:345 +#: ../../using/windows.rst:385 msgid "" "If you have installed another version of Python and added it to your " "``PATH`` variable, it will be available as ``python.exe`` rather than the " @@ -738,13 +795,13 @@ msgid "" "exe`` or ``python3.x.exe``." msgstr "" -#: ../../using/windows.rst:350 +#: ../../using/windows.rst:390 msgid "" "The ``py.exe`` launcher will detect this Python installation, but will " "prefer installations from the traditional installer." msgstr "" -#: ../../using/windows.rst:353 +#: ../../using/windows.rst:393 msgid "" "To remove Python, open Settings and use Apps and Features, or else find " "Python in Start and right-click to select Uninstall. Uninstalling will " @@ -752,15 +809,15 @@ msgid "" "but will not remove any virtual environments" msgstr "" -#: ../../using/windows.rst:359 +#: ../../using/windows.rst:399 msgid "Known issues" msgstr "" -#: ../../using/windows.rst:362 +#: ../../using/windows.rst:402 msgid "Redirection of local data, registry, and temporary paths" msgstr "" -#: ../../using/windows.rst:364 +#: ../../using/windows.rst:404 msgid "" "Because of restrictions on Microsoft Store apps, Python scripts may not have " "full write access to shared locations such as :envvar:`TEMP` and the " @@ -768,7 +825,7 @@ msgid "" "modify the shared locations, you will need to install the full installer." msgstr "" -#: ../../using/windows.rst:369 +#: ../../using/windows.rst:409 msgid "" "At runtime, Python will use a private copy of well-known Windows folders and " "the registry. For example, if the environment variable :envvar:`%APPDATA%` " @@ -779,7 +836,7 @@ msgid "" "\\`." msgstr "" -#: ../../using/windows.rst:374 +#: ../../using/windows.rst:414 msgid "" "When reading files, Windows will return the file from the private folder, or " "if that does not exist, the real Windows directory. For example reading :" @@ -788,13 +845,13 @@ msgid "" "\\WindowsApps\\\\package_name\\\\VFS\\\\SystemX86`." msgstr "" -#: ../../using/windows.rst:378 +#: ../../using/windows.rst:418 msgid "" "You can find the real path of any existing file using :func:`os.path." "realpath`:" msgstr "" -#: ../../using/windows.rst:380 +#: ../../using/windows.rst:420 msgid "" ">>> import os\n" ">>> test_file = 'C:\\\\Users\\\\example\\\\AppData\\\\Local\\\\test.txt'\n" @@ -810,30 +867,30 @@ msgstr "" "\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\\\LocalCache\\\\Local\\" "\\test.txt'" -#: ../../using/windows.rst:387 +#: ../../using/windows.rst:427 msgid "When writing to the Windows Registry, the following behaviors exist:" msgstr "" -#: ../../using/windows.rst:389 +#: ../../using/windows.rst:429 msgid "" "Reading from ``HKLM\\\\Software`` is allowed and results are merged with " "the :file:`registry.dat` file in the package." msgstr "" -#: ../../using/windows.rst:390 +#: ../../using/windows.rst:430 msgid "" "Writing to ``HKLM\\\\Software`` is not allowed if the corresponding key/" "value exists, i.e. modifying existing keys." msgstr "" -#: ../../using/windows.rst:391 +#: ../../using/windows.rst:431 msgid "" "Writing to ``HKLM\\\\Software`` is allowed as long as a corresponding key/" "value does not exist in the package and the user has the correct access " "permissions." msgstr "" -#: ../../using/windows.rst:394 +#: ../../using/windows.rst:434 msgid "" "For more detail on the technical basis for these limitations, please consult " "Microsoft's documentation on packaged full-trust apps, currently available " @@ -842,11 +899,11 @@ msgid "" "behind-the-scenes>`_" msgstr "" -#: ../../using/windows.rst:403 +#: ../../using/windows.rst:443 msgid "The nuget.org packages" msgstr "nuget.org 套件" -#: ../../using/windows.rst:407 +#: ../../using/windows.rst:447 msgid "" "The nuget.org package is a reduced size Python environment intended for use " "on continuous integration and build systems that do not have a system-wide " @@ -854,14 +911,14 @@ msgid "" "works perfectly fine for packages containing build-time tools." msgstr "" -#: ../../using/windows.rst:412 +#: ../../using/windows.rst:452 msgid "" "Visit `nuget.org <https://www.nuget.org/>`_ for the most up-to-date " "information on using nuget. What follows is a summary that is sufficient for " "Python developers." msgstr "" -#: ../../using/windows.rst:416 +#: ../../using/windows.rst:456 msgid "" "The ``nuget.exe`` command line tool may be downloaded directly from " "``https://aka.ms/nugetclidl``, for example, using curl or PowerShell. With " @@ -869,7 +926,7 @@ msgid "" "installed using::" msgstr "" -#: ../../using/windows.rst:421 +#: ../../using/windows.rst:461 msgid "" "nuget.exe install python -ExcludeVersion -OutputDirectory .\n" "nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory ." @@ -877,7 +934,7 @@ msgstr "" "nuget.exe install python -ExcludeVersion -OutputDirectory .\n" "nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory ." -#: ../../using/windows.rst:424 +#: ../../using/windows.rst:464 msgid "" "To select a particular version, add a ``-Version 3.x.y``. The output " "directory may be changed from ``.``, and the package will be installed into " @@ -887,7 +944,7 @@ msgid "" "directory that contains the Python installation:" msgstr "" -#: ../../using/windows.rst:431 +#: ../../using/windows.rst:471 msgid "" "# Without -ExcludeVersion\n" "> .\\python.3.5.2\\tools\\python.exe -V\n" @@ -905,7 +962,7 @@ msgstr "" "> .\\python\\tools\\python.exe -V\n" "Python 3.5.2" -#: ../../using/windows.rst:441 +#: ../../using/windows.rst:481 msgid "" "In general, nuget packages are not upgradeable, and newer versions should be " "installed side-by-side and referenced using the full path. Alternatively, " @@ -913,7 +970,7 @@ msgid "" "will do this automatically if they do not preserve files between builds." msgstr "" -#: ../../using/windows.rst:446 +#: ../../using/windows.rst:486 msgid "" "Alongside the ``tools`` directory is a ``build\\native`` directory. This " "contains a MSBuild properties file ``python.props`` that can be used in a C+" @@ -921,26 +978,42 @@ msgid "" "automatically use the headers and import libraries in your build." msgstr "" -#: ../../using/windows.rst:451 +#: ../../using/windows.rst:491 msgid "" "The package information pages on nuget.org are `www.nuget.org/packages/" -"python <https://www.nuget.org/packages/python>`_ for the 64-bit version and " +"python <https://www.nuget.org/packages/python>`_ for the 64-bit version, " "`www.nuget.org/packages/pythonx86 <https://www.nuget.org/packages/" -"pythonx86>`_ for the 32-bit version." +"pythonx86>`_ for the 32-bit version, and `www.nuget.org/packages/pythonarm64 " +"<https://www.nuget.org/packages/pythonarm64>`_ for the ARM64 version" +msgstr "" + +#: ../../using/windows.rst:499 +msgid "Free-threaded packages" msgstr "" -#: ../../using/windows.rst:460 +#: ../../using/windows.rst:508 +msgid "" +"Packages containing free-threaded binaries are named `python-freethreaded " +"<https://www.nuget.org/packages/python-freethreaded>`_ for the 64-bit " +"version, `pythonx86-freethreaded <https://www.nuget.org/packages/pythonx86-" +"freethreaded>`_ for the 32-bit version, and `pythonarm64-freethreaded " +"<https://www.nuget.org/packages/pythonarm64-freethreaded>`_ for the ARM64 " +"version. These packages contain both the ``python3.13t.exe`` and ``python." +"exe`` entry points, both of which run free threaded." +msgstr "" + +#: ../../using/windows.rst:520 msgid "The embeddable package" msgstr "" -#: ../../using/windows.rst:464 +#: ../../using/windows.rst:524 msgid "" "The embedded distribution is a ZIP file containing a minimal Python " "environment. It is intended for acting as part of another application, " "rather than being directly accessed by end-users." msgstr "" -#: ../../using/windows.rst:468 +#: ../../using/windows.rst:528 msgid "" "When extracted, the embedded distribution is (almost) fully isolated from " "the user's system, including environment variables, system registry " @@ -951,7 +1024,7 @@ msgid "" "documentation are not included." msgstr "" -#: ../../using/windows.rst:477 +#: ../../using/windows.rst:537 msgid "" "The embedded distribution does not include the `Microsoft C Runtime <https://" "docs.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist#visual-" @@ -961,7 +1034,7 @@ msgid "" "and can be detected by finding ``ucrtbase.dll`` in the system directory." msgstr "" -#: ../../using/windows.rst:484 +#: ../../using/windows.rst:544 msgid "" "Third-party packages should be installed by the application installer " "alongside the embedded distribution. Using pip to manage dependencies as for " @@ -972,16 +1045,16 @@ msgid "" "compatibility with newer versions before providing updates to users." msgstr "" -#: ../../using/windows.rst:492 +#: ../../using/windows.rst:552 msgid "" "The two recommended use cases for this distribution are described below." msgstr "" -#: ../../using/windows.rst:495 +#: ../../using/windows.rst:555 msgid "Python Application" msgstr "" -#: ../../using/windows.rst:497 +#: ../../using/windows.rst:557 msgid "" "An application written in Python does not necessarily require users to be " "aware of that fact. The embedded distribution may be used in this case to " @@ -990,7 +1063,7 @@ msgid "" "there are two options." msgstr "" -#: ../../using/windows.rst:503 +#: ../../using/windows.rst:563 msgid "" "Using a specialized executable as a launcher requires some coding, but " "provides the most transparent experience for users. With a customized " @@ -1001,7 +1074,7 @@ msgid "" "line." msgstr "" -#: ../../using/windows.rst:510 +#: ../../using/windows.rst:570 msgid "" "The simpler approach is to provide a batch file or generated shortcut that " "directly calls the ``python.exe`` or ``pythonw.exe`` with the required " @@ -1010,7 +1083,7 @@ msgid "" "from other running Python processes or file associations." msgstr "" -#: ../../using/windows.rst:516 +#: ../../using/windows.rst:576 msgid "" "With the latter approach, packages should be installed as directories " "alongside the Python executable to ensure they are available on the path. " @@ -1019,11 +1092,11 @@ msgid "" "application." msgstr "" -#: ../../using/windows.rst:522 +#: ../../using/windows.rst:582 msgid "Embedding Python" msgstr "嵌入 Python" -#: ../../using/windows.rst:524 +#: ../../using/windows.rst:584 msgid "" "Applications written in native code often require some form of scripting " "language, and the embedded Python distribution can be used for this purpose. " @@ -1034,7 +1107,7 @@ msgid "" "interpreter." msgstr "" -#: ../../using/windows.rst:531 +#: ../../using/windows.rst:591 msgid "" "As with the application use, packages can be installed to any location as " "there is an opportunity to specify search paths before initializing the " @@ -1042,46 +1115,46 @@ msgid "" "the embedded distribution and a regular installation." msgstr "" -#: ../../using/windows.rst:538 +#: ../../using/windows.rst:598 msgid "Alternative bundles" msgstr "" -#: ../../using/windows.rst:540 +#: ../../using/windows.rst:600 msgid "" "Besides the standard CPython distribution, there are modified packages " "including additional functionality. The following is a list of popular " "versions and their key features:" msgstr "" -#: ../../using/windows.rst:544 +#: ../../using/windows.rst:604 msgid "`ActivePython <https://www.activestate.com/products/python/>`_" msgstr "`ActivePython <https://www.activestate.com/products/python/>`_" -#: ../../using/windows.rst:545 +#: ../../using/windows.rst:605 msgid "Installer with multi-platform compatibility, documentation, PyWin32" msgstr "" -#: ../../using/windows.rst:547 +#: ../../using/windows.rst:607 msgid "`Anaconda <https://www.anaconda.com/download/>`_" msgstr "`Anaconda <https://www.anaconda.com/download/>`_" -#: ../../using/windows.rst:548 +#: ../../using/windows.rst:608 msgid "" "Popular scientific modules (such as numpy, scipy and pandas) and the " "``conda`` package manager." msgstr "" -#: ../../using/windows.rst:551 -msgid "" -"`Enthought Deployment Manager <https://assets.enthought.com/downloads/edm/>`_" +#: ../../using/windows.rst:611 +#, fuzzy +msgid "`Enthought Deployment Manager <https://www.enthought.com/edm/>`_" msgstr "" "`Enthought Deployment Manager <https://assets.enthought.com/downloads/edm/>`_" -#: ../../using/windows.rst:552 +#: ../../using/windows.rst:612 msgid "\"The Next Generation Python Environment and Package Manager\"." msgstr "" -#: ../../using/windows.rst:554 +#: ../../using/windows.rst:614 msgid "" "Previously Enthought provided Canopy, but it `reached end of life in 2016 " "<https://support.enthought.com/hc/en-us/articles/360038600051-Canopy-GUI-end-" @@ -1089,27 +1162,27 @@ msgid "" "Code>`_." msgstr "" -#: ../../using/windows.rst:557 +#: ../../using/windows.rst:617 msgid "`WinPython <https://winpython.github.io/>`_" msgstr "`WinPython <https://winpython.github.io/>`_" -#: ../../using/windows.rst:558 +#: ../../using/windows.rst:618 msgid "" "Windows-specific distribution with prebuilt scientific packages and tools " "for building packages." msgstr "" -#: ../../using/windows.rst:561 +#: ../../using/windows.rst:621 msgid "" "Note that these packages may not include the latest versions of Python or " "other libraries, and are not maintained or supported by the core Python team." msgstr "" -#: ../../using/windows.rst:567 +#: ../../using/windows.rst:627 msgid "Configuring Python" msgstr "設定 Python" -#: ../../using/windows.rst:569 +#: ../../using/windows.rst:629 msgid "" "To run Python conveniently from a command prompt, you might consider " "changing some default environment variables in Windows. While the installer " @@ -1118,23 +1191,23 @@ msgid "" "use multiple versions of Python, consider using the :ref:`launcher`." msgstr "" -#: ../../using/windows.rst:579 +#: ../../using/windows.rst:639 msgid "Excursus: Setting environment variables" msgstr "" -#: ../../using/windows.rst:581 +#: ../../using/windows.rst:641 msgid "" "Windows allows environment variables to be configured permanently at both " "the User level and the System level, or temporarily in a command prompt." msgstr "" -#: ../../using/windows.rst:584 +#: ../../using/windows.rst:644 msgid "" "To temporarily set environment variables, open Command Prompt and use the :" "command:`set` command:" msgstr "" -#: ../../using/windows.rst:587 +#: ../../using/windows.rst:647 msgid "" "C:\\>set PATH=C:\\Program Files\\Python 3.9;%PATH%\n" "C:\\>set PYTHONPATH=%PYTHONPATH%;C:\\My_python_lib\n" @@ -1144,13 +1217,13 @@ msgstr "" "C:\\>set PYTHONPATH=%PYTHONPATH%;C:\\My_python_lib\n" "C:\\>python" -#: ../../using/windows.rst:593 +#: ../../using/windows.rst:653 msgid "" "These changes will apply to any further commands executed in that console, " "and will be inherited by any applications started from the console." msgstr "" -#: ../../using/windows.rst:596 +#: ../../using/windows.rst:656 msgid "" "Including the variable name within percent signs will expand to the existing " "value, allowing you to add your new value at either the start or the end. " @@ -1159,7 +1232,7 @@ msgid "" "launched." msgstr "" -#: ../../using/windows.rst:602 +#: ../../using/windows.rst:662 msgid "" "To permanently modify the default environment variables, click Start and " "search for 'edit environment variables', or open System properties, :" @@ -1169,20 +1242,20 @@ msgid "" "your machine (i.e. Administrator rights)." msgstr "" -#: ../../using/windows.rst:611 +#: ../../using/windows.rst:671 msgid "" "Windows will concatenate User variables *after* System variables, which may " "cause unexpected results when modifying :envvar:`PATH`." msgstr "" -#: ../../using/windows.rst:614 +#: ../../using/windows.rst:674 msgid "" "The :envvar:`PYTHONPATH` variable is used by all versions of Python, so you " "should not permanently configure it unless the listed paths only include " "code that is compatible with all of your installed Python versions." msgstr "" -#: ../../using/windows.rst:621 +#: ../../using/windows.rst:681 msgid "" "https://docs.microsoft.com/en-us/windows/win32/procthread/environment-" "variables" @@ -1190,11 +1263,11 @@ msgstr "" "https://docs.microsoft.com/en-us/windows/win32/procthread/environment-" "variables" -#: ../../using/windows.rst:622 +#: ../../using/windows.rst:682 msgid "Overview of environment variables on Windows" msgstr "Windows 上的環境變數概要" -#: ../../using/windows.rst:624 +#: ../../using/windows.rst:684 msgid "" "https://docs.microsoft.com/en-us/windows-server/administration/windows-" "commands/set_1" @@ -1202,11 +1275,11 @@ msgstr "" "https://docs.microsoft.com/en-us/windows-server/administration/windows-" "commands/set_1" -#: ../../using/windows.rst:625 +#: ../../using/windows.rst:685 msgid "The ``set`` command, for temporarily modifying environment variables" msgstr "" -#: ../../using/windows.rst:627 +#: ../../using/windows.rst:687 msgid "" "https://docs.microsoft.com/en-us/windows-server/administration/windows-" "commands/setx" @@ -1214,22 +1287,22 @@ msgstr "" "https://docs.microsoft.com/en-us/windows-server/administration/windows-" "commands/setx" -#: ../../using/windows.rst:628 +#: ../../using/windows.rst:688 msgid "The ``setx`` command, for permanently modifying environment variables" msgstr "" -#: ../../using/windows.rst:634 +#: ../../using/windows.rst:694 msgid "Finding the Python executable" msgstr "" -#: ../../using/windows.rst:638 +#: ../../using/windows.rst:698 msgid "" "Besides using the automatically created start menu entry for the Python " "interpreter, you might want to start Python in the command prompt. The " "installer has an option to set that up for you." msgstr "" -#: ../../using/windows.rst:642 +#: ../../using/windows.rst:702 msgid "" "On the first page of the installer, an option labelled \"Add Python to " "PATH\" may be selected to have the installer add the install location into " @@ -1240,7 +1313,7 @@ msgid "" "documentation." msgstr "" -#: ../../using/windows.rst:649 +#: ../../using/windows.rst:709 msgid "" "If you don't enable this option at install time, you can always re-run the " "installer, select Modify, and enable it. Alternatively, you can manually " @@ -1251,28 +1324,28 @@ msgid "" "entries already existed)::" msgstr "" -#: ../../using/windows.rst:657 +#: ../../using/windows.rst:717 msgid "C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\Program Files\\Python 3.9" msgstr "C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\Program Files\\Python 3.9" -#: ../../using/windows.rst:662 +#: ../../using/windows.rst:722 msgid "UTF-8 mode" msgstr "UTF-8 模式" -#: ../../using/windows.rst:666 +#: ../../using/windows.rst:726 msgid "" "Windows still uses legacy encodings for the system encoding (the ANSI Code " "Page). Python uses it for the default encoding of text files (e.g. :func:" "`locale.getencoding`)." msgstr "" -#: ../../using/windows.rst:670 +#: ../../using/windows.rst:730 msgid "" "This may cause issues because UTF-8 is widely used on the internet and most " "Unix systems, including WSL (Windows Subsystem for Linux)." msgstr "" -#: ../../using/windows.rst:673 +#: ../../using/windows.rst:733 msgid "" "You can use the :ref:`Python UTF-8 Mode <utf8-mode>` to change the default " "text encoding to UTF-8. You can enable the :ref:`Python UTF-8 Mode <utf8-" @@ -1281,13 +1354,13 @@ msgid "" "and :ref:`setting-envvars` for how to modify environment variables." msgstr "" -#: ../../using/windows.rst:679 +#: ../../using/windows.rst:739 msgid "" "When the :ref:`Python UTF-8 Mode <utf8-mode>` is enabled, you can still use " "the system encoding (the ANSI Code Page) via the \"mbcs\" codec." msgstr "" -#: ../../using/windows.rst:682 +#: ../../using/windows.rst:742 msgid "" "Note that adding ``PYTHONUTF8=1`` to the default environment variables will " "affect all Python 3.7+ applications on your system. If you have any Python " @@ -1296,27 +1369,27 @@ msgid "" "utf8`` command line option." msgstr "" -#: ../../using/windows.rst:689 +#: ../../using/windows.rst:749 msgid "" "Even when UTF-8 mode is disabled, Python uses UTF-8 by default on Windows " "for:" msgstr "" -#: ../../using/windows.rst:692 +#: ../../using/windows.rst:752 msgid "Console I/O including standard I/O (see :pep:`528` for details)." msgstr "" -#: ../../using/windows.rst:693 +#: ../../using/windows.rst:753 msgid "" "The :term:`filesystem encoding <filesystem encoding and error handler>` " "(see :pep:`529` for details)." msgstr "" -#: ../../using/windows.rst:700 +#: ../../using/windows.rst:760 msgid "Python Launcher for Windows" msgstr "" -#: ../../using/windows.rst:704 +#: ../../using/windows.rst:764 msgid "" "The Python launcher for Windows is a utility which aids in locating and " "executing of different Python versions. It allows scripts (or the command-" @@ -1324,7 +1397,7 @@ msgid "" "locate and execute that version." msgstr "" -#: ../../using/windows.rst:709 +#: ../../using/windows.rst:769 msgid "" "Unlike the :envvar:`PATH` variable, the launcher will correctly select the " "most appropriate version of Python. It will prefer per-user installations " @@ -1332,19 +1405,19 @@ msgid "" "most recently installed version." msgstr "" -#: ../../using/windows.rst:714 +#: ../../using/windows.rst:774 msgid "The launcher was originally specified in :pep:`397`." msgstr "" -#: ../../using/windows.rst:717 +#: ../../using/windows.rst:777 msgid "Getting started" msgstr "開始" -#: ../../using/windows.rst:720 +#: ../../using/windows.rst:780 msgid "From the command-line" msgstr "" -#: ../../using/windows.rst:724 +#: ../../using/windows.rst:784 msgid "" "System-wide installations of Python 3.3 and later will put the launcher on " "your :envvar:`PATH`. The launcher is compatible with all available versions " @@ -1352,62 +1425,62 @@ msgid "" "the launcher is available, execute the following command in Command Prompt::" msgstr "" -#: ../../using/windows.rst:729 +#: ../../using/windows.rst:789 msgid "py" msgstr "py" -#: ../../using/windows.rst:731 +#: ../../using/windows.rst:791 msgid "" "You should find that the latest version of Python you have installed is " "started - it can be exited as normal, and any additional command-line " "arguments specified will be sent directly to Python." msgstr "" -#: ../../using/windows.rst:735 +#: ../../using/windows.rst:795 msgid "" "If you have multiple versions of Python installed (e.g., 3.7 and |version|) " "you will have noticed that Python |version| was started - to launch Python " "3.7, try the command::" msgstr "" -#: ../../using/windows.rst:739 +#: ../../using/windows.rst:799 msgid "py -3.7" msgstr "py -3.7" -#: ../../using/windows.rst:741 +#: ../../using/windows.rst:801 msgid "" "If you want the latest version of Python 2 you have installed, try the " "command::" msgstr "" -#: ../../using/windows.rst:744 +#: ../../using/windows.rst:804 msgid "py -2" msgstr "py -2" -#: ../../using/windows.rst:746 +#: ../../using/windows.rst:806 msgid "" "If you see the following error, you do not have the launcher installed::" msgstr "" -#: ../../using/windows.rst:748 +#: ../../using/windows.rst:808 msgid "" "'py' is not recognized as an internal or external command,\n" "operable program or batch file." msgstr "" -#: ../../using/windows.rst:751 +#: ../../using/windows.rst:811 msgid "The command::" msgstr "指令: ::" -#: ../../using/windows.rst:753 +#: ../../using/windows.rst:813 msgid "py --list" msgstr "py --list" -#: ../../using/windows.rst:755 +#: ../../using/windows.rst:815 msgid "displays the currently installed version(s) of Python." msgstr "" -#: ../../using/windows.rst:757 +#: ../../using/windows.rst:817 msgid "" "The ``-x.y`` argument is the short form of the ``-V:Company/Tag`` argument, " "which allows selecting a specific Python runtime, including those that may " @@ -1416,14 +1489,14 @@ msgid "" "available runtimes using the ``-V:`` format." msgstr "" -#: ../../using/windows.rst:763 +#: ../../using/windows.rst:823 msgid "" "When using the ``-V:`` argument, specifying the Company will limit selection " "to runtimes from that provider, while specifying only the Tag will select " "from all providers. Note that omitting the slash implies a tag::" msgstr "" -#: ../../using/windows.rst:767 +#: ../../using/windows.rst:827 msgid "" "# Select any '3.*' tagged runtime\n" "py -V:3\n" @@ -1435,14 +1508,14 @@ msgid "" "py -V:PythonCore/3" msgstr "" -#: ../../using/windows.rst:776 +#: ../../using/windows.rst:836 msgid "" "The short form of the argument (``-3``) only ever selects from core Python " "releases, and not other distributions. However, the longer form (``-V:3``) " "will select from any." msgstr "" -#: ../../using/windows.rst:780 +#: ../../using/windows.rst:840 msgid "" "The Company is matched on the full string, case-insenitive. The Tag is " "matched oneither the full string, or a prefix, provided the next character " @@ -1451,11 +1524,11 @@ msgid "" "``3.1``), but are compared using text (``-V:3.01`` does not match ``3.1``)." msgstr "" -#: ../../using/windows.rst:788 +#: ../../using/windows.rst:848 msgid "Virtual environments" msgstr "虛擬環境(Virtual environment)" -#: ../../using/windows.rst:792 +#: ../../using/windows.rst:852 msgid "" "If the launcher is run with no explicit Python version specification, and a " "virtual environment (created with the standard library :mod:`venv` module or " @@ -1465,17 +1538,17 @@ msgid "" "specify the global Python version." msgstr "" -#: ../../using/windows.rst:800 +#: ../../using/windows.rst:860 msgid "From a script" msgstr "" -#: ../../using/windows.rst:802 +#: ../../using/windows.rst:862 msgid "" "Let's create a test Python script - create a file called ``hello.py`` with " "the following contents" msgstr "" -#: ../../using/windows.rst:805 +#: ../../using/windows.rst:865 msgid "" "#! python\n" "import sys\n" @@ -1485,25 +1558,25 @@ msgstr "" "import sys\n" "sys.stdout.write(\"hello from Python %s\\n\" % (sys.version,))" -#: ../../using/windows.rst:811 +#: ../../using/windows.rst:871 msgid "From the directory in which hello.py lives, execute the command::" msgstr "" -#: ../../using/windows.rst:813 +#: ../../using/windows.rst:873 msgid "py hello.py" msgstr "py hello.py" -#: ../../using/windows.rst:815 +#: ../../using/windows.rst:875 msgid "" "You should notice the version number of your latest Python 2.x installation " "is printed. Now try changing the first line to be:" msgstr "" -#: ../../using/windows.rst:818 +#: ../../using/windows.rst:878 msgid "#! python3" msgstr "#! python3" -#: ../../using/windows.rst:822 +#: ../../using/windows.rst:882 msgid "" "Re-executing the command should now print the latest Python 3.x information. " "As with the above command-line examples, you can specify a more explicit " @@ -1512,7 +1585,7 @@ msgid "" "information printed." msgstr "" -#: ../../using/windows.rst:828 +#: ../../using/windows.rst:888 msgid "" "Note that unlike interactive use, a bare \"python\" will use the latest " "version of Python 2.x that you have installed. This is for backward " @@ -1520,11 +1593,11 @@ msgid "" "typically refers to Python 2." msgstr "" -#: ../../using/windows.rst:834 +#: ../../using/windows.rst:894 msgid "From file associations" msgstr "從檔案關聯" -#: ../../using/windows.rst:836 +#: ../../using/windows.rst:896 msgid "" "The launcher should have been associated with Python files (i.e. ``.py``, ``." "pyw``, ``.pyc`` files) when it was installed. This means that when you " @@ -1533,17 +1606,17 @@ msgid "" "have the script specify the version which should be used." msgstr "" -#: ../../using/windows.rst:842 +#: ../../using/windows.rst:902 msgid "" "The key benefit of this is that a single launcher can support multiple " "Python versions at the same time depending on the contents of the first line." msgstr "" -#: ../../using/windows.rst:846 +#: ../../using/windows.rst:906 msgid "Shebang Lines" msgstr "" -#: ../../using/windows.rst:848 +#: ../../using/windows.rst:908 msgid "" "If the first line of a script file starts with ``#!``, it is known as a " "\"shebang\" line. Linux and other Unix like operating systems have native " @@ -1553,70 +1626,80 @@ msgid "" "demonstrate their use." msgstr "" -#: ../../using/windows.rst:855 +#: ../../using/windows.rst:915 msgid "" "To allow shebang lines in Python scripts to be portable between Unix and " "Windows, this launcher supports a number of 'virtual' commands to specify " "which interpreter to use. The supported virtual commands are:" msgstr "" -#: ../../using/windows.rst:859 +#: ../../using/windows.rst:919 msgid "``/usr/bin/env``" msgstr "``/usr/bin/env``" -#: ../../using/windows.rst:860 +#: ../../using/windows.rst:920 msgid "``/usr/bin/python``" msgstr "``/usr/bin/python``" -#: ../../using/windows.rst:861 +#: ../../using/windows.rst:921 msgid "``/usr/local/bin/python``" msgstr "``/usr/local/bin/python``" -#: ../../using/windows.rst:862 +#: ../../using/windows.rst:922 msgid "``python``" msgstr "``python``" -#: ../../using/windows.rst:864 +#: ../../using/windows.rst:924 msgid "For example, if the first line of your script starts with" msgstr "" -#: ../../using/windows.rst:866 +#: ../../using/windows.rst:926 msgid "#! /usr/bin/python" msgstr "#! /usr/bin/python" -#: ../../using/windows.rst:870 +#: ../../using/windows.rst:930 msgid "" -"The default Python will be located and used. As many Python scripts written " -"to work on Unix will already have this line, you should find these scripts " -"can be used by the launcher without modification. If you are writing a new " -"script on Windows which you hope will be useful on Unix, you should use one " -"of the shebang lines starting with ``/usr``." +"The default Python or an active virtual environment will be located and " +"used. As many Python scripts written to work on Unix will already have this " +"line, you should find these scripts can be used by the launcher without " +"modification. If you are writing a new script on Windows which you hope will " +"be useful on Unix, you should use one of the shebang lines starting with ``/" +"usr``." msgstr "" -#: ../../using/windows.rst:876 +#: ../../using/windows.rst:936 msgid "" "Any of the above virtual commands can be suffixed with an explicit version " "(either just the major version, or the major and minor version). Furthermore " "the 32-bit version can be requested by adding \"-32\" after the minor " "version. I.e. ``/usr/bin/python3.7-32`` will request usage of the 32-bit " -"python 3.7." +"Python 3.7. If a virtual environment is active, the version will be ignored " +"and the environment will be used." msgstr "" -#: ../../using/windows.rst:884 +#: ../../using/windows.rst:945 msgid "" "Beginning with python launcher 3.7 it is possible to request 64-bit version " "by the \"-64\" suffix. Furthermore it is possible to specify a major and " "architecture without minor (i.e. ``/usr/bin/python3-64``)." msgstr "" -#: ../../using/windows.rst:890 +#: ../../using/windows.rst:951 msgid "" "The \"-64\" suffix is deprecated, and now implies \"any architecture that is " "not provably i386/32-bit\". To request a specific environment, use the new :" "samp:`-V:{TAG}` argument with the complete tag." msgstr "" -#: ../../using/windows.rst:894 +#: ../../using/windows.rst:957 +msgid "" +"Virtual commands referencing ``python`` now prefer an active virtual " +"environment rather than searching :envvar:`PATH`. This handles cases where " +"the shebang specifies ``/usr/bin/env python3`` but :file:`python3.exe` is " +"not present in the active environment." +msgstr "" + +#: ../../using/windows.rst:962 msgid "" "The ``/usr/bin/env`` form of shebang line has one further special property. " "Before looking for installed Python interpreters, this form will search the " @@ -1630,7 +1713,7 @@ msgid "" "of :envvar:`PATH`." msgstr "" -#: ../../using/windows.rst:905 +#: ../../using/windows.rst:973 msgid "" "Shebang lines that do not match any of these patterns are looked up in the " "``[commands]`` section of the launcher's :ref:`.INI file <launcher-ini>`. " @@ -1641,7 +1724,7 @@ msgid "" "part of the filename)." msgstr "" -#: ../../using/windows.rst:913 +#: ../../using/windows.rst:981 msgid "" "[commands]\n" "/bin/xpython=C:\\Program Files\\XPython\\python.exe" @@ -1649,7 +1732,7 @@ msgstr "" "[commands]\n" "/bin/xpython=C:\\Program Files\\XPython\\python.exe" -#: ../../using/windows.rst:918 +#: ../../using/windows.rst:986 msgid "" "Any commands not found in the .INI file are treated as **Windows** " "executable paths that are absolute or relative to the directory containing " @@ -1660,33 +1743,33 @@ msgid "" "will be appended." msgstr "" -#: ../../using/windows.rst:927 +#: ../../using/windows.rst:995 msgid "Arguments in shebang lines" msgstr "" -#: ../../using/windows.rst:929 +#: ../../using/windows.rst:997 msgid "" "The shebang lines can also specify additional options to be passed to the " "Python interpreter. For example, if you have a shebang line:" msgstr "" -#: ../../using/windows.rst:932 +#: ../../using/windows.rst:1000 msgid "#! /usr/bin/python -v" msgstr "#! /usr/bin/python -v" -#: ../../using/windows.rst:936 +#: ../../using/windows.rst:1004 msgid "Then Python will be started with the ``-v`` option" msgstr "" -#: ../../using/windows.rst:939 +#: ../../using/windows.rst:1007 msgid "Customization" msgstr "" -#: ../../using/windows.rst:944 +#: ../../using/windows.rst:1012 msgid "Customization via INI files" msgstr "" -#: ../../using/windows.rst:946 +#: ../../using/windows.rst:1014 msgid "" "Two .ini files will be searched by the launcher - ``py.ini`` in the current " "user's application data directory (``%LOCALAPPDATA%`` or ``$env:" @@ -1695,7 +1778,7 @@ msgid "" "e. py.exe) and for the 'windows' version (i.e. pyw.exe)." msgstr "" -#: ../../using/windows.rst:952 +#: ../../using/windows.rst:1020 msgid "" "Customization specified in the \"application directory\" will have " "precedence over the one next to the executable, so a user, who may not have " @@ -1703,11 +1786,11 @@ msgid "" "that global .ini file." msgstr "" -#: ../../using/windows.rst:957 +#: ../../using/windows.rst:1025 msgid "Customizing default Python versions" msgstr "" -#: ../../using/windows.rst:959 +#: ../../using/windows.rst:1027 msgid "" "In some cases, a version qualifier can be included in a command to dictate " "which version of Python will be used by the command. A version qualifier " @@ -1717,13 +1800,13 @@ msgid "" "\"-32\" or \"-64\"." msgstr "" -#: ../../using/windows.rst:965 +#: ../../using/windows.rst:1033 msgid "" "For example, a shebang line of ``#!python`` has no version qualifier, while " "``#!python3`` has a version qualifier which specifies only a major version." msgstr "" -#: ../../using/windows.rst:968 +#: ../../using/windows.rst:1036 msgid "" "If no version qualifiers are found in a command, the environment variable :" "envvar:`PY_PYTHON` can be set to specify the default version qualifier. If " @@ -1733,7 +1816,7 @@ msgid "" "launcher included with Python 3.7 or newer.)" msgstr "" -#: ../../using/windows.rst:975 +#: ../../using/windows.rst:1043 msgid "" "If no minor version qualifiers are found, the environment variable " "``PY_PYTHON{major}`` (where ``{major}`` is the current major version " @@ -1744,7 +1827,7 @@ msgid "" "version in that family." msgstr "" -#: ../../using/windows.rst:983 +#: ../../using/windows.rst:1051 msgid "" "On 64-bit Windows with both 32-bit and 64-bit implementations of the same " "(major.minor) Python version installed, the 64-bit version will always be " @@ -1758,30 +1841,30 @@ msgid "" "suffix can be used on a version specifier to change this behaviour." msgstr "" -#: ../../using/windows.rst:994 +#: ../../using/windows.rst:1062 msgid "Examples:" msgstr "範例:" -#: ../../using/windows.rst:996 +#: ../../using/windows.rst:1064 msgid "" "If no relevant options are set, the commands ``python`` and ``python2`` will " "use the latest Python 2.x version installed and the command ``python3`` will " "use the latest Python 3.x installed." msgstr "" -#: ../../using/windows.rst:1000 +#: ../../using/windows.rst:1068 msgid "" "The command ``python3.7`` will not consult any options at all as the " "versions are fully specified." msgstr "" -#: ../../using/windows.rst:1003 +#: ../../using/windows.rst:1071 msgid "" "If ``PY_PYTHON=3``, the commands ``python`` and ``python3`` will both use " "the latest installed Python 3 version." msgstr "" -#: ../../using/windows.rst:1006 +#: ../../using/windows.rst:1074 msgid "" "If ``PY_PYTHON=3.7-32``, the command ``python`` will use the 32-bit " "implementation of 3.7 whereas the command ``python3`` will use the latest " @@ -1789,13 +1872,13 @@ msgid "" "specified.)" msgstr "" -#: ../../using/windows.rst:1011 +#: ../../using/windows.rst:1079 msgid "" "If ``PY_PYTHON=3`` and ``PY_PYTHON3=3.7``, the commands ``python`` and " "``python3`` will both use specifically 3.7" msgstr "" -#: ../../using/windows.rst:1014 +#: ../../using/windows.rst:1082 msgid "" "In addition to environment variables, the same settings can be configured in " "the .INI file used by the launcher. The section in the INI file is called " @@ -1805,15 +1888,15 @@ msgid "" "will override things specified in the INI file." msgstr "" -#: ../../using/windows.rst:1021 +#: ../../using/windows.rst:1089 msgid "For example:" msgstr "舉例來說:" -#: ../../using/windows.rst:1023 +#: ../../using/windows.rst:1091 msgid "Setting ``PY_PYTHON=3.7`` is equivalent to the INI file containing:" msgstr "" -#: ../../using/windows.rst:1025 +#: ../../using/windows.rst:1093 msgid "" "[defaults]\n" "python=3.7" @@ -1821,13 +1904,13 @@ msgstr "" "[defaults]\n" "python=3.7" -#: ../../using/windows.rst:1030 +#: ../../using/windows.rst:1098 msgid "" "Setting ``PY_PYTHON=3`` and ``PY_PYTHON3=3.7`` is equivalent to the INI file " "containing:" msgstr "" -#: ../../using/windows.rst:1033 +#: ../../using/windows.rst:1101 msgid "" "[defaults]\n" "python=3\n" @@ -1837,11 +1920,11 @@ msgstr "" "python=3\n" "python3=3.7" -#: ../../using/windows.rst:1040 +#: ../../using/windows.rst:1108 msgid "Diagnostics" msgstr "" -#: ../../using/windows.rst:1042 +#: ../../using/windows.rst:1110 msgid "" "If an environment variable :envvar:`PYLAUNCHER_DEBUG` is set (to any value), " "the launcher will print diagnostic information to stderr (i.e. to the " @@ -1851,11 +1934,11 @@ msgid "" "the target Python. It is primarily intended for testing and debugging." msgstr "" -#: ../../using/windows.rst:1050 +#: ../../using/windows.rst:1118 msgid "Dry Run" msgstr "" -#: ../../using/windows.rst:1052 +#: ../../using/windows.rst:1120 msgid "" "If an environment variable :envvar:`PYLAUNCHER_DRYRUN` is set (to any " "value), the launcher will output the command it would have run, but will not " @@ -1865,11 +1948,11 @@ msgid "" "correctly in the console." msgstr "" -#: ../../using/windows.rst:1060 +#: ../../using/windows.rst:1128 msgid "Install on demand" msgstr "安裝隨選" -#: ../../using/windows.rst:1062 +#: ../../using/windows.rst:1130 msgid "" "If an environment variable :envvar:`PYLAUNCHER_ALLOW_INSTALL` is set (to any " "value), and the requested Python version is not installed but is available " @@ -1878,7 +1961,7 @@ msgid "" "again." msgstr "" -#: ../../using/windows.rst:1067 +#: ../../using/windows.rst:1135 msgid "" "An additional :envvar:`PYLAUNCHER_ALWAYS_INSTALL` variable causes the " "launcher to always try to install Python, even if it is detected. This is " @@ -1886,137 +1969,137 @@ msgid "" "`PYLAUNCHER_DRYRUN`)." msgstr "" -#: ../../using/windows.rst:1072 +#: ../../using/windows.rst:1140 msgid "Return codes" msgstr "" -#: ../../using/windows.rst:1074 +#: ../../using/windows.rst:1142 msgid "" "The following exit codes may be returned by the Python launcher. " "Unfortunately, there is no way to distinguish these from the exit code of " "Python itself." msgstr "" -#: ../../using/windows.rst:1077 +#: ../../using/windows.rst:1145 msgid "" "The names of codes are as used in the sources, and are only for reference. " "There is no way to access or resolve them apart from reading this page. " "Entries are listed in alphabetical order of names." msgstr "" -#: ../../using/windows.rst:1082 +#: ../../using/windows.rst:1150 msgid "Value" msgstr "" -#: ../../using/windows.rst:1084 +#: ../../using/windows.rst:1152 msgid "RC_BAD_VENV_CFG" msgstr "RC_BAD_VENV_CFG" -#: ../../using/windows.rst:1084 +#: ../../using/windows.rst:1152 msgid "107" msgstr "107" -#: ../../using/windows.rst:1084 +#: ../../using/windows.rst:1152 msgid "A :file:`pyvenv.cfg` was found but is corrupt." msgstr "" -#: ../../using/windows.rst:1086 +#: ../../using/windows.rst:1154 msgid "RC_CREATE_PROCESS" msgstr "RC_CREATE_PROCESS" -#: ../../using/windows.rst:1086 +#: ../../using/windows.rst:1154 msgid "101" msgstr "101" -#: ../../using/windows.rst:1086 +#: ../../using/windows.rst:1154 msgid "Failed to launch Python." msgstr "" -#: ../../using/windows.rst:1088 +#: ../../using/windows.rst:1156 msgid "RC_INSTALLING" msgstr "RC_INSTALLING" -#: ../../using/windows.rst:1088 +#: ../../using/windows.rst:1156 msgid "111" msgstr "111" -#: ../../using/windows.rst:1088 +#: ../../using/windows.rst:1156 msgid "" "An install was started, but the command will need to be re-run after it " "completes." msgstr "" -#: ../../using/windows.rst:1091 +#: ../../using/windows.rst:1159 msgid "RC_INTERNAL_ERROR" msgstr "RC_INTERNAL_ERROR" -#: ../../using/windows.rst:1091 +#: ../../using/windows.rst:1159 msgid "109" msgstr "109" -#: ../../using/windows.rst:1091 +#: ../../using/windows.rst:1159 msgid "Unexpected error. Please report a bug." msgstr "" -#: ../../using/windows.rst:1093 +#: ../../using/windows.rst:1161 msgid "RC_NO_COMMANDLINE" msgstr "RC_NO_COMMANDLINE" -#: ../../using/windows.rst:1093 +#: ../../using/windows.rst:1161 msgid "108" msgstr "108" -#: ../../using/windows.rst:1093 +#: ../../using/windows.rst:1161 msgid "Unable to obtain command line from the operating system." msgstr "" -#: ../../using/windows.rst:1096 +#: ../../using/windows.rst:1164 msgid "RC_NO_PYTHON" msgstr "RC_NO_PYTHON" -#: ../../using/windows.rst:1096 +#: ../../using/windows.rst:1164 msgid "103" msgstr "103" -#: ../../using/windows.rst:1096 +#: ../../using/windows.rst:1164 msgid "Unable to locate the requested version." msgstr "" -#: ../../using/windows.rst:1098 +#: ../../using/windows.rst:1166 msgid "RC_NO_VENV_CFG" msgstr "RC_NO_VENV_CFG" -#: ../../using/windows.rst:1098 +#: ../../using/windows.rst:1166 msgid "106" msgstr "106" -#: ../../using/windows.rst:1098 +#: ../../using/windows.rst:1166 msgid "A :file:`pyvenv.cfg` was required but not found." msgstr "" -#: ../../using/windows.rst:1106 +#: ../../using/windows.rst:1174 msgid "Finding modules" msgstr "找尋模組" -#: ../../using/windows.rst:1108 +#: ../../using/windows.rst:1176 msgid "" "These notes supplement the description at :ref:`sys-path-init` with detailed " "Windows notes." msgstr "" -#: ../../using/windows.rst:1111 +#: ../../using/windows.rst:1179 msgid "" "When no ``._pth`` file is found, this is how :data:`sys.path` is populated " "on Windows:" msgstr "" -#: ../../using/windows.rst:1114 +#: ../../using/windows.rst:1182 msgid "" "An empty entry is added at the start, which corresponds to the current " "directory." msgstr "" -#: ../../using/windows.rst:1117 +#: ../../using/windows.rst:1185 msgid "" "If the environment variable :envvar:`PYTHONPATH` exists, as described in :" "ref:`using-on-envvars`, its entries are added next. Note that on Windows, " @@ -2024,7 +2107,7 @@ msgid "" "from the colon used in drive identifiers (``C:\\`` etc.)." msgstr "" -#: ../../using/windows.rst:1122 +#: ../../using/windows.rst:1190 msgid "" "Additional \"application paths\" can be added in the registry as subkeys of :" "samp:`\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\{version}\\\\PythonPath` under " @@ -2034,7 +2117,7 @@ msgid "" "installers only use HKLM, so HKCU is typically empty.)" msgstr "" -#: ../../using/windows.rst:1129 +#: ../../using/windows.rst:1197 msgid "" "If the environment variable :envvar:`PYTHONHOME` is set, it is assumed as " "\"Python Home\". Otherwise, the path of the main Python executable is used " @@ -2045,31 +2128,31 @@ msgid "" "PythonPath stored in the registry." msgstr "" -#: ../../using/windows.rst:1137 +#: ../../using/windows.rst:1205 msgid "" "If the Python Home cannot be located, no :envvar:`PYTHONPATH` is specified " "in the environment, and no registry entries can be found, a default path " "with relative entries is used (e.g. ``.\\Lib;.\\plat-win``, etc)." msgstr "" -#: ../../using/windows.rst:1141 +#: ../../using/windows.rst:1209 msgid "" "If a ``pyvenv.cfg`` file is found alongside the main executable or in the " "directory one level above the executable, the following variations apply:" msgstr "" -#: ../../using/windows.rst:1144 +#: ../../using/windows.rst:1212 msgid "" "If ``home`` is an absolute path and :envvar:`PYTHONHOME` is not set, this " "path is used instead of the path to the main executable when deducing the " "home location." msgstr "" -#: ../../using/windows.rst:1148 +#: ../../using/windows.rst:1216 msgid "The end result of all this is:" msgstr "最終這所有的結果為:" -#: ../../using/windows.rst:1150 +#: ../../using/windows.rst:1218 msgid "" "When running :file:`python.exe`, or any other .exe in the main Python " "directory (either an installed version, or directly from the PCbuild " @@ -2077,7 +2160,7 @@ msgid "" "ignored. Other \"application paths\" in the registry are always read." msgstr "" -#: ../../using/windows.rst:1155 +#: ../../using/windows.rst:1223 msgid "" "When Python is hosted in another .exe (different directory, embedded via " "COM, etc), the \"Python Home\" will not be deduced, so the core path from " @@ -2085,20 +2168,20 @@ msgid "" "always read." msgstr "" -#: ../../using/windows.rst:1159 +#: ../../using/windows.rst:1227 msgid "" "If Python can't find its home and there are no registry value (frozen .exe, " "some very strange installation setup) you get a path with some default, but " "relative, paths." msgstr "" -#: ../../using/windows.rst:1163 +#: ../../using/windows.rst:1231 msgid "" "For those who want to bundle Python into their application or distribution, " "the following advice will prevent conflicts with other installations:" msgstr "" -#: ../../using/windows.rst:1166 +#: ../../using/windows.rst:1234 msgid "" "Include a ``._pth`` file alongside your executable containing the " "directories to include. This will ignore paths listed in the registry and " @@ -2106,20 +2189,20 @@ msgid "" "listed." msgstr "" -#: ../../using/windows.rst:1171 +#: ../../using/windows.rst:1239 msgid "" "If you are loading :file:`python3.dll` or :file:`python37.dll` in your own " -"executable, explicitly call :c:func:`Py_SetPath` or (at least) :c:func:" -"`Py_SetProgramName` before :c:func:`Py_Initialize`." +"executable, explicitly set :c:member:`PyConfig.module_search_paths` before :" +"c:func:`Py_InitializeFromConfig`." msgstr "" -#: ../../using/windows.rst:1175 +#: ../../using/windows.rst:1243 msgid "" "Clear and/or overwrite :envvar:`PYTHONPATH` and set :envvar:`PYTHONHOME` " "before launching :file:`python.exe` from your application." msgstr "" -#: ../../using/windows.rst:1178 +#: ../../using/windows.rst:1246 msgid "" "If you cannot use the previous suggestions (for example, you are a " "distribution that allows people to run :file:`python.exe` directly), ensure " @@ -2128,7 +2211,7 @@ msgid "" "correctly named ZIP file will be detected instead.)" msgstr "" -#: ../../using/windows.rst:1184 +#: ../../using/windows.rst:1252 msgid "" "These will ensure that the files in a system-wide installation will not take " "precedence over the copy of the standard library bundled with your " @@ -2138,19 +2221,19 @@ msgid "" "packages." msgstr "" -#: ../../using/windows.rst:1192 +#: ../../using/windows.rst:1260 msgid "" "Add ``._pth`` file support and removes ``applocal`` option from ``pyvenv." "cfg``." msgstr "" -#: ../../using/windows.rst:1197 +#: ../../using/windows.rst:1265 msgid "" "Add :file:`python{XX}.zip` as a potential landmark when directly adjacent to " "the executable." msgstr "" -#: ../../using/windows.rst:1202 +#: ../../using/windows.rst:1270 msgid "" "Modules specified in the registry under ``Modules`` (not ``PythonPath``) may " "be imported by :class:`importlib.machinery.WindowsRegistryFinder`. This " @@ -2158,87 +2241,88 @@ msgid "" "explicitly added to :data:`sys.meta_path` in the future." msgstr "" -#: ../../using/windows.rst:1208 +#: ../../using/windows.rst:1276 msgid "Additional modules" msgstr "額外的模組" -#: ../../using/windows.rst:1210 +#: ../../using/windows.rst:1278 msgid "" "Even though Python aims to be portable among all platforms, there are " "features that are unique to Windows. A couple of modules, both in the " "standard library and external, and snippets exist to use these features." msgstr "" -#: ../../using/windows.rst:1214 +#: ../../using/windows.rst:1282 msgid "" "The Windows-specific standard modules are documented in :ref:`mswin-specific-" "services`." msgstr "" -#: ../../using/windows.rst:1218 +#: ../../using/windows.rst:1286 msgid "PyWin32" msgstr "PyWin32" -#: ../../using/windows.rst:1220 +#: ../../using/windows.rst:1288 msgid "" "The :pypi:`PyWin32` module by Mark Hammond is a collection of modules for " "advanced Windows-specific support. This includes utilities for:" msgstr "" -#: ../../using/windows.rst:1224 +#: ../../using/windows.rst:1292 msgid "" "`Component Object Model <https://docs.microsoft.com/en-us/windows/win32/com/" "component-object-model--com--portal>`_ (COM)" msgstr "" -#: ../../using/windows.rst:1227 +#: ../../using/windows.rst:1295 msgid "Win32 API calls" msgstr "Win32 API 呼叫" -#: ../../using/windows.rst:1228 +#: ../../using/windows.rst:1296 msgid "Registry" msgstr "登錄檔(Registry)" -#: ../../using/windows.rst:1229 +#: ../../using/windows.rst:1297 msgid "Event log" msgstr "事件日誌(Event log)" -#: ../../using/windows.rst:1230 +#: ../../using/windows.rst:1298 msgid "" "`Microsoft Foundation Classes <https://docs.microsoft.com/en-us/cpp/mfc/mfc-" "desktop-applications>`_ (MFC) user interfaces" msgstr "" -#: ../../using/windows.rst:1234 +#: ../../using/windows.rst:1302 msgid "" "`PythonWin <https://web.archive.org/web/20060524042422/ https://www.python." "org/windows/pythonwin/>`_ is a sample MFC application shipped with PyWin32. " "It is an embeddable IDE with a built-in debugger." msgstr "" -#: ../../using/windows.rst:1240 +#: ../../using/windows.rst:1308 +#, fuzzy msgid "" -"`Win32 How Do I...? <https://timgolden.me.uk/python/win32_how_do_i.html>`_" +"`Win32 How Do I...? <http://timgolden.me.uk/python/win32_how_do_i.html>`_" msgstr "" "`Win32 How Do I...? <https://timgolden.me.uk/python/win32_how_do_i.html>`_" -#: ../../using/windows.rst:1241 +#: ../../using/windows.rst:1309 msgid "by Tim Golden" msgstr "由 Tim Golden 所著" -#: ../../using/windows.rst:1243 +#: ../../using/windows.rst:1311 msgid "`Python and COM <https://www.boddie.org.uk/python/COM.html>`_" msgstr "`Python and COM <https://www.boddie.org.uk/python/COM.html>`_" -#: ../../using/windows.rst:1244 +#: ../../using/windows.rst:1312 msgid "by David and Paul Boddie" msgstr "由 David 與 Paul Boddie 所著" -#: ../../using/windows.rst:1248 +#: ../../using/windows.rst:1316 msgid "cx_Freeze" msgstr "cx_Freeze" -#: ../../using/windows.rst:1250 +#: ../../using/windows.rst:1318 msgid "" "`cx_Freeze <https://cx-freeze.readthedocs.io/en/latest/>`_ wraps Python " "scripts into executable Windows programs (:file:`{*}.exe` files). When you " @@ -2246,11 +2330,11 @@ msgid "" "users to install Python." msgstr "" -#: ../../using/windows.rst:1257 +#: ../../using/windows.rst:1325 msgid "Compiling Python on Windows" msgstr "編譯 Python 在 Windows" -#: ../../using/windows.rst:1259 +#: ../../using/windows.rst:1327 msgid "" "If you want to compile CPython yourself, first thing you should do is get " "the `source <https://www.python.org/downloads/source/>`_. You can download " @@ -2258,48 +2342,48 @@ msgid "" "devguide.python.org/setup/#get-the-source-code>`_." msgstr "" -#: ../../using/windows.rst:1264 +#: ../../using/windows.rst:1332 msgid "" "The source tree contains a build solution and project files for Microsoft " "Visual Studio, which is the compiler used to build the official Python " "releases. These files are in the :file:`PCbuild` directory." msgstr "" -#: ../../using/windows.rst:1268 +#: ../../using/windows.rst:1336 msgid "" "Check :file:`PCbuild/readme.txt` for general information on the build " "process." msgstr "" -#: ../../using/windows.rst:1270 +#: ../../using/windows.rst:1338 msgid "For extension modules, consult :ref:`building-on-windows`." msgstr "" -#: ../../using/windows.rst:1274 +#: ../../using/windows.rst:1342 msgid "Other Platforms" msgstr "其他平台" -#: ../../using/windows.rst:1276 +#: ../../using/windows.rst:1344 msgid "" "With ongoing development of Python, some platforms that used to be supported " "earlier are no longer supported (due to the lack of users or developers). " "Check :pep:`11` for details on all unsupported platforms." msgstr "" -#: ../../using/windows.rst:1280 +#: ../../using/windows.rst:1348 msgid "" "`Windows CE <https://pythonce.sourceforge.net/>`_ is `no longer supported " "<https://github.com/python/cpython/issues/71542>`__ since Python 3 (if it " "ever was)." msgstr "" -#: ../../using/windows.rst:1283 +#: ../../using/windows.rst:1351 msgid "" "The `Cygwin <https://cygwin.com/>`_ installer offers to install the `Python " "interpreter <https://cygwin.com/packages/summary/python3.html>`__ as well" msgstr "" -#: ../../using/windows.rst:1287 +#: ../../using/windows.rst:1355 msgid "" "See `Python for Windows <https://www.python.org/downloads/windows/>`_ for " "detailed information about platforms with pre-compiled installers." diff --git a/whatsnew/2.0.po b/whatsnew/2.0.po index 384912a37d..a8df302c59 100644 --- a/whatsnew/2.0.po +++ b/whatsnew/2.0.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1494,10 +1494,10 @@ msgstr "模組變更" msgid "" "Lots of improvements and bugfixes were made to Python's extensive standard " "library; some of the affected modules include :mod:`readline`, :mod:" -"`ConfigParser <configparser>`, :mod:`cgi`, :mod:`calendar`, :mod:`posix`, :" -"mod:`readline`, :mod:`!xmllib`, :mod:`aifc`, :mod:`chunk` :mod:`wave`, :mod:" -"`random`, :mod:`shelve`, and :mod:`nntplib`. Consult the CVS logs for the " -"exact patch-by-patch details." +"`ConfigParser <configparser>`, :mod:`!cgi`, :mod:`calendar`, :mod:`posix`, :" +"mod:`readline`, :mod:`!xmllib`, :mod:`!aifc`, :mod:`!chunk`, :mod:`wave`, :" +"mod:`random`, :mod:`shelve`, and :mod:`!nntplib`. Consult the CVS logs for " +"the exact patch-by-patch details." msgstr "" #: ../../whatsnew/2.0.rst:1037 diff --git a/whatsnew/2.3.po b/whatsnew/2.3.po index 4a8043f37b..6e32c82426 100644 --- a/whatsnew/2.3.po +++ b/whatsnew/2.3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2099,7 +2099,7 @@ msgstr "" #: ../../whatsnew/2.3.rst:1394 msgid "" "The old and never-documented :mod:`!linuxaudiodev` module has been " -"deprecated, and a new version named :mod:`ossaudiodev` has been added. The " +"deprecated, and a new version named :mod:`!ossaudiodev` has been added. The " "module was renamed because the OSS sound drivers can be used on platforms " "other than Linux, and the interface has also been tidied and brought up to " "date in various ways. (Contributed by Greg Ward and Nicholas FitzRoy-Dale.)" diff --git a/whatsnew/2.4.po b/whatsnew/2.4.po index 8b3940987f..f8d6f7d7ed 100644 --- a/whatsnew/2.4.po +++ b/whatsnew/2.4.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1043,12 +1043,8 @@ msgid "" msgstr "" #: ../../whatsnew/2.4.rst:687 -msgid "" -"`http://www.lahey.com/float.htm <https://web.archive.org/web/20230604072523/" -"http://www.lahey.com/float.htm%3E%60__" +msgid "http://www.lahey.com/float.htm" msgstr "" -"`http://www.lahey.com/float.htm <https://web.archive.org/web/20230604072523/" -"http://www.lahey.com/float.htm%3E%60__" #: ../../whatsnew/2.4.rst:688 msgid "" @@ -1057,7 +1053,8 @@ msgid "" msgstr "" #: ../../whatsnew/2.4.rst:691 -msgid "https://speleotrove.com/decimal/" +#, fuzzy +msgid "http://speleotrove.com/decimal/" msgstr "https://speleotrove.com/decimal/" #: ../../whatsnew/2.4.rst:692 @@ -1162,12 +1159,11 @@ msgstr "" #: ../../whatsnew/2.4.rst:759 msgid "" -"The code for these functions came from the GLib library (`https://developer-" -"old.gnome.org/glib/2.26/ <http://web.archive.org/web/20210306104320/https://" -"developer.gnome.org/glib/2.26/>`__), whose developers kindly relicensed the " -"relevant functions and donated them to the Python Software Foundation. The :" -"mod:`locale` module can now change the numeric locale, letting extensions " -"such as GTK+ produce the correct results." +"The code for these functions came from the GLib library (https://developer-" +"old.gnome.org/glib/2.26/), whose developers kindly relicensed the relevant " +"functions and donated them to the Python Software Foundation. The :mod:" +"`locale` module can now change the numeric locale, letting extensions such " +"as GTK+ produce the correct results." msgstr "" #: ../../whatsnew/2.4.rst:768 @@ -1818,7 +1814,7 @@ msgstr "" #: ../../whatsnew/2.4.rst:1195 msgid "" -"The :mod:`nntplib` module's :class:`NNTP` class gained :meth:`description` " +"The :mod:`!nntplib` module's :class:`NNTP` class gained :meth:`description` " "and :meth:`descriptions` methods to retrieve newsgroup descriptions for a " "single group or for a range of groups. (Contributed by Jürgen A. Erhard.)" msgstr "" @@ -2377,3 +2373,10 @@ msgstr "universal newlines" #: ../../whatsnew/2.4.rst:415 msgid "What's new" msgstr "What's new(有什麼新功能)" + +#~ msgid "" +#~ "`http://www.lahey.com/float.htm <https://web.archive.org/" +#~ "web/20230604072523/http://www.lahey.com/float.htm>`__" +#~ msgstr "" +#~ "`http://www.lahey.com/float.htm <https://web.archive.org/" +#~ "web/20230604072523/http://www.lahey.com/float.htm>`__" diff --git a/whatsnew/2.5.po b/whatsnew/2.5.po index dc403b9f06..e426c7db93 100644 --- a/whatsnew/2.5.po +++ b/whatsnew/2.5.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1905,7 +1905,7 @@ msgstr "" #: ../../whatsnew/2.5.rst:1225 msgid "" -"The :mod:`audioop` module now supports the a-LAW encoding, and the code for " +"The :mod:`!audioop` module now supports the a-LAW encoding, and the code for " "u-LAW encoding has been improved. (Contributed by Lars Immisch.)" msgstr "" @@ -2218,16 +2218,16 @@ msgstr "" #: ../../whatsnew/2.5.rst:1425 msgid "" -"New module: the :mod:`msilib` module allows creating Microsoft Installer :" +"New module: the :mod:`!msilib` module allows creating Microsoft Installer :" "file:`.msi` files and CAB files. Some support for reading the :file:`.msi` " "database is also included. (Contributed by Martin von Löwis.)" msgstr "" #: ../../whatsnew/2.5.rst:1429 msgid "" -"The :mod:`nis` module now supports accessing domains other than the system " -"default domain by supplying a *domain* argument to the :func:`nis.match` " -"and :func:`nis.maps` functions. (Contributed by Ben Bell.)" +"The :mod:`!nis` module now supports accessing domains other than the system " +"default domain by supplying a *domain* argument to the :func:`!nis.match` " +"and :func:`!nis.maps` functions. (Contributed by Ben Bell.)" msgstr "" #: ../../whatsnew/2.5.rst:1433 @@ -2398,7 +2398,7 @@ msgstr "" #: ../../whatsnew/2.5.rst:1545 msgid "" -"New module: the :mod:`spwd` module provides functions for accessing the " +"New module: the :mod:`!spwd` module provides functions for accessing the " "shadow password database on systems that support shadow passwords." msgstr "" diff --git a/whatsnew/2.6.po b/whatsnew/2.6.po index 6b2ee814c8..de308f3fc6 100644 --- a/whatsnew/2.6.po +++ b/whatsnew/2.6.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -124,7 +124,7 @@ msgid "" "that will be removed in Python 3.0. You can run code with this switch to " "see how much work will be necessary to port code to 3.0. The value of this " "switch is available to Python code as the boolean variable :data:`sys." -"py3kwarning`, and to C extension code as :c:data:`Py_Py3kWarningFlag`." +"py3kwarning`, and to C extension code as :c:data:`!Py_Py3kWarningFlag`." msgstr "" #: ../../whatsnew/2.6.rst:126 @@ -2572,7 +2572,7 @@ msgstr "" #: ../../whatsnew/2.6.rst:1803 msgid "" -"The :mod:`cgi` module will now read variables from the query string of an " +"The :mod:`!cgi` module will now read variables from the query string of an " "HTTP POST request. This makes it possible to use form actions with URLs " "that include query strings such as \"/cgi-bin/add.py?category=1\". " "(Contributed by Alexandre Fiori and Nubis; :issue:`1817`.)" @@ -2581,8 +2581,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:1809 msgid "" "The :func:`parse_qs` and :func:`parse_qsl` functions have been relocated " -"from the :mod:`cgi` module to the :mod:`urlparse <urllib.parse>` module. The " -"versions still available in the :mod:`!cgi` module will trigger :exc:" +"from the :mod:`!cgi` module to the :mod:`urlparse <urllib.parse>` module. " +"The versions still available in the :mod:`!cgi` module will trigger :exc:" "`PendingDeprecationWarning` messages in 2.6 (:issue:`600362`)." msgstr "" @@ -3531,9 +3531,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:2462 msgid "" -"An optional ``timeout`` parameter was added to the :class:`telnetlib.Telnet` " -"class constructor, specifying a timeout measured in seconds. (Added by " -"Facundo Batista.)" +"An optional ``timeout`` parameter was added to the :class:`!telnetlib." +"Telnet` class constructor, specifying a timeout measured in seconds. (Added " +"by Facundo Batista.)" msgstr "" #: ../../whatsnew/2.6.rst:2466 @@ -4475,10 +4475,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:3159 msgid "" -"The :mod:`msilib` module's :class:`!Record` object gained :meth:`~msilib." -"Record.GetInteger` and :meth:`~msilib.Record.GetString` methods that return " -"field values as an integer or a string. (Contributed by Floris Bruynooghe; :" -"issue:`2125`.)" +"The :mod:`!msilib` module's :class:`!Record` object gained :meth:`!" +"GetInteger` and :meth:`!GetString` methods that return field values as an " +"integer or a string. (Contributed by Floris Bruynooghe; :issue:`2125`.)" msgstr "" #: ../../whatsnew/2.6.rst:3167 diff --git a/whatsnew/2.7.po b/whatsnew/2.7.po index b68b58db3d..381ebe4260 100644 --- a/whatsnew/2.7.po +++ b/whatsnew/2.7.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1973,8 +1973,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:1434 msgid "" -"The :mod:`nntplib` module now supports IPv6 addresses. (Contributed by Derek " -"Morr; :issue:`1664`.)" +"The :mod:`!nntplib` module now supports IPv6 addresses. (Contributed by " +"Derek Morr; :issue:`1664`.)" msgstr "" #: ../../whatsnew/2.7.rst:1437 @@ -2132,8 +2132,8 @@ msgid "" "The :func:`~ssl.SSLContext.wrap_socket` constructor function now takes a " "*ciphers* argument that's a string listing the encryption algorithms to be " "allowed; the format of the string is described `in the OpenSSL documentation " -"<https://docs.openssl.org/1.0.2/man1/ciphers/>`__. (Added by Antoine " -"Pitrou; :issue:`8322`.)" +"<https://www.openssl.org/docs/man1.0.2/man1/ciphers.html>`__. (Added by " +"Antoine Pitrou; :issue:`8322`.)" msgstr "" #: ../../whatsnew/2.7.rst:1554 @@ -3017,7 +3017,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:2162 msgid "" -"New function: :c:func:`PySys_SetArgvEx` sets the value of ``sys.argv`` and " +"New function: :c:func:`!PySys_SetArgvEx` sets the value of ``sys.argv`` and " "can optionally update ``sys.path`` to include the directory containing the " "script named by ``sys.argv[0]`` depending on the value of an *updatepath* " "parameter." @@ -3026,7 +3026,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:2167 msgid "" "This function was added to close a security hole for applications that embed " -"Python. The old function, :c:func:`PySys_SetArgv`, would always update " +"Python. The old function, :c:func:`!PySys_SetArgv`, would always update " "``sys.path``, and sometimes it would add the current directory. This meant " "that, if you ran an application embedding Python in a directory controlled " "by someone else, attackers could put a Trojan-horse module in the directory " @@ -3037,8 +3037,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2175 msgid "" "If you maintain a C/C++ application that embeds Python, check whether you're " -"calling :c:func:`PySys_SetArgv` and carefully consider whether the " -"application should be using :c:func:`PySys_SetArgvEx` with *updatepath* set " +"calling :c:func:`!PySys_SetArgv` and carefully consider whether the " +"application should be using :c:func:`!PySys_SetArgvEx` with *updatepath* set " "to false." msgstr "" @@ -3479,11 +3479,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:2551 msgid "" -"The :c:func:`PySys_SetArgvEx` function was added, letting applications close " -"a security hole when the existing :c:func:`PySys_SetArgv` function was " -"used. Check whether you're calling :c:func:`PySys_SetArgv` and carefully " -"consider whether the application should be using :c:func:`PySys_SetArgvEx` " -"with *updatepath* set to false." +"The :c:func:`!PySys_SetArgvEx` function was added, letting applications " +"close a security hole when the existing :c:func:`!PySys_SetArgv` function " +"was used. Check whether you're calling :c:func:`!PySys_SetArgv` and " +"carefully consider whether the application should be using :c:func:`!" +"PySys_SetArgvEx` with *updatepath* set to false." msgstr "" #: ../../whatsnew/2.7.rst:2564 @@ -3675,18 +3675,17 @@ msgstr "" #: ../../whatsnew/2.7.rst:2683 msgid "" -"As :pep:`discussed in the PEP <0477#disabling-ensurepip-by-downstream-" -"distributors>`, platform packagers may choose not to install these commands " -"by default, as long as, when invoked, they provide clear and simple " -"directions on how to install them on that platform (usually using the system " -"package manager)." +"As `discussed in the PEP`__, platform packagers may choose not to install " +"these commands by default, as long as, when invoked, they provide clear and " +"simple directions on how to install them on that platform (usually using the " +"system package manager)." msgstr "" -#: ../../whatsnew/2.7.rst:2690 +#: ../../whatsnew/2.7.rst:2692 msgid "Documentation Changes" msgstr "" -#: ../../whatsnew/2.7.rst:2692 +#: ../../whatsnew/2.7.rst:2694 msgid "" "As part of this change, the :ref:`installing-index` and :ref:`distributing-" "index` sections of the documentation have been completely redesigned as " @@ -3696,29 +3695,29 @@ msgid "" "of the individual projects." msgstr "" -#: ../../whatsnew/2.7.rst:2700 +#: ../../whatsnew/2.7.rst:2702 msgid "" "However, as this migration is currently still incomplete, the legacy " "versions of those guides remaining available as :ref:`install-index` and :" "ref:`setuptools-index`." msgstr "" -#: ../../whatsnew/2.7.rst:2706 +#: ../../whatsnew/2.7.rst:2708 msgid ":pep:`453` -- Explicit bootstrapping of pip in Python installations" msgstr "" -#: ../../whatsnew/2.7.rst:2707 +#: ../../whatsnew/2.7.rst:2709 msgid "" "PEP written by Donald Stufft and Nick Coghlan, implemented by Donald Stufft, " "Nick Coghlan, Martin von Löwis and Ned Deily." msgstr "" -#: ../../whatsnew/2.7.rst:2711 +#: ../../whatsnew/2.7.rst:2713 msgid "" "PEP 476: Enabling certificate verification by default for stdlib http clients" msgstr "" -#: ../../whatsnew/2.7.rst:2713 +#: ../../whatsnew/2.7.rst:2715 msgid "" ":pep:`476` updated :mod:`httplib <http>` and modules which use it, such as :" "mod:`urllib2 <urllib.request>` and :mod:`xmlrpclib <xmlrpc.client>`, to now " @@ -3728,13 +3727,13 @@ msgid "" "for many applications. This change was made in the Python 2.7.9 release." msgstr "" -#: ../../whatsnew/2.7.rst:2721 +#: ../../whatsnew/2.7.rst:2723 msgid "" "For applications which require the old previous behavior, they can pass an " "alternate context::" msgstr "" -#: ../../whatsnew/2.7.rst:2724 +#: ../../whatsnew/2.7.rst:2726 msgid "" "import urllib2\n" "import ssl\n" @@ -3749,11 +3748,11 @@ msgid "" "urllib2.urlopen(\"https://invalid-cert/", context=context)" msgstr "" -#: ../../whatsnew/2.7.rst:2738 +#: ../../whatsnew/2.7.rst:2740 msgid "PEP 493: HTTPS verification migration tools for Python 2.7" msgstr "" -#: ../../whatsnew/2.7.rst:2740 +#: ../../whatsnew/2.7.rst:2742 msgid "" ":pep:`493` provides additional migration tools to support a more incremental " "infrastructure upgrade process for environments containing applications and " @@ -3762,14 +3761,14 @@ msgid "" "were made in the Python 2.7.12 release." msgstr "" -#: ../../whatsnew/2.7.rst:2746 +#: ../../whatsnew/2.7.rst:2748 msgid "" "These tools are intended for use in cases where affected applications and " "services can't be modified to explicitly pass a more permissive SSL context " "when establishing the connection." msgstr "" -#: ../../whatsnew/2.7.rst:2750 +#: ../../whatsnew/2.7.rst:2752 msgid "" "For applications and services which can't be modified at all, the new " "``PYTHONHTTPSVERIFY`` environment variable may be set to ``0`` to revert an " @@ -3777,18 +3776,18 @@ msgid "" "2.7.8 and earlier." msgstr "" -#: ../../whatsnew/2.7.rst:2755 +#: ../../whatsnew/2.7.rst:2757 msgid "" "For cases where the connection establishment code can't be modified, but the " "overall application can be, the new :func:`!ssl._https_verify_certificates` " "function can be used to adjust the default behaviour at runtime." msgstr "" -#: ../../whatsnew/2.7.rst:2761 +#: ../../whatsnew/2.7.rst:2763 msgid "New ``make regen-all`` build target" msgstr "" -#: ../../whatsnew/2.7.rst:2763 +#: ../../whatsnew/2.7.rst:2765 msgid "" "To simplify cross-compilation, and to ensure that CPython can reliably be " "compiled without requiring an existing version of Python to already be " @@ -3796,43 +3795,43 @@ msgid "" "recompile generated files based on file modification times." msgstr "" -#: ../../whatsnew/2.7.rst:2768 +#: ../../whatsnew/2.7.rst:2770 msgid "" "Instead, a new ``make regen-all`` command has been added to force " "regeneration of these files when desired (e.g. after an initial version of " "Python has already been built based on the pregenerated versions)." msgstr "" -#: ../../whatsnew/2.7.rst:2772 +#: ../../whatsnew/2.7.rst:2774 msgid "" "More selective regeneration targets are also defined - see :source:`Makefile." "pre.in` for details." msgstr "" -#: ../../whatsnew/2.7.rst:2775 ../../whatsnew/2.7.rst:2788 +#: ../../whatsnew/2.7.rst:2777 ../../whatsnew/2.7.rst:2790 msgid "(Contributed by Victor Stinner in :issue:`23404`.)" msgstr "(由 Victor Stinner 於 :issue:`23404` 中貢獻。)" -#: ../../whatsnew/2.7.rst:2781 +#: ../../whatsnew/2.7.rst:2783 msgid "Removal of ``make touch`` build target" msgstr "" -#: ../../whatsnew/2.7.rst:2783 +#: ../../whatsnew/2.7.rst:2785 msgid "" "The ``make touch`` build target previously used to request implicit " "regeneration of generated files by updating their modification times has " "been removed." msgstr "" -#: ../../whatsnew/2.7.rst:2786 +#: ../../whatsnew/2.7.rst:2788 msgid "It has been replaced by the new ``make regen-all`` target." msgstr "" -#: ../../whatsnew/2.7.rst:2797 +#: ../../whatsnew/2.7.rst:2799 msgid "Acknowledgements" msgstr "致謝" -#: ../../whatsnew/2.7.rst:2799 +#: ../../whatsnew/2.7.rst:2801 msgid "" "The author would like to thank the following people for offering " "suggestions, corrections and assistance with various drafts of this article: " diff --git a/whatsnew/3.0.po b/whatsnew/3.0.po index 3fc6bc2be0..3c93e678fd 100644 --- a/whatsnew/3.0.po +++ b/whatsnew/3.0.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1366,9 +1366,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:915 msgid "" "Run the ``2to3`` source-to-source translator over your source code tree. " -"(See :ref:`2to3-reference` for more on this tool.) Run the result of the " -"translation under Python 3.0. Manually fix up any remaining issues, fixing " -"problems until all tests pass again." +"Run the result of the translation under Python 3.0. Manually fix up any " +"remaining issues, fixing problems until all tests pass again." msgstr "" #: ../../whatsnew/3.0.rst:920 diff --git a/whatsnew/3.1.po b/whatsnew/3.1.po index 718005d5bf..c931bef0cf 100644 --- a/whatsnew/3.1.po +++ b/whatsnew/3.1.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -665,7 +665,7 @@ msgid "(Contributed by Ross Light; :issue:`4285`.)" msgstr "(由 Ross Light 貢獻;:issue:`4285`。)" #: ../../whatsnew/3.1.rst:406 -msgid "The :mod:`nntplib` and :mod:`imaplib` modules now support IPv6." +msgid "The :mod:`!nntplib` and :mod:`imaplib` modules now support IPv6." msgstr "" #: ../../whatsnew/3.1.rst:408 diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index 22899a7637..d81741b506 100644 --- a/whatsnew/3.10.po +++ b/whatsnew/3.10.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-06-26 03:02+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2879,13 +2879,14 @@ msgid "urllib.parse" msgstr "urllib.parse" #: ../../whatsnew/3.10.rst:1510 +#, fuzzy msgid "" "Python versions earlier than Python 3.10 allowed using both ``;`` and ``&`` " "as query parameter separators in :func:`urllib.parse.parse_qs` and :func:" "`urllib.parse.parse_qsl`. Due to security concerns, and to conform with " "newer W3C recommendations, this has been changed to allow only a single " -"separator key, with ``&`` as the default. This change also affects :func:" -"`cgi.parse` and :func:`cgi.parse_multipart` as they use the affected " +"separator key, with ``&`` as the default. This change also affects :func:`!" +"cgi.parse` and :func:`!cgi.parse_multipart` as they use the affected " "functions internally. For more details, please see their respective " "documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " "in :issue:`42967`.)" diff --git a/whatsnew/3.11.po b/whatsnew/3.11.po index 4584c32ee1..bf12f1484a 100644 --- a/whatsnew/3.11.po +++ b/whatsnew/3.11.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-05-28 18:21+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -3188,79 +3188,98 @@ msgid "" msgstr ":pep:`594` 引領下列模組的棄用,並排訂於 Python 3.13 移除:" #: ../../whatsnew/3.11.rst:1752 -msgid ":mod:`aifc`" +#, fuzzy +msgid ":mod:`!aifc`" msgstr ":mod:`aifc`" #: ../../whatsnew/3.11.rst:1752 -msgid ":mod:`chunk`" +#, fuzzy +msgid ":mod:`!chunk`" msgstr ":mod:`chunk`" #: ../../whatsnew/3.11.rst:1752 -msgid ":mod:`msilib`" +#, fuzzy +msgid ":mod:`!msilib`" msgstr ":mod:`msilib`" #: ../../whatsnew/3.11.rst:1752 -msgid ":mod:`pipes`" +#, fuzzy +msgid ":mod:`!pipes`" msgstr ":mod:`pipes`" #: ../../whatsnew/3.11.rst:1752 -msgid ":mod:`telnetlib`" +#, fuzzy +msgid ":mod:`!telnetlib`" msgstr ":mod:`telnetlib`" #: ../../whatsnew/3.11.rst:1754 -msgid ":mod:`audioop`" +#, fuzzy +msgid ":mod:`!audioop`" msgstr ":mod:`audioop`" #: ../../whatsnew/3.11.rst:1754 -msgid ":mod:`crypt`" +#, fuzzy +msgid ":mod:`!crypt`" msgstr ":mod:`crypt`" #: ../../whatsnew/3.11.rst:1754 -msgid ":mod:`nis`" +#, fuzzy +msgid ":mod:`!nis`" msgstr ":mod:`nis`" #: ../../whatsnew/3.11.rst:1754 -msgid ":mod:`sndhdr`" +#, fuzzy +msgid ":mod:`!sndhdr`" msgstr ":mod:`sndhdr`" #: ../../whatsnew/3.11.rst:1754 -msgid ":mod:`uu`" +#, fuzzy +msgid ":mod:`!uu`" msgstr ":mod:`uu`" #: ../../whatsnew/3.11.rst:1756 -msgid ":mod:`cgi`" +#, fuzzy +msgid ":mod:`!cgi`" msgstr ":mod:`cgi`" #: ../../whatsnew/3.11.rst:1756 -msgid ":mod:`imghdr`" +#, fuzzy +msgid ":mod:`!imghdr`" msgstr ":mod:`imghdr`" #: ../../whatsnew/3.11.rst:1756 -msgid ":mod:`nntplib`" +#, fuzzy +msgid ":mod:`!nntplib`" msgstr ":mod:`nntplib`" #: ../../whatsnew/3.11.rst:1756 -msgid ":mod:`spwd`" +#, fuzzy +msgid ":mod:`!spwd`" msgstr ":mod:`spwd`" #: ../../whatsnew/3.11.rst:1756 -msgid ":mod:`xdrlib`" +#, fuzzy +msgid ":mod:`!xdrlib`" msgstr ":mod:`xdrlib`" #: ../../whatsnew/3.11.rst:1758 -msgid ":mod:`cgitb`" +#, fuzzy +msgid ":mod:`!cgitb`" msgstr ":mod:`cgitb`" #: ../../whatsnew/3.11.rst:1758 -msgid ":mod:`mailcap`" +#, fuzzy +msgid ":mod:`!mailcap`" msgstr ":mod:`mailcap`" #: ../../whatsnew/3.11.rst:1758 -msgid ":mod:`ossaudiodev`" +#, fuzzy +msgid ":mod:`!ossaudiodev`" msgstr ":mod:`ossaudiodev`" #: ../../whatsnew/3.11.rst:1758 -msgid ":mod:`sunau`" +#, fuzzy +msgid ":mod:`!sunau`" msgstr ":mod:`sunau`" #: ../../whatsnew/3.11.rst:1761 @@ -3283,11 +3302,11 @@ msgstr "" "除。(由 Hugo van Kemenade 於 :issue:`47022` 中貢獻。)" #: ../../whatsnew/3.11.rst:1769 +#, fuzzy msgid "" -"The :mod:`lib2to3` package and :ref:`2to3 <2to3-reference>` tool are now " -"deprecated and may not be able to parse Python 3.10 or newer. See :pep:" -"`617`, introducing the new PEG parser, for details. (Contributed by Victor " -"Stinner in :issue:`40360`.)" +"The :mod:`!lib2to3` package and ``2to3`` tool are now deprecated and may not " +"be able to parse Python 3.10 or newer. See :pep:`617`, introducing the new " +"PEG parser, for details. (Contributed by Victor Stinner in :issue:`40360`.)" msgstr "" ":mod:`lib2to3` 套件和 :ref:`2to3 <2to3-reference>` 工具現已棄用,可能無法剖" "析 Python 3.10 或更新版本。有關詳細資訊請參閱 :pep:`617`,它引入了新的 PEG 剖" @@ -3359,31 +3378,38 @@ msgstr "" "案:" #: ../../whatsnew/3.11.rst:1806 -msgid ":func:`importlib.resources.contents`" +#, fuzzy +msgid ":func:`!importlib.resources.contents`" msgstr ":func:`importlib.resources.contents`" #: ../../whatsnew/3.11.rst:1807 -msgid ":func:`importlib.resources.is_resource`" +#, fuzzy +msgid ":func:`!importlib.resources.is_resource`" msgstr ":func:`importlib.resources.is_resource`" #: ../../whatsnew/3.11.rst:1808 -msgid ":func:`importlib.resources.open_binary`" +#, fuzzy +msgid ":func:`!importlib.resources.open_binary`" msgstr ":func:`importlib.resources.open_binary`" #: ../../whatsnew/3.11.rst:1809 -msgid ":func:`importlib.resources.open_text`" +#, fuzzy +msgid ":func:`!importlib.resources.open_text`" msgstr ":func:`importlib.resources.open_text`" #: ../../whatsnew/3.11.rst:1810 -msgid ":func:`importlib.resources.read_binary`" +#, fuzzy +msgid ":func:`!importlib.resources.read_binary`" msgstr ":func:`importlib.resources.read_binary`" #: ../../whatsnew/3.11.rst:1811 -msgid ":func:`importlib.resources.read_text`" +#, fuzzy +msgid ":func:`!importlib.resources.read_text`" msgstr ":func:`importlib.resources.read_text`" #: ../../whatsnew/3.11.rst:1812 -msgid ":func:`importlib.resources.path`" +#, fuzzy +msgid ":func:`!importlib.resources.path`" msgstr ":func:`importlib.resources.path`" #: ../../whatsnew/3.11.rst:1814 @@ -3399,9 +3425,10 @@ msgstr "" "於 :gh:`90817` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1820 +#, fuzzy msgid "" -"The :func:`locale.resetlocale` function is deprecated and will be removed in " -"Python 3.13. Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. " +"The :func:`!locale.resetlocale` function is deprecated and will be removed " +"in Python 3.13. Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. " "(Contributed by Victor Stinner in :gh:`90817`.)" msgstr "" ":func:`locale.resetlocale` 函式已棄用並將於 Python 3.13 中移除,請改用 " @@ -3438,8 +3465,9 @@ msgstr "" "`92728` 中貢獻。)" #: ../../whatsnew/3.11.rst:1838 +#, fuzzy msgid "" -":func:`turtle.settiltangle` has been deprecated since Python 3.1; it now " +":func:`!turtle.settiltangle` has been deprecated since Python 3.1; it now " "emits a deprecation warning and will be removed in Python 3.13. Use :func:" "`turtle.tiltangle` instead (it was earlier incorrectly marked as deprecated, " "and its docstring is now corrected). (Contributed by Hugo van Kemenade in :" diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index 3c8eb123d2..3c3f4d6e2c 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -239,11 +239,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:156 msgid "" -":pep:`632`: Remove the :mod:`!distutils` package. See :pep:`the migration " -"guide <0632#migration-advice>` for advice replacing the APIs it provided. " -"The third-party `Setuptools <https://setuptools.pypa.io/en/latest/deprecated/" -"distutils-legacy.html>`__ package continues to provide :mod:`!distutils`, if " -"you still require it in Python 3.12 and beyond." +":pep:`632`: Remove the :mod:`!distutils` package. See `the migration guide " +"<https://peps.python.org/pep-0632/#migration-advice>`_ for advice replacing " +"the APIs it provided. The third-party `Setuptools <https://setuptools.pypa." +"io/en/latest/deprecated/distutils-legacy.html>`__ package continues to " +"provide :mod:`!distutils`, if you still require it in Python 3.12 and beyond." msgstr "" #: ../../whatsnew/3.12.rst:163 @@ -265,7 +265,7 @@ msgstr "" "`unittest.TestCase` 的\\ `方法別名 <unittest-TestCase-removed-aliases_>`_\\ " "已被刪除。" -#: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1836 +#: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1825 msgid "New Features" msgstr "新增特性" @@ -525,7 +525,7 @@ msgstr "" #: ../../whatsnew/3.12.rst:361 msgid "" "For further examples how to use the C-API for sub-interpreters with a per-" -"interpreter GIL, see ``Modules/_xxsubinterpretersmodule.c``." +"interpreter GIL, see :source:`Modules/_xxsubinterpretersmodule.c`." msgstr "" #: ../../whatsnew/3.12.rst:364 @@ -979,8 +979,8 @@ msgstr "csv" #: ../../whatsnew/3.12.rst:691 msgid "" "Add :const:`csv.QUOTE_NOTNULL` and :const:`csv.QUOTE_STRINGS` flags to " -"provide finer grained control of ``None`` and empty strings by :class:`csv." -"writer` objects." +"provide finer grained control of ``None`` and empty strings by :class:`~csv." +"reader` and :class:`~csv.writer` objects." msgstr "" #: ../../whatsnew/3.12.rst:696 @@ -1121,36 +1121,27 @@ msgid "" "`99726`.)" msgstr "" -#: ../../whatsnew/3.12.rst:781 -msgid "" -"As of 3.12.4, :func:`os.mkdir` and :func:`os.makedirs` on Windows now " -"support passing a *mode* value of ``0o700`` to apply access control to the " -"new directory. This implicitly affects :func:`tempfile.mkdtemp` and is a " -"mitigation for :cve:`2024-4030`. Other values for *mode* continue to be " -"ignored. (Contributed by Steve Dower in :gh:`118486`.)" -msgstr "" - -#: ../../whatsnew/3.12.rst:789 +#: ../../whatsnew/3.12.rst:782 msgid "os.path" msgstr "os.path" -#: ../../whatsnew/3.12.rst:791 +#: ../../whatsnew/3.12.rst:784 msgid "" "Add :func:`os.path.isjunction` to check if a given path is a junction. " "(Contributed by Charles Machalow in :gh:`99547`.)" msgstr "" -#: ../../whatsnew/3.12.rst:794 +#: ../../whatsnew/3.12.rst:787 msgid "" "Add :func:`os.path.splitroot` to split a path into a triad ``(drive, root, " "tail)``. (Contributed by Barney Gale in :gh:`101000`.)" msgstr "" -#: ../../whatsnew/3.12.rst:798 +#: ../../whatsnew/3.12.rst:791 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.12.rst:800 +#: ../../whatsnew/3.12.rst:793 msgid "" "Add support for subclassing :class:`pathlib.PurePath` and :class:`pathlib." "Path`, plus their Posix- and Windows-specific variants. Subclasses may " @@ -1158,14 +1149,14 @@ msgid "" "information between path instances." msgstr "" -#: ../../whatsnew/3.12.rst:805 +#: ../../whatsnew/3.12.rst:798 msgid "" "Add :meth:`pathlib.Path.walk` for walking the directory trees and generating " "all file or directory names within them, similar to :func:`os.walk`. " "(Contributed by Stanislav Zmiev in :gh:`90385`.)" msgstr "" -#: ../../whatsnew/3.12.rst:809 +#: ../../whatsnew/3.12.rst:802 msgid "" "Add *walk_up* optional parameter to :meth:`pathlib.PurePath.relative_to` to " "allow the insertion of ``..`` entries in the result; this behavior is more " @@ -1173,13 +1164,13 @@ msgid "" "gh:`84538`.)" msgstr "" -#: ../../whatsnew/3.12.rst:814 +#: ../../whatsnew/3.12.rst:807 msgid "" "Add :meth:`pathlib.Path.is_junction` as a proxy to :func:`os.path." "isjunction`. (Contributed by Charles Machalow in :gh:`99547`.)" msgstr "" -#: ../../whatsnew/3.12.rst:817 +#: ../../whatsnew/3.12.rst:810 msgid "" "Add *case_sensitive* optional parameter to :meth:`pathlib.Path.glob`, :meth:" "`pathlib.Path.rglob` and :meth:`pathlib.PurePath.match` for matching the " @@ -1187,22 +1178,22 @@ msgid "" "process." msgstr "" -#: ../../whatsnew/3.12.rst:822 +#: ../../whatsnew/3.12.rst:815 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.12.rst:824 +#: ../../whatsnew/3.12.rst:817 msgid "" "Add convenience variables to hold values temporarily for debug session and " "provide quick access to values like the current frame or the return value. " "(Contributed by Tian Gao in :gh:`103693`.)" msgstr "" -#: ../../whatsnew/3.12.rst:830 +#: ../../whatsnew/3.12.rst:823 msgid "random" msgstr "random" -#: ../../whatsnew/3.12.rst:832 +#: ../../whatsnew/3.12.rst:825 msgid "" "Add :func:`random.binomialvariate`. (Contributed by Raymond Hettinger in :gh:" "`81620`.)" @@ -1210,7 +1201,7 @@ msgstr "" "新增 :func:`random.binomialvariate`。(由 Raymond Hettinger 於 :gh:`81620` 中" "貢獻。)" -#: ../../whatsnew/3.12.rst:835 +#: ../../whatsnew/3.12.rst:828 msgid "" "Add a default of ``lambd=1.0`` to :func:`random.expovariate`. (Contributed " "by Raymond Hettinger in :gh:`100234`.)" @@ -1218,11 +1209,11 @@ msgstr "" "將預設值 ``lambd=1.0`` 加入至 :func:`random.expovariate` 中。(由 Raymond " "Hettinger 在 :gh:`100234` 中貢獻。)" -#: ../../whatsnew/3.12.rst:839 +#: ../../whatsnew/3.12.rst:832 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.12.rst:841 +#: ../../whatsnew/3.12.rst:834 msgid "" ":func:`shutil.make_archive` now passes the *root_dir* argument to custom " "archivers which support it. In this case it no longer temporarily changes " @@ -1230,7 +1221,7 @@ msgid "" "archiving. (Contributed by Serhiy Storchaka in :gh:`74696`.)" msgstr "" -#: ../../whatsnew/3.12.rst:847 +#: ../../whatsnew/3.12.rst:840 msgid "" ":func:`shutil.rmtree` now accepts a new argument *onexc* which is an error " "handler like *onerror* but which expects an exception instance rather than a " @@ -1238,14 +1229,14 @@ msgid "" "Katriel in :gh:`102828`.)" msgstr "" -#: ../../whatsnew/3.12.rst:852 +#: ../../whatsnew/3.12.rst:845 msgid "" ":func:`shutil.which` now consults the *PATHEXT* environment variable to find " "matches within *PATH* on Windows even when the given *cmd* includes a " "directory component. (Contributed by Charles Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:857 +#: ../../whatsnew/3.12.rst:850 msgid "" ":func:`shutil.which` will call ``NeedCurrentDirectoryForExePathW`` when " "querying for executables on Windows to determine if the current working " @@ -1253,18 +1244,18 @@ msgid "" "Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:862 +#: ../../whatsnew/3.12.rst:855 msgid "" ":func:`shutil.which` will return a path matching the *cmd* with a component " "from ``PATHEXT`` prior to a direct match elsewhere in the search path on " "Windows. (Contributed by Charles Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:868 ../../whatsnew/3.12.rst:1540 +#: ../../whatsnew/3.12.rst:861 ../../whatsnew/3.12.rst:1529 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.12.rst:870 +#: ../../whatsnew/3.12.rst:863 msgid "" "Add a :ref:`command-line interface <sqlite3-cli>`. (Contributed by Erlend E. " "Aasland in :gh:`77617`.)" @@ -1272,7 +1263,7 @@ msgstr "" "新增\\ :ref:`命令列介面 <sqlite3-cli>`。(由 Erlend E. Aasland 於 :gh:" "`77617` 中貢獻。)" -#: ../../whatsnew/3.12.rst:873 +#: ../../whatsnew/3.12.rst:866 msgid "" "Add the :attr:`sqlite3.Connection.autocommit` attribute to :class:`sqlite3." "Connection` and the *autocommit* parameter to :func:`sqlite3.connect` to " @@ -1280,43 +1271,43 @@ msgid "" "control-autocommit>`. (Contributed by Erlend E. Aasland in :gh:`83638`.)" msgstr "" -#: ../../whatsnew/3.12.rst:880 +#: ../../whatsnew/3.12.rst:873 msgid "" "Add *entrypoint* keyword-only parameter to :meth:`sqlite3.Connection." "load_extension`, for overriding the SQLite extension entry point. " "(Contributed by Erlend E. Aasland in :gh:`103015`.)" msgstr "" -#: ../../whatsnew/3.12.rst:885 +#: ../../whatsnew/3.12.rst:878 msgid "" "Add :meth:`sqlite3.Connection.getconfig` and :meth:`sqlite3.Connection." "setconfig` to :class:`sqlite3.Connection` to make configuration changes to a " "database connection. (Contributed by Erlend E. Aasland in :gh:`103489`.)" msgstr "" -#: ../../whatsnew/3.12.rst:891 +#: ../../whatsnew/3.12.rst:884 msgid "statistics" msgstr "statistics" -#: ../../whatsnew/3.12.rst:893 +#: ../../whatsnew/3.12.rst:886 msgid "" "Extend :func:`statistics.correlation` to include as a ``ranked`` method for " "computing the Spearman correlation of ranked data. (Contributed by Raymond " "Hettinger in :gh:`95861`.)" msgstr "" -#: ../../whatsnew/3.12.rst:898 +#: ../../whatsnew/3.12.rst:891 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.12.rst:900 +#: ../../whatsnew/3.12.rst:893 msgid "" "Add the :mod:`sys.monitoring` namespace to expose the new :ref:`PEP 669 " "<whatsnew312-pep669>` monitoring API. (Contributed by Mark Shannon in :gh:" "`103082`.)" msgstr "" -#: ../../whatsnew/3.12.rst:904 +#: ../../whatsnew/3.12.rst:897 msgid "" "Add :func:`sys.activate_stack_trampoline` and :func:`sys." "deactivate_stack_trampoline` for activating and deactivating stack profiler " @@ -1326,7 +1317,7 @@ msgid "" "Shannon in :gh:`96123`.)" msgstr "" -#: ../../whatsnew/3.12.rst:913 +#: ../../whatsnew/3.12.rst:906 msgid "" "Add :data:`sys.last_exc` which holds the last unhandled exception that was " "raised (for post-mortem debugging use cases). Deprecate the three fields " @@ -1335,14 +1326,14 @@ msgid "" "Katriel in :gh:`102778`.)" msgstr "" -#: ../../whatsnew/3.12.rst:919 ../../whatsnew/3.12.rst:1735 +#: ../../whatsnew/3.12.rst:912 ../../whatsnew/3.12.rst:1724 msgid "" ":func:`sys._current_exceptions` now returns a mapping from thread-id to an " "exception instance, rather than to a ``(typ, exc, tb)`` tuple. (Contributed " "by Irit Katriel in :gh:`103176`.)" msgstr "" -#: ../../whatsnew/3.12.rst:923 +#: ../../whatsnew/3.12.rst:916 msgid "" ":func:`sys.setrecursionlimit` and :func:`sys.getrecursionlimit`. The " "recursion limit now applies only to Python code. Builtin functions do not " @@ -1350,11 +1341,11 @@ msgid "" "prevents recursion from causing a virtual machine crash." msgstr "" -#: ../../whatsnew/3.12.rst:929 +#: ../../whatsnew/3.12.rst:922 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.12.rst:931 +#: ../../whatsnew/3.12.rst:924 msgid "" "The :class:`tempfile.NamedTemporaryFile` function has a new optional " "parameter *delete_on_close* (Contributed by Evgeny Zorin in :gh:`58451`.)" @@ -1362,7 +1353,7 @@ msgstr "" ":class:`tempfile.NamedTemporaryFile` 函式新增了一個選擇性參數 " "*delete_on_close* (由 Evgeny Zorin 於 :gh:`58451` 中貢獻。)" -#: ../../whatsnew/3.12.rst:933 +#: ../../whatsnew/3.12.rst:926 msgid "" ":func:`tempfile.mkdtemp` now always returns an absolute path, even if the " "argument provided to the *dir* parameter is a relative path." @@ -1370,19 +1361,11 @@ msgstr "" ":func:`tempfile.mkdtemp` 現在總是會傳回絕對路徑,即使提供給 *dir* 參數的引數" "是相對路徑。" -#: ../../whatsnew/3.12.rst:935 -msgid "" -"As of 3.12.4 on Windows, the default mode ``0o700`` used by :func:`tempfile." -"mkdtemp` now limits access to the new directory due to changes to :func:`os." -"mkdir`. This is a mitigation for :cve:`2024-4030`. (Contributed by Steve " -"Dower in :gh:`118486`.)" -msgstr "" - -#: ../../whatsnew/3.12.rst:941 +#: ../../whatsnew/3.12.rst:930 msgid "threading" msgstr "threading" -#: ../../whatsnew/3.12.rst:943 +#: ../../whatsnew/3.12.rst:932 msgid "" "Add :func:`threading.settrace_all_threads` and :func:`threading." "setprofile_all_threads` that allow to set tracing and profiling functions in " @@ -1390,11 +1373,11 @@ msgid "" "Galindo in :gh:`93503`.)" msgstr "" -#: ../../whatsnew/3.12.rst:949 +#: ../../whatsnew/3.12.rst:938 msgid "tkinter" msgstr "tkinter" -#: ../../whatsnew/3.12.rst:951 +#: ../../whatsnew/3.12.rst:940 msgid "" "``tkinter.Canvas.coords()`` now flattens its arguments. It now accepts not " "only coordinates as separate arguments (``x1, y1, x2, y2, ...``) and a " @@ -1404,11 +1387,11 @@ msgid "" "in :gh:`94473`.)" msgstr "" -#: ../../whatsnew/3.12.rst:960 +#: ../../whatsnew/3.12.rst:949 msgid "tokenize" msgstr "tokenize" -#: ../../whatsnew/3.12.rst:962 +#: ../../whatsnew/3.12.rst:951 msgid "" "The :mod:`tokenize` module includes the changes introduced in :pep:`701`. " "(Contributed by Marta Gómez Macías and Pablo Galindo in :gh:`102856`.) See :" @@ -1416,22 +1399,22 @@ msgid "" "to the :mod:`tokenize` module." msgstr "" -#: ../../whatsnew/3.12.rst:968 +#: ../../whatsnew/3.12.rst:957 msgid "types" msgstr "types" -#: ../../whatsnew/3.12.rst:970 +#: ../../whatsnew/3.12.rst:959 msgid "" "Add :func:`types.get_original_bases` to allow for further introspection of :" "ref:`user-defined-generics` when subclassed. (Contributed by James Hilton-" "Balfe and Alex Waygood in :gh:`101827`.)" msgstr "" -#: ../../whatsnew/3.12.rst:977 +#: ../../whatsnew/3.12.rst:966 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.12.rst:979 +#: ../../whatsnew/3.12.rst:968 msgid "" ":func:`isinstance` checks against :func:`runtime-checkable protocols <typing." "runtime_checkable>` now use :func:`inspect.getattr_static` rather than :func:" @@ -1444,7 +1427,7 @@ msgid "" "affected by this change. (Contributed by Alex Waygood in :gh:`102433`.)" msgstr "" -#: ../../whatsnew/3.12.rst:990 +#: ../../whatsnew/3.12.rst:979 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 " @@ -1452,7 +1435,7 @@ msgid "" "on :func:`isinstance` checks comparing objects to the protocol. For example::" msgstr "" -#: ../../whatsnew/3.12.rst:995 +#: ../../whatsnew/3.12.rst:984 msgid "" ">>> from typing import Protocol, runtime_checkable\n" ">>> @runtime_checkable\n" @@ -1473,13 +1456,13 @@ msgid "" "True" msgstr "" -#: ../../whatsnew/3.12.rst:1012 +#: ../../whatsnew/3.12.rst:1001 msgid "" "This change was made in order to speed up ``isinstance()`` checks against " "runtime-checkable protocols." msgstr "" -#: ../../whatsnew/3.12.rst:1015 +#: ../../whatsnew/3.12.rst:1004 msgid "" "The performance profile of :func:`isinstance` checks against :func:`runtime-" "checkable protocols <typing.runtime_checkable>` has changed significantly. " @@ -1490,14 +1473,14 @@ msgid "" "`74690` and :gh:`103193`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1023 +#: ../../whatsnew/3.12.rst:1012 msgid "" "All :data:`typing.TypedDict` and :data:`typing.NamedTuple` classes now have " "the ``__orig_bases__`` attribute. (Contributed by Adrian Garcia Badaracco " "in :gh:`103699`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1027 +#: ../../whatsnew/3.12.rst:1016 msgid "" "Add ``frozen_default`` parameter to :func:`typing.dataclass_transform`. " "(Contributed by Erik De Bonte in :gh:`99957`.)" @@ -1505,26 +1488,26 @@ msgstr "" "新增 ``frozen_default`` 參數至 :func:`typing.dataclass_transform`。(由 Erik " "De Bonte 於 :gh:`99957` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1031 +#: ../../whatsnew/3.12.rst:1020 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.12.rst:1033 +#: ../../whatsnew/3.12.rst:1022 msgid "" "The Unicode database has been updated to version 15.0.0. (Contributed by " "Benjamin Peterson in :gh:`96734`)." msgstr "" -#: ../../whatsnew/3.12.rst:1037 ../../whatsnew/3.12.rst:1580 +#: ../../whatsnew/3.12.rst:1026 ../../whatsnew/3.12.rst:1569 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.12.rst:1039 +#: ../../whatsnew/3.12.rst:1028 msgid "" "Add a ``--durations`` command line option, showing the N slowest test cases::" msgstr "新增 ``--durations`` 命令列選項,顯示 N 個最慢的測試案例:" -#: ../../whatsnew/3.12.rst:1041 +#: ../../whatsnew/3.12.rst:1030 msgid "" "python3 -m unittest --durations=3 lib.tests.test_threading\n" ".....\n" @@ -1554,15 +1537,15 @@ msgstr "" "\n" "OK (skipped=3)" -#: ../../whatsnew/3.12.rst:1055 +#: ../../whatsnew/3.12.rst:1044 msgid "(Contributed by Giampaolo Rodola in :gh:`48330`)" msgstr "(由 Giampaolo Rodola 於 :gh:`48330` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1058 +#: ../../whatsnew/3.12.rst:1047 msgid "uuid" msgstr "uuid" -#: ../../whatsnew/3.12.rst:1060 +#: ../../whatsnew/3.12.rst:1049 msgid "" "Add a :ref:`command-line interface <uuid-cli>`. (Contributed by Adam Chhina " "in :gh:`88597`.)" @@ -1570,25 +1553,25 @@ msgstr "" "新增一個\\ :ref:`命令列介面 <uuid-cli>`。(由 Adam Chhina 於 :gh:`88597` 中貢" "獻。)" -#: ../../whatsnew/3.12.rst:1065 +#: ../../whatsnew/3.12.rst:1054 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.12.rst:1067 +#: ../../whatsnew/3.12.rst:1056 msgid "" "Remove ``wstr`` and ``wstr_length`` members from Unicode objects. It reduces " "object size by 8 or 16 bytes on 64bit platform. (:pep:`623`) (Contributed by " "Inada Naoki in :gh:`92536`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1071 +#: ../../whatsnew/3.12.rst:1060 msgid "" "Add experimental support for using the BOLT binary optimizer in the build " "process, which improves performance by 1-5%. (Contributed by Kevin " "Modzelewski in :gh:`90536` and tuned by Donghee Na in :gh:`101525`)" msgstr "" -#: ../../whatsnew/3.12.rst:1075 +#: ../../whatsnew/3.12.rst:1064 msgid "" "Speed up the regular expression substitution (functions :func:`re.sub` and :" "func:`re.subn` and corresponding :class:`!re.Pattern` methods) for " @@ -1596,13 +1579,13 @@ msgid "" "by Serhiy Storchaka in :gh:`91524`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1080 +#: ../../whatsnew/3.12.rst:1069 msgid "" "Speed up :class:`asyncio.Task` creation by deferring expensive string " "formatting. (Contributed by Itamar Oren in :gh:`103793`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1083 +#: ../../whatsnew/3.12.rst:1072 msgid "" "The :func:`tokenize.tokenize` and :func:`tokenize.generate_tokens` functions " "are up to 64% faster as a side effect of the changes required to cover :pep:" @@ -1610,18 +1593,18 @@ msgid "" "Pablo Galindo in :gh:`102856`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1088 +#: ../../whatsnew/3.12.rst:1077 msgid "" "Speed up :func:`super` method calls and attribute loads via the new :opcode:" "`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and Vladimir " "Matveev in :gh:`103497`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1094 +#: ../../whatsnew/3.12.rst:1083 msgid "CPython bytecode changes" msgstr "CPython 位元組碼變更" -#: ../../whatsnew/3.12.rst:1096 +#: ../../whatsnew/3.12.rst:1085 msgid "" "Remove the :opcode:`!LOAD_METHOD` instruction. It has been merged into :" "opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the old :opcode:" @@ -1629,62 +1612,62 @@ msgid "" "by Ken Jin in :gh:`93429`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1101 +#: ../../whatsnew/3.12.rst:1090 msgid "" "Remove the :opcode:`!JUMP_IF_FALSE_OR_POP` and :opcode:`!" "JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel in :gh:" "`102859`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1104 +#: ../../whatsnew/3.12.rst:1093 msgid "" "Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon in :" "gh:`92925`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1107 +#: ../../whatsnew/3.12.rst:1096 msgid "" "Add the :opcode:`BINARY_SLICE` and :opcode:`STORE_SLICE` instructions. " "(Contributed by Mark Shannon in :gh:`94163`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1110 +#: ../../whatsnew/3.12.rst:1099 msgid "" "Add the :opcode:`CALL_INTRINSIC_1` instructions. (Contributed by Mark " "Shannon in :gh:`99005`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1113 +#: ../../whatsnew/3.12.rst:1102 msgid "" "Add the :opcode:`CALL_INTRINSIC_2` instruction. (Contributed by Irit Katriel " "in :gh:`101799`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1116 +#: ../../whatsnew/3.12.rst:1105 msgid "" "Add the :opcode:`CLEANUP_THROW` instruction. (Contributed by Brandt Bucher " "in :gh:`90997`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1119 +#: ../../whatsnew/3.12.rst:1108 msgid "" "Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon in :gh:" "`103082`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1122 +#: ../../whatsnew/3.12.rst:1111 msgid "" "Add the :opcode:`LOAD_FAST_AND_CLEAR` instruction as part of the " "implementation of :pep:`709`. (Contributed by Carl Meyer in :gh:`101441`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1125 +#: ../../whatsnew/3.12.rst:1114 msgid "" "Add the :opcode:`LOAD_FAST_CHECK` instruction. (Contributed by Dennis " "Sweeney in :gh:`93143`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1128 +#: ../../whatsnew/3.12.rst:1117 msgid "" "Add the :opcode:`LOAD_FROM_DICT_OR_DEREF`, :opcode:" "`LOAD_FROM_DICT_OR_GLOBALS`, and :opcode:`LOAD_LOCALS` opcodes as part of " @@ -1693,41 +1676,41 @@ msgid "" "`LOAD_FROM_DICT_OR_DEREF`. (Contributed by Jelle Zijlstra in :gh:`103764`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1134 +#: ../../whatsnew/3.12.rst:1123 msgid "" "Add the :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer " "and Vladimir Matveev in :gh:`103497`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1137 +#: ../../whatsnew/3.12.rst:1126 msgid "" "Add the :opcode:`RETURN_CONST` instruction. (Contributed by Wenyang Wang in :" "gh:`101632`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1140 +#: ../../whatsnew/3.12.rst:1129 msgid "Demos and Tools" msgstr "" -#: ../../whatsnew/3.12.rst:1142 +#: ../../whatsnew/3.12.rst:1131 msgid "" "Remove the ``Tools/demo/`` directory which contained old demo scripts. A " "copy can be found in the `old-demos project <https://github.com/gvanrossum/" "old-demos>`_. (Contributed by Victor Stinner in :gh:`97681`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1147 +#: ../../whatsnew/3.12.rst:1136 msgid "" "Remove outdated example scripts of the ``Tools/scripts/`` directory. A copy " "can be found in the `old-demos project <https://github.com/gvanrossum/old-" "demos>`_. (Contributed by Victor Stinner in :gh:`97669`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1154 ../../whatsnew/3.12.rst:2138 +#: ../../whatsnew/3.12.rst:1143 ../../whatsnew/3.12.rst:2127 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.12.rst:1156 +#: ../../whatsnew/3.12.rst:1145 #: ../../deprecations/pending-removal-in-3.14.rst:4 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" @@ -1738,7 +1721,7 @@ msgstr "" "*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " "於 :gh:`92248` 貢獻。)" -#: ../../whatsnew/3.12.rst:1161 +#: ../../whatsnew/3.12.rst:1150 msgid "" ":mod:`ast`: The following :mod:`ast` features have been deprecated in " "documentation since Python 3.8, now cause a :exc:`DeprecationWarning` to be " @@ -1746,32 +1729,32 @@ msgid "" "Python 3.14:" msgstr "" -#: ../../whatsnew/3.12.rst:1165 +#: ../../whatsnew/3.12.rst:1154 #: ../../deprecations/pending-removal-in-3.14.rst:13 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" -#: ../../whatsnew/3.12.rst:1166 +#: ../../whatsnew/3.12.rst:1155 #: ../../deprecations/pending-removal-in-3.14.rst:14 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" -#: ../../whatsnew/3.12.rst:1167 +#: ../../whatsnew/3.12.rst:1156 #: ../../deprecations/pending-removal-in-3.14.rst:15 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" -#: ../../whatsnew/3.12.rst:1168 +#: ../../whatsnew/3.12.rst:1157 #: ../../deprecations/pending-removal-in-3.14.rst:16 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" -#: ../../whatsnew/3.12.rst:1169 +#: ../../whatsnew/3.12.rst:1158 #: ../../deprecations/pending-removal-in-3.14.rst:17 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" -#: ../../whatsnew/3.12.rst:1171 +#: ../../whatsnew/3.12.rst:1160 #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" @@ -1779,12 +1762,12 @@ msgid "" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" -#: ../../whatsnew/3.12.rst:1174 +#: ../../whatsnew/3.12.rst:1163 #: ../../deprecations/pending-removal-in-3.14.rst:22 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" -#: ../../whatsnew/3.12.rst:1176 +#: ../../whatsnew/3.12.rst:1165 msgid "" "The child watcher classes :class:`asyncio.MultiLoopChildWatcher`, :class:" "`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher` and :class:" @@ -1792,7 +1775,7 @@ msgid "" "3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1182 +#: ../../whatsnew/3.12.rst:1171 #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" @@ -1805,7 +1788,7 @@ msgstr "" "AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" "除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" -#: ../../whatsnew/3.12.rst:1188 +#: ../../whatsnew/3.12.rst:1177 #: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " @@ -1817,7 +1800,7 @@ msgstr "" "件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" -#: ../../whatsnew/3.12.rst:1193 +#: ../../whatsnew/3.12.rst:1182 #: ../../deprecations/pending-removal-in-future.rst:41 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " @@ -1828,7 +1811,7 @@ msgstr "" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " "Roshan 於 :gh:`103636` 貢獻。)" -#: ../../whatsnew/3.12.rst:1197 +#: ../../whatsnew/3.12.rst:1186 msgid "" ":mod:`collections.abc`: Deprecated :class:`collections.abc.ByteString`. " "Prefer :class:`Sequence` or :class:`collections.abc.Buffer`. For use in " @@ -1836,7 +1819,7 @@ msgid "" "abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1202 +#: ../../whatsnew/3.12.rst:1191 msgid "" ":mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime." "utcnow` and :meth:`~datetime.datetime.utcfromtimestamp` are deprecated and " @@ -1846,7 +1829,7 @@ msgid "" "set to :const:`datetime.UTC`. (Contributed by Paul Ganssle in :gh:`103857`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1210 +#: ../../whatsnew/3.12.rst:1199 msgid "" ":mod:`email`: Deprecate the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" @@ -1854,48 +1837,48 @@ msgstr "" ":mod:`email`:棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1213 +#: ../../whatsnew/3.12.rst:1202 msgid "" ":mod:`importlib.abc`: Deprecated the following classes, scheduled for " "removal in Python 3.14:" msgstr ":mod:`importlib.abc`:棄用下列類別,預定於 Python 3.14 中移除:" -#: ../../whatsnew/3.12.rst:1216 +#: ../../whatsnew/3.12.rst:1205 #: ../../deprecations/pending-removal-in-3.14.rst:55 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../whatsnew/3.12.rst:1217 +#: ../../whatsnew/3.12.rst:1206 #: ../../deprecations/pending-removal-in-3.14.rst:56 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../whatsnew/3.12.rst:1218 +#: ../../whatsnew/3.12.rst:1207 #: ../../deprecations/pending-removal-in-3.14.rst:57 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../whatsnew/3.12.rst:1220 +#: ../../whatsnew/3.12.rst:1209 #: ../../deprecations/pending-removal-in-3.14.rst:59 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../whatsnew/3.12.rst:1222 +#: ../../whatsnew/3.12.rst:1211 #: ../../deprecations/pending-removal-in-3.14.rst:61 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../whatsnew/3.12.rst:1223 +#: ../../whatsnew/3.12.rst:1212 #: ../../deprecations/pending-removal-in-3.14.rst:62 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../whatsnew/3.12.rst:1225 +#: ../../whatsnew/3.12.rst:1214 #: ../../deprecations/pending-removal-in-3.14.rst:64 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../whatsnew/3.12.rst:1227 +#: ../../whatsnew/3.12.rst:1216 msgid "" ":mod:`itertools`: Deprecate the support for copy, deepcopy, and pickle " "operations, which is undocumented, inefficient, historically buggy, and " @@ -1904,7 +1887,7 @@ msgid "" "`101588`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1233 +#: ../../whatsnew/3.12.rst:1222 msgid "" ":mod:`multiprocessing`: In Python 3.14, the default :mod:`multiprocessing` " "start method will change to a safer one on Linux, BSDs, and other non-macOS " @@ -1916,14 +1899,14 @@ msgid "" "methods <multiprocessing-start-methods>`." msgstr "" -#: ../../whatsnew/3.12.rst:1243 +#: ../../whatsnew/3.12.rst:1232 msgid "" ":mod:`pkgutil`: :func:`pkgutil.find_loader` and :func:`pkgutil.get_loader` " "are deprecated and will be removed in Python 3.14; use :func:`importlib.util." "find_spec` instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1248 +#: ../../whatsnew/3.12.rst:1237 msgid "" ":mod:`pty`: The module has two undocumented ``master_open()`` and " "``slave_open()`` functions that have been deprecated since Python 2 but only " @@ -1931,11 +1914,11 @@ msgid "" "(Contributed by Soumendra Ganguly and Gregory P. Smith in :gh:`85984`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1253 +#: ../../whatsnew/3.12.rst:1242 msgid ":mod:`os`:" msgstr ":mod:`os`:" -#: ../../whatsnew/3.12.rst:1255 +#: ../../whatsnew/3.12.rst:1244 msgid "" "The ``st_ctime`` fields return by :func:`os.stat` and :func:`os.lstat` on " "Windows are deprecated. In a future release, they will contain the last " @@ -1944,7 +1927,7 @@ msgid "" "``st_birthtime`` field. (Contributed by Steve Dower in :gh:`99726`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1261 +#: ../../whatsnew/3.12.rst:1250 msgid "" "On POSIX platforms, :func:`os.fork` can now raise a :exc:" "`DeprecationWarning` when it can detect being called from a multithreaded " @@ -1953,19 +1936,18 @@ msgid "" "warning to raise awareness as issues encountered by code doing this are " "becoming more frequent. See the :func:`os.fork` documentation for more " "details along with `this discussion on fork being incompatible with threads " -"<https://discuss.python.org/t/concerns-regarding-deprecation-of-fork-with-" -"alive-threads/33555>`_ for *why* we're now surfacing this longstanding " -"platform compatibility problem to developers." +"<https://discuss.python.org/t/33555>`_ for *why* we're now surfacing this " +"longstanding platform compatibility problem to developers." msgstr "" -#: ../../whatsnew/3.12.rst:1271 +#: ../../whatsnew/3.12.rst:1260 msgid "" "When this warning appears due to usage of :mod:`multiprocessing` or :mod:" "`concurrent.futures` the fix is to use a different :mod:`multiprocessing` " "start method such as ``\"spawn\"`` or ``\"forkserver\"``." msgstr "" -#: ../../whatsnew/3.12.rst:1275 +#: ../../whatsnew/3.12.rst:1264 msgid "" ":mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree` is " "deprecated; use *onexc* instead. (Contributed by Irit Katriel in :gh:" @@ -1974,19 +1956,19 @@ msgstr "" ":mod:`shutil`::func:`shutil.rmtree` 的 *onerror* 引數已被棄用,請改用 " "*onexc*。(由 Irit Katriel 於 :gh:`102828` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1278 +#: ../../whatsnew/3.12.rst:1267 #: ../../deprecations/pending-removal-in-3.14.rst:94 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../whatsnew/3.12.rst:1280 +#: ../../whatsnew/3.12.rst:1269 msgid "" ":ref:`default adapters and converters <sqlite3-default-converters>` are now " "deprecated. Instead, use the :ref:`sqlite3-adapter-converter-recipes` and " "tailor them to your needs. (Contributed by Erlend E. Aasland in :gh:`90016`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1286 +#: ../../whatsnew/3.12.rst:1275 msgid "" "In :meth:`~sqlite3.Cursor.execute`, :exc:`DeprecationWarning` is now emitted " "when :ref:`named placeholders <sqlite3-placeholders>` are used together with " @@ -1996,39 +1978,39 @@ msgid "" "Erlend E. Aasland in :gh:`101698`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1293 +#: ../../whatsnew/3.12.rst:1282 msgid "" ":mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` and :data:`sys." "last_traceback` fields are deprecated. Use :data:`sys.last_exc` instead. " "(Contributed by Irit Katriel in :gh:`102778`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1297 +#: ../../whatsnew/3.12.rst:1286 msgid "" ":mod:`tarfile`: Extracting tar archives without specifying *filter* is " "deprecated until Python 3.14, when ``'data'`` filter will become the " "default. See :ref:`tarfile-extraction-filter` for details." msgstr "" -#: ../../whatsnew/3.12.rst:1301 +#: ../../whatsnew/3.12.rst:1290 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../whatsnew/3.12.rst:1303 +#: ../../whatsnew/3.12.rst:1292 msgid "" ":class:`typing.Hashable` and :class:`typing.Sized`, aliases for :class:" "`collections.abc.Hashable` and :class:`collections.abc.Sized` respectively, " "are deprecated. (:gh:`94309`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1307 +#: ../../whatsnew/3.12.rst:1296 msgid "" ":class:`typing.ByteString`, deprecated since Python 3.9, now causes a :exc:" "`DeprecationWarning` to be emitted when it is used. (Contributed by Alex " "Waygood in :gh:`91896`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1311 +#: ../../whatsnew/3.12.rst:1300 msgid "" ":mod:`xml.etree.ElementTree`: The module now emits :exc:`DeprecationWarning` " "when testing the truth value of an :class:`xml.etree.ElementTree.Element`. " @@ -2036,7 +2018,7 @@ msgid "" "implementation emitted nothing. (Contributed by Jacob Walls in :gh:`83122`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1317 +#: ../../whatsnew/3.12.rst:1306 msgid "" "The 3-arg signatures (type, value, traceback) of :meth:`coroutine throw() " "<coroutine.throw>`, :meth:`generator throw() <generator.throw>` and :meth:" @@ -2045,21 +2027,21 @@ msgid "" "instead. (Contributed by Ofey Chan in :gh:`89874`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1323 +#: ../../whatsnew/3.12.rst:1312 msgid "" ":exc:`DeprecationWarning` is now raised when ``__package__`` on a module " "differs from ``__spec__.parent`` (previously it was :exc:`ImportWarning`). " "(Contributed by Brett Cannon in :gh:`65961`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1328 +#: ../../whatsnew/3.12.rst:1317 msgid "" "Setting ``__package__`` or ``__cached__`` on a module is deprecated, and " "will cease to be set or taken into consideration by the import system in " "Python 3.14. (Contributed by Brett Cannon in :gh:`65961`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1332 +#: ../../whatsnew/3.12.rst:1321 msgid "" "The bitwise inversion operator (``~``) on bool is deprecated. It will throw " "an error in Python 3.16. Use ``not`` for logical negation of bools instead. " @@ -2068,7 +2050,7 @@ msgid "" "Tim Hoffmann in :gh:`103487`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1338 +#: ../../whatsnew/3.12.rst:1327 msgid "" "Accessing :attr:`~codeobject.co_lnotab` on code objects was deprecated in " "Python 3.10 via :pep:`626`, but it only got a proper :exc:" @@ -2085,80 +2067,80 @@ msgid "Modules (see :pep:`594`):" msgstr "模組(請見 :pep:`594`):" #: ../../deprecations/pending-removal-in-3.13.rst:6 -msgid ":mod:`aifc`" -msgstr ":mod:`aifc`" +msgid ":mod:`!aifc`" +msgstr ":mod:`!aifc`" #: ../../deprecations/pending-removal-in-3.13.rst:7 -msgid ":mod:`audioop`" -msgstr ":mod:`audioop`" +msgid ":mod:`!audioop`" +msgstr ":mod:`!audioop`" #: ../../deprecations/pending-removal-in-3.13.rst:8 -msgid ":mod:`cgi`" -msgstr ":mod:`cgi`" +msgid ":mod:`!cgi`" +msgstr ":mod:`!cgi`" #: ../../deprecations/pending-removal-in-3.13.rst:9 -msgid ":mod:`cgitb`" -msgstr ":mod:`cgitb`" +msgid ":mod:`!cgitb`" +msgstr ":mod:`!cgitb`" #: ../../deprecations/pending-removal-in-3.13.rst:10 -msgid ":mod:`chunk`" -msgstr ":mod:`chunk`" +msgid ":mod:`!chunk`" +msgstr ":mod:`!chunk`" #: ../../deprecations/pending-removal-in-3.13.rst:11 -msgid ":mod:`crypt`" -msgstr ":mod:`crypt`" +msgid ":mod:`!crypt`" +msgstr ":mod:`!crypt`" #: ../../deprecations/pending-removal-in-3.13.rst:12 -msgid ":mod:`imghdr`" -msgstr ":mod:`imghdr`" +msgid ":mod:`!imghdr`" +msgstr ":mod:`!imghdr`" #: ../../deprecations/pending-removal-in-3.13.rst:13 -msgid ":mod:`mailcap`" -msgstr ":mod:`mailcap`" +msgid ":mod:`!mailcap`" +msgstr ":mod:`!mailcap`" #: ../../deprecations/pending-removal-in-3.13.rst:14 -msgid ":mod:`msilib`" -msgstr ":mod:`msilib`" +msgid ":mod:`!msilib`" +msgstr ":mod:`!msilib`" #: ../../deprecations/pending-removal-in-3.13.rst:15 -msgid ":mod:`nis`" -msgstr ":mod:`nis`" +msgid ":mod:`!nis`" +msgstr ":mod:`!nis`" #: ../../deprecations/pending-removal-in-3.13.rst:16 -msgid ":mod:`nntplib`" -msgstr ":mod:`nntplib`" +msgid ":mod:`!nntplib`" +msgstr ":mod:`!nntplib`" #: ../../deprecations/pending-removal-in-3.13.rst:17 -msgid ":mod:`ossaudiodev`" -msgstr ":mod:`ossaudiodev`" +msgid ":mod:`!ossaudiodev`" +msgstr ":mod:`!ossaudiodev`" #: ../../deprecations/pending-removal-in-3.13.rst:18 -msgid ":mod:`pipes`" -msgstr ":mod:`pipes`" +msgid ":mod:`!pipes`" +msgstr ":mod:`!pipes`" #: ../../deprecations/pending-removal-in-3.13.rst:19 -msgid ":mod:`sndhdr`" -msgstr ":mod:`sndhdr`" +msgid ":mod:`!sndhdr`" +msgstr ":mod:`!sndhdr`" #: ../../deprecations/pending-removal-in-3.13.rst:20 -msgid ":mod:`spwd`" -msgstr ":mod:`spwd`" +msgid ":mod:`!spwd`" +msgstr ":mod:`!spwd`" #: ../../deprecations/pending-removal-in-3.13.rst:21 -msgid ":mod:`sunau`" -msgstr ":mod:`sunau`" +msgid ":mod:`!sunau`" +msgstr ":mod:`!sunau`" #: ../../deprecations/pending-removal-in-3.13.rst:22 -msgid ":mod:`telnetlib`" -msgstr ":mod:`telnetlib`" +msgid ":mod:`!telnetlib`" +msgstr ":mod:`!telnetlib`" #: ../../deprecations/pending-removal-in-3.13.rst:23 -msgid ":mod:`uu`" -msgstr ":mod:`uu`" +msgid ":mod:`!uu`" +msgstr ":mod:`!uu`" #: ../../deprecations/pending-removal-in-3.13.rst:24 -msgid ":mod:`xdrlib`" -msgstr ":mod:`xdrlib`" +msgid ":mod:`!xdrlib`" +msgstr ":mod:`!xdrlib`" #: ../../deprecations/pending-removal-in-3.13.rst:26 msgid "Other modules:" @@ -2449,12 +2431,11 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:16 msgid "" ":mod:`pathlib`: :meth:`pathlib.PurePath.is_reserved` is deprecated and " -"scheduled for removal in Python 3.15. From Python 3.13 onwards, use ``os." -"path.isreserved`` to detect reserved paths on Windows." +"scheduled for removal in Python 3.15. Use :func:`os.path.isreserved` to " +"detect reserved paths on Windows." msgstr "" ":mod:`pathlib`::meth:`pathlib.PurePath.is_reserved` 已被棄用並計劃在 Python " -"3.15 中移除。從 Python 3.13 開始,請用 ``os.path.isreserved`` 來偵測 Windows " -"上的保留路徑。" +"3.15 中移除。請用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:21 msgid "" @@ -2719,17 +2700,23 @@ msgstr "回傳值上的隱式 ``None``。" #: ../../deprecations/pending-removal-in-future.rst:69 msgid "" +":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " +"use :meth:`~logging.warning` instead." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:72 +msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:75 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:74 +#: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -2737,7 +2724,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:80 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -2749,12 +2736,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:84 +#: ../../deprecations/pending-removal-in-future.rst:87 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:86 +#: ../../deprecations/pending-removal-in-future.rst:89 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -2762,15 +2749,15 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:92 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:91 +#: ../../deprecations/pending-removal-in-future.rst:94 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:95 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" "`!selected_npn_protocol` are deprecated: use ALPN instead." @@ -2778,58 +2765,58 @@ msgstr "" ":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" "`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:96 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:97 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:107 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid "" ":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " "ignored." msgstr "" ":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" -#: ../../deprecations/pending-removal-in-future.rst:109 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:111 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid "" ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." "notify_all`." @@ -2837,11 +2824,11 @@ msgstr "" ":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." "notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:113 +#: ../../deprecations/pending-removal-in-future.rst:116 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" "attr:`threading.Thread.daemon` attribute." @@ -2849,7 +2836,7 @@ msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:118 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" "attr:`threading.Thread.name` attribute." @@ -2857,20 +2844,20 @@ msgstr "" ":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" "attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:117 +#: ../../deprecations/pending-removal-in-future.rst:120 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:121 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:123 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:122 +#: ../../deprecations/pending-removal-in-future.rst:125 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -2878,58 +2865,58 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:127 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:129 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:135 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:137 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:139 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "" ":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" "`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " @@ -2939,13 +2926,13 @@ msgstr "" "class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" "`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:143 +#: ../../deprecations/pending-removal-in-future.rst:146 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:149 msgid "" ":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." "etree.ElementTree.Element` is deprecated. In a future release it will always " @@ -2956,7 +2943,7 @@ msgstr "" "Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " "``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:151 +#: ../../deprecations/pending-removal-in-future.rst:154 msgid "" ":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" "`~zipimport.zipimporter.exec_module` instead." @@ -2964,32 +2951,32 @@ msgstr "" ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." "zipimporter.exec_module`。" -#: ../../whatsnew/3.12.rst:1355 ../../whatsnew/3.12.rst:2233 +#: ../../whatsnew/3.12.rst:1344 ../../whatsnew/3.12.rst:2222 msgid "Removed" msgstr "已移除" -#: ../../whatsnew/3.12.rst:1358 +#: ../../whatsnew/3.12.rst:1347 msgid "asynchat and asyncore" msgstr "asynchat 和 asyncore" -#: ../../whatsnew/3.12.rst:1360 +#: ../../whatsnew/3.12.rst:1349 msgid "" "These two modules have been removed according to the schedule in :pep:`594`, " "having been deprecated in Python 3.6. Use :mod:`asyncio` instead. " "(Contributed by Nikita Sobolev in :gh:`96580`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1367 +#: ../../whatsnew/3.12.rst:1356 msgid "configparser" msgstr "configparser" -#: ../../whatsnew/3.12.rst:1369 +#: ../../whatsnew/3.12.rst:1358 msgid "" "Several names deprecated in the :mod:`configparser` way back in 3.2 have " "been removed per :gh:`89336`:" msgstr "" -#: ../../whatsnew/3.12.rst:1372 +#: ../../whatsnew/3.12.rst:1361 msgid "" ":class:`configparser.ParsingError` no longer has a ``filename`` attribute or " "argument. Use the ``source`` attribute and argument instead." @@ -2997,23 +2984,23 @@ msgstr "" ":class:`configparser.ParsingError` 不再具有 ``filename`` 屬性或引數。請改用 " "``source`` 屬性和引數。" -#: ../../whatsnew/3.12.rst:1374 +#: ../../whatsnew/3.12.rst:1363 msgid "" ":mod:`configparser` no longer has a ``SafeConfigParser`` class. Use the " "shorter :class:`~configparser.ConfigParser` name instead." msgstr "" -#: ../../whatsnew/3.12.rst:1376 +#: ../../whatsnew/3.12.rst:1365 msgid "" ":class:`configparser.ConfigParser` no longer has a ``readfp`` method. Use :" "meth:`~configparser.ConfigParser.read_file` instead." msgstr "" -#: ../../whatsnew/3.12.rst:1380 +#: ../../whatsnew/3.12.rst:1369 msgid "distutils" msgstr "distutils" -#: ../../whatsnew/3.12.rst:1382 +#: ../../whatsnew/3.12.rst:1371 msgid "" "Remove the :py:mod:`!distutils` package. It was deprecated in Python 3.10 " "by :pep:`632` \"Deprecate distutils module\". For projects still using " @@ -3022,17 +3009,17 @@ msgid "" "Victor Stinner in :gh:`92584`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1389 +#: ../../whatsnew/3.12.rst:1378 msgid "ensurepip" msgstr "ensurepip" -#: ../../whatsnew/3.12.rst:1391 +#: ../../whatsnew/3.12.rst:1380 msgid "" "Remove the bundled setuptools wheel from :mod:`ensurepip`, and stop " "installing setuptools in environments created by :mod:`venv`." msgstr "" -#: ../../whatsnew/3.12.rst:1394 +#: ../../whatsnew/3.12.rst:1383 msgid "" "``pip (>= 22.1)`` does not require setuptools to be installed in the " "environment. ``setuptools``-based (and ``distutils``-based) packages can " @@ -3040,7 +3027,7 @@ msgid "" "the build environment it uses for building a package." msgstr "" -#: ../../whatsnew/3.12.rst:1400 +#: ../../whatsnew/3.12.rst:1389 msgid "" "``easy_install``, ``pkg_resources``, ``setuptools`` and ``distutils`` are no " "longer provided by default in environments created with ``venv`` or " @@ -3050,25 +3037,25 @@ msgid "" "(typically, using pip)." msgstr "" -#: ../../whatsnew/3.12.rst:1407 +#: ../../whatsnew/3.12.rst:1396 msgid "(Contributed by Pradyun Gedam in :gh:`95299`.)" msgstr "(由 Pradyun Gedam 於 :gh:`95299` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1410 +#: ../../whatsnew/3.12.rst:1399 msgid "enum" msgstr "enum" -#: ../../whatsnew/3.12.rst:1412 +#: ../../whatsnew/3.12.rst:1401 msgid "" "Remove :mod:`enum`'s ``EnumMeta.__getattr__``, which is no longer needed for " "enum attribute access. (Contributed by Ethan Furman in :gh:`95083`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1417 +#: ../../whatsnew/3.12.rst:1406 msgid "ftplib" msgstr "ftplib" -#: ../../whatsnew/3.12.rst:1419 +#: ../../whatsnew/3.12.rst:1408 msgid "" "Remove :mod:`ftplib`'s ``FTP_TLS.ssl_version`` class attribute: use the " "*context* parameter instead. (Contributed by Victor Stinner in :gh:`94172`.)" @@ -3076,11 +3063,11 @@ msgstr "" "移除 :mod:`ftplib` 的 ``FTP_TLS.ssl_version`` 類別屬性:請改用 *context* 參" "數。(由 Victor Stinner 於 :gh:`94172` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1424 +#: ../../whatsnew/3.12.rst:1413 msgid "gzip" msgstr "gzip" -#: ../../whatsnew/3.12.rst:1426 +#: ../../whatsnew/3.12.rst:1415 msgid "" "Remove the ``filename`` attribute of :mod:`gzip`'s :class:`gzip.GzipFile`, " "deprecated since Python 2.6, use the :attr:`~gzip.GzipFile.name` attribute " @@ -3089,11 +3076,11 @@ msgid "" "`94196`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1433 +#: ../../whatsnew/3.12.rst:1422 msgid "hashlib" msgstr "hashlib" -#: ../../whatsnew/3.12.rst:1435 +#: ../../whatsnew/3.12.rst:1424 msgid "" "Remove the pure Python implementation of :mod:`hashlib`'s :func:`hashlib." "pbkdf2_hmac`, deprecated in Python 3.10. Python 3.10 and newer requires " @@ -3102,17 +3089,17 @@ msgid "" "Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1442 ../../whatsnew/3.12.rst:1469 +#: ../../whatsnew/3.12.rst:1431 ../../whatsnew/3.12.rst:1458 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.12.rst:1444 +#: ../../whatsnew/3.12.rst:1433 msgid "" "Many previously deprecated cleanups in :mod:`importlib` have now been " "completed:" msgstr "現已完成清理 :mod:`importlib` 中許多過去已經棄用的東西:" -#: ../../whatsnew/3.12.rst:1447 +#: ../../whatsnew/3.12.rst:1436 msgid "" "References to, and support for :meth:`!module_repr` has been removed. " "(Contributed by Barry Warsaw in :gh:`97850`.)" @@ -3120,134 +3107,134 @@ msgstr "" "對 :meth:`!module_repr` 的參照和支援已刪除。(由 Barry Warsaw 在 :gh:`97850` " "中貢獻。)" -#: ../../whatsnew/3.12.rst:1450 +#: ../../whatsnew/3.12.rst:1439 msgid "" "``importlib.util.set_package``, ``importlib.util.set_loader`` and " "``importlib.util.module_for_loader`` have all been removed. (Contributed by " "Brett Cannon and Nikita Sobolev in :gh:`65961` and :gh:`97850`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1454 +#: ../../whatsnew/3.12.rst:1443 msgid "" "Support for ``find_loader()`` and ``find_module()`` APIs have been removed. " "(Contributed by Barry Warsaw in :gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1457 +#: ../../whatsnew/3.12.rst:1446 msgid "" "``importlib.abc.Finder``, ``pkgutil.ImpImporter``, and ``pkgutil.ImpLoader`` " "have been removed. (Contributed by Barry Warsaw in :gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1461 ../../whatsnew/3.12.rst:1469 +#: ../../whatsnew/3.12.rst:1450 ../../whatsnew/3.12.rst:1458 msgid "imp" msgstr "imp" -#: ../../whatsnew/3.12.rst:1463 +#: ../../whatsnew/3.12.rst:1452 msgid "" "The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in :" "gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1466 +#: ../../whatsnew/3.12.rst:1455 msgid "To migrate, consult the following correspondence table:" msgstr "" -#: ../../whatsnew/3.12.rst:1471 +#: ../../whatsnew/3.12.rst:1460 msgid "``imp.NullImporter``" msgstr "``imp.NullImporter``" -#: ../../whatsnew/3.12.rst:1471 +#: ../../whatsnew/3.12.rst:1460 msgid "Insert ``None`` into ``sys.path_importer_cache``" msgstr "將 ``None`` 插入 ``sys.path_importer_cache``" -#: ../../whatsnew/3.12.rst:1472 +#: ../../whatsnew/3.12.rst:1461 msgid "``imp.cache_from_source()``" msgstr "``imp.cache_from_source()``" -#: ../../whatsnew/3.12.rst:1472 +#: ../../whatsnew/3.12.rst:1461 msgid ":func:`importlib.util.cache_from_source`" msgstr ":func:`importlib.util.cache_from_source`" -#: ../../whatsnew/3.12.rst:1473 +#: ../../whatsnew/3.12.rst:1462 msgid "``imp.find_module()``" msgstr "``imp.find_module()``" -#: ../../whatsnew/3.12.rst:1473 +#: ../../whatsnew/3.12.rst:1462 msgid ":func:`importlib.util.find_spec`" msgstr ":func:`importlib.util.find_spec`" -#: ../../whatsnew/3.12.rst:1474 +#: ../../whatsnew/3.12.rst:1463 msgid "``imp.get_magic()``" msgstr "``imp.get_magic()``" -#: ../../whatsnew/3.12.rst:1474 +#: ../../whatsnew/3.12.rst:1463 msgid ":attr:`importlib.util.MAGIC_NUMBER`" msgstr ":attr:`importlib.util.MAGIC_NUMBER`" -#: ../../whatsnew/3.12.rst:1475 +#: ../../whatsnew/3.12.rst:1464 msgid "``imp.get_suffixes()``" msgstr "``imp.get_suffixes()``" -#: ../../whatsnew/3.12.rst:1475 +#: ../../whatsnew/3.12.rst:1464 msgid "" ":attr:`importlib.machinery.SOURCE_SUFFIXES`, :attr:`importlib.machinery." "EXTENSION_SUFFIXES`, and :attr:`importlib.machinery.BYTECODE_SUFFIXES`" msgstr "" -#: ../../whatsnew/3.12.rst:1476 +#: ../../whatsnew/3.12.rst:1465 msgid "``imp.get_tag()``" msgstr "``imp.get_tag()``" -#: ../../whatsnew/3.12.rst:1476 +#: ../../whatsnew/3.12.rst:1465 msgid ":attr:`sys.implementation.cache_tag <sys.implementation>`" msgstr ":attr:`sys.implementation.cache_tag <sys.implementation>`" -#: ../../whatsnew/3.12.rst:1477 +#: ../../whatsnew/3.12.rst:1466 msgid "``imp.load_module()``" msgstr "``imp.load_module()``" -#: ../../whatsnew/3.12.rst:1477 +#: ../../whatsnew/3.12.rst:1466 msgid ":func:`importlib.import_module`" msgstr ":func:`importlib.import_module`" -#: ../../whatsnew/3.12.rst:1478 +#: ../../whatsnew/3.12.rst:1467 msgid "``imp.new_module(name)``" msgstr "``imp.new_module(name)``" -#: ../../whatsnew/3.12.rst:1478 +#: ../../whatsnew/3.12.rst:1467 msgid "``types.ModuleType(name)``" msgstr "``types.ModuleType(name)``" -#: ../../whatsnew/3.12.rst:1479 +#: ../../whatsnew/3.12.rst:1468 msgid "``imp.reload()``" msgstr "``imp.reload()``" -#: ../../whatsnew/3.12.rst:1479 +#: ../../whatsnew/3.12.rst:1468 msgid ":func:`importlib.reload`" msgstr ":func:`importlib.reload`" -#: ../../whatsnew/3.12.rst:1480 +#: ../../whatsnew/3.12.rst:1469 msgid "``imp.source_from_cache()``" msgstr "``imp.source_from_cache()``" -#: ../../whatsnew/3.12.rst:1480 +#: ../../whatsnew/3.12.rst:1469 msgid ":func:`importlib.util.source_from_cache`" msgstr ":func:`importlib.util.source_from_cache`" -#: ../../whatsnew/3.12.rst:1481 +#: ../../whatsnew/3.12.rst:1470 msgid "``imp.load_source()``" msgstr "``imp.load_source()``" -#: ../../whatsnew/3.12.rst:1481 +#: ../../whatsnew/3.12.rst:1470 msgid "*See below*" msgstr "*見下文*" -#: ../../whatsnew/3.12.rst:1484 +#: ../../whatsnew/3.12.rst:1473 msgid "Replace ``imp.load_source()`` with::" msgstr "用以下取代 ``imp.load_source()``: ::" -#: ../../whatsnew/3.12.rst:1486 +#: ../../whatsnew/3.12.rst:1475 msgid "" "import importlib.util\n" "import importlib.machinery\n" @@ -3264,37 +3251,37 @@ msgid "" " return module" msgstr "" -#: ../../whatsnew/3.12.rst:1499 +#: ../../whatsnew/3.12.rst:1488 msgid "Remove :mod:`!imp` functions and attributes with no replacements:" msgstr "移除 :mod:`!imp` 函式和屬性、沒有替代方案:" -#: ../../whatsnew/3.12.rst:1501 +#: ../../whatsnew/3.12.rst:1490 msgid "Undocumented functions:" msgstr "未以文件記錄的函式:" -#: ../../whatsnew/3.12.rst:1503 +#: ../../whatsnew/3.12.rst:1492 msgid "``imp.init_builtin()``" msgstr "``imp.init_builtin()``" -#: ../../whatsnew/3.12.rst:1504 +#: ../../whatsnew/3.12.rst:1493 msgid "``imp.load_compiled()``" msgstr "``imp.load_compiled()``" -#: ../../whatsnew/3.12.rst:1505 +#: ../../whatsnew/3.12.rst:1494 msgid "``imp.load_dynamic()``" msgstr "``imp.load_dynamic()``" -#: ../../whatsnew/3.12.rst:1506 +#: ../../whatsnew/3.12.rst:1495 msgid "``imp.load_package()``" msgstr "``imp.load_package()``" -#: ../../whatsnew/3.12.rst:1508 +#: ../../whatsnew/3.12.rst:1497 msgid "" "``imp.lock_held()``, ``imp.acquire_lock()``, ``imp.release_lock()``: the " "locking scheme has changed in Python 3.3 to per-module locks." msgstr "" -#: ../../whatsnew/3.12.rst:1510 +#: ../../whatsnew/3.12.rst:1499 msgid "" "``imp.find_module()`` constants: ``SEARCH_ERROR``, ``PY_SOURCE``, " "``PY_COMPILED``, ``C_EXTENSION``, ``PY_RESOURCE``, ``PKG_DIRECTORY``, " @@ -3304,11 +3291,11 @@ msgstr "" "``PY_COMPILED``、``C_EXTENSION``、``PY_RESOURCE``、``PKG_DIRECTORY``、" "``C_BUILTIN``、``PY_FROZEN``、``PY_CODERESOURCE``、``IMP_HOOK``。" -#: ../../whatsnew/3.12.rst:1515 +#: ../../whatsnew/3.12.rst:1504 msgid "io" msgstr "io" -#: ../../whatsnew/3.12.rst:1517 +#: ../../whatsnew/3.12.rst:1506 msgid "" "Remove :mod:`io`'s ``io.OpenWrapper`` and ``_pyio.OpenWrapper``, deprecated " "in Python 3.10: just use :func:`open` instead. The :func:`open` (:func:`io." @@ -3317,22 +3304,22 @@ msgid "" "`94169`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1524 +#: ../../whatsnew/3.12.rst:1513 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.12.rst:1526 +#: ../../whatsnew/3.12.rst:1515 msgid "" "Remove :mod:`locale`'s :func:`!locale.format` function, deprecated in Python " "3.7: use :func:`locale.format_string` instead. (Contributed by Victor " "Stinner in :gh:`94226`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1531 +#: ../../whatsnew/3.12.rst:1520 msgid "smtpd" msgstr "smtpd" -#: ../../whatsnew/3.12.rst:1533 +#: ../../whatsnew/3.12.rst:1522 msgid "" "The ``smtpd`` module has been removed according to the schedule in :pep:" "`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use the :pypi:" @@ -3340,27 +3327,27 @@ msgid "" "(Contributed by Oleg Iarygin in :gh:`93243`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1542 +#: ../../whatsnew/3.12.rst:1531 msgid "" "The following undocumented :mod:`sqlite3` features, deprecated in Python " "3.10, are now removed:" msgstr "" -#: ../../whatsnew/3.12.rst:1545 +#: ../../whatsnew/3.12.rst:1534 msgid "``sqlite3.enable_shared_cache()``" msgstr "``sqlite3.enable_shared_cache()``" -#: ../../whatsnew/3.12.rst:1546 +#: ../../whatsnew/3.12.rst:1535 msgid "``sqlite3.OptimizedUnicode``" msgstr "``sqlite3.OptimizedUnicode``" -#: ../../whatsnew/3.12.rst:1548 +#: ../../whatsnew/3.12.rst:1537 msgid "" "If a shared cache must be used, open the database in URI mode using the " "``cache=shared`` query parameter." msgstr "" -#: ../../whatsnew/3.12.rst:1551 +#: ../../whatsnew/3.12.rst:1540 msgid "" "The ``sqlite3.OptimizedUnicode`` text factory has been an alias for :class:" "`str` since Python 3.3. Code that previously set the text factory to " @@ -3368,22 +3355,22 @@ msgid "" "default value which is also ``str``." msgstr "" -#: ../../whatsnew/3.12.rst:1556 +#: ../../whatsnew/3.12.rst:1545 msgid "(Contributed by Erlend E. Aasland in :gh:`92548`.)" msgstr "(由 Erlend E. Aasland 於 :gh:`92548` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1559 +#: ../../whatsnew/3.12.rst:1548 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.12.rst:1561 +#: ../../whatsnew/3.12.rst:1550 msgid "" "Remove :mod:`ssl`'s :func:`!ssl.RAND_pseudo_bytes` function, deprecated in " "Python 3.6: use :func:`os.urandom` or :func:`ssl.RAND_bytes` instead. " "(Contributed by Victor Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1565 +#: ../../whatsnew/3.12.rst:1554 msgid "" "Remove the :func:`!ssl.match_hostname` function. It was deprecated in Python " "3.7. OpenSSL performs hostname matching since Python 3.7, Python no longer " @@ -3391,7 +3378,7 @@ msgid "" "Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1571 +#: ../../whatsnew/3.12.rst:1560 msgid "" "Remove the :func:`!ssl.wrap_socket` function, deprecated in Python 3.7: " "instead, create a :class:`ssl.SSLContext` object and call its :class:`ssl." @@ -3402,189 +3389,189 @@ msgid "" "`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1582 +#: ../../whatsnew/3.12.rst:1571 msgid "Remove many long-deprecated :mod:`unittest` features:" msgstr "移除許多 :mod:`unittest` 中被棄用已久的功能:" -#: ../../whatsnew/3.12.rst:1586 +#: ../../whatsnew/3.12.rst:1575 msgid "A number of :class:`~unittest.TestCase` method aliases:" msgstr "許多 :class:`~unittest.TestCase` 方法別名:" -#: ../../whatsnew/3.12.rst:1589 +#: ../../whatsnew/3.12.rst:1578 msgid "Deprecated alias" msgstr "已棄用的別名" -#: ../../whatsnew/3.12.rst:1589 +#: ../../whatsnew/3.12.rst:1578 msgid "Method Name" msgstr "方法名稱" -#: ../../whatsnew/3.12.rst:1589 +#: ../../whatsnew/3.12.rst:1578 msgid "Deprecated in" msgstr "已棄用於" -#: ../../whatsnew/3.12.rst:1591 +#: ../../whatsnew/3.12.rst:1580 msgid "``failUnless``" msgstr "``failUnless``" -#: ../../whatsnew/3.12.rst:1591 ../../whatsnew/3.12.rst:1598 +#: ../../whatsnew/3.12.rst:1580 ../../whatsnew/3.12.rst:1587 msgid ":meth:`.assertTrue`" msgstr ":meth:`.assertTrue`" -#: ../../whatsnew/3.12.rst:1591 ../../whatsnew/3.12.rst:1592 -#: ../../whatsnew/3.12.rst:1593 ../../whatsnew/3.12.rst:1594 -#: ../../whatsnew/3.12.rst:1595 ../../whatsnew/3.12.rst:1596 -#: ../../whatsnew/3.12.rst:1597 +#: ../../whatsnew/3.12.rst:1580 ../../whatsnew/3.12.rst:1581 +#: ../../whatsnew/3.12.rst:1582 ../../whatsnew/3.12.rst:1583 +#: ../../whatsnew/3.12.rst:1584 ../../whatsnew/3.12.rst:1585 +#: ../../whatsnew/3.12.rst:1586 msgid "3.1" msgstr "3.1" -#: ../../whatsnew/3.12.rst:1592 +#: ../../whatsnew/3.12.rst:1581 msgid "``failIf``" msgstr "``failIf``" -#: ../../whatsnew/3.12.rst:1592 +#: ../../whatsnew/3.12.rst:1581 msgid ":meth:`.assertFalse`" msgstr ":meth:`.assertFalse`" -#: ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1582 msgid "``failUnlessEqual``" msgstr "``failUnlessEqual``" -#: ../../whatsnew/3.12.rst:1593 ../../whatsnew/3.12.rst:1599 +#: ../../whatsnew/3.12.rst:1582 ../../whatsnew/3.12.rst:1588 msgid ":meth:`.assertEqual`" msgstr ":meth:`.assertEqual`" -#: ../../whatsnew/3.12.rst:1594 +#: ../../whatsnew/3.12.rst:1583 msgid "``failIfEqual``" msgstr "``failIfEqual``" -#: ../../whatsnew/3.12.rst:1594 ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1583 ../../whatsnew/3.12.rst:1589 msgid ":meth:`.assertNotEqual`" msgstr ":meth:`.assertNotEqual`" -#: ../../whatsnew/3.12.rst:1595 +#: ../../whatsnew/3.12.rst:1584 msgid "``failUnlessAlmostEqual``" msgstr "``failUnlessAlmostEqual``" -#: ../../whatsnew/3.12.rst:1595 ../../whatsnew/3.12.rst:1601 +#: ../../whatsnew/3.12.rst:1584 ../../whatsnew/3.12.rst:1590 msgid ":meth:`.assertAlmostEqual`" msgstr ":meth:`.assertAlmostEqual`" -#: ../../whatsnew/3.12.rst:1596 +#: ../../whatsnew/3.12.rst:1585 msgid "``failIfAlmostEqual``" msgstr "``failIfAlmostEqual``" -#: ../../whatsnew/3.12.rst:1596 ../../whatsnew/3.12.rst:1602 +#: ../../whatsnew/3.12.rst:1585 ../../whatsnew/3.12.rst:1591 msgid ":meth:`.assertNotAlmostEqual`" msgstr ":meth:`.assertNotAlmostEqual`" -#: ../../whatsnew/3.12.rst:1597 +#: ../../whatsnew/3.12.rst:1586 msgid "``failUnlessRaises``" msgstr "``failUnlessRaises``" -#: ../../whatsnew/3.12.rst:1597 +#: ../../whatsnew/3.12.rst:1586 msgid ":meth:`.assertRaises`" msgstr ":meth:`.assertRaises`" -#: ../../whatsnew/3.12.rst:1598 +#: ../../whatsnew/3.12.rst:1587 msgid "``assert_``" msgstr "``assert_``" -#: ../../whatsnew/3.12.rst:1598 ../../whatsnew/3.12.rst:1599 -#: ../../whatsnew/3.12.rst:1600 ../../whatsnew/3.12.rst:1601 -#: ../../whatsnew/3.12.rst:1602 ../../whatsnew/3.12.rst:1603 -#: ../../whatsnew/3.12.rst:1604 +#: ../../whatsnew/3.12.rst:1587 ../../whatsnew/3.12.rst:1588 +#: ../../whatsnew/3.12.rst:1589 ../../whatsnew/3.12.rst:1590 +#: ../../whatsnew/3.12.rst:1591 ../../whatsnew/3.12.rst:1592 +#: ../../whatsnew/3.12.rst:1593 msgid "3.2" msgstr "3.2" -#: ../../whatsnew/3.12.rst:1599 +#: ../../whatsnew/3.12.rst:1588 msgid "``assertEquals``" msgstr "``assertEquals``" -#: ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1589 msgid "``assertNotEquals``" msgstr "``assertNotEquals``" -#: ../../whatsnew/3.12.rst:1601 +#: ../../whatsnew/3.12.rst:1590 msgid "``assertAlmostEquals``" msgstr "``assertAlmostEquals``" -#: ../../whatsnew/3.12.rst:1602 +#: ../../whatsnew/3.12.rst:1591 msgid "``assertNotAlmostEquals``" msgstr "``assertNotAlmostEquals``" -#: ../../whatsnew/3.12.rst:1603 +#: ../../whatsnew/3.12.rst:1592 msgid "``assertRegexpMatches``" msgstr "``assertRegexpMatches``" -#: ../../whatsnew/3.12.rst:1603 +#: ../../whatsnew/3.12.rst:1592 msgid ":meth:`.assertRegex`" msgstr ":meth:`.assertRegex`" -#: ../../whatsnew/3.12.rst:1604 +#: ../../whatsnew/3.12.rst:1593 msgid "``assertRaisesRegexp``" msgstr "``assertRaisesRegexp``" -#: ../../whatsnew/3.12.rst:1604 +#: ../../whatsnew/3.12.rst:1593 msgid ":meth:`.assertRaisesRegex`" msgstr ":meth:`.assertRaisesRegex`" -#: ../../whatsnew/3.12.rst:1605 +#: ../../whatsnew/3.12.rst:1594 msgid "``assertNotRegexpMatches``" msgstr "``assertNotRegexpMatches``" -#: ../../whatsnew/3.12.rst:1605 +#: ../../whatsnew/3.12.rst:1594 msgid ":meth:`.assertNotRegex`" msgstr ":meth:`.assertNotRegex`" -#: ../../whatsnew/3.12.rst:1605 +#: ../../whatsnew/3.12.rst:1594 msgid "3.5" msgstr "3.5" -#: ../../whatsnew/3.12.rst:1608 +#: ../../whatsnew/3.12.rst:1597 msgid "" "You can use https://github.com/isidentical/teyit to automatically modernise " "your unit tests." msgstr "" -#: ../../whatsnew/3.12.rst:1611 +#: ../../whatsnew/3.12.rst:1600 msgid "" "Undocumented and broken :class:`~unittest.TestCase` method " "``assertDictContainsSubset`` (deprecated in Python 3.2)." msgstr "" -#: ../../whatsnew/3.12.rst:1614 +#: ../../whatsnew/3.12.rst:1603 msgid "" "Undocumented :meth:`TestLoader.loadTestsFromModule <unittest.TestLoader." "loadTestsFromModule>` parameter *use_load_tests* (deprecated and ignored " "since Python 3.5)." msgstr "" -#: ../../whatsnew/3.12.rst:1618 +#: ../../whatsnew/3.12.rst:1607 msgid "" "An alias of the :class:`~unittest.TextTestResult` class: ``_TextTestResult`` " "(deprecated in Python 3.2)." msgstr "" -#: ../../whatsnew/3.12.rst:1621 +#: ../../whatsnew/3.12.rst:1610 msgid "(Contributed by Serhiy Storchaka in :gh:`89325`.)" msgstr "(由 Serhiy Storchaka 於 :gh:`89325` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1624 +#: ../../whatsnew/3.12.rst:1613 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.12.rst:1626 +#: ../../whatsnew/3.12.rst:1615 msgid "" "Remove support for obsolete browsers from :mod:`webbrowser`. The removed " "browsers include: Grail, Mosaic, Netscape, Galeon, Skipstone, Iceape, " "Firebird, and Firefox versions 35 and below (:gh:`102871`)." msgstr "" -#: ../../whatsnew/3.12.rst:1631 +#: ../../whatsnew/3.12.rst:1620 msgid "xml.etree.ElementTree" msgstr "xml.etree.ElementTree" -#: ../../whatsnew/3.12.rst:1633 +#: ../../whatsnew/3.12.rst:1622 msgid "" "Remove the ``ElementTree.Element.copy()`` method of the pure Python " "implementation, deprecated in Python 3.10, use the :func:`copy.copy` " @@ -3593,22 +3580,22 @@ msgid "" "Stinner in :gh:`94383`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1640 +#: ../../whatsnew/3.12.rst:1629 msgid "zipimport" msgstr "zipimport" -#: ../../whatsnew/3.12.rst:1642 +#: ../../whatsnew/3.12.rst:1631 msgid "" "Remove :mod:`zipimport`'s ``find_loader()`` and ``find_module()`` methods, " "deprecated in Python 3.10: use the ``find_spec()`` method instead. See :pep:" "`451` for the rationale. (Contributed by Victor Stinner in :gh:`94379`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1648 +#: ../../whatsnew/3.12.rst:1637 msgid "Others" msgstr "其他" -#: ../../whatsnew/3.12.rst:1650 +#: ../../whatsnew/3.12.rst:1639 msgid "" "Remove the ``suspicious`` rule from the documentation :file:`Makefile` and :" "file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint <https://github." @@ -3616,7 +3603,7 @@ msgid "" "`98179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1655 +#: ../../whatsnew/3.12.rst:1644 msgid "" "Remove the *keyfile* and *certfile* parameters from the :mod:`ftplib`, :mod:" "`imaplib`, :mod:`poplib` and :mod:`smtplib` modules, and the *key_file*, " @@ -3626,7 +3613,7 @@ msgid "" "in :gh:`94172`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1663 +#: ../../whatsnew/3.12.rst:1652 msgid "" "Remove ``Jython`` compatibility hacks from several stdlib modules and tests. " "(Contributed by Nikita Sobolev in :gh:`99482`.)" @@ -3634,7 +3621,7 @@ msgstr "" "移除數個標準函式庫模組與測試中的 ``Jython`` 相容性修補程式。(由 Nikita " "Sobolev 於 :gh:`99482` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1666 +#: ../../whatsnew/3.12.rst:1655 msgid "" "Remove ``_use_broken_old_ctypes_structure_semantics_`` flag from :mod:" "`ctypes` module. (Contributed by Nikita Sobolev in :gh:`99285`.)" @@ -3642,21 +3629,21 @@ msgstr "" "移除 :mod:`ctypes` 模組中的 ``_use_broken_old_ctypes_structure_semantics_`` " "旗標。(由 Nikita Sobolev 於 :gh:`99285` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1674 ../../whatsnew/3.12.rst:1998 +#: ../../whatsnew/3.12.rst:1663 ../../whatsnew/3.12.rst:1987 msgid "Porting to Python 3.12" msgstr "" -#: ../../whatsnew/3.12.rst:1676 +#: ../../whatsnew/3.12.rst:1665 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.12.rst:1680 +#: ../../whatsnew/3.12.rst:1669 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.12.rst:1682 +#: ../../whatsnew/3.12.rst:1671 msgid "" "More strict rules are now applied for numerical group references and group " "names in regular expressions. Only sequence of ASCII digits is now accepted " @@ -3665,7 +3652,7 @@ msgid "" "(Contributed by Serhiy Storchaka in :gh:`91760`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1689 +#: ../../whatsnew/3.12.rst:1678 msgid "" "Remove ``randrange()`` functionality deprecated since Python 3.10. " "Formerly, ``randrange(10.0)`` losslessly converted to ``randrange(10)``. " @@ -3677,7 +3664,7 @@ msgid "" "`86388`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1697 +#: ../../whatsnew/3.12.rst:1686 msgid "" ":class:`argparse.ArgumentParser` changed encoding and error handler for " "reading arguments from file (e.g. ``fromfile_prefix_chars`` option) from " @@ -3687,21 +3674,21 @@ msgid "" "on Windows." msgstr "" -#: ../../whatsnew/3.12.rst:1703 +#: ../../whatsnew/3.12.rst:1692 msgid "" "Remove the ``asyncore``-based ``smtpd`` module deprecated in Python 3.4.7 " "and 3.5.4. A recommended replacement is the :mod:`asyncio`-based :pypi:" "`aiosmtpd` PyPI module." msgstr "" -#: ../../whatsnew/3.12.rst:1707 +#: ../../whatsnew/3.12.rst:1696 msgid "" ":func:`shlex.split`: Passing ``None`` for *s* argument now raises an " "exception, rather than reading :data:`sys.stdin`. The feature was deprecated " "in Python 3.9. (Contributed by Victor Stinner in :gh:`94352`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1712 +#: ../../whatsnew/3.12.rst:1701 msgid "" "The :mod:`os` module no longer accepts bytes-like paths, like :class:" "`bytearray` and :class:`memoryview` types: only the exact :class:`bytes` " @@ -3709,7 +3696,7 @@ msgid "" "`98393`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1717 +#: ../../whatsnew/3.12.rst:1706 msgid "" ":func:`syslog.openlog` and :func:`syslog.closelog` now fail if used in " "subinterpreters. :func:`syslog.syslog` may still be used in subinterpreters, " @@ -3721,7 +3708,7 @@ msgid "" "(Contributed by Donghee Na in :gh:`99127`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1726 +#: ../../whatsnew/3.12.rst:1715 msgid "" "The undocumented locking behavior of :func:`~functools.cached_property` is " "removed, because it locked across all instances of the class, leading to " @@ -3733,14 +3720,14 @@ msgid "" "property getter function or around multi-threaded access points." msgstr "" -#: ../../whatsnew/3.12.rst:1739 +#: ../../whatsnew/3.12.rst:1728 msgid "" "When extracting tar files using :mod:`tarfile` or :func:`shutil." "unpack_archive`, pass the *filter* argument to limit features that may be " "surprising or dangerous. See :ref:`tarfile-extraction-filter` for details." msgstr "" -#: ../../whatsnew/3.12.rst:1744 +#: ../../whatsnew/3.12.rst:1733 msgid "" "The output of the :func:`tokenize.tokenize` and :func:`tokenize." "generate_tokens` functions is now changed due to the changes introduced in :" @@ -3752,15 +3739,15 @@ msgid "" "``f\"start {1+1} end\"`` the old version of the tokenizer emitted::" msgstr "" -#: ../../whatsnew/3.12.rst:1753 +#: ../../whatsnew/3.12.rst:1742 msgid "1,0-1,18: STRING 'f\"start {1+1} end\"'" msgstr "1,0-1,18: STRING 'f\"start {1+1} end\"'" -#: ../../whatsnew/3.12.rst:1755 +#: ../../whatsnew/3.12.rst:1744 msgid "while the new version emits::" msgstr "" -#: ../../whatsnew/3.12.rst:1757 +#: ../../whatsnew/3.12.rst:1746 msgid "" "1,0-1,2: FSTRING_START 'f\"'\n" "1,2-1,8: FSTRING_MIDDLE 'start '\n" @@ -3782,54 +3769,54 @@ msgstr "" "1,13-1,17: FSTRING_MIDDLE ' end'\n" "1,17-1,18: FSTRING_END '\"'" -#: ../../whatsnew/3.12.rst:1767 +#: ../../whatsnew/3.12.rst:1756 msgid "" "Additionally, there may be some minor behavioral changes as a consequence of " "the changes required to support :pep:`701`. Some of these changes include:" msgstr "" -#: ../../whatsnew/3.12.rst:1770 +#: ../../whatsnew/3.12.rst:1759 msgid "" "The ``type`` attribute of the tokens emitted when tokenizing some invalid " "Python characters such as ``!`` has changed from ``ERRORTOKEN`` to ``OP``." msgstr "" -#: ../../whatsnew/3.12.rst:1773 +#: ../../whatsnew/3.12.rst:1762 msgid "" "Incomplete single-line strings now also raise :exc:`tokenize.TokenError` as " "incomplete multiline strings do." msgstr "" -#: ../../whatsnew/3.12.rst:1776 +#: ../../whatsnew/3.12.rst:1765 msgid "" "Some incomplete or invalid Python code now raises :exc:`tokenize.TokenError` " "instead of returning arbitrary ``ERRORTOKEN`` tokens when tokenizing it." msgstr "" -#: ../../whatsnew/3.12.rst:1779 +#: ../../whatsnew/3.12.rst:1768 msgid "" "Mixing tabs and spaces as indentation in the same file is not supported " "anymore and will raise a :exc:`TabError`." msgstr "" -#: ../../whatsnew/3.12.rst:1782 +#: ../../whatsnew/3.12.rst:1771 msgid "" "The :mod:`threading` module now expects the :mod:`!_thread` module to have " "an ``_is_main_interpreter`` attribute. It is a function with no arguments " "that returns ``True`` if the current interpreter is the main interpreter." msgstr "" -#: ../../whatsnew/3.12.rst:1787 +#: ../../whatsnew/3.12.rst:1776 msgid "" "Any library or application that provides a custom ``_thread`` module should " "provide ``_is_main_interpreter()``. (See :gh:`112826`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1792 +#: ../../whatsnew/3.12.rst:1781 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.12.rst:1794 +#: ../../whatsnew/3.12.rst:1783 msgid "" "Python no longer uses :file:`setup.py` to build shared C extension modules. " "Build parameters like headers and libraries are detected in ``configure`` " @@ -3838,21 +3825,21 @@ msgid "" "in :gh:`93939`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1800 +#: ../../whatsnew/3.12.rst:1789 msgid "" "``va_start()`` with two parameters, like ``va_start(args, format),`` is now " "required to build Python. ``va_start()`` is no longer called with a single " "parameter. (Contributed by Kumar Aditya in :gh:`93207`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1805 +#: ../../whatsnew/3.12.rst:1794 msgid "" "CPython now uses the ThinLTO option as the default link time optimization " "policy if the Clang compiler accepts the flag. (Contributed by Donghee Na " "in :gh:`89536`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1809 +#: ../../whatsnew/3.12.rst:1798 msgid "" "Add ``COMPILEALL_OPTS`` variable in :file:`Makefile` to override :mod:" "`compileall` options (default: ``-j0``) in ``make install``. Also merged the " @@ -3861,46 +3848,46 @@ msgid "" "`99289`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1815 +#: ../../whatsnew/3.12.rst:1804 msgid "Add platform triplets for 64-bit LoongArch:" msgstr "" -#: ../../whatsnew/3.12.rst:1817 +#: ../../whatsnew/3.12.rst:1806 msgid "loongarch64-linux-gnusf" msgstr "loongarch64-linux-gnusf" -#: ../../whatsnew/3.12.rst:1818 +#: ../../whatsnew/3.12.rst:1807 msgid "loongarch64-linux-gnuf32" msgstr "loongarch64-linux-gnuf32" -#: ../../whatsnew/3.12.rst:1819 +#: ../../whatsnew/3.12.rst:1808 msgid "loongarch64-linux-gnu" msgstr "loongarch64-linux-gnu" -#: ../../whatsnew/3.12.rst:1821 +#: ../../whatsnew/3.12.rst:1810 msgid "(Contributed by Zhang Na in :gh:`90656`.)" msgstr "(由 Zhang Na 於 :gh:`90656` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1823 +#: ../../whatsnew/3.12.rst:1812 msgid "``PYTHON_FOR_REGEN`` now require Python 3.10 or newer." msgstr "" -#: ../../whatsnew/3.12.rst:1825 +#: ../../whatsnew/3.12.rst:1814 msgid "" "Autoconf 2.71 and aclocal 1.16.4 is now required to regenerate :file:`!" "configure`. (Contributed by Christian Heimes in :gh:`89886`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1829 +#: ../../whatsnew/3.12.rst:1818 msgid "" "Windows builds and macOS installers from python.org now use OpenSSL 3.0." msgstr "" -#: ../../whatsnew/3.12.rst:1833 +#: ../../whatsnew/3.12.rst:1822 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.12.rst:1840 +#: ../../whatsnew/3.12.rst:1829 msgid "" ":pep:`697`: Introduce the :ref:`Unstable C API tier <unstable-c-api>`, " "intended for low-level tools like debuggers and JIT compilers. This API may " @@ -3908,15 +3895,15 @@ msgid "" "contents are marked by the ``PyUnstable_`` prefix in names." msgstr "" -#: ../../whatsnew/3.12.rst:1846 +#: ../../whatsnew/3.12.rst:1835 msgid "Code object constructors:" msgstr "程式碼物件建構函式:" -#: ../../whatsnew/3.12.rst:1848 +#: ../../whatsnew/3.12.rst:1837 msgid "``PyUnstable_Code_New()`` (renamed from ``PyCode_New``)" msgstr "``PyUnstable_Code_New()``\\ (自 ``PyCode_New`` 重新命名)" -#: ../../whatsnew/3.12.rst:1849 +#: ../../whatsnew/3.12.rst:1838 msgid "" "``PyUnstable_Code_NewWithPosOnlyArgs()`` (renamed from " "``PyCode_NewWithPosOnlyArgs``)" @@ -3924,11 +3911,11 @@ msgstr "" "``PyUnstable_Code_NewWithPosOnlyArgs()``\\ (自 " "``PyCode_NewWithPosOnlyArgs`` 重新命名)" -#: ../../whatsnew/3.12.rst:1851 +#: ../../whatsnew/3.12.rst:1840 msgid "Extra storage for code objects (:pep:`523`):" msgstr "程式碼物件的額外儲存 (:pep:`523`):" -#: ../../whatsnew/3.12.rst:1853 +#: ../../whatsnew/3.12.rst:1842 msgid "" "``PyUnstable_Eval_RequestCodeExtraIndex()`` (renamed from " "``_PyEval_RequestCodeExtraIndex``)" @@ -3936,31 +3923,31 @@ msgstr "" "``PyUnstable_Eval_RequestCodeExtraIndex()``\\ (自 " "``_PyEval_RequestCodeExtraIndex`` 重新命名)" -#: ../../whatsnew/3.12.rst:1854 +#: ../../whatsnew/3.12.rst:1843 msgid "``PyUnstable_Code_GetExtra()`` (renamed from ``_PyCode_GetExtra``)" msgstr "``PyUnstable_Code_GetExtra()``\\ (自 ``_PyCode_GetExtra`` 重新命名)" -#: ../../whatsnew/3.12.rst:1855 +#: ../../whatsnew/3.12.rst:1844 msgid "``PyUnstable_Code_SetExtra()`` (renamed from ``_PyCode_SetExtra``)" msgstr "``PyUnstable_Code_SetExtra()``\\ (自 ``_PyCode_SetExtra`` 重新命名)" -#: ../../whatsnew/3.12.rst:1857 +#: ../../whatsnew/3.12.rst:1846 msgid "" "The original names will continue to be available until the respective API " "changes." msgstr "原始名稱將可繼續使用,直到相應的 API 發生變更。" -#: ../../whatsnew/3.12.rst:1860 +#: ../../whatsnew/3.12.rst:1849 msgid "(Contributed by Petr Viktorin in :gh:`101101`.)" msgstr "(由 Petr Viktorin 於 :gh:`101101` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1862 +#: ../../whatsnew/3.12.rst:1851 msgid "" ":pep:`697`: Add an API for extending types whose instance memory layout is " "opaque:" msgstr "" -#: ../../whatsnew/3.12.rst:1865 +#: ../../whatsnew/3.12.rst:1854 msgid "" ":c:member:`PyType_Spec.basicsize` can be zero or negative to specify " "inheriting or extending the base class size." @@ -3968,30 +3955,30 @@ msgstr "" ":c:member:`PyType_Spec.basicsize` 可以為零或負數來指定繼承或擴充基底類別大" "小。" -#: ../../whatsnew/3.12.rst:1867 +#: ../../whatsnew/3.12.rst:1856 msgid "" ":c:func:`PyObject_GetTypeData` and :c:func:`PyType_GetTypeDataSize` added to " "allow access to subclass-specific instance data." msgstr "" -#: ../../whatsnew/3.12.rst:1869 +#: ../../whatsnew/3.12.rst:1858 msgid "" ":c:macro:`Py_TPFLAGS_ITEMS_AT_END` and :c:func:`PyObject_GetItemData` added " "to allow safely extending certain variable-sized types, including :c:var:" "`PyType_Type`." msgstr "" -#: ../../whatsnew/3.12.rst:1872 +#: ../../whatsnew/3.12.rst:1861 msgid "" ":c:macro:`Py_RELATIVE_OFFSET` added to allow defining :c:type:`members " "<PyMemberDef>` in terms of a subclass-specific struct." msgstr "" -#: ../../whatsnew/3.12.rst:1875 +#: ../../whatsnew/3.12.rst:1864 msgid "(Contributed by Petr Viktorin in :gh:`103509`.)" msgstr "(由 Petr Viktorin 於 :gh:`103509` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1877 +#: ../../whatsnew/3.12.rst:1866 msgid "" "Add the new :ref:`limited C API <limited-c-api>` function :c:func:" "`PyType_FromMetaclass`, which generalizes the existing :c:func:" @@ -3999,29 +3986,29 @@ msgid "" "(Contributed by Wenzel Jakob in :gh:`93012`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1882 +#: ../../whatsnew/3.12.rst:1871 msgid "" "API for creating objects that can be called using :ref:`the vectorcall " "protocol <vectorcall>` was added to the :ref:`Limited API <stable>`:" msgstr "" -#: ../../whatsnew/3.12.rst:1886 +#: ../../whatsnew/3.12.rst:1875 msgid ":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`" msgstr ":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`" -#: ../../whatsnew/3.12.rst:1887 +#: ../../whatsnew/3.12.rst:1876 msgid ":c:func:`PyVectorcall_NARGS`" msgstr ":c:func:`PyVectorcall_NARGS`" -#: ../../whatsnew/3.12.rst:1888 +#: ../../whatsnew/3.12.rst:1877 msgid ":c:func:`PyVectorcall_Call`" msgstr ":c:func:`PyVectorcall_Call`" -#: ../../whatsnew/3.12.rst:1889 +#: ../../whatsnew/3.12.rst:1878 msgid ":c:type:`vectorcallfunc`" msgstr ":c:type:`vectorcallfunc`" -#: ../../whatsnew/3.12.rst:1891 +#: ../../whatsnew/3.12.rst:1880 msgid "" "The :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class " "when the class's :py:meth:`~object.__call__` method is reassigned. This " @@ -4032,7 +4019,7 @@ msgid "" "`93274`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1899 +#: ../../whatsnew/3.12.rst:1888 msgid "" "The :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows extensions " @@ -4040,32 +4027,32 @@ msgid "" "using less memory and with faster access." msgstr "" -#: ../../whatsnew/3.12.rst:1904 +#: ../../whatsnew/3.12.rst:1893 msgid "" "API for performing calls using :ref:`the vectorcall protocol <vectorcall>` " "was added to the :ref:`Limited API <stable>`:" msgstr "" -#: ../../whatsnew/3.12.rst:1908 +#: ../../whatsnew/3.12.rst:1897 msgid ":c:func:`PyObject_Vectorcall`" msgstr ":c:func:`PyObject_Vectorcall`" -#: ../../whatsnew/3.12.rst:1909 +#: ../../whatsnew/3.12.rst:1898 msgid ":c:func:`PyObject_VectorcallMethod`" msgstr ":c:func:`PyObject_VectorcallMethod`" -#: ../../whatsnew/3.12.rst:1910 +#: ../../whatsnew/3.12.rst:1899 msgid ":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`" msgstr ":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`" -#: ../../whatsnew/3.12.rst:1912 +#: ../../whatsnew/3.12.rst:1901 msgid "" "This means that both the incoming and outgoing ends of the vector call " "protocol are now available in the :ref:`Limited API <stable>`. (Contributed " "by Wenzel Jakob in :gh:`98586`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1916 +#: ../../whatsnew/3.12.rst:1905 msgid "" "Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` and :c:" "func:`PyEval_SetTraceAllThreads`, that allow to set tracing and profiling " @@ -4073,14 +4060,14 @@ msgid "" "(Contributed by Pablo Galindo in :gh:`93503`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1922 +#: ../../whatsnew/3.12.rst:1911 msgid "" "Add new function :c:func:`PyFunction_SetVectorcall` to the C API which sets " "the vectorcall field of a given :c:type:`PyFunctionObject`. (Contributed by " "Andrew Frost in :gh:`92257`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1926 +#: ../../whatsnew/3.12.rst:1915 msgid "" "The C API now permits registering callbacks via :c:func:" "`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to be called " @@ -4089,28 +4076,28 @@ msgid "" "`91052`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1932 +#: ../../whatsnew/3.12.rst:1921 msgid "" "Add :c:func:`PyType_AddWatcher` and :c:func:`PyType_Watch` API to register " "callbacks to receive notification on changes to a type. (Contributed by Carl " "Meyer in :gh:`91051`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1936 +#: ../../whatsnew/3.12.rst:1925 msgid "" "Add :c:func:`PyCode_AddWatcher` and :c:func:`PyCode_ClearWatcher` APIs to " "register callbacks to receive notification on creation and destruction of " "code objects. (Contributed by Itamar Oren in :gh:`91054`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1941 +#: ../../whatsnew/3.12.rst:1930 msgid "" "Add :c:func:`PyFrame_GetVar` and :c:func:`PyFrame_GetVarString` functions to " "get a frame variable by its name. (Contributed by Victor Stinner in :gh:" "`91248`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1945 +#: ../../whatsnew/3.12.rst:1934 msgid "" "Add :c:func:`PyErr_GetRaisedException` and :c:func:" "`PyErr_SetRaisedException` for saving and restoring the current exception. " @@ -4120,14 +4107,14 @@ msgid "" "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1953 +#: ../../whatsnew/3.12.rst:1942 msgid "" "Add ``_PyErr_ChainExceptions1``, which takes an exception instance, to " "replace the legacy-API ``_PyErr_ChainExceptions``, which is now deprecated. " "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1957 +#: ../../whatsnew/3.12.rst:1946 msgid "" "Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs` as " "convenience functions for retrieving and modifying the :attr:`~BaseException." @@ -4135,71 +4122,71 @@ msgid "" "in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1962 +#: ../../whatsnew/3.12.rst:1951 msgid "" "Add :c:func:`PyErr_DisplayException`, which takes an exception instance, to " "replace the legacy-api :c:func:`!PyErr_Display`. (Contributed by Irit " "Katriel in :gh:`102755`)." msgstr "" -#: ../../whatsnew/3.12.rst:1968 +#: ../../whatsnew/3.12.rst:1957 msgid "" ":pep:`683`: Introduce *Immortal Objects*, which allows objects to bypass " "reference counts, and related changes to the C-API:" msgstr "" -#: ../../whatsnew/3.12.rst:1971 +#: ../../whatsnew/3.12.rst:1960 msgid "``_Py_IMMORTAL_REFCNT``: The reference count that defines an object" msgstr "``_Py_IMMORTAL_REFCNT``:定義物件的參照計數" -#: ../../whatsnew/3.12.rst:1972 +#: ../../whatsnew/3.12.rst:1961 msgid "as immortal." msgstr "" -#: ../../whatsnew/3.12.rst:1973 +#: ../../whatsnew/3.12.rst:1962 msgid "" "``_Py_IsImmortal`` Checks if an object has the immortal reference count." msgstr "" -#: ../../whatsnew/3.12.rst:1974 +#: ../../whatsnew/3.12.rst:1963 msgid "``PyObject_HEAD_INIT`` This will now initialize reference count to" msgstr "``PyObject_HEAD_INIT`` 這現在將初始化參照計數" -#: ../../whatsnew/3.12.rst:1975 +#: ../../whatsnew/3.12.rst:1964 msgid "``_Py_IMMORTAL_REFCNT`` when used with ``Py_BUILD_CORE``." msgstr "``_Py_IMMORTAL_REFCNT``\\ (與 ``Py_BUILD_CORE`` 一起使用時)。" -#: ../../whatsnew/3.12.rst:1976 +#: ../../whatsnew/3.12.rst:1965 msgid "``SSTATE_INTERNED_IMMORTAL`` An identifier for interned unicode objects" msgstr "" -#: ../../whatsnew/3.12.rst:1977 +#: ../../whatsnew/3.12.rst:1966 msgid "that are immortal." msgstr "" -#: ../../whatsnew/3.12.rst:1978 +#: ../../whatsnew/3.12.rst:1967 msgid "``SSTATE_INTERNED_IMMORTAL_STATIC`` An identifier for interned unicode" msgstr "" -#: ../../whatsnew/3.12.rst:1979 +#: ../../whatsnew/3.12.rst:1968 msgid "objects that are immortal and static" msgstr "" -#: ../../whatsnew/3.12.rst:1980 +#: ../../whatsnew/3.12.rst:1969 msgid "``sys.getunicodeinternedsize`` This returns the total number of unicode" msgstr "" -#: ../../whatsnew/3.12.rst:1981 +#: ../../whatsnew/3.12.rst:1970 msgid "" "objects that have been interned. This is now needed for :file:`refleak.py` " "to correctly track reference counts and allocated blocks" msgstr "" -#: ../../whatsnew/3.12.rst:1984 +#: ../../whatsnew/3.12.rst:1973 msgid "(Contributed by Eddie Elizondo in :gh:`84436`.)" msgstr "(由 Eddie Elizondo 於 :gh:`84436` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1986 +#: ../../whatsnew/3.12.rst:1975 msgid "" ":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function and :" "c:type:`PyInterpreterConfig`, which may be used to create sub-interpreters " @@ -4207,27 +4194,27 @@ msgid "" "(Contributed by Eric Snow in :gh:`104110`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1992 +#: ../../whatsnew/3.12.rst:1981 msgid "" "In the limited C API version 3.12, :c:func:`Py_INCREF` and :c:func:" "`Py_DECREF` functions are now implemented as opaque function calls to hide " "implementation details. (Contributed by Victor Stinner in :gh:`105387`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2000 +#: ../../whatsnew/3.12.rst:1989 msgid "" "Legacy Unicode APIs based on ``Py_UNICODE*`` representation has been " "removed. Please migrate to APIs based on UTF-8 or ``wchar_t*``." msgstr "" -#: ../../whatsnew/3.12.rst:2003 +#: ../../whatsnew/3.12.rst:1992 msgid "" "Argument parsing functions like :c:func:`PyArg_ParseTuple` doesn't support " "``Py_UNICODE*`` based format (e.g. ``u``, ``Z``) anymore. Please migrate to " "other formats for Unicode like ``s``, ``z``, ``es``, and ``U``." msgstr "" -#: ../../whatsnew/3.12.rst:2007 +#: ../../whatsnew/3.12.rst:1996 msgid "" "``tp_weaklist`` for all static builtin types is always ``NULL``. This is an " "internal-only field on ``PyTypeObject`` but we're pointing out the change in " @@ -4236,7 +4223,7 @@ msgid "" "necessary, the (internal-only) ``_PyObject_GET_WEAKREFS_LISTPTR()`` macro." msgstr "" -#: ../../whatsnew/3.12.rst:2014 +#: ../../whatsnew/3.12.rst:2003 msgid "" "This internal-only :c:member:`PyTypeObject.tp_subclasses` may now not be a " "valid object pointer. Its type was changed to :c:expr:`void *` to reflect " @@ -4244,13 +4231,13 @@ msgid "" "only field directly." msgstr "" -#: ../../whatsnew/3.12.rst:2019 +#: ../../whatsnew/3.12.rst:2008 msgid "" "To get a list of subclasses, call the Python method :py:meth:`~class." "__subclasses__` (using :c:func:`PyObject_CallMethod`, for example)." msgstr "" -#: ../../whatsnew/3.12.rst:2023 +#: ../../whatsnew/3.12.rst:2012 msgid "" "Add support of more formatting options (left aligning, octals, uppercase " "hexadecimals, :c:type:`intmax_t`, :c:type:`ptrdiff_t`, :c:type:`wchar_t` C " @@ -4259,7 +4246,7 @@ msgid "" "`98836`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2029 +#: ../../whatsnew/3.12.rst:2018 msgid "" "An unrecognized format character in :c:func:`PyUnicode_FromFormat` and :c:" "func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In previous " @@ -4268,13 +4255,13 @@ msgid "" "Storchaka in :gh:`95781`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2035 +#: ../../whatsnew/3.12.rst:2024 msgid "" "Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` and :c:func:" "`PyUnicode_FromFormatV`. (Contributed by Philip Georgi in :gh:`95504`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2039 +#: ../../whatsnew/3.12.rst:2028 msgid "" "Extension classes wanting to add a ``__dict__`` or weak reference slot " "should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" @@ -4282,13 +4269,13 @@ msgid "" "``tp_weaklistoffset``, respectively. The use of ``tp_dictoffset`` and " "``tp_weaklistoffset`` is still supported, but does not fully support " "multiple inheritance (:gh:`95589`), and performance may be worse. Classes " -"declaring :c:macro:`Py_TPFLAGS_MANAGED_DICT` should call :c:func:`!" +"declaring :c:macro:`Py_TPFLAGS_MANAGED_DICT` must call :c:func:`!" "_PyObject_VisitManagedDict` and :c:func:`!_PyObject_ClearManagedDict` to " "traverse and clear their instance's dictionaries. To clear weakrefs, call :c:" "func:`PyObject_ClearWeakRefs`, as before." msgstr "" -#: ../../whatsnew/3.12.rst:2051 +#: ../../whatsnew/3.12.rst:2040 msgid "" "The :c:func:`PyUnicode_FSDecoder` function no longer accepts bytes-like " "paths, like :class:`bytearray` and :class:`memoryview` types: only the " @@ -4296,7 +4283,7 @@ msgid "" "Victor Stinner in :gh:`98393`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2056 +#: ../../whatsnew/3.12.rst:2045 msgid "" "The :c:macro:`Py_CLEAR`, :c:macro:`Py_SETREF` and :c:macro:`Py_XSETREF` " "macros now only evaluate their arguments once. If an argument has side " @@ -4304,7 +4291,7 @@ msgid "" "Stinner in :gh:`98724`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2061 +#: ../../whatsnew/3.12.rst:2050 msgid "" "The interpreter's error indicator is now always normalized. This means that :" "c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other functions " @@ -4312,7 +4299,7 @@ msgid "" "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2066 +#: ../../whatsnew/3.12.rst:2055 msgid "" "``_Py_RefTotal`` is no longer authoritative and only kept around for ABI " "compatibility. Note that it is an internal global and only available on " @@ -4320,25 +4307,25 @@ msgid "" "``_Py_GetGlobalRefTotal()``." msgstr "" -#: ../../whatsnew/3.12.rst:2071 +#: ../../whatsnew/3.12.rst:2060 msgid "" "The following functions now select an appropriate metaclass for the newly " "created type:" msgstr "" -#: ../../whatsnew/3.12.rst:2074 +#: ../../whatsnew/3.12.rst:2063 msgid ":c:func:`PyType_FromSpec`" msgstr ":c:func:`PyType_FromSpec`" -#: ../../whatsnew/3.12.rst:2075 +#: ../../whatsnew/3.12.rst:2064 msgid ":c:func:`PyType_FromSpecWithBases`" msgstr ":c:func:`PyType_FromSpecWithBases`" -#: ../../whatsnew/3.12.rst:2076 +#: ../../whatsnew/3.12.rst:2065 msgid ":c:func:`PyType_FromModuleAndSpec`" msgstr ":c:func:`PyType_FromModuleAndSpec`" -#: ../../whatsnew/3.12.rst:2078 +#: ../../whatsnew/3.12.rst:2067 msgid "" "Creating classes whose metaclass overrides :c:member:`~PyTypeObject.tp_new` " "is deprecated, and in Python 3.14+ it will be disallowed. Note that these " @@ -4346,14 +4333,14 @@ msgid "" "initialization." msgstr "" -#: ../../whatsnew/3.12.rst:2083 +#: ../../whatsnew/3.12.rst:2072 msgid "" "Note that :c:func:`PyType_FromMetaclass` (added in Python 3.12) already " "disallows creating classes whose metaclass overrides ``tp_new`` (:meth:" "`~object.__new__` in Python)." msgstr "" -#: ../../whatsnew/3.12.rst:2087 +#: ../../whatsnew/3.12.rst:2076 msgid "" "Since ``tp_new`` overrides almost everything ``PyType_From*`` functions do, " "the two are incompatible with each other. The existing behavior -- ignoring " @@ -4362,17 +4349,17 @@ msgid "" "general workaround. One of the following may work for you:" msgstr "" -#: ../../whatsnew/3.12.rst:2094 +#: ../../whatsnew/3.12.rst:2083 msgid "If you control the metaclass, avoid using ``tp_new`` in it:" msgstr "" -#: ../../whatsnew/3.12.rst:2096 +#: ../../whatsnew/3.12.rst:2085 msgid "" "If initialization can be skipped, it can be done in :c:member:`~PyTypeObject." "tp_init` instead." msgstr "" -#: ../../whatsnew/3.12.rst:2098 +#: ../../whatsnew/3.12.rst:2087 msgid "" "If the metaclass doesn't need to be instantiated from Python, set its " "``tp_new`` to ``NULL`` using the :c:macro:" @@ -4380,20 +4367,20 @@ msgid "" "``PyType_From*`` functions." msgstr "" -#: ../../whatsnew/3.12.rst:2103 +#: ../../whatsnew/3.12.rst:2092 msgid "" "Avoid ``PyType_From*`` functions: if you don't need C-specific features " "(slots or setting the instance size), create types by :ref:`calling <call>` " "the metaclass." msgstr "" -#: ../../whatsnew/3.12.rst:2107 +#: ../../whatsnew/3.12.rst:2096 msgid "" "If you *know* the ``tp_new`` can be skipped safely, filter the deprecation " "warning out using :func:`warnings.catch_warnings` from Python." msgstr "" -#: ../../whatsnew/3.12.rst:2110 +#: ../../whatsnew/3.12.rst:2099 msgid "" ":c:var:`PyOS_InputHook` and :c:var:`PyOS_ReadlineFunctionPointer` are no " "longer called in :ref:`subinterpreters <sub-interpreter-support>`. This is " @@ -4401,14 +4388,14 @@ msgid "" "callbacks have no way of recovering extension module state)." msgstr "" -#: ../../whatsnew/3.12.rst:2115 +#: ../../whatsnew/3.12.rst:2104 msgid "" "This also avoids situations where extensions may find themselves running in " "a subinterpreter that they don't support (or haven't yet been loaded in). " "See :gh:`104668` for more info." msgstr "" -#: ../../whatsnew/3.12.rst:2119 +#: ../../whatsnew/3.12.rst:2108 msgid "" ":c:struct:`PyLongObject` has had its internals changed for better " "performance. Although the internals of :c:struct:`PyLongObject` are private, " @@ -4419,15 +4406,15 @@ msgid "" "a single machine word:" msgstr "" -#: ../../whatsnew/3.12.rst:2127 +#: ../../whatsnew/3.12.rst:2116 msgid ":c:func:`PyUnstable_Long_IsCompact`" msgstr ":c:func:`PyUnstable_Long_IsCompact`" -#: ../../whatsnew/3.12.rst:2128 +#: ../../whatsnew/3.12.rst:2117 msgid ":c:func:`PyUnstable_Long_CompactValue`" msgstr ":c:func:`PyUnstable_Long_CompactValue`" -#: ../../whatsnew/3.12.rst:2130 +#: ../../whatsnew/3.12.rst:2119 msgid "" "Custom allocators, set via :c:func:`PyMem_SetAllocator`, are now required to " "be thread-safe, regardless of memory domain. Allocators that don't have " @@ -4436,7 +4423,7 @@ msgid "" "create a new GitHub issue and CC ``@ericsnowcurrently``." msgstr "" -#: ../../whatsnew/3.12.rst:2140 +#: ../../whatsnew/3.12.rst:2129 msgid "" "In accordance with :pep:`699`, the ``ma_version_tag`` field in :c:type:" "`PyDictObject` is deprecated for extension modules. Accessing this field " @@ -4445,76 +4432,76 @@ msgid "" "PEP by Ken Jin.)" msgstr "" -#: ../../whatsnew/3.12.rst:2145 +#: ../../whatsnew/3.12.rst:2134 msgid "Deprecate global configuration variable:" msgstr "棄用全域配置變數:" -#: ../../whatsnew/3.12.rst:2147 +#: ../../whatsnew/3.12.rst:2136 msgid ":c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug`" msgstr ":c:var:`Py_DebugFlag`: 請改用 :c:member:`PyConfig.parser_debug`" -#: ../../whatsnew/3.12.rst:2148 +#: ../../whatsnew/3.12.rst:2137 msgid ":c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose`" msgstr ":c:var:`Py_VerboseFlag`: 請改用 :c:member:`PyConfig.verbose`" -#: ../../whatsnew/3.12.rst:2149 +#: ../../whatsnew/3.12.rst:2138 msgid ":c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet`" msgstr ":c:var:`Py_QuietFlag`: 請改用 :c:member:`PyConfig.quiet`" -#: ../../whatsnew/3.12.rst:2150 +#: ../../whatsnew/3.12.rst:2139 msgid ":c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive`" msgstr ":c:var:`Py_InteractiveFlag`: 請改用 :c:member:`PyConfig.interactive`" -#: ../../whatsnew/3.12.rst:2151 +#: ../../whatsnew/3.12.rst:2140 msgid ":c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect`" msgstr ":c:var:`Py_InspectFlag`: 請改用 :c:member:`PyConfig.inspect`" -#: ../../whatsnew/3.12.rst:2152 +#: ../../whatsnew/3.12.rst:2141 msgid ":c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level`" msgstr "" ":c:var:`Py_OptimizeFlag`: 請改用 :c:member:`PyConfig.optimization_level`" -#: ../../whatsnew/3.12.rst:2153 +#: ../../whatsnew/3.12.rst:2142 msgid ":c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import`" msgstr ":c:var:`Py_NoSiteFlag`: 請改用 :c:member:`PyConfig.site_import`" -#: ../../whatsnew/3.12.rst:2154 +#: ../../whatsnew/3.12.rst:2143 msgid ":c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning`" msgstr "" ":c:var:`Py_BytesWarningFlag`: 請改用 :c:member:`PyConfig.bytes_warning`" -#: ../../whatsnew/3.12.rst:2155 +#: ../../whatsnew/3.12.rst:2144 msgid ":c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings`" msgstr "" ":c:var:`Py_FrozenFlag`: 請改用 :c:member:`PyConfig.pathconfig_warnings`" -#: ../../whatsnew/3.12.rst:2156 +#: ../../whatsnew/3.12.rst:2145 msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment`" msgstr "" ":c:var:`Py_IgnoreEnvironmentFlag`: 請改用 :c:member:`PyConfig." "use_environment`" -#: ../../whatsnew/3.12.rst:2157 +#: ../../whatsnew/3.12.rst:2146 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode`" msgstr "" ":c:var:`Py_DontWriteBytecodeFlag`: 請改用 :c:member:`PyConfig.write_bytecode`" -#: ../../whatsnew/3.12.rst:2158 +#: ../../whatsnew/3.12.rst:2147 msgid "" ":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig.user_site_directory`" msgstr "" ":c:var:`Py_NoUserSiteDirectory`: 請改用 :c:member:`PyConfig." "user_site_directory`" -#: ../../whatsnew/3.12.rst:2159 +#: ../../whatsnew/3.12.rst:2148 msgid "" ":c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio`" msgstr "" ":c:var:`Py_UnbufferedStdioFlag`: 請改用 :c:member:`PyConfig.buffered_stdio`" -#: ../../whatsnew/3.12.rst:2160 +#: ../../whatsnew/3.12.rst:2149 msgid "" ":c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed`" @@ -4522,11 +4509,11 @@ msgstr "" ":c:var:`Py_HashRandomizationFlag`: 請改用 :c:member:`PyConfig.use_hash_seed` " "和 :c:member:`PyConfig.hash_seed`" -#: ../../whatsnew/3.12.rst:2162 +#: ../../whatsnew/3.12.rst:2151 msgid ":c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated`" msgstr ":c:var:`Py_IsolatedFlag`: 請改用 :c:member:`PyConfig.isolated`" -#: ../../whatsnew/3.12.rst:2163 +#: ../../whatsnew/3.12.rst:2152 msgid "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." "legacy_windows_fs_encoding`" @@ -4534,7 +4521,7 @@ msgstr "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`: 請改用 :c:member:`PyPreConfig." "legacy_windows_fs_encoding`" -#: ../../whatsnew/3.12.rst:2164 +#: ../../whatsnew/3.12.rst:2153 msgid "" ":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." "legacy_windows_stdio`" @@ -4542,7 +4529,7 @@ msgstr "" ":c:var:`Py_LegacyWindowsStdioFlag`: 請改用 :c:member:`PyConfig." "legacy_windows_stdio`" -#: ../../whatsnew/3.12.rst:2165 +#: ../../whatsnew/3.12.rst:2154 msgid "" ":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." "filesystem_encoding`" @@ -4550,7 +4537,7 @@ msgstr "" ":c:var:`!Py_FileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." "filesystem_encoding`" -#: ../../whatsnew/3.12.rst:2166 +#: ../../whatsnew/3.12.rst:2155 msgid "" ":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." "filesystem_encoding`" @@ -4558,7 +4545,7 @@ msgstr "" ":c:var:`!Py_HasFileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." "filesystem_encoding`" -#: ../../whatsnew/3.12.rst:2167 +#: ../../whatsnew/3.12.rst:2156 msgid "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." "filesystem_errors`" @@ -4566,7 +4553,7 @@ msgstr "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`: 請改用 :c:member:`PyConfig." "filesystem_errors`" -#: ../../whatsnew/3.12.rst:2168 +#: ../../whatsnew/3.12.rst:2157 msgid "" ":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:" "`Py_PreInitialize`)" @@ -4574,7 +4561,7 @@ msgstr "" ":c:var:`!Py_UTF8Mode`: 請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參見 :c:" "func:`Py_PreInitialize`)" -#: ../../whatsnew/3.12.rst:2170 +#: ../../whatsnew/3.12.rst:2159 msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" "`PyConfig` instead. (Contributed by Victor Stinner in :gh:`77782`.)" @@ -4582,25 +4569,25 @@ msgstr "" ":c:func:`Py_InitializeFromConfig` API 應改為與 :c:type:`PyConfig` 一起使用。" "(由 Victor Stinner 於 :gh:`77782` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2174 +#: ../../whatsnew/3.12.rst:2163 msgid "" "Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable " "bases is deprecated and will be disabled in Python 3.14. (:gh:`95388`)" msgstr "" -#: ../../whatsnew/3.12.rst:2177 +#: ../../whatsnew/3.12.rst:2166 msgid "" "The :file:`structmember.h` header is deprecated, though it continues to be " "available and there are no plans to remove it." msgstr ":file:`structmember.h` 標頭已棄用,但仍可使用,且還沒有移除它的計畫。" -#: ../../whatsnew/3.12.rst:2180 +#: ../../whatsnew/3.12.rst:2169 msgid "" "Its contents are now available just by including :file:`Python.h`, with a " "``Py`` prefix added if it was missing:" msgstr "" -#: ../../whatsnew/3.12.rst:2183 +#: ../../whatsnew/3.12.rst:2172 msgid "" ":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` and :c:func:" "`PyMember_SetOne`" @@ -4608,13 +4595,13 @@ msgstr "" ":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` 和 :c:func:" "`PyMember_SetOne`" -#: ../../whatsnew/3.12.rst:2185 +#: ../../whatsnew/3.12.rst:2174 msgid "" "Type macros like :c:macro:`Py_T_INT`, :c:macro:`Py_T_DOUBLE`, etc. " "(previously ``T_INT``, ``T_DOUBLE``, etc.)" msgstr "" -#: ../../whatsnew/3.12.rst:2187 +#: ../../whatsnew/3.12.rst:2176 msgid "" "The flags :c:macro:`Py_READONLY` (previously ``READONLY``) and :c:macro:" "`Py_AUDIT_READ` (previously all uppercase)" @@ -4622,23 +4609,23 @@ msgstr "" ":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)和 :c:macro:" "`Py_AUDIT_READ`\\ (先前全大寫)旗標" -#: ../../whatsnew/3.12.rst:2190 +#: ../../whatsnew/3.12.rst:2179 msgid "Several items are not exposed from :file:`Python.h`:" msgstr "數個項目不再從 :file:`Python.h` 中公開:" -#: ../../whatsnew/3.12.rst:2192 +#: ../../whatsnew/3.12.rst:2181 msgid ":c:macro:`T_OBJECT` (use :c:macro:`Py_T_OBJECT_EX`)" msgstr ":c:macro:`T_OBJECT`\\ (請改用 :c:macro:`Py_T_OBJECT_EX`)" -#: ../../whatsnew/3.12.rst:2193 +#: ../../whatsnew/3.12.rst:2182 msgid ":c:macro:`T_NONE` (previously undocumented, and pretty quirky)" msgstr ":c:macro:`T_NONE`\\ (先前未記錄於文件上,且相當古怪)" -#: ../../whatsnew/3.12.rst:2194 +#: ../../whatsnew/3.12.rst:2183 msgid "The macro ``WRITE_RESTRICTED`` which does nothing." msgstr "不做任何事的巨集 ``WRITE_RESTRICTED``。" -#: ../../whatsnew/3.12.rst:2195 +#: ../../whatsnew/3.12.rst:2184 msgid "" "The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of :c:macro:" "`Py_AUDIT_READ`." @@ -4646,33 +4633,33 @@ msgstr "" "``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當於 :c:macro:" "`Py_AUDIT_READ`。" -#: ../../whatsnew/3.12.rst:2197 +#: ../../whatsnew/3.12.rst:2186 msgid "" "In some configurations, ``<stddef.h>`` is not included from :file:`Python." "h`. It should be included manually when using ``offsetof()``." msgstr "" -#: ../../whatsnew/3.12.rst:2200 +#: ../../whatsnew/3.12.rst:2189 msgid "" "The deprecated header continues to provide its original contents under the " "original names. Your old code can stay unchanged, unless the extra include " "and non-namespaced macros bother you greatly." msgstr "" -#: ../../whatsnew/3.12.rst:2205 +#: ../../whatsnew/3.12.rst:2194 msgid "" "(Contributed in :gh:`47146` by Petr Viktorin, based on earlier work by " "Alexander Belopolsky and Matthias Braun.)" msgstr "" -#: ../../whatsnew/3.12.rst:2208 +#: ../../whatsnew/3.12.rst:2197 msgid "" ":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. Use :c:" "func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException` " "instead. (Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2213 +#: ../../whatsnew/3.12.rst:2202 msgid "" ":c:func:`!PyErr_Display` is deprecated. Use :c:func:`PyErr_DisplayException` " "instead. (Contributed by Irit Katriel in :gh:`102755`)." @@ -4680,7 +4667,7 @@ msgstr "" ":c:func:`!PyErr_Display` 已棄用,請改用 :c:func:`PyErr_DisplayException`。" "(由 Irit Katriel 於 :gh:`102755` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2216 +#: ../../whatsnew/3.12.rst:2205 msgid "" "``_PyErr_ChainExceptions`` is deprecated. Use ``_PyErr_ChainExceptions1`` " "instead. (Contributed by Irit Katriel in :gh:`102192`.)" @@ -4688,7 +4675,7 @@ msgstr "" "``_PyErr_ChainExceptions`` 已棄用,請改用 ``_PyErr_ChainExceptions1``。(由 " "Irit Katriel 於 :gh:`102192` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2219 +#: ../../whatsnew/3.12.rst:2208 msgid "" "Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` or :c:" "func:`PyType_FromModuleAndSpec` to create a class whose metaclass overrides :" @@ -4893,13 +4880,12 @@ msgstr "" "`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 -msgid "" -":c:func:`PyWeakref_GET_OBJECT`: use :c:func:`!PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GET_OBJECT`:請改用 :c:func:`!PyWeakref_GetRef`。" +msgid ":c:func:`PyWeakref_GET_OBJECT`: use :c:func:`PyWeakref_GetRef` instead." +msgstr ":c:func:`PyWeakref_GET_OBJECT`:請改用 :c:func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 -msgid ":c:func:`PyWeakref_GetObject`: use :c:func:`!PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GetObject`:請改用 :c:func:`!PyWeakref_GetRef`。" +msgid ":c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef` instead." +msgstr ":c:func:`PyWeakref_GetObject`:請改用 :c:func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:8 msgid ":c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead." @@ -5079,54 +5065,54 @@ msgstr "" msgid ":c:func:`PyThread_ReInitTLS`: unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.12.rst:2235 +#: ../../whatsnew/3.12.rst:2224 msgid "" "Remove the :file:`token.h` header file. There was never any public tokenizer " "C API. The :file:`token.h` header file was only designed to be used by " "Python internals. (Contributed by Victor Stinner in :gh:`92651`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2240 +#: ../../whatsnew/3.12.rst:2229 msgid "Legacy Unicode APIs have been removed. See :pep:`623` for detail." msgstr "" -#: ../../whatsnew/3.12.rst:2242 +#: ../../whatsnew/3.12.rst:2231 msgid ":c:macro:`!PyUnicode_WCHAR_KIND`" msgstr ":c:macro:`!PyUnicode_WCHAR_KIND`" -#: ../../whatsnew/3.12.rst:2243 +#: ../../whatsnew/3.12.rst:2232 msgid ":c:func:`!PyUnicode_AS_UNICODE`" msgstr ":c:func:`!PyUnicode_AS_UNICODE`" -#: ../../whatsnew/3.12.rst:2244 +#: ../../whatsnew/3.12.rst:2233 msgid ":c:func:`!PyUnicode_AsUnicode`" msgstr ":c:func:`!PyUnicode_AsUnicode`" -#: ../../whatsnew/3.12.rst:2245 +#: ../../whatsnew/3.12.rst:2234 msgid ":c:func:`!PyUnicode_AsUnicodeAndSize`" msgstr ":c:func:`!PyUnicode_AsUnicodeAndSize`" -#: ../../whatsnew/3.12.rst:2246 +#: ../../whatsnew/3.12.rst:2235 msgid ":c:func:`!PyUnicode_AS_DATA`" msgstr ":c:func:`!PyUnicode_AS_DATA`" -#: ../../whatsnew/3.12.rst:2247 +#: ../../whatsnew/3.12.rst:2236 msgid ":c:func:`!PyUnicode_FromUnicode`" msgstr ":c:func:`!PyUnicode_FromUnicode`" -#: ../../whatsnew/3.12.rst:2248 +#: ../../whatsnew/3.12.rst:2237 msgid ":c:func:`!PyUnicode_GET_SIZE`" msgstr ":c:func:`!PyUnicode_GET_SIZE`" -#: ../../whatsnew/3.12.rst:2249 +#: ../../whatsnew/3.12.rst:2238 msgid ":c:func:`!PyUnicode_GetSize`" msgstr ":c:func:`!PyUnicode_GetSize`" -#: ../../whatsnew/3.12.rst:2250 +#: ../../whatsnew/3.12.rst:2239 msgid ":c:func:`!PyUnicode_GET_DATA_SIZE`" msgstr ":c:func:`!PyUnicode_GET_DATA_SIZE`" -#: ../../whatsnew/3.12.rst:2252 +#: ../../whatsnew/3.12.rst:2241 msgid "" "Remove the ``PyUnicode_InternImmortal()`` function macro. (Contributed by " "Victor Stinner in :gh:`85858`.)" @@ -5134,56 +5120,24 @@ msgstr "" "移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner 於 :gh:" "`85858` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2256 -msgid "Notable changes in 3.12.4" -msgstr "3.12.4 中的顯著變更" +#~ msgid "Notable changes in 3.12.4" +#~ msgstr "3.12.4 中的顯著變更" -#: ../../whatsnew/3.12.rst:2259 -msgid "ipaddress" -msgstr "ipaddress" +#~ msgid "ipaddress" +#~ msgstr "ipaddress" -#: ../../whatsnew/3.12.rst:2261 -msgid "" -"Fixed ``is_global`` and ``is_private`` behavior in ``IPv4Address``, " -"``IPv6Address``, ``IPv4Network`` and ``IPv6Network``." -msgstr "" -"修正 ``IPv4Address``、``IPv6Address``、``IPv4Network`` 和 ``IPv6Network`` 中" -"的 ``is_global`` 和 ``is_private`` 行為。" - -#: ../../whatsnew/3.12.rst:2266 -msgid "Notable changes in 3.12.5" -msgstr "3.12.5 中的顯著變更" +#~ msgid "" +#~ "Fixed ``is_global`` and ``is_private`` behavior in ``IPv4Address``, " +#~ "``IPv6Address``, ``IPv4Network`` and ``IPv6Network``." +#~ msgstr "" +#~ "修正 ``IPv4Address``、``IPv6Address``、``IPv4Network`` 和 ``IPv6Network`` " +#~ "中的 ``is_global`` 和 ``is_private`` 行為。" -#: ../../whatsnew/3.12.rst:2269 ../../whatsnew/3.12.rst:2286 -msgid "email" -msgstr "email" +#~ msgid "Notable changes in 3.12.5" +#~ msgstr "3.12.5 中的顯著變更" -#: ../../whatsnew/3.12.rst:2272 -msgid "Headers with embedded newlines are now quoted on output." -msgstr "" +#~ msgid "email" +#~ msgstr "email" -#: ../../whatsnew/3.12.rst:2274 -msgid "" -"The :mod:`~email.generator` will now refuse to serialize (write) headers " -"that are improperly folded or delimited, such that they would be parsed as " -"multiple headers or joined with adjacent data. If you need to turn this " -"safety feature off, set :attr:`~email.policy.Policy." -"verify_generated_headers`. (Contributed by Bas Bloemsaat and Petr Viktorin " -"in :gh:`121650`.)" -msgstr "" - -#: ../../whatsnew/3.12.rst:2283 -msgid "Notable changes in 3.12.6" -msgstr "3.12.6 中的顯著變更" - -#: ../../whatsnew/3.12.rst:2288 -msgid "" -":func:`email.utils.getaddresses` and :func:`email.utils.parseaddr` now " -"return ``('', '')`` 2-tuples in more situations where invalid email " -"addresses are encountered, instead of potentially inaccurate values. An " -"optional *strict* parameter was added to these two functions: use " -"``strict=False`` to get the old behavior, accepting malformed inputs. " -"``getattr(email.utils, 'supports_strict_parsing', False)`` can be used to " -"check if the *strict* paramater is available. (Contributed by Thomas Dwyer " -"and Victor Stinner for :gh:`102988` to improve the CVE-2023-27043 fix.)" -msgstr "" +#~ msgid "Notable changes in 3.12.6" +#~ msgstr "3.12.6 中的顯著變更" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po new file mode 100644 index 0000000000..380acd14d1 --- /dev/null +++ b/whatsnew/3.13.po @@ -0,0 +1,4787 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../whatsnew/3.13.rst:4 +msgid "What's New In Python 3.13" +msgstr "" + +#: ../../whatsnew/3.13.rst:0 +msgid "Editor" +msgstr "" + +#: ../../whatsnew/3.13.rst:6 +msgid "Thomas Wouters" +msgstr "" + +#: ../../whatsnew/3.13.rst:48 +msgid "" +"This article explains the new features in Python 3.13, compared to 3.12. " +"Python 3.13 will be released on October 1, 2024. For full details, see the :" +"ref:`changelog <changelog>`." +msgstr "" + +#: ../../whatsnew/3.13.rst:54 +msgid ":pep:`719` -- Python 3.13 Release Schedule" +msgstr "" + +#: ../../whatsnew/3.13.rst:58 +msgid "" +"Prerelease users should be aware that this document is currently in draft " +"form. It will be updated substantially as Python 3.13 moves towards release, " +"so it's worth checking back even after reading earlier versions." +msgstr "" + +#: ../../whatsnew/3.13.rst:64 +msgid "Summary -- Release Highlights" +msgstr "" + +#: ../../whatsnew/3.13.rst:69 +msgid "" +"Python 3.13 will be the latest stable release of the Python programming " +"language, with a mix of changes to the language, the implementation and the " +"standard library. The biggest changes include a new `interactive interpreter " +"<whatsnew313-better-interactive-interpreter_>`_, experimental support for " +"running in a `free-threaded mode <whatsnew313-free-threaded-cpython_>`_ (:" +"pep:`703`), and a `Just-In-Time compiler <whatsnew313-jit-compiler_>`_ (:pep:" +"`744`)." +msgstr "" + +#: ../../whatsnew/3.13.rst:78 +msgid "" +"Error messages continue to improve, with tracebacks now highlighted in color " +"by default. The :func:`locals` builtin now has :ref:`defined semantics " +"<whatsnew313-locals-semantics>` for changing the returned mapping, and type " +"parameters now support default values." +msgstr "" + +#: ../../whatsnew/3.13.rst:83 +msgid "" +"The library changes contain removal of deprecated APIs and modules, as well " +"as the usual improvements in user-friendliness and correctness. Several " +"legacy standard library modules have now `been removed <whatsnew313-" +"pep594_>`_ following their deprecation in Python 3.11 (:pep:`594`)." +msgstr "" + +#: ../../whatsnew/3.13.rst:88 +msgid "" +"This article doesn't attempt to provide a complete specification of all new " +"features, but instead gives a convenient overview. For full details refer to " +"the documentation, such as the :ref:`Library Reference <library-index>` and :" +"ref:`Language Reference <reference-index>`. To understand the complete " +"implementation and design rationale for a change, refer to the PEP for a " +"particular new feature; but note that PEPs usually are not kept up-to-date " +"once a feature has been fully implemented. See `Porting to Python 3.13`_ for " +"guidance on upgrading from earlier versions of Python." +msgstr "" + +#: ../../whatsnew/3.13.rst:104 +msgid "Interpreter improvements:" +msgstr "" + +#: ../../whatsnew/3.13.rst:106 +msgid "" +"A greatly improved :ref:`interactive interpreter <whatsnew313-better-" +"interactive-interpreter>` and :ref:`improved error messages <whatsnew313-" +"improved-error-messages>`." +msgstr "" + +#: ../../whatsnew/3.13.rst:109 +msgid "" +":pep:`667`: The :func:`locals` builtin now has :ref:`defined semantics " +"<whatsnew313-locals-semantics>` when mutating the returned mapping. Python " +"debuggers and similar tools may now more reliably update local variables in " +"optimized scopes even during concurrent code execution." +msgstr "" + +#: ../../whatsnew/3.13.rst:114 +msgid "" +":pep:`703`: CPython 3.13 has experimental support for running with the :term:" +"`global interpreter lock` disabled. See :ref:`Free-threaded CPython " +"<whatsnew313-free-threaded-cpython>` for more details." +msgstr "" + +#: ../../whatsnew/3.13.rst:117 +msgid "" +":pep:`744`: A basic :ref:`JIT compiler <whatsnew313-jit-compiler>` was " +"added. It is currently disabled by default (though we may turn it on later). " +"Performance improvements are modest -- we expect to improve this over the " +"next few releases." +msgstr "" + +#: ../../whatsnew/3.13.rst:121 +msgid "" +"Color support in the new :ref:`interactive interpreter <whatsnew313-better-" +"interactive-interpreter>`, as well as in :ref:`tracebacks <whatsnew313-" +"improved-error-messages>` and :ref:`doctest <whatsnew313-doctest>` output. " +"This can be disabled through the :envvar:`PYTHON_COLORS` and |NO_COLOR|_ " +"environment variables." +msgstr "" + +#: ../../whatsnew/3.13.rst:128 +msgid "Python data model improvements:" +msgstr "" + +#: ../../whatsnew/3.13.rst:130 +msgid "" +":attr:`~class.__static_attributes__` stores the names of attributes accessed " +"through ``self.X`` in any function in a class body." +msgstr "" + +#: ../../whatsnew/3.13.rst:132 +msgid "" +":attr:`!__firstlineno__` records the first line number of a class definition." +msgstr "" + +#: ../../whatsnew/3.13.rst:134 +msgid "Significant improvements in the standard library:" +msgstr "" + +#: ../../whatsnew/3.13.rst:136 +msgid "" +"Add a new :exc:`PythonFinalizationError` exception, raised when an operation " +"is blocked during :term:`finalization <interpreter shutdown>`." +msgstr "" + +#: ../../whatsnew/3.13.rst:138 +msgid "" +"The :mod:`argparse` module now supports deprecating command-line options, " +"positional arguments, and subcommands." +msgstr "" + +#: ../../whatsnew/3.13.rst:140 +msgid "" +"The new functions :func:`base64.z85encode` and :func:`base64.z85decode` " +"support encoding and decoding `Z85 data`_." +msgstr "" + +#: ../../whatsnew/3.13.rst:142 +msgid "" +"The :mod:`copy` module now has a :func:`copy.replace` function, with support " +"for many builtin types and any class defining the :func:`~object." +"__replace__` method." +msgstr "" + +#: ../../whatsnew/3.13.rst:145 +msgid "The :mod:`dbm.sqlite3` module is now the default :mod:`dbm` backend." +msgstr "" + +#: ../../whatsnew/3.13.rst:146 +msgid "" +"The :mod:`os` module has a :ref:`suite of new functions <os-timerfd>` for " +"working with Linux's timer notification file descriptors." +msgstr "" + +#: ../../whatsnew/3.13.rst:148 +msgid "" +"The :mod:`random` module now has a :ref:`command-line interface <random-" +"cli>`." +msgstr "" + +#: ../../whatsnew/3.13.rst:150 +msgid "Security improvements:" +msgstr "" + +#: ../../whatsnew/3.13.rst:152 +msgid "" +":func:`ssl.create_default_context` sets :data:`ssl." +"VERIFY_X509_PARTIAL_CHAIN` and :data:`ssl.VERIFY_X509_STRICT` as default " +"flags." +msgstr "" + +#: ../../whatsnew/3.13.rst:155 +msgid "C API improvements:" +msgstr "" + +#: ../../whatsnew/3.13.rst:157 +msgid "" +"The :c:data:`Py_mod_gil` slot is now used to indicate that an extension " +"module supports running with the :term:`GIL` disabled." +msgstr "" + +#: ../../whatsnew/3.13.rst:159 +msgid "" +"The :doc:`PyTime C API </c-api/time>` has been added, providing access to " +"system clocks." +msgstr "" + +#: ../../whatsnew/3.13.rst:161 +msgid "" +":c:type:`PyMutex` is a new lightweight mutex that occupies a single byte." +msgstr "" + +#: ../../whatsnew/3.13.rst:163 +msgid "New typing features:" +msgstr "" + +#: ../../whatsnew/3.13.rst:165 +msgid "" +":pep:`696`: Type parameters (:data:`typing.TypeVar`, :data:`typing." +"ParamSpec`, and :data:`typing.TypeVarTuple`) now support defaults." +msgstr "" + +#: ../../whatsnew/3.13.rst:167 +msgid "" +":pep:`702`: The new :func:`warnings.deprecated` decorator adds support for " +"marking deprecations in the type system." +msgstr "" + +#: ../../whatsnew/3.13.rst:169 +msgid "" +":pep:`705`: :data:`typing.ReadOnly` can be used to mark an item of a :class:" +"`typing.TypedDict` as read-only for type checkers." +msgstr "" + +#: ../../whatsnew/3.13.rst:171 +msgid "" +":pep:`742`: :data:`typing.TypeIs` provides more intuitive type narrowing " +"behavior, as an alternative to :data:`typing.TypeGuard`." +msgstr "" + +#: ../../whatsnew/3.13.rst:174 +msgid "Platform support:" +msgstr "" + +#: ../../whatsnew/3.13.rst:176 +msgid "" +":pep:`730`: Apple's iOS is now an :ref:`officially supported platform " +"<whatsnew313-platform-support>`, at :pep:`tier 3 <11#tier-3>`. Official " +"Android support (:pep:`738`) is in the works as well." +msgstr "" + +#: ../../whatsnew/3.13.rst:179 +msgid "" +"``wasm32-wasi`` is now supported as a :pep:`tier 2 <11#tier-2>` platform." +msgstr "" + +#: ../../whatsnew/3.13.rst:180 +msgid "``wasm32-emscripten`` is no longer an officially supported platform." +msgstr "" + +#: ../../whatsnew/3.13.rst:182 +msgid "Important removals:" +msgstr "" + +#: ../../whatsnew/3.13.rst:184 +msgid "" +":ref:`PEP 594 <whatsnew313-pep594>`: The remaining 19 \"dead batteries\" " +"have been removed from the standard library: :mod:`!aifc`, :mod:`!audioop`, :" +"mod:`!cgi`, :mod:`!cgitb`, :mod:`!chunk`, :mod:`!crypt`, :mod:`!imghdr`, :" +"mod:`!mailcap`, :mod:`!msilib`, :mod:`!nis`, :mod:`!nntplib`, :mod:`!" +"ossaudiodev`, :mod:`!pipes`, :mod:`!sndhdr`, :mod:`!spwd`, :mod:`!sunau`, :" +"mod:`!telnetlib`, :mod:`!uu` and :mod:`!xdrlib`." +msgstr "" + +#: ../../whatsnew/3.13.rst:190 +msgid "" +"Remove the :program:`2to3` tool and :mod:`!lib2to3` module (deprecated in " +"Python 3.11)." +msgstr "" + +#: ../../whatsnew/3.13.rst:192 +msgid "Remove the :mod:`!tkinter.tix` module (deprecated in Python 3.6)." +msgstr "" + +#: ../../whatsnew/3.13.rst:193 +msgid "Remove :func:`!locale.resetlocale`." +msgstr "" + +#: ../../whatsnew/3.13.rst:194 +msgid "Remove :mod:`!typing.io` and :mod:`!typing.re`." +msgstr "" + +#: ../../whatsnew/3.13.rst:195 +msgid "Remove chained :class:`classmethod` descriptors." +msgstr "" + +#: ../../whatsnew/3.13.rst:197 +msgid "Release schedule changes:" +msgstr "" + +#: ../../whatsnew/3.13.rst:199 +msgid "" +":pep:`602` (\"Annual Release Cycle for Python\") has been updated to extend " +"the full support ('bugfix') period for new releases to two years. This " +"updated policy means that:" +msgstr "" + +#: ../../whatsnew/3.13.rst:203 +msgid "" +"Python 3.9--3.12 have one and a half years of full support, followed by " +"three and a half years of security fixes." +msgstr "" + +#: ../../whatsnew/3.13.rst:205 +msgid "" +"Python 3.13 and later have two years of full support, followed by three " +"years of security fixes." +msgstr "" + +#: ../../whatsnew/3.13.rst:210 ../../whatsnew/3.13.rst:1954 +msgid "New Features" +msgstr "" + +#: ../../whatsnew/3.13.rst:216 +msgid "A better interactive interpreter" +msgstr "" + +#: ../../whatsnew/3.13.rst:218 +msgid "" +"Python now uses a new :term:`interactive` shell by default, based on code " +"from the `PyPy project`_. When the user starts the :term:`REPL` from an " +"interactive terminal, the following new features are now supported:" +msgstr "" + +#: ../../whatsnew/3.13.rst:223 +msgid "Multiline editing with history preservation." +msgstr "" + +#: ../../whatsnew/3.13.rst:224 +msgid "" +"Direct support for REPL-specific commands like :kbd:`help`, :kbd:`exit`, " +"and :kbd:`quit`, without the need to call them as functions." +msgstr "" + +#: ../../whatsnew/3.13.rst:226 +msgid "" +"Prompts and tracebacks with :ref:`color enabled by default <using-on-" +"controlling-color>`." +msgstr "" + +#: ../../whatsnew/3.13.rst:228 +msgid "" +"Interactive help browsing using :kbd:`F1` with a separate command history." +msgstr "" + +#: ../../whatsnew/3.13.rst:230 +msgid "" +"History browsing using :kbd:`F2` that skips output as well as the :term:" +"`>>>` and :term:`...` prompts." +msgstr "" + +#: ../../whatsnew/3.13.rst:232 +msgid "" +"\"Paste mode\" with :kbd:`F3` that makes pasting larger blocks of code " +"easier (press :kbd:`F3` again to return to the regular prompt)." +msgstr "" + +#: ../../whatsnew/3.13.rst:235 +msgid "" +"To disable the new interactive shell, set the :envvar:`PYTHON_BASIC_REPL` " +"environment variable. For more on interactive mode, see :ref:`tut-interac`." +msgstr "" + +#: ../../whatsnew/3.13.rst:239 +msgid "" +"(Contributed by Pablo Galindo Salgado, Łukasz Langa, and Lysandros Nikolaou " +"in :gh:`111201` based on code from the PyPy project. Windows support " +"contributed by Dino Viehland and Anthony Shaw.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:249 +msgid "Improved error messages" +msgstr "" + +#: ../../whatsnew/3.13.rst:251 +msgid "" +"The interpreter now uses color by default when displaying tracebacks in the " +"terminal. This feature :ref:`can be controlled <using-on-controlling-color>` " +"via the new :envvar:`PYTHON_COLORS` environment variable as well as the " +"canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment variables. (Contributed " +"by Pablo Galindo Salgado in :gh:`112730`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:266 +msgid "" +"A common mistake is to write a script with the same name as a standard " +"library module. When this results in errors, we now display a more helpful " +"error message:" +msgstr "" + +#: ../../whatsnew/3.13.rst:270 +msgid "" +"$ python random.py\n" +"Traceback (most recent call last):\n" +" File \"/home/me/random.py\", line 1, in <module>\n" +" import random\n" +" File \"/home/me/random.py\", line 3, in <module>\n" +" print(random.randint(5))\n" +" ^^^^^^^^^^^^^^\n" +"AttributeError: module 'random' has no attribute 'randint' (consider " +"renaming '/home/me/random.py' since it has the same name as the standard " +"library module named 'random' and the import system gives it precedence)" +msgstr "" + +#: ../../whatsnew/3.13.rst:281 +msgid "" +"Similarly, if a script has the same name as a third-party module that it " +"attempts to import and this results in errors, we also display a more " +"helpful error message:" +msgstr "" + +#: ../../whatsnew/3.13.rst:285 +msgid "" +"$ python numpy.py\n" +"Traceback (most recent call last):\n" +" File \"/home/me/numpy.py\", line 1, in <module>\n" +" import numpy as np\n" +" File \"/home/me/numpy.py\", line 3, in <module>\n" +" np.array([1, 2, 3])\n" +" ^^^^^^^^\n" +"AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/" +"home/me/numpy.py' if it has the same name as a third-party module you " +"intended to import)" +msgstr "" + +#: ../../whatsnew/3.13.rst:296 +msgid "(Contributed by Shantanu Jain in :gh:`95754`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:298 +msgid "" +"The error message now tries to suggest the correct keyword argument when an " +"incorrect keyword argument is passed to a function." +msgstr "" + +#: ../../whatsnew/3.13.rst:301 +msgid "" +">>> \"Better error messages!\".split(max_split=1)\n" +"Traceback (most recent call last):\n" +" File \"<python-input-0>\", line 1, in <module>\n" +" \"Better error messages!\".split(max_split=1)\n" +" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^\n" +"TypeError: split() got an unexpected keyword argument 'max_split'. Did you " +"mean 'maxsplit'?" +msgstr "" + +#: ../../whatsnew/3.13.rst:310 +msgid "" +"(Contributed by Pablo Galindo Salgado and Shantanu Jain in :gh:`107944`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:316 +msgid "Free-threaded CPython" +msgstr "" + +#: ../../whatsnew/3.13.rst:318 +msgid "" +"CPython now has experimental support for running in a free-threaded mode, " +"with the :term:`global interpreter lock` (GIL) disabled. This is an " +"experimental feature and therefore is not enabled by default. The free-" +"threaded mode requires a different executable, usually called " +"``python3.13t`` or ``python3.13t.exe``. Pre-built binaries marked as *free-" +"threaded* can be installed as part of the official :ref:`Windows <install-" +"freethreaded-windows>` and :ref:`macOS <getting-and-installing-macpython>` " +"installers, or CPython can be built from source with the :option:`--disable-" +"gil` option." +msgstr "" + +#: ../../whatsnew/3.13.rst:331 +msgid "" +"Free-threaded execution allows for full utilization of the available " +"processing power by running threads in parallel on available CPU cores. " +"While not all software will benefit from this automatically, programs " +"designed with threading in mind will run faster on multi-core hardware. " +"**The free-threaded mode is experimental** and work is ongoing to improve " +"it: expect some bugs and a substantial single-threaded performance hit. Free-" +"threaded builds of CPython support optionally running with the GIL enabled " +"at runtime using the environment variable :envvar:`PYTHON_GIL` or the " +"command-line option :option:`-X gil`." +msgstr "" + +#: ../../whatsnew/3.13.rst:341 +msgid "" +"To check if the current interpreter supports free-threading, :option:`python " +"-VV <-V>` and :attr:`sys.version` contain \"experimental free-threading " +"build\". The new :func:`!sys._is_gil_enabled` function can be used to check " +"whether the GIL is actually disabled in the running process." +msgstr "" + +#: ../../whatsnew/3.13.rst:346 +msgid "" +"C-API extension modules need to be built specifically for the free-threaded " +"build. Extensions that support running with the :term:`GIL` disabled should " +"use the :c:data:`Py_mod_gil` slot. Extensions using single-phase init should " +"use :c:func:`PyUnstable_Module_SetGIL` to indicate whether they support " +"running with the GIL disabled. Importing C extensions that don't use these " +"mechanisms will cause the GIL to be enabled, unless the GIL was explicitly " +"disabled with the :envvar:`PYTHON_GIL` environment variable or the :option:`-" +"X gil=0` option. pip 24.1 or newer is required to install packages with C " +"extensions in the free-threaded build." +msgstr "" + +#: ../../whatsnew/3.13.rst:359 +msgid "" +":pep:`703` \"Making the Global Interpreter Lock Optional in CPython\" " +"contains rationale and information surrounding this work." +msgstr "" + +#: ../../whatsnew/3.13.rst:362 +msgid "" +"`Porting Extension Modules to Support Free-Threading <https://py-free-" +"threading.github.io/porting/>`_: A community-maintained porting guide for " +"extension authors." +msgstr "" + +#: ../../whatsnew/3.13.rst:370 +msgid "An experimental just-in-time (JIT) compiler" +msgstr "" + +#: ../../whatsnew/3.13.rst:372 +msgid "" +"When CPython is configured and built using the :option:`!--enable-" +"experimental-jit` option, a just-in-time (JIT) compiler is added which may " +"speed up some Python programs. On Windows, use ``PCbuild/build.bat --" +"experimental-jit`` to enable the JIT or ``--experimental-jit-interpreter`` " +"to enable the Tier 2 interpreter. Build requirements and further supporting " +"information `are contained at`__ :file:`Tools/jit/README.md`." +msgstr "" + +#: ../../whatsnew/3.13.rst:382 +msgid "" +"The :option:`!--enable-experimental-jit` option takes these (optional) " +"values, defaulting to ``yes`` if :option:`!--enable-experimental-jit` is " +"present without the optional value." +msgstr "" + +#: ../../whatsnew/3.13.rst:386 +msgid "``no``: Disable the entire Tier 2 and JIT pipeline." +msgstr "" + +#: ../../whatsnew/3.13.rst:387 +msgid "" +"``yes``: Enable the JIT. To disable the JIT at runtime, pass the environment " +"variable ``PYTHON_JIT=0``." +msgstr "" + +#: ../../whatsnew/3.13.rst:389 +msgid "" +"``yes-off``: Build the JIT but disable it by default. To enable the JIT at " +"runtime, pass the environment variable ``PYTHON_JIT=1``." +msgstr "" + +#: ../../whatsnew/3.13.rst:391 +msgid "" +"``interpreter``: Enable the Tier 2 interpreter but disable the JIT. The " +"interpreter can be disabled by running with ``PYTHON_JIT=0``." +msgstr "" + +#: ../../whatsnew/3.13.rst:394 +msgid "The internal architecture is roughly as follows:" +msgstr "" + +#: ../../whatsnew/3.13.rst:396 +msgid "" +"We start with specialized *Tier 1 bytecode*. See :ref:`What's new in 3.11 " +"<whatsnew311-pep659>` for details." +msgstr "" + +#: ../../whatsnew/3.13.rst:398 +msgid "" +"When the Tier 1 bytecode gets hot enough, it gets translated to a new purely " +"internal intermediate representation (IR), called the *Tier 2 IR*, and " +"sometimes referred to as micro-ops (\"uops\")." +msgstr "" + +#: ../../whatsnew/3.13.rst:401 +msgid "" +"The Tier 2 IR uses the same stack-based virtual machine as Tier 1, but the " +"instruction format is better suited to translation to machine code." +msgstr "" + +#: ../../whatsnew/3.13.rst:403 +msgid "" +"We have several optimization passes for Tier 2 IR, which are applied before " +"it is interpreted or translated to machine code." +msgstr "" + +#: ../../whatsnew/3.13.rst:405 +msgid "" +"There is a Tier 2 interpreter, but it is mostly intended for debugging the " +"earlier stages of the optimization pipeline. The Tier 2 interpreter can be " +"enabled by configuring Python with ``--enable-experimental-jit=interpreter``." +msgstr "" + +#: ../../whatsnew/3.13.rst:409 +msgid "" +"When the JIT is enabled, the optimized Tier 2 IR is translated to machine " +"code, which is then executed." +msgstr "" + +#: ../../whatsnew/3.13.rst:411 +msgid "" +"The machine code translation process uses a technique called *copy-and-" +"patch*. It has no runtime dependencies, but there is a new build-time " +"dependency on LLVM." +msgstr "" + +#: ../../whatsnew/3.13.rst:415 +msgid ":pep:`744`" +msgstr "" + +#: ../../whatsnew/3.13.rst:417 +msgid "" +"(JIT by Brandt Bucher, inspired by a paper by Haoran Xu and Fredrik " +"Kjolstad. Tier 2 IR by Mark Shannon and Guido van Rossum. Tier 2 optimizer " +"by Ken Jin.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:425 +msgid "Defined mutation semantics for :py:func:`locals`" +msgstr "" + +#: ../../whatsnew/3.13.rst:427 +msgid "" +"Historically, the expected result of mutating the return value of :func:" +"`locals` has been left to individual Python implementations to define. " +"Starting from Python 3.13, :pep:`667` standardises the historical behaviour " +"of CPython for most code execution scopes, but changes :term:`optimized " +"scopes <optimized scope>` (functions, generators, coroutines, " +"comprehensions, and generator expressions) to explicitly return independent " +"snapshots of the currently assigned local variables, including locally " +"referenced nonlocal variables captured in closures." +msgstr "" + +#: ../../whatsnew/3.13.rst:436 +msgid "" +"This change to the semantics of :func:`locals` in optimized scopes also " +"affects the default behaviour of code execution functions that implicitly " +"target :func:`!locals` if no explicit namespace is provided (such as :func:" +"`exec` and :func:`eval`). In previous versions, whether or not changes could " +"be accessed by calling :func:`!locals` after calling the code execution " +"function was implementation-dependent. In CPython specifically, such code " +"would typically appear to work as desired, but could sometimes fail in " +"optimized scopes based on other code (including debuggers and code execution " +"tracing tools) potentially resetting the shared snapshot in that scope. Now, " +"the code will always run against an independent snapshot of the local " +"variables in optimized scopes, and hence the changes will never be visible " +"in subsequent calls to :func:`!locals`. To access the changes made in these " +"cases, an explicit namespace reference must now be passed to the relevant " +"function. Alternatively, it may make sense to update affected code to use a " +"higher level code execution API that returns the resulting code execution " +"namespace (e.g. :func:`runpy.run_path` when executing Python files from " +"disk)." +msgstr "" + +#: ../../whatsnew/3.13.rst:455 +msgid "" +"To ensure debuggers and similar tools can reliably update local variables in " +"scopes affected by this change, :attr:`FrameType.f_locals <frame.f_locals>` " +"now returns a write-through proxy to the frame's local and locally " +"referenced nonlocal variables in these scopes, rather than returning an " +"inconsistently updated shared ``dict`` instance with undefined runtime " +"semantics." +msgstr "" + +#: ../../whatsnew/3.13.rst:461 +msgid "" +"See :pep:`667` for more details, including related C API changes and " +"deprecations. Porting notes are also provided below for the affected :ref:" +"`Python APIs <pep667-porting-notes-py>` and :ref:`C APIs <pep667-porting-" +"notes-c>`." +msgstr "" + +#: ../../whatsnew/3.13.rst:466 +msgid "" +"(PEP and implementation contributed by Mark Shannon and Tian Gao in :gh:" +"`74929`. Documentation updates provided by Guido van Rossum and Alyssa " +"Coghlan.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:474 +msgid "Support for mobile platforms" +msgstr "" + +#: ../../whatsnew/3.13.rst:476 +msgid "" +":pep:`730`: iOS is now a :pep:`11` supported platform, with the ``arm64-" +"apple-ios`` and ``arm64-apple-ios-simulator`` targets at tier 3 (iPhone and " +"iPad devices released after 2013 and the Xcode iOS simulator running on " +"Apple silicon hardware, respectively). ``x86_64-apple-ios-simulator`` (the " +"Xcode iOS simulator running on older ``x86_64`` hardware) is not a tier 3 " +"supported platform, but will have best-effort support. (PEP written and " +"implementation contributed by Russell Keith-Magee in :gh:`114099`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:486 +msgid "" +":pep:`738`: Android support is being actively worked on, but the platform is " +"not yet officially supported. (PEP written and implementation contributed by " +"Malcolm Smith in :gh:`116622`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:491 +msgid ":pep:`730`, :pep:`738`" +msgstr "" + +#: ../../whatsnew/3.13.rst:497 +msgid "Incremental garbage collection" +msgstr "" + +#: ../../whatsnew/3.13.rst:499 +msgid "" +"The cycle garbage collector is now incremental. This means that maximum " +"pause times are reduced by an order of magnitude or more for larger heaps." +msgstr "" + +#: ../../whatsnew/3.13.rst:503 +msgid "" +"There are now only two generations: young and old. When :func:`gc.collect` " +"is not called directly, the GC is invoked a little less frequently. When " +"invoked, it collects the young generation and an increment of the old " +"generation, instead of collecting one or more generations." +msgstr "" + +#: ../../whatsnew/3.13.rst:509 +msgid "The behavior of :func:`!gc.collect` changes slightly:" +msgstr "" + +#: ../../whatsnew/3.13.rst:511 +msgid "" +"``gc.collect(1)``: Performs an increment of GC, rather than collecting " +"generation 1." +msgstr "" + +#: ../../whatsnew/3.13.rst:513 +msgid "Other calls to :func:`!gc.collect` are unchanged." +msgstr "" + +#: ../../whatsnew/3.13.rst:515 +msgid "(Contributed by Mark Shannon in :gh:`108362`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:519 +msgid "Other Language Changes" +msgstr "" + +#: ../../whatsnew/3.13.rst:521 +msgid "" +"The compiler now strips common leading whitespace from every line in a " +"docstring. This reduces the size of the :term:`bytecode cache <bytecode>` " +"(such as ``.pyc`` files), with reductions in file size of around 5%, for " +"example in :mod:`!sqlalchemy.orm.session` from SQLAlchemy 2.0. This change " +"affects tools that use docstrings, such as :mod:`doctest`." +msgstr "" + +#: ../../whatsnew/3.13.rst:528 +msgid "" +">>> def spam():\n" +"... \"\"\"\n" +"... This is a docstring with\n" +"... leading whitespace.\n" +"...\n" +"... It even has multiple paragraphs!\n" +"... \"\"\"\n" +"...\n" +">>> spam.__doc__\n" +"'\\nThis is a docstring with\\n leading whitespace.\\n\\nIt even has " +"multiple paragraphs!\\n'" +msgstr "" + +#: ../../whatsnew/3.13.rst:541 +msgid "(Contributed by Inada Naoki in :gh:`81283`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:543 +msgid "" +":ref:`Annotation scopes <annotation-scopes>` within class scopes can now " +"contain lambdas and comprehensions. Comprehensions that are located within " +"class scopes are not inlined into their parent scope." +msgstr "" + +#: ../../whatsnew/3.13.rst:548 +msgid "" +"class C[T]:\n" +" type Alias = lambda: T" +msgstr "" + +#: ../../whatsnew/3.13.rst:553 +msgid "(Contributed by Jelle Zijlstra in :gh:`109118` and :gh:`118160`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:555 +msgid "" +":ref:`Future statements <future>` are no longer triggered by relative " +"imports of the :mod:`__future__` module, meaning that statements of the form " +"``from .__future__ import ...`` are now simply standard relative imports, " +"with no special features activated. (Contributed by Jeremiah Gabriel Pascual " +"in :gh:`118216`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:561 +msgid "" +":keyword:`global` declarations are now permitted in :keyword:`except` blocks " +"when that global is used in the :keyword:`else` block. Previously this " +"raised an erroneous :exc:`SyntaxError`. (Contributed by Irit Katriel in :gh:" +"`111123`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:566 +msgid "" +"Add :envvar:`PYTHON_FROZEN_MODULES`, a new environment variable that " +"determines whether frozen modules are ignored by the import machinery, " +"equivalent to the :option:`-X frozen_modules <-X>` command-line option. " +"(Contributed by Yilei Yang in :gh:`111374`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:571 +msgid "" +"Add :ref:`support for the perf profiler <perf_profiling>` working without " +"`frame pointers <https://en.wikipedia.org/wiki/Call_stack>`_ through the new " +"environment variable :envvar:`PYTHON_PERF_JIT_SUPPORT` and command-line " +"option :option:`-X perf_jit <-X>`. (Contributed by Pablo Galindo in :gh:" +"`118518`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:577 +msgid "" +"The location of a :file:`.python_history` file can be changed via the new :" +"envvar:`PYTHON_HISTORY` environment variable. (Contributed by Levi Sabah, " +"Zackery Spytz and Hugo van Kemenade in :gh:`73965`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:582 +msgid "" +"Classes have a new :attr:`~class.__static_attributes__` attribute. This is " +"populated by the compiler with a tuple of the class's attribute names which " +"are assigned through ``self.<name>`` from any function in its body. " +"(Contributed by Irit Katriel in :gh:`115775`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:587 +msgid "" +"The compiler now creates a :attr:`!__firstlineno__` attribute on classes " +"with the line number of the first line of the class definition. (Contributed " +"by Serhiy Storchaka in :gh:`118465`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:591 +msgid "" +"The :func:`exec` and :func:`eval` builtins now accept the *globals* and " +"*locals* arguments as keywords. (Contributed by Raphael Gaschignard in :gh:" +"`105879`)" +msgstr "" + +#: ../../whatsnew/3.13.rst:595 +msgid "" +"The :func:`compile` builtin now accepts a new flag, ``ast." +"PyCF_OPTIMIZED_AST``, which is similar to ``ast.PyCF_ONLY_AST`` except that " +"the returned AST is optimized according to the value of the *optimize* " +"argument. (Contributed by Irit Katriel in :gh:`108113`)." +msgstr "" + +#: ../../whatsnew/3.13.rst:601 +msgid "" +"Add :exc:`PythonFinalizationError`, a new exception derived from :exc:" +"`RuntimeError` and used to signal when operations are blocked during :term:" +"`finalization <interpreter shutdown>`. The following callables now raise :" +"exc:`!PythonFinalizationError`, instead of :exc:`RuntimeError`:" +msgstr "" + +#: ../../whatsnew/3.13.rst:607 +msgid ":func:`_thread.start_new_thread`" +msgstr "" + +#: ../../whatsnew/3.13.rst:608 +msgid ":func:`os.fork`" +msgstr "" + +#: ../../whatsnew/3.13.rst:609 +msgid ":func:`os.forkpty`" +msgstr "" + +#: ../../whatsnew/3.13.rst:610 +msgid ":class:`subprocess.Popen`" +msgstr "" + +#: ../../whatsnew/3.13.rst:612 +msgid "(Contributed by Victor Stinner in :gh:`114570`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:614 +msgid "" +"Allow the *count* argument of :meth:`str.replace` to be a keyword. " +"(Contributed by Hugo van Kemenade in :gh:`106487`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:617 +msgid "" +"Many functions now emit a warning if a boolean value is passed as a file " +"descriptor argument. This can help catch some errors earlier. (Contributed " +"by Serhiy Storchaka in :gh:`82626`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:622 +msgid "" +"Added :attr:`!name` and :attr:`!mode` attributes for compressed and archived " +"file-like objects in the :mod:`bz2`, :mod:`lzma`, :mod:`tarfile`, and :mod:" +"`zipfile` modules. (Contributed by Serhiy Storchaka in :gh:`115961`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:627 +msgid "" +"Add a :attr:`~property.__name__` attribute on :class:`property` objects. " +"(Contributed by Eugene Toder in :gh:`101860`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:632 +msgid "New Modules" +msgstr "" + +#: ../../whatsnew/3.13.rst:634 +msgid "" +":mod:`dbm.sqlite3`: An SQLite backend for :mod:`dbm`. (Contributed by " +"Raymond Hettinger and Erlend E. Aasland in :gh:`100414`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:639 +msgid "Improved Modules" +msgstr "" + +#: ../../whatsnew/3.13.rst:643 +msgid "argparse" +msgstr "" + +#: ../../whatsnew/3.13.rst:645 +msgid "" +"Add the *deprecated* parameter to the :meth:`~argparse.ArgumentParser." +"add_argument` and :meth:`!add_parser` methods, to enable deprecating command-" +"line options, positional arguments, and subcommands. (Contributed by Serhiy " +"Storchaka in :gh:`83648`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:653 +msgid "array" +msgstr "" + +#: ../../whatsnew/3.13.rst:655 +msgid "" +"Add the ``'w'`` type code (``Py_UCS4``) for Unicode characters. It should be " +"used instead of the deprecated ``'u'`` type code. (Contributed by Inada " +"Naoki in :gh:`80480`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:659 +msgid "" +"Register :class:`array.array` as a :class:`~collections.abc.MutableSequence` " +"by implementing the :meth:`~array.array.clear` method. (Contributed by Mike " +"Zimin in :gh:`114894`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:665 +msgid "ast" +msgstr "" + +#: ../../whatsnew/3.13.rst:667 +msgid "" +"The constructors of node types in the :mod:`ast` module are now stricter in " +"the arguments they accept, with more intuitive behaviour when arguments are " +"omitted." +msgstr "" + +#: ../../whatsnew/3.13.rst:671 +msgid "" +"If an optional field on an AST node is not included as an argument when " +"constructing an instance, the field will now be set to ``None``. Similarly, " +"if a list field is omitted, that field will now be set to an empty list, and " +"if an :class:`!expr_context` field is omitted, it defaults to :class:`Load() " +"<ast.Load>`. (Previously, in all cases, the attribute would be missing on " +"the newly constructed AST node instance.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:679 +msgid "" +"In all other cases, where a required argument is omitted, the node " +"constructor will emit a :exc:`DeprecationWarning`. This will raise an " +"exception in Python 3.15. Similarly, passing a keyword argument to the " +"constructor that does not map to a field on the AST node is now deprecated, " +"and will raise an exception in Python 3.15." +msgstr "" + +#: ../../whatsnew/3.13.rst:686 +msgid "" +"These changes do not apply to user-defined subclasses of :class:`ast.AST` " +"unless the class opts in to the new behavior by defining the :attr:`.AST." +"_field_types` mapping." +msgstr "" + +#: ../../whatsnew/3.13.rst:690 +msgid "" +"(Contributed by Jelle Zijlstra in :gh:`105858`, :gh:`117486`, and :gh:" +"`118851`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:692 +msgid "" +":func:`ast.parse` now accepts an optional argument *optimize* which is " +"passed on to :func:`compile`. This makes it possible to obtain an optimized " +"AST. (Contributed by Irit Katriel in :gh:`108113`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:699 +msgid "asyncio" +msgstr "" + +#: ../../whatsnew/3.13.rst:701 +msgid "" +":func:`asyncio.as_completed` now returns an object that is both an :term:" +"`asynchronous iterator` and a plain :term:`iterator` of :term:`awaitables " +"<awaitable>`. The awaitables yielded by asynchronous iteration include " +"original task or future objects that were passed in, making it easier to " +"associate results with the tasks being completed. (Contributed by Justin " +"Arthur in :gh:`77714`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:709 +msgid "" +":meth:`asyncio.loop.create_unix_server` will now automatically remove the " +"Unix socket when the server is closed. (Contributed by Pierre Ossman in :gh:" +"`111246`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:713 +msgid "" +":meth:`.DatagramTransport.sendto` will now send zero-length datagrams if " +"called with an empty bytes object. The transport flow control also now " +"accounts for the datagram header when calculating the buffer size. " +"(Contributed by Jamie Phan in :gh:`115199`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:719 +msgid "" +"Add :meth:`Queue.shutdown <asyncio.Queue.shutdown>` and :exc:`~asyncio." +"QueueShutDown` to manage queue termination. (Contributed by Laurie Opperman " +"and Yves Duprat in :gh:`104228`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:723 +msgid "" +"Add the :meth:`.Server.close_clients` and :meth:`.Server.abort_clients` " +"methods, which more forcefully close an asyncio server. (Contributed by " +"Pierre Ossman in :gh:`113538`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:727 +msgid "" +"Accept a tuple of separators in :meth:`.StreamReader.readuntil`, stopping " +"when any one of them is encountered. (Contributed by Bruce Merry in :gh:" +"`81322`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:731 +msgid "" +"Improve the behavior of :class:`~asyncio.TaskGroup` when an external " +"cancellation collides with an internal cancellation. For example, when two " +"task groups are nested and both experience an exception in a child task " +"simultaneously, it was possible that the outer task group would hang, " +"because its internal cancellation was swallowed by the inner task group." +msgstr "" + +#: ../../whatsnew/3.13.rst:738 +msgid "" +"In the case where a task group is cancelled externally and also must raise " +"an :exc:`ExceptionGroup`, it will now call the parent task's :meth:`~asyncio." +"Task.cancel` method. This ensures that a :exc:`~asyncio.CancelledError` will " +"be raised at the next :keyword:`await`, so the cancellation is not lost." +msgstr "" + +#: ../../whatsnew/3.13.rst:744 +msgid "" +"An added benefit of these changes is that task groups now preserve the " +"cancellation count (:meth:`~asyncio.Task.cancelling`)." +msgstr "" + +#: ../../whatsnew/3.13.rst:747 +msgid "" +"In order to handle some corner cases, :meth:`~asyncio.Task.uncancel` may now " +"reset the undocumented ``_must_cancel`` flag when the cancellation count " +"reaches zero." +msgstr "" + +#: ../../whatsnew/3.13.rst:751 +msgid "(Inspired by an issue reported by Arthur Tacca in :gh:`116720`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:753 +msgid "" +"When :meth:`.TaskGroup.create_task` is called on an inactive :class:" +"`~asyncio.TaskGroup`, the given coroutine will be closed (which prevents a :" +"exc:`RuntimeWarning` about the given coroutine being never awaited). " +"(Contributed by Arthur Tacca and Jason Zhang in :gh:`115957`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:761 +msgid "base64" +msgstr "" + +#: ../../whatsnew/3.13.rst:763 +msgid "" +"Add :func:`~base64.z85encode` and :func:`~base64.z85decode` functions for " +"encoding :class:`bytes` as `Z85 data`_ and decoding Z85-encoded data to :" +"class:`!bytes`. (Contributed by Matan Perelman in :gh:`75299`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:772 +msgid "compileall" +msgstr "" + +#: ../../whatsnew/3.13.rst:774 ../../whatsnew/3.13.rst:790 +#: ../../whatsnew/3.13.rst:1050 +msgid "" +"The default number of worker threads and processes is now selected using :" +"func:`os.process_cpu_count` instead of :func:`os.cpu_count`. (Contributed by " +"Victor Stinner in :gh:`109649`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:780 ../../whatsnew/3.13.rst:796 +#: ../../whatsnew/3.13.rst:1646 +msgid "configparser" +msgstr "" + +#: ../../whatsnew/3.13.rst:782 +msgid "" +"The :class:`configparser.ConfigParser` now accepts unnamed sections before " +"named ones if configured to do so. (Contributed by Pedro Sousa Lacerda in :" +"gh:`66449`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:788 +msgid "concurrent.futures" +msgstr "" + +#: ../../whatsnew/3.13.rst:798 +msgid "" +":class:`~configparser.ConfigParser` now has support for unnamed sections, " +"which allows for top-level key-value pairs. This can be enabled with the new " +"*allow_unnamed_section* parameter. (Contributed by Pedro Sousa Lacerda in :" +"gh:`66449`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:805 +msgid "copy" +msgstr "" + +#: ../../whatsnew/3.13.rst:807 +msgid "" +"The new :func:`~copy.replace` function and the :meth:`replace protocol " +"<object.__replace__>` make creating modified copies of objects much simpler. " +"This is especially useful when working with immutable objects. The following " +"types support the :func:`~copy.replace` function and implement the replace " +"protocol:" +msgstr "" + +#: ../../whatsnew/3.13.rst:813 +msgid ":func:`collections.namedtuple`" +msgstr "" + +#: ../../whatsnew/3.13.rst:814 +msgid ":class:`dataclasses.dataclass`" +msgstr "" + +#: ../../whatsnew/3.13.rst:815 +msgid "" +":class:`datetime.datetime`, :class:`datetime.date`, :class:`datetime.time`" +msgstr "" + +#: ../../whatsnew/3.13.rst:816 +msgid ":class:`inspect.Signature`, :class:`inspect.Parameter`" +msgstr "" + +#: ../../whatsnew/3.13.rst:817 +msgid ":class:`types.SimpleNamespace`" +msgstr "" + +#: ../../whatsnew/3.13.rst:818 +msgid ":ref:`code objects <code-objects>`" +msgstr "" + +#: ../../whatsnew/3.13.rst:820 +msgid "" +"Any user-defined class can also support :func:`copy.replace` by defining " +"the :meth:`~object.__replace__` method. (Contributed by Serhiy Storchaka in :" +"gh:`108751`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:826 +msgid "dbm" +msgstr "" + +#: ../../whatsnew/3.13.rst:828 +msgid "" +"Add :mod:`dbm.sqlite3`, a new module which implements an SQLite backend, and " +"make it the default :mod:`!dbm` backend. (Contributed by Raymond Hettinger " +"and Erlend E. Aasland in :gh:`100414`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:832 +msgid "" +"Allow removing all items from the database through the new :meth:`.gdbm." +"clear` and :meth:`.ndbm.clear` methods. (Contributed by Donghee Na in :gh:" +"`107122`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:838 +msgid "dis" +msgstr "" + +#: ../../whatsnew/3.13.rst:840 +msgid "" +"Change the output of :mod:`dis` module functions to show logical labels for " +"jump targets and exception handlers, rather than offsets. The offsets can be " +"added with the new :option:`-O <dis --show-offsets>` command-line option or " +"the *show_offsets* argument. (Contributed by Irit Katriel in :gh:`112137`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:847 +msgid "" +":meth:`~dis.get_instructions` no longer represents cache entries as separate " +"instructions. Instead, it returns them as part of the :class:`~dis." +"Instruction`, in the new *cache_info* field. The *show_caches* argument to :" +"meth:`~dis.get_instructions` is deprecated and no longer has any effect. " +"(Contributed by Irit Katriel in :gh:`112962`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:859 +msgid "doctest" +msgstr "" + +#: ../../whatsnew/3.13.rst:861 +msgid "" +":mod:`doctest` output is now colored by default. This can be controlled via " +"the new :envvar:`PYTHON_COLORS` environment variable as well as the " +"canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment variables. See also :" +"ref:`using-on-controlling-color`. (Contributed by Hugo van Kemenade in :gh:" +"`117225`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:868 +msgid "" +"The :meth:`.DocTestRunner.run` method now counts the number of skipped " +"tests. Add the :attr:`.DocTestRunner.skips` and :attr:`.TestResults.skipped` " +"attributes. (Contributed by Victor Stinner in :gh:`108794`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:874 +msgid "email" +msgstr "" + +#: ../../whatsnew/3.13.rst:876 +msgid "" +"Headers with embedded newlines are now quoted on output. The :mod:`~email." +"generator` will now refuse to serialize (write) headers that are improperly " +"folded or delimited, such that they would be parsed as multiple headers or " +"joined with adjacent data. If you need to turn this safety feature off, set :" +"attr:`~email.policy.Policy.verify_generated_headers`. (Contributed by Bas " +"Bloemsaat and Petr Viktorin in :gh:`121650`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:884 +msgid "" +":func:`~email.utils.getaddresses` and :func:`~email.utils.parseaddr` now " +"return ``('', '')`` pairs in more situations where invalid email addresses " +"are encountered instead of potentially inaccurate values. The two functions " +"have a new optional *strict* parameter (default ``True``). To get the old " +"behaviour (accepting malformed input), use ``strict=False``. ``getattr(email." +"utils, 'supports_strict_parsing', False)`` can be used to check if the " +"*strict* parameter is available. (Contributed by Thomas Dwyer and Victor " +"Stinner for :gh:`102988` to improve the :cve:`2023-27043` fix.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:896 +msgid "fractions" +msgstr "" + +#: ../../whatsnew/3.13.rst:898 +msgid "" +":class:`~fractions.Fraction` objects now support the standard :ref:`format " +"specification mini-language <formatspec>` rules for fill, alignment, sign " +"handling, minimum width, and grouping. (Contributed by Mark Dickinson in :gh:" +"`111320`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:905 +msgid "gc" +msgstr "" + +#: ../../whatsnew/3.13.rst:907 +msgid "" +"The cyclic garbage collector is now incremental, which changes the meaning " +"of the results of :meth:`~gc.get_threshold` and :meth:`~gc.set_threshold` as " +"well as :meth:`~gc.get_count` and :meth:`~gc.get_stats`." +msgstr "" + +#: ../../whatsnew/3.13.rst:912 +msgid "" +"For backwards compatibility, :meth:`~gc.get_threshold` continues to return a " +"three-item tuple. The first value is the threshold for young collections, as " +"before; the second value determines the rate at which the old collection is " +"scanned (the default is 10, and higher values mean that the old collection " +"is scanned more slowly). The third value is meaningless and is always zero." +msgstr "" + +#: ../../whatsnew/3.13.rst:920 +msgid ":meth:`~gc.set_threshold` ignores any items after the second." +msgstr "" + +#: ../../whatsnew/3.13.rst:922 +msgid "" +":meth:`~gc.get_count` and :meth:`~gc.get_stats` continue to return the same " +"format of results. The only difference is that instead of the results " +"referring to the young, aging and old generations, the results refer to the " +"young generation and the aging and collecting spaces of the old generation." +msgstr "" + +#: ../../whatsnew/3.13.rst:929 +msgid "" +"In summary, code that attempted to manipulate the behavior of the cycle GC " +"may not work exactly as intended, but it is very unlikely to be harmful. All " +"other code will work just fine." +msgstr "" + +#: ../../whatsnew/3.13.rst:935 +msgid "glob" +msgstr "" + +#: ../../whatsnew/3.13.rst:937 +msgid "" +"Add :func:`~glob.translate`, a function to convert a path specification with " +"shell-style wildcards to a regular expression. (Contributed by Barney Gale " +"in :gh:`72904`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:943 +msgid "importlib" +msgstr "" + +#: ../../whatsnew/3.13.rst:945 +msgid "" +"The following functions in :mod:`importlib.resources` now allow accessing a " +"directory (or tree) of resources, using multiple positional arguments (the " +"*encoding* and *errors* arguments in the text-reading functions are now " +"keyword-only):" +msgstr "" + +#: ../../whatsnew/3.13.rst:950 +msgid ":func:`~importlib.resources.is_resource`" +msgstr "" + +#: ../../whatsnew/3.13.rst:951 +msgid ":func:`~importlib.resources.open_binary`" +msgstr "" + +#: ../../whatsnew/3.13.rst:952 +msgid ":func:`~importlib.resources.open_text`" +msgstr "" + +#: ../../whatsnew/3.13.rst:953 +msgid ":func:`~importlib.resources.path`" +msgstr "" + +#: ../../whatsnew/3.13.rst:954 +msgid ":func:`~importlib.resources.read_binary`" +msgstr "" + +#: ../../whatsnew/3.13.rst:955 +msgid ":func:`~importlib.resources.read_text`" +msgstr "" + +#: ../../whatsnew/3.13.rst:957 +msgid "" +"These functions are no longer deprecated and are not scheduled for removal. " +"(Contributed by Petr Viktorin in :gh:`106532`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:960 +msgid "" +":func:`~importlib.resources.contents` remains deprecated in favor of the " +"fully-featured :class:`~importlib.resources.abc.Traversable` API. However, " +"there is now no plan to remove it. (Contributed by Petr Viktorin in :gh:" +"`106532`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:967 +msgid "io" +msgstr "" + +#: ../../whatsnew/3.13.rst:969 +msgid "" +"The :class:`~io.IOBase` finalizer now logs any errors raised by the :meth:" +"`~io.IOBase.close` method with :data:`sys.unraisablehook`. Previously, " +"errors were ignored silently by default, and only logged in :ref:`Python " +"Development Mode <devmode>` or when using a :ref:`Python debug build <debug-" +"build>`. (Contributed by Victor Stinner in :gh:`62948`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:978 +msgid "ipaddress" +msgstr "" + +#: ../../whatsnew/3.13.rst:980 +msgid "" +"Add the :attr:`.IPv4Address.ipv6_mapped` property, which returns the IPv4-" +"mapped IPv6 address. (Contributed by Charles Machalow in :gh:`109466`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:984 +msgid "" +"Fix ``is_global`` and ``is_private`` behavior in :class:`~ipaddress." +"IPv4Address`, :class:`~ipaddress.IPv6Address`, :class:`~ipaddress." +"IPv4Network`, and :class:`~ipaddress.IPv6Network`. (Contributed by Jakub " +"Stasiak in :gh:`113171`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:991 +msgid "itertools" +msgstr "" + +#: ../../whatsnew/3.13.rst:993 +msgid "" +":func:`~itertools.batched` has a new *strict* parameter, which raises a :exc:" +"`ValueError` if the final batch is shorter than the specified batch size. " +"(Contributed by Raymond Hettinger in :gh:`113202`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1000 +msgid "marshal" +msgstr "" + +#: ../../whatsnew/3.13.rst:1002 +msgid "" +"Add the *allow_code* parameter in module functions. Passing " +"``allow_code=False`` prevents serialization and de-serialization of code " +"objects which are incompatible between Python versions. (Contributed by " +"Serhiy Storchaka in :gh:`113626`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1009 +msgid "math" +msgstr "" + +#: ../../whatsnew/3.13.rst:1011 +msgid "" +"The new function :func:`~math.fma` performs fused multiply-add operations. " +"This computes ``x * y + z`` with only a single round, and so avoids any " +"intermediate loss of precision. It wraps the ``fma()`` function provided by " +"C99, and follows the specification of the IEEE 754 \"fusedMultiplyAdd\" " +"operation for special cases. (Contributed by Mark Dickinson and Victor " +"Stinner in :gh:`73468`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1021 +msgid "mimetypes" +msgstr "" + +#: ../../whatsnew/3.13.rst:1023 +msgid "" +"Add the :func:`~mimetypes.guess_file_type` function to guess a MIME type " +"from a filesystem path. Using paths with :func:`~mimetypes.guess_type` is " +"now :term:`soft deprecated`. (Contributed by Serhiy Storchaka in :gh:" +"`66543`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1030 +msgid "mmap" +msgstr "" + +#: ../../whatsnew/3.13.rst:1032 +msgid "" +":class:`~mmap.mmap` is now protected from crashing on Windows when the " +"mapped memory is inaccessible due to file system errors or access " +"violations. (Contributed by Jannis Weigend in :gh:`118209`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1036 +msgid "" +":class:`~mmap.mmap` has a new :meth:`~mmap.mmap.seekable` method that can be " +"used when a seekable file-like object is required. The :meth:`~mmap.mmap." +"seek` method now returns the new absolute position. (Contributed by Donghee " +"Na and Sylvie Liberman in :gh:`111835`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1041 +msgid "" +"The new UNIX-only *trackfd* parameter for :class:`~mmap.mmap` controls file " +"descriptor duplication; if false, the file descriptor specified by *fileno* " +"will not be duplicated. (Contributed by Zackery Spytz and Petr Viktorin in :" +"gh:`78502`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1048 +msgid "multiprocessing" +msgstr "" + +#: ../../whatsnew/3.13.rst:1056 +msgid "os" +msgstr "" + +#: ../../whatsnew/3.13.rst:1058 +msgid "" +"Add :func:`~os.process_cpu_count` function to get the number of logical CPU " +"cores usable by the calling thread of the current process. (Contributed by " +"Victor Stinner in :gh:`109649`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1062 +msgid "" +":func:`~os.cpu_count` and :func:`~os.process_cpu_count` can be overridden " +"through the new environment variable :envvar:`PYTHON_CPU_COUNT` or the new " +"command-line option :option:`-X cpu_count <-X>`. This option is useful for " +"users who need to limit CPU resources of a container system without having " +"to modify application code or the container itself. (Contributed by Donghee " +"Na in :gh:`109595`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1070 +msgid "" +"Add a :ref:`low level interface <os-timerfd>` to Linux's :manpage:`timer " +"file descriptors <timerfd_create(2)>` via :func:`~os.timerfd_create`, :func:" +"`~os.timerfd_settime`, :func:`~os.timerfd_settime_ns`, :func:`~os." +"timerfd_gettime`, :func:`~os.timerfd_gettime_ns`, :const:`~os." +"TFD_NONBLOCK`, :const:`~os.TFD_CLOEXEC`, :const:`~os.TFD_TIMER_ABSTIME`, " +"and :const:`~os.TFD_TIMER_CANCEL_ON_SET` (Contributed by Masaru Tsuchiyama " +"in :gh:`108277`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1079 +msgid "" +":func:`~os.lchmod` and the *follow_symlinks* argument of :func:`~os.chmod` " +"are both now available on Windows. Note that the default value of " +"*follow_symlinks* in :func:`!lchmod` is ``False`` on Windows. (Contributed " +"by Serhiy Storchaka in :gh:`59616`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1085 +msgid "" +":func:`~os.fchmod` and support for file descriptors in :func:`~os.chmod` are " +"both now available on Windows. (Contributed by Serhiy Storchaka in :gh:" +"`113191`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1089 +msgid "" +"On Windows, :func:`~os.mkdir` and :func:`~os.makedirs` now support passing a " +"*mode* value of ``0o700`` to apply access control to the new directory. This " +"implicitly affects :func:`tempfile.mkdtemp` and is a mitigation for :cve:" +"`2024-4030`. Other values for *mode* continue to be ignored. (Contributed by " +"Steve Dower in :gh:`118486`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1096 +msgid "" +":func:`~os.posix_spawn` now accepts ``None`` for the *env* argument, which " +"makes the newly spawned process use the current process environment. " +"(Contributed by Jakub Kulik in :gh:`113119`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1100 +msgid "" +":func:`~os.posix_spawn` can now use the :attr:`~os.POSIX_SPAWN_CLOSEFROM` " +"attribute in the *file_actions* parameter on platforms that support :c:func:" +"`!posix_spawn_file_actions_addclosefrom_np`. (Contributed by Jakub Kulik in :" +"gh:`113117`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1107 +msgid "os.path" +msgstr "" + +#: ../../whatsnew/3.13.rst:1109 +msgid "" +"Add :func:`~os.path.isreserved` to check if a path is reserved on the " +"current system. This function is only available on Windows. (Contributed by " +"Barney Gale in :gh:`88569`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1114 +msgid "" +"On Windows, :func:`~os.path.isabs` no longer considers paths starting with " +"exactly one slash (``\\`` or ``/``) to be absolute. (Contributed by Barney " +"Gale and Jon Foster in :gh:`44626`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1118 +msgid "" +":func:`~os.path.realpath` now resolves MS-DOS style file names even if the " +"file is not accessible. (Contributed by Moonsik Park in :gh:`82367`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1124 ../../whatsnew/3.13.rst:1686 +msgid "pathlib" +msgstr "" + +#: ../../whatsnew/3.13.rst:1126 +msgid "" +"Add :exc:`~pathlib.UnsupportedOperation`, which is raised instead of :exc:" +"`NotImplementedError` when a path operation isn't supported. (Contributed by " +"Barney Gale in :gh:`89812`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1130 +msgid "" +"Add a new constructor for creating :class:`~pathlib.Path` objects from " +"'file' URIs (``file:///``), :meth:`.Path.from_uri`. (Contributed by Barney " +"Gale in :gh:`107465`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1134 +msgid "" +"Add :meth:`.PurePath.full_match` for matching paths with shell-style " +"wildcards, including the recursive wildcard \"``**``\". (Contributed by " +"Barney Gale in :gh:`73435`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1138 +msgid "" +"Add the :attr:`.PurePath.parser` class attribute to store the implementation " +"of :mod:`os.path` used for low-level path parsing and joining. This will be " +"either :mod:`!posixpath` or :mod:`!ntpath`." +msgstr "" + +#: ../../whatsnew/3.13.rst:1143 +msgid "" +"Add *recurse_symlinks* keyword-only argument to :meth:`.Path.glob` and :meth:" +"`~pathlib.Path.rglob`. (Contributed by Barney Gale in :gh:`77609`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1147 +msgid "" +":meth:`.Path.glob` and :meth:`~pathlib.Path.rglob` now return files and " +"directories when given a pattern that ends with \"``**``\". Previously, only " +"directories were returned. (Contributed by Barney Gale in :gh:`70303`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1152 +msgid "" +"Add the *follow_symlinks* keyword-only argument to :meth:`Path.is_file " +"<pathlib.Path.is_file>`, :meth:`Path.is_dir <pathlib.Path.is_dir>`, :meth:`." +"Path.owner`, and :meth:`.Path.group`. (Contributed by Barney Gale in :gh:" +"`105793` and Kamil Turek in :gh:`107962`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1160 +msgid "pdb" +msgstr "" + +#: ../../whatsnew/3.13.rst:1162 +msgid "" +":func:`breakpoint` and :func:`~pdb.set_trace` now enter the debugger " +"immediately rather than on the next line of code to be executed. This change " +"prevents the debugger from breaking outside of the context when :func:`!" +"breakpoint` is positioned at the end of the context. (Contributed by Tian " +"Gao in :gh:`118579`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1168 +msgid "" +"``sys.path[0]`` is no longer replaced by the directory of the script being " +"debugged when :attr:`sys.flags.safe_path` is set. (Contributed by Tian Gao " +"and Christian Walther in :gh:`111762`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1172 +msgid "" +":mod:`zipapp` is now supported as a debugging target. (Contributed by Tian " +"Gao in :gh:`118501`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1175 +msgid "" +"Add ability to move between chained exceptions during post-mortem debugging " +"in :func:`~pdb.pm` using the new :pdbcmd:`exceptions [exc_number] " +"<exceptions>` command for Pdb. (Contributed by Matthias Bussonnier in :gh:" +"`106676`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1180 +msgid "" +"Expressions and statements whose prefix is a pdb command are now correctly " +"identified and executed. (Contributed by Tian Gao in :gh:`108464`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1186 +msgid "queue" +msgstr "" + +#: ../../whatsnew/3.13.rst:1188 +msgid "" +"Add :meth:`Queue.shutdown <queue.Queue.shutdown>` and :exc:`~queue.ShutDown` " +"to manage queue termination. (Contributed by Laurie Opperman and Yves Duprat " +"in :gh:`104750`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1194 +msgid "random" +msgstr "" + +#: ../../whatsnew/3.13.rst:1196 +msgid "" +"Add a :ref:`command-line interface <random-cli>`. (Contributed by Hugo van " +"Kemenade in :gh:`118131`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1201 ../../whatsnew/3.13.rst:1694 +msgid "re" +msgstr "" + +#: ../../whatsnew/3.13.rst:1203 +msgid "" +"Rename :exc:`!re.error` to :exc:`~re.PatternError` for improved clarity. :" +"exc:`!re.error` is kept for backward compatibility." +msgstr "" + +#: ../../whatsnew/3.13.rst:1208 +msgid "shutil" +msgstr "" + +#: ../../whatsnew/3.13.rst:1210 +msgid "" +"Support the *dir_fd* and *follow_symlinks* keyword arguments in :func:" +"`~shutil.chown`. (Contributed by Berker Peksag and Tahia K in :gh:`62308`)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1216 +msgid "site" +msgstr "" + +#: ../../whatsnew/3.13.rst:1218 +msgid "" +":file:`.pth` files are now decoded using UTF-8 first, and then with the :" +"term:`locale encoding` if UTF-8 decoding fails. (Contributed by Inada Naoki " +"in :gh:`117802`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1224 +msgid "sqlite3" +msgstr "" + +#: ../../whatsnew/3.13.rst:1226 +msgid "" +"A :exc:`ResourceWarning` is now emitted if a :class:`~sqlite3.Connection` " +"object is not :meth:`closed <sqlite3.Connection.close>` explicitly. " +"(Contributed by Erlend E. Aasland in :gh:`105539`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1230 +msgid "" +"Add the *filter* keyword-only parameter to :meth:`.Connection.iterdump` for " +"filtering database objects to dump. (Contributed by Mariusz Felisiak in :gh:" +"`91602`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1236 +msgid "ssl" +msgstr "" + +#: ../../whatsnew/3.13.rst:1238 +msgid "" +"The :func:`~ssl.create_default_context` API now includes :data:`~ssl." +"VERIFY_X509_PARTIAL_CHAIN` and :data:`~ssl.VERIFY_X509_STRICT` in its " +"default flags." +msgstr "" + +#: ../../whatsnew/3.13.rst:1244 +msgid "" +":data:`~ssl.VERIFY_X509_STRICT` may reject pre-:rfc:`5280` or malformed " +"certificates that the underlying OpenSSL implementation might otherwise " +"accept. Whilst disabling this is not recommended, you can do so using:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1249 +msgid "" +"import ssl\n" +"\n" +"ctx = ssl.create_default_context()\n" +"ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" +msgstr "" + +#: ../../whatsnew/3.13.rst:1256 +msgid "(Contributed by William Woodruff in :gh:`112389`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1260 +msgid "statistics" +msgstr "" + +#: ../../whatsnew/3.13.rst:1262 +msgid "" +"Add :func:`~statistics.kde` for kernel density estimation. This makes it " +"possible to estimate a continuous probability density function from a fixed " +"number of discrete samples. (Contributed by Raymond Hettinger in :gh:" +"`115863`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1267 +msgid "" +"Add :func:`~statistics.kde_random` for sampling from an estimated " +"probability density function created by :func:`~statistics.kde`. " +"(Contributed by Raymond Hettinger in :gh:`115863`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1275 +msgid "subprocess" +msgstr "" + +#: ../../whatsnew/3.13.rst:1277 +msgid "" +"The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " +"in more situations." +msgstr "" + +#: ../../whatsnew/3.13.rst:1280 +msgid "" +"Notably, when *close_fds* is ``True`` (the default), :func:`~os.posix_spawn` " +"will be used when the C library provides :c:func:`!" +"posix_spawn_file_actions_addclosefrom_np`, which includes recent versions of " +"Linux, FreeBSD, and Solaris. On Linux, this should perform similarly to the " +"existing Linux :c:func:`!vfork` based code." +msgstr "" + +#: ../../whatsnew/3.13.rst:1287 +msgid "" +"A private control knob :attr:`!subprocess._USE_POSIX_SPAWN` can be set to " +"``False`` if you need to force :mod:`subprocess` to never use :func:`~os." +"posix_spawn`. Please report your reason and platform details in the :ref:" +"`issue tracker <using-the-tracker>` if you set this so that we can improve " +"our API selection logic for everyone. (Contributed by Jakub Kulik in :gh:" +"`113117`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1297 +msgid "sys" +msgstr "" + +#: ../../whatsnew/3.13.rst:1299 +msgid "" +"Add the :func:`~sys._is_interned` function to test if a string was interned. " +"This function is not guaranteed to exist in all implementations of Python. " +"(Contributed by Serhiy Storchaka in :gh:`78573`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1305 +msgid "tempfile" +msgstr "" + +#: ../../whatsnew/3.13.rst:1307 +msgid "" +"On Windows, the default mode ``0o700`` used by :func:`tempfile.mkdtemp` now " +"limits access to the new directory due to changes to :func:`os.mkdir`. This " +"is a mitigation for :cve:`2024-4030`. (Contributed by Steve Dower in :gh:" +"`118486`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1314 +msgid "time" +msgstr "" + +#: ../../whatsnew/3.13.rst:1316 +msgid "" +"On Windows, :func:`~time.monotonic` now uses the " +"``QueryPerformanceCounter()`` clock for a resolution of 1 microsecond, " +"instead of the ``GetTickCount64()`` clock which has a resolution of 15.6 " +"milliseconds. (Contributed by Victor Stinner in :gh:`88494`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1322 +msgid "" +"On Windows, :func:`~time.time` now uses the " +"``GetSystemTimePreciseAsFileTime()`` clock for a resolution of 1 " +"microsecond, instead of the ``GetSystemTimeAsFileTime()`` clock which has a " +"resolution of 15.6 milliseconds. (Contributed by Victor Stinner in :gh:" +"`63207`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1330 +msgid "tkinter" +msgstr "" + +#: ../../whatsnew/3.13.rst:1332 +msgid "" +"Add :mod:`tkinter` widget methods: :meth:`!tk_busy_hold`, :meth:`!" +"tk_busy_configure`, :meth:`!tk_busy_cget`, :meth:`!tk_busy_forget`, :meth:`!" +"tk_busy_current`, and :meth:`!tk_busy_status`. (Contributed by Miguel, " +"klappnase and Serhiy Storchaka in :gh:`72684`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1338 +msgid "" +"The :mod:`tkinter` widget method :meth:`!wm_attributes` now accepts the " +"attribute name without the minus prefix to get window attributes, for " +"example ``w.wm_attributes('alpha')`` and allows specifying attributes and " +"values to set as keyword arguments, for example ``w." +"wm_attributes(alpha=0.5)``. (Contributed by Serhiy Storchaka in :gh:`43457`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1345 +msgid "" +":meth:`!wm_attributes` can now return attributes as a :class:`dict`, by " +"using the new optional keyword-only parameter *return_python_dict*. " +"(Contributed by Serhiy Storchaka in :gh:`43457`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1349 +msgid "" +":meth:`!Text.count` can now return a simple :class:`int` when the new " +"optional keyword-only parameter *return_ints* is used. Otherwise, the single " +"count is returned as a 1-tuple or ``None``. (Contributed by Serhiy Storchaka " +"in :gh:`97928`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1354 +msgid "" +"Support the \"vsapi\" element type in the :meth:`~tkinter.ttk.Style." +"element_create` method of :class:`tkinter.ttk.Style`. (Contributed by Serhiy " +"Storchaka in :gh:`68166`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1359 +msgid "" +"Add the :meth:`!after_info` method for Tkinter widgets. (Contributed by " +"Cheryl Sabella in :gh:`77020`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1362 +msgid "" +"Add a new :meth:`!copy_replace` method to :class:`!PhotoImage` to copy a " +"region from one image to another, possibly with pixel zooming, subsampling, " +"or both. (Contributed by Serhiy Storchaka in :gh:`118225`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1367 +msgid "" +"Add *from_coords* parameter to the :class:`!PhotoImage` methods :meth:`!" +"copy`, :meth:`!zoom` and :meth:`!subsample`. Add *zoom* and *subsample* " +"parameters to the :class:`!PhotoImage` method :meth:`!copy`. (Contributed by " +"Serhiy Storchaka in :gh:`118225`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1373 +msgid "" +"Add the :class:`!PhotoImage` methods :meth:`!read` to read an image from a " +"file and :meth:`!data` to get the image data. Add *background* and " +"*grayscale* parameters to the :meth:`!write` method. (Contributed by Serhiy " +"Storchaka in :gh:`118271`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1381 +msgid "traceback" +msgstr "" + +#: ../../whatsnew/3.13.rst:1383 +msgid "" +"Add the :attr:`~traceback.TracebackException.exc_type_str` attribute to :" +"class:`~traceback.TracebackException`, which holds a string display of the " +"*exc_type*. Deprecate the :attr:`~traceback.TracebackException.exc_type` " +"attribute, which holds the type object itself. Add parameter *save_exc_type* " +"(default ``True``) to indicate whether ``exc_type`` should be saved. " +"(Contributed by Irit Katriel in :gh:`112332`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1392 +msgid "" +"Add a new *show_group* keyword-only parameter to :meth:`.TracebackException." +"format_exception_only` to (recursively) format the nested exceptions of a :" +"exc:`BaseExceptionGroup` instance. (Contributed by Irit Katriel in :gh:" +"`105292`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1399 +msgid "types" +msgstr "" + +#: ../../whatsnew/3.13.rst:1401 +msgid "" +":class:`~types.SimpleNamespace` can now take a single positional argument to " +"initialise the namespace's arguments. This argument must either be a mapping " +"or an iterable of key-value pairs. (Contributed by Serhiy Storchaka in :gh:" +"`108191`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1408 ../../whatsnew/3.13.rst:1719 +msgid "typing" +msgstr "" + +#: ../../whatsnew/3.13.rst:1410 +msgid "" +":pep:`705`: Add :data:`~typing.ReadOnly`, a special typing construct to mark " +"a :class:`~typing.TypedDict` item as read-only for type checkers." +msgstr "" + +#: ../../whatsnew/3.13.rst:1413 +msgid "" +":pep:`742`: Add :data:`~typing.TypeIs`, a typing construct that can be used " +"to instruct a type checker how to narrow a type." +msgstr "" + +#: ../../whatsnew/3.13.rst:1416 +msgid "" +"Add :data:`~typing.NoDefault`, a sentinel object used to represent the " +"defaults of some parameters in the :mod:`typing` module. (Contributed by " +"Jelle Zijlstra in :gh:`116126`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1420 +msgid "" +"Add :func:`~typing.get_protocol_members` to return the set of members " +"defining a :class:`typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:" +"`104873`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1424 +msgid "" +"Add :func:`~typing.is_protocol` to check whether a class is a :class:" +"`~typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:`104873`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1428 +msgid "" +":data:`~typing.ClassVar` can now be nested in :data:`~typing.Final`, and " +"vice versa. (Contributed by Mehdi Drissi in :gh:`89547`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1434 +msgid "unicodedata" +msgstr "" + +#: ../../whatsnew/3.13.rst:1436 +msgid "" +"Update the Unicode database to `version 15.1.0`__. (Contributed by James " +"Gerity in :gh:`109559`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1443 +msgid "venv" +msgstr "" + +#: ../../whatsnew/3.13.rst:1445 +msgid "" +"Add support for creating source control management (SCM) ignore files in a " +"virtual environment's directory. By default, Git is supported. This is " +"implemented as opt-in via the API, which can be extended to support other " +"SCMs (:class:`~venv.EnvBuilder` and :func:`~venv.create`), and opt-out via " +"the CLI, using :option:`!--without-scm-ignore-files`. (Contributed by Brett " +"Cannon in :gh:`108125`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1456 +msgid "warnings" +msgstr "" + +#: ../../whatsnew/3.13.rst:1458 +msgid "" +":pep:`702`: The new :func:`warnings.deprecated` decorator provides a way to " +"communicate deprecations to a :term:`static type checker` and to warn on " +"usage of deprecated classes and functions. A :exc:`DeprecationWarning` may " +"also be emitted when a decorated function or class is used at runtime. " +"(Contributed by Jelle Zijlstra in :gh:`104003`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1467 +msgid "xml" +msgstr "" + +#: ../../whatsnew/3.13.rst:1469 +msgid "" +"Allow controlling Expat >=2.6.0 reparse deferral (:cve:`2023-52425`) by " +"adding five new methods:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1472 +msgid ":meth:`xml.etree.ElementTree.XMLParser.flush`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1473 +msgid ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1474 +msgid ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1475 +msgid ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1476 +msgid ":meth:`!xml.sax.expatreader.ExpatParser.flush`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1478 +msgid "(Contributed by Sebastian Pipping in :gh:`115623`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1480 +msgid "" +"Add the :meth:`!close` method for the iterator returned by :func:`~xml.etree." +"ElementTree.iterparse` for explicit cleanup. (Contributed by Serhiy " +"Storchaka in :gh:`69893`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1486 +msgid "zipimport" +msgstr "" + +#: ../../whatsnew/3.13.rst:1488 +msgid "" +"Add support for ZIP64_ format files. Everybody loves huge data, right? " +"(Contributed by Tim Hatch in :gh:`94146`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1496 +msgid "Optimizations" +msgstr "" + +#: ../../whatsnew/3.13.rst:1498 +msgid "" +"The new :ref:`incremental garbage collector <whatsnew313-incremental-gc>` " +"means that maximum pause times are reduced by an order of magnitude or more " +"for larger heaps. (Contributed by Mark Shannon in :gh:`108362`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1503 +msgid "" +"Several standard library modules have had their import times significantly " +"improved. For example, the import time of the :mod:`typing` module has been " +"reduced by around a third by removing dependencies on :mod:`re` and :mod:" +"`contextlib`. Other modules to enjoy import-time speedups include :mod:" +"`email.utils`, :mod:`enum`, :mod:`functools`, :mod:`importlib.metadata`, " +"and :mod:`threading`. (Contributed by Alex Waygood, Shantanu Jain, Adam " +"Turner, Daniel Hollas, and others in :gh:`109653`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1514 +msgid "" +":func:`textwrap.indent` is now around 30% faster than before for large " +"input. (Contributed by Inada Naoki in :gh:`107369`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1517 +msgid "" +"The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " +"in more situations, including when *close_fds* is ``True`` (the default) on " +"many modern platforms. This should provide a notable performance increase " +"when launching processes on FreeBSD and Solaris. See the :ref:`subprocess " +"<whatsnew313-subprocess>` section above for details. (Contributed by Jakub " +"Kulik in :gh:`113117`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1527 +msgid "Removed Modules And APIs" +msgstr "" + +#: ../../whatsnew/3.13.rst:1533 +msgid "PEP 594: Remove \"dead batteries\" from the standard library" +msgstr "" + +#: ../../whatsnew/3.13.rst:1535 +msgid "" +":pep:`594` proposed removing 19 modules from the standard library, " +"colloquially referred to as 'dead batteries' due to their historic, " +"obsolete, or insecure status. All of the following modules were deprecated " +"in Python 3.11, and are now removed:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1541 +msgid ":mod:`!aifc`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1542 +msgid ":mod:`!audioop`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1543 +msgid ":mod:`!chunk`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1544 +msgid ":mod:`!cgi` and :mod:`!cgitb`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1546 +msgid "" +":class:`!cgi.FieldStorage` can typically be replaced with :func:`urllib." +"parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." +"message` module or the :pypi:`multipart` library for ``POST`` and ``PUT`` " +"requests." +msgstr "" + +#: ../../whatsnew/3.13.rst:1551 +msgid "" +":func:`!cgi.parse` can be replaced by calling :func:`urllib.parse.parse_qs` " +"directly on the desired query string, unless the input is ``multipart/form-" +"data``, which should be replaced as described below for :func:`!cgi." +"parse_multipart`." +msgstr "" + +#: ../../whatsnew/3.13.rst:1556 +msgid "" +":func:`!cgi.parse_header` can be replaced with the functionality in the :mod:" +"`email` package, which implements the same MIME RFCs. For example, with :" +"class:`email.message.EmailMessage`:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1560 +msgid "" +"from email.message import EmailMessage\n" +"\n" +"msg = EmailMessage()\n" +"msg['content-type'] = 'application/json; charset=\"utf8\"'\n" +"main, params = msg.get_content_type(), msg['content-type'].params" +msgstr "" + +#: ../../whatsnew/3.13.rst:1568 +msgid "" +":func:`!cgi.parse_multipart` can be replaced with the functionality in the :" +"mod:`email` package, which implements the same MIME RFCs, or with the :pypi:" +"`multipart` library. For example, the :class:`email.message.EmailMessage` " +"and :class:`email.message.Message` classes." +msgstr "" + +#: ../../whatsnew/3.13.rst:1574 +msgid "" +":mod:`!crypt` and the private :mod:`!_crypt` extension. The :mod:`hashlib` " +"module may be an appropriate replacement when simply hashing a value is " +"required. Otherwise, various third-party libraries on PyPI are available:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1579 +msgid "" +":pypi:`bcrypt`: Modern password hashing for your software and your servers." +msgstr "" + +#: ../../whatsnew/3.13.rst:1581 +msgid "" +":pypi:`passlib`: Comprehensive password hashing framework supporting over 30 " +"schemes." +msgstr "" + +#: ../../whatsnew/3.13.rst:1583 +msgid ":pypi:`argon2-cffi`: The secure Argon2 password hashing algorithm." +msgstr "" + +#: ../../whatsnew/3.13.rst:1585 +msgid "" +":pypi:`legacycrypt`: :mod:`ctypes` wrapper to the POSIX crypt library call " +"and associated functionality." +msgstr "" + +#: ../../whatsnew/3.13.rst:1588 +msgid "" +":pypi:`crypt_r`: Fork of the :mod:`!crypt` module, wrapper to the :manpage:" +"`crypt_r(3)` library call and associated functionality." +msgstr "" + +#: ../../whatsnew/3.13.rst:1593 +msgid "" +":mod:`!imghdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" +"magic` libraries should be used as replacements. For example, the :func:`!" +"puremagic.what` function can be used to replace the :func:`!imghdr.what` " +"function for all file formats that were supported by :mod:`!imghdr`." +msgstr "" + +#: ../../whatsnew/3.13.rst:1599 +msgid ":mod:`!mailcap`: Use the :mod:`mimetypes` module instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:1601 +msgid ":mod:`!msilib`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1602 +msgid ":mod:`!nis`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1603 +msgid ":mod:`!nntplib`: Use the :pypi:`nntplib` library from PyPI instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:1605 +msgid "" +":mod:`!ossaudiodev`: For audio playback, use the :pypi:`pygame` library from " +"PyPI instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:1607 +msgid ":mod:`!pipes`: Use the :mod:`subprocess` module instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:1609 +msgid "" +":mod:`!sndhdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" +"magic` libraries should be used as replacements." +msgstr "" + +#: ../../whatsnew/3.13.rst:1612 +msgid ":mod:`!spwd`: Use the :pypi:`python-pam` library from PyPI instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:1614 +msgid ":mod:`!sunau`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1615 +msgid "" +":mod:`!telnetlib`, Use the :pypi:`telnetlib3` or :pypi:`Exscript` libraries " +"from PyPI instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:1617 +msgid "" +":mod:`!uu`: Use the :mod:`base64` module instead, as a modern alternative." +msgstr "" + +#: ../../whatsnew/3.13.rst:1619 +msgid ":mod:`!xdrlib`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1621 +msgid "" +"(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` and :gh:" +"`104780`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1625 +msgid "2to3" +msgstr "" + +#: ../../whatsnew/3.13.rst:1627 +msgid "" +"Remove the :program:`2to3` program and the :mod:`!lib2to3` module, " +"previously deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:" +"`104780`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1633 +msgid "builtins" +msgstr "" + +#: ../../whatsnew/3.13.rst:1635 +msgid "" +"Remove support for chained :class:`classmethod` descriptors (introduced in :" +"gh:`63272`). These can no longer be used to wrap other descriptors, such as :" +"class:`property`. The core design of this feature was flawed and led to " +"several problems. To \"pass-through\" a :class:`classmethod`, consider using " +"the :attr:`!__wrapped__` attribute that was added in Python 3.10. " +"(Contributed by Raymond Hettinger in :gh:`89519`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1648 +msgid "" +"Remove the undocumented :class:`!LegacyInterpolation` class, deprecated in " +"the docstring since Python 3.2, and at runtime since Python 3.11. " +"(Contributed by Hugo van Kemenade in :gh:`104886`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1655 +msgid "importlib.metadata" +msgstr "" + +#: ../../whatsnew/3.13.rst:1657 +msgid "" +"Remove deprecated subscript (:meth:`~object.__getitem__`) access for :ref:" +"`EntryPoint <entry-points>` objects. (Contributed by Jason R. Coombs in :gh:" +"`113175`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1663 +msgid "locale" +msgstr "" + +#: ../../whatsnew/3.13.rst:1665 +msgid "" +"Remove the :func:`!locale.resetlocale` function, deprecated in Python 3.11. " +"Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. (Contributed by " +"Victor Stinner in :gh:`104783`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1671 +msgid "opcode" +msgstr "" + +#: ../../whatsnew/3.13.rst:1673 +msgid "" +"Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!_opcode." +"ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " +"documented, and is not intended for external use. (Contributed by Irit " +"Katriel in :gh:`105481`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1678 +msgid "" +"Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, and :" +"attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but were " +"neither documented nor exposed through :mod:`dis`, and were not intended to " +"be used externally. (Contributed by Irit Katriel in :gh:`105481`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1688 +msgid "" +"Remove the ability to use :class:`~pathlib.Path` objects as context " +"managers. This functionality was deprecated and has had no effect since " +"Python 3.9. (Contributed by Barney Gale in :gh:`83863`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1696 +msgid "" +"Remove the undocumented, deprecated, and broken :func:`!re.template` " +"function and :attr:`!re.TEMPLATE` / :attr:`!re.T` flag. (Contributed by " +"Serhiy Storchaka and Nikita Sobolev in :gh:`105687`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1702 +msgid "tkinter.tix" +msgstr "" + +#: ../../whatsnew/3.13.rst:1704 +msgid "" +"Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6. The third-" +"party Tix library which the module wrapped is unmaintained. (Contributed by " +"Zachary Ware in :gh:`75552`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1710 +msgid "turtle" +msgstr "" + +#: ../../whatsnew/3.13.rst:1712 +msgid "" +"Remove the :meth:`!RawTurtle.settiltangle` method, deprecated in the " +"documentation since Python 3.1 and at runtime since Python 3.11. " +"(Contributed by Hugo van Kemenade in :gh:`104876`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1721 +msgid "" +"Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces, deprecated " +"since Python 3.8. The items in those namespaces can be imported directly " +"from the :mod:`typing` module. (Contributed by Sebastian Rittau in :gh:" +"`92871`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1727 +msgid "" +"Remove the keyword-argument method of creating :class:`~typing.TypedDict` " +"types, deprecated in Python 3.11. (Contributed by Tomas Roun in :gh:" +"`104786`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1733 +msgid "unittest" +msgstr "" + +#: ../../whatsnew/3.13.rst:1735 +msgid "" +"Remove the following :mod:`unittest` functions, deprecated in Python 3.11:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1737 +msgid ":func:`!unittest.findTestCases`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1738 +msgid ":func:`!unittest.makeSuite`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1739 +msgid ":func:`!unittest.getTestCaseNames`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1741 +msgid "Use :class:`~unittest.TestLoader` methods instead:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1743 +msgid ":meth:`~unittest.TestLoader.loadTestsFromModule`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1744 +msgid ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1745 +msgid ":meth:`~unittest.TestLoader.getTestCaseNames`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1747 +msgid "(Contributed by Hugo van Kemenade in :gh:`104835`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1749 +msgid "" +"Remove the untested and undocumented :meth:`!TestProgram.usageExit` method, " +"deprecated in Python 3.11. (Contributed by Hugo van Kemenade in :gh:" +"`104992`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1755 +msgid "urllib" +msgstr "" + +#: ../../whatsnew/3.13.rst:1757 +msgid "" +"Remove the *cafile*, *capath*, and *cadefault* parameters of the :func:" +"`urllib.request.urlopen` function, deprecated in Python 3.6. Use the " +"*context* parameter instead with an :class:`~ssl.SSLContext` instance. The :" +"meth:`ssl.SSLContext.load_cert_chain` function can be used to load specific " +"certificates, or let :func:`ssl.create_default_context` select the operating " +"system's trusted certificate authority (CA) certificates. (Contributed by " +"Victor Stinner in :gh:`105382`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1768 +msgid "webbrowser" +msgstr "" + +#: ../../whatsnew/3.13.rst:1770 +msgid "" +"Remove the untested and undocumented :class:`!MacOSX` class, deprecated in " +"Python 3.11. Use the :class:`!MacOSXOSAScript` class (introduced in Python " +"3.2) instead. (Contributed by Hugo van Kemenade in :gh:`104804`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1775 +msgid "" +"Remove the deprecated :attr:`!MacOSXOSAScript._name` attribute. Use the :" +"attr:`MacOSXOSAScript.name <webbrowser.controller.name>` attribute instead. " +"(Contributed by Nikita Sobolev in :gh:`105546`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1782 +msgid "New Deprecations" +msgstr "" + +#: ../../whatsnew/3.13.rst:1784 +msgid "" +":mod:`array`: :mod:`array`'s ``'u'`` format code, deprecated in docs since " +"Python 3.3, emits :exc:`DeprecationWarning` since 3.13 and will be removed " +"in Python 3.16. Use the ``'w'`` format code instead. (Contributed by Hugo " +"van Kemenade in :gh:`80480`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1790 +msgid "" +":mod:`ctypes`: Deprecate undocumented :func:`!ctypes.SetPointerType` " +"function. :term:`Soft-deprecate <soft deprecated>` the :func:`ctypes.ARRAY` " +"function in favor of multiplication. (Contributed by Victor Stinner in :gh:" +"`105733`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1795 +msgid "" +":mod:`decimal`: Deprecate non-standard format specifier \"N\" for :class:" +"`decimal.Decimal`. It was not documented and only supported in the C " +"implementation. (Contributed by Serhiy Storchaka in :gh:`89902`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1800 +msgid "" +":mod:`dis`: The ``dis.HAVE_ARGUMENT`` separator is deprecated. Check " +"membership in :data:`~dis.hasarg` instead. (Contributed by Irit Katriel in :" +"gh:`109319`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1804 +msgid "" +":ref:`frame-objects`: Calling :meth:`frame.clear` on a suspended frame " +"raises :exc:`RuntimeError` (as has always been the case for an executing " +"frame). (Contributed by Irit Katriel in :gh:`79932`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1809 +msgid "" +":mod:`getopt` and :mod:`optparse` modules: They are now :term:`soft " +"deprecated`: the :mod:`argparse` module should be used for new projects. " +"Previously, the :mod:`optparse` module was already deprecated, its removal " +"was not scheduled, and no warnings was emitted: so there is no change in " +"practice. (Contributed by Victor Stinner in :gh:`106535`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1816 +msgid "" +":mod:`gettext`: Emit deprecation warning for non-integer numbers in :mod:" +"`gettext` functions and methods that consider plural forms even if the " +"translation was not found. (Contributed by Serhiy Storchaka in :gh:`88434`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1821 +msgid "" +":mod:`glob`: The undocumented :func:`!glob.glob0` and :func:`!glob.glob1` " +"functions are deprecated. Use :func:`glob.glob` and pass a directory to its " +"*root_dir* argument instead. (Contributed by Barney Gale in :gh:`117337`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1826 +msgid "" +":mod:`http.server`: :class:`http.server.CGIHTTPRequestHandler` now emits a :" +"exc:`DeprecationWarning` as it will be removed in 3.15. Process-based CGI " +"HTTP servers have been out of favor for a very long time. This code was " +"outdated, unmaintained, and rarely used. It has a high potential for both " +"security and functionality bugs. This includes removal of the ``--cgi`` " +"flag to the ``python -m http.server`` command line in 3.15." +msgstr "" + +#: ../../whatsnew/3.13.rst:1833 +msgid "" +":mod:`mimetypes`: Passing file path instead of URL in :func:`~mimetypes." +"guess_type` is :term:`soft deprecated`. Use :func:`~mimetypes." +"guess_file_type` instead. (Contributed by Serhiy Storchaka in :gh:`66543`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1837 +msgid "" +":mod:`re`: Passing optional arguments *maxsplit*, *count* and *flags* in " +"module-level functions :func:`re.split`, :func:`re.sub` and :func:`re.subn` " +"as positional arguments is now deprecated. In future Python versions these " +"parameters will be :ref:`keyword-only <keyword-only_parameter>`. " +"(Contributed by Serhiy Storchaka in :gh:`56166`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1843 +#: ../../deprecations/pending-removal-in-3.15.rst:16 +msgid "" +":mod:`pathlib`: :meth:`pathlib.PurePath.is_reserved` is deprecated and " +"scheduled for removal in Python 3.15. Use :func:`os.path.isreserved` to " +"detect reserved paths on Windows." +msgstr "" + +#: ../../whatsnew/3.13.rst:1848 +#: ../../deprecations/pending-removal-in-3.15.rst:21 +msgid "" +":mod:`platform`: :func:`~platform.java_ver` is deprecated and will be " +"removed in 3.15. It was largely untested, had a confusing API, and was only " +"useful for Jython support. (Contributed by Nikita Sobolev in :gh:`116349`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1854 +msgid "" +":mod:`pydoc`: Deprecate undocumented :func:`!pydoc.ispackage` function. " +"(Contributed by Zackery Spytz in :gh:`64020`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1857 +msgid "" +":mod:`sqlite3`: Passing more than one positional argument to :func:`sqlite3." +"connect` and the :class:`sqlite3.Connection` constructor is deprecated. The " +"remaining parameters will become keyword-only in Python 3.15." +msgstr "" + +#: ../../whatsnew/3.13.rst:1861 +msgid "" +"Deprecate passing name, number of arguments, and the callable as keyword " +"arguments for the following :class:`sqlite3.Connection` APIs:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1864 +msgid ":meth:`~sqlite3.Connection.create_function`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1865 +msgid ":meth:`~sqlite3.Connection.create_aggregate`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1867 +msgid "" +"Deprecate passing the callback callable by keyword for the following :class:" +"`sqlite3.Connection` APIs:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1870 +msgid ":meth:`~sqlite3.Connection.set_authorizer`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1871 +msgid ":meth:`~sqlite3.Connection.set_progress_handler`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1872 +msgid ":meth:`~sqlite3.Connection.set_trace_callback`" +msgstr "" + +#: ../../whatsnew/3.13.rst:1874 +msgid "The affected parameters will become positional-only in Python 3.15." +msgstr "" + +#: ../../whatsnew/3.13.rst:1876 +msgid "(Contributed by Erlend E. Aasland in :gh:`107948` and :gh:`108278`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1878 +msgid "" +":mod:`sys`: The :func:`sys._enablelegacywindowsfsencoding` function is " +"deprecated. Replace it with the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable. (Contributed by Inada Naoki in :gh:`73427`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1882 +msgid "" +":mod:`tarfile`: The undocumented and unused ``tarfile`` attribute of :class:" +"`tarfile.TarFile` is deprecated and scheduled for removal in Python 3.16." +msgstr "" + +#: ../../whatsnew/3.13.rst:1886 +msgid "" +":mod:`traceback`: The field *exc_type* of :class:`traceback." +"TracebackException` is deprecated. Use *exc_type_str* instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:1889 +msgid ":mod:`typing`:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1891 +msgid "" +"Creating a :class:`typing.NamedTuple` class using keyword arguments to " +"denote the fields (``NT = NamedTuple(\"NT\", x=int, y=int)``) is deprecated, " +"and will be disallowed in Python 3.15. Use the class-based syntax or the " +"functional syntax instead. (Contributed by Alex Waygood in :gh:`105566`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1896 +msgid "" +"When using the functional syntax to create a :class:`typing.NamedTuple` " +"class or a :class:`typing.TypedDict` class, failing to pass a value to the " +"'fields' parameter (``NT = NamedTuple(\"NT\")`` or ``TD = " +"TypedDict(\"TD\")``) is deprecated. Passing ``None`` to the 'fields' " +"parameter (``NT = NamedTuple(\"NT\", None)`` or ``TD = TypedDict(\"TD\", " +"None)``) is also deprecated. Both will be disallowed in Python 3.15. To " +"create a NamedTuple class with zero fields, use ``class NT(NamedTuple): " +"pass`` or ``NT = NamedTuple(\"NT\", [])``. To create a TypedDict class with " +"zero fields, use ``class TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", " +"{})``. (Contributed by Alex Waygood in :gh:`105566` and :gh:`105570`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1907 +msgid "" +":func:`typing.no_type_check_decorator` is deprecated, and scheduled for " +"removal in Python 3.15. After eight years in the :mod:`typing` module, it " +"has yet to be supported by any major type checkers. (Contributed by Alex " +"Waygood in :gh:`106309`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1912 +msgid "" +":data:`typing.AnyStr` is deprecated. In Python 3.16, it will be removed from " +"``typing.__all__``, and a :exc:`DeprecationWarning` will be emitted when it " +"is imported or accessed. It will be removed entirely in Python 3.18. Use the " +"new :ref:`type parameter syntax <type-params>` instead. (Contributed by " +"Michael The in :gh:`107116`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1918 +msgid "" +":ref:`user-defined-funcs`: Assignment to a function's :attr:`~function." +"__code__` attribute where the new code object's type does not match the " +"function's type is deprecated. The different types are: plain function, " +"generator, async generator and coroutine. (Contributed by Irit Katriel in :" +"gh:`81137`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1925 +#: ../../deprecations/pending-removal-in-3.15.rst:54 +msgid "" +":mod:`wave`: Deprecate the ``getmark()``, ``setmark()`` and ``getmarkers()`` " +"methods of the :class:`wave.Wave_read` and :class:`wave.Wave_write` classes. " +"They will be removed in Python 3.15. (Contributed by Victor Stinner in :gh:" +"`105096`.)" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:2 +#: ../../deprecations/pending-removal-in-3.14.rst:2 +msgid "Pending Removal in Python 3.14" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:4 +msgid "" +":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" +"argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " +"(Contributed by Nikita Sobolev in :gh:`92248`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:9 +msgid "" +":mod:`ast`: The following features have been deprecated in documentation " +"since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " +"runtime when they are accessed or used, and will be removed in Python 3.14:" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:13 +msgid ":class:`!ast.Num`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:14 +msgid ":class:`!ast.Str`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:15 +msgid ":class:`!ast.Bytes`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:16 +msgid ":class:`!ast.NameConstant`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:17 +msgid ":class:`!ast.Ellipsis`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:19 +msgid "" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" +"`90953`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:22 +msgid ":mod:`asyncio`:" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:24 +msgid "" +"The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" +"`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" +"class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " +"Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:30 +msgid "" +":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" +"`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." +"AbstractEventLoopPolicy.get_child_watcher` are deprecated and will be " +"removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:36 +msgid "" +"The :meth:`~asyncio.get_event_loop` method of the default event loop policy " +"now emits a :exc:`DeprecationWarning` if there is no current event loop set " +"and it decides to create one. (Contributed by Serhiy Storchaka and Guido van " +"Rossum in :gh:`100160`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:41 +msgid "" +":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " +"Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " +"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." +"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:47 +msgid "" +":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:50 +msgid "" +":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " +"taken into consideration by the import system (:gh:`97879`)." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:53 +msgid ":mod:`importlib.abc` deprecated classes:" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:55 +msgid ":class:`!importlib.abc.ResourceReader`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:56 +msgid ":class:`!importlib.abc.Traversable`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:57 +msgid ":class:`!importlib.abc.TraversableResources`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:59 +msgid "Use :mod:`importlib.resources.abc` classes instead:" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:61 +msgid ":class:`importlib.resources.abc.Traversable`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:62 +msgid ":class:`importlib.resources.abc.TraversableResources`" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:64 +msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:66 +msgid "" +":mod:`itertools` had undocumented, inefficient, historically buggy, and " +"inconsistent support for copy, deepcopy, and pickle operations. This will be " +"removed in 3.14 for a significant reduction in code volume and maintenance " +"burden. (Contributed by Raymond Hettinger in :gh:`101588`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:72 +msgid "" +":mod:`multiprocessing`: The default start method will change to a safer one " +"on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " +"currently the default (:gh:`84559`). Adding a runtime warning about this was " +"deemed too disruptive as the majority of code is not expected to care. Use " +"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." +"set_start_method` APIs to explicitly specify when your code *requires* " +"``'fork'``. See :ref:`multiprocessing-start-methods`." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:80 +msgid "" +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." +"PurePath.relative_to`: passing additional arguments is deprecated." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:84 +msgid "" +":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " +"now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " +"instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:89 +msgid ":mod:`pty`:" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:91 +msgid "``master_open()``: use :func:`pty.openpty`." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:92 +msgid "``slave_open()``: use :func:`pty.openpty`." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:94 +msgid ":mod:`sqlite3`:" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:96 +msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:98 +msgid "" +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" +"ref:`named placeholders <sqlite3-placeholders>` are used and *parameters* is " +"a sequence instead of a :class:`dict`." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:102 +msgid "" +"date and datetime adapter, date and timestamp converter: see the :mod:" +"`sqlite3` documentation for suggested replacement recipes." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:105 +msgid "" +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.14. (Contributed by Nikita Sobolev in :gh:`101866`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:112 +msgid "" +":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " +"causes a :exc:`DeprecationWarning` to be emitted when it is used." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.14.rst:115 +msgid "" +":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " +"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" +"`88168`.)" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:2 +#: ../../deprecations/pending-removal-in-3.15.rst:2 +msgid "Pending Removal in Python 3.15" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.15.rst:4 +msgid "" +":class:`http.server.CGIHTTPRequestHandler` will be removed along with its " +"related ``--cgi`` flag to ``python -m http.server``. It was obsolete and " +"rarely used. No direct replacement exists. *Anything* is better than CGI " +"to interface a web server with a request handler." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.15.rst:9 +msgid "" +":class:`locale`: :func:`locale.getdefaultlocale` was deprecated in Python " +"3.11 and originally planned for removal in Python 3.13 (:gh:`90817`), but " +"removal has been postponed to Python 3.15. Use :func:`locale.setlocale`, :" +"func:`locale.getencoding` and :func:`locale.getlocale` instead. (Contributed " +"by Hugo van Kemenade in :gh:`111187`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.15.rst:27 +msgid "" +":mod:`threading`: Passing any arguments to :func:`threading.RLock` is now " +"deprecated. C version allows any numbers of args and kwargs, but they are " +"just ignored. Python version does not allow any arguments. All arguments " +"will be removed from :func:`threading.RLock` in Python 3.15. (Contributed by " +"Nikita Sobolev in :gh:`102029`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.15.rst:34 +msgid ":class:`typing.NamedTuple`:" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.15.rst:36 +msgid "" +"The undocumented keyword argument syntax for creating :class:`!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 "" + +#: ../../deprecations/pending-removal-in-3.15.rst:40 +msgid "" +"When using the functional syntax to create a :class:`!NamedTuple` class, " +"failing to pass a value to the *fields* parameter (``NT = " +"NamedTuple(\"NT\")``) is deprecated. Passing ``None`` to the *fields* " +"parameter (``NT = NamedTuple(\"NT\", None)``) is also deprecated. Both will " +"be disallowed in Python 3.15. To create a :class:`!NamedTuple` class with 0 " +"fields, use ``class NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", " +"[])``." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.15.rst:47 +msgid "" +":class:`typing.TypedDict`: When using the functional syntax to create a :" +"class:`!TypedDict` class, failing to pass a value to the *fields* parameter " +"(``TD = TypedDict(\"TD\")``) is deprecated. Passing ``None`` to the *fields* " +"parameter (``TD = TypedDict(\"TD\", None)``) is also deprecated. Both will " +"be disallowed in Python 3.15. To create a :class:`!TypedDict` class with 0 " +"fields, use ``class TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:2 +msgid "Pending Removal in Python 3.16" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:4 +msgid "" +":mod:`array`: :class:`array.array` ``'u'`` type (:c:type:`wchar_t`): use the " +"``'w'`` type instead (``Py_UCS4``)." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:8 +msgid ":mod:`builtins`: ``~bool``, bitwise inversion on bool." +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:11 +msgid "" +":mod:`symtable`: Deprecate :meth:`symtable.Class.get_methods` due to the " +"lack of interest. (Contributed by Bénédikt Tran in :gh:`119698`.)" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:2 +#: ../../deprecations/pending-removal-in-future.rst:2 +msgid "Pending Removal in Future Versions" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:4 +msgid "" +"The following APIs will be removed in the future, although there is " +"currently no date scheduled for their removal." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:7 +msgid "" +":mod:`argparse`: Nesting argument groups and nesting mutually exclusive " +"groups are deprecated." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:10 +msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:12 +msgid ":mod:`builtins`:" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:14 +msgid "``bool(NotImplemented)``." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:15 +msgid "" +"Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " +"is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " +"argument signature." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:18 +msgid "" +"Currently Python accepts numeric literals immediately followed by keywords, " +"for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " +"ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " +"``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:26 +msgid "" +"Support for ``__index__()`` and ``__int__()`` method returning non-int type: " +"these methods will be required to return an instance of a strict subclass " +"of :class:`int`." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:29 +msgid "" +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:32 +msgid "" +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:35 +msgid "Delegation of ``int()`` to ``__trunc__()`` method." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:36 +msgid "" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:41 +msgid "" +":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " +"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." +"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:46 +msgid "" +":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " +"instead." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:49 +msgid ":mod:`datetime`:" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:51 +msgid "" +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:53 +msgid "" +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:56 +msgid ":mod:`gettext`: Plural value must be an integer." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:58 +msgid ":mod:`importlib`:" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:60 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:61 +msgid "" +":func:`~importlib.util.cache_from_source` *debug_override* parameter is " +"deprecated: use the *optimization* parameter instead." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:64 +msgid ":mod:`importlib.metadata`:" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:66 +msgid "``EntryPoints`` tuple interface." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:67 +msgid "Implicit ``None`` on return values." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:69 +msgid "" +":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " +"use :meth:`~logging.warning` instead." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:72 +msgid "" +":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " +"BytesIO and binary mode instead." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:75 +msgid "" +":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:77 +msgid "" +":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " +"deprecated, use an exception instance." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:80 +msgid "" +":mod:`re`: More strict rules are now applied for numerical group references " +"and group names in regular expressions. Only sequence of ASCII digits is " +"now accepted as a numerical reference. The group name in bytes patterns and " +"replacement strings can now only contain ASCII letters and digits and " +"underscore. (Contributed by Serhiy Storchaka in :gh:`91760`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:87 +msgid "" +":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:89 +msgid "" +":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " +"Python 3.12; use the *onexc* parameter instead." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:92 +msgid ":mod:`ssl` options and protocols:" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:94 +msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:95 +msgid "" +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:98 +msgid "``ssl.OP_NO_SSL*`` options" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:99 +msgid "``ssl.OP_NO_TLS*`` options" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:100 +msgid "``ssl.PROTOCOL_SSLv3``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:101 +msgid "``ssl.PROTOCOL_TLS``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:102 +msgid "``ssl.PROTOCOL_TLSv1``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:103 +msgid "``ssl.PROTOCOL_TLSv1_1``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:104 +msgid "``ssl.PROTOCOL_TLSv1_2``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:105 +msgid "``ssl.TLSVersion.SSLv3``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:106 +msgid "``ssl.TLSVersion.TLSv1``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:107 +msgid "``ssl.TLSVersion.TLSv1_1``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:109 +msgid "" +":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " +"ignored." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:112 +msgid ":mod:`threading` methods:" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:114 +msgid "" +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:115 +msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:116 +msgid "" +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:118 +msgid "" +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:120 +msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:121 +msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:123 +msgid ":class:`typing.Text` (:gh:`92332`)." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:125 +msgid "" +":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " +"value that is not ``None`` from a test case." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:128 +msgid "" +":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " +"instead" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:130 +msgid "``splitattr()``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:131 +msgid "``splithost()``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:132 +msgid "``splitnport()``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:133 +msgid "``splitpasswd()``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:134 +msgid "``splitport()``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:135 +msgid "``splitquery()``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:136 +msgid "``splittag()``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:137 +msgid "``splittype()``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:138 +msgid "``splituser()``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:139 +msgid "``splitvalue()``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:140 +msgid "``to_bytes()``" +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:142 +msgid "" +":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" +"`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " +"Use newer :func:`~urllib.request.urlopen` functions and methods." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:146 +msgid "" +":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " +"writes." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:149 +msgid "" +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:154 +msgid "" +":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" +"`~zipimport.zipimporter.exec_module` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:1941 +msgid "CPython Bytecode Changes" +msgstr "" + +#: ../../whatsnew/3.13.rst:1943 +msgid "" +"The oparg of ``YIELD_VALUE`` is now ``1`` if the yield is part of a yield-" +"from or await, and ``0`` otherwise. The oparg of ``RESUME`` was changed to " +"add a bit indicating whether the except-depth is 1, which is needed to " +"optimize closing of generators. (Contributed by Irit Katriel in :gh:" +"`111354`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1951 +msgid "C API Changes" +msgstr "" + +#: ../../whatsnew/3.13.rst:1956 +msgid "" +"You no longer have to define the ``PY_SSIZE_T_CLEAN`` macro before " +"including :file:`Python.h` when using ``#`` formats in :ref:`format codes " +"<arg-parsing-string-and-buffers>`. APIs accepting the format codes always " +"use ``Py_ssize_t`` for ``#`` formats. (Contributed by Inada Naoki in :gh:" +"`104922`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1962 +msgid "" +"The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and :c:" +"func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * const *` " +"in C and :c:expr:`const char * const *` in C++, instead of :c:expr:`char " +"**`. It makes these functions compatible with arguments of type :c:expr:" +"`const char * const *`, :c:expr:`const char **` or :c:expr:`char * const *` " +"in C++ and :c:expr:`char * const *` in C without an explicit type cast. This " +"can be overridden with the :c:macro:`PY_CXX_CONST` macro. (Contributed by " +"Serhiy Storchaka in :gh:`65210`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1972 +msgid "" +"Add :c:func:`PyImport_AddModuleRef`: similar to :c:func:" +"`PyImport_AddModule`, but return a :term:`strong reference` instead of a :" +"term:`borrowed reference`. (Contributed by Victor Stinner in :gh:`105922`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1977 +msgid "" +"Add :c:func:`PyWeakref_GetRef` function: similar to :c:func:" +"`PyWeakref_GetObject` but returns a :term:`strong reference`, or ``NULL`` if " +"the referent is no longer live. (Contributed by Victor Stinner in :gh:" +"`105927`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1982 +msgid "" +"Add :c:func:`PyObject_GetOptionalAttr` and :c:func:" +"`PyObject_GetOptionalAttrString`, variants of :c:func:`PyObject_GetAttr` " +"and :c:func:`PyObject_GetAttrString` which don't raise :exc:`AttributeError` " +"if the attribute is not found. These variants are more convenient and faster " +"if the missing attribute should not be treated as a failure. (Contributed by " +"Serhiy Storchaka in :gh:`106521`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1990 +msgid "" +"Add :c:func:`PyMapping_GetOptionalItem` and :c:func:" +"`PyMapping_GetOptionalItemString`: variants of :c:func:`PyObject_GetItem` " +"and :c:func:`PyMapping_GetItemString` which don't raise :exc:`KeyError` if " +"the key is not found. These variants are more convenient and faster if the " +"missing key should not be treated as a failure. (Contributed by Serhiy " +"Storchaka in :gh:`106307`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1998 +msgid "Add fixed variants of functions which silently ignore errors:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2000 +msgid "" +":c:func:`PyObject_HasAttrWithError` replaces :c:func:`PyObject_HasAttr`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2001 +msgid "" +":c:func:`PyObject_HasAttrStringWithError` replaces :c:func:" +"`PyObject_HasAttrString`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2002 +msgid "" +":c:func:`PyMapping_HasKeyWithError` replaces :c:func:`PyMapping_HasKey`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2003 +msgid "" +":c:func:`PyMapping_HasKeyStringWithError` replaces :c:func:" +"`PyMapping_HasKeyString`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2005 +msgid "" +"New functions return not only ``1`` for true and ``0`` for false, but also " +"``-1`` for error." +msgstr "" + +#: ../../whatsnew/3.13.rst:2008 +msgid "(Contributed by Serhiy Storchaka in :gh:`108511`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2010 +msgid "" +"If Python is built in :ref:`debug mode <debug-build>` or :option:`with " +"assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and :c:func:" +"`PyList_SET_ITEM` now check the index argument with an assertion. " +"(Contributed by Victor Stinner in :gh:`106168`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2015 +msgid "" +"Add :c:func:`PyModule_Add` function: similar to :c:func:" +"`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject` but always steals a " +"reference to the value. (Contributed by Serhiy Storchaka in :gh:`86493`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2020 +msgid "" +"Add :c:func:`PyDict_GetItemRef` and :c:func:`PyDict_GetItemStringRef` " +"functions: similar to :c:func:`PyDict_GetItemWithError` but returning a :" +"term:`strong reference` instead of a :term:`borrowed reference`. Moreover, " +"these functions return -1 on error and so checking ``PyErr_Occurred()`` is " +"not needed. (Contributed by Victor Stinner in :gh:`106004`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2027 +msgid "" +"Added :c:func:`PyDict_SetDefaultRef`, which is similar to :c:func:" +"`PyDict_SetDefault` but returns a :term:`strong reference` instead of a :" +"term:`borrowed reference`. This function returns ``-1`` on error, ``0`` on " +"insertion, and ``1`` if the key was already present in the dictionary. " +"(Contributed by Sam Gross in :gh:`112066`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2033 +msgid "" +"Add :c:func:`PyDict_ContainsString` function: same as :c:func:" +"`PyDict_Contains`, but *key* is specified as a :c:expr:`const char*` UTF-8 " +"encoded bytes string, rather than a :c:expr:`PyObject*`. (Contributed by " +"Victor Stinner in :gh:`108314`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2038 +msgid "" +"Added :c:func:`PyList_GetItemRef` function: similar to :c:func:" +"`PyList_GetItem` but returns a :term:`strong reference` instead of a :term:" +"`borrowed reference`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2042 +msgid "" +"Add :c:func:`Py_IsFinalizing` function: check if the main Python interpreter " +"is :term:`shutting down <interpreter shutdown>`. (Contributed by Victor " +"Stinner in :gh:`108014`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2046 +msgid "" +"Add :c:func:`PyLong_AsInt` function: similar to :c:func:`PyLong_AsLong`, but " +"store the result in a C :c:expr:`int` instead of a C :c:expr:`long`. " +"Previously, it was known as the private function :c:func:`!_PyLong_AsInt` " +"(with an underscore prefix). (Contributed by Victor Stinner in :gh:`108014`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2052 +msgid "" +"Python built with :file:`configure` :option:`--with-trace-refs` (tracing " +"references) now supports the :ref:`Limited API <limited-c-api>`. " +"(Contributed by Victor Stinner in :gh:`108634`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2056 +msgid "" +"Add :c:func:`PyObject_VisitManagedDict` and :c:func:" +"`PyObject_ClearManagedDict` functions which must be called by the traverse " +"and clear functions of a type using :c:macro:`Py_TPFLAGS_MANAGED_DICT` " +"flag. The `pythoncapi-compat project <https://github.com/python/pythoncapi-" +"compat/>`__ can be used to get these functions on Python 3.11 and 3.12. " +"(Contributed by Victor Stinner in :gh:`107073`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2064 +msgid "" +"Add :c:func:`PyUnicode_EqualToUTF8AndSize` and :c:func:" +"`PyUnicode_EqualToUTF8` functions: compare Unicode object with a :c:expr:" +"`const char*` UTF-8 encoded string and return true (``1``) if they are " +"equal, or false (``0``) otherwise. These functions do not raise exceptions. " +"(Contributed by Serhiy Storchaka in :gh:`110289`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2070 +msgid "" +"Add :c:func:`PyThreadState_GetUnchecked()` function: similar to :c:func:" +"`PyThreadState_Get()`, but don't kill the process with a fatal error if it " +"is NULL. The caller is responsible to check if the result is NULL. " +"Previously, the function was private and known as " +"``_PyThreadState_UncheckedGet()``. (Contributed by Victor Stinner in :gh:" +"`108867`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2077 +msgid "" +"Add :c:func:`PySys_AuditTuple` function: similar to :c:func:`PySys_Audit`, " +"but pass event arguments as a Python :class:`tuple` object. (Contributed by " +"Victor Stinner in :gh:`85283`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2081 +msgid "" +":c:func:`PyArg_ParseTupleAndKeywords` now supports non-ASCII keyword " +"parameter names. (Contributed by Serhiy Storchaka in :gh:`110815`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2085 +msgid "" +"Add :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawCalloc`, :c:func:" +"`PyMem_RawRealloc` and :c:func:`PyMem_RawFree` to the limited C API (version " +"3.13). (Contributed by Victor Stinner in :gh:`85283`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2090 +msgid "" +"Add :c:func:`PySys_Audit` and :c:func:`PySys_AuditTuple` functions to the " +"limited C API. (Contributed by Victor Stinner in :gh:`85283`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2094 +msgid "" +"Add :c:func:`PyErr_FormatUnraisable` function: similar to :c:func:" +"`PyErr_WriteUnraisable`, but allow customizing the warning message. " +"(Contributed by Serhiy Storchaka in :gh:`108082`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2098 +msgid "" +"Add :c:func:`PyList_Extend` and :c:func:`PyList_Clear` functions: similar to " +"Python ``list.extend()`` and ``list.clear()`` methods. (Contributed by " +"Victor Stinner in :gh:`111138`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2102 +msgid "" +"Add :c:func:`PyDict_Pop` and :c:func:`PyDict_PopString` functions: remove a " +"key from a dictionary and optionally return the removed value. This is " +"similar to :meth:`dict.pop`, but without the default value and not raising :" +"exc:`KeyError` if the key is missing. (Contributed by Stefan Behnel and " +"Victor Stinner in :gh:`111262`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2108 +msgid "" +"Add :c:func:`Py_HashPointer` function to hash a pointer. (Contributed by " +"Victor Stinner in :gh:`111545`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2111 +msgid "" +"Add :c:func:`PyObject_GenericHash` function that implements the default " +"hashing function of a Python object. (Contributed by Serhiy Storchaka in :gh:" +"`113024`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2115 +msgid "Add PyTime C API:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2117 +msgid ":c:type:`PyTime_t` type." +msgstr "" + +#: ../../whatsnew/3.13.rst:2118 +msgid ":c:var:`PyTime_MIN` and :c:var:`PyTime_MAX` constants." +msgstr "" + +#: ../../whatsnew/3.13.rst:2119 +msgid "Add functions:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2121 +msgid ":c:func:`PyTime_AsSecondsDouble`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2122 +msgid ":c:func:`PyTime_Monotonic`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2123 +msgid ":c:func:`PyTime_MonotonicRaw`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2124 +msgid ":c:func:`PyTime_PerfCounter`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2125 +msgid ":c:func:`PyTime_PerfCounterRaw`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2126 +msgid ":c:func:`PyTime_Time`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2127 +msgid ":c:func:`PyTime_TimeRaw`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2129 +msgid "(Contributed by Victor Stinner and Petr Viktorin in :gh:`110850`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2131 +msgid "" +"Add :c:func:`PyLong_AsNativeBytes`, :c:func:`PyLong_FromNativeBytes` and :c:" +"func:`PyLong_FromUnsignedNativeBytes` functions to simplify converting " +"between native integer types and Python :class:`int` objects. (Contributed " +"by Steve Dower in :gh:`111140`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2136 +msgid "" +"Add :c:func:`PyType_GetFullyQualifiedName` function to get the type's fully " +"qualified name. Equivalent to ``f\"{type.__module__}.{type." +"__qualname__}\"``, or ``type.__qualname__`` if ``type.__module__`` is not a " +"string or is equal to ``\"builtins\"``. (Contributed by Victor Stinner in :" +"gh:`111696`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2142 +msgid "" +"Add :c:func:`PyType_GetModuleName` function to get the type's module name. " +"Equivalent to getting the ``type.__module__`` attribute. (Contributed by " +"Eric Snow and Victor Stinner in :gh:`111696`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2146 +msgid "" +"Add support for ``%T``, ``%#T``, ``%N`` and ``%#N`` formats to :c:func:" +"`PyUnicode_FromFormat`: format the fully qualified name of an object type " +"and of a type: call :c:func:`PyType_GetModuleName`. See :pep:`737` for more " +"information. (Contributed by Victor Stinner in :gh:`111696`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2152 +msgid "" +"Add :c:func:`Py_GetConstant` and :c:func:`Py_GetConstantBorrowed` functions " +"to get constants. For example, ``Py_GetConstant(Py_CONSTANT_ZERO)`` returns " +"a :term:`strong reference` to the constant zero. (Contributed by Victor " +"Stinner in :gh:`115754`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2157 +msgid "" +"Add :c:func:`PyType_GetModuleByDef` to the limited C API (Contributed by " +"Victor Stinner in :gh:`116936`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2160 +msgid "" +"Add two new functions to the C-API, :c:func:`PyRefTracer_SetTracer` and :c:" +"func:`PyRefTracer_GetTracer`, that allow to track object creation and " +"destruction the same way the :mod:`tracemalloc` module does. (Contributed by " +"Pablo Galindo in :gh:`93502`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2165 +msgid "" +"Add :c:func:`PyEval_GetFrameBuiltins`, :c:func:`PyEval_GetFrameGlobals`, " +"and :c:func:`PyEval_GetFrameLocals` to the C API. These replacements for :c:" +"func:`PyEval_GetBuiltins`, :c:func:`PyEval_GetGlobals`, and :c:func:" +"`PyEval_GetLocals` return :term:`strong references <strong reference>` " +"rather than borrowed references. (Added as part of :pep:`667`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2171 +msgid "" +"Add :c:type:`PyMutex` API, a lightweight mutex that occupies a single byte. " +"The :c:func:`PyMutex_Lock` function will release the GIL (if currently held) " +"if the operation needs to block. (Contributed by Sam Gross in :gh:`108724`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2177 +msgid "Build Changes" +msgstr "" + +#: ../../whatsnew/3.13.rst:2179 +msgid "" +"The :file:`configure` option :option:`--with-system-libmpdec` now defaults " +"to ``yes``. The bundled copy of ``libmpdecimal`` will be removed in Python " +"3.15." +msgstr "" + +#: ../../whatsnew/3.13.rst:2183 +msgid "" +"Autoconf 2.71 and aclocal 1.16.4 are now required to regenerate the :file:" +"`configure` script. (Contributed by Christian Heimes in :gh:`89886`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2187 +msgid "" +"SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension " +"module. (Contributed by Erlend Aasland in :gh:`105875`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2190 +msgid "" +"Python built with :file:`configure` :option:`--with-trace-refs` (tracing " +"references) is now ABI compatible with the Python release build and :ref:" +"`debug build <debug-build>`. (Contributed by Victor Stinner in :gh:`108634`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2195 +msgid "" +"Building CPython now requires a compiler with support for the C11 atomic " +"library, GCC built-in atomic functions, or MSVC interlocked intrinsics." +msgstr "" + +#: ../../whatsnew/3.13.rst:2198 +msgid "" +"The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``, " +"``termios``, ``winsound``, ``_ctypes_test``, ``_multiprocessing." +"posixshmem``, ``_scproxy``, ``_stat``, ``_statistics``, ``_testconsole``, " +"``_testimportmultiple`` and ``_uuid`` C extensions are now built with the :" +"ref:`limited C API <limited-c-api>`. (Contributed by Victor Stinner in :gh:" +"`85283`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2205 +msgid "" +"``wasm32-wasi`` is now a :pep:`11` tier 2 platform. (Contributed by Brett " +"Cannon in :gh:`115192`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2208 +msgid "" +"``wasm32-emscripten`` is no longer a :pep:`11` supported platform. " +"(Contributed by Brett Cannon in :gh:`115192`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2211 +msgid "" +"Python now bundles the `mimalloc library <https://github.com/microsoft/" +"mimalloc>`__. It is licensed under the MIT license; see :ref:`mimalloc " +"license <mimalloc-license>`. The bundled mimalloc has custom changes, see :" +"gh:`113141` for details. (Contributed by Dino Viehland in :gh:`109914`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2216 +msgid "" +"On POSIX systems, the pkg-config (``.pc``) filenames now include the ABI " +"flags. For example, the free-threaded build generates ``python-3.13t.pc`` " +"and the debug build generates ``python-3.13d.pc``." +msgstr "" + +#: ../../whatsnew/3.13.rst:2222 +msgid "Porting to Python 3.13" +msgstr "" + +#: ../../whatsnew/3.13.rst:2224 +msgid "" +"This section lists previously described changes and other bugfixes that may " +"require changes to your code." +msgstr "" + +#: ../../whatsnew/3.13.rst:2228 +msgid "Changes in the Python API" +msgstr "" + +#: ../../whatsnew/3.13.rst:2230 +msgid "" +"An :exc:`OSError` is now raised by :func:`getpass.getuser` for any failure " +"to retrieve a username, instead of :exc:`ImportError` on non-Unix platforms " +"or :exc:`KeyError` on Unix platforms where the password database is empty." +msgstr "" + +#: ../../whatsnew/3.13.rst:2234 +msgid "" +"The :mod:`threading` module now expects the :mod:`!_thread` module to have " +"an ``_is_main_interpreter`` attribute. It is a function with no arguments " +"that returns ``True`` if the current interpreter is the main interpreter." +msgstr "" + +#: ../../whatsnew/3.13.rst:2239 +msgid "" +"Any library or application that provides a custom ``_thread`` module must " +"provide ``_is_main_interpreter()``, just like the module's other \"private\" " +"attributes. (See :gh:`112826`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2244 +msgid "" +":class:`mailbox.Maildir` now ignores files with a leading dot. (Contributed " +"by Zackery Spytz in :gh:`65559`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2247 +msgid "" +":meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` now return both " +"files and directories if a pattern that ends with \"``**``\" is given, " +"rather than directories only. Users may add a trailing slash to match only " +"directories." +msgstr "" + +#: ../../whatsnew/3.13.rst:2252 +msgid "" +"The value of the :attr:`!mode` attribute of :class:`gzip.GzipFile` was " +"changed from integer (``1`` or ``2``) to string (``'rb'`` or ``'wb'``). The " +"value of the :attr:`!mode` attribute of the readable file-like object " +"returned by :meth:`zipfile.ZipFile.open` was changed from ``'r'`` to " +"``'rb'``. (Contributed by Serhiy Storchaka in :gh:`115961`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2258 +msgid "" +":class:`functools.partial` now emits a :exc:`FutureWarning` when it is used " +"as a method. Its behavior will be changed in future Python versions. Wrap it " +"in :func:`staticmethod` if you want to preserve the old behavior. " +"(Contributed by Serhiy Storchaka in :gh:`121027`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2266 +msgid "" +"Calling :func:`locals` in an :term:`optimized scope` now produces an " +"independent snapshot on each call, and hence no longer implicitly updates " +"previously returned references. Obtaining the legacy CPython behaviour now " +"requires explicit calls to update the initially returned dictionary with the " +"results of subsequent calls to :func:`!locals`. Code execution functions " +"that implicitly target :func:`!locals` (such as ``exec`` and ``eval``) must " +"be passed an explicit namespace to access their results in an optimized " +"scope. (Changed as part of :pep:`667`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2275 +msgid "" +"Calling :func:`locals` from a comprehension at module or class scope " +"(including via ``exec`` or ``eval``) once more behaves as if the " +"comprehension were running as an independent nested function (i.e. the local " +"variables from the containing scope are not included). In Python 3.12, this " +"had changed to include the local variables from the containing scope when " +"implementing :pep:`709`. (Changed as part of :pep:`667`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2282 +msgid "" +"Accessing :attr:`FrameType.f_locals <frame.f_locals>` in an :term:`optimized " +"scope` now returns a write-through proxy rather than a snapshot that gets " +"updated at ill-specified times. If a snapshot is desired, it must be created " +"explicitly with ``dict`` or the proxy's ``.copy()`` method. (Changed as part " +"of :pep:`667`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2289 +msgid "Changes in the C API" +msgstr "" + +#: ../../whatsnew/3.13.rst:2291 +msgid "" +"``Python.h`` no longer includes the ``<ieeefp.h>`` standard header. It was " +"included for the ``finite()`` function which is now provided by the ``<math." +"h>`` header. It should now be included explicitly if needed. Remove also the " +"``HAVE_IEEEFP_H`` macro. (Contributed by Victor Stinner in :gh:`108765`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2297 +msgid "" +"``Python.h`` no longer includes these standard header files: ``<time.h>``, " +"``<sys/select.h>`` and ``<sys/time.h>``. If needed, they should now be " +"included explicitly. For example, ``<time.h>`` provides the ``clock()`` and " +"``gmtime()`` functions, ``<sys/select.h>`` provides the ``select()`` " +"function, and ``<sys/time.h>`` provides the ``futimes()``, " +"``gettimeofday()`` and ``setitimer()`` functions. (Contributed by Victor " +"Stinner in :gh:`108765`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2305 +msgid "" +"On Windows, ``Python.h`` no longer includes the ``<stddef.h>`` standard " +"header file. If needed, it should now be included explicitly. For example, " +"it provides ``offsetof()`` function, and ``size_t`` and ``ptrdiff_t`` types. " +"Including ``<stddef.h>`` explicitly was already needed by all other " +"platforms, the ``HAVE_STDDEF_H`` macro is only defined on Windows. " +"(Contributed by Victor Stinner in :gh:`108765`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2312 +msgid "" +"If the :c:macro:`Py_LIMITED_API` macro is defined, :c:macro:`!" +"Py_BUILD_CORE`, :c:macro:`!Py_BUILD_CORE_BUILTIN` and :c:macro:`!" +"Py_BUILD_CORE_MODULE` macros are now undefined by ``<Python.h>``. " +"(Contributed by Victor Stinner in :gh:`85283`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2317 +msgid "" +"The old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " +"``Py_TRASHCAN_SAFE_END`` were removed. They should be replaced by the new " +"macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``." +msgstr "" + +#: ../../whatsnew/3.13.rst:2321 +msgid "A ``tp_dealloc`` function that has the old macros, such as::" +msgstr "" + +#: ../../whatsnew/3.13.rst:2323 +msgid "" +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_SAFE_BEGIN(p);\n" +" ...\n" +" Py_TRASHCAN_SAFE_END\n" +"}" +msgstr "" + +#: ../../whatsnew/3.13.rst:2332 +msgid "should migrate to the new macros as follows::" +msgstr "" + +#: ../../whatsnew/3.13.rst:2334 +msgid "" +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_BEGIN(p, mytype_dealloc)\n" +" ...\n" +" Py_TRASHCAN_END\n" +"}" +msgstr "" + +#: ../../whatsnew/3.13.rst:2343 +msgid "" +"Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " +"deallocation function it is in. The new macros were added in Python 3.8 and " +"the old macros were deprecated in Python 3.11. (Contributed by Irit Katriel " +"in :gh:`105111`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2348 +msgid "" +"Functions :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:" +"`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:" +"`PyObject_HasAttr`, :c:func:`PyObject_HasAttrString`, and :c:func:" +"`PySys_GetObject`, which clear all errors which occurred when calling them, " +"now report them using :func:`sys.unraisablehook`. You may replace them with " +"other functions as recommended in the documentation. (Contributed by Serhiy " +"Storchaka in :gh:`106672`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2357 +msgid "" +":c:func:`!PyCode_GetFirstFree` is an unstable API now and has been renamed " +"to :c:func:`PyUnstable_Code_GetFirstFree`. (Contributed by Bogdan Romanyuk " +"in :gh:`115781`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2363 +msgid "" +"The effects of mutating the dictionary returned from :c:func:" +"`PyEval_GetLocals` in an :term:`optimized scope` have changed. New dict " +"entries added this way will now *only* be visible to subsequent :c:func:" +"`PyEval_GetLocals` calls in that frame, as :c:func:`PyFrame_GetLocals`, :" +"func:`locals`, and :attr:`FrameType.f_locals <frame.f_locals>` no longer " +"access the same underlying cached dictionary. Changes made to entries for " +"actual variable names and names added via the write-through proxy interfaces " +"will be overwritten on subsequent calls to :c:func:`PyEval_GetLocals` in " +"that frame. The recommended code update depends on how the function was " +"being used, so refer to the deprecation notice on the function for details. " +"(Changed as part of :pep:`667`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2374 +msgid "" +"Calling :c:func:`PyFrame_GetLocals` in an :term:`optimized scope` now " +"returns a write-through proxy rather than a snapshot that gets updated at " +"ill-specified times. If a snapshot is desired, it must be created explicitly " +"(e.g. with :c:func:`PyDict_Copy`) or by calling the new :c:func:" +"`PyEval_GetFrameLocals` API. (Changed as part of :pep:`667`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2379 +msgid "" +":c:func:`!PyFrame_FastToLocals` and :c:func:`!PyFrame_FastToLocalsWithError` " +"no longer have any effect. Calling these functions has been redundant since " +"Python 3.11, when :c:func:`PyFrame_GetLocals` was first introduced. (Changed " +"as part of :pep:`667`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2384 +msgid "" +":c:func:`!PyFrame_LocalsToFast` no longer has any effect. Calling this " +"function is redundant now that :c:func:`PyFrame_GetLocals` returns a write-" +"through proxy for :term:`optimized scopes <optimized scope>`. (Changed as " +"part of :pep:`667`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2389 +msgid "Removed C APIs" +msgstr "" + +#: ../../whatsnew/3.13.rst:2391 +msgid "" +"Remove many APIs (functions, macros, variables) with names prefixed by " +"``_Py`` or ``_PY`` (considered as private API). If your project is affected " +"by one of these removals and you consider that the removed API should remain " +"available, please open a new issue to request a public C API and add ``cc " +"@vstinner`` to the issue to notify Victor Stinner. (Contributed by Victor " +"Stinner in :gh:`106320`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2398 +msgid "Remove functions deprecated in Python 3.9:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2400 +msgid "" +"``PyEval_CallObject()``, ``PyEval_CallObjectWithKeywords()``: use :c:func:" +"`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead. Warning: :c:func:" +"`PyObject_Call` positional arguments must be a :class:`tuple` and must not " +"be ``NULL``, keyword arguments must be a :class:`dict` or ``NULL``, whereas " +"removed functions checked arguments type and accepted ``NULL`` positional " +"and keyword arguments. To replace ``PyEval_CallObjectWithKeywords(func, " +"NULL, kwargs)`` with :c:func:`PyObject_Call`, pass an empty tuple as " +"positional arguments using :c:func:`PyTuple_New(0) <PyTuple_New>`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2409 +msgid "``PyEval_CallFunction()``: use :c:func:`PyObject_CallFunction` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2410 +msgid "``PyEval_CallMethod()``: use :c:func:`PyObject_CallMethod` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2411 +msgid "``PyCFunction_Call()``: use :c:func:`PyObject_Call` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2413 +msgid "(Contributed by Victor Stinner in :gh:`105107`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2415 +msgid "" +"Remove old buffer protocols deprecated in Python 3.0. Use :ref:" +"`bufferobjects` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2417 +msgid "" +":c:func:`!PyObject_CheckReadBuffer`: Use :c:func:`PyObject_CheckBuffer` to " +"test if the object supports the buffer protocol. Note that :c:func:" +"`PyObject_CheckBuffer` doesn't guarantee that :c:func:`PyObject_GetBuffer` " +"will succeed. To test if the object is actually readable, see the next " +"example of :c:func:`PyObject_GetBuffer`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2424 +msgid "" +":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: :c:func:" +"`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2427 +msgid "" +"Py_buffer view;\n" +"if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) < 0) {\n" +" return NULL;\n" +"}\n" +"// Use `view.buf` and `view.len` to read from the buffer.\n" +"// You may need to cast buf as `(const char*)view.buf`.\n" +"PyBuffer_Release(&view);" +msgstr "" + +#: ../../whatsnew/3.13.rst:2437 +msgid "" +":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` and :c:" +"func:`PyBuffer_Release` instead:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2440 +msgid "" +"Py_buffer view;\n" +"if (PyObject_GetBuffer(obj, &view, PyBUF_WRITABLE) < 0) {\n" +" return NULL;\n" +"}\n" +"// Use `view.buf` and `view.len` to write to the buffer.\n" +"PyBuffer_Release(&view);" +msgstr "" + +#: ../../whatsnew/3.13.rst:2449 +msgid "(Contributed by Inada Naoki in :gh:`85275`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2451 +msgid "" +"Remove the following old functions to configure the Python initialization, " +"deprecated in Python 3.11:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2454 +msgid "" +"``PySys_AddWarnOptionUnicode()``: use :c:member:`PyConfig.warnoptions` " +"instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2455 +msgid "" +"``PySys_AddWarnOption()``: use :c:member:`PyConfig.warnoptions` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2456 +msgid "``PySys_AddXOption()``: use :c:member:`PyConfig.xoptions` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2457 +msgid "``PySys_HasWarnOptions()``: use :c:member:`PyConfig.xoptions` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2458 +msgid "" +"``PySys_SetPath()``: set :c:member:`PyConfig.module_search_paths` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2459 +msgid "``Py_SetPath()``: set :c:member:`PyConfig.module_search_paths` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2460 +msgid "" +"``Py_SetStandardStreamEncoding()``: set :c:member:`PyConfig.stdio_encoding` " +"instead, and set also maybe :c:member:`PyConfig.legacy_windows_stdio` (on " +"Windows)." +msgstr "" + +#: ../../whatsnew/3.13.rst:2463 +msgid "" +"``_Py_SetProgramFullPath()``: set :c:member:`PyConfig.executable` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2465 +msgid "" +"Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " +"Configuration <init-config>` instead (:pep:`587`), added to Python 3.8. " +"(Contributed by Victor Stinner in :gh:`105145`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2469 +msgid "" +"Remove ``PyEval_ThreadsInitialized()`` function, deprecated in Python 3.9. " +"Since Python 3.7, ``Py_Initialize()`` always creates the GIL: calling " +"``PyEval_InitThreads()`` does nothing and ``PyEval_ThreadsInitialized()`` " +"always returned non-zero. (Contributed by Victor Stinner in :gh:`105182`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2475 +msgid "" +"Remove ``PyEval_AcquireLock()`` and ``PyEval_ReleaseLock()`` functions, " +"deprecated in Python 3.2. They didn't update the current thread state. They " +"can be replaced with:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2479 +msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`;" +msgstr "" + +#: ../../whatsnew/3.13.rst:2480 +msgid "" +"low-level :c:func:`PyEval_AcquireThread` and :c:func:`PyEval_RestoreThread`;" +msgstr "" + +#: ../../whatsnew/3.13.rst:2481 +msgid "or :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2483 +msgid "(Contributed by Victor Stinner in :gh:`105182`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2485 +msgid "" +"Remove private ``_PyObject_FastCall()`` function: use " +"``PyObject_Vectorcall()`` which is available since Python 3.8 (:pep:`590`). " +"(Contributed by Victor Stinner in :gh:`106023`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2490 +msgid "" +"Remove ``cpython/pytime.h`` header file: it only contained private " +"functions. (Contributed by Victor Stinner in :gh:`106316`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2493 +msgid "" +"Remove ``_PyInterpreterState_Get()`` alias to :c:func:" +"`PyInterpreterState_Get()` which was kept for backward compatibility with " +"Python 3.8. The `pythoncapi-compat project <https://github.com/python/" +"pythoncapi-compat/>`__ can be used to get :c:func:`PyInterpreterState_Get()` " +"on Python 3.8 and older. (Contributed by Victor Stinner in :gh:`106320`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2500 +msgid "" +"The :c:func:`PyModule_AddObject` function is now :term:`soft deprecated`: :c:" +"func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions should be " +"used instead. (Contributed by Serhiy Storchaka in :gh:`86493`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2505 +msgid "" +"Remove undocumented ``PY_TIMEOUT_MAX`` constant from the limited C API. " +"(Contributed by Victor Stinner in :gh:`110014`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2509 +msgid "Deprecated C APIs" +msgstr "" + +#: ../../whatsnew/3.13.rst:2511 +msgid "" +"Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types: use directly " +"the :c:type:`wchar_t` type instead. Since Python 3.3, ``Py_UNICODE`` and " +"``PY_UNICODE_TYPE`` are just aliases to :c:type:`wchar_t`. (Contributed by " +"Victor Stinner in :gh:`105156`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2516 +msgid "Deprecate old Python initialization functions:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2518 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 +msgid "" +":c:func:`PySys_ResetWarnOptions`: clear :data:`sys.warnoptions` and :data:`!" +"warnings.filters` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2520 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:14 +msgid ":c:func:`Py_GetExecPrefix`: get :data:`sys.exec_prefix` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2521 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 +msgid ":c:func:`Py_GetPath`: get :data:`sys.path` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2522 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:16 +msgid ":c:func:`Py_GetPrefix`: get :data:`sys.prefix` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2523 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid ":c:func:`Py_GetProgramFullPath`: get :data:`sys.executable` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2524 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:18 +msgid ":c:func:`Py_GetProgramName`: get :data:`sys.executable` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2525 +msgid "" +":c:func:`Py_GetPythonHome`: get :c:member:`PyConfig.home` or :envvar:" +"`PYTHONHOME` environment variable instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2528 +msgid "" +"Functions scheduled for removal in Python 3.15. (Contributed by Victor " +"Stinner in :gh:`105145`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2531 +msgid "" +"Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function which is just " +"an alias to :c:func:`PyImport_ImportModule` since Python 3.3. Scheduled for " +"removal in Python 3.15. (Contributed by Victor Stinner in :gh:`105396`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2536 +msgid "" +"Deprecate the :c:func:`PyWeakref_GetObject` and :c:func:" +"`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed reference`: " +"use the new :c:func:`PyWeakref_GetRef` function instead, it returns a :term:" +"`strong reference`. The `pythoncapi-compat project <https://github.com/" +"python/pythoncapi-compat/>`__ can be used to get :c:func:`PyWeakref_GetRef` " +"on Python 3.12 and older. (Contributed by Victor Stinner in :gh:`105927`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2544 +msgid "" +"Deprecate the :c:func:`PyEval_GetBuiltins`, :c:func:`PyEval_GetGlobals`, " +"and :c:func:`PyEval_GetLocals` functions, which return a :term:`borrowed " +"reference`. Refer to the deprecation notices on each function for their " +"recommended replacements. (Soft deprecated as part of :pep:`667`.)" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 +msgid "" +"The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " +"(:pep:`699`; :gh:`101193`)." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 +msgid "" +"Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable " +"bases (:gh:`95388`)." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:10 +msgid "" +"Functions to configure Python's initialization, deprecated in Python 3.11:" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:12 +msgid "``PySys_SetArgvEx()``: set :c:member:`PyConfig.argv` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:13 +msgid "``PySys_SetArgv()``: set :c:member:`PyConfig.argv` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:14 +msgid "``Py_SetProgramName()``: set :c:member:`PyConfig.program_name` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:15 +msgid "``Py_SetPythonHome()``: set :c:member:`PyConfig.home` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:17 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:45 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:20 +msgid "Global configuration variables:" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:22 +msgid ":c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:23 +msgid ":c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 +msgid ":c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:25 +msgid "" +":c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 +msgid ":c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:27 +msgid "" +":c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level` " +"instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 +msgid ":c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:29 +msgid "" +":c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 +msgid "" +":c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:31 +msgid "" +":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment` " +"instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 +msgid "" +":c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode` " +"instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:33 +msgid "" +":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig." +"user_site_directory` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 +msgid "" +":c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio` " +"instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:35 +msgid "" +":c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` " +"and :c:member:`PyConfig.hash_seed` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:37 +msgid ":c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 +msgid "" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:39 +msgid "" +":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." +"legacy_windows_stdio` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 +msgid "" +":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." +"filesystem_encoding` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:41 +msgid "" +":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." +"filesystem_encoding` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 +msgid "" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." +"filesystem_errors` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:43 +msgid "" +":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` instead. (see :" +"c:func:`Py_PreInitialize`)" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 +msgid "The bundled copy of ``libmpdecimal``." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 +msgid "" +":c:func:`PyImport_ImportModuleNoBlock`: use :c:func:`PyImport_ImportModule` " +"instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 +msgid ":c:func:`PyWeakref_GET_OBJECT`: use :c:func:`PyWeakref_GetRef` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 +msgid ":c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:8 +msgid ":c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 +msgid ":c:type:`Py_UNICODE` type: use :c:type:`wchar_t` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 +msgid "Python initialization functions:" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid "" +":c:func:`Py_GetPythonHome`: get :c:member:`PyConfig.home` or the :envvar:" +"`PYTHONHOME` environment variable instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:4 +msgid "" +"The following APIs are deprecated and will be removed, although there is " +"currently no date scheduled for their removal." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:7 +msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: unneeded since Python 3.8." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:8 +msgid ":c:func:`PyErr_Fetch`: use :c:func:`PyErr_GetRaisedException` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:9 +msgid "" +":c:func:`PyErr_NormalizeException`: use :c:func:`PyErr_GetRaisedException` " +"instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:10 +msgid "" +":c:func:`PyErr_Restore`: use :c:func:`PyErr_SetRaisedException` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:11 +msgid "" +":c:func:`PyModule_GetFilename`: use :c:func:`PyModule_GetFilenameObject` " +"instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:12 +msgid ":c:func:`PyOS_AfterFork`: use :c:func:`PyOS_AfterFork_Child` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:13 +msgid "" +":c:func:`PySlice_GetIndicesEx`: use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:14 +msgid "" +":c:func:`!PyUnicode_AsDecodedObject`: use :c:func:`PyCodec_Decode` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:15 +msgid "" +":c:func:`!PyUnicode_AsDecodedUnicode`: use :c:func:`PyCodec_Decode` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:16 +msgid "" +":c:func:`!PyUnicode_AsEncodedObject`: use :c:func:`PyCodec_Encode` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:17 +msgid "" +":c:func:`!PyUnicode_AsEncodedUnicode`: use :c:func:`PyCodec_Encode` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:18 +msgid ":c:func:`PyUnicode_READY`: unneeded since Python 3.12" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:19 +msgid ":c:func:`!PyErr_Display`: use :c:func:`PyErr_DisplayException` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:20 +msgid "" +":c:func:`!_PyErr_ChainExceptions`: use ``_PyErr_ChainExceptions1`` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:21 +msgid "" +":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " +"instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:23 +msgid ":c:member:`!PyDictObject.ma_version_tag` member." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:24 +msgid "Thread Local Storage (TLS) API:" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:26 +msgid "" +":c:func:`PyThread_create_key`: use :c:func:`PyThread_tss_alloc` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:27 +msgid ":c:func:`PyThread_delete_key`: use :c:func:`PyThread_tss_free` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:28 +msgid "" +":c:func:`PyThread_set_key_value`: use :c:func:`PyThread_tss_set` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:29 +msgid "" +":c:func:`PyThread_get_key_value`: use :c:func:`PyThread_tss_get` instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:30 +msgid "" +":c:func:`PyThread_delete_key_value`: use :c:func:`PyThread_tss_delete` " +"instead." +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:31 +msgid ":c:func:`PyThread_ReInitTLS`: unneeded since Python 3.7." +msgstr "" + +#: ../../whatsnew/3.13.rst:2558 +msgid "Regression Test Changes" +msgstr "" + +#: ../../whatsnew/3.13.rst:2560 +msgid "" +"Python built with :file:`configure` :option:`--with-pydebug` now supports a :" +"option:`-X presite=package.module <-X>` command-line option. If used, it " +"specifies a module that should be imported early in the lifecycle of the " +"interpreter, before ``site.py`` is executed. (Contributed by Łukasz Langa " +"in :gh:`110769`.)" +msgstr "" diff --git a/whatsnew/3.2.po b/whatsnew/3.2.po index 096eab1ab1..f27239f8a4 100644 --- a/whatsnew/3.2.po +++ b/whatsnew/3.2.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1001,7 +1001,7 @@ msgstr "" #: ../../whatsnew/3.2.rst:664 msgid "" "The biggest news for Python 3.2 is that the :mod:`email` package, :mod:" -"`mailbox` module, and :mod:`nntplib` modules now work correctly with the " +"`mailbox` module, and :mod:`!nntplib` modules now work correctly with the " "bytes/text model in Python 3. For the first time, there is correct handling " "of messages with mixed encodings." msgstr "" @@ -2537,8 +2537,8 @@ msgid "" "The :func:`ssl.wrap_socket() <ssl.SSLContext.wrap_socket>` constructor " "function now takes a *ciphers* argument. The *ciphers* string lists the " "allowed encryption algorithms using the format described in the `OpenSSL " -"documentation <https://docs.openssl.org/1.0.2/man1/ciphers/#cipher-list-" -"format>`__." +"documentation <https://www.openssl.org/docs/man1.0.2/man1/ciphers." +"html#CIPHER-LIST-FORMAT>`__." msgstr "" #: ../../whatsnew/3.2.rst:1655 @@ -2585,7 +2585,7 @@ msgstr "nntp" #: ../../whatsnew/3.2.rst:1680 msgid "" -"The :mod:`nntplib` module has a revamped implementation with better bytes " +"The :mod:`!nntplib` module has a revamped implementation with better bytes " "and text semantics as well as more practical APIs. These improvements break " "compatibility with the nntplib version in Python 3.1, which was partly " "dysfunctional in itself." @@ -2593,8 +2593,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:1685 msgid "" -"Support for secure connections through both implicit (using :class:`nntplib." -"NNTP_SSL`) and explicit (using :meth:`nntplib.NNTP.starttls`) TLS has also " +"Support for secure connections through both implicit (using :class:`!nntplib." +"NNTP_SSL`) and explicit (using :meth:`!nntplib.NNTP.starttls`) TLS has also " "been added." msgstr "" @@ -4311,7 +4311,7 @@ msgstr "" #: ../../whatsnew/3.2.rst:2647 msgid "" -"The :mod:`nntplib` module was reworked extensively, meaning that its APIs " +"The :mod:`!nntplib` module was reworked extensively, meaning that its APIs " "are often incompatible with the 3.1 APIs." msgstr "" diff --git a/whatsnew/3.3.po b/whatsnew/3.3.po index 227ebf5acf..bba85bbba6 100644 --- a/whatsnew/3.3.po +++ b/whatsnew/3.3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1710,8 +1710,8 @@ msgstr "crypt" #: ../../whatsnew/3.3.rst:1055 msgid "" -"Addition of salt and modular crypt format (hashing method) and the :func:" -"`~crypt.mksalt` function to the :mod:`crypt` module." +"Addition of salt and modular crypt format (hashing method) and the :func:`!" +"mksalt` function to the :mod:`!crypt` module." msgstr "" #: ../../whatsnew/3.3.rst:1058 @@ -2582,9 +2582,9 @@ msgstr "nntplib" #: ../../whatsnew/3.3.rst:1561 msgid "" -"The :class:`nntplib.NNTP` class now supports the context management protocol " -"to unconditionally consume :exc:`socket.error` exceptions and to close the " -"NNTP connection when done::" +"The :class:`!nntplib.NNTP` class now supports the context management " +"protocol to unconditionally consume :exc:`socket.error` exceptions and to " +"close the NNTP connection when done::" msgstr "" #: ../../whatsnew/3.3.rst:1565 @@ -2952,7 +2952,7 @@ msgstr "shlex" #: ../../whatsnew/3.3.rst:1780 msgid "" -"The previously undocumented helper function ``quote`` from the :mod:`pipes` " +"The previously undocumented helper function ``quote`` from the :mod:`!pipes` " "modules has been moved to the :mod:`shlex` module and documented. :func:" "`~shlex.quote` properly escapes all characters in a string that might be " "otherwise given special meaning by the shell." diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index 8d0fff2e57..35f2b010c0 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -339,14 +339,13 @@ msgstr "" #: ../../whatsnew/3.4.rst:218 msgid "" -"As :pep:`discussed in the PEP <0453#recommendations-for-downstream-" -"distributors>` platform packagers may choose not to install these commands " -"by default, as long as, when invoked, they provide clear and simple " -"directions on how to install them on that platform (usually using the system " -"package manager)." +"As `discussed in the PEP`__, platform packagers may choose not to install " +"these commands by default, as long as, when invoked, they provide clear and " +"simple directions on how to install them on that platform (usually using the " +"system package manager)." msgstr "" -#: ../../whatsnew/3.4.rst:226 +#: ../../whatsnew/3.4.rst:227 msgid "" "To avoid conflicts between parallel Python 2 and Python 3 installations, " "only the versioned ``pip3`` and ``pip3.4`` commands are bootstrapped by " @@ -358,11 +357,11 @@ msgid "" "multiple Python installations." msgstr "" -#: ../../whatsnew/3.4.rst:237 +#: ../../whatsnew/3.4.rst:238 msgid "Documentation Changes" msgstr "" -#: ../../whatsnew/3.4.rst:239 +#: ../../whatsnew/3.4.rst:240 msgid "" "As part of this change, the :ref:`installing-index` and :ref:`distributing-" "index` sections of the documentation have been completely redesigned as " @@ -372,28 +371,28 @@ msgid "" "of the individual projects." msgstr "" -#: ../../whatsnew/3.4.rst:247 +#: ../../whatsnew/3.4.rst:248 msgid "" "However, as this migration is currently still incomplete, the legacy " "versions of those guides remaining available as :ref:`install-index` and :" "ref:`setuptools-index`." msgstr "" -#: ../../whatsnew/3.4.rst:253 +#: ../../whatsnew/3.4.rst:254 msgid ":pep:`453` -- Explicit bootstrapping of pip in Python installations" msgstr "" -#: ../../whatsnew/3.4.rst:254 +#: ../../whatsnew/3.4.rst:255 msgid "" "PEP written by Donald Stufft and Nick Coghlan, implemented by Donald Stufft, " "Nick Coghlan, Martin von Löwis and Ned Deily." msgstr "" -#: ../../whatsnew/3.4.rst:261 +#: ../../whatsnew/3.4.rst:262 msgid "PEP 446: Newly Created File Descriptors Are Non-Inheritable" msgstr "" -#: ../../whatsnew/3.4.rst:263 +#: ../../whatsnew/3.4.rst:264 msgid "" ":pep:`446` makes newly created file descriptors :ref:`non-inheritable " "<fd_inheritance>`. In general, this is the behavior an application will " @@ -402,39 +401,39 @@ msgid "" "to security issues." msgstr "" -#: ../../whatsnew/3.4.rst:269 +#: ../../whatsnew/3.4.rst:270 msgid "" "However, there are occasions when inheritance is desired. To support these " "cases, the following new functions and methods are available:" msgstr "" -#: ../../whatsnew/3.4.rst:272 +#: ../../whatsnew/3.4.rst:273 msgid ":func:`os.get_inheritable`, :func:`os.set_inheritable`" msgstr ":func:`os.get_inheritable`, :func:`os.set_inheritable`" -#: ../../whatsnew/3.4.rst:273 +#: ../../whatsnew/3.4.rst:274 msgid ":func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`" msgstr ":func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`" -#: ../../whatsnew/3.4.rst:274 +#: ../../whatsnew/3.4.rst:275 msgid "" ":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" msgstr "" ":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" -#: ../../whatsnew/3.4.rst:278 +#: ../../whatsnew/3.4.rst:279 msgid ":pep:`446` -- Make newly created file descriptors non-inheritable" msgstr "" -#: ../../whatsnew/3.4.rst:279 ../../whatsnew/3.4.rst:1811 +#: ../../whatsnew/3.4.rst:280 ../../whatsnew/3.4.rst:1812 msgid "PEP written and implemented by Victor Stinner." msgstr "由 Victor Stinner 撰寫 PEP 與實作。" -#: ../../whatsnew/3.4.rst:285 +#: ../../whatsnew/3.4.rst:286 msgid "Improvements to Codec Handling" msgstr "" -#: ../../whatsnew/3.4.rst:287 +#: ../../whatsnew/3.4.rst:288 msgid "" "Since it was first introduced, the :mod:`codecs` module has always been " "intended to operate as a type-neutral dynamic encoding and decoding system. " @@ -443,7 +442,7 @@ msgid "" "and :class:`bytearray` types, has historically obscured that fact." msgstr "" -#: ../../whatsnew/3.4.rst:294 +#: ../../whatsnew/3.4.rst:295 msgid "" "As a key step in clarifying the situation, the :meth:`codecs.encode` and :" "meth:`codecs.decode` convenience functions are now properly documented in " @@ -452,7 +451,7 @@ msgid "" "2.4, but were previously only discoverable through runtime introspection." msgstr "" -#: ../../whatsnew/3.4.rst:300 +#: ../../whatsnew/3.4.rst:301 msgid "" "Unlike the convenience methods on :class:`str`, :class:`bytes` and :class:" "`bytearray`, the :mod:`codecs` convenience functions support arbitrary " @@ -461,14 +460,14 @@ msgid "" "conversions (in Python 2)." msgstr "" -#: ../../whatsnew/3.4.rst:306 +#: ../../whatsnew/3.4.rst:307 msgid "" "In Python 3.4, the interpreter is able to identify the known non-text " "encodings provided in the standard library and direct users towards these " "general purpose convenience functions when appropriate::" msgstr "" -#: ../../whatsnew/3.4.rst:310 +#: ../../whatsnew/3.4.rst:311 msgid "" ">>> b\"abcdef\".decode(\"hex\")\n" "Traceback (most recent call last):\n" @@ -506,7 +505,7 @@ msgstr "" "LookupError: 'hex' is not a text encoding; use codecs.open() to handle " "arbitrary codecs" -#: ../../whatsnew/3.4.rst:325 +#: ../../whatsnew/3.4.rst:326 msgid "" "In a related change, whenever it is feasible without breaking backwards " "compatibility, exceptions raised during encoding and decoding operations are " @@ -514,7 +513,7 @@ msgid "" "the codec responsible for producing the error::" msgstr "" -#: ../../whatsnew/3.4.rst:330 +#: ../../whatsnew/3.4.rst:331 msgid "" ">>> import codecs\n" "\n" @@ -549,7 +548,7 @@ msgid "" "support the buffer interface)" msgstr "" -#: ../../whatsnew/3.4.rst:358 +#: ../../whatsnew/3.4.rst:359 msgid "" "Finally, as the examples above show, these improvements have permitted the " "restoration of the convenience aliases for the non-Unicode codecs that were " @@ -557,7 +556,7 @@ msgid "" "and from its hexadecimal representation (for example) can now be written as::" msgstr "" -#: ../../whatsnew/3.4.rst:364 +#: ../../whatsnew/3.4.rst:365 msgid "" ">>> from codecs import encode, decode\n" ">>> encode(b\"hello\", \"hex\")\n" @@ -566,13 +565,13 @@ msgid "" "b'hello'" msgstr "" -#: ../../whatsnew/3.4.rst:370 +#: ../../whatsnew/3.4.rst:371 msgid "" "The binary and text transforms provided in the standard library are detailed " "in :ref:`binary-transforms` and :ref:`text-transforms`." msgstr "" -#: ../../whatsnew/3.4.rst:373 +#: ../../whatsnew/3.4.rst:374 msgid "" "(Contributed by Nick Coghlan in :issue:`7475`, :issue:`17827`, :issue:" "`17828` and :issue:`19619`.)" @@ -580,11 +579,11 @@ msgstr "" "(由 Nick Coghlan 在 :issue:`7475`、:issue:`17827`、:issue:`17828` 和 :issue:" "`19619` 中貢獻。)" -#: ../../whatsnew/3.4.rst:380 +#: ../../whatsnew/3.4.rst:381 msgid "PEP 451: A ModuleSpec Type for the Import System" msgstr "" -#: ../../whatsnew/3.4.rst:382 +#: ../../whatsnew/3.4.rst:383 msgid "" ":pep:`451` provides an encapsulation of the information about a module that " "the import machinery will use to load it (that is, a module specification). " @@ -593,7 +592,7 @@ msgid "" "related improvements`__." msgstr "" -#: ../../whatsnew/3.4.rst:390 +#: ../../whatsnew/3.4.rst:391 msgid "" "The public-facing changes from the PEP are entirely backward-compatible. " "Furthermore, they should be transparent to everyone but importer authors. " @@ -604,19 +603,19 @@ msgid "" "and their replacements." msgstr "" -#: ../../whatsnew/3.4.rst:400 +#: ../../whatsnew/3.4.rst:401 msgid "Other Language Changes" msgstr "其他語言更動" -#: ../../whatsnew/3.4.rst:402 +#: ../../whatsnew/3.4.rst:403 msgid "Some smaller changes made to the core Python language are:" msgstr "" -#: ../../whatsnew/3.4.rst:404 +#: ../../whatsnew/3.4.rst:405 msgid "Unicode database updated to UCD version 6.3." msgstr "" -#: ../../whatsnew/3.4.rst:406 +#: ../../whatsnew/3.4.rst:407 msgid "" ":func:`min` and :func:`max` now accept a *default* keyword-only argument " "that can be used to specify the value they return if the iterable they are " @@ -624,11 +623,11 @@ msgid "" "`18111`.)" msgstr "" -#: ../../whatsnew/3.4.rst:411 +#: ../../whatsnew/3.4.rst:412 msgid "Module objects are now :ref:`weakly referenceable <mod-weakref>`." msgstr "" -#: ../../whatsnew/3.4.rst:413 +#: ../../whatsnew/3.4.rst:414 msgid "" "Module ``__file__`` attributes (and related values) should now always " "contain absolute paths by default, with the sole exception of ``__main__." @@ -636,7 +635,7 @@ msgid "" "(Contributed by Brett Cannon in :issue:`18416`.)" msgstr "" -#: ../../whatsnew/3.4.rst:418 +#: ../../whatsnew/3.4.rst:419 msgid "" "All the UTF-\\* codecs (except UTF-7) now reject surrogates during both " "encoding and decoding unless the ``surrogatepass`` error handler is used, " @@ -646,69 +645,69 @@ msgid "" "Storchaka in :issue:`12892`.)" msgstr "" -#: ../../whatsnew/3.4.rst:425 +#: ../../whatsnew/3.4.rst:426 msgid "" "New German EBCDIC :ref:`codec <standard-encodings>` ``cp273``. (Contributed " "by Michael Bierenfeld and Andrew Kuchling in :issue:`1097797`.)" msgstr "" -#: ../../whatsnew/3.4.rst:428 +#: ../../whatsnew/3.4.rst:429 msgid "" "New Ukrainian :ref:`codec <standard-encodings>` ``cp1125``. (Contributed by " "Serhiy Storchaka in :issue:`19668`.)" msgstr "" -#: ../../whatsnew/3.4.rst:431 +#: ../../whatsnew/3.4.rst:432 msgid "" ":class:`bytes`.join() and :class:`bytearray`.join() now accept arbitrary " "buffer objects as arguments. (Contributed by Antoine Pitrou in :issue:" "`15958`.)" msgstr "" -#: ../../whatsnew/3.4.rst:435 +#: ../../whatsnew/3.4.rst:436 msgid "" "The :class:`int` constructor now accepts any object that has an " "``__index__`` method for its *base* argument. (Contributed by Mark " "Dickinson in :issue:`16772`.)" msgstr "" -#: ../../whatsnew/3.4.rst:439 +#: ../../whatsnew/3.4.rst:440 msgid "" "Frame objects now have a :func:`~frame.clear` method that clears all " "references to local variables from the frame. (Contributed by Antoine " "Pitrou in :issue:`17934`.)" msgstr "" -#: ../../whatsnew/3.4.rst:443 +#: ../../whatsnew/3.4.rst:444 msgid "" ":class:`memoryview` is now registered as a :class:`Sequence <collections." "abc>`, and supports the :func:`reversed` builtin. (Contributed by Nick " "Coghlan and Claudiu Popa in :issue:`18690` and :issue:`19078`.)" msgstr "" -#: ../../whatsnew/3.4.rst:447 +#: ../../whatsnew/3.4.rst:448 msgid "" "Signatures reported by :func:`help` have been modified and improved in " "several cases as a result of the introduction of Argument Clinic and other " "changes to the :mod:`inspect` and :mod:`pydoc` modules." msgstr "" -#: ../../whatsnew/3.4.rst:451 +#: ../../whatsnew/3.4.rst:452 msgid "" ":meth:`~object.__length_hint__` is now part of the formal language " "specification (see :pep:`424`). (Contributed by Armin Ronacher in :issue:" "`16148`.)" msgstr "" -#: ../../whatsnew/3.4.rst:457 +#: ../../whatsnew/3.4.rst:458 msgid "New Modules" msgstr "新模組" -#: ../../whatsnew/3.4.rst:463 +#: ../../whatsnew/3.4.rst:464 msgid "asyncio" msgstr "asyncio" -#: ../../whatsnew/3.4.rst:465 +#: ../../whatsnew/3.4.rst:466 msgid "" "The new :mod:`asyncio` module (defined in :pep:`3156`) provides a standard " "pluggable event loop model for Python, providing solid asynchronous IO " @@ -716,23 +715,23 @@ msgid "" "implementations to interoperate with the standard library and each other." msgstr "" -#: ../../whatsnew/3.4.rst:470 ../../whatsnew/3.4.rst:533 +#: ../../whatsnew/3.4.rst:471 ../../whatsnew/3.4.rst:534 msgid "For Python 3.4, this module is considered a :term:`provisional API`." msgstr "" -#: ../../whatsnew/3.4.rst:474 +#: ../../whatsnew/3.4.rst:475 msgid ":pep:`3156` -- Asynchronous IO Support Rebooted: the \"asyncio\" Module" msgstr "" -#: ../../whatsnew/3.4.rst:475 +#: ../../whatsnew/3.4.rst:476 msgid "PEP written and implementation led by Guido van Rossum." msgstr "由 Guido van Rossum 撰寫 PEP 與帶領實作。" -#: ../../whatsnew/3.4.rst:481 +#: ../../whatsnew/3.4.rst:482 msgid "ensurepip" msgstr "ensurepip" -#: ../../whatsnew/3.4.rst:483 +#: ../../whatsnew/3.4.rst:484 msgid "" "The new :mod:`ensurepip` module is the primary infrastructure for the :pep:" "`453` implementation. In the normal course of events end users will not " @@ -741,7 +740,7 @@ msgid "" "environment was declined." msgstr "" -#: ../../whatsnew/3.4.rst:489 +#: ../../whatsnew/3.4.rst:490 msgid "" ":mod:`ensurepip` includes a bundled copy of ``pip``, up-to-date as of the " "first release candidate of the release of CPython with which it ships (this " @@ -753,7 +752,7 @@ msgid "" "package and will not be removed if Python is uninstalled.)" msgstr "" -#: ../../whatsnew/3.4.rst:498 +#: ../../whatsnew/3.4.rst:499 msgid "" "The module is named *ensure*\\ pip because if called when ``pip`` is already " "installed, it does nothing. It also has an ``--upgrade`` option that will " @@ -761,11 +760,11 @@ msgid "" "version of ``pip`` is older than the bundled copy." msgstr "" -#: ../../whatsnew/3.4.rst:507 +#: ../../whatsnew/3.4.rst:508 msgid "enum" msgstr "enum" -#: ../../whatsnew/3.4.rst:509 +#: ../../whatsnew/3.4.rst:510 msgid "" "The new :mod:`enum` module (defined in :pep:`435`) provides a standard " "implementation of enumeration types, allowing other modules (such as :mod:" @@ -774,21 +773,21 @@ msgid "" "enumeration values." msgstr "" -#: ../../whatsnew/3.4.rst:517 +#: ../../whatsnew/3.4.rst:518 msgid ":pep:`435` -- Adding an Enum type to the Python standard library" msgstr "" -#: ../../whatsnew/3.4.rst:518 +#: ../../whatsnew/3.4.rst:519 msgid "" "PEP written by Barry Warsaw, Eli Bendersky and Ethan Furman, implemented by " "Ethan Furman." msgstr "" -#: ../../whatsnew/3.4.rst:525 +#: ../../whatsnew/3.4.rst:526 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.4.rst:527 +#: ../../whatsnew/3.4.rst:528 msgid "" "The new :mod:`pathlib` module offers classes representing filesystem paths " "with semantics appropriate for different operating systems. Path classes " @@ -797,30 +796,30 @@ msgid "" "but also provide I/O operations." msgstr "" -#: ../../whatsnew/3.4.rst:537 +#: ../../whatsnew/3.4.rst:538 msgid ":pep:`428` -- The pathlib module -- object-oriented filesystem paths" msgstr "" -#: ../../whatsnew/3.4.rst:538 ../../whatsnew/3.4.rst:1834 +#: ../../whatsnew/3.4.rst:539 ../../whatsnew/3.4.rst:1835 msgid "PEP written and implemented by Antoine Pitrou." msgstr "由 Antoine Pitrou 撰寫 PEP 與實作。" -#: ../../whatsnew/3.4.rst:544 +#: ../../whatsnew/3.4.rst:545 msgid "selectors" msgstr "selectors" -#: ../../whatsnew/3.4.rst:546 +#: ../../whatsnew/3.4.rst:547 msgid "" "The new :mod:`selectors` module (created as part of implementing :pep:" "`3156`) allows high-level and efficient I/O multiplexing, built upon the :" "mod:`select` module primitives." msgstr "" -#: ../../whatsnew/3.4.rst:554 +#: ../../whatsnew/3.4.rst:555 msgid "statistics" msgstr "statistics" -#: ../../whatsnew/3.4.rst:556 +#: ../../whatsnew/3.4.rst:557 msgid "" "The new :mod:`statistics` module (defined in :pep:`450`) offers some core " "statistics functionality directly in the standard library. This module " @@ -828,64 +827,64 @@ msgid "" "deviation of a data series." msgstr "" -#: ../../whatsnew/3.4.rst:563 +#: ../../whatsnew/3.4.rst:564 msgid ":pep:`450` -- Adding A Statistics Module To The Standard Library" msgstr "" -#: ../../whatsnew/3.4.rst:564 +#: ../../whatsnew/3.4.rst:565 msgid "PEP written and implemented by Steven D'Aprano" msgstr "由 Steven D'Aprano 撰寫 PEP 與實作" -#: ../../whatsnew/3.4.rst:570 +#: ../../whatsnew/3.4.rst:571 msgid "tracemalloc" msgstr "tracemalloc" -#: ../../whatsnew/3.4.rst:572 +#: ../../whatsnew/3.4.rst:573 msgid "" "The new :mod:`tracemalloc` module (defined in :pep:`454`) is a debug tool to " "trace memory blocks allocated by Python. It provides the following " "information:" msgstr "" -#: ../../whatsnew/3.4.rst:575 +#: ../../whatsnew/3.4.rst:576 msgid "Trace where an object was allocated" msgstr "" -#: ../../whatsnew/3.4.rst:576 +#: ../../whatsnew/3.4.rst:577 msgid "" "Statistics on allocated memory blocks per filename and per line number: " "total size, number and average size of allocated memory blocks" msgstr "" -#: ../../whatsnew/3.4.rst:578 +#: ../../whatsnew/3.4.rst:579 msgid "Compute the differences between two snapshots to detect memory leaks" msgstr "" -#: ../../whatsnew/3.4.rst:582 +#: ../../whatsnew/3.4.rst:583 msgid "" ":pep:`454` -- Add a new tracemalloc module to trace Python memory allocations" msgstr "" -#: ../../whatsnew/3.4.rst:583 +#: ../../whatsnew/3.4.rst:584 msgid "PEP written and implemented by Victor Stinner" msgstr "由 Victor Stinner 撰寫 PEP 與實作" -#: ../../whatsnew/3.4.rst:588 +#: ../../whatsnew/3.4.rst:589 msgid "Improved Modules" msgstr "改進的模組" -#: ../../whatsnew/3.4.rst:592 +#: ../../whatsnew/3.4.rst:593 msgid "abc" msgstr "abc" -#: ../../whatsnew/3.4.rst:594 +#: ../../whatsnew/3.4.rst:595 msgid "" "New function :func:`abc.get_cache_token` can be used to know when to " "invalidate caches that are affected by changes in the object graph. " "(Contributed by Łukasz Langa in :issue:`16832`.)" msgstr "" -#: ../../whatsnew/3.4.rst:598 +#: ../../whatsnew/3.4.rst:599 msgid "" "New class :class:`~abc.ABC` has :class:`~abc.ABCMeta` as its meta class. " "Using ``ABC`` as a base class has essentially the same effect as specifying " @@ -893,70 +892,70 @@ msgid "" "(Contributed by Bruno Dupuis in :issue:`16049`.)" msgstr "" -#: ../../whatsnew/3.4.rst:605 +#: ../../whatsnew/3.4.rst:606 msgid "aifc" msgstr "aifc" -#: ../../whatsnew/3.4.rst:607 +#: ../../whatsnew/3.4.rst:608 msgid "" -"The :meth:`~aifc.aifc.getparams` method now returns a namedtuple rather than " -"a plain tuple. (Contributed by Claudiu Popa in :issue:`17818`.)" +"The :meth:`!getparams` method now returns a namedtuple rather than a plain " +"tuple. (Contributed by Claudiu Popa in :issue:`17818`.)" msgstr "" -#: ../../whatsnew/3.4.rst:610 +#: ../../whatsnew/3.4.rst:611 msgid "" -":func:`aifc.open` now supports the context management protocol: when used in " -"a :keyword:`with` block, the :meth:`~aifc.aifc.close` method of the returned " -"object will be called automatically at the end of the block. (Contributed " -"by Serhiy Storchacha in :issue:`16486`.)" +":func:`!aifc.open` now supports the context management protocol: when used " +"in a :keyword:`with` block, the :meth:`!close` method of the returned object " +"will be called automatically at the end of the block. (Contributed by " +"Serhiy Storchacha in :issue:`16486`.)" msgstr "" -#: ../../whatsnew/3.4.rst:615 +#: ../../whatsnew/3.4.rst:616 ../../whatsnew/3.4.rst:1543 msgid "" -"The :meth:`~aifc.aifc.writeframesraw` and :meth:`~aifc.aifc.writeframes` " -"methods now accept any :term:`bytes-like object`. (Contributed by Serhiy " -"Storchaka in :issue:`8311`.)" +"The :meth:`!writeframesraw` and :meth:`!writeframes` methods now accept any :" +"term:`bytes-like object`. (Contributed by Serhiy Storchaka in :issue:" +"`8311`.)" msgstr "" -#: ../../whatsnew/3.4.rst:621 +#: ../../whatsnew/3.4.rst:622 msgid "argparse" msgstr "argparse" -#: ../../whatsnew/3.4.rst:623 +#: ../../whatsnew/3.4.rst:624 msgid "" "The :class:`~argparse.FileType` class now accepts *encoding* and *errors* " "arguments, which are passed through to :func:`open`. (Contributed by Lucas " "Maystre in :issue:`11175`.)" msgstr "" -#: ../../whatsnew/3.4.rst:629 +#: ../../whatsnew/3.4.rst:630 msgid "audioop" msgstr "audioop" -#: ../../whatsnew/3.4.rst:631 +#: ../../whatsnew/3.4.rst:632 msgid "" -":mod:`audioop` now supports 24-bit samples. (Contributed by Serhiy " +":mod:`!audioop` now supports 24-bit samples. (Contributed by Serhiy " "Storchaka in :issue:`12866`.)" msgstr "" -#: ../../whatsnew/3.4.rst:634 +#: ../../whatsnew/3.4.rst:635 msgid "" -"New :func:`~audioop.byteswap` function converts big-endian samples to little-" -"endian and vice versa. (Contributed by Serhiy Storchaka in :issue:`19641`.)" +"New :func:`!byteswap` function converts big-endian samples to little-endian " +"and vice versa. (Contributed by Serhiy Storchaka in :issue:`19641`.)" msgstr "" -#: ../../whatsnew/3.4.rst:638 +#: ../../whatsnew/3.4.rst:639 msgid "" -"All :mod:`audioop` functions now accept any :term:`bytes-like object`. " +"All :mod:`!audioop` functions now accept any :term:`bytes-like object`. " "Strings are not accepted: they didn't work before, now they raise an error " "right away. (Contributed by Serhiy Storchaka in :issue:`16685`.)" msgstr "" -#: ../../whatsnew/3.4.rst:644 +#: ../../whatsnew/3.4.rst:645 msgid "base64" msgstr "base64" -#: ../../whatsnew/3.4.rst:646 +#: ../../whatsnew/3.4.rst:647 msgid "" "The encoding and decoding functions in :mod:`base64` now accept any :term:" "`bytes-like object` in cases where it previously required a :class:`bytes` " @@ -964,7 +963,7 @@ msgid "" "`17839`.)" msgstr "" -#: ../../whatsnew/3.4.rst:651 +#: ../../whatsnew/3.4.rst:652 msgid "" "New functions :func:`~base64.a85encode`, :func:`~base64.a85decode`, :func:" "`~base64.b85encode`, and :func:`~base64.b85decode` provide the ability to " @@ -975,11 +974,11 @@ msgid "" "Mercurial project, Serhiy Storchaka, and Antoine Pitrou in :issue:`17618`.)" msgstr "" -#: ../../whatsnew/3.4.rst:661 +#: ../../whatsnew/3.4.rst:662 msgid "collections" msgstr "collections" -#: ../../whatsnew/3.4.rst:663 +#: ../../whatsnew/3.4.rst:664 msgid "" "The :meth:`.ChainMap.new_child` method now accepts an *m* argument " "specifying the child map to add to the chain. This allows an existing " @@ -987,11 +986,11 @@ msgid "" "by Vinay Sajip in :issue:`16613`.)" msgstr "" -#: ../../whatsnew/3.4.rst:670 +#: ../../whatsnew/3.4.rst:671 msgid "colorsys" msgstr "colorsys" -#: ../../whatsnew/3.4.rst:672 +#: ../../whatsnew/3.4.rst:673 msgid "" "The number of digits in the coefficients for the RGB --- YIQ conversions " "have been expanded so that they match the FCC NTSC versions. The change in " @@ -999,11 +998,11 @@ msgid "" "(Contributed by Brian Landers and Serhiy Storchaka in :issue:`14323`.)" msgstr "" -#: ../../whatsnew/3.4.rst:679 +#: ../../whatsnew/3.4.rst:680 msgid "contextlib" msgstr "contextlib" -#: ../../whatsnew/3.4.rst:681 +#: ../../whatsnew/3.4.rst:682 msgid "" "The new :class:`contextlib.suppress` context manager helps to clarify the " "intent of code that deliberately suppresses exceptions from a single " @@ -1011,7 +1010,7 @@ msgid "" "Piraeus in :issue:`19266`.)" msgstr "" -#: ../../whatsnew/3.4.rst:686 +#: ../../whatsnew/3.4.rst:687 msgid "" "The new :func:`contextlib.redirect_stdout` context manager makes it easier " "for utility scripts to handle inflexible APIs that write their output to :" @@ -1024,18 +1023,18 @@ msgid "" "data:`sys.stdout`. (Contributed by Raymond Hettinger in :issue:`15805`.)" msgstr "" -#: ../../whatsnew/3.4.rst:697 +#: ../../whatsnew/3.4.rst:698 msgid "" "The :mod:`contextlib` documentation has also been updated to include a :ref:" "`discussion <single-use-reusable-and-reentrant-cms>` of the differences " "between single use, reusable and reentrant context managers." msgstr "" -#: ../../whatsnew/3.4.rst:703 +#: ../../whatsnew/3.4.rst:704 msgid "dbm" msgstr "dbm" -#: ../../whatsnew/3.4.rst:705 +#: ../../whatsnew/3.4.rst:706 msgid "" ":func:`dbm.open` objects now support the context management protocol. When " "used in a :keyword:`with` statement, the ``close`` method of the database " @@ -1043,25 +1042,25 @@ msgid "" "by Claudiu Popa and Nick Coghlan in :issue:`19282`.)" msgstr "" -#: ../../whatsnew/3.4.rst:712 +#: ../../whatsnew/3.4.rst:713 msgid "dis" msgstr "dis" -#: ../../whatsnew/3.4.rst:714 +#: ../../whatsnew/3.4.rst:715 msgid "" "Functions :func:`~dis.show_code`, :func:`~dis.dis`, :func:`~dis.distb`, and :" "func:`~dis.disassemble` now accept a keyword-only *file* argument that " "controls where they write their output." msgstr "" -#: ../../whatsnew/3.4.rst:718 +#: ../../whatsnew/3.4.rst:719 msgid "" "The :mod:`dis` module is now built around an :class:`~dis.Instruction` class " "that provides object oriented access to the details of each individual " "bytecode operation." msgstr "" -#: ../../whatsnew/3.4.rst:722 +#: ../../whatsnew/3.4.rst:723 msgid "" "A new method, :func:`~dis.get_instructions`, provides an iterator that emits " "the Instruction stream for a given piece of Python code. Thus it is now " @@ -1070,7 +1069,7 @@ msgid "" "example::" msgstr "" -#: ../../whatsnew/3.4.rst:728 +#: ../../whatsnew/3.4.rst:729 msgid "" ">>> import dis\n" ">>> for instr in dis.get_instructions(lambda x: x + 1):\n" @@ -1088,13 +1087,13 @@ msgstr "" "BINARY_ADD\n" "RETURN_VALUE" -#: ../../whatsnew/3.4.rst:736 +#: ../../whatsnew/3.4.rst:737 msgid "" "The various display tools in the :mod:`dis` module have been rewritten to " "use these new components." msgstr "" -#: ../../whatsnew/3.4.rst:739 +#: ../../whatsnew/3.4.rst:740 msgid "" "In addition, a new application-friendly class :class:`~dis.Bytecode` " "provides an object-oriented API for inspecting bytecode in both in human-" @@ -1106,7 +1105,7 @@ msgid "" "dis` on the constructor argument, but returned as a multi-line string::" msgstr "" -#: ../../whatsnew/3.4.rst:748 +#: ../../whatsnew/3.4.rst:749 msgid "" ">>> bytecode = dis.Bytecode(lambda x: x + 1, current_offset=3)\n" ">>> for instr in bytecode:\n" @@ -1122,7 +1121,7 @@ msgid "" " ' 7 RETURN_VALUE']" msgstr "" -#: ../../whatsnew/3.4.rst:761 +#: ../../whatsnew/3.4.rst:762 msgid "" ":class:`~dis.Bytecode` also has a class method, :meth:`~dis.Bytecode." "from_traceback`, that provides the ability to manipulate a traceback (that " @@ -1130,7 +1129,7 @@ msgid "" "``distb(tb)``)." msgstr "" -#: ../../whatsnew/3.4.rst:766 +#: ../../whatsnew/3.4.rst:767 msgid "" "(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver in :issue:" "`11816` and Claudiu Popa in :issue:`17916`.)" @@ -1138,25 +1137,25 @@ msgstr "" "(由 Nick Coghlan、Ryan Kelly 和 Thomas Kluyver 在 :issue:`11816` 中以及 " "Claudiu Popa 在 :issue:`17916` 中貢獻。)" -#: ../../whatsnew/3.4.rst:769 +#: ../../whatsnew/3.4.rst:770 msgid "" "New function :func:`~dis.stack_effect` computes the effect on the Python " "stack of a given opcode and argument, information that is not otherwise " "available. (Contributed by Larry Hastings in :issue:`19722`.)" msgstr "" -#: ../../whatsnew/3.4.rst:775 +#: ../../whatsnew/3.4.rst:776 msgid "doctest" msgstr "doctest" -#: ../../whatsnew/3.4.rst:777 +#: ../../whatsnew/3.4.rst:778 msgid "" "A new :ref:`option flag <doctest-options>`, :const:`~doctest.FAIL_FAST`, " "halts test running as soon as the first failure is detected. (Contributed " "by R. David Murray and Daniel Urban in :issue:`16522`.)" msgstr "" -#: ../../whatsnew/3.4.rst:781 +#: ../../whatsnew/3.4.rst:782 msgid "" "The :mod:`doctest` command line interface now uses :mod:`argparse`, and has " "two new options, ``-o`` and ``-f``. ``-o`` allows :ref:`doctest options " @@ -1166,17 +1165,17 @@ msgid "" "`11390`.)" msgstr "" -#: ../../whatsnew/3.4.rst:787 +#: ../../whatsnew/3.4.rst:788 msgid "" ":mod:`doctest` will now find doctests in extension module ``__doc__`` " "strings. (Contributed by Zachary Ware in :issue:`3158`.)" msgstr "" -#: ../../whatsnew/3.4.rst:792 +#: ../../whatsnew/3.4.rst:793 msgid "email" msgstr "email" -#: ../../whatsnew/3.4.rst:794 +#: ../../whatsnew/3.4.rst:795 msgid "" ":meth:`~email.message.Message.as_string` now accepts a *policy* argument to " "override the default policy of the message when generating a string " @@ -1186,7 +1185,7 @@ msgid "" "(Contributed by R. David Murray in :issue:`18600`.)" msgstr "" -#: ../../whatsnew/3.4.rst:801 +#: ../../whatsnew/3.4.rst:802 msgid "" "New method :meth:`~email.message.Message.as_bytes` added to produce a bytes " "representation of the message in a fashion similar to how ``as_string`` " @@ -1198,7 +1197,7 @@ msgid "" "(Contributed by R. David Murray in :issue:`18600`.)" msgstr "" -#: ../../whatsnew/3.4.rst:810 +#: ../../whatsnew/3.4.rst:811 msgid "" "The :meth:`.Message.set_param` message now accepts a *replace* keyword " "argument. When specified, the associated header will be updated without " @@ -1207,7 +1206,7 @@ msgid "" "`18891`.)" msgstr "" -#: ../../whatsnew/3.4.rst:818 +#: ../../whatsnew/3.4.rst:819 msgid "" "A pair of new subclasses of :class:`~email.message.Message` have been added " "(:class:`.EmailMessage` and :class:`.MIMEPart`), along with a new sub-" @@ -1224,11 +1223,11 @@ msgid "" "handling). (Contributed by R. David Murray in :issue:`18891`.)" msgstr "" -#: ../../whatsnew/3.4.rst:834 +#: ../../whatsnew/3.4.rst:835 msgid "filecmp" msgstr "filecmp" -#: ../../whatsnew/3.4.rst:836 +#: ../../whatsnew/3.4.rst:837 msgid "" "A new :func:`~filecmp.clear_cache` function provides the ability to clear " "the :mod:`filecmp` comparison cache, which uses :func:`os.stat` information " @@ -1238,7 +1237,7 @@ msgid "" "time field. (Contributed by Mark Levitt in :issue:`18149`.)" msgstr "" -#: ../../whatsnew/3.4.rst:843 +#: ../../whatsnew/3.4.rst:844 msgid "" "New module attribute :const:`~filecmp.DEFAULT_IGNORES` provides the list of " "directories that are used as the default value for the *ignore* parameter of " @@ -1246,11 +1245,11 @@ msgid "" "issue:`15442`.)" msgstr "" -#: ../../whatsnew/3.4.rst:850 +#: ../../whatsnew/3.4.rst:851 msgid "functools" msgstr "functools" -#: ../../whatsnew/3.4.rst:852 +#: ../../whatsnew/3.4.rst:853 msgid "" "The new :func:`~functools.partialmethod` descriptor brings partial argument " "application to descriptors, just as :func:`~functools.partial` provides for " @@ -1260,7 +1259,7 @@ msgid "" "Alon Horev and Nick Coghlan in :issue:`4331`.)" msgstr "" -#: ../../whatsnew/3.4.rst:861 +#: ../../whatsnew/3.4.rst:862 msgid "" "The new :func:`~functools.singledispatch` decorator brings support for " "single-dispatch generic functions to the Python standard library. Where " @@ -1270,22 +1269,22 @@ msgid "" "*different* kinds of data." msgstr "" -#: ../../whatsnew/3.4.rst:870 +#: ../../whatsnew/3.4.rst:871 msgid ":pep:`443` -- Single-dispatch generic functions" msgstr "" -#: ../../whatsnew/3.4.rst:871 +#: ../../whatsnew/3.4.rst:872 msgid "PEP written and implemented by Łukasz Langa." msgstr "由 Łukasz Langa 撰寫 PEP 與實作。" -#: ../../whatsnew/3.4.rst:873 +#: ../../whatsnew/3.4.rst:874 msgid "" ":func:`~functools.total_ordering` now supports a return value of :data:" "`NotImplemented` from the underlying comparison function. (Contributed by " "Katie Miller in :issue:`10042`.)" msgstr "" -#: ../../whatsnew/3.4.rst:877 +#: ../../whatsnew/3.4.rst:878 msgid "" "A pure-python version of the :func:`~functools.partial` function is now in " "the stdlib; in CPython it is overridden by the C accelerated version, but it " @@ -1293,22 +1292,22 @@ msgid "" "in :issue:`12428`.)" msgstr "" -#: ../../whatsnew/3.4.rst:884 +#: ../../whatsnew/3.4.rst:885 msgid "gc" msgstr "gc" -#: ../../whatsnew/3.4.rst:886 +#: ../../whatsnew/3.4.rst:887 msgid "" "New function :func:`~gc.get_stats` returns a list of three per-generation " "dictionaries containing the collections statistics since interpreter " "startup. (Contributed by Antoine Pitrou in :issue:`16351`.)" msgstr "" -#: ../../whatsnew/3.4.rst:892 +#: ../../whatsnew/3.4.rst:893 msgid "glob" msgstr "glob" -#: ../../whatsnew/3.4.rst:894 +#: ../../whatsnew/3.4.rst:895 msgid "" "A new function :func:`~glob.escape` provides a way to escape special " "characters in a filename so that they do not become part of the globbing " @@ -1316,18 +1315,18 @@ msgid "" "Storchaka in :issue:`8402`.)" msgstr "" -#: ../../whatsnew/3.4.rst:900 +#: ../../whatsnew/3.4.rst:901 msgid "hashlib" msgstr "hashlib" -#: ../../whatsnew/3.4.rst:902 +#: ../../whatsnew/3.4.rst:903 msgid "" "A new :func:`hashlib.pbkdf2_hmac` function provides the `PKCS#5 password-" "based key derivation function 2 <https://en.wikipedia.org/wiki/PBKDF2>`_. " "(Contributed by Christian Heimes in :issue:`18582`.)" msgstr "" -#: ../../whatsnew/3.4.rst:907 +#: ../../whatsnew/3.4.rst:908 msgid "" "The :attr:`~hashlib.hash.name` attribute of :mod:`hashlib` hash objects is " "now a formally supported interface. It has always existed in CPython's :mod:" @@ -1337,11 +1336,11 @@ msgid "" "Coombs in :issue:`18532`.)" msgstr "" -#: ../../whatsnew/3.4.rst:916 +#: ../../whatsnew/3.4.rst:917 msgid "hmac" msgstr "hmac" -#: ../../whatsnew/3.4.rst:918 +#: ../../whatsnew/3.4.rst:919 msgid "" ":mod:`hmac` now accepts ``bytearray`` as well as ``bytes`` for the *key* " "argument to the :func:`~hmac.new` function, and the *msg* parameter to both " @@ -1350,7 +1349,7 @@ msgid "" "Jonas Borgström in :issue:`18240`.)" msgstr "" -#: ../../whatsnew/3.4.rst:924 +#: ../../whatsnew/3.4.rst:925 msgid "" "The *digestmod* argument to the :func:`hmac.new` function may now be any " "hash digest name recognized by :mod:`hashlib`. In addition, the current " @@ -1359,7 +1358,7 @@ msgid "" "(Contributed by Christian Heimes in :issue:`17276`.)" msgstr "" -#: ../../whatsnew/3.4.rst:930 +#: ../../whatsnew/3.4.rst:931 msgid "" "With the addition of :attr:`~hmac.HMAC.block_size` and :attr:`~hmac.HMAC." "name` attributes (and the formal documentation of the :attr:`~hmac.HMAC." @@ -1367,18 +1366,18 @@ msgid "" "pep:`247` API. (Contributed by Christian Heimes in :issue:`18775`.)" msgstr "" -#: ../../whatsnew/3.4.rst:937 +#: ../../whatsnew/3.4.rst:938 msgid "html" msgstr "html" -#: ../../whatsnew/3.4.rst:939 +#: ../../whatsnew/3.4.rst:940 msgid "" "New function :func:`~html.unescape` function converts HTML5 character " "references to the corresponding Unicode characters. (Contributed by Ezio " "Melotti in :issue:`2927`.)" msgstr "" -#: ../../whatsnew/3.4.rst:943 +#: ../../whatsnew/3.4.rst:944 msgid "" ":class:`~html.parser.HTMLParser` accepts a new keyword argument " "*convert_charrefs* that, when ``True``, automatically converts all character " @@ -1388,17 +1387,17 @@ msgid "" "(Contributed by Ezio Melotti in :issue:`13633`.)" msgstr "" -#: ../../whatsnew/3.4.rst:950 +#: ../../whatsnew/3.4.rst:951 msgid "" "The *strict* argument of :class:`~html.parser.HTMLParser` is now deprecated. " "(Contributed by Ezio Melotti in :issue:`15114`.)" msgstr "" -#: ../../whatsnew/3.4.rst:955 +#: ../../whatsnew/3.4.rst:956 msgid "http" msgstr "http" -#: ../../whatsnew/3.4.rst:957 +#: ../../whatsnew/3.4.rst:958 msgid "" ":meth:`~http.server.BaseHTTPRequestHandler.send_error` now accepts an " "optional additional *explain* parameter which can be used to provide an " @@ -1408,18 +1407,18 @@ msgid "" "the error response. (Contributed by Karl Cow in :issue:`12921`.)" msgstr "" -#: ../../whatsnew/3.4.rst:964 +#: ../../whatsnew/3.4.rst:965 msgid "" "The :mod:`http.server` :ref:`command line interface <http-server-cli>` now " "has a ``-b/--bind`` option that causes the server to listen on a specific " "address. (Contributed by Malte Swart in :issue:`17764`.)" msgstr "" -#: ../../whatsnew/3.4.rst:970 +#: ../../whatsnew/3.4.rst:971 msgid "idlelib and IDLE" msgstr "idlelib 與 IDLE" -#: ../../whatsnew/3.4.rst:972 +#: ../../whatsnew/3.4.rst:973 msgid "" "Since idlelib implements the IDLE shell and editor and is not intended for " "import by other programs, it gets improvements with every release. See :file:" @@ -1428,11 +1427,11 @@ msgid "" "the IDLE :menuselection:`Help --> About IDLE` dialog." msgstr "" -#: ../../whatsnew/3.4.rst:980 +#: ../../whatsnew/3.4.rst:981 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.4.rst:982 +#: ../../whatsnew/3.4.rst:983 msgid "" "The :class:`~importlib.abc.InspectLoader` ABC defines a new method, :meth:" "`~importlib.abc.InspectLoader.source_to_code` that accepts source data and a " @@ -1441,7 +1440,7 @@ msgid "" "Snow and Brett Cannon in :issue:`15627`.)" msgstr "" -#: ../../whatsnew/3.4.rst:988 +#: ../../whatsnew/3.4.rst:989 msgid "" ":class:`~importlib.abc.InspectLoader` also now has a default implementation " "for the :meth:`~importlib.abc.InspectLoader.get_code` method. However, it " @@ -1449,14 +1448,14 @@ msgid "" "performance reasons. (Contributed by Brett Cannon in :issue:`18072`.)" msgstr "" -#: ../../whatsnew/3.4.rst:993 +#: ../../whatsnew/3.4.rst:994 msgid "" "The :func:`~importlib.reload` function has been moved from :mod:`!imp` to :" "mod:`importlib` as part of the :mod:`!imp` module deprecation. (Contributed " "by Berker Peksag in :issue:`18193`.)" msgstr "" -#: ../../whatsnew/3.4.rst:997 +#: ../../whatsnew/3.4.rst:998 msgid "" ":mod:`importlib.util` now has a :data:`~importlib.util.MAGIC_NUMBER` " "attribute providing access to the bytecode version number. This replaces " @@ -1464,7 +1463,7 @@ msgid "" "(Contributed by Brett Cannon in :issue:`18192`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1002 +#: ../../whatsnew/3.4.rst:1003 msgid "" "New :mod:`importlib.util` functions :func:`~importlib.util." "cache_from_source` and :func:`~importlib.util.source_from_cache` replace the " @@ -1472,7 +1471,7 @@ msgid "" "Brett Cannon in :issue:`18194`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1007 +#: ../../whatsnew/3.4.rst:1008 msgid "" "The :mod:`importlib` bootstrap :class:`.NamespaceLoader` now conforms to " "the :class:`.InspectLoader` ABC, which means that ``runpy`` and ``python -" @@ -1480,7 +1479,7 @@ msgid "" "in :issue:`18058`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1012 +#: ../../whatsnew/3.4.rst:1013 msgid "" ":mod:`importlib.util` has a new function :func:`~importlib.util." "decode_source` that decodes source from bytes using universal newline " @@ -1488,7 +1487,7 @@ msgid "" "get_source` methods." msgstr "" -#: ../../whatsnew/3.4.rst:1016 +#: ../../whatsnew/3.4.rst:1017 msgid "" ":class:`importlib.machinery.ExtensionFileLoader` now has a :meth:`~importlib." "machinery.ExtensionFileLoader.get_filename` method. This was inadvertently " @@ -1496,11 +1495,11 @@ msgid "" "`19152`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1023 +#: ../../whatsnew/3.4.rst:1024 msgid "inspect" msgstr "inspect" -#: ../../whatsnew/3.4.rst:1025 +#: ../../whatsnew/3.4.rst:1026 msgid "" "The :mod:`inspect` module now offers a basic :ref:`command line interface " "<inspect-module-cli>` to quickly display source code and other information " @@ -1508,7 +1507,7 @@ msgid "" "Coghlan in :issue:`18626`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1030 +#: ../../whatsnew/3.4.rst:1031 msgid "" ":func:`~inspect.unwrap` makes it easy to unravel wrapper function chains " "created by :func:`functools.wraps` (and any other API that sets the " @@ -1516,7 +1515,7 @@ msgid "" "Urban, Aaron Iles and Nick Coghlan in :issue:`13266`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1035 +#: ../../whatsnew/3.4.rst:1036 msgid "" "As part of the implementation of the new :mod:`enum` module, the :mod:" "`inspect` module now has substantially better support for custom ``__dir__`` " @@ -1524,7 +1523,7 @@ msgid "" "(Contributed by Ethan Furman in :issue:`18929` and :issue:`19030`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1041 +#: ../../whatsnew/3.4.rst:1042 msgid "" ":func:`~inspect.getfullargspec` and :func:`~inspect.getargspec` now use the :" "func:`~inspect.signature` API. This allows them to support a much broader " @@ -1537,18 +1536,18 @@ msgid "" "(Contributed by Yury Selivanov in :issue:`17481`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1052 +#: ../../whatsnew/3.4.rst:1053 msgid "" ":func:`~inspect.signature` now supports duck types of CPython functions, " "which adds support for functions compiled with Cython. (Contributed by " "Stefan Behnel and Yury Selivanov in :issue:`17159`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1058 +#: ../../whatsnew/3.4.rst:1059 msgid "ipaddress" msgstr "ipaddress" -#: ../../whatsnew/3.4.rst:1060 +#: ../../whatsnew/3.4.rst:1061 msgid "" ":mod:`ipaddress` was added to the standard library in Python 3.3 as a :term:" "`provisional API`. With the release of Python 3.4, this qualification has " @@ -1556,32 +1555,32 @@ msgid "" "the normal standard library requirements to maintain backwards compatibility." msgstr "" -#: ../../whatsnew/3.4.rst:1066 +#: ../../whatsnew/3.4.rst:1067 msgid "" "A new :attr:`~ipaddress.IPv4Address.is_global` property is ``True`` if an " "address is globally routeable. (Contributed by Peter Moody in :issue:" "`17400`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1072 +#: ../../whatsnew/3.4.rst:1073 msgid "logging" msgstr "logging" -#: ../../whatsnew/3.4.rst:1074 +#: ../../whatsnew/3.4.rst:1075 msgid "" "The :class:`~logging.handlers.TimedRotatingFileHandler` has a new *atTime* " "parameter that can be used to specify the time of day when rollover should " "happen. (Contributed by Ronald Oussoren in :issue:`9556`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1078 +#: ../../whatsnew/3.4.rst:1079 msgid "" ":class:`~logging.handlers.SocketHandler` and :class:`~logging.handlers." "DatagramHandler` now support Unix domain sockets (by setting *port* to " "``None``). (Contributed by Vinay Sajip in commit ce46195b56a9.)" msgstr "" -#: ../../whatsnew/3.4.rst:1083 +#: ../../whatsnew/3.4.rst:1084 msgid "" ":func:`~logging.config.fileConfig` now accepts a :class:`configparser." "RawConfigParser` subclass instance for the *fname* parameter. This " @@ -1591,7 +1590,7 @@ msgid "" "fileConfig`. (Contributed by Vinay Sajip in :issue:`16110`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1091 +#: ../../whatsnew/3.4.rst:1092 msgid "" "Logging configuration data received from a socket via the :func:`logging." "config.listen` function can now be validated before being processed by " @@ -1599,11 +1598,11 @@ msgid "" "keyword argument. (Contributed by Vinay Sajip in :issue:`15452`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1100 +#: ../../whatsnew/3.4.rst:1101 msgid "marshal" msgstr "marshal" -#: ../../whatsnew/3.4.rst:1102 +#: ../../whatsnew/3.4.rst:1103 msgid "" "The default :mod:`marshal` version has been bumped to 3. The code " "implementing the new version restores the Python2 behavior of recording only " @@ -1616,21 +1615,21 @@ msgid "" "issue:`19219`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1113 +#: ../../whatsnew/3.4.rst:1114 msgid "mmap" msgstr "mmap" -#: ../../whatsnew/3.4.rst:1115 +#: ../../whatsnew/3.4.rst:1116 msgid "" "mmap objects are now :ref:`weakly referenceable <mod-weakref>`. (Contributed " "by Valerie Lambert in :issue:`4885`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1120 +#: ../../whatsnew/3.4.rst:1121 msgid "multiprocessing" msgstr "multiprocessing" -#: ../../whatsnew/3.4.rst:1124 +#: ../../whatsnew/3.4.rst:1125 msgid "" "On Unix two new :ref:`start methods <multiprocessing-start-methods>`, " "``spawn`` and ``forkserver``, have been added for starting processes using :" @@ -1643,7 +1642,7 @@ msgid "" "(Contributed by Richard Oudkerk in :issue:`8713`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1134 +#: ../../whatsnew/3.4.rst:1135 msgid "" ":mod:`multiprocessing` also now has the concept of a ``context``, which " "determines how child processes are created. New function :func:" @@ -1656,14 +1655,14 @@ msgid "" "Richard Oudkerk in :issue:`18999`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1144 +#: ../../whatsnew/3.4.rst:1145 msgid "" "Except when using the old *fork* start method, child processes no longer " "inherit unneeded handles/file descriptors from their parents (part of :issue:" "`8713`)." msgstr "" -#: ../../whatsnew/3.4.rst:1148 +#: ../../whatsnew/3.4.rst:1149 msgid "" ":mod:`multiprocessing` now relies on :mod:`runpy` (which implements the ``-" "m`` switch) to initialise ``__main__`` appropriately in child processes when " @@ -1673,11 +1672,11 @@ msgid "" "(Contributed by Nick Coghlan in :issue:`19946`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1157 +#: ../../whatsnew/3.4.rst:1158 msgid "operator" msgstr "operator" -#: ../../whatsnew/3.4.rst:1159 +#: ../../whatsnew/3.4.rst:1160 msgid "" "New function :func:`~operator.length_hint` provides an implementation of the " "specification for how the :meth:`~object.__length_hint__` special method " @@ -1685,18 +1684,18 @@ msgid "" "language feature. (Contributed by Armin Ronacher in :issue:`16148`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1164 +#: ../../whatsnew/3.4.rst:1165 msgid "" "There is now a pure-python version of the :mod:`operator` module available " "for reference and for use by alternate implementations of Python. " "(Contributed by Zachary Ware in :issue:`16694`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1170 +#: ../../whatsnew/3.4.rst:1171 msgid "os" msgstr "os" -#: ../../whatsnew/3.4.rst:1172 +#: ../../whatsnew/3.4.rst:1173 msgid "" "There are new functions to get and set the :ref:`inheritable flag " "<fd_inheritance>` of a file descriptor (:func:`os.get_inheritable`, :func:" @@ -1704,7 +1703,7 @@ msgid "" "get_handle_inheritable`, :func:`os.set_handle_inheritable`)." msgstr "" -#: ../../whatsnew/3.4.rst:1177 +#: ../../whatsnew/3.4.rst:1178 msgid "" "New function :func:`~os.cpu_count` reports the number of CPUs available on " "the platform on which Python is running (or ``None`` if the count can't be " @@ -1714,20 +1713,20 @@ msgid "" "`17914`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1183 +#: ../../whatsnew/3.4.rst:1184 msgid "" ":func:`os.path.samestat` is now available on the Windows platform (and the :" "func:`os.path.samefile` implementation is now shared between Unix and " "Windows). (Contributed by Brian Curtin in :issue:`11939`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1187 +#: ../../whatsnew/3.4.rst:1188 msgid "" ":func:`os.path.ismount` now recognizes volumes mounted below a drive root on " "Windows. (Contributed by Tim Golden in :issue:`9035`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1190 +#: ../../whatsnew/3.4.rst:1191 msgid "" ":func:`os.open` supports two new flags on platforms that provide them, :" "const:`~os.O_PATH` (un-opened file descriptor), and :const:`~os.O_TMPFILE` " @@ -1737,11 +1736,11 @@ msgid "" "respectively.)" msgstr "" -#: ../../whatsnew/3.4.rst:1198 +#: ../../whatsnew/3.4.rst:1199 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.4.rst:1200 +#: ../../whatsnew/3.4.rst:1201 msgid "" ":mod:`pdb` has been enhanced to handle generators, :keyword:`yield`, and " "``yield from`` in a more useful fashion. This is especially helpful when " @@ -1749,7 +1748,7 @@ msgid "" "Xavier de Gaye in :issue:`16596`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1205 +#: ../../whatsnew/3.4.rst:1206 msgid "" "The ``print`` command has been removed from :mod:`pdb`, restoring access to " "the Python :func:`print` function from the pdb command line. Python2's " @@ -1762,11 +1761,11 @@ msgid "" "(Contributed by Connor Osborn in :issue:`18764`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1219 +#: ../../whatsnew/3.4.rst:1220 msgid "pickle" msgstr "pickle" -#: ../../whatsnew/3.4.rst:1221 +#: ../../whatsnew/3.4.rst:1222 msgid "" ":mod:`pickle` now supports (but does not use by default) a new pickle " "protocol, protocol 4. This new protocol addresses a number of issues that " @@ -1776,19 +1775,19 @@ msgid "" "efficiency improvements." msgstr "" -#: ../../whatsnew/3.4.rst:1229 +#: ../../whatsnew/3.4.rst:1230 msgid ":pep:`3154` -- Pickle protocol 4" msgstr "" -#: ../../whatsnew/3.4.rst:1230 +#: ../../whatsnew/3.4.rst:1231 msgid "PEP written by Antoine Pitrou and implemented by Alexandre Vassalotti." msgstr "由 Antoine Pitrou 撰寫 PEP、Alexandre Vassalotti 實作。" -#: ../../whatsnew/3.4.rst:1234 +#: ../../whatsnew/3.4.rst:1235 msgid "plistlib" msgstr "plistlib" -#: ../../whatsnew/3.4.rst:1236 +#: ../../whatsnew/3.4.rst:1237 msgid "" ":mod:`plistlib` now has an API that is similar to the standard pattern for " "stdlib serialization protocols, with new :func:`~plistlib.load`, :func:" @@ -1799,11 +1798,11 @@ msgid "" "(Contributed by Ronald Oussoren and others in :issue:`14455`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1246 +#: ../../whatsnew/3.4.rst:1247 msgid "poplib" msgstr "poplib" -#: ../../whatsnew/3.4.rst:1248 +#: ../../whatsnew/3.4.rst:1249 msgid "" "Two new methods have been added to :mod:`poplib`: :meth:`~poplib.POP3.capa`, " "which returns the list of capabilities advertised by the POP server, and :" @@ -1812,11 +1811,11 @@ msgid "" "Lorenzo Catucci in :issue:`4473`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1256 +#: ../../whatsnew/3.4.rst:1257 msgid "pprint" msgstr "pprint" -#: ../../whatsnew/3.4.rst:1258 +#: ../../whatsnew/3.4.rst:1259 msgid "" "The :mod:`pprint` module's :class:`~pprint.PrettyPrinter` class and its :" "func:`~pprint.pformat`, and :func:`~pprint.pprint` functions have a new " @@ -1826,27 +1825,27 @@ msgid "" "(Contributed by Serhiy Storchaka in :issue:`19132`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1265 +#: ../../whatsnew/3.4.rst:1266 msgid "" "Long strings are now wrapped using Python's normal line continuation " "syntax. (Contributed by Antoine Pitrou in :issue:`17150`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1270 +#: ../../whatsnew/3.4.rst:1271 msgid "pty" msgstr "pty" -#: ../../whatsnew/3.4.rst:1272 +#: ../../whatsnew/3.4.rst:1273 msgid "" ":func:`pty.spawn` now returns the status value from :func:`os.waitpid` on " "the child process, instead of ``None``. (Contributed by Gregory P. Smith.)" msgstr "" -#: ../../whatsnew/3.4.rst:1277 +#: ../../whatsnew/3.4.rst:1278 msgid "pydoc" msgstr "pydoc" -#: ../../whatsnew/3.4.rst:1279 +#: ../../whatsnew/3.4.rst:1280 msgid "" "The :mod:`pydoc` module is now based directly on the :func:`inspect." "signature` introspection API, allowing it to provide signature information " @@ -1855,7 +1854,7 @@ msgid "" "information. (Contributed by Larry Hastings in :issue:`19674`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1285 +#: ../../whatsnew/3.4.rst:1286 msgid "" "The :mod:`pydoc` module no longer displays the ``self`` parameter for " "already bound methods. Instead, it aims to always display the exact current " @@ -1863,7 +1862,7 @@ msgid "" "issue:`20710`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1290 +#: ../../whatsnew/3.4.rst:1291 msgid "" "In addition to the changes that have been made to :mod:`pydoc` directly, its " "handling of custom ``__dir__`` methods and various descriptor behaviours has " @@ -1871,17 +1870,17 @@ msgid "" "`inspect` module." msgstr "" -#: ../../whatsnew/3.4.rst:1295 +#: ../../whatsnew/3.4.rst:1296 msgid "" "As the :func:`help` builtin is based on :mod:`pydoc`, the above changes also " "affect the behaviour of :func:`help`." msgstr "" -#: ../../whatsnew/3.4.rst:1300 +#: ../../whatsnew/3.4.rst:1301 msgid "re" msgstr "re" -#: ../../whatsnew/3.4.rst:1302 +#: ../../whatsnew/3.4.rst:1303 msgid "" "New :func:`~re.fullmatch` function and :meth:`.regex.fullmatch` method " "anchor the pattern at both ends of the string to match. This provides a way " @@ -1891,7 +1890,7 @@ msgid "" "Barnett in :issue:`16203`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1309 +#: ../../whatsnew/3.4.rst:1310 msgid "" "The repr of :ref:`regex objects <re-objects>` now includes the pattern and " "the flags; the repr of :ref:`match objects <match-objects>` now includes the " @@ -1899,11 +1898,11 @@ msgid "" "Lopes Tavares and Serhiy Storchaka in :issue:`13592` and :issue:`17087`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1317 +#: ../../whatsnew/3.4.rst:1318 msgid "resource" msgstr "resource" -#: ../../whatsnew/3.4.rst:1319 +#: ../../whatsnew/3.4.rst:1320 msgid "" "New :func:`~resource.prlimit` function, available on Linux platforms with a " "kernel version of 2.6.36 or later and glibc of 2.13 or later, provides the " @@ -1911,7 +1910,7 @@ msgid "" "making the call. (Contributed by Christian Heimes in :issue:`16595`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1324 +#: ../../whatsnew/3.4.rst:1325 msgid "" "On Linux kernel version 2.6.36 or later, there are also some new Linux " "specific constants: :const:`~resource.RLIMIT_MSGQUEUE`, :const:`~resource." @@ -1920,18 +1919,18 @@ msgid "" "Christian Heimes in :issue:`19324`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1330 +#: ../../whatsnew/3.4.rst:1331 msgid "" "On FreeBSD version 9 and later, there some new FreeBSD specific constants: :" "const:`~resource.RLIMIT_SBSIZE`, :const:`~resource.RLIMIT_SWAP`, and :const:" "`~resource.RLIMIT_NPTS`. (Contributed by Claudiu Popa in :issue:`19343`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1337 +#: ../../whatsnew/3.4.rst:1338 msgid "select" msgstr "select" -#: ../../whatsnew/3.4.rst:1339 +#: ../../whatsnew/3.4.rst:1340 msgid "" ":class:`~select.epoll` objects now support the context management protocol. " "When used in a :keyword:`with` statement, the :meth:`~select.epoll.close` " @@ -1939,29 +1938,29 @@ msgid "" "by Serhiy Storchaka in :issue:`16488`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1344 +#: ../../whatsnew/3.4.rst:1345 msgid "" ":class:`~select.devpoll` objects now have :meth:`~select.devpoll.fileno` " "and :meth:`~select.devpoll.close` methods, as well as a new attribute :attr:" "`~select.devpoll.closed`. (Contributed by Victor Stinner in :issue:`18794`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1351 +#: ../../whatsnew/3.4.rst:1352 msgid "shelve" msgstr "shelve" -#: ../../whatsnew/3.4.rst:1353 +#: ../../whatsnew/3.4.rst:1354 msgid "" ":class:`~shelve.Shelf` instances may now be used in :keyword:`with` " "statements, and will be automatically closed at the end of the :keyword:`!" "with` block. (Contributed by Filip Gruszczyński in :issue:`13896`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1359 +#: ../../whatsnew/3.4.rst:1360 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.4.rst:1361 +#: ../../whatsnew/3.4.rst:1362 msgid "" ":func:`~shutil.copyfile` now raises a specific :exc:`~shutil.Error` " "subclass, :exc:`~shutil.SameFileError`, when the source and destination are " @@ -1970,11 +1969,11 @@ msgid "" "issue:`1492704`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1369 +#: ../../whatsnew/3.4.rst:1370 msgid "smtpd" msgstr "smtpd" -#: ../../whatsnew/3.4.rst:1371 +#: ../../whatsnew/3.4.rst:1372 msgid "" "The :class:`!SMTPServer` and :class:`!SMTPChannel` classes now accept a " "*map* keyword argument which, if specified, is passed in to :class:`!" @@ -1983,11 +1982,11 @@ msgid "" "issue:`11959`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1379 +#: ../../whatsnew/3.4.rst:1380 msgid "smtplib" msgstr "smtplib" -#: ../../whatsnew/3.4.rst:1381 +#: ../../whatsnew/3.4.rst:1382 msgid "" ":exc:`~smtplib.SMTPException` is now a subclass of :exc:`OSError`, which " "allows both socket level errors and SMTP protocol level errors to be caught " @@ -1995,45 +1994,45 @@ msgid "" "occurred. (Contributed by Ned Jackson Lovely in :issue:`2118`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1388 +#: ../../whatsnew/3.4.rst:1389 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.4.rst:1390 +#: ../../whatsnew/3.4.rst:1391 msgid "" "The socket module now supports the :const:`~socket.CAN_BCM` protocol on " "platforms that support it. (Contributed by Brian Thorne in :issue:`15359`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1393 +#: ../../whatsnew/3.4.rst:1394 msgid "" "Socket objects have new methods to get or set their :ref:`inheritable flag " "<fd_inheritance>`, :meth:`~socket.socket.get_inheritable` and :meth:`~socket." "socket.set_inheritable`." msgstr "" -#: ../../whatsnew/3.4.rst:1397 +#: ../../whatsnew/3.4.rst:1398 msgid "" "The ``socket.AF_*`` and ``socket.SOCK_*`` constants are now enumeration " "values using the new :mod:`enum` module. This allows meaningful names to be " "printed during debugging, instead of integer \"magic numbers\"." msgstr "" -#: ../../whatsnew/3.4.rst:1401 +#: ../../whatsnew/3.4.rst:1402 msgid "The :const:`~socket.AF_LINK` constant is now available on BSD and OSX." msgstr "" -#: ../../whatsnew/3.4.rst:1403 +#: ../../whatsnew/3.4.rst:1404 msgid "" ":func:`~socket.inet_pton` and :func:`~socket.inet_ntop` are now supported on " "Windows. (Contributed by Atsuo Ishimoto in :issue:`7171`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1408 +#: ../../whatsnew/3.4.rst:1409 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.4.rst:1410 +#: ../../whatsnew/3.4.rst:1411 msgid "" "A new boolean parameter to the :func:`~sqlite3.connect` function, *uri*, can " "be used to indicate that the *database* parameter is a ``uri`` (see the " @@ -2041,11 +2040,11 @@ msgid "" "(Contributed by poq in :issue:`13773`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1417 +#: ../../whatsnew/3.4.rst:1418 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.4.rst:1421 +#: ../../whatsnew/3.4.rst:1422 msgid "" ":data:`~ssl.PROTOCOL_TLSv1_1` and :data:`~ssl.PROTOCOL_TLSv1_2` (TLSv1.1 and " "TLSv1.2 support) have been added; support for these protocols is only " @@ -2053,7 +2052,7 @@ msgid "" "Michele Orrù and Antoine Pitrou in :issue:`16692`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1428 +#: ../../whatsnew/3.4.rst:1429 msgid "" "New function :func:`~ssl.create_default_context` provides a standard way to " "obtain an :class:`~ssl.SSLContext` whose settings are intended to be a " @@ -2067,7 +2066,7 @@ msgid "" "stdlib API. (Contributed by Christian Heimes in :issue:`19689`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1440 +#: ../../whatsnew/3.4.rst:1441 msgid "" ":class:`~ssl.SSLContext` method :meth:`~ssl.SSLContext." "load_verify_locations` accepts a new optional argument *cadata*, which can " @@ -2075,7 +2074,7 @@ msgid "" "bytes, respectively. (Contributed by Christian Heimes in :issue:`18138`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1445 +#: ../../whatsnew/3.4.rst:1446 msgid "" "New function :func:`~ssl.get_default_verify_paths` returns a named tuple of " "the paths and environment variables that the :meth:`~ssl.SSLContext." @@ -2084,7 +2083,7 @@ msgid "" "issues. (Contributed by Christian Heimes in :issue:`18143`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1452 +#: ../../whatsnew/3.4.rst:1453 msgid "" ":class:`~ssl.SSLContext` has a new method, :meth:`~ssl.SSLContext." "cert_store_stats`, that reports the number of loaded ``X.509`` certs, " @@ -2094,7 +2093,7 @@ msgid "" "`18147`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1459 +#: ../../whatsnew/3.4.rst:1460 msgid "" "If OpenSSL 0.9.8 or later is available, :class:`~ssl.SSLContext` has a new " "attribute :attr:`~ssl.SSLContext.verify_flags` that can be used to control " @@ -2105,7 +2104,7 @@ msgid "" "default. (Contributed by Christien Heimes in :issue:`8813`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1467 +#: ../../whatsnew/3.4.rst:1468 msgid "" "New :class:`~ssl.SSLContext` method :meth:`~ssl.SSLContext." "load_default_certs` loads a set of default \"certificate authority\" (CA) " @@ -2117,7 +2116,7 @@ msgid "" "by Christian Heimes in :issue:`19292`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1478 +#: ../../whatsnew/3.4.rst:1479 msgid "" "Two new windows-only functions, :func:`~ssl.enum_certificates` and :func:" "`~ssl.enum_crls` provide the ability to retrieve certificates, certificate " @@ -2125,14 +2124,14 @@ msgid "" "Christian Heimes in :issue:`17134`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1485 +#: ../../whatsnew/3.4.rst:1486 msgid "" "Support for server-side SNI (Server Name Indication) using the new :meth:" "`ssl.SSLContext.set_servername_callback` method. (Contributed by Daniel " "Black in :issue:`8109`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1489 +#: ../../whatsnew/3.4.rst:1490 msgid "" "The dictionary returned by :meth:`.SSLSocket.getpeercert` contains " "additional ``X509v3`` extension items: ``crlDistributionPoints``, " @@ -2140,29 +2139,29 @@ msgid "" "issue:`18379`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1495 +#: ../../whatsnew/3.4.rst:1496 msgid "stat" msgstr "stat" -#: ../../whatsnew/3.4.rst:1497 +#: ../../whatsnew/3.4.rst:1498 msgid "" "The :mod:`stat` module is now backed by a C implementation in :mod:`!_stat`. " "A C implementation is required as most of the values aren't standardized and " "are platform-dependent. (Contributed by Christian Heimes in :issue:`11016`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1501 +#: ../../whatsnew/3.4.rst:1502 msgid "" "The module supports new :mod:`~stat.ST_MODE` flags, :mod:`~stat.S_IFDOOR`, :" "const:`~stat.S_IFPORT`, and :const:`~stat.S_IFWHT`. (Contributed by " "Christian Hiemes in :issue:`11016`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1507 +#: ../../whatsnew/3.4.rst:1508 msgid "struct" msgstr "struct" -#: ../../whatsnew/3.4.rst:1509 +#: ../../whatsnew/3.4.rst:1510 msgid "" "New function :mod:`~struct.iter_unpack` and a new :meth:`struct.Struct." "iter_unpack` method on compiled formats provide streamed unpacking of a " @@ -2170,61 +2169,54 @@ msgid "" "by Antoine Pitrou in :issue:`17804`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1516 +#: ../../whatsnew/3.4.rst:1517 msgid "subprocess" msgstr "subprocess" -#: ../../whatsnew/3.4.rst:1518 +#: ../../whatsnew/3.4.rst:1519 msgid "" ":func:`~subprocess.check_output` now accepts an *input* argument that can be " "used to provide the contents of ``stdin`` for the command that is run. " "(Contributed by Zack Weinberg in :issue:`16624`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1522 +#: ../../whatsnew/3.4.rst:1523 msgid "" ":func:`~subprocess.getstatus` and :func:`~subprocess.getstatusoutput` now " "work on Windows. This change was actually inadvertently made in 3.3.4. " "(Contributed by Tim Golden in :issue:`10197`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1528 +#: ../../whatsnew/3.4.rst:1529 msgid "sunau" msgstr "sunau" -#: ../../whatsnew/3.4.rst:1530 +#: ../../whatsnew/3.4.rst:1531 msgid "" -"The :meth:`~sunau.getparams` method now returns a namedtuple rather than a " -"plain tuple. (Contributed by Claudiu Popa in :issue:`18901`.)" +"The :meth:`!getparams` method now returns a namedtuple rather than a plain " +"tuple. (Contributed by Claudiu Popa in :issue:`18901`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1533 +#: ../../whatsnew/3.4.rst:1534 msgid "" -":meth:`sunau.open` now supports the context management protocol: when used " +":meth:`!sunau.open` now supports the context management protocol: when used " "in a :keyword:`with` block, the ``close`` method of the returned object will " "be called automatically at the end of the block. (Contributed by Serhiy " "Storchaka in :issue:`18878`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1538 +#: ../../whatsnew/3.4.rst:1539 msgid "" ":meth:`.AU_write.setsampwidth` now supports 24 bit samples, thus adding " "support for writing 24 sample using the module. (Contributed by Serhiy " "Storchaka in :issue:`19261`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1542 -msgid "" -"The :meth:`~sunau.AU_write.writeframesraw` and :meth:`~sunau.AU_write." -"writeframes` methods now accept any :term:`bytes-like object`. (Contributed " -"by Serhiy Storchaka in :issue:`8311`.)" -msgstr "" - -#: ../../whatsnew/3.4.rst:1548 +#: ../../whatsnew/3.4.rst:1549 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.4.rst:1550 +#: ../../whatsnew/3.4.rst:1551 msgid "" "New function :func:`sys.getallocatedblocks` returns the current number of " "blocks allocated by the interpreter. (In CPython with the default ``--with-" @@ -2234,7 +2226,7 @@ msgid "" "in :issue:`13390`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1557 +#: ../../whatsnew/3.4.rst:1558 msgid "" "When the Python interpreter starts in :ref:`interactive mode <tut-" "interactive>`, it checks for an :data:`~sys.__interactivehook__` attribute " @@ -2250,11 +2242,11 @@ msgid "" "Araujo and Antoine Pitrou in :issue:`5845`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1572 +#: ../../whatsnew/3.4.rst:1573 msgid "tarfile" msgstr "tarfile" -#: ../../whatsnew/3.4.rst:1574 +#: ../../whatsnew/3.4.rst:1575 msgid "" "The :mod:`tarfile` module now supports a simple :ref:`tarfile-commandline` " "when called as a script directly or via ``-m``. This can be used to create " @@ -2262,11 +2254,11 @@ msgid "" "`13477`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1580 +#: ../../whatsnew/3.4.rst:1581 msgid "textwrap" msgstr "textwrap" -#: ../../whatsnew/3.4.rst:1582 +#: ../../whatsnew/3.4.rst:1583 msgid "" "The :class:`~textwrap.TextWrapper` class has two new attributes/constructor " "arguments: :attr:`~textwrap.TextWrapper.max_lines`, which limits the number " @@ -2280,11 +2272,11 @@ msgid "" "issue:`18725`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1594 +#: ../../whatsnew/3.4.rst:1595 msgid "threading" msgstr "threading" -#: ../../whatsnew/3.4.rst:1596 +#: ../../whatsnew/3.4.rst:1597 msgid "" "The :class:`~threading.Thread` object representing the main thread can be " "obtained from the new :func:`~threading.main_thread` function. In normal " @@ -2292,11 +2284,11 @@ msgid "" "started. (Contributed by Andrew Svetlov in :issue:`18882`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1603 +#: ../../whatsnew/3.4.rst:1604 msgid "traceback" msgstr "traceback" -#: ../../whatsnew/3.4.rst:1605 +#: ../../whatsnew/3.4.rst:1606 msgid "" "A new :func:`traceback.clear_frames` function takes a traceback object and " "clears the local variables in all of the frames it references, reducing the " @@ -2304,11 +2296,11 @@ msgid "" "`1565525`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1612 +#: ../../whatsnew/3.4.rst:1613 msgid "types" msgstr "types" -#: ../../whatsnew/3.4.rst:1614 +#: ../../whatsnew/3.4.rst:1615 msgid "" "A new :func:`~types.DynamicClassAttribute` descriptor provides a way to " "define an attribute that acts normally when looked up through an instance " @@ -2318,18 +2310,18 @@ msgid "" "for an example). (Contributed by Ethan Furman in :issue:`19030`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1623 +#: ../../whatsnew/3.4.rst:1624 msgid "urllib" msgstr "urllib" -#: ../../whatsnew/3.4.rst:1625 +#: ../../whatsnew/3.4.rst:1626 msgid "" ":mod:`urllib.request` now supports ``data:`` URLs via the :class:`~urllib." "request.DataHandler` class. (Contributed by Mathias Panzenböck in :issue:" "`16423`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1629 +#: ../../whatsnew/3.4.rst:1630 msgid "" "The http method that will be used by a :class:`~urllib.request.Request` " "class can now be specified by setting a :class:`~urllib.request.Request." @@ -2337,7 +2329,7 @@ msgid "" "issue:`18978`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1634 +#: ../../whatsnew/3.4.rst:1635 msgid "" ":class:`~urllib.request.Request` objects are now reusable: if the :attr:" "`~urllib.request.Request.full_url` or :attr:`~urllib.request.Request.data` " @@ -2352,7 +2344,7 @@ msgid "" "`17485`, and Damien Brecht and Senthil Kumaran in :issue:`17272`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1647 +#: ../../whatsnew/3.4.rst:1648 msgid "" ":class:`~urllib.error.HTTPError` objects now have a :attr:`~urllib.error." "HTTPError.headers` attribute that provides access to the HTTP response " @@ -2360,11 +2352,11 @@ msgid "" "`15701`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1654 +#: ../../whatsnew/3.4.rst:1655 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.4.rst:1656 +#: ../../whatsnew/3.4.rst:1657 msgid "" "The :class:`~unittest.TestCase` class has a new method, :meth:`~unittest." "TestCase.subTest`, that produces a context manager whose :keyword:`with` " @@ -2375,7 +2367,7 @@ msgid "" "of which will run even if one or more of them fail. For example::" msgstr "" -#: ../../whatsnew/3.4.rst:1664 +#: ../../whatsnew/3.4.rst:1665 msgid "" "class NumbersTest(unittest.TestCase):\n" " def test_even(self):\n" @@ -2389,7 +2381,7 @@ msgstr "" " with self.subTest(i=i):\n" " self.assertEqual(i % 2, 0)" -#: ../../whatsnew/3.4.rst:1670 +#: ../../whatsnew/3.4.rst:1671 msgid "" "will result in six subtests, each identified in the unittest verbose output " "with a label consisting of the variable name ``i`` and a particular value " @@ -2397,28 +2389,28 @@ msgid "" "version of this example. (Contributed by Antoine Pitrou in :issue:`16997`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1675 +#: ../../whatsnew/3.4.rst:1676 msgid "" ":func:`unittest.main` now accepts an iterable of test names for " "*defaultTest*, where previously it only accepted a single test name as a " "string. (Contributed by Jyrki Pulliainen in :issue:`15132`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1679 +#: ../../whatsnew/3.4.rst:1680 msgid "" "If :class:`~unittest.SkipTest` is raised during test discovery (that is, at " "the module level in the test file), it is now reported as a skip instead of " "an error. (Contributed by Zach Ware in :issue:`16935`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1683 +#: ../../whatsnew/3.4.rst:1684 msgid "" ":meth:`~unittest.TestLoader.discover` now sorts the discovered files to " "provide consistent test ordering. (Contributed by Martin Melin and Jeff " "Ramnani in :issue:`16709`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1687 +#: ../../whatsnew/3.4.rst:1688 msgid "" ":class:`~unittest.TestSuite` now drops references to tests as soon as the " "test has been run, if the test is successful. On Python interpreters that " @@ -2429,7 +2421,7 @@ msgid "" "Wardill, Matt McClure, and Andrew Svetlov in :issue:`11798`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1695 +#: ../../whatsnew/3.4.rst:1696 msgid "" "A new test assertion context-manager, :meth:`~unittest.TestCase.assertLogs`, " "will ensure that a given block of code emits a log message using the :mod:" @@ -2441,13 +2433,13 @@ msgid "" "in :issue:`18937`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1704 +#: ../../whatsnew/3.4.rst:1705 msgid "" "Test discovery now works with namespace packages (Contributed by Claudiu " "Popa in :issue:`17457`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1707 +#: ../../whatsnew/3.4.rst:1708 msgid "" ":mod:`unittest.mock` objects now inspect their specification signatures when " "matching calls, which means an argument can now be matched by either " @@ -2455,23 +2447,23 @@ msgid "" "Pitrou in :issue:`17015`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1712 +#: ../../whatsnew/3.4.rst:1713 msgid "" ":func:`~mock.mock_open` objects now have ``readline`` and ``readlines`` " "methods. (Contributed by Toshio Kuratomi in :issue:`17467`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1717 +#: ../../whatsnew/3.4.rst:1718 msgid "venv" msgstr "venv" -#: ../../whatsnew/3.4.rst:1719 +#: ../../whatsnew/3.4.rst:1720 msgid "" ":mod:`venv` now includes activation scripts for the ``csh`` and ``fish`` " "shells. (Contributed by Andrew Svetlov in :issue:`15417`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1722 +#: ../../whatsnew/3.4.rst:1723 msgid "" ":class:`~venv.EnvBuilder` and the :func:`~venv.create` convenience function " "take a new keyword argument *with_pip*, which defaults to ``False``, that " @@ -2480,47 +2472,47 @@ msgid "" "issue:`19552` as part of the :pep:`453` implementation.)" msgstr "" -#: ../../whatsnew/3.4.rst:1730 +#: ../../whatsnew/3.4.rst:1731 msgid "wave" msgstr "wave" -#: ../../whatsnew/3.4.rst:1732 +#: ../../whatsnew/3.4.rst:1733 msgid "" "The :meth:`~wave.getparams` method now returns a namedtuple rather than a " "plain tuple. (Contributed by Claudiu Popa in :issue:`17487`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1735 +#: ../../whatsnew/3.4.rst:1736 msgid "" ":meth:`wave.open` now supports the context management protocol. " "(Contributed by Claudiu Popa in :issue:`17616`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1738 +#: ../../whatsnew/3.4.rst:1739 msgid "" ":mod:`wave` can now :ref:`write output to unseekable files <wave-write-" "objects>`. (Contributed by David Jones, Guilherme Polo, and Serhiy " "Storchaka in :issue:`5202`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1742 +#: ../../whatsnew/3.4.rst:1743 msgid "" "The :meth:`~wave.Wave_write.writeframesraw` and :meth:`~wave.Wave_write." "writeframes` methods now accept any :term:`bytes-like object`. (Contributed " "by Serhiy Storchaka in :issue:`8311`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1748 +#: ../../whatsnew/3.4.rst:1749 msgid "weakref" msgstr "weakref" -#: ../../whatsnew/3.4.rst:1750 +#: ../../whatsnew/3.4.rst:1751 msgid "" "New :class:`~weakref.WeakMethod` class simulates weak references to bound " "methods. (Contributed by Antoine Pitrou in :issue:`14631`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1753 +#: ../../whatsnew/3.4.rst:1754 msgid "" "New :class:`~weakref.finalize` class makes it possible to register a " "callback to be invoked when an object is garbage collected, without needing " @@ -2528,18 +2520,18 @@ msgid "" "(Contributed by Richard Oudkerk in :issue:`15528`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1758 +#: ../../whatsnew/3.4.rst:1759 msgid "" "The callback, if any, associated with a :class:`~weakref.ref` is now exposed " "via the :attr:`~weakref.ref.__callback__` attribute. (Contributed by Mark " "Dickinson in :issue:`17643`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1764 +#: ../../whatsnew/3.4.rst:1765 msgid "xml.etree" msgstr "xml.etree" -#: ../../whatsnew/3.4.rst:1766 +#: ../../whatsnew/3.4.rst:1767 msgid "" "A new parser, :class:`~xml.etree.ElementTree.XMLPullParser`, allows a non-" "blocking applications to parse XML documents. An example can be seen at :" @@ -2547,7 +2539,7 @@ msgid "" "`17741`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1771 +#: ../../whatsnew/3.4.rst:1772 msgid "" "The :mod:`xml.etree.ElementTree` :func:`~xml.etree.ElementTree.tostring` " "and :func:`~xml.etree.ElementTree.tostringlist` functions, and the :class:" @@ -2559,11 +2551,11 @@ msgid "" "Storchaka in :issue:`14377`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1782 +#: ../../whatsnew/3.4.rst:1783 msgid "zipfile" msgstr "zipfile" -#: ../../whatsnew/3.4.rst:1784 +#: ../../whatsnew/3.4.rst:1785 msgid "" "The :meth:`~zipfile.PyZipFile.writepy` method of the :class:`~zipfile." "PyZipFile` class has a new *filterfunc* option that can be used to control " @@ -2572,36 +2564,36 @@ msgid "" "Christian Tismer in :issue:`19274`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1790 +#: ../../whatsnew/3.4.rst:1791 msgid "" "The *allowZip64* parameter to :class:`~zipfile.ZipFile` and :class:`~zipfile." "PyZipfile` is now ``True`` by default. (Contributed by William Mallard in :" "issue:`17201`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1797 +#: ../../whatsnew/3.4.rst:1798 msgid "CPython Implementation Changes" msgstr "CPython 實作變更" -#: ../../whatsnew/3.4.rst:1803 +#: ../../whatsnew/3.4.rst:1804 msgid "PEP 445: Customization of CPython Memory Allocators" msgstr "" -#: ../../whatsnew/3.4.rst:1805 +#: ../../whatsnew/3.4.rst:1806 msgid "" ":pep:`445` adds new C level interfaces to customize memory allocation in the " "CPython interpreter." msgstr "" -#: ../../whatsnew/3.4.rst:1810 +#: ../../whatsnew/3.4.rst:1811 msgid ":pep:`445` -- Add new APIs to customize Python memory allocators" msgstr "" -#: ../../whatsnew/3.4.rst:1817 +#: ../../whatsnew/3.4.rst:1818 msgid "PEP 442: Safe Object Finalization" msgstr "" -#: ../../whatsnew/3.4.rst:1819 +#: ../../whatsnew/3.4.rst:1820 msgid "" ":pep:`442` removes the current limitations and quirks of object finalization " "in CPython. With it, objects with :meth:`__del__` methods, as well as " @@ -2609,7 +2601,7 @@ msgid "" "part of a reference cycle." msgstr "" -#: ../../whatsnew/3.4.rst:1824 +#: ../../whatsnew/3.4.rst:1825 msgid "" "As part of this change, module globals are no longer forcibly set to :const:" "`None` during interpreter shutdown in most cases, instead relying on the " @@ -2618,15 +2610,15 @@ msgid "" "that have plagued Python since the cyclic GC was first introduced." msgstr "" -#: ../../whatsnew/3.4.rst:1833 +#: ../../whatsnew/3.4.rst:1834 msgid ":pep:`442` -- Safe object finalization" msgstr "" -#: ../../whatsnew/3.4.rst:1840 +#: ../../whatsnew/3.4.rst:1841 msgid "PEP 456: Secure and Interchangeable Hash Algorithm" msgstr "" -#: ../../whatsnew/3.4.rst:1842 +#: ../../whatsnew/3.4.rst:1843 msgid "" ":pep:`456` follows up on earlier security fix work done on Python's hash " "algorithm to address certain DOS attacks to which public facing APIs backed " @@ -2638,18 +2630,18 @@ msgid "" "comparison with the older FNV algorithm are trivial." msgstr "" -#: ../../whatsnew/3.4.rst:1851 +#: ../../whatsnew/3.4.rst:1852 msgid "" "The PEP adds additional fields to the :data:`sys.hash_info` named tuple to " "describe the hash algorithm in use by the currently executing binary. " "Otherwise, the PEP does not alter any existing CPython APIs." msgstr "" -#: ../../whatsnew/3.4.rst:1859 +#: ../../whatsnew/3.4.rst:1860 msgid "PEP 436: Argument Clinic" msgstr "" -#: ../../whatsnew/3.4.rst:1861 +#: ../../whatsnew/3.4.rst:1862 msgid "" "\"Argument Clinic\" (:pep:`436`) is now part of the CPython build process " "and can be used to simplify the process of defining and maintaining accurate " @@ -2657,21 +2649,21 @@ msgid "" "in C." msgstr "" -#: ../../whatsnew/3.4.rst:1866 +#: ../../whatsnew/3.4.rst:1867 msgid "" "Some standard library extension modules have been converted to use Argument " "Clinic in Python 3.4, and :mod:`pydoc` and :mod:`inspect` have been updated " "accordingly." msgstr "" -#: ../../whatsnew/3.4.rst:1870 +#: ../../whatsnew/3.4.rst:1871 msgid "" "It is expected that signature metadata for programmatic introspection will " "be added to additional callables implemented in C as part of Python 3.4 " "maintenance releases." msgstr "" -#: ../../whatsnew/3.4.rst:1875 +#: ../../whatsnew/3.4.rst:1876 msgid "" "The Argument Clinic PEP is not fully up to date with the state of the " "implementation. This has been deemed acceptable by the release manager and " @@ -2679,61 +2671,61 @@ msgid "" "available as a public API for third party use in Python 3.4." msgstr "" -#: ../../whatsnew/3.4.rst:1882 +#: ../../whatsnew/3.4.rst:1883 msgid ":pep:`436` -- The Argument Clinic DSL" msgstr "" -#: ../../whatsnew/3.4.rst:1883 +#: ../../whatsnew/3.4.rst:1884 msgid "PEP written and implemented by Larry Hastings." msgstr "由 Larry Hastings 撰寫 PEP 與實作。" -#: ../../whatsnew/3.4.rst:1887 +#: ../../whatsnew/3.4.rst:1888 msgid "Other Build and C API Changes" msgstr "" -#: ../../whatsnew/3.4.rst:1889 +#: ../../whatsnew/3.4.rst:1890 msgid "" "The new :c:func:`PyType_GetSlot` function has been added to the stable ABI, " "allowing retrieval of function pointers from named type slots when using the " "limited API. (Contributed by Martin von Löwis in :issue:`17162`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1893 +#: ../../whatsnew/3.4.rst:1894 msgid "" -"The new :c:func:`Py_SetStandardStreamEncoding` pre-initialization API allows " -"applications embedding the CPython interpreter to reliably force a " +"The new :c:func:`!Py_SetStandardStreamEncoding` pre-initialization API " +"allows applications embedding the CPython interpreter to reliably force a " "particular encoding and error handler for the standard streams. (Contributed " "by Bastien Montagne and Nick Coghlan in :issue:`16129`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1898 +#: ../../whatsnew/3.4.rst:1899 msgid "" "Most Python C APIs that don't mutate string arguments are now correctly " "marked as accepting ``const char *`` rather than ``char *``. (Contributed " "by Serhiy Storchaka in :issue:`1772673`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1902 +#: ../../whatsnew/3.4.rst:1903 msgid "" "A new shell version of ``python-config`` can be used even when a python " "interpreter is not available (for example, in cross compilation scenarios)." msgstr "" -#: ../../whatsnew/3.4.rst:1905 +#: ../../whatsnew/3.4.rst:1906 msgid "" ":c:func:`PyUnicode_FromFormat` now supports width and precision " "specifications for ``%s``, ``%A``, ``%U``, ``%V``, ``%S``, and ``%R``. " "(Contributed by Ysj Ray and Victor Stinner in :issue:`7330`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1909 +#: ../../whatsnew/3.4.rst:1910 msgid "" "New function :c:func:`PyStructSequence_InitType2` supplements the existing :" "c:func:`PyStructSequence_InitType` function. The difference is that it " "returns ``0`` on success and ``-1`` on failure." msgstr "" -#: ../../whatsnew/3.4.rst:1913 +#: ../../whatsnew/3.4.rst:1914 msgid "" "The CPython source can now be compiled using the address sanity checking " "features of recent versions of GCC and clang: the false alarms in the small " @@ -2741,7 +2733,7 @@ msgid "" "`18596`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1918 +#: ../../whatsnew/3.4.rst:1919 msgid "" "The Windows build now uses `Address Space Layout Randomization <https://en." "wikipedia.org/wiki/Address_space_layout_randomization>`_ and `Data Execution " @@ -2749,17 +2741,17 @@ msgid "" "(Contributed by Christian Heimes in :issue:`16632`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1923 +#: ../../whatsnew/3.4.rst:1924 msgid "" "New function :c:func:`PyObject_LengthHint` is the C API equivalent of :func:" "`operator.length_hint`. (Contributed by Armin Ronacher in :issue:`16148`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1931 +#: ../../whatsnew/3.4.rst:1932 msgid "Other Improvements" msgstr "" -#: ../../whatsnew/3.4.rst:1935 +#: ../../whatsnew/3.4.rst:1936 msgid "" "The :ref:`python <using-on-cmdline>` command has a new :ref:`option <using-" "on-misc-options>`, ``-I``, which causes it to run in \"isolated mode\", " @@ -2773,7 +2765,7 @@ msgid "" "scripts. (Contributed by Christian Heimes in :issue:`16499`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1946 +#: ../../whatsnew/3.4.rst:1947 msgid "" "Tab-completion is now enabled by default in the interactive interpreter on " "systems that support :mod:`readline`. History is also enabled by default, " @@ -2781,7 +2773,7 @@ msgid "" "(Contributed by Antoine Pitrou and Éric Araujo in :issue:`5845`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1951 +#: ../../whatsnew/3.4.rst:1952 msgid "" "Invoking the Python interpreter with ``--version`` now outputs the version " "to standard output instead of standard error (:issue:`18338`). Similar " @@ -2789,7 +2781,7 @@ msgid "" "have script-like invocation capabilities (:issue:`18922`)." msgstr "" -#: ../../whatsnew/3.4.rst:1956 +#: ../../whatsnew/3.4.rst:1957 msgid "" "The CPython Windows installer now adds ``.py`` to the :envvar:`PATHEXT` " "variable when extensions are registered, allowing users to run a python " @@ -2797,40 +2789,40 @@ msgid "" "py`` extension. (Contributed by Paul Moore in :issue:`18569`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1961 +#: ../../whatsnew/3.4.rst:1962 msgid "" "A new ``make`` target `coverage-report <https://devguide.python.org/coverage/" "#measuring-coverage-of-c-code-with-gcov-and-lcov>`_ will build python, run " "the test suite, and generate an HTML coverage report for the C codebase " -"using ``gcov`` and `lcov <https://github.com/linux-test-project/lcov>`_." +"using ``gcov`` and `lcov <https://ltp.sourceforge.net/coverage/lcov.php>`_." msgstr "" -#: ../../whatsnew/3.4.rst:1967 +#: ../../whatsnew/3.4.rst:1968 msgid "" "The ``-R`` option to the :ref:`python regression test suite <regrtest>` now " "also checks for memory allocation leaks, using :func:`sys." "getallocatedblocks`. (Contributed by Antoine Pitrou in :issue:`13390`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1972 +#: ../../whatsnew/3.4.rst:1973 msgid "``python -m`` now works with namespace packages." msgstr "" -#: ../../whatsnew/3.4.rst:1974 +#: ../../whatsnew/3.4.rst:1975 msgid "" "The :mod:`stat` module is now implemented in C, which means it gets the " "values for its constants from the C header files, instead of having the " "values hard-coded in the python module as was previously the case." msgstr "" -#: ../../whatsnew/3.4.rst:1978 +#: ../../whatsnew/3.4.rst:1979 msgid "" "Loading multiple python modules from a single OS module (``.so``, ``.dll``) " "now works correctly (previously it silently returned the first python module " "in the file). (Contributed by Václav Šmilauer in :issue:`16421`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1982 +#: ../../whatsnew/3.4.rst:1983 msgid "" "A new opcode, :opcode:`LOAD_CLASSDEREF`, has been added to fix a bug in the " "loading of free variables in class bodies that could be triggered by certain " @@ -2838,21 +2830,21 @@ msgid "" "issue:`17853`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1987 +#: ../../whatsnew/3.4.rst:1988 msgid "" "A number of MemoryError-related crashes were identified and fixed by Victor " "Stinner using his :pep:`445`-based ``pyfailmalloc`` tool (:issue:`18408`, :" "issue:`18520`)." msgstr "" -#: ../../whatsnew/3.4.rst:1991 +#: ../../whatsnew/3.4.rst:1992 msgid "" "The ``pyvenv`` command now accepts a ``--copies`` option to use copies " "rather than symlinks even on systems where symlinks are the default. " "(Contributed by Vinay Sajip in :issue:`18807`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1995 +#: ../../whatsnew/3.4.rst:1996 msgid "" "The ``pyvenv`` command also accepts a ``--without-pip`` option to suppress " "the otherwise-automatic bootstrapping of pip into the virtual environment. " @@ -2860,7 +2852,7 @@ msgid "" "implementation.)" msgstr "" -#: ../../whatsnew/3.4.rst:2000 +#: ../../whatsnew/3.4.rst:2001 msgid "" "The encoding name is now optional in the value set for the :envvar:" "`PYTHONIOENCODING` environment variable. This makes it possible to set just " @@ -2868,24 +2860,24 @@ msgid "" "Serhiy Storchaka in :issue:`18818`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2005 +#: ../../whatsnew/3.4.rst:2006 msgid "" "The :mod:`bz2`, :mod:`lzma`, and :mod:`gzip` module ``open`` functions now " "support ``x`` (exclusive creation) mode. (Contributed by Tim Heaney and " "Vajrasky Kok in :issue:`19201`, :issue:`19222`, and :issue:`19223`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2011 +#: ../../whatsnew/3.4.rst:2012 msgid "Significant Optimizations" msgstr "顯著最佳化" -#: ../../whatsnew/3.4.rst:2013 +#: ../../whatsnew/3.4.rst:2014 msgid "" "The UTF-32 decoder is now 3x to 4x faster. (Contributed by Serhiy Storchaka " "in :issue:`14625`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2016 +#: ../../whatsnew/3.4.rst:2017 msgid "" "The cost of hash collisions for sets is now reduced. Each hash table probe " "now checks a series of consecutive, adjacent key/hash pairs before " @@ -2898,7 +2890,7 @@ msgid "" "Raymond Hettinger in :issue:`18771`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2027 +#: ../../whatsnew/3.4.rst:2028 msgid "" "The interpreter starts about 30% faster. A couple of measures lead to the " "speedup. The interpreter loads fewer modules on startup, e.g. the :mod:" @@ -2909,27 +2901,27 @@ msgid "" "`19209`, :issue:`19205` and :issue:`9548`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2035 +#: ../../whatsnew/3.4.rst:2036 msgid "" ":class:`bz2.BZ2File` is now as fast or faster than the Python2 version for " "most cases. :class:`lzma.LZMAFile` has also been optimized. (Contributed " "by Serhiy Storchaka and Nadeem Vawda in :issue:`16034`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2039 +#: ../../whatsnew/3.4.rst:2040 msgid "" ":func:`random.getrandbits` is 20%-40% faster for small integers (the most " "common use case). (Contributed by Serhiy Storchaka in :issue:`16674`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2042 +#: ../../whatsnew/3.4.rst:2043 msgid "" "By taking advantage of the new storage format for strings, pickling of " "strings is now significantly faster. (Contributed by Victor Stinner and " "Antoine Pitrou in :issue:`15596`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2046 +#: ../../whatsnew/3.4.rst:2047 msgid "" "A performance issue in :meth:`io.FileIO.readall` has been solved. This " "particularly affects Windows, and significantly speeds up the case of piping " @@ -2937,31 +2929,31 @@ msgid "" "Richard Oudkerk in :issue:`15758`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2051 +#: ../../whatsnew/3.4.rst:2052 msgid "" ":func:`html.escape` is now 10x faster. (Contributed by Matt Bryant in :" "issue:`18020`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2054 +#: ../../whatsnew/3.4.rst:2055 msgid "" "On Windows, the native ``VirtualAlloc`` is now used instead of the CRT " "``malloc`` in ``obmalloc``. Artificial benchmarks show about a 3% memory " "savings." msgstr "" -#: ../../whatsnew/3.4.rst:2058 +#: ../../whatsnew/3.4.rst:2059 msgid "" ":func:`os.urandom` now uses a lazily opened persistent file descriptor so as " "to avoid using many file descriptors when run in parallel from multiple " "threads. (Contributed by Antoine Pitrou in :issue:`18756`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2066 +#: ../../whatsnew/3.4.rst:2067 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.4.rst:2068 +#: ../../whatsnew/3.4.rst:2069 msgid "" "This section covers various APIs and other features that have been " "deprecated in Python 3.4, and will be removed in Python 3.5 or later. In " @@ -2970,11 +2962,11 @@ msgid "" "enabled (for example, by using ``-Wd``)." msgstr "" -#: ../../whatsnew/3.4.rst:2076 +#: ../../whatsnew/3.4.rst:2077 msgid "Deprecations in the Python API" msgstr "" -#: ../../whatsnew/3.4.rst:2078 +#: ../../whatsnew/3.4.rst:2079 msgid "" "As mentioned in :ref:`whatsnew-pep-451`, a number of :mod:`importlib` " "methods and functions are deprecated: :meth:`!importlib.find_loader` is " @@ -2997,45 +2989,45 @@ msgid "" "now handled automatically by the import system." msgstr "" -#: ../../whatsnew/3.4.rst:2103 +#: ../../whatsnew/3.4.rst:2104 msgid "" "The :mod:`!imp` module is pending deprecation. To keep compatibility with " "Python 2/3 code bases, the module's removal is currently not scheduled." msgstr "" -#: ../../whatsnew/3.4.rst:2106 +#: ../../whatsnew/3.4.rst:2107 msgid "" "The :mod:`formatter` module is pending deprecation and is slated for removal " "in Python 3.6." msgstr "" -#: ../../whatsnew/3.4.rst:2109 +#: ../../whatsnew/3.4.rst:2110 msgid "" "``MD5`` as the default *digestmod* for the :func:`hmac.new` function is " "deprecated. Python 3.6 will require an explicit digest name or constructor " "as *digestmod* argument." msgstr "" -#: ../../whatsnew/3.4.rst:2113 +#: ../../whatsnew/3.4.rst:2114 msgid "" "The internal ``Netrc`` class in the :mod:`ftplib` module has been documented " "as deprecated in its docstring for quite some time. It now emits a :exc:" "`DeprecationWarning` and will be removed completely in Python 3.5." msgstr "" -#: ../../whatsnew/3.4.rst:2117 +#: ../../whatsnew/3.4.rst:2118 msgid "" "The undocumented *endtime* argument to :meth:`subprocess.Popen.wait` should " "not have been exposed and is hopefully not in use; it is deprecated and will " "mostly likely be removed in Python 3.5." msgstr "" -#: ../../whatsnew/3.4.rst:2121 +#: ../../whatsnew/3.4.rst:2122 msgid "" "The *strict* argument of :class:`~html.parser.HTMLParser` is deprecated." msgstr "" -#: ../../whatsnew/3.4.rst:2123 +#: ../../whatsnew/3.4.rst:2124 msgid "" "The :mod:`plistlib` :func:`~plistlib.readPlist`, :func:`~plistlib." "writePlist`, :func:`~plistlib.readPlistFromBytes`, and :func:`~plistlib." @@ -3045,13 +3037,13 @@ msgid "" "deprecated in favor of just using the :class:`bytes` constructor." msgstr "" -#: ../../whatsnew/3.4.rst:2130 +#: ../../whatsnew/3.4.rst:2131 msgid "" "The :mod:`sysconfig` key ``SO`` is deprecated, it has been replaced by " "``EXT_SUFFIX``." msgstr "" -#: ../../whatsnew/3.4.rst:2133 +#: ../../whatsnew/3.4.rst:2134 msgid "" "The ``U`` mode accepted by various ``open`` functions is deprecated. In " "Python3 it does not do anything useful, and should be replaced by " @@ -3059,7 +3051,7 @@ msgid "" "argument." msgstr "" -#: ../../whatsnew/3.4.rst:2138 +#: ../../whatsnew/3.4.rst:2139 msgid "" "The *parser* argument of :func:`xml.etree.ElementTree.iterparse` has been " "deprecated, as has the *html* argument of :func:`~xml.etree.ElementTree." @@ -3067,97 +3059,97 @@ msgid "" "``XMLParser`` should be passed by keyword." msgstr "" -#: ../../whatsnew/3.4.rst:2145 +#: ../../whatsnew/3.4.rst:2146 msgid "Deprecated Features" msgstr "已棄用功能" -#: ../../whatsnew/3.4.rst:2147 +#: ../../whatsnew/3.4.rst:2148 msgid "" "Running :ref:`idle` with the ``-n`` flag (no subprocess) is deprecated. " "However, the feature will not be removed until :issue:`18823` is resolved." msgstr "" -#: ../../whatsnew/3.4.rst:2150 +#: ../../whatsnew/3.4.rst:2151 msgid "" "The site module adding a \"site-python\" directory to sys.path, if it " "exists, is deprecated (:issue:`19375`)." msgstr "" -#: ../../whatsnew/3.4.rst:2156 +#: ../../whatsnew/3.4.rst:2157 msgid "Removed" msgstr "已移除" -#: ../../whatsnew/3.4.rst:2160 +#: ../../whatsnew/3.4.rst:2161 msgid "Operating Systems No Longer Supported" msgstr "" -#: ../../whatsnew/3.4.rst:2162 +#: ../../whatsnew/3.4.rst:2163 msgid "" "Support for the following operating systems has been removed from the source " "and build tools:" msgstr "" -#: ../../whatsnew/3.4.rst:2165 +#: ../../whatsnew/3.4.rst:2166 msgid "OS/2 (:issue:`16135`)." msgstr "OS/2 (:issue:`16135`)。" -#: ../../whatsnew/3.4.rst:2166 +#: ../../whatsnew/3.4.rst:2167 msgid "Windows 2000 (changeset e52df05b496a)." msgstr "" -#: ../../whatsnew/3.4.rst:2167 +#: ../../whatsnew/3.4.rst:2168 msgid "" "Windows systems where ``COMSPEC`` points to ``command.com`` (:issue:`14470`)." msgstr "" -#: ../../whatsnew/3.4.rst:2168 +#: ../../whatsnew/3.4.rst:2169 msgid "VMS (:issue:`16136`)." msgstr "VMS (:issue:`16136`)。" -#: ../../whatsnew/3.4.rst:2172 +#: ../../whatsnew/3.4.rst:2173 msgid "API and Feature Removals" msgstr "API 與功能的移除" -#: ../../whatsnew/3.4.rst:2174 +#: ../../whatsnew/3.4.rst:2175 msgid "" "The following obsolete and previously deprecated APIs and features have been " "removed:" msgstr "" -#: ../../whatsnew/3.4.rst:2177 +#: ../../whatsnew/3.4.rst:2178 msgid "" "The unmaintained ``Misc/TextMate`` and ``Misc/vim`` directories have been " "removed (see the `devguide <https://devguide.python.org>`_ for suggestions " "on what to use instead)." msgstr "" -#: ../../whatsnew/3.4.rst:2181 +#: ../../whatsnew/3.4.rst:2182 msgid "" "The ``SO`` makefile macro is removed (it was replaced by the " "``SHLIB_SUFFIX`` and ``EXT_SUFFIX`` macros) (:issue:`16754`)." msgstr "" -#: ../../whatsnew/3.4.rst:2184 +#: ../../whatsnew/3.4.rst:2185 msgid "" "The ``PyThreadState.tick_counter`` field has been removed; its value has " "been meaningless since Python 3.2, when the \"new GIL\" was introduced (:" "issue:`19199`)." msgstr "" -#: ../../whatsnew/3.4.rst:2188 +#: ../../whatsnew/3.4.rst:2189 msgid "" "``PyLoader`` and ``PyPycLoader`` have been removed from :mod:`importlib`. " "(Contributed by Taras Lyapun in :issue:`15641`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2191 +#: ../../whatsnew/3.4.rst:2192 msgid "" "The *strict* argument to :class:`~http.client.HTTPConnection` and :class:" "`~http.client.HTTPSConnection` has been removed. HTTP 0.9-style \"Simple " "Responses\" are no longer supported." msgstr "" -#: ../../whatsnew/3.4.rst:2195 +#: ../../whatsnew/3.4.rst:2196 msgid "" "The deprecated :mod:`urllib.request.Request` getter and setter methods " "``add_data``, ``has_data``, ``get_data``, ``get_type``, ``get_host``, " @@ -3165,19 +3157,19 @@ msgid "" "``is_unverifiable`` have been removed (use direct attribute access instead)." msgstr "" -#: ../../whatsnew/3.4.rst:2200 +#: ../../whatsnew/3.4.rst:2201 msgid "" "Support for loading the deprecated ``TYPE_INT64`` has been removed from :mod:" "`marshal`. (Contributed by Dan Riti in :issue:`15480`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2203 +#: ../../whatsnew/3.4.rst:2204 msgid "" ":class:`inspect.Signature`: positional-only parameters are now required to " "have a valid name." msgstr "" -#: ../../whatsnew/3.4.rst:2206 +#: ../../whatsnew/3.4.rst:2207 msgid "" ":meth:`object.__format__` no longer accepts non-empty format strings, it now " "raises a :exc:`TypeError` instead. Using a non-empty string has been " @@ -3189,7 +3181,7 @@ msgid "" "`7994` for background." msgstr "" -#: ../../whatsnew/3.4.rst:2215 +#: ../../whatsnew/3.4.rst:2216 msgid "" ":meth:`difflib.SequenceMatcher.isbjunk` and :meth:`difflib.SequenceMatcher." "isbpopular` were deprecated in 3.2, and have now been removed: use ``x in sm." @@ -3197,17 +3189,17 @@ msgid "" "SequenceMatcher` object (:issue:`13248`)." msgstr "" -#: ../../whatsnew/3.4.rst:2223 +#: ../../whatsnew/3.4.rst:2224 msgid "Code Cleanups" msgstr "程式碼的清除" -#: ../../whatsnew/3.4.rst:2225 +#: ../../whatsnew/3.4.rst:2226 msgid "" "The unused and undocumented internal ``Scanner`` class has been removed from " "the :mod:`pydoc` module." msgstr "" -#: ../../whatsnew/3.4.rst:2228 +#: ../../whatsnew/3.4.rst:2229 msgid "" "The private and effectively unused ``_gestalt`` module has been removed, " "along with the private :mod:`platform` functions ``_mac_ver_lookup``, " @@ -3215,27 +3207,27 @@ msgid "" "called on badly broken OSX systems (see :issue:`18393`)." msgstr "" -#: ../../whatsnew/3.4.rst:2233 +#: ../../whatsnew/3.4.rst:2234 msgid "" "The hardcoded copies of certain :mod:`stat` constants that were included in " "the :mod:`tarfile` module namespace have been removed." msgstr "" -#: ../../whatsnew/3.4.rst:2239 +#: ../../whatsnew/3.4.rst:2240 msgid "Porting to Python 3.4" msgstr "" -#: ../../whatsnew/3.4.rst:2241 +#: ../../whatsnew/3.4.rst:2242 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.4.rst:2246 +#: ../../whatsnew/3.4.rst:2247 msgid "Changes in 'python' Command Behavior" msgstr "" -#: ../../whatsnew/3.4.rst:2248 +#: ../../whatsnew/3.4.rst:2249 msgid "" "In a posix shell, setting the :envvar:`PATH` environment variable to an " "empty value is equivalent to not setting it at all. However, setting :" @@ -3246,25 +3238,25 @@ msgid "" "for :envvar:`PATH`." msgstr "" -#: ../../whatsnew/3.4.rst:2256 +#: ../../whatsnew/3.4.rst:2257 msgid "" "The [X refs, Y blocks] output of a debug (``--with-pydebug``) build of the " "CPython interpreter is now off by default. It can be re-enabled using the " "``-X showrefcount`` option. (Contributed by Ezio Melotti in :issue:`17323`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2260 +#: ../../whatsnew/3.4.rst:2261 msgid "" "The python command and most stdlib scripts (as well as :mod:`argparse`) now " "output ``--version`` information to ``stdout`` instead of ``stderr`` (for " "issue list see :ref:`other-improvements-3.4` above)." msgstr "" -#: ../../whatsnew/3.4.rst:2266 +#: ../../whatsnew/3.4.rst:2267 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.4.rst:2268 +#: ../../whatsnew/3.4.rst:2269 msgid "" "The ABCs defined in :mod:`importlib.abc` now either raise the appropriate " "exception or return a default value instead of raising :exc:" @@ -3273,7 +3265,7 @@ msgid "" "catch both :exc:`NotImplementedError` or the appropriate exception as needed." msgstr "" -#: ../../whatsnew/3.4.rst:2274 +#: ../../whatsnew/3.4.rst:2275 msgid "" "The module type now initializes the :attr:`__package__` and :attr:" "`__loader__` attributes to ``None`` by default. To determine if these " @@ -3281,7 +3273,7 @@ msgid "" "``getattr(module, '__loader__', None) is not None``. (:issue:`17115`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2279 +#: ../../whatsnew/3.4.rst:2280 msgid "" ":meth:`!importlib.util.module_for_loader` now sets ``__loader__`` and " "``__package__`` unconditionally to properly support reloading. If this is " @@ -3289,7 +3281,7 @@ msgid "" "use :func:`importlib.util.module_to_load` for module management." msgstr "" -#: ../../whatsnew/3.4.rst:2284 +#: ../../whatsnew/3.4.rst:2285 msgid "" "Import now resets relevant attributes (e.g. ``__name__``, ``__loader__``, " "``__package__``, ``__file__``, ``__cached__``) unconditionally when " @@ -3297,7 +3289,7 @@ msgid "" "module is re-found when re-loaded (:issue:`19413`)." msgstr "" -#: ../../whatsnew/3.4.rst:2289 +#: ../../whatsnew/3.4.rst:2290 msgid "" "Frozen packages no longer set ``__path__`` to a list containing the package " "name, they now set it to an empty list. The previous behavior could cause " @@ -3307,7 +3299,7 @@ msgid "" "'__path__')`` (:issue:`18065`)." msgstr "" -#: ../../whatsnew/3.4.rst:2296 +#: ../../whatsnew/3.4.rst:2297 msgid "" "Frozen modules no longer define a ``__file__`` attribute. It's semantically " "incorrect for frozen modules to set the attribute as they are not loaded " @@ -3318,7 +3310,7 @@ msgid "" "use :func:`!imp.is_frozen`." msgstr "" -#: ../../whatsnew/3.4.rst:2304 +#: ../../whatsnew/3.4.rst:2305 msgid "" ":func:`py_compile.compile` now raises :exc:`FileExistsError` if the file " "path it would write to is a symlink or a non-regular file. This is to act as " @@ -3326,7 +3318,7 @@ msgid "" "regardless of what type of file path they were originally." msgstr "" -#: ../../whatsnew/3.4.rst:2309 +#: ../../whatsnew/3.4.rst:2310 msgid "" ":meth:`importlib.abc.SourceLoader.get_source` no longer raises :exc:" "`ImportError` when the source code being loaded triggers a :exc:" @@ -3338,7 +3330,7 @@ msgid "" "exceptions now." msgstr "" -#: ../../whatsnew/3.4.rst:2318 +#: ../../whatsnew/3.4.rst:2319 msgid "" ":func:`functools.update_wrapper` and :func:`functools.wraps` now correctly " "set the ``__wrapped__`` attribute to the function being wrapped, even if " @@ -3350,7 +3342,7 @@ msgid "" "function in the chain that has no ``__wrapped__`` attribute." msgstr "" -#: ../../whatsnew/3.4.rst:2328 +#: ../../whatsnew/3.4.rst:2329 msgid "" ":func:`inspect.getfullargspec` has been reimplemented on top of :func:" "`inspect.signature` and hence handles a much wider variety of callable " @@ -3360,7 +3352,7 @@ msgid "" "will fail on non-Python callables may need to be adjusted accordingly." msgstr "" -#: ../../whatsnew/3.4.rst:2336 +#: ../../whatsnew/3.4.rst:2337 msgid "" ":class:`importlib.machinery.PathFinder` now passes on the current working " "directory to objects in :data:`sys.path_hooks` for the empty string. This " @@ -3374,7 +3366,7 @@ msgid "" "`18416`)." msgstr "" -#: ../../whatsnew/3.4.rst:2347 +#: ../../whatsnew/3.4.rst:2348 msgid "" "The removal of the *strict* argument to :class:`~http.client.HTTPConnection` " "and :class:`~http.client.HTTPSConnection` changes the meaning of the " @@ -3383,7 +3375,7 @@ msgid "" "should already be specifying any additional arguments via keywords." msgstr "" -#: ../../whatsnew/3.4.rst:2353 +#: ../../whatsnew/3.4.rst:2354 msgid "" "Strings between ``from __future__ import ...`` statements now *always* raise " "a :exc:`SyntaxError`. Previously if there was no leading docstring, an " @@ -3392,7 +3384,7 @@ msgid "" "`17434`)." msgstr "" -#: ../../whatsnew/3.4.rst:2359 +#: ../../whatsnew/3.4.rst:2360 msgid "" ":meth:`ssl.SSLSocket.getpeercert` and :meth:`ssl.SSLSocket.do_handshake` now " "raise an :exc:`OSError` with ``ENOTCONN`` when the ``SSLSocket`` is not " @@ -3401,7 +3393,7 @@ msgid "" "raise a :exc:`ValueError` if the handshake has not yet been done." msgstr "" -#: ../../whatsnew/3.4.rst:2365 +#: ../../whatsnew/3.4.rst:2366 msgid "" ":func:`base64.b32decode` now raises a :exc:`binascii.Error` when the input " "string contains non-b32-alphabet characters, instead of a :exc:`TypeError`. " @@ -3410,25 +3402,24 @@ msgid "" "`18011`.) Note: this change was also inadvertently applied in Python 3.3.3." msgstr "" -#: ../../whatsnew/3.4.rst:2372 +#: ../../whatsnew/3.4.rst:2373 msgid "" -"The :attr:`~cgi.FieldStorage.file` attribute is now automatically closed " -"when the creating :class:`cgi.FieldStorage` instance is garbage collected. " -"If you were pulling the file object out separately from the :class:`cgi." -"FieldStorage` instance and not keeping the instance alive, then you should " -"either store the entire :class:`cgi.FieldStorage` instance or read the " -"contents of the file before the :class:`cgi.FieldStorage` instance is " -"garbage collected." +"The :attr:`!file` attribute is now automatically closed when the creating :" +"class:`!cgi.FieldStorage` instance is garbage collected. If you were pulling " +"the file object out separately from the :class:`!cgi.FieldStorage` instance " +"and not keeping the instance alive, then you should either store the entire :" +"class:`!cgi.FieldStorage` instance or read the contents of the file before " +"the :class:`!cgi.FieldStorage` instance is garbage collected." msgstr "" -#: ../../whatsnew/3.4.rst:2379 +#: ../../whatsnew/3.4.rst:2380 msgid "" "Calling ``read`` or ``write`` on a closed SSL socket now raises an " "informative :exc:`ValueError` rather than the previous more mysterious :exc:" "`AttributeError` (:issue:`9177`)." msgstr "" -#: ../../whatsnew/3.4.rst:2383 +#: ../../whatsnew/3.4.rst:2384 msgid "" ":meth:`slice.indices` no longer produces an :exc:`OverflowError` for huge " "values. As a consequence of this fix, :meth:`slice.indices` now raises a :" @@ -3436,7 +3427,7 @@ msgid "" "values (:issue:`14794`)." msgstr "" -#: ../../whatsnew/3.4.rst:2388 +#: ../../whatsnew/3.4.rst:2389 msgid "" "The :class:`complex` constructor, unlike the :mod:`cmath` functions, was " "incorrectly accepting :class:`float` values if an object's ``__complex__`` " @@ -3444,21 +3435,21 @@ msgid "" "`16290`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2393 +#: ../../whatsnew/3.4.rst:2394 msgid "" "The :class:`int` constructor in 3.2 and 3.3 erroneously accepts :class:" "`float` values for the *base* parameter. It is unlikely anyone was doing " "this, but if so, it will now raise a :exc:`TypeError` (:issue:`16772`)." msgstr "" -#: ../../whatsnew/3.4.rst:2397 +#: ../../whatsnew/3.4.rst:2398 msgid "" "Defaults for keyword-only arguments are now evaluated *after* defaults for " "regular keyword arguments, instead of before. Hopefully no one wrote any " "code that depends on the previous buggy behavior (:issue:`16967`)." msgstr "" -#: ../../whatsnew/3.4.rst:2401 +#: ../../whatsnew/3.4.rst:2402 msgid "" "Stale thread states are now cleared after :func:`~os.fork`. This may cause " "some system resources to be released that previously were incorrectly kept " @@ -3466,21 +3457,21 @@ msgid "" "storage). (:issue:`17094`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2406 +#: ../../whatsnew/3.4.rst:2407 msgid "" "Parameter names in ``__annotations__`` dicts are now mangled properly, " "similarly to :attr:`~function.__kwdefaults__`. (Contributed by Yury " "Selivanov in :issue:`20625`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2410 +#: ../../whatsnew/3.4.rst:2411 msgid "" ":attr:`hashlib.hash.name` now always returns the identifier in lower case. " "Previously some builtin hashes had uppercase names, but now that it is a " "formal public interface the naming has been made consistent (:issue:`18532`)." msgstr "" -#: ../../whatsnew/3.4.rst:2414 +#: ../../whatsnew/3.4.rst:2415 msgid "" "Because :mod:`unittest.TestSuite` now drops references to tests after they " "are run, test harnesses that reuse a :class:`~unittest.TestSuite` to re-run " @@ -3493,7 +3484,7 @@ msgid "" "__iter__`) (:issue:`11798`)." msgstr "" -#: ../../whatsnew/3.4.rst:2424 +#: ../../whatsnew/3.4.rst:2425 msgid "" ":mod:`unittest` now uses :mod:`argparse` for command line parsing. There " "are certain invalid command forms that used to work that are no longer " @@ -3502,7 +3493,7 @@ msgid "" "use." msgstr "" -#: ../../whatsnew/3.4.rst:2429 +#: ../../whatsnew/3.4.rst:2430 msgid "" "The :func:`re.split`, :func:`re.findall`, and :func:`re.sub` functions, and " "the :meth:`~re.match.group` and :meth:`~re.match.groups` methods of " @@ -3512,13 +3503,13 @@ msgid "" "say, a ``bytearray``, you will need to change your code." msgstr "" -#: ../../whatsnew/3.4.rst:2436 +#: ../../whatsnew/3.4.rst:2437 msgid "" -":mod:`audioop` functions now raise an error immediately if passed string " +":mod:`!audioop` functions now raise an error immediately if passed string " "input, instead of failing randomly later on (:issue:`16685`)." msgstr "" -#: ../../whatsnew/3.4.rst:2439 +#: ../../whatsnew/3.4.rst:2440 msgid "" "The new *convert_charrefs* argument to :class:`~html.parser.HTMLParser` " "currently defaults to ``False`` for backward compatibility, but will " @@ -3527,14 +3518,14 @@ msgid "" "HTMLParser` calls in your code (:issue:`13633`)." msgstr "" -#: ../../whatsnew/3.4.rst:2445 +#: ../../whatsnew/3.4.rst:2446 msgid "" "Since the *digestmod* argument to the :func:`hmac.new` function will in the " "future have no default, all calls to :func:`hmac.new` should be changed to " "explicitly specify a *digestmod* (:issue:`17276`)." msgstr "" -#: ../../whatsnew/3.4.rst:2449 +#: ../../whatsnew/3.4.rst:2450 msgid "" "Calling :func:`sysconfig.get_config_var` with the ``SO`` key, or looking " "``SO`` up in the results of a call to :func:`sysconfig.get_config_vars` is " @@ -3542,7 +3533,7 @@ msgid "" "``SHLIB_SUFFIX``, depending on the context (:issue:`19555`)." msgstr "" -#: ../../whatsnew/3.4.rst:2454 +#: ../../whatsnew/3.4.rst:2455 msgid "" "Any calls to ``open`` functions that specify ``U`` should be modified. ``U`` " "is ineffective in Python3 and will eventually raise an error if used. " @@ -3552,13 +3543,13 @@ msgid "" "`15204`)." msgstr "" -#: ../../whatsnew/3.4.rst:2461 +#: ../../whatsnew/3.4.rst:2462 msgid "" "If you use ``pyvenv`` in a script and desire that pip *not* be installed, " "you must add ``--without-pip`` to your command invocation." msgstr "" -#: ../../whatsnew/3.4.rst:2465 +#: ../../whatsnew/3.4.rst:2466 msgid "" "The default behavior of :func:`json.dump` and :func:`json.dumps` when an " "indent is specified has changed: it no longer produces trailing spaces after " @@ -3567,7 +3558,7 @@ msgid "" "output (:issue:`16333`)." msgstr "" -#: ../../whatsnew/3.4.rst:2471 +#: ../../whatsnew/3.4.rst:2472 msgid "" ":mod:`doctest` now looks for doctests in extension module ``__doc__`` " "strings, so if your doctest test discovery includes extension modules that " @@ -3575,7 +3566,7 @@ msgid "" "never seen before when running your tests (:issue:`3158`)." msgstr "" -#: ../../whatsnew/3.4.rst:2476 +#: ../../whatsnew/3.4.rst:2477 msgid "" "The :mod:`collections.abc` module has been slightly refactored as part of " "the Python startup improvements. As a consequence of this, it is no longer " @@ -3585,11 +3576,11 @@ msgid "" "`20784`)." msgstr "" -#: ../../whatsnew/3.4.rst:2485 +#: ../../whatsnew/3.4.rst:2486 msgid "Changes in the C API" msgstr "C API 中的改動" -#: ../../whatsnew/3.4.rst:2487 +#: ../../whatsnew/3.4.rst:2488 msgid "" ":c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr`, and :c:func:" "`PyObject_Str`, along with some other internal C APIs, now include a " @@ -3603,14 +3594,14 @@ msgid "" "version of Python that is compiled with assertions enabled." msgstr "" -#: ../../whatsnew/3.4.rst:2499 +#: ../../whatsnew/3.4.rst:2500 msgid "" ":c:func:`PyErr_SetImportError` now sets :exc:`TypeError` when its **msg** " "argument is not set. Previously only ``NULL`` was returned with no exception " "set." msgstr "" -#: ../../whatsnew/3.4.rst:2503 +#: ../../whatsnew/3.4.rst:2504 msgid "" "The result of the :c:data:`PyOS_ReadlineFunctionPointer` callback must now " "be a string allocated by :c:func:`PyMem_RawMalloc` or :c:func:" @@ -3619,30 +3610,30 @@ msgid "" "`16742`)" msgstr "" -#: ../../whatsnew/3.4.rst:2509 +#: ../../whatsnew/3.4.rst:2510 msgid "" ":c:func:`PyThread_set_key_value` now always set the value. In Python 3.3, " "the function did nothing if the key already exists (if the current value is " "a non-``NULL`` pointer)." msgstr "" -#: ../../whatsnew/3.4.rst:2513 +#: ../../whatsnew/3.4.rst:2514 msgid "" "The ``f_tstate`` (thread state) field of the :c:type:`PyFrameObject` " "structure has been removed to fix a bug: see :issue:`14432` for the " "rationale." msgstr "" -#: ../../whatsnew/3.4.rst:2518 +#: ../../whatsnew/3.4.rst:2519 msgid "Changed in 3.4.3" msgstr "3.4.3 中的變更" -#: ../../whatsnew/3.4.rst:2523 +#: ../../whatsnew/3.4.rst:2524 msgid "" "PEP 476: Enabling certificate verification by default for stdlib http clients" msgstr "" -#: ../../whatsnew/3.4.rst:2525 +#: ../../whatsnew/3.4.rst:2526 msgid "" ":mod:`http.client` and modules which use it, such as :mod:`urllib.request` " "and :mod:`xmlrpc.client`, will now verify that the server presents a " @@ -3651,13 +3642,13 @@ msgid "" "improving security for many applications." msgstr "" -#: ../../whatsnew/3.4.rst:2531 +#: ../../whatsnew/3.4.rst:2532 msgid "" "For applications which require the old previous behavior, they can pass an " "alternate context::" msgstr "" -#: ../../whatsnew/3.4.rst:2534 +#: ../../whatsnew/3.4.rst:2535 msgid "" "import urllib.request\n" "import ssl\n" diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index 334f9a4baf..00e2e09a2f 100644 --- a/whatsnew/3.5.po +++ b/whatsnew/3.5.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1376,8 +1376,8 @@ msgstr "cgi" #: ../../whatsnew/3.5.rst:881 msgid "" -"The :class:`~cgi.FieldStorage` class now supports the :term:`context " -"manager` protocol. (Contributed by Berker Peksag in :issue:`20289`.)" +"The :class:`!FieldStorage` class now supports the :term:`context manager` " +"protocol. (Contributed by Berker Peksag in :issue:`20289`.)" msgstr "" #: ../../whatsnew/3.5.rst:886 @@ -1952,9 +1952,9 @@ msgstr "imghdr" #: ../../whatsnew/3.5.rst:1255 msgid "" -"The :func:`~imghdr.what` function now recognizes the `OpenEXR <https://www." -"openexr.com>`_ format (contributed by Martin Vignali and Claudiu Popa in :" -"issue:`20295`), and the `WebP <https://en.wikipedia.org/wiki/WebP>`_ format " +"The :func:`!what` function now recognizes the `OpenEXR <https://www.openexr." +"com>`_ format (contributed by Martin Vignali and Claudiu Popa in :issue:" +"`20295`), and the `WebP <https://en.wikipedia.org/wiki/WebP>`_ format " "(contributed by Fabrice Aneche and Claudiu Popa in :issue:`20197`.)" msgstr "" @@ -2685,9 +2685,8 @@ msgstr "sndhdr" #: ../../whatsnew/3.5.rst:1717 msgid "" -"The :func:`~sndhdr.what` and :func:`~sndhdr.whathdr` functions now return " -"a :func:`~collections.namedtuple`. (Contributed by Claudiu Popa in :issue:" -"`18615`.)" +"The :func:`!what` and :func:`!whathdr` functions now return a :func:" +"`~collections.namedtuple`. (Contributed by Claudiu Popa in :issue:`18615`.)" msgstr "" #: ../../whatsnew/3.5.rst:1723 @@ -3240,7 +3239,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:2099 msgid "" -"Many functions in the :mod:`mmap`, :mod:`ossaudiodev`, :mod:`socket`, :mod:" +"Many functions in the :mod:`mmap`, :mod:`!ossaudiodev`, :mod:`socket`, :mod:" "`ssl`, and :mod:`codecs` modules now accept writable :term:`bytes-like " "objects <bytes-like object>`. (Contributed by Serhiy Storchaka in :issue:" "`23001`.)" diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index e8e6ac0774..e3ad5e1ef2 100644 --- a/whatsnew/3.6.po +++ b/whatsnew/3.6.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -2228,7 +2228,7 @@ msgstr "telnetlib" #: ../../whatsnew/3.6.rst:1527 msgid "" -":class:`~telnetlib.Telnet` is now a context manager (contributed by Stéphane " +":class:`!telnetlib.Telnet` is now a context manager (contributed by Stéphane " "Wirtel in :issue:`25485`)." msgstr "" @@ -3017,7 +3017,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:2056 msgid "" -"The :mod:`tkinter.tix` module is now deprecated. :mod:`tkinter` users " +"The :mod:`!tkinter.tix` module is now deprecated. :mod:`tkinter` users " "should use :mod:`tkinter.ttk` instead." msgstr "" @@ -3224,7 +3224,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:2200 msgid "" "The following modules have had missing APIs added to their :attr:`__all__` " -"attributes to match the documented APIs: :mod:`calendar`, :mod:`cgi`, :mod:" +"attributes to match the documented APIs: :mod:`calendar`, :mod:`!cgi`, :mod:" "`csv`, :mod:`~xml.etree.ElementTree`, :mod:`enum`, :mod:`fileinput`, :mod:" "`ftplib`, :mod:`logging`, :mod:`mailbox`, :mod:`mimetypes`, :mod:" "`optparse`, :mod:`plistlib`, :mod:`!smtpd`, :mod:`subprocess`, :mod:" @@ -3260,7 +3260,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:2228 msgid "" -":func:`spwd.getspnam` now raises a :exc:`PermissionError` instead of :exc:" +":func:`!spwd.getspnam` now raises a :exc:`PermissionError` instead of :exc:" "`KeyError` if the user doesn't have privileges." msgstr "" @@ -3351,9 +3351,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:2291 msgid "" -"The :const:`crypt.METHOD_CRYPT` will no longer be added to ``crypt.methods`` " -"if unsupported by the platform. (Contributed by Victor Stinner in :issue:" -"`25287`.)" +"The :const:`!crypt.METHOD_CRYPT` will no longer be added to ``crypt." +"methods`` if unsupported by the platform. (Contributed by Victor Stinner in :" +"issue:`25287`.)" msgstr "" #: ../../whatsnew/3.6.rst:2299 @@ -3607,8 +3607,8 @@ msgid "" "parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." "parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " "recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`cgi.parse` and :" -"func:`cgi.parse_multipart` as they use the affected functions internally. " +"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" +"func:`!cgi.parse_multipart` as they use the affected functions internally. " "For more details, please see their respective documentation. (Contributed by " "Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" msgstr "" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index 3d7002fd00..c1c198bda7 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -531,9 +531,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:356 msgid "" -":pep:`Measurements <0564#annex-clocks-resolution-in-python>` show that on " -"Linux and Windows the resolution of :func:`time.time_ns` is approximately 3 " -"times better than that of :func:`time.time`." +"`Measurements <https://peps.python.org/pep-0564/#annex-clocks-resolution-in-" +"python>`_ show that on Linux and Windows the resolution of :func:`time." +"time_ns` is approximately 3 times better than that of :func:`time.time`." msgstr "" #: ../../whatsnew/3.7.rst:362 @@ -1219,14 +1219,14 @@ msgstr "crypt" #: ../../whatsnew/3.7.rst:851 msgid "" -"The :mod:`crypt` module now supports the Blowfish hashing method. " +"The :mod:`!crypt` module now supports the Blowfish hashing method. " "(Contributed by Serhiy Storchaka in :issue:`31664`.)" msgstr "" #: ../../whatsnew/3.7.rst:854 msgid "" -"The :func:`~crypt.mksalt` function now allows specifying the number of " -"rounds for hashing. (Contributed by Serhiy Storchaka in :issue:`31702`.)" +"The :func:`!mksalt` function now allows specifying the number of rounds for " +"hashing. (Contributed by Serhiy Storchaka in :issue:`31702`.)" msgstr "" #: ../../whatsnew/3.7.rst:859 @@ -1628,9 +1628,8 @@ msgstr "msilib" #: ../../whatsnew/3.7.rst:1136 msgid "" -"The new :meth:`Database.Close() <msilib.Database.Close>` method can be used " -"to close the :abbr:`MSI` database. (Contributed by Berker Peksag in :issue:" -"`20486`.)" +"The new :meth:`!Database.Close` method can be used to close the :abbr:`MSI` " +"database. (Contributed by Berker Peksag in :issue:`20486`.)" msgstr "" #: ../../whatsnew/3.7.rst:1142 @@ -2221,7 +2220,7 @@ msgstr "uu" #: ../../whatsnew/3.7.rst:1554 msgid "" -"The :func:`uu.encode` function now accepts an optional *backtick* keyword " +"The :func:`!uu.encode` function now accepts an optional *backtick* keyword " "argument. When it's true, zeros are represented by ``'`'`` instead of " "spaces. (Contributed by Xiang Zhang in :issue:`30103`.)" msgstr "" @@ -2836,8 +2835,8 @@ msgstr "aifc" #: ../../whatsnew/3.7.rst:1956 msgid "" -":func:`aifc.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`aifc.open` instead. (Contributed by Brian Curtin in :issue:" +":func:`!aifc.openfp` has been deprecated and will be removed in Python 3.9. " +"Use :func:`!aifc.open` instead. (Contributed by Brian Curtin in :issue:" "`31985`.)" msgstr "" @@ -2958,8 +2957,8 @@ msgstr "sunau" #: ../../whatsnew/3.7.rst:2077 msgid "" -":func:`sunau.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`sunau.open` instead. (Contributed by Brian Curtin in :issue:" +":func:`!sunau.openfp` has been deprecated and will be removed in Python 3.9. " +"Use :func:`!sunau.open` instead. (Contributed by Brian Curtin in :issue:" "`31985`.)" msgstr "" @@ -3321,7 +3320,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:2320 msgid "" -":func:`~cgi.parse_multipart` now accepts the *encoding* and *errors* " +":func:`!cgi.parse_multipart` now accepts the *encoding* and *errors* " "arguments and returns the same results as :class:`!FieldStorage`: for non-" "file fields, the value associated to a key is a list of strings, not bytes. " "(Contributed by Pierre Quentel in :issue:`29979`.)" @@ -3584,15 +3583,15 @@ msgstr "" #: ../../whatsnew/3.7.rst:2511 msgid "" -":c:func:`PySys_AddWarnOptionUnicode` is not currently usable by embedding " +":c:func:`!PySys_AddWarnOptionUnicode` is not currently usable by embedding " "applications due to the requirement to create a Unicode object prior to " -"calling ``Py_Initialize``. Use :c:func:`PySys_AddWarnOption` instead." +"calling ``Py_Initialize``. Use :c:func:`!PySys_AddWarnOption` instead." msgstr "" #: ../../whatsnew/3.7.rst:2515 msgid "" -"warnings filters added by an embedding application with :c:func:" -"`PySys_AddWarnOption` should now more consistently take precedence over the " +"warnings filters added by an embedding application with :c:func:`!" +"PySys_AddWarnOption` should now more consistently take precedence over the " "default filters set by the interpreter" msgstr "" @@ -3689,8 +3688,8 @@ msgid "" "parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." "parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " "recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`cgi.parse` and :" -"func:`cgi.parse_multipart` as they use the affected functions internally. " +"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" +"func:`!cgi.parse_multipart` as they use the affected functions internally. " "For more details, please see their respective documentation. (Contributed by " "Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" msgstr "" diff --git a/whatsnew/3.8.po b/whatsnew/3.8.po index 1ec080c04d..15f3d8d588 100644 --- a/whatsnew/3.8.po +++ b/whatsnew/3.8.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-19 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2783,7 +2783,7 @@ msgid "" "Starting with Python 3.3, importing ABCs from :mod:`collections` was " "deprecated, and importing should be done from :mod:`collections.abc`. Being " "able to import from collections was marked for removal in 3.8, but has been " -"delayed to 3.9. (See :gh:`81134`.)" +"delayed to 3.9. (See :issue:`36952`.)" msgstr "" #: ../../whatsnew/3.8.rst:1760 @@ -2816,7 +2816,7 @@ msgstr "" #: ../../whatsnew/3.8.rst:1777 msgid "" -"``parse_qs``, ``parse_qsl``, and ``escape`` are removed from the :mod:`cgi` " +"``parse_qs``, ``parse_qsl``, and ``escape`` are removed from the :mod:`!cgi` " "module. They are deprecated in Python 3.2 or older. They should be imported " "from the ``urllib.parse`` and ``html`` modules instead." msgstr "" @@ -3595,8 +3595,8 @@ msgid "" "parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." "parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " "recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`cgi.parse` and :" -"func:`cgi.parse_multipart` as they use the affected functions internally. " +"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" +"func:`!cgi.parse_multipart` as they use the affected functions internally. " "For more details, please see their respective documentation. (Contributed by " "Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" msgstr "" diff --git a/whatsnew/3.9.po b/whatsnew/3.9.po index 668cc5e06d..96ce53c7f5 100644 --- a/whatsnew/3.9.po +++ b/whatsnew/3.9.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -107,16 +107,16 @@ msgstr "" #: ../../whatsnew/3.9.rst:84 msgid "" -"a number of Python modules (:mod:`!_abc`, :mod:`audioop`, :mod:`!_bz2`, :mod:" -"`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!_functools`, :mod:`!" -"_json`, :mod:`!_locale`, :mod:`math`, :mod:`operator`, :mod:`resource`, :mod:" -"`time`, :mod:`!_weakref`) now use multiphase initialization as defined by " -"PEP 489;" +"a number of Python modules (:mod:`!_abc`, :mod:`!audioop`, :mod:`!_bz2`, :" +"mod:`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!_functools`, :" +"mod:`!_json`, :mod:`!_locale`, :mod:`math`, :mod:`operator`, :mod:" +"`resource`, :mod:`time`, :mod:`!_weakref`) now use multiphase initialization " +"as defined by PEP 489;" msgstr "" #: ../../whatsnew/3.9.rst:89 msgid "" -"a number of standard library modules (:mod:`audioop`, :mod:`ast`, :mod:" +"a number of standard library modules (:mod:`!audioop`, :mod:`ast`, :mod:" "`grp`, :mod:`!_hashlib`, :mod:`pwd`, :mod:`!_posixsubprocess`, :mod:" "`random`, :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) are now " "using the stable ABI defined by PEP 384." @@ -897,10 +897,9 @@ msgstr "nntplib" #: ../../whatsnew/3.9.rst:585 msgid "" -":class:`~nntplib.NNTP` and :class:`~nntplib.NNTP_SSL` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`!NNTP` and :class:`!NNTP_SSL` now raise a :class:`ValueError` if the " +"given timeout for their constructor is zero to prevent the creation of a non-" +"blocking socket. (Contributed by Donghee Na in :issue:`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:590 @@ -1536,12 +1535,12 @@ msgstr "" #: ../../whatsnew/3.9.rst:934 msgid "" -"The :mod:`lib2to3` module now emits a :exc:`PendingDeprecationWarning`. " +"The :mod:`!lib2to3` module now emits a :exc:`PendingDeprecationWarning`. " "Python 3.9 switched to a PEG parser (see :pep:`617`), and Python 3.10 may " "include new language syntax that is not parsable by lib2to3's LL(1) parser. " -"The ``lib2to3`` module may be removed from the standard library in a future " -"Python version. Consider third-party alternatives such as `LibCST`_ or " -"`parso`_. (Contributed by Carl Meyer in :issue:`40360`.)" +"The :mod:`!lib2to3` module may be removed from the standard library in a " +"future Python version. Consider third-party alternatives such as `LibCST`_ " +"or `parso`_. (Contributed by Carl Meyer in :issue:`40360`.)" msgstr "" #: ../../whatsnew/3.9.rst:942 @@ -1561,11 +1560,11 @@ msgstr "" #: ../../whatsnew/3.9.rst:955 msgid "" -":class:`nntplib.NNTP`: ``xpath()`` and ``xgtitle()`` methods have been " +":class:`!nntplib.NNTP`: ``xpath()`` and ``xgtitle()`` methods have been " "removed. These methods are deprecated since Python 3.3. Generally, these " "extensions are not supported or not enabled by NNTP server administrators. " -"For ``xgtitle()``, please use :meth:`nntplib.NNTP.descriptions` or :meth:" -"`nntplib.NNTP.description` instead. (Contributed by Donghee Na in :issue:" +"For ``xgtitle()``, please use :meth:`!nntplib.NNTP.descriptions` or :meth:`!" +"nntplib.NNTP.description` instead. (Contributed by Donghee Na in :issue:" "`39366`.)" msgstr "" @@ -2531,8 +2530,8 @@ msgid "" "parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." "parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " "recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`cgi.parse` and :" -"func:`cgi.parse_multipart` as they use the affected functions internally. " +"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" +"func:`!cgi.parse_multipart` as they use the affected functions internally. " "For more details, please see their respective documentation. (Contributed by " "Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" msgstr "" diff --git a/whatsnew/index.po b/whatsnew/index.po index 750ee6edc1..3d82a190e0 100644 --- a/whatsnew/index.po +++ b/whatsnew/index.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-16 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-07-07 11:37+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,7 +35,7 @@ msgstr "" "的重大改變的地方。對於希望在新版本釋出時立即了解版本差異的使用者們來說,這些" "說明被歸類為「必讀」的等級。" -#: ../../whatsnew/index.rst:36 +#: ../../whatsnew/index.rst:37 msgid "" "The \"Changelog\" is an HTML version of the :pypi:`file built<blurb>` from " "the contents of the :source:`Misc/NEWS.d` directory tree, which contains " From e0f7a22380ecf479835b2838b679840004de9b4a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 12:22:13 +0800 Subject: [PATCH 15/89] build(deps): bump JamesIves/github-pages-deploy-action from 4.6.3 to 4.6.4 (#960) Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.6.3 to 4.6.4. - [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases) - [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.6.3...v4.6.4) --- updated-dependencies: - dependency-name: JamesIves/github-pages-deploy-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/deploy-gh-page.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-gh-page.yml b/.github/workflows/deploy-gh-page.yml index e06e7a4581..3ccd22d104 100644 --- a/.github/workflows/deploy-gh-page.yml +++ b/.github/workflows/deploy-gh-page.yml @@ -18,7 +18,7 @@ jobs: run: make all - name: Deploy to gh page - uses: JamesIves/github-pages-deploy-action@v4.6.3 + uses: JamesIves/github-pages-deploy-action@v4.6.4 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BRANCH: gh-pages From 0313a637a30633bbb32082494cf30daad16ff7a7 Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" <mattwang44@gmail.com> Date: Mon, 23 Sep 2024 12:29:39 +0800 Subject: [PATCH 16/89] chore(gitignore): add venv artifacts to gitignore --- .gitignore | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index 185f2c0f70..948c289ec6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,12 @@ *.mo __pycache__ .DS_Store + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ From 23c3e90ae5fa8270c54c203d15414b684d5440c4 Mon Sep 17 00:00:00 2001 From: CA <ca1025@gmail.com> Date: Mon, 23 Sep 2024 14:41:19 +0800 Subject: [PATCH 17/89] Translate library/numeric.po (#964) --- library/numeric.po | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/numeric.po b/library/numeric.po index f95652f63e..064f8e0530 100644 --- a/library/numeric.po +++ b/library/numeric.po @@ -32,7 +32,11 @@ msgid "" "mod:`decimal` module supports exact representations of decimal numbers, " "using arbitrary precision arithmetic." msgstr "" +"本章所描述的模組提供了數值和與數學相關的函式和資料型別。:mod:`numbers` 模組定" +"義了數值型別的抽象階層結構。:mod:`math` 和 :mod:`cmath` 模組包含了用於浮點數" +"和複數的各種數學函式。:mod:`decimal` 模組支援對十進位數字的精確表示以及任意精" +"度的算術運算。" #: ../../library/numeric.rst:15 msgid "The following modules are documented in this chapter:" -msgstr "" +msgstr "本章節包含下列的模組:" From 15714a9bc1a120c8d6033a9607f71a86c5187532 Mon Sep 17 00:00:00 2001 From: CA <ca1025@gmail.com> Date: Mon, 23 Sep 2024 15:04:51 +0800 Subject: [PATCH 18/89] Translate library/i18n.po (#965) * Translate library/i18n.po * polish translation for library/i18n.po --- library/i18n.po | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/i18n.po b/library/i18n.po index c05c2ed1c1..e2fd6fc3c2 100644 --- a/library/i18n.po +++ b/library/i18n.po @@ -30,6 +30,8 @@ msgid "" "language to be used in program messages or by tailoring output to match " "local conventions." msgstr "" +"本章所描述的模組透過提供用於程式訊息中語言的選擇機制或是調整輸出以符合當地慣" +"例,來幫助你編寫不依賴語言和地區設定的軟體" #: ../../library/i18n.rst:12 msgid "The list of modules described in this chapter is:" From 0f715693f35633669ebb41c5ab89796a73e01ec1 Mon Sep 17 00:00:00 2001 From: Winnie <winniepopu@gmail.com> Date: Mon, 23 Sep 2024 15:05:11 +0800 Subject: [PATCH 19/89] Translate library/importLib (#966) * interpret one of the purpose part in importLib * fix the name format of "import" * Apply suggestions from code review Fix the statements of translation Co-authored-by: Wei-Hsiang (Matt) Wang <mattwang44@gmail.com> --------- Co-authored-by: Wei-Hsiang (Matt) Wang <mattwang44@gmail.com> --- library/importlib.po | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/importlib.po b/library/importlib.po index 093b6063c0..4ce7485363 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -32,7 +32,7 @@ msgstr "簡介" #: ../../library/importlib.rst:20 msgid "The purpose of the :mod:`importlib` package is three-fold." -msgstr "" +msgstr ":mod:`importlib` 的目的可分為三個部分。" #: ../../library/importlib.rst:22 msgid "" @@ -43,6 +43,9 @@ msgid "" "to comprehend than one implemented in a programming language other than " "Python." msgstr "" +"第一是提供 Python 原始碼中 :keyword:`import` 陳述式的實作(因此,也延伸到 :" +"func:`__import__` 函式)。這讓 :keyword:`!import` 實作可以移植到任何 Python " +"直譯器。同時,這也提供了一個比用其他程式語言實作更容易理解的版本。 " #: ../../library/importlib.rst:29 msgid "" From 8f1374e6051434c0139563ba446595c47f69ca27 Mon Sep 17 00:00:00 2001 From: PoChuan994 <62919709+PoChuan994@users.noreply.github.com> Date: Mon, 23 Sep 2024 15:05:33 +0800 Subject: [PATCH 20/89] translate c-api/float.po (#969) Co-authored-by: PoChuan <pochuan994@gmail.com> --- c-api/float.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c-api/float.po b/c-api/float.po index b2e2875073..3c2eff7ff2 100644 --- a/c-api/float.po +++ b/c-api/float.po @@ -159,7 +159,7 @@ msgstr "" #: ../../c-api/float.rst:122 msgid "``-0.0`` and ``+0.0`` produce the same bytes string." -msgstr "" +msgstr "``-0.0`` 和 ``+0.0`` 會產生同樣的位元組字串。" #: ../../c-api/float.rst:126 msgid "Pack a C double as the IEEE 754 binary16 half-precision format." From 8d20b5d05bfa5f4f16506558c705e06ec7f1d535 Mon Sep 17 00:00:00 2001 From: SamLiaoP <sam.liao.dev@gmail.com> Date: Mon, 23 Sep 2024 15:20:26 +0800 Subject: [PATCH 21/89] Translate /c-api/dict.rst:48 (#968) * Translate /c-api/dict.rst:48 * Apply suggestions from code review Co-authored-by: Wei-Hsiang (Matt) Wang <mattwang44@gmail.com> --------- Co-authored-by: Wei-Hsiang (Matt) Wang <mattwang44@gmail.com> --- c-api/dict.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c-api/dict.po b/c-api/dict.po index 2905a63507..5a9c30db1f 100644 --- a/c-api/dict.po +++ b/c-api/dict.po @@ -66,7 +66,7 @@ msgstr "" #: ../../c-api/dict.rst:48 msgid "Empty an existing dictionary of all key-value pairs." -msgstr "" +msgstr "清空現有字典中的所有鍵值對。" #: ../../c-api/dict.rst:53 msgid "" From 55a06286596b6864f722a9614cd4b133a852cb75 Mon Sep 17 00:00:00 2001 From: CA <ca1025@gmail.com> Date: Mon, 23 Sep 2024 16:28:39 +0800 Subject: [PATCH 22/89] Translate library/development.po (#971) --- library/development.po | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/development.po b/library/development.po index ef66cf89b2..0272023235 100644 --- a/library/development.po +++ b/library/development.po @@ -31,7 +31,10 @@ msgid "" "contains frameworks for writing unit tests that automatically exercise code " "and verify that the expected output is produced." msgstr "" +"本章所描述的模組可以幫助你編寫軟體。例如 :mod:`pydoc` 模組可以根據模組的內容" +"生成文件;:mod:`doctest` 和 :mod:`unittest` 模組則包含編寫單元測試的框架,這" +"些測試程式碼會自動執行並驗證輸出結果是否正確。" #: ../../library/development.rst:13 msgid "The list of modules described in this chapter is:" -msgstr "" +msgstr "本章節所描述的模組列表為:" From 879b6b960f8b0f8d8a0c0382c0acd7c3122ed2f3 Mon Sep 17 00:00:00 2001 From: CA <ca1025@gmail.com> Date: Mon, 23 Sep 2024 16:29:15 +0800 Subject: [PATCH 23/89] Translate library/distribution.po (#972) --- library/distribution.po | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/distribution.po b/library/distribution.po index 16f1ff1073..ef9d7dfdf8 100644 --- a/library/distribution.po +++ b/library/distribution.po @@ -30,3 +30,6 @@ msgid "" "Package Index <https://pypi.org>`__, they can also be used with a local " "index server, or without any index server at all." msgstr "" +"這些函式庫可以幫助你發布和安裝 Python 軟體。雖然這些模組設計是為了與 `Python " +"套件索引 (Python Package Index) <https://pypi.org>`__ 結合使用,但它們也可以" +"搭配本地索引伺服器,甚至可以在沒有任何索引伺服器的情況下使用。" From 53991871107f595545545ef87e46d4d730a8fe3d Mon Sep 17 00:00:00 2001 From: "pydoc-zh-tw[bot]" <90344106+pydoc-zh-tw[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2024 18:50:34 +0800 Subject: [PATCH 24/89] Sync with CPython 3.13 (#973) Co-authored-by: Matt Wang <mattwang44@gmail.com> --- .scripts/poetry.lock | 6 +- c-api/code.po | 7 +- c-api/exceptions.po | 348 +- c-api/long.po | 70 +- c-api/memory.po | 411 +- c-api/module.po | 108 +- c-api/monitoring.po | 119 +- c-api/objbuffer.po | 105 - c-api/object.po | 36 +- c-api/refcounting.po | 36 +- c-api/time.po | 56 +- c-api/unicode.po | 11 +- deprecations/c-api-pending-removal-in-3.14.po | 117 +- deprecations/c-api-pending-removal-in-3.15.po | 60 +- .../c-api-pending-removal-in-future.po | 87 +- deprecations/index.po | 684 ++- deprecations/pending-removal-in-3.15.po | 187 +- deprecations/pending-removal-in-3.16.po | 87 +- faq/design.po | 16 +- faq/extending.po | 35 +- faq/general.po | 9 +- faq/gui.po | 20 - glossary.po | 10 +- howto/argparse.po | 6 +- howto/descriptor.po | 341 +- howto/free-threading-extensions.po | 107 +- howto/index.po | 44 +- library/2to3.po | 706 ---- library/_thread.po | 2 +- library/aifc.po | 286 -- library/argparse.po | 12 +- library/array.po | 14 +- library/ast.po | 709 ++-- library/asyncio-task.po | 2 +- library/asyncio.po | 8 +- library/audioop.po | 367 -- library/cgi.po | 889 ---- library/cgitb.po | 137 - library/chunk.po | 225 - library/cmdline.po | 3 +- library/compileall.po | 7 +- library/concurrent.futures.po | 8 +- library/crypt.po | 277 -- library/ctypes.po | 6 +- library/curses.po | 18 +- library/dbm.po | 237 +- library/ensurepip.po | 31 +- library/exceptions.po | 2 +- library/ftplib.po | 5 +- library/functools.po | 5 +- library/getpass.po | 7 +- library/grp.po | 8 +- library/hashlib.po | 8 +- library/http.client.po | 7 +- library/http.cookiejar.po | 7 +- library/http.server.po | 7 +- library/imaplib.po | 7 +- library/imghdr.po | 209 - library/importlib.po | 59 +- library/inspect.po | 276 +- library/intro.po | 109 +- library/json.po | 18 +- library/mailcap.po | 148 - library/mmap.po | 7 +- library/msilib.po | 623 --- library/multiprocessing.po | 31 +- library/nis.po | 100 - library/nntplib.po | 688 --- library/os.po | 154 +- library/ossaudiodev.po | 603 --- library/pathlib.po | 6 +- library/pipes.po | 144 - library/poplib.po | 7 +- library/re.po | 602 +-- library/readline.po | 18 +- library/select.po | 8 +- library/selectors.po | 7 +- library/smtplib.po | 7 +- library/sndhdr.po | 231 - library/socket.po | 19 +- library/socketserver.po | 7 +- library/spwd.po | 226 - library/sqlite3.po | 734 ++-- library/ssl.po | 47 +- library/statistics.po | 6 +- library/subprocess.po | 32 +- library/sunau.po | 386 -- library/sys.monitoring.po | 4 +- library/sys.po | 2 +- library/telnetlib.po | 369 -- library/threading.po | 6 +- library/time.po | 9 +- library/tkinter.po | 9 +- library/tkinter.tix.po | 553 --- library/typing.po | 233 +- library/undoc.po | 62 - library/urllib.request.po | 7 +- library/uu.po | 110 - library/venv.po | 31 +- library/webbrowser.po | 28 +- library/wsgiref.po | 24 +- library/xdrlib.po | 347 -- library/xml.etree.elementtree.po | 4 +- library/xmlrpc.client.po | 12 +- library/xmlrpc.server.po | 7 +- library/zoneinfo.po | 7 +- reference/datamodel.po | 6 +- reference/introduction.po | 6 +- sphinx.po | 62 +- tutorial/errors.po | 264 +- using/android.po | 144 + using/ios.po | 4 +- using/mac.po | 5 +- using/windows.po | 9 +- whatsnew/2.4.po | 29 +- whatsnew/2.7.po | 79 +- whatsnew/3.11.po | 78 +- whatsnew/3.12.po | 645 +-- whatsnew/3.13.po | 3763 ++++++++++------- whatsnew/3.2.po | 6 +- whatsnew/3.4.po | 933 ++-- whatsnew/3.7.po | 8 +- whatsnew/3.8.po | 4 +- 123 files changed, 6710 insertions(+), 13801 deletions(-) delete mode 100644 c-api/objbuffer.po delete mode 100644 library/2to3.po delete mode 100644 library/aifc.po delete mode 100644 library/audioop.po delete mode 100644 library/cgi.po delete mode 100644 library/cgitb.po delete mode 100644 library/chunk.po delete mode 100644 library/crypt.po delete mode 100644 library/imghdr.po delete mode 100644 library/mailcap.po delete mode 100644 library/msilib.po delete mode 100644 library/nis.po delete mode 100644 library/nntplib.po delete mode 100644 library/ossaudiodev.po delete mode 100644 library/pipes.po delete mode 100644 library/sndhdr.po delete mode 100644 library/spwd.po delete mode 100644 library/sunau.po delete mode 100644 library/telnetlib.po delete mode 100644 library/tkinter.tix.po delete mode 100644 library/undoc.po delete mode 100644 library/uu.po delete mode 100644 library/xdrlib.po create mode 100644 using/android.po diff --git a/.scripts/poetry.lock b/.scripts/poetry.lock index 482702ad5f..60d477dd30 100644 --- a/.scripts/poetry.lock +++ b/.scripts/poetry.lock @@ -483,13 +483,13 @@ yaml = ["ruamel.yaml (==0.17.21)"] [[package]] name = "urllib3" -version = "2.2.2" +version = "2.2.3" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=3.8" files = [ - {file = "urllib3-2.2.2-py3-none-any.whl", hash = "sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472"}, - {file = "urllib3-2.2.2.tar.gz", hash = "sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168"}, + {file = "urllib3-2.2.3-py3-none-any.whl", hash = "sha256:ca899ca043dcb1bafa3e262d73aa25c465bfb49e0bd9dd5d59f1d0acba2f8fac"}, + {file = "urllib3-2.2.3.tar.gz", hash = "sha256:e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9"}, ] [package.extras] diff --git a/c-api/code.po b/c-api/code.po index c653263f0a..79fec6db3e 100644 --- a/c-api/code.po +++ b/c-api/code.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -128,9 +128,8 @@ msgstr "" #: ../../c-api/code.rst:99 msgid "" -"For efficiently iterating over the line numbers in a code object, use `the " -"API described in PEP 626 <https://peps.python.org/pep-0626/#out-of-process-" -"debuggers-and-profilers>`_." +"For efficiently iterating over the line numbers in a code object, use :pep:" +"`the API described in PEP 626 <0626#out-of-process-debuggers-and-profilers>`." msgstr "" #: ../../c-api/code.rst:104 diff --git a/c-api/exceptions.po b/c-api/exceptions.po index 7709f0093c..c0ba0fe6ca 100644 --- a/c-api/exceptions.po +++ b/c-api/exceptions.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 14:05+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1038,451 +1038,459 @@ msgid "" "all the variables:" msgstr "" -#: ../../c-api/exceptions.rst:1027 ../../c-api/exceptions.rst:1160 -#: ../../c-api/exceptions.rst:1205 +#: ../../c-api/exceptions.rst:1028 ../../c-api/exceptions.rst:1163 +#: ../../c-api/exceptions.rst:1208 msgid "C Name" msgstr "C 名稱" -#: ../../c-api/exceptions.rst:1027 ../../c-api/exceptions.rst:1205 +#: ../../c-api/exceptions.rst:1028 ../../c-api/exceptions.rst:1208 msgid "Python Name" msgstr "Python 名稱" -#: ../../c-api/exceptions.rst:1027 ../../c-api/exceptions.rst:1160 -#: ../../c-api/exceptions.rst:1205 +#: ../../c-api/exceptions.rst:1028 ../../c-api/exceptions.rst:1163 +#: ../../c-api/exceptions.rst:1208 msgid "Notes" msgstr "註解" -#: ../../c-api/exceptions.rst:1029 +#: ../../c-api/exceptions.rst:1030 msgid ":c:data:`PyExc_BaseException`" msgstr ":c:data:`PyExc_BaseException`" -#: ../../c-api/exceptions.rst:1029 +#: ../../c-api/exceptions.rst:1030 msgid ":exc:`BaseException`" msgstr ":exc:`BaseException`" -#: ../../c-api/exceptions.rst:1029 ../../c-api/exceptions.rst:1031 -#: ../../c-api/exceptions.rst:1033 ../../c-api/exceptions.rst:1079 -#: ../../c-api/exceptions.rst:1091 +#: ../../c-api/exceptions.rst:1030 ../../c-api/exceptions.rst:1032 +#: ../../c-api/exceptions.rst:1034 ../../c-api/exceptions.rst:1080 +#: ../../c-api/exceptions.rst:1092 msgid "[1]_" msgstr "[1]_" -#: ../../c-api/exceptions.rst:1031 +#: ../../c-api/exceptions.rst:1032 msgid ":c:data:`PyExc_Exception`" msgstr ":c:data:`PyExc_Exception`" -#: ../../c-api/exceptions.rst:1031 +#: ../../c-api/exceptions.rst:1032 msgid ":exc:`Exception`" msgstr ":exc:`Exception`" -#: ../../c-api/exceptions.rst:1033 +#: ../../c-api/exceptions.rst:1034 msgid ":c:data:`PyExc_ArithmeticError`" msgstr ":c:data:`PyExc_ArithmeticError`" -#: ../../c-api/exceptions.rst:1033 +#: ../../c-api/exceptions.rst:1034 msgid ":exc:`ArithmeticError`" msgstr ":exc:`ArithmeticError`" -#: ../../c-api/exceptions.rst:1035 +#: ../../c-api/exceptions.rst:1036 msgid ":c:data:`PyExc_AssertionError`" msgstr ":c:data:`PyExc_AssertionError`" -#: ../../c-api/exceptions.rst:1035 +#: ../../c-api/exceptions.rst:1036 msgid ":exc:`AssertionError`" msgstr ":exc:`AssertionError`" -#: ../../c-api/exceptions.rst:1037 +#: ../../c-api/exceptions.rst:1038 msgid ":c:data:`PyExc_AttributeError`" msgstr ":c:data:`PyExc_AttributeError`" -#: ../../c-api/exceptions.rst:1037 +#: ../../c-api/exceptions.rst:1038 msgid ":exc:`AttributeError`" msgstr ":exc:`AttributeError`" -#: ../../c-api/exceptions.rst:1039 +#: ../../c-api/exceptions.rst:1040 msgid ":c:data:`PyExc_BlockingIOError`" msgstr ":c:data:`PyExc_BlockingIOError`" -#: ../../c-api/exceptions.rst:1039 +#: ../../c-api/exceptions.rst:1040 msgid ":exc:`BlockingIOError`" msgstr ":exc:`BlockingIOError`" -#: ../../c-api/exceptions.rst:1041 +#: ../../c-api/exceptions.rst:1042 msgid ":c:data:`PyExc_BrokenPipeError`" msgstr ":c:data:`PyExc_BrokenPipeError`" -#: ../../c-api/exceptions.rst:1041 +#: ../../c-api/exceptions.rst:1042 msgid ":exc:`BrokenPipeError`" msgstr ":exc:`BrokenPipeError`" -#: ../../c-api/exceptions.rst:1043 +#: ../../c-api/exceptions.rst:1044 msgid ":c:data:`PyExc_BufferError`" msgstr ":c:data:`PyExc_BufferError`" -#: ../../c-api/exceptions.rst:1043 +#: ../../c-api/exceptions.rst:1044 msgid ":exc:`BufferError`" msgstr ":exc:`BufferError`" -#: ../../c-api/exceptions.rst:1045 +#: ../../c-api/exceptions.rst:1046 msgid ":c:data:`PyExc_ChildProcessError`" msgstr ":c:data:`PyExc_ChildProcessError`" -#: ../../c-api/exceptions.rst:1045 +#: ../../c-api/exceptions.rst:1046 msgid ":exc:`ChildProcessError`" msgstr ":exc:`ChildProcessError`" -#: ../../c-api/exceptions.rst:1047 +#: ../../c-api/exceptions.rst:1048 msgid ":c:data:`PyExc_ConnectionAbortedError`" msgstr ":c:data:`PyExc_ConnectionAbortedError`" -#: ../../c-api/exceptions.rst:1047 +#: ../../c-api/exceptions.rst:1048 msgid ":exc:`ConnectionAbortedError`" msgstr ":exc:`ConnectionAbortedError`" -#: ../../c-api/exceptions.rst:1049 +#: ../../c-api/exceptions.rst:1050 msgid ":c:data:`PyExc_ConnectionError`" msgstr ":c:data:`PyExc_ConnectionError`" -#: ../../c-api/exceptions.rst:1049 +#: ../../c-api/exceptions.rst:1050 msgid ":exc:`ConnectionError`" msgstr ":exc:`ConnectionError`" -#: ../../c-api/exceptions.rst:1051 +#: ../../c-api/exceptions.rst:1052 msgid ":c:data:`PyExc_ConnectionRefusedError`" msgstr ":c:data:`PyExc_ConnectionRefusedError`" -#: ../../c-api/exceptions.rst:1051 +#: ../../c-api/exceptions.rst:1052 msgid ":exc:`ConnectionRefusedError`" msgstr ":exc:`ConnectionRefusedError`" -#: ../../c-api/exceptions.rst:1053 +#: ../../c-api/exceptions.rst:1054 msgid ":c:data:`PyExc_ConnectionResetError`" msgstr ":c:data:`PyExc_ConnectionResetError`" -#: ../../c-api/exceptions.rst:1053 +#: ../../c-api/exceptions.rst:1054 msgid ":exc:`ConnectionResetError`" msgstr ":exc:`ConnectionResetError`" -#: ../../c-api/exceptions.rst:1055 +#: ../../c-api/exceptions.rst:1056 msgid ":c:data:`PyExc_EOFError`" msgstr ":c:data:`PyExc_EOFError`" -#: ../../c-api/exceptions.rst:1055 +#: ../../c-api/exceptions.rst:1056 msgid ":exc:`EOFError`" msgstr ":exc:`EOFError`" -#: ../../c-api/exceptions.rst:1057 +#: ../../c-api/exceptions.rst:1058 msgid ":c:data:`PyExc_FileExistsError`" msgstr ":c:data:`PyExc_FileExistsError`" -#: ../../c-api/exceptions.rst:1057 +#: ../../c-api/exceptions.rst:1058 msgid ":exc:`FileExistsError`" msgstr ":exc:`FileExistsError`" -#: ../../c-api/exceptions.rst:1059 +#: ../../c-api/exceptions.rst:1060 msgid ":c:data:`PyExc_FileNotFoundError`" msgstr ":c:data:`PyExc_FileNotFoundError`" -#: ../../c-api/exceptions.rst:1059 +#: ../../c-api/exceptions.rst:1060 msgid ":exc:`FileNotFoundError`" msgstr ":exc:`FileNotFoundError`" -#: ../../c-api/exceptions.rst:1061 +#: ../../c-api/exceptions.rst:1062 msgid ":c:data:`PyExc_FloatingPointError`" msgstr ":c:data:`PyExc_FloatingPointError`" -#: ../../c-api/exceptions.rst:1061 +#: ../../c-api/exceptions.rst:1062 msgid ":exc:`FloatingPointError`" msgstr ":exc:`FloatingPointError`" -#: ../../c-api/exceptions.rst:1063 +#: ../../c-api/exceptions.rst:1064 msgid ":c:data:`PyExc_GeneratorExit`" msgstr ":c:data:`PyExc_GeneratorExit`" -#: ../../c-api/exceptions.rst:1063 +#: ../../c-api/exceptions.rst:1064 msgid ":exc:`GeneratorExit`" msgstr ":exc:`GeneratorExit`" -#: ../../c-api/exceptions.rst:1065 +#: ../../c-api/exceptions.rst:1066 msgid ":c:data:`PyExc_ImportError`" msgstr ":c:data:`PyExc_ImportError`" -#: ../../c-api/exceptions.rst:1065 +#: ../../c-api/exceptions.rst:1066 msgid ":exc:`ImportError`" msgstr ":exc:`ImportError`" -#: ../../c-api/exceptions.rst:1067 +#: ../../c-api/exceptions.rst:1068 msgid ":c:data:`PyExc_IndentationError`" msgstr ":c:data:`PyExc_IndentationError`" -#: ../../c-api/exceptions.rst:1067 +#: ../../c-api/exceptions.rst:1068 msgid ":exc:`IndentationError`" msgstr ":exc:`IndentationError`" -#: ../../c-api/exceptions.rst:1069 +#: ../../c-api/exceptions.rst:1070 msgid ":c:data:`PyExc_IndexError`" msgstr ":c:data:`PyExc_IndexError`" -#: ../../c-api/exceptions.rst:1069 +#: ../../c-api/exceptions.rst:1070 msgid ":exc:`IndexError`" msgstr ":exc:`IndexError`" -#: ../../c-api/exceptions.rst:1071 +#: ../../c-api/exceptions.rst:1072 msgid ":c:data:`PyExc_InterruptedError`" msgstr ":c:data:`PyExc_InterruptedError`" -#: ../../c-api/exceptions.rst:1071 +#: ../../c-api/exceptions.rst:1072 msgid ":exc:`InterruptedError`" msgstr ":exc:`InterruptedError`" -#: ../../c-api/exceptions.rst:1073 +#: ../../c-api/exceptions.rst:1074 msgid ":c:data:`PyExc_IsADirectoryError`" msgstr ":c:data:`PyExc_IsADirectoryError`" -#: ../../c-api/exceptions.rst:1073 +#: ../../c-api/exceptions.rst:1074 msgid ":exc:`IsADirectoryError`" msgstr ":exc:`IsADirectoryError`" -#: ../../c-api/exceptions.rst:1075 +#: ../../c-api/exceptions.rst:1076 msgid ":c:data:`PyExc_KeyError`" msgstr ":c:data:`PyExc_KeyError`" -#: ../../c-api/exceptions.rst:1075 +#: ../../c-api/exceptions.rst:1076 msgid ":exc:`KeyError`" msgstr ":exc:`KeyError`" -#: ../../c-api/exceptions.rst:1077 +#: ../../c-api/exceptions.rst:1078 msgid ":c:data:`PyExc_KeyboardInterrupt`" msgstr ":c:data:`PyExc_KeyboardInterrupt`" -#: ../../c-api/exceptions.rst:1077 +#: ../../c-api/exceptions.rst:1078 msgid ":exc:`KeyboardInterrupt`" msgstr ":exc:`KeyboardInterrupt`" -#: ../../c-api/exceptions.rst:1079 +#: ../../c-api/exceptions.rst:1080 msgid ":c:data:`PyExc_LookupError`" msgstr ":c:data:`PyExc_LookupError`" -#: ../../c-api/exceptions.rst:1079 +#: ../../c-api/exceptions.rst:1080 msgid ":exc:`LookupError`" msgstr ":exc:`LookupError`" -#: ../../c-api/exceptions.rst:1081 +#: ../../c-api/exceptions.rst:1082 msgid ":c:data:`PyExc_MemoryError`" msgstr ":c:data:`PyExc_MemoryError`" -#: ../../c-api/exceptions.rst:1081 +#: ../../c-api/exceptions.rst:1082 msgid ":exc:`MemoryError`" msgstr ":exc:`MemoryError`" -#: ../../c-api/exceptions.rst:1083 +#: ../../c-api/exceptions.rst:1084 msgid ":c:data:`PyExc_ModuleNotFoundError`" msgstr ":c:data:`PyExc_ModuleNotFoundError`" -#: ../../c-api/exceptions.rst:1083 +#: ../../c-api/exceptions.rst:1084 msgid ":exc:`ModuleNotFoundError`" msgstr ":exc:`ModuleNotFoundError`" -#: ../../c-api/exceptions.rst:1085 +#: ../../c-api/exceptions.rst:1086 msgid ":c:data:`PyExc_NameError`" msgstr ":c:data:`PyExc_NameError`" -#: ../../c-api/exceptions.rst:1085 +#: ../../c-api/exceptions.rst:1086 msgid ":exc:`NameError`" msgstr ":exc:`NameError`" -#: ../../c-api/exceptions.rst:1087 +#: ../../c-api/exceptions.rst:1088 msgid ":c:data:`PyExc_NotADirectoryError`" msgstr ":c:data:`PyExc_NotADirectoryError`" -#: ../../c-api/exceptions.rst:1087 +#: ../../c-api/exceptions.rst:1088 msgid ":exc:`NotADirectoryError`" msgstr ":exc:`NotADirectoryError`" -#: ../../c-api/exceptions.rst:1089 +#: ../../c-api/exceptions.rst:1090 msgid ":c:data:`PyExc_NotImplementedError`" msgstr ":c:data:`PyExc_NotImplementedError`" -#: ../../c-api/exceptions.rst:1089 +#: ../../c-api/exceptions.rst:1090 msgid ":exc:`NotImplementedError`" msgstr ":exc:`NotImplementedError`" -#: ../../c-api/exceptions.rst:1091 +#: ../../c-api/exceptions.rst:1092 msgid ":c:data:`PyExc_OSError`" msgstr ":c:data:`PyExc_OSError`" -#: ../../c-api/exceptions.rst:1091 +#: ../../c-api/exceptions.rst:1092 msgid ":exc:`OSError`" msgstr ":exc:`OSError`" -#: ../../c-api/exceptions.rst:1093 +#: ../../c-api/exceptions.rst:1094 msgid ":c:data:`PyExc_OverflowError`" msgstr ":c:data:`PyExc_OverflowError`" -#: ../../c-api/exceptions.rst:1093 +#: ../../c-api/exceptions.rst:1094 msgid ":exc:`OverflowError`" msgstr ":exc:`OverflowError`" -#: ../../c-api/exceptions.rst:1095 +#: ../../c-api/exceptions.rst:1096 msgid ":c:data:`PyExc_PermissionError`" msgstr ":c:data:`PyExc_PermissionError`" -#: ../../c-api/exceptions.rst:1095 +#: ../../c-api/exceptions.rst:1096 msgid ":exc:`PermissionError`" msgstr ":exc:`PermissionError`" -#: ../../c-api/exceptions.rst:1097 +#: ../../c-api/exceptions.rst:1098 msgid ":c:data:`PyExc_ProcessLookupError`" msgstr ":c:data:`PyExc_ProcessLookupError`" -#: ../../c-api/exceptions.rst:1097 +#: ../../c-api/exceptions.rst:1098 msgid ":exc:`ProcessLookupError`" msgstr ":exc:`ProcessLookupError`" -#: ../../c-api/exceptions.rst:1099 +#: ../../c-api/exceptions.rst:1100 +msgid ":c:data:`PyExc_PythonFinalizationError`" +msgstr ":c:data:`PyExc_PythonFinalizationError`" + +#: ../../c-api/exceptions.rst:1100 +msgid ":exc:`PythonFinalizationError`" +msgstr ":exc:`PythonFinalizationError`" + +#: ../../c-api/exceptions.rst:1102 msgid ":c:data:`PyExc_RecursionError`" msgstr ":c:data:`PyExc_RecursionError`" -#: ../../c-api/exceptions.rst:1099 +#: ../../c-api/exceptions.rst:1102 msgid ":exc:`RecursionError`" msgstr ":exc:`RecursionError`" -#: ../../c-api/exceptions.rst:1101 +#: ../../c-api/exceptions.rst:1104 msgid ":c:data:`PyExc_ReferenceError`" msgstr ":c:data:`PyExc_ReferenceError`" -#: ../../c-api/exceptions.rst:1101 +#: ../../c-api/exceptions.rst:1104 msgid ":exc:`ReferenceError`" msgstr ":exc:`ReferenceError`" -#: ../../c-api/exceptions.rst:1103 +#: ../../c-api/exceptions.rst:1106 msgid ":c:data:`PyExc_RuntimeError`" msgstr ":c:data:`PyExc_RuntimeError`" -#: ../../c-api/exceptions.rst:1103 +#: ../../c-api/exceptions.rst:1106 msgid ":exc:`RuntimeError`" msgstr ":exc:`RuntimeError`" -#: ../../c-api/exceptions.rst:1105 +#: ../../c-api/exceptions.rst:1108 msgid ":c:data:`PyExc_StopAsyncIteration`" msgstr ":c:data:`PyExc_StopAsyncIteration`" -#: ../../c-api/exceptions.rst:1105 +#: ../../c-api/exceptions.rst:1108 msgid ":exc:`StopAsyncIteration`" msgstr ":exc:`StopAsyncIteration`" -#: ../../c-api/exceptions.rst:1107 +#: ../../c-api/exceptions.rst:1110 msgid ":c:data:`PyExc_StopIteration`" msgstr ":c:data:`PyExc_StopIteration`" -#: ../../c-api/exceptions.rst:1107 +#: ../../c-api/exceptions.rst:1110 msgid ":exc:`StopIteration`" msgstr ":exc:`StopIteration`" -#: ../../c-api/exceptions.rst:1109 +#: ../../c-api/exceptions.rst:1112 msgid ":c:data:`PyExc_SyntaxError`" msgstr ":c:data:`PyExc_SyntaxError`" -#: ../../c-api/exceptions.rst:1109 +#: ../../c-api/exceptions.rst:1112 msgid ":exc:`SyntaxError`" msgstr ":exc:`SyntaxError`" -#: ../../c-api/exceptions.rst:1111 +#: ../../c-api/exceptions.rst:1114 msgid ":c:data:`PyExc_SystemError`" msgstr ":c:data:`PyExc_SystemError`" -#: ../../c-api/exceptions.rst:1111 +#: ../../c-api/exceptions.rst:1114 msgid ":exc:`SystemError`" msgstr ":exc:`SystemError`" -#: ../../c-api/exceptions.rst:1113 +#: ../../c-api/exceptions.rst:1116 msgid ":c:data:`PyExc_SystemExit`" msgstr ":c:data:`PyExc_SystemExit`" -#: ../../c-api/exceptions.rst:1113 +#: ../../c-api/exceptions.rst:1116 msgid ":exc:`SystemExit`" msgstr ":exc:`SystemExit`" -#: ../../c-api/exceptions.rst:1115 +#: ../../c-api/exceptions.rst:1118 msgid ":c:data:`PyExc_TabError`" msgstr ":c:data:`PyExc_TabError`" -#: ../../c-api/exceptions.rst:1115 +#: ../../c-api/exceptions.rst:1118 msgid ":exc:`TabError`" msgstr ":exc:`TabError`" -#: ../../c-api/exceptions.rst:1117 +#: ../../c-api/exceptions.rst:1120 msgid ":c:data:`PyExc_TimeoutError`" msgstr ":c:data:`PyExc_TimeoutError`" -#: ../../c-api/exceptions.rst:1117 +#: ../../c-api/exceptions.rst:1120 msgid ":exc:`TimeoutError`" msgstr ":exc:`TimeoutError`" -#: ../../c-api/exceptions.rst:1119 +#: ../../c-api/exceptions.rst:1122 msgid ":c:data:`PyExc_TypeError`" msgstr ":c:data:`PyExc_TypeError`" -#: ../../c-api/exceptions.rst:1119 +#: ../../c-api/exceptions.rst:1122 msgid ":exc:`TypeError`" msgstr ":exc:`TypeError`" -#: ../../c-api/exceptions.rst:1121 +#: ../../c-api/exceptions.rst:1124 msgid ":c:data:`PyExc_UnboundLocalError`" msgstr ":c:data:`PyExc_UnboundLocalError`" -#: ../../c-api/exceptions.rst:1121 +#: ../../c-api/exceptions.rst:1124 msgid ":exc:`UnboundLocalError`" msgstr ":exc:`UnboundLocalError`" -#: ../../c-api/exceptions.rst:1123 +#: ../../c-api/exceptions.rst:1126 msgid ":c:data:`PyExc_UnicodeDecodeError`" msgstr ":c:data:`PyExc_UnicodeDecodeError`" -#: ../../c-api/exceptions.rst:1123 +#: ../../c-api/exceptions.rst:1126 msgid ":exc:`UnicodeDecodeError`" msgstr ":exc:`UnicodeDecodeError`" -#: ../../c-api/exceptions.rst:1125 +#: ../../c-api/exceptions.rst:1128 msgid ":c:data:`PyExc_UnicodeEncodeError`" msgstr ":c:data:`PyExc_UnicodeEncodeError`" -#: ../../c-api/exceptions.rst:1125 +#: ../../c-api/exceptions.rst:1128 msgid ":exc:`UnicodeEncodeError`" msgstr ":exc:`UnicodeEncodeError`" -#: ../../c-api/exceptions.rst:1127 +#: ../../c-api/exceptions.rst:1130 msgid ":c:data:`PyExc_UnicodeError`" msgstr ":c:data:`PyExc_UnicodeError`" -#: ../../c-api/exceptions.rst:1127 +#: ../../c-api/exceptions.rst:1130 msgid ":exc:`UnicodeError`" msgstr ":exc:`UnicodeError`" -#: ../../c-api/exceptions.rst:1129 +#: ../../c-api/exceptions.rst:1132 msgid ":c:data:`PyExc_UnicodeTranslateError`" msgstr ":c:data:`PyExc_UnicodeTranslateError`" -#: ../../c-api/exceptions.rst:1129 +#: ../../c-api/exceptions.rst:1132 msgid ":exc:`UnicodeTranslateError`" msgstr ":exc:`UnicodeTranslateError`" -#: ../../c-api/exceptions.rst:1131 +#: ../../c-api/exceptions.rst:1134 msgid ":c:data:`PyExc_ValueError`" msgstr ":c:data:`PyExc_ValueError`" -#: ../../c-api/exceptions.rst:1131 +#: ../../c-api/exceptions.rst:1134 msgid ":exc:`ValueError`" msgstr ":exc:`ValueError`" -#: ../../c-api/exceptions.rst:1133 +#: ../../c-api/exceptions.rst:1136 msgid ":c:data:`PyExc_ZeroDivisionError`" msgstr ":c:data:`PyExc_ZeroDivisionError`" -#: ../../c-api/exceptions.rst:1133 +#: ../../c-api/exceptions.rst:1136 msgid ":exc:`ZeroDivisionError`" msgstr ":exc:`ZeroDivisionError`" -#: ../../c-api/exceptions.rst:1136 +#: ../../c-api/exceptions.rst:1139 msgid "" ":c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, :c:data:" "`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, :c:data:" @@ -1502,57 +1510,57 @@ msgstr "" "`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` 和 :c:data:" "`PyExc_TimeoutError` 是在 :pep:`3151` 被引入。" -#: ../../c-api/exceptions.rst:1146 +#: ../../c-api/exceptions.rst:1149 msgid ":c:data:`PyExc_StopAsyncIteration` and :c:data:`PyExc_RecursionError`." msgstr ":c:data:`PyExc_StopAsyncIteration` 和 :c:data:`PyExc_RecursionError`。" -#: ../../c-api/exceptions.rst:1149 +#: ../../c-api/exceptions.rst:1152 msgid ":c:data:`PyExc_ModuleNotFoundError`." msgstr ":c:data:`PyExc_ModuleNotFoundError`。" -#: ../../c-api/exceptions.rst:1152 +#: ../../c-api/exceptions.rst:1155 msgid "These are compatibility aliases to :c:data:`PyExc_OSError`:" msgstr "" -#: ../../c-api/exceptions.rst:1162 +#: ../../c-api/exceptions.rst:1165 msgid ":c:data:`!PyExc_EnvironmentError`" msgstr ":c:data:`!PyExc_EnvironmentError`" -#: ../../c-api/exceptions.rst:1164 +#: ../../c-api/exceptions.rst:1167 msgid ":c:data:`!PyExc_IOError`" msgstr ":c:data:`!PyExc_IOError`" -#: ../../c-api/exceptions.rst:1166 +#: ../../c-api/exceptions.rst:1169 msgid ":c:data:`!PyExc_WindowsError`" msgstr ":c:data:`!PyExc_WindowsError`" -#: ../../c-api/exceptions.rst:1166 +#: ../../c-api/exceptions.rst:1169 msgid "[2]_" msgstr "[2]_" -#: ../../c-api/exceptions.rst:1169 +#: ../../c-api/exceptions.rst:1172 msgid "These aliases used to be separate exception types." msgstr "" -#: ../../c-api/exceptions.rst:1172 ../../c-api/exceptions.rst:1233 +#: ../../c-api/exceptions.rst:1175 ../../c-api/exceptions.rst:1236 msgid "Notes:" msgstr "註解:" -#: ../../c-api/exceptions.rst:1175 +#: ../../c-api/exceptions.rst:1178 msgid "This is a base class for other standard exceptions." msgstr "" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1181 msgid "" "Only defined on Windows; protect code that uses this by testing that the " "preprocessor macro ``MS_WINDOWS`` is defined." msgstr "" -#: ../../c-api/exceptions.rst:1184 +#: ../../c-api/exceptions.rst:1187 msgid "Standard Warning Categories" msgstr "" -#: ../../c-api/exceptions.rst:1186 +#: ../../c-api/exceptions.rst:1189 msgid "" "All standard Python warning categories are available as global variables " "whose names are ``PyExc_`` followed by the Python exception name. These have " @@ -1560,103 +1568,103 @@ msgid "" "here are all the variables:" msgstr "" -#: ../../c-api/exceptions.rst:1207 +#: ../../c-api/exceptions.rst:1210 msgid ":c:data:`PyExc_Warning`" msgstr ":c:data:`PyExc_Warning`" -#: ../../c-api/exceptions.rst:1207 +#: ../../c-api/exceptions.rst:1210 msgid ":exc:`Warning`" msgstr ":exc:`Warning`" -#: ../../c-api/exceptions.rst:1207 +#: ../../c-api/exceptions.rst:1210 msgid "[3]_" msgstr "[3]_" -#: ../../c-api/exceptions.rst:1209 +#: ../../c-api/exceptions.rst:1212 msgid ":c:data:`PyExc_BytesWarning`" msgstr ":c:data:`PyExc_BytesWarning`" -#: ../../c-api/exceptions.rst:1209 +#: ../../c-api/exceptions.rst:1212 msgid ":exc:`BytesWarning`" msgstr ":exc:`BytesWarning`" -#: ../../c-api/exceptions.rst:1211 +#: ../../c-api/exceptions.rst:1214 msgid ":c:data:`PyExc_DeprecationWarning`" msgstr ":c:data:`PyExc_DeprecationWarning`" -#: ../../c-api/exceptions.rst:1211 +#: ../../c-api/exceptions.rst:1214 msgid ":exc:`DeprecationWarning`" msgstr ":exc:`DeprecationWarning`" -#: ../../c-api/exceptions.rst:1213 +#: ../../c-api/exceptions.rst:1216 msgid ":c:data:`PyExc_FutureWarning`" msgstr ":c:data:`PyExc_FutureWarning`" -#: ../../c-api/exceptions.rst:1213 +#: ../../c-api/exceptions.rst:1216 msgid ":exc:`FutureWarning`" msgstr ":exc:`FutureWarning`" -#: ../../c-api/exceptions.rst:1215 +#: ../../c-api/exceptions.rst:1218 msgid ":c:data:`PyExc_ImportWarning`" msgstr ":c:data:`PyExc_ImportWarning`" -#: ../../c-api/exceptions.rst:1215 +#: ../../c-api/exceptions.rst:1218 msgid ":exc:`ImportWarning`" msgstr ":exc:`ImportWarning`" -#: ../../c-api/exceptions.rst:1217 +#: ../../c-api/exceptions.rst:1220 msgid ":c:data:`PyExc_PendingDeprecationWarning`" msgstr ":c:data:`PyExc_PendingDeprecationWarning`" -#: ../../c-api/exceptions.rst:1217 +#: ../../c-api/exceptions.rst:1220 msgid ":exc:`PendingDeprecationWarning`" msgstr ":exc:`PendingDeprecationWarning`" -#: ../../c-api/exceptions.rst:1219 +#: ../../c-api/exceptions.rst:1222 msgid ":c:data:`PyExc_ResourceWarning`" msgstr ":c:data:`PyExc_ResourceWarning`" -#: ../../c-api/exceptions.rst:1219 +#: ../../c-api/exceptions.rst:1222 msgid ":exc:`ResourceWarning`" msgstr ":exc:`ResourceWarning`" -#: ../../c-api/exceptions.rst:1221 +#: ../../c-api/exceptions.rst:1224 msgid ":c:data:`PyExc_RuntimeWarning`" msgstr ":c:data:`PyExc_RuntimeWarning`" -#: ../../c-api/exceptions.rst:1221 +#: ../../c-api/exceptions.rst:1224 msgid ":exc:`RuntimeWarning`" msgstr ":exc:`RuntimeWarning`" -#: ../../c-api/exceptions.rst:1223 +#: ../../c-api/exceptions.rst:1226 msgid ":c:data:`PyExc_SyntaxWarning`" msgstr ":c:data:`PyExc_SyntaxWarning`" -#: ../../c-api/exceptions.rst:1223 +#: ../../c-api/exceptions.rst:1226 msgid ":exc:`SyntaxWarning`" msgstr ":exc:`SyntaxWarning`" -#: ../../c-api/exceptions.rst:1225 +#: ../../c-api/exceptions.rst:1228 msgid ":c:data:`PyExc_UnicodeWarning`" msgstr ":c:data:`PyExc_UnicodeWarning`" -#: ../../c-api/exceptions.rst:1225 +#: ../../c-api/exceptions.rst:1228 msgid ":exc:`UnicodeWarning`" msgstr ":exc:`UnicodeWarning`" -#: ../../c-api/exceptions.rst:1227 +#: ../../c-api/exceptions.rst:1230 msgid ":c:data:`PyExc_UserWarning`" msgstr ":c:data:`PyExc_UserWarning`" -#: ../../c-api/exceptions.rst:1227 +#: ../../c-api/exceptions.rst:1230 msgid ":exc:`UserWarning`" msgstr ":exc:`UserWarning`" -#: ../../c-api/exceptions.rst:1230 +#: ../../c-api/exceptions.rst:1233 msgid ":c:data:`PyExc_ResourceWarning`." msgstr ":c:data:`PyExc_ResourceWarning`." -#: ../../c-api/exceptions.rst:1236 +#: ../../c-api/exceptions.rst:1239 msgid "This is a base class for other standard warning categories." msgstr "" @@ -1823,6 +1831,10 @@ msgstr "PyExc_PermissionError(C 變數)" msgid "PyExc_ProcessLookupError (C var)" msgstr "PyExc_ProcessLookupError(C 變數)" +#: ../../c-api/exceptions.rst:971 +msgid "PyExc_PythonFinalizationError (C var)" +msgstr "PyExc_PythonFinalizationError(C 變數)" + #: ../../c-api/exceptions.rst:971 msgid "PyExc_RecursionError (C var)" msgstr "PyExc_RecursionError(C 變數)" @@ -1895,58 +1907,58 @@ msgstr "PyExc_ValueError(C 變數)" msgid "PyExc_ZeroDivisionError (C var)" msgstr "PyExc_ZeroDivisionError(C 變數)" -#: ../../c-api/exceptions.rst:1154 +#: ../../c-api/exceptions.rst:1157 msgid "PyExc_EnvironmentError (C var)" msgstr "PyExc_EnvironmentError(C 變數)" -#: ../../c-api/exceptions.rst:1154 +#: ../../c-api/exceptions.rst:1157 msgid "PyExc_IOError (C var)" msgstr "PyExc_IOError(C 變數)" -#: ../../c-api/exceptions.rst:1154 +#: ../../c-api/exceptions.rst:1157 msgid "PyExc_WindowsError (C var)" msgstr "PyExc_WindowsError(C 變數)" -#: ../../c-api/exceptions.rst:1191 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_Warning (C var)" msgstr "PyExc_Warning(C 變數)" -#: ../../c-api/exceptions.rst:1191 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_BytesWarning (C var)" msgstr "PyExc_BytesWarning(C 變數)" -#: ../../c-api/exceptions.rst:1191 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_DeprecationWarning (C var)" msgstr "PyExc_DeprecationWarning(C 變數)" -#: ../../c-api/exceptions.rst:1191 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_FutureWarning (C var)" msgstr "PyExc_FutureWarning(C 變數)" -#: ../../c-api/exceptions.rst:1191 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_ImportWarning (C var)" msgstr "PyExc_ImportWarning(C 變數)" -#: ../../c-api/exceptions.rst:1191 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_PendingDeprecationWarning (C var)" msgstr "PyExc_PendingDeprecationWarning(C 變數)" -#: ../../c-api/exceptions.rst:1191 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_ResourceWarning (C var)" msgstr "PyExc_ResourceWarning(C 變數)" -#: ../../c-api/exceptions.rst:1191 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_RuntimeWarning (C var)" msgstr "PyExc_RuntimeWarning(C 變數)" -#: ../../c-api/exceptions.rst:1191 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_SyntaxWarning (C var)" msgstr "PyExc_SyntaxWarning(C 變數)" -#: ../../c-api/exceptions.rst:1191 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_UnicodeWarning (C var)" msgstr "PyExc_UnicodeWarning(C 變數)" -#: ../../c-api/exceptions.rst:1191 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_UserWarning (C var)" msgstr "PyExc_UserWarning(C 變數)" diff --git a/c-api/long.po b/c-api/long.po index 7abcaaf2c1..7c2be2dcee 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -405,7 +405,7 @@ msgstr "" #: ../../c-api/long.rst:386 msgid "``0`` will never be returned." -msgstr "" +msgstr "``0`` 將永不被回傳。" #: ../../c-api/long.rst:388 msgid "Values are always copied as two's-complement." @@ -413,7 +413,7 @@ msgstr "" #: ../../c-api/long.rst:390 msgid "Usage example::" -msgstr "" +msgstr "使用範例: ::" #: ../../c-api/long.rst:392 msgid "" @@ -495,56 +495,56 @@ msgid "" "Py_ASNATIVEBYTES_UNSIGNED_BUFFER``." msgstr "" -#: ../../c-api/long.rst:456 +#: ../../c-api/long.rst:458 msgid "Flag" -msgstr "" +msgstr "旗標" -#: ../../c-api/long.rst:456 +#: ../../c-api/long.rst:458 msgid "Value" -msgstr "" +msgstr "數值" -#: ../../c-api/long.rst:458 +#: ../../c-api/long.rst:460 msgid "``-1``" -msgstr "" +msgstr "``-1``" -#: ../../c-api/long.rst:459 +#: ../../c-api/long.rst:461 msgid "``0``" -msgstr "" +msgstr "``0``" -#: ../../c-api/long.rst:460 +#: ../../c-api/long.rst:462 msgid "``1``" -msgstr "" +msgstr "``1``" -#: ../../c-api/long.rst:461 +#: ../../c-api/long.rst:463 msgid "``3``" -msgstr "" +msgstr "``3``" -#: ../../c-api/long.rst:462 +#: ../../c-api/long.rst:464 msgid "``4``" -msgstr "" +msgstr "``4``" -#: ../../c-api/long.rst:463 +#: ../../c-api/long.rst:465 msgid "``8``" -msgstr "" +msgstr "``8``" -#: ../../c-api/long.rst:464 +#: ../../c-api/long.rst:466 msgid "``16``" -msgstr "" +msgstr "``16``" -#: ../../c-api/long.rst:467 +#: ../../c-api/long.rst:469 msgid "" "Specifying ``Py_ASNATIVEBYTES_NATIVE_ENDIAN`` will override any other endian " "flags. Passing ``2`` is reserved." msgstr "" -#: ../../c-api/long.rst:470 +#: ../../c-api/long.rst:472 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:474 +#: ../../c-api/long.rst:476 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 " @@ -554,7 +554,7 @@ msgid "" "requested." msgstr "" -#: ../../c-api/long.rst:481 +#: ../../c-api/long.rst:483 msgid "" "Specifying ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` causes an exception to be " "set if *pylong* is negative. Without this flag, negative values will be " @@ -562,7 +562,7 @@ msgid "" "of whether ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` was specified." msgstr "" -#: ../../c-api/long.rst:486 +#: ../../c-api/long.rst:488 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 " @@ -572,7 +572,7 @@ msgid "" "`TypeError`." msgstr "" -#: ../../c-api/long.rst:495 +#: ../../c-api/long.rst:497 msgid "" "With the default *flags* (``-1``, or *UNSIGNED_BUFFER* without " "*REJECT_NEGATIVE*), multiple Python integers can map to a single value " @@ -580,22 +580,22 @@ msgid "" "buffer and set all its bits. This matches typical C cast behavior." msgstr "" -#: ../../c-api/long.rst:506 +#: ../../c-api/long.rst:508 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:510 +#: ../../c-api/long.rst:512 msgid "On failure, return ``NULL`` with an exception set." msgstr "在失敗時,會回傳 ``NULL`` 並設定例外。" -#: ../../c-api/long.rst:517 +#: ../../c-api/long.rst:519 msgid "Return 1 if *op* is compact, 0 otherwise." msgstr "" -#: ../../c-api/long.rst:519 +#: ../../c-api/long.rst:521 msgid "" "This function makes it possible for performance-critical code to implement a " "“fast path” for small integers. For compact values use :c:func:" @@ -603,23 +603,23 @@ msgid "" "`PyLong_As* <PyLong_AsSize_t>` function or :c:func:`PyLong_AsNativeBytes`." msgstr "" -#: ../../c-api/long.rst:525 +#: ../../c-api/long.rst:527 msgid "The speedup is expected to be negligible for most users." msgstr "" -#: ../../c-api/long.rst:527 +#: ../../c-api/long.rst:529 msgid "" "Exactly what values are considered compact is an implementation detail and " "is subject to change." msgstr "" -#: ../../c-api/long.rst:532 +#: ../../c-api/long.rst:534 msgid "" "If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`, " "return its value." msgstr "" -#: ../../c-api/long.rst:535 +#: ../../c-api/long.rst:537 msgid "Otherwise, the return value is undefined." msgstr "" diff --git a/c-api/memory.po b/c-api/memory.po index 489366188e..e3b9669a9d 100644 --- a/c-api/memory.po +++ b/c-api/memory.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -135,59 +135,70 @@ msgid "" "details on how every domain allocates memory or what internal functions each " "domain calls is considered an implementation detail, but for debugging " "purposes a simplified table can be found at :ref:`here <default-memory-" -"allocators>`. There is no hard requirement to use the memory returned by the " -"allocation functions belonging to a given domain for only the purposes " -"hinted by that domain (although this is the recommended practice). For " -"example, one could use the memory returned by :c:func:`PyMem_RawMalloc` for " -"allocating Python objects or the memory returned by :c:func:" -"`PyObject_Malloc` for allocating memory for buffers." +"allocators>`. The APIs used to allocate and free a block of memory must be " +"from the same domain. For example, :c:func:`PyMem_Free` must be used to free " +"memory allocated using :c:func:`PyMem_Malloc`." msgstr "" -#: ../../c-api/memory.rst:112 +#: ../../c-api/memory.rst:109 msgid "The three allocation domains are:" msgstr "" -#: ../../c-api/memory.rst:114 +#: ../../c-api/memory.rst:111 msgid "" "Raw domain: intended for allocating memory for general-purpose memory " "buffers where the allocation *must* go to the system allocator or where the " "allocator can operate without the :term:`GIL`. The memory is requested " -"directly to the system." +"directly from the system. See :ref:`Raw Memory Interface <raw-" +"memoryinterface>`." msgstr "" -#: ../../c-api/memory.rst:119 +#: ../../c-api/memory.rst:116 msgid "" "\"Mem\" domain: intended for allocating memory for Python buffers and " "general-purpose memory buffers where the allocation must be performed with " -"the :term:`GIL` held. The memory is taken from the Python private heap." +"the :term:`GIL` held. The memory is taken from the Python private heap. See :" +"ref:`Memory Interface <memoryinterface>`." msgstr "" -#: ../../c-api/memory.rst:123 +#: ../../c-api/memory.rst:121 msgid "" -"Object domain: intended for allocating memory belonging to Python objects. " -"The memory is taken from the Python private heap." +"Object domain: intended for allocating memory for Python objects. The memory " +"is taken from the Python private heap. See :ref:`Object allocators " +"<objectinterface>`." msgstr "" #: ../../c-api/memory.rst:126 msgid "" -"When freeing memory previously allocated by the allocating functions " -"belonging to a given domain,the matching specific deallocating functions " -"must be used. For example, :c:func:`PyMem_Free` must be used to free memory " -"allocated using :c:func:`PyMem_Malloc`." +"The :term:`free-threaded <free threading>` build requires that only Python " +"objects are allocated using the \"object\" domain and that all Python " +"objects are allocated using that domain. This differs from the prior Python " +"versions, where this was only a best practice and not a hard requirement." msgstr "" -#: ../../c-api/memory.rst:131 -msgid "Raw Memory Interface" +#: ../../c-api/memory.rst:130 +msgid "" +"For example, buffers (non-Python objects) should be allocated using :c:func:" +"`PyMem_Malloc`, :c:func:`PyMem_RawMalloc`, or :c:func:`malloc`, but not :c:" +"func:`PyObject_Malloc`." msgstr "" #: ../../c-api/memory.rst:133 +msgid "See :ref:`Memory Allocation APIs <free-threaded-memory-allocation>`." +msgstr "" + +#: ../../c-api/memory.rst:139 +msgid "Raw Memory Interface" +msgstr "" + +#: ../../c-api/memory.rst:141 msgid "" "The following function sets are wrappers to the system allocator. These " "functions are thread-safe, the :term:`GIL <global interpreter lock>` does " "not need to be held." msgstr "" -#: ../../c-api/memory.rst:137 +#: ../../c-api/memory.rst:145 msgid "" "The :ref:`default raw memory allocator <default-memory-allocators>` uses the " "following functions: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` " @@ -195,63 +206,63 @@ msgid "" "requesting zero bytes." msgstr "" -#: ../../c-api/memory.rst:146 ../../c-api/memory.rst:217 -#: ../../c-api/memory.rst:325 +#: ../../c-api/memory.rst:154 ../../c-api/memory.rst:225 +#: ../../c-api/memory.rst:335 msgid "" "Allocates *n* bytes and returns a pointer of type :c:expr:`void*` to the " "allocated memory, or ``NULL`` if the request fails." msgstr "" -#: ../../c-api/memory.rst:149 +#: ../../c-api/memory.rst:157 msgid "" "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, " "as if ``PyMem_RawMalloc(1)`` had been called instead. The memory will not " "have been initialized in any way." msgstr "" -#: ../../c-api/memory.rst:156 ../../c-api/memory.rst:227 -#: ../../c-api/memory.rst:335 +#: ../../c-api/memory.rst:164 ../../c-api/memory.rst:235 +#: ../../c-api/memory.rst:345 msgid "" "Allocates *nelem* elements each whose size in bytes is *elsize* and returns " "a pointer of type :c:expr:`void*` to the allocated memory, or ``NULL`` if " "the request fails. The memory is initialized to zeros." msgstr "" -#: ../../c-api/memory.rst:160 +#: ../../c-api/memory.rst:168 msgid "" "Requesting zero elements or elements of size zero bytes returns a distinct " "non-``NULL`` pointer if possible, as if ``PyMem_RawCalloc(1, 1)`` had been " "called instead." msgstr "" -#: ../../c-api/memory.rst:169 ../../c-api/memory.rst:240 -#: ../../c-api/memory.rst:348 +#: ../../c-api/memory.rst:177 ../../c-api/memory.rst:248 +#: ../../c-api/memory.rst:358 msgid "" "Resizes the memory block pointed to by *p* to *n* bytes. The contents will " "be unchanged to the minimum of the old and the new sizes." msgstr "" -#: ../../c-api/memory.rst:172 +#: ../../c-api/memory.rst:180 msgid "" "If *p* is ``NULL``, the call is equivalent to ``PyMem_RawMalloc(n)``; else " "if *n* is equal to zero, the memory block is resized but is not freed, and " "the returned pointer is non-``NULL``." msgstr "" -#: ../../c-api/memory.rst:176 +#: ../../c-api/memory.rst:184 msgid "" "Unless *p* is ``NULL``, it must have been returned by a previous call to :c:" "func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` or :c:func:" "`PyMem_RawCalloc`." msgstr "" -#: ../../c-api/memory.rst:180 +#: ../../c-api/memory.rst:188 msgid "" "If the request fails, :c:func:`PyMem_RawRealloc` returns ``NULL`` and *p* " "remains a valid pointer to the previous memory area." msgstr "" -#: ../../c-api/memory.rst:186 +#: ../../c-api/memory.rst:194 msgid "" "Frees the memory block pointed to by *p*, which must have been returned by a " "previous call to :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` or :c:" @@ -259,73 +270,73 @@ msgid "" "called before, undefined behavior occurs." msgstr "" -#: ../../c-api/memory.rst:191 ../../c-api/memory.rst:261 -#: ../../c-api/memory.rst:369 +#: ../../c-api/memory.rst:199 ../../c-api/memory.rst:269 +#: ../../c-api/memory.rst:379 msgid "If *p* is ``NULL``, no operation is performed." msgstr "" -#: ../../c-api/memory.rst:197 +#: ../../c-api/memory.rst:205 msgid "Memory Interface" msgstr "記憶體介面" -#: ../../c-api/memory.rst:199 ../../c-api/memory.rst:305 +#: ../../c-api/memory.rst:207 ../../c-api/memory.rst:315 msgid "" "The following function sets, modeled after the ANSI C standard, but " "specifying behavior when requesting zero bytes, are available for allocating " "and releasing memory from the Python heap." msgstr "" -#: ../../c-api/memory.rst:203 +#: ../../c-api/memory.rst:211 msgid "" "The :ref:`default memory allocator <default-memory-allocators>` uses the :" "ref:`pymalloc memory allocator <pymalloc>`." msgstr "" -#: ../../c-api/memory.rst:208 ../../c-api/memory.rst:320 +#: ../../c-api/memory.rst:216 ../../c-api/memory.rst:330 msgid "" "The :term:`GIL <global interpreter lock>` must be held when using these " "functions." msgstr "" -#: ../../c-api/memory.rst:213 +#: ../../c-api/memory.rst:221 msgid "" "The default allocator is now pymalloc instead of system :c:func:`malloc`." msgstr "" -#: ../../c-api/memory.rst:220 +#: ../../c-api/memory.rst:228 msgid "" "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, " "as if ``PyMem_Malloc(1)`` had been called instead. The memory will not have " "been initialized in any way." msgstr "" -#: ../../c-api/memory.rst:231 +#: ../../c-api/memory.rst:239 msgid "" "Requesting zero elements or elements of size zero bytes returns a distinct " "non-``NULL`` pointer if possible, as if ``PyMem_Calloc(1, 1)`` had been " "called instead." msgstr "" -#: ../../c-api/memory.rst:243 +#: ../../c-api/memory.rst:251 msgid "" "If *p* is ``NULL``, the call is equivalent to ``PyMem_Malloc(n)``; else if " "*n* is equal to zero, the memory block is resized but is not freed, and the " "returned pointer is non-``NULL``." msgstr "" -#: ../../c-api/memory.rst:247 +#: ../../c-api/memory.rst:255 msgid "" "Unless *p* is ``NULL``, it must have been returned by a previous call to :c:" "func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:`PyMem_Calloc`." msgstr "" -#: ../../c-api/memory.rst:250 +#: ../../c-api/memory.rst:258 msgid "" "If the request fails, :c:func:`PyMem_Realloc` returns ``NULL`` and *p* " "remains a valid pointer to the previous memory area." msgstr "" -#: ../../c-api/memory.rst:256 +#: ../../c-api/memory.rst:264 msgid "" "Frees the memory block pointed to by *p*, which must have been returned by a " "previous call to :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:" @@ -333,20 +344,20 @@ msgid "" "undefined behavior occurs." msgstr "" -#: ../../c-api/memory.rst:263 +#: ../../c-api/memory.rst:271 msgid "" "The following type-oriented macros are provided for convenience. Note that " "*TYPE* refers to any C type." msgstr "" -#: ../../c-api/memory.rst:269 +#: ../../c-api/memory.rst:277 msgid "" "Same as :c:func:`PyMem_Malloc`, but allocates ``(n * sizeof(TYPE))`` bytes " "of memory. Returns a pointer cast to ``TYPE*``. The memory will not have " "been initialized in any way." msgstr "" -#: ../../c-api/memory.rst:276 +#: ../../c-api/memory.rst:284 msgid "" "Same as :c:func:`PyMem_Realloc`, but the memory block is resized to ``(n * " "sizeof(TYPE))`` bytes. Returns a pointer cast to ``TYPE*``. On return, *p* " @@ -354,17 +365,17 @@ msgid "" "failure." msgstr "" -#: ../../c-api/memory.rst:281 +#: ../../c-api/memory.rst:289 msgid "" "This is a C preprocessor macro; *p* is always reassigned. Save the original " "value of *p* to avoid losing memory when handling errors." msgstr "" -#: ../../c-api/memory.rst:287 +#: ../../c-api/memory.rst:295 msgid "Same as :c:func:`PyMem_Free`." msgstr "和 :c:func:`PyMem_Free` 相同。" -#: ../../c-api/memory.rst:289 +#: ../../c-api/memory.rst:297 msgid "" "In addition, the following macro sets are provided for calling the Python " "memory allocator directly, without involving the C API functions listed " @@ -372,35 +383,35 @@ msgid "" "across Python versions and is therefore deprecated in extension modules." msgstr "" -#: ../../c-api/memory.rst:294 +#: ../../c-api/memory.rst:302 msgid "``PyMem_MALLOC(size)``" msgstr "``PyMem_MALLOC(size)``" -#: ../../c-api/memory.rst:295 +#: ../../c-api/memory.rst:303 msgid "``PyMem_NEW(type, size)``" msgstr "``PyMem_NEW(type, size)``" -#: ../../c-api/memory.rst:296 +#: ../../c-api/memory.rst:304 msgid "``PyMem_REALLOC(ptr, size)``" msgstr "``PyMem_REALLOC(ptr, size)``" -#: ../../c-api/memory.rst:297 +#: ../../c-api/memory.rst:305 msgid "``PyMem_RESIZE(ptr, type, size)``" msgstr "``PyMem_RESIZE(ptr, type, size)``" -#: ../../c-api/memory.rst:298 +#: ../../c-api/memory.rst:306 msgid "``PyMem_FREE(ptr)``" msgstr "``PyMem_FREE(ptr)``" -#: ../../c-api/memory.rst:299 +#: ../../c-api/memory.rst:307 msgid "``PyMem_DEL(ptr)``" msgstr "``PyMem_DEL(ptr)``" -#: ../../c-api/memory.rst:303 +#: ../../c-api/memory.rst:313 msgid "Object allocators" msgstr "" -#: ../../c-api/memory.rst:310 +#: ../../c-api/memory.rst:320 msgid "" "There is no guarantee that the memory returned by these allocators can be " "successfully cast to a Python object when intercepting the allocating " @@ -408,47 +419,47 @@ msgid "" "Memory Allocators <customize-memory-allocators>` section." msgstr "" -#: ../../c-api/memory.rst:315 +#: ../../c-api/memory.rst:325 msgid "" "The :ref:`default object allocator <default-memory-allocators>` uses the :" "ref:`pymalloc memory allocator <pymalloc>`." msgstr "" -#: ../../c-api/memory.rst:328 +#: ../../c-api/memory.rst:338 msgid "" "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, " "as if ``PyObject_Malloc(1)`` had been called instead. The memory will not " "have been initialized in any way." msgstr "" -#: ../../c-api/memory.rst:339 +#: ../../c-api/memory.rst:349 msgid "" "Requesting zero elements or elements of size zero bytes returns a distinct " "non-``NULL`` pointer if possible, as if ``PyObject_Calloc(1, 1)`` had been " "called instead." msgstr "" -#: ../../c-api/memory.rst:351 +#: ../../c-api/memory.rst:361 msgid "" "If *p* is ``NULL``, the call is equivalent to ``PyObject_Malloc(n)``; else " "if *n* is equal to zero, the memory block is resized but is not freed, and " "the returned pointer is non-``NULL``." msgstr "" -#: ../../c-api/memory.rst:355 +#: ../../c-api/memory.rst:365 msgid "" "Unless *p* is ``NULL``, it must have been returned by a previous call to :c:" "func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` or :c:func:" "`PyObject_Calloc`." msgstr "" -#: ../../c-api/memory.rst:358 +#: ../../c-api/memory.rst:368 msgid "" "If the request fails, :c:func:`PyObject_Realloc` returns ``NULL`` and *p* " "remains a valid pointer to the previous memory area." msgstr "" -#: ../../c-api/memory.rst:364 +#: ../../c-api/memory.rst:374 msgid "" "Frees the memory block pointed to by *p*, which must have been returned by a " "previous call to :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` or :c:" @@ -456,283 +467,283 @@ msgid "" "called before, undefined behavior occurs." msgstr "" -#: ../../c-api/memory.rst:375 +#: ../../c-api/memory.rst:385 msgid "Default Memory Allocators" msgstr "" -#: ../../c-api/memory.rst:377 +#: ../../c-api/memory.rst:387 msgid "Default memory allocators:" msgstr "" -#: ../../c-api/memory.rst:380 +#: ../../c-api/memory.rst:390 msgid "Configuration" msgstr "配置" -#: ../../c-api/memory.rst:380 +#: ../../c-api/memory.rst:390 msgid "Name" msgstr "名稱" -#: ../../c-api/memory.rst:380 +#: ../../c-api/memory.rst:390 msgid "PyMem_RawMalloc" msgstr "PyMem_RawMalloc" -#: ../../c-api/memory.rst:380 +#: ../../c-api/memory.rst:390 msgid "PyMem_Malloc" msgstr "PyMem_Malloc" -#: ../../c-api/memory.rst:380 +#: ../../c-api/memory.rst:390 msgid "PyObject_Malloc" msgstr "PyObject_Malloc" -#: ../../c-api/memory.rst:382 +#: ../../c-api/memory.rst:392 msgid "Release build" msgstr "" -#: ../../c-api/memory.rst:382 +#: ../../c-api/memory.rst:392 msgid "``\"pymalloc\"``" msgstr "``\"pymalloc\"``" -#: ../../c-api/memory.rst:382 ../../c-api/memory.rst:384 +#: ../../c-api/memory.rst:392 ../../c-api/memory.rst:394 msgid "``malloc``" msgstr "``malloc``" -#: ../../c-api/memory.rst:382 +#: ../../c-api/memory.rst:392 msgid "``pymalloc``" msgstr "``pymalloc``" -#: ../../c-api/memory.rst:383 +#: ../../c-api/memory.rst:393 msgid "Debug build" msgstr "" -#: ../../c-api/memory.rst:383 +#: ../../c-api/memory.rst:393 msgid "``\"pymalloc_debug\"``" msgstr "``\"pymalloc_debug\"``" -#: ../../c-api/memory.rst:383 ../../c-api/memory.rst:385 +#: ../../c-api/memory.rst:393 ../../c-api/memory.rst:395 msgid "``malloc`` + debug" msgstr "" -#: ../../c-api/memory.rst:383 +#: ../../c-api/memory.rst:393 msgid "``pymalloc`` + debug" msgstr "" -#: ../../c-api/memory.rst:384 +#: ../../c-api/memory.rst:394 msgid "Release build, without pymalloc" msgstr "" -#: ../../c-api/memory.rst:384 +#: ../../c-api/memory.rst:394 msgid "``\"malloc\"``" msgstr "``\"malloc\"``" -#: ../../c-api/memory.rst:385 +#: ../../c-api/memory.rst:395 msgid "Debug build, without pymalloc" msgstr "" -#: ../../c-api/memory.rst:385 +#: ../../c-api/memory.rst:395 msgid "``\"malloc_debug\"``" msgstr "``\"malloc_debug\"``" -#: ../../c-api/memory.rst:388 +#: ../../c-api/memory.rst:398 msgid "Legend:" msgstr "" -#: ../../c-api/memory.rst:390 +#: ../../c-api/memory.rst:400 msgid "Name: value for :envvar:`PYTHONMALLOC` environment variable." msgstr "" -#: ../../c-api/memory.rst:391 +#: ../../c-api/memory.rst:401 msgid "" "``malloc``: system allocators from the standard C library, C functions: :c:" "func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`." msgstr "" -#: ../../c-api/memory.rst:393 +#: ../../c-api/memory.rst:403 msgid "``pymalloc``: :ref:`pymalloc memory allocator <pymalloc>`." msgstr "" -#: ../../c-api/memory.rst:394 +#: ../../c-api/memory.rst:404 msgid "" "``mimalloc``: :ref:`mimalloc memory allocator <mimalloc>`. The pymalloc " "allocator will be used if mimalloc support isn't available." msgstr "" -#: ../../c-api/memory.rst:396 +#: ../../c-api/memory.rst:406 msgid "" "\"+ debug\": with :ref:`debug hooks on the Python memory allocators <pymem-" "debug-hooks>`." msgstr "" -#: ../../c-api/memory.rst:398 +#: ../../c-api/memory.rst:408 msgid "\"Debug build\": :ref:`Python build in debug mode <debug-build>`." msgstr "" -#: ../../c-api/memory.rst:403 +#: ../../c-api/memory.rst:413 msgid "Customize Memory Allocators" msgstr "" -#: ../../c-api/memory.rst:409 +#: ../../c-api/memory.rst:419 msgid "" "Structure used to describe a memory block allocator. The structure has the " "following fields:" msgstr "" -#: ../../c-api/memory.rst:413 ../../c-api/memory.rst:660 +#: ../../c-api/memory.rst:423 ../../c-api/memory.rst:670 msgid "Field" msgstr "欄位" -#: ../../c-api/memory.rst:413 ../../c-api/memory.rst:660 +#: ../../c-api/memory.rst:423 ../../c-api/memory.rst:670 msgid "Meaning" msgstr "意義" -#: ../../c-api/memory.rst:415 ../../c-api/memory.rst:662 +#: ../../c-api/memory.rst:425 ../../c-api/memory.rst:672 msgid "``void *ctx``" msgstr "``void *ctx``" -#: ../../c-api/memory.rst:415 ../../c-api/memory.rst:662 +#: ../../c-api/memory.rst:425 ../../c-api/memory.rst:672 msgid "user context passed as first argument" msgstr "" -#: ../../c-api/memory.rst:417 +#: ../../c-api/memory.rst:427 msgid "``void* malloc(void *ctx, size_t size)``" msgstr "``void* malloc(void *ctx, size_t size)``" -#: ../../c-api/memory.rst:417 +#: ../../c-api/memory.rst:427 msgid "allocate a memory block" msgstr "" -#: ../../c-api/memory.rst:419 +#: ../../c-api/memory.rst:429 msgid "``void* calloc(void *ctx, size_t nelem, size_t elsize)``" msgstr "``void* calloc(void *ctx, size_t nelem, size_t elsize)``" -#: ../../c-api/memory.rst:419 +#: ../../c-api/memory.rst:429 msgid "allocate a memory block initialized with zeros" msgstr "" -#: ../../c-api/memory.rst:422 +#: ../../c-api/memory.rst:432 msgid "``void* realloc(void *ctx, void *ptr, size_t new_size)``" msgstr "``void* realloc(void *ctx, void *ptr, size_t new_size)``" -#: ../../c-api/memory.rst:422 +#: ../../c-api/memory.rst:432 msgid "allocate or resize a memory block" msgstr "" -#: ../../c-api/memory.rst:424 +#: ../../c-api/memory.rst:434 msgid "``void free(void *ctx, void *ptr)``" msgstr "``void free(void *ctx, void *ptr)``" -#: ../../c-api/memory.rst:424 +#: ../../c-api/memory.rst:434 msgid "free a memory block" msgstr "" -#: ../../c-api/memory.rst:427 +#: ../../c-api/memory.rst:437 msgid "" "The :c:type:`!PyMemAllocator` structure was renamed to :c:type:" "`PyMemAllocatorEx` and a new ``calloc`` field was added." msgstr "" -#: ../../c-api/memory.rst:434 +#: ../../c-api/memory.rst:444 msgid "Enum used to identify an allocator domain. Domains:" msgstr "" -#: ../../c-api/memory.rst:440 ../../c-api/memory.rst:449 -#: ../../c-api/memory.rst:458 +#: ../../c-api/memory.rst:450 ../../c-api/memory.rst:459 +#: ../../c-api/memory.rst:468 msgid "Functions:" msgstr "函式:" -#: ../../c-api/memory.rst:442 +#: ../../c-api/memory.rst:452 msgid ":c:func:`PyMem_RawMalloc`" msgstr ":c:func:`PyMem_RawMalloc`" -#: ../../c-api/memory.rst:443 +#: ../../c-api/memory.rst:453 msgid ":c:func:`PyMem_RawRealloc`" msgstr ":c:func:`PyMem_RawRealloc`" -#: ../../c-api/memory.rst:444 +#: ../../c-api/memory.rst:454 msgid ":c:func:`PyMem_RawCalloc`" msgstr ":c:func:`PyMem_RawCalloc`" -#: ../../c-api/memory.rst:445 +#: ../../c-api/memory.rst:455 msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" -#: ../../c-api/memory.rst:451 +#: ../../c-api/memory.rst:461 msgid ":c:func:`PyMem_Malloc`," msgstr ":c:func:`PyMem_Malloc`," -#: ../../c-api/memory.rst:452 +#: ../../c-api/memory.rst:462 msgid ":c:func:`PyMem_Realloc`" msgstr ":c:func:`PyMem_Realloc`" -#: ../../c-api/memory.rst:453 +#: ../../c-api/memory.rst:463 msgid ":c:func:`PyMem_Calloc`" msgstr ":c:func:`PyMem_Calloc`" -#: ../../c-api/memory.rst:454 +#: ../../c-api/memory.rst:464 msgid ":c:func:`PyMem_Free`" msgstr ":c:func:`PyMem_Free`" -#: ../../c-api/memory.rst:460 +#: ../../c-api/memory.rst:470 msgid ":c:func:`PyObject_Malloc`" msgstr ":c:func:`PyObject_Malloc`" -#: ../../c-api/memory.rst:461 +#: ../../c-api/memory.rst:471 msgid ":c:func:`PyObject_Realloc`" msgstr ":c:func:`PyObject_Realloc`" -#: ../../c-api/memory.rst:462 +#: ../../c-api/memory.rst:472 msgid ":c:func:`PyObject_Calloc`" msgstr ":c:func:`PyObject_Calloc`" -#: ../../c-api/memory.rst:463 +#: ../../c-api/memory.rst:473 msgid ":c:func:`PyObject_Free`" msgstr ":c:func:`PyObject_Free`" -#: ../../c-api/memory.rst:467 +#: ../../c-api/memory.rst:477 msgid "Get the memory block allocator of the specified domain." msgstr "" -#: ../../c-api/memory.rst:472 +#: ../../c-api/memory.rst:482 msgid "Set the memory block allocator of the specified domain." msgstr "" -#: ../../c-api/memory.rst:474 +#: ../../c-api/memory.rst:484 msgid "" "The new allocator must return a distinct non-``NULL`` pointer when " "requesting zero bytes." msgstr "" -#: ../../c-api/memory.rst:477 +#: ../../c-api/memory.rst:487 msgid "" "For the :c:macro:`PYMEM_DOMAIN_RAW` domain, the allocator must be thread-" "safe: the :term:`GIL <global interpreter lock>` is not held when the " "allocator is called." msgstr "" -#: ../../c-api/memory.rst:481 +#: ../../c-api/memory.rst:491 msgid "" "For the remaining domains, the allocator must also be thread-safe: the " "allocator may be called in different interpreters that do not share a " "``GIL``." msgstr "" -#: ../../c-api/memory.rst:485 +#: ../../c-api/memory.rst:495 msgid "" "If the new allocator is not a hook (does not call the previous allocator), " "the :c:func:`PyMem_SetupDebugHooks` function must be called to reinstall the " "debug hooks on top on the new allocator." msgstr "" -#: ../../c-api/memory.rst:489 +#: ../../c-api/memory.rst:499 msgid "" "See also :c:member:`PyPreConfig.allocator` and :ref:`Preinitialize Python " "with PyPreConfig <c-preinit>`." msgstr "" -#: ../../c-api/memory.rst:494 +#: ../../c-api/memory.rst:504 msgid ":c:func:`PyMem_SetAllocator` does have the following contract:" msgstr "" -#: ../../c-api/memory.rst:496 +#: ../../c-api/memory.rst:506 msgid "" "It can be called after :c:func:`Py_PreInitialize` and before :c:func:" "`Py_InitializeFromConfig` to install a custom memory allocator. There are no " @@ -742,7 +753,7 @@ msgid "" "domains>` for more information." msgstr "" -#: ../../c-api/memory.rst:504 +#: ../../c-api/memory.rst:514 msgid "" "If called after Python has finish initializing (after :c:func:" "`Py_InitializeFromConfig` has been called) the allocator **must** wrap the " @@ -750,21 +761,21 @@ msgid "" "arbitrary one is **not supported**." msgstr "" -#: ../../c-api/memory.rst:509 +#: ../../c-api/memory.rst:519 msgid "All allocators must be thread-safe." msgstr "" -#: ../../c-api/memory.rst:515 +#: ../../c-api/memory.rst:525 msgid "" "Setup :ref:`debug hooks in the Python memory allocators <pymem-debug-hooks>` " "to detect memory errors." msgstr "" -#: ../../c-api/memory.rst:522 +#: ../../c-api/memory.rst:532 msgid "Debug hooks on the Python memory allocators" msgstr "" -#: ../../c-api/memory.rst:524 +#: ../../c-api/memory.rst:534 msgid "" "When :ref:`Python is built in debug mode <debug-build>`, the :c:func:" "`PyMem_SetupDebugHooks` function is called at the :ref:`Python " @@ -772,19 +783,19 @@ msgid "" "allocators to detect memory errors." msgstr "" -#: ../../c-api/memory.rst:529 +#: ../../c-api/memory.rst:539 msgid "" "The :envvar:`PYTHONMALLOC` environment variable can be used to install debug " "hooks on a Python compiled in release mode (ex: ``PYTHONMALLOC=debug``)." msgstr "" -#: ../../c-api/memory.rst:532 +#: ../../c-api/memory.rst:542 msgid "" "The :c:func:`PyMem_SetupDebugHooks` function can be used to set debug hooks " "after calling :c:func:`PyMem_SetAllocator`." msgstr "" -#: ../../c-api/memory.rst:535 +#: ../../c-api/memory.rst:545 msgid "" "These debug hooks fill dynamically allocated memory blocks with special, " "recognizable bit patterns. Newly allocated memory is filled with the byte " @@ -794,25 +805,25 @@ msgid "" "these bytes are unlikely to be valid addresses, floats, or ASCII strings." msgstr "" -#: ../../c-api/memory.rst:542 +#: ../../c-api/memory.rst:552 msgid "Runtime checks:" msgstr "Runtime 檢查:" -#: ../../c-api/memory.rst:544 +#: ../../c-api/memory.rst:554 msgid "" "Detect API violations. For example, detect if :c:func:`PyObject_Free` is " "called on a memory block allocated by :c:func:`PyMem_Malloc`." msgstr "" -#: ../../c-api/memory.rst:546 +#: ../../c-api/memory.rst:556 msgid "Detect write before the start of the buffer (buffer underflow)." msgstr "" -#: ../../c-api/memory.rst:547 +#: ../../c-api/memory.rst:557 msgid "Detect write after the end of the buffer (buffer overflow)." msgstr "" -#: ../../c-api/memory.rst:548 +#: ../../c-api/memory.rst:558 msgid "" "Check that the :term:`GIL <global interpreter lock>` is held when allocator " "functions of :c:macro:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) " @@ -820,7 +831,7 @@ msgid "" "called." msgstr "" -#: ../../c-api/memory.rst:553 +#: ../../c-api/memory.rst:563 msgid "" "On error, the debug hooks use the :mod:`tracemalloc` module to get the " "traceback where a memory block was allocated. The traceback is only " @@ -828,7 +839,7 @@ msgid "" "memory block was traced." msgstr "" -#: ../../c-api/memory.rst:558 +#: ../../c-api/memory.rst:568 msgid "" "Let *S* = ``sizeof(size_t)``. ``2*S`` bytes are added at each end of each " "block of *N* bytes requested. The memory layout is like so, where p " @@ -838,49 +849,49 @@ msgid "" "from a Python slice):" msgstr "" -#: ../../c-api/memory.rst:564 +#: ../../c-api/memory.rst:574 msgid "``p[-2*S:-S]``" msgstr "``p[-2*S:-S]``" -#: ../../c-api/memory.rst:565 +#: ../../c-api/memory.rst:575 msgid "" "Number of bytes originally asked for. This is a size_t, big-endian (easier " "to read in a memory dump)." msgstr "" -#: ../../c-api/memory.rst:567 +#: ../../c-api/memory.rst:577 msgid "``p[-S]``" msgstr "``p[-S]``" -#: ../../c-api/memory.rst:568 +#: ../../c-api/memory.rst:578 msgid "API identifier (ASCII character):" msgstr "" -#: ../../c-api/memory.rst:570 +#: ../../c-api/memory.rst:580 msgid "``'r'`` for :c:macro:`PYMEM_DOMAIN_RAW`." msgstr "" -#: ../../c-api/memory.rst:571 +#: ../../c-api/memory.rst:581 msgid "``'m'`` for :c:macro:`PYMEM_DOMAIN_MEM`." msgstr "" -#: ../../c-api/memory.rst:572 +#: ../../c-api/memory.rst:582 msgid "``'o'`` for :c:macro:`PYMEM_DOMAIN_OBJ`." msgstr "" -#: ../../c-api/memory.rst:574 +#: ../../c-api/memory.rst:584 msgid "``p[-S+1:0]``" msgstr "``p[-S+1:0]``" -#: ../../c-api/memory.rst:575 +#: ../../c-api/memory.rst:585 msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch under- writes and reads." msgstr "" -#: ../../c-api/memory.rst:577 +#: ../../c-api/memory.rst:587 msgid "``p[0:N]``" msgstr "``p[0:N]``" -#: ../../c-api/memory.rst:578 +#: ../../c-api/memory.rst:588 msgid "" "The requested memory, filled with copies of PYMEM_CLEANBYTE, used to catch " "reference to uninitialized memory. When a realloc-like function is called " @@ -891,25 +902,25 @@ msgid "" "bytes are also filled with PYMEM_DEADBYTE." msgstr "" -#: ../../c-api/memory.rst:586 +#: ../../c-api/memory.rst:596 msgid "``p[N:N+S]``" msgstr "``p[N:N+S]``" -#: ../../c-api/memory.rst:587 +#: ../../c-api/memory.rst:597 msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch over- writes and reads." msgstr "" -#: ../../c-api/memory.rst:589 +#: ../../c-api/memory.rst:599 msgid "``p[N+S:N+2*S]``" msgstr "``p[N+S:N+2*S]``" -#: ../../c-api/memory.rst:590 +#: ../../c-api/memory.rst:600 msgid "" "Only used if the ``PYMEM_DEBUG_SERIALNO`` macro is defined (not defined by " "default)." msgstr "" -#: ../../c-api/memory.rst:593 +#: ../../c-api/memory.rst:603 msgid "" "A serial number, incremented by 1 on each call to a malloc-like or realloc-" "like function. Big-endian :c:type:`size_t`. If \"bad memory\" is detected " @@ -919,7 +930,7 @@ msgid "" "number is incremented, and exists so you can set such a breakpoint easily." msgstr "" -#: ../../c-api/memory.rst:600 +#: ../../c-api/memory.rst:610 msgid "" "A realloc-like or free-like function first checks that the " "PYMEM_FORBIDDENBYTE bytes at each end are intact. If they've been altered, " @@ -932,7 +943,7 @@ msgid "" "getting used)." msgstr "" -#: ../../c-api/memory.rst:609 +#: ../../c-api/memory.rst:619 msgid "" "The :c:func:`PyMem_SetupDebugHooks` function now also works on Python " "compiled in release mode. On error, the debug hooks now use :mod:" @@ -941,7 +952,7 @@ msgid "" "`PYMEM_DOMAIN_OBJ` and :c:macro:`PYMEM_DOMAIN_MEM` domains are called." msgstr "" -#: ../../c-api/memory.rst:617 +#: ../../c-api/memory.rst:627 msgid "" "Byte patterns ``0xCB`` (``PYMEM_CLEANBYTE``), ``0xDB`` (``PYMEM_DEADBYTE``) " "and ``0xFB`` (``PYMEM_FORBIDDENBYTE``) have been replaced with ``0xCD``, " @@ -949,11 +960,11 @@ msgid "" "``malloc()`` and ``free()``." msgstr "" -#: ../../c-api/memory.rst:627 +#: ../../c-api/memory.rst:637 msgid "The pymalloc allocator" msgstr "" -#: ../../c-api/memory.rst:629 +#: ../../c-api/memory.rst:639 msgid "" "Python has a *pymalloc* allocator optimized for small objects (smaller or " "equal to 512 bytes) with a short lifetime. It uses memory mappings called " @@ -962,75 +973,75 @@ msgid "" "`PyMem_RawRealloc` for allocations larger than 512 bytes." msgstr "" -#: ../../c-api/memory.rst:635 +#: ../../c-api/memory.rst:645 msgid "" "*pymalloc* is the :ref:`default allocator <default-memory-allocators>` of " "the :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) and :c:macro:" "`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) domains." msgstr "" -#: ../../c-api/memory.rst:639 +#: ../../c-api/memory.rst:649 msgid "The arena allocator uses the following functions:" msgstr "" -#: ../../c-api/memory.rst:641 +#: ../../c-api/memory.rst:651 msgid ":c:func:`!VirtualAlloc` and :c:func:`!VirtualFree` on Windows," msgstr "" -#: ../../c-api/memory.rst:642 +#: ../../c-api/memory.rst:652 msgid ":c:func:`!mmap` and :c:func:`!munmap` if available," msgstr "" -#: ../../c-api/memory.rst:643 +#: ../../c-api/memory.rst:653 msgid ":c:func:`malloc` and :c:func:`free` otherwise." msgstr "" -#: ../../c-api/memory.rst:645 +#: ../../c-api/memory.rst:655 msgid "" "This allocator is disabled if Python is configured with the :option:`--" "without-pymalloc` option. It can also be disabled at runtime using the :" "envvar:`PYTHONMALLOC` environment variable (ex: ``PYTHONMALLOC=malloc``)." msgstr "" -#: ../../c-api/memory.rst:650 +#: ../../c-api/memory.rst:660 msgid "Customize pymalloc Arena Allocator" msgstr "" -#: ../../c-api/memory.rst:656 +#: ../../c-api/memory.rst:666 msgid "" "Structure used to describe an arena allocator. The structure has three " "fields:" msgstr "" -#: ../../c-api/memory.rst:664 +#: ../../c-api/memory.rst:674 msgid "``void* alloc(void *ctx, size_t size)``" msgstr "``void* alloc(void *ctx, size_t size)``" -#: ../../c-api/memory.rst:664 +#: ../../c-api/memory.rst:674 msgid "allocate an arena of size bytes" msgstr "" -#: ../../c-api/memory.rst:666 +#: ../../c-api/memory.rst:676 msgid "``void free(void *ctx, void *ptr, size_t size)``" msgstr "``void free(void *ctx, void *ptr, size_t size)``" -#: ../../c-api/memory.rst:666 +#: ../../c-api/memory.rst:676 msgid "free an arena" msgstr "" -#: ../../c-api/memory.rst:671 +#: ../../c-api/memory.rst:681 msgid "Get the arena allocator." msgstr "" -#: ../../c-api/memory.rst:675 +#: ../../c-api/memory.rst:685 msgid "Set the arena allocator." msgstr "" -#: ../../c-api/memory.rst:680 +#: ../../c-api/memory.rst:690 msgid "The mimalloc allocator" msgstr "" -#: ../../c-api/memory.rst:684 +#: ../../c-api/memory.rst:694 msgid "" "Python supports the mimalloc allocator when the underlying platform support " "is available. mimalloc \"is a general purpose allocator with excellent " @@ -1038,46 +1049,46 @@ msgid "" "runtime systems of the Koka and Lean languages.\"" msgstr "" -#: ../../c-api/memory.rst:689 +#: ../../c-api/memory.rst:699 msgid "tracemalloc C API" msgstr "" -#: ../../c-api/memory.rst:695 +#: ../../c-api/memory.rst:705 msgid "Track an allocated memory block in the :mod:`tracemalloc` module." msgstr "" -#: ../../c-api/memory.rst:697 +#: ../../c-api/memory.rst:707 msgid "" "Return ``0`` on success, return ``-1`` on error (failed to allocate memory " "to store the trace). Return ``-2`` if tracemalloc is disabled." msgstr "" -#: ../../c-api/memory.rst:700 +#: ../../c-api/memory.rst:710 msgid "If memory block is already tracked, update the existing trace." msgstr "" -#: ../../c-api/memory.rst:704 +#: ../../c-api/memory.rst:714 msgid "" "Untrack an allocated memory block in the :mod:`tracemalloc` module. Do " "nothing if the block was not tracked." msgstr "" -#: ../../c-api/memory.rst:707 +#: ../../c-api/memory.rst:717 msgid "Return ``-2`` if tracemalloc is disabled, otherwise return ``0``." msgstr "" -#: ../../c-api/memory.rst:713 +#: ../../c-api/memory.rst:723 msgid "Examples" msgstr "範例" -#: ../../c-api/memory.rst:715 +#: ../../c-api/memory.rst:725 msgid "" "Here is the example from section :ref:`memoryoverview`, rewritten so that " "the I/O buffer is allocated from the Python heap by using the first function " "set::" msgstr "" -#: ../../c-api/memory.rst:718 +#: ../../c-api/memory.rst:728 msgid "" "PyObject *res;\n" "char *buf = (char *) PyMem_Malloc(BUFSIZ); /* for I/O */\n" @@ -1090,11 +1101,11 @@ msgid "" "return res;" msgstr "" -#: ../../c-api/memory.rst:728 +#: ../../c-api/memory.rst:738 msgid "The same code using the type-oriented function set::" msgstr "" -#: ../../c-api/memory.rst:730 +#: ../../c-api/memory.rst:740 msgid "" "PyObject *res;\n" "char *buf = PyMem_New(char, BUFSIZ); /* for I/O */\n" @@ -1107,7 +1118,7 @@ msgid "" "return res;" msgstr "" -#: ../../c-api/memory.rst:740 +#: ../../c-api/memory.rst:750 msgid "" "Note that in the two examples above, the buffer is always manipulated via " "functions belonging to the same set. Indeed, it is required to use the same " @@ -1117,7 +1128,7 @@ msgid "" "different allocators operating on different heaps. ::" msgstr "" -#: ../../c-api/memory.rst:747 +#: ../../c-api/memory.rst:757 msgid "" "char *buf1 = PyMem_New(char, BUFSIZ);\n" "char *buf2 = (char *) malloc(BUFSIZ);\n" @@ -1128,14 +1139,14 @@ msgid "" "free(buf1); /* Fatal -- should be PyMem_Del() */" msgstr "" -#: ../../c-api/memory.rst:755 +#: ../../c-api/memory.rst:765 msgid "" "In addition to the functions aimed at handling raw memory blocks from the " "Python heap, objects in Python are allocated and released with :c:macro:" "`PyObject_New`, :c:macro:`PyObject_NewVar` and :c:func:`PyObject_Del`." msgstr "" -#: ../../c-api/memory.rst:759 +#: ../../c-api/memory.rst:769 msgid "" "These will be explained in the next chapter on defining and implementing new " "object types in C." diff --git a/c-api/module.po b/c-api/module.po index cd977561d1..13cc3dc95a 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -50,7 +50,7 @@ msgid "" msgstr "" #: ../../c-api/module.rst:46 ../../c-api/module.rst:270 -#: ../../c-api/module.rst:470 +#: ../../c-api/module.rst:472 msgid "Return ``NULL`` with an exception set on error." msgstr "在失敗時回傳 ``NULL`` 並設定例外。" @@ -468,17 +468,17 @@ msgid "" "defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED``." msgstr "" -#: ../../c-api/module.rst:426 +#: ../../c-api/module.rst:428 msgid "" "The module depends on the presence of the global interpreter lock (GIL), and " "may access global state without synchronization." msgstr "" -#: ../../c-api/module.rst:431 +#: ../../c-api/module.rst:433 msgid "The module is safe to run without an active GIL." msgstr "" -#: ../../c-api/module.rst:433 +#: ../../c-api/module.rst:435 msgid "" "This slot is ignored by Python builds not configured with :option:`--disable-" "gil`. Otherwise, it determines whether or not importing this module will " @@ -486,26 +486,26 @@ msgid "" "threaded-cpython` for more detail." msgstr "" -#: ../../c-api/module.rst:438 +#: ../../c-api/module.rst:440 msgid "" "Multiple ``Py_mod_gil`` slots may not be specified in one module definition." msgstr "" -#: ../../c-api/module.rst:440 +#: ../../c-api/module.rst:442 msgid "" "If ``Py_mod_gil`` is not specified, the import machinery defaults to " "``Py_MOD_GIL_USED``." msgstr "" -#: ../../c-api/module.rst:445 +#: ../../c-api/module.rst:447 msgid "See :PEP:`489` for more details on multi-phase initialization." msgstr "" -#: ../../c-api/module.rst:448 +#: ../../c-api/module.rst:450 msgid "Low-level module creation functions" msgstr "" -#: ../../c-api/module.rst:450 +#: ../../c-api/module.rst:452 msgid "" "The following functions are called under the hood when using multi-phase " "initialization. They can be used directly, for example when creating module " @@ -513,14 +513,14 @@ msgid "" "``PyModule_ExecDef`` must be called to fully initialize a module." msgstr "" -#: ../../c-api/module.rst:457 +#: ../../c-api/module.rst:459 msgid "" "Create a new module object, given the definition in *def* and the ModuleSpec " "*spec*. This behaves like :c:func:`PyModule_FromDefAndSpec2` with " "*module_api_version* set to :c:macro:`PYTHON_API_VERSION`." msgstr "" -#: ../../c-api/module.rst:465 +#: ../../c-api/module.rst:467 msgid "" "Create a new module object, given the definition in *def* and the ModuleSpec " "*spec*, assuming the API version *module_api_version*. If that version does " @@ -528,24 +528,24 @@ msgid "" "emitted." msgstr "" -#: ../../c-api/module.rst:474 +#: ../../c-api/module.rst:476 msgid "" "Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec` " "instead; only use this if you are sure you need it." msgstr "" -#: ../../c-api/module.rst:481 +#: ../../c-api/module.rst:483 msgid "Process any execution slots (:c:data:`Py_mod_exec`) given in *def*." msgstr "" -#: ../../c-api/module.rst:487 +#: ../../c-api/module.rst:489 msgid "" "Set the docstring for *module* to *docstring*. This function is called " "automatically when creating a module from ``PyModuleDef``, using either " "``PyModule_Create`` or ``PyModule_FromDefAndSpec``." msgstr "" -#: ../../c-api/module.rst:496 +#: ../../c-api/module.rst:498 msgid "" "Add the functions from the ``NULL`` terminated *functions* array to " "*module*. Refer to the :c:type:`PyMethodDef` documentation for details on " @@ -557,11 +557,11 @@ msgid "" "``PyModule_FromDefAndSpec``." msgstr "" -#: ../../c-api/module.rst:508 +#: ../../c-api/module.rst:510 msgid "Support functions" msgstr "支援的函式" -#: ../../c-api/module.rst:510 +#: ../../c-api/module.rst:512 msgid "" "The module initialization function (if using single phase initialization) or " "a function called from a module execution slot (if using multi-phase " @@ -569,29 +569,29 @@ msgid "" "module state:" msgstr "" -#: ../../c-api/module.rst:517 +#: ../../c-api/module.rst:519 msgid "" "Add an object to *module* as *name*. This is a convenience function which " "can be used from the module's initialization function." msgstr "" -#: ../../c-api/module.rst:520 +#: ../../c-api/module.rst:522 msgid "" "On success, return ``0``. On error, raise an exception and return ``-1``." msgstr "" -#: ../../c-api/module.rst:522 +#: ../../c-api/module.rst:524 msgid "" "Return ``-1`` if *value* is ``NULL``. It must be called with an exception " "raised in this case." msgstr "" -#: ../../c-api/module.rst:525 ../../c-api/module.rst:572 -#: ../../c-api/module.rst:599 +#: ../../c-api/module.rst:527 ../../c-api/module.rst:574 +#: ../../c-api/module.rst:601 msgid "Example usage::" msgstr "用法範例: ::" -#: ../../c-api/module.rst:527 +#: ../../c-api/module.rst:529 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -617,13 +617,13 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:539 +#: ../../c-api/module.rst:541 msgid "" "The example can also be written without checking explicitly if *obj* is " "``NULL``::" msgstr "" -#: ../../c-api/module.rst:542 +#: ../../c-api/module.rst:544 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -643,13 +643,13 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:551 +#: ../../c-api/module.rst:553 msgid "" "Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this " "case, since *obj* can be ``NULL``." msgstr "" -#: ../../c-api/module.rst:554 +#: ../../c-api/module.rst:556 msgid "" "The number of different *name* strings passed to this function should be " "kept small, usually by only using statically allocated strings as *name*. " @@ -659,7 +659,7 @@ msgid "" "internally to create a key object." msgstr "" -#: ../../c-api/module.rst:567 +#: ../../c-api/module.rst:569 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but \"steals\" a reference to " "*value*. It can be called with a result of function that returns a new " @@ -667,39 +667,39 @@ msgid "" "variable." msgstr "" -#: ../../c-api/module.rst:574 +#: ../../c-api/module.rst:576 msgid "" "if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n" " goto error;\n" "}" msgstr "" -#: ../../c-api/module.rst:583 +#: ../../c-api/module.rst:585 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to " "*value* on success (if it returns ``0``)." msgstr "" -#: ../../c-api/module.rst:586 +#: ../../c-api/module.rst:588 msgid "" "The new :c:func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions " "are recommended, since it is easy to introduce reference leaks by misusing " "the :c:func:`PyModule_AddObject` function." msgstr "" -#: ../../c-api/module.rst:593 +#: ../../c-api/module.rst:595 msgid "" "Unlike other functions that steal references, ``PyModule_AddObject()`` only " "releases the reference to *value* **on success**." msgstr "" -#: ../../c-api/module.rst:596 +#: ../../c-api/module.rst:598 msgid "" "This means that its return value must be checked, and calling code must :c:" "func:`Py_XDECREF` *value* manually on error." msgstr "" -#: ../../c-api/module.rst:601 +#: ../../c-api/module.rst:603 msgid "" "PyObject *obj = PyBytes_FromString(value);\n" "if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" @@ -713,24 +713,24 @@ msgid "" "// Py_XDECREF(obj) is not needed here." msgstr "" -#: ../../c-api/module.rst:614 +#: ../../c-api/module.rst:616 msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`." msgstr "" -#: ../../c-api/module.rst:619 +#: ../../c-api/module.rst:621 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:623 +#: ../../c-api/module.rst:625 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:629 +#: ../../c-api/module.rst:631 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 " @@ -738,14 +738,14 @@ msgid "" "on success." msgstr "" -#: ../../c-api/module.rst:634 +#: ../../c-api/module.rst:636 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:641 +#: ../../c-api/module.rst:643 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 " @@ -753,11 +753,11 @@ msgid "" "with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:649 +#: ../../c-api/module.rst:651 msgid "Add a string constant to *module*." msgstr "" -#: ../../c-api/module.rst:653 +#: ../../c-api/module.rst:655 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 " @@ -765,7 +765,7 @@ msgid "" "``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:663 +#: ../../c-api/module.rst:665 msgid "" "Indicate that *module* does or does not support running without the global " "interpreter lock (GIL), using one of the values from :c:macro:`Py_mod_gil`. " @@ -776,25 +776,25 @@ msgid "" "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:676 +#: ../../c-api/module.rst:678 msgid "Module lookup" msgstr "模組查找" -#: ../../c-api/module.rst:678 +#: ../../c-api/module.rst:680 msgid "" "Single-phase initialization creates singleton modules that can be looked up " "in the context of the current interpreter. This allows the module object to " "be retrieved later with only a reference to the module definition." msgstr "" -#: ../../c-api/module.rst:682 +#: ../../c-api/module.rst:684 msgid "" "These functions will not work on modules created using multi-phase " "initialization, since multiple such modules can be created from a single " "definition." msgstr "" -#: ../../c-api/module.rst:687 +#: ../../c-api/module.rst:689 msgid "" "Returns the module object that was created from *def* for the current " "interpreter. This method requires that the module object has been attached " @@ -803,18 +803,18 @@ msgid "" "to the interpreter state yet, it returns ``NULL``." msgstr "" -#: ../../c-api/module.rst:694 +#: ../../c-api/module.rst:696 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:697 +#: ../../c-api/module.rst:699 msgid "Only effective on modules created using single-phase initialization." msgstr "" -#: ../../c-api/module.rst:699 +#: ../../c-api/module.rst:701 msgid "" "Python calls ``PyState_AddModule`` automatically after importing a module, " "so it is unnecessary (but harmless) to call it from module initialization " @@ -825,15 +825,15 @@ msgid "" "state updates)." msgstr "" -#: ../../c-api/module.rst:707 ../../c-api/module.rst:718 +#: ../../c-api/module.rst:709 ../../c-api/module.rst:720 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/module.rst:709 +#: ../../c-api/module.rst:711 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "成功時回傳 ``0``,在失敗時回傳 ``-1`` 並設定例外。" -#: ../../c-api/module.rst:715 +#: ../../c-api/module.rst:717 msgid "" "Removes the module object created from *def* from the interpreter state. " "Return ``-1`` with an exception set on error, ``0`` on success." diff --git a/c-api/monitoring.po b/c-api/monitoring.po index cd950f57fa..ef4d13984c 100644 --- a/c-api/monitoring.po +++ b/c-api/monitoring.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -166,3 +166,120 @@ msgid "" "Monitoring states can be managed with the help of monitoring scopes. A scope " "would typically correspond to a python function." msgstr "" + +#: ../../c-api/monitoring.rst:138 +msgid "" +"Enter a monitored scope. ``event_types`` is an array of the event IDs for " +"events that may be fired from the scope. For example, the ID of a " +"``PY_START`` event is the value ``PY_MONITORING_EVENT_PY_START``, which is " +"numerically equal to the base-2 logarithm of ``sys.monitoring.events." +"PY_START``. ``state_array`` is an array with a monitoring state entry for " +"each event in ``event_types``, it is allocated by the user but populated by :" +"c:func:`!PyMonitoring_EnterScope` with information about the activation " +"state of the event. The size of ``event_types`` (and hence also of " +"``state_array``) is given in ``length``." +msgstr "" + +#: ../../c-api/monitoring.rst:148 +msgid "" +"The ``version`` argument is a pointer to a value which should be allocated " +"by the user together with ``state_array`` and initialized to 0, and then set " +"only by :c:func:`!PyMonitoring_EnterScope` itelf. It allows this function to " +"determine whether event states have changed since the previous call, and to " +"return quickly if they have not." +msgstr "" + +#: ../../c-api/monitoring.rst:154 +msgid "" +"The scopes referred to here are lexical scopes: a function, class or " +"method. :c:func:`!PyMonitoring_EnterScope` should be called whenever the " +"lexical scope is entered. Scopes can be reentered, reusing the same " +"*state_array* and *version*, in situations like when emulating a recursive " +"Python function. When a code-like's execution is paused, such as when " +"emulating a generator, the scope needs to be exited and re-entered." +msgstr "" + +#: ../../c-api/monitoring.rst:161 +msgid "The macros for *event_types* are:" +msgstr "" + +#: ../../c-api/monitoring.rst:169 +msgid "Macro" +msgstr "巨集" + +#: ../../c-api/monitoring.rst:169 +msgid "Event" +msgstr "" + +#: ../../c-api/monitoring.rst:171 +msgid ":monitoring-event:`BRANCH`" +msgstr ":monitoring-event:`BRANCH`" + +#: ../../c-api/monitoring.rst:172 +msgid ":monitoring-event:`CALL`" +msgstr ":monitoring-event:`CALL`" + +#: ../../c-api/monitoring.rst:173 +msgid ":monitoring-event:`C_RAISE`" +msgstr ":monitoring-event:`C_RAISE`" + +#: ../../c-api/monitoring.rst:174 +msgid ":monitoring-event:`C_RETURN`" +msgstr ":monitoring-event:`C_RETURN`" + +#: ../../c-api/monitoring.rst:175 +msgid ":monitoring-event:`EXCEPTION_HANDLED`" +msgstr ":monitoring-event:`EXCEPTION_HANDLED`" + +#: ../../c-api/monitoring.rst:176 +msgid ":monitoring-event:`INSTRUCTION`" +msgstr ":monitoring-event:`INSTRUCTION`" + +#: ../../c-api/monitoring.rst:177 +msgid ":monitoring-event:`JUMP`" +msgstr ":monitoring-event:`JUMP`" + +#: ../../c-api/monitoring.rst:178 +msgid ":monitoring-event:`LINE`" +msgstr ":monitoring-event:`LINE`" + +#: ../../c-api/monitoring.rst:179 +msgid ":monitoring-event:`PY_RESUME`" +msgstr ":monitoring-event:`PY_RESUME`" + +#: ../../c-api/monitoring.rst:180 +msgid ":monitoring-event:`PY_RETURN`" +msgstr ":monitoring-event:`PY_RETURN`" + +#: ../../c-api/monitoring.rst:181 +msgid ":monitoring-event:`PY_START`" +msgstr ":monitoring-event:`PY_START`" + +#: ../../c-api/monitoring.rst:182 +msgid ":monitoring-event:`PY_THROW`" +msgstr ":monitoring-event:`PY_THROW`" + +#: ../../c-api/monitoring.rst:183 +msgid ":monitoring-event:`PY_UNWIND`" +msgstr ":monitoring-event:`PY_UNWIND`" + +#: ../../c-api/monitoring.rst:184 +msgid ":monitoring-event:`PY_YIELD`" +msgstr ":monitoring-event:`PY_YIELD`" + +#: ../../c-api/monitoring.rst:185 +msgid ":monitoring-event:`RAISE`" +msgstr ":monitoring-event:`RAISE`" + +#: ../../c-api/monitoring.rst:186 +msgid ":monitoring-event:`RERAISE`" +msgstr ":monitoring-event:`RERAISE`" + +#: ../../c-api/monitoring.rst:187 +msgid ":monitoring-event:`STOP_ITERATION`" +msgstr ":monitoring-event:`STOP_ITERATION`" + +#: ../../c-api/monitoring.rst:192 +msgid "" +"Exit the last scope that was entered with :c:func:`!PyMonitoring_EnterScope`." +msgstr "" diff --git a/c-api/objbuffer.po b/c-api/objbuffer.po deleted file mode 100644 index c12f1984bb..0000000000 --- a/c-api/objbuffer.po +++ /dev/null @@ -1,105 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -# Liang-Bo Wang <me@liang2.tw>, 2015 -# Matt Wang <mattwang44@gmail.com>, 2023 -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-20 18:08+0800\n" -"PO-Revision-Date: 2023-07-01 04:33+0800\n" -"Last-Translator: Matt Wang <mattwang44@gmail.com>\n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.3.2\n" - -#: ../../c-api/objbuffer.rst:4 -msgid "Old Buffer Protocol" -msgstr "舊式緩衝協定 (Buffer Protocol)" - -#: ../../c-api/objbuffer.rst:8 -msgid "" -"These functions were part of the \"old buffer protocol\" API in Python 2. In " -"Python 3, this protocol doesn't exist anymore but the functions are still " -"exposed to ease porting 2.x code. They act as a compatibility wrapper " -"around the :ref:`new buffer protocol <bufferobjects>`, but they don't give " -"you control over the lifetime of the resources acquired when a buffer is " -"exported." -msgstr "" -"這些函式是 Python 2 中「舊式緩衝區協定」API 的一部分。在 Python 3 中,該協議" -"已經不存在,但這些函式仍有公開以供移植 2.x 程式碼。它們充當\\ :ref:`新式緩衝" -"區協定 <bufferobjects>`\\ 的相容性包裝器,但它們無法讓你控制匯出 (export) 緩" -"衝區時所獲取資源的生命週期。" - -#: ../../c-api/objbuffer.rst:15 -msgid "" -"Therefore, it is recommended that you call :c:func:`PyObject_GetBuffer` (or " -"the ``y*`` or ``w*`` :ref:`format codes <arg-parsing>` with the :c:func:" -"`PyArg_ParseTuple` family of functions) to get a buffer view over an object, " -"and :c:func:`PyBuffer_Release` when the buffer view can be released." -msgstr "" -"因此,建議你呼叫 :c:func:`PyObject_GetBuffer` (或是以 ``y*`` 或 ``w*`` :ref:" -"`格式碼 (format code) <arg-parsing>` 呼叫 :c:func:`PyArg_ParseTuple` 系列函" -"式)獲取物件的緩衝區視圖 (buffer view),以及緩衝區視圖可被釋放時呼叫 :c:func:" -"`PyBuffer_Release` 。" - -#: ../../c-api/objbuffer.rst:23 -msgid "" -"Returns a pointer to a read-only memory location usable as character-based " -"input. The *obj* argument must support the single-segment character buffer " -"interface. On success, returns ``0``, sets *buffer* to the memory location " -"and *buffer_len* to the buffer length. Returns ``-1`` and sets a :exc:" -"`TypeError` on error." -msgstr "" -"回傳一個指向可用作基於字元輸入之唯讀記憶體位置的指標。 *obj* 引數必須支援單一" -"片段 (single-segment) 字元緩衝區介面。成功時回傳 ``0``,並將 *buffer* 設定為" -"記憶體位置、將 *buffer_len* 設定為緩衝區長度。回傳 ``-1`` 並在錯誤時設定 :" -"exc:`TypeError`。" - -#: ../../c-api/objbuffer.rst:32 -msgid "" -"Returns a pointer to a read-only memory location containing arbitrary data. " -"The *obj* argument must support the single-segment readable buffer " -"interface. On success, returns ``0``, sets *buffer* to the memory location " -"and *buffer_len* to the buffer length. Returns ``-1`` and sets a :exc:" -"`TypeError` on error." -msgstr "" -"回傳一個指向包含任意資料之唯讀記憶體位置的指標。*obj* 引數必須支援單一片段可" -"讀緩衝區介面。成功時回傳 ``0``,並將 *buffer* 設定為記憶體位置、將 " -"*buffer_len* 設定為緩衝區長度。回傳 ``-1`` 並在錯誤時設定 :exc:`TypeError`。" - -#: ../../c-api/objbuffer.rst:41 -msgid "" -"Returns ``1`` if *o* supports the single-segment readable buffer interface. " -"Otherwise returns ``0``. This function always succeeds." -msgstr "" -"如果 *o* 支援單一片段可讀緩衝區介面,則回傳 ``1``,否則回傳 ``0``。這個函式一" -"定會執行成功的。" - -#: ../../c-api/objbuffer.rst:44 -msgid "" -"Note that this function tries to get and release a buffer, and exceptions " -"which occur while calling corresponding functions will get suppressed. To " -"get error reporting use :c:func:`PyObject_GetBuffer()` instead." -msgstr "" -"請注意,該函式嘗試獲取和釋放緩衝區,並且呼叫相應函式時發生的例外將被抑制。要" -"獲取錯誤報告,請改用 :c:func:`PyObject_GetBuffer()`。" - -#: ../../c-api/objbuffer.rst:51 -msgid "" -"Returns a pointer to a writable memory location. The *obj* argument must " -"support the single-segment, character buffer interface. On success, returns " -"``0``, sets *buffer* to the memory location and *buffer_len* to the buffer " -"length. Returns ``-1`` and sets a :exc:`TypeError` on error." -msgstr "" -"回傳指向可寫記憶體位置的指標。 *obj* 引數必須支援單一片段字元緩衝區介面。成功" -"時回傳 ``0``,並將 *buffer* 設定為記憶體位置,且將 *buffer_len* 設定為緩衝區" -"長度。回傳 ``-1`` 並在錯誤時設定 :exc:`TypeError`。" diff --git a/c-api/object.po b/c-api/object.po index a672a4c44f..039b7a3b69 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -48,75 +48,75 @@ msgstr "" #: ../../c-api/object.rst:22 ../../c-api/object.rst:27 msgid "``0``" -msgstr "" +msgstr "``0``" #: ../../c-api/object.rst:22 msgid ":py:data:`None`" -msgstr "" +msgstr ":py:data:`None`" #: ../../c-api/object.rst:23 ../../c-api/object.rst:28 msgid "``1``" -msgstr "" +msgstr "``1``" #: ../../c-api/object.rst:23 msgid ":py:data:`False`" -msgstr "" +msgstr ":py:data:`False`" #: ../../c-api/object.rst:24 msgid "``2``" -msgstr "" +msgstr "``2``" #: ../../c-api/object.rst:24 msgid ":py:data:`True`" -msgstr "" +msgstr ":py:data:`True`" #: ../../c-api/object.rst:25 msgid "``3``" -msgstr "" +msgstr "``3``" #: ../../c-api/object.rst:25 msgid ":py:data:`Ellipsis`" -msgstr "" +msgstr ":py:data:`Ellipsis`" #: ../../c-api/object.rst:26 msgid "``4``" -msgstr "" +msgstr "``4``" #: ../../c-api/object.rst:26 msgid ":py:data:`NotImplemented`" -msgstr "" +msgstr ":py:data:`NotImplemented`" #: ../../c-api/object.rst:27 msgid "``5``" -msgstr "" +msgstr "``5``" #: ../../c-api/object.rst:28 msgid "``6``" -msgstr "" +msgstr "``6``" #: ../../c-api/object.rst:29 msgid "``7``" -msgstr "" +msgstr "``7``" #: ../../c-api/object.rst:29 msgid "``''``" -msgstr "" +msgstr "``''``" #: ../../c-api/object.rst:30 msgid "``8``" -msgstr "" +msgstr "``8``" #: ../../c-api/object.rst:30 msgid "``b''``" -msgstr "" +msgstr "``b''``" #: ../../c-api/object.rst:31 msgid "``9``" -msgstr "" +msgstr "``9``" #: ../../c-api/object.rst:31 msgid "``()``" -msgstr "" +msgstr "``()``" #: ../../c-api/object.rst:34 msgid "" diff --git a/c-api/refcounting.po b/c-api/refcounting.po index 4f44c6bec2..d5cacea802 100644 --- a/c-api/refcounting.po +++ b/c-api/refcounting.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-08-06 14:19+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,7 +35,6 @@ msgid "Get the reference count of the Python object *o*." msgstr "取得物件 *o* 的參照計數。" #: ../../c-api/refcounting.rst:18 -#, fuzzy msgid "" "Note that the returned value may not actually reflect how many references to " "the object are actually held. For example, some objects are :term:" @@ -44,8 +43,8 @@ msgid "" "accurate, other than a value of 0 or 1." msgstr "" "請注意,回傳的值可能實際上並不反映實際保存了多少對該物件的參照。例如,某些物" -"件是「不滅的 (immortal)」,並且具有非常高的參照計數,不能反映實際的參照數量。" -"因此,除了 0 或 1 以外,不要依賴回傳值的準確性。" +"件是「\\ :term:`不滅的 (immortal) <immortal>`\\ 」,並且具有非常高的參照計" +"數,不能反映實際的參照數量。因此,除了 0 或 1 以外,不要依賴回傳值的準確性。" #: ../../c-api/refcounting.rst:24 msgid "" @@ -72,11 +71,8 @@ msgstr "" #: ../../c-api/refcounting.rst:40 ../../c-api/refcounting.rst:53 #: ../../c-api/refcounting.rst:119 -#, fuzzy msgid "This function has no effect on :term:`immortal` objects." -msgstr "" -"請注意,此函式對\\ `不滅的 <https://peps.python.org/pep-0683/>`_\\ 物件沒有影" -"響。" +msgstr "請注意,此函式對\\ :term:`不滅的 <immortal>`\\ 物件沒有影響。" #: ../../c-api/refcounting.rst:44 ../../c-api/refcounting.rst:68 #: ../../c-api/refcounting.rst:147 @@ -102,7 +98,6 @@ msgstr "" "新的\\ :term:`強參照 <strong reference>`。" #: ../../c-api/refcounting.rst:59 -#, fuzzy msgid "When done using the object, release is by calling :c:func:`Py_DECREF`." msgstr "使用完該物件後,透過呼叫 :c:func:`Py_DECREF` 來釋放它。" @@ -114,12 +109,10 @@ msgstr "" "該物件不能為 ``NULL``;如果你不確定它不是 ``NULL``,請使用 :c:func:" "`Py_XINCREF`。" -#: ../../c-api/refcounting.rst:64 ../../c-api/refcounting.rst:132 -#, fuzzy +#: ../../c-api/refcounting.rst:64 msgid "" -"Do not expect this function to actually modify *o* in any way. For at least " -"`some objects <https://peps.python.org/pep-0683/>`_, this function has no " -"effect." +"Do not expect this function to actually modify *o* in any way. For at least :" +"pep:`some objects <0683>`, this function has no effect." msgstr "" "不要期望此函式會以任何方式實際修改 *o*,至少對於\\ :pep:`某些物件 <0683>`\\ " "來說,此函式沒有任何效果。" @@ -225,6 +218,14 @@ msgstr "" "該物件不能為 ``NULL``;如果你不確定它不是 ``NULL``,請改用 :c:func:" "`Py_XDECREF`。" +#: ../../c-api/refcounting.rst:132 +msgid "" +"Do not expect this function to actually modify *o* in any way. For at least :" +"pep:`some objects <683>`, this function has no effect." +msgstr "" +"不要期望此函式會以任何方式實際修改 *o*,至少對於\\ :pep:`某些物件 <683>`\\ 來" +"說,此函式沒有任何效果。" + #: ../../c-api/refcounting.rst:138 msgid "" "The deallocation function can cause arbitrary Python code to be invoked (e." @@ -351,10 +352,3 @@ msgid "" msgstr "" ":c:macro:`Py_SETREF` 巨集的變體,請改用 :c:func:`Py_XDECREF` 而非 :c:func:" "`Py_DECREF`。" - -#~ msgid "" -#~ "Do not expect this function to actually modify *o* in any way. For at " -#~ "least :pep:`some objects <683>`, this function has no effect." -#~ msgstr "" -#~ "不要期望此函式會以任何方式實際修改 *o*,至少對於\\ :pep:`某些物件 " -#~ "<683>`\\ 來說,此函式沒有任何效果。" diff --git a/c-api/time.po b/c-api/time.po index d41ea7d002..7636335954 100644 --- a/c-api/time.po +++ b/c-api/time.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -17,70 +17,70 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ../../c-api/time.rst:4 +#: ../../c-api/time.rst:6 msgid "PyTime C API" msgstr "" -#: ../../c-api/time.rst:8 +#: ../../c-api/time.rst:10 msgid "" "The clock C API provides access to system clocks. It is similar to the " "Python :mod:`time` module." msgstr "" -#: ../../c-api/time.rst:11 +#: ../../c-api/time.rst:13 msgid "" "For C API related to the :mod:`datetime` module, see :ref:`datetimeobjects`." msgstr "" -#: ../../c-api/time.rst:15 +#: ../../c-api/time.rst:17 msgid "Types" msgstr "" -#: ../../c-api/time.rst:19 +#: ../../c-api/time.rst:21 msgid "" "A timestamp or duration in nanoseconds, represented as a signed 64-bit " "integer." msgstr "" -#: ../../c-api/time.rst:22 +#: ../../c-api/time.rst:24 msgid "" "The reference point for timestamps depends on the clock used. For example, :" "c:func:`PyTime_Time` returns timestamps relative to the UNIX epoch." msgstr "" -#: ../../c-api/time.rst:25 +#: ../../c-api/time.rst:27 msgid "" "The supported range is around [-292.3 years; +292.3 years]. Using the Unix " "epoch (January 1st, 1970) as reference, the supported date range is around " "[1677-09-21; 2262-04-11]. The exact limits are exposed as constants:" msgstr "" -#: ../../c-api/time.rst:32 +#: ../../c-api/time.rst:34 msgid "Minimum value of :c:type:`PyTime_t`." msgstr "" -#: ../../c-api/time.rst:36 +#: ../../c-api/time.rst:38 msgid "Maximum value of :c:type:`PyTime_t`." msgstr "" -#: ../../c-api/time.rst:40 +#: ../../c-api/time.rst:42 msgid "Clock Functions" msgstr "" -#: ../../c-api/time.rst:42 +#: ../../c-api/time.rst:44 msgid "" "The following functions take a pointer to a :c:expr:`PyTime_t` that they set " "to the value of a particular clock. Details of each clock are given in the " "documentation of the corresponding Python function." msgstr "" -#: ../../c-api/time.rst:47 +#: ../../c-api/time.rst:49 msgid "" "The functions return ``0`` on success, or ``-1`` (with an exception set) on " "failure." msgstr "" -#: ../../c-api/time.rst:50 +#: ../../c-api/time.rst:52 msgid "" "On integer overflow, they set the :c:data:`PyExc_OverflowError` exception " "and set ``*result`` to the value clamped to the ``[PyTime_MIN; PyTime_MAX]`` " @@ -88,45 +88,45 @@ msgid "" "misconfigured system time.)" msgstr "" -#: ../../c-api/time.rst:56 +#: ../../c-api/time.rst:58 msgid "" "As any other C API (unless otherwise specified), the functions must be " "called with the :term:`GIL` held." msgstr "" -#: ../../c-api/time.rst:61 +#: ../../c-api/time.rst:63 msgid "" "Read the monotonic clock. See :func:`time.monotonic` for important details " "on this clock." msgstr "" -#: ../../c-api/time.rst:66 +#: ../../c-api/time.rst:68 msgid "" "Read the performance counter. See :func:`time.perf_counter` for important " "details on this clock." msgstr "" -#: ../../c-api/time.rst:71 +#: ../../c-api/time.rst:73 msgid "" "Read the “wall clock” time. See :func:`time.time` for details important on " "this clock." msgstr "" -#: ../../c-api/time.rst:76 +#: ../../c-api/time.rst:78 msgid "Raw Clock Functions" msgstr "" -#: ../../c-api/time.rst:78 +#: ../../c-api/time.rst:80 msgid "" "Similar to clock functions, but don't set an exception on error and don't " "require the caller to hold the GIL." msgstr "" -#: ../../c-api/time.rst:81 +#: ../../c-api/time.rst:83 msgid "On success, the functions return ``0``." msgstr "" -#: ../../c-api/time.rst:83 +#: ../../c-api/time.rst:85 msgid "" "On failure, they set ``*result`` to ``0`` and return ``-1``, *without* " "setting an exception. To get the cause of the error, acquire the GIL and " @@ -134,33 +134,33 @@ msgid "" "succeed after the ``Raw`` one failed." msgstr "" -#: ../../c-api/time.rst:90 +#: ../../c-api/time.rst:92 msgid "" "Similar to :c:func:`PyTime_Monotonic`, but don't set an exception on error " "and don't require holding the GIL." msgstr "" -#: ../../c-api/time.rst:95 +#: ../../c-api/time.rst:97 msgid "" "Similar to :c:func:`PyTime_PerfCounter`, but don't set an exception on error " "and don't require holding the GIL." msgstr "" -#: ../../c-api/time.rst:100 +#: ../../c-api/time.rst:102 msgid "" "Similar to :c:func:`PyTime_Time`, but don't set an exception on error and " "don't require holding the GIL." msgstr "" -#: ../../c-api/time.rst:105 +#: ../../c-api/time.rst:107 msgid "Conversion functions" msgstr "" -#: ../../c-api/time.rst:109 +#: ../../c-api/time.rst:111 msgid "Convert a timestamp to a number of seconds as a C :c:expr:`double`." msgstr "" -#: ../../c-api/time.rst:111 +#: ../../c-api/time.rst:113 msgid "" "The function cannot fail, but note that :c:expr:`double` has limited " "accuracy for large values." diff --git a/c-api/unicode.po b/c-api/unicode.po index 44e3e7af19..1245ea48db 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -700,7 +700,7 @@ msgstr "" #: ../../c-api/unicode.rst:521 msgid "``T``" -msgstr "" +msgstr "``T``" #: ../../c-api/unicode.rst:523 msgid "" @@ -710,7 +710,7 @@ msgstr "" #: ../../c-api/unicode.rst:526 msgid "``#T``" -msgstr "" +msgstr "``#T``" #: ../../c-api/unicode.rst:528 msgid "" @@ -720,12 +720,11 @@ msgstr "" #: ../../c-api/unicode.rst:531 msgid "``N``" -msgstr "" +msgstr "``N``" #: ../../c-api/unicode.rst:532 ../../c-api/unicode.rst:537 -#, fuzzy msgid ":c:expr:`PyTypeObject*`" -msgstr ":c:expr:`PyObject*`" +msgstr ":c:expr:`PyTypeObject*`" #: ../../c-api/unicode.rst:533 msgid "" @@ -735,7 +734,7 @@ msgstr "" #: ../../c-api/unicode.rst:536 msgid "``#N``" -msgstr "" +msgstr "``#N``" #: ../../c-api/unicode.rst:538 msgid "" diff --git a/deprecations/c-api-pending-removal-in-3.14.po b/deprecations/c-api-pending-removal-in-3.14.po index acd9ed6272..aaa4c2db16 100644 --- a/deprecations/c-api-pending-removal-in-3.14.po +++ b/deprecations/c-api-pending-removal-in-3.14.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-17 00:03+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -41,164 +41,167 @@ msgid "" msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:12 -msgid "``PySys_SetArgvEx()``: set :c:member:`PyConfig.argv` instead." -msgstr "``PySys_SetArgvEx()``:請改以 :c:member:`PyConfig.argv` 設定。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:13 -msgid "``PySys_SetArgv()``: set :c:member:`PyConfig.argv` instead." -msgstr "``PySys_SetArgv()``:請改以 :c:member:`PyConfig.argv` 設定。" +msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`!PySys_SetArgvEx()`:請改以 :c:member:`PyConfig.argv` 設定。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:14 -msgid "``Py_SetProgramName()``: set :c:member:`PyConfig.program_name` instead." +msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`!PySys_SetArgv()`:請改以 :c:member:`PyConfig.argv` 設定。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:16 +msgid "" +":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +"instead." msgstr "" -"``Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設定。" +":c:func:`!Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設" +"定。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:15 -msgid "``Py_SetPythonHome()``: set :c:member:`PyConfig.home` instead." -msgstr "``Py_SetPythonHome()``:請改以 :c:member:`PyConfig.home` 設定。" +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:18 +msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." +msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設定。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:17 -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:45 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" "`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:20 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 msgid "Global configuration variables:" msgstr "全域設定變數:" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:22 -msgid ":c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 +msgid ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` instead." msgstr ":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:23 -msgid ":c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 +msgid ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` instead." msgstr ":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 -msgid ":c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 +msgid ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` instead." msgstr ":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:25 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 msgid "" -":c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive` instead." +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` instead." msgstr ":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 -msgid ":c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 +msgid ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` instead." msgstr ":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:27 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:36 msgid "" -":c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level` " +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " "instead." msgstr "" ":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 -msgid ":c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 +msgid ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` instead." msgstr ":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:29 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 msgid "" -":c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning` instead." +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` instead." msgstr "" ":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 msgid "" -":c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings` instead." +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` instead." msgstr "" ":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:31 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:44 msgid "" -":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment` " +":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "instead." msgstr "" ":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." "use_environment`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 msgid "" -":c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode` " +":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "instead." msgstr "" ":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." "write_bytecode`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:33 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 msgid "" -":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig." +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." "user_site_directory` instead." msgstr "" ":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." "user_site_directory`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 msgid "" -":c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio` " +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " "instead." msgstr "" ":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:35 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:52 msgid "" -":c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` " +":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed` instead." msgstr "" ":c:var:`Py_HashRandomizationFlag`:請改用 :c:member:`PyConfig.use_hash_seed` " "和 :c:member:`PyConfig.hash_seed`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:37 -msgid ":c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:55 +msgid ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` instead." msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." "legacy_windows_fs_encoding` instead." msgstr "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." "legacy_windows_fs_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:39 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." "legacy_windows_stdio` instead." msgstr "" ":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." "legacy_windows_stdio`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." +":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." "filesystem_encoding` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." "filesystem_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:41 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." +":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." "filesystem_encoding` instead." msgstr "" ":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." "filesystem_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." "filesystem_errors` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." "filesystem_errors`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:43 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` instead. (see :" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" "c:func:`Py_PreInitialize`)" msgstr "" ":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" diff --git a/deprecations/c-api-pending-removal-in-3.15.po b/deprecations/c-api-pending-removal-in-3.15.po index 20ea03215f..1c765579a9 100644 --- a/deprecations/c-api-pending-removal-in-3.15.po +++ b/deprecations/c-api-pending-removal-in-3.15.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -26,63 +26,63 @@ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -":c:func:`PyImport_ImportModuleNoBlock`: use :c:func:`PyImport_ImportModule` " -"instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." msgstr "" ":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" "`PyImport_ImportModule`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 -msgid ":c:func:`PyWeakref_GET_OBJECT`: use :c:func:`PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GET_OBJECT`:請改用 :c:func:`PyWeakref_GetRef`。" - #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 -msgid ":c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GetObject`:請改用 :c:func:`PyWeakref_GetRef`。" - -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:8 -msgid ":c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead." -msgstr ":c:type:`!Py_UNICODE_WIDE` type:請改用 :c:type:`wchar_t`。" +msgid "" +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead." +msgstr "" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 -msgid ":c:type:`Py_UNICODE` type: use :c:type:`wchar_t` instead." -msgstr ":c:type:`Py_UNICODE` type:請改用 :c:type:`wchar_t`。" +msgid "" +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." +msgstr "" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 msgid "Python initialization functions:" msgstr "Python 初始化函式:" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 msgid "" -":c:func:`PySys_ResetWarnOptions`: clear :data:`sys.warnoptions` and :data:`!" +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" ":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" "data:`!warnings.filters`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:14 -msgid ":c:func:`Py_GetExecPrefix`: get :data:`sys.exec_prefix` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 +msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 -msgid ":c:func:`Py_GetPath`: get :data:`sys.path` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:16 -msgid ":c:func:`Py_GetPrefix`: get :data:`sys.prefix` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 -msgid ":c:func:`Py_GetProgramFullPath`: get :data:`sys.executable` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 +msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:18 -msgid ":c:func:`Py_GetProgramName`: get :data:`sys.executable` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:23 +msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -":c:func:`Py_GetPythonHome`: get :c:member:`PyConfig.home` or the :envvar:" +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" "`PYTHONHOME` environment variable instead." msgstr "" ":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" diff --git a/deprecations/c-api-pending-removal-in-future.po b/deprecations/c-api-pending-removal-in-future.po index 28b6ce87dc..a042b964bc 100644 --- a/deprecations/c-api-pending-removal-in-future.po +++ b/deprecations/c-api-pending-removal-in-future.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-17 00:03+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -27,84 +27,85 @@ msgid "" msgstr "下列 API 已被棄用並將會被移除,不過目前尚未訂定移除日期。" #: ../../deprecations/c-api-pending-removal-in-future.rst:7 -msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: unneeded since Python 3.8." +msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8." msgstr ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`:自 Python 3.8 起不再需要" -#: ../../deprecations/c-api-pending-removal-in-future.rst:8 -msgid ":c:func:`PyErr_Fetch`: use :c:func:`PyErr_GetRaisedException` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:9 +msgid ":c:func:`PyErr_Fetch`: Use :c:func:`PyErr_GetRaisedException` instead." msgstr ":c:func:`PyErr_Fetch`:請改用 :c:func:`PyErr_GetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:9 +#: ../../deprecations/c-api-pending-removal-in-future.rst:11 msgid "" -":c:func:`PyErr_NormalizeException`: use :c:func:`PyErr_GetRaisedException` " +":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" ":c:func:`PyErr_NormalizeException`:請改用 :c:func:" "`PyErr_GetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:10 +#: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" -":c:func:`PyErr_Restore`: use :c:func:`PyErr_SetRaisedException` instead." +":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." msgstr ":c:func:`PyErr_Restore`:請改用 :c:func:`PyErr_SetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:11 +#: ../../deprecations/c-api-pending-removal-in-future.rst:15 msgid "" -":c:func:`PyModule_GetFilename`: use :c:func:`PyModule_GetFilenameObject` " +":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` " "instead." msgstr "" ":c:func:`PyModule_GetFilename`:請改用 :c:func:`PyModule_GetFilenameObject`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:12 -msgid ":c:func:`PyOS_AfterFork`: use :c:func:`PyOS_AfterFork_Child` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:17 +msgid ":c:func:`PyOS_AfterFork`: Use :c:func:`PyOS_AfterFork_Child` instead." msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:13 +#: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: use :c:func:`PySlice_Unpack` and :c:func:" +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" "`PySlice_AdjustIndices` instead." msgstr "" ":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" "`PySlice_AdjustIndices`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:14 +#: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid "" -":c:func:`!PyUnicode_AsDecodedObject`: use :c:func:`PyCodec_Decode` instead." +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." msgstr "" ":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:15 +#: ../../deprecations/c-api-pending-removal-in-future.rst:23 msgid "" -":c:func:`!PyUnicode_AsDecodedUnicode`: use :c:func:`PyCodec_Decode` instead." +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead." msgstr "" ":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:16 +#: ../../deprecations/c-api-pending-removal-in-future.rst:25 msgid "" -":c:func:`!PyUnicode_AsEncodedObject`: use :c:func:`PyCodec_Encode` instead." +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." msgstr "" ":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:17 +#: ../../deprecations/c-api-pending-removal-in-future.rst:27 msgid "" -":c:func:`!PyUnicode_AsEncodedUnicode`: use :c:func:`PyCodec_Encode` instead." +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead." msgstr "" ":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:18 -msgid ":c:func:`PyUnicode_READY`: unneeded since Python 3.12" +#: ../../deprecations/c-api-pending-removal-in-future.rst:29 +msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" msgstr ":c:func:`PyUnicode_READY`:自 Python 3.12 起不再需要" -#: ../../deprecations/c-api-pending-removal-in-future.rst:19 -msgid ":c:func:`!PyErr_Display`: use :c:func:`PyErr_DisplayException` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:31 +msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." msgstr ":c:func:`!PyErr_Display`:請改用 :c:func:`PyErr_DisplayException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:20 +#: ../../deprecations/c-api-pending-removal-in-future.rst:33 msgid "" -":c:func:`!_PyErr_ChainExceptions`: use ``_PyErr_ChainExceptions1`` instead." +":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " +"instead." msgstr "" ":c:func:`!_PyErr_ChainExceptions`:請改用 ``_PyErr_ChainExceptions1``。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:21 +#: ../../deprecations/c-api-pending-removal-in-future.rst:35 msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." @@ -112,40 +113,40 @@ msgstr "" ":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" "`PyObject_Hash`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:23 +#: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid ":c:member:`!PyDictObject.ma_version_tag` member." msgstr ":c:member:`!PyDictObject.ma_version_tag` 成員。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:24 +#: ../../deprecations/c-api-pending-removal-in-future.rst:38 msgid "Thread Local Storage (TLS) API:" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../deprecations/c-api-pending-removal-in-future.rst:26 +#: ../../deprecations/c-api-pending-removal-in-future.rst:40 msgid "" -":c:func:`PyThread_create_key`: use :c:func:`PyThread_tss_alloc` instead." +":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." msgstr ":c:func:`PyThread_create_key`:請改用 :c:func:`PyThread_tss_alloc`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:27 -msgid ":c:func:`PyThread_delete_key`: use :c:func:`PyThread_tss_free` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:42 +msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." msgstr ":c:func:`PyThread_delete_key`:請改用 :c:func:`PyThread_tss_free`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:28 +#: ../../deprecations/c-api-pending-removal-in-future.rst:44 msgid "" -":c:func:`PyThread_set_key_value`: use :c:func:`PyThread_tss_set` instead." +":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." msgstr ":c:func:`PyThread_set_key_value`:請改用 :c:func:`PyThread_tss_set`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:29 +#: ../../deprecations/c-api-pending-removal-in-future.rst:46 msgid "" -":c:func:`PyThread_get_key_value`: use :c:func:`PyThread_tss_get` instead." +":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." msgstr ":c:func:`PyThread_get_key_value`:請改用 :c:func:`PyThread_tss_get`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:30 +#: ../../deprecations/c-api-pending-removal-in-future.rst:48 msgid "" -":c:func:`PyThread_delete_key_value`: use :c:func:`PyThread_tss_delete` " +":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " "instead." msgstr "" ":c:func:`PyThread_delete_key_value`:請改用 :c:func:`PyThread_tss_delete`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:31 -msgid ":c:func:`PyThread_ReInitTLS`: unneeded since Python 3.7." +#: ../../deprecations/c-api-pending-removal-in-future.rst:50 +msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" diff --git a/deprecations/index.po b/deprecations/index.po index 88748aa9dd..b4a60d6ccd 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -2,12 +2,11 @@ # This file is distributed under the same license as the Python package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -289,142 +288,219 @@ msgid "Pending Removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" #: ../../deprecations/pending-removal-in-3.15.rst:4 +msgid ":mod:`ctypes`:" +msgstr ":mod:`ctypes`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -":class:`http.server.CGIHTTPRequestHandler` will be removed along with its " -"related ``--cgi`` flag to ``python -m http.server``. It was obsolete and " -"rarely used. No direct replacement exists. *Anything* is better than CGI " -"to interface a web server with a request handler." +"The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " +"since Python 3.13." msgstr "" -":class:`http.server.CGIHTTPRequestHandler` 將會被移除,連同其相關的 ``--" -"cgi`` 旗標到 ``python -m http.server``。它已經過時且很少被使用。沒有直接的替" -"代方案。*任何東西*\\ 都比 CGI 更好的來介接一個帶有請求處理器的網頁伺服器。" +"自 Python 3.13 起,未記錄的 :func:`!ctypes.SetPointerType` 函式已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:9 +msgid ":mod:`http.server`:" +msgstr ":mod:`http.server`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -":class:`locale`: :func:`locale.getdefaultlocale` was deprecated in Python " -"3.11 and originally planned for removal in Python 3.13 (:gh:`90817`), but " -"removal has been postponed to Python 3.15. Use :func:`locale.setlocale`, :" -"func:`locale.getencoding` and :func:`locale.getlocale` instead. (Contributed " -"by Hugo van Kemenade in :gh:`111187`.)" +"The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " +"been deprecated since Python 3.13. No direct replacement exists. *Anything* " +"is better than CGI to interface a web server with a request handler." msgstr "" -":class:`locale`::func:`locale.getdefaultlocale` 已在 Python 3.11 中被棄用," -"原本計劃在 Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :" -"func:`locale.setlocale`、:func:`locale.getencoding` 和 :func:`locale." -"getlocale`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" +"過時且很少使用的 :class:`~http.server.CGIHTTPRequestHandler` 自 Python 3.13 " +"起已被棄用。不存在直接的替代。*任何東西*\\ 都比 CGI 更好地將 Web 伺服器與請求" +"處理程序介接起來。" -#: ../../deprecations/pending-removal-in-3.15.rst:16 +#: ../../deprecations/pending-removal-in-3.15.rst:17 msgid "" -":mod:`pathlib`: :meth:`pathlib.PurePath.is_reserved` is deprecated and " -"scheduled for removal in Python 3.15. Use :func:`os.path.isreserved` to " -"detect reserved paths on Windows." +"The :option:`!--cgi` flag to the :program:`python -m http.server` command-" +"line interface has been deprecated since Python 3.13." msgstr "" -":mod:`pathlib`::meth:`pathlib.PurePath.is_reserved` 已被棄用並計劃在 Python " -"3.15 中移除。請用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" +"自 Python 3.13 起,:program:`python -m http.server` 命令列介面的 :option:`!--" +"cgi` 旗標已被棄用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:20 +msgid ":class:`locale`:" +msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:21 +#: ../../deprecations/pending-removal-in-3.15.rst:22 msgid "" -":mod:`platform`: :func:`~platform.java_ver` is deprecated and will be " -"removed in 3.15. It was largely untested, had a confusing API, and was only " -"useful for Jython support. (Contributed by Nikita Sobolev in :gh:`116349`.)" +"The :func:`~locale.getdefaultlocale` function has been deprecated since " +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" -":mod:`platform`::func:`~platform.java_ver` 已被棄用並將在 3.15 中移除。它幾" -"乎沒有被測試過,API 令人困惑並且只對 Jython 支援有用。 (由 Nikita Sobolev " -"於 :gh:`116349` 貢獻。)" +":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:27 +#: ../../deprecations/pending-removal-in-3.15.rst:30 +msgid ":mod:`pathlib`:" +msgstr ":mod:`pathlib`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:32 msgid "" -":mod:`threading`: Passing any arguments to :func:`threading.RLock` is now " -"deprecated. C version allows any numbers of args and kwargs, but they are " -"just ignored. Python version does not allow any arguments. All arguments " -"will be removed from :func:`threading.RLock` in Python 3.15. (Contributed by " -"Nikita Sobolev in :gh:`102029`.)" +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":mod:`threading`:對 :func:`threading.RLock` 傳遞任何引數現在已被棄用。C 版本" -"允許任意數量的引數和關鍵字引數,但它們會被忽略。Python 版本不允許任何引數。所" -"有引數將在 Python 3.15 中從 :func:`threading.RLock` 中移除。 (由 Nikita " -"Sobolev 於 :gh:`102029` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.15.rst:34 -msgid ":class:`typing.NamedTuple`:" -msgstr ":class:`typing.NamedTuple`:" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:36 +msgid ":mod:`platform`:" +msgstr ":mod:`platform`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" -"The undocumented keyword argument syntax for creating :class:`!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." +":func:`~platform.java_ver` has been deprecated since Python 3.13. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested." msgstr "" -"用於建立 :class:`!NamedTuple` 類別的未以文件記錄之關鍵字引數語法 (``NT = " -"NamedTuple(\"NT\", x=int)``) 已棄用,並將在 3.15 中被禁止。請改用基於類別的語" -"法或函式語法 (functional syntax)。" - -#: ../../deprecations/pending-removal-in-3.15.rst:40 -msgid "" -"When using the functional syntax to create a :class:`!NamedTuple` class, " -"failing to pass a value to the *fields* parameter (``NT = " -"NamedTuple(\"NT\")``) is deprecated. Passing ``None`` to the *fields* " -"parameter (``NT = NamedTuple(\"NT\", None)``) is also deprecated. Both will " -"be disallowed in Python 3.15. To create a :class:`!NamedTuple` class with 0 " -"fields, use ``class NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", " -"[])``." -msgstr "" -"當使用函式語法來建立 :class:`!NamedTuple` 類別時,沒將值傳遞給 *fields* 參數" -"的方式 (``NT = NamedTuple(\"NT\")``) 已被棄用,將 ``None`` 傳遞給 *fields* 參" -"數(``NT = NamedTuple(\"NT\", None)``)也已被棄用。這兩者將在 Python 3.15 中" -"會被禁止。要建立一個沒有欄位的 :class:`!NamedTuple` 類別,請使用 ``class " -"NT(NamedTuple): pass`` 或 ``NT = NamedTuple(\"NT\", [])``。" - -#: ../../deprecations/pending-removal-in-3.15.rst:47 -msgid "" -":class:`typing.TypedDict`: When using the functional syntax to create a :" -"class:`!TypedDict` class, failing to pass a value to the *fields* parameter " -"(``TD = TypedDict(\"TD\")``) is deprecated. Passing ``None`` to the *fields* " -"parameter (``TD = TypedDict(\"TD\", None)``) is also deprecated. Both will " -"be disallowed in Python 3.15. To create a :class:`!TypedDict` class with 0 " -"fields, use ``class TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." -msgstr "" -":class:`typing.TypedDict`:當使用函式語法來建立 :class:`!TypedDict` 類別時," -"沒將值傳遞給 *fields* 參數的方式(``TD = TypedDict(\"TD\")``)已被棄用,將 " -"``None`` 傳遞給 *fields* 參數(``TD = TypedDict(\"TD\", None)``)也已被棄用。" -"這兩者將在 Python 3.15 中會被禁止。要建立一個沒有欄位的 :class:`!TypedDict` " -"類別,請使用 ``class TD(TypedDict): pass`` 或 ``TD = TypedDict(\"TD\", " -"{})``。" - -#: ../../deprecations/pending-removal-in-3.15.rst:54 -msgid "" -":mod:`wave`: Deprecate the ``getmark()``, ``setmark()`` and ``getmarkers()`` " -"methods of the :class:`wave.Wave_read` and :class:`wave.Wave_write` classes. " -"They will be removed in Python 3.15. (Contributed by Victor Stinner in :gh:" -"`105096`.)" -msgstr "" -":mod:`wave`:已棄用 :class:`wave.Wave_read` 和 :class:`wave.Wave_write` 類別" -"的 ``getmark()``、``setmark()`` 和 ``getmarkers()`` 方法。它們將在 Python " -"3.15 中被移除。 (由 Victor Stinner 於 :gh:`105096` 貢獻。)" +"自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" +"援有用,具有令人困惑的 API,基本上未經測試。" + +#: ../../deprecations/pending-removal-in-3.15.rst:42 +msgid ":mod:`threading`:" +msgstr ":mod:`threading`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:44 +msgid "" +":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " +"arguments has been deprecated since Python 3.14, as the Python version does " +"not permit any arguments, but the C version allows any number of positional " +"or keyword arguments, ignoring every argument." +msgstr "" +":func:`~threading.RLock` 在 Python 3.15 中將不接受任何引數。自 Python 3.14 " +"起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" +"任意數量的位置或關鍵字引數,並忽略每個引數。" + +#: ../../deprecations/pending-removal-in-3.15.rst:50 +msgid ":mod:`typing`:" +msgstr ":mod:`typing`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:52 +msgid "" +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " +"has been deprecated since Python 3.13. Use the class-based syntax or the " +"functional syntax instead." +msgstr "" +"用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " +"(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" +"用基於類別的語法或函式語法 (functional syntax)。" + +#: ../../deprecations/pending-removal-in-3.15.rst:58 +msgid "" +"The :func:`typing.no_type_check_decorator` decorator function has been " +"deprecated since Python 3.13. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker." +msgstr "" +"自 Python 3.13 起,:func:`typing.no_type_check_decorator` 裝飾器函式已被棄" +"用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" +"援。" + +#: ../../deprecations/pending-removal-in-3.15.rst:63 +msgid ":mod:`wave`:" +msgstr ":mod:`wave`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:65 +msgid "" +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." +msgstr "" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending Removal in Python 3.16" msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:4 +#: ../../deprecations/pending-removal-in-future.rst:12 +msgid ":mod:`builtins`:" +msgstr ":mod:`builtins`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:6 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" +"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" +"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" +"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " +"``~int(x)`` (``~int(x)``)。" + +#: ../../deprecations/pending-removal-in-3.16.rst:13 +msgid ":mod:`array`:" +msgstr ":mod:`array`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:15 msgid "" -":mod:`array`: :class:`array.array` ``'u'`` type (:c:type:`wchar_t`): use the " -"``'w'`` type instead (``Py_UCS4``)." +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." msgstr "" -":mod:`array`::class:`array.array` ``'u'`` 型別 (:c:type:`wchar_t`):請改用 " -"``'w'`` 型別 (``Py_UCS4``)。" +"自 Python 3.3 起,``'u'`` 格式碼 (:c:type:`wchar_t`) 在文件中已被棄用,自 " +"Python 3.13 起在 runtime 已被棄用。請使用 ``'w'`` 格式碼 (:c:type:`Py_UCS4`) " +"來取代 Unicode 字元。" -#: ../../deprecations/pending-removal-in-3.16.rst:8 -msgid ":mod:`builtins`: ``~bool``, bitwise inversion on bool." -msgstr ":mod:`builtins`:``~bool``,對 bool 進行位元反轉。" +#: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid ":mod:`shutil`:" +msgstr ":mod:`shutil`:" -#: ../../deprecations/pending-removal-in-3.16.rst:11 +#: ../../deprecations/pending-removal-in-3.16.rst:23 msgid "" -":mod:`symtable`: Deprecate :meth:`symtable.Class.get_methods` due to the " -"lack of interest. (Contributed by Bénédikt Tran in :gh:`119698`.)" +"The :class:`!ExecError` exception has been deprecated since Python 3.14. It " +"has not been used by any function in :mod:`!shutil` since Python 3.4, and is " +"now an alias of :exc:`RuntimeError`." msgstr "" -":mod:`symtable`:由於並沒有太多關注,已棄用 :meth:`symtable.Class." -"get_methods`。 (由 Bénédikt Tran 於 :gh:`119698` 貢獻。)" +"自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" +"未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" + +#: ../../deprecations/pending-removal-in-3.16.rst:28 +msgid ":mod:`symtable`:" +msgstr ":mod:`symtable`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:30 +msgid "" +"The :meth:`Class.get_methods <symtable.Class.get_methods>` method has been " +"deprecated since Python 3.14." +msgstr "" +"自 Python 3.14 起,:meth:`Class.get_methods <symtable.Class.get_methods>` 方" +"法已被棄用。" + +#: ../../deprecations/pending-removal-in-3.16.rst:33 +msgid ":mod:`sys`:" +msgstr ":mod:`sys`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:35 +msgid "" +"The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " +"since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead." +msgstr "" +"自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" +"請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" + +#: ../../deprecations/pending-removal-in-3.16.rst:39 +msgid ":mod:`tarfile`:" +msgstr ":mod:`tarfile`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:41 +msgid "" +"The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " +"deprecated since Python 3.13." +msgstr "" +"自 Python 3.13 起,未以文件記錄和未被使用的 :attr:`!TarFile.tarfile` 屬性已被" +"棄用。" #: ../../deprecations/c-api-pending-removal-in-future.rst:2 #: ../../deprecations/pending-removal-in-future.rst:2 @@ -447,10 +523,6 @@ msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" -#: ../../deprecations/pending-removal-in-future.rst:12 -msgid ":mod:`builtins`:" -msgstr ":mod:`builtins`:" - #: ../../deprecations/pending-removal-in-future.rst:14 msgid "``bool(NotImplemented)``." msgstr "``bool(NotImplemented)``。" @@ -871,164 +943,167 @@ msgid "" msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:12 -msgid "``PySys_SetArgvEx()``: set :c:member:`PyConfig.argv` instead." -msgstr "``PySys_SetArgvEx()``:請改以 :c:member:`PyConfig.argv` 設定。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:13 -msgid "``PySys_SetArgv()``: set :c:member:`PyConfig.argv` instead." -msgstr "``PySys_SetArgv()``:請改以 :c:member:`PyConfig.argv` 設定。" +msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`!PySys_SetArgvEx()`:請改以 :c:member:`PyConfig.argv` 設定。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:14 -msgid "``Py_SetProgramName()``: set :c:member:`PyConfig.program_name` instead." +msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`!PySys_SetArgv()`:請改以 :c:member:`PyConfig.argv` 設定。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:16 +msgid "" +":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +"instead." msgstr "" -"``Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設定。" +":c:func:`!Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設" +"定。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:15 -msgid "``Py_SetPythonHome()``: set :c:member:`PyConfig.home` instead." -msgstr "``Py_SetPythonHome()``:請改以 :c:member:`PyConfig.home` 設定。" +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:18 +msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." +msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設定。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:17 -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:45 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" "`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:20 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 msgid "Global configuration variables:" msgstr "全域設定變數:" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:22 -msgid ":c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 +msgid ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` instead." msgstr ":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:23 -msgid ":c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 +msgid ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` instead." msgstr ":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 -msgid ":c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 +msgid ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` instead." msgstr ":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:25 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 msgid "" -":c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive` instead." +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` instead." msgstr ":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 -msgid ":c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 +msgid ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` instead." msgstr ":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:27 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:36 msgid "" -":c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level` " +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " "instead." msgstr "" ":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 -msgid ":c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 +msgid ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` instead." msgstr ":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:29 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 msgid "" -":c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning` instead." +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` instead." msgstr "" ":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 msgid "" -":c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings` instead." +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` instead." msgstr "" ":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:31 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:44 msgid "" -":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment` " +":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "instead." msgstr "" ":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." "use_environment`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 msgid "" -":c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode` " +":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "instead." msgstr "" ":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." "write_bytecode`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:33 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 msgid "" -":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig." +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." "user_site_directory` instead." msgstr "" ":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." "user_site_directory`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 msgid "" -":c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio` " +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " "instead." msgstr "" ":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:35 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:52 msgid "" -":c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` " +":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed` instead." msgstr "" ":c:var:`Py_HashRandomizationFlag`:請改用 :c:member:`PyConfig.use_hash_seed` " "和 :c:member:`PyConfig.hash_seed`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:37 -msgid ":c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:55 +msgid ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` instead." msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." "legacy_windows_fs_encoding` instead." msgstr "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." "legacy_windows_fs_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:39 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." "legacy_windows_stdio` instead." msgstr "" ":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." "legacy_windows_stdio`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." +":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." "filesystem_encoding` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." "filesystem_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:41 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." +":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." "filesystem_encoding` instead." msgstr "" ":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." "filesystem_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." "filesystem_errors` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." "filesystem_errors`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:43 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` instead. (see :" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" "c:func:`Py_PreInitialize`)" msgstr "" ":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" @@ -1040,63 +1115,63 @@ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -":c:func:`PyImport_ImportModuleNoBlock`: use :c:func:`PyImport_ImportModule` " -"instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." msgstr "" ":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" "`PyImport_ImportModule`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 -msgid ":c:func:`PyWeakref_GET_OBJECT`: use :c:func:`PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GET_OBJECT`:請改用 :c:func:`PyWeakref_GetRef`。" - #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 -msgid ":c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GetObject`:請改用 :c:func:`PyWeakref_GetRef`。" - -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:8 -msgid ":c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead." -msgstr ":c:type:`!Py_UNICODE_WIDE` type:請改用 :c:type:`wchar_t`。" +msgid "" +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead." +msgstr "" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 -msgid ":c:type:`Py_UNICODE` type: use :c:type:`wchar_t` instead." -msgstr ":c:type:`Py_UNICODE` type:請改用 :c:type:`wchar_t`。" +msgid "" +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." +msgstr "" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 msgid "Python initialization functions:" msgstr "Python 初始化函式:" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 msgid "" -":c:func:`PySys_ResetWarnOptions`: clear :data:`sys.warnoptions` and :data:`!" +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" ":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" "data:`!warnings.filters`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:14 -msgid ":c:func:`Py_GetExecPrefix`: get :data:`sys.exec_prefix` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 +msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 -msgid ":c:func:`Py_GetPath`: get :data:`sys.path` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:16 -msgid ":c:func:`Py_GetPrefix`: get :data:`sys.prefix` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 -msgid ":c:func:`Py_GetProgramFullPath`: get :data:`sys.executable` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 +msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:18 -msgid ":c:func:`Py_GetProgramName`: get :data:`sys.executable` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:23 +msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -":c:func:`Py_GetPythonHome`: get :c:member:`PyConfig.home` or the :envvar:" +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" "`PYTHONHOME` environment variable instead." msgstr "" ":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" @@ -1109,84 +1184,85 @@ msgid "" msgstr "下列 API 已被棄用並將會被移除,不過目前尚未訂定移除日期。" #: ../../deprecations/c-api-pending-removal-in-future.rst:7 -msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: unneeded since Python 3.8." +msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8." msgstr ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`:自 Python 3.8 起不再需要" -#: ../../deprecations/c-api-pending-removal-in-future.rst:8 -msgid ":c:func:`PyErr_Fetch`: use :c:func:`PyErr_GetRaisedException` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:9 +msgid ":c:func:`PyErr_Fetch`: Use :c:func:`PyErr_GetRaisedException` instead." msgstr ":c:func:`PyErr_Fetch`:請改用 :c:func:`PyErr_GetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:9 +#: ../../deprecations/c-api-pending-removal-in-future.rst:11 msgid "" -":c:func:`PyErr_NormalizeException`: use :c:func:`PyErr_GetRaisedException` " +":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" ":c:func:`PyErr_NormalizeException`:請改用 :c:func:" "`PyErr_GetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:10 +#: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" -":c:func:`PyErr_Restore`: use :c:func:`PyErr_SetRaisedException` instead." +":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." msgstr ":c:func:`PyErr_Restore`:請改用 :c:func:`PyErr_SetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:11 +#: ../../deprecations/c-api-pending-removal-in-future.rst:15 msgid "" -":c:func:`PyModule_GetFilename`: use :c:func:`PyModule_GetFilenameObject` " +":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` " "instead." msgstr "" ":c:func:`PyModule_GetFilename`:請改用 :c:func:`PyModule_GetFilenameObject`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:12 -msgid ":c:func:`PyOS_AfterFork`: use :c:func:`PyOS_AfterFork_Child` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:17 +msgid ":c:func:`PyOS_AfterFork`: Use :c:func:`PyOS_AfterFork_Child` instead." msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:13 +#: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: use :c:func:`PySlice_Unpack` and :c:func:" +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" "`PySlice_AdjustIndices` instead." msgstr "" ":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" "`PySlice_AdjustIndices`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:14 +#: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid "" -":c:func:`!PyUnicode_AsDecodedObject`: use :c:func:`PyCodec_Decode` instead." +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." msgstr "" ":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:15 +#: ../../deprecations/c-api-pending-removal-in-future.rst:23 msgid "" -":c:func:`!PyUnicode_AsDecodedUnicode`: use :c:func:`PyCodec_Decode` instead." +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead." msgstr "" ":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:16 +#: ../../deprecations/c-api-pending-removal-in-future.rst:25 msgid "" -":c:func:`!PyUnicode_AsEncodedObject`: use :c:func:`PyCodec_Encode` instead." +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." msgstr "" ":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:17 +#: ../../deprecations/c-api-pending-removal-in-future.rst:27 msgid "" -":c:func:`!PyUnicode_AsEncodedUnicode`: use :c:func:`PyCodec_Encode` instead." +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead." msgstr "" ":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:18 -msgid ":c:func:`PyUnicode_READY`: unneeded since Python 3.12" +#: ../../deprecations/c-api-pending-removal-in-future.rst:29 +msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" msgstr ":c:func:`PyUnicode_READY`:自 Python 3.12 起不再需要" -#: ../../deprecations/c-api-pending-removal-in-future.rst:19 -msgid ":c:func:`!PyErr_Display`: use :c:func:`PyErr_DisplayException` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:31 +msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." msgstr ":c:func:`!PyErr_Display`:請改用 :c:func:`PyErr_DisplayException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:20 +#: ../../deprecations/c-api-pending-removal-in-future.rst:33 msgid "" -":c:func:`!_PyErr_ChainExceptions`: use ``_PyErr_ChainExceptions1`` instead." +":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " +"instead." msgstr "" ":c:func:`!_PyErr_ChainExceptions`:請改用 ``_PyErr_ChainExceptions1``。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:21 +#: ../../deprecations/c-api-pending-removal-in-future.rst:35 msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." @@ -1194,172 +1270,40 @@ msgstr "" ":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" "`PyObject_Hash`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:23 +#: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid ":c:member:`!PyDictObject.ma_version_tag` member." msgstr ":c:member:`!PyDictObject.ma_version_tag` 成員。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:24 +#: ../../deprecations/c-api-pending-removal-in-future.rst:38 msgid "Thread Local Storage (TLS) API:" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../deprecations/c-api-pending-removal-in-future.rst:26 +#: ../../deprecations/c-api-pending-removal-in-future.rst:40 msgid "" -":c:func:`PyThread_create_key`: use :c:func:`PyThread_tss_alloc` instead." +":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." msgstr ":c:func:`PyThread_create_key`:請改用 :c:func:`PyThread_tss_alloc`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:27 -msgid ":c:func:`PyThread_delete_key`: use :c:func:`PyThread_tss_free` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:42 +msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." msgstr ":c:func:`PyThread_delete_key`:請改用 :c:func:`PyThread_tss_free`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:28 +#: ../../deprecations/c-api-pending-removal-in-future.rst:44 msgid "" -":c:func:`PyThread_set_key_value`: use :c:func:`PyThread_tss_set` instead." +":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." msgstr ":c:func:`PyThread_set_key_value`:請改用 :c:func:`PyThread_tss_set`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:29 +#: ../../deprecations/c-api-pending-removal-in-future.rst:46 msgid "" -":c:func:`PyThread_get_key_value`: use :c:func:`PyThread_tss_get` instead." +":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." msgstr ":c:func:`PyThread_get_key_value`:請改用 :c:func:`PyThread_tss_get`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:30 +#: ../../deprecations/c-api-pending-removal-in-future.rst:48 msgid "" -":c:func:`PyThread_delete_key_value`: use :c:func:`PyThread_tss_delete` " +":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " "instead." msgstr "" ":c:func:`PyThread_delete_key_value`:請改用 :c:func:`PyThread_tss_delete`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:31 -msgid ":c:func:`PyThread_ReInitTLS`: unneeded since Python 3.7." +#: ../../deprecations/c-api-pending-removal-in-future.rst:50 +msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" - -#~ msgid "Pending Removal in Python 3.13" -#~ msgstr "Python 3.13 中待移除的項目" - -#~ msgid "Modules (see :pep:`594`):" -#~ msgstr "模組(請見 :pep:`594`):" - -#~ msgid ":mod:`aifc`" -#~ msgstr ":mod:`aifc`" - -#~ msgid ":mod:`audioop`" -#~ msgstr ":mod:`audioop`" - -#~ msgid ":mod:`cgi`" -#~ msgstr ":mod:`cgi`" - -#~ msgid ":mod:`cgitb`" -#~ msgstr ":mod:`cgitb`" - -#~ msgid ":mod:`chunk`" -#~ msgstr ":mod:`chunk`" - -#~ msgid ":mod:`crypt`" -#~ msgstr ":mod:`crypt`" - -#~ msgid ":mod:`imghdr`" -#~ msgstr ":mod:`imghdr`" - -#~ msgid ":mod:`mailcap`" -#~ msgstr ":mod:`mailcap`" - -#~ msgid ":mod:`msilib`" -#~ msgstr ":mod:`msilib`" - -#~ msgid ":mod:`nis`" -#~ msgstr ":mod:`nis`" - -#~ msgid ":mod:`nntplib`" -#~ msgstr ":mod:`nntplib`" - -#~ msgid ":mod:`ossaudiodev`" -#~ msgstr ":mod:`ossaudiodev`" - -#~ msgid ":mod:`pipes`" -#~ msgstr ":mod:`pipes`" - -#~ msgid ":mod:`sndhdr`" -#~ msgstr ":mod:`sndhdr`" - -#~ msgid ":mod:`spwd`" -#~ msgstr ":mod:`spwd`" - -#~ msgid ":mod:`sunau`" -#~ msgstr ":mod:`sunau`" - -#~ msgid ":mod:`telnetlib`" -#~ msgstr ":mod:`telnetlib`" - -#~ msgid ":mod:`uu`" -#~ msgstr ":mod:`uu`" - -#~ msgid ":mod:`xdrlib`" -#~ msgstr ":mod:`xdrlib`" - -#~ msgid "Other modules:" -#~ msgstr "其他模組:" - -#~ msgid ":mod:`!lib2to3`, and the :program:`2to3` program (:gh:`84540`)" -#~ msgstr ":mod:`!lib2to3` 和 :program:`2to3` 程式 (:gh:`84540`)" - -#~ msgid "APIs:" -#~ msgstr "API:" - -#~ msgid ":class:`!configparser.LegacyInterpolation` (:gh:`90765`)" -#~ msgstr ":class:`!configparser.LegacyInterpolation` (:gh:`90765`)" - -#~ msgid "``locale.resetlocale()`` (:gh:`90817`)" -#~ msgstr "``locale.resetlocale()`` (:gh:`90817`)" - -#~ msgid ":meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)" -#~ msgstr ":meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)" - -#~ msgid ":func:`!unittest.findTestCases` (:gh:`50096`)" -#~ msgstr ":func:`!unittest.findTestCases` (:gh:`50096`)" - -#~ msgid ":func:`!unittest.getTestCaseNames` (:gh:`50096`)" -#~ msgstr ":func:`!unittest.getTestCaseNames` (:gh:`50096`)" - -#~ msgid ":func:`!unittest.makeSuite` (:gh:`50096`)" -#~ msgstr ":func:`!unittest.makeSuite` (:gh:`50096`)" - -#~ msgid ":meth:`!unittest.TestProgram.usageExit` (:gh:`67048`)" -#~ msgstr ":meth:`!unittest.TestProgram.usageExit` (:gh:`67048`)" - -#~ msgid ":class:`!webbrowser.MacOSX` (:gh:`86421`)" -#~ msgstr ":class:`!webbrowser.MacOSX` (:gh:`86421`)" - -#~ msgid ":class:`classmethod` descriptor chaining (:gh:`89519`)" -#~ msgstr ":class:`classmethod` 描述器鏈接 (:gh:`89519`)" - -#~ msgid ":mod:`importlib.resources` deprecated methods:" -#~ msgstr ":mod:`importlib.resources` 的已棄用方法:" - -#~ msgid "``contents()``" -#~ msgstr "``contents()``" - -#~ msgid "``is_resource()``" -#~ msgstr "``is_resource()``" - -#~ msgid "``open_binary()``" -#~ msgstr "``open_binary()``" - -#~ msgid "``open_text()``" -#~ msgstr "``open_text()``" - -#~ msgid "``path()``" -#~ msgstr "``path()``" - -#~ msgid "``read_binary()``" -#~ msgstr "``read_binary()``" - -#~ msgid "``read_text()``" -#~ msgstr "``read_text()``" - -#~ msgid "" -#~ "Use :func:`importlib.resources.files` instead. Refer to `importlib-" -#~ "resources: Migrating from Legacy <https://importlib-resources.readthedocs." -#~ "io/en/latest/using.html#migrating-from-legacy>`_ (:gh:`106531`)" -#~ msgstr "" -#~ "請改用 :func:`importlib.resources.files`。請參閱 `importlib-resources: " -#~ "Migrating from Legacy <https://importlib-resources.readthedocs.io/en/" -#~ "latest/using.html#migrating-from-legacy>`_ (:gh:`106531`)" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index b2019d1972..b8663476ab 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -21,115 +21,130 @@ msgid "Pending Removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" #: ../../deprecations/pending-removal-in-3.15.rst:4 +msgid ":mod:`ctypes`:" +msgstr ":mod:`ctypes`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -":class:`http.server.CGIHTTPRequestHandler` will be removed along with its " -"related ``--cgi`` flag to ``python -m http.server``. It was obsolete and " -"rarely used. No direct replacement exists. *Anything* is better than CGI " -"to interface a web server with a request handler." +"The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " +"since Python 3.13." msgstr "" -":class:`http.server.CGIHTTPRequestHandler` 將會被移除,連同其相關的 ``--" -"cgi`` 旗標到 ``python -m http.server``。它已經過時且很少被使用。沒有直接的替" -"代方案。*任何東西*\\ 都比 CGI 更好的來介接一個帶有請求處理器的網頁伺服器。" +"自 Python 3.13 起,未記錄的 :func:`!ctypes.SetPointerType` 函式已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:9 +msgid ":mod:`http.server`:" +msgstr ":mod:`http.server`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -":class:`locale`: :func:`locale.getdefaultlocale` was deprecated in Python " -"3.11 and originally planned for removal in Python 3.13 (:gh:`90817`), but " -"removal has been postponed to Python 3.15. Use :func:`locale.setlocale`, :" -"func:`locale.getencoding` and :func:`locale.getlocale` instead. (Contributed " -"by Hugo van Kemenade in :gh:`111187`.)" +"The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " +"been deprecated since Python 3.13. No direct replacement exists. *Anything* " +"is better than CGI to interface a web server with a request handler." msgstr "" -":class:`locale`::func:`locale.getdefaultlocale` 已在 Python 3.11 中被棄用," -"原本計劃在 Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :" -"func:`locale.setlocale`、:func:`locale.getencoding` 和 :func:`locale." -"getlocale`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" +"過時且很少使用的 :class:`~http.server.CGIHTTPRequestHandler` 自 Python 3.13 " +"起已被棄用。不存在直接的替代。*任何東西*\\ 都比 CGI 更好地將 Web 伺服器與請求" +"處理程序介接起來。" -#: ../../deprecations/pending-removal-in-3.15.rst:16 +#: ../../deprecations/pending-removal-in-3.15.rst:17 msgid "" -":mod:`pathlib`: :meth:`pathlib.PurePath.is_reserved` is deprecated and " -"scheduled for removal in Python 3.15. Use :func:`os.path.isreserved` to " -"detect reserved paths on Windows." +"The :option:`!--cgi` flag to the :program:`python -m http.server` command-" +"line interface has been deprecated since Python 3.13." msgstr "" -":mod:`pathlib`::meth:`pathlib.PurePath.is_reserved` 已被棄用並計劃在 Python " -"3.15 中移除。請用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" +"自 Python 3.13 起,:program:`python -m http.server` 命令列介面的 :option:`!--" +"cgi` 旗標已被棄用。" -#: ../../deprecations/pending-removal-in-3.15.rst:21 +#: ../../deprecations/pending-removal-in-3.15.rst:20 +msgid ":class:`locale`:" +msgstr ":class:`locale`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:22 msgid "" -":mod:`platform`: :func:`~platform.java_ver` is deprecated and will be " -"removed in 3.15. It was largely untested, had a confusing API, and was only " -"useful for Jython support. (Contributed by Nikita Sobolev in :gh:`116349`.)" +"The :func:`~locale.getdefaultlocale` function has been deprecated since " +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" -":mod:`platform`::func:`~platform.java_ver` 已被棄用並將在 3.15 中移除。它幾" -"乎沒有被測試過,API 令人困惑並且只對 Jython 支援有用。 (由 Nikita Sobolev " -"於 :gh:`116349` 貢獻。)" +":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.15.rst:30 +msgid ":mod:`pathlib`:" +msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:27 +#: ../../deprecations/pending-removal-in-3.15.rst:32 msgid "" -":mod:`threading`: Passing any arguments to :func:`threading.RLock` is now " -"deprecated. C version allows any numbers of args and kwargs, but they are " -"just ignored. Python version does not allow any arguments. All arguments " -"will be removed from :func:`threading.RLock` in Python 3.15. (Contributed by " -"Nikita Sobolev in :gh:`102029`.)" +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":mod:`threading`:對 :func:`threading.RLock` 傳遞任何引數現在已被棄用。C 版本" -"允許任意數量的引數和關鍵字引數,但它們會被忽略。Python 版本不允許任何引數。所" -"有引數將在 Python 3.15 中從 :func:`threading.RLock` 中移除。 (由 Nikita " -"Sobolev 於 :gh:`102029` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.15.rst:34 -msgid ":class:`typing.NamedTuple`:" -msgstr ":class:`typing.NamedTuple`:" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:36 +msgid ":mod:`platform`:" +msgstr ":mod:`platform`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" -"The undocumented keyword argument syntax for creating :class:`!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." +":func:`~platform.java_ver` has been deprecated since Python 3.13. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested." msgstr "" -"用於建立 :class:`!NamedTuple` 類別的未以文件記錄之關鍵字引數語法 (``NT = " -"NamedTuple(\"NT\", x=int)``) 已棄用,並將在 3.15 中被禁止。請改用基於類別的語" -"法或函式語法 (functional syntax)。" +"自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" +"援有用,具有令人困惑的 API,基本上未經測試。" + +#: ../../deprecations/pending-removal-in-3.15.rst:42 +msgid ":mod:`threading`:" +msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:40 +#: ../../deprecations/pending-removal-in-3.15.rst:44 msgid "" -"When using the functional syntax to create a :class:`!NamedTuple` class, " -"failing to pass a value to the *fields* parameter (``NT = " -"NamedTuple(\"NT\")``) is deprecated. Passing ``None`` to the *fields* " -"parameter (``NT = NamedTuple(\"NT\", None)``) is also deprecated. Both will " -"be disallowed in Python 3.15. To create a :class:`!NamedTuple` class with 0 " -"fields, use ``class NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", " -"[])``." +":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " +"arguments has been deprecated since Python 3.14, as the Python version does " +"not permit any arguments, but the C version allows any number of positional " +"or keyword arguments, ignoring every argument." msgstr "" -"當使用函式語法來建立 :class:`!NamedTuple` 類別時,沒將值傳遞給 *fields* 參數" -"的方式 (``NT = NamedTuple(\"NT\")``) 已被棄用,將 ``None`` 傳遞給 *fields* 參" -"數(``NT = NamedTuple(\"NT\", None)``)也已被棄用。這兩者將在 Python 3.15 中" -"會被禁止。要建立一個沒有欄位的 :class:`!NamedTuple` 類別,請使用 ``class " -"NT(NamedTuple): pass`` 或 ``NT = NamedTuple(\"NT\", [])``。" +":func:`~threading.RLock` 在 Python 3.15 中將不接受任何引數。自 Python 3.14 " +"起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" +"任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:47 +#: ../../deprecations/pending-removal-in-3.15.rst:50 +msgid ":mod:`typing`:" +msgstr ":mod:`typing`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:52 +msgid "" +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " +"has been deprecated since Python 3.13. Use the class-based syntax or the " +"functional syntax instead." +msgstr "" +"用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " +"(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" +"用基於類別的語法或函式語法 (functional syntax)。" + +#: ../../deprecations/pending-removal-in-3.15.rst:58 msgid "" -":class:`typing.TypedDict`: When using the functional syntax to create a :" -"class:`!TypedDict` class, failing to pass a value to the *fields* parameter " -"(``TD = TypedDict(\"TD\")``) is deprecated. Passing ``None`` to the *fields* " -"parameter (``TD = TypedDict(\"TD\", None)``) is also deprecated. Both will " -"be disallowed in Python 3.15. To create a :class:`!TypedDict` class with 0 " -"fields, use ``class TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." +"The :func:`typing.no_type_check_decorator` decorator function has been " +"deprecated since Python 3.13. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker." msgstr "" -":class:`typing.TypedDict`:當使用函式語法來建立 :class:`!TypedDict` 類別時," -"沒將值傳遞給 *fields* 參數的方式(``TD = TypedDict(\"TD\")``)已被棄用,將 " -"``None`` 傳遞給 *fields* 參數(``TD = TypedDict(\"TD\", None)``)也已被棄用。" -"這兩者將在 Python 3.15 中會被禁止。要建立一個沒有欄位的 :class:`!TypedDict` " -"類別,請使用 ``class TD(TypedDict): pass`` 或 ``TD = TypedDict(\"TD\", " -"{})``。" - -#: ../../deprecations/pending-removal-in-3.15.rst:54 +"自 Python 3.13 起,:func:`typing.no_type_check_decorator` 裝飾器函式已被棄" +"用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" +"援。" + +#: ../../deprecations/pending-removal-in-3.15.rst:63 +msgid ":mod:`wave`:" +msgstr ":mod:`wave`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:65 msgid "" -":mod:`wave`: Deprecate the ``getmark()``, ``setmark()`` and ``getmarkers()`` " -"methods of the :class:`wave.Wave_read` and :class:`wave.Wave_write` classes. " -"They will be removed in Python 3.15. (Contributed by Victor Stinner in :gh:" -"`105096`.)" +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." msgstr "" -":mod:`wave`:已棄用 :class:`wave.Wave_read` 和 :class:`wave.Wave_write` 類別" -"的 ``getmark()``、``setmark()`` 和 ``getmarkers()`` 方法。它們將在 Python " -"3.15 中被移除。 (由 Victor Stinner 於 :gh:`105096` 貢獻。)" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" diff --git a/deprecations/pending-removal-in-3.16.po b/deprecations/pending-removal-in-3.16.po index 184a9c07c8..80e023abb0 100644 --- a/deprecations/pending-removal-in-3.16.po +++ b/deprecations/pending-removal-in-3.16.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-26 00:03+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -20,21 +20,82 @@ msgid "Pending Removal in Python 3.16" msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:4 +msgid ":mod:`builtins`:" +msgstr ":mod:`builtins`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:6 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" +"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" +"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" +"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " +"``~int(x)`` (``~int(x)``)。" + +#: ../../deprecations/pending-removal-in-3.16.rst:13 +msgid ":mod:`array`:" +msgstr ":mod:`array`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:15 +msgid "" +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." +msgstr "" +"自 Python 3.3 起,``'u'`` 格式碼 (:c:type:`wchar_t`) 在文件中已被棄用,自 " +"Python 3.13 起在 runtime 已被棄用。請使用 ``'w'`` 格式碼 (:c:type:`Py_UCS4`) " +"來取代 Unicode 字元。" + +#: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid ":mod:`shutil`:" +msgstr ":mod:`shutil`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:23 +msgid "" +"The :class:`!ExecError` exception has been deprecated since Python 3.14. It " +"has not been used by any function in :mod:`!shutil` since Python 3.4, and is " +"now an alias of :exc:`RuntimeError`." +msgstr "" +"自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" +"未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" + +#: ../../deprecations/pending-removal-in-3.16.rst:28 +msgid ":mod:`symtable`:" +msgstr ":mod:`symtable`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:30 +msgid "" +"The :meth:`Class.get_methods <symtable.Class.get_methods>` method has been " +"deprecated since Python 3.14." +msgstr "" +"自 Python 3.14 起,:meth:`Class.get_methods <symtable.Class.get_methods>` 方" +"法已被棄用。" + +#: ../../deprecations/pending-removal-in-3.16.rst:33 +msgid ":mod:`sys`:" +msgstr ":mod:`sys`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:35 msgid "" -":mod:`array`: :class:`array.array` ``'u'`` type (:c:type:`wchar_t`): use the " -"``'w'`` type instead (``Py_UCS4``)." +"The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " +"since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead." msgstr "" -":mod:`array`::class:`array.array` ``'u'`` 型別 (:c:type:`wchar_t`):請改用 " -"``'w'`` 型別 (``Py_UCS4``)。" +"自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" +"請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" -#: ../../deprecations/pending-removal-in-3.16.rst:8 -msgid ":mod:`builtins`: ``~bool``, bitwise inversion on bool." -msgstr ":mod:`builtins`:``~bool``,對 bool 進行位元反轉。" +#: ../../deprecations/pending-removal-in-3.16.rst:39 +msgid ":mod:`tarfile`:" +msgstr ":mod:`tarfile`:" -#: ../../deprecations/pending-removal-in-3.16.rst:11 +#: ../../deprecations/pending-removal-in-3.16.rst:41 msgid "" -":mod:`symtable`: Deprecate :meth:`symtable.Class.get_methods` due to the " -"lack of interest. (Contributed by Bénédikt Tran in :gh:`119698`.)" +"The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " +"deprecated since Python 3.13." msgstr "" -":mod:`symtable`:由於並沒有太多關注,已棄用 :meth:`symtable.Class." -"get_methods`。 (由 Bénédikt Tran 於 :gh:`119698` 貢獻。)" +"自 Python 3.13 起,未以文件記錄和未被使用的 :attr:`!TarFile.tarfile` 屬性已被" +"棄用。" diff --git a/faq/design.po b/faq/design.po index 0b92963fe7..543508819a 100644 --- a/faq/design.po +++ b/faq/design.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-08-31 11:34+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -647,11 +647,10 @@ msgid "Can Python be compiled to machine code, C or some other language?" msgstr "Python 可以被編譯成機器語言、C 語言或其他種語言嗎?" #: ../../faq/design.rst:330 -#, fuzzy msgid "" "`Cython <https://cython.org/>`_ compiles a modified version of Python with " -"optional annotations into C extensions. `Nuitka <https://www.nuitka.net/>`_ " -"is an up-and-coming compiler of Python into C++ code, aiming to support the " +"optional annotations into C extensions. `Nuitka <https://nuitka.net/>`_ is " +"an up-and-coming compiler of Python into C++ code, aiming to support the " "full Python language." msgstr "" "`Cython <https://cython.org/>`_ 可以編譯一個調整過有選擇性註解的 Python 版" @@ -679,13 +678,12 @@ msgstr "" "函式。" #: ../../faq/design.rst:347 -#, fuzzy msgid "" "Other implementations (such as `Jython <https://www.jython.org>`_ or `PyPy " -"<https://www.pypy.org>`_), however, can rely on a different mechanism such " -"as a full-blown garbage collector. This difference can cause some subtle " -"porting problems if your Python code depends on the behavior of the " -"reference counting implementation." +"<https://pypy.org>`_), however, can rely on a different mechanism such as a " +"full-blown garbage collector. This difference can cause some subtle porting " +"problems if your Python code depends on the behavior of the reference " +"counting implementation." msgstr "" "然而,在其他實作(像是 `Jython <https://www.jython.org>`_ 或 `PyPy <https://" "pypy.org>`_)中,會使用像是成熟的垃圾收集器等不同機制。如果你的 Python 程式碼" diff --git a/faq/extending.po b/faq/extending.po index f55f34caaf..ab0b8990b6 100644 --- a/faq/extending.po +++ b/faq/extending.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-02-18 13:08+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -467,26 +467,25 @@ msgstr "" #: ../../faq/extending.rst:249 #, fuzzy msgid "" -"Most packaged versions of Python don't include the :file:`/usr/lib/python2." -"{x}/config/` directory, which contains various files required for compiling " +"Most packaged versions of Python omit some files required for compiling " "Python extensions." msgstr "" "大多數打包版本的 Python 不包含 :file:`/usr/lib/python2.{x}/config/` 目錄,該" "目錄包含編譯 Python 擴充所需的各種檔案。" -#: ../../faq/extending.rst:253 -msgid "For Red Hat, install the python-devel RPM to get the necessary files." -msgstr "在 Red Hat 上,請安裝 python-devel RPM 來取得必要的檔案。" +#: ../../faq/extending.rst:252 +msgid "For Red Hat, install the python3-devel RPM to get the necessary files." +msgstr "在 Red Hat 上,請安裝 python3-devel RPM 來取得必要的檔案。" -#: ../../faq/extending.rst:255 -msgid "For Debian, run ``apt-get install python-dev``." -msgstr "對於 Debian,運行 ``apt-get install python-dev``。" +#: ../../faq/extending.rst:254 +msgid "For Debian, run ``apt-get install python3-dev``." +msgstr "對於 Debian,運行 ``apt-get install python3-dev``。" -#: ../../faq/extending.rst:258 +#: ../../faq/extending.rst:257 msgid "How do I tell \"incomplete input\" from \"invalid input\"?" msgstr "如何從「無效輸入」區分出「不完整輸入」?" -#: ../../faq/extending.rst:260 +#: ../../faq/extending.rst:259 #, fuzzy msgid "" "Sometimes you want to emulate the Python interactive interpreter's behavior, " @@ -499,7 +498,7 @@ msgstr "" "(例如,你鍵入了 \"if\" 陳述句的開頭或者你沒有關閉你的括號或三重字串引號)," "但是當輸入無效時,它會立即為你提供語法錯誤消息。" -#: ../../faq/extending.rst:266 +#: ../../faq/extending.rst:265 msgid "" "In Python you can use the :mod:`codeop` module, which approximates the " "parser's behavior sufficiently. IDLE uses this, for example." @@ -507,7 +506,7 @@ msgstr "" "在 Python 中,你可以使用 :mod:`codeop` 模組,它充分模擬了剖析器 (parser) 的行" "為。像是 IDLE 就有使用它。" -#: ../../faq/extending.rst:269 +#: ../../faq/extending.rst:268 #, fuzzy msgid "" "The easiest way to do it in C is to call :c:func:`PyRun_InteractiveLoop` " @@ -521,11 +520,11 @@ msgstr "" "`PyOS_ReadlineFunctionPointer` 設定為指向你的自定義輸入函式。有關更多提示,請" "參閱``Modules/readline.c`` 和``Parser/myreadline.c``。" -#: ../../faq/extending.rst:276 +#: ../../faq/extending.rst:275 msgid "How do I find undefined g++ symbols __builtin_new or __pure_virtual?" msgstr "如何找到未定義的 g++ 符號 __builtin_new 或 __pure_virtual?" -#: ../../faq/extending.rst:278 +#: ../../faq/extending.rst:277 #, fuzzy msgid "" "To dynamically load g++ extension modules, you must recompile Python, relink " @@ -536,7 +535,7 @@ msgstr "" "Python 模組 Makefile 中的 LINKCC),並使用 g++ 鏈接你的擴充模組(例如,``g++ " "-shared -o mymodule.so mymodule.o` `)。" -#: ../../faq/extending.rst:284 +#: ../../faq/extending.rst:283 #, fuzzy msgid "" "Can I create an object class with some methods implemented in C and others " @@ -545,7 +544,7 @@ msgstr "" "我可以用一些用 C 實作的方法和用 Python 實作的其他方法(例如通過繼承)建立一個" "物件類別嗎?" -#: ../../faq/extending.rst:286 +#: ../../faq/extending.rst:285 msgid "" "Yes, you can inherit from built-in classes such as :class:`int`, :class:" "`list`, :class:`dict`, etc." @@ -553,7 +552,7 @@ msgstr "" "是的,你可以繼承內建類別,例如 :class:`int`、:class:`list`、:class:`dict` " "等。" -#: ../../faq/extending.rst:289 +#: ../../faq/extending.rst:288 msgid "" "The Boost Python Library (BPL, https://www.boost.org/libs/python/doc/index." "html) provides a way of doing this from C++ (i.e. you can inherit from an " diff --git a/faq/general.po b/faq/general.po index 95f7688655..ac24b2276b 100644 --- a/faq/general.po +++ b/faq/general.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-06-23 16:56+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -614,10 +614,9 @@ msgstr "" #, fuzzy msgid "" "The latest stable releases can always be found on the `Python download page " -"<https://www.python.org/downloads/>`_. There are two production-ready " -"versions of Python: 2.x and 3.x. The recommended version is 3.x, which is " -"supported by most widely used libraries. Although 2.x is still widely used, " -"`it is not maintained anymore <https://peps.python.org/pep-0373/>`_." +"<https://www.python.org/downloads/>`_. Python 3.x is the recommended version " +"and supported by most widely used libraries. Python 2.x :pep:`is not " +"maintained anymore <373>`." msgstr "" "最新的穩定發布版本隨時都可以在 `Python 下載頁面 <https://www.python.org/" "downloads/>`_\\ 上找到。Python 有兩個生產就緒 (production-ready) 的版本:2.x " diff --git a/faq/gui.po b/faq/gui.po index 784f3360fb..96851969b6 100644 --- a/faq/gui.po +++ b/faq/gui.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # This file is distributed under the same license as the Python package. # @@ -139,22 +138,3 @@ msgstr "" "最常見的原因是,繫結到的小工具並沒有「鍵盤焦點 (keyboard focus)」。請查看 Tk " "說明文件中關於焦點命令的敘述。通常,點擊一個小工具,會讓它得到鍵盤焦點(但不" "適用於標籤;請參閱 takefocus 選項)。" - -#~ msgid "" -#~ "To get truly stand-alone applications, the Tcl scripts that form the " -#~ "library have to be integrated into the application as well. One tool " -#~ "supporting that is SAM (stand-alone modules), which is part of the Tix " -#~ "distribution (https://tix.sourceforge.net/)." -#~ msgstr "" -#~ "要得到真正獨立的應用程式,必須將構成函式庫的 Tcl 腳本也整合到應用程式中。" -#~ "一個可支援該方法的工具是 SAM(stand-alone modules,獨立模組),它是 Tix 發" -#~ "行版的一部分 (https://tix.sourceforge.net/)。" - -#~ msgid "" -#~ "Build Tix with SAM enabled, perform the appropriate call to :c:func:`!" -#~ "Tclsam_init`, etc. inside Python's :file:`Modules/tkappinit.c`, and link " -#~ "with libtclsam and libtksam (you might include the Tix libraries as well)." -#~ msgstr "" -#~ "請在 SAM 被啟用的情況下建置 Tix,對 Python 的 :file:`Modules/tkappinit.c` " -#~ "中的 :c:func:`!Tclsam_init` 等函式執行適當的呼叫,並與 libtclsam 和 " -#~ "libtksam 連結(你可能也會 include Tix 函式庫)。" diff --git a/glossary.po b/glossary.po index 076f333c7b..0f5ee13d86 100644 --- a/glossary.po +++ b/glossary.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2540,16 +2540,16 @@ msgid "" "built-in sequence types are :class:`list`, :class:`str`, :class:`tuple`, " "and :class:`bytes`. Note that :class:`dict` also supports :meth:`~object." "__getitem__` and :meth:`!__len__`, but is considered a mapping rather than a " -"sequence because the lookups use arbitrary :term:`immutable` keys rather " -"than integers." +"sequence because the lookups use arbitrary :term:`hashable` keys rather than " +"integers." msgstr "" "一個 :term:`iterable`\\ (可疊代物件),它透過 :meth:`~object.__getitem__` " "special method(特殊方法),使用整數索引來支援高效率的元素存取,並定義了一" "個 :meth:`~object.__len__` method 來回傳該序列的長度。一些內建序列型別包括 :" "class:`list`、:class:`str`、:class:`tuple` 和 :class:`bytes`。請注意,雖然 :" "class:`dict` 也支援 :meth:`~object.__getitem__` 和 :meth:`!__len__`,但它被視" -"為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`immutable` " -"鍵,而不是整數。" +"為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` 鍵," +"而不是整數。" #: ../../glossary.rst:1126 msgid "" diff --git a/howto/argparse.po b/howto/argparse.po index c8731127a1..aeb863ddff 100644 --- a/howto/argparse.po +++ b/howto/argparse.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-12-11 17:33+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -871,7 +871,7 @@ msgid "" "\n" "options:\n" " -h, --help show this help message and exit\n" -" -v {0,1,2}, --verbosity {0,1,2}\n" +" -v, --verbosity {0,1,2}\n" " increase output verbosity" msgstr "" "$ python prog.py 4 -v 3\n" @@ -886,7 +886,7 @@ msgstr "" "\n" "options:\n" " -h, --help show this help message and exit\n" -" -v {0,1,2}, --verbosity {0,1,2}\n" +" -v, --verbosity {0,1,2}\n" " increase output verbosity" #: ../../howto/argparse.rst:450 diff --git a/howto/descriptor.po b/howto/descriptor.po index 6cc6a29c8f..80a905a7cd 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -583,8 +583,9 @@ msgid "" "\n" " def validate(self, value):\n" " if value not in self.options:\n" -" raise ValueError(f'Expected {value!r} to be one of {self.options!" -"r}')\n" +" raise ValueError(\n" +" f'Expected {value!r} to be one of {self.options!r}'\n" +" )\n" "\n" "class Number(Validator):\n" "\n" @@ -629,15 +630,15 @@ msgid "" " )" msgstr "" -#: ../../howto/descriptor.rst:437 +#: ../../howto/descriptor.rst:439 msgid "Practical application" msgstr "" -#: ../../howto/descriptor.rst:439 +#: ../../howto/descriptor.rst:441 msgid "Here's how the data validators can be used in a real class:" msgstr "" -#: ../../howto/descriptor.rst:441 +#: ../../howto/descriptor.rst:443 msgid "" "class Component:\n" "\n" @@ -651,11 +652,11 @@ msgid "" " self.quantity = quantity" msgstr "" -#: ../../howto/descriptor.rst:454 +#: ../../howto/descriptor.rst:456 msgid "The descriptors prevent invalid instances from being created:" msgstr "" -#: ../../howto/descriptor.rst:456 +#: ../../howto/descriptor.rst:458 msgid "" ">>> Component('Widget', 'metal', 5) # Blocked: 'Widget' is not all " "uppercase\n" @@ -673,6 +674,7 @@ msgid "" "Traceback (most recent call last):\n" " ...\n" "ValueError: Expected -5 to be at least 0\n" +"\n" ">>> Component('WIDGET', 'metal', 'V') # Blocked: 'V' isn't a number\n" "Traceback (most recent call last):\n" " ...\n" @@ -681,37 +683,37 @@ msgid "" ">>> c = Component('WIDGET', 'metal', 5) # Allowed: The inputs are valid" msgstr "" -#: ../../howto/descriptor.rst:481 +#: ../../howto/descriptor.rst:484 msgid "Technical Tutorial" msgstr "" -#: ../../howto/descriptor.rst:483 +#: ../../howto/descriptor.rst:486 msgid "" "What follows is a more technical tutorial for the mechanics and details of " "how descriptors work." msgstr "" -#: ../../howto/descriptor.rst:488 +#: ../../howto/descriptor.rst:491 msgid "Abstract" msgstr "摘要" -#: ../../howto/descriptor.rst:490 +#: ../../howto/descriptor.rst:493 msgid "" "Defines descriptors, summarizes the protocol, and shows how descriptors are " "called. Provides an example showing how object relational mappings work." msgstr "" -#: ../../howto/descriptor.rst:493 +#: ../../howto/descriptor.rst:496 msgid "" "Learning about descriptors not only provides access to a larger toolset, it " "creates a deeper understanding of how Python works." msgstr "" -#: ../../howto/descriptor.rst:498 +#: ../../howto/descriptor.rst:501 msgid "Definition and introduction" msgstr "" -#: ../../howto/descriptor.rst:500 +#: ../../howto/descriptor.rst:503 msgid "" "In general, a descriptor is an attribute value that has one of the methods " "in the descriptor protocol. Those methods are :meth:`__get__`, :meth:" @@ -719,7 +721,7 @@ msgid "" "an attribute, it is said to be a :term:`descriptor`." msgstr "" -#: ../../howto/descriptor.rst:505 +#: ../../howto/descriptor.rst:508 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " @@ -731,7 +733,7 @@ msgid "" "methods were defined." msgstr "" -#: ../../howto/descriptor.rst:514 +#: ../../howto/descriptor.rst:517 msgid "" "Descriptors are a powerful, general purpose protocol. They are the " "mechanism behind properties, methods, static methods, class methods, and :" @@ -740,30 +742,30 @@ msgid "" "Python programs." msgstr "" -#: ../../howto/descriptor.rst:522 +#: ../../howto/descriptor.rst:525 msgid "Descriptor protocol" msgstr "描述器協定" -#: ../../howto/descriptor.rst:524 +#: ../../howto/descriptor.rst:527 msgid "``descr.__get__(self, obj, type=None)``" msgstr "``descr.__get__(self, obj, type=None)``" -#: ../../howto/descriptor.rst:526 +#: ../../howto/descriptor.rst:529 msgid "``descr.__set__(self, obj, value)``" msgstr "``descr.__set__(self, obj, value)``" -#: ../../howto/descriptor.rst:528 +#: ../../howto/descriptor.rst:531 msgid "``descr.__delete__(self, obj)``" msgstr "``descr.__delete__(self, obj)``" -#: ../../howto/descriptor.rst:530 +#: ../../howto/descriptor.rst:533 msgid "" "That is all there is to it. Define any of these methods and an object is " "considered a descriptor and can override default behavior upon being looked " "up as an attribute." msgstr "" -#: ../../howto/descriptor.rst:534 +#: ../../howto/descriptor.rst:537 msgid "" "If an object defines :meth:`__set__` or :meth:`__delete__`, it is considered " "a data descriptor. Descriptors that only define :meth:`__get__` are called " @@ -771,7 +773,7 @@ msgid "" "possible)." msgstr "" -#: ../../howto/descriptor.rst:539 +#: ../../howto/descriptor.rst:542 msgid "" "Data and non-data descriptors differ in how overrides are calculated with " "respect to entries in an instance's dictionary. If an instance's dictionary " @@ -780,7 +782,7 @@ msgid "" "name as a non-data descriptor, the dictionary entry takes precedence." msgstr "" -#: ../../howto/descriptor.rst:545 +#: ../../howto/descriptor.rst:548 msgid "" "To make a read-only data descriptor, define both :meth:`__get__` and :meth:" "`__set__` with the :meth:`__set__` raising an :exc:`AttributeError` when " @@ -788,23 +790,23 @@ msgid "" "placeholder is enough to make it a data descriptor." msgstr "" -#: ../../howto/descriptor.rst:552 +#: ../../howto/descriptor.rst:555 msgid "Overview of descriptor invocation" msgstr "" -#: ../../howto/descriptor.rst:554 +#: ../../howto/descriptor.rst:557 msgid "" "A descriptor can be called directly with ``desc.__get__(obj)`` or ``desc." "__get__(None, cls)``." msgstr "" -#: ../../howto/descriptor.rst:557 +#: ../../howto/descriptor.rst:560 msgid "" "But it is more common for a descriptor to be invoked automatically from " "attribute access." msgstr "" -#: ../../howto/descriptor.rst:560 +#: ../../howto/descriptor.rst:563 msgid "" "The expression ``obj.x`` looks up the attribute ``x`` in the chain of " "namespaces for ``obj``. If the search finds a descriptor outside of the " @@ -812,17 +814,17 @@ msgid "" "the precedence rules listed below." msgstr "" -#: ../../howto/descriptor.rst:565 +#: ../../howto/descriptor.rst:568 msgid "" "The details of invocation depend on whether ``obj`` is an object, class, or " "instance of super." msgstr "" -#: ../../howto/descriptor.rst:570 +#: ../../howto/descriptor.rst:573 msgid "Invocation from an instance" msgstr "" -#: ../../howto/descriptor.rst:572 +#: ../../howto/descriptor.rst:575 msgid "" "Instance lookup scans through a chain of namespaces giving data descriptors " "the highest priority, followed by instance variables, then non-data " @@ -830,19 +832,19 @@ msgid "" "provided." msgstr "" -#: ../../howto/descriptor.rst:577 +#: ../../howto/descriptor.rst:580 msgid "" "If a descriptor is found for ``a.x``, then it is invoked with: ``desc." "__get__(a, type(a))``." msgstr "" -#: ../../howto/descriptor.rst:580 +#: ../../howto/descriptor.rst:583 msgid "" "The logic for a dotted lookup is in :meth:`object.__getattribute__`. Here " "is a pure Python equivalent:" msgstr "" -#: ../../howto/descriptor.rst:583 +#: ../../howto/descriptor.rst:586 msgid "" "def find_name_in_mro(cls, name, default):\n" " \"Emulate _PyType_Lookup() in Objects/typeobject.c\"\n" @@ -871,14 +873,14 @@ msgid "" " raise AttributeError(name)" msgstr "" -#: ../../howto/descriptor.rst:719 +#: ../../howto/descriptor.rst:722 msgid "" "Note, there is no :meth:`__getattr__` hook in the :meth:`__getattribute__` " "code. That is why calling :meth:`__getattribute__` directly or with " "``super().__getattribute__`` will bypass :meth:`__getattr__` entirely." msgstr "" -#: ../../howto/descriptor.rst:723 +#: ../../howto/descriptor.rst:726 msgid "" "Instead, it is the dot operator and the :func:`getattr` function that are " "responsible for invoking :meth:`__getattr__` whenever :meth:" @@ -886,7 +888,7 @@ msgid "" "encapsulated in a helper function:" msgstr "" -#: ../../howto/descriptor.rst:728 +#: ../../howto/descriptor.rst:731 msgid "" "def getattr_hook(obj, name):\n" " \"Emulate slot_tp_getattr_hook() in Objects/typeobject.c\"\n" @@ -906,11 +908,11 @@ msgstr "" " raise\n" " return type(obj).__getattr__(obj, name) # __getattr__" -#: ../../howto/descriptor.rst:773 +#: ../../howto/descriptor.rst:776 msgid "Invocation from a class" msgstr "" -#: ../../howto/descriptor.rst:775 +#: ../../howto/descriptor.rst:778 msgid "" "The logic for a dotted lookup such as ``A.x`` is in :meth:`type." "__getattribute__`. The steps are similar to those for :meth:`object." @@ -918,27 +920,27 @@ msgid "" "through the class's :term:`method resolution order`." msgstr "" -#: ../../howto/descriptor.rst:780 +#: ../../howto/descriptor.rst:783 msgid "If a descriptor is found, it is invoked with ``desc.__get__(None, A)``." msgstr "" -#: ../../howto/descriptor.rst:782 +#: ../../howto/descriptor.rst:785 msgid "" "The full C implementation can be found in :c:func:`!type_getattro` and :c:" "func:`!_PyType_Lookup` in :source:`Objects/typeobject.c`." msgstr "" -#: ../../howto/descriptor.rst:787 +#: ../../howto/descriptor.rst:790 msgid "Invocation from super" msgstr "" -#: ../../howto/descriptor.rst:789 +#: ../../howto/descriptor.rst:792 msgid "" "The logic for super's dotted lookup is in the :meth:`__getattribute__` " "method for object returned by :func:`super`." msgstr "" -#: ../../howto/descriptor.rst:792 +#: ../../howto/descriptor.rst:795 msgid "" "A dotted lookup such as ``super(A, obj).m`` searches ``obj.__class__." "__mro__`` for the base class ``B`` immediately following ``A`` and then " @@ -946,7 +948,7 @@ msgid "" "returned unchanged." msgstr "" -#: ../../howto/descriptor.rst:797 +#: ../../howto/descriptor.rst:800 msgid "" "The full C implementation can be found in :c:func:`!super_getattro` in :" "source:`Objects/typeobject.c`. A pure Python equivalent can be found in " @@ -954,37 +956,37 @@ msgid "" "#cooperation>`_." msgstr "" -#: ../../howto/descriptor.rst:804 +#: ../../howto/descriptor.rst:807 msgid "Summary of invocation logic" msgstr "" -#: ../../howto/descriptor.rst:806 +#: ../../howto/descriptor.rst:809 msgid "" "The mechanism for descriptors is embedded in the :meth:`__getattribute__` " "methods for :class:`object`, :class:`type`, and :func:`super`." msgstr "" -#: ../../howto/descriptor.rst:809 +#: ../../howto/descriptor.rst:812 msgid "The important points to remember are:" msgstr "要記住的重點是:" -#: ../../howto/descriptor.rst:811 +#: ../../howto/descriptor.rst:814 msgid "Descriptors are invoked by the :meth:`__getattribute__` method." msgstr "" -#: ../../howto/descriptor.rst:813 +#: ../../howto/descriptor.rst:816 msgid "" "Classes inherit this machinery from :class:`object`, :class:`type`, or :func:" "`super`." msgstr "" -#: ../../howto/descriptor.rst:816 +#: ../../howto/descriptor.rst:819 msgid "" "Overriding :meth:`__getattribute__` prevents automatic descriptor calls " "because all the descriptor logic is in that method." msgstr "" -#: ../../howto/descriptor.rst:819 +#: ../../howto/descriptor.rst:822 msgid "" ":meth:`object.__getattribute__` and :meth:`type.__getattribute__` make " "different calls to :meth:`__get__`. The first includes the instance and may " @@ -992,19 +994,19 @@ msgid "" "includes the class." msgstr "" -#: ../../howto/descriptor.rst:824 +#: ../../howto/descriptor.rst:827 msgid "Data descriptors always override instance dictionaries." msgstr "" -#: ../../howto/descriptor.rst:826 +#: ../../howto/descriptor.rst:829 msgid "Non-data descriptors may be overridden by instance dictionaries." msgstr "" -#: ../../howto/descriptor.rst:830 +#: ../../howto/descriptor.rst:833 msgid "Automatic name notification" msgstr "" -#: ../../howto/descriptor.rst:832 +#: ../../howto/descriptor.rst:835 msgid "" "Sometimes it is desirable for a descriptor to know what class variable name " "it was assigned to. When a new class is created, the :class:`type` " @@ -1014,38 +1016,38 @@ msgid "" "and the *name* is the class variable the descriptor was assigned to." msgstr "" -#: ../../howto/descriptor.rst:839 +#: ../../howto/descriptor.rst:842 msgid "" "The implementation details are in :c:func:`!type_new` and :c:func:`!" "set_names` in :source:`Objects/typeobject.c`." msgstr "" -#: ../../howto/descriptor.rst:842 +#: ../../howto/descriptor.rst:845 msgid "" "Since the update logic is in :meth:`type.__new__`, notifications only take " "place at the time of class creation. If descriptors are added to the class " "afterwards, :meth:`__set_name__` will need to be called manually." msgstr "" -#: ../../howto/descriptor.rst:848 +#: ../../howto/descriptor.rst:851 msgid "ORM example" msgstr "ORM 範例" -#: ../../howto/descriptor.rst:850 +#: ../../howto/descriptor.rst:853 msgid "" "The following code is a simplified skeleton showing how data descriptors " "could be used to implement an `object relational mapping <https://en." "wikipedia.org/wiki/Object%E2%80%93relational_mapping>`_." msgstr "" -#: ../../howto/descriptor.rst:854 +#: ../../howto/descriptor.rst:857 msgid "" "The essential idea is that the data is stored in an external database. The " "Python instances only hold keys to the database's tables. Descriptors take " "care of lookups or updates:" msgstr "" -#: ../../howto/descriptor.rst:858 +#: ../../howto/descriptor.rst:861 msgid "" "class Field:\n" "\n" @@ -1077,14 +1079,14 @@ msgstr "" " conn.execute(self.store, [value, obj.key])\n" " conn.commit()" -#: ../../howto/descriptor.rst:873 +#: ../../howto/descriptor.rst:876 msgid "" "We can use the :class:`Field` class to define `models <https://en.wikipedia." "org/wiki/Database_model>`_ that describe the schema for each table in a " "database:" msgstr "" -#: ../../howto/descriptor.rst:877 +#: ../../howto/descriptor.rst:880 msgid "" "class Movie:\n" " table = 'Movies' # Table name\n" @@ -1106,11 +1108,11 @@ msgid "" " self.key = key" msgstr "" -#: ../../howto/descriptor.rst:898 +#: ../../howto/descriptor.rst:901 msgid "To use the models, first connect to the database::" msgstr "" -#: ../../howto/descriptor.rst:900 +#: ../../howto/descriptor.rst:903 msgid "" ">>> import sqlite3\n" ">>> conn = sqlite3.connect('entertainment.db')" @@ -1118,13 +1120,13 @@ msgstr "" ">>> import sqlite3\n" ">>> conn = sqlite3.connect('entertainment.db')" -#: ../../howto/descriptor.rst:903 +#: ../../howto/descriptor.rst:906 msgid "" "An interactive session shows how data is retrieved from the database and how " "it can be updated:" msgstr "" -#: ../../howto/descriptor.rst:931 +#: ../../howto/descriptor.rst:934 msgid "" ">>> Movie('Star Wars').director\n" "'George Lucas'\n" @@ -1152,11 +1154,11 @@ msgstr "" ">>> Movie('Star Wars').director\n" "'J.J. Abrams'" -#: ../../howto/descriptor.rst:952 +#: ../../howto/descriptor.rst:955 msgid "Pure Python Equivalents" msgstr "" -#: ../../howto/descriptor.rst:954 +#: ../../howto/descriptor.rst:957 msgid "" "The descriptor protocol is simple and offers exciting possibilities. " "Several use cases are so common that they have been prepackaged into built-" @@ -1164,27 +1166,27 @@ msgid "" "\\_\\_slots\\_\\_ are all based on the descriptor protocol." msgstr "" -#: ../../howto/descriptor.rst:961 +#: ../../howto/descriptor.rst:964 msgid "Properties" msgstr "" -#: ../../howto/descriptor.rst:963 +#: ../../howto/descriptor.rst:966 msgid "" "Calling :func:`property` is a succinct way of building a data descriptor " "that triggers a function call upon access to an attribute. Its signature " "is::" msgstr "" -#: ../../howto/descriptor.rst:966 +#: ../../howto/descriptor.rst:969 msgid "property(fget=None, fset=None, fdel=None, doc=None) -> property" msgstr "property(fget=None, fset=None, fdel=None, doc=None) -> property" -#: ../../howto/descriptor.rst:968 +#: ../../howto/descriptor.rst:971 msgid "" "The documentation shows a typical use to define a managed attribute ``x``:" msgstr "" -#: ../../howto/descriptor.rst:970 +#: ../../howto/descriptor.rst:973 msgid "" "class C:\n" " def getx(self): return self.__x\n" @@ -1198,14 +1200,14 @@ msgstr "" " def delx(self): del self.__x\n" " x = property(getx, setx, delx, \"I'm the 'x' property.\")" -#: ../../howto/descriptor.rst:992 +#: ../../howto/descriptor.rst:995 msgid "" "To see how :func:`property` is implemented in terms of the descriptor " "protocol, here is a pure Python equivalent that implements most of the core " "functionality:" msgstr "" -#: ../../howto/descriptor.rst:995 +#: ../../howto/descriptor.rst:998 msgid "" "class Property:\n" " \"Emulate PyProperty_Type() in Objects/descrobject.c\"\n" @@ -1217,7 +1219,6 @@ msgid "" " if doc is None and fget is not None:\n" " doc = fget.__doc__\n" " self.__doc__ = doc\n" -" self.__name__ = ''\n" "\n" " def __set_name__(self, owner, name):\n" " self.__name__ = name\n" @@ -1249,14 +1250,14 @@ msgid "" " return type(self)(self.fget, self.fset, fdel, self.__doc__)" msgstr "" -#: ../../howto/descriptor.rst:1120 +#: ../../howto/descriptor.rst:1122 msgid "" "The :func:`property` builtin helps whenever a user interface has granted " "attribute access and then subsequent changes require the intervention of a " "method." msgstr "" -#: ../../howto/descriptor.rst:1124 +#: ../../howto/descriptor.rst:1126 msgid "" "For instance, a spreadsheet class may grant access to a cell value through " "``Cell('b10').value``. Subsequent improvements to the program require the " @@ -1266,7 +1267,7 @@ msgid "" "descriptor:" msgstr "" -#: ../../howto/descriptor.rst:1130 +#: ../../howto/descriptor.rst:1132 msgid "" "class Cell:\n" " ...\n" @@ -1278,23 +1279,23 @@ msgid "" " return self._value" msgstr "" -#: ../../howto/descriptor.rst:1141 +#: ../../howto/descriptor.rst:1143 msgid "" "Either the built-in :func:`property` or our :func:`Property` equivalent " "would work in this example." msgstr "" -#: ../../howto/descriptor.rst:1146 +#: ../../howto/descriptor.rst:1148 msgid "Functions and methods" msgstr "" -#: ../../howto/descriptor.rst:1148 +#: ../../howto/descriptor.rst:1150 msgid "" "Python's object oriented features are built upon a function based " "environment. Using non-data descriptors, the two are merged seamlessly." msgstr "" -#: ../../howto/descriptor.rst:1151 +#: ../../howto/descriptor.rst:1153 msgid "" "Functions stored in class dictionaries get turned into methods when invoked. " "Methods only differ from regular functions in that the object instance is " @@ -1302,13 +1303,13 @@ msgid "" "*self* but could be called *this* or any other variable name." msgstr "" -#: ../../howto/descriptor.rst:1156 +#: ../../howto/descriptor.rst:1158 msgid "" "Methods can be created manually with :class:`types.MethodType` which is " "roughly equivalent to:" msgstr "" -#: ../../howto/descriptor.rst:1159 +#: ../../howto/descriptor.rst:1161 msgid "" "class MethodType:\n" " \"Emulate PyMethod_Type in Objects/classobject.c\"\n" @@ -1337,7 +1338,7 @@ msgid "" " return self" msgstr "" -#: ../../howto/descriptor.rst:1187 +#: ../../howto/descriptor.rst:1189 msgid "" "To support automatic creation of methods, functions include the :meth:" "`__get__` method for binding methods during attribute access. This means " @@ -1345,7 +1346,7 @@ msgid "" "dotted lookup from an instance. Here's how it works:" msgstr "" -#: ../../howto/descriptor.rst:1192 +#: ../../howto/descriptor.rst:1194 msgid "" "class Function:\n" " ...\n" @@ -1357,14 +1358,13 @@ msgid "" " return MethodType(self, obj)" msgstr "" -#: ../../howto/descriptor.rst:1203 +#: ../../howto/descriptor.rst:1205 msgid "" "Running the following class in the interpreter shows how the function " "descriptor works in practice:" msgstr "" -#: ../../howto/descriptor.rst:1206 -#, fuzzy +#: ../../howto/descriptor.rst:1208 msgid "" "class D:\n" " def f(self):\n" @@ -1374,15 +1374,18 @@ msgid "" " pass" msgstr "" "class D:\n" -" def f(self, x):\n" -" return x" +" def f(self):\n" +" return self\n" +"\n" +"class D2:\n" +" pass" -#: ../../howto/descriptor.rst:1224 +#: ../../howto/descriptor.rst:1226 msgid "" "The function has a :term:`qualified name` attribute to support introspection:" msgstr "" -#: ../../howto/descriptor.rst:1226 +#: ../../howto/descriptor.rst:1228 msgid "" ">>> D.f.__qualname__\n" "'D.f'" @@ -1390,13 +1393,13 @@ msgstr "" ">>> D.f.__qualname__\n" "'D.f'" -#: ../../howto/descriptor.rst:1231 +#: ../../howto/descriptor.rst:1233 msgid "" "Accessing the function through the class dictionary does not invoke :meth:" "`__get__`. Instead, it just returns the underlying function object::" msgstr "" -#: ../../howto/descriptor.rst:1234 +#: ../../howto/descriptor.rst:1236 msgid "" ">>> D.__dict__['f']\n" "<function D.f at 0x00C45070>" @@ -1404,13 +1407,13 @@ msgstr "" ">>> D.__dict__['f']\n" "<function D.f at 0x00C45070>" -#: ../../howto/descriptor.rst:1237 +#: ../../howto/descriptor.rst:1239 msgid "" "Dotted access from a class calls :meth:`__get__` which just returns the " "underlying function unchanged::" msgstr "" -#: ../../howto/descriptor.rst:1240 +#: ../../howto/descriptor.rst:1242 msgid "" ">>> D.f\n" "<function D.f at 0x00C45070>" @@ -1418,13 +1421,13 @@ msgstr "" ">>> D.f\n" "<function D.f at 0x00C45070>" -#: ../../howto/descriptor.rst:1243 +#: ../../howto/descriptor.rst:1245 msgid "" "The interesting behavior occurs during dotted access from an instance. The " "dotted lookup calls :meth:`__get__` which returns a bound method object::" msgstr "" -#: ../../howto/descriptor.rst:1246 +#: ../../howto/descriptor.rst:1248 msgid "" ">>> d = D()\n" ">>> d.f\n" @@ -1434,13 +1437,13 @@ msgstr "" ">>> d.f\n" "<bound method D.f of <__main__.D object at 0x00B18C90>>" -#: ../../howto/descriptor.rst:1250 +#: ../../howto/descriptor.rst:1252 msgid "" "Internally, the bound method stores the underlying function and the bound " "instance::" msgstr "" -#: ../../howto/descriptor.rst:1253 +#: ../../howto/descriptor.rst:1255 msgid "" ">>> d.f.__func__\n" "<function D.f at 0x00C45070>\n" @@ -1454,23 +1457,23 @@ msgstr "" ">>> d.f.__self__\n" "<__main__.D object at 0x00B18C90>" -#: ../../howto/descriptor.rst:1259 +#: ../../howto/descriptor.rst:1261 msgid "" "If you have ever wondered where *self* comes from in regular methods or " "where *cls* comes from in class methods, this is it!" msgstr "" -#: ../../howto/descriptor.rst:1264 +#: ../../howto/descriptor.rst:1266 msgid "Kinds of methods" msgstr "" -#: ../../howto/descriptor.rst:1266 +#: ../../howto/descriptor.rst:1268 msgid "" "Non-data descriptors provide a simple mechanism for variations on the usual " "patterns of binding functions into methods." msgstr "" -#: ../../howto/descriptor.rst:1269 +#: ../../howto/descriptor.rst:1271 msgid "" "To recap, functions have a :meth:`__get__` method so that they can be " "converted to a method when accessed as attributes. The non-data descriptor " @@ -1478,55 +1481,55 @@ msgid "" "f(*args)`` becomes ``f(*args)``." msgstr "" -#: ../../howto/descriptor.rst:1274 +#: ../../howto/descriptor.rst:1276 msgid "This chart summarizes the binding and its two most useful variants:" msgstr "" -#: ../../howto/descriptor.rst:1277 +#: ../../howto/descriptor.rst:1279 msgid "Transformation" msgstr "" -#: ../../howto/descriptor.rst:1277 +#: ../../howto/descriptor.rst:1279 msgid "Called from an object" msgstr "" -#: ../../howto/descriptor.rst:1277 +#: ../../howto/descriptor.rst:1279 msgid "Called from a class" msgstr "" -#: ../../howto/descriptor.rst:1280 +#: ../../howto/descriptor.rst:1282 msgid "function" msgstr "函式" -#: ../../howto/descriptor.rst:1280 +#: ../../howto/descriptor.rst:1282 msgid "f(obj, \\*args)" msgstr "f(obj, \\*args)" -#: ../../howto/descriptor.rst:1280 ../../howto/descriptor.rst:1282 +#: ../../howto/descriptor.rst:1282 ../../howto/descriptor.rst:1284 msgid "f(\\*args)" msgstr "f(\\*args)" -#: ../../howto/descriptor.rst:1282 +#: ../../howto/descriptor.rst:1284 msgid "staticmethod" msgstr "staticmethod" -#: ../../howto/descriptor.rst:1284 +#: ../../howto/descriptor.rst:1286 msgid "classmethod" msgstr "classmethod" -#: ../../howto/descriptor.rst:1284 +#: ../../howto/descriptor.rst:1286 msgid "f(type(obj), \\*args)" msgstr "f(type(obj), \\*args)" -#: ../../howto/descriptor.rst:1284 +#: ../../howto/descriptor.rst:1286 msgid "f(cls, \\*args)" msgstr "f(cls, \\*args)" -#: ../../howto/descriptor.rst:1289 +#: ../../howto/descriptor.rst:1291 msgid "Static methods" msgstr "" -#: ../../howto/descriptor.rst:1291 +#: ../../howto/descriptor.rst:1293 msgid "" "Static methods return the underlying function without changes. Calling " "either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into ``object." @@ -1535,13 +1538,13 @@ msgid "" "a class." msgstr "" -#: ../../howto/descriptor.rst:1297 +#: ../../howto/descriptor.rst:1299 msgid "" "Good candidates for static methods are methods that do not reference the " "``self`` variable." msgstr "" -#: ../../howto/descriptor.rst:1300 +#: ../../howto/descriptor.rst:1302 msgid "" "For instance, a statistics package may include a container class for " "experimental data. The class provides normal methods for computing the " @@ -1550,16 +1553,16 @@ msgid "" "but do not depend on the data. For instance, ``erf(x)`` is handy conversion " "routine that comes up in statistical work but does not directly depend on a " "particular dataset. It can be called either from an object or the class: " -"``s.erf(1.5) --> .9332`` or ``Sample.erf(1.5) --> .9332``." +"``s.erf(1.5) --> 0.9332`` or ``Sample.erf(1.5) --> 0.9332``." msgstr "" -#: ../../howto/descriptor.rst:1309 +#: ../../howto/descriptor.rst:1311 msgid "" "Since static methods return the underlying function with no changes, the " "example calls are unexciting:" msgstr "" -#: ../../howto/descriptor.rst:1312 +#: ../../howto/descriptor.rst:1314 msgid "" "class E:\n" " @staticmethod\n" @@ -1571,7 +1574,7 @@ msgstr "" " def f(x):\n" " return x * 10" -#: ../../howto/descriptor.rst:1319 +#: ../../howto/descriptor.rst:1321 msgid "" ">>> E.f(3)\n" "30\n" @@ -1583,13 +1586,13 @@ msgstr "" ">>> E().f(3)\n" "30" -#: ../../howto/descriptor.rst:1326 +#: ../../howto/descriptor.rst:1328 msgid "" "Using the non-data descriptor protocol, a pure Python version of :func:" "`staticmethod` would look like this:" msgstr "" -#: ../../howto/descriptor.rst:1329 +#: ../../howto/descriptor.rst:1331 msgid "" "import functools\n" "\n" @@ -1607,7 +1610,7 @@ msgid "" " return self.f(*args, **kwds)" msgstr "" -#: ../../howto/descriptor.rst:1346 +#: ../../howto/descriptor.rst:1348 msgid "" "The :func:`functools.update_wrapper` call adds a ``__wrapped__`` attribute " "that refers to the underlying function. Also it carries forward the " @@ -1616,18 +1619,18 @@ msgid "" "__doc__`, and :attr:`~function.__annotations__`." msgstr "" -#: ../../howto/descriptor.rst:1415 +#: ../../howto/descriptor.rst:1417 msgid "Class methods" msgstr "" -#: ../../howto/descriptor.rst:1417 +#: ../../howto/descriptor.rst:1419 msgid "" "Unlike static methods, class methods prepend the class reference to the " "argument list before calling the function. This format is the same for " "whether the caller is an object or a class:" msgstr "" -#: ../../howto/descriptor.rst:1421 +#: ../../howto/descriptor.rst:1423 msgid "" "class F:\n" " @classmethod\n" @@ -1639,7 +1642,7 @@ msgstr "" " def f(cls, x):\n" " return cls.__name__, x" -#: ../../howto/descriptor.rst:1428 +#: ../../howto/descriptor.rst:1430 msgid "" ">>> F.f(3)\n" "('F', 3)\n" @@ -1651,7 +1654,7 @@ msgstr "" ">>> F().f(3)\n" "('F', 3)" -#: ../../howto/descriptor.rst:1435 +#: ../../howto/descriptor.rst:1437 msgid "" "This behavior is useful whenever the method only needs to have a class " "reference and does not rely on data stored in a specific instance. One use " @@ -1660,7 +1663,7 @@ msgid "" "of keys. The pure Python equivalent is:" msgstr "" -#: ../../howto/descriptor.rst:1441 +#: ../../howto/descriptor.rst:1443 msgid "" "class Dict(dict):\n" " @classmethod\n" @@ -1672,11 +1675,11 @@ msgid "" " return d" msgstr "" -#: ../../howto/descriptor.rst:1452 +#: ../../howto/descriptor.rst:1454 msgid "Now a new dictionary of unique keys can be constructed like this:" msgstr "" -#: ../../howto/descriptor.rst:1454 +#: ../../howto/descriptor.rst:1456 msgid "" ">>> d = Dict.fromkeys('abracadabra')\n" ">>> type(d) is Dict\n" @@ -1690,13 +1693,13 @@ msgstr "" ">>> d\n" "{'a': None, 'b': None, 'r': None, 'c': None, 'd': None}" -#: ../../howto/descriptor.rst:1462 +#: ../../howto/descriptor.rst:1464 msgid "" "Using the non-data descriptor protocol, a pure Python version of :func:" "`classmethod` would look like this:" msgstr "" -#: ../../howto/descriptor.rst:1465 +#: ../../howto/descriptor.rst:1467 msgid "" "import functools\n" "\n" @@ -1713,7 +1716,7 @@ msgid "" " return MethodType(self.f, cls)" msgstr "" -#: ../../howto/descriptor.rst:1527 +#: ../../howto/descriptor.rst:1529 msgid "" "The :func:`functools.update_wrapper` call in ``ClassMethod`` adds a " "``__wrapped__`` attribute that refers to the underlying function. Also it " @@ -1723,24 +1726,24 @@ msgid "" "__annotations__`." msgstr "" -#: ../../howto/descriptor.rst:1536 +#: ../../howto/descriptor.rst:1538 msgid "Member objects and __slots__" msgstr "" -#: ../../howto/descriptor.rst:1538 +#: ../../howto/descriptor.rst:1540 msgid "" "When a class defines ``__slots__``, it replaces instance dictionaries with a " "fixed-length array of slot values. From a user point of view that has " "several effects:" msgstr "" -#: ../../howto/descriptor.rst:1542 +#: ../../howto/descriptor.rst:1544 msgid "" "1. Provides immediate detection of bugs due to misspelled attribute " "assignments. Only attribute names specified in ``__slots__`` are allowed:" msgstr "" -#: ../../howto/descriptor.rst:1545 +#: ../../howto/descriptor.rst:1547 msgid "" "class Vehicle:\n" " __slots__ = ('id_number', 'make', 'model')" @@ -1748,7 +1751,7 @@ msgstr "" "class Vehicle:\n" " __slots__ = ('id_number', 'make', 'model')" -#: ../../howto/descriptor.rst:1550 +#: ../../howto/descriptor.rst:1552 msgid "" ">>> auto = Vehicle()\n" ">>> auto.id_nubmer = 'VYE483814LQEX'\n" @@ -1762,13 +1765,13 @@ msgstr "" " ...\n" "AttributeError: 'Vehicle' object has no attribute 'id_nubmer'" -#: ../../howto/descriptor.rst:1558 +#: ../../howto/descriptor.rst:1560 msgid "" "2. Helps create immutable objects where descriptors manage access to private " "attributes stored in ``__slots__``:" msgstr "" -#: ../../howto/descriptor.rst:1561 +#: ../../howto/descriptor.rst:1563 msgid "" "class Immutable:\n" "\n" @@ -1788,7 +1791,7 @@ msgid "" " return self._name" msgstr "" -#: ../../howto/descriptor.rst:1579 +#: ../../howto/descriptor.rst:1581 msgid "" ">>> mark = Immutable('Botany', 'Mark Watney')\n" ">>> mark.dept\n" @@ -1814,7 +1817,7 @@ msgstr "" " ...\n" "AttributeError: 'Immutable' object has no attribute 'location'" -#: ../../howto/descriptor.rst:1593 +#: ../../howto/descriptor.rst:1595 msgid "" "3. Saves memory. On a 64-bit Linux build, an instance with two attributes " "takes 48 bytes with ``__slots__`` and 152 bytes without. This `flyweight " @@ -1822,19 +1825,19 @@ msgid "" "only matters when a large number of instances are going to be created." msgstr "" -#: ../../howto/descriptor.rst:1598 +#: ../../howto/descriptor.rst:1600 msgid "" "4. Improves speed. Reading instance variables is 35% faster with " "``__slots__`` (as measured with Python 3.10 on an Apple M1 processor)." msgstr "" -#: ../../howto/descriptor.rst:1601 +#: ../../howto/descriptor.rst:1603 msgid "" "5. Blocks tools like :func:`functools.cached_property` which require an " "instance dictionary to function correctly:" msgstr "" -#: ../../howto/descriptor.rst:1604 +#: ../../howto/descriptor.rst:1606 msgid "" "from functools import cached_property\n" "\n" @@ -1847,7 +1850,7 @@ msgid "" " for n in reversed(range(100_000)))" msgstr "" -#: ../../howto/descriptor.rst:1616 +#: ../../howto/descriptor.rst:1618 msgid "" ">>> CP().pi\n" "Traceback (most recent call last):\n" @@ -1859,7 +1862,7 @@ msgstr "" " ...\n" "TypeError: No '__dict__' attribute on 'CP' instance to cache 'pi' property." -#: ../../howto/descriptor.rst:1623 +#: ../../howto/descriptor.rst:1625 msgid "" "It is not possible to create an exact drop-in pure Python version of " "``__slots__`` because it requires direct access to C structures and control " @@ -1869,7 +1872,7 @@ msgid "" "managed by member descriptors:" msgstr "" -#: ../../howto/descriptor.rst:1630 +#: ../../howto/descriptor.rst:1632 msgid "" "null = object()\n" "\n" @@ -1908,13 +1911,13 @@ msgid "" " return f'<Member {self.name!r} of {self.clsname!r}>'" msgstr "" -#: ../../howto/descriptor.rst:1668 +#: ../../howto/descriptor.rst:1670 msgid "" "The :meth:`type.__new__` method takes care of adding member objects to class " "variables:" msgstr "" -#: ../../howto/descriptor.rst:1671 +#: ../../howto/descriptor.rst:1673 msgid "" "class Type(type):\n" " 'Simulate how the type metaclass adds member objects for slots'\n" @@ -1928,14 +1931,14 @@ msgid "" " return type.__new__(mcls, clsname, bases, mapping, **kwargs)" msgstr "" -#: ../../howto/descriptor.rst:1684 +#: ../../howto/descriptor.rst:1686 msgid "" "The :meth:`object.__new__` method takes care of creating instances that have " "slots instead of an instance dictionary. Here is a rough simulation in pure " "Python:" msgstr "" -#: ../../howto/descriptor.rst:1688 +#: ../../howto/descriptor.rst:1690 msgid "" "class Object:\n" " 'Simulate how object.__new__() allocates memory for __slots__'\n" @@ -1967,13 +1970,13 @@ msgid "" " super().__delattr__(name)" msgstr "" -#: ../../howto/descriptor.rst:1719 +#: ../../howto/descriptor.rst:1721 msgid "" "To use the simulation in a real class, just inherit from :class:`Object` and " "set the :term:`metaclass` to :class:`Type`:" msgstr "" -#: ../../howto/descriptor.rst:1722 +#: ../../howto/descriptor.rst:1724 msgid "" "class H(Object, metaclass=Type):\n" " 'Instance variables stored in slots'\n" @@ -1985,12 +1988,12 @@ msgid "" " self.y = y" msgstr "" -#: ../../howto/descriptor.rst:1733 +#: ../../howto/descriptor.rst:1735 msgid "" "At this point, the metaclass has loaded member objects for *x* and *y*::" msgstr "" -#: ../../howto/descriptor.rst:1735 +#: ../../howto/descriptor.rst:1737 msgid "" ">>> from pprint import pp\n" ">>> pp(dict(vars(H)))\n" @@ -2010,13 +2013,13 @@ msgstr "" " 'x': <Member 'x' of 'H'>,\n" " 'y': <Member 'y' of 'H'>}" -#: ../../howto/descriptor.rst:1754 +#: ../../howto/descriptor.rst:1756 msgid "" "When instances are created, they have a ``slot_values`` list where the " "attributes are stored:" msgstr "" -#: ../../howto/descriptor.rst:1757 +#: ../../howto/descriptor.rst:1759 msgid "" ">>> h = H(10, 20)\n" ">>> vars(h)\n" @@ -2032,11 +2035,11 @@ msgstr "" ">>> vars(h)\n" "{'_slotvalues': [55, 20]}" -#: ../../howto/descriptor.rst:1766 +#: ../../howto/descriptor.rst:1768 msgid "Misspelled or unassigned attributes will raise an exception:" msgstr "" -#: ../../howto/descriptor.rst:1768 +#: ../../howto/descriptor.rst:1770 msgid "" ">>> h.xz\n" "Traceback (most recent call last):\n" diff --git a/howto/free-threading-extensions.po b/howto/free-threading-extensions.po index 08d6aaa97a..988740ef1d 100644 --- a/howto/free-threading-extensions.po +++ b/howto/free-threading-extensions.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -128,6 +128,23 @@ msgid "" " return m;\n" "}" msgstr "" +"static struct PyModuleDef moduledef = {\n" +" PyModuleDef_HEAD_INIT,\n" +" ...\n" +"};\n" +"\n" +"PyMODINIT_FUNC\n" +"PyInit_mymodule(void)\n" +"{\n" +" PyObject *m = PyModule_Create(&moduledef);\n" +" if (m == NULL) {\n" +" return NULL;\n" +" }\n" +"#ifdef Py_GIL_DISABLED\n" +" PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);\n" +"#endif\n" +" return m;\n" +"}" #: ../../howto/free-threading-extensions.rst:93 msgid "General API Guidelines" @@ -172,7 +189,7 @@ msgstr "" #: ../../howto/free-threading-extensions.rst:120 msgid "``PyDict_Next``" -msgstr "" +msgstr "``PyDict_Next``" #: ../../howto/free-threading-extensions.rst:122 msgid "" @@ -221,44 +238,44 @@ msgstr "" #: ../../howto/free-threading-extensions.rst:152 msgid ":c:func:`PyList_GetItem`" -msgstr "" +msgstr ":c:func:`PyList_GetItem`" #: ../../howto/free-threading-extensions.rst:152 msgid ":c:func:`PyList_GetItemRef`" -msgstr "" +msgstr ":c:func:`PyList_GetItemRef`" #: ../../howto/free-threading-extensions.rst:154 msgid ":c:func:`PyDict_GetItem`" -msgstr "" +msgstr ":c:func:`PyDict_GetItem`" #: ../../howto/free-threading-extensions.rst:154 #: ../../howto/free-threading-extensions.rst:156 msgid ":c:func:`PyDict_GetItemRef`" -msgstr "" +msgstr ":c:func:`PyDict_GetItemRef`" #: ../../howto/free-threading-extensions.rst:156 msgid ":c:func:`PyDict_GetItemWithError`" -msgstr "" +msgstr ":c:func:`PyDict_GetItemWithError`" #: ../../howto/free-threading-extensions.rst:158 msgid ":c:func:`PyDict_GetItemString`" -msgstr "" +msgstr ":c:func:`PyDict_GetItemString`" #: ../../howto/free-threading-extensions.rst:158 msgid ":c:func:`PyDict_GetItemStringRef`" -msgstr "" +msgstr ":c:func:`PyDict_GetItemStringRef`" #: ../../howto/free-threading-extensions.rst:160 msgid ":c:func:`PyDict_SetDefault`" -msgstr "" +msgstr ":c:func:`PyDict_SetDefault`" #: ../../howto/free-threading-extensions.rst:160 msgid ":c:func:`PyDict_SetDefaultRef`" -msgstr "" +msgstr ":c:func:`PyDict_SetDefaultRef`" #: ../../howto/free-threading-extensions.rst:162 msgid ":c:func:`PyDict_Next`" -msgstr "" +msgstr ":c:func:`PyDict_Next`" #: ../../howto/free-threading-extensions.rst:162 msgid "none (see :ref:`PyDict_Next`)" @@ -266,24 +283,24 @@ msgstr "" #: ../../howto/free-threading-extensions.rst:164 msgid ":c:func:`PyWeakref_GetObject`" -msgstr "" +msgstr ":c:func:`PyWeakref_GetObject`" #: ../../howto/free-threading-extensions.rst:164 #: ../../howto/free-threading-extensions.rst:166 msgid ":c:func:`PyWeakref_GetRef`" -msgstr "" +msgstr ":c:func:`PyWeakref_GetRef`" #: ../../howto/free-threading-extensions.rst:166 msgid ":c:func:`PyWeakref_GET_OBJECT`" -msgstr "" +msgstr ":c:func:`PyWeakref_GET_OBJECT`" #: ../../howto/free-threading-extensions.rst:168 msgid ":c:func:`PyImport_AddModule`" -msgstr "" +msgstr ":c:func:`PyImport_AddModule`" #: ../../howto/free-threading-extensions.rst:168 msgid ":c:func:`PyImport_AddModuleRef`" -msgstr "" +msgstr ":c:func:`PyImport_AddModuleRef`" #: ../../howto/free-threading-extensions.rst:171 msgid "" @@ -303,11 +320,11 @@ msgid "" "to provide implementations of these functions for older Python versions." msgstr "" -#: ../../howto/free-threading-extensions.rst:185 +#: ../../howto/free-threading-extensions.rst:187 msgid "Memory Allocation APIs" msgstr "" -#: ../../howto/free-threading-extensions.rst:187 +#: ../../howto/free-threading-extensions.rst:189 msgid "" "Python's memory management C API provides functions in three different :ref:" "`allocation domains <allocator-domains>`: \"raw\", \"mem\", and \"object\". " @@ -317,36 +334,36 @@ msgid "" "where this was only a best practice and not a hard requirement." msgstr "" -#: ../../howto/free-threading-extensions.rst:196 +#: ../../howto/free-threading-extensions.rst:198 msgid "" "Search for uses of :c:func:`PyObject_Malloc` in your extension and check " "that the allocated memory is used for Python objects. Use :c:func:" "`PyMem_Malloc` to allocate buffers instead of :c:func:`PyObject_Malloc`." msgstr "" -#: ../../howto/free-threading-extensions.rst:203 +#: ../../howto/free-threading-extensions.rst:205 msgid "Thread State and GIL APIs" msgstr "" -#: ../../howto/free-threading-extensions.rst:205 +#: ../../howto/free-threading-extensions.rst:207 msgid "" "Python provides a set of functions and macros to manage thread state and the " "GIL, such as:" msgstr "" -#: ../../howto/free-threading-extensions.rst:208 +#: ../../howto/free-threading-extensions.rst:210 msgid ":c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`" -msgstr "" +msgstr ":c:func:`PyGILState_Ensure` 和 :c:func:`PyGILState_Release`" -#: ../../howto/free-threading-extensions.rst:209 +#: ../../howto/free-threading-extensions.rst:211 msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`" -msgstr "" +msgstr ":c:func:`PyEval_SaveThread` 和 :c:func:`PyEval_RestoreThread`" -#: ../../howto/free-threading-extensions.rst:210 +#: ../../howto/free-threading-extensions.rst:212 msgid ":c:macro:`Py_BEGIN_ALLOW_THREADS` and :c:macro:`Py_END_ALLOW_THREADS`" -msgstr "" +msgstr ":c:macro:`Py_BEGIN_ALLOW_THREADS` 和 :c:macro:`Py_END_ALLOW_THREADS`" -#: ../../howto/free-threading-extensions.rst:212 +#: ../../howto/free-threading-extensions.rst:214 msgid "" "These functions should still be used in the free-threaded build to manage " "thread state even when the :term:`GIL` is disabled. For example, if you " @@ -355,7 +372,7 @@ msgid "" "Python thread state." msgstr "" -#: ../../howto/free-threading-extensions.rst:218 +#: ../../howto/free-threading-extensions.rst:220 msgid "" "You should continue to call :c:func:`PyEval_SaveThread` or :c:macro:" "`Py_BEGIN_ALLOW_THREADS` around blocking operations, such as I/O or lock " @@ -363,25 +380,25 @@ msgid "" "collector <garbage collection>`." msgstr "" -#: ../../howto/free-threading-extensions.rst:225 +#: ../../howto/free-threading-extensions.rst:227 msgid "Protecting Internal Extension State" msgstr "" -#: ../../howto/free-threading-extensions.rst:227 +#: ../../howto/free-threading-extensions.rst:229 msgid "" "Your extension may have internal state that was previously protected by the " "GIL. You may need to add locking to protect this state. The approach will " "depend on your extension, but some common patterns include:" msgstr "" -#: ../../howto/free-threading-extensions.rst:231 +#: ../../howto/free-threading-extensions.rst:233 msgid "" "**Caches**: global caches are a common source of shared state. Consider " "using a lock to protect the cache or disabling it in the free-threaded build " "if the cache is not critical for performance." msgstr "" -#: ../../howto/free-threading-extensions.rst:234 +#: ../../howto/free-threading-extensions.rst:236 msgid "" "**Global State**: global state may need to be protected by a lock or moved " "to thread local storage. C11 and C++11 provide the ``thread_local`` or " @@ -389,34 +406,34 @@ msgid "" "language/storage_duration>`_." msgstr "" -#: ../../howto/free-threading-extensions.rst:241 +#: ../../howto/free-threading-extensions.rst:243 msgid "Building Extensions for the Free-Threaded Build" msgstr "" -#: ../../howto/free-threading-extensions.rst:243 +#: ../../howto/free-threading-extensions.rst:245 msgid "" "C API extensions need to be built specifically for the free-threaded build. " "The wheels, shared libraries, and binaries are indicated by a ``t`` suffix." msgstr "" -#: ../../howto/free-threading-extensions.rst:246 +#: ../../howto/free-threading-extensions.rst:248 msgid "" "`pypa/manylinux <https://github.com/pypa/manylinux>`_ supports the free-" "threaded build, with the ``t`` suffix, such as ``python3.13t``." msgstr "" -#: ../../howto/free-threading-extensions.rst:248 +#: ../../howto/free-threading-extensions.rst:250 msgid "" "`pypa/cibuildwheel <https://github.com/pypa/cibuildwheel>`_ supports the " "free-threaded build if you set `CIBW_FREE_THREADED_SUPPORT <https://" "cibuildwheel.pypa.io/en/stable/options/#free-threaded-support>`_." msgstr "" -#: ../../howto/free-threading-extensions.rst:253 +#: ../../howto/free-threading-extensions.rst:255 msgid "Limited C API and Stable ABI" msgstr "" -#: ../../howto/free-threading-extensions.rst:255 +#: ../../howto/free-threading-extensions.rst:257 msgid "" "The free-threaded build does not currently support the :ref:`Limited C API " "<limited-c-api>` or the stable ABI. If you use `setuptools <https://" @@ -426,24 +443,24 @@ msgid "" "API when building with the free-threaded build." msgstr "" -#: ../../howto/free-threading-extensions.rst:263 +#: ../../howto/free-threading-extensions.rst:265 msgid "" "You will need to build separate wheels specifically for the free-threaded " "build. If you currently use the stable ABI, you can continue to build a " "single wheel for multiple non-free-threaded Python versions." msgstr "" -#: ../../howto/free-threading-extensions.rst:269 +#: ../../howto/free-threading-extensions.rst:271 msgid "Windows" -msgstr "" +msgstr "Windows" -#: ../../howto/free-threading-extensions.rst:271 +#: ../../howto/free-threading-extensions.rst:273 msgid "" "Due to a limitation of the official Windows installer, you will need to " "manually define ``Py_GIL_DISABLED=1`` when building extensions from source." msgstr "" -#: ../../howto/free-threading-extensions.rst:276 +#: ../../howto/free-threading-extensions.rst:278 msgid "" "`Porting Extension Modules to Support Free-Threading <https://py-free-" "threading.github.io/porting/>`_: A community-maintained porting guide for " diff --git a/howto/index.po b/howto/index.po index d0d55f2163..da80089a8f 100644 --- a/howto/index.po +++ b/howto/index.po @@ -42,51 +42,51 @@ msgstr "" #: ../../howto/index.rst:39 msgid ":ref:`annotations-howto`" -msgstr "" +msgstr ":ref:`annotations-howto`" #: ../../howto/index.rst:40 msgid ":ref:`argparse-tutorial`" -msgstr "" +msgstr ":ref:`argparse-tutorial`" #: ../../howto/index.rst:41 msgid ":ref:`descriptorhowto`" -msgstr "" +msgstr ":ref:`descriptorhowto`" #: ../../howto/index.rst:42 msgid ":ref:`enum-howto`" -msgstr "" +msgstr ":ref:`enum-howto`" #: ../../howto/index.rst:43 msgid ":ref:`functional-howto`" -msgstr "" +msgstr ":ref:`functional-howto`" #: ../../howto/index.rst:44 msgid ":ref:`ipaddress-howto`" -msgstr "" +msgstr ":ref:`ipaddress-howto`" #: ../../howto/index.rst:45 msgid ":ref:`logging-howto`" -msgstr "" +msgstr ":ref:`logging-howto`" #: ../../howto/index.rst:46 msgid ":ref:`logging-cookbook`" -msgstr "" +msgstr ":ref:`logging-cookbook`" #: ../../howto/index.rst:47 msgid ":ref:`regex-howto`" -msgstr "" +msgstr ":ref:`regex-howto`" #: ../../howto/index.rst:48 msgid ":ref:`sortinghowto`" -msgstr "" +msgstr ":ref:`sortinghowto`" #: ../../howto/index.rst:49 msgid ":ref:`unicode-howto`" -msgstr "" +msgstr ":ref:`unicode-howto`" #: ../../howto/index.rst:50 msgid ":ref:`urllib-howto`" -msgstr "" +msgstr ":ref:`urllib-howto`" #: ../../howto/index.rst:52 msgid "Advanced development:" @@ -94,31 +94,31 @@ msgstr "" #: ../../howto/index.rst:54 msgid ":ref:`curses-howto`" -msgstr "" +msgstr ":ref:`curses-howto`" #: ../../howto/index.rst:55 msgid ":ref:`freethreading-extensions-howto`" -msgstr "" +msgstr ":ref:`freethreading-extensions-howto`" #: ../../howto/index.rst:56 msgid ":ref:`isolating-extensions-howto`" -msgstr "" +msgstr ":ref:`isolating-extensions-howto`" #: ../../howto/index.rst:57 msgid ":ref:`python_2.3_mro`" -msgstr "" +msgstr ":ref:`python_2.3_mro`" #: ../../howto/index.rst:58 msgid ":ref:`socket-howto`" -msgstr "" +msgstr ":ref:`socket-howto`" #: ../../howto/index.rst:59 msgid ":ref:`timerfd-howto`" -msgstr "" +msgstr ":ref:`timerfd-howto`" #: ../../howto/index.rst:60 msgid ":ref:`cporting-howto`" -msgstr "" +msgstr ":ref:`cporting-howto`" #: ../../howto/index.rst:62 msgid "Debugging and profiling:" @@ -126,15 +126,15 @@ msgstr "" #: ../../howto/index.rst:64 msgid ":ref:`gdb`" -msgstr "" +msgstr ":ref:`gdb`" #: ../../howto/index.rst:65 msgid ":ref:`instrumentation`" -msgstr "" +msgstr ":ref:`instrumentation`" #: ../../howto/index.rst:66 msgid ":ref:`perf_profiling`" -msgstr "" +msgstr ":ref:`perf_profiling`" #~ msgid "Currently, the HOWTOs are:" #~ msgstr "目前有以下這些任務指南:" diff --git a/library/2to3.po b/library/2to3.po deleted file mode 100644 index 1b1272de37..0000000000 --- a/library/2to3.po +++ /dev/null @@ -1,706 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -# jerrychen <jerrychen.ee@gmail.com>, 2016 -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2018-05-23 14:37+0000\n" -"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../../library/2to3.rst:4 -msgid "2to3 --- Automated Python 2 to 3 code translation" -msgstr "2to3 --- 自動將 Python 2的程式碼轉成 Python 3" - -#: ../../library/2to3.rst:8 -msgid "" -"2to3 is a Python program that reads Python 2.x source code and applies a " -"series of *fixers* to transform it into valid Python 3.x code. The standard " -"library contains a rich set of fixers that will handle almost all code. " -"2to3 supporting library :mod:`lib2to3` is, however, a flexible and generic " -"library, so it is possible to write your own fixers for 2to3." -msgstr "" - -#: ../../library/2to3.rst:14 -msgid "" -"The ``lib2to3`` module was marked pending for deprecation in Python 3.9 " -"(raising :exc:`PendingDeprecationWarning` on import) and fully deprecated in " -"Python 3.11 (raising :exc:`DeprecationWarning`). The ``2to3`` tool is part " -"of that. It will be removed in Python 3.13." -msgstr "" - -#: ../../library/2to3.rst:23 -msgid "Using 2to3" -msgstr "使用 2to3" - -#: ../../library/2to3.rst:25 -msgid "" -"2to3 will usually be installed with the Python interpreter as a script. It " -"is also located in the :file:`Tools/scripts` directory of the Python root." -msgstr "" - -#: ../../library/2to3.rst:28 -msgid "" -"2to3's basic arguments are a list of files or directories to transform. The " -"directories are recursively traversed for Python sources." -msgstr "" - -#: ../../library/2to3.rst:31 -msgid "Here is a sample Python 2.x source file, :file:`example.py`::" -msgstr "這邊有簡單的 Python 2的原始檔案 :file:`example.py`::" - -#: ../../library/2to3.rst:33 -msgid "" -"def greet(name):\n" -" print \"Hello, {0}!\".format(name)\n" -"print \"What's your name?\"\n" -"name = raw_input()\n" -"greet(name)" -msgstr "" - -#: ../../library/2to3.rst:39 -msgid "It can be converted to Python 3.x code via 2to3 on the command line:" -msgstr "" - -#: ../../library/2to3.rst:41 -msgid "$ 2to3 example.py" -msgstr "$ 2to3 example.py" - -#: ../../library/2to3.rst:45 -msgid "" -"A diff against the original source file is printed. 2to3 can also write the " -"needed modifications right back to the source file. (A backup of the " -"original file is made unless :option:`!-n` is also given.) Writing the " -"changes back is enabled with the :option:`!-w` flag:" -msgstr "" - -#: ../../library/2to3.rst:50 -msgid "$ 2to3 -w example.py" -msgstr "$ 2to3 -w example.py" - -#: ../../library/2to3.rst:54 -msgid "After transformation, :file:`example.py` looks like this::" -msgstr "" - -#: ../../library/2to3.rst:56 -msgid "" -"def greet(name):\n" -" print(\"Hello, {0}!\".format(name))\n" -"print(\"What's your name?\")\n" -"name = input()\n" -"greet(name)" -msgstr "" - -#: ../../library/2to3.rst:62 -msgid "" -"Comments and exact indentation are preserved throughout the translation " -"process." -msgstr "" - -#: ../../library/2to3.rst:64 -msgid "" -"By default, 2to3 runs a set of :ref:`predefined fixers <2to3-fixers>`. The :" -"option:`!-l` flag lists all available fixers. An explicit set of fixers to " -"run can be given with :option:`!-f`. Likewise the :option:`!-x` explicitly " -"disables a fixer. The following example runs only the ``imports`` and " -"``has_key`` fixers:" -msgstr "" - -#: ../../library/2to3.rst:69 -msgid "$ 2to3 -f imports -f has_key example.py" -msgstr "$ 2to3 -f imports -f has_key example.py" - -#: ../../library/2to3.rst:73 -msgid "This command runs every fixer except the ``apply`` fixer:" -msgstr "" - -#: ../../library/2to3.rst:75 -msgid "$ 2to3 -x apply example.py" -msgstr "$ 2to3 -x apply example.py" - -#: ../../library/2to3.rst:79 -msgid "" -"Some fixers are *explicit*, meaning they aren't run by default and must be " -"listed on the command line to be run. Here, in addition to the default " -"fixers, the ``idioms`` fixer is run:" -msgstr "" - -#: ../../library/2to3.rst:83 -msgid "$ 2to3 -f all -f idioms example.py" -msgstr "$ 2to3 -f all -f idioms example.py" - -#: ../../library/2to3.rst:87 -msgid "Notice how passing ``all`` enables all default fixers." -msgstr "" - -#: ../../library/2to3.rst:89 -msgid "" -"Sometimes 2to3 will find a place in your source code that needs to be " -"changed, but 2to3 cannot fix automatically. In this case, 2to3 will print a " -"warning beneath the diff for a file. You should address the warning in " -"order to have compliant 3.x code." -msgstr "" - -#: ../../library/2to3.rst:94 -msgid "" -"2to3 can also refactor doctests. To enable this mode, use the :option:`!-d` " -"flag. Note that *only* doctests will be refactored. This also doesn't " -"require the module to be valid Python. For example, doctest like examples " -"in a reST document could also be refactored with this option." -msgstr "" - -#: ../../library/2to3.rst:99 -msgid "" -"The :option:`!-v` option enables output of more information on the " -"translation process." -msgstr "" - -#: ../../library/2to3.rst:102 -msgid "" -"Since some print statements can be parsed as function calls or statements, " -"2to3 cannot always read files containing the print function. When 2to3 " -"detects the presence of the ``from __future__ import print_function`` " -"compiler directive, it modifies its internal grammar to interpret :func:" -"`print` as a function. This change can also be enabled manually with the :" -"option:`!-p` flag. Use :option:`!-p` to run fixers on code that already has " -"had its print statements converted. Also :option:`!-e` can be used to make :" -"func:`exec` a function." -msgstr "" - -#: ../../library/2to3.rst:110 -msgid "" -"The :option:`!-o` or :option:`!--output-dir` option allows specification of " -"an alternate directory for processed output files to be written to. The :" -"option:`!-n` flag is required when using this as backup files do not make " -"sense when not overwriting the input files." -msgstr "" - -#: ../../library/2to3.rst:115 -msgid "The :option:`!-o` option was added." -msgstr "新增 :option:`!-o` 選項。" - -#: ../../library/2to3.rst:118 -msgid "" -"The :option:`!-W` or :option:`!--write-unchanged-files` flag tells 2to3 to " -"always write output files even if no changes were required to the file. " -"This is most useful with :option:`!-o` so that an entire Python source tree " -"is copied with translation from one directory to another. This option " -"implies the :option:`!-w` flag as it would not make sense otherwise." -msgstr "" - -#: ../../library/2to3.rst:124 -msgid "The :option:`!-W` flag was added." -msgstr "" - -#: ../../library/2to3.rst:127 -msgid "" -"The :option:`!--add-suffix` option specifies a string to append to all " -"output filenames. The :option:`!-n` flag is required when specifying this " -"as backups are not necessary when writing to different filenames. Example:" -msgstr "" - -#: ../../library/2to3.rst:131 -msgid "$ 2to3 -n -W --add-suffix=3 example.py" -msgstr "$ 2to3 -n -W --add-suffix=3 example.py" - -#: ../../library/2to3.rst:135 -msgid "Will cause a converted file named ``example.py3`` to be written." -msgstr "" - -#: ../../library/2to3.rst:137 -msgid "The :option:`!--add-suffix` option was added." -msgstr "" - -#: ../../library/2to3.rst:140 -msgid "To translate an entire project from one directory tree to another use:" -msgstr "" - -#: ../../library/2to3.rst:142 -msgid "$ 2to3 --output-dir=python3-version/mycode -W -n python2-version/mycode" -msgstr "" -"$ 2to3 --output-dir=python3-version/mycode -W -n python2-version/mycode" - -#: ../../library/2to3.rst:150 -msgid "Fixers" -msgstr "" - -#: ../../library/2to3.rst:152 -msgid "" -"Each step of transforming code is encapsulated in a fixer. The command " -"``2to3 -l`` lists them. As :ref:`documented above <2to3-using>`, each can " -"be turned on and off individually. They are described here in more detail." -msgstr "" - -#: ../../library/2to3.rst:159 -msgid "" -"Removes usage of :func:`apply`. For example ``apply(function, *args, " -"**kwargs)`` is converted to ``function(*args, **kwargs)``." -msgstr "" - -#: ../../library/2to3.rst:164 -msgid "Replaces deprecated :mod:`unittest` method names with the correct ones." -msgstr "" - -#: ../../library/2to3.rst:167 ../../library/2to3.rst:356 -msgid "From" -msgstr "從" - -#: ../../library/2to3.rst:167 ../../library/2to3.rst:356 -msgid "To" -msgstr "到" - -#: ../../library/2to3.rst:169 -msgid "``failUnlessEqual(a, b)``" -msgstr "``failUnlessEqual(a, b)``" - -#: ../../library/2to3.rst:169 ../../library/2to3.rst:171 -msgid ":meth:`assertEqual(a, b) <unittest.TestCase.assertEqual>`" -msgstr ":meth:`assertEqual(a, b) <unittest.TestCase.assertEqual>`" - -#: ../../library/2to3.rst:171 -msgid "``assertEquals(a, b)``" -msgstr "``assertEquals(a, b)``" - -#: ../../library/2to3.rst:173 -msgid "``failIfEqual(a, b)``" -msgstr "``failIfEqual(a, b)``" - -#: ../../library/2to3.rst:173 ../../library/2to3.rst:175 -msgid ":meth:`assertNotEqual(a, b) <unittest.TestCase.assertNotEqual>`" -msgstr ":meth:`assertNotEqual(a, b) <unittest.TestCase.assertNotEqual>`" - -#: ../../library/2to3.rst:175 -msgid "``assertNotEquals(a, b)``" -msgstr "``assertNotEquals(a, b)``" - -#: ../../library/2to3.rst:177 -msgid "``failUnless(a)``" -msgstr "``failUnless(a)``" - -#: ../../library/2to3.rst:177 ../../library/2to3.rst:179 -msgid ":meth:`assertTrue(a) <unittest.TestCase.assertTrue>`" -msgstr ":meth:`assertTrue(a) <unittest.TestCase.assertTrue>`" - -#: ../../library/2to3.rst:179 -msgid "``assert_(a)``" -msgstr "``assert_(a)``" - -#: ../../library/2to3.rst:181 -msgid "``failIf(a)``" -msgstr "``failIf(a)``" - -#: ../../library/2to3.rst:181 -msgid ":meth:`assertFalse(a) <unittest.TestCase.assertFalse>`" -msgstr ":meth:`assertFalse(a) <unittest.TestCase.assertFalse>`" - -#: ../../library/2to3.rst:183 -msgid "``failUnlessRaises(exc, cal)``" -msgstr "``failUnlessRaises(exc, cal)``" - -#: ../../library/2to3.rst:183 -msgid ":meth:`assertRaises(exc, cal) <unittest.TestCase.assertRaises>`" -msgstr ":meth:`assertRaises(exc, cal) <unittest.TestCase.assertRaises>`" - -#: ../../library/2to3.rst:185 -msgid "``failUnlessAlmostEqual(a, b)``" -msgstr "``failUnlessAlmostEqual(a, b)``" - -#: ../../library/2to3.rst:185 ../../library/2to3.rst:187 -msgid ":meth:`assertAlmostEqual(a, b) <unittest.TestCase.assertAlmostEqual>`" -msgstr ":meth:`assertAlmostEqual(a, b) <unittest.TestCase.assertAlmostEqual>`" - -#: ../../library/2to3.rst:187 -msgid "``assertAlmostEquals(a, b)``" -msgstr "``assertAlmostEquals(a, b)``" - -#: ../../library/2to3.rst:189 -msgid "``failIfAlmostEqual(a, b)``" -msgstr "``failIfAlmostEqual(a, b)``" - -#: ../../library/2to3.rst:189 ../../library/2to3.rst:191 -msgid "" -":meth:`assertNotAlmostEqual(a, b) <unittest.TestCase.assertNotAlmostEqual>`" -msgstr "" - -#: ../../library/2to3.rst:191 -msgid "``assertNotAlmostEquals(a, b)``" -msgstr "``assertNotAlmostEquals(a, b)``" - -#: ../../library/2to3.rst:197 -msgid "Converts :class:`basestring` to :class:`str`." -msgstr "" - -#: ../../library/2to3.rst:201 -msgid "" -"Converts :class:`buffer` to :class:`memoryview`. This fixer is optional " -"because the :class:`memoryview` API is similar but not exactly the same as " -"that of :class:`buffer`." -msgstr "" - -#: ../../library/2to3.rst:207 -msgid "" -"Fixes dictionary iteration methods. :meth:`dict.iteritems` is converted to :" -"meth:`dict.items`, :meth:`dict.iterkeys` to :meth:`dict.keys`, and :meth:" -"`dict.itervalues` to :meth:`dict.values`. Similarly, :meth:`dict." -"viewitems`, :meth:`dict.viewkeys` and :meth:`dict.viewvalues` are converted " -"respectively to :meth:`dict.items`, :meth:`dict.keys` and :meth:`dict." -"values`. It also wraps existing usages of :meth:`dict.items`, :meth:`dict." -"keys`, and :meth:`dict.values` in a call to :class:`list`." -msgstr "" - -#: ../../library/2to3.rst:217 -msgid "Converts ``except X, T`` to ``except X as T``." -msgstr "" - -#: ../../library/2to3.rst:221 -msgid "Converts the ``exec`` statement to the :func:`exec` function." -msgstr "" - -#: ../../library/2to3.rst:225 -msgid "" -"Removes usage of :func:`execfile`. The argument to :func:`execfile` is " -"wrapped in calls to :func:`open`, :func:`compile`, and :func:`exec`." -msgstr "" - -#: ../../library/2to3.rst:230 -msgid "" -"Changes assignment of :attr:`sys.exitfunc` to use of the :mod:`atexit` " -"module." -msgstr "" - -#: ../../library/2to3.rst:235 -msgid "Wraps :func:`filter` usage in a :class:`list` call." -msgstr "" - -#: ../../library/2to3.rst:239 -msgid "" -"Fixes function attributes that have been renamed. For example, " -"``my_function.func_closure`` is converted to ``my_function.__closure__``." -msgstr "" - -#: ../../library/2to3.rst:244 -msgid "Removes ``from __future__ import new_feature`` statements." -msgstr "" - -#: ../../library/2to3.rst:248 -msgid "Renames :func:`os.getcwdu` to :func:`os.getcwd`." -msgstr "" - -#: ../../library/2to3.rst:252 -msgid "Changes ``dict.has_key(key)`` to ``key in dict``." -msgstr "" - -#: ../../library/2to3.rst:256 -msgid "" -"This optional fixer performs several transformations that make Python code " -"more idiomatic. Type comparisons like ``type(x) is SomeClass`` and " -"``type(x) == SomeClass`` are converted to ``isinstance(x, SomeClass)``. " -"``while 1`` becomes ``while True``. This fixer also tries to make use of :" -"func:`sorted` in appropriate places. For example, this block ::" -msgstr "" - -#: ../../library/2to3.rst:262 -msgid "" -"L = list(some_iterable)\n" -"L.sort()" -msgstr "" -"L = list(some_iterable)\n" -"L.sort()" - -#: ../../library/2to3.rst:265 -msgid "is changed to ::" -msgstr "" - -#: ../../library/2to3.rst:267 -msgid "L = sorted(some_iterable)" -msgstr "L = sorted(some_iterable)" - -#: ../../library/2to3.rst:271 -msgid "Detects sibling imports and converts them to relative imports." -msgstr "" - -#: ../../library/2to3.rst:275 -msgid "Handles module renames in the standard library." -msgstr "" - -#: ../../library/2to3.rst:279 -msgid "" -"Handles other modules renames in the standard library. It is separate from " -"the :2to3fixer:`imports` fixer only because of technical limitations." -msgstr "" - -#: ../../library/2to3.rst:284 -msgid "Converts ``input(prompt)`` to ``eval(input(prompt))``." -msgstr "" - -#: ../../library/2to3.rst:288 -msgid "Converts :func:`intern` to :func:`sys.intern`." -msgstr "" - -#: ../../library/2to3.rst:292 -msgid "" -"Fixes duplicate types in the second argument of :func:`isinstance`. For " -"example, ``isinstance(x, (int, int))`` is converted to ``isinstance(x, " -"int)`` and ``isinstance(x, (int, float, int))`` is converted to " -"``isinstance(x, (int, float))``." -msgstr "" - -#: ../../library/2to3.rst:299 -msgid "" -"Removes imports of :func:`itertools.ifilter`, :func:`itertools.izip`, and :" -"func:`itertools.imap`. Imports of :func:`itertools.ifilterfalse` are also " -"changed to :func:`itertools.filterfalse`." -msgstr "" - -#: ../../library/2to3.rst:305 -msgid "" -"Changes usage of :func:`itertools.ifilter`, :func:`itertools.izip`, and :" -"func:`itertools.imap` to their built-in equivalents. :func:`itertools." -"ifilterfalse` is changed to :func:`itertools.filterfalse`." -msgstr "" - -#: ../../library/2to3.rst:311 -msgid "Renames :class:`long` to :class:`int`." -msgstr "" - -#: ../../library/2to3.rst:315 -msgid "" -"Wraps :func:`map` in a :class:`list` call. It also changes ``map(None, x)`` " -"to ``list(x)``. Using ``from future_builtins import map`` disables this " -"fixer." -msgstr "" - -#: ../../library/2to3.rst:321 -msgid "" -"Converts the old metaclass syntax (``__metaclass__ = Meta`` in the class " -"body) to the new (``class X(metaclass=Meta)``)." -msgstr "" - -#: ../../library/2to3.rst:326 -msgid "" -"Fixes old method attribute names. For example, ``meth.im_func`` is " -"converted to ``meth.__func__``." -msgstr "" - -#: ../../library/2to3.rst:331 -msgid "Converts the old not-equal syntax, ``<>``, to ``!=``." -msgstr "" - -#: ../../library/2to3.rst:335 -msgid "" -"Converts the use of iterator's :meth:`~iterator.next` methods to the :func:" -"`next` function. It also renames :meth:`next` methods to :meth:`~iterator." -"__next__`." -msgstr "" - -#: ../../library/2to3.rst:341 -msgid "" -"Renames definitions of methods called :meth:`__nonzero__` to :meth:`~object." -"__bool__`." -msgstr "" - -#: ../../library/2to3.rst:346 -msgid "Converts octal literals into the new syntax." -msgstr "" - -#: ../../library/2to3.rst:350 -msgid "" -"Converts calls to various functions in the :mod:`operator` module to other, " -"but equivalent, function calls. When needed, the appropriate ``import`` " -"statements are added, e.g. ``import collections.abc``. The following " -"mapping are made:" -msgstr "" - -#: ../../library/2to3.rst:358 -msgid "``operator.isCallable(obj)``" -msgstr "``operator.isCallable(obj)``" - -#: ../../library/2to3.rst:358 -msgid "``callable(obj)``" -msgstr "``callable(obj)``" - -#: ../../library/2to3.rst:359 -msgid "``operator.sequenceIncludes(obj)``" -msgstr "``operator.sequenceIncludes(obj)``" - -#: ../../library/2to3.rst:359 -msgid "``operator.contains(obj)``" -msgstr "``operator.contains(obj)``" - -#: ../../library/2to3.rst:360 -msgid "``operator.isSequenceType(obj)``" -msgstr "``operator.isSequenceType(obj)``" - -#: ../../library/2to3.rst:360 -msgid "``isinstance(obj, collections.abc.Sequence)``" -msgstr "``isinstance(obj, collections.abc.Sequence)``" - -#: ../../library/2to3.rst:361 -msgid "``operator.isMappingType(obj)``" -msgstr "``operator.isMappingType(obj)``" - -#: ../../library/2to3.rst:361 -msgid "``isinstance(obj, collections.abc.Mapping)``" -msgstr "``isinstance(obj, collections.abc.Mapping)``" - -#: ../../library/2to3.rst:362 -msgid "``operator.isNumberType(obj)``" -msgstr "``operator.isNumberType(obj)``" - -#: ../../library/2to3.rst:362 -msgid "``isinstance(obj, numbers.Number)``" -msgstr "``isinstance(obj, numbers.Number)``" - -#: ../../library/2to3.rst:363 -msgid "``operator.repeat(obj, n)``" -msgstr "``operator.repeat(obj, n)``" - -#: ../../library/2to3.rst:363 -msgid "``operator.mul(obj, n)``" -msgstr "``operator.mul(obj, n)``" - -#: ../../library/2to3.rst:364 -msgid "``operator.irepeat(obj, n)``" -msgstr "``operator.irepeat(obj, n)``" - -#: ../../library/2to3.rst:364 -msgid "``operator.imul(obj, n)``" -msgstr "``operator.imul(obj, n)``" - -#: ../../library/2to3.rst:369 -msgid "" -"Add extra parenthesis where they are required in list comprehensions. For " -"example, ``[x for x in 1, 2]`` becomes ``[x for x in (1, 2)]``." -msgstr "" - -#: ../../library/2to3.rst:374 -msgid "Converts the ``print`` statement to the :func:`print` function." -msgstr "" - -#: ../../library/2to3.rst:378 -msgid "" -"Converts ``raise E, V`` to ``raise E(V)``, and ``raise E, V, T`` to ``raise " -"E(V).with_traceback(T)``. If ``E`` is a tuple, the translation will be " -"incorrect because substituting tuples for exceptions has been removed in 3.0." -msgstr "" - -#: ../../library/2to3.rst:384 -msgid "Converts :func:`raw_input` to :func:`input`." -msgstr "" - -#: ../../library/2to3.rst:388 -msgid "Handles the move of :func:`reduce` to :func:`functools.reduce`." -msgstr "" - -#: ../../library/2to3.rst:392 -msgid "Converts :func:`reload` to :func:`importlib.reload`." -msgstr "" - -#: ../../library/2to3.rst:396 -msgid "Changes :data:`sys.maxint` to :data:`sys.maxsize`." -msgstr "" - -#: ../../library/2to3.rst:400 -msgid "Replaces backtick repr with the :func:`repr` function." -msgstr "" - -#: ../../library/2to3.rst:404 -msgid "" -"Replaces use of the :class:`set` constructor with set literals. This fixer " -"is optional." -msgstr "" - -#: ../../library/2to3.rst:409 -msgid "Renames :exc:`StandardError` to :exc:`Exception`." -msgstr "" - -#: ../../library/2to3.rst:413 -msgid "" -"Changes the deprecated :data:`sys.exc_value`, :data:`sys.exc_type`, :data:" -"`sys.exc_traceback` to use :func:`sys.exc_info`." -msgstr "" - -#: ../../library/2to3.rst:418 -msgid "Fixes the API change in generator's :meth:`throw` method." -msgstr "" - -#: ../../library/2to3.rst:422 -msgid "" -"Removes implicit tuple parameter unpacking. This fixer inserts temporary " -"variables." -msgstr "" - -#: ../../library/2to3.rst:427 -msgid "" -"Fixes code broken from the removal of some members in the :mod:`types` " -"module." -msgstr "" - -#: ../../library/2to3.rst:432 -msgid "Renames :class:`unicode` to :class:`str`." -msgstr "" - -#: ../../library/2to3.rst:436 -msgid "" -"Handles the rename of :mod:`urllib` and :mod:`urllib2` to the :mod:`urllib` " -"package." -msgstr "" - -#: ../../library/2to3.rst:441 -msgid "" -"Removes excess whitespace from comma separated items. This fixer is " -"optional." -msgstr "" - -#: ../../library/2to3.rst:446 -msgid "" -"Renames :func:`xrange` to :func:`range` and wraps existing :func:`range` " -"calls with :class:`list`." -msgstr "" - -#: ../../library/2to3.rst:451 -msgid "Changes ``for x in file.xreadlines()`` to ``for x in file``." -msgstr "" - -#: ../../library/2to3.rst:455 -msgid "" -"Wraps :func:`zip` usage in a :class:`list` call. This is disabled when " -"``from future_builtins import zip`` appears." -msgstr "" - -#: ../../library/2to3.rst:460 -msgid ":mod:`lib2to3` --- 2to3's library" -msgstr "" - -#: ../../library/2to3.rst:469 -msgid "**Source code:** :source:`Lib/lib2to3/`" -msgstr "**原始碼:**\\ :source:`Lib/lib2to3/`" - -#: ../../library/2to3.rst:473 -msgid "" -"Python 3.9 switched to a PEG parser (see :pep:`617`) while lib2to3 is using " -"a less flexible LL(1) parser. Python 3.10 includes new language syntax that " -"is not parsable by lib2to3's LL(1) parser (see :pep:`634`). The ``lib2to3`` " -"module was marked pending for deprecation in Python 3.9 (raising :exc:" -"`PendingDeprecationWarning` on import) and fully deprecated in Python 3.11 " -"(raising :exc:`DeprecationWarning`). It will be removed from the standard " -"library in Python 3.13. Consider third-party alternatives such as `LibCST`_ " -"or `parso`_." -msgstr "" - -#: ../../library/2to3.rst:485 -msgid "" -"The :mod:`lib2to3` API should be considered unstable and may change " -"drastically in the future." -msgstr "" diff --git a/library/_thread.po b/library/_thread.po index 3fad9c4652..c36a47a237 100644 --- a/library/_thread.po +++ b/library/_thread.po @@ -215,7 +215,7 @@ msgstr "" #: ../../library/_thread.rst:148 msgid ":ref:`Availability <availability>`: Windows, pthreads." -msgstr ":ref:`適用 <availability>`:Windows, pthreads。" +msgstr ":ref:`適用 <availability>`:Windows、pthreads。" #: ../../library/_thread.rst:150 msgid "Unix platforms with POSIX threads support." diff --git a/library/aifc.po b/library/aifc.po deleted file mode 100644 index e5750661b5..0000000000 --- a/library/aifc.po +++ /dev/null @@ -1,286 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" -"PO-Revision-Date: 2022-05-22 01:57+0800\n" -"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/aifc.rst:2 -msgid ":mod:`aifc` --- Read and write AIFF and AIFC files" -msgstr ":mod:`aifc` --- 讀寫 AIFF 與 AIFC 檔案" - -#: ../../library/aifc.rst:8 -msgid "**Source code:** :source:`Lib/aifc.py`" -msgstr "**原始碼:**\\ :source:`Lib/aifc.py`" - -#: ../../library/aifc.rst:16 -msgid "" -"The :mod:`aifc` module is deprecated (see :pep:`PEP 594 <594#aifc>` for " -"details)." -msgstr "" -":mod:`aifc` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#aifc>`\\ )。" - -#: ../../library/aifc.rst:22 -msgid "" -"This module provides support for reading and writing AIFF and AIFF-C files. " -"AIFF is Audio Interchange File Format, a format for storing digital audio " -"samples in a file. AIFF-C is a newer version of the format that includes " -"the ability to compress the audio data." -msgstr "" - -#: ../../library/aifc.rst:27 -msgid "" -"Audio files have a number of parameters that describe the audio data. The " -"sampling rate or frame rate is the number of times per second the sound is " -"sampled. The number of channels indicate if the audio is mono, stereo, or " -"quadro. Each frame consists of one sample per channel. The sample size is " -"the size in bytes of each sample. Thus a frame consists of ``nchannels * " -"samplesize`` bytes, and a second's worth of audio consists of ``nchannels * " -"samplesize * framerate`` bytes." -msgstr "" - -#: ../../library/aifc.rst:35 -msgid "" -"For example, CD quality audio has a sample size of two bytes (16 bits), uses " -"two channels (stereo) and has a frame rate of 44,100 frames/second. This " -"gives a frame size of 4 bytes (2\\*2), and a second's worth occupies " -"2\\*2\\*44100 bytes (176,400 bytes)." -msgstr "" - -#: ../../library/aifc.rst:40 -msgid "Module :mod:`aifc` defines the following function:" -msgstr ":mod:`aifc` 模組定義了以下函式:" - -#: ../../library/aifc.rst:45 -msgid "" -"Open an AIFF or AIFF-C file and return an object instance with methods that " -"are described below. The argument *file* is either a string naming a file " -"or a :term:`file object`. *mode* must be ``'r'`` or ``'rb'`` when the file " -"must be opened for reading, or ``'w'`` or ``'wb'`` when the file must be " -"opened for writing. If omitted, ``file.mode`` is used if it exists, " -"otherwise ``'rb'`` is used. When used for writing, the file object should " -"be seekable, unless you know ahead of time how many samples you are going to " -"write in total and use :meth:`writeframesraw` and :meth:`setnframes`. The :" -"func:`.open` function may be used in a :keyword:`with` statement. When the :" -"keyword:`!with` block completes, the :meth:`~aifc.close` method is called." -msgstr "" - -#: ../../library/aifc.rst:56 -msgid "Support for the :keyword:`with` statement was added." -msgstr "" - -#: ../../library/aifc.rst:59 -msgid "" -"Objects returned by :func:`.open` when a file is opened for reading have the " -"following methods:" -msgstr "" - -#: ../../library/aifc.rst:65 -msgid "Return the number of audio channels (1 for mono, 2 for stereo)." -msgstr "" - -#: ../../library/aifc.rst:70 -msgid "Return the size in bytes of individual samples." -msgstr "" - -#: ../../library/aifc.rst:75 -msgid "Return the sampling rate (number of audio frames per second)." -msgstr "" - -#: ../../library/aifc.rst:80 -msgid "Return the number of audio frames in the file." -msgstr "" - -#: ../../library/aifc.rst:85 -msgid "" -"Return a bytes array of length 4 describing the type of compression used in " -"the audio file. For AIFF files, the returned value is ``b'NONE'``." -msgstr "" - -#: ../../library/aifc.rst:92 -msgid "" -"Return a bytes array convertible to a human-readable description of the type " -"of compression used in the audio file. For AIFF files, the returned value " -"is ``b'not compressed'``." -msgstr "" - -#: ../../library/aifc.rst:99 -msgid "" -"Returns a :func:`~collections.namedtuple` ``(nchannels, sampwidth, " -"framerate, nframes, comptype, compname)``, equivalent to output of the :meth:" -"`get\\*` methods." -msgstr "" - -#: ../../library/aifc.rst:106 -msgid "" -"Return a list of markers in the audio file. A marker consists of a tuple of " -"three elements. The first is the mark ID (an integer), the second is the " -"mark position in frames from the beginning of the data (an integer), the " -"third is the name of the mark (a string)." -msgstr "" - -#: ../../library/aifc.rst:114 -msgid "" -"Return the tuple as described in :meth:`getmarkers` for the mark with the " -"given *id*." -msgstr "" - -#: ../../library/aifc.rst:120 -msgid "" -"Read and return the next *nframes* frames from the audio file. The returned " -"data is a string containing for each frame the uncompressed samples of all " -"channels." -msgstr "" - -#: ../../library/aifc.rst:127 -msgid "" -"Rewind the read pointer. The next :meth:`readframes` will start from the " -"beginning." -msgstr "" - -#: ../../library/aifc.rst:133 -msgid "Seek to the specified frame number." -msgstr "" - -#: ../../library/aifc.rst:138 -msgid "Return the current frame number." -msgstr "" - -#: ../../library/aifc.rst:143 -msgid "" -"Close the AIFF file. After calling this method, the object can no longer be " -"used." -msgstr "" - -#: ../../library/aifc.rst:146 -msgid "" -"Objects returned by :func:`.open` when a file is opened for writing have all " -"the above methods, except for :meth:`readframes` and :meth:`setpos`. In " -"addition the following methods exist. The :meth:`get\\*` methods can only " -"be called after the corresponding :meth:`set\\*` methods have been called. " -"Before the first :meth:`writeframes` or :meth:`writeframesraw`, all " -"parameters except for the number of frames must be filled in." -msgstr "" - -#: ../../library/aifc.rst:156 -msgid "" -"Create an AIFF file. The default is that an AIFF-C file is created, unless " -"the name of the file ends in ``'.aiff'`` in which case the default is an " -"AIFF file." -msgstr "" - -#: ../../library/aifc.rst:162 -msgid "" -"Create an AIFF-C file. The default is that an AIFF-C file is created, " -"unless the name of the file ends in ``'.aiff'`` in which case the default is " -"an AIFF file." -msgstr "" - -#: ../../library/aifc.rst:169 -msgid "Specify the number of channels in the audio file." -msgstr "" - -#: ../../library/aifc.rst:174 -msgid "Specify the size in bytes of audio samples." -msgstr "" - -#: ../../library/aifc.rst:179 -msgid "Specify the sampling frequency in frames per second." -msgstr "" - -#: ../../library/aifc.rst:184 -msgid "" -"Specify the number of frames that are to be written to the audio file. If " -"this parameter is not set, or not set correctly, the file needs to support " -"seeking." -msgstr "" - -#: ../../library/aifc.rst:195 -msgid "" -"Specify the compression type. If not specified, the audio data will not be " -"compressed. In AIFF files, compression is not possible. The name parameter " -"should be a human-readable description of the compression type as a bytes " -"array, the type parameter should be a bytes array of length 4. Currently " -"the following compression types are supported: ``b'NONE'``, ``b'ULAW'``, " -"``b'ALAW'``, ``b'G722'``." -msgstr "" - -#: ../../library/aifc.rst:205 -msgid "" -"Set all the above parameters at once. The argument is a tuple consisting of " -"the various parameters. This means that it is possible to use the result of " -"a :meth:`getparams` call as argument to :meth:`setparams`." -msgstr "" - -#: ../../library/aifc.rst:212 -msgid "" -"Add a mark with the given id (larger than 0), and the given name at the " -"given position. This method can be called at any time before :meth:`close`." -msgstr "" - -#: ../../library/aifc.rst:219 -msgid "" -"Return the current write position in the output file. Useful in combination " -"with :meth:`setmark`." -msgstr "" - -#: ../../library/aifc.rst:225 -msgid "" -"Write data to the output file. This method can only be called after the " -"audio file parameters have been set." -msgstr "" - -#: ../../library/aifc.rst:228 ../../library/aifc.rst:237 -msgid "Any :term:`bytes-like object` is now accepted." -msgstr "" - -#: ../../library/aifc.rst:234 -msgid "" -"Like :meth:`writeframes`, except that the header of the audio file is not " -"updated." -msgstr "" - -#: ../../library/aifc.rst:244 -msgid "" -"Close the AIFF file. The header of the file is updated to reflect the " -"actual size of the audio data. After calling this method, the object can no " -"longer be used." -msgstr "" - -#: ../../library/aifc.rst:10 -msgid "Audio Interchange File Format" -msgstr "Audio Interchange File Format(音訊交換檔案格式)" - -#: ../../library/aifc.rst:10 -msgid "AIFF" -msgstr "AIFF" - -#: ../../library/aifc.rst:10 -msgid "AIFF-C" -msgstr "AIFF-C" - -#: ../../library/aifc.rst:190 -msgid "u-LAW" -msgstr "u-LAW" - -#: ../../library/aifc.rst:190 -msgid "A-LAW" -msgstr "A-LAW" - -#: ../../library/aifc.rst:190 -msgid "G.722" -msgstr "G.722" diff --git a/library/argparse.po b/library/argparse.po index 726a5ed8f2..8c2959c432 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2614,7 +2614,7 @@ msgid "" "argument of :meth:`~ArgumentParser.add_argument`, which defaults to " "``False``, specifies if the argument is deprecated and will be removed in " "the future. For arguments, if ``deprecated`` is ``True``, then a warning " -"will be printed to standard error when the argument is used::" +"will be printed to :data:`sys.stderr` when the argument is used::" msgstr "" #: ../../library/argparse.rst:1460 @@ -3858,8 +3858,8 @@ msgstr "" #: ../../library/argparse.rst:2237 msgid "" "This method terminates the program, exiting with the specified *status* and, " -"if given, it prints a *message* before that. The user can override this " -"method to handle these steps differently::" +"if given, it prints a *message* to :data:`sys.stderr` before that. The user " +"can override this method to handle these steps differently::" msgstr "" #: ../../library/argparse.rst:2241 @@ -3878,8 +3878,8 @@ msgstr "" #: ../../library/argparse.rst:2249 msgid "" -"This method prints a usage message including the *message* to the standard " -"error and terminates the program with a status code of 2." +"This method prints a usage message, including the *message*, to :data:`sys." +"stderr` and terminates the program with a status code of 2." msgstr "" #: ../../library/argparse.rst:2254 diff --git a/library/array.po b/library/array.po index 22011a7f92..8d66dac4e6 100644 --- a/library/array.po +++ b/library/array.po @@ -112,11 +112,11 @@ msgstr "\\(1)" #: ../../library/array.rst:27 msgid "``'w'``" -msgstr "" +msgstr "``'w'``" #: ../../library/array.rst:27 msgid "Py_UCS4" -msgstr "" +msgstr "Py_UCS4" #: ../../library/array.rst:27 ../../library/array.rst:37 #: ../../library/array.rst:39 ../../library/array.rst:45 @@ -536,13 +536,3 @@ msgstr "NumPy 套件定義了另一個陣列型別" #: ../../library/array.rst:7 msgid "arrays" msgstr "arrays(陣列)" - -#~ msgid "Module :mod:`xdrlib`" -#~ msgstr ":mod:`xdrlib` 模組" - -#~ msgid "" -#~ "Packing and unpacking of External Data Representation (XDR) data as used " -#~ "in some remote procedure call systems." -#~ msgstr "" -#~ "將 External Data Representation (XDR) 的資料包裝與解開包裝,這用在一些遠端" -#~ "操作的系統 (remote procedure call systems)。" diff --git a/library/ast.po b/library/ast.po index 4a81075034..a667e2bdc0 100644 --- a/library/ast.po +++ b/library/ast.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 15:56+0800\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -264,11 +264,10 @@ msgstr "" "有特定建構函式節點的實例會被建立。" #: ../../library/ast.rst:64 -#, fuzzy msgid "" "Each concrete class has an attribute :attr:`!_fields` which gives the names " "of all child nodes." -msgstr "每個具體類別都有一個屬性 :attr:`_fields`,它會給出所有子節點的名稱。" +msgstr "每個具體類別都有一個屬性 :attr:`!_fields`,它會給出所有子節點的名稱。" #: ../../library/ast.rst:67 msgid "" @@ -296,6 +295,8 @@ msgid "" "The :attr:`!_field_types` attribute on each concrete class is a dictionary " "mapping field names (as also listed in :attr:`_fields`) to their types." msgstr "" +"每個具體類別上的 :attr:`!_field_types` 屬性是將欄位名稱(也在 :attr:" +"`_fields` 中列出)對映到其型別的字典。" #: ../../library/ast.rst:82 msgid "" @@ -303,6 +304,9 @@ msgid "" "{'name': <class 'str'>, 'bound': ast.expr | None, 'default_value': ast.expr " "| None}" msgstr "" +">>> ast.TypeVar._field_types\n" +"{'name': <class 'str'>, 'bound': ast.expr | None, 'default_value': ast.expr " +"| None}" #: ../../library/ast.rst:94 msgid "" @@ -376,6 +380,11 @@ msgid "" "exc:`DeprecationWarning` is raised and the AST node will not have this " "field. In Python 3.15, this condition will raise an error." msgstr "" +"如果建構函式中省略了文法中可選的欄位,則它預設為 ``None``。如果省略串列欄位," +"則預設為空串列。如果省略 :class:`!ast.expr_context` 型別的欄位,則預設為 :" +"class:`Load() <ast.Load>`。如果省略任何其他欄位,則會引發 :exc:" +"`DeprecationWarning`,且 AST 節點將沒有此欄位。在 Python 3.15 中,這種情況會" +"引發錯誤。" #: ../../library/ast.rst:130 msgid "Class :class:`ast.Constant` is now used for all constants." @@ -415,6 +424,9 @@ msgid "" "did not match any of the fields of the AST node. This behavior is deprecated " "and will be removed in Python 3.15." msgstr "" +"先前版本的 Python 允許建立缺少必填欄位的 AST 節點。同樣地,AST 節點建構函式允" +"許將任意關鍵字引數設為 AST 節點的屬性,即使它們與 AST 節點的任何欄位都不匹" +"配。此行為已被棄用,並將在 Python 3.15 中刪除。" #: ../../library/ast.rst:160 msgid "" @@ -451,7 +463,6 @@ msgstr "" "閱 :func:`ast.parse`。" #: ../../library/ast.rst:181 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('x = 1'), indent=4))\n" "Module(\n" @@ -467,8 +478,7 @@ msgstr "" " Assign(\n" " targets=[\n" " Name(id='x', ctx=Store())],\n" -" value=Constant(value=1))],\n" -" type_ignores=[])" +" value=Constant(value=1))])" #: ../../library/ast.rst:194 msgid "" @@ -661,7 +671,6 @@ msgstr "" "一個 f 字串,包含一系列 :class:`FormattedValue` 和 :class:`Constant` 節點。" #: ../../library/ast.rst:302 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('f\"sin({a}) is {sin(a):.3}\"', mode='eval'), " "indent=4))\n" @@ -697,8 +706,7 @@ msgstr "" " value=Call(\n" " func=Name(id='sin', ctx=Load()),\n" " args=[\n" -" Name(id='a', ctx=Load())],\n" -" keywords=[]),\n" +" Name(id='a', ctx=Load())]),\n" " conversion=-1,\n" " format_spec=JoinedStr(\n" " values=[\n" @@ -832,7 +840,6 @@ msgstr "" "(context) 來區分這些情況。" #: ../../library/ast.rst:406 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('a'), indent=4))\n" "Module(\n" @@ -859,8 +866,7 @@ msgstr "" "Module(\n" " body=[\n" " Expr(\n" -" value=Name(id='a', ctx=Load()))],\n" -" type_ignores=[])\n" +" value=Name(id='a', ctx=Load()))])\n" "\n" ">>> print(ast.dump(ast.parse('a = 1'), indent=4))\n" "Module(\n" @@ -868,16 +874,14 @@ msgstr "" " Assign(\n" " targets=[\n" " Name(id='a', ctx=Store())],\n" -" value=Constant(value=1))],\n" -" type_ignores=[])\n" +" value=Constant(value=1))])\n" "\n" ">>> print(ast.dump(ast.parse('del a'), indent=4))\n" "Module(\n" " body=[\n" " Delete(\n" " targets=[\n" -" Name(id='a', ctx=Del())])],\n" -" type_ignores=[])" +" Name(id='a', ctx=Del())])])" #: ../../library/ast.rst:432 msgid "" @@ -889,7 +893,6 @@ msgstr "" "使用 ``*args`` 建置 :class:`Call` 節點時必須使用此型別。" #: ../../library/ast.rst:436 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('a, *b = it'), indent=4))\n" "Module(\n" @@ -917,8 +920,7 @@ msgstr "" " value=Name(id='b', ctx=Store()),\n" " ctx=Store())],\n" " ctx=Store())],\n" -" value=Name(id='it', ctx=Load()))],\n" -" type_ignores=[])" +" value=Name(id='it', ctx=Load()))])" #: ../../library/ast.rst:456 msgid "Expressions" @@ -938,7 +940,6 @@ msgstr "" "`YieldFrom`" #: ../../library/ast.rst:465 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('-a'), indent=4))\n" "Module(\n" @@ -954,8 +955,7 @@ msgstr "" " Expr(\n" " value=UnaryOp(\n" " op=USub(),\n" -" operand=Name(id='a', ctx=Load())))],\n" -" type_ignores=[])" +" operand=Name(id='a', ctx=Load())))])" #: ../../library/ast.rst:478 msgid "" @@ -1108,12 +1108,10 @@ msgstr "" "``keywords`` 保存一個 :class:`.keyword` 物件串列,表示透過關鍵字傳遞的引數。" #: ../../library/ast.rst:600 -#, fuzzy msgid "" "The ``args`` and ``keywords`` arguments are optional and default to empty " "lists." -msgstr "" -"建立 ``Call`` 節點時會需要 ``args`` 和 ``keywords``,但它們可以是空串列。" +msgstr "``args`` 和 ``keywords`` 引數是可選的,預設為空串列。" #: ../../library/ast.rst:602 msgid "" @@ -1326,7 +1324,6 @@ msgid "``generators`` is a list of :class:`comprehension` nodes." msgstr "``generators`` 是一個 :class:`comprehension` 節點的串列。" #: ../../library/ast.rst:735 -#, fuzzy msgid "" ">>> print(ast.dump(\n" "... ast.parse('[x for x in numbers]', mode='eval'),\n" @@ -1369,8 +1366,10 @@ msgid "" " iter=Name(id='numbers', ctx=Load()),\n" " is_async=0)]))" msgstr "" -">>> print(ast.dump(ast.parse('[x for x in numbers]', mode='eval'), " -"indent=4))\n" +">>> print(ast.dump(\n" +"... ast.parse('[x for x in numbers]', mode='eval'),\n" +"... indent=4,\n" +"... ))\n" "Expression(\n" " body=ListComp(\n" " elt=Name(id='x', ctx=Load()),\n" @@ -1378,10 +1377,11 @@ msgstr "" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" " is_async=0)]))\n" -">>> print(ast.dump(ast.parse('{x: x**2 for x in numbers}', mode='eval'), " -"indent=4))\n" +">>> print(ast.dump(\n" +"... ast.parse('{x: x**2 for x in numbers}', mode='eval'),\n" +"... indent=4,\n" +"... ))\n" "Expression(\n" " body=DictComp(\n" " key=Name(id='x', ctx=Load()),\n" @@ -1393,10 +1393,11 @@ msgstr "" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" " is_async=0)]))\n" -">>> print(ast.dump(ast.parse('{x for x in numbers}', mode='eval'), " -"indent=4))\n" +">>> print(ast.dump(\n" +"... ast.parse('{x for x in numbers}', mode='eval'),\n" +"... indent=4,\n" +"... ))\n" "Expression(\n" " body=SetComp(\n" " elt=Name(id='x', ctx=Load()),\n" @@ -1404,7 +1405,6 @@ msgstr "" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" " is_async=0)]))" #: ../../library/ast.rst:781 @@ -1427,7 +1427,6 @@ msgstr "" "該值為整數(0 或 1)。" #: ../../library/ast.rst:789 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('[ord(c) for line in file for c in line]', " "mode='eval'),\n" @@ -1487,43 +1486,63 @@ msgid "" " iter=Name(id='soc', ctx=Load()),\n" " is_async=1)]))" msgstr "" -">>> print(ast.dump(ast.parse('[x for x in numbers]', mode='eval'), " -"indent=4))\n" +">>> print(ast.dump(ast.parse('[ord(c) for line in file for c in line]', " +"mode='eval'),\n" +"... indent=4)) # Multiple comprehensions in one.\n" "Expression(\n" " body=ListComp(\n" -" elt=Name(id='x', ctx=Load()),\n" +" elt=Call(\n" +" func=Name(id='ord', ctx=Load()),\n" +" args=[\n" +" Name(id='c', ctx=Load())]),\n" " generators=[\n" " comprehension(\n" -" target=Name(id='x', ctx=Store()),\n" -" iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" +" target=Name(id='line', ctx=Store()),\n" +" iter=Name(id='file', ctx=Load()),\n" +" is_async=0),\n" +" comprehension(\n" +" target=Name(id='c', ctx=Store()),\n" +" iter=Name(id='line', ctx=Load()),\n" " is_async=0)]))\n" -">>> print(ast.dump(ast.parse('{x: x**2 for x in numbers}', mode='eval'), " -"indent=4))\n" +"\n" +">>> print(ast.dump(ast.parse('(n**2 for n in it if n>5 if n<10)', " +"mode='eval'),\n" +"... indent=4)) # generator comprehension\n" "Expression(\n" -" body=DictComp(\n" -" key=Name(id='x', ctx=Load()),\n" -" value=BinOp(\n" -" left=Name(id='x', ctx=Load()),\n" +" body=GeneratorExp(\n" +" elt=BinOp(\n" +" left=Name(id='n', ctx=Load()),\n" " op=Pow(),\n" " right=Constant(value=2)),\n" " generators=[\n" " comprehension(\n" -" target=Name(id='x', ctx=Store()),\n" -" iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" +" target=Name(id='n', ctx=Store()),\n" +" iter=Name(id='it', ctx=Load()),\n" +" ifs=[\n" +" Compare(\n" +" left=Name(id='n', ctx=Load()),\n" +" ops=[\n" +" Gt()],\n" +" comparators=[\n" +" Constant(value=5)]),\n" +" Compare(\n" +" left=Name(id='n', ctx=Load()),\n" +" ops=[\n" +" Lt()],\n" +" comparators=[\n" +" Constant(value=10)])],\n" " is_async=0)]))\n" -">>> print(ast.dump(ast.parse('{x for x in numbers}', mode='eval'), " -"indent=4))\n" +"\n" +">>> print(ast.dump(ast.parse('[i async for i in soc]', mode='eval'),\n" +"... indent=4)) # Async comprehension\n" "Expression(\n" -" body=SetComp(\n" -" elt=Name(id='x', ctx=Load()),\n" +" body=ListComp(\n" +" elt=Name(id='i', ctx=Load()),\n" " generators=[\n" " comprehension(\n" -" target=Name(id='x', ctx=Store()),\n" -" iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" -" is_async=0)]))" +" target=Name(id='i', ctx=Store()),\n" +" iter=Name(id='soc', ctx=Load()),\n" +" is_async=1)]))" #: ../../library/ast.rst:851 msgid "Statements" @@ -1551,7 +1570,6 @@ msgid "" msgstr "``type_comment`` 是一個可選字串,其中的註解為型別註釋。" #: ../../library/ast.rst:865 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('a = b = 1'), indent=4)) # Multiple assignment\n" "Module(\n" @@ -1574,7 +1592,16 @@ msgid "" " ctx=Store())],\n" " value=Name(id='c', ctx=Load()))])" msgstr "" -">>> print(ast.dump(ast.parse('a, *b = it'), indent=4))\n" +">>> print(ast.dump(ast.parse('a = b = 1'), indent=4)) # Multiple assignment\n" +"Module(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Name(id='a', ctx=Store()),\n" +" Name(id='b', ctx=Store())],\n" +" value=Constant(value=1))])\n" +"\n" +">>> print(ast.dump(ast.parse('a,b = c'), indent=4)) # Unpacking\n" "Module(\n" " body=[\n" " Assign(\n" @@ -1582,12 +1609,9 @@ msgstr "" " Tuple(\n" " elts=[\n" " Name(id='a', ctx=Store()),\n" -" Starred(\n" -" value=Name(id='b', ctx=Store()),\n" -" ctx=Store())],\n" +" Name(id='b', ctx=Store())],\n" " ctx=Store())],\n" -" value=Name(id='it', ctx=Load()))],\n" -" type_ignores=[])" +" value=Name(id='c', ctx=Load()))])" #: ../../library/ast.rst:891 msgid "" @@ -1614,7 +1638,6 @@ msgstr "" "中。" #: ../../library/ast.rst:902 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('c: int'), indent=4))\n" "Module(\n" @@ -1657,43 +1680,46 @@ msgid "" " annotation=Name(id='int', ctx=Load()),\n" " simple=0)])" msgstr "" -">>> print(ast.dump(ast.parse('[x for x in numbers]', mode='eval'), " -"indent=4))\n" -"Expression(\n" -" body=ListComp(\n" -" elt=Name(id='x', ctx=Load()),\n" -" generators=[\n" -" comprehension(\n" -" target=Name(id='x', ctx=Store()),\n" -" iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" -" is_async=0)]))\n" -">>> print(ast.dump(ast.parse('{x: x**2 for x in numbers}', mode='eval'), " -"indent=4))\n" -"Expression(\n" -" body=DictComp(\n" -" key=Name(id='x', ctx=Load()),\n" -" value=BinOp(\n" -" left=Name(id='x', ctx=Load()),\n" -" op=Pow(),\n" -" right=Constant(value=2)),\n" -" generators=[\n" -" comprehension(\n" -" target=Name(id='x', ctx=Store()),\n" -" iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" -" is_async=0)]))\n" -">>> print(ast.dump(ast.parse('{x for x in numbers}', mode='eval'), " -"indent=4))\n" -"Expression(\n" -" body=SetComp(\n" -" elt=Name(id='x', ctx=Load()),\n" -" generators=[\n" -" comprehension(\n" -" target=Name(id='x', ctx=Store()),\n" -" iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" -" is_async=0)]))" +">>> print(ast.dump(ast.parse('c: int'), indent=4))\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Name(id='c', ctx=Store()),\n" +" annotation=Name(id='int', ctx=Load()),\n" +" simple=1)])\n" +"\n" +">>> print(ast.dump(ast.parse('(a): int = 1'), indent=4)) # Annotation with " +"parenthesis\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Name(id='a', ctx=Store()),\n" +" annotation=Name(id='int', ctx=Load()),\n" +" value=Constant(value=1),\n" +" simple=0)])\n" +"\n" +">>> print(ast.dump(ast.parse('a.b: int'), indent=4)) # Attribute annotation\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Attribute(\n" +" value=Name(id='a', ctx=Load()),\n" +" attr='b',\n" +" ctx=Store()),\n" +" annotation=Name(id='int', ctx=Load()),\n" +" simple=0)])\n" +"\n" +">>> print(ast.dump(ast.parse('a[1]: int'), indent=4)) # Subscript " +"annotation\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Subscript(\n" +" value=Name(id='a', ctx=Load()),\n" +" slice=Constant(value=1),\n" +" ctx=Store()),\n" +" annotation=Name(id='int', ctx=Load()),\n" +" simple=0)])" #: ../../library/ast.rst:946 msgid "" @@ -1715,7 +1741,6 @@ msgstr "" "class:`List` 類別。" #: ../../library/ast.rst:954 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('x += 2'), indent=4))\n" "Module(\n" @@ -1731,8 +1756,7 @@ msgstr "" " AugAssign(\n" " target=Name(id='x', ctx=Store()),\n" " op=Add(),\n" -" value=Constant(value=2))],\n" -" type_ignores=[])" +" value=Constant(value=2))])" #: ../../library/ast.rst:967 msgid "" @@ -1745,7 +1769,6 @@ msgstr "" "from y`` 中的可選部分 ``y``。" #: ../../library/ast.rst:971 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('raise x from y'), indent=4))\n" "Module(\n" @@ -1759,8 +1782,7 @@ msgstr "" " body=[\n" " Raise(\n" " exc=Name(id='x', ctx=Load()),\n" -" cause=Name(id='y', ctx=Load()))],\n" -" type_ignores=[])" +" cause=Name(id='y', ctx=Load()))])" #: ../../library/ast.rst:983 msgid "" @@ -1771,7 +1793,6 @@ msgstr "" "保存失敗訊息。" #: ../../library/ast.rst:986 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('assert x,y'), indent=4))\n" "Module(\n" @@ -1785,8 +1806,7 @@ msgstr "" " body=[\n" " Assert(\n" " test=Name(id='x', ctx=Load()),\n" -" msg=Name(id='y', ctx=Load()))],\n" -" type_ignores=[])" +" msg=Name(id='y', ctx=Load()))])" #: ../../library/ast.rst:998 msgid "" @@ -1797,7 +1817,6 @@ msgstr "" "`Attribute` 或 :class:`Subscript` 節點。" #: ../../library/ast.rst:1001 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('del x,y,z'), indent=4))\n" "Module(\n" @@ -1815,15 +1834,13 @@ msgstr "" " targets=[\n" " Name(id='x', ctx=Del()),\n" " Name(id='y', ctx=Del()),\n" -" Name(id='z', ctx=Del())])],\n" -" type_ignores=[])" +" Name(id='z', ctx=Del())])])" #: ../../library/ast.rst:1015 msgid "A ``pass`` statement." msgstr "一個 ``pass`` 陳述式。" #: ../../library/ast.rst:1017 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('pass'), indent=4))\n" "Module(\n" @@ -1833,8 +1850,7 @@ msgstr "" ">>> print(ast.dump(ast.parse('pass'), indent=4))\n" "Module(\n" " body=[\n" -" Pass()],\n" -" type_ignores=[])" +" Pass()])" #: ../../library/ast.rst:1027 msgid "" @@ -1848,7 +1864,6 @@ msgstr "" "parameter) <ast-type-params>` 的串列、``value`` 是型別別名的值。" #: ../../library/ast.rst:1032 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('type Alias = int'), indent=4))\n" "Module(\n" @@ -1862,9 +1877,7 @@ msgstr "" " body=[\n" " TypeAlias(\n" " name=Name(id='Alias', ctx=Store()),\n" -" type_params=[],\n" -" value=Name(id='int', ctx=Load()))],\n" -" type_ignores=[])" +" value=Name(id='int', ctx=Load()))])" #: ../../library/ast.rst:1043 msgid "" @@ -1881,7 +1894,6 @@ msgid "An import statement. ``names`` is a list of :class:`alias` nodes." msgstr "一個 import 陳述式。``names`` 是 :class:`alias` 節點的串列。" #: ../../library/ast.rst:1053 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('import x,y,z'), indent=4))\n" "Module(\n" @@ -1899,8 +1911,7 @@ msgstr "" " names=[\n" " alias(name='x'),\n" " alias(name='y'),\n" -" alias(name='z')])],\n" -" type_ignores=[])" +" alias(name='z')])])" #: ../../library/ast.rst:1067 msgid "" @@ -1914,7 +1925,6 @@ msgstr "" "``level`` 是一個整數,保存相對引入的級別(0 表示絕對引入)。" #: ../../library/ast.rst:1072 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('from y import x,y,z'), indent=4))\n" "Module(\n" @@ -1936,8 +1946,7 @@ msgstr "" " alias(name='x'),\n" " alias(name='y'),\n" " alias(name='z')],\n" -" level=0)],\n" -" type_ignores=[])" +" level=0)])" #: ../../library/ast.rst:1088 msgid "" @@ -1948,7 +1957,6 @@ msgstr "" "``None``。" #: ../../library/ast.rst:1091 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('from ..foo.bar import a as b, c'), indent=4))\n" "Module(\n" @@ -1968,8 +1976,7 @@ msgstr "" " names=[\n" " alias(name='a', asname='b'),\n" " alias(name='c')],\n" -" level=2)],\n" -" type_ignores=[])" +" level=2)])" #: ../../library/ast.rst:1104 msgid "Control flow" @@ -1999,7 +2006,6 @@ msgstr "" "額外的 :class:`If` 節點出現。" #: ../../library/ast.rst:1119 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... if x:\n" @@ -2049,8 +2055,7 @@ msgstr "" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" #: ../../library/ast.rst:1149 msgid "" @@ -2068,7 +2073,6 @@ msgstr "" "``break`` 陳述式執行。" #: ../../library/ast.rst:1160 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... for x in y:\n" @@ -2104,8 +2108,7 @@ msgstr "" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])" #: ../../library/ast.rst:1183 msgid "" @@ -2114,7 +2117,6 @@ msgid "" msgstr "一個 ``while`` 迴圈。``test`` 保存條件,例如 :class:`Compare` 節點。" #: ../../library/ast.rst:1186 -#, fuzzy msgid "" ">> print(ast.dump(ast.parse(\"\"\"\n" "... while x:\n" @@ -2148,15 +2150,13 @@ msgstr "" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])" #: ../../library/ast.rst:1209 msgid "The ``break`` and ``continue`` statements." msgstr "``break`` 和 ``continue`` 陳述式。" #: ../../library/ast.rst:1211 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... for a in b:\n" @@ -2208,9 +2208,7 @@ msgstr "" " body=[\n" " Break()],\n" " orelse=[\n" -" Continue()])],\n" -" orelse=[])],\n" -" type_ignores=[])" +" Continue()])])])" #: ../../library/ast.rst:1242 msgid "" @@ -2221,7 +2219,6 @@ msgstr "" "有屬性都是要執行之節點的串列。" #: ../../library/ast.rst:1245 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -2295,8 +2292,7 @@ msgstr "" " value=Constant(value=Ellipsis))],\n" " finalbody=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])" #: ../../library/ast.rst:1287 msgid "" @@ -2309,7 +2305,6 @@ msgstr "" "``except*`` 區塊而不是 ``except``。" #: ../../library/ast.rst:1291 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -2347,10 +2342,7 @@ msgstr "" " type=Name(id='Exception', ctx=Load()),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])],\n" -" orelse=[],\n" -" finalbody=[])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" #: ../../library/ast.rst:1316 msgid "" @@ -2365,7 +2357,6 @@ msgstr "" "``None``。``body`` 是節點串列。" #: ../../library/ast.rst:1321 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... try:\n" @@ -2407,10 +2398,7 @@ msgstr "" " ExceptHandler(\n" " type=Name(id='TypeError', ctx=Load()),\n" " body=[\n" -" Pass()])],\n" -" orelse=[],\n" -" finalbody=[])],\n" -" type_ignores=[])" +" Pass()])])])" #: ../../library/ast.rst:1347 msgid "" @@ -2433,7 +2421,6 @@ msgstr "" "class:`Tuple` 或 :class:`List`,或者如果不使用則為 ``None`` 。" #: ../../library/ast.rst:1362 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... with a as b, c as d:\n" @@ -2477,9 +2464,7 @@ msgstr "" " func=Name(id='something', ctx=Load()),\n" " args=[\n" " Name(id='b', ctx=Load()),\n" -" Name(id='d', ctx=Load())],\n" -" keywords=[]))])],\n" -" type_ignores=[])" +" Name(id='d', ctx=Load())]))])])" #: ../../library/ast.rst:1388 msgid "Pattern matching" @@ -2520,7 +2505,6 @@ msgstr "" "求值 (evaluate) 結果為真,則會執行該節點串列。" #: ../../library/ast.rst:1412 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2581,14 +2565,10 @@ msgstr "" " value=Constant(value=Ellipsis))]),\n" " match_case(\n" " pattern=MatchClass(\n" -" cls=Name(id='tuple', ctx=Load()),\n" -" patterns=[],\n" -" kwd_attrs=[],\n" -" kwd_patterns=[]),\n" +" cls=Name(id='tuple', ctx=Load())),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" #: ../../library/ast.rst:1450 msgid "" @@ -2601,7 +2581,6 @@ msgstr "" "受到匹配陳述式文件中所述的限制。如果匹配主題等於求出值,則此模式成功。" #: ../../library/ast.rst:1455 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2635,8 +2614,7 @@ msgstr "" " value=Constant(value='Relevant')),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" #: ../../library/ast.rst:1478 msgid "" @@ -2649,7 +2627,6 @@ msgstr "" "則此模式成功。" #: ../../library/ast.rst:1482 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2681,8 +2658,7 @@ msgstr "" " pattern=MatchSingleton(value=None),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" #: ../../library/ast.rst:1504 msgid "" @@ -2695,7 +2671,6 @@ msgstr "" "子模式之一是 ``MatchStar`` 節點,則匹配可變長度序列,否則匹配固定長度序列。" #: ../../library/ast.rst:1509 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2737,8 +2712,7 @@ msgstr "" " value=Constant(value=2))]),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" #: ../../library/ast.rst:1536 msgid "" @@ -2751,7 +2725,6 @@ msgstr "" "整體序列模式成功,則包含其餘序列元素的串列將綁定到該名稱。" #: ../../library/ast.rst:1540 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2813,8 +2786,7 @@ msgstr "" " MatchStar()]),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" #: ../../library/ast.rst:1577 msgid "" @@ -2841,7 +2813,6 @@ msgstr "" "成功,則包含其餘對映元素的字典將綁定到該名稱。" #: ../../library/ast.rst:1589 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2896,12 +2867,10 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))]),\n" " match_case(\n" -" pattern=MatchMapping(keys=[], patterns=[], " -"rest='rest'),\n" +" pattern=MatchMapping(rest='rest'),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" #: ../../library/ast.rst:1624 msgid "" @@ -2937,7 +2906,6 @@ msgstr "" "實例進行匹配。一些內建型別也以這種方式匹配,如同匹配陳述式文件中所述。" #: ../../library/ast.rst:1639 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2999,16 +2967,13 @@ msgstr "" " MatchValue(\n" " value=Constant(value=0)),\n" " MatchValue(\n" -" value=Constant(value=0))],\n" -" kwd_attrs=[],\n" -" kwd_patterns=[]),\n" +" value=Constant(value=0))]),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))]),\n" " match_case(\n" " pattern=MatchClass(\n" " cls=Name(id='Point3D', ctx=Load()),\n" -" patterns=[],\n" " kwd_attrs=[\n" " 'x',\n" " 'y',\n" @@ -3022,8 +2987,7 @@ msgstr "" " value=Constant(value=0))]),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" #: ../../library/ast.rst:1686 msgid "" @@ -3046,7 +3010,6 @@ msgstr "" "``pattern`` 也必須為 ``None``,並且節點代表通配模式。" #: ../../library/ast.rst:1695 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -3100,8 +3063,7 @@ msgstr "" " pattern=MatchAs(),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" #: ../../library/ast.rst:1728 msgid "" @@ -3116,7 +3078,6 @@ msgstr "" "式將失敗。 ``patterns`` 屬性包含將與主題進行匹配的匹配模式節點串列。" #: ../../library/ast.rst:1734 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -3158,8 +3119,7 @@ msgstr "" " MatchAs(name='y')]),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" #: ../../library/ast.rst:1762 msgid "Type parameters" @@ -3172,7 +3132,6 @@ msgid "" msgstr ":ref:`型別參數 <type-params>`\\ 可以存在於類別、函式和型別別名上。" #: ../../library/ast.rst:1769 -#, fuzzy msgid "" "A :class:`typing.TypeVar`. *name* is the name of the type variable. *bound* " "is the bound or constraints, if any. If *bound* is a :class:`Tuple`, it " @@ -3180,12 +3139,12 @@ msgid "" "is the default value; if the :class:`!TypeVar` has no default, this " "attribute will be set to ``None``." msgstr "" -"一個 :class:`typing.TypeVar`。``name`` 是型別變數的名稱。``bound`` 是(如果有" -"存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一個 :class:" -"`Tuple`,它代表約束;否則它代表界限。" +"一個 :class:`typing.TypeVar`。*name* 是型別變數的名稱。*bound* 是(如果有存在" +"的)界限 (bound) 或約束 (constraint)。如果 *bound* 是一個 :class:`Tuple`,它" +"代表約束;否則它代表界限。*default_value* 為預設值;如果 :class:`!TypeVar` 沒" +"有預設值,那此屬性會被設為 ``None``。" #: ../../library/ast.rst:1775 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[T: int = bool] = list[T]\"), " "indent=4))\n" @@ -3203,7 +3162,8 @@ msgid "" " slice=Name(id='T', ctx=Load()),\n" " ctx=Load()))])" msgstr "" -">>> print(ast.dump(ast.parse(\"type Alias[T: int] = list[T]\"), indent=4))\n" +">>> print(ast.dump(ast.parse(\"type Alias[T: int = bool] = list[T]\"), " +"indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" @@ -3211,18 +3171,17 @@ msgstr "" " type_params=[\n" " TypeVar(\n" " name='T',\n" -" bound=Name(id='int', ctx=Load()))],\n" +" bound=Name(id='int', ctx=Load()),\n" +" default_value=Name(id='bool', ctx=Load()))],\n" " value=Subscript(\n" " value=Name(id='list', ctx=Load()),\n" " slice=Name(id='T', ctx=Load()),\n" -" ctx=Load()))],\n" -" type_ignores=[])" +" ctx=Load()))])" #: ../../library/ast.rst:1794 ../../library/ast.rst:1829 #: ../../library/ast.rst:1861 -#, fuzzy msgid "Added the *default_value* parameter." -msgstr "新增 *indent* 選項。" +msgstr "新增 *default_value* 參數。" #: ../../library/ast.rst:1799 msgid "" @@ -3230,9 +3189,10 @@ msgid "" "specification. *default_value* is the default value; if the :class:`!" "ParamSpec` has no default, this attribute will be set to ``None``." msgstr "" +"一個 :class:`typing.ParamSpec`。*name* 是參數規範的名稱。*default_value* 是預" +"設值;如果 :class:`!ParamSpec` 沒有預設值,則該屬性將設定為 ``None``。" #: ../../library/ast.rst:1803 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[**P = (int, str)] = Callable[P, " "int]\"), indent=4))\n" @@ -3257,14 +3217,20 @@ msgid "" " ctx=Load()),\n" " ctx=Load()))])" msgstr "" -">>> print(ast.dump(ast.parse(\"type Alias[**P] = Callable[P, int]\"), " -"indent=4))\n" +">>> print(ast.dump(ast.parse(\"type Alias[**P = (int, str)] = Callable[P, " +"int]\"), indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" " name=Name(id='Alias', ctx=Store()),\n" " type_params=[\n" -" ParamSpec(name='P')],\n" +" ParamSpec(\n" +" name='P',\n" +" default_value=Tuple(\n" +" elts=[\n" +" Name(id='int', ctx=Load()),\n" +" Name(id='str', ctx=Load())],\n" +" ctx=Load()))],\n" " value=Subscript(\n" " value=Name(id='Callable', ctx=Load()),\n" " slice=Tuple(\n" @@ -3272,22 +3238,19 @@ msgstr "" " Name(id='P', ctx=Load()),\n" " Name(id='int', ctx=Load())],\n" " ctx=Load()),\n" -" ctx=Load()))],\n" -" type_ignores=[])" +" ctx=Load()))])" #: ../../library/ast.rst:1834 -#, fuzzy msgid "" "A :class:`typing.TypeVarTuple`. *name* is the name of the type variable " "tuple. *default_value* is the default value; if the :class:`!TypeVarTuple` " "has no default, this attribute will be set to ``None``." msgstr "" -"一個 :class:`typing.TypeVar`。``name`` 是型別變數的名稱。``bound`` 是(如果有" -"存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一個 :class:" -"`Tuple`,它代表約束;否則它代表界限。" +"一個 :class:`typing.TypeVarTuple`。*name* 是型別變數元組的名稱。" +"*default_value* 為預設值;如果 :class:`!TypeVarTuple` 沒有預設值,那此屬性會" +"被設為 ``None``。" #: ../../library/ast.rst:1838 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[*Ts = ()] = tuple[*Ts]\"), " "indent=4))\n" @@ -3309,13 +3272,16 @@ msgid "" " ctx=Load()),\n" " ctx=Load()))])" msgstr "" -">>> print(ast.dump(ast.parse(\"type Alias[*Ts] = tuple[*Ts]\"), indent=4))\n" +">>> print(ast.dump(ast.parse(\"type Alias[*Ts = ()] = tuple[*Ts]\"), " +"indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" " name=Name(id='Alias', ctx=Store()),\n" " type_params=[\n" -" TypeVarTuple(name='Ts')],\n" +" TypeVarTuple(\n" +" name='Ts',\n" +" default_value=Tuple(ctx=Load()))],\n" " value=Subscript(\n" " value=Name(id='tuple', ctx=Load()),\n" " slice=Tuple(\n" @@ -3324,8 +3290,7 @@ msgstr "" " value=Name(id='Ts', ctx=Load()),\n" " ctx=Load())],\n" " ctx=Load()),\n" -" ctx=Load()))],\n" -" type_ignores=[])" +" ctx=Load()))])" #: ../../library/ast.rst:1865 msgid "Function and class definitions" @@ -3359,12 +3324,12 @@ msgstr "" msgid "``returns`` is the return annotation." msgstr "``returns`` 是回傳註釋。" -#: ../../library/ast.rst:1877 ../../library/ast.rst:2041 +#: ../../library/ast.rst:1877 ../../library/ast.rst:2040 msgid "``type_params`` is a list of :ref:`type parameters <ast-type-params>`." msgstr "``type_params`` 是\\ :ref:`型別參數 <ast-type-params>`\\ 的串列。" -#: ../../library/ast.rst:1883 ../../library/ast.rst:2068 -#: ../../library/ast.rst:2079 +#: ../../library/ast.rst:1883 ../../library/ast.rst:2067 +#: ../../library/ast.rst:2078 msgid "Added ``type_params``." msgstr "新增了 ``type_params``。" @@ -3377,7 +3342,6 @@ msgstr "" "``body`` 保存單個節點。" #: ../../library/ast.rst:1892 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\n" "Module(\n" @@ -3396,15 +3360,10 @@ msgstr "" " Expr(\n" " value=Lambda(\n" " args=arguments(\n" -" posonlyargs=[],\n" " args=[\n" " arg(arg='x'),\n" -" arg(arg='y')],\n" -" kwonlyargs=[],\n" -" kw_defaults=[],\n" -" defaults=[]),\n" -" body=Constant(value=Ellipsis)))],\n" -" type_ignores=[])" +" arg(arg='y')]),\n" +" body=Constant(value=Ellipsis)))])" #: ../../library/ast.rst:1908 msgid "The arguments for a function." @@ -3455,7 +3414,6 @@ msgid "" msgstr "``type_comment`` 是一個可選字串,其註解為型別註釋" #: ../../library/ast.rst:1929 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3505,7 +3463,6 @@ msgstr "" " FunctionDef(\n" " name='f',\n" " args=arguments(\n" -" posonlyargs=[],\n" " args=[\n" " arg(\n" " arg='a',\n" @@ -3528,16 +3485,13 @@ msgstr "" " decorator_list=[\n" " Name(id='decorator1', ctx=Load()),\n" " Name(id='decorator2', ctx=Load())],\n" -" returns=Constant(value='return annotation'),\n" -" type_params=[])],\n" -" type_ignores=[])" +" returns=Constant(value='return annotation'))])" #: ../../library/ast.rst:1969 msgid "A ``return`` statement." msgstr "一個 ``return`` 陳述式。" #: ../../library/ast.rst:1971 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('return 4'), indent=4))\n" "Module(\n" @@ -3549,8 +3503,7 @@ msgstr "" "Module(\n" " body=[\n" " Return(\n" -" value=Constant(value=4))],\n" -" type_ignores=[])" +" value=Constant(value=4))])" #: ../../library/ast.rst:1983 msgid "" @@ -3562,7 +3515,6 @@ msgstr "" "回來的值,則必須將它們包裝在 :class:`Expr` 節點中。" #: ../../library/ast.rst:1986 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('yield x'), indent=4))\n" "Module(\n" @@ -3583,16 +3535,14 @@ msgstr "" " body=[\n" " Expr(\n" " value=Yield(\n" -" value=Name(id='x', ctx=Load())))],\n" -" type_ignores=[])\n" +" value=Name(id='x', ctx=Load())))])\n" "\n" ">>> print(ast.dump(ast.parse('yield from x'), indent=4))\n" "Module(\n" " body=[\n" " Expr(\n" " value=YieldFrom(\n" -" value=Name(id='x', ctx=Load())))],\n" -" type_ignores=[])" +" value=Name(id='x', ctx=Load())))])" #: ../../library/ast.rst:2006 msgid "" @@ -3600,7 +3550,6 @@ msgid "" msgstr "``global`` 和 ``nonlocal`` 陳述式。``names`` 是原始字串的串列。" #: ../../library/ast.rst:2008 -#, fuzzy msgid "" ">>> print(ast.dump(ast.parse('global x,y,z'), indent=4))\n" "Module(\n" @@ -3627,8 +3576,7 @@ msgstr "" " names=[\n" " 'x',\n" " 'y',\n" -" 'z'])],\n" -" type_ignores=[])\n" +" 'z'])])\n" "\n" ">>> print(ast.dump(ast.parse('nonlocal x,y,z'), indent=4))\n" "Module(\n" @@ -3637,8 +3585,7 @@ msgstr "" " names=[\n" " 'x',\n" " 'y',\n" -" 'z'])],\n" -" type_ignores=[])" +" 'z'])])" #: ../../library/ast.rst:2031 msgid "A class definition." @@ -3653,27 +3600,25 @@ msgid "``bases`` is a list of nodes for explicitly specified base classes." msgstr "``bases`` 是被顯式指定的基底類別節點串列。" #: ../../library/ast.rst:2035 -#, fuzzy msgid "" "``keywords`` is a list of :class:`.keyword` nodes, principally for " -"'metaclass'. Other keywords will be passed to the metaclass, as per " -"`PEP-3115 <https://peps.python.org/pep-3115/>`_." +"'metaclass'. Other keywords will be passed to the metaclass, as per :pep:" +"`3115`." msgstr "" "``keywords`` 是一個 :class:`.keyword` 節點的串列,主要用於 'metaclass'(元類" "別)。如 :pep:`3115` 所述,其他關鍵字將被傳遞到 metaclass。" -#: ../../library/ast.rst:2038 +#: ../../library/ast.rst:2037 msgid "" "``body`` is a list of nodes representing the code within the class " "definition." msgstr "``body`` 是表示類別定義中程式碼的節點串列。" -#: ../../library/ast.rst:2040 +#: ../../library/ast.rst:2039 msgid "``decorator_list`` is a list of nodes, as in :class:`FunctionDef`." msgstr "``decorator_list`` 是一個節點串列,如 :class:`FunctionDef` 中所示。" -#: ../../library/ast.rst:2043 -#, fuzzy +#: ../../library/ast.rst:2042 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3719,21 +3664,19 @@ msgstr "" " Pass()],\n" " decorator_list=[\n" " Name(id='decorator1', ctx=Load()),\n" -" Name(id='decorator2', ctx=Load())],\n" -" type_params=[])],\n" -" type_ignores=[])" +" Name(id='decorator2', ctx=Load())])])" -#: ../../library/ast.rst:2072 +#: ../../library/ast.rst:2071 msgid "Async and await" msgstr "async 和 await" -#: ../../library/ast.rst:2076 +#: ../../library/ast.rst:2075 msgid "" "An ``async def`` function definition. Has the same fields as :class:" "`FunctionDef`." msgstr "一個 ``async def`` 函式定義。與 :class:`FunctionDef` 具有相同的欄位。" -#: ../../library/ast.rst:2085 +#: ../../library/ast.rst:2084 msgid "" "An ``await`` expression. ``value`` is what it waits for. Only valid in the " "body of an :class:`AsyncFunctionDef`." @@ -3741,8 +3684,7 @@ msgstr "" "一個 ``await`` 運算式。``value`` 是它等待的東西。僅在 :class:" "`AsyncFunctionDef` 主體 (body) 中有效。" -#: ../../library/ast.rst:2088 -#, fuzzy +#: ../../library/ast.rst:2087 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -3767,24 +3709,14 @@ msgstr "" " body=[\n" " AsyncFunctionDef(\n" " name='f',\n" -" args=arguments(\n" -" posonlyargs=[],\n" -" args=[],\n" -" kwonlyargs=[],\n" -" kw_defaults=[],\n" -" defaults=[]),\n" +" args=arguments(),\n" " body=[\n" " Expr(\n" " value=Await(\n" " value=Call(\n" -" func=Name(id='other_func', ctx=Load()),\n" -" args=[],\n" -" keywords=[])))],\n" -" decorator_list=[],\n" -" type_params=[])],\n" -" type_ignores=[])" +" func=Name(id='other_func', ctx=Load()))))])])" -#: ../../library/ast.rst:2109 +#: ../../library/ast.rst:2108 msgid "" "``async for`` loops and ``async with`` context managers. They have the same " "fields as :class:`For` and :class:`With`, respectively. Only valid in the " @@ -3793,7 +3725,7 @@ msgstr "" "``async for`` 迴圈和 ``async with`` 情境管理器。它們分別具有與 :class:`For` " "和 :class:`With` 相同的欄位。僅在 :class:`AsyncFunctionDef` 主體中有效。" -#: ../../library/ast.rst:2114 +#: ../../library/ast.rst:2113 msgid "" "When a string is parsed by :func:`ast.parse`, operator nodes (subclasses of :" "class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast." @@ -3806,11 +3738,11 @@ msgstr "" "boolop` 和 :class:`ast.expr_context`\\ )將是單例。對其中之一的更改將反映在所" "有其他出現的相同值中(例如 :class:`ast.Add`\\ )。" -#: ../../library/ast.rst:2122 +#: ../../library/ast.rst:2121 msgid ":mod:`ast` Helpers" msgstr ":mod:`ast` 輔助程式" -#: ../../library/ast.rst:2124 +#: ../../library/ast.rst:2123 msgid "" "Apart from the node classes, the :mod:`ast` module defines these utility " "functions and classes for traversing abstract syntax trees:" @@ -3818,18 +3750,18 @@ msgstr "" "除了節點類別之外,:mod:`ast` 模組還定義了這些用於遍歷 (traverse) 抽象語法樹的" "實用函式和類別:" -#: ../../library/ast.rst:2129 -#, fuzzy +#: ../../library/ast.rst:2128 msgid "" "Parse the source into an AST node. Equivalent to ``compile(source, " "filename, mode, flags=FLAGS_VALUE, optimize=optimize)``, where " "``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and ``ast." "PyCF_OPTIMIZED_AST`` otherwise." msgstr "" -"將原始碼剖析為 AST 節點。相當於 ``compile(source, filename, mode, ast." -"PyCF_ONLY_AST)``。" +"將原始碼剖析為 AST 節點,相當於 ``compile(source, filename, mode, " +"flags=FLAGS_VALUE, optimize=optimize)``,其中 ``FLAGS_VALUE`` 在 ``optimize " +"<= 0`` 時為 ``ast.PyCF_ONLY_AST``,否則為 ``ast.PyCF_OPTIMIZED_AST``。" -#: ../../library/ast.rst:2134 +#: ../../library/ast.rst:2133 msgid "" "If ``type_comments=True`` is given, the parser is modified to check and " "return type comments as specified by :pep:`484` and :pep:`526`. This is " @@ -3848,7 +3780,7 @@ msgstr "" "``None``。此外,``# type: ignore`` 註釋的位置將作為 :class:`Module` 的 " "``type_ignores`` 屬性回傳(否則它始終是一個空串列)。" -#: ../../library/ast.rst:2144 +#: ../../library/ast.rst:2143 msgid "" "In addition, if ``mode`` is ``'func_type'``, the input syntax is modified to " "correspond to :pep:`484` \"signature type comments\", e.g. ``(str, int) -> " @@ -3858,8 +3790,7 @@ msgstr "" "名型別註解 (signature type comments)」而被修改,例如 ``(str, int) -> " "List[str]``。" -#: ../../library/ast.rst:2148 -#, fuzzy +#: ../../library/ast.rst:2147 msgid "" "Setting ``feature_version`` to a tuple ``(major, minor)`` will result in a " "\"best-effort\" attempt to parse using that Python version's grammar. For " @@ -3873,18 +3804,18 @@ msgid "" msgstr "" "將 ``feature_version`` 設定為元組 ``(major, minor)`` 將「盡可能」嘗試使用該 " "Python 版本的文法進行剖析。當前 ``major`` 必須等於 ``3``。例如,設定 " -"``feature_version=(3, 4)`` 將嘗試禁止剖析 :keyword:`match` 陳述式。目前 " -"``major`` 必須為 ``3``、支援的最低版本為 ``(3, 4)``\\ (這在未來的 Python 版" +"``feature_version=(3, 9)`` 將嘗試禁止剖析 :keyword:`match` 陳述式。目前 " +"``major`` 必須為 ``3``、支援的最低版本為 ``(3, 7)``\\ (這在未來的 Python 版" "本中可能會增加);最高的是 ``sys.version_info[0:2]``。「盡可能」嘗試意味著不" "能保證剖析(或剖析的成功)與在與 ``feature_version`` 對應的 Python 版本上運行" "時相同。" -#: ../../library/ast.rst:2158 +#: ../../library/ast.rst:2157 msgid "" "If source contains a null character (``\\0``), :exc:`ValueError` is raised." msgstr "如果來源包含 null 字元 (``\\0``),則會引發 :exc:`ValueError`。" -#: ../../library/ast.rst:2161 +#: ../../library/ast.rst:2160 msgid "" "Note that successfully parsing source code into an AST object doesn't " "guarantee that the source code provided is valid Python code that can be " @@ -3898,14 +3829,14 @@ msgstr "" "原始的 ``return 42`` 為 return 陳述式生成一個有效的 AST 節點,但它不能單獨編" "譯(它需要位於函式節點內)。" -#: ../../library/ast.rst:2168 +#: ../../library/ast.rst:2167 msgid "" "In particular, :func:`ast.parse` won't do any scoping checks, which the " "compilation step does." msgstr "" "特別是 :func:`ast.parse` 不會執行任何範圍檢查,而編譯步驟才會執行此操作。" -#: ../../library/ast.rst:2172 +#: ../../library/ast.rst:2171 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string due to stack depth limitations in Python's AST compiler." @@ -3913,17 +3844,19 @@ msgstr "" "由於 Python AST 編譯器中的堆疊 (stack) 深度限制,太大或太複雜的字串可能會導" "致 Python 直譯器崩潰。" -#: ../../library/ast.rst:2176 +#: ../../library/ast.rst:2175 msgid "Added ``type_comments``, ``mode='func_type'`` and ``feature_version``." msgstr "新增 ``type_comments``、``mode='func_type'`` 與 ``feature_version``。" -#: ../../library/ast.rst:2179 +#: ../../library/ast.rst:2178 msgid "" "The minimum supported version for ``feature_version`` is now ``(3, 7)``. The " "``optimize`` argument was added." msgstr "" +"``feature_version`` 的最低支援版本現在是 ``(3, 7)``。新增了 ``optimize`` 引" +"數。" -#: ../../library/ast.rst:2186 +#: ../../library/ast.rst:2185 msgid "" "Unparse an :class:`ast.AST` object and generate a string with code that " "would produce an equivalent :class:`ast.AST` object if parsed back with :" @@ -3932,7 +3865,7 @@ msgstr "" "反剖析 :class:`ast.AST` 物件並生成一個帶有程式碼的字串,如果使用 :func:`ast." "parse` 剖析回來,該程式碼將生成等效的 :class:`ast.AST` 物件。" -#: ../../library/ast.rst:2191 +#: ../../library/ast.rst:2190 msgid "" "The produced code string will not necessarily be equal to the original code " "that generated the :class:`ast.AST` object (without any compiler " @@ -3941,13 +3874,13 @@ msgstr "" "生成的程式碼字串不一定等於生成 :class:`ast.AST` 物件的原始程式碼(沒有任何編" "譯器最佳化,例如常數元組/凍結集合)。" -#: ../../library/ast.rst:2196 +#: ../../library/ast.rst:2195 msgid "" "Trying to unparse a highly complex expression would result with :exc:" "`RecursionError`." msgstr "嘗試剖析高度複雜的運算式會導致 :exc:`RecursionError`。" -#: ../../library/ast.rst:2204 +#: ../../library/ast.rst:2203 msgid "" "Evaluate an expression node or a string containing only a Python literal or " "container display. The string or node provided may only consist of the " @@ -3958,7 +3891,7 @@ msgstr "" "能包含以下 Python 文本結構:字串、位元組、數字、元組、串列、字典、集合、布林" "值、``None`` 和 ``Ellipsis``。" -#: ../../library/ast.rst:2209 +#: ../../library/ast.rst:2208 msgid "" "This can be used for evaluating strings containing Python values without the " "need to parse the values oneself. It is not capable of evaluating " @@ -3967,7 +3900,7 @@ msgstr "" "這可用於為包含 Python 值的字串求值,而無需自己剖析這些值。它無法計算任意複雜" "的運算式,例如涉及運算子或索引。" -#: ../../library/ast.rst:2214 +#: ../../library/ast.rst:2213 msgid "" "This function had been documented as \"safe\" in the past without defining " "what that meant. That was misleading. This is specifically designed not to " @@ -3984,13 +3917,13 @@ msgstr "" "盡或 C 堆疊耗盡,從而導致行程崩潰。某些輸入也可能會出現 CPU 消耗過多而導致拒" "絕服務的情況。因此不建議在不受信任的資料上呼叫它。" -#: ../../library/ast.rst:2224 +#: ../../library/ast.rst:2223 msgid "" "It is possible to crash the Python interpreter due to stack depth " "limitations in Python's AST compiler." msgstr "由於 Python AST 編譯器的堆疊深度限制,Python 直譯器可能會崩潰。" -#: ../../library/ast.rst:2227 +#: ../../library/ast.rst:2226 msgid "" "It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:" "`MemoryError` and :exc:`RecursionError` depending on the malformed input." @@ -3998,19 +3931,19 @@ msgstr "" "它可能會引發 :exc:`ValueError`、:exc:`TypeError`、:exc:`SyntaxError`、:exc:" "`MemoryError` 和 :exc:`RecursionError`,具體取決於格式錯誤的輸入。" -#: ../../library/ast.rst:2231 +#: ../../library/ast.rst:2230 msgid "Now allows bytes and set literals." msgstr "現在允許位元組和集合文本 (set literal)。" -#: ../../library/ast.rst:2234 +#: ../../library/ast.rst:2233 msgid "Now supports creating empty sets with ``'set()'``." msgstr "現在支援使用 ``'set()'`` 建立空集合。" -#: ../../library/ast.rst:2237 +#: ../../library/ast.rst:2236 msgid "For string inputs, leading spaces and tabs are now stripped." msgstr "對於字串輸入,前導空格和定位字元 (tab) 現在已被去除。" -#: ../../library/ast.rst:2243 +#: ../../library/ast.rst:2242 msgid "" "Return the docstring of the given *node* (which must be a :class:" "`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, or :class:" @@ -4022,11 +3955,11 @@ msgstr "" "件字串則為 ``None``。如果 *clean* 為 true,則使用 :func:`inspect.cleandoc` 清" "理文件字串的縮排。" -#: ../../library/ast.rst:2249 +#: ../../library/ast.rst:2248 msgid ":class:`AsyncFunctionDef` is now supported." msgstr "目前已支援 :class:`AsyncFunctionDef`。" -#: ../../library/ast.rst:2255 +#: ../../library/ast.rst:2254 msgid "" "Get source code segment of the *source* that generated *node*. If some " "location information (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :" @@ -4037,7 +3970,7 @@ msgstr "" "lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST.col_offset` 或 :attr:" "`~ast.AST.end_col_offset`\\ )遺漏,則回傳 ``None``。" -#: ../../library/ast.rst:2259 +#: ../../library/ast.rst:2258 msgid "" "If *padded* is ``True``, the first line of a multi-line statement will be " "padded with spaces to match its original position." @@ -4045,7 +3978,7 @@ msgstr "" "如果 *padded* 為 ``True``,則多列陳述式的第一列將用空格填充 (padded) 以匹配其" "原始位置。" -#: ../../library/ast.rst:2267 +#: ../../library/ast.rst:2266 msgid "" "When you compile a node tree with :func:`compile`, the compiler expects :" "attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes for every " @@ -4059,7 +3992,7 @@ msgstr "" "要存在。填入生成的節點相當繁瑣,因此該輔助工具透過將這些屬性設定為父節點的" "值,在尚未設定的地方遞迴地新增這些屬性。它從 *node* 開始遞迴地作用。" -#: ../../library/ast.rst:2276 +#: ../../library/ast.rst:2275 msgid "" "Increment the line number and end line number of each node in the tree " "starting at *node* by *n*. This is useful to \"move code\" to a different " @@ -4068,7 +4001,7 @@ msgstr "" "將樹中從 *node* 開始的每個節點的列號和結束列號增加 *n*。這對於「移動程式碼」" "到檔案中的不同位置很有用。" -#: ../../library/ast.rst:2283 +#: ../../library/ast.rst:2282 msgid "" "Copy source location (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :" "attr:`~ast.AST.end_lineno`, and :attr:`~ast.AST.end_col_offset`) from " @@ -4078,7 +4011,7 @@ msgstr "" "attr:`~ast.AST.end_lineno` 和 :attr:`~ast.AST.end_col_offset` )從 " "*old_node* 複製到 *new_node*,並回傳 *new_node* 。" -#: ../../library/ast.rst:2290 +#: ../../library/ast.rst:2289 msgid "" "Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` " "that is present on *node*." @@ -4086,7 +4019,7 @@ msgstr "" "為 *node* 上存在的 ``node._fields`` 中的每個欄位生成一個 ``(fieldname, " "value)`` 元組。" -#: ../../library/ast.rst:2296 +#: ../../library/ast.rst:2295 msgid "" "Yield all direct child nodes of *node*, that is, all fields that are nodes " "and all items of fields that are lists of nodes." @@ -4094,7 +4027,7 @@ msgstr "" "生成 *node* 的所有直接子節點,即作為節點的所有欄位以及作為節點串列欄位的所有" "項目。" -#: ../../library/ast.rst:2302 +#: ../../library/ast.rst:2301 msgid "" "Recursively yield all descendant nodes in the tree starting at *node* " "(including *node* itself), in no specified order. This is useful if you " @@ -4103,7 +4036,7 @@ msgstr "" "遞迴地生成樹中從 *node* 開始的所有後代節點(包括 *node* 本身),不按指定順" "序。如果你只想就地修改節點而不關心情境,這非常有用。" -#: ../../library/ast.rst:2309 +#: ../../library/ast.rst:2308 msgid "" "A node visitor base class that walks the abstract syntax tree and calls a " "visitor function for every node found. This function may return a value " @@ -4112,13 +4045,13 @@ msgstr "" "節點訪問者基底類別,它遍歷抽象語法樹並為找到的每個節點呼叫訪問者函式。該函式" "可能會回傳一個由 :meth:`visit` 方法轉發的值。" -#: ../../library/ast.rst:2313 +#: ../../library/ast.rst:2312 msgid "" "This class is meant to be subclassed, with the subclass adding visitor " "methods." msgstr "這個類別應該被子類別化,子類別新增訪問者方法。" -#: ../../library/ast.rst:2318 +#: ../../library/ast.rst:2317 msgid "" "Visit a node. The default implementation calls the method called :samp:" "`self.visit_{classname}` where *classname* is the name of the node class, " @@ -4128,11 +4061,11 @@ msgstr "" "*classname* 是節點類別的名稱,或者在該方法不存在時呼叫 :meth:" "`generic_visit`。" -#: ../../library/ast.rst:2324 +#: ../../library/ast.rst:2323 msgid "This visitor calls :meth:`visit` on all children of the node." msgstr "該訪問者對該節點的所有子節點呼叫 :meth:`visit`。" -#: ../../library/ast.rst:2326 +#: ../../library/ast.rst:2325 msgid "" "Note that child nodes of nodes that have a custom visitor method won't be " "visited unless the visitor calls :meth:`generic_visit` or visits them itself." @@ -4140,11 +4073,11 @@ msgstr "" "請注意,除非訪問者呼叫 :meth:`generic_visit` 或訪問它們本身,否則不會訪問具有" "自定義訪問者方法的節點之子節點。" -#: ../../library/ast.rst:2332 +#: ../../library/ast.rst:2331 msgid "Handles all constant nodes." msgstr "處理所有常數節點。" -#: ../../library/ast.rst:2334 +#: ../../library/ast.rst:2333 msgid "" "Don't use the :class:`NodeVisitor` if you want to apply changes to nodes " "during traversal. For this a special visitor exists (:class:" @@ -4154,7 +4087,7 @@ msgstr "" "`NodeVisitor`。為此,有個允許修改的特殊遍歷訪問者工具 :class:" "`NodeTransformer`。" -#: ../../library/ast.rst:2340 +#: ../../library/ast.rst:2339 msgid "" "Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!visit_Bytes`, :meth:" "`!visit_NameConstant` and :meth:`!visit_Ellipsis` are deprecated now and " @@ -4165,13 +4098,13 @@ msgstr "" "visit_NameConstant` 和 :meth:`!visit_Ellipsis` 方法現已棄用,並且不會在未來的" "Python 版本中被呼叫。新增 :meth:`visit_Constant` 方法來處理所有常數節點。" -#: ../../library/ast.rst:2348 +#: ../../library/ast.rst:2347 msgid "" "A :class:`NodeVisitor` subclass that walks the abstract syntax tree and " "allows modification of nodes." msgstr "一個 :class:`NodeVisitor` 子類別,它會遍歷抽象語法樹並允許修改節點。" -#: ../../library/ast.rst:2351 +#: ../../library/ast.rst:2350 msgid "" "The :class:`NodeTransformer` will walk the AST and use the return value of " "the visitor methods to replace or remove the old node. If the return value " @@ -4183,7 +4116,7 @@ msgstr "" "點。如果訪問者方法的回傳值為 ``None``,則該節點將從其位置中刪除,否則將被替換" "為回傳值。回傳值可能是原始節點,在這種情況下不會發生替換。" -#: ../../library/ast.rst:2357 +#: ../../library/ast.rst:2356 msgid "" "Here is an example transformer that rewrites all occurrences of name lookups " "(``foo``) to ``data['foo']``::" @@ -4191,7 +4124,7 @@ msgstr "" "下面是一個示範用的 transformer,它將查找所有出現名稱 (``foo``) 並改寫為 " "``data['foo']``: ::" -#: ../../library/ast.rst:2360 +#: ../../library/ast.rst:2359 msgid "" "class RewriteName(NodeTransformer):\n" "\n" @@ -4211,7 +4144,7 @@ msgstr "" " ctx=node.ctx\n" " )" -#: ../../library/ast.rst:2369 +#: ../../library/ast.rst:2368 msgid "" "Keep in mind that if the node you're operating on has child nodes you must " "either transform the child nodes yourself or call the :meth:`~ast." @@ -4220,7 +4153,7 @@ msgstr "" "請記住,如果你正在操作的節點有子節點,你必須自己轉換子節點或先呼叫該節點的 :" "meth:`~ast.NodeVisitor.generic_visit` 方法。" -#: ../../library/ast.rst:2373 +#: ../../library/ast.rst:2372 msgid "" "For nodes that were part of a collection of statements (that applies to all " "statement nodes), the visitor may also return a list of nodes rather than " @@ -4229,7 +4162,7 @@ msgstr "" "對於屬於陳述式總集 (collection) 一部分的節點(適用於所有陳述式節點),訪問者" "還可以回傳節點串列,而不僅僅是單個節點。" -#: ../../library/ast.rst:2377 +#: ../../library/ast.rst:2376 msgid "" "If :class:`NodeTransformer` introduces new nodes (that weren't part of " "original tree) without giving them location information (such as :attr:`~ast." @@ -4240,7 +4173,7 @@ msgstr "" "它們提供位置資訊(例如 :attr:`~ast.AST.lineno`\\ ),則應使用新的子樹呼叫 :" "func:`fix_missing_locations` 以重新計算位置資訊: ::" -#: ../../library/ast.rst:2382 +#: ../../library/ast.rst:2381 msgid "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" @@ -4248,15 +4181,15 @@ msgstr "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" -#: ../../library/ast.rst:2385 +#: ../../library/ast.rst:2384 msgid "Usually you use the transformer like this::" msgstr "你通常會像這樣使用 transformer: ::" -#: ../../library/ast.rst:2387 +#: ../../library/ast.rst:2386 msgid "node = YourTransformer().visit(node)" msgstr "node = YourTransformer().visit(node)" -#: ../../library/ast.rst:2392 +#: ../../library/ast.rst:2391 msgid "" "Return a formatted dump of the tree in *node*. This is mainly useful for " "debugging purposes. If *annotate_fields* is true (by default), the returned " @@ -4272,7 +4205,7 @@ msgstr "" "潔。預設情況下,不會傾印列號和行偏移量等屬性。如果需要,可以設定 " "*include_attributes* 為 true。" -#: ../../library/ast.rst:2400 +#: ../../library/ast.rst:2399 msgid "" "If *indent* is a non-negative integer or string, then the tree will be " "pretty-printed with that indent level. An indent level of 0, negative, or " @@ -4286,23 +4219,23 @@ msgstr "" "(預設值)代表選擇單列表示。使用正整數縮排可以在每個級別縮排相同數量的空格。" "如果 *indent* 是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個級別。" -#: ../../library/ast.rst:2407 +#: ../../library/ast.rst:2406 msgid "" "If *show_empty* is ``False`` (the default), empty lists and fields that are " "``None`` will be omitted from the output." msgstr "" +"如果 *show_empty* 為 ``False`` (預設值),則輸出中將省略 ``False`` 的空串列" +"和欄位。" -#: ../../library/ast.rst:2410 +#: ../../library/ast.rst:2409 msgid "Added the *indent* option." msgstr "新增 *indent* 選項。" -#: ../../library/ast.rst:2413 -#, fuzzy +#: ../../library/ast.rst:2412 msgid "Added the *show_empty* option." -msgstr "新增 *indent* 選項。" +msgstr "新增 *show_empty* 選項。" -#: ../../library/ast.rst:2416 -#, fuzzy +#: ../../library/ast.rst:2415 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -4332,7 +4265,7 @@ msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" "... await other_func()\n" -"... \"\"\"), indent=4))\n" +"... \"\"\"), indent=4, show_empty=True))\n" "Module(\n" " body=[\n" " AsyncFunctionDef(\n" @@ -4354,17 +4287,17 @@ msgstr "" " type_params=[])],\n" " type_ignores=[])" -#: ../../library/ast.rst:2447 +#: ../../library/ast.rst:2446 msgid "Compiler Flags" msgstr "編譯器旗標" -#: ../../library/ast.rst:2449 +#: ../../library/ast.rst:2448 msgid "" "The following flags may be passed to :func:`compile` in order to change " "effects on the compilation of a program:" msgstr "可以將以下旗標傳遞給 :func:`compile` 以變更對程式的編譯效果:" -#: ../../library/ast.rst:2454 +#: ../../library/ast.rst:2453 msgid "" "Enables support for top-level ``await``, ``async for``, ``async with`` and " "async comprehensions." @@ -4372,19 +4305,21 @@ msgstr "" "啟用對最高階 ``await``、``async for``、``async with`` 和非同步綜合運算的支" "援。" -#: ../../library/ast.rst:2461 +#: ../../library/ast.rst:2460 msgid "" "Generates and returns an abstract syntax tree instead of returning a " "compiled code object." msgstr "生成並回傳抽象語法樹,而不是回傳已編譯的程式碼物件。" -#: ../../library/ast.rst:2466 +#: ../../library/ast.rst:2465 msgid "" "The returned AST is optimized according to the *optimize* argument in :func:" "`compile` or :func:`ast.parse`." msgstr "" +"回傳的 AST 會根據 :func:`compile` 或 :func:`ast.parse` 中的 *optimize* 引數進" +"行最佳化。" -#: ../../library/ast.rst:2473 +#: ../../library/ast.rst:2472 msgid "" "Enables support for :pep:`484` and :pep:`526` style type comments (``# type: " "<type>``, ``# type: ignore <stuff>``)." @@ -4392,47 +4327,47 @@ msgstr "" "啟用對 :pep:`484` 和 :pep:`526` 樣式型別註釋的支援 (``# type: <type>``, ``# " "type: ignore <stuff>``)。" -#: ../../library/ast.rst:2482 +#: ../../library/ast.rst:2481 msgid "Command-Line Usage" msgstr "命令列用法" -#: ../../library/ast.rst:2486 +#: ../../library/ast.rst:2485 msgid "" "The :mod:`ast` module can be executed as a script from the command line. It " "is as simple as:" msgstr ":mod:`ast` 模組可以作為腳本從命令列執行,可以像這樣簡單地做到:" -#: ../../library/ast.rst:2489 +#: ../../library/ast.rst:2488 msgid "python -m ast [-m <mode>] [-a] [infile]" msgstr "python -m ast [-m <mode>] [-a] [infile]" -#: ../../library/ast.rst:2493 +#: ../../library/ast.rst:2492 msgid "The following options are accepted:" msgstr "以下選項可被接受:" -#: ../../library/ast.rst:2499 +#: ../../library/ast.rst:2498 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/ast.rst:2504 +#: ../../library/ast.rst:2503 msgid "" "Specify what kind of code must be compiled, like the *mode* argument in :" "func:`parse`." msgstr "指定必須編譯哪種類型的程式碼,像是 :func:`parse` 中的 *mode* 引數。" -#: ../../library/ast.rst:2509 +#: ../../library/ast.rst:2508 msgid "Don't parse type comments." msgstr "不要剖析型別註解。" -#: ../../library/ast.rst:2513 +#: ../../library/ast.rst:2512 msgid "Include attributes such as line numbers and column offsets." msgstr "包括列號和行偏移量等屬性。" -#: ../../library/ast.rst:2518 +#: ../../library/ast.rst:2517 msgid "Indentation of nodes in AST (number of spaces)." msgstr "AST 中節點的縮進(空格數)。" -#: ../../library/ast.rst:2520 +#: ../../library/ast.rst:2519 msgid "" "If :file:`infile` is specified its contents are parsed to AST and dumped to " "stdout. Otherwise, the content is read from stdin." @@ -4440,7 +4375,7 @@ msgstr "" "如果指定了 :file:`infile`,則其內容將被剖析為 AST 並傾印 (dump) 到 stdout。否" "則會從 stdin 讀取內容。" -#: ../../library/ast.rst:2526 +#: ../../library/ast.rst:2525 msgid "" "`Green Tree Snakes <https://greentreesnakes.readthedocs.io/>`_, an external " "documentation resource, has good details on working with Python ASTs." @@ -4448,7 +4383,7 @@ msgstr "" "`Green Tree Snakes <https://greentreesnakes.readthedocs.io/>`_ 是一個外部文件" "資源,提供了有關使用 Python AST 的詳細資訊。" -#: ../../library/ast.rst:2529 +#: ../../library/ast.rst:2528 msgid "" "`ASTTokens <https://asttokens.readthedocs.io/en/latest/user-guide.html>`_ " "annotates Python ASTs with the positions of tokens and text in the source " @@ -4459,7 +4394,7 @@ msgstr "" "用生成它們的原始碼中的標記和文本的位置來註釋 Python AST。這對於進行原始碼轉換" "的工具很有幫助。" -#: ../../library/ast.rst:2534 +#: ../../library/ast.rst:2533 msgid "" "`leoAst.py <https://leo-editor.github.io/leo-editor/appendices.html#leoast-" "py>`_ unifies the token-based and parse-tree-based views of python programs " @@ -4469,7 +4404,7 @@ msgstr "" "py>`_ 透過在 token 和 ast 節點之間插入雙向鏈結,統一了 python 程式的基於 " "token 和基於剖析樹的視圖。" -#: ../../library/ast.rst:2539 +#: ../../library/ast.rst:2538 msgid "" "`LibCST <https://libcst.readthedocs.io/>`_ parses code as a Concrete Syntax " "Tree that looks like an ast tree and keeps all formatting details. It's " @@ -4479,7 +4414,7 @@ msgstr "" "(Concrete Syntax Tree),看起來像 ast 樹並保留所有格式詳細資訊。它對於建置自動" "重構 (codemod) 應用程式和 linter 非常有用。" -#: ../../library/ast.rst:2544 +#: ../../library/ast.rst:2543 msgid "" "`Parso <https://parso.readthedocs.io>`_ is a Python parser that supports " "error recovery and round-trip parsing for different Python versions (in " @@ -4501,35 +4436,3 @@ msgstr "於 AST 文法中" #: ../../library/ast.rst:60 msgid "* (asterisk)" msgstr "* (星號)" - -#~ msgid "" -#~ "node = ast.UnaryOp()\n" -#~ "node.op = ast.USub()\n" -#~ "node.operand = ast.Constant()\n" -#~ "node.operand.value = 5\n" -#~ "node.operand.lineno = 0\n" -#~ "node.operand.col_offset = 0\n" -#~ "node.lineno = 0\n" -#~ "node.col_offset = 0" -#~ msgstr "" -#~ "node = ast.UnaryOp()\n" -#~ "node.op = ast.USub()\n" -#~ "node.operand = ast.Constant()\n" -#~ "node.operand.value = 5\n" -#~ "node.operand.lineno = 0\n" -#~ "node.operand.col_offset = 0\n" -#~ "node.lineno = 0\n" -#~ "node.col_offset = 0" - -#~ msgid "or the more compact ::" -#~ msgstr "或更簡潔的: ::" - -#~ msgid "" -#~ "A :class:`typing.ParamSpec`. ``name`` is the name of the parameter " -#~ "specification." -#~ msgstr "A :class:`typing.ParamSpec`。``name`` 是參數規範的名稱。" - -#~ msgid "" -#~ "A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable " -#~ "tuple." -#~ msgstr "一個 :class:`typing.TypeVarTuple`。``name`` 是型別變數元組的名稱。" diff --git a/library/asyncio-task.po b/library/asyncio-task.po index 6e293fd3d1..ab4532b2ef 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -226,7 +226,7 @@ msgstr "" #: ../../library/asyncio-task.rst:130 msgid ":class:`asyncio.TaskGroup`." -msgstr "" +msgstr ":class:`asyncio.TaskGroup`。" #: ../../library/asyncio-task.rst:137 msgid "Awaitables" diff --git a/library/asyncio.po b/library/asyncio.po index f6ca78be42..56727e33e5 100644 --- a/library/asyncio.po +++ b/library/asyncio.po @@ -148,18 +148,16 @@ msgstr "" "based) 的函式庫與程式碼。" #: ../../includes/wasm-notavail.rst:3 -#, fuzzy msgid ":ref:`Availability <availability>`: not WASI." -msgstr ":ref:`適用 <availability>`:非 Emscripten、非 WASI。" +msgstr ":ref:`適用 <availability>`:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上不起作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/asyncio.rst:64 msgid "asyncio REPL" diff --git a/library/audioop.po b/library/audioop.po deleted file mode 100644 index 4de310eb6f..0000000000 --- a/library/audioop.po +++ /dev/null @@ -1,367 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2022-05-22 02:00+0800\n" -"Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/audioop.rst:2 -msgid ":mod:`audioop` --- Manipulate raw audio data" -msgstr ":mod:`audioop` --- 操作原始聲音檔案" - -#: ../../library/audioop.rst:8 -msgid "" -"The :mod:`audioop` module is deprecated (see :pep:`PEP 594 <594#audioop>` " -"for details)." -msgstr "" -":mod:`audioop` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 " -"<594#audioop>`\\ )。" - -#: ../../library/audioop.rst:14 -msgid "" -"The :mod:`audioop` module contains some useful operations on sound " -"fragments. It operates on sound fragments consisting of signed integer " -"samples 8, 16, 24 or 32 bits wide, stored in :term:`bytes-like objects " -"<bytes-like object>`. All scalar items are integers, unless specified " -"otherwise." -msgstr "" - -#: ../../library/audioop.rst:19 -msgid "" -"Support for 24-bit samples was added. All functions now accept any :term:" -"`bytes-like object`. String input now results in an immediate error." -msgstr "" - -#: ../../library/audioop.rst:30 -msgid "" -"This module provides support for a-LAW, u-LAW and Intel/DVI ADPCM encodings." -msgstr "" - -#: ../../library/audioop.rst:34 -msgid "" -"A few of the more complicated operations only take 16-bit samples, otherwise " -"the sample size (in bytes) is always a parameter of the operation." -msgstr "" - -#: ../../library/audioop.rst:37 -msgid "The module defines the following variables and functions:" -msgstr "" - -#: ../../library/audioop.rst:42 -msgid "" -"This exception is raised on all errors, such as unknown number of bytes per " -"sample, etc." -msgstr "" - -#: ../../library/audioop.rst:48 -msgid "" -"Return a fragment which is the addition of the two samples passed as " -"parameters. *width* is the sample width in bytes, either ``1``, ``2``, ``3`` " -"or ``4``. Both fragments should have the same length. Samples are " -"truncated in case of overflow." -msgstr "" - -#: ../../library/audioop.rst:55 -msgid "" -"Decode an Intel/DVI ADPCM coded fragment to a linear fragment. See the " -"description of :func:`lin2adpcm` for details on ADPCM coding. Return a tuple " -"``(sample, newstate)`` where the sample has the width specified in *width*." -msgstr "" - -#: ../../library/audioop.rst:62 -msgid "" -"Convert sound fragments in a-LAW encoding to linearly encoded sound " -"fragments. a-LAW encoding always uses 8 bits samples, so *width* refers only " -"to the sample width of the output fragment here." -msgstr "" - -#: ../../library/audioop.rst:69 -msgid "Return the average over all samples in the fragment." -msgstr "" - -#: ../../library/audioop.rst:74 -msgid "" -"Return the average peak-peak value over all samples in the fragment. No " -"filtering is done, so the usefulness of this routine is questionable." -msgstr "" - -#: ../../library/audioop.rst:80 -msgid "" -"Return a fragment that is the original fragment with a bias added to each " -"sample. Samples wrap around in case of overflow." -msgstr "" - -#: ../../library/audioop.rst:86 -msgid "" -"\"Byteswap\" all samples in a fragment and returns the modified fragment. " -"Converts big-endian samples to little-endian and vice versa." -msgstr "" - -#: ../../library/audioop.rst:94 -msgid "" -"Return the number of zero crossings in the fragment passed as an argument." -msgstr "" - -#: ../../library/audioop.rst:99 -msgid "" -"Return a factor *F* such that ``rms(add(fragment, mul(reference, -F)))`` is " -"minimal, i.e., return the factor with which you should multiply *reference* " -"to make it match as well as possible to *fragment*. The fragments should " -"both contain 2-byte samples." -msgstr "" - -#: ../../library/audioop.rst:104 -msgid "The time taken by this routine is proportional to ``len(fragment)``." -msgstr "" - -#: ../../library/audioop.rst:109 -msgid "" -"Try to match *reference* as well as possible to a portion of *fragment* " -"(which should be the longer fragment). This is (conceptually) done by " -"taking slices out of *fragment*, using :func:`findfactor` to compute the " -"best match, and minimizing the result. The fragments should both contain 2-" -"byte samples. Return a tuple ``(offset, factor)`` where *offset* is the " -"(integer) offset into *fragment* where the optimal match started and " -"*factor* is the (floating-point) factor as per :func:`findfactor`." -msgstr "" - -#: ../../library/audioop.rst:120 -msgid "" -"Search *fragment* for a slice of length *length* samples (not bytes!) with " -"maximum energy, i.e., return *i* for which ``rms(fragment[i*2:" -"(i+length)*2])`` is maximal. The fragments should both contain 2-byte " -"samples." -msgstr "" - -#: ../../library/audioop.rst:124 -msgid "The routine takes time proportional to ``len(fragment)``." -msgstr "" - -#: ../../library/audioop.rst:129 -msgid "Return the value of sample *index* from the fragment." -msgstr "" - -#: ../../library/audioop.rst:134 -msgid "" -"Convert samples to 4 bit Intel/DVI ADPCM encoding. ADPCM coding is an " -"adaptive coding scheme, whereby each 4 bit number is the difference between " -"one sample and the next, divided by a (varying) step. The Intel/DVI ADPCM " -"algorithm has been selected for use by the IMA, so it may well become a " -"standard." -msgstr "" - -#: ../../library/audioop.rst:139 -msgid "" -"*state* is a tuple containing the state of the coder. The coder returns a " -"tuple ``(adpcmfrag, newstate)``, and the *newstate* should be passed to the " -"next call of :func:`lin2adpcm`. In the initial call, ``None`` can be passed " -"as the state. *adpcmfrag* is the ADPCM coded fragment packed 2 4-bit values " -"per byte." -msgstr "" - -#: ../../library/audioop.rst:147 -msgid "" -"Convert samples in the audio fragment to a-LAW encoding and return this as a " -"bytes object. a-LAW is an audio encoding format whereby you get a dynamic " -"range of about 13 bits using only 8 bit samples. It is used by the Sun " -"audio hardware, among others." -msgstr "" - -#: ../../library/audioop.rst:155 -msgid "Convert samples between 1-, 2-, 3- and 4-byte formats." -msgstr "" - -#: ../../library/audioop.rst:159 -msgid "" -"In some audio formats, such as .WAV files, 16, 24 and 32 bit samples are " -"signed, but 8 bit samples are unsigned. So when converting to 8 bit wide " -"samples for these formats, you need to also add 128 to the result::" -msgstr "" - -#: ../../library/audioop.rst:163 -msgid "" -"new_frames = audioop.lin2lin(frames, old_width, 1)\n" -"new_frames = audioop.bias(new_frames, 1, 128)" -msgstr "" - -#: ../../library/audioop.rst:166 -msgid "" -"The same, in reverse, has to be applied when converting from 8 to 16, 24 or " -"32 bit width samples." -msgstr "" - -#: ../../library/audioop.rst:172 -msgid "" -"Convert samples in the audio fragment to u-LAW encoding and return this as a " -"bytes object. u-LAW is an audio encoding format whereby you get a dynamic " -"range of about 14 bits using only 8 bit samples. It is used by the Sun " -"audio hardware, among others." -msgstr "" - -#: ../../library/audioop.rst:180 -msgid "" -"Return the maximum of the *absolute value* of all samples in a fragment." -msgstr "" - -#: ../../library/audioop.rst:185 -msgid "Return the maximum peak-peak value in the sound fragment." -msgstr "" - -#: ../../library/audioop.rst:190 -msgid "" -"Return a tuple consisting of the minimum and maximum values of all samples " -"in the sound fragment." -msgstr "" - -#: ../../library/audioop.rst:196 -msgid "" -"Return a fragment that has all samples in the original fragment multiplied " -"by the floating-point value *factor*. Samples are truncated in case of " -"overflow." -msgstr "" - -#: ../../library/audioop.rst:202 -msgid "Convert the frame rate of the input fragment." -msgstr "" - -#: ../../library/audioop.rst:204 -msgid "" -"*state* is a tuple containing the state of the converter. The converter " -"returns a tuple ``(newfragment, newstate)``, and *newstate* should be passed " -"to the next call of :func:`ratecv`. The initial call should pass ``None`` " -"as the state." -msgstr "" - -#: ../../library/audioop.rst:208 -msgid "" -"The *weightA* and *weightB* arguments are parameters for a simple digital " -"filter and default to ``1`` and ``0`` respectively." -msgstr "" - -#: ../../library/audioop.rst:214 -msgid "Reverse the samples in a fragment and returns the modified fragment." -msgstr "" - -#: ../../library/audioop.rst:219 -msgid "" -"Return the root-mean-square of the fragment, i.e. ``sqrt(sum(S_i^2)/n)``." -msgstr "" - -#: ../../library/audioop.rst:221 -msgid "This is a measure of the power in an audio signal." -msgstr "" - -#: ../../library/audioop.rst:226 -msgid "" -"Convert a stereo fragment to a mono fragment. The left channel is " -"multiplied by *lfactor* and the right channel by *rfactor* before adding the " -"two channels to give a mono signal." -msgstr "" - -#: ../../library/audioop.rst:233 -msgid "" -"Generate a stereo fragment from a mono fragment. Each pair of samples in " -"the stereo fragment are computed from the mono sample, whereby left channel " -"samples are multiplied by *lfactor* and right channel samples by *rfactor*." -msgstr "" - -#: ../../library/audioop.rst:240 -msgid "" -"Convert sound fragments in u-LAW encoding to linearly encoded sound " -"fragments. u-LAW encoding always uses 8 bits samples, so *width* refers only " -"to the sample width of the output fragment here." -msgstr "" - -#: ../../library/audioop.rst:244 -msgid "" -"Note that operations such as :func:`.mul` or :func:`.max` make no " -"distinction between mono and stereo fragments, i.e. all samples are treated " -"equal. If this is a problem the stereo fragment should be split into two " -"mono fragments first and recombined later. Here is an example of how to do " -"that::" -msgstr "" - -#: ../../library/audioop.rst:249 -msgid "" -"def mul_stereo(sample, width, lfactor, rfactor):\n" -" lsample = audioop.tomono(sample, width, 1, 0)\n" -" rsample = audioop.tomono(sample, width, 0, 1)\n" -" lsample = audioop.mul(lsample, width, lfactor)\n" -" rsample = audioop.mul(rsample, width, rfactor)\n" -" lsample = audioop.tostereo(lsample, width, 1, 0)\n" -" rsample = audioop.tostereo(rsample, width, 0, 1)\n" -" return audioop.add(lsample, rsample, width)" -msgstr "" - -#: ../../library/audioop.rst:258 -msgid "" -"If you use the ADPCM coder to build network packets and you want your " -"protocol to be stateless (i.e. to be able to tolerate packet loss) you " -"should not only transmit the data but also the state. Note that you should " -"send the *initial* state (the one you passed to :func:`lin2adpcm`) along to " -"the decoder, not the final state (as returned by the coder). If you want to " -"use :class:`struct.Struct` to store the state in binary you can code the " -"first element (the predicted value) in 16 bits and the second (the delta " -"index) in 8." -msgstr "" - -#: ../../library/audioop.rst:266 -msgid "" -"The ADPCM coders have never been tried against other ADPCM coders, only " -"against themselves. It could well be that I misinterpreted the standards in " -"which case they will not be interoperable with the respective standards." -msgstr "" - -#: ../../library/audioop.rst:270 -msgid "" -"The :func:`find\\*` routines might look a bit funny at first sight. They are " -"primarily meant to do echo cancellation. A reasonably fast way to do this " -"is to pick the most energetic piece of the output sample, locate that in the " -"input sample and subtract the whole output sample from the input sample::" -msgstr "" - -#: ../../library/audioop.rst:275 -msgid "" -"def echocancel(outputdata, inputdata):\n" -" pos = audioop.findmax(outputdata, 800) # one tenth second\n" -" out_test = outputdata[pos*2:]\n" -" in_test = inputdata[pos*2:]\n" -" ipos, factor = audioop.findfit(in_test, out_test)\n" -" # Optional (for better cancellation):\n" -" # factor = audioop.findfactor(in_test[ipos*2:ipos*2+len(out_test)],\n" -" # out_test)\n" -" prefill = '\\0'*(pos+ipos)*2\n" -" postfill = '\\0'*(len(inputdata)-len(prefill)-len(outputdata))\n" -" outputdata = prefill + audioop.mul(outputdata, 2, -factor) + postfill\n" -" return audioop.add(inputdata, outputdata, 2)" -msgstr "" - -#: ../../library/audioop.rst:24 -msgid "Intel/DVI ADPCM" -msgstr "Intel/DVI ADPCM" - -#: ../../library/audioop.rst:24 -msgid "ADPCM, Intel/DVI" -msgstr "ADPCM, Intel/DVI" - -#: ../../library/audioop.rst:24 -msgid "a-LAW" -msgstr "a-LAW" - -#: ../../library/audioop.rst:24 -msgid "u-LAW" -msgstr "u-LAW" diff --git a/library/cgi.po b/library/cgi.po deleted file mode 100644 index 8f7890bfa5..0000000000 --- a/library/cgi.po +++ /dev/null @@ -1,889 +0,0 @@ -# Copyright (C) 2001-2024, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2022-05-22 02:01+0800\n" -"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/cgi.rst:2 -msgid ":mod:`cgi` --- Common Gateway Interface support" -msgstr ":mod:`cgi` --- 通用閘道器介面支援" - -#: ../../library/cgi.rst:8 -msgid "**Source code:** :source:`Lib/cgi.py`" -msgstr "**原始碼:**\\ :source:`Lib/cgi.py`" - -#: ../../library/cgi.rst:18 -msgid "" -"The :mod:`cgi` module is deprecated (see :pep:`PEP 594 <594#cgi>` for " -"details and alternatives)." -msgstr "" -":mod:`cgi` 模組 (module) 即將被棄用(詳情與替代方案請見 :pep:`PEP 594 " -"<594#cgi>`\\ )。" - -#: ../../library/cgi.rst:22 -msgid "" -"The :class:`FieldStorage` class can typically be replaced with :func:`urllib." -"parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." -"message` module or :pypi:`multipart` for ``POST`` and ``PUT``. Most :ref:" -"`utility functions <functions-in-cgi-module>` have replacements." -msgstr "" - -#: ../../library/cgi.rst:30 -msgid "Support module for Common Gateway Interface (CGI) scripts." -msgstr "" - -#: ../../library/cgi.rst:32 -msgid "" -"This module defines a number of utilities for use by CGI scripts written in " -"Python." -msgstr "" - -#: ../../library/cgi.rst:35 -msgid "" -"The global variable ``maxlen`` can be set to an integer indicating the " -"maximum size of a POST request. POST requests larger than this size will " -"result in a :exc:`ValueError` being raised during parsing. The default value " -"of this variable is ``0``, meaning the request size is unlimited." -msgstr "" - -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability <availability>`: not Emscripten, not WASI." -msgstr "" - -#: ../../includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" - -#: ../../library/cgi.rst:43 -msgid "Introduction" -msgstr "簡介" - -#: ../../library/cgi.rst:47 -msgid "" -"A CGI script is invoked by an HTTP server, usually to process user input " -"submitted through an HTML ``<FORM>`` or ``<ISINDEX>`` element." -msgstr "" - -#: ../../library/cgi.rst:50 -msgid "" -"Most often, CGI scripts live in the server's special :file:`cgi-bin` " -"directory. The HTTP server places all sorts of information about the request " -"(such as the client's hostname, the requested URL, the query string, and " -"lots of other goodies) in the script's shell environment, executes the " -"script, and sends the script's output back to the client." -msgstr "" - -#: ../../library/cgi.rst:56 -msgid "" -"The script's input is connected to the client too, and sometimes the form " -"data is read this way; at other times the form data is passed via the " -"\"query string\" part of the URL. This module is intended to take care of " -"the different cases and provide a simpler interface to the Python script. " -"It also provides a number of utilities that help in debugging scripts, and " -"the latest addition is support for file uploads from a form (if your browser " -"supports it)." -msgstr "" - -#: ../../library/cgi.rst:63 -msgid "" -"The output of a CGI script should consist of two sections, separated by a " -"blank line. The first section contains a number of headers, telling the " -"client what kind of data is following. Python code to generate a minimal " -"header section looks like this::" -msgstr "" - -#: ../../library/cgi.rst:68 -msgid "" -"print(\"Content-Type: text/html\") # HTML is following\n" -"print() # blank line, end of headers" -msgstr "" - -#: ../../library/cgi.rst:71 -msgid "" -"The second section is usually HTML, which allows the client software to " -"display nicely formatted text with header, in-line images, etc. Here's " -"Python code that prints a simple piece of HTML::" -msgstr "" - -#: ../../library/cgi.rst:75 -msgid "" -"print(\"<TITLE>CGI script output\")\n" -"print(\"

This is my first CGI script

\")\n" -"print(\"Hello, world!\")" -msgstr "" -"print(\"CGI script output\")\n" -"print(\"

This is my first CGI script

\")\n" -"print(\"Hello, world!\")" - -#: ../../library/cgi.rst:83 -msgid "Using the cgi module" -msgstr "使用 cgi 模組" - -#: ../../library/cgi.rst:85 -msgid "Begin by writing ``import cgi``." -msgstr "" - -#: ../../library/cgi.rst:87 -msgid "When you write a new script, consider adding these lines::" -msgstr "" - -#: ../../library/cgi.rst:89 ../../library/cgi.rst:505 -msgid "" -"import cgitb\n" -"cgitb.enable()" -msgstr "" -"import cgitb\n" -"cgitb.enable()" - -#: ../../library/cgi.rst:92 -msgid "" -"This activates a special exception handler that will display detailed " -"reports in the web browser if any errors occur. If you'd rather not show " -"the guts of your program to users of your script, you can have the reports " -"saved to files instead, with code like this::" -msgstr "" - -#: ../../library/cgi.rst:97 -msgid "" -"import cgitb\n" -"cgitb.enable(display=0, logdir=\"/path/to/logdir\")" -msgstr "" -"import cgitb\n" -"cgitb.enable(display=0, logdir=\"/path/to/logdir\")" - -#: ../../library/cgi.rst:100 -msgid "" -"It's very helpful to use this feature during script development. The reports " -"produced by :mod:`cgitb` provide information that can save you a lot of time " -"in tracking down bugs. You can always remove the ``cgitb`` line later when " -"you have tested your script and are confident that it works correctly." -msgstr "" - -#: ../../library/cgi.rst:105 -msgid "" -"To get at submitted form data, use the :class:`FieldStorage` class. If the " -"form contains non-ASCII characters, use the *encoding* keyword parameter set " -"to the value of the encoding defined for the document. It is usually " -"contained in the META tag in the HEAD section of the HTML document or by " -"the :mailheader:`Content-Type` header. This reads the form contents from " -"the standard input or the environment (depending on the value of various " -"environment variables set according to the CGI standard). Since it may " -"consume standard input, it should be instantiated only once." -msgstr "" - -#: ../../library/cgi.rst:114 -msgid "" -"The :class:`FieldStorage` instance can be indexed like a Python dictionary. " -"It allows membership testing with the :keyword:`in` operator, and also " -"supports the standard dictionary method :meth:`~dict.keys` and the built-in " -"function :func:`len`. Form fields containing empty strings are ignored and " -"do not appear in the dictionary; to keep such values, provide a true value " -"for the optional *keep_blank_values* keyword parameter when creating the :" -"class:`FieldStorage` instance." -msgstr "" - -#: ../../library/cgi.rst:122 -msgid "" -"For instance, the following code (which assumes that the :mailheader:" -"`Content-Type` header and blank line have already been printed) checks that " -"the fields ``name`` and ``addr`` are both set to a non-empty string::" -msgstr "" - -#: ../../library/cgi.rst:127 -msgid "" -"form = cgi.FieldStorage()\n" -"if \"name\" not in form or \"addr\" not in form:\n" -" print(\"

Error

\")\n" -" print(\"Please fill in the name and addr fields.\")\n" -" return\n" -"print(\"

name:\", form[\"name\"].value)\n" -"print(\"

addr:\", form[\"addr\"].value)\n" -"...further form processing here..." -msgstr "" - -#: ../../library/cgi.rst:136 -msgid "" -"Here the fields, accessed through ``form[key]``, are themselves instances " -"of :class:`FieldStorage` (or :class:`MiniFieldStorage`, depending on the " -"form encoding). The :attr:`~FieldStorage.value` attribute of the instance " -"yields the string value of the field. The :meth:`~FieldStorage.getvalue` " -"method returns this string value directly; it also accepts an optional " -"second argument as a default to return if the requested key is not present." -msgstr "" - -#: ../../library/cgi.rst:143 -msgid "" -"If the submitted form data contains more than one field with the same name, " -"the object retrieved by ``form[key]`` is not a :class:`FieldStorage` or :" -"class:`MiniFieldStorage` instance but a list of such instances. Similarly, " -"in this situation, ``form.getvalue(key)`` would return a list of strings. If " -"you expect this possibility (when your HTML form contains multiple fields " -"with the same name), use the :meth:`~FieldStorage.getlist` method, which " -"always returns a list of values (so that you do not need to special-case the " -"single item case). For example, this code concatenates any number of " -"username fields, separated by commas::" -msgstr "" - -#: ../../library/cgi.rst:153 -msgid "" -"value = form.getlist(\"username\")\n" -"usernames = \",\".join(value)" -msgstr "" -"value = form.getlist(\"username\")\n" -"usernames = \",\".join(value)" - -#: ../../library/cgi.rst:156 -msgid "" -"If a field represents an uploaded file, accessing the value via the :attr:" -"`~FieldStorage.value` attribute or the :meth:`~FieldStorage.getvalue` method " -"reads the entire file in memory as bytes. This may not be what you want. " -"You can test for an uploaded file by testing either the :attr:`~FieldStorage." -"filename` attribute or the :attr:`~FieldStorage.file` attribute. You can " -"then read the data from the :attr:`!file` attribute before it is " -"automatically closed as part of the garbage collection of the :class:" -"`FieldStorage` instance (the :func:`~io.RawIOBase.read` and :func:`~io." -"IOBase.readline` methods will return bytes)::" -msgstr "" - -#: ../../library/cgi.rst:167 -msgid "" -"fileitem = form[\"userfile\"]\n" -"if fileitem.file:\n" -" # It's an uploaded file; count lines\n" -" linecount = 0\n" -" while True:\n" -" line = fileitem.file.readline()\n" -" if not line: break\n" -" linecount = linecount + 1" -msgstr "" - -#: ../../library/cgi.rst:176 -msgid "" -":class:`FieldStorage` objects also support being used in a :keyword:`with` " -"statement, which will automatically close them when done." -msgstr "" - -#: ../../library/cgi.rst:179 -msgid "" -"If an error is encountered when obtaining the contents of an uploaded file " -"(for example, when the user interrupts the form submission by clicking on a " -"Back or Cancel button) the :attr:`~FieldStorage.done` attribute of the " -"object for the field will be set to the value -1." -msgstr "" - -#: ../../library/cgi.rst:184 -msgid "" -"The file upload draft standard entertains the possibility of uploading " -"multiple files from one field (using a recursive :mimetype:`multipart/\\*` " -"encoding). When this occurs, the item will be a dictionary-like :class:" -"`FieldStorage` item. This can be determined by testing its :attr:`!type` " -"attribute, which should be :mimetype:`multipart/form-data` (or perhaps " -"another MIME type matching :mimetype:`multipart/\\*`). In this case, it can " -"be iterated over recursively just like the top-level form object." -msgstr "" - -#: ../../library/cgi.rst:192 -msgid "" -"When a form is submitted in the \"old\" format (as the query string or as a " -"single data part of type :mimetype:`application/x-www-form-urlencoded`), the " -"items will actually be instances of the class :class:`MiniFieldStorage`. In " -"this case, the :attr:`!list`, :attr:`!file`, and :attr:`filename` attributes " -"are always ``None``." -msgstr "" - -#: ../../library/cgi.rst:197 -msgid "" -"A form submitted via POST that also has a query string will contain both :" -"class:`FieldStorage` and :class:`MiniFieldStorage` items." -msgstr "" - -#: ../../library/cgi.rst:200 -msgid "" -"The :attr:`~FieldStorage.file` attribute is automatically closed upon the " -"garbage collection of the creating :class:`FieldStorage` instance." -msgstr "" - -#: ../../library/cgi.rst:204 -msgid "" -"Added support for the context management protocol to the :class:" -"`FieldStorage` class." -msgstr "" - -#: ../../library/cgi.rst:210 -msgid "Higher Level Interface" -msgstr "" - -#: ../../library/cgi.rst:212 -msgid "" -"The previous section explains how to read CGI form data using the :class:" -"`FieldStorage` class. This section describes a higher level interface which " -"was added to this class to allow one to do it in a more readable and " -"intuitive way. The interface doesn't make the techniques described in " -"previous sections obsolete --- they are still useful to process file uploads " -"efficiently, for example." -msgstr "" - -#: ../../library/cgi.rst:221 -msgid "" -"The interface consists of two simple methods. Using the methods you can " -"process form data in a generic way, without the need to worry whether only " -"one or more values were posted under one name." -msgstr "" - -#: ../../library/cgi.rst:225 -msgid "" -"In the previous section, you learned to write following code anytime you " -"expected a user to post more than one value under one name::" -msgstr "" - -#: ../../library/cgi.rst:228 -msgid "" -"item = form.getvalue(\"item\")\n" -"if isinstance(item, list):\n" -" # The user is requesting more than one item.\n" -"else:\n" -" # The user is requesting only one item." -msgstr "" - -#: ../../library/cgi.rst:234 -msgid "" -"This situation is common for example when a form contains a group of " -"multiple checkboxes with the same name::" -msgstr "" - -#: ../../library/cgi.rst:237 -msgid "" -"\n" -"" -msgstr "" -"\n" -"" - -#: ../../library/cgi.rst:240 -msgid "" -"In most situations, however, there's only one form control with a particular " -"name in a form and then you expect and need only one value associated with " -"this name. So you write a script containing for example this code::" -msgstr "" - -#: ../../library/cgi.rst:244 -msgid "user = form.getvalue(\"user\").upper()" -msgstr "user = form.getvalue(\"user\").upper()" - -#: ../../library/cgi.rst:246 -msgid "" -"The problem with the code is that you should never expect that a client will " -"provide valid input to your scripts. For example, if a curious user appends " -"another ``user=foo`` pair to the query string, then the script would crash, " -"because in this situation the ``getvalue(\"user\")`` method call returns a " -"list instead of a string. Calling the :meth:`~str.upper` method on a list " -"is not valid (since lists do not have a method of this name) and results in " -"an :exc:`AttributeError` exception." -msgstr "" - -#: ../../library/cgi.rst:254 -msgid "" -"Therefore, the appropriate way to read form data values was to always use " -"the code which checks whether the obtained value is a single value or a list " -"of values. That's annoying and leads to less readable scripts." -msgstr "" - -#: ../../library/cgi.rst:258 -msgid "" -"A more convenient approach is to use the methods :meth:`~FieldStorage." -"getfirst` and :meth:`~FieldStorage.getlist` provided by this higher level " -"interface." -msgstr "" - -#: ../../library/cgi.rst:264 -msgid "" -"This method always returns only one value associated with form field *name*. " -"The method returns only the first value in case that more values were posted " -"under such name. Please note that the order in which the values are " -"received may vary from browser to browser and should not be counted on. " -"[#]_ If no such form field or value exists then the method returns the " -"value specified by the optional parameter *default*. This parameter " -"defaults to ``None`` if not specified." -msgstr "" - -#: ../../library/cgi.rst:275 -msgid "" -"This method always returns a list of values associated with form field " -"*name*. The method returns an empty list if no such form field or value " -"exists for *name*. It returns a list consisting of one item if only one " -"such value exists." -msgstr "" - -#: ../../library/cgi.rst:279 -msgid "Using these methods you can write nice compact code::" -msgstr "" - -#: ../../library/cgi.rst:281 -msgid "" -"import cgi\n" -"form = cgi.FieldStorage()\n" -"user = form.getfirst(\"user\", \"\").upper() # This way it's safe.\n" -"for item in form.getlist(\"item\"):\n" -" do_something(item)" -msgstr "" -"import cgi\n" -"form = cgi.FieldStorage()\n" -"user = form.getfirst(\"user\", \"\").upper() # 這是安全的方式。\n" -"for item in form.getlist(\"item\"):\n" -" do_something(item)" - -#: ../../library/cgi.rst:291 -msgid "Functions" -msgstr "函式" - -#: ../../library/cgi.rst:293 -msgid "" -"These are useful if you want more control, or if you want to employ some of " -"the algorithms implemented in this module in other circumstances." -msgstr "" - -#: ../../library/cgi.rst:299 -msgid "" -"Parse a query in the environment or from a file (the file defaults to ``sys." -"stdin``). The *keep_blank_values*, *strict_parsing* and *separator* " -"parameters are passed to :func:`urllib.parse.parse_qs` unchanged." -msgstr "" - -#: ../../library/cgi.rst:303 -msgid "" -"This function, like the rest of the :mod:`cgi` module, is deprecated. It can " -"be replaced by calling :func:`urllib.parse.parse_qs` directly on the desired " -"query string (except for ``multipart/form-data`` input, which can be handled " -"as described for :func:`parse_multipart`)." -msgstr "" - -#: ../../library/cgi.rst:312 -msgid "" -"Parse input of type :mimetype:`multipart/form-data` (for file uploads). " -"Arguments are *fp* for the input file, *pdict* for a dictionary containing " -"other parameters in the :mailheader:`Content-Type` header, and *encoding*, " -"the request encoding." -msgstr "" - -#: ../../library/cgi.rst:317 -msgid "" -"Returns a dictionary just like :func:`urllib.parse.parse_qs`: keys are the " -"field names, each value is a list of values for that field. For non-file " -"fields, the value is a list of strings." -msgstr "" - -#: ../../library/cgi.rst:321 -msgid "" -"This is easy to use but not much good if you are expecting megabytes to be " -"uploaded --- in that case, use the :class:`FieldStorage` class instead which " -"is much more flexible." -msgstr "" - -#: ../../library/cgi.rst:325 -msgid "" -"Added the *encoding* and *errors* parameters. For non-file fields, the " -"value is now a list of strings, not bytes." -msgstr "" - -#: ../../library/cgi.rst:329 -msgid "Added the *separator* parameter." -msgstr "新增 *separator* 參數。" - -#: ../../library/cgi.rst:332 -msgid "" -"This function, like the rest of the :mod:`cgi` module, is deprecated. It can " -"be replaced with the functionality in the :mod:`email` package (e.g. :class:" -"`email.message.EmailMessage`/:class:`email.message.Message`) which " -"implements the same MIME RFCs, or with the :pypi:`multipart` PyPI project." -msgstr "" - -#: ../../library/cgi.rst:342 -msgid "" -"Parse a MIME header (such as :mailheader:`Content-Type`) into a main value " -"and a dictionary of parameters." -msgstr "" - -#: ../../library/cgi.rst:345 -msgid "" -"This function, like the rest of the :mod:`cgi` module, is deprecated. It can " -"be replaced with the functionality in the :mod:`email` package, which " -"implements the same MIME RFCs." -msgstr "" - -#: ../../library/cgi.rst:350 -msgid "For example, with :class:`email.message.EmailMessage`::" -msgstr "" - -#: ../../library/cgi.rst:352 -msgid "" -"from email.message import EmailMessage\n" -"msg = EmailMessage()\n" -"msg['content-type'] = 'application/json; charset=\"utf8\"'\n" -"main, params = msg.get_content_type(), msg['content-type'].params" -msgstr "" -"from email.message import EmailMessage\n" -"msg = EmailMessage()\n" -"msg['content-type'] = 'application/json; charset=\"utf8\"'\n" -"main, params = msg.get_content_type(), msg['content-type'].params" - -#: ../../library/cgi.rst:360 -msgid "" -"Robust test CGI script, usable as main program. Writes minimal HTTP headers " -"and formats all information provided to the script in HTML format." -msgstr "" - -#: ../../library/cgi.rst:366 -msgid "Format the shell environment in HTML." -msgstr "" - -#: ../../library/cgi.rst:371 -msgid "Format a form in HTML." -msgstr "" - -#: ../../library/cgi.rst:376 -msgid "Format the current directory in HTML." -msgstr "" - -#: ../../library/cgi.rst:381 -msgid "Print a list of useful (used by CGI) environment variables in HTML." -msgstr "" - -#: ../../library/cgi.rst:387 -msgid "Caring about security" -msgstr "" - -#: ../../library/cgi.rst:391 -msgid "" -"There's one important rule: if you invoke an external program (via :func:`os." -"system`, :func:`os.popen` or other functions with similar functionality), " -"make very sure you don't pass arbitrary strings received from the client to " -"the shell. This is a well-known security hole whereby clever hackers " -"anywhere on the web can exploit a gullible CGI script to invoke arbitrary " -"shell commands. Even parts of the URL or field names cannot be trusted, " -"since the request doesn't have to come from your form!" -msgstr "" - -#: ../../library/cgi.rst:399 -msgid "" -"To be on the safe side, if you must pass a string gotten from a form to a " -"shell command, you should make sure the string contains only alphanumeric " -"characters, dashes, underscores, and periods." -msgstr "" - -#: ../../library/cgi.rst:405 -msgid "Installing your CGI script on a Unix system" -msgstr "" - -#: ../../library/cgi.rst:407 -msgid "" -"Read the documentation for your HTTP server and check with your local system " -"administrator to find the directory where CGI scripts should be installed; " -"usually this is in a directory :file:`cgi-bin` in the server tree." -msgstr "" - -#: ../../library/cgi.rst:411 -msgid "" -"Make sure that your script is readable and executable by \"others\"; the " -"Unix file mode should be ``0o755`` octal (use ``chmod 0755 filename``). " -"Make sure that the first line of the script contains ``#!`` starting in " -"column 1 followed by the pathname of the Python interpreter, for instance::" -msgstr "" - -#: ../../library/cgi.rst:416 -msgid "#!/usr/local/bin/python" -msgstr "#!/usr/local/bin/python" - -#: ../../library/cgi.rst:418 -msgid "" -"Make sure the Python interpreter exists and is executable by \"others\"." -msgstr "" - -#: ../../library/cgi.rst:420 -msgid "" -"Make sure that any files your script needs to read or write are readable or " -"writable, respectively, by \"others\" --- their mode should be ``0o644`` for " -"readable and ``0o666`` for writable. This is because, for security reasons, " -"the HTTP server executes your script as user \"nobody\", without any special " -"privileges. It can only read (write, execute) files that everybody can read " -"(write, execute). The current directory at execution time is also different " -"(it is usually the server's cgi-bin directory) and the set of environment " -"variables is also different from what you get when you log in. In " -"particular, don't count on the shell's search path for executables (:envvar:" -"`PATH`) or the Python module search path (:envvar:`PYTHONPATH`) to be set to " -"anything interesting." -msgstr "" - -#: ../../library/cgi.rst:431 -msgid "" -"If you need to load modules from a directory which is not on Python's " -"default module search path, you can change the path in your script, before " -"importing other modules. For example::" -msgstr "" - -#: ../../library/cgi.rst:435 -msgid "" -"import sys\n" -"sys.path.insert(0, \"/usr/home/joe/lib/python\")\n" -"sys.path.insert(0, \"/usr/local/lib/python\")" -msgstr "" -"import sys\n" -"sys.path.insert(0, \"/usr/home/joe/lib/python\")\n" -"sys.path.insert(0, \"/usr/local/lib/python\")" - -#: ../../library/cgi.rst:439 -msgid "(This way, the directory inserted last will be searched first!)" -msgstr "" - -#: ../../library/cgi.rst:441 -msgid "" -"Instructions for non-Unix systems will vary; check your HTTP server's " -"documentation (it will usually have a section on CGI scripts)." -msgstr "" - -#: ../../library/cgi.rst:446 -msgid "Testing your CGI script" -msgstr "" - -#: ../../library/cgi.rst:448 -msgid "" -"Unfortunately, a CGI script will generally not run when you try it from the " -"command line, and a script that works perfectly from the command line may " -"fail mysteriously when run from the server. There's one reason why you " -"should still test your script from the command line: if it contains a syntax " -"error, the Python interpreter won't execute it at all, and the HTTP server " -"will most likely send a cryptic error to the client." -msgstr "" - -#: ../../library/cgi.rst:455 -msgid "" -"Assuming your script has no syntax errors, yet it does not work, you have no " -"choice but to read the next section." -msgstr "" - -#: ../../library/cgi.rst:460 -msgid "Debugging CGI scripts" -msgstr "" - -#: ../../library/cgi.rst:464 -msgid "" -"First of all, check for trivial installation errors --- reading the section " -"above on installing your CGI script carefully can save you a lot of time. " -"If you wonder whether you have understood the installation procedure " -"correctly, try installing a copy of this module file (:file:`cgi.py`) as a " -"CGI script. When invoked as a script, the file will dump its environment " -"and the contents of the form in HTML format. Give it the right mode etc., " -"and send it a request. If it's installed in the standard :file:`cgi-bin` " -"directory, it should be possible to send it a request by entering a URL into " -"your browser of the form:" -msgstr "" - -#: ../../library/cgi.rst:473 -msgid "http://yourhostname/cgi-bin/cgi.py?name=Joe+Blow&addr=At+Home" -msgstr "http://yourhostname/cgi-bin/cgi.py?name=Joe+Blow&addr=At+Home" - -#: ../../library/cgi.rst:477 -msgid "" -"If this gives an error of type 404, the server cannot find the script -- " -"perhaps you need to install it in a different directory. If it gives " -"another error, there's an installation problem that you should fix before " -"trying to go any further. If you get a nicely formatted listing of the " -"environment and form content (in this example, the fields should be listed " -"as \"addr\" with value \"At Home\" and \"name\" with value \"Joe Blow\"), " -"the :file:`cgi.py` script has been installed correctly. If you follow the " -"same procedure for your own script, you should now be able to debug it." -msgstr "" - -#: ../../library/cgi.rst:486 -msgid "" -"The next step could be to call the :mod:`cgi` module's :func:`test` function " -"from your script: replace its main code with the single statement ::" -msgstr "" - -#: ../../library/cgi.rst:489 -msgid "cgi.test()" -msgstr "cgi.test()" - -#: ../../library/cgi.rst:491 -msgid "" -"This should produce the same results as those gotten from installing the :" -"file:`cgi.py` file itself." -msgstr "" - -#: ../../library/cgi.rst:494 -msgid "" -"When an ordinary Python script raises an unhandled exception (for whatever " -"reason: of a typo in a module name, a file that can't be opened, etc.), the " -"Python interpreter prints a nice traceback and exits. While the Python " -"interpreter will still do this when your CGI script raises an exception, " -"most likely the traceback will end up in one of the HTTP server's log files, " -"or be discarded altogether." -msgstr "" - -#: ../../library/cgi.rst:501 -msgid "" -"Fortunately, once you have managed to get your script to execute *some* " -"code, you can easily send tracebacks to the web browser using the :mod:" -"`cgitb` module. If you haven't done so already, just add the lines::" -msgstr "" - -#: ../../library/cgi.rst:508 -msgid "" -"to the top of your script. Then try running it again; when a problem " -"occurs, you should see a detailed report that will likely make apparent the " -"cause of the crash." -msgstr "" - -#: ../../library/cgi.rst:512 -msgid "" -"If you suspect that there may be a problem in importing the :mod:`cgitb` " -"module, you can use an even more robust approach (which only uses built-in " -"modules)::" -msgstr "" - -#: ../../library/cgi.rst:515 -msgid "" -"import sys\n" -"sys.stderr = sys.stdout\n" -"print(\"Content-Type: text/plain\")\n" -"print()\n" -"...your code here..." -msgstr "" - -#: ../../library/cgi.rst:521 -msgid "" -"This relies on the Python interpreter to print the traceback. The content " -"type of the output is set to plain text, which disables all HTML " -"processing. If your script works, the raw HTML will be displayed by your " -"client. If it raises an exception, most likely after the first two lines " -"have been printed, a traceback will be displayed. Because no HTML " -"interpretation is going on, the traceback will be readable." -msgstr "" - -#: ../../library/cgi.rst:530 -msgid "Common problems and solutions" -msgstr "" - -#: ../../library/cgi.rst:532 -msgid "" -"Most HTTP servers buffer the output from CGI scripts until the script is " -"completed. This means that it is not possible to display a progress report " -"on the client's display while the script is running." -msgstr "" - -#: ../../library/cgi.rst:536 -msgid "Check the installation instructions above." -msgstr "" - -#: ../../library/cgi.rst:538 -msgid "" -"Check the HTTP server's log files. (``tail -f logfile`` in a separate " -"window may be useful!)" -msgstr "" - -#: ../../library/cgi.rst:541 -msgid "" -"Always check a script for syntax errors first, by doing something like " -"``python script.py``." -msgstr "" - -#: ../../library/cgi.rst:544 -msgid "" -"If your script does not have any syntax errors, try adding ``import cgitb; " -"cgitb.enable()`` to the top of the script." -msgstr "" - -#: ../../library/cgi.rst:547 -msgid "" -"When invoking external programs, make sure they can be found. Usually, this " -"means using absolute path names --- :envvar:`PATH` is usually not set to a " -"very useful value in a CGI script." -msgstr "" - -#: ../../library/cgi.rst:551 -msgid "" -"When reading or writing external files, make sure they can be read or " -"written by the userid under which your CGI script will be running: this is " -"typically the userid under which the web server is running, or some " -"explicitly specified userid for a web server's ``suexec`` feature." -msgstr "" - -#: ../../library/cgi.rst:556 -msgid "" -"Don't try to give a CGI script a set-uid mode. This doesn't work on most " -"systems, and is a security liability as well." -msgstr "" - -#: ../../library/cgi.rst:560 -msgid "Footnotes" -msgstr "註解" - -#: ../../library/cgi.rst:561 -msgid "" -"Note that some recent versions of the HTML specification do state what order " -"the field values should be supplied in, but knowing whether a request was " -"received from a conforming browser, or even from a browser at all, is " -"tedious and error-prone." -msgstr "" - -#: ../../library/cgi.rst:10 -msgid "WWW" -msgstr "WWW" - -#: ../../library/cgi.rst:10 -msgid "server" -msgstr "server(伺服器)" - -#: ../../library/cgi.rst:10 ../../library/cgi.rst:389 ../../library/cgi.rst:462 -msgid "CGI" -msgstr "CGI" - -#: ../../library/cgi.rst:10 -msgid "protocol" -msgstr "protocol(協定)" - -#: ../../library/cgi.rst:10 -msgid "HTTP" -msgstr "HTTP" - -#: ../../library/cgi.rst:10 -msgid "MIME" -msgstr "MIME" - -#: ../../library/cgi.rst:10 -msgid "headers" -msgstr "headers(標頭)" - -#: ../../library/cgi.rst:10 -msgid "URL" -msgstr "URL(統一資源定位器)" - -#: ../../library/cgi.rst:10 -msgid "Common Gateway Interface" -msgstr "Common Gateway Interface(通用閘道器介面)" - -#: ../../library/cgi.rst:389 -msgid "security" -msgstr "security(安全)" - -#: ../../library/cgi.rst:462 -msgid "debugging" -msgstr "debugging(除錯)" diff --git a/library/cgitb.po b/library/cgitb.po deleted file mode 100644 index e608145917..0000000000 --- a/library/cgitb.po +++ /dev/null @@ -1,137 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2022-05-22 02:02+0800\n" -"Last-Translator: Liang-Bo Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/cgitb.rst:2 -msgid ":mod:`cgitb` --- Traceback manager for CGI scripts" -msgstr ":mod:`cgitb` --- CGI 腳本的回溯 (traceback) 管理程式" - -#: ../../library/cgitb.rst:11 -msgid "**Source code:** :source:`Lib/cgitb.py`" -msgstr "**原始碼:**\\ :source:`Lib/cgitb.py`" - -#: ../../library/cgitb.rst:19 -msgid "" -"The :mod:`cgitb` module is deprecated (see :pep:`PEP 594 <594#cgitb>` for " -"details)." -msgstr "" -":mod:`cgitb` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#cgitb>`\\ )。" - -#: ../../library/cgitb.rst:25 -msgid "" -"The :mod:`cgitb` module provides a special exception handler for Python " -"scripts. (Its name is a bit misleading. It was originally designed to " -"display extensive traceback information in HTML for CGI scripts. It was " -"later generalized to also display this information in plain text.) After " -"this module is activated, if an uncaught exception occurs, a detailed, " -"formatted report will be displayed. The report includes a traceback showing " -"excerpts of the source code for each level, as well as the values of the " -"arguments and local variables to currently running functions, to help you " -"debug the problem. Optionally, you can save this information to a file " -"instead of sending it to the browser." -msgstr "" - -#: ../../library/cgitb.rst:35 -msgid "To enable this feature, simply add this to the top of your CGI script::" -msgstr "" - -#: ../../library/cgitb.rst:37 -msgid "" -"import cgitb\n" -"cgitb.enable()" -msgstr "" -"import cgitb\n" -"cgitb.enable()" - -#: ../../library/cgitb.rst:40 -msgid "" -"The options to the :func:`enable` function control whether the report is " -"displayed in the browser and whether the report is logged to a file for " -"later analysis." -msgstr "" - -#: ../../library/cgitb.rst:49 -msgid "" -"This function causes the :mod:`cgitb` module to take over the interpreter's " -"default handling for exceptions by setting the value of :attr:`sys." -"excepthook`." -msgstr "" - -#: ../../library/cgitb.rst:52 -msgid "" -"The optional argument *display* defaults to ``1`` and can be set to ``0`` to " -"suppress sending the traceback to the browser. If the argument *logdir* is " -"present, the traceback reports are written to files. The value of *logdir* " -"should be a directory where these files will be placed. The optional " -"argument *context* is the number of lines of context to display around the " -"current line of source code in the traceback; this defaults to ``5``. If the " -"optional argument *format* is ``\"html\"``, the output is formatted as " -"HTML. Any other value forces plain text output. The default value is " -"``\"html\"``." -msgstr "" - -#: ../../library/cgitb.rst:64 -msgid "" -"This function handles the exception described by *info* (a 3-tuple " -"containing the result of :func:`sys.exc_info`), formatting its traceback as " -"text and returning the result as a string. The optional argument *context* " -"is the number of lines of context to display around the current line of " -"source code in the traceback; this defaults to ``5``." -msgstr "" - -#: ../../library/cgitb.rst:73 -msgid "" -"This function handles the exception described by *info* (a 3-tuple " -"containing the result of :func:`sys.exc_info`), formatting its traceback as " -"HTML and returning the result as a string. The optional argument *context* " -"is the number of lines of context to display around the current line of " -"source code in the traceback; this defaults to ``5``." -msgstr "" - -#: ../../library/cgitb.rst:82 -msgid "" -"This function handles an exception using the default settings (that is, show " -"a report in the browser, but don't log to a file). This can be used when " -"you've caught an exception and want to report it using :mod:`cgitb`. The " -"optional *info* argument should be a 3-tuple containing an exception type, " -"exception value, and traceback object, exactly like the tuple returned by :" -"func:`sys.exc_info`. If the *info* argument is not supplied, the current " -"exception is obtained from :func:`sys.exc_info`." -msgstr "" - -#: ../../library/cgitb.rst:13 -msgid "CGI" -msgstr "CGI" - -#: ../../library/cgitb.rst:13 -msgid "exceptions" -msgstr "exceptions(例外)" - -#: ../../library/cgitb.rst:13 -msgid "tracebacks" -msgstr "tracebacks(回溯)" - -#: ../../library/cgitb.rst:13 -msgid "in CGI scripts" -msgstr "於 CGI 腳本中" - -#: ../../library/cgitb.rst:47 -msgid "excepthook() (in module sys)" -msgstr "excepthook() (sys 模組中)" diff --git a/library/chunk.po b/library/chunk.po deleted file mode 100644 index 96bf1cfea3..0000000000 --- a/library/chunk.po +++ /dev/null @@ -1,225 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" -"PO-Revision-Date: 2022-05-22 02:03+0800\n" -"Last-Translator: Liang-Bo Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/chunk.rst:2 -msgid ":mod:`chunk` --- Read IFF chunked data" -msgstr ":mod:`chunk` --- 讀取 IFF 分塊資料" - -#: ../../library/chunk.rst:11 -msgid "**Source code:** :source:`Lib/chunk.py`" -msgstr "**原始碼:**\\ :source:`Lib/chunk.py`" - -#: ../../library/chunk.rst:20 -msgid "" -"The :mod:`chunk` module is deprecated (see :pep:`PEP 594 <594#chunk>` for " -"details)." -msgstr "" -":mod:`chunk` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#chunk>`\\ )。" - -#: ../../library/chunk.rst:26 -msgid "" -"This module provides an interface for reading files that use EA IFF 85 " -"chunks. [#]_ This format is used in at least the Audio Interchange File " -"Format (AIFF/AIFF-C) and the Real Media File Format (RMFF). The WAVE audio " -"file format is closely related and can also be read using this module." -msgstr "" - -#: ../../library/chunk.rst:31 -msgid "A chunk has the following structure:" -msgstr "" - -#: ../../library/chunk.rst:34 -msgid "Offset" -msgstr "" - -#: ../../library/chunk.rst:34 -msgid "Length" -msgstr "長度" - -#: ../../library/chunk.rst:34 -msgid "Contents" -msgstr "內容" - -#: ../../library/chunk.rst:36 -msgid "0" -msgstr "0" - -#: ../../library/chunk.rst:36 ../../library/chunk.rst:38 -msgid "4" -msgstr "4" - -#: ../../library/chunk.rst:36 -msgid "Chunk ID" -msgstr "" - -#: ../../library/chunk.rst:38 -msgid "Size of chunk in big-endian byte order, not including the header" -msgstr "" - -#: ../../library/chunk.rst:42 -msgid "8" -msgstr "8" - -#: ../../library/chunk.rst:42 -msgid "*n*" -msgstr "*n*" - -#: ../../library/chunk.rst:42 -msgid "Data bytes, where *n* is the size given in the preceding field" -msgstr "" - -#: ../../library/chunk.rst:46 -msgid "8 + *n*" -msgstr "8 + *n*" - -#: ../../library/chunk.rst:46 -msgid "0 or 1" -msgstr "0 或 1" - -#: ../../library/chunk.rst:46 -msgid "Pad byte needed if *n* is odd and chunk alignment is used" -msgstr "" - -#: ../../library/chunk.rst:50 -msgid "The ID is a 4-byte string which identifies the type of chunk." -msgstr "" - -#: ../../library/chunk.rst:52 -msgid "" -"The size field (a 32-bit value, encoded using big-endian byte order) gives " -"the size of the chunk data, not including the 8-byte header." -msgstr "" - -#: ../../library/chunk.rst:55 -msgid "" -"Usually an IFF-type file consists of one or more chunks. The proposed usage " -"of the :class:`Chunk` class defined here is to instantiate an instance at " -"the start of each chunk and read from the instance until it reaches the end, " -"after which a new instance can be instantiated. At the end of the file, " -"creating a new instance will fail with an :exc:`EOFError` exception." -msgstr "" - -#: ../../library/chunk.rst:64 -msgid "" -"Class which represents a chunk. The *file* argument is expected to be a " -"file-like object. An instance of this class is specifically allowed. The " -"only method that is needed is :meth:`~io.IOBase.read`. If the methods :meth:" -"`~io.IOBase.seek` and :meth:`~io.IOBase.tell` are present and don't raise an " -"exception, they are also used. If these methods are present and raise an " -"exception, they are expected to not have altered the object. If the " -"optional argument *align* is true, chunks are assumed to be aligned on 2-" -"byte boundaries. If *align* is false, no alignment is assumed. The default " -"value is true. If the optional argument *bigendian* is false, the chunk " -"size is assumed to be in little-endian order. This is needed for WAVE audio " -"files. The default value is true. If the optional argument *inclheader* is " -"true, the size given in the chunk header includes the size of the header. " -"The default value is false." -msgstr "" - -#: ../../library/chunk.rst:78 -msgid "A :class:`Chunk` object supports the following methods:" -msgstr "" - -#: ../../library/chunk.rst:83 -msgid "" -"Returns the name (ID) of the chunk. This is the first 4 bytes of the chunk." -msgstr "" - -#: ../../library/chunk.rst:89 -msgid "Returns the size of the chunk." -msgstr "" - -#: ../../library/chunk.rst:94 -msgid "" -"Close and skip to the end of the chunk. This does not close the underlying " -"file." -msgstr "" - -#: ../../library/chunk.rst:97 -msgid "" -"The remaining methods will raise :exc:`OSError` if called after the :meth:" -"`close` method has been called. Before Python 3.3, they used to raise :exc:" -"`IOError`, now an alias of :exc:`OSError`." -msgstr "" - -#: ../../library/chunk.rst:104 -msgid "Returns ``False``." -msgstr "" - -#: ../../library/chunk.rst:109 -msgid "" -"Set the chunk's current position. The *whence* argument is optional and " -"defaults to ``0`` (absolute file positioning); other values are ``1`` (seek " -"relative to the current position) and ``2`` (seek relative to the file's " -"end). There is no return value. If the underlying file does not allow seek, " -"only forward seeks are allowed." -msgstr "" - -#: ../../library/chunk.rst:118 -msgid "Return the current position into the chunk." -msgstr "" - -#: ../../library/chunk.rst:123 -msgid "" -"Read at most *size* bytes from the chunk (less if the read hits the end of " -"the chunk before obtaining *size* bytes). If the *size* argument is " -"negative or omitted, read all data until the end of the chunk. An empty " -"bytes object is returned when the end of the chunk is encountered " -"immediately." -msgstr "" - -#: ../../library/chunk.rst:132 -msgid "" -"Skip to the end of the chunk. All further calls to :meth:`read` for the " -"chunk will return ``b''``. If you are not interested in the contents of the " -"chunk, this method should be called so that the file points to the start of " -"the next chunk." -msgstr "" - -#: ../../library/chunk.rst:139 -msgid "Footnotes" -msgstr "註解" - -#: ../../library/chunk.rst:140 -msgid "" -"\"EA IFF 85\" Standard for Interchange Format Files, Jerry Morrison, " -"Electronic Arts, January 1985." -msgstr "" - -#: ../../library/chunk.rst:13 -msgid "Audio Interchange File Format" -msgstr "Audio Interchange File Format(音訊交換檔案格式)" - -#: ../../library/chunk.rst:13 -msgid "AIFF" -msgstr "AIFF" - -#: ../../library/chunk.rst:13 -msgid "AIFF-C" -msgstr "AIFF-C" - -#: ../../library/chunk.rst:13 -msgid "Real Media File Format" -msgstr "Real Media File Format(Real Media 檔案格式)" - -#: ../../library/chunk.rst:13 -msgid "RMFF" -msgstr "RMFF" diff --git a/library/cmdline.po b/library/cmdline.po index ed2fd4286f..4f84c320d2 100644 --- a/library/cmdline.po +++ b/library/cmdline.po @@ -154,9 +154,8 @@ msgid ":mod:`quopri`" msgstr ":mod:`quopri`" #: ../../library/cmdline.rst:39 -#, fuzzy msgid ":ref:`random `" -msgstr ":ref:`asyncio `" +msgstr ":ref:`random `" #: ../../library/cmdline.rst:40 msgid ":mod:`runpy`" diff --git a/library/compileall.po b/library/compileall.po index 2f8e76a53f..78cbc5fb98 100644 --- a/library/compileall.po +++ b/library/compileall.po @@ -37,16 +37,15 @@ msgstr "" #: ../../includes/wasm-notavail.rst:3 msgid ":ref:`Availability `: not WASI." -msgstr "" +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/compileall.rst:22 msgid "Command-line use" diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index 061f4dc950..1a8ea4d243 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -51,18 +51,16 @@ msgstr "" "相同的介面,該介面由抽象的 :class:`Executor` 類別定義。" #: ../../includes/wasm-notavail.rst:3 -#, fuzzy msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 Emscripten、非 WASI。" +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上沒有作用" -"或不可使用。更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/concurrent.futures.rst:25 msgid "Executor Objects" diff --git a/library/crypt.po b/library/crypt.po deleted file mode 100644 index 4f37bcb814..0000000000 --- a/library/crypt.po +++ /dev/null @@ -1,277 +0,0 @@ -# Copyright (C) 2001-2024, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2018-05-23 14:42+0000\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../../library/crypt.rst:2 -msgid ":mod:`crypt` --- Function to check Unix passwords" -msgstr ":mod:`crypt` --- 用於檢查 Unix 密碼的函式" - -#: ../../library/crypt.rst:13 -msgid "**Source code:** :source:`Lib/crypt.py`" -msgstr "**原始碼:**\\ :source:`Lib/crypt.py`" - -#: ../../library/crypt.rst:19 -msgid "" -"The :mod:`crypt` module is deprecated (see :pep:`PEP 594 <594#crypt>` for " -"details and alternatives). The :mod:`hashlib` module is a potential " -"replacement for certain use cases. The :pypi:`passlib` package can replace " -"all use cases of this module." -msgstr "" - -#: ../../library/crypt.rst:27 -msgid "" -"This module implements an interface to the :manpage:`crypt(3)` routine, " -"which is a one-way hash function based upon a modified DES algorithm; see " -"the Unix man page for further details. Possible uses include storing hashed " -"passwords so you can check passwords without storing the actual password, or " -"attempting to crack Unix passwords with a dictionary." -msgstr "" - -#: ../../library/crypt.rst:35 -msgid "" -"Notice that the behavior of this module depends on the actual " -"implementation of the :manpage:`crypt(3)` routine in the running system. " -"Therefore, any extensions available on the current implementation will also " -"be available on this module." -msgstr "" - -#: ../../library/crypt.rst:40 -msgid ":ref:`Availability `: Unix, not VxWorks." -msgstr ":ref:`適用 `:Unix,非 VxWorks。" - -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: ../../includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" - -#: ../../library/crypt.rst:45 -msgid "Hashing Methods" -msgstr "雜湊方法" - -#: ../../library/crypt.rst:49 -msgid "" -"The :mod:`crypt` module defines the list of hashing methods (not all methods " -"are available on all platforms):" -msgstr "" - -#: ../../library/crypt.rst:54 -msgid "" -"A Modular Crypt Format method with 16 character salt and 86 character hash " -"based on the SHA-512 hash function. This is the strongest method." -msgstr "" - -#: ../../library/crypt.rst:59 -msgid "" -"Another Modular Crypt Format method with 16 character salt and 43 character " -"hash based on the SHA-256 hash function." -msgstr "" - -#: ../../library/crypt.rst:64 -msgid "" -"Another Modular Crypt Format method with 22 character salt and 31 character " -"hash based on the Blowfish cipher." -msgstr "" - -#: ../../library/crypt.rst:71 -msgid "" -"Another Modular Crypt Format method with 8 character salt and 22 character " -"hash based on the MD5 hash function." -msgstr "" - -#: ../../library/crypt.rst:76 -msgid "" -"The traditional method with a 2 character salt and 13 characters of hash. " -"This is the weakest method." -msgstr "" - -#: ../../library/crypt.rst:81 -msgid "Module Attributes" -msgstr "模組屬性" - -#: ../../library/crypt.rst:87 -msgid "" -"A list of available password hashing algorithms, as ``crypt.METHOD_*`` " -"objects. This list is sorted from strongest to weakest." -msgstr "" - -#: ../../library/crypt.rst:93 -msgid "Module Functions" -msgstr "模組函式" - -#: ../../library/crypt.rst:95 -msgid "The :mod:`crypt` module defines the following functions:" -msgstr ":mod:`crypt` 模組定義了以下函式:" - -#: ../../library/crypt.rst:99 -msgid "" -"*word* will usually be a user's password as typed at a prompt or in a " -"graphical interface. The optional *salt* is either a string as returned " -"from :func:`mksalt`, one of the ``crypt.METHOD_*`` values (though not all " -"may be available on all platforms), or a full encrypted password including " -"salt, as returned by this function. If *salt* is not provided, the " -"strongest method available in :attr:`methods` will be used." -msgstr "" - -#: ../../library/crypt.rst:106 -msgid "" -"Checking a password is usually done by passing the plain-text password as " -"*word* and the full results of a previous :func:`crypt` call, which should " -"be the same as the results of this call." -msgstr "" - -#: ../../library/crypt.rst:110 -msgid "" -"*salt* (either a random 2 or 16 character string, possibly prefixed with " -"``$digit$`` to indicate the method) which will be used to perturb the " -"encryption algorithm. The characters in *salt* must be in the set ``[./a-zA-" -"Z0-9]``, with the exception of Modular Crypt Format which prefixes a " -"``$digit$``." -msgstr "" - -#: ../../library/crypt.rst:116 -msgid "" -"Returns the hashed password as a string, which will be composed of " -"characters from the same alphabet as the salt." -msgstr "" - -#: ../../library/crypt.rst:121 -msgid "" -"Since a few :manpage:`crypt(3)` extensions allow different values, with " -"different sizes in the *salt*, it is recommended to use the full crypted " -"password as salt when checking for a password." -msgstr "" - -#: ../../library/crypt.rst:125 -msgid "Accept ``crypt.METHOD_*`` values in addition to strings for *salt*." -msgstr "" - -#: ../../library/crypt.rst:131 -msgid "" -"Return a randomly generated salt of the specified method. If no *method* is " -"given, the strongest method available in :attr:`methods` is used." -msgstr "" - -#: ../../library/crypt.rst:135 -msgid "" -"The return value is a string suitable for passing as the *salt* argument to :" -"func:`crypt`." -msgstr "" - -#: ../../library/crypt.rst:138 -msgid "" -"*rounds* specifies the number of rounds for ``METHOD_SHA256``, " -"``METHOD_SHA512`` and ``METHOD_BLOWFISH``. For ``METHOD_SHA256`` and " -"``METHOD_SHA512`` it must be an integer between ``1000`` and " -"``999_999_999``, the default is ``5000``. For ``METHOD_BLOWFISH`` it must " -"be a power of two between ``16`` (2\\ :sup:`4`) and ``2_147_483_648`` (2\\ :" -"sup:`31`), the default is ``4096`` (2\\ :sup:`12`)." -msgstr "" - -#: ../../library/crypt.rst:148 -msgid "Added the *rounds* parameter." -msgstr "新增 *rounds* 參數。" - -#: ../../library/crypt.rst:153 -msgid "Examples" -msgstr "範例" - -#: ../../library/crypt.rst:155 -msgid "" -"A simple example illustrating typical use (a constant-time comparison " -"operation is needed to limit exposure to timing attacks. :func:`hmac." -"compare_digest` is suitable for this purpose)::" -msgstr "" - -#: ../../library/crypt.rst:159 -msgid "" -"import pwd\n" -"import crypt\n" -"import getpass\n" -"from hmac import compare_digest as compare_hash\n" -"\n" -"def login():\n" -" username = input('Python login: ')\n" -" cryptedpasswd = pwd.getpwnam(username)[1]\n" -" if cryptedpasswd:\n" -" if cryptedpasswd == 'x' or cryptedpasswd == '*':\n" -" raise ValueError('no support for shadow passwords')\n" -" cleartext = getpass.getpass()\n" -" return compare_hash(crypt.crypt(cleartext, cryptedpasswd), " -"cryptedpasswd)\n" -" else:\n" -" return True" -msgstr "" -"import pwd\n" -"import crypt\n" -"import getpass\n" -"from hmac import compare_digest as compare_hash\n" -"\n" -"def login():\n" -" username = input('Python login: ')\n" -" cryptedpasswd = pwd.getpwnam(username)[1]\n" -" if cryptedpasswd:\n" -" if cryptedpasswd == 'x' or cryptedpasswd == '*':\n" -" raise ValueError('no support for shadow passwords')\n" -" cleartext = getpass.getpass()\n" -" return compare_hash(crypt.crypt(cleartext, cryptedpasswd), " -"cryptedpasswd)\n" -" else:\n" -" return True" - -#: ../../library/crypt.rst:175 -msgid "" -"To generate a hash of a password using the strongest available method and " -"check it against the original::" -msgstr "" - -#: ../../library/crypt.rst:178 -msgid "" -"import crypt\n" -"from hmac import compare_digest as compare_hash\n" -"\n" -"hashed = crypt.crypt(plaintext)\n" -"if not compare_hash(hashed, crypt.crypt(plaintext, hashed)):\n" -" raise ValueError(\"hashed version doesn't validate against original\")" -msgstr "" -"import crypt\n" -"from hmac import compare_digest as compare_hash\n" -"\n" -"hashed = crypt.crypt(plaintext)\n" -"if not compare_hash(hashed, crypt.crypt(plaintext, hashed)):\n" -" raise ValueError(\"hashed version doesn't validate against original\")" - -#: ../../library/crypt.rst:15 ../../library/crypt.rst:33 -#: ../../library/crypt.rst:119 -msgid "crypt(3)" -msgstr "crypt(3)" - -#: ../../library/crypt.rst:15 -msgid "cipher" -msgstr "cipher" - -#: ../../library/crypt.rst:15 -msgid "DES" -msgstr "DES" diff --git a/library/ctypes.po b/library/ctypes.po index 048c245976..4d41b963bb 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-04-26 02:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -83,8 +83,8 @@ msgstr "" #: ../../library/ctypes.rst:53 msgid "" "Here are some examples for Windows. Note that ``msvcrt`` is the MS standard " -"C library containing most standard C functions, and uses the cdecl calling " -"convention::" +"C library containing most standard C functions, and uses the ``cdecl`` " +"calling convention::" msgstr "" #: ../../library/ctypes.rst:57 diff --git a/library/curses.po b/library/curses.po index e2707a4f1a..0640ee51c5 100644 --- a/library/curses.po +++ b/library/curses.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -40,17 +40,17 @@ msgid "" "curses library hosted on Linux and the BSD variants of Unix." msgstr "" -#: ../../includes/wasm-ios-notavail.rst:3 -msgid ":ref:`Availability `: not WASI, not iOS." -msgstr "" +#: ../../includes/wasm-mobile-notavail.rst:3 +msgid ":ref:`Availability `: not Android, not iOS, not WASI." +msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" -#: ../../includes/wasm-ios-notavail.rst:5 +#: ../../includes/wasm-mobile-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms, or " -"on iOS. See :ref:`wasm-availability` for more information on WASM " -"availability; see :ref:`iOS-availability` for more information on iOS " -"availability." +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" +"此模組在\\ :ref:`行動平台 `\\ 或\\ :ref:`WebAssembly 平" +"台 `\\ 上不支援。" #: ../../library/curses.rst:28 msgid "" diff --git a/library/dbm.po b/library/dbm.po index c93cd0d4b0..d8cdda7b2e 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,21 +27,20 @@ msgid "**Source code:** :source:`Lib/dbm/__init__.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/__init__.py`" #: ../../library/dbm.rst:11 -#, fuzzy msgid ":mod:`dbm` is a generic interface to variants of the DBM database:" -msgstr ":mod:`!dbm` --- Unix \"databases\" 的介面" +msgstr "" #: ../../library/dbm.rst:13 msgid ":mod:`dbm.sqlite3`" -msgstr "" +msgstr ":mod:`dbm.sqlite3`" #: ../../library/dbm.rst:14 msgid ":mod:`dbm.gnu`" -msgstr "" +msgstr ":mod:`dbm.gnu`" #: ../../library/dbm.rst:15 msgid ":mod:`dbm.ndbm`" -msgstr "" +msgstr ":mod:`dbm.ndbm`" #: ../../library/dbm.rst:17 msgid "" @@ -50,56 +49,44 @@ msgid "" "`_ to the Oracle Berkeley DB." msgstr "" -#: ../../includes/wasm-ios-notavail.rst:3 -msgid ":ref:`Availability `: not WASI, not iOS." -msgstr "" - -#: ../../includes/wasm-ios-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms, or " -"on iOS. See :ref:`wasm-availability` for more information on WASM " -"availability; see :ref:`iOS-availability` for more information on iOS " -"availability." -msgstr "" - -#: ../../library/dbm.rst:26 +#: ../../library/dbm.rst:24 msgid "" "A tuple containing the exceptions that can be raised by each of the " "supported modules, with a unique exception also named :exc:`dbm.error` as " "the first item --- the latter is used when :exc:`dbm.error` is raised." msgstr "" -#: ../../library/dbm.rst:33 +#: ../../library/dbm.rst:31 msgid "" "This function attempts to guess which of the several simple database modules " "available --- :mod:`dbm.sqlite3`, :mod:`dbm.gnu`, :mod:`dbm.ndbm`, or :mod:" "`dbm.dumb` --- should be used to open a given file." msgstr "" -#: ../../library/dbm.rst:37 +#: ../../library/dbm.rst:35 msgid "Return one of the following values:" msgstr "回傳以下其中一個值:" -#: ../../library/dbm.rst:39 +#: ../../library/dbm.rst:37 msgid "" "``None`` if the file can't be opened because it's unreadable or doesn't exist" msgstr "" -#: ../../library/dbm.rst:40 +#: ../../library/dbm.rst:38 msgid "the empty string (``''``) if the file's format can't be guessed" msgstr "" -#: ../../library/dbm.rst:41 +#: ../../library/dbm.rst:39 msgid "" "a string containing the required module name, such as ``'dbm.ndbm'`` or " "``'dbm.gnu'``" msgstr "" -#: ../../library/dbm.rst:43 ../../library/dbm.rst:248 ../../library/dbm.rst:444 +#: ../../library/dbm.rst:41 ../../library/dbm.rst:250 ../../library/dbm.rst:448 msgid "*filename* accepts a :term:`path-like object`." msgstr "" -#: ../../library/dbm.rst:67 +#: ../../library/dbm.rst:65 msgid "Open a database and return the corresponding database object." msgstr "" @@ -107,7 +94,7 @@ msgstr "" msgid "Parameters" msgstr "參數" -#: ../../library/dbm.rst:69 +#: ../../library/dbm.rst:67 msgid "" "The database file to open. If the database file already exists, the :func:" "`whichdb` function is used to determine its type and the appropriate module " @@ -115,18 +102,18 @@ msgid "" "imported is used." msgstr "" -#: ../../library/dbm.rst:70 ../../library/dbm.rst:220 +#: ../../library/dbm.rst:68 ../../library/dbm.rst:222 msgid "The database file to open." msgstr "要打開的資料庫檔案" -#: ../../library/dbm.rst:72 +#: ../../library/dbm.rst:70 msgid "" "If the database file already exists, the :func:`whichdb` function is used to " "determine its type and the appropriate module is used; if it does not exist, " "the first submodule listed above that can be imported is used." msgstr "" -#: ../../library/dbm.rst:77 ../../library/dbm.rst:178 ../../library/dbm.rst:349 +#: ../../library/dbm.rst:75 ../../library/dbm.rst:178 ../../library/dbm.rst:353 msgid "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n|" @@ -134,36 +121,36 @@ msgstr "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n|" -#: ../../library/dbm.rst:78 ../../library/dbm.rst:180 ../../library/dbm.rst:225 -#: ../../library/dbm.rst:350 +#: ../../library/dbm.rst:76 ../../library/dbm.rst:180 ../../library/dbm.rst:227 +#: ../../library/dbm.rst:354 msgid "``'r'`` (default): |flag_r|" msgstr "``'r'`` (default): |flag_r|" -#: ../../library/dbm.rst:79 ../../library/dbm.rst:181 ../../library/dbm.rst:226 -#: ../../library/dbm.rst:351 ../../library/dbm.rst:425 +#: ../../library/dbm.rst:77 ../../library/dbm.rst:181 ../../library/dbm.rst:228 +#: ../../library/dbm.rst:355 ../../library/dbm.rst:429 msgid "``'w'``: |flag_w|" msgstr "``'w'``: |flag_w|" -#: ../../library/dbm.rst:80 ../../library/dbm.rst:182 ../../library/dbm.rst:227 -#: ../../library/dbm.rst:352 +#: ../../library/dbm.rst:78 ../../library/dbm.rst:182 ../../library/dbm.rst:229 +#: ../../library/dbm.rst:356 msgid "``'c'``: |flag_c|" msgstr "``'c'``: |flag_c|" -#: ../../library/dbm.rst:81 ../../library/dbm.rst:183 ../../library/dbm.rst:228 -#: ../../library/dbm.rst:353 ../../library/dbm.rst:427 +#: ../../library/dbm.rst:79 ../../library/dbm.rst:183 ../../library/dbm.rst:230 +#: ../../library/dbm.rst:357 ../../library/dbm.rst:431 msgid "``'n'``: |flag_n|" msgstr "``'n'``: |flag_n|" -#: ../../library/dbm.rst:83 ../../library/dbm.rst:242 ../../library/dbm.rst:355 -#: ../../library/dbm.rst:429 +#: ../../library/dbm.rst:81 ../../library/dbm.rst:244 ../../library/dbm.rst:359 +#: ../../library/dbm.rst:433 msgid "|mode_param_doc|" msgstr "|mode_param_doc|" -#: ../../library/dbm.rst:86 +#: ../../library/dbm.rst:84 msgid "*file* accepts a :term:`path-like object`." msgstr "*file* 接受一個\\ :term:`類路徑物件 `。" -#: ../../library/dbm.rst:89 +#: ../../library/dbm.rst:87 msgid "" "The object returned by :func:`~dbm.open` supports the same basic " "functionality as a :class:`dict`; keys and their corresponding values can be " @@ -172,44 +159,44 @@ msgid "" "setdefault` methods." msgstr "" -#: ../../library/dbm.rst:94 +#: ../../library/dbm.rst:92 msgid "" "Key and values are always stored as :class:`bytes`. This means that when " "strings are used they are implicitly converted to the default encoding " "before being stored." msgstr "" -#: ../../library/dbm.rst:98 +#: ../../library/dbm.rst:96 msgid "" "These objects also support being used in a :keyword:`with` statement, which " "will automatically close them when done." msgstr "" -#: ../../library/dbm.rst:101 +#: ../../library/dbm.rst:99 msgid "" ":meth:`!get` and :meth:`!setdefault` methods are now available for all :mod:" "`dbm` backends." msgstr "" -#: ../../library/dbm.rst:105 +#: ../../library/dbm.rst:103 msgid "" "Added native support for the context management protocol to the objects " "returned by :func:`~dbm.open`." msgstr "" -#: ../../library/dbm.rst:109 +#: ../../library/dbm.rst:107 msgid "" "Deleting a key from a read-only database raises a database module specific " "exception instead of :exc:`KeyError`." msgstr "" -#: ../../library/dbm.rst:113 +#: ../../library/dbm.rst:111 msgid "" "The following example records some hostnames and a corresponding title, and " "then prints out the contents of the database::" msgstr "" -#: ../../library/dbm.rst:116 +#: ../../library/dbm.rst:114 msgid "" "import dbm\n" "\n" @@ -236,28 +223,27 @@ msgid "" "# db is automatically closed when leaving the with statement." msgstr "" -#: ../../library/dbm.rst:143 +#: ../../library/dbm.rst:141 msgid "Module :mod:`shelve`" msgstr ":mod:`shelve` 模組" -#: ../../library/dbm.rst:144 +#: ../../library/dbm.rst:142 msgid "Persistence module which stores non-string data." msgstr "" -#: ../../library/dbm.rst:147 +#: ../../library/dbm.rst:145 msgid "The individual submodules are described in the following sections." msgstr "" -#: ../../library/dbm.rst:150 +#: ../../library/dbm.rst:148 msgid ":mod:`dbm.sqlite3` --- SQLite backend for dbm" msgstr "" -#: ../../library/dbm.rst:158 -#, fuzzy +#: ../../library/dbm.rst:156 msgid "**Source code:** :source:`Lib/dbm/sqlite3.py`" -msgstr "**原始碼:**\\ :source:`Lib/dbm/gnu.py`" +msgstr "**原始碼:**\\ :source:`Lib/dbm/sqlite3.py`" -#: ../../library/dbm.rst:162 +#: ../../library/dbm.rst:160 msgid "" "This module uses the standard library :mod:`sqlite3` module to provide an " "SQLite backend for the :mod:`dbm` module. The files created by :mod:`dbm." @@ -265,6 +251,18 @@ msgid "" "including the SQLite CLI." msgstr "" +#: ../../includes/wasm-notavail.rst:3 +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." +msgstr "" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" + #: ../../library/dbm.rst:169 msgid "" "Open an SQLite database. The returned object behaves like a :term:`mapping`, " @@ -273,9 +271,8 @@ msgid "" msgstr "" #: ../../library/dbm.rst:174 -#, fuzzy msgid "The path to the database to be opened." -msgstr "要打開的資料庫檔案" +msgstr "要打開的資料庫路徑" #: ../../library/dbm.rst:185 msgid "" @@ -298,24 +295,36 @@ msgid "" "functionality like crash tolerance." msgstr "" -#: ../../library/dbm.rst:207 ../../library/dbm.rst:319 +#: ../../library/dbm.rst:207 ../../library/dbm.rst:321 msgid "" "The file formats created by :mod:`dbm.gnu` and :mod:`dbm.ndbm` are " "incompatible and can not be used interchangeably." msgstr "" -#: ../../library/dbm.rst:212 +#: ../../includes/wasm-mobile-notavail.rst:3 +msgid ":ref:`Availability `: not Android, not iOS, not WASI." +msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" + +#: ../../includes/wasm-mobile-notavail.rst:5 +msgid "" +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." +msgstr "" +"此模組在\\ :ref:`行動平台 `\\ 或\\ :ref:`WebAssembly 平" +"台 `\\ 上不支援。" + +#: ../../library/dbm.rst:214 msgid "" "Raised on :mod:`dbm.gnu`-specific errors, such as I/O errors. :exc:" "`KeyError` is raised for general mapping errors like specifying an incorrect " "key." msgstr "" -#: ../../library/dbm.rst:218 +#: ../../library/dbm.rst:220 msgid "Open a GDBM database and return a :class:`!gdbm` object." msgstr "" -#: ../../library/dbm.rst:224 +#: ../../library/dbm.rst:226 msgid "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n| The following additional characters may be appended to " @@ -327,29 +336,29 @@ msgid "" "flag characters." msgstr "" -#: ../../library/dbm.rst:230 +#: ../../library/dbm.rst:232 msgid "" "The following additional characters may be appended to control how the " "database is opened:" msgstr "" -#: ../../library/dbm.rst:233 +#: ../../library/dbm.rst:235 msgid "" "``'f'``: Open the database in fast mode. Writes to the database will not be " "synchronized." msgstr "" -#: ../../library/dbm.rst:235 +#: ../../library/dbm.rst:237 msgid "" "``'s'``: Synchronized mode. Changes to the database will be written " "immediately to the file." msgstr "" -#: ../../library/dbm.rst:237 +#: ../../library/dbm.rst:239 msgid "``'u'``: Do not lock database." msgstr "``'u'``: 不要鎖住資料庫。" -#: ../../library/dbm.rst:239 +#: ../../library/dbm.rst:241 msgid "" "Not all flags are valid for all versions of GDBM. See the :data:`open_flags` " "member for a list of supported flag characters." @@ -359,24 +368,24 @@ msgstr "" msgid "Raises" msgstr "引發" -#: ../../library/dbm.rst:245 +#: ../../library/dbm.rst:247 msgid "If an invalid *flag* argument is passed." msgstr "如果一個無效的 *flag* 引數被傳入。" -#: ../../library/dbm.rst:253 +#: ../../library/dbm.rst:255 msgid "" "A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` " "supports." msgstr "" -#: ../../library/dbm.rst:255 +#: ../../library/dbm.rst:257 msgid "" ":class:`!gdbm` objects behave similar to :term:`mappings `, but :" "meth:`!items` and :meth:`!values` methods are not supported. The following " "methods are also provided:" msgstr "" -#: ../../library/dbm.rst:261 +#: ../../library/dbm.rst:263 msgid "" "It's possible to loop over every key in the database using this method and " "the :meth:`nextkey` method. The traversal is ordered by GDBM's internal " @@ -384,14 +393,14 @@ msgid "" "starting key." msgstr "" -#: ../../library/dbm.rst:268 +#: ../../library/dbm.rst:270 msgid "" "Returns the key that follows *key* in the traversal. The following code " "prints every key in the database ``db``, without having to create a list in " "memory that contains them all::" msgstr "" -#: ../../library/dbm.rst:272 +#: ../../library/dbm.rst:274 msgid "" "k = db.firstkey()\n" "while k is not None:\n" @@ -403,7 +412,7 @@ msgstr "" " print(k)\n" " k = db.nextkey(k)" -#: ../../library/dbm.rst:279 +#: ../../library/dbm.rst:281 msgid "" "If you have carried out a lot of deletions and would like to shrink the " "space used by the GDBM file, this routine will reorganize the database. :" @@ -412,37 +421,36 @@ msgid "" "reused as new (key, value) pairs are added." msgstr "" -#: ../../library/dbm.rst:287 +#: ../../library/dbm.rst:289 msgid "" "When the database has been opened in fast mode, this method forces any " "unwritten data to be written to the disk." msgstr "" -#: ../../library/dbm.rst:292 +#: ../../library/dbm.rst:294 msgid "Close the GDBM database." msgstr "關閉 GDBM 資料庫。" -#: ../../library/dbm.rst:296 -#, fuzzy +#: ../../library/dbm.rst:298 msgid "Remove all items from the GDBM database." -msgstr "關閉 GDBM 資料庫。" +msgstr "移除 GDBM 資料庫中所有項目。" -#: ../../library/dbm.rst:302 +#: ../../library/dbm.rst:304 msgid ":mod:`dbm.ndbm` --- New Database Manager" msgstr ":mod:`dbm.ndbm` --- 新資料庫管理器" -#: ../../library/dbm.rst:308 +#: ../../library/dbm.rst:310 msgid "**Source code:** :source:`Lib/dbm/ndbm.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/ndbm.py`" -#: ../../library/dbm.rst:312 +#: ../../library/dbm.rst:314 msgid "" "The :mod:`dbm.ndbm` module provides an interface to the :abbr:`NDBM (New " "Database Manager)` library. This module can be used with the \"classic\" " "NDBM interface or the :abbr:`GDBM (GNU dbm)` compatibility interface." msgstr "" -#: ../../library/dbm.rst:324 +#: ../../library/dbm.rst:326 msgid "" "The NDBM library shipped as part of macOS has an undocumented limitation on " "the size of values, which can result in corrupted database files when " @@ -450,56 +458,55 @@ msgid "" "result in a hard crash (segmentation fault)." msgstr "" -#: ../../library/dbm.rst:331 +#: ../../library/dbm.rst:335 msgid "" "Raised on :mod:`dbm.ndbm`-specific errors, such as I/O errors. :exc:" "`KeyError` is raised for general mapping errors like specifying an incorrect " "key." msgstr "" -#: ../../library/dbm.rst:337 +#: ../../library/dbm.rst:341 msgid "Name of the NDBM implementation library used." msgstr "" -#: ../../library/dbm.rst:342 +#: ../../library/dbm.rst:346 msgid "Open an NDBM database and return an :class:`!ndbm` object." msgstr "" -#: ../../library/dbm.rst:344 +#: ../../library/dbm.rst:348 msgid "" "The basename of the database file (without the :file:`.dir` or :file:`.pag` " "extensions)." msgstr "" -#: ../../library/dbm.rst:358 +#: ../../library/dbm.rst:362 msgid "" ":class:`!ndbm` objects behave similar to :term:`mappings `, but :" "meth:`!items` and :meth:`!values` methods are not supported. The following " "methods are also provided:" msgstr "" -#: ../../library/dbm.rst:362 +#: ../../library/dbm.rst:366 msgid "Accepts :term:`path-like object` for filename." msgstr "" -#: ../../library/dbm.rst:367 +#: ../../library/dbm.rst:371 msgid "Close the NDBM database." msgstr "關閉 NDBM 資料庫。" -#: ../../library/dbm.rst:371 -#, fuzzy +#: ../../library/dbm.rst:375 msgid "Remove all items from the NDBM database." -msgstr "關閉 NDBM 資料庫。" +msgstr "移除 NDBM 資料庫中所有項目。" -#: ../../library/dbm.rst:377 +#: ../../library/dbm.rst:381 msgid ":mod:`dbm.dumb` --- Portable DBM implementation" msgstr ":mod:`dbm.dumb` --- 可攜式 DBM 實作" -#: ../../library/dbm.rst:382 +#: ../../library/dbm.rst:386 msgid "**Source code:** :source:`Lib/dbm/dumb.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/dumb.py`" -#: ../../library/dbm.rst:388 +#: ../../library/dbm.rst:392 msgid "" "The :mod:`dbm.dumb` module is intended as a last resort fallback for the :" "mod:`dbm` module when a more robust module is not available. The :mod:`dbm." @@ -507,53 +514,53 @@ msgid "" "the other database modules." msgstr "" -#: ../../library/dbm.rst:395 +#: ../../library/dbm.rst:399 msgid "" "The :mod:`dbm.dumb` module provides a persistent :class:`dict`-like " "interface which is written entirely in Python. Unlike other :mod:`dbm` " "backends, such as :mod:`dbm.gnu`, no external library is required." msgstr "" -#: ../../library/dbm.rst:400 +#: ../../library/dbm.rst:404 msgid "The :mod:`!dbm.dumb` module defines the following:" msgstr ":mod:`!dbm.dumb` 模組定義了以下項目:" -#: ../../library/dbm.rst:404 +#: ../../library/dbm.rst:408 msgid "" "Raised on :mod:`dbm.dumb`-specific errors, such as I/O errors. :exc:" "`KeyError` is raised for general mapping errors like specifying an incorrect " "key." msgstr "" -#: ../../library/dbm.rst:410 +#: ../../library/dbm.rst:414 msgid "" "Open a :mod:`!dbm.dumb` database. The returned database object behaves " "similar to a :term:`mapping`, in addition to providing :meth:`~dumbdbm.sync` " "and :meth:`~dumbdbm.close` methods." msgstr "" -#: ../../library/dbm.rst:415 +#: ../../library/dbm.rst:419 msgid "" "The basename of the database file (without extensions). A new database " "creates the following files: - :file:`{filename}.dat` - :file:`{filename}." "dir`" msgstr "" -#: ../../library/dbm.rst:416 +#: ../../library/dbm.rst:420 msgid "" "The basename of the database file (without extensions). A new database " "creates the following files:" msgstr "" -#: ../../library/dbm.rst:419 +#: ../../library/dbm.rst:423 msgid ":file:`{filename}.dat`" msgstr ":file:`{filename}.dat`" -#: ../../library/dbm.rst:420 +#: ../../library/dbm.rst:424 msgid ":file:`{filename}.dir`" msgstr ":file:`{filename}.dir`" -#: ../../library/dbm.rst:423 +#: ../../library/dbm.rst:427 msgid "" "* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (default): |flag_c| * " "``'n'``: |flag_n|" @@ -561,49 +568,49 @@ msgstr "" "* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (default): |flag_c| * " "``'n'``: |flag_n|" -#: ../../library/dbm.rst:424 +#: ../../library/dbm.rst:428 msgid "``'r'``: |flag_r|" msgstr "``'r'``: |flag_r|" -#: ../../library/dbm.rst:426 +#: ../../library/dbm.rst:430 msgid "``'c'`` (default): |flag_c|" msgstr "``'c'`` (default): |flag_c|" -#: ../../library/dbm.rst:433 +#: ../../library/dbm.rst:437 msgid "" "It is possible to crash the Python interpreter when loading a database with " "a sufficiently large/complex entry due to stack depth limitations in " "Python's AST compiler." msgstr "" -#: ../../library/dbm.rst:437 +#: ../../library/dbm.rst:441 msgid "" ":func:`~dbm.dumb.open` always creates a new database when *flag* is ``'n'``." msgstr "" -#: ../../library/dbm.rst:440 +#: ../../library/dbm.rst:444 msgid "" "A database opened read-only if *flag* is ``'r'``. A database is not created " "if it does not exist if *flag* is ``'r'`` or ``'w'``." msgstr "" -#: ../../library/dbm.rst:447 +#: ../../library/dbm.rst:451 msgid "" "In addition to the methods provided by the :class:`collections.abc." "MutableMapping` class, the following methods are provided:" msgstr "" -#: ../../library/dbm.rst:453 +#: ../../library/dbm.rst:457 msgid "" "Synchronize the on-disk directory and data files. This method is called by " "the :meth:`Shelve.sync` method." msgstr "" -#: ../../library/dbm.rst:458 +#: ../../library/dbm.rst:462 msgid "Close the database." msgstr "關閉資料庫。" -#: ../../library/dbm.rst:384 +#: ../../library/dbm.rst:388 msgid "databases" msgstr "databases(資料庫)" diff --git a/library/ensurepip.po b/library/ensurepip.po index 8b2bc4d453..0c3867c9a3 100644 --- a/library/ensurepip.po +++ b/library/ensurepip.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -75,20 +75,17 @@ msgstr ":pep:`453`: 在 Python 安裝中的 pip 明確初始建置" msgid "The original rationale and specification for this module." msgstr "此模組的最初設計理念與規範。" -#: ../../includes/wasm-ios-notavail.rst:3 -msgid ":ref:`Availability `: not WASI, not iOS." -msgstr "" +#: ../../includes/wasm-mobile-notavail.rst:3 +msgid ":ref:`Availability `: not Android, not iOS, not WASI." +msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" -#: ../../includes/wasm-ios-notavail.rst:5 -#, fuzzy +#: ../../includes/wasm-mobile-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms, or " -"on iOS. See :ref:`wasm-availability` for more information on WASM " -"availability; see :ref:`iOS-availability` for more information on iOS " -"availability." +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在\\ :ref:`行動平台 `\\ 或\\ :ref:`WebAssembly 平" +"台 `\\ 上不支援。" #: ../../library/ensurepip.rst:44 msgid "Command line interface" @@ -273,3 +270,13 @@ msgstr "" "初始建置的過程也許會安裝 ``pip`` 所需要的額外的模組,但其他軟體不應該假設這些" "相依 (dependency) 總是預設存在(因為這些相依很可能會在未來版本的 ``pip`` 中被" "移除)。" + +#, fuzzy +#~ msgid "" +#~ "This module does not work or is not available on WebAssembly platforms, " +#~ "or on iOS. See :ref:`wasm-availability` for more information on WASM " +#~ "availability; see :ref:`iOS-availability` for more information on iOS " +#~ "availability." +#~ msgstr "" +#~ "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法" +#~ "作用或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/exceptions.po b/library/exceptions.po index 836c4bee5c..eb2e321fa6 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -645,7 +645,7 @@ msgstr "" #: ../../library/exceptions.rst:429 msgid ":func:`os.fork`." -msgstr "" +msgstr ":func:`os.fork`。" #: ../../library/exceptions.rst:431 msgid "See also the :func:`sys.is_finalizing` function." diff --git a/library/ftplib.po b/library/ftplib.po index b0dac40c3a..5f1ac72eb1 100644 --- a/library/ftplib.po +++ b/library/ftplib.po @@ -50,13 +50,12 @@ msgid ":ref:`Availability `: not WASI." msgstr ":ref:`Availability `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上不起作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/ftplib.rst:26 msgid "Here's a sample session using the :mod:`ftplib` module::" diff --git a/library/functools.po b/library/functools.po index 280a86fb33..cc8ce0e7f8 100644 --- a/library/functools.po +++ b/library/functools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2024-05-11 16:02+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -394,10 +394,9 @@ msgstr "" "cache-method-calls`" #: ../../library/functools.rst:220 -#, fuzzy msgid "" "An `LRU (least recently used) cache `_ works best when the " +"Cache_replacement_policies#Least_Recently_Used_(LRU)>`_ works best when the " "most recent calls are the best predictors of upcoming calls (for example, " "the most popular articles on a news server tend to change each day). The " "cache's size limit assures that the cache does not grow without bound on " diff --git a/library/getpass.po b/library/getpass.po index 19177262cd..c1301e9377 100644 --- a/library/getpass.po +++ b/library/getpass.po @@ -29,16 +29,15 @@ msgstr "**原始碼:**\\ :source:`Lib/getpass.py`" #: ../../includes/wasm-notavail.rst:3 msgid ":ref:`Availability `: not WASI." -msgstr "" +msgstr ":ref:`Availability `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/getpass.rst:17 msgid "The :mod:`getpass` module provides two functions:" diff --git a/library/grp.po b/library/grp.po index 00ca37fb41..15b9d95405 100644 --- a/library/grp.po +++ b/library/grp.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,9 +29,9 @@ msgid "" msgstr "" #: ../../library/grp.rst:13 -#, fuzzy -msgid ":ref:`Availability `: Unix, not WASI, not iOS." -msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" +msgid "" +":ref:`Availability `: Unix, not WASI, not Android, not iOS." +msgstr ":ref:`適用 `:Unix、非 WASI、非 Android、非 iOS。" #: ../../library/grp.rst:15 msgid "" diff --git a/library/hashlib.po b/library/hashlib.po index c3eba1ece2..e7b2a5de94 100644 --- a/library/hashlib.po +++ b/library/hashlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2024-05-11 16:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -976,10 +976,9 @@ msgstr "" "性。" #: ../../library/hashlib.rst:657 -#, fuzzy msgid "" "(`NIST SP-800-106 \"Randomized Hashing for Digital Signatures\" `_)" +"csrc.nist.gov/pubs/sp/800/106/final>`_)" msgstr "" "(`NIST SP-800-106 「數位簽章的隨機雜湊 (Randomized Hashing for Digital " "Signatures)」 `_)" @@ -1251,8 +1250,7 @@ msgid "The FIPS 180-4 publication on Secure Hash Algorithms." msgstr "有關安全雜湊演算法的 FIPS 180-4 出版物。" #: ../../library/hashlib.rst:830 -#, fuzzy -msgid "https://csrc.nist.gov/publications/detail/fips/202/final" +msgid "https://csrc.nist.gov/pubs/fips/202/final" msgstr "https://csrc.nist.gov/pubs/fips/202/final" #: ../../library/hashlib.rst:831 diff --git a/library/http.client.po b/library/http.client.po index a3bb30106b..e9a367037e 100644 --- a/library/http.client.po +++ b/library/http.client.po @@ -46,16 +46,15 @@ msgstr "" #: ../../includes/wasm-notavail.rst:3 msgid ":ref:`Availability `: not WASI." -msgstr "" +msgstr ":ref:`Availability `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/http.client.rst:33 msgid "The module provides the following classes:" diff --git a/library/http.cookiejar.po b/library/http.cookiejar.po index ea30115b2d..6184715dab 100644 --- a/library/http.cookiejar.po +++ b/library/http.cookiejar.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2016-11-19 00:31+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -200,8 +200,7 @@ msgid "" msgstr "" #: ../../library/http.cookiejar.rst:140 -#, fuzzy -msgid "http://kristol.org/cookie/errata.html" +msgid "https://kristol.org/cookie/errata.html" msgstr "https://kristol.org/cookie/errata.html" #: ../../library/http.cookiejar.rst:141 @@ -224,7 +223,7 @@ msgstr "" #: ../../library/http.cookiejar.rst:153 msgid ":class:`CookieJar` has the following methods:" -msgstr "" +msgstr ":class:`CookieJar` 擁有以下方法:" #: ../../library/http.cookiejar.rst:158 msgid "Add correct :mailheader:`Cookie` header to *request*." diff --git a/library/http.server.po b/library/http.server.po index 5a706bd1c1..16bc06d5f9 100644 --- a/library/http.server.po +++ b/library/http.server.po @@ -37,16 +37,15 @@ msgstr "" #: ../../includes/wasm-notavail.rst:3 msgid ":ref:`Availability `: not WASI." -msgstr "" +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/http.server.rst:27 msgid "" diff --git a/library/imaplib.po b/library/imaplib.po index ecc2eaa302..e78b7739b0 100644 --- a/library/imaplib.po +++ b/library/imaplib.po @@ -36,16 +36,15 @@ msgstr "" #: ../../includes/wasm-notavail.rst:3 msgid ":ref:`Availability `: not WASI." -msgstr "" +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/imaplib.rst:31 msgid "" diff --git a/library/imghdr.po b/library/imghdr.po deleted file mode 100644 index f190c8b9c3..0000000000 --- a/library/imghdr.po +++ /dev/null @@ -1,209 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2022-05-22 02:06+0800\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/imghdr.rst:2 -msgid ":mod:`imghdr` --- Determine the type of an image" -msgstr ":mod:`imghdr` --- 推測圖片種類" - -#: ../../library/imghdr.rst:8 -msgid "**Source code:** :source:`Lib/imghdr.py`" -msgstr "**原始碼:**\\ :source:`Lib/imghdr.py`" - -#: ../../library/imghdr.rst:10 -msgid "" -"The :mod:`imghdr` module is deprecated (see :pep:`PEP 594 <594#imghdr>` for " -"details and alternatives)." -msgstr "" -":mod:`imghdr` 模組 (module) 即將被棄用(詳情與替代方案見 :pep:`PEP 594 " -"<594#imghdr>`\\ )。" - -#: ../../library/imghdr.rst:16 -msgid "" -"The :mod:`imghdr` module determines the type of image contained in a file or " -"byte stream." -msgstr "" - -#: ../../library/imghdr.rst:19 -msgid "The :mod:`imghdr` module defines the following function:" -msgstr "" - -#: ../../library/imghdr.rst:24 -msgid "" -"Test the image data contained in the file named *file* and return a string " -"describing the image type. If *h* is provided, the *file* argument is " -"ignored and *h* is assumed to contain the byte stream to test." -msgstr "" - -#: ../../library/imghdr.rst:28 -msgid "Accepts a :term:`path-like object`." -msgstr "" - -#: ../../library/imghdr.rst:31 -msgid "" -"The following image types are recognized, as listed below with the return " -"value from :func:`what`:" -msgstr "" - -#: ../../library/imghdr.rst:35 -msgid "Value" -msgstr "" - -#: ../../library/imghdr.rst:35 -msgid "Image format" -msgstr "" - -#: ../../library/imghdr.rst:37 -msgid "``'rgb'``" -msgstr "``'rgb'``" - -#: ../../library/imghdr.rst:37 -msgid "SGI ImgLib Files" -msgstr "" - -#: ../../library/imghdr.rst:39 -msgid "``'gif'``" -msgstr "``'gif'``" - -#: ../../library/imghdr.rst:39 -msgid "GIF 87a and 89a Files" -msgstr "" - -#: ../../library/imghdr.rst:41 -msgid "``'pbm'``" -msgstr "``'pbm'``" - -#: ../../library/imghdr.rst:41 -msgid "Portable Bitmap Files" -msgstr "" - -#: ../../library/imghdr.rst:43 -msgid "``'pgm'``" -msgstr "``'pgm'``" - -#: ../../library/imghdr.rst:43 -msgid "Portable Graymap Files" -msgstr "" - -#: ../../library/imghdr.rst:45 -msgid "``'ppm'``" -msgstr "``'ppm'``" - -#: ../../library/imghdr.rst:45 -msgid "Portable Pixmap Files" -msgstr "" - -#: ../../library/imghdr.rst:47 -msgid "``'tiff'``" -msgstr "``'tiff'``" - -#: ../../library/imghdr.rst:47 -msgid "TIFF Files" -msgstr "TIFF 檔案" - -#: ../../library/imghdr.rst:49 -msgid "``'rast'``" -msgstr "``'rast'``" - -#: ../../library/imghdr.rst:49 -msgid "Sun Raster Files" -msgstr "" - -#: ../../library/imghdr.rst:51 -msgid "``'xbm'``" -msgstr "``'xbm'``" - -#: ../../library/imghdr.rst:51 -msgid "X Bitmap Files" -msgstr "" - -#: ../../library/imghdr.rst:53 -msgid "``'jpeg'``" -msgstr "``'jpeg'``" - -#: ../../library/imghdr.rst:53 -msgid "JPEG data in JFIF or Exif formats" -msgstr "" - -#: ../../library/imghdr.rst:55 -msgid "``'bmp'``" -msgstr "``'bmp'``" - -#: ../../library/imghdr.rst:55 -msgid "BMP files" -msgstr "BMP 檔案" - -#: ../../library/imghdr.rst:57 -msgid "``'png'``" -msgstr "``'png'``" - -#: ../../library/imghdr.rst:57 -msgid "Portable Network Graphics" -msgstr "" - -#: ../../library/imghdr.rst:59 -msgid "``'webp'``" -msgstr "``'webp'``" - -#: ../../library/imghdr.rst:59 -msgid "WebP files" -msgstr "WebP 檔案" - -#: ../../library/imghdr.rst:61 -msgid "``'exr'``" -msgstr "``'exr'``" - -#: ../../library/imghdr.rst:61 -msgid "OpenEXR Files" -msgstr "OpenEXR 檔案" - -#: ../../library/imghdr.rst:64 -msgid "The *exr* and *webp* formats were added." -msgstr "新增 *exr* 與 *webp* 格式。" - -#: ../../library/imghdr.rst:68 -msgid "" -"You can extend the list of file types :mod:`imghdr` can recognize by " -"appending to this variable:" -msgstr "" - -#: ../../library/imghdr.rst:74 -msgid "" -"A list of functions performing the individual tests. Each function takes " -"two arguments: the byte-stream and an open file-like object. When :func:" -"`what` is called with a byte-stream, the file-like object will be ``None``." -msgstr "" - -#: ../../library/imghdr.rst:78 -msgid "" -"The test function should return a string describing the image type if the " -"test succeeded, or ``None`` if it failed." -msgstr "" - -#: ../../library/imghdr.rst:81 -msgid "Example::" -msgstr "範例: ::" - -#: ../../library/imghdr.rst:83 -msgid "" -">>> import imghdr\n" -">>> imghdr.what('bass.gif')\n" -"'gif'" -msgstr "" diff --git a/library/importlib.po b/library/importlib.po index 4ce7485363..77865d2b32 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1919,34 +1919,53 @@ msgid "Importing a source file directly" msgstr "" #: ../../library/importlib.rst:1587 -msgid "To import a Python source file directly, use the following recipe::" +msgid "" +"This recipe should be used with caution: it is an approximation of an import " +"statement where the file path is specified directly, rather than :data:`sys." +"path` being searched. Alternatives should first be considered first, such as " +"modifying :data:`sys.path` when a proper module is required, or using :func:" +"`runpy.run_path` when the global namespace resulting from running a Python " +"file is appropriate." +msgstr "" + +#: ../../library/importlib.rst:1594 +msgid "" +"To import a Python source file directly from a path, use the following " +"recipe::" msgstr "" -#: ../../library/importlib.rst:1589 +#: ../../library/importlib.rst:1596 msgid "" "import importlib.util\n" "import sys\n" "\n" -"# For illustrative purposes.\n" -"import tokenize\n" -"file_path = tokenize.__file__\n" -"module_name = tokenize.__name__\n" "\n" -"spec = importlib.util.spec_from_file_location(module_name, file_path)\n" -"module = importlib.util.module_from_spec(spec)\n" -"sys.modules[module_name] = module\n" -"spec.loader.exec_module(module)" +"def import_from_path(module_name, file_path):\n" +" spec = importlib.util.spec_from_file_location(module_name, file_path)\n" +" module = importlib.util.module_from_spec(spec)\n" +" sys.modules[module_name] = module\n" +" spec.loader.exec_module(module)\n" +" return module\n" +"\n" +"\n" +"# For illustrative purposes only (use of `json` is arbitrary).\n" +"import json\n" +"file_path = json.__file__\n" +"module_name = json.__name__\n" +"\n" +"# Similar outcome as `import json`.\n" +"json = import_from_path(module_name, file_path)" msgstr "" -#: ../../library/importlib.rst:1604 +#: ../../library/importlib.rst:1618 msgid "Implementing lazy imports" msgstr "" -#: ../../library/importlib.rst:1606 +#: ../../library/importlib.rst:1620 msgid "The example below shows how to implement lazy imports::" msgstr "" -#: ../../library/importlib.rst:1608 +#: ../../library/importlib.rst:1622 msgid "" ">>> import importlib.util\n" ">>> import sys\n" @@ -1966,11 +1985,11 @@ msgid "" "False" msgstr "" -#: ../../library/importlib.rst:1628 +#: ../../library/importlib.rst:1641 msgid "Setting up an importer" msgstr "" -#: ../../library/importlib.rst:1630 +#: ../../library/importlib.rst:1643 msgid "" "For deep customizations of import, you typically want to implement an :term:" "`importer`. This means managing both the :term:`finder` and :term:`loader` " @@ -1984,7 +2003,7 @@ msgid "" "for the appropriate classes defined within this package)::" msgstr "" -#: ../../library/importlib.rst:1641 +#: ../../library/importlib.rst:1654 msgid "" "import importlib.machinery\n" "import sys\n" @@ -2008,11 +2027,11 @@ msgid "" "sys.path_hooks.append(SpamPathEntryFinder.path_hook(loader_details))" msgstr "" -#: ../../library/importlib.rst:1662 +#: ../../library/importlib.rst:1675 msgid "Approximating :func:`importlib.import_module`" msgstr "" -#: ../../library/importlib.rst:1664 +#: ../../library/importlib.rst:1677 msgid "" "Import itself is implemented in Python code, making it possible to expose " "most of the import machinery through importlib. The following helps " @@ -2020,7 +2039,7 @@ msgid "" "approximate implementation of :func:`importlib.import_module`::" msgstr "" -#: ../../library/importlib.rst:1670 +#: ../../library/importlib.rst:1683 msgid "" "import importlib.util\n" "import sys\n" diff --git a/library/inspect.po b/library/inspect.po index 75c786af83..d8ce3640b7 100644 --- a/library/inspect.po +++ b/library/inspect.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -667,11 +667,10 @@ msgid "" msgstr "" #: ../../library/inspect.rst:366 -#, fuzzy msgid "" "Functions wrapped in :func:`functools.partialmethod` now return ``True`` if " "the wrapped function is a Python generator function." -msgstr "如果物件是 Python 產生器函式,則回傳 ``True``。" +msgstr "" #: ../../library/inspect.rst:372 msgid "Return ``True`` if the object is a generator." @@ -1131,7 +1130,7 @@ msgid "" "including keyword-only parameters." msgstr "" -#: ../../library/inspect.rst:770 ../../library/inspect.rst:1124 +#: ../../library/inspect.rst:770 ../../library/inspect.rst:1125 msgid "" "Python only explicitly guaranteed that it preserved the declaration order of " "keyword-only parameters as of version 3.7, although in practice this order " @@ -1487,28 +1486,29 @@ msgstr "" #: ../../library/inspect.rst:1020 msgid "" "A dict of keyword arguments values. Dynamically computed from the :attr:" -"`arguments` attribute." +"`arguments` attribute. Arguments that can be passed positionally are " +"included in :attr:`args` instead." msgstr "" -#: ../../library/inspect.rst:1025 +#: ../../library/inspect.rst:1026 msgid "A reference to the parent :class:`Signature` object." msgstr "" -#: ../../library/inspect.rst:1029 +#: ../../library/inspect.rst:1030 msgid "Set default values for missing arguments." msgstr "為遺漏的引數設定預設值。" -#: ../../library/inspect.rst:1031 +#: ../../library/inspect.rst:1032 msgid "" "For variable-positional arguments (``*args``) the default is an empty tuple." msgstr "" -#: ../../library/inspect.rst:1034 +#: ../../library/inspect.rst:1035 msgid "" "For variable-keyword arguments (``**kwargs``) the default is an empty dict." msgstr "" -#: ../../library/inspect.rst:1037 +#: ../../library/inspect.rst:1038 msgid "" ">>> def foo(a, b='ham', *args): pass\n" ">>> ba = inspect.signature(foo).bind('spam')\n" @@ -1522,13 +1522,13 @@ msgstr "" ">>> ba.arguments\n" "{'a': 'spam', 'b': 'ham', 'args': ()}" -#: ../../library/inspect.rst:1047 +#: ../../library/inspect.rst:1048 msgid "" "The :attr:`args` and :attr:`kwargs` properties can be used to invoke " "functions:" msgstr "" -#: ../../library/inspect.rst:1050 +#: ../../library/inspect.rst:1051 msgid "" "def test(a, *, b):\n" " ...\n" @@ -1544,19 +1544,19 @@ msgstr "" "ba = sig.bind(10, b=20)\n" "test(*ba.args, **ba.kwargs)" -#: ../../library/inspect.rst:1062 +#: ../../library/inspect.rst:1063 msgid ":pep:`362` - Function Signature Object." msgstr "" -#: ../../library/inspect.rst:1063 +#: ../../library/inspect.rst:1064 msgid "The detailed specification, implementation details and examples." msgstr "" -#: ../../library/inspect.rst:1069 +#: ../../library/inspect.rst:1070 msgid "Classes and functions" msgstr "類別與函式" -#: ../../library/inspect.rst:1073 +#: ../../library/inspect.rst:1074 msgid "" "Arrange the given list of classes into a hierarchy of nested lists. Where a " "nested list appears, it contains classes derived from the class whose entry " @@ -1567,19 +1567,19 @@ msgid "" "will appear multiple times." msgstr "" -#: ../../library/inspect.rst:1084 +#: ../../library/inspect.rst:1085 msgid "" "Get the names and default values of a Python function's parameters. A :term:" "`named tuple` is returned:" msgstr "" -#: ../../library/inspect.rst:1087 +#: ../../library/inspect.rst:1088 msgid "" "``FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, " "annotations)``" msgstr "" -#: ../../library/inspect.rst:1090 +#: ../../library/inspect.rst:1091 msgid "" "*args* is a list of the positional parameter names. *varargs* is the name of " "the ``*`` parameter or ``None`` if arbitrary positional arguments are not " @@ -1594,7 +1594,7 @@ msgid "" "report the function return value annotation (if any)." msgstr "" -#: ../../library/inspect.rst:1105 +#: ../../library/inspect.rst:1106 msgid "" "Note that :func:`signature` and :ref:`Signature Object ` provide the recommended API for callable introspection, and support " @@ -1604,14 +1604,14 @@ msgid "" "``inspect`` module API." msgstr "" -#: ../../library/inspect.rst:1112 +#: ../../library/inspect.rst:1113 msgid "" "This function is now based on :func:`signature`, but still ignores " "``__wrapped__`` attributes and includes the already bound first parameter in " "the signature output for bound methods." msgstr "" -#: ../../library/inspect.rst:1117 +#: ../../library/inspect.rst:1118 msgid "" "This method was previously documented as deprecated in favour of :func:" "`signature` in Python 3.5, but that decision has been reversed in order to " @@ -1619,7 +1619,7 @@ msgid "" "code migrating away from the legacy :func:`getargspec` API." msgstr "" -#: ../../library/inspect.rst:1132 +#: ../../library/inspect.rst:1133 msgid "" "Get information about arguments passed into a particular frame. A :term:" "`named tuple` ``ArgInfo(args, varargs, keywords, locals)`` is returned. " @@ -1628,18 +1628,18 @@ msgid "" "dictionary of the given frame." msgstr "" -#: ../../library/inspect.rst:1139 ../../library/inspect.rst:1149 +#: ../../library/inspect.rst:1140 ../../library/inspect.rst:1150 msgid "This function was inadvertently marked as deprecated in Python 3.5." msgstr "" -#: ../../library/inspect.rst:1144 +#: ../../library/inspect.rst:1145 msgid "" "Format a pretty argument spec from the four values returned by :func:" "`getargvalues`. The format\\* arguments are the corresponding optional " "formatting functions that are called to turn names and values into strings." msgstr "" -#: ../../library/inspect.rst:1154 +#: ../../library/inspect.rst:1155 msgid "" "Return a tuple of class cls's base classes, including cls, in method " "resolution order. No class appears more than once in this tuple. Note that " @@ -1647,7 +1647,7 @@ msgid "" "user-defined metatype is in use, cls will be the first element of the tuple." msgstr "" -#: ../../library/inspect.rst:1162 +#: ../../library/inspect.rst:1163 msgid "" "Bind the *args* and *kwds* to the argument names of the Python function or " "method *func*, as if it was called with them. For bound methods, bind also " @@ -1660,7 +1660,7 @@ msgid "" "example:" msgstr "" -#: ../../library/inspect.rst:1171 +#: ../../library/inspect.rst:1172 msgid "" ">>> from inspect import getcallargs\n" ">>> def f(a, b=1, *pos, **named):\n" @@ -1690,11 +1690,11 @@ msgstr "" "...\n" "TypeError: f() missing 1 required positional argument: 'a'" -#: ../../library/inspect.rst:1188 +#: ../../library/inspect.rst:1189 msgid "Use :meth:`Signature.bind` and :meth:`Signature.bind_partial` instead." msgstr "請改用 :meth:`Signature.bind` 與 :meth:`Signature.bind_partial`。" -#: ../../library/inspect.rst:1194 +#: ../../library/inspect.rst:1195 msgid "" "Get the mapping of external name references in a Python function or method " "*func* to their current values. A :term:`named tuple` " @@ -1706,18 +1706,18 @@ msgid "" "builtins." msgstr "" -#: ../../library/inspect.rst:1203 +#: ../../library/inspect.rst:1204 msgid "" ":exc:`TypeError` is raised if *func* is not a Python function or method." msgstr "如果 *func* 不是 Python 函式或方法,則引發 :exc:`TypeError`。" -#: ../../library/inspect.rst:1210 +#: ../../library/inspect.rst:1211 msgid "" "Get the object wrapped by *func*. It follows the chain of :attr:" "`__wrapped__` attributes returning the last object in the chain." msgstr "" -#: ../../library/inspect.rst:1213 +#: ../../library/inspect.rst:1214 msgid "" "*stop* is an optional callback accepting an object in the wrapper chain as " "its sole argument that allows the unwrapping to be terminated early if the " @@ -1727,80 +1727,80 @@ msgid "" "``__signature__`` attribute defined." msgstr "" -#: ../../library/inspect.rst:1220 +#: ../../library/inspect.rst:1221 msgid ":exc:`ValueError` is raised if a cycle is encountered." msgstr "如果遇到循環,則引發 :exc:`ValueError`。" -#: ../../library/inspect.rst:1227 +#: ../../library/inspect.rst:1228 msgid "Compute the annotations dict for an object." msgstr "" -#: ../../library/inspect.rst:1229 +#: ../../library/inspect.rst:1230 msgid "" "``obj`` may be a callable, class, or module. Passing in an object of any " "other type raises :exc:`TypeError`." msgstr "" -#: ../../library/inspect.rst:1232 +#: ../../library/inspect.rst:1233 msgid "" "Returns a dict. ``get_annotations()`` returns a new dict every time it's " "called; calling it twice on the same object will return two different but " "equivalent dicts." msgstr "" -#: ../../library/inspect.rst:1236 +#: ../../library/inspect.rst:1237 msgid "This function handles several details for you:" msgstr "" -#: ../../library/inspect.rst:1238 +#: ../../library/inspect.rst:1239 msgid "" "If ``eval_str`` is true, values of type ``str`` will be un-stringized using :" "func:`eval`. This is intended for use with stringized annotations (``from " "__future__ import annotations``)." msgstr "" -#: ../../library/inspect.rst:1242 +#: ../../library/inspect.rst:1243 msgid "" "If ``obj`` doesn't have an annotations dict, returns an empty dict. " "(Functions and methods always have an annotations dict; classes, modules, " "and other types of callables may not.)" msgstr "" -#: ../../library/inspect.rst:1246 +#: ../../library/inspect.rst:1247 msgid "" "Ignores inherited annotations on classes. If a class doesn't have its own " "annotations dict, returns an empty dict." msgstr "" -#: ../../library/inspect.rst:1248 +#: ../../library/inspect.rst:1249 msgid "" "All accesses to object members and dict values are done using ``getattr()`` " "and ``dict.get()`` for safety." msgstr "" -#: ../../library/inspect.rst:1250 +#: ../../library/inspect.rst:1251 msgid "Always, always, always returns a freshly created dict." msgstr "" -#: ../../library/inspect.rst:1252 +#: ../../library/inspect.rst:1253 msgid "" "``eval_str`` controls whether or not values of type ``str`` are replaced " "with the result of calling :func:`eval` on those values:" msgstr "" -#: ../../library/inspect.rst:1255 +#: ../../library/inspect.rst:1256 msgid "" "If eval_str is true, :func:`eval` is called on values of type ``str``. (Note " "that ``get_annotations`` doesn't catch exceptions; if :func:`eval` raises an " "exception, it will unwind the stack past the ``get_annotations`` call.)" msgstr "" -#: ../../library/inspect.rst:1259 +#: ../../library/inspect.rst:1260 msgid "" "If eval_str is false (the default), values of type ``str`` are unchanged." msgstr "" -#: ../../library/inspect.rst:1261 +#: ../../library/inspect.rst:1262 msgid "" "``globals`` and ``locals`` are passed in to :func:`eval`; see the " "documentation for :func:`eval` for more information. If ``globals`` or " @@ -1808,35 +1808,35 @@ msgid "" "specific default, contingent on ``type(obj)``:" msgstr "" -#: ../../library/inspect.rst:1266 +#: ../../library/inspect.rst:1267 msgid "If ``obj`` is a module, ``globals`` defaults to ``obj.__dict__``." msgstr "" -#: ../../library/inspect.rst:1267 +#: ../../library/inspect.rst:1268 msgid "" "If ``obj`` is a class, ``globals`` defaults to ``sys.modules[obj.__module__]." "__dict__`` and ``locals`` defaults to the ``obj`` class namespace." msgstr "" -#: ../../library/inspect.rst:1270 +#: ../../library/inspect.rst:1271 msgid "" "If ``obj`` is a callable, ``globals`` defaults to :attr:`obj.__globals__ " "`, although if ``obj`` is a wrapped function (using :" "func:`functools.update_wrapper`) it is first unwrapped." msgstr "" -#: ../../library/inspect.rst:1275 +#: ../../library/inspect.rst:1276 msgid "" "Calling ``get_annotations`` is best practice for accessing the annotations " "dict of any object. See :ref:`annotations-howto` for more information on " "annotations best practices." msgstr "" -#: ../../library/inspect.rst:1285 +#: ../../library/inspect.rst:1286 msgid "The interpreter stack" msgstr "直譯器堆疊" -#: ../../library/inspect.rst:1287 +#: ../../library/inspect.rst:1288 msgid "" "Some of the following functions return :class:`FrameInfo` objects. For " "backwards compatibility these objects allow tuple-like operations on all " @@ -1844,95 +1844,95 @@ msgid "" "may be removed in the future." msgstr "" -#: ../../library/inspect.rst:1296 +#: ../../library/inspect.rst:1297 msgid "The :ref:`frame object ` that the record corresponds to." msgstr "" -#: ../../library/inspect.rst:1300 +#: ../../library/inspect.rst:1301 msgid "" "The file name associated with the code being executed by the frame this " "record corresponds to." msgstr "" -#: ../../library/inspect.rst:1305 +#: ../../library/inspect.rst:1306 msgid "" "The line number of the current line associated with the code being executed " "by the frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1310 +#: ../../library/inspect.rst:1311 msgid "" "The function name that is being executed by the frame this record " "corresponds to." msgstr "" -#: ../../library/inspect.rst:1314 +#: ../../library/inspect.rst:1315 msgid "" "A list of lines of context from the source code that's being executed by the " "frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1319 ../../library/inspect.rst:1358 +#: ../../library/inspect.rst:1320 ../../library/inspect.rst:1359 msgid "" "The index of the current line being executed in the :attr:`code_context` " "list." msgstr "" -#: ../../library/inspect.rst:1323 +#: ../../library/inspect.rst:1324 msgid "" "A :class:`dis.Positions` object containing the start line number, end line " "number, start column offset, and end column offset associated with the " "instruction being executed by the frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1327 +#: ../../library/inspect.rst:1328 msgid "Return a :term:`named tuple` instead of a :class:`tuple`." msgstr "" -#: ../../library/inspect.rst:1330 +#: ../../library/inspect.rst:1331 msgid "" ":class:`!FrameInfo` is now a class instance (that is backwards compatible " "with the previous :term:`named tuple`)." msgstr "" -#: ../../library/inspect.rst:1339 +#: ../../library/inspect.rst:1340 msgid "" "The file name associated with the code being executed by the frame this " "traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1344 +#: ../../library/inspect.rst:1345 msgid "" "The line number of the current line associated with the code being executed " "by the frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1349 +#: ../../library/inspect.rst:1350 msgid "" "The function name that is being executed by the frame this traceback " "corresponds to." msgstr "" -#: ../../library/inspect.rst:1353 +#: ../../library/inspect.rst:1354 msgid "" "A list of lines of context from the source code that's being executed by the " "frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1362 +#: ../../library/inspect.rst:1363 msgid "" "A :class:`dis.Positions` object containing the start line number, end line " "number, start column offset, and end column offset associated with the " "instruction being executed by the frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1367 +#: ../../library/inspect.rst:1368 msgid "" ":class:`!Traceback` is now a class instance (that is backwards compatible " "with the previous :term:`named tuple`)." msgstr "" -#: ../../library/inspect.rst:1374 +#: ../../library/inspect.rst:1375 msgid "" "Keeping references to frame objects, as found in the first element of the " "frame records these functions return, can cause your program to create " @@ -1944,7 +1944,7 @@ msgid "" "consumption which occurs." msgstr "" -#: ../../library/inspect.rst:1382 +#: ../../library/inspect.rst:1383 msgid "" "Though the cycle detector will catch these, destruction of the frames (and " "local variables) can be made deterministic by removing the cycle in a :" @@ -1952,7 +1952,7 @@ msgid "" "disabled when Python was compiled or using :func:`gc.disable`. For example::" msgstr "" -#: ../../library/inspect.rst:1387 +#: ../../library/inspect.rst:1388 msgid "" "def handle_stackframe_without_leak():\n" " frame = inspect.currentframe()\n" @@ -1962,31 +1962,31 @@ msgid "" " del frame" msgstr "" -#: ../../library/inspect.rst:1394 +#: ../../library/inspect.rst:1395 msgid "" "If you want to keep the frame around (for example to print a traceback " "later), you can also break reference cycles by using the :meth:`frame.clear` " "method." msgstr "" -#: ../../library/inspect.rst:1398 +#: ../../library/inspect.rst:1399 msgid "" "The optional *context* argument supported by most of these functions " "specifies the number of lines of context to return, which are centered " "around the current line." msgstr "" -#: ../../library/inspect.rst:1405 +#: ../../library/inspect.rst:1406 msgid "" "Get information about a frame or traceback object. A :class:`Traceback` " "object is returned." msgstr "" -#: ../../library/inspect.rst:1408 +#: ../../library/inspect.rst:1409 msgid "A :class:`Traceback` object is returned instead of a named tuple." msgstr "" -#: ../../library/inspect.rst:1413 +#: ../../library/inspect.rst:1414 msgid "" "Get a list of :class:`FrameInfo` objects for a frame and all outer frames. " "These frames represent the calls that lead to the creation of *frame*. The " @@ -1994,19 +1994,19 @@ msgid "" "represents the outermost call on *frame*'s stack." msgstr "" -#: ../../library/inspect.rst:1418 ../../library/inspect.rst:1433 -#: ../../library/inspect.rst:1459 ../../library/inspect.rst:1474 +#: ../../library/inspect.rst:1419 ../../library/inspect.rst:1434 +#: ../../library/inspect.rst:1460 ../../library/inspect.rst:1475 msgid "" "A list of :term:`named tuples ` ``FrameInfo(frame, filename, " "lineno, function, code_context, index)`` is returned." msgstr "" -#: ../../library/inspect.rst:1423 ../../library/inspect.rst:1438 -#: ../../library/inspect.rst:1464 ../../library/inspect.rst:1479 +#: ../../library/inspect.rst:1424 ../../library/inspect.rst:1439 +#: ../../library/inspect.rst:1465 ../../library/inspect.rst:1480 msgid "A list of :class:`FrameInfo` objects is returned." msgstr "回傳一個 :class:`FrameInfo` 物件串列。" -#: ../../library/inspect.rst:1428 +#: ../../library/inspect.rst:1429 msgid "" "Get a list of :class:`FrameInfo` objects for a traceback's frame and all " "inner frames. These frames represent calls made as a consequence of " @@ -2014,11 +2014,11 @@ msgid "" "represents where the exception was raised." msgstr "" -#: ../../library/inspect.rst:1443 +#: ../../library/inspect.rst:1444 msgid "Return the frame object for the caller's stack frame." msgstr "" -#: ../../library/inspect.rst:1447 +#: ../../library/inspect.rst:1448 msgid "" "This function relies on Python stack frame support in the interpreter, which " "isn't guaranteed to exist in all implementations of Python. If running in " @@ -2026,14 +2026,14 @@ msgid "" "``None``." msgstr "" -#: ../../library/inspect.rst:1455 +#: ../../library/inspect.rst:1456 msgid "" "Return a list of :class:`FrameInfo` objects for the caller's stack. The " "first entry in the returned list represents the caller; the last entry " "represents the outermost call on the stack." msgstr "" -#: ../../library/inspect.rst:1469 +#: ../../library/inspect.rst:1470 msgid "" "Return a list of :class:`FrameInfo` objects for the stack between the " "current frame and the frame in which an exception currently being handled " @@ -2041,11 +2041,11 @@ msgid "" "entry represents where the exception was raised." msgstr "" -#: ../../library/inspect.rst:1483 +#: ../../library/inspect.rst:1484 msgid "Fetching attributes statically" msgstr "" -#: ../../library/inspect.rst:1485 +#: ../../library/inspect.rst:1486 msgid "" "Both :func:`getattr` and :func:`hasattr` can trigger code execution when " "fetching or checking for the existence of attributes. Descriptors, like " @@ -2053,20 +2053,20 @@ msgid "" "`~object.__getattribute__` may be called." msgstr "" -#: ../../library/inspect.rst:1491 +#: ../../library/inspect.rst:1492 msgid "" "For cases where you want passive introspection, like documentation tools, " "this can be inconvenient. :func:`getattr_static` has the same signature as :" "func:`getattr` but avoids executing code when it fetches attributes." msgstr "" -#: ../../library/inspect.rst:1497 +#: ../../library/inspect.rst:1498 msgid "" "Retrieve attributes without triggering dynamic lookup via the descriptor " "protocol, :meth:`~object.__getattr__` or :meth:`~object.__getattribute__`." msgstr "" -#: ../../library/inspect.rst:1501 +#: ../../library/inspect.rst:1502 msgid "" "Note: this function may not be able to retrieve all attributes that getattr " "can fetch (like dynamically created attributes) and may find attributes that " @@ -2074,27 +2074,27 @@ msgid "" "return descriptors objects instead of instance members." msgstr "" -#: ../../library/inspect.rst:1507 +#: ../../library/inspect.rst:1508 msgid "" "If the instance :attr:`~object.__dict__` is shadowed by another member (for " "example a property) then this function will be unable to find instance " "members." msgstr "" -#: ../../library/inspect.rst:1513 +#: ../../library/inspect.rst:1514 msgid "" ":func:`getattr_static` does not resolve descriptors, for example slot " "descriptors or getset descriptors on objects implemented in C. The " "descriptor object is returned instead of the underlying attribute." msgstr "" -#: ../../library/inspect.rst:1517 +#: ../../library/inspect.rst:1518 msgid "" "You can handle these with code like the following. Note that for arbitrary " "getset descriptors invoking these may trigger code execution::" msgstr "" -#: ../../library/inspect.rst:1521 +#: ../../library/inspect.rst:1522 msgid "" "# example code for resolving the builtin descriptor types\n" "class _foo:\n" @@ -2117,11 +2117,11 @@ msgid "" " pass" msgstr "" -#: ../../library/inspect.rst:1543 +#: ../../library/inspect.rst:1544 msgid "Current State of Generators, Coroutines, and Asynchronous Generators" msgstr "" -#: ../../library/inspect.rst:1545 +#: ../../library/inspect.rst:1546 msgid "" "When implementing coroutine schedulers and for other advanced uses of " "generators, it is useful to determine whether a generator is currently " @@ -2130,32 +2130,32 @@ msgid "" "generator to be determined easily." msgstr "" -#: ../../library/inspect.rst:1553 +#: ../../library/inspect.rst:1554 msgid "Get current state of a generator-iterator." msgstr "" -#: ../../library/inspect.rst:1555 ../../library/inspect.rst:1571 -#: ../../library/inspect.rst:1588 +#: ../../library/inspect.rst:1556 ../../library/inspect.rst:1572 +#: ../../library/inspect.rst:1589 msgid "Possible states are:" msgstr "" -#: ../../library/inspect.rst:1557 +#: ../../library/inspect.rst:1558 msgid "GEN_CREATED: Waiting to start execution." msgstr "" -#: ../../library/inspect.rst:1558 +#: ../../library/inspect.rst:1559 msgid "GEN_RUNNING: Currently being executed by the interpreter." msgstr "" -#: ../../library/inspect.rst:1559 +#: ../../library/inspect.rst:1560 msgid "GEN_SUSPENDED: Currently suspended at a yield expression." msgstr "" -#: ../../library/inspect.rst:1560 +#: ../../library/inspect.rst:1561 msgid "GEN_CLOSED: Execution has completed." msgstr "" -#: ../../library/inspect.rst:1566 +#: ../../library/inspect.rst:1567 msgid "" "Get current state of a coroutine object. The function is intended to be " "used with coroutine objects created by :keyword:`async def` functions, but " @@ -2163,23 +2163,23 @@ msgid "" "``cr_frame`` attributes." msgstr "" -#: ../../library/inspect.rst:1573 +#: ../../library/inspect.rst:1574 msgid "CORO_CREATED: Waiting to start execution." msgstr "" -#: ../../library/inspect.rst:1574 +#: ../../library/inspect.rst:1575 msgid "CORO_RUNNING: Currently being executed by the interpreter." msgstr "" -#: ../../library/inspect.rst:1575 +#: ../../library/inspect.rst:1576 msgid "CORO_SUSPENDED: Currently suspended at an await expression." msgstr "" -#: ../../library/inspect.rst:1576 +#: ../../library/inspect.rst:1577 msgid "CORO_CLOSED: Execution has completed." msgstr "" -#: ../../library/inspect.rst:1582 +#: ../../library/inspect.rst:1583 msgid "" "Get current state of an asynchronous generator object. The function is " "intended to be used with asynchronous iterator objects created by :keyword:" @@ -2188,30 +2188,30 @@ msgid "" "``ag_frame`` attributes." msgstr "" -#: ../../library/inspect.rst:1590 +#: ../../library/inspect.rst:1591 msgid "AGEN_CREATED: Waiting to start execution." msgstr "AGEN_CREATED: 等待開始執行。" -#: ../../library/inspect.rst:1591 +#: ../../library/inspect.rst:1592 msgid "AGEN_RUNNING: Currently being executed by the interpreter." msgstr "AGEN_RUNNING: 目前正在被直譯器執行。" -#: ../../library/inspect.rst:1592 +#: ../../library/inspect.rst:1593 msgid "AGEN_SUSPENDED: Currently suspended at a yield expression." msgstr "AGEN_SUSPENDED: 目前於 yield 運算式暫停。" -#: ../../library/inspect.rst:1593 +#: ../../library/inspect.rst:1594 msgid "AGEN_CLOSED: Execution has completed." msgstr "AGEN_CLOSED: 執行已完成。" -#: ../../library/inspect.rst:1597 +#: ../../library/inspect.rst:1598 msgid "" "The current internal state of the generator can also be queried. This is " "mostly useful for testing purposes, to ensure that internal state is being " "updated as expected:" msgstr "" -#: ../../library/inspect.rst:1603 +#: ../../library/inspect.rst:1604 msgid "" "Get the mapping of live local variables in *generator* to their current " "values. A dictionary is returned that maps from variable names to values. " @@ -2219,14 +2219,14 @@ msgid "" "generator, and all the same caveats apply." msgstr "" -#: ../../library/inspect.rst:1608 +#: ../../library/inspect.rst:1609 msgid "" "If *generator* is a :term:`generator` with no currently associated frame, " "then an empty dictionary is returned. :exc:`TypeError` is raised if " "*generator* is not a Python generator object." msgstr "" -#: ../../library/inspect.rst:1614 +#: ../../library/inspect.rst:1615 msgid "" "This function relies on the generator exposing a Python stack frame for " "introspection, which isn't guaranteed to be the case in all implementations " @@ -2234,79 +2234,79 @@ msgid "" "dictionary." msgstr "" -#: ../../library/inspect.rst:1623 +#: ../../library/inspect.rst:1624 msgid "" "This function is analogous to :func:`~inspect.getgeneratorlocals`, but works " "for coroutine objects created by :keyword:`async def` functions." msgstr "" -#: ../../library/inspect.rst:1630 +#: ../../library/inspect.rst:1631 msgid "" "This function is analogous to :func:`~inspect.getgeneratorlocals`, but works " "for asynchronous generator objects created by :keyword:`async def` functions " "which use the :keyword:`yield` statement." msgstr "" -#: ../../library/inspect.rst:1640 +#: ../../library/inspect.rst:1641 msgid "Code Objects Bit Flags" msgstr "" -#: ../../library/inspect.rst:1642 +#: ../../library/inspect.rst:1643 msgid "" "Python code objects have a :attr:`~codeobject.co_flags` attribute, which is " "a bitmap of the following flags:" msgstr "" -#: ../../library/inspect.rst:1647 +#: ../../library/inspect.rst:1648 msgid "The code object is optimized, using fast locals." msgstr "" -#: ../../library/inspect.rst:1651 +#: ../../library/inspect.rst:1652 msgid "" "If set, a new dict will be created for the frame's :attr:`~frame.f_locals` " "when the code object is executed." msgstr "" -#: ../../library/inspect.rst:1656 +#: ../../library/inspect.rst:1657 msgid "The code object has a variable positional parameter (``*args``-like)." msgstr "" -#: ../../library/inspect.rst:1660 +#: ../../library/inspect.rst:1661 msgid "The code object has a variable keyword parameter (``**kwargs``-like)." msgstr "" -#: ../../library/inspect.rst:1664 +#: ../../library/inspect.rst:1665 msgid "The flag is set when the code object is a nested function." msgstr "" -#: ../../library/inspect.rst:1668 +#: ../../library/inspect.rst:1669 msgid "" "The flag is set when the code object is a generator function, i.e. a " "generator object is returned when the code object is executed." msgstr "" -#: ../../library/inspect.rst:1673 +#: ../../library/inspect.rst:1674 msgid "" "The flag is set when the code object is a coroutine function. When the code " "object is executed it returns a coroutine object. See :pep:`492` for more " "details." msgstr "" -#: ../../library/inspect.rst:1681 +#: ../../library/inspect.rst:1682 msgid "" "The flag is used to transform generators into generator-based coroutines. " "Generator objects with this flag can be used in ``await`` expression, and " "can ``yield from`` coroutine objects. See :pep:`492` for more details." msgstr "" -#: ../../library/inspect.rst:1690 +#: ../../library/inspect.rst:1691 msgid "" "The flag is set when the code object is an asynchronous generator function. " "When the code object is executed it returns an asynchronous generator " "object. See :pep:`525` for more details." msgstr "" -#: ../../library/inspect.rst:1697 +#: ../../library/inspect.rst:1698 msgid "" "The flags are specific to CPython, and may not be defined in other Python " "implementations. Furthermore, the flags are an implementation detail, and " @@ -2314,39 +2314,39 @@ msgid "" "use public APIs from the :mod:`inspect` module for any introspection needs." msgstr "" -#: ../../library/inspect.rst:1705 +#: ../../library/inspect.rst:1706 msgid "Buffer flags" msgstr "" -#: ../../library/inspect.rst:1709 +#: ../../library/inspect.rst:1710 msgid "" "This is an :class:`enum.IntFlag` that represents the flags that can be " "passed to the :meth:`~object.__buffer__` method of objects implementing the :" "ref:`buffer protocol `." msgstr "" -#: ../../library/inspect.rst:1713 +#: ../../library/inspect.rst:1714 msgid "The meaning of the flags is explained at :ref:`buffer-request-types`." msgstr "" -#: ../../library/inspect.rst:1740 +#: ../../library/inspect.rst:1741 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/inspect.rst:1742 +#: ../../library/inspect.rst:1743 msgid "" "The :mod:`inspect` module also provides a basic introspection capability " "from the command line." msgstr "" -#: ../../library/inspect.rst:1747 +#: ../../library/inspect.rst:1748 msgid "" "By default, accepts the name of a module and prints the source of that " "module. A class or function within the module can be printed instead by " "appended a colon and the qualified name of the target object." msgstr "" -#: ../../library/inspect.rst:1753 +#: ../../library/inspect.rst:1754 msgid "" "Print information about the specified object rather than the source code" msgstr "" diff --git a/library/intro.po b/library/intro.po index 599f406f42..b620131be3 100644 --- a/library/intro.po +++ b/library/intro.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2021-10-26 17:01+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -117,7 +117,7 @@ msgstr "讓我們開始吧!" #: ../../library/intro.rst:54 msgid "Notes on availability" -msgstr "可用性之註釋" +msgstr "可用性之標註" #: ../../library/intro.rst:56 msgid "" @@ -125,17 +125,16 @@ msgid "" "Unix systems. It does not make any claims about its existence on a specific " "operating system." msgstr "" -"如果出現「適用:Unix」註釋,則代表該函式普遍存在於 Unix 系統中,但這並不保證" +"如果出現「適用:Unix」標註,則代表該函式普遍存在於 Unix 系統中,但這並不保證" "其存在於某特定作業系統。" #: ../../library/intro.rst:60 -#, fuzzy msgid "" "If not separately noted, all functions that claim \"Availability: Unix\" are " -"supported on macOS and iOS, both of which build on a Unix core." +"supported on macOS, iOS and Android, all of which build on a Unix core." msgstr "" -"如果沒有分別註釋的話,有標明「適用:Unix」註釋的所有函式也都於 macOS 上支援," -"因其建於 Unix 核心之上。" +"如果沒有分別標註的話,有標明「適用:Unix」標註的所有函式也都於 macOS、iOS 和 " +"Android 上支援,因其建於 Unix 核心之上。" #: ../../library/intro.rst:63 msgid "" @@ -213,64 +212,86 @@ msgid "" "not permit symlinks with absolute file names." msgstr "" -#: ../../library/intro.rst:126 -msgid "iOS" -msgstr "" +#: ../../library/intro.rst:127 +msgid "Mobile platforms" +msgstr "行動平台" -#: ../../library/intro.rst:128 +#: ../../library/intro.rst:129 msgid "" -"iOS is, in most respects, a POSIX operating system. File I/O, socket " -"handling, and threading all behave as they would on any POSIX operating " -"system. However, there are several major differences between iOS and other " -"POSIX systems." +"Android and iOS are, in most respects, POSIX operating systems. File I/O, " +"socket handling, and threading all behave as they would on any POSIX " +"operating system. However, there are several major differences:" msgstr "" -#: ../../library/intro.rst:132 +#: ../../library/intro.rst:133 msgid "" -"iOS can only use Python in \"embedded\" mode. There is no Python REPL, and " -"no ability to execute binaries that are part of the normal Python developer " -"experience, such as :program:`pip`. To add Python code to your iOS app, you " -"must use the :ref:`Python embedding API ` to add a Python " -"interpreter to an iOS app created with Xcode. See the :ref:`iOS usage guide " -"` for more details." +"Mobile platforms can only use Python in \"embedded\" mode. There is no " +"Python REPL, and no ability to use separate executables such as :program:" +"`python` or :program:`pip`. To add Python code to your mobile app, you must " +"use the :ref:`Python embedding API `. For more details, see :ref:" +"`using-android` and :ref:`using-ios`." msgstr "" #: ../../library/intro.rst:139 +msgid "Subprocesses:" +msgstr "" + +#: ../../library/intro.rst:141 msgid "" -"An iOS app cannot use any form of subprocessing, background processing, or " -"inter-process communication. If an iOS app attempts to create a subprocess, " -"the process creating the subprocess will either lock up, or crash. An iOS " -"app has no visibility of other applications that are running, nor any " -"ability to communicate with other running applications, outside of the iOS-" -"specific APIs that exist for this purpose." +"On Android, creating subprocesses is possible but `officially unsupported " +"`__. In " +"particular, Android does not support any part of the System V IPC API, so :" +"mod:`multiprocessing` is not available." msgstr "" #: ../../library/intro.rst:146 msgid "" -"iOS apps have limited access to modify system resources (such as the system " -"clock). These resources will often be *readable*, but attempts to modify " -"those resources will usually fail." +"An iOS app cannot use any form of subprocessing, multiprocessing, or inter-" +"process communication. If an iOS app attempts to create a subprocess, the " +"process creating the subprocess will either lock up, or crash. An iOS app " +"has no visibility of other applications that are running, nor any ability to " +"communicate with other running applications, outside of the iOS-specific " +"APIs that exist for this purpose." msgstr "" -#: ../../library/intro.rst:150 +#: ../../library/intro.rst:153 msgid "" -"iOS apps have a limited concept of console input and output. ``stdout`` and " -"``stderr`` *exist*, and content written to ``stdout`` and ``stderr`` will be " -"visible in logs when running in Xcode, but this content *won't* be recorded " -"in the system log. If a user who has installed your app provides their app " -"logs as a diagnostic aid, they will not include any detail written to " -"``stdout`` or ``stderr``." +"Mobile apps have limited access to modify system resources (such as the " +"system clock). These resources will often be *readable*, but attempts to " +"modify those resources will usually fail." msgstr "" #: ../../library/intro.rst:157 +msgid "Console input and output:" +msgstr "" + +#: ../../library/intro.rst:159 +msgid "" +"On Android, the native ``stdout`` and ``stderr`` are not connected to " +"anything, so Python installs its own streams which redirect messages to the " +"system log. These can be seen under the tags ``python.stdout`` and ``python." +"stderr`` respectively." +msgstr "" + +#: ../../library/intro.rst:164 +msgid "" +"iOS apps have a limited concept of console output. ``stdout`` and ``stderr`` " +"*exist*, and content written to ``stdout`` and ``stderr`` will be visible in " +"logs when running in Xcode, but this content *won't* be recorded in the " +"system log. If a user who has installed your app provides their app logs as " +"a diagnostic aid, they will not include any detail written to ``stdout`` or " +"``stderr``." +msgstr "" + +#: ../../library/intro.rst:171 msgid "" -"iOS apps have no concept of ``stdin`` at all. While iOS apps can have a " -"keyboard, this is a software feature, not something that is attached to " -"``stdin``." +"Mobile apps have no usable ``stdin`` at all. While apps can display an on-" +"screen keyboard, this is a software feature, not something that is attached " +"to ``stdin``." msgstr "" -#: ../../library/intro.rst:161 +#: ../../library/intro.rst:175 msgid "" -"As a result, Python library that involve console manipulation (such as :mod:" -"`curses` and :mod:`readline`) are not available on iOS." +"As a result, Python modules that involve console manipulation (such as :mod:" +"`curses` and :mod:`readline`) are not available on mobile platforms." msgstr "" diff --git a/library/json.po b/library/json.po index 8d22f578e3..a910b316ff 100644 --- a/library/json.po +++ b/library/json.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-08-05 15:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,10 +29,9 @@ msgid "**Source code:** :source:`Lib/json/__init__.py`" msgstr "**原始碼:**\\ :source:`Lib/json/__init__.py`" #: ../../library/json.rst:14 -#, fuzzy msgid "" "`JSON (JavaScript Object Notation) `_, specified by :rfc:" -"`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 `_, is a " "lightweight data interchange format inspired by `JavaScript `_ object literal syntax (although it is not a " @@ -118,7 +117,6 @@ msgid "Pretty printing::" msgstr "美化輸出: ::" #: ../../library/json.rst:56 -#, fuzzy msgid "" ">>> import json\n" ">>> print(json.dumps({'6': 7, '4': 5}, sort_keys=True, indent=4))\n" @@ -128,16 +126,15 @@ msgid "" "}" msgstr "" ">>> import json\n" -">>> print(json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4))\n" +">>> print(json.dumps({'6': 7, '4': 5}, sort_keys=True, indent=4))\n" "{\n" " \"4\": 5,\n" " \"6\": 7\n" "}" #: ../../library/json.rst:63 -#, fuzzy msgid "Specializing JSON object encoding::" -msgstr "自訂特殊的 JSON 解碼方式: ::" +msgstr "特殊化 JSON 物件解碼方式: ::" #: ../../library/json.rst:65 msgid "" @@ -912,11 +909,10 @@ msgid "Standard Compliance and Interoperability" msgstr "合規性與互通性(Interoperability)" #: ../../library/json.rst:559 -#, fuzzy msgid "" -"The JSON format is specified by :rfc:`7159` and by `ECMA-404 `_. " -"This section details this module's level of compliance with the RFC. For " +"The JSON format is specified by :rfc:`7159` and by `ECMA-404 `_. This " +"section details this module's level of compliance with the RFC. For " "simplicity, :class:`JSONEncoder` and :class:`JSONDecoder` subclasses, and " "parameters other than those explicitly mentioned, are not considered." msgstr "" diff --git a/library/mailcap.po b/library/mailcap.po deleted file mode 100644 index 6b778d0178..0000000000 --- a/library/mailcap.po +++ /dev/null @@ -1,148 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2015-12-09 17:51+0000\n" -"Last-Translator: Liang-Bo Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../../library/mailcap.rst:2 -msgid ":mod:`mailcap` --- Mailcap file handling" -msgstr ":mod:`mailcap` --- Mailcap 檔案處理" - -#: ../../library/mailcap.rst:8 -msgid "**Source code:** :source:`Lib/mailcap.py`" -msgstr "**原始碼:**\\ :source:`Lib/mailcap.py`" - -#: ../../library/mailcap.rst:10 -msgid "" -"The :mod:`mailcap` module is deprecated (see :pep:`PEP 594 <594#mailcap>` " -"for details). The :mod:`mimetypes` module provides an alternative." -msgstr "" - -#: ../../library/mailcap.rst:17 -msgid "" -"Mailcap files are used to configure how MIME-aware applications such as mail " -"readers and web browsers react to files with different MIME types. (The name " -"\"mailcap\" is derived from the phrase \"mail capability\".) For example, a " -"mailcap file might contain a line like ``video/mpeg; xmpeg %s``. Then, if " -"the user encounters an email message or web document with the MIME type :" -"mimetype:`video/mpeg`, ``%s`` will be replaced by a filename (usually one " -"belonging to a temporary file) and the :program:`xmpeg` program can be " -"automatically started to view the file." -msgstr "" - -#: ../../library/mailcap.rst:26 -msgid "" -"The mailcap format is documented in :rfc:`1524`, \"A User Agent " -"Configuration Mechanism For Multimedia Mail Format Information\", but is not " -"an internet standard. However, mailcap files are supported on most Unix " -"systems." -msgstr "" - -#: ../../library/mailcap.rst:33 -msgid "" -"Return a 2-tuple; the first element is a string containing the command line " -"to be executed (which can be passed to :func:`os.system`), and the second " -"element is the mailcap entry for a given MIME type. If no matching MIME " -"type can be found, ``(None, None)`` is returned." -msgstr "" - -#: ../../library/mailcap.rst:38 -msgid "" -"*key* is the name of the field desired, which represents the type of " -"activity to be performed; the default value is 'view', since in the most " -"common case you simply want to view the body of the MIME-typed data. Other " -"possible values might be 'compose' and 'edit', if you wanted to create a new " -"body of the given MIME type or alter the existing body data. See :rfc:" -"`1524` for a complete list of these fields." -msgstr "" - -#: ../../library/mailcap.rst:45 -msgid "" -"*filename* is the filename to be substituted for ``%s`` in the command line; " -"the default value is ``'/dev/null'`` which is almost certainly not what you " -"want, so usually you'll override it by specifying a filename." -msgstr "" - -#: ../../library/mailcap.rst:49 -msgid "" -"*plist* can be a list containing named parameters; the default value is " -"simply an empty list. Each entry in the list must be a string containing " -"the parameter name, an equals sign (``'='``), and the parameter's value. " -"Mailcap entries can contain named parameters like ``%{foo}``, which will be " -"replaced by the value of the parameter named 'foo'. For example, if the " -"command line ``showpartial %{id} %{number} %{total}`` was in a mailcap file, " -"and *plist* was set to ``['id=1', 'number=2', 'total=3']``, the resulting " -"command line would be ``'showpartial 1 2 3'``." -msgstr "" - -#: ../../library/mailcap.rst:58 -msgid "" -"In a mailcap file, the \"test\" field can optionally be specified to test " -"some external condition (such as the machine architecture, or the window " -"system in use) to determine whether or not the mailcap line applies. :func:" -"`findmatch` will automatically check such conditions and skip the entry if " -"the check fails." -msgstr "" - -#: ../../library/mailcap.rst:65 -msgid "" -"To prevent security issues with shell metacharacters (symbols that have " -"special effects in a shell command line), ``findmatch`` will refuse to " -"inject ASCII characters other than alphanumerics and ``@+=:,./-_`` into the " -"returned command line." -msgstr "" - -#: ../../library/mailcap.rst:70 -msgid "" -"If a disallowed character appears in *filename*, ``findmatch`` will always " -"return ``(None, None)`` as if no entry was found. If such a character " -"appears elsewhere (a value in *plist* or in *MIMEtype*), ``findmatch`` will " -"ignore all mailcap entries which use that value. A :mod:`warning ` " -"will be raised in either case." -msgstr "" - -#: ../../library/mailcap.rst:78 -msgid "" -"Returns a dictionary mapping MIME types to a list of mailcap file entries. " -"This dictionary must be passed to the :func:`findmatch` function. An entry " -"is stored as a list of dictionaries, but it shouldn't be necessary to know " -"the details of this representation." -msgstr "" - -#: ../../library/mailcap.rst:83 -msgid "" -"The information is derived from all of the mailcap files found on the " -"system. Settings in the user's mailcap file :file:`$HOME/.mailcap` will " -"override settings in the system mailcap files :file:`/etc/mailcap`, :file:`/" -"usr/etc/mailcap`, and :file:`/usr/local/etc/mailcap`." -msgstr "" - -#: ../../library/mailcap.rst:88 -msgid "An example usage::" -msgstr "" - -#: ../../library/mailcap.rst:90 -msgid "" -">>> import mailcap\n" -">>> d = mailcap.getcaps()\n" -">>> mailcap.findmatch(d, 'video/mpeg', filename='tmp1223')\n" -"('xmpeg tmp1223', {'view': 'xmpeg %s'})" -msgstr "" -">>> import mailcap\n" -">>> d = mailcap.getcaps()\n" -">>> mailcap.findmatch(d, 'video/mpeg', filename='tmp1223')\n" -"('xmpeg tmp1223', {'view': 'xmpeg %s'})" diff --git a/library/mmap.po b/library/mmap.po index b9e77a07cc..753e0bb140 100644 --- a/library/mmap.po +++ b/library/mmap.po @@ -23,16 +23,15 @@ msgstr ":mod:`!mmap` --- 記憶體映射檔案的支援" #: ../../includes/wasm-notavail.rst:3 msgid ":ref:`Availability `: not WASI." -msgstr "" +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/mmap.rst:11 msgid "" diff --git a/library/msilib.po b/library/msilib.po deleted file mode 100644 index f7d0ed3c2a..0000000000 --- a/library/msilib.po +++ /dev/null @@ -1,623 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+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-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../../library/msilib.rst:2 -msgid ":mod:`msilib` --- Read and write Microsoft Installer files" -msgstr ":mod:`msilib` --- 讀寫 Microsoft Installer 檔案" - -#: ../../library/msilib.rst:12 -msgid "**Source code:** :source:`Lib/msilib/__init__.py`" -msgstr "**原始碼:**\\ :source:`Lib/msilib/__init__.py`" - -#: ../../library/msilib.rst:16 -msgid "" -"The :mod:`msilib` module is deprecated (see :pep:`PEP 594 <594#msilib>` for " -"details)." -msgstr "" -":mod:`msilib` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 " -"<594#msilib>`\\ )。" - -#: ../../library/msilib.rst:22 -msgid "" -"The :mod:`msilib` supports the creation of Microsoft Installer (``.msi``) " -"files. Because these files often contain an embedded \"cabinet\" file (``." -"cab``), it also exposes an API to create CAB files. Support for reading ``." -"cab`` files is currently not implemented; read support for the ``.msi`` " -"database is possible." -msgstr "" - -#: ../../library/msilib.rst:27 -msgid "" -"This package aims to provide complete access to all tables in an ``.msi`` " -"file, therefore, it is a fairly low-level API. One primary application of " -"this package is the creation of Python installer package itself (although " -"that currently uses a different version of ``msilib``)." -msgstr "" - -#: ../../library/msilib.rst:32 -msgid "" -"The package contents can be roughly split into four parts: low-level CAB " -"routines, low-level MSI routines, higher-level MSI routines, and standard " -"table structures." -msgstr "" - -#: ../../library/msilib.rst:39 -msgid "" -"Create a new CAB file named *cabname*. *files* must be a list of tuples, " -"each containing the name of the file on disk, and the name of the file " -"inside the CAB file." -msgstr "" - -#: ../../library/msilib.rst:43 -msgid "" -"The files are added to the CAB file in the order they appear in the list. " -"All files are added into a single CAB file, using the MSZIP compression " -"algorithm." -msgstr "" - -#: ../../library/msilib.rst:46 -msgid "" -"Callbacks to Python for the various steps of MSI creation are currently not " -"exposed." -msgstr "" - -#: ../../library/msilib.rst:52 -msgid "" -"Return the string representation of a new unique identifier. This wraps the " -"Windows API functions :c:func:`UuidCreate` and :c:func:`UuidToString`." -msgstr "" - -#: ../../library/msilib.rst:58 -msgid "" -"Return a new database object by calling MsiOpenDatabase. *path* is the " -"file name of the MSI file; *persist* can be one of the constants " -"``MSIDBOPEN_CREATEDIRECT``, ``MSIDBOPEN_CREATE``, ``MSIDBOPEN_DIRECT``, " -"``MSIDBOPEN_READONLY``, or ``MSIDBOPEN_TRANSACT``, and may include the flag " -"``MSIDBOPEN_PATCHFILE``. See the Microsoft documentation for the meaning of " -"these flags; depending on the flags, an existing database is opened, or a " -"new one created." -msgstr "" - -#: ../../library/msilib.rst:69 -msgid "" -"Return a new record object by calling :c:func:`MSICreateRecord`. *count* is " -"the number of fields of the record." -msgstr "" - -#: ../../library/msilib.rst:75 -msgid "" -"Create and return a new database *name*, initialize it with *schema*, and " -"set the properties *ProductName*, *ProductCode*, *ProductVersion*, and " -"*Manufacturer*." -msgstr "" - -#: ../../library/msilib.rst:79 -msgid "" -"*schema* must be a module object containing ``tables`` and " -"``_Validation_records`` attributes; typically, :mod:`msilib.schema` should " -"be used." -msgstr "" - -#: ../../library/msilib.rst:83 -msgid "" -"The database will contain just the schema and the validation records when " -"this function returns." -msgstr "" - -#: ../../library/msilib.rst:89 -msgid "Add all *records* to the table named *table* in *database*." -msgstr "" - -#: ../../library/msilib.rst:91 -msgid "" -"The *table* argument must be one of the predefined tables in the MSI schema, " -"e.g. ``'Feature'``, ``'File'``, ``'Component'``, ``'Dialog'``, " -"``'Control'``, etc." -msgstr "" - -#: ../../library/msilib.rst:95 -msgid "" -"*records* should be a list of tuples, each one containing all fields of a " -"record according to the schema of the table. For optional fields, ``None`` " -"can be passed." -msgstr "" - -#: ../../library/msilib.rst:99 -msgid "Field values can be ints, strings, or instances of the Binary class." -msgstr "" - -#: ../../library/msilib.rst:104 -msgid "" -"Represents entries in the Binary table; inserting such an object using :func:" -"`add_data` reads the file named *filename* into the table." -msgstr "" - -#: ../../library/msilib.rst:110 -msgid "" -"Add all table content from *module* to *database*. *module* must contain an " -"attribute *tables* listing all tables for which content should be added, and " -"one attribute per table that has the actual content." -msgstr "" - -#: ../../library/msilib.rst:114 -msgid "This is typically used to install the sequence tables." -msgstr "" - -#: ../../library/msilib.rst:119 -msgid "" -"Add the file *path* into the ``_Stream`` table of *database*, with the " -"stream name *name*." -msgstr "" - -#: ../../library/msilib.rst:125 -msgid "" -"Return a new UUID, in the format that MSI typically requires (i.e. in curly " -"braces, and with all hexdigits in uppercase)." -msgstr "" - -#: ../../library/msilib.rst:131 -msgid "" -"`FCICreate `_ " -"`UuidCreate `_ `UuidToString `_" -msgstr "" - -#: ../../library/msilib.rst:138 -msgid "Database Objects" -msgstr "" - -#: ../../library/msilib.rst:143 -msgid "" -"Return a view object, by calling :c:func:`MSIDatabaseOpenView`. *sql* is the " -"SQL statement to execute." -msgstr "" - -#: ../../library/msilib.rst:149 -msgid "" -"Commit the changes pending in the current transaction, by calling :c:func:" -"`MSIDatabaseCommit`." -msgstr "" - -#: ../../library/msilib.rst:155 -msgid "" -"Return a new summary information object, by calling :c:func:" -"`MsiGetSummaryInformation`. *count* is the maximum number of updated values." -msgstr "" - -#: ../../library/msilib.rst:161 -msgid "Close the database object, through :c:func:`MsiCloseHandle`." -msgstr "" - -#: ../../library/msilib.rst:167 -msgid "" -"`MSIDatabaseOpenView `_ `MSIDatabaseCommit `_ `MSIGetSummaryInformation " -"`_ " -"`MsiCloseHandle `_" -msgstr "" - -#: ../../library/msilib.rst:175 -msgid "View Objects" -msgstr "" - -#: ../../library/msilib.rst:180 -msgid "" -"Execute the SQL query of the view, through :c:func:`MSIViewExecute`. If " -"*params* is not ``None``, it is a record describing actual values of the " -"parameter tokens in the query." -msgstr "" - -#: ../../library/msilib.rst:187 -msgid "" -"Return a record describing the columns of the view, through calling :c:func:" -"`MsiViewGetColumnInfo`. *kind* can be either ``MSICOLINFO_NAMES`` or " -"``MSICOLINFO_TYPES``." -msgstr "" - -#: ../../library/msilib.rst:194 -msgid "" -"Return a result record of the query, through calling :c:func:`MsiViewFetch`." -msgstr "" - -#: ../../library/msilib.rst:199 -msgid "" -"Modify the view, by calling :c:func:`MsiViewModify`. *kind* can be one of " -"``MSIMODIFY_SEEK``, ``MSIMODIFY_REFRESH``, ``MSIMODIFY_INSERT``, " -"``MSIMODIFY_UPDATE``, ``MSIMODIFY_ASSIGN``, ``MSIMODIFY_REPLACE``, " -"``MSIMODIFY_MERGE``, ``MSIMODIFY_DELETE``, ``MSIMODIFY_INSERT_TEMPORARY``, " -"``MSIMODIFY_VALIDATE``, ``MSIMODIFY_VALIDATE_NEW``, " -"``MSIMODIFY_VALIDATE_FIELD``, or ``MSIMODIFY_VALIDATE_DELETE``." -msgstr "" - -#: ../../library/msilib.rst:206 -msgid "*data* must be a record describing the new data." -msgstr "" - -#: ../../library/msilib.rst:211 -msgid "Close the view, through :c:func:`MsiViewClose`." -msgstr "" - -#: ../../library/msilib.rst:216 -msgid "" -"`MsiViewExecute `_ `MSIViewGetColumnInfo `_ `MsiViewFetch `_ `MsiViewModify " -"`_ " -"`MsiViewClose `_" -msgstr "" - -#: ../../library/msilib.rst:225 -msgid "Summary Information Objects" -msgstr "" - -#: ../../library/msilib.rst:230 -msgid "" -"Return a property of the summary, through :c:func:" -"`MsiSummaryInfoGetProperty`. *field* is the name of the property, and can be " -"one of the constants ``PID_CODEPAGE``, ``PID_TITLE``, ``PID_SUBJECT``, " -"``PID_AUTHOR``, ``PID_KEYWORDS``, ``PID_COMMENTS``, ``PID_TEMPLATE``, " -"``PID_LASTAUTHOR``, ``PID_REVNUMBER``, ``PID_LASTPRINTED``, " -"``PID_CREATE_DTM``, ``PID_LASTSAVE_DTM``, ``PID_PAGECOUNT``, " -"``PID_WORDCOUNT``, ``PID_CHARCOUNT``, ``PID_APPNAME``, or ``PID_SECURITY``." -msgstr "" - -#: ../../library/msilib.rst:241 -msgid "" -"Return the number of summary properties, through :c:func:" -"`MsiSummaryInfoGetPropertyCount`." -msgstr "" - -#: ../../library/msilib.rst:247 -msgid "" -"Set a property through :c:func:`MsiSummaryInfoSetProperty`. *field* can have " -"the same values as in :meth:`GetProperty`, *value* is the new value of the " -"property. Possible value types are integer and string." -msgstr "" - -#: ../../library/msilib.rst:254 -msgid "" -"Write the modified properties to the summary information stream, using :c:" -"func:`MsiSummaryInfoPersist`." -msgstr "" - -#: ../../library/msilib.rst:260 -msgid "" -"`MsiSummaryInfoGetProperty `_ `MsiSummaryInfoGetPropertyCount `_ " -"`MsiSummaryInfoSetProperty `_ `MsiSummaryInfoPersist `_" -msgstr "" - -#: ../../library/msilib.rst:268 -msgid "Record Objects" -msgstr "" - -#: ../../library/msilib.rst:273 -msgid "" -"Return the number of fields of the record, through :c:func:" -"`MsiRecordGetFieldCount`." -msgstr "" - -#: ../../library/msilib.rst:279 -msgid "" -"Return the value of *field* as an integer where possible. *field* must be " -"an integer." -msgstr "" - -#: ../../library/msilib.rst:285 -msgid "" -"Return the value of *field* as a string where possible. *field* must be an " -"integer." -msgstr "" - -#: ../../library/msilib.rst:291 -msgid "" -"Set *field* to *value* through :c:func:`MsiRecordSetString`. *field* must be " -"an integer; *value* a string." -msgstr "" - -#: ../../library/msilib.rst:297 -msgid "" -"Set *field* to the contents of the file named *value*, through :c:func:" -"`MsiRecordSetStream`. *field* must be an integer; *value* a string." -msgstr "" - -#: ../../library/msilib.rst:303 -msgid "" -"Set *field* to *value* through :c:func:`MsiRecordSetInteger`. Both *field* " -"and *value* must be an integer." -msgstr "" - -#: ../../library/msilib.rst:309 -msgid "" -"Set all fields of the record to 0, through :c:func:`MsiRecordClearData`." -msgstr "" - -#: ../../library/msilib.rst:314 -msgid "" -"`MsiRecordGetFieldCount `_ `MsiRecordSetString `_ `MsiRecordSetStream `_ " -"`MsiRecordSetInteger `_ `MsiRecordClearData `_" -msgstr "" - -#: ../../library/msilib.rst:323 -msgid "Errors" -msgstr "" - -#: ../../library/msilib.rst:325 -msgid "" -"All wrappers around MSI functions raise :exc:`MSIError`; the string inside " -"the exception will contain more detail." -msgstr "" - -#: ../../library/msilib.rst:332 -msgid "CAB Objects" -msgstr "CAB 物件" - -#: ../../library/msilib.rst:337 -msgid "" -"The class :class:`CAB` represents a CAB file. During MSI construction, files " -"will be added simultaneously to the ``Files`` table, and to a CAB file. " -"Then, when all files have been added, the CAB file can be written, then " -"added to the MSI file." -msgstr "" - -#: ../../library/msilib.rst:342 -msgid "*name* is the name of the CAB file in the MSI file." -msgstr "" - -#: ../../library/msilib.rst:347 -msgid "" -"Add the file with the pathname *full* to the CAB file, under the name " -"*logical*. If there is already a file named *logical*, a new file name is " -"created." -msgstr "" - -#: ../../library/msilib.rst:351 -msgid "" -"Return the index of the file in the CAB file, and the new name of the file " -"inside the CAB file." -msgstr "" - -#: ../../library/msilib.rst:357 -msgid "" -"Generate a CAB file, add it as a stream to the MSI file, put it into the " -"``Media`` table, and remove the generated file from the disk." -msgstr "" - -#: ../../library/msilib.rst:364 -msgid "Directory Objects" -msgstr "" - -#: ../../library/msilib.rst:369 -msgid "" -"Create a new directory in the Directory table. There is a current component " -"at each point in time for the directory, which is either explicitly created " -"through :meth:`start_component`, or implicitly when files are added for the " -"first time. Files are added into the current component, and into the cab " -"file. To create a directory, a base directory object needs to be specified " -"(can be ``None``), the path to the physical directory, and a logical " -"directory name. *default* specifies the DefaultDir slot in the directory " -"table. *componentflags* specifies the default flags that new components get." -msgstr "" - -#: ../../library/msilib.rst:381 -msgid "" -"Add an entry to the Component table, and make this component the current " -"component for this directory. If no component name is given, the directory " -"name is used. If no *feature* is given, the current feature is used. If no " -"*flags* are given, the directory's default flags are used. If no *keyfile* " -"is given, the KeyPath is left null in the Component table." -msgstr "" - -#: ../../library/msilib.rst:390 -msgid "" -"Add a file to the current component of the directory, starting a new one if " -"there is no current component. By default, the file name in the source and " -"the file table will be identical. If the *src* file is specified, it is " -"interpreted relative to the current directory. Optionally, a *version* and a " -"*language* can be specified for the entry in the File table." -msgstr "" - -#: ../../library/msilib.rst:399 -msgid "" -"Add a list of files to the current component as specified in the glob " -"pattern. Individual files can be excluded in the *exclude* list." -msgstr "" - -#: ../../library/msilib.rst:405 -msgid "Remove ``.pyc`` files on uninstall." -msgstr "" - -#: ../../library/msilib.rst:410 -msgid "" -"`Directory Table `_ `File Table `_ `Component Table `_ `FeatureComponents Table " -"`_" -msgstr "" - -#: ../../library/msilib.rst:418 -msgid "Features" -msgstr "" - -#: ../../library/msilib.rst:423 -msgid "" -"Add a new record to the ``Feature`` table, using the values *id*, *parent." -"id*, *title*, *desc*, *display*, *level*, *directory*, and *attributes*. The " -"resulting feature object can be passed to the :meth:`start_component` method " -"of :class:`Directory`." -msgstr "" - -#: ../../library/msilib.rst:431 -msgid "" -"Make this feature the current feature of :mod:`msilib`. New components are " -"automatically added to the default feature, unless a feature is explicitly " -"specified." -msgstr "" - -#: ../../library/msilib.rst:438 -msgid "" -"`Feature Table `_" -msgstr "" - -#: ../../library/msilib.rst:443 -msgid "GUI classes" -msgstr "" - -#: ../../library/msilib.rst:445 -msgid "" -":mod:`msilib` provides several classes that wrap the GUI tables in an MSI " -"database. However, no standard user interface is provided." -msgstr "" - -#: ../../library/msilib.rst:451 -msgid "" -"Base class of the dialog controls. *dlg* is the dialog object the control " -"belongs to, and *name* is the control's name." -msgstr "" - -#: ../../library/msilib.rst:457 -msgid "Make an entry into the ``ControlEvent`` table for this control." -msgstr "" - -#: ../../library/msilib.rst:462 -msgid "Make an entry into the ``EventMapping`` table for this control." -msgstr "" - -#: ../../library/msilib.rst:467 -msgid "Make an entry into the ``ControlCondition`` table for this control." -msgstr "" - -#: ../../library/msilib.rst:472 -msgid "" -"Create a radio button control named *name*. *property* is the installer " -"property that gets set when a radio button is selected." -msgstr "" - -#: ../../library/msilib.rst:478 -msgid "" -"Add a radio button named *name* to the group, at the coordinates *x*, *y*, " -"*width*, *height*, and with the label *text*. If *value* is ``None``, it " -"defaults to *name*." -msgstr "" - -#: ../../library/msilib.rst:485 -msgid "" -"Return a new :class:`Dialog` object. An entry in the ``Dialog`` table is " -"made, with the specified coordinates, dialog attributes, title, name of the " -"first, default, and cancel controls." -msgstr "" - -#: ../../library/msilib.rst:492 -msgid "" -"Return a new :class:`Control` object. An entry in the ``Control`` table is " -"made with the specified parameters." -msgstr "" - -#: ../../library/msilib.rst:495 -msgid "" -"This is a generic method; for specific types, specialized methods are " -"provided." -msgstr "" - -#: ../../library/msilib.rst:501 -msgid "Add and return a ``Text`` control." -msgstr "" - -#: ../../library/msilib.rst:506 -msgid "Add and return a ``Bitmap`` control." -msgstr "" - -#: ../../library/msilib.rst:511 -msgid "Add and return a ``Line`` control." -msgstr "" - -#: ../../library/msilib.rst:516 -msgid "Add and return a ``PushButton`` control." -msgstr "" - -#: ../../library/msilib.rst:521 -msgid "Add and return a ``RadioButtonGroup`` control." -msgstr "" - -#: ../../library/msilib.rst:526 -msgid "Add and return a ``CheckBox`` control." -msgstr "" - -#: ../../library/msilib.rst:531 -msgid "" -"`Dialog Table `_ `Control Table `_ `Control Types `_ `ControlCondition Table " -"`_ " -"`ControlEvent Table `_ `EventMapping Table `_ `RadioButton Table `_" -msgstr "" - -#: ../../library/msilib.rst:542 -msgid "Precomputed tables" -msgstr "" - -#: ../../library/msilib.rst:544 -msgid "" -":mod:`msilib` provides a few subpackages that contain only schema and table " -"definitions. Currently, these definitions are based on MSI version 2.0." -msgstr "" - -#: ../../library/msilib.rst:550 -msgid "" -"This is the standard MSI schema for MSI 2.0, with the *tables* variable " -"providing a list of table definitions, and *_Validation_records* providing " -"the data for MSI validation." -msgstr "" - -#: ../../library/msilib.rst:557 -msgid "" -"This module contains table contents for the standard sequence tables: " -"*AdminExecuteSequence*, *AdminUISequence*, *AdvtExecuteSequence*, " -"*InstallExecuteSequence*, and *InstallUISequence*." -msgstr "" - -#: ../../library/msilib.rst:564 -msgid "" -"This module contains definitions for the UIText and ActionText tables, for " -"the standard installer actions." -msgstr "" - -#: ../../library/msilib.rst:14 -msgid "msi" -msgstr "msi" diff --git a/library/multiprocessing.po b/library/multiprocessing.po index 6bbd946213..c428df62b4 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -25,20 +25,17 @@ msgstr ":mod:`!multiprocessing` --- 以行程為基礎的平行性" msgid "**Source code:** :source:`Lib/multiprocessing/`" msgstr "**原始碼:**\\ :source:`Lib/multiprocessing/`" -#: ../../includes/wasm-ios-notavail.rst:3 -msgid ":ref:`Availability `: not WASI, not iOS." -msgstr "" +#: ../../includes/wasm-mobile-notavail.rst:3 +msgid ":ref:`Availability `: not Android, not iOS, not WASI." +msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" -#: ../../includes/wasm-ios-notavail.rst:5 -#, fuzzy +#: ../../includes/wasm-mobile-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms, or " -"on iOS. See :ref:`wasm-availability` for more information on WASM " -"availability; see :ref:`iOS-availability` for more information on iOS " -"availability." +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在\\ :ref:`行動平台 `\\ 或\\ :ref:`WebAssembly 平" +"台 `\\ 上不支援。" #: ../../library/multiprocessing.rst:14 msgid "Introduction" @@ -4883,5 +4880,15 @@ msgid "" " test()\n" msgstr "" +#, fuzzy +#~ msgid "" +#~ "This module does not work or is not available on WebAssembly platforms, " +#~ "or on iOS. See :ref:`wasm-availability` for more information on WASM " +#~ "availability; see :ref:`iOS-availability` for more information on iOS " +#~ "availability." +#~ msgstr "" +#~ "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法" +#~ "作用或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" + #~ msgid ":func:`os.cpu_count`" #~ msgstr ":func:`os.cpu_count`" diff --git a/library/nis.po b/library/nis.po deleted file mode 100644 index 4f16e11b08..0000000000 --- a/library/nis.po +++ /dev/null @@ -1,100 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" -"PO-Revision-Date: 2016-11-19 00:32+0000\n" -"Last-Translator: Liang-Bo Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../../library/nis.rst:3 -msgid ":mod:`nis` --- Interface to Sun's NIS (Yellow Pages)" -msgstr ":mod:`nis` --- Sun NIS (Yellow Pages) 介面" - -#: ../../library/nis.rst:13 -msgid "" -"The :mod:`nis` module is deprecated (see :pep:`PEP 594 <594#nis>` for " -"details)." -msgstr "" -":mod:`nis` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#nis>`\\ )。" - -#: ../../library/nis.rst:19 -msgid "" -"The :mod:`nis` module gives a thin wrapper around the NIS library, useful " -"for central administration of several hosts." -msgstr "" - -#: ../../library/nis.rst:22 -msgid "" -"Because NIS exists only on Unix systems, this module is only available for " -"Unix." -msgstr "" - -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: ../../includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" - -#: ../../library/nis.rst:26 -msgid "The :mod:`nis` module defines the following functions:" -msgstr "" - -#: ../../library/nis.rst:31 -msgid "" -"Return the match for *key* in map *mapname*, or raise an error (:exc:`nis." -"error`) if there is none. Both should be strings, *key* is 8-bit clean. " -"Return value is an arbitrary array of bytes (may contain ``NULL`` and other " -"joys)." -msgstr "" - -#: ../../library/nis.rst:36 ../../library/nis.rst:48 -msgid "Note that *mapname* is first checked if it is an alias to another name." -msgstr "" - -#: ../../library/nis.rst:38 ../../library/nis.rst:50 ../../library/nis.rst:58 -msgid "" -"The *domain* argument allows overriding the NIS domain used for the lookup. " -"If unspecified, lookup is in the default NIS domain." -msgstr "" - -#: ../../library/nis.rst:44 -msgid "" -"Return a dictionary mapping *key* to *value* such that ``match(key, " -"mapname)==value``. Note that both keys and values of the dictionary are " -"arbitrary arrays of bytes." -msgstr "" - -#: ../../library/nis.rst:56 -msgid "Return a list of all valid maps." -msgstr "" - -#: ../../library/nis.rst:64 -msgid "Return the system default NIS domain." -msgstr "" - -#: ../../library/nis.rst:67 -msgid "The :mod:`nis` module defines the following exception:" -msgstr "" - -#: ../../library/nis.rst:71 -msgid "An error raised when a NIS function returns an error code." -msgstr "" diff --git a/library/nntplib.po b/library/nntplib.po deleted file mode 100644 index d0720d6f85..0000000000 --- a/library/nntplib.po +++ /dev/null @@ -1,688 +0,0 @@ -# Copyright (C) 2001-2024, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\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-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../../library/nntplib.rst:2 -msgid ":mod:`nntplib` --- NNTP protocol client" -msgstr ":mod:`nntplib` --- NNTP 協定客戶端" - -#: ../../library/nntplib.rst:8 -msgid "**Source code:** :source:`Lib/nntplib.py`" -msgstr "**原始碼:**\\ :source:`Lib/nntplib.py`" - -#: ../../library/nntplib.rst:14 -msgid "The :mod:`nntplib` module is deprecated (see :pep:`594` for details)." -msgstr ":mod:`nntlib` 模組 (module) 即將被棄用(詳見 :pep:`594`\\ )。" - -#: ../../library/nntplib.rst:36 -msgid "" -"This module defines the class :class:`NNTP` which implements the client side " -"of the Network News Transfer Protocol. It can be used to implement a news " -"reader or poster, or automated news processors. It is compatible with :rfc:" -"`3977` as well as the older :rfc:`977` and :rfc:`2980`." -msgstr "" - -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: ../../includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" - -#: ../../library/nntplib.rst:43 -msgid "" -"Here are two small examples of how it can be used. To list some statistics " -"about a newsgroup and print the subjects of the last 10 articles::" -msgstr "" - -#: ../../library/nntplib.rst:46 -msgid "" -">>> s = nntplib.NNTP('news.gmane.io')\n" -">>> resp, count, first, last, name = s.group('gmane.comp.python." -"committers')\n" -">>> print('Group', name, 'has', count, 'articles, range', first, 'to', " -"last)\n" -"Group gmane.comp.python.committers has 1096 articles, range 1 to 1096\n" -">>> resp, overviews = s.over((last - 9, last))\n" -">>> for id, over in overviews:\n" -"... print(id, nntplib.decode_header(over['subject']))\n" -"...\n" -"1087 Re: Commit privileges for Łukasz Langa\n" -"1088 Re: 3.2 alpha 2 freeze\n" -"1089 Re: 3.2 alpha 2 freeze\n" -"1090 Re: Commit privileges for Łukasz Langa\n" -"1091 Re: Commit privileges for Łukasz Langa\n" -"1092 Updated ssh key\n" -"1093 Re: Updated ssh key\n" -"1094 Re: Updated ssh key\n" -"1095 Hello fellow committers!\n" -"1096 Re: Hello fellow committers!\n" -">>> s.quit()\n" -"'205 Bye!'" -msgstr "" -">>> s = nntplib.NNTP('news.gmane.io')\n" -">>> resp, count, first, last, name = s.group('gmane.comp.python." -"committers')\n" -">>> print('Group', name, 'has', count, 'articles, range', first, 'to', " -"last)\n" -"Group gmane.comp.python.committers has 1096 articles, range 1 to 1096\n" -">>> resp, overviews = s.over((last - 9, last))\n" -">>> for id, over in overviews:\n" -"... print(id, nntplib.decode_header(over['subject']))\n" -"...\n" -"1087 Re: Commit privileges for Łukasz Langa\n" -"1088 Re: 3.2 alpha 2 freeze\n" -"1089 Re: 3.2 alpha 2 freeze\n" -"1090 Re: Commit privileges for Łukasz Langa\n" -"1091 Re: Commit privileges for Łukasz Langa\n" -"1092 Updated ssh key\n" -"1093 Re: Updated ssh key\n" -"1094 Re: Updated ssh key\n" -"1095 Hello fellow committers!\n" -"1096 Re: Hello fellow committers!\n" -">>> s.quit()\n" -"'205 Bye!'" - -#: ../../library/nntplib.rst:67 -msgid "" -"To post an article from a binary file (this assumes that the article has " -"valid headers, and that you have right to post on the particular newsgroup)::" -msgstr "" - -#: ../../library/nntplib.rst:70 -msgid "" -">>> s = nntplib.NNTP('news.gmane.io')\n" -">>> f = open('article.txt', 'rb')\n" -">>> s.post(f)\n" -"'240 Article posted successfully.'\n" -">>> s.quit()\n" -"'205 Bye!'" -msgstr "" -">>> s = nntplib.NNTP('news.gmane.io')\n" -">>> f = open('article.txt', 'rb')\n" -">>> s.post(f)\n" -"'240 Article posted successfully.'\n" -">>> s.quit()\n" -"'205 Bye!'" - -#: ../../library/nntplib.rst:77 -msgid "The module itself defines the following classes:" -msgstr "" - -#: ../../library/nntplib.rst:82 -msgid "" -"Return a new :class:`NNTP` object, representing a connection to the NNTP " -"server running on host *host*, listening at port *port*. An optional " -"*timeout* can be specified for the socket connection. If the optional *user* " -"and *password* are provided, or if suitable credentials are present in :file:" -"`/.netrc` and the optional flag *usenetrc* is true, the ``AUTHINFO USER`` " -"and ``AUTHINFO PASS`` commands are used to identify and authenticate the " -"user to the server. If the optional flag *readermode* is true, then a " -"``mode reader`` command is sent before authentication is performed. Reader " -"mode is sometimes necessary if you are connecting to an NNTP server on the " -"local machine and intend to call reader-specific commands, such as " -"``group``. If you get unexpected :exc:`NNTPPermanentError`\\ s, you might " -"need to set *readermode*. The :class:`NNTP` class supports the :keyword:" -"`with` statement to unconditionally consume :exc:`OSError` exceptions and to " -"close the NNTP connection when done, e.g.:" -msgstr "" - -#: ../../library/nntplib.rst:105 ../../library/nntplib.rst:137 -msgid "" -"Raises an :ref:`auditing event ` ``nntplib.connect`` with " -"arguments ``self``, ``host``, ``port``." -msgstr "" -"引發一個附帶引數 ``self``、``host``、``port`` 的\\ :ref:`稽核事件 " -"` ``nntplib.connect``。" - -#: ../../library/nntplib.rst:107 ../../library/nntplib.rst:109 -#: ../../library/nntplib.rst:139 ../../library/nntplib.rst:141 -msgid "" -"All commands will raise an :ref:`auditing event ` ``nntplib." -"putline`` with arguments ``self`` and ``line``, where ``line`` is the bytes " -"about to be sent to the remote host." -msgstr "" - -#: ../../library/nntplib.rst:113 -msgid "*usenetrc* is now ``False`` by default." -msgstr "" - -#: ../../library/nntplib.rst:116 -msgid "Support for the :keyword:`with` statement was added." -msgstr "" - -#: ../../library/nntplib.rst:119 ../../library/nntplib.rst:152 -msgid "" -"If the *timeout* parameter is set to be zero, it will raise a :class:" -"`ValueError` to prevent the creation of a non-blocking socket." -msgstr "" - -#: ../../library/nntplib.rst:125 -msgid "" -"Return a new :class:`NNTP_SSL` object, representing an encrypted connection " -"to the NNTP server running on host *host*, listening at port *port*. :class:" -"`NNTP_SSL` objects have the same methods as :class:`NNTP` objects. If " -"*port* is omitted, port 563 (NNTPS) is used. *ssl_context* is also optional, " -"and is a :class:`~ssl.SSLContext` object. Please read :ref:`ssl-security` " -"for best practices. All other parameters behave the same as for :class:" -"`NNTP`." -msgstr "" - -#: ../../library/nntplib.rst:133 -msgid "" -"Note that SSL-on-563 is discouraged per :rfc:`4642`, in favor of STARTTLS as " -"described below. However, some servers only support the former." -msgstr "" - -#: ../../library/nntplib.rst:147 -msgid "" -"The class now supports hostname check with :attr:`ssl.SSLContext." -"check_hostname` and *Server Name Indication* (see :data:`ssl.HAS_SNI`)." -msgstr "" - -#: ../../library/nntplib.rst:158 -msgid "" -"Derived from the standard exception :exc:`Exception`, this is the base class " -"for all exceptions raised by the :mod:`nntplib` module. Instances of this " -"class have the following attribute:" -msgstr "" - -#: ../../library/nntplib.rst:164 -msgid "The response of the server if available, as a :class:`str` object." -msgstr "" - -#: ../../library/nntplib.rst:169 -msgid "Exception raised when an unexpected reply is received from the server." -msgstr "" - -#: ../../library/nntplib.rst:174 -msgid "" -"Exception raised when a response code in the range 400--499 is received." -msgstr "" - -#: ../../library/nntplib.rst:179 -msgid "" -"Exception raised when a response code in the range 500--599 is received." -msgstr "" - -#: ../../library/nntplib.rst:184 -msgid "" -"Exception raised when a reply is received from the server that does not " -"begin with a digit in the range 1--5." -msgstr "" - -#: ../../library/nntplib.rst:190 -msgid "Exception raised when there is some error in the response data." -msgstr "" - -#: ../../library/nntplib.rst:196 -msgid "NNTP Objects" -msgstr "NNTP 物件" - -#: ../../library/nntplib.rst:198 -msgid "" -"When connected, :class:`NNTP` and :class:`NNTP_SSL` objects support the " -"following methods and attributes." -msgstr "" - -#: ../../library/nntplib.rst:202 -msgid "Attributes" -msgstr "屬性" - -#: ../../library/nntplib.rst:206 -msgid "" -"An integer representing the version of the NNTP protocol supported by the " -"server. In practice, this should be ``2`` for servers advertising :rfc:" -"`3977` compliance and ``1`` for others." -msgstr "" - -#: ../../library/nntplib.rst:214 -msgid "" -"A string describing the software name and version of the NNTP server, or :" -"const:`None` if not advertised by the server." -msgstr "" - -#: ../../library/nntplib.rst:220 -msgid "Methods" -msgstr "方法" - -#: ../../library/nntplib.rst:222 -msgid "" -"The *response* that is returned as the first item in the return tuple of " -"almost all methods is the server's response: a string beginning with a three-" -"digit code. If the server's response indicates an error, the method raises " -"one of the above exceptions." -msgstr "" - -#: ../../library/nntplib.rst:227 -msgid "" -"Many of the following methods take an optional keyword-only argument *file*. " -"When the *file* argument is supplied, it must be either a :term:`file " -"object` opened for binary writing, or the name of an on-disk file to be " -"written to. The method will then write any data returned by the server " -"(except for the response line and the terminating dot) to the file; any list " -"of lines, tuples or objects that the method normally returns will be empty." -msgstr "" - -#: ../../library/nntplib.rst:234 -msgid "" -"Many of the following methods have been reworked and fixed, which makes them " -"incompatible with their 3.1 counterparts." -msgstr "" - -#: ../../library/nntplib.rst:241 -msgid "" -"Send a ``QUIT`` command and close the connection. Once this method has been " -"called, no other methods of the NNTP object should be called." -msgstr "" - -#: ../../library/nntplib.rst:247 -msgid "" -"Return the welcome message sent by the server in reply to the initial " -"connection. (This message sometimes contains disclaimers or help " -"information that may be relevant to the user.)" -msgstr "" - -#: ../../library/nntplib.rst:254 -msgid "" -"Return the :rfc:`3977` capabilities advertised by the server, as a :class:" -"`dict` instance mapping capability names to (possibly empty) lists of " -"values. On legacy servers which don't understand the ``CAPABILITIES`` " -"command, an empty dictionary is returned instead." -msgstr "" - -#: ../../library/nntplib.rst:268 -msgid "" -"Send ``AUTHINFO`` commands with the user name and password. If *user* and " -"*password* are ``None`` and *usenetrc* is true, credentials from ``~/." -"netrc`` will be used if possible." -msgstr "" - -#: ../../library/nntplib.rst:272 -msgid "" -"Unless intentionally delayed, login is normally performed during the :class:" -"`NNTP` object initialization and separately calling this function is " -"unnecessary. To force authentication to be delayed, you must not set *user* " -"or *password* when creating the object, and must set *usenetrc* to False." -msgstr "" - -#: ../../library/nntplib.rst:283 -msgid "" -"Send a ``STARTTLS`` command. This will enable encryption on the NNTP " -"connection. The *context* argument is optional and should be a :class:`ssl." -"SSLContext` object. Please read :ref:`ssl-security` for best practices." -msgstr "" - -#: ../../library/nntplib.rst:288 -msgid "" -"Note that this may not be done after authentication information has been " -"transmitted, and authentication occurs by default if possible during a :" -"class:`NNTP` object initialization. See :meth:`NNTP.login` for information " -"on suppressing this behavior." -msgstr "" - -#: ../../library/nntplib.rst:295 -msgid "" -"The method now supports hostname check with :attr:`ssl.SSLContext." -"check_hostname` and *Server Name Indication* (see :data:`ssl.HAS_SNI`)." -msgstr "" - -#: ../../library/nntplib.rst:302 -msgid "" -"Send a ``NEWGROUPS`` command. The *date* argument should be a :class:" -"`datetime.date` or :class:`datetime.datetime` object. Return a pair " -"``(response, groups)`` where *groups* is a list representing the groups that " -"are new since the given *date*. If *file* is supplied, though, then *groups* " -"will be empty." -msgstr "" - -#: ../../library/nntplib.rst:318 -msgid "" -"Send a ``NEWNEWS`` command. Here, *group* is a group name or ``'*'``, and " -"*date* has the same meaning as for :meth:`newgroups`. Return a pair " -"``(response, articles)`` where *articles* is a list of message ids." -msgstr "" - -#: ../../library/nntplib.rst:322 -msgid "This command is frequently disabled by NNTP server administrators." -msgstr "" - -#: ../../library/nntplib.rst:327 -msgid "" -"Send a ``LIST`` or ``LIST ACTIVE`` command. Return a pair ``(response, " -"list)`` where *list* is a list of tuples representing all the groups " -"available from this NNTP server, optionally matching the pattern string " -"*group_pattern*. Each tuple has the form ``(group, last, first, flag)``, " -"where *group* is a group name, *last* and *first* are the last and first " -"article numbers, and *flag* usually takes one of these values:" -msgstr "" - -#: ../../library/nntplib.rst:335 -msgid "``y``: Local postings and articles from peers are allowed." -msgstr "" - -#: ../../library/nntplib.rst:336 -msgid "``m``: The group is moderated and all postings must be approved." -msgstr "" - -#: ../../library/nntplib.rst:337 -msgid "``n``: No local postings are allowed, only articles from peers." -msgstr "" - -#: ../../library/nntplib.rst:338 -msgid "``j``: Articles from peers are filed in the junk group instead." -msgstr "" - -#: ../../library/nntplib.rst:339 -msgid "``x``: No local postings, and articles from peers are ignored." -msgstr "" - -#: ../../library/nntplib.rst:340 -msgid "``=foo.bar``: Articles are filed in the ``foo.bar`` group instead." -msgstr "" - -#: ../../library/nntplib.rst:342 -msgid "" -"If *flag* has another value, then the status of the newsgroup should be " -"considered unknown." -msgstr "" - -#: ../../library/nntplib.rst:345 -msgid "" -"This command can return very large results, especially if *group_pattern* is " -"not specified. It is best to cache the results offline unless you really " -"need to refresh them." -msgstr "" - -#: ../../library/nntplib.rst:349 -msgid "*group_pattern* was added." -msgstr "新增 *group_pattern*。" - -#: ../../library/nntplib.rst:355 -msgid "" -"Send a ``LIST NEWSGROUPS`` command, where *grouppattern* is a wildmat string " -"as specified in :rfc:`3977` (it's essentially the same as DOS or UNIX shell " -"wildcard strings). Return a pair ``(response, descriptions)``, where " -"*descriptions* is a dictionary mapping group names to textual descriptions." -msgstr "" - -#: ../../library/nntplib.rst:369 -msgid "" -"Get a description for a single group *group*. If more than one group " -"matches (if 'group' is a real wildmat string), return the first match. If " -"no group matches, return an empty string." -msgstr "" - -#: ../../library/nntplib.rst:373 -msgid "" -"This elides the response code from the server. If the response code is " -"needed, use :meth:`descriptions`." -msgstr "" - -#: ../../library/nntplib.rst:379 -msgid "" -"Send a ``GROUP`` command, where *name* is the group name. The group is " -"selected as the current group, if it exists. Return a tuple ``(response, " -"count, first, last, name)`` where *count* is the (estimated) number of " -"articles in the group, *first* is the first article number in the group, " -"*last* is the last article number in the group, and *name* is the group name." -msgstr "" - -#: ../../library/nntplib.rst:389 -msgid "" -"Send an ``OVER`` command, or an ``XOVER`` command on legacy servers. " -"*message_spec* can be either a string representing a message id, or a " -"``(first, last)`` tuple of numbers indicating a range of articles in the " -"current group, or a ``(first, None)`` tuple indicating a range of articles " -"starting from *first* to the last article in the current group, or :const:" -"`None` to select the current article in the current group." -msgstr "" - -#: ../../library/nntplib.rst:396 -msgid "" -"Return a pair ``(response, overviews)``. *overviews* is a list of " -"``(article_number, overview)`` tuples, one for each article selected by " -"*message_spec*. Each *overview* is a dictionary with the same number of " -"items, but this number depends on the server. These items are either " -"message headers (the key is then the lower-cased header name) or metadata " -"items (the key is then the metadata name prepended with ``\":\"``). The " -"following items are guaranteed to be present by the NNTP specification:" -msgstr "" - -#: ../../library/nntplib.rst:404 -msgid "" -"the ``subject``, ``from``, ``date``, ``message-id`` and ``references`` " -"headers" -msgstr "" - -#: ../../library/nntplib.rst:406 -msgid "" -"the ``:bytes`` metadata: the number of bytes in the entire raw article " -"(including headers and body)" -msgstr "" - -#: ../../library/nntplib.rst:408 -msgid "the ``:lines`` metadata: the number of lines in the article body" -msgstr "" - -#: ../../library/nntplib.rst:410 -msgid "" -"The value of each item is either a string, or :const:`None` if not present." -msgstr "" - -#: ../../library/nntplib.rst:412 -msgid "" -"It is advisable to use the :func:`decode_header` function on header values " -"when they may contain non-ASCII characters::" -msgstr "" - -#: ../../library/nntplib.rst:415 -msgid "" -">>> _, _, first, last, _ = s.group('gmane.comp.python.devel')\n" -">>> resp, overviews = s.over((last, last))\n" -">>> art_num, over = overviews[0]\n" -">>> art_num\n" -"117216\n" -">>> list(over.keys())\n" -"['xref', 'from', ':lines', ':bytes', 'references', 'date', 'message-id', " -"'subject']\n" -">>> over['from']\n" -"'=?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= '\n" -">>> nntplib.decode_header(over['from'])\n" -"'\"Martin v. Löwis\" '" -msgstr "" -">>> _, _, first, last, _ = s.group('gmane.comp.python.devel')\n" -">>> resp, overviews = s.over((last, last))\n" -">>> art_num, over = overviews[0]\n" -">>> art_num\n" -"117216\n" -">>> list(over.keys())\n" -"['xref', 'from', ':lines', ':bytes', 'references', 'date', 'message-id', " -"'subject']\n" -">>> over['from']\n" -"'=?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= '\n" -">>> nntplib.decode_header(over['from'])\n" -"'\"Martin v. Löwis\" '" - -#: ../../library/nntplib.rst:432 -msgid "" -"Send a ``HELP`` command. Return a pair ``(response, list)`` where *list* is " -"a list of help strings." -msgstr "" - -#: ../../library/nntplib.rst:438 -msgid "" -"Send a ``STAT`` command, where *message_spec* is either a message id " -"(enclosed in ``'<'`` and ``'>'``) or an article number in the current group. " -"If *message_spec* is omitted or :const:`None`, the current article in the " -"current group is considered. Return a triple ``(response, number, id)`` " -"where *number* is the article number and *id* is the message id." -msgstr "" - -#: ../../library/nntplib.rst:452 -msgid "Send a ``NEXT`` command. Return as for :meth:`.stat`." -msgstr "" - -#: ../../library/nntplib.rst:457 -msgid "Send a ``LAST`` command. Return as for :meth:`.stat`." -msgstr "" - -#: ../../library/nntplib.rst:462 -msgid "" -"Send an ``ARTICLE`` command, where *message_spec* has the same meaning as " -"for :meth:`.stat`. Return a tuple ``(response, info)`` where *info* is a :" -"class:`~collections.namedtuple` with three attributes *number*, *message_id* " -"and *lines* (in that order). *number* is the article number in the group " -"(or 0 if the information is not available), *message_id* the message id as a " -"string, and *lines* a list of lines (without terminating newlines) " -"comprising the raw message including headers and body." -msgstr "" - -#: ../../library/nntplib.rst:487 -msgid "" -"Same as :meth:`article`, but sends a ``HEAD`` command. The *lines* returned " -"(or written to *file*) will only contain the message headers, not the body." -msgstr "" - -#: ../../library/nntplib.rst:494 -msgid "" -"Same as :meth:`article`, but sends a ``BODY`` command. The *lines* returned " -"(or written to *file*) will only contain the message body, not the headers." -msgstr "" - -#: ../../library/nntplib.rst:501 -msgid "" -"Post an article using the ``POST`` command. The *data* argument is either " -"a :term:`file object` opened for binary reading, or any iterable of bytes " -"objects (representing raw lines of the article to be posted). It should " -"represent a well-formed news article, including the required headers. The :" -"meth:`post` method automatically escapes lines beginning with ``.`` and " -"appends the termination line." -msgstr "" - -#: ../../library/nntplib.rst:508 -msgid "" -"If the method succeeds, the server's response is returned. If the server " -"refuses posting, a :class:`NNTPReplyError` is raised." -msgstr "" - -#: ../../library/nntplib.rst:514 -msgid "" -"Send an ``IHAVE`` command. *message_id* is the id of the message to send to " -"the server (enclosed in ``'<'`` and ``'>'``). The *data* parameter and the " -"return value are the same as for :meth:`post`." -msgstr "" - -#: ../../library/nntplib.rst:521 -msgid "" -"Return a pair ``(response, date)``. *date* is a :class:`~datetime.datetime` " -"object containing the current date and time of the server." -msgstr "" - -#: ../../library/nntplib.rst:527 -msgid "Send a ``SLAVE`` command. Return the server's *response*." -msgstr "" - -#: ../../library/nntplib.rst:532 -msgid "" -"Set the instance's debugging level. This controls the amount of debugging " -"output printed. The default, ``0``, produces no debugging output. A value " -"of ``1`` produces a moderate amount of debugging output, generally a single " -"line per request or response. A value of ``2`` or higher produces the " -"maximum amount of debugging output, logging each line sent and received on " -"the connection (including message text)." -msgstr "" - -#: ../../library/nntplib.rst:540 -msgid "" -"The following are optional NNTP extensions defined in :rfc:`2980`. Some of " -"them have been superseded by newer commands in :rfc:`3977`." -msgstr "" - -#: ../../library/nntplib.rst:546 -msgid "" -"Send an ``XHDR`` command. The *hdr* argument is a header keyword, e.g. " -"``'subject'``. The *str* argument should have the form ``'first-last'`` " -"where *first* and *last* are the first and last article numbers to search. " -"Return a pair ``(response, list)``, where *list* is a list of pairs ``(id, " -"text)``, where *id* is an article number (as a string) and *text* is the " -"text of the requested header for that article. If the *file* parameter is " -"supplied, then the output of the ``XHDR`` command is stored in a file. If " -"*file* is a string, then the method will open a file with that name, write " -"to it then close it. If *file* is a :term:`file object`, then it will start " -"calling :meth:`write` on it to store the lines of the command output. If " -"*file* is supplied, then the returned *list* is an empty list." -msgstr "" - -#: ../../library/nntplib.rst:561 -msgid "" -"Send an ``XOVER`` command. *start* and *end* are article numbers delimiting " -"the range of articles to select. The return value is the same of for :meth:" -"`over`. It is recommended to use :meth:`over` instead, since it will " -"automatically use the newer ``OVER`` command if available." -msgstr "" - -#: ../../library/nntplib.rst:569 -msgid "Utility functions" -msgstr "" - -#: ../../library/nntplib.rst:571 -msgid "The module also defines the following utility function:" -msgstr "" - -#: ../../library/nntplib.rst:576 -msgid "" -"Decode a header value, un-escaping any escaped non-ASCII characters. " -"*header_str* must be a :class:`str` object. The unescaped value is " -"returned. Using this function is recommended to display some headers in a " -"human readable form::" -msgstr "" - -#: ../../library/nntplib.rst:581 -msgid "" -">>> decode_header(\"Some subject\")\n" -"'Some subject'\n" -">>> decode_header(\"=?ISO-8859-15?Q?D=E9buter_en_Python?=\")\n" -"'Débuter en Python'\n" -">>> decode_header(\"Re: =?UTF-8?B?cHJvYmzDqG1lIGRlIG1hdHJpY2U=?=\")\n" -"'Re: problème de matrice'" -msgstr "" -">>> decode_header(\"Some subject\")\n" -"'Some subject'\n" -">>> decode_header(\"=?ISO-8859-15?Q?D=E9buter_en_Python?=\")\n" -"'Débuter en Python'\n" -">>> decode_header(\"Re: =?UTF-8?B?cHJvYmzDqG1lIGRlIG1hdHJpY2U=?=\")\n" -"'Re: problème de matrice'" - -#: ../../library/nntplib.rst:10 -msgid "NNTP" -msgstr "NNTP" - -#: ../../library/nntplib.rst:10 -msgid "protocol" -msgstr "protocol(協定)" - -#: ../../library/nntplib.rst:10 -msgid "Network News Transfer Protocol" -msgstr "Network News Transfer Protocol(網路新聞傳輸協定)" diff --git a/library/os.po b/library/os.po index 8e1f1843ff..7968086daf 100644 --- a/library/os.po +++ b/library/os.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -82,20 +82,19 @@ msgid "" msgstr "在 VxWorks, 不支援 os.popen、os.fork、os.execv 和 os.spawn*p*。" #: ../../library/os.rst:37 -#, fuzzy -msgid "" -"On WebAssembly platforms, and on iOS, large parts of the :mod:`os` module " -"are not available or behave differently. API related to processes (e.g. :" -"func:`~os.fork`, :func:`~os.execve`) and resources (e.g. :func:`~os.nice`) " -"are not available. Others like :func:`~os.getuid` and :func:`~os.getpid` are " -"emulated or stubs. WebAssembly platforms also lack support for signals (e." -"g. :func:`~os.kill`, :func:`~os.wait`)." -msgstr "" -"在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上,大部分 :mod:" -"`os` 模組無法使用或行為不同。與行程(Process)(例如 :func:`~os.fork`、:func:" -"`~os.execve`\\ )、訊號(例如 :func:`~os.kill`、:func:`~os.wait`\\ ),與資源" +msgid "" +"On WebAssembly platforms, Android and iOS, large parts of the :mod:`os` " +"module are not available or behave differently. APIs related to processes (e." +"g. :func:`~os.fork`, :func:`~os.execve`) and resources (e.g. :func:`~os." +"nice`) are not available. Others like :func:`~os.getuid` and :func:`~os." +"getpid` are emulated or stubs. WebAssembly platforms also lack support for " +"signals (e.g. :func:`~os.kill`, :func:`~os.wait`)." +msgstr "" +"在 WebAssembly 平台和 Android 與 iOS 上,大部分 :mod:`os` 模組無法使用或行為" +"不同。與行程 (process)(例如 :func:`~os.fork`、:func:`~os.execve`\\ )與資源" "(例如 :func:`~os.nice`\\ )相關的 API 不可使用。其他諸如 :func:`~os.getuid` " -"和 :func:`~os.getpid` 的相關 API 是 emulated 或 stubs。" +"和 :func:`~os.getpid` 的相關 API 是 emulated 或 stubs。WebAssembly 平台也缺少" +"訊號相關支援(例如 :func:`~os.kill`、:func:`~os.wait`\\ )。" #: ../../library/os.rst:47 msgid "" @@ -309,29 +308,25 @@ msgstr "" #: ../../library/os.rst:181 ../../library/os.rst:358 ../../library/os.rst:367 #: ../../library/os.rst:389 ../../library/os.rst:398 ../../library/os.rst:434 #: ../../library/os.rst:442 ../../library/os.rst:480 ../../library/os.rst:491 -#: ../../library/os.rst:512 ../../library/os.rst:522 ../../library/os.rst:545 -#: ../../library/os.rst:579 ../../library/os.rst:586 ../../library/os.rst:593 -#: ../../library/os.rst:602 ../../library/os.rst:652 ../../library/os.rst:661 -#: ../../library/os.rst:678 ../../library/os.rst:687 ../../library/os.rst:694 -#: ../../library/os.rst:703 ../../library/os.rst:712 ../../library/os.rst:719 -#: ../../library/os.rst:726 ../../library/os.rst:735 ../../library/os.rst:1139 +#: ../../library/os.rst:512 ../../library/os.rst:522 ../../library/os.rst:602 +#: ../../library/os.rst:652 ../../library/os.rst:661 ../../library/os.rst:678 +#: ../../library/os.rst:719 ../../library/os.rst:726 ../../library/os.rst:1139 #: ../../library/os.rst:1183 ../../library/os.rst:1367 #: ../../library/os.rst:1393 ../../library/os.rst:1463 #: ../../library/os.rst:1535 ../../library/os.rst:1662 #: ../../library/os.rst:1682 ../../library/os.rst:1691 #: ../../library/os.rst:1772 ../../library/os.rst:1780 #: ../../library/os.rst:1800 ../../library/os.rst:2087 -#: ../../library/os.rst:2181 ../../library/os.rst:2221 -#: ../../library/os.rst:2514 ../../library/os.rst:2536 -#: ../../library/os.rst:4330 ../../library/os.rst:4337 -#: ../../library/os.rst:4344 ../../library/os.rst:4351 -#: ../../library/os.rst:4358 ../../library/os.rst:4365 -#: ../../library/os.rst:4372 ../../library/os.rst:4380 -#: ../../library/os.rst:4388 ../../library/os.rst:4395 -#: ../../library/os.rst:4402 ../../library/os.rst:4411 -#: ../../library/os.rst:4419 ../../library/os.rst:4427 -#: ../../library/os.rst:4434 ../../library/os.rst:4441 -#: ../../library/os.rst:4564 +#: ../../library/os.rst:2221 ../../library/os.rst:2514 +#: ../../library/os.rst:2536 ../../library/os.rst:4330 +#: ../../library/os.rst:4337 ../../library/os.rst:4344 +#: ../../library/os.rst:4351 ../../library/os.rst:4358 +#: ../../library/os.rst:4365 ../../library/os.rst:4372 +#: ../../library/os.rst:4380 ../../library/os.rst:4388 +#: ../../library/os.rst:4395 ../../library/os.rst:4402 +#: ../../library/os.rst:4411 ../../library/os.rst:4419 +#: ../../library/os.rst:4427 ../../library/os.rst:4434 +#: ../../library/os.rst:4441 ../../library/os.rst:4564 msgid ":ref:`Availability `: Unix, not WASI." msgstr ":ref:`適用 `:Unix、非 WASI。" @@ -599,9 +594,8 @@ msgid "" msgstr "" #: ../../library/os.rst:426 ../../library/os.rst:462 -#, fuzzy msgid ":ref:`Availability `: Unix, Windows, not WASI." -msgstr ":ref:`適用 `:Unix、非 WASI。" +msgstr ":ref:`適用 `:Unix、Windows、非 WASI。" #: ../../library/os.rst:431 msgid "" @@ -671,6 +665,13 @@ msgid "" "group id." msgstr "" +#: ../../library/os.rst:545 ../../library/os.rst:579 ../../library/os.rst:586 +#: ../../library/os.rst:593 ../../library/os.rst:687 ../../library/os.rst:694 +#: ../../library/os.rst:703 ../../library/os.rst:712 ../../library/os.rst:735 +#: ../../library/os.rst:2181 +msgid ":ref:`Availability `: Unix, not WASI, not Android." +msgstr ":ref:`適用 `:Unix、非 WASI、非 Android。" + #: ../../library/os.rst:554 msgid "" "Set the environment variable named *key* to the string *value*. Such " @@ -1176,7 +1177,6 @@ msgid "" msgstr "" #: ../../library/os.rst:1014 ../../library/os.rst:2244 -#, fuzzy msgid "Added support on Windows." msgstr "新增對 Windows 的支援。" @@ -2534,13 +2534,12 @@ msgid "" msgstr "" #: ../../library/os.rst:2239 -#, fuzzy msgid "" ":ref:`Availability `: Unix, Windows, not Linux, FreeBSD >= " "1.3, NetBSD >= 1.3, not OpenBSD" msgstr "" -":ref:`適用 `:Unix、非 Linux、FreeBSD 1.3 以上、NetBSD 1.3 以" -"上、非 OpenBSD。" +":ref:`適用 `:Unix、Windows、非 Linux、FreeBSD 1.3 以上、" +"NetBSD 1.3 以上、非 OpenBSD。" #: ../../library/os.rst:2249 msgid "" @@ -4424,15 +4423,15 @@ msgstr "" #: ../../library/os.rst:3881 msgid ":func:`read`" -msgstr "" +msgstr ":func:`read`" #: ../../library/os.rst:3882 msgid ":func:`~select.select`" -msgstr "" +msgstr ":func:`~select.select`" #: ../../library/os.rst:3883 msgid ":func:`~select.poll`" -msgstr "" +msgstr ":func:`~select.poll`" #: ../../library/os.rst:3885 msgid "" @@ -4456,13 +4455,12 @@ msgid "" msgstr "" #: ../../library/os.rst:3896 -#, fuzzy msgid ":const:`time.CLOCK_REALTIME`" -msgstr ":const:`stat.S_IREAD`" +msgstr ":const:`time.CLOCK_REALTIME`" #: ../../library/os.rst:3897 msgid ":const:`time.CLOCK_MONOTONIC`" -msgstr "" +msgstr ":const:`time.CLOCK_MONOTONIC`" #: ../../library/os.rst:3898 msgid ":const:`time.CLOCK_BOOTTIME` (Since Linux 3.15 for timerfd_create)" @@ -4497,14 +4495,12 @@ msgid "" msgstr "" #: ../../library/os.rst:3916 -#, fuzzy msgid ":const:`TFD_NONBLOCK`" -msgstr ":const:`stat.UF_NOUNLINK`" +msgstr ":const:`TFD_NONBLOCK`" #: ../../library/os.rst:3917 -#, fuzzy msgid ":const:`TFD_CLOEXEC`" -msgstr ":const:`stat.S_IEXEC`" +msgstr ":const:`TFD_CLOEXEC`" #: ../../library/os.rst:3919 msgid "" @@ -4525,9 +4521,8 @@ msgid "" msgstr "" #: ../../library/os.rst:3930 -#, fuzzy msgid "The :manpage:`timerfd_create(2)` man page." -msgstr "更多細節請見 :manpage:`pidfd_open(2)` 手冊頁。" +msgstr ":manpage:`timerfd_create(2)` 手冊頁。" #: ../../library/os.rst:3939 msgid "" @@ -4547,14 +4542,12 @@ msgid "" msgstr "" #: ../../library/os.rst:3948 -#, fuzzy msgid ":const:`TFD_TIMER_ABSTIME`" -msgstr ":const:`stat.UF_IMMUTABLE`" +msgstr ":const:`TFD_TIMER_ABSTIME`" #: ../../library/os.rst:3949 -#, fuzzy msgid ":const:`TFD_TIMER_CANCEL_ON_SET`" -msgstr ":const:`SEEK_SET`" +msgstr ":const:`TFD_TIMER_CANCEL_ON_SET`" #: ../../library/os.rst:3951 msgid "" @@ -4610,11 +4603,11 @@ msgstr "" #: ../../library/os.rst:3982 msgid "``settimeofday``" -msgstr "" +msgstr "``settimeofday``" #: ../../library/os.rst:3983 msgid "``clock_settime``" -msgstr "" +msgstr "``clock_settime``" #: ../../library/os.rst:3984 msgid "set the system date and time by ``date`` command" @@ -4939,12 +4932,14 @@ msgstr "" "引發一個附帶引數 ``path``、``args``、``env`` 的\\ :ref:`稽核事件 ` " "``os.exec``。" -#: ../../library/os.rst:4287 ../../library/os.rst:4541 -#: ../../library/os.rst:4852 ../../library/os.rst:4976 -#: ../../library/os.rst:5095 ../../library/os.rst:5264 -#, fuzzy -msgid ":ref:`Availability `: Unix, Windows, not WASI, not iOS." -msgstr ":ref:`適用 `:Unix、Windows、非 Emscripten、非 WASI。" +#: ../../library/os.rst:4287 ../../library/os.rst:4852 +#: ../../library/os.rst:4976 ../../library/os.rst:5095 +#: ../../library/os.rst:5264 +msgid "" +":ref:`Availability `: Unix, Windows, not WASI, not Android, " +"not iOS." +msgstr "" +":ref:`適用 `:Unix、Windows、非 WASI、非 Android、非 iOS。" #: ../../library/os.rst:4289 msgid "" @@ -5130,9 +5125,9 @@ msgid "" msgstr "" #: ../../library/os.rst:4490 ../../library/os.rst:4750 -#, fuzzy -msgid ":ref:`Availability `: POSIX, not WASI, not iOS." -msgstr ":ref:`適用 `:POSIX、非 Emscripten、非 WASI。" +msgid "" +":ref:`Availability `: POSIX, not WASI, not Android, not iOS." +msgstr ":ref:`適用 `:POSIX、非 WASI、非 Android、非 iOS。" #: ../../library/os.rst:4495 msgid "" @@ -5161,8 +5156,7 @@ msgid "" "fork`." msgstr "" -#: ../../library/os.rst:4517 ../../library/os.rst:4557 -#: ../../library/os.rst:4594 ../../library/os.rst:4734 +#: ../../library/os.rst:4517 ../../library/os.rst:4734 #: ../../library/os.rst:4783 ../../library/os.rst:5020 #: ../../library/os.rst:5054 ../../library/os.rst:5115 #: ../../library/os.rst:5129 ../../library/os.rst:5146 @@ -5174,9 +5168,9 @@ msgstr "" #: ../../library/os.rst:5310 ../../library/os.rst:5319 #: ../../library/os.rst:5328 ../../library/os.rst:5337 #: ../../library/os.rst:5346 -#, fuzzy -msgid ":ref:`Availability `: Unix, not WASI, not iOS." -msgstr ":ref:`適用 `:Unix、非 WASI。" +msgid "" +":ref:`Availability `: Unix, not WASI, not Android, not iOS." +msgstr ":ref:`適用 `:Unix、非 WASI、非 Android、非 iOS。" #: ../../library/os.rst:4526 msgid "" @@ -5207,6 +5201,10 @@ msgstr "" "引發一個附帶引數 ``pid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." "kill``。" +#: ../../library/os.rst:4541 +msgid ":ref:`Availability `: Unix, Windows, not WASI, not iOS." +msgstr ":ref:`適用 `:Unix、Windows、非 WASI、非 iOS" + #: ../../library/os.rst:4553 msgid "Send the signal *sig* to the process group *pgid*." msgstr "" @@ -5219,6 +5217,10 @@ msgstr "" "引發一個附帶引數 ``pgid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." "killpg``。" +#: ../../library/os.rst:4557 ../../library/os.rst:4594 +msgid ":ref:`Availability `: Unix, not WASI, not iOS." +msgstr ":ref:`適用 `:Unix、非 WASI、非 iOS。" + #: ../../library/os.rst:4562 msgid "" "Add *increment* to the process's \"niceness\". Return the new niceness." @@ -5294,9 +5296,8 @@ msgid "" msgstr "" #: ../../library/os.rst:4626 -#, fuzzy -msgid ":ref:`Availability `: not WASI, not iOS." -msgstr ":ref:`適用 `:非 WASI。" +msgid ":ref:`Availability `: not WASI, not Android, not iOS." +msgstr ":ref:`適用 `:非 WASI、非 Android、非 iOS。" #: ../../library/os.rst:4629 msgid "" @@ -5368,9 +5369,8 @@ msgid "Performs ``os.dup2(fd, new_fd)``." msgstr "" #: ../../library/os.rst:4679 -#, fuzzy msgid "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" -msgstr "(``os.POSIX_SPAWN_CLOSE``, *fd*)" +msgstr "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" #: ../../library/os.rst:4681 msgid "Performs ``os.closerange(fd, INF)``." @@ -6313,9 +6313,8 @@ msgid "" msgstr "" #: ../../library/os.rst:5469 -#, fuzzy msgid "See also the :func:`process_cpu_count` function." -msgstr ":func:`~os.setns` 函式。" +msgstr "也請見 :func:`process_cpu_count` 函式。" #: ../../library/os.rst:5475 msgid "Miscellaneous System Information" @@ -6398,9 +6397,8 @@ msgid "" msgstr "" #: ../../library/os.rst:5544 -#, fuzzy msgid "See also the :func:`sched_getaffinity` functions." -msgstr ":func:`~os.setns` 函式。" +msgstr "也請見 :func:`sched_getaffinity` 函式。" #: ../../library/os.rst:5551 msgid "" diff --git a/library/ossaudiodev.po b/library/ossaudiodev.po deleted file mode 100644 index 4daa2201eb..0000000000 --- a/library/ossaudiodev.po +++ /dev/null @@ -1,603 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2022-05-22 02:10+0800\n" -"Last-Translator: Liang-Bo Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/ossaudiodev.rst:2 -msgid ":mod:`ossaudiodev` --- Access to OSS-compatible audio devices" -msgstr ":mod:`ossaudiodev` --- 對 OSS 相容聲音裝置的存取" - -#: ../../library/ossaudiodev.rst:9 -msgid "" -"The :mod:`ossaudiodev` module is deprecated (see :pep:`PEP 594 " -"<594#ossaudiodev>` for details)." -msgstr "" -":mod:`ossaudiodev` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 " -"<594#ossaudiodev>`\\ )。" - -#: ../../library/ossaudiodev.rst:15 -msgid "" -"This module allows you to access the OSS (Open Sound System) audio " -"interface. OSS is available for a wide range of open-source and commercial " -"Unices, and is the standard audio interface for Linux and recent versions of " -"FreeBSD." -msgstr "" - -#: ../../library/ossaudiodev.rst:47 -msgid "" -"Operations in this module now raise :exc:`OSError` where :exc:`IOError` was " -"raised." -msgstr "" - -#: ../../library/ossaudiodev.rst:54 -msgid "" -"`Open Sound System Programmer's Guide `_" -msgstr "" - -#: ../../library/ossaudiodev.rst:55 -msgid "the official documentation for the OSS C API" -msgstr "" - -#: ../../library/ossaudiodev.rst:57 -msgid "" -"The module defines a large number of constants supplied by the OSS device " -"driver; see ```` on either Linux or FreeBSD for a listing." -msgstr "" - -#: ../../library/ossaudiodev.rst:60 -msgid ":mod:`ossaudiodev` defines the following variables and functions:" -msgstr "" - -#: ../../library/ossaudiodev.rst:65 -msgid "" -"This exception is raised on certain errors. The argument is a string " -"describing what went wrong." -msgstr "" - -#: ../../library/ossaudiodev.rst:68 -msgid "" -"(If :mod:`ossaudiodev` receives an error from a system call such as :c:func:" -"`open`, :c:func:`write`, or :c:func:`ioctl`, it raises :exc:`OSError`. " -"Errors detected directly by :mod:`ossaudiodev` result in :exc:" -"`OSSAudioError`.)" -msgstr "" - -#: ../../library/ossaudiodev.rst:72 -msgid "" -"(For backwards compatibility, the exception class is also available as " -"``ossaudiodev.error``.)" -msgstr "" - -#: ../../library/ossaudiodev.rst:79 -msgid "" -"Open an audio device and return an OSS audio device object. This object " -"supports many file-like methods, such as :meth:`read`, :meth:`write`, and :" -"meth:`fileno` (although there are subtle differences between conventional " -"Unix read/write semantics and those of OSS audio devices). It also supports " -"a number of audio-specific methods; see below for the complete list of " -"methods." -msgstr "" - -#: ../../library/ossaudiodev.rst:85 -msgid "" -"*device* is the audio device filename to use. If it is not specified, this " -"module first looks in the environment variable :envvar:`AUDIODEV` for a " -"device to use. If not found, it falls back to :file:`/dev/dsp`." -msgstr "" - -#: ../../library/ossaudiodev.rst:89 -msgid "" -"*mode* is one of ``'r'`` for read-only (record) access, ``'w'`` for write-" -"only (playback) access and ``'rw'`` for both. Since many sound cards only " -"allow one process to have the recorder or player open at a time, it is a " -"good idea to open the device only for the activity needed. Further, some " -"sound cards are half-duplex: they can be opened for reading or writing, but " -"not both at once." -msgstr "" - -#: ../../library/ossaudiodev.rst:96 -msgid "" -"Note the unusual calling syntax: the *first* argument is optional, and the " -"second is required. This is a historical artifact for compatibility with " -"the older :mod:`linuxaudiodev` module which :mod:`ossaudiodev` supersedes." -msgstr "" - -#: ../../library/ossaudiodev.rst:107 -msgid "" -"Open a mixer device and return an OSS mixer device object. *device* is the " -"mixer device filename to use. If it is not specified, this module first " -"looks in the environment variable :envvar:`MIXERDEV` for a device to use. " -"If not found, it falls back to :file:`/dev/mixer`." -msgstr "" - -#: ../../library/ossaudiodev.rst:116 -msgid "Audio Device Objects" -msgstr "" - -#: ../../library/ossaudiodev.rst:118 -msgid "" -"Before you can write to or read from an audio device, you must call three " -"methods in the correct order:" -msgstr "" - -#: ../../library/ossaudiodev.rst:121 -msgid ":meth:`setfmt` to set the output format" -msgstr "" - -#: ../../library/ossaudiodev.rst:123 -msgid ":meth:`channels` to set the number of channels" -msgstr "" - -#: ../../library/ossaudiodev.rst:125 -msgid ":meth:`speed` to set the sample rate" -msgstr "" - -#: ../../library/ossaudiodev.rst:127 -msgid "" -"Alternately, you can use the :meth:`setparameters` method to set all three " -"audio parameters at once. This is more convenient, but may not be as " -"flexible in all cases." -msgstr "" - -#: ../../library/ossaudiodev.rst:131 -msgid "" -"The audio device objects returned by :func:`.open` define the following " -"methods and (read-only) attributes:" -msgstr "" - -#: ../../library/ossaudiodev.rst:137 -msgid "" -"Explicitly close the audio device. When you are done writing to or reading " -"from an audio device, you should explicitly close it. A closed device " -"cannot be used again." -msgstr "" - -#: ../../library/ossaudiodev.rst:144 -msgid "Return the file descriptor associated with the device." -msgstr "" - -#: ../../library/ossaudiodev.rst:149 -msgid "" -"Read *size* bytes from the audio input and return them as a Python string. " -"Unlike most Unix device drivers, OSS audio devices in blocking mode (the " -"default) will block :func:`read` until the entire requested amount of data " -"is available." -msgstr "" - -#: ../../library/ossaudiodev.rst:157 -msgid "" -"Write a :term:`bytes-like object` *data* to the audio device and return the " -"number of bytes written. If the audio device is in blocking mode (the " -"default), the entire data is always written (again, this is different from " -"usual Unix device semantics). If the device is in non-blocking mode, some " -"data may not be written---see :meth:`writeall`." -msgstr "" - -#: ../../library/ossaudiodev.rst:163 ../../library/ossaudiodev.rst:177 -msgid "Writable :term:`bytes-like object` is now accepted." -msgstr "" - -#: ../../library/ossaudiodev.rst:169 -msgid "" -"Write a :term:`bytes-like object` *data* to the audio device: waits until " -"the audio device is able to accept data, writes as much data as it will " -"accept, and repeats until *data* has been completely written. If the device " -"is in blocking mode (the default), this has the same effect as :meth:" -"`write`; :meth:`writeall` is only useful in non-blocking mode. Has no " -"return value, since the amount of data written is always equal to the amount " -"of data supplied." -msgstr "" - -#: ../../library/ossaudiodev.rst:181 -msgid "" -"Audio device objects also support the context management protocol, i.e. they " -"can be used in a :keyword:`with` statement." -msgstr "" - -#: ../../library/ossaudiodev.rst:186 -msgid "" -"The following methods each map to exactly one :c:func:`ioctl` system call. " -"The correspondence is obvious: for example, :meth:`setfmt` corresponds to " -"the ``SNDCTL_DSP_SETFMT`` ioctl, and :meth:`sync` to ``SNDCTL_DSP_SYNC`` " -"(this can be useful when consulting the OSS documentation). If the " -"underlying :c:func:`ioctl` fails, they all raise :exc:`OSError`." -msgstr "" - -#: ../../library/ossaudiodev.rst:195 -msgid "" -"Put the device into non-blocking mode. Once in non-blocking mode, there is " -"no way to return it to blocking mode." -msgstr "" - -#: ../../library/ossaudiodev.rst:201 -msgid "" -"Return a bitmask of the audio output formats supported by the soundcard. " -"Some of the formats supported by OSS are:" -msgstr "" - -#: ../../library/ossaudiodev.rst:205 -msgid "Format" -msgstr "格式" - -#: ../../library/ossaudiodev.rst:205 ../../library/ossaudiodev.rst:259 -msgid "Description" -msgstr "描述" - -#: ../../library/ossaudiodev.rst:207 -msgid ":const:`AFMT_MU_LAW`" -msgstr ":const:`AFMT_MU_LAW`" - -#: ../../library/ossaudiodev.rst:207 -msgid "" -"a logarithmic encoding (used by Sun ``.au`` files and :file:`/dev/audio`)" -msgstr "" - -#: ../../library/ossaudiodev.rst:210 -msgid ":const:`AFMT_A_LAW`" -msgstr ":const:`AFMT_A_LAW`" - -#: ../../library/ossaudiodev.rst:210 -msgid "a logarithmic encoding" -msgstr "" - -#: ../../library/ossaudiodev.rst:212 -msgid ":const:`AFMT_IMA_ADPCM`" -msgstr ":const:`AFMT_IMA_ADPCM`" - -#: ../../library/ossaudiodev.rst:212 -msgid "" -"a 4:1 compressed format defined by the Interactive Multimedia Association" -msgstr "" - -#: ../../library/ossaudiodev.rst:215 -msgid ":const:`AFMT_U8`" -msgstr ":const:`AFMT_U8`" - -#: ../../library/ossaudiodev.rst:215 -msgid "Unsigned, 8-bit audio" -msgstr "" - -#: ../../library/ossaudiodev.rst:217 -msgid ":const:`AFMT_S16_LE`" -msgstr ":const:`AFMT_S16_LE`" - -#: ../../library/ossaudiodev.rst:217 -msgid "" -"Signed, 16-bit audio, little-endian byte order (as used by Intel processors)" -msgstr "" - -#: ../../library/ossaudiodev.rst:220 -msgid ":const:`AFMT_S16_BE`" -msgstr ":const:`AFMT_S16_BE`" - -#: ../../library/ossaudiodev.rst:220 -msgid "" -"Signed, 16-bit audio, big-endian byte order (as used by 68k, PowerPC, Sparc)" -msgstr "" - -#: ../../library/ossaudiodev.rst:223 -msgid ":const:`AFMT_S8`" -msgstr ":const:`AFMT_S8`" - -#: ../../library/ossaudiodev.rst:223 -msgid "Signed, 8 bit audio" -msgstr "" - -#: ../../library/ossaudiodev.rst:225 -msgid ":const:`AFMT_U16_LE`" -msgstr ":const:`AFMT_U16_LE`" - -#: ../../library/ossaudiodev.rst:225 -msgid "Unsigned, 16-bit little-endian audio" -msgstr "" - -#: ../../library/ossaudiodev.rst:227 -msgid ":const:`AFMT_U16_BE`" -msgstr ":const:`AFMT_U16_BE`" - -#: ../../library/ossaudiodev.rst:227 -msgid "Unsigned, 16-bit big-endian audio" -msgstr "" - -#: ../../library/ossaudiodev.rst:230 -msgid "" -"Consult the OSS documentation for a full list of audio formats, and note " -"that most devices support only a subset of these formats. Some older " -"devices only support :const:`AFMT_U8`; the most common format used today is :" -"const:`AFMT_S16_LE`." -msgstr "" - -#: ../../library/ossaudiodev.rst:238 -msgid "" -"Try to set the current audio format to *format*---see :meth:`getfmts` for a " -"list. Returns the audio format that the device was set to, which may not be " -"the requested format. May also be used to return the current audio format---" -"do this by passing an \"audio format\" of :const:`AFMT_QUERY`." -msgstr "" - -#: ../../library/ossaudiodev.rst:246 -msgid "" -"Set the number of output channels to *nchannels*. A value of 1 indicates " -"monophonic sound, 2 stereophonic. Some devices may have more than 2 " -"channels, and some high-end devices may not support mono. Returns the number " -"of channels the device was set to." -msgstr "" - -#: ../../library/ossaudiodev.rst:254 -msgid "" -"Try to set the audio sampling rate to *samplerate* samples per second. " -"Returns the rate actually set. Most sound devices don't support arbitrary " -"sampling rates. Common rates are:" -msgstr "" - -#: ../../library/ossaudiodev.rst:259 -msgid "Rate" -msgstr "" - -#: ../../library/ossaudiodev.rst:261 -msgid "8000" -msgstr "8000" - -#: ../../library/ossaudiodev.rst:261 -msgid "default rate for :file:`/dev/audio`" -msgstr "" - -#: ../../library/ossaudiodev.rst:263 -msgid "11025" -msgstr "11025" - -#: ../../library/ossaudiodev.rst:263 -msgid "speech recording" -msgstr "" - -#: ../../library/ossaudiodev.rst:265 -msgid "22050" -msgstr "22050" - -#: ../../library/ossaudiodev.rst:267 -msgid "44100" -msgstr "44100" - -#: ../../library/ossaudiodev.rst:267 -msgid "CD quality audio (at 16 bits/sample and 2 channels)" -msgstr "" - -#: ../../library/ossaudiodev.rst:270 -msgid "96000" -msgstr "96000" - -#: ../../library/ossaudiodev.rst:270 -msgid "DVD quality audio (at 24 bits/sample)" -msgstr "" - -#: ../../library/ossaudiodev.rst:276 -msgid "" -"Wait until the sound device has played every byte in its buffer. (This " -"happens implicitly when the device is closed.) The OSS documentation " -"recommends closing and re-opening the device rather than using :meth:`sync`." -msgstr "" - -#: ../../library/ossaudiodev.rst:283 -msgid "" -"Immediately stop playing or recording and return the device to a state where " -"it can accept commands. The OSS documentation recommends closing and re-" -"opening the device after calling :meth:`reset`." -msgstr "" - -#: ../../library/ossaudiodev.rst:290 -msgid "" -"Tell the driver that there is likely to be a pause in the output, making it " -"possible for the device to handle the pause more intelligently. You might " -"use this after playing a spot sound effect, before waiting for user input, " -"or before doing disk I/O." -msgstr "" - -#: ../../library/ossaudiodev.rst:295 -msgid "" -"The following convenience methods combine several ioctls, or one ioctl and " -"some simple calculations." -msgstr "" - -#: ../../library/ossaudiodev.rst:301 -msgid "" -"Set the key audio sampling parameters---sample format, number of channels, " -"and sampling rate---in one method call. *format*, *nchannels*, and " -"*samplerate* should be as specified in the :meth:`setfmt`, :meth:`channels`, " -"and :meth:`speed` methods. If *strict* is true, :meth:`setparameters` " -"checks to see if each parameter was actually set to the requested value, and " -"raises :exc:`OSSAudioError` if not. Returns a tuple (*format*, *nchannels*, " -"*samplerate*) indicating the parameter values that were actually set by the " -"device driver (i.e., the same as the return values of :meth:`setfmt`, :meth:" -"`channels`, and :meth:`speed`)." -msgstr "" - -#: ../../library/ossaudiodev.rst:311 -msgid "For example, ::" -msgstr "舉例來說: ::" - -#: ../../library/ossaudiodev.rst:313 -msgid "(fmt, channels, rate) = dsp.setparameters(fmt, channels, rate)" -msgstr "(fmt, channels, rate) = dsp.setparameters(fmt, channels, rate)" - -#: ../../library/ossaudiodev.rst:315 -msgid "is equivalent to ::" -msgstr "等價於: ::" - -#: ../../library/ossaudiodev.rst:317 -msgid "" -"fmt = dsp.setfmt(fmt)\n" -"channels = dsp.channels(channels)\n" -"rate = dsp.rate(rate)" -msgstr "" -"fmt = dsp.setfmt(fmt)\n" -"channels = dsp.channels(channels)\n" -"rate = dsp.rate(rate)" - -#: ../../library/ossaudiodev.rst:324 -msgid "Returns the size of the hardware buffer, in samples." -msgstr "" - -#: ../../library/ossaudiodev.rst:329 -msgid "" -"Returns the number of samples that are in the hardware buffer yet to be " -"played." -msgstr "" - -#: ../../library/ossaudiodev.rst:334 -msgid "" -"Returns the number of samples that could be queued into the hardware buffer " -"to be played without blocking." -msgstr "" - -#: ../../library/ossaudiodev.rst:337 -msgid "Audio device objects also support several read-only attributes:" -msgstr "" - -#: ../../library/ossaudiodev.rst:342 -msgid "Boolean indicating whether the device has been closed." -msgstr "" - -#: ../../library/ossaudiodev.rst:347 -msgid "String containing the name of the device file." -msgstr "" - -#: ../../library/ossaudiodev.rst:352 -msgid "The I/O mode for the file, either ``\"r\"``, ``\"rw\"``, or ``\"w\"``." -msgstr "" - -#: ../../library/ossaudiodev.rst:358 -msgid "Mixer Device Objects" -msgstr "" - -#: ../../library/ossaudiodev.rst:360 -msgid "The mixer object provides two file-like methods:" -msgstr "" - -#: ../../library/ossaudiodev.rst:365 -msgid "" -"This method closes the open mixer device file. Any further attempts to use " -"the mixer after this file is closed will raise an :exc:`OSError`." -msgstr "" - -#: ../../library/ossaudiodev.rst:371 -msgid "Returns the file handle number of the open mixer device file." -msgstr "" - -#: ../../library/ossaudiodev.rst:373 -msgid "Mixer objects also support the context management protocol." -msgstr "" - -#: ../../library/ossaudiodev.rst:377 -msgid "The remaining methods are specific to audio mixing:" -msgstr "" - -#: ../../library/ossaudiodev.rst:382 -msgid "" -"This method returns a bitmask specifying the available mixer controls " -"(\"Control\" being a specific mixable \"channel\", such as :const:" -"`SOUND_MIXER_PCM` or :const:`SOUND_MIXER_SYNTH`). This bitmask indicates a " -"subset of all available mixer controls---the :const:`SOUND_MIXER_\\*` " -"constants defined at module level. To determine if, for example, the current " -"mixer object supports a PCM mixer, use the following Python code::" -msgstr "" - -#: ../../library/ossaudiodev.rst:389 -msgid "" -"mixer=ossaudiodev.openmixer()\n" -"if mixer.controls() & (1 << ossaudiodev.SOUND_MIXER_PCM):\n" -" # PCM is supported\n" -" ... code ..." -msgstr "" - -#: ../../library/ossaudiodev.rst:394 -msgid "" -"For most purposes, the :const:`SOUND_MIXER_VOLUME` (master volume) and :" -"const:`SOUND_MIXER_PCM` controls should suffice---but code that uses the " -"mixer should be flexible when it comes to choosing mixer controls. On the " -"Gravis Ultrasound, for example, :const:`SOUND_MIXER_VOLUME` does not exist." -msgstr "" - -#: ../../library/ossaudiodev.rst:402 -msgid "" -"Returns a bitmask indicating stereo mixer controls. If a bit is set, the " -"corresponding control is stereo; if it is unset, the control is either " -"monophonic or not supported by the mixer (use in combination with :meth:" -"`controls` to determine which)." -msgstr "" - -#: ../../library/ossaudiodev.rst:407 -msgid "" -"See the code example for the :meth:`controls` function for an example of " -"getting data from a bitmask." -msgstr "" - -#: ../../library/ossaudiodev.rst:413 -msgid "" -"Returns a bitmask specifying the mixer controls that may be used to record. " -"See the code example for :meth:`controls` for an example of reading from a " -"bitmask." -msgstr "" - -#: ../../library/ossaudiodev.rst:419 -msgid "" -"Returns the volume of a given mixer control. The returned volume is a 2-" -"tuple ``(left_volume,right_volume)``. Volumes are specified as numbers from " -"0 (silent) to 100 (full volume). If the control is monophonic, a 2-tuple is " -"still returned, but both volumes are the same." -msgstr "" - -#: ../../library/ossaudiodev.rst:424 -msgid "" -"Raises :exc:`OSSAudioError` if an invalid control is specified, or :exc:" -"`OSError` if an unsupported control is specified." -msgstr "" - -#: ../../library/ossaudiodev.rst:430 -msgid "" -"Sets the volume for a given mixer control to ``(left,right)``. ``left`` and " -"``right`` must be ints and between 0 (silent) and 100 (full volume). On " -"success, the new volume is returned as a 2-tuple. Note that this may not be " -"exactly the same as the volume specified, because of the limited resolution " -"of some soundcard's mixers." -msgstr "" - -#: ../../library/ossaudiodev.rst:436 -msgid "" -"Raises :exc:`OSSAudioError` if an invalid mixer control was specified, or if " -"the specified volumes were out-of-range." -msgstr "" - -#: ../../library/ossaudiodev.rst:442 -msgid "" -"This method returns a bitmask indicating which control(s) are currently " -"being used as a recording source." -msgstr "" - -#: ../../library/ossaudiodev.rst:448 -msgid "" -"Call this function to specify a recording source. Returns a bitmask " -"indicating the new recording source (or sources) if successful; raises :exc:" -"`OSError` if an invalid source was specified. To set the current recording " -"source to the microphone input::" -msgstr "" - -#: ../../library/ossaudiodev.rst:453 -msgid "mixer.setrecsrc (1 << ossaudiodev.SOUND_MIXER_MIC)" -msgstr "mixer.setrecsrc (1 << ossaudiodev.SOUND_MIXER_MIC)" diff --git a/library/pathlib.po b/library/pathlib.po index 43323de507..ffd0c4ac4f 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -2790,7 +2790,7 @@ msgstr "" #: ../../library/pathlib.rst:1661 msgid "``?``" -msgstr "" +msgstr "``?``" #: ../../library/pathlib.rst:1662 msgid "Matches one non-separator character." @@ -2798,7 +2798,7 @@ msgstr "" #: ../../library/pathlib.rst:1663 msgid "``[seq]``" -msgstr "" +msgstr "``[seq]``" #: ../../library/pathlib.rst:1664 msgid "Matches one character in *seq*." @@ -2806,7 +2806,7 @@ msgstr "" #: ../../library/pathlib.rst:1665 msgid "``[!seq]``" -msgstr "" +msgstr "``[!seq]``" #: ../../library/pathlib.rst:1666 msgid "Matches one character not in *seq*." diff --git a/library/pipes.po b/library/pipes.po deleted file mode 100644 index 67d5298f5b..0000000000 --- a/library/pipes.po +++ /dev/null @@ -1,144 +0,0 @@ -# Copyright (C) 2001-2024, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2022-05-22 02:11+0800\n" -"Last-Translator: Liang-Bo Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/pipes.rst:2 -msgid ":mod:`pipes` --- Interface to shell pipelines" -msgstr ":mod:`pipes` --- shell pipelines 介面" - -#: ../../library/pipes.rst:11 -msgid "**Source code:** :source:`Lib/pipes.py`" -msgstr "**原始碼:**\\ :source:`Lib/pipes.py`" - -#: ../../library/pipes.rst:13 -msgid "" -"The :mod:`pipes` module is deprecated (see :pep:`PEP 594 <594#pipes>` for " -"details). Please use the :mod:`subprocess` module instead." -msgstr "" -":mod:`pipes` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#pipes>`\\ )。" -"請改用 :mod:`subprocess`。" - -#: ../../library/pipes.rst:20 -msgid "" -"The :mod:`pipes` module defines a class to abstract the concept of a " -"*pipeline* --- a sequence of converters from one file to another." -msgstr "" - -#: ../../library/pipes.rst:23 -msgid "" -"Because the module uses :program:`/bin/sh` command lines, a POSIX or " -"compatible shell for :func:`os.system` and :func:`os.popen` is required." -msgstr "" - -#: ../../library/pipes.rst:26 -msgid ":ref:`Availability `: Unix, not VxWorks." -msgstr ":ref:`適用 `:Unix,非 VxWorks。" - -#: ../../library/pipes.rst:28 -msgid "The :mod:`pipes` module defines the following class:" -msgstr "" - -#: ../../library/pipes.rst:33 -msgid "An abstraction of a pipeline." -msgstr "" - -#: ../../library/pipes.rst:35 -msgid "Example::" -msgstr "範例: ::" - -#: ../../library/pipes.rst:37 -msgid "" -">>> import pipes\n" -">>> t = pipes.Template()\n" -">>> t.append('tr a-z A-Z', '--')\n" -">>> f = t.open('pipefile', 'w')\n" -">>> f.write('hello world')\n" -">>> f.close()\n" -">>> open('pipefile').read()\n" -"'HELLO WORLD'" -msgstr "" -">>> import pipes\n" -">>> t = pipes.Template()\n" -">>> t.append('tr a-z A-Z', '--')\n" -">>> f = t.open('pipefile', 'w')\n" -">>> f.write('hello world')\n" -">>> f.close()\n" -">>> open('pipefile').read()\n" -"'HELLO WORLD'" - -#: ../../library/pipes.rst:50 -msgid "Template Objects" -msgstr "" - -#: ../../library/pipes.rst:52 -msgid "Template objects following methods:" -msgstr "" - -#: ../../library/pipes.rst:57 -msgid "Restore a pipeline template to its initial state." -msgstr "" - -#: ../../library/pipes.rst:62 -msgid "Return a new, equivalent, pipeline template." -msgstr "" - -#: ../../library/pipes.rst:67 -msgid "" -"If *flag* is true, turn debugging on. Otherwise, turn debugging off. When " -"debugging is on, commands to be executed are printed, and the shell is given " -"``set -x`` command to be more verbose." -msgstr "" - -#: ../../library/pipes.rst:74 -msgid "" -"Append a new action at the end. The *cmd* variable must be a valid bourne " -"shell command. The *kind* variable consists of two letters." -msgstr "" - -#: ../../library/pipes.rst:77 -msgid "" -"The first letter can be either of ``'-'`` (which means the command reads its " -"standard input), ``'f'`` (which means the commands reads a given file on the " -"command line) or ``'.'`` (which means the commands reads no input, and hence " -"must be first.)" -msgstr "" - -#: ../../library/pipes.rst:82 -msgid "" -"Similarly, the second letter can be either of ``'-'`` (which means the " -"command writes to standard output), ``'f'`` (which means the command writes " -"a file on the command line) or ``'.'`` (which means the command does not " -"write anything, and hence must be last.)" -msgstr "" - -#: ../../library/pipes.rst:90 -msgid "" -"Add a new action at the beginning. See :meth:`append` for explanations of " -"the arguments." -msgstr "" - -#: ../../library/pipes.rst:96 -msgid "" -"Return a file-like object, open to *file*, but read from or written to by " -"the pipeline. Note that only one of ``'r'``, ``'w'`` may be given." -msgstr "" - -#: ../../library/pipes.rst:102 -msgid "Copy *infile* to *outfile* through the pipe." -msgstr "" diff --git a/library/poplib.po b/library/poplib.po index 56f717a4f5..05056d6a9f 100644 --- a/library/poplib.po +++ b/library/poplib.po @@ -53,16 +53,15 @@ msgstr "" #: ../../includes/wasm-notavail.rst:3 msgid ":ref:`Availability `: not WASI." -msgstr "" +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/poplib.rst:33 msgid "The :mod:`poplib` module provides two classes:" diff --git a/library/re.po b/library/re.po index 5059b8501a..ade794f4a6 100644 --- a/library/re.po +++ b/library/re.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-09-16 14:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -169,7 +169,7 @@ msgstr "" msgid "The special characters are:" msgstr "" -#: ../../library/re.rst:101 ../../library/re.rst:1643 +#: ../../library/re.rst:101 ../../library/re.rst:1649 msgid "``.``" msgstr "``.``" @@ -829,53 +829,60 @@ msgid "" msgstr "" #: ../../library/re.rst:577 +msgid "" +"Note that ``\\B`` does not match an empty string, which differs from RE " +"implementations in other programming languages such as Perl. This behavior " +"is kept for compatibility reasons." +msgstr "" + +#: ../../library/re.rst:583 msgid "``\\d``" msgstr "``\\d``" -#: ../../library/re.rst:578 ../../library/re.rst:602 ../../library/re.rst:624 +#: ../../library/re.rst:584 ../../library/re.rst:608 ../../library/re.rst:630 msgid "For Unicode (str) patterns:" msgstr "" -#: ../../library/re.rst:579 +#: ../../library/re.rst:585 msgid "" "Matches any Unicode decimal digit (that is, any character in Unicode " "character category `[Nd]`__). This includes ``[0-9]``, and also many other " "digit characters." msgstr "" -#: ../../library/re.rst:583 +#: ../../library/re.rst:589 msgid "Matches ``[0-9]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:587 ../../library/re.rst:609 ../../library/re.rst:632 +#: ../../library/re.rst:593 ../../library/re.rst:615 ../../library/re.rst:638 msgid "For 8-bit (bytes) patterns:" msgstr "" -#: ../../library/re.rst:588 +#: ../../library/re.rst:594 msgid "" "Matches any decimal digit in the ASCII character set; this is equivalent to " "``[0-9]``." msgstr "" -#: ../../library/re.rst:593 +#: ../../library/re.rst:599 msgid "``\\D``" msgstr "``\\D``" -#: ../../library/re.rst:594 +#: ../../library/re.rst:600 msgid "" "Matches any character which is not a decimal digit. This is the opposite of " "``\\d``." msgstr "" -#: ../../library/re.rst:597 +#: ../../library/re.rst:603 msgid "Matches ``[^0-9]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:601 +#: ../../library/re.rst:607 msgid "``\\s``" msgstr "``\\s``" -#: ../../library/re.rst:603 +#: ../../library/re.rst:609 msgid "" "Matches Unicode whitespace characters (as defined by :py:meth:`str." "isspace`). This includes ``[ \\t\\n\\r\\f\\v]``, and also many other " @@ -883,48 +890,48 @@ msgid "" "in many languages." msgstr "" -#: ../../library/re.rst:607 +#: ../../library/re.rst:613 msgid "" "Matches ``[ \\t\\n\\r\\f\\v]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:610 +#: ../../library/re.rst:616 msgid "" "Matches characters considered whitespace in the ASCII character set; this is " "equivalent to ``[ \\t\\n\\r\\f\\v]``." msgstr "" -#: ../../library/re.rst:615 +#: ../../library/re.rst:621 msgid "``\\S``" msgstr "``\\S``" -#: ../../library/re.rst:616 +#: ../../library/re.rst:622 msgid "" "Matches any character which is not a whitespace character. This is the " "opposite of ``\\s``." msgstr "" -#: ../../library/re.rst:619 +#: ../../library/re.rst:625 msgid "" "Matches ``[^ \\t\\n\\r\\f\\v]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:623 +#: ../../library/re.rst:629 msgid "``\\w``" msgstr "``\\w``" -#: ../../library/re.rst:625 +#: ../../library/re.rst:631 msgid "" "Matches Unicode word characters; this includes all Unicode alphanumeric " "characters (as defined by :py:meth:`str.isalnum`), as well as the underscore " "(``_``)." msgstr "" -#: ../../library/re.rst:630 +#: ../../library/re.rst:636 msgid "Matches ``[a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:633 +#: ../../library/re.rst:639 msgid "" "Matches characters considered alphanumeric in the ASCII character set; this " "is equivalent to ``[a-zA-Z0-9_]``. If the :py:const:`~re.LOCALE` flag is " @@ -932,42 +939,42 @@ msgid "" "the underscore." msgstr "" -#: ../../library/re.rst:640 +#: ../../library/re.rst:646 msgid "``\\W``" msgstr "``\\W``" -#: ../../library/re.rst:641 +#: ../../library/re.rst:647 msgid "" "Matches any character which is not a word character. This is the opposite of " "``\\w``. By default, matches non-underscore (``_``) characters for which :py:" "meth:`str.isalnum` returns ``False``." msgstr "" -#: ../../library/re.rst:646 +#: ../../library/re.rst:652 msgid "Matches ``[^a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:648 +#: ../../library/re.rst:654 msgid "" "If the :py:const:`~re.LOCALE` flag is used, matches characters which are " "neither alphanumeric in the current locale nor the underscore." msgstr "" -#: ../../library/re.rst:654 +#: ../../library/re.rst:660 msgid "``\\Z``" msgstr "``\\Z``" -#: ../../library/re.rst:655 +#: ../../library/re.rst:661 msgid "Matches only at the end of the string." msgstr "" -#: ../../library/re.rst:671 +#: ../../library/re.rst:677 msgid "" "Most of the :ref:`escape sequences ` supported by Python " "string literals are also accepted by the regular expression parser::" msgstr "" -#: ../../library/re.rst:674 +#: ../../library/re.rst:680 msgid "" "\\a \\b \\f \\n\n" "\\N \\r \\t \\u\n" @@ -977,20 +984,20 @@ msgstr "" "\\N \\r \\t \\u\n" "\\U \\v \\x \\\\" -#: ../../library/re.rst:678 +#: ../../library/re.rst:684 msgid "" "(Note that ``\\b`` is used to represent word boundaries, and means " "\"backspace\" only inside character classes.)" msgstr "" -#: ../../library/re.rst:681 +#: ../../library/re.rst:687 msgid "" "``'\\u'``, ``'\\U'``, and ``'\\N'`` escape sequences are only recognized in " "Unicode (str) patterns. In bytes patterns they are errors. Unknown escapes " "of ASCII letters are reserved for future use and treated as errors." msgstr "" -#: ../../library/re.rst:687 +#: ../../library/re.rst:693 msgid "" "Octal escapes are included in a limited form. If the first digit is a 0, or " "if there are three octal digits, it is considered an octal escape. " @@ -998,27 +1005,27 @@ msgid "" "are always at most three digits in length." msgstr "" -#: ../../library/re.rst:692 +#: ../../library/re.rst:698 msgid "The ``'\\u'`` and ``'\\U'`` escape sequences have been added." msgstr "" -#: ../../library/re.rst:695 +#: ../../library/re.rst:701 msgid "" "Unknown escapes consisting of ``'\\'`` and an ASCII letter now are errors." msgstr "" -#: ../../library/re.rst:698 +#: ../../library/re.rst:704 msgid "" "The :samp:`'\\\\N\\\\{{name}\\\\}'` escape sequence has been added. As in " "string literals, it expands to the named Unicode character (e.g. ``'\\N{EM " "DASH}'``)." msgstr "" -#: ../../library/re.rst:706 +#: ../../library/re.rst:712 msgid "Module Contents" msgstr "模組內容" -#: ../../library/re.rst:708 +#: ../../library/re.rst:714 msgid "" "The module defines several functions, constants, and an exception. Some of " "the functions are simplified versions of the full featured methods for " @@ -1026,26 +1033,26 @@ msgid "" "compiled form." msgstr "" -#: ../../library/re.rst:715 +#: ../../library/re.rst:721 msgid "Flags" msgstr "旗標" -#: ../../library/re.rst:717 +#: ../../library/re.rst:723 msgid "" "Flag constants are now instances of :class:`RegexFlag`, which is a subclass " "of :class:`enum.IntFlag`." msgstr "" -#: ../../library/re.rst:724 +#: ../../library/re.rst:730 msgid "" "An :class:`enum.IntFlag` class containing the regex options listed below." msgstr "" -#: ../../library/re.rst:726 +#: ../../library/re.rst:732 msgid "- added to ``__all__``" msgstr "" -#: ../../library/re.rst:731 +#: ../../library/re.rst:737 msgid "" "Make ``\\w``, ``\\W``, ``\\b``, ``\\B``, ``\\d``, ``\\D``, ``\\s`` and " "``\\S`` perform ASCII-only matching instead of full Unicode matching. This " @@ -1053,11 +1060,11 @@ msgid "" "patterns." msgstr "" -#: ../../library/re.rst:735 +#: ../../library/re.rst:741 msgid "Corresponds to the inline flag ``(?a)``." msgstr "" -#: ../../library/re.rst:739 +#: ../../library/re.rst:745 msgid "" "The :py:const:`~re.U` flag still exists for backward compatibility, but is " "redundant in Python 3 since matches are Unicode by default for ``str`` " @@ -1065,15 +1072,15 @@ msgid "" "`~re.UNICODE` and the inline flag ``(?u)`` are similarly redundant." msgstr "" -#: ../../library/re.rst:748 +#: ../../library/re.rst:754 msgid "Display debug information about compiled expression." msgstr "" -#: ../../library/re.rst:750 +#: ../../library/re.rst:756 msgid "No corresponding inline flag." msgstr "" -#: ../../library/re.rst:756 +#: ../../library/re.rst:762 msgid "" "Perform case-insensitive matching; expressions like ``[A-Z]`` will also " "match lowercase letters. Full Unicode matching (such as ``Ü`` matching " @@ -1082,11 +1089,11 @@ msgid "" "flag unless the :py:const:`~re.LOCALE` flag is also used." msgstr "" -#: ../../library/re.rst:764 +#: ../../library/re.rst:770 msgid "Corresponds to the inline flag ``(?i)``." msgstr "" -#: ../../library/re.rst:766 +#: ../../library/re.rst:772 msgid "" "Note that when the Unicode patterns ``[a-z]`` or ``[A-Z]`` are used in " "combination with the :const:`IGNORECASE` flag, they will match the 52 ASCII " @@ -1097,18 +1104,18 @@ msgid "" "are matched." msgstr "" -#: ../../library/re.rst:777 +#: ../../library/re.rst:783 msgid "" "Make ``\\w``, ``\\W``, ``\\b``, ``\\B`` and case-insensitive matching " "dependent on the current locale. This flag can be used only with bytes " "patterns." msgstr "" -#: ../../library/re.rst:781 +#: ../../library/re.rst:787 msgid "Corresponds to the inline flag ``(?L)``." msgstr "" -#: ../../library/re.rst:785 +#: ../../library/re.rst:791 msgid "" "This flag is discouraged; consider Unicode matching instead. The locale " "mechanism is very unreliable as it only handles one \"culture\" at a time " @@ -1117,20 +1124,20 @@ msgid "" "languages." msgstr "" -#: ../../library/re.rst:792 +#: ../../library/re.rst:798 msgid "" ":py:const:`~re.LOCALE` can be used only with bytes patterns and is not " "compatible with :py:const:`~re.ASCII`." msgstr "" -#: ../../library/re.rst:796 +#: ../../library/re.rst:802 msgid "" "Compiled regular expression objects with the :py:const:`~re.LOCALE` flag no " "longer depend on the locale at compile time. Only the locale at matching " "time affects the result of matching." msgstr "" -#: ../../library/re.rst:805 +#: ../../library/re.rst:811 msgid "" "When specified, the pattern character ``'^'`` matches at the beginning of " "the string and at the beginning of each line (immediately following each " @@ -1141,11 +1148,11 @@ msgid "" "the end of the string." msgstr "" -#: ../../library/re.rst:812 +#: ../../library/re.rst:818 msgid "Corresponds to the inline flag ``(?m)``." msgstr "" -#: ../../library/re.rst:816 +#: ../../library/re.rst:822 msgid "" "Indicates no flag being applied, the value is ``0``. This flag may be used " "as a default value for a function keyword argument or as a base value that " @@ -1153,35 +1160,35 @@ msgid "" "value::" msgstr "" -#: ../../library/re.rst:821 +#: ../../library/re.rst:827 msgid "" "def myfunc(text, flag=re.NOFLAG):\n" " return re.match(text, flag)" msgstr "" -#: ../../library/re.rst:829 +#: ../../library/re.rst:835 msgid "" "Make the ``'.'`` special character match any character at all, including a " "newline; without this flag, ``'.'`` will match anything *except* a newline." msgstr "" -#: ../../library/re.rst:832 +#: ../../library/re.rst:838 msgid "Corresponds to the inline flag ``(?s)``." msgstr "" -#: ../../library/re.rst:838 +#: ../../library/re.rst:844 msgid "" "In Python 3, Unicode characters are matched by default for ``str`` patterns. " "This flag is therefore redundant with **no effect** and is only kept for " "backward compatibility." msgstr "" -#: ../../library/re.rst:843 +#: ../../library/re.rst:849 msgid "" "See :py:const:`~re.ASCII` to restrict matching to ASCII characters instead." msgstr "" -#: ../../library/re.rst:850 +#: ../../library/re.rst:856 msgid "" "This flag allows you to write regular expressions that look nicer and are " "more readable by allowing you to visually separate logical sections of the " @@ -1194,13 +1201,13 @@ msgid "" "ignored." msgstr "" -#: ../../library/re.rst:860 +#: ../../library/re.rst:866 msgid "" "This means that the two following regular expression objects that match a " "decimal number are functionally equal::" msgstr "" -#: ../../library/re.rst:863 +#: ../../library/re.rst:869 msgid "" "a = re.compile(r\"\"\"\\d + # the integral part\n" " \\. # the decimal point\n" @@ -1208,57 +1215,57 @@ msgid "" "b = re.compile(r\"\\d+\\.\\d*\")" msgstr "" -#: ../../library/re.rst:868 +#: ../../library/re.rst:874 msgid "Corresponds to the inline flag ``(?x)``." msgstr "" -#: ../../library/re.rst:872 +#: ../../library/re.rst:878 msgid "Functions" msgstr "" -#: ../../library/re.rst:876 +#: ../../library/re.rst:882 msgid "" "Compile a regular expression pattern into a :ref:`regular expression object " "`, which can be used for matching using its :func:`~Pattern." "match`, :func:`~Pattern.search` and other methods, described below." msgstr "" -#: ../../library/re.rst:881 ../../library/re.rst:913 ../../library/re.rst:931 -#: ../../library/re.rst:942 ../../library/re.rst:988 ../../library/re.rst:1022 -#: ../../library/re.rst:1037 ../../library/re.rst:1096 -#: ../../library/re.rst:1132 +#: ../../library/re.rst:887 ../../library/re.rst:919 ../../library/re.rst:937 +#: ../../library/re.rst:948 ../../library/re.rst:994 ../../library/re.rst:1028 +#: ../../library/re.rst:1043 ../../library/re.rst:1102 +#: ../../library/re.rst:1138 msgid "" "The expression's behaviour can be modified by specifying a *flags* value. " "Values can be any of the `flags`_ variables, combined using bitwise OR (the " "``|`` operator)." msgstr "" -#: ../../library/re.rst:885 +#: ../../library/re.rst:891 msgid "The sequence ::" msgstr "" -#: ../../library/re.rst:887 +#: ../../library/re.rst:893 msgid "" "prog = re.compile(pattern)\n" "result = prog.match(string)" msgstr "" -#: ../../library/re.rst:890 +#: ../../library/re.rst:896 msgid "is equivalent to ::" msgstr "等價於: ::" -#: ../../library/re.rst:892 +#: ../../library/re.rst:898 msgid "result = re.match(pattern, string)" msgstr "" -#: ../../library/re.rst:894 +#: ../../library/re.rst:900 msgid "" "but using :func:`re.compile` and saving the resulting regular expression " "object for reuse is more efficient when the expression will be used several " "times in a single program." msgstr "" -#: ../../library/re.rst:900 +#: ../../library/re.rst:906 msgid "" "The compiled versions of the most recent patterns passed to :func:`re." "compile` and the module-level matching functions are cached, so programs " @@ -1266,7 +1273,7 @@ msgid "" "compiling regular expressions." msgstr "" -#: ../../library/re.rst:908 +#: ../../library/re.rst:914 msgid "" "Scan through *string* looking for the first location where the regular " "expression *pattern* produces a match, and return a corresponding :class:" @@ -1275,7 +1282,7 @@ msgid "" "some point in the string." msgstr "" -#: ../../library/re.rst:920 +#: ../../library/re.rst:926 msgid "" "If zero or more characters at the beginning of *string* match the regular " "expression *pattern*, return a corresponding :class:`~re.Match`. Return " @@ -1283,26 +1290,26 @@ msgid "" "different from a zero-length match." msgstr "" -#: ../../library/re.rst:925 +#: ../../library/re.rst:931 msgid "" "Note that even in :const:`MULTILINE` mode, :func:`re.match` will only match " "at the beginning of the string and not at the beginning of each line." msgstr "" -#: ../../library/re.rst:928 +#: ../../library/re.rst:934 msgid "" "If you want to locate a match anywhere in *string*, use :func:`search` " "instead (see also :ref:`search-vs-match`)." msgstr "" -#: ../../library/re.rst:938 +#: ../../library/re.rst:944 msgid "" "If the whole *string* matches the regular expression *pattern*, return a " "corresponding :class:`~re.Match`. Return ``None`` if the string does not " "match the pattern; note that this is different from a zero-length match." msgstr "" -#: ../../library/re.rst:951 +#: ../../library/re.rst:957 msgid "" "Split *string* by the occurrences of *pattern*. If capturing parentheses " "are used in *pattern*, then the text of all groups in the pattern are also " @@ -1311,8 +1318,7 @@ msgid "" "final element of the list. ::" msgstr "" -#: ../../library/re.rst:957 -#, fuzzy +#: ../../library/re.rst:963 msgid "" ">>> re.split(r'\\W+', 'Words, words, words.')\n" "['Words', 'words', 'words', '']\n" @@ -1327,19 +1333,19 @@ msgstr "" "['Words', 'words', 'words', '']\n" ">>> re.split(r'(\\W+)', 'Words, words, words.')\n" "['Words', ', ', 'words', ', ', 'words', '.', '']\n" -">>> re.split(r'\\W+', 'Words, words, words.', 1)\n" +">>> re.split(r'\\W+', 'Words, words, words.', maxsplit=1)\n" "['Words', 'words, words.']\n" ">>> re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE)\n" "['0', '3', '9']" -#: ../../library/re.rst:966 +#: ../../library/re.rst:972 msgid "" "If there are capturing groups in the separator and it matches at the start " "of the string, the result will start with an empty string. The same holds " "for the end of the string::" msgstr "" -#: ../../library/re.rst:970 +#: ../../library/re.rst:976 msgid "" ">>> re.split(r'(\\W+)', '...words, words...')\n" "['', '...', 'words', ', ', 'words', '...', '']" @@ -1347,19 +1353,19 @@ msgstr "" ">>> re.split(r'(\\W+)', '...words, words...')\n" "['', '...', 'words', ', ', 'words', '...', '']" -#: ../../library/re.rst:973 +#: ../../library/re.rst:979 msgid "" "That way, separator components are always found at the same relative indices " "within the result list." msgstr "" -#: ../../library/re.rst:976 +#: ../../library/re.rst:982 msgid "" "Empty matches for the pattern split the string only when not adjacent to a " "previous empty match." msgstr "" -#: ../../library/re.rst:979 +#: ../../library/re.rst:985 msgid "" ">>> re.split(r'\\b', 'Words, words, words.')\n" "['', 'Words', ', ', 'words', ', ', 'words', '.']\n" @@ -1377,30 +1383,30 @@ msgstr "" "['', '...', '', '', 'w', '', 'o', '', 'r', '', 'd', '', 's', '...', '', '', " "'']" -#: ../../library/re.rst:992 ../../library/re.rst:1100 +#: ../../library/re.rst:998 ../../library/re.rst:1106 msgid "Added the optional flags argument." msgstr "新增可選的旗標引數。" -#: ../../library/re.rst:995 +#: ../../library/re.rst:1001 msgid "" "Added support of splitting on a pattern that could match an empty string." msgstr "" -#: ../../library/re.rst:998 +#: ../../library/re.rst:1004 msgid "" "Passing *maxsplit* and *flags* as positional arguments is deprecated. In " "future Python versions they will be :ref:`keyword-only parameters `." msgstr "" -#: ../../library/re.rst:1006 +#: ../../library/re.rst:1012 msgid "" "Return all non-overlapping matches of *pattern* in *string*, as a list of " "strings or tuples. The *string* is scanned left-to-right, and matches are " "returned in the order found. Empty matches are included in the result." msgstr "" -#: ../../library/re.rst:1010 +#: ../../library/re.rst:1016 msgid "" "The result depends on the number of capturing groups in the pattern. If " "there are no groups, return a list of strings matching the whole pattern. " @@ -1410,11 +1416,11 @@ msgid "" "result." msgstr "" -#: ../../library/re.rst:1026 ../../library/re.rst:1041 +#: ../../library/re.rst:1032 ../../library/re.rst:1047 msgid "Non-empty matches can now start just after a previous empty match." msgstr "" -#: ../../library/re.rst:1032 +#: ../../library/re.rst:1038 msgid "" "Return an :term:`iterator` yielding :class:`~re.Match` objects over all non-" "overlapping matches for the RE *pattern* in *string*. The *string* is " @@ -1422,7 +1428,7 @@ msgid "" "matches are included in the result." msgstr "" -#: ../../library/re.rst:1047 +#: ../../library/re.rst:1053 msgid "" "Return the string obtained by replacing the leftmost non-overlapping " "occurrences of *pattern* in *string* by the replacement *repl*. If the " @@ -1436,7 +1442,7 @@ msgid "" "For example::" msgstr "" -#: ../../library/re.rst:1058 +#: ../../library/re.rst:1064 msgid "" ">>> re.sub(r'def\\s+([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\(\\s*\\):',\n" "... r'static PyObject*\\npy_\\1(void)\\n{',\n" @@ -1448,14 +1454,14 @@ msgstr "" "... 'def myfunc():')\n" "'static PyObject*\\npy_myfunc(void)\\n{'" -#: ../../library/re.rst:1063 +#: ../../library/re.rst:1069 msgid "" "If *repl* is a function, it is called for every non-overlapping occurrence " "of *pattern*. The function takes a single :class:`~re.Match` argument, and " "returns the replacement string. For example::" msgstr "" -#: ../../library/re.rst:1067 +#: ../../library/re.rst:1073 msgid "" ">>> def dashrepl(matchobj):\n" "... if matchobj.group(0) == '-': return ' '\n" @@ -1477,11 +1483,11 @@ msgstr "" "IGNORECASE)\n" "'Baked Beans & Spam'" -#: ../../library/re.rst:1076 +#: ../../library/re.rst:1082 msgid "The pattern may be a string or a :class:`~re.Pattern`." msgstr "" -#: ../../library/re.rst:1078 +#: ../../library/re.rst:1084 msgid "" "The optional argument *count* is the maximum number of pattern occurrences " "to be replaced; *count* must be a non-negative integer. If omitted or zero, " @@ -1490,7 +1496,7 @@ msgid "" "'abxd')`` returns ``'-a-b--d-'``." msgstr "" -#: ../../library/re.rst:1086 +#: ../../library/re.rst:1092 msgid "" "In string-type *repl* arguments, in addition to the character escapes and " "backreferences described above, ``\\g`` will use the substring matched " @@ -1503,51 +1509,51 @@ msgid "" "RE." msgstr "" -#: ../../library/re.rst:1103 ../../library/re.rst:1381 +#: ../../library/re.rst:1109 ../../library/re.rst:1387 msgid "Unmatched groups are replaced with an empty string." msgstr "" -#: ../../library/re.rst:1106 +#: ../../library/re.rst:1112 msgid "" "Unknown escapes in *pattern* consisting of ``'\\'`` and an ASCII letter now " "are errors." msgstr "" -#: ../../library/re.rst:1110 +#: ../../library/re.rst:1116 msgid "" "Unknown escapes in *repl* consisting of ``'\\'`` and an ASCII letter now are " "errors. Empty matches for the pattern are replaced when adjacent to a " "previous non-empty match." msgstr "" -#: ../../library/re.rst:1116 +#: ../../library/re.rst:1122 msgid "" "Group *id* can only contain ASCII digits. In :class:`bytes` replacement " "strings, group *name* can only contain bytes in the ASCII range " "(``b'\\x00'``-``b'\\x7f'``)." msgstr "" -#: ../../library/re.rst:1121 +#: ../../library/re.rst:1127 msgid "" "Passing *count* and *flags* as positional arguments is deprecated. In future " "Python versions they will be :ref:`keyword-only parameters `." msgstr "" -#: ../../library/re.rst:1129 +#: ../../library/re.rst:1135 msgid "" "Perform the same operation as :func:`sub`, but return a tuple ``(new_string, " "number_of_subs_made)``." msgstr "" -#: ../../library/re.rst:1139 +#: ../../library/re.rst:1145 msgid "" "Escape special characters in *pattern*. This is useful if you want to match " "an arbitrary literal string that may have regular expression metacharacters " "in it. For example::" msgstr "" -#: ../../library/re.rst:1143 +#: ../../library/re.rst:1149 msgid "" ">>> print(re.escape('https://www.python.org/'))\n" "https://www//.python//.org/n" @@ -1573,13 +1579,13 @@ msgstr "" ">>> print('|'.join(map(re.escape, sorted(operators, reverse=True))))\n" "/|\\-|\\+|\\*\\*|\\*" -#: ../../library/re.rst:1154 +#: ../../library/re.rst:1160 msgid "" "This function must not be used for the replacement string in :func:`sub` " "and :func:`subn`, only backslashes should be escaped. For example::" msgstr "" -#: ../../library/re.rst:1157 +#: ../../library/re.rst:1163 msgid "" ">>> digits_re = r'\\d+'\n" ">>> sample = '/usr/sbin/sendmail - 0 errors, 12 warnings'\n" @@ -1591,11 +1597,11 @@ msgstr "" ">>> print(re.sub(digits_re, digits_re.replace('\\\\', r'\\\\'), sample))\n" "/usr/sbin/sendmail - \\d+ errors, \\d+ warnings" -#: ../../library/re.rst:1162 +#: ../../library/re.rst:1168 msgid "The ``'_'`` character is no longer escaped." msgstr "" -#: ../../library/re.rst:1165 +#: ../../library/re.rst:1171 msgid "" "Only characters that can have special meaning in a regular expression are " "escaped. As a result, ``'!'``, ``'\"'``, ``'%'``, ``\"'\"``, ``','``, " @@ -1603,15 +1609,15 @@ msgid "" "are no longer escaped." msgstr "" -#: ../../library/re.rst:1174 +#: ../../library/re.rst:1180 msgid "Clear the regular expression cache." msgstr "" -#: ../../library/re.rst:1178 +#: ../../library/re.rst:1184 msgid "Exceptions" msgstr "" -#: ../../library/re.rst:1182 +#: ../../library/re.rst:1188 msgid "" "Exception raised when a string passed to one of the functions here is not a " "valid regular expression (for example, it might contain unmatched " @@ -1621,51 +1627,51 @@ msgid "" "attributes:" msgstr "" -#: ../../library/re.rst:1190 +#: ../../library/re.rst:1196 msgid "The unformatted error message." msgstr "" -#: ../../library/re.rst:1194 +#: ../../library/re.rst:1200 msgid "The regular expression pattern." msgstr "" -#: ../../library/re.rst:1198 +#: ../../library/re.rst:1204 msgid "The index in *pattern* where compilation failed (may be ``None``)." msgstr "" -#: ../../library/re.rst:1202 +#: ../../library/re.rst:1208 msgid "The line corresponding to *pos* (may be ``None``)." msgstr "" -#: ../../library/re.rst:1206 +#: ../../library/re.rst:1212 msgid "The column corresponding to *pos* (may be ``None``)." msgstr "" -#: ../../library/re.rst:1208 +#: ../../library/re.rst:1214 msgid "Added additional attributes." msgstr "新增額外屬性。" -#: ../../library/re.rst:1211 +#: ../../library/re.rst:1217 msgid "" "``PatternError`` was originally named ``error``; the latter is kept as an " "alias for backward compatibility." msgstr "" -#: ../../library/re.rst:1218 +#: ../../library/re.rst:1224 msgid "Regular Expression Objects" msgstr "" -#: ../../library/re.rst:1222 +#: ../../library/re.rst:1228 msgid "Compiled regular expression object returned by :func:`re.compile`." msgstr "" -#: ../../library/re.rst:1224 +#: ../../library/re.rst:1230 msgid "" ":py:class:`re.Pattern` supports ``[]`` to indicate a Unicode (str) or bytes " "pattern. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1230 +#: ../../library/re.rst:1236 msgid "" "Scan through *string* looking for the first location where this regular " "expression produces a match, and return a corresponding :class:`~re.Match`. " @@ -1674,7 +1680,7 @@ msgid "" "string." msgstr "" -#: ../../library/re.rst:1235 +#: ../../library/re.rst:1241 msgid "" "The optional second parameter *pos* gives an index in the string where the " "search is to start; it defaults to ``0``. This is not completely equivalent " @@ -1683,7 +1689,7 @@ msgid "" "necessarily at the index where the search is to start." msgstr "" -#: ../../library/re.rst:1241 +#: ../../library/re.rst:1247 msgid "" "The optional parameter *endpos* limits how far the string will be searched; " "it will be as if the string is *endpos* characters long, so only the " @@ -1693,7 +1699,7 @@ msgid "" "equivalent to ``rx.search(string[:50], 0)``. ::" msgstr "" -#: ../../library/re.rst:1248 +#: ../../library/re.rst:1254 msgid "" ">>> pattern = re.compile(\"d\")\n" ">>> pattern.search(\"dog\") # Match at index 0\n" @@ -1701,7 +1707,7 @@ msgid "" ">>> pattern.search(\"dog\", 1) # No match; search doesn't include the \"d\"" msgstr "" -#: ../../library/re.rst:1256 +#: ../../library/re.rst:1262 msgid "" "If zero or more characters at the *beginning* of *string* match this regular " "expression, return a corresponding :class:`~re.Match`. Return ``None`` if " @@ -1709,13 +1715,13 @@ msgid "" "zero-length match." msgstr "" -#: ../../library/re.rst:1261 ../../library/re.rst:1279 +#: ../../library/re.rst:1267 ../../library/re.rst:1285 msgid "" "The optional *pos* and *endpos* parameters have the same meaning as for the :" "meth:`~Pattern.search` method. ::" msgstr "" -#: ../../library/re.rst:1264 +#: ../../library/re.rst:1270 msgid "" ">>> pattern = re.compile(\"o\")\n" ">>> pattern.match(\"dog\") # No match as \"o\" is not at the start of " @@ -1725,20 +1731,20 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1269 +#: ../../library/re.rst:1275 msgid "" "If you want to locate a match anywhere in *string*, use :meth:`~Pattern." "search` instead (see also :ref:`search-vs-match`)." msgstr "" -#: ../../library/re.rst:1275 +#: ../../library/re.rst:1281 msgid "" "If the whole *string* matches this regular expression, return a " "corresponding :class:`~re.Match`. Return ``None`` if the string does not " "match the pattern; note that this is different from a zero-length match." msgstr "" -#: ../../library/re.rst:1282 +#: ../../library/re.rst:1288 msgid "" ">>> pattern = re.compile(\"o[gh]\")\n" ">>> pattern.fullmatch(\"dog\") # No match as \"o\" is not at the start " @@ -1749,72 +1755,72 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1293 +#: ../../library/re.rst:1299 msgid "Identical to the :func:`split` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1298 +#: ../../library/re.rst:1304 msgid "" "Similar to the :func:`findall` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1305 +#: ../../library/re.rst:1311 msgid "" "Similar to the :func:`finditer` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1312 +#: ../../library/re.rst:1318 msgid "Identical to the :func:`sub` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1317 +#: ../../library/re.rst:1323 msgid "Identical to the :func:`subn` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1322 +#: ../../library/re.rst:1328 msgid "" "The regex matching flags. This is a combination of the flags given to :func:" "`.compile`, any ``(?...)`` inline flags in the pattern, and implicit flags " "such as :py:const:`~re.UNICODE` if the pattern is a Unicode string." msgstr "" -#: ../../library/re.rst:1329 +#: ../../library/re.rst:1335 msgid "The number of capturing groups in the pattern." msgstr "" -#: ../../library/re.rst:1334 +#: ../../library/re.rst:1340 msgid "" "A dictionary mapping any symbolic group names defined by ``(?P)`` to " "group numbers. The dictionary is empty if no symbolic groups were used in " "the pattern." msgstr "" -#: ../../library/re.rst:1341 +#: ../../library/re.rst:1347 msgid "The pattern string from which the pattern object was compiled." msgstr "" -#: ../../library/re.rst:1344 +#: ../../library/re.rst:1350 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Compiled " "regular expression objects are considered atomic." msgstr "" -#: ../../library/re.rst:1352 +#: ../../library/re.rst:1358 msgid "Match Objects" msgstr "" -#: ../../library/re.rst:1354 +#: ../../library/re.rst:1360 msgid "" "Match objects always have a boolean value of ``True``. Since :meth:`~Pattern." "match` and :meth:`~Pattern.search` return ``None`` when there is no match, " "you can test whether there was a match with a simple ``if`` statement::" msgstr "" -#: ../../library/re.rst:1359 +#: ../../library/re.rst:1365 msgid "" "match = re.search(pattern, string)\n" "if match:\n" @@ -1824,17 +1830,17 @@ msgstr "" "if match:\n" " process(match)" -#: ../../library/re.rst:1365 +#: ../../library/re.rst:1371 msgid "Match object returned by successful ``match``\\ es and ``search``\\ es." msgstr "" -#: ../../library/re.rst:1367 +#: ../../library/re.rst:1373 msgid "" ":py:class:`re.Match` supports ``[]`` to indicate a Unicode (str) or bytes " "match. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1373 +#: ../../library/re.rst:1379 msgid "" "Return the string obtained by doing backslash substitution on the template " "string *template*, as done by the :meth:`~Pattern.sub` method. Escapes such " @@ -1844,7 +1850,7 @@ msgid "" "backreference ``\\g<0>`` will be replaced by the entire match." msgstr "" -#: ../../library/re.rst:1386 +#: ../../library/re.rst:1392 msgid "" "Returns one or more subgroups of the match. If there is a single argument, " "the result is a single string; if there are multiple arguments, the result " @@ -1859,7 +1865,7 @@ msgid "" "the pattern that matched multiple times, the last match is returned. ::" msgstr "" -#: ../../library/re.rst:1398 +#: ../../library/re.rst:1404 msgid "" ">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" ">>> m.group(0) # The entire match\n" @@ -1872,7 +1878,7 @@ msgid "" "('Isaac', 'Newton')" msgstr "" -#: ../../library/re.rst:1408 +#: ../../library/re.rst:1414 msgid "" "If the regular expression uses the ``(?P...)`` syntax, the *groupN* " "arguments may also be strings identifying groups by their group name. If a " @@ -1880,11 +1886,11 @@ msgid "" "`IndexError` exception is raised." msgstr "" -#: ../../library/re.rst:1413 +#: ../../library/re.rst:1419 msgid "A moderately complicated example::" msgstr "" -#: ../../library/re.rst:1415 +#: ../../library/re.rst:1421 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " "Reynolds\")\n" @@ -1900,11 +1906,11 @@ msgstr "" ">>> m.group('last_name')\n" "'Reynolds'" -#: ../../library/re.rst:1421 +#: ../../library/re.rst:1427 msgid "Named groups can also be referred to by their index::" msgstr "" -#: ../../library/re.rst:1423 +#: ../../library/re.rst:1429 msgid "" ">>> m.group(1)\n" "'Malcolm'\n" @@ -1916,24 +1922,24 @@ msgstr "" ">>> m.group(2)\n" "'Reynolds'" -#: ../../library/re.rst:1428 +#: ../../library/re.rst:1434 msgid "If a group matches multiple times, only the last match is accessible::" msgstr "" -#: ../../library/re.rst:1430 +#: ../../library/re.rst:1436 msgid "" ">>> m = re.match(r\"(..)+\", \"a1b2c3\") # Matches 3 times.\n" ">>> m.group(1) # Returns only the last match.\n" "'c3'" msgstr "" -#: ../../library/re.rst:1437 +#: ../../library/re.rst:1443 msgid "" "This is identical to ``m.group(g)``. This allows easier access to an " "individual group from a match::" msgstr "" -#: ../../library/re.rst:1440 +#: ../../library/re.rst:1446 msgid "" ">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" ">>> m[0] # The entire match\n" @@ -1944,11 +1950,11 @@ msgid "" "'Newton'" msgstr "" -#: ../../library/re.rst:1448 +#: ../../library/re.rst:1454 msgid "Named groups are supported as well::" msgstr "" -#: ../../library/re.rst:1450 +#: ../../library/re.rst:1456 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Isaac " "Newton\")\n" @@ -1964,18 +1970,18 @@ msgstr "" ">>> m['last_name']\n" "'Newton'" -#: ../../library/re.rst:1461 +#: ../../library/re.rst:1467 msgid "" "Return a tuple containing all the subgroups of the match, from 1 up to " "however many groups are in the pattern. The *default* argument is used for " "groups that did not participate in the match; it defaults to ``None``." msgstr "" -#: ../../library/re.rst:1465 ../../library/re.rst:1690 +#: ../../library/re.rst:1471 ../../library/re.rst:1696 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/re.rst:1467 +#: ../../library/re.rst:1473 msgid "" ">>> m = re.match(r\"(\\d+)\\.(\\d+)\", \"24.1632\")\n" ">>> m.groups()\n" @@ -1985,14 +1991,14 @@ msgstr "" ">>> m.groups()\n" "('24', '1632')" -#: ../../library/re.rst:1471 +#: ../../library/re.rst:1477 msgid "" "If we make the decimal place and everything after it optional, not all " "groups might participate in the match. These groups will default to " "``None`` unless the *default* argument is given::" msgstr "" -#: ../../library/re.rst:1475 +#: ../../library/re.rst:1481 msgid "" ">>> m = re.match(r\"(\\d+)\\.?(\\d+)?\", \"24\")\n" ">>> m.groups() # Second group defaults to None.\n" @@ -2001,14 +2007,14 @@ msgid "" "('24', '0')" msgstr "" -#: ../../library/re.rst:1484 +#: ../../library/re.rst:1490 msgid "" "Return a dictionary containing all the *named* subgroups of the match, keyed " "by the subgroup name. The *default* argument is used for groups that did " "not participate in the match; it defaults to ``None``. For example::" msgstr "" -#: ../../library/re.rst:1488 +#: ../../library/re.rst:1494 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " "Reynolds\")\n" @@ -2020,7 +2026,7 @@ msgstr "" ">>> m.groupdict()\n" "{'first_name': 'Malcolm', 'last_name': 'Reynolds'}" -#: ../../library/re.rst:1496 +#: ../../library/re.rst:1502 msgid "" "Return the indices of the start and end of the substring matched by *group*; " "*group* defaults to zero (meaning the whole matched substring). Return " @@ -2029,11 +2035,11 @@ msgid "" "matched by group *g* (equivalent to ``m.group(g)``) is ::" msgstr "" -#: ../../library/re.rst:1502 +#: ../../library/re.rst:1508 msgid "m.string[m.start(g):m.end(g)]" msgstr "m.string[m.start(g):m.end(g)]" -#: ../../library/re.rst:1504 +#: ../../library/re.rst:1510 msgid "" "Note that ``m.start(group)`` will equal ``m.end(group)`` if *group* matched " "a null string. For example, after ``m = re.search('b(c?)', 'cba')``, ``m." @@ -2041,11 +2047,11 @@ msgid "" "2, and ``m.start(2)`` raises an :exc:`IndexError` exception." msgstr "" -#: ../../library/re.rst:1509 +#: ../../library/re.rst:1515 msgid "An example that will remove *remove_this* from email addresses::" msgstr "" -#: ../../library/re.rst:1511 +#: ../../library/re.rst:1517 msgid "" ">>> email = \"tony@tiremove_thisger.net\"\n" ">>> m = re.search(\"remove_this\", email)\n" @@ -2057,28 +2063,28 @@ msgstr "" ">>> email[:m.start()] + email[m.end():]\n" "'tony@tiger.net'" -#: ../../library/re.rst:1519 +#: ../../library/re.rst:1525 msgid "" "For a match *m*, return the 2-tuple ``(m.start(group), m.end(group))``. Note " "that if *group* did not contribute to the match, this is ``(-1, -1)``. " "*group* defaults to zero, the entire match." msgstr "" -#: ../../library/re.rst:1526 +#: ../../library/re.rst:1532 msgid "" "The value of *pos* which was passed to the :meth:`~Pattern.search` or :meth:" "`~Pattern.match` method of a :ref:`regex object `. This is the " "index into the string at which the RE engine started looking for a match." msgstr "" -#: ../../library/re.rst:1533 +#: ../../library/re.rst:1539 msgid "" "The value of *endpos* which was passed to the :meth:`~Pattern.search` or :" "meth:`~Pattern.match` method of a :ref:`regex object `. This is " "the index into the string beyond which the RE engine will not go." msgstr "" -#: ../../library/re.rst:1540 +#: ../../library/re.rst:1546 msgid "" "The integer index of the last matched capturing group, or ``None`` if no " "group was matched at all. For example, the expressions ``(a)b``, ``((a)" @@ -2087,43 +2093,43 @@ msgid "" "applied to the same string." msgstr "" -#: ../../library/re.rst:1549 +#: ../../library/re.rst:1555 msgid "" "The name of the last matched capturing group, or ``None`` if the group " "didn't have a name, or if no group was matched at all." msgstr "" -#: ../../library/re.rst:1555 +#: ../../library/re.rst:1561 msgid "" "The :ref:`regular expression object ` whose :meth:`~Pattern." "match` or :meth:`~Pattern.search` method produced this match instance." msgstr "" -#: ../../library/re.rst:1561 +#: ../../library/re.rst:1567 msgid "The string passed to :meth:`~Pattern.match` or :meth:`~Pattern.search`." msgstr "" -#: ../../library/re.rst:1564 +#: ../../library/re.rst:1570 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Match objects " "are considered atomic." msgstr "" -#: ../../library/re.rst:1572 +#: ../../library/re.rst:1578 msgid "Regular Expression Examples" msgstr "" -#: ../../library/re.rst:1576 +#: ../../library/re.rst:1582 msgid "Checking for a Pair" msgstr "" -#: ../../library/re.rst:1578 +#: ../../library/re.rst:1584 msgid "" "In this example, we'll use the following helper function to display match " "objects a little more gracefully::" msgstr "" -#: ../../library/re.rst:1581 +#: ../../library/re.rst:1587 msgid "" "def displaymatch(match):\n" " if match is None:\n" @@ -2135,7 +2141,7 @@ msgstr "" " return None\n" " return '' % (match.group(), match.groups())" -#: ../../library/re.rst:1586 +#: ../../library/re.rst:1592 msgid "" "Suppose you are writing a poker program where a player's hand is represented " "as a 5-character string with each character representing a card, \"a\" for " @@ -2143,11 +2149,11 @@ msgid "" "\"2\" through \"9\" representing the card with that value." msgstr "" -#: ../../library/re.rst:1591 +#: ../../library/re.rst:1597 msgid "To see if a given string is a valid hand, one could do the following::" msgstr "" -#: ../../library/re.rst:1593 +#: ../../library/re.rst:1599 msgid "" ">>> valid = re.compile(r\"^[a2-9tjqk]{5}$\")\n" ">>> displaymatch(valid.match(\"akt5q\")) # Valid.\n" @@ -2158,14 +2164,14 @@ msgid "" "\"\"" msgstr "" -#: ../../library/re.rst:1601 +#: ../../library/re.rst:1607 msgid "" "That last hand, ``\"727ak\"``, contained a pair, or two of the same valued " "cards. To match this with a regular expression, one could use backreferences " "as such::" msgstr "" -#: ../../library/re.rst:1604 +#: ../../library/re.rst:1610 msgid "" ">>> pair = re.compile(r\".*(.).*\\1\")\n" ">>> displaymatch(pair.match(\"717ak\")) # Pair of 7s.\n" @@ -2175,13 +2181,13 @@ msgid "" "\"\"" msgstr "" -#: ../../library/re.rst:1611 +#: ../../library/re.rst:1617 msgid "" "To find out what card the pair consists of, one could use the :meth:`~Match." "group` method of the match object in the following manner::" msgstr "" -#: ../../library/re.rst:1614 +#: ../../library/re.rst:1620 msgid "" ">>> pair = re.compile(r\".*(.).*\\1\")\n" ">>> pair.match(\"717ak\").group(1)\n" @@ -2199,11 +2205,11 @@ msgid "" "'a'" msgstr "" -#: ../../library/re.rst:1630 +#: ../../library/re.rst:1636 msgid "Simulating scanf()" msgstr "模擬 scanf()" -#: ../../library/re.rst:1634 +#: ../../library/re.rst:1640 msgid "" "Python does not currently have an equivalent to :c:func:`!scanf`. Regular " "expressions are generally more powerful, though also more verbose, than :c:" @@ -2212,130 +2218,130 @@ msgid "" "expressions." msgstr "" -#: ../../library/re.rst:1641 +#: ../../library/re.rst:1647 msgid ":c:func:`!scanf` Token" msgstr "" -#: ../../library/re.rst:1641 +#: ../../library/re.rst:1647 msgid "Regular Expression" msgstr "" -#: ../../library/re.rst:1643 +#: ../../library/re.rst:1649 msgid "``%c``" msgstr "``%c``" -#: ../../library/re.rst:1645 +#: ../../library/re.rst:1651 msgid "``%5c``" msgstr "``%5c``" -#: ../../library/re.rst:1645 +#: ../../library/re.rst:1651 msgid "``.{5}``" msgstr "``.{5}``" -#: ../../library/re.rst:1647 +#: ../../library/re.rst:1653 msgid "``%d``" msgstr "``%d``" -#: ../../library/re.rst:1647 +#: ../../library/re.rst:1653 msgid "``[-+]?\\d+``" msgstr "``[-+]?\\d+``" -#: ../../library/re.rst:1649 +#: ../../library/re.rst:1655 msgid "``%e``, ``%E``, ``%f``, ``%g``" msgstr "``%e``, ``%E``, ``%f``, ``%g``" -#: ../../library/re.rst:1649 +#: ../../library/re.rst:1655 msgid "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" msgstr "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" -#: ../../library/re.rst:1651 +#: ../../library/re.rst:1657 msgid "``%i``" msgstr "``%i``" -#: ../../library/re.rst:1651 +#: ../../library/re.rst:1657 msgid "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" msgstr "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" -#: ../../library/re.rst:1653 +#: ../../library/re.rst:1659 msgid "``%o``" msgstr "``%o``" -#: ../../library/re.rst:1653 +#: ../../library/re.rst:1659 msgid "``[-+]?[0-7]+``" msgstr "``[-+]?[0-7]+``" -#: ../../library/re.rst:1655 +#: ../../library/re.rst:1661 msgid "``%s``" msgstr "``%s``" -#: ../../library/re.rst:1655 +#: ../../library/re.rst:1661 msgid "``\\S+``" msgstr "``\\S+``" -#: ../../library/re.rst:1657 +#: ../../library/re.rst:1663 msgid "``%u``" msgstr "``%u``" -#: ../../library/re.rst:1657 +#: ../../library/re.rst:1663 msgid "``\\d+``" msgstr "``\\d+``" -#: ../../library/re.rst:1659 +#: ../../library/re.rst:1665 msgid "``%x``, ``%X``" msgstr "``%x``、``%X``" -#: ../../library/re.rst:1659 +#: ../../library/re.rst:1665 msgid "``[-+]?(0[xX])?[\\dA-Fa-f]+``" msgstr "``[-+]?(0[xX])?[\\dA-Fa-f]+``" -#: ../../library/re.rst:1662 +#: ../../library/re.rst:1668 msgid "To extract the filename and numbers from a string like ::" msgstr "" -#: ../../library/re.rst:1664 +#: ../../library/re.rst:1670 msgid "/usr/sbin/sendmail - 0 errors, 4 warnings" msgstr "/usr/sbin/sendmail - 0 errors, 4 warnings" -#: ../../library/re.rst:1666 +#: ../../library/re.rst:1672 msgid "you would use a :c:func:`!scanf` format like ::" msgstr "" -#: ../../library/re.rst:1668 +#: ../../library/re.rst:1674 msgid "%s - %d errors, %d warnings" msgstr "" -#: ../../library/re.rst:1670 +#: ../../library/re.rst:1676 msgid "The equivalent regular expression would be ::" msgstr "" -#: ../../library/re.rst:1672 +#: ../../library/re.rst:1678 msgid "(\\S+) - (\\d+) errors, (\\d+) warnings" msgstr "" -#: ../../library/re.rst:1678 +#: ../../library/re.rst:1684 msgid "search() vs. match()" msgstr "search() vs. match()" -#: ../../library/re.rst:1682 +#: ../../library/re.rst:1688 msgid "" "Python offers different primitive operations based on regular expressions:" msgstr "" -#: ../../library/re.rst:1684 +#: ../../library/re.rst:1690 msgid ":func:`re.match` checks for a match only at the beginning of the string" msgstr "" -#: ../../library/re.rst:1685 +#: ../../library/re.rst:1691 msgid "" ":func:`re.search` checks for a match anywhere in the string (this is what " "Perl does by default)" msgstr "" -#: ../../library/re.rst:1687 +#: ../../library/re.rst:1693 msgid ":func:`re.fullmatch` checks for entire string to be a match" msgstr "" -#: ../../library/re.rst:1692 +#: ../../library/re.rst:1698 msgid "" ">>> re.match(\"c\", \"abcdef\") # No match\n" ">>> re.search(\"c\", \"abcdef\") # Match\n" @@ -2345,13 +2351,13 @@ msgid "" ">>> re.fullmatch(\"r.*n\", \"python\") # No match" msgstr "" -#: ../../library/re.rst:1699 +#: ../../library/re.rst:1705 msgid "" "Regular expressions beginning with ``'^'`` can be used with :func:`search` " "to restrict the match at the beginning of the string::" msgstr "" -#: ../../library/re.rst:1702 +#: ../../library/re.rst:1708 msgid "" ">>> re.match(\"c\", \"abcdef\") # No match\n" ">>> re.search(\"^c\", \"abcdef\") # No match\n" @@ -2359,7 +2365,7 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1707 +#: ../../library/re.rst:1713 msgid "" "Note however that in :const:`MULTILINE` mode :func:`match` only matches at " "the beginning of the string, whereas using :func:`search` with a regular " @@ -2367,18 +2373,18 @@ msgid "" "line. ::" msgstr "" -#: ../../library/re.rst:1711 +#: ../../library/re.rst:1717 msgid "" ">>> re.match(\"X\", \"A\\nB\\nX\", re.MULTILINE) # No match\n" ">>> re.search(\"^X\", \"A\\nB\\nX\", re.MULTILINE) # Match\n" "" msgstr "" -#: ../../library/re.rst:1717 +#: ../../library/re.rst:1723 msgid "Making a Phonebook" msgstr "" -#: ../../library/re.rst:1719 +#: ../../library/re.rst:1725 msgid "" ":func:`split` splits a string into a list delimited by the passed pattern. " "The method is invaluable for converting textual data into data structures " @@ -2386,13 +2392,13 @@ msgid "" "following example that creates a phonebook." msgstr "" -#: ../../library/re.rst:1724 +#: ../../library/re.rst:1730 msgid "" "First, here is the input. Normally it may come from a file, here we are " "using triple-quoted string syntax" msgstr "" -#: ../../library/re.rst:1727 +#: ../../library/re.rst:1733 msgid "" ">>> text = \"\"\"Ross McFluff: 834.345.1254 155 Elm Street\n" "...\n" @@ -2410,13 +2416,13 @@ msgstr "" "...\n" "... Heather Albrecht: 548.326.4584 919 Park Place\"\"\"" -#: ../../library/re.rst:1737 +#: ../../library/re.rst:1743 msgid "" "The entries are separated by one or more newlines. Now we convert the string " "into a list with each nonempty line having its own entry:" msgstr "" -#: ../../library/re.rst:1740 +#: ../../library/re.rst:1746 msgid "" ">>> entries = re.split(\"\\n+\", text)\n" ">>> entries\n" @@ -2432,15 +2438,14 @@ msgstr "" "'Frank Burger: 925.541.7625 662 South Dogwood Way',\n" "'Heather Albrecht: 548.326.4584 919 Park Place']" -#: ../../library/re.rst:1750 +#: ../../library/re.rst:1756 msgid "" "Finally, split each entry into a list with first name, last name, telephone " "number, and address. We use the ``maxsplit`` parameter of :func:`split` " "because the address has spaces, our splitting pattern, in it:" msgstr "" -#: ../../library/re.rst:1754 -#, fuzzy +#: ../../library/re.rst:1760 msgid "" ">>> [re.split(\":? \", entry, maxsplit=3) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155 Elm Street'],\n" @@ -2448,21 +2453,20 @@ msgid "" "['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919 Park Place']]" msgstr "" -">>> [re.split(\":? \", entry, 3) for entry in entries]\n" +">>> [re.split(\":? \", entry, maxsplit=3) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155 Elm Street'],\n" "['Ronald', 'Heathmore', '892.345.3428', '436 Finley Avenue'],\n" "['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919 Park Place']]" -#: ../../library/re.rst:1763 +#: ../../library/re.rst:1769 msgid "" "The ``:?`` pattern matches the colon after the last name, so that it does " "not occur in the result list. With a ``maxsplit`` of ``4``, we could " "separate the house number from the street name:" msgstr "" -#: ../../library/re.rst:1767 -#, fuzzy +#: ../../library/re.rst:1773 msgid "" ">>> [re.split(\":? \", entry, maxsplit=4) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155', 'Elm Street'],\n" @@ -2470,17 +2474,17 @@ msgid "" "['Frank', 'Burger', '925.541.7625', '662', 'South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919', 'Park Place']]" msgstr "" -">>> [re.split(\":? \", entry, 4) for entry in entries]\n" +">>> [re.split(\":? \", entry, maxsplit=4) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155', 'Elm Street'],\n" "['Ronald', 'Heathmore', '892.345.3428', '436', 'Finley Avenue'],\n" "['Frank', 'Burger', '925.541.7625', '662', 'South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919', 'Park Place']]" -#: ../../library/re.rst:1778 +#: ../../library/re.rst:1784 msgid "Text Munging" msgstr "" -#: ../../library/re.rst:1780 +#: ../../library/re.rst:1786 msgid "" ":func:`sub` replaces every occurrence of a pattern with a string or the " "result of a function. This example demonstrates using :func:`sub` with a " @@ -2488,7 +2492,7 @@ msgid "" "each word of a sentence except for the first and last characters::" msgstr "" -#: ../../library/re.rst:1785 +#: ../../library/re.rst:1791 msgid "" ">>> def repl(m):\n" "... inner_word = list(m.group(2))\n" @@ -2512,11 +2516,11 @@ msgstr "" ">>> re.sub(r\"(\\w)(\\w+)(\\w)\", repl, text)\n" "'Pofsroser Aodlambelk, plasee reoprt yuor asnebces potlmrpy.'" -#: ../../library/re.rst:1798 +#: ../../library/re.rst:1804 msgid "Finding all Adverbs" msgstr "" -#: ../../library/re.rst:1800 +#: ../../library/re.rst:1806 msgid "" ":func:`findall` matches *all* occurrences of a pattern, not just the first " "one as :func:`search` does. For example, if a writer wanted to find all of " @@ -2524,7 +2528,7 @@ msgid "" "manner::" msgstr "" -#: ../../library/re.rst:1805 +#: ../../library/re.rst:1811 msgid "" ">>> text = \"He was carefully disguised but captured quickly by police.\"\n" ">>> re.findall(r\"\\w+ly\\b\", text)\n" @@ -2534,11 +2538,11 @@ msgstr "" ">>> re.findall(r\"\\w+ly\\b\", text)\n" "['carefully', 'quickly']" -#: ../../library/re.rst:1811 +#: ../../library/re.rst:1817 msgid "Finding all Adverbs and their Positions" msgstr "" -#: ../../library/re.rst:1813 +#: ../../library/re.rst:1819 msgid "" "If one wants more information about all matches of a pattern than the " "matched text, :func:`finditer` is useful as it provides :class:`~re.Match` " @@ -2547,7 +2551,7 @@ msgid "" "they would use :func:`finditer` in the following manner::" msgstr "" -#: ../../library/re.rst:1819 +#: ../../library/re.rst:1825 msgid "" ">>> text = \"He was carefully disguised but captured quickly by police.\"\n" ">>> for m in re.finditer(r\"\\w+ly\\b\", text):\n" @@ -2561,11 +2565,11 @@ msgstr "" "07-16: carefully\n" "40-47: quickly" -#: ../../library/re.rst:1827 +#: ../../library/re.rst:1833 msgid "Raw String Notation" msgstr "" -#: ../../library/re.rst:1829 +#: ../../library/re.rst:1835 msgid "" "Raw string notation (``r\"text\"``) keeps regular expressions sane. Without " "it, every backslash (``'\\'``) in a regular expression would have to be " @@ -2573,7 +2577,7 @@ msgid "" "lines of code are functionally identical::" msgstr "" -#: ../../library/re.rst:1834 +#: ../../library/re.rst:1840 msgid "" ">>> re.match(r\"\\W(.)\\1\\W\", \" ff \")\n" "\n" @@ -2585,7 +2589,7 @@ msgstr "" ">>> re.match(\"\\\\W(.)\\\\1\\\\W\", \" ff \")\n" "" -#: ../../library/re.rst:1839 +#: ../../library/re.rst:1845 msgid "" "When one wants to match a literal backslash, it must be escaped in the " "regular expression. With raw string notation, this means ``r\"\\\\\"``. " @@ -2593,7 +2597,7 @@ msgid "" "following lines of code functionally identical::" msgstr "" -#: ../../library/re.rst:1844 +#: ../../library/re.rst:1850 msgid "" ">>> re.match(r\"\\\\\", r\"\\\\\")\n" "\n" @@ -2605,25 +2609,25 @@ msgstr "" ">>> re.match(\"\\\\\\\\\", r\"\\\\\")\n" "" -#: ../../library/re.rst:1851 +#: ../../library/re.rst:1857 msgid "Writing a Tokenizer" msgstr "" -#: ../../library/re.rst:1853 +#: ../../library/re.rst:1859 msgid "" "A `tokenizer or scanner `_ " "analyzes a string to categorize groups of characters. This is a useful " "first step in writing a compiler or interpreter." msgstr "" -#: ../../library/re.rst:1857 +#: ../../library/re.rst:1863 msgid "" "The text categories are specified with regular expressions. The technique " "is to combine those into a single master regular expression and to loop over " "successive matches::" msgstr "" -#: ../../library/re.rst:1861 +#: ../../library/re.rst:1867 msgid "" "from typing import NamedTuple\n" "import re\n" @@ -2679,11 +2683,11 @@ msgid "" " print(token)" msgstr "" -#: ../../library/re.rst:1913 +#: ../../library/re.rst:1919 msgid "The tokenizer produces the following output::" msgstr "" -#: ../../library/re.rst:1915 +#: ../../library/re.rst:1921 msgid "" "Token(type='IF', value='IF', line=2, column=4)\n" "Token(type='ID', value='quantity', line=2, column=7)\n" @@ -2725,7 +2729,7 @@ msgstr "" "Token(type='ENDIF', value='ENDIF', line=5, column=4)\n" "Token(type='END', value=';', line=5, column=9)" -#: ../../library/re.rst:1936 +#: ../../library/re.rst:1942 msgid "" "Friedl, Jeffrey. Mastering Regular Expressions. 3rd ed., O'Reilly Media, " "2009. The third edition of the book no longer covers Python at all, but the " @@ -2747,10 +2751,10 @@ msgstr ". (點)" #: ../../library/re.rst:448 ../../library/re.rst:455 ../../library/re.rst:462 #: ../../library/re.rst:489 ../../library/re.rst:499 ../../library/re.rst:522 #: ../../library/re.rst:534 ../../library/re.rst:539 ../../library/re.rst:561 -#: ../../library/re.rst:575 ../../library/re.rst:591 ../../library/re.rst:599 -#: ../../library/re.rst:613 ../../library/re.rst:621 ../../library/re.rst:638 -#: ../../library/re.rst:652 ../../library/re.rst:657 ../../library/re.rst:848 -#: ../../library/re.rst:1084 +#: ../../library/re.rst:581 ../../library/re.rst:597 ../../library/re.rst:605 +#: ../../library/re.rst:619 ../../library/re.rst:627 ../../library/re.rst:644 +#: ../../library/re.rst:658 ../../library/re.rst:663 ../../library/re.rst:854 +#: ../../library/re.rst:1090 msgid "in regular expressions" msgstr "於正規表示式中" @@ -2866,7 +2870,7 @@ msgstr "(?(" msgid "\\A" msgstr "\\A" -#: ../../library/re.rst:539 ../../library/re.rst:657 +#: ../../library/re.rst:539 ../../library/re.rst:663 msgid "\\b" msgstr "\\b" @@ -2874,87 +2878,87 @@ msgstr "\\b" msgid "\\B" msgstr "\\B" -#: ../../library/re.rst:575 +#: ../../library/re.rst:581 msgid "\\d" msgstr "\\d" -#: ../../library/re.rst:591 +#: ../../library/re.rst:597 msgid "\\D" msgstr "\\D" -#: ../../library/re.rst:599 +#: ../../library/re.rst:605 msgid "\\s" msgstr "\\s" -#: ../../library/re.rst:613 +#: ../../library/re.rst:619 msgid "\\S" msgstr "\\S" -#: ../../library/re.rst:621 +#: ../../library/re.rst:627 msgid "\\w" msgstr "\\w" -#: ../../library/re.rst:638 +#: ../../library/re.rst:644 msgid "\\W" msgstr "\\W" -#: ../../library/re.rst:652 +#: ../../library/re.rst:658 msgid "\\Z" msgstr "\\Z" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\a" msgstr "\\a" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\f" msgstr "\\f" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\n" msgstr "\\n" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\N" msgstr "\\N" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\r" msgstr "\\r" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\t" msgstr "\\t" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\u" msgstr "\\u" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\U" msgstr "\\U" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\v" msgstr "\\v" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\x" msgstr "\\x" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\\\" msgstr "\\\\" -#: ../../library/re.rst:848 +#: ../../library/re.rst:854 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/re.rst:1084 +#: ../../library/re.rst:1090 msgid "\\g" msgstr "\\g" -#: ../../library/re.rst:1632 +#: ../../library/re.rst:1638 msgid "scanf (C function)" msgstr "scanf(C 函式)" diff --git a/library/readline.po b/library/readline.po index 258923d199..40b729b026 100644 --- a/library/readline.po +++ b/library/readline.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,17 +43,17 @@ msgid "" "general." msgstr "" -#: ../../includes/wasm-ios-notavail.rst:3 -msgid ":ref:`Availability `: not WASI, not iOS." -msgstr "" +#: ../../includes/wasm-mobile-notavail.rst:3 +msgid ":ref:`Availability `: not Android, not iOS, not WASI." +msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" -#: ../../includes/wasm-ios-notavail.rst:5 +#: ../../includes/wasm-mobile-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms, or " -"on iOS. See :ref:`wasm-availability` for more information on WASM " -"availability; see :ref:`iOS-availability` for more information on iOS " -"availability." +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" +"此模組在\\ :ref:`行動平台 `\\ 或\\ :ref:`WebAssembly 平" +"台 `\\ 上不支援。" #: ../../library/readline.rst:31 msgid "" diff --git a/library/select.po b/library/select.po index 9c9f95c416..17c60cfe83 100644 --- a/library/select.po +++ b/library/select.po @@ -42,18 +42,16 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -#, fuzzy msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:Unix。" +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/select.rst:27 msgid "The module defines the following:" diff --git a/library/selectors.po b/library/selectors.po index 4ef9e9b455..bf3bb5b888 100644 --- a/library/selectors.po +++ b/library/selectors.po @@ -71,16 +71,15 @@ msgstr "" #: ../../includes/wasm-notavail.rst:3 msgid ":ref:`Availability `: not WASI." -msgstr "" +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/selectors.rst:44 msgid "Classes" diff --git a/library/smtplib.po b/library/smtplib.po index 1f438f383e..b3e25996f0 100644 --- a/library/smtplib.po +++ b/library/smtplib.po @@ -36,16 +36,15 @@ msgstr "" #: ../../includes/wasm-notavail.rst:3 msgid ":ref:`Availability `: not WASI." -msgstr "" +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/smtplib.rst:26 msgid "" diff --git a/library/sndhdr.po b/library/sndhdr.po deleted file mode 100644 index 13eead7a74..0000000000 --- a/library/sndhdr.po +++ /dev/null @@ -1,231 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -# Liang-Bo Wang , 2015 -# Matt Wang , 2021 -# -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" -"PO-Revision-Date: 2022-06-11 15:40+0800\n" -"Last-Translator: Matt Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.1\n" - -#: ../../library/sndhdr.rst:2 -msgid ":mod:`sndhdr` --- Determine type of sound file" -msgstr ":mod:`sndhdr` --- 判定聲音檔案的型別" - -#: ../../library/sndhdr.rst:11 -msgid "**Source code:** :source:`Lib/sndhdr.py`" -msgstr "**原始碼:**\\ :source:`Lib/sndhdr.py`" - -#: ../../library/sndhdr.rst:17 -msgid "" -"The :mod:`sndhdr` module is deprecated (see :pep:`PEP 594 <594#sndhdr>` for " -"details and alternatives)." -msgstr "" -":mod:`sndhdr` 模組 (module) 即將被棄用(詳情與替代方案請見 :pep:`PEP 594 " -"<594#sndhdr>`)。" - -#: ../../library/sndhdr.rst:23 -msgid "" -"The :mod:`sndhdr` provides utility functions which attempt to determine the " -"type of sound data which is in a file. When these functions are able to " -"determine what type of sound data is stored in a file, they return a :func:" -"`~collections.namedtuple`, containing five attributes: (``filetype``, " -"``framerate``, ``nchannels``, ``nframes``, ``sampwidth``). The value for " -"*type* indicates the data type and will be one of the strings ``'aifc'``, " -"``'aiff'``, ``'au'``, ``'hcom'``, ``'sndr'``, ``'sndt'``, ``'voc'``, " -"``'wav'``, ``'8svx'``, ``'sb'``, ``'ub'``, or ``'ul'``. The *sampling_rate* " -"will be either the actual value or ``0`` if unknown or difficult to decode. " -"Similarly, *channels* will be either the number of channels or ``0`` if it " -"cannot be determined or if the value is difficult to decode. The value for " -"*frames* will be either the number of frames or ``-1``. The last item in " -"the tuple, *bits_per_sample*, will either be the sample size in bits or " -"``'A'`` for A-LAW or ``'U'`` for u-LAW." -msgstr "" -":mod:`sndhdr` 提供了企圖猜測檔案中聲音資料型別的工具函式。當這些函式可以推測" -"出儲存在檔案中聲音資料的型別,它們分別回傳一個 :func:`collections." -"namedtuple`,包含了五種屬性:(``filetype``、``framerate``、``nchannels``、" -"``nframes``、``sampwidth``)。這些 *type* 的值表示資料的型別,會是以下字串之" -"一:``'aifc'``、``'aiff'``、``'au'``、``'hcom'``、``'sndr'``、``'sndt'``、" -"``'voc'``、``'wav'``、``'8svx'``、``'sb'``、``'ub'`` 或 ``'ul'``。" -"*sampling_rate*\\ (取樣頻率)可能是實際值、或者當未知或者難以解碼時為 " -"``0``。同樣的,*channels*\\ (影像通道數)也會回傳實際值或者在無法推測或難以" -"解碼時回傳 ``0``。*frames*\\ (幀數)則是實際值或 ``-1``。tuple 的最後一項," -"*bits_per_sample* 為位元表示的取樣大小,或者在 A-LAW 時為 ``'A'``,u-LAW 時" -"為 ``'U'``。" - -#: ../../library/sndhdr.rst:40 -msgid "" -"Determines the type of sound data stored in the file *filename* using :func:" -"`whathdr`. If it succeeds, returns a namedtuple as described above, " -"otherwise ``None`` is returned." -msgstr "" -"使用 :func:`whathdr` 推測儲存在 *filename* 檔案中聲音資料的型別。如果成功,回" -"傳上述的 namedtuple(附名元組),否則回傳 ``None``。" - -#: ../../library/sndhdr.rst:44 ../../library/sndhdr.rst:54 -msgid "Result changed from a tuple to a namedtuple." -msgstr "結果從 tuple 改為 namedtuple。" - -#: ../../library/sndhdr.rst:50 -msgid "" -"Determines the type of sound data stored in a file based on the file " -"header. The name of the file is given by *filename*. This function returns " -"a namedtuple as described above on success, or ``None``." -msgstr "" -"根據檔案標頭 (header) 推測儲存在檔案中的聲音資料型別。檔名由 *filename* 給" -"定。這個函式在成功時回傳上述 namedtuple,或在失敗時回傳 ``None``。" - -#: ../../library/sndhdr.rst:57 -msgid "" -"The following sound header types are recognized, as listed below with the " -"return value from :func:`whathdr`: and :func:`what`:" -msgstr "" - -#: ../../library/sndhdr.rst:61 -msgid "Value" -msgstr "" - -#: ../../library/sndhdr.rst:61 -msgid "Sound header format" -msgstr "" - -#: ../../library/sndhdr.rst:63 -msgid "``'aifc'``" -msgstr "``'aifc'``" - -#: ../../library/sndhdr.rst:63 -msgid "Compressed Audio Interchange Files" -msgstr "" - -#: ../../library/sndhdr.rst:65 -msgid "``'aiff'``" -msgstr "``'aiff'``" - -#: ../../library/sndhdr.rst:65 -msgid "Audio Interchange Files" -msgstr "" - -#: ../../library/sndhdr.rst:67 -msgid "``'au'``" -msgstr "``'au'``" - -#: ../../library/sndhdr.rst:67 -msgid "Au Files" -msgstr "Au 檔案" - -#: ../../library/sndhdr.rst:69 -msgid "``'hcom'``" -msgstr "``'hcom'``" - -#: ../../library/sndhdr.rst:69 -msgid "HCOM Files" -msgstr "HCOM 檔案" - -#: ../../library/sndhdr.rst:71 -msgid "``'sndt'``" -msgstr "``'sndt'``" - -#: ../../library/sndhdr.rst:71 -msgid "Sndtool Sound Files" -msgstr "" - -#: ../../library/sndhdr.rst:73 -msgid "``'voc'``" -msgstr "``'voc'``" - -#: ../../library/sndhdr.rst:73 -msgid "Creative Labs Audio Files" -msgstr "" - -#: ../../library/sndhdr.rst:75 -msgid "``'wav'``" -msgstr "``'wav'``" - -#: ../../library/sndhdr.rst:75 -msgid "Waveform Audio File Format Files" -msgstr "" - -#: ../../library/sndhdr.rst:77 -msgid "``'8svx'``" -msgstr "``'8svx'``" - -#: ../../library/sndhdr.rst:77 -msgid "8-Bit Sampled Voice Files" -msgstr "" - -#: ../../library/sndhdr.rst:79 -msgid "``'sb'``" -msgstr "``'sb'``" - -#: ../../library/sndhdr.rst:79 -msgid "Signed Byte Audio Data Files" -msgstr "" - -#: ../../library/sndhdr.rst:81 -msgid "``'ub'``" -msgstr "``'ub'``" - -#: ../../library/sndhdr.rst:81 -msgid "UB Files" -msgstr "UB 檔案" - -#: ../../library/sndhdr.rst:83 -msgid "``'ul'``" -msgstr "``'ul'``" - -#: ../../library/sndhdr.rst:83 -msgid "uLAW Audio Files" -msgstr "uLAW 音檔" - -#: ../../library/sndhdr.rst:88 -msgid "" -"A list of functions performing the individual tests. Each function takes " -"two arguments: the byte-stream and an open file-like object. When :func:" -"`what` is called with a byte-stream, the file-like object will be ``None``." -msgstr "" - -#: ../../library/sndhdr.rst:92 -msgid "" -"The test function should return a string describing the image type if the " -"test succeeded, or ``None`` if it failed." -msgstr "" - -#: ../../library/sndhdr.rst:95 -msgid "Example:" -msgstr "範例:" - -#: ../../library/sndhdr.rst:97 -msgid "" -">>> import sndhdr\n" -">>> imghdr.what('bass.wav')\n" -"'wav'\n" -">>> imghdr.whathdr('bass.wav')\n" -"'wav'" -msgstr "" -">>> import sndhdr\n" -">>> imghdr.what('bass.wav')\n" -"'wav'\n" -">>> imghdr.whathdr('bass.wav')\n" -"'wav'" - -#: ../../library/sndhdr.rst:13 -msgid "A-LAW" -msgstr "A-LAW" - -#: ../../library/sndhdr.rst:13 -msgid "u-LAW" -msgstr "u-LAW" diff --git a/library/socket.po b/library/socket.po index d365183971..9d99c82d2a 100644 --- a/library/socket.po +++ b/library/socket.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,13 +51,12 @@ msgid ":ref:`Availability `: not WASI." msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/socket.rst:24 msgid "" @@ -1552,10 +1551,10 @@ msgstr "" "引發一個附帶引數 ``name`` 的\\ :ref:`稽核事件 ` ``socket." "sethostname``。" -#: ../../library/socket.rst:1275 ../../library/socket.rst:1715 -#: ../../library/socket.rst:1759 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" +#: ../../library/socket.rst:1275 +#, fuzzy +msgid ":ref:`Availability `: Unix, not Android." +msgstr ":ref:`適用 `:Unix、非 WASI。" #: ../../library/socket.rst:1282 msgid "" @@ -2018,6 +2017,10 @@ msgid "" " return msg, list(fds)" msgstr "" +#: ../../library/socket.rst:1715 ../../library/socket.rst:1759 +msgid ":ref:`Availability `: Unix." +msgstr ":ref:`適用 `:Unix。" + #: ../../library/socket.rst:1729 msgid "" "Receive normal data and ancillary data from the socket, behaving as :meth:" diff --git a/library/socketserver.po b/library/socketserver.po index 656edd79ce..ac01c1ed20 100644 --- a/library/socketserver.po +++ b/library/socketserver.po @@ -33,16 +33,15 @@ msgstr "" #: ../../includes/wasm-notavail.rst:3 msgid ":ref:`Availability `: not WASI." -msgstr "" +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/socketserver.rst:15 msgid "There are four basic concrete server classes:" diff --git a/library/spwd.po b/library/spwd.po deleted file mode 100644 index 3a1dae13ce..0000000000 --- a/library/spwd.po +++ /dev/null @@ -1,226 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" -"PO-Revision-Date: 2022-05-22 02:14+0800\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/spwd.rst:2 -msgid ":mod:`spwd` --- The shadow password database" -msgstr ":mod:`spwd` --- shadow 密碼資料庫" - -#: ../../library/spwd.rst:9 -msgid "" -"The :mod:`spwd` module is deprecated (see :pep:`PEP 594 <594#spwd>` for " -"details and alternatives)." -msgstr "" -":mod:`spwd` 模組 (module) 即將被棄用(詳情與替代方案請見 :pep:`PEP 594 " -"<594#spwd>`\\ )。" - -#: ../../library/spwd.rst:15 -msgid "" -"This module provides access to the Unix shadow password database. It is " -"available on various Unix versions." -msgstr "" - -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: ../../includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" - -#: ../../library/spwd.rst:20 -msgid "" -"You must have enough privileges to access the shadow password database (this " -"usually means you have to be root)." -msgstr "" - -#: ../../library/spwd.rst:23 -msgid "" -"Shadow password database entries are reported as a tuple-like object, whose " -"attributes correspond to the members of the ``spwd`` structure (Attribute " -"field below, see ````):" -msgstr "" - -#: ../../library/spwd.rst:28 -msgid "Index" -msgstr "" - -#: ../../library/spwd.rst:28 -msgid "Attribute" -msgstr "屬性" - -#: ../../library/spwd.rst:28 -msgid "Meaning" -msgstr "含義" - -#: ../../library/spwd.rst:30 -msgid "0" -msgstr "0" - -#: ../../library/spwd.rst:30 -msgid "``sp_namp``" -msgstr "``sp_namp``" - -#: ../../library/spwd.rst:30 -msgid "Login name" -msgstr "" - -#: ../../library/spwd.rst:32 -msgid "1" -msgstr "1" - -#: ../../library/spwd.rst:32 -msgid "``sp_pwdp``" -msgstr "``sp_pwdp``" - -#: ../../library/spwd.rst:32 -msgid "Encrypted password" -msgstr "" - -#: ../../library/spwd.rst:34 -msgid "2" -msgstr "2" - -#: ../../library/spwd.rst:34 -msgid "``sp_lstchg``" -msgstr "``sp_lstchg``" - -#: ../../library/spwd.rst:34 -msgid "Date of last change" -msgstr "" - -#: ../../library/spwd.rst:36 -msgid "3" -msgstr "3" - -#: ../../library/spwd.rst:36 -msgid "``sp_min``" -msgstr "``sp_min``" - -#: ../../library/spwd.rst:36 -msgid "Minimal number of days between changes" -msgstr "" - -#: ../../library/spwd.rst:39 -msgid "4" -msgstr "4" - -#: ../../library/spwd.rst:39 -msgid "``sp_max``" -msgstr "``sp_max``" - -#: ../../library/spwd.rst:39 -msgid "Maximum number of days between changes" -msgstr "" - -#: ../../library/spwd.rst:42 -msgid "5" -msgstr "5" - -#: ../../library/spwd.rst:42 -msgid "``sp_warn``" -msgstr "``sp_warn``" - -#: ../../library/spwd.rst:42 -msgid "Number of days before password expires to warn user about it" -msgstr "" - -#: ../../library/spwd.rst:45 -msgid "6" -msgstr "6" - -#: ../../library/spwd.rst:45 -msgid "``sp_inact``" -msgstr "``sp_inact``" - -#: ../../library/spwd.rst:45 -msgid "Number of days after password expires until account is disabled" -msgstr "" - -#: ../../library/spwd.rst:49 -msgid "7" -msgstr "7" - -#: ../../library/spwd.rst:49 -msgid "``sp_expire``" -msgstr "``sp_expire``" - -#: ../../library/spwd.rst:49 -msgid "Number of days since 1970-01-01 when account expires" -msgstr "" - -#: ../../library/spwd.rst:52 -msgid "8" -msgstr "8" - -#: ../../library/spwd.rst:52 -msgid "``sp_flag``" -msgstr "``sp_flag``" - -#: ../../library/spwd.rst:52 -msgid "Reserved" -msgstr "" - -#: ../../library/spwd.rst:55 -msgid "" -"The sp_namp and sp_pwdp items are strings, all others are integers. :exc:" -"`KeyError` is raised if the entry asked for cannot be found." -msgstr "" - -#: ../../library/spwd.rst:58 -msgid "The following functions are defined:" -msgstr "" - -#: ../../library/spwd.rst:63 -msgid "Return the shadow password database entry for the given user name." -msgstr "" - -#: ../../library/spwd.rst:65 -msgid "" -"Raises a :exc:`PermissionError` instead of :exc:`KeyError` if the user " -"doesn't have privileges." -msgstr "" - -#: ../../library/spwd.rst:71 -msgid "" -"Return a list of all available shadow password database entries, in " -"arbitrary order." -msgstr "" - -#: ../../library/spwd.rst:77 -msgid "Module :mod:`grp`" -msgstr ":mod:`grp` 模組" - -#: ../../library/spwd.rst:78 -msgid "An interface to the group database, similar to this." -msgstr "" - -#: ../../library/spwd.rst:80 -msgid "Module :mod:`pwd`" -msgstr ":mod:`pwd` 模組" - -#: ../../library/spwd.rst:81 -msgid "An interface to the normal password database, similar to this." -msgstr "" diff --git a/library/sqlite3.po b/library/sqlite3.po index 547e4c0846..05aaa3758b 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -356,7 +356,7 @@ msgstr ":ref:`sqlite3-adapters`" msgid ":ref:`sqlite3-converters`" msgstr ":ref:`sqlite3-converters`" -#: ../../library/sqlite3.rst:244 ../../library/sqlite3.rst:616 +#: ../../library/sqlite3.rst:244 ../../library/sqlite3.rst:615 msgid ":ref:`sqlite3-connection-context-manager`" msgstr ":ref:`sqlite3-connection-context-manager`" @@ -723,8 +723,8 @@ msgid "SQLite threading mode" msgstr "" #: ../../library/sqlite3.rst:529 -msgid "`threadsafety`_" -msgstr "`threadsafety`_" +msgid ":pep:`threadsafety <0249#threadsafety>`" +msgstr "" #: ../../library/sqlite3.rst:529 msgid "`SQLITE_THREADSAFE`_" @@ -774,106 +774,106 @@ msgstr "3" msgid "Threads may share the module, connections and cursors" msgstr "" -#: ../../library/sqlite3.rst:545 +#: ../../library/sqlite3.rst:544 msgid "Set *threadsafety* dynamically instead of hard-coding it to ``1``." msgstr "" -#: ../../library/sqlite3.rst:550 +#: ../../library/sqlite3.rst:549 msgid "" "Version number of this module as a :class:`string `. This is not the " "version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:553 ../../library/sqlite3.rst:563 +#: ../../library/sqlite3.rst:552 ../../library/sqlite3.rst:562 msgid "" "This constant used to reflect the version number of the ``pysqlite`` " "package, a third-party library which used to upstream changes to :mod:`!" "sqlite3`. Today, it carries no meaning or practical value." msgstr "" -#: ../../library/sqlite3.rst:560 +#: ../../library/sqlite3.rst:559 msgid "" "Version number of this module as a :class:`tuple` of :class:`integers " "`. This is not the version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:587 +#: ../../library/sqlite3.rst:586 msgid "" "These constants are used for the :meth:`Connection.setconfig` and :meth:" "`~Connection.getconfig` methods." msgstr "" -#: ../../library/sqlite3.rst:590 +#: ../../library/sqlite3.rst:589 msgid "" "The availability of these constants varies depending on the version of " "SQLite Python was compiled with." msgstr "" -#: ../../library/sqlite3.rst:597 +#: ../../library/sqlite3.rst:596 msgid "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" msgstr "" -#: ../../library/sqlite3.rst:598 +#: ../../library/sqlite3.rst:597 msgid "SQLite docs: Database Connection Configuration Options" msgstr "" -#: ../../library/sqlite3.rst:604 +#: ../../library/sqlite3.rst:603 msgid "Connection objects" msgstr "Connection 物件" -#: ../../library/sqlite3.rst:608 +#: ../../library/sqlite3.rst:607 msgid "" "Each open SQLite database is represented by a ``Connection`` object, which " "is created using :func:`sqlite3.connect`. Their main purpose is creating :" "class:`Cursor` objects, and :ref:`sqlite3-controlling-transactions`." msgstr "" -#: ../../library/sqlite3.rst:615 +#: ../../library/sqlite3.rst:614 msgid ":ref:`sqlite3-connection-shortcuts`" msgstr ":ref:`sqlite3-connection-shortcuts`" -#: ../../library/sqlite3.rst:621 +#: ../../library/sqlite3.rst:620 msgid "" "A :exc:`ResourceWarning` is emitted if :meth:`close` is not called before a :" "class:`!Connection` object is deleted." msgstr "" -#: ../../library/sqlite3.rst:624 +#: ../../library/sqlite3.rst:623 msgid "An SQLite database connection has the following attributes and methods:" msgstr "" -#: ../../library/sqlite3.rst:628 +#: ../../library/sqlite3.rst:627 msgid "" "Create and return a :class:`Cursor` object. The cursor method accepts a " "single optional parameter *factory*. If supplied, this must be a :term:" "`callable` returning an instance of :class:`Cursor` or its subclasses." msgstr "" -#: ../../library/sqlite3.rst:635 +#: ../../library/sqlite3.rst:634 msgid "" "Open a :class:`Blob` handle to an existing :abbr:`BLOB (Binary Large " "OBject)`." msgstr "" -#: ../../library/sqlite3.rst:638 +#: ../../library/sqlite3.rst:637 msgid "The name of the table where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:641 +#: ../../library/sqlite3.rst:640 msgid "The name of the column where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:644 +#: ../../library/sqlite3.rst:643 msgid "The name of the row where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:647 +#: ../../library/sqlite3.rst:646 msgid "" "Set to ``True`` if the blob should be opened without write permissions. " "Defaults to ``False``." msgstr "" -#: ../../library/sqlite3.rst:652 +#: ../../library/sqlite3.rst:651 msgid "" "The name of the database where the blob is located. Defaults to ``\"main\"``." msgstr "" @@ -882,17 +882,17 @@ msgstr "" msgid "Raises" msgstr "" -#: ../../library/sqlite3.rst:656 +#: ../../library/sqlite3.rst:655 msgid "When trying to open a blob in a ``WITHOUT ROWID`` table." msgstr "" -#: ../../library/sqlite3.rst:663 +#: ../../library/sqlite3.rst:662 msgid "" "The blob size cannot be changed using the :class:`Blob` class. Use the SQL " "function ``zeroblob`` to create a blob with a fixed size." msgstr "" -#: ../../library/sqlite3.rst:670 +#: ../../library/sqlite3.rst:669 msgid "" "Commit any pending transaction to the database. If :attr:`autocommit` is " "``True``, or there is no open transaction, this method does nothing. If :" @@ -900,7 +900,7 @@ msgid "" "pending transaction was committed by this method." msgstr "" -#: ../../library/sqlite3.rst:678 +#: ../../library/sqlite3.rst:677 msgid "" "Roll back to the start of any pending transaction. If :attr:`autocommit` is " "``True``, or there is no open transaction, this method does nothing. If :" @@ -908,7 +908,7 @@ msgid "" "pending transaction was rolled back by this method." msgstr "" -#: ../../library/sqlite3.rst:686 +#: ../../library/sqlite3.rst:685 msgid "" "Close the database connection. If :attr:`autocommit` is ``False``, any " "pending transaction is implicitly rolled back. If :attr:`!autocommit` is " @@ -917,63 +917,63 @@ msgid "" "losing pending changes." msgstr "" -#: ../../library/sqlite3.rst:696 +#: ../../library/sqlite3.rst:695 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.execute` on it " "with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:702 +#: ../../library/sqlite3.rst:701 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executemany` on " "it with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:708 +#: ../../library/sqlite3.rst:707 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executescript` " "on it with the given *sql_script*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:714 +#: ../../library/sqlite3.rst:713 msgid "Create or remove a user-defined SQL function." msgstr "" -#: ../../library/sqlite3.rst:716 +#: ../../library/sqlite3.rst:715 msgid "The name of the SQL function." msgstr "" -#: ../../library/sqlite3.rst:719 +#: ../../library/sqlite3.rst:718 msgid "" "The number of arguments the SQL function can accept. If ``-1``, it may take " "any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:723 +#: ../../library/sqlite3.rst:722 msgid "" "A :term:`callable` that is called when the SQL function is invoked. The " "callable must return :ref:`a type natively supported by SQLite `. Set to ``None`` to remove an existing SQL function." msgstr "" -#: ../../library/sqlite3.rst:730 +#: ../../library/sqlite3.rst:729 msgid "" "If ``True``, the created SQL function is marked as `deterministic `_, which allows SQLite to perform additional " "optimizations." msgstr "" -#: ../../library/sqlite3.rst:735 +#: ../../library/sqlite3.rst:734 msgid "Added the *deterministic* parameter." msgstr "新增 *deterministic* 參數。" -#: ../../library/sqlite3.rst:738 ../../library/sqlite3.rst:782 -#: ../../library/sqlite3.rst:850 ../../library/sqlite3.rst:1129 -#: ../../library/sqlite3.rst:1551 ../../library/sqlite3.rst:1594 +#: ../../library/sqlite3.rst:737 ../../library/sqlite3.rst:781 +#: ../../library/sqlite3.rst:849 ../../library/sqlite3.rst:1128 +#: ../../library/sqlite3.rst:1550 ../../library/sqlite3.rst:1593 msgid "Example:" msgstr "範例:" -#: ../../library/sqlite3.rst:740 +#: ../../library/sqlite3.rst:739 msgid "" ">>> import hashlib\n" ">>> def md5sum(t):\n" @@ -995,27 +995,27 @@ msgstr "" "('acbd18db4cc2f85cedef654fccc4a4d8',)\n" ">>> con.close()" -#: ../../library/sqlite3.rst:754 +#: ../../library/sqlite3.rst:753 msgid "" "Passing *name*, *narg*, and *func* as keyword arguments is deprecated. These " "parameters will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:760 +#: ../../library/sqlite3.rst:759 msgid "Create or remove a user-defined SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:762 +#: ../../library/sqlite3.rst:761 msgid "The name of the SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:765 +#: ../../library/sqlite3.rst:764 msgid "" "The number of arguments the SQL aggregate function can accept. If ``-1``, it " "may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:769 +#: ../../library/sqlite3.rst:768 msgid "" "A class must implement the following methods: * ``step()``: Add a row to " "the aggregate. * ``finalize()``: Return the final result of the aggregate " @@ -1024,31 +1024,31 @@ msgid "" "*n_arg*. Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:770 +#: ../../library/sqlite3.rst:769 msgid "A class must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:772 +#: ../../library/sqlite3.rst:771 msgid "``step()``: Add a row to the aggregate." msgstr "" -#: ../../library/sqlite3.rst:773 ../../library/sqlite3.rst:834 +#: ../../library/sqlite3.rst:772 ../../library/sqlite3.rst:833 msgid "" "``finalize()``: Return the final result of the aggregate as :ref:`a type " "natively supported by SQLite `." msgstr "" -#: ../../library/sqlite3.rst:776 +#: ../../library/sqlite3.rst:775 msgid "" "The number of arguments that the ``step()`` method must accept is controlled " "by *n_arg*." msgstr "" -#: ../../library/sqlite3.rst:779 +#: ../../library/sqlite3.rst:778 msgid "Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:784 +#: ../../library/sqlite3.rst:783 msgid "" "class MySum:\n" " def __init__(self):\n" @@ -1090,27 +1090,27 @@ msgstr "" "\n" "con.close()" -#: ../../library/sqlite3.rst:813 +#: ../../library/sqlite3.rst:812 msgid "" "Passing *name*, *n_arg*, and *aggregate_class* as keyword arguments is " "deprecated. These parameters will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:819 +#: ../../library/sqlite3.rst:818 msgid "Create or remove a user-defined aggregate window function." msgstr "" -#: ../../library/sqlite3.rst:821 +#: ../../library/sqlite3.rst:820 msgid "The name of the SQL aggregate window function to create or remove." msgstr "" -#: ../../library/sqlite3.rst:824 +#: ../../library/sqlite3.rst:823 msgid "" "The number of arguments the SQL aggregate window function can accept. If " "``-1``, it may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:828 +#: ../../library/sqlite3.rst:827 msgid "" "A class that must implement the following methods: * ``step()``: Add a row " "to the current window. * ``value()``: Return the current value of the " @@ -1122,39 +1122,39 @@ msgid "" "function." msgstr "" -#: ../../library/sqlite3.rst:829 +#: ../../library/sqlite3.rst:828 msgid "A class that must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:831 +#: ../../library/sqlite3.rst:830 msgid "``step()``: Add a row to the current window." msgstr "" -#: ../../library/sqlite3.rst:832 +#: ../../library/sqlite3.rst:831 msgid "``value()``: Return the current value of the aggregate." msgstr "" -#: ../../library/sqlite3.rst:833 +#: ../../library/sqlite3.rst:832 msgid "``inverse()``: Remove a row from the current window." msgstr "" -#: ../../library/sqlite3.rst:837 +#: ../../library/sqlite3.rst:836 msgid "" "The number of arguments that the ``step()`` and ``value()`` methods must " "accept is controlled by *num_params*." msgstr "" -#: ../../library/sqlite3.rst:840 +#: ../../library/sqlite3.rst:839 msgid "Set to ``None`` to remove an existing SQL aggregate window function." msgstr "" -#: ../../library/sqlite3.rst:842 +#: ../../library/sqlite3.rst:841 msgid "" "If used with a version of SQLite older than 3.25.0, which does not support " "aggregate window functions." msgstr "" -#: ../../library/sqlite3.rst:852 +#: ../../library/sqlite3.rst:851 msgid "" "# Example taken from https://www.sqlite.org/windowfunctions.html#udfwinfunc\n" "class WindowSumInt:\n" @@ -1202,30 +1202,30 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:906 +#: ../../library/sqlite3.rst:905 msgid "" "Create a collation named *name* using the collating function *callable*. " "*callable* is passed two :class:`string ` arguments, and it should " "return an :class:`integer `:" msgstr "" -#: ../../library/sqlite3.rst:910 +#: ../../library/sqlite3.rst:909 msgid "``1`` if the first is ordered higher than the second" msgstr "" -#: ../../library/sqlite3.rst:911 +#: ../../library/sqlite3.rst:910 msgid "``-1`` if the first is ordered lower than the second" msgstr "" -#: ../../library/sqlite3.rst:912 +#: ../../library/sqlite3.rst:911 msgid "``0`` if they are ordered equal" msgstr "" -#: ../../library/sqlite3.rst:914 +#: ../../library/sqlite3.rst:913 msgid "The following example shows a reverse sorting collation:" msgstr "" -#: ../../library/sqlite3.rst:916 +#: ../../library/sqlite3.rst:915 msgid "" "def collate_reverse(string1, string2):\n" " if string1 == string2:\n" @@ -1263,24 +1263,24 @@ msgstr "" " print(row)\n" "con.close()" -#: ../../library/sqlite3.rst:942 +#: ../../library/sqlite3.rst:941 msgid "Remove a collation function by setting *callable* to ``None``." msgstr "" -#: ../../library/sqlite3.rst:944 +#: ../../library/sqlite3.rst:943 msgid "" "The collation name can contain any Unicode character. Earlier, only ASCII " "characters were allowed." msgstr "" -#: ../../library/sqlite3.rst:951 +#: ../../library/sqlite3.rst:950 msgid "" "Call this method from a different thread to abort any queries that might be " "executing on the connection. Aborted queries will raise an :exc:" "`OperationalError`." msgstr "" -#: ../../library/sqlite3.rst:958 +#: ../../library/sqlite3.rst:957 msgid "" "Register :term:`callable` *authorizer_callback* to be invoked for each " "attempt to access a column of a table in the database. The callback should " @@ -1289,7 +1289,7 @@ msgid "" "underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:965 +#: ../../library/sqlite3.rst:964 msgid "" "The first argument to the callback signifies what kind of operation is to be " "authorized. The second and third argument will be arguments or ``None`` " @@ -1299,7 +1299,7 @@ msgid "" "attempt or ``None`` if this access attempt is directly from input SQL code." msgstr "" -#: ../../library/sqlite3.rst:972 +#: ../../library/sqlite3.rst:971 msgid "" "Please consult the SQLite documentation about the possible values for the " "first argument and the meaning of the second and third argument depending on " @@ -1307,21 +1307,21 @@ msgid "" "module." msgstr "" -#: ../../library/sqlite3.rst:976 +#: ../../library/sqlite3.rst:975 msgid "Passing ``None`` as *authorizer_callback* will disable the authorizer." msgstr "" -#: ../../library/sqlite3.rst:978 +#: ../../library/sqlite3.rst:977 msgid "Added support for disabling the authorizer using ``None``." msgstr "" -#: ../../library/sqlite3.rst:981 +#: ../../library/sqlite3.rst:980 msgid "" "Passing *authorizer_callback* as a keyword argument is deprecated. The " "parameter will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:988 +#: ../../library/sqlite3.rst:987 msgid "" "Register :term:`callable` *progress_handler* to be invoked for every *n* " "instructions of the SQLite virtual machine. This is useful if you want to " @@ -1329,32 +1329,32 @@ msgid "" "a GUI." msgstr "" -#: ../../library/sqlite3.rst:993 +#: ../../library/sqlite3.rst:992 msgid "" "If you want to clear any previously installed progress handler, call the " "method with ``None`` for *progress_handler*." msgstr "" -#: ../../library/sqlite3.rst:996 +#: ../../library/sqlite3.rst:995 msgid "" "Returning a non-zero value from the handler function will terminate the " "currently executing query and cause it to raise a :exc:`DatabaseError` " "exception." msgstr "" -#: ../../library/sqlite3.rst:1000 +#: ../../library/sqlite3.rst:999 msgid "" "Passing *progress_handler* as a keyword argument is deprecated. The " "parameter will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:1007 +#: ../../library/sqlite3.rst:1006 msgid "" "Register :term:`callable` *trace_callback* to be invoked for each SQL " "statement that is actually executed by the SQLite backend." msgstr "" -#: ../../library/sqlite3.rst:1010 +#: ../../library/sqlite3.rst:1009 msgid "" "The only argument passed to the callback is the statement (as :class:`str`) " "that is being executed. The return value of the callback is ignored. Note " @@ -1364,24 +1364,24 @@ msgid "" "execution of triggers defined in the current database." msgstr "" -#: ../../library/sqlite3.rst:1018 +#: ../../library/sqlite3.rst:1017 msgid "Passing ``None`` as *trace_callback* will disable the trace callback." msgstr "" -#: ../../library/sqlite3.rst:1021 +#: ../../library/sqlite3.rst:1020 msgid "" "Exceptions raised in the trace callback are not propagated. As a development " "and debugging aid, use :meth:`~sqlite3.enable_callback_tracebacks` to enable " "printing tracebacks from exceptions raised in the trace callback." msgstr "" -#: ../../library/sqlite3.rst:1028 +#: ../../library/sqlite3.rst:1027 msgid "" "Passing *trace_callback* as a keyword argument is deprecated. The parameter " "will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:1035 +#: ../../library/sqlite3.rst:1034 msgid "" "Enable the SQLite engine to load SQLite extensions from shared libraries if " "*enabled* is ``True``; else, disallow loading SQLite extensions. SQLite " @@ -1390,7 +1390,7 @@ msgid "" "distributed with SQLite." msgstr "" -#: ../../library/sqlite3.rst:1044 +#: ../../library/sqlite3.rst:1043 msgid "" "The :mod:`!sqlite3` module is not built with loadable extension support by " "default, because some platforms (notably macOS) have SQLite libraries which " @@ -1399,7 +1399,7 @@ msgid "" "program:`configure`." msgstr "" -#: ../../library/sqlite3.rst:1051 +#: ../../library/sqlite3.rst:1050 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." @@ -1407,11 +1407,11 @@ msgstr "" "引發一個附帶引數 ``connection``、``enabled`` 的\\ :ref:`稽核事件 ` " "``sqlite3.enable_load_extension``。" -#: ../../library/sqlite3.rst:1055 +#: ../../library/sqlite3.rst:1054 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "加入 ``sqlite3.enable_load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1061 +#: ../../library/sqlite3.rst:1060 msgid "" "con.enable_load_extension(True)\n" "\n" @@ -1441,24 +1441,24 @@ msgid "" " print(row)" msgstr "" -#: ../../library/sqlite3.rst:1087 +#: ../../library/sqlite3.rst:1086 msgid "" "Load an SQLite extension from a shared library. Enable extension loading " "with :meth:`enable_load_extension` before calling this method." msgstr "" -#: ../../library/sqlite3.rst:1091 +#: ../../library/sqlite3.rst:1090 msgid "The path to the SQLite extension." msgstr "" -#: ../../library/sqlite3.rst:1095 +#: ../../library/sqlite3.rst:1094 msgid "" "Entry point name. If ``None`` (the default), SQLite will come up with an " "entry point name of its own; see the SQLite docs `Loading an Extension`_ for " "details." msgstr "" -#: ../../library/sqlite3.rst:1104 +#: ../../library/sqlite3.rst:1103 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." @@ -1466,29 +1466,29 @@ msgstr "" "引發一個附帶引數 ``connection``、``path`` 的\\ :ref:`稽核事件 ` " "``sqlite3.load_extension``。" -#: ../../library/sqlite3.rst:1108 +#: ../../library/sqlite3.rst:1107 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "加入 ``sqlite3.load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1111 +#: ../../library/sqlite3.rst:1110 msgid "Added the *entrypoint* parameter." msgstr "新增 *entrypoint* 參數。" -#: ../../library/sqlite3.rst:1118 +#: ../../library/sqlite3.rst:1117 msgid "" "Return an :term:`iterator` to dump the database as SQL source code. Useful " "when saving an in-memory database for later restoration. Similar to the ``." "dump`` command in the :program:`sqlite3` shell." msgstr "" -#: ../../library/sqlite3.rst:1122 +#: ../../library/sqlite3.rst:1121 msgid "" "An optional ``LIKE`` pattern for database objects to dump, e.g. " "``prefix_%``. If ``None`` (the default), all database objects will be " "included." msgstr "" -#: ../../library/sqlite3.rst:1131 +#: ../../library/sqlite3.rst:1130 msgid "" "# Convert file example.db to SQL dump file dump.sql\n" "con = sqlite3.connect('example.db')\n" @@ -1498,36 +1498,35 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:1142 ../../library/sqlite3.rst:1216 +#: ../../library/sqlite3.rst:1141 ../../library/sqlite3.rst:1215 msgid ":ref:`sqlite3-howto-encoding`" msgstr ":ref:`sqlite3-howto-encoding`" -#: ../../library/sqlite3.rst:1144 -#, fuzzy +#: ../../library/sqlite3.rst:1143 msgid "Added the *filter* parameter." -msgstr "新增 *uri* 參數。" +msgstr "新增 *filter* 參數。" -#: ../../library/sqlite3.rst:1149 +#: ../../library/sqlite3.rst:1148 msgid "Create a backup of an SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1151 +#: ../../library/sqlite3.rst:1150 msgid "" "Works even if the database is being accessed by other clients or " "concurrently by the same connection." msgstr "" -#: ../../library/sqlite3.rst:1154 +#: ../../library/sqlite3.rst:1153 msgid "The database connection to save the backup to." msgstr "" -#: ../../library/sqlite3.rst:1157 +#: ../../library/sqlite3.rst:1156 msgid "" "The number of pages to copy at a time. If equal to or less than ``0``, the " "entire database is copied in a single step. Defaults to ``-1``." msgstr "" -#: ../../library/sqlite3.rst:1163 +#: ../../library/sqlite3.rst:1162 msgid "" "If set to a :term:`callable`, it is invoked with three integer arguments for " "every backup iteration: the *status* of the last iteration, the *remaining* " @@ -1535,24 +1534,24 @@ msgid "" "Defaults to ``None``." msgstr "" -#: ../../library/sqlite3.rst:1172 +#: ../../library/sqlite3.rst:1171 msgid "" "The name of the database to back up. Either ``\"main\"`` (the default) for " "the main database, ``\"temp\"`` for the temporary database, or the name of a " "custom database as attached using the ``ATTACH DATABASE`` SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1179 +#: ../../library/sqlite3.rst:1178 msgid "" "The number of seconds to sleep between successive attempts to back up " "remaining pages." msgstr "" -#: ../../library/sqlite3.rst:1183 +#: ../../library/sqlite3.rst:1182 msgid "Example 1, copy an existing database into another:" msgstr "" -#: ../../library/sqlite3.rst:1185 +#: ../../library/sqlite3.rst:1184 msgid "" "def progress(status, remaining, total):\n" " print(f'Copied {total-remaining} of {total} pages...')\n" @@ -1574,11 +1573,11 @@ msgstr "" "dst.close()\n" "src.close()" -#: ../../library/sqlite3.rst:1202 +#: ../../library/sqlite3.rst:1201 msgid "Example 2, copy an existing database into a transient copy:" msgstr "" -#: ../../library/sqlite3.rst:1204 +#: ../../library/sqlite3.rst:1203 msgid "" "src = sqlite3.connect('example.db')\n" "dst = sqlite3.connect(':memory:')\n" @@ -1592,25 +1591,25 @@ msgstr "" "dst.close()\n" "src.close()" -#: ../../library/sqlite3.rst:1220 +#: ../../library/sqlite3.rst:1219 msgid "Get a connection runtime limit." msgstr "" -#: ../../library/sqlite3.rst:1222 +#: ../../library/sqlite3.rst:1221 msgid "The `SQLite limit category`_ to be queried." msgstr "" -#: ../../library/sqlite3.rst:1227 ../../library/sqlite3.rst:1264 +#: ../../library/sqlite3.rst:1226 ../../library/sqlite3.rst:1263 msgid "If *category* is not recognised by the underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:1230 +#: ../../library/sqlite3.rst:1229 msgid "" "Example, query the maximum length of an SQL statement for :class:" "`Connection` ``con`` (the default is 1000000000):" msgstr "" -#: ../../library/sqlite3.rst:1240 +#: ../../library/sqlite3.rst:1239 msgid "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" "1000000000" @@ -1618,7 +1617,7 @@ msgstr "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" "1000000000" -#: ../../library/sqlite3.rst:1250 +#: ../../library/sqlite3.rst:1249 msgid "" "Set a connection runtime limit. Attempts to increase a limit above its hard " "upper bound are silently truncated to the hard upper bound. Regardless of " @@ -1626,22 +1625,22 @@ msgid "" "returned." msgstr "" -#: ../../library/sqlite3.rst:1255 +#: ../../library/sqlite3.rst:1254 msgid "The `SQLite limit category`_ to be set." msgstr "" -#: ../../library/sqlite3.rst:1258 +#: ../../library/sqlite3.rst:1257 msgid "" "The value of the new limit. If negative, the current limit is unchanged." msgstr "" -#: ../../library/sqlite3.rst:1267 +#: ../../library/sqlite3.rst:1266 msgid "" "Example, limit the number of attached databases to 1 for :class:`Connection` " "``con`` (the default limit is 10):" msgstr "" -#: ../../library/sqlite3.rst:1270 +#: ../../library/sqlite3.rst:1269 msgid "" ">>> con.setlimit(sqlite3.SQLITE_LIMIT_ATTACHED, 1)\n" "10\n" @@ -1653,25 +1652,25 @@ msgstr "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_ATTACHED)\n" "1" -#: ../../library/sqlite3.rst:1288 +#: ../../library/sqlite3.rst:1287 msgid "Query a boolean connection configuration option." msgstr "" -#: ../../library/sqlite3.rst:1290 ../../library/sqlite3.rst:1301 +#: ../../library/sqlite3.rst:1289 ../../library/sqlite3.rst:1300 msgid "A :ref:`SQLITE_DBCONFIG code `." msgstr "" -#: ../../library/sqlite3.rst:1299 +#: ../../library/sqlite3.rst:1298 msgid "Set a boolean connection configuration option." msgstr "" -#: ../../library/sqlite3.rst:1304 +#: ../../library/sqlite3.rst:1303 msgid "" "``True`` if the configuration option should be enabled (default); ``False`` " "if it should be disabled." msgstr "" -#: ../../library/sqlite3.rst:1312 +#: ../../library/sqlite3.rst:1311 msgid "" "Serialize a database into a :class:`bytes` object. For an ordinary on-disk " "database file, the serialization is just a copy of the disk file. For an in-" @@ -1680,17 +1679,17 @@ msgid "" "backed up to disk." msgstr "" -#: ../../library/sqlite3.rst:1318 +#: ../../library/sqlite3.rst:1317 msgid "The database name to be serialized. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1326 +#: ../../library/sqlite3.rst:1325 msgid "" "This method is only available if the underlying SQLite library has the " "serialize API." msgstr "" -#: ../../library/sqlite3.rst:1334 +#: ../../library/sqlite3.rst:1333 msgid "" "Deserialize a :meth:`serialized ` database into a :class:" "`Connection`. This method causes the database connection to disconnect from " @@ -1698,96 +1697,96 @@ msgid "" "serialization contained in *data*." msgstr "" -#: ../../library/sqlite3.rst:1340 +#: ../../library/sqlite3.rst:1339 msgid "A serialized database." msgstr "" -#: ../../library/sqlite3.rst:1343 +#: ../../library/sqlite3.rst:1342 msgid "The database name to deserialize into. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1347 +#: ../../library/sqlite3.rst:1346 msgid "" "If the database connection is currently involved in a read transaction or a " "backup operation." msgstr "" -#: ../../library/sqlite3.rst:1351 +#: ../../library/sqlite3.rst:1350 msgid "If *data* does not contain a valid SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1354 +#: ../../library/sqlite3.rst:1353 msgid "If :func:`len(data) ` is larger than ``2**63 - 1``." msgstr "" -#: ../../library/sqlite3.rst:1359 +#: ../../library/sqlite3.rst:1358 msgid "" "This method is only available if the underlying SQLite library has the " "deserialize API." msgstr "" -#: ../../library/sqlite3.rst:1366 +#: ../../library/sqlite3.rst:1365 msgid "" "This attribute controls :pep:`249`-compliant transaction behaviour. :attr:`!" "autocommit` has three allowed values:" msgstr "" -#: ../../library/sqlite3.rst:1369 +#: ../../library/sqlite3.rst:1368 msgid "" "``False``: Select :pep:`249`-compliant transaction behaviour, implying that :" "mod:`!sqlite3` ensures a transaction is always open. Use :meth:`commit` and :" "meth:`rollback` to close transactions." msgstr "" -#: ../../library/sqlite3.rst:1373 +#: ../../library/sqlite3.rst:1372 msgid "This is the recommended value of :attr:`!autocommit`." msgstr "" -#: ../../library/sqlite3.rst:1375 +#: ../../library/sqlite3.rst:1374 msgid "" "``True``: Use SQLite's `autocommit mode`_. :meth:`commit` and :meth:" "`rollback` have no effect in this mode." msgstr "" -#: ../../library/sqlite3.rst:1378 +#: ../../library/sqlite3.rst:1377 msgid "" ":data:`LEGACY_TRANSACTION_CONTROL`: Pre-Python 3.12 (non-:pep:`249`-" "compliant) transaction control. See :attr:`isolation_level` for more details." msgstr "" -#: ../../library/sqlite3.rst:1382 +#: ../../library/sqlite3.rst:1381 msgid "This is currently the default value of :attr:`!autocommit`." msgstr "" -#: ../../library/sqlite3.rst:1384 +#: ../../library/sqlite3.rst:1383 msgid "" "Changing :attr:`!autocommit` to ``False`` will open a new transaction, and " "changing it to ``True`` will commit any pending transaction." msgstr "" -#: ../../library/sqlite3.rst:1387 +#: ../../library/sqlite3.rst:1386 msgid "See :ref:`sqlite3-transaction-control-autocommit` for more details." msgstr "更多詳情請見 :ref:`sqlite3-transaction-control-autocommit`。" -#: ../../library/sqlite3.rst:1391 +#: ../../library/sqlite3.rst:1390 msgid "" "The :attr:`isolation_level` attribute has no effect unless :attr:" "`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." msgstr "" -#: ../../library/sqlite3.rst:1398 +#: ../../library/sqlite3.rst:1397 msgid "" "This read-only attribute corresponds to the low-level SQLite `autocommit " "mode`_." msgstr "" -#: ../../library/sqlite3.rst:1401 +#: ../../library/sqlite3.rst:1400 msgid "" "``True`` if a transaction is active (there are uncommitted changes), " "``False`` otherwise." msgstr "" -#: ../../library/sqlite3.rst:1408 +#: ../../library/sqlite3.rst:1407 msgid "" "Controls the :ref:`legacy transaction handling mode ` of :mod:`!sqlite3`. If set to ``None``, " @@ -1797,13 +1796,13 @@ msgid "" "` is performed." msgstr "" -#: ../../library/sqlite3.rst:1416 +#: ../../library/sqlite3.rst:1415 msgid "" "If not overridden by the *isolation_level* parameter of :func:`connect`, the " "default is ``\"\"``, which is an alias for ``\"DEFERRED\"``." msgstr "" -#: ../../library/sqlite3.rst:1421 +#: ../../library/sqlite3.rst:1420 msgid "" "Using :attr:`autocommit` to control transaction handling is recommended over " "using :attr:`!isolation_level`. :attr:`!isolation_level` has no effect " @@ -1811,7 +1810,7 @@ msgid "" "default)." msgstr "" -#: ../../library/sqlite3.rst:1428 +#: ../../library/sqlite3.rst:1427 msgid "" "The initial :attr:`~Cursor.row_factory` for :class:`Cursor` objects created " "from this connection. Assigning to this attribute does not affect the :attr:" @@ -1820,33 +1819,33 @@ msgid "" "`tuple`." msgstr "" -#: ../../library/sqlite3.rst:1435 ../../library/sqlite3.rst:1721 -#: ../../library/sqlite3.rst:1744 +#: ../../library/sqlite3.rst:1434 ../../library/sqlite3.rst:1720 +#: ../../library/sqlite3.rst:1743 msgid "See :ref:`sqlite3-howto-row-factory` for more details." msgstr "更多詳情請見 :ref:`sqlite3-howto-row-factory`。" -#: ../../library/sqlite3.rst:1439 +#: ../../library/sqlite3.rst:1438 msgid "" "A :term:`callable` that accepts a :class:`bytes` parameter and returns a " "text representation of it. The callable is invoked for SQLite values with " "the ``TEXT`` data type. By default, this attribute is set to :class:`str`." msgstr "" -#: ../../library/sqlite3.rst:1444 +#: ../../library/sqlite3.rst:1443 msgid "See :ref:`sqlite3-howto-encoding` for more details." msgstr "更多詳情請見 :ref:`sqlite3-howto-encoding`。" -#: ../../library/sqlite3.rst:1448 +#: ../../library/sqlite3.rst:1447 msgid "" "Return the total number of database rows that have been modified, inserted, " "or deleted since the database connection was opened." msgstr "" -#: ../../library/sqlite3.rst:1455 +#: ../../library/sqlite3.rst:1454 msgid "Cursor objects" msgstr "Cursor 物件" -#: ../../library/sqlite3.rst:1457 +#: ../../library/sqlite3.rst:1456 msgid "" "A ``Cursor`` object represents a `database cursor`_ which is used to execute " "SQL statements, and manage the context of a fetch operation. Cursors are " @@ -1854,14 +1853,14 @@ msgid "" "`connection shortcut methods `." msgstr "" -#: ../../library/sqlite3.rst:1464 +#: ../../library/sqlite3.rst:1463 msgid "" "Cursor objects are :term:`iterators `, meaning that if you :meth:" "`~Cursor.execute` a ``SELECT`` query, you can simply iterate over the cursor " "to fetch the resulting rows:" msgstr "" -#: ../../library/sqlite3.rst:1475 +#: ../../library/sqlite3.rst:1474 msgid "" "for row in cur.execute(\"SELECT t FROM data\"):\n" " print(row)" @@ -1869,32 +1868,32 @@ msgstr "" "for row in cur.execute(\"SELECT t FROM data\"):\n" " print(row)" -#: ../../library/sqlite3.rst:1489 +#: ../../library/sqlite3.rst:1488 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr "" -#: ../../library/sqlite3.rst:1496 +#: ../../library/sqlite3.rst:1495 msgid "" "Execute a single SQL statement, optionally binding Python values using :ref:" "`placeholders `." msgstr "" -#: ../../library/sqlite3.rst:1500 +#: ../../library/sqlite3.rst:1499 msgid "A single SQL statement." msgstr "單一個 SQL 陳述式。" -#: ../../library/sqlite3.rst:1503 +#: ../../library/sqlite3.rst:1502 msgid "" "Python values to bind to placeholders in *sql*. A :class:`!dict` if named " "placeholders are used. A :term:`!sequence` if unnamed placeholders are used. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1510 +#: ../../library/sqlite3.rst:1509 msgid "If *sql* contains more than one SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1513 +#: ../../library/sqlite3.rst:1512 msgid "" "If :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`, :" "attr:`~Connection.isolation_level` is not ``None``, *sql* is an ``INSERT``, " @@ -1902,7 +1901,7 @@ msgid "" "transaction, a transaction is implicitly opened before executing *sql*." msgstr "" -#: ../../library/sqlite3.rst:1522 +#: ../../library/sqlite3.rst:1521 msgid "" ":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and *parameters* is a sequence instead of a :class:" @@ -1910,37 +1909,37 @@ msgid "" "instead." msgstr "" -#: ../../library/sqlite3.rst:1528 +#: ../../library/sqlite3.rst:1527 msgid "Use :meth:`executescript` to execute multiple SQL statements." msgstr "" -#: ../../library/sqlite3.rst:1532 +#: ../../library/sqlite3.rst:1531 msgid "" "For every item in *parameters*, repeatedly execute the :ref:`parameterized " "` :abbr:`DML (Data Manipulation Language)` SQL " "statement *sql*." msgstr "" -#: ../../library/sqlite3.rst:1536 +#: ../../library/sqlite3.rst:1535 msgid "Uses the same implicit transaction handling as :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:1538 +#: ../../library/sqlite3.rst:1537 msgid "A single SQL DML statement." msgstr "" -#: ../../library/sqlite3.rst:1541 +#: ../../library/sqlite3.rst:1540 msgid "" "An :term:`!iterable` of parameters to bind with the placeholders in *sql*. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1547 +#: ../../library/sqlite3.rst:1546 msgid "" "If *sql* contains more than one SQL statement, or is not a DML statement." msgstr "" -#: ../../library/sqlite3.rst:1553 +#: ../../library/sqlite3.rst:1552 msgid "" "rows = [\n" " (\"row1\",),\n" @@ -1956,13 +1955,13 @@ msgstr "" "# cur 是一個 sqlite3.Cursor 物件\n" "cur.executemany(\"INSERT INTO data VALUES(?)\", rows)" -#: ../../library/sqlite3.rst:1568 +#: ../../library/sqlite3.rst:1567 msgid "" "Any resulting rows are discarded, including DML statements with `RETURNING " "clauses`_." msgstr "" -#: ../../library/sqlite3.rst:1575 +#: ../../library/sqlite3.rst:1574 msgid "" ":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and the items in *parameters* are sequences instead " @@ -1970,7 +1969,7 @@ msgid "" "be raised instead." msgstr "" -#: ../../library/sqlite3.rst:1584 +#: ../../library/sqlite3.rst:1583 msgid "" "Execute the SQL statements in *sql_script*. If the :attr:`~Connection." "autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and there is a pending " @@ -1979,11 +1978,11 @@ msgid "" "added to *sql_script*." msgstr "" -#: ../../library/sqlite3.rst:1592 +#: ../../library/sqlite3.rst:1591 msgid "*sql_script* must be a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:1596 +#: ../../library/sqlite3.rst:1595 msgid "" "# cur is an sqlite3.Cursor object\n" "cur.executescript(\"\"\"\n" @@ -2003,20 +2002,20 @@ msgstr "" " COMMIT;\n" "\"\"\")" -#: ../../library/sqlite3.rst:1609 +#: ../../library/sqlite3.rst:1608 msgid "" "If :attr:`~Cursor.row_factory` is ``None``, return the next row query result " "set as a :class:`tuple`. Else, pass it to the row factory and return its " "result. Return ``None`` if no more data is available." msgstr "" -#: ../../library/sqlite3.rst:1617 +#: ../../library/sqlite3.rst:1616 msgid "" "Return the next set of rows of a query result as a :class:`list`. Return an " "empty list if no more rows are available." msgstr "" -#: ../../library/sqlite3.rst:1620 +#: ../../library/sqlite3.rst:1619 msgid "" "The number of rows to fetch per call is specified by the *size* parameter. " "If *size* is not given, :attr:`arraysize` determines the number of rows to " @@ -2024,7 +2023,7 @@ msgid "" "available are returned." msgstr "" -#: ../../library/sqlite3.rst:1626 +#: ../../library/sqlite3.rst:1625 msgid "" "Note there are performance considerations involved with the *size* " "parameter. For optimal performance, it is usually best to use the arraysize " @@ -2032,36 +2031,36 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:1633 +#: ../../library/sqlite3.rst:1632 msgid "" "Return all (remaining) rows of a query result as a :class:`list`. Return an " "empty list if no rows are available. Note that the :attr:`arraysize` " "attribute can affect the performance of this operation." msgstr "" -#: ../../library/sqlite3.rst:1640 +#: ../../library/sqlite3.rst:1639 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:1642 +#: ../../library/sqlite3.rst:1641 msgid "" "The cursor will be unusable from this point forward; a :exc:" "`ProgrammingError` exception will be raised if any operation is attempted " "with the cursor." msgstr "" -#: ../../library/sqlite3.rst:1647 ../../library/sqlite3.rst:1651 +#: ../../library/sqlite3.rst:1646 ../../library/sqlite3.rst:1650 msgid "Required by the DB-API. Does nothing in :mod:`!sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:1655 +#: ../../library/sqlite3.rst:1654 msgid "" "Read/write attribute that controls the number of rows returned by :meth:" "`fetchmany`. The default value is 1 which means a single row would be " "fetched per call." msgstr "" -#: ../../library/sqlite3.rst:1660 +#: ../../library/sqlite3.rst:1659 msgid "" "Read-only attribute that provides the SQLite database :class:`Connection` " "belonging to the cursor. A :class:`Cursor` object created by calling :meth:" @@ -2069,7 +2068,7 @@ msgid "" "that refers to *con*:" msgstr "" -#: ../../library/sqlite3.rst:1665 +#: ../../library/sqlite3.rst:1664 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> cur = con.cursor()\n" @@ -2083,18 +2082,18 @@ msgstr "" "True\n" ">>> con.close()" -#: ../../library/sqlite3.rst:1675 +#: ../../library/sqlite3.rst:1674 msgid "" "Read-only attribute that provides the column names of the last query. To " "remain compatible with the Python DB API, it returns a 7-tuple for each " "column where the last six items of each tuple are ``None``." msgstr "" -#: ../../library/sqlite3.rst:1679 +#: ../../library/sqlite3.rst:1678 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: ../../library/sqlite3.rst:1683 +#: ../../library/sqlite3.rst:1682 msgid "" "Read-only attribute that provides the row id of the last inserted row. It is " "only updated after successful ``INSERT`` or ``REPLACE`` statements using " @@ -2104,15 +2103,15 @@ msgid "" "``None``." msgstr "" -#: ../../library/sqlite3.rst:1691 +#: ../../library/sqlite3.rst:1690 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: ../../library/sqlite3.rst:1693 +#: ../../library/sqlite3.rst:1692 msgid "Added support for the ``REPLACE`` statement." msgstr "新增 ``REPLACE`` 陳述式的支援。" -#: ../../library/sqlite3.rst:1698 +#: ../../library/sqlite3.rst:1697 msgid "" "Read-only attribute that provides the number of modified rows for " "``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " @@ -2122,7 +2121,7 @@ msgid "" "resulting rows must be fetched in order for :attr:`!rowcount` to be updated." msgstr "" -#: ../../library/sqlite3.rst:1709 +#: ../../library/sqlite3.rst:1708 msgid "" "Control how a row fetched from this :class:`!Cursor` is represented. If " "``None``, a row is represented as a :class:`tuple`. Can be set to the " @@ -2131,18 +2130,18 @@ msgid "" "and returns a custom object representing an SQLite row." msgstr "" -#: ../../library/sqlite3.rst:1716 +#: ../../library/sqlite3.rst:1715 msgid "" "Defaults to what :attr:`Connection.row_factory` was set to when the :class:`!" "Cursor` was created. Assigning to this attribute does not affect :attr:" "`Connection.row_factory` of the parent connection." msgstr "" -#: ../../library/sqlite3.rst:1732 +#: ../../library/sqlite3.rst:1731 msgid "Row objects" msgstr "Row 物件" -#: ../../library/sqlite3.rst:1736 +#: ../../library/sqlite3.rst:1735 msgid "" "A :class:`!Row` instance serves as a highly optimized :attr:`~Connection." "row_factory` for :class:`Connection` objects. It supports iteration, " @@ -2150,28 +2149,28 @@ msgid "" "index." msgstr "" -#: ../../library/sqlite3.rst:1741 +#: ../../library/sqlite3.rst:1740 msgid "" "Two :class:`!Row` objects compare equal if they have identical column names " "and values." msgstr "" -#: ../../library/sqlite3.rst:1748 +#: ../../library/sqlite3.rst:1747 msgid "" "Return a :class:`list` of column names as :class:`strings `. " "Immediately after a query, it is the first member of each tuple in :attr:" "`Cursor.description`." msgstr "" -#: ../../library/sqlite3.rst:1752 +#: ../../library/sqlite3.rst:1751 msgid "Added support of slicing." msgstr "新增對切片的支援。" -#: ../../library/sqlite3.rst:1759 +#: ../../library/sqlite3.rst:1758 msgid "Blob objects" msgstr "Blob 物件" -#: ../../library/sqlite3.rst:1765 +#: ../../library/sqlite3.rst:1764 msgid "" "A :class:`Blob` instance is a :term:`file-like object` that can read and " "write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. Call :func:" @@ -2179,13 +2178,13 @@ msgid "" "and :term:`slices ` for direct access to the blob data." msgstr "" -#: ../../library/sqlite3.rst:1770 +#: ../../library/sqlite3.rst:1769 msgid "" "Use the :class:`Blob` as a :term:`context manager` to ensure that the blob " "handle is closed after use." msgstr "" -#: ../../library/sqlite3.rst:1773 +#: ../../library/sqlite3.rst:1772 msgid "" "con = sqlite3.connect(\":memory:\")\n" "con.execute(\"CREATE TABLE test(blob_col blob)\")\n" @@ -2207,18 +2206,18 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:1801 +#: ../../library/sqlite3.rst:1800 msgid "Close the blob." msgstr "" -#: ../../library/sqlite3.rst:1803 +#: ../../library/sqlite3.rst:1802 msgid "" "The blob will be unusable from this point onward. An :class:`~sqlite3." "Error` (or subclass) exception will be raised if any further operation is " "attempted with the blob." msgstr "" -#: ../../library/sqlite3.rst:1809 +#: ../../library/sqlite3.rst:1808 msgid "" "Read *length* bytes of data from the blob at the current offset position. If " "the end of the blob is reached, the data up to :abbr:`EOF (End of File)` " @@ -2226,18 +2225,18 @@ msgid "" "`~Blob.read` will read until the end of the blob." msgstr "" -#: ../../library/sqlite3.rst:1817 +#: ../../library/sqlite3.rst:1816 msgid "" "Write *data* to the blob at the current offset. This function cannot change " "the blob length. Writing beyond the end of the blob will raise :exc:" "`ValueError`." msgstr "" -#: ../../library/sqlite3.rst:1823 +#: ../../library/sqlite3.rst:1822 msgid "Return the current access position of the blob." msgstr "" -#: ../../library/sqlite3.rst:1827 +#: ../../library/sqlite3.rst:1826 msgid "" "Set the current access position of the blob to *offset*. The *origin* " "argument defaults to :const:`os.SEEK_SET` (absolute blob positioning). Other " @@ -2245,26 +2244,26 @@ msgid "" "position) and :const:`os.SEEK_END` (seek relative to the blob’s end)." msgstr "" -#: ../../library/sqlite3.rst:1835 +#: ../../library/sqlite3.rst:1834 msgid "PrepareProtocol objects" msgstr "PrepareProtocol 物件" -#: ../../library/sqlite3.rst:1839 +#: ../../library/sqlite3.rst:1838 msgid "" "The PrepareProtocol type's single purpose is to act as a :pep:`246` style " "adaption protocol for objects that can :ref:`adapt themselves ` to :ref:`native SQLite types `." msgstr "" -#: ../../library/sqlite3.rst:1847 +#: ../../library/sqlite3.rst:1846 msgid "Exceptions" msgstr "例外" -#: ../../library/sqlite3.rst:1849 +#: ../../library/sqlite3.rst:1848 msgid "The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`)." msgstr "" -#: ../../library/sqlite3.rst:1853 +#: ../../library/sqlite3.rst:1852 msgid "" "This exception is not currently raised by the :mod:`!sqlite3` module, but " "may be raised by applications using :mod:`!sqlite3`, for example if a user-" @@ -2272,39 +2271,39 @@ msgid "" "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1860 +#: ../../library/sqlite3.rst:1859 msgid "" "The base class of the other exceptions in this module. Use this to catch all " "errors with one single :keyword:`except` statement. ``Error`` is a subclass " "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1864 +#: ../../library/sqlite3.rst:1863 msgid "" "If the exception originated from within the SQLite library, the following " "two attributes are added to the exception:" msgstr "" -#: ../../library/sqlite3.rst:1869 +#: ../../library/sqlite3.rst:1868 msgid "" "The numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1876 +#: ../../library/sqlite3.rst:1875 msgid "" "The symbolic name of the numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1883 +#: ../../library/sqlite3.rst:1882 msgid "" "Exception raised for misuse of the low-level SQLite C API. In other words, " "if this exception is raised, it probably indicates a bug in the :mod:`!" "sqlite3` module. ``InterfaceError`` is a subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1890 +#: ../../library/sqlite3.rst:1889 msgid "" "Exception raised for errors that are related to the database. This serves as " "the base exception for several types of database errors. It is only raised " @@ -2312,14 +2311,14 @@ msgid "" "subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1897 +#: ../../library/sqlite3.rst:1896 msgid "" "Exception raised for errors caused by problems with the processed data, like " "numeric values out of range, and strings which are too long. ``DataError`` " "is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1903 +#: ../../library/sqlite3.rst:1902 msgid "" "Exception raised for errors that are related to the database's operation, " "and not necessarily under the control of the programmer. For example, the " @@ -2327,20 +2326,20 @@ msgid "" "``OperationalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1911 +#: ../../library/sqlite3.rst:1910 msgid "" "Exception raised when the relational integrity of the database is affected, " "e.g. a foreign key check fails. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1916 +#: ../../library/sqlite3.rst:1915 msgid "" "Exception raised when SQLite encounters an internal error. If this is " "raised, it may indicate that there is a problem with the runtime SQLite " "library. ``InternalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1923 +#: ../../library/sqlite3.rst:1922 msgid "" "Exception raised for :mod:`!sqlite3` API programming errors, for example " "supplying the wrong number of bindings to a query, or trying to operate on a " @@ -2348,7 +2347,7 @@ msgid "" "`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1930 +#: ../../library/sqlite3.rst:1929 msgid "" "Exception raised in case a method or database API is not supported by the " "underlying SQLite library. For example, setting *deterministic* to ``True`` " @@ -2357,78 +2356,78 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1940 +#: ../../library/sqlite3.rst:1939 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:1942 +#: ../../library/sqlite3.rst:1941 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:1945 +#: ../../library/sqlite3.rst:1944 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:1948 ../../library/sqlite3.rst:1965 +#: ../../library/sqlite3.rst:1947 ../../library/sqlite3.rst:1964 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:1948 ../../library/sqlite3.rst:1965 +#: ../../library/sqlite3.rst:1947 ../../library/sqlite3.rst:1964 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:1950 ../../library/sqlite3.rst:1967 +#: ../../library/sqlite3.rst:1949 ../../library/sqlite3.rst:1966 msgid "``None``" msgstr "``None``" -#: ../../library/sqlite3.rst:1950 ../../library/sqlite3.rst:1967 +#: ../../library/sqlite3.rst:1949 ../../library/sqlite3.rst:1966 msgid "``NULL``" msgstr "``NULL``" -#: ../../library/sqlite3.rst:1952 ../../library/sqlite3.rst:1969 +#: ../../library/sqlite3.rst:1951 ../../library/sqlite3.rst:1968 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../library/sqlite3.rst:1952 ../../library/sqlite3.rst:1969 +#: ../../library/sqlite3.rst:1951 ../../library/sqlite3.rst:1968 msgid "``INTEGER``" msgstr "``INTEGER``" -#: ../../library/sqlite3.rst:1954 ../../library/sqlite3.rst:1971 +#: ../../library/sqlite3.rst:1953 ../../library/sqlite3.rst:1970 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/sqlite3.rst:1954 ../../library/sqlite3.rst:1971 +#: ../../library/sqlite3.rst:1953 ../../library/sqlite3.rst:1970 msgid "``REAL``" msgstr "``REAL``" -#: ../../library/sqlite3.rst:1956 +#: ../../library/sqlite3.rst:1955 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/sqlite3.rst:1956 ../../library/sqlite3.rst:1973 +#: ../../library/sqlite3.rst:1955 ../../library/sqlite3.rst:1972 msgid "``TEXT``" msgstr "``TEXT``" -#: ../../library/sqlite3.rst:1958 ../../library/sqlite3.rst:1976 +#: ../../library/sqlite3.rst:1957 ../../library/sqlite3.rst:1975 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../library/sqlite3.rst:1958 ../../library/sqlite3.rst:1976 +#: ../../library/sqlite3.rst:1957 ../../library/sqlite3.rst:1975 msgid "``BLOB``" msgstr "``BLOB``" -#: ../../library/sqlite3.rst:1962 +#: ../../library/sqlite3.rst:1961 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:1973 +#: ../../library/sqlite3.rst:1972 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:1979 +#: ../../library/sqlite3.rst:1978 msgid "" "The type system of the :mod:`!sqlite3` module is extensible in two ways: you " "can store additional Python types in an SQLite database via :ref:`object " @@ -2437,47 +2436,47 @@ msgid "" "converters>`." msgstr "" -#: ../../library/sqlite3.rst:1989 +#: ../../library/sqlite3.rst:1988 msgid "Default adapters and converters (deprecated)" msgstr "" -#: ../../library/sqlite3.rst:1993 +#: ../../library/sqlite3.rst:1992 msgid "" "The default adapters and converters are deprecated as of Python 3.12. " "Instead, use the :ref:`sqlite3-adapter-converter-recipes` and tailor them to " "your needs." msgstr "" -#: ../../library/sqlite3.rst:1997 +#: ../../library/sqlite3.rst:1996 msgid "The deprecated default adapters and converters consist of:" msgstr "" -#: ../../library/sqlite3.rst:1999 +#: ../../library/sqlite3.rst:1998 msgid "" "An adapter for :class:`datetime.date` objects to :class:`strings ` in " "`ISO 8601`_ format." msgstr "" -#: ../../library/sqlite3.rst:2001 +#: ../../library/sqlite3.rst:2000 msgid "" "An adapter for :class:`datetime.datetime` objects to strings in ISO 8601 " "format." msgstr "" -#: ../../library/sqlite3.rst:2003 +#: ../../library/sqlite3.rst:2002 msgid "" "A converter for :ref:`declared ` \"date\" types to :" "class:`datetime.date` objects." msgstr "" -#: ../../library/sqlite3.rst:2005 +#: ../../library/sqlite3.rst:2004 msgid "" "A converter for declared \"timestamp\" types to :class:`datetime.datetime` " "objects. Fractional parts will be truncated to 6 digits (microsecond " "precision)." msgstr "" -#: ../../library/sqlite3.rst:2011 +#: ../../library/sqlite3.rst:2010 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -2485,42 +2484,42 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:2024 +#: ../../library/sqlite3.rst:2023 msgid "Command-line interface" msgstr "命令列介面" -#: ../../library/sqlite3.rst:2026 +#: ../../library/sqlite3.rst:2025 msgid "" "The :mod:`!sqlite3` module can be invoked as a script, using the " "interpreter's :option:`-m` switch, in order to provide a simple SQLite " "shell. The argument signature is as follows::" msgstr "" -#: ../../library/sqlite3.rst:2031 +#: ../../library/sqlite3.rst:2030 msgid "python -m sqlite3 [-h] [-v] [filename] [sql]" msgstr "python -m sqlite3 [-h] [-v] [filename] [sql]" -#: ../../library/sqlite3.rst:2033 +#: ../../library/sqlite3.rst:2032 msgid "Type ``.quit`` or CTRL-D to exit the shell." msgstr "" -#: ../../library/sqlite3.rst:2039 +#: ../../library/sqlite3.rst:2038 msgid "Print CLI help." msgstr "" -#: ../../library/sqlite3.rst:2043 +#: ../../library/sqlite3.rst:2042 msgid "Print underlying SQLite library version." msgstr "" -#: ../../library/sqlite3.rst:2051 +#: ../../library/sqlite3.rst:2050 msgid "How-to guides" msgstr "" -#: ../../library/sqlite3.rst:2056 +#: ../../library/sqlite3.rst:2055 msgid "How to use placeholders to bind values in SQL queries" msgstr "" -#: ../../library/sqlite3.rst:2058 +#: ../../library/sqlite3.rst:2057 msgid "" "SQL operations usually need to use values from Python variables. However, " "beware of using Python's string operations to assemble queries, as they are " @@ -2528,7 +2527,7 @@ msgid "" "close the single quote and inject ``OR TRUE`` to select all rows::" msgstr "" -#: ../../library/sqlite3.rst:2063 +#: ../../library/sqlite3.rst:2062 msgid "" ">>> # Never do this -- insecure!\n" ">>> symbol = input()\n" @@ -2539,7 +2538,7 @@ msgid "" ">>> cur.execute(sql)" msgstr "" -#: ../../library/sqlite3.rst:2071 +#: ../../library/sqlite3.rst:2070 msgid "" "Instead, use the DB-API's parameter substitution. To insert a variable into " "a query string, use a placeholder in the string, and substitute the actual " @@ -2547,7 +2546,7 @@ msgid "" "second argument of the cursor's :meth:`~Cursor.execute` method." msgstr "" -#: ../../library/sqlite3.rst:2076 +#: ../../library/sqlite3.rst:2075 msgid "" "An SQL statement may use one of two kinds of placeholders: question marks " "(qmark style) or named placeholders (named style). For the qmark style, " @@ -2558,7 +2557,7 @@ msgid "" "ignored. Here's an example of both styles:" msgstr "" -#: ../../library/sqlite3.rst:2087 +#: ../../library/sqlite3.rst:2086 msgid "" "con = sqlite3.connect(\":memory:\")\n" "cur = con.execute(\"CREATE TABLE lang(name, first_appeared)\")\n" @@ -2579,24 +2578,24 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2114 +#: ../../library/sqlite3.rst:2113 msgid "" ":pep:`249` numeric placeholders are *not* supported. If used, they will be " "interpreted as named placeholders." msgstr "" -#: ../../library/sqlite3.rst:2121 +#: ../../library/sqlite3.rst:2120 msgid "How to adapt custom Python types to SQLite values" msgstr "" -#: ../../library/sqlite3.rst:2123 +#: ../../library/sqlite3.rst:2122 msgid "" "SQLite supports only a limited set of data types natively. To store custom " "Python types in SQLite databases, *adapt* them to one of the :ref:`Python " "types SQLite natively understands `." msgstr "" -#: ../../library/sqlite3.rst:2127 +#: ../../library/sqlite3.rst:2126 msgid "" "There are two ways to adapt Python objects to SQLite types: letting your " "object adapt itself, or using an *adapter callable*. The latter will take " @@ -2606,11 +2605,11 @@ msgid "" "custom adapter functions." msgstr "" -#: ../../library/sqlite3.rst:2139 +#: ../../library/sqlite3.rst:2138 msgid "How to write adaptable objects" msgstr "" -#: ../../library/sqlite3.rst:2141 +#: ../../library/sqlite3.rst:2140 msgid "" "Suppose we have a :class:`!Point` class that represents a pair of " "coordinates, ``x`` and ``y``, in a Cartesian coordinate system. The " @@ -2620,7 +2619,7 @@ msgid "" "object passed to *protocol* will be of type :class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:2149 +#: ../../library/sqlite3.rst:2148 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2652,18 +2651,18 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2173 +#: ../../library/sqlite3.rst:2172 msgid "How to register adapter callables" msgstr "" -#: ../../library/sqlite3.rst:2175 +#: ../../library/sqlite3.rst:2174 msgid "" "The other possibility is to create a function that converts the Python " "object to an SQLite-compatible type. This function can then be registered " "using :func:`register_adapter`." msgstr "" -#: ../../library/sqlite3.rst:2179 +#: ../../library/sqlite3.rst:2178 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2697,36 +2696,36 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2206 +#: ../../library/sqlite3.rst:2205 msgid "How to convert SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:2208 +#: ../../library/sqlite3.rst:2207 msgid "" "Writing an adapter lets you convert *from* custom Python types *to* SQLite " "values. To be able to convert *from* SQLite values *to* custom Python types, " "we use *converters*." msgstr "" -#: ../../library/sqlite3.rst:2213 +#: ../../library/sqlite3.rst:2212 msgid "" "Let's go back to the :class:`!Point` class. We stored the x and y " "coordinates separated via semicolons as strings in SQLite." msgstr "" -#: ../../library/sqlite3.rst:2216 +#: ../../library/sqlite3.rst:2215 msgid "" "First, we'll define a converter function that accepts the string as a " "parameter and constructs a :class:`!Point` object from it." msgstr "" -#: ../../library/sqlite3.rst:2221 +#: ../../library/sqlite3.rst:2220 msgid "" "Converter functions are **always** passed a :class:`bytes` object, no matter " "the underlying SQLite data type." msgstr "" -#: ../../library/sqlite3.rst:2224 +#: ../../library/sqlite3.rst:2223 msgid "" "def convert_point(s):\n" " x, y = map(float, s.split(b\";\"))\n" @@ -2736,32 +2735,32 @@ msgstr "" " x, y = map(float, s.split(b\";\"))\n" " return Point(x, y)" -#: ../../library/sqlite3.rst:2230 +#: ../../library/sqlite3.rst:2229 msgid "" "We now need to tell :mod:`!sqlite3` when it should convert a given SQLite " "value. This is done when connecting to a database, using the *detect_types* " "parameter of :func:`connect`. There are three options:" msgstr "" -#: ../../library/sqlite3.rst:2234 +#: ../../library/sqlite3.rst:2233 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" msgstr "" -#: ../../library/sqlite3.rst:2235 +#: ../../library/sqlite3.rst:2234 msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`" msgstr "" -#: ../../library/sqlite3.rst:2236 +#: ../../library/sqlite3.rst:2235 msgid "" "Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." "PARSE_COLNAMES``. Column names take precedence over declared types." msgstr "" -#: ../../library/sqlite3.rst:2240 +#: ../../library/sqlite3.rst:2239 msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" -#: ../../library/sqlite3.rst:2242 +#: ../../library/sqlite3.rst:2241 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2803,15 +2802,15 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2293 +#: ../../library/sqlite3.rst:2292 msgid "Adapter and converter recipes" msgstr "" -#: ../../library/sqlite3.rst:2295 +#: ../../library/sqlite3.rst:2294 msgid "This section shows recipes for common adapters and converters." msgstr "" -#: ../../library/sqlite3.rst:2297 +#: ../../library/sqlite3.rst:2296 msgid "" "import datetime\n" "import sqlite3\n" @@ -2849,11 +2848,11 @@ msgid "" "sqlite3.register_converter(\"timestamp\", convert_timestamp)" msgstr "" -#: ../../library/sqlite3.rst:2357 +#: ../../library/sqlite3.rst:2356 msgid "How to use connection shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:2359 +#: ../../library/sqlite3.rst:2358 msgid "" "Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :" "meth:`~Connection.executescript` methods of the :class:`Connection` class, " @@ -2865,7 +2864,7 @@ msgid "" "object." msgstr "" -#: ../../library/sqlite3.rst:2368 +#: ../../library/sqlite3.rst:2367 msgid "" "# Create and fill the table.\n" "con = sqlite3.connect(\":memory:\")\n" @@ -2889,11 +2888,11 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2400 +#: ../../library/sqlite3.rst:2399 msgid "How to use the connection context manager" msgstr "" -#: ../../library/sqlite3.rst:2402 +#: ../../library/sqlite3.rst:2401 msgid "" "A :class:`Connection` object can be used as a context manager that " "automatically commits or rolls back open transactions when leaving the body " @@ -2905,21 +2904,21 @@ msgid "" "rolling back." msgstr "" -#: ../../library/sqlite3.rst:2413 +#: ../../library/sqlite3.rst:2412 msgid "" "If there is no open transaction upon leaving the body of the ``with`` " "statement, or if :attr:`~Connection.autocommit` is ``True``, the context " "manager does nothing." msgstr "" -#: ../../library/sqlite3.rst:2418 +#: ../../library/sqlite3.rst:2417 msgid "" "The context manager neither implicitly opens a new transaction nor closes " "the connection. If you need a closing context manager, consider using :meth:" "`contextlib.closing`." msgstr "" -#: ../../library/sqlite3.rst:2422 +#: ../../library/sqlite3.rst:2421 msgid "" "con = sqlite3.connect(\":memory:\")\n" "con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR " @@ -2943,19 +2942,19 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2452 +#: ../../library/sqlite3.rst:2451 msgid "How to work with SQLite URIs" msgstr "" -#: ../../library/sqlite3.rst:2454 +#: ../../library/sqlite3.rst:2453 msgid "Some useful URI tricks include:" msgstr "" -#: ../../library/sqlite3.rst:2456 +#: ../../library/sqlite3.rst:2455 msgid "Open a database in read-only mode:" msgstr "" -#: ../../library/sqlite3.rst:2458 +#: ../../library/sqlite3.rst:2457 msgid "" ">>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n" ">>> con.execute(\"CREATE TABLE readonly(data)\")\n" @@ -2967,13 +2966,13 @@ msgstr "" "Traceback (most recent call last):\n" "OperationalError: attempt to write a readonly database" -#: ../../library/sqlite3.rst:2465 +#: ../../library/sqlite3.rst:2464 msgid "" "Do not implicitly create a new database file if it does not already exist; " "will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:" msgstr "" -#: ../../library/sqlite3.rst:2468 +#: ../../library/sqlite3.rst:2467 msgid "" ">>> con = sqlite3.connect(\"file:nosuchdb.db?mode=rw\", uri=True)\n" "Traceback (most recent call last):\n" @@ -2983,11 +2982,11 @@ msgstr "" "Traceback (most recent call last):\n" "OperationalError: unable to open database file" -#: ../../library/sqlite3.rst:2475 +#: ../../library/sqlite3.rst:2474 msgid "Create a shared named in-memory database:" msgstr "" -#: ../../library/sqlite3.rst:2477 +#: ../../library/sqlite3.rst:2476 msgid "" "db = \"file:mem1?mode=memory&cache=shared\"\n" "con1 = sqlite3.connect(db, uri=True)\n" @@ -3013,24 +3012,24 @@ msgstr "" "con1.close()\n" "con2.close()" -#: ../../library/sqlite3.rst:2491 +#: ../../library/sqlite3.rst:2490 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:2500 +#: ../../library/sqlite3.rst:2499 msgid "How to create and use row factories" msgstr "" -#: ../../library/sqlite3.rst:2502 +#: ../../library/sqlite3.rst:2501 msgid "" "By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If a :" "class:`!tuple` does not suit your needs, you can use the :class:`sqlite3." "Row` class or a custom :attr:`~Cursor.row_factory`." msgstr "" -#: ../../library/sqlite3.rst:2507 +#: ../../library/sqlite3.rst:2506 msgid "" "While :attr:`!row_factory` exists as an attribute both on the :class:" "`Cursor` and the :class:`Connection`, it is recommended to set :class:" @@ -3038,7 +3037,7 @@ msgid "" "use the same row factory." msgstr "" -#: ../../library/sqlite3.rst:2512 +#: ../../library/sqlite3.rst:2511 msgid "" ":class:`!Row` provides indexed and case-insensitive named access to columns, " "with minimal memory overhead and performance impact over a :class:`!tuple`. " @@ -3046,7 +3045,7 @@ msgid "" "attribute:" msgstr "" -#: ../../library/sqlite3.rst:2517 +#: ../../library/sqlite3.rst:2516 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" @@ -3054,11 +3053,11 @@ msgstr "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" -#: ../../library/sqlite3.rst:2522 +#: ../../library/sqlite3.rst:2521 msgid "Queries now return :class:`!Row` objects:" msgstr "" -#: ../../library/sqlite3.rst:2524 +#: ../../library/sqlite3.rst:2523 msgid "" ">>> res = con.execute(\"SELECT 'Earth' AS name, 6378 AS radius\")\n" ">>> row = res.fetchone()\n" @@ -3073,7 +3072,7 @@ msgid "" ">>> con.close()" msgstr "" -#: ../../library/sqlite3.rst:2540 +#: ../../library/sqlite3.rst:2539 msgid "" "The ``FROM`` clause can be omitted in the ``SELECT`` statement, as in the " "above example. In such cases, SQLite returns a single row with columns " @@ -3081,13 +3080,13 @@ msgid "" "alias``." msgstr "" -#: ../../library/sqlite3.rst:2545 +#: ../../library/sqlite3.rst:2544 msgid "" "You can create a custom :attr:`~Cursor.row_factory` that returns each row as " "a :class:`dict`, with column names mapped to values:" msgstr "" -#: ../../library/sqlite3.rst:2548 +#: ../../library/sqlite3.rst:2547 msgid "" "def dict_factory(cursor, row):\n" " fields = [column[0] for column in cursor.description]\n" @@ -3097,12 +3096,12 @@ msgstr "" " fields = [column[0] for column in cursor.description]\n" " return {key: value for key, value in zip(fields, row)}" -#: ../../library/sqlite3.rst:2554 +#: ../../library/sqlite3.rst:2553 msgid "" "Using it, queries now return a :class:`!dict` instead of a :class:`!tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2556 +#: ../../library/sqlite3.rst:2555 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = dict_factory\n" @@ -3118,11 +3117,11 @@ msgstr "" "{'a': 1, 'b': 2}\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2565 +#: ../../library/sqlite3.rst:2564 msgid "The following row factory returns a :term:`named tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2567 +#: ../../library/sqlite3.rst:2566 msgid "" "from collections import namedtuple\n" "\n" @@ -3138,11 +3137,11 @@ msgstr "" " cls = namedtuple(\"Row\", fields)\n" " return cls._make(row)" -#: ../../library/sqlite3.rst:2576 +#: ../../library/sqlite3.rst:2575 msgid ":func:`!namedtuple_factory` can be used as follows:" msgstr "" -#: ../../library/sqlite3.rst:2578 +#: ../../library/sqlite3.rst:2577 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = namedtuple_factory\n" @@ -3168,18 +3167,18 @@ msgstr "" "2\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2592 +#: ../../library/sqlite3.rst:2591 msgid "" "With some adjustments, the above recipe can be adapted to use a :class:" "`~dataclasses.dataclass`, or any other custom class, instead of a :class:" "`~collections.namedtuple`." msgstr "" -#: ../../library/sqlite3.rst:2600 +#: ../../library/sqlite3.rst:2599 msgid "How to handle non-UTF-8 text encodings" msgstr "" -#: ../../library/sqlite3.rst:2602 +#: ../../library/sqlite3.rst:2601 msgid "" "By default, :mod:`!sqlite3` uses :class:`str` to adapt SQLite values with " "the ``TEXT`` data type. This works well for UTF-8 encoded text, but it might " @@ -3187,7 +3186,7 @@ msgid "" "`~Connection.text_factory` to handle such cases." msgstr "" -#: ../../library/sqlite3.rst:2608 +#: ../../library/sqlite3.rst:2607 msgid "" "Because of SQLite's `flexible typing`_, it is not uncommon to encounter " "table columns with the ``TEXT`` data type containing non-UTF-8 encodings, or " @@ -3198,39 +3197,39 @@ msgid "" "text using this :attr:`~Connection.text_factory`:" msgstr "" -#: ../../library/sqlite3.rst:2617 +#: ../../library/sqlite3.rst:2616 msgid "con.text_factory = lambda data: str(data, encoding=\"latin2\")" msgstr "con.text_factory = lambda data: str(data, encoding=\"latin2\")" -#: ../../library/sqlite3.rst:2621 +#: ../../library/sqlite3.rst:2620 msgid "" "For invalid UTF-8 or arbitrary data in stored in ``TEXT`` table columns, you " "can use the following technique, borrowed from the :ref:`unicode-howto`:" msgstr "" -#: ../../library/sqlite3.rst:2624 +#: ../../library/sqlite3.rst:2623 msgid "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" msgstr "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" -#: ../../library/sqlite3.rst:2630 +#: ../../library/sqlite3.rst:2629 msgid "" "The :mod:`!sqlite3` module API does not support strings containing " "surrogates." msgstr "" -#: ../../library/sqlite3.rst:2635 +#: ../../library/sqlite3.rst:2634 msgid ":ref:`unicode-howto`" msgstr ":ref:`unicode-howto`" -#: ../../library/sqlite3.rst:2641 +#: ../../library/sqlite3.rst:2640 msgid "Explanation" msgstr "解釋" -#: ../../library/sqlite3.rst:2647 +#: ../../library/sqlite3.rst:2646 msgid "Transaction control" msgstr "" -#: ../../library/sqlite3.rst:2649 +#: ../../library/sqlite3.rst:2648 msgid "" ":mod:`!sqlite3` offers multiple methods of controlling whether, when and how " "database transactions are opened and closed. :ref:`sqlite3-transaction-" @@ -3238,24 +3237,24 @@ msgid "" "isolation-level` retains the pre-Python 3.12 behaviour." msgstr "" -#: ../../library/sqlite3.rst:2658 +#: ../../library/sqlite3.rst:2657 msgid "Transaction control via the ``autocommit`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2660 +#: ../../library/sqlite3.rst:2659 msgid "" "The recommended way of controlling transaction behaviour is through the :" "attr:`Connection.autocommit` attribute, which should preferably be set using " "the *autocommit* parameter of :func:`connect`." msgstr "" -#: ../../library/sqlite3.rst:2665 +#: ../../library/sqlite3.rst:2664 msgid "" "It is suggested to set *autocommit* to ``False``, which implies :pep:`249`-" "compliant transaction control. This means:" msgstr "" -#: ../../library/sqlite3.rst:2669 +#: ../../library/sqlite3.rst:2668 msgid "" ":mod:`!sqlite3` ensures that a transaction is always open, so :func:" "`connect`, :meth:`Connection.commit`, and :meth:`Connection.rollback` will " @@ -3264,21 +3263,21 @@ msgid "" "when opening transactions." msgstr "" -#: ../../library/sqlite3.rst:2674 +#: ../../library/sqlite3.rst:2673 msgid "Transactions should be committed explicitly using :meth:`!commit`." msgstr "" -#: ../../library/sqlite3.rst:2675 +#: ../../library/sqlite3.rst:2674 msgid "Transactions should be rolled back explicitly using :meth:`!rollback`." msgstr "" -#: ../../library/sqlite3.rst:2676 +#: ../../library/sqlite3.rst:2675 msgid "" "An implicit rollback is performed if the database is :meth:`~Connection." "close`-ed with pending changes." msgstr "" -#: ../../library/sqlite3.rst:2679 +#: ../../library/sqlite3.rst:2678 msgid "" "Set *autocommit* to ``True`` to enable SQLite's `autocommit mode`_. In this " "mode, :meth:`Connection.commit` and :meth:`Connection.rollback` have no " @@ -3287,25 +3286,25 @@ msgid "" "in_transaction` to query the low-level SQLite autocommit mode." msgstr "" -#: ../../library/sqlite3.rst:2687 +#: ../../library/sqlite3.rst:2686 msgid "" "Set *autocommit* to :data:`LEGACY_TRANSACTION_CONTROL` to leave transaction " "control behaviour to the :attr:`Connection.isolation_level` attribute. See :" "ref:`sqlite3-transaction-control-isolation-level` for more information." msgstr "" -#: ../../library/sqlite3.rst:2696 +#: ../../library/sqlite3.rst:2695 msgid "Transaction control via the ``isolation_level`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2700 +#: ../../library/sqlite3.rst:2699 msgid "" "The recommended way of controlling transactions is via the :attr:" "`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-control-" "autocommit`." msgstr "" -#: ../../library/sqlite3.rst:2704 +#: ../../library/sqlite3.rst:2703 msgid "" "If :attr:`Connection.autocommit` is set to :data:" "`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour is " @@ -3313,7 +3312,7 @@ msgid "" "Otherwise, :attr:`!isolation_level` has no effect." msgstr "" -#: ../../library/sqlite3.rst:2710 +#: ../../library/sqlite3.rst:2709 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " "``None``, new transactions are implicitly opened before :meth:`~Cursor." @@ -3327,7 +3326,7 @@ msgid "" "attribute." msgstr "" -#: ../../library/sqlite3.rst:2723 +#: ../../library/sqlite3.rst:2722 msgid "" "If :attr:`~Connection.isolation_level` is set to ``None``, no transactions " "are implicitly opened at all. This leaves the underlying SQLite library in " @@ -3337,33 +3336,36 @@ msgid "" "in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:2731 +#: ../../library/sqlite3.rst:2730 msgid "" "The :meth:`~Cursor.executescript` method implicitly commits any pending " "transaction before execution of the given SQL script, regardless of the " "value of :attr:`~Connection.isolation_level`." msgstr "" -#: ../../library/sqlite3.rst:2735 +#: ../../library/sqlite3.rst:2734 msgid "" ":mod:`!sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:2739 +#: ../../library/sqlite3.rst:2738 msgid "" "The recommended way of controlling transactions is now via the :attr:" "`~Connection.autocommit` attribute." msgstr "" -#: ../../library/sqlite3.rst:1491 +#: ../../library/sqlite3.rst:1490 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/sqlite3.rst:1491 ../../library/sqlite3.rst:1492 +#: ../../library/sqlite3.rst:1490 ../../library/sqlite3.rst:1491 msgid "in SQL statements" msgstr "於 SQL 陳述式中" -#: ../../library/sqlite3.rst:1492 +#: ../../library/sqlite3.rst:1491 msgid ": (colon)" msgstr ": (冒號)" + +#~ msgid "`threadsafety`_" +#~ msgstr "`threadsafety`_" diff --git a/library/ssl.po b/library/ssl.po index 17af83b322..342879d494 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2024-08-28 00:43+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -60,18 +60,16 @@ msgstr "" "安全性認知,因為 ssl 模組的預設設定未必適合你的應用程式。" #: ../../includes/wasm-notavail.rst:3 -#, fuzzy msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:只有 Windows。" +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/ssl.rst:38 msgid "" @@ -2234,8 +2232,7 @@ msgstr "" msgid "" "The *capath* string, if present, is the path to a directory containing " "several CA certificates in PEM format, following an `OpenSSL specific layout " -"`_." +"`_." msgstr "" #: ../../library/ssl.rst:1571 @@ -2343,10 +2340,10 @@ msgstr "" #: ../../library/ssl.rst:1642 msgid "" "Set the available ciphers for sockets created with this context. It should " -"be a string in the `OpenSSL cipher list format `_. If no cipher can be selected (because " -"compile-time options or other configuration forbids use of all the specified " -"ciphers), an :class:`SSLError` will be raised." +"be a string in the `OpenSSL cipher list format `_. If no cipher can be selected (because compile-time " +"options or other configuration forbids use of all the specified ciphers), " +"an :class:`SSLError` will be raised." msgstr "" #: ../../library/ssl.rst:1650 @@ -2640,9 +2637,9 @@ msgstr "" msgid "" "Get statistics about the SSL sessions created or managed by this context. A " "dictionary is returned which maps the names of each `piece of information " -"`_ to " -"their numeric values. For example, here is the total number of hits and " -"misses in the session cache since the context was created::" +"`_ to their " +"numeric values. For example, here is the total number of hits and misses in " +"the session cache since the context was created::" msgstr "" #: ../../library/ssl.rst:1881 @@ -2801,9 +2798,9 @@ msgstr "" #: ../../library/ssl.rst:2019 msgid "" -"An integer representing the `security level `_ for the context. This " -"attribute is read-only." +"An integer representing the `security level `_ for the context. This attribute is read-" +"only." msgstr "" #: ../../library/ssl.rst:2027 @@ -3655,14 +3652,12 @@ msgid ":meth:`~SSLSocket.getpeercert`" msgstr ":meth:`~SSLSocket.getpeercert`" #: ../../library/ssl.rst:2572 -#, fuzzy msgid ":meth:`~SSLSocket.get_verified_chain`" -msgstr ":meth:`~SSLSocket.version`" +msgstr ":meth:`~SSLSocket.get_verified_chain`" #: ../../library/ssl.rst:2573 -#, fuzzy msgid ":meth:`~SSLSocket.get_unverified_chain`" -msgstr ":meth:`~SSLSocket.get_channel_binding`" +msgstr ":meth:`~SSLSocket.get_unverified_chain`" #: ../../library/ssl.rst:2574 msgid ":meth:`~SSLSocket.selected_alpn_protocol`" @@ -3951,10 +3946,10 @@ msgid "" "`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the ssl module " "disables certain weak ciphers by default, but you may want to further " "restrict the cipher choice. Be sure to read OpenSSL's documentation about " -"the `cipher list format `_. If you want to check which ciphers are enabled " -"by a given cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl " -"ciphers`` command on your system." +"the `cipher list format `_. If you want to check which ciphers are enabled by a given " +"cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl ciphers`` " +"command on your system." msgstr "" #: ../../library/ssl.rst:2768 diff --git a/library/statistics.po b/library/statistics.po index 54f51c864f..1337bd2d8f 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -143,18 +143,16 @@ msgid "Harmonic mean of data." msgstr "資料的調和平均數。" #: ../../library/statistics.rst:79 -#, fuzzy msgid ":func:`kde`" -msgstr ":func:`mode`" +msgstr ":func:`kde`" #: ../../library/statistics.rst:79 msgid "Estimate the probability density distribution of the data." msgstr "" #: ../../library/statistics.rst:80 -#, fuzzy msgid ":func:`kde_random`" -msgstr ":func:`mean`" +msgstr ":func:`kde_random`" #: ../../library/statistics.rst:80 msgid "Random sampling from the PDF generated by kde()." diff --git a/library/subprocess.po b/library/subprocess.po index a6c58c0908..d6d98f3bfc 100644 --- a/library/subprocess.po +++ b/library/subprocess.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -50,21 +50,17 @@ msgstr "" msgid ":pep:`324` -- PEP proposing the subprocess module" msgstr ":pep:`324` -- 提議 subprocess 模組的 PEP" -#: ../../includes/wasm-ios-notavail.rst:3 -#, fuzzy -msgid ":ref:`Availability `: not WASI, not iOS." -msgstr ":ref:`適用 `:Unix 和 Windows。" +#: ../../includes/wasm-mobile-notavail.rst:3 +msgid ":ref:`Availability `: not Android, not iOS, not WASI." +msgstr ":ref:`適用 `:、非 Android、非 iOS、非 WASI。" -#: ../../includes/wasm-ios-notavail.rst:5 -#, fuzzy +#: ../../includes/wasm-mobile-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms, or " -"on iOS. See :ref:`wasm-availability` for more information on WASM " -"availability; see :ref:`iOS-availability` for more information on iOS " -"availability." +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在\\ :ref:`行動平台 `\\ 或\\ :ref:`WebAssembly 平" +"台 `\\ 上不支援。" #: ../../library/subprocess.rst:31 msgid "Using the :mod:`subprocess` Module" @@ -2218,3 +2214,13 @@ msgstr "universal newlines" #: ../../library/subprocess.rst:296 msgid "subprocess module" msgstr "subprocess 模組" + +#, fuzzy +#~ msgid "" +#~ "This module does not work or is not available on WebAssembly platforms, " +#~ "or on iOS. See :ref:`wasm-availability` for more information on WASM " +#~ "availability; see :ref:`iOS-availability` for more information on iOS " +#~ "availability." +#~ msgstr "" +#~ "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法" +#~ "作用或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/sunau.po b/library/sunau.po deleted file mode 100644 index c4917b1d20..0000000000 --- a/library/sunau.po +++ /dev/null @@ -1,386 +0,0 @@ -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -# Adrian Liaw , 2018 -# Matt Wang , 2022 -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" -"PO-Revision-Date: 2018-05-23 16:11+0000\n" -"Last-Translator: Matt Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/sunau.rst:2 -msgid ":mod:`sunau` --- Read and write Sun AU files" -msgstr ":mod:`sunau` --- 讀寫 Sun AU 檔案" - -#: ../../library/sunau.rst:10 -msgid "**Source code:** :source:`Lib/sunau.py`" -msgstr "**原始碼:**\\ :source:`Lib/sunau.py`" - -#: ../../library/sunau.rst:12 -msgid "" -"The :mod:`sunau` module is deprecated (see :pep:`PEP 594 <594#sunau>` for " -"details)." -msgstr "" -":mod:`sunau` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#sunau>`\\ )。" - -#: ../../library/sunau.rst:18 -msgid "" -"The :mod:`sunau` module provides a convenient interface to the Sun AU sound " -"format. Note that this module is interface-compatible with the modules :mod:" -"`aifc` and :mod:`wave`." -msgstr "" -":mod:`sunau` 模組 (module) 提供了一個處理 Sun AU 聲音格式的便利介面。請注意此" -"模組與 :mod:`aifc` 和 :mod:`wave` 的介面是相容的。" - -#: ../../library/sunau.rst:22 -msgid "" -"An audio file consists of a header followed by the data. The fields of the " -"header are:" -msgstr "音訊檔案由標頭 (header) 和資料組成。標頭包含以下欄位:" - -#: ../../library/sunau.rst:26 -msgid "Field" -msgstr "欄位" - -#: ../../library/sunau.rst:26 -msgid "Contents" -msgstr "內容" - -#: ../../library/sunau.rst:28 -msgid "magic word" -msgstr "magic word" - -#: ../../library/sunau.rst:28 -msgid "The four bytes ``.snd``." -msgstr "四個位元組 ``.snd``。" - -#: ../../library/sunau.rst:30 -msgid "header size" -msgstr "header size" - -#: ../../library/sunau.rst:30 -msgid "Size of the header, including info, in bytes." -msgstr "標頭的大小,包括資訊,以位元組為單位。" - -#: ../../library/sunau.rst:32 -msgid "data size" -msgstr "data size" - -#: ../../library/sunau.rst:32 -msgid "Physical size of the data, in bytes." -msgstr "資料的物理大小,以位元組為單位。" - -#: ../../library/sunau.rst:34 -msgid "encoding" -msgstr "encoding" - -#: ../../library/sunau.rst:34 -msgid "Indicates how the audio samples are encoded." -msgstr "表示音訊取樣的編碼方式。" - -#: ../../library/sunau.rst:36 -msgid "sample rate" -msgstr "sample rate" - -#: ../../library/sunau.rst:36 -msgid "The sampling rate." -msgstr "取樣頻率。" - -#: ../../library/sunau.rst:38 -msgid "# of channels" -msgstr "# of channels" - -#: ../../library/sunau.rst:38 -msgid "The number of channels in the samples." -msgstr "取樣中的聲道數。" - -#: ../../library/sunau.rst:40 -msgid "info" -msgstr "info" - -#: ../../library/sunau.rst:40 -msgid "" -"ASCII string giving a description of the audio file (padded with null bytes)." -msgstr "音訊檔案描述的 ASCII 字串(會以空位元組填補 (pad))。" - -#: ../../library/sunau.rst:44 -msgid "" -"Apart from the info field, all header fields are 4 bytes in size. They are " -"all 32-bit unsigned integers encoded in big-endian byte order." -msgstr "" -"除了 info 欄位以外,所有其他標頭中欄位的大小都是 4 位元組,他們都是以 big-" -"endian 位元組順序所編碼的 32-bit(位元)unsigned integers(無符號整數)" - -#: ../../library/sunau.rst:47 -msgid "The :mod:`sunau` module defines the following functions:" -msgstr ":mod:`sunau` 模組定義了以下函式:" - -#: ../../library/sunau.rst:52 -msgid "" -"If *file* is a string, open the file by that name, otherwise treat it as a " -"seekable file-like object. *mode* can be any of" -msgstr "" -"如 *file* 是一個字串,則以此名開啟檔案,否則把它當作一個可以被搜尋的 file-" -"like object(類檔案物件)。*mode* 可以是以下任一" - -#: ../../library/sunau.rst:55 -msgid "``'r'``" -msgstr "``'r'``" - -#: ../../library/sunau.rst:56 -msgid "Read only mode." -msgstr "唯讀模式。" - -#: ../../library/sunau.rst:58 -msgid "``'w'``" -msgstr "``'w'``" - -#: ../../library/sunau.rst:59 -msgid "Write only mode." -msgstr "唯寫模式。" - -#: ../../library/sunau.rst:61 -msgid "Note that it does not allow read/write files." -msgstr "請注意這並不允許讀/寫檔案。" - -#: ../../library/sunau.rst:63 -msgid "" -"A *mode* of ``'r'`` returns an :class:`AU_read` object, while a *mode* of " -"``'w'`` or ``'wb'`` returns an :class:`AU_write` object." -msgstr "" -"*mode* 若設為 ``'r'`` 則會回傳一個 :class:`AU_read` 物件,若設為 ``'w'`` 或 " -"``'wb'`` 則回傳 :class:`AU_write` 物件。" - -#: ../../library/sunau.rst:67 -msgid "The :mod:`sunau` module defines the following exception:" -msgstr ":mod:`sunau` 模組定義了以下例外:" - -#: ../../library/sunau.rst:71 -msgid "" -"An error raised when something is impossible because of Sun AU specs or " -"implementation deficiency." -msgstr "在不符合 Sun AU 規格或實作上有所不足而無法達成某些目的時會引發的錯誤。" - -#: ../../library/sunau.rst:75 -msgid "The :mod:`sunau` module defines the following data items:" -msgstr ":mod:`sunau` 模組定義了以下資料條目:" - -#: ../../library/sunau.rst:79 -msgid "" -"An integer every valid Sun AU file begins with, stored in big-endian form. " -"This is the string ``.snd`` interpreted as an integer." -msgstr "" -"每個 Sun AU 檔案都會作為開頭的一個整數,以 big-endian 形式儲存。這也是 ``." -"snd`` 所直接轉譯成一個整數的字串。" - -#: ../../library/sunau.rst:90 -msgid "" -"Values of the encoding field from the AU header which are supported by this " -"module." -msgstr "此模組有支援的 AU 標頭中 encoding 欄位值。" - -#: ../../library/sunau.rst:101 -msgid "" -"Additional known values of the encoding field from the AU header, but which " -"are not supported by this module." -msgstr "額外已知的 AU 標頭中 encoding 欄位值,但不被此模組支援。" - -#: ../../library/sunau.rst:108 -msgid "AU_read Objects" -msgstr "AU_read 物件" - -#: ../../library/sunau.rst:110 -msgid "" -"AU_read objects, as returned by :func:`.open` above, have the following " -"methods:" -msgstr "如上述 :func:`.open` 所回傳的 AU_read 物件擁有以下 method(方法):" - -#: ../../library/sunau.rst:115 -msgid "" -"Close the stream, and make the instance unusable. (This is called " -"automatically on deletion.)" -msgstr "關閉串流 (stream),並使該實例無法被使用。(這會自動在刪除時呼叫。)" - -#: ../../library/sunau.rst:121 -msgid "Returns number of audio channels (1 for mono, 2 for stereo)." -msgstr "回傳音訊聲道數量(單聲道為 1,雙聲道為 2)。" - -#: ../../library/sunau.rst:126 -msgid "Returns sample width in bytes." -msgstr "回傳取樣位元組長度。" - -#: ../../library/sunau.rst:131 -msgid "Returns sampling frequency." -msgstr "回傳取樣頻率。" - -#: ../../library/sunau.rst:136 -msgid "Returns number of audio frames." -msgstr "回傳音訊總幀數。" - -#: ../../library/sunau.rst:141 -msgid "" -"Returns compression type. Supported compression types are ``'ULAW'``, " -"``'ALAW'`` and ``'NONE'``." -msgstr "回傳壓縮種類。支援的壓縮種類有 ``'ULAW'``、``'ALAW'`` 和 ``'NONE'``。" - -#: ../../library/sunau.rst:147 -msgid "" -"Human-readable version of :meth:`getcomptype`. The supported types have the " -"respective names ``'CCITT G.711 u-law'``, ``'CCITT G.711 A-law'`` and ``'not " -"compressed'``." -msgstr "" -"可被人類讀懂 (human-readable) 的 :meth:`getcomptype`。有被支援的種類分別有這" -"些名稱 ``'CCITT G.711 u-law'``、``'CCITT G.711 A-law'`` 和 ``'not " -"compressed'``。" - -#: ../../library/sunau.rst:154 -msgid "" -"Returns a :func:`~collections.namedtuple` ``(nchannels, sampwidth, " -"framerate, nframes, comptype, compname)``, equivalent to output of the :meth:" -"`get\\*` methods." -msgstr "" -"回傳一個 :func:`~collections.namedtuple` ``(nchannels, sampwidth, framerate, " -"nframes, comptype, compname)``,與 :meth:`get\\*` methods 的輸出相同。" - -#: ../../library/sunau.rst:161 -msgid "" -"Reads and returns at most *n* frames of audio, as a :class:`bytes` object. " -"The data will be returned in linear format. If the original data is in u-" -"LAW format, it will be converted." -msgstr "" -"讀取並以 :class:`bytes` 物件形式回傳音檔中至多 *n* 幀,資料會以線性格式 " -"(linear format) 回傳,如果原始資料是 u-LAW 格式,則它會被轉換。" - -#: ../../library/sunau.rst:168 -msgid "Rewind the file pointer to the beginning of the audio stream." -msgstr "重置檔案指標 (file pointer) 至音訊開頭。" - -#: ../../library/sunau.rst:170 -msgid "" -"The following two methods define a term \"position\" which is compatible " -"between them, and is otherwise implementation dependent." -msgstr "" -"以下兩個 methods 都定義了在它們之間相容的 \"position\",否則會與實作相依。" - -#: ../../library/sunau.rst:176 -msgid "" -"Set the file pointer to the specified position. Only values returned from :" -"meth:`tell` should be used for *pos*." -msgstr "" -"設定檔案指標至指定的位置,只有 :meth:`tell` 的回傳值應被做為 *pos* 使用。" - -#: ../../library/sunau.rst:182 -msgid "" -"Return current file pointer position. Note that the returned value has " -"nothing to do with the actual position in the file." -msgstr "回傳當前檔案指標位置,要注意回傳值和真實檔案中的位置無關。" - -#: ../../library/sunau.rst:185 -msgid "" -"The following two functions are defined for compatibility with the :mod:" -"`aifc`, and don't do anything interesting." -msgstr "以下兩個函式單純是為了和 :mod:`aifc` 相容而定義,並沒有做什麼特別的。" - -#: ../../library/sunau.rst:191 -msgid "Returns ``None``." -msgstr "回傳 ``None``。" - -#: ../../library/sunau.rst:196 -msgid "Raise an error." -msgstr "引發錯誤。" - -#: ../../library/sunau.rst:202 -msgid "AU_write Objects" -msgstr "AU_write 物件" - -#: ../../library/sunau.rst:204 -msgid "" -"AU_write objects, as returned by :func:`.open` above, have the following " -"methods:" -msgstr "如上述 :func:`.open` 所回傳的 AU_write 物件擁有以下 methods:" - -#: ../../library/sunau.rst:209 -msgid "Set the number of channels." -msgstr "設定聲道數。" - -#: ../../library/sunau.rst:214 -msgid "Set the sample width (in bytes.)" -msgstr "設定取樣寬度(以位元組為單位)。" - -#: ../../library/sunau.rst:216 -msgid "Added support for 24-bit samples." -msgstr "新增對於 24-bit 取樣的支援。" - -#: ../../library/sunau.rst:222 -msgid "Set the frame rate." -msgstr "設定影格率 (frame rate)。" - -#: ../../library/sunau.rst:227 -msgid "" -"Set the number of frames. This can be later changed, when and if more " -"frames are written." -msgstr "設定幀數,該值可以在寫入更多幀後修改。" - -#: ../../library/sunau.rst:233 -msgid "" -"Set the compression type and description. Only ``'NONE'`` and ``'ULAW'`` are " -"supported on output." -msgstr "設定壓縮種類和敘述,輸出只支援 ``'NONE'`` 和 ``'ULAW'``。" - -#: ../../library/sunau.rst:239 -msgid "" -"The *tuple* should be ``(nchannels, sampwidth, framerate, nframes, comptype, " -"compname)``, with values valid for the :meth:`set\\*` methods. Set all " -"parameters." -msgstr "" -"*tuple* 應為 ``(nchannels, sampwidth, framerate, nframes, comptype, " -"compname)`` 形式,各個值應該要是 :meth:`set\\*` methods 能有效接受的值。該函" -"數會一次設定所有參數。" - -#: ../../library/sunau.rst:246 -msgid "" -"Return current position in the file, with the same disclaimer for the :meth:" -"`AU_read.tell` and :meth:`AU_read.setpos` methods." -msgstr "" -"回傳當前檔案中的位置,帶有和 :meth:`AU_read.tell` 與 :meth:`AU_read.setpos` " -"方法相同的免責聲明 (disclaimer)。" - -#: ../../library/sunau.rst:252 -msgid "Write audio frames, without correcting *nframes*." -msgstr "寫入音訊資料但不更新 *nframes*。" - -#: ../../library/sunau.rst:254 ../../library/sunau.rst:262 -msgid "Any :term:`bytes-like object` is now accepted." -msgstr "現在可接受任意 :term:`bytes-like object`。" - -#: ../../library/sunau.rst:260 -msgid "Write audio frames and make sure *nframes* is correct." -msgstr "寫入音訊資料並更新 *nframes* 以確保其正確性。" - -#: ../../library/sunau.rst:268 -msgid "Make sure *nframes* is correct, and close the file." -msgstr "確保 *nframes* 是正確的,並關閉檔案。" - -#: ../../library/sunau.rst:270 -msgid "This method is called upon deletion." -msgstr "此 method 會在刪除時呼叫。" - -#: ../../library/sunau.rst:272 -msgid "" -"Note that it is invalid to set any parameters after calling :meth:" -"`writeframes` or :meth:`writeframesraw`." -msgstr "" -"請注意,在呼叫 :meth:`writeframes` 或 :meth:`writeframesraw` 後設定任何參數都" -"是無效的。" diff --git a/library/sys.monitoring.po b/library/sys.monitoring.po index 67cae05d1b..99edc3a8a0 100644 --- a/library/sys.monitoring.po +++ b/library/sys.monitoring.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -418,7 +418,7 @@ msgid "" "Events can also be controlled on a per code object basis. The functions " "defined below which accept a :class:`types.CodeType` should be prepared to " "accept a look-alike object from functions which are not defined in Python " -"(see :ref:`monitoring`)." +"(see :ref:`c-api-monitoring`)." msgstr "" #: ../../library/sys.monitoring.rst:265 diff --git a/library/sys.po b/library/sys.po index 77f594eaca..32c11aa68d 100644 --- a/library/sys.po +++ b/library/sys.po @@ -1764,7 +1764,7 @@ msgstr "" #: ../../library/sys.rst:1388 msgid "``'ios'``" -msgstr "" +msgstr "``'ios'``" #: ../../library/sys.rst:1389 msgid "Linux" diff --git a/library/telnetlib.po b/library/telnetlib.po deleted file mode 100644 index 20603a5420..0000000000 --- a/library/telnetlib.po +++ /dev/null @@ -1,369 +0,0 @@ -# Copyright (C) 2001-2024, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2022-05-22 02:15+0800\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/telnetlib.rst:2 -msgid ":mod:`telnetlib` --- Telnet client" -msgstr ":mod:`telnetlib` --- Telnet 客戶端" - -#: ../../library/telnetlib.rst:10 -msgid "**Source code:** :source:`Lib/telnetlib.py`" -msgstr "**原始碼:**\\ :source:`Lib/telnetlib.py`" - -#: ../../library/telnetlib.rst:14 -msgid "" -"The :mod:`telnetlib` module is deprecated (see :pep:`PEP 594 " -"<594#telnetlib>` for details and alternatives)." -msgstr "" -":mod:`telnetlib` 模組 (module) 即將被棄用(詳情與替代方案請見 :pep:`PEP 594 " -"<594#telnetlib>`\\ )。" - -#: ../../library/telnetlib.rst:20 -msgid "" -"The :mod:`telnetlib` module provides a :class:`Telnet` class that implements " -"the Telnet protocol. See :rfc:`854` for details about the protocol. In " -"addition, it provides symbolic constants for the protocol characters (see " -"below), and for the telnet options. The symbolic names of the telnet options " -"follow the definitions in ``arpa/telnet.h``, with the leading ``TELOPT_`` " -"removed. For symbolic names of options which are traditionally not included " -"in ``arpa/telnet.h``, see the module source itself." -msgstr "" - -#: ../../library/telnetlib.rst:28 -msgid "" -"The symbolic constants for the telnet commands are: IAC, DONT, DO, WONT, " -"WILL, SE (Subnegotiation End), NOP (No Operation), DM (Data Mark), BRK " -"(Break), IP (Interrupt process), AO (Abort output), AYT (Are You There), EC " -"(Erase Character), EL (Erase Line), GA (Go Ahead), SB (Subnegotiation Begin)." -msgstr "" - -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: ../../includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" - -#: ../../library/telnetlib.rst:37 -msgid "" -":class:`Telnet` represents a connection to a Telnet server. The instance is " -"initially not connected by default; the :meth:`~Telnet.open` method must be " -"used to establish a connection. Alternatively, the host name and optional " -"port number can be passed to the constructor too, in which case the " -"connection to the server will be established before the constructor " -"returns. The optional *timeout* parameter specifies a timeout in seconds " -"for blocking operations like the connection attempt (if not specified, the " -"global default timeout setting will be used)." -msgstr "" - -#: ../../library/telnetlib.rst:46 -msgid "Do not reopen an already connected instance." -msgstr "" - -#: ../../library/telnetlib.rst:48 -msgid "" -"This class has many :meth:`read_\\*` methods. Note that some of them " -"raise :exc:`EOFError` when the end of the connection is read, because they " -"can return an empty string for other reasons. See the individual " -"descriptions below." -msgstr "" - -#: ../../library/telnetlib.rst:52 -msgid "" -"A :class:`Telnet` object is a context manager and can be used in a :keyword:" -"`with` statement. When the :keyword:`!with` block ends, the :meth:`close` " -"method is called::" -msgstr "" - -#: ../../library/telnetlib.rst:56 -msgid "" -">>> from telnetlib import Telnet\n" -">>> with Telnet('localhost', 23) as tn:\n" -"... tn.interact()\n" -"..." -msgstr "" -">>> from telnetlib import Telnet\n" -">>> with Telnet('localhost', 23) as tn:\n" -"... tn.interact()\n" -"..." - -#: ../../library/telnetlib.rst:61 -msgid "Context manager support added" -msgstr "" - -#: ../../library/telnetlib.rst:66 -msgid ":rfc:`854` - Telnet Protocol Specification" -msgstr "" - -#: ../../library/telnetlib.rst:67 -msgid "Definition of the Telnet protocol." -msgstr "" - -#: ../../library/telnetlib.rst:73 -msgid "Telnet Objects" -msgstr "" - -#: ../../library/telnetlib.rst:75 -msgid ":class:`Telnet` instances have the following methods:" -msgstr "" - -#: ../../library/telnetlib.rst:80 -msgid "" -"Read until a given byte string, *expected*, is encountered or until " -"*timeout* seconds have passed." -msgstr "" - -#: ../../library/telnetlib.rst:83 -msgid "" -"When no match is found, return whatever is available instead, possibly empty " -"bytes. Raise :exc:`EOFError` if the connection is closed and no cooked data " -"is available." -msgstr "" - -#: ../../library/telnetlib.rst:90 -msgid "Read all data until EOF as bytes; block until connection closed." -msgstr "" - -#: ../../library/telnetlib.rst:95 -msgid "" -"Read at least one byte of cooked data unless EOF is hit. Return ``b''`` if " -"EOF is hit. Block if no data is immediately available." -msgstr "" - -#: ../../library/telnetlib.rst:101 -msgid "Read everything that can be without blocking in I/O (eager)." -msgstr "" - -#: ../../library/telnetlib.rst:103 ../../library/telnetlib.rst:112 -msgid "" -"Raise :exc:`EOFError` if connection closed and no cooked data available. " -"Return ``b''`` if no cooked data available otherwise. Do not block unless in " -"the midst of an IAC sequence." -msgstr "" - -#: ../../library/telnetlib.rst:110 -msgid "Read readily available data." -msgstr "" - -#: ../../library/telnetlib.rst:119 -msgid "Process and return data already in the queues (lazy)." -msgstr "" - -#: ../../library/telnetlib.rst:121 -msgid "" -"Raise :exc:`EOFError` if connection closed and no data available. Return " -"``b''`` if no cooked data available otherwise. Do not block unless in the " -"midst of an IAC sequence." -msgstr "" - -#: ../../library/telnetlib.rst:128 -msgid "Return any data available in the cooked queue (very lazy)." -msgstr "" - -#: ../../library/telnetlib.rst:130 -msgid "" -"Raise :exc:`EOFError` if connection closed and no data available. Return " -"``b''`` if no cooked data available otherwise. This method never blocks." -msgstr "" - -#: ../../library/telnetlib.rst:136 -msgid "" -"Return the data collected between a SB/SE pair (suboption begin/end). The " -"callback should access these data when it was invoked with a ``SE`` command. " -"This method never blocks." -msgstr "" - -#: ../../library/telnetlib.rst:143 -msgid "" -"Connect to a host. The optional second argument is the port number, which " -"defaults to the standard Telnet port (23). The optional *timeout* parameter " -"specifies a timeout in seconds for blocking operations like the connection " -"attempt (if not specified, the global default timeout setting will be used)." -msgstr "" - -#: ../../library/telnetlib.rst:148 -msgid "Do not try to reopen an already connected instance." -msgstr "" - -#: ../../library/telnetlib.rst:150 -msgid "" -"Raises an :ref:`auditing event ` ``telnetlib.Telnet.open`` with " -"arguments ``self``, ``host``, ``port``." -msgstr "" -"引發一個附帶引數 ``self``、``host``、``port`` 的\\ :ref:`稽核事件 " -"` ``telnetlib.Telnet.open``。" - -#: ../../library/telnetlib.rst:155 -msgid "" -"Print a debug message when the debug level is ``>`` 0. If extra arguments " -"are present, they are substituted in the message using the standard string " -"formatting operator." -msgstr "" - -#: ../../library/telnetlib.rst:162 -msgid "" -"Set the debug level. The higher the value of *debuglevel*, the more debug " -"output you get (on ``sys.stdout``)." -msgstr "" - -#: ../../library/telnetlib.rst:168 -msgid "Close the connection." -msgstr "" - -#: ../../library/telnetlib.rst:173 -msgid "Return the socket object used internally." -msgstr "" - -#: ../../library/telnetlib.rst:178 -msgid "Return the file descriptor of the socket object used internally." -msgstr "" - -#: ../../library/telnetlib.rst:183 -msgid "" -"Write a byte string to the socket, doubling any IAC characters. This can " -"block if the connection is blocked. May raise :exc:`OSError` if the " -"connection is closed." -msgstr "" - -#: ../../library/telnetlib.rst:187 -msgid "" -"Raises an :ref:`auditing event ` ``telnetlib.Telnet.write`` with " -"arguments ``self``, ``buffer``." -msgstr "" -"引發一個附帶引數 ``self``、``buffer`` 的\\ :ref:`稽核事件 ` " -"``telnetlib.Telnet.write``。" - -#: ../../library/telnetlib.rst:189 -msgid "" -"This method used to raise :exc:`socket.error`, which is now an alias of :exc:" -"`OSError`." -msgstr "" - -#: ../../library/telnetlib.rst:196 -msgid "Interaction function, emulates a very dumb Telnet client." -msgstr "" - -#: ../../library/telnetlib.rst:201 -msgid "Multithreaded version of :meth:`interact`." -msgstr "" - -#: ../../library/telnetlib.rst:206 -msgid "Read until one from a list of a regular expressions matches." -msgstr "" - -#: ../../library/telnetlib.rst:208 -msgid "" -"The first argument is a list of regular expressions, either compiled (:ref:" -"`regex objects `) or uncompiled (byte strings). The optional " -"second argument is a timeout, in seconds; the default is to block " -"indefinitely." -msgstr "" - -#: ../../library/telnetlib.rst:213 -msgid "" -"Return a tuple of three items: the index in the list of the first regular " -"expression that matches; the match object returned; and the bytes read up " -"till and including the match." -msgstr "" - -#: ../../library/telnetlib.rst:217 -msgid "" -"If end of file is found and no bytes were read, raise :exc:`EOFError`. " -"Otherwise, when nothing matches, return ``(-1, None, data)`` where *data* is " -"the bytes received so far (may be empty bytes if a timeout happened)." -msgstr "" - -#: ../../library/telnetlib.rst:221 -msgid "" -"If a regular expression ends with a greedy match (such as ``.*``) or if more " -"than one expression can match the same input, the results are non-" -"deterministic, and may depend on the I/O timing." -msgstr "" - -#: ../../library/telnetlib.rst:228 -msgid "" -"Each time a telnet option is read on the input flow, this *callback* (if " -"set) is called with the following parameters: callback(telnet socket, " -"command (DO/DONT/WILL/WONT), option). No other action is done afterwards by " -"telnetlib." -msgstr "" - -#: ../../library/telnetlib.rst:236 -msgid "Telnet Example" -msgstr "Telnet 範例" - -#: ../../library/telnetlib.rst:241 -msgid "A simple example illustrating typical use::" -msgstr "" - -#: ../../library/telnetlib.rst:243 -msgid "" -"import getpass\n" -"import telnetlib\n" -"\n" -"HOST = \"localhost\"\n" -"user = input(\"Enter your remote account: \")\n" -"password = getpass.getpass()\n" -"\n" -"tn = telnetlib.Telnet(HOST)\n" -"\n" -"tn.read_until(b\"login: \")\n" -"tn.write(user.encode('ascii') + b\"\\n\")\n" -"if password:\n" -" tn.read_until(b\"Password: \")\n" -" tn.write(password.encode('ascii') + b\"\\n\")\n" -"\n" -"tn.write(b\"ls\\n\")\n" -"tn.write(b\"exit\\n\")\n" -"\n" -"print(tn.read_all().decode('ascii'))" -msgstr "" -"import getpass\n" -"import telnetlib\n" -"\n" -"HOST = \"localhost\"\n" -"user = input(\"Enter your remote account: \")\n" -"password = getpass.getpass()\n" -"\n" -"tn = telnetlib.Telnet(HOST)\n" -"\n" -"tn.read_until(b\"login: \")\n" -"tn.write(user.encode('ascii') + b\"\\n\")\n" -"if password:\n" -" tn.read_until(b\"Password: \")\n" -" tn.write(password.encode('ascii') + b\"\\n\")\n" -"\n" -"tn.write(b\"ls\\n\")\n" -"tn.write(b\"exit\\n\")\n" -"\n" -"print(tn.read_all().decode('ascii'))" - -#: ../../library/telnetlib.rst:12 -msgid "protocol" -msgstr "protocol(協定)" - -#: ../../library/telnetlib.rst:12 -msgid "Telnet" -msgstr "Telnet" diff --git a/library/threading.po b/library/threading.po index 82ec8c7c3b..13f67b22f7 100644 --- a/library/threading.po +++ b/library/threading.po @@ -74,18 +74,16 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -#, fuzzy msgid ":ref:`Availability `: not WASI." msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/threading.rst:50 msgid "This module defines the following functions:" diff --git a/library/time.po b/library/time.po index 8b03cadcce..a31807549b 100644 --- a/library/time.po +++ b/library/time.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2024-08-14 16:05+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -282,8 +282,7 @@ msgstr "" "參閱 :ref:`time-clock-id-constants`。" #: ../../library/time.rst:161 ../../library/time.rst:174 -#: ../../library/time.rst:183 ../../library/time.rst:196 -#: ../../library/time.rst:205 ../../library/time.rst:745 +#: ../../library/time.rst:183 ../../library/time.rst:745 #: ../../library/time.rst:862 ../../library/time.rst:890 #: ../../library/time.rst:918 ../../library/time.rst:962 msgid ":ref:`Availability `: Unix." @@ -324,6 +323,10 @@ msgid "" msgstr "" "使用 :func:`clock_settime_ns` 以避免 :class:`float` 型別造成的精確度損失。" +#: ../../library/time.rst:196 ../../library/time.rst:205 +msgid ":ref:`Availability `: Unix, not Android, not iOS." +msgstr ":ref:`適用 `:Unix、非 Android、非 iOS。" + #: ../../library/time.rst:203 msgid "Similar to :func:`clock_settime` but set time with nanoseconds." msgstr "類似於 :func:`clock_settime`,但設定以奈秒為單位的時間。" diff --git a/library/tkinter.po b/library/tkinter.po index 60989d08ac..cff143b797 100644 --- a/library/tkinter.po +++ b/library/tkinter.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -125,13 +125,12 @@ msgid "By Mark Roseman. (ISBN 978-1999149567)" msgstr "由 Mark Roseman 所著。(ISBN 978-1999149567)" #: ../../library/tkinter.rst:61 -#, fuzzy msgid "" -"`Python GUI programming with Tkinter `_" +"`Python GUI programming with Tkinter `_" msgstr "" "`Python GUI programming with Tkinter `_" +"python-gui-programming-with-tkinter-9781788835886>`_" #: ../../library/tkinter.rst:62 msgid "By Alan D. Moore. (ISBN 978-1788835886)" diff --git a/library/tkinter.tix.po b/library/tkinter.tix.po deleted file mode 100644 index ad862d5ec0..0000000000 --- a/library/tkinter.tix.po +++ /dev/null @@ -1,553 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2022-10-01 14:35+0800\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.1.1\n" - -#: ../../library/tkinter.tix.rst:2 -msgid ":mod:`tkinter.tix` --- Extension widgets for Tk" -msgstr ":mod:`tkinter.tix` --- Tk 擴充小工具" - -#: ../../library/tkinter.tix.rst:9 -msgid "**Source code:** :source:`Lib/tkinter/tix.py`" -msgstr "**原始碼:**\\ :source:`Lib/tkinter/tix.py`" - -#: ../../library/tkinter.tix.rst:13 -msgid "" -"This Tk extension is unmaintained and should not be used in new code. Use :" -"mod:`tkinter.ttk` instead." -msgstr "" - -#: ../../library/tkinter.tix.rst:19 -msgid "" -"The :mod:`tkinter.tix` (Tk Interface Extension) module provides an " -"additional rich set of widgets. Although the standard Tk library has many " -"useful widgets, they are far from complete. The :mod:`tkinter.tix` library " -"provides most of the commonly needed widgets that are missing from standard " -"Tk: :class:`HList`, :class:`ComboBox`, :class:`Control` (a.k.a. SpinBox) and " -"an assortment of scrollable widgets. :mod:`tkinter.tix` also includes many " -"more widgets that are generally useful in a wide range of applications: :" -"class:`NoteBook`, :class:`FileEntry`, :class:`PanedWindow`, etc; there are " -"more than 40 of them." -msgstr "" - -#: ../../library/tkinter.tix.rst:29 -msgid "" -"With all these new widgets, you can introduce new interaction techniques " -"into applications, creating more useful and more intuitive user interfaces. " -"You can design your application by choosing the most appropriate widgets to " -"match the special needs of your application and users." -msgstr "" - -#: ../../library/tkinter.tix.rst:36 -msgid "`Tix Homepage `_" -msgstr "`Tix 首頁 `_" - -#: ../../library/tkinter.tix.rst:37 -msgid "" -"The home page for :mod:`Tix`. This includes links to additional " -"documentation and downloads." -msgstr "" - -#: ../../library/tkinter.tix.rst:40 -msgid "`Tix Man Pages `_" -msgstr "`Tix 首頁 `_" - -#: ../../library/tkinter.tix.rst:41 -msgid "On-line version of the man pages and reference material." -msgstr "" - -#: ../../library/tkinter.tix.rst:43 -msgid "" -"`Tix Programming Guide `_" -msgstr "" -"`Tix 程式指南 `_" - -#: ../../library/tkinter.tix.rst:44 -msgid "On-line version of the programmer's reference material." -msgstr "" - -#: ../../library/tkinter.tix.rst:46 -msgid "" -"`Tix Development Applications `_" -msgstr "" -"`Tix 開發應用程式 `_" - -#: ../../library/tkinter.tix.rst:47 -msgid "" -"Tix applications for development of Tix and Tkinter programs. Tide " -"applications work under Tk or Tkinter, and include :program:`TixInspect`, an " -"inspector to remotely modify and debug Tix/Tk/Tkinter applications." -msgstr "" - -#: ../../library/tkinter.tix.rst:53 -msgid "Using Tix" -msgstr "" - -#: ../../library/tkinter.tix.rst:58 -msgid "" -"Toplevel widget of Tix which represents mostly the main window of an " -"application. It has an associated Tcl interpreter." -msgstr "" - -#: ../../library/tkinter.tix.rst:61 -msgid "" -"Classes in the :mod:`tkinter.tix` module subclasses the classes in the :mod:" -"`tkinter`. The former imports the latter, so to use :mod:`tkinter.tix` with " -"Tkinter, all you need to do is to import one module. In general, you can " -"just import :mod:`tkinter.tix`, and replace the toplevel call to :class:" -"`tkinter.Tk` with :class:`tix.Tk`::" -msgstr "" - -#: ../../library/tkinter.tix.rst:67 -msgid "" -"from tkinter import tix\n" -"from tkinter.constants import *\n" -"root = tix.Tk()" -msgstr "" -"from tkinter import tix\n" -"from tkinter.constants import *\n" -"root = tix.Tk()" - -#: ../../library/tkinter.tix.rst:71 -msgid "" -"To use :mod:`tkinter.tix`, you must have the Tix widgets installed, usually " -"alongside your installation of the Tk widgets. To test your installation, " -"try the following::" -msgstr "" - -#: ../../library/tkinter.tix.rst:75 -msgid "" -"from tkinter import tix\n" -"root = tix.Tk()\n" -"root.tk.eval('package require Tix')" -msgstr "" -"from tkinter import tix\n" -"root = tix.Tk()\n" -"root.tk.eval('package require Tix')" - -#: ../../library/tkinter.tix.rst:81 -msgid "Tix Widgets" -msgstr "" - -#: ../../library/tkinter.tix.rst:83 -msgid "" -"`Tix `_ introduces over 40 widget classes to the :mod:`tkinter` repertoire." -msgstr "" - -#: ../../library/tkinter.tix.rst:88 -msgid "Basic Widgets" -msgstr "" - -#: ../../library/tkinter.tix.rst:93 -msgid "" -"A `Balloon `_ that pops up over a widget to provide help. When the user " -"moves the cursor inside a widget to which a Balloon widget has been bound, a " -"small pop-up window with a descriptive message will be shown on the screen." -msgstr "" - -#: ../../library/tkinter.tix.rst:105 -msgid "" -"The `ButtonBox `_ widget creates a box of buttons, such as is commonly " -"used for ``Ok Cancel``." -msgstr "" - -#: ../../library/tkinter.tix.rst:115 -msgid "" -"The `ComboBox `_ widget is similar to the combo box control in MS Windows. " -"The user can select a choice by either typing in the entry subwidget or " -"selecting from the listbox subwidget." -msgstr "" - -#: ../../library/tkinter.tix.rst:127 -msgid "" -"The `Control `_ widget is also known as the :class:`SpinBox` widget. The " -"user can adjust the value by pressing the two arrow buttons or by entering " -"the value directly into the entry. The new value will be checked against the " -"user-defined upper and lower limits." -msgstr "" - -#: ../../library/tkinter.tix.rst:140 -msgid "" -"The `LabelEntry `_ widget packages an entry widget and a label into one " -"mega widget. It can be used to simplify the creation of \"entry-form\" type " -"of interface." -msgstr "" - -#: ../../library/tkinter.tix.rst:151 -msgid "" -"The `LabelFrame `_ widget packages a frame widget and a label into one " -"mega widget. To create widgets inside a LabelFrame widget, one creates the " -"new widgets relative to the :attr:`frame` subwidget and manage them inside " -"the :attr:`frame` subwidget." -msgstr "" - -#: ../../library/tkinter.tix.rst:163 -msgid "" -"The `Meter `_ widget can be used to show the progress of a background job " -"which may take a long time to execute." -msgstr "" - -#: ../../library/tkinter.tix.rst:174 -msgid "" -"The `OptionMenu `_ creates a menu button of options." -msgstr "" - -#: ../../library/tkinter.tix.rst:184 -msgid "" -"The `PopupMenu `_ widget can be used as a replacement of the ``tk_popup`` " -"command. The advantage of the :mod:`Tix` :class:`PopupMenu` widget is it " -"requires less application code to manipulate." -msgstr "" - -#: ../../library/tkinter.tix.rst:196 -msgid "" -"The `Select `_ widget is a container of button subwidgets. It can be used " -"to provide radio-box or check-box style of selection options for the user." -msgstr "" - -#: ../../library/tkinter.tix.rst:207 -msgid "" -"The `StdButtonBox `_ widget is a group of standard buttons for Motif-like " -"dialog boxes." -msgstr "" - -#: ../../library/tkinter.tix.rst:216 -msgid "File Selectors" -msgstr "" - -#: ../../library/tkinter.tix.rst:221 -msgid "" -"The `DirList `_ widget displays a list view of a directory, its previous " -"directories and its sub-directories. The user can choose one of the " -"directories displayed in the list or change to another directory." -msgstr "" - -#: ../../library/tkinter.tix.rst:233 -msgid "" -"The `DirTree `_ widget displays a tree view of a directory, its previous " -"directories and its sub-directories. The user can choose one of the " -"directories displayed in the list or change to another directory." -msgstr "" - -#: ../../library/tkinter.tix.rst:245 -msgid "" -"The `DirSelectDialog `_ widget presents the directories in the file " -"system in a dialog window. The user can use this dialog window to navigate " -"through the file system to select the desired directory." -msgstr "" - -#: ../../library/tkinter.tix.rst:257 -msgid "" -"The :class:`DirSelectBox` is similar to the standard Motif(TM) directory-" -"selection box. It is generally used for the user to choose a directory. " -"DirSelectBox stores the directories mostly recently selected into a ComboBox " -"widget so that they can be quickly selected again." -msgstr "" - -#: ../../library/tkinter.tix.rst:265 -msgid "" -"The `ExFileSelectBox `_ widget is usually embedded in a " -"tixExFileSelectDialog widget. It provides a convenient method for the user " -"to select files. The style of the :class:`ExFileSelectBox` widget is very " -"similar to the standard file dialog on MS Windows 3.1." -msgstr "" - -#: ../../library/tkinter.tix.rst:278 -msgid "" -"The `FileSelectBox `_ is similar to the standard Motif(TM) file-selection " -"box. It is generally used for the user to choose a file. FileSelectBox " -"stores the files mostly recently selected into a :class:`ComboBox` widget so " -"that they can be quickly selected again." -msgstr "" - -#: ../../library/tkinter.tix.rst:291 -msgid "" -"The `FileEntry `_ widget can be used to input a filename. The user can " -"type in the filename manually. Alternatively, the user can press the button " -"widget that sits next to the entry, which will bring up a file selection " -"dialog." -msgstr "" - -#: ../../library/tkinter.tix.rst:302 -msgid "Hierarchical ListBox" -msgstr "" - -#: ../../library/tkinter.tix.rst:307 -msgid "" -"The `HList `_ widget can be used to display any data that have a " -"hierarchical structure, for example, file system directory trees. The list " -"entries are indented and connected by branch lines according to their places " -"in the hierarchy." -msgstr "" - -#: ../../library/tkinter.tix.rst:319 -msgid "" -"The `CheckList `_ widget displays a list of items to be selected by the " -"user. CheckList acts similarly to the Tk checkbutton or radiobutton widgets, " -"except it is capable of handling many more items than checkbuttons or " -"radiobuttons." -msgstr "" - -#: ../../library/tkinter.tix.rst:335 -msgid "" -"The `Tree `_ widget can be used to display hierarchical data in a tree form. The " -"user can adjust the view of the tree by opening or closing parts of the tree." -msgstr "" - -#: ../../library/tkinter.tix.rst:347 -msgid "Tabular ListBox" -msgstr "" - -#: ../../library/tkinter.tix.rst:352 -msgid "" -"The `TList `_ widget can be used to display data in a tabular format. The " -"list entries of a :class:`TList` widget are similar to the entries in the Tk " -"listbox widget. The main differences are (1) the :class:`TList` widget can " -"display the list entries in a two dimensional format and (2) you can use " -"graphical images as well as multiple colors and fonts for the list entries." -msgstr "" - -#: ../../library/tkinter.tix.rst:375 -msgid "Manager Widgets" -msgstr "" - -#: ../../library/tkinter.tix.rst:380 -msgid "" -"The `PanedWindow `_ widget allows the user to interactively manipulate the " -"sizes of several panes. The panes can be arranged either vertically or " -"horizontally. The user changes the sizes of the panes by dragging the " -"resize handle between two panes." -msgstr "" - -#: ../../library/tkinter.tix.rst:392 -msgid "" -"The `ListNoteBook `_ widget is very similar to the :class:`TixNoteBook` " -"widget: it can be used to display many windows in a limited space using a " -"notebook metaphor. The notebook is divided into a stack of pages (windows). " -"At one time only one of these pages can be shown. The user can navigate " -"through these pages by choosing the name of the desired page in the :attr:" -"`hlist` subwidget." -msgstr "" - -#: ../../library/tkinter.tix.rst:406 -msgid "" -"The `NoteBook `_ widget can be used to display many windows in a limited " -"space using a notebook metaphor. The notebook is divided into a stack of " -"pages. At one time only one of these pages can be shown. The user can " -"navigate through these pages by choosing the visual \"tabs\" at the top of " -"the NoteBook widget." -msgstr "" - -#: ../../library/tkinter.tix.rst:428 -msgid "Image Types" -msgstr "" - -#: ../../library/tkinter.tix.rst:430 -msgid "The :mod:`tkinter.tix` module adds:" -msgstr "" - -#: ../../library/tkinter.tix.rst:432 -msgid "" -"`pixmap `_ capabilities to all :mod:`tkinter.tix` and :mod:`tkinter` widgets to " -"create color images from XPM files." -msgstr "" - -#: ../../library/tkinter.tix.rst:441 -msgid "" -"`Compound `_ image types can be used to create images that consists of multiple " -"horizontal lines; each line is composed of a series of items (texts, " -"bitmaps, images or spaces) arranged from left to right. For example, a " -"compound image can be used to display a bitmap and a text string " -"simultaneously in a Tk :class:`Button` widget." -msgstr "" - -#: ../../library/tkinter.tix.rst:460 -msgid "Miscellaneous Widgets" -msgstr "" - -#: ../../library/tkinter.tix.rst:465 -msgid "" -"The `InputOnly `_ widgets are to accept inputs from the user, which can be " -"done with the ``bind`` command (Unix only)." -msgstr "" - -#: ../../library/tkinter.tix.rst:472 -msgid "Form Geometry Manager" -msgstr "" - -#: ../../library/tkinter.tix.rst:474 -msgid "In addition, :mod:`tkinter.tix` augments :mod:`tkinter` by providing:" -msgstr "" - -#: ../../library/tkinter.tix.rst:479 -msgid "" -"The `Form `_ geometry manager based on attachment rules for all Tk widgets." -msgstr "" - -#: ../../library/tkinter.tix.rst:485 -msgid "Tix Commands" -msgstr "Tix 指令" - -#: ../../library/tkinter.tix.rst:490 -msgid "" -"The `tix commands `_ provide access to miscellaneous elements of :mod:`Tix`'s internal " -"state and the :mod:`Tix` application context. Most of the information " -"manipulated by these methods pertains to the application as a whole, or to a " -"screen or display, rather than to a particular window." -msgstr "" - -#: ../../library/tkinter.tix.rst:497 -msgid "To view the current settings, the common usage is::" -msgstr "" - -#: ../../library/tkinter.tix.rst:499 -msgid "" -"from tkinter import tix\n" -"root = tix.Tk()\n" -"print(root.tix_configure())" -msgstr "" -"from tkinter import tix\n" -"root = tix.Tk()\n" -"print(root.tix_configure())" - -#: ../../library/tkinter.tix.rst:506 -msgid "" -"Query or modify the configuration options of the Tix application context. If " -"no option is specified, returns a dictionary all of the available options. " -"If option is specified with no value, then the method returns a list " -"describing the one named option (this list will be identical to the " -"corresponding sublist of the value returned if no option is specified). If " -"one or more option-value pairs are specified, then the method modifies the " -"given option(s) to have the given value(s); in this case the method returns " -"an empty string. Option may be any of the configuration options." -msgstr "" - -#: ../../library/tkinter.tix.rst:518 -msgid "" -"Returns the current value of the configuration option given by *option*. " -"Option may be any of the configuration options." -msgstr "" - -#: ../../library/tkinter.tix.rst:524 -msgid "" -"Locates a bitmap file of the name ``name.xpm`` or ``name`` in one of the " -"bitmap directories (see the :meth:`tix_addbitmapdir` method). By using :" -"meth:`tix_getbitmap`, you can avoid hard coding the pathnames of the bitmap " -"files in your application. When successful, it returns the complete pathname " -"of the bitmap file, prefixed with the character ``@``. The returned value " -"can be used to configure the ``bitmap`` option of the Tk and Tix widgets." -msgstr "" - -#: ../../library/tkinter.tix.rst:534 -msgid "" -"Tix maintains a list of directories under which the :meth:`tix_getimage` " -"and :meth:`tix_getbitmap` methods will search for image files. The standard " -"bitmap directory is :file:`$TIX_LIBRARY/bitmaps`. The :meth:" -"`tix_addbitmapdir` method adds *directory* into this list. By using this " -"method, the image files of an applications can also be located using the :" -"meth:`tix_getimage` or :meth:`tix_getbitmap` method." -msgstr "" - -#: ../../library/tkinter.tix.rst:544 -msgid "" -"Returns the file selection dialog that may be shared among different calls " -"from this application. This method will create a file selection dialog " -"widget when it is called the first time. This dialog will be returned by all " -"subsequent calls to :meth:`tix_filedialog`. An optional dlgclass parameter " -"can be passed as a string to specified what type of file selection dialog " -"widget is desired. Possible options are ``tix``, ``FileSelectDialog`` or " -"``tixExFileSelectDialog``." -msgstr "" - -#: ../../library/tkinter.tix.rst:554 -msgid "" -"Locates an image file of the name :file:`name.xpm`, :file:`name.xbm` or :" -"file:`name.ppm` in one of the bitmap directories (see the :meth:" -"`tix_addbitmapdir` method above). If more than one file with the same name " -"(but different extensions) exist, then the image type is chosen according to " -"the depth of the X display: xbm images are chosen on monochrome displays and " -"color images are chosen on color displays. By using :meth:`tix_getimage`, " -"you can avoid hard coding the pathnames of the image files in your " -"application. When successful, this method returns the name of the newly " -"created image, which can be used to configure the ``image`` option of the Tk " -"and Tix widgets." -msgstr "" - -#: ../../library/tkinter.tix.rst:567 -msgid "Gets the options maintained by the Tix scheme mechanism." -msgstr "" - -#: ../../library/tkinter.tix.rst:572 -msgid "" -"Resets the scheme and fontset of the Tix application to *newScheme* and " -"*newFontSet*, respectively. This affects only those widgets created after " -"this call. Therefore, it is best to call the resetoptions method before the " -"creation of any widgets in a Tix application." -msgstr "" - -#: ../../library/tkinter.tix.rst:577 -msgid "" -"The optional parameter *newScmPrio* can be given to reset the priority level " -"of the Tk options set by the Tix schemes." -msgstr "" - -#: ../../library/tkinter.tix.rst:580 -msgid "" -"Because of the way Tk handles the X option database, after Tix has been has " -"imported and inited, it is not possible to reset the color schemes and font " -"sets using the :meth:`tix_config` method. Instead, the :meth:" -"`tix_resetoptions` method must be used." -msgstr "" - -#: ../../library/tkinter.tix.rst:11 -msgid "Tix" -msgstr "Tix" diff --git a/library/typing.po b/library/typing.po index 0840c1c64a..60f44beffd 100644 --- a/library/typing.po +++ b/library/typing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -2135,7 +2135,7 @@ msgid "" " year: int\n" "\n" "def mutate_movie(m: Movie) -> None:\n" -" m[\"year\"] = 1992 # allowed\n" +" m[\"year\"] = 1999 # allowed\n" " m[\"title\"] = \"The Matrix\" # typechecker error" msgstr "" @@ -4299,7 +4299,7 @@ msgstr "" #: ../../library/typing.rst:2792 msgid "" "`Unreachable Code and Exhaustiveness Checking `__ has more information about " +"en/latest/guides/unreachable.html>`__ has more information about " "exhaustiveness checking with static typing." msgstr "" @@ -5756,7 +5756,7 @@ msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" #: ../../library/typing.rst:3888 ../../library/typing.rst:3892 msgid "3.12" -msgstr "" +msgstr "3.12" #: ../../library/typing.rst:3890 msgid ":gh:`94309`" @@ -5780,235 +5780,20 @@ msgstr "3.13" #: ../../library/typing.rst:3897 msgid "3.15" -msgstr "" +msgstr "3.15" #: ../../library/typing.rst:3898 -#, fuzzy msgid ":gh:`106309`" -msgstr ":gh:`94309`" +msgstr ":gh:`106309`" #: ../../library/typing.rst:3899 -#, fuzzy msgid ":data:`typing.AnyStr`" -msgstr ":data:`typing.Text`" +msgstr ":data:`typing.AnyStr`" #: ../../library/typing.rst:3901 msgid "3.18" -msgstr "" +msgstr "3.18" #: ../../library/typing.rst:3902 -#, fuzzy msgid ":gh:`105578`" -msgstr ":gh:`91896`" - -#~ msgid "Point2D = TypedDict('Point2D', x=int, y=int, label=str)" -#~ msgstr "Point2D = TypedDict('Point2D', x=int, y=int, label=str)" - -#~ msgid "``typing.io`` and ``typing.re`` submodules" -#~ msgstr "``typing.io`` 和 ``typing.re`` 子模組" - -#~ msgid "3.8" -#~ msgstr "3.8" - -#~ msgid ":issue:`38291`" -#~ msgstr ":issue:`38291`" - -#~ msgid "" -#~ "On older Python versions, :data:`NoReturn` may be used to express the " -#~ "same concept. ``Never`` was added to make the intended meaning more " -#~ "explicit." -#~ msgstr "" -#~ "在舊的 Python 版本當中,:data:`NoReturn` 可以用來當作一樣的概念使用。新增 " -#~ "``Never`` 之後,則讓這個含義變得更為明確。" - -#~ msgid "" -#~ "``NoReturn`` can also be used as a `bottom type `_, a type that has no values. Starting in Python 3.11, " -#~ "the :data:`Never` type should be used for this concept instead. Type " -#~ "checkers should treat the two equivalently." -#~ msgstr "" -#~ "``NoReturn`` 可以用來作為一個\\ `底部型別 `_,一個沒有值的型別。從 Python 3.11 開始,型別 :data:`Never` " -#~ "應該改用這個概念。型別檢查器應該將這兩種型別視為相等的。" - -#~ msgid "" -#~ "This module provides runtime support for type hints. For the original " -#~ "specification of the typing system, see :pep:`484`. For a simplified " -#~ "introduction to type hints, see :pep:`483`." -#~ msgstr "" -#~ "這個模組提供可以支援型別提示的 runtime。關於加註型別系統的原有規格,請看 :" -#~ "pep:`484`。關於型別提示的簡易介紹,請看 :pep:`483`。" - -#~ msgid "" -#~ "The function below takes and returns a string and is annotated as " -#~ "follows::" -#~ msgstr "以下函式接受及回傳都是使用字串,且註解方式如下: ::" - -#~ msgid "" -#~ "In the function ``greeting``, the argument ``name`` is expected to be of " -#~ "type :class:`str` and the return type :class:`str`. Subtypes are accepted " -#~ "as arguments." -#~ msgstr "" -#~ "在函式 ``greeting`` 當中,引數 ``name`` 的型別應為 :class:`str` 且回傳的型" -#~ "別也是 :class:`str`。該引數也可以接受其子型別。" - -#~ msgid "" -#~ "For a summary of deprecated features and a deprecation timeline, please " -#~ "see `Deprecation Timeline of Major Features`_." -#~ msgstr "" -#~ "棄用功能及其棄用時間線的簡介,請看\\ `Deprecation Timeline of Major " -#~ "Features`_ \\。" - -#~ msgid "Relevant PEPs" -#~ msgstr "相關的 PEPs" - -#~ msgid "" -#~ "Since the initial introduction of type hints in :pep:`484` and :pep:" -#~ "`483`, a number of PEPs have modified and enhanced Python's framework for " -#~ "type annotations:" -#~ msgstr "" -#~ "自從 :pep:`484` 及 :pep:`483` 對於型別提示的基礎引入,多個 PEPs 針對型別註" -#~ "釋的 Python 框架進行修訂及加強:" - -#~ msgid ":pep:`526`: Syntax for Variable Annotations" -#~ msgstr ":pep:`526`:變數註釋的語法" - -#~ msgid "" -#~ "*Introducing* syntax for annotating variables outside of function " -#~ "definitions, and :data:`ClassVar`" -#~ msgstr "*引入*\\ 在定義函式之外的變數註釋語法,以及 :data:`ClassVar`" - -#~ msgid ":pep:`544`: Protocols: Structural subtyping (static duck typing)" -#~ msgstr "" -#~ ":pep:`544`: 協定:結構子型別 (Structural Subtyping) (靜態鴨子型別," -#~ "Static Duck Typing)" - -#~ msgid "" -#~ "*Introducing* :class:`Protocol` and the :func:" -#~ "`@runtime_checkable` decorator" -#~ msgstr "" -#~ "*引入* :class:`Protocol` 以及 :func:" -#~ "`@runtime_checkable` 裝飾器 (decorator)" - -#~ msgid ":pep:`585`: Type Hinting Generics In Standard Collections" -#~ msgstr "" -#~ ":pep:`585`:基礎彙集 (collection) 中的型別提示泛型 (Type Hinting Generics " -#~ "In Standard Collections)" - -#~ msgid "" -#~ "*Introducing* :class:`types.GenericAlias` and the ability to use standard " -#~ "library classes as :ref:`generic types`" -#~ msgstr "" -#~ "*引入* :class:`types.GenericAlias` 以及使用基礎函式庫類別 :ref:`generic " -#~ "types` 的能力" - -#~ msgid ":pep:`586`: Literal Types" -#~ msgstr ":pep:`586`:文字型別" - -#~ msgid "*Introducing* :data:`Literal`" -#~ msgstr "*引入* :data:`Literal`" - -#~ msgid "" -#~ ":pep:`589`: TypedDict: Type Hints for Dictionaries with a Fixed Set of " -#~ "Keys" -#~ msgstr ":pep:`589`:TypedDict:含有一組固定 (fixed) 鍵值的型別提示字典" - -#~ msgid "*Introducing* :class:`TypedDict`" -#~ msgstr "*引入* :class:`TypedDict`" - -#~ msgid ":pep:`591`: Adding a final qualifier to typing" -#~ msgstr ":pep:`591`:為型別新增一個最終限定符 (final qualifier)" - -#~ msgid "*Introducing* :data:`Final` and the :func:`@final` decorator" -#~ msgstr "*引入* :data:`Final` 以及 :func:`@final` 裝飾器" - -#~ msgid ":pep:`593`: Flexible function and variable annotations" -#~ msgstr ":pep:`593`:彈性函式及變數註釋" - -#~ msgid "*Introducing* :data:`Annotated`" -#~ msgstr "*引入* :data:`Annotated`" - -#~ msgid ":pep:`604`: Allow writing union types as ``X | Y``" -#~ msgstr ":pep:`604`:允許寫入聯集型別 (union type) 為 ``X | Y``" - -#~ msgid "" -#~ "*Introducing* :data:`types.UnionType` and the ability to use the binary-" -#~ "or operator ``|`` to signify a :ref:`union of types`" -#~ msgstr "" -#~ "*引入* :data:`types.UnionType` 以及使用 binary-or 運算子 ``|`` 以表示\\ :" -#~ "ref:`型別聯合 `\\ 的能力" - -#~ msgid ":pep:`612`: Parameter Specification Variables" -#~ msgstr ":pep:`612`:參數規格變數 (Parameter Specification Variable)" - -#~ msgid "*Introducing* :class:`ParamSpec` and :data:`Concatenate`" -#~ msgstr "*引入* :class:`ParamSpec` 及 :data:`Concatenate`" - -#~ msgid ":pep:`613`: Explicit Type Aliases" -#~ msgstr ":pep:`613`:顯式型別別名 (Explicit Type Alias)" - -#~ msgid "*Introducing* :data:`TypeAlias`" -#~ msgstr "*引入* :data:`TypeAlias`" - -#~ msgid ":pep:`646`: Variadic Generics" -#~ msgstr ":pep:`646`:可變參數泛型 (Variadic Generic)" - -#~ msgid "*Introducing* :data:`TypeVarTuple`" -#~ msgstr "*引入* :data:`TypeVarTuple`" - -#~ msgid ":pep:`647`: User-Defined Type Guards" -#~ msgstr ":pep:`647`:使用者定義的型別防護 (Type Guard)" - -#~ msgid "*Introducing* :data:`TypeGuard`" -#~ msgstr "*引入* :data:`TypeGuard`" - -#~ msgid "" -#~ ":pep:`655`: Marking individual TypedDict items as required or potentially " -#~ "missing" -#~ msgstr ":pep:`655`:標記個別的 TypedDict 物件為必需的或可能遺失的" - -#~ msgid "*Introducing* :data:`Required` and :data:`NotRequired`" -#~ msgstr "*引入* :data:`Required` 和 :data:`NotRequired`" - -#~ msgid ":pep:`673`: Self type" -#~ msgstr ":pep:`673`:Self 型別" - -#~ msgid "*Introducing* :data:`Self`" -#~ msgstr "*引入* :data:`Self`" - -#~ msgid ":pep:`675`: Arbitrary Literal String Type" -#~ msgstr ":pep:`675`:任意的文本字串型別 (Arbitrary Literal String Type)" - -#~ msgid "*Introducing* :data:`LiteralString`" -#~ msgstr "*引入* :data:`LiteralString`" - -#~ msgid ":pep:`681`: Data Class Transforms" -#~ msgstr ":pep:`681`:資料類別轉換" - -#~ msgid "" -#~ "*Introducing* the :func:`@dataclass_transform` " -#~ "decorator" -#~ msgstr "*引入* :func:`@dataclass_transform` 裝飾器" - -#~ msgid ":pep:`692`: Using ``TypedDict`` for more precise ``**kwargs`` typing" -#~ msgstr ":pep:`692`:為更精準的 ``**kwargs`` 型別使用 ``TypedDict``" - -#~ msgid "" -#~ "*Introducing* a new way of typing ``**kwargs`` with :data:`Unpack` and :" -#~ "data:`TypedDict`" -#~ msgstr "" -#~ "*引入* 型別 ``**kwargs`` 的新方式 :data:`Unpack` 以及 :data:`TypedDict`" - -#~ msgid ":pep:`695`: Type Parameter Syntax" -#~ msgstr ":pep:`695`:型別參數語法" - -#~ msgid "" -#~ "*Introducing* builtin syntax for creating generic functions, classes, and " -#~ "type aliases." -#~ msgstr "*引入*\\ 建立泛型函式、類別、型別別名的內建語法。" - -#~ msgid ":pep:`698`: Adding an override decorator to typing" -#~ msgstr ":pep:`698`:為型別新增可覆寫的裝飾器" - -#~ msgid "*Introducing* the :func:`@override` decorator" -#~ msgstr "*引入* :func:`@override` 裝飾器" +msgstr ":gh:`105578`" diff --git a/library/undoc.po b/library/undoc.po deleted file mode 100644 index 6a66f5b73e..0000000000 --- a/library/undoc.po +++ /dev/null @@ -1,62 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: Python 3.10\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-01-14 13:34+0800\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../../library/undoc.rst:5 -msgid "Undocumented Modules" -msgstr "未紀錄於文件的模組" - -#: ../../library/undoc.rst:7 -msgid "" -"Here's a quick listing of modules that are currently undocumented, but that " -"should be documented. Feel free to contribute documentation for them! " -"(Send via email to docs@python.org.)" -msgstr "" - -#: ../../library/undoc.rst:11 -msgid "" -"The idea and original contents for this chapter were taken from a posting by " -"Fredrik Lundh; the specific contents of this chapter have been substantially " -"revised." -msgstr "" - -#: ../../library/undoc.rst:17 -msgid "Platform specific modules" -msgstr "" - -#: ../../library/undoc.rst:19 -msgid "" -"These modules are used to implement the :mod:`os.path` module, and are not " -"documented beyond this mention. There's little need to document these." -msgstr "" - -#: ../../library/undoc.rst:23 -msgid ":mod:`ntpath`" -msgstr ":mod:`ntpath`" - -#: ../../library/undoc.rst:23 -msgid "--- Implementation of :mod:`os.path` on Win32 and Win64 platforms." -msgstr "" - -#: ../../library/undoc.rst:25 -msgid ":mod:`posixpath`" -msgstr ":mod:`posixpath`" - -#: ../../library/undoc.rst:26 -msgid "--- Implementation of :mod:`os.path` on POSIX." -msgstr "" diff --git a/library/urllib.request.po b/library/urllib.request.po index 3fb995ae69..5720f797b8 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -55,16 +55,15 @@ msgstr "" #: ../../includes/wasm-notavail.rst:3 msgid ":ref:`Availability `: not WASI." -msgstr "" +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/urllib.request.rst:34 msgid "The :mod:`urllib.request` module defines the following functions:" diff --git a/library/uu.po b/library/uu.po deleted file mode 100644 index 13affdd5a7..0000000000 --- a/library/uu.po +++ /dev/null @@ -1,110 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-202# SOME DESCRIPTIVE TITLE., Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" -"PO-Revision-Date: 2022-05-22 02:22+0800\n" -"Last-Translator: Liang-Bo Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/uu.rst:2 -msgid ":mod:`uu` --- Encode and decode uuencode files" -msgstr ":mod:`xdrlib` --- uuencode 檔案的編碼與解碼" - -#: ../../library/uu.rst:10 -msgid "**Source code:** :source:`Lib/uu.py`" -msgstr "**原始碼:**\\ :source:`Lib/uu.py`" - -#: ../../library/uu.rst:12 -msgid "" -"The :mod:`uu` module is deprecated (see :pep:`PEP 594 <594#uu-and-the-uu-" -"encoding>` for details). :mod:`base64` is a modern alternative." -msgstr "" -":mod:`uu` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#uu-and-the-uu-" -"encoding>`\\ )。:mod:`base64` 是個現時常用的替代方案。" - -#: ../../library/uu.rst:19 -msgid "" -"This module encodes and decodes files in uuencode format, allowing arbitrary " -"binary data to be transferred over ASCII-only connections. Wherever a file " -"argument is expected, the methods accept a file-like object. For backwards " -"compatibility, a string containing a pathname is also accepted, and the " -"corresponding file will be opened for reading and writing; the pathname " -"``'-'`` is understood to mean the standard input or output. However, this " -"interface is deprecated; it's better for the caller to open the file itself, " -"and be sure that, when required, the mode is ``'rb'`` or ``'wb'`` on Windows." -msgstr "" - -#: ../../library/uu.rst:32 -msgid "" -"This code was contributed by Lance Ellinghouse, and modified by Jack Jansen." -msgstr "" - -#: ../../library/uu.rst:34 -msgid "The :mod:`uu` module defines the following functions:" -msgstr "" - -#: ../../library/uu.rst:39 -msgid "" -"Uuencode file *in_file* into file *out_file*. The uuencoded file will have " -"the header specifying *name* and *mode* as the defaults for the results of " -"decoding the file. The default defaults are taken from *in_file*, or ``'-'`` " -"and ``0o666`` respectively. If *backtick* is true, zeros are represented by " -"``'`'`` instead of spaces." -msgstr "" - -#: ../../library/uu.rst:45 -msgid "Added the *backtick* parameter." -msgstr "新增 *backtick* 參數。" - -#: ../../library/uu.rst:51 -msgid "" -"This call decodes uuencoded file *in_file* placing the result on file " -"*out_file*. If *out_file* is a pathname, *mode* is used to set the " -"permission bits if the file must be created. Defaults for *out_file* and " -"*mode* are taken from the uuencode header. However, if the file specified " -"in the header already exists, a :exc:`uu.Error` is raised." -msgstr "" - -#: ../../library/uu.rst:57 -msgid "" -":func:`decode` may print a warning to standard error if the input was " -"produced by an incorrect uuencoder and Python could recover from that " -"error. Setting *quiet* to a true value silences this warning." -msgstr "" - -#: ../../library/uu.rst:64 -msgid "" -"Subclass of :exc:`Exception`, this can be raised by :func:`uu.decode` under " -"various situations, such as described above, but also including a badly " -"formatted header, or truncated input file." -msgstr "" - -#: ../../library/uu.rst:71 -msgid "Module :mod:`binascii`" -msgstr ":mod:`binascii` 模組" - -#: ../../library/uu.rst:72 -msgid "" -"Support module containing ASCII-to-binary and binary-to-ASCII conversions." -msgstr "" - -#: ../../library/uu.rst:28 -msgid "Jansen, Jack" -msgstr "Jansen, Jack" - -#: ../../library/uu.rst:28 -msgid "Ellinghouse, Lance" -msgstr "Ellinghouse, Lance" diff --git a/library/venv.po b/library/venv.po index f24d52177e..2318e51ea4 100644 --- a/library/venv.po +++ b/library/venv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-07-09 15:09+0800\n" "Last-Translator: Po-Chuan Chen \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -91,20 +91,17 @@ msgid "" "environments/#create-and-use-virtual-environments>`__" msgstr "" -#: ../../includes/wasm-ios-notavail.rst:3 -msgid ":ref:`Availability `: not WASI, not iOS." -msgstr "" +#: ../../includes/wasm-mobile-notavail.rst:3 +msgid ":ref:`Availability `: not Android, not iOS, not WASI." +msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" -#: ../../includes/wasm-ios-notavail.rst:5 -#, fuzzy +#: ../../includes/wasm-mobile-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms, or " -"on iOS. See :ref:`wasm-availability` for more information on WASM " -"availability; see :ref:`iOS-availability` for more information on iOS " -"availability." +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在\\ :ref:`行動平台 `\\ 或\\ :ref:`WebAssembly 平" +"台 `\\ 上不支援。" #: ../../library/venv.rst:62 msgid "Creating virtual environments" @@ -1130,3 +1127,13 @@ msgstr "Environments (環境)" #: ../../library/venv.rst:14 msgid "virtual" msgstr "virtual (虛擬)" + +#, fuzzy +#~ msgid "" +#~ "This module does not work or is not available on WebAssembly platforms, " +#~ "or on iOS. See :ref:`wasm-availability` for more information on WASM " +#~ "availability; see :ref:`iOS-availability` for more information on iOS " +#~ "availability." +#~ msgstr "" +#~ "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法" +#~ "作用或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/webbrowser.po b/library/webbrowser.po index 58e216d74c..425faf6782 100644 --- a/library/webbrowser.po +++ b/library/webbrowser.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -94,19 +94,10 @@ msgstr "" msgid "python -m webbrowser -t \"https://www.python.org/"" msgstr "python -m webbrowser -t \"https://www.python.org/"" -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." +#: ../../library/webbrowser.rst:54 +msgid ":ref:`Availability `: not WASI, not Android." msgstr "" -#: ../../includes/wasm-notavail.rst:5 -#, fuzzy -msgid "" -"This module does not work or is not available on WebAssembly. See :ref:`wasm-" -"availability` for more information." -msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" - #: ../../library/webbrowser.rst:56 msgid "The following exception is defined:" msgstr "" @@ -362,11 +353,11 @@ msgstr "``'iosbrowser'``" #: ../../library/webbrowser.rst:167 msgid "``IOSBrowser``" -msgstr "" +msgstr "``IOSBrowser``" #: ../../library/webbrowser.rst:167 msgid "\\(4)" -msgstr "" +msgstr "\\(4)" #: ../../library/webbrowser.rst:170 msgid "Notes:" @@ -474,12 +465,3 @@ msgid "" "Executables named here without a full path will be searched in the " "directories given in the :envvar:`PATH` environment variable." msgstr "" - -#~ msgid ":class:`Konqueror()`" -#~ msgstr ":class:`Konqueror()`" - -#~ msgid ":class:`Opera()`" -#~ msgstr ":class:`Opera()`" - -#~ msgid ":class:`WindowsDefault`" -#~ msgstr ":class:`WindowsDefault`" diff --git a/library/wsgiref.po b/library/wsgiref.po index 364b60b0a9..240292a6a8 100644 --- a/library/wsgiref.po +++ b/library/wsgiref.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-12-09 21:29+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1207,10 +1207,9 @@ msgid "" msgstr "這個模組提供在 :pep:`3333` 中所描述的各種用於靜態型別檢查的型別。" #: ../../library/wsgiref.rst:786 -#, fuzzy msgid "" -"A :class:`typing.Protocol` describing `start_response() `_ callables (:pep:`3333`)." +"A :class:`typing.Protocol` describing :pep:`start_response() <3333#the-start-" +"response-callable>` callables (:pep:`3333`)." msgstr "" "一個描述 :pep:`start_response() <3333#the-start-response-callable>` 可呼叫物" "件的 :class:`typing.Protocol` (:pep:`3333`)。" @@ -1224,29 +1223,26 @@ msgid "A type alias describing a WSGI application callable." msgstr "一個描述 WSGI 應用程式可呼叫物件的型別別名。" #: ../../library/wsgiref.rst:800 -#, fuzzy msgid "" -"A :class:`typing.Protocol` describing a `WSGI Input Stream `_." +"A :class:`typing.Protocol` describing a :pep:`WSGI Input Stream <3333#input-" +"and-error-streams>`." msgstr "" "一個描述 :pep:`WSGI 輸入串流 <3333#input-and-error-streams>`\\ 的 :class:" "`typing.Protocol`。" #: ../../library/wsgiref.rst:805 -#, fuzzy msgid "" -"A :class:`typing.Protocol` describing a `WSGI Error Stream `_." +"A :class:`typing.Protocol` describing a :pep:`WSGI Error Stream <3333#input-" +"and-error-streams>`." msgstr "" "一個描述 :pep:`WSGI 錯誤串流 <3333#input-and-error-streams>`\\ 的 :class:" "`typing.Protocol`。" #: ../../library/wsgiref.rst:810 -#, fuzzy msgid "" -"A :class:`typing.Protocol` describing a `file wrapper `_. See :class:" -"`wsgiref.util.FileWrapper` for a concrete implementation of this protocol." +"A :class:`typing.Protocol` describing a :pep:`file wrapper <3333#optional-" +"platform-specific-file-handling>`. See :class:`wsgiref.util.FileWrapper` for " +"a concrete implementation of this protocol." msgstr "" "一個描述\\ :pep:`檔案包裝器 <3333#optional-platform-specific-file-" "handling>`\\ 的 :class:`typing.Protocol`。請參閱 :class:`wsgiref.util." diff --git a/library/xdrlib.po b/library/xdrlib.po deleted file mode 100644 index ca29ccbfd4..0000000000 --- a/library/xdrlib.po +++ /dev/null @@ -1,347 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" -"PO-Revision-Date: 2016-01-31 07:33+0000\n" -"Last-Translator: Liang-Bo Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../../library/xdrlib.rst:2 -msgid ":mod:`xdrlib` --- Encode and decode XDR data" -msgstr ":mod:`xdrlib` --- XDR 資料的編碼與解碼" - -#: ../../library/xdrlib.rst:8 -msgid "**Source code:** :source:`Lib/xdrlib.py`" -msgstr "**原始碼:**\\ :source:`Lib/xdrlib.py`" - -#: ../../library/xdrlib.rst:14 -msgid "" -"The :mod:`xdrlib` module is deprecated (see :pep:`PEP 594 <594#xdrlib>` for " -"details)." -msgstr "" -":mod:`xdrlib` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 " -"<594#xdrlib>`\\ )。" - -#: ../../library/xdrlib.rst:20 -msgid "" -"The :mod:`xdrlib` module supports the External Data Representation Standard " -"as described in :rfc:`1014`, written by Sun Microsystems, Inc. June 1987. " -"It supports most of the data types described in the RFC." -msgstr "" - -#: ../../library/xdrlib.rst:24 -msgid "" -"The :mod:`xdrlib` module defines two classes, one for packing variables into " -"XDR representation, and another for unpacking from XDR representation. " -"There are also two exception classes." -msgstr "" - -#: ../../library/xdrlib.rst:31 -msgid "" -":class:`Packer` is the class for packing data into XDR representation. The :" -"class:`Packer` class is instantiated with no arguments." -msgstr "" - -#: ../../library/xdrlib.rst:37 -msgid "" -"``Unpacker`` is the complementary class which unpacks XDR data values from a " -"string buffer. The input buffer is given as *data*." -msgstr "" - -#: ../../library/xdrlib.rst:43 -msgid ":rfc:`1014` - XDR: External Data Representation Standard" -msgstr "" - -#: ../../library/xdrlib.rst:44 -msgid "" -"This RFC defined the encoding of data which was XDR at the time this module " -"was originally written. It has apparently been obsoleted by :rfc:`1832`." -msgstr "" - -#: ../../library/xdrlib.rst:47 -msgid ":rfc:`1832` - XDR: External Data Representation Standard" -msgstr "" - -#: ../../library/xdrlib.rst:48 -msgid "Newer RFC that provides a revised definition of XDR." -msgstr "" - -#: ../../library/xdrlib.rst:54 -msgid "Packer Objects" -msgstr "" - -#: ../../library/xdrlib.rst:56 -msgid ":class:`Packer` instances have the following methods:" -msgstr "" - -#: ../../library/xdrlib.rst:61 -msgid "Returns the current pack buffer as a string." -msgstr "" - -#: ../../library/xdrlib.rst:66 -msgid "Resets the pack buffer to the empty string." -msgstr "" - -#: ../../library/xdrlib.rst:68 -msgid "" -"In general, you can pack any of the most common XDR data types by calling " -"the appropriate ``pack_type()`` method. Each method takes a single " -"argument, the value to pack. The following simple data type packing methods " -"are supported: :meth:`pack_uint`, :meth:`pack_int`, :meth:`pack_enum`, :meth:" -"`pack_bool`, :meth:`pack_uhyper`, and :meth:`pack_hyper`." -msgstr "" - -#: ../../library/xdrlib.rst:77 -msgid "Packs the single-precision floating point number *value*." -msgstr "" - -#: ../../library/xdrlib.rst:82 -msgid "Packs the double-precision floating point number *value*." -msgstr "" - -#: ../../library/xdrlib.rst:84 -msgid "The following methods support packing strings, bytes, and opaque data:" -msgstr "" - -#: ../../library/xdrlib.rst:89 -msgid "" -"Packs a fixed length string, *s*. *n* is the length of the string but it is " -"*not* packed into the data buffer. The string is padded with null bytes if " -"necessary to guaranteed 4 byte alignment." -msgstr "" - -#: ../../library/xdrlib.rst:96 -msgid "" -"Packs a fixed length opaque data stream, similarly to :meth:`pack_fstring`." -msgstr "" - -#: ../../library/xdrlib.rst:101 -msgid "" -"Packs a variable length string, *s*. The length of the string is first " -"packed as an unsigned integer, then the string data is packed with :meth:" -"`pack_fstring`." -msgstr "" - -#: ../../library/xdrlib.rst:108 -msgid "" -"Packs a variable length opaque data string, similarly to :meth:`pack_string`." -msgstr "" - -#: ../../library/xdrlib.rst:113 -msgid "Packs a variable length byte stream, similarly to :meth:`pack_string`." -msgstr "" - -#: ../../library/xdrlib.rst:115 -msgid "The following methods support packing arrays and lists:" -msgstr "" - -#: ../../library/xdrlib.rst:120 -msgid "" -"Packs a *list* of homogeneous items. This method is useful for lists with " -"an indeterminate size; i.e. the size is not available until the entire list " -"has been walked. For each item in the list, an unsigned integer ``1`` is " -"packed first, followed by the data value from the list. *pack_item* is the " -"function that is called to pack the individual item. At the end of the " -"list, an unsigned integer ``0`` is packed." -msgstr "" - -#: ../../library/xdrlib.rst:127 -msgid "" -"For example, to pack a list of integers, the code might appear like this::" -msgstr "" - -#: ../../library/xdrlib.rst:129 -msgid "" -"import xdrlib\n" -"p = xdrlib.Packer()\n" -"p.pack_list([1, 2, 3], p.pack_int)" -msgstr "" -"import xdrlib\n" -"p = xdrlib.Packer()\n" -"p.pack_list([1, 2, 3], p.pack_int)" - -#: ../../library/xdrlib.rst:136 -msgid "" -"Packs a fixed length list (*array*) of homogeneous items. *n* is the length " -"of the list; it is *not* packed into the buffer, but a :exc:`ValueError` " -"exception is raised if ``len(array)`` is not equal to *n*. As above, " -"*pack_item* is the function used to pack each element." -msgstr "" - -#: ../../library/xdrlib.rst:144 -msgid "" -"Packs a variable length *list* of homogeneous items. First, the length of " -"the list is packed as an unsigned integer, then each element is packed as " -"in :meth:`pack_farray` above." -msgstr "" - -#: ../../library/xdrlib.rst:152 -msgid "Unpacker Objects" -msgstr "" - -#: ../../library/xdrlib.rst:154 -msgid "The :class:`Unpacker` class offers the following methods:" -msgstr "" - -#: ../../library/xdrlib.rst:159 -msgid "Resets the string buffer with the given *data*." -msgstr "" - -#: ../../library/xdrlib.rst:164 -msgid "Returns the current unpack position in the data buffer." -msgstr "" - -#: ../../library/xdrlib.rst:169 -msgid "" -"Sets the data buffer unpack position to *position*. You should be careful " -"about using :meth:`get_position` and :meth:`set_position`." -msgstr "" - -#: ../../library/xdrlib.rst:175 -msgid "Returns the current unpack data buffer as a string." -msgstr "" - -#: ../../library/xdrlib.rst:180 -msgid "" -"Indicates unpack completion. Raises an :exc:`Error` exception if all of the " -"data has not been unpacked." -msgstr "" - -#: ../../library/xdrlib.rst:183 -msgid "" -"In addition, every data type that can be packed with a :class:`Packer`, can " -"be unpacked with an :class:`Unpacker`. Unpacking methods are of the form " -"``unpack_type()``, and take no arguments. They return the unpacked object." -msgstr "" - -#: ../../library/xdrlib.rst:190 -msgid "Unpacks a single-precision floating point number." -msgstr "" - -#: ../../library/xdrlib.rst:195 -msgid "" -"Unpacks a double-precision floating point number, similarly to :meth:" -"`unpack_float`." -msgstr "" - -#: ../../library/xdrlib.rst:198 -msgid "" -"In addition, the following methods unpack strings, bytes, and opaque data:" -msgstr "" - -#: ../../library/xdrlib.rst:203 -msgid "" -"Unpacks and returns a fixed length string. *n* is the number of characters " -"expected. Padding with null bytes to guaranteed 4 byte alignment is assumed." -msgstr "" - -#: ../../library/xdrlib.rst:209 -msgid "" -"Unpacks and returns a fixed length opaque data stream, similarly to :meth:" -"`unpack_fstring`." -msgstr "" - -#: ../../library/xdrlib.rst:215 -msgid "" -"Unpacks and returns a variable length string. The length of the string is " -"first unpacked as an unsigned integer, then the string data is unpacked " -"with :meth:`unpack_fstring`." -msgstr "" - -#: ../../library/xdrlib.rst:222 -msgid "" -"Unpacks and returns a variable length opaque data string, similarly to :meth:" -"`unpack_string`." -msgstr "" - -#: ../../library/xdrlib.rst:228 -msgid "" -"Unpacks and returns a variable length byte stream, similarly to :meth:" -"`unpack_string`." -msgstr "" - -#: ../../library/xdrlib.rst:231 -msgid "The following methods support unpacking arrays and lists:" -msgstr "" - -#: ../../library/xdrlib.rst:236 -msgid "" -"Unpacks and returns a list of homogeneous items. The list is unpacked one " -"element at a time by first unpacking an unsigned integer flag. If the flag " -"is ``1``, then the item is unpacked and appended to the list. A flag of " -"``0`` indicates the end of the list. *unpack_item* is the function that is " -"called to unpack the items." -msgstr "" - -#: ../../library/xdrlib.rst:245 -msgid "" -"Unpacks and returns (as a list) a fixed length array of homogeneous items. " -"*n* is number of list elements to expect in the buffer. As above, " -"*unpack_item* is the function used to unpack each element." -msgstr "" - -#: ../../library/xdrlib.rst:252 -msgid "" -"Unpacks and returns a variable length *list* of homogeneous items. First, " -"the length of the list is unpacked as an unsigned integer, then each element " -"is unpacked as in :meth:`unpack_farray` above." -msgstr "" - -#: ../../library/xdrlib.rst:260 -msgid "Exceptions" -msgstr "例外" - -#: ../../library/xdrlib.rst:262 -msgid "Exceptions in this module are coded as class instances:" -msgstr "" - -#: ../../library/xdrlib.rst:267 -msgid "" -"The base exception class. :exc:`Error` has a single public attribute :attr:" -"`msg` containing the description of the error." -msgstr "" - -#: ../../library/xdrlib.rst:273 -msgid "" -"Class derived from :exc:`Error`. Contains no additional instance variables." -msgstr "" - -#: ../../library/xdrlib.rst:275 -msgid "Here is an example of how you would catch one of these exceptions::" -msgstr "" - -#: ../../library/xdrlib.rst:277 -msgid "" -"import xdrlib\n" -"p = xdrlib.Packer()\n" -"try:\n" -" p.pack_double(8.01)\n" -"except xdrlib.ConversionError as instance:\n" -" print('packing the double failed:', instance.msg)" -msgstr "" -"import xdrlib\n" -"p = xdrlib.Packer()\n" -"try:\n" -" p.pack_double(8.01)\n" -"except xdrlib.ConversionError as instance:\n" -" print('packing the double failed:', instance.msg)" - -#: ../../library/xdrlib.rst:10 -msgid "XDR" -msgstr "XDR" - -#: ../../library/xdrlib.rst:10 -msgid "External Data Representation" -msgstr "External Data Representation (外部資料表示)" diff --git a/library/xml.etree.elementtree.po b/library/xml.etree.elementtree.po index cb631dab21..b5a9518fc2 100644 --- a/library/xml.etree.elementtree.po +++ b/library/xml.etree.elementtree.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1907,7 +1907,7 @@ msgstr "" #: ../../library/xml.etree.elementtree.rst:1376 msgid "" "Parameters are now :ref:`keyword-only `. The *html* " -"argument no longer supported." +"argument is no longer supported." msgstr "" #: ../../library/xml.etree.elementtree.rst:1383 diff --git a/library/xmlrpc.client.po b/library/xmlrpc.client.po index efbc83579f..927aeeba24 100644 --- a/library/xmlrpc.client.po +++ b/library/xmlrpc.client.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -49,16 +49,15 @@ msgstr "" #: ../../includes/wasm-notavail.rst:3 msgid ":ref:`Availability `: not WASI." -msgstr "" +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/xmlrpc.client.rst:41 msgid "" @@ -282,8 +281,7 @@ msgstr "" #: ../../library/xmlrpc.client.rst:168 msgid "" -"`XML-RPC Introspection `_" +"`XML-RPC Introspection `_" msgstr "" #: ../../library/xmlrpc.client.rst:169 diff --git a/library/xmlrpc.server.po b/library/xmlrpc.server.po index c3daa17cde..7e1eba8c5a 100644 --- a/library/xmlrpc.server.po +++ b/library/xmlrpc.server.po @@ -43,16 +43,15 @@ msgstr "" #: ../../includes/wasm-notavail.rst:3 msgid ":ref:`Availability `: not WASI." -msgstr "" +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/xmlrpc.server.rst:32 msgid "" diff --git a/library/zoneinfo.po b/library/zoneinfo.po index 3e5a4a6662..0859e10f69 100644 --- a/library/zoneinfo.po +++ b/library/zoneinfo.po @@ -56,16 +56,15 @@ msgstr "" #: ../../includes/wasm-notavail.rst:3 msgid ":ref:`Availability `: not WASI." -msgstr "" +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 -#, fuzzy msgid "" "This module does not work or is not available on WebAssembly. See :ref:`wasm-" "availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/zoneinfo.rst:35 msgid "Using ``ZoneInfo``" diff --git a/reference/datamodel.po b/reference/datamodel.po index d9ac935995..66e8a576fa 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -1139,9 +1139,8 @@ msgid "" msgstr "" #: ../../reference/datamodel.rst:1002 -#, fuzzy msgid ":attr:`~class.__static_attributes__`" -msgstr ":attr:`~class.__bases__`" +msgstr ":attr:`~class.__static_attributes__`" #: ../../reference/datamodel.rst:1003 msgid "" @@ -1150,9 +1149,8 @@ msgid "" msgstr "" #: ../../reference/datamodel.rst:1006 -#, fuzzy msgid ":attr:`__firstlineno__`" -msgstr ":attr:`__file__`" +msgstr ":attr:`__firstlineno__`" #: ../../reference/datamodel.rst:1007 msgid "" diff --git a/reference/introduction.po b/reference/introduction.po index 94633cbb7f..41407dcc00 100644 --- a/reference/introduction.po +++ b/reference/introduction.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -137,8 +137,8 @@ msgid "" "support and a Just in Time compiler. One of the goals of the project is to " "encourage experimentation with the language itself by making it easier to " "modify the interpreter (since it is written in Python). Additional " -"information is available on `the PyPy project's home page `_." +"information is available on `the PyPy project's home page `_." msgstr "" #: ../../reference/introduction.rst:79 diff --git a/sphinx.po b/sphinx.po index 2e0b49145c..5729a9b54b 100644 --- a/sphinx.po +++ b/sphinx.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -66,38 +66,18 @@ msgid "Packed as .tar.bz2" msgstr "打包成 .tar.bz2" #: ../../tools/templates/download.html:28 -msgid "PDF (US-Letter paper size)" -msgstr "PDF(美國信紙大小)" +msgid "PDF" +msgstr "PDF" #: ../../tools/templates/download.html:29 msgid "" -"Download " -"(ca. %(download_size)s MiB)" -msgstr "" -"下載 (ca. " -"%(download_size)s MiB)" - -#: ../../tools/templates/download.html:30 -msgid "" -"Download (ca. %(download_size)s MiB)" -msgstr "" -"下載 " -"(ca. %(download_size)s MiB)" - -#: ../../tools/templates/download.html:33 -msgid "PDF (A4 paper size)" -msgstr "PDF(A4 紙張大小)" - -#: ../../tools/templates/download.html:34 -msgid "" "Download (ca. " "%(download_size)s MiB)" msgstr "" "下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:35 +#: ../../tools/templates/download.html:30 msgid "" "Download " "(ca. %(download_size)s MiB)" @@ -105,11 +85,11 @@ msgstr "" "下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:38 +#: ../../tools/templates/download.html:33 msgid "HTML" msgstr "HTML" -#: ../../tools/templates/download.html:39 +#: ../../tools/templates/download.html:34 msgid "" "Download (ca. " "%(download_size)s MiB)" @@ -117,7 +97,7 @@ msgstr "" "下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:40 +#: ../../tools/templates/download.html:35 msgid "" "Download " "(ca. %(download_size)s MiB)" @@ -125,11 +105,11 @@ msgstr "" "下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:43 +#: ../../tools/templates/download.html:38 msgid "Plain text" msgstr "純文字" -#: ../../tools/templates/download.html:44 +#: ../../tools/templates/download.html:39 msgid "" "Download (ca. " "%(download_size)s MiB)" @@ -137,7 +117,7 @@ msgstr "" "下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:45 +#: ../../tools/templates/download.html:40 msgid "" "Download " "(ca. %(download_size)s MiB)" @@ -145,11 +125,11 @@ msgstr "" "下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:48 +#: ../../tools/templates/download.html:43 msgid "Texinfo" msgstr "Texinfo" -#: ../../tools/templates/download.html:49 +#: ../../tools/templates/download.html:44 msgid "" "Download (ca. " "%(download_size)s MiB)" @@ -157,7 +137,7 @@ msgstr "" "下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:50 +#: ../../tools/templates/download.html:45 msgid "" "Download " "(ca. %(download_size)s MiB)" @@ -165,11 +145,11 @@ msgstr "" "下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:53 +#: ../../tools/templates/download.html:48 msgid "EPUB" msgstr "EPUB" -#: ../../tools/templates/download.html:54 +#: ../../tools/templates/download.html:49 msgid "" "Download (ca. " "%(download_size)s MiB)" @@ -177,15 +157,15 @@ msgstr "" "下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:59 +#: ../../tools/templates/download.html:54 msgid "These archives contain all the content in the documentation." msgstr "這些歸檔包含了說明文件中的所有內容。" -#: ../../tools/templates/download.html:62 +#: ../../tools/templates/download.html:57 msgid "Unpacking" msgstr "解壓縮" -#: ../../tools/templates/download.html:64 +#: ../../tools/templates/download.html:59 msgid "" "Unix users should download the .tar.bz2 archives; these are bzipped tar\n" "archives and can be handled in the usual way using tar and the bzip2\n" @@ -200,7 +180,7 @@ msgstr "" "net\">Info-ZIP 解壓縮程式來處理 ZIP 歸檔。.tar.bz2 歸檔提供最佳壓縮率和最" "快的下載時間。" -#: ../../tools/templates/download.html:70 +#: ../../tools/templates/download.html:65 msgid "" "Windows users can use the ZIP archives since those are customary on that\n" "platform. These are created on Unix using the Info-ZIP zip program." @@ -208,11 +188,11 @@ msgstr "" "Windows 使用者可以使用 ZIP 歸檔,因為這在該平台上是常見的。這些是在 Unix 上使" "用 Info-ZIP zip 程式建立的。" -#: ../../tools/templates/download.html:74 +#: ../../tools/templates/download.html:69 msgid "Problems" msgstr "問題" -#: ../../tools/templates/download.html:76 +#: ../../tools/templates/download.html:71 msgid "" "If you have comments or suggestions for the Python documentation, please " "send\n" diff --git a/tutorial/errors.po b/tutorial/errors.po index 6e4e0d9bd0..fd65d5efcd 100644 --- a/tutorial/errors.po +++ b/tutorial/errors.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2022-10-24 14:54+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -99,30 +99,42 @@ msgid "" ">>> 10 * (1/0)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" +" 10 * (1/0)\n" +" ~^~\n" "ZeroDivisionError: division by zero\n" ">>> 4 + spam*3\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" +" 4 + spam*3\n" +" ^^^^\n" "NameError: name 'spam' is not defined\n" ">>> '2' + 2\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" +" '2' + 2\n" +" ~~~~^~~\n" "TypeError: can only concatenate str (not \"int\") to str" msgstr "" ">>> 10 * (1/0)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" +" 10 * (1/0)\n" +" ~^~\n" "ZeroDivisionError: division by zero\n" ">>> 4 + spam*3\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" +" 4 + spam*3\n" +" ^^^^\n" "NameError: name 'spam' is not defined\n" ">>> '2' + 2\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" +" '2' + 2\n" +" ~~~~^~~\n" "TypeError: can only concatenate str (not \"int\") to str" -#: ../../tutorial/errors.rst:58 +#: ../../tutorial/errors.rst:64 msgid "" "The last line of the error message indicates what happened. Exceptions come " "in different types, and the type is printed as part of the message: the " @@ -140,13 +152,13 @@ msgstr "" "需要遵守(雖然這是一個有用的慣例)。標準例外名稱是內建的識別字 (identifier)," "不是保留關鍵字 (reserved keyword)。" -#: ../../tutorial/errors.rst:66 +#: ../../tutorial/errors.rst:72 msgid "" "The rest of the line provides detail based on the type of exception and what " "caused it." msgstr "此行其餘部分,根據例外的類型及導致例外的原因,說明例外的細節。" -#: ../../tutorial/errors.rst:69 +#: ../../tutorial/errors.rst:75 msgid "" "The preceding part of the error message shows the context where the " "exception occurred, in the form of a stack traceback. In general it contains " @@ -157,16 +169,16 @@ msgstr "" "說,它含有一個列出源程式碼行 (source line) 的堆疊回溯;但它不會顯示從標準輸入" "中讀取的程式碼。" -#: ../../tutorial/errors.rst:74 +#: ../../tutorial/errors.rst:80 msgid "" ":ref:`bltin-exceptions` lists the built-in exceptions and their meanings." msgstr ":ref:`bltin-exceptions`\\ 章節列出內建的例外及它們的意義。" -#: ../../tutorial/errors.rst:80 +#: ../../tutorial/errors.rst:86 msgid "Handling Exceptions" msgstr "處理例外" -#: ../../tutorial/errors.rst:82 +#: ../../tutorial/errors.rst:88 msgid "" "It is possible to write programs that handle selected exceptions. Look at " "the following example, which asks the user for input until a valid integer " @@ -180,7 +192,7 @@ msgstr "" "令);請注意,由使用者產生的程式中斷會引發 :exc:`KeyboardInterrupt` 例外信" "號。 ::" -#: ../../tutorial/errors.rst:88 +#: ../../tutorial/errors.rst:94 msgid "" ">>> while True:\n" "... try:\n" @@ -198,11 +210,11 @@ msgstr "" "... print(\"Oops! That was no valid number. Try again...\")\n" "..." -#: ../../tutorial/errors.rst:96 +#: ../../tutorial/errors.rst:102 msgid "The :keyword:`try` statement works as follows." msgstr ":keyword:`try` 陳述式運作方式如下。" -#: ../../tutorial/errors.rst:98 +#: ../../tutorial/errors.rst:104 msgid "" "First, the *try clause* (the statement(s) between the :keyword:`try` and :" "keyword:`except` keywords) is executed." @@ -210,7 +222,7 @@ msgstr "" "首先,執行 *try 子句*\\ (\\ :keyword:`try` 和 :keyword:`except` 關鍵字之間的" "陳述式)。" -#: ../../tutorial/errors.rst:101 +#: ../../tutorial/errors.rst:107 msgid "" "If no exception occurs, the *except clause* is skipped and execution of the :" "keyword:`try` statement is finished." @@ -218,7 +230,7 @@ msgstr "" "如果沒有發生例外,則 *except 子句*\\ 會被跳過,:keyword:`try` 陳述式執行完" "畢。" -#: ../../tutorial/errors.rst:104 +#: ../../tutorial/errors.rst:110 msgid "" "If an exception occurs during execution of the :keyword:`try` clause, the " "rest of the clause is skipped. Then, if its type matches the exception " @@ -229,7 +241,7 @@ msgstr "" "例外的類型與 :keyword:`except` 關鍵字後面的例外名稱相符,則 *except 子句*\\ " "被執行,然後,繼續執行 try/except 區塊之後的程式碼。" -#: ../../tutorial/errors.rst:109 +#: ../../tutorial/errors.rst:115 msgid "" "If an exception occurs which does not match the exception named in the " "*except clause*, it is passed on to outer :keyword:`try` statements; if no " @@ -240,7 +252,7 @@ msgstr "" "`try` 陳述式;如果仍無法找到處理者,則它是一個\\ *未處理例外 (unhandled " "exception)*,執行將停止,並顯示錯誤訊息。" -#: ../../tutorial/errors.rst:113 +#: ../../tutorial/errors.rst:119 msgid "" "A :keyword:`try` statement may have more than one *except clause*, to " "specify handlers for different exceptions. At most one handler will be " @@ -254,7 +266,7 @@ msgstr "" "理同一 :keyword:`!try` 陳述式裡其他處理者內的例外。一個 *except 子句*\\ 可以" "用一組括號內的 tuple 列舉多個例外,例如: ::" -#: ../../tutorial/errors.rst:119 +#: ../../tutorial/errors.rst:125 msgid "" "... except (RuntimeError, TypeError, NameError):\n" "... pass" @@ -262,7 +274,7 @@ msgstr "" "... except (RuntimeError, TypeError, NameError):\n" "... pass" -#: ../../tutorial/errors.rst:122 +#: ../../tutorial/errors.rst:128 #, fuzzy msgid "" "A class in an :keyword:`except` clause matches exceptions which are " @@ -276,7 +288,7 @@ msgstr "" "derived class (衍生類別)的 *except 子句*\\ 並不能與 base class 相容。例如," "以下程式碼會依序印出 B、C、D: ::" -#: ../../tutorial/errors.rst:127 +#: ../../tutorial/errors.rst:133 msgid "" "class B(Exception):\n" " pass\n" @@ -316,7 +328,7 @@ msgstr "" " except B:\n" " print(\"B\")" -#: ../../tutorial/errors.rst:146 +#: ../../tutorial/errors.rst:152 msgid "" "Note that if the *except clauses* were reversed (with ``except B`` first), " "it would have printed B, B, B --- the first matching *except clause* is " @@ -325,7 +337,7 @@ msgstr "" "請注意,如果 *except 子句*\\ 的順序被反轉(把 ``except B`` 放到第一個),則會" "印出 B、B、B ­­——第一個符合的 *except 子句*\\ 會被觸發。" -#: ../../tutorial/errors.rst:149 +#: ../../tutorial/errors.rst:155 msgid "" "When an exception occurs, it may have associated values, also known as the " "exception's *arguments*. The presence and types of the arguments depend on " @@ -334,7 +346,7 @@ msgstr "" "當例外發生時,它可能有相關聯的值,也就是例外的\\ *引數*。引數的存在與否及它的" "類型,是取決於例外的類型。" -#: ../../tutorial/errors.rst:153 +#: ../../tutorial/errors.rst:159 msgid "" "The *except clause* may specify a variable after the exception name. The " "variable is bound to the exception instance which typically has an ``args`` " @@ -346,7 +358,7 @@ msgstr "" "(instance),其引數通常儲存在 ``args`` 屬性中。為了方便,內建例外型別定義了 :" "meth:`~object.__str__` 以印出所有引數而不需顯式地取用 ``.args``: ::" -#: ../../tutorial/errors.rst:159 +#: ../../tutorial/errors.rst:165 msgid "" ">>> try:\n" "... raise Exception('spam', 'eggs')\n" @@ -367,7 +379,7 @@ msgid "" "y = eggs" msgstr "" -#: ../../tutorial/errors.rst:176 +#: ../../tutorial/errors.rst:182 msgid "" "The exception's :meth:`~object.__str__` output is printed as the last part " "('detail') of the message for unhandled exceptions." @@ -375,7 +387,7 @@ msgstr "" "例外的 :meth:`~object.__str__` 輸出會被印在未處理例外訊息的最後一部分(「細" "節」)。" -#: ../../tutorial/errors.rst:179 +#: ../../tutorial/errors.rst:185 msgid "" ":exc:`BaseException` is the common base class of all exceptions. One of its " "subclasses, :exc:`Exception`, is the base class of all the non-fatal " @@ -391,7 +403,7 @@ msgstr "" "它們是用來指示程式應該終止。這些例外包括了由 :meth:`sys.exit` 所引發的 :exc:" "`SystemExit`,以及當使用者想要中斷程式時所引發的 :exc:`KeyboardInterrupt`。" -#: ../../tutorial/errors.rst:187 +#: ../../tutorial/errors.rst:193 msgid "" ":exc:`Exception` can be used as a wildcard that catches (almost) everything. " "However, it is good practice to be as specific as possible with the types of " @@ -402,7 +414,7 @@ msgstr "" "較好的做法是盡可能具體地說明我們打算處理的例外類型,並容許任何非預期例外的傳" "遞 (propagate)。" -#: ../../tutorial/errors.rst:192 +#: ../../tutorial/errors.rst:198 msgid "" "The most common pattern for handling :exc:`Exception` is to print or log the " "exception and then re-raise it (allowing a caller to handle the exception as " @@ -411,7 +423,7 @@ msgstr "" "處理 :exc:`Exception` 的最常見模式,是先將該例外印出或記錄,然後再重新引發它" "(也允許一個呼叫函式 (caller) 來處理該例外): ::" -#: ../../tutorial/errors.rst:196 +#: ../../tutorial/errors.rst:202 msgid "" "import sys\n" "\n" @@ -441,7 +453,7 @@ msgstr "" " print(f\"Unexpected {err=}, {type(err)=}\")\n" " raise" -#: ../../tutorial/errors.rst:210 +#: ../../tutorial/errors.rst:216 msgid "" "The :keyword:`try` ... :keyword:`except` statement has an optional *else " "clause*, which, when present, must follow all *except clauses*. It is " @@ -452,7 +464,7 @@ msgstr "" "時,該子句必須放在所有 *except 子句*\\ 之後。如果一段程式碼必須被執行,但 " "*try 子句*\\ 又沒有引發例外時,這個子句很有用。例如: ::" -#: ../../tutorial/errors.rst:215 +#: ../../tutorial/errors.rst:221 msgid "" "for arg in sys.argv[1:]:\n" " try:\n" @@ -472,7 +484,7 @@ msgstr "" " print(arg, 'has', len(f.readlines()), 'lines')\n" " f.close()" -#: ../../tutorial/errors.rst:224 +#: ../../tutorial/errors.rst:230 msgid "" "The use of the :keyword:`!else` clause is better than adding additional code " "to the :keyword:`try` clause because it avoids accidentally catching an " @@ -483,7 +495,7 @@ msgstr "" "這可以避免意外地捕獲不是由 :keyword:`!try` ... :keyword:`!except` 陳述式保護" "的程式碼所引發的例外。" -#: ../../tutorial/errors.rst:229 +#: ../../tutorial/errors.rst:235 msgid "" "Exception handlers do not handle only exceptions that occur immediately in " "the *try clause*, but also those that occur inside functions that are called " @@ -492,7 +504,7 @@ msgstr "" "例外的處理者不僅處理 *try 子句*\\ 內立即發生的例外,還處理 *try 子句*\\ 內" "(即使是間接地)呼叫的函式內部發生的例外。例如: ::" -#: ../../tutorial/errors.rst:233 +#: ../../tutorial/errors.rst:239 msgid "" ">>> def this_fails():\n" "... x = 1/0\n" @@ -514,29 +526,31 @@ msgstr "" "...\n" "Handling run-time error: division by zero" -#: ../../tutorial/errors.rst:247 +#: ../../tutorial/errors.rst:253 msgid "Raising Exceptions" msgstr "引發例外" -#: ../../tutorial/errors.rst:249 +#: ../../tutorial/errors.rst:255 msgid "" "The :keyword:`raise` statement allows the programmer to force a specified " "exception to occur. For example::" msgstr ":keyword:`raise` 陳述式可讓程式設計師強制引發指定的例外。例如: ::" -#: ../../tutorial/errors.rst:252 +#: ../../tutorial/errors.rst:258 msgid "" ">>> raise NameError('HiThere')\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" +" raise NameError('HiThere')\n" "NameError: HiThere" msgstr "" ">>> raise NameError('HiThere')\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" +" raise NameError('HiThere')\n" "NameError: HiThere" -#: ../../tutorial/errors.rst:257 +#: ../../tutorial/errors.rst:264 msgid "" "The sole argument to :keyword:`raise` indicates the exception to be raised. " "This must be either an exception instance or an exception class (a class " @@ -549,11 +563,11 @@ msgstr "" "的 subclass)。如果一個例外 class 被傳遞,它會不含引數地呼叫它的建構函式 " "(constructor) ,使它被自動建立實例 (implicitly instantiated): ::" -#: ../../tutorial/errors.rst:263 +#: ../../tutorial/errors.rst:270 msgid "raise ValueError # shorthand for 'raise ValueError()'" msgstr "raise ValueError # 'raise ValueError()' 的簡寫" -#: ../../tutorial/errors.rst:265 +#: ../../tutorial/errors.rst:272 msgid "" "If you need to determine whether an exception was raised but don't intend to " "handle it, a simpler form of the :keyword:`raise` statement allows you to re-" @@ -562,7 +576,7 @@ msgstr "" "如果你只想判斷是否引發了例外,但並不打算處理它,則可以使用簡單的 :keyword:" "`raise` 陳述式來重新引發該例外: ::" -#: ../../tutorial/errors.rst:269 +#: ../../tutorial/errors.rst:276 msgid "" ">>> try:\n" "... raise NameError('HiThere')\n" @@ -573,6 +587,7 @@ msgid "" "An exception flew by!\n" "Traceback (most recent call last):\n" " File \"\", line 2, in \n" +" raise NameError('HiThere')\n" "NameError: HiThere" msgstr "" ">>> try:\n" @@ -584,13 +599,14 @@ msgstr "" "An exception flew by!\n" "Traceback (most recent call last):\n" " File \"\", line 2, in \n" +" raise NameError('HiThere')\n" "NameError: HiThere" -#: ../../tutorial/errors.rst:284 +#: ../../tutorial/errors.rst:292 msgid "Exception Chaining" msgstr "例外鏈接 (Exception Chaining)" -#: ../../tutorial/errors.rst:286 +#: ../../tutorial/errors.rst:294 msgid "" "If an unhandled exception occurs inside an :keyword:`except` section, it " "will have the exception being handled attached to it and included in the " @@ -599,7 +615,7 @@ msgstr "" "如果在 :keyword:`except` 段落內部發生了一個未處理的例外,則它會讓這個將要被處" "理的例外附加在後,並將其包含在錯誤訊息中: ::" -#: ../../tutorial/errors.rst:290 +#: ../../tutorial/errors.rst:298 msgid "" ">>> try:\n" "... open(\"database.sqlite\")\n" @@ -608,12 +624,15 @@ msgid "" "...\n" "Traceback (most recent call last):\n" " File \"\", line 2, in \n" +" open(\"database.sqlite\")\n" +" ~~~~^^^^^^^^^^^^^^^^^^^\n" "FileNotFoundError: [Errno 2] No such file or directory: 'database.sqlite'\n" "\n" "During handling of the above exception, another exception occurred:\n" "\n" "Traceback (most recent call last):\n" " File \"\", line 4, in \n" +" raise RuntimeError(\"unable to handle error\")\n" "RuntimeError: unable to handle error" msgstr "" ">>> try:\n" @@ -623,15 +642,18 @@ msgstr "" "...\n" "Traceback (most recent call last):\n" " File \"\", line 2, in \n" +" open(\"database.sqlite\")\n" +" ~~~~^^^^^^^^^^^^^^^^^^^\n" "FileNotFoundError: [Errno 2] No such file or directory: 'database.sqlite'\n" "\n" "During handling of the above exception, another exception occurred:\n" "\n" "Traceback (most recent call last):\n" " File \"\", line 4, in \n" +" raise RuntimeError(\"unable to handle error\")\n" "RuntimeError: unable to handle error" -#: ../../tutorial/errors.rst:305 +#: ../../tutorial/errors.rst:316 msgid "" "To indicate that an exception is a direct consequence of another, the :" "keyword:`raise` statement allows an optional :keyword:`from` clause::" @@ -639,7 +661,7 @@ msgstr "" "為了表明一個例外是另一個例外直接造成的結果,:keyword:`raise` 陳述式容許一個選" "擇性的 :keyword:`from` 子句: ::" -#: ../../tutorial/errors.rst:308 +#: ../../tutorial/errors.rst:319 msgid "" "# exc must be exception instance or None.\n" "raise RuntimeError from exc" @@ -647,11 +669,11 @@ msgstr "" "# exc 必須是例外實例或 None。\n" "raise RuntimeError from exc" -#: ../../tutorial/errors.rst:311 +#: ../../tutorial/errors.rst:322 msgid "This can be useful when you are transforming exceptions. For example::" msgstr "要變換例外時,這種方式很有用。例如: ::" -#: ../../tutorial/errors.rst:313 +#: ../../tutorial/errors.rst:324 msgid "" ">>> def func():\n" "... raise ConnectionError\n" @@ -663,6 +685,8 @@ msgid "" "...\n" "Traceback (most recent call last):\n" " File \"\", line 2, in \n" +" func()\n" +" ~~~~^^\n" " File \"\", line 2, in func\n" "ConnectionError\n" "\n" @@ -670,6 +694,7 @@ msgid "" "\n" "Traceback (most recent call last):\n" " File \"\", line 4, in \n" +" raise RuntimeError('Failed to open database') from exc\n" "RuntimeError: Failed to open database" msgstr "" ">>> def func():\n" @@ -682,6 +707,8 @@ msgstr "" "...\n" "Traceback (most recent call last):\n" " File \"\", line 2, in \n" +" func()\n" +" ~~~~^^\n" " File \"\", line 2, in func\n" "ConnectionError\n" "\n" @@ -689,15 +716,16 @@ msgstr "" "\n" "Traceback (most recent call last):\n" " File \"\", line 4, in \n" +" raise RuntimeError('Failed to open database') from exc\n" "RuntimeError: Failed to open database" -#: ../../tutorial/errors.rst:332 +#: ../../tutorial/errors.rst:346 msgid "" "It also allows disabling automatic exception chaining using the ``from " "None`` idiom::" msgstr "它也容許使用慣用語 ``from None`` 來停用自動例外鏈接: ::" -#: ../../tutorial/errors.rst:335 +#: ../../tutorial/errors.rst:349 msgid "" ">>> try:\n" "... open('database.sqlite')\n" @@ -706,6 +734,7 @@ msgid "" "...\n" "Traceback (most recent call last):\n" " File \"\", line 4, in \n" +" raise RuntimeError from None\n" "RuntimeError" msgstr "" ">>> try:\n" @@ -715,18 +744,19 @@ msgstr "" "...\n" "Traceback (most recent call last):\n" " File \"\", line 4, in \n" +" raise RuntimeError from None\n" "RuntimeError" -#: ../../tutorial/errors.rst:344 +#: ../../tutorial/errors.rst:359 msgid "" "For more information about chaining mechanics, see :ref:`bltin-exceptions`." msgstr "更多關於鏈接機制的資訊,詳見\\ :ref:`bltin-exceptions`。" -#: ../../tutorial/errors.rst:350 +#: ../../tutorial/errors.rst:365 msgid "User-defined Exceptions" msgstr "使用者自定的例外" -#: ../../tutorial/errors.rst:352 +#: ../../tutorial/errors.rst:367 msgid "" "Programs may name their own exceptions by creating a new exception class " "(see :ref:`tut-classes` for more about Python classes). Exceptions should " @@ -737,7 +767,7 @@ msgstr "" "\\ :ref:`tut-classes`\\ )。不論是直接還是間接地,例外通常應該從 :exc:" "`Exception` class 衍生出來。" -#: ../../tutorial/errors.rst:356 +#: ../../tutorial/errors.rst:371 msgid "" "Exception classes can be defined which do anything any other class can do, " "but are usually kept simple, often only offering a number of attributes that " @@ -747,23 +777,23 @@ msgstr "" "例外 class 可被定義來做任何其他 class 能夠做的事,但通常會讓它維持簡單,只提" "供一些屬性,讓關於錯誤的資訊可被例外的處理者抽取出來。" -#: ../../tutorial/errors.rst:360 +#: ../../tutorial/errors.rst:375 msgid "" "Most exceptions are defined with names that end in \"Error\", similar to the " "naming of the standard exceptions." msgstr "大多數的例外定義,都會以「Error」作為名稱結尾,類似於標準例外的命名。" -#: ../../tutorial/errors.rst:363 +#: ../../tutorial/errors.rst:378 msgid "" "Many standard modules define their own exceptions to report errors that may " "occur in functions they define." msgstr "許多標準模組會定義它們自己的例外,以報告在其定義的函式中發生的錯誤。" -#: ../../tutorial/errors.rst:370 +#: ../../tutorial/errors.rst:385 msgid "Defining Clean-up Actions" msgstr "定義清理動作" -#: ../../tutorial/errors.rst:372 +#: ../../tutorial/errors.rst:387 msgid "" "The :keyword:`try` statement has another optional clause which is intended " "to define clean-up actions that must be executed under all circumstances. " @@ -772,7 +802,7 @@ msgstr "" ":keyword:`try` 陳述式有另一個選擇性子句,用於定義在所有情況下都必須被執行的清" "理動作。例如: ::" -#: ../../tutorial/errors.rst:376 +#: ../../tutorial/errors.rst:391 msgid "" ">>> try:\n" "... raise KeyboardInterrupt\n" @@ -782,6 +812,7 @@ msgid "" "Goodbye, world!\n" "Traceback (most recent call last):\n" " File \"\", line 2, in \n" +" raise KeyboardInterrupt\n" "KeyboardInterrupt" msgstr "" ">>> try:\n" @@ -792,9 +823,10 @@ msgstr "" "Goodbye, world!\n" "Traceback (most recent call last):\n" " File \"\", line 2, in \n" +" raise KeyboardInterrupt\n" "KeyboardInterrupt" -#: ../../tutorial/errors.rst:386 +#: ../../tutorial/errors.rst:402 msgid "" "If a :keyword:`finally` clause is present, the :keyword:`!finally` clause " "will execute as the last task before the :keyword:`try` statement completes. " @@ -807,7 +839,7 @@ msgstr "" "外,都會執行 :keyword:`!finally` 子句。以下幾點將探討例外發生時,比較複雜的情" "況:" -#: ../../tutorial/errors.rst:392 +#: ../../tutorial/errors.rst:408 msgid "" "If an exception occurs during execution of the :keyword:`!try` clause, the " "exception may be handled by an :keyword:`except` clause. If the exception is " @@ -818,7 +850,7 @@ msgstr "" "`except` 子句處理。如果該例外沒有被 :keyword:`!except` 子句處理,它會在 :" "keyword:`!finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:398 +#: ../../tutorial/errors.rst:414 msgid "" "An exception could occur during execution of an :keyword:`!except` or :" "keyword:`!else` clause. Again, the exception is re-raised after the :keyword:" @@ -827,7 +859,7 @@ msgstr "" "一個例外可能發生於 :keyword:`!except` 或 :keyword:`!else` 子句的執行過程。同" "樣地,該例外會在 :keyword:`!finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:402 +#: ../../tutorial/errors.rst:418 msgid "" "If the :keyword:`!finally` clause executes a :keyword:`break`, :keyword:" "`continue` or :keyword:`return` statement, exceptions are not re-raised." @@ -835,7 +867,7 @@ msgstr "" "如果 :keyword:`!finally` 子句執行 :keyword:`break`、:keyword:`continue` 或 :" "keyword:`return` 陳述式,則例外不會被重新引發。" -#: ../../tutorial/errors.rst:406 +#: ../../tutorial/errors.rst:422 msgid "" "If the :keyword:`!try` statement reaches a :keyword:`break`, :keyword:" "`continue` or :keyword:`return` statement, the :keyword:`!finally` clause " @@ -846,7 +878,7 @@ msgstr "" "keyword:`return` 陳述式,則 :keyword:`!finally` 子句會在執行 :keyword:`!" "break`、:keyword:`!continue` 或 :keyword:`!return` 陳述式之前先執行。" -#: ../../tutorial/errors.rst:412 +#: ../../tutorial/errors.rst:428 msgid "" "If a :keyword:`!finally` clause includes a :keyword:`!return` statement, the " "returned value will be the one from the :keyword:`!finally` clause's :" @@ -857,11 +889,11 @@ msgstr "" "自 :keyword:`!finally` 子句的 :keyword:`!return` 陳述式的回傳值,而不是來自 :" "keyword:`!try` 子句的 :keyword:`!return` 陳述式的回傳值。" -#: ../../tutorial/errors.rst:418 +#: ../../tutorial/errors.rst:434 msgid "For example::" msgstr "例如: ::" -#: ../../tutorial/errors.rst:420 +#: ../../tutorial/errors.rst:436 msgid "" ">>> def bool_return():\n" "... try:\n" @@ -881,11 +913,11 @@ msgstr "" ">>> bool_return()\n" "False" -#: ../../tutorial/errors.rst:429 +#: ../../tutorial/errors.rst:445 msgid "A more complicated example::" msgstr "另一個比較複雜的範例: ::" -#: ../../tutorial/errors.rst:431 +#: ../../tutorial/errors.rst:447 msgid "" ">>> def divide(x, y):\n" "... try:\n" @@ -907,7 +939,11 @@ msgid "" "executing finally clause\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" +" divide(\"2\", \"0\")\n" +" ~~~~~~^^^^^^^^^^\n" " File \"\", line 3, in divide\n" +" result = x / y\n" +" ~~^~~\n" "TypeError: unsupported operand type(s) for /: 'str' and 'str'" msgstr "" ">>> def divide(x, y):\n" @@ -930,10 +966,14 @@ msgstr "" "executing finally clause\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" +" divide(\"2\", \"0\")\n" +" ~~~~~~^^^^^^^^^^\n" " File \"\", line 3, in divide\n" +" result = x / y\n" +" ~~^~~\n" "TypeError: unsupported operand type(s) for /: 'str' and 'str'" -#: ../../tutorial/errors.rst:454 +#: ../../tutorial/errors.rst:474 msgid "" "As you can see, the :keyword:`finally` clause is executed in any event. " "The :exc:`TypeError` raised by dividing two strings is not handled by the :" @@ -944,7 +984,7 @@ msgstr "" "的 :exc:`TypeError` 沒有被 :keyword:`except` 子句處理,因此會在 :keyword:`!" "finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:459 +#: ../../tutorial/errors.rst:479 msgid "" "In real world applications, the :keyword:`finally` clause is useful for " "releasing external resources (such as files or network connections), " @@ -953,11 +993,11 @@ msgstr "" "在真實應用程式中,:keyword:`finally` 子句對於釋放外部資源(例如檔案或網路連" "線)很有用,無論該資源的使用是否成功。" -#: ../../tutorial/errors.rst:467 +#: ../../tutorial/errors.rst:487 msgid "Predefined Clean-up Actions" msgstr "預定義的清理動作" -#: ../../tutorial/errors.rst:469 +#: ../../tutorial/errors.rst:489 msgid "" "Some objects define standard clean-up actions to be undertaken when the " "object is no longer needed, regardless of whether or not the operation using " @@ -967,7 +1007,7 @@ msgstr "" "某些物件定義了在物件不再被需要時的標準清理動作,無論使用該物件的作業是成功或" "失敗。請看以下範例,它嘗試開啟一個檔案,並印出檔案內容至螢幕。 ::" -#: ../../tutorial/errors.rst:474 +#: ../../tutorial/errors.rst:494 msgid "" "for line in open(\"myfile.txt\"):\n" " print(line, end=\"\")" @@ -975,7 +1015,7 @@ msgstr "" "for line in open(\"myfile.txt\"):\n" " print(line, end=\"\")" -#: ../../tutorial/errors.rst:477 +#: ../../tutorial/errors.rst:497 msgid "" "The problem with this code is that it leaves the file open for an " "indeterminate amount of time after this part of the code has finished " @@ -989,7 +1029,7 @@ msgstr "" "keyword:`with` 陳述式讓物件(例如檔案)在被使用時,能保證它們總是及時、正確地" "被清理。 ::" -#: ../../tutorial/errors.rst:483 +#: ../../tutorial/errors.rst:503 msgid "" "with open(\"myfile.txt\") as f:\n" " for line in f:\n" @@ -999,7 +1039,7 @@ msgstr "" " for line in f:\n" " print(line, end=\"\")" -#: ../../tutorial/errors.rst:487 +#: ../../tutorial/errors.rst:507 msgid "" "After the statement is executed, the file *f* is always closed, even if a " "problem was encountered while processing the lines. Objects which, like " @@ -1009,11 +1049,11 @@ msgstr "" "陳述式執行完畢後,就算是在處理內容時遇到問題,檔案 *f* 總是會被關閉。和檔案一" "樣,提供預定義清理動作的物件會在說明文件中表明這一點。" -#: ../../tutorial/errors.rst:495 +#: ../../tutorial/errors.rst:515 msgid "Raising and Handling Multiple Unrelated Exceptions" msgstr "引發及處理多個無關的例外" -#: ../../tutorial/errors.rst:497 +#: ../../tutorial/errors.rst:517 msgid "" "There are situations where it is necessary to report several exceptions that " "have occurred. This is often the case in concurrency frameworks, when " @@ -1025,7 +1065,7 @@ msgstr "" "中經常會出現這種情況,當平行的 (parallel) 某些任務可能已經失效,但還有其他用" "例 (use case) 希望能繼續執行並收集多個例外,而不是只有引發第一個例外時。" -#: ../../tutorial/errors.rst:503 +#: ../../tutorial/errors.rst:523 msgid "" "The builtin :exc:`ExceptionGroup` wraps a list of exception instances so " "that they can be raised together. It is an exception itself, so it can be " @@ -1035,7 +1075,7 @@ msgstr "" "(串列),使得它們可以一起被引發。由於它本身就是一個例外,因此它也可以像任何" "其他例外一樣被捕獲。 ::" -#: ../../tutorial/errors.rst:507 +#: ../../tutorial/errors.rst:527 msgid "" ">>> def f():\n" "... excs = [OSError('error 1'), SystemError('error 2')]\n" @@ -1044,8 +1084,11 @@ msgid "" ">>> f()\n" " + Exception Group Traceback (most recent call last):\n" " | File \"\", line 1, in \n" +" | f()\n" +" | ~^^\n" " | File \"\", line 3, in f\n" -" | ExceptionGroup: there were problems\n" +" | raise ExceptionGroup('there were problems', excs)\n" +" | ExceptionGroup: there were problems (2 sub-exceptions)\n" " +-+---------------- 1 ----------------\n" " | OSError: error 1\n" " +---------------- 2 ----------------\n" @@ -1066,8 +1109,11 @@ msgstr "" ">>> f()\n" " + Exception Group Traceback (most recent call last):\n" " | File \"\", line 1, in \n" +" | f()\n" +" | ~^^\n" " | File \"\", line 3, in f\n" -" | ExceptionGroup: there were problems\n" +" | raise ExceptionGroup('there were problems', excs)\n" +" | ExceptionGroup: there were problems (2 sub-exceptions)\n" " +-+---------------- 1 ----------------\n" " | OSError: error 1\n" " +---------------- 2 ----------------\n" @@ -1081,7 +1127,7 @@ msgstr "" "caught : e\n" ">>>" -#: ../../tutorial/errors.rst:529 +#: ../../tutorial/errors.rst:552 msgid "" "By using ``except*`` instead of ``except``, we can selectively handle only " "the exceptions in the group that match a certain type. In the following " @@ -1094,7 +1140,7 @@ msgstr "" "``except*`` 子句分別從該群組中提取一個特定類型的例外,同時讓所有其他的例外都" "傳遞到其他子句,最後再被重新引發。 ::" -#: ../../tutorial/errors.rst:536 +#: ../../tutorial/errors.rst:559 msgid "" ">>> def f():\n" "... raise ExceptionGroup(\n" @@ -1123,10 +1169,15 @@ msgid "" "There were SystemErrors\n" " + Exception Group Traceback (most recent call last):\n" " | File \"\", line 2, in \n" +" | f()\n" +" | ~^^\n" " | File \"\", line 2, in f\n" -" | ExceptionGroup: group1\n" +" | raise ExceptionGroup(\n" +" | ...<12 lines>...\n" +" | )\n" +" | ExceptionGroup: group1 (1 sub-exception)\n" " +-+---------------- 1 ----------------\n" -" | ExceptionGroup: group2\n" +" | ExceptionGroup: group2 (1 sub-exception)\n" " +-+---------------- 1 ----------------\n" " | RecursionError: 4\n" " +------------------------------------\n" @@ -1159,16 +1210,21 @@ msgstr "" "There were SystemErrors\n" " + Exception Group Traceback (most recent call last):\n" " | File \"\", line 2, in \n" +" | f()\n" +" | ~^^\n" " | File \"\", line 2, in f\n" -" | ExceptionGroup: group1\n" +" | raise ExceptionGroup(\n" +" | ...<12 lines>...\n" +" | )\n" +" | ExceptionGroup: group1 (1 sub-exception)\n" " +-+---------------- 1 ----------------\n" -" | ExceptionGroup: group2\n" +" | ExceptionGroup: group2 (1 sub-exception)\n" " +-+---------------- 1 ----------------\n" " | RecursionError: 4\n" " +------------------------------------\n" ">>>" -#: ../../tutorial/errors.rst:572 +#: ../../tutorial/errors.rst:600 msgid "" "Note that the exceptions nested in an exception group must be instances, not " "types. This is because in practice the exceptions would typically be ones " @@ -1178,7 +1234,7 @@ msgstr "" "請注意,被巢套在例外群組中的例外必須是實例,而不是類型。這是因為在實務上,這" "些例外通常是已經被程式引發並捕獲的例外,類似以下的模式: ::" -#: ../../tutorial/errors.rst:577 +#: ../../tutorial/errors.rst:605 msgid "" ">>> excs = []\n" "... for test in tests:\n" @@ -1202,11 +1258,11 @@ msgstr "" "... raise ExceptionGroup(\"Test Failures\", excs)\n" "..." -#: ../../tutorial/errors.rst:592 +#: ../../tutorial/errors.rst:620 msgid "Enriching Exceptions with Notes" msgstr "用註解使例外更詳細" -#: ../../tutorial/errors.rst:594 +#: ../../tutorial/errors.rst:622 msgid "" "When an exception is created in order to be raised, it is usually " "initialized with information that describes the error that has occurred. " @@ -1222,7 +1278,7 @@ msgstr "" "的註解清單中。標準的回溯呈現會在例外之後列出所有的註解,並按照其被添加的順序" "來排列。 ::" -#: ../../tutorial/errors.rst:601 +#: ../../tutorial/errors.rst:629 msgid "" ">>> try:\n" "... raise TypeError('bad type')\n" @@ -1233,6 +1289,7 @@ msgid "" "...\n" "Traceback (most recent call last):\n" " File \"\", line 2, in \n" +" raise TypeError('bad type')\n" "TypeError: bad type\n" "Add some information\n" "Add some more information\n" @@ -1247,12 +1304,13 @@ msgstr "" "...\n" "Traceback (most recent call last):\n" " File \"\", line 2, in \n" +" raise TypeError('bad type')\n" "TypeError: bad type\n" "Add some information\n" "Add some more information\n" ">>>" -#: ../../tutorial/errors.rst:615 +#: ../../tutorial/errors.rst:644 msgid "" "For example, when collecting exceptions into an exception group, we may want " "to add context information for the individual errors. In the following each " @@ -1261,7 +1319,7 @@ msgstr "" "例如,在將例外收集到例外群組中時,我們可能希望為各個錯誤添加一些上下文的資" "訊。在以下範例中,群組中的每個例外都有一條註解,指示此錯誤是在何時發生。 ::" -#: ../../tutorial/errors.rst:619 +#: ../../tutorial/errors.rst:648 msgid "" ">>> def f():\n" "... raise OSError('operation failed')\n" @@ -1277,23 +1335,33 @@ msgid "" ">>> raise ExceptionGroup('We have some problems', excs)\n" " + Exception Group Traceback (most recent call last):\n" " | File \"\", line 1, in \n" +" | raise ExceptionGroup('We have some problems', excs)\n" " | ExceptionGroup: We have some problems (3 sub-exceptions)\n" " +-+---------------- 1 ----------------\n" " | Traceback (most recent call last):\n" " | File \"\", line 3, in \n" +" | f()\n" +" | ~^^\n" " | File \"\", line 2, in f\n" +" | raise OSError('operation failed')\n" " | OSError: operation failed\n" " | Happened in Iteration 1\n" " +---------------- 2 ----------------\n" " | Traceback (most recent call last):\n" " | File \"\", line 3, in \n" +" | f()\n" +" | ~^^\n" " | File \"\", line 2, in f\n" +" | raise OSError('operation failed')\n" " | OSError: operation failed\n" " | Happened in Iteration 2\n" " +---------------- 3 ----------------\n" " | Traceback (most recent call last):\n" " | File \"\", line 3, in \n" +" | f()\n" +" | ~^^\n" " | File \"\", line 2, in f\n" +" | raise OSError('operation failed')\n" " | OSError: operation failed\n" " | Happened in Iteration 3\n" " +------------------------------------\n" @@ -1313,23 +1381,33 @@ msgstr "" ">>> raise ExceptionGroup('We have some problems', excs)\n" " + Exception Group Traceback (most recent call last):\n" " | File \"\", line 1, in \n" +" | raise ExceptionGroup('We have some problems', excs)\n" " | ExceptionGroup: We have some problems (3 sub-exceptions)\n" " +-+---------------- 1 ----------------\n" " | Traceback (most recent call last):\n" " | File \"\", line 3, in \n" +" | f()\n" +" | ~^^\n" " | File \"\", line 2, in f\n" +" | raise OSError('operation failed')\n" " | OSError: operation failed\n" " | Happened in Iteration 1\n" " +---------------- 2 ----------------\n" " | Traceback (most recent call last):\n" " | File \"\", line 3, in \n" +" | f()\n" +" | ~^^\n" " | File \"\", line 2, in f\n" +" | raise OSError('operation failed')\n" " | OSError: operation failed\n" " | Happened in Iteration 2\n" " +---------------- 3 ----------------\n" " | Traceback (most recent call last):\n" " | File \"\", line 3, in \n" +" | f()\n" +" | ~^^\n" " | File \"\", line 2, in f\n" +" | raise OSError('operation failed')\n" " | OSError: operation failed\n" " | Happened in Iteration 3\n" " +------------------------------------\n" diff --git a/using/android.po b/using/android.po new file mode 100644 index 0000000000..dbb98acccb --- /dev/null +++ b/using/android.po @@ -0,0 +1,144 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../using/android.rst:5 +msgid "Using Python on Android" +msgstr "" + +#: ../../using/android.rst:7 +msgid "" +"Python on Android is unlike Python on desktop platforms. On a desktop " +"platform, Python is generally installed as a system resource that can be " +"used by any user of that computer. Users then interact with Python by " +"running a :program:`python` executable and entering commands at an " +"interactive prompt, or by running a Python script." +msgstr "" + +#: ../../using/android.rst:13 +msgid "" +"On Android, there is no concept of installing as a system resource. The only " +"unit of software distribution is an \"app\". There is also no console where " +"you could run a :program:`python` executable, or interact with a Python REPL." +msgstr "" + +#: ../../using/android.rst:17 +msgid "" +"As a result, the only way you can use Python on Android is in embedded mode " +"– that is, by writing a native Android application, embedding a Python " +"interpreter using ``libpython``, and invoking Python code using the :ref:" +"`Python embedding API `. The full Python interpreter, the " +"standard library, and all your Python code is then packaged into your app " +"for its own private use." +msgstr "" + +#: ../../using/android.rst:23 +msgid "" +"The Python standard library has some notable omissions and restrictions on " +"Android. See the :ref:`API availability guide ` for " +"details." +msgstr "" + +#: ../../using/android.rst:28 +msgid "Adding Python to an Android app" +msgstr "" + +#: ../../using/android.rst:30 +msgid "" +"These instructions are only needed if you're planning to compile Python for " +"Android yourself. Most users should *not* need to do this. Instead, use one " +"of the following tools, which will provide a much easier experience:" +msgstr "" + +#: ../../using/android.rst:34 +msgid "" +"`Briefcase `__, from the BeeWare project" +msgstr "" + +#: ../../using/android.rst:35 +msgid "`Buildozer `__, from the Kivy project" +msgstr "" + +#: ../../using/android.rst:36 +msgid "`Chaquopy `__" +msgstr "" + +#: ../../using/android.rst:37 +msgid "" +"`pyqtdeploy `__" +msgstr "" + +#: ../../using/android.rst:38 +msgid "`Termux `__" +msgstr "" + +#: ../../using/android.rst:40 +msgid "" +"If you're sure you want to do all of this manually, read on. You can use " +"the :source:`testbed app ` as a guide; each step below " +"contains a link to the relevant file." +msgstr "" + +#: ../../using/android.rst:44 +msgid "" +"Build Python by following the instructions in :source:`Android/README.md`." +msgstr "" + +#: ../../using/android.rst:46 +msgid "" +"Add code to your :source:`build.gradle ` file to copy the following items into your project. All except your " +"own Python code can be copied from ``cross-build/HOST/prefix/lib``:" +msgstr "" + +#: ../../using/android.rst:50 +msgid "In your JNI libraries:" +msgstr "" + +#: ../../using/android.rst:52 +msgid "``libpython*.*.so``" +msgstr "``libpython*.*.so``" + +#: ../../using/android.rst:53 +msgid "``lib*_python.so`` (external libraries such as OpenSSL)" +msgstr "" + +#: ../../using/android.rst:55 +msgid "In your assets:" +msgstr "" + +#: ../../using/android.rst:57 +msgid "``python*.*`` (the Python standard library)" +msgstr "" + +#: ../../using/android.rst:58 +msgid "``python*.*/site-packages`` (your own Python code)" +msgstr "" + +#: ../../using/android.rst:60 +msgid "" +"Add code to your app to :source:`extract the assets to the filesystem " +"`." +msgstr "" + +#: ../../using/android.rst:63 +msgid "" +"Add code to your app to :source:`start Python in embedded mode `. This will need to be C code called " +"via JNI." +msgstr "" diff --git a/using/ios.po b/using/ios.po index 2d702dba27..f2c2df9111 100644 --- a/using/ios.po +++ b/using/ios.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -115,7 +115,7 @@ msgstr "" #: ../../using/ios.rst:65 msgid "" "The Python standard library has some notable omissions and restrictions on " -"iOS. See the :ref:`API availability guide for iOS ` for " +"iOS. See the :ref:`API availability guide for iOS ` for " "details." msgstr "" diff --git a/using/mac.po b/using/mac.po index 9ece55a5c4..f346362e0e 100644 --- a/using/mac.po +++ b/using/mac.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2022-08-31 22:26+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -289,10 +289,9 @@ msgid "A number of alternative macOS GUI toolkits are available:" msgstr "有許多替代 macOS GUI 工具套件可用:" #: ../../using/mac.rst:157 -#, fuzzy msgid "" "`PySide `__: Official Python bindings to " -"the `Qt GUI toolkit `__." +"the `Qt GUI toolkit `__." msgstr "" "`PySide `__:`Qt GUI 工具包 `__\\ 的官方 Python 繫結。" diff --git a/using/windows.po b/using/windows.po index 2ef76eb5e5..a61e7c9881 100644 --- a/using/windows.po +++ b/using/windows.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1145,8 +1145,8 @@ msgid "" msgstr "" #: ../../using/windows.rst:611 -#, fuzzy -msgid "`Enthought Deployment Manager `_" +msgid "" +"`Enthought Deployment Manager `_" msgstr "" "`Enthought Deployment Manager `_" @@ -2300,9 +2300,8 @@ msgid "" msgstr "" #: ../../using/windows.rst:1308 -#, fuzzy msgid "" -"`Win32 How Do I...? `_" +"`Win32 How Do I...? `_" msgstr "" "`Win32 How Do I...? `_" diff --git a/whatsnew/2.4.po b/whatsnew/2.4.po index f8d6f7d7ed..7c50822863 100644 --- a/whatsnew/2.4.po +++ b/whatsnew/2.4.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1043,8 +1043,12 @@ msgid "" msgstr "" #: ../../whatsnew/2.4.rst:687 -msgid "http://www.lahey.com/float.htm" +msgid "" +"`http://www.lahey.com/float.htm `__), whose developers kindly relicensed the " +"relevant functions and donated them to the Python Software Foundation. The :" +"mod:`locale` module can now change the numeric locale, letting extensions " +"such as GTK+ produce the correct results." msgstr "" #: ../../whatsnew/2.4.rst:768 @@ -2373,10 +2377,3 @@ msgstr "universal newlines" #: ../../whatsnew/2.4.rst:415 msgid "What's new" msgstr "What's new(有什麼新功能)" - -#~ msgid "" -#~ "`http://www.lahey.com/float.htm `__" -#~ msgstr "" -#~ "`http://www.lahey.com/float.htm `__" diff --git a/whatsnew/2.7.po b/whatsnew/2.7.po index 381ebe4260..8eaa5f46cd 100644 --- a/whatsnew/2.7.po +++ b/whatsnew/2.7.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2132,8 +2132,8 @@ msgid "" "The :func:`~ssl.SSLContext.wrap_socket` constructor function now takes a " "*ciphers* argument that's a string listing the encryption algorithms to be " "allowed; the format of the string is described `in the OpenSSL documentation " -"`__. (Added by " -"Antoine Pitrou; :issue:`8322`.)" +"`__. (Added by Antoine " +"Pitrou; :issue:`8322`.)" msgstr "" #: ../../whatsnew/2.7.rst:1554 @@ -2846,14 +2846,14 @@ msgid "" "ElementTree's code for converting trees to a string has been significantly " "reworked, making it roughly twice as fast in many cases. The :meth:" "`ElementTree.write() ` and :meth:" -"`Element.write` methods now have a *method* parameter that can be \"xml\" " -"(the default), \"html\", or \"text\". HTML mode will output empty elements " -"as ```` instead of ````, and text mode will skip over " -"elements and only output the text chunks. If you set the :attr:`~xml.etree." -"ElementTree.Element.tag` attribute of an element to ``None`` but leave its " -"children in place, the element will be omitted when the tree is written out, " -"so you don't need to do more extensive rearrangement to remove a single " -"element." +"`Element.write` methods now have a *method* parameter that can be " +"\"xml\" (the default), \"html\", or \"text\". HTML mode will output empty " +"elements as ```` instead of ````, and text mode will " +"skip over elements and only output the text chunks. If you set the :attr:" +"`~xml.etree.ElementTree.Element.tag` attribute of an element to ``None`` but " +"leave its children in place, the element will be omitted when the tree is " +"written out, so you don't need to do more extensive rearrangement to remove " +"a single element." msgstr "" #: ../../whatsnew/2.7.rst:2044 @@ -3675,17 +3675,18 @@ msgstr "" #: ../../whatsnew/2.7.rst:2683 msgid "" -"As `discussed in the PEP`__, platform packagers may choose not to install " -"these commands by default, as long as, when invoked, they provide clear and " -"simple directions on how to install them on that platform (usually using the " -"system package manager)." +"As :pep:`discussed in the PEP <0477#disabling-ensurepip-by-downstream-" +"distributors>`, platform packagers may choose not to install these commands " +"by default, as long as, when invoked, they provide clear and simple " +"directions on how to install them on that platform (usually using the system " +"package manager)." msgstr "" -#: ../../whatsnew/2.7.rst:2692 +#: ../../whatsnew/2.7.rst:2690 msgid "Documentation Changes" msgstr "" -#: ../../whatsnew/2.7.rst:2694 +#: ../../whatsnew/2.7.rst:2692 msgid "" "As part of this change, the :ref:`installing-index` and :ref:`distributing-" "index` sections of the documentation have been completely redesigned as " @@ -3695,29 +3696,29 @@ msgid "" "of the individual projects." msgstr "" -#: ../../whatsnew/2.7.rst:2702 +#: ../../whatsnew/2.7.rst:2700 msgid "" "However, as this migration is currently still incomplete, the legacy " "versions of those guides remaining available as :ref:`install-index` and :" "ref:`setuptools-index`." msgstr "" -#: ../../whatsnew/2.7.rst:2708 +#: ../../whatsnew/2.7.rst:2706 msgid ":pep:`453` -- Explicit bootstrapping of pip in Python installations" msgstr "" -#: ../../whatsnew/2.7.rst:2709 +#: ../../whatsnew/2.7.rst:2707 msgid "" "PEP written by Donald Stufft and Nick Coghlan, implemented by Donald Stufft, " "Nick Coghlan, Martin von Löwis and Ned Deily." msgstr "" -#: ../../whatsnew/2.7.rst:2713 +#: ../../whatsnew/2.7.rst:2711 msgid "" "PEP 476: Enabling certificate verification by default for stdlib http clients" msgstr "" -#: ../../whatsnew/2.7.rst:2715 +#: ../../whatsnew/2.7.rst:2713 msgid "" ":pep:`476` updated :mod:`httplib ` and modules which use it, such as :" "mod:`urllib2 ` and :mod:`xmlrpclib `, to now " @@ -3727,13 +3728,13 @@ msgid "" "for many applications. This change was made in the Python 2.7.9 release." msgstr "" -#: ../../whatsnew/2.7.rst:2723 +#: ../../whatsnew/2.7.rst:2721 msgid "" "For applications which require the old previous behavior, they can pass an " "alternate context::" msgstr "" -#: ../../whatsnew/2.7.rst:2726 +#: ../../whatsnew/2.7.rst:2724 msgid "" "import urllib2\n" "import ssl\n" @@ -3748,11 +3749,11 @@ msgid "" "urllib2.urlopen(\"https://invalid-cert/", context=context)" msgstr "" -#: ../../whatsnew/2.7.rst:2740 +#: ../../whatsnew/2.7.rst:2738 msgid "PEP 493: HTTPS verification migration tools for Python 2.7" msgstr "" -#: ../../whatsnew/2.7.rst:2742 +#: ../../whatsnew/2.7.rst:2740 msgid "" ":pep:`493` provides additional migration tools to support a more incremental " "infrastructure upgrade process for environments containing applications and " @@ -3761,14 +3762,14 @@ msgid "" "were made in the Python 2.7.12 release." msgstr "" -#: ../../whatsnew/2.7.rst:2748 +#: ../../whatsnew/2.7.rst:2746 msgid "" "These tools are intended for use in cases where affected applications and " "services can't be modified to explicitly pass a more permissive SSL context " "when establishing the connection." msgstr "" -#: ../../whatsnew/2.7.rst:2752 +#: ../../whatsnew/2.7.rst:2750 msgid "" "For applications and services which can't be modified at all, the new " "``PYTHONHTTPSVERIFY`` environment variable may be set to ``0`` to revert an " @@ -3776,18 +3777,18 @@ msgid "" "2.7.8 and earlier." msgstr "" -#: ../../whatsnew/2.7.rst:2757 +#: ../../whatsnew/2.7.rst:2755 msgid "" "For cases where the connection establishment code can't be modified, but the " "overall application can be, the new :func:`!ssl._https_verify_certificates` " "function can be used to adjust the default behaviour at runtime." msgstr "" -#: ../../whatsnew/2.7.rst:2763 +#: ../../whatsnew/2.7.rst:2761 msgid "New ``make regen-all`` build target" msgstr "" -#: ../../whatsnew/2.7.rst:2765 +#: ../../whatsnew/2.7.rst:2763 msgid "" "To simplify cross-compilation, and to ensure that CPython can reliably be " "compiled without requiring an existing version of Python to already be " @@ -3795,43 +3796,43 @@ msgid "" "recompile generated files based on file modification times." msgstr "" -#: ../../whatsnew/2.7.rst:2770 +#: ../../whatsnew/2.7.rst:2768 msgid "" "Instead, a new ``make regen-all`` command has been added to force " "regeneration of these files when desired (e.g. after an initial version of " "Python has already been built based on the pregenerated versions)." msgstr "" -#: ../../whatsnew/2.7.rst:2774 +#: ../../whatsnew/2.7.rst:2772 msgid "" "More selective regeneration targets are also defined - see :source:`Makefile." "pre.in` for details." msgstr "" -#: ../../whatsnew/2.7.rst:2777 ../../whatsnew/2.7.rst:2790 +#: ../../whatsnew/2.7.rst:2775 ../../whatsnew/2.7.rst:2788 msgid "(Contributed by Victor Stinner in :issue:`23404`.)" msgstr "(由 Victor Stinner 於 :issue:`23404` 中貢獻。)" -#: ../../whatsnew/2.7.rst:2783 +#: ../../whatsnew/2.7.rst:2781 msgid "Removal of ``make touch`` build target" msgstr "" -#: ../../whatsnew/2.7.rst:2785 +#: ../../whatsnew/2.7.rst:2783 msgid "" "The ``make touch`` build target previously used to request implicit " "regeneration of generated files by updating their modification times has " "been removed." msgstr "" -#: ../../whatsnew/2.7.rst:2788 +#: ../../whatsnew/2.7.rst:2786 msgid "It has been replaced by the new ``make regen-all`` target." msgstr "" -#: ../../whatsnew/2.7.rst:2799 +#: ../../whatsnew/2.7.rst:2797 msgid "Acknowledgements" msgstr "致謝" -#: ../../whatsnew/2.7.rst:2801 +#: ../../whatsnew/2.7.rst:2799 msgid "" "The author would like to thank the following people for offering " "suggestions, corrections and assistance with various drafts of this article: " diff --git a/whatsnew/3.11.po b/whatsnew/3.11.po index bf12f1484a..ee765c9437 100644 --- a/whatsnew/3.11.po +++ b/whatsnew/3.11.po @@ -3188,99 +3188,80 @@ msgid "" msgstr ":pep:`594` 引領下列模組的棄用,並排訂於 Python 3.13 移除:" #: ../../whatsnew/3.11.rst:1752 -#, fuzzy msgid ":mod:`!aifc`" -msgstr ":mod:`aifc`" +msgstr ":mod:`!aifc`" #: ../../whatsnew/3.11.rst:1752 -#, fuzzy msgid ":mod:`!chunk`" -msgstr ":mod:`chunk`" +msgstr ":mod:`!chunk`" #: ../../whatsnew/3.11.rst:1752 -#, fuzzy msgid ":mod:`!msilib`" -msgstr ":mod:`msilib`" +msgstr ":mod:`!msilib`" #: ../../whatsnew/3.11.rst:1752 -#, fuzzy msgid ":mod:`!pipes`" -msgstr ":mod:`pipes`" +msgstr ":mod:`!pipes`" #: ../../whatsnew/3.11.rst:1752 -#, fuzzy msgid ":mod:`!telnetlib`" -msgstr ":mod:`telnetlib`" +msgstr ":mod:`!telnetlib`" #: ../../whatsnew/3.11.rst:1754 -#, fuzzy msgid ":mod:`!audioop`" -msgstr ":mod:`audioop`" +msgstr ":mod:`!audioop`" #: ../../whatsnew/3.11.rst:1754 -#, fuzzy msgid ":mod:`!crypt`" -msgstr ":mod:`crypt`" +msgstr ":mod:`!crypt`" #: ../../whatsnew/3.11.rst:1754 -#, fuzzy msgid ":mod:`!nis`" -msgstr ":mod:`nis`" +msgstr ":mod:`!nis`" #: ../../whatsnew/3.11.rst:1754 -#, fuzzy msgid ":mod:`!sndhdr`" -msgstr ":mod:`sndhdr`" +msgstr ":mod:`!sndhdr`" #: ../../whatsnew/3.11.rst:1754 -#, fuzzy msgid ":mod:`!uu`" -msgstr ":mod:`uu`" +msgstr ":mod:`!uu`" #: ../../whatsnew/3.11.rst:1756 -#, fuzzy msgid ":mod:`!cgi`" -msgstr ":mod:`cgi`" +msgstr ":mod:`!cgi`" #: ../../whatsnew/3.11.rst:1756 -#, fuzzy msgid ":mod:`!imghdr`" -msgstr ":mod:`imghdr`" +msgstr ":mod:`!imghdr`" #: ../../whatsnew/3.11.rst:1756 -#, fuzzy msgid ":mod:`!nntplib`" -msgstr ":mod:`nntplib`" +msgstr ":mod:`!nntplib`" #: ../../whatsnew/3.11.rst:1756 -#, fuzzy msgid ":mod:`!spwd`" -msgstr ":mod:`spwd`" +msgstr ":mod:`!spwd`" #: ../../whatsnew/3.11.rst:1756 -#, fuzzy msgid ":mod:`!xdrlib`" -msgstr ":mod:`xdrlib`" +msgstr ":mod:`!xdrlib`" #: ../../whatsnew/3.11.rst:1758 -#, fuzzy msgid ":mod:`!cgitb`" -msgstr ":mod:`cgitb`" +msgstr ":mod:`!cgitb`" #: ../../whatsnew/3.11.rst:1758 -#, fuzzy msgid ":mod:`!mailcap`" -msgstr ":mod:`mailcap`" +msgstr ":mod:`!mailcap`" #: ../../whatsnew/3.11.rst:1758 -#, fuzzy msgid ":mod:`!ossaudiodev`" -msgstr ":mod:`ossaudiodev`" +msgstr ":mod:`!ossaudiodev`" #: ../../whatsnew/3.11.rst:1758 -#, fuzzy msgid ":mod:`!sunau`" -msgstr ":mod:`sunau`" +msgstr ":mod:`!sunau`" #: ../../whatsnew/3.11.rst:1761 msgid "" @@ -3378,39 +3359,32 @@ msgstr "" "案:" #: ../../whatsnew/3.11.rst:1806 -#, fuzzy msgid ":func:`!importlib.resources.contents`" -msgstr ":func:`importlib.resources.contents`" +msgstr ":func:`!importlib.resources.contents`" #: ../../whatsnew/3.11.rst:1807 -#, fuzzy msgid ":func:`!importlib.resources.is_resource`" -msgstr ":func:`importlib.resources.is_resource`" +msgstr ":func:`!importlib.resources.is_resource`" #: ../../whatsnew/3.11.rst:1808 -#, fuzzy msgid ":func:`!importlib.resources.open_binary`" -msgstr ":func:`importlib.resources.open_binary`" +msgstr ":func:`!importlib.resources.open_binary`" #: ../../whatsnew/3.11.rst:1809 -#, fuzzy msgid ":func:`!importlib.resources.open_text`" -msgstr ":func:`importlib.resources.open_text`" +msgstr ":func:`!importlib.resources.open_text`" #: ../../whatsnew/3.11.rst:1810 -#, fuzzy msgid ":func:`!importlib.resources.read_binary`" -msgstr ":func:`importlib.resources.read_binary`" +msgstr ":func:`!importlib.resources.read_binary`" #: ../../whatsnew/3.11.rst:1811 -#, fuzzy msgid ":func:`!importlib.resources.read_text`" -msgstr ":func:`importlib.resources.read_text`" +msgstr ":func:`!importlib.resources.read_text`" #: ../../whatsnew/3.11.rst:1812 -#, fuzzy msgid ":func:`!importlib.resources.path`" -msgstr ":func:`importlib.resources.path`" +msgstr ":func:`!importlib.resources.path`" #: ../../whatsnew/3.11.rst:1814 msgid "" diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index 3c3f4d6e2c..b3a08c1401 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -239,11 +239,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:156 msgid "" -":pep:`632`: Remove the :mod:`!distutils` package. See `the migration guide " -"`_ for advice replacing " -"the APIs it provided. The third-party `Setuptools `__ package continues to " -"provide :mod:`!distutils`, if you still require it in Python 3.12 and beyond." +":pep:`632`: Remove the :mod:`!distutils` package. See :pep:`the migration " +"guide <0632#migration-advice>` for advice replacing the APIs it provided. " +"The third-party `Setuptools `__ package continues to provide :mod:`!distutils`, if " +"you still require it in Python 3.12 and beyond." msgstr "" #: ../../whatsnew/3.12.rst:163 @@ -525,7 +525,7 @@ msgstr "" #: ../../whatsnew/3.12.rst:361 msgid "" "For further examples how to use the C-API for sub-interpreters with a per-" -"interpreter GIL, see :source:`Modules/_xxsubinterpretersmodule.c`." +"interpreter GIL, see ``Modules/_xxsubinterpretersmodule.c``." msgstr "" #: ../../whatsnew/3.12.rst:364 @@ -1936,8 +1936,9 @@ msgid "" "warning to raise awareness as issues encountered by code doing this are " "becoming more frequent. See the :func:`os.fork` documentation for more " "details along with `this discussion on fork being incompatible with threads " -"`_ for *why* we're now surfacing this " -"longstanding platform compatibility problem to developers." +"`_ for *why* we're now surfacing this longstanding " +"platform compatibility problem to developers." msgstr "" #: ../../whatsnew/3.12.rst:1260 @@ -1993,6 +1994,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.12.rst:1290 +#: ../../deprecations/pending-removal-in-3.15.rst:50 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" @@ -2405,142 +2407,215 @@ msgid "Pending Removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" #: ../../deprecations/pending-removal-in-3.15.rst:4 +msgid ":mod:`ctypes`:" +msgstr ":mod:`ctypes`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -":class:`http.server.CGIHTTPRequestHandler` will be removed along with its " -"related ``--cgi`` flag to ``python -m http.server``. It was obsolete and " -"rarely used. No direct replacement exists. *Anything* is better than CGI " -"to interface a web server with a request handler." +"The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " +"since Python 3.13." msgstr "" -":class:`http.server.CGIHTTPRequestHandler` 將會被移除,連同其相關的 ``--" -"cgi`` 旗標到 ``python -m http.server``。它已經過時且很少被使用。沒有直接的替" -"代方案。*任何東西*\\ 都比 CGI 更好的來介接一個帶有請求處理器的網頁伺服器。" +"自 Python 3.13 起,未記錄的 :func:`!ctypes.SetPointerType` 函式已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:9 +msgid ":mod:`http.server`:" +msgstr ":mod:`http.server`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -":class:`locale`: :func:`locale.getdefaultlocale` was deprecated in Python " -"3.11 and originally planned for removal in Python 3.13 (:gh:`90817`), but " -"removal has been postponed to Python 3.15. Use :func:`locale.setlocale`, :" -"func:`locale.getencoding` and :func:`locale.getlocale` instead. (Contributed " -"by Hugo van Kemenade in :gh:`111187`.)" +"The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " +"been deprecated since Python 3.13. No direct replacement exists. *Anything* " +"is better than CGI to interface a web server with a request handler." msgstr "" -":class:`locale`::func:`locale.getdefaultlocale` 已在 Python 3.11 中被棄用," -"原本計劃在 Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :" -"func:`locale.setlocale`、:func:`locale.getencoding` 和 :func:`locale." -"getlocale`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" +"過時且很少使用的 :class:`~http.server.CGIHTTPRequestHandler` 自 Python 3.13 " +"起已被棄用。不存在直接的替代。*任何東西*\\ 都比 CGI 更好地將 Web 伺服器與請求" +"處理程序介接起來。" -#: ../../deprecations/pending-removal-in-3.15.rst:16 +#: ../../deprecations/pending-removal-in-3.15.rst:17 msgid "" -":mod:`pathlib`: :meth:`pathlib.PurePath.is_reserved` is deprecated and " -"scheduled for removal in Python 3.15. Use :func:`os.path.isreserved` to " -"detect reserved paths on Windows." +"The :option:`!--cgi` flag to the :program:`python -m http.server` command-" +"line interface has been deprecated since Python 3.13." msgstr "" -":mod:`pathlib`::meth:`pathlib.PurePath.is_reserved` 已被棄用並計劃在 Python " -"3.15 中移除。請用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" +"自 Python 3.13 起,:program:`python -m http.server` 命令列介面的 :option:`!--" +"cgi` 旗標已被棄用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:20 +msgid ":class:`locale`:" +msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:21 +#: ../../deprecations/pending-removal-in-3.15.rst:22 msgid "" -":mod:`platform`: :func:`~platform.java_ver` is deprecated and will be " -"removed in 3.15. It was largely untested, had a confusing API, and was only " -"useful for Jython support. (Contributed by Nikita Sobolev in :gh:`116349`.)" +"The :func:`~locale.getdefaultlocale` function has been deprecated since " +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" -":mod:`platform`::func:`~platform.java_ver` 已被棄用並將在 3.15 中移除。它幾" -"乎沒有被測試過,API 令人困惑並且只對 Jython 支援有用。 (由 Nikita Sobolev " -"於 :gh:`116349` 貢獻。)" +":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:27 +#: ../../deprecations/pending-removal-in-3.15.rst:30 +msgid ":mod:`pathlib`:" +msgstr ":mod:`pathlib`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:32 msgid "" -":mod:`threading`: Passing any arguments to :func:`threading.RLock` is now " -"deprecated. C version allows any numbers of args and kwargs, but they are " -"just ignored. Python version does not allow any arguments. All arguments " -"will be removed from :func:`threading.RLock` in Python 3.15. (Contributed by " -"Nikita Sobolev in :gh:`102029`.)" +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":mod:`threading`:對 :func:`threading.RLock` 傳遞任何引數現在已被棄用。C 版本" -"允許任意數量的引數和關鍵字引數,但它們會被忽略。Python 版本不允許任何引數。所" -"有引數將在 Python 3.15 中從 :func:`threading.RLock` 中移除。 (由 Nikita " -"Sobolev 於 :gh:`102029` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.15.rst:34 -msgid ":class:`typing.NamedTuple`:" -msgstr ":class:`typing.NamedTuple`:" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:36 +msgid ":mod:`platform`:" +msgstr ":mod:`platform`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" -"The undocumented keyword argument syntax for creating :class:`!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." +":func:`~platform.java_ver` has been deprecated since Python 3.13. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested." +msgstr "" +"自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" +"援有用,具有令人困惑的 API,基本上未經測試。" + +#: ../../deprecations/pending-removal-in-3.15.rst:42 +msgid ":mod:`threading`:" +msgstr ":mod:`threading`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:44 +msgid "" +":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " +"arguments has been deprecated since Python 3.14, as the Python version does " +"not permit any arguments, but the C version allows any number of positional " +"or keyword arguments, ignoring every argument." +msgstr "" +":func:`~threading.RLock` 在 Python 3.15 中將不接受任何引數。自 Python 3.14 " +"起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" +"任意數量的位置或關鍵字引數,並忽略每個引數。" + +#: ../../deprecations/pending-removal-in-3.15.rst:52 +msgid "" +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " +"has been deprecated since Python 3.13. Use the class-based syntax or the " +"functional syntax instead." +msgstr "" +"用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " +"(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" +"用基於類別的語法或函式語法 (functional syntax)。" + +#: ../../deprecations/pending-removal-in-3.15.rst:58 +msgid "" +"The :func:`typing.no_type_check_decorator` decorator function has been " +"deprecated since Python 3.13. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker." msgstr "" -"用於建立 :class:`!NamedTuple` 類別的未以文件記錄之關鍵字引數語法 (``NT = " -"NamedTuple(\"NT\", x=int)``) 已棄用,並將在 3.15 中被禁止。請改用基於類別的語" -"法或函式語法 (functional syntax)。" - -#: ../../deprecations/pending-removal-in-3.15.rst:40 -msgid "" -"When using the functional syntax to create a :class:`!NamedTuple` class, " -"failing to pass a value to the *fields* parameter (``NT = " -"NamedTuple(\"NT\")``) is deprecated. Passing ``None`` to the *fields* " -"parameter (``NT = NamedTuple(\"NT\", None)``) is also deprecated. Both will " -"be disallowed in Python 3.15. To create a :class:`!NamedTuple` class with 0 " -"fields, use ``class NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", " -"[])``." -msgstr "" -"當使用函式語法來建立 :class:`!NamedTuple` 類別時,沒將值傳遞給 *fields* 參數" -"的方式 (``NT = NamedTuple(\"NT\")``) 已被棄用,將 ``None`` 傳遞給 *fields* 參" -"數(``NT = NamedTuple(\"NT\", None)``)也已被棄用。這兩者將在 Python 3.15 中" -"會被禁止。要建立一個沒有欄位的 :class:`!NamedTuple` 類別,請使用 ``class " -"NT(NamedTuple): pass`` 或 ``NT = NamedTuple(\"NT\", [])``。" - -#: ../../deprecations/pending-removal-in-3.15.rst:47 -msgid "" -":class:`typing.TypedDict`: When using the functional syntax to create a :" -"class:`!TypedDict` class, failing to pass a value to the *fields* parameter " -"(``TD = TypedDict(\"TD\")``) is deprecated. Passing ``None`` to the *fields* " -"parameter (``TD = TypedDict(\"TD\", None)``) is also deprecated. Both will " -"be disallowed in Python 3.15. To create a :class:`!TypedDict` class with 0 " -"fields, use ``class TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." -msgstr "" -":class:`typing.TypedDict`:當使用函式語法來建立 :class:`!TypedDict` 類別時," -"沒將值傳遞給 *fields* 參數的方式(``TD = TypedDict(\"TD\")``)已被棄用,將 " -"``None`` 傳遞給 *fields* 參數(``TD = TypedDict(\"TD\", None)``)也已被棄用。" -"這兩者將在 Python 3.15 中會被禁止。要建立一個沒有欄位的 :class:`!TypedDict` " -"類別,請使用 ``class TD(TypedDict): pass`` 或 ``TD = TypedDict(\"TD\", " -"{})``。" - -#: ../../deprecations/pending-removal-in-3.15.rst:54 -msgid "" -":mod:`wave`: Deprecate the ``getmark()``, ``setmark()`` and ``getmarkers()`` " -"methods of the :class:`wave.Wave_read` and :class:`wave.Wave_write` classes. " -"They will be removed in Python 3.15. (Contributed by Victor Stinner in :gh:" -"`105096`.)" -msgstr "" -":mod:`wave`:已棄用 :class:`wave.Wave_read` 和 :class:`wave.Wave_write` 類別" -"的 ``getmark()``、``setmark()`` 和 ``getmarkers()`` 方法。它們將在 Python " -"3.15 中被移除。 (由 Victor Stinner 於 :gh:`105096` 貢獻。)" +"自 Python 3.13 起,:func:`typing.no_type_check_decorator` 裝飾器函式已被棄" +"用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" +"援。" + +#: ../../deprecations/pending-removal-in-3.15.rst:63 +msgid ":mod:`wave`:" +msgstr ":mod:`wave`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:65 +msgid "" +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." +msgstr "" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending Removal in Python 3.16" msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:4 +#: ../../deprecations/pending-removal-in-future.rst:12 +msgid ":mod:`builtins`:" +msgstr ":mod:`builtins`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:6 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" +"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" +"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" +"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " +"``~int(x)`` (``~int(x)``)。" + +#: ../../deprecations/pending-removal-in-3.16.rst:13 +msgid ":mod:`array`:" +msgstr ":mod:`array`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:15 +msgid "" +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." +msgstr "" +"自 Python 3.3 起,``'u'`` 格式碼 (:c:type:`wchar_t`) 在文件中已被棄用,自 " +"Python 3.13 起在 runtime 已被棄用。請使用 ``'w'`` 格式碼 (:c:type:`Py_UCS4`) " +"來取代 Unicode 字元。" + +#: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid ":mod:`shutil`:" +msgstr ":mod:`shutil`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:23 msgid "" -":mod:`array`: :class:`array.array` ``'u'`` type (:c:type:`wchar_t`): use the " -"``'w'`` type instead (``Py_UCS4``)." +"The :class:`!ExecError` exception has been deprecated since Python 3.14. It " +"has not been used by any function in :mod:`!shutil` since Python 3.4, and is " +"now an alias of :exc:`RuntimeError`." msgstr "" -":mod:`array`::class:`array.array` ``'u'`` 型別 (:c:type:`wchar_t`):請改用 " -"``'w'`` 型別 (``Py_UCS4``)。" +"自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" +"未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" -#: ../../deprecations/pending-removal-in-3.16.rst:8 -msgid ":mod:`builtins`: ``~bool``, bitwise inversion on bool." -msgstr ":mod:`builtins`:``~bool``,對 bool 進行位元反轉。" +#: ../../deprecations/pending-removal-in-3.16.rst:28 +msgid ":mod:`symtable`:" +msgstr ":mod:`symtable`:" -#: ../../deprecations/pending-removal-in-3.16.rst:11 +#: ../../deprecations/pending-removal-in-3.16.rst:30 msgid "" -":mod:`symtable`: Deprecate :meth:`symtable.Class.get_methods` due to the " -"lack of interest. (Contributed by Bénédikt Tran in :gh:`119698`.)" +"The :meth:`Class.get_methods ` method has been " +"deprecated since Python 3.14." msgstr "" -":mod:`symtable`:由於並沒有太多關注,已棄用 :meth:`symtable.Class." -"get_methods`。 (由 Bénédikt Tran 於 :gh:`119698` 貢獻。)" +"自 Python 3.14 起,:meth:`Class.get_methods ` 方" +"法已被棄用。" + +#: ../../deprecations/pending-removal-in-3.16.rst:33 +msgid ":mod:`sys`:" +msgstr ":mod:`sys`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:35 +msgid "" +"The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " +"since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead." +msgstr "" +"自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" +"請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" + +#: ../../deprecations/pending-removal-in-3.16.rst:39 +msgid ":mod:`tarfile`:" +msgstr ":mod:`tarfile`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:41 +msgid "" +"The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " +"deprecated since Python 3.13." +msgstr "" +"自 Python 3.13 起,未以文件記錄和未被使用的 :attr:`!TarFile.tarfile` 屬性已被" +"棄用。" #: ../../deprecations/c-api-pending-removal-in-future.rst:2 #: ../../deprecations/pending-removal-in-future.rst:2 @@ -2563,10 +2638,6 @@ msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" -#: ../../deprecations/pending-removal-in-future.rst:12 -msgid ":mod:`builtins`:" -msgstr ":mod:`builtins`:" - #: ../../deprecations/pending-removal-in-future.rst:14 msgid "``bool(NotImplemented)``." msgstr "``bool(NotImplemented)``。" @@ -4704,164 +4775,167 @@ msgid "" msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:12 -msgid "``PySys_SetArgvEx()``: set :c:member:`PyConfig.argv` instead." -msgstr "``PySys_SetArgvEx()``:請改以 :c:member:`PyConfig.argv` 設定。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:13 -msgid "``PySys_SetArgv()``: set :c:member:`PyConfig.argv` instead." -msgstr "``PySys_SetArgv()``:請改以 :c:member:`PyConfig.argv` 設定。" +msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`!PySys_SetArgvEx()`:請改以 :c:member:`PyConfig.argv` 設定。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:14 -msgid "``Py_SetProgramName()``: set :c:member:`PyConfig.program_name` instead." +msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`!PySys_SetArgv()`:請改以 :c:member:`PyConfig.argv` 設定。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:16 +msgid "" +":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +"instead." msgstr "" -"``Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設定。" +":c:func:`!Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設" +"定。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:15 -msgid "``Py_SetPythonHome()``: set :c:member:`PyConfig.home` instead." -msgstr "``Py_SetPythonHome()``:請改以 :c:member:`PyConfig.home` 設定。" +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:18 +msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." +msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設定。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:17 -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:45 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" "`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:20 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 msgid "Global configuration variables:" msgstr "全域設定變數:" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:22 -msgid ":c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 +msgid ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` instead." msgstr ":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:23 -msgid ":c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 +msgid ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` instead." msgstr ":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 -msgid ":c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 +msgid ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` instead." msgstr ":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:25 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 msgid "" -":c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive` instead." +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` instead." msgstr ":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 -msgid ":c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 +msgid ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` instead." msgstr ":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:27 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:36 msgid "" -":c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level` " +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " "instead." msgstr "" ":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 -msgid ":c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 +msgid ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` instead." msgstr ":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:29 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 msgid "" -":c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning` instead." +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` instead." msgstr "" ":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 msgid "" -":c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings` instead." +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` instead." msgstr "" ":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:31 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:44 msgid "" -":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment` " +":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "instead." msgstr "" ":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." "use_environment`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 msgid "" -":c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode` " +":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "instead." msgstr "" ":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." "write_bytecode`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:33 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 msgid "" -":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig." +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." "user_site_directory` instead." msgstr "" ":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." "user_site_directory`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 msgid "" -":c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio` " +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " "instead." msgstr "" ":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:35 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:52 msgid "" -":c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` " +":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed` instead." msgstr "" ":c:var:`Py_HashRandomizationFlag`:請改用 :c:member:`PyConfig.use_hash_seed` " "和 :c:member:`PyConfig.hash_seed`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:37 -msgid ":c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:55 +msgid ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` instead." msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." "legacy_windows_fs_encoding` instead." msgstr "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." "legacy_windows_fs_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:39 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." "legacy_windows_stdio` instead." msgstr "" ":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." "legacy_windows_stdio`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." +":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." "filesystem_encoding` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." "filesystem_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:41 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." +":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." "filesystem_encoding` instead." msgstr "" ":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." "filesystem_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." "filesystem_errors` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." "filesystem_errors`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:43 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` instead. (see :" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" "c:func:`Py_PreInitialize`)" msgstr "" ":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" @@ -4873,63 +4947,63 @@ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -":c:func:`PyImport_ImportModuleNoBlock`: use :c:func:`PyImport_ImportModule` " -"instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." msgstr "" ":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" "`PyImport_ImportModule`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 -msgid ":c:func:`PyWeakref_GET_OBJECT`: use :c:func:`PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GET_OBJECT`:請改用 :c:func:`PyWeakref_GetRef`。" - #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 -msgid ":c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GetObject`:請改用 :c:func:`PyWeakref_GetRef`。" - -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:8 -msgid ":c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead." -msgstr ":c:type:`!Py_UNICODE_WIDE` type:請改用 :c:type:`wchar_t`。" +msgid "" +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead." +msgstr "" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 -msgid ":c:type:`Py_UNICODE` type: use :c:type:`wchar_t` instead." -msgstr ":c:type:`Py_UNICODE` type:請改用 :c:type:`wchar_t`。" +msgid "" +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." +msgstr "" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 msgid "Python initialization functions:" msgstr "Python 初始化函式:" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 msgid "" -":c:func:`PySys_ResetWarnOptions`: clear :data:`sys.warnoptions` and :data:`!" +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" ":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" "data:`!warnings.filters`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:14 -msgid ":c:func:`Py_GetExecPrefix`: get :data:`sys.exec_prefix` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 +msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 -msgid ":c:func:`Py_GetPath`: get :data:`sys.path` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:16 -msgid ":c:func:`Py_GetPrefix`: get :data:`sys.prefix` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 -msgid ":c:func:`Py_GetProgramFullPath`: get :data:`sys.executable` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 +msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:18 -msgid ":c:func:`Py_GetProgramName`: get :data:`sys.executable` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:23 +msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -":c:func:`Py_GetPythonHome`: get :c:member:`PyConfig.home` or the :envvar:" +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" "`PYTHONHOME` environment variable instead." msgstr "" ":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" @@ -4942,84 +5016,85 @@ msgid "" msgstr "下列 API 已被棄用並將會被移除,不過目前尚未訂定移除日期。" #: ../../deprecations/c-api-pending-removal-in-future.rst:7 -msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: unneeded since Python 3.8." +msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8." msgstr ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`:自 Python 3.8 起不再需要" -#: ../../deprecations/c-api-pending-removal-in-future.rst:8 -msgid ":c:func:`PyErr_Fetch`: use :c:func:`PyErr_GetRaisedException` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:9 +msgid ":c:func:`PyErr_Fetch`: Use :c:func:`PyErr_GetRaisedException` instead." msgstr ":c:func:`PyErr_Fetch`:請改用 :c:func:`PyErr_GetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:9 +#: ../../deprecations/c-api-pending-removal-in-future.rst:11 msgid "" -":c:func:`PyErr_NormalizeException`: use :c:func:`PyErr_GetRaisedException` " +":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" ":c:func:`PyErr_NormalizeException`:請改用 :c:func:" "`PyErr_GetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:10 +#: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" -":c:func:`PyErr_Restore`: use :c:func:`PyErr_SetRaisedException` instead." +":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." msgstr ":c:func:`PyErr_Restore`:請改用 :c:func:`PyErr_SetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:11 +#: ../../deprecations/c-api-pending-removal-in-future.rst:15 msgid "" -":c:func:`PyModule_GetFilename`: use :c:func:`PyModule_GetFilenameObject` " +":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` " "instead." msgstr "" ":c:func:`PyModule_GetFilename`:請改用 :c:func:`PyModule_GetFilenameObject`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:12 -msgid ":c:func:`PyOS_AfterFork`: use :c:func:`PyOS_AfterFork_Child` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:17 +msgid ":c:func:`PyOS_AfterFork`: Use :c:func:`PyOS_AfterFork_Child` instead." msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:13 +#: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: use :c:func:`PySlice_Unpack` and :c:func:" +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" "`PySlice_AdjustIndices` instead." msgstr "" ":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" "`PySlice_AdjustIndices`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:14 +#: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid "" -":c:func:`!PyUnicode_AsDecodedObject`: use :c:func:`PyCodec_Decode` instead." +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." msgstr "" ":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:15 +#: ../../deprecations/c-api-pending-removal-in-future.rst:23 msgid "" -":c:func:`!PyUnicode_AsDecodedUnicode`: use :c:func:`PyCodec_Decode` instead." +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead." msgstr "" ":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:16 +#: ../../deprecations/c-api-pending-removal-in-future.rst:25 msgid "" -":c:func:`!PyUnicode_AsEncodedObject`: use :c:func:`PyCodec_Encode` instead." +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." msgstr "" ":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:17 +#: ../../deprecations/c-api-pending-removal-in-future.rst:27 msgid "" -":c:func:`!PyUnicode_AsEncodedUnicode`: use :c:func:`PyCodec_Encode` instead." +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead." msgstr "" ":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:18 -msgid ":c:func:`PyUnicode_READY`: unneeded since Python 3.12" +#: ../../deprecations/c-api-pending-removal-in-future.rst:29 +msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" msgstr ":c:func:`PyUnicode_READY`:自 Python 3.12 起不再需要" -#: ../../deprecations/c-api-pending-removal-in-future.rst:19 -msgid ":c:func:`!PyErr_Display`: use :c:func:`PyErr_DisplayException` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:31 +msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." msgstr ":c:func:`!PyErr_Display`:請改用 :c:func:`PyErr_DisplayException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:20 +#: ../../deprecations/c-api-pending-removal-in-future.rst:33 msgid "" -":c:func:`!_PyErr_ChainExceptions`: use ``_PyErr_ChainExceptions1`` instead." +":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " +"instead." msgstr "" ":c:func:`!_PyErr_ChainExceptions`:請改用 ``_PyErr_ChainExceptions1``。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:21 +#: ../../deprecations/c-api-pending-removal-in-future.rst:35 msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." @@ -5027,42 +5102,42 @@ msgstr "" ":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" "`PyObject_Hash`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:23 +#: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid ":c:member:`!PyDictObject.ma_version_tag` member." msgstr ":c:member:`!PyDictObject.ma_version_tag` 成員。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:24 +#: ../../deprecations/c-api-pending-removal-in-future.rst:38 msgid "Thread Local Storage (TLS) API:" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../deprecations/c-api-pending-removal-in-future.rst:26 +#: ../../deprecations/c-api-pending-removal-in-future.rst:40 msgid "" -":c:func:`PyThread_create_key`: use :c:func:`PyThread_tss_alloc` instead." +":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." msgstr ":c:func:`PyThread_create_key`:請改用 :c:func:`PyThread_tss_alloc`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:27 -msgid ":c:func:`PyThread_delete_key`: use :c:func:`PyThread_tss_free` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:42 +msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." msgstr ":c:func:`PyThread_delete_key`:請改用 :c:func:`PyThread_tss_free`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:28 +#: ../../deprecations/c-api-pending-removal-in-future.rst:44 msgid "" -":c:func:`PyThread_set_key_value`: use :c:func:`PyThread_tss_set` instead." +":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." msgstr ":c:func:`PyThread_set_key_value`:請改用 :c:func:`PyThread_tss_set`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:29 +#: ../../deprecations/c-api-pending-removal-in-future.rst:46 msgid "" -":c:func:`PyThread_get_key_value`: use :c:func:`PyThread_tss_get` instead." +":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." msgstr ":c:func:`PyThread_get_key_value`:請改用 :c:func:`PyThread_tss_get`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:30 +#: ../../deprecations/c-api-pending-removal-in-future.rst:48 msgid "" -":c:func:`PyThread_delete_key_value`: use :c:func:`PyThread_tss_delete` " +":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " "instead." msgstr "" ":c:func:`PyThread_delete_key_value`:請改用 :c:func:`PyThread_tss_delete`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:31 -msgid ":c:func:`PyThread_ReInitTLS`: unneeded since Python 3.7." +#: ../../deprecations/c-api-pending-removal-in-future.rst:50 +msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" #: ../../whatsnew/3.12.rst:2224 @@ -5120,6 +5195,86 @@ msgstr "" "移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner 於 :gh:" "`85858` 中貢獻。)" +#~ msgid "" +#~ ":mod:`platform`: :func:`~platform.java_ver` is deprecated and will be " +#~ "removed in 3.15. It was largely untested, had a confusing API, and was " +#~ "only useful for Jython support. (Contributed by Nikita Sobolev in :gh:" +#~ "`116349`.)" +#~ msgstr "" +#~ ":mod:`platform`::func:`~platform.java_ver` 已被棄用並將在 3.15 中移除。它" +#~ "幾乎沒有被測試過,API 令人困惑並且只對 Jython 支援有用。 (由 Nikita " +#~ "Sobolev 於 :gh:`116349` 貢獻。)" + +#~ msgid "" +#~ ":mod:`threading`: Passing any arguments to :func:`threading.RLock` is now " +#~ "deprecated. C version allows any numbers of args and kwargs, but they are " +#~ "just ignored. Python version does not allow any arguments. All arguments " +#~ "will be removed from :func:`threading.RLock` in Python 3.15. (Contributed " +#~ "by Nikita Sobolev in :gh:`102029`.)" +#~ msgstr "" +#~ ":mod:`threading`:對 :func:`threading.RLock` 傳遞任何引數現在已被棄用。C " +#~ "版本允許任意數量的引數和關鍵字引數,但它們會被忽略。Python 版本不允許任何" +#~ "引數。所有引數將在 Python 3.15 中從 :func:`threading.RLock` 中移除。 (由 " +#~ "Nikita Sobolev 於 :gh:`102029` 貢獻。)" + +#~ msgid ":class:`typing.NamedTuple`:" +#~ msgstr ":class:`typing.NamedTuple`:" + +#~ msgid "" +#~ "When using the functional syntax to create a :class:`!NamedTuple` class, " +#~ "failing to pass a value to the *fields* parameter (``NT = " +#~ "NamedTuple(\"NT\")``) is deprecated. Passing ``None`` to the *fields* " +#~ "parameter (``NT = NamedTuple(\"NT\", None)``) is also deprecated. Both " +#~ "will be disallowed in Python 3.15. To create a :class:`!NamedTuple` class " +#~ "with 0 fields, use ``class NT(NamedTuple): pass`` or ``NT = " +#~ "NamedTuple(\"NT\", [])``." +#~ msgstr "" +#~ "當使用函式語法來建立 :class:`!NamedTuple` 類別時,沒將值傳遞給 *fields* 參" +#~ "數的方式 (``NT = NamedTuple(\"NT\")``) 已被棄用,將 ``None`` 傳遞給 " +#~ "*fields* 參數(``NT = NamedTuple(\"NT\", None)``)也已被棄用。這兩者將在 " +#~ "Python 3.15 中會被禁止。要建立一個沒有欄位的 :class:`!NamedTuple` 類別,請" +#~ "使用 ``class NT(NamedTuple): pass`` 或 ``NT = NamedTuple(\"NT\", [])``。" + +#~ msgid "" +#~ ":class:`typing.TypedDict`: When using the functional syntax to create a :" +#~ "class:`!TypedDict` class, failing to pass a value to the *fields* " +#~ "parameter (``TD = TypedDict(\"TD\")``) is deprecated. Passing ``None`` to " +#~ "the *fields* parameter (``TD = TypedDict(\"TD\", None)``) is also " +#~ "deprecated. Both will be disallowed in Python 3.15. To create a :class:`!" +#~ "TypedDict` class with 0 fields, use ``class TD(TypedDict): pass`` or ``TD " +#~ "= TypedDict(\"TD\", {})``." +#~ msgstr "" +#~ ":class:`typing.TypedDict`:當使用函式語法來建立 :class:`!TypedDict` 類別" +#~ "時,沒將值傳遞給 *fields* 參數的方式(``TD = TypedDict(\"TD\")``)已被棄" +#~ "用,將 ``None`` 傳遞給 *fields* 參數(``TD = TypedDict(\"TD\", None)``)也" +#~ "已被棄用。這兩者將在 Python 3.15 中會被禁止。要建立一個沒有欄位的 :class:" +#~ "`!TypedDict` 類別,請使用 ``class TD(TypedDict): pass`` 或 ``TD = " +#~ "TypedDict(\"TD\", {})``。" + +#~ msgid "" +#~ ":mod:`array`: :class:`array.array` ``'u'`` type (:c:type:`wchar_t`): use " +#~ "the ``'w'`` type instead (``Py_UCS4``)." +#~ msgstr "" +#~ ":mod:`array`::class:`array.array` ``'u'`` 型別 (:c:type:`wchar_t`):請改" +#~ "用 ``'w'`` 型別 (``Py_UCS4``)。" + +#~ msgid ":mod:`builtins`: ``~bool``, bitwise inversion on bool." +#~ msgstr ":mod:`builtins`:``~bool``,對 bool 進行位元反轉。" + +#~ msgid "" +#~ ":mod:`symtable`: Deprecate :meth:`symtable.Class.get_methods` due to the " +#~ "lack of interest. (Contributed by Bénédikt Tran in :gh:`119698`.)" +#~ msgstr "" +#~ ":mod:`symtable`:由於並沒有太多關注,已棄用 :meth:`symtable.Class." +#~ "get_methods`。 (由 Bénédikt Tran 於 :gh:`119698` 貢獻。)" + +#~ msgid "" +#~ ":c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef` instead." +#~ msgstr ":c:func:`PyWeakref_GetObject`:請改用 :c:func:`PyWeakref_GetRef`。" + +#~ msgid ":c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead." +#~ msgstr ":c:type:`!Py_UNICODE_WIDE` type:請改用 :c:type:`wchar_t`。" + #~ msgid "Notable changes in 3.12.4" #~ msgstr "3.12.4 中的顯著變更" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index 380acd14d1..22c2f71389 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -1,17 +1,16 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 15:56+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -19,15 +18,15 @@ msgstr "" #: ../../whatsnew/3.13.rst:4 msgid "What's New In Python 3.13" -msgstr "" +msgstr "Python 3.13 有什麼新功能" #: ../../whatsnew/3.13.rst:0 -msgid "Editor" -msgstr "" +msgid "Editors" +msgstr "編輯者" #: ../../whatsnew/3.13.rst:6 -msgid "Thomas Wouters" -msgstr "" +msgid "Adam Turner and Thomas Wouters" +msgstr "Adam Turner 和 Thomas Wouters" #: ../../whatsnew/3.13.rst:48 msgid "" @@ -38,20 +37,13 @@ msgstr "" #: ../../whatsnew/3.13.rst:54 msgid ":pep:`719` -- Python 3.13 Release Schedule" -msgstr "" +msgstr ":pep:`719` -- Python 3.13 發佈時程" #: ../../whatsnew/3.13.rst:58 -msgid "" -"Prerelease users should be aware that this document is currently in draft " -"form. It will be updated substantially as Python 3.13 moves towards release, " -"so it's worth checking back even after reading earlier versions." -msgstr "" - -#: ../../whatsnew/3.13.rst:64 msgid "Summary -- Release Highlights" -msgstr "" +msgstr "發布重點摘要" -#: ../../whatsnew/3.13.rst:69 +#: ../../whatsnew/3.13.rst:63 msgid "" "Python 3.13 will be the latest stable release of the Python programming " "language, with a mix of changes to the language, the implementation and the " @@ -62,7 +54,7 @@ msgid "" "`744`)." msgstr "" -#: ../../whatsnew/3.13.rst:78 +#: ../../whatsnew/3.13.rst:72 msgid "" "Error messages continue to improve, with tracebacks now highlighted in color " "by default. The :func:`locals` builtin now has :ref:`defined semantics " @@ -70,7 +62,7 @@ msgid "" "parameters now support default values." msgstr "" -#: ../../whatsnew/3.13.rst:83 +#: ../../whatsnew/3.13.rst:77 msgid "" "The library changes contain removal of deprecated APIs and modules, as well " "as the usual improvements in user-friendliness and correctness. Several " @@ -78,7 +70,7 @@ msgid "" "pep594_>`_ following their deprecation in Python 3.11 (:pep:`594`)." msgstr "" -#: ../../whatsnew/3.13.rst:88 +#: ../../whatsnew/3.13.rst:82 msgid "" "This article doesn't attempt to provide a complete specification of all new " "features, but instead gives a convenient overview. For full details refer to " @@ -90,18 +82,18 @@ msgid "" "guidance on upgrading from earlier versions of Python." msgstr "" -#: ../../whatsnew/3.13.rst:104 +#: ../../whatsnew/3.13.rst:98 msgid "Interpreter improvements:" -msgstr "" +msgstr "直譯器改進:" -#: ../../whatsnew/3.13.rst:106 +#: ../../whatsnew/3.13.rst:100 msgid "" "A greatly improved :ref:`interactive interpreter ` and :ref:`improved error messages `." msgstr "" -#: ../../whatsnew/3.13.rst:109 +#: ../../whatsnew/3.13.rst:103 msgid "" ":pep:`667`: The :func:`locals` builtin now has :ref:`defined semantics " "` when mutating the returned mapping. Python " @@ -109,14 +101,14 @@ msgid "" "optimized scopes even during concurrent code execution." msgstr "" -#: ../../whatsnew/3.13.rst:114 +#: ../../whatsnew/3.13.rst:108 msgid "" ":pep:`703`: CPython 3.13 has experimental support for running with the :term:" "`global interpreter lock` disabled. See :ref:`Free-threaded CPython " "` for more details." msgstr "" -#: ../../whatsnew/3.13.rst:117 +#: ../../whatsnew/3.13.rst:111 msgid "" ":pep:`744`: A basic :ref:`JIT compiler ` was " "added. It is currently disabled by default (though we may turn it on later). " @@ -124,7 +116,7 @@ msgid "" "next few releases." msgstr "" -#: ../../whatsnew/3.13.rst:121 +#: ../../whatsnew/3.13.rst:115 msgid "" "Color support in the new :ref:`interactive interpreter `, as well as in :ref:`tracebacks `." msgstr "" -#: ../../whatsnew/3.13.rst:138 +#: ../../whatsnew/3.13.rst:132 msgid "" "The :mod:`argparse` module now supports deprecating command-line options, " "positional arguments, and subcommands." msgstr "" -#: ../../whatsnew/3.13.rst:140 +#: ../../whatsnew/3.13.rst:134 msgid "" "The new functions :func:`base64.z85encode` and :func:`base64.z85decode` " "support encoding and decoding `Z85 data`_." msgstr "" -#: ../../whatsnew/3.13.rst:142 +#: ../../whatsnew/3.13.rst:136 msgid "" "The :mod:`copy` module now has a :func:`copy.replace` function, with support " "for many builtin types and any class defining the :func:`~object." "__replace__` method." msgstr "" -#: ../../whatsnew/3.13.rst:145 -msgid "The :mod:`dbm.sqlite3` module is now the default :mod:`dbm` backend." +#: ../../whatsnew/3.13.rst:139 +msgid "" +"The new :mod:`dbm.sqlite3` module is now the default :mod:`dbm` backend." msgstr "" -#: ../../whatsnew/3.13.rst:146 +#: ../../whatsnew/3.13.rst:140 msgid "" "The :mod:`os` module has a :ref:`suite of new functions ` for " "working with Linux's timer notification file descriptors." msgstr "" -#: ../../whatsnew/3.13.rst:148 +#: ../../whatsnew/3.13.rst:142 msgid "" "The :mod:`random` module now has a :ref:`command-line interface `." msgstr "" -#: ../../whatsnew/3.13.rst:150 +#: ../../whatsnew/3.13.rst:144 msgid "Security improvements:" -msgstr "" +msgstr "安全性改進:" -#: ../../whatsnew/3.13.rst:152 +#: ../../whatsnew/3.13.rst:146 msgid "" ":func:`ssl.create_default_context` sets :data:`ssl." "VERIFY_X509_PARTIAL_CHAIN` and :data:`ssl.VERIFY_X509_STRICT` as default " "flags." msgstr "" -#: ../../whatsnew/3.13.rst:155 +#: ../../whatsnew/3.13.rst:149 msgid "C API improvements:" -msgstr "" +msgstr "C API 改進:" -#: ../../whatsnew/3.13.rst:157 +#: ../../whatsnew/3.13.rst:151 msgid "" "The :c:data:`Py_mod_gil` slot is now used to indicate that an extension " "module supports running with the :term:`GIL` disabled." msgstr "" -#: ../../whatsnew/3.13.rst:159 +#: ../../whatsnew/3.13.rst:153 msgid "" "The :doc:`PyTime C API ` has been added, providing access to " "system clocks." msgstr "" -#: ../../whatsnew/3.13.rst:161 +#: ../../whatsnew/3.13.rst:155 msgid "" ":c:type:`PyMutex` is a new lightweight mutex that occupies a single byte." msgstr "" -#: ../../whatsnew/3.13.rst:163 -msgid "New typing features:" +#: ../../whatsnew/3.13.rst:156 +msgid "" +"There is a new :ref:`suite of functions ` for generating :" +"pep:`669` monitoring events in the C API." msgstr "" -#: ../../whatsnew/3.13.rst:165 +#: ../../whatsnew/3.13.rst:159 +msgid "New typing features:" +msgstr "新增型別特性:" + +#: ../../whatsnew/3.13.rst:161 msgid "" ":pep:`696`: Type parameters (:data:`typing.TypeVar`, :data:`typing." "ParamSpec`, and :data:`typing.TypeVarTuple`) now support defaults." msgstr "" -#: ../../whatsnew/3.13.rst:167 +#: ../../whatsnew/3.13.rst:163 msgid "" ":pep:`702`: The new :func:`warnings.deprecated` decorator adds support for " -"marking deprecations in the type system." +"marking deprecations in the type system and at runtime." msgstr "" -#: ../../whatsnew/3.13.rst:169 +#: ../../whatsnew/3.13.rst:165 msgid "" ":pep:`705`: :data:`typing.ReadOnly` can be used to mark an item of a :class:" "`typing.TypedDict` as read-only for type checkers." msgstr "" -#: ../../whatsnew/3.13.rst:171 +#: ../../whatsnew/3.13.rst:167 msgid "" ":pep:`742`: :data:`typing.TypeIs` provides more intuitive type narrowing " "behavior, as an alternative to :data:`typing.TypeGuard`." msgstr "" -#: ../../whatsnew/3.13.rst:174 +#: ../../whatsnew/3.13.rst:170 msgid "Platform support:" msgstr "" -#: ../../whatsnew/3.13.rst:176 +#: ../../whatsnew/3.13.rst:172 msgid "" ":pep:`730`: Apple's iOS is now an :ref:`officially supported platform " -"`, at :pep:`tier 3 <11#tier-3>`. Official " -"Android support (:pep:`738`) is in the works as well." +"`, at :pep:`tier 3 <11#tier-3>`." msgstr "" -#: ../../whatsnew/3.13.rst:179 +#: ../../whatsnew/3.13.rst:174 +msgid "" +":pep:`738`: Android is now an :ref:`officially supported platform " +"`, at :pep:`tier 3 <11#tier-3>`." +msgstr "" + +#: ../../whatsnew/3.13.rst:176 msgid "" "``wasm32-wasi`` is now supported as a :pep:`tier 2 <11#tier-2>` platform." msgstr "" -#: ../../whatsnew/3.13.rst:180 +#: ../../whatsnew/3.13.rst:177 msgid "``wasm32-emscripten`` is no longer an officially supported platform." msgstr "" -#: ../../whatsnew/3.13.rst:182 +#: ../../whatsnew/3.13.rst:179 msgid "Important removals:" msgstr "" -#: ../../whatsnew/3.13.rst:184 +#: ../../whatsnew/3.13.rst:181 msgid "" ":ref:`PEP 594 `: The remaining 19 \"dead batteries\" " -"have been removed from the standard library: :mod:`!aifc`, :mod:`!audioop`, :" -"mod:`!cgi`, :mod:`!cgitb`, :mod:`!chunk`, :mod:`!crypt`, :mod:`!imghdr`, :" -"mod:`!mailcap`, :mod:`!msilib`, :mod:`!nis`, :mod:`!nntplib`, :mod:`!" -"ossaudiodev`, :mod:`!pipes`, :mod:`!sndhdr`, :mod:`!spwd`, :mod:`!sunau`, :" -"mod:`!telnetlib`, :mod:`!uu` and :mod:`!xdrlib`." +"(legacy stdlib modules) have been removed from the standard library: :mod:`!" +"aifc`, :mod:`!audioop`, :mod:`!cgi`, :mod:`!cgitb`, :mod:`!chunk`, :mod:`!" +"crypt`, :mod:`!imghdr`, :mod:`!mailcap`, :mod:`!msilib`, :mod:`!nis`, :mod:`!" +"nntplib`, :mod:`!ossaudiodev`, :mod:`!pipes`, :mod:`!sndhdr`, :mod:`!spwd`, :" +"mod:`!sunau`, :mod:`!telnetlib`, :mod:`!uu` and :mod:`!xdrlib`." msgstr "" -#: ../../whatsnew/3.13.rst:190 +#: ../../whatsnew/3.13.rst:187 msgid "" "Remove the :program:`2to3` tool and :mod:`!lib2to3` module (deprecated in " "Python 3.11)." msgstr "" -#: ../../whatsnew/3.13.rst:192 +#: ../../whatsnew/3.13.rst:189 msgid "Remove the :mod:`!tkinter.tix` module (deprecated in Python 3.6)." msgstr "" -#: ../../whatsnew/3.13.rst:193 -msgid "Remove :func:`!locale.resetlocale`." +#: ../../whatsnew/3.13.rst:190 +msgid "Remove the :func:`!locale.resetlocale` function." msgstr "" -#: ../../whatsnew/3.13.rst:194 -msgid "Remove :mod:`!typing.io` and :mod:`!typing.re`." +#: ../../whatsnew/3.13.rst:191 +msgid "Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces." msgstr "" -#: ../../whatsnew/3.13.rst:195 +#: ../../whatsnew/3.13.rst:192 msgid "Remove chained :class:`classmethod` descriptors." msgstr "" -#: ../../whatsnew/3.13.rst:197 +#: ../../whatsnew/3.13.rst:194 msgid "Release schedule changes:" msgstr "" -#: ../../whatsnew/3.13.rst:199 +#: ../../whatsnew/3.13.rst:196 msgid "" ":pep:`602` (\"Annual Release Cycle for Python\") has been updated to extend " "the full support ('bugfix') period for new releases to two years. This " "updated policy means that:" msgstr "" -#: ../../whatsnew/3.13.rst:203 +#: ../../whatsnew/3.13.rst:200 msgid "" "Python 3.9--3.12 have one and a half years of full support, followed by " "three and a half years of security fixes." msgstr "" -#: ../../whatsnew/3.13.rst:205 +#: ../../whatsnew/3.13.rst:202 msgid "" "Python 3.13 and later have two years of full support, followed by three " "years of security fixes." msgstr "" -#: ../../whatsnew/3.13.rst:210 ../../whatsnew/3.13.rst:1954 +#: ../../whatsnew/3.13.rst:207 ../../whatsnew/3.13.rst:2005 msgid "New Features" -msgstr "" +msgstr "新增特性" -#: ../../whatsnew/3.13.rst:216 +#: ../../whatsnew/3.13.rst:213 msgid "A better interactive interpreter" msgstr "" -#: ../../whatsnew/3.13.rst:218 +#: ../../whatsnew/3.13.rst:215 msgid "" "Python now uses a new :term:`interactive` shell by default, based on code " "from the `PyPy project`_. When the user starts the :term:`REPL` from an " "interactive terminal, the following new features are now supported:" msgstr "" -#: ../../whatsnew/3.13.rst:223 +#: ../../whatsnew/3.13.rst:220 msgid "Multiline editing with history preservation." msgstr "" -#: ../../whatsnew/3.13.rst:224 +#: ../../whatsnew/3.13.rst:221 msgid "" "Direct support for REPL-specific commands like :kbd:`help`, :kbd:`exit`, " "and :kbd:`quit`, without the need to call them as functions." msgstr "" -#: ../../whatsnew/3.13.rst:226 +#: ../../whatsnew/3.13.rst:223 msgid "" "Prompts and tracebacks with :ref:`color enabled by default `." msgstr "" -#: ../../whatsnew/3.13.rst:228 +#: ../../whatsnew/3.13.rst:225 msgid "" "Interactive help browsing using :kbd:`F1` with a separate command history." msgstr "" -#: ../../whatsnew/3.13.rst:230 +#: ../../whatsnew/3.13.rst:227 msgid "" "History browsing using :kbd:`F2` that skips output as well as the :term:" "`>>>` and :term:`...` prompts." msgstr "" -#: ../../whatsnew/3.13.rst:232 +#: ../../whatsnew/3.13.rst:229 msgid "" "\"Paste mode\" with :kbd:`F3` that makes pasting larger blocks of code " "easier (press :kbd:`F3` again to return to the regular prompt)." msgstr "" -#: ../../whatsnew/3.13.rst:235 +#: ../../whatsnew/3.13.rst:232 msgid "" "To disable the new interactive shell, set the :envvar:`PYTHON_BASIC_REPL` " "environment variable. For more on interactive mode, see :ref:`tut-interac`." msgstr "" -#: ../../whatsnew/3.13.rst:239 +#: ../../whatsnew/3.13.rst:236 msgid "" "(Contributed by Pablo Galindo Salgado, Łukasz Langa, and Lysandros Nikolaou " "in :gh:`111201` based on code from the PyPy project. Windows support " "contributed by Dino Viehland and Anthony Shaw.)" msgstr "" -#: ../../whatsnew/3.13.rst:249 +#: ../../whatsnew/3.13.rst:246 msgid "Improved error messages" msgstr "" -#: ../../whatsnew/3.13.rst:251 +#: ../../whatsnew/3.13.rst:248 msgid "" "The interpreter now uses color by default when displaying tracebacks in the " "terminal. This feature :ref:`can be controlled ` " @@ -406,14 +410,14 @@ msgid "" "by Pablo Galindo Salgado in :gh:`112730`.)" msgstr "" -#: ../../whatsnew/3.13.rst:266 +#: ../../whatsnew/3.13.rst:263 msgid "" "A common mistake is to write a script with the same name as a standard " "library module. When this results in errors, we now display a more helpful " "error message:" msgstr "" -#: ../../whatsnew/3.13.rst:270 +#: ../../whatsnew/3.13.rst:267 msgid "" "$ python random.py\n" "Traceback (most recent call last):\n" @@ -427,14 +431,14 @@ msgid "" "library module named 'random' and the import system gives it precedence)" msgstr "" -#: ../../whatsnew/3.13.rst:281 +#: ../../whatsnew/3.13.rst:278 msgid "" "Similarly, if a script has the same name as a third-party module that it " "attempts to import and this results in errors, we also display a more " "helpful error message:" msgstr "" -#: ../../whatsnew/3.13.rst:285 +#: ../../whatsnew/3.13.rst:282 msgid "" "$ python numpy.py\n" "Traceback (most recent call last):\n" @@ -448,17 +452,17 @@ msgid "" "intended to import)" msgstr "" -#: ../../whatsnew/3.13.rst:296 +#: ../../whatsnew/3.13.rst:293 msgid "(Contributed by Shantanu Jain in :gh:`95754`.)" msgstr "" -#: ../../whatsnew/3.13.rst:298 +#: ../../whatsnew/3.13.rst:295 msgid "" "The error message now tries to suggest the correct keyword argument when an " "incorrect keyword argument is passed to a function." msgstr "" -#: ../../whatsnew/3.13.rst:301 +#: ../../whatsnew/3.13.rst:298 msgid "" ">>> \"Better error messages!\".split(max_split=1)\n" "Traceback (most recent call last):\n" @@ -469,16 +473,16 @@ msgid "" "mean 'maxsplit'?" msgstr "" -#: ../../whatsnew/3.13.rst:310 +#: ../../whatsnew/3.13.rst:307 msgid "" "(Contributed by Pablo Galindo Salgado and Shantanu Jain in :gh:`107944`.)" msgstr "" -#: ../../whatsnew/3.13.rst:316 +#: ../../whatsnew/3.13.rst:313 msgid "Free-threaded CPython" msgstr "" -#: ../../whatsnew/3.13.rst:318 +#: ../../whatsnew/3.13.rst:315 msgid "" "CPython now has experimental support for running in a free-threaded mode, " "with the :term:`global interpreter lock` (GIL) disabled. This is an " @@ -491,7 +495,7 @@ msgid "" "gil` option." msgstr "" -#: ../../whatsnew/3.13.rst:331 +#: ../../whatsnew/3.13.rst:328 msgid "" "Free-threaded execution allows for full utilization of the available " "processing power by running threads in parallel on available CPU cores. " @@ -501,10 +505,10 @@ msgid "" "it: expect some bugs and a substantial single-threaded performance hit. Free-" "threaded builds of CPython support optionally running with the GIL enabled " "at runtime using the environment variable :envvar:`PYTHON_GIL` or the " -"command-line option :option:`-X gil`." +"command-line option :option:`-X gil=1`." msgstr "" -#: ../../whatsnew/3.13.rst:341 +#: ../../whatsnew/3.13.rst:338 msgid "" "To check if the current interpreter supports free-threading, :option:`python " "-VV <-V>` and :attr:`sys.version` contain \"experimental free-threading " @@ -512,7 +516,7 @@ msgid "" "whether the GIL is actually disabled in the running process." msgstr "" -#: ../../whatsnew/3.13.rst:346 +#: ../../whatsnew/3.13.rst:343 msgid "" "C-API extension modules need to be built specifically for the free-threaded " "build. Extensions that support running with the :term:`GIL` disabled should " @@ -525,24 +529,24 @@ msgid "" "extensions in the free-threaded build." msgstr "" -#: ../../whatsnew/3.13.rst:359 +#: ../../whatsnew/3.13.rst:356 msgid "" ":pep:`703` \"Making the Global Interpreter Lock Optional in CPython\" " "contains rationale and information surrounding this work." msgstr "" -#: ../../whatsnew/3.13.rst:362 +#: ../../whatsnew/3.13.rst:359 msgid "" "`Porting Extension Modules to Support Free-Threading `_: A community-maintained porting guide for " "extension authors." msgstr "" -#: ../../whatsnew/3.13.rst:370 +#: ../../whatsnew/3.13.rst:367 msgid "An experimental just-in-time (JIT) compiler" msgstr "" -#: ../../whatsnew/3.13.rst:372 +#: ../../whatsnew/3.13.rst:369 msgid "" "When CPython is configured and built using the :option:`!--enable-" "experimental-jit` option, a just-in-time (JIT) compiler is added which may " @@ -552,104 +556,104 @@ msgid "" "information `are contained at`__ :file:`Tools/jit/README.md`." msgstr "" -#: ../../whatsnew/3.13.rst:382 +#: ../../whatsnew/3.13.rst:379 msgid "" "The :option:`!--enable-experimental-jit` option takes these (optional) " "values, defaulting to ``yes`` if :option:`!--enable-experimental-jit` is " "present without the optional value." msgstr "" -#: ../../whatsnew/3.13.rst:386 +#: ../../whatsnew/3.13.rst:383 msgid "``no``: Disable the entire Tier 2 and JIT pipeline." msgstr "" -#: ../../whatsnew/3.13.rst:387 +#: ../../whatsnew/3.13.rst:384 msgid "" "``yes``: Enable the JIT. To disable the JIT at runtime, pass the environment " "variable ``PYTHON_JIT=0``." msgstr "" -#: ../../whatsnew/3.13.rst:389 +#: ../../whatsnew/3.13.rst:386 msgid "" "``yes-off``: Build the JIT but disable it by default. To enable the JIT at " "runtime, pass the environment variable ``PYTHON_JIT=1``." msgstr "" -#: ../../whatsnew/3.13.rst:391 +#: ../../whatsnew/3.13.rst:388 msgid "" "``interpreter``: Enable the Tier 2 interpreter but disable the JIT. The " "interpreter can be disabled by running with ``PYTHON_JIT=0``." msgstr "" -#: ../../whatsnew/3.13.rst:394 +#: ../../whatsnew/3.13.rst:391 msgid "The internal architecture is roughly as follows:" msgstr "" -#: ../../whatsnew/3.13.rst:396 +#: ../../whatsnew/3.13.rst:393 msgid "" "We start with specialized *Tier 1 bytecode*. See :ref:`What's new in 3.11 " "` for details." msgstr "" -#: ../../whatsnew/3.13.rst:398 +#: ../../whatsnew/3.13.rst:395 msgid "" "When the Tier 1 bytecode gets hot enough, it gets translated to a new purely " "internal intermediate representation (IR), called the *Tier 2 IR*, and " "sometimes referred to as micro-ops (\"uops\")." msgstr "" -#: ../../whatsnew/3.13.rst:401 +#: ../../whatsnew/3.13.rst:398 msgid "" "The Tier 2 IR uses the same stack-based virtual machine as Tier 1, but the " "instruction format is better suited to translation to machine code." msgstr "" -#: ../../whatsnew/3.13.rst:403 +#: ../../whatsnew/3.13.rst:400 msgid "" "We have several optimization passes for Tier 2 IR, which are applied before " "it is interpreted or translated to machine code." msgstr "" -#: ../../whatsnew/3.13.rst:405 +#: ../../whatsnew/3.13.rst:402 msgid "" "There is a Tier 2 interpreter, but it is mostly intended for debugging the " "earlier stages of the optimization pipeline. The Tier 2 interpreter can be " "enabled by configuring Python with ``--enable-experimental-jit=interpreter``." msgstr "" -#: ../../whatsnew/3.13.rst:409 +#: ../../whatsnew/3.13.rst:406 msgid "" "When the JIT is enabled, the optimized Tier 2 IR is translated to machine " "code, which is then executed." msgstr "" -#: ../../whatsnew/3.13.rst:411 +#: ../../whatsnew/3.13.rst:408 msgid "" "The machine code translation process uses a technique called *copy-and-" "patch*. It has no runtime dependencies, but there is a new build-time " "dependency on LLVM." msgstr "" -#: ../../whatsnew/3.13.rst:415 +#: ../../whatsnew/3.13.rst:412 msgid ":pep:`744`" -msgstr "" +msgstr ":pep:`744`" -#: ../../whatsnew/3.13.rst:417 +#: ../../whatsnew/3.13.rst:414 msgid "" "(JIT by Brandt Bucher, inspired by a paper by Haoran Xu and Fredrik " "Kjolstad. Tier 2 IR by Mark Shannon and Guido van Rossum. Tier 2 optimizer " "by Ken Jin.)" msgstr "" -#: ../../whatsnew/3.13.rst:425 +#: ../../whatsnew/3.13.rst:422 msgid "Defined mutation semantics for :py:func:`locals`" msgstr "" -#: ../../whatsnew/3.13.rst:427 +#: ../../whatsnew/3.13.rst:424 msgid "" "Historically, the expected result of mutating the return value of :func:" "`locals` has been left to individual Python implementations to define. " -"Starting from Python 3.13, :pep:`667` standardises the historical behaviour " +"Starting from Python 3.13, :pep:`667` standardises the historical behavior " "of CPython for most code execution scopes, but changes :term:`optimized " "scopes ` (functions, generators, coroutines, " "comprehensions, and generator expressions) to explicitly return independent " @@ -657,10 +661,10 @@ msgid "" "referenced nonlocal variables captured in closures." msgstr "" -#: ../../whatsnew/3.13.rst:436 +#: ../../whatsnew/3.13.rst:433 msgid "" "This change to the semantics of :func:`locals` in optimized scopes also " -"affects the default behaviour of code execution functions that implicitly " +"affects the default behavior of code execution functions that implicitly " "target :func:`!locals` if no explicit namespace is provided (such as :func:" "`exec` and :func:`eval`). In previous versions, whether or not changes could " "be accessed by calling :func:`!locals` after calling the code execution " @@ -678,7 +682,7 @@ msgid "" "disk)." msgstr "" -#: ../../whatsnew/3.13.rst:455 +#: ../../whatsnew/3.13.rst:452 msgid "" "To ensure debuggers and similar tools can reliably update local variables in " "scopes affected by this change, :attr:`FrameType.f_locals ` " @@ -688,7 +692,7 @@ msgid "" "semantics." msgstr "" -#: ../../whatsnew/3.13.rst:461 +#: ../../whatsnew/3.13.rst:458 msgid "" "See :pep:`667` for more details, including related C API changes and " "deprecations. Porting notes are also provided below for the affected :ref:" @@ -696,18 +700,18 @@ msgid "" "notes-c>`." msgstr "" -#: ../../whatsnew/3.13.rst:466 +#: ../../whatsnew/3.13.rst:463 msgid "" "(PEP and implementation contributed by Mark Shannon and Tian Gao in :gh:" "`74929`. Documentation updates provided by Guido van Rossum and Alyssa " "Coghlan.)" msgstr "" -#: ../../whatsnew/3.13.rst:474 +#: ../../whatsnew/3.13.rst:471 msgid "Support for mobile platforms" msgstr "" -#: ../../whatsnew/3.13.rst:476 +#: ../../whatsnew/3.13.rst:473 msgid "" ":pep:`730`: iOS is now a :pep:`11` supported platform, with the ``arm64-" "apple-ios`` and ``arm64-apple-ios-simulator`` targets at tier 3 (iPhone and " @@ -718,28 +722,30 @@ msgid "" "implementation contributed by Russell Keith-Magee in :gh:`114099`.)" msgstr "" -#: ../../whatsnew/3.13.rst:486 +#: ../../whatsnew/3.13.rst:483 msgid "" -":pep:`738`: Android support is being actively worked on, but the platform is " -"not yet officially supported. (PEP written and implementation contributed by " -"Malcolm Smith in :gh:`116622`.)" +":pep:`738`: Android is now a :pep:`11` supported platform, with the " +"``aarch64-linux-android`` and ``x86_64-linux-android`` targets at tier 3. " +"The 32-bit targets ``arm-linux-androideabi`` and ``i686-linux-android`` are " +"not tier 3 supported platforms, but will have best-effort support. (PEP " +"written and implementation contributed by Malcolm Smith in :gh:`116622`.)" msgstr "" -#: ../../whatsnew/3.13.rst:491 +#: ../../whatsnew/3.13.rst:490 msgid ":pep:`730`, :pep:`738`" -msgstr "" +msgstr ":pep:`730`、:pep:`738`" -#: ../../whatsnew/3.13.rst:497 +#: ../../whatsnew/3.13.rst:496 msgid "Incremental garbage collection" msgstr "" -#: ../../whatsnew/3.13.rst:499 +#: ../../whatsnew/3.13.rst:498 msgid "" "The cycle garbage collector is now incremental. This means that maximum " "pause times are reduced by an order of magnitude or more for larger heaps." msgstr "" -#: ../../whatsnew/3.13.rst:503 +#: ../../whatsnew/3.13.rst:502 msgid "" "There are now only two generations: young and old. When :func:`gc.collect` " "is not called directly, the GC is invoked a little less frequently. When " @@ -747,29 +753,29 @@ msgid "" "generation, instead of collecting one or more generations." msgstr "" -#: ../../whatsnew/3.13.rst:509 +#: ../../whatsnew/3.13.rst:508 msgid "The behavior of :func:`!gc.collect` changes slightly:" msgstr "" -#: ../../whatsnew/3.13.rst:511 +#: ../../whatsnew/3.13.rst:510 ../../whatsnew/3.13.rst:2617 msgid "" -"``gc.collect(1)``: Performs an increment of GC, rather than collecting " -"generation 1." +"``gc.collect(1)``: Performs an increment of garbage collection, rather than " +"collecting generation 1." msgstr "" -#: ../../whatsnew/3.13.rst:513 +#: ../../whatsnew/3.13.rst:512 ../../whatsnew/3.13.rst:2619 msgid "Other calls to :func:`!gc.collect` are unchanged." msgstr "" -#: ../../whatsnew/3.13.rst:515 +#: ../../whatsnew/3.13.rst:514 msgid "(Contributed by Mark Shannon in :gh:`108362`.)" msgstr "" -#: ../../whatsnew/3.13.rst:519 +#: ../../whatsnew/3.13.rst:518 msgid "Other Language Changes" -msgstr "" +msgstr "其他語言更動" -#: ../../whatsnew/3.13.rst:521 +#: ../../whatsnew/3.13.rst:520 msgid "" "The compiler now strips common leading whitespace from every line in a " "docstring. This reduces the size of the :term:`bytecode cache ` " @@ -778,7 +784,7 @@ msgid "" "affects tools that use docstrings, such as :mod:`doctest`." msgstr "" -#: ../../whatsnew/3.13.rst:528 +#: ../../whatsnew/3.13.rst:527 msgid "" ">>> def spam():\n" "... \"\"\"\n" @@ -793,28 +799,30 @@ msgid "" "multiple paragraphs!\\n'" msgstr "" -#: ../../whatsnew/3.13.rst:541 +#: ../../whatsnew/3.13.rst:540 msgid "(Contributed by Inada Naoki in :gh:`81283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:543 +#: ../../whatsnew/3.13.rst:542 msgid "" ":ref:`Annotation scopes ` within class scopes can now " "contain lambdas and comprehensions. Comprehensions that are located within " "class scopes are not inlined into their parent scope." msgstr "" -#: ../../whatsnew/3.13.rst:548 +#: ../../whatsnew/3.13.rst:547 msgid "" "class C[T]:\n" " type Alias = lambda: T" msgstr "" +"class C[T]:\n" +" type Alias = lambda: T" -#: ../../whatsnew/3.13.rst:553 +#: ../../whatsnew/3.13.rst:552 msgid "(Contributed by Jelle Zijlstra in :gh:`109118` and :gh:`118160`.)" msgstr "" -#: ../../whatsnew/3.13.rst:555 +#: ../../whatsnew/3.13.rst:554 msgid "" ":ref:`Future statements ` are no longer triggered by relative " "imports of the :mod:`__future__` module, meaning that statements of the form " @@ -823,7 +831,7 @@ msgid "" "in :gh:`118216`.)" msgstr "" -#: ../../whatsnew/3.13.rst:561 +#: ../../whatsnew/3.13.rst:560 msgid "" ":keyword:`global` declarations are now permitted in :keyword:`except` blocks " "when that global is used in the :keyword:`else` block. Previously this " @@ -831,7 +839,7 @@ msgid "" "`111123`.)" msgstr "" -#: ../../whatsnew/3.13.rst:566 +#: ../../whatsnew/3.13.rst:565 msgid "" "Add :envvar:`PYTHON_FROZEN_MODULES`, a new environment variable that " "determines whether frozen modules are ignored by the import machinery, " @@ -839,7 +847,7 @@ msgid "" "(Contributed by Yilei Yang in :gh:`111374`.)" msgstr "" -#: ../../whatsnew/3.13.rst:571 +#: ../../whatsnew/3.13.rst:570 msgid "" "Add :ref:`support for the perf profiler ` working without " "`frame pointers `_ through the new " @@ -848,14 +856,14 @@ msgid "" "`118518`.)" msgstr "" -#: ../../whatsnew/3.13.rst:577 +#: ../../whatsnew/3.13.rst:576 msgid "" "The location of a :file:`.python_history` file can be changed via the new :" "envvar:`PYTHON_HISTORY` environment variable. (Contributed by Levi Sabah, " "Zackery Spytz and Hugo van Kemenade in :gh:`73965`.)" msgstr "" -#: ../../whatsnew/3.13.rst:582 +#: ../../whatsnew/3.13.rst:581 msgid "" "Classes have a new :attr:`~class.__static_attributes__` attribute. This is " "populated by the compiler with a tuple of the class's attribute names which " @@ -863,21 +871,21 @@ msgid "" "(Contributed by Irit Katriel in :gh:`115775`.)" msgstr "" -#: ../../whatsnew/3.13.rst:587 +#: ../../whatsnew/3.13.rst:586 msgid "" "The compiler now creates a :attr:`!__firstlineno__` attribute on classes " "with the line number of the first line of the class definition. (Contributed " "by Serhiy Storchaka in :gh:`118465`.)" msgstr "" -#: ../../whatsnew/3.13.rst:591 +#: ../../whatsnew/3.13.rst:590 msgid "" "The :func:`exec` and :func:`eval` builtins now accept the *globals* and " "*locals* arguments as keywords. (Contributed by Raphael Gaschignard in :gh:" "`105879`)" msgstr "" -#: ../../whatsnew/3.13.rst:595 +#: ../../whatsnew/3.13.rst:594 msgid "" "The :func:`compile` builtin now accepts a new flag, ``ast." "PyCF_OPTIMIZED_AST``, which is similar to ``ast.PyCF_ONLY_AST`` except that " @@ -885,7 +893,13 @@ msgid "" "argument. (Contributed by Irit Katriel in :gh:`108113`)." msgstr "" -#: ../../whatsnew/3.13.rst:601 +#: ../../whatsnew/3.13.rst:600 +msgid "" +"Add a :attr:`~property.__name__` attribute on :class:`property` objects. " +"(Contributed by Eugene Toder in :gh:`101860`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:603 msgid "" "Add :exc:`PythonFinalizationError`, a new exception derived from :exc:" "`RuntimeError` and used to signal when operations are blocked during :term:" @@ -893,71 +907,65 @@ msgid "" "exc:`!PythonFinalizationError`, instead of :exc:`RuntimeError`:" msgstr "" -#: ../../whatsnew/3.13.rst:607 +#: ../../whatsnew/3.13.rst:609 msgid ":func:`_thread.start_new_thread`" -msgstr "" +msgstr ":func:`_thread.start_new_thread`" -#: ../../whatsnew/3.13.rst:608 +#: ../../whatsnew/3.13.rst:610 msgid ":func:`os.fork`" -msgstr "" +msgstr ":func:`os.fork`" -#: ../../whatsnew/3.13.rst:609 +#: ../../whatsnew/3.13.rst:611 msgid ":func:`os.forkpty`" -msgstr "" +msgstr ":func:`os.forkpty`" -#: ../../whatsnew/3.13.rst:610 +#: ../../whatsnew/3.13.rst:612 msgid ":class:`subprocess.Popen`" -msgstr "" +msgstr ":class:`subprocess.Popen`" -#: ../../whatsnew/3.13.rst:612 +#: ../../whatsnew/3.13.rst:614 msgid "(Contributed by Victor Stinner in :gh:`114570`.)" msgstr "" -#: ../../whatsnew/3.13.rst:614 +#: ../../whatsnew/3.13.rst:616 msgid "" "Allow the *count* argument of :meth:`str.replace` to be a keyword. " "(Contributed by Hugo van Kemenade in :gh:`106487`.)" msgstr "" -#: ../../whatsnew/3.13.rst:617 +#: ../../whatsnew/3.13.rst:619 msgid "" "Many functions now emit a warning if a boolean value is passed as a file " "descriptor argument. This can help catch some errors earlier. (Contributed " "by Serhiy Storchaka in :gh:`82626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:622 +#: ../../whatsnew/3.13.rst:624 msgid "" "Added :attr:`!name` and :attr:`!mode` attributes for compressed and archived " "file-like objects in the :mod:`bz2`, :mod:`lzma`, :mod:`tarfile`, and :mod:" "`zipfile` modules. (Contributed by Serhiy Storchaka in :gh:`115961`.)" msgstr "" -#: ../../whatsnew/3.13.rst:627 -msgid "" -"Add a :attr:`~property.__name__` attribute on :class:`property` objects. " -"(Contributed by Eugene Toder in :gh:`101860`.)" -msgstr "" - -#: ../../whatsnew/3.13.rst:632 +#: ../../whatsnew/3.13.rst:631 msgid "New Modules" -msgstr "" +msgstr "新增模組" -#: ../../whatsnew/3.13.rst:634 +#: ../../whatsnew/3.13.rst:633 msgid "" ":mod:`dbm.sqlite3`: An SQLite backend for :mod:`dbm`. (Contributed by " "Raymond Hettinger and Erlend E. Aasland in :gh:`100414`.)" msgstr "" -#: ../../whatsnew/3.13.rst:639 +#: ../../whatsnew/3.13.rst:638 msgid "Improved Modules" -msgstr "" +msgstr "改進的模組" -#: ../../whatsnew/3.13.rst:643 +#: ../../whatsnew/3.13.rst:642 msgid "argparse" -msgstr "" +msgstr "argparse" -#: ../../whatsnew/3.13.rst:645 +#: ../../whatsnew/3.13.rst:644 msgid "" "Add the *deprecated* parameter to the :meth:`~argparse.ArgumentParser." "add_argument` and :meth:`!add_parser` methods, to enable deprecating command-" @@ -965,36 +973,36 @@ msgid "" "Storchaka in :gh:`83648`.)" msgstr "" -#: ../../whatsnew/3.13.rst:653 +#: ../../whatsnew/3.13.rst:652 msgid "array" -msgstr "" +msgstr "array" -#: ../../whatsnew/3.13.rst:655 +#: ../../whatsnew/3.13.rst:654 msgid "" "Add the ``'w'`` type code (``Py_UCS4``) for Unicode characters. It should be " "used instead of the deprecated ``'u'`` type code. (Contributed by Inada " "Naoki in :gh:`80480`.)" msgstr "" -#: ../../whatsnew/3.13.rst:659 +#: ../../whatsnew/3.13.rst:658 msgid "" "Register :class:`array.array` as a :class:`~collections.abc.MutableSequence` " "by implementing the :meth:`~array.array.clear` method. (Contributed by Mike " "Zimin in :gh:`114894`.)" msgstr "" -#: ../../whatsnew/3.13.rst:665 +#: ../../whatsnew/3.13.rst:664 msgid "ast" -msgstr "" +msgstr "ast" -#: ../../whatsnew/3.13.rst:667 +#: ../../whatsnew/3.13.rst:666 msgid "" "The constructors of node types in the :mod:`ast` module are now stricter in " -"the arguments they accept, with more intuitive behaviour when arguments are " +"the arguments they accept, with more intuitive behavior when arguments are " "omitted." msgstr "" -#: ../../whatsnew/3.13.rst:671 +#: ../../whatsnew/3.13.rst:670 msgid "" "If an optional field on an AST node is not included as an argument when " "constructing an instance, the field will now be set to ``None``. Similarly, " @@ -1004,7 +1012,7 @@ msgid "" "the newly constructed AST node instance.)" msgstr "" -#: ../../whatsnew/3.13.rst:679 +#: ../../whatsnew/3.13.rst:678 msgid "" "In all other cases, where a required argument is omitted, the node " "constructor will emit a :exc:`DeprecationWarning`. This will raise an " @@ -1013,31 +1021,31 @@ msgid "" "and will raise an exception in Python 3.15." msgstr "" -#: ../../whatsnew/3.13.rst:686 +#: ../../whatsnew/3.13.rst:685 msgid "" "These changes do not apply to user-defined subclasses of :class:`ast.AST` " "unless the class opts in to the new behavior by defining the :attr:`.AST." "_field_types` mapping." msgstr "" -#: ../../whatsnew/3.13.rst:690 +#: ../../whatsnew/3.13.rst:689 msgid "" "(Contributed by Jelle Zijlstra in :gh:`105858`, :gh:`117486`, and :gh:" "`118851`.)" msgstr "" -#: ../../whatsnew/3.13.rst:692 +#: ../../whatsnew/3.13.rst:691 msgid "" ":func:`ast.parse` now accepts an optional argument *optimize* which is " "passed on to :func:`compile`. This makes it possible to obtain an optimized " "AST. (Contributed by Irit Katriel in :gh:`108113`.)" msgstr "" -#: ../../whatsnew/3.13.rst:699 +#: ../../whatsnew/3.13.rst:698 msgid "asyncio" -msgstr "" +msgstr "asyncio" -#: ../../whatsnew/3.13.rst:701 +#: ../../whatsnew/3.13.rst:700 msgid "" ":func:`asyncio.as_completed` now returns an object that is both an :term:" "`asynchronous iterator` and a plain :term:`iterator` of :term:`awaitables " @@ -1047,14 +1055,14 @@ msgid "" "Arthur in :gh:`77714`.)" msgstr "" -#: ../../whatsnew/3.13.rst:709 +#: ../../whatsnew/3.13.rst:708 msgid "" ":meth:`asyncio.loop.create_unix_server` will now automatically remove the " "Unix socket when the server is closed. (Contributed by Pierre Ossman in :gh:" "`111246`.)" msgstr "" -#: ../../whatsnew/3.13.rst:713 +#: ../../whatsnew/3.13.rst:712 msgid "" ":meth:`.DatagramTransport.sendto` will now send zero-length datagrams if " "called with an empty bytes object. The transport flow control also now " @@ -1062,28 +1070,28 @@ msgid "" "(Contributed by Jamie Phan in :gh:`115199`.)" msgstr "" -#: ../../whatsnew/3.13.rst:719 +#: ../../whatsnew/3.13.rst:718 msgid "" "Add :meth:`Queue.shutdown ` and :exc:`~asyncio." "QueueShutDown` to manage queue termination. (Contributed by Laurie Opperman " "and Yves Duprat in :gh:`104228`.)" msgstr "" -#: ../../whatsnew/3.13.rst:723 +#: ../../whatsnew/3.13.rst:722 msgid "" "Add the :meth:`.Server.close_clients` and :meth:`.Server.abort_clients` " "methods, which more forcefully close an asyncio server. (Contributed by " "Pierre Ossman in :gh:`113538`.)" msgstr "" -#: ../../whatsnew/3.13.rst:727 +#: ../../whatsnew/3.13.rst:726 msgid "" "Accept a tuple of separators in :meth:`.StreamReader.readuntil`, stopping " "when any one of them is encountered. (Contributed by Bruce Merry in :gh:" "`81322`.)" msgstr "" -#: ../../whatsnew/3.13.rst:731 +#: ../../whatsnew/3.13.rst:730 msgid "" "Improve the behavior of :class:`~asyncio.TaskGroup` when an external " "cancellation collides with an internal cancellation. For example, when two " @@ -1092,7 +1100,7 @@ msgid "" "because its internal cancellation was swallowed by the inner task group." msgstr "" -#: ../../whatsnew/3.13.rst:738 +#: ../../whatsnew/3.13.rst:737 msgid "" "In the case where a task group is cancelled externally and also must raise " "an :exc:`ExceptionGroup`, it will now call the parent task's :meth:`~asyncio." @@ -1100,24 +1108,24 @@ msgid "" "be raised at the next :keyword:`await`, so the cancellation is not lost." msgstr "" -#: ../../whatsnew/3.13.rst:744 +#: ../../whatsnew/3.13.rst:743 msgid "" "An added benefit of these changes is that task groups now preserve the " "cancellation count (:meth:`~asyncio.Task.cancelling`)." msgstr "" -#: ../../whatsnew/3.13.rst:747 +#: ../../whatsnew/3.13.rst:746 msgid "" "In order to handle some corner cases, :meth:`~asyncio.Task.uncancel` may now " "reset the undocumented ``_must_cancel`` flag when the cancellation count " "reaches zero." msgstr "" -#: ../../whatsnew/3.13.rst:751 +#: ../../whatsnew/3.13.rst:750 msgid "(Inspired by an issue reported by Arthur Tacca in :gh:`116720`.)" msgstr "" -#: ../../whatsnew/3.13.rst:753 +#: ../../whatsnew/3.13.rst:752 msgid "" "When :meth:`.TaskGroup.create_task` is called on an inactive :class:" "`~asyncio.TaskGroup`, the given coroutine will be closed (which prevents a :" @@ -1125,46 +1133,46 @@ msgid "" "(Contributed by Arthur Tacca and Jason Zhang in :gh:`115957`.)" msgstr "" -#: ../../whatsnew/3.13.rst:761 +#: ../../whatsnew/3.13.rst:760 msgid "base64" -msgstr "" +msgstr "base64" -#: ../../whatsnew/3.13.rst:763 +#: ../../whatsnew/3.13.rst:762 msgid "" "Add :func:`~base64.z85encode` and :func:`~base64.z85decode` functions for " "encoding :class:`bytes` as `Z85 data`_ and decoding Z85-encoded data to :" "class:`!bytes`. (Contributed by Matan Perelman in :gh:`75299`.)" msgstr "" -#: ../../whatsnew/3.13.rst:772 +#: ../../whatsnew/3.13.rst:771 msgid "compileall" -msgstr "" +msgstr "compileall" -#: ../../whatsnew/3.13.rst:774 ../../whatsnew/3.13.rst:790 -#: ../../whatsnew/3.13.rst:1050 +#: ../../whatsnew/3.13.rst:773 ../../whatsnew/3.13.rst:789 +#: ../../whatsnew/3.13.rst:1049 msgid "" "The default number of worker threads and processes is now selected using :" "func:`os.process_cpu_count` instead of :func:`os.cpu_count`. (Contributed by " "Victor Stinner in :gh:`109649`.)" msgstr "" -#: ../../whatsnew/3.13.rst:780 ../../whatsnew/3.13.rst:796 -#: ../../whatsnew/3.13.rst:1646 +#: ../../whatsnew/3.13.rst:779 ../../whatsnew/3.13.rst:795 +#: ../../whatsnew/3.13.rst:1649 msgid "configparser" -msgstr "" +msgstr "configparser" -#: ../../whatsnew/3.13.rst:782 +#: ../../whatsnew/3.13.rst:781 msgid "" "The :class:`configparser.ConfigParser` now accepts unnamed sections before " "named ones if configured to do so. (Contributed by Pedro Sousa Lacerda in :" "gh:`66449`.)" msgstr "" -#: ../../whatsnew/3.13.rst:788 +#: ../../whatsnew/3.13.rst:787 msgid "concurrent.futures" -msgstr "" +msgstr "concurrent.futures" -#: ../../whatsnew/3.13.rst:798 +#: ../../whatsnew/3.13.rst:797 msgid "" ":class:`~configparser.ConfigParser` now has support for unnamed sections, " "which allows for top-level key-value pairs. This can be enabled with the new " @@ -1172,11 +1180,11 @@ msgid "" "gh:`66449`.)" msgstr "" -#: ../../whatsnew/3.13.rst:805 +#: ../../whatsnew/3.13.rst:804 msgid "copy" -msgstr "" +msgstr "copy" -#: ../../whatsnew/3.13.rst:807 +#: ../../whatsnew/3.13.rst:806 msgid "" "The new :func:`~copy.replace` function and the :meth:`replace protocol " "` make creating modified copies of objects much simpler. " @@ -1185,61 +1193,62 @@ msgid "" "protocol:" msgstr "" -#: ../../whatsnew/3.13.rst:813 +#: ../../whatsnew/3.13.rst:812 msgid ":func:`collections.namedtuple`" -msgstr "" +msgstr ":func:`collections.namedtuple`" -#: ../../whatsnew/3.13.rst:814 +#: ../../whatsnew/3.13.rst:813 msgid ":class:`dataclasses.dataclass`" -msgstr "" +msgstr ":class:`dataclasses.dataclass`" -#: ../../whatsnew/3.13.rst:815 +#: ../../whatsnew/3.13.rst:814 msgid "" ":class:`datetime.datetime`, :class:`datetime.date`, :class:`datetime.time`" msgstr "" +":class:`datetime.datetime`、:class:`datetime.date`、:class:`datetime.time`" -#: ../../whatsnew/3.13.rst:816 +#: ../../whatsnew/3.13.rst:815 msgid ":class:`inspect.Signature`, :class:`inspect.Parameter`" -msgstr "" +msgstr ":class:`inspect.Signature`、:class:`inspect.Parameter`" -#: ../../whatsnew/3.13.rst:817 +#: ../../whatsnew/3.13.rst:816 msgid ":class:`types.SimpleNamespace`" -msgstr "" +msgstr ":class:`types.SimpleNamespace`" -#: ../../whatsnew/3.13.rst:818 +#: ../../whatsnew/3.13.rst:817 msgid ":ref:`code objects `" msgstr "" -#: ../../whatsnew/3.13.rst:820 +#: ../../whatsnew/3.13.rst:819 msgid "" "Any user-defined class can also support :func:`copy.replace` by defining " "the :meth:`~object.__replace__` method. (Contributed by Serhiy Storchaka in :" "gh:`108751`.)" msgstr "" -#: ../../whatsnew/3.13.rst:826 +#: ../../whatsnew/3.13.rst:825 msgid "dbm" -msgstr "" +msgstr "dbm" -#: ../../whatsnew/3.13.rst:828 +#: ../../whatsnew/3.13.rst:827 msgid "" "Add :mod:`dbm.sqlite3`, a new module which implements an SQLite backend, and " "make it the default :mod:`!dbm` backend. (Contributed by Raymond Hettinger " "and Erlend E. Aasland in :gh:`100414`.)" msgstr "" -#: ../../whatsnew/3.13.rst:832 +#: ../../whatsnew/3.13.rst:831 msgid "" "Allow removing all items from the database through the new :meth:`.gdbm." "clear` and :meth:`.ndbm.clear` methods. (Contributed by Donghee Na in :gh:" "`107122`.)" msgstr "" -#: ../../whatsnew/3.13.rst:838 +#: ../../whatsnew/3.13.rst:837 msgid "dis" -msgstr "" +msgstr "dis" -#: ../../whatsnew/3.13.rst:840 +#: ../../whatsnew/3.13.rst:839 msgid "" "Change the output of :mod:`dis` module functions to show logical labels for " "jump targets and exception handlers, rather than offsets. The offsets can be " @@ -1247,7 +1256,7 @@ msgid "" "the *show_offsets* argument. (Contributed by Irit Katriel in :gh:`112137`.)" msgstr "" -#: ../../whatsnew/3.13.rst:847 +#: ../../whatsnew/3.13.rst:846 msgid "" ":meth:`~dis.get_instructions` no longer represents cache entries as separate " "instructions. Instead, it returns them as part of the :class:`~dis." @@ -1256,11 +1265,11 @@ msgid "" "(Contributed by Irit Katriel in :gh:`112962`.)" msgstr "" -#: ../../whatsnew/3.13.rst:859 +#: ../../whatsnew/3.13.rst:858 msgid "doctest" -msgstr "" +msgstr "doctest" -#: ../../whatsnew/3.13.rst:861 +#: ../../whatsnew/3.13.rst:860 msgid "" ":mod:`doctest` output is now colored by default. This can be controlled via " "the new :envvar:`PYTHON_COLORS` environment variable as well as the " @@ -1269,18 +1278,18 @@ msgid "" "`117225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:868 +#: ../../whatsnew/3.13.rst:867 msgid "" "The :meth:`.DocTestRunner.run` method now counts the number of skipped " "tests. Add the :attr:`.DocTestRunner.skips` and :attr:`.TestResults.skipped` " "attributes. (Contributed by Victor Stinner in :gh:`108794`.)" msgstr "" -#: ../../whatsnew/3.13.rst:874 +#: ../../whatsnew/3.13.rst:873 msgid "email" -msgstr "" +msgstr "email" -#: ../../whatsnew/3.13.rst:876 +#: ../../whatsnew/3.13.rst:875 msgid "" "Headers with embedded newlines are now quoted on output. The :mod:`~email." "generator` will now refuse to serialize (write) headers that are improperly " @@ -1290,23 +1299,23 @@ msgid "" "Bloemsaat and Petr Viktorin in :gh:`121650`.)" msgstr "" -#: ../../whatsnew/3.13.rst:884 +#: ../../whatsnew/3.13.rst:883 msgid "" ":func:`~email.utils.getaddresses` and :func:`~email.utils.parseaddr` now " "return ``('', '')`` pairs in more situations where invalid email addresses " "are encountered instead of potentially inaccurate values. The two functions " "have a new optional *strict* parameter (default ``True``). To get the old " -"behaviour (accepting malformed input), use ``strict=False``. ``getattr(email." +"behavior (accepting malformed input), use ``strict=False``. ``getattr(email." "utils, 'supports_strict_parsing', False)`` can be used to check if the " "*strict* parameter is available. (Contributed by Thomas Dwyer and Victor " "Stinner for :gh:`102988` to improve the :cve:`2023-27043` fix.)" msgstr "" -#: ../../whatsnew/3.13.rst:896 +#: ../../whatsnew/3.13.rst:895 msgid "fractions" -msgstr "" +msgstr "fractions" -#: ../../whatsnew/3.13.rst:898 +#: ../../whatsnew/3.13.rst:897 msgid "" ":class:`~fractions.Fraction` objects now support the standard :ref:`format " "specification mini-language ` rules for fill, alignment, sign " @@ -1314,18 +1323,18 @@ msgid "" "`111320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:905 +#: ../../whatsnew/3.13.rst:904 msgid "gc" -msgstr "" +msgstr "gc" -#: ../../whatsnew/3.13.rst:907 +#: ../../whatsnew/3.13.rst:906 msgid "" "The cyclic garbage collector is now incremental, which changes the meaning " "of the results of :meth:`~gc.get_threshold` and :meth:`~gc.set_threshold` as " "well as :meth:`~gc.get_count` and :meth:`~gc.get_stats`." msgstr "" -#: ../../whatsnew/3.13.rst:912 +#: ../../whatsnew/3.13.rst:911 msgid "" "For backwards compatibility, :meth:`~gc.get_threshold` continues to return a " "three-item tuple. The first value is the threshold for young collections, as " @@ -1334,11 +1343,11 @@ msgid "" "is scanned more slowly). The third value is meaningless and is always zero." msgstr "" -#: ../../whatsnew/3.13.rst:920 +#: ../../whatsnew/3.13.rst:919 msgid ":meth:`~gc.set_threshold` ignores any items after the second." msgstr "" -#: ../../whatsnew/3.13.rst:922 +#: ../../whatsnew/3.13.rst:921 msgid "" ":meth:`~gc.get_count` and :meth:`~gc.get_stats` continue to return the same " "format of results. The only difference is that instead of the results " @@ -1346,29 +1355,29 @@ msgid "" "young generation and the aging and collecting spaces of the old generation." msgstr "" -#: ../../whatsnew/3.13.rst:929 +#: ../../whatsnew/3.13.rst:928 msgid "" "In summary, code that attempted to manipulate the behavior of the cycle GC " "may not work exactly as intended, but it is very unlikely to be harmful. All " "other code will work just fine." msgstr "" -#: ../../whatsnew/3.13.rst:935 +#: ../../whatsnew/3.13.rst:934 msgid "glob" -msgstr "" +msgstr "glob" -#: ../../whatsnew/3.13.rst:937 +#: ../../whatsnew/3.13.rst:936 msgid "" "Add :func:`~glob.translate`, a function to convert a path specification with " "shell-style wildcards to a regular expression. (Contributed by Barney Gale " "in :gh:`72904`.)" msgstr "" -#: ../../whatsnew/3.13.rst:943 +#: ../../whatsnew/3.13.rst:942 msgid "importlib" -msgstr "" +msgstr "importlib" -#: ../../whatsnew/3.13.rst:945 +#: ../../whatsnew/3.13.rst:944 msgid "" "The following functions in :mod:`importlib.resources` now allow accessing a " "directory (or tree) of resources, using multiple positional arguments (the " @@ -1376,37 +1385,37 @@ msgid "" "keyword-only):" msgstr "" -#: ../../whatsnew/3.13.rst:950 +#: ../../whatsnew/3.13.rst:949 msgid ":func:`~importlib.resources.is_resource`" -msgstr "" +msgstr ":func:`~importlib.resources.is_resource`" -#: ../../whatsnew/3.13.rst:951 +#: ../../whatsnew/3.13.rst:950 msgid ":func:`~importlib.resources.open_binary`" -msgstr "" +msgstr ":func:`~importlib.resources.open_binary`" -#: ../../whatsnew/3.13.rst:952 +#: ../../whatsnew/3.13.rst:951 msgid ":func:`~importlib.resources.open_text`" -msgstr "" +msgstr ":func:`~importlib.resources.open_text`" -#: ../../whatsnew/3.13.rst:953 +#: ../../whatsnew/3.13.rst:952 msgid ":func:`~importlib.resources.path`" -msgstr "" +msgstr ":func:`~importlib.resources.path`" -#: ../../whatsnew/3.13.rst:954 +#: ../../whatsnew/3.13.rst:953 msgid ":func:`~importlib.resources.read_binary`" -msgstr "" +msgstr ":func:`~importlib.resources.read_binary`" -#: ../../whatsnew/3.13.rst:955 +#: ../../whatsnew/3.13.rst:954 msgid ":func:`~importlib.resources.read_text`" -msgstr "" +msgstr ":func:`~importlib.resources.read_text`" -#: ../../whatsnew/3.13.rst:957 +#: ../../whatsnew/3.13.rst:956 msgid "" "These functions are no longer deprecated and are not scheduled for removal. " "(Contributed by Petr Viktorin in :gh:`106532`.)" msgstr "" -#: ../../whatsnew/3.13.rst:960 +#: ../../whatsnew/3.13.rst:959 msgid "" ":func:`~importlib.resources.contents` remains deprecated in favor of the " "fully-featured :class:`~importlib.resources.abc.Traversable` API. However, " @@ -1414,11 +1423,11 @@ msgid "" "`106532`.)" msgstr "" -#: ../../whatsnew/3.13.rst:967 +#: ../../whatsnew/3.13.rst:966 msgid "io" -msgstr "" +msgstr "io" -#: ../../whatsnew/3.13.rst:969 +#: ../../whatsnew/3.13.rst:968 msgid "" "The :class:`~io.IOBase` finalizer now logs any errors raised by the :meth:" "`~io.IOBase.close` method with :data:`sys.unraisablehook`. Previously, " @@ -1427,17 +1436,17 @@ msgid "" "build>`. (Contributed by Victor Stinner in :gh:`62948`.)" msgstr "" -#: ../../whatsnew/3.13.rst:978 +#: ../../whatsnew/3.13.rst:977 msgid "ipaddress" -msgstr "" +msgstr "ipaddress" -#: ../../whatsnew/3.13.rst:980 +#: ../../whatsnew/3.13.rst:979 msgid "" "Add the :attr:`.IPv4Address.ipv6_mapped` property, which returns the IPv4-" "mapped IPv6 address. (Contributed by Charles Machalow in :gh:`109466`.)" msgstr "" -#: ../../whatsnew/3.13.rst:984 +#: ../../whatsnew/3.13.rst:983 msgid "" "Fix ``is_global`` and ``is_private`` behavior in :class:`~ipaddress." "IPv4Address`, :class:`~ipaddress.IPv6Address`, :class:`~ipaddress." @@ -1445,22 +1454,22 @@ msgid "" "Stasiak in :gh:`113171`.)" msgstr "" -#: ../../whatsnew/3.13.rst:991 +#: ../../whatsnew/3.13.rst:990 msgid "itertools" -msgstr "" +msgstr "itertools" -#: ../../whatsnew/3.13.rst:993 +#: ../../whatsnew/3.13.rst:992 msgid "" ":func:`~itertools.batched` has a new *strict* parameter, which raises a :exc:" "`ValueError` if the final batch is shorter than the specified batch size. " "(Contributed by Raymond Hettinger in :gh:`113202`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1000 +#: ../../whatsnew/3.13.rst:999 msgid "marshal" -msgstr "" +msgstr "marshal" -#: ../../whatsnew/3.13.rst:1002 +#: ../../whatsnew/3.13.rst:1001 msgid "" "Add the *allow_code* parameter in module functions. Passing " "``allow_code=False`` prevents serialization and de-serialization of code " @@ -1468,11 +1477,11 @@ msgid "" "Serhiy Storchaka in :gh:`113626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1009 +#: ../../whatsnew/3.13.rst:1008 msgid "math" -msgstr "" +msgstr "math" -#: ../../whatsnew/3.13.rst:1011 +#: ../../whatsnew/3.13.rst:1010 msgid "" "The new function :func:`~math.fma` performs fused multiply-add operations. " "This computes ``x * y + z`` with only a single round, and so avoids any " @@ -1482,11 +1491,11 @@ msgid "" "Stinner in :gh:`73468`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1021 +#: ../../whatsnew/3.13.rst:1020 msgid "mimetypes" -msgstr "" +msgstr "mimetypes" -#: ../../whatsnew/3.13.rst:1023 +#: ../../whatsnew/3.13.rst:1022 msgid "" "Add the :func:`~mimetypes.guess_file_type` function to guess a MIME type " "from a filesystem path. Using paths with :func:`~mimetypes.guess_type` is " @@ -1494,18 +1503,18 @@ msgid "" "`66543`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1030 +#: ../../whatsnew/3.13.rst:1029 msgid "mmap" -msgstr "" +msgstr "mmap" -#: ../../whatsnew/3.13.rst:1032 +#: ../../whatsnew/3.13.rst:1031 msgid "" ":class:`~mmap.mmap` is now protected from crashing on Windows when the " "mapped memory is inaccessible due to file system errors or access " "violations. (Contributed by Jannis Weigend in :gh:`118209`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1036 +#: ../../whatsnew/3.13.rst:1035 msgid "" ":class:`~mmap.mmap` has a new :meth:`~mmap.mmap.seekable` method that can be " "used when a seekable file-like object is required. The :meth:`~mmap.mmap." @@ -1513,7 +1522,7 @@ msgid "" "Na and Sylvie Liberman in :gh:`111835`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1041 +#: ../../whatsnew/3.13.rst:1040 msgid "" "The new UNIX-only *trackfd* parameter for :class:`~mmap.mmap` controls file " "descriptor duplication; if false, the file descriptor specified by *fileno* " @@ -1521,22 +1530,22 @@ msgid "" "gh:`78502`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1048 +#: ../../whatsnew/3.13.rst:1047 msgid "multiprocessing" -msgstr "" +msgstr "multiprocessing" -#: ../../whatsnew/3.13.rst:1056 +#: ../../whatsnew/3.13.rst:1055 msgid "os" -msgstr "" +msgstr "os" -#: ../../whatsnew/3.13.rst:1058 +#: ../../whatsnew/3.13.rst:1057 msgid "" "Add :func:`~os.process_cpu_count` function to get the number of logical CPU " "cores usable by the calling thread of the current process. (Contributed by " "Victor Stinner in :gh:`109649`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1062 +#: ../../whatsnew/3.13.rst:1061 msgid "" ":func:`~os.cpu_count` and :func:`~os.process_cpu_count` can be overridden " "through the new environment variable :envvar:`PYTHON_CPU_COUNT` or the new " @@ -1546,7 +1555,7 @@ msgid "" "Na in :gh:`109595`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1070 +#: ../../whatsnew/3.13.rst:1069 msgid "" "Add a :ref:`low level interface ` to Linux's :manpage:`timer " "file descriptors ` via :func:`~os.timerfd_create`, :func:" @@ -1557,7 +1566,7 @@ msgid "" "in :gh:`108277`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1079 +#: ../../whatsnew/3.13.rst:1078 msgid "" ":func:`~os.lchmod` and the *follow_symlinks* argument of :func:`~os.chmod` " "are both now available on Windows. Note that the default value of " @@ -1565,14 +1574,14 @@ msgid "" "by Serhiy Storchaka in :gh:`59616`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1085 +#: ../../whatsnew/3.13.rst:1084 msgid "" ":func:`~os.fchmod` and support for file descriptors in :func:`~os.chmod` are " "both now available on Windows. (Contributed by Serhiy Storchaka in :gh:" "`113191`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1089 +#: ../../whatsnew/3.13.rst:1088 msgid "" "On Windows, :func:`~os.mkdir` and :func:`~os.makedirs` now support passing a " "*mode* value of ``0o700`` to apply access control to the new directory. This " @@ -1581,14 +1590,14 @@ msgid "" "Steve Dower in :gh:`118486`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1096 +#: ../../whatsnew/3.13.rst:1095 msgid "" ":func:`~os.posix_spawn` now accepts ``None`` for the *env* argument, which " "makes the newly spawned process use the current process environment. " "(Contributed by Jakub Kulik in :gh:`113119`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1100 +#: ../../whatsnew/3.13.rst:1099 msgid "" ":func:`~os.posix_spawn` can now use the :attr:`~os.POSIX_SPAWN_CLOSEFROM` " "attribute in the *file_actions* parameter on platforms that support :c:func:" @@ -1596,76 +1605,76 @@ msgid "" "gh:`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1107 +#: ../../whatsnew/3.13.rst:1106 msgid "os.path" -msgstr "" +msgstr "os.path" -#: ../../whatsnew/3.13.rst:1109 +#: ../../whatsnew/3.13.rst:1108 msgid "" "Add :func:`~os.path.isreserved` to check if a path is reserved on the " "current system. This function is only available on Windows. (Contributed by " "Barney Gale in :gh:`88569`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1114 +#: ../../whatsnew/3.13.rst:1113 msgid "" "On Windows, :func:`~os.path.isabs` no longer considers paths starting with " "exactly one slash (``\\`` or ``/``) to be absolute. (Contributed by Barney " "Gale and Jon Foster in :gh:`44626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1118 +#: ../../whatsnew/3.13.rst:1117 msgid "" ":func:`~os.path.realpath` now resolves MS-DOS style file names even if the " "file is not accessible. (Contributed by Moonsik Park in :gh:`82367`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1124 ../../whatsnew/3.13.rst:1686 +#: ../../whatsnew/3.13.rst:1123 ../../whatsnew/3.13.rst:1689 msgid "pathlib" -msgstr "" +msgstr "pathlib" -#: ../../whatsnew/3.13.rst:1126 +#: ../../whatsnew/3.13.rst:1125 msgid "" "Add :exc:`~pathlib.UnsupportedOperation`, which is raised instead of :exc:" "`NotImplementedError` when a path operation isn't supported. (Contributed by " "Barney Gale in :gh:`89812`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1130 +#: ../../whatsnew/3.13.rst:1129 msgid "" "Add a new constructor for creating :class:`~pathlib.Path` objects from " "'file' URIs (``file:///``), :meth:`.Path.from_uri`. (Contributed by Barney " "Gale in :gh:`107465`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1134 +#: ../../whatsnew/3.13.rst:1133 msgid "" "Add :meth:`.PurePath.full_match` for matching paths with shell-style " "wildcards, including the recursive wildcard \"``**``\". (Contributed by " "Barney Gale in :gh:`73435`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1138 +#: ../../whatsnew/3.13.rst:1137 msgid "" "Add the :attr:`.PurePath.parser` class attribute to store the implementation " "of :mod:`os.path` used for low-level path parsing and joining. This will be " "either :mod:`!posixpath` or :mod:`!ntpath`." msgstr "" -#: ../../whatsnew/3.13.rst:1143 +#: ../../whatsnew/3.13.rst:1142 msgid "" "Add *recurse_symlinks* keyword-only argument to :meth:`.Path.glob` and :meth:" "`~pathlib.Path.rglob`. (Contributed by Barney Gale in :gh:`77609`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1147 +#: ../../whatsnew/3.13.rst:1146 msgid "" ":meth:`.Path.glob` and :meth:`~pathlib.Path.rglob` now return files and " "directories when given a pattern that ends with \"``**``\". Previously, only " "directories were returned. (Contributed by Barney Gale in :gh:`70303`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1152 +#: ../../whatsnew/3.13.rst:1151 msgid "" "Add the *follow_symlinks* keyword-only argument to :meth:`Path.is_file " "`, :meth:`Path.is_dir `, :meth:`." @@ -1673,11 +1682,11 @@ msgid "" "`105793` and Kamil Turek in :gh:`107962`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1160 +#: ../../whatsnew/3.13.rst:1159 msgid "pdb" -msgstr "" +msgstr "pdb" -#: ../../whatsnew/3.13.rst:1162 +#: ../../whatsnew/3.13.rst:1161 msgid "" ":func:`breakpoint` and :func:`~pdb.set_trace` now enter the debugger " "immediately rather than on the next line of code to be executed. This change " @@ -1686,20 +1695,20 @@ msgid "" "Gao in :gh:`118579`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1168 +#: ../../whatsnew/3.13.rst:1167 msgid "" "``sys.path[0]`` is no longer replaced by the directory of the script being " "debugged when :attr:`sys.flags.safe_path` is set. (Contributed by Tian Gao " "and Christian Walther in :gh:`111762`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1172 +#: ../../whatsnew/3.13.rst:1171 msgid "" ":mod:`zipapp` is now supported as a debugging target. (Contributed by Tian " "Gao in :gh:`118501`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1175 +#: ../../whatsnew/3.13.rst:1174 msgid "" "Add ability to move between chained exceptions during post-mortem debugging " "in :func:`~pdb.pm` using the new :pdbcmd:`exceptions [exc_number] " @@ -1707,101 +1716,101 @@ msgid "" "`106676`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1180 +#: ../../whatsnew/3.13.rst:1179 msgid "" "Expressions and statements whose prefix is a pdb command are now correctly " "identified and executed. (Contributed by Tian Gao in :gh:`108464`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1186 +#: ../../whatsnew/3.13.rst:1185 msgid "queue" -msgstr "" +msgstr "queue" -#: ../../whatsnew/3.13.rst:1188 +#: ../../whatsnew/3.13.rst:1187 msgid "" "Add :meth:`Queue.shutdown ` and :exc:`~queue.ShutDown` " "to manage queue termination. (Contributed by Laurie Opperman and Yves Duprat " "in :gh:`104750`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1194 +#: ../../whatsnew/3.13.rst:1193 msgid "random" -msgstr "" +msgstr "random" -#: ../../whatsnew/3.13.rst:1196 +#: ../../whatsnew/3.13.rst:1195 msgid "" "Add a :ref:`command-line interface `. (Contributed by Hugo van " "Kemenade in :gh:`118131`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1201 ../../whatsnew/3.13.rst:1694 +#: ../../whatsnew/3.13.rst:1200 ../../whatsnew/3.13.rst:1697 msgid "re" -msgstr "" +msgstr "re" -#: ../../whatsnew/3.13.rst:1203 +#: ../../whatsnew/3.13.rst:1202 msgid "" "Rename :exc:`!re.error` to :exc:`~re.PatternError` for improved clarity. :" "exc:`!re.error` is kept for backward compatibility." msgstr "" -#: ../../whatsnew/3.13.rst:1208 +#: ../../whatsnew/3.13.rst:1207 msgid "shutil" -msgstr "" +msgstr "shutil" -#: ../../whatsnew/3.13.rst:1210 +#: ../../whatsnew/3.13.rst:1209 msgid "" "Support the *dir_fd* and *follow_symlinks* keyword arguments in :func:" "`~shutil.chown`. (Contributed by Berker Peksag and Tahia K in :gh:`62308`)" msgstr "" -#: ../../whatsnew/3.13.rst:1216 +#: ../../whatsnew/3.13.rst:1215 msgid "site" -msgstr "" +msgstr "site" -#: ../../whatsnew/3.13.rst:1218 +#: ../../whatsnew/3.13.rst:1217 msgid "" ":file:`.pth` files are now decoded using UTF-8 first, and then with the :" "term:`locale encoding` if UTF-8 decoding fails. (Contributed by Inada Naoki " "in :gh:`117802`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1224 +#: ../../whatsnew/3.13.rst:1223 msgid "sqlite3" -msgstr "" +msgstr "sqlite3" -#: ../../whatsnew/3.13.rst:1226 +#: ../../whatsnew/3.13.rst:1225 msgid "" "A :exc:`ResourceWarning` is now emitted if a :class:`~sqlite3.Connection` " "object is not :meth:`closed ` explicitly. " "(Contributed by Erlend E. Aasland in :gh:`105539`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1230 +#: ../../whatsnew/3.13.rst:1229 msgid "" "Add the *filter* keyword-only parameter to :meth:`.Connection.iterdump` for " "filtering database objects to dump. (Contributed by Mariusz Felisiak in :gh:" "`91602`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1236 +#: ../../whatsnew/3.13.rst:1235 msgid "ssl" -msgstr "" +msgstr "ssl" -#: ../../whatsnew/3.13.rst:1238 +#: ../../whatsnew/3.13.rst:1237 msgid "" "The :func:`~ssl.create_default_context` API now includes :data:`~ssl." "VERIFY_X509_PARTIAL_CHAIN` and :data:`~ssl.VERIFY_X509_STRICT` in its " "default flags." msgstr "" -#: ../../whatsnew/3.13.rst:1244 +#: ../../whatsnew/3.13.rst:1243 msgid "" ":data:`~ssl.VERIFY_X509_STRICT` may reject pre-:rfc:`5280` or malformed " "certificates that the underlying OpenSSL implementation might otherwise " "accept. Whilst disabling this is not recommended, you can do so using:" msgstr "" -#: ../../whatsnew/3.13.rst:1249 +#: ../../whatsnew/3.13.rst:1248 msgid "" "import ssl\n" "\n" @@ -1809,15 +1818,15 @@ msgid "" "ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" msgstr "" -#: ../../whatsnew/3.13.rst:1256 +#: ../../whatsnew/3.13.rst:1255 msgid "(Contributed by William Woodruff in :gh:`112389`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1260 +#: ../../whatsnew/3.13.rst:1259 msgid "statistics" -msgstr "" +msgstr "statistics" -#: ../../whatsnew/3.13.rst:1262 +#: ../../whatsnew/3.13.rst:1261 msgid "" "Add :func:`~statistics.kde` for kernel density estimation. This makes it " "possible to estimate a continuous probability density function from a fixed " @@ -1825,24 +1834,24 @@ msgid "" "`115863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1267 +#: ../../whatsnew/3.13.rst:1266 msgid "" "Add :func:`~statistics.kde_random` for sampling from an estimated " "probability density function created by :func:`~statistics.kde`. " "(Contributed by Raymond Hettinger in :gh:`115863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1275 +#: ../../whatsnew/3.13.rst:1274 msgid "subprocess" -msgstr "" +msgstr "subprocess" -#: ../../whatsnew/3.13.rst:1277 +#: ../../whatsnew/3.13.rst:1276 msgid "" "The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " "in more situations." msgstr "" -#: ../../whatsnew/3.13.rst:1280 +#: ../../whatsnew/3.13.rst:1279 msgid "" "Notably, when *close_fds* is ``True`` (the default), :func:`~os.posix_spawn` " "will be used when the C library provides :c:func:`!" @@ -1851,7 +1860,7 @@ msgid "" "existing Linux :c:func:`!vfork` based code." msgstr "" -#: ../../whatsnew/3.13.rst:1287 +#: ../../whatsnew/3.13.rst:1286 msgid "" "A private control knob :attr:`!subprocess._USE_POSIX_SPAWN` can be set to " "``False`` if you need to force :mod:`subprocess` to never use :func:`~os." @@ -1861,22 +1870,22 @@ msgid "" "`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1297 +#: ../../whatsnew/3.13.rst:1296 msgid "sys" -msgstr "" +msgstr "sys" -#: ../../whatsnew/3.13.rst:1299 +#: ../../whatsnew/3.13.rst:1298 msgid "" "Add the :func:`~sys._is_interned` function to test if a string was interned. " "This function is not guaranteed to exist in all implementations of Python. " "(Contributed by Serhiy Storchaka in :gh:`78573`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1305 +#: ../../whatsnew/3.13.rst:1304 msgid "tempfile" -msgstr "" +msgstr "tempfile" -#: ../../whatsnew/3.13.rst:1307 +#: ../../whatsnew/3.13.rst:1306 msgid "" "On Windows, the default mode ``0o700`` used by :func:`tempfile.mkdtemp` now " "limits access to the new directory due to changes to :func:`os.mkdir`. This " @@ -1884,11 +1893,11 @@ msgid "" "`118486`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1314 +#: ../../whatsnew/3.13.rst:1313 msgid "time" -msgstr "" +msgstr "time" -#: ../../whatsnew/3.13.rst:1316 +#: ../../whatsnew/3.13.rst:1315 msgid "" "On Windows, :func:`~time.monotonic` now uses the " "``QueryPerformanceCounter()`` clock for a resolution of 1 microsecond, " @@ -1896,7 +1905,7 @@ msgid "" "milliseconds. (Contributed by Victor Stinner in :gh:`88494`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1322 +#: ../../whatsnew/3.13.rst:1321 msgid "" "On Windows, :func:`~time.time` now uses the " "``GetSystemTimePreciseAsFileTime()`` clock for a resolution of 1 " @@ -1905,11 +1914,11 @@ msgid "" "`63207`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1330 +#: ../../whatsnew/3.13.rst:1329 msgid "tkinter" -msgstr "" +msgstr "tkinter" -#: ../../whatsnew/3.13.rst:1332 +#: ../../whatsnew/3.13.rst:1331 msgid "" "Add :mod:`tkinter` widget methods: :meth:`!tk_busy_hold`, :meth:`!" "tk_busy_configure`, :meth:`!tk_busy_cget`, :meth:`!tk_busy_forget`, :meth:`!" @@ -1917,7 +1926,7 @@ msgid "" "klappnase and Serhiy Storchaka in :gh:`72684`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1338 +#: ../../whatsnew/3.13.rst:1337 msgid "" "The :mod:`tkinter` widget method :meth:`!wm_attributes` now accepts the " "attribute name without the minus prefix to get window attributes, for " @@ -1926,14 +1935,14 @@ msgid "" "wm_attributes(alpha=0.5)``. (Contributed by Serhiy Storchaka in :gh:`43457`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1345 +#: ../../whatsnew/3.13.rst:1344 msgid "" ":meth:`!wm_attributes` can now return attributes as a :class:`dict`, by " "using the new optional keyword-only parameter *return_python_dict*. " "(Contributed by Serhiy Storchaka in :gh:`43457`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1349 +#: ../../whatsnew/3.13.rst:1348 msgid "" ":meth:`!Text.count` can now return a simple :class:`int` when the new " "optional keyword-only parameter *return_ints* is used. Otherwise, the single " @@ -1941,27 +1950,27 @@ msgid "" "in :gh:`97928`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1354 +#: ../../whatsnew/3.13.rst:1353 msgid "" "Support the \"vsapi\" element type in the :meth:`~tkinter.ttk.Style." "element_create` method of :class:`tkinter.ttk.Style`. (Contributed by Serhiy " "Storchaka in :gh:`68166`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1359 +#: ../../whatsnew/3.13.rst:1358 msgid "" "Add the :meth:`!after_info` method for Tkinter widgets. (Contributed by " "Cheryl Sabella in :gh:`77020`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1362 +#: ../../whatsnew/3.13.rst:1361 msgid "" "Add a new :meth:`!copy_replace` method to :class:`!PhotoImage` to copy a " "region from one image to another, possibly with pixel zooming, subsampling, " "or both. (Contributed by Serhiy Storchaka in :gh:`118225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1367 +#: ../../whatsnew/3.13.rst:1366 msgid "" "Add *from_coords* parameter to the :class:`!PhotoImage` methods :meth:`!" "copy`, :meth:`!zoom` and :meth:`!subsample`. Add *zoom* and *subsample* " @@ -1969,7 +1978,7 @@ msgid "" "Serhiy Storchaka in :gh:`118225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1373 +#: ../../whatsnew/3.13.rst:1372 msgid "" "Add the :class:`!PhotoImage` methods :meth:`!read` to read an image from a " "file and :meth:`!data` to get the image data. Add *background* and " @@ -1977,11 +1986,11 @@ msgid "" "Storchaka in :gh:`118271`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1381 +#: ../../whatsnew/3.13.rst:1380 msgid "traceback" -msgstr "" +msgstr "traceback" -#: ../../whatsnew/3.13.rst:1383 +#: ../../whatsnew/3.13.rst:1382 msgid "" "Add the :attr:`~traceback.TracebackException.exc_type_str` attribute to :" "class:`~traceback.TracebackException`, which holds a string display of the " @@ -1991,7 +2000,7 @@ msgid "" "(Contributed by Irit Katriel in :gh:`112332`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1392 +#: ../../whatsnew/3.13.rst:1391 msgid "" "Add a new *show_group* keyword-only parameter to :meth:`.TracebackException." "format_exception_only` to (recursively) format the nested exceptions of a :" @@ -1999,11 +2008,11 @@ msgid "" "`105292`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1399 +#: ../../whatsnew/3.13.rst:1398 msgid "types" -msgstr "" +msgstr "types" -#: ../../whatsnew/3.13.rst:1401 +#: ../../whatsnew/3.13.rst:1400 msgid "" ":class:`~types.SimpleNamespace` can now take a single positional argument to " "initialise the namespace's arguments. This argument must either be a mapping " @@ -2011,63 +2020,63 @@ msgid "" "`108191`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1408 ../../whatsnew/3.13.rst:1719 +#: ../../whatsnew/3.13.rst:1407 ../../whatsnew/3.13.rst:1722 msgid "typing" -msgstr "" +msgstr "typing" -#: ../../whatsnew/3.13.rst:1410 +#: ../../whatsnew/3.13.rst:1409 msgid "" ":pep:`705`: Add :data:`~typing.ReadOnly`, a special typing construct to mark " "a :class:`~typing.TypedDict` item as read-only for type checkers." msgstr "" -#: ../../whatsnew/3.13.rst:1413 +#: ../../whatsnew/3.13.rst:1412 msgid "" ":pep:`742`: Add :data:`~typing.TypeIs`, a typing construct that can be used " "to instruct a type checker how to narrow a type." msgstr "" -#: ../../whatsnew/3.13.rst:1416 +#: ../../whatsnew/3.13.rst:1415 msgid "" "Add :data:`~typing.NoDefault`, a sentinel object used to represent the " "defaults of some parameters in the :mod:`typing` module. (Contributed by " "Jelle Zijlstra in :gh:`116126`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1420 +#: ../../whatsnew/3.13.rst:1419 msgid "" "Add :func:`~typing.get_protocol_members` to return the set of members " "defining a :class:`typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:" "`104873`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1424 +#: ../../whatsnew/3.13.rst:1423 msgid "" "Add :func:`~typing.is_protocol` to check whether a class is a :class:" "`~typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:`104873`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1428 +#: ../../whatsnew/3.13.rst:1427 msgid "" ":data:`~typing.ClassVar` can now be nested in :data:`~typing.Final`, and " "vice versa. (Contributed by Mehdi Drissi in :gh:`89547`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1434 +#: ../../whatsnew/3.13.rst:1433 msgid "unicodedata" -msgstr "" +msgstr "unicodedata" -#: ../../whatsnew/3.13.rst:1436 +#: ../../whatsnew/3.13.rst:1435 msgid "" "Update the Unicode database to `version 15.1.0`__. (Contributed by James " "Gerity in :gh:`109559`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1443 +#: ../../whatsnew/3.13.rst:1442 msgid "venv" -msgstr "" +msgstr "venv" -#: ../../whatsnew/3.13.rst:1445 +#: ../../whatsnew/3.13.rst:1444 msgid "" "Add support for creating source control management (SCM) ignore files in a " "virtual environment's directory. By default, Git is supported. This is " @@ -2077,11 +2086,11 @@ msgid "" "Cannon in :gh:`108125`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1456 +#: ../../whatsnew/3.13.rst:1455 msgid "warnings" -msgstr "" +msgstr "warnings" -#: ../../whatsnew/3.13.rst:1458 +#: ../../whatsnew/3.13.rst:1457 msgid "" ":pep:`702`: The new :func:`warnings.deprecated` decorator provides a way to " "communicate deprecations to a :term:`static type checker` and to warn on " @@ -2090,69 +2099,69 @@ msgid "" "(Contributed by Jelle Zijlstra in :gh:`104003`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1467 +#: ../../whatsnew/3.13.rst:1466 msgid "xml" -msgstr "" +msgstr "xml" -#: ../../whatsnew/3.13.rst:1469 +#: ../../whatsnew/3.13.rst:1468 msgid "" "Allow controlling Expat >=2.6.0 reparse deferral (:cve:`2023-52425`) by " "adding five new methods:" msgstr "" -#: ../../whatsnew/3.13.rst:1472 +#: ../../whatsnew/3.13.rst:1471 msgid ":meth:`xml.etree.ElementTree.XMLParser.flush`" -msgstr "" +msgstr ":meth:`xml.etree.ElementTree.XMLParser.flush`" -#: ../../whatsnew/3.13.rst:1473 +#: ../../whatsnew/3.13.rst:1472 msgid ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" -msgstr "" +msgstr ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" -#: ../../whatsnew/3.13.rst:1474 +#: ../../whatsnew/3.13.rst:1473 msgid ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" -msgstr "" +msgstr ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" -#: ../../whatsnew/3.13.rst:1475 +#: ../../whatsnew/3.13.rst:1474 msgid ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" -msgstr "" +msgstr ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" -#: ../../whatsnew/3.13.rst:1476 +#: ../../whatsnew/3.13.rst:1475 msgid ":meth:`!xml.sax.expatreader.ExpatParser.flush`" -msgstr "" +msgstr ":meth:`!xml.sax.expatreader.ExpatParser.flush`" -#: ../../whatsnew/3.13.rst:1478 +#: ../../whatsnew/3.13.rst:1477 msgid "(Contributed by Sebastian Pipping in :gh:`115623`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1480 +#: ../../whatsnew/3.13.rst:1479 msgid "" "Add the :meth:`!close` method for the iterator returned by :func:`~xml.etree." "ElementTree.iterparse` for explicit cleanup. (Contributed by Serhiy " "Storchaka in :gh:`69893`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1486 +#: ../../whatsnew/3.13.rst:1485 msgid "zipimport" -msgstr "" +msgstr "zipimport" -#: ../../whatsnew/3.13.rst:1488 +#: ../../whatsnew/3.13.rst:1487 msgid "" "Add support for ZIP64_ format files. Everybody loves huge data, right? " "(Contributed by Tim Hatch in :gh:`94146`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1496 +#: ../../whatsnew/3.13.rst:1495 msgid "Optimizations" -msgstr "" +msgstr "最佳化" -#: ../../whatsnew/3.13.rst:1498 +#: ../../whatsnew/3.13.rst:1497 msgid "" "The new :ref:`incremental garbage collector ` " "means that maximum pause times are reduced by an order of magnitude or more " "for larger heaps. (Contributed by Mark Shannon in :gh:`108362`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1503 +#: ../../whatsnew/3.13.rst:1502 msgid "" "Several standard library modules have had their import times significantly " "improved. For example, the import time of the :mod:`typing` module has been " @@ -2163,13 +2172,13 @@ msgid "" "Turner, Daniel Hollas, and others in :gh:`109653`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1514 +#: ../../whatsnew/3.13.rst:1513 msgid "" ":func:`textwrap.indent` is now around 30% faster than before for large " "input. (Contributed by Inada Naoki in :gh:`107369`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1517 +#: ../../whatsnew/3.13.rst:1516 msgid "" "The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " "in more situations, including when *close_fds* is ``True`` (the default) on " @@ -2179,15 +2188,15 @@ msgid "" "Kulik in :gh:`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1527 +#: ../../whatsnew/3.13.rst:1526 msgid "Removed Modules And APIs" msgstr "" -#: ../../whatsnew/3.13.rst:1533 +#: ../../whatsnew/3.13.rst:1532 msgid "PEP 594: Remove \"dead batteries\" from the standard library" msgstr "" -#: ../../whatsnew/3.13.rst:1535 +#: ../../whatsnew/3.13.rst:1534 msgid "" ":pep:`594` proposed removing 19 modules from the standard library, " "colloquially referred to as 'dead batteries' due to their historic, " @@ -2195,23 +2204,23 @@ msgid "" "in Python 3.11, and are now removed:" msgstr "" -#: ../../whatsnew/3.13.rst:1541 +#: ../../whatsnew/3.13.rst:1540 msgid ":mod:`!aifc`" -msgstr "" +msgstr ":mod:`!aifc`" -#: ../../whatsnew/3.13.rst:1542 +#: ../../whatsnew/3.13.rst:1541 msgid ":mod:`!audioop`" -msgstr "" +msgstr ":mod:`!audioop`" -#: ../../whatsnew/3.13.rst:1543 +#: ../../whatsnew/3.13.rst:1542 msgid ":mod:`!chunk`" -msgstr "" +msgstr ":mod:`!chunk`" -#: ../../whatsnew/3.13.rst:1544 +#: ../../whatsnew/3.13.rst:1543 msgid ":mod:`!cgi` and :mod:`!cgitb`" -msgstr "" +msgstr ":mod:`!cgi` 和 :mod:`!cgitb`" -#: ../../whatsnew/3.13.rst:1546 +#: ../../whatsnew/3.13.rst:1545 msgid "" ":class:`!cgi.FieldStorage` can typically be replaced with :func:`urllib." "parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." @@ -2219,7 +2228,7 @@ msgid "" "requests." msgstr "" -#: ../../whatsnew/3.13.rst:1551 +#: ../../whatsnew/3.13.rst:1550 msgid "" ":func:`!cgi.parse` can be replaced by calling :func:`urllib.parse.parse_qs` " "directly on the desired query string, unless the input is ``multipart/form-" @@ -2227,14 +2236,14 @@ msgid "" "parse_multipart`." msgstr "" -#: ../../whatsnew/3.13.rst:1556 +#: ../../whatsnew/3.13.rst:1555 msgid "" ":func:`!cgi.parse_header` can be replaced with the functionality in the :mod:" "`email` package, which implements the same MIME RFCs. For example, with :" "class:`email.message.EmailMessage`:" msgstr "" -#: ../../whatsnew/3.13.rst:1560 +#: ../../whatsnew/3.13.rst:1559 msgid "" "from email.message import EmailMessage\n" "\n" @@ -2243,7 +2252,7 @@ msgid "" "main, params = msg.get_content_type(), msg['content-type'].params" msgstr "" -#: ../../whatsnew/3.13.rst:1568 +#: ../../whatsnew/3.13.rst:1567 msgid "" ":func:`!cgi.parse_multipart` can be replaced with the functionality in the :" "mod:`email` package, which implements the same MIME RFCs, or with the :pypi:" @@ -2251,41 +2260,41 @@ msgid "" "and :class:`email.message.Message` classes." msgstr "" -#: ../../whatsnew/3.13.rst:1574 +#: ../../whatsnew/3.13.rst:1573 msgid "" ":mod:`!crypt` and the private :mod:`!_crypt` extension. The :mod:`hashlib` " "module may be an appropriate replacement when simply hashing a value is " "required. Otherwise, various third-party libraries on PyPI are available:" msgstr "" -#: ../../whatsnew/3.13.rst:1579 +#: ../../whatsnew/3.13.rst:1578 msgid "" ":pypi:`bcrypt`: Modern password hashing for your software and your servers." msgstr "" -#: ../../whatsnew/3.13.rst:1581 +#: ../../whatsnew/3.13.rst:1580 msgid "" ":pypi:`passlib`: Comprehensive password hashing framework supporting over 30 " "schemes." msgstr "" -#: ../../whatsnew/3.13.rst:1583 +#: ../../whatsnew/3.13.rst:1582 msgid ":pypi:`argon2-cffi`: The secure Argon2 password hashing algorithm." msgstr "" -#: ../../whatsnew/3.13.rst:1585 +#: ../../whatsnew/3.13.rst:1584 msgid "" ":pypi:`legacycrypt`: :mod:`ctypes` wrapper to the POSIX crypt library call " "and associated functionality." msgstr "" -#: ../../whatsnew/3.13.rst:1588 +#: ../../whatsnew/3.13.rst:1587 msgid "" ":pypi:`crypt_r`: Fork of the :mod:`!crypt` module, wrapper to the :manpage:" "`crypt_r(3)` library call and associated functionality." msgstr "" -#: ../../whatsnew/3.13.rst:1593 +#: ../../whatsnew/3.13.rst:1592 msgid "" ":mod:`!imghdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements. For example, the :func:`!" @@ -2293,83 +2302,83 @@ msgid "" "function for all file formats that were supported by :mod:`!imghdr`." msgstr "" -#: ../../whatsnew/3.13.rst:1599 +#: ../../whatsnew/3.13.rst:1598 msgid ":mod:`!mailcap`: Use the :mod:`mimetypes` module instead." msgstr "" -#: ../../whatsnew/3.13.rst:1601 +#: ../../whatsnew/3.13.rst:1600 msgid ":mod:`!msilib`" -msgstr "" +msgstr ":mod:`!msilib`" -#: ../../whatsnew/3.13.rst:1602 +#: ../../whatsnew/3.13.rst:1601 msgid ":mod:`!nis`" -msgstr "" +msgstr ":mod:`!nis`" -#: ../../whatsnew/3.13.rst:1603 +#: ../../whatsnew/3.13.rst:1602 msgid ":mod:`!nntplib`: Use the :pypi:`nntplib` library from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1605 +#: ../../whatsnew/3.13.rst:1604 msgid "" ":mod:`!ossaudiodev`: For audio playback, use the :pypi:`pygame` library from " "PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1607 +#: ../../whatsnew/3.13.rst:1606 msgid ":mod:`!pipes`: Use the :mod:`subprocess` module instead." msgstr "" -#: ../../whatsnew/3.13.rst:1609 +#: ../../whatsnew/3.13.rst:1608 msgid "" ":mod:`!sndhdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements." msgstr "" -#: ../../whatsnew/3.13.rst:1612 +#: ../../whatsnew/3.13.rst:1611 msgid ":mod:`!spwd`: Use the :pypi:`python-pam` library from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1614 +#: ../../whatsnew/3.13.rst:1613 msgid ":mod:`!sunau`" -msgstr "" +msgstr ":mod:`!sunau`" -#: ../../whatsnew/3.13.rst:1615 +#: ../../whatsnew/3.13.rst:1614 msgid "" ":mod:`!telnetlib`, Use the :pypi:`telnetlib3` or :pypi:`Exscript` libraries " "from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1617 +#: ../../whatsnew/3.13.rst:1616 msgid "" ":mod:`!uu`: Use the :mod:`base64` module instead, as a modern alternative." msgstr "" -#: ../../whatsnew/3.13.rst:1619 +#: ../../whatsnew/3.13.rst:1618 msgid ":mod:`!xdrlib`" -msgstr "" +msgstr ":mod:`!xdrlib`" -#: ../../whatsnew/3.13.rst:1621 +#: ../../whatsnew/3.13.rst:1620 msgid "" "(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` and :gh:" "`104780`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1625 +#: ../../whatsnew/3.13.rst:1624 msgid "2to3" -msgstr "" +msgstr "2to3" -#: ../../whatsnew/3.13.rst:1627 +#: ../../whatsnew/3.13.rst:1626 msgid "" "Remove the :program:`2to3` program and the :mod:`!lib2to3` module, " "previously deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:" "`104780`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1633 +#: ../../whatsnew/3.13.rst:1632 msgid "builtins" -msgstr "" +msgstr "builtins" -#: ../../whatsnew/3.13.rst:1635 +#: ../../whatsnew/3.13.rst:1634 msgid "" "Remove support for chained :class:`classmethod` descriptors (introduced in :" "gh:`63272`). These can no longer be used to wrap other descriptors, such as :" @@ -2379,40 +2388,47 @@ msgid "" "(Contributed by Raymond Hettinger in :gh:`89519`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1648 +#: ../../whatsnew/3.13.rst:1643 +msgid "" +"Raise a :exc:`RuntimeError` when calling :meth:`frame.clear` on a suspended " +"frame (as has always been the case for an executing frame). (Contributed by " +"Irit Katriel in :gh:`79932`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1651 msgid "" "Remove the undocumented :class:`!LegacyInterpolation` class, deprecated in " "the docstring since Python 3.2, and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104886`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1655 +#: ../../whatsnew/3.13.rst:1658 msgid "importlib.metadata" -msgstr "" +msgstr "importlib.metadata" -#: ../../whatsnew/3.13.rst:1657 +#: ../../whatsnew/3.13.rst:1660 msgid "" "Remove deprecated subscript (:meth:`~object.__getitem__`) access for :ref:" "`EntryPoint ` objects. (Contributed by Jason R. Coombs in :gh:" "`113175`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1663 +#: ../../whatsnew/3.13.rst:1666 msgid "locale" -msgstr "" +msgstr "locale" -#: ../../whatsnew/3.13.rst:1665 +#: ../../whatsnew/3.13.rst:1668 msgid "" "Remove the :func:`!locale.resetlocale` function, deprecated in Python 3.11. " "Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. (Contributed by " "Victor Stinner in :gh:`104783`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1671 +#: ../../whatsnew/3.13.rst:1674 msgid "opcode" -msgstr "" +msgstr "opcode" -#: ../../whatsnew/3.13.rst:1673 +#: ../../whatsnew/3.13.rst:1676 msgid "" "Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!_opcode." "ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " @@ -2420,7 +2436,7 @@ msgid "" "Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1678 +#: ../../whatsnew/3.13.rst:1681 msgid "" "Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, and :" "attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but were " @@ -2428,43 +2444,43 @@ msgid "" "be used externally. (Contributed by Irit Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1688 +#: ../../whatsnew/3.13.rst:1691 msgid "" "Remove the ability to use :class:`~pathlib.Path` objects as context " "managers. This functionality was deprecated and has had no effect since " "Python 3.9. (Contributed by Barney Gale in :gh:`83863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1696 +#: ../../whatsnew/3.13.rst:1699 msgid "" "Remove the undocumented, deprecated, and broken :func:`!re.template` " "function and :attr:`!re.TEMPLATE` / :attr:`!re.T` flag. (Contributed by " "Serhiy Storchaka and Nikita Sobolev in :gh:`105687`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1702 +#: ../../whatsnew/3.13.rst:1705 msgid "tkinter.tix" -msgstr "" +msgstr "tkinter.tix" -#: ../../whatsnew/3.13.rst:1704 +#: ../../whatsnew/3.13.rst:1707 msgid "" "Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6. The third-" "party Tix library which the module wrapped is unmaintained. (Contributed by " "Zachary Ware in :gh:`75552`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1710 +#: ../../whatsnew/3.13.rst:1713 msgid "turtle" -msgstr "" +msgstr "turtle" -#: ../../whatsnew/3.13.rst:1712 +#: ../../whatsnew/3.13.rst:1715 msgid "" "Remove the :meth:`!RawTurtle.settiltangle` method, deprecated in the " "documentation since Python 3.1 and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104876`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1721 +#: ../../whatsnew/3.13.rst:1724 msgid "" "Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces, deprecated " "since Python 3.8. The items in those namespaces can be imported directly " @@ -2472,66 +2488,66 @@ msgid "" "`92871`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1727 +#: ../../whatsnew/3.13.rst:1730 msgid "" "Remove the keyword-argument method of creating :class:`~typing.TypedDict` " "types, deprecated in Python 3.11. (Contributed by Tomas Roun in :gh:" "`104786`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1733 +#: ../../whatsnew/3.13.rst:1736 msgid "unittest" -msgstr "" +msgstr "unittest" -#: ../../whatsnew/3.13.rst:1735 +#: ../../whatsnew/3.13.rst:1738 msgid "" "Remove the following :mod:`unittest` functions, deprecated in Python 3.11:" msgstr "" -#: ../../whatsnew/3.13.rst:1737 +#: ../../whatsnew/3.13.rst:1740 msgid ":func:`!unittest.findTestCases`" -msgstr "" +msgstr ":func:`!unittest.findTestCases`" -#: ../../whatsnew/3.13.rst:1738 +#: ../../whatsnew/3.13.rst:1741 msgid ":func:`!unittest.makeSuite`" -msgstr "" +msgstr ":func:`!unittest.makeSuite`" -#: ../../whatsnew/3.13.rst:1739 +#: ../../whatsnew/3.13.rst:1742 msgid ":func:`!unittest.getTestCaseNames`" -msgstr "" +msgstr ":func:`!unittest.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1741 +#: ../../whatsnew/3.13.rst:1744 msgid "Use :class:`~unittest.TestLoader` methods instead:" msgstr "" -#: ../../whatsnew/3.13.rst:1743 +#: ../../whatsnew/3.13.rst:1746 msgid ":meth:`~unittest.TestLoader.loadTestsFromModule`" -msgstr "" +msgstr ":meth:`~unittest.TestLoader.loadTestsFromModule`" -#: ../../whatsnew/3.13.rst:1744 +#: ../../whatsnew/3.13.rst:1747 msgid ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" -msgstr "" +msgstr ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" -#: ../../whatsnew/3.13.rst:1745 +#: ../../whatsnew/3.13.rst:1748 msgid ":meth:`~unittest.TestLoader.getTestCaseNames`" -msgstr "" +msgstr ":meth:`~unittest.TestLoader.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1747 +#: ../../whatsnew/3.13.rst:1750 msgid "(Contributed by Hugo van Kemenade in :gh:`104835`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1749 +#: ../../whatsnew/3.13.rst:1752 msgid "" "Remove the untested and undocumented :meth:`!TestProgram.usageExit` method, " "deprecated in Python 3.11. (Contributed by Hugo van Kemenade in :gh:" "`104992`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1755 +#: ../../whatsnew/3.13.rst:1758 msgid "urllib" -msgstr "" +msgstr "urllib" -#: ../../whatsnew/3.13.rst:1757 +#: ../../whatsnew/3.13.rst:1760 msgid "" "Remove the *cafile*, *capath*, and *cadefault* parameters of the :func:" "`urllib.request.urlopen` function, deprecated in Python 3.6. Use the " @@ -2542,267 +2558,333 @@ msgid "" "Victor Stinner in :gh:`105382`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1768 +#: ../../whatsnew/3.13.rst:1771 msgid "webbrowser" -msgstr "" +msgstr "webbrowser" -#: ../../whatsnew/3.13.rst:1770 +#: ../../whatsnew/3.13.rst:1773 msgid "" "Remove the untested and undocumented :class:`!MacOSX` class, deprecated in " "Python 3.11. Use the :class:`!MacOSXOSAScript` class (introduced in Python " "3.2) instead. (Contributed by Hugo van Kemenade in :gh:`104804`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1775 +#: ../../whatsnew/3.13.rst:1778 msgid "" "Remove the deprecated :attr:`!MacOSXOSAScript._name` attribute. Use the :" "attr:`MacOSXOSAScript.name ` attribute instead. " "(Contributed by Nikita Sobolev in :gh:`105546`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1782 +#: ../../whatsnew/3.13.rst:1785 msgid "New Deprecations" msgstr "" -#: ../../whatsnew/3.13.rst:1784 -msgid "" -":mod:`array`: :mod:`array`'s ``'u'`` format code, deprecated in docs since " -"Python 3.3, emits :exc:`DeprecationWarning` since 3.13 and will be removed " -"in Python 3.16. Use the ``'w'`` format code instead. (Contributed by Hugo " -"van Kemenade in :gh:`80480`.)" +#: ../../whatsnew/3.13.rst:1787 +msgid ":ref:`User-defined functions `:" msgstr "" -#: ../../whatsnew/3.13.rst:1790 +#: ../../whatsnew/3.13.rst:1789 msgid "" -":mod:`ctypes`: Deprecate undocumented :func:`!ctypes.SetPointerType` " -"function. :term:`Soft-deprecate ` the :func:`ctypes.ARRAY` " -"function in favor of multiplication. (Contributed by Victor Stinner in :gh:" -"`105733`.)" +"Deprecate assignment to a function's :attr:`~function.__code__` attribute, " +"where the new code object's type does not match the function's type. The " +"different types are: plain function, generator, async generator, and " +"coroutine. (Contributed by Irit Katriel in :gh:`81137`.)" msgstr "" #: ../../whatsnew/3.13.rst:1795 -msgid "" -":mod:`decimal`: Deprecate non-standard format specifier \"N\" for :class:" -"`decimal.Decimal`. It was not documented and only supported in the C " -"implementation. (Contributed by Serhiy Storchaka in :gh:`89902`.)" -msgstr "" +#: ../../deprecations/pending-removal-in-3.16.rst:13 +msgid ":mod:`array`:" +msgstr ":mod:`array`:" -#: ../../whatsnew/3.13.rst:1800 +#: ../../whatsnew/3.13.rst:1797 msgid "" -":mod:`dis`: The ``dis.HAVE_ARGUMENT`` separator is deprecated. Check " -"membership in :data:`~dis.hasarg` instead. (Contributed by Irit Katriel in :" -"gh:`109319`.)" +"Deprecate the ``'u'`` format code (:c:type:`wchar_t`) at runtime. This " +"format code has been deprecated in documentation since Python 3.3, and will " +"be removed in Python 3.16. Use the ``'w'`` format code (:c:type:`Py_UCS4`) " +"for Unicode characters instead. (Contributed by Hugo van Kemenade in :gh:" +"`80480`.)" msgstr "" #: ../../whatsnew/3.13.rst:1804 +#: ../../deprecations/pending-removal-in-3.15.rst:4 +msgid ":mod:`ctypes`:" +msgstr ":mod:`ctypes`:" + +#: ../../whatsnew/3.13.rst:1806 msgid "" -":ref:`frame-objects`: Calling :meth:`frame.clear` on a suspended frame " -"raises :exc:`RuntimeError` (as has always been the case for an executing " -"frame). (Contributed by Irit Katriel in :gh:`79932`.)" +"Deprecate the undocumented :func:`!SetPointerType` function, to be removed " +"in Python 3.15. (Contributed by Victor Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1809 +#: ../../whatsnew/3.13.rst:1810 msgid "" -":mod:`getopt` and :mod:`optparse` modules: They are now :term:`soft " -"deprecated`: the :mod:`argparse` module should be used for new projects. " -"Previously, the :mod:`optparse` module was already deprecated, its removal " -"was not scheduled, and no warnings was emitted: so there is no change in " -"practice. (Contributed by Victor Stinner in :gh:`106535`.)" +":term:`Soft-deprecate ` the :func:`~ctypes.ARRAY` function " +"in favour of ``type * length`` multiplication. (Contributed by Victor " +"Stinner in :gh:`105733`.)" msgstr "" +#: ../../whatsnew/3.13.rst:1814 +msgid ":mod:`decimal`:" +msgstr ":mod:`decimal`:" + #: ../../whatsnew/3.13.rst:1816 msgid "" -":mod:`gettext`: Emit deprecation warning for non-integer numbers in :mod:" -"`gettext` functions and methods that consider plural forms even if the " -"translation was not found. (Contributed by Serhiy Storchaka in :gh:`88434`.)" +"Deprecate the non-standard and undocumented :class:`~decimal.Decimal` format " +"specifier ``'N'``, which is only supported in the :mod:`!decimal` module's C " +"implementation. (Contributed by Serhiy Storchaka in :gh:`89902`.)" msgstr "" #: ../../whatsnew/3.13.rst:1821 +msgid ":mod:`dis`:" +msgstr ":mod:`dis`:" + +#: ../../whatsnew/3.13.rst:1823 msgid "" -":mod:`glob`: The undocumented :func:`!glob.glob0` and :func:`!glob.glob1` " -"functions are deprecated. Use :func:`glob.glob` and pass a directory to its " -"*root_dir* argument instead. (Contributed by Barney Gale in :gh:`117337`.)" +"Deprecate the :attr:`!HAVE_ARGUMENT` separator. Check membership in :data:" +"`~dis.hasarg` instead. (Contributed by Irit Katriel in :gh:`109319`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1826 +#: ../../whatsnew/3.13.rst:1827 +msgid ":mod:`getopt` and :mod:`optparse`:" +msgstr ":mod:`getopt` 和 :mod:`optparse`:" + +#: ../../whatsnew/3.13.rst:1829 msgid "" -":mod:`http.server`: :class:`http.server.CGIHTTPRequestHandler` now emits a :" -"exc:`DeprecationWarning` as it will be removed in 3.15. Process-based CGI " -"HTTP servers have been out of favor for a very long time. This code was " -"outdated, unmaintained, and rarely used. It has a high potential for both " -"security and functionality bugs. This includes removal of the ``--cgi`` " -"flag to the ``python -m http.server`` command line in 3.15." +"Both modules are now :term:`soft deprecated`, with :mod:`argparse` preferred " +"for new projects. This is a new soft-deprecation for the :mod:`!getopt` " +"module, whereas the :mod:`!optparse` module was already *de facto* soft " +"deprecated. (Contributed by Victor Stinner in :gh:`106535`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1833 -msgid "" -":mod:`mimetypes`: Passing file path instead of URL in :func:`~mimetypes." -"guess_type` is :term:`soft deprecated`. Use :func:`~mimetypes." -"guess_file_type` instead. (Contributed by Serhiy Storchaka in :gh:`66543`.)" -msgstr "" +#: ../../whatsnew/3.13.rst:1835 +msgid ":mod:`gettext`:" +msgstr ":mod:`gettext`:" #: ../../whatsnew/3.13.rst:1837 msgid "" -":mod:`re`: Passing optional arguments *maxsplit*, *count* and *flags* in " -"module-level functions :func:`re.split`, :func:`re.sub` and :func:`re.subn` " -"as positional arguments is now deprecated. In future Python versions these " -"parameters will be :ref:`keyword-only `. " -"(Contributed by Serhiy Storchaka in :gh:`56166`.)" +"Deprecate non-integer numbers as arguments to functions and methods that " +"consider plural forms in the :mod:`!gettext` module, even if no translation " +"was found. (Contributed by Serhiy Storchaka in :gh:`88434`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1843 -#: ../../deprecations/pending-removal-in-3.15.rst:16 +#: ../../whatsnew/3.13.rst:1842 +msgid ":mod:`glob`:" +msgstr ":mod:`glob`:" + +#: ../../whatsnew/3.13.rst:1844 msgid "" -":mod:`pathlib`: :meth:`pathlib.PurePath.is_reserved` is deprecated and " -"scheduled for removal in Python 3.15. Use :func:`os.path.isreserved` to " -"detect reserved paths on Windows." +"Deprecate the undocumented :func:`!glob0` and :func:`!glob1` functions. Use :" +"func:`~glob.glob` and pass a :term:`path-like object` specifying the root " +"directory to the *root_dir* parameter instead. (Contributed by Barney Gale " +"in :gh:`117337`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1848 -#: ../../deprecations/pending-removal-in-3.15.rst:21 +#: ../../whatsnew/3.13.rst:1849 +#: ../../deprecations/pending-removal-in-3.15.rst:9 +msgid ":mod:`http.server`:" +msgstr ":mod:`http.server`:" + +#: ../../whatsnew/3.13.rst:1851 msgid "" -":mod:`platform`: :func:`~platform.java_ver` is deprecated and will be " -"removed in 3.15. It was largely untested, had a confusing API, and was only " -"useful for Jython support. (Contributed by Nikita Sobolev in :gh:`116349`.)" +"Deprecate :class:`~http.server.CGIHTTPRequestHandler`, to be removed in " +"Python 3.15. Process-based CGI HTTP servers have been out of favor for a " +"very long time. This code was outdated, unmaintained, and rarely used. It " +"has a high potential for both security and functionality bugs. (Contributed " +"by Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1854 +#: ../../whatsnew/3.13.rst:1858 msgid "" -":mod:`pydoc`: Deprecate undocumented :func:`!pydoc.ispackage` function. " -"(Contributed by Zackery Spytz in :gh:`64020`.)" +"Deprecate the :option:`!--cgi` flag to the :program:`python -m http.server` " +"command-line interface, to be removed in Python 3.15. (Contributed by " +"Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1857 +#: ../../whatsnew/3.13.rst:1863 +msgid ":mod:`mimetypes`:" +msgstr ":mod:`mimetypes`:" + +#: ../../whatsnew/3.13.rst:1865 msgid "" -":mod:`sqlite3`: Passing more than one positional argument to :func:`sqlite3." -"connect` and the :class:`sqlite3.Connection` constructor is deprecated. The " -"remaining parameters will become keyword-only in Python 3.15." +":term:`Soft-deprecate ` file path arguments to :func:" +"`~mimetypes.guess_type`, use :func:`~mimetypes.guess_file_type` instead. " +"(Contributed by Serhiy Storchaka in :gh:`66543`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1861 +#: ../../whatsnew/3.13.rst:1870 +#, fuzzy +msgid ":mod:`re`:" +msgstr ":mod:`re`。" + +#: ../../whatsnew/3.13.rst:1872 msgid "" -"Deprecate passing name, number of arguments, and the callable as keyword " -"arguments for the following :class:`sqlite3.Connection` APIs:" +"Deprecate passing the optional *maxsplit*, *count*, or *flags* arguments as " +"positional arguments to the module-level :func:`~re.split`, :func:`~re.sub`, " +"and :func:`~re.subn` functions. These parameters will become :ref:`keyword-" +"only ` in a future version of Python. (Contributed " +"by Serhiy Storchaka in :gh:`56166`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1864 -msgid ":meth:`~sqlite3.Connection.create_function`" -msgstr "" +#: ../../whatsnew/3.13.rst:1879 +#: ../../deprecations/pending-removal-in-3.15.rst:30 +msgid ":mod:`pathlib`:" +msgstr ":mod:`pathlib`:" -#: ../../whatsnew/3.13.rst:1865 -msgid ":meth:`~sqlite3.Connection.create_aggregate`" +#: ../../whatsnew/3.13.rst:1881 +msgid "" +"Deprecate :meth:`.PurePath.is_reserved`, to be removed in Python 3.15. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows. (Contributed " +"by Barney Gale in :gh:`88569`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1867 +#: ../../whatsnew/3.13.rst:1886 +#: ../../deprecations/pending-removal-in-3.15.rst:36 +msgid ":mod:`platform`:" +msgstr ":mod:`platform`:" + +#: ../../whatsnew/3.13.rst:1888 msgid "" -"Deprecate passing the callback callable by keyword for the following :class:" -"`sqlite3.Connection` APIs:" +"Deprecate :func:`~platform.java_ver`, to be removed in Python 3.15. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested. (Contributed by Nikita Sobolev in :gh:`116349`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1870 -msgid ":meth:`~sqlite3.Connection.set_authorizer`" -msgstr "" +#: ../../whatsnew/3.13.rst:1894 +msgid ":mod:`pydoc`:" +msgstr ":mod:`pydoc`:" -#: ../../whatsnew/3.13.rst:1871 -msgid ":meth:`~sqlite3.Connection.set_progress_handler`" +#: ../../whatsnew/3.13.rst:1896 +msgid "" +"Deprecate the undocumented :func:`!ispackage` function. (Contributed by " +"Zackery Spytz in :gh:`64020`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1872 -msgid ":meth:`~sqlite3.Connection.set_trace_callback`" +#: ../../whatsnew/3.13.rst:1899 +#: ../../deprecations/pending-removal-in-3.14.rst:94 +msgid ":mod:`sqlite3`:" +msgstr ":mod:`sqlite3`:" + +#: ../../whatsnew/3.13.rst:1901 +msgid "" +"Deprecate passing more than one positional argument to the :func:`~sqlite3." +"connect` function and the :class:`~sqlite3.Connection` constructor. The " +"remaining parameters will become keyword-only in Python 3.15. (Contributed " +"by Erlend E. Aasland in :gh:`107948`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1874 -msgid "The affected parameters will become positional-only in Python 3.15." +#: ../../whatsnew/3.13.rst:1907 +msgid "" +"Deprecate passing name, number of arguments, and the callable as keyword " +"arguments for :meth:`.Connection.create_function` and :meth:`.Connection." +"create_aggregate` These parameters will become positional-only in Python " +"3.15. (Contributed by Erlend E. Aasland in :gh:`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1876 -msgid "(Contributed by Erlend E. Aasland in :gh:`107948` and :gh:`108278`.)" +#: ../../whatsnew/3.13.rst:1913 +msgid "" +"Deprecate passing the callback callable by keyword for the :meth:`~sqlite3." +"Connection.set_authorizer`, :meth:`~sqlite3.Connection." +"set_progress_handler`, and :meth:`~sqlite3.Connection.set_trace_callback` :" +"class:`~sqlite3.Connection` methods. The callback callables will become " +"positional-only in Python 3.15. (Contributed by Erlend E. Aasland in :gh:" +"`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1878 +#: ../../whatsnew/3.13.rst:1921 +#: ../../deprecations/pending-removal-in-3.16.rst:33 +msgid ":mod:`sys`:" +msgstr ":mod:`sys`:" + +#: ../../whatsnew/3.13.rst:1923 msgid "" -":mod:`sys`: The :func:`sys._enablelegacywindowsfsencoding` function is " -"deprecated. Replace it with the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " -"environment variable. (Contributed by Inada Naoki in :gh:`73427`.)" +"Deprecate the :func:`~sys._enablelegacywindowsfsencoding` function, to be " +"removed in Python 3.16. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead. (Contributed by Inada Naoki in :gh:`73427`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1882 +#: ../../whatsnew/3.13.rst:1928 +#: ../../deprecations/pending-removal-in-3.16.rst:39 +msgid ":mod:`tarfile`:" +msgstr ":mod:`tarfile`:" + +#: ../../whatsnew/3.13.rst:1930 msgid "" -":mod:`tarfile`: The undocumented and unused ``tarfile`` attribute of :class:" -"`tarfile.TarFile` is deprecated and scheduled for removal in Python 3.16." +"Deprecate the undocumented and unused :attr:`!TarFile.tarfile` attribute, to " +"be removed in Python 3.16. (Contributed in :gh:`115256`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1886 +#: ../../whatsnew/3.13.rst:1934 +#, fuzzy +msgid ":mod:`traceback`:" +msgstr ":mod:`traceback`。" + +#: ../../whatsnew/3.13.rst:1936 msgid "" -":mod:`traceback`: The field *exc_type* of :class:`traceback." -"TracebackException` is deprecated. Use *exc_type_str* instead." +"Deprecate the :attr:`.TracebackException.exc_type` attribute. Use :attr:`." +"TracebackException.exc_type_str` instead. (Contributed by Irit Katriel in :" +"gh:`112332`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1889 +#: ../../whatsnew/3.13.rst:1940 +#: ../../deprecations/pending-removal-in-3.15.rst:50 msgid ":mod:`typing`:" -msgstr "" +msgstr ":mod:`typing`:" -#: ../../whatsnew/3.13.rst:1891 +#: ../../whatsnew/3.13.rst:1942 msgid "" -"Creating a :class:`typing.NamedTuple` class using keyword arguments to " -"denote the fields (``NT = NamedTuple(\"NT\", x=int, y=int)``) is deprecated, " -"and will be disallowed in Python 3.15. Use the class-based syntax or the " +"Deprecate the undocumented keyword argument syntax for creating :class:" +"`~typing.NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, " +"y=int)``), to be removed in Python 3.15. Use the class-based syntax or the " "functional syntax instead. (Contributed by Alex Waygood in :gh:`105566`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1896 +#: ../../whatsnew/3.13.rst:1949 msgid "" -"When using the functional syntax to create a :class:`typing.NamedTuple` " -"class or a :class:`typing.TypedDict` class, failing to pass a value to the " -"'fields' parameter (``NT = NamedTuple(\"NT\")`` or ``TD = " -"TypedDict(\"TD\")``) is deprecated. Passing ``None`` to the 'fields' " -"parameter (``NT = NamedTuple(\"NT\", None)`` or ``TD = TypedDict(\"TD\", " -"None)``) is also deprecated. Both will be disallowed in Python 3.15. To " -"create a NamedTuple class with zero fields, use ``class NT(NamedTuple): " -"pass`` or ``NT = NamedTuple(\"NT\", [])``. To create a TypedDict class with " -"zero fields, use ``class TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", " -"{})``. (Contributed by Alex Waygood in :gh:`105566` and :gh:`105570`.)" +"Deprecate omitting the *fields* parameter when creating a :class:`~typing." +"NamedTuple` or :class:`typing.TypedDict` class, and deprecate passing " +"``None`` to the *fields* parameter of both types. Python 3.15 will require a " +"valid sequence for the *fields* parameter. To create a NamedTuple class with " +"zero fields, use ``class NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", " +"())``. To create a TypedDict class with zero fields, use ``class " +"TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``. (Contributed by " +"Alex Waygood in :gh:`105566` and :gh:`105570`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1907 +#: ../../whatsnew/3.13.rst:1959 msgid "" -":func:`typing.no_type_check_decorator` is deprecated, and scheduled for " -"removal in Python 3.15. After eight years in the :mod:`typing` module, it " -"has yet to be supported by any major type checkers. (Contributed by Alex " +"Deprecate the :func:`typing.no_type_check_decorator` decorator function, to " +"be removed in in Python 3.15. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker. (Contributed by Alex " "Waygood in :gh:`106309`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1912 +#: ../../whatsnew/3.13.rst:1965 msgid "" -":data:`typing.AnyStr` is deprecated. In Python 3.16, it will be removed from " -"``typing.__all__``, and a :exc:`DeprecationWarning` will be emitted when it " -"is imported or accessed. It will be removed entirely in Python 3.18. Use the " -"new :ref:`type parameter syntax ` instead. (Contributed by " -"Michael The in :gh:`107116`.)" +"Deprecate :data:`typing.AnyStr`. In Python 3.16, it will be removed from " +"``typing.__all__``, and a :exc:`DeprecationWarning` will be emitted at " +"runtime when it is imported or accessed. It will be removed entirely in " +"Python 3.18. Use the new :ref:`type parameter syntax ` instead. " +"(Contributed by Michael The in :gh:`107116`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1918 -msgid "" -":ref:`user-defined-funcs`: Assignment to a function's :attr:`~function." -"__code__` attribute where the new code object's type does not match the " -"function's type is deprecated. The different types are: plain function, " -"generator, async generator and coroutine. (Contributed by Irit Katriel in :" -"gh:`81137`.)" -msgstr "" +#: ../../whatsnew/3.13.rst:1973 +#: ../../deprecations/pending-removal-in-3.15.rst:63 +msgid ":mod:`wave`:" +msgstr ":mod:`wave`:" -#: ../../whatsnew/3.13.rst:1925 -#: ../../deprecations/pending-removal-in-3.15.rst:54 +#: ../../whatsnew/3.13.rst:1975 msgid "" -":mod:`wave`: Deprecate the ``getmark()``, ``setmark()`` and ``getmarkers()`` " -"methods of the :class:`wave.Wave_read` and :class:`wave.Wave_write` classes. " -"They will be removed in Python 3.15. (Contributed by Victor Stinner in :gh:" -"`105096`.)" +"Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:" +"`~wave.Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :" +"class:`~wave.Wave_write` classes, to be removed in Python 3.15. (Contributed " +"by Victor Stinner in :gh:`105096`.)" msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:2 #: ../../deprecations/pending-removal-in-3.14.rst:2 msgid "Pending Removal in Python 3.14" -msgstr "" +msgstr "Python 3.14 中待移除的項目" #: ../../deprecations/pending-removal-in-3.14.rst:4 msgid "" @@ -2810,6 +2892,9 @@ msgid "" "argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " "(Contributed by Nikita Sobolev in :gh:`92248`.)" msgstr "" +":mod:`argparse`::class:`!argparse.BooleanOptionalAction` 的 *type*、" +"*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " +"於 :gh:`92248` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:9 msgid "" @@ -2817,36 +2902,39 @@ msgid "" "since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " "runtime when they are accessed or used, and will be removed in Python 3.14:" msgstr "" +":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時會" +"於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" #: ../../deprecations/pending-removal-in-3.14.rst:13 msgid ":class:`!ast.Num`" -msgstr "" +msgstr ":class:`!ast.Num`" #: ../../deprecations/pending-removal-in-3.14.rst:14 msgid ":class:`!ast.Str`" -msgstr "" +msgstr ":class:`!ast.Str`" #: ../../deprecations/pending-removal-in-3.14.rst:15 msgid ":class:`!ast.Bytes`" -msgstr "" +msgstr ":class:`!ast.Bytes`" #: ../../deprecations/pending-removal-in-3.14.rst:16 msgid ":class:`!ast.NameConstant`" -msgstr "" +msgstr ":class:`!ast.NameConstant`" #: ../../deprecations/pending-removal-in-3.14.rst:17 msgid ":class:`!ast.Ellipsis`" -msgstr "" +msgstr ":class:`!ast.Ellipsis`" #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" "`90953`.)" msgstr "" +"請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:22 msgid ":mod:`asyncio`:" -msgstr "" +msgstr ":mod:`asyncio`:" #: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" @@ -2855,6 +2943,10 @@ msgid "" "class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " "Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" +"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`~asyncio." +"MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio." +"AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " +"Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" @@ -2863,6 +2955,10 @@ msgid "" "AbstractEventLoopPolicy.get_child_watcher` are deprecated and will be " "removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" +":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:" +"`asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`asyncio." +"AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" +"除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" @@ -2871,6 +2967,9 @@ msgid "" "and it decides to create one. (Contributed by Serhiy Storchaka and Guido van " "Rossum in :gh:`100160`.)" msgstr "" +"預設事件迴圈策略的 :meth:`~asyncio.get_event_loop` 方法現在會在沒有設定目前事" +"件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " +"和 Guido van Rossum 於 :gh:`100160` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" @@ -2879,50 +2978,58 @@ msgid "" "typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." "abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" msgstr "" +":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改用 :" +"class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用時,請" +"改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " +"Shantanu Jain 於 :gh:`91896` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" ":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" msgstr "" +":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " +"Alan Williams 於 :gh:`72346` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:50 msgid "" ":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " "taken into consideration by the import system (:gh:`97879`)." msgstr "" +":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " +"系統考慮。 (:gh:`97879`)" #: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":mod:`importlib.abc` deprecated classes:" -msgstr "" +msgstr ":mod:`importlib.abc` 的已棄用類別:" #: ../../deprecations/pending-removal-in-3.14.rst:55 msgid ":class:`!importlib.abc.ResourceReader`" -msgstr "" +msgstr ":class:`!importlib.abc.ResourceReader`" #: ../../deprecations/pending-removal-in-3.14.rst:56 msgid ":class:`!importlib.abc.Traversable`" -msgstr "" +msgstr ":class:`!importlib.abc.Traversable`" #: ../../deprecations/pending-removal-in-3.14.rst:57 msgid ":class:`!importlib.abc.TraversableResources`" -msgstr "" +msgstr ":class:`!importlib.abc.TraversableResources`" #: ../../deprecations/pending-removal-in-3.14.rst:59 msgid "Use :mod:`importlib.resources.abc` classes instead:" -msgstr "" +msgstr "請改用 :mod:`importlib.resources.abc` 類別:" #: ../../deprecations/pending-removal-in-3.14.rst:61 msgid ":class:`importlib.resources.abc.Traversable`" -msgstr "" +msgstr ":class:`importlib.resources.abc.Traversable`" #: ../../deprecations/pending-removal-in-3.14.rst:62 msgid ":class:`importlib.resources.abc.TraversableResources`" -msgstr "" +msgstr ":class:`importlib.resources.abc.TraversableResources`" #: ../../deprecations/pending-removal-in-3.14.rst:64 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" -msgstr "" +msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" #: ../../deprecations/pending-removal-in-3.14.rst:66 msgid "" @@ -2931,6 +3038,9 @@ msgid "" "removed in 3.14 for a significant reduction in code volume and maintenance " "burden. (Contributed by Raymond Hettinger in :gh:`101588`.)" msgstr "" +":mod:`itertools` 有不以文件記錄、效率低下、過去常有 bug 且不一致的 copy、" +"deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " +"(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:72 msgid "" @@ -2942,12 +3052,20 @@ msgid "" "set_start_method` APIs to explicitly specify when your code *requires* " "``'fork'``. See :ref:`multiprocessing-start-methods`." msgstr "" +":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平" +"台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。對此增加一" +"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用 :func:" +"`~multiprocessing.get_context` 或 :func:`~multiprocessing.set_start_method` " +"API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" +"`multiprocessing-start-methods`。" #: ../../deprecations/pending-removal-in-3.14.rst:80 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." msgstr "" +":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" +"`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" #: ../../deprecations/pending-removal-in-3.14.rst:84 msgid "" @@ -2955,26 +3073,25 @@ msgid "" "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" +":mod:`pkgutil`::func:`~pkgutil.find_loader` 和 :func:`~pkgutil.get_loader` " +"現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." +"find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:89 msgid ":mod:`pty`:" -msgstr "" +msgstr ":mod:`pty`:" #: ../../deprecations/pending-removal-in-3.14.rst:91 msgid "``master_open()``: use :func:`pty.openpty`." -msgstr "" +msgstr "``master_open()``:請用 :func:`pty.openpty`。" #: ../../deprecations/pending-removal-in-3.14.rst:92 msgid "``slave_open()``: use :func:`pty.openpty`." -msgstr "" - -#: ../../deprecations/pending-removal-in-3.14.rst:94 -msgid ":mod:`sqlite3`:" -msgstr "" +msgstr "``slave_open()``:請用 :func:`pty.openpty`。" #: ../../deprecations/pending-removal-in-3.14.rst:96 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." -msgstr "" +msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" #: ../../deprecations/pending-removal-in-3.14.rst:98 msgid "" @@ -2982,12 +3099,17 @@ msgid "" "ref:`named placeholders ` are used and *parameters* is " "a sequence instead of a :class:`dict`." msgstr "" +":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如果" +"使用 :ref:`named placeholders ` 且 *parameters* 是序列" +"而不是 :class:`dict`。" #: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" "date and datetime adapter, date and timestamp converter: see the :mod:" "`sqlite3` documentation for suggested replacement recipes." msgstr "" +"date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" +"參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" #: ../../deprecations/pending-removal-in-3.14.rst:105 msgid "" @@ -2996,12 +3118,18 @@ msgid "" "but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " "in 3.14. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" +":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:112 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." msgstr "" +":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" +"使用時會發出 :exc:`DeprecationWarning`。" #: ../../deprecations/pending-removal-in-3.14.rst:115 msgid "" @@ -3009,119 +3137,217 @@ msgid "" "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" "`88168`.)" msgstr "" +":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 API。" +"(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:2 #: ../../deprecations/pending-removal-in-3.15.rst:2 msgid "Pending Removal in Python 3.15" +msgstr "Python 3.15 中待移除的項目" + +#: ../../deprecations/pending-removal-in-3.15.rst:6 +msgid "" +"The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " +"since Python 3.13." msgstr "" +"自 Python 3.13 起,未記錄的 :func:`!ctypes.SetPointerType` 函式已被棄用。" -#: ../../deprecations/pending-removal-in-3.15.rst:4 +#: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -":class:`http.server.CGIHTTPRequestHandler` will be removed along with its " -"related ``--cgi`` flag to ``python -m http.server``. It was obsolete and " -"rarely used. No direct replacement exists. *Anything* is better than CGI " -"to interface a web server with a request handler." +"The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " +"been deprecated since Python 3.13. No direct replacement exists. *Anything* " +"is better than CGI to interface a web server with a request handler." msgstr "" +"過時且很少使用的 :class:`~http.server.CGIHTTPRequestHandler` 自 Python 3.13 " +"起已被棄用。不存在直接的替代。*任何東西*\\ 都比 CGI 更好地將 Web 伺服器與請求" +"處理程序介接起來。" -#: ../../deprecations/pending-removal-in-3.15.rst:9 +#: ../../deprecations/pending-removal-in-3.15.rst:17 msgid "" -":class:`locale`: :func:`locale.getdefaultlocale` was deprecated in Python " -"3.11 and originally planned for removal in Python 3.13 (:gh:`90817`), but " -"removal has been postponed to Python 3.15. Use :func:`locale.setlocale`, :" -"func:`locale.getencoding` and :func:`locale.getlocale` instead. (Contributed " -"by Hugo van Kemenade in :gh:`111187`.)" +"The :option:`!--cgi` flag to the :program:`python -m http.server` command-" +"line interface has been deprecated since Python 3.13." msgstr "" +"自 Python 3.13 起,:program:`python -m http.server` 命令列介面的 :option:`!--" +"cgi` 旗標已被棄用。" -#: ../../deprecations/pending-removal-in-3.15.rst:27 +#: ../../deprecations/pending-removal-in-3.15.rst:20 +msgid ":class:`locale`:" +msgstr ":class:`locale`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:22 msgid "" -":mod:`threading`: Passing any arguments to :func:`threading.RLock` is now " -"deprecated. C version allows any numbers of args and kwargs, but they are " -"just ignored. Python version does not allow any arguments. All arguments " -"will be removed from :func:`threading.RLock` in Python 3.15. (Contributed by " -"Nikita Sobolev in :gh:`102029`.)" +"The :func:`~locale.getdefaultlocale` function has been deprecated since " +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" +":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:34 -msgid ":class:`typing.NamedTuple`:" +#: ../../deprecations/pending-removal-in-3.15.rst:32 +msgid "" +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:36 +#: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" -"The undocumented keyword argument syntax for creating :class:`!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." +":func:`~platform.java_ver` has been deprecated since Python 3.13. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested." msgstr "" +"自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" +"援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:40 +#: ../../deprecations/pending-removal-in-3.15.rst:42 +msgid ":mod:`threading`:" +msgstr ":mod:`threading`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:44 +msgid "" +":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " +"arguments has been deprecated since Python 3.14, as the Python version does " +"not permit any arguments, but the C version allows any number of positional " +"or keyword arguments, ignoring every argument." +msgstr "" +":func:`~threading.RLock` 在 Python 3.15 中將不接受任何引數。自 Python 3.14 " +"起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" +"任意數量的位置或關鍵字引數,並忽略每個引數。" + +#: ../../deprecations/pending-removal-in-3.15.rst:52 msgid "" -"When using the functional syntax to create a :class:`!NamedTuple` class, " -"failing to pass a value to the *fields* parameter (``NT = " -"NamedTuple(\"NT\")``) is deprecated. Passing ``None`` to the *fields* " -"parameter (``NT = NamedTuple(\"NT\", None)``) is also deprecated. Both will " -"be disallowed in Python 3.15. To create a :class:`!NamedTuple` class with 0 " -"fields, use ``class NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", " -"[])``." +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " +"has been deprecated since Python 3.13. Use the class-based syntax or the " +"functional syntax instead." msgstr "" +"用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " +"(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" +"用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:47 +#: ../../deprecations/pending-removal-in-3.15.rst:58 msgid "" -":class:`typing.TypedDict`: When using the functional syntax to create a :" -"class:`!TypedDict` class, failing to pass a value to the *fields* parameter " -"(``TD = TypedDict(\"TD\")``) is deprecated. Passing ``None`` to the *fields* " -"parameter (``TD = TypedDict(\"TD\", None)``) is also deprecated. Both will " -"be disallowed in Python 3.15. To create a :class:`!TypedDict` class with 0 " -"fields, use ``class TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." +"The :func:`typing.no_type_check_decorator` decorator function has been " +"deprecated since Python 3.13. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker." msgstr "" +"自 Python 3.13 起,:func:`typing.no_type_check_decorator` 裝飾器函式已被棄" +"用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" +"援。" + +#: ../../deprecations/pending-removal-in-3.15.rst:65 +msgid "" +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." +msgstr "" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending Removal in Python 3.16" -msgstr "" +msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:4 +#: ../../deprecations/pending-removal-in-future.rst:12 +msgid ":mod:`builtins`:" +msgstr ":mod:`builtins`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:6 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" +"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" +"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" +"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " +"``~int(x)`` (``~int(x)``)。" + +#: ../../deprecations/pending-removal-in-3.16.rst:15 +msgid "" +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." +msgstr "" +"自 Python 3.3 起,``'u'`` 格式碼 (:c:type:`wchar_t`) 在文件中已被棄用,自 " +"Python 3.13 起在 runtime 已被棄用。請使用 ``'w'`` 格式碼 (:c:type:`Py_UCS4`) " +"來取代 Unicode 字元。" + +#: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid ":mod:`shutil`:" +msgstr ":mod:`shutil`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:23 +msgid "" +"The :class:`!ExecError` exception has been deprecated since Python 3.14. It " +"has not been used by any function in :mod:`!shutil` since Python 3.4, and is " +"now an alias of :exc:`RuntimeError`." +msgstr "" +"自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" +"未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" + +#: ../../deprecations/pending-removal-in-3.16.rst:28 +msgid ":mod:`symtable`:" +msgstr ":mod:`symtable`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:30 msgid "" -":mod:`array`: :class:`array.array` ``'u'`` type (:c:type:`wchar_t`): use the " -"``'w'`` type instead (``Py_UCS4``)." +"The :meth:`Class.get_methods ` method has been " +"deprecated since Python 3.14." msgstr "" +"自 Python 3.14 起,:meth:`Class.get_methods ` 方" +"法已被棄用。" -#: ../../deprecations/pending-removal-in-3.16.rst:8 -msgid ":mod:`builtins`: ``~bool``, bitwise inversion on bool." +#: ../../deprecations/pending-removal-in-3.16.rst:35 +msgid "" +"The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " +"since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead." msgstr "" +"自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" +"請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" -#: ../../deprecations/pending-removal-in-3.16.rst:11 +#: ../../deprecations/pending-removal-in-3.16.rst:41 msgid "" -":mod:`symtable`: Deprecate :meth:`symtable.Class.get_methods` due to the " -"lack of interest. (Contributed by Bénédikt Tran in :gh:`119698`.)" +"The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " +"deprecated since Python 3.13." msgstr "" +"自 Python 3.13 起,未以文件記錄和未被使用的 :attr:`!TarFile.tarfile` 屬性已被" +"棄用。" #: ../../deprecations/c-api-pending-removal-in-future.rst:2 #: ../../deprecations/pending-removal-in-future.rst:2 msgid "Pending Removal in Future Versions" -msgstr "" +msgstr "未來版本中的待移除項目" #: ../../deprecations/pending-removal-in-future.rst:4 msgid "" "The following APIs will be removed in the future, although there is " "currently no date scheduled for their removal." -msgstr "" +msgstr "以下 API 將在未來被移除,雖然目前尚未安排移除日期。" #: ../../deprecations/pending-removal-in-future.rst:7 msgid "" ":mod:`argparse`: Nesting argument groups and nesting mutually exclusive " "groups are deprecated." -msgstr "" +msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" #: ../../deprecations/pending-removal-in-future.rst:10 msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" -msgstr "" - -#: ../../deprecations/pending-removal-in-future.rst:12 -msgid ":mod:`builtins`:" -msgstr "" +msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" #: ../../deprecations/pending-removal-in-future.rst:14 msgid "``bool(NotImplemented)``." -msgstr "" +msgstr "``bool(NotImplemented)``。" #: ../../deprecations/pending-removal-in-future.rst:15 msgid "" @@ -3129,6 +3355,8 @@ msgid "" "is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " "argument signature." msgstr "" +"產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" +"請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" #: ../../deprecations/pending-removal-in-future.rst:18 msgid "" @@ -3141,6 +3369,12 @@ msgid "" "keyword:`is` and :keyword:`or`. In a future release it will be changed to a " "syntax error. (:gh:`87999`)" msgstr "" +"目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " +"1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" +"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" +"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" +"本中,它將被更改為語法錯誤。(:gh:`87999`)" #: ../../deprecations/pending-removal-in-future.rst:26 msgid "" @@ -3148,6 +3382,8 @@ msgid "" "these methods will be required to return an instance of a strict subclass " "of :class:`int`." msgstr "" +"``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" +"傳 :class:`int` 的嚴格子類別實例。" #: ../../deprecations/pending-removal-in-future.rst:29 msgid "" @@ -3155,6 +3391,8 @@ msgid "" "`float`: these methods will be required to return an instance of :class:" "`float`." msgstr "" +"回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" +"傳 :class:`float` 的實例。" #: ../../deprecations/pending-removal-in-future.rst:32 msgid "" @@ -3162,10 +3400,12 @@ msgid "" "`complex`: these methods will be required to return an instance of :class:" "`complex`." msgstr "" +"回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" +"回傳 :class:`complex` 的實例。" #: ../../deprecations/pending-removal-in-future.rst:35 msgid "Delegation of ``int()`` to ``__trunc__()`` method." -msgstr "" +msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" #: ../../deprecations/pending-removal-in-future.rst:36 msgid "" @@ -3174,6 +3414,8 @@ msgid "" "single positional argument. (Contributed by Serhiy Storchaka in :gh:" "`109218`.)" msgstr "" +"在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" +"它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" #: ../../deprecations/pending-removal-in-future.rst:41 msgid "" @@ -3181,58 +3423,68 @@ msgid "" "are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." "FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" msgstr "" +":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" +"被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " +"Roshan 於 :gh:`103636` 貢獻。)" #: ../../deprecations/pending-removal-in-future.rst:46 msgid "" ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " "instead." msgstr "" +":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" #: ../../deprecations/pending-removal-in-future.rst:49 msgid ":mod:`datetime`:" -msgstr "" +msgstr ":mod:`datetime`:" #: ../../deprecations/pending-removal-in-future.rst:51 msgid "" ":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." "UTC)``." msgstr "" +":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." +"now(tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:53 msgid "" ":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:56 msgid ":mod:`gettext`: Plural value must be an integer." -msgstr "" +msgstr ":mod:`gettext`:複數值必須是整數。" #: ../../deprecations/pending-removal-in-future.rst:58 msgid ":mod:`importlib`:" -msgstr "" +msgstr ":mod:`importlib`:" #: ../../deprecations/pending-removal-in-future.rst:60 msgid "``load_module()`` method: use ``exec_module()`` instead." -msgstr "" +msgstr "``load_module()`` method:請改用 ``exec_module()``。" #: ../../deprecations/pending-removal-in-future.rst:61 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." msgstr "" +":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" +"用 *optimization* 參數。" #: ../../deprecations/pending-removal-in-future.rst:64 msgid ":mod:`importlib.metadata`:" -msgstr "" +msgstr ":mod:`importlib.metadata`:" #: ../../deprecations/pending-removal-in-future.rst:66 msgid "``EntryPoints`` tuple interface." -msgstr "" +msgstr "``EntryPoints`` 元組介面。" #: ../../deprecations/pending-removal-in-future.rst:67 msgid "Implicit ``None`` on return values." -msgstr "" +msgstr "回傳值上的隱式 ``None``。" #: ../../deprecations/pending-removal-in-future.rst:69 msgid "" @@ -3245,17 +3497,20 @@ msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" +":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" #: ../../deprecations/pending-removal-in-future.rst:75 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." -msgstr "" +msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" #: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." msgstr "" +":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" +"實例。" #: ../../deprecations/pending-removal-in-future.rst:80 msgid "" @@ -3265,171 +3520,189 @@ msgid "" "replacement strings can now only contain ASCII letters and digits and " "underscore. (Contributed by Serhiy Storchaka in :gh:`91760`.)" msgstr "" +":mod:`re`:現在對正規表示式中的數值群組參照和群組名稱用了更嚴格的規則。現在只" +"有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" +"包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" #: ../../deprecations/pending-removal-in-future.rst:87 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." -msgstr "" +msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" #: ../../deprecations/pending-removal-in-future.rst:89 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." msgstr "" +":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" +"棄用;請改用 *onexc* 參數。" #: ../../deprecations/pending-removal-in-future.rst:92 msgid ":mod:`ssl` options and protocols:" -msgstr "" +msgstr ":mod:`ssl` 選項和協定:" #: ../../deprecations/pending-removal-in-future.rst:94 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." -msgstr "" +msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:95 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" "`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" +"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" #: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.OP_NO_SSL*`` options" -msgstr "" +msgstr "``ssl.OP_NO_SSL*`` 選項" #: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.OP_NO_TLS*`` options" -msgstr "" +msgstr "``ssl.OP_NO_TLS*`` 選項" #: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_SSLv3``" -msgstr "" +msgstr "``ssl.PROTOCOL_SSLv3``" #: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLS``" -msgstr "" +msgstr "``ssl.PROTOCOL_TLS``" #: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.PROTOCOL_TLSv1``" -msgstr "" +msgstr "``ssl.PROTOCOL_TLSv1``" #: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.PROTOCOL_TLSv1_1``" -msgstr "" +msgstr "``ssl.PROTOCOL_TLSv1_1``" #: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.PROTOCOL_TLSv1_2``" -msgstr "" +msgstr "``ssl.PROTOCOL_TLSv1_2``" #: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.TLSVersion.SSLv3``" -msgstr "" +msgstr "``ssl.TLSVersion.SSLv3``" #: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.TLSVersion.TLSv1``" -msgstr "" +msgstr "``ssl.TLSVersion.TLSv1``" #: ../../deprecations/pending-removal-in-future.rst:107 msgid "``ssl.TLSVersion.TLSv1_1``" -msgstr "" +msgstr "``ssl.TLSVersion.TLSv1_1``" #: ../../deprecations/pending-removal-in-future.rst:109 msgid "" ":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " "ignored." msgstr "" +":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" #: ../../deprecations/pending-removal-in-future.rst:112 msgid ":mod:`threading` methods:" -msgstr "" +msgstr ":mod:`threading` 方法:" #: ../../deprecations/pending-removal-in-future.rst:114 msgid "" ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." "notify_all`." msgstr "" +":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." +"notify_all`。" #: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." -msgstr "" +msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" #: ../../deprecations/pending-removal-in-future.rst:116 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" "attr:`threading.Thread.daemon` attribute." msgstr "" +":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" +"用 :attr:`threading.Thread.daemon` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:118 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" "attr:`threading.Thread.name` attribute." msgstr "" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" +"attr:`threading.Thread.name` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:120 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" +":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" #: ../../deprecations/pending-removal-in-future.rst:121 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." -msgstr "" +msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" #: ../../deprecations/pending-removal-in-future.rst:123 msgid ":class:`typing.Text` (:gh:`92332`)." -msgstr "" +msgstr ":class:`typing.Text` (:gh:`92332`)。" #: ../../deprecations/pending-removal-in-future.rst:125 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." msgstr "" +":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" +"被棄用。" #: ../../deprecations/pending-removal-in-future.rst:128 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" +":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" #: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splitattr()``" -msgstr "" +msgstr "``splitattr()``" #: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splithost()``" -msgstr "" +msgstr "``splithost()``" #: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splitnport()``" -msgstr "" +msgstr "``splitnport()``" #: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splitpasswd()``" -msgstr "" +msgstr "``splitpasswd()``" #: ../../deprecations/pending-removal-in-future.rst:134 msgid "``splitport()``" -msgstr "" +msgstr "``splitport()``" #: ../../deprecations/pending-removal-in-future.rst:135 msgid "``splitquery()``" -msgstr "" +msgstr "``splitquery()``" #: ../../deprecations/pending-removal-in-future.rst:136 msgid "``splittag()``" -msgstr "" +msgstr "``splittag()``" #: ../../deprecations/pending-removal-in-future.rst:137 msgid "``splittype()``" -msgstr "" +msgstr "``splittype()``" #: ../../deprecations/pending-removal-in-future.rst:138 msgid "``splituser()``" -msgstr "" +msgstr "``splituser()``" #: ../../deprecations/pending-removal-in-future.rst:139 msgid "``splitvalue()``" -msgstr "" +msgstr "``splitvalue()``" #: ../../deprecations/pending-removal-in-future.rst:140 msgid "``to_bytes()``" -msgstr "" +msgstr "``to_bytes()``" #: ../../deprecations/pending-removal-in-future.rst:142 msgid "" @@ -3437,12 +3710,15 @@ msgid "" "`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " "Use newer :func:`~urllib.request.urlopen` functions and methods." msgstr "" +":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` 和 :" +"class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" +"`~urllib.request.urlopen` 函式和方法。" #: ../../deprecations/pending-removal-in-future.rst:146 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." -msgstr "" +msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" #: ../../deprecations/pending-removal-in-future.rst:149 msgid "" @@ -3451,1333 +3727,1580 @@ msgid "" "return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " "instead." msgstr "" +":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." +"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " +"``len(elem)`` 或 ``elem is not None`` 測試。" #: ../../deprecations/pending-removal-in-future.rst:154 msgid "" ":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" "`~zipimport.zipimporter.exec_module` instead." msgstr "" +":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." +"zipimporter.exec_module`。" -#: ../../whatsnew/3.13.rst:1941 +#: ../../whatsnew/3.13.rst:1992 msgid "CPython Bytecode Changes" msgstr "" -#: ../../whatsnew/3.13.rst:1943 +#: ../../whatsnew/3.13.rst:1994 msgid "" -"The oparg of ``YIELD_VALUE`` is now ``1`` if the yield is part of a yield-" -"from or await, and ``0`` otherwise. The oparg of ``RESUME`` was changed to " -"add a bit indicating whether the except-depth is 1, which is needed to " +"The oparg of :opcode:`YIELD_VALUE` is now ``1`` if the yield is part of a " +"yield-from or await, and ``0`` otherwise. The oparg of :opcode:`RESUME` was " +"changed to add a bit indicating if the except-depth is 1, which is needed to " "optimize closing of generators. (Contributed by Irit Katriel in :gh:" "`111354`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1951 +#: ../../whatsnew/3.13.rst:2002 msgid "C API Changes" -msgstr "" +msgstr "C API 變更" -#: ../../whatsnew/3.13.rst:1956 +#: ../../whatsnew/3.13.rst:2007 msgid "" -"You no longer have to define the ``PY_SSIZE_T_CLEAN`` macro before " -"including :file:`Python.h` when using ``#`` formats in :ref:`format codes " -"`. APIs accepting the format codes always " -"use ``Py_ssize_t`` for ``#`` formats. (Contributed by Inada Naoki in :gh:" -"`104922`.)" +"Add the :ref:`PyMonitoring C API ` for generating :pep:" +"`669` monitoring events:" msgstr "" -#: ../../whatsnew/3.13.rst:1962 -msgid "" -"The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and :c:" -"func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * const *` " -"in C and :c:expr:`const char * const *` in C++, instead of :c:expr:`char " -"**`. It makes these functions compatible with arguments of type :c:expr:" -"`const char * const *`, :c:expr:`const char **` or :c:expr:`char * const *` " -"in C++ and :c:expr:`char * const *` in C without an explicit type cast. This " -"can be overridden with the :c:macro:`PY_CXX_CONST` macro. (Contributed by " -"Serhiy Storchaka in :gh:`65210`.)" -msgstr "" +#: ../../whatsnew/3.13.rst:2010 +msgid ":c:type:`PyMonitoringState`" +msgstr ":c:type:`PyMonitoringState`" -#: ../../whatsnew/3.13.rst:1972 -msgid "" -"Add :c:func:`PyImport_AddModuleRef`: similar to :c:func:" -"`PyImport_AddModule`, but return a :term:`strong reference` instead of a :" -"term:`borrowed reference`. (Contributed by Victor Stinner in :gh:`105922`.)" +#: ../../whatsnew/3.13.rst:2011 +msgid ":c:func:`PyMonitoring_FirePyStartEvent`" +msgstr ":c:func:`PyMonitoring_FirePyStartEvent`" + +#: ../../whatsnew/3.13.rst:2012 +msgid ":c:func:`PyMonitoring_FirePyResumeEvent`" +msgstr ":c:func:`PyMonitoring_FirePyResumeEvent`" + +#: ../../whatsnew/3.13.rst:2013 +msgid ":c:func:`PyMonitoring_FirePyReturnEvent`" +msgstr ":c:func:`PyMonitoring_FirePyReturnEvent`" + +#: ../../whatsnew/3.13.rst:2014 +msgid ":c:func:`PyMonitoring_FirePyYieldEvent`" +msgstr ":c:func:`PyMonitoring_FirePyYieldEvent`" + +#: ../../whatsnew/3.13.rst:2015 +msgid ":c:func:`PyMonitoring_FireCallEvent`" +msgstr ":c:func:`PyMonitoring_FireCallEvent`" + +#: ../../whatsnew/3.13.rst:2016 +msgid ":c:func:`PyMonitoring_FireLineEvent`" +msgstr ":c:func:`PyMonitoring_FireLineEvent`" + +#: ../../whatsnew/3.13.rst:2017 +msgid ":c:func:`PyMonitoring_FireJumpEvent`" +msgstr ":c:func:`PyMonitoring_FireJumpEvent`" + +#: ../../whatsnew/3.13.rst:2018 +msgid ":c:func:`PyMonitoring_FireBranchEvent`" +msgstr ":c:func:`PyMonitoring_FireBranchEvent`" + +#: ../../whatsnew/3.13.rst:2019 +msgid ":c:func:`PyMonitoring_FireCReturnEvent`" +msgstr ":c:func:`PyMonitoring_FireCReturnEvent`" + +#: ../../whatsnew/3.13.rst:2020 +msgid ":c:func:`PyMonitoring_FirePyThrowEvent`" +msgstr ":c:func:`PyMonitoring_FirePyThrowEvent`" + +#: ../../whatsnew/3.13.rst:2021 +msgid ":c:func:`PyMonitoring_FireRaiseEvent`" +msgstr ":c:func:`PyMonitoring_FireRaiseEvent`" + +#: ../../whatsnew/3.13.rst:2022 +msgid ":c:func:`PyMonitoring_FireCRaiseEvent`" +msgstr ":c:func:`PyMonitoring_FireCRaiseEvent`" + +#: ../../whatsnew/3.13.rst:2023 +msgid ":c:func:`PyMonitoring_FireReraiseEvent`" +msgstr ":c:func:`PyMonitoring_FireReraiseEvent`" + +#: ../../whatsnew/3.13.rst:2024 +msgid ":c:func:`PyMonitoring_FireExceptionHandledEvent`" +msgstr ":c:func:`PyMonitoring_FireExceptionHandledEvent`" + +#: ../../whatsnew/3.13.rst:2025 +msgid ":c:func:`PyMonitoring_FirePyUnwindEvent`" +msgstr ":c:func:`PyMonitoring_FirePyUnwindEvent`" + +#: ../../whatsnew/3.13.rst:2026 +msgid ":c:func:`PyMonitoring_FireStopIterationEvent`" +msgstr ":c:func:`PyMonitoring_FireStopIterationEvent`" + +#: ../../whatsnew/3.13.rst:2027 +msgid ":c:func:`PyMonitoring_EnterScope`" +msgstr ":c:func:`PyMonitoring_EnterScope`" + +#: ../../whatsnew/3.13.rst:2028 +msgid ":c:func:`PyMonitoring_ExitScope`" +msgstr ":c:func:`PyMonitoring_ExitScope`" + +#: ../../whatsnew/3.13.rst:2030 +msgid "(Contributed by Irit Katriel in :gh:`111997`)." msgstr "" -#: ../../whatsnew/3.13.rst:1977 +#: ../../whatsnew/3.13.rst:2032 msgid "" -"Add :c:func:`PyWeakref_GetRef` function: similar to :c:func:" -"`PyWeakref_GetObject` but returns a :term:`strong reference`, or ``NULL`` if " -"the referent is no longer live. (Contributed by Victor Stinner in :gh:" -"`105927`.)" +"Add :c:type:`PyMutex`, a lightweight mutex that occupies a single byte, and " +"the new :c:func:`PyMutex_Lock` and :c:func:`PyMutex_Unlock` functions. :c:" +"func:`!PyMutex_Lock` will release the :term:`GIL` (if currently held) if the " +"operation needs to block. (Contributed by Sam Gross in :gh:`108724`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1982 +#: ../../whatsnew/3.13.rst:2038 msgid "" -"Add :c:func:`PyObject_GetOptionalAttr` and :c:func:" -"`PyObject_GetOptionalAttrString`, variants of :c:func:`PyObject_GetAttr` " -"and :c:func:`PyObject_GetAttrString` which don't raise :exc:`AttributeError` " -"if the attribute is not found. These variants are more convenient and faster " -"if the missing attribute should not be treated as a failure. (Contributed by " -"Serhiy Storchaka in :gh:`106521`.)" +"Add the :ref:`PyTime C API ` to provide access to system clocks:" msgstr "" -#: ../../whatsnew/3.13.rst:1990 -msgid "" -"Add :c:func:`PyMapping_GetOptionalItem` and :c:func:" -"`PyMapping_GetOptionalItemString`: variants of :c:func:`PyObject_GetItem` " -"and :c:func:`PyMapping_GetItemString` which don't raise :exc:`KeyError` if " -"the key is not found. These variants are more convenient and faster if the " -"missing key should not be treated as a failure. (Contributed by Serhiy " -"Storchaka in :gh:`106307`.)" +#: ../../whatsnew/3.13.rst:2040 +msgid ":c:type:`PyTime_t`." +msgstr ":c:type:`PyTime_t`。" + +#: ../../whatsnew/3.13.rst:2041 +msgid ":c:var:`PyTime_MIN` and :c:var:`PyTime_MAX`." msgstr "" -#: ../../whatsnew/3.13.rst:1998 -msgid "Add fixed variants of functions which silently ignore errors:" +#: ../../whatsnew/3.13.rst:2042 +msgid ":c:func:`PyTime_AsSecondsDouble`." +msgstr ":c:func:`PyTime_AsSecondsDouble`。" + +#: ../../whatsnew/3.13.rst:2043 +msgid ":c:func:`PyTime_Monotonic`." +msgstr ":c:func:`PyTime_Monotonic`。" + +#: ../../whatsnew/3.13.rst:2044 +msgid ":c:func:`PyTime_MonotonicRaw`." +msgstr ":c:func:`PyTime_MonotonicRaw`。" + +#: ../../whatsnew/3.13.rst:2045 +msgid ":c:func:`PyTime_PerfCounter`." +msgstr ":c:func:`PyTime_PerfCounter`。" + +#: ../../whatsnew/3.13.rst:2046 +msgid ":c:func:`PyTime_PerfCounterRaw`." +msgstr ":c:func:`PyTime_PerfCounterRaw`。" + +#: ../../whatsnew/3.13.rst:2047 +msgid ":c:func:`PyTime_Time`." +msgstr ":c:func:`PyTime_Time`。" + +#: ../../whatsnew/3.13.rst:2048 +msgid ":c:func:`PyTime_TimeRaw`." +msgstr ":c:func:`PyTime_TimeRaw`。" + +#: ../../whatsnew/3.13.rst:2050 +msgid "(Contributed by Victor Stinner and Petr Viktorin in :gh:`110850`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2000 +#: ../../whatsnew/3.13.rst:2052 msgid "" -":c:func:`PyObject_HasAttrWithError` replaces :c:func:`PyObject_HasAttr`." +"Add the :c:func:`PyDict_ContainsString` function with the same behavior as :" +"c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const char*` " +"UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`. (Contributed " +"by Victor Stinner in :gh:`108314`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2001 +#: ../../whatsnew/3.13.rst:2058 msgid "" -":c:func:`PyObject_HasAttrStringWithError` replaces :c:func:" -"`PyObject_HasAttrString`." +"Add the :c:func:`PyDict_GetItemRef` and :c:func:`PyDict_GetItemStringRef` " +"functions, which behave similarly to :c:func:`PyDict_GetItemWithError`, but " +"return a :term:`strong reference` instead of a :term:`borrowed reference`. " +"Moreover, these functions return ``-1`` on error, removing the need to " +"check :c:func:`!PyErr_Occurred`. (Contributed by Victor Stinner in :gh:" +"`106004`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2002 +#: ../../whatsnew/3.13.rst:2066 msgid "" -":c:func:`PyMapping_HasKeyWithError` replaces :c:func:`PyMapping_HasKey`." +"Add the :c:func:`PyDict_SetDefaultRef` function, which behaves similarly to :" +"c:func:`PyDict_SetDefault`, but returns a :term:`strong reference` instead " +"of a :term:`borrowed reference`. This function returns ``-1`` on error, " +"``0`` on insertion, and ``1`` if the key was already present in the " +"dictionary. (Contributed by Sam Gross in :gh:`112066`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2003 +#: ../../whatsnew/3.13.rst:2074 msgid "" -":c:func:`PyMapping_HasKeyStringWithError` replaces :c:func:" -"`PyMapping_HasKeyString`." +"Add the :c:func:`PyDict_Pop` and :c:func:`PyDict_PopString` functions to " +"remove a key from a dictionary and optionally return the removed value. This " +"is similar to :meth:`dict.pop`, though there is no default value, and :exc:" +"`KeyError` is not raised for missing keys. (Contributed by Stefan Behnel and " +"Victor Stinner in :gh:`111262`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2005 +#: ../../whatsnew/3.13.rst:2081 msgid "" -"New functions return not only ``1`` for true and ``0`` for false, but also " -"``-1`` for error." +"Add the :c:func:`PyMapping_GetOptionalItem` and :c:func:" +"`PyMapping_GetOptionalItemString` functions as alternatives to :c:func:" +"`PyObject_GetItem` and :c:func:`PyMapping_GetItemString` respectively. The " +"new functions do not raise :exc:`KeyError` if the requested key is missing " +"from the mapping. These variants are more convenient and faster if a missing " +"key should not be treated as a failure. (Contributed by Serhiy Storchaka in :" +"gh:`106307`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2008 -msgid "(Contributed by Serhiy Storchaka in :gh:`108511`.)" +#: ../../whatsnew/3.13.rst:2091 +msgid "" +"Add the :c:func:`PyObject_GetOptionalAttr` and :c:func:" +"`PyObject_GetOptionalAttrString` functions as alternatives to :c:func:" +"`PyObject_GetAttr` and :c:func:`PyObject_GetAttrString` respectively. The " +"new functions do not raise :exc:`AttributeError` if the requested attribute " +"is not found on the object. These variants are more convenient and faster if " +"the missing attribute should not be treated as a failure. (Contributed by " +"Serhiy Storchaka in :gh:`106521`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2010 +#: ../../whatsnew/3.13.rst:2101 msgid "" -"If Python is built in :ref:`debug mode ` or :option:`with " -"assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and :c:func:" -"`PyList_SET_ITEM` now check the index argument with an assertion. " -"(Contributed by Victor Stinner in :gh:`106168`.)" +"Add the :c:func:`PyErr_FormatUnraisable` function as an extension to :c:func:" +"`PyErr_WriteUnraisable` that allows customizing the warning message. " +"(Contributed by Serhiy Storchaka in :gh:`108082`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2015 +#: ../../whatsnew/3.13.rst:2106 msgid "" -"Add :c:func:`PyModule_Add` function: similar to :c:func:" -"`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject` but always steals a " -"reference to the value. (Contributed by Serhiy Storchaka in :gh:`86493`.)" +"Add new functions that return a :term:`strong reference` instead of a :term:" +"`borrowed reference` for frame locals, globals, and builtins, as part of :" +"ref:`PEP 667 `:" msgstr "" -#: ../../whatsnew/3.13.rst:2020 -msgid "" -"Add :c:func:`PyDict_GetItemRef` and :c:func:`PyDict_GetItemStringRef` " -"functions: similar to :c:func:`PyDict_GetItemWithError` but returning a :" -"term:`strong reference` instead of a :term:`borrowed reference`. Moreover, " -"these functions return -1 on error and so checking ``PyErr_Occurred()`` is " -"not needed. (Contributed by Victor Stinner in :gh:`106004`.)" +#: ../../whatsnew/3.13.rst:2110 +msgid ":c:func:`PyEval_GetFrameBuiltins` replaces :c:func:`PyEval_GetBuiltins`" msgstr "" -#: ../../whatsnew/3.13.rst:2027 -msgid "" -"Added :c:func:`PyDict_SetDefaultRef`, which is similar to :c:func:" -"`PyDict_SetDefault` but returns a :term:`strong reference` instead of a :" -"term:`borrowed reference`. This function returns ``-1`` on error, ``0`` on " -"insertion, and ``1`` if the key was already present in the dictionary. " -"(Contributed by Sam Gross in :gh:`112066`.)" +#: ../../whatsnew/3.13.rst:2111 +msgid ":c:func:`PyEval_GetFrameGlobals` replaces :c:func:`PyEval_GetGlobals`" msgstr "" -#: ../../whatsnew/3.13.rst:2033 -msgid "" -"Add :c:func:`PyDict_ContainsString` function: same as :c:func:" -"`PyDict_Contains`, but *key* is specified as a :c:expr:`const char*` UTF-8 " -"encoded bytes string, rather than a :c:expr:`PyObject*`. (Contributed by " -"Victor Stinner in :gh:`108314`.)" +#: ../../whatsnew/3.13.rst:2112 +msgid ":c:func:`PyEval_GetFrameLocals` replaces :c:func:`PyEval_GetLocals`" msgstr "" -#: ../../whatsnew/3.13.rst:2038 -msgid "" -"Added :c:func:`PyList_GetItemRef` function: similar to :c:func:" -"`PyList_GetItem` but returns a :term:`strong reference` instead of a :term:" -"`borrowed reference`." +#: ../../whatsnew/3.13.rst:2114 +msgid "(Contributed by Mark Shannon and Tian Gao in :gh:`74929`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2042 +#: ../../whatsnew/3.13.rst:2116 msgid "" -"Add :c:func:`Py_IsFinalizing` function: check if the main Python interpreter " -"is :term:`shutting down `. (Contributed by Victor " -"Stinner in :gh:`108014`.)" +"Add the :c:func:`Py_GetConstant` and :c:func:`Py_GetConstantBorrowed` " +"functions to get :term:`strong ` or :term:`borrowed " +"` references to constants. For example, " +"``Py_GetConstant(Py_CONSTANT_ZERO)`` returns a strong reference to the " +"constant zero. (Contributed by Victor Stinner in :gh:`115754`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2046 +#: ../../whatsnew/3.13.rst:2123 msgid "" -"Add :c:func:`PyLong_AsInt` function: similar to :c:func:`PyLong_AsLong`, but " -"store the result in a C :c:expr:`int` instead of a C :c:expr:`long`. " -"Previously, it was known as the private function :c:func:`!_PyLong_AsInt` " -"(with an underscore prefix). (Contributed by Victor Stinner in :gh:`108014`.)" +"Add the :c:func:`PyImport_AddModuleRef` function as a replacement for :c:" +"func:`PyImport_AddModule` that returns a :term:`strong reference` instead of " +"a :term:`borrowed reference`. (Contributed by Victor Stinner in :gh:" +"`105922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2052 +#: ../../whatsnew/3.13.rst:2128 msgid "" -"Python built with :file:`configure` :option:`--with-trace-refs` (tracing " -"references) now supports the :ref:`Limited API `. " -"(Contributed by Victor Stinner in :gh:`108634`.)" +"Add the :c:func:`Py_IsFinalizing` function to check whether the main Python " +"interpreter is :term:`shutting down `. (Contributed by " +"Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2056 +#: ../../whatsnew/3.13.rst:2133 msgid "" -"Add :c:func:`PyObject_VisitManagedDict` and :c:func:" -"`PyObject_ClearManagedDict` functions which must be called by the traverse " -"and clear functions of a type using :c:macro:`Py_TPFLAGS_MANAGED_DICT` " -"flag. The `pythoncapi-compat project `__ can be used to get these functions on Python 3.11 and 3.12. " -"(Contributed by Victor Stinner in :gh:`107073`.)" +"Add the :c:func:`PyList_GetItemRef` function as a replacement for :c:func:" +"`PyList_GetItem` that returns a :term:`strong reference` instead of a :term:" +"`borrowed reference`. (Contributed by Sam Gross in :gh:`114329`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2064 +#: ../../whatsnew/3.13.rst:2138 msgid "" -"Add :c:func:`PyUnicode_EqualToUTF8AndSize` and :c:func:" -"`PyUnicode_EqualToUTF8` functions: compare Unicode object with a :c:expr:" -"`const char*` UTF-8 encoded string and return true (``1``) if they are " -"equal, or false (``0``) otherwise. These functions do not raise exceptions. " -"(Contributed by Serhiy Storchaka in :gh:`110289`.)" +"Add the :c:func:`PyList_Extend` and :c:func:`PyList_Clear` functions, " +"mirroring the Python :meth:`!list.extend` and :meth:`!list.clear` methods. " +"(Contributed by Victor Stinner in :gh:`111138`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2070 +#: ../../whatsnew/3.13.rst:2142 msgid "" -"Add :c:func:`PyThreadState_GetUnchecked()` function: similar to :c:func:" -"`PyThreadState_Get()`, but don't kill the process with a fatal error if it " -"is NULL. The caller is responsible to check if the result is NULL. " -"Previously, the function was private and known as " -"``_PyThreadState_UncheckedGet()``. (Contributed by Victor Stinner in :gh:" -"`108867`.)" +"Add the :c:func:`PyLong_AsInt` function. It behaves similarly to :c:func:" +"`PyLong_AsLong`, but stores the result in a C :c:expr:`int` instead of a C :" +"c:expr:`long`. (Contributed by Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2077 +#: ../../whatsnew/3.13.rst:2147 msgid "" -"Add :c:func:`PySys_AuditTuple` function: similar to :c:func:`PySys_Audit`, " -"but pass event arguments as a Python :class:`tuple` object. (Contributed by " -"Victor Stinner in :gh:`85283`.)" +"Add the :c:func:`PyLong_AsNativeBytes`, :c:func:`PyLong_FromNativeBytes`, " +"and :c:func:`PyLong_FromUnsignedNativeBytes` functions to simplify " +"converting between native integer types and Python :class:`int` objects. " +"(Contributed by Steve Dower in :gh:`111140`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2081 +#: ../../whatsnew/3.13.rst:2153 msgid "" -":c:func:`PyArg_ParseTupleAndKeywords` now supports non-ASCII keyword " -"parameter names. (Contributed by Serhiy Storchaka in :gh:`110815`.)" +"Add :c:func:`PyModule_Add` function, which is similar to :c:func:" +"`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but always steals " +"a reference to the value. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2085 +#: ../../whatsnew/3.13.rst:2158 msgid "" -"Add :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawCalloc`, :c:func:" -"`PyMem_RawRealloc` and :c:func:`PyMem_RawFree` to the limited C API (version " -"3.13). (Contributed by Victor Stinner in :gh:`85283`.)" +"Add the :c:func:`PyObject_GenericHash` function that implements the default " +"hashing function of a Python object. (Contributed by Serhiy Storchaka in :gh:" +"`113024`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2090 +#: ../../whatsnew/3.13.rst:2162 msgid "" -"Add :c:func:`PySys_Audit` and :c:func:`PySys_AuditTuple` functions to the " -"limited C API. (Contributed by Victor Stinner in :gh:`85283`.)" +"Add the :c:func:`Py_HashPointer` function to hash a raw pointer. " +"(Contributed by Victor Stinner in :gh:`111545`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2094 +#: ../../whatsnew/3.13.rst:2165 msgid "" -"Add :c:func:`PyErr_FormatUnraisable` function: similar to :c:func:" -"`PyErr_WriteUnraisable`, but allow customizing the warning message. " -"(Contributed by Serhiy Storchaka in :gh:`108082`.)" +"Add the :c:func:`PyObject_VisitManagedDict` and :c:func:" +"`PyObject_ClearManagedDict` functions. which must be called by the traverse " +"and clear functions of a type using the :c:macro:`Py_TPFLAGS_MANAGED_DICT` " +"flag. The `pythoncapi-compat project`_ can be used to use these functions " +"with Python 3.11 and 3.12. (Contributed by Victor Stinner in :gh:`107073`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2098 +#: ../../whatsnew/3.13.rst:2173 msgid "" -"Add :c:func:`PyList_Extend` and :c:func:`PyList_Clear` functions: similar to " -"Python ``list.extend()`` and ``list.clear()`` methods. (Contributed by " -"Victor Stinner in :gh:`111138`.)" +"Add the :c:func:`PyRefTracer_SetTracer` and :c:func:`PyRefTracer_GetTracer` " +"functions, which enable tracking object creation and destruction in the same " +"way that the :mod:`tracemalloc` module does. (Contributed by Pablo Galindo " +"in :gh:`93502`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2102 +#: ../../whatsnew/3.13.rst:2179 msgid "" -"Add :c:func:`PyDict_Pop` and :c:func:`PyDict_PopString` functions: remove a " -"key from a dictionary and optionally return the removed value. This is " -"similar to :meth:`dict.pop`, but without the default value and not raising :" -"exc:`KeyError` if the key is missing. (Contributed by Stefan Behnel and " -"Victor Stinner in :gh:`111262`.)" +"Add the :c:func:`PySys_AuditTuple` function as an alternative to :c:func:" +"`PySys_Audit` that takes event arguments as a Python :class:`tuple` object. " +"(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2108 +#: ../../whatsnew/3.13.rst:2184 msgid "" -"Add :c:func:`Py_HashPointer` function to hash a pointer. (Contributed by " -"Victor Stinner in :gh:`111545`.)" +"Add the :c:func:`PyThreadState_GetUnchecked()` function as an alternative " +"to :c:func:`PyThreadState_Get()` that doesn't kill the process with a fatal " +"error if it is ``NULL``. The caller is responsible for checking if the " +"result is ``NULL``. (Contributed by Victor Stinner in :gh:`108867`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2111 +#: ../../whatsnew/3.13.rst:2190 msgid "" -"Add :c:func:`PyObject_GenericHash` function that implements the default " -"hashing function of a Python object. (Contributed by Serhiy Storchaka in :gh:" -"`113024`.)" +"Add the :c:func:`PyType_GetFullyQualifiedName` function to get the type's " +"fully qualified name. The module name is prepended if ``type.__module__`` is " +"a string and is not equal to either ``'builtins'`` or ``'__main__'``. " +"(Contributed by Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2115 -msgid "Add PyTime C API:" +#: ../../whatsnew/3.13.rst:2196 +msgid "" +"Add the :c:func:`PyType_GetModuleName` function to get the type's module " +"name. This is equivalent to getting the ``type.__module__`` attribute. " +"(Contributed by Eric Snow and Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2117 -msgid ":c:type:`PyTime_t` type." +#: ../../whatsnew/3.13.rst:2201 +msgid "" +"Add the :c:func:`PyUnicode_EqualToUTF8AndSize` and :c:func:" +"`PyUnicode_EqualToUTF8` functions to compare a Unicode object with a :c:expr:" +"`const char*` UTF-8 encoded string and ``1`` if they are equal or ``0`` " +"otherwise. These functions do not raise exceptions. (Contributed by Serhiy " +"Storchaka in :gh:`110289`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2118 -msgid ":c:var:`PyTime_MIN` and :c:var:`PyTime_MAX` constants." +#: ../../whatsnew/3.13.rst:2208 +msgid "" +"Add the :c:func:`PyWeakref_GetRef` function as an alternative to :c:func:" +"`PyWeakref_GetObject` that returns a :term:`strong reference` or ``NULL`` if " +"the referent is no longer live. (Contributed by Victor Stinner in :gh:" +"`105927`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2119 -msgid "Add functions:" +#: ../../whatsnew/3.13.rst:2214 +msgid "Add fixed variants of functions which silently ignore errors:" msgstr "" -#: ../../whatsnew/3.13.rst:2121 -msgid ":c:func:`PyTime_AsSecondsDouble`." -msgstr "" - -#: ../../whatsnew/3.13.rst:2122 -msgid ":c:func:`PyTime_Monotonic`." -msgstr "" - -#: ../../whatsnew/3.13.rst:2123 -msgid ":c:func:`PyTime_MonotonicRaw`." -msgstr "" - -#: ../../whatsnew/3.13.rst:2124 -msgid ":c:func:`PyTime_PerfCounter`." -msgstr "" - -#: ../../whatsnew/3.13.rst:2125 -msgid ":c:func:`PyTime_PerfCounterRaw`." -msgstr "" - -#: ../../whatsnew/3.13.rst:2126 -msgid ":c:func:`PyTime_Time`." +#: ../../whatsnew/3.13.rst:2216 +msgid "" +":c:func:`PyObject_HasAttrWithError` replaces :c:func:`PyObject_HasAttr`." msgstr "" -#: ../../whatsnew/3.13.rst:2127 -msgid ":c:func:`PyTime_TimeRaw`." +#: ../../whatsnew/3.13.rst:2217 +msgid "" +":c:func:`PyObject_HasAttrStringWithError` replaces :c:func:" +"`PyObject_HasAttrString`." msgstr "" -#: ../../whatsnew/3.13.rst:2129 -msgid "(Contributed by Victor Stinner and Petr Viktorin in :gh:`110850`.)" +#: ../../whatsnew/3.13.rst:2219 +msgid "" +":c:func:`PyMapping_HasKeyWithError` replaces :c:func:`PyMapping_HasKey`." msgstr "" -#: ../../whatsnew/3.13.rst:2131 +#: ../../whatsnew/3.13.rst:2220 msgid "" -"Add :c:func:`PyLong_AsNativeBytes`, :c:func:`PyLong_FromNativeBytes` and :c:" -"func:`PyLong_FromUnsignedNativeBytes` functions to simplify converting " -"between native integer types and Python :class:`int` objects. (Contributed " -"by Steve Dower in :gh:`111140`.)" +":c:func:`PyMapping_HasKeyStringWithError` replaces :c:func:" +"`PyMapping_HasKeyString`." msgstr "" -#: ../../whatsnew/3.13.rst:2136 +#: ../../whatsnew/3.13.rst:2223 msgid "" -"Add :c:func:`PyType_GetFullyQualifiedName` function to get the type's fully " -"qualified name. Equivalent to ``f\"{type.__module__}.{type." -"__qualname__}\"``, or ``type.__qualname__`` if ``type.__module__`` is not a " -"string or is equal to ``\"builtins\"``. (Contributed by Victor Stinner in :" -"gh:`111696`.)" +"The new functions return ``-1`` for errors and the standard ``1`` for true " +"and ``0`` for false." msgstr "" -#: ../../whatsnew/3.13.rst:2142 -msgid "" -"Add :c:func:`PyType_GetModuleName` function to get the type's module name. " -"Equivalent to getting the ``type.__module__`` attribute. (Contributed by " -"Eric Snow and Victor Stinner in :gh:`111696`.)" +#: ../../whatsnew/3.13.rst:2226 +msgid "(Contributed by Serhiy Storchaka in :gh:`108511`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2146 -msgid "" -"Add support for ``%T``, ``%#T``, ``%N`` and ``%#N`` formats to :c:func:" -"`PyUnicode_FromFormat`: format the fully qualified name of an object type " -"and of a type: call :c:func:`PyType_GetModuleName`. See :pep:`737` for more " -"information. (Contributed by Victor Stinner in :gh:`111696`.)" +#: ../../whatsnew/3.13.rst:2230 +msgid "Changed C APIs" msgstr "" -#: ../../whatsnew/3.13.rst:2152 +#: ../../whatsnew/3.13.rst:2232 msgid "" -"Add :c:func:`Py_GetConstant` and :c:func:`Py_GetConstantBorrowed` functions " -"to get constants. For example, ``Py_GetConstant(Py_CONSTANT_ZERO)`` returns " -"a :term:`strong reference` to the constant zero. (Contributed by Victor " -"Stinner in :gh:`115754`.)" +"The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and :c:" +"func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * const *` " +"in C and :c:expr:`const char * const *` in C++, instead of :c:expr:`char " +"**`. In C++, this makes these functions compatible with arguments of type :c:" +"expr:`const char * const *`, :c:expr:`const char **`, or :c:expr:`char * " +"const *` without an explicit type cast. In C, the functions only support " +"arguments of type :c:expr:`char * const *`. This can be overridden with the :" +"c:macro:`PY_CXX_CONST` macro. (Contributed by Serhiy Storchaka in :gh:" +"`65210`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2157 +#: ../../whatsnew/3.13.rst:2244 msgid "" -"Add :c:func:`PyType_GetModuleByDef` to the limited C API (Contributed by " -"Victor Stinner in :gh:`116936`.)" +":c:func:`PyArg_ParseTupleAndKeywords` now supports non-ASCII keyword " +"parameter names. (Contributed by Serhiy Storchaka in :gh:`110815`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2160 +#: ../../whatsnew/3.13.rst:2248 msgid "" -"Add two new functions to the C-API, :c:func:`PyRefTracer_SetTracer` and :c:" -"func:`PyRefTracer_GetTracer`, that allow to track object creation and " -"destruction the same way the :mod:`tracemalloc` module does. (Contributed by " -"Pablo Galindo in :gh:`93502`.)" +"The :c:func:`!PyCode_GetFirstFree` function is now unstable API and is now " +"named :c:func:`PyUnstable_Code_GetFirstFree`. (Contributed by Bogdan " +"Romanyuk in :gh:`115781`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2165 +#: ../../whatsnew/3.13.rst:2252 msgid "" -"Add :c:func:`PyEval_GetFrameBuiltins`, :c:func:`PyEval_GetFrameGlobals`, " -"and :c:func:`PyEval_GetFrameLocals` to the C API. These replacements for :c:" -"func:`PyEval_GetBuiltins`, :c:func:`PyEval_GetGlobals`, and :c:func:" -"`PyEval_GetLocals` return :term:`strong references ` " -"rather than borrowed references. (Added as part of :pep:`667`.)" +"The :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:" +"`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:" +"`PyObject_HasAttr`, :c:func:`PyObject_HasAttrString`, and :c:func:" +"`PySys_GetObject` functions, each of which clears all errors which occurred " +"when calling them now reports these errors using :func:`sys.unraisablehook`. " +"You may replace them with other functions as recommended in the " +"documentation. (Contributed by Serhiy Storchaka in :gh:`106672`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2171 +#: ../../whatsnew/3.13.rst:2261 msgid "" -"Add :c:type:`PyMutex` API, a lightweight mutex that occupies a single byte. " -"The :c:func:`PyMutex_Lock` function will release the GIL (if currently held) " -"if the operation needs to block. (Contributed by Sam Gross in :gh:`108724`.)" +"Add support for the ``%T``, ``%#T``, ``%N`` and ``%#N`` formats to :c:func:" +"`PyUnicode_FromFormat`:" msgstr "" -#: ../../whatsnew/3.13.rst:2177 -msgid "Build Changes" +#: ../../whatsnew/3.13.rst:2264 +msgid "``%T``: Get the fully qualified name of an object type" msgstr "" -#: ../../whatsnew/3.13.rst:2179 -msgid "" -"The :file:`configure` option :option:`--with-system-libmpdec` now defaults " -"to ``yes``. The bundled copy of ``libmpdecimal`` will be removed in Python " -"3.15." +#: ../../whatsnew/3.13.rst:2265 +msgid "``%#T``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2183 -msgid "" -"Autoconf 2.71 and aclocal 1.16.4 are now required to regenerate the :file:" -"`configure` script. (Contributed by Christian Heimes in :gh:`89886`.)" +#: ../../whatsnew/3.13.rst:2266 +msgid "``%N``: Get the fully qualified name of a type" msgstr "" -#: ../../whatsnew/3.13.rst:2187 -msgid "" -"SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension " -"module. (Contributed by Erlend Aasland in :gh:`105875`.)" +#: ../../whatsnew/3.13.rst:2267 +msgid "``%#N``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2190 +#: ../../whatsnew/3.13.rst:2269 msgid "" -"Python built with :file:`configure` :option:`--with-trace-refs` (tracing " -"references) is now ABI compatible with the Python release build and :ref:" -"`debug build `. (Contributed by Victor Stinner in :gh:`108634`.)" +"See :pep:`737` for more information. (Contributed by Victor Stinner in :gh:" +"`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2195 +#: ../../whatsnew/3.13.rst:2272 msgid "" -"Building CPython now requires a compiler with support for the C11 atomic " -"library, GCC built-in atomic functions, or MSVC interlocked intrinsics." +"You no longer have to define the ``PY_SSIZE_T_CLEAN`` macro before " +"including :file:`Python.h` when using ``#`` formats in :ref:`format codes " +"`. APIs accepting the format codes always " +"use ``Py_ssize_t`` for ``#`` formats. (Contributed by Inada Naoki in :gh:" +"`104922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2198 +#: ../../whatsnew/3.13.rst:2278 msgid "" -"The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``, " -"``termios``, ``winsound``, ``_ctypes_test``, ``_multiprocessing." -"posixshmem``, ``_scproxy``, ``_stat``, ``_statistics``, ``_testconsole``, " -"``_testimportmultiple`` and ``_uuid`` C extensions are now built with the :" -"ref:`limited C API `. (Contributed by Victor Stinner in :gh:" -"`85283`.)" +"If Python is built in :ref:`debug mode ` or :option:`with " +"assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and :c:func:" +"`PyList_SET_ITEM` now check the index argument with an assertion. " +"(Contributed by Victor Stinner in :gh:`106168`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2205 -msgid "" -"``wasm32-wasi`` is now a :pep:`11` tier 2 platform. (Contributed by Brett " -"Cannon in :gh:`115192`.)" +#: ../../whatsnew/3.13.rst:2286 +msgid "Limited C API Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2208 -msgid "" -"``wasm32-emscripten`` is no longer a :pep:`11` supported platform. " -"(Contributed by Brett Cannon in :gh:`115192`.)" +#: ../../whatsnew/3.13.rst:2288 +msgid "The following functions are now included in the Limited C API:" msgstr "" -#: ../../whatsnew/3.13.rst:2211 -msgid "" -"Python now bundles the `mimalloc library `__. It is licensed under the MIT license; see :ref:`mimalloc " -"license `. The bundled mimalloc has custom changes, see :" -"gh:`113141` for details. (Contributed by Dino Viehland in :gh:`109914`.)" -msgstr "" +#: ../../whatsnew/3.13.rst:2290 +msgid ":c:func:`PyMem_RawMalloc`" +msgstr ":c:func:`PyMem_RawMalloc`" -#: ../../whatsnew/3.13.rst:2216 -msgid "" -"On POSIX systems, the pkg-config (``.pc``) filenames now include the ABI " -"flags. For example, the free-threaded build generates ``python-3.13t.pc`` " -"and the debug build generates ``python-3.13d.pc``." -msgstr "" +#: ../../whatsnew/3.13.rst:2291 +msgid ":c:func:`PyMem_RawCalloc`" +msgstr ":c:func:`PyMem_RawCalloc`" -#: ../../whatsnew/3.13.rst:2222 -msgid "Porting to Python 3.13" -msgstr "" +#: ../../whatsnew/3.13.rst:2292 +msgid ":c:func:`PyMem_RawRealloc`" +msgstr ":c:func:`PyMem_RawRealloc`" -#: ../../whatsnew/3.13.rst:2224 -msgid "" -"This section lists previously described changes and other bugfixes that may " -"require changes to your code." -msgstr "" +#: ../../whatsnew/3.13.rst:2293 +msgid ":c:func:`PyMem_RawFree`" +msgstr ":c:func:`PyMem_RawFree`" -#: ../../whatsnew/3.13.rst:2228 -msgid "Changes in the Python API" -msgstr "" +#: ../../whatsnew/3.13.rst:2294 +msgid ":c:func:`PySys_Audit`" +msgstr ":c:func:`PySys_Audit`" -#: ../../whatsnew/3.13.rst:2230 +#: ../../whatsnew/3.13.rst:2295 +msgid ":c:func:`PySys_AuditTuple`" +msgstr ":c:func:`PySys_AuditTuple`" + +#: ../../whatsnew/3.13.rst:2296 +msgid ":c:func:`PyType_GetModuleByDef`" +msgstr ":c:func:`PyType_GetModuleByDef`" + +#: ../../whatsnew/3.13.rst:2298 msgid "" -"An :exc:`OSError` is now raised by :func:`getpass.getuser` for any failure " -"to retrieve a username, instead of :exc:`ImportError` on non-Unix platforms " -"or :exc:`KeyError` on Unix platforms where the password database is empty." +"(Contributed by Victor Stinner in :gh:`85283`, :gh:`85283`, and :gh:" +"`116936`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2234 +#: ../../whatsnew/3.13.rst:2300 msgid "" -"The :mod:`threading` module now expects the :mod:`!_thread` module to have " -"an ``_is_main_interpreter`` attribute. It is a function with no arguments " -"that returns ``True`` if the current interpreter is the main interpreter." +"Python built with :option:`--with-trace-refs` (tracing references) now " +"supports the :ref:`Limited API `. (Contributed by Victor " +"Stinner in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2239 -msgid "" -"Any library or application that provides a custom ``_thread`` module must " -"provide ``_is_main_interpreter()``, just like the module's other \"private\" " -"attributes. (See :gh:`112826`.)" +#: ../../whatsnew/3.13.rst:2306 +msgid "Removed C APIs" msgstr "" -#: ../../whatsnew/3.13.rst:2244 +#: ../../whatsnew/3.13.rst:2308 msgid "" -":class:`mailbox.Maildir` now ignores files with a leading dot. (Contributed " -"by Zackery Spytz in :gh:`65559`.)" +"Remove several functions, macros, variables, etc with names prefixed by " +"``_Py`` or ``_PY`` (which are considered private). If your project is " +"affected by one of these removals and you believe that the removed API " +"should remain available, please :ref:`open a new issue ` " +"to request a public C API and add ``cc: @vstinner`` to the issue to notify " +"Victor Stinner. (Contributed by Victor Stinner in :gh:`106320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2247 +#: ../../whatsnew/3.13.rst:2316 msgid "" -":meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` now return both " -"files and directories if a pattern that ends with \"``**``\" is given, " -"rather than directories only. Users may add a trailing slash to match only " -"directories." +"Remove old buffer protocols deprecated in Python 3.0. Use :ref:" +"`bufferobjects` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2252 +#: ../../whatsnew/3.13.rst:2319 msgid "" -"The value of the :attr:`!mode` attribute of :class:`gzip.GzipFile` was " -"changed from integer (``1`` or ``2``) to string (``'rb'`` or ``'wb'``). The " -"value of the :attr:`!mode` attribute of the readable file-like object " -"returned by :meth:`zipfile.ZipFile.open` was changed from ``'r'`` to " -"``'rb'``. (Contributed by Serhiy Storchaka in :gh:`115961`.)" +":c:func:`!PyObject_CheckReadBuffer`: Use :c:func:`PyObject_CheckBuffer` to " +"test whether the object supports the buffer protocol. Note that :c:func:" +"`PyObject_CheckBuffer` doesn't guarantee that :c:func:`PyObject_GetBuffer` " +"will succeed. To test if the object is actually readable, see the next " +"example of :c:func:`PyObject_GetBuffer`." msgstr "" -#: ../../whatsnew/3.13.rst:2258 +#: ../../whatsnew/3.13.rst:2327 msgid "" -":class:`functools.partial` now emits a :exc:`FutureWarning` when it is used " -"as a method. Its behavior will be changed in future Python versions. Wrap it " -"in :func:`staticmethod` if you want to preserve the old behavior. " -"(Contributed by Serhiy Storchaka in :gh:`121027`.)" +":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: Use :c:" +"func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" msgstr "" -#: ../../whatsnew/3.13.rst:2266 +#: ../../whatsnew/3.13.rst:2330 msgid "" -"Calling :func:`locals` in an :term:`optimized scope` now produces an " -"independent snapshot on each call, and hence no longer implicitly updates " -"previously returned references. Obtaining the legacy CPython behaviour now " -"requires explicit calls to update the initially returned dictionary with the " -"results of subsequent calls to :func:`!locals`. Code execution functions " -"that implicitly target :func:`!locals` (such as ``exec`` and ``eval``) must " -"be passed an explicit namespace to access their results in an optimized " -"scope. (Changed as part of :pep:`667`.)" +"Py_buffer view;\n" +"if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) < 0) {\n" +" return NULL;\n" +"}\n" +"// Use `view.buf` and `view.len` to read from the buffer.\n" +"// You may need to cast buf as `(const char*)view.buf`.\n" +"PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2275 +#: ../../whatsnew/3.13.rst:2340 msgid "" -"Calling :func:`locals` from a comprehension at module or class scope " -"(including via ``exec`` or ``eval``) once more behaves as if the " -"comprehension were running as an independent nested function (i.e. the local " -"variables from the containing scope are not included). In Python 3.12, this " -"had changed to include the local variables from the containing scope when " -"implementing :pep:`709`. (Changed as part of :pep:`667`.)" +":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` and :c:" +"func:`PyBuffer_Release` instead:" msgstr "" -#: ../../whatsnew/3.13.rst:2282 +#: ../../whatsnew/3.13.rst:2343 msgid "" -"Accessing :attr:`FrameType.f_locals ` in an :term:`optimized " -"scope` now returns a write-through proxy rather than a snapshot that gets " -"updated at ill-specified times. If a snapshot is desired, it must be created " -"explicitly with ``dict`` or the proxy's ``.copy()`` method. (Changed as part " -"of :pep:`667`.)" +"Py_buffer view;\n" +"if (PyObject_GetBuffer(obj, &view, PyBUF_WRITABLE) < 0) {\n" +" return NULL;\n" +"}\n" +"// Use `view.buf` and `view.len` to write to the buffer.\n" +"PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2289 -msgid "Changes in the C API" +#: ../../whatsnew/3.13.rst:2352 +msgid "(Contributed by Inada Naoki in :gh:`85275`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2291 -msgid "" -"``Python.h`` no longer includes the ```` standard header. It was " -"included for the ``finite()`` function which is now provided by the ```` header. It should now be included explicitly if needed. Remove also the " -"``HAVE_IEEEFP_H`` macro. (Contributed by Victor Stinner in :gh:`108765`.)" +#: ../../whatsnew/3.13.rst:2354 +msgid "Remove various functions deprecated in Python 3.9:" msgstr "" -#: ../../whatsnew/3.13.rst:2297 +#: ../../whatsnew/3.13.rst:2356 msgid "" -"``Python.h`` no longer includes these standard header files: ````, " -"```` and ````. If needed, they should now be " -"included explicitly. For example, ```` provides the ``clock()`` and " -"``gmtime()`` functions, ```` provides the ``select()`` " -"function, and ```` provides the ``futimes()``, " -"``gettimeofday()`` and ``setitimer()`` functions. (Contributed by Victor " -"Stinner in :gh:`108765`.)" +":c:func:`!PyEval_CallObject`, :c:func:`!PyEval_CallObjectWithKeywords`: Use :" +"c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2305 +#: ../../whatsnew/3.13.rst:2361 msgid "" -"On Windows, ``Python.h`` no longer includes the ```` standard " -"header file. If needed, it should now be included explicitly. For example, " -"it provides ``offsetof()`` function, and ``size_t`` and ``ptrdiff_t`` types. " -"Including ```` explicitly was already needed by all other " -"platforms, the ``HAVE_STDDEF_H`` macro is only defined on Windows. " -"(Contributed by Victor Stinner in :gh:`108765`.)" +"In :c:func:`PyObject_Call`, positional arguments must be a :class:`tuple` " +"and must not be ``NULL``, and keyword arguments must be a :class:`dict` or " +"``NULL``, whereas the removed functions checked argument types and accepted " +"``NULL`` positional and keyword arguments. To replace " +"``PyEval_CallObjectWithKeywords(func, NULL, kwargs)`` with :c:func:" +"`PyObject_Call`, pass an empty tuple as positional arguments using :c:func:" +"`PyTuple_New(0) `." msgstr "" -#: ../../whatsnew/3.13.rst:2312 +#: ../../whatsnew/3.13.rst:2371 msgid "" -"If the :c:macro:`Py_LIMITED_API` macro is defined, :c:macro:`!" -"Py_BUILD_CORE`, :c:macro:`!Py_BUILD_CORE_BUILTIN` and :c:macro:`!" -"Py_BUILD_CORE_MODULE` macros are now undefined by ````. " -"(Contributed by Victor Stinner in :gh:`85283`.)" +":c:func:`!PyEval_CallFunction`: Use :c:func:`PyObject_CallFunction` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2317 +#: ../../whatsnew/3.13.rst:2373 msgid "" -"The old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " -"``Py_TRASHCAN_SAFE_END`` were removed. They should be replaced by the new " -"macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``." +":c:func:`!PyEval_CallMethod`: Use :c:func:`PyObject_CallMethod` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2321 -msgid "A ``tp_dealloc`` function that has the old macros, such as::" +#: ../../whatsnew/3.13.rst:2375 +msgid ":c:func:`!PyCFunction_Call`: Use :c:func:`PyObject_Call` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2323 -msgid "" -"static void\n" -"mytype_dealloc(mytype *p)\n" -"{\n" -" PyObject_GC_UnTrack(p);\n" -" Py_TRASHCAN_SAFE_BEGIN(p);\n" -" ...\n" -" Py_TRASHCAN_SAFE_END\n" -"}" -msgstr "" - -#: ../../whatsnew/3.13.rst:2332 -msgid "should migrate to the new macros as follows::" -msgstr "" - -#: ../../whatsnew/3.13.rst:2334 -msgid "" -"static void\n" -"mytype_dealloc(mytype *p)\n" -"{\n" -" PyObject_GC_UnTrack(p);\n" -" Py_TRASHCAN_BEGIN(p, mytype_dealloc)\n" -" ...\n" -" Py_TRASHCAN_END\n" -"}" +#: ../../whatsnew/3.13.rst:2378 +msgid "(Contributed by Victor Stinner in :gh:`105107`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2343 +#: ../../whatsnew/3.13.rst:2380 msgid "" -"Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " -"deallocation function it is in. The new macros were added in Python 3.8 and " -"the old macros were deprecated in Python 3.11. (Contributed by Irit Katriel " -"in :gh:`105111`.)" +"Remove the following old functions to configure the Python initialization, " +"deprecated in Python 3.11:" msgstr "" -#: ../../whatsnew/3.13.rst:2348 +#: ../../whatsnew/3.13.rst:2383 msgid "" -"Functions :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:" -"`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:" -"`PyObject_HasAttr`, :c:func:`PyObject_HasAttrString`, and :c:func:" -"`PySys_GetObject`, which clear all errors which occurred when calling them, " -"now report them using :func:`sys.unraisablehook`. You may replace them with " -"other functions as recommended in the documentation. (Contributed by Serhiy " -"Storchaka in :gh:`106672`.)" +":c:func:`!PySys_AddWarnOptionUnicode`: Use :c:member:`PyConfig.warnoptions` " +"instead." msgstr "" -#: ../../whatsnew/3.13.rst:2357 +#: ../../whatsnew/3.13.rst:2385 msgid "" -":c:func:`!PyCode_GetFirstFree` is an unstable API now and has been renamed " -"to :c:func:`PyUnstable_Code_GetFirstFree`. (Contributed by Bogdan Romanyuk " -"in :gh:`115781`.)" +":c:func:`!PySys_AddWarnOption`: Use :c:member:`PyConfig.warnoptions` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2363 -msgid "" -"The effects of mutating the dictionary returned from :c:func:" -"`PyEval_GetLocals` in an :term:`optimized scope` have changed. New dict " -"entries added this way will now *only* be visible to subsequent :c:func:" -"`PyEval_GetLocals` calls in that frame, as :c:func:`PyFrame_GetLocals`, :" -"func:`locals`, and :attr:`FrameType.f_locals ` no longer " -"access the same underlying cached dictionary. Changes made to entries for " -"actual variable names and names added via the write-through proxy interfaces " -"will be overwritten on subsequent calls to :c:func:`PyEval_GetLocals` in " -"that frame. The recommended code update depends on how the function was " -"being used, so refer to the deprecation notice on the function for details. " -"(Changed as part of :pep:`667`.)" +#: ../../whatsnew/3.13.rst:2387 +msgid ":c:func:`!PySys_AddXOption`: Use :c:member:`PyConfig.xoptions` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2374 +#: ../../whatsnew/3.13.rst:2389 msgid "" -"Calling :c:func:`PyFrame_GetLocals` in an :term:`optimized scope` now " -"returns a write-through proxy rather than a snapshot that gets updated at " -"ill-specified times. If a snapshot is desired, it must be created explicitly " -"(e.g. with :c:func:`PyDict_Copy`) or by calling the new :c:func:" -"`PyEval_GetFrameLocals` API. (Changed as part of :pep:`667`.)" +":c:func:`!PySys_HasWarnOptions`: Use :c:member:`PyConfig.xoptions` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2379 +#: ../../whatsnew/3.13.rst:2391 msgid "" -":c:func:`!PyFrame_FastToLocals` and :c:func:`!PyFrame_FastToLocalsWithError` " -"no longer have any effect. Calling these functions has been redundant since " -"Python 3.11, when :c:func:`PyFrame_GetLocals` was first introduced. (Changed " -"as part of :pep:`667`.)" +":c:func:`!PySys_SetPath`: Set :c:member:`PyConfig.module_search_paths` " +"instead." msgstr "" -#: ../../whatsnew/3.13.rst:2384 +#: ../../whatsnew/3.13.rst:2393 msgid "" -":c:func:`!PyFrame_LocalsToFast` no longer has any effect. Calling this " -"function is redundant now that :c:func:`PyFrame_GetLocals` returns a write-" -"through proxy for :term:`optimized scopes `. (Changed as " -"part of :pep:`667`.)" +":c:func:`!Py_SetPath`: Set :c:member:`PyConfig.module_search_paths` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2389 -msgid "Removed C APIs" -msgstr "" - -#: ../../whatsnew/3.13.rst:2391 +#: ../../whatsnew/3.13.rst:2395 msgid "" -"Remove many APIs (functions, macros, variables) with names prefixed by " -"``_Py`` or ``_PY`` (considered as private API). If your project is affected " -"by one of these removals and you consider that the removed API should remain " -"available, please open a new issue to request a public C API and add ``cc " -"@vstinner`` to the issue to notify Victor Stinner. (Contributed by Victor " -"Stinner in :gh:`106320`.)" +":c:func:`!Py_SetStandardStreamEncoding`: Set :c:member:`PyConfig." +"stdio_encoding` instead, and set also maybe :c:member:`PyConfig." +"legacy_windows_stdio` (on Windows)." msgstr "" #: ../../whatsnew/3.13.rst:2398 -msgid "Remove functions deprecated in Python 3.9:" +msgid "" +":c:func:`!_Py_SetProgramFullPath`: Set :c:member:`PyConfig.executable` " +"instead." msgstr "" -#: ../../whatsnew/3.13.rst:2400 +#: ../../whatsnew/3.13.rst:2401 msgid "" -"``PyEval_CallObject()``, ``PyEval_CallObjectWithKeywords()``: use :c:func:" -"`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead. Warning: :c:func:" -"`PyObject_Call` positional arguments must be a :class:`tuple` and must not " -"be ``NULL``, keyword arguments must be a :class:`dict` or ``NULL``, whereas " -"removed functions checked arguments type and accepted ``NULL`` positional " -"and keyword arguments. To replace ``PyEval_CallObjectWithKeywords(func, " -"NULL, kwargs)`` with :c:func:`PyObject_Call`, pass an empty tuple as " -"positional arguments using :c:func:`PyTuple_New(0) `." +"Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " +"Configuration ` instead (:pep:`587`), added to Python 3.8. " +"(Contributed by Victor Stinner in :gh:`105145`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2409 -msgid "``PyEval_CallFunction()``: use :c:func:`PyObject_CallFunction` instead." +#: ../../whatsnew/3.13.rst:2405 +msgid "" +"Remove :c:func:`!PyEval_AcquireLock` and :c:func:`!PyEval_ReleaseLock` " +"functions, deprecated in Python 3.2. They didn't update the current thread " +"state. They can be replaced with:" msgstr "" #: ../../whatsnew/3.13.rst:2410 -msgid "``PyEval_CallMethod()``: use :c:func:`PyObject_CallMethod` instead." -msgstr "" +msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`;" +msgstr ":c:func:`PyEval_SaveThread` 和 :c:func:`PyEval_RestoreThread`;" #: ../../whatsnew/3.13.rst:2411 -msgid "``PyCFunction_Call()``: use :c:func:`PyObject_Call` instead." +msgid "" +"low-level :c:func:`PyEval_AcquireThread` and :c:func:`PyEval_RestoreThread`;" msgstr "" -#: ../../whatsnew/3.13.rst:2413 -msgid "(Contributed by Victor Stinner in :gh:`105107`.)" +#: ../../whatsnew/3.13.rst:2412 +msgid "or :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`." msgstr "" -#: ../../whatsnew/3.13.rst:2415 +#: ../../whatsnew/3.13.rst:2414 +msgid "(Contributed by Victor Stinner in :gh:`105182`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2416 msgid "" -"Remove old buffer protocols deprecated in Python 3.0. Use :ref:" -"`bufferobjects` instead." +"Remove the :c:func:`!PyEval_ThreadsInitialized` function, deprecated in " +"Python 3.9. Since Python 3.7, :c:func:`!Py_Initialize` always creates the " +"GIL: calling :c:func:`!PyEval_InitThreads` does nothing and :c:func:`!" +"PyEval_ThreadsInitialized` always returns non-zero. (Contributed by Victor " +"Stinner in :gh:`105182`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2417 +#: ../../whatsnew/3.13.rst:2423 msgid "" -":c:func:`!PyObject_CheckReadBuffer`: Use :c:func:`PyObject_CheckBuffer` to " -"test if the object supports the buffer protocol. Note that :c:func:" -"`PyObject_CheckBuffer` doesn't guarantee that :c:func:`PyObject_GetBuffer` " -"will succeed. To test if the object is actually readable, see the next " -"example of :c:func:`PyObject_GetBuffer`." +"Remove the :c:func:`!_PyInterpreterState_Get` alias to :c:func:" +"`PyInterpreterState_Get()` which was kept for backward compatibility with " +"Python 3.8. The `pythoncapi-compat project`_ can be used to get :c:func:" +"`PyInterpreterState_Get()` on Python 3.8 and older. (Contributed by Victor " +"Stinner in :gh:`106320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2424 +#: ../../whatsnew/3.13.rst:2430 msgid "" -":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: :c:func:" -"`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" +"Remove the private :c:func:`!_PyObject_FastCall` function: use :c:func:`!" +"PyObject_Vectorcall` which is available since Python 3.8 (:pep:`590`). " +"(Contributed by Victor Stinner in :gh:`106023`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2427 +#: ../../whatsnew/3.13.rst:2435 msgid "" -"Py_buffer view;\n" -"if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) < 0) {\n" -" return NULL;\n" -"}\n" -"// Use `view.buf` and `view.len` to read from the buffer.\n" -"// You may need to cast buf as `(const char*)view.buf`.\n" -"PyBuffer_Release(&view);" +"Remove the ``cpython/pytime.h`` header file, which only contained private " +"functions. (Contributed by Victor Stinner in :gh:`106316`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2437 +#: ../../whatsnew/3.13.rst:2439 msgid "" -":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` and :c:" -"func:`PyBuffer_Release` instead:" +"Remove the undocumented ``PY_TIMEOUT_MAX`` constant from the limited C API. " +"(Contributed by Victor Stinner in :gh:`110014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2440 +#: ../../whatsnew/3.13.rst:2442 msgid "" -"Py_buffer view;\n" -"if (PyObject_GetBuffer(obj, &view, PyBUF_WRITABLE) < 0) {\n" -" return NULL;\n" -"}\n" -"// Use `view.buf` and `view.len` to write to the buffer.\n" -"PyBuffer_Release(&view);" +"Remove the old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " +"``Py_TRASHCAN_SAFE_END``. Replace both with the new macros " +"``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``. (Contributed by Irit Katriel " +"in :gh:`105111`.)" msgstr "" #: ../../whatsnew/3.13.rst:2449 -msgid "(Contributed by Inada Naoki in :gh:`85275`.)" -msgstr "" +msgid "Deprecated C APIs" +msgstr "器用的 C API" #: ../../whatsnew/3.13.rst:2451 -msgid "" -"Remove the following old functions to configure the Python initialization, " -"deprecated in Python 3.11:" +msgid "Deprecate old Python initialization functions:" msgstr "" -#: ../../whatsnew/3.13.rst:2454 +#: ../../whatsnew/3.13.rst:2453 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 msgid "" -"``PySys_AddWarnOptionUnicode()``: use :c:member:`PyConfig.warnoptions` " -"instead." +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" +"warnings.filters` instead." msgstr "" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" +"data:`!warnings.filters`。" #: ../../whatsnew/3.13.rst:2455 -msgid "" -"``PySys_AddWarnOption()``: use :c:member:`PyConfig.warnoptions` instead." -msgstr "" - -#: ../../whatsnew/3.13.rst:2456 -msgid "``PySys_AddXOption()``: use :c:member:`PyConfig.xoptions` instead." -msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 +msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." +msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" #: ../../whatsnew/3.13.rst:2457 -msgid "``PySys_HasWarnOptions()``: use :c:member:`PyConfig.xoptions` instead." -msgstr "" - -#: ../../whatsnew/3.13.rst:2458 -msgid "" -"``PySys_SetPath()``: set :c:member:`PyConfig.module_search_paths` instead." -msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." +msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" #: ../../whatsnew/3.13.rst:2459 -msgid "``Py_SetPath()``: set :c:member:`PyConfig.module_search_paths` instead." -msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." +msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" -#: ../../whatsnew/3.13.rst:2460 -msgid "" -"``Py_SetStandardStreamEncoding()``: set :c:member:`PyConfig.stdio_encoding` " -"instead, and set also maybe :c:member:`PyConfig.legacy_windows_stdio` (on " -"Windows)." -msgstr "" +#: ../../whatsnew/3.13.rst:2461 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 +msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." +msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" #: ../../whatsnew/3.13.rst:2463 -msgid "" -"``_Py_SetProgramFullPath()``: set :c:member:`PyConfig.executable` instead." -msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:23 +msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." +msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" #: ../../whatsnew/3.13.rst:2465 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -"Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " -"Configuration ` instead (:pep:`587`), added to Python 3.8. " -"(Contributed by Victor Stinner in :gh:`105145`.)" +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" +"`PYTHONHOME` environment variable instead." msgstr "" +":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" +"`PYTHONHOME` 環境變數。" #: ../../whatsnew/3.13.rst:2469 -msgid "" -"Remove ``PyEval_ThreadsInitialized()`` function, deprecated in Python 3.9. " -"Since Python 3.7, ``Py_Initialize()`` always creates the GIL: calling " -"``PyEval_InitThreads()`` does nothing and ``PyEval_ThreadsInitialized()`` " -"always returned non-zero. (Contributed by Victor Stinner in :gh:`105182`.)" +msgid "(Contributed by Victor Stinner in :gh:`105145`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2475 +#: ../../whatsnew/3.13.rst:2471 msgid "" -"Remove ``PyEval_AcquireLock()`` and ``PyEval_ReleaseLock()`` functions, " -"deprecated in Python 3.2. They didn't update the current thread state. They " -"can be replaced with:" -msgstr "" - -#: ../../whatsnew/3.13.rst:2479 -msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`;" +":term:`Soft deprecate ` the :c:func:`PyEval_GetBuiltins`, :" +"c:func:`PyEval_GetGlobals`, and :c:func:`PyEval_GetLocals` functions, which " +"return a :term:`borrowed reference`. (Soft deprecated as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2480 +#: ../../whatsnew/3.13.rst:2477 msgid "" -"low-level :c:func:`PyEval_AcquireThread` and :c:func:`PyEval_RestoreThread`;" +"Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function, which is just " +"an alias to :c:func:`PyImport_ImportModule` since Python 3.3. (Contributed " +"by Victor Stinner in :gh:`105396`.)" msgstr "" #: ../../whatsnew/3.13.rst:2481 -msgid "or :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`." +msgid "" +":term:`Soft deprecate ` the :c:func:`PyModule_AddObject` " +"function. It should be replaced with :c:func:`PyModule_Add` or :c:func:" +"`PyModule_AddObjectRef`. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2483 -msgid "(Contributed by Victor Stinner in :gh:`105182`.)" +#: ../../whatsnew/3.13.rst:2487 +msgid "" +"Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types and the :c:" +"macro:`!Py_UNICODE_WIDE` define. Use the :c:type:`wchar_t` type directly " +"instead. Since Python 3.3, ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` are just " +"aliases to :c:type:`!wchar_t`. (Contributed by Victor Stinner in :gh:" +"`105156`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2485 +#: ../../whatsnew/3.13.rst:2494 msgid "" -"Remove private ``_PyObject_FastCall()`` function: use " -"``PyObject_Vectorcall()`` which is available since Python 3.8 (:pep:`590`). " -"(Contributed by Victor Stinner in :gh:`106023`.)" +"Deprecate the :c:func:`PyWeakref_GetObject` and :c:func:" +"`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed reference`. " +"Replace them with the new :c:func:`PyWeakref_GetRef` function, which returns " +"a :term:`strong reference`. The `pythoncapi-compat project`_ can be used to " +"get :c:func:`PyWeakref_GetRef` on Python 3.12 and older. (Contributed by " +"Victor Stinner in :gh:`105927`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2490 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 msgid "" -"Remove ``cpython/pytime.h`` header file: it only contained private " -"functions. (Contributed by Victor Stinner in :gh:`106316`.)" +"The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " +"(:pep:`699`; :gh:`101193`)." msgstr "" +":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 (:pep:" +"`699`;:gh:`101193`)。" -#: ../../whatsnew/3.13.rst:2493 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 msgid "" -"Remove ``_PyInterpreterState_Get()`` alias to :c:func:" -"`PyInterpreterState_Get()` which was kept for backward compatibility with " -"Python 3.8. The `pythoncapi-compat project `__ can be used to get :c:func:`PyInterpreterState_Get()` " -"on Python 3.8 and older. (Contributed by Victor Stinner in :gh:`106320`.)" +"Creating :c:data:`immutable types ` with mutable " +"bases (:gh:`95388`)." msgstr "" +"使用可變基底建立\\ :c:data:`不可變型別 ` (:gh:" +"`95388`)。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:10 +msgid "" +"Functions to configure Python's initialization, deprecated in Python 3.11:" +msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" -#: ../../whatsnew/3.13.rst:2500 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:12 +msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`!PySys_SetArgvEx()`:請改以 :c:member:`PyConfig.argv` 設定。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:14 +msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`!PySys_SetArgv()`:請改以 :c:member:`PyConfig.argv` 設定。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:16 msgid "" -"The :c:func:`PyModule_AddObject` function is now :term:`soft deprecated`: :c:" -"func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions should be " -"used instead. (Contributed by Serhiy Storchaka in :gh:`86493`.)" +":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +"instead." msgstr "" +":c:func:`!Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設" +"定。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:18 +msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." +msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設定。" -#: ../../whatsnew/3.13.rst:2505 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" -"Remove undocumented ``PY_TIMEOUT_MAX`` constant from the limited C API. " -"(Contributed by Victor Stinner in :gh:`110014`.)" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead." msgstr "" +":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" -#: ../../whatsnew/3.13.rst:2509 -msgid "Deprecated C APIs" +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 +msgid "Global configuration variables:" +msgstr "全域設定變數:" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 +msgid ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` instead." +msgstr ":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 +msgid ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` instead." +msgstr ":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 +msgid ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` instead." +msgstr ":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 +msgid "" +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` instead." +msgstr ":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 +msgid ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` instead." +msgstr ":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:36 +msgid "" +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " +"instead." msgstr "" +":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 +msgid ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` instead." +msgstr ":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import`。" -#: ../../whatsnew/3.13.rst:2511 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 msgid "" -"Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types: use directly " -"the :c:type:`wchar_t` type instead. Since Python 3.3, ``Py_UNICODE`` and " -"``PY_UNICODE_TYPE`` are just aliases to :c:type:`wchar_t`. (Contributed by " -"Victor Stinner in :gh:`105156`.)" +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` instead." msgstr "" +":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning`。" -#: ../../whatsnew/3.13.rst:2516 -msgid "Deprecate old Python initialization functions:" +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 +msgid "" +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` instead." msgstr "" +":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings`。" -#: ../../whatsnew/3.13.rst:2518 -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:44 msgid "" -":c:func:`PySys_ResetWarnOptions`: clear :data:`sys.warnoptions` and :data:`!" -"warnings.filters` instead." +":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " +"instead." msgstr "" +":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." +"use_environment`。" -#: ../../whatsnew/3.13.rst:2520 -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:14 -msgid ":c:func:`Py_GetExecPrefix`: get :data:`sys.exec_prefix` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 +msgid "" +":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " +"instead." msgstr "" +":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." +"write_bytecode`。" -#: ../../whatsnew/3.13.rst:2521 -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 -msgid ":c:func:`Py_GetPath`: get :data:`sys.path` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 +msgid "" +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." +"user_site_directory` instead." msgstr "" +":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." +"user_site_directory`。" -#: ../../whatsnew/3.13.rst:2522 -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:16 -msgid ":c:func:`Py_GetPrefix`: get :data:`sys.prefix` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 +msgid "" +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " +"instead." msgstr "" +":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio`。" -#: ../../whatsnew/3.13.rst:2523 -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 -msgid ":c:func:`Py_GetProgramFullPath`: get :data:`sys.executable` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:52 +msgid "" +":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " +"and :c:member:`PyConfig.hash_seed` instead." msgstr "" +":c:var:`Py_HashRandomizationFlag`:請改用 :c:member:`PyConfig.use_hash_seed` " +"和 :c:member:`PyConfig.hash_seed`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:55 +msgid ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` instead." +msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" -#: ../../whatsnew/3.13.rst:2524 -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:18 -msgid ":c:func:`Py_GetProgramName`: get :data:`sys.executable` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 +msgid "" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` instead." msgstr "" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`。" -#: ../../whatsnew/3.13.rst:2525 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:func:`Py_GetPythonHome`: get :c:member:`PyConfig.home` or :envvar:" -"`PYTHONHOME` environment variable instead." +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." +"legacy_windows_stdio` instead." msgstr "" +":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." +"legacy_windows_stdio`。" -#: ../../whatsnew/3.13.rst:2528 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -"Functions scheduled for removal in Python 3.15. (Contributed by Victor " -"Stinner in :gh:`105145`.)" +":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` instead." msgstr "" +":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding`。" -#: ../../whatsnew/3.13.rst:2531 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -"Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function which is just " -"an alias to :c:func:`PyImport_ImportModule` since Python 3.3. Scheduled for " -"removal in Python 3.15. (Contributed by Victor Stinner in :gh:`105396`.)" +":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` instead." msgstr "" +":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding`。" -#: ../../whatsnew/3.13.rst:2536 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -"Deprecate the :c:func:`PyWeakref_GetObject` and :c:func:" -"`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed reference`: " -"use the new :c:func:`PyWeakref_GetRef` function instead, it returns a :term:" -"`strong reference`. The `pythoncapi-compat project `__ can be used to get :c:func:`PyWeakref_GetRef` " -"on Python 3.12 and older. (Contributed by Victor Stinner in :gh:`105927`.)" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." +"filesystem_errors` instead." msgstr "" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." +"filesystem_errors`。" -#: ../../whatsnew/3.13.rst:2544 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -"Deprecate the :c:func:`PyEval_GetBuiltins`, :c:func:`PyEval_GetGlobals`, " -"and :c:func:`PyEval_GetLocals` functions, which return a :term:`borrowed " -"reference`. Refer to the deprecation notices on each function for their " -"recommended replacements. (Soft deprecated as part of :pep:`667`.)" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" +"c:func:`Py_PreInitialize`)" msgstr "" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" +"func:`Py_PreInitialize`)" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 +msgid "The bundled copy of ``libmpdecimal``." +msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -"The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " -"(:pep:`699`; :gh:`101193`)." +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." msgstr "" +":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" +"`PyImport_ImportModule`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 msgid "" -"Creating :c:data:`immutable types ` with mutable " -"bases (:gh:`95388`)." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead." msgstr "" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:10 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 msgid "" -"Functions to configure Python's initialization, deprecated in Python 3.11:" +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." msgstr "" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:12 -msgid "``PySys_SetArgvEx()``: set :c:member:`PyConfig.argv` instead." -msgstr "" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 +msgid "Python initialization functions:" +msgstr "Python 初始化函式:" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:13 -msgid "``PySys_SetArgv()``: set :c:member:`PyConfig.argv` instead." -msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:4 +msgid "" +"The following APIs are deprecated and will be removed, although there is " +"currently no date scheduled for their removal." +msgstr "下列 API 已被棄用並將會被移除,不過目前尚未訂定移除日期。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:14 -msgid "``Py_SetProgramName()``: set :c:member:`PyConfig.program_name` instead." -msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:7 +msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8." +msgstr ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`:自 Python 3.8 起不再需要" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:15 -msgid "``Py_SetPythonHome()``: set :c:member:`PyConfig.home` instead." -msgstr "" +#: ../../deprecations/c-api-pending-removal-in-future.rst:9 +msgid ":c:func:`PyErr_Fetch`: Use :c:func:`PyErr_GetRaisedException` instead." +msgstr ":c:func:`PyErr_Fetch`:請改用 :c:func:`PyErr_GetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:17 -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:45 +#: ../../deprecations/c-api-pending-removal-in-future.rst:11 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" -"`PyConfig` instead." +":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " +"instead." msgstr "" +":c:func:`PyErr_NormalizeException`:請改用 :c:func:" +"`PyErr_GetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:20 -msgid "Global configuration variables:" +#: ../../deprecations/c-api-pending-removal-in-future.rst:13 +msgid "" +":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." +msgstr ":c:func:`PyErr_Restore`:請改用 :c:func:`PyErr_SetRaisedException`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:15 +msgid "" +":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` " +"instead." msgstr "" +":c:func:`PyModule_GetFilename`:請改用 :c:func:`PyModule_GetFilenameObject`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:17 +msgid ":c:func:`PyOS_AfterFork`: Use :c:func:`PyOS_AfterFork_Child` instead." +msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:22 -msgid ":c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:19 +msgid "" +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." msgstr "" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" +"`PySlice_AdjustIndices`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:23 -msgid ":c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:21 +msgid "" +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." msgstr "" +":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 -msgid ":c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:23 +msgid "" +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead." msgstr "" +":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:25 +#: ../../deprecations/c-api-pending-removal-in-future.rst:25 msgid "" -":c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive` instead." +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." msgstr "" +":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 -msgid ":c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:27 +msgid "" +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead." msgstr "" +":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:29 +msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" +msgstr ":c:func:`PyUnicode_READY`:自 Python 3.12 起不再需要" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:31 +msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." +msgstr ":c:func:`!PyErr_Display`:請改用 :c:func:`PyErr_DisplayException`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:27 +#: ../../deprecations/c-api-pending-removal-in-future.rst:33 msgid "" -":c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level` " +":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " "instead." msgstr "" +":c:func:`!_PyErr_ChainExceptions`:請改用 ``_PyErr_ChainExceptions1``。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 -msgid ":c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:35 +msgid "" +":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " +"instead." msgstr "" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" +"`PyObject_Hash`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:37 +msgid ":c:member:`!PyDictObject.ma_version_tag` member." +msgstr ":c:member:`!PyDictObject.ma_version_tag` 成員。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:38 +msgid "Thread Local Storage (TLS) API:" +msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:29 +#: ../../deprecations/c-api-pending-removal-in-future.rst:40 msgid "" -":c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning` instead." -msgstr "" +":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." +msgstr ":c:func:`PyThread_create_key`:請改用 :c:func:`PyThread_tss_alloc`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 +#: ../../deprecations/c-api-pending-removal-in-future.rst:42 +msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." +msgstr ":c:func:`PyThread_delete_key`:請改用 :c:func:`PyThread_tss_free`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:44 msgid "" -":c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings` instead." -msgstr "" +":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." +msgstr ":c:func:`PyThread_set_key_value`:請改用 :c:func:`PyThread_tss_set`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:31 +#: ../../deprecations/c-api-pending-removal-in-future.rst:46 msgid "" -":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment` " -"instead." -msgstr "" +":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." +msgstr ":c:func:`PyThread_get_key_value`:請改用 :c:func:`PyThread_tss_get`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 +#: ../../deprecations/c-api-pending-removal-in-future.rst:48 msgid "" -":c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode` " +":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " "instead." msgstr "" +":c:func:`PyThread_delete_key_value`:請改用 :c:func:`PyThread_tss_delete`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:50 +msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." +msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:33 +#: ../../whatsnew/3.13.rst:2514 +msgid "Build Changes" +msgstr "建置變更" + +#: ../../whatsnew/3.13.rst:2516 msgid "" -":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig." -"user_site_directory` instead." +"``arm64-apple-ios`` and ``arm64-apple-ios-simulator`` are both now :pep:`11` " +"tier 3 platforms. (:ref:`PEP 730 ` written and " +"implementation contributed by Russell Keith-Magee in :gh:`114099`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 +#: ../../whatsnew/3.13.rst:2521 msgid "" -":c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio` " -"instead." +"``aarch64-linux-android`` and ``x86_64-linux-android`` are both now :pep:" +"`11` tier 3 platforms. (:ref:`PEP 738 ` " +"written and implementation contributed by Malcolm Smith in :gh:`116622`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:35 +#: ../../whatsnew/3.13.rst:2526 msgid "" -":c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` " -"and :c:member:`PyConfig.hash_seed` instead." +"``wasm32-wasi`` is now a :pep:`11` tier 2 platform. (Contributed by Brett " +"Cannon in :gh:`115192`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:37 -msgid ":c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated` instead." +#: ../../whatsnew/3.13.rst:2529 +msgid "" +"``wasm32-emscripten`` is no longer a :pep:`11` supported platform. " +"(Contributed by Brett Cannon in :gh:`115192`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 +#: ../../whatsnew/3.13.rst:2532 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." -"legacy_windows_fs_encoding` instead." +"Building CPython now requires a compiler with support for the C11 atomic " +"library, GCC built-in atomic functions, or MSVC interlocked intrinsics." msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:39 +#: ../../whatsnew/3.13.rst:2535 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." -"legacy_windows_stdio` instead." +"Autoconf 2.71 and aclocal 1.16.4 are now required to regenerate the :file:" +"`configure` script. (Contributed by Christian Heimes in :gh:`89886`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 +#: ../../whatsnew/3.13.rst:2539 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." -"filesystem_encoding` instead." +"SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension " +"module. (Contributed by Erlend Aasland in :gh:`105875`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:41 +#: ../../whatsnew/3.13.rst:2543 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." -"filesystem_encoding` instead." +"CPython now bundles the `mimalloc library`_ by default. It is licensed under " +"the MIT license; see :ref:`mimalloc license `. The bundled " +"mimalloc has custom changes, see :gh:`113141` for details. (Contributed by " +"Dino Viehland in :gh:`109914`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 +#: ../../whatsnew/3.13.rst:2551 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." -"filesystem_errors` instead." +"The :file:`configure` option :option:`--with-system-libmpdec` now defaults " +"to ``yes``. The bundled copy of ``libmpdecimal`` will be removed in Python " +"3.15." msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:43 +#: ../../whatsnew/3.13.rst:2555 msgid "" -":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` instead. (see :" -"c:func:`Py_PreInitialize`)" +"Python built with :file:`configure` :option:`--with-trace-refs` (tracing " +"references) is now ABI compatible with the Python release build and :ref:" +"`debug build `. (Contributed by Victor Stinner in :gh:`108634`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 -msgid "The bundled copy of ``libmpdecimal``." +#: ../../whatsnew/3.13.rst:2560 +msgid "" +"On POSIX systems, the pkg-config (``.pc``) filenames now include the ABI " +"flags. For example, the free-threaded build generates ``python-3.13t.pc`` " +"and the debug build generates ``python-3.13d.pc``." msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 +#: ../../whatsnew/3.13.rst:2564 msgid "" -":c:func:`PyImport_ImportModuleNoBlock`: use :c:func:`PyImport_ImportModule` " -"instead." +"The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``, " +"``termios``, ``winsound``, ``_ctypes_test``, ``_multiprocessing." +"posixshmem``, ``_scproxy``, ``_stat``, ``_statistics``, ``_testconsole``, " +"``_testimportmultiple`` and ``_uuid`` C extensions are now built with the :" +"ref:`limited C API `. (Contributed by Victor Stinner in :gh:" +"`85283`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 -msgid ":c:func:`PyWeakref_GET_OBJECT`: use :c:func:`PyWeakref_GetRef` instead." +#: ../../whatsnew/3.13.rst:2573 +msgid "Porting to Python 3.13" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 -msgid ":c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef` instead." +#: ../../whatsnew/3.13.rst:2575 +msgid "" +"This section lists previously described changes and other bugfixes that may " +"require changes to your code." msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:8 -msgid ":c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead." -msgstr "" +#: ../../whatsnew/3.13.rst:2579 +msgid "Changes in the Python API" +msgstr "Python API 的變更" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 -msgid ":c:type:`Py_UNICODE` type: use :c:type:`wchar_t` instead." +#: ../../whatsnew/3.13.rst:2583 +msgid "" +":ref:`PEP 667 ` introduces several changes to " +"the semantics of :func:`locals` and :attr:`f_locals `:" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 -msgid "Python initialization functions:" +#: ../../whatsnew/3.13.rst:2586 +msgid "" +"Calling :func:`locals` in an :term:`optimized scope` now produces an " +"independent snapshot on each call, and hence no longer implicitly updates " +"previously returned references. Obtaining the legacy CPython behavior now " +"requires explicit calls to update the initially returned dictionary with the " +"results of subsequent calls to :func:`!locals`. Code execution functions " +"that implicitly target :func:`!locals` (such as ``exec`` and ``eval``) must " +"be passed an explicit namespace to access their results in an optimized " +"scope. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +#: ../../whatsnew/3.13.rst:2595 msgid "" -":c:func:`Py_GetPythonHome`: get :c:member:`PyConfig.home` or the :envvar:" -"`PYTHONHOME` environment variable instead." +"Calling :func:`locals` from a comprehension at module or class scope " +"(including via ``exec`` or ``eval``) once more behaves as if the " +"comprehension were running as an independent nested function (i.e. the local " +"variables from the containing scope are not included). In Python 3.12, this " +"had changed to include the local variables from the containing scope when " +"implementing :pep:`709`. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:4 +#: ../../whatsnew/3.13.rst:2602 msgid "" -"The following APIs are deprecated and will be removed, although there is " -"currently no date scheduled for their removal." +"Accessing :attr:`FrameType.f_locals ` in an :term:`optimized " +"scope` now returns a write-through proxy rather than a snapshot that gets " +"updated at ill-specified times. If a snapshot is desired, it must be created " +"explicitly with ``dict`` or the proxy's ``.copy()`` method. (Changed as part " +"of :pep:`667`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:7 -msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: unneeded since Python 3.8." +#: ../../whatsnew/3.13.rst:2608 +msgid "" +":class:`functools.partial` now emits a :exc:`FutureWarning` when used as a " +"method. The behavior will change in future Python versions. Wrap it in :func:" +"`staticmethod` if you want to preserve the old behavior. (Contributed by " +"Serhiy Storchaka in :gh:`121027`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:8 -msgid ":c:func:`PyErr_Fetch`: use :c:func:`PyErr_GetRaisedException` instead." +#: ../../whatsnew/3.13.rst:2614 +msgid "" +"The :ref:`garbage collector is now incremental `, which means that the behavior of :func:`gc.collect` changes slightly:" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:9 +#: ../../whatsnew/3.13.rst:2621 msgid "" -":c:func:`PyErr_NormalizeException`: use :c:func:`PyErr_GetRaisedException` " -"instead." +"An :exc:`OSError` is now raised by :func:`getpass.getuser` for any failure " +"to retrieve a username, instead of :exc:`ImportError` on non-Unix platforms " +"or :exc:`KeyError` on Unix platforms where the password database is empty." msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:10 +#: ../../whatsnew/3.13.rst:2626 msgid "" -":c:func:`PyErr_Restore`: use :c:func:`PyErr_SetRaisedException` instead." +"The value of the :attr:`!mode` attribute of :class:`gzip.GzipFile` is now a " +"string (``'rb'`` or ``'wb'``) instead of an integer (``1`` or ``2``). The " +"value of the :attr:`!mode` attribute of the readable file-like object " +"returned by :meth:`zipfile.ZipFile.open` is now ``'rb'`` instead of ``'r'``. " +"(Contributed by Serhiy Storchaka in :gh:`115961`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:11 +#: ../../whatsnew/3.13.rst:2632 msgid "" -":c:func:`PyModule_GetFilename`: use :c:func:`PyModule_GetFilenameObject` " -"instead." +":class:`mailbox.Maildir` now ignores files with a leading dot (``.``). " +"(Contributed by Zackery Spytz in :gh:`65559`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:12 -msgid ":c:func:`PyOS_AfterFork`: use :c:func:`PyOS_AfterFork_Child` instead." +#: ../../whatsnew/3.13.rst:2635 +msgid "" +":meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` now return both " +"files and directories if a pattern that ends with \"``**``\" is given, " +"rather than directories only. Add a trailing slash to keep the previous " +"behavior and only match directories." msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:13 +#: ../../whatsnew/3.13.rst:2640 msgid "" -":c:func:`PySlice_GetIndicesEx`: use :c:func:`PySlice_Unpack` and :c:func:" -"`PySlice_AdjustIndices` instead." +"The :mod:`threading` module now expects the :mod:`!_thread` module to have " +"an :func:`!_is_main_interpreter` function. This function takes no arguments " +"and returns ``True`` if the current interpreter is the main interpreter." msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:14 +#: ../../whatsnew/3.13.rst:2645 msgid "" -":c:func:`!PyUnicode_AsDecodedObject`: use :c:func:`PyCodec_Decode` instead." +"Any library or application that provides a custom :mod:`!_thread` module " +"must provide :func:`!_is_main_interpreter`, just like the module's other " +"\"private\" attributes. (:gh:`112826`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:15 -msgid "" -":c:func:`!PyUnicode_AsDecodedUnicode`: use :c:func:`PyCodec_Decode` instead." +#: ../../whatsnew/3.13.rst:2652 +msgid "Changes in the C API" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:16 +#: ../../whatsnew/3.13.rst:2654 msgid "" -":c:func:`!PyUnicode_AsEncodedObject`: use :c:func:`PyCodec_Encode` instead." +"``Python.h`` no longer includes the ```` standard header. It was " +"included for the :c:func:`!finite` function which is now provided by the " +"```` header. It should now be included explicitly if needed. Remove " +"also the ``HAVE_IEEEFP_H`` macro. (Contributed by Victor Stinner in :gh:" +"`108765`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:17 +#: ../../whatsnew/3.13.rst:2660 msgid "" -":c:func:`!PyUnicode_AsEncodedUnicode`: use :c:func:`PyCodec_Encode` instead." +"``Python.h`` no longer includes these standard header files: ````, " +"```` and ````. If needed, they should now be " +"included explicitly. For example, ```` provides the :c:func:`!clock` " +"and :c:func:`!gmtime` functions, ```` provides the :c:func:`!" +"select` function, and ```` provides the :c:func:`!futimes`, :c:" +"func:`!gettimeofday` and :c:func:`!setitimer` functions. (Contributed by " +"Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:18 -msgid ":c:func:`PyUnicode_READY`: unneeded since Python 3.12" +#: ../../whatsnew/3.13.rst:2668 +msgid "" +"On Windows, ``Python.h`` no longer includes the ```` standard " +"header file. If needed, it should now be included explicitly. For example, " +"it provides :c:func:`!offsetof` function, and ``size_t`` and ``ptrdiff_t`` " +"types. Including ```` explicitly was already needed by all other " +"platforms, the ``HAVE_STDDEF_H`` macro is only defined on Windows. " +"(Contributed by Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:19 -msgid ":c:func:`!PyErr_Display`: use :c:func:`PyErr_DisplayException` instead." +#: ../../whatsnew/3.13.rst:2675 +msgid "" +"If the :c:macro:`Py_LIMITED_API` macro is defined, :c:macro:`!" +"Py_BUILD_CORE`, :c:macro:`!Py_BUILD_CORE_BUILTIN` and :c:macro:`!" +"Py_BUILD_CORE_MODULE` macros are now undefined by ````. " +"(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:20 +#: ../../whatsnew/3.13.rst:2680 msgid "" -":c:func:`!_PyErr_ChainExceptions`: use ``_PyErr_ChainExceptions1`` instead." +"The old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " +"``Py_TRASHCAN_SAFE_END`` were removed. They should be replaced by the new " +"macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``." msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:21 +#: ../../whatsnew/3.13.rst:2684 +msgid "A ``tp_dealloc`` function that has the old macros, such as::" +msgstr "" + +#: ../../whatsnew/3.13.rst:2686 msgid "" -":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " -"instead." +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_SAFE_BEGIN(p);\n" +" ...\n" +" Py_TRASHCAN_SAFE_END\n" +"}" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:23 -msgid ":c:member:`!PyDictObject.ma_version_tag` member." +#: ../../whatsnew/3.13.rst:2695 +msgid "should migrate to the new macros as follows::" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:24 -msgid "Thread Local Storage (TLS) API:" +#: ../../whatsnew/3.13.rst:2697 +msgid "" +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_BEGIN(p, mytype_dealloc)\n" +" ...\n" +" Py_TRASHCAN_END\n" +"}" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:26 +#: ../../whatsnew/3.13.rst:2706 msgid "" -":c:func:`PyThread_create_key`: use :c:func:`PyThread_tss_alloc` instead." +"Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " +"deallocation function it is in. The new macros were added in Python 3.8 and " +"the old macros were deprecated in Python 3.11. (Contributed by Irit Katriel " +"in :gh:`105111`.)" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:27 -msgid ":c:func:`PyThread_delete_key`: use :c:func:`PyThread_tss_free` instead." +#: ../../whatsnew/3.13.rst:2713 +msgid "" +":ref:`PEP 667 ` introduces several changes to " +"frame-related functions:" msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:28 +#: ../../whatsnew/3.13.rst:2716 msgid "" -":c:func:`PyThread_set_key_value`: use :c:func:`PyThread_tss_set` instead." +"The effects of mutating the dictionary returned from :c:func:" +"`PyEval_GetLocals` in an :term:`optimized scope` have changed. New dict " +"entries added this way will now *only* be visible to subsequent :c:func:" +"`PyEval_GetLocals` calls in that frame, as :c:func:`PyFrame_GetLocals`, :" +"func:`locals`, and :attr:`FrameType.f_locals ` no longer " +"access the same underlying cached dictionary. Changes made to entries for " +"actual variable names and names added via the write-through proxy interfaces " +"will be overwritten on subsequent calls to :c:func:`PyEval_GetLocals` in " +"that frame. The recommended code update depends on how the function was " +"being used, so refer to the deprecation notice on the function for details." msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:29 +#: ../../whatsnew/3.13.rst:2729 msgid "" -":c:func:`PyThread_get_key_value`: use :c:func:`PyThread_tss_get` instead." +"Calling :c:func:`PyFrame_GetLocals` in an :term:`optimized scope` now " +"returns a write-through proxy rather than a snapshot that gets updated at " +"ill-specified times. If a snapshot is desired, it must be created explicitly " +"(e.g. with :c:func:`PyDict_Copy`), or by calling the new :c:func:" +"`PyEval_GetFrameLocals` API." msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:30 +#: ../../whatsnew/3.13.rst:2736 msgid "" -":c:func:`PyThread_delete_key_value`: use :c:func:`PyThread_tss_delete` " -"instead." +":c:func:`!PyFrame_FastToLocals` and :c:func:`!PyFrame_FastToLocalsWithError` " +"no longer have any effect. Calling these functions has been redundant since " +"Python 3.11, when :c:func:`PyFrame_GetLocals` was first introduced." msgstr "" -#: ../../deprecations/c-api-pending-removal-in-future.rst:31 -msgid ":c:func:`PyThread_ReInitTLS`: unneeded since Python 3.7." +#: ../../whatsnew/3.13.rst:2741 +msgid "" +":c:func:`!PyFrame_LocalsToFast` no longer has any effect. Calling this " +"function is redundant now that :c:func:`PyFrame_GetLocals` returns a write-" +"through proxy for :term:`optimized scopes `." msgstr "" -#: ../../whatsnew/3.13.rst:2558 +#: ../../whatsnew/3.13.rst:2746 msgid "Regression Test Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2560 +#: ../../whatsnew/3.13.rst:2748 msgid "" "Python built with :file:`configure` :option:`--with-pydebug` now supports a :" "option:`-X presite=package.module <-X>` command-line option. If used, it " diff --git a/whatsnew/3.2.po b/whatsnew/3.2.po index f27239f8a4..5f49805ffb 100644 --- a/whatsnew/3.2.po +++ b/whatsnew/3.2.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2537,8 +2537,8 @@ msgid "" "The :func:`ssl.wrap_socket() ` constructor " "function now takes a *ciphers* argument. The *ciphers* string lists the " "allowed encryption algorithms using the format described in the `OpenSSL " -"documentation `__." +"documentation `__." msgstr "" #: ../../whatsnew/3.2.rst:1655 diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index 35f2b010c0..49ff4555d8 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -339,13 +339,14 @@ msgstr "" #: ../../whatsnew/3.4.rst:218 msgid "" -"As `discussed in the PEP`__, platform packagers may choose not to install " -"these commands by default, as long as, when invoked, they provide clear and " -"simple directions on how to install them on that platform (usually using the " -"system package manager)." +"As :pep:`discussed in the PEP <0453#recommendations-for-downstream-" +"distributors>` platform packagers may choose not to install these commands " +"by default, as long as, when invoked, they provide clear and simple " +"directions on how to install them on that platform (usually using the system " +"package manager)." msgstr "" -#: ../../whatsnew/3.4.rst:227 +#: ../../whatsnew/3.4.rst:226 msgid "" "To avoid conflicts between parallel Python 2 and Python 3 installations, " "only the versioned ``pip3`` and ``pip3.4`` commands are bootstrapped by " @@ -357,11 +358,11 @@ msgid "" "multiple Python installations." msgstr "" -#: ../../whatsnew/3.4.rst:238 +#: ../../whatsnew/3.4.rst:237 msgid "Documentation Changes" msgstr "" -#: ../../whatsnew/3.4.rst:240 +#: ../../whatsnew/3.4.rst:239 msgid "" "As part of this change, the :ref:`installing-index` and :ref:`distributing-" "index` sections of the documentation have been completely redesigned as " @@ -371,28 +372,28 @@ msgid "" "of the individual projects." msgstr "" -#: ../../whatsnew/3.4.rst:248 +#: ../../whatsnew/3.4.rst:247 msgid "" "However, as this migration is currently still incomplete, the legacy " "versions of those guides remaining available as :ref:`install-index` and :" "ref:`setuptools-index`." msgstr "" -#: ../../whatsnew/3.4.rst:254 +#: ../../whatsnew/3.4.rst:253 msgid ":pep:`453` -- Explicit bootstrapping of pip in Python installations" msgstr "" -#: ../../whatsnew/3.4.rst:255 +#: ../../whatsnew/3.4.rst:254 msgid "" "PEP written by Donald Stufft and Nick Coghlan, implemented by Donald Stufft, " "Nick Coghlan, Martin von Löwis and Ned Deily." msgstr "" -#: ../../whatsnew/3.4.rst:262 +#: ../../whatsnew/3.4.rst:261 msgid "PEP 446: Newly Created File Descriptors Are Non-Inheritable" msgstr "" -#: ../../whatsnew/3.4.rst:264 +#: ../../whatsnew/3.4.rst:263 msgid "" ":pep:`446` makes newly created file descriptors :ref:`non-inheritable " "`. In general, this is the behavior an application will " @@ -401,39 +402,39 @@ msgid "" "to security issues." msgstr "" -#: ../../whatsnew/3.4.rst:270 +#: ../../whatsnew/3.4.rst:269 msgid "" "However, there are occasions when inheritance is desired. To support these " "cases, the following new functions and methods are available:" msgstr "" -#: ../../whatsnew/3.4.rst:273 +#: ../../whatsnew/3.4.rst:272 msgid ":func:`os.get_inheritable`, :func:`os.set_inheritable`" msgstr ":func:`os.get_inheritable`, :func:`os.set_inheritable`" -#: ../../whatsnew/3.4.rst:274 +#: ../../whatsnew/3.4.rst:273 msgid ":func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`" msgstr ":func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`" -#: ../../whatsnew/3.4.rst:275 +#: ../../whatsnew/3.4.rst:274 msgid "" ":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" msgstr "" ":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" -#: ../../whatsnew/3.4.rst:279 +#: ../../whatsnew/3.4.rst:278 msgid ":pep:`446` -- Make newly created file descriptors non-inheritable" msgstr "" -#: ../../whatsnew/3.4.rst:280 ../../whatsnew/3.4.rst:1812 +#: ../../whatsnew/3.4.rst:279 ../../whatsnew/3.4.rst:1811 msgid "PEP written and implemented by Victor Stinner." msgstr "由 Victor Stinner 撰寫 PEP 與實作。" -#: ../../whatsnew/3.4.rst:286 +#: ../../whatsnew/3.4.rst:285 msgid "Improvements to Codec Handling" msgstr "" -#: ../../whatsnew/3.4.rst:288 +#: ../../whatsnew/3.4.rst:287 msgid "" "Since it was first introduced, the :mod:`codecs` module has always been " "intended to operate as a type-neutral dynamic encoding and decoding system. " @@ -442,7 +443,7 @@ msgid "" "and :class:`bytearray` types, has historically obscured that fact." msgstr "" -#: ../../whatsnew/3.4.rst:295 +#: ../../whatsnew/3.4.rst:294 msgid "" "As a key step in clarifying the situation, the :meth:`codecs.encode` and :" "meth:`codecs.decode` convenience functions are now properly documented in " @@ -451,7 +452,7 @@ msgid "" "2.4, but were previously only discoverable through runtime introspection." msgstr "" -#: ../../whatsnew/3.4.rst:301 +#: ../../whatsnew/3.4.rst:300 msgid "" "Unlike the convenience methods on :class:`str`, :class:`bytes` and :class:" "`bytearray`, the :mod:`codecs` convenience functions support arbitrary " @@ -460,14 +461,14 @@ msgid "" "conversions (in Python 2)." msgstr "" -#: ../../whatsnew/3.4.rst:307 +#: ../../whatsnew/3.4.rst:306 msgid "" "In Python 3.4, the interpreter is able to identify the known non-text " "encodings provided in the standard library and direct users towards these " "general purpose convenience functions when appropriate::" msgstr "" -#: ../../whatsnew/3.4.rst:311 +#: ../../whatsnew/3.4.rst:310 msgid "" ">>> b\"abcdef\".decode(\"hex\")\n" "Traceback (most recent call last):\n" @@ -505,7 +506,7 @@ msgstr "" "LookupError: 'hex' is not a text encoding; use codecs.open() to handle " "arbitrary codecs" -#: ../../whatsnew/3.4.rst:326 +#: ../../whatsnew/3.4.rst:325 msgid "" "In a related change, whenever it is feasible without breaking backwards " "compatibility, exceptions raised during encoding and decoding operations are " @@ -513,7 +514,7 @@ msgid "" "the codec responsible for producing the error::" msgstr "" -#: ../../whatsnew/3.4.rst:331 +#: ../../whatsnew/3.4.rst:330 msgid "" ">>> import codecs\n" "\n" @@ -548,7 +549,7 @@ msgid "" "support the buffer interface)" msgstr "" -#: ../../whatsnew/3.4.rst:359 +#: ../../whatsnew/3.4.rst:358 msgid "" "Finally, as the examples above show, these improvements have permitted the " "restoration of the convenience aliases for the non-Unicode codecs that were " @@ -556,7 +557,7 @@ msgid "" "and from its hexadecimal representation (for example) can now be written as::" msgstr "" -#: ../../whatsnew/3.4.rst:365 +#: ../../whatsnew/3.4.rst:364 msgid "" ">>> from codecs import encode, decode\n" ">>> encode(b\"hello\", \"hex\")\n" @@ -565,13 +566,13 @@ msgid "" "b'hello'" msgstr "" -#: ../../whatsnew/3.4.rst:371 +#: ../../whatsnew/3.4.rst:370 msgid "" "The binary and text transforms provided in the standard library are detailed " "in :ref:`binary-transforms` and :ref:`text-transforms`." msgstr "" -#: ../../whatsnew/3.4.rst:374 +#: ../../whatsnew/3.4.rst:373 msgid "" "(Contributed by Nick Coghlan in :issue:`7475`, :issue:`17827`, :issue:" "`17828` and :issue:`19619`.)" @@ -579,11 +580,11 @@ msgstr "" "(由 Nick Coghlan 在 :issue:`7475`、:issue:`17827`、:issue:`17828` 和 :issue:" "`19619` 中貢獻。)" -#: ../../whatsnew/3.4.rst:381 +#: ../../whatsnew/3.4.rst:380 msgid "PEP 451: A ModuleSpec Type for the Import System" msgstr "" -#: ../../whatsnew/3.4.rst:383 +#: ../../whatsnew/3.4.rst:382 msgid "" ":pep:`451` provides an encapsulation of the information about a module that " "the import machinery will use to load it (that is, a module specification). " @@ -592,7 +593,7 @@ msgid "" "related improvements`__." msgstr "" -#: ../../whatsnew/3.4.rst:391 +#: ../../whatsnew/3.4.rst:390 msgid "" "The public-facing changes from the PEP are entirely backward-compatible. " "Furthermore, they should be transparent to everyone but importer authors. " @@ -603,19 +604,19 @@ msgid "" "and their replacements." msgstr "" -#: ../../whatsnew/3.4.rst:401 +#: ../../whatsnew/3.4.rst:400 msgid "Other Language Changes" msgstr "其他語言更動" -#: ../../whatsnew/3.4.rst:403 +#: ../../whatsnew/3.4.rst:402 msgid "Some smaller changes made to the core Python language are:" msgstr "" -#: ../../whatsnew/3.4.rst:405 +#: ../../whatsnew/3.4.rst:404 msgid "Unicode database updated to UCD version 6.3." msgstr "" -#: ../../whatsnew/3.4.rst:407 +#: ../../whatsnew/3.4.rst:406 msgid "" ":func:`min` and :func:`max` now accept a *default* keyword-only argument " "that can be used to specify the value they return if the iterable they are " @@ -623,11 +624,11 @@ msgid "" "`18111`.)" msgstr "" -#: ../../whatsnew/3.4.rst:412 +#: ../../whatsnew/3.4.rst:411 msgid "Module objects are now :ref:`weakly referenceable `." msgstr "" -#: ../../whatsnew/3.4.rst:414 +#: ../../whatsnew/3.4.rst:413 msgid "" "Module ``__file__`` attributes (and related values) should now always " "contain absolute paths by default, with the sole exception of ``__main__." @@ -635,7 +636,7 @@ msgid "" "(Contributed by Brett Cannon in :issue:`18416`.)" msgstr "" -#: ../../whatsnew/3.4.rst:419 +#: ../../whatsnew/3.4.rst:418 msgid "" "All the UTF-\\* codecs (except UTF-7) now reject surrogates during both " "encoding and decoding unless the ``surrogatepass`` error handler is used, " @@ -645,69 +646,69 @@ msgid "" "Storchaka in :issue:`12892`.)" msgstr "" -#: ../../whatsnew/3.4.rst:426 +#: ../../whatsnew/3.4.rst:425 msgid "" "New German EBCDIC :ref:`codec ` ``cp273``. (Contributed " "by Michael Bierenfeld and Andrew Kuchling in :issue:`1097797`.)" msgstr "" -#: ../../whatsnew/3.4.rst:429 +#: ../../whatsnew/3.4.rst:428 msgid "" "New Ukrainian :ref:`codec ` ``cp1125``. (Contributed by " "Serhiy Storchaka in :issue:`19668`.)" msgstr "" -#: ../../whatsnew/3.4.rst:432 +#: ../../whatsnew/3.4.rst:431 msgid "" ":class:`bytes`.join() and :class:`bytearray`.join() now accept arbitrary " "buffer objects as arguments. (Contributed by Antoine Pitrou in :issue:" "`15958`.)" msgstr "" -#: ../../whatsnew/3.4.rst:436 +#: ../../whatsnew/3.4.rst:435 msgid "" "The :class:`int` constructor now accepts any object that has an " "``__index__`` method for its *base* argument. (Contributed by Mark " "Dickinson in :issue:`16772`.)" msgstr "" -#: ../../whatsnew/3.4.rst:440 +#: ../../whatsnew/3.4.rst:439 msgid "" "Frame objects now have a :func:`~frame.clear` method that clears all " "references to local variables from the frame. (Contributed by Antoine " "Pitrou in :issue:`17934`.)" msgstr "" -#: ../../whatsnew/3.4.rst:444 +#: ../../whatsnew/3.4.rst:443 msgid "" ":class:`memoryview` is now registered as a :class:`Sequence `, and supports the :func:`reversed` builtin. (Contributed by Nick " "Coghlan and Claudiu Popa in :issue:`18690` and :issue:`19078`.)" msgstr "" -#: ../../whatsnew/3.4.rst:448 +#: ../../whatsnew/3.4.rst:447 msgid "" "Signatures reported by :func:`help` have been modified and improved in " "several cases as a result of the introduction of Argument Clinic and other " "changes to the :mod:`inspect` and :mod:`pydoc` modules." msgstr "" -#: ../../whatsnew/3.4.rst:452 +#: ../../whatsnew/3.4.rst:451 msgid "" ":meth:`~object.__length_hint__` is now part of the formal language " "specification (see :pep:`424`). (Contributed by Armin Ronacher in :issue:" "`16148`.)" msgstr "" -#: ../../whatsnew/3.4.rst:458 +#: ../../whatsnew/3.4.rst:457 msgid "New Modules" msgstr "新模組" -#: ../../whatsnew/3.4.rst:464 +#: ../../whatsnew/3.4.rst:463 msgid "asyncio" msgstr "asyncio" -#: ../../whatsnew/3.4.rst:466 +#: ../../whatsnew/3.4.rst:465 msgid "" "The new :mod:`asyncio` module (defined in :pep:`3156`) provides a standard " "pluggable event loop model for Python, providing solid asynchronous IO " @@ -715,23 +716,23 @@ msgid "" "implementations to interoperate with the standard library and each other." msgstr "" -#: ../../whatsnew/3.4.rst:471 ../../whatsnew/3.4.rst:534 +#: ../../whatsnew/3.4.rst:470 ../../whatsnew/3.4.rst:533 msgid "For Python 3.4, this module is considered a :term:`provisional API`." msgstr "" -#: ../../whatsnew/3.4.rst:475 +#: ../../whatsnew/3.4.rst:474 msgid ":pep:`3156` -- Asynchronous IO Support Rebooted: the \"asyncio\" Module" msgstr "" -#: ../../whatsnew/3.4.rst:476 +#: ../../whatsnew/3.4.rst:475 msgid "PEP written and implementation led by Guido van Rossum." msgstr "由 Guido van Rossum 撰寫 PEP 與帶領實作。" -#: ../../whatsnew/3.4.rst:482 +#: ../../whatsnew/3.4.rst:481 msgid "ensurepip" msgstr "ensurepip" -#: ../../whatsnew/3.4.rst:484 +#: ../../whatsnew/3.4.rst:483 msgid "" "The new :mod:`ensurepip` module is the primary infrastructure for the :pep:" "`453` implementation. In the normal course of events end users will not " @@ -740,7 +741,7 @@ msgid "" "environment was declined." msgstr "" -#: ../../whatsnew/3.4.rst:490 +#: ../../whatsnew/3.4.rst:489 msgid "" ":mod:`ensurepip` includes a bundled copy of ``pip``, up-to-date as of the " "first release candidate of the release of CPython with which it ships (this " @@ -752,7 +753,7 @@ msgid "" "package and will not be removed if Python is uninstalled.)" msgstr "" -#: ../../whatsnew/3.4.rst:499 +#: ../../whatsnew/3.4.rst:498 msgid "" "The module is named *ensure*\\ pip because if called when ``pip`` is already " "installed, it does nothing. It also has an ``--upgrade`` option that will " @@ -760,11 +761,11 @@ msgid "" "version of ``pip`` is older than the bundled copy." msgstr "" -#: ../../whatsnew/3.4.rst:508 +#: ../../whatsnew/3.4.rst:507 msgid "enum" msgstr "enum" -#: ../../whatsnew/3.4.rst:510 +#: ../../whatsnew/3.4.rst:509 msgid "" "The new :mod:`enum` module (defined in :pep:`435`) provides a standard " "implementation of enumeration types, allowing other modules (such as :mod:" @@ -773,21 +774,21 @@ msgid "" "enumeration values." msgstr "" -#: ../../whatsnew/3.4.rst:518 +#: ../../whatsnew/3.4.rst:517 msgid ":pep:`435` -- Adding an Enum type to the Python standard library" msgstr "" -#: ../../whatsnew/3.4.rst:519 +#: ../../whatsnew/3.4.rst:518 msgid "" "PEP written by Barry Warsaw, Eli Bendersky and Ethan Furman, implemented by " "Ethan Furman." msgstr "" -#: ../../whatsnew/3.4.rst:526 +#: ../../whatsnew/3.4.rst:525 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.4.rst:528 +#: ../../whatsnew/3.4.rst:527 msgid "" "The new :mod:`pathlib` module offers classes representing filesystem paths " "with semantics appropriate for different operating systems. Path classes " @@ -796,30 +797,30 @@ msgid "" "but also provide I/O operations." msgstr "" -#: ../../whatsnew/3.4.rst:538 +#: ../../whatsnew/3.4.rst:537 msgid ":pep:`428` -- The pathlib module -- object-oriented filesystem paths" msgstr "" -#: ../../whatsnew/3.4.rst:539 ../../whatsnew/3.4.rst:1835 +#: ../../whatsnew/3.4.rst:538 ../../whatsnew/3.4.rst:1834 msgid "PEP written and implemented by Antoine Pitrou." msgstr "由 Antoine Pitrou 撰寫 PEP 與實作。" -#: ../../whatsnew/3.4.rst:545 +#: ../../whatsnew/3.4.rst:544 msgid "selectors" msgstr "selectors" -#: ../../whatsnew/3.4.rst:547 +#: ../../whatsnew/3.4.rst:546 msgid "" "The new :mod:`selectors` module (created as part of implementing :pep:" "`3156`) allows high-level and efficient I/O multiplexing, built upon the :" "mod:`select` module primitives." msgstr "" -#: ../../whatsnew/3.4.rst:555 +#: ../../whatsnew/3.4.rst:554 msgid "statistics" msgstr "statistics" -#: ../../whatsnew/3.4.rst:557 +#: ../../whatsnew/3.4.rst:556 msgid "" "The new :mod:`statistics` module (defined in :pep:`450`) offers some core " "statistics functionality directly in the standard library. This module " @@ -827,64 +828,64 @@ msgid "" "deviation of a data series." msgstr "" -#: ../../whatsnew/3.4.rst:564 +#: ../../whatsnew/3.4.rst:563 msgid ":pep:`450` -- Adding A Statistics Module To The Standard Library" msgstr "" -#: ../../whatsnew/3.4.rst:565 +#: ../../whatsnew/3.4.rst:564 msgid "PEP written and implemented by Steven D'Aprano" msgstr "由 Steven D'Aprano 撰寫 PEP 與實作" -#: ../../whatsnew/3.4.rst:571 +#: ../../whatsnew/3.4.rst:570 msgid "tracemalloc" msgstr "tracemalloc" -#: ../../whatsnew/3.4.rst:573 +#: ../../whatsnew/3.4.rst:572 msgid "" "The new :mod:`tracemalloc` module (defined in :pep:`454`) is a debug tool to " "trace memory blocks allocated by Python. It provides the following " "information:" msgstr "" -#: ../../whatsnew/3.4.rst:576 +#: ../../whatsnew/3.4.rst:575 msgid "Trace where an object was allocated" msgstr "" -#: ../../whatsnew/3.4.rst:577 +#: ../../whatsnew/3.4.rst:576 msgid "" "Statistics on allocated memory blocks per filename and per line number: " "total size, number and average size of allocated memory blocks" msgstr "" -#: ../../whatsnew/3.4.rst:579 +#: ../../whatsnew/3.4.rst:578 msgid "Compute the differences between two snapshots to detect memory leaks" msgstr "" -#: ../../whatsnew/3.4.rst:583 +#: ../../whatsnew/3.4.rst:582 msgid "" ":pep:`454` -- Add a new tracemalloc module to trace Python memory allocations" msgstr "" -#: ../../whatsnew/3.4.rst:584 +#: ../../whatsnew/3.4.rst:583 msgid "PEP written and implemented by Victor Stinner" msgstr "由 Victor Stinner 撰寫 PEP 與實作" -#: ../../whatsnew/3.4.rst:589 +#: ../../whatsnew/3.4.rst:588 msgid "Improved Modules" msgstr "改進的模組" -#: ../../whatsnew/3.4.rst:593 +#: ../../whatsnew/3.4.rst:592 msgid "abc" msgstr "abc" -#: ../../whatsnew/3.4.rst:595 +#: ../../whatsnew/3.4.rst:594 msgid "" "New function :func:`abc.get_cache_token` can be used to know when to " "invalidate caches that are affected by changes in the object graph. " "(Contributed by Łukasz Langa in :issue:`16832`.)" msgstr "" -#: ../../whatsnew/3.4.rst:599 +#: ../../whatsnew/3.4.rst:598 msgid "" "New class :class:`~abc.ABC` has :class:`~abc.ABCMeta` as its meta class. " "Using ``ABC`` as a base class has essentially the same effect as specifying " @@ -892,17 +893,17 @@ msgid "" "(Contributed by Bruno Dupuis in :issue:`16049`.)" msgstr "" -#: ../../whatsnew/3.4.rst:606 +#: ../../whatsnew/3.4.rst:605 msgid "aifc" msgstr "aifc" -#: ../../whatsnew/3.4.rst:608 +#: ../../whatsnew/3.4.rst:607 msgid "" "The :meth:`!getparams` method now returns a namedtuple rather than a plain " "tuple. (Contributed by Claudiu Popa in :issue:`17818`.)" msgstr "" -#: ../../whatsnew/3.4.rst:611 +#: ../../whatsnew/3.4.rst:610 msgid "" ":func:`!aifc.open` now supports the context management protocol: when used " "in a :keyword:`with` block, the :meth:`!close` method of the returned object " @@ -910,52 +911,52 @@ msgid "" "Serhiy Storchacha in :issue:`16486`.)" msgstr "" -#: ../../whatsnew/3.4.rst:616 ../../whatsnew/3.4.rst:1543 +#: ../../whatsnew/3.4.rst:615 ../../whatsnew/3.4.rst:1542 msgid "" "The :meth:`!writeframesraw` and :meth:`!writeframes` methods now accept any :" "term:`bytes-like object`. (Contributed by Serhiy Storchaka in :issue:" "`8311`.)" msgstr "" -#: ../../whatsnew/3.4.rst:622 +#: ../../whatsnew/3.4.rst:621 msgid "argparse" msgstr "argparse" -#: ../../whatsnew/3.4.rst:624 +#: ../../whatsnew/3.4.rst:623 msgid "" "The :class:`~argparse.FileType` class now accepts *encoding* and *errors* " "arguments, which are passed through to :func:`open`. (Contributed by Lucas " "Maystre in :issue:`11175`.)" msgstr "" -#: ../../whatsnew/3.4.rst:630 +#: ../../whatsnew/3.4.rst:629 msgid "audioop" msgstr "audioop" -#: ../../whatsnew/3.4.rst:632 +#: ../../whatsnew/3.4.rst:631 msgid "" ":mod:`!audioop` now supports 24-bit samples. (Contributed by Serhiy " "Storchaka in :issue:`12866`.)" msgstr "" -#: ../../whatsnew/3.4.rst:635 +#: ../../whatsnew/3.4.rst:634 msgid "" "New :func:`!byteswap` function converts big-endian samples to little-endian " "and vice versa. (Contributed by Serhiy Storchaka in :issue:`19641`.)" msgstr "" -#: ../../whatsnew/3.4.rst:639 +#: ../../whatsnew/3.4.rst:638 msgid "" "All :mod:`!audioop` functions now accept any :term:`bytes-like object`. " "Strings are not accepted: they didn't work before, now they raise an error " "right away. (Contributed by Serhiy Storchaka in :issue:`16685`.)" msgstr "" -#: ../../whatsnew/3.4.rst:645 +#: ../../whatsnew/3.4.rst:644 msgid "base64" msgstr "base64" -#: ../../whatsnew/3.4.rst:647 +#: ../../whatsnew/3.4.rst:646 msgid "" "The encoding and decoding functions in :mod:`base64` now accept any :term:" "`bytes-like object` in cases where it previously required a :class:`bytes` " @@ -963,7 +964,7 @@ msgid "" "`17839`.)" msgstr "" -#: ../../whatsnew/3.4.rst:652 +#: ../../whatsnew/3.4.rst:651 msgid "" "New functions :func:`~base64.a85encode`, :func:`~base64.a85decode`, :func:" "`~base64.b85encode`, and :func:`~base64.b85decode` provide the ability to " @@ -974,11 +975,11 @@ msgid "" "Mercurial project, Serhiy Storchaka, and Antoine Pitrou in :issue:`17618`.)" msgstr "" -#: ../../whatsnew/3.4.rst:662 +#: ../../whatsnew/3.4.rst:661 msgid "collections" msgstr "collections" -#: ../../whatsnew/3.4.rst:664 +#: ../../whatsnew/3.4.rst:663 msgid "" "The :meth:`.ChainMap.new_child` method now accepts an *m* argument " "specifying the child map to add to the chain. This allows an existing " @@ -986,11 +987,11 @@ msgid "" "by Vinay Sajip in :issue:`16613`.)" msgstr "" -#: ../../whatsnew/3.4.rst:671 +#: ../../whatsnew/3.4.rst:670 msgid "colorsys" msgstr "colorsys" -#: ../../whatsnew/3.4.rst:673 +#: ../../whatsnew/3.4.rst:672 msgid "" "The number of digits in the coefficients for the RGB --- YIQ conversions " "have been expanded so that they match the FCC NTSC versions. The change in " @@ -998,11 +999,11 @@ msgid "" "(Contributed by Brian Landers and Serhiy Storchaka in :issue:`14323`.)" msgstr "" -#: ../../whatsnew/3.4.rst:680 +#: ../../whatsnew/3.4.rst:679 msgid "contextlib" msgstr "contextlib" -#: ../../whatsnew/3.4.rst:682 +#: ../../whatsnew/3.4.rst:681 msgid "" "The new :class:`contextlib.suppress` context manager helps to clarify the " "intent of code that deliberately suppresses exceptions from a single " @@ -1010,7 +1011,7 @@ msgid "" "Piraeus in :issue:`19266`.)" msgstr "" -#: ../../whatsnew/3.4.rst:687 +#: ../../whatsnew/3.4.rst:686 msgid "" "The new :func:`contextlib.redirect_stdout` context manager makes it easier " "for utility scripts to handle inflexible APIs that write their output to :" @@ -1023,18 +1024,18 @@ msgid "" "data:`sys.stdout`. (Contributed by Raymond Hettinger in :issue:`15805`.)" msgstr "" -#: ../../whatsnew/3.4.rst:698 +#: ../../whatsnew/3.4.rst:697 msgid "" "The :mod:`contextlib` documentation has also been updated to include a :ref:" "`discussion ` of the differences " "between single use, reusable and reentrant context managers." msgstr "" -#: ../../whatsnew/3.4.rst:704 +#: ../../whatsnew/3.4.rst:703 msgid "dbm" msgstr "dbm" -#: ../../whatsnew/3.4.rst:706 +#: ../../whatsnew/3.4.rst:705 msgid "" ":func:`dbm.open` objects now support the context management protocol. When " "used in a :keyword:`with` statement, the ``close`` method of the database " @@ -1042,25 +1043,25 @@ msgid "" "by Claudiu Popa and Nick Coghlan in :issue:`19282`.)" msgstr "" -#: ../../whatsnew/3.4.rst:713 +#: ../../whatsnew/3.4.rst:712 msgid "dis" msgstr "dis" -#: ../../whatsnew/3.4.rst:715 +#: ../../whatsnew/3.4.rst:714 msgid "" "Functions :func:`~dis.show_code`, :func:`~dis.dis`, :func:`~dis.distb`, and :" "func:`~dis.disassemble` now accept a keyword-only *file* argument that " "controls where they write their output." msgstr "" -#: ../../whatsnew/3.4.rst:719 +#: ../../whatsnew/3.4.rst:718 msgid "" "The :mod:`dis` module is now built around an :class:`~dis.Instruction` class " "that provides object oriented access to the details of each individual " "bytecode operation." msgstr "" -#: ../../whatsnew/3.4.rst:723 +#: ../../whatsnew/3.4.rst:722 msgid "" "A new method, :func:`~dis.get_instructions`, provides an iterator that emits " "the Instruction stream for a given piece of Python code. Thus it is now " @@ -1069,7 +1070,7 @@ msgid "" "example::" msgstr "" -#: ../../whatsnew/3.4.rst:729 +#: ../../whatsnew/3.4.rst:728 msgid "" ">>> import dis\n" ">>> for instr in dis.get_instructions(lambda x: x + 1):\n" @@ -1087,13 +1088,13 @@ msgstr "" "BINARY_ADD\n" "RETURN_VALUE" -#: ../../whatsnew/3.4.rst:737 +#: ../../whatsnew/3.4.rst:736 msgid "" "The various display tools in the :mod:`dis` module have been rewritten to " "use these new components." msgstr "" -#: ../../whatsnew/3.4.rst:740 +#: ../../whatsnew/3.4.rst:739 msgid "" "In addition, a new application-friendly class :class:`~dis.Bytecode` " "provides an object-oriented API for inspecting bytecode in both in human-" @@ -1105,7 +1106,7 @@ msgid "" "dis` on the constructor argument, but returned as a multi-line string::" msgstr "" -#: ../../whatsnew/3.4.rst:749 +#: ../../whatsnew/3.4.rst:748 msgid "" ">>> bytecode = dis.Bytecode(lambda x: x + 1, current_offset=3)\n" ">>> for instr in bytecode:\n" @@ -1121,7 +1122,7 @@ msgid "" " ' 7 RETURN_VALUE']" msgstr "" -#: ../../whatsnew/3.4.rst:762 +#: ../../whatsnew/3.4.rst:761 msgid "" ":class:`~dis.Bytecode` also has a class method, :meth:`~dis.Bytecode." "from_traceback`, that provides the ability to manipulate a traceback (that " @@ -1129,7 +1130,7 @@ msgid "" "``distb(tb)``)." msgstr "" -#: ../../whatsnew/3.4.rst:767 +#: ../../whatsnew/3.4.rst:766 msgid "" "(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver in :issue:" "`11816` and Claudiu Popa in :issue:`17916`.)" @@ -1137,25 +1138,25 @@ msgstr "" "(由 Nick Coghlan、Ryan Kelly 和 Thomas Kluyver 在 :issue:`11816` 中以及 " "Claudiu Popa 在 :issue:`17916` 中貢獻。)" -#: ../../whatsnew/3.4.rst:770 +#: ../../whatsnew/3.4.rst:769 msgid "" "New function :func:`~dis.stack_effect` computes the effect on the Python " "stack of a given opcode and argument, information that is not otherwise " "available. (Contributed by Larry Hastings in :issue:`19722`.)" msgstr "" -#: ../../whatsnew/3.4.rst:776 +#: ../../whatsnew/3.4.rst:775 msgid "doctest" msgstr "doctest" -#: ../../whatsnew/3.4.rst:778 +#: ../../whatsnew/3.4.rst:777 msgid "" "A new :ref:`option flag `, :const:`~doctest.FAIL_FAST`, " "halts test running as soon as the first failure is detected. (Contributed " "by R. David Murray and Daniel Urban in :issue:`16522`.)" msgstr "" -#: ../../whatsnew/3.4.rst:782 +#: ../../whatsnew/3.4.rst:781 msgid "" "The :mod:`doctest` command line interface now uses :mod:`argparse`, and has " "two new options, ``-o`` and ``-f``. ``-o`` allows :ref:`doctest options " @@ -1165,17 +1166,17 @@ msgid "" "`11390`.)" msgstr "" -#: ../../whatsnew/3.4.rst:788 +#: ../../whatsnew/3.4.rst:787 msgid "" ":mod:`doctest` will now find doctests in extension module ``__doc__`` " "strings. (Contributed by Zachary Ware in :issue:`3158`.)" msgstr "" -#: ../../whatsnew/3.4.rst:793 +#: ../../whatsnew/3.4.rst:792 msgid "email" msgstr "email" -#: ../../whatsnew/3.4.rst:795 +#: ../../whatsnew/3.4.rst:794 msgid "" ":meth:`~email.message.Message.as_string` now accepts a *policy* argument to " "override the default policy of the message when generating a string " @@ -1185,7 +1186,7 @@ msgid "" "(Contributed by R. David Murray in :issue:`18600`.)" msgstr "" -#: ../../whatsnew/3.4.rst:802 +#: ../../whatsnew/3.4.rst:801 msgid "" "New method :meth:`~email.message.Message.as_bytes` added to produce a bytes " "representation of the message in a fashion similar to how ``as_string`` " @@ -1197,7 +1198,7 @@ msgid "" "(Contributed by R. David Murray in :issue:`18600`.)" msgstr "" -#: ../../whatsnew/3.4.rst:811 +#: ../../whatsnew/3.4.rst:810 msgid "" "The :meth:`.Message.set_param` message now accepts a *replace* keyword " "argument. When specified, the associated header will be updated without " @@ -1206,7 +1207,7 @@ msgid "" "`18891`.)" msgstr "" -#: ../../whatsnew/3.4.rst:819 +#: ../../whatsnew/3.4.rst:818 msgid "" "A pair of new subclasses of :class:`~email.message.Message` have been added " "(:class:`.EmailMessage` and :class:`.MIMEPart`), along with a new sub-" @@ -1223,11 +1224,11 @@ msgid "" "handling). (Contributed by R. David Murray in :issue:`18891`.)" msgstr "" -#: ../../whatsnew/3.4.rst:835 +#: ../../whatsnew/3.4.rst:834 msgid "filecmp" msgstr "filecmp" -#: ../../whatsnew/3.4.rst:837 +#: ../../whatsnew/3.4.rst:836 msgid "" "A new :func:`~filecmp.clear_cache` function provides the ability to clear " "the :mod:`filecmp` comparison cache, which uses :func:`os.stat` information " @@ -1237,7 +1238,7 @@ msgid "" "time field. (Contributed by Mark Levitt in :issue:`18149`.)" msgstr "" -#: ../../whatsnew/3.4.rst:844 +#: ../../whatsnew/3.4.rst:843 msgid "" "New module attribute :const:`~filecmp.DEFAULT_IGNORES` provides the list of " "directories that are used as the default value for the *ignore* parameter of " @@ -1245,11 +1246,11 @@ msgid "" "issue:`15442`.)" msgstr "" -#: ../../whatsnew/3.4.rst:851 +#: ../../whatsnew/3.4.rst:850 msgid "functools" msgstr "functools" -#: ../../whatsnew/3.4.rst:853 +#: ../../whatsnew/3.4.rst:852 msgid "" "The new :func:`~functools.partialmethod` descriptor brings partial argument " "application to descriptors, just as :func:`~functools.partial` provides for " @@ -1259,7 +1260,7 @@ msgid "" "Alon Horev and Nick Coghlan in :issue:`4331`.)" msgstr "" -#: ../../whatsnew/3.4.rst:862 +#: ../../whatsnew/3.4.rst:861 msgid "" "The new :func:`~functools.singledispatch` decorator brings support for " "single-dispatch generic functions to the Python standard library. Where " @@ -1269,22 +1270,22 @@ msgid "" "*different* kinds of data." msgstr "" -#: ../../whatsnew/3.4.rst:871 +#: ../../whatsnew/3.4.rst:870 msgid ":pep:`443` -- Single-dispatch generic functions" msgstr "" -#: ../../whatsnew/3.4.rst:872 +#: ../../whatsnew/3.4.rst:871 msgid "PEP written and implemented by Łukasz Langa." msgstr "由 Łukasz Langa 撰寫 PEP 與實作。" -#: ../../whatsnew/3.4.rst:874 +#: ../../whatsnew/3.4.rst:873 msgid "" ":func:`~functools.total_ordering` now supports a return value of :data:" "`NotImplemented` from the underlying comparison function. (Contributed by " "Katie Miller in :issue:`10042`.)" msgstr "" -#: ../../whatsnew/3.4.rst:878 +#: ../../whatsnew/3.4.rst:877 msgid "" "A pure-python version of the :func:`~functools.partial` function is now in " "the stdlib; in CPython it is overridden by the C accelerated version, but it " @@ -1292,22 +1293,22 @@ msgid "" "in :issue:`12428`.)" msgstr "" -#: ../../whatsnew/3.4.rst:885 +#: ../../whatsnew/3.4.rst:884 msgid "gc" msgstr "gc" -#: ../../whatsnew/3.4.rst:887 +#: ../../whatsnew/3.4.rst:886 msgid "" "New function :func:`~gc.get_stats` returns a list of three per-generation " "dictionaries containing the collections statistics since interpreter " "startup. (Contributed by Antoine Pitrou in :issue:`16351`.)" msgstr "" -#: ../../whatsnew/3.4.rst:893 +#: ../../whatsnew/3.4.rst:892 msgid "glob" msgstr "glob" -#: ../../whatsnew/3.4.rst:895 +#: ../../whatsnew/3.4.rst:894 msgid "" "A new function :func:`~glob.escape` provides a way to escape special " "characters in a filename so that they do not become part of the globbing " @@ -1315,18 +1316,18 @@ msgid "" "Storchaka in :issue:`8402`.)" msgstr "" -#: ../../whatsnew/3.4.rst:901 +#: ../../whatsnew/3.4.rst:900 msgid "hashlib" msgstr "hashlib" -#: ../../whatsnew/3.4.rst:903 +#: ../../whatsnew/3.4.rst:902 msgid "" "A new :func:`hashlib.pbkdf2_hmac` function provides the `PKCS#5 password-" "based key derivation function 2 `_. " "(Contributed by Christian Heimes in :issue:`18582`.)" msgstr "" -#: ../../whatsnew/3.4.rst:908 +#: ../../whatsnew/3.4.rst:907 msgid "" "The :attr:`~hashlib.hash.name` attribute of :mod:`hashlib` hash objects is " "now a formally supported interface. It has always existed in CPython's :mod:" @@ -1336,11 +1337,11 @@ msgid "" "Coombs in :issue:`18532`.)" msgstr "" -#: ../../whatsnew/3.4.rst:917 +#: ../../whatsnew/3.4.rst:916 msgid "hmac" msgstr "hmac" -#: ../../whatsnew/3.4.rst:919 +#: ../../whatsnew/3.4.rst:918 msgid "" ":mod:`hmac` now accepts ``bytearray`` as well as ``bytes`` for the *key* " "argument to the :func:`~hmac.new` function, and the *msg* parameter to both " @@ -1349,7 +1350,7 @@ msgid "" "Jonas Borgström in :issue:`18240`.)" msgstr "" -#: ../../whatsnew/3.4.rst:925 +#: ../../whatsnew/3.4.rst:924 msgid "" "The *digestmod* argument to the :func:`hmac.new` function may now be any " "hash digest name recognized by :mod:`hashlib`. In addition, the current " @@ -1358,7 +1359,7 @@ msgid "" "(Contributed by Christian Heimes in :issue:`17276`.)" msgstr "" -#: ../../whatsnew/3.4.rst:931 +#: ../../whatsnew/3.4.rst:930 msgid "" "With the addition of :attr:`~hmac.HMAC.block_size` and :attr:`~hmac.HMAC." "name` attributes (and the formal documentation of the :attr:`~hmac.HMAC." @@ -1366,18 +1367,18 @@ msgid "" "pep:`247` API. (Contributed by Christian Heimes in :issue:`18775`.)" msgstr "" -#: ../../whatsnew/3.4.rst:938 +#: ../../whatsnew/3.4.rst:937 msgid "html" msgstr "html" -#: ../../whatsnew/3.4.rst:940 +#: ../../whatsnew/3.4.rst:939 msgid "" "New function :func:`~html.unescape` function converts HTML5 character " "references to the corresponding Unicode characters. (Contributed by Ezio " "Melotti in :issue:`2927`.)" msgstr "" -#: ../../whatsnew/3.4.rst:944 +#: ../../whatsnew/3.4.rst:943 msgid "" ":class:`~html.parser.HTMLParser` accepts a new keyword argument " "*convert_charrefs* that, when ``True``, automatically converts all character " @@ -1387,17 +1388,17 @@ msgid "" "(Contributed by Ezio Melotti in :issue:`13633`.)" msgstr "" -#: ../../whatsnew/3.4.rst:951 +#: ../../whatsnew/3.4.rst:950 msgid "" "The *strict* argument of :class:`~html.parser.HTMLParser` is now deprecated. " "(Contributed by Ezio Melotti in :issue:`15114`.)" msgstr "" -#: ../../whatsnew/3.4.rst:956 +#: ../../whatsnew/3.4.rst:955 msgid "http" msgstr "http" -#: ../../whatsnew/3.4.rst:958 +#: ../../whatsnew/3.4.rst:957 msgid "" ":meth:`~http.server.BaseHTTPRequestHandler.send_error` now accepts an " "optional additional *explain* parameter which can be used to provide an " @@ -1407,18 +1408,18 @@ msgid "" "the error response. (Contributed by Karl Cow in :issue:`12921`.)" msgstr "" -#: ../../whatsnew/3.4.rst:965 +#: ../../whatsnew/3.4.rst:964 msgid "" "The :mod:`http.server` :ref:`command line interface ` now " "has a ``-b/--bind`` option that causes the server to listen on a specific " "address. (Contributed by Malte Swart in :issue:`17764`.)" msgstr "" -#: ../../whatsnew/3.4.rst:971 +#: ../../whatsnew/3.4.rst:970 msgid "idlelib and IDLE" msgstr "idlelib 與 IDLE" -#: ../../whatsnew/3.4.rst:973 +#: ../../whatsnew/3.4.rst:972 msgid "" "Since idlelib implements the IDLE shell and editor and is not intended for " "import by other programs, it gets improvements with every release. See :file:" @@ -1427,11 +1428,11 @@ msgid "" "the IDLE :menuselection:`Help --> About IDLE` dialog." msgstr "" -#: ../../whatsnew/3.4.rst:981 +#: ../../whatsnew/3.4.rst:980 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.4.rst:983 +#: ../../whatsnew/3.4.rst:982 msgid "" "The :class:`~importlib.abc.InspectLoader` ABC defines a new method, :meth:" "`~importlib.abc.InspectLoader.source_to_code` that accepts source data and a " @@ -1440,7 +1441,7 @@ msgid "" "Snow and Brett Cannon in :issue:`15627`.)" msgstr "" -#: ../../whatsnew/3.4.rst:989 +#: ../../whatsnew/3.4.rst:988 msgid "" ":class:`~importlib.abc.InspectLoader` also now has a default implementation " "for the :meth:`~importlib.abc.InspectLoader.get_code` method. However, it " @@ -1448,14 +1449,14 @@ msgid "" "performance reasons. (Contributed by Brett Cannon in :issue:`18072`.)" msgstr "" -#: ../../whatsnew/3.4.rst:994 +#: ../../whatsnew/3.4.rst:993 msgid "" "The :func:`~importlib.reload` function has been moved from :mod:`!imp` to :" "mod:`importlib` as part of the :mod:`!imp` module deprecation. (Contributed " "by Berker Peksag in :issue:`18193`.)" msgstr "" -#: ../../whatsnew/3.4.rst:998 +#: ../../whatsnew/3.4.rst:997 msgid "" ":mod:`importlib.util` now has a :data:`~importlib.util.MAGIC_NUMBER` " "attribute providing access to the bytecode version number. This replaces " @@ -1463,7 +1464,7 @@ msgid "" "(Contributed by Brett Cannon in :issue:`18192`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1003 +#: ../../whatsnew/3.4.rst:1002 msgid "" "New :mod:`importlib.util` functions :func:`~importlib.util." "cache_from_source` and :func:`~importlib.util.source_from_cache` replace the " @@ -1471,7 +1472,7 @@ msgid "" "Brett Cannon in :issue:`18194`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1008 +#: ../../whatsnew/3.4.rst:1007 msgid "" "The :mod:`importlib` bootstrap :class:`.NamespaceLoader` now conforms to " "the :class:`.InspectLoader` ABC, which means that ``runpy`` and ``python -" @@ -1479,7 +1480,7 @@ msgid "" "in :issue:`18058`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1013 +#: ../../whatsnew/3.4.rst:1012 msgid "" ":mod:`importlib.util` has a new function :func:`~importlib.util." "decode_source` that decodes source from bytes using universal newline " @@ -1487,7 +1488,7 @@ msgid "" "get_source` methods." msgstr "" -#: ../../whatsnew/3.4.rst:1017 +#: ../../whatsnew/3.4.rst:1016 msgid "" ":class:`importlib.machinery.ExtensionFileLoader` now has a :meth:`~importlib." "machinery.ExtensionFileLoader.get_filename` method. This was inadvertently " @@ -1495,11 +1496,11 @@ msgid "" "`19152`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1024 +#: ../../whatsnew/3.4.rst:1023 msgid "inspect" msgstr "inspect" -#: ../../whatsnew/3.4.rst:1026 +#: ../../whatsnew/3.4.rst:1025 msgid "" "The :mod:`inspect` module now offers a basic :ref:`command line interface " "` to quickly display source code and other information " @@ -1507,7 +1508,7 @@ msgid "" "Coghlan in :issue:`18626`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1031 +#: ../../whatsnew/3.4.rst:1030 msgid "" ":func:`~inspect.unwrap` makes it easy to unravel wrapper function chains " "created by :func:`functools.wraps` (and any other API that sets the " @@ -1515,7 +1516,7 @@ msgid "" "Urban, Aaron Iles and Nick Coghlan in :issue:`13266`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1036 +#: ../../whatsnew/3.4.rst:1035 msgid "" "As part of the implementation of the new :mod:`enum` module, the :mod:" "`inspect` module now has substantially better support for custom ``__dir__`` " @@ -1523,7 +1524,7 @@ msgid "" "(Contributed by Ethan Furman in :issue:`18929` and :issue:`19030`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1042 +#: ../../whatsnew/3.4.rst:1041 msgid "" ":func:`~inspect.getfullargspec` and :func:`~inspect.getargspec` now use the :" "func:`~inspect.signature` API. This allows them to support a much broader " @@ -1536,18 +1537,18 @@ msgid "" "(Contributed by Yury Selivanov in :issue:`17481`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1053 +#: ../../whatsnew/3.4.rst:1052 msgid "" ":func:`~inspect.signature` now supports duck types of CPython functions, " "which adds support for functions compiled with Cython. (Contributed by " "Stefan Behnel and Yury Selivanov in :issue:`17159`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1059 +#: ../../whatsnew/3.4.rst:1058 msgid "ipaddress" msgstr "ipaddress" -#: ../../whatsnew/3.4.rst:1061 +#: ../../whatsnew/3.4.rst:1060 msgid "" ":mod:`ipaddress` was added to the standard library in Python 3.3 as a :term:" "`provisional API`. With the release of Python 3.4, this qualification has " @@ -1555,32 +1556,32 @@ msgid "" "the normal standard library requirements to maintain backwards compatibility." msgstr "" -#: ../../whatsnew/3.4.rst:1067 +#: ../../whatsnew/3.4.rst:1066 msgid "" "A new :attr:`~ipaddress.IPv4Address.is_global` property is ``True`` if an " "address is globally routeable. (Contributed by Peter Moody in :issue:" "`17400`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1073 +#: ../../whatsnew/3.4.rst:1072 msgid "logging" msgstr "logging" -#: ../../whatsnew/3.4.rst:1075 +#: ../../whatsnew/3.4.rst:1074 msgid "" "The :class:`~logging.handlers.TimedRotatingFileHandler` has a new *atTime* " "parameter that can be used to specify the time of day when rollover should " "happen. (Contributed by Ronald Oussoren in :issue:`9556`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1079 +#: ../../whatsnew/3.4.rst:1078 msgid "" ":class:`~logging.handlers.SocketHandler` and :class:`~logging.handlers." "DatagramHandler` now support Unix domain sockets (by setting *port* to " "``None``). (Contributed by Vinay Sajip in commit ce46195b56a9.)" msgstr "" -#: ../../whatsnew/3.4.rst:1084 +#: ../../whatsnew/3.4.rst:1083 msgid "" ":func:`~logging.config.fileConfig` now accepts a :class:`configparser." "RawConfigParser` subclass instance for the *fname* parameter. This " @@ -1590,7 +1591,7 @@ msgid "" "fileConfig`. (Contributed by Vinay Sajip in :issue:`16110`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1092 +#: ../../whatsnew/3.4.rst:1091 msgid "" "Logging configuration data received from a socket via the :func:`logging." "config.listen` function can now be validated before being processed by " @@ -1598,11 +1599,11 @@ msgid "" "keyword argument. (Contributed by Vinay Sajip in :issue:`15452`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1101 +#: ../../whatsnew/3.4.rst:1100 msgid "marshal" msgstr "marshal" -#: ../../whatsnew/3.4.rst:1103 +#: ../../whatsnew/3.4.rst:1102 msgid "" "The default :mod:`marshal` version has been bumped to 3. The code " "implementing the new version restores the Python2 behavior of recording only " @@ -1615,21 +1616,21 @@ msgid "" "issue:`19219`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1114 +#: ../../whatsnew/3.4.rst:1113 msgid "mmap" msgstr "mmap" -#: ../../whatsnew/3.4.rst:1116 +#: ../../whatsnew/3.4.rst:1115 msgid "" "mmap objects are now :ref:`weakly referenceable `. (Contributed " "by Valerie Lambert in :issue:`4885`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1121 +#: ../../whatsnew/3.4.rst:1120 msgid "multiprocessing" msgstr "multiprocessing" -#: ../../whatsnew/3.4.rst:1125 +#: ../../whatsnew/3.4.rst:1124 msgid "" "On Unix two new :ref:`start methods `, " "``spawn`` and ``forkserver``, have been added for starting processes using :" @@ -1642,7 +1643,7 @@ msgid "" "(Contributed by Richard Oudkerk in :issue:`8713`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1135 +#: ../../whatsnew/3.4.rst:1134 msgid "" ":mod:`multiprocessing` also now has the concept of a ``context``, which " "determines how child processes are created. New function :func:" @@ -1655,14 +1656,14 @@ msgid "" "Richard Oudkerk in :issue:`18999`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1145 +#: ../../whatsnew/3.4.rst:1144 msgid "" "Except when using the old *fork* start method, child processes no longer " "inherit unneeded handles/file descriptors from their parents (part of :issue:" "`8713`)." msgstr "" -#: ../../whatsnew/3.4.rst:1149 +#: ../../whatsnew/3.4.rst:1148 msgid "" ":mod:`multiprocessing` now relies on :mod:`runpy` (which implements the ``-" "m`` switch) to initialise ``__main__`` appropriately in child processes when " @@ -1672,11 +1673,11 @@ msgid "" "(Contributed by Nick Coghlan in :issue:`19946`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1158 +#: ../../whatsnew/3.4.rst:1157 msgid "operator" msgstr "operator" -#: ../../whatsnew/3.4.rst:1160 +#: ../../whatsnew/3.4.rst:1159 msgid "" "New function :func:`~operator.length_hint` provides an implementation of the " "specification for how the :meth:`~object.__length_hint__` special method " @@ -1684,18 +1685,18 @@ msgid "" "language feature. (Contributed by Armin Ronacher in :issue:`16148`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1165 +#: ../../whatsnew/3.4.rst:1164 msgid "" "There is now a pure-python version of the :mod:`operator` module available " "for reference and for use by alternate implementations of Python. " "(Contributed by Zachary Ware in :issue:`16694`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1171 +#: ../../whatsnew/3.4.rst:1170 msgid "os" msgstr "os" -#: ../../whatsnew/3.4.rst:1173 +#: ../../whatsnew/3.4.rst:1172 msgid "" "There are new functions to get and set the :ref:`inheritable flag " "` of a file descriptor (:func:`os.get_inheritable`, :func:" @@ -1703,7 +1704,7 @@ msgid "" "get_handle_inheritable`, :func:`os.set_handle_inheritable`)." msgstr "" -#: ../../whatsnew/3.4.rst:1178 +#: ../../whatsnew/3.4.rst:1177 msgid "" "New function :func:`~os.cpu_count` reports the number of CPUs available on " "the platform on which Python is running (or ``None`` if the count can't be " @@ -1713,20 +1714,20 @@ msgid "" "`17914`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1184 +#: ../../whatsnew/3.4.rst:1183 msgid "" ":func:`os.path.samestat` is now available on the Windows platform (and the :" "func:`os.path.samefile` implementation is now shared between Unix and " "Windows). (Contributed by Brian Curtin in :issue:`11939`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1188 +#: ../../whatsnew/3.4.rst:1187 msgid "" ":func:`os.path.ismount` now recognizes volumes mounted below a drive root on " "Windows. (Contributed by Tim Golden in :issue:`9035`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1191 +#: ../../whatsnew/3.4.rst:1190 msgid "" ":func:`os.open` supports two new flags on platforms that provide them, :" "const:`~os.O_PATH` (un-opened file descriptor), and :const:`~os.O_TMPFILE` " @@ -1736,11 +1737,11 @@ msgid "" "respectively.)" msgstr "" -#: ../../whatsnew/3.4.rst:1199 +#: ../../whatsnew/3.4.rst:1198 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.4.rst:1201 +#: ../../whatsnew/3.4.rst:1200 msgid "" ":mod:`pdb` has been enhanced to handle generators, :keyword:`yield`, and " "``yield from`` in a more useful fashion. This is especially helpful when " @@ -1748,7 +1749,7 @@ msgid "" "Xavier de Gaye in :issue:`16596`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1206 +#: ../../whatsnew/3.4.rst:1205 msgid "" "The ``print`` command has been removed from :mod:`pdb`, restoring access to " "the Python :func:`print` function from the pdb command line. Python2's " @@ -1761,11 +1762,11 @@ msgid "" "(Contributed by Connor Osborn in :issue:`18764`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1220 +#: ../../whatsnew/3.4.rst:1219 msgid "pickle" msgstr "pickle" -#: ../../whatsnew/3.4.rst:1222 +#: ../../whatsnew/3.4.rst:1221 msgid "" ":mod:`pickle` now supports (but does not use by default) a new pickle " "protocol, protocol 4. This new protocol addresses a number of issues that " @@ -1775,19 +1776,19 @@ msgid "" "efficiency improvements." msgstr "" -#: ../../whatsnew/3.4.rst:1230 +#: ../../whatsnew/3.4.rst:1229 msgid ":pep:`3154` -- Pickle protocol 4" msgstr "" -#: ../../whatsnew/3.4.rst:1231 +#: ../../whatsnew/3.4.rst:1230 msgid "PEP written by Antoine Pitrou and implemented by Alexandre Vassalotti." msgstr "由 Antoine Pitrou 撰寫 PEP、Alexandre Vassalotti 實作。" -#: ../../whatsnew/3.4.rst:1235 +#: ../../whatsnew/3.4.rst:1234 msgid "plistlib" msgstr "plistlib" -#: ../../whatsnew/3.4.rst:1237 +#: ../../whatsnew/3.4.rst:1236 msgid "" ":mod:`plistlib` now has an API that is similar to the standard pattern for " "stdlib serialization protocols, with new :func:`~plistlib.load`, :func:" @@ -1798,11 +1799,11 @@ msgid "" "(Contributed by Ronald Oussoren and others in :issue:`14455`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1247 +#: ../../whatsnew/3.4.rst:1246 msgid "poplib" msgstr "poplib" -#: ../../whatsnew/3.4.rst:1249 +#: ../../whatsnew/3.4.rst:1248 msgid "" "Two new methods have been added to :mod:`poplib`: :meth:`~poplib.POP3.capa`, " "which returns the list of capabilities advertised by the POP server, and :" @@ -1811,11 +1812,11 @@ msgid "" "Lorenzo Catucci in :issue:`4473`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1257 +#: ../../whatsnew/3.4.rst:1256 msgid "pprint" msgstr "pprint" -#: ../../whatsnew/3.4.rst:1259 +#: ../../whatsnew/3.4.rst:1258 msgid "" "The :mod:`pprint` module's :class:`~pprint.PrettyPrinter` class and its :" "func:`~pprint.pformat`, and :func:`~pprint.pprint` functions have a new " @@ -1825,27 +1826,27 @@ msgid "" "(Contributed by Serhiy Storchaka in :issue:`19132`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1266 +#: ../../whatsnew/3.4.rst:1265 msgid "" "Long strings are now wrapped using Python's normal line continuation " "syntax. (Contributed by Antoine Pitrou in :issue:`17150`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1271 +#: ../../whatsnew/3.4.rst:1270 msgid "pty" msgstr "pty" -#: ../../whatsnew/3.4.rst:1273 +#: ../../whatsnew/3.4.rst:1272 msgid "" ":func:`pty.spawn` now returns the status value from :func:`os.waitpid` on " "the child process, instead of ``None``. (Contributed by Gregory P. Smith.)" msgstr "" -#: ../../whatsnew/3.4.rst:1278 +#: ../../whatsnew/3.4.rst:1277 msgid "pydoc" msgstr "pydoc" -#: ../../whatsnew/3.4.rst:1280 +#: ../../whatsnew/3.4.rst:1279 msgid "" "The :mod:`pydoc` module is now based directly on the :func:`inspect." "signature` introspection API, allowing it to provide signature information " @@ -1854,7 +1855,7 @@ msgid "" "information. (Contributed by Larry Hastings in :issue:`19674`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1286 +#: ../../whatsnew/3.4.rst:1285 msgid "" "The :mod:`pydoc` module no longer displays the ``self`` parameter for " "already bound methods. Instead, it aims to always display the exact current " @@ -1862,7 +1863,7 @@ msgid "" "issue:`20710`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1291 +#: ../../whatsnew/3.4.rst:1290 msgid "" "In addition to the changes that have been made to :mod:`pydoc` directly, its " "handling of custom ``__dir__`` methods and various descriptor behaviours has " @@ -1870,17 +1871,17 @@ msgid "" "`inspect` module." msgstr "" -#: ../../whatsnew/3.4.rst:1296 +#: ../../whatsnew/3.4.rst:1295 msgid "" "As the :func:`help` builtin is based on :mod:`pydoc`, the above changes also " "affect the behaviour of :func:`help`." msgstr "" -#: ../../whatsnew/3.4.rst:1301 +#: ../../whatsnew/3.4.rst:1300 msgid "re" msgstr "re" -#: ../../whatsnew/3.4.rst:1303 +#: ../../whatsnew/3.4.rst:1302 msgid "" "New :func:`~re.fullmatch` function and :meth:`.regex.fullmatch` method " "anchor the pattern at both ends of the string to match. This provides a way " @@ -1890,7 +1891,7 @@ msgid "" "Barnett in :issue:`16203`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1310 +#: ../../whatsnew/3.4.rst:1309 msgid "" "The repr of :ref:`regex objects ` now includes the pattern and " "the flags; the repr of :ref:`match objects ` now includes the " @@ -1898,11 +1899,11 @@ msgid "" "Lopes Tavares and Serhiy Storchaka in :issue:`13592` and :issue:`17087`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1318 +#: ../../whatsnew/3.4.rst:1317 msgid "resource" msgstr "resource" -#: ../../whatsnew/3.4.rst:1320 +#: ../../whatsnew/3.4.rst:1319 msgid "" "New :func:`~resource.prlimit` function, available on Linux platforms with a " "kernel version of 2.6.36 or later and glibc of 2.13 or later, provides the " @@ -1910,7 +1911,7 @@ msgid "" "making the call. (Contributed by Christian Heimes in :issue:`16595`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1325 +#: ../../whatsnew/3.4.rst:1324 msgid "" "On Linux kernel version 2.6.36 or later, there are also some new Linux " "specific constants: :const:`~resource.RLIMIT_MSGQUEUE`, :const:`~resource." @@ -1919,18 +1920,18 @@ msgid "" "Christian Heimes in :issue:`19324`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1331 +#: ../../whatsnew/3.4.rst:1330 msgid "" "On FreeBSD version 9 and later, there some new FreeBSD specific constants: :" "const:`~resource.RLIMIT_SBSIZE`, :const:`~resource.RLIMIT_SWAP`, and :const:" "`~resource.RLIMIT_NPTS`. (Contributed by Claudiu Popa in :issue:`19343`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1338 +#: ../../whatsnew/3.4.rst:1337 msgid "select" msgstr "select" -#: ../../whatsnew/3.4.rst:1340 +#: ../../whatsnew/3.4.rst:1339 msgid "" ":class:`~select.epoll` objects now support the context management protocol. " "When used in a :keyword:`with` statement, the :meth:`~select.epoll.close` " @@ -1938,29 +1939,29 @@ msgid "" "by Serhiy Storchaka in :issue:`16488`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1345 +#: ../../whatsnew/3.4.rst:1344 msgid "" ":class:`~select.devpoll` objects now have :meth:`~select.devpoll.fileno` " "and :meth:`~select.devpoll.close` methods, as well as a new attribute :attr:" "`~select.devpoll.closed`. (Contributed by Victor Stinner in :issue:`18794`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1352 +#: ../../whatsnew/3.4.rst:1351 msgid "shelve" msgstr "shelve" -#: ../../whatsnew/3.4.rst:1354 +#: ../../whatsnew/3.4.rst:1353 msgid "" ":class:`~shelve.Shelf` instances may now be used in :keyword:`with` " "statements, and will be automatically closed at the end of the :keyword:`!" "with` block. (Contributed by Filip Gruszczyński in :issue:`13896`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1360 +#: ../../whatsnew/3.4.rst:1359 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.4.rst:1362 +#: ../../whatsnew/3.4.rst:1361 msgid "" ":func:`~shutil.copyfile` now raises a specific :exc:`~shutil.Error` " "subclass, :exc:`~shutil.SameFileError`, when the source and destination are " @@ -1969,11 +1970,11 @@ msgid "" "issue:`1492704`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1370 +#: ../../whatsnew/3.4.rst:1369 msgid "smtpd" msgstr "smtpd" -#: ../../whatsnew/3.4.rst:1372 +#: ../../whatsnew/3.4.rst:1371 msgid "" "The :class:`!SMTPServer` and :class:`!SMTPChannel` classes now accept a " "*map* keyword argument which, if specified, is passed in to :class:`!" @@ -1982,11 +1983,11 @@ msgid "" "issue:`11959`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1380 +#: ../../whatsnew/3.4.rst:1379 msgid "smtplib" msgstr "smtplib" -#: ../../whatsnew/3.4.rst:1382 +#: ../../whatsnew/3.4.rst:1381 msgid "" ":exc:`~smtplib.SMTPException` is now a subclass of :exc:`OSError`, which " "allows both socket level errors and SMTP protocol level errors to be caught " @@ -1994,45 +1995,45 @@ msgid "" "occurred. (Contributed by Ned Jackson Lovely in :issue:`2118`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1389 +#: ../../whatsnew/3.4.rst:1388 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.4.rst:1391 +#: ../../whatsnew/3.4.rst:1390 msgid "" "The socket module now supports the :const:`~socket.CAN_BCM` protocol on " "platforms that support it. (Contributed by Brian Thorne in :issue:`15359`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1394 +#: ../../whatsnew/3.4.rst:1393 msgid "" "Socket objects have new methods to get or set their :ref:`inheritable flag " "`, :meth:`~socket.socket.get_inheritable` and :meth:`~socket." "socket.set_inheritable`." msgstr "" -#: ../../whatsnew/3.4.rst:1398 +#: ../../whatsnew/3.4.rst:1397 msgid "" "The ``socket.AF_*`` and ``socket.SOCK_*`` constants are now enumeration " "values using the new :mod:`enum` module. This allows meaningful names to be " "printed during debugging, instead of integer \"magic numbers\"." msgstr "" -#: ../../whatsnew/3.4.rst:1402 +#: ../../whatsnew/3.4.rst:1401 msgid "The :const:`~socket.AF_LINK` constant is now available on BSD and OSX." msgstr "" -#: ../../whatsnew/3.4.rst:1404 +#: ../../whatsnew/3.4.rst:1403 msgid "" ":func:`~socket.inet_pton` and :func:`~socket.inet_ntop` are now supported on " "Windows. (Contributed by Atsuo Ishimoto in :issue:`7171`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1409 +#: ../../whatsnew/3.4.rst:1408 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.4.rst:1411 +#: ../../whatsnew/3.4.rst:1410 msgid "" "A new boolean parameter to the :func:`~sqlite3.connect` function, *uri*, can " "be used to indicate that the *database* parameter is a ``uri`` (see the " @@ -2040,11 +2041,11 @@ msgid "" "(Contributed by poq in :issue:`13773`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1418 +#: ../../whatsnew/3.4.rst:1417 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.4.rst:1422 +#: ../../whatsnew/3.4.rst:1421 msgid "" ":data:`~ssl.PROTOCOL_TLSv1_1` and :data:`~ssl.PROTOCOL_TLSv1_2` (TLSv1.1 and " "TLSv1.2 support) have been added; support for these protocols is only " @@ -2052,7 +2053,7 @@ msgid "" "Michele Orrù and Antoine Pitrou in :issue:`16692`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1429 +#: ../../whatsnew/3.4.rst:1428 msgid "" "New function :func:`~ssl.create_default_context` provides a standard way to " "obtain an :class:`~ssl.SSLContext` whose settings are intended to be a " @@ -2066,7 +2067,7 @@ msgid "" "stdlib API. (Contributed by Christian Heimes in :issue:`19689`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1441 +#: ../../whatsnew/3.4.rst:1440 msgid "" ":class:`~ssl.SSLContext` method :meth:`~ssl.SSLContext." "load_verify_locations` accepts a new optional argument *cadata*, which can " @@ -2074,7 +2075,7 @@ msgid "" "bytes, respectively. (Contributed by Christian Heimes in :issue:`18138`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1446 +#: ../../whatsnew/3.4.rst:1445 msgid "" "New function :func:`~ssl.get_default_verify_paths` returns a named tuple of " "the paths and environment variables that the :meth:`~ssl.SSLContext." @@ -2083,7 +2084,7 @@ msgid "" "issues. (Contributed by Christian Heimes in :issue:`18143`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1453 +#: ../../whatsnew/3.4.rst:1452 msgid "" ":class:`~ssl.SSLContext` has a new method, :meth:`~ssl.SSLContext." "cert_store_stats`, that reports the number of loaded ``X.509`` certs, " @@ -2093,7 +2094,7 @@ msgid "" "`18147`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1460 +#: ../../whatsnew/3.4.rst:1459 msgid "" "If OpenSSL 0.9.8 or later is available, :class:`~ssl.SSLContext` has a new " "attribute :attr:`~ssl.SSLContext.verify_flags` that can be used to control " @@ -2104,7 +2105,7 @@ msgid "" "default. (Contributed by Christien Heimes in :issue:`8813`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1468 +#: ../../whatsnew/3.4.rst:1467 msgid "" "New :class:`~ssl.SSLContext` method :meth:`~ssl.SSLContext." "load_default_certs` loads a set of default \"certificate authority\" (CA) " @@ -2116,7 +2117,7 @@ msgid "" "by Christian Heimes in :issue:`19292`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1479 +#: ../../whatsnew/3.4.rst:1478 msgid "" "Two new windows-only functions, :func:`~ssl.enum_certificates` and :func:" "`~ssl.enum_crls` provide the ability to retrieve certificates, certificate " @@ -2124,14 +2125,14 @@ msgid "" "Christian Heimes in :issue:`17134`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1486 +#: ../../whatsnew/3.4.rst:1485 msgid "" "Support for server-side SNI (Server Name Indication) using the new :meth:" "`ssl.SSLContext.set_servername_callback` method. (Contributed by Daniel " "Black in :issue:`8109`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1490 +#: ../../whatsnew/3.4.rst:1489 msgid "" "The dictionary returned by :meth:`.SSLSocket.getpeercert` contains " "additional ``X509v3`` extension items: ``crlDistributionPoints``, " @@ -2139,29 +2140,29 @@ msgid "" "issue:`18379`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1496 +#: ../../whatsnew/3.4.rst:1495 msgid "stat" msgstr "stat" -#: ../../whatsnew/3.4.rst:1498 +#: ../../whatsnew/3.4.rst:1497 msgid "" "The :mod:`stat` module is now backed by a C implementation in :mod:`!_stat`. " "A C implementation is required as most of the values aren't standardized and " "are platform-dependent. (Contributed by Christian Heimes in :issue:`11016`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1502 +#: ../../whatsnew/3.4.rst:1501 msgid "" "The module supports new :mod:`~stat.ST_MODE` flags, :mod:`~stat.S_IFDOOR`, :" "const:`~stat.S_IFPORT`, and :const:`~stat.S_IFWHT`. (Contributed by " "Christian Hiemes in :issue:`11016`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1508 +#: ../../whatsnew/3.4.rst:1507 msgid "struct" msgstr "struct" -#: ../../whatsnew/3.4.rst:1510 +#: ../../whatsnew/3.4.rst:1509 msgid "" "New function :mod:`~struct.iter_unpack` and a new :meth:`struct.Struct." "iter_unpack` method on compiled formats provide streamed unpacking of a " @@ -2169,35 +2170,35 @@ msgid "" "by Antoine Pitrou in :issue:`17804`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1517 +#: ../../whatsnew/3.4.rst:1516 msgid "subprocess" msgstr "subprocess" -#: ../../whatsnew/3.4.rst:1519 +#: ../../whatsnew/3.4.rst:1518 msgid "" ":func:`~subprocess.check_output` now accepts an *input* argument that can be " "used to provide the contents of ``stdin`` for the command that is run. " "(Contributed by Zack Weinberg in :issue:`16624`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1523 +#: ../../whatsnew/3.4.rst:1522 msgid "" ":func:`~subprocess.getstatus` and :func:`~subprocess.getstatusoutput` now " "work on Windows. This change was actually inadvertently made in 3.3.4. " "(Contributed by Tim Golden in :issue:`10197`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1529 +#: ../../whatsnew/3.4.rst:1528 msgid "sunau" msgstr "sunau" -#: ../../whatsnew/3.4.rst:1531 +#: ../../whatsnew/3.4.rst:1530 msgid "" "The :meth:`!getparams` method now returns a namedtuple rather than a plain " "tuple. (Contributed by Claudiu Popa in :issue:`18901`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1534 +#: ../../whatsnew/3.4.rst:1533 msgid "" ":meth:`!sunau.open` now supports the context management protocol: when used " "in a :keyword:`with` block, the ``close`` method of the returned object will " @@ -2205,18 +2206,18 @@ msgid "" "Storchaka in :issue:`18878`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1539 +#: ../../whatsnew/3.4.rst:1538 msgid "" ":meth:`.AU_write.setsampwidth` now supports 24 bit samples, thus adding " "support for writing 24 sample using the module. (Contributed by Serhiy " "Storchaka in :issue:`19261`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1549 +#: ../../whatsnew/3.4.rst:1548 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.4.rst:1551 +#: ../../whatsnew/3.4.rst:1550 msgid "" "New function :func:`sys.getallocatedblocks` returns the current number of " "blocks allocated by the interpreter. (In CPython with the default ``--with-" @@ -2226,7 +2227,7 @@ msgid "" "in :issue:`13390`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1558 +#: ../../whatsnew/3.4.rst:1557 msgid "" "When the Python interpreter starts in :ref:`interactive mode `, it checks for an :data:`~sys.__interactivehook__` attribute " @@ -2242,11 +2243,11 @@ msgid "" "Araujo and Antoine Pitrou in :issue:`5845`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1573 +#: ../../whatsnew/3.4.rst:1572 msgid "tarfile" msgstr "tarfile" -#: ../../whatsnew/3.4.rst:1575 +#: ../../whatsnew/3.4.rst:1574 msgid "" "The :mod:`tarfile` module now supports a simple :ref:`tarfile-commandline` " "when called as a script directly or via ``-m``. This can be used to create " @@ -2254,11 +2255,11 @@ msgid "" "`13477`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1581 +#: ../../whatsnew/3.4.rst:1580 msgid "textwrap" msgstr "textwrap" -#: ../../whatsnew/3.4.rst:1583 +#: ../../whatsnew/3.4.rst:1582 msgid "" "The :class:`~textwrap.TextWrapper` class has two new attributes/constructor " "arguments: :attr:`~textwrap.TextWrapper.max_lines`, which limits the number " @@ -2272,11 +2273,11 @@ msgid "" "issue:`18725`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1595 +#: ../../whatsnew/3.4.rst:1594 msgid "threading" msgstr "threading" -#: ../../whatsnew/3.4.rst:1597 +#: ../../whatsnew/3.4.rst:1596 msgid "" "The :class:`~threading.Thread` object representing the main thread can be " "obtained from the new :func:`~threading.main_thread` function. In normal " @@ -2284,11 +2285,11 @@ msgid "" "started. (Contributed by Andrew Svetlov in :issue:`18882`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1604 +#: ../../whatsnew/3.4.rst:1603 msgid "traceback" msgstr "traceback" -#: ../../whatsnew/3.4.rst:1606 +#: ../../whatsnew/3.4.rst:1605 msgid "" "A new :func:`traceback.clear_frames` function takes a traceback object and " "clears the local variables in all of the frames it references, reducing the " @@ -2296,11 +2297,11 @@ msgid "" "`1565525`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1613 +#: ../../whatsnew/3.4.rst:1612 msgid "types" msgstr "types" -#: ../../whatsnew/3.4.rst:1615 +#: ../../whatsnew/3.4.rst:1614 msgid "" "A new :func:`~types.DynamicClassAttribute` descriptor provides a way to " "define an attribute that acts normally when looked up through an instance " @@ -2310,18 +2311,18 @@ msgid "" "for an example). (Contributed by Ethan Furman in :issue:`19030`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1624 +#: ../../whatsnew/3.4.rst:1623 msgid "urllib" msgstr "urllib" -#: ../../whatsnew/3.4.rst:1626 +#: ../../whatsnew/3.4.rst:1625 msgid "" ":mod:`urllib.request` now supports ``data:`` URLs via the :class:`~urllib." "request.DataHandler` class. (Contributed by Mathias Panzenböck in :issue:" "`16423`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1630 +#: ../../whatsnew/3.4.rst:1629 msgid "" "The http method that will be used by a :class:`~urllib.request.Request` " "class can now be specified by setting a :class:`~urllib.request.Request." @@ -2329,7 +2330,7 @@ msgid "" "issue:`18978`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1635 +#: ../../whatsnew/3.4.rst:1634 msgid "" ":class:`~urllib.request.Request` objects are now reusable: if the :attr:" "`~urllib.request.Request.full_url` or :attr:`~urllib.request.Request.data` " @@ -2344,7 +2345,7 @@ msgid "" "`17485`, and Damien Brecht and Senthil Kumaran in :issue:`17272`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1648 +#: ../../whatsnew/3.4.rst:1647 msgid "" ":class:`~urllib.error.HTTPError` objects now have a :attr:`~urllib.error." "HTTPError.headers` attribute that provides access to the HTTP response " @@ -2352,11 +2353,11 @@ msgid "" "`15701`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1655 +#: ../../whatsnew/3.4.rst:1654 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.4.rst:1657 +#: ../../whatsnew/3.4.rst:1656 msgid "" "The :class:`~unittest.TestCase` class has a new method, :meth:`~unittest." "TestCase.subTest`, that produces a context manager whose :keyword:`with` " @@ -2367,7 +2368,7 @@ msgid "" "of which will run even if one or more of them fail. For example::" msgstr "" -#: ../../whatsnew/3.4.rst:1665 +#: ../../whatsnew/3.4.rst:1664 msgid "" "class NumbersTest(unittest.TestCase):\n" " def test_even(self):\n" @@ -2381,7 +2382,7 @@ msgstr "" " with self.subTest(i=i):\n" " self.assertEqual(i % 2, 0)" -#: ../../whatsnew/3.4.rst:1671 +#: ../../whatsnew/3.4.rst:1670 msgid "" "will result in six subtests, each identified in the unittest verbose output " "with a label consisting of the variable name ``i`` and a particular value " @@ -2389,28 +2390,28 @@ msgid "" "version of this example. (Contributed by Antoine Pitrou in :issue:`16997`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1676 +#: ../../whatsnew/3.4.rst:1675 msgid "" ":func:`unittest.main` now accepts an iterable of test names for " "*defaultTest*, where previously it only accepted a single test name as a " "string. (Contributed by Jyrki Pulliainen in :issue:`15132`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1680 +#: ../../whatsnew/3.4.rst:1679 msgid "" "If :class:`~unittest.SkipTest` is raised during test discovery (that is, at " "the module level in the test file), it is now reported as a skip instead of " "an error. (Contributed by Zach Ware in :issue:`16935`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1684 +#: ../../whatsnew/3.4.rst:1683 msgid "" ":meth:`~unittest.TestLoader.discover` now sorts the discovered files to " "provide consistent test ordering. (Contributed by Martin Melin and Jeff " "Ramnani in :issue:`16709`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1688 +#: ../../whatsnew/3.4.rst:1687 msgid "" ":class:`~unittest.TestSuite` now drops references to tests as soon as the " "test has been run, if the test is successful. On Python interpreters that " @@ -2421,7 +2422,7 @@ msgid "" "Wardill, Matt McClure, and Andrew Svetlov in :issue:`11798`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1696 +#: ../../whatsnew/3.4.rst:1695 msgid "" "A new test assertion context-manager, :meth:`~unittest.TestCase.assertLogs`, " "will ensure that a given block of code emits a log message using the :mod:" @@ -2433,13 +2434,13 @@ msgid "" "in :issue:`18937`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1705 +#: ../../whatsnew/3.4.rst:1704 msgid "" "Test discovery now works with namespace packages (Contributed by Claudiu " "Popa in :issue:`17457`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1708 +#: ../../whatsnew/3.4.rst:1707 msgid "" ":mod:`unittest.mock` objects now inspect their specification signatures when " "matching calls, which means an argument can now be matched by either " @@ -2447,23 +2448,23 @@ msgid "" "Pitrou in :issue:`17015`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1713 +#: ../../whatsnew/3.4.rst:1712 msgid "" ":func:`~mock.mock_open` objects now have ``readline`` and ``readlines`` " "methods. (Contributed by Toshio Kuratomi in :issue:`17467`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1718 +#: ../../whatsnew/3.4.rst:1717 msgid "venv" msgstr "venv" -#: ../../whatsnew/3.4.rst:1720 +#: ../../whatsnew/3.4.rst:1719 msgid "" ":mod:`venv` now includes activation scripts for the ``csh`` and ``fish`` " "shells. (Contributed by Andrew Svetlov in :issue:`15417`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1723 +#: ../../whatsnew/3.4.rst:1722 msgid "" ":class:`~venv.EnvBuilder` and the :func:`~venv.create` convenience function " "take a new keyword argument *with_pip*, which defaults to ``False``, that " @@ -2472,47 +2473,47 @@ msgid "" "issue:`19552` as part of the :pep:`453` implementation.)" msgstr "" -#: ../../whatsnew/3.4.rst:1731 +#: ../../whatsnew/3.4.rst:1730 msgid "wave" msgstr "wave" -#: ../../whatsnew/3.4.rst:1733 +#: ../../whatsnew/3.4.rst:1732 msgid "" "The :meth:`~wave.getparams` method now returns a namedtuple rather than a " "plain tuple. (Contributed by Claudiu Popa in :issue:`17487`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1736 +#: ../../whatsnew/3.4.rst:1735 msgid "" ":meth:`wave.open` now supports the context management protocol. " "(Contributed by Claudiu Popa in :issue:`17616`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1739 +#: ../../whatsnew/3.4.rst:1738 msgid "" ":mod:`wave` can now :ref:`write output to unseekable files `. (Contributed by David Jones, Guilherme Polo, and Serhiy " "Storchaka in :issue:`5202`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1743 +#: ../../whatsnew/3.4.rst:1742 msgid "" "The :meth:`~wave.Wave_write.writeframesraw` and :meth:`~wave.Wave_write." "writeframes` methods now accept any :term:`bytes-like object`. (Contributed " "by Serhiy Storchaka in :issue:`8311`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1749 +#: ../../whatsnew/3.4.rst:1748 msgid "weakref" msgstr "weakref" -#: ../../whatsnew/3.4.rst:1751 +#: ../../whatsnew/3.4.rst:1750 msgid "" "New :class:`~weakref.WeakMethod` class simulates weak references to bound " "methods. (Contributed by Antoine Pitrou in :issue:`14631`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1754 +#: ../../whatsnew/3.4.rst:1753 msgid "" "New :class:`~weakref.finalize` class makes it possible to register a " "callback to be invoked when an object is garbage collected, without needing " @@ -2520,18 +2521,18 @@ msgid "" "(Contributed by Richard Oudkerk in :issue:`15528`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1759 +#: ../../whatsnew/3.4.rst:1758 msgid "" "The callback, if any, associated with a :class:`~weakref.ref` is now exposed " "via the :attr:`~weakref.ref.__callback__` attribute. (Contributed by Mark " "Dickinson in :issue:`17643`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1765 +#: ../../whatsnew/3.4.rst:1764 msgid "xml.etree" msgstr "xml.etree" -#: ../../whatsnew/3.4.rst:1767 +#: ../../whatsnew/3.4.rst:1766 msgid "" "A new parser, :class:`~xml.etree.ElementTree.XMLPullParser`, allows a non-" "blocking applications to parse XML documents. An example can be seen at :" @@ -2539,7 +2540,7 @@ msgid "" "`17741`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1772 +#: ../../whatsnew/3.4.rst:1771 msgid "" "The :mod:`xml.etree.ElementTree` :func:`~xml.etree.ElementTree.tostring` " "and :func:`~xml.etree.ElementTree.tostringlist` functions, and the :class:" @@ -2551,11 +2552,11 @@ msgid "" "Storchaka in :issue:`14377`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1783 +#: ../../whatsnew/3.4.rst:1782 msgid "zipfile" msgstr "zipfile" -#: ../../whatsnew/3.4.rst:1785 +#: ../../whatsnew/3.4.rst:1784 msgid "" "The :meth:`~zipfile.PyZipFile.writepy` method of the :class:`~zipfile." "PyZipFile` class has a new *filterfunc* option that can be used to control " @@ -2564,36 +2565,36 @@ msgid "" "Christian Tismer in :issue:`19274`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1791 +#: ../../whatsnew/3.4.rst:1790 msgid "" "The *allowZip64* parameter to :class:`~zipfile.ZipFile` and :class:`~zipfile." "PyZipfile` is now ``True`` by default. (Contributed by William Mallard in :" "issue:`17201`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1798 +#: ../../whatsnew/3.4.rst:1797 msgid "CPython Implementation Changes" msgstr "CPython 實作變更" -#: ../../whatsnew/3.4.rst:1804 +#: ../../whatsnew/3.4.rst:1803 msgid "PEP 445: Customization of CPython Memory Allocators" msgstr "" -#: ../../whatsnew/3.4.rst:1806 +#: ../../whatsnew/3.4.rst:1805 msgid "" ":pep:`445` adds new C level interfaces to customize memory allocation in the " "CPython interpreter." msgstr "" -#: ../../whatsnew/3.4.rst:1811 +#: ../../whatsnew/3.4.rst:1810 msgid ":pep:`445` -- Add new APIs to customize Python memory allocators" msgstr "" -#: ../../whatsnew/3.4.rst:1818 +#: ../../whatsnew/3.4.rst:1817 msgid "PEP 442: Safe Object Finalization" msgstr "" -#: ../../whatsnew/3.4.rst:1820 +#: ../../whatsnew/3.4.rst:1819 msgid "" ":pep:`442` removes the current limitations and quirks of object finalization " "in CPython. With it, objects with :meth:`__del__` methods, as well as " @@ -2601,7 +2602,7 @@ msgid "" "part of a reference cycle." msgstr "" -#: ../../whatsnew/3.4.rst:1825 +#: ../../whatsnew/3.4.rst:1824 msgid "" "As part of this change, module globals are no longer forcibly set to :const:" "`None` during interpreter shutdown in most cases, instead relying on the " @@ -2610,15 +2611,15 @@ msgid "" "that have plagued Python since the cyclic GC was first introduced." msgstr "" -#: ../../whatsnew/3.4.rst:1834 +#: ../../whatsnew/3.4.rst:1833 msgid ":pep:`442` -- Safe object finalization" msgstr "" -#: ../../whatsnew/3.4.rst:1841 +#: ../../whatsnew/3.4.rst:1840 msgid "PEP 456: Secure and Interchangeable Hash Algorithm" msgstr "" -#: ../../whatsnew/3.4.rst:1843 +#: ../../whatsnew/3.4.rst:1842 msgid "" ":pep:`456` follows up on earlier security fix work done on Python's hash " "algorithm to address certain DOS attacks to which public facing APIs backed " @@ -2630,18 +2631,18 @@ msgid "" "comparison with the older FNV algorithm are trivial." msgstr "" -#: ../../whatsnew/3.4.rst:1852 +#: ../../whatsnew/3.4.rst:1851 msgid "" "The PEP adds additional fields to the :data:`sys.hash_info` named tuple to " "describe the hash algorithm in use by the currently executing binary. " "Otherwise, the PEP does not alter any existing CPython APIs." msgstr "" -#: ../../whatsnew/3.4.rst:1860 +#: ../../whatsnew/3.4.rst:1859 msgid "PEP 436: Argument Clinic" msgstr "" -#: ../../whatsnew/3.4.rst:1862 +#: ../../whatsnew/3.4.rst:1861 msgid "" "\"Argument Clinic\" (:pep:`436`) is now part of the CPython build process " "and can be used to simplify the process of defining and maintaining accurate " @@ -2649,21 +2650,21 @@ msgid "" "in C." msgstr "" -#: ../../whatsnew/3.4.rst:1867 +#: ../../whatsnew/3.4.rst:1866 msgid "" "Some standard library extension modules have been converted to use Argument " "Clinic in Python 3.4, and :mod:`pydoc` and :mod:`inspect` have been updated " "accordingly." msgstr "" -#: ../../whatsnew/3.4.rst:1871 +#: ../../whatsnew/3.4.rst:1870 msgid "" "It is expected that signature metadata for programmatic introspection will " "be added to additional callables implemented in C as part of Python 3.4 " "maintenance releases." msgstr "" -#: ../../whatsnew/3.4.rst:1876 +#: ../../whatsnew/3.4.rst:1875 msgid "" "The Argument Clinic PEP is not fully up to date with the state of the " "implementation. This has been deemed acceptable by the release manager and " @@ -2671,26 +2672,26 @@ msgid "" "available as a public API for third party use in Python 3.4." msgstr "" -#: ../../whatsnew/3.4.rst:1883 +#: ../../whatsnew/3.4.rst:1882 msgid ":pep:`436` -- The Argument Clinic DSL" msgstr "" -#: ../../whatsnew/3.4.rst:1884 +#: ../../whatsnew/3.4.rst:1883 msgid "PEP written and implemented by Larry Hastings." msgstr "由 Larry Hastings 撰寫 PEP 與實作。" -#: ../../whatsnew/3.4.rst:1888 +#: ../../whatsnew/3.4.rst:1887 msgid "Other Build and C API Changes" msgstr "" -#: ../../whatsnew/3.4.rst:1890 +#: ../../whatsnew/3.4.rst:1889 msgid "" "The new :c:func:`PyType_GetSlot` function has been added to the stable ABI, " "allowing retrieval of function pointers from named type slots when using the " "limited API. (Contributed by Martin von Löwis in :issue:`17162`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1894 +#: ../../whatsnew/3.4.rst:1893 msgid "" "The new :c:func:`!Py_SetStandardStreamEncoding` pre-initialization API " "allows applications embedding the CPython interpreter to reliably force a " @@ -2698,34 +2699,34 @@ msgid "" "by Bastien Montagne and Nick Coghlan in :issue:`16129`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1899 +#: ../../whatsnew/3.4.rst:1898 msgid "" "Most Python C APIs that don't mutate string arguments are now correctly " "marked as accepting ``const char *`` rather than ``char *``. (Contributed " "by Serhiy Storchaka in :issue:`1772673`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1903 +#: ../../whatsnew/3.4.rst:1902 msgid "" "A new shell version of ``python-config`` can be used even when a python " "interpreter is not available (for example, in cross compilation scenarios)." msgstr "" -#: ../../whatsnew/3.4.rst:1906 +#: ../../whatsnew/3.4.rst:1905 msgid "" ":c:func:`PyUnicode_FromFormat` now supports width and precision " "specifications for ``%s``, ``%A``, ``%U``, ``%V``, ``%S``, and ``%R``. " "(Contributed by Ysj Ray and Victor Stinner in :issue:`7330`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1910 +#: ../../whatsnew/3.4.rst:1909 msgid "" "New function :c:func:`PyStructSequence_InitType2` supplements the existing :" "c:func:`PyStructSequence_InitType` function. The difference is that it " "returns ``0`` on success and ``-1`` on failure." msgstr "" -#: ../../whatsnew/3.4.rst:1914 +#: ../../whatsnew/3.4.rst:1913 msgid "" "The CPython source can now be compiled using the address sanity checking " "features of recent versions of GCC and clang: the false alarms in the small " @@ -2733,7 +2734,7 @@ msgid "" "`18596`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1919 +#: ../../whatsnew/3.4.rst:1918 msgid "" "The Windows build now uses `Address Space Layout Randomization `_ and `Data Execution " @@ -2741,17 +2742,17 @@ msgid "" "(Contributed by Christian Heimes in :issue:`16632`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1924 +#: ../../whatsnew/3.4.rst:1923 msgid "" "New function :c:func:`PyObject_LengthHint` is the C API equivalent of :func:" "`operator.length_hint`. (Contributed by Armin Ronacher in :issue:`16148`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1932 +#: ../../whatsnew/3.4.rst:1931 msgid "Other Improvements" msgstr "" -#: ../../whatsnew/3.4.rst:1936 +#: ../../whatsnew/3.4.rst:1935 msgid "" "The :ref:`python ` command has a new :ref:`option `, ``-I``, which causes it to run in \"isolated mode\", " @@ -2765,7 +2766,7 @@ msgid "" "scripts. (Contributed by Christian Heimes in :issue:`16499`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1947 +#: ../../whatsnew/3.4.rst:1946 msgid "" "Tab-completion is now enabled by default in the interactive interpreter on " "systems that support :mod:`readline`. History is also enabled by default, " @@ -2773,7 +2774,7 @@ msgid "" "(Contributed by Antoine Pitrou and Éric Araujo in :issue:`5845`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1952 +#: ../../whatsnew/3.4.rst:1951 msgid "" "Invoking the Python interpreter with ``--version`` now outputs the version " "to standard output instead of standard error (:issue:`18338`). Similar " @@ -2781,7 +2782,7 @@ msgid "" "have script-like invocation capabilities (:issue:`18922`)." msgstr "" -#: ../../whatsnew/3.4.rst:1957 +#: ../../whatsnew/3.4.rst:1956 msgid "" "The CPython Windows installer now adds ``.py`` to the :envvar:`PATHEXT` " "variable when extensions are registered, allowing users to run a python " @@ -2789,40 +2790,40 @@ msgid "" "py`` extension. (Contributed by Paul Moore in :issue:`18569`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1962 +#: ../../whatsnew/3.4.rst:1961 msgid "" "A new ``make`` target `coverage-report `_ will build python, run " "the test suite, and generate an HTML coverage report for the C codebase " -"using ``gcov`` and `lcov `_." +"using ``gcov`` and `lcov `_." msgstr "" -#: ../../whatsnew/3.4.rst:1968 +#: ../../whatsnew/3.4.rst:1967 msgid "" "The ``-R`` option to the :ref:`python regression test suite ` now " "also checks for memory allocation leaks, using :func:`sys." "getallocatedblocks`. (Contributed by Antoine Pitrou in :issue:`13390`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1973 +#: ../../whatsnew/3.4.rst:1972 msgid "``python -m`` now works with namespace packages." msgstr "" -#: ../../whatsnew/3.4.rst:1975 +#: ../../whatsnew/3.4.rst:1974 msgid "" "The :mod:`stat` module is now implemented in C, which means it gets the " "values for its constants from the C header files, instead of having the " "values hard-coded in the python module as was previously the case." msgstr "" -#: ../../whatsnew/3.4.rst:1979 +#: ../../whatsnew/3.4.rst:1978 msgid "" "Loading multiple python modules from a single OS module (``.so``, ``.dll``) " "now works correctly (previously it silently returned the first python module " "in the file). (Contributed by Václav Šmilauer in :issue:`16421`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1983 +#: ../../whatsnew/3.4.rst:1982 msgid "" "A new opcode, :opcode:`LOAD_CLASSDEREF`, has been added to fix a bug in the " "loading of free variables in class bodies that could be triggered by certain " @@ -2830,21 +2831,21 @@ msgid "" "issue:`17853`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1988 +#: ../../whatsnew/3.4.rst:1987 msgid "" "A number of MemoryError-related crashes were identified and fixed by Victor " "Stinner using his :pep:`445`-based ``pyfailmalloc`` tool (:issue:`18408`, :" "issue:`18520`)." msgstr "" -#: ../../whatsnew/3.4.rst:1992 +#: ../../whatsnew/3.4.rst:1991 msgid "" "The ``pyvenv`` command now accepts a ``--copies`` option to use copies " "rather than symlinks even on systems where symlinks are the default. " "(Contributed by Vinay Sajip in :issue:`18807`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1996 +#: ../../whatsnew/3.4.rst:1995 msgid "" "The ``pyvenv`` command also accepts a ``--without-pip`` option to suppress " "the otherwise-automatic bootstrapping of pip into the virtual environment. " @@ -2852,7 +2853,7 @@ msgid "" "implementation.)" msgstr "" -#: ../../whatsnew/3.4.rst:2001 +#: ../../whatsnew/3.4.rst:2000 msgid "" "The encoding name is now optional in the value set for the :envvar:" "`PYTHONIOENCODING` environment variable. This makes it possible to set just " @@ -2860,24 +2861,24 @@ msgid "" "Serhiy Storchaka in :issue:`18818`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2006 +#: ../../whatsnew/3.4.rst:2005 msgid "" "The :mod:`bz2`, :mod:`lzma`, and :mod:`gzip` module ``open`` functions now " "support ``x`` (exclusive creation) mode. (Contributed by Tim Heaney and " "Vajrasky Kok in :issue:`19201`, :issue:`19222`, and :issue:`19223`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2012 +#: ../../whatsnew/3.4.rst:2011 msgid "Significant Optimizations" msgstr "顯著最佳化" -#: ../../whatsnew/3.4.rst:2014 +#: ../../whatsnew/3.4.rst:2013 msgid "" "The UTF-32 decoder is now 3x to 4x faster. (Contributed by Serhiy Storchaka " "in :issue:`14625`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2017 +#: ../../whatsnew/3.4.rst:2016 msgid "" "The cost of hash collisions for sets is now reduced. Each hash table probe " "now checks a series of consecutive, adjacent key/hash pairs before " @@ -2890,7 +2891,7 @@ msgid "" "Raymond Hettinger in :issue:`18771`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2028 +#: ../../whatsnew/3.4.rst:2027 msgid "" "The interpreter starts about 30% faster. A couple of measures lead to the " "speedup. The interpreter loads fewer modules on startup, e.g. the :mod:" @@ -2901,27 +2902,27 @@ msgid "" "`19209`, :issue:`19205` and :issue:`9548`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2036 +#: ../../whatsnew/3.4.rst:2035 msgid "" ":class:`bz2.BZ2File` is now as fast or faster than the Python2 version for " "most cases. :class:`lzma.LZMAFile` has also been optimized. (Contributed " "by Serhiy Storchaka and Nadeem Vawda in :issue:`16034`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2040 +#: ../../whatsnew/3.4.rst:2039 msgid "" ":func:`random.getrandbits` is 20%-40% faster for small integers (the most " "common use case). (Contributed by Serhiy Storchaka in :issue:`16674`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2043 +#: ../../whatsnew/3.4.rst:2042 msgid "" "By taking advantage of the new storage format for strings, pickling of " "strings is now significantly faster. (Contributed by Victor Stinner and " "Antoine Pitrou in :issue:`15596`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2047 +#: ../../whatsnew/3.4.rst:2046 msgid "" "A performance issue in :meth:`io.FileIO.readall` has been solved. This " "particularly affects Windows, and significantly speeds up the case of piping " @@ -2929,31 +2930,31 @@ msgid "" "Richard Oudkerk in :issue:`15758`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2052 +#: ../../whatsnew/3.4.rst:2051 msgid "" ":func:`html.escape` is now 10x faster. (Contributed by Matt Bryant in :" "issue:`18020`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2055 +#: ../../whatsnew/3.4.rst:2054 msgid "" "On Windows, the native ``VirtualAlloc`` is now used instead of the CRT " "``malloc`` in ``obmalloc``. Artificial benchmarks show about a 3% memory " "savings." msgstr "" -#: ../../whatsnew/3.4.rst:2059 +#: ../../whatsnew/3.4.rst:2058 msgid "" ":func:`os.urandom` now uses a lazily opened persistent file descriptor so as " "to avoid using many file descriptors when run in parallel from multiple " "threads. (Contributed by Antoine Pitrou in :issue:`18756`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2067 +#: ../../whatsnew/3.4.rst:2066 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.4.rst:2069 +#: ../../whatsnew/3.4.rst:2068 msgid "" "This section covers various APIs and other features that have been " "deprecated in Python 3.4, and will be removed in Python 3.5 or later. In " @@ -2962,11 +2963,11 @@ msgid "" "enabled (for example, by using ``-Wd``)." msgstr "" -#: ../../whatsnew/3.4.rst:2077 +#: ../../whatsnew/3.4.rst:2076 msgid "Deprecations in the Python API" msgstr "" -#: ../../whatsnew/3.4.rst:2079 +#: ../../whatsnew/3.4.rst:2078 msgid "" "As mentioned in :ref:`whatsnew-pep-451`, a number of :mod:`importlib` " "methods and functions are deprecated: :meth:`!importlib.find_loader` is " @@ -2989,45 +2990,45 @@ msgid "" "now handled automatically by the import system." msgstr "" -#: ../../whatsnew/3.4.rst:2104 +#: ../../whatsnew/3.4.rst:2103 msgid "" "The :mod:`!imp` module is pending deprecation. To keep compatibility with " "Python 2/3 code bases, the module's removal is currently not scheduled." msgstr "" -#: ../../whatsnew/3.4.rst:2107 +#: ../../whatsnew/3.4.rst:2106 msgid "" "The :mod:`formatter` module is pending deprecation and is slated for removal " "in Python 3.6." msgstr "" -#: ../../whatsnew/3.4.rst:2110 +#: ../../whatsnew/3.4.rst:2109 msgid "" "``MD5`` as the default *digestmod* for the :func:`hmac.new` function is " "deprecated. Python 3.6 will require an explicit digest name or constructor " "as *digestmod* argument." msgstr "" -#: ../../whatsnew/3.4.rst:2114 +#: ../../whatsnew/3.4.rst:2113 msgid "" "The internal ``Netrc`` class in the :mod:`ftplib` module has been documented " "as deprecated in its docstring for quite some time. It now emits a :exc:" "`DeprecationWarning` and will be removed completely in Python 3.5." msgstr "" -#: ../../whatsnew/3.4.rst:2118 +#: ../../whatsnew/3.4.rst:2117 msgid "" "The undocumented *endtime* argument to :meth:`subprocess.Popen.wait` should " "not have been exposed and is hopefully not in use; it is deprecated and will " "mostly likely be removed in Python 3.5." msgstr "" -#: ../../whatsnew/3.4.rst:2122 +#: ../../whatsnew/3.4.rst:2121 msgid "" "The *strict* argument of :class:`~html.parser.HTMLParser` is deprecated." msgstr "" -#: ../../whatsnew/3.4.rst:2124 +#: ../../whatsnew/3.4.rst:2123 msgid "" "The :mod:`plistlib` :func:`~plistlib.readPlist`, :func:`~plistlib." "writePlist`, :func:`~plistlib.readPlistFromBytes`, and :func:`~plistlib." @@ -3037,13 +3038,13 @@ msgid "" "deprecated in favor of just using the :class:`bytes` constructor." msgstr "" -#: ../../whatsnew/3.4.rst:2131 +#: ../../whatsnew/3.4.rst:2130 msgid "" "The :mod:`sysconfig` key ``SO`` is deprecated, it has been replaced by " "``EXT_SUFFIX``." msgstr "" -#: ../../whatsnew/3.4.rst:2134 +#: ../../whatsnew/3.4.rst:2133 msgid "" "The ``U`` mode accepted by various ``open`` functions is deprecated. In " "Python3 it does not do anything useful, and should be replaced by " @@ -3051,7 +3052,7 @@ msgid "" "argument." msgstr "" -#: ../../whatsnew/3.4.rst:2139 +#: ../../whatsnew/3.4.rst:2138 msgid "" "The *parser* argument of :func:`xml.etree.ElementTree.iterparse` has been " "deprecated, as has the *html* argument of :func:`~xml.etree.ElementTree." @@ -3059,97 +3060,97 @@ msgid "" "``XMLParser`` should be passed by keyword." msgstr "" -#: ../../whatsnew/3.4.rst:2146 +#: ../../whatsnew/3.4.rst:2145 msgid "Deprecated Features" msgstr "已棄用功能" -#: ../../whatsnew/3.4.rst:2148 +#: ../../whatsnew/3.4.rst:2147 msgid "" "Running :ref:`idle` with the ``-n`` flag (no subprocess) is deprecated. " "However, the feature will not be removed until :issue:`18823` is resolved." msgstr "" -#: ../../whatsnew/3.4.rst:2151 +#: ../../whatsnew/3.4.rst:2150 msgid "" "The site module adding a \"site-python\" directory to sys.path, if it " "exists, is deprecated (:issue:`19375`)." msgstr "" -#: ../../whatsnew/3.4.rst:2157 +#: ../../whatsnew/3.4.rst:2156 msgid "Removed" msgstr "已移除" -#: ../../whatsnew/3.4.rst:2161 +#: ../../whatsnew/3.4.rst:2160 msgid "Operating Systems No Longer Supported" msgstr "" -#: ../../whatsnew/3.4.rst:2163 +#: ../../whatsnew/3.4.rst:2162 msgid "" "Support for the following operating systems has been removed from the source " "and build tools:" msgstr "" -#: ../../whatsnew/3.4.rst:2166 +#: ../../whatsnew/3.4.rst:2165 msgid "OS/2 (:issue:`16135`)." msgstr "OS/2 (:issue:`16135`)。" -#: ../../whatsnew/3.4.rst:2167 +#: ../../whatsnew/3.4.rst:2166 msgid "Windows 2000 (changeset e52df05b496a)." msgstr "" -#: ../../whatsnew/3.4.rst:2168 +#: ../../whatsnew/3.4.rst:2167 msgid "" "Windows systems where ``COMSPEC`` points to ``command.com`` (:issue:`14470`)." msgstr "" -#: ../../whatsnew/3.4.rst:2169 +#: ../../whatsnew/3.4.rst:2168 msgid "VMS (:issue:`16136`)." msgstr "VMS (:issue:`16136`)。" -#: ../../whatsnew/3.4.rst:2173 +#: ../../whatsnew/3.4.rst:2172 msgid "API and Feature Removals" msgstr "API 與功能的移除" -#: ../../whatsnew/3.4.rst:2175 +#: ../../whatsnew/3.4.rst:2174 msgid "" "The following obsolete and previously deprecated APIs and features have been " "removed:" msgstr "" -#: ../../whatsnew/3.4.rst:2178 +#: ../../whatsnew/3.4.rst:2177 msgid "" "The unmaintained ``Misc/TextMate`` and ``Misc/vim`` directories have been " "removed (see the `devguide `_ for suggestions " "on what to use instead)." msgstr "" -#: ../../whatsnew/3.4.rst:2182 +#: ../../whatsnew/3.4.rst:2181 msgid "" "The ``SO`` makefile macro is removed (it was replaced by the " "``SHLIB_SUFFIX`` and ``EXT_SUFFIX`` macros) (:issue:`16754`)." msgstr "" -#: ../../whatsnew/3.4.rst:2185 +#: ../../whatsnew/3.4.rst:2184 msgid "" "The ``PyThreadState.tick_counter`` field has been removed; its value has " "been meaningless since Python 3.2, when the \"new GIL\" was introduced (:" "issue:`19199`)." msgstr "" -#: ../../whatsnew/3.4.rst:2189 +#: ../../whatsnew/3.4.rst:2188 msgid "" "``PyLoader`` and ``PyPycLoader`` have been removed from :mod:`importlib`. " "(Contributed by Taras Lyapun in :issue:`15641`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2192 +#: ../../whatsnew/3.4.rst:2191 msgid "" "The *strict* argument to :class:`~http.client.HTTPConnection` and :class:" "`~http.client.HTTPSConnection` has been removed. HTTP 0.9-style \"Simple " "Responses\" are no longer supported." msgstr "" -#: ../../whatsnew/3.4.rst:2196 +#: ../../whatsnew/3.4.rst:2195 msgid "" "The deprecated :mod:`urllib.request.Request` getter and setter methods " "``add_data``, ``has_data``, ``get_data``, ``get_type``, ``get_host``, " @@ -3157,19 +3158,19 @@ msgid "" "``is_unverifiable`` have been removed (use direct attribute access instead)." msgstr "" -#: ../../whatsnew/3.4.rst:2201 +#: ../../whatsnew/3.4.rst:2200 msgid "" "Support for loading the deprecated ``TYPE_INT64`` has been removed from :mod:" "`marshal`. (Contributed by Dan Riti in :issue:`15480`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2204 +#: ../../whatsnew/3.4.rst:2203 msgid "" ":class:`inspect.Signature`: positional-only parameters are now required to " "have a valid name." msgstr "" -#: ../../whatsnew/3.4.rst:2207 +#: ../../whatsnew/3.4.rst:2206 msgid "" ":meth:`object.__format__` no longer accepts non-empty format strings, it now " "raises a :exc:`TypeError` instead. Using a non-empty string has been " @@ -3181,7 +3182,7 @@ msgid "" "`7994` for background." msgstr "" -#: ../../whatsnew/3.4.rst:2216 +#: ../../whatsnew/3.4.rst:2215 msgid "" ":meth:`difflib.SequenceMatcher.isbjunk` and :meth:`difflib.SequenceMatcher." "isbpopular` were deprecated in 3.2, and have now been removed: use ``x in sm." @@ -3189,17 +3190,17 @@ msgid "" "SequenceMatcher` object (:issue:`13248`)." msgstr "" -#: ../../whatsnew/3.4.rst:2224 +#: ../../whatsnew/3.4.rst:2223 msgid "Code Cleanups" msgstr "程式碼的清除" -#: ../../whatsnew/3.4.rst:2226 +#: ../../whatsnew/3.4.rst:2225 msgid "" "The unused and undocumented internal ``Scanner`` class has been removed from " "the :mod:`pydoc` module." msgstr "" -#: ../../whatsnew/3.4.rst:2229 +#: ../../whatsnew/3.4.rst:2228 msgid "" "The private and effectively unused ``_gestalt`` module has been removed, " "along with the private :mod:`platform` functions ``_mac_ver_lookup``, " @@ -3207,27 +3208,27 @@ msgid "" "called on badly broken OSX systems (see :issue:`18393`)." msgstr "" -#: ../../whatsnew/3.4.rst:2234 +#: ../../whatsnew/3.4.rst:2233 msgid "" "The hardcoded copies of certain :mod:`stat` constants that were included in " "the :mod:`tarfile` module namespace have been removed." msgstr "" -#: ../../whatsnew/3.4.rst:2240 +#: ../../whatsnew/3.4.rst:2239 msgid "Porting to Python 3.4" msgstr "" -#: ../../whatsnew/3.4.rst:2242 +#: ../../whatsnew/3.4.rst:2241 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.4.rst:2247 +#: ../../whatsnew/3.4.rst:2246 msgid "Changes in 'python' Command Behavior" msgstr "" -#: ../../whatsnew/3.4.rst:2249 +#: ../../whatsnew/3.4.rst:2248 msgid "" "In a posix shell, setting the :envvar:`PATH` environment variable to an " "empty value is equivalent to not setting it at all. However, setting :" @@ -3238,25 +3239,25 @@ msgid "" "for :envvar:`PATH`." msgstr "" -#: ../../whatsnew/3.4.rst:2257 +#: ../../whatsnew/3.4.rst:2256 msgid "" "The [X refs, Y blocks] output of a debug (``--with-pydebug``) build of the " "CPython interpreter is now off by default. It can be re-enabled using the " "``-X showrefcount`` option. (Contributed by Ezio Melotti in :issue:`17323`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2261 +#: ../../whatsnew/3.4.rst:2260 msgid "" "The python command and most stdlib scripts (as well as :mod:`argparse`) now " "output ``--version`` information to ``stdout`` instead of ``stderr`` (for " "issue list see :ref:`other-improvements-3.4` above)." msgstr "" -#: ../../whatsnew/3.4.rst:2267 +#: ../../whatsnew/3.4.rst:2266 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.4.rst:2269 +#: ../../whatsnew/3.4.rst:2268 msgid "" "The ABCs defined in :mod:`importlib.abc` now either raise the appropriate " "exception or return a default value instead of raising :exc:" @@ -3265,7 +3266,7 @@ msgid "" "catch both :exc:`NotImplementedError` or the appropriate exception as needed." msgstr "" -#: ../../whatsnew/3.4.rst:2275 +#: ../../whatsnew/3.4.rst:2274 msgid "" "The module type now initializes the :attr:`__package__` and :attr:" "`__loader__` attributes to ``None`` by default. To determine if these " @@ -3273,7 +3274,7 @@ msgid "" "``getattr(module, '__loader__', None) is not None``. (:issue:`17115`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2280 +#: ../../whatsnew/3.4.rst:2279 msgid "" ":meth:`!importlib.util.module_for_loader` now sets ``__loader__`` and " "``__package__`` unconditionally to properly support reloading. If this is " @@ -3281,7 +3282,7 @@ msgid "" "use :func:`importlib.util.module_to_load` for module management." msgstr "" -#: ../../whatsnew/3.4.rst:2285 +#: ../../whatsnew/3.4.rst:2284 msgid "" "Import now resets relevant attributes (e.g. ``__name__``, ``__loader__``, " "``__package__``, ``__file__``, ``__cached__``) unconditionally when " @@ -3289,7 +3290,7 @@ msgid "" "module is re-found when re-loaded (:issue:`19413`)." msgstr "" -#: ../../whatsnew/3.4.rst:2290 +#: ../../whatsnew/3.4.rst:2289 msgid "" "Frozen packages no longer set ``__path__`` to a list containing the package " "name, they now set it to an empty list. The previous behavior could cause " @@ -3299,7 +3300,7 @@ msgid "" "'__path__')`` (:issue:`18065`)." msgstr "" -#: ../../whatsnew/3.4.rst:2297 +#: ../../whatsnew/3.4.rst:2296 msgid "" "Frozen modules no longer define a ``__file__`` attribute. It's semantically " "incorrect for frozen modules to set the attribute as they are not loaded " @@ -3310,7 +3311,7 @@ msgid "" "use :func:`!imp.is_frozen`." msgstr "" -#: ../../whatsnew/3.4.rst:2305 +#: ../../whatsnew/3.4.rst:2304 msgid "" ":func:`py_compile.compile` now raises :exc:`FileExistsError` if the file " "path it would write to is a symlink or a non-regular file. This is to act as " @@ -3318,7 +3319,7 @@ msgid "" "regardless of what type of file path they were originally." msgstr "" -#: ../../whatsnew/3.4.rst:2310 +#: ../../whatsnew/3.4.rst:2309 msgid "" ":meth:`importlib.abc.SourceLoader.get_source` no longer raises :exc:" "`ImportError` when the source code being loaded triggers a :exc:" @@ -3330,7 +3331,7 @@ msgid "" "exceptions now." msgstr "" -#: ../../whatsnew/3.4.rst:2319 +#: ../../whatsnew/3.4.rst:2318 msgid "" ":func:`functools.update_wrapper` and :func:`functools.wraps` now correctly " "set the ``__wrapped__`` attribute to the function being wrapped, even if " @@ -3342,7 +3343,7 @@ msgid "" "function in the chain that has no ``__wrapped__`` attribute." msgstr "" -#: ../../whatsnew/3.4.rst:2329 +#: ../../whatsnew/3.4.rst:2328 msgid "" ":func:`inspect.getfullargspec` has been reimplemented on top of :func:" "`inspect.signature` and hence handles a much wider variety of callable " @@ -3352,7 +3353,7 @@ msgid "" "will fail on non-Python callables may need to be adjusted accordingly." msgstr "" -#: ../../whatsnew/3.4.rst:2337 +#: ../../whatsnew/3.4.rst:2336 msgid "" ":class:`importlib.machinery.PathFinder` now passes on the current working " "directory to objects in :data:`sys.path_hooks` for the empty string. This " @@ -3366,7 +3367,7 @@ msgid "" "`18416`)." msgstr "" -#: ../../whatsnew/3.4.rst:2348 +#: ../../whatsnew/3.4.rst:2347 msgid "" "The removal of the *strict* argument to :class:`~http.client.HTTPConnection` " "and :class:`~http.client.HTTPSConnection` changes the meaning of the " @@ -3375,7 +3376,7 @@ msgid "" "should already be specifying any additional arguments via keywords." msgstr "" -#: ../../whatsnew/3.4.rst:2354 +#: ../../whatsnew/3.4.rst:2353 msgid "" "Strings between ``from __future__ import ...`` statements now *always* raise " "a :exc:`SyntaxError`. Previously if there was no leading docstring, an " @@ -3384,7 +3385,7 @@ msgid "" "`17434`)." msgstr "" -#: ../../whatsnew/3.4.rst:2360 +#: ../../whatsnew/3.4.rst:2359 msgid "" ":meth:`ssl.SSLSocket.getpeercert` and :meth:`ssl.SSLSocket.do_handshake` now " "raise an :exc:`OSError` with ``ENOTCONN`` when the ``SSLSocket`` is not " @@ -3393,7 +3394,7 @@ msgid "" "raise a :exc:`ValueError` if the handshake has not yet been done." msgstr "" -#: ../../whatsnew/3.4.rst:2366 +#: ../../whatsnew/3.4.rst:2365 msgid "" ":func:`base64.b32decode` now raises a :exc:`binascii.Error` when the input " "string contains non-b32-alphabet characters, instead of a :exc:`TypeError`. " @@ -3402,7 +3403,7 @@ msgid "" "`18011`.) Note: this change was also inadvertently applied in Python 3.3.3." msgstr "" -#: ../../whatsnew/3.4.rst:2373 +#: ../../whatsnew/3.4.rst:2372 msgid "" "The :attr:`!file` attribute is now automatically closed when the creating :" "class:`!cgi.FieldStorage` instance is garbage collected. If you were pulling " @@ -3412,14 +3413,14 @@ msgid "" "the :class:`!cgi.FieldStorage` instance is garbage collected." msgstr "" -#: ../../whatsnew/3.4.rst:2380 +#: ../../whatsnew/3.4.rst:2379 msgid "" "Calling ``read`` or ``write`` on a closed SSL socket now raises an " "informative :exc:`ValueError` rather than the previous more mysterious :exc:" "`AttributeError` (:issue:`9177`)." msgstr "" -#: ../../whatsnew/3.4.rst:2384 +#: ../../whatsnew/3.4.rst:2383 msgid "" ":meth:`slice.indices` no longer produces an :exc:`OverflowError` for huge " "values. As a consequence of this fix, :meth:`slice.indices` now raises a :" @@ -3427,7 +3428,7 @@ msgid "" "values (:issue:`14794`)." msgstr "" -#: ../../whatsnew/3.4.rst:2389 +#: ../../whatsnew/3.4.rst:2388 msgid "" "The :class:`complex` constructor, unlike the :mod:`cmath` functions, was " "incorrectly accepting :class:`float` values if an object's ``__complex__`` " @@ -3435,21 +3436,21 @@ msgid "" "`16290`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2394 +#: ../../whatsnew/3.4.rst:2393 msgid "" "The :class:`int` constructor in 3.2 and 3.3 erroneously accepts :class:" "`float` values for the *base* parameter. It is unlikely anyone was doing " "this, but if so, it will now raise a :exc:`TypeError` (:issue:`16772`)." msgstr "" -#: ../../whatsnew/3.4.rst:2398 +#: ../../whatsnew/3.4.rst:2397 msgid "" "Defaults for keyword-only arguments are now evaluated *after* defaults for " "regular keyword arguments, instead of before. Hopefully no one wrote any " "code that depends on the previous buggy behavior (:issue:`16967`)." msgstr "" -#: ../../whatsnew/3.4.rst:2402 +#: ../../whatsnew/3.4.rst:2401 msgid "" "Stale thread states are now cleared after :func:`~os.fork`. This may cause " "some system resources to be released that previously were incorrectly kept " @@ -3457,21 +3458,21 @@ msgid "" "storage). (:issue:`17094`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2407 +#: ../../whatsnew/3.4.rst:2406 msgid "" "Parameter names in ``__annotations__`` dicts are now mangled properly, " "similarly to :attr:`~function.__kwdefaults__`. (Contributed by Yury " "Selivanov in :issue:`20625`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2411 +#: ../../whatsnew/3.4.rst:2410 msgid "" ":attr:`hashlib.hash.name` now always returns the identifier in lower case. " "Previously some builtin hashes had uppercase names, but now that it is a " "formal public interface the naming has been made consistent (:issue:`18532`)." msgstr "" -#: ../../whatsnew/3.4.rst:2415 +#: ../../whatsnew/3.4.rst:2414 msgid "" "Because :mod:`unittest.TestSuite` now drops references to tests after they " "are run, test harnesses that reuse a :class:`~unittest.TestSuite` to re-run " @@ -3484,7 +3485,7 @@ msgid "" "__iter__`) (:issue:`11798`)." msgstr "" -#: ../../whatsnew/3.4.rst:2425 +#: ../../whatsnew/3.4.rst:2424 msgid "" ":mod:`unittest` now uses :mod:`argparse` for command line parsing. There " "are certain invalid command forms that used to work that are no longer " @@ -3493,7 +3494,7 @@ msgid "" "use." msgstr "" -#: ../../whatsnew/3.4.rst:2430 +#: ../../whatsnew/3.4.rst:2429 msgid "" "The :func:`re.split`, :func:`re.findall`, and :func:`re.sub` functions, and " "the :meth:`~re.match.group` and :meth:`~re.match.groups` methods of " @@ -3503,13 +3504,13 @@ msgid "" "say, a ``bytearray``, you will need to change your code." msgstr "" -#: ../../whatsnew/3.4.rst:2437 +#: ../../whatsnew/3.4.rst:2436 msgid "" ":mod:`!audioop` functions now raise an error immediately if passed string " "input, instead of failing randomly later on (:issue:`16685`)." msgstr "" -#: ../../whatsnew/3.4.rst:2440 +#: ../../whatsnew/3.4.rst:2439 msgid "" "The new *convert_charrefs* argument to :class:`~html.parser.HTMLParser` " "currently defaults to ``False`` for backward compatibility, but will " @@ -3518,14 +3519,14 @@ msgid "" "HTMLParser` calls in your code (:issue:`13633`)." msgstr "" -#: ../../whatsnew/3.4.rst:2446 +#: ../../whatsnew/3.4.rst:2445 msgid "" "Since the *digestmod* argument to the :func:`hmac.new` function will in the " "future have no default, all calls to :func:`hmac.new` should be changed to " "explicitly specify a *digestmod* (:issue:`17276`)." msgstr "" -#: ../../whatsnew/3.4.rst:2450 +#: ../../whatsnew/3.4.rst:2449 msgid "" "Calling :func:`sysconfig.get_config_var` with the ``SO`` key, or looking " "``SO`` up in the results of a call to :func:`sysconfig.get_config_vars` is " @@ -3533,7 +3534,7 @@ msgid "" "``SHLIB_SUFFIX``, depending on the context (:issue:`19555`)." msgstr "" -#: ../../whatsnew/3.4.rst:2455 +#: ../../whatsnew/3.4.rst:2454 msgid "" "Any calls to ``open`` functions that specify ``U`` should be modified. ``U`` " "is ineffective in Python3 and will eventually raise an error if used. " @@ -3543,13 +3544,13 @@ msgid "" "`15204`)." msgstr "" -#: ../../whatsnew/3.4.rst:2462 +#: ../../whatsnew/3.4.rst:2461 msgid "" "If you use ``pyvenv`` in a script and desire that pip *not* be installed, " "you must add ``--without-pip`` to your command invocation." msgstr "" -#: ../../whatsnew/3.4.rst:2466 +#: ../../whatsnew/3.4.rst:2465 msgid "" "The default behavior of :func:`json.dump` and :func:`json.dumps` when an " "indent is specified has changed: it no longer produces trailing spaces after " @@ -3558,7 +3559,7 @@ msgid "" "output (:issue:`16333`)." msgstr "" -#: ../../whatsnew/3.4.rst:2472 +#: ../../whatsnew/3.4.rst:2471 msgid "" ":mod:`doctest` now looks for doctests in extension module ``__doc__`` " "strings, so if your doctest test discovery includes extension modules that " @@ -3566,7 +3567,7 @@ msgid "" "never seen before when running your tests (:issue:`3158`)." msgstr "" -#: ../../whatsnew/3.4.rst:2477 +#: ../../whatsnew/3.4.rst:2476 msgid "" "The :mod:`collections.abc` module has been slightly refactored as part of " "the Python startup improvements. As a consequence of this, it is no longer " @@ -3576,11 +3577,11 @@ msgid "" "`20784`)." msgstr "" -#: ../../whatsnew/3.4.rst:2486 +#: ../../whatsnew/3.4.rst:2485 msgid "Changes in the C API" msgstr "C API 中的改動" -#: ../../whatsnew/3.4.rst:2488 +#: ../../whatsnew/3.4.rst:2487 msgid "" ":c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr`, and :c:func:" "`PyObject_Str`, along with some other internal C APIs, now include a " @@ -3594,14 +3595,14 @@ msgid "" "version of Python that is compiled with assertions enabled." msgstr "" -#: ../../whatsnew/3.4.rst:2500 +#: ../../whatsnew/3.4.rst:2499 msgid "" ":c:func:`PyErr_SetImportError` now sets :exc:`TypeError` when its **msg** " "argument is not set. Previously only ``NULL`` was returned with no exception " "set." msgstr "" -#: ../../whatsnew/3.4.rst:2504 +#: ../../whatsnew/3.4.rst:2503 msgid "" "The result of the :c:data:`PyOS_ReadlineFunctionPointer` callback must now " "be a string allocated by :c:func:`PyMem_RawMalloc` or :c:func:" @@ -3610,30 +3611,30 @@ msgid "" "`16742`)" msgstr "" -#: ../../whatsnew/3.4.rst:2510 +#: ../../whatsnew/3.4.rst:2509 msgid "" ":c:func:`PyThread_set_key_value` now always set the value. In Python 3.3, " "the function did nothing if the key already exists (if the current value is " "a non-``NULL`` pointer)." msgstr "" -#: ../../whatsnew/3.4.rst:2514 +#: ../../whatsnew/3.4.rst:2513 msgid "" "The ``f_tstate`` (thread state) field of the :c:type:`PyFrameObject` " "structure has been removed to fix a bug: see :issue:`14432` for the " "rationale." msgstr "" -#: ../../whatsnew/3.4.rst:2519 +#: ../../whatsnew/3.4.rst:2518 msgid "Changed in 3.4.3" msgstr "3.4.3 中的變更" -#: ../../whatsnew/3.4.rst:2524 +#: ../../whatsnew/3.4.rst:2523 msgid "" "PEP 476: Enabling certificate verification by default for stdlib http clients" msgstr "" -#: ../../whatsnew/3.4.rst:2526 +#: ../../whatsnew/3.4.rst:2525 msgid "" ":mod:`http.client` and modules which use it, such as :mod:`urllib.request` " "and :mod:`xmlrpc.client`, will now verify that the server presents a " @@ -3642,13 +3643,13 @@ msgid "" "improving security for many applications." msgstr "" -#: ../../whatsnew/3.4.rst:2532 +#: ../../whatsnew/3.4.rst:2531 msgid "" "For applications which require the old previous behavior, they can pass an " "alternate context::" msgstr "" -#: ../../whatsnew/3.4.rst:2535 +#: ../../whatsnew/3.4.rst:2534 msgid "" "import urllib.request\n" "import ssl\n" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index c1c198bda7..2d895c796f 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -531,9 +531,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:356 msgid "" -"`Measurements `_ show that on Linux and Windows the resolution of :func:`time." -"time_ns` is approximately 3 times better than that of :func:`time.time`." +":pep:`Measurements <0564#annex-clocks-resolution-in-python>` show that on " +"Linux and Windows the resolution of :func:`time.time_ns` is approximately 3 " +"times better than that of :func:`time.time`." msgstr "" #: ../../whatsnew/3.7.rst:362 diff --git a/whatsnew/3.8.po b/whatsnew/3.8.po index 15f3d8d588..5603747792 100644 --- a/whatsnew/3.8.po +++ b/whatsnew/3.8.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -2783,7 +2783,7 @@ msgid "" "Starting with Python 3.3, importing ABCs from :mod:`collections` was " "deprecated, and importing should be done from :mod:`collections.abc`. Being " "able to import from collections was marked for removal in 3.8, but has been " -"delayed to 3.9. (See :issue:`36952`.)" +"delayed to 3.9. (See :gh:`81134`.)" msgstr "" #: ../../whatsnew/3.8.rst:1760 From b1e286609fe34166fa03bc4a6b137a9fa0ecdae0 Mon Sep 17 00:00:00 2001 From: Kisaragi Hiu Date: Tue, 24 Sep 2024 20:35:11 +0900 Subject: [PATCH 25/89] translate reference/datamodel.po (#941) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * translate reference/datamodel.po * Remove extraneous syntax escape as suggested Co-authored-by: Wei-Hsiang (Matt) Wang * Address review - Mutable and Immutable are 可變 and 不可變 when being defined - 你 is used here and not 您 - Apply Matt's review for GC: 垃圾回收如何進行完全是各個實作自己的事項,唯一擔保是仍然可存取的物件絕不會被回收。 -> 垃圾回收如何進行完全取決於各個實作,只要沒有被回收的物件仍是可達的。 - Revise away "單層" - Apply review for 型別幾乎影響物件行為的所有面向 * Translate missed source text update --------- Co-authored-by: Wei-Hsiang (Matt) Wang --- reference/datamodel.po | 109 +++++++++++++++++++++++++++++++++-------- 1 file changed, 88 insertions(+), 21 deletions(-) diff --git a/reference/datamodel.po b/reference/datamodel.po index 66e8a576fa..0d583e4d37 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -2,13 +2,15 @@ # This file is distributed under the same license as the Python package. # # Translators: +# Adrian Liaw , 2018 +# Kisaragi Hiu , 2024 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" -"PO-Revision-Date: 2018-05-23 16:17+0000\n" -"Last-Translator: Adrian Liaw \n" +"POT-Creation-Date: 2024-06-27 00:03+0000\n" +"PO-Revision-Date: 2024-09-24 19:03+0900\n" +"Last-Translator: Kisaragi Hiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -16,6 +18,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Lokalize 24.08.1\n" #: ../../reference/datamodel.rst:6 msgid "Data model" @@ -23,7 +26,7 @@ msgstr "資料模型" #: ../../reference/datamodel.rst:12 msgid "Objects, values and types" -msgstr "" +msgstr "物件、數值和型別" #: ../../reference/datamodel.rst:18 msgid "" @@ -32,6 +35,9 @@ msgid "" "sense, and in conformance to Von Neumann's model of a \"stored program " "computer\", code is also represented by objects.)" msgstr "" +":dfn:`物件` 是 Python 為資料的抽象表示方式。一個 Python 程式當中的所有資料皆" +"由物件或物件之間的關係來呈現。(某種意義上,同時符合 Von Neumann 對於「儲存程" +"式型電腦」(\"stored program computer\") 的模型,程式碼也是以物件呈現的。)" #: ../../reference/datamodel.rst:35 msgid "" @@ -41,10 +47,14 @@ msgid "" "objects; the :func:`id` function returns an integer representing its " "identity." msgstr "" +"每個物件都有一個識別性、型別,和數值。物件的\\ *識別性*\\ 在物件建立後永遠不" +"會改變;你也可以把它想成是該物件在記憶體中的位址。:keyword:`is` 運算子會比較" +"兩個物件的識別性是否相同;:func:`id` 函式則會回傳代表一個該物件的識別性的整" +"數。" #: ../../reference/datamodel.rst:42 msgid "For CPython, ``id(x)`` is the memory address where ``x`` is stored." -msgstr "" +msgstr "在 CPython 當中,``id(x)`` 就是 ``x`` 所儲存在的記憶體位址。" #: ../../reference/datamodel.rst:44 msgid "" @@ -54,6 +64,10 @@ msgid "" "an object itself). Like its identity, an object's :dfn:`type` is also " "unchangeable. [#]_" msgstr "" +"一個物件的型別決定了該物件所支援的操作(例如「它有長度嗎?」),也同時定義該" +"型別的物件能夠擁有的數值。:func:`type` 函式會回傳一個物件的型別(而該型別本身" +"也是一個物件)。如同它的識別性,一個物件的型別 (:dfn:`type`) 也是不可變" +"的。\\ [#]_" #: ../../reference/datamodel.rst:50 msgid "" @@ -68,6 +82,13 @@ msgid "" "instance, numbers, strings and tuples are immutable, while dictionaries and " "lists are mutable." msgstr "" +"某些物件的\\ *數值*\\ 可被改變,這種物件稱作「可變的」(*mutable*);建立後數值" +"不能變更的物件則稱作「不可變的」(*immutable*)。(不可變的容器物件中如果包含對" +"於可變物件的參照,則後者的數值改變的時候前者的數值也會跟著一起改變;這種時候" +"該容器仍會被當成是不可變的,因為它包含的物件集合仍然無法變更。因此可變或不可" +"變嚴格說起並不等同於數值是否能被改變,它的定義有其他不明顯的細節。)一個物件" +"是否為可變取決於它的型別;舉例來說,數字、字串和 tuple 是不可變的,而字典與串" +"列則是可變的。" #: ../../reference/datamodel.rst:65 msgid "" @@ -77,6 +98,9 @@ msgid "" "implementation quality how garbage collection is implemented, as long as no " "objects are collected that are still reachable." msgstr "" +"物件永遠不會被明示的摧毀;但當它們變得不再能夠存取的時候可能會被作為垃圾回" +"收。每個實作都能延後垃圾回收或是乾脆忽略它 --- 垃圾回收如何進行完全取決於各個" +"實作,只要沒有被回收的物件仍是可達的。" #: ../../reference/datamodel.rst:73 msgid "" @@ -89,6 +113,11 @@ msgid "" "on immediate finalization of objects when they become unreachable (so you " "should always close files explicitly)." msgstr "" +"CPython 目前使用一種參照計數的方案,並提供可選的循環連結垃圾延遲偵測,這個方" +"案會在大部分物件變得不可存取時馬上回收它們,但不保證能夠回收包含循環參照的垃" +"圾。關於控制循環垃圾回收的資訊請見 :mod:`gc` 模組的說明文件。其他實作的行為不" +"會相同,CPython 也有可能改變,因此請不要仰賴物件在變得不可存取時能夠馬上被最" +"終化(亦即你應該總是明確關閉檔案)。" #: ../../reference/datamodel.rst:82 msgid "" @@ -97,6 +126,9 @@ msgid "" "catching an exception with a :keyword:`try`...\\ :keyword:`except` statement " "may keep objects alive." msgstr "" +"請注意,使用一個實作的追蹤或除錯工具可能會讓原本能夠回收的物件被維持存活。也" +"請注意,使用 :keyword:`try`...\\ :keyword:`except` 陳述式來抓捕例外也可能會讓" +"物件維持存活。" #: ../../reference/datamodel.rst:87 msgid "" @@ -109,6 +141,11 @@ msgid "" "`finally` statement and the :keyword:`with` statement provide convenient " "ways to do this." msgstr "" +"某些物件包含對於「外部」資源的參照,像是開啟的檔案或是視窗。基本上這些資源會" +"在物件被回收時釋放,但因為垃圾回收不保證會發生,這種物件也會提供明確釋放外部" +"資源的方式 --- 通常是 :meth:`!close` method。強烈建議各個程式明確關閉這種物" +"件。:keyword:`try`...\\ :keyword:`finally` 陳述式與 :keyword:`with` 陳述式提" +"供進行明確關閉的方便手段。" #: ../../reference/datamodel.rst:97 msgid "" @@ -121,6 +158,12 @@ msgid "" "implied. So, if an immutable container (like a tuple) contains a reference " "to a mutable object, its value changes if that mutable object is changed." msgstr "" +"某些物件包含對於其他物件的參照;這種物件被叫做「容器」。容器的範例有 tuple、" +"串列與字典。這些參照是容器的數值的一部分。通常當我們提到容器的數值的時候,我" +"們指的是其中包含的物件的數值,而不是它們的識別性;但當我們提到容器是否可變的" +"時候,我們指的是直接包含在其中的物件的識別性。因此,如果一個不可變的容器(像" +"一個 tuple)包含對於可變物件的參照,該可變物件被變更時該容器的數值也會跟著變" +"更。" #: ../../reference/datamodel.rst:106 msgid "" @@ -138,6 +181,15 @@ msgid "" "newly created empty lists. (Note that ``e = f = []`` assigns the *same* " "object to both *e* and *f*.)" msgstr "" +"型別幾乎影響物件行為的所有面向。就連物件識別性的重要性某種程度上也受型別影" +"響:對於不可變的型別,計算新數值的操作可能其實會回傳一個某個相同型別且相同數" +"值的現存物件的參照;對於可變型別這則不會發生。舉例來說,在進行 ``a = 1; b = " +"1`` 之後,*a* 和 *b* 可能會參照同一個物件,也可能不會,取決於所使用的實作。這" +"是因為 :class:`int` 是不可變的型別,因此 ``1`` 的參照可以重複利用。這個行為取" +"決於所使用的實作,因此不應該依賴它,但在進行物件識別性測試的時候還是需要注意" +"有這件事情。而在進行 ``c = []; d = []`` 之後,*c* 和 *d* 則保證會參照兩個不" +"同、獨特、且新建立的空白串列。(請注意,``e = f = []`` 則會將同一個物件同時指" +"派給 *e* 和 *f*。)" #: ../../reference/datamodel.rst:124 msgid "The standard type hierarchy" @@ -163,7 +215,7 @@ msgstr "" #: ../../reference/datamodel.rst:150 ../../reference/datamodel.rst:152 msgid "None" -msgstr "" +msgstr "None" #: ../../reference/datamodel.rst:154 msgid "" @@ -172,6 +224,9 @@ msgid "" "signify the absence of a value in many situations, e.g., it is returned from " "functions that don't explicitly return anything. Its truth value is false." msgstr "" +"這個型別只有一個數值。只有一個物件有這個數值。這個物件由內建名稱 ``None`` 存" +"取。它用來在許多情況下代表數值不存在,例如沒有明確回傳任何東西的函式就會回傳" +"這個物件。它的真值是 false。" #: ../../reference/datamodel.rst:161 ../../reference/datamodel.rst:163 msgid "NotImplemented" @@ -186,6 +241,10 @@ msgid "" "will then try the reflected operation, or some other fallback, depending on " "the operator.) It should not be evaluated in a boolean context." msgstr "" +"這個型別只有一個數值。只有一個物件有這個數值。這個物件由內建名稱 :data:" +"`NotImplemented` 存取。數字方法和 rich comparison 方法應該在沒有為所提供的運" +"算元實作該操作的時候回傳這個數值。(直譯器接下來則會依運算子嘗試反轉的操作或" +"是其他的後備方案。)它不應該在預期布林值的情境中被計算。" #: ../../reference/datamodel.rst:172 msgid "See :ref:`implementing-the-arithmetic-operations` for more details." @@ -197,10 +256,13 @@ msgid "" "it currently evaluates as true, it will emit a :exc:`DeprecationWarning`. It " "will raise a :exc:`TypeError` in a future version of Python." msgstr "" +"在預期布林值的情境中計算 :data:`NotImplemented` 的行為已棄用。雖然目前它會計" +"算為 true,它也會同時發出 :exc:`DeprecationWarning`。從某個未來 Python 版本開" +"始這將會引發 :exc:`TypeError`。" #: ../../reference/datamodel.rst:183 ../../reference/datamodel.rst:184 msgid "Ellipsis" -msgstr "" +msgstr "Ellipsis" #: ../../reference/datamodel.rst:188 msgid "" @@ -208,6 +270,8 @@ msgid "" "This object is accessed through the literal ``...`` or the built-in name " "``Ellipsis``. Its truth value is true." msgstr "" +"這個型別只有一個數值。只有一個物件有這個數值。這個物件由文本 ``...`` 或內建名" +"稱 ``Ellipsis`` 存取。它的真值是 true。" #: ../../reference/datamodel.rst:194 msgid ":class:`numbers.Number`" @@ -406,7 +470,7 @@ msgstr "" #: ../../reference/datamodel.rst:362 msgid "Tuples" -msgstr "" +msgstr "Tuple(元組)" #: ../../reference/datamodel.rst:368 msgid "" @@ -420,7 +484,7 @@ msgstr "" #: ../../reference/datamodel.rst:375 msgid "Bytes" -msgstr "" +msgstr "位元組" #: ../../reference/datamodel.rst:378 msgid "" @@ -433,7 +497,7 @@ msgstr "" #: ../../reference/datamodel.rst:386 msgid "Mutable sequences" -msgstr "" +msgstr "可變序列" #: ../../reference/datamodel.rst:395 msgid "" @@ -465,7 +529,7 @@ msgstr "" #: ../../reference/datamodel.rst:415 msgid "Byte Arrays" -msgstr "" +msgstr "位元組陣列" #: ../../reference/datamodel.rst:418 msgid "" @@ -477,7 +541,7 @@ msgstr "" #: ../../reference/datamodel.rst:425 msgid "Set types" -msgstr "" +msgstr "Set(集合)型別" #: ../../reference/datamodel.rst:431 msgid "" @@ -503,7 +567,7 @@ msgstr "" #: ../../reference/datamodel.rst:446 msgid "Sets" -msgstr "" +msgstr "Set(集合)" #: ../../reference/datamodel.rst:449 msgid "" @@ -514,7 +578,7 @@ msgstr "" #: ../../reference/datamodel.rst:454 msgid "Frozen sets" -msgstr "" +msgstr "Frozen set(凍結集合)" #: ../../reference/datamodel.rst:457 msgid "" @@ -525,7 +589,7 @@ msgstr "" #: ../../reference/datamodel.rst:464 msgid "Mappings" -msgstr "" +msgstr "對映" #: ../../reference/datamodel.rst:471 msgid "" @@ -585,7 +649,7 @@ msgstr "" #: ../../reference/datamodel.rst:517 msgid "Callable types" -msgstr "" +msgstr "可呼叫型別" #: ../../reference/datamodel.rst:525 msgid "" @@ -829,7 +893,7 @@ msgstr "" #: ../../reference/datamodel.rst:741 msgid "Generator functions" -msgstr "" +msgstr "Generator(產生器)函式" #: ../../reference/datamodel.rst:747 msgid "" @@ -846,7 +910,7 @@ msgstr "" #: ../../reference/datamodel.rst:759 msgid "Coroutine functions" -msgstr "" +msgstr "Coroutine(協程)函式" #: ../../reference/datamodel.rst:764 msgid "" @@ -883,7 +947,7 @@ msgstr "" #: ../../reference/datamodel.rst:797 msgid "Built-in functions" -msgstr "" +msgstr "內建函式" #: ../../reference/datamodel.rst:804 msgid "" @@ -892,6 +956,9 @@ msgid "" "standard built-in module). The number and type of the arguments are " "determined by the C function. Special read-only attributes:" msgstr "" +"一個內建函式物件是一個 C 函式的 wrapper。內建函式的範例有 :func:`len` 和 :" +"func:`math.sin`\\ (\\ :mod:`math` 是一個標準的內建模組)。內建函式的引數數量" +"與其型別由其包裝的 C 函式所決定。特殊唯讀屬性:" #: ../../reference/datamodel.rst:809 msgid "" @@ -1081,7 +1148,7 @@ msgstr "" #: ../../reference/datamodel.rst:973 msgid "Special attributes:" -msgstr "" +msgstr "特殊屬性:" #: ../../reference/datamodel.rst:975 msgid ":attr:`~definition.__name__`" @@ -3638,7 +3705,7 @@ msgstr "" #: ../../reference/datamodel.rst:3136 msgid "With Statement Context Managers" -msgstr "" +msgstr "With 陳述式的情境管理器" #: ../../reference/datamodel.rst:3138 msgid "" From 9fa7ace6b44694e976f2b70a2c27bb9501da9f93 Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Tue, 24 Sep 2024 20:44:39 +0800 Subject: [PATCH 26/89] translate `library/codeop.po` --- library/codeop.po | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/library/codeop.po b/library/codeop.po index a495574e00..26b7065bc9 100644 --- a/library/codeop.po +++ b/library/codeop.po @@ -1,15 +1,16 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Liang-Bo Wang , 2016 +# Matt Wang , 2024 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" -"PO-Revision-Date: 2016-11-19 00:28+0000\n" -"Last-Translator: Liang-Bo Wang \n" +"PO-Revision-Date: 2024-09-24 20:28+0000\n" +"Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -34,32 +35,41 @@ msgid "" "include such a loop in your program you probably want to use the :mod:`code` " "module instead." msgstr "" +":mod:`codeop` 模組提供了可以模擬 Python read-eval-print 循環的工具程式 " +"(utilities),就像在 :mod:`code` 模組中所做的那樣。因此你可能不想直接使用該模" +"組;如果你想在程式中包含這樣的循環,你可能需要使用 :mod:`code` 模組。" #: ../../library/codeop.rst:20 msgid "There are two parts to this job:" -msgstr "" +msgstr "這個任務有兩個部分:" #: ../../library/codeop.rst:22 msgid "" "Being able to tell if a line of input completes a Python statement: in " "short, telling whether to print '``>>>``' or '``...``' next." msgstr "" +"能夠判斷一列輸入是否完成了一項 Python 陳述式:簡而言之,判斷接下來是列印 " +"'``>>>``' 還是 '``...``'。" #: ../../library/codeop.rst:25 msgid "" "Remembering which future statements the user has entered, so subsequent " "input can be compiled with these in effect." msgstr "" +"記住使用者輸入了哪些未來陳述式,以便後續輸入可以在這些陳述式生效的情況下進行" +"編譯。" #: ../../library/codeop.rst:28 msgid "" "The :mod:`codeop` module provides a way of doing each of these things, and a " "way of doing them both." msgstr "" +":mod:`codeop` 模組提供了一種完成上述每項任務的方法,以及同時完成這兩項任務的" +"方法。" #: ../../library/codeop.rst:31 msgid "To do just the former:" -msgstr "" +msgstr "只做前者:" #: ../../library/codeop.rst:35 msgid "" @@ -69,6 +79,10 @@ msgid "" "``''``. Returns ``None`` if *source* is *not* valid Python code, but " "is a prefix of valid Python code." msgstr "" +"嘗試編譯 *source*,它應該是 Python 程式碼的字串,如果 *source* 是有效的 " +"Python 程式碼,則回傳一個程式碼物件 (code object)。在這種情況下,程式碼物件的" +"檔案名稱屬性將為 *filename*,預設為 ``''``。如果 *source* 不是有效的 " +"Python 程式碼,而是有效 Python 程式碼的前綴,則回傳 ``None``。" #: ../../library/codeop.rst:41 msgid "" @@ -76,6 +90,9 @@ msgid "" "`SyntaxError` is raised if there is invalid Python syntax, and :exc:" "`OverflowError` or :exc:`ValueError` if there is an invalid literal." msgstr "" +"如果 *source* 有問題,就會引發例外。如果存在無效的 Python 語法則會引發 :exc:" +"`SyntaxError`;如果存在無效的文字 (literal),則會引發 :exc:`OverflowError` " +"或 :exc:`ValueError`。" #: ../../library/codeop.rst:45 msgid "" @@ -84,6 +101,9 @@ msgid "" "or as an :term:`expression` (``'eval'``). Any other value will cause :exc:" "`ValueError` to be raised." msgstr "" +"*symbol* 引數決定 *source* 是否編譯為陳述式(``'single'``,為預設值)、為\\ :" +"term:`陳述式 `\\ 序列 (``'exec'``) 或為\\ :term:`運算式 " +"` (``'eval'``)。任何其他值都會導致引發 :exc:`ValueError`。" #: ../../library/codeop.rst:52 msgid "" @@ -93,6 +113,10 @@ msgid "" "backslash followed by two newlines may be followed by arbitrary garbage. " "This will be fixed once the API for the parser is better." msgstr "" +"剖析器 (parser) 有可能(但通常不會)在到達原始碼的結尾之前停止剖析並獲得成功" +"的結果;在這種情況下,尾隨符號可能會被忽略而不是導致錯誤。例如,反斜線後面加" +"上兩個換行符號後可以是任意的無意義符號。這個問題在未來會因為剖析器 API 的改善" +"而被解決。" #: ../../library/codeop.rst:61 msgid "" @@ -102,6 +126,9 @@ msgid "" "statement, the instance 'remembers' and compiles all subsequent program " "texts with the statement in force." msgstr "" +"此類別的實例具有 :meth:`~object.__call__` 方法,其簽名與內建函式 :func:" +"`compile` 相同,區別在於如果實例編譯包含 :mod:`__future__` 陳述式的程式文本," +"實例會「記住」並使用該陳述式並有效地編譯所有後續程式文本。" #: ../../library/codeop.rst:70 msgid "" @@ -111,3 +138,6 @@ msgid "" "'remembers' and compiles all subsequent program texts with the statement in " "force." msgstr "" +"此類別的實例具有 :meth:`~object.__call__` 方法,其簽名與內建函式 :func:" +"`compile_command` 相同,區別在於如果實例編譯包含 :mod:`__future__` 陳述式的程" +"式文本,實例會「記住」並使用該陳述式並有效地編譯所有後續程式文本。" From 94e37356e4fa4ad0ebefa66b5be305f0913141bd Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Mon, 30 Sep 2024 14:16:58 +0800 Subject: [PATCH 27/89] Apply suggestions from code review Co-authored-by: Payon --- library/codeop.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/codeop.po b/library/codeop.po index 26b7065bc9..36b73d432c 100644 --- a/library/codeop.po +++ b/library/codeop.po @@ -128,7 +128,7 @@ msgid "" msgstr "" "此類別的實例具有 :meth:`~object.__call__` 方法,其簽名與內建函式 :func:" "`compile` 相同,區別在於如果實例編譯包含 :mod:`__future__` 陳述式的程式文本," -"實例會「記住」並使用該陳述式並有效地編譯所有後續程式文本。" +"實例會「記住」並使用該陳述式開始編譯所有後續程式文本。" #: ../../library/codeop.rst:70 msgid "" @@ -140,4 +140,4 @@ msgid "" msgstr "" "此類別的實例具有 :meth:`~object.__call__` 方法,其簽名與內建函式 :func:" "`compile_command` 相同,區別在於如果實例編譯包含 :mod:`__future__` 陳述式的程" -"式文本,實例會「記住」並使用該陳述式並有效地編譯所有後續程式文本。" +"式文本,實例會「記住」並使用該陳述式開始編譯所有後續程式文本。" From 67a53e58ed407b350920d466c862c148eca2160a Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Mon, 30 Sep 2024 22:37:39 +0800 Subject: [PATCH 28/89] docs(library/pickle.po): First iteration of translation done --- library/pickle.po | 149 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 135 insertions(+), 14 deletions(-) diff --git a/library/pickle.po b/library/pickle.po index 8d833b4006..1f6b2b99c9 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -1988,6 +1988,10 @@ msgid "" "graph. Buffers accumulated by the *buffer_callback* will not see their data " "copied into the pickle stream, only a cheap marker will be inserted." msgstr "" +"傳送端需要傳遞一個調用緩衝區的回呼函數給 :class:`Pickler`(或 :func:`dump` " +"或 :func:`dumps` 函數)的 *buffer_callback* 引數,使每次生成 :class:" +"`PickleBuffer` 時,該物件在處理物件圖時能被呼叫。除了一個簡易標記以外,由 " +"*buffer_callback* 累積的緩衝區資料不會被複製到 pickle 串流中。" #: ../../library/pickle.rst:991 msgid "" @@ -1999,6 +2003,12 @@ msgid "" "reconstructors of the objects whose pickling produced the original :class:" "`PickleBuffer` objects." msgstr "" +"接收端需要傳遞一個緩衝區物件給 :class:`Unpickler`(或 :func:`load` 或 :func:" +"`loads` 函式)的 *buffers* 引數。該物件須是一個可疊代的(iterable)緩衝區" +"(buffer)物件,其中包含傳遞給 *buffer_callback* 的緩衝區物件。這個可疊代物件" +"的緩衝區順序應該與它們當初被封裝時傳遞給 *buffer_callback* 的順序相同。這些緩" +"衝區將提供物件重建所需的資料,以使重建器能還原出那個當時產生了 :class:" +"`PickleBuffer` 的物件。" #: ../../library/pickle.rst:999 msgid "" @@ -2007,6 +2017,8 @@ msgid "" "Potential optimizations include the use of shared memory or datatype-" "dependent compression." msgstr "" +"在傳送與接收端之間,通訊系統可以自由實作轉移帶外緩衝區資料的機制。該機制可能" +"可以利用共用記憶體機制或根據資料類型特定的壓縮方式來最佳化執行速度。" #: ../../library/pickle.rst:1005 msgid "Example" @@ -2017,6 +2029,8 @@ msgid "" "Here is a trivial example where we implement a :class:`bytearray` subclass " "able to participate in out-of-band buffer pickling::" msgstr "" +"這一個簡單的範例展示了如何實作一個可以參與帶外緩衝區封裝的 :class:" +"`bytearray` 子類別:::" #: ../../library/pickle.rst:1010 msgid "" @@ -2041,6 +2055,25 @@ msgid "" " else:\n" " return cls(obj)" msgstr "" +"class ZeroCopyByteArray(bytearray):\n" +"\n" +" def __reduce_ex__(self, protocol):\n" +" if protocol >= 5:\n" +" return type(self)._reconstruct, (PickleBuffer(self),), None\n" +" else:\n" +" # PickleBuffer 在 pickle 協定 <= 4 時禁止使用。\n" +" return type(self)._reconstruct, (bytearray(self),)\n" +"\n" +" @classmethod\n" +" def _reconstruct(cls, obj):\n" +" with memoryview(obj) as m:\n" +" # 取得對原始緩衝區物件的控制\n" +" obj = m.obj\n" +" if type(obj) is cls:\n" +" # 若原本的緩衝區物件是 ZeroCopyByteArray,則直接回傳。\n" +" return obj\n" +" else:\n" +" return cls(obj)" #: ../../library/pickle.rst:1031 msgid "" @@ -2048,12 +2081,16 @@ msgid "" "providing object if it has the right type. This is an easy way to simulate " "zero-copy behaviour on this toy example." msgstr "" +"如果型別正確,重建器(``_reconstruct`` 類別方法)會返回當時提供緩衝區的物件。" +"這個簡易實作可以模擬一個無複製行為的重建器。" #: ../../library/pickle.rst:1035 msgid "" "On the consumer side, we can pickle those objects the usual way, which when " "unserialized will give us a copy of the original object::" msgstr "" +"在使用端,我們可以用一般的方式封裝這些物件,當我們拆封時會得到一個原始物件的" +"副本:::" #: ../../library/pickle.rst:1038 msgid "" @@ -2063,12 +2100,19 @@ msgid "" "print(b == new_b) # True\n" "print(b is new_b) # False: a copy was made" msgstr "" +"b = ZeroCopyByteArray(b\"abc\")\n" +"data = pickle.dumps(b, protocol=5)\n" +"new_b = pickle.loads(data)\n" +"print(b == new_b) # True\n" +"print(b is new_b) # False: 曾進行過複製運算" #: ../../library/pickle.rst:1044 msgid "" "But if we pass a *buffer_callback* and then give back the accumulated " "buffers when unserializing, we are able to get back the original object::" msgstr "" +"但如果我們傳一個 *buffer_callback* 並在去序列化時正確返回積累的緩衝資料,我們" +"就能拿回原始的物件:::" #: ../../library/pickle.rst:1047 msgid "" @@ -2079,6 +2123,12 @@ msgid "" "print(b == new_b) # True\n" "print(b is new_b) # True: no copy was made" msgstr "" +"b = ZeroCopyByteArray(b\"abc\")\n" +"buffers = []\n" +"data = pickle.dumps(b, protocol=5, buffer_callback=buffers.append)\n" +"new_b = pickle.loads(data, buffers=buffers)\n" +"print(b == new_b) # True\n" +"print(b is new_b) # True: 沒有進行過複製" #: ../../library/pickle.rst:1054 msgid "" @@ -2089,14 +2139,18 @@ msgid "" "making as few copies as possible) when transferring between distinct " "processes or systems." msgstr "" +"此範例是因為受限於 :class:`bytearray` 會自行分配記憶體:您無法創建以其他物件" +"的記憶體為基礎的 :class:`bytearray` 實例。不過第三方資料型態(如 NumPy 陣列)" +"則可能沒有這個限制,而允許在不同程序或系統之間傳輸資料時使用零拷貝封裝(或儘" +"可能地減少拷貝次數)。" #: ../../library/pickle.rst:1061 msgid ":pep:`574` -- Pickle protocol 5 with out-of-band data" -msgstr "" +msgstr ":pep:`574` -- 第 5 版 Pickle 協定的帶外資料(out-of-band data)處裡" #: ../../library/pickle.rst:1067 msgid "Restricting Globals" -msgstr "" +msgstr "限制全域物件" #: ../../library/pickle.rst:1072 msgid "" @@ -2105,6 +2159,9 @@ msgid "" "it permits the unpickler to import and invoke arbitrary code. Just consider " "what this hand-crafted pickle data stream does when loaded::" msgstr "" +"預設情況下,拆封過程將會引入任何在 pickle 資料中找到的類別或函式。對於許多應" +"用程式來說,這種行為是不可接受的,因為它讓拆封器能夠引入並執行任意程式碼。請" +"參見以下 pickle 資料流在載入時的行為:::" #: ../../library/pickle.rst:1077 msgid "" @@ -2125,6 +2182,9 @@ msgid "" "is inoffensive, it is not difficult to imagine one that could damage your " "system." msgstr "" +"在這個例子中,拆封器會引入 :func:`os.system` 函式,然後執行命令「echo hello " +"world」。雖然這個例子是無害的,但不難想像可以這個方式輕易執行任意可能對系統造" +"成損害的命令。" #: ../../library/pickle.rst:1086 msgid "" @@ -2134,12 +2194,18 @@ msgid "" "requested. Thus it is possible to either completely forbid globals or " "restrict them to a safe subset." msgstr "" +"基於以上原因,您可能會希望透過自訂 :meth:`Unpickler.find_class` 來控制哪些是" +"能夠被拆封的內容。與其名稱字面意義暗示的不同,實際上每當你請求一個全域物件" +"(例如,類別或函式)時,就會調用 :meth:`Unpickler.find_class`。因此,可以透過" +"這個方法完全禁止全域物件或將其限制在安全的子集合。" #: ../../library/pickle.rst:1092 msgid "" "Here is an example of an unpickler allowing only few safe classes from the :" "mod:`builtins` module to be loaded::" msgstr "" +"以下是一個僅允許從 :mod:`builtins` 模組中載入少數安全類別的拆封器" +"(unpickler)的例子:::" #: ../../library/pickle.rst:1095 msgid "" @@ -2169,10 +2235,35 @@ msgid "" " \"\"\"Helper function analogous to pickle.loads().\"\"\"\n" " return RestrictedUnpickler(io.BytesIO(s)).load()" msgstr "" +"import builtins\n" +"import io\n" +"import pickle\n" +"\n" +"safe_builtins = {\n" +" 'range',\n" +" 'complex',\n" +" 'set',\n" +" 'frozenset',\n" +" 'slice',\n" +"}\n" +"\n" +"class RestrictedUnpickler(pickle.Unpickler):\n" +"\n" +" def find_class(self, module, name):\n" +" # 只允許幾個內建的安全類別\n" +" if module == \"builtins\" and name in safe_builtins:\n" +" return getattr(builtins, name)\n" +" # 完全禁止任何其他類別\n" +" raise pickle.UnpicklingError(\"global '%s.%s' is forbidden\" %\n" +" (module, name))\n" +"\n" +"def restricted_loads(s):\n" +" \"\"\"一個模擬 pickle.loads() 的輔助函數\"\"\"\n" +" return RestrictedUnpickler(io.BytesIO(s)).load()" #: ../../library/pickle.rst:1121 msgid "A sample usage of our unpickler working as intended::" -msgstr "" +msgstr "我們剛才實作的的拆封器範例正常運作的樣子:::" #: ../../library/pickle.rst:1123 msgid "" @@ -2209,10 +2300,13 @@ msgid "" "alternatives such as the marshalling API in :mod:`xmlrpc.client` or third-" "party solutions." msgstr "" +"正如我們的範例所示,必須謹慎審視能被拆封的內容。因此,如果您的應用場景非常關" +"心安全性,您可能需要考慮其他選擇,例如 :mod:`xmlrpc.client` 中的 marshalling " +"API 或其他第三方解決方案。" #: ../../library/pickle.rst:1147 msgid "Performance" -msgstr "" +msgstr "效能" #: ../../library/pickle.rst:1149 msgid "" @@ -2220,6 +2314,9 @@ msgid "" "efficient binary encodings for several common features and built-in types. " "Also, the :mod:`pickle` module has a transparent optimizer written in C." msgstr "" +"較近期的 pickle 協定版本(從 2 版協定開始)為多種常見功能和內建型別提供了高效" +"率的二進位編碼。此外,:mod:`pickle` 模組還具備一個透明化的、以 C 語言編寫的最" +"佳化工具。" #: ../../library/pickle.rst:1157 msgid "Examples" @@ -2228,7 +2325,7 @@ msgstr "範例" #: ../../library/pickle.rst:1159 msgid "" "For the simplest code, use the :func:`dump` and :func:`load` functions. ::" -msgstr "" +msgstr "最簡單的使用方式,調用 :func:`dump` 和 :func:`load` 函式。::" #: ../../library/pickle.rst:1161 msgid "" @@ -2245,10 +2342,22 @@ msgid "" " # Pickle the 'data' dictionary using the highest protocol available.\n" " pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)" msgstr "" +"import pickle\n" +"\n" +"# 任意 pickle 支援的物件。\n" +"data = {\n" +" 'a': [1, 2.0, 3+4j],\n" +" 'b': (\"string\", b\"byte string\"),\n" +" 'c': {None, True, False}\n" +"}\n" +"\n" +"with open('data.pickle', 'wb') as f:\n" +" # 使用可用的最高協定來封裝 'data' 字典。\n" +" pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)\n" #: ../../library/pickle.rst:1175 msgid "The following example reads the resulting pickled data. ::" -msgstr "" +msgstr "以下範例可以讀取前述程式所封裝的 pickle 資料。::" #: ../../library/pickle.rst:1177 msgid "" @@ -2259,6 +2368,11 @@ msgid "" " # have to specify it.\n" " data = pickle.load(f)" msgstr "" +"import pickle\n" +"\n" +"with open('data.pickle', 'rb') as f:\n" +" # 會自動檢測資料使用的協定版本,因此我們不需要手動指定。\n" +" data = pickle.load(f)" #: ../../library/pickle.rst:1191 msgid "Module :mod:`copyreg`" @@ -2266,7 +2380,7 @@ msgstr ":mod:`copyreg` 模組" #: ../../library/pickle.rst:1192 msgid "Pickle interface constructor registration for extension types." -msgstr "" +msgstr "註冊擴充型別的 Pickle 介面建構子。" #: ../../library/pickle.rst:1194 msgid "Module :mod:`pickletools`" @@ -2274,7 +2388,7 @@ msgstr ":mod:`pickletools` 模組" #: ../../library/pickle.rst:1195 msgid "Tools for working with and analyzing pickled data." -msgstr "" +msgstr "用於分析或處裡被封裝資料的工具。" #: ../../library/pickle.rst:1197 msgid "Module :mod:`shelve`" @@ -2282,7 +2396,7 @@ msgstr ":mod:`shelve` 模組" #: ../../library/pickle.rst:1198 msgid "Indexed databases of objects; uses :mod:`pickle`." -msgstr "" +msgstr "索引式資料庫;使用 :mod:`pickle` 實作。" #: ../../library/pickle.rst:1200 msgid "Module :mod:`copy`" @@ -2290,7 +2404,7 @@ msgstr ":mod:`copy` 模組" #: ../../library/pickle.rst:1201 msgid "Shallow and deep object copying." -msgstr "" +msgstr "物件的淺層或深度拷貝。" #: ../../library/pickle.rst:1203 msgid "Module :mod:`marshal`" @@ -2298,7 +2412,7 @@ msgstr ":mod:`marshal` 模組" #: ../../library/pickle.rst:1204 msgid "High-performance serialization of built-in types." -msgstr "" +msgstr "內建型別的高效能序列化。" #: ../../library/pickle.rst:1208 msgid "Footnotes" @@ -2306,25 +2420,29 @@ msgstr "註解" #: ../../library/pickle.rst:1209 msgid "Don't confuse this with the :mod:`marshal` module" -msgstr "" +msgstr "不要將此模組與 :mod:`marshal` 模組混淆" #: ../../library/pickle.rst:1211 msgid "" "This is why :keyword:`lambda` functions cannot be pickled: all :keyword:`!" "lambda` functions share the same name: ````." msgstr "" +"這就是為什麼 :keyword:`lambda` 函式無法被封裝:所有 :keyword:`!lambda` 函式共" +"享相同的名稱:````。" #: ../../library/pickle.rst:1214 msgid "" "The exception raised will likely be an :exc:`ImportError` or an :exc:" "`AttributeError` but it could be something else." msgstr "" +"拋出的例外應該是 :exc:`ImportError` 或 :exc:`AttributeError`,但也可能是其他" +"例外。" #: ../../library/pickle.rst:1217 msgid "" "The :mod:`copy` module uses this protocol for shallow and deep copying " "operations." -msgstr "" +msgstr ":mod:`copy` 模組使用此協定進行淺層及深層複製操作。" #: ../../library/pickle.rst:1220 msgid "" @@ -2333,6 +2451,9 @@ msgid "" "kind of newline characters occurs in persistent IDs, the resulting pickled " "data will become unreadable." msgstr "" +"協定 0 中限制僅能使用英文字母或數字字元來分配持久化 ID 是因為持久化 ID 是由換" +"行符號所分隔的。因此,如果持久化 ID 中出現任何形式的換行字元,將導致封裝資料" +"變得無法讀取。" #: ../../library/pickle.rst:12 msgid "persistence" @@ -2364,7 +2485,7 @@ msgstr "pickling" #: ../../library/pickle.rst:123 msgid "External Data Representation" -msgstr "External Data Representation(外部資料表示法)" +msgstr "External Data Representation(外部資料表現)" #: ../../library/pickle.rst:664 msgid "copy" From 10b5c6dd31160d1e860d224692488c5566b4141b Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Mon, 30 Sep 2024 23:38:12 +0800 Subject: [PATCH 29/89] docs(library/pickle.po): Build succesful --- library/pickle.po | 55 +++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/library/pickle.po b/library/pickle.po index 1f6b2b99c9..be51283dc1 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -96,8 +96,8 @@ msgid "" "pyc` files." msgstr "" "Python 有另一個比較原始的序列化模組叫 :mod:`marshal`,不過其設計目的是為了支" -"援 Python 的預編譯功能 :file:`.pyc` 的運作。總地來說,沒事不要用 :mod:" -"`marshal`。" +"援 Python 的預編譯功能 :file:`.pyc` 的運作。總地來說,請盡可能地使用 :mod:" +"`pickle`,沒事不要用 :mod:`marshal`。" #: ../../library/pickle.rst:57 msgid "" @@ -251,7 +251,7 @@ msgid "" "efficiently :doc:`compress ` pickled data." msgstr "" "以預設設定來說,:mod:`pickle` 使用相對緊湊的二進位形式來儲存資料。如果你需要" -"盡可能地縮小檔案大小,你可以\\\\ :doc:`壓縮 `\\\\ 封裝的資料。" +"盡可能地縮小檔案大小,你可以\\ :doc:`壓縮 `\\ 封裝的資料。" #: ../../library/pickle.rst:135 msgid "" @@ -412,8 +412,8 @@ msgid "" "Write the pickled representation of the object *obj* to the open :term:`file " "object` *file*. This is equivalent to ``Pickler(file, protocol).dump(obj)``." msgstr "" -"將被封裝成 pickle 形式的 *obj* 寫入到已開啟的\\\\ term:`檔案物件 ` *file*。這等效於\\\\ ``Pickler(file, protocol).dump(obj)``。" +"將被封裝成 pickle 形式的 *obj* 寫入到已開啟的\\ :term:`file object` *file*。" +"這等效於\\ ``Pickler(file, protocol).dump(obj)``。" #: ../../library/pickle.rst:222 msgid "" @@ -685,8 +685,11 @@ msgid "" "and can optionally return :data:`NotImplemented` to fallback on :attr:" "`dispatch_table`-registered reducers to pickle ``obj``." msgstr "" -"傳 :data:`NotImplemented` 以退回(fallback)並改為使用 :attr:" -"`dispatch_table` 中登錄的縮減方法來封裝 ``obj``。" +"一個可以在 :class:`Pickler` 子類別中被定義的縮減器(reducer)。這個方法的優先" +"度高於任何其他 :attr:`分派表 ` 中的縮減器。他應該要有和 :" +"meth:`~object.__reduce__` 方法相同的函數界面,且可以可選地回傳 :data:" +"`NotImplemented` 以退回(fallback)使用 :attr:`分派表 ` 中登" +"錄的縮減方法來封裝 ``obj``。" #: ../../library/pickle.rst:379 msgid "For a detailed example, see :ref:`reducer_override`." @@ -744,7 +747,7 @@ msgid "" "datetime`, :class:`~datetime.date` and :class:`~datetime.time` pickled by " "Python 2." msgstr "" -"可選引數 *fix_imports*,*encoding* 和 *errors* 用來控制 Python 2 pickle 資料" +"可選引數 *fix_imports*、*encoding* 和 *errors* 用來控制 Python 2 pickle 資料" "的相容性支援。如果 *fix_imports* 為 true,則 pickle 模組會嘗試將舊的 Python " "2 模組名稱映射到 Python 3 中使用的新名稱。*encoding* 和 *errors* 告訴 pickle " "模組如何解碼由 Python 2 pickle 封裝的 8 位元字串實例;*encoding* 和 *errors* " @@ -760,9 +763,9 @@ msgid "" "*buffer_callback* argument was ``None`` when a :class:`Pickler` was " "instantiated (or when :func:`dump` or :func:`dumps` was called)." msgstr "" -"如果 *buffers* 是 ``None``(預設值),那麼去序列化所需的所有資料都必須已經包" -"含在 pickle 串流中。這意味著當初在建立對應的 :class:`Pickler` 時(或在呼叫 :" -"func:`dump` 或 :func:`dumps` 時)*buffer_callback* 引數必須為 ``None``。" +"如果 *buffers* 是 ``None``\\ (預設值),那麼去序列化所需的所有資料都必須已經" +"包含在 pickle 串流中。這意味著當初在建立對應的 :class:`Pickler` 時(或在呼" +"叫 :func:`dump` 或 :func:`dumps` 時)*buffer_callback* 引數必須為 ``None``。" #: ../../library/pickle.rst:424 msgid "" @@ -772,8 +775,8 @@ msgid "" "the *buffer_callback* of a Pickler object." msgstr "" "如果 *buffers* 不是 ``None``,則其應該是一個可疊代物件,內含數個支援緩衝區的" -"物件,並且每當 pickle 串流引用一個 :ref:`帶外 ` 緩衝區視圖時將會" -"被照順序消耗。這些緩衝資料當初建立時應已按照順序給定予 Pickler 物件中的 " +"物件,並且每當 pickle 串流引用一個\\ :ref:`帶外 `\\ 緩衝區視圖時" +"將會被照順序消耗。這些緩衝資料當初建立時應已按照順序給定予 Pickler 物件中的 " "*buffer_callback*。" #: ../../library/pickle.rst:434 @@ -816,7 +819,7 @@ msgid "" "`pickle-restrict` for details." msgstr "" "子類別可以覆寫此方法以控制可以載入哪些類型的物件、以及如何載入它們,從而潛在" -"地降低安全性風險。詳情請參考 :ref:`pickle-restrict`。" +"地降低安全性風險。詳情請參考\\ :ref:`pickle-restrict`。" #: ../../library/pickle.rst:460 msgid "" @@ -836,8 +839,8 @@ msgid "" "object` or a N-dimensional array." msgstr "" "一個表示了含有可封裝數據緩衝區的包裝函數(wrapper function)。*buffer* 必須是" -"一個 :ref:`提供緩衝區 ` 的物件,例如一個 :term:`類位元組物件" -"(bytes-like object)` 或 N 維陣列。" +"一個 :ref:`提供緩衝區 ` 的物件,例如一個 :term:`類位元組物件 " +"` 或 N 維陣列。" #: ../../library/pickle.rst:468 msgid "" @@ -855,9 +858,9 @@ msgid "" "oob>`." msgstr "" ":class:`PickleBuffer` 物件僅能由 5 版或以上的 pickle 協定進行封裝。該物件亦能" -"被作為帶外資料來進行:ref:`帶外資料序列化 `" +"被作為帶外資料來進行\\ :ref:`帶外資料序列化 `" -# SkyLull: oh boy... 好多術語... +# SkyLull: oh... 好多術語... # format B: https://learn.microsoft.com/zh-tw/dotnet/standard/base- # types/standard-numeric-format-strings#BFormatString # C-contiguous, Fortran-contiguous: https://stackoverflow.com/a/26999092 @@ -1304,7 +1307,7 @@ msgstr "" "可選項。一個用來提供連續項目的疊代器(而非序列)。這些項目將個別透過 ``obj." "append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被附加到" "物件中。主要用於串列(list)子類別,但只要其他類別具有相應的 :ref:`append 和 " -"extend 方法 `和相同的輸入特徵(signature)就也可以使用。 " +"extend 方法 `\\ 和相同的輸入特徵(signature)就也可以使用。 " "(如何選擇使用 :meth:`!append` 或 :meth:`!extend` 方法將取決於所選用的 " "pickle 協定版本以及要附加的項目數量,因此必須同時支援這兩種方法。)" @@ -1988,8 +1991,8 @@ msgid "" "graph. Buffers accumulated by the *buffer_callback* will not see their data " "copied into the pickle stream, only a cheap marker will be inserted." msgstr "" -"傳送端需要傳遞一個調用緩衝區的回呼函數給 :class:`Pickler`(或 :func:`dump` " -"或 :func:`dumps` 函數)的 *buffer_callback* 引數,使每次生成 :class:" +"傳送端需要傳遞一個調用緩衝區的回呼函數給 :class:`Pickler`\\ (或 :func:" +"`dump` 或 :func:`dumps` 函數)的 *buffer_callback* 引數,使每次生成 :class:" "`PickleBuffer` 時,該物件在處理物件圖時能被呼叫。除了一個簡易標記以外,由 " "*buffer_callback* 累積的緩衝區資料不會被複製到 pickle 串流中。" @@ -2003,11 +2006,11 @@ msgid "" "reconstructors of the objects whose pickling produced the original :class:" "`PickleBuffer` objects." msgstr "" -"接收端需要傳遞一個緩衝區物件給 :class:`Unpickler`(或 :func:`load` 或 :func:" -"`loads` 函式)的 *buffers* 引數。該物件須是一個可疊代的(iterable)緩衝區" -"(buffer)物件,其中包含傳遞給 *buffer_callback* 的緩衝區物件。這個可疊代物件" -"的緩衝區順序應該與它們當初被封裝時傳遞給 *buffer_callback* 的順序相同。這些緩" -"衝區將提供物件重建所需的資料,以使重建器能還原出那個當時產生了 :class:" +"接收端需要傳遞一個緩衝區物件給 :class:`Unpickler`\\ (或 :func:`load` 或 :" +"func:`loads` 函式)的 *buffers* 引數。該物件須是一個可疊代的(iterable)緩衝" +"區(buffer)物件,其中包含傳遞給 *buffer_callback* 的緩衝區物件。這個可疊代物" +"件的緩衝區順序應該與它們當初被封裝時傳遞給 *buffer_callback* 的順序相同。這些" +"緩衝區將提供物件重建所需的資料,以使重建器能還原出那個當時產生了 :class:" "`PickleBuffer` 的物件。" #: ../../library/pickle.rst:999 From 7cf33e8eb6c3ee06786294db0985fa82059188a8 Mon Sep 17 00:00:00 2001 From: "pydoc-zh-tw[bot]" <90344106+pydoc-zh-tw[bot]@users.noreply.github.com> Date: Sat, 5 Oct 2024 15:06:19 +0800 Subject: [PATCH 30/89] Sync with CPython 3.13 (#978) Co-authored-by: github-actions[bot] Co-authored-by: Matt Wang --- .scripts/poetry.lock | 6 +- c-api/buffer.po | 178 +-- c-api/exceptions.po | 8 +- c-api/init.po | 4 +- c-api/long.po | 171 +-- c-api/object.po | 14 +- c-api/type.po | 210 +-- c-api/typeobj.po | 18 +- c-api/unicode.po | 562 ++++---- deprecations/index.po | 84 +- deprecations/pending-removal-in-3.14.po | 52 +- deprecations/pending-removal-in-3.15.po | 34 +- extending/newtypes.po | 4 +- extending/newtypes_tutorial.po | 6 +- faq/design.po | 4 +- faq/extending.po | 2 +- faq/library.po | 8 +- faq/programming.po | 365 +++--- glossary.po | 76 +- howto/annotations.po | 24 +- howto/descriptor.po | 6 +- howto/enum.po | 29 +- howto/free-threading-python.po | 257 ++++ howto/index.po | 66 +- howto/mro.po | 4 +- library/abc.po | 12 +- library/argparse.po | 738 +++++------ library/ast.po | 64 +- library/asyncio-task.po | 445 ++++--- library/calendar.po | 105 +- library/cmdline.po | 34 +- library/collections.po | 90 +- library/contextvars.po | 14 +- library/dataclasses.po | 8 +- library/datetime.po | 1147 +++++++++-------- library/email.contentmanager.po | 62 +- library/email.headerregistry.po | 4 +- library/functions.po | 878 ++++++------- library/functools.po | 184 +-- library/gc.po | 254 ++-- library/importlib.po | 256 ++-- library/inspect.po | 4 +- library/logging.po | 686 +++++----- library/mmap.po | 2 +- library/os.po | 13 +- library/pydoc.po | 6 +- library/random.po | 4 +- library/secrets.po | 4 +- library/shutil.po | 211 +-- library/signal.po | 11 +- library/stdtypes.po | 165 +-- library/string.po | 141 +- library/test.po | 8 +- library/tomllib.po | 9 +- library/types.po | 7 +- library/typing.po | 1088 ++++++++-------- library/unittest.mock.po | 12 +- library/venv.po | 529 ++++---- library/warnings.po | 12 +- reference/compound_stmts.po | 432 ++++--- reference/datamodel.po | 1495 ++++++++++----------- reference/executionmodel.po | 8 +- reference/expressions.po | 804 ++++++------ reference/import.po | 208 +-- sphinx.po | 114 +- tutorial/classes.po | 83 +- tutorial/controlflow.po | 555 ++++---- using/mac.po | 789 ++++++++---- whatsnew/2.1.po | 6 +- whatsnew/2.2.po | 395 +++--- whatsnew/2.3.po | 22 +- whatsnew/3.1.po | 4 +- whatsnew/3.10.po | 8 +- whatsnew/3.11.po | 8 +- whatsnew/3.12.po | 104 +- whatsnew/3.13.po | 1573 +++++++++++------------ whatsnew/3.2.po | 4 +- whatsnew/3.3.po | 1113 ++++++++-------- whatsnew/3.4.po | 11 +- whatsnew/3.5.po | 24 +- whatsnew/3.6.po | 23 +- whatsnew/3.7.po | 14 +- whatsnew/3.8.po | 8 +- whatsnew/3.9.po | 468 +++---- 84 files changed, 9287 insertions(+), 8385 deletions(-) create mode 100644 howto/free-threading-python.po diff --git a/.scripts/poetry.lock b/.scripts/poetry.lock index 60d477dd30..5f06f9c25c 100644 --- a/.scripts/poetry.lock +++ b/.scripts/poetry.lock @@ -173,13 +173,13 @@ files = [ [[package]] name = "hstspreload" -version = "2024.9.1" +version = "2024.10.1" description = "Chromium HSTS Preload list as a Python package" optional = false python-versions = ">=3.6" files = [ - {file = "hstspreload-2024.9.1-py3-none-any.whl", hash = "sha256:9c1b2d0313899d3ff9dac03ab39d53fed95c32eef9862e7eabee8dc07dfd589c"}, - {file = "hstspreload-2024.9.1.tar.gz", hash = "sha256:2ab4518495a132c4ae430c474afffd12938852c6eec68ce1368c8f7858dc3076"}, + {file = "hstspreload-2024.10.1-py3-none-any.whl", hash = "sha256:3ab481036cbdff095cb411dafe33ee7924492319cf6ddaf4e776a159537541b3"}, + {file = "hstspreload-2024.10.1.tar.gz", hash = "sha256:2859a6b52253743ddddad468d8c9570ba650170ca49ac416336826915ee409b8"}, ] [[package]] diff --git a/c-api/buffer.po b/c-api/buffer.po index fa0c60391b..d183ac606f 100644 --- a/c-api/buffer.po +++ b/c-api/buffer.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2018-05-23 14:30+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -341,16 +341,17 @@ msgid "" "itemsize`, :c:member:`~Py_buffer.ndim`." msgstr "" -#: ../../c-api/buffer.rst:249 +#: ../../c-api/buffer.rst:248 msgid "readonly, format" msgstr "" -#: ../../c-api/buffer.rst:253 +#: ../../c-api/buffer.rst:252 msgid "" "Controls the :c:member:`~Py_buffer.readonly` field. If set, the exporter " "MUST provide a writable buffer or else report failure. Otherwise, the " "exporter MAY provide either a read-only or writable buffer, but the choice " -"MUST be consistent for all consumers." +"MUST be consistent for all consumers. For example, :c:expr:`PyBUF_SIMPLE | " +"PyBUF_WRITABLE` can be used to request a simple writable buffer." msgstr "" #: ../../c-api/buffer.rst:260 @@ -369,156 +370,157 @@ msgstr "" #: ../../c-api/buffer.rst:268 msgid "" -":c:macro:`PyBUF_FORMAT` can be \\|'d to any of the flags except :c:macro:" -"`PyBUF_SIMPLE`. The latter already implies format ``B`` (unsigned bytes)." +":c:macro:`PyBUF_FORMAT` must be \\|'d to any of the flags except :c:macro:" +"`PyBUF_SIMPLE`, because the latter already implies format ``B`` (unsigned " +"bytes). :c:macro:`!PyBUF_FORMAT` cannot be used on its own." msgstr "" -#: ../../c-api/buffer.rst:273 +#: ../../c-api/buffer.rst:274 msgid "shape, strides, suboffsets" msgstr "" -#: ../../c-api/buffer.rst:275 +#: ../../c-api/buffer.rst:276 msgid "" "The flags that control the logical structure of the memory are listed in " "decreasing order of complexity. Note that each flag contains all bits of the " "flags below it." msgstr "" -#: ../../c-api/buffer.rst:282 ../../c-api/buffer.rst:306 -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 +#: ../../c-api/buffer.rst:332 msgid "Request" msgstr "" -#: ../../c-api/buffer.rst:282 ../../c-api/buffer.rst:306 -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 +#: ../../c-api/buffer.rst:332 msgid "shape" msgstr "" -#: ../../c-api/buffer.rst:282 ../../c-api/buffer.rst:306 -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 +#: ../../c-api/buffer.rst:332 msgid "strides" msgstr "" -#: ../../c-api/buffer.rst:282 ../../c-api/buffer.rst:306 -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 +#: ../../c-api/buffer.rst:332 msgid "suboffsets" msgstr "" -#: ../../c-api/buffer.rst:284 ../../c-api/buffer.rst:286 -#: ../../c-api/buffer.rst:288 ../../c-api/buffer.rst:308 -#: ../../c-api/buffer.rst:310 ../../c-api/buffer.rst:312 -#: ../../c-api/buffer.rst:314 ../../c-api/buffer.rst:333 -#: ../../c-api/buffer.rst:335 ../../c-api/buffer.rst:337 -#: ../../c-api/buffer.rst:339 ../../c-api/buffer.rst:341 -#: ../../c-api/buffer.rst:343 ../../c-api/buffer.rst:345 -#: ../../c-api/buffer.rst:347 +#: ../../c-api/buffer.rst:285 ../../c-api/buffer.rst:287 +#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:309 +#: ../../c-api/buffer.rst:311 ../../c-api/buffer.rst:313 +#: ../../c-api/buffer.rst:315 ../../c-api/buffer.rst:334 +#: ../../c-api/buffer.rst:336 ../../c-api/buffer.rst:338 +#: ../../c-api/buffer.rst:340 ../../c-api/buffer.rst:342 +#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:346 +#: ../../c-api/buffer.rst:348 msgid "yes" msgstr "" -#: ../../c-api/buffer.rst:284 ../../c-api/buffer.rst:333 -#: ../../c-api/buffer.rst:335 +#: ../../c-api/buffer.rst:285 ../../c-api/buffer.rst:334 +#: ../../c-api/buffer.rst:336 msgid "if needed" msgstr "" -#: ../../c-api/buffer.rst:286 ../../c-api/buffer.rst:288 -#: ../../c-api/buffer.rst:290 ../../c-api/buffer.rst:308 -#: ../../c-api/buffer.rst:310 ../../c-api/buffer.rst:312 -#: ../../c-api/buffer.rst:314 ../../c-api/buffer.rst:337 -#: ../../c-api/buffer.rst:339 ../../c-api/buffer.rst:341 -#: ../../c-api/buffer.rst:343 ../../c-api/buffer.rst:345 -#: ../../c-api/buffer.rst:347 +#: ../../c-api/buffer.rst:287 ../../c-api/buffer.rst:289 +#: ../../c-api/buffer.rst:291 ../../c-api/buffer.rst:309 +#: ../../c-api/buffer.rst:311 ../../c-api/buffer.rst:313 +#: ../../c-api/buffer.rst:315 ../../c-api/buffer.rst:338 +#: ../../c-api/buffer.rst:340 ../../c-api/buffer.rst:342 +#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:346 +#: ../../c-api/buffer.rst:348 msgid "NULL" msgstr "NULL" -#: ../../c-api/buffer.rst:297 +#: ../../c-api/buffer.rst:298 msgid "contiguity requests" msgstr "" -#: ../../c-api/buffer.rst:299 +#: ../../c-api/buffer.rst:300 msgid "" "C or Fortran :term:`contiguity ` can be explicitly requested, " "with and without stride information. Without stride information, the buffer " "must be C-contiguous." msgstr "" -#: ../../c-api/buffer.rst:306 ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:307 ../../c-api/buffer.rst:332 msgid "contig" msgstr "" -#: ../../c-api/buffer.rst:308 ../../c-api/buffer.rst:314 -#: ../../c-api/buffer.rst:345 ../../c-api/buffer.rst:347 +#: ../../c-api/buffer.rst:309 ../../c-api/buffer.rst:315 +#: ../../c-api/buffer.rst:346 ../../c-api/buffer.rst:348 msgid "C" msgstr "C" -#: ../../c-api/buffer.rst:310 +#: ../../c-api/buffer.rst:311 msgid "F" msgstr "F" -#: ../../c-api/buffer.rst:312 +#: ../../c-api/buffer.rst:313 msgid "C or F" msgstr "C 或 F" -#: ../../c-api/buffer.rst:314 +#: ../../c-api/buffer.rst:315 msgid ":c:macro:`PyBUF_ND`" msgstr ":c:macro:`PyBUF_ND`" -#: ../../c-api/buffer.rst:319 +#: ../../c-api/buffer.rst:320 msgid "compound requests" msgstr "" -#: ../../c-api/buffer.rst:321 +#: ../../c-api/buffer.rst:322 msgid "" "All possible requests are fully defined by some combination of the flags in " "the previous section. For convenience, the buffer protocol provides " "frequently used combinations as single flags." msgstr "" -#: ../../c-api/buffer.rst:325 +#: ../../c-api/buffer.rst:326 msgid "" "In the following table *U* stands for undefined contiguity. The consumer " "would have to call :c:func:`PyBuffer_IsContiguous` to determine contiguity." msgstr "" -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:332 msgid "readonly" msgstr "" -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:332 msgid "format" msgstr "" -#: ../../c-api/buffer.rst:333 ../../c-api/buffer.rst:335 -#: ../../c-api/buffer.rst:337 ../../c-api/buffer.rst:339 -#: ../../c-api/buffer.rst:341 ../../c-api/buffer.rst:343 +#: ../../c-api/buffer.rst:334 ../../c-api/buffer.rst:336 +#: ../../c-api/buffer.rst:338 ../../c-api/buffer.rst:340 +#: ../../c-api/buffer.rst:342 ../../c-api/buffer.rst:344 msgid "U" msgstr "U" -#: ../../c-api/buffer.rst:333 ../../c-api/buffer.rst:337 -#: ../../c-api/buffer.rst:341 ../../c-api/buffer.rst:345 +#: ../../c-api/buffer.rst:334 ../../c-api/buffer.rst:338 +#: ../../c-api/buffer.rst:342 ../../c-api/buffer.rst:346 msgid "0" msgstr "0" -#: ../../c-api/buffer.rst:335 ../../c-api/buffer.rst:339 -#: ../../c-api/buffer.rst:343 ../../c-api/buffer.rst:347 +#: ../../c-api/buffer.rst:336 ../../c-api/buffer.rst:340 +#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:348 msgid "1 or 0" msgstr "1 或 0" -#: ../../c-api/buffer.rst:352 +#: ../../c-api/buffer.rst:353 msgid "Complex arrays" msgstr "" -#: ../../c-api/buffer.rst:355 +#: ../../c-api/buffer.rst:356 msgid "NumPy-style: shape and strides" msgstr "" -#: ../../c-api/buffer.rst:357 +#: ../../c-api/buffer.rst:358 msgid "" "The logical structure of NumPy-style arrays is defined by :c:member:" "`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`, :c:member:`~Py_buffer." "shape` and :c:member:`~Py_buffer.strides`." msgstr "" -#: ../../c-api/buffer.rst:360 +#: ../../c-api/buffer.rst:361 msgid "" "If ``ndim == 0``, the memory location pointed to by :c:member:`~Py_buffer." "buf` is interpreted as a scalar of size :c:member:`~Py_buffer.itemsize`. In " @@ -526,14 +528,14 @@ msgid "" "strides` are ``NULL``." msgstr "" -#: ../../c-api/buffer.rst:364 +#: ../../c-api/buffer.rst:365 msgid "" "If :c:member:`~Py_buffer.strides` is ``NULL``, the array is interpreted as a " "standard n-dimensional C-array. Otherwise, the consumer must access an n-" "dimensional array as follows:" msgstr "" -#: ../../c-api/buffer.rst:368 +#: ../../c-api/buffer.rst:369 msgid "" "ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * " "strides[n-1];\n" @@ -543,14 +545,14 @@ msgstr "" "strides[n-1];\n" "item = *((typeof(item) *)ptr);" -#: ../../c-api/buffer.rst:374 +#: ../../c-api/buffer.rst:375 msgid "" "As noted above, :c:member:`~Py_buffer.buf` can point to any location within " "the actual memory block. An exporter can check the validity of a buffer with " "this function:" msgstr "" -#: ../../c-api/buffer.rst:378 +#: ../../c-api/buffer.rst:379 msgid "" "def verify_structure(memlen, itemsize, ndim, shape, strides, offset):\n" " \"\"\"Verify that the parameters represent a valid array within\n" @@ -579,11 +581,11 @@ msgid "" " return 0 <= offset+imin and offset+imax+itemsize <= memlen" msgstr "" -#: ../../c-api/buffer.rst:408 +#: ../../c-api/buffer.rst:409 msgid "PIL-style: shape, strides and suboffsets" msgstr "" -#: ../../c-api/buffer.rst:410 +#: ../../c-api/buffer.rst:411 msgid "" "In addition to the regular items, PIL-style arrays can contain pointers that " "must be followed in order to get to the next element in a dimension. For " @@ -594,14 +596,14 @@ msgid "" "x[2][3]`` arrays that can be located anywhere in memory." msgstr "" -#: ../../c-api/buffer.rst:419 +#: ../../c-api/buffer.rst:420 msgid "" "Here is a function that returns a pointer to the element in an N-D array " "pointed to by an N-dimensional index when there are both non-``NULL`` " "strides and suboffsets::" msgstr "" -#: ../../c-api/buffer.rst:423 +#: ../../c-api/buffer.rst:424 msgid "" "void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n" " Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n" @@ -629,25 +631,25 @@ msgstr "" " return (void*)pointer;\n" "}" -#: ../../c-api/buffer.rst:438 +#: ../../c-api/buffer.rst:439 msgid "Buffer-related functions" msgstr "" -#: ../../c-api/buffer.rst:442 +#: ../../c-api/buffer.rst:443 msgid "" "Return ``1`` if *obj* supports the buffer interface otherwise ``0``. When " "``1`` is returned, it doesn't guarantee that :c:func:`PyObject_GetBuffer` " "will succeed. This function always succeeds." msgstr "" -#: ../../c-api/buffer.rst:449 +#: ../../c-api/buffer.rst:450 msgid "" "Send a request to *exporter* to fill in *view* as specified by *flags*. If " "the exporter cannot provide a buffer of the exact type, it MUST raise :exc:" "`BufferError`, set ``view->obj`` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/buffer.rst:454 +#: ../../c-api/buffer.rst:455 msgid "" "On success, fill in *view*, set ``view->obj`` to a new reference to " "*exporter* and return 0. In the case of chained buffer providers that " @@ -655,7 +657,7 @@ msgid "" "instead of *exporter* (See :ref:`Buffer Object Structures `)." msgstr "" -#: ../../c-api/buffer.rst:459 +#: ../../c-api/buffer.rst:460 msgid "" "Successful calls to :c:func:`PyObject_GetBuffer` must be paired with calls " "to :c:func:`PyBuffer_Release`, similar to :c:func:`malloc` and :c:func:" @@ -663,7 +665,7 @@ msgid "" "`PyBuffer_Release` must be called exactly once." msgstr "" -#: ../../c-api/buffer.rst:467 +#: ../../c-api/buffer.rst:468 msgid "" "Release the buffer *view* and release the :term:`strong reference` (i.e. " "decrement the reference count) to the view's supporting object, ``view-" @@ -671,19 +673,19 @@ msgid "" "used, otherwise reference leaks may occur." msgstr "" -#: ../../c-api/buffer.rst:472 +#: ../../c-api/buffer.rst:473 msgid "" "It is an error to call this function on a buffer that was not obtained via :" "c:func:`PyObject_GetBuffer`." msgstr "" -#: ../../c-api/buffer.rst:478 +#: ../../c-api/buffer.rst:479 msgid "" "Return the implied :c:member:`~Py_buffer.itemsize` from :c:member:" "`~Py_buffer.format`. On error, raise an exception and return -1." msgstr "" -#: ../../c-api/buffer.rst:486 +#: ../../c-api/buffer.rst:487 msgid "" "Return ``1`` if the memory defined by the *view* is C-style (*order* is " "``'C'``) or Fortran-style (*order* is ``'F'``) :term:`contiguous` or either " @@ -691,69 +693,69 @@ msgid "" "succeeds." msgstr "" -#: ../../c-api/buffer.rst:493 +#: ../../c-api/buffer.rst:494 msgid "" "Get the memory area pointed to by the *indices* inside the given *view*. " "*indices* must point to an array of ``view->ndim`` indices." msgstr "" -#: ../../c-api/buffer.rst:499 +#: ../../c-api/buffer.rst:500 msgid "" "Copy contiguous *len* bytes from *buf* to *view*. *fort* can be ``'C'`` or " "``'F'`` (for C-style or Fortran-style ordering). ``0`` is returned on " "success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:506 +#: ../../c-api/buffer.rst:507 msgid "" "Copy *len* bytes from *src* to its contiguous representation in *buf*. " "*order* can be ``'C'`` or ``'F'`` or ``'A'`` (for C-style or Fortran-style " "ordering or either one). ``0`` is returned on success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:510 +#: ../../c-api/buffer.rst:511 msgid "This function fails if *len* != *src->len*." msgstr "" -#: ../../c-api/buffer.rst:515 +#: ../../c-api/buffer.rst:516 msgid "" "Copy data from *src* to *dest* buffer. Can convert between C-style and or " "Fortran-style buffers." msgstr "" -#: ../../c-api/buffer.rst:518 +#: ../../c-api/buffer.rst:519 msgid "``0`` is returned on success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:522 +#: ../../c-api/buffer.rst:523 msgid "" "Fill the *strides* array with byte-strides of a :term:`contiguous` (C-style " "if *order* is ``'C'`` or Fortran-style if *order* is ``'F'``) array of the " "given shape with the given number of bytes per element." msgstr "" -#: ../../c-api/buffer.rst:529 +#: ../../c-api/buffer.rst:530 msgid "" "Handle buffer requests for an exporter that wants to expose *buf* of size " "*len* with writability set according to *readonly*. *buf* is interpreted as " "a sequence of unsigned bytes." msgstr "" -#: ../../c-api/buffer.rst:533 +#: ../../c-api/buffer.rst:534 msgid "" "The *flags* argument indicates the request type. This function always fills " "in *view* as specified by flags, unless *buf* has been designated as read-" "only and :c:macro:`PyBUF_WRITABLE` is set in *flags*." msgstr "" -#: ../../c-api/buffer.rst:537 +#: ../../c-api/buffer.rst:538 msgid "" "On success, set ``view->obj`` to a new reference to *exporter* and return 0. " "Otherwise, raise :exc:`BufferError`, set ``view->obj`` to ``NULL`` and " "return ``-1``;" msgstr "" -#: ../../c-api/buffer.rst:541 +#: ../../c-api/buffer.rst:542 msgid "" "If this function is used as part of a :ref:`getbufferproc `, " "*exporter* MUST be set to the exporting object and *flags* must be passed " @@ -780,14 +782,14 @@ msgstr "buffer object(緩衝物件)" msgid "PyBufferProcs (C type)" msgstr "PyBufferProcs(C 型別)" -#: ../../c-api/buffer.rst:294 +#: ../../c-api/buffer.rst:295 msgid "contiguous" msgstr "contiguous(連續的)" -#: ../../c-api/buffer.rst:294 +#: ../../c-api/buffer.rst:295 msgid "C-contiguous" msgstr "C-contiguous(C 連續的)" -#: ../../c-api/buffer.rst:294 +#: ../../c-api/buffer.rst:295 msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" diff --git a/c-api/exceptions.po b/c-api/exceptions.po index c0ba0fe6ca..faaa283f82 100644 --- a/c-api/exceptions.po +++ b/c-api/exceptions.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -784,9 +784,9 @@ msgstr "" #: ../../c-api/exceptions.rst:736 msgid "" -"The :attr:`!__module__` attribute of the new class is set to the first part " -"(up to the last dot) of the *name* argument, and the class name is set to " -"the last part (after the last dot). The *base* argument can be used to " +"The :attr:`~type.__module__` attribute of the new class is set to the first " +"part (up to the last dot) of the *name* argument, and the class name is set " +"to the last part (after the last dot). The *base* argument can be used to " "specify alternate base classes; it can either be only one class or a tuple " "of classes. The *dict* argument can be used to specify a dictionary of class " "variables and methods." diff --git a/c-api/init.po b/c-api/init.po index 9ca9aecb98..f06d0dbb97 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-04 00:13+0000\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1470,7 +1470,7 @@ msgstr "" #: ../../c-api/init.rst:1220 msgid "" "Destroy the current thread state and release the global interpreter lock. " -"Like :c:func:`PyThreadState_Delete`, the global interpreter lock need not be " +"Like :c:func:`PyThreadState_Delete`, the global interpreter lock must be " "held. The thread state must have been reset with a previous call to :c:func:" "`PyThreadState_Clear`." msgstr "" diff --git a/c-api/long.po b/c-api/long.po index 7c2be2dcee..8416a8fa8a 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-30 09:19+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-" @@ -166,41 +166,52 @@ msgid "" "most-significant bit is not a sign bit. Flags other than endian are ignored." msgstr "" -#: ../../c-api/long.rst:149 ../../c-api/long.rst:175 +#: ../../c-api/long.rst:148 ../../c-api/long.rst:184 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__` " "method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:153 +#: ../../c-api/long.rst:152 msgid "" "Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" "expr:`long`." msgstr "" -#: ../../c-api/long.rst:156 ../../c-api/long.rst:184 ../../c-api/long.rst:205 -#: ../../c-api/long.rst:225 ../../c-api/long.rst:248 +#: ../../c-api/long.rst:155 ../../c-api/long.rst:193 ../../c-api/long.rst:214 +#: ../../c-api/long.rst:234 ../../c-api/long.rst:257 msgid "Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:158 ../../c-api/long.rst:186 ../../c-api/long.rst:207 -#: ../../c-api/long.rst:229 ../../c-api/long.rst:313 ../../c-api/long.rst:333 +#: ../../c-api/long.rst:157 ../../c-api/long.rst:195 ../../c-api/long.rst:216 +#: ../../c-api/long.rst:238 ../../c-api/long.rst:322 ../../c-api/long.rst:342 msgid "Use :meth:`~object.__index__` if available." msgstr "" -#: ../../c-api/long.rst:161 ../../c-api/long.rst:189 ../../c-api/long.rst:210 -#: ../../c-api/long.rst:232 ../../c-api/long.rst:316 ../../c-api/long.rst:336 +#: ../../c-api/long.rst:160 ../../c-api/long.rst:198 ../../c-api/long.rst:219 +#: ../../c-api/long.rst:241 ../../c-api/long.rst:325 ../../c-api/long.rst:345 msgid "This function will no longer use :meth:`~object.__int__`." msgstr "" #: ../../c-api/long.rst:167 msgid "" +"A :term:`soft deprecated` alias. Exactly equivalent to the preferred " +"``PyLong_AsLong``. In particular, it can fail with :exc:`OverflowError` or " +"another exception." +msgstr "" + +#: ../../c-api/long.rst:171 +msgid "The function is soft deprecated." +msgstr "" + +#: ../../c-api/long.rst:176 +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:179 +#: ../../c-api/long.rst:188 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 " @@ -208,20 +219,20 @@ msgid "" "exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" -#: ../../c-api/long.rst:198 ../../c-api/long.rst:216 +#: ../../c-api/long.rst:207 ../../c-api/long.rst:225 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:202 +#: ../../c-api/long.rst:211 msgid "" "Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" "expr:`long long`." msgstr "" -#: ../../c-api/long.rst:220 +#: ../../c-api/long.rst:229 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 " @@ -229,133 +240,133 @@ msgid "" "exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" -#: ../../c-api/long.rst:242 +#: ../../c-api/long.rst:251 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:245 +#: ../../c-api/long.rst:254 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:257 +#: ../../c-api/long.rst:266 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:260 +#: ../../c-api/long.rst:269 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "expr:`unsigned long`." msgstr "" -#: ../../c-api/long.rst:263 +#: ../../c-api/long.rst:272 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:273 +#: ../../c-api/long.rst:282 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:276 +#: ../../c-api/long.rst:285 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "type:`size_t`." msgstr "" -#: ../../c-api/long.rst:279 +#: ../../c-api/long.rst:288 msgid "" "Returns ``(size_t)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:288 +#: ../../c-api/long.rst:297 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:291 +#: ../../c-api/long.rst:300 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:294 +#: ../../c-api/long.rst:303 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:297 +#: ../../c-api/long.rst:306 msgid "" "A negative *pylong* now raises :exc:`OverflowError`, not :exc:`TypeError`." msgstr "" -#: ../../c-api/long.rst:303 +#: ../../c-api/long.rst:312 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:307 +#: ../../c-api/long.rst:316 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:310 +#: ../../c-api/long.rst:319 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:322 +#: ../../c-api/long.rst:331 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:327 +#: ../../c-api/long.rst:336 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:330 +#: ../../c-api/long.rst:339 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` " "to disambiguate." msgstr "" -#: ../../c-api/long.rst:342 +#: ../../c-api/long.rst:351 msgid "" "Return a C :c:expr:`double` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:345 +#: ../../c-api/long.rst:354 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "expr:`double`." msgstr "" -#: ../../c-api/long.rst:348 +#: ../../c-api/long.rst:357 msgid "" "Returns ``-1.0`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:353 +#: ../../c-api/long.rst:362 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 " @@ -363,33 +374,33 @@ msgid "" "c:func:`PyLong_FromVoidPtr`." msgstr "" -#: ../../c-api/long.rst:358 +#: ../../c-api/long.rst:367 msgid "" "Returns ``NULL`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:363 +#: ../../c-api/long.rst:372 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:367 +#: ../../c-api/long.rst:376 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:371 +#: ../../c-api/long.rst:380 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 " "*n_bytes* of the buffer are written: large buffers are padded with zeroes." msgstr "" -#: ../../c-api/long.rst:376 +#: ../../c-api/long.rst:385 msgid "" "If the returned value is greater than than *n_bytes*, the value was " "truncated: as many of the lowest bits of the value as could fit are written, " @@ -397,25 +408,25 @@ msgid "" "style downcast." msgstr "" -#: ../../c-api/long.rst:383 +#: ../../c-api/long.rst:392 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:386 +#: ../../c-api/long.rst:395 msgid "``0`` will never be returned." msgstr "``0`` 將永不被回傳。" -#: ../../c-api/long.rst:388 +#: ../../c-api/long.rst:397 msgid "Values are always copied as two's-complement." msgstr "" -#: ../../c-api/long.rst:390 +#: ../../c-api/long.rst:399 msgid "Usage example::" msgstr "使用範例: ::" -#: ../../c-api/long.rst:392 +#: ../../c-api/long.rst:401 msgid "" "int32_t value;\n" "Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, &value, sizeof(value), -1);\n" @@ -432,26 +443,26 @@ msgid "" "}" msgstr "" -#: ../../c-api/long.rst:406 +#: ../../c-api/long.rst:415 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:413 +#: ../../c-api/long.rst:422 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:416 +#: ../../c-api/long.rst:425 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:419 +#: ../../c-api/long.rst:428 msgid "" "// Ask how much space we need.\n" "Py_ssize_t expected = PyLong_AsNativeBytes(pylong, NULL, 0, -1);\n" @@ -482,69 +493,69 @@ msgid "" "free(bignum);" msgstr "" -#: ../../c-api/long.rst:447 +#: ../../c-api/long.rst:456 msgid "" "*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults " "that behave most like a C cast, or a combintation of the other flags in the " "table below. Note that ``-1`` cannot be combined with other flags." msgstr "" -#: ../../c-api/long.rst:452 +#: ../../c-api/long.rst:461 msgid "" "Currently, ``-1`` corresponds to ``Py_ASNATIVEBYTES_NATIVE_ENDIAN | " "Py_ASNATIVEBYTES_UNSIGNED_BUFFER``." msgstr "" -#: ../../c-api/long.rst:458 +#: ../../c-api/long.rst:467 msgid "Flag" msgstr "旗標" -#: ../../c-api/long.rst:458 +#: ../../c-api/long.rst:467 msgid "Value" msgstr "數值" -#: ../../c-api/long.rst:460 +#: ../../c-api/long.rst:469 msgid "``-1``" msgstr "``-1``" -#: ../../c-api/long.rst:461 +#: ../../c-api/long.rst:470 msgid "``0``" msgstr "``0``" -#: ../../c-api/long.rst:462 +#: ../../c-api/long.rst:471 msgid "``1``" msgstr "``1``" -#: ../../c-api/long.rst:463 +#: ../../c-api/long.rst:472 msgid "``3``" msgstr "``3``" -#: ../../c-api/long.rst:464 +#: ../../c-api/long.rst:473 msgid "``4``" msgstr "``4``" -#: ../../c-api/long.rst:465 +#: ../../c-api/long.rst:474 msgid "``8``" msgstr "``8``" -#: ../../c-api/long.rst:466 +#: ../../c-api/long.rst:475 msgid "``16``" msgstr "``16``" -#: ../../c-api/long.rst:469 +#: ../../c-api/long.rst:478 msgid "" "Specifying ``Py_ASNATIVEBYTES_NATIVE_ENDIAN`` will override any other endian " "flags. Passing ``2`` is reserved." msgstr "" -#: ../../c-api/long.rst:472 +#: ../../c-api/long.rst:481 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:476 +#: ../../c-api/long.rst:485 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 " @@ -554,7 +565,7 @@ msgid "" "requested." msgstr "" -#: ../../c-api/long.rst:483 +#: ../../c-api/long.rst:492 msgid "" "Specifying ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` causes an exception to be " "set if *pylong* is negative. Without this flag, negative values will be " @@ -562,7 +573,7 @@ msgid "" "of whether ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` was specified." msgstr "" -#: ../../c-api/long.rst:488 +#: ../../c-api/long.rst:497 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 " @@ -572,7 +583,7 @@ msgid "" "`TypeError`." msgstr "" -#: ../../c-api/long.rst:497 +#: ../../c-api/long.rst:506 msgid "" "With the default *flags* (``-1``, or *UNSIGNED_BUFFER* without " "*REJECT_NEGATIVE*), multiple Python integers can map to a single value " @@ -580,22 +591,22 @@ msgid "" "buffer and set all its bits. This matches typical C cast behavior." msgstr "" -#: ../../c-api/long.rst:508 +#: ../../c-api/long.rst:517 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:512 +#: ../../c-api/long.rst:521 msgid "On failure, return ``NULL`` with an exception set." msgstr "在失敗時,會回傳 ``NULL`` 並設定例外。" -#: ../../c-api/long.rst:519 +#: ../../c-api/long.rst:528 msgid "Return 1 if *op* is compact, 0 otherwise." msgstr "" -#: ../../c-api/long.rst:521 +#: ../../c-api/long.rst:530 msgid "" "This function makes it possible for performance-critical code to implement a " "“fast path” for small integers. For compact values use :c:func:" @@ -603,23 +614,23 @@ msgid "" "`PyLong_As* ` function or :c:func:`PyLong_AsNativeBytes`." msgstr "" -#: ../../c-api/long.rst:527 +#: ../../c-api/long.rst:536 msgid "The speedup is expected to be negligible for most users." msgstr "" -#: ../../c-api/long.rst:529 +#: ../../c-api/long.rst:538 msgid "" "Exactly what values are considered compact is an implementation detail and " "is subject to change." msgstr "" -#: ../../c-api/long.rst:534 +#: ../../c-api/long.rst:543 msgid "" "If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`, " "return its value." msgstr "" -#: ../../c-api/long.rst:537 +#: ../../c-api/long.rst:546 msgid "Otherwise, the return value is undefined." msgstr "" @@ -635,23 +646,23 @@ msgstr "long integer(長整数)" msgid "integer" msgstr "integer(整数)" -#: ../../c-api/long.rst:145 +#: ../../c-api/long.rst:144 msgid "LONG_MAX (C macro)" msgstr "LONG_MAX(C 巨集)" -#: ../../c-api/long.rst:145 ../../c-api/long.rst:195 ../../c-api/long.rst:238 -#: ../../c-api/long.rst:253 ../../c-api/long.rst:269 ../../c-api/long.rst:285 +#: ../../c-api/long.rst:144 ../../c-api/long.rst:204 ../../c-api/long.rst:247 +#: ../../c-api/long.rst:262 ../../c-api/long.rst:278 ../../c-api/long.rst:294 msgid "OverflowError (built-in exception)" msgstr "OverflowError(内建例外)" -#: ../../c-api/long.rst:238 +#: ../../c-api/long.rst:247 msgid "PY_SSIZE_T_MAX (C macro)" msgstr "PY_SSIZE_T_MAX(C 巨集)" -#: ../../c-api/long.rst:253 +#: ../../c-api/long.rst:262 msgid "ULONG_MAX (C macro)" msgstr "ULONG_MAX(C 巨集)" -#: ../../c-api/long.rst:269 +#: ../../c-api/long.rst:278 msgid "SIZE_MAX (C macro)" msgstr "SIZE_MAX(C 巨集)" diff --git a/c-api/object.po b/c-api/object.po index 039b7a3b69..d557e3d5c6 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -477,17 +477,17 @@ msgstr "" #: ../../c-api/object.rst:370 msgid "" -"If *cls* has a :meth:`~class.__subclasscheck__` method, it will be called to " +"If *cls* has a :meth:`~type.__subclasscheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " "*derived* is a subclass of *cls* if it is a direct or indirect subclass, i." -"e. contained in ``cls.__mro__``." +"e. contained in :attr:`cls.__mro__ `." msgstr "" #: ../../c-api/object.rst:375 msgid "" "Normally only class objects, i.e. instances of :class:`type` or a derived " "class, are considered classes. However, objects can override this by having " -"a :attr:`~class.__bases__` attribute (which must be a tuple of base classes)." +"a :attr:`~type.__bases__` attribute (which must be a tuple of base classes)." msgstr "" #: ../../c-api/object.rst:382 @@ -498,7 +498,7 @@ msgstr "" #: ../../c-api/object.rst:389 msgid "" -"If *cls* has a :meth:`~class.__instancecheck__` method, it will be called to " +"If *cls* has a :meth:`~type.__instancecheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " "*inst* is an instance of *cls* if its class is a subclass of *cls*." msgstr "" @@ -506,13 +506,13 @@ msgstr "" #: ../../c-api/object.rst:393 msgid "" "An instance *inst* can override what is considered its class by having a :" -"attr:`~instance.__class__` attribute." +"attr:`~object.__class__` attribute." msgstr "" #: ../../c-api/object.rst:396 msgid "" "An object *cls* can override if it is considered a class, and what its base " -"classes are, by having a :attr:`~class.__bases__` attribute (which must be a " +"classes are, by having a :attr:`~type.__bases__` attribute (which must be a " "tuple of base classes)." msgstr "" diff --git a/c-api/type.po b/c-api/type.po index 0cba8494b9..9ca76377b5 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -65,32 +65,32 @@ msgstr "" #: ../../c-api/type.rst:55 msgid "" "Return the type object's internal namespace, which is otherwise only exposed " -"via a read-only proxy (``cls.__dict__``). This is a replacement for " -"accessing :c:member:`~PyTypeObject.tp_dict` directly. The returned " -"dictionary must be treated as read-only." +"via a read-only proxy (:attr:`cls.__dict__ `). This is a " +"replacement for accessing :c:member:`~PyTypeObject.tp_dict` directly. The " +"returned dictionary must be treated as read-only." msgstr "" -#: ../../c-api/type.rst:60 +#: ../../c-api/type.rst:61 msgid "" "This function is meant for specific embedding and language-binding cases, " "where direct access to the dict is necessary and indirect access (e.g. via " "the proxy or :c:func:`PyObject_GetAttr`) isn't adequate." msgstr "" -#: ../../c-api/type.rst:64 +#: ../../c-api/type.rst:65 msgid "" "Extension modules should continue to use ``tp_dict``, directly or " "indirectly, when setting up their own types." msgstr "" -#: ../../c-api/type.rst:72 +#: ../../c-api/type.rst:73 msgid "" "Invalidate the internal lookup cache for the type and all of its subtypes. " "This function must be called after any manual modification of the attributes " "or base classes of the type." msgstr "" -#: ../../c-api/type.rst:79 +#: ../../c-api/type.rst:80 msgid "" "Register *callback* as a type watcher. Return a non-negative integer ID " "which must be passed to future calls to :c:func:`PyType_Watch`. In case of " @@ -98,21 +98,21 @@ msgid "" "exception." msgstr "" -#: ../../c-api/type.rst:89 +#: ../../c-api/type.rst:90 msgid "" "Clear watcher identified by *watcher_id* (previously returned from :c:func:" "`PyType_AddWatcher`). Return ``0`` on success, ``-1`` on error (e.g. if " "*watcher_id* was never registered.)" msgstr "" -#: ../../c-api/type.rst:93 +#: ../../c-api/type.rst:94 msgid "" "An extension should never call ``PyType_ClearWatcher`` with a *watcher_id* " "that was not returned to it by a previous call to :c:func:" "`PyType_AddWatcher`." msgstr "" -#: ../../c-api/type.rst:102 +#: ../../c-api/type.rst:103 msgid "" "Mark *type* as watched. The callback granted *watcher_id* by :c:func:" "`PyType_AddWatcher` will be called whenever :c:func:`PyType_Modified` " @@ -122,61 +122,61 @@ msgid "" "detail and subject to change.)" msgstr "" -#: ../../c-api/type.rst:109 +#: ../../c-api/type.rst:110 msgid "" "An extension should never call ``PyType_Watch`` with a *watcher_id* that was " "not returned to it by a previous call to :c:func:`PyType_AddWatcher`." msgstr "" -#: ../../c-api/type.rst:117 +#: ../../c-api/type.rst:118 msgid "Type of a type-watcher callback function." msgstr "" -#: ../../c-api/type.rst:119 +#: ../../c-api/type.rst:120 msgid "" "The callback must not modify *type* or cause :c:func:`PyType_Modified` to be " "called on *type* or any type in its MRO; violating this rule could cause " "infinite recursion." msgstr "" -#: ../../c-api/type.rst:128 +#: ../../c-api/type.rst:129 msgid "" "Return non-zero if the type object *o* sets the feature *feature*. Type " "features are denoted by single bit flags." msgstr "" -#: ../../c-api/type.rst:134 +#: ../../c-api/type.rst:135 msgid "" "Return true if the type object includes support for the cycle detector; this " "tests the type flag :c:macro:`Py_TPFLAGS_HAVE_GC`." msgstr "" -#: ../../c-api/type.rst:140 +#: ../../c-api/type.rst:141 msgid "Return true if *a* is a subtype of *b*." msgstr "" -#: ../../c-api/type.rst:142 +#: ../../c-api/type.rst:143 msgid "" -"This function only checks for actual subtypes, which means that :meth:" -"`~class.__subclasscheck__` is not called on *b*. Call :c:func:" -"`PyObject_IsSubclass` to do the same check that :func:`issubclass` would do." +"This function only checks for actual subtypes, which means that :meth:`~type." +"__subclasscheck__` is not called on *b*. Call :c:func:`PyObject_IsSubclass` " +"to do the same check that :func:`issubclass` would do." msgstr "" -#: ../../c-api/type.rst:150 +#: ../../c-api/type.rst:151 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_alloc` slot of a type " "object. Use Python's default memory allocation mechanism to allocate a new " "instance and initialize all its contents to ``NULL``." msgstr "" -#: ../../c-api/type.rst:156 +#: ../../c-api/type.rst:157 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_new` slot of a type " "object. Create a new instance using the type's :c:member:`~PyTypeObject." "tp_alloc` slot." msgstr "" -#: ../../c-api/type.rst:161 +#: ../../c-api/type.rst:162 msgid "" "Finalize a type object. This should be called on all type objects to finish " "their initialization. This function is responsible for adding inherited " @@ -184,7 +184,7 @@ msgid "" "and sets an exception on error." msgstr "" -#: ../../c-api/type.rst:167 +#: ../../c-api/type.rst:168 msgid "" "If some of the base classes implements the GC protocol and the provided type " "does not include the :c:macro:`Py_TPFLAGS_HAVE_GC` in its flags, then the GC " @@ -195,32 +195,32 @@ msgid "" "handle." msgstr "" -#: ../../c-api/type.rst:177 +#: ../../c-api/type.rst:178 msgid "" -"Return the type's name. Equivalent to getting the type's ``__name__`` " -"attribute." +"Return the type's name. Equivalent to getting the type's :attr:`~type." +"__name__` attribute." msgstr "" -#: ../../c-api/type.rst:183 +#: ../../c-api/type.rst:185 msgid "" -"Return the type's qualified name. Equivalent to getting the type's " -"``__qualname__`` attribute." +"Return the type's qualified name. Equivalent to getting the type's :attr:" +"`~type.__qualname__` attribute." msgstr "" -#: ../../c-api/type.rst:190 +#: ../../c-api/type.rst:192 msgid "" "Return the type's fully qualified name. Equivalent to ``f\"{type.__module__}." -"{type.__qualname__}\"``, or ``type.__qualname__`` if ``type.__module__`` is " -"not a string or is equal to ``\"builtins\"``." +"{type.__qualname__}\"``, or :attr:`type.__qualname__` if :attr:`type." +"__module__` is not a string or is equal to ``\"builtins\"``." msgstr "" -#: ../../c-api/type.rst:198 +#: ../../c-api/type.rst:200 msgid "" -"Return the type's module name. Equivalent to getting the ``type.__module__`` " -"attribute." +"Return the type's module name. Equivalent to getting the :attr:`type." +"__module__` attribute." msgstr "" -#: ../../c-api/type.rst:205 +#: ../../c-api/type.rst:207 msgid "" "Return the function pointer stored in the given slot. If the result is " "``NULL``, this indicates that either the slot is ``NULL``, or that the " @@ -228,30 +228,30 @@ msgid "" "result pointer into the appropriate function type." msgstr "" -#: ../../c-api/type.rst:211 +#: ../../c-api/type.rst:213 msgid "" "See :c:member:`PyType_Slot.slot` for possible values of the *slot* argument." msgstr "" -#: ../../c-api/type.rst:215 +#: ../../c-api/type.rst:217 msgid "" ":c:func:`PyType_GetSlot` can now accept all types. Previously, it was " "limited to :ref:`heap types `." msgstr "" -#: ../../c-api/type.rst:221 +#: ../../c-api/type.rst:223 msgid "" "Return the module object associated with the given type when the type was " "created using :c:func:`PyType_FromModuleAndSpec`." msgstr "" -#: ../../c-api/type.rst:224 ../../c-api/type.rst:244 +#: ../../c-api/type.rst:226 ../../c-api/type.rst:246 msgid "" "If no module is associated with the given type, sets :py:class:`TypeError` " "and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:227 +#: ../../c-api/type.rst:229 msgid "" "This function is usually used to get the module in which a method is " "defined. Note that in such a method, ``PyType_GetModule(Py_TYPE(self))`` may " @@ -262,31 +262,31 @@ msgid "" "type:`!PyCMethod` cannot be used." msgstr "" -#: ../../c-api/type.rst:240 +#: ../../c-api/type.rst:242 msgid "" "Return the state of the module object associated with the given type. This " "is a shortcut for calling :c:func:`PyModule_GetState()` on the result of :c:" "func:`PyType_GetModule`." msgstr "" -#: ../../c-api/type.rst:247 +#: ../../c-api/type.rst:249 msgid "" "If the *type* has an associated module but its state is ``NULL``, returns " "``NULL`` without setting an exception." msgstr "" -#: ../../c-api/type.rst:254 +#: ../../c-api/type.rst:256 msgid "" "Find the first superclass whose module was created from the given :c:type:" "`PyModuleDef` *def*, and return that module." msgstr "" -#: ../../c-api/type.rst:257 +#: ../../c-api/type.rst:259 msgid "" "If no module is found, raises a :py:class:`TypeError` and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:259 +#: ../../c-api/type.rst:261 msgid "" "This function is intended to be used together with :c:func:" "`PyModule_GetState()` to get module state from slot methods (such as :c:" @@ -295,40 +295,40 @@ msgid "" "type:`PyCMethod` calling convention." msgstr "" -#: ../../c-api/type.rst:269 +#: ../../c-api/type.rst:271 msgid "Attempt to assign a version tag to the given type." msgstr "" -#: ../../c-api/type.rst:271 +#: ../../c-api/type.rst:273 msgid "" "Returns 1 if the type already had a valid version tag or a new one was " "assigned, or 0 if a new tag could not be assigned." msgstr "" -#: ../../c-api/type.rst:278 +#: ../../c-api/type.rst:280 msgid "Creating Heap-Allocated Types" msgstr "" -#: ../../c-api/type.rst:280 +#: ../../c-api/type.rst:282 msgid "" "The following functions and structs are used to create :ref:`heap types " "`." msgstr "" -#: ../../c-api/type.rst:285 +#: ../../c-api/type.rst:287 msgid "" "Create and return a :ref:`heap type ` from the *spec* (see :c:" "macro:`Py_TPFLAGS_HEAPTYPE`)." msgstr "" -#: ../../c-api/type.rst:288 +#: ../../c-api/type.rst:290 msgid "" "The metaclass *metaclass* is used to construct the resulting type object. " "When *metaclass* is ``NULL``, the metaclass is derived from *bases* (or " "*Py_tp_base[s]* slots if *bases* is ``NULL``, see below)." msgstr "" -#: ../../c-api/type.rst:292 +#: ../../c-api/type.rst:294 msgid "" "Metaclasses that override :c:member:`~PyTypeObject.tp_new` are not " "supported, except if ``tp_new`` is ``NULL``. (For backwards compatibility, " @@ -337,7 +337,7 @@ msgid "" "deprecated and in Python 3.14+ such metaclasses will not be supported.)" msgstr "" -#: ../../c-api/type.rst:299 +#: ../../c-api/type.rst:301 msgid "" "The *bases* argument can be used to specify base classes; it can either be " "only one class or a tuple of classes. If *bases* is ``NULL``, the " @@ -346,7 +346,7 @@ msgid "" "derives from :class:`object`." msgstr "" -#: ../../c-api/type.rst:305 +#: ../../c-api/type.rst:307 msgid "" "The *module* argument can be used to record the module in which the new " "class is defined. It must be a module object or ``NULL``. If not ``NULL``, " @@ -355,11 +355,11 @@ msgid "" "subclasses; it must be specified for each class individually." msgstr "" -#: ../../c-api/type.rst:312 +#: ../../c-api/type.rst:314 msgid "This function calls :c:func:`PyType_Ready` on the new type." msgstr "" -#: ../../c-api/type.rst:314 +#: ../../c-api/type.rst:316 msgid "" "Note that this function does *not* fully match the behavior of calling :py:" "class:`type() ` or using the :keyword:`class` statement. With user-" @@ -368,41 +368,41 @@ msgid "" "Specifically:" msgstr "" -#: ../../c-api/type.rst:321 +#: ../../c-api/type.rst:323 msgid "" ":py:meth:`~object.__new__` is not called on the new class (and it must be " "set to ``type.__new__``)." msgstr "" -#: ../../c-api/type.rst:323 +#: ../../c-api/type.rst:325 msgid ":py:meth:`~object.__init__` is not called on the new class." msgstr "" -#: ../../c-api/type.rst:324 +#: ../../c-api/type.rst:326 msgid ":py:meth:`~object.__init_subclass__` is not called on any bases." msgstr "" -#: ../../c-api/type.rst:325 +#: ../../c-api/type.rst:327 msgid ":py:meth:`~object.__set_name__` is not called on new descriptors." msgstr "" -#: ../../c-api/type.rst:331 +#: ../../c-api/type.rst:333 msgid "Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, module, spec, bases)``。" -#: ../../c-api/type.rst:337 +#: ../../c-api/type.rst:339 msgid "" "The function now accepts a single class as the *bases* argument and ``NULL`` " "as the ``tp_doc`` slot." msgstr "" -#: ../../c-api/type.rst:342 ../../c-api/type.rst:359 +#: ../../c-api/type.rst:344 ../../c-api/type.rst:361 msgid "" "The function now finds and uses a metaclass corresponding to the provided " "base classes. Previously, only :class:`type` instances were returned." msgstr "" -#: ../../c-api/type.rst:345 ../../c-api/type.rst:362 ../../c-api/type.rst:378 +#: ../../c-api/type.rst:347 ../../c-api/type.rst:364 ../../c-api/type.rst:380 msgid "" "The :c:member:`~PyTypeObject.tp_new` of the metaclass is *ignored*. which " "may result in incomplete initialization. Creating classes whose metaclass " @@ -410,42 +410,42 @@ msgid "" "it will be no longer allowed." msgstr "" -#: ../../c-api/type.rst:353 +#: ../../c-api/type.rst:355 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, bases)``。" -#: ../../c-api/type.rst:370 +#: ../../c-api/type.rst:372 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``。" -#: ../../c-api/type.rst:374 +#: ../../c-api/type.rst:376 msgid "" "The function now finds and uses a metaclass corresponding to the base " "classes provided in *Py_tp_base[s]* slots. Previously, only :class:`type` " "instances were returned." msgstr "" -#: ../../c-api/type.rst:395 +#: ../../c-api/type.rst:397 msgid "Structure defining a type's behavior." msgstr "" -#: ../../c-api/type.rst:399 +#: ../../c-api/type.rst:401 msgid "Name of the type, used to set :c:member:`PyTypeObject.tp_name`." msgstr "" -#: ../../c-api/type.rst:403 +#: ../../c-api/type.rst:405 msgid "" "If positive, specifies the size of the instance in bytes. It is used to set :" "c:member:`PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/type.rst:406 +#: ../../c-api/type.rst:408 msgid "" "If zero, specifies that :c:member:`~PyTypeObject.tp_basicsize` should be " "inherited." msgstr "" -#: ../../c-api/type.rst:409 +#: ../../c-api/type.rst:411 msgid "" "If negative, the absolute value specifies how much space instances of the " "class need *in addition* to the superclass. Use :c:func:" @@ -453,17 +453,17 @@ msgid "" "this way." msgstr "" -#: ../../c-api/type.rst:416 +#: ../../c-api/type.rst:418 msgid "Previously, this field could not be negative." msgstr "" -#: ../../c-api/type.rst:420 +#: ../../c-api/type.rst:422 msgid "" "Size of one element of a variable-size type, in bytes. Used to set :c:member:" "`PyTypeObject.tp_itemsize`. See ``tp_itemsize`` documentation for caveats." msgstr "" -#: ../../c-api/type.rst:424 +#: ../../c-api/type.rst:426 msgid "" "If zero, :c:member:`~PyTypeObject.tp_itemsize` is inherited. Extending " "arbitrary variable-sized classes is dangerous, since some types use a fixed " @@ -472,58 +472,58 @@ msgid "" "only possible in the following situations:" msgstr "" -#: ../../c-api/type.rst:431 +#: ../../c-api/type.rst:433 msgid "" "The base is not variable-sized (its :c:member:`~PyTypeObject.tp_itemsize`)." msgstr "" -#: ../../c-api/type.rst:433 +#: ../../c-api/type.rst:435 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is positive, suggesting that " "the memory layout of the base class is known." msgstr "" -#: ../../c-api/type.rst:435 +#: ../../c-api/type.rst:437 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is zero, suggesting that the " "subclass does not access the instance's memory directly." msgstr "" -#: ../../c-api/type.rst:438 +#: ../../c-api/type.rst:440 msgid "With the :c:macro:`Py_TPFLAGS_ITEMS_AT_END` flag." msgstr "" -#: ../../c-api/type.rst:442 +#: ../../c-api/type.rst:444 msgid "Type flags, used to set :c:member:`PyTypeObject.tp_flags`." msgstr "" -#: ../../c-api/type.rst:444 +#: ../../c-api/type.rst:446 msgid "" "If the ``Py_TPFLAGS_HEAPTYPE`` flag is not set, :c:func:" "`PyType_FromSpecWithBases` sets it automatically." msgstr "" -#: ../../c-api/type.rst:449 +#: ../../c-api/type.rst:451 msgid "" "Array of :c:type:`PyType_Slot` structures. Terminated by the special slot " "value ``{0, NULL}``." msgstr "" -#: ../../c-api/type.rst:452 +#: ../../c-api/type.rst:454 msgid "Each slot ID should be specified at most once." msgstr "" -#: ../../c-api/type.rst:462 +#: ../../c-api/type.rst:464 msgid "" "Structure defining optional functionality of a type, containing a slot ID " "and a value pointer." msgstr "" -#: ../../c-api/type.rst:467 +#: ../../c-api/type.rst:469 msgid "A slot ID." msgstr "" -#: ../../c-api/type.rst:469 +#: ../../c-api/type.rst:471 msgid "" "Slot IDs are named like the field names of the structures :c:type:" "`PyTypeObject`, :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, :c:" @@ -531,30 +531,30 @@ msgid "" "prefix. For example, use:" msgstr "" -#: ../../c-api/type.rst:475 +#: ../../c-api/type.rst:477 msgid "``Py_tp_dealloc`` to set :c:member:`PyTypeObject.tp_dealloc`" msgstr "" -#: ../../c-api/type.rst:476 +#: ../../c-api/type.rst:478 msgid "``Py_nb_add`` to set :c:member:`PyNumberMethods.nb_add`" msgstr "" -#: ../../c-api/type.rst:477 +#: ../../c-api/type.rst:479 msgid "``Py_sq_length`` to set :c:member:`PySequenceMethods.sq_length`" msgstr "" -#: ../../c-api/type.rst:479 +#: ../../c-api/type.rst:481 msgid "" "The following “offset” fields cannot be set using :c:type:`PyType_Slot`:" msgstr "" -#: ../../c-api/type.rst:481 +#: ../../c-api/type.rst:483 msgid "" ":c:member:`~PyTypeObject.tp_weaklistoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)" msgstr "" -#: ../../c-api/type.rst:483 +#: ../../c-api/type.rst:485 msgid "" ":c:member:`~PyTypeObject.tp_dictoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_DICT` instead if possible)" @@ -562,7 +562,7 @@ msgstr "" ":c:member:`~PyTypeObject.tp_dictoffset`\\ (如果可能,請改用 :c:macro:" "`Py_TPFLAGS_MANAGED_DICT`)" -#: ../../c-api/type.rst:485 +#: ../../c-api/type.rst:487 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall_offset` (use " "``\"__vectorcalloffset__\"`` in :ref:`PyMemberDef `)" @@ -570,7 +570,7 @@ msgstr "" ":c:member:`~PyTypeObject.tp_vectorcall_offset`\\ (請用 :ref:`PyMemberDef " "` 中的 ``\"__vectorcalloffset__\"``)" -#: ../../c-api/type.rst:489 +#: ../../c-api/type.rst:491 msgid "" "If it is not possible to switch to a ``MANAGED`` flag (for example, for " "vectorcall or to support Python older than 3.12), specify the offset in :c:" @@ -578,48 +578,48 @@ msgid "" "documentation ` for details." msgstr "" -#: ../../c-api/type.rst:495 +#: ../../c-api/type.rst:497 msgid "The following fields cannot be set at all when creating a heap type:" msgstr "" -#: ../../c-api/type.rst:497 +#: ../../c-api/type.rst:499 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall` (use :c:member:`~PyTypeObject." "tp_new` and/or :c:member:`~PyTypeObject.tp_init`)" msgstr "" -#: ../../c-api/type.rst:501 +#: ../../c-api/type.rst:503 msgid "" "Internal fields: :c:member:`~PyTypeObject.tp_dict`, :c:member:`~PyTypeObject." "tp_mro`, :c:member:`~PyTypeObject.tp_cache`, :c:member:`~PyTypeObject." "tp_subclasses`, and :c:member:`~PyTypeObject.tp_weaklist`." msgstr "" -#: ../../c-api/type.rst:508 +#: ../../c-api/type.rst:510 msgid "" "Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be problematic on " "some platforms. To avoid issues, use the *bases* argument of :c:func:" "`PyType_FromSpecWithBases` instead." msgstr "" -#: ../../c-api/type.rst:515 +#: ../../c-api/type.rst:517 msgid "Slots in :c:type:`PyBufferProcs` may be set in the unlimited API." msgstr "" -#: ../../c-api/type.rst:517 +#: ../../c-api/type.rst:519 msgid "" ":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." "bf_releasebuffer` are now available under the :ref:`limited API `." msgstr "" -#: ../../c-api/type.rst:524 +#: ../../c-api/type.rst:526 msgid "" "The desired value of the slot. In most cases, this is a pointer to a " "function." msgstr "" -#: ../../c-api/type.rst:527 +#: ../../c-api/type.rst:529 msgid "Slots other than ``Py_tp_doc`` may not be ``NULL``." msgstr "" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index a19d40c885..951587ed1f 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:33+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1410,15 +1410,15 @@ msgstr "" msgid "" "For :ref:`statically allocated type objects `, the *tp_name* " "field should contain a dot. Everything before the last dot is made " -"accessible as the :attr:`__module__` attribute, and everything after the " -"last dot is made accessible as the :attr:`~definition.__name__` attribute." +"accessible as the :attr:`~type.__module__` attribute, and everything after " +"the last dot is made accessible as the :attr:`~type.__name__` attribute." msgstr "" #: ../../c-api/typeobj.rst:574 msgid "" "If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is " -"made accessible as the :attr:`~definition.__name__` attribute, and the :attr:" -"`__module__` attribute is undefined (unless explicitly set in the " +"made accessible as the :attr:`~type.__name__` attribute, and the :attr:" +"`~type.__module__` attribute is undefined (unless explicitly set in the " "dictionary, as explained above). This means your type will be impossible to " "pickle. Additionally, it will not be listed in module documentations " "created with pydoc." @@ -2109,7 +2109,7 @@ msgstr "" #: ../../c-api/typeobj.rst:1134 msgid "" -"This bit indicates that instances of the class have a ``__dict__`` " +"This bit indicates that instances of the class have a `~object.__dict__` " "attribute, and that the space for the dictionary is managed by the VM." msgstr "" @@ -2310,8 +2310,8 @@ msgstr "" #: ../../c-api/typeobj.rst:1337 msgid "" "An optional pointer to a NUL-terminated C string giving the docstring for " -"this type object. This is exposed as the :attr:`__doc__` attribute on the " -"type and instances of the type." +"this type object. This is exposed as the :attr:`~type.__doc__` attribute on " +"the type and instances of the type." msgstr "" #: ../../c-api/typeobj.rst:1343 @@ -3231,7 +3231,7 @@ msgstr "" #: ../../c-api/typeobj.rst:2038 msgid "" -"To get a list of subclasses, call the Python method :py:meth:`~class." +"To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__`." msgstr "" diff --git a/c-api/unicode.po b/c-api/unicode.po index 1245ea48db..8ebbcebe8f 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -317,7 +317,7 @@ msgstr "" #: ../../c-api/unicode.rst:320 msgid "" -"Join two surrogate characters and return a single :c:type:`Py_UCS4` value. " +"Join two surrogate code points and return a single :c:type:`Py_UCS4` value. " "*high* and *low* are respectively the leading and trailing surrogates in a " "surrogate pair. *high* must be in the range [0xD800; 0xDBFF] and *low* must " "be in the range [0xDC00; 0xDFFF]." @@ -346,7 +346,11 @@ msgid "" "created using this function are not resizable." msgstr "" -#: ../../c-api/unicode.rst:347 +#: ../../c-api/unicode.rst:341 +msgid "On error, set an exception and return ``NULL``." +msgstr "" + +#: ../../c-api/unicode.rst:349 msgid "" "Create a new Unicode object with the given *kind* (possible values are :c:" "macro:`PyUnicode_1BYTE_KIND` etc., as returned by :c:func:" @@ -354,7 +358,7 @@ msgid "" "1, 2 or 4 bytes per character, as given by the kind." msgstr "" -#: ../../c-api/unicode.rst:352 +#: ../../c-api/unicode.rst:354 msgid "" "If necessary, the input *buffer* is copied and transformed into the " "canonical representation. For example, if the *buffer* is a UCS4 string (:c:" @@ -362,7 +366,7 @@ msgid "" "range, it will be transformed into UCS1 (:c:macro:`PyUnicode_1BYTE_KIND`)." msgstr "" -#: ../../c-api/unicode.rst:363 +#: ../../c-api/unicode.rst:365 msgid "" "Create a Unicode object from the char buffer *str*. The bytes will be " "interpreted as being UTF-8 encoded. The buffer is copied into the new " @@ -370,29 +374,29 @@ msgid "" "data is not allowed." msgstr "" -#: ../../c-api/unicode.rst:369 +#: ../../c-api/unicode.rst:371 msgid "This function raises :exc:`SystemError` when:" msgstr "" -#: ../../c-api/unicode.rst:371 +#: ../../c-api/unicode.rst:373 msgid "*size* < 0," msgstr "" -#: ../../c-api/unicode.rst:372 +#: ../../c-api/unicode.rst:374 msgid "*str* is ``NULL`` and *size* > 0" msgstr "" -#: ../../c-api/unicode.rst:374 +#: ../../c-api/unicode.rst:376 msgid "*str* == ``NULL`` with *size* > 0 is not allowed anymore." msgstr "" -#: ../../c-api/unicode.rst:380 +#: ../../c-api/unicode.rst:382 msgid "" "Create a Unicode object from a UTF-8 encoded null-terminated char buffer " "*str*." msgstr "" -#: ../../c-api/unicode.rst:386 +#: ../../c-api/unicode.rst:388 msgid "" "Take a C :c:func:`printf`\\ -style *format* string and a variable number of " "arguments, calculate the size of the resulting Python Unicode string and " @@ -401,23 +405,23 @@ msgid "" "*format* ASCII-encoded string." msgstr "" -#: ../../c-api/unicode.rst:392 +#: ../../c-api/unicode.rst:394 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../c-api/unicode.rst:395 +#: ../../c-api/unicode.rst:397 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../c-api/unicode.rst:397 +#: ../../c-api/unicode.rst:399 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../c-api/unicode.rst:400 +#: ../../c-api/unicode.rst:402 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is given in the next argument, which must be of type :c:expr:" @@ -425,7 +429,7 @@ msgid "" "optional precision." msgstr "" -#: ../../c-api/unicode.rst:405 +#: ../../c-api/unicode.rst:407 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. If " "specified as ``'*'`` (an asterisk), the actual precision is given in the " @@ -433,316 +437,316 @@ msgid "" "comes after the precision." msgstr "" -#: ../../c-api/unicode.rst:410 +#: ../../c-api/unicode.rst:412 msgid "Length modifier (optional)." msgstr "" -#: ../../c-api/unicode.rst:412 +#: ../../c-api/unicode.rst:414 msgid "Conversion type." msgstr "" -#: ../../c-api/unicode.rst:414 +#: ../../c-api/unicode.rst:416 msgid "The conversion flag characters are:" msgstr "" -#: ../../c-api/unicode.rst:419 +#: ../../c-api/unicode.rst:421 msgid "Flag" msgstr "旗標" -#: ../../c-api/unicode.rst:419 +#: ../../c-api/unicode.rst:421 msgid "Meaning" msgstr "含義" -#: ../../c-api/unicode.rst:421 +#: ../../c-api/unicode.rst:423 msgid "``0``" msgstr "``0``" -#: ../../c-api/unicode.rst:421 +#: ../../c-api/unicode.rst:423 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../c-api/unicode.rst:423 +#: ../../c-api/unicode.rst:425 msgid "``-``" msgstr "``-``" -#: ../../c-api/unicode.rst:423 +#: ../../c-api/unicode.rst:425 msgid "" "The converted value is left adjusted (overrides the ``0`` flag if both are " "given)." msgstr "" -#: ../../c-api/unicode.rst:427 +#: ../../c-api/unicode.rst:429 msgid "" "The length modifiers for following integer conversions (``d``, ``i``, ``o``, " "``u``, ``x``, or ``X``) specify the type of the argument (:c:expr:`int` by " "default):" msgstr "" -#: ../../c-api/unicode.rst:434 +#: ../../c-api/unicode.rst:436 msgid "Modifier" msgstr "" -#: ../../c-api/unicode.rst:434 +#: ../../c-api/unicode.rst:436 msgid "Types" msgstr "" -#: ../../c-api/unicode.rst:436 +#: ../../c-api/unicode.rst:438 msgid "``l``" msgstr "``l``" -#: ../../c-api/unicode.rst:436 +#: ../../c-api/unicode.rst:438 msgid ":c:expr:`long` or :c:expr:`unsigned long`" msgstr ":c:expr:`long` 或 :c:expr:`unsigned long`" -#: ../../c-api/unicode.rst:438 +#: ../../c-api/unicode.rst:440 msgid "``ll``" msgstr "``ll``" -#: ../../c-api/unicode.rst:438 +#: ../../c-api/unicode.rst:440 msgid ":c:expr:`long long` or :c:expr:`unsigned long long`" msgstr ":c:expr:`long long` 或 :c:expr:`unsigned long long`" -#: ../../c-api/unicode.rst:440 +#: ../../c-api/unicode.rst:442 msgid "``j``" msgstr "``j``" -#: ../../c-api/unicode.rst:440 +#: ../../c-api/unicode.rst:442 msgid ":c:type:`intmax_t` or :c:type:`uintmax_t`" msgstr ":c:type:`intmax_t` 或 :c:type:`uintmax_t`" -#: ../../c-api/unicode.rst:442 +#: ../../c-api/unicode.rst:444 msgid "``z``" msgstr "``z``" -#: ../../c-api/unicode.rst:442 +#: ../../c-api/unicode.rst:444 msgid ":c:type:`size_t` or :c:type:`ssize_t`" msgstr ":c:type:`size_t` 或 :c:type:`ssize_t`" -#: ../../c-api/unicode.rst:444 +#: ../../c-api/unicode.rst:446 msgid "``t``" msgstr "``t``" -#: ../../c-api/unicode.rst:444 +#: ../../c-api/unicode.rst:446 msgid ":c:type:`ptrdiff_t`" msgstr ":c:type:`ptrdiff_t`" -#: ../../c-api/unicode.rst:447 +#: ../../c-api/unicode.rst:449 msgid "" "The length modifier ``l`` for following conversions ``s`` or ``V`` specify " "that the type of the argument is :c:expr:`const wchar_t*`." msgstr "" -#: ../../c-api/unicode.rst:450 +#: ../../c-api/unicode.rst:452 msgid "The conversion specifiers are:" msgstr "" -#: ../../c-api/unicode.rst:456 +#: ../../c-api/unicode.rst:458 msgid "Conversion Specifier" msgstr "" -#: ../../c-api/unicode.rst:457 +#: ../../c-api/unicode.rst:459 msgid "Type" msgstr "" -#: ../../c-api/unicode.rst:458 +#: ../../c-api/unicode.rst:460 msgid "Comment" msgstr "" -#: ../../c-api/unicode.rst:460 +#: ../../c-api/unicode.rst:462 msgid "``%``" msgstr "``%``" -#: ../../c-api/unicode.rst:461 +#: ../../c-api/unicode.rst:463 msgid "*n/a*" msgstr "*n/a*" -#: ../../c-api/unicode.rst:462 +#: ../../c-api/unicode.rst:464 msgid "The literal ``%`` character." msgstr "" -#: ../../c-api/unicode.rst:464 +#: ../../c-api/unicode.rst:466 msgid "``d``, ``i``" msgstr "``d``, ``i``" -#: ../../c-api/unicode.rst:465 ../../c-api/unicode.rst:469 -#: ../../c-api/unicode.rst:473 ../../c-api/unicode.rst:477 -#: ../../c-api/unicode.rst:481 +#: ../../c-api/unicode.rst:467 ../../c-api/unicode.rst:471 +#: ../../c-api/unicode.rst:475 ../../c-api/unicode.rst:479 +#: ../../c-api/unicode.rst:483 msgid "Specified by the length modifier" msgstr "" -#: ../../c-api/unicode.rst:466 +#: ../../c-api/unicode.rst:468 msgid "The decimal representation of a signed C integer." msgstr "" -#: ../../c-api/unicode.rst:468 +#: ../../c-api/unicode.rst:470 msgid "``u``" msgstr "``u``" -#: ../../c-api/unicode.rst:470 +#: ../../c-api/unicode.rst:472 msgid "The decimal representation of an unsigned C integer." msgstr "" -#: ../../c-api/unicode.rst:472 +#: ../../c-api/unicode.rst:474 msgid "``o``" msgstr "``o``" -#: ../../c-api/unicode.rst:474 +#: ../../c-api/unicode.rst:476 msgid "The octal representation of an unsigned C integer." msgstr "" -#: ../../c-api/unicode.rst:476 +#: ../../c-api/unicode.rst:478 msgid "``x``" msgstr "``x``" -#: ../../c-api/unicode.rst:478 +#: ../../c-api/unicode.rst:480 msgid "The hexadecimal representation of an unsigned C integer (lowercase)." msgstr "" -#: ../../c-api/unicode.rst:480 +#: ../../c-api/unicode.rst:482 msgid "``X``" msgstr "``X``" -#: ../../c-api/unicode.rst:482 +#: ../../c-api/unicode.rst:484 msgid "The hexadecimal representation of an unsigned C integer (uppercase)." msgstr "" -#: ../../c-api/unicode.rst:484 +#: ../../c-api/unicode.rst:486 msgid "``c``" msgstr "``c``" -#: ../../c-api/unicode.rst:485 +#: ../../c-api/unicode.rst:487 msgid ":c:expr:`int`" msgstr ":c:expr:`int`" -#: ../../c-api/unicode.rst:486 +#: ../../c-api/unicode.rst:488 msgid "A single character." msgstr "" -#: ../../c-api/unicode.rst:488 +#: ../../c-api/unicode.rst:490 msgid "``s``" msgstr "``s``" -#: ../../c-api/unicode.rst:489 +#: ../../c-api/unicode.rst:491 msgid ":c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`const char*` 或 :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:490 +#: ../../c-api/unicode.rst:492 msgid "A null-terminated C character array." msgstr "" -#: ../../c-api/unicode.rst:492 +#: ../../c-api/unicode.rst:494 msgid "``p``" msgstr "``p``" -#: ../../c-api/unicode.rst:493 +#: ../../c-api/unicode.rst:495 msgid ":c:expr:`const void*`" msgstr ":c:expr:`const void*`" -#: ../../c-api/unicode.rst:494 +#: ../../c-api/unicode.rst:496 msgid "" "The hex representation of a C pointer. Mostly equivalent to " "``printf(\"%p\")`` except that it is guaranteed to start with the literal " "``0x`` regardless of what the platform's ``printf`` yields." msgstr "" -#: ../../c-api/unicode.rst:499 +#: ../../c-api/unicode.rst:501 msgid "``A``" msgstr "``A``" -#: ../../c-api/unicode.rst:500 ../../c-api/unicode.rst:504 -#: ../../c-api/unicode.rst:514 ../../c-api/unicode.rst:518 -#: ../../c-api/unicode.rst:522 ../../c-api/unicode.rst:527 +#: ../../c-api/unicode.rst:502 ../../c-api/unicode.rst:506 +#: ../../c-api/unicode.rst:516 ../../c-api/unicode.rst:520 +#: ../../c-api/unicode.rst:524 ../../c-api/unicode.rst:529 msgid ":c:expr:`PyObject*`" msgstr ":c:expr:`PyObject*`" -#: ../../c-api/unicode.rst:501 +#: ../../c-api/unicode.rst:503 msgid "The result of calling :func:`ascii`." msgstr "" -#: ../../c-api/unicode.rst:503 +#: ../../c-api/unicode.rst:505 msgid "``U``" msgstr "``U``" -#: ../../c-api/unicode.rst:505 +#: ../../c-api/unicode.rst:507 msgid "A Unicode object." msgstr "一 Unicode 物件。" -#: ../../c-api/unicode.rst:507 +#: ../../c-api/unicode.rst:509 msgid "``V``" msgstr "``V``" -#: ../../c-api/unicode.rst:508 +#: ../../c-api/unicode.rst:510 msgid ":c:expr:`PyObject*`, :c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`PyObject*`、:c:expr:`const char*` 或 :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:509 +#: ../../c-api/unicode.rst:511 msgid "" "A Unicode object (which may be ``NULL``) and a null-terminated C character " "array as a second parameter (which will be used, if the first parameter is " "``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:513 +#: ../../c-api/unicode.rst:515 msgid "``S``" msgstr "``S``" -#: ../../c-api/unicode.rst:515 +#: ../../c-api/unicode.rst:517 msgid "The result of calling :c:func:`PyObject_Str`." msgstr "" -#: ../../c-api/unicode.rst:517 +#: ../../c-api/unicode.rst:519 msgid "``R``" msgstr "``R``" -#: ../../c-api/unicode.rst:519 +#: ../../c-api/unicode.rst:521 msgid "The result of calling :c:func:`PyObject_Repr`." msgstr "" -#: ../../c-api/unicode.rst:521 +#: ../../c-api/unicode.rst:523 msgid "``T``" msgstr "``T``" -#: ../../c-api/unicode.rst:523 +#: ../../c-api/unicode.rst:525 msgid "" "Get the fully qualified name of an object type; call :c:func:" "`PyType_GetFullyQualifiedName`." msgstr "" -#: ../../c-api/unicode.rst:526 +#: ../../c-api/unicode.rst:528 msgid "``#T``" msgstr "``#T``" -#: ../../c-api/unicode.rst:528 +#: ../../c-api/unicode.rst:530 msgid "" "Similar to ``T`` format, but use a colon (``:``) as separator between the " "module name and the qualified name." msgstr "" -#: ../../c-api/unicode.rst:531 +#: ../../c-api/unicode.rst:533 msgid "``N``" msgstr "``N``" -#: ../../c-api/unicode.rst:532 ../../c-api/unicode.rst:537 +#: ../../c-api/unicode.rst:534 ../../c-api/unicode.rst:539 msgid ":c:expr:`PyTypeObject*`" msgstr ":c:expr:`PyTypeObject*`" -#: ../../c-api/unicode.rst:533 +#: ../../c-api/unicode.rst:535 msgid "" "Get the fully qualified name of a type; call :c:func:" "`PyType_GetFullyQualifiedName`." msgstr "" -#: ../../c-api/unicode.rst:536 +#: ../../c-api/unicode.rst:538 msgid "``#N``" msgstr "``#N``" -#: ../../c-api/unicode.rst:538 +#: ../../c-api/unicode.rst:540 msgid "" "Similar to ``N`` format, but use a colon (``:``) as separator between the " "module name and the qualified name." msgstr "" -#: ../../c-api/unicode.rst:542 +#: ../../c-api/unicode.rst:544 msgid "" "The width formatter unit is number of characters rather than bytes. The " "precision formatter unit is number of bytes or :c:type:`wchar_t` items (if " @@ -752,28 +756,28 @@ msgid "" "``PyObject*`` argument is not ``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:550 +#: ../../c-api/unicode.rst:552 msgid "" "Unlike to C :c:func:`printf` the ``0`` flag has effect even when a precision " "is given for integer conversions (``d``, ``i``, ``u``, ``o``, ``x``, or " "``X``)." msgstr "" -#: ../../c-api/unicode.rst:554 +#: ../../c-api/unicode.rst:556 msgid "Support for ``\"%lld\"`` and ``\"%llu\"`` added." msgstr "" -#: ../../c-api/unicode.rst:557 +#: ../../c-api/unicode.rst:559 msgid "Support for ``\"%li\"``, ``\"%lli\"`` and ``\"%zi\"`` added." msgstr "" -#: ../../c-api/unicode.rst:560 +#: ../../c-api/unicode.rst:562 msgid "" "Support width and precision formatter for ``\"%s\"``, ``\"%A\"``, " "``\"%U\"``, ``\"%V\"``, ``\"%S\"``, ``\"%R\"`` added." msgstr "" -#: ../../c-api/unicode.rst:564 +#: ../../c-api/unicode.rst:566 msgid "" "Support for conversion specifiers ``o`` and ``X``. Support for length " "modifiers ``j`` and ``t``. Length modifiers are now applied to all integer " @@ -782,40 +786,40 @@ msgid "" "flag ``-``." msgstr "" -#: ../../c-api/unicode.rst:572 +#: ../../c-api/unicode.rst:574 msgid "" "An unrecognized format character now sets a :exc:`SystemError`. In previous " "versions it caused all the rest of the format string to be copied as-is to " "the result string, and any extra arguments discarded." msgstr "" -#: ../../c-api/unicode.rst:576 +#: ../../c-api/unicode.rst:578 msgid "Support for ``%T``, ``%#T``, ``%N`` and ``%#N`` formats added." msgstr "" -#: ../../c-api/unicode.rst:582 +#: ../../c-api/unicode.rst:584 msgid "" "Identical to :c:func:`PyUnicode_FromFormat` except that it takes exactly two " "arguments." msgstr "" -#: ../../c-api/unicode.rst:588 +#: ../../c-api/unicode.rst:590 msgid "" "Copy an instance of a Unicode subtype to a new true Unicode object if " "necessary. If *obj* is already a true Unicode object (not a subtype), return " "a new :term:`strong reference` to the object." msgstr "" -#: ../../c-api/unicode.rst:592 +#: ../../c-api/unicode.rst:594 msgid "" "Objects other than Unicode or its subtypes will cause a :exc:`TypeError`." msgstr "" -#: ../../c-api/unicode.rst:598 +#: ../../c-api/unicode.rst:600 msgid "Decode an encoded object *obj* to a Unicode object." msgstr "" -#: ../../c-api/unicode.rst:600 +#: ../../c-api/unicode.rst:602 msgid "" ":class:`bytes`, :class:`bytearray` and other :term:`bytes-like objects " "` are decoded according to the given *encoding* and using " @@ -823,23 +827,27 @@ msgid "" "interface use the default values (see :ref:`builtincodecs` for details)." msgstr "" -#: ../../c-api/unicode.rst:606 +#: ../../c-api/unicode.rst:608 msgid "" "All other objects, including Unicode objects, cause a :exc:`TypeError` to be " "set." msgstr "" -#: ../../c-api/unicode.rst:609 +#: ../../c-api/unicode.rst:611 msgid "" "The API returns ``NULL`` if there was an error. The caller is responsible " "for decref'ing the returned objects." msgstr "" -#: ../../c-api/unicode.rst:615 +#: ../../c-api/unicode.rst:617 msgid "Return the length of the Unicode object, in code points." msgstr "" -#: ../../c-api/unicode.rst:626 +#: ../../c-api/unicode.rst:619 +msgid "On error, set an exception and return ``-1``." +msgstr "" + +#: ../../c-api/unicode.rst:630 msgid "" "Copy characters from one Unicode object into another. This function " "performs character conversion when necessary and falls back to :c:func:`!" @@ -847,39 +855,43 @@ msgid "" "otherwise returns the number of copied characters." msgstr "" -#: ../../c-api/unicode.rst:637 +#: ../../c-api/unicode.rst:641 msgid "" "Fill a string with a character: write *fill_char* into ``unicode[start:" "start+length]``." msgstr "" -#: ../../c-api/unicode.rst:640 +#: ../../c-api/unicode.rst:644 msgid "" "Fail if *fill_char* is bigger than the string maximum character, or if the " "string has more than 1 reference." msgstr "" -#: ../../c-api/unicode.rst:643 +#: ../../c-api/unicode.rst:647 msgid "" "Return the number of written character, or return ``-1`` and raise an " "exception on error." msgstr "" -#: ../../c-api/unicode.rst:652 +#: ../../c-api/unicode.rst:656 msgid "" "Write a character to a string. The string must have been created through :c:" "func:`PyUnicode_New`. Since Unicode strings are supposed to be immutable, " "the string must not be shared, or have been hashed yet." msgstr "" -#: ../../c-api/unicode.rst:656 +#: ../../c-api/unicode.rst:660 msgid "" "This function checks that *unicode* is a Unicode object, that the index is " "not out of bounds, and that the object can be modified safely (i.e. that it " "its reference count is one)." msgstr "" -#: ../../c-api/unicode.rst:665 +#: ../../c-api/unicode.rst:664 +msgid "Return ``0`` on success, ``-1`` on error with an exception set." +msgstr "" + +#: ../../c-api/unicode.rst:671 msgid "" "Read a character from a string. This function checks that *unicode* is a " "Unicode object and the index is not out of bounds, in contrast to :c:func:" @@ -887,12 +899,17 @@ msgid "" msgstr "" #: ../../c-api/unicode.rst:675 +msgid "Return character on success, ``-1`` on error with an exception set." +msgstr "" + +#: ../../c-api/unicode.rst:683 msgid "" "Return a substring of *unicode*, from character index *start* (included) to " -"character index *end* (excluded). Negative indices are not supported." +"character index *end* (excluded). Negative indices are not supported. On " +"error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:684 +#: ../../c-api/unicode.rst:693 msgid "" "Copy the string *unicode* into a UCS4 buffer, including a null character, if " "*copy_null* is set. Returns ``NULL`` and sets an exception on error (in " @@ -900,7 +917,7 @@ msgid "" "*unicode*). *buffer* is returned on success." msgstr "" -#: ../../c-api/unicode.rst:694 +#: ../../c-api/unicode.rst:703 msgid "" "Copy the string *unicode* into a new UCS4 buffer that is allocated using :c:" "func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:" @@ -908,17 +925,17 @@ msgid "" "appended." msgstr "" -#: ../../c-api/unicode.rst:703 +#: ../../c-api/unicode.rst:712 msgid "Locale Encoding" msgstr "" -#: ../../c-api/unicode.rst:705 +#: ../../c-api/unicode.rst:714 msgid "" "The current locale encoding can be used to decode text from the operating " "system." msgstr "" -#: ../../c-api/unicode.rst:712 +#: ../../c-api/unicode.rst:721 msgid "" "Decode a string from UTF-8 on Android and VxWorks, or from the current " "locale encoding on other platforms. The supported error handlers are " @@ -927,21 +944,21 @@ msgid "" "null character but cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:719 +#: ../../c-api/unicode.rst:728 msgid "" "Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from the :" "term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:722 ../../c-api/unicode.rst:757 +#: ../../c-api/unicode.rst:731 ../../c-api/unicode.rst:766 msgid "This function ignores the :ref:`Python UTF-8 Mode `." msgstr "" -#: ../../c-api/unicode.rst:726 ../../c-api/unicode.rst:823 +#: ../../c-api/unicode.rst:735 ../../c-api/unicode.rst:832 msgid "The :c:func:`Py_DecodeLocale` function." msgstr ":c:func:`Py_DecodeLocale` 函式。" -#: ../../c-api/unicode.rst:730 +#: ../../c-api/unicode.rst:739 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -949,13 +966,13 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:739 +#: ../../c-api/unicode.rst:748 msgid "" "Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string " "length using :c:func:`!strlen`." msgstr "" -#: ../../c-api/unicode.rst:747 +#: ../../c-api/unicode.rst:756 msgid "" "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " "locale encoding on other platforms. The supported error handlers are " @@ -964,17 +981,17 @@ msgid "" "`bytes` object. *unicode* cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:754 +#: ../../c-api/unicode.rst:763 msgid "" "Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to the :term:" "`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:761 ../../c-api/unicode.rst:854 +#: ../../c-api/unicode.rst:770 ../../c-api/unicode.rst:863 msgid "The :c:func:`Py_EncodeLocale` function." msgstr ":c:func:`Py_EncodeLocale` 函式。" -#: ../../c-api/unicode.rst:765 +#: ../../c-api/unicode.rst:774 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -982,24 +999,24 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:774 +#: ../../c-api/unicode.rst:783 msgid "File System Encoding" msgstr "" -#: ../../c-api/unicode.rst:776 +#: ../../c-api/unicode.rst:785 msgid "" "Functions encoding to and decoding from the :term:`filesystem encoding and " "error handler` (:pep:`383` and :pep:`529`)." msgstr "" -#: ../../c-api/unicode.rst:779 +#: ../../c-api/unicode.rst:788 msgid "" "To encode file names to :class:`bytes` during argument parsing, the " "``\"O&\"`` converter should be used, passing :c:func:`PyUnicode_FSConverter` " "as the conversion function:" msgstr "" -#: ../../c-api/unicode.rst:785 +#: ../../c-api/unicode.rst:794 msgid "" "ParseTuple converter: encode :class:`str` objects -- obtained directly or " "through the :class:`os.PathLike` interface -- to :class:`bytes` using :c:" @@ -1008,18 +1025,18 @@ msgid "" "is no longer used." msgstr "" -#: ../../c-api/unicode.rst:793 ../../c-api/unicode.rst:810 +#: ../../c-api/unicode.rst:802 ../../c-api/unicode.rst:819 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../c-api/unicode.rst:796 +#: ../../c-api/unicode.rst:805 msgid "" "To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` " "converter should be used, passing :c:func:`PyUnicode_FSDecoder` as the " "conversion function:" msgstr "" -#: ../../c-api/unicode.rst:802 +#: ../../c-api/unicode.rst:811 msgid "" "ParseTuple converter: decode :class:`bytes` objects -- obtained either " "directly or indirectly through the :class:`os.PathLike` interface -- to :" @@ -1028,57 +1045,57 @@ msgid "" "which must be released when it is no longer used." msgstr "" -#: ../../c-api/unicode.rst:816 +#: ../../c-api/unicode.rst:825 msgid "Decode a string from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:818 +#: ../../c-api/unicode.rst:827 msgid "" "If you need to decode a string from the current locale encoding, use :c:func:" "`PyUnicode_DecodeLocaleAndSize`." msgstr "" -#: ../../c-api/unicode.rst:825 ../../c-api/unicode.rst:838 -#: ../../c-api/unicode.rst:858 +#: ../../c-api/unicode.rst:834 ../../c-api/unicode.rst:847 +#: ../../c-api/unicode.rst:867 msgid "" "The :term:`filesystem error handler ` " "is now used." msgstr "" -#: ../../c-api/unicode.rst:832 +#: ../../c-api/unicode.rst:841 msgid "" "Decode a null-terminated string from the :term:`filesystem encoding and " "error handler`." msgstr "" -#: ../../c-api/unicode.rst:835 +#: ../../c-api/unicode.rst:844 msgid "" "If the string length is known, use :c:func:" "`PyUnicode_DecodeFSDefaultAndSize`." msgstr "" -#: ../../c-api/unicode.rst:845 +#: ../../c-api/unicode.rst:854 msgid "" "Encode a Unicode object to the :term:`filesystem encoding and error " "handler`, and return :class:`bytes`. Note that the resulting :class:`bytes` " "object can contain null bytes." msgstr "" -#: ../../c-api/unicode.rst:849 +#: ../../c-api/unicode.rst:858 msgid "" "If you need to encode a string to the current locale encoding, use :c:func:" "`PyUnicode_EncodeLocale`." msgstr "" -#: ../../c-api/unicode.rst:863 +#: ../../c-api/unicode.rst:872 msgid "wchar_t Support" msgstr "wchar_t 支援" -#: ../../c-api/unicode.rst:865 +#: ../../c-api/unicode.rst:874 msgid ":c:type:`wchar_t` support for platforms which support it:" msgstr "" -#: ../../c-api/unicode.rst:869 +#: ../../c-api/unicode.rst:878 msgid "" "Create a Unicode object from the :c:type:`wchar_t` buffer *wstr* of the " "given *size*. Passing ``-1`` as the *size* indicates that the function must " @@ -1086,7 +1103,7 @@ msgid "" "failure." msgstr "" -#: ../../c-api/unicode.rst:877 +#: ../../c-api/unicode.rst:886 msgid "" "Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. " "At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly " @@ -1094,13 +1111,13 @@ msgid "" "`wchar_t` characters copied or ``-1`` in case of an error." msgstr "" -#: ../../c-api/unicode.rst:882 +#: ../../c-api/unicode.rst:891 msgid "" "When *wstr* is ``NULL``, instead return the *size* that would be required to " "store all of *unicode* including a terminating null." msgstr "" -#: ../../c-api/unicode.rst:885 +#: ../../c-api/unicode.rst:894 msgid "" "Note that the resulting :c:expr:`wchar_t*` string may or may not be null-" "terminated. It is the responsibility of the caller to make sure that the :c:" @@ -1110,7 +1127,7 @@ msgid "" "most C functions." msgstr "" -#: ../../c-api/unicode.rst:895 +#: ../../c-api/unicode.rst:904 msgid "" "Convert the Unicode object to a wide character string. The output string " "always ends with a null character. If *size* is not ``NULL``, write the " @@ -1121,37 +1138,37 @@ msgid "" "`wchar_t*` string contains null characters a :exc:`ValueError` is raised." msgstr "" -#: ../../c-api/unicode.rst:903 +#: ../../c-api/unicode.rst:912 msgid "" "Returns a buffer allocated by :c:macro:`PyMem_New` (use :c:func:`PyMem_Free` " "to free it) on success. On error, returns ``NULL`` and *\\*size* is " "undefined. Raises a :exc:`MemoryError` if memory allocation is failed." msgstr "" -#: ../../c-api/unicode.rst:910 +#: ../../c-api/unicode.rst:919 msgid "" "Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` " "string contains null characters." msgstr "" -#: ../../c-api/unicode.rst:918 +#: ../../c-api/unicode.rst:927 msgid "Built-in Codecs" msgstr "" -#: ../../c-api/unicode.rst:920 +#: ../../c-api/unicode.rst:929 msgid "" "Python provides a set of built-in codecs which are written in C for speed. " "All of these codecs are directly usable via the following functions." msgstr "" -#: ../../c-api/unicode.rst:923 +#: ../../c-api/unicode.rst:932 msgid "" "Many of the following APIs take two arguments encoding and errors, and they " "have the same semantics as the ones of the built-in :func:`str` string " "object constructor." msgstr "" -#: ../../c-api/unicode.rst:927 +#: ../../c-api/unicode.rst:936 msgid "" "Setting encoding to ``NULL`` causes the default encoding to be used which is " "UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for " @@ -1159,28 +1176,28 @@ msgid "" "handler` internally." msgstr "" -#: ../../c-api/unicode.rst:932 +#: ../../c-api/unicode.rst:941 msgid "" "Error handling is set by errors which may also be set to ``NULL`` meaning to " "use the default handling defined for the codec. Default error handling for " "all built-in codecs is \"strict\" (:exc:`ValueError` is raised)." msgstr "" -#: ../../c-api/unicode.rst:936 +#: ../../c-api/unicode.rst:945 msgid "" "The codecs all use a similar interface. Only deviations from the following " "generic ones are documented for simplicity." msgstr "" -#: ../../c-api/unicode.rst:941 +#: ../../c-api/unicode.rst:950 msgid "Generic Codecs" msgstr "" -#: ../../c-api/unicode.rst:943 +#: ../../c-api/unicode.rst:952 msgid "These are the generic codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:949 +#: ../../c-api/unicode.rst:958 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string " "*str*. *encoding* and *errors* have the same meaning as the parameters of " @@ -1189,7 +1206,7 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:959 +#: ../../c-api/unicode.rst:968 msgid "" "Encode a Unicode object and return the result as Python bytes object. " "*encoding* and *errors* have the same meaning as the parameters of the same " @@ -1198,21 +1215,21 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:967 +#: ../../c-api/unicode.rst:976 msgid "UTF-8 Codecs" msgstr "UTF-8 編解碼器" -#: ../../c-api/unicode.rst:969 +#: ../../c-api/unicode.rst:978 msgid "These are the UTF-8 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:974 +#: ../../c-api/unicode.rst:983 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:981 +#: ../../c-api/unicode.rst:990 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF8`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-8 byte sequences will " @@ -1220,14 +1237,20 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:989 +#: ../../c-api/unicode.rst:998 msgid "" "Encode a Unicode object using UTF-8 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:996 +#: ../../c-api/unicode.rst:1002 ../../c-api/unicode.rst:1017 +msgid "" +"The function fails if the string contains surrogate code points (``U+D800`` " +"- ``U+DFFF``)." +msgstr "" + +#: ../../c-api/unicode.rst:1008 msgid "" "Return a pointer to the UTF-8 encoding of the Unicode object, and store the " "size of the encoded representation (in bytes) in *size*. The *size* " @@ -1236,13 +1259,13 @@ msgid "" "regardless of whether there are any other null code points." msgstr "" -#: ../../c-api/unicode.rst:1002 +#: ../../c-api/unicode.rst:1014 msgid "" "On error, set an exception, set *size* to ``-1`` (if it's not NULL) and " "return ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:1005 +#: ../../c-api/unicode.rst:1020 msgid "" "This caches the UTF-8 representation of the string in the Unicode object, " "and subsequent calls will return a pointer to the same buffer. The caller " @@ -1251,47 +1274,47 @@ msgid "" "collected." msgstr "" -#: ../../c-api/unicode.rst:1012 ../../c-api/unicode.rst:1025 +#: ../../c-api/unicode.rst:1027 ../../c-api/unicode.rst:1040 msgid "The return type is now ``const char *`` rather of ``char *``." msgstr "" -#: ../../c-api/unicode.rst:1015 +#: ../../c-api/unicode.rst:1030 msgid "This function is a part of the :ref:`limited API `." msgstr "" -#: ../../c-api/unicode.rst:1021 +#: ../../c-api/unicode.rst:1036 msgid "As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size." msgstr "" -#: ../../c-api/unicode.rst:1030 +#: ../../c-api/unicode.rst:1045 msgid "UTF-32 Codecs" msgstr "UTF-32 編解碼器" -#: ../../c-api/unicode.rst:1032 +#: ../../c-api/unicode.rst:1047 msgid "These are the UTF-32 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1038 +#: ../../c-api/unicode.rst:1053 msgid "" "Decode *size* bytes from a UTF-32 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1042 ../../c-api/unicode.rst:1092 +#: ../../c-api/unicode.rst:1057 ../../c-api/unicode.rst:1107 msgid "" "If *byteorder* is non-``NULL``, the decoder starts decoding using the given " "byte order::" msgstr "" -#: ../../c-api/unicode.rst:1045 ../../c-api/unicode.rst:1095 +#: ../../c-api/unicode.rst:1060 ../../c-api/unicode.rst:1110 msgid "" "*byteorder == -1: little endian\n" "*byteorder == 0: native order\n" "*byteorder == 1: big endian" msgstr "" -#: ../../c-api/unicode.rst:1049 +#: ../../c-api/unicode.rst:1064 msgid "" "If ``*byteorder`` is zero, and the first four bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1299,21 +1322,21 @@ msgid "" "``-1`` or ``1``, any byte order mark is copied to the output." msgstr "" -#: ../../c-api/unicode.rst:1054 +#: ../../c-api/unicode.rst:1069 msgid "" "After completion, *\\*byteorder* is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1057 ../../c-api/unicode.rst:1108 +#: ../../c-api/unicode.rst:1072 ../../c-api/unicode.rst:1123 msgid "If *byteorder* is ``NULL``, the codec starts in native order mode." msgstr "" -#: ../../c-api/unicode.rst:1059 ../../c-api/unicode.rst:1110 +#: ../../c-api/unicode.rst:1074 ../../c-api/unicode.rst:1125 msgid "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1065 +#: ../../c-api/unicode.rst:1080 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF32`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF32Stateful` will not " @@ -1322,29 +1345,29 @@ msgid "" "number of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1074 +#: ../../c-api/unicode.rst:1089 msgid "" "Return a Python byte string using the UTF-32 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1080 +#: ../../c-api/unicode.rst:1095 msgid "UTF-16 Codecs" msgstr "UTF-16 編解碼器" -#: ../../c-api/unicode.rst:1082 +#: ../../c-api/unicode.rst:1097 msgid "These are the UTF-16 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1088 +#: ../../c-api/unicode.rst:1103 msgid "" "Decode *size* bytes from a UTF-16 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1099 +#: ../../c-api/unicode.rst:1114 msgid "" "If ``*byteorder`` is zero, and the first two bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1353,13 +1376,13 @@ msgid "" "result in either a ``\\ufeff`` or a ``\\ufffe`` character)." msgstr "" -#: ../../c-api/unicode.rst:1105 +#: ../../c-api/unicode.rst:1120 msgid "" "After completion, ``*byteorder`` is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1116 +#: ../../c-api/unicode.rst:1131 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF16`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF16Stateful` will not " @@ -1369,28 +1392,28 @@ msgid "" "*consumed*." msgstr "" -#: ../../c-api/unicode.rst:1125 +#: ../../c-api/unicode.rst:1140 msgid "" "Return a Python byte string using the UTF-16 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1131 +#: ../../c-api/unicode.rst:1146 msgid "UTF-7 Codecs" msgstr "UTF-7 編解碼器" -#: ../../c-api/unicode.rst:1133 +#: ../../c-api/unicode.rst:1148 msgid "These are the UTF-7 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1138 +#: ../../c-api/unicode.rst:1153 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1145 +#: ../../c-api/unicode.rst:1160 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF7`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-7 base-64 sections will " @@ -1398,101 +1421,101 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1152 +#: ../../c-api/unicode.rst:1167 msgid "Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1154 +#: ../../c-api/unicode.rst:1169 msgid "These are the \"Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1160 +#: ../../c-api/unicode.rst:1175 msgid "" "Create a Unicode object by decoding *size* bytes of the Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1166 +#: ../../c-api/unicode.rst:1181 msgid "" "Encode a Unicode object using Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1172 +#: ../../c-api/unicode.rst:1187 msgid "Raw-Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1174 +#: ../../c-api/unicode.rst:1189 msgid "These are the \"Raw Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1180 +#: ../../c-api/unicode.rst:1195 msgid "" "Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1186 +#: ../../c-api/unicode.rst:1201 msgid "" "Encode a Unicode object using Raw-Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1192 +#: ../../c-api/unicode.rst:1207 msgid "Latin-1 Codecs" msgstr "Latin-1 編解碼器" -#: ../../c-api/unicode.rst:1194 +#: ../../c-api/unicode.rst:1209 msgid "" "These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 " "Unicode ordinals and only these are accepted by the codecs during encoding." msgstr "" -#: ../../c-api/unicode.rst:1200 +#: ../../c-api/unicode.rst:1215 msgid "" "Create a Unicode object by decoding *size* bytes of the Latin-1 encoded " "string *str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1206 +#: ../../c-api/unicode.rst:1221 msgid "" "Encode a Unicode object using Latin-1 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1212 +#: ../../c-api/unicode.rst:1227 msgid "ASCII Codecs" msgstr "ASCII 編解碼器" -#: ../../c-api/unicode.rst:1214 +#: ../../c-api/unicode.rst:1229 msgid "" "These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All " "other codes generate errors." msgstr "" -#: ../../c-api/unicode.rst:1220 +#: ../../c-api/unicode.rst:1235 msgid "" "Create a Unicode object by decoding *size* bytes of the ASCII encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1226 +#: ../../c-api/unicode.rst:1241 msgid "" "Encode a Unicode object using ASCII and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1232 +#: ../../c-api/unicode.rst:1247 msgid "Character Map Codecs" msgstr "" -#: ../../c-api/unicode.rst:1234 +#: ../../c-api/unicode.rst:1249 msgid "" "This codec is special in that it can be used to implement many different " "codecs (and this is in fact what was done to obtain most of the standard " @@ -1502,18 +1525,18 @@ msgid "" "sequences work well." msgstr "" -#: ../../c-api/unicode.rst:1240 +#: ../../c-api/unicode.rst:1255 msgid "These are the mapping codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1245 +#: ../../c-api/unicode.rst:1260 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string *str* " "using the given *mapping* object. Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1249 +#: ../../c-api/unicode.rst:1264 msgid "" "If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* " "must map bytes ordinals (integers in the range from 0 to 255) to Unicode " @@ -1523,14 +1546,14 @@ msgid "" "treated as undefined mappings and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1260 +#: ../../c-api/unicode.rst:1275 msgid "" "Encode a Unicode object using the given *mapping* object and return the " "result as a bytes object. Error handling is \"strict\". Return ``NULL`` if " "an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1264 +#: ../../c-api/unicode.rst:1279 msgid "" "The *mapping* object must map Unicode ordinal integers to bytes objects, " "integers in the range from 0 to 255 or ``None``. Unmapped character " @@ -1538,41 +1561,41 @@ msgid "" "``None`` are treated as \"undefined mapping\" and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1270 +#: ../../c-api/unicode.rst:1285 msgid "The following codec API is special in that maps Unicode to Unicode." msgstr "" -#: ../../c-api/unicode.rst:1274 +#: ../../c-api/unicode.rst:1289 msgid "" "Translate a string by applying a character mapping table to it and return " "the resulting Unicode object. Return ``NULL`` if an exception was raised by " "the codec." msgstr "" -#: ../../c-api/unicode.rst:1278 +#: ../../c-api/unicode.rst:1293 msgid "" "The mapping table must map Unicode ordinal integers to Unicode ordinal " "integers or ``None`` (causing deletion of the character)." msgstr "" -#: ../../c-api/unicode.rst:1281 +#: ../../c-api/unicode.rst:1296 msgid "" "Mapping tables need only provide the :meth:`~object.__getitem__` interface; " "dictionaries and sequences work well. Unmapped character ordinals (ones " "which cause a :exc:`LookupError`) are left untouched and are copied as-is." msgstr "" -#: ../../c-api/unicode.rst:1285 +#: ../../c-api/unicode.rst:1300 msgid "" "*errors* has the usual meaning for codecs. It may be ``NULL`` which " "indicates to use the default error handling." msgstr "" -#: ../../c-api/unicode.rst:1290 +#: ../../c-api/unicode.rst:1305 msgid "MBCS codecs for Windows" msgstr "" -#: ../../c-api/unicode.rst:1292 +#: ../../c-api/unicode.rst:1307 msgid "" "These are the MBCS codec APIs. They are currently only available on Windows " "and use the Win32 MBCS converters to implement the conversions. Note that " @@ -1580,13 +1603,13 @@ msgid "" "is defined by the user settings on the machine running the codec." msgstr "" -#: ../../c-api/unicode.rst:1299 +#: ../../c-api/unicode.rst:1314 msgid "" "Create a Unicode object by decoding *size* bytes of the MBCS encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1306 +#: ../../c-api/unicode.rst:1321 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeMBCS`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeMBCSStateful` will not " @@ -1594,44 +1617,44 @@ msgid "" "will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1314 +#: ../../c-api/unicode.rst:1329 msgid "" "Encode a Unicode object using MBCS and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1321 +#: ../../c-api/unicode.rst:1336 msgid "" "Encode the Unicode object using the specified code page and return a Python " "bytes object. Return ``NULL`` if an exception was raised by the codec. Use :" "c:macro:`!CP_ACP` code page to get the MBCS encoder." msgstr "" -#: ../../c-api/unicode.rst:1329 +#: ../../c-api/unicode.rst:1344 msgid "Methods & Slots" msgstr "" -#: ../../c-api/unicode.rst:1335 +#: ../../c-api/unicode.rst:1350 msgid "Methods and Slot Functions" msgstr "" -#: ../../c-api/unicode.rst:1337 +#: ../../c-api/unicode.rst:1352 msgid "" "The following APIs are capable of handling Unicode objects and strings on " "input (we refer to them as strings in the descriptions) and return Unicode " "objects or integers as appropriate." msgstr "" -#: ../../c-api/unicode.rst:1341 +#: ../../c-api/unicode.rst:1356 msgid "They all return ``NULL`` or ``-1`` if an exception occurs." msgstr "" -#: ../../c-api/unicode.rst:1346 +#: ../../c-api/unicode.rst:1361 msgid "Concat two strings giving a new Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1351 +#: ../../c-api/unicode.rst:1366 msgid "" "Split a string giving a list of Unicode strings. If *sep* is ``NULL``, " "splitting will be done at all whitespace substrings. Otherwise, splits " @@ -1640,27 +1663,27 @@ msgid "" "list." msgstr "" -#: ../../c-api/unicode.rst:1359 +#: ../../c-api/unicode.rst:1374 msgid "" "Split a Unicode string at line breaks, returning a list of Unicode strings. " "CRLF is considered to be one line break. If *keepends* is ``0``, the Line " "break characters are not included in the resulting strings." msgstr "" -#: ../../c-api/unicode.rst:1366 +#: ../../c-api/unicode.rst:1381 msgid "" "Join a sequence of strings using the given *separator* and return the " "resulting Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1373 +#: ../../c-api/unicode.rst:1388 msgid "" "Return ``1`` if *substr* matches ``unicode[start:end]`` at the given tail " "end (*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` " "a suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1381 +#: ../../c-api/unicode.rst:1396 msgid "" "Return the first position of *substr* in ``unicode[start:end]`` using the " "given *direction* (*direction* == ``1`` means to do a forward search, " @@ -1669,7 +1692,7 @@ msgid "" "``-2`` indicates that an error occurred and an exception has been set." msgstr "" -#: ../../c-api/unicode.rst:1391 +#: ../../c-api/unicode.rst:1406 msgid "" "Return the first position of the character *ch* in ``unicode[start:end]`` " "using the given *direction* (*direction* == ``1`` means to do a forward " @@ -1679,56 +1702,57 @@ msgid "" "set." msgstr "" -#: ../../c-api/unicode.rst:1399 +#: ../../c-api/unicode.rst:1414 msgid "" "*start* and *end* are now adjusted to behave like ``unicode[start:end]``." msgstr "" -#: ../../c-api/unicode.rst:1406 +#: ../../c-api/unicode.rst:1421 msgid "" "Return the number of non-overlapping occurrences of *substr* in " "``unicode[start:end]``. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1413 +#: ../../c-api/unicode.rst:1428 msgid "" "Replace at most *maxcount* occurrences of *substr* in *unicode* with " "*replstr* and return the resulting Unicode object. *maxcount* == ``-1`` " "means replace all occurrences." msgstr "" -#: ../../c-api/unicode.rst:1420 +#: ../../c-api/unicode.rst:1435 msgid "" "Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, " "and greater than, respectively." msgstr "" -#: ../../c-api/unicode.rst:1423 +#: ../../c-api/unicode.rst:1438 msgid "" "This function returns ``-1`` upon failure, so one should call :c:func:" "`PyErr_Occurred` to check for errors." msgstr "" -#: ../../c-api/unicode.rst:1429 +#: ../../c-api/unicode.rst:1444 msgid "" "Compare a Unicode object with a char buffer which is interpreted as being " "UTF-8 or ASCII encoded and return true (``1``) if they are equal, or false " -"(``0``) otherwise. If the Unicode object contains surrogate characters or " -"the C string is not valid UTF-8, false (``0``) is returned." +"(``0``) otherwise. If the Unicode object contains surrogate code points " +"(``U+D800`` - ``U+DFFF``) or the C string is not valid UTF-8, false (``0``) " +"is returned." msgstr "" -#: ../../c-api/unicode.rst:1435 ../../c-api/unicode.rst:1456 +#: ../../c-api/unicode.rst:1451 ../../c-api/unicode.rst:1472 msgid "This function does not raise exceptions." msgstr "" -#: ../../c-api/unicode.rst:1442 +#: ../../c-api/unicode.rst:1458 msgid "" "Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string* " "length using :c:func:`!strlen`. If the Unicode object contains null " "characters, false (``0``) is returned." msgstr "" -#: ../../c-api/unicode.rst:1451 +#: ../../c-api/unicode.rst:1467 msgid "" "Compare a Unicode object, *unicode*, with *string* and return ``-1``, ``0``, " "``1`` for less than, equal, and greater than, respectively. It is best to " @@ -1736,47 +1760,47 @@ msgid "" "string as ISO-8859-1 if it contains non-ASCII characters." msgstr "" -#: ../../c-api/unicode.rst:1461 +#: ../../c-api/unicode.rst:1477 msgid "Rich compare two Unicode strings and return one of the following:" msgstr "" -#: ../../c-api/unicode.rst:1463 +#: ../../c-api/unicode.rst:1479 msgid "``NULL`` in case an exception was raised" msgstr "" -#: ../../c-api/unicode.rst:1464 +#: ../../c-api/unicode.rst:1480 msgid ":c:data:`Py_True` or :c:data:`Py_False` for successful comparisons" msgstr "" -#: ../../c-api/unicode.rst:1465 +#: ../../c-api/unicode.rst:1481 msgid ":c:data:`Py_NotImplemented` in case the type combination is unknown" msgstr "" -#: ../../c-api/unicode.rst:1467 +#: ../../c-api/unicode.rst:1483 msgid "" "Possible values for *op* are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:" "`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, and :c:macro:`Py_LE`." msgstr "" -#: ../../c-api/unicode.rst:1473 +#: ../../c-api/unicode.rst:1489 msgid "" "Return a new string object from *format* and *args*; this is analogous to " "``format % args``." msgstr "" -#: ../../c-api/unicode.rst:1479 +#: ../../c-api/unicode.rst:1495 msgid "" "Check whether *substr* is contained in *unicode* and return true or false " "accordingly." msgstr "" -#: ../../c-api/unicode.rst:1482 +#: ../../c-api/unicode.rst:1498 msgid "" "*substr* has to coerce to a one element Unicode string. ``-1`` is returned " "if there was an error." msgstr "" -#: ../../c-api/unicode.rst:1488 +#: ../../c-api/unicode.rst:1504 msgid "" "Intern the argument :c:expr:`*p_unicode` in place. The argument must be the " "address of a pointer variable pointing to a Python Unicode string object. " @@ -1787,7 +1811,7 @@ msgid "" "interns it." msgstr "" -#: ../../c-api/unicode.rst:1495 +#: ../../c-api/unicode.rst:1511 msgid "" "(Clarification: even though there is a lot of talk about references, think " "of this function as reference-neutral. You must own the object you pass in; " @@ -1795,39 +1819,39 @@ msgid "" "the result.)" msgstr "" -#: ../../c-api/unicode.rst:1500 +#: ../../c-api/unicode.rst:1516 msgid "" "This function never raises an exception. On error, it leaves its argument " "unchanged without interning it." msgstr "" -#: ../../c-api/unicode.rst:1503 +#: ../../c-api/unicode.rst:1519 msgid "" "Instances of subclasses of :py:class:`str` may not be interned, that is, :c:" "expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, then -- " "as with any other error -- the argument is left unchanged." msgstr "" -#: ../../c-api/unicode.rst:1507 +#: ../../c-api/unicode.rst:1523 msgid "" "Note that interned strings are not “immortal”. You must keep a reference to " "the result to benefit from interning." msgstr "" -#: ../../c-api/unicode.rst:1513 +#: ../../c-api/unicode.rst:1529 msgid "" "A combination of :c:func:`PyUnicode_FromString` and :c:func:" "`PyUnicode_InternInPlace`, meant for statically allocated strings." msgstr "" -#: ../../c-api/unicode.rst:1516 +#: ../../c-api/unicode.rst:1532 msgid "" "Return a new (\"owned\") reference to either a new Unicode string object " "that has been interned, or an earlier interned string object with the same " "value." msgstr "" -#: ../../c-api/unicode.rst:1520 +#: ../../c-api/unicode.rst:1536 msgid "" "Python may keep a reference to the result, or make it :term:`immortal`, " "preventing it from being garbage-collected promptly. For interning an " @@ -1836,6 +1860,6 @@ msgid "" "`PyUnicode_InternInPlace` directly." msgstr "" -#: ../../c-api/unicode.rst:1528 +#: ../../c-api/unicode.rst:1544 msgid "Strings interned this way are made :term:`immortal`." msgstr "" diff --git a/deprecations/index.po b/deprecations/index.po index b4a60d6ccd..7634be6157 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -130,46 +130,38 @@ msgstr "" "Alan Williams 於 :gh:`72346` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:50 -msgid "" -":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " -"taken into consideration by the import system (:gh:`97879`)." -msgstr "" -":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " -"系統考慮。 (:gh:`97879`)" - -#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:55 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:62 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:64 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -180,7 +172,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:72 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -197,7 +189,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:80 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -205,7 +197,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -215,27 +207,27 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:92 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:94 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -245,7 +237,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" "date and datetime adapter, date and timestamp converter: see the :mod:" "`sqlite3` documentation for suggested replacement recipes." @@ -253,7 +245,7 @@ msgstr "" "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" "參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" -#: ../../deprecations/pending-removal-in-3.14.rst:105 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -265,7 +257,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:112 +#: ../../deprecations/pending-removal-in-3.14.rst:109 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -273,7 +265,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:115 +#: ../../deprecations/pending-removal-in-3.14.rst:112 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -321,10 +313,18 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:20 +msgid "" +":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " +"taken into consideration by the import system (:gh:`97879`)." +msgstr "" +":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " +"系統考慮。 (:gh:`97879`)" + +#: ../../deprecations/pending-removal-in-3.15.rst:23 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:22 +#: ../../deprecations/pending-removal-in-3.15.rst:25 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" @@ -337,11 +337,11 @@ msgstr "" "`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." "getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:30 +#: ../../deprecations/pending-removal-in-3.15.rst:33 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-3.15.rst:35 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows." @@ -349,11 +349,11 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." "isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:36 +#: ../../deprecations/pending-removal-in-3.15.rst:39 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:38 +#: ../../deprecations/pending-removal-in-3.15.rst:41 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -362,11 +362,11 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:45 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:47 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -377,11 +377,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:53 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.15.rst:52 +#: ../../deprecations/pending-removal-in-3.15.rst:55 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -392,7 +392,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:58 +#: ../../deprecations/pending-removal-in-3.15.rst:61 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -402,11 +402,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:63 +#: ../../deprecations/pending-removal-in-3.15.rst:66 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:65 +#: ../../deprecations/pending-removal-in-3.15.rst:68 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" diff --git a/deprecations/pending-removal-in-3.14.po b/deprecations/pending-removal-in-3.14.po index 2b0e1acbc9..615e97ede1 100644 --- a/deprecations/pending-removal-in-3.14.po +++ b/deprecations/pending-removal-in-3.14.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-17 00:03+0000\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -126,46 +126,38 @@ msgstr "" "Alan Williams 於 :gh:`72346` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:50 -msgid "" -":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " -"taken into consideration by the import system (:gh:`97879`)." -msgstr "" -":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " -"系統考慮。 (:gh:`97879`)" - -#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:55 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:62 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:64 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -176,7 +168,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:72 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -193,7 +185,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:80 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -201,7 +193,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -211,27 +203,27 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:92 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:94 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -241,7 +233,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" "date and datetime adapter, date and timestamp converter: see the :mod:" "`sqlite3` documentation for suggested replacement recipes." @@ -249,7 +241,7 @@ msgstr "" "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" "參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" -#: ../../deprecations/pending-removal-in-3.14.rst:105 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -261,7 +253,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:112 +#: ../../deprecations/pending-removal-in-3.14.rst:109 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -269,7 +261,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:115 +#: ../../deprecations/pending-removal-in-3.14.rst:112 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index b8663476ab..d160dbfc7a 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -54,10 +54,18 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:20 +msgid "" +":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " +"taken into consideration by the import system (:gh:`97879`)." +msgstr "" +":mod:`importlib`:引入系統將不再設定或考慮 ``__package__`` 和 ``__cached__`` " +"(:gh:`97879`)。" + +#: ../../deprecations/pending-removal-in-3.15.rst:23 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:22 +#: ../../deprecations/pending-removal-in-3.15.rst:25 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" @@ -70,11 +78,11 @@ msgstr "" "`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." "getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:30 +#: ../../deprecations/pending-removal-in-3.15.rst:33 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-3.15.rst:35 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows." @@ -82,11 +90,11 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." "isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:36 +#: ../../deprecations/pending-removal-in-3.15.rst:39 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:38 +#: ../../deprecations/pending-removal-in-3.15.rst:41 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -95,11 +103,11 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:45 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:47 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -110,11 +118,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:53 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.15.rst:52 +#: ../../deprecations/pending-removal-in-3.15.rst:55 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -125,7 +133,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:58 +#: ../../deprecations/pending-removal-in-3.15.rst:61 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -135,11 +143,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:63 +#: ../../deprecations/pending-removal-in-3.15.rst:66 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:65 +#: ../../deprecations/pending-removal-in-3.15.rst:68 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" diff --git a/extending/newtypes.po b/extending/newtypes.po index d31c7ef8a7..7029e57821 100644 --- a/extending/newtypes.po +++ b/extending/newtypes.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:34+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -561,7 +561,7 @@ msgid "" "defined this way can have an associated doc string simply by providing the " "text in the table. An application can use the introspection API to retrieve " "the descriptor from the class object, and get the doc string using its :attr:" -"`!__doc__` attribute." +"`~type.__doc__` attribute." msgstr "" #: ../../extending/newtypes.rst:301 diff --git a/extending/newtypes_tutorial.po b/extending/newtypes_tutorial.po index 8b1a2a41b9..d344eb253f 100644 --- a/extending/newtypes_tutorial.po +++ b/extending/newtypes_tutorial.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -289,8 +289,8 @@ msgid "" "If you want your type to be subclassable from Python, and your type has the " "same :c:member:`~PyTypeObject.tp_basicsize` as its base type, you may have " "problems with multiple inheritance. A Python subclass of your type will " -"have to list your type first in its :attr:`~class.__bases__`, or else it " -"will not be able to call your type's :meth:`~object.__new__` method without " +"have to list your type first in its :attr:`~type.__bases__`, or else it will " +"not be able to call your type's :meth:`~object.__new__` method without " "getting an error. You can avoid this problem by ensuring that your type has " "a larger value for :c:member:`~PyTypeObject.tp_basicsize` than its base type " "does. Most of the time, this will be true anyway, because either your base " diff --git a/faq/design.po b/faq/design.po index 543508819a..8474f7dc97 100644 --- a/faq/design.po +++ b/faq/design.po @@ -363,7 +363,7 @@ msgstr "" "(二) 當我看到一段程式碼寫著 len(x),我\\ *知道*\\ 他要找某個東西的長度。這" "告訴了我兩件事:結果是一個整數、參數是某種容器。相對地,當我看到 x.len(),我" "必須先知道 x 是某種容器,並實作了一個介面或是繼承了一個有標準 len() 的類別。" -"遇到一個沒有實作映射 (mapping) 的類別卻有 get() 或 keys() 方法,或是不是檔案" +"遇到一個沒有實作對映 (mapping) 的類別卻有 get() 或 keys() 方法,或是不是檔案" "但卻有 write() 方法時,我們偶爾會覺得困惑。" #: ../../faq/design.rst:189 @@ -526,7 +526,7 @@ msgid "" "For cases where you need to choose from a very large number of " "possibilities, you can create a dictionary mapping case values to functions " "to call. For example::" -msgstr "如果可能性很多,你可以用字典去映射要呼叫的函式。舉例來說: ::" +msgstr "如果可能性很多,你可以用字典去對映要呼叫的函式。舉例來說: ::" #: ../../faq/design.rst:272 msgid "" diff --git a/faq/extending.po b/faq/extending.po index ab0b8990b6..720d5e9fe3 100644 --- a/faq/extending.po +++ b/faq/extending.po @@ -186,7 +186,7 @@ msgstr "" "還有一個針對 Python 物件的高級 API,它由所謂的「抽象」介面提供——閱讀 " "``Include/abstract.h`` 了解更多詳細資訊。它允許使用 :c:func:" "`PySequence_Length`、:c:func:`PySequence_GetItem` 等呼叫以及許多其他有用的協" -"議(例如數字 (:c:func:`PyNumber_Index) ` 等)和 PyMapping API 中的映射。" +"議(例如數字 (:c:func:`PyNumber_Index) ` 等)和 PyMapping API 中的對映。" #: ../../faq/extending.rst:104 msgid "How do I use Py_BuildValue() to create a tuple of arbitrary length?" diff --git a/faq/library.po b/faq/library.po index fef7290929..3a9a9e0094 100644 --- a/faq/library.po +++ b/faq/library.po @@ -1239,7 +1239,7 @@ msgid "" "`DatabaseProgramming wiki page `_ for details." msgstr "" -"支援大多數關係資料庫。有關詳細資訊,請參閱`DatabaseProgramming 維基頁面 " +"支援大多數關係資料庫。有關詳細資訊,請參閱 `DatabaseProgramming 維基頁面 " "`_。" #: ../../faq/library.rst:779 @@ -1255,9 +1255,9 @@ msgid "" "mod:`shelve` library module uses pickle and (g)dbm to create persistent " "mappings containing arbitrary Python objects." msgstr "" -":mod:`pickle` 庫模組以一種非常通用的方式解決了這個問題(儘管你仍然不能存儲諸" -"如打開的檔案、socket 或窗口之類的東西),而 :mod:`shelve` 庫模組使用 pickle " -"和 (g) dbm 建立包含任意 Python 物件的持久映射。" +":mod:`pickle` 函式庫模組以一種非常通用的方式解決了這個問題(儘管你仍然不能存" +"儲諸如打開的檔案、socket 或窗口之類的東西),而 :mod:`shelve` 函式庫模組使用 " +"pickle 和 (g) dbm 建立包含任意 Python 物件的持久對映。" #: ../../faq/library.rst:788 msgid "Mathematics and Numerics" diff --git a/faq/programming.po b/faq/programming.po index 4a9bd315fb..3a4d4abfe8 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-04-25 14:17+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -351,14 +351,14 @@ msgstr "" msgid "" "Why do lambdas defined in a loop with different values all return the same " "result?" -msgstr "為什麼在具有不同值的循環中定義的 lambda 都回傳相同的結果?" +msgstr "為什麼在具有不同值的迴圈中定義的 lambda 都回傳相同的結果?" #: ../../faq/programming.rst:210 msgid "" "Assume you use a for loop to define a few different lambdas (or even plain " "functions), e.g.::" msgstr "" -"假設你使用 for 循環來定義幾個不同的 lambda(甚至是普通函式),例如: ::" +"假設你使用 for 迴圈來定義幾個不同的 lambda(甚至是普通函式),例如: ::" #: ../../faq/programming.rst:213 msgid "" @@ -404,7 +404,7 @@ msgid "" "changing the value of ``x`` and see how the results of the lambdas change::" msgstr "" "發生這種情況是因為 ``x`` 不是 lambda 的局部變數,而是在外部作用域中定義的,並" -"且在呼叫 lambda 時存取它——而不是在定義時存取它。在循環結束時,``x`` 的值為 " +"且在呼叫 lambda 時存取它——而不是在定義時存取它。在迴圈結束時,``x`` 的值為 " "``4``,因此所有函式現在都回傳 ``4**2``,即 ``16``。你還可以透過更改 ``x`` 的" "值來驗證這一點,並查看 lambda 運算式的結果如何變化: ::" @@ -447,7 +447,7 @@ msgid "" "Therefore each lambda will now return the correct result::" msgstr "" "在這裡,``n=x`` 建立了一個新變數 ``n`` 局部於 lambda 並在定義 lambda 時計算," -"因此它具有與 ``x`` 在循環中的那個點相同的值。這意味著 ``n`` 的值在第一個 " +"因此它具有與 ``x`` 在迴圈中的那個點相同的值。這意味著 ``n`` 的值在第一個 " "lambda 中為 ``0`` ,在第二個中為 ``1`` ,在第三個中為 ``2`` ,依此類推。因此" "每個 lambda 現在將回傳正確的結果: ::" @@ -1517,9 +1517,8 @@ msgid "Don't try this at home, kids!" msgstr "孩子們,不要在家裡嘗試這個!" #: ../../faq/programming.rst:777 -#, fuzzy msgid "What does the slash(/) in the parameter list of a function mean?" -msgstr "函式參數 list 中的斜槓(/)是什麼意思?" +msgstr "函式參數串列中的斜槓 (/) 是什麼意思?" #: ../../faq/programming.rst:779 #, fuzzy @@ -1532,7 +1531,7 @@ msgid "" "only parameters. Its documentation looks like this::" msgstr "" "函式引數list中的斜杠表示它前面的參數是位置參數。僅位置參數是沒有外部可用名稱" -"的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置映射到參數。例如,:" +"的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置對映到參數。例如,:" "func:`divmod` 是一個只接受位置參數的函式。它的文件看起來像這樣: ::" #: ../../faq/programming.rst:786 @@ -1858,7 +1857,7 @@ msgid "" "names of the functions. This is also the primary technique used to emulate " "a case construct::" msgstr "" -"最好的方法是使用將字串映射到函式的字典。這種技術的主要優點是字串不需要與函式" +"最好的方法是使用將字串對映到函式的字典。這種技術的主要優點是字串不需要與函式" "名稱相匹配。這也是用於模擬案例構造的主要技術: ::" #: ../../faq/programming.rst:947 @@ -2663,7 +2662,7 @@ msgstr "" msgid "" "To just run the method or function without saving the return values, a " "plain :keyword:`for` loop will suffice::" -msgstr "要只運行方法或函式而不保存回傳值,一個普通的 for 循環就足夠了: ::" +msgstr "要只運行方法或函式而不保存回傳值,一個普通的 for 迴圈就足夠了: ::" #: ../../faq/programming.rst:1337 msgid "" @@ -2872,7 +2871,7 @@ msgid "" "value\". In Python, use the ``key`` argument for the :meth:`list.sort` " "method::" msgstr "" -"該技術歸功於 Perl 社區的 Randal Schwartz,它透過將每個元素映射到其「排序值」" +"該技術歸功於 Perl 社區的 Randal Schwartz,它透過將每個元素對映到其「排序值」" "的度量對list的元素進行排序。在 Python 中,對 :meth:`list.sort` 方法使用 " "``key`` 引數: ::" @@ -3224,25 +3223,44 @@ msgstr "" #: ../../faq/programming.rst:1616 #, fuzzy msgid "" -"Most :meth:`!__setattr__` implementations must modify :meth:`self.__dict__ " -"` to store local state for self without causing an infinite " -"recursion." +"Many :meth:`~object.__setattr__` implementations call :meth:`!object." +"__setattr__` to set an attribute on self without causing infinite recursion::" msgstr "" "大多數 :meth:`!__setattr__` 實作必須修改 :meth:`self.__dict__ ` 以存儲 self 的本地狀態,而不會導致無限遞迴。" -#: ../../faq/programming.rst:1622 +#: ../../faq/programming.rst:1619 +#, fuzzy +msgid "" +"class X:\n" +" def __setattr__(self, name, value):\n" +" # Custom logic here...\n" +" object.__setattr__(self, name, value)" +msgstr "" +"class X:\n" +" ...\n" +" def __setattr__(self, name, value):\n" +" self.__dict__[name] = value\n" +" ..." + +#: ../../faq/programming.rst:1624 +msgid "" +"Alternatively, it is possible to set attributes by inserting entries into :" +"attr:`self.__dict__ ` directly." +msgstr "" + +#: ../../faq/programming.rst:1629 #, fuzzy msgid "" "How do I call a method defined in a base class from a derived class that " "extends it?" msgstr "如何從擴充它的衍生類別呼叫基底類別中定義的方法?" -#: ../../faq/programming.rst:1624 +#: ../../faq/programming.rst:1631 msgid "Use the built-in :func:`super` function::" msgstr "使用內建的 :func:`super` 函式: ::" -#: ../../faq/programming.rst:1626 +#: ../../faq/programming.rst:1633 msgid "" "class Derived(Base):\n" " def meth(self):\n" @@ -3252,7 +3270,7 @@ msgstr "" " def meth(self):\n" " super().meth() # calls Base.meth" -#: ../../faq/programming.rst:1630 +#: ../../faq/programming.rst:1637 #, fuzzy msgid "" "In the example, :func:`super` will automatically determine the instance from " @@ -3263,12 +3281,12 @@ msgstr "" "在示例中,:func:`super` 將自動確定呼叫它的實例(``self`` 值),使用 " "``type(self ).__mro__``,並回傳 MRO 中``Derived`` 之後的下一行:``Base``。" -#: ../../faq/programming.rst:1637 +#: ../../faq/programming.rst:1644 #, fuzzy msgid "How can I organize my code to make it easier to change the base class?" msgstr "我如何組織我的程式碼以便更容易地更改基底類別?" -#: ../../faq/programming.rst:1639 +#: ../../faq/programming.rst:1646 #, fuzzy msgid "" "You could assign the base class to an alias and derive from the alias. Then " @@ -3280,7 +3298,7 @@ msgstr "" "說一句,如果你想動態決定(例如,取決於資源的可用性)使用哪個基底類別,這個技" "巧也很方便。例子: ::" -#: ../../faq/programming.rst:1644 +#: ../../faq/programming.rst:1651 msgid "" "class Base:\n" " ...\n" @@ -3298,19 +3316,19 @@ msgstr "" "class Derived(BaseAlias):\n" " ..." -#: ../../faq/programming.rst:1654 +#: ../../faq/programming.rst:1661 #, fuzzy msgid "How do I create static class data and static class methods?" msgstr "如何建立靜態類別資料和靜態類別方法?" -#: ../../faq/programming.rst:1656 +#: ../../faq/programming.rst:1663 #, fuzzy msgid "" "Both static data and static methods (in the sense of C++ or Java) are " "supported in Python." msgstr "Python 支援靜態資料和靜態方法(在 C++ 或 Java 的意義上)。" -#: ../../faq/programming.rst:1659 +#: ../../faq/programming.rst:1666 #, fuzzy msgid "" "For static data, simply define a class attribute. To assign a new value to " @@ -3319,7 +3337,7 @@ msgstr "" "對於靜態資料,只需定義一個類別屬性即可。要為屬性分配新值,你必須在分配中顯式" "使用類別名: ::" -#: ../../faq/programming.rst:1662 +#: ../../faq/programming.rst:1669 msgid "" "class C:\n" " count = 0 # number of times C.__init__ called\n" @@ -3331,7 +3349,7 @@ msgid "" " return C.count # or return self.count" msgstr "" -#: ../../faq/programming.rst:1671 +#: ../../faq/programming.rst:1678 #, fuzzy msgid "" "``c.count`` also refers to ``C.count`` for any ``c`` such that " @@ -3342,7 +3360,7 @@ msgstr "" "除非被 ``c`` 本身或某些人覆蓋從 ``c.__class__`` 回到 ``C`` 的基底類別搜索路徑" "上的類別。" -#: ../../faq/programming.rst:1675 +#: ../../faq/programming.rst:1682 #, fuzzy msgid "" "Caution: within a method of C, an assignment like ``self.count = 42`` " @@ -3354,15 +3372,15 @@ msgstr "" "一個名為 \"count\" 的新的不相關實例。類別靜態資料名稱的重新綁定必須始終指定類" "別是否在方法內: ::" -#: ../../faq/programming.rst:1680 +#: ../../faq/programming.rst:1687 msgid "C.count = 314" msgstr "C.count = 314" -#: ../../faq/programming.rst:1682 +#: ../../faq/programming.rst:1689 msgid "Static methods are possible::" msgstr "靜態方法是可能的: ::" -#: ../../faq/programming.rst:1684 +#: ../../faq/programming.rst:1691 msgid "" "class C:\n" " @staticmethod\n" @@ -3376,7 +3394,7 @@ msgstr "" " # 沒有 'self' 參數!\n" " ..." -#: ../../faq/programming.rst:1690 +#: ../../faq/programming.rst:1697 #, fuzzy msgid "" "However, a far more straightforward way to get the effect of a static method " @@ -3384,7 +3402,7 @@ msgid "" msgstr "" "然而,獲得靜態方法效果的一種更直接的方法是透過一個簡單的模組級函式: ::" -#: ../../faq/programming.rst:1693 +#: ../../faq/programming.rst:1700 msgid "" "def getcount():\n" " return C.count" @@ -3392,7 +3410,7 @@ msgstr "" "def getcount():\n" " return C.count" -#: ../../faq/programming.rst:1696 +#: ../../faq/programming.rst:1703 #, fuzzy msgid "" "If your code is structured so as to define one class (or tightly related " @@ -3401,12 +3419,12 @@ msgstr "" "如果你的程式碼結構化以便為每個模組定義一個類別(或緊密相關的類別層次結構)," "則這提供了所需的封裝。" -#: ../../faq/programming.rst:1701 +#: ../../faq/programming.rst:1708 #, fuzzy msgid "How can I overload constructors (or methods) in Python?" msgstr "如何在 Python 中重載構造函式(或方法)?" -#: ../../faq/programming.rst:1703 +#: ../../faq/programming.rst:1710 #, fuzzy msgid "" "This answer actually applies to all methods, but the question usually comes " @@ -3414,11 +3432,11 @@ msgid "" msgstr "" "這個答案實際上適用於所有方法,但這個問題通常首先出現在構造函式的上下文中。" -#: ../../faq/programming.rst:1706 +#: ../../faq/programming.rst:1713 msgid "In C++ you'd write" msgstr "在 C++ 中你會寫成" -#: ../../faq/programming.rst:1708 +#: ../../faq/programming.rst:1715 msgid "" "class C {\n" " C() { cout << \"No arguments\\n\"; }\n" @@ -3430,7 +3448,7 @@ msgstr "" " C(int i) { cout << \"Argument is \" << i << \"\\n\"; }\n" "}" -#: ../../faq/programming.rst:1715 +#: ../../faq/programming.rst:1722 #, fuzzy msgid "" "In Python you have to write a single constructor that catches all cases " @@ -3438,7 +3456,7 @@ msgid "" msgstr "" "在 Python 中,你必須編寫一個構造函式來捕獲所有使用預設引數的情況。例如: ::" -#: ../../faq/programming.rst:1718 +#: ../../faq/programming.rst:1725 msgid "" "class C:\n" " def __init__(self, i=None):\n" @@ -3454,17 +3472,17 @@ msgstr "" " else:\n" " print(\"Argument is\", i)" -#: ../../faq/programming.rst:1725 +#: ../../faq/programming.rst:1732 #, fuzzy msgid "This is not entirely equivalent, but close enough in practice." msgstr "這並不完全等價,但在實踐中足夠接近。" -#: ../../faq/programming.rst:1727 +#: ../../faq/programming.rst:1734 #, fuzzy msgid "You could also try a variable-length argument list, e.g. ::" msgstr "你也可以嘗試可變長度引數 list,例如: ::" -#: ../../faq/programming.rst:1729 +#: ../../faq/programming.rst:1736 msgid "" "def __init__(self, *args):\n" " ..." @@ -3472,17 +3490,17 @@ msgstr "" "def __init__(self, *args):\n" " ..." -#: ../../faq/programming.rst:1732 +#: ../../faq/programming.rst:1739 #, fuzzy msgid "The same approach works for all method definitions." msgstr "相同的方法適用於所有方法定義。" -#: ../../faq/programming.rst:1736 +#: ../../faq/programming.rst:1743 #, fuzzy msgid "I try to use __spam and I get an error about _SomeClassName__spam." msgstr "我嘗試使用 __spam,但收到有關 _SomeClassName__spam 的錯誤。" -#: ../../faq/programming.rst:1738 +#: ../../faq/programming.rst:1745 #, fuzzy msgid "" "Variable names with double leading underscores are \"mangled\" to provide a " @@ -3497,13 +3515,13 @@ msgstr "" "上替換為 ``_classname__spam``,其中 ``classname`` 是當前類別名,所有前導底線" "被去除。" -#: ../../faq/programming.rst:1744 +#: ../../faq/programming.rst:1751 msgid "" "The identifier can be used unchanged within the class, but to access it " "outside the class, the mangled name must be used:" msgstr "" -#: ../../faq/programming.rst:1747 +#: ../../faq/programming.rst:1754 msgid "" "class A:\n" " def __one(self):\n" @@ -3529,7 +3547,7 @@ msgstr "" "\n" "four = 4 * A()._A__one()" -#: ../../faq/programming.rst:1761 +#: ../../faq/programming.rst:1768 #, fuzzy msgid "" "In particular, this does not guarantee privacy since an outside user can " @@ -3539,23 +3557,23 @@ msgstr "" "這並不能保證隱私:外部使用者仍然可以故意存取 \"_classname__spam\" 屬性,並且" "私有值在物件的 __dict__ 中可見。許多 Python 程式員根本懶得使用私有變數名。" -#: ../../faq/programming.rst:1767 +#: ../../faq/programming.rst:1774 msgid "" "The :ref:`private name mangling specifications ` for " "details and special cases." msgstr "" -#: ../../faq/programming.rst:1771 +#: ../../faq/programming.rst:1778 #, fuzzy msgid "My class defines __del__ but it is not called when I delete the object." msgstr "我的類別定義了 __del__ 但是當我刪除物件時它沒有被呼叫。" -#: ../../faq/programming.rst:1773 +#: ../../faq/programming.rst:1780 #, fuzzy msgid "There are several possible reasons for this." msgstr "這有幾個可能的原因。" -#: ../../faq/programming.rst:1775 +#: ../../faq/programming.rst:1782 #, fuzzy msgid "" "The :keyword:`del` statement does not necessarily call :meth:`~object." @@ -3565,7 +3583,7 @@ msgstr "" ":keyword:`del` 陳述式不一定呼叫 :meth:`~object.__del__` -- 它只是減少物件的引" "用計數,如果達到零,則呼叫 :meth:`!__del__`。" -#: ../../faq/programming.rst:1779 +#: ../../faq/programming.rst:1786 #, fuzzy msgid "" "If your data structures contain circular links (e.g. a tree where each child " @@ -3587,7 +3605,7 @@ msgstr "" "行順序是任意的。你可以運行 :func:`gc.collect` 來強制收集,但*存在*永遠不會收" "集物件的病態情況。" -#: ../../faq/programming.rst:1790 +#: ../../faq/programming.rst:1797 #, fuzzy msgid "" "Despite the cycle collector, it's still a good idea to define an explicit " @@ -3602,7 +3620,7 @@ msgstr "" "性。不要直接呼叫 :meth:`!__del__` -- :meth:`!__del__` 應該呼叫 ``close()`` 並" "且 ``close()`` 應該確保它可以多次呼叫同一個物件。" -#: ../../faq/programming.rst:1797 +#: ../../faq/programming.rst:1804 #, fuzzy msgid "" "Another way to avoid cyclical references is to use the :mod:`weakref` " @@ -3614,21 +3632,20 @@ msgstr "" "的情況下指向物件。例如,樹資料結構應該對其父參照和同級參照使用弱參照(如果需" "要的話!)。" -#: ../../faq/programming.rst:1810 -#, fuzzy +#: ../../faq/programming.rst:1817 msgid "" "Finally, if your :meth:`!__del__` method raises an exception, a warning " "message is printed to :data:`sys.stderr`." msgstr "" -"最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告消息印出到 :data:" +"最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告訊息印出到 :data:" "`sys.stderr`。" -#: ../../faq/programming.rst:1815 +#: ../../faq/programming.rst:1822 #, fuzzy msgid "How do I get a list of all instances of a given class?" msgstr "如何獲取給定類別的所有實例的 list?" -#: ../../faq/programming.rst:1817 +#: ../../faq/programming.rst:1824 #, fuzzy msgid "" "Python does not keep track of all instances of a class (or of a built-in " @@ -3638,12 +3655,11 @@ msgstr "" "Python 不會跟踪類別(或內建型別)的所有實例。你可以對類別的構造函式進行編程," "以透過保留對每個實例的弱參照list來跟踪所有實例。" -#: ../../faq/programming.rst:1823 -#, fuzzy +#: ../../faq/programming.rst:1830 msgid "Why does the result of ``id()`` appear to be not unique?" msgstr "為什麼 ``id()`` 的結果看起來不唯一?" -#: ../../faq/programming.rst:1825 +#: ../../faq/programming.rst:1832 #, fuzzy msgid "" "The :func:`id` builtin returns an integer that is guaranteed to be unique " @@ -3656,7 +3672,7 @@ msgstr "" "CPython 中,這是物件的記憶體地址,所以經常發生在從記憶體中刪除一個物件後,下" "一個新建立的物件被分配在記憶體中的相同位置。這個例子說明了這一點:" -#: ../../faq/programming.rst:1836 +#: ../../faq/programming.rst:1843 #, fuzzy msgid "" "The two ids belong to different integer objects that are created before, and " @@ -3667,18 +3683,18 @@ msgstr "" "這兩個 id 屬於之前建立的不同整數物件,並在執行 ``id()`` 呼叫後立即刪除。要確" "保你要檢查其 id 的物件仍然存在,請建立對該物件的另一個參照:" -#: ../../faq/programming.rst:1849 +#: ../../faq/programming.rst:1856 msgid "When can I rely on identity tests with the *is* operator?" msgstr "我什麼時候可以依靠 *is* 運算子進行識別性測試?" -#: ../../faq/programming.rst:1851 +#: ../../faq/programming.rst:1858 msgid "" "The ``is`` operator tests for object identity. The test ``a is b`` is " "equivalent to ``id(a) == id(b)``." msgstr "" "``is`` 運算子測試物件識別性。測試 ``a is b`` 等同於 ``id(a) == id(b)`` 。" -#: ../../faq/programming.rst:1854 +#: ../../faq/programming.rst:1861 msgid "" "The most important property of an identity test is that an object is always " "identical to itself, ``a is a`` always returns ``True``. Identity tests are " @@ -3689,7 +3705,7 @@ msgstr "" "識別性測試通常比相等性測試更快。與相等性測試不同,識別性測試保證回傳布林值 " "``True`` 或 ``False`` 。" -#: ../../faq/programming.rst:1859 +#: ../../faq/programming.rst:1866 msgid "" "However, identity tests can *only* be substituted for equality tests when " "object identity is assured. Generally, there are three circumstances where " @@ -3698,7 +3714,7 @@ msgstr "" "然而,*只有*\\ 當物件識別性得到保證時,識別性測試才能代替相等性測試。一般來" "說,保證識別性的情況有以下三種:" -#: ../../faq/programming.rst:1863 +#: ../../faq/programming.rst:1870 msgid "" "1) Assignments create new names but do not change object identity. After " "the assignment ``new = old``, it is guaranteed that ``new is old``." @@ -3706,7 +3722,7 @@ msgstr "" "1) 賦值建立新名稱但不改變物件識別性。賦值 ``new = old`` 後,保證 ``new is " "old``。" -#: ../../faq/programming.rst:1866 +#: ../../faq/programming.rst:1873 msgid "" "2) Putting an object in a container that stores object references does not " "change object identity. After the list assignment ``s[0] = x``, it is " @@ -3715,7 +3731,7 @@ msgstr "" "2) 將物件放入存儲物件參照的容器中不會改變物件識別性。在 list 賦值 ``s[0] = " "x`` 之後,保證 ``s[0] 是 x``。" -#: ../../faq/programming.rst:1870 +#: ../../faq/programming.rst:1877 #, fuzzy msgid "" "3) If an object is a singleton, it means that only one instance of that " @@ -3725,7 +3741,7 @@ msgstr "" "3)如果一個物件是單例,則意味著該物件只能存在一個實例。在賦值 ``a = None`` " "和 ``b = None`` 之後,可以保證 ``a is b`` 因為 ``None`` 是單例。" -#: ../../faq/programming.rst:1874 +#: ../../faq/programming.rst:1881 msgid "" "In most other circumstances, identity tests are inadvisable and equality " "tests are preferred. In particular, identity tests should not be used to " @@ -3735,7 +3751,7 @@ msgstr "" "在大多數其他情況下,識別性測試是不可取的,相等性測試是首選。特別是,識別性測" "試不應用於檢查常數,例如不能保證是單例的 :class:`int` 和 :class:`str`: ::" -#: ../../faq/programming.rst:1879 +#: ../../faq/programming.rst:1886 msgid "" ">>> a = 1000\n" ">>> b = 500\n" @@ -3761,12 +3777,11 @@ msgstr "" ">>> a is c\n" "False" -#: ../../faq/programming.rst:1891 -#, fuzzy +#: ../../faq/programming.rst:1898 msgid "Likewise, new instances of mutable containers are never identical::" -msgstr "同樣,可變容器的新實例永遠不會相同: ::" +msgstr "同樣地,可變容器的新實例永遠不會相同: ::" -#: ../../faq/programming.rst:1893 +#: ../../faq/programming.rst:1900 msgid "" ">>> a = []\n" ">>> b = []\n" @@ -3778,13 +3793,13 @@ msgstr "" ">>> a is b\n" "False" -#: ../../faq/programming.rst:1898 +#: ../../faq/programming.rst:1905 msgid "" "In the standard library code, you will see several common patterns for " "correctly using identity tests:" msgstr "在標準函式庫程式碼中,你將看到幾種正確使用識別性測試的常見模式:" -#: ../../faq/programming.rst:1901 +#: ../../faq/programming.rst:1908 msgid "" "1) As recommended by :pep:`8`, an identity test is the preferred way to " "check for ``None``. This reads like plain English in code and avoids " @@ -3794,7 +3809,7 @@ msgstr "" "1) 正如 :pep:`8` 所推薦的,識別性測試是檢查 ``None`` 的首選方法。這在程式碼中" "讀起來像簡單的英語,並避免與其他可能具有評估為 false 的布林值的物件混淆。" -#: ../../faq/programming.rst:1905 +#: ../../faq/programming.rst:1912 #, fuzzy msgid "" "2) Detecting optional arguments can be tricky when ``None`` is a valid input " @@ -3806,7 +3821,7 @@ msgstr "" "建立一個保證與其他物件不同的單例哨兵物件。例如,這裡是如何實作一個行為類似" "於 :meth:`dict.pop` 的方法: ::" -#: ../../faq/programming.rst:1910 +#: ../../faq/programming.rst:1917 msgid "" "_sentinel = object()\n" "\n" @@ -3830,7 +3845,7 @@ msgstr "" " raise KeyError(key)\n" " return default" -#: ../../faq/programming.rst:1921 +#: ../../faq/programming.rst:1928 msgid "" "3) Container implementations sometimes need to augment equality tests with " "identity tests. This prevents the code from being confused by objects such " @@ -3839,14 +3854,14 @@ msgstr "" "3) 容器實作有時需要透過識別性測試來增強相等性測試。這可以防止程式碼被諸如 " "float('NaN') 之類的不等於自身的物件所混淆。" -#: ../../faq/programming.rst:1925 +#: ../../faq/programming.rst:1932 msgid "" "For example, here is the implementation of :meth:`!collections.abc.Sequence." "__contains__`::" msgstr "" "例如,以下是 :meth:`!collections.abc.Sequence.__contains__` 的實作: ::" -#: ../../faq/programming.rst:1928 +#: ../../faq/programming.rst:1935 msgid "" "def __contains__(self, value):\n" " for v in self:\n" @@ -3860,12 +3875,12 @@ msgstr "" " return True\n" " return False" -#: ../../faq/programming.rst:1936 +#: ../../faq/programming.rst:1943 msgid "" "How can a subclass control what data is stored in an immutable instance?" msgstr "子類別如何控制不可變實例中存儲的資料?" -#: ../../faq/programming.rst:1938 +#: ../../faq/programming.rst:1945 #, fuzzy msgid "" "When subclassing an immutable type, override the :meth:`~object.__new__` " @@ -3877,14 +3892,14 @@ msgstr "" "`~object.__init__` 方法。後者僅在*建立實例後*運行,這為時已晚,無法更改不可變" "實例中的資料。" -#: ../../faq/programming.rst:1943 +#: ../../faq/programming.rst:1950 #, fuzzy msgid "" "All of these immutable classes have a different signature than their parent " "class:" msgstr "所有這些不可變類別都具有與其父類別不同的簽名:" -#: ../../faq/programming.rst:1946 +#: ../../faq/programming.rst:1953 msgid "" "from datetime import date\n" "\n" @@ -3908,11 +3923,11 @@ msgid "" " return super().__new__(cls, s)" msgstr "" -#: ../../faq/programming.rst:1969 +#: ../../faq/programming.rst:1976 msgid "The classes can be used like this:" msgstr "這些類別可以像這樣使用:" -#: ../../faq/programming.rst:1971 +#: ../../faq/programming.rst:1978 msgid "" ">>> FirstOfMonthDate(2012, 2, 14)\n" "FirstOfMonthDate(2012, 2, 1)\n" @@ -3932,11 +3947,11 @@ msgstr "" ">>> TitleStr('Blog: Why Python Rocks')\n" "'blog-why-python-rocks'" -#: ../../faq/programming.rst:1986 +#: ../../faq/programming.rst:1993 msgid "How do I cache method calls?" msgstr "如何快取方法呼叫?" -#: ../../faq/programming.rst:1988 +#: ../../faq/programming.rst:1995 #, fuzzy msgid "" "The two principal tools for caching methods are :func:`functools." @@ -3946,7 +3961,7 @@ msgstr "" "快取方法的兩個主要工具是 func:`functools.cached_property` 和 :func:" "`functools.lru_cache`。前者在實例級別存儲結果,後者在類別級別存儲結果。" -#: ../../faq/programming.rst:1993 +#: ../../faq/programming.rst:2000 #, fuzzy msgid "" "The *cached_property* approach only works with methods that do not take any " @@ -3956,7 +3971,7 @@ msgstr "" "*cached_property* 方法僅適用於不帶任何引數的方法。它不會建立對實例的參照。只" "要實例還活著,快取的方法結果就會被保留。" -#: ../../faq/programming.rst:1997 +#: ../../faq/programming.rst:2004 #, fuzzy msgid "" "The advantage is that when an instance is no longer used, the cached method " @@ -3967,7 +3982,7 @@ msgstr "" "好處是當一個實例不再使用時,快取的方法結果會立即釋放。缺點是如果實例累積,累" "積的方法結果也會累積。他們可以不受限制地成長。" -#: ../../faq/programming.rst:2002 +#: ../../faq/programming.rst:2009 msgid "" "The *lru_cache* approach works with methods that have :term:`hashable` " "arguments. It creates a reference to the instance unless special efforts " @@ -3976,7 +3991,7 @@ msgstr "" "*lru_cache* 方法適用於具有\\ :term:`可雜湊 `\\ 引數的方法。除非特別" "努力傳遞弱參照,否則它會建立對實例的參照。" -#: ../../faq/programming.rst:2006 +#: ../../faq/programming.rst:2013 #, fuzzy msgid "" "The advantage of the least recently used algorithm is that the cache is " @@ -3986,11 +4001,11 @@ msgstr "" "最近最少使用演算法的優點是快取受指定的 *maxsize* 限制。缺點是實例會一直保持活" "動狀態,直到它們從快取中老化或快取被清除。" -#: ../../faq/programming.rst:2011 +#: ../../faq/programming.rst:2018 msgid "This example shows the various techniques::" msgstr "這個例子展示了各種技術: ::" -#: ../../faq/programming.rst:2013 +#: ../../faq/programming.rst:2020 msgid "" "class Weather:\n" " \"Lookup weather information on a government website\"\n" @@ -4015,7 +4030,7 @@ msgid "" " # Depends on the station_id, date, and units." msgstr "" -#: ../../faq/programming.rst:2035 +#: ../../faq/programming.rst:2042 #, fuzzy msgid "" "The above example assumes that the *station_id* never changes. If the " @@ -4025,7 +4040,7 @@ msgstr "" "上面的例子假設 *station_id* 永遠不會改變。如果相關的實例屬性是可變的,則 " "*cached_property* 方法無法工作,因為它無法檢測到屬性的更改。" -#: ../../faq/programming.rst:2040 +#: ../../faq/programming.rst:2047 #, fuzzy msgid "" "To make the *lru_cache* approach work when the *station_id* is mutable, the " @@ -4036,7 +4051,7 @@ msgstr "" "`~object.__eq__` 和 :meth:`~object.__hash__` 方法,以便快取可以檢測相關屬性更" "新: ::" -#: ../../faq/programming.rst:2044 +#: ../../faq/programming.rst:2051 msgid "" "class Weather:\n" " \"Example with a mutable station identifier\"\n" @@ -4059,15 +4074,15 @@ msgid "" " # Depends on the station_id, date, and units." msgstr "" -#: ../../faq/programming.rst:2066 +#: ../../faq/programming.rst:2073 msgid "Modules" msgstr "模組" -#: ../../faq/programming.rst:2069 +#: ../../faq/programming.rst:2076 msgid "How do I create a .pyc file?" msgstr "如何建立 .pyc 檔案?" -#: ../../faq/programming.rst:2071 +#: ../../faq/programming.rst:2078 #, fuzzy msgid "" "When a module is imported for the first time (or when the source file has " @@ -4084,7 +4099,7 @@ msgstr "" "間部分依賴於特定的``python `` 建立它的二進製檔案。(有關詳細資訊,請參閱 :" "pep:`3147`。)" -#: ../../faq/programming.rst:2079 +#: ../../faq/programming.rst:2086 #, fuzzy msgid "" "One reason that a ``.pyc`` file may not be created is a permissions problem " @@ -4097,7 +4112,7 @@ msgstr "" "__pycache__ 子目錄。例如,如果你以一個使用者的身份開發但以另一個使用者的身份" "運行,例如你正在使用 Web 服務器進行測試,就會發生這種情況。" -#: ../../faq/programming.rst:2084 +#: ../../faq/programming.rst:2091 #, fuzzy msgid "" "Unless the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable is set, " @@ -4106,11 +4121,11 @@ msgid "" "``__pycache__`` subdirectory and write the compiled module to that " "subdirectory." msgstr "" -"除非:envvar:`PYTHONDONTWRITEBYTECODE` 環境變數被設定,如果你正在引入一個模組" -"並且 Python 有能力(權限,空閒空間等)建立一個 .pyc 檔案是自動的建立一個" +"除非 :envvar:`PYTHONDONTWRITEBYTECODE` 環境變數有被設定,如果你正在引入一個模" +"組並且 Python 有能力(權限、空閒空間等)建立一個 .pyc 檔案是自動的建立一個" "``__pycache__ `` 子目錄並將編譯後的模組寫入該子目錄。" -#: ../../faq/programming.rst:2089 +#: ../../faq/programming.rst:2096 #, fuzzy msgid "" "Running Python on a top level script is not considered an import and no ``." @@ -4125,26 +4140,25 @@ msgstr "" "入 ``python foo.py`` 作為一個 shell 命令),將為 xyz 建立一個 .pyc 因為引入" "了 xyz,但是不會為 foo 建立 .pyc 檔案,因為 ` `foo.py`` 沒有被引入。" -#: ../../faq/programming.rst:2096 -#, fuzzy +#: ../../faq/programming.rst:2103 msgid "" "If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a ``." "pyc`` file for a module that is not imported -- you can, using the :mod:" "`py_compile` and :mod:`compileall` modules." msgstr "" -"如果你需要為 ``foo`` 建立一個 ``.pyc`` 檔案——也就是說,為一個未引入的模組建立" -"一個 ``.pyc`` 檔案——你可以使用 :mod :`py_compile` 和 :mod:`compileall` 模組。" +"如果你需要為 ``foo`` 建立一個 ``.pyc`` 檔案 —— 也就是說,要為一個未引入的模組" +"建立一個 ``.pyc`` 檔案 —— 你可以使用 :mod:`py_compile` 和 :mod:`compileall` " +"模組。" -#: ../../faq/programming.rst:2100 -#, fuzzy +#: ../../faq/programming.rst:2107 msgid "" "The :mod:`py_compile` module can manually compile any module. One way is to " "use the ``compile()`` function in that module interactively::" msgstr "" -":mod:`py_compile` 模組可以手動編譯任何模組。一種方法是在該模組中以交互方式使" -"用 ``compile()`` 函式: ::" +":mod:`py_compile` 模組允許手動編譯任何模組。其中一種方法是在該模組中以交互方" +"式使用 ``compile()`` 函式: ::" -#: ../../faq/programming.rst:2103 +#: ../../faq/programming.rst:2110 msgid "" ">>> import py_compile\n" ">>> py_compile.compile('foo.py') " @@ -4152,17 +4166,16 @@ msgstr "" ">>> import py_compile\n" ">>> py_compile.compile('foo.py') " -#: ../../faq/programming.rst:2106 -#, fuzzy +#: ../../faq/programming.rst:2113 msgid "" "This will write the ``.pyc`` to a ``__pycache__`` subdirectory in the same " "location as ``foo.py`` (or you can override that with the optional parameter " "``cfile``)." msgstr "" -"這會將 .pyc 寫入與 foo.py 相同位置的 __pycache__ 子目錄(或者你可以使用可選參" -"數 cfile 覆蓋它)。" +"這會將 ``.pyc`` 寫入與 ``foo.py`` 相同位置的 ``__pycache__`` 子目錄(或者你可" +"以使用可選參數 ``cfile`` 覆蓋它)。" -#: ../../faq/programming.rst:2110 +#: ../../faq/programming.rst:2117 #, fuzzy msgid "" "You can also automatically compile all files in a directory or directories " @@ -4173,15 +4186,15 @@ msgstr "" "你還可以使用 :mod:`compileall` 模組自動編譯目錄中的所有檔案。你可以在 shell " "提示符下運行 ``compileall.py`` 並提供包含要編譯的 Python 檔案的目錄路徑: ::" -#: ../../faq/programming.rst:2115 +#: ../../faq/programming.rst:2122 msgid "python -m compileall ." msgstr "python -m compileall ." -#: ../../faq/programming.rst:2119 +#: ../../faq/programming.rst:2126 msgid "How do I find the current module name?" msgstr "如何找到當前模組名稱?" -#: ../../faq/programming.rst:2121 +#: ../../faq/programming.rst:2128 #, fuzzy msgid "" "A module can find out its own module name by looking at the predefined " @@ -4194,7 +4207,7 @@ msgstr "" "值為``'__main__'``,則該程式作為腳本運行。許多通常透過引入使用的模組還提供命" "令行界面或自檢,只有在檢查 ``__name__`` 後才執行此程式碼: ::" -#: ../../faq/programming.rst:2127 +#: ../../faq/programming.rst:2134 msgid "" "def main():\n" " print('Running test...')\n" @@ -4204,20 +4217,20 @@ msgid "" " main()" msgstr "" -#: ../../faq/programming.rst:2136 +#: ../../faq/programming.rst:2143 #, fuzzy msgid "How can I have modules that mutually import each other?" msgstr "我怎樣才能擁有相互引入的模組?" -#: ../../faq/programming.rst:2138 +#: ../../faq/programming.rst:2145 msgid "Suppose you have the following modules:" msgstr "假設你有以下模組:" -#: ../../faq/programming.rst:2140 +#: ../../faq/programming.rst:2147 msgid ":file:`foo.py`::" msgstr ":file:`foo.py`: ::" -#: ../../faq/programming.rst:2142 +#: ../../faq/programming.rst:2149 msgid "" "from bar import bar_var\n" "foo_var = 1" @@ -4225,11 +4238,11 @@ msgstr "" "from bar import bar_var\n" "foo_var = 1" -#: ../../faq/programming.rst:2145 +#: ../../faq/programming.rst:2152 msgid ":file:`bar.py`::" msgstr ":file:`bar.py`: ::" -#: ../../faq/programming.rst:2147 +#: ../../faq/programming.rst:2154 msgid "" "from foo import foo_var\n" "bar_var = 2" @@ -4237,56 +4250,50 @@ msgstr "" "from foo import foo_var\n" "bar_var = 2" -#: ../../faq/programming.rst:2150 -#, fuzzy +#: ../../faq/programming.rst:2157 msgid "The problem is that the interpreter will perform the following steps:" msgstr "問題是直譯器將執行以下步驟:" -#: ../../faq/programming.rst:2152 -#, fuzzy +#: ../../faq/programming.rst:2159 msgid "main imports ``foo``" msgstr "主要引入 ``foo``" -#: ../../faq/programming.rst:2153 -#, fuzzy +#: ../../faq/programming.rst:2160 msgid "Empty globals for ``foo`` are created" msgstr "建立了 ``foo`` 的空全域變數" -#: ../../faq/programming.rst:2154 +#: ../../faq/programming.rst:2161 msgid "``foo`` is compiled and starts executing" msgstr "``foo`` 被編譯並開始執行" -#: ../../faq/programming.rst:2155 +#: ../../faq/programming.rst:2162 msgid "``foo`` imports ``bar``" msgstr "``foo`` 引入 ``bar``" -#: ../../faq/programming.rst:2156 -#, fuzzy +#: ../../faq/programming.rst:2163 msgid "Empty globals for ``bar`` are created" msgstr "建立了 ``bar`` 的空全域變數" -#: ../../faq/programming.rst:2157 +#: ../../faq/programming.rst:2164 msgid "``bar`` is compiled and starts executing" msgstr "``bar`` 已被編譯並開始執行" -#: ../../faq/programming.rst:2158 -#, fuzzy +#: ../../faq/programming.rst:2165 msgid "" "``bar`` imports ``foo`` (which is a no-op since there already is a module " "named ``foo``)" msgstr "" -"``bar`` 引入 ``foo``(這是一個空操作,因為已經有一個名為 ``foo`` 的模組)" +"``bar`` 引入 ``foo``\\ (這是一個空操作,因為已經有一個名為 ``foo`` 的模組)" -#: ../../faq/programming.rst:2159 -#, fuzzy +#: ../../faq/programming.rst:2166 msgid "" "The import mechanism tries to read ``foo_var`` from ``foo`` globals, to set " "``bar.foo_var = foo.foo_var``" msgstr "" -"引入機制嘗試從 ``foo`` 全域變數中讀取 ``foo_var`` ,以設定 ``bar.foo_var = " -"foo.foo_var`` " +"引入機制嘗試從 ``foo`` 全域變數中讀取 ``foo_var``,以設定 ``bar.foo_var = " +"foo.foo_var``" -#: ../../faq/programming.rst:2161 +#: ../../faq/programming.rst:2168 #, fuzzy msgid "" "The last step fails, because Python isn't done with interpreting ``foo`` yet " @@ -4295,7 +4302,7 @@ msgstr "" "最後一步失敗了,因為 Python 還沒有完成對 ``foo`` 的直譯,而 ``foo`` 的全域符" "號字典仍然是空的。" -#: ../../faq/programming.rst:2164 +#: ../../faq/programming.rst:2171 #, fuzzy msgid "" "The same thing happens when you use ``import foo``, and then try to access " @@ -4304,11 +4311,11 @@ msgstr "" "當你使用 ``import foo``,然後嘗試在全域程式碼中存取 ``foo.foo_var`` 時,也會" "發生同樣的事情。" -#: ../../faq/programming.rst:2167 +#: ../../faq/programming.rst:2174 msgid "There are (at least) three possible workarounds for this problem." msgstr "此問題有(至少)三種可能的解決方法。" -#: ../../faq/programming.rst:2169 +#: ../../faq/programming.rst:2176 #, fuzzy msgid "" "Guido van Rossum recommends avoiding all uses of ``from import ..." @@ -4321,50 +4328,51 @@ msgstr "" "函式中。全域變數和類別變數的初始化應該只使用常數或內建函式。這意味著來自引入" "模組的所有內容都被參照為 ``.``。" -#: ../../faq/programming.rst:2174 +#: ../../faq/programming.rst:2181 msgid "" "Jim Roskind suggests performing steps in the following order in each module:" msgstr "Jim Roskind 建議在每個模組中按以下順序執行各個步驟:" -#: ../../faq/programming.rst:2176 +#: ../../faq/programming.rst:2183 #, fuzzy msgid "" "exports (globals, functions, and classes that don't need imported base " "classes)" -msgstr "導出(不需要引入基底類別的全域變數、函式和類別)" +msgstr "匯出(不需要引入基底類別的全域變數、函式和類別)" -#: ../../faq/programming.rst:2178 +#: ../../faq/programming.rst:2185 msgid "``import`` statements" msgstr "``import`` 陳述式" -#: ../../faq/programming.rst:2179 +#: ../../faq/programming.rst:2186 msgid "" "active code (including globals that are initialized from imported values)." msgstr "活躍程式碼(包括從引入值初始化的全域變數)。" -#: ../../faq/programming.rst:2181 -#, fuzzy +#: ../../faq/programming.rst:2188 msgid "" "Van Rossum doesn't like this approach much because the imports appear in a " "strange place, but it does work." msgstr "" "Van Rossum 不太喜歡這種方法,因為引入出現在一個奇怪的地方,但它確實有效。" -#: ../../faq/programming.rst:2184 +#: ../../faq/programming.rst:2191 msgid "" "Matthias Urlichs recommends restructuring your code so that the recursive " "import is not necessary in the first place." -msgstr "Matthias Urlichs 建議重構你的程式碼,以便打從一開始就不需要遞迴引入。" +msgstr "" +"Matthias Urlichs 建議重組 (restructuring) 你的程式碼,以便打從一開始就不需要" +"遞迴引入。" -#: ../../faq/programming.rst:2187 +#: ../../faq/programming.rst:2194 msgid "These solutions are not mutually exclusive." msgstr "這些方案並不衝突。" -#: ../../faq/programming.rst:2191 +#: ../../faq/programming.rst:2198 msgid "__import__('x.y.z') returns ; how do I get z?" msgstr "__import__('x.y.z') 回傳 ,那我怎麼得到 z?" -#: ../../faq/programming.rst:2193 +#: ../../faq/programming.rst:2200 #, fuzzy msgid "" "Consider using the convenience function :func:`~importlib.import_module` " @@ -4373,17 +4381,17 @@ msgstr "" "考慮使用來自 :mod:`importlib` 的便利函式 :func:`~importlib.import_module` 代" "替: ::" -#: ../../faq/programming.rst:2196 +#: ../../faq/programming.rst:2203 msgid "z = importlib.import_module('x.y.z')" msgstr "z = importlib.import_module('x.y.z')" -#: ../../faq/programming.rst:2200 +#: ../../faq/programming.rst:2207 msgid "" "When I edit an imported module and reimport it, the changes don't show up. " "Why does this happen?" msgstr "當我編輯需要引入的模組並重新引入它時,更動沒有反應出來。為什麼會這樣?" -#: ../../faq/programming.rst:2202 +#: ../../faq/programming.rst:2209 #, fuzzy msgid "" "For reasons of efficiency as well as consistency, Python only reads the " @@ -4396,7 +4404,7 @@ msgstr "" "一個由許多模組組成的程式中,每個模組都引入相同的基本模組,基本模組將被解析和" "重新解析很多次。要強制重新讀取已更改的模組,請執行以下操作: ::" -#: ../../faq/programming.rst:2208 +#: ../../faq/programming.rst:2215 msgid "" "import importlib\n" "import modname\n" @@ -4406,18 +4414,17 @@ msgstr "" "import modname\n" "importlib.reload(modname)" -#: ../../faq/programming.rst:2212 -#, fuzzy +#: ../../faq/programming.rst:2219 msgid "" "Warning: this technique is not 100% fool-proof. In particular, modules " "containing statements like ::" -msgstr "警告:此技術並非 100% 萬無一失。尤其是,包含像這樣的陳述式的模組: ::" +msgstr "警告:此技術並非 100% 萬無一失。尤其是包含像這樣陳述式的模組: ::" -#: ../../faq/programming.rst:2215 +#: ../../faq/programming.rst:2222 msgid "from modname import some_objects" msgstr "from modname import some_objects" -#: ../../faq/programming.rst:2217 +#: ../../faq/programming.rst:2224 #, fuzzy msgid "" "will continue to work with the old version of the imported objects. If the " @@ -4428,7 +4435,7 @@ msgstr "" "將繼續使用舊版本的引入物件。如果模組包含類別定義,現有的類別實例將*不會*更新" "為使用新的類別定義。這可能會導致以下自相矛盾的行為: ::" -#: ../../faq/programming.rst:2222 +#: ../../faq/programming.rst:2229 msgid "" ">>> import importlib\n" ">>> import cls\n" @@ -4439,13 +4446,13 @@ msgid "" "False" msgstr "" -#: ../../faq/programming.rst:2230 +#: ../../faq/programming.rst:2237 msgid "" "The nature of the problem is made clear if you print out the \"identity\" of " "the class objects::" msgstr "如果印出類別物件的「識別性」,問題的本質就很清楚了: ::" -#: ../../faq/programming.rst:2233 +#: ../../faq/programming.rst:2240 msgid "" ">>> hex(id(c.__class__))\n" "'0x7352a0'\n" diff --git a/glossary.po b/glossary.po index 0f5ee13d86..a882706b5e 100644 --- a/glossary.po +++ b/glossary.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -148,6 +148,8 @@ msgid "" "complex(real=3, imag=5)\n" "complex(**{'real': 3, 'imag': 5})" msgstr "" +"complex(real=3, imag=5)\n" +"complex(**{'real': 3, 'imag': 5})" #: ../../glossary.rst:67 msgid "" @@ -165,6 +167,8 @@ msgid "" "complex(3, 5)\n" "complex(*(3, 5))" msgstr "" +"complex(3, 5)\n" +"complex(*(3, 5))" #: ../../glossary.rst:76 msgid "" @@ -483,7 +487,7 @@ msgstr "" #: ../../glossary.rst:210 msgid "callable(argument1, argument2, argumentN)" -msgstr "" +msgstr "callable(argument1, argument2, argumentN)" #: ../../glossary.rst:212 msgid "" @@ -741,7 +745,7 @@ msgid "" "can be any object with :meth:`~object.__hash__` and :meth:`~object.__eq__` " "methods. Called a hash in Perl." msgstr "" -"一個關聯陣列 (associative array),其中任意的鍵會被映射到值。鍵可以是任何帶" +"一個關聯陣列 (associative array),其中任意的鍵會被對映到值。鍵可以是任何帶" "有 :meth:`~object.__hash__` 和 :meth:`~object.__eq__` method 的物件。在 Perl " "中被稱為雜湊 (hash)。" @@ -758,7 +762,7 @@ msgid "" msgstr "" "一種緊密的方法,用來處理一個可疊代物件中的全部或部分元素,並將處理結果以一個" "字典回傳。``results = {n: n ** 2 for n in range(10)}`` 會產生一個字典,它包含" -"了鍵 ``n`` 映射到值 ``n ** 2``。請參閱\\ :ref:`comprehensions`。" +"了鍵 ``n`` 對映到值 ``n ** 2``。請參閱\\ :ref:`comprehensions`。" #: ../../glossary.rst:333 msgid "dictionary view" @@ -785,14 +789,14 @@ msgstr "docstring(說明字串)" msgid "" "A string literal which appears as the first expression in a class, function " "or module. While ignored when the suite is executed, it is recognized by " -"the compiler and put into the :attr:`!__doc__` attribute of the enclosing " -"class, function or module. Since it is available via introspection, it is " -"the canonical place for documentation of the object." +"the compiler and put into the :attr:`~definition.__doc__` attribute of the " +"enclosing class, function or module. Since it is available via " +"introspection, it is the canonical place for documentation of the object." msgstr "" "一個在 class、函式或模組中,作為第一個運算式出現的字串文本。雖然它在套件執行" -"時會被忽略,但它會被編譯器辨識,並被放入所屬 class、函式或模組的 :attr:`!" -"__doc__` 屬性中。由於說明字串可以透過內省 (introspection) 來瀏覽,因此它是物" -"件的說明文件存放的標準位置。" +"時會被忽略,但它會被編譯器辨識,並被放入所屬 class、函式或模組的 :attr:" +"`~definition.__doc__` 屬性中。由於說明字串可以透過內省 (introspection) 來瀏" +"覽,因此它是物件的說明文件存放的標準位置。" #: ../../glossary.rst:349 msgid "duck-typing" @@ -1012,7 +1016,7 @@ msgstr "" #: ../../glossary.rst:440 msgid "free threading" -msgstr "" +msgstr "free threading(自由執行緒)" #: ../../glossary.rst:442 msgid "" @@ -1021,6 +1025,9 @@ msgid "" "term:`global interpreter lock` which allows only one thread to execute " "Python bytecode at a time. See :pep:`703`." msgstr "" +"為一種執行緒模型,多個執行緒可以在同一直譯器中同時運行 Python 位元組碼。這與" +"\\ :term:`全域直譯器鎖 `\\ 形成對比,後者一次只允許" +"一個執行緒執行 Python 位元組碼。請參閱 :pep:`703`。" #: ../../glossary.rst:446 msgid "function" @@ -1186,6 +1193,8 @@ msgid "" ">>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81\n" "285" msgstr "" +">>> sum(i*i for i in range(10)) # 平方之和 0, 1, 4, ... 81\n" +"285" #: ../../glossary.rst:521 msgid "generic function" @@ -1279,6 +1288,11 @@ msgid "" "performance for multi-threaded applications and makes it easier to use multi-" "core CPUs efficiently. For more details, see :pep:`703`." msgstr "" +"從 Python 3.13 開始可以使用 :option:`--disable-gil` 建置設定來停用 GIL。使用" +"此選項建立 Python 後,必須使用 :option:`-X gil 0 <-X>` 來執行程式碼,或者設" +"定 :envvar:`PYTHON_GIL=0 ` 環境變數後再執行程式碼。此功能可以提高" +"多執行緒應用程式的效能,並使多核心 CPU 的高效使用變得更加容易。有關更多詳細資" +"訊,請參閱 :pep:`703`。" #: ../../glossary.rst:563 msgid "hash-based pyc" @@ -1348,13 +1362,13 @@ msgstr "" #: ../../glossary.rst:591 msgid "immortal" -msgstr "" +msgstr "immportal(不滅)" #: ../../glossary.rst:593 msgid "" "*Immortal objects* are a CPython implementation detail introduced in :pep:" "`683`." -msgstr "" +msgstr "*不滅物件 (Immortal objects)* 是 :pep:`683` 引入的 CPython 實作細節。" #: ../../glossary.rst:596 msgid "" @@ -1362,6 +1376,9 @@ msgid "" "therefore it is never deallocated while the interpreter is running. For " "example, :const:`True` and :const:`None` are immortal in CPython." msgstr "" +"如果一個物件是不滅的,它的\\ :term:`參照計數 `\\ 永遠不會被" +"修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` 和 :const:" +"`None` 在 CPython 中是不滅的。" #: ../../glossary.rst:599 msgid "immutable" @@ -1562,14 +1579,14 @@ msgid "More information can be found in :ref:`typeiter`." msgstr "在\\ :ref:`typeiter`\\ 文中可以找到更多資訊。" #: ../../glossary.rst:693 -#, fuzzy msgid "" "CPython does not consistently apply the requirement that an iterator define :" "meth:`~iterator.__iter__`. And also please note that the free-threading " "CPython does not guarantee the thread-safety of iterator operations." msgstr "" "CPython 並不是始終如一地都會檢查「疊代器有定義 :meth:`~iterator." -"__iter__`\\ 」這個規定。" +"__iter__`\\ 」這個規定。另請注意,free-threading(自由執行緒)CPython 不保證" +"疊代器操作的執行緒安全。" #: ../../glossary.rst:698 msgid "key function" @@ -2469,7 +2486,6 @@ msgid "reference count" msgstr "reference count(參照計數)" #: ../../glossary.rst:1090 -#, fuzzy msgid "" "The number of references to an object. When the reference count of an " "object drops to zero, it is deallocated. Some objects are :term:`immortal` " @@ -2480,10 +2496,10 @@ msgid "" "reference count for a particular object." msgstr "" "對於一個物件的參照次數。當一個物件的參照計數下降到零時,它會被解除配置 " -"(deallocated)。有些物件是「不滅的 (immortal)」並擁有不會被改變的參照計數,也" -"因此永遠不會被解除配置。參照計數通常在 Python 程式碼中看不到,但它卻是 :term:" -"`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :func:`~sys.getrefcount` 函" -"式來回傳一個特定物件的參照計數。" +"(deallocated)。有些物件是「\\ :term:`不滅的 ` (immortal)」並擁有不" +"會被改變的參照計數,也因此永遠不會被解除配置。參照計數通常在 Python 程式碼中" +"看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :" +"func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" #: ../../glossary.rst:1098 msgid "regular package" @@ -2503,13 +2519,15 @@ msgstr "另請參閱 :term:`namespace package`\\ (命名空間套件)。" #: ../../glossary.rst:1104 msgid "REPL" -msgstr "" +msgstr "REPL" #: ../../glossary.rst:1106 msgid "" "An acronym for the \"read–eval–print loop\", another name for the :term:" "`interactive` interpreter shell." msgstr "" +"「read-eval-print 迴圈 (read–eval–print loop)」的縮寫,是\\ :term:`互動式 " +"`\\ 直譯器 shell 的另一個名稱。" #: ../../glossary.rst:1108 msgid "__slots__" @@ -2613,7 +2631,7 @@ msgstr "" #: ../../glossary.rst:1151 msgid "soft deprecated" -msgstr "" +msgstr "soft deprecated(軟性棄用)" #: ../../glossary.rst:1153 msgid "" @@ -2622,6 +2640,8 @@ msgid "" "code. The API remains documented and tested, but will not be developed " "further (no enhancement)." msgstr "" +"軟性棄用代表 API 不應再用來編寫新程式碼,但在現有程式碼中繼續使用它仍然是安全" +"的。API 仍會以文件記錄並會被測試,但不會進一步開發(不會繼續改進)。" #: ../../glossary.rst:1158 msgid "" @@ -2629,16 +2649,20 @@ msgid "" "is that the soft deprecation does not imply scheduling the removal of the " "deprecated API." msgstr "" +"「軟性」棄用和(常規的)「硬性」棄用之間的主要區別在於,軟性棄用並不代表已經" +"確定要什麼時候刪除已棄用的 API。" #: ../../glossary.rst:1162 msgid "Another difference is that a soft deprecation does not issue a warning." -msgstr "" +msgstr "另一個區別是軟性棄用不會發出警告。" #: ../../glossary.rst:1164 msgid "" "See `PEP 387: Soft Deprecation `_." msgstr "" +"請參閱 `PEP 387:軟性棄用 `_。" #: ../../glossary.rst:1166 msgid "special method" @@ -2793,12 +2817,12 @@ msgstr "type(型別)" #: ../../glossary.rst:1232 msgid "" "The type of a Python object determines what kind of object it is; every " -"object has a type. An object's type is accessible as its :attr:`~instance." +"object has a type. An object's type is accessible as its :attr:`~object." "__class__` attribute or can be retrieved with ``type(obj)``." msgstr "" "一個 Python 物件的型別決定了它是什麼類型的物件;每個物件都有一個型別。一個物" -"件的型別可以用它的 :attr:`~instance.__class__` 屬性來存取,或以 " -"``type(obj)`` 來檢索。" +"件的型別可以用它的 :attr:`~object.__class__` 屬性來存取,或以 ``type(obj)`` " +"來檢索。" #: ../../glossary.rst:1236 msgid "type alias" diff --git a/howto/annotations.po b/howto/annotations.po index c4450542af..67acc522c3 100644 --- a/howto/annotations.po +++ b/howto/annotations.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2023-11-08 23:11+0800\n" "Last-Translator: rockleon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -192,15 +192,15 @@ msgid "" "Your code will have to have a separate code path if the object you're " "examining is a class (``isinstance(o, type)``). In that case, best practice " "relies on an implementation detail of Python 3.9 and before: if a class has " -"annotations defined, they are stored in the class's ``__dict__`` " +"annotations defined, they are stored in the class's :attr:`~type.__dict__` " "dictionary. Since the class may or may not have annotations defined, best " -"practice is to call the ``get`` method on the class dict." +"practice is to call the :meth:`~dict.get` method on the class dict." msgstr "" "如果你正在檢查的物件是一個類別 (``isinstance(o, type)``),你的程式碼將必須有" "一個單獨的程式碼路徑。在這種情況下,最佳實踐依賴 Python 3.9 及之前版本的實作" -"細節 (implementation detail):如果一個類別定義了註釋,它們將儲存在該類別的 " -"``__dict__`` 字典中。由於類別可能定義了註釋,也可能沒有定義,因此最佳實踐是在" -"類別字典上呼叫 ``get`` 方法。" +"細節 (implementation detail):如果一個類別定義了註釋,它們將儲存在該類別的 :" +"attr:`~type.__dict__` 字典中。由於類別可能定義了註釋,也可能沒有定義,因此最" +"佳實踐是在類別字典上呼叫 :meth:`~dict.get` 方法。" #: ../../howto/annotations.rst:109 msgid "" @@ -234,13 +234,13 @@ msgstr "" #: ../../howto/annotations.rst:123 msgid "" -"Note that some exotic or malformed type objects may not have a ``__dict__`` " -"attribute, so for extra safety you may also wish to use :func:`getattr` to " -"access ``__dict__``." +"Note that some exotic or malformed type objects may not have a :attr:`~type." +"__dict__` attribute, so for extra safety you may also wish to use :func:" +"`getattr` to access :attr:`!__dict__`." msgstr "" -"請注意,某些外來 (exotic) 或格式錯誤 (malform) 的型別物件可能沒有 " -"``__dict__`` 屬性,因此為了額外的安全,你可能還希望使用 :func:`getattr` 來存" -"取 ``__dict__`` 。" +"請注意,某些外來 (exotic) 或格式錯誤 (malform) 的型別物件可能沒有 :attr:" +"`~type.__dict__` 屬性,因此為了額外的安全,你可能還希望使用 :func:`getattr` " +"來存取 :attr:`!__dict__`。" #: ../../howto/annotations.rst:129 msgid "Manually Un-Stringizing Stringized Annotations" diff --git a/howto/descriptor.po b/howto/descriptor.po index 80a905a7cd..876ca82e89 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -810,8 +810,8 @@ msgstr "" msgid "" "The expression ``obj.x`` looks up the attribute ``x`` in the chain of " "namespaces for ``obj``. If the search finds a descriptor outside of the " -"instance ``__dict__``, its :meth:`__get__` method is invoked according to " -"the precedence rules listed below." +"instance :attr:`~object.__dict__`, its :meth:`~object.__get__` method is " +"invoked according to the precedence rules listed below." msgstr "" #: ../../howto/descriptor.rst:568 diff --git a/howto/enum.po b/howto/enum.po index 8e243e281d..668b2723f2 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1137,9 +1137,9 @@ msgstr "" #: ../../howto/enum.rst:610 msgid "" "The new pickle protocol 4 also, in some circumstances, relies on :attr:" -"`~definition.__qualname__` being set to the location where pickle will be " -"able to find the class. For example, if the class was made available in " -"class SomeData in the global scope::" +"`~type.__qualname__` being set to the location where pickle will be able to " +"find the class. For example, if the class was made available in class " +"SomeData in the global scope::" msgstr "" #: ../../howto/enum.rst:615 @@ -1644,12 +1644,11 @@ msgid "" msgstr "" #: ../../howto/enum.rst:890 -#, fuzzy msgid "" "class IntEnum(int, ReprEnum): # or Enum instead of ReprEnum\n" " pass" msgstr "" -"class IntEnum(int, Enum):\n" +"class IntEnum(int, ReprEnum): # 或用 Enum 取代 ReprEnum\n" " pass" #: ../../howto/enum.rst:893 @@ -1792,9 +1791,8 @@ msgid "Supported ``_sunder_`` names" msgstr "" #: ../../howto/enum.rst:983 -#, fuzzy msgid ":attr:`~Enum._name_` -- name of the member" -msgstr "``_name_`` -- 成員的名稱" +msgstr ":attr:`~Enum._name_` -- 成員的名稱" #: ../../howto/enum.rst:984 msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" @@ -1942,6 +1940,11 @@ msgid "" ">>> MyEnum.example.value # and hex(11) is...\n" "17" msgstr "" +">>> class MyEnum(IntEnum): # help(int) -> int(x, base=10) -> integer\n" +"... example = '11', 16 # 所以 x='11' 且 base=16\n" +"...\n" +">>> MyEnum.example.value # 且 hex(11) 為...\n" +"17" #: ../../howto/enum.rst:1071 msgid "Boolean value of ``Enum`` classes and members" @@ -2222,7 +2225,7 @@ msgstr "" #: ../../howto/enum.rst:1216 msgid "Enum Classes" -msgstr "" +msgstr "Enum 類別" #: ../../howto/enum.rst:1218 msgid "" @@ -2237,7 +2240,7 @@ msgstr "" #: ../../howto/enum.rst:1227 msgid "Flag Classes" -msgstr "" +msgstr "Flag 類別" #: ../../howto/enum.rst:1229 msgid "" @@ -2263,7 +2266,7 @@ msgstr "" #: ../../howto/enum.rst:1243 msgid "Flag Members" -msgstr "" +msgstr "Flag 成員" #: ../../howto/enum.rst:1245 msgid "" @@ -2673,7 +2676,7 @@ msgstr "" #: ../../howto/enum.rst:1482 msgid "MultiValueEnum" -msgstr "" +msgstr "MultiValueEnum" #: ../../howto/enum.rst:1484 msgid "Supports having more than one value per member::" @@ -2763,7 +2766,7 @@ msgstr "" #: ../../howto/enum.rst:1557 msgid "Subclassing EnumType" -msgstr "" +msgstr "子類別化 EnumType" #: ../../howto/enum.rst:1559 msgid "" diff --git a/howto/free-threading-python.po b/howto/free-threading-python.po new file mode 100644 index 0000000000..5578166a5d --- /dev/null +++ b/howto/free-threading-python.po @@ -0,0 +1,257 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-04 00:13+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../howto/free-threading-python.rst:5 +msgid "Python experimental support for free threading" +msgstr "" + +#: ../../howto/free-threading-python.rst:7 +msgid "" +"Starting with the 3.13 release, CPython has experimental support for a build " +"of Python called :term:`free threading` where the :term:`global interpreter " +"lock` (GIL) is disabled. Free-threaded execution allows for full " +"utilization of the available processing power by running threads in parallel " +"on available CPU cores. While not all software will benefit from this " +"automatically, programs designed with threading in mind will run faster on " +"multi-core hardware." +msgstr "" + +#: ../../howto/free-threading-python.rst:14 +msgid "" +"**The free-threaded mode is experimental** and work is ongoing to improve " +"it: expect some bugs and a substantial single-threaded performance hit." +msgstr "" + +#: ../../howto/free-threading-python.rst:17 +msgid "" +"This document describes the implications of free threading for Python code. " +"See :ref:`freethreading-extensions-howto` for information on how to write C " +"extensions that support the free-threaded build." +msgstr "" + +#: ../../howto/free-threading-python.rst:23 +msgid "" +":pep:`703` – Making the Global Interpreter Lock Optional in CPython for an " +"overall description of free-threaded Python." +msgstr "" + +#: ../../howto/free-threading-python.rst:28 +msgid "Installation" +msgstr "" + +#: ../../howto/free-threading-python.rst:30 +msgid "" +"Starting with Python 3.13, the official macOS and Windows installers " +"optionally support installing free-threaded Python binaries. The installers " +"are available at https://www.python.org/downloads/." +msgstr "" + +#: ../../howto/free-threading-python.rst:34 +msgid "" +"For information on other platforms, see the `Installing a Free-Threaded " +"Python `_, a " +"community-maintained installation guide for installing free-threaded Python." +msgstr "" + +#: ../../howto/free-threading-python.rst:38 +msgid "" +"When building CPython from source, the :option:`--disable-gil` configure " +"option should be used to build a free-threaded Python interpreter." +msgstr "" + +#: ../../howto/free-threading-python.rst:43 +msgid "Identifying free-threaded Python" +msgstr "" + +#: ../../howto/free-threading-python.rst:45 +msgid "" +"To check if the current interpreter supports free-threading, :option:`python " +"-VV <-V>` and :attr:`sys.version` contain \"experimental free-threading " +"build\". The new :func:`sys._is_gil_enabled` function can be used to check " +"whether the GIL is actually disabled in the running process." +msgstr "" + +#: ../../howto/free-threading-python.rst:50 +msgid "" +"The ``sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` configuration variable " +"can be used to determine whether the build supports free threading. If the " +"variable is set to ``1``, then the build supports free threading. This is " +"the recommended mechanism for decisions related to the build configuration." +msgstr "" + +#: ../../howto/free-threading-python.rst:57 +msgid "The global interpreter lock in free-threaded Python" +msgstr "" + +#: ../../howto/free-threading-python.rst:59 +msgid "" +"Free-threaded builds of CPython support optionally running with the GIL " +"enabled at runtime using the environment variable :envvar:`PYTHON_GIL` or " +"the command-line option :option:`-X gil`." +msgstr "" + +#: ../../howto/free-threading-python.rst:63 +msgid "" +"The GIL may also automatically be enabled when importing a C-API extension " +"module that is not explicitly marked as supporting free threading. A " +"warning will be printed in this case." +msgstr "" + +#: ../../howto/free-threading-python.rst:67 +msgid "" +"In addition to individual package documentation, the following websites " +"track the status of popular packages support for free threading:" +msgstr "" + +#: ../../howto/free-threading-python.rst:70 +msgid "https://py-free-threading.github.io/tracking/" +msgstr "" + +#: ../../howto/free-threading-python.rst:71 +msgid "https://hugovk.github.io/free-threaded-wheels/" +msgstr "" + +#: ../../howto/free-threading-python.rst:75 +msgid "Thread safety" +msgstr "" + +#: ../../howto/free-threading-python.rst:77 +msgid "" +"The free-threaded build of CPython aims to provide similar thread-safety " +"behavior at the Python level to the default GIL-enabled build. Built-in " +"types like :class:`dict`, :class:`list`, and :class:`set` use internal locks " +"to protect against concurrent modifications in ways that behave similarly to " +"the GIL. However, Python has not historically guaranteed specific behavior " +"for concurrent modifications to these built-in types, so this should be " +"treated as a description of the current implementation, not a guarantee of " +"current or future behavior." +msgstr "" + +#: ../../howto/free-threading-python.rst:88 +msgid "" +"It's recommended to use the :class:`threading.Lock` or other synchronization " +"primitives instead of relying on the internal locks of built-in types, when " +"possible." +msgstr "" + +#: ../../howto/free-threading-python.rst:94 +msgid "Known limitations" +msgstr "" + +#: ../../howto/free-threading-python.rst:96 +msgid "" +"This section describes known limitations of the free-threaded CPython build." +msgstr "" + +#: ../../howto/free-threading-python.rst:99 +msgid "Immortalization" +msgstr "" + +#: ../../howto/free-threading-python.rst:101 +msgid "" +"The free-threaded build of the 3.13 release makes some objects :term:" +"`immortal`. Immortal objects are not deallocated and have reference counts " +"that are never modified. This is done to avoid reference count contention " +"that would prevent efficient multi-threaded scaling." +msgstr "" + +#: ../../howto/free-threading-python.rst:106 +msgid "" +"An object will be made immortal when a new thread is started for the first " +"time after the main thread is running. The following objects are " +"immortalized:" +msgstr "" + +#: ../../howto/free-threading-python.rst:109 +msgid "" +":ref:`function ` objects declared at the module level" +msgstr "" + +#: ../../howto/free-threading-python.rst:110 +msgid ":ref:`method ` descriptors" +msgstr "" + +#: ../../howto/free-threading-python.rst:111 +msgid ":ref:`code ` objects" +msgstr "" + +#: ../../howto/free-threading-python.rst:112 +msgid ":term:`module` objects and their dictionaries" +msgstr "" + +#: ../../howto/free-threading-python.rst:113 +msgid ":ref:`classes ` (type objects)" +msgstr "" + +#: ../../howto/free-threading-python.rst:115 +msgid "" +"Because immortal objects are never deallocated, applications that create " +"many objects of these types may see increased memory usage. This is " +"expected to be addressed in the 3.14 release." +msgstr "" + +#: ../../howto/free-threading-python.rst:119 +msgid "" +"Additionally, numeric and string literals in the code as well as strings " +"returned by :func:`sys.intern` are also immortalized. This behavior is " +"expected to remain in the 3.14 free-threaded build." +msgstr "" + +#: ../../howto/free-threading-python.rst:125 +msgid "Frame objects" +msgstr "" + +#: ../../howto/free-threading-python.rst:127 +msgid "" +"It is not safe to access :ref:`frame ` objects from other " +"threads and doing so may cause your program to crash . This means that :" +"func:`sys._current_frames` is generally not safe to use in a free-threaded " +"build. Functions like :func:`inspect.currentframe` and :func:`sys." +"_getframe` are generally safe as long as the resulting frame object is not " +"passed to another thread." +msgstr "" + +#: ../../howto/free-threading-python.rst:135 +msgid "Iterators" +msgstr "" + +#: ../../howto/free-threading-python.rst:137 +msgid "" +"Sharing the same iterator object between multiple threads is generally not " +"safe and threads may see duplicate or missing elements when iterating or " +"crash the interpreter." +msgstr "" + +#: ../../howto/free-threading-python.rst:143 +msgid "Single-threaded performance" +msgstr "" + +#: ../../howto/free-threading-python.rst:145 +msgid "" +"The free-threaded build has additional overhead when executing Python code " +"compared to the default GIL-enabled build. In 3.13, this overhead is about " +"40% on the `pyperformance `_ suite. " +"Programs that spend most of their time in C extensions or I/O will see less " +"of an impact. The largest impact is because the specializing adaptive " +"interpreter (:pep:`659`) is disabled in the free-threaded build. We expect " +"to re-enable it in a thread-safe way in the 3.14 release. This overhead is " +"expected to be reduced in upcoming Python release. We are aiming for an " +"overhead of 10% or less on the pyperformance suite compared to the default " +"GIL-enabled build." +msgstr "" diff --git a/howto/index.po b/howto/index.po index da80089a8f..d2b94700c4 100644 --- a/howto/index.po +++ b/howto/index.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-04 00:13+0000\n" "PO-Revision-Date: 2021-07-05 12:45+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,116 +25,116 @@ msgid "Python HOWTOs" msgstr "Python 如何達成任務" #: ../../howto/index.rst:5 -#, fuzzy msgid "" "Python HOWTOs are documents that cover a specific topic in-depth. Modeled on " "the Linux Documentation Project's HOWTO collection, this collection is an " "effort to foster documentation that's more detailed than the Python Library " "Reference." msgstr "" -"「Python 如何達成任務 (HOWTOs)」是一系列的說明文件,其內容會盡量完整地涵蓋某" -"些單一、特定的主題。以 Linux 說明文件專案的 HOWTO 系列為模範,本系列的目標是" -"提供比 Python 函式庫參考手冊更實用的說明文件。" +"「Python 如何達成任務 (HOWTOs)」是一系列的說明文件,其內容會深度地涵蓋某些特" +"定的主題。以 Linux 說明文件專案的 HOWTO 系列為模範,本系列的目標是提供比 " +"Python 函式庫參考手冊更實用的說明文件。" -#: ../../howto/index.rst:37 +#: ../../howto/index.rst:38 msgid "General:" msgstr "" -#: ../../howto/index.rst:39 +#: ../../howto/index.rst:40 msgid ":ref:`annotations-howto`" msgstr ":ref:`annotations-howto`" -#: ../../howto/index.rst:40 +#: ../../howto/index.rst:41 msgid ":ref:`argparse-tutorial`" msgstr ":ref:`argparse-tutorial`" -#: ../../howto/index.rst:41 +#: ../../howto/index.rst:42 msgid ":ref:`descriptorhowto`" msgstr ":ref:`descriptorhowto`" -#: ../../howto/index.rst:42 +#: ../../howto/index.rst:43 msgid ":ref:`enum-howto`" msgstr ":ref:`enum-howto`" -#: ../../howto/index.rst:43 +#: ../../howto/index.rst:44 msgid ":ref:`functional-howto`" msgstr ":ref:`functional-howto`" -#: ../../howto/index.rst:44 +#: ../../howto/index.rst:45 msgid ":ref:`ipaddress-howto`" msgstr ":ref:`ipaddress-howto`" -#: ../../howto/index.rst:45 +#: ../../howto/index.rst:46 msgid ":ref:`logging-howto`" msgstr ":ref:`logging-howto`" -#: ../../howto/index.rst:46 +#: ../../howto/index.rst:47 msgid ":ref:`logging-cookbook`" msgstr ":ref:`logging-cookbook`" -#: ../../howto/index.rst:47 +#: ../../howto/index.rst:48 msgid ":ref:`regex-howto`" msgstr ":ref:`regex-howto`" -#: ../../howto/index.rst:48 +#: ../../howto/index.rst:49 msgid ":ref:`sortinghowto`" msgstr ":ref:`sortinghowto`" -#: ../../howto/index.rst:49 +#: ../../howto/index.rst:50 msgid ":ref:`unicode-howto`" msgstr ":ref:`unicode-howto`" -#: ../../howto/index.rst:50 +#: ../../howto/index.rst:51 msgid ":ref:`urllib-howto`" msgstr ":ref:`urllib-howto`" -#: ../../howto/index.rst:52 +#: ../../howto/index.rst:53 msgid "Advanced development:" msgstr "" -#: ../../howto/index.rst:54 +#: ../../howto/index.rst:55 msgid ":ref:`curses-howto`" msgstr ":ref:`curses-howto`" -#: ../../howto/index.rst:55 +#: ../../howto/index.rst:56 +msgid ":ref:`freethreading-python-howto`" +msgstr ":ref:`freethreading-python-howto`" + +#: ../../howto/index.rst:57 msgid ":ref:`freethreading-extensions-howto`" msgstr ":ref:`freethreading-extensions-howto`" -#: ../../howto/index.rst:56 +#: ../../howto/index.rst:58 msgid ":ref:`isolating-extensions-howto`" msgstr ":ref:`isolating-extensions-howto`" -#: ../../howto/index.rst:57 +#: ../../howto/index.rst:59 msgid ":ref:`python_2.3_mro`" msgstr ":ref:`python_2.3_mro`" -#: ../../howto/index.rst:58 +#: ../../howto/index.rst:60 msgid ":ref:`socket-howto`" msgstr ":ref:`socket-howto`" -#: ../../howto/index.rst:59 +#: ../../howto/index.rst:61 msgid ":ref:`timerfd-howto`" msgstr ":ref:`timerfd-howto`" -#: ../../howto/index.rst:60 +#: ../../howto/index.rst:62 msgid ":ref:`cporting-howto`" msgstr ":ref:`cporting-howto`" -#: ../../howto/index.rst:62 +#: ../../howto/index.rst:64 msgid "Debugging and profiling:" msgstr "" -#: ../../howto/index.rst:64 +#: ../../howto/index.rst:66 msgid ":ref:`gdb`" msgstr ":ref:`gdb`" -#: ../../howto/index.rst:65 +#: ../../howto/index.rst:67 msgid ":ref:`instrumentation`" msgstr ":ref:`instrumentation`" -#: ../../howto/index.rst:66 +#: ../../howto/index.rst:68 msgid ":ref:`perf_profiling`" msgstr ":ref:`perf_profiling`" - -#~ msgid "Currently, the HOWTOs are:" -#~ msgstr "目前有以下這些任務指南:" diff --git a/howto/mro.po b/howto/mro.po index 816adb559d..ac73681c25 100644 --- a/howto/mro.po +++ b/howto/mro.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -527,7 +527,7 @@ msgstr "" msgid "" "A lazy programmer can obtain the MRO directly from Python 2.2, since in this " "case it coincides with the Python 2.3 linearization. It is enough to invoke " -"the .mro() method of class A:" +"the :meth:`~type.mro` method of class A:" msgstr "" #: ../../howto/mro.rst:345 diff --git a/library/abc.po b/library/abc.po index e6231cfde5..5d5dde6b3b 100644 --- a/library/abc.po +++ b/library/abc.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2022-11-16 03:29+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -187,12 +187,12 @@ msgid "" "Check whether *subclass* is considered a subclass of this ABC. This means " "that you can customize the behavior of :func:`issubclass` further without " "the need to call :meth:`register` on every class you want to consider a " -"subclass of the ABC. (This class method is called from the :meth:`~class." +"subclass of the ABC. (This class method is called from the :meth:`~type." "__subclasscheck__` method of the ABC.)" msgstr "" "檢查 *subclass* 是否該被認為是該 ABC 的子類別,也就是說你可以直接自訂 :func:" "`issubclass` 的行為,而不用對於那些你希望定義為該 ABC 的子類別的類別都個別呼" -"叫 :meth:`register` 方法。(這個類別方法是在 ABC 的 :meth:`~class." +"叫 :meth:`register` 方法。(這個類別方法是在 ABC 的 :meth:`~type." "__subclasscheck__` 方法中呼叫。)" #: ../../library/abc.rst:104 @@ -286,11 +286,11 @@ msgid "" "The :meth:`__subclasshook__` class method defined here says that any class " "that has an :meth:`~iterator.__iter__` method in its :attr:`~object." "__dict__` (or in that of one of its base classes, accessed via the :attr:" -"`~class.__mro__` list) is considered a ``MyIterable`` too." +"`~type.__mro__` list) is considered a ``MyIterable`` too." msgstr "" "這裡定義的 :meth:`__subclasshook__` 類別方法說明任何在其 :attr:`~object." -"__dict__` (或在其透過 :attr:`~class.__mro__` 列表訪問的基底類別) 中具有 :" -"meth:`~iterator.__iter__` 方法的類別也都會被視為 ``MyIterable``。" +"__dict__` (或在其透過 :attr:`~type.__mro__` 列表訪問的基底類別) 中具有 :meth:" +"`~iterator.__iter__` 方法的類別也都會被視為 ``MyIterable``。" #: ../../library/abc.rst:154 msgid "" diff --git a/library/argparse.po b/library/argparse.po index 8c2959c432..958fbaa23f 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -514,7 +514,7 @@ msgstr "" msgid "*exit_on_error* parameter was added." msgstr "新增 *exit_on_error* 參數。" -#: ../../library/argparse.rst:244 ../../library/argparse.rst:782 +#: ../../library/argparse.rst:244 ../../library/argparse.rst:783 msgid "The following sections describe how each of these are used." msgstr "" @@ -524,14 +524,15 @@ msgstr "" #: ../../library/argparse.rst:252 msgid "" -"By default, :class:`ArgumentParser` objects use ``sys.argv[0]`` to determine " -"how to display the name of the program in help messages. This default is " -"almost always desirable because it will make the help messages match how the " -"program was invoked on the command line. For example, consider a file named " +"By default, :class:`ArgumentParser` objects use the base name (see :func:`os." +"path.basename`) of ``sys.argv[0]`` to determine how to display the name of " +"the program in help messages. This default is almost always desirable " +"because it will make the help messages match the name that was used to " +"invoke the program on the command line. For example, consider a file named " "``myprogram.py`` with the following code::" msgstr "" -#: ../../library/argparse.rst:258 ../../library/argparse.rst:678 +#: ../../library/argparse.rst:259 ../../library/argparse.rst:679 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -543,13 +544,13 @@ msgstr "" "parser.add_argument('--foo', help='foo help')\n" "args = parser.parse_args()" -#: ../../library/argparse.rst:263 +#: ../../library/argparse.rst:264 msgid "" "The help for this program will display ``myprogram.py`` as the program name " "(regardless of where the program was invoked from):" msgstr "" -#: ../../library/argparse.rst:266 +#: ../../library/argparse.rst:267 msgid "" "$ python myprogram.py --help\n" "usage: myprogram.py [-h] [--foo FOO]\n" @@ -579,13 +580,13 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO foo help" -#: ../../library/argparse.rst:282 +#: ../../library/argparse.rst:283 msgid "" "To change this default behavior, another value can be supplied using the " "``prog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:285 +#: ../../library/argparse.rst:286 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.print_help()\n" @@ -601,14 +602,14 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:292 +#: ../../library/argparse.rst:293 msgid "" "Note that the program name, whether determined from ``sys.argv[0]`` or from " "the ``prog=`` argument, is available to help messages using the ``%(prog)s`` " "format specifier." msgstr "" -#: ../../library/argparse.rst:298 +#: ../../library/argparse.rst:299 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.add_argument('--foo', help='foo of the %(prog)s program')\n" @@ -628,17 +629,17 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO foo of the myprogram program" -#: ../../library/argparse.rst:309 +#: ../../library/argparse.rst:310 msgid "usage" msgstr "" -#: ../../library/argparse.rst:311 +#: ../../library/argparse.rst:312 msgid "" "By default, :class:`ArgumentParser` calculates the usage message from the " "arguments it contains::" msgstr "" -#: ../../library/argparse.rst:314 +#: ../../library/argparse.rst:315 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', nargs='?', help='foo help')\n" @@ -666,12 +667,12 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo [FOO] foo help" -#: ../../library/argparse.rst:327 +#: ../../library/argparse.rst:328 msgid "" "The default message can be overridden with the ``usage=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:329 +#: ../../library/argparse.rst:330 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s " "[options]')\n" @@ -701,17 +702,17 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo [FOO] foo help" -#: ../../library/argparse.rst:342 +#: ../../library/argparse.rst:343 msgid "" "The ``%(prog)s`` format specifier is available to fill in the program name " "in your usage messages." msgstr "" -#: ../../library/argparse.rst:349 +#: ../../library/argparse.rst:350 msgid "description" msgstr "描述" -#: ../../library/argparse.rst:351 +#: ../../library/argparse.rst:352 msgid "" "Most calls to the :class:`ArgumentParser` constructor will use the " "``description=`` keyword argument. This argument gives a brief description " @@ -720,7 +721,7 @@ msgid "" "messages for the various arguments::" msgstr "" -#: ../../library/argparse.rst:357 +#: ../../library/argparse.rst:358 msgid "" ">>> parser = argparse.ArgumentParser(description='A foo that bars')\n" ">>> parser.print_help()\n" @@ -740,24 +741,24 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:366 +#: ../../library/argparse.rst:367 msgid "" "By default, the description will be line-wrapped so that it fits within the " "given space. To change this behavior, see the formatter_class_ argument." msgstr "" -#: ../../library/argparse.rst:371 +#: ../../library/argparse.rst:372 msgid "epilog" msgstr "" -#: ../../library/argparse.rst:373 +#: ../../library/argparse.rst:374 msgid "" "Some programs like to display additional description of the program after " "the description of the arguments. Such text can be specified using the " "``epilog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:377 +#: ../../library/argparse.rst:378 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... description='A foo that bars',\n" @@ -785,18 +786,18 @@ msgstr "" "\n" "And that's how you'd foo a bar" -#: ../../library/argparse.rst:390 +#: ../../library/argparse.rst:391 msgid "" "As with the description_ argument, the ``epilog=`` text is by default line-" "wrapped, but this behavior can be adjusted with the formatter_class_ " "argument to :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:396 +#: ../../library/argparse.rst:397 msgid "parents" msgstr "" -#: ../../library/argparse.rst:398 +#: ../../library/argparse.rst:399 msgid "" "Sometimes, several parsers share a common set of arguments. Rather than " "repeating the definitions of these arguments, a single parser with all the " @@ -807,7 +808,7 @@ msgid "" "object being constructed::" msgstr "" -#: ../../library/argparse.rst:405 +#: ../../library/argparse.rst:406 msgid "" ">>> parent_parser = argparse.ArgumentParser(add_help=False)\n" ">>> parent_parser.add_argument('--parent', type=int)\n" @@ -835,32 +836,32 @@ msgstr "" ">>> bar_parser.parse_args(['--bar', 'YYY'])\n" "Namespace(bar='YYY', parent=None)" -#: ../../library/argparse.rst:418 +#: ../../library/argparse.rst:419 msgid "" "Note that most parent parsers will specify ``add_help=False``. Otherwise, " "the :class:`ArgumentParser` will see two ``-h/--help`` options (one in the " "parent and one in the child) and raise an error." msgstr "" -#: ../../library/argparse.rst:423 +#: ../../library/argparse.rst:424 msgid "" "You must fully initialize the parsers before passing them via ``parents=``. " "If you change the parent parsers after the child parser, those changes will " "not be reflected in the child." msgstr "" -#: ../../library/argparse.rst:431 +#: ../../library/argparse.rst:432 msgid "formatter_class" msgstr "formatter_class" -#: ../../library/argparse.rst:433 +#: ../../library/argparse.rst:434 msgid "" ":class:`ArgumentParser` objects allow the help formatting to be customized " "by specifying an alternate formatting class. Currently, there are four such " "classes:" msgstr "" -#: ../../library/argparse.rst:442 +#: ../../library/argparse.rst:443 msgid "" ":class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give " "more control over how textual descriptions are displayed. By default, :class:" @@ -868,7 +869,7 @@ msgid "" "command-line help messages::" msgstr "" -#: ../../library/argparse.rst:447 +#: ../../library/argparse.rst:448 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -892,14 +893,14 @@ msgid "" "will be wrapped across a couple lines" msgstr "" -#: ../../library/argparse.rst:467 +#: ../../library/argparse.rst:468 msgid "" "Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` " "indicates that description_ and epilog_ are already correctly formatted and " "should not be line-wrapped::" msgstr "" -#: ../../library/argparse.rst:471 +#: ../../library/argparse.rst:472 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -924,7 +925,7 @@ msgid "" " -h, --help show this help message and exit" msgstr "" -#: ../../library/argparse.rst:493 +#: ../../library/argparse.rst:494 msgid "" ":class:`RawTextHelpFormatter` maintains whitespace for all sorts of help " "text, including argument descriptions. However, multiple new lines are " @@ -932,13 +933,13 @@ msgid "" "between the newlines." msgstr "" -#: ../../library/argparse.rst:498 +#: ../../library/argparse.rst:499 msgid "" ":class:`ArgumentDefaultsHelpFormatter` automatically adds information about " "default values to each of the argument help messages::" msgstr "" -#: ../../library/argparse.rst:501 +#: ../../library/argparse.rst:502 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -970,14 +971,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO FOO! (default: 42)" -#: ../../library/argparse.rst:516 +#: ../../library/argparse.rst:517 msgid "" ":class:`MetavarTypeHelpFormatter` uses the name of the type_ argument for " "each argument as the display name for its values (rather than using the " "dest_ as the regular formatter does)::" msgstr "" -#: ../../library/argparse.rst:520 +#: ../../library/argparse.rst:521 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -1009,11 +1010,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo int" -#: ../../library/argparse.rst:537 +#: ../../library/argparse.rst:538 msgid "prefix_chars" msgstr "prefix_chars" -#: ../../library/argparse.rst:539 +#: ../../library/argparse.rst:540 msgid "" "Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. " "Parsers that need to support different or additional prefix characters, e.g. " @@ -1021,7 +1022,7 @@ msgid "" "``prefix_chars=`` argument to the ArgumentParser constructor::" msgstr "" -#: ../../library/argparse.rst:545 +#: ../../library/argparse.rst:546 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')\n" ">>> parser.add_argument('+f')\n" @@ -1035,18 +1036,18 @@ msgstr "" ">>> parser.parse_args('+f X ++bar Y'.split())\n" "Namespace(bar='Y', f='X')" -#: ../../library/argparse.rst:551 +#: ../../library/argparse.rst:552 msgid "" "The ``prefix_chars=`` argument defaults to ``'-'``. Supplying a set of " "characters that does not include ``-`` will cause ``-f/--foo`` options to be " "disallowed." msgstr "" -#: ../../library/argparse.rst:557 +#: ../../library/argparse.rst:558 msgid "fromfile_prefix_chars" msgstr "fromfile_prefix_chars" -#: ../../library/argparse.rst:559 +#: ../../library/argparse.rst:560 msgid "" "Sometimes, when dealing with a particularly long argument list, it may make " "sense to keep the list of arguments in a file rather than typing it out at " @@ -1056,7 +1057,7 @@ msgid "" "by the arguments they contain. For example::" msgstr "" -#: ../../library/argparse.rst:566 +#: ../../library/argparse.rst:567 msgid "" ">>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:\n" "... fp.write('-f\\nbar')\n" @@ -1074,7 +1075,7 @@ msgstr "" ">>> parser.parse_args(['-f', 'foo', '@args.txt'])\n" "Namespace(f='bar')" -#: ../../library/argparse.rst:574 +#: ../../library/argparse.rst:575 msgid "" "Arguments read from a file must by default be one per line (but see also :" "meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they " @@ -1084,19 +1085,19 @@ msgid "" "f', 'bar']``." msgstr "" -#: ../../library/argparse.rst:580 +#: ../../library/argparse.rst:581 msgid "" ":class:`ArgumentParser` uses :term:`filesystem encoding and error handler` " "to read the file containing arguments." msgstr "" -#: ../../library/argparse.rst:583 +#: ../../library/argparse.rst:584 msgid "" "The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that " "arguments will never be treated as file references." msgstr "" -#: ../../library/argparse.rst:586 +#: ../../library/argparse.rst:587 msgid "" ":class:`ArgumentParser` changed encoding and errors to read arguments files " "from default (e.g. :func:`locale.getpreferredencoding(False) >> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)\n" ">>> parser.add_argument('--foo')\n" @@ -1139,22 +1140,22 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace()" -#: ../../library/argparse.rst:616 +#: ../../library/argparse.rst:617 msgid "allow_abbrev" msgstr "allow_abbrev" -#: ../../library/argparse.rst:618 +#: ../../library/argparse.rst:619 msgid "" "Normally, when you pass an argument list to the :meth:`~ArgumentParser." "parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes " "abbreviations ` of long options." msgstr "" -#: ../../library/argparse.rst:622 +#: ../../library/argparse.rst:623 msgid "This feature can be disabled by setting ``allow_abbrev`` to ``False``::" msgstr "" -#: ../../library/argparse.rst:624 +#: ../../library/argparse.rst:625 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False)\n" ">>> parser.add_argument('--foobar', action='http://github.com/store_true')\n" @@ -1170,11 +1171,11 @@ msgstr "" "usage: PROG [-h] [--foobar] [--foonley]\n" "PROG: error: unrecognized arguments: --foon" -#: ../../library/argparse.rst:635 +#: ../../library/argparse.rst:636 msgid "conflict_handler" msgstr "conflict_handler" -#: ../../library/argparse.rst:637 +#: ../../library/argparse.rst:638 msgid "" ":class:`ArgumentParser` objects do not allow two actions with the same " "option string. By default, :class:`ArgumentParser` objects raise an " @@ -1182,7 +1183,7 @@ msgid "" "that is already in use::" msgstr "" -#: ../../library/argparse.rst:642 +#: ../../library/argparse.rst:643 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo', help='old foo help')\n" @@ -1198,7 +1199,7 @@ msgstr "" " ..\n" "ArgumentError: argument --foo: conflicting option string(s): --foo" -#: ../../library/argparse.rst:649 +#: ../../library/argparse.rst:650 msgid "" "Sometimes (e.g. when using parents_) it may be useful to simply override any " "older arguments with the same option string. To get this behavior, the " @@ -1206,7 +1207,7 @@ msgid "" "of :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:654 +#: ../../library/argparse.rst:655 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', " "conflict_handler='resolve')\n" @@ -1232,7 +1233,7 @@ msgstr "" " -f FOO old foo help\n" " --foo FOO new foo help" -#: ../../library/argparse.rst:665 +#: ../../library/argparse.rst:666 msgid "" "Note that :class:`ArgumentParser` objects only remove an action if all of " "its option strings are overridden. So, in the example above, the old ``-f/--" @@ -1240,24 +1241,24 @@ msgid "" "option string was overridden." msgstr "" -#: ../../library/argparse.rst:672 +#: ../../library/argparse.rst:673 msgid "add_help" msgstr "add_help" -#: ../../library/argparse.rst:674 +#: ../../library/argparse.rst:675 msgid "" "By default, ArgumentParser objects add an option which simply displays the " "parser's help message. For example, consider a file named ``myprogram.py`` " "containing the following code::" msgstr "" -#: ../../library/argparse.rst:683 +#: ../../library/argparse.rst:684 msgid "" "If ``-h`` or ``--help`` is supplied at the command line, the ArgumentParser " "help will be printed:" msgstr "" -#: ../../library/argparse.rst:686 +#: ../../library/argparse.rst:687 msgid "" "$ python myprogram.py --help\n" "usage: myprogram.py [-h] [--foo FOO]\n" @@ -1273,14 +1274,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO foo help" -#: ../../library/argparse.rst:695 +#: ../../library/argparse.rst:696 msgid "" "Occasionally, it may be useful to disable the addition of this help option. " "This can be achieved by passing ``False`` as the ``add_help=`` argument to :" "class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:699 +#: ../../library/argparse.rst:700 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> parser.add_argument('--foo', help='foo help')\n" @@ -1298,7 +1299,7 @@ msgstr "" "options:\n" " --foo FOO foo help" -#: ../../library/argparse.rst:707 +#: ../../library/argparse.rst:708 msgid "" "The help option is typically ``-h/--help``. The exception to this is if the " "``prefix_chars=`` is specified and does not include ``-``, in which case ``-" @@ -1306,7 +1307,7 @@ msgid "" "in ``prefix_chars`` is used to prefix the help options::" msgstr "" -#: ../../library/argparse.rst:713 +#: ../../library/argparse.rst:714 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')\n" ">>> parser.print_help()\n" @@ -1322,24 +1323,24 @@ msgstr "" "options:\n" " +h, ++help show this help message and exit" -#: ../../library/argparse.rst:722 +#: ../../library/argparse.rst:723 msgid "exit_on_error" msgstr "exit_on_error" -#: ../../library/argparse.rst:724 +#: ../../library/argparse.rst:725 msgid "" "Normally, when you pass an invalid argument list to the :meth:" "`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will " "exit with error info." msgstr "" -#: ../../library/argparse.rst:727 +#: ../../library/argparse.rst:728 msgid "" "If the user would like to catch errors manually, the feature can be enabled " "by setting ``exit_on_error`` to ``False``::" msgstr "" -#: ../../library/argparse.rst:730 +#: ../../library/argparse.rst:731 msgid "" ">>> parser = argparse.ArgumentParser(exit_on_error=False)\n" ">>> parser.add_argument('--integers', type=int)\n" @@ -1365,81 +1366,81 @@ msgstr "" "...\n" "Catching an argumentError" -#: ../../library/argparse.rst:744 +#: ../../library/argparse.rst:745 msgid "The add_argument() method" msgstr "" -#: ../../library/argparse.rst:750 +#: ../../library/argparse.rst:751 msgid "" "Define how a single command-line argument should be parsed. Each parameter " "has its own more detailed description below, but in short they are:" msgstr "" -#: ../../library/argparse.rst:753 +#: ../../library/argparse.rst:754 msgid "" "`name or flags`_ - Either a name or a list of option strings, e.g. ``foo`` " "or ``-f, --foo``." msgstr "" -#: ../../library/argparse.rst:756 +#: ../../library/argparse.rst:757 msgid "" "action_ - The basic type of action to be taken when this argument is " "encountered at the command line." msgstr "" -#: ../../library/argparse.rst:759 +#: ../../library/argparse.rst:760 msgid "nargs_ - The number of command-line arguments that should be consumed." msgstr "" -#: ../../library/argparse.rst:761 +#: ../../library/argparse.rst:762 msgid "" "const_ - A constant value required by some action_ and nargs_ selections." msgstr "" -#: ../../library/argparse.rst:763 +#: ../../library/argparse.rst:764 msgid "" "default_ - The value produced if the argument is absent from the command " "line and if it is absent from the namespace object." msgstr "" -#: ../../library/argparse.rst:766 +#: ../../library/argparse.rst:767 msgid "" "type_ - The type to which the command-line argument should be converted." msgstr "" -#: ../../library/argparse.rst:768 +#: ../../library/argparse.rst:769 msgid "choices_ - A sequence of the allowable values for the argument." msgstr "" -#: ../../library/argparse.rst:770 +#: ../../library/argparse.rst:771 msgid "" "required_ - Whether or not the command-line option may be omitted (optionals " "only)." msgstr "" -#: ../../library/argparse.rst:773 +#: ../../library/argparse.rst:774 msgid "help_ - A brief description of what the argument does." msgstr "" -#: ../../library/argparse.rst:775 +#: ../../library/argparse.rst:776 msgid "metavar_ - A name for the argument in usage messages." msgstr "" -#: ../../library/argparse.rst:777 +#: ../../library/argparse.rst:778 msgid "" "dest_ - The name of the attribute to be added to the object returned by :" "meth:`parse_args`." msgstr "" -#: ../../library/argparse.rst:780 +#: ../../library/argparse.rst:781 msgid "deprecated_ - Whether or not use of the argument is deprecated." msgstr "" -#: ../../library/argparse.rst:788 +#: ../../library/argparse.rst:789 msgid "name or flags" msgstr "" -#: ../../library/argparse.rst:790 +#: ../../library/argparse.rst:791 msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " @@ -1448,30 +1449,30 @@ msgid "" "or a simple argument name." msgstr "" -#: ../../library/argparse.rst:796 +#: ../../library/argparse.rst:797 msgid "For example, an optional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:798 +#: ../../library/argparse.rst:799 msgid ">>> parser.add_argument('-f', '--foo')" msgstr ">>> parser.add_argument('-f', '--foo')" -#: ../../library/argparse.rst:800 +#: ../../library/argparse.rst:801 msgid "while a positional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:802 +#: ../../library/argparse.rst:803 msgid ">>> parser.add_argument('bar')" msgstr ">>> parser.add_argument('bar')" -#: ../../library/argparse.rst:804 +#: ../../library/argparse.rst:805 msgid "" "When :meth:`~ArgumentParser.parse_args` is called, optional arguments will " "be identified by the ``-`` prefix, and the remaining arguments will be " "assumed to be positional::" msgstr "" -#: ../../library/argparse.rst:808 +#: ../../library/argparse.rst:809 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo')\n" @@ -1495,11 +1496,11 @@ msgstr "" "usage: PROG [-h] [-f FOO] bar\n" "PROG: error: the following arguments are required: bar" -#: ../../library/argparse.rst:823 +#: ../../library/argparse.rst:824 msgid "action" msgstr "" -#: ../../library/argparse.rst:825 +#: ../../library/argparse.rst:826 msgid "" ":class:`ArgumentParser` objects associate command-line arguments with " "actions. These actions can do just about anything with the command-line " @@ -1509,13 +1510,13 @@ msgid "" "be handled. The supplied actions are:" msgstr "" -#: ../../library/argparse.rst:831 +#: ../../library/argparse.rst:832 msgid "" "``'store'`` - This just stores the argument's value. This is the default " "action. For example::" msgstr "" -#: ../../library/argparse.rst:834 +#: ../../library/argparse.rst:835 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -1527,7 +1528,7 @@ msgstr "" ">>> parser.parse_args('--foo 1'.split())\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:839 +#: ../../library/argparse.rst:840 msgid "" "``'store_const'`` - This stores the value specified by the const_ keyword " "argument; note that the const_ keyword argument defaults to ``None``. The " @@ -1535,7 +1536,7 @@ msgid "" "specify some sort of flag. For example::" msgstr "" -#: ../../library/argparse.rst:844 +#: ../../library/argparse.rst:845 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/store_const', const=42)\n" @@ -1547,7 +1548,7 @@ msgstr "" ">>> parser.parse_args(['--foo'])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:849 +#: ../../library/argparse.rst:850 msgid "" "``'store_true'`` and ``'store_false'`` - These are special cases of " "``'store_const'`` used for storing the values ``True`` and ``False`` " @@ -1555,7 +1556,7 @@ msgid "" "``True`` respectively. For example::" msgstr "" -#: ../../library/argparse.rst:854 +#: ../../library/argparse.rst:855 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/store_true')\n" @@ -1571,7 +1572,7 @@ msgstr "" ">>> parser.parse_args('--foo --bar'.split())\n" "Namespace(foo=True, bar=False, baz=True)" -#: ../../library/argparse.rst:861 +#: ../../library/argparse.rst:862 msgid "" "``'append'`` - This stores a list, and appends each argument value to the " "list. It is useful to allow an option to be specified multiple times. If the " @@ -1580,7 +1581,7 @@ msgid "" "after those default values. Example usage::" msgstr "" -#: ../../library/argparse.rst:867 +#: ../../library/argparse.rst:868 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/append')\n" @@ -1592,7 +1593,7 @@ msgstr "" ">>> parser.parse_args('--foo 1 --foo 2'.split())\n" "Namespace(foo=['1', '2'])" -#: ../../library/argparse.rst:872 +#: ../../library/argparse.rst:873 msgid "" "``'append_const'`` - This stores a list, and appends the value specified by " "the const_ keyword argument to the list; note that the const_ keyword " @@ -1601,7 +1602,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:878 +#: ../../library/argparse.rst:879 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--str', dest='types', action='http://github.com/append_const', " @@ -1619,13 +1620,13 @@ msgstr "" ">>> parser.parse_args('--str --int'.split())\n" "Namespace(types=[, ])" -#: ../../library/argparse.rst:884 +#: ../../library/argparse.rst:885 msgid "" "``'count'`` - This counts the number of times a keyword argument occurs. For " "example, this is useful for increasing verbosity levels::" msgstr "" -#: ../../library/argparse.rst:887 +#: ../../library/argparse.rst:888 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--verbose', '-v', action='http://github.com/count', default=0)\n" @@ -1633,11 +1634,11 @@ msgid "" "Namespace(verbose=3)" msgstr "" -#: ../../library/argparse.rst:892 +#: ../../library/argparse.rst:893 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." msgstr "" -#: ../../library/argparse.rst:894 +#: ../../library/argparse.rst:895 msgid "" "``'help'`` - This prints a complete help message for all the options in the " "current parser and then exits. By default a help action is automatically " @@ -1645,14 +1646,14 @@ msgid "" "output is created." msgstr "" -#: ../../library/argparse.rst:899 +#: ../../library/argparse.rst:900 msgid "" "``'version'`` - This expects a ``version=`` keyword argument in the :meth:" "`~ArgumentParser.add_argument` call, and prints version information and " "exits when invoked::" msgstr "" -#: ../../library/argparse.rst:903 +#: ../../library/argparse.rst:904 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -1668,13 +1669,13 @@ msgstr "" ">>> parser.parse_args(['--version'])\n" "PROG 2.0" -#: ../../library/argparse.rst:909 +#: ../../library/argparse.rst:910 msgid "" "``'extend'`` - This stores a list, and extends each argument value to the " "list. Example usage::" msgstr "" -#: ../../library/argparse.rst:913 +#: ../../library/argparse.rst:914 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " @@ -1690,7 +1691,7 @@ msgstr "" "\"f4\"])\n" "Namespace(foo=['f1', 'f2', 'f3', 'f4'])" -#: ../../library/argparse.rst:920 +#: ../../library/argparse.rst:921 msgid "" "You may also specify an arbitrary action by passing an Action subclass or " "other object that implements the same interface. The " @@ -1698,7 +1699,7 @@ msgid "" "boolean actions such as ``--foo`` and ``--no-foo``::" msgstr "" -#: ../../library/argparse.rst:925 +#: ../../library/argparse.rst:926 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -1712,18 +1713,18 @@ msgstr "" ">>> parser.parse_args(['--no-foo'])\n" "Namespace(foo=False)" -#: ../../library/argparse.rst:933 +#: ../../library/argparse.rst:934 msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " "overriding the ``__call__`` method and optionally the ``__init__`` and " "``format_usage`` methods." msgstr "" -#: ../../library/argparse.rst:937 +#: ../../library/argparse.rst:938 msgid "An example of a custom action::" msgstr "" -#: ../../library/argparse.rst:939 +#: ../../library/argparse.rst:940 msgid "" ">>> class FooAction(argparse.Action):\n" "... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" @@ -1744,15 +1745,15 @@ msgid "" "Namespace(bar='1', foo='2')" msgstr "" -#: ../../library/argparse.rst:957 +#: ../../library/argparse.rst:958 msgid "For more details, see :class:`Action`." msgstr "" -#: ../../library/argparse.rst:963 +#: ../../library/argparse.rst:964 msgid "nargs" msgstr "" -#: ../../library/argparse.rst:965 +#: ../../library/argparse.rst:966 msgid "" "ArgumentParser objects usually associate a single command-line argument with " "a single action to be taken. The ``nargs`` keyword argument associates a " @@ -1760,13 +1761,13 @@ msgid "" "ref:`specifying-ambiguous-arguments`. The supported values are:" msgstr "" -#: ../../library/argparse.rst:970 +#: ../../library/argparse.rst:971 msgid "" "``N`` (an integer). ``N`` arguments from the command line will be gathered " "together into a list. For example::" msgstr "" -#: ../../library/argparse.rst:973 +#: ../../library/argparse.rst:974 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs=2)\n" @@ -1780,13 +1781,13 @@ msgstr "" ">>> parser.parse_args('c --foo a b'.split())\n" "Namespace(bar=['c'], foo=['a', 'b'])" -#: ../../library/argparse.rst:979 +#: ../../library/argparse.rst:980 msgid "" "Note that ``nargs=1`` produces a list of one item. This is different from " "the default, in which the item is produced by itself." msgstr "" -#: ../../library/argparse.rst:984 +#: ../../library/argparse.rst:985 msgid "" "``'?'``. One argument will be consumed from the command line if possible, " "and produced as a single item. If no command-line argument is present, the " @@ -1796,7 +1797,7 @@ msgid "" "produced. Some examples to illustrate this::" msgstr "" -#: ../../library/argparse.rst:991 +#: ../../library/argparse.rst:992 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" @@ -1818,13 +1819,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(bar='d', foo='d')" -#: ../../library/argparse.rst:1001 +#: ../../library/argparse.rst:1002 msgid "" "One of the more common uses of ``nargs='?'`` is to allow optional input and " "output files::" msgstr "" -#: ../../library/argparse.rst:1004 +#: ../../library/argparse.rst:1005 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', nargs='?', type=argparse.FileType('r'),\n" @@ -1850,7 +1851,7 @@ msgstr "" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>,\n" " outfile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1018 +#: ../../library/argparse.rst:1019 msgid "" "``'*'``. All command-line arguments present are gathered into a list. Note " "that it generally doesn't make much sense to have more than one positional " @@ -1858,7 +1859,7 @@ msgid "" "``nargs='*'`` is possible. For example::" msgstr "" -#: ../../library/argparse.rst:1023 +#: ../../library/argparse.rst:1024 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='*')\n" @@ -1874,14 +1875,14 @@ msgstr "" ">>> parser.parse_args('a b --foo x y --bar 1 2'.split())\n" "Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])" -#: ../../library/argparse.rst:1032 +#: ../../library/argparse.rst:1033 msgid "" "``'+'``. Just like ``'*'``, all command-line args present are gathered into " "a list. Additionally, an error message will be generated if there wasn't at " "least one command-line argument present. For example::" msgstr "" -#: ../../library/argparse.rst:1036 +#: ../../library/argparse.rst:1037 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('foo', nargs='+')\n" @@ -1899,7 +1900,7 @@ msgstr "" "usage: PROG [-h] foo [foo ...]\n" "PROG: error: the following arguments are required: foo" -#: ../../library/argparse.rst:1044 +#: ../../library/argparse.rst:1045 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " @@ -1907,11 +1908,11 @@ msgid "" "be produced." msgstr "" -#: ../../library/argparse.rst:1052 +#: ../../library/argparse.rst:1053 msgid "const" msgstr "" -#: ../../library/argparse.rst:1054 +#: ../../library/argparse.rst:1055 msgid "" "The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to " "hold constant values that are not read from the command line but are " @@ -1919,7 +1920,7 @@ msgid "" "common uses of it are:" msgstr "" -#: ../../library/argparse.rst:1058 +#: ../../library/argparse.rst:1059 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='http://github.com/store_const'`` or ``action='http://github.com/append_const'``. These actions add " @@ -1929,7 +1930,7 @@ msgid "" "receive a default value of ``None``." msgstr "" -#: ../../library/argparse.rst:1066 +#: ../../library/argparse.rst:1067 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with option strings " "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " @@ -1939,17 +1940,17 @@ msgid "" "to be ``None`` instead. See the nargs_ description for examples." msgstr "" -#: ../../library/argparse.rst:1073 +#: ../../library/argparse.rst:1074 msgid "" "``const=None`` by default, including when ``action='http://github.com/append_const'`` or " "``action='http://github.com/store_const'``." msgstr "" -#: ../../library/argparse.rst:1080 +#: ../../library/argparse.rst:1081 msgid "default" msgstr "" -#: ../../library/argparse.rst:1082 +#: ../../library/argparse.rst:1083 msgid "" "All optional arguments and some positional arguments may be omitted at the " "command line. The ``default`` keyword argument of :meth:`~ArgumentParser." @@ -1959,7 +1960,7 @@ msgid "" "command line::" msgstr "" -#: ../../library/argparse.rst:1089 +#: ../../library/argparse.rst:1090 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1975,13 +1976,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:1096 +#: ../../library/argparse.rst:1097 msgid "" "If the target namespace already has an attribute set, the action *default* " "will not over write it::" msgstr "" -#: ../../library/argparse.rst:1099 +#: ../../library/argparse.rst:1100 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1993,7 +1994,7 @@ msgstr "" ">>> parser.parse_args([], namespace=argparse.Namespace(foo=101))\n" "Namespace(foo=101)" -#: ../../library/argparse.rst:1104 +#: ../../library/argparse.rst:1105 msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " @@ -2001,7 +2002,7 @@ msgid "" "`Namespace` return value. Otherwise, the parser uses the value as is::" msgstr "" -#: ../../library/argparse.rst:1109 +#: ../../library/argparse.rst:1110 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--length', default='10', type=int)\n" @@ -2015,13 +2016,13 @@ msgstr "" ">>> parser.parse_args()\n" "Namespace(length=10, width=10.5)" -#: ../../library/argparse.rst:1115 +#: ../../library/argparse.rst:1116 msgid "" "For positional arguments with nargs_ equal to ``?`` or ``*``, the " "``default`` value is used when no command-line argument was present::" msgstr "" -#: ../../library/argparse.rst:1118 +#: ../../library/argparse.rst:1119 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', nargs='?', default=42)\n" @@ -2039,11 +2040,18 @@ msgstr "" #: ../../library/argparse.rst:1126 msgid "" +"For required_ arguments, the ``default`` value is ignored. For example, this " +"applies to positional arguments with nargs_ values other than ``?`` or " +"``*``, or optional arguments marked as ``required=True``." +msgstr "" + +#: ../../library/argparse.rst:1130 +msgid "" "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " "the command-line argument was not present::" msgstr "" -#: ../../library/argparse.rst:1129 +#: ../../library/argparse.rst:1133 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" @@ -2059,11 +2067,11 @@ msgstr "" ">>> parser.parse_args(['--foo', '1'])\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:1140 +#: ../../library/argparse.rst:1144 msgid "type" msgstr "" -#: ../../library/argparse.rst:1142 +#: ../../library/argparse.rst:1146 msgid "" "By default, the parser reads command-line arguments in as simple strings. " "However, quite often the command-line string should instead be interpreted " @@ -2072,13 +2080,13 @@ msgid "" "checking and type conversions to be performed." msgstr "" -#: ../../library/argparse.rst:1148 +#: ../../library/argparse.rst:1152 msgid "" "If the type_ keyword is used with the default_ keyword, the type converter " "is only applied if the default is a string." msgstr "" -#: ../../library/argparse.rst:1151 +#: ../../library/argparse.rst:1155 msgid "" "The argument to ``type`` can be any callable that accepts a single string. " "If the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" @@ -2086,11 +2094,11 @@ msgid "" "is displayed. No other exception types are handled." msgstr "" -#: ../../library/argparse.rst:1156 +#: ../../library/argparse.rst:1160 msgid "Common built-in types and functions can be used as type converters:" msgstr "" -#: ../../library/argparse.rst:1158 +#: ../../library/argparse.rst:1162 msgid "" "import argparse\n" "import pathlib\n" @@ -2118,11 +2126,11 @@ msgstr "" "encoding='latin-1'))\n" "parser.add_argument('datapath', type=pathlib.Path)" -#: ../../library/argparse.rst:1172 +#: ../../library/argparse.rst:1176 msgid "User defined functions can be used as well:" msgstr "" -#: ../../library/argparse.rst:1174 +#: ../../library/argparse.rst:1178 msgid "" ">>> def hyphenated(string):\n" "... return '-'.join([word[:4] for word in string.casefold().split()])\n" @@ -2140,14 +2148,14 @@ msgstr "" ">>> parser.parse_args(['\"The Tale of Two Cities\"'])\n" "Namespace(short_title='\"the-tale-of-two-citi')" -#: ../../library/argparse.rst:1184 +#: ../../library/argparse.rst:1188 msgid "" "The :func:`bool` function is not recommended as a type converter. All it " "does is convert empty strings to ``False`` and non-empty strings to " "``True``. This is usually not what is desired." msgstr "" -#: ../../library/argparse.rst:1188 +#: ../../library/argparse.rst:1192 msgid "" "In general, the ``type`` keyword is a convenience that should only be used " "for simple conversions that can only raise one of the three supported " @@ -2155,7 +2163,7 @@ msgid "" "management should be done downstream after the arguments are parsed." msgstr "" -#: ../../library/argparse.rst:1193 +#: ../../library/argparse.rst:1197 msgid "" "For example, JSON or YAML conversions have complex error cases that require " "better reporting than can be given by the ``type`` keyword. A :exc:`~json." @@ -2163,7 +2171,7 @@ msgid "" "exception would not be handled at all." msgstr "" -#: ../../library/argparse.rst:1198 +#: ../../library/argparse.rst:1202 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " "``type`` keyword. If one argument uses *FileType* and then a subsequent " @@ -2172,17 +2180,17 @@ msgid "" "run and then use the :keyword:`with`-statement to manage the files." msgstr "" -#: ../../library/argparse.rst:1204 +#: ../../library/argparse.rst:1208 msgid "" "For type checkers that simply check against a fixed set of values, consider " "using the choices_ keyword instead." msgstr "" -#: ../../library/argparse.rst:1211 +#: ../../library/argparse.rst:1215 msgid "choices" msgstr "" -#: ../../library/argparse.rst:1213 +#: ../../library/argparse.rst:1217 msgid "" "Some command-line arguments should be selected from a restricted set of " "values. These can be handled by passing a sequence object as the *choices* " @@ -2191,7 +2199,7 @@ msgid "" "be displayed if the argument was not one of the acceptable values::" msgstr "" -#: ../../library/argparse.rst:1219 +#: ../../library/argparse.rst:1223 msgid "" ">>> parser = argparse.ArgumentParser(prog='game.py')\n" ">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" @@ -2211,14 +2219,14 @@ msgstr "" "game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n" "'paper', 'scissors')" -#: ../../library/argparse.rst:1228 +#: ../../library/argparse.rst:1232 msgid "" "Note that inclusion in the *choices* sequence is checked after any type_ " "conversions have been performed, so the type of the objects in the *choices* " "sequence should match the type_ specified::" msgstr "" -#: ../../library/argparse.rst:1232 +#: ../../library/argparse.rst:1236 msgid "" ">>> parser = argparse.ArgumentParser(prog='doors.py')\n" ">>> parser.add_argument('door', type=int, choices=range(1, 4))\n" @@ -2236,19 +2244,19 @@ msgstr "" "usage: doors.py [-h] {1,2,3}\n" "doors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3)" -#: ../../library/argparse.rst:1240 +#: ../../library/argparse.rst:1244 msgid "" "Any sequence can be passed as the *choices* value, so :class:`list` " "objects, :class:`tuple` objects, and custom sequences are all supported." msgstr "" -#: ../../library/argparse.rst:1243 +#: ../../library/argparse.rst:1247 msgid "" "Use of :class:`enum.Enum` is not recommended because it is difficult to " "control its appearance in usage, help, and error messages." msgstr "" -#: ../../library/argparse.rst:1246 +#: ../../library/argparse.rst:1250 msgid "" "Formatted choices override the default *metavar* which is normally derived " "from *dest*. This is usually what you want because the user never sees the " @@ -2256,11 +2264,11 @@ msgid "" "are many choices), just specify an explicit metavar_." msgstr "" -#: ../../library/argparse.rst:1255 +#: ../../library/argparse.rst:1259 msgid "required" msgstr "" -#: ../../library/argparse.rst:1257 +#: ../../library/argparse.rst:1261 msgid "" "In general, the :mod:`argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " @@ -2268,7 +2276,7 @@ msgid "" "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: ../../library/argparse.rst:1262 +#: ../../library/argparse.rst:1266 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', required=True)\n" @@ -2286,24 +2294,24 @@ msgstr "" "usage: [-h] --foo FOO\n" ": error: the following arguments are required: --foo" -#: ../../library/argparse.rst:1270 +#: ../../library/argparse.rst:1274 msgid "" "As the example shows, if an option is marked as ``required``, :meth:" "`~ArgumentParser.parse_args` will report an error if that option is not " "present at the command line." msgstr "" -#: ../../library/argparse.rst:1276 +#: ../../library/argparse.rst:1280 msgid "" "Required options are generally considered bad form because users expect " "*options* to be *optional*, and thus they should be avoided when possible." msgstr "" -#: ../../library/argparse.rst:1283 +#: ../../library/argparse.rst:1287 msgid "help" msgstr "幫助" -#: ../../library/argparse.rst:1285 +#: ../../library/argparse.rst:1289 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " @@ -2311,7 +2319,7 @@ msgid "" "each argument::" msgstr "" -#: ../../library/argparse.rst:1290 +#: ../../library/argparse.rst:1294 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', action='http://github.com/store_true',\n" @@ -2343,7 +2351,7 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo foo the bars before frobbling" -#: ../../library/argparse.rst:1305 +#: ../../library/argparse.rst:1309 msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " @@ -2352,7 +2360,7 @@ msgid "" "``%(type)s``, etc.::" msgstr "" -#: ../../library/argparse.rst:1310 +#: ../../library/argparse.rst:1314 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" @@ -2378,19 +2386,19 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1322 +#: ../../library/argparse.rst:1326 msgid "" "As the help string supports %-formatting, if you want a literal ``%`` to " "appear in the help string, you must escape it as ``%%``." msgstr "" -#: ../../library/argparse.rst:1325 +#: ../../library/argparse.rst:1329 msgid "" ":mod:`argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:1328 +#: ../../library/argparse.rst:1332 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" @@ -2408,11 +2416,11 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1340 +#: ../../library/argparse.rst:1344 msgid "metavar" msgstr "" -#: ../../library/argparse.rst:1342 +#: ../../library/argparse.rst:1346 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " "refer to each expected argument. By default, ArgumentParser objects use the " @@ -2424,7 +2432,7 @@ msgid "" "argument will be referred to as ``FOO``. An example::" msgstr "" -#: ../../library/argparse.rst:1351 +#: ../../library/argparse.rst:1355 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2456,11 +2464,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO" -#: ../../library/argparse.rst:1366 +#: ../../library/argparse.rst:1370 msgid "An alternative name can be specified with ``metavar``::" msgstr "" -#: ../../library/argparse.rst:1368 +#: ../../library/argparse.rst:1372 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', metavar='YYY')\n" @@ -2492,21 +2500,21 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo YYY" -#: ../../library/argparse.rst:1383 +#: ../../library/argparse.rst:1387 msgid "" "Note that ``metavar`` only changes the *displayed* name - the name of the " "attribute on the :meth:`~ArgumentParser.parse_args` object is still " "determined by the dest_ value." msgstr "" -#: ../../library/argparse.rst:1387 +#: ../../library/argparse.rst:1391 msgid "" "Different values of ``nargs`` may cause the metavar to be used multiple " "times. Providing a tuple to ``metavar`` specifies a different display for " "each of the arguments::" msgstr "" -#: ../../library/argparse.rst:1391 +#: ../../library/argparse.rst:1395 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', nargs=2)\n" @@ -2530,11 +2538,11 @@ msgstr "" " -x X X\n" " --foo bar baz" -#: ../../library/argparse.rst:1406 +#: ../../library/argparse.rst:1410 msgid "dest" msgstr "" -#: ../../library/argparse.rst:1408 +#: ../../library/argparse.rst:1412 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " @@ -2544,7 +2552,7 @@ msgid "" "add_argument`::" msgstr "" -#: ../../library/argparse.rst:1415 +#: ../../library/argparse.rst:1419 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('bar')\n" @@ -2556,7 +2564,7 @@ msgstr "" ">>> parser.parse_args(['XXX'])\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1420 +#: ../../library/argparse.rst:1424 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " @@ -2568,7 +2576,7 @@ msgid "" "below illustrate this behavior::" msgstr "" -#: ../../library/argparse.rst:1429 +#: ../../library/argparse.rst:1433 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('-f', '--foo-bar', '--foo')\n" @@ -2586,11 +2594,11 @@ msgstr "" ">>> parser.parse_args('--foo 1 -y 2'.split())\n" "Namespace(foo_bar='1', x='2')" -#: ../../library/argparse.rst:1437 +#: ../../library/argparse.rst:1441 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" -#: ../../library/argparse.rst:1439 +#: ../../library/argparse.rst:1443 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', dest='bar')\n" @@ -2602,11 +2610,11 @@ msgstr "" ">>> parser.parse_args('--foo XXX'.split())\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1448 +#: ../../library/argparse.rst:1452 msgid "deprecated" msgstr "" -#: ../../library/argparse.rst:1450 +#: ../../library/argparse.rst:1454 msgid "" "During a project's lifetime, some arguments may need to be removed from the " "command line. Before removing them, you should inform your users that the " @@ -2617,7 +2625,7 @@ msgid "" "will be printed to :data:`sys.stderr` when the argument is used::" msgstr "" -#: ../../library/argparse.rst:1460 +#: ../../library/argparse.rst:1464 #, fuzzy msgid "" ">>> import argparse\n" @@ -2636,11 +2644,11 @@ msgstr "" ">>> parser.parse_args(['--foo', '1'])\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:1473 +#: ../../library/argparse.rst:1477 msgid "Action classes" msgstr "" -#: ../../library/argparse.rst:1475 +#: ../../library/argparse.rst:1479 msgid "" "Action classes implement the Action API, a callable which returns a callable " "which processes arguments from the command-line. Any object which follows " @@ -2648,7 +2656,7 @@ msgid "" "add_argument`." msgstr "" -#: ../../library/argparse.rst:1484 +#: ../../library/argparse.rst:1488 msgid "" "Action objects are used by an ArgumentParser to represent the information " "needed to parse a single argument from one or more strings from the command " @@ -2657,7 +2665,7 @@ msgid "" "the ``action`` itself." msgstr "" -#: ../../library/argparse.rst:1490 +#: ../../library/argparse.rst:1494 msgid "" "Instances of Action (or return value of any callable to the ``action`` " "parameter) should have attributes \"dest\", \"option_strings\", \"default\", " @@ -2665,91 +2673,91 @@ msgid "" "these attributes are defined is to call ``Action.__init__``." msgstr "" -#: ../../library/argparse.rst:1495 +#: ../../library/argparse.rst:1499 msgid "" "Action instances should be callable, so subclasses must override the " "``__call__`` method, which should accept four parameters:" msgstr "" -#: ../../library/argparse.rst:1498 +#: ../../library/argparse.rst:1502 msgid "``parser`` - The ArgumentParser object which contains this action." msgstr "" -#: ../../library/argparse.rst:1500 +#: ../../library/argparse.rst:1504 msgid "" "``namespace`` - The :class:`Namespace` object that will be returned by :meth:" "`~ArgumentParser.parse_args`. Most actions add an attribute to this object " "using :func:`setattr`." msgstr "" -#: ../../library/argparse.rst:1504 +#: ../../library/argparse.rst:1508 msgid "" "``values`` - The associated command-line arguments, with any type " "conversions applied. Type conversions are specified with the type_ keyword " "argument to :meth:`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1508 +#: ../../library/argparse.rst:1512 msgid "" "``option_string`` - The option string that was used to invoke this action. " "The ``option_string`` argument is optional, and will be absent if the action " "is associated with a positional argument." msgstr "" -#: ../../library/argparse.rst:1512 +#: ../../library/argparse.rst:1516 msgid "" "The ``__call__`` method may perform arbitrary actions, but will typically " "set attributes on the ``namespace`` based on ``dest`` and ``values``." msgstr "" -#: ../../library/argparse.rst:1515 +#: ../../library/argparse.rst:1519 msgid "" "Action subclasses can define a ``format_usage`` method that takes no " "argument and return a string which will be used when printing the usage of " "the program. If such method is not provided, a sensible default will be used." msgstr "" -#: ../../library/argparse.rst:1520 +#: ../../library/argparse.rst:1524 msgid "The parse_args() method" msgstr "" -#: ../../library/argparse.rst:1524 +#: ../../library/argparse.rst:1528 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" -#: ../../library/argparse.rst:1527 +#: ../../library/argparse.rst:1531 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " "created and how they are assigned. See the documentation for :meth:" "`add_argument` for details." msgstr "" -#: ../../library/argparse.rst:1531 +#: ../../library/argparse.rst:1535 msgid "" "args_ - List of strings to parse. The default is taken from :data:`sys." "argv`." msgstr "" -#: ../../library/argparse.rst:1534 +#: ../../library/argparse.rst:1538 msgid "" "namespace_ - An object to take the attributes. The default is a new empty :" "class:`Namespace` object." msgstr "" -#: ../../library/argparse.rst:1539 +#: ../../library/argparse.rst:1543 msgid "Option value syntax" msgstr "" -#: ../../library/argparse.rst:1541 +#: ../../library/argparse.rst:1545 msgid "" "The :meth:`~ArgumentParser.parse_args` method supports several ways of " "specifying the value of an option (if it takes one). In the simplest case, " "the option and its value are passed as two separate arguments::" msgstr "" -#: ../../library/argparse.rst:1545 +#: ../../library/argparse.rst:1549 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2767,14 +2775,14 @@ msgstr "" ">>> parser.parse_args(['--foo', 'FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1553 +#: ../../library/argparse.rst:1557 msgid "" "For long options (options with names longer than a single character), the " "option and value can also be passed as a single command-line argument, using " "``=`` to separate them::" msgstr "" -#: ../../library/argparse.rst:1557 +#: ../../library/argparse.rst:1561 msgid "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" @@ -2782,13 +2790,13 @@ msgstr "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1560 +#: ../../library/argparse.rst:1564 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "" -#: ../../library/argparse.rst:1563 +#: ../../library/argparse.rst:1567 msgid "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" @@ -2796,13 +2804,13 @@ msgstr "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" -#: ../../library/argparse.rst:1566 +#: ../../library/argparse.rst:1570 msgid "" "Several short options can be joined together, using only a single ``-`` " "prefix, as long as only the last option (or none of them) requires a value::" msgstr "" -#: ../../library/argparse.rst:1569 +#: ../../library/argparse.rst:1573 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='http://github.com/store_true')\n" @@ -2818,11 +2826,11 @@ msgstr "" ">>> parser.parse_args(['-xyzZ'])\n" "Namespace(x=True, y=True, z='Z')" -#: ../../library/argparse.rst:1578 +#: ../../library/argparse.rst:1582 msgid "Invalid arguments" msgstr "" -#: ../../library/argparse.rst:1580 +#: ../../library/argparse.rst:1584 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " @@ -2830,7 +2838,7 @@ msgid "" "an error, it exits and prints the error along with a usage message::" msgstr "" -#: ../../library/argparse.rst:1585 +#: ../../library/argparse.rst:1589 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', type=int)\n" @@ -2852,11 +2860,11 @@ msgid "" "PROG: error: extra arguments found: badger" msgstr "" -#: ../../library/argparse.rst:1606 +#: ../../library/argparse.rst:1610 msgid "Arguments containing ``-``" msgstr "" -#: ../../library/argparse.rst:1608 +#: ../../library/argparse.rst:1612 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " @@ -2868,7 +2876,7 @@ msgid "" "negative numbers::" msgstr "" -#: ../../library/argparse.rst:1616 +#: ../../library/argparse.rst:1620 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2901,7 +2909,7 @@ msgid "" "PROG: error: argument -1: expected one argument" msgstr "" -#: ../../library/argparse.rst:1646 +#: ../../library/argparse.rst:1650 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " @@ -2909,7 +2917,7 @@ msgid "" "positional argument::" msgstr "" -#: ../../library/argparse.rst:1651 +#: ../../library/argparse.rst:1655 msgid "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" @@ -2917,24 +2925,24 @@ msgstr "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" -#: ../../library/argparse.rst:1654 +#: ../../library/argparse.rst:1658 msgid "" "See also :ref:`the argparse howto on ambiguous arguments ` for more details." msgstr "" -#: ../../library/argparse.rst:1660 +#: ../../library/argparse.rst:1664 msgid "Argument abbreviations (prefix matching)" msgstr "" -#: ../../library/argparse.rst:1662 +#: ../../library/argparse.rst:1666 msgid "" "The :meth:`~ArgumentParser.parse_args` method :ref:`by default " "` allows long options to be abbreviated to a prefix, if the " "abbreviation is unambiguous (the prefix matches a unique option)::" msgstr "" -#: ../../library/argparse.rst:1666 +#: ../../library/argparse.rst:1670 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -2958,17 +2966,17 @@ msgstr "" "usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" "PROG: error: ambiguous option: -ba could match -badger, -bacon" -#: ../../library/argparse.rst:1677 +#: ../../library/argparse.rst:1681 msgid "" "An error is produced for arguments that could produce more than one options. " "This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." msgstr "" -#: ../../library/argparse.rst:1683 +#: ../../library/argparse.rst:1687 msgid "Beyond ``sys.argv``" msgstr "" -#: ../../library/argparse.rst:1685 +#: ../../library/argparse.rst:1689 msgid "" "Sometimes it may be useful to have an ArgumentParser parse arguments other " "than those of :data:`sys.argv`. This can be accomplished by passing a list " @@ -2976,7 +2984,7 @@ msgid "" "testing at the interactive prompt::" msgstr "" -#: ../../library/argparse.rst:1690 +#: ../../library/argparse.rst:1694 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\n" @@ -3002,24 +3010,24 @@ msgstr "" ">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" "Namespace(accumulate=, integers=[1, 2, 3, 4])" -#: ../../library/argparse.rst:1705 +#: ../../library/argparse.rst:1709 msgid "The Namespace object" msgstr "" -#: ../../library/argparse.rst:1709 +#: ../../library/argparse.rst:1713 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." msgstr "" -#: ../../library/argparse.rst:1712 +#: ../../library/argparse.rst:1716 msgid "" "This class is deliberately simple, just an :class:`object` subclass with a " "readable string representation. If you prefer to have dict-like view of the " "attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" -#: ../../library/argparse.rst:1716 +#: ../../library/argparse.rst:1720 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3033,14 +3041,14 @@ msgstr "" ">>> vars(args)\n" "{'foo': 'BAR'}" -#: ../../library/argparse.rst:1722 +#: ../../library/argparse.rst:1726 msgid "" "It may also be useful to have an :class:`ArgumentParser` assign attributes " "to an already existing object, rather than a new :class:`Namespace` object. " "This can be achieved by specifying the ``namespace=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:1726 +#: ../../library/argparse.rst:1730 msgid "" ">>> class C:\n" "... pass\n" @@ -3062,15 +3070,15 @@ msgstr "" ">>> c.foo\n" "'BAR'" -#: ../../library/argparse.rst:1738 +#: ../../library/argparse.rst:1742 msgid "Other utilities" msgstr "" -#: ../../library/argparse.rst:1741 +#: ../../library/argparse.rst:1745 msgid "Sub-commands" msgstr "" -#: ../../library/argparse.rst:1748 +#: ../../library/argparse.rst:1752 msgid "" "Many programs split up their functionality into a number of sub-commands, " "for example, the ``svn`` program can invoke sub-commands like ``svn " @@ -3086,69 +3094,69 @@ msgid "" "can be modified as usual." msgstr "" -#: ../../library/argparse.rst:1760 +#: ../../library/argparse.rst:1764 msgid "Description of parameters:" msgstr "" -#: ../../library/argparse.rst:1762 +#: ../../library/argparse.rst:1766 msgid "" "title - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " "positional arguments" msgstr "" -#: ../../library/argparse.rst:1766 +#: ../../library/argparse.rst:1770 msgid "" "description - description for the sub-parser group in help output, by " "default ``None``" msgstr "" -#: ../../library/argparse.rst:1769 +#: ../../library/argparse.rst:1773 msgid "" "prog - usage information that will be displayed with sub-command help, by " "default the name of the program and any positional arguments before the " "subparser argument" msgstr "" -#: ../../library/argparse.rst:1773 +#: ../../library/argparse.rst:1777 msgid "" "parser_class - class which will be used to create sub-parser instances, by " "default the class of the current parser (e.g. ArgumentParser)" msgstr "" -#: ../../library/argparse.rst:1776 +#: ../../library/argparse.rst:1780 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "" -#: ../../library/argparse.rst:1779 +#: ../../library/argparse.rst:1783 msgid "" "dest_ - name of the attribute under which sub-command name will be stored; " "by default ``None`` and no value is stored" msgstr "" -#: ../../library/argparse.rst:1782 +#: ../../library/argparse.rst:1786 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "" -#: ../../library/argparse.rst:1785 +#: ../../library/argparse.rst:1789 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" -#: ../../library/argparse.rst:1787 +#: ../../library/argparse.rst:1791 msgid "" "metavar_ - string presenting available sub-commands in help; by default it " "is ``None`` and presents sub-commands in form {cmd1, cmd2, ..}" msgstr "" -#: ../../library/argparse.rst:1790 +#: ../../library/argparse.rst:1794 msgid "Some example usage::" msgstr "一些使用範例: ::" -#: ../../library/argparse.rst:1792 +#: ../../library/argparse.rst:1796 msgid "" ">>> # create the top-level parser\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -3170,7 +3178,7 @@ msgid "" "Namespace(baz='Z', foo=True)" msgstr "" -#: ../../library/argparse.rst:1811 +#: ../../library/argparse.rst:1815 msgid "" "Note that the object returned by :meth:`parse_args` will only contain " "attributes for the main parser and the subparser that was selected by the " @@ -3180,7 +3188,7 @@ msgid "" "``baz`` attributes are present." msgstr "" -#: ../../library/argparse.rst:1818 +#: ../../library/argparse.rst:1822 msgid "" "Similarly, when a help message is requested from a subparser, only the help " "for that particular parser will be printed. The help message will not " @@ -3189,7 +3197,7 @@ msgid "" "to :meth:`~_SubParsersAction.add_parser` as above.)" msgstr "" -#: ../../library/argparse.rst:1826 +#: ../../library/argparse.rst:1830 msgid "" ">>> parser.parse_args(['--help'])\n" "usage: PROG [-h] [--foo] {a,b} ...\n" @@ -3247,14 +3255,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --baz {X,Y,Z} baz help" -#: ../../library/argparse.rst:1854 +#: ../../library/argparse.rst:1858 msgid "" "The :meth:`add_subparsers` method also supports ``title`` and " "``description`` keyword arguments. When either is present, the subparser's " "commands will appear in their own group in the help output. For example::" msgstr "" -#: ../../library/argparse.rst:1858 +#: ../../library/argparse.rst:1862 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -3290,7 +3298,7 @@ msgstr "" "\n" " {foo,bar} additional help" -#: ../../library/argparse.rst:1875 +#: ../../library/argparse.rst:1879 msgid "" "Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional " "*aliases* argument, which allows multiple strings to refer to the same " @@ -3298,7 +3306,7 @@ msgid "" "``checkout``::" msgstr "" -#: ../../library/argparse.rst:1880 +#: ../../library/argparse.rst:1884 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -3314,13 +3322,13 @@ msgstr "" ">>> parser.parse_args(['co', 'bar'])\n" "Namespace(foo='bar')" -#: ../../library/argparse.rst:1887 +#: ../../library/argparse.rst:1891 msgid "" ":meth:`~_SubParsersAction.add_parser` supports also an additional " "*deprecated* argument, which allows to deprecate the subparser." msgstr "" -#: ../../library/argparse.rst:1901 +#: ../../library/argparse.rst:1905 msgid "" "One particularly effective way of handling sub-commands is to combine the " "use of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` " @@ -3328,7 +3336,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:1906 +#: ../../library/argparse.rst:1910 msgid "" ">>> # sub-command functions\n" ">>> def foo(args):\n" @@ -3363,7 +3371,7 @@ msgid "" "((XYZYX))" msgstr "" -#: ../../library/argparse.rst:1938 +#: ../../library/argparse.rst:1942 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " @@ -3373,7 +3381,7 @@ msgid "" "argument to the :meth:`add_subparsers` call will work::" msgstr "" -#: ../../library/argparse.rst:1945 +#: ../../library/argparse.rst:1949 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" @@ -3393,15 +3401,15 @@ msgstr "" ">>> parser.parse_args(['2', 'frobble'])\n" "Namespace(subparser_name='2', y='frobble')" -#: ../../library/argparse.rst:1954 +#: ../../library/argparse.rst:1958 msgid "New *required* keyword argument." msgstr "" -#: ../../library/argparse.rst:1959 +#: ../../library/argparse.rst:1963 msgid "FileType objects" msgstr "FileType 物件" -#: ../../library/argparse.rst:1963 +#: ../../library/argparse.rst:1967 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " "argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" @@ -3410,7 +3418,7 @@ msgid "" "the :func:`open` function for more details)::" msgstr "" -#: ../../library/argparse.rst:1969 +#: ../../library/argparse.rst:1973 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" @@ -3428,14 +3436,14 @@ msgstr "" "Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " "raw=<_io.FileIO name='raw.dat' mode='wb'>)" -#: ../../library/argparse.rst:1975 +#: ../../library/argparse.rst:1979 msgid "" "FileType objects understand the pseudo-argument ``'-'`` and automatically " "convert this into :data:`sys.stdin` for readable :class:`FileType` objects " "and :data:`sys.stdout` for writable :class:`FileType` objects::" msgstr "" -#: ../../library/argparse.rst:1979 +#: ../../library/argparse.rst:1983 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" @@ -3447,15 +3455,15 @@ msgstr "" ">>> parser.parse_args(['-'])\n" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1984 +#: ../../library/argparse.rst:1988 msgid "Added the *encodings* and *errors* parameters." msgstr "" -#: ../../library/argparse.rst:1989 +#: ../../library/argparse.rst:1993 msgid "Argument groups" msgstr "" -#: ../../library/argparse.rst:1993 +#: ../../library/argparse.rst:1997 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"options\" when displaying help messages. When " @@ -3464,7 +3472,7 @@ msgid "" "method::" msgstr "" -#: ../../library/argparse.rst:1999 +#: ../../library/argparse.rst:2003 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group = parser.add_argument_group('group')\n" @@ -3488,7 +3496,7 @@ msgstr "" " bar bar help\n" " --foo FOO foo help" -#: ../../library/argparse.rst:2010 +#: ../../library/argparse.rst:2014 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " "has an :meth:`~ArgumentParser.add_argument` method just like a regular :" @@ -3499,7 +3507,7 @@ msgid "" "this display::" msgstr "" -#: ../../library/argparse.rst:2018 +#: ../../library/argparse.rst:2022 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" @@ -3537,13 +3545,13 @@ msgstr "" "\n" " --bar BAR bar help" -#: ../../library/argparse.rst:2036 +#: ../../library/argparse.rst:2040 msgid "" "Note that any arguments not in your user-defined groups will end up back in " "the usual \"positional arguments\" and \"optional arguments\" sections." msgstr "" -#: ../../library/argparse.rst:2039 +#: ../../library/argparse.rst:2043 msgid "" "Calling :meth:`add_argument_group` on an argument group is deprecated. This " "feature was never supported and does not always work correctly. The function " @@ -3551,18 +3559,18 @@ msgid "" "future." msgstr "" -#: ../../library/argparse.rst:2047 +#: ../../library/argparse.rst:2051 msgid "Mutual exclusion" msgstr "" -#: ../../library/argparse.rst:2051 +#: ../../library/argparse.rst:2055 msgid "" "Create a mutually exclusive group. :mod:`argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " "command line::" msgstr "" -#: ../../library/argparse.rst:2055 +#: ../../library/argparse.rst:2059 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -3588,14 +3596,14 @@ msgstr "" "usage: PROG [-h] [--foo | --bar]\n" "PROG: error: argument --bar: not allowed with argument --foo" -#: ../../library/argparse.rst:2067 +#: ../../library/argparse.rst:2071 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " "is required::" msgstr "" -#: ../../library/argparse.rst:2071 +#: ../../library/argparse.rst:2075 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -3613,7 +3621,7 @@ msgstr "" "usage: PROG [-h] (--foo | --bar)\n" "PROG: error: one of the arguments --foo --bar is required" -#: ../../library/argparse.rst:2079 +#: ../../library/argparse.rst:2083 msgid "" "Note that currently mutually exclusive argument groups do not support the " "*title* and *description* arguments of :meth:`~ArgumentParser." @@ -3621,7 +3629,7 @@ msgid "" "argument group that has a title and description. For example::" msgstr "" -#: ../../library/argparse.rst:2085 +#: ../../library/argparse.rst:2089 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -3657,7 +3665,7 @@ msgstr "" " --foo FOO foo help\n" " --bar BAR bar help" -#: ../../library/argparse.rst:2102 +#: ../../library/argparse.rst:2106 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " "on a mutually exclusive group is deprecated. These features were never " @@ -3665,11 +3673,11 @@ msgid "" "by accident through inheritance and will be removed in the future." msgstr "" -#: ../../library/argparse.rst:2110 +#: ../../library/argparse.rst:2114 msgid "Parser defaults" msgstr "" -#: ../../library/argparse.rst:2114 +#: ../../library/argparse.rst:2118 msgid "" "Most of the time, the attributes of the object returned by :meth:" "`parse_args` will be fully determined by inspecting the command-line " @@ -3678,7 +3686,7 @@ msgid "" "command line to be added::" msgstr "" -#: ../../library/argparse.rst:2120 +#: ../../library/argparse.rst:2124 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -3692,12 +3700,12 @@ msgstr "" ">>> parser.parse_args(['736'])\n" "Namespace(bar=42, baz='badger', foo=736)" -#: ../../library/argparse.rst:2126 +#: ../../library/argparse.rst:2130 msgid "" "Note that parser-level defaults always override argument-level defaults::" msgstr "" -#: ../../library/argparse.rst:2128 +#: ../../library/argparse.rst:2132 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -3711,20 +3719,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo='spam')" -#: ../../library/argparse.rst:2134 +#: ../../library/argparse.rst:2138 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " "example of this type." msgstr "" -#: ../../library/argparse.rst:2140 +#: ../../library/argparse.rst:2144 msgid "" "Get the default value for a namespace attribute, as set by either :meth:" "`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" msgstr "" -#: ../../library/argparse.rst:2144 +#: ../../library/argparse.rst:2148 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" @@ -3736,54 +3744,54 @@ msgstr "" ">>> parser.get_default('foo')\n" "'badger'" -#: ../../library/argparse.rst:2151 +#: ../../library/argparse.rst:2155 msgid "Printing help" msgstr "" -#: ../../library/argparse.rst:2153 +#: ../../library/argparse.rst:2157 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " "several formatting methods are available:" msgstr "" -#: ../../library/argparse.rst:2159 +#: ../../library/argparse.rst:2163 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " "assumed." msgstr "" -#: ../../library/argparse.rst:2165 +#: ../../library/argparse.rst:2169 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " "``None``, :data:`sys.stdout` is assumed." msgstr "" -#: ../../library/argparse.rst:2169 +#: ../../library/argparse.rst:2173 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "" -#: ../../library/argparse.rst:2174 +#: ../../library/argparse.rst:2178 msgid "" "Return a string containing a brief description of how the :class:" "`ArgumentParser` should be invoked on the command line." msgstr "" -#: ../../library/argparse.rst:2179 +#: ../../library/argparse.rst:2183 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:2184 +#: ../../library/argparse.rst:2188 msgid "Partial parsing" msgstr "" -#: ../../library/argparse.rst:2188 +#: ../../library/argparse.rst:2192 msgid "" "Sometimes a script may only parse a few of the command-line arguments, " "passing the remaining arguments on to another script or program. In these " @@ -3794,7 +3802,7 @@ msgid "" "remaining argument strings." msgstr "" -#: ../../library/argparse.rst:2197 +#: ../../library/argparse.rst:2201 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/store_true')\n" @@ -3808,7 +3816,7 @@ msgstr "" ">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" -#: ../../library/argparse.rst:2204 +#: ../../library/argparse.rst:2208 msgid "" ":ref:`Prefix matching ` rules apply to :meth:" "`~ArgumentParser.parse_known_args`. The parser may consume an option even if " @@ -3816,11 +3824,11 @@ msgid "" "remaining arguments list." msgstr "" -#: ../../library/argparse.rst:2211 +#: ../../library/argparse.rst:2215 msgid "Customizing file parsing" msgstr "" -#: ../../library/argparse.rst:2215 +#: ../../library/argparse.rst:2219 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -3828,20 +3836,20 @@ msgid "" "reading." msgstr "" -#: ../../library/argparse.rst:2220 +#: ../../library/argparse.rst:2224 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " "The method is called once per line read from the argument file, in order." msgstr "" -#: ../../library/argparse.rst:2224 +#: ../../library/argparse.rst:2228 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" msgstr "" -#: ../../library/argparse.rst:2227 +#: ../../library/argparse.rst:2231 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" @@ -3851,18 +3859,18 @@ msgstr "" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" -#: ../../library/argparse.rst:2233 +#: ../../library/argparse.rst:2237 msgid "Exiting methods" msgstr "" -#: ../../library/argparse.rst:2237 +#: ../../library/argparse.rst:2241 msgid "" "This method terminates the program, exiting with the specified *status* and, " "if given, it prints a *message* to :data:`sys.stderr` before that. The user " "can override this method to handle these steps differently::" msgstr "" -#: ../../library/argparse.rst:2241 +#: ../../library/argparse.rst:2245 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -3876,17 +3884,17 @@ msgstr "" " raise Exception(f'Exiting because of an error: {message}')\n" " exit(status)" -#: ../../library/argparse.rst:2249 +#: ../../library/argparse.rst:2253 msgid "" "This method prints a usage message, including the *message*, to :data:`sys." "stderr` and terminates the program with a status code of 2." msgstr "" -#: ../../library/argparse.rst:2254 +#: ../../library/argparse.rst:2258 msgid "Intermixed parsing" msgstr "" -#: ../../library/argparse.rst:2259 +#: ../../library/argparse.rst:2263 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -3894,7 +3902,7 @@ msgid "" "parsing style." msgstr "" -#: ../../library/argparse.rst:2264 +#: ../../library/argparse.rst:2268 msgid "" "These parsers do not support all the argparse features, and will raise " "exceptions if unsupported features are used. In particular, subparsers, and " @@ -3902,7 +3910,7 @@ msgid "" "not supported." msgstr "" -#: ../../library/argparse.rst:2269 +#: ../../library/argparse.rst:2273 msgid "" "The following example shows the difference between :meth:`~ArgumentParser." "parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " @@ -3910,7 +3918,7 @@ msgid "" "collects all the positionals into ``rest``. ::" msgstr "" -#: ../../library/argparse.rst:2275 +#: ../../library/argparse.rst:2279 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3930,7 +3938,7 @@ msgstr "" ">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" "Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" -#: ../../library/argparse.rst:2284 +#: ../../library/argparse.rst:2288 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -3938,11 +3946,11 @@ msgid "" "there are any remaining unparsed argument strings." msgstr "" -#: ../../library/argparse.rst:2294 +#: ../../library/argparse.rst:2298 msgid "Upgrading optparse code" msgstr "" -#: ../../library/argparse.rst:2296 +#: ../../library/argparse.rst:2300 msgid "" "Originally, the :mod:`argparse` module had attempted to maintain " "compatibility with :mod:`optparse`. However, :mod:`optparse` was difficult " @@ -3953,47 +3961,47 @@ msgid "" "compatibility." msgstr "" -#: ../../library/argparse.rst:2303 +#: ../../library/argparse.rst:2307 msgid "" "The :mod:`argparse` module improves on the standard library :mod:`optparse` " "module in a number of ways including:" msgstr "" -#: ../../library/argparse.rst:2306 +#: ../../library/argparse.rst:2310 msgid "Handling positional arguments." msgstr "" -#: ../../library/argparse.rst:2307 +#: ../../library/argparse.rst:2311 msgid "Supporting sub-commands." msgstr "" -#: ../../library/argparse.rst:2308 +#: ../../library/argparse.rst:2312 msgid "Allowing alternative option prefixes like ``+`` and ``/``." msgstr "" -#: ../../library/argparse.rst:2309 +#: ../../library/argparse.rst:2313 msgid "Handling zero-or-more and one-or-more style arguments." msgstr "" -#: ../../library/argparse.rst:2310 +#: ../../library/argparse.rst:2314 msgid "Producing more informative usage messages." msgstr "" -#: ../../library/argparse.rst:2311 +#: ../../library/argparse.rst:2315 msgid "Providing a much simpler interface for custom ``type`` and ``action``." msgstr "" -#: ../../library/argparse.rst:2313 +#: ../../library/argparse.rst:2317 msgid "A partial upgrade path from :mod:`optparse` to :mod:`argparse`:" msgstr "" -#: ../../library/argparse.rst:2315 +#: ../../library/argparse.rst:2319 msgid "" "Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:" "`ArgumentParser.add_argument` calls." msgstr "" -#: ../../library/argparse.rst:2318 +#: ../../library/argparse.rst:2322 msgid "" "Replace ``(options, args) = parser.parse_args()`` with ``args = parser." "parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls " @@ -4001,78 +4009,78 @@ msgid "" "``options``, now in the :mod:`argparse` context is called ``args``." msgstr "" -#: ../../library/argparse.rst:2323 +#: ../../library/argparse.rst:2327 msgid "" "Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using :" "meth:`~ArgumentParser.parse_intermixed_args` instead of :meth:" "`~ArgumentParser.parse_args`." msgstr "" -#: ../../library/argparse.rst:2327 +#: ../../library/argparse.rst:2331 msgid "" "Replace callback actions and the ``callback_*`` keyword arguments with " "``type`` or ``action`` arguments." msgstr "" -#: ../../library/argparse.rst:2330 +#: ../../library/argparse.rst:2334 msgid "" "Replace string names for ``type`` keyword arguments with the corresponding " "type objects (e.g. int, float, complex, etc)." msgstr "" -#: ../../library/argparse.rst:2333 +#: ../../library/argparse.rst:2337 msgid "" "Replace :class:`optparse.Values` with :class:`Namespace` and :exc:`optparse." "OptionError` and :exc:`optparse.OptionValueError` with :exc:`ArgumentError`." msgstr "" -#: ../../library/argparse.rst:2337 +#: ../../library/argparse.rst:2341 msgid "" "Replace strings with implicit arguments such as ``%default`` or ``%prog`` " "with the standard Python syntax to use dictionaries to format strings, that " "is, ``%(default)s`` and ``%(prog)s``." msgstr "" -#: ../../library/argparse.rst:2341 +#: ../../library/argparse.rst:2345 msgid "" "Replace the OptionParser constructor ``version`` argument with a call to " "``parser.add_argument('--version', action='http://github.com/version', version='')``." msgstr "" -#: ../../library/argparse.rst:2345 +#: ../../library/argparse.rst:2349 msgid "Exceptions" msgstr "" -#: ../../library/argparse.rst:2349 +#: ../../library/argparse.rst:2353 msgid "An error from creating or using an argument (optional or positional)." msgstr "" -#: ../../library/argparse.rst:2351 +#: ../../library/argparse.rst:2355 msgid "" "The string value of this exception is the message, augmented with " "information about the argument that caused it." msgstr "" -#: ../../library/argparse.rst:2356 +#: ../../library/argparse.rst:2360 msgid "" "Raised when something goes wrong converting a command line string to a type." msgstr "" -#: ../../library/argparse.rst:982 +#: ../../library/argparse.rst:983 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/argparse.rst:982 ../../library/argparse.rst:1016 -#: ../../library/argparse.rst:1030 +#: ../../library/argparse.rst:983 ../../library/argparse.rst:1017 +#: ../../library/argparse.rst:1031 msgid "in argparse module" msgstr "於 argparse 模組中" -#: ../../library/argparse.rst:1016 +#: ../../library/argparse.rst:1017 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/argparse.rst:1030 +#: ../../library/argparse.rst:1031 msgid "+ (plus)" msgstr "+ (加號)" diff --git a/library/ast.po b/library/ast.po index a667e2bdc0..bf6a46b3ed 100644 --- a/library/ast.po +++ b/library/ast.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 15:56+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -451,15 +451,15 @@ msgstr "" "parse` 在預設的 ``\"exec\"`` *mode* 下生成的節點型別。" #: ../../library/ast.rst:176 -msgid "*body* is a :class:`list` of the module's :ref:`ast-statements`." -msgstr "*body* 是模組的\\ :ref:`ast-statements` 的一個 :class:`list`。" +msgid "``body`` is a :class:`list` of the module's :ref:`ast-statements`." +msgstr "``body`` 是模組的\\ :ref:`ast-statements` 的一個 :class:`list`。" #: ../../library/ast.rst:178 msgid "" -"*type_ignores* is a :class:`list` of the module's type ignore comments; see :" -"func:`ast.parse` for more details." +"``type_ignores`` is a :class:`list` of the module's type ignore comments; " +"see :func:`ast.parse` for more details." msgstr "" -"*type_ignores* 是模組的忽略型別註解的 :class:`list`;有關更多詳細資訊,請參" +"``type_ignores`` 是模組的忽略型別註解的 :class:`list`;有關更多詳細資訊,請參" "閱 :func:`ast.parse`。" #: ../../library/ast.rst:181 @@ -490,10 +490,10 @@ msgstr "" #: ../../library/ast.rst:197 msgid "" -"*body* is a single node, one of the :ref:`expression types `." msgstr "" -"*body* 是單個節點,是\\ :ref:`運算式型別 `\\ 的其中之一。" +"``body`` 是單個節點,是\\ :ref:`運算式型別 `\\ 的其中之一。" #: ../../library/ast.rst:200 ../../library/ast.rst:270 msgid "" @@ -514,9 +514,9 @@ msgstr "" "似。當 *mode* 是 ``\"single\"`` 時節點型別由 :func:`ast.parse` 生成。" #: ../../library/ast.rst:212 -msgid "*body* is a :class:`list` of :ref:`statement nodes `." +msgid "``body`` is a :class:`list` of :ref:`statement nodes `." msgstr "" -"*body* 是\\ :ref:`陳述式節點 (statement nodes) ` 的 :class:" +"``body`` 是\\ :ref:`陳述式節點 (statement nodes) ` 的 :class:" "`list`。" #: ../../library/ast.rst:214 @@ -570,13 +570,13 @@ msgstr "" #: ../../library/ast.rst:241 msgid "" -"*argtypes* is a :class:`list` of :ref:`expression nodes `." +"``argtypes`` is a :class:`list` of :ref:`expression nodes `." msgstr "" -"*argtypes* 是\\ :ref:`運算式節點 `\\ 的 :class:`list`。" +"``argtypes`` 是\\ :ref:`運算式節點 `\\ 的 :class:`list`。" #: ../../library/ast.rst:243 -msgid "*returns* is a single :ref:`expression node `." -msgstr "*returns* 是單個\\ :ref:`運算式節點 `。" +msgid "``returns`` is a single :ref:`expression node `." +msgstr "``returns`` 是單個\\ :ref:`運算式節點 `。" #: ../../library/ast.rst:245 msgid "" @@ -3133,16 +3133,16 @@ msgstr ":ref:`型別參數 `\\ 可以存在於類別、函式和型 #: ../../library/ast.rst:1769 msgid "" -"A :class:`typing.TypeVar`. *name* is the name of the type variable. *bound* " -"is the bound or constraints, if any. If *bound* is a :class:`Tuple`, it " -"represents constraints; otherwise it represents the bound. *default_value* " -"is the default value; if the :class:`!TypeVar` has no default, this " -"attribute will be set to ``None``." +"A :class:`typing.TypeVar`. ``name`` is the name of the type variable. " +"``bound`` is the bound or constraints, if any. If ``bound`` is a :class:" +"`Tuple`, it represents constraints; otherwise it represents the bound. " +"``default_value`` is the default value; if the :class:`!TypeVar` has no " +"default, this attribute will be set to ``None``." msgstr "" -"一個 :class:`typing.TypeVar`。*name* 是型別變數的名稱。*bound* 是(如果有存在" -"的)界限 (bound) 或約束 (constraint)。如果 *bound* 是一個 :class:`Tuple`,它" -"代表約束;否則它代表界限。*default_value* 為預設值;如果 :class:`!TypeVar` 沒" -"有預設值,那此屬性會被設為 ``None``。" +"一個 :class:`typing.TypeVar`。``name`` 是型別變數的名稱。``bound`` 是(如果有" +"存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一個 :class:" +"`Tuple`,它代表約束;否則它代表界限。``default_value`` 為預設值;如果 :class:" +"`!TypeVar` 沒有預設值,那此屬性會被設為 ``None``。" #: ../../library/ast.rst:1775 msgid "" @@ -3185,12 +3185,12 @@ msgstr "新增 *default_value* 參數。" #: ../../library/ast.rst:1799 msgid "" -"A :class:`typing.ParamSpec`. *name* is the name of the parameter " -"specification. *default_value* is the default value; if the :class:`!" +"A :class:`typing.ParamSpec`. ``name`` is the name of the parameter " +"specification. ``default_value`` is the default value; if the :class:`!" "ParamSpec` has no default, this attribute will be set to ``None``." msgstr "" -"一個 :class:`typing.ParamSpec`。*name* 是參數規範的名稱。*default_value* 是預" -"設值;如果 :class:`!ParamSpec` 沒有預設值,則該屬性將設定為 ``None``。" +"一個 :class:`typing.ParamSpec`。``name`` 是參數規範的名稱。``default_value`` " +"是預設值;如果 :class:`!ParamSpec` 沒有預設值,則該屬性將設定為 ``None``。" #: ../../library/ast.rst:1803 msgid "" @@ -3242,13 +3242,13 @@ msgstr "" #: ../../library/ast.rst:1834 msgid "" -"A :class:`typing.TypeVarTuple`. *name* is the name of the type variable " -"tuple. *default_value* is the default value; if the :class:`!TypeVarTuple` " +"A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable " +"tuple. ``default_value`` is the default value; if the :class:`!TypeVarTuple` " "has no default, this attribute will be set to ``None``." msgstr "" -"一個 :class:`typing.TypeVarTuple`。*name* 是型別變數元組的名稱。" -"*default_value* 為預設值;如果 :class:`!TypeVarTuple` 沒有預設值,那此屬性會" -"被設為 ``None``。" +"一個 :class:`typing.TypeVarTuple`。``name`` 是型別變數元組的名稱。" +"``default_value`` 為預設值;如果 :class:`!TypeVarTuple` 沒有預設值,那此屬性" +"會被設為 ``None``。" #: ../../library/ast.rst:1838 msgid "" diff --git a/library/asyncio-task.po b/library/asyncio-task.po index ab4532b2ef..b4dd13ea2f 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -435,11 +435,11 @@ msgid "" " task.add_done_callback(background_tasks.discard)" msgstr "" -#: ../../library/asyncio-task.rst:287 ../../library/asyncio-task.rst:1141 +#: ../../library/asyncio-task.rst:287 ../../library/asyncio-task.rst:1188 msgid "Added the *name* parameter." msgstr "新增 *name* 參數。" -#: ../../library/asyncio-task.rst:290 ../../library/asyncio-task.rst:1148 +#: ../../library/asyncio-task.rst:290 ../../library/asyncio-task.rst:1195 msgid "Added the *context* parameter." msgstr "新增 *context* 參數。" @@ -502,9 +502,9 @@ msgstr "" msgid "Close the given coroutine if the task group is not active." msgstr "" -#: ../../library/asyncio-task.rst:345 ../../library/asyncio-task.rst:503 -#: ../../library/asyncio-task.rst:676 ../../library/asyncio-task.rst:734 -#: ../../library/asyncio-task.rst:760 ../../library/asyncio-task.rst:800 +#: ../../library/asyncio-task.rst:345 ../../library/asyncio-task.rst:550 +#: ../../library/asyncio-task.rst:723 ../../library/asyncio-task.rst:781 +#: ../../library/asyncio-task.rst:807 ../../library/asyncio-task.rst:847 msgid "Example::" msgstr "範例: ::" @@ -600,37 +600,92 @@ msgid "" msgstr "" #: ../../library/asyncio-task.rst:418 +msgid "Terminating a Task Group" +msgstr "" + +#: ../../library/asyncio-task.rst:420 +msgid "" +"While terminating a task group is not natively supported by the standard " +"library, termination can be achieved by adding an exception-raising task to " +"the task group and ignoring the raised exception:" +msgstr "" + +#: ../../library/asyncio-task.rst:424 +msgid "" +"import asyncio\n" +"from asyncio import TaskGroup\n" +"\n" +"class TerminateTaskGroup(Exception):\n" +" \"\"\"Exception raised to terminate a task group.\"\"\"\n" +"\n" +"async def force_terminate_task_group():\n" +" \"\"\"Used to force termination of a task group.\"\"\"\n" +" raise TerminateTaskGroup()\n" +"\n" +"async def job(task_id, sleep_time):\n" +" print(f'Task {task_id}: start')\n" +" await asyncio.sleep(sleep_time)\n" +" print(f'Task {task_id}: done')\n" +"\n" +"async def main():\n" +" try:\n" +" async with TaskGroup() as group:\n" +" # spawn some tasks\n" +" group.create_task(job(1, 0.5))\n" +" group.create_task(job(2, 1.5))\n" +" # sleep for 1 second\n" +" await asyncio.sleep(1)\n" +" # add an exception-raising task to force the group to terminate\n" +" group.create_task(force_terminate_task_group())\n" +" except* TerminateTaskGroup:\n" +" pass\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: ../../library/asyncio-task.rst:456 +msgid "Expected output:" +msgstr "預期的輸出: ::" + +#: ../../library/asyncio-task.rst:458 +msgid "" +"Task 1: start\n" +"Task 2: start\n" +"Task 1: done" +msgstr "" + +#: ../../library/asyncio-task.rst:465 msgid "Sleeping" msgstr "" -#: ../../library/asyncio-task.rst:422 +#: ../../library/asyncio-task.rst:469 msgid "Block for *delay* seconds." msgstr "" -#: ../../library/asyncio-task.rst:424 +#: ../../library/asyncio-task.rst:471 msgid "" "If *result* is provided, it is returned to the caller when the coroutine " "completes." msgstr "" -#: ../../library/asyncio-task.rst:427 +#: ../../library/asyncio-task.rst:474 msgid "" "``sleep()`` always suspends the current task, allowing other tasks to run." msgstr "" -#: ../../library/asyncio-task.rst:430 +#: ../../library/asyncio-task.rst:477 msgid "" "Setting the delay to 0 provides an optimized path to allow other tasks to " "run. This can be used by long-running functions to avoid blocking the event " "loop for the full duration of the function call." msgstr "" -#: ../../library/asyncio-task.rst:436 +#: ../../library/asyncio-task.rst:483 msgid "" "Example of coroutine displaying the current date every second for 5 seconds::" msgstr "" -#: ../../library/asyncio-task.rst:439 +#: ../../library/asyncio-task.rst:486 msgid "" "import asyncio\n" "import datetime\n" @@ -660,40 +715,40 @@ msgstr "" "\n" "asyncio.run(display_date())" -#: ../../library/asyncio-task.rst:454 ../../library/asyncio-task.rst:552 -#: ../../library/asyncio-task.rst:651 ../../library/asyncio-task.rst:825 -#: ../../library/asyncio-task.rst:879 ../../library/asyncio-task.rst:936 +#: ../../library/asyncio-task.rst:501 ../../library/asyncio-task.rst:599 +#: ../../library/asyncio-task.rst:698 ../../library/asyncio-task.rst:872 +#: ../../library/asyncio-task.rst:926 ../../library/asyncio-task.rst:983 msgid "Removed the *loop* parameter." msgstr "移除 *loop* 參數。" -#: ../../library/asyncio-task.rst:457 +#: ../../library/asyncio-task.rst:504 msgid "Raises :exc:`ValueError` if *delay* is :data:`~math.nan`." msgstr "" -#: ../../library/asyncio-task.rst:462 +#: ../../library/asyncio-task.rst:509 msgid "Running Tasks Concurrently" msgstr "" -#: ../../library/asyncio-task.rst:466 +#: ../../library/asyncio-task.rst:513 msgid "" "Run :ref:`awaitable objects ` in the *aws* sequence " "*concurrently*." msgstr "" -#: ../../library/asyncio-task.rst:469 +#: ../../library/asyncio-task.rst:516 msgid "" "If any awaitable in *aws* is a coroutine, it is automatically scheduled as a " "Task." msgstr "" -#: ../../library/asyncio-task.rst:472 +#: ../../library/asyncio-task.rst:519 msgid "" "If all awaitables are completed successfully, the result is an aggregate " "list of returned values. The order of result values corresponds to the " "order of awaitables in *aws*." msgstr "" -#: ../../library/asyncio-task.rst:476 +#: ../../library/asyncio-task.rst:523 msgid "" "If *return_exceptions* is ``False`` (default), the first raised exception is " "immediately propagated to the task that awaits on ``gather()``. Other " @@ -701,19 +756,19 @@ msgid "" "run." msgstr "" -#: ../../library/asyncio-task.rst:481 +#: ../../library/asyncio-task.rst:528 msgid "" "If *return_exceptions* is ``True``, exceptions are treated the same as " "successful results, and aggregated in the result list." msgstr "" -#: ../../library/asyncio-task.rst:484 +#: ../../library/asyncio-task.rst:531 msgid "" "If ``gather()`` is *cancelled*, all submitted awaitables (that have not " "completed yet) are also *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:487 +#: ../../library/asyncio-task.rst:534 msgid "" "If any Task or Future from the *aws* sequence is *cancelled*, it is treated " "as if it raised :exc:`CancelledError` -- the ``gather()`` call is **not** " @@ -721,7 +776,7 @@ msgid "" "submitted Task/Future to cause other Tasks/Futures to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:494 +#: ../../library/asyncio-task.rst:541 msgid "" "A new alternative to create and run tasks concurrently and wait for their " "completion is :class:`asyncio.TaskGroup`. *TaskGroup* provides stronger " @@ -731,7 +786,7 @@ msgid "" "tasks)." msgstr "" -#: ../../library/asyncio-task.rst:505 +#: ../../library/asyncio-task.rst:552 msgid "" "import asyncio\n" "\n" @@ -770,7 +825,7 @@ msgid "" "# [2, 6, 24]" msgstr "" -#: ../../library/asyncio-task.rst:541 +#: ../../library/asyncio-task.rst:588 msgid "" "If *return_exceptions* is false, cancelling gather() after it has been " "marked done won't cancel any submitted awaitables. For instance, gather can " @@ -779,28 +834,28 @@ msgid "" "the awaitables) from gather won't cancel any other awaitables." msgstr "" -#: ../../library/asyncio-task.rst:548 +#: ../../library/asyncio-task.rst:595 msgid "" "If the *gather* itself is cancelled, the cancellation is propagated " "regardless of *return_exceptions*." msgstr "" -#: ../../library/asyncio-task.rst:555 +#: ../../library/asyncio-task.rst:602 msgid "" "Deprecation warning is emitted if no positional arguments are provided or " "not all positional arguments are Future-like objects and there is no running " "event loop." msgstr "" -#: ../../library/asyncio-task.rst:564 +#: ../../library/asyncio-task.rst:611 msgid "Eager Task Factory" msgstr "" -#: ../../library/asyncio-task.rst:568 +#: ../../library/asyncio-task.rst:615 msgid "A task factory for eager task execution." msgstr "" -#: ../../library/asyncio-task.rst:570 +#: ../../library/asyncio-task.rst:617 msgid "" "When using this factory (via :meth:`loop.set_task_factory(asyncio." "eager_task_factory) `), coroutines begin execution " @@ -810,13 +865,13 @@ msgid "" "synchronously." msgstr "" -#: ../../library/asyncio-task.rst:576 +#: ../../library/asyncio-task.rst:623 msgid "" "A common example where this is beneficial is coroutines which employ caching " "or memoization to avoid actual I/O when possible." msgstr "" -#: ../../library/asyncio-task.rst:581 +#: ../../library/asyncio-task.rst:628 msgid "" "Immediate execution of the coroutine is a semantic change. If the coroutine " "returns or raises, the task is never scheduled to the event loop. If the " @@ -825,46 +880,46 @@ msgid "" "the application's task execution order is likely to change." msgstr "" -#: ../../library/asyncio-task.rst:592 +#: ../../library/asyncio-task.rst:639 msgid "" "Create an eager task factory, similar to :func:`eager_task_factory`, using " "the provided *custom_task_constructor* when creating a new task instead of " "the default :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:596 +#: ../../library/asyncio-task.rst:643 msgid "" "*custom_task_constructor* must be a *callable* with the signature matching " "the signature of :class:`Task.__init__ `. The callable must return a :" "class:`asyncio.Task`-compatible object." msgstr "" -#: ../../library/asyncio-task.rst:600 +#: ../../library/asyncio-task.rst:647 msgid "" "This function returns a *callable* intended to be used as a task factory of " "an event loop via :meth:`loop.set_task_factory(factory) `)." msgstr "" -#: ../../library/asyncio-task.rst:607 +#: ../../library/asyncio-task.rst:654 msgid "Shielding From Cancellation" msgstr "" -#: ../../library/asyncio-task.rst:611 +#: ../../library/asyncio-task.rst:658 msgid "" "Protect an :ref:`awaitable object ` from being :meth:" "`cancelled `." msgstr "" -#: ../../library/asyncio-task.rst:614 ../../library/asyncio-task.rst:780 +#: ../../library/asyncio-task.rst:661 ../../library/asyncio-task.rst:827 msgid "If *aw* is a coroutine it is automatically scheduled as a Task." msgstr "" -#: ../../library/asyncio-task.rst:616 +#: ../../library/asyncio-task.rst:663 msgid "The statement::" msgstr "" -#: ../../library/asyncio-task.rst:618 +#: ../../library/asyncio-task.rst:665 msgid "" "task = asyncio.create_task(something())\n" "res = await shield(task)" @@ -872,15 +927,15 @@ msgstr "" "task = asyncio.create_task(something())\n" "res = await shield(task)" -#: ../../library/asyncio-task.rst:621 +#: ../../library/asyncio-task.rst:668 msgid "is equivalent to::" msgstr "" -#: ../../library/asyncio-task.rst:623 +#: ../../library/asyncio-task.rst:670 msgid "res = await something()" msgstr "res = await something()" -#: ../../library/asyncio-task.rst:625 +#: ../../library/asyncio-task.rst:672 msgid "" "*except* that if the coroutine containing it is cancelled, the Task running " "in ``something()`` is not cancelled. From the point of view of " @@ -889,20 +944,20 @@ msgid "" "`CancelledError`." msgstr "" -#: ../../library/asyncio-task.rst:631 +#: ../../library/asyncio-task.rst:678 msgid "" "If ``something()`` is cancelled by other means (i.e. from within itself) " "that would also cancel ``shield()``." msgstr "" -#: ../../library/asyncio-task.rst:634 +#: ../../library/asyncio-task.rst:681 msgid "" "If it is desired to completely ignore cancellation (not recommended) the " "``shield()`` function should be combined with a try/except clause, as " "follows::" msgstr "" -#: ../../library/asyncio-task.rst:638 +#: ../../library/asyncio-task.rst:685 msgid "" "task = asyncio.create_task(something())\n" "try:\n" @@ -916,7 +971,7 @@ msgstr "" "except CancelledError:\n" " res = None" -#: ../../library/asyncio-task.rst:646 +#: ../../library/asyncio-task.rst:693 msgid "" "Save a reference to tasks passed to this function, to avoid a task " "disappearing mid-execution. The event loop only keeps weak references to " @@ -924,36 +979,36 @@ msgid "" "any time, even before it's done." msgstr "" -#: ../../library/asyncio-task.rst:654 +#: ../../library/asyncio-task.rst:701 msgid "" "Deprecation warning is emitted if *aw* is not Future-like object and there " "is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:660 +#: ../../library/asyncio-task.rst:707 msgid "Timeouts" msgstr "" -#: ../../library/asyncio-task.rst:664 +#: ../../library/asyncio-task.rst:711 msgid "" "Return an :ref:`asynchronous context manager ` that " "can be used to limit the amount of time spent waiting on something." msgstr "" -#: ../../library/asyncio-task.rst:668 +#: ../../library/asyncio-task.rst:715 msgid "" "*delay* can either be ``None``, or a float/int number of seconds to wait. If " "*delay* is ``None``, no time limit will be applied; this can be useful if " "the delay is unknown when the context manager is created." msgstr "" -#: ../../library/asyncio-task.rst:673 +#: ../../library/asyncio-task.rst:720 msgid "" "In either case, the context manager can be rescheduled after creation using :" "meth:`Timeout.reschedule`." msgstr "" -#: ../../library/asyncio-task.rst:678 +#: ../../library/asyncio-task.rst:725 msgid "" "async def main():\n" " async with asyncio.timeout(10):\n" @@ -963,7 +1018,7 @@ msgstr "" " async with asyncio.timeout(10):\n" " await long_running_task()" -#: ../../library/asyncio-task.rst:682 +#: ../../library/asyncio-task.rst:729 msgid "" "If ``long_running_task`` takes more than 10 seconds to complete, the context " "manager will cancel the current task and handle the resulting :exc:`asyncio." @@ -971,18 +1026,18 @@ msgid "" "can be caught and handled." msgstr "" -#: ../../library/asyncio-task.rst:689 +#: ../../library/asyncio-task.rst:736 msgid "" "The :func:`asyncio.timeout` context manager is what transforms the :exc:" "`asyncio.CancelledError` into a :exc:`TimeoutError`, which means the :exc:" "`TimeoutError` can only be caught *outside* of the context manager." msgstr "" -#: ../../library/asyncio-task.rst:694 +#: ../../library/asyncio-task.rst:741 msgid "Example of catching :exc:`TimeoutError`::" msgstr "" -#: ../../library/asyncio-task.rst:696 +#: ../../library/asyncio-task.rst:743 msgid "" "async def main():\n" " try:\n" @@ -994,48 +1049,48 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -#: ../../library/asyncio-task.rst:705 +#: ../../library/asyncio-task.rst:752 msgid "" "The context manager produced by :func:`asyncio.timeout` can be rescheduled " "to a different deadline and inspected." msgstr "" -#: ../../library/asyncio-task.rst:710 +#: ../../library/asyncio-task.rst:757 msgid "" "An :ref:`asynchronous context manager ` for " "cancelling overdue coroutines." msgstr "" -#: ../../library/asyncio-task.rst:713 +#: ../../library/asyncio-task.rst:760 msgid "" "``when`` should be an absolute time at which the context should time out, as " "measured by the event loop's clock:" msgstr "" -#: ../../library/asyncio-task.rst:716 +#: ../../library/asyncio-task.rst:763 msgid "If ``when`` is ``None``, the timeout will never trigger." msgstr "" -#: ../../library/asyncio-task.rst:717 +#: ../../library/asyncio-task.rst:764 msgid "" "If ``when < loop.time()``, the timeout will trigger on the next iteration of " "the event loop." msgstr "" -#: ../../library/asyncio-task.rst:722 +#: ../../library/asyncio-task.rst:769 msgid "" "Return the current deadline, or ``None`` if the current deadline is not set." msgstr "" -#: ../../library/asyncio-task.rst:727 +#: ../../library/asyncio-task.rst:774 msgid "Reschedule the timeout." msgstr "" -#: ../../library/asyncio-task.rst:731 +#: ../../library/asyncio-task.rst:778 msgid "Return whether the context manager has exceeded its deadline (expired)." msgstr "" -#: ../../library/asyncio-task.rst:736 +#: ../../library/asyncio-task.rst:783 msgid "" "async def main():\n" " try:\n" @@ -1053,17 +1108,17 @@ msgid "" " print(\"Looks like we haven't finished on time.\")" msgstr "" -#: ../../library/asyncio-task.rst:751 +#: ../../library/asyncio-task.rst:798 msgid "Timeout context managers can be safely nested." msgstr "" -#: ../../library/asyncio-task.rst:757 +#: ../../library/asyncio-task.rst:804 msgid "" "Similar to :func:`asyncio.timeout`, except *when* is the absolute time to " "stop waiting, or ``None``." msgstr "" -#: ../../library/asyncio-task.rst:762 +#: ../../library/asyncio-task.rst:809 msgid "" "async def main():\n" " loop = get_running_loop()\n" @@ -1077,41 +1132,41 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -#: ../../library/asyncio-task.rst:777 +#: ../../library/asyncio-task.rst:824 msgid "" "Wait for the *aw* :ref:`awaitable ` to complete with a " "timeout." msgstr "" -#: ../../library/asyncio-task.rst:782 +#: ../../library/asyncio-task.rst:829 msgid "" "*timeout* can either be ``None`` or a float or int number of seconds to wait " "for. If *timeout* is ``None``, block until the future completes." msgstr "" -#: ../../library/asyncio-task.rst:786 +#: ../../library/asyncio-task.rst:833 msgid "" "If a timeout occurs, it cancels the task and raises :exc:`TimeoutError`." msgstr "" -#: ../../library/asyncio-task.rst:789 +#: ../../library/asyncio-task.rst:836 msgid "" "To avoid the task :meth:`cancellation `, wrap it in :func:" "`shield`." msgstr "" -#: ../../library/asyncio-task.rst:792 +#: ../../library/asyncio-task.rst:839 msgid "" "The function will wait until the future is actually cancelled, so the total " "wait time may exceed the *timeout*. If an exception happens during " "cancellation, it is propagated." msgstr "" -#: ../../library/asyncio-task.rst:796 +#: ../../library/asyncio-task.rst:843 msgid "If the wait is cancelled, the future *aw* is also cancelled." msgstr "" -#: ../../library/asyncio-task.rst:802 +#: ../../library/asyncio-task.rst:849 msgid "" "async def eternity():\n" " # Sleep for one hour\n" @@ -1132,107 +1187,107 @@ msgid "" "# timeout!" msgstr "" -#: ../../library/asyncio-task.rst:820 +#: ../../library/asyncio-task.rst:867 msgid "" "When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be " "cancelled. Previously, it raised :exc:`TimeoutError` immediately." msgstr "" -#: ../../library/asyncio-task.rst:828 +#: ../../library/asyncio-task.rst:875 msgid "Raises :exc:`TimeoutError` instead of :exc:`asyncio.TimeoutError`." msgstr "引發 :exc:`TimeoutError` 而不是 :exc:`asyncio.TimeoutError`。" -#: ../../library/asyncio-task.rst:833 +#: ../../library/asyncio-task.rst:880 msgid "Waiting Primitives" msgstr "" -#: ../../library/asyncio-task.rst:837 +#: ../../library/asyncio-task.rst:884 msgid "" "Run :class:`~asyncio.Future` and :class:`~asyncio.Task` instances in the " "*aws* iterable concurrently and block until the condition specified by " "*return_when*." msgstr "" -#: ../../library/asyncio-task.rst:841 +#: ../../library/asyncio-task.rst:888 msgid "The *aws* iterable must not be empty." msgstr "" -#: ../../library/asyncio-task.rst:843 +#: ../../library/asyncio-task.rst:890 msgid "Returns two sets of Tasks/Futures: ``(done, pending)``." msgstr "" -#: ../../library/asyncio-task.rst:845 +#: ../../library/asyncio-task.rst:892 msgid "Usage::" msgstr "用法: ::" -#: ../../library/asyncio-task.rst:847 +#: ../../library/asyncio-task.rst:894 msgid "done, pending = await asyncio.wait(aws)" msgstr "done, pending = await asyncio.wait(aws)" -#: ../../library/asyncio-task.rst:849 +#: ../../library/asyncio-task.rst:896 msgid "" "*timeout* (a float or int), if specified, can be used to control the maximum " "number of seconds to wait before returning." msgstr "" -#: ../../library/asyncio-task.rst:852 +#: ../../library/asyncio-task.rst:899 msgid "" "Note that this function does not raise :exc:`TimeoutError`. Futures or Tasks " "that aren't done when the timeout occurs are simply returned in the second " "set." msgstr "" -#: ../../library/asyncio-task.rst:856 +#: ../../library/asyncio-task.rst:903 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "" -#: ../../library/asyncio-task.rst:862 +#: ../../library/asyncio-task.rst:909 msgid "Constant" msgstr "常數" -#: ../../library/asyncio-task.rst:863 +#: ../../library/asyncio-task.rst:910 msgid "Description" msgstr "描述" -#: ../../library/asyncio-task.rst:866 +#: ../../library/asyncio-task.rst:913 msgid "The function will return when any future finishes or is cancelled." msgstr "" -#: ../../library/asyncio-task.rst:869 +#: ../../library/asyncio-task.rst:916 msgid "" "The function will return when any future finishes by raising an exception. " "If no future raises an exception then it is equivalent to :const:" "`ALL_COMPLETED`." msgstr "" -#: ../../library/asyncio-task.rst:874 +#: ../../library/asyncio-task.rst:921 msgid "The function will return when all futures finish or are cancelled." msgstr "" -#: ../../library/asyncio-task.rst:876 +#: ../../library/asyncio-task.rst:923 msgid "" "Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the futures " "when a timeout occurs." msgstr "" -#: ../../library/asyncio-task.rst:882 +#: ../../library/asyncio-task.rst:929 msgid "Passing coroutine objects to ``wait()`` directly is forbidden." msgstr "" -#: ../../library/asyncio-task.rst:885 ../../library/asyncio-task.rst:943 +#: ../../library/asyncio-task.rst:932 ../../library/asyncio-task.rst:990 msgid "Added support for generators yielding tasks." msgstr "" -#: ../../library/asyncio-task.rst:891 +#: ../../library/asyncio-task.rst:938 msgid "" "Run :ref:`awaitable objects ` in the *aws* iterable " "concurrently. The returned object can be iterated to obtain the results of " "the awaitables as they finish." msgstr "" -#: ../../library/asyncio-task.rst:895 +#: ../../library/asyncio-task.rst:942 msgid "" "The object returned by ``as_completed()`` can be iterated as an :term:" "`asynchronous iterator` or a plain :term:`iterator`. When asynchronous " @@ -1241,7 +1296,7 @@ msgid "" "tasks with their results. Example::" msgstr "" -#: ../../library/asyncio-task.rst:901 +#: ../../library/asyncio-task.rst:948 msgid "" "ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" "ipv6_connect = create_task(open_connection(\"::1\", 80))\n" @@ -1258,20 +1313,20 @@ msgid "" " print(\"IPv4 connection established.\")" msgstr "" -#: ../../library/asyncio-task.rst:915 +#: ../../library/asyncio-task.rst:962 msgid "" "During asynchronous iteration, implicitly-created tasks will be yielded for " "supplied awaitables that aren't tasks or futures." msgstr "" -#: ../../library/asyncio-task.rst:918 +#: ../../library/asyncio-task.rst:965 msgid "" "When used as a plain iterator, each iteration yields a new coroutine that " "returns the result or raises the exception of the next completed awaitable. " "This pattern is compatible with Python versions older than 3.13::" msgstr "" -#: ../../library/asyncio-task.rst:922 +#: ../../library/asyncio-task.rst:969 msgid "" "ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" "ipv6_connect = create_task(open_connection(\"::1\", 80))\n" @@ -1284,34 +1339,34 @@ msgid "" " reader, writer = await next_connect" msgstr "" -#: ../../library/asyncio-task.rst:932 +#: ../../library/asyncio-task.rst:979 msgid "" "A :exc:`TimeoutError` is raised if the timeout occurs before all awaitables " "are done. This is raised by the ``async for`` loop during asynchronous " "iteration or by the coroutines yielded during plain iteration." msgstr "" -#: ../../library/asyncio-task.rst:939 +#: ../../library/asyncio-task.rst:986 msgid "" "Deprecation warning is emitted if not all awaitable objects in the *aws* " "iterable are Future-like objects and there is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:946 +#: ../../library/asyncio-task.rst:993 msgid "" "The result can now be used as either an :term:`asynchronous iterator` or as " "a plain :term:`iterator` (previously it was only a plain iterator)." msgstr "" -#: ../../library/asyncio-task.rst:952 +#: ../../library/asyncio-task.rst:999 msgid "Running in Threads" msgstr "" -#: ../../library/asyncio-task.rst:956 +#: ../../library/asyncio-task.rst:1003 msgid "Asynchronously run function *func* in a separate thread." msgstr "" -#: ../../library/asyncio-task.rst:958 +#: ../../library/asyncio-task.rst:1005 msgid "" "Any \\*args and \\*\\*kwargs supplied for this function are directly passed " "to *func*. Also, the current :class:`contextvars.Context` is propagated, " @@ -1319,19 +1374,19 @@ msgid "" "separate thread." msgstr "" -#: ../../library/asyncio-task.rst:963 +#: ../../library/asyncio-task.rst:1010 msgid "" "Return a coroutine that can be awaited to get the eventual result of *func*." msgstr "" -#: ../../library/asyncio-task.rst:965 +#: ../../library/asyncio-task.rst:1012 msgid "" "This coroutine function is primarily intended to be used for executing IO-" "bound functions/methods that would otherwise block the event loop if they " "were run in the main thread. For example::" msgstr "" -#: ../../library/asyncio-task.rst:969 +#: ../../library/asyncio-task.rst:1016 msgid "" "def blocking_io():\n" " print(f\"start blocking_io at {time.strftime('%X')}\")\n" @@ -1360,7 +1415,7 @@ msgid "" "# finished main at 19:50:54" msgstr "" -#: ../../library/asyncio-task.rst:995 +#: ../../library/asyncio-task.rst:1042 msgid "" "Directly calling ``blocking_io()`` in any coroutine would block the event " "loop for its duration, resulting in an additional 1 second of run time. " @@ -1368,7 +1423,7 @@ msgid "" "thread without blocking the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1002 +#: ../../library/asyncio-task.rst:1049 msgid "" "Due to the :term:`GIL`, ``asyncio.to_thread()`` can typically only be used " "to make IO-bound functions non-blocking. However, for extension modules that " @@ -1376,27 +1431,27 @@ msgid "" "``asyncio.to_thread()`` can also be used for CPU-bound functions." msgstr "" -#: ../../library/asyncio-task.rst:1011 +#: ../../library/asyncio-task.rst:1058 msgid "Scheduling From Other Threads" msgstr "" -#: ../../library/asyncio-task.rst:1015 +#: ../../library/asyncio-task.rst:1062 msgid "Submit a coroutine to the given event loop. Thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:1017 +#: ../../library/asyncio-task.rst:1064 msgid "" "Return a :class:`concurrent.futures.Future` to wait for the result from " "another OS thread." msgstr "" -#: ../../library/asyncio-task.rst:1020 +#: ../../library/asyncio-task.rst:1067 msgid "" "This function is meant to be called from a different OS thread than the one " "where the event loop is running. Example::" msgstr "" -#: ../../library/asyncio-task.rst:1023 +#: ../../library/asyncio-task.rst:1070 msgid "" "# Create a coroutine\n" "coro = asyncio.sleep(1, result=3)\n" @@ -1408,13 +1463,13 @@ msgid "" "assert future.result(timeout) == 3" msgstr "" -#: ../../library/asyncio-task.rst:1032 +#: ../../library/asyncio-task.rst:1079 msgid "" "If an exception is raised in the coroutine, the returned Future will be " "notified. It can also be used to cancel the task in the event loop::" msgstr "" -#: ../../library/asyncio-task.rst:1036 +#: ../../library/asyncio-task.rst:1083 msgid "" "try:\n" " result = future.result(timeout)\n" @@ -1427,59 +1482,59 @@ msgid "" " print(f'The coroutine returned: {result!r}')" msgstr "" -#: ../../library/asyncio-task.rst:1046 +#: ../../library/asyncio-task.rst:1093 msgid "" "See the :ref:`concurrency and multithreading ` " "section of the documentation." msgstr "" -#: ../../library/asyncio-task.rst:1049 +#: ../../library/asyncio-task.rst:1096 msgid "" "Unlike other asyncio functions this function requires the *loop* argument to " "be passed explicitly." msgstr "" -#: ../../library/asyncio-task.rst:1056 +#: ../../library/asyncio-task.rst:1103 msgid "Introspection" msgstr "" -#: ../../library/asyncio-task.rst:1061 +#: ../../library/asyncio-task.rst:1108 msgid "" "Return the currently running :class:`Task` instance, or ``None`` if no task " "is running." msgstr "" -#: ../../library/asyncio-task.rst:1064 +#: ../../library/asyncio-task.rst:1111 msgid "" "If *loop* is ``None`` :func:`get_running_loop` is used to get the current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:1072 +#: ../../library/asyncio-task.rst:1119 msgid "Return a set of not yet finished :class:`Task` objects run by the loop." msgstr "" -#: ../../library/asyncio-task.rst:1075 +#: ../../library/asyncio-task.rst:1122 msgid "" "If *loop* is ``None``, :func:`get_running_loop` is used for getting current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:1083 +#: ../../library/asyncio-task.rst:1130 msgid "Return ``True`` if *obj* is a coroutine object." msgstr "" -#: ../../library/asyncio-task.rst:1089 +#: ../../library/asyncio-task.rst:1136 msgid "Task Object" msgstr "" -#: ../../library/asyncio-task.rst:1093 +#: ../../library/asyncio-task.rst:1140 msgid "" "A :class:`Future-like ` object that runs a Python :ref:`coroutine " "`. Not thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:1096 +#: ../../library/asyncio-task.rst:1143 msgid "" "Tasks are used to run coroutines in event loops. If a coroutine awaits on a " "Future, the Task suspends the execution of the coroutine and waits for the " @@ -1487,21 +1542,21 @@ msgid "" "wrapped coroutine resumes." msgstr "" -#: ../../library/asyncio-task.rst:1102 +#: ../../library/asyncio-task.rst:1149 msgid "" "Event loops use cooperative scheduling: an event loop runs one Task at a " "time. While a Task awaits for the completion of a Future, the event loop " "runs other Tasks, callbacks, or performs IO operations." msgstr "" -#: ../../library/asyncio-task.rst:1107 +#: ../../library/asyncio-task.rst:1154 msgid "" "Use the high-level :func:`asyncio.create_task` function to create Tasks, or " "the low-level :meth:`loop.create_task` or :func:`ensure_future` functions. " "Manual instantiation of Tasks is discouraged." msgstr "" -#: ../../library/asyncio-task.rst:1112 +#: ../../library/asyncio-task.rst:1159 msgid "" "To cancel a running Task use the :meth:`cancel` method. Calling it will " "cause the Task to throw a :exc:`CancelledError` exception into the wrapped " @@ -1509,20 +1564,20 @@ msgid "" "cancellation, the Future object will be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1117 +#: ../../library/asyncio-task.rst:1164 msgid "" ":meth:`cancelled` can be used to check if the Task was cancelled. The method " "returns ``True`` if the wrapped coroutine did not suppress the :exc:" "`CancelledError` exception and was actually cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1122 +#: ../../library/asyncio-task.rst:1169 msgid "" ":class:`asyncio.Task` inherits from :class:`Future` all of its APIs except :" "meth:`Future.set_result` and :meth:`Future.set_exception`." msgstr "" -#: ../../library/asyncio-task.rst:1126 +#: ../../library/asyncio-task.rst:1173 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *coro* to run in. If no *context* is " @@ -1530,7 +1585,7 @@ msgid "" "in the copied context." msgstr "" -#: ../../library/asyncio-task.rst:1131 +#: ../../library/asyncio-task.rst:1178 msgid "" "An optional keyword-only *eager_start* argument allows eagerly starting the " "execution of the :class:`asyncio.Task` at task creation time. If set to " @@ -1540,96 +1595,96 @@ msgid "" "eagerly and will skip scheduling to the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1138 +#: ../../library/asyncio-task.rst:1185 msgid "Added support for the :mod:`contextvars` module." msgstr "" -#: ../../library/asyncio-task.rst:1144 +#: ../../library/asyncio-task.rst:1191 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" -#: ../../library/asyncio-task.rst:1151 +#: ../../library/asyncio-task.rst:1198 msgid "Added the *eager_start* parameter." msgstr "新增 *eager_start* 參數。" -#: ../../library/asyncio-task.rst:1156 +#: ../../library/asyncio-task.rst:1203 msgid "Return ``True`` if the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:1158 +#: ../../library/asyncio-task.rst:1205 msgid "" "A Task is *done* when the wrapped coroutine either returned a value, raised " "an exception, or the Task was cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1163 +#: ../../library/asyncio-task.rst:1210 msgid "Return the result of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1165 +#: ../../library/asyncio-task.rst:1212 msgid "" "If the Task is *done*, the result of the wrapped coroutine is returned (or " "if the coroutine raised an exception, that exception is re-raised.)" msgstr "" -#: ../../library/asyncio-task.rst:1169 ../../library/asyncio-task.rst:1183 +#: ../../library/asyncio-task.rst:1216 ../../library/asyncio-task.rst:1230 msgid "" "If the Task has been *cancelled*, this method raises a :exc:`CancelledError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:1172 +#: ../../library/asyncio-task.rst:1219 msgid "" "If the Task's result isn't yet available, this method raises an :exc:" "`InvalidStateError` exception." msgstr "" -#: ../../library/asyncio-task.rst:1177 +#: ../../library/asyncio-task.rst:1224 msgid "Return the exception of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1179 +#: ../../library/asyncio-task.rst:1226 msgid "" "If the wrapped coroutine raised an exception that exception is returned. If " "the wrapped coroutine returned normally this method returns ``None``." msgstr "" -#: ../../library/asyncio-task.rst:1186 +#: ../../library/asyncio-task.rst:1233 msgid "" "If the Task isn't *done* yet, this method raises an :exc:`InvalidStateError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:1191 +#: ../../library/asyncio-task.rst:1238 msgid "Add a callback to be run when the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:1193 ../../library/asyncio-task.rst:1202 +#: ../../library/asyncio-task.rst:1240 ../../library/asyncio-task.rst:1249 msgid "This method should only be used in low-level callback-based code." msgstr "" -#: ../../library/asyncio-task.rst:1195 +#: ../../library/asyncio-task.rst:1242 msgid "" "See the documentation of :meth:`Future.add_done_callback` for more details." msgstr "" -#: ../../library/asyncio-task.rst:1200 +#: ../../library/asyncio-task.rst:1247 msgid "Remove *callback* from the callbacks list." msgstr "" -#: ../../library/asyncio-task.rst:1204 +#: ../../library/asyncio-task.rst:1251 msgid "" "See the documentation of :meth:`Future.remove_done_callback` for more " "details." msgstr "" -#: ../../library/asyncio-task.rst:1209 +#: ../../library/asyncio-task.rst:1256 msgid "Return the list of stack frames for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1211 +#: ../../library/asyncio-task.rst:1258 msgid "" "If the wrapped coroutine is not done, this returns the stack where it is " "suspended. If the coroutine has completed successfully or was cancelled, " @@ -1637,15 +1692,15 @@ msgid "" "this returns the list of traceback frames." msgstr "" -#: ../../library/asyncio-task.rst:1217 +#: ../../library/asyncio-task.rst:1264 msgid "The frames are always ordered from oldest to newest." msgstr "" -#: ../../library/asyncio-task.rst:1219 +#: ../../library/asyncio-task.rst:1266 msgid "Only one stack frame is returned for a suspended coroutine." msgstr "" -#: ../../library/asyncio-task.rst:1221 +#: ../../library/asyncio-task.rst:1268 msgid "" "The optional *limit* argument sets the maximum number of frames to return; " "by default all available frames are returned. The ordering of the returned " @@ -1654,81 +1709,81 @@ msgid "" "are returned. (This matches the behavior of the traceback module.)" msgstr "" -#: ../../library/asyncio-task.rst:1230 +#: ../../library/asyncio-task.rst:1277 msgid "Print the stack or traceback for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1232 +#: ../../library/asyncio-task.rst:1279 msgid "" "This produces output similar to that of the traceback module for the frames " "retrieved by :meth:`get_stack`." msgstr "" -#: ../../library/asyncio-task.rst:1235 +#: ../../library/asyncio-task.rst:1282 msgid "The *limit* argument is passed to :meth:`get_stack` directly." msgstr "" -#: ../../library/asyncio-task.rst:1237 +#: ../../library/asyncio-task.rst:1284 msgid "" "The *file* argument is an I/O stream to which the output is written; by " "default output is written to :data:`sys.stdout`." msgstr "" -#: ../../library/asyncio-task.rst:1242 +#: ../../library/asyncio-task.rst:1289 msgid "Return the coroutine object wrapped by the :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:1246 +#: ../../library/asyncio-task.rst:1293 msgid "" "This will return ``None`` for Tasks which have already completed eagerly. " "See the :ref:`Eager Task Factory `." msgstr "" -#: ../../library/asyncio-task.rst:1253 +#: ../../library/asyncio-task.rst:1300 msgid "Newly added eager task execution means result may be ``None``." msgstr "" -#: ../../library/asyncio-task.rst:1257 +#: ../../library/asyncio-task.rst:1304 msgid "" "Return the :class:`contextvars.Context` object associated with the task." msgstr "" -#: ../../library/asyncio-task.rst:1264 +#: ../../library/asyncio-task.rst:1311 msgid "Return the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1266 +#: ../../library/asyncio-task.rst:1313 msgid "" "If no name has been explicitly assigned to the Task, the default asyncio " "Task implementation generates a default name during instantiation." msgstr "" -#: ../../library/asyncio-task.rst:1274 +#: ../../library/asyncio-task.rst:1321 msgid "Set the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1276 +#: ../../library/asyncio-task.rst:1323 msgid "" "The *value* argument can be any object, which is then converted to a string." msgstr "" -#: ../../library/asyncio-task.rst:1279 +#: ../../library/asyncio-task.rst:1326 msgid "" "In the default Task implementation, the name will be visible in the :func:" "`repr` output of a task object." msgstr "" -#: ../../library/asyncio-task.rst:1286 +#: ../../library/asyncio-task.rst:1333 msgid "Request the Task to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1288 +#: ../../library/asyncio-task.rst:1335 msgid "" "This arranges for a :exc:`CancelledError` exception to be thrown into the " "wrapped coroutine on the next cycle of the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1291 +#: ../../library/asyncio-task.rst:1338 msgid "" "The coroutine then has a chance to clean up or even deny the request by " "suppressing the exception with a :keyword:`try` ... ... ``except " @@ -1740,21 +1795,21 @@ msgid "" "addition to catching the exception." msgstr "" -#: ../../library/asyncio-task.rst:1301 +#: ../../library/asyncio-task.rst:1348 msgid "Added the *msg* parameter." msgstr "新增 *msg* 參數。" -#: ../../library/asyncio-task.rst:1304 +#: ../../library/asyncio-task.rst:1351 msgid "The ``msg`` parameter is propagated from cancelled task to its awaiter." msgstr "" -#: ../../library/asyncio-task.rst:1309 +#: ../../library/asyncio-task.rst:1356 msgid "" "The following example illustrates how coroutines can intercept the " "cancellation request::" msgstr "" -#: ../../library/asyncio-task.rst:1312 +#: ../../library/asyncio-task.rst:1359 msgid "" "async def cancel_me():\n" " print('cancel_me(): before sleep')\n" @@ -1791,32 +1846,32 @@ msgid "" "# main(): cancel_me is cancelled now" msgstr "" -#: ../../library/asyncio-task.rst:1348 +#: ../../library/asyncio-task.rst:1395 msgid "Return ``True`` if the Task is *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:1350 +#: ../../library/asyncio-task.rst:1397 msgid "" "The Task is *cancelled* when the cancellation was requested with :meth:" "`cancel` and the wrapped coroutine propagated the :exc:`CancelledError` " "exception thrown into it." msgstr "" -#: ../../library/asyncio-task.rst:1356 +#: ../../library/asyncio-task.rst:1403 msgid "Decrement the count of cancellation requests to this Task." msgstr "" -#: ../../library/asyncio-task.rst:1358 +#: ../../library/asyncio-task.rst:1405 msgid "Returns the remaining number of cancellation requests." msgstr "" -#: ../../library/asyncio-task.rst:1360 +#: ../../library/asyncio-task.rst:1407 msgid "" "Note that once execution of a cancelled task completed, further calls to :" "meth:`uncancel` are ineffective." msgstr "" -#: ../../library/asyncio-task.rst:1365 +#: ../../library/asyncio-task.rst:1412 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. In particular, if a Task gets successfully uncancelled, this " @@ -1825,7 +1880,7 @@ msgid "" "respective structured block. For example::" msgstr "" -#: ../../library/asyncio-task.rst:1372 +#: ../../library/asyncio-task.rst:1419 msgid "" "async def make_request_with_timeout():\n" " try:\n" @@ -1839,7 +1894,7 @@ msgid "" " await unrelated_code()" msgstr "" -#: ../../library/asyncio-task.rst:1383 +#: ../../library/asyncio-task.rst:1430 msgid "" "While the block with ``make_request()`` and ``make_another_request()`` might " "get cancelled due to the timeout, ``unrelated_code()`` should continue " @@ -1848,14 +1903,14 @@ msgid "" "similar fashion." msgstr "" -#: ../../library/asyncio-task.rst:1389 +#: ../../library/asyncio-task.rst:1436 msgid "" "If end-user code is, for some reason, suppressing cancellation by catching :" "exc:`CancelledError`, it needs to call this method to remove the " "cancellation state." msgstr "" -#: ../../library/asyncio-task.rst:1393 +#: ../../library/asyncio-task.rst:1440 msgid "" "When this method decrements the cancellation count to zero, the method " "checks if a previous :meth:`cancel` call had arranged for :exc:" @@ -1864,17 +1919,17 @@ msgid "" "``_must_cancel`` flag)." msgstr "" -#: ../../library/asyncio-task.rst:1399 +#: ../../library/asyncio-task.rst:1446 msgid "Changed to rescind pending cancellation requests upon reaching zero." msgstr "" -#: ../../library/asyncio-task.rst:1404 +#: ../../library/asyncio-task.rst:1451 msgid "" "Return the number of pending cancellation requests to this Task, i.e., the " "number of calls to :meth:`cancel` less the number of :meth:`uncancel` calls." msgstr "" -#: ../../library/asyncio-task.rst:1408 +#: ../../library/asyncio-task.rst:1455 msgid "" "Note that if this number is greater than zero but the Task is still " "executing, :meth:`cancelled` will still return ``False``. This is because " @@ -1883,7 +1938,7 @@ msgid "" "to zero." msgstr "" -#: ../../library/asyncio-task.rst:1414 +#: ../../library/asyncio-task.rst:1461 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. See :meth:`uncancel` for more details." diff --git a/library/calendar.po b/library/calendar.po index 4365ce363d..564f71a8d6 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-26 00:13+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-" @@ -532,22 +532,24 @@ msgid "The :mod:`calendar` module exports the following data attributes:" msgstr ":mod:`calendar` 模組匯出以下資料屬性:" #: ../../library/calendar.rst:396 -msgid "An array that represents the days of the week in the current locale." -msgstr "以目前語系來表示的一週每一天名稱的陣列。" +msgid "" +"A sequence that represents the days of the week in the current locale, where " +"Monday is day number 0." +msgstr "以目前語系來表示的一週每一天名稱的序列,其中週一是第 0 天。" -#: ../../library/calendar.rst:401 +#: ../../library/calendar.rst:406 msgid "" -"An array that represents the abbreviated days of the week in the current " -"locale." -msgstr "以目前語系來表示的一週每一天縮寫名稱的陣列。" +"A sequence that represents the abbreviated days of the week in the current " +"locale, where Mon is day number 0." +msgstr "以目前語系來表示的一週每一天縮寫名稱的序列,其中 Mon 是第 0 天。" -#: ../../library/calendar.rst:412 +#: ../../library/calendar.rst:421 msgid "" "Aliases for the days of the week, where ``MONDAY`` is ``0`` and ``SUNDAY`` " "is ``6``." msgstr "一週每一天的別名,其中 ``MONDAY`` 是 ``0`` 而 ``SUNDAY`` 是 ``6``。" -#: ../../library/calendar.rst:420 +#: ../../library/calendar.rst:429 msgid "" "Enumeration defining days of the week as integer constants. The members of " "this enumeration are exported to the module scope as :data:`MONDAY` through :" @@ -556,32 +558,32 @@ msgstr "" "將一週中的幾天定義為整數常數的列舉。此列舉的成員將作為 :data:`MONDAY` 到 :" "data:`SUNDAY` 匯出到模組作用域。" -#: ../../library/calendar.rst:429 +#: ../../library/calendar.rst:438 msgid "" -"An array that represents the months of the year in the current locale. This " -"follows normal convention of January being month number 1, so it has a " +"A sequence that represents the months of the year in the current locale. " +"This follows normal convention of January being month number 1, so it has a " "length of 13 and ``month_name[0]`` is the empty string." msgstr "" -"以目前語系來表示的一年每個月份名稱的陣列。它按照一般慣例以數字 1 代表一月,因" +"以目前語系來表示的一年每個月份名稱的序列。它按照一般慣例以數字 1 代表一月,因" "此它的長度為 13,而 ``month_name[0]`` 是空字串。" -#: ../../library/calendar.rst:436 +#: ../../library/calendar.rst:449 msgid "" -"An array that represents the abbreviated months of the year in the current " +"A sequence that represents the abbreviated months of the year in the current " "locale. This follows normal convention of January being month number 1, so " "it has a length of 13 and ``month_abbr[0]`` is the empty string." msgstr "" -"以目前語系來表示的一年每個月份縮寫名稱的陣列。它按照一般慣例以數字 1 代表一" +"以目前語系來表示的一年每個月份縮寫名稱的序列。它按照一般慣例以數字 1 代表一" "月,因此它的長度為 13,而 ``month_abbr[0]`` 是空字串。" -#: ../../library/calendar.rst:454 +#: ../../library/calendar.rst:470 msgid "" "Aliases for the months of the year, where ``JANUARY`` is ``1`` and " "``DECEMBER`` is ``12``." msgstr "" "一年內每個月的別名,其中 ``JANUARY`` 是 ``ㄅ`` 而 ``DECEMBER`` 是 ``12``。" -#: ../../library/calendar.rst:462 +#: ../../library/calendar.rst:478 msgid "" "Enumeration defining months of the year as integer constants. The members of " "this enumeration are exported to the module scope as :data:`JANUARY` " @@ -590,62 +592,61 @@ msgstr "" "將一年中的月份定義為整數常數的列舉。此列舉的成員將作為 :data:`JANUARY` 到 :" "data:`DECEMBER` 匯出到模組作用域。" -#: ../../library/calendar.rst:469 +#: ../../library/calendar.rst:485 msgid "The :mod:`calendar` module defines the following exceptions:" msgstr ":mod:`calendar` 模組定義了以下例外:" -#: ../../library/calendar.rst:473 +#: ../../library/calendar.rst:489 msgid "" "A subclass of :exc:`ValueError`, raised when the given month number is " "outside of the range 1-12 (inclusive)." msgstr "" ":exc:`ValueError` 的子類別,當給定的月份數字超出 1-12 範圍(含)時引發。" -#: ../../library/calendar.rst:478 +#: ../../library/calendar.rst:494 msgid "The invalid month number." msgstr "無效的月份號。" -#: ../../library/calendar.rst:483 +#: ../../library/calendar.rst:499 msgid "" "A subclass of :exc:`ValueError`, raised when the given weekday number is " "outside of the range 0-6 (inclusive)." msgstr "" ":exc:`ValueError` 的子類別,當給定的週幾的數字超出 0-6(含)範圍時引發。" -#: ../../library/calendar.rst:488 +#: ../../library/calendar.rst:504 msgid "The invalid weekday number." msgstr "無效的週幾編號。" -#: ../../library/calendar.rst:493 +#: ../../library/calendar.rst:509 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/calendar.rst:494 +#: ../../library/calendar.rst:510 msgid "" "Object-oriented interface to dates and times with similar functionality to " "the :mod:`time` module." msgstr "日期與時間的物件導向介面,和 :mod:`time` 模組有相似的功能。" -#: ../../library/calendar.rst:497 +#: ../../library/calendar.rst:513 msgid "Module :mod:`time`" msgstr ":mod:`time` 模組" -#: ../../library/calendar.rst:498 +#: ../../library/calendar.rst:514 msgid "Low-level time related functions." msgstr "底層的時間相關函式。" -#: ../../library/calendar.rst:504 +#: ../../library/calendar.rst:520 msgid "Command-Line Usage" msgstr "命令列用法" -#: ../../library/calendar.rst:508 +#: ../../library/calendar.rst:524 msgid "" "The :mod:`calendar` module can be executed as a script from the command line " "to interactively print a calendar." msgstr ":mod:`calendar` 模組可以作為腳本從命令列執行,並以互動方式列印日曆。" -#: ../../library/calendar.rst:511 -#, fuzzy +#: ../../library/calendar.rst:527 msgid "" "python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" @@ -653,13 +654,13 @@ msgid "" msgstr "" "python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" -" [year] [month]" +" [-f FIRST_WEEKDAY] [year] [month]" -#: ../../library/calendar.rst:518 +#: ../../library/calendar.rst:534 msgid "For example, to print a calendar for the year 2000:" msgstr "例如,要列印 2000 年的日曆:" -#: ../../library/calendar.rst:520 +#: ../../library/calendar.rst:536 msgid "" "$ python -m calendar 2000\n" " 2000\n" @@ -737,42 +738,40 @@ msgstr "" "23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31\n" "30 31" -#: ../../library/calendar.rst:561 +#: ../../library/calendar.rst:577 msgid "The following options are accepted:" msgstr "接受以下選項:" -#: ../../library/calendar.rst:568 +#: ../../library/calendar.rst:584 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/calendar.rst:573 +#: ../../library/calendar.rst:589 msgid "The locale to use for month and weekday names. Defaults to English." msgstr "用於月份和週幾名稱的語系。預設為英語。" -#: ../../library/calendar.rst:579 +#: ../../library/calendar.rst:595 msgid "" "The encoding to use for output. :option:`--encoding` is required if :option:" "`--locale` is set." msgstr "" "用於輸出的編碼。如有設定 :option:`--locale` 則必須給定 :option:`--encoding`。" -#: ../../library/calendar.rst:585 +#: ../../library/calendar.rst:601 msgid "Print the calendar to the terminal as text, or as an HTML document." msgstr "將日曆以文字或 HTML 文件的形式印出到終端機。" -#: ../../library/calendar.rst:591 -#, fuzzy +#: ../../library/calendar.rst:607 msgid "" "The weekday to start each week. Must be a number between 0 (Monday) and 6 " "(Sunday). Defaults to 0." -msgstr "印出日曆的年份。必須是 1 到 9999 之間的數字。預設為當前年份。" +msgstr "一週起始的日子。必須是 0(週一)到 6(週日)之間的數字。預設為 0。" -#: ../../library/calendar.rst:599 -#, fuzzy +#: ../../library/calendar.rst:615 msgid "The year to print the calendar for. Defaults to the current year." -msgstr "印出日曆的年份。必須是 1 到 9999 之間的數字。預設為當前年份。" +msgstr "印出日曆的年份。預設為當前年份。" -#: ../../library/calendar.rst:605 +#: ../../library/calendar.rst:621 msgid "" "The month of the specified :option:`year` to print the calendar for. Must be " "a number between 1 and 12, and may only be used in text mode. Defaults to " @@ -781,11 +780,11 @@ msgstr "" "要列印日曆的指定 :option:`year` 的月份。必須是 1 到 12 之間的數字,並且只能在" "文字模式下使用。預設列印全年日曆。" -#: ../../library/calendar.rst:611 +#: ../../library/calendar.rst:627 msgid "*Text-mode options:*" msgstr "*文字模式選項:*" -#: ../../library/calendar.rst:615 +#: ../../library/calendar.rst:631 msgid "" "The width of the date column in terminal columns. The date is printed " "centred in the column. Any value lower than 2 is ignored. Defaults to 2." @@ -793,7 +792,7 @@ msgstr "" "終端機行中日期行的寬度。日期印出在行的中央。任何小於 2 的值都會被忽略。預設" "為 2。" -#: ../../library/calendar.rst:623 +#: ../../library/calendar.rst:639 msgid "" "The number of lines for each week in terminal rows. The date is printed top-" "aligned. Any value lower than 1 is ignored. Defaults to 1." @@ -801,21 +800,21 @@ msgstr "" "終端機列中每週的列數。日期印出時頂部會對齊。任何小於 1 的值都會被忽略。預設" "為 1。" -#: ../../library/calendar.rst:631 +#: ../../library/calendar.rst:647 msgid "" "The space between months in columns. Any value lower than 2 is ignored. " "Defaults to 6." msgstr "行中月份之間的間距。任何小於 2 的值都會被忽略。預設為 6。" -#: ../../library/calendar.rst:638 +#: ../../library/calendar.rst:654 msgid "The number of months printed per row. Defaults to 3." msgstr "每列印出的月份數量。預設為 3。" -#: ../../library/calendar.rst:642 +#: ../../library/calendar.rst:658 msgid "*HTML-mode options:*" msgstr "*HTML 模式選項:*" -#: ../../library/calendar.rst:646 +#: ../../library/calendar.rst:662 msgid "" "The path of a CSS stylesheet to use for the calendar. This must either be " "relative to the generated HTML, or an absolute HTTP or ``file:///`` URL." diff --git a/library/cmdline.po b/library/cmdline.po index 4f84c320d2..51d4a6fe87 100644 --- a/library/cmdline.po +++ b/library/cmdline.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2023-10-14 16:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -170,61 +170,65 @@ msgid ":ref:`sqlite3 `" msgstr ":ref:`sqlite3 `" #: ../../library/cmdline.rst:43 +msgid ":ref:`symtable `" +msgstr ":ref:`symtable `" + +#: ../../library/cmdline.rst:44 msgid ":ref:`sysconfig `" msgstr ":ref:`sysconfig `" -#: ../../library/cmdline.rst:44 +#: ../../library/cmdline.rst:45 msgid ":mod:`tabnanny`" msgstr ":mod:`tabnanny`" -#: ../../library/cmdline.rst:45 +#: ../../library/cmdline.rst:46 msgid ":ref:`tarfile `" msgstr ":ref:`tarfile `" -#: ../../library/cmdline.rst:46 +#: ../../library/cmdline.rst:47 msgid ":mod:`!this`" msgstr ":mod:`!this`" -#: ../../library/cmdline.rst:47 +#: ../../library/cmdline.rst:48 msgid ":ref:`timeit `" msgstr ":ref:`timeit `" -#: ../../library/cmdline.rst:48 +#: ../../library/cmdline.rst:49 msgid ":ref:`tokenize `" msgstr ":ref:`tokenize `" -#: ../../library/cmdline.rst:49 +#: ../../library/cmdline.rst:50 msgid ":ref:`trace `" msgstr ":ref:`trace `" -#: ../../library/cmdline.rst:50 +#: ../../library/cmdline.rst:51 msgid ":mod:`turtledemo`" msgstr ":mod:`turtledemo`" -#: ../../library/cmdline.rst:51 +#: ../../library/cmdline.rst:52 msgid ":ref:`unittest `" msgstr ":ref:`unittest `" -#: ../../library/cmdline.rst:52 +#: ../../library/cmdline.rst:53 msgid ":ref:`uuid `" msgstr ":ref:`uuid `" -#: ../../library/cmdline.rst:53 +#: ../../library/cmdline.rst:54 msgid ":mod:`venv`" msgstr ":mod:`venv`" -#: ../../library/cmdline.rst:54 +#: ../../library/cmdline.rst:55 msgid ":mod:`webbrowser`" msgstr ":mod:`webbrowser`" -#: ../../library/cmdline.rst:55 +#: ../../library/cmdline.rst:56 msgid ":ref:`zipapp `" msgstr ":ref:`zipapp `" -#: ../../library/cmdline.rst:56 +#: ../../library/cmdline.rst:57 msgid ":ref:`zipfile `" msgstr ":ref:`zipfile `" -#: ../../library/cmdline.rst:58 +#: ../../library/cmdline.rst:59 msgid "See also the :ref:`Python command-line interface `." msgstr "另請見 :ref:`Python 命令列介面 `。" diff --git a/library/collections.po b/library/collections.po index 28d2d79ade..b2cd7486d9 100644 --- a/library/collections.po +++ b/library/collections.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2024-01-22 21:42+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1207,7 +1207,7 @@ msgstr "" "此屬性為 :meth:`__missing__` 方法所使用。如果有引數被傳入建構函式,則此屬性會" "被初始化成第一個引數,如未提供引數則被初始化為 ``None``。" -#: ../../library/collections.rst:765 ../../library/collections.rst:1188 +#: ../../library/collections.rst:765 ../../library/collections.rst:1191 msgid "" "Added merge (``|``) and update (``|=``) operators, specified in :pep:`584`." msgstr "新增合併 (``|``) 和更新 (``|=``) 運算子,請見 :pep:`584`。" @@ -1357,10 +1357,11 @@ msgstr "" #: ../../library/collections.rst:877 msgid "" -"If *module* is defined, the ``__module__`` attribute of the named tuple is " -"set to that value." +"If *module* is defined, the :attr:`~type.__module__` attribute of the named " +"tuple is set to that value." msgstr "" -"如果 *module* 值有被定義,named tuple 的 ``__module__`` 屬性就被設定為該值。" +"如果 *module* 值有被定義,named tuple 的 :attr:`~type.__module__` 屬性就被設" +"定為該值。" #: ../../library/collections.rst:880 msgid "" @@ -1876,21 +1877,26 @@ msgstr "" "除了普通的對映方法,ordered dictionary 還支援了透過 :func:`reversed` 來做倒序" "疊代。" -#: ../../library/collections.rst:1172 +#: ../../library/collections.rst:1174 msgid "" "Equality tests between :class:`OrderedDict` objects are order-sensitive and " -"are implemented as ``list(od1.items())==list(od2.items())``. Equality tests " -"between :class:`OrderedDict` objects and other :class:`~collections.abc." -"Mapping` objects are order-insensitive like regular dictionaries. This " -"allows :class:`OrderedDict` objects to be substituted anywhere a regular " -"dictionary is used." +"are roughly equivalent to ``list(od1.items())==list(od2.items())``." msgstr "" -":class:`OrderedDict` 物件之間的相等性運算是會檢查順序是否相同的,是透過 " -"``list(od1.items())==list(od2.items())`` 來實現。:class:`OrderedDict` 物件和" -"其他 :class:`~collections.abc.Mapping` 物件間的相等性運算則像普通字典一樣不考" -"慮順序性,這使得 :class:`OrderedDict` 可於任何字典可使用的時機中被替換掉。" +":class:`OrderedDict` 物件之間的相等性運算是會檢查順序是否相同的,大致等價於 " +"``list(od1.items())==list(od2.items())``。" -#: ../../library/collections.rst:1179 +#: ../../library/collections.rst:1177 +msgid "" +"Equality tests between :class:`OrderedDict` objects and other :class:" +"`~collections.abc.Mapping` objects are order-insensitive like regular " +"dictionaries. This allows :class:`OrderedDict` objects to be substituted " +"anywhere a regular dictionary is used." +msgstr "" +":class:`OrderedDict` 物件和其他 :class:`~collections.abc.Mapping` 物件間的相" +"等性運算則像普通字典一樣不考慮順序性,這使得 :class:`OrderedDict` 可於任何字" +"典可使用的時機中被替換掉。" + +#: ../../library/collections.rst:1182 msgid "" "The items, keys, and values :term:`views ` of :class:" "`OrderedDict` now support reverse iteration using :func:`reversed`." @@ -1898,7 +1904,7 @@ msgstr "" ":class:`OrderedDict` 的項 (item)、鍵與值之\\ :term:`視圖 `\\ 現在可透過 :func:`reversed` 來倒序疊代。" -#: ../../library/collections.rst:1183 +#: ../../library/collections.rst:1186 msgid "" "With the acceptance of :pep:`468`, order is retained for keyword arguments " "passed to the :class:`OrderedDict` constructor and its :meth:`update` method." @@ -1906,11 +1912,11 @@ msgstr "" "隨著 :pep:`468` 被核可,被傳入給 :class:`OrderedDict` 建構函式與其 :meth:" "`update` 方法的關鍵字引數之順序被保留了下來。" -#: ../../library/collections.rst:1193 +#: ../../library/collections.rst:1196 msgid ":class:`OrderedDict` Examples and Recipes" msgstr ":class:`OrderedDict` 範例與用法" -#: ../../library/collections.rst:1195 +#: ../../library/collections.rst:1198 msgid "" "It is straightforward to create an ordered dictionary variant that remembers " "the order the keys were *last* inserted. If a new entry overwrites an " @@ -1920,7 +1926,7 @@ msgstr "" "建立一個能夠記住鍵\\ *最後*\\ 插入順序的 ordered dictionary 變體很簡單。如果" "新條目覆蓋了現有條目,則原本插入位置會被更改並移動至末端: ::" -#: ../../library/collections.rst:1200 +#: ../../library/collections.rst:1203 msgid "" "class LastUpdatedOrderedDict(OrderedDict):\n" " 'Store items in the order the keys were last added'\n" @@ -1930,7 +1936,7 @@ msgid "" " self.move_to_end(key)" msgstr "" -#: ../../library/collections.rst:1207 +#: ../../library/collections.rst:1210 msgid "" "An :class:`OrderedDict` would also be useful for implementing variants of :" "func:`functools.lru_cache`:" @@ -1938,7 +1944,7 @@ msgstr "" ":class:`OrderedDict` 在實現一個 :func:`functools.lru_cache` 的變形版本時也非" "常有用:" -#: ../../library/collections.rst:1210 +#: ../../library/collections.rst:1213 msgid "" "from collections import OrderedDict\n" "from time import time\n" @@ -1965,7 +1971,7 @@ msgid "" " return result" msgstr "" -#: ../../library/collections.rst:1237 +#: ../../library/collections.rst:1240 msgid "" "class MultiHitLRUCache:\n" " \"\"\" LRU cache that defers caching a result until\n" @@ -2003,11 +2009,11 @@ msgid "" " return result" msgstr "" -#: ../../library/collections.rst:1306 +#: ../../library/collections.rst:1309 msgid ":class:`UserDict` objects" msgstr ":class:`UserDict` 物件" -#: ../../library/collections.rst:1308 +#: ../../library/collections.rst:1311 msgid "" "The class, :class:`UserDict` acts as a wrapper around dictionary objects. " "The need for this class has been partially supplanted by the ability to " @@ -2018,7 +2024,7 @@ msgstr "" "`dict` 建立子類別,這個類別的需求已部分被滿足,不過這個類別使用起來更方便,因" "為被包裝的字典可以作為其屬性來存取。" -#: ../../library/collections.rst:1316 +#: ../../library/collections.rst:1319 msgid "" "Class that simulates a dictionary. The instance's contents are kept in a " "regular dictionary, which is accessible via the :attr:`data` attribute of :" @@ -2030,23 +2036,23 @@ msgstr "" "`data` 屬性來做存取。如果有提供 *initialdata*,:attr:`data` 屬性會被初始化為" "其值;要注意指到 *initialdata* 的參照不會被保留,使其可被用於其他目的。" -#: ../../library/collections.rst:1322 +#: ../../library/collections.rst:1325 msgid "" "In addition to supporting the methods and operations of mappings, :class:" "`UserDict` instances provide the following attribute:" msgstr "" "除了支援作為對映所需的方法與操作,:class:`UserDict` 實例提供了以下屬性:" -#: ../../library/collections.rst:1327 +#: ../../library/collections.rst:1330 msgid "" "A real dictionary used to store the contents of the :class:`UserDict` class." msgstr "一個真實的字典,用於儲存 :class:`UserDict` 類別的資料內容。" -#: ../../library/collections.rst:1333 +#: ../../library/collections.rst:1336 msgid ":class:`UserList` objects" msgstr ":class:`UserList` 物件" -#: ../../library/collections.rst:1335 +#: ../../library/collections.rst:1338 msgid "" "This class acts as a wrapper around list objects. It is a useful base class " "for your own list-like classes which can inherit from them and override " @@ -2057,7 +2063,7 @@ msgstr "" "入新方法來定義你所需的一個類似於 list 的類別。如此一來,我們可以為 list 加入" "新的特性。" -#: ../../library/collections.rst:1340 +#: ../../library/collections.rst:1343 msgid "" "The need for this class has been partially supplanted by the ability to " "subclass directly from :class:`list`; however, this class can be easier to " @@ -2066,7 +2072,7 @@ msgstr "" "因為已經可以直接自 :class:`list` 建立子類別,這個類別的需求已部分被滿足,不過" "這個類別使用起來更方便,因為被包裝的 list 可以作為其屬性來存取。" -#: ../../library/collections.rst:1346 +#: ../../library/collections.rst:1349 msgid "" "Class that simulates a list. The instance's contents are kept in a regular " "list, which is accessible via the :attr:`data` attribute of :class:" @@ -2079,20 +2085,20 @@ msgstr "" "list ``[]``。*list* 可以是任何 iterable,例如一個真實的 Python list 或是一" "個 :class:`UserList` 物件。" -#: ../../library/collections.rst:1352 +#: ../../library/collections.rst:1355 msgid "" "In addition to supporting the methods and operations of mutable sequences, :" "class:`UserList` instances provide the following attribute:" msgstr "除了支援可變序列的方法與操作,:class:`UserList` 實例提供了以下屬性:" -#: ../../library/collections.rst:1357 +#: ../../library/collections.rst:1360 msgid "" "A real :class:`list` object used to store the contents of the :class:" "`UserList` class." msgstr "" "一個真實的 :class:`list` 物件,用於儲存 :class:`UserList` 類別的資料內容。" -#: ../../library/collections.rst:1360 +#: ../../library/collections.rst:1363 msgid "" "**Subclassing requirements:** Subclasses of :class:`UserList` are expected " "to offer a constructor which can be called with either no arguments or one " @@ -2106,7 +2112,7 @@ msgstr "" "例,為了達成上述目的,它假設建構函式可傳入單一參數來呼叫,該參數即是做為數據" "來源的一個序列物件。" -#: ../../library/collections.rst:1367 +#: ../../library/collections.rst:1370 msgid "" "If a derived class does not wish to comply with this requirement, all of the " "special methods supported by this class will need to be overridden; please " @@ -2116,11 +2122,11 @@ msgstr "" "如果希望一個自此獲得的子類別不遵從上述要求,那所有該類別支援的特殊方法則必須" "被覆寫;請參考原始碼來理解在這情況下哪些方法是必須提供的。" -#: ../../library/collections.rst:1373 +#: ../../library/collections.rst:1376 msgid ":class:`UserString` objects" msgstr ":class:`UserString` 物件" -#: ../../library/collections.rst:1375 +#: ../../library/collections.rst:1378 msgid "" "The class, :class:`UserString` acts as a wrapper around string objects. The " "need for this class has been partially supplanted by the ability to subclass " @@ -2131,7 +2137,7 @@ msgstr "" "建立子類別,這個類別的需求已經部分被滿足,不過這個類別使用起來更方便,因為被" "包裝的字串可以作為其屬性來存取。" -#: ../../library/collections.rst:1383 +#: ../../library/collections.rst:1386 msgid "" "Class that simulates a string object. The instance's content is kept in a " "regular string object, which is accessible via the :attr:`data` attribute " @@ -2143,21 +2149,21 @@ msgstr "" "的 :attr:`data` 屬性來做存取。實例內容被初始化為 *seq* 的複製,*seq* 引數可以" "是任何可被內建函式 :func:`str` 轉換成字串的物件。" -#: ../../library/collections.rst:1390 +#: ../../library/collections.rst:1393 msgid "" "In addition to supporting the methods and operations of strings, :class:" "`UserString` instances provide the following attribute:" msgstr "" "除了支援字串的方法和操作以外,:class:`UserString` 實例也提供了以下屬性:" -#: ../../library/collections.rst:1395 +#: ../../library/collections.rst:1398 msgid "" "A real :class:`str` object used to store the contents of the :class:" "`UserString` class." msgstr "" "一個真實的 :class:`str` 物件,用來儲存 :class:`UserString` 類別的資料內容。" -#: ../../library/collections.rst:1398 +#: ../../library/collections.rst:1401 msgid "" "New methods ``__getnewargs__``, ``__rmod__``, ``casefold``, ``format_map``, " "``isprintable``, and ``maketrans``." diff --git a/library/contextvars.po b/library/contextvars.po index b90483b630..8f8fe6b9cd 100644 --- a/library/contextvars.po +++ b/library/contextvars.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -329,7 +329,7 @@ msgid "" " # without passing it explicitly to this function.\n" "\n" " client_addr = client_addr_var.get()\n" -" return f'Good bye, client @ {client_addr}\\n'.encode()\n" +" return f'Good bye, client @ {client_addr}\\r\\n'.encode()\n" "\n" "async def handle_request(reader, writer):\n" " addr = writer.transport.get_extra_info('socket').getpeername()\n" @@ -343,9 +343,10 @@ msgid "" " print(line)\n" " if not line.strip():\n" " break\n" -" writer.write(line)\n" "\n" -" writer.write(render_goodbye())\n" +" writer.write(b'HTTP/1.1 200 OK\\r\\n') # status line\n" +" writer.write(b'\\r\\n') # headers\n" +" writer.write(render_goodbye()) # body\n" " writer.close()\n" "\n" "async def main():\n" @@ -357,6 +358,7 @@ msgid "" "\n" "asyncio.run(main())\n" "\n" -"# To test it you can use telnet:\n" -"# telnet 127.0.0.1 8081" +"# To test it you can use telnet or curl:\n" +"# telnet 127.0.0.1 8081\n" +"# curl 127.0.0.1:8081" msgstr "" diff --git a/library/dataclasses.po b/library/dataclasses.po index 3725bca2be..f6f692492e 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -584,7 +584,7 @@ msgid "" "mechanism. Multiple third-parties can each have their own key, to use as a " "namespace in the metadata." msgstr "" -"*metadata*:這可以是映射或無。 None 被視為空字典。此值包含在 :func:`~types." +"*metadata*:這可以是對映或無。 None 被視為空字典。此值包含在 :func:`~types." "MappingProxyType` 中以使其成為只讀的,並暴露在 :class:`Field` 對像上。它根本" "不被資料類別使用,而是作為第三方擴充機制提供的。多個第三方可以各自擁有自己的" "密鑰,用作元資料中的命名空間。" @@ -1186,9 +1186,9 @@ msgid "" msgstr "" "當 :func:`@dataclass ` 裝飾器建立資料類別時,它會以反向 MRO(即" "從 :class:`object` 開始)查看該類的所有基底類別,並且對於它找到的每個資料類" -"別,將該基底類別中的欄位新增到欄位的有序映射中。新增所有基底類別欄位後,它會" -"將自己的欄位新增到有序映射中。所有生成的方法都將使用這種組合的、計算的有序欄" -"位映射。因為欄位是按插入順序排列的,所以派生類會覆蓋基底類別。一個例子: ::" +"別,將該基底類別中的欄位新增到欄位的有序對映中。新增所有基底類別欄位後,它會" +"將自己的欄位新增到有序對映中。所有生成的方法都將使用這種組合的、計算的有序欄" +"位對映。因為欄位是按插入順序排列的,所以派生類會覆蓋基底類別。一個例子: ::" #: ../../library/dataclasses.rst:652 msgid "" diff --git a/library/datetime.po b/library/datetime.po index 886165ae86..21b3d8a2d7 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-04 00:13+0000\n" "PO-Revision-Date: 2023-08-07 10:20+0800\n" "Last-Translator: Griiid \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -422,9 +422,9 @@ msgstr "" ">>> (d.days, d.seconds, d.microseconds)\n" "(-1, 86399, 999999)" -#: ../../library/datetime.rst:265 ../../library/datetime.rst:552 -#: ../../library/datetime.rst:1108 ../../library/datetime.rst:1746 -#: ../../library/datetime.rst:2351 +#: ../../library/datetime.rst:265 ../../library/datetime.rst:566 +#: ../../library/datetime.rst:1122 ../../library/datetime.rst:1760 +#: ../../library/datetime.rst:2365 msgid "Class attributes:" msgstr "類別屬性:" @@ -451,8 +451,8 @@ msgid "" "`timedelta` object." msgstr "" -#: ../../library/datetime.rst:287 ../../library/datetime.rst:570 -#: ../../library/datetime.rst:1128 ../../library/datetime.rst:1766 +#: ../../library/datetime.rst:287 ../../library/datetime.rst:584 +#: ../../library/datetime.rst:1142 ../../library/datetime.rst:1780 msgid "Instance attributes (read-only):" msgstr "" @@ -464,194 +464,217 @@ msgstr "在 -999,999,999 到 999,999,999 (含)之間" msgid "Between 0 and 86,399 inclusive." msgstr "在 0 到 86,399 (含)之間" -#: ../../library/datetime.rst:301 +#: ../../library/datetime.rst:300 +msgid "" +"It is a somewhat common bug for code to unintentionally use this attribute " +"when it is actually intended to get a :meth:`~timedelta.total_seconds` value " +"instead:" +msgstr "" + +#: ../../library/datetime.rst:304 +msgid "" +">>> from datetime import timedelta\n" +">>> duration = timedelta(seconds=11235813)\n" +">>> duration.days, duration.seconds\n" +"(130, 3813)\n" +">>> duration.total_seconds()\n" +"11235813.0" +msgstr "" +">>> from datetime import timedelta\n" +">>> duration = timedelta(seconds=11235813)\n" +">>> duration.days, duration.seconds\n" +"(130, 3813)\n" +">>> duration.total_seconds()\n" +"11235813.0" + +#: ../../library/datetime.rst:315 msgid "Between 0 and 999,999 inclusive." msgstr "在 0 到 999,999 (含)之間" -#: ../../library/datetime.rst:304 ../../library/datetime.rst:587 -#: ../../library/datetime.rst:1181 +#: ../../library/datetime.rst:318 ../../library/datetime.rst:601 +#: ../../library/datetime.rst:1195 msgid "Supported operations:" msgstr "" -#: ../../library/datetime.rst:309 ../../library/datetime.rst:590 -#: ../../library/datetime.rst:1184 +#: ../../library/datetime.rst:323 ../../library/datetime.rst:604 +#: ../../library/datetime.rst:1198 msgid "Operation" msgstr "" -#: ../../library/datetime.rst:309 ../../library/datetime.rst:590 -#: ../../library/datetime.rst:1184 +#: ../../library/datetime.rst:323 ../../library/datetime.rst:604 +#: ../../library/datetime.rst:1198 msgid "Result" msgstr "" -#: ../../library/datetime.rst:311 +#: ../../library/datetime.rst:325 msgid "``t1 = t2 + t3``" msgstr "``t1 = t2 + t3``" -#: ../../library/datetime.rst:311 +#: ../../library/datetime.rst:325 msgid "" "Sum of ``t2`` and ``t3``. Afterwards ``t1 - t2 == t3`` and ``t1 - t3 == t2`` " "are true. (1)" msgstr "" -#: ../../library/datetime.rst:315 +#: ../../library/datetime.rst:329 msgid "``t1 = t2 - t3``" msgstr "``t1 = t2 - t3``" -#: ../../library/datetime.rst:315 +#: ../../library/datetime.rst:329 msgid "" "Difference of ``t2`` and ``t3``. Afterwards ``t1 == t2 - t3`` and ``t2 == " "t1 + t3`` are true. (1)(6)" msgstr "" -#: ../../library/datetime.rst:319 +#: ../../library/datetime.rst:333 msgid "``t1 = t2 * i or t1 = i * t2``" msgstr "``t1 = t2 * i or t1 = i * t2``" -#: ../../library/datetime.rst:319 +#: ../../library/datetime.rst:333 msgid "" "Delta multiplied by an integer. Afterwards ``t1 // i == t2`` is true, " "provided ``i != 0``." msgstr "" -#: ../../library/datetime.rst:323 +#: ../../library/datetime.rst:337 msgid "In general, ``t1 * i == t1 * (i-1) + t1`` is true. (1)" msgstr "" -#: ../../library/datetime.rst:326 +#: ../../library/datetime.rst:340 msgid "``t1 = t2 * f or t1 = f * t2``" msgstr "``t1 = t2 * f or t1 = f * t2``" -#: ../../library/datetime.rst:326 +#: ../../library/datetime.rst:340 msgid "" "Delta multiplied by a float. The result is rounded to the nearest multiple " "of timedelta.resolution using round-half-to-even." msgstr "" -#: ../../library/datetime.rst:330 +#: ../../library/datetime.rst:344 msgid "``f = t2 / t3``" msgstr "``f = t2 / t3``" -#: ../../library/datetime.rst:330 +#: ../../library/datetime.rst:344 msgid "" "Division (3) of overall duration ``t2`` by interval unit ``t3``. Returns a :" "class:`float` object." msgstr "" -#: ../../library/datetime.rst:334 +#: ../../library/datetime.rst:348 msgid "``t1 = t2 / f or t1 = t2 / i``" msgstr "``t1 = t2 / f or t1 = t2 / i``" -#: ../../library/datetime.rst:334 +#: ../../library/datetime.rst:348 msgid "" "Delta divided by a float or an int. The result is rounded to the nearest " "multiple of timedelta.resolution using round-half-to-even." msgstr "" -#: ../../library/datetime.rst:338 +#: ../../library/datetime.rst:352 msgid "``t1 = t2 // i`` or ``t1 = t2 // t3``" msgstr "``t1 = t2 // i`` or ``t1 = t2 // t3``" -#: ../../library/datetime.rst:338 +#: ../../library/datetime.rst:352 msgid "" "The floor is computed and the remainder (if any) is thrown away. In the " "second case, an integer is returned. (3)" msgstr "" -#: ../../library/datetime.rst:342 +#: ../../library/datetime.rst:356 msgid "``t1 = t2 % t3``" msgstr "``t1 = t2 % t3``" -#: ../../library/datetime.rst:342 +#: ../../library/datetime.rst:356 msgid "The remainder is computed as a :class:`timedelta` object. (3)" msgstr "" -#: ../../library/datetime.rst:345 +#: ../../library/datetime.rst:359 msgid "``q, r = divmod(t1, t2)``" msgstr "``q, r = divmod(t1, t2)``" -#: ../../library/datetime.rst:345 +#: ../../library/datetime.rst:359 msgid "" "Computes the quotient and the remainder: ``q = t1 // t2`` (3) and ``r = t1 % " "t2``. q is an integer and r is a :class:`timedelta` object." msgstr "" -#: ../../library/datetime.rst:350 +#: ../../library/datetime.rst:364 msgid "``+t1``" msgstr "``+t1``" -#: ../../library/datetime.rst:350 +#: ../../library/datetime.rst:364 msgid "Returns a :class:`timedelta` object with the same value. (2)" msgstr "" -#: ../../library/datetime.rst:353 +#: ../../library/datetime.rst:367 msgid "``-t1``" msgstr "``-t1``" -#: ../../library/datetime.rst:353 +#: ../../library/datetime.rst:367 msgid "" -"Equivalent to ``timedelta(-t1.days, -t1.seconds*, -t1.microseconds)``, and " -"to ``t1 * -1``. (1)(4)" +"Equivalent to ``timedelta(-t1.days, -t1.seconds, -t1.microseconds)``, and to " +"``t1 * -1``. (1)(4)" msgstr "" -#: ../../library/datetime.rst:357 +#: ../../library/datetime.rst:371 msgid "``abs(t)``" msgstr "``abs(t)``" -#: ../../library/datetime.rst:357 +#: ../../library/datetime.rst:371 msgid "" "Equivalent to ``+t`` when ``t.days >= 0``, and to ``-t`` when ``t.days < " "0``. (2)" msgstr "" -#: ../../library/datetime.rst:360 +#: ../../library/datetime.rst:374 msgid "``str(t)``" msgstr "``str(t)``" -#: ../../library/datetime.rst:360 +#: ../../library/datetime.rst:374 msgid "" "Returns a string in the form ``[D day[s], ][H]H:MM:SS[.UUUUUU]``, where D is " "negative for negative ``t``. (5)" msgstr "" -#: ../../library/datetime.rst:364 +#: ../../library/datetime.rst:378 msgid "``repr(t)``" msgstr "``repr(t)``" -#: ../../library/datetime.rst:364 +#: ../../library/datetime.rst:378 msgid "" "Returns a string representation of the :class:`timedelta` object as a " "constructor call with canonical attribute values." msgstr "" -#: ../../library/datetime.rst:370 ../../library/datetime.rst:609 -#: ../../library/datetime.rst:2582 +#: ../../library/datetime.rst:384 ../../library/datetime.rst:623 +#: ../../library/datetime.rst:2596 msgid "Notes:" msgstr "註解:" -#: ../../library/datetime.rst:373 +#: ../../library/datetime.rst:387 msgid "This is exact but may overflow." msgstr "這是精確的,但可能會溢位。" -#: ../../library/datetime.rst:376 +#: ../../library/datetime.rst:390 msgid "This is exact and cannot overflow." msgstr "這是精確的,且不會溢位。" -#: ../../library/datetime.rst:379 +#: ../../library/datetime.rst:393 msgid "Division by zero raises :exc:`ZeroDivisionError`." msgstr "" -#: ../../library/datetime.rst:382 +#: ../../library/datetime.rst:396 msgid "``-timedelta.max`` is not representable as a :class:`timedelta` object." msgstr "" -#: ../../library/datetime.rst:385 +#: ../../library/datetime.rst:399 msgid "" "String representations of :class:`timedelta` objects are normalized " "similarly to their internal representation. This leads to somewhat unusual " "results for negative timedeltas. For example::" msgstr "" -#: ../../library/datetime.rst:389 +#: ../../library/datetime.rst:403 msgid "" ">>> timedelta(hours=-5)\n" "datetime.timedelta(days=-1, seconds=68400)\n" @@ -663,21 +686,21 @@ msgstr "" ">>> print(_)\n" "-1 day, 19:00:00" -#: ../../library/datetime.rst:395 +#: ../../library/datetime.rst:409 msgid "" "The expression ``t2 - t3`` will always be equal to the expression ``t2 + (-" "t3)`` except when t3 is equal to ``timedelta.max``; in that case the former " "will produce a result while the latter will overflow." msgstr "" -#: ../../library/datetime.rst:399 +#: ../../library/datetime.rst:413 msgid "" "In addition to the operations listed above, :class:`timedelta` objects " "support certain additions and subtractions with :class:`date` and :class:`." "datetime` objects (see below)." msgstr "" -#: ../../library/datetime.rst:403 +#: ../../library/datetime.rst:417 msgid "" "Floor division and true division of a :class:`timedelta` object by another :" "class:`timedelta` object are now supported, as are remainder operations and " @@ -685,43 +708,43 @@ msgid "" "`timedelta` object by a :class:`float` object are now supported." msgstr "" -#: ../../library/datetime.rst:409 +#: ../../library/datetime.rst:423 msgid ":class:`timedelta` objects support equality and order comparisons." msgstr "" -#: ../../library/datetime.rst:411 +#: ../../library/datetime.rst:425 msgid "" "In Boolean contexts, a :class:`timedelta` object is considered to be true if " "and only if it isn't equal to ``timedelta(0)``." msgstr "" -#: ../../library/datetime.rst:414 ../../library/datetime.rst:651 -#: ../../library/datetime.rst:1271 ../../library/datetime.rst:1873 +#: ../../library/datetime.rst:428 ../../library/datetime.rst:665 +#: ../../library/datetime.rst:1285 ../../library/datetime.rst:1887 msgid "Instance methods:" msgstr "實例方法:" -#: ../../library/datetime.rst:418 +#: ../../library/datetime.rst:432 msgid "" "Return the total number of seconds contained in the duration. Equivalent to " "``td / timedelta(seconds=1)``. For interval units other than seconds, use " "the division form directly (e.g. ``td / timedelta(microseconds=1)``)." msgstr "" -#: ../../library/datetime.rst:422 +#: ../../library/datetime.rst:436 msgid "" "Note that for very large time intervals (greater than 270 years on most " "platforms) this method will lose microsecond accuracy." msgstr "" -#: ../../library/datetime.rst:428 +#: ../../library/datetime.rst:442 msgid "Examples of usage: :class:`timedelta`" msgstr "用法範例::class:`timedelta`" -#: ../../library/datetime.rst:430 +#: ../../library/datetime.rst:444 msgid "An additional example of normalization::" msgstr "" -#: ../../library/datetime.rst:432 +#: ../../library/datetime.rst:446 msgid "" ">>> # Components of another_year add up to exactly 365 days\n" ">>> from datetime import timedelta\n" @@ -734,11 +757,11 @@ msgid "" "31536000.0" msgstr "" -#: ../../library/datetime.rst:442 +#: ../../library/datetime.rst:456 msgid "Examples of :class:`timedelta` arithmetic::" msgstr "" -#: ../../library/datetime.rst:444 +#: ../../library/datetime.rst:458 msgid "" ">>> from datetime import timedelta\n" ">>> year = timedelta(days=365)\n" @@ -768,65 +791,65 @@ msgstr "" ">>> three_years, three_years.days // 365\n" "(datetime.timedelta(days=1095), 3)" -#: ../../library/datetime.rst:461 +#: ../../library/datetime.rst:475 msgid ":class:`date` Objects" msgstr ":class:`date` 物件" -#: ../../library/datetime.rst:463 +#: ../../library/datetime.rst:477 msgid "" "A :class:`date` object represents a date (year, month and day) in an " "idealized calendar, the current Gregorian calendar indefinitely extended in " "both directions." msgstr "" -#: ../../library/datetime.rst:467 +#: ../../library/datetime.rst:481 msgid "" "January 1 of year 1 is called day number 1, January 2 of year 1 is called " "day number 2, and so on. [#]_" msgstr "" -#: ../../library/datetime.rst:472 +#: ../../library/datetime.rst:486 msgid "" "All arguments are required. Arguments must be integers, in the following " "ranges:" msgstr "" -#: ../../library/datetime.rst:475 +#: ../../library/datetime.rst:489 msgid "``MINYEAR <= year <= MAXYEAR``" msgstr "``MINYEAR <= year <= MAXYEAR``" -#: ../../library/datetime.rst:476 +#: ../../library/datetime.rst:490 msgid "``1 <= month <= 12``" msgstr "``1 <= month <= 12``" -#: ../../library/datetime.rst:477 +#: ../../library/datetime.rst:491 msgid "``1 <= day <= number of days in the given month and year``" msgstr "" -#: ../../library/datetime.rst:479 ../../library/datetime.rst:869 +#: ../../library/datetime.rst:493 ../../library/datetime.rst:883 msgid "" "If an argument outside those ranges is given, :exc:`ValueError` is raised." msgstr "" -#: ../../library/datetime.rst:482 ../../library/datetime.rst:874 +#: ../../library/datetime.rst:496 ../../library/datetime.rst:888 msgid "Other constructors, all class methods:" msgstr "" -#: ../../library/datetime.rst:486 +#: ../../library/datetime.rst:500 msgid "Return the current local date." msgstr "回傳目前的本地日期。" -#: ../../library/datetime.rst:488 +#: ../../library/datetime.rst:502 msgid "This is equivalent to ``date.fromtimestamp(time.time())``." msgstr "這等同於 ``date.fromtimestamp(time.time())``。" -#: ../../library/datetime.rst:492 +#: ../../library/datetime.rst:506 msgid "" "Return the local date corresponding to the POSIX timestamp, such as is " "returned by :func:`time.time`." msgstr "" -#: ../../library/datetime.rst:495 +#: ../../library/datetime.rst:509 msgid "" "This may raise :exc:`OverflowError`, if the timestamp is out of the range of " "values supported by the platform C :c:func:`localtime` function, and :exc:" @@ -836,7 +859,7 @@ msgid "" "ignored by :meth:`fromtimestamp`." msgstr "" -#: ../../library/datetime.rst:502 +#: ../../library/datetime.rst:516 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -844,45 +867,45 @@ msgid "" "`localtime` failure." msgstr "" -#: ../../library/datetime.rst:511 +#: ../../library/datetime.rst:525 msgid "" "Return the date corresponding to the proleptic Gregorian ordinal, where " "January 1 of year 1 has ordinal 1." msgstr "" -#: ../../library/datetime.rst:514 +#: ../../library/datetime.rst:528 msgid "" ":exc:`ValueError` is raised unless ``1 <= ordinal <= date.max.toordinal()``. " "For any date *d*, ``date.fromordinal(d.toordinal()) == d``." msgstr "" -#: ../../library/datetime.rst:521 +#: ../../library/datetime.rst:535 msgid "" "Return a :class:`date` corresponding to a *date_string* given in any valid " "ISO 8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:524 ../../library/datetime.rst:1030 +#: ../../library/datetime.rst:538 ../../library/datetime.rst:1044 msgid "" "Reduced precision dates are not currently supported (``YYYY-MM``, ``YYYY``)." msgstr "" -#: ../../library/datetime.rst:526 ../../library/datetime.rst:1032 +#: ../../library/datetime.rst:540 ../../library/datetime.rst:1046 msgid "" "Extended date representations are not currently supported (``±YYYYYY-MM-" "DD``)." msgstr "" -#: ../../library/datetime.rst:528 ../../library/datetime.rst:1034 +#: ../../library/datetime.rst:542 ../../library/datetime.rst:1048 msgid "Ordinal dates are not currently supported (``YYYY-OOO``)." msgstr "" -#: ../../library/datetime.rst:530 ../../library/datetime.rst:1036 -#: ../../library/datetime.rst:1502 +#: ../../library/datetime.rst:544 ../../library/datetime.rst:1050 +#: ../../library/datetime.rst:1516 msgid "Examples::" msgstr "範例: ::" -#: ../../library/datetime.rst:532 +#: ../../library/datetime.rst:546 msgid "" ">>> from datetime import date\n" ">>> date.fromisoformat('2019-12-04')\n" @@ -900,64 +923,64 @@ msgstr "" ">>> date.fromisoformat('2021-W01-1')\n" "datetime.date(2021, 1, 4)" -#: ../../library/datetime.rst:541 +#: ../../library/datetime.rst:555 msgid "Previously, this method only supported the format ``YYYY-MM-DD``." msgstr "" -#: ../../library/datetime.rst:546 +#: ../../library/datetime.rst:560 msgid "" "Return a :class:`date` corresponding to the ISO calendar date specified by " "year, week and day. This is the inverse of the function :meth:`date." "isocalendar`." msgstr "" -#: ../../library/datetime.rst:556 +#: ../../library/datetime.rst:570 msgid "The earliest representable date, ``date(MINYEAR, 1, 1)``." msgstr "" -#: ../../library/datetime.rst:561 +#: ../../library/datetime.rst:575 msgid "The latest representable date, ``date(MAXYEAR, 12, 31)``." msgstr "" -#: ../../library/datetime.rst:566 +#: ../../library/datetime.rst:580 msgid "" "The smallest possible difference between non-equal date objects, " "``timedelta(days=1)``." msgstr "" -#: ../../library/datetime.rst:574 ../../library/datetime.rst:1132 +#: ../../library/datetime.rst:588 ../../library/datetime.rst:1146 msgid "Between :const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -#: ../../library/datetime.rst:579 ../../library/datetime.rst:1137 +#: ../../library/datetime.rst:593 ../../library/datetime.rst:1151 msgid "Between 1 and 12 inclusive." msgstr "在 1 到 12 (含)之間。" -#: ../../library/datetime.rst:584 ../../library/datetime.rst:1142 +#: ../../library/datetime.rst:598 ../../library/datetime.rst:1156 msgid "Between 1 and the number of days in the given month of the given year." msgstr "" -#: ../../library/datetime.rst:592 +#: ../../library/datetime.rst:606 msgid "``date2 = date1 + timedelta``" msgstr "``date2 = date1 + timedelta``" -#: ../../library/datetime.rst:592 +#: ../../library/datetime.rst:606 msgid "``date2`` will be ``timedelta.days`` days after ``date1``. (1)" msgstr "" -#: ../../library/datetime.rst:595 +#: ../../library/datetime.rst:609 msgid "``date2 = date1 - timedelta``" msgstr "``date2 = date1 - timedelta``" -#: ../../library/datetime.rst:595 +#: ../../library/datetime.rst:609 msgid "Computes ``date2`` such that ``date2 + timedelta == date1``. (2)" msgstr "" -#: ../../library/datetime.rst:598 +#: ../../library/datetime.rst:612 msgid "``timedelta = date1 - date2``" msgstr "``timedelta = date1 - date2``" -#: ../../library/datetime.rst:598 ../../library/datetime.rst:1190 +#: ../../library/datetime.rst:612 ../../library/datetime.rst:1204 msgid "\\(3)" msgstr "\\(3)" @@ -969,7 +992,7 @@ msgstr "``date1 == date2``" msgid "``date1 != date2``" msgstr "``date1 != date2``" -#: ../../library/datetime.rst:600 ../../library/datetime.rst:1192 +#: ../../library/datetime.rst:614 ../../library/datetime.rst:1206 msgid "Equality comparison. (4)" msgstr "" @@ -989,11 +1012,11 @@ msgstr "``date1 <= date2``" msgid "``date1 >= date2``" msgstr "``date1 >= date2``" -#: ../../library/datetime.rst:603 ../../library/datetime.rst:1195 +#: ../../library/datetime.rst:617 ../../library/datetime.rst:1209 msgid "Order comparison. (5)" msgstr "" -#: ../../library/datetime.rst:612 +#: ../../library/datetime.rst:626 msgid "" "*date2* is moved forward in time if ``timedelta.days > 0``, or backward if " "``timedelta.days < 0``. Afterward ``date2 - date1 == timedelta.days``. " @@ -1002,41 +1025,41 @@ msgid "" "`MINYEAR` or larger than :const:`MAXYEAR`." msgstr "" -#: ../../library/datetime.rst:619 +#: ../../library/datetime.rst:633 msgid "``timedelta.seconds`` and ``timedelta.microseconds`` are ignored." msgstr "``timedelta.seconds`` 和 ``timedelta.microseconds`` 被忽略。" -#: ../../library/datetime.rst:622 +#: ../../library/datetime.rst:636 msgid "" "This is exact, and cannot overflow. ``timedelta.seconds`` and ``timedelta." "microseconds`` are 0, and ``date2 + timedelta == date1`` after." msgstr "" -#: ../../library/datetime.rst:626 +#: ../../library/datetime.rst:640 msgid ":class:`date` objects are equal if they represent the same date." msgstr "" -#: ../../library/datetime.rst:628 +#: ../../library/datetime.rst:642 msgid "" ":class:`!date` objects that are not also :class:`.datetime` instances are " "never equal to :class:`!datetime` objects, even if they represent the same " "date." msgstr "" -#: ../../library/datetime.rst:633 +#: ../../library/datetime.rst:647 msgid "" "*date1* is considered less than *date2* when *date1* precedes *date2* in " "time. In other words, ``date1 < date2`` if and only if ``date1.toordinal() < " "date2.toordinal()``." msgstr "" -#: ../../library/datetime.rst:637 +#: ../../library/datetime.rst:651 msgid "" "Order comparison between a :class:`!date` object that is not also a :class:`." "datetime` instance and a :class:`!datetime` object raises :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:641 ../../library/datetime.rst:1263 +#: ../../library/datetime.rst:655 ../../library/datetime.rst:1277 msgid "" "Comparison between :class:`.datetime` object and an instance of the :class:" "`date` subclass that is not a :class:`!datetime` subclass no longer converts " @@ -1045,22 +1068,22 @@ msgid "" "in subclasses." msgstr "" -#: ../../library/datetime.rst:649 +#: ../../library/datetime.rst:663 msgid "" "In Boolean contexts, all :class:`date` objects are considered to be true." msgstr "" -#: ../../library/datetime.rst:655 +#: ../../library/datetime.rst:669 msgid "" "Return a date with the same value, except for those parameters given new " "values by whichever keyword arguments are specified." msgstr "" -#: ../../library/datetime.rst:658 ../../library/datetime.rst:1919 +#: ../../library/datetime.rst:672 ../../library/datetime.rst:1933 msgid "Example::" msgstr "範例: ::" -#: ../../library/datetime.rst:660 +#: ../../library/datetime.rst:674 msgid "" ">>> from datetime import date\n" ">>> d = date(2002, 12, 31)\n" @@ -1072,47 +1095,47 @@ msgstr "" ">>> d.replace(day=26)\n" "datetime.date(2002, 12, 26)" -#: ../../library/datetime.rst:665 +#: ../../library/datetime.rst:679 msgid "" ":class:`date` objects are also supported by generic function :func:`copy." "replace`." msgstr "" -#: ../../library/datetime.rst:671 ../../library/datetime.rst:1387 +#: ../../library/datetime.rst:685 ../../library/datetime.rst:1401 msgid "" "Return a :class:`time.struct_time` such as returned by :func:`time." "localtime`." msgstr "" "回傳一個 :class:`time.struct_time`,如同 :func:`time.localtime` 所回傳。" -#: ../../library/datetime.rst:673 +#: ../../library/datetime.rst:687 msgid "The hours, minutes and seconds are 0, and the DST flag is -1." msgstr "" -#: ../../library/datetime.rst:675 ../../library/datetime.rst:1389 +#: ../../library/datetime.rst:689 ../../library/datetime.rst:1403 msgid "``d.timetuple()`` is equivalent to::" msgstr "``d.timetuple()`` 等價於: ::" -#: ../../library/datetime.rst:677 +#: ../../library/datetime.rst:691 msgid "" "time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))" msgstr "" "time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))" -#: ../../library/datetime.rst:679 +#: ../../library/datetime.rst:693 msgid "" "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " "day number within the current year starting with 1 for January 1st." msgstr "" -#: ../../library/datetime.rst:685 +#: ../../library/datetime.rst:699 msgid "" "Return the proleptic Gregorian ordinal of the date, where January 1 of year " "1 has ordinal 1. For any :class:`date` object *d*, ``date.fromordinal(d." "toordinal()) == d``." msgstr "" -#: ../../library/datetime.rst:692 +#: ../../library/datetime.rst:706 msgid "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " "For example, ``date(2002, 12, 4).weekday() == 2``, a Wednesday. See also :" @@ -1121,25 +1144,25 @@ msgstr "" "回傳一個代表星期幾的整數,星期一為 0、星期日為 6。例如 ``date(2002, 12, 4)." "weekday() == 2`` 為星期三。也請參考 :meth:`isoweekday`。" -#: ../../library/datetime.rst:699 +#: ../../library/datetime.rst:713 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " "For example, ``date(2002, 12, 4).isoweekday() == 3``, a Wednesday. See also :" "meth:`weekday`, :meth:`isocalendar`." msgstr "" -#: ../../library/datetime.rst:706 +#: ../../library/datetime.rst:720 msgid "" "Return a :term:`named tuple` object with three components: ``year``, " "``week`` and ``weekday``." msgstr "" -#: ../../library/datetime.rst:709 +#: ../../library/datetime.rst:723 msgid "" "The ISO calendar is a widely used variant of the Gregorian calendar. [#]_" msgstr "" -#: ../../library/datetime.rst:711 +#: ../../library/datetime.rst:725 msgid "" "The ISO year consists of 52 or 53 full weeks, and where a week starts on a " "Monday and ends on a Sunday. The first week of an ISO year is the first " @@ -1148,13 +1171,13 @@ msgid "" "Gregorian year." msgstr "" -#: ../../library/datetime.rst:716 +#: ../../library/datetime.rst:730 msgid "" "For example, 2004 begins on a Thursday, so the first week of ISO year 2004 " "begins on Monday, 29 Dec 2003 and ends on Sunday, 4 Jan 2004::" msgstr "" -#: ../../library/datetime.rst:719 +#: ../../library/datetime.rst:733 msgid "" ">>> from datetime import date\n" ">>> date(2003, 12, 29).isocalendar()\n" @@ -1168,16 +1191,16 @@ msgstr "" ">>> date(2004, 1, 4).isocalendar()\n" "datetime.IsoCalendarDate(year=2004, week=1, weekday=7)" -#: ../../library/datetime.rst:725 +#: ../../library/datetime.rst:739 msgid "Result changed from a tuple to a :term:`named tuple`." msgstr "" -#: ../../library/datetime.rst:730 +#: ../../library/datetime.rst:744 msgid "" "Return a string representing the date in ISO 8601 format, ``YYYY-MM-DD``::" msgstr "回傳一以 ISO 8601 格式 ``YYYY-MM-DD`` 表示的日期字串: ::" -#: ../../library/datetime.rst:732 +#: ../../library/datetime.rst:746 msgid "" ">>> from datetime import date\n" ">>> date(2002, 12, 4).isoformat()\n" @@ -1187,15 +1210,15 @@ msgstr "" ">>> date(2002, 12, 4).isoformat()\n" "'2002-12-04'" -#: ../../library/datetime.rst:738 +#: ../../library/datetime.rst:752 msgid "For a date *d*, ``str(d)`` is equivalent to ``d.isoformat()``." msgstr "" -#: ../../library/datetime.rst:743 +#: ../../library/datetime.rst:757 msgid "Return a string representing the date::" msgstr "" -#: ../../library/datetime.rst:745 +#: ../../library/datetime.rst:759 msgid "" ">>> from datetime import date\n" ">>> date(2002, 12, 4).ctime()\n" @@ -1205,22 +1228,22 @@ msgstr "" ">>> date(2002, 12, 4).ctime()\n" "'Wed Dec 4 00:00:00 2002'" -#: ../../library/datetime.rst:749 ../../library/datetime.rst:1573 +#: ../../library/datetime.rst:763 ../../library/datetime.rst:1587 msgid "``d.ctime()`` is equivalent to::" msgstr "``d.ctime()`` 等價於: ::" -#: ../../library/datetime.rst:751 ../../library/datetime.rst:1575 +#: ../../library/datetime.rst:765 ../../library/datetime.rst:1589 msgid "time.ctime(time.mktime(d.timetuple()))" msgstr "time.ctime(time.mktime(d.timetuple()))" -#: ../../library/datetime.rst:753 +#: ../../library/datetime.rst:767 msgid "" "on platforms where the native C :c:func:`ctime` function (which :func:`time." "ctime` invokes, but which :meth:`date.ctime` does not invoke) conforms to " "the C standard." msgstr "" -#: ../../library/datetime.rst:760 +#: ../../library/datetime.rst:774 msgid "" "Return a string representing the date, controlled by an explicit format " "string. Format codes referring to hours, minutes or seconds will see 0 " @@ -1228,7 +1251,7 @@ msgid "" "isoformat`." msgstr "" -#: ../../library/datetime.rst:767 +#: ../../library/datetime.rst:781 msgid "" "Same as :meth:`.date.strftime`. This makes it possible to specify a format " "string for a :class:`.date` object in :ref:`formatted string literals >> import time\n" ">>> from datetime import date\n" @@ -1280,11 +1303,11 @@ msgstr "" ">>> time_to_birthday.days\n" "202" -#: ../../library/datetime.rst:794 +#: ../../library/datetime.rst:808 msgid "More examples of working with :class:`date`:" msgstr "更多 :class:`date` 的用法範例:" -#: ../../library/datetime.rst:796 +#: ../../library/datetime.rst:810 msgid "" ">>> from datetime import date\n" ">>> d = date.fromordinal(730920) # 730920th day after 1. 1. 0001\n" @@ -1328,17 +1351,17 @@ msgid "" "datetime.date(2005, 3, 11)" msgstr "" -#: ../../library/datetime.rst:843 +#: ../../library/datetime.rst:857 msgid ":class:`.datetime` Objects" msgstr ":class:`.datetime` 物件" -#: ../../library/datetime.rst:845 +#: ../../library/datetime.rst:859 msgid "" "A :class:`.datetime` object is a single object containing all the " "information from a :class:`date` object and a :class:`.time` object." msgstr "" -#: ../../library/datetime.rst:848 +#: ../../library/datetime.rst:862 msgid "" "Like a :class:`date` object, :class:`.datetime` assumes the current " "Gregorian calendar extended in both directions; like a :class:`.time` " @@ -1346,81 +1369,81 @@ msgid "" "every day." msgstr "" -#: ../../library/datetime.rst:852 +#: ../../library/datetime.rst:866 msgid "Constructor:" msgstr "" -#: ../../library/datetime.rst:856 +#: ../../library/datetime.rst:870 msgid "" "The *year*, *month* and *day* arguments are required. *tzinfo* may be " "``None``, or an instance of a :class:`tzinfo` subclass. The remaining " "arguments must be integers in the following ranges:" msgstr "" -#: ../../library/datetime.rst:860 +#: ../../library/datetime.rst:874 msgid "``MINYEAR <= year <= MAXYEAR``," msgstr "``MINYEAR <= year <= MAXYEAR``," -#: ../../library/datetime.rst:861 +#: ../../library/datetime.rst:875 msgid "``1 <= month <= 12``," msgstr "``1 <= month <= 12``," -#: ../../library/datetime.rst:862 +#: ../../library/datetime.rst:876 msgid "``1 <= day <= number of days in the given month and year``," msgstr "" -#: ../../library/datetime.rst:863 ../../library/datetime.rst:1737 +#: ../../library/datetime.rst:877 ../../library/datetime.rst:1751 msgid "``0 <= hour < 24``," msgstr "``0 <= hour < 24``," -#: ../../library/datetime.rst:864 ../../library/datetime.rst:1738 +#: ../../library/datetime.rst:878 ../../library/datetime.rst:1752 msgid "``0 <= minute < 60``," msgstr "``0 <= minute < 60``," -#: ../../library/datetime.rst:865 ../../library/datetime.rst:1739 +#: ../../library/datetime.rst:879 ../../library/datetime.rst:1753 msgid "``0 <= second < 60``," msgstr "``0 <= second < 60``," -#: ../../library/datetime.rst:866 ../../library/datetime.rst:1740 +#: ../../library/datetime.rst:880 ../../library/datetime.rst:1754 msgid "``0 <= microsecond < 1000000``," msgstr "``0 <= microsecond < 1000000``," -#: ../../library/datetime.rst:867 ../../library/datetime.rst:1741 +#: ../../library/datetime.rst:881 ../../library/datetime.rst:1755 msgid "``fold in [0, 1]``." msgstr "" -#: ../../library/datetime.rst:871 ../../library/datetime.rst:1308 -#: ../../library/datetime.rst:1886 +#: ../../library/datetime.rst:885 ../../library/datetime.rst:1322 +#: ../../library/datetime.rst:1900 msgid "Added the *fold* parameter." msgstr "新增 *fold* 參數。" -#: ../../library/datetime.rst:878 +#: ../../library/datetime.rst:892 msgid "Return the current local date and time, with :attr:`.tzinfo` ``None``." msgstr "回傳目前的本地日期與時間,且 :attr:`.tzinfo` 為 ``None``。" -#: ../../library/datetime.rst:880 +#: ../../library/datetime.rst:894 msgid "Equivalent to::" msgstr "等價於: ::" -#: ../../library/datetime.rst:882 +#: ../../library/datetime.rst:896 msgid "datetime.fromtimestamp(time.time())" msgstr "datetime.fromtimestamp(time.time())" -#: ../../library/datetime.rst:884 +#: ../../library/datetime.rst:898 msgid "See also :meth:`now`, :meth:`fromtimestamp`." msgstr "也請見 :meth:`now`、:meth:`fromtimestamp`。" -#: ../../library/datetime.rst:886 +#: ../../library/datetime.rst:900 msgid "" "This method is functionally equivalent to :meth:`now`, but without a ``tz`` " "parameter." msgstr "" -#: ../../library/datetime.rst:891 +#: ../../library/datetime.rst:905 msgid "Return the current local date and time." msgstr "" -#: ../../library/datetime.rst:893 +#: ../../library/datetime.rst:907 msgid "" "If optional argument *tz* is ``None`` or not specified, this is like :meth:" "`today`, but, if possible, supplies more precision than can be gotten from " @@ -1431,28 +1454,28 @@ msgstr "" "供比透過 :func:`time.time` 取得的時間戳記更多位數的資訊(例如,這在有提供 C :" "c:func:`gettimeofday` 函式的平台上可能可行)。" -#: ../../library/datetime.rst:899 +#: ../../library/datetime.rst:913 msgid "" "If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` " "subclass, and the current date and time are converted to *tz*’s time zone." msgstr "" -#: ../../library/datetime.rst:902 +#: ../../library/datetime.rst:916 msgid "This function is preferred over :meth:`today` and :meth:`utcnow`." msgstr "" -#: ../../library/datetime.rst:907 +#: ../../library/datetime.rst:921 msgid "Return the current UTC date and time, with :attr:`.tzinfo` ``None``." msgstr "" -#: ../../library/datetime.rst:909 +#: ../../library/datetime.rst:923 msgid "" "This is like :meth:`now`, but returns the current UTC date and time, as a " "naive :class:`.datetime` object. An aware current UTC datetime can be " "obtained by calling ``datetime.now(timezone.utc)``. See also :meth:`now`." msgstr "" -#: ../../library/datetime.rst:915 +#: ../../library/datetime.rst:929 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -1460,11 +1483,11 @@ msgid "" "current time in UTC is by calling ``datetime.now(timezone.utc)``." msgstr "" -#: ../../library/datetime.rst:922 +#: ../../library/datetime.rst:936 msgid "Use :meth:`datetime.now` with :attr:`UTC` instead." msgstr "" -#: ../../library/datetime.rst:927 +#: ../../library/datetime.rst:941 msgid "" "Return the local date and time corresponding to the POSIX timestamp, such as " "is returned by :func:`time.time`. If optional argument *tz* is ``None`` or " @@ -1472,13 +1495,13 @@ msgid "" "time, and the returned :class:`.datetime` object is naive." msgstr "" -#: ../../library/datetime.rst:932 +#: ../../library/datetime.rst:946 msgid "" "If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` " "subclass, and the timestamp is converted to *tz*’s time zone." msgstr "" -#: ../../library/datetime.rst:935 +#: ../../library/datetime.rst:949 msgid "" ":meth:`fromtimestamp` may raise :exc:`OverflowError`, if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -1491,7 +1514,7 @@ msgid "" "preferred over :meth:`utcfromtimestamp`." msgstr "" -#: ../../library/datetime.rst:946 +#: ../../library/datetime.rst:960 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -1499,17 +1522,17 @@ msgid "" "`ValueError` on :c:func:`localtime` or :c:func:`gmtime` failure." msgstr "" -#: ../../library/datetime.rst:953 +#: ../../library/datetime.rst:967 msgid ":meth:`fromtimestamp` may return instances with :attr:`.fold` set to 1." msgstr "" -#: ../../library/datetime.rst:958 +#: ../../library/datetime.rst:972 msgid "" "Return the UTC :class:`.datetime` corresponding to the POSIX timestamp, " "with :attr:`.tzinfo` ``None``. (The resulting object is naive.)" msgstr "" -#: ../../library/datetime.rst:961 +#: ../../library/datetime.rst:975 msgid "" "This may raise :exc:`OverflowError`, if the timestamp is out of the range of " "values supported by the platform C :c:func:`gmtime` function, and :exc:" @@ -1517,33 +1540,33 @@ msgid "" "to years in 1970 through 2038." msgstr "" -#: ../../library/datetime.rst:966 +#: ../../library/datetime.rst:980 msgid "To get an aware :class:`.datetime` object, call :meth:`fromtimestamp`::" msgstr "" -#: ../../library/datetime.rst:968 +#: ../../library/datetime.rst:982 msgid "datetime.fromtimestamp(timestamp, timezone.utc)" msgstr "datetime.fromtimestamp(timestamp, timezone.utc)" -#: ../../library/datetime.rst:970 +#: ../../library/datetime.rst:984 msgid "" "On the POSIX compliant platforms, it is equivalent to the following " "expression::" msgstr "" -#: ../../library/datetime.rst:973 +#: ../../library/datetime.rst:987 msgid "" "datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" msgstr "" "datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" -#: ../../library/datetime.rst:975 +#: ../../library/datetime.rst:989 msgid "" "except the latter formula always supports the full years range: between :" "const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -#: ../../library/datetime.rst:980 +#: ../../library/datetime.rst:994 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -1552,7 +1575,7 @@ msgid "" "tz=timezone.utc)``." msgstr "" -#: ../../library/datetime.rst:986 +#: ../../library/datetime.rst:1000 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`gmtime` " @@ -1560,11 +1583,11 @@ msgid "" "`gmtime` failure." msgstr "" -#: ../../library/datetime.rst:994 +#: ../../library/datetime.rst:1008 msgid "Use :meth:`datetime.fromtimestamp` with :attr:`UTC` instead." msgstr "" -#: ../../library/datetime.rst:999 +#: ../../library/datetime.rst:1013 msgid "" "Return the :class:`.datetime` corresponding to the proleptic Gregorian " "ordinal, where January 1 of year 1 has ordinal 1. :exc:`ValueError` is " @@ -1573,7 +1596,7 @@ msgid "" "is ``None``." msgstr "" -#: ../../library/datetime.rst:1007 +#: ../../library/datetime.rst:1021 msgid "" "Return a new :class:`.datetime` object whose date components are equal to " "the given :class:`date` object's, and whose time components are equal to the " @@ -1584,35 +1607,35 @@ msgid "" "attr:`.tzinfo` attributes are ignored." msgstr "" -#: ../../library/datetime.rst:1015 +#: ../../library/datetime.rst:1029 msgid "" "For any :class:`.datetime` object *d*, ``d == datetime.combine(d.date(), d." "time(), d.tzinfo)``." msgstr "" -#: ../../library/datetime.rst:1018 +#: ../../library/datetime.rst:1032 msgid "Added the *tzinfo* argument." msgstr "新增 *tzinfo* 引數。" -#: ../../library/datetime.rst:1024 +#: ../../library/datetime.rst:1038 msgid "" "Return a :class:`.datetime` corresponding to a *date_string* in any valid " "ISO 8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:1027 ../../library/datetime.rst:1837 +#: ../../library/datetime.rst:1041 ../../library/datetime.rst:1851 msgid "Time zone offsets may have fractional seconds." msgstr "" -#: ../../library/datetime.rst:1028 +#: ../../library/datetime.rst:1042 msgid "The ``T`` separator may be replaced by any single unicode character." msgstr "" -#: ../../library/datetime.rst:1029 ../../library/datetime.rst:1842 +#: ../../library/datetime.rst:1043 ../../library/datetime.rst:1856 msgid "Fractional hours and minutes are not supported." msgstr "" -#: ../../library/datetime.rst:1038 +#: ../../library/datetime.rst:1052 msgid "" ">>> from datetime import datetime\n" ">>> datetime.fromisoformat('2011-11-04')\n" @@ -1658,13 +1681,13 @@ msgstr "" "datetime.datetime(2011, 11, 4, 0, 5, 23,\n" " tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))" -#: ../../library/datetime.rst:1060 +#: ../../library/datetime.rst:1074 msgid "" "Previously, this method only supported formats that could be emitted by :" "meth:`date.isoformat` or :meth:`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1067 +#: ../../library/datetime.rst:1081 msgid "" "Return a :class:`.datetime` corresponding to the ISO calendar date specified " "by year, week and day. The non-date components of the datetime are populated " @@ -1672,23 +1695,23 @@ msgid "" "`datetime.isocalendar`." msgstr "" -#: ../../library/datetime.rst:1076 +#: ../../library/datetime.rst:1090 msgid "" "Return a :class:`.datetime` corresponding to *date_string*, parsed according " "to *format*." msgstr "" -#: ../../library/datetime.rst:1079 +#: ../../library/datetime.rst:1093 msgid "" "If *format* does not contain microseconds or time zone information, this is " "equivalent to::" msgstr "" -#: ../../library/datetime.rst:1081 ../../library/datetime.rst:2562 +#: ../../library/datetime.rst:1095 ../../library/datetime.rst:2576 msgid "datetime(*(time.strptime(date_string, format)[0:6]))" msgstr "datetime(*(time.strptime(date_string, format)[0:6]))" -#: ../../library/datetime.rst:1083 +#: ../../library/datetime.rst:1097 msgid "" ":exc:`ValueError` is raised if the date_string and format can't be parsed " "by :func:`time.strptime` or if it returns a value which isn't a time tuple. " @@ -1696,7 +1719,7 @@ msgid "" "fromisoformat`." msgstr "" -#: ../../library/datetime.rst:1090 +#: ../../library/datetime.rst:1104 msgid "" "If *format* specifies a day of month without a year a :exc:" "`DeprecationWarning` is now emitted. This is to avoid a quadrennial leap " @@ -1707,7 +1730,7 @@ msgid "" "not have a year, explicitly add a year that is a leap year before parsing:" msgstr "" -#: ../../library/datetime.rst:1099 +#: ../../library/datetime.rst:1113 msgid "" ">>> from datetime import datetime\n" ">>> date_string = \"02/29\"\n" @@ -1717,44 +1740,44 @@ msgid "" "'February 29'" msgstr "" -#: ../../library/datetime.rst:1112 +#: ../../library/datetime.rst:1126 msgid "" "The earliest representable :class:`.datetime`, ``datetime(MINYEAR, 1, 1, " "tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1118 +#: ../../library/datetime.rst:1132 msgid "" "The latest representable :class:`.datetime`, ``datetime(MAXYEAR, 12, 31, 23, " "59, 59, 999999, tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1124 +#: ../../library/datetime.rst:1138 msgid "" "The smallest possible difference between non-equal :class:`.datetime` " "objects, ``timedelta(microseconds=1)``." msgstr "" -#: ../../library/datetime.rst:1147 ../../library/datetime.rst:1770 +#: ../../library/datetime.rst:1161 ../../library/datetime.rst:1784 msgid "In ``range(24)``." msgstr "" -#: ../../library/datetime.rst:1152 ../../library/datetime.rst:1157 -#: ../../library/datetime.rst:1775 ../../library/datetime.rst:1780 +#: ../../library/datetime.rst:1166 ../../library/datetime.rst:1171 +#: ../../library/datetime.rst:1789 ../../library/datetime.rst:1794 msgid "In ``range(60)``." msgstr "" -#: ../../library/datetime.rst:1162 ../../library/datetime.rst:1785 +#: ../../library/datetime.rst:1176 ../../library/datetime.rst:1799 msgid "In ``range(1000000)``." msgstr "" -#: ../../library/datetime.rst:1167 +#: ../../library/datetime.rst:1181 msgid "" "The object passed as the *tzinfo* argument to the :class:`.datetime` " "constructor, or ``None`` if none was passed." msgstr "" -#: ../../library/datetime.rst:1173 ../../library/datetime.rst:1796 +#: ../../library/datetime.rst:1187 ../../library/datetime.rst:1810 msgid "" "In ``[0, 1]``. Used to disambiguate wall times during a repeated interval. " "(A repeated interval occurs when clocks are rolled back at the end of " @@ -1764,26 +1787,26 @@ msgid "" "time representation." msgstr "" -#: ../../library/datetime.rst:1186 +#: ../../library/datetime.rst:1200 msgid "``datetime2 = datetime1 + timedelta``" msgstr "``datetime2 = datetime1 + timedelta``" -#: ../../library/datetime.rst:1186 ../../library/datetime.rst:2409 -#: ../../library/datetime.rst:2414 ../../library/datetime.rst:2426 -#: ../../library/datetime.rst:2431 ../../library/datetime.rst:2491 -#: ../../library/datetime.rst:2496 ../../library/datetime.rst:2500 +#: ../../library/datetime.rst:1200 ../../library/datetime.rst:2423 +#: ../../library/datetime.rst:2428 ../../library/datetime.rst:2440 +#: ../../library/datetime.rst:2445 ../../library/datetime.rst:2505 +#: ../../library/datetime.rst:2510 ../../library/datetime.rst:2514 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/datetime.rst:1188 +#: ../../library/datetime.rst:1202 msgid "``datetime2 = datetime1 - timedelta``" msgstr "``datetime2 = datetime1 - timedelta``" -#: ../../library/datetime.rst:1188 ../../library/datetime.rst:2442 +#: ../../library/datetime.rst:1202 ../../library/datetime.rst:2456 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/datetime.rst:1190 +#: ../../library/datetime.rst:1204 msgid "``timedelta = datetime1 - datetime2``" msgstr "``timedelta = datetime1 - datetime2``" @@ -1811,7 +1834,7 @@ msgstr "``datetime1 <= datetime2``" msgid "``datetime1 >= datetime2``" msgstr "``datetime1 >= datetime2``" -#: ../../library/datetime.rst:1202 +#: ../../library/datetime.rst:1216 msgid "" "``datetime2`` is a duration of ``timedelta`` removed from ``datetime1``, " "moving forward in time if ``timedelta.days > 0``, or backward if ``timedelta." @@ -1822,7 +1845,7 @@ msgid "" "adjustments are done even if the input is an aware object." msgstr "" -#: ../../library/datetime.rst:1211 +#: ../../library/datetime.rst:1225 msgid "" "Computes the ``datetime2`` such that ``datetime2 + timedelta == datetime1``. " "As for addition, the result has the same :attr:`~.datetime.tzinfo` attribute " @@ -1830,14 +1853,14 @@ msgid "" "input is aware." msgstr "" -#: ../../library/datetime.rst:1216 +#: ../../library/datetime.rst:1230 msgid "" "Subtraction of a :class:`.datetime` from a :class:`.datetime` is defined " "only if both operands are naive, or if both are aware. If one is aware and " "the other is naive, :exc:`TypeError` is raised." msgstr "" -#: ../../library/datetime.rst:1220 +#: ../../library/datetime.rst:1234 msgid "" "If both are naive, or both are aware and have the same :attr:`~.datetime." "tzinfo` attribute, the :attr:`~.datetime.tzinfo` attributes are ignored, and " @@ -1845,7 +1868,7 @@ msgid "" "datetime1``. No time zone adjustments are done in this case." msgstr "" -#: ../../library/datetime.rst:1225 +#: ../../library/datetime.rst:1239 msgid "" "If both are aware and have different :attr:`~.datetime.tzinfo` attributes, " "``a-b`` acts as if *a* and *b* were first converted to naive UTC datetimes. " @@ -1854,17 +1877,17 @@ msgid "" "overflows." msgstr "" -#: ../../library/datetime.rst:1231 +#: ../../library/datetime.rst:1245 msgid "" ":class:`.datetime` objects are equal if they represent the same date and " "time, taking into account the time zone." msgstr "" -#: ../../library/datetime.rst:1234 +#: ../../library/datetime.rst:1248 msgid "Naive and aware :class:`!datetime` objects are never equal." msgstr "" -#: ../../library/datetime.rst:1236 +#: ../../library/datetime.rst:1250 msgid "" "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " "the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " @@ -1875,19 +1898,19 @@ msgid "" "interval are never equal to :class:`!datetime` instances in other time zone." msgstr "" -#: ../../library/datetime.rst:1246 +#: ../../library/datetime.rst:1260 msgid "" "*datetime1* is considered less than *datetime2* when *datetime1* precedes " "*datetime2* in time, taking into account the time zone." msgstr "" -#: ../../library/datetime.rst:1249 +#: ../../library/datetime.rst:1263 msgid "" "Order comparison between naive and aware :class:`.datetime` objects raises :" "exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1252 +#: ../../library/datetime.rst:1266 msgid "" "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " "the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " @@ -1897,33 +1920,33 @@ msgid "" "implementation never overflows." msgstr "" -#: ../../library/datetime.rst:1259 +#: ../../library/datetime.rst:1273 msgid "" "Equality comparisons between aware and naive :class:`.datetime` instances " "don't raise :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1275 +#: ../../library/datetime.rst:1289 msgid "Return :class:`date` object with same year, month and day." msgstr "" -#: ../../library/datetime.rst:1280 +#: ../../library/datetime.rst:1294 msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond and " "fold. :attr:`.tzinfo` is ``None``. See also method :meth:`timetz`." msgstr "" -#: ../../library/datetime.rst:1283 ../../library/datetime.rst:1292 +#: ../../library/datetime.rst:1297 ../../library/datetime.rst:1306 msgid "The fold value is copied to the returned :class:`.time` object." msgstr "" -#: ../../library/datetime.rst:1289 +#: ../../library/datetime.rst:1303 msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond, " "fold, and tzinfo attributes. See also method :meth:`time`." msgstr "" -#: ../../library/datetime.rst:1300 +#: ../../library/datetime.rst:1314 msgid "" "Return a datetime with the same attributes, except for those attributes " "given new values by whichever keyword arguments are specified. Note that " @@ -1931,27 +1954,27 @@ msgid "" "datetime with no conversion of date and time data." msgstr "" -#: ../../library/datetime.rst:1305 +#: ../../library/datetime.rst:1319 msgid "" ":class:`.datetime` objects are also supported by generic function :func:" "`copy.replace`." msgstr "" -#: ../../library/datetime.rst:1314 +#: ../../library/datetime.rst:1328 msgid "" "Return a :class:`.datetime` object with new :attr:`.tzinfo` attribute *tz*, " "adjusting the date and time data so the result is the same UTC time as " "*self*, but in *tz*'s local time." msgstr "" -#: ../../library/datetime.rst:1318 +#: ../../library/datetime.rst:1332 msgid "" "If provided, *tz* must be an instance of a :class:`tzinfo` subclass, and " "its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. If " "*self* is naive, it is presumed to represent time in the system time zone." msgstr "" -#: ../../library/datetime.rst:1322 +#: ../../library/datetime.rst:1336 msgid "" "If called without arguments (or with ``tz=None``) the system local time zone " "is assumed for the target time zone. The ``.tzinfo`` attribute of the " @@ -1959,7 +1982,7 @@ msgid "" "with the zone name and offset obtained from the OS." msgstr "" -#: ../../library/datetime.rst:1327 +#: ../../library/datetime.rst:1341 msgid "" "If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no " "adjustment of date or time data is performed. Else the result is local time " @@ -1968,7 +1991,7 @@ msgid "" "date and time data as ``dt - dt.utcoffset()``." msgstr "" -#: ../../library/datetime.rst:1333 +#: ../../library/datetime.rst:1347 msgid "" "If you merely want to attach a :class:`timezone` object *tz* to a datetime " "*dt* without adjustment of date and time data, use ``dt." @@ -1977,14 +2000,14 @@ msgid "" "use ``dt.replace(tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1338 +#: ../../library/datetime.rst:1352 msgid "" "Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :" "class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. " "Ignoring error cases, :meth:`astimezone` acts like::" msgstr "" -#: ../../library/datetime.rst:1342 +#: ../../library/datetime.rst:1356 msgid "" "def astimezone(self, tz):\n" " if self.tzinfo is tz:\n" @@ -1995,49 +2018,49 @@ msgid "" " return tz.fromutc(utc)" msgstr "" -#: ../../library/datetime.rst:1350 +#: ../../library/datetime.rst:1364 msgid "*tz* now can be omitted." msgstr "" -#: ../../library/datetime.rst:1353 +#: ../../library/datetime.rst:1367 msgid "" "The :meth:`astimezone` method can now be called on naive instances that are " "presumed to represent system local time." msgstr "" -#: ../../library/datetime.rst:1360 +#: ../../library/datetime.rst:1374 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "utcoffset(self)``, and raises an exception if the latter doesn't return " "``None`` or a :class:`timedelta` object with magnitude less than one day." msgstr "" -#: ../../library/datetime.rst:1364 ../../library/datetime.rst:1959 -#: ../../library/datetime.rst:2066 ../../library/datetime.rst:2311 -#: ../../library/datetime.rst:2323 ../../library/datetime.rst:2635 +#: ../../library/datetime.rst:1378 ../../library/datetime.rst:1973 +#: ../../library/datetime.rst:2080 ../../library/datetime.rst:2325 +#: ../../library/datetime.rst:2337 ../../library/datetime.rst:2649 msgid "The UTC offset is not restricted to a whole number of minutes." msgstr "" -#: ../../library/datetime.rst:1370 +#: ../../library/datetime.rst:1384 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "dst(self)``, and raises an exception if the latter doesn't return ``None`` " "or a :class:`timedelta` object with magnitude less than one day." msgstr "" -#: ../../library/datetime.rst:1374 ../../library/datetime.rst:1969 -#: ../../library/datetime.rst:2120 +#: ../../library/datetime.rst:1388 ../../library/datetime.rst:1983 +#: ../../library/datetime.rst:2134 msgid "The DST offset is not restricted to a whole number of minutes." msgstr "" -#: ../../library/datetime.rst:1380 +#: ../../library/datetime.rst:1394 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "tzname(self)``, raises an exception if the latter doesn't return ``None`` or " "a string object," msgstr "" -#: ../../library/datetime.rst:1391 +#: ../../library/datetime.rst:1405 msgid "" "time.struct_time((d.year, d.month, d.day,\n" " d.hour, d.minute, d.second,\n" @@ -2047,7 +2070,7 @@ msgstr "" " d.hour, d.minute, d.second,\n" " d.weekday(), yday, dst))" -#: ../../library/datetime.rst:1395 +#: ../../library/datetime.rst:1409 msgid "" "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " "day number within the current year starting with 1 for January 1st. The :" @@ -2058,7 +2081,7 @@ msgid "" "to 0." msgstr "" -#: ../../library/datetime.rst:1406 +#: ../../library/datetime.rst:1420 msgid "" "If :class:`.datetime` instance *d* is naive, this is the same as ``d." "timetuple()`` except that :attr:`~.time.struct_time.tm_isdst` is forced to 0 " @@ -2066,7 +2089,7 @@ msgid "" "time." msgstr "" -#: ../../library/datetime.rst:1410 +#: ../../library/datetime.rst:1424 msgid "" "If *d* is aware, *d* is normalized to UTC time, by subtracting ``d." "utcoffset()``, and a :class:`time.struct_time` for the normalized time is " @@ -2075,7 +2098,7 @@ msgid "" "and UTC adjustment spills over a year boundary." msgstr "" -#: ../../library/datetime.rst:1419 +#: ../../library/datetime.rst:1433 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -2085,20 +2108,20 @@ msgid "" "meth:`.datetime.timetuple`." msgstr "" -#: ../../library/datetime.rst:1428 +#: ../../library/datetime.rst:1442 msgid "" "Return the proleptic Gregorian ordinal of the date. The same as ``self." "date().toordinal()``." msgstr "" -#: ../../library/datetime.rst:1433 +#: ../../library/datetime.rst:1447 msgid "" "Return POSIX timestamp corresponding to the :class:`.datetime` instance. The " "return value is a :class:`float` similar to that returned by :func:`time." "time`." msgstr "" -#: ../../library/datetime.rst:1437 +#: ../../library/datetime.rst:1451 msgid "" "Naive :class:`.datetime` instances are assumed to represent local time and " "this method relies on the platform C :c:func:`mktime` function to perform " @@ -2108,22 +2131,22 @@ msgid "" "future." msgstr "" -#: ../../library/datetime.rst:1444 +#: ../../library/datetime.rst:1458 msgid "" "For aware :class:`.datetime` instances, the return value is computed as::" msgstr "" -#: ../../library/datetime.rst:1447 +#: ../../library/datetime.rst:1461 msgid "(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()" msgstr "(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()" -#: ../../library/datetime.rst:1451 +#: ../../library/datetime.rst:1465 msgid "" "The :meth:`timestamp` method uses the :attr:`.fold` attribute to " "disambiguate the times during a repeated interval." msgstr "" -#: ../../library/datetime.rst:1457 +#: ../../library/datetime.rst:1471 msgid "" "There is no method to obtain the POSIX timestamp directly from a naive :" "class:`.datetime` instance representing UTC time. If your application uses " @@ -2131,57 +2154,57 @@ msgid "" "the POSIX timestamp by supplying ``tzinfo=timezone.utc``::" msgstr "" -#: ../../library/datetime.rst:1463 +#: ../../library/datetime.rst:1477 msgid "timestamp = dt.replace(tzinfo=timezone.utc).timestamp()" msgstr "timestamp = dt.replace(tzinfo=timezone.utc).timestamp()" -#: ../../library/datetime.rst:1465 +#: ../../library/datetime.rst:1479 msgid "or by calculating the timestamp directly::" msgstr "" -#: ../../library/datetime.rst:1467 +#: ../../library/datetime.rst:1481 msgid "timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)" msgstr "timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)" -#: ../../library/datetime.rst:1471 +#: ../../library/datetime.rst:1485 msgid "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " "The same as ``self.date().weekday()``. See also :meth:`isoweekday`." msgstr "" -#: ../../library/datetime.rst:1477 +#: ../../library/datetime.rst:1491 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " "The same as ``self.date().isoweekday()``. See also :meth:`weekday`, :meth:" "`isocalendar`." msgstr "" -#: ../../library/datetime.rst:1484 +#: ../../library/datetime.rst:1498 msgid "" "Return a :term:`named tuple` with three components: ``year``, ``week`` and " "``weekday``. The same as ``self.date().isocalendar()``." msgstr "" -#: ../../library/datetime.rst:1490 +#: ../../library/datetime.rst:1504 msgid "Return a string representing the date and time in ISO 8601 format:" msgstr "" -#: ../../library/datetime.rst:1492 +#: ../../library/datetime.rst:1506 msgid "``YYYY-MM-DDTHH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "``YYYY-MM-DDTHH:MM:SS.ffffff``,如果 :attr:`microsecond` 不是 0" -#: ../../library/datetime.rst:1493 +#: ../../library/datetime.rst:1507 msgid "``YYYY-MM-DDTHH:MM:SS``, if :attr:`microsecond` is 0" msgstr "``YYYY-MM-DDTHH:MM:SS``,如果 :attr:`microsecond` 是 0" -#: ../../library/datetime.rst:1495 +#: ../../library/datetime.rst:1509 msgid "" "If :meth:`utcoffset` does not return ``None``, a string is appended, giving " "the UTC offset:" msgstr "" "如果 :meth:`utcoffset` 没有回傳 ``None``,則會附加一个字串,給出 UTC 偏移:" -#: ../../library/datetime.rst:1498 +#: ../../library/datetime.rst:1512 msgid "" "``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` " "is not 0" @@ -2189,13 +2212,13 @@ msgstr "" "``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``,如果 :attr:`microsecond` " "不是 0" -#: ../../library/datetime.rst:1500 +#: ../../library/datetime.rst:1514 msgid "" "``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0" msgstr "" "``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``,如果 :attr:`microsecond` 是 0" -#: ../../library/datetime.rst:1504 +#: ../../library/datetime.rst:1518 msgid "" ">>> from datetime import datetime, timezone\n" ">>> datetime(2019, 5, 18, 15, 17, 8, 132263).isoformat()\n" @@ -2209,13 +2232,13 @@ msgstr "" ">>> datetime(2019, 5, 18, 15, 17, tzinfo=timezone.utc).isoformat()\n" "'2019-05-18T15:17:00+00:00'" -#: ../../library/datetime.rst:1510 +#: ../../library/datetime.rst:1524 msgid "" "The optional argument *sep* (default ``'T'``) is a one-character separator, " "placed between the date and time portions of the result. For example::" msgstr "" -#: ../../library/datetime.rst:1513 +#: ../../library/datetime.rst:1527 msgid "" ">>> from datetime import tzinfo, timedelta, datetime\n" ">>> class TZ(tzinfo):\n" @@ -2229,53 +2252,53 @@ msgid "" "'2009-11-27T00:00:00.000100-06:39'" msgstr "" -#: ../../library/datetime.rst:1524 ../../library/datetime.rst:1899 +#: ../../library/datetime.rst:1538 ../../library/datetime.rst:1913 msgid "" "The optional argument *timespec* specifies the number of additional " "components of the time to include (the default is ``'auto'``). It can be one " "of the following:" msgstr "" -#: ../../library/datetime.rst:1528 ../../library/datetime.rst:1903 +#: ../../library/datetime.rst:1542 ../../library/datetime.rst:1917 msgid "" "``'auto'``: Same as ``'seconds'`` if :attr:`microsecond` is 0, same as " "``'microseconds'`` otherwise." msgstr "" -#: ../../library/datetime.rst:1530 ../../library/datetime.rst:1905 +#: ../../library/datetime.rst:1544 ../../library/datetime.rst:1919 msgid "``'hours'``: Include the :attr:`hour` in the two-digit ``HH`` format." msgstr "" -#: ../../library/datetime.rst:1531 ../../library/datetime.rst:1906 +#: ../../library/datetime.rst:1545 ../../library/datetime.rst:1920 msgid "" "``'minutes'``: Include :attr:`hour` and :attr:`minute` in ``HH:MM`` format." msgstr "" -#: ../../library/datetime.rst:1532 ../../library/datetime.rst:1907 +#: ../../library/datetime.rst:1546 ../../library/datetime.rst:1921 msgid "" "``'seconds'``: Include :attr:`hour`, :attr:`minute`, and :attr:`second` in " "``HH:MM:SS`` format." msgstr "" -#: ../../library/datetime.rst:1534 ../../library/datetime.rst:1909 +#: ../../library/datetime.rst:1548 ../../library/datetime.rst:1923 msgid "" "``'milliseconds'``: Include full time, but truncate fractional second part " "to milliseconds. ``HH:MM:SS.sss`` format." msgstr "" -#: ../../library/datetime.rst:1536 ../../library/datetime.rst:1911 +#: ../../library/datetime.rst:1550 ../../library/datetime.rst:1925 msgid "``'microseconds'``: Include full time in ``HH:MM:SS.ffffff`` format." msgstr "" -#: ../../library/datetime.rst:1540 ../../library/datetime.rst:1915 +#: ../../library/datetime.rst:1554 ../../library/datetime.rst:1929 msgid "Excluded time components are truncated, not rounded." msgstr "" -#: ../../library/datetime.rst:1542 +#: ../../library/datetime.rst:1556 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument::" msgstr "" -#: ../../library/datetime.rst:1545 +#: ../../library/datetime.rst:1559 msgid "" ">>> from datetime import datetime\n" ">>> datetime.now().isoformat(timespec='minutes') \n" @@ -2291,21 +2314,21 @@ msgstr "" ">>> dt.isoformat(timespec='microseconds')\n" "'2015-01-01T12:30:59.000000'" -#: ../../library/datetime.rst:1552 ../../library/datetime.rst:1930 +#: ../../library/datetime.rst:1566 ../../library/datetime.rst:1944 msgid "Added the *timespec* parameter." msgstr "新增 *timespec* 參數。" -#: ../../library/datetime.rst:1558 +#: ../../library/datetime.rst:1572 msgid "" "For a :class:`.datetime` instance *d*, ``str(d)`` is equivalent to ``d." "isoformat(' ')``." msgstr "" -#: ../../library/datetime.rst:1564 +#: ../../library/datetime.rst:1578 msgid "Return a string representing the date and time::" msgstr "" -#: ../../library/datetime.rst:1566 +#: ../../library/datetime.rst:1580 msgid "" ">>> from datetime import datetime\n" ">>> datetime(2002, 12, 4, 20, 30, 40).ctime()\n" @@ -2315,27 +2338,27 @@ msgstr "" ">>> datetime(2002, 12, 4, 20, 30, 40).ctime()\n" "'Wed Dec 4 20:30:40 2002'" -#: ../../library/datetime.rst:1570 +#: ../../library/datetime.rst:1584 msgid "" "The output string will *not* include time zone information, regardless of " "whether the input is aware or naive." msgstr "" -#: ../../library/datetime.rst:1577 +#: ../../library/datetime.rst:1591 msgid "" "on platforms where the native C :c:func:`ctime` function (which :func:`time." "ctime` invokes, but which :meth:`datetime.ctime` does not invoke) conforms " "to the C standard." msgstr "" -#: ../../library/datetime.rst:1584 +#: ../../library/datetime.rst:1598 msgid "" "Return a string representing the date and time, controlled by an explicit " "format string. See also :ref:`strftime-strptime-behavior` and :meth:" "`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1591 +#: ../../library/datetime.rst:1605 msgid "" "Same as :meth:`.datetime.strftime`. This makes it possible to specify a " "format string for a :class:`.datetime` object in :ref:`formatted string " @@ -2343,15 +2366,15 @@ msgid "" "`strftime-strptime-behavior` and :meth:`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1598 +#: ../../library/datetime.rst:1612 msgid "Examples of Usage: :class:`.datetime`" msgstr "用法範例::class:`.datetime`" -#: ../../library/datetime.rst:1600 +#: ../../library/datetime.rst:1614 msgid "Examples of working with :class:`.datetime` objects:" msgstr "更多 :class:`.datetime` 的用法範例:" -#: ../../library/datetime.rst:1602 +#: ../../library/datetime.rst:1616 msgid "" ">>> from datetime import datetime, date, time, timezone\n" "\n" @@ -2405,14 +2428,14 @@ msgid "" "'The day is 21, the month is November, the time is 04:30PM.'" msgstr "" -#: ../../library/datetime.rst:1653 +#: ../../library/datetime.rst:1667 msgid "" "The example below defines a :class:`tzinfo` subclass capturing time zone " "information for Kabul, Afghanistan, which used +4 UTC until 1945 and then " "+4:30 UTC thereafter::" msgstr "" -#: ../../library/datetime.rst:1657 +#: ../../library/datetime.rst:1671 msgid "" "from datetime import timedelta, datetime, tzinfo, timezone\n" "\n" @@ -2459,11 +2482,11 @@ msgid "" " return \"+04\"" msgstr "" -#: ../../library/datetime.rst:1700 +#: ../../library/datetime.rst:1714 msgid "Usage of ``KabulTz`` from above::" msgstr "" -#: ../../library/datetime.rst:1702 +#: ../../library/datetime.rst:1716 msgid "" ">>> tz1 = KabulTz()\n" "\n" @@ -2487,63 +2510,63 @@ msgid "" "True" msgstr "" -#: ../../library/datetime.rst:1726 +#: ../../library/datetime.rst:1740 msgid ":class:`.time` Objects" msgstr ":class:`.time` 物件" -#: ../../library/datetime.rst:1728 +#: ../../library/datetime.rst:1742 msgid "" "A :class:`.time` object represents a (local) time of day, independent of any " "particular day, and subject to adjustment via a :class:`tzinfo` object." msgstr "" -#: ../../library/datetime.rst:1733 +#: ../../library/datetime.rst:1747 msgid "" "All arguments are optional. *tzinfo* may be ``None``, or an instance of a :" "class:`tzinfo` subclass. The remaining arguments must be integers in the " "following ranges:" msgstr "" -#: ../../library/datetime.rst:1743 +#: ../../library/datetime.rst:1757 msgid "" "If an argument outside those ranges is given, :exc:`ValueError` is raised. " "All default to 0 except *tzinfo*, which defaults to ``None``." msgstr "" -#: ../../library/datetime.rst:1751 +#: ../../library/datetime.rst:1765 msgid "The earliest representable :class:`.time`, ``time(0, 0, 0, 0)``." msgstr "" -#: ../../library/datetime.rst:1756 +#: ../../library/datetime.rst:1770 msgid "The latest representable :class:`.time`, ``time(23, 59, 59, 999999)``." msgstr "" -#: ../../library/datetime.rst:1761 +#: ../../library/datetime.rst:1775 msgid "" "The smallest possible difference between non-equal :class:`.time` objects, " "``timedelta(microseconds=1)``, although note that arithmetic on :class:`." "time` objects is not supported." msgstr "" -#: ../../library/datetime.rst:1790 +#: ../../library/datetime.rst:1804 msgid "" "The object passed as the tzinfo argument to the :class:`.time` constructor, " "or ``None`` if none was passed." msgstr "" -#: ../../library/datetime.rst:1804 +#: ../../library/datetime.rst:1818 msgid "" ":class:`.time` objects support equality and order comparisons, where *a* is " "considered less than *b* when *a* precedes *b* in time." msgstr "" -#: ../../library/datetime.rst:1807 +#: ../../library/datetime.rst:1821 msgid "" "Naive and aware :class:`!time` objects are never equal. Order comparison " "between naive and aware :class:`!time` objects raises :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1811 +#: ../../library/datetime.rst:1825 msgid "" "If both comparands are aware, and have the same :attr:`~.time.tzinfo` " "attribute, the :attr:`!tzinfo` and :attr:`!fold` attributes are ignored and " @@ -2552,18 +2575,18 @@ msgid "" "subtracting their UTC offsets (obtained from ``self.utcoffset()``)." msgstr "" -#: ../../library/datetime.rst:1817 +#: ../../library/datetime.rst:1831 msgid "" "Equality comparisons between aware and naive :class:`.time` instances don't " "raise :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1821 +#: ../../library/datetime.rst:1835 msgid "" "In Boolean contexts, a :class:`.time` object is always considered to be true." msgstr "" -#: ../../library/datetime.rst:1823 +#: ../../library/datetime.rst:1837 msgid "" "Before Python 3.5, a :class:`.time` object was considered to be false if it " "represented midnight in UTC. This behavior was considered obscure and error-" @@ -2571,33 +2594,33 @@ msgid "" "details." msgstr "" -#: ../../library/datetime.rst:1830 +#: ../../library/datetime.rst:1844 msgid "Other constructor:" msgstr "" -#: ../../library/datetime.rst:1834 +#: ../../library/datetime.rst:1848 msgid "" "Return a :class:`.time` corresponding to a *time_string* in any valid ISO " "8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:1838 +#: ../../library/datetime.rst:1852 msgid "" "The leading ``T``, normally required in cases where there may be ambiguity " "between a date and a time, is not required." msgstr "" -#: ../../library/datetime.rst:1840 +#: ../../library/datetime.rst:1854 msgid "" "Fractional seconds may have any number of digits (anything beyond 6 will be " "truncated)." msgstr "" -#: ../../library/datetime.rst:1844 +#: ../../library/datetime.rst:1858 msgid "Examples:" msgstr "範例: ::" -#: ../../library/datetime.rst:1846 +#: ../../library/datetime.rst:1860 msgid "" ">>> from datetime import time\n" ">>> time.fromisoformat('04:23:01')\n" @@ -2637,13 +2660,13 @@ msgstr "" ">>> time.fromisoformat('04:23:01+00:00')\n" "datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)" -#: ../../library/datetime.rst:1868 +#: ../../library/datetime.rst:1882 msgid "" "Previously, this method only supported formats that could be emitted by :" "meth:`time.isoformat`." msgstr "" -#: ../../library/datetime.rst:1878 +#: ../../library/datetime.rst:1892 msgid "" "Return a :class:`.time` with the same value, except for those attributes " "given new values by whichever keyword arguments are specified. Note that " @@ -2651,41 +2674,41 @@ msgid "" "aware :class:`.time`, without conversion of the time data." msgstr "" -#: ../../library/datetime.rst:1883 +#: ../../library/datetime.rst:1897 msgid "" ":class:`.time` objects are also supported by generic function :func:`copy." "replace`." msgstr "" -#: ../../library/datetime.rst:1892 +#: ../../library/datetime.rst:1906 msgid "Return a string representing the time in ISO 8601 format, one of:" msgstr "" -#: ../../library/datetime.rst:1894 +#: ../../library/datetime.rst:1908 msgid "``HH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "" -#: ../../library/datetime.rst:1895 +#: ../../library/datetime.rst:1909 msgid "``HH:MM:SS``, if :attr:`microsecond` is 0" msgstr "" -#: ../../library/datetime.rst:1896 +#: ../../library/datetime.rst:1910 msgid "" "``HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :meth:`utcoffset` does not " "return ``None``" msgstr "" -#: ../../library/datetime.rst:1897 +#: ../../library/datetime.rst:1911 msgid "" "``HH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0 and :meth:" "`utcoffset` does not return ``None``" msgstr "" -#: ../../library/datetime.rst:1917 +#: ../../library/datetime.rst:1931 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument." msgstr "" -#: ../../library/datetime.rst:1921 +#: ../../library/datetime.rst:1935 msgid "" ">>> from datetime import time\n" ">>> time(hour=12, minute=34, second=56, microsecond=123456)." @@ -2707,18 +2730,18 @@ msgstr "" ">>> dt.isoformat(timespec='auto')\n" "'12:34:56'" -#: ../../library/datetime.rst:1936 +#: ../../library/datetime.rst:1950 msgid "For a time *t*, ``str(t)`` is equivalent to ``t.isoformat()``." msgstr "" -#: ../../library/datetime.rst:1941 +#: ../../library/datetime.rst:1955 msgid "" "Return a string representing the time, controlled by an explicit format " "string. See also :ref:`strftime-strptime-behavior` and :meth:`time." "isoformat`." msgstr "" -#: ../../library/datetime.rst:1947 +#: ../../library/datetime.rst:1961 msgid "" "Same as :meth:`.time.strftime`. This makes it possible to specify a format " "string for a :class:`.time` object in :ref:`formatted string literals >> from datetime import time, tzinfo, timedelta\n" ">>> class TZ1(tzinfo):\n" @@ -2807,18 +2830,18 @@ msgstr "" ">>> 'The {} is {:%H:%M}.'.format(\"time\", t)\n" "'The time is 12:10.'" -#: ../../library/datetime.rst:2012 +#: ../../library/datetime.rst:2026 msgid ":class:`tzinfo` Objects" msgstr ":class:`tzinfo` 物件" -#: ../../library/datetime.rst:2016 +#: ../../library/datetime.rst:2030 msgid "" "This is an abstract base class, meaning that this class should not be " "instantiated directly. Define a subclass of :class:`tzinfo` to capture " "information about a particular time zone." msgstr "" -#: ../../library/datetime.rst:2020 +#: ../../library/datetime.rst:2034 msgid "" "An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the " "constructors for :class:`.datetime` and :class:`.time` objects. The latter " @@ -2828,7 +2851,7 @@ msgid "" "object passed to them." msgstr "" -#: ../../library/datetime.rst:2026 +#: ../../library/datetime.rst:2040 msgid "" "You need to derive a concrete subclass, and (at least) supply " "implementations of the standard :class:`tzinfo` methods needed by the :class:" @@ -2838,7 +2861,7 @@ msgid "" "American EST and EDT." msgstr "" -#: ../../library/datetime.rst:2033 +#: ../../library/datetime.rst:2047 msgid "" "Special requirement for pickling: A :class:`tzinfo` subclass must have an :" "meth:`~object.__init__` method that can be called with no arguments, " @@ -2846,20 +2869,20 @@ msgid "" "technical requirement that may be relaxed in the future." msgstr "" -#: ../../library/datetime.rst:2039 +#: ../../library/datetime.rst:2053 msgid "" "A concrete subclass of :class:`tzinfo` may need to implement the following " "methods. Exactly which methods are needed depends on the uses made of aware :" "mod:`!datetime` objects. If in doubt, simply implement all of them." msgstr "" -#: ../../library/datetime.rst:2046 +#: ../../library/datetime.rst:2060 msgid "" "Return offset of local time from UTC, as a :class:`timedelta` object that is " "positive east of UTC. If local time is west of UTC, this should be negative." msgstr "" -#: ../../library/datetime.rst:2049 +#: ../../library/datetime.rst:2063 msgid "" "This represents the *total* offset from UTC; for example, if a :class:" "`tzinfo` object represents both time zone and DST adjustments, :meth:" @@ -2870,31 +2893,31 @@ msgid "" "meth:`utcoffset` will probably look like one of these two::" msgstr "" -#: ../../library/datetime.rst:2057 +#: ../../library/datetime.rst:2071 msgid "" "return CONSTANT # fixed-offset class\n" "return CONSTANT + self.dst(dt) # daylight-aware class" msgstr "" -#: ../../library/datetime.rst:2060 +#: ../../library/datetime.rst:2074 msgid "" "If :meth:`utcoffset` does not return ``None``, :meth:`dst` should not return " "``None`` either." msgstr "" -#: ../../library/datetime.rst:2063 +#: ../../library/datetime.rst:2077 msgid "" "The default implementation of :meth:`utcoffset` raises :exc:" "`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2072 +#: ../../library/datetime.rst:2086 msgid "" "Return the daylight saving time (DST) adjustment, as a :class:`timedelta` " "object or ``None`` if DST information isn't known." msgstr "" -#: ../../library/datetime.rst:2076 +#: ../../library/datetime.rst:2090 msgid "" "Return ``timedelta(0)`` if DST is not in effect. If DST is in effect, return " "the offset as a :class:`timedelta` object (see :meth:`utcoffset` for " @@ -2907,17 +2930,17 @@ msgid "" "to account for DST changes when crossing time zones." msgstr "" -#: ../../library/datetime.rst:2086 +#: ../../library/datetime.rst:2100 msgid "" "An instance *tz* of a :class:`tzinfo` subclass that models both standard and " "daylight times must be consistent in this sense:" msgstr "" -#: ../../library/datetime.rst:2089 +#: ../../library/datetime.rst:2103 msgid "``tz.utcoffset(dt) - tz.dst(dt)``" msgstr "``tz.utcoffset(dt) - tz.dst(dt)``" -#: ../../library/datetime.rst:2091 +#: ../../library/datetime.rst:2105 msgid "" "must return the same result for every :class:`.datetime` *dt* with ``dt." "tzinfo == tz``. For sane :class:`tzinfo` subclasses, this expression yields " @@ -2930,24 +2953,24 @@ msgid "" "astimezone` regardless." msgstr "" -#: ../../library/datetime.rst:2100 +#: ../../library/datetime.rst:2114 msgid "" "Most implementations of :meth:`dst` will probably look like one of these " "two::" msgstr "" -#: ../../library/datetime.rst:2102 +#: ../../library/datetime.rst:2116 msgid "" "def dst(self, dt):\n" " # a fixed-offset class: doesn't account for DST\n" " return timedelta(0)" msgstr "" -#: ../../library/datetime.rst:2106 +#: ../../library/datetime.rst:2120 msgid "or::" msgstr "或是: ::" -#: ../../library/datetime.rst:2108 +#: ../../library/datetime.rst:2122 msgid "" "def dst(self, dt):\n" " # Code to set dston and dstoff to the time zone's DST\n" @@ -2960,12 +2983,12 @@ msgid "" " return timedelta(0)" msgstr "" -#: ../../library/datetime.rst:2118 +#: ../../library/datetime.rst:2132 msgid "" "The default implementation of :meth:`dst` raises :exc:`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2126 +#: ../../library/datetime.rst:2140 msgid "" "Return the time zone name corresponding to the :class:`.datetime` object " "*dt*, as a string. Nothing about string names is defined by the :mod:`!" @@ -2979,13 +3002,13 @@ msgid "" "accounting for daylight time." msgstr "" -#: ../../library/datetime.rst:2136 +#: ../../library/datetime.rst:2150 msgid "" "The default implementation of :meth:`tzname` raises :exc:" "`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2139 +#: ../../library/datetime.rst:2153 msgid "" "These methods are called by a :class:`.datetime` or :class:`.time` object, " "in response to their methods of the same names. A :class:`.datetime` object " @@ -2995,7 +3018,7 @@ msgid "" "datetime`." msgstr "" -#: ../../library/datetime.rst:2145 +#: ../../library/datetime.rst:2159 msgid "" "When ``None`` is passed, it's up to the class designer to decide the best " "response. For example, returning ``None`` is appropriate if the class wishes " @@ -3004,7 +3027,7 @@ msgid "" "offset, as there is no other convention for discovering the standard offset." msgstr "" -#: ../../library/datetime.rst:2151 +#: ../../library/datetime.rst:2165 msgid "" "When a :class:`.datetime` object is passed in response to a :class:`." "datetime` method, ``dt.tzinfo`` is the same object as *self*. :class:" @@ -3014,13 +3037,13 @@ msgid "" "zones." msgstr "" -#: ../../library/datetime.rst:2157 +#: ../../library/datetime.rst:2171 msgid "" "There is one more :class:`tzinfo` method that a subclass may wish to " "override:" msgstr "" -#: ../../library/datetime.rst:2162 +#: ../../library/datetime.rst:2176 msgid "" "This is called from the default :meth:`datetime.astimezone` implementation. " "When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time " @@ -3029,7 +3052,7 @@ msgid "" "datetime in *self*'s local time." msgstr "" -#: ../../library/datetime.rst:2168 +#: ../../library/datetime.rst:2182 msgid "" "Most :class:`tzinfo` subclasses should be able to inherit the default :meth:" "`fromutc` implementation without problems. It's strong enough to handle " @@ -3044,13 +3067,13 @@ msgid "" "offset changes." msgstr "" -#: ../../library/datetime.rst:2179 +#: ../../library/datetime.rst:2193 msgid "" "Skipping code for error cases, the default :meth:`fromutc` implementation " "acts like::" msgstr "" -#: ../../library/datetime.rst:2182 +#: ../../library/datetime.rst:2196 msgid "" "def fromutc(self, dt):\n" " # raise ValueError error if dt.tzinfo is not self\n" @@ -3068,13 +3091,13 @@ msgid "" " return dt" msgstr "" -#: ../../library/datetime.rst:2197 +#: ../../library/datetime.rst:2211 msgid "" "In the following :download:`tzinfo_examples.py <../includes/tzinfo_examples." "py>` file there are some examples of :class:`tzinfo` classes:" msgstr "" -#: ../../library/datetime.rst:2201 +#: ../../library/datetime.rst:2215 msgid "" "from datetime import tzinfo, timedelta, datetime\n" "\n" @@ -3254,7 +3277,7 @@ msgid "" "Pacific = USTimeZone(-8, \"Pacific\", \"PST\", \"PDT\")\n" msgstr "" -#: ../../library/datetime.rst:2203 +#: ../../library/datetime.rst:2217 msgid "" "Note that there are unavoidable subtleties twice per year in a :class:" "`tzinfo` subclass accounting for both standard and daylight time, at the DST " @@ -3263,7 +3286,7 @@ msgid "" "ends the minute after 1:59 (EDT) on the first Sunday in November::" msgstr "" -#: ../../library/datetime.rst:2209 +#: ../../library/datetime.rst:2223 msgid "" " UTC 3:MM 4:MM 5:MM 6:MM 7:MM 8:MM\n" " EST 22:MM 23:MM 0:MM 1:MM 2:MM 3:MM\n" @@ -3281,7 +3304,7 @@ msgstr "" "\n" " end 23:MM 0:MM 1:MM 1:MM 2:MM 3:MM" -#: ../../library/datetime.rst:2217 +#: ../../library/datetime.rst:2231 msgid "" "When DST starts (the \"start\" line), the local wall clock leaps from 1:59 " "to 3:00. A wall time of the form 2:MM doesn't really make sense on that day, " @@ -3290,7 +3313,7 @@ msgid "" "get::" msgstr "" -#: ../../library/datetime.rst:2222 +#: ../../library/datetime.rst:2236 msgid "" ">>> from datetime import datetime, timezone\n" ">>> from tzinfo_examples import HOUR, Eastern\n" @@ -3318,7 +3341,7 @@ msgstr "" "07:00:00 UTC = 03:00:00 EDT\n" "08:00:00 UTC = 04:00:00 EDT" -#: ../../library/datetime.rst:2236 +#: ../../library/datetime.rst:2250 msgid "" "When DST ends (the \"end\" line), there's a potentially worse problem: " "there's an hour that can't be spelled unambiguously in local wall time: the " @@ -3333,7 +3356,7 @@ msgid "" "Fall back transition of 2016, we get::" msgstr "" -#: ../../library/datetime.rst:2247 +#: ../../library/datetime.rst:2261 msgid "" ">>> u0 = datetime(2016, 11, 6, 4, tzinfo=timezone.utc)\n" ">>> for i in range(4):\n" @@ -3357,13 +3380,13 @@ msgstr "" "06:00:00 UTC = 01:00:00 EST 1\n" "07:00:00 UTC = 02:00:00 EST 0" -#: ../../library/datetime.rst:2258 +#: ../../library/datetime.rst:2272 msgid "" "Note that the :class:`.datetime` instances that differ only by the value of " "the :attr:`~.datetime.fold` attribute are considered equal in comparisons." msgstr "" -#: ../../library/datetime.rst:2261 +#: ../../library/datetime.rst:2275 msgid "" "Applications that can't bear wall-time ambiguities should explicitly check " "the value of the :attr:`~.datetime.fold` attribute or avoid using hybrid :" @@ -3373,28 +3396,28 @@ msgid "" "offset -4 hours))." msgstr "" -#: ../../library/datetime.rst:2269 +#: ../../library/datetime.rst:2283 msgid ":mod:`zoneinfo`" msgstr ":mod:`zoneinfo`" -#: ../../library/datetime.rst:2270 +#: ../../library/datetime.rst:2284 msgid "" "The :mod:`!datetime` module has a basic :class:`timezone` class (for " "handling arbitrary fixed offsets from UTC) and its :attr:`timezone.utc` " "attribute (a UTC :class:`!timezone` instance)." msgstr "" -#: ../../library/datetime.rst:2274 +#: ../../library/datetime.rst:2288 msgid "" "``zoneinfo`` brings the *IANA time zone database* (also known as the Olson " "database) to Python, and its usage is recommended." msgstr "" -#: ../../library/datetime.rst:2277 +#: ../../library/datetime.rst:2291 msgid "`IANA time zone database `_" msgstr "`IANA 時區資料庫 `_" -#: ../../library/datetime.rst:2278 +#: ../../library/datetime.rst:2292 msgid "" "The Time Zone Database (often called tz, tzdata or zoneinfo) contains code " "and data that represent the history of local time for many representative " @@ -3403,24 +3426,24 @@ msgid "" "saving rules." msgstr "" -#: ../../library/datetime.rst:2288 +#: ../../library/datetime.rst:2302 msgid ":class:`timezone` Objects" msgstr ":class:`timezone` 物件" -#: ../../library/datetime.rst:2290 +#: ../../library/datetime.rst:2304 msgid "" "The :class:`timezone` class is a subclass of :class:`tzinfo`, each instance " "of which represents a time zone defined by a fixed offset from UTC." msgstr "" -#: ../../library/datetime.rst:2294 +#: ../../library/datetime.rst:2308 msgid "" "Objects of this class cannot be used to represent time zone information in " "the locations where different offsets are used in different days of the year " "or where historical changes have been made to civil time." msgstr "" -#: ../../library/datetime.rst:2301 +#: ../../library/datetime.rst:2315 msgid "" "The *offset* argument must be specified as a :class:`timedelta` object " "representing the difference between the local time and UTC. It must be " @@ -3428,25 +3451,25 @@ msgid "" "otherwise :exc:`ValueError` is raised." msgstr "" -#: ../../library/datetime.rst:2306 +#: ../../library/datetime.rst:2320 msgid "" "The *name* argument is optional. If specified it must be a string that will " "be used as the value returned by the :meth:`datetime.tzname` method." msgstr "" -#: ../../library/datetime.rst:2317 ../../library/datetime.rst:2328 +#: ../../library/datetime.rst:2331 ../../library/datetime.rst:2342 msgid "" "Return the fixed value specified when the :class:`timezone` instance is " "constructed." msgstr "" -#: ../../library/datetime.rst:2320 +#: ../../library/datetime.rst:2334 msgid "" "The *dt* argument is ignored. The return value is a :class:`timedelta` " "instance equal to the difference between the local time and UTC." msgstr "" -#: ../../library/datetime.rst:2331 +#: ../../library/datetime.rst:2345 msgid "" "If *name* is not provided in the constructor, the name returned by " "``tzname(dt)`` is generated from the value of the ``offset`` as follows. If " @@ -3455,119 +3478,119 @@ msgid "" "are two digits of ``offset.hours`` and ``offset.minutes`` respectively." msgstr "" -#: ../../library/datetime.rst:2337 +#: ../../library/datetime.rst:2351 msgid "" "Name generated from ``offset=timedelta(0)`` is now plain ``'UTC'``, not " "``'UTC+00:00'``." msgstr "" -#: ../../library/datetime.rst:2344 +#: ../../library/datetime.rst:2358 msgid "Always returns ``None``." msgstr "總是回傳 ``None``。" -#: ../../library/datetime.rst:2348 +#: ../../library/datetime.rst:2362 msgid "" "Return ``dt + offset``. The *dt* argument must be an aware :class:`." "datetime` instance, with ``tzinfo`` set to ``self``." msgstr "" -#: ../../library/datetime.rst:2355 +#: ../../library/datetime.rst:2369 msgid "The UTC time zone, ``timezone(timedelta(0))``." msgstr "UTC 時區,``timezone(timedelta(0))``。" -#: ../../library/datetime.rst:2364 +#: ../../library/datetime.rst:2378 msgid ":meth:`~.datetime.strftime` and :meth:`~.datetime.strptime` Behavior" msgstr ":meth:`~.datetime.strftime` 與 :meth:`~.datetime.strptime` 的行為" -#: ../../library/datetime.rst:2366 +#: ../../library/datetime.rst:2380 msgid "" ":class:`date`, :class:`.datetime`, and :class:`.time` objects all support a " "``strftime(format)`` method, to create a string representing the time under " "the control of an explicit format string." msgstr "" -#: ../../library/datetime.rst:2370 +#: ../../library/datetime.rst:2384 msgid "" "Conversely, the :meth:`datetime.strptime` class method creates a :class:`." "datetime` object from a string representing a date and time and a " "corresponding format string." msgstr "" -#: ../../library/datetime.rst:2374 +#: ../../library/datetime.rst:2388 msgid "" "The table below provides a high-level comparison of :meth:`~.datetime." "strftime` versus :meth:`~.datetime.strptime`:" msgstr "" -#: ../../library/datetime.rst:2378 +#: ../../library/datetime.rst:2392 msgid "``strftime``" msgstr "``strftime``" -#: ../../library/datetime.rst:2378 +#: ../../library/datetime.rst:2392 msgid "``strptime``" msgstr "``strptime``" -#: ../../library/datetime.rst:2380 +#: ../../library/datetime.rst:2394 msgid "Usage" msgstr "用法" -#: ../../library/datetime.rst:2380 +#: ../../library/datetime.rst:2394 msgid "Convert object to a string according to a given format" msgstr "" -#: ../../library/datetime.rst:2380 +#: ../../library/datetime.rst:2394 msgid "" "Parse a string into a :class:`.datetime` object given a corresponding format" msgstr "" -#: ../../library/datetime.rst:2382 +#: ../../library/datetime.rst:2396 msgid "Type of method" msgstr "" -#: ../../library/datetime.rst:2382 +#: ../../library/datetime.rst:2396 msgid "Instance method" msgstr "實例方法" -#: ../../library/datetime.rst:2382 +#: ../../library/datetime.rst:2396 msgid "Class method" msgstr "類別方法" -#: ../../library/datetime.rst:2384 +#: ../../library/datetime.rst:2398 msgid "Method of" msgstr "" -#: ../../library/datetime.rst:2384 +#: ../../library/datetime.rst:2398 msgid ":class:`date`; :class:`.datetime`; :class:`.time`" msgstr ":class:`date`; :class:`.datetime`; :class:`.time`" -#: ../../library/datetime.rst:2384 +#: ../../library/datetime.rst:2398 msgid ":class:`.datetime`" msgstr ":class:`.datetime`" -#: ../../library/datetime.rst:2386 +#: ../../library/datetime.rst:2400 msgid "Signature" msgstr "" -#: ../../library/datetime.rst:2386 +#: ../../library/datetime.rst:2400 msgid "``strftime(format)``" msgstr "``strftime(format)``" -#: ../../library/datetime.rst:2386 +#: ../../library/datetime.rst:2400 msgid "``strptime(date_string, format)``" msgstr "``strptime(date_string, format)``" -#: ../../library/datetime.rst:2393 +#: ../../library/datetime.rst:2407 msgid "" ":meth:`~.datetime.strftime` and :meth:`~.datetime.strptime` Format Codes" msgstr ":meth:`~.datetime.strftime` 與 :meth:`~.datetime.strptime` 格式碼" -#: ../../library/datetime.rst:2395 +#: ../../library/datetime.rst:2409 msgid "" "These methods accept format codes that can be used to parse and format " "dates::" msgstr "" -#: ../../library/datetime.rst:2397 +#: ../../library/datetime.rst:2411 msgid "" ">>> datetime.strptime('31/01/22 23:59:59.999999',\n" "... '%d/%m/%y %H:%M:%S.%f')\n" @@ -3581,33 +3604,33 @@ msgstr "" ">>> _.strftime('%a %d %b %Y, %I:%M%p')\n" "'Mon 31 Jan 2022, 11:59PM'" -#: ../../library/datetime.rst:2403 +#: ../../library/datetime.rst:2417 msgid "" "The following is a list of all the format codes that the 1989 C standard " "requires, and these work on all platforms with a standard C implementation." msgstr "" -#: ../../library/datetime.rst:2407 ../../library/datetime.rst:2510 +#: ../../library/datetime.rst:2421 ../../library/datetime.rst:2524 msgid "Directive" msgstr "" -#: ../../library/datetime.rst:2407 ../../library/datetime.rst:2510 +#: ../../library/datetime.rst:2421 ../../library/datetime.rst:2524 msgid "Meaning" msgstr "含義" -#: ../../library/datetime.rst:2407 ../../library/datetime.rst:2510 +#: ../../library/datetime.rst:2421 ../../library/datetime.rst:2524 msgid "Example" msgstr "範例" -#: ../../library/datetime.rst:2407 ../../library/datetime.rst:2510 +#: ../../library/datetime.rst:2421 ../../library/datetime.rst:2524 msgid "Notes" msgstr "註解" -#: ../../library/datetime.rst:2409 +#: ../../library/datetime.rst:2423 msgid "``%a``" msgstr "``%a``" -#: ../../library/datetime.rst:2409 +#: ../../library/datetime.rst:2423 msgid "Weekday as locale's abbreviated name." msgstr "" @@ -3619,11 +3642,11 @@ msgstr "" msgid "So, Mo, ..., Sa (de_DE)" msgstr "" -#: ../../library/datetime.rst:2414 +#: ../../library/datetime.rst:2428 msgid "``%A``" msgstr "``%A``" -#: ../../library/datetime.rst:2414 +#: ../../library/datetime.rst:2428 msgid "Weekday as locale's full name." msgstr "" @@ -3635,42 +3658,42 @@ msgstr "" msgid "Sonntag, Montag, ..., Samstag (de_DE)" msgstr "" -#: ../../library/datetime.rst:2419 +#: ../../library/datetime.rst:2433 msgid "``%w``" msgstr "``%w``" -#: ../../library/datetime.rst:2419 +#: ../../library/datetime.rst:2433 msgid "Weekday as a decimal number, where 0 is Sunday and 6 is Saturday." msgstr "" -#: ../../library/datetime.rst:2419 +#: ../../library/datetime.rst:2433 msgid "0, 1, ..., 6" msgstr "0, 1, ..., 6" -#: ../../library/datetime.rst:2423 +#: ../../library/datetime.rst:2437 msgid "``%d``" msgstr "``%d``" -#: ../../library/datetime.rst:2423 +#: ../../library/datetime.rst:2437 msgid "Day of the month as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2423 +#: ../../library/datetime.rst:2437 msgid "01, 02, ..., 31" msgstr "01, 02, ..., 31" -#: ../../library/datetime.rst:2423 ../../library/datetime.rst:2436 -#: ../../library/datetime.rst:2439 ../../library/datetime.rst:2445 -#: ../../library/datetime.rst:2448 ../../library/datetime.rst:2454 -#: ../../library/datetime.rst:2472 +#: ../../library/datetime.rst:2437 ../../library/datetime.rst:2450 +#: ../../library/datetime.rst:2453 ../../library/datetime.rst:2459 +#: ../../library/datetime.rst:2462 ../../library/datetime.rst:2468 +#: ../../library/datetime.rst:2486 msgid "\\(9)" msgstr "\\(9)" -#: ../../library/datetime.rst:2426 +#: ../../library/datetime.rst:2440 msgid "``%b``" msgstr "``%b``" -#: ../../library/datetime.rst:2426 +#: ../../library/datetime.rst:2440 msgid "Month as locale's abbreviated name." msgstr "" @@ -3682,11 +3705,11 @@ msgstr "" msgid "Jan, Feb, ..., Dez (de_DE)" msgstr "" -#: ../../library/datetime.rst:2431 +#: ../../library/datetime.rst:2445 msgid "``%B``" msgstr "``%B``" -#: ../../library/datetime.rst:2431 +#: ../../library/datetime.rst:2445 msgid "Month as locale's full name." msgstr "" @@ -3698,67 +3721,67 @@ msgstr "" msgid "Januar, Februar, ..., Dezember (de_DE)" msgstr "" -#: ../../library/datetime.rst:2436 +#: ../../library/datetime.rst:2450 msgid "``%m``" msgstr "``%m``" -#: ../../library/datetime.rst:2436 +#: ../../library/datetime.rst:2450 msgid "Month as a zero-padded decimal number." msgstr "以零填充的並以十進位數字表示的月份。" -#: ../../library/datetime.rst:2436 ../../library/datetime.rst:2448 +#: ../../library/datetime.rst:2450 ../../library/datetime.rst:2462 msgid "01, 02, ..., 12" msgstr "01, 02, ..., 12" -#: ../../library/datetime.rst:2439 +#: ../../library/datetime.rst:2453 msgid "``%y``" msgstr "``%y``" -#: ../../library/datetime.rst:2439 +#: ../../library/datetime.rst:2453 msgid "Year without century as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2439 +#: ../../library/datetime.rst:2453 msgid "00, 01, ..., 99" msgstr "00, 01, ..., 99" -#: ../../library/datetime.rst:2442 +#: ../../library/datetime.rst:2456 msgid "``%Y``" msgstr "``%Y``" -#: ../../library/datetime.rst:2442 +#: ../../library/datetime.rst:2456 msgid "Year with century as a decimal number." msgstr "" -#: ../../library/datetime.rst:2442 ../../library/datetime.rst:2512 +#: ../../library/datetime.rst:2456 ../../library/datetime.rst:2526 msgid "0001, 0002, ..., 2013, 2014, ..., 9998, 9999" msgstr "0001, 0002, ..., 2013, 2014, ..., 9998, 9999" -#: ../../library/datetime.rst:2445 +#: ../../library/datetime.rst:2459 msgid "``%H``" msgstr "``%H``" -#: ../../library/datetime.rst:2445 +#: ../../library/datetime.rst:2459 msgid "Hour (24-hour clock) as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2445 +#: ../../library/datetime.rst:2459 msgid "00, 01, ..., 23" msgstr "00, 01, ..., 23" -#: ../../library/datetime.rst:2448 +#: ../../library/datetime.rst:2462 msgid "``%I``" msgstr "``%I``" -#: ../../library/datetime.rst:2448 +#: ../../library/datetime.rst:2462 msgid "Hour (12-hour clock) as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2451 +#: ../../library/datetime.rst:2465 msgid "``%p``" msgstr "``%p``" -#: ../../library/datetime.rst:2451 +#: ../../library/datetime.rst:2465 msgid "Locale's equivalent of either AM or PM." msgstr "" @@ -3770,128 +3793,128 @@ msgstr "AM, PM (en_US);" msgid "am, pm (de_DE)" msgstr "am, pm (de_DE)" -#: ../../library/datetime.rst:2451 +#: ../../library/datetime.rst:2465 msgid "\\(1), \\(3)" msgstr "\\(1), \\(3)" -#: ../../library/datetime.rst:2454 +#: ../../library/datetime.rst:2468 msgid "``%M``" msgstr "``%M``" -#: ../../library/datetime.rst:2454 +#: ../../library/datetime.rst:2468 msgid "Minute as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2454 ../../library/datetime.rst:2457 +#: ../../library/datetime.rst:2468 ../../library/datetime.rst:2471 msgid "00, 01, ..., 59" msgstr "00, 01, ..., 59" -#: ../../library/datetime.rst:2457 +#: ../../library/datetime.rst:2471 msgid "``%S``" msgstr "``%S``" -#: ../../library/datetime.rst:2457 +#: ../../library/datetime.rst:2471 msgid "Second as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2457 +#: ../../library/datetime.rst:2471 msgid "\\(4), \\(9)" msgstr "\\(4), \\(9)" -#: ../../library/datetime.rst:2460 +#: ../../library/datetime.rst:2474 msgid "``%f``" msgstr "``%f``" -#: ../../library/datetime.rst:2460 +#: ../../library/datetime.rst:2474 msgid "Microsecond as a decimal number, zero-padded to 6 digits." msgstr "" -#: ../../library/datetime.rst:2460 +#: ../../library/datetime.rst:2474 msgid "000000, 000001, ..., 999999" msgstr "000000, 000001, ..., 999999" -#: ../../library/datetime.rst:2460 +#: ../../library/datetime.rst:2474 msgid "\\(5)" msgstr "\\(5)" -#: ../../library/datetime.rst:2464 ../../library/datetime.rst:2623 +#: ../../library/datetime.rst:2478 ../../library/datetime.rst:2637 msgid "``%z``" msgstr "``%z``" -#: ../../library/datetime.rst:2464 +#: ../../library/datetime.rst:2478 msgid "" "UTC offset in the form ``±HHMM[SS[.ffffff]]`` (empty string if the object is " "naive)." msgstr "" -#: ../../library/datetime.rst:2464 +#: ../../library/datetime.rst:2478 msgid "(empty), +0000, -0400, +1030, +063415, -030712.345216" msgstr "" -#: ../../library/datetime.rst:2464 ../../library/datetime.rst:2469 -#: ../../library/datetime.rst:2526 +#: ../../library/datetime.rst:2478 ../../library/datetime.rst:2483 +#: ../../library/datetime.rst:2540 msgid "\\(6)" msgstr "\\(6)" -#: ../../library/datetime.rst:2469 ../../library/datetime.rst:2649 +#: ../../library/datetime.rst:2483 ../../library/datetime.rst:2663 msgid "``%Z``" msgstr "``%Z``" -#: ../../library/datetime.rst:2469 +#: ../../library/datetime.rst:2483 msgid "Time zone name (empty string if the object is naive)." msgstr "" -#: ../../library/datetime.rst:2469 +#: ../../library/datetime.rst:2483 msgid "(empty), UTC, GMT" msgstr "" -#: ../../library/datetime.rst:2472 +#: ../../library/datetime.rst:2486 msgid "``%j``" msgstr "``%j``" -#: ../../library/datetime.rst:2472 +#: ../../library/datetime.rst:2486 msgid "Day of the year as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2472 +#: ../../library/datetime.rst:2486 msgid "001, 002, ..., 366" msgstr "001, 002, ..., 366" -#: ../../library/datetime.rst:2475 +#: ../../library/datetime.rst:2489 msgid "``%U``" msgstr "``%U``" -#: ../../library/datetime.rst:2475 +#: ../../library/datetime.rst:2489 msgid "" "Week number of the year (Sunday as the first day of the week) as a zero-" "padded decimal number. All days in a new year preceding the first Sunday are " "considered to be in week 0." msgstr "" -#: ../../library/datetime.rst:2475 ../../library/datetime.rst:2483 +#: ../../library/datetime.rst:2489 ../../library/datetime.rst:2497 msgid "00, 01, ..., 53" msgstr "00, 01, ..., 53" -#: ../../library/datetime.rst:2475 ../../library/datetime.rst:2483 +#: ../../library/datetime.rst:2489 ../../library/datetime.rst:2497 msgid "\\(7), \\(9)" msgstr "\\(7), \\(9)" -#: ../../library/datetime.rst:2483 +#: ../../library/datetime.rst:2497 msgid "``%W``" msgstr "``%W``" -#: ../../library/datetime.rst:2483 +#: ../../library/datetime.rst:2497 msgid "" "Week number of the year (Monday as the first day of the week) as a zero-" "padded decimal number. All days in a new year preceding the first Monday are " "considered to be in week 0." msgstr "" -#: ../../library/datetime.rst:2491 +#: ../../library/datetime.rst:2505 msgid "``%c``" msgstr "``%c``" -#: ../../library/datetime.rst:2491 +#: ../../library/datetime.rst:2505 msgid "Locale's appropriate date and time representation." msgstr "" @@ -3903,11 +3926,11 @@ msgstr "" msgid "Di 16 Aug 21:30:00 1988 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2496 +#: ../../library/datetime.rst:2510 msgid "``%x``" msgstr "``%x``" -#: ../../library/datetime.rst:2496 +#: ../../library/datetime.rst:2510 msgid "Locale's appropriate date representation." msgstr "" @@ -3923,11 +3946,11 @@ msgstr "" msgid "16.08.1988 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2500 +#: ../../library/datetime.rst:2514 msgid "``%X``" msgstr "``%X``" -#: ../../library/datetime.rst:2500 +#: ../../library/datetime.rst:2514 msgid "Locale's appropriate time representation." msgstr "" @@ -3939,83 +3962,83 @@ msgstr "" msgid "21:30:00 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2503 +#: ../../library/datetime.rst:2517 msgid "``%%``" msgstr "``%%``" -#: ../../library/datetime.rst:2503 +#: ../../library/datetime.rst:2517 msgid "A literal ``'%'`` character." msgstr "" -#: ../../library/datetime.rst:2503 +#: ../../library/datetime.rst:2517 msgid "%" msgstr "%" -#: ../../library/datetime.rst:2506 +#: ../../library/datetime.rst:2520 msgid "" "Several additional directives not required by the C89 standard are included " "for convenience. These parameters all correspond to ISO 8601 date values." msgstr "" -#: ../../library/datetime.rst:2512 +#: ../../library/datetime.rst:2526 msgid "``%G``" msgstr "``%G``" -#: ../../library/datetime.rst:2512 +#: ../../library/datetime.rst:2526 msgid "" "ISO 8601 year with century representing the year that contains the greater " "part of the ISO week (``%V``)." msgstr "" -#: ../../library/datetime.rst:2512 +#: ../../library/datetime.rst:2526 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2531 msgid "``%u``" msgstr "``%u``" -#: ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2531 msgid "ISO 8601 weekday as a decimal number where 1 is Monday." msgstr "" -#: ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2531 msgid "1, 2, ..., 7" msgstr "1, 2, ..., 7" -#: ../../library/datetime.rst:2520 +#: ../../library/datetime.rst:2534 msgid "``%V``" msgstr "``%V``" -#: ../../library/datetime.rst:2520 +#: ../../library/datetime.rst:2534 msgid "" "ISO 8601 week as a decimal number with Monday as the first day of the week. " "Week 01 is the week containing Jan 4." msgstr "" -#: ../../library/datetime.rst:2520 +#: ../../library/datetime.rst:2534 msgid "01, 02, ..., 53" msgstr "01, 02, ..., 53" -#: ../../library/datetime.rst:2520 +#: ../../library/datetime.rst:2534 msgid "\\(8), \\(9)" msgstr "\\(8), \\(9)" -#: ../../library/datetime.rst:2526 ../../library/datetime.rst:2645 +#: ../../library/datetime.rst:2540 ../../library/datetime.rst:2659 msgid "``%:z``" msgstr "``%:z``" -#: ../../library/datetime.rst:2526 +#: ../../library/datetime.rst:2540 msgid "" "UTC offset in the form ``±HH:MM[:SS[.ffffff]]`` (empty string if the object " "is naive)." msgstr "" -#: ../../library/datetime.rst:2526 +#: ../../library/datetime.rst:2540 msgid "(empty), +00:00, -04:00, +10:30, +06:34:15, -03:07:12.345216" msgstr "" -#: ../../library/datetime.rst:2532 +#: ../../library/datetime.rst:2546 msgid "" "These may not be available on all platforms when used with the :meth:`~." "datetime.strftime` method. The ISO 8601 year and ISO 8601 week directives " @@ -4024,7 +4047,7 @@ msgid "" "directives will raise a :exc:`ValueError`." msgstr "" -#: ../../library/datetime.rst:2537 +#: ../../library/datetime.rst:2551 msgid "" "The full set of format codes supported varies across platforms, because " "Python calls the platform C library's :c:func:`strftime` function, and " @@ -4034,44 +4057,44 @@ msgid "" "unsupported format specifiers." msgstr "" -#: ../../library/datetime.rst:2543 +#: ../../library/datetime.rst:2557 msgid "``%G``, ``%u`` and ``%V`` were added." msgstr "新增 ``%G``、``%u`` 與 ``%V``。" -#: ../../library/datetime.rst:2546 +#: ../../library/datetime.rst:2560 msgid "``%:z`` was added." msgstr "新增 ``%:z``。" -#: ../../library/datetime.rst:2550 +#: ../../library/datetime.rst:2564 msgid "Technical Detail" msgstr "技術細節" -#: ../../library/datetime.rst:2552 +#: ../../library/datetime.rst:2566 msgid "" "Broadly speaking, ``d.strftime(fmt)`` acts like the :mod:`time` module's " "``time.strftime(fmt, d.timetuple())`` although not all objects support a :" "meth:`~date.timetuple` method." msgstr "" -#: ../../library/datetime.rst:2556 +#: ../../library/datetime.rst:2570 msgid "" "For the :meth:`.datetime.strptime` class method, the default value is " "``1900-01-01T00:00:00.000``: any components not specified in the format " "string will be pulled from the default value. [#]_" msgstr "" -#: ../../library/datetime.rst:2560 +#: ../../library/datetime.rst:2574 msgid "Using ``datetime.strptime(date_string, format)`` is equivalent to::" msgstr "" -#: ../../library/datetime.rst:2564 +#: ../../library/datetime.rst:2578 msgid "" "except when the format includes sub-second components or time zone offset " "information, which are supported in ``datetime.strptime`` but are discarded " "by ``time.strptime``." msgstr "" -#: ../../library/datetime.rst:2568 +#: ../../library/datetime.rst:2582 msgid "" "For :class:`.time` objects, the format codes for year, month, and day should " "not be used, as :class:`!time` objects have no such values. If they're used " @@ -4081,7 +4104,7 @@ msgstr "" "time` 物件並沒有這些值。如果使用這些格式碼,年份會以 1900 代替、月及日會以 1 " "代替。" -#: ../../library/datetime.rst:2572 +#: ../../library/datetime.rst:2586 msgid "" "For :class:`date` objects, the format codes for hours, minutes, seconds, and " "microseconds should not be used, as :class:`date` objects have no such " @@ -4090,7 +4113,7 @@ msgstr "" "對 :class:`.date` 物件來說,不應該使用時、分、秒、微秒的格式碼,因為 :class:" "`date` 物件並沒有這些值。如果使用這些格式碼,這些值都會以 0 代替。" -#: ../../library/datetime.rst:2576 +#: ../../library/datetime.rst:2590 msgid "" "For the same reason, handling of format strings containing Unicode code " "points that can't be represented in the charset of the current locale is " @@ -4099,7 +4122,7 @@ msgid "" "`UnicodeError` or return an empty string instead." msgstr "" -#: ../../library/datetime.rst:2585 +#: ../../library/datetime.rst:2599 msgid "" "Because the format depends on the current locale, care should be taken when " "making assumptions about the output value. Field orderings will vary (for " @@ -4107,38 +4130,38 @@ msgid "" "contain non-ASCII characters." msgstr "" -#: ../../library/datetime.rst:2591 +#: ../../library/datetime.rst:2605 msgid "" "The :meth:`~.datetime.strptime` method can parse years in the full [1, 9999] " "range, but years < 1000 must be zero-filled to 4-digit width." msgstr "" -#: ../../library/datetime.rst:2594 +#: ../../library/datetime.rst:2608 msgid "" "In previous versions, :meth:`~.datetime.strftime` method was restricted to " "years >= 1900." msgstr "" -#: ../../library/datetime.rst:2598 +#: ../../library/datetime.rst:2612 msgid "" "In version 3.2, :meth:`~.datetime.strftime` method was restricted to years " ">= 1000." msgstr "" -#: ../../library/datetime.rst:2603 +#: ../../library/datetime.rst:2617 msgid "" "When used with the :meth:`~.datetime.strptime` method, the ``%p`` directive " "only affects the output hour field if the ``%I`` directive is used to parse " "the hour." msgstr "" -#: ../../library/datetime.rst:2607 +#: ../../library/datetime.rst:2621 msgid "" "Unlike the :mod:`time` module, the :mod:`!datetime` module does not support " "leap seconds." msgstr "" -#: ../../library/datetime.rst:2611 +#: ../../library/datetime.rst:2625 msgid "" "When used with the :meth:`~.datetime.strptime` method, the ``%f`` directive " "accepts from one to six digits and zero pads on the right. ``%f`` is an " @@ -4146,17 +4169,17 @@ msgid "" "separately in datetime objects, and therefore always available)." msgstr "" -#: ../../library/datetime.rst:2618 +#: ../../library/datetime.rst:2632 msgid "" "For a naive object, the ``%z``, ``%:z`` and ``%Z`` format codes are replaced " "by empty strings." msgstr "" -#: ../../library/datetime.rst:2621 +#: ../../library/datetime.rst:2635 msgid "For an aware object:" msgstr "" -#: ../../library/datetime.rst:2624 +#: ../../library/datetime.rst:2638 msgid "" ":meth:`~.datetime.utcoffset` is transformed into a string of the form " "``±HHMM[SS[.ffffff]]``, where ``HH`` is a 2-digit string giving the number " @@ -4170,7 +4193,7 @@ msgid "" "replaced with the string ``'-0330'``." msgstr "" -#: ../../library/datetime.rst:2638 +#: ../../library/datetime.rst:2652 msgid "" "When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` " "method, the UTC offsets can have a colon as a separator between hours, " @@ -4179,53 +4202,53 @@ msgid "" "``'+00:00'``." msgstr "" -#: ../../library/datetime.rst:2646 +#: ../../library/datetime.rst:2660 msgid "" "Behaves exactly as ``%z``, but has a colon separator added between hours, " "minutes and seconds." msgstr "" -#: ../../library/datetime.rst:2650 +#: ../../library/datetime.rst:2664 msgid "" "In :meth:`~.datetime.strftime`, ``%Z`` is replaced by an empty string if :" "meth:`~.datetime.tzname` returns ``None``; otherwise ``%Z`` is replaced by " "the returned value, which must be a string." msgstr "" -#: ../../library/datetime.rst:2654 +#: ../../library/datetime.rst:2668 msgid ":meth:`~.datetime.strptime` only accepts certain values for ``%Z``:" msgstr "" -#: ../../library/datetime.rst:2656 +#: ../../library/datetime.rst:2670 msgid "any value in ``time.tzname`` for your machine's locale" msgstr "" -#: ../../library/datetime.rst:2657 +#: ../../library/datetime.rst:2671 msgid "the hard-coded values ``UTC`` and ``GMT``" msgstr "" -#: ../../library/datetime.rst:2659 +#: ../../library/datetime.rst:2673 msgid "" "So someone living in Japan may have ``JST``, ``UTC``, and ``GMT`` as valid " "values, but probably not ``EST``. It will raise ``ValueError`` for invalid " "values." msgstr "" -#: ../../library/datetime.rst:2663 +#: ../../library/datetime.rst:2677 msgid "" "When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` " "method, an aware :class:`.datetime` object will be produced. The ``tzinfo`` " "of the result will be set to a :class:`timezone` instance." msgstr "" -#: ../../library/datetime.rst:2669 +#: ../../library/datetime.rst:2683 msgid "" "When used with the :meth:`~.datetime.strptime` method, ``%U`` and ``%W`` are " "only used in calculations when the day of the week and the calendar year " "(``%Y``) are specified." msgstr "" -#: ../../library/datetime.rst:2674 +#: ../../library/datetime.rst:2688 msgid "" "Similar to ``%U`` and ``%W``, ``%V`` is only used in calculations when the " "day of the week and the ISO year (``%G``) are specified in a :meth:`~." @@ -4233,7 +4256,7 @@ msgid "" "interchangeable." msgstr "" -#: ../../library/datetime.rst:2680 +#: ../../library/datetime.rst:2694 msgid "" "When used with the :meth:`~.datetime.strptime` method, the leading zero is " "optional for formats ``%d``, ``%m``, ``%H``, ``%I``, ``%M``, ``%S``, " @@ -4241,7 +4264,7 @@ msgid "" "zero." msgstr "" -#: ../../library/datetime.rst:2685 +#: ../../library/datetime.rst:2699 msgid "" "When parsing a month and day using :meth:`~.datetime.strptime`, always " "include a year in the format. If the value you need to parse lacks a year, " @@ -4250,7 +4273,7 @@ msgid "" "parser is not a leap year. Users run into this bug every four years..." msgstr "" -#: ../../library/datetime.rst:2691 +#: ../../library/datetime.rst:2705 msgid "" ">>> month_day = \"02/29\"\n" ">>> datetime.strptime(f\"{month_day};1984\", \"%m/%d;%Y\") # No leap year " @@ -4258,7 +4281,7 @@ msgid "" "datetime.datetime(1984, 2, 29, 0, 0)" msgstr "" -#: ../../library/datetime.rst:2697 +#: ../../library/datetime.rst:2711 msgid "" ":meth:`~.datetime.strptime` calls using a format string containing a day of " "month without a year now emit a :exc:`DeprecationWarning`. In 3.15 or later " @@ -4266,15 +4289,15 @@ msgid "" "See :gh:`70647`." msgstr "" -#: ../../library/datetime.rst:2704 +#: ../../library/datetime.rst:2718 msgid "Footnotes" msgstr "註解" -#: ../../library/datetime.rst:2705 +#: ../../library/datetime.rst:2719 msgid "If, that is, we ignore the effects of Relativity" msgstr "也就是說,我們會忽略相對論的效應" -#: ../../library/datetime.rst:2707 +#: ../../library/datetime.rst:2721 msgid "" "This matches the definition of the \"proleptic Gregorian\" calendar in " "Dershowitz and Reingold's book *Calendrical Calculations*, where it's the " @@ -4283,23 +4306,23 @@ msgid "" "systems." msgstr "" -#: ../../library/datetime.rst:2713 +#: ../../library/datetime.rst:2727 msgid "" "See R. H. van Gent's `guide to the mathematics of the ISO 8601 calendar " "`_ for a good explanation." msgstr "" -#: ../../library/datetime.rst:2717 +#: ../../library/datetime.rst:2731 msgid "" "Passing ``datetime.strptime('Feb 29', '%b %d')`` will fail since 1900 is not " "a leap year." msgstr "" -#: ../../library/datetime.rst:2358 +#: ../../library/datetime.rst:2372 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/datetime.rst:2358 +#: ../../library/datetime.rst:2372 msgid "datetime format" msgstr "datetime format(日期時間格式)" diff --git a/library/email.contentmanager.po b/library/email.contentmanager.po index 2c155e66b3..a03eead9b1 100644 --- a/library/email.contentmanager.po +++ b/library/email.contentmanager.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -98,46 +98,46 @@ msgid "" msgstr "" #: ../../library/email.contentmanager.rst:61 -msgid "the type's qualname (``typ.__qualname__``)" +msgid "the type's :attr:`qualname ` (``typ.__qualname__``)" msgstr "" #: ../../library/email.contentmanager.rst:62 -msgid "the type's name (``typ.__name__``)." +msgid "the type's :attr:`name ` (``typ.__name__``)." msgstr "" #: ../../library/email.contentmanager.rst:64 msgid "" "If none of the above match, repeat all of the checks above for each of the " -"types in the :term:`MRO` (``typ.__mro__``). Finally, if no other key yields " -"a handler, check for a handler for the key ``None``. If there is no handler " -"for ``None``, raise a :exc:`KeyError` for the fully qualified name of the " -"type." +"types in the :term:`MRO` (:attr:`typ.__mro__ `). Finally, if " +"no other key yields a handler, check for a handler for the key ``None``. If " +"there is no handler for ``None``, raise a :exc:`KeyError` for the fully " +"qualified name of the type." msgstr "" -#: ../../library/email.contentmanager.rst:70 +#: ../../library/email.contentmanager.rst:71 msgid "" "Also add a :mailheader:`MIME-Version` header if one is not present (see " "also :class:`.MIMEPart`)." msgstr "" -#: ../../library/email.contentmanager.rst:76 +#: ../../library/email.contentmanager.rst:77 msgid "" "Record the function *handler* as the handler for *key*. For the possible " "values of *key*, see :meth:`get_content`." msgstr "" -#: ../../library/email.contentmanager.rst:82 +#: ../../library/email.contentmanager.rst:83 msgid "" "Record *handler* as the function to call when an object of a type matching " "*typekey* is passed to :meth:`set_content`. For the possible values of " "*typekey*, see :meth:`set_content`." msgstr "" -#: ../../library/email.contentmanager.rst:88 +#: ../../library/email.contentmanager.rst:89 msgid "Content Manager Instances" msgstr "" -#: ../../library/email.contentmanager.rst:90 +#: ../../library/email.contentmanager.rst:91 msgid "" "Currently the email package provides only one concrete content manager, :" "data:`raw_data_manager`, although more may be added in the future. :data:" @@ -145,7 +145,7 @@ msgid "" "provided by :attr:`~email.policy.EmailPolicy` and its derivatives." msgstr "" -#: ../../library/email.contentmanager.rst:99 +#: ../../library/email.contentmanager.rst:100 msgid "" "This content manager provides only a minimum interface beyond that provided " "by :class:`~email.message.Message` itself: it deals only with text, raw " @@ -158,7 +158,7 @@ msgid "" "simplifying the creation of multipart messages." msgstr "" -#: ../../library/email.contentmanager.rst:111 +#: ../../library/email.contentmanager.rst:112 msgid "" "Return the payload of the part as either a string (for ``text`` parts), an :" "class:`~email.message.EmailMessage` object (for ``message/rfc822`` parts), " @@ -168,28 +168,28 @@ msgid "" "to unicode. The default error handler is ``replace``." msgstr "" -#: ../../library/email.contentmanager.rst:130 +#: ../../library/email.contentmanager.rst:131 msgid "Add headers and payload to *msg*:" msgstr "" -#: ../../library/email.contentmanager.rst:132 +#: ../../library/email.contentmanager.rst:133 msgid "" "Add a :mailheader:`Content-Type` header with a ``maintype/subtype`` value." msgstr "" -#: ../../library/email.contentmanager.rst:135 +#: ../../library/email.contentmanager.rst:136 msgid "" "For ``str``, set the MIME ``maintype`` to ``text``, and set the subtype to " "*subtype* if it is specified, or ``plain`` if it is not." msgstr "" -#: ../../library/email.contentmanager.rst:137 +#: ../../library/email.contentmanager.rst:138 msgid "" "For ``bytes``, use the specified *maintype* and *subtype*, or raise a :exc:" "`TypeError` if they are not specified." msgstr "" -#: ../../library/email.contentmanager.rst:139 +#: ../../library/email.contentmanager.rst:140 msgid "" "For :class:`~email.message.EmailMessage` objects, set the maintype to " "``message``, and set the subtype to *subtype* if it is specified or " @@ -197,7 +197,7 @@ msgid "" "(``bytes`` objects must be used to construct ``message/partial`` parts)." msgstr "" -#: ../../library/email.contentmanager.rst:145 +#: ../../library/email.contentmanager.rst:146 msgid "" "If *charset* is provided (which is valid only for ``str``), encode the " "string to bytes using the specified character set. The default is " @@ -205,7 +205,7 @@ msgid "" "charset name, use the standard charset instead." msgstr "" -#: ../../library/email.contentmanager.rst:150 +#: ../../library/email.contentmanager.rst:151 msgid "" "If *cte* is set, encode the payload using the specified content transfer " "encoding, and set the :mailheader:`Content-Transfer-Encoding` header to that " @@ -215,13 +215,13 @@ msgid "" "that contains non-ASCII values), raise a :exc:`ValueError`." msgstr "" -#: ../../library/email.contentmanager.rst:158 +#: ../../library/email.contentmanager.rst:159 msgid "" "For ``str`` objects, if *cte* is not set use heuristics to determine the " "most compact encoding." msgstr "" -#: ../../library/email.contentmanager.rst:160 +#: ../../library/email.contentmanager.rst:161 msgid "" "For :class:`~email.message.EmailMessage`, per :rfc:`2046`, raise an error if " "a *cte* of ``quoted-printable`` or ``base64`` is requested for *subtype* " @@ -230,14 +230,14 @@ msgid "" "For all other values of *subtype*, use ``7bit``." msgstr "" -#: ../../library/email.contentmanager.rst:167 +#: ../../library/email.contentmanager.rst:168 msgid "" "A *cte* of ``binary`` does not actually work correctly yet. The " "``EmailMessage`` object as modified by ``set_content`` is correct, but :" "class:`~email.generator.BytesGenerator` does not serialize it correctly." msgstr "" -#: ../../library/email.contentmanager.rst:172 +#: ../../library/email.contentmanager.rst:173 msgid "" "If *disposition* is set, use it as the value of the :mailheader:`Content-" "Disposition` header. If not specified, and *filename* is specified, add the " @@ -246,37 +246,37 @@ msgid "" "values for *disposition* are ``attachment`` and ``inline``." msgstr "" -#: ../../library/email.contentmanager.rst:179 +#: ../../library/email.contentmanager.rst:180 msgid "" "If *filename* is specified, use it as the value of the ``filename`` " "parameter of the :mailheader:`Content-Disposition` header." msgstr "" -#: ../../library/email.contentmanager.rst:182 +#: ../../library/email.contentmanager.rst:183 msgid "" "If *cid* is specified, add a :mailheader:`Content-ID` header with *cid* as " "its value." msgstr "" -#: ../../library/email.contentmanager.rst:185 +#: ../../library/email.contentmanager.rst:186 msgid "" "If *params* is specified, iterate its ``items`` method and use the resulting " "``(key, value)`` pairs to set additional parameters on the :mailheader:" "`Content-Type` header." msgstr "" -#: ../../library/email.contentmanager.rst:189 +#: ../../library/email.contentmanager.rst:190 msgid "" "If *headers* is specified and is a list of strings of the form ``headername: " "headervalue`` or a list of ``header`` objects (distinguished from strings by " "having a ``name`` attribute), add the headers to *msg*." msgstr "" -#: ../../library/email.contentmanager.rst:196 +#: ../../library/email.contentmanager.rst:197 msgid "Footnotes" msgstr "註解" -#: ../../library/email.contentmanager.rst:197 +#: ../../library/email.contentmanager.rst:198 msgid "" "Originally added in 3.4 as a :term:`provisional module `" msgstr "" diff --git a/library/email.headerregistry.po b/library/email.headerregistry.po index a55e5e9a83..7d6b290f43 100644 --- a/library/email.headerregistry.po +++ b/library/email.headerregistry.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -390,7 +390,7 @@ msgid "" "class. When *use_default_map* is ``True`` (the default), the standard " "mapping of header names to classes is copied in to the registry during " "initialization. *base_class* is always the last class in the generated " -"class's ``__bases__`` list." +"class's :class:`~type.__bases__` list." msgstr "" #: ../../library/email.headerregistry.rst:322 diff --git a/library/functions.po b/library/functions.po index 1ac9b3f1e4..0703f10a5b 100644 --- a/library/functions.po +++ b/library/functions.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-05-06 17:06+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -514,13 +514,12 @@ msgid "" "ways." msgstr "如果不一定需要 \"0b\" 前綴,還可以使用如下的方法。" -#: ../../library/functions.rst:141 ../../library/functions.rst:929 -#: ../../library/functions.rst:1308 +#: ../../library/functions.rst:141 ../../library/functions.rst:931 +#: ../../library/functions.rst:1311 msgid "See also :func:`format` for more information." msgstr "可參考 :func:`format` 獲取更多資訊。" #: ../../library/functions.rst:146 -#, fuzzy msgid "" "Return a Boolean value, i.e. one of ``True`` or ``False``. The argument is " "converted using the standard :ref:`truth testing procedure `. If the " @@ -529,13 +528,13 @@ msgid "" "`typesnumeric`). It cannot be subclassed further. Its only instances are " "``False`` and ``True`` (see :ref:`typebool`)." msgstr "" -"回傳一個布林值,即 ``True`` 或者 ``False``。*x* 使用標準的\\ :ref:`真值測試程" -"序 `\\ 來轉換。如果 *x* 為假或者被省略,則回傳 ``False``;其他情況回" +"回傳一個布林值,即 ``True`` 或者 ``False``。引數會使用標準的\\ :ref:`真值測試" +"程序 `\\ 來轉換。如果引數為假或者被省略,則回傳 ``False``;其他情況回" "傳 ``True``。:class:`bool` class(類別)是 :class:`int` 的 subclass(子類別)" "(參見 :ref:`typesnumeric`),其他 class 不能繼承自它。它只有 ``False`` 和 " "``True`` 兩個實例(參見 :ref:`typebool`)。" -#: ../../library/functions.rst:156 ../../library/functions.rst:794 +#: ../../library/functions.rst:156 ../../library/functions.rst:796 msgid "The parameter is now positional-only." msgstr "現在為僅限位置參數。" @@ -764,15 +763,17 @@ msgstr "" #: ../../library/functions.rst:285 msgid "" -"Class methods now inherit the method attributes (``__module__``, " -"``__name__``, ``__qualname__``, ``__doc__`` and ``__annotations__``) and " -"have a new ``__wrapped__`` attribute." +"Class methods now inherit the method attributes (:attr:`~function." +"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" +"attr:`~function.__doc__` and :attr:`~function.__annotations__`) and have a " +"new ``__wrapped__`` attribute." msgstr "" -"Class method 現在繼承了 method 屬性(``__module__``、``__name__``、" -"``__qualname__``、``__doc__`` 和 ``__annotations__``),並擁有一個新的 " +"Class method 現在繼承了 method 屬性(:attr:`~function.__module__`、:attr:" +"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." +"__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " "``__wrapped__`` 屬性。" -#: ../../library/functions.rst:290 +#: ../../library/functions.rst:292 msgid "" "Class methods can no longer wrap other :term:`descriptors ` such " "as :func:`property`." @@ -780,7 +781,7 @@ msgstr "" "Class methods 不能再包裝其他的\\ :term:`描述器 `,例如 :func:" "`property`。" -#: ../../library/functions.rst:297 +#: ../../library/functions.rst:299 msgid "" "Compile the *source* into a code or AST object. Code objects can be " "executed by :func:`exec` or :func:`eval`. *source* can either be a normal " @@ -791,7 +792,7 @@ msgstr "" "`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。參見 :mod:" "`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" -#: ../../library/functions.rst:302 +#: ../../library/functions.rst:304 msgid "" "The *filename* argument should give the file from which the code was read; " "pass some recognizable value if it wasn't read from a file (``''`` " @@ -800,7 +801,7 @@ msgstr "" "*filename* 引數必須是程式碼的檔名;如果程式碼不是從檔案中讀取,可以傳入一些可" "辨識的值(經常會使用 ``''`` 來替代)。" -#: ../../library/functions.rst:306 +#: ../../library/functions.rst:308 msgid "" "The *mode* argument specifies what kind of code must be compiled; it can be " "``'exec'`` if *source* consists of a sequence of statements, ``'eval'`` if " @@ -813,7 +814,7 @@ msgstr "" "式,可以是 ``'single'``\\ (在最後一種情況下,如果運算式執行結果不是 " "``None`` 則會被印出來)。" -#: ../../library/functions.rst:312 +#: ../../library/functions.rst:314 msgid "" "The optional arguments *flags* and *dont_inherit* control which :ref:" "`compiler options ` should be activated and which :ref:" @@ -833,7 +834,7 @@ msgstr "" "引數所指定的編譯器選項和未來陳述式。如果 *dont_inherit* 是一個非零整數,則使" "用 *flags* 引數 -- 周圍程式碼中的旗標(未來功能和編譯器選項)將被忽略。" -#: ../../library/functions.rst:323 +#: ../../library/functions.rst:325 msgid "" "Compiler options and future statements are specified by bits which can be " "bitwise ORed together to specify multiple options. The bitfield required to " @@ -848,7 +849,7 @@ msgstr "" "compiler_flag` 屬性來獲得。:ref:`編譯器旗標 `\\ 可以在 :" "mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名稱。" -#: ../../library/functions.rst:331 +#: ../../library/functions.rst:333 msgid "" "The argument *optimize* specifies the optimization level of the compiler; " "the default value of ``-1`` selects the optimization level of the " @@ -861,7 +862,7 @@ msgstr "" "``__debug__`` 為真值)、``1``\\ (assert 被刪除,``__debug__`` 為假值)或 " "``2``\\ (說明字串 (docstring) 也被刪除)。" -#: ../../library/functions.rst:337 +#: ../../library/functions.rst:339 msgid "" "This function raises :exc:`SyntaxError` if the compiled source is invalid, " "and :exc:`ValueError` if the source contains null bytes." @@ -869,13 +870,13 @@ msgstr "" "如果編譯的原始碼無效,此函式會引發 :exc:`SyntaxError`,如果原始碼包含 null " "bytes,則會引發 :exc:`ValueError`。" -#: ../../library/functions.rst:340 +#: ../../library/functions.rst:342 msgid "" "If you want to parse Python code into its AST representation, see :func:`ast." "parse`." msgstr "如果你想解析 Python 程式碼為 AST 運算式,請參閱 :func:`ast.parse`。" -#: ../../library/functions.rst:343 ../../library/functions.rst:345 +#: ../../library/functions.rst:345 ../../library/functions.rst:347 msgid "" "Raises an :ref:`auditing event ` ``compile`` with arguments " "``source`` and ``filename``. This event may also be raised by implicit " @@ -884,7 +885,7 @@ msgstr "" "引發一個附帶引數 ``source``、``filename`` 的\\ :ref:`稽核事件 ` " "``compile``。此事件也可能由隱式編譯 (implicit compilation) 所引發。" -#: ../../library/functions.rst:351 +#: ../../library/functions.rst:353 msgid "" "When compiling a string with multi-line code in ``'single'`` or ``'eval'`` " "mode, input must be terminated by at least one newline character. This is " @@ -894,7 +895,7 @@ msgstr "" "在 ``'single'`` 或 ``'eval'`` 模式編譯多行程式碼時,輸入必須以至少一個換行符" "結尾。這使 :mod:`code` module 更容易檢測陳述式的完整性。" -#: ../../library/functions.rst:358 +#: ../../library/functions.rst:360 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string when compiling to an AST object due to stack depth " @@ -903,7 +904,7 @@ msgstr "" "如果編譯足夠大或者足夠複雜的字串成 AST 物件時,Python 直譯器會因為 Python " "AST 編譯器的 stack 深度限制而崩潰。" -#: ../../library/functions.rst:362 +#: ../../library/functions.rst:364 msgid "" "Allowed use of Windows and Mac newlines. Also, input in ``'exec'`` mode " "does not have to end in a newline anymore. Added the *optimize* parameter." @@ -911,13 +912,13 @@ msgstr "" "允許使用 Windows 和 Mac 的換行符號。此外,在 ``'exec'`` 模式不需要以換行符號" "結尾。增加了 *optimize* 參數。" -#: ../../library/functions.rst:366 +#: ../../library/functions.rst:368 msgid "" "Previously, :exc:`TypeError` was raised when null bytes were encountered in " "*source*." msgstr "在之前的版本,*source* 中包含 null bytes 會引發 :exc:`TypeError`。" -#: ../../library/functions.rst:370 +#: ../../library/functions.rst:372 msgid "" "``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable " "support for top-level ``await``, ``async for``, and ``async with``." @@ -925,18 +926,18 @@ msgstr "" "``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` 現在可以傳遞旗標以啟用對頂層 ``await``、" "``async for`` 和 ``async with`` 的支援。" -#: ../../library/functions.rst:379 +#: ../../library/functions.rst:381 msgid "" "Convert a single string or number to a complex number, or create a complex " "number from real and imaginary parts." msgstr "" -#: ../../library/functions.rst:382 ../../library/functions.rst:739 -#: ../../library/functions.rst:985 +#: ../../library/functions.rst:384 ../../library/functions.rst:741 +#: ../../library/functions.rst:987 msgid "Examples:" msgstr "例如: ::" -#: ../../library/functions.rst:384 +#: ../../library/functions.rst:386 msgid "" ">>> complex('+1.23')\n" "(1.23+0j)\n" @@ -972,7 +973,7 @@ msgstr "" ">>> complex(-1.23, 4.5)\n" "(-1.23+4.5j)" -#: ../../library/functions.rst:403 +#: ../../library/functions.rst:405 msgid "" "If the argument is a string, it must contain either a real part (in the same " "format as for :func:`float`) or an imaginary part (in the same format but " @@ -987,8 +988,7 @@ msgid "" "parentheses and leading and trailing whitespace characters are removed:" msgstr "" -#: ../../library/functions.rst:422 -#, fuzzy +#: ../../library/functions.rst:424 msgid "" "If the argument is a number, the constructor serves as a numeric conversion " "like :class:`int` and :class:`float`. For a general Python object ``x``, " @@ -997,12 +997,13 @@ msgid "" "If :meth:`!__float__` is not defined then it falls back to :meth:`~object." "__index__`." msgstr "" -"對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 ``x." +"如果引數是一個數字,則建構函式會像 :class:`int` 和 :class:`float` 一樣進行數" +"值轉換。對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 ``x." "__complex__()``。如果 :meth:`~object.__complex__` 未定義,則會回退 (fall " "back) 到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未定義,則會再回" "退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:431 +#: ../../library/functions.rst:433 msgid "" "If two arguments are provided or keyword arguments are used, each argument " "may be any numeric type (including complex). If both arguments are real " @@ -1013,20 +1014,20 @@ msgid "" "number, only its real component is used in the above expressions." msgstr "" -#: ../../library/functions.rst:441 +#: ../../library/functions.rst:443 msgid "If all arguments are omitted, returns ``0j``." msgstr "" -#: ../../library/functions.rst:443 +#: ../../library/functions.rst:445 msgid "The complex type is described in :ref:`typesnumeric`." msgstr "複數型別在 :ref:`typesnumeric` 中有相關描述。" -#: ../../library/functions.rst:445 ../../library/functions.rst:791 -#: ../../library/functions.rst:1034 +#: ../../library/functions.rst:447 ../../library/functions.rst:793 +#: ../../library/functions.rst:1036 msgid "Grouping digits with underscores as in code literals is allowed." msgstr "可以使用底線將程式碼文字中的數字進行分組。" -#: ../../library/functions.rst:448 +#: ../../library/functions.rst:450 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` and :" "meth:`~object.__float__` are not defined." @@ -1034,7 +1035,7 @@ msgstr "" "如果 :meth:`~object.__complex__` 和 :meth:`~object.__float__` 未定義,則會回" "退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:455 +#: ../../library/functions.rst:457 msgid "" "This is a relative of :func:`setattr`. The arguments are an object and a " "string. The string must be the name of one of the object's attributes. The " @@ -1047,7 +1048,7 @@ msgstr "" "'foobar')`` 等價於 ``del x.foobar``。*name* 不必是個 Python 識別符 " "(identifier)(請見 :func:`setattr`)。" -#: ../../library/functions.rst:468 +#: ../../library/functions.rst:470 msgid "" "Create a new dictionary. The :class:`dict` object is the dictionary class. " "See :class:`dict` and :ref:`typesmapping` for documentation about this class." @@ -1055,7 +1056,7 @@ msgstr "" "建立一個新的 dictionary(字典)。:class:`dict` 物件是一個 dictionary class。" "參見 :class:`dict` 和 :ref:`typesmapping` 來瞭解這個 class。" -#: ../../library/functions.rst:471 +#: ../../library/functions.rst:473 msgid "" "For other containers see the built-in :class:`list`, :class:`set`, and :" "class:`tuple` classes, as well as the :mod:`collections` module." @@ -1063,7 +1064,7 @@ msgstr "" "其他容器型別,請參見內建的 :class:`list`、:class:`set` 和 :class:`tuple` " "class,以及 :mod:`collections` module。" -#: ../../library/functions.rst:478 +#: ../../library/functions.rst:480 msgid "" "Without arguments, return the list of names in the current local scope. " "With an argument, attempt to return a list of valid attributes for that " @@ -1072,7 +1073,7 @@ msgstr "" "如果沒有引數,則回傳當前區域作用域 (local scope) 中的名稱列表。如果有引數,它" "會嘗試回傳該物件的有效屬性列表。" -#: ../../library/functions.rst:481 +#: ../../library/functions.rst:483 msgid "" "If the object has a method named :meth:`~object.__dir__`, this method will " "be called and must return the list of attributes. This allows objects that " @@ -1085,7 +1086,7 @@ msgstr "" "或 :func:`~object.__getattribute__` 函式的物件能夠自定義 :func:`dir` 來報告它" "們的屬性。" -#: ../../library/functions.rst:488 +#: ../../library/functions.rst:490 msgid "" "If the object does not provide :meth:`~object.__dir__`, the function tries " "its best to gather information from the object's :attr:`~object.__dict__` " @@ -1097,7 +1098,7 @@ msgstr "" "`~object.__dict__` 屬性和型別物件收集資訊。結果列表並不總是完整的,如果物件有" "自定義 :func:`~object.__getattr__`,那結果可能不準確。" -#: ../../library/functions.rst:494 +#: ../../library/functions.rst:496 msgid "" "The default :func:`dir` mechanism behaves differently with different types " "of objects, as it attempts to produce the most relevant, rather than " @@ -1106,13 +1107,13 @@ msgstr "" "預設的 :func:`dir` 機制對不同型別的物件有不同行為,它會試圖回傳最相關而非最完" "整的資訊:" -#: ../../library/functions.rst:498 +#: ../../library/functions.rst:500 msgid "" "If the object is a module object, the list contains the names of the " "module's attributes." msgstr "如果物件是 module 物件,則列表包含 module 的屬性名稱。" -#: ../../library/functions.rst:501 +#: ../../library/functions.rst:503 msgid "" "If the object is a type or class object, the list contains the names of its " "attributes, and recursively of the attributes of its bases." @@ -1120,7 +1121,7 @@ msgstr "" "如果物件是型別或 class 物件,則列表包含它們的屬性名稱,並且遞迴查詢其基礎的所" "有屬性。" -#: ../../library/functions.rst:504 +#: ../../library/functions.rst:506 msgid "" "Otherwise, the list contains the object's attributes' names, the names of " "its class's attributes, and recursively of the attributes of its class's " @@ -1129,11 +1130,11 @@ msgstr "" "否則,包含物件的屬性名稱列表、它的 class 屬性名稱,並且遞迴查詢它的 class 的" "所有基礎 class 的屬性。" -#: ../../library/functions.rst:508 +#: ../../library/functions.rst:510 msgid "The resulting list is sorted alphabetically. For example:" msgstr "回傳的列表按字母表排序,例如:" -#: ../../library/functions.rst:528 +#: ../../library/functions.rst:530 msgid "" "Because :func:`dir` is supplied primarily as a convenience for use at an " "interactive prompt, it tries to supply an interesting set of names more than " @@ -1146,7 +1147,7 @@ msgstr "" "版本之間改變。例如,當引數是一個 class 時,metaclass 的屬性不包含在結果列表" "中。" -#: ../../library/functions.rst:538 +#: ../../library/functions.rst:540 msgid "" "Take two (non-complex) numbers as arguments and return a pair of numbers " "consisting of their quotient and remainder when using integer division. " @@ -1164,7 +1165,7 @@ msgstr "" "等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣,且 ``0 <= abs(a % b) < " "abs(b)``。" -#: ../../library/functions.rst:550 +#: ../../library/functions.rst:552 msgid "" "Return an enumerate object. *iterable* must be a sequence, an :term:" "`iterator`, or some other object which supports iteration. The :meth:" @@ -1177,11 +1178,11 @@ msgstr "" "__next__` method 回傳一個 tuple(元組),裡面包含一個計數值(從 *start* 開" "始,預設為 0)和透過疊代 *iterable* 獲得的值。" -#: ../../library/functions.rst:562 +#: ../../library/functions.rst:564 msgid "Equivalent to::" msgstr "等價於: ::" -#: ../../library/functions.rst:564 +#: ../../library/functions.rst:566 msgid "" "def enumerate(iterable, start=0):\n" " n = start\n" @@ -1199,15 +1200,15 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/functions.rst:574 +#: ../../library/functions.rst:576 msgid "A Python expression." msgstr "" -#: ../../library/functions.rst:578 +#: ../../library/functions.rst:580 msgid "The global namespace (default: ``None``)." msgstr "" -#: ../../library/functions.rst:582 +#: ../../library/functions.rst:584 msgid "The local namespace (default: ``None``)." msgstr "" @@ -1215,7 +1216,7 @@ msgstr "" msgid "Returns" msgstr "" -#: ../../library/functions.rst:586 +#: ../../library/functions.rst:588 msgid "The result of the evaluated expression." msgstr "" @@ -1223,12 +1224,11 @@ msgstr "" msgid "raises" msgstr "引發" -#: ../../library/functions.rst:587 +#: ../../library/functions.rst:589 msgid "Syntax errors are reported as exceptions." msgstr "" -#: ../../library/functions.rst:589 -#, fuzzy +#: ../../library/functions.rst:591 msgid "" "The *expression* argument is parsed and evaluated as a Python expression " "(technically speaking, a condition list) using the *globals* and *locals* " @@ -1247,20 +1247,22 @@ msgid "" "`nonlocal` statement)." msgstr "" "*expression* 引數會被視為一條 Python 運算式(技術上而言,是條件列表)來剖析及" -"求值,而 *globals* 和 *locals* dictionaries 分別用作全域和區域命名空間。如果 " +"求值,而 *globals* 和 *locals* 對映分別用作全域和區域命名空間。如果 " "*globals* dictionary 存在但缺少 ``__builtins__`` 的鍵值,那 *expression* 被剖" "析之前,將為該鍵插入對內建 :mod:`builtins` module dictionary 的引用。這麼一" "來,在將 ``__builtins__`` dictionary 傳入 :func:`eval` 之前,你可以透過將它插" -"入 *globals* 來控制你需要哪些內建函式來執行程式碼。如果 *locals* 被省略,那它" -"的預設值是 *globals* dictionary。如果兩個 dictionary 引數都被省略,則在 :" -"func:`eval` 被呼叫的環境中執行運算式。請注意,*eval()* 在封閉 (enclosing) 環" -"境中無法存取\\ :term:`巢狀作用域 ` (non-locals)。" - -#: ../../library/functions.rst:605 +"入 *globals* 來控制你需要哪些內建函式來執行程式碼。如果 *locals* 對映被省略," +"那它的預設值是 *globals* dictionary。如果兩個對映都被省略,則以在 :func:" +"`eval` 被呼叫的環境中的 *globals* 和 *locals* 執行運算式。請注意,*eval()* 在" +"封閉 (enclosing) 環境中無法存取\\ :term:`巢狀作用域 ` (non-" +"locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透過 :keyword:" +"`nonlocal` 陳述式)。" + +#: ../../library/functions.rst:607 msgid "Example:" msgstr "範例:" -#: ../../library/functions.rst:611 +#: ../../library/functions.rst:613 msgid "" "This function can also be used to execute arbitrary code objects (such as " "those created by :func:`compile`). In this case, pass a code object instead " @@ -1271,7 +1273,7 @@ msgstr "" "情況下,傳入的引數是程式碼物件而不是字串。如果編譯該物件時的 *mode* 引數是 " "``'exec'``,那麼 :func:`eval` 回傳值為 ``None``。" -#: ../../library/functions.rst:616 +#: ../../library/functions.rst:618 msgid "" "Hints: dynamic execution of statements is supported by the :func:`exec` " "function. The :func:`globals` and :func:`locals` functions return the " @@ -1282,13 +1284,13 @@ msgstr "" "函式分別回傳當前的全域性和局部性 dictionary,它們對於將引數傳遞給 :func:" "`eval` 或 :func:`exec` 可能會方便許多。" -#: ../../library/functions.rst:621 +#: ../../library/functions.rst:623 msgid "" "If the given source is a string, then leading and trailing spaces and tabs " "are stripped." msgstr "如果給定來源是一個字串,那麼其前後的空格和定位字元會被移除。" -#: ../../library/functions.rst:624 +#: ../../library/functions.rst:626 msgid "" "See :func:`ast.literal_eval` for a function that can safely evaluate strings " "with expressions containing only literals." @@ -1296,8 +1298,8 @@ msgstr "" "另外可以參閱 :func:`ast.literal_eval`,該函式可以安全執行僅包含文字的運算式字" "串。" -#: ../../library/functions.rst:627 ../../library/functions.rst:629 -#: ../../library/functions.rst:683 ../../library/functions.rst:685 +#: ../../library/functions.rst:629 ../../library/functions.rst:631 +#: ../../library/functions.rst:685 ../../library/functions.rst:687 msgid "" "Raises an :ref:`auditing event ` ``exec`` with the code object as " "the argument. Code compilation events may also be raised." @@ -1305,18 +1307,17 @@ msgstr "" "引發一個附帶程式碼物件為引數的\\ :ref:`稽核事件 ` ``exec``。也可能" "會引發程式碼編譯事件。" -#: ../../library/functions.rst:634 ../../library/functions.rst:705 +#: ../../library/functions.rst:636 ../../library/functions.rst:707 msgid "The *globals* and *locals* arguments can now be passed as keywords." msgstr "" -#: ../../library/functions.rst:638 ../../library/functions.rst:709 +#: ../../library/functions.rst:640 ../../library/functions.rst:711 msgid "" "The semantics of the default *locals* namespace have been adjusted as " "described for the :func:`locals` builtin." msgstr "" -#: ../../library/functions.rst:645 -#, fuzzy +#: ../../library/functions.rst:647 msgid "" "This function supports dynamic execution of Python code. *source* must be " "either a string or a code object. If it is a string, the string is parsed " @@ -1328,7 +1329,7 @@ msgid "" "not be used outside of function definitions even within the context of code " "passed to the :func:`exec` function. The return value is ``None``." msgstr "" -"這個函式支援動態執行 Python 程式碼。*object* 必須是字串或者程式碼物件。如果是" +"這個函式支援動態執行 Python 程式碼。*source* 必須是字串或者程式碼物件。如果是" "字串,那麼該字串將被剖析為一系列 Python 陳述式並執行(除非發生語法錯誤)。" "[#]_ 如果是程式碼物件,它將被直接執行。無論哪種情況,被執行的程式碼都需要和檔" "案輸入一樣是有效的(可參閱語言參考手冊中關於\\ :ref:`file-input`\\ 的章節)。" @@ -1336,8 +1337,7 @@ msgstr "" "`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在函式之外使" "用。該函式回傳值是 ``None``。" -#: ../../library/functions.rst:656 -#, fuzzy +#: ../../library/functions.rst:658 msgid "" "In all cases, if the optional parts are omitted, the code is executed in the " "current scope. If only *globals* is provided, it must be a dictionary (and " @@ -1347,13 +1347,13 @@ msgid "" "any mapping object. Remember that at the module level, globals and locals " "are the same dictionary." msgstr "" -"無論哪種情況,如果省略了選擇性引數,程式碼將在當前作用域內執行。如果只提供了 " -"*globals* 引數,就必須是 dictionary 型別,而且會被用作全域性和本地變數。如果" -"同時提供了 *globals* 和 *locals* 引數,它們分別被用作全域性和本地變數。如果提" -"供了 *locals* 引數,則它可以是任何映射物件。請記住在 module 層級中全域性和本" -"地變數是相同的 dictionary。" +"無論哪種情況,如果省略了選擇性的部分,程式碼將在當前作用域內執行。如果只提供" +"了 *globals* 引數,就必須是 dictionary 型別(且不能是 dictionary 的子類別)," +"而且會被用作全域和區域變數。如果同時提供了 *globals* 和 *locals*,它們分別被" +"用作全域和區域變數。如果提供了 *locals*,則它可以是任何對映物件。請記住在 " +"module 層級中全域和區域變數是相同的 dictionary。" -#: ../../library/functions.rst:666 +#: ../../library/functions.rst:668 msgid "" "When ``exec`` gets two separate objects as *globals* and *locals*, the code " "will be executed as if it were embedded in a class definition. This means " @@ -1362,7 +1362,7 @@ msgid "" "are treated as class variables in a class definition)." msgstr "" -#: ../../library/functions.rst:672 +#: ../../library/functions.rst:674 msgid "" "If the *globals* dictionary does not contain a value for the key " "``__builtins__``, a reference to the dictionary of the built-in module :mod:" @@ -1375,7 +1375,7 @@ msgstr "" "dictionary 傳入 :func:`exec` 之前,你可以透過將它插入 *globals* 來控制你需要" "哪些內建函式來執行程式碼。" -#: ../../library/functions.rst:678 +#: ../../library/functions.rst:680 msgid "" "The *closure* argument specifies a closure--a tuple of cellvars. It's only " "valid when the *object* is a code object containing free variables. The " @@ -1386,32 +1386,30 @@ msgstr "" "只有在 *object* 是一個含有自由變數 (free variable) 的程式碼物件時,它才有效。" "Tuple 的長度必須與程式碼物件所引用的自由變數數量完全匹配。" -#: ../../library/functions.rst:690 -#, fuzzy +#: ../../library/functions.rst:692 msgid "" "The built-in functions :func:`globals` and :func:`locals` return the current " "global and local namespace, respectively, which may be useful to pass around " "for use as the second and third argument to :func:`exec`." msgstr "" -"內建 :func:`globals` 和 :func:`locals` 函式各自回傳當前的全域性和本地 " -"dictionary,因此可以將它們傳遞給 :func:`exec` 的第二個和第三個引數。" +"內建 :func:`globals` 和 :func:`locals` 函式各自回傳當前的全域和區域命名空間," +"因此可以將它們傳遞給 :func:`exec` 的第二個和第三個引數以供後續使用。" -#: ../../library/functions.rst:696 -#, fuzzy +#: ../../library/functions.rst:698 msgid "" "The default *locals* act as described for function :func:`locals` below. " "Pass an explicit *locals* dictionary if you need to see effects of the code " "on *locals* after function :func:`exec` returns." msgstr "" -"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣:不要試圖改變" -"預設的 *locals* dictionary。如果你想在 :func:`exec` 函式回傳時知道程式碼對 " -"*locals* 的變動,請明確地傳遞 *locals* dictionary 。" +"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣。如果你想在 :" +"func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 *locals* " +"dictionary 。" -#: ../../library/functions.rst:700 +#: ../../library/functions.rst:702 msgid "Added the *closure* parameter." msgstr "增加了 *closure* 參數。" -#: ../../library/functions.rst:715 +#: ../../library/functions.rst:717 msgid "" "Construct an iterator from those elements of *iterable* for which *function* " "is true. *iterable* may be either a sequence, a container which supports " @@ -1423,7 +1421,7 @@ msgstr "" "*function* 是 ``None``,則會假設它是一個識別性函式,即 *iterable* 中所有假值" "元素會被移除。" -#: ../../library/functions.rst:721 +#: ../../library/functions.rst:723 msgid "" "Note that ``filter(function, iterable)`` is equivalent to the generator " "expression ``(item for item in iterable if function(item))`` if function is " @@ -1434,7 +1432,7 @@ msgstr "" "是 ``None`` 的時候為 ``(item for item in iterable if function(item))``;" "function 是 ``None`` 的時候為 ``(item for item in iterable if item)``。" -#: ../../library/functions.rst:726 +#: ../../library/functions.rst:728 msgid "" "See :func:`itertools.filterfalse` for the complementary function that " "returns elements of *iterable* for which *function* is false." @@ -1442,11 +1440,11 @@ msgstr "" "請參閱 :func:`itertools.filterfalse`,只有 *function* 為 false 時才選取 " "*iterable* 中元素的互補函式。" -#: ../../library/functions.rst:737 +#: ../../library/functions.rst:739 msgid "Return a floating-point number constructed from a number or a string." msgstr "回傳從數字或字串生成的浮點數。" -#: ../../library/functions.rst:741 +#: ../../library/functions.rst:743 msgid "" ">>> float('+1.23')\n" "1.23\n" @@ -1470,7 +1468,7 @@ msgstr "" ">>> float('-Infinity')\n" "-inf" -#: ../../library/functions.rst:754 +#: ../../library/functions.rst:756 msgid "" "If the argument is a string, it should contain a decimal number, optionally " "preceded by a sign, and optionally embedded in whitespace. The optional " @@ -1485,7 +1483,7 @@ msgstr "" "數也可以是 NaN(非數字)或正負無窮大的字串。確切地說,除去首尾的空格後,輸入" "必須遵循以下語法中 :token:`~float:floatvalue` 的生成規則:" -#: ../../library/functions.rst:775 +#: ../../library/functions.rst:777 msgid "" "Case is not significant, so, for example, \"inf\", \"Inf\", \"INFINITY\", " "and \"iNfINity\" are all acceptable spellings for positive infinity." @@ -1493,7 +1491,7 @@ msgstr "" "字母大小寫不影響,例如,\"inf\"、\"Inf\"、\"INFINITY\"、\"iNfINity\" 都可以表" "示正無窮大。" -#: ../../library/functions.rst:778 +#: ../../library/functions.rst:780 msgid "" "Otherwise, if the argument is an integer or a floating-point number, a " "floating-point number with the same value (within Python's floating-point " @@ -1503,7 +1501,7 @@ msgstr "" "否則,如果引數是整數或浮點數,則回傳具有相同值(在 Python 浮點精度範圍內)的" "浮點數。如果引數在 Python 浮點精度範圍外,則會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:783 +#: ../../library/functions.rst:785 msgid "" "For a general Python object ``x``, ``float(x)`` delegates to ``x." "__float__()``. If :meth:`~object.__float__` is not defined then it falls " @@ -1512,22 +1510,22 @@ msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 會委派給 ``x.__float__()``。如果未" "定義 :meth:`~object.__float__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:787 +#: ../../library/functions.rst:789 msgid "If no argument is given, ``0.0`` is returned." msgstr "如果沒有引數,則回傳 ``0.0``。" -#: ../../library/functions.rst:789 +#: ../../library/functions.rst:791 msgid "The float type is described in :ref:`typesnumeric`." msgstr ":ref:`typesnumeric` 描述了浮點數型別。" -#: ../../library/functions.rst:797 +#: ../../library/functions.rst:799 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not " "defined." msgstr "" "如果 :meth:`~object.__float__` 未定義,則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:807 +#: ../../library/functions.rst:809 msgid "" "Convert a *value* to a \"formatted\" representation, as controlled by " "*format_spec*. The interpretation of *format_spec* will depend on the type " @@ -1538,7 +1536,7 @@ msgstr "" "取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語法::ref:" "`formatspec`。" -#: ../../library/functions.rst:812 +#: ../../library/functions.rst:814 msgid "" "The default *format_spec* is an empty string which usually gives the same " "effect as calling :func:`str(value) `." @@ -1546,7 +1544,7 @@ msgstr "" "預設的 *format_spec* 是一個空字串,它通常和呼叫 :func:`str(value) ` 的效" "果相同。" -#: ../../library/functions.rst:815 +#: ../../library/functions.rst:817 msgid "" "A call to ``format(value, format_spec)`` is translated to ``type(value)." "__format__(value, format_spec)`` which bypasses the instance dictionary when " @@ -1560,7 +1558,7 @@ msgstr "" "實例中的字典。如果搜尋到 :mod:`object` 這個 method 但 *format_spec* 不為空," "或是 *format_spec* 或回傳值不是字串,則會引發 :exc:`TypeError`。" -#: ../../library/functions.rst:822 +#: ../../library/functions.rst:824 msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." @@ -1568,7 +1566,7 @@ msgstr "" "當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:831 +#: ../../library/functions.rst:833 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " "*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" @@ -1578,7 +1576,7 @@ msgstr "" "``frozenset`` 是一個內建的 class。有關此 class 的文件,請參閱 :class:" "`frozenset` 和 :ref:`types-set`。" -#: ../../library/functions.rst:835 +#: ../../library/functions.rst:837 msgid "" "For other containers see the built-in :class:`set`, :class:`list`, :class:" "`tuple`, and :class:`dict` classes, as well as the :mod:`collections` module." @@ -1586,7 +1584,7 @@ msgstr "" "請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` " "class,以及 :mod:`collections` module 來了解其它的容器。" -#: ../../library/functions.rst:843 +#: ../../library/functions.rst:845 msgid "" "Return the value of the named attribute of *object*. *name* must be a " "string. If the string is the name of one of the object's attributes, the " @@ -1601,7 +1599,7 @@ msgstr "" "`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:" "`setattr`)。" -#: ../../library/functions.rst:852 +#: ../../library/functions.rst:854 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " @@ -1612,7 +1610,7 @@ msgstr "" "發生在編譯期,因此你必須手動改編私有屬性(有兩個前導底線的屬性)的名稱,才能" "使用 :func:`getattr` 來取得它。" -#: ../../library/functions.rst:860 +#: ../../library/functions.rst:862 msgid "" "Return the dictionary implementing the current module namespace. For code " "within functions, this is set when the function is defined and remains the " @@ -1621,7 +1619,7 @@ msgstr "" "回傳代表當前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義" "函式時設定且不論該函式是在何處呼叫都會保持相同。" -#: ../../library/functions.rst:867 +#: ../../library/functions.rst:869 msgid "" "The arguments are an object and a string. The result is ``True`` if the " "string is the name of one of the object's attributes, ``False`` if not. " @@ -1632,7 +1630,7 @@ msgstr "" "則回傳 ``False``。(此功能是透過呼叫 ``getattr(object, name)`` 並檢查是否引" "發 :exc:`AttributeError` 來實作的。)" -#: ../../library/functions.rst:875 +#: ../../library/functions.rst:877 msgid "" "Return the hash value of the object (if it has one). Hash values are " "integers. They are used to quickly compare dictionary keys during a " @@ -1643,7 +1641,7 @@ msgstr "" "時用來快速比較 dictionary 的鍵。相同大小的數字數值有相同的雜湊值(即使它們型" "別不同,如 1 和 1.0)。" -#: ../../library/functions.rst:882 +#: ../../library/functions.rst:884 msgid "" "For objects with custom :meth:`~object.__hash__` methods, note that :func:" "`hash` truncates the return value based on the bit width of the host machine." @@ -1651,7 +1649,7 @@ msgstr "" "請注意,如果物件帶有自訂的 :meth:`~object.__hash__` 方法,:func:`hash` 將根據" "運行機器的位元長度來截斷回傳值。" -#: ../../library/functions.rst:889 +#: ../../library/functions.rst:891 msgid "" "Invoke the built-in help system. (This function is intended for interactive " "use.) If no argument is given, the interactive help system starts on the " @@ -1665,7 +1663,7 @@ msgstr "" "關鍵字或說明文件主題中搜索該字串,並在控制台上列印幫助資訊。如果引數是其他任" "意物件,則會生成該物件的幫助頁。" -#: ../../library/functions.rst:896 +#: ../../library/functions.rst:898 msgid "" "Note that if a slash(/) appears in the parameter list of a function when " "invoking :func:`help`, it means that the parameters prior to the slash are " @@ -1676,12 +1674,12 @@ msgstr "" "前面的參數是僅限位置 (positional-only) 參數。有關更多資訊,請參閱\\ :ref:`常" "見問答集中的僅限位置參數條目 `。" -#: ../../library/functions.rst:901 +#: ../../library/functions.rst:903 msgid "" "This function is added to the built-in namespace by the :mod:`site` module." msgstr "此函式會被 :mod:`site` module 加入到內建命名空間。" -#: ../../library/functions.rst:903 +#: ../../library/functions.rst:905 msgid "" "Changes to :mod:`pydoc` and :mod:`inspect` mean that the reported signatures " "for callables are now more comprehensive and consistent." @@ -1689,7 +1687,7 @@ msgstr "" "對於 :mod:`pydoc` 和 :mod:`inspect` 的變更,使得可呼叫物件回報的的簽名 " "(signature) 更加全面和一致。" -#: ../../library/functions.rst:910 +#: ../../library/functions.rst:912 msgid "" "Convert an integer number to a lowercase hexadecimal string prefixed with " "\"0x\". If *x* is not a Python :class:`int` object, it has to define an :" @@ -1699,7 +1697,7 @@ msgstr "" "class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並且回傳一" "個整數。舉例來說:" -#: ../../library/functions.rst:919 +#: ../../library/functions.rst:921 msgid "" "If you want to convert an integer number to an uppercase or lower " "hexadecimal string with prefix or not, you can use either of the following " @@ -1708,20 +1706,20 @@ msgstr "" "如果要將整數轉換為大寫或小寫的十六進位制字串,並可選擇有無 \"0x\" 前綴,則可" "以使用如下方法:" -#: ../../library/functions.rst:931 +#: ../../library/functions.rst:933 msgid "" "See also :func:`int` for converting a hexadecimal string to an integer using " "a base of 16." msgstr "另請參閱 :func:`int` 將十六進位制字串轉換為以 16 為基數的整數。" -#: ../../library/functions.rst:936 +#: ../../library/functions.rst:938 msgid "" "To obtain a hexadecimal string representation for a float, use the :meth:" "`float.hex` method." msgstr "" "如果要獲取浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" -#: ../../library/functions.rst:942 +#: ../../library/functions.rst:944 msgid "" "Return the \"identity\" of an object. This is an integer which is " "guaranteed to be unique and constant for this object during its lifetime. " @@ -1731,18 +1729,18 @@ msgstr "" "回傳物件的 \"識別性\" 。該值是一個整數,在此物件的生命週期中保證是唯一且恆定" "的。兩個生命期不重疊的物件可能具有相同的 :func:`id` 值。" -#: ../../library/functions.rst:947 +#: ../../library/functions.rst:949 msgid "This is the address of the object in memory." msgstr "這是該物件在記憶體中的位址。" -#: ../../library/functions.rst:949 +#: ../../library/functions.rst:951 msgid "" "Raises an :ref:`auditing event ` ``builtins.id`` with argument " "``id``." msgstr "" "引發一個附帶引數 ``id`` 的\\ :ref:`稽核事件 ` ``builtins.id``。" -#: ../../library/functions.rst:955 +#: ../../library/functions.rst:957 msgid "" "If the *prompt* argument is present, it is written to standard output " "without a trailing newline. The function then reads a line from input, " @@ -1753,7 +1751,7 @@ msgstr "" "從輸入中讀取一行,將其轉換為字串(去除末尾的換行符)並回傳。當讀取到 EOF 時," "則引發 :exc:`EOFError`。例如: ::" -#: ../../library/functions.rst:960 +#: ../../library/functions.rst:962 msgid "" ">>> s = input('--> ') \n" "--> Monty Python's Flying Circus\n" @@ -1765,7 +1763,7 @@ msgstr "" ">>> s \n" "\"Monty Python's Flying Circus\"" -#: ../../library/functions.rst:965 +#: ../../library/functions.rst:967 msgid "" "If the :mod:`readline` module was loaded, then :func:`input` will use it to " "provide elaborate line editing and history features." @@ -1773,7 +1771,7 @@ msgstr "" "如果載入了 :mod:`readline` module,:func:`input` 將使用它來提供複雜的行編輯和" "歷史記錄功能。" -#: ../../library/functions.rst:968 ../../library/functions.rst:970 +#: ../../library/functions.rst:970 ../../library/functions.rst:972 msgid "" "Raises an :ref:`auditing event ` ``builtins.input`` with argument " "``prompt`` before reading input" @@ -1781,7 +1779,7 @@ msgstr "" "引發一個附帶讀取輸入前的引數 ``prompt`` 的\\ :ref:`稽核事件 ` " "``builtins.input``。" -#: ../../library/functions.rst:973 ../../library/functions.rst:975 +#: ../../library/functions.rst:975 ../../library/functions.rst:977 msgid "" "Raises an :ref:`auditing event ` ``builtins.input/result`` with " "the result after successfully reading input." @@ -1789,13 +1787,13 @@ msgstr "" "引發一個附帶成功讀取結果的\\ :ref:`稽核事件 ` ``builtins.input/" "result``。" -#: ../../library/functions.rst:982 +#: ../../library/functions.rst:984 msgid "" "Return an integer object constructed from a number or a string, or return " "``0`` if no arguments are given." msgstr "" -#: ../../library/functions.rst:987 +#: ../../library/functions.rst:989 msgid "" ">>> int(123.45)\n" "123\n" @@ -1823,7 +1821,7 @@ msgstr "" ">>> int('01110011', base=2)\n" "115" -#: ../../library/functions.rst:1002 +#: ../../library/functions.rst:1004 msgid "" "If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x." "__int__()``. If the argument defines :meth:`~object.__index__`, it returns " @@ -1836,7 +1834,7 @@ msgstr "" "義了 :meth:`~object.__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數,則會向零" "的方向無條件捨去。" -#: ../../library/functions.rst:1008 +#: ../../library/functions.rst:1010 msgid "" "If the argument is not a number or if *base* is given, then it must be a " "string, :class:`bytes`, or :class:`bytearray` instance representing an " @@ -1849,7 +1847,7 @@ msgstr "" "以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、或在" "數字間有單一底線。" -#: ../../library/functions.rst:1014 +#: ../../library/functions.rst:1016 msgid "" "A base-n integer string contains digits, each representing a value from 0 to " "n-1. The values 0--9 can be represented by any Unicode decimal digit. The " @@ -1871,11 +1869,11 @@ msgstr "" "進制中的一個,所以 ``int('010', 0)`` 是非法的,但 ``int('010')`` 和 " "``int('010', 8)`` 是有效的。" -#: ../../library/functions.rst:1025 +#: ../../library/functions.rst:1027 msgid "The integer type is described in :ref:`typesnumeric`." msgstr "整數型別定義請參閱\\ :ref:`typesnumeric`。" -#: ../../library/functions.rst:1027 +#: ../../library/functions.rst:1029 msgid "" "If *base* is not an instance of :class:`int` and the *base* object has a :" "meth:`base.__index__ ` method, that method is called to " @@ -1887,22 +1885,22 @@ msgstr "" "的版本使用 :meth:`base.__int__ ` 而不是 :meth:`base." "__index__ `。" -#: ../../library/functions.rst:1037 +#: ../../library/functions.rst:1039 msgid "The first parameter is now positional-only." msgstr "第一個參數為僅限位置參數。" -#: ../../library/functions.rst:1040 +#: ../../library/functions.rst:1042 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not " "defined." msgstr "" "如果未定義 :meth:`~object.__int__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:1043 +#: ../../library/functions.rst:1045 msgid "The delegation to :meth:`~object.__trunc__` is deprecated." msgstr "對 :meth:`~object.__trunc__` 的委派已棄用。" -#: ../../library/functions.rst:1046 +#: ../../library/functions.rst:1048 msgid "" ":class:`int` string inputs and string representations can be limited to help " "avoid denial of service attacks. A :exc:`ValueError` is raised when the " @@ -1916,7 +1914,7 @@ msgstr "" "`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱\\ :ref:`整" "數字串轉換的長度限制 `\\ 說明文件。" -#: ../../library/functions.rst:1056 +#: ../../library/functions.rst:1058 msgid "" "Return ``True`` if the *object* argument is an instance of the *classinfo* " "argument, or of a (direct, indirect, or :term:`virtual `) of *classinfo*. A class is considered a " @@ -1956,7 +1954,7 @@ msgstr "" "是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:1088 +#: ../../library/functions.rst:1090 msgid "" "Return an :term:`iterator` object. The first argument is interpreted very " "differently depending on the presence of the second argument. Without a " @@ -1980,11 +1978,11 @@ msgstr "" "__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 *sentinel* 則引發 :" "exc:`StopIteration`,否則回傳呼叫結果。" -#: ../../library/functions.rst:1102 +#: ../../library/functions.rst:1104 msgid "See also :ref:`typeiter`." msgstr "另請參閱 :ref:`typeiter`。" -#: ../../library/functions.rst:1104 +#: ../../library/functions.rst:1106 msgid "" "One useful application of the second form of :func:`iter` is to build a " "block-reader. For example, reading fixed-width blocks from a binary database " @@ -1993,7 +1991,7 @@ msgstr "" ":func:`iter` 的第二種形式有一個好用的應用,是能夠建立一個區塊閱讀器 (block-" "reader)。例如,從二進位資料庫檔案中讀取固定寬度的區塊,直到檔案的結尾: ::" -#: ../../library/functions.rst:1108 +#: ../../library/functions.rst:1110 msgid "" "from functools import partial\n" "with open('mydata.db', 'rb') as f:\n" @@ -2005,7 +2003,7 @@ msgstr "" " for block in iter(partial(f.read, 64), b''):\n" " process_block(block)" -#: ../../library/functions.rst:1116 +#: ../../library/functions.rst:1118 msgid "" "Return the length (the number of items) of an object. The argument may be a " "sequence (such as a string, bytes, tuple, list, or range) or a collection " @@ -2014,7 +2012,7 @@ msgstr "" "回傳物件的長度(元素個數)。引數可以是序列(如 string、bytes、tuple、list 或 " "range)或集合(如 dictionary、set 或 frozen set)。" -#: ../../library/functions.rst:1122 +#: ../../library/functions.rst:1124 msgid "" "``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." "maxsize`, such as :class:`range(2 ** 100) `." @@ -2022,7 +2020,7 @@ msgstr "" "如果物件長度大於 :data:`sys.maxsize`,像是 :class:`range(2 ** 100) `," "則 ``len`` 會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:1131 +#: ../../library/functions.rst:1133 msgid "" "Rather than being a function, :class:`list` is actually a mutable sequence " "type, as documented in :ref:`typesseq-list` and :ref:`typesseq`." @@ -2030,33 +2028,33 @@ msgstr "" "除了是函式,:class:`list` 也是可變序列型別,詳情請參閱 :ref:`typesseq-list` " "和 :ref:`typesseq`。" -#: ../../library/functions.rst:1137 +#: ../../library/functions.rst:1139 msgid "" "Return a mapping object representing the current local symbol table, with " "variable names as the keys, and their currently bound references as the " "values." msgstr "" -#: ../../library/functions.rst:1141 +#: ../../library/functions.rst:1143 msgid "" "At module scope, as well as when using :func:`exec` or :func:`eval` with a " "single namespace, this function returns the same namespace as :func:" "`globals`." msgstr "" -#: ../../library/functions.rst:1145 +#: ../../library/functions.rst:1147 msgid "" "At class scope, it returns the namespace that will be passed to the " "metaclass constructor." msgstr "" -#: ../../library/functions.rst:1148 +#: ../../library/functions.rst:1150 msgid "" "When using ``exec()`` or ``eval()`` with separate local and global " "arguments, it returns the local namespace passed in to the function call." msgstr "" -#: ../../library/functions.rst:1151 +#: ../../library/functions.rst:1153 msgid "" "In all of the above cases, each call to ``locals()`` in a given frame of " "execution will return the *same* mapping object. Changes made through the " @@ -2066,7 +2064,7 @@ msgid "" "returned mapping object." msgstr "" -#: ../../library/functions.rst:1158 +#: ../../library/functions.rst:1160 msgid "" "In an :term:`optimized scope` (including functions, generators, and " "coroutines), each call to ``locals()`` instead returns a fresh dictionary " @@ -2078,7 +2076,7 @@ msgid "" "previously returned dictionaries." msgstr "" -#: ../../library/functions.rst:1167 +#: ../../library/functions.rst:1169 msgid "" "Calling ``locals()`` as part of a comprehension in a function, generator, or " "coroutine is equivalent to calling it in the containing scope, except that " @@ -2087,19 +2085,19 @@ msgid "" "function." msgstr "" -#: ../../library/functions.rst:1173 +#: ../../library/functions.rst:1175 msgid "" "Calling ``locals()`` as part of a generator expression is equivalent to " "calling it in a nested generator function." msgstr "" -#: ../../library/functions.rst:1176 +#: ../../library/functions.rst:1178 msgid "" "The behaviour of ``locals()`` in a comprehension has been updated as " "described in :pep:`709`." msgstr "" -#: ../../library/functions.rst:1180 +#: ../../library/functions.rst:1182 msgid "" "As part of :pep:`667`, the semantics of mutating the mapping objects " "returned from this function are now defined. The behavior in :term:" @@ -2108,7 +2106,7 @@ msgid "" "versions." msgstr "" -#: ../../library/functions.rst:1190 +#: ../../library/functions.rst:1192 msgid "" "Return an iterator that applies *function* to every item of *iterable*, " "yielding the results. If additional *iterables* arguments are passed, " @@ -2123,13 +2121,13 @@ msgstr "" "iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經被編排為引數的 tuple," "請參閱 :func:`itertools.starmap`。" -#: ../../library/functions.rst:1202 +#: ../../library/functions.rst:1204 msgid "" "Return the largest item in an iterable or the largest of two or more " "arguments." msgstr "回傳 iterable 中最大的元素,或者回傳兩個以上的引數中最大的。" -#: ../../library/functions.rst:1205 +#: ../../library/functions.rst:1207 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The largest item in the iterable is returned. If two or more positional " @@ -2138,7 +2136,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是個 :term:`iterable`,iterable 中最大的元素" "會被回傳。如果提供了兩個或以上的位置引數,則回傳最大的位置引數。" -#: ../../library/functions.rst:1210 ../../library/functions.rst:1248 +#: ../../library/functions.rst:1212 ../../library/functions.rst:1250 msgid "" "There are two optional keyword-only arguments. The *key* argument specifies " "a one-argument ordering function like that used for :meth:`list.sort`. The " @@ -2151,7 +2149,7 @@ msgstr "" "的物件。如果 iterable 為空,並且沒有提供 *default*,則會引發 :exc:" "`ValueError`。" -#: ../../library/functions.rst:1216 +#: ../../library/functions.rst:1218 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2162,15 +2160,15 @@ msgstr "" "``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " "iterable, key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1221 ../../library/functions.rst:1259 +#: ../../library/functions.rst:1223 ../../library/functions.rst:1261 msgid "Added the *default* keyword-only parameter." msgstr "新增 *default* 僅限關鍵字參數。" -#: ../../library/functions.rst:1224 ../../library/functions.rst:1262 +#: ../../library/functions.rst:1226 ../../library/functions.rst:1264 msgid "The *key* can be ``None``." msgstr "*key* 可以為 ``None``。" -#: ../../library/functions.rst:1232 +#: ../../library/functions.rst:1234 msgid "" "Return a \"memory view\" object created from the given argument. See :ref:" "`typememoryview` for more information." @@ -2178,13 +2176,13 @@ msgstr "" "回傳由給定的引數所建立之「memory view(記憶體檢視)」物件。有關詳細資訊,請參" "閱\\ :ref:`typememoryview`。" -#: ../../library/functions.rst:1240 +#: ../../library/functions.rst:1242 msgid "" "Return the smallest item in an iterable or the smallest of two or more " "arguments." msgstr "回傳 iterable 中最小的元素,或者回傳兩個以上的引數中最小的。" -#: ../../library/functions.rst:1243 +#: ../../library/functions.rst:1245 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The smallest item in the iterable is returned. If two or more positional " @@ -2193,7 +2191,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是 :term:`iterable`,iterable 中最小的元素會" "被回傳。如果提供了兩個以上的位置引數,則回傳最小的位置引數。" -#: ../../library/functions.rst:1254 +#: ../../library/functions.rst:1256 msgid "" "If multiple items are minimal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2204,7 +2202,7 @@ msgstr "" "``sorted(iterable, key=keyfunc)[0]`` 和 ``heapq.nsmallest(1, iterable, " "key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1269 +#: ../../library/functions.rst:1271 msgid "" "Retrieve the next item from the :term:`iterator` by calling its :meth:" "`~iterator.__next__` method. If *default* is given, it is returned if the " @@ -2214,7 +2212,7 @@ msgstr "" "素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引發 :" "exc:`StopIteration`。" -#: ../../library/functions.rst:1276 +#: ../../library/functions.rst:1278 msgid "" "Return a new featureless object. :class:`object` is a base for all classes. " "It has methods that are common to all instances of Python classes. This " @@ -2223,15 +2221,15 @@ msgstr "" "回傳一個沒有特徵的新物件。:class:`object` 是所有 class 的基礎,它具有所有 " "Python class 實例的通用 method。這個函式不接受任何引數。" -#: ../../library/functions.rst:1282 +#: ../../library/functions.rst:1284 msgid "" -":class:`object` does *not* have a :attr:`~object.__dict__`, so you can't " -"assign arbitrary attributes to an instance of the :class:`object` class." +":class:`object` instances do *not* have :attr:`~object.__dict__` attributes, " +"so you can't assign arbitrary attributes to an instance of :class:`object`." msgstr "" -"由於 :class:`object` *沒有* :attr:`~object.__dict__`,因此無法將任意屬性賦" -"給 :class:`object` class 的實例。" +"由於 :class:`object` 實例\\ *沒有* :attr:`~object.__dict__` 屬性,因此無法將" +"任意屬性賦給 :class:`object` 的實例。" -#: ../../library/functions.rst:1288 +#: ../../library/functions.rst:1291 msgid "" "Convert an integer number to an octal string prefixed with \"0o\". The " "result is a valid Python expression. If *x* is not a Python :class:`int` " @@ -2242,7 +2240,7 @@ msgstr "" "Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" "`~object.__index__` method 回傳一個整數。舉例來說:" -#: ../../library/functions.rst:1298 +#: ../../library/functions.rst:1301 msgid "" "If you want to convert an integer number to an octal string either with the " "prefix \"0o\" or not, you can use either of the following ways." @@ -2250,7 +2248,7 @@ msgstr "" "如果要將整數轉換為八進位制字串,不論是否具備 \"0o\" 前綴,都可以使用下面的方" "法。" -#: ../../library/functions.rst:1315 +#: ../../library/functions.rst:1318 msgid "" "Open *file* and return a corresponding :term:`file object`. If the file " "cannot be opened, an :exc:`OSError` is raised. See :ref:`tut-files` for more " @@ -2260,7 +2258,7 @@ msgstr "" "啟,則引發 :exc:`OSError`。關於使用此函式的更多方法,請參閱\\ :ref:`tut-" "files`。" -#: ../../library/functions.rst:1319 +#: ../../library/functions.rst:1322 msgid "" "*file* is a :term:`path-like object` giving the pathname (absolute or " "relative to the current working directory) of the file to be opened or an " @@ -2273,7 +2271,7 @@ msgstr "" "器 (file descriptor)。(如果有給定檔案描述器,它會隨著回傳的 I/O 物件關閉而關" "閉,除非 *closefd* 被設為 ``False``。)" -#: ../../library/functions.rst:1325 +#: ../../library/functions.rst:1328 msgid "" "*mode* is an optional string that specifies the mode in which the file is " "opened. It defaults to ``'r'`` which means open for reading in text mode. " @@ -2294,71 +2292,71 @@ msgstr "" "getencoding` 來獲取當前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制模" "式且不要指定 *encoding*。)可用的模式有:" -#: ../../library/functions.rst:1342 +#: ../../library/functions.rst:1345 msgid "Character" msgstr "字元" -#: ../../library/functions.rst:1342 +#: ../../library/functions.rst:1345 msgid "Meaning" msgstr "意義" -#: ../../library/functions.rst:1344 +#: ../../library/functions.rst:1347 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/functions.rst:1344 +#: ../../library/functions.rst:1347 msgid "open for reading (default)" msgstr "讀取(預設)" -#: ../../library/functions.rst:1345 +#: ../../library/functions.rst:1348 msgid "``'w'``" msgstr "``'w'``" -#: ../../library/functions.rst:1345 +#: ../../library/functions.rst:1348 msgid "open for writing, truncating the file first" msgstr "寫入,會先清除檔案內容" -#: ../../library/functions.rst:1346 +#: ../../library/functions.rst:1349 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/functions.rst:1346 +#: ../../library/functions.rst:1349 msgid "open for exclusive creation, failing if the file already exists" msgstr "唯一性建立,如果文件已存在則會失敗" -#: ../../library/functions.rst:1347 +#: ../../library/functions.rst:1350 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/functions.rst:1347 +#: ../../library/functions.rst:1350 msgid "open for writing, appending to the end of file if it exists" msgstr "寫入,如果檔案存在則在其末端附加內容" -#: ../../library/functions.rst:1348 +#: ../../library/functions.rst:1351 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/functions.rst:1348 ../../library/functions.rst:1492 +#: ../../library/functions.rst:1351 ../../library/functions.rst:1495 msgid "binary mode" msgstr "二進制模式" -#: ../../library/functions.rst:1349 +#: ../../library/functions.rst:1352 msgid "``'t'``" msgstr "``'t'``" -#: ../../library/functions.rst:1349 +#: ../../library/functions.rst:1352 msgid "text mode (default)" msgstr "文字模式(預設)" -#: ../../library/functions.rst:1350 +#: ../../library/functions.rst:1353 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/functions.rst:1350 +#: ../../library/functions.rst:1353 msgid "open for updating (reading and writing)" msgstr "更新(讀取並寫入)" -#: ../../library/functions.rst:1353 +#: ../../library/functions.rst:1356 msgid "" "The default mode is ``'r'`` (open for reading text, a synonym of ``'rt'``). " "Modes ``'w+'`` and ``'w+b'`` open and truncate the file. Modes ``'r+'`` and " @@ -2368,7 +2366,7 @@ msgstr "" "``'w+b'`` 模式會開啟並清除檔案。``'r+'`` 和 ``'r+b'`` 模式會開啟且保留檔案內" "容。" -#: ../../library/functions.rst:1357 +#: ../../library/functions.rst:1360 msgid "" "As mentioned in the :ref:`io-overview`, Python distinguishes between binary " "and text I/O. Files opened in binary mode (including ``'b'`` in the *mode* " @@ -2384,7 +2382,7 @@ msgstr "" "``'t'``),檔案的內容會以 :class:`str` 回傳,其位元組已經先被解碼,使用的是取" "決於平台的編碼系統或是給定的 *encoding*。" -#: ../../library/functions.rst:1367 +#: ../../library/functions.rst:1370 msgid "" "Python doesn't depend on the underlying operating system's notion of text " "files; all the processing is done by Python itself, and is therefore " @@ -2393,7 +2391,7 @@ msgstr "" "Python 不會使用底層作業系統對於文字檔案的操作概念;所有的處理都是由 Python 獨" "自完成的,因此能獨立於不同平台。" -#: ../../library/functions.rst:1371 +#: ../../library/functions.rst:1374 msgid "" "*buffering* is an optional integer used to set the buffering policy. Pass 0 " "to switch buffering off (only allowed in binary mode), 1 to select line " @@ -2414,7 +2412,7 @@ msgstr "" "``write_through`` 旗標。若未給定 *buffering* 引數,則預設的緩衝策略會運作如" "下:" -#: ../../library/functions.rst:1381 +#: ../../library/functions.rst:1384 msgid "" "Binary files are buffered in fixed-size chunks; the size of the buffer is " "chosen using a heuristic trying to determine the underlying device's \"block " @@ -2426,7 +2424,7 @@ msgstr "" "DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 8192 個位元" "組。" -#: ../../library/functions.rst:1386 +#: ../../library/functions.rst:1389 msgid "" "\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` " "returns ``True``) use line buffering. Other text files use the policy " @@ -2435,7 +2433,7 @@ msgstr "" "「互動式」文字檔(:meth:`~io.IOBase.isatty` 回傳 ``True`` 的檔案)會使用列緩" "衝。其他文字檔則使用上述的二進制檔案緩衝策略。" -#: ../../library/functions.rst:1390 +#: ../../library/functions.rst:1393 msgid "" "*encoding* is the name of the encoding used to decode or encode the file. " "This should only be used in text mode. The default encoding is platform " @@ -2448,7 +2446,7 @@ msgstr "" "Python 支援的任何 :term:`text encoding`\\ (文字編碼)都是可以使用的。關於支" "援的編碼系統清單,請參閱 :mod:`codecs` module。" -#: ../../library/functions.rst:1396 +#: ../../library/functions.rst:1399 msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled—this cannot be used in binary mode. A variety of " @@ -2461,7 +2459,7 @@ msgstr "" "handlers`\\ 有列出清單),不過任何已註冊到 :func:`codecs.register_error` 的錯" "誤處理程式名稱也都是有效的。標準的名稱包括:" -#: ../../library/functions.rst:1404 +#: ../../library/functions.rst:1407 msgid "" "``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding " "error. The default value of ``None`` has the same effect." @@ -2469,20 +2467,20 @@ msgstr "" "``'strict'`` 如果發生編碼錯誤,則引發 :exc:`ValueError` 例外。預設值 " "``None`` 也有相同的效果。" -#: ../../library/functions.rst:1408 +#: ../../library/functions.rst:1411 msgid "" "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to " "data loss." msgstr "``'ignore'`` 忽略錯誤。請注意,忽略編碼錯誤可能導致資料遺失。" -#: ../../library/functions.rst:1411 +#: ../../library/functions.rst:1414 msgid "" "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted " "where there is malformed data." msgstr "" "``'replace'`` 會在格式不正確的資料位置插入一個替換標誌(像是 ``'?'``)。" -#: ../../library/functions.rst:1414 +#: ../../library/functions.rst:1417 msgid "" "``'surrogateescape'`` will represent any incorrect bytes as low surrogate " "code units ranging from U+DC80 to U+DCFF. These surrogate code units will " @@ -2495,7 +2493,7 @@ msgstr "" "被還原回 ``surrogateescape`` 錯誤處理程式當時所處理的那些相同位元組。這對於處" "理未知編碼方式的檔案會很好用。" -#: ../../library/functions.rst:1421 +#: ../../library/functions.rst:1424 msgid "" "``'xmlcharrefreplace'`` is only supported when writing to a file. Characters " "not supported by the encoding are replaced with the appropriate XML " @@ -2504,7 +2502,7 @@ msgstr "" "``'xmlcharrefreplace'`` 僅在寫入檔案時可支援。編碼系統不支援的字元會被替換為" "適當的 XML 字元參考 (character reference) ``&#nnn;``。" -#: ../../library/functions.rst:1425 +#: ../../library/functions.rst:1428 msgid "" "``'backslashreplace'`` replaces malformed data by Python's backslashed " "escape sequences." @@ -2512,7 +2510,7 @@ msgstr "" "``'backslashreplace'`` 會用 Python 的反斜線跳脫序列 (backslashed escape " "sequence) 替換格式不正確的資料。" -#: ../../library/functions.rst:1428 +#: ../../library/functions.rst:1431 msgid "" "``'namereplace'`` (also only supported when writing) replaces unsupported " "characters with ``\\N{...}`` escape sequences." @@ -2520,7 +2518,7 @@ msgstr "" "``'namereplace'``\\ (也僅在寫入時支援)會將不支援的字元替換為 ``\\N{...}`` " "跳脫序列。" -#: ../../library/functions.rst:1436 +#: ../../library/functions.rst:1439 msgid "" "*newline* determines how to parse newline characters from the stream. It can " "be ``None``, ``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as " @@ -2529,7 +2527,7 @@ msgstr "" "*newline* 會決定如何剖析資料串流 (stream) 中的換行字元。它可以是 ``None``、" "``''``、``'\\n'``、``'\\r'`` 或 ``'\\r\\n'``。它的運作規則如下:" -#: ../../library/functions.rst:1440 +#: ../../library/functions.rst:1443 msgid "" "When reading input from the stream, if *newline* is ``None``, universal " "newlines mode is enabled. Lines in the input can end in ``'\\n'``, " @@ -2545,7 +2543,7 @@ msgstr "" "傳給呼叫方時,行尾符號不會被轉換。如果它是任何其他有效的值,則輸入資料的行只" "會由給定的字串做結尾,且在回傳給呼叫方時,行尾符號不會被轉換。" -#: ../../library/functions.rst:1448 +#: ../../library/functions.rst:1451 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -2558,7 +2556,7 @@ msgstr "" "``''`` 或 ``'\\n'``,則不做任何轉換。如果 *newline* 是任何其他有效的值,則寫" "入的任何 ``'\\n'`` 字元都將轉換為給定的字串。" -#: ../../library/functions.rst:1454 +#: ../../library/functions.rst:1457 msgid "" "If *closefd* is ``False`` and a file descriptor rather than a filename was " "given, the underlying file descriptor will be kept open when the file is " @@ -2569,7 +2567,7 @@ msgstr "" "則當檔案關閉時,底層的檔案描述器會保持開啟狀態。如果有給定一個檔名,則 " "*closefd* 必須是 ``True``\\ (預設值);否則將引發錯誤。" -#: ../../library/functions.rst:1459 +#: ../../library/functions.rst:1462 msgid "" "A custom opener can be used by passing a callable as *opener*. The " "underlying file descriptor for the file object is then obtained by calling " @@ -2582,11 +2580,11 @@ msgstr "" "必須回傳一個開啟的檔案描述器(將 :mod:`os.open` 作為 *opener* 傳入,在功能上" "的結果會相當於傳入 ``None``)。" -#: ../../library/functions.rst:1465 +#: ../../library/functions.rst:1468 msgid "The newly created file is :ref:`non-inheritable `." msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" -#: ../../library/functions.rst:1467 +#: ../../library/functions.rst:1470 msgid "" "The following example uses the :ref:`dir_fd ` parameter of the :func:" "`os.open` function to open a file relative to a given directory::" @@ -2594,7 +2592,7 @@ msgstr "" "下面的範例使用 :func:`os.open` 函式回傳值當作 :ref:`dir_fd ` 的參數," "從給定的目錄中用相對路徑開啟檔案: ::" -#: ../../library/functions.rst:1470 +#: ../../library/functions.rst:1473 msgid "" ">>> import os\n" ">>> dir_fd = os.open('somedir', os.O_RDONLY)\n" @@ -2607,7 +2605,7 @@ msgid "" ">>> os.close(dir_fd) # don't leak a file descriptor" msgstr "" -#: ../../library/functions.rst:1480 +#: ../../library/functions.rst:1483 msgid "" "The type of :term:`file object` returned by the :func:`open` function " "depends on the mode. When :func:`open` is used to open a file in a text " @@ -2631,7 +2629,7 @@ msgstr "" "BufferedRandom`。當緩衝被停用時,會回傳原始資料串流 :class:`io.FileIO`,它" "是 :class:`io.RawIOBase` 的一個 subclass。" -#: ../../library/functions.rst:1501 +#: ../../library/functions.rst:1504 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " "(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" @@ -2641,7 +2639,7 @@ msgstr "" "`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以及 :mod:" "`shutil`。" -#: ../../library/functions.rst:1505 +#: ../../library/functions.rst:1508 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." @@ -2649,25 +2647,25 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " "` ``open``。" -#: ../../library/functions.rst:1507 +#: ../../library/functions.rst:1510 msgid "" "The ``mode`` and ``flags`` arguments may have been modified or inferred from " "the original call." msgstr "``mode`` 和 ``flags`` 引數可能會被原始的呼叫所修改或推論 (infer)。" -#: ../../library/functions.rst:1512 +#: ../../library/functions.rst:1515 msgid "The *opener* parameter was added." msgstr "增加了 *opener* 參數。" -#: ../../library/functions.rst:1513 +#: ../../library/functions.rst:1516 msgid "The ``'x'`` mode was added." msgstr "增加了 ``'x'`` 模式。" -#: ../../library/functions.rst:1514 +#: ../../library/functions.rst:1517 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "過去引發的 :exc:`IOError`,現在是 :exc:`OSError` 的別名。" -#: ../../library/functions.rst:1515 +#: ../../library/functions.rst:1518 msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." @@ -2675,11 +2673,11 @@ msgstr "" "如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引發 :exc:" "`FileExistsError`。" -#: ../../library/functions.rst:1520 +#: ../../library/functions.rst:1523 msgid "The file is now non-inheritable." msgstr "檔案在此版本開始是不可繼承的。" -#: ../../library/functions.rst:1524 +#: ../../library/functions.rst:1527 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 :" @@ -2688,15 +2686,15 @@ msgstr "" "如果系統呼叫被中斷,但訊號處理程式沒有引發例外,此函式現在會重試系統呼叫,而" "不是引發 :exc:`InterruptedError` 例外(原因詳見 :pep:`475`)。" -#: ../../library/functions.rst:1527 +#: ../../library/functions.rst:1530 msgid "The ``'namereplace'`` error handler was added." msgstr "增加了 ``'namereplace'`` 錯誤處理程式。" -#: ../../library/functions.rst:1531 +#: ../../library/functions.rst:1534 msgid "Support added to accept objects implementing :class:`os.PathLike`." msgstr "增加對於實作 :class:`os.PathLike` 物件的支援。" -#: ../../library/functions.rst:1532 +#: ../../library/functions.rst:1535 msgid "" "On Windows, opening a console buffer may return a subclass of :class:`io." "RawIOBase` other than :class:`io.FileIO`." @@ -2704,11 +2702,11 @@ msgstr "" "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " "subclass,而不是 :class:`io.FileIO`。" -#: ../../library/functions.rst:1535 +#: ../../library/functions.rst:1538 msgid "The ``'U'`` mode has been removed." msgstr "``'U'`` 模式被移除。" -#: ../../library/functions.rst:1540 +#: ../../library/functions.rst:1543 msgid "" "Given a string representing one Unicode character, return an integer " "representing the Unicode code point of that character. For example, " @@ -2719,7 +2717,7 @@ msgstr "" "``ord('a')`` 回傳整數 ``97``、``ord('€')``\\ (歐元符號)回傳 ``8364``。這" "是 :func:`chr` 的逆函式。" -#: ../../library/functions.rst:1548 +#: ../../library/functions.rst:1551 msgid "" "Return *base* to the power *exp*; if *mod* is present, return *base* to the " "power *exp*, modulo *mod* (computed more efficiently than ``pow(base, exp) % " @@ -2730,8 +2728,7 @@ msgstr "" "*mod* 取餘數(比直接呼叫 ``pow(base, exp) % mod`` 計算更高效)。兩個引數形式" "的 ``pow(exp, exp)`` 等價於次方運算子:``base**exp``。" -#: ../../library/functions.rst:1553 -#, fuzzy +#: ../../library/functions.rst:1556 msgid "" "The arguments must have numeric types. With mixed operand types, the " "coercion rules for binary arithmetic operators apply. For :class:`int` " @@ -2745,15 +2742,17 @@ msgid "" "`float` with an integral exponent, a float result is delivered. For example, " "``pow(-9, 2.0)`` returns ``81.0``." msgstr "" -"引數必須是數值型別。對於不同型別的運算元,會套用二元算術運算子的強制轉型 " +"引數必須是數值型別。對於混合型別的運算元,會套用二元算術運算子的強制轉型 " "(coercion) 規則。對於 :class:`int` 運算元,運算結果會(在強制轉型後)與運算元" "的型別相同,除非第二個引數是負數;在這種情況下,所有的引數都會被轉換為浮點數" "並得到浮點數的結果。例如,``pow(10, 2)`` 會回傳 ``100``,但 ``pow(10, -2)`` " "會回傳 ``0.01``。如果底數 (base) 是型別為 :class:`int` 或 :class:`float` 的負" -"數,且指數 (exponent) 不是整數,則會得到一個複數的結果。例如,``pow(-9, " -"0.5)`` 會回傳一個接近 ``3j`` 的值。" +"數且指數 (exponent) 不是整數,則會得到一個複數的結果,例如 ``pow(-9, 0.5)`` " +"會回傳一個接近 ``3j`` 的值。如果底數 (base) 是型別為 :class:`int` 或 :class:" +"`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 ``pow(-9, 2.0)`` " +"會回傳 ``81.0``。" -#: ../../library/functions.rst:1565 +#: ../../library/functions.rst:1568 msgid "" "For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must " "also be of integer type and *mod* must be nonzero. If *mod* is present and " @@ -2766,11 +2765,11 @@ msgstr "" "與 *mod* 互質。在這種情況下,會回傳 ``pow(inv_base, -exp, mod)``,其中 " "*inv_base* 是 *base* 對 *mod* 的模倒數 (inverse modulo)。" -#: ../../library/functions.rst:1571 +#: ../../library/functions.rst:1574 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" msgstr "以下是一個計算 ``38`` 對 ``97`` 取模倒數的範例: ::" -#: ../../library/functions.rst:1573 +#: ../../library/functions.rst:1576 msgid "" ">>> pow(38, -1, mod=97)\n" "23\n" @@ -2782,7 +2781,7 @@ msgstr "" ">>> 23 * 38 % 97 == 1\n" "True" -#: ../../library/functions.rst:1578 +#: ../../library/functions.rst:1581 msgid "" "For :class:`int` operands, the three-argument form of ``pow`` now allows the " "second argument to be negative, permitting computation of modular inverses." @@ -2790,12 +2789,12 @@ msgstr "" "對於 :class:`int` 運算元,現在 ``pow`` 的三引數形式允許第二個引數為負數,也容" "許模倒數的計算。" -#: ../../library/functions.rst:1583 +#: ../../library/functions.rst:1586 msgid "" "Allow keyword arguments. Formerly, only positional arguments were supported." msgstr "允許關鍵字引數。在此之前只支援位置引數。" -#: ../../library/functions.rst:1590 +#: ../../library/functions.rst:1593 msgid "" "Print *objects* to the text stream *file*, separated by *sep* and followed " "by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as " @@ -2804,7 +2803,7 @@ msgstr "" "將 *objects* 列印到文字資料串流 *file*,用 *sep* 分隔並以 *end* 結尾。如果有" "給定 *sep*、*end*、*file* 和 *flush*,那麼它們必須是關鍵字引數的形式。" -#: ../../library/functions.rst:1594 +#: ../../library/functions.rst:1597 msgid "" "All non-keyword arguments are converted to strings like :func:`str` does and " "written to the stream, separated by *sep* and followed by *end*. Both *sep* " @@ -2817,7 +2816,7 @@ msgstr "" "以是 ``None``,這表示使用預設值。如果沒有給定 *objects*,:func:`print` 就只會" "寫入 *end*。" -#: ../../library/functions.rst:1600 +#: ../../library/functions.rst:1603 msgid "" "The *file* argument must be an object with a ``write(string)`` method; if it " "is not present or ``None``, :data:`sys.stdout` will be used. Since printed " @@ -2829,7 +2828,7 @@ msgstr "" "串,所以 :func:`print` 不能用於二進位模式的檔案物件。對於此類物件,請改用 " "``file.write(...)``。" -#: ../../library/functions.rst:1605 +#: ../../library/functions.rst:1608 msgid "" "Output buffering is usually determined by *file*. However, if *flush* is " "true, the stream is forcibly flushed." @@ -2837,15 +2836,15 @@ msgstr "" "輸出緩衝通常會由 *file* 決定。但是如果 *flush* 為 true,則資料串流會被強制清" "除。" -#: ../../library/functions.rst:1609 +#: ../../library/functions.rst:1612 msgid "Added the *flush* keyword argument." msgstr "增加了 *flush* 關鍵字引數。" -#: ../../library/functions.rst:1615 +#: ../../library/functions.rst:1618 msgid "Return a property attribute." msgstr "回傳 property 屬性。" -#: ../../library/functions.rst:1617 +#: ../../library/functions.rst:1620 msgid "" "*fget* is a function for getting an attribute value. *fset* is a function " "for setting an attribute value. *fdel* is a function for deleting an " @@ -2854,11 +2853,11 @@ msgstr "" "*fget* 是一個用於取得屬性值的函式,*fset* 是一個用於設定屬性值的函式,*fdel* " "是一個用於刪除屬性值的函式,而 *doc* 會為該屬性建立一個說明字串。" -#: ../../library/functions.rst:1621 +#: ../../library/functions.rst:1624 msgid "A typical use is to define a managed attribute ``x``::" msgstr "一個典型的用途是定義一個受管理的屬性 ``x``: ::" -#: ../../library/functions.rst:1623 +#: ../../library/functions.rst:1626 msgid "" "class C:\n" " def __init__(self):\n" @@ -2890,7 +2889,7 @@ msgstr "" "\n" " x = property(getx, setx, delx, \"I'm the 'x' property.\")" -#: ../../library/functions.rst:1638 +#: ../../library/functions.rst:1641 msgid "" "If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = " "value`` will invoke the setter, and ``del c.x`` the deleter." @@ -2898,7 +2897,7 @@ msgstr "" "如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會呼叫取得器 (getter),``c.x = " "value`` 會呼叫設定器 (setter),而 ``del c.x`` 會呼叫刪除器 (deleter)。" -#: ../../library/functions.rst:1641 +#: ../../library/functions.rst:1644 msgid "" "If given, *doc* will be the docstring of the property attribute. Otherwise, " "the property will copy *fget*'s docstring (if it exists). This makes it " @@ -2909,7 +2908,7 @@ msgstr "" "*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使用 :func:" "`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" -#: ../../library/functions.rst:1645 +#: ../../library/functions.rst:1648 msgid "" "class Parrot:\n" " def __init__(self):\n" @@ -2921,14 +2920,14 @@ msgid "" " return self._voltage" msgstr "" -#: ../../library/functions.rst:1654 +#: ../../library/functions.rst:1657 msgid "" "The ``@property`` decorator turns the :meth:`!voltage` method into a " "\"getter\" for a read-only attribute with the same name, and it sets the " "docstring for *voltage* to \"Get the current voltage.\"" msgstr "" -#: ../../library/functions.rst:1662 +#: ../../library/functions.rst:1665 msgid "" "A property object has ``getter``, ``setter``, and ``deleter`` methods usable " "as decorators that create a copy of the property with the corresponding " @@ -2936,7 +2935,7 @@ msgid "" "with an example:" msgstr "" -#: ../../library/functions.rst:1667 +#: ../../library/functions.rst:1670 msgid "" "class C:\n" " def __init__(self):\n" @@ -2972,36 +2971,36 @@ msgstr "" " def x(self):\n" " del self._x" -#: ../../library/functions.rst:1686 +#: ../../library/functions.rst:1689 msgid "" "This code is exactly equivalent to the first example. Be sure to give the " "additional functions the same name as the original property (``x`` in this " "case.)" msgstr "" -#: ../../library/functions.rst:1690 +#: ../../library/functions.rst:1693 msgid "" "The returned property object also has the attributes ``fget``, ``fset``, and " "``fdel`` corresponding to the constructor arguments." msgstr "" -#: ../../library/functions.rst:1693 +#: ../../library/functions.rst:1696 msgid "The docstrings of property objects are now writeable." msgstr "" -#: ../../library/functions.rst:1698 +#: ../../library/functions.rst:1701 msgid "" "Attribute holding the name of the property. The name of the property can be " "changed at runtime." msgstr "" -#: ../../library/functions.rst:1709 +#: ../../library/functions.rst:1712 msgid "" "Rather than being a function, :class:`range` is actually an immutable " "sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:1715 +#: ../../library/functions.rst:1718 msgid "" "Return a string containing a printable representation of an object. For " "many types, this function makes an attempt to return a string that would " @@ -3014,11 +3013,11 @@ msgid "" "raise :exc:`RuntimeError`." msgstr "" -#: ../../library/functions.rst:1726 +#: ../../library/functions.rst:1729 msgid "This class has a custom representation that can be evaluated::" msgstr "" -#: ../../library/functions.rst:1728 +#: ../../library/functions.rst:1731 msgid "" "class Person:\n" " def __init__(self, name, age):\n" @@ -3036,7 +3035,7 @@ msgstr "" " def __repr__(self):\n" " return f\"Person('{self.name}', {self.age})\"" -#: ../../library/functions.rst:1739 +#: ../../library/functions.rst:1742 msgid "" "Return a reverse :term:`iterator`. *seq* must be an object which has a :" "meth:`~object.__reversed__` method or supports the sequence protocol (the :" @@ -3044,14 +3043,14 @@ msgid "" "with integer arguments starting at ``0``)." msgstr "" -#: ../../library/functions.rst:1747 +#: ../../library/functions.rst:1750 msgid "" "Return *number* rounded to *ndigits* precision after the decimal point. If " "*ndigits* is omitted or is ``None``, it returns the nearest integer to its " "input." msgstr "" -#: ../../library/functions.rst:1751 +#: ../../library/functions.rst:1754 msgid "" "For the built-in types supporting :func:`round`, values are rounded to the " "closest multiple of 10 to the power minus *ndigits*; if two multiples are " @@ -3062,13 +3061,13 @@ msgid "" "``None``. Otherwise, the return value has the same type as *number*." msgstr "" -#: ../../library/functions.rst:1760 +#: ../../library/functions.rst:1763 msgid "" "For a general Python object ``number``, ``round`` delegates to ``number." "__round__``." msgstr "" -#: ../../library/functions.rst:1765 +#: ../../library/functions.rst:1768 msgid "" "The behavior of :func:`round` for floats can be surprising: for example, " "``round(2.675, 2)`` gives ``2.67`` instead of the expected ``2.68``. This is " @@ -3077,21 +3076,21 @@ msgid "" "information." msgstr "" -#: ../../library/functions.rst:1777 +#: ../../library/functions.rst:1780 msgid "" "Return a new :class:`set` object, optionally with elements taken from " "*iterable*. ``set`` is a built-in class. See :class:`set` and :ref:`types-" "set` for documentation about this class." msgstr "" -#: ../../library/functions.rst:1781 +#: ../../library/functions.rst:1784 msgid "" "For other containers see the built-in :class:`frozenset`, :class:`list`, :" "class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` " "module." msgstr "" -#: ../../library/functions.rst:1788 +#: ../../library/functions.rst:1791 msgid "" "This is the counterpart of :func:`getattr`. The arguments are an object, a " "string, and an arbitrary value. The string may name an existing attribute " @@ -3100,7 +3099,7 @@ msgid "" "is equivalent to ``x.foobar = 123``." msgstr "" -#: ../../library/functions.rst:1794 +#: ../../library/functions.rst:1797 msgid "" "*name* need not be a Python identifier as defined in :ref:`identifiers` " "unless the object chooses to enforce that, for example in a custom :meth:" @@ -3109,21 +3108,21 @@ msgid "" "notation, but is accessible through :func:`getattr` etc.." msgstr "" -#: ../../library/functions.rst:1802 +#: ../../library/functions.rst:1805 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " "with two leading underscores) name in order to set it with :func:`setattr`." msgstr "" -#: ../../library/functions.rst:1811 +#: ../../library/functions.rst:1814 msgid "" "Return a :term:`slice` object representing the set of indices specified by " "``range(start, stop, step)``. The *start* and *step* arguments default to " "``None``." msgstr "" -#: ../../library/functions.rst:1819 +#: ../../library/functions.rst:1822 msgid "" "Slice objects have read-only data attributes :attr:`!start`, :attr:`!stop`, " "and :attr:`!step` which merely return the argument values (or their " @@ -3131,48 +3130,48 @@ msgid "" "by NumPy and other third-party packages." msgstr "" -#: ../../library/functions.rst:1824 +#: ../../library/functions.rst:1827 msgid "" "Slice objects are also generated when extended indexing syntax is used. For " "example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See :func:" "`itertools.islice` for an alternate version that returns an :term:`iterator`." msgstr "" -#: ../../library/functions.rst:1829 +#: ../../library/functions.rst:1832 msgid "" "Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:" "`~slice.stop`, and :attr:`~slice.step` are hashable)." msgstr "" -#: ../../library/functions.rst:1835 +#: ../../library/functions.rst:1838 msgid "Return a new sorted list from the items in *iterable*." msgstr "" -#: ../../library/functions.rst:1837 +#: ../../library/functions.rst:1840 msgid "" "Has two optional arguments which must be specified as keyword arguments." msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" -#: ../../library/functions.rst:1839 +#: ../../library/functions.rst:1842 msgid "" "*key* specifies a function of one argument that is used to extract a " "comparison key from each element in *iterable* (for example, ``key=str." "lower``). The default value is ``None`` (compare the elements directly)." msgstr "" -#: ../../library/functions.rst:1843 +#: ../../library/functions.rst:1846 msgid "" "*reverse* is a boolean value. If set to ``True``, then the list elements " "are sorted as if each comparison were reversed." msgstr "" -#: ../../library/functions.rst:1846 +#: ../../library/functions.rst:1849 msgid "" "Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a " "*key* function." msgstr "" -#: ../../library/functions.rst:1849 +#: ../../library/functions.rst:1852 msgid "" "The built-in :func:`sorted` function is guaranteed to be stable. A sort is " "stable if it guarantees not to change the relative order of elements that " @@ -3180,7 +3179,7 @@ msgid "" "example, sort by department, then by salary grade)." msgstr "" -#: ../../library/functions.rst:1854 +#: ../../library/functions.rst:1857 msgid "" "The sort algorithm uses only ``<`` comparisons between items. While " "defining an :meth:`~object.__lt__` method will suffice for sorting, :PEP:`8` " @@ -3192,22 +3191,22 @@ msgid "" "method." msgstr "" -#: ../../library/functions.rst:1863 +#: ../../library/functions.rst:1866 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -#: ../../library/functions.rst:1867 +#: ../../library/functions.rst:1870 msgid "Transform a method into a static method." msgstr "" -#: ../../library/functions.rst:1869 +#: ../../library/functions.rst:1872 msgid "" "A static method does not receive an implicit first argument. To declare a " "static method, use this idiom::" msgstr "" -#: ../../library/functions.rst:1872 +#: ../../library/functions.rst:1875 msgid "" "class C:\n" " @staticmethod\n" @@ -3217,7 +3216,7 @@ msgstr "" " @staticmethod\n" " def f(arg1, arg2, argN): ..." -#: ../../library/functions.rst:1876 +#: ../../library/functions.rst:1879 msgid "" "The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" "`function` for details." @@ -3225,7 +3224,7 @@ msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" -#: ../../library/functions.rst:1879 +#: ../../library/functions.rst:1882 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " "an instance (such as ``C().f()``). Moreover, the static method :term:" @@ -3233,14 +3232,14 @@ msgid "" "(such as ``f()``)." msgstr "" -#: ../../library/functions.rst:1884 +#: ../../library/functions.rst:1887 msgid "" "Static methods in Python are similar to those found in Java or C++. Also, " "see :func:`classmethod` for a variant that is useful for creating alternate " "class constructors." msgstr "" -#: ../../library/functions.rst:1888 +#: ../../library/functions.rst:1891 msgid "" "Like all decorators, it is also possible to call ``staticmethod`` as a " "regular function and do something with its result. This is needed in some " @@ -3249,7 +3248,7 @@ msgid "" "cases, use this idiom::" msgstr "" -#: ../../library/functions.rst:1894 +#: ../../library/functions.rst:1897 msgid "" "def regular_function():\n" " ...\n" @@ -3263,36 +3262,41 @@ msgstr "" "class C:\n" " method = staticmethod(regular_function)" -#: ../../library/functions.rst:1900 +#: ../../library/functions.rst:1903 msgid "For more information on static methods, see :ref:`types`." msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" -#: ../../library/functions.rst:1902 +#: ../../library/functions.rst:1905 msgid "" -"Static methods now inherit the method attributes (``__module__``, " -"``__name__``, ``__qualname__``, ``__doc__`` and ``__annotations__``), have a " -"new ``__wrapped__`` attribute, and are now callable as regular functions." +"Static methods now inherit the method attributes (:attr:`~function." +"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" +"attr:`~function.__doc__` and :attr:`~function.__annotations__`), have a new " +"``__wrapped__`` attribute, and are now callable as regular functions." msgstr "" +"Static method 現在繼承了 method 屬性(:attr:`~function.__module__`、:attr:" +"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." +"__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " +"``__wrapped__`` 屬性,且為如一般函式的可呼叫物件。" -#: ../../library/functions.rst:1917 +#: ../../library/functions.rst:1921 msgid "" "Return a :class:`str` version of *object*. See :func:`str` for details." msgstr "" -#: ../../library/functions.rst:1919 +#: ../../library/functions.rst:1923 msgid "" "``str`` is the built-in string :term:`class`. For general information about " "strings, see :ref:`textseq`." msgstr "" -#: ../../library/functions.rst:1925 +#: ../../library/functions.rst:1929 msgid "" "Sums *start* and the items of an *iterable* from left to right and returns " "the total. The *iterable*'s items are normally numbers, and the start value " "is not allowed to be a string." msgstr "" -#: ../../library/functions.rst:1929 +#: ../../library/functions.rst:1933 msgid "" "For some use cases, there are good alternatives to :func:`sum`. The " "preferred, fast way to concatenate a sequence of strings is by calling ``''." @@ -3301,45 +3305,45 @@ msgid "" "using :func:`itertools.chain`." msgstr "" -#: ../../library/functions.rst:1935 +#: ../../library/functions.rst:1939 msgid "The *start* parameter can be specified as a keyword argument." msgstr "*start* 參數可被指定為關鍵字引數。" -#: ../../library/functions.rst:1938 +#: ../../library/functions.rst:1942 msgid "" "Summation of floats switched to an algorithm that gives higher accuracy and " "better commutativity on most builds." msgstr "" -#: ../../library/functions.rst:1945 +#: ../../library/functions.rst:1949 msgid "" "Return a proxy object that delegates method calls to a parent or sibling " "class of *type*. This is useful for accessing inherited methods that have " "been overridden in a class." msgstr "" -#: ../../library/functions.rst:1949 +#: ../../library/functions.rst:1953 msgid "" "The *object_or_type* determines the :term:`method resolution order` to be " "searched. The search starts from the class right after the *type*." msgstr "" -#: ../../library/functions.rst:1953 +#: ../../library/functions.rst:1957 msgid "" -"For example, if :attr:`~class.__mro__` of *object_or_type* is ``D -> B -> C -" +"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C -" "> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" -#: ../../library/functions.rst:1957 +#: ../../library/functions.rst:1961 msgid "" -"The :attr:`~class.__mro__` attribute of the class corresponding to " +"The :attr:`~type.__mro__` attribute of the class corresponding to " "*object_or_type* lists the method resolution search order used by both :func:" "`getattr` and :func:`super`. The attribute is dynamic and can change " "whenever the inheritance hierarchy is updated." msgstr "" -#: ../../library/functions.rst:1962 +#: ../../library/functions.rst:1966 msgid "" "If the second argument is omitted, the super object returned is unbound. If " "the second argument is an object, ``isinstance(obj, type)`` must be true. " @@ -3347,7 +3351,7 @@ msgid "" "(this is useful for classmethods)." msgstr "" -#: ../../library/functions.rst:1967 +#: ../../library/functions.rst:1971 msgid "" "When called directly within an ordinary method of a class, both arguments " "may be omitted (\"zero-argument :func:`!super`\"). In this case, *type* will " @@ -3357,7 +3361,7 @@ msgid "" "including generator expressions, which implicitly create nested functions.)" msgstr "" -#: ../../library/functions.rst:1974 +#: ../../library/functions.rst:1978 msgid "" "There are two typical use cases for *super*. In a class hierarchy with " "single inheritance, *super* can be used to refer to parent classes without " @@ -3365,7 +3369,7 @@ msgid "" "closely parallels the use of *super* in other programming languages." msgstr "" -#: ../../library/functions.rst:1979 +#: ../../library/functions.rst:1983 msgid "" "The second use case is to support cooperative multiple inheritance in a " "dynamic execution environment. This use case is unique to Python and is not " @@ -3378,11 +3382,11 @@ msgid "" "classes that are unknown prior to runtime)." msgstr "" -#: ../../library/functions.rst:1989 +#: ../../library/functions.rst:1993 msgid "For both use cases, a typical superclass call looks like this::" msgstr "" -#: ../../library/functions.rst:1991 +#: ../../library/functions.rst:1995 msgid "" "class C(B):\n" " def method(self, arg):\n" @@ -3390,14 +3394,14 @@ msgid "" " # super(C, self).method(arg)" msgstr "" -#: ../../library/functions.rst:1996 +#: ../../library/functions.rst:2000 msgid "" "In addition to method lookups, :func:`super` also works for attribute " "lookups. One possible use case for this is calling :term:`descriptors " "` in a parent or sibling class." msgstr "" -#: ../../library/functions.rst:2000 +#: ../../library/functions.rst:2004 msgid "" "Note that :func:`super` is implemented as part of the binding process for " "explicit dotted attribute lookups such as ``super().__getitem__(name)``. It " @@ -3407,7 +3411,7 @@ msgid "" "using statements or operators such as ``super()[name]``." msgstr "" -#: ../../library/functions.rst:2008 +#: ../../library/functions.rst:2012 msgid "" "Also note that, aside from the zero argument form, :func:`super` is not " "limited to use inside methods. The two argument form specifies the " @@ -3417,50 +3421,60 @@ msgid "" "accessing the current instance for ordinary methods." msgstr "" -#: ../../library/functions.rst:2015 +#: ../../library/functions.rst:2019 msgid "" "For practical suggestions on how to design cooperative classes using :func:" "`super`, see `guide to using super() `_." msgstr "" -#: ../../library/functions.rst:2025 +#: ../../library/functions.rst:2029 msgid "" "Rather than being a function, :class:`tuple` is actually an immutable " "sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:2034 +#: ../../library/functions.rst:2038 msgid "" "With one argument, return the type of an *object*. The return value is a " "type object and generally the same object as returned by :attr:`object." -"__class__ `." +"__class__`." msgstr "" -#: ../../library/functions.rst:2038 +#: ../../library/functions.rst:2042 msgid "" "The :func:`isinstance` built-in function is recommended for testing the type " "of an object, because it takes subclasses into account." msgstr "" -#: ../../library/functions.rst:2042 +#: ../../library/functions.rst:2045 msgid "" "With three arguments, return a new type object. This is essentially a " "dynamic form of the :keyword:`class` statement. The *name* string is the " -"class name and becomes the :attr:`~definition.__name__` attribute. The " -"*bases* tuple contains the base classes and becomes the :attr:`~class." -"__bases__` attribute; if empty, :class:`object`, the ultimate base of all " -"classes, is added. The *dict* dictionary contains attribute and method " -"definitions for the class body; it may be copied or wrapped before becoming " -"the :attr:`~object.__dict__` attribute. The following two statements create " -"identical :class:`type` objects:" +"class name and becomes the :attr:`~type.__name__` attribute. The *bases* " +"tuple contains the base classes and becomes the :attr:`~type.__bases__` " +"attribute; if empty, :class:`object`, the ultimate base of all classes, is " +"added. The *dict* dictionary contains attribute and method definitions for " +"the class body; it may be copied or wrapped before becoming the :attr:`~type." +"__dict__` attribute. The following two statements create identical :class:`!" +"type` objects:" msgstr "" -#: ../../library/functions.rst:2057 -msgid "See also :ref:`bltin-type-objects`." -msgstr "另請參閱 :ref:`bltin-type-objects`。" +#: ../../library/functions.rst:2060 +msgid "See also:" +msgstr "" -#: ../../library/functions.rst:2059 +#: ../../library/functions.rst:2062 +msgid "" +":ref:`Documentation on attributes and methods on classes `." +msgstr "" + +#: ../../library/functions.rst:2063 +msgid ":ref:`bltin-type-objects`" +msgstr ":ref:`bltin-type-objects`" + +#: ../../library/functions.rst:2065 msgid "" "Keyword arguments provided to the three argument form are passed to the " "appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`) " @@ -3468,58 +3482,58 @@ msgid "" "would." msgstr "" -#: ../../library/functions.rst:2064 +#: ../../library/functions.rst:2070 msgid "See also :ref:`class-customization`." msgstr "另請參閱 :ref:`class-customization`。" -#: ../../library/functions.rst:2066 +#: ../../library/functions.rst:2072 msgid "" -"Subclasses of :class:`type` which don't override ``type.__new__`` may no " +"Subclasses of :class:`!type` which don't override ``type.__new__`` may no " "longer use the one-argument form to get the type of an object." msgstr "" -#: ../../library/functions.rst:2073 +#: ../../library/functions.rst:2079 msgid "" "Return the :attr:`~object.__dict__` attribute for a module, class, instance, " -"or any other object with a :attr:`~object.__dict__` attribute." +"or any other object with a :attr:`!__dict__` attribute." msgstr "" -#: ../../library/functions.rst:2076 +#: ../../library/functions.rst:2082 msgid "" "Objects such as modules and instances have an updateable :attr:`~object." "__dict__` attribute; however, other objects may have write restrictions on " -"their :attr:`~object.__dict__` attributes (for example, classes use a :class:" -"`types.MappingProxyType` to prevent direct dictionary updates)." +"their :attr:`!__dict__` attributes (for example, classes use a :class:`types." +"MappingProxyType` to prevent direct dictionary updates)." msgstr "" -#: ../../library/functions.rst:2081 +#: ../../library/functions.rst:2087 msgid "Without an argument, :func:`vars` acts like :func:`locals`." msgstr "" -#: ../../library/functions.rst:2083 +#: ../../library/functions.rst:2089 msgid "" "A :exc:`TypeError` exception is raised if an object is specified but it " "doesn't have a :attr:`~object.__dict__` attribute (for example, if its class " "defines the :attr:`~object.__slots__` attribute)." msgstr "" -#: ../../library/functions.rst:2089 +#: ../../library/functions.rst:2095 msgid "" "The result of calling this function without an argument has been updated as " "described for the :func:`locals` builtin." msgstr "" -#: ../../library/functions.rst:2095 +#: ../../library/functions.rst:2101 msgid "" "Iterate over several iterables in parallel, producing tuples with an item " "from each one." msgstr "" -#: ../../library/functions.rst:2098 +#: ../../library/functions.rst:2104 msgid "Example::" msgstr "例如: ::" -#: ../../library/functions.rst:2100 +#: ../../library/functions.rst:2106 msgid "" ">>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):\n" "... print(item)\n" @@ -3535,27 +3549,27 @@ msgstr "" "(2, 'spice')\n" "(3, 'everything nice')" -#: ../../library/functions.rst:2107 +#: ../../library/functions.rst:2113 msgid "" "More formally: :func:`zip` returns an iterator of tuples, where the *i*-th " "tuple contains the *i*-th element from each of the argument iterables." msgstr "" -#: ../../library/functions.rst:2110 +#: ../../library/functions.rst:2116 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " "columns into rows. This is similar to `transposing a matrix `_." msgstr "" -#: ../../library/functions.rst:2114 +#: ../../library/functions.rst:2120 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " "iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" "`list`." msgstr "" -#: ../../library/functions.rst:2118 +#: ../../library/functions.rst:2124 msgid "" "One thing to consider is that the iterables passed to :func:`zip` could have " "different lengths; sometimes by design, and sometimes because of a bug in " @@ -3563,14 +3577,14 @@ msgid "" "approaches to dealing with this issue:" msgstr "" -#: ../../library/functions.rst:2123 +#: ../../library/functions.rst:2129 msgid "" "By default, :func:`zip` stops when the shortest iterable is exhausted. It " "will ignore the remaining items in the longer iterables, cutting off the " "result to the length of the shortest iterable::" msgstr "" -#: ../../library/functions.rst:2127 +#: ../../library/functions.rst:2133 msgid "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" @@ -3578,14 +3592,14 @@ msgstr "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" -#: ../../library/functions.rst:2130 +#: ../../library/functions.rst:2136 msgid "" ":func:`zip` is often used in cases where the iterables are assumed to be of " "equal length. In such cases, it's recommended to use the ``strict=True`` " "option. Its output is the same as regular :func:`zip`::" msgstr "" -#: ../../library/functions.rst:2134 +#: ../../library/functions.rst:2140 msgid "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" @@ -3593,37 +3607,37 @@ msgstr "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" -#: ../../library/functions.rst:2137 +#: ../../library/functions.rst:2143 msgid "" "Unlike the default behavior, it raises a :exc:`ValueError` if one iterable " "is exhausted before the others:" msgstr "" -#: ../../library/functions.rst:2155 +#: ../../library/functions.rst:2161 msgid "" "Without the ``strict=True`` argument, any bug that results in iterables of " "different lengths will be silenced, possibly manifesting as a hard-to-find " "bug in another part of the program." msgstr "" -#: ../../library/functions.rst:2159 +#: ../../library/functions.rst:2165 msgid "" "Shorter iterables can be padded with a constant value to make all the " "iterables have the same length. This is done by :func:`itertools." "zip_longest`." msgstr "" -#: ../../library/functions.rst:2163 +#: ../../library/functions.rst:2169 msgid "" "Edge cases: With a single iterable argument, :func:`zip` returns an iterator " "of 1-tuples. With no arguments, it returns an empty iterator." msgstr "" -#: ../../library/functions.rst:2166 +#: ../../library/functions.rst:2172 msgid "Tips and tricks:" msgstr "" -#: ../../library/functions.rst:2168 +#: ../../library/functions.rst:2174 msgid "" "The left-to-right evaluation order of the iterables is guaranteed. This " "makes possible an idiom for clustering a data series into n-length groups " @@ -3632,13 +3646,13 @@ msgid "" "iterator. This has the effect of dividing the input into n-length chunks." msgstr "" -#: ../../library/functions.rst:2174 +#: ../../library/functions.rst:2180 msgid "" ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " "list::" msgstr "" -#: ../../library/functions.rst:2177 +#: ../../library/functions.rst:2183 msgid "" ">>> x = [1, 2, 3]\n" ">>> y = [4, 5, 6]\n" @@ -3656,17 +3670,17 @@ msgstr "" ">>> x == list(x2) and y == list(y2)\n" "True" -#: ../../library/functions.rst:2185 +#: ../../library/functions.rst:2191 msgid "Added the ``strict`` argument." msgstr "增加了 ``strict`` 引數。" -#: ../../library/functions.rst:2197 +#: ../../library/functions.rst:2203 msgid "" "This is an advanced function that is not needed in everyday Python " "programming, unlike :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2200 +#: ../../library/functions.rst:2206 msgid "" "This function is invoked by the :keyword:`import` statement. It can be " "replaced (by importing the :mod:`builtins` module and assigning to " @@ -3678,7 +3692,7 @@ msgid "" "discouraged in favor of :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2209 +#: ../../library/functions.rst:2215 msgid "" "The function imports the module *name*, potentially using the given " "*globals* and *locals* to determine how to interpret the name in a package " @@ -3688,7 +3702,7 @@ msgid "" "determine the package context of the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2216 +#: ../../library/functions.rst:2222 msgid "" "*level* specifies whether to use absolute or relative imports. ``0`` (the " "default) means only perform absolute imports. Positive values for *level* " @@ -3697,7 +3711,7 @@ msgid "" "details)." msgstr "" -#: ../../library/functions.rst:2222 +#: ../../library/functions.rst:2228 msgid "" "When the *name* variable is of the form ``package.module``, normally, the " "top-level package (the name up till the first dot) is returned, *not* the " @@ -3705,37 +3719,37 @@ msgid "" "given, the module named by *name* is returned." msgstr "" -#: ../../library/functions.rst:2227 +#: ../../library/functions.rst:2233 msgid "" "For example, the statement ``import spam`` results in bytecode resembling " "the following code::" msgstr "" -#: ../../library/functions.rst:2230 +#: ../../library/functions.rst:2236 msgid "spam = __import__('spam', globals(), locals(), [], 0)" msgstr "spam = __import__('spam', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2232 +#: ../../library/functions.rst:2238 msgid "The statement ``import spam.ham`` results in this call::" msgstr "" -#: ../../library/functions.rst:2234 +#: ../../library/functions.rst:2240 msgid "spam = __import__('spam.ham', globals(), locals(), [], 0)" msgstr "spam = __import__('spam.ham', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2236 +#: ../../library/functions.rst:2242 msgid "" "Note how :func:`__import__` returns the toplevel module here because this is " "the object that is bound to a name by the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2239 +#: ../../library/functions.rst:2245 msgid "" "On the other hand, the statement ``from spam.ham import eggs, sausage as " "saus`` results in ::" msgstr "" -#: ../../library/functions.rst:2242 +#: ../../library/functions.rst:2248 msgid "" "_temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)\n" "eggs = _temp.eggs\n" @@ -3745,36 +3759,36 @@ msgstr "" "eggs = _temp.eggs\n" "saus = _temp.sausage" -#: ../../library/functions.rst:2246 +#: ../../library/functions.rst:2252 msgid "" "Here, the ``spam.ham`` module is returned from :func:`__import__`. From " "this object, the names to import are retrieved and assigned to their " "respective names." msgstr "" -#: ../../library/functions.rst:2250 +#: ../../library/functions.rst:2256 msgid "" "If you simply want to import a module (potentially within a package) by " "name, use :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2253 +#: ../../library/functions.rst:2259 msgid "" "Negative values for *level* are no longer supported (which also changes the " "default value to 0)." msgstr "" -#: ../../library/functions.rst:2257 +#: ../../library/functions.rst:2263 msgid "" "When the command line options :option:`-E` or :option:`-I` are being used, " "the environment variable :envvar:`PYTHONCASEOK` is now ignored." msgstr "" -#: ../../library/functions.rst:2262 +#: ../../library/functions.rst:2268 msgid "Footnotes" msgstr "註解" -#: ../../library/functions.rst:2263 +#: ../../library/functions.rst:2269 msgid "" "Note that the parser only accepts the Unix-style end of line convention. If " "you are reading the code from a file, make sure to use newline conversion " @@ -3787,107 +3801,107 @@ msgstr "" msgid "Boolean" msgstr "Boolean(布林值)" -#: ../../library/functions.rst:154 ../../library/functions.rst:2032 +#: ../../library/functions.rst:154 ../../library/functions.rst:2036 msgid "type" msgstr "type(型別)" -#: ../../library/functions.rst:641 +#: ../../library/functions.rst:643 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/functions.rst:641 +#: ../../library/functions.rst:643 msgid "exec" msgstr "exec" -#: ../../library/functions.rst:733 +#: ../../library/functions.rst:735 msgid "NaN" msgstr "NaN" -#: ../../library/functions.rst:733 +#: ../../library/functions.rst:735 msgid "Infinity" msgstr "Infinity(無窮)" -#: ../../library/functions.rst:801 +#: ../../library/functions.rst:803 msgid "__format__" msgstr "__format__" -#: ../../library/functions.rst:801 ../../library/functions.rst:1909 +#: ../../library/functions.rst:803 ../../library/functions.rst:1913 msgid "string" msgstr "string(字串)" -#: ../../library/functions.rst:801 +#: ../../library/functions.rst:803 msgid "format() (built-in function)" msgstr "format()(內建函式)" -#: ../../library/functions.rst:1310 +#: ../../library/functions.rst:1313 msgid "file object" msgstr "file object(檔案物件)" -#: ../../library/functions.rst:1310 ../../library/functions.rst:1431 +#: ../../library/functions.rst:1313 ../../library/functions.rst:1434 msgid "open() built-in function" msgstr "open() 內建函式" -#: ../../library/functions.rst:1338 +#: ../../library/functions.rst:1341 msgid "file" msgstr "file(檔案)" -#: ../../library/functions.rst:1338 +#: ../../library/functions.rst:1341 msgid "modes" msgstr "modes(模式)" -#: ../../library/functions.rst:1431 +#: ../../library/functions.rst:1434 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/functions.rst:1492 +#: ../../library/functions.rst:1495 msgid "line-buffered I/O" msgstr "line-buffered I/O(行緩衝 I/O)" -#: ../../library/functions.rst:1492 +#: ../../library/functions.rst:1495 msgid "unbuffered I/O" msgstr "unbuffered I/O(非緩衝 I/O)" -#: ../../library/functions.rst:1492 +#: ../../library/functions.rst:1495 msgid "buffer size, I/O" msgstr "buffer size, I/O(緩衝區大小、I/O)" -#: ../../library/functions.rst:1492 +#: ../../library/functions.rst:1495 msgid "I/O control" msgstr "I/O control(I/O 控制)" -#: ../../library/functions.rst:1492 +#: ../../library/functions.rst:1495 msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/functions.rst:1492 +#: ../../library/functions.rst:1495 msgid "text mode" msgstr "text mode(文字模式)" -#: ../../library/functions.rst:1492 ../../library/functions.rst:2191 +#: ../../library/functions.rst:1495 ../../library/functions.rst:2197 msgid "module" msgstr "module(模組)" -#: ../../library/functions.rst:1492 +#: ../../library/functions.rst:1495 msgid "sys" msgstr "sys" -#: ../../library/functions.rst:1909 +#: ../../library/functions.rst:1913 msgid "str() (built-in function)" msgstr "str() (內建函式)" -#: ../../library/functions.rst:2032 +#: ../../library/functions.rst:2036 msgid "object" msgstr "object(物件)" -#: ../../library/functions.rst:2191 +#: ../../library/functions.rst:2197 msgid "statement" msgstr "statement(陳述式)" -#: ../../library/functions.rst:2191 +#: ../../library/functions.rst:2197 msgid "import" msgstr "import(引入)" -#: ../../library/functions.rst:2191 +#: ../../library/functions.rst:2197 msgid "builtins" msgstr "builtins(內建)" diff --git a/library/functools.po b/library/functools.po index cc8ce0e7f8..af426e5f3d 100644 --- a/library/functools.po +++ b/library/functools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2024-05-11 16:02+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -690,7 +690,6 @@ msgstr "" "True" #: ../../library/functools.rst:408 -#, fuzzy msgid "" "Apply *function* of two arguments cumulatively to the items of *iterable*, " "from left to right, so as to reduce the iterable to a single value. For " @@ -705,16 +704,15 @@ msgstr "" "從左到右,將兩個引數的 *function* 累加運用到 *iterable* 的項目上,從而將可疊" "代物件減少為單一值。例如,``reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])`` 會計" "算出 ``((((1+2)+3)+4)+5)``。左邊的引數 *x* 是累積值,右邊的引數 *y* 是來自 " -"*iterable* 的更新值。如果可選的 *initializer* 存在,則在計算中會將其放置在可" -"疊代物件的項目之前,並在可疊代物件為空時作為預設值。如果未給定 *initializer* " -"且 *iterable* 僅包含一個項目,則回傳第一個項目。" +"*iterable* 的更新值。如果可選的 *initial* 存在,則在計算中會將其放置在可疊代" +"物件的項目之前,並在可疊代物件為空時作為預設值。如果未給定 *initial* 且 " +"*iterable* 僅包含一個項目,則回傳第一個項目。" #: ../../library/functools.rst:417 msgid "Roughly equivalent to::" msgstr "大致相當於: ::" #: ../../library/functools.rst:419 -#, fuzzy msgid "" "initial_missing = object()\n" "\n" @@ -728,12 +726,14 @@ msgid "" " value = function(value, element)\n" " return value" msgstr "" -"def reduce(function, iterable, initializer=None):\n" +"initial_missing = object()\n" +"\n" +"def reduce(function, iterable, initial=initial_missing, /):\n" " it = iter(iterable)\n" -" if initializer is None:\n" +" if initial is initial_missing:\n" " value = next(it)\n" " else:\n" -" value = initializer\n" +" value = initial\n" " for element in it:\n" " value = function(value, element)\n" " return value" @@ -877,7 +877,39 @@ msgstr "" "... print(arg.real, arg.imag)\n" "..." -#: ../../library/functools.rst:496 +#: ../../library/functools.rst:495 +msgid "" +"For code that dispatches on a collections type (e.g., ``list``), but wants " +"to typehint the items of the collection (e.g., ``list[int]``), the dispatch " +"type should be passed explicitly to the decorator itself with the typehint " +"going into the function definition::" +msgstr "" + +#: ../../library/functools.rst:500 +msgid "" +">>> @fun.register(list)\n" +"... def _(arg: list[int], verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)" +msgstr "" +">>> @fun.register(list)\n" +"... def _(arg: list[int], verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)" + +#: ../../library/functools.rst:509 +msgid "" +"At runtime the function will dispatch on an instance of a list regardless of " +"the type contained within the list i.e. ``[1,2,3]`` will be dispatched the " +"same as ``[\"foo\", \"bar\", \"baz\"]``. The annotation provided in this " +"example is for static type checkers only and has no runtime impact." +msgstr "" + +#: ../../library/functools.rst:515 msgid "" "To enable registering :term:`lambdas` and pre-existing functions, " "the :func:`register` attribute can also be used in a functional form::" @@ -885,7 +917,7 @@ msgstr "" "若要啟用註冊 :term:`lambdas` 和預先存在的函式,:func:`register` 屬性" "也能以函式形式使用: ::" -#: ../../library/functools.rst:499 +#: ../../library/functools.rst:518 msgid "" ">>> def nothing(arg, verbose=False):\n" "... print(\"Nothing.\")\n" @@ -897,7 +929,7 @@ msgstr "" "...\n" ">>> fun.register(type(None), nothing)" -#: ../../library/functools.rst:504 +#: ../../library/functools.rst:523 msgid "" "The :func:`register` attribute returns the undecorated function. This " "enables decorator stacking, :mod:`pickling`, and the creation of " @@ -906,7 +938,7 @@ msgstr "" ":func:`register` 屬性回傳未加裝飾器的函式。這讓使得裝飾器堆疊 (decorator " "stacking)、:mod:`pickling` 以及為每個變體獨立建立單元測試成為可能:" -#: ../../library/functools.rst:508 +#: ../../library/functools.rst:527 msgid "" ">>> @fun.register(float)\n" "... @fun.register(Decimal)\n" @@ -928,13 +960,13 @@ msgstr "" ">>> fun_num is fun\n" "False" -#: ../../library/functools.rst:518 +#: ../../library/functools.rst:537 msgid "" "When called, the generic function dispatches on the type of the first " "argument::" msgstr "呼叫時,泛型函式會分派第一個引數的型別: ::" -#: ../../library/functools.rst:521 +#: ../../library/functools.rst:540 msgid "" ">>> fun(\"Hello, world.\")\n" "Hello, world.\n" @@ -970,7 +1002,7 @@ msgstr "" ">>> fun(1.23)\n" "0.615" -#: ../../library/functools.rst:538 +#: ../../library/functools.rst:557 msgid "" "Where there is no registered implementation for a specific type, its method " "resolution order is used to find a more generic implementation. The original " @@ -982,7 +1014,7 @@ msgstr "" "尋找更通用的實作。用 ``@singledispatch`` 裝飾的原始函式是為基底 :class:" "`object` 型別註冊的,這意味著如果沒有找到更好的實作就會使用它。" -#: ../../library/functools.rst:544 +#: ../../library/functools.rst:563 msgid "" "If an implementation is registered to an :term:`abstract base class`, " "virtual subclasses of the base class will be dispatched to that " @@ -991,7 +1023,7 @@ msgstr "" "如果一個實作有被註冊到一個\\ :term:`抽象基底類別 `,則基" "底類別的虛擬子類別將被分派到該實作: ::" -#: ../../library/functools.rst:548 +#: ../../library/functools.rst:567 msgid "" ">>> from collections.abc import Mapping\n" ">>> @fun.register\n" @@ -1015,14 +1047,14 @@ msgstr "" ">>> fun({\"a\": \"b\"})\n" "a => b" -#: ../../library/functools.rst:559 +#: ../../library/functools.rst:578 msgid "" "To check which implementation the generic function will choose for a given " "type, use the ``dispatch()`` attribute::" msgstr "" "若要檢查泛型函式將為給定型別選擇哪種實作,請使用 ``dispatch()`` 屬性: ::" -#: ../../library/functools.rst:562 +#: ../../library/functools.rst:581 msgid "" ">>> fun.dispatch(float)\n" "\n" @@ -1030,13 +1062,13 @@ msgid "" "" msgstr "" -#: ../../library/functools.rst:567 +#: ../../library/functools.rst:586 msgid "" "To access all registered implementations, use the read-only ``registry`` " "attribute::" msgstr "若要存取所有已註冊的實作,請使用唯讀 ``registry`` 屬性: ::" -#: ../../library/functools.rst:570 +#: ../../library/functools.rst:589 msgid "" ">>> fun.registry.keys()\n" "dict_keys([, , ,\n" @@ -1056,11 +1088,11 @@ msgstr "" ">>> fun.registry[object]\n" "" -#: ../../library/functools.rst:581 +#: ../../library/functools.rst:600 msgid "The :func:`register` attribute now supports using type annotations." msgstr ":func:`register` 屬性現在支援使用型別註釋。" -#: ../../library/functools.rst:584 +#: ../../library/functools.rst:603 msgid "" "The :func:`register` attribute now supports :data:`types.UnionType` and :" "data:`typing.Union` as type annotations." @@ -1068,7 +1100,7 @@ msgstr "" ":func:`register` 屬性現在支援以 :data:`types.UnionType` 和 :data:`typing." "Union` 作為型別註釋。" -#: ../../library/functools.rst:591 +#: ../../library/functools.rst:610 msgid "" "Transform a method into a :term:`single-dispatch ` :term:" "`generic function`." @@ -1076,7 +1108,7 @@ msgstr "" "將方法轉換為\\ :term:`單一調度 `\\ :term:`泛型函式 `。" -#: ../../library/functools.rst:594 +#: ../../library/functools.rst:613 msgid "" "To define a generic method, decorate it with the ``@singledispatchmethod`` " "decorator. When defining a function using ``@singledispatchmethod``, note " @@ -1087,7 +1119,7 @@ msgstr "" "用 ``@singledispatchmethod`` 定義函式時,分派調度是發生在第一個非 *self* 或" "非 *cls* 引數的型別上: ::" -#: ../../library/functools.rst:599 +#: ../../library/functools.rst:618 msgid "" "class Negator:\n" " @singledispatchmethod\n" @@ -1115,7 +1147,7 @@ msgstr "" " def _(self, arg: bool):\n" " return not arg" -#: ../../library/functools.rst:612 +#: ../../library/functools.rst:631 msgid "" "``@singledispatchmethod`` supports nesting with other decorators such as :" "func:`@classmethod`. Note that to allow for ``dispatcher." @@ -1128,7 +1160,7 @@ msgstr "" "``singledispatchmethod`` 必須是\\ *最外面的*\\ 裝飾器。以下範例是 " "``Negator`` 類別,其 ``neg`` 方法繫結到該類別,而不是該類別的實例: ::" -#: ../../library/functools.rst:618 +#: ../../library/functools.rst:637 msgid "" "class Negator:\n" " @singledispatchmethod\n" @@ -1162,7 +1194,7 @@ msgstr "" " def _(cls, arg: bool):\n" " return not arg" -#: ../../library/functools.rst:634 +#: ../../library/functools.rst:653 msgid "" "The same pattern can be used for other similar decorators: :func:" "`@staticmethod`, :func:`@abstractmethod`, " @@ -1171,7 +1203,7 @@ msgstr "" "相同的模式可用於其他類似的裝飾器::func:`@staticmethod`、:func:" "`@abstractmethod` 等。" -#: ../../library/functools.rst:643 +#: ../../library/functools.rst:662 msgid "" "Update a *wrapper* function to look like the *wrapped* function. The " "optional arguments are tuples to specify which attributes of the original " @@ -1179,19 +1211,23 @@ msgid "" "function and which attributes of the wrapper function are updated with the " "corresponding attributes from the original function. The default values for " "these arguments are the module level constants ``WRAPPER_ASSIGNMENTS`` " -"(which assigns to the wrapper function's ``__module__``, ``__name__``, " -"``__qualname__``, ``__annotations__``, ``__type_params__``, and ``__doc__``, " -"the documentation string) and ``WRAPPER_UPDATES`` (which updates the wrapper " -"function's ``__dict__``, i.e. the instance dictionary)." +"(which assigns to the wrapper function's :attr:`~function.__module__`, :attr:" +"`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function." +"__annotations__`, :attr:`~function.__type_params__`, and :attr:`~function." +"__doc__`, the documentation string) and ``WRAPPER_UPDATES`` (which updates " +"the wrapper function's :attr:`~function.__dict__`, i.e. the instance " +"dictionary)." msgstr "" "更新 *wrapper* 函式,使其看起來像 *wrapped* 函式。可選引數是元組,用於指定原" "始函式的哪些屬性直接賦值給包裝函式上的匹配屬性,以及包裝函式的哪些屬性使用原" "始函式中的對應屬性進行更新。這些引數的預設值是模組層級的常數 " -"``WRAPPER_ASSIGNMENTS``\\ (它賦值給包裝函式的 ``__module__``、``__name__``、" -"``__qualname__``、``__annotations__`` 和 ``__doc__`` 文件字串 (docstring)和 " -"``WRAPPER_UPDATES``\\ (更新包裝器函式的 ``__dict__``,即實例字典)。" +"``WRAPPER_ASSIGNMENTS``\\ (它賦值給包裝函式的 :attr:`~function." +"__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:" +"attr:`~function.__annotations__`、:attr:`~function.__type_params__` 和 :attr:" +"`~function.__doc__` 文件字串 (docstring))和 ``WRAPPER_UPDATES``\\ (更新包" +"裝器函式的 :attr:`~function.__dict__`,即實例字典)。" -#: ../../library/functools.rst:654 +#: ../../library/functools.rst:674 msgid "" "To allow access to the original function for introspection and other " "purposes (e.g. bypassing a caching decorator such as :func:`lru_cache`), " @@ -1202,7 +1238,7 @@ msgstr "" "飾器,如 :func:`lru_cache`),此函式會自動向包裝器新增 ``__wrapped__`` 屬性," "該包裝器參照被包裝的函式。" -#: ../../library/functools.rst:659 +#: ../../library/functools.rst:679 msgid "" "The main intended use for this function is in :term:`decorator` functions " "which wrap the decorated function and return the wrapper. If the wrapper " @@ -1214,7 +1250,7 @@ msgstr "" "裝器函式未更新,則回傳函式的元資料 (metadata) 將反映包裝器定義而非原始函式定" "義,這通常不太會有幫助。" -#: ../../library/functools.rst:665 +#: ../../library/functools.rst:685 msgid "" ":func:`update_wrapper` may be used with callables other than functions. Any " "attributes named in *assigned* or *updated* that are missing from the object " @@ -1227,16 +1263,16 @@ msgstr "" "器函式上設定它們)。如果包裝函式本身缺少 *updated* 中指定的任何屬性,仍然會引" "發 :exc:`AttributeError`。" -#: ../../library/functools.rst:671 +#: ../../library/functools.rst:691 msgid "" -"The ``__wrapped__`` attribute is now automatically added. The " -"``__annotations__`` attribute is now copied by default. Missing attributes " -"no longer trigger an :exc:`AttributeError`." +"The ``__wrapped__`` attribute is now automatically added. The :attr:" +"`~function.__annotations__` attribute is now copied by default. Missing " +"attributes no longer trigger an :exc:`AttributeError`." msgstr "" -"現在會自動新增 ``__wrapped__`` 屬性。現在預設會複製 ``__annotations__`` 屬" -"性。缺少的屬性不再觸發 :exc:`AttributeError`。" +"現在會自動新增 ``__wrapped__`` 屬性。現在預設會複製 :attr:`~function." +"__annotations__` 屬性。缺少的屬性不再觸發 :exc:`AttributeError`。" -#: ../../library/functools.rst:676 +#: ../../library/functools.rst:696 msgid "" "The ``__wrapped__`` attribute now always refers to the wrapped function, " "even if that function defined a ``__wrapped__`` attribute. (see :issue:" @@ -1245,11 +1281,12 @@ msgstr "" "``__wrapped__`` 屬性現在都會參照包裝函式,即便函式有定義 ``__wrapped__`` 屬" "性。(參見 :issue:`17482`)" -#: ../../library/functools.rst:681 -msgid "The ``__type_params__`` attribute is now copied by default." -msgstr "現在預設會複製 ``__type_params__`` 屬性。" +#: ../../library/functools.rst:701 +msgid "" +"The :attr:`~function.__type_params__` attribute is now copied by default." +msgstr "現在預設會複製 :attr:`~function.__type_params__` 屬性。" -#: ../../library/functools.rst:687 +#: ../../library/functools.rst:707 msgid "" "This is a convenience function for invoking :func:`update_wrapper` as a " "function decorator when defining a wrapper function. It is equivalent to " @@ -1260,7 +1297,7 @@ msgstr "" "式裝飾器。它相當於 ``partial(update_wrapper, wrapped=wrapped, " "assigned=assigned, updated=updated)``。例如: ::" -#: ../../library/functools.rst:692 +#: ../../library/functools.rst:712 msgid "" ">>> from functools import wraps\n" ">>> def my_decorator(f):\n" @@ -1284,7 +1321,7 @@ msgid "" "'Docstring'" msgstr "" -#: ../../library/functools.rst:713 +#: ../../library/functools.rst:733 msgid "" "Without the use of this decorator factory, the name of the example function " "would have been ``'wrapper'``, and the docstring of the original :func:" @@ -1293,11 +1330,11 @@ msgstr "" "如果不使用這個裝飾器工廠 (decorator factory),範例函式的名稱將會是 " "``'wrapper'``,並且原始 :func:`example` 的文件字串將會遺失。" -#: ../../library/functools.rst:721 +#: ../../library/functools.rst:741 msgid ":class:`partial` Objects" msgstr ":class:`partial` 物件" -#: ../../library/functools.rst:723 +#: ../../library/functools.rst:743 msgid "" ":class:`partial` objects are callable objects created by :func:`partial`. " "They have three read-only attributes:" @@ -1305,7 +1342,7 @@ msgstr "" ":class:`partial` 物件是由 :func:`partial` 所建立的可呼叫物件。它們有三個唯讀" "屬性:" -#: ../../library/functools.rst:729 +#: ../../library/functools.rst:749 msgid "" "A callable object or function. Calls to the :class:`partial` object will be " "forwarded to :attr:`func` with new arguments and keywords." @@ -1313,7 +1350,7 @@ msgstr "" "一個可呼叫的物件或函式。對 :class:`partial` 物件的呼叫將被轉送到帶有新引數和" "關鍵字的 :attr:`func`。" -#: ../../library/functools.rst:735 +#: ../../library/functools.rst:755 msgid "" "The leftmost positional arguments that will be prepended to the positional " "arguments provided to a :class:`partial` object call." @@ -1321,23 +1358,24 @@ msgstr "" "最左邊的位置引數將會被加入到提供給 :class:`partial` 物件呼叫的位置引數的前" "面。" -#: ../../library/functools.rst:741 +#: ../../library/functools.rst:761 msgid "" "The keyword arguments that will be supplied when the :class:`partial` object " "is called." msgstr "呼叫 :class:`partial` 物件時將提供的關鍵字引數。" -#: ../../library/functools.rst:744 -msgid "" -":class:`partial` objects are like :class:`function` objects in that they are " -"callable, weak referenceable, and can have attributes. There are some " -"important differences. For instance, the :attr:`~definition.__name__` and :" -"attr:`__doc__` attributes are not created automatically. Also, :class:" -"`partial` objects defined in classes behave like static methods and do not " -"transform into bound methods during instance attribute look-up." -msgstr "" -":class:`partial` 物件與 :class:`function` 物件類似,因為它們是可呼叫的、可弱" -"參照的 (weak referencable) 且可以具有屬性。有一些重要的區別,例如,:attr:" -"`~definition.__name__` 和 :attr:`__doc__` 屬性不會自動建立。此外,類別中定義" -"的 :class:`partial` 物件的行為類似於靜態方法,並且在實例屬性查找期間不會轉換" -"為繫結方法。" +#: ../../library/functools.rst:764 +msgid "" +":class:`partial` objects are like :ref:`function objects ` in that they are callable, weak referenceable, and can have " +"attributes. There are some important differences. For instance, the :attr:" +"`~function.__name__` and :attr:`function.__doc__` attributes are not created " +"automatically. Also, :class:`partial` objects defined in classes behave " +"like static methods and do not transform into bound methods during instance " +"attribute look-up." +msgstr "" +":class:`partial` 物件與\\ :ref:`函式物件 `\\ 類似,因為它" +"們是可呼叫的、可弱參照的 (weak referencable) 且可以具有屬性。有一些重要的區" +"別,例如,:attr:`~function.__name__` 和 :attr:`function.__doc__` 屬性不會自動" +"建立。此外,類別中定義的 :class:`partial` 物件的行為類似於靜態方法,並且在實" +"例屬性查找期間不會轉換為繫結方法。" diff --git a/library/gc.po b/library/gc.po index 9e8bf39153..dd5103866b 100644 --- a/library/gc.po +++ b/library/gc.po @@ -1,16 +1,15 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Liang-Bo Wang , 2015 -# Matt Wang , 2022 +# Matt Wang , 2022-2024 # msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-01 00:15+0000\n" "PO-Revision-Date: 2023-04-24 21:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -64,12 +63,11 @@ msgid "Return ``True`` if automatic collection is enabled." msgstr "如果啟用了自動回收則回傳 ``True``。" #: ../../library/gc.rst:43 -#, fuzzy msgid "" -"Perform a collection. The optional argument *generation* may be an integer " -"specifying which generation to collect (from 0 to 2). A :exc:`ValueError` " -"is raised if the generation number is invalid. The sum of collected objects " -"and uncollectable objects is returned." +"With no arguments, run a full collection. The optional argument " +"*generation* may be an integer specifying which generation to collect (from " +"0 to 2). A :exc:`ValueError` is raised if the generation number is invalid. " +"The sum of collected objects and uncollectable objects is returned." msgstr "" "若被呼叫時沒有引數,則啟動完整垃圾回收。可選的引數 *generation* 可以是一個指" "明需要回收哪一代垃圾的整數(從 0 到 2)。當引數 *generation* 無效時,會引發 :" @@ -77,23 +75,6 @@ msgstr "" #: ../../library/gc.rst:48 msgid "" -"Calling ``gc.collect(0)`` will perform a GC collection on the young " -"generation." -msgstr "" - -#: ../../library/gc.rst:50 -msgid "" -"Calling ``gc.collect(1)`` will perform a GC collection on the young " -"generation and an increment of the old generation." -msgstr "" - -#: ../../library/gc.rst:53 -msgid "" -"Calling ``gc.collect(2)`` or ``gc.collect()`` performs a full collection" -msgstr "" - -#: ../../library/gc.rst:55 -msgid "" "The free lists maintained for a number of built-in types are cleared " "whenever a full collection or collection of the highest generation (2) is " "run. Not all items in some free lists may be freed due to the particular " @@ -103,17 +84,13 @@ msgstr "" "為了特定型別的實現,特別是 :class:`float`,在某些空閒列表中並非所有項目都會被" "釋放。" -#: ../../library/gc.rst:60 +#: ../../library/gc.rst:53 msgid "" "The effect of calling ``gc.collect()`` while the interpreter is already " "performing a collection is undefined." -msgstr "" +msgstr "當直譯器已經執行收集時呼叫 ``gc.collect()`` 的效果是未定義的。" -#: ../../library/gc.rst:63 -msgid "``generation=1`` performs an increment of collection." -msgstr "" - -#: ../../library/gc.rst:69 +#: ../../library/gc.rst:59 msgid "" "Set the garbage collection debugging flags. Debugging information will be " "written to ``sys.stderr``. See below for a list of debugging flags which " @@ -122,43 +99,24 @@ msgstr "" "設定垃圾回收器的除錯旗標。除錯資訊會被寫入 ``sys.stderr``。請見下方的除錯旗標" "列表,可以使用位元操作 (bit operation) 進行設定以控制除錯程式。" -#: ../../library/gc.rst:76 +#: ../../library/gc.rst:66 msgid "Return the debugging flags currently set." msgstr "回傳當前設置的除錯旗標。" -#: ../../library/gc.rst:82 -#, fuzzy +#: ../../library/gc.rst:71 msgid "" "Returns a list of all objects tracked by the collector, excluding the list " -"returned. If *generation* is not ``None``, return only the objects as " -"follows:" +"returned. If *generation* is not ``None``, return only the objects tracked " +"by the collector that are in that generation." msgstr "" "回傳一個包含回收器正在追蹤的所有物件的 list,除去所回傳的 list。如果 " -"*generation* 不為 None,只回傳回收器正在追蹤且屬於該代的物件。" +"*generation* 不為 ``None``,只回傳回收器正在追蹤且屬於該代的物件。" -#: ../../library/gc.rst:85 -#, fuzzy -msgid "0: All objects in the young generation" -msgstr "回傳永久代中的物件數量。" - -#: ../../library/gc.rst:86 -msgid "1: No objects, as there is no generation 1 (as of Python 3.13)" -msgstr "" - -#: ../../library/gc.rst:87 -#, fuzzy -msgid "2: All objects in the old generation" -msgstr "回傳永久代中的物件數量。" - -#: ../../library/gc.rst:89 +#: ../../library/gc.rst:75 msgid "New *generation* parameter." msgstr "新增 *generation* 參數。" -#: ../../library/gc.rst:92 -msgid "Generation 1 is removed" -msgstr "" - -#: ../../library/gc.rst:95 +#: ../../library/gc.rst:78 msgid "" "Raises an :ref:`auditing event ` ``gc.get_objects`` with argument " "``generation``." @@ -166,7 +124,7 @@ msgstr "" "引發一個附帶引數 ``generation`` 的\\ :ref:`稽核事件 (auditing event) " "` ``gc.get_objects``。" -#: ../../library/gc.rst:99 +#: ../../library/gc.rst:82 msgid "" "Return a list of three per-generation dictionaries containing collection " "statistics since interpreter start. The number of keys may change in the " @@ -176,17 +134,17 @@ msgstr "" "的垃圾回收統計資料。字典的鍵的數目在將來可能會改變,但目前每個字典包含以下項" "目:" -#: ../../library/gc.rst:104 +#: ../../library/gc.rst:87 msgid "``collections`` is the number of times this generation was collected;" msgstr "``collections`` 是該代被回收的次數;" -#: ../../library/gc.rst:106 +#: ../../library/gc.rst:89 msgid "" "``collected`` is the total number of objects collected inside this " "generation;" msgstr "``collected`` 是該代中被回收的物件總數;" -#: ../../library/gc.rst:109 +#: ../../library/gc.rst:92 msgid "" "``uncollectable`` is the total number of objects which were found to be " "uncollectable (and were therefore moved to the :data:`garbage` list) inside " @@ -195,64 +153,54 @@ msgstr "" "``uncollectable`` 是在這一代中被發現無法回收的物件總數(因此被移到 :data:" "`garbage` list 中)。" -#: ../../library/gc.rst:118 +#: ../../library/gc.rst:101 msgid "" "Set the garbage collection thresholds (the collection frequency). Setting " "*threshold0* to zero disables collection." msgstr "設定垃圾回收閾值(回收頻率)。 將 *threshold0* 設為零會停止回收。" -#: ../../library/gc.rst:121 -msgid "" -"The GC classifies objects into two generations depending on whether they " -"have survived a collection. New objects are placed in the young generation. " -"If an object survives a collection it is moved into the old generation." -msgstr "" - -#: ../../library/gc.rst:125 -msgid "" -"In order to decide when to run, the collector keeps track of the number of " -"object allocations and deallocations since the last collection. When the " -"number of allocations minus the number of deallocations exceeds " -"*threshold0*, collection starts. For each collection, all the objects in the " -"young generation and some fraction of the old generation is collected." -msgstr "" - -#: ../../library/gc.rst:131 -msgid "" -"The fraction of the old generation that is collected is **inversely** " -"proportional to *threshold1*. The larger *threshold1* is, the slower objects " -"in the old generation are collected. For the default value of 10, 1% of the " -"old generation is scanned during each collection." -msgstr "" - -#: ../../library/gc.rst:136 -msgid "*threshold2* is ignored." -msgstr "" - -#: ../../library/gc.rst:138 +#: ../../library/gc.rst:104 msgid "" -"See `Garbage collector design `_ for more information." -msgstr "" +"The GC classifies objects into three generations depending on how many " +"collection sweeps they have survived. New objects are placed in the " +"youngest generation (generation ``0``). If an object survives a collection " +"it is moved into the next older generation. Since generation ``2`` is the " +"oldest generation, objects in that generation remain there after a " +"collection. In order to decide when to run, the collector keeps track of " +"the number object allocations and deallocations since the last collection. " +"When the number of allocations minus the number of deallocations exceeds " +"*threshold0*, collection starts. Initially only generation ``0`` is " +"examined. If generation ``0`` has been examined more than *threshold1* " +"times since generation ``1`` has been examined, then generation ``1`` is " +"examined as well. With the third generation, things are a bit more " +"complicated, see `Collecting the oldest generation `_ for more " +"information." +msgstr "" +"垃圾回收器會根據物件在多少次垃圾回收後仍倖存來把所有物件分類為三代。新建物件" +"會被放在最年輕代(第 ``0`` 代)。 如果一個物件在一次垃圾回收後倖存,它會被移" +"入下一個較老代。由於第 ``2`` 代是最老代,這一代的物件在一次垃圾回收後仍會保留" +"原樣。為了確定何時要執行,垃圾回收器會追蹤自上一次回收後物件分配和釋放的數" +"量。當分配數量減去釋放數量的結果大於 *threshold0* 時,垃圾回收就會開始。初始" +"時只有第 ``0`` 代會被檢查。如果自第 ``1`` 代被檢查後第 ``0`` 代已被檢查超過 " +"*threshold1* 次,則第 ``1`` 代也會被檢查。對於第三代來說,情況還會更復雜一" +"些,請參閱 `Collecting the oldest generation `_ 來了解詳情。" -#: ../../library/gc.rst:140 -msgid "*threshold2* is ignored" -msgstr "" - -#: ../../library/gc.rst:146 +#: ../../library/gc.rst:121 msgid "" "Return the current collection counts as a tuple of ``(count0, count1, " "count2)``." msgstr "將當前回收計數以 ``(count0, count1, count2)`` 形式的 tuple 回傳。" -#: ../../library/gc.rst:152 +#: ../../library/gc.rst:127 msgid "" "Return the current collection thresholds as a tuple of ``(threshold0, " "threshold1, threshold2)``." msgstr "" "將當前回收閾值以 ``(threshold0, threshold1, threshold2)`` 形式的 tuple 回傳。" -#: ../../library/gc.rst:158 +#: ../../library/gc.rst:133 msgid "" "Return the list of objects that directly refer to any of objs. This function " "will only locate those containers which support garbage collection; " @@ -262,7 +210,7 @@ msgstr "" "回傳包含直接參照 objs 中任一個物件的物件 list。這個函式只定位支援垃圾回收的容" "器;參照了其它物件但不支援垃圾回收的擴充套件型別無法被找到。" -#: ../../library/gc.rst:163 +#: ../../library/gc.rst:138 msgid "" "Note that objects which have already been dereferenced, but which live in " "cycles and have not yet been collected by the garbage collector can be " @@ -273,7 +221,7 @@ msgstr "" "會被作為參照者出現在回傳的 list 中。若只要獲取當前正在參照的物件,需要在呼" "叫 :func:`get_referrers` 之前呼叫 :func:`collect`。" -#: ../../library/gc.rst:169 +#: ../../library/gc.rst:144 msgid "" "Care must be taken when using objects returned by :func:`get_referrers` " "because some of them could still be under construction and hence in a " @@ -284,7 +232,7 @@ msgstr "" "在建構中而處於暫時無效的狀態。不要把 :func:`get_referrers` 用於除錯以外的其它" "目的。" -#: ../../library/gc.rst:174 +#: ../../library/gc.rst:149 msgid "" "Raises an :ref:`auditing event ` ``gc.get_referrers`` with " "argument ``objs``." @@ -292,7 +240,7 @@ msgstr "" "引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` ``gc." "get_referrers``。" -#: ../../library/gc.rst:179 +#: ../../library/gc.rst:154 msgid "" "Return a list of objects directly referred to by any of the arguments. The " "referents returned are those objects visited by the arguments' C-level :c:" @@ -310,7 +258,7 @@ msgstr "" "此,可以有以下例子:一個整數對於一個引數是直接可達的,這個整數物件有可能出現" "或不出現在結果的 list 當中。" -#: ../../library/gc.rst:187 +#: ../../library/gc.rst:162 msgid "" "Raises an :ref:`auditing event ` ``gc.get_referents`` with " "argument ``objs``." @@ -318,7 +266,7 @@ msgstr "" "引發一個附帶引數 ``objs`` 的\\ :ref:`稽核事件 ` ``gc." "get_referents``。" -#: ../../library/gc.rst:191 +#: ../../library/gc.rst:166 msgid "" "Returns ``True`` if the object is currently tracked by the garbage " "collector, ``False`` otherwise. As a general rule, instances of atomic " @@ -332,7 +280,7 @@ msgstr "" "件)會被追蹤。然而,有一些特定型別最佳化會被用來減少垃圾回收器在簡單實例(如" "只含有原子性的鍵和值的字典)上的足跡: ::" -#: ../../library/gc.rst:198 +#: ../../library/gc.rst:173 msgid "" ">>> gc.is_tracked(0)\n" "False\n" @@ -360,14 +308,14 @@ msgstr "" ">>> gc.is_tracked({\"a\": []})\n" "True" -#: ../../library/gc.rst:216 +#: ../../library/gc.rst:191 msgid "" "Returns ``True`` if the given object has been finalized by the garbage " "collector, ``False`` otherwise. ::" msgstr "" "如果給定物件已被垃圾回收器終結則回傳 ``True``,否則回傳 ``False``。: ::" -#: ../../library/gc.rst:219 +#: ../../library/gc.rst:194 msgid "" ">>> x = None\n" ">>> class Lazarus:\n" @@ -395,7 +343,7 @@ msgstr "" ">>> gc.is_finalized(x)\n" "True" -#: ../../library/gc.rst:237 +#: ../../library/gc.rst:212 msgid "" "Freeze all the objects tracked by the garbage collector; move them to a " "permanent generation and ignore them in all the future collections." @@ -403,7 +351,7 @@ msgstr "" "凍結 (freeze) 垃圾回收器所追蹤的所有物件;將它們移至永久代並忽略所有未來的收" "集動作。" -#: ../../library/gc.rst:240 +#: ../../library/gc.rst:215 msgid "" "If a process will ``fork()`` without ``exec()``, avoiding unnecessary copy-" "on-write in child processes will maximize memory sharing and reduce overall " @@ -421,23 +369,23 @@ msgstr "" "disable()``,在 ``fork()`` 之前呼叫 ``gc.freeze()``,並儘早在子行程中呼叫 " "``gc.enable()``。" -#: ../../library/gc.rst:254 +#: ../../library/gc.rst:229 msgid "" "Unfreeze the objects in the permanent generation, put them back into the " "oldest generation." msgstr "解凍 (unfreeze) 永久代中的物件,並將它們放回到最年老代中。" -#: ../../library/gc.rst:262 +#: ../../library/gc.rst:237 msgid "Return the number of objects in the permanent generation." msgstr "回傳永久代中的物件數量。" -#: ../../library/gc.rst:267 +#: ../../library/gc.rst:242 msgid "" "The following variables are provided for read-only access (you can mutate " "the values but should not rebind them):" msgstr "以下變數僅供唯讀存取(你可以修改其值但不應該重新繫結 (rebind) 它們):" -#: ../../library/gc.rst:272 +#: ../../library/gc.rst:247 msgid "" "A list of objects which the collector found to be unreachable but could not " "be freed (uncollectable objects). Starting with Python 3.4, this list " @@ -448,7 +396,7 @@ msgstr "" "開始,該 list 在大多數時候都應該是空的,除非使用了有非 ``NULL`` ``tp_del`` 槽" "位的 C 擴充套件型別的實例。" -#: ../../library/gc.rst:277 +#: ../../library/gc.rst:252 msgid "" "If :const:`DEBUG_SAVEALL` is set, then all unreachable objects will be added " "to this list rather than freed." @@ -456,7 +404,7 @@ msgstr "" "如果設定了 :const:`DEBUG_SAVEALL`,則所有不可達物件將被加進該 list 而不會被釋" "放。" -#: ../../library/gc.rst:280 +#: ../../library/gc.rst:255 msgid "" "If this list is non-empty at :term:`interpreter shutdown`, a :exc:" "`ResourceWarning` is emitted, which is silent by default. If :const:" @@ -467,7 +415,7 @@ msgstr "" "`ResourceWarning`,在預設情況下此警告不會被提醒。如果設定了 :const:" "`DEBUG_UNCOLLECTABLE`,所有無法被回收的物件會被印出。" -#: ../../library/gc.rst:286 +#: ../../library/gc.rst:261 msgid "" "Following :pep:`442`, objects with a :meth:`~object.__del__` method don't " "end up in :data:`gc.garbage` anymore." @@ -475,7 +423,7 @@ msgstr "" "根據 :pep:`442`,帶有 :meth:`~object.__del__` method 的物件最終不會在 :data:" "`gc.garbage` 內。" -#: ../../library/gc.rst:292 +#: ../../library/gc.rst:267 msgid "" "A list of callbacks that will be invoked by the garbage collector before and " "after collection. The callbacks will be called with two arguments, *phase* " @@ -484,29 +432,29 @@ msgstr "" "會被垃圾回收器在回收開始前和完成後呼叫的一系列回呼函式 (callback) 。這些回呼" "函式在被呼叫時附帶兩個引數:*phase* 和 *info*。" -#: ../../library/gc.rst:296 +#: ../../library/gc.rst:271 msgid "*phase* can be one of two values:" msgstr "*phase* 可為以下兩者之一:" -#: ../../library/gc.rst:298 +#: ../../library/gc.rst:273 msgid "\"start\": The garbage collection is about to start." msgstr "\"start\":垃圾回收即將開始。" -#: ../../library/gc.rst:300 +#: ../../library/gc.rst:275 msgid "\"stop\": The garbage collection has finished." msgstr "\"stop\":垃圾回收已結束。" -#: ../../library/gc.rst:302 +#: ../../library/gc.rst:277 msgid "" "*info* is a dict providing more information for the callback. The following " "keys are currently defined:" msgstr "*info* 是一個字典,提供回呼函式更多資訊。已有定義的鍵有:" -#: ../../library/gc.rst:305 +#: ../../library/gc.rst:280 msgid "\"generation\": The oldest generation being collected." msgstr "\"generation\"(代):正在被回收的最年老的一代。" -#: ../../library/gc.rst:307 +#: ../../library/gc.rst:282 msgid "" "\"collected\": When *phase* is \"stop\", the number of objects successfully " "collected." @@ -514,7 +462,7 @@ msgstr "" "\"collected\"(已回收的):當 *phase* 為 \"stop\" 時,被成功回收的物件的數" "目。" -#: ../../library/gc.rst:310 +#: ../../library/gc.rst:285 msgid "" "\"uncollectable\": When *phase* is \"stop\", the number of objects that " "could not be collected and were put in :data:`garbage`." @@ -522,40 +470,40 @@ msgstr "" "\"uncollectable\"(不可回收的):當 *phase* 為 \"stop\" 時,不能被回收並被放" "入 :data:`garbage` 的物件的數目。" -#: ../../library/gc.rst:313 +#: ../../library/gc.rst:288 msgid "" "Applications can add their own callbacks to this list. The primary use " "cases are:" msgstr "應用程式可以把他們自己的回呼函式加入此 list。主要的使用場景有:" -#: ../../library/gc.rst:316 +#: ../../library/gc.rst:291 msgid "" "Gathering statistics about garbage collection, such as how often various " "generations are collected, and how long the collection takes." msgstr "收集垃圾回收的統計資料,如:不同代的回收頻率、回收任務所花費的時間。" -#: ../../library/gc.rst:320 +#: ../../library/gc.rst:295 msgid "" "Allowing applications to identify and clear their own uncollectable types " "when they appear in :data:`garbage`." msgstr "" "讓應用程式可以識別和清理他們自己在 :data:`garbage` 中的不可回收型別物件。" -#: ../../library/gc.rst:326 +#: ../../library/gc.rst:301 msgid "The following constants are provided for use with :func:`set_debug`:" msgstr "以下常數是為了和 :func:`set_debug` 一起使用所提供:" -#: ../../library/gc.rst:331 +#: ../../library/gc.rst:306 msgid "" "Print statistics during collection. This information can be useful when " "tuning the collection frequency." msgstr "在回收完成後印出統計資訊。當調校回收頻率設定時,這些資訊會很有用。" -#: ../../library/gc.rst:337 +#: ../../library/gc.rst:312 msgid "Print information on collectable objects found." msgstr "當發現可回收物件時印出資訊。" -#: ../../library/gc.rst:342 +#: ../../library/gc.rst:317 msgid "" "Print information of uncollectable objects found (objects which are not " "reachable but cannot be freed by the collector). These objects will be " @@ -564,7 +512,7 @@ msgstr "" "印出找到的不可回收物件的資訊(指不能被回收器回收的不可達物件)。這些物件會被" "新增到 ``garbage`` list 中。" -#: ../../library/gc.rst:346 +#: ../../library/gc.rst:321 msgid "" "Also print the contents of the :data:`garbage` list at :term:`interpreter " "shutdown`, if it isn't empty." @@ -572,7 +520,7 @@ msgstr "" "當 :term:`interpreter shutdown`\\ (直譯器關閉)時,若 :data:`garbage` list " "不是空的,那這些內容也會被印出。" -#: ../../library/gc.rst:352 +#: ../../library/gc.rst:327 msgid "" "When set, all unreachable objects found will be appended to *garbage* rather " "than being freed. This can be useful for debugging a leaking program." @@ -580,7 +528,7 @@ msgstr "" "設定後,所有回收器找到的不可達物件會被加進 *garbage* 而不是直接被釋放。這在為" "一個記憶體流失的程式除錯時會很有用。" -#: ../../library/gc.rst:358 +#: ../../library/gc.rst:333 msgid "" "The debugging flags necessary for the collector to print information about a " "leaking program (equal to ``DEBUG_COLLECTABLE | DEBUG_UNCOLLECTABLE | " @@ -588,31 +536,3 @@ msgid "" msgstr "" "要印出記憶體流失程式之相關資訊時,回收器所需的除錯旗標。(等同於 " "``DEBUG_COLLECTABLE | DEBUG_UNCOLLECTABLE | DEBUG_SAVEALL``)。" - -#~ msgid "" -#~ "The GC classifies objects into three generations depending on how many " -#~ "collection sweeps they have survived. New objects are placed in the " -#~ "youngest generation (generation ``0``). If an object survives a " -#~ "collection it is moved into the next older generation. Since generation " -#~ "``2`` is the oldest generation, objects in that generation remain there " -#~ "after a collection. In order to decide when to run, the collector keeps " -#~ "track of the number object allocations and deallocations since the last " -#~ "collection. When the number of allocations minus the number of " -#~ "deallocations exceeds *threshold0*, collection starts. Initially only " -#~ "generation ``0`` is examined. If generation ``0`` has been examined more " -#~ "than *threshold1* times since generation ``1`` has been examined, then " -#~ "generation ``1`` is examined as well. With the third generation, things " -#~ "are a bit more complicated, see `Collecting the oldest generation " -#~ "`_ for more information." -#~ msgstr "" -#~ "垃圾回收器會根據物件在多少次垃圾回收後仍倖存來把所有物件分類為三代。新建物" -#~ "件會被放在最年輕代(第 ``0`` 代)。 如果一個物件在一次垃圾回收後倖存,它會" -#~ "被移入下一個較老代。由於第 ``2`` 代是最老代,這一代的物件在一次垃圾回收後" -#~ "仍會保留原樣。為了確定何時要執行,垃圾回收器會追蹤自上一次回收後物件分配和" -#~ "釋放的數量。當分配數量減去釋放數量的結果大於 *threshold0* 時,垃圾回收就會" -#~ "開始。初始時只有第 ``0`` 代會被檢查。如果自第 ``1`` 代被檢查後第 ``0`` 代" -#~ "已被檢查超過 *threshold1* 次,則第 ``1`` 代也會被檢查。對於第三代來說,情" -#~ "況還會更復雜一些,請參閱 `Collecting the oldest generation `_ 來了解詳情。" diff --git a/library/importlib.po b/library/importlib.po index 77865d2b32..9946fd1bea 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1366,7 +1366,7 @@ msgstr "" msgid "Multi-phase init is now required for use in subinterpreters." msgstr "" -#: ../../library/importlib.rst:1109 ../../library/importlib.rst:1300 +#: ../../library/importlib.rst:1109 ../../library/importlib.rst:1293 msgid "Name of the module the loader supports." msgstr "" @@ -1426,109 +1426,85 @@ msgstr "" #: ../../library/importlib.rst:1168 msgid "" "A specification for a module's import-system-related state. This is " -"typically exposed as the module's :attr:`__spec__` attribute. In the " -"descriptions below, the names in parentheses give the corresponding " -"attribute available directly on the module object, e.g. ``module.__spec__." -"origin == module.__file__``. Note, however, that while the *values* are " -"usually equivalent, they can differ since there is no synchronization " -"between the two objects. For example, it is possible to update the " -"module's :attr:`__file__` at runtime and this will not be automatically " -"reflected in the module's :attr:`__spec__.origin`, and vice versa." +"typically exposed as the module's :attr:`__spec__` attribute. Many of these " +"attributes are also available directly on a module: for example, ``module." +"__spec__.origin == module.__file__``. Note, however, that while the " +"*values* are usually equivalent, they can differ since there is no " +"synchronization between the two objects. For example, it is possible to " +"update the module's :attr:`__file__` at runtime and this will not be " +"automatically reflected in the module's :attr:`__spec__.origin`, and vice " +"versa." msgstr "" -#: ../../library/importlib.rst:1182 -msgid "(:attr:`__name__`)" -msgstr "(:attr:`__name__`)" - -#: ../../library/importlib.rst:1184 +#: ../../library/importlib.rst:1181 msgid "" -"The module's fully qualified name. The :term:`finder` should always set this " -"attribute to a non-empty string." +"The module's fully qualified name (see :attr:`__name__` attributes on " +"modules). The :term:`finder` should always set this attribute to a non-empty " +"string." msgstr "" -#: ../../library/importlib.rst:1189 -msgid "(:attr:`__loader__`)" -msgstr "(:attr:`__loader__`)" - -#: ../../library/importlib.rst:1191 +#: ../../library/importlib.rst:1187 msgid "" -"The :term:`loader` used to load the module. The :term:`finder` should always " -"set this attribute." +"The :term:`loader` used to load the module (see :attr:`__loader__` " +"attributes on modules). The :term:`finder` should always set this attribute." msgstr "" -#: ../../library/importlib.rst:1196 -msgid "(:attr:`__file__`)" -msgstr "(:attr:`__file__`)" - -#: ../../library/importlib.rst:1198 +#: ../../library/importlib.rst:1193 msgid "" -"The location the :term:`loader` should use to load the module. For example, " -"for modules loaded from a .py file this is the filename. The :term:`finder` " -"should always set this attribute to a meaningful value for the :term:" -"`loader` to use. In the uncommon case that there is not one (like for " -"namespace packages), it should be set to ``None``." +"The location the :term:`loader` should use to load the module (see :attr:" +"`__file__` attributes on modules). For example, for modules loaded from a ." +"py file this is the filename. The :term:`finder` should always set this " +"attribute to a meaningful value for the :term:`loader` to use. In the " +"uncommon case that there is not one (like for namespace packages), it should " +"be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1206 -msgid "(:attr:`__path__`)" -msgstr "(:attr:`__path__`)" - -#: ../../library/importlib.rst:1208 +#: ../../library/importlib.rst:1202 msgid "" -"The list of locations where the package's submodules will be found. Most of " -"the time this is a single directory. The :term:`finder` should set this " -"attribute to a list, even an empty one, to indicate to the import system " -"that the module is a package. It should be set to ``None`` for non-package " -"modules. It is set automatically later to a special object for namespace " -"packages." +"The list of locations where the package's submodules will be found (see :" +"attr:`__path__` attributes on modules). Most of the time this is a single " +"directory. The :term:`finder` should set this attribute to a list, even an " +"empty one, to indicate to the import system that the module is a package. " +"It should be set to ``None`` for non-package modules. It is set " +"automatically later to a special object for namespace packages." msgstr "" -#: ../../library/importlib.rst:1217 +#: ../../library/importlib.rst:1212 msgid "" "The :term:`finder` may set this attribute to an object containing " "additional, module-specific data to use when loading the module. Otherwise " "it should be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1223 -msgid "(:attr:`__cached__`)" -msgstr "(:attr:`__cached__`)" - -#: ../../library/importlib.rst:1225 +#: ../../library/importlib.rst:1218 msgid "" -"The filename of a compiled version of the module's code. The :term:`finder` " -"should always set this attribute but it may be ``None`` for modules that do " -"not need compiled code stored." +"The filename of a compiled version of the module's code (see :attr:" +"`__cached__` attributes on modules). The :term:`finder` should always set " +"this attribute but it may be ``None`` for modules that do not need compiled " +"code stored." msgstr "" -#: ../../library/importlib.rst:1231 -msgid "(:attr:`__package__`)" -msgstr "(:attr:`__package__`)" - -#: ../../library/importlib.rst:1233 +#: ../../library/importlib.rst:1225 msgid "" "(Read-only) The fully qualified name of the package the module is in (or the " -"empty string for a top-level module). If the module is a package then this " -"is the same as :attr:`name`." -msgstr "" - -#: ../../library/importlib.rst:1239 -msgid "``True`` if the spec's :attr:`origin` refers to a loadable location," +"empty string for a top-level module). See :attr:`__package__` attributes on " +"modules. If the module is a package then this is the same as :attr:`name`." msgstr "" -#: ../../library/importlib.rst:1240 +#: ../../library/importlib.rst:1232 msgid "" +"``True`` if the spec's :attr:`origin` refers to a loadable location, " "``False`` otherwise. This value impacts how :attr:`origin` is interpreted " "and how the module's :attr:`__file__` is populated." msgstr "" -#: ../../library/importlib.rst:1246 +#: ../../library/importlib.rst:1239 msgid "" "A specialization of :class:`importlib.machinery.ExtensionFileLoader` that is " "able to load extension modules in Framework format." msgstr "" -#: ../../library/importlib.rst:1249 +#: ../../library/importlib.rst:1242 msgid "" "For compatibility with the iOS App Store, *all* binary modules in an iOS app " "must be dynamic libraries, contained in a framework with appropriate " @@ -1537,7 +1513,7 @@ msgid "" "material outside the Frameworks folder." msgstr "" -#: ../../library/importlib.rst:1255 +#: ../../library/importlib.rst:1248 msgid "" "To accommodate this requirement, when running on iOS, extension module " "binaries are *not* packaged as ``.so`` files on ``sys.path``, but as " @@ -1551,7 +1527,7 @@ msgid "" "fwork`` file, relative to the app bundle." msgstr "" -#: ../../library/importlib.rst:1266 +#: ../../library/importlib.rst:1259 msgid "" "For example, consider the case of an import ``from foo.bar import _whiz``, " "where ``_whiz`` is implemented with the binary module ``sources/foo/bar/" @@ -1567,7 +1543,7 @@ msgid "" "_whiz.origin``, containing the path to the ``.fwork`` file." msgstr "" -#: ../../library/importlib.rst:1280 +#: ../../library/importlib.rst:1273 msgid "" "When a module is loaded with this loader, the ``__file__`` for the module " "will report as the location of the ``.fwork`` file. This allows code to use " @@ -1576,7 +1552,7 @@ msgid "" "in the ``.framework`` folder." msgstr "" -#: ../../library/importlib.rst:1286 +#: ../../library/importlib.rst:1279 msgid "" "The Xcode project building the app is responsible for converting any ``.so`` " "files from wherever they exist in the ``PYTHONPATH`` into frameworks in the " @@ -1587,35 +1563,35 @@ msgid "" "details on how to construct this build step." msgstr "" -#: ../../library/importlib.rst:1296 +#: ../../library/importlib.rst:1289 msgid ":ref:`Availability `: iOS." msgstr "" -#: ../../library/importlib.rst:1304 +#: ../../library/importlib.rst:1297 msgid "Path to the ``.fwork`` file for the extension module." msgstr "" -#: ../../library/importlib.rst:1308 +#: ../../library/importlib.rst:1301 msgid ":mod:`importlib.util` -- Utility code for importers" msgstr "" -#: ../../library/importlib.rst:1314 +#: ../../library/importlib.rst:1307 msgid "**Source code:** :source:`Lib/importlib/util.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/util.py`" -#: ../../library/importlib.rst:1318 +#: ../../library/importlib.rst:1311 msgid "" "This module contains the various objects that help in the construction of " "an :term:`importer`." msgstr "" -#: ../../library/importlib.rst:1323 +#: ../../library/importlib.rst:1316 msgid "" "The bytes which represent the bytecode version number. If you need help with " "loading/writing bytecode then consider :class:`importlib.abc.SourceLoader`." msgstr "" -#: ../../library/importlib.rst:1330 +#: ../../library/importlib.rst:1323 msgid "" "Return the :pep:`3147`/:pep:`488` path to the byte-compiled file associated " "with the source *path*. For example, if *path* is ``/foo/bar/baz.py`` the " @@ -1625,7 +1601,7 @@ msgid "" "`NotImplementedError` will be raised)." msgstr "" -#: ../../library/importlib.rst:1337 +#: ../../library/importlib.rst:1330 msgid "" "The *optimization* parameter is used to specify the optimization level of " "the bytecode file. An empty string represents no optimization, so ``/foo/bar/" @@ -1638,7 +1614,7 @@ msgid "" "be alphanumeric, else :exc:`ValueError` is raised." msgstr "" -#: ../../library/importlib.rst:1347 +#: ../../library/importlib.rst:1340 msgid "" "The *debug_override* parameter is deprecated and can be used to override the " "system's value for ``__debug__``. A ``True`` value is the equivalent of " @@ -1647,18 +1623,18 @@ msgid "" "are not ``None`` then :exc:`TypeError` is raised." msgstr "" -#: ../../library/importlib.rst:1355 +#: ../../library/importlib.rst:1348 msgid "" "The *optimization* parameter was added and the *debug_override* parameter " "was deprecated." msgstr "" -#: ../../library/importlib.rst:1359 ../../library/importlib.rst:1375 -#: ../../library/importlib.rst:1464 +#: ../../library/importlib.rst:1352 ../../library/importlib.rst:1368 +#: ../../library/importlib.rst:1457 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/importlib.rst:1365 +#: ../../library/importlib.rst:1358 msgid "" "Given the *path* to a :pep:`3147` file name, return the associated source " "code file path. For example, if *path* is ``/foo/bar/__pycache__/baz." @@ -1668,25 +1644,25 @@ msgid "" "cache_tag` is not defined, :exc:`NotImplementedError` is raised." msgstr "" -#: ../../library/importlib.rst:1380 +#: ../../library/importlib.rst:1373 msgid "" "Decode the given bytes representing source code and return it as a string " "with universal newlines (as required by :meth:`importlib.abc.InspectLoader." "get_source`)." msgstr "" -#: ../../library/importlib.rst:1388 +#: ../../library/importlib.rst:1381 msgid "Resolve a relative module name to an absolute one." msgstr "" -#: ../../library/importlib.rst:1390 +#: ../../library/importlib.rst:1383 msgid "" "If **name** has no leading dots, then **name** is simply returned. This " "allows for usage such as ``importlib.util.resolve_name('sys', __spec__." "parent)`` without doing a check to see if the **package** argument is needed." msgstr "" -#: ../../library/importlib.rst:1395 +#: ../../library/importlib.rst:1388 msgid "" ":exc:`ImportError` is raised if **name** is a relative module name but " "**package** is a false value (e.g. ``None`` or the empty string). :exc:" @@ -1694,13 +1670,13 @@ msgid "" "package (e.g. requesting ``..bacon`` from within the ``spam`` package)." msgstr "" -#: ../../library/importlib.rst:1403 +#: ../../library/importlib.rst:1396 msgid "" "To improve consistency with import statements, raise :exc:`ImportError` " "instead of :exc:`ValueError` for invalid relative import attempts." msgstr "" -#: ../../library/importlib.rst:1410 +#: ../../library/importlib.rst:1403 msgid "" "Find the :term:`spec ` for a module, optionally relative to the " "specified **package** name. If the module is in :data:`sys.modules`, then " @@ -1710,30 +1686,30 @@ msgid "" "if no spec is found." msgstr "" -#: ../../library/importlib.rst:1417 +#: ../../library/importlib.rst:1410 msgid "" "If **name** is for a submodule (contains a dot), the parent module is " "automatically imported." msgstr "" -#: ../../library/importlib.rst:1420 +#: ../../library/importlib.rst:1413 msgid "**name** and **package** work the same as for :func:`import_module`." msgstr "" -#: ../../library/importlib.rst:1424 +#: ../../library/importlib.rst:1417 msgid "" "Raises :exc:`ModuleNotFoundError` instead of :exc:`AttributeError` if " "**package** is in fact not a package (i.e. lacks a :attr:`__path__` " "attribute)." msgstr "" -#: ../../library/importlib.rst:1431 +#: ../../library/importlib.rst:1424 msgid "" "Create a new module based on **spec** and :meth:`spec.loader.create_module " "`." msgstr "" -#: ../../library/importlib.rst:1434 +#: ../../library/importlib.rst:1427 msgid "" "If :meth:`spec.loader.create_module ` " "does not return ``None``, then any pre-existing attributes will not be " @@ -1741,14 +1717,14 @@ msgid "" "accessing **spec** or setting an attribute on the module." msgstr "" -#: ../../library/importlib.rst:1439 +#: ../../library/importlib.rst:1432 msgid "" "This function is preferred over using :class:`types.ModuleType` to create a " "new module as **spec** is used to set as many import-controlled attributes " "on the module as possible." msgstr "" -#: ../../library/importlib.rst:1447 +#: ../../library/importlib.rst:1440 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on a loader. The parameters have the same meaning as they do " @@ -1757,7 +1733,7 @@ msgid "" "spec." msgstr "" -#: ../../library/importlib.rst:1457 +#: ../../library/importlib.rst:1450 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on the path to a file. Missing information will be filled in " @@ -1765,14 +1741,14 @@ msgid "" "module will be file-based." msgstr "" -#: ../../library/importlib.rst:1469 +#: ../../library/importlib.rst:1462 msgid "" "Return the hash of *source_bytes* as bytes. A hash-based ``.pyc`` file " "embeds the :func:`source_hash` of the corresponding source file's contents " "in its header." msgstr "" -#: ../../library/importlib.rst:1477 +#: ../../library/importlib.rst:1470 msgid "" "A context manager that can temporarily skip the compatibility check for " "extension modules. By default the check is enabled and will fail when a " @@ -1781,33 +1757,33 @@ msgid "" "interpreter GIL, when imported in an interpreter with its own GIL." msgstr "" -#: ../../library/importlib.rst:1484 +#: ../../library/importlib.rst:1477 msgid "" "Note that this function is meant to accommodate an unusual case; one which " "is likely to eventually go away. There's is a pretty good chance this is " "not what you were looking for." msgstr "" -#: ../../library/importlib.rst:1488 +#: ../../library/importlib.rst:1481 msgid "" "You can get the same effect as this function by implementing the basic " "interface of multi-phase init (:pep:`489`) and lying about support for " "multiple interpreters (or per-interpreter GIL)." msgstr "" -#: ../../library/importlib.rst:1493 +#: ../../library/importlib.rst:1486 msgid "" "Using this function to disable the check can lead to unexpected behavior and " "even crashes. It should only be used during extension module development." msgstr "" -#: ../../library/importlib.rst:1501 +#: ../../library/importlib.rst:1494 msgid "" "A class which postpones the execution of the loader of a module until the " "module has an attribute accessed." msgstr "" -#: ../../library/importlib.rst:1504 +#: ../../library/importlib.rst:1497 msgid "" "This class **only** works with loaders that define :meth:`~importlib.abc." "Loader.exec_module` as control over what module type is used for the module " @@ -1820,7 +1796,7 @@ msgid "" "raised if such a substitution is detected." msgstr "" -#: ../../library/importlib.rst:1515 +#: ../../library/importlib.rst:1508 msgid "" "For projects where startup time is critical, this class allows for " "potentially minimizing the cost of loading a module if it is never used. For " @@ -1829,21 +1805,21 @@ msgid "" "postponed and thus occurring out of context." msgstr "" -#: ../../library/importlib.rst:1523 +#: ../../library/importlib.rst:1516 msgid "" "Began calling :meth:`~importlib.abc.Loader.create_module`, removing the " "compatibility warning for :class:`importlib.machinery.BuiltinImporter` and :" "class:`importlib.machinery.ExtensionFileLoader`." msgstr "" -#: ../../library/importlib.rst:1530 +#: ../../library/importlib.rst:1523 msgid "" "A class method which returns a callable that creates a lazy loader. This is " "meant to be used in situations where the loader is passed by class instead " "of by instance. ::" msgstr "" -#: ../../library/importlib.rst:1535 +#: ../../library/importlib.rst:1528 msgid "" "suffixes = importlib.machinery.SOURCE_SUFFIXES\n" "loader = importlib.machinery.SourceFileLoader\n" @@ -1855,20 +1831,20 @@ msgstr "" "lazy_loader = importlib.util.LazyLoader.factory(loader)\n" "finder = importlib.machinery.FileFinder(path, (lazy_loader, suffixes))" -#: ../../library/importlib.rst:1543 +#: ../../library/importlib.rst:1536 msgid "Examples" msgstr "範例" -#: ../../library/importlib.rst:1546 +#: ../../library/importlib.rst:1539 msgid "Importing programmatically" msgstr "" -#: ../../library/importlib.rst:1548 +#: ../../library/importlib.rst:1541 msgid "" "To programmatically import a module, use :func:`importlib.import_module`. ::" msgstr "" -#: ../../library/importlib.rst:1551 +#: ../../library/importlib.rst:1544 msgid "" "import importlib\n" "\n" @@ -1878,23 +1854,23 @@ msgstr "" "\n" "itertools = importlib.import_module('itertools')" -#: ../../library/importlib.rst:1557 +#: ../../library/importlib.rst:1550 msgid "Checking if a module can be imported" msgstr "" -#: ../../library/importlib.rst:1559 +#: ../../library/importlib.rst:1552 msgid "" "If you need to find out if a module can be imported without actually doing " "the import, then you should use :func:`importlib.util.find_spec`." msgstr "" -#: ../../library/importlib.rst:1562 +#: ../../library/importlib.rst:1555 msgid "" "Note that if ``name`` is a submodule (contains a dot), :func:`importlib.util." "find_spec` will import the parent module. ::" msgstr "" -#: ../../library/importlib.rst:1566 +#: ../../library/importlib.rst:1559 msgid "" "import importlib.util\n" "import sys\n" @@ -1914,11 +1890,11 @@ msgid "" " print(f\"can't find the {name!r} module\")" msgstr "" -#: ../../library/importlib.rst:1585 +#: ../../library/importlib.rst:1578 msgid "Importing a source file directly" msgstr "" -#: ../../library/importlib.rst:1587 +#: ../../library/importlib.rst:1580 msgid "" "This recipe should be used with caution: it is an approximation of an import " "statement where the file path is specified directly, rather than :data:`sys." @@ -1928,13 +1904,13 @@ msgid "" "file is appropriate." msgstr "" -#: ../../library/importlib.rst:1594 +#: ../../library/importlib.rst:1587 msgid "" "To import a Python source file directly from a path, use the following " "recipe::" msgstr "" -#: ../../library/importlib.rst:1596 +#: ../../library/importlib.rst:1589 msgid "" "import importlib.util\n" "import sys\n" @@ -1957,15 +1933,15 @@ msgid "" "json = import_from_path(module_name, file_path)" msgstr "" -#: ../../library/importlib.rst:1618 +#: ../../library/importlib.rst:1611 msgid "Implementing lazy imports" msgstr "" -#: ../../library/importlib.rst:1620 +#: ../../library/importlib.rst:1613 msgid "The example below shows how to implement lazy imports::" msgstr "" -#: ../../library/importlib.rst:1622 +#: ../../library/importlib.rst:1615 msgid "" ">>> import importlib.util\n" ">>> import sys\n" @@ -1985,11 +1961,11 @@ msgid "" "False" msgstr "" -#: ../../library/importlib.rst:1641 +#: ../../library/importlib.rst:1634 msgid "Setting up an importer" msgstr "" -#: ../../library/importlib.rst:1643 +#: ../../library/importlib.rst:1636 msgid "" "For deep customizations of import, you typically want to implement an :term:" "`importer`. This means managing both the :term:`finder` and :term:`loader` " @@ -2003,7 +1979,7 @@ msgid "" "for the appropriate classes defined within this package)::" msgstr "" -#: ../../library/importlib.rst:1654 +#: ../../library/importlib.rst:1647 msgid "" "import importlib.machinery\n" "import sys\n" @@ -2027,11 +2003,11 @@ msgid "" "sys.path_hooks.append(SpamPathEntryFinder.path_hook(loader_details))" msgstr "" -#: ../../library/importlib.rst:1675 +#: ../../library/importlib.rst:1668 msgid "Approximating :func:`importlib.import_module`" msgstr "" -#: ../../library/importlib.rst:1677 +#: ../../library/importlib.rst:1670 msgid "" "Import itself is implemented in Python code, making it possible to expose " "most of the import machinery through importlib. The following helps " @@ -2039,7 +2015,7 @@ msgid "" "approximate implementation of :func:`importlib.import_module`::" msgstr "" -#: ../../library/importlib.rst:1683 +#: ../../library/importlib.rst:1676 msgid "" "import importlib.util\n" "import sys\n" @@ -2079,3 +2055,21 @@ msgstr "universal newlines" #: ../../library/importlib.rst:443 msgid "importlib.abc.InspectLoader.get_source method" msgstr "importlib.abc.InspectLoader.get_source 方法" + +#~ msgid "(:attr:`__name__`)" +#~ msgstr "(:attr:`__name__`)" + +#~ msgid "(:attr:`__loader__`)" +#~ msgstr "(:attr:`__loader__`)" + +#~ msgid "(:attr:`__file__`)" +#~ msgstr "(:attr:`__file__`)" + +#~ msgid "(:attr:`__path__`)" +#~ msgstr "(:attr:`__path__`)" + +#~ msgid "(:attr:`__cached__`)" +#~ msgstr "(:attr:`__cached__`)" + +#~ msgid "(:attr:`__package__`)" +#~ msgstr "(:attr:`__package__`)" diff --git a/library/inspect.po b/library/inspect.po index d8ce3640b7..4b2f07941b 100644 --- a/library/inspect.po +++ b/library/inspect.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -840,7 +840,7 @@ msgid "" "has a :meth:`~object.__get__` method, but not a :meth:`~object.__set__` " "method or a :meth:`~object.__delete__` method. Beyond that, the set of " "attributes varies. A :attr:`~definition.__name__` attribute is usually " -"sensible, and :attr:`!__doc__` often is." +"sensible, and :attr:`~definition.__doc__` often is." msgstr "" #: ../../library/inspect.rst:525 diff --git a/library/logging.po b/library/logging.po index dbfd2969fc..8bfdaea17d 100644 --- a/library/logging.po +++ b/library/logging.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-03-28 22:40+0800\n" "Last-Translator: RockLeon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -346,7 +346,7 @@ msgid "" "level." msgstr "" -#: ../../library/logging.rst:211 ../../library/logging.rst:554 +#: ../../library/logging.rst:211 ../../library/logging.rst:555 msgid "See :ref:`levels` for a list of levels." msgstr "層級清單請見 :ref:`levels`。" @@ -464,13 +464,13 @@ msgstr "" #: ../../library/logging.rst:306 msgid "" "The fourth keyword argument is *extra* which can be used to pass a " -"dictionary which is used to populate the __dict__ of the :class:`LogRecord` " -"created for the logging event with user-defined attributes. These custom " -"attributes can then be used as you like. For example, they could be " -"incorporated into logged messages. For example::" +"dictionary which is used to populate the :attr:`~object.__dict__` of the :" +"class:`LogRecord` created for the logging event with user-defined " +"attributes. These custom attributes can then be used as you like. For " +"example, they could be incorporated into logged messages. For example::" msgstr "" -#: ../../library/logging.rst:312 +#: ../../library/logging.rst:313 msgid "" "FORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s'\n" "logging.basicConfig(format=FORMAT)\n" @@ -484,24 +484,24 @@ msgstr "" "logger = logging.getLogger('tcpserver')\n" "logger.warning('Protocol problem: %s', 'connection reset', extra=d)" -#: ../../library/logging.rst:318 +#: ../../library/logging.rst:319 msgid "would print something like" msgstr "" -#: ../../library/logging.rst:320 +#: ../../library/logging.rst:321 msgid "" "2006-02-08 22:20:02,165 192.168.0.1 fbloggs Protocol problem: connection " "reset" msgstr "" -#: ../../library/logging.rst:324 +#: ../../library/logging.rst:325 msgid "" "The keys in the dictionary passed in *extra* should not clash with the keys " "used by the logging system. (See the section on :ref:`logrecord-attributes` " "for more information on which keys are used by the logging system.)" msgstr "" -#: ../../library/logging.rst:328 +#: ../../library/logging.rst:329 msgid "" "If you choose to use these attributes in logged messages, you need to " "exercise some care. In the above example, for instance, the :class:" @@ -512,7 +512,7 @@ msgid "" "dictionary with these keys." msgstr "" -#: ../../library/logging.rst:335 +#: ../../library/logging.rst:336 msgid "" "While this might be annoying, this feature is intended for use in " "specialized circumstances, such as multi-threaded servers where the same " @@ -523,32 +523,32 @@ msgid "" "particular :class:`Handler`\\ s." msgstr "" -#: ../../library/logging.rst:342 +#: ../../library/logging.rst:343 msgid "" "If no handler is attached to this logger (or any of its ancestors, taking " "into account the relevant :attr:`Logger.propagate` attributes), the message " "will be sent to the handler set on :attr:`lastResort`." msgstr "" -#: ../../library/logging.rst:346 +#: ../../library/logging.rst:347 msgid "The *stack_info* parameter was added." msgstr "新增 *stack_info* 參數。" -#: ../../library/logging.rst:349 +#: ../../library/logging.rst:350 msgid "The *exc_info* parameter can now accept exception instances." msgstr "" -#: ../../library/logging.rst:352 +#: ../../library/logging.rst:353 msgid "The *stacklevel* parameter was added." msgstr "新增 *stacklevel* 參數。" -#: ../../library/logging.rst:358 +#: ../../library/logging.rst:359 msgid "" "Logs a message with level :const:`INFO` on this logger. The arguments are " "interpreted as for :meth:`debug`." msgstr "" -#: ../../library/logging.rst:364 +#: ../../library/logging.rst:365 msgid "" "Logs a message with level :const:`WARNING` on this logger. The arguments are " "interpreted as for :meth:`debug`." @@ -556,47 +556,47 @@ msgstr "" "在此記錄器上記錄一條層級為 :const:`WARNING` 的訊息。這些引數被直譯的方式與 :" "meth:`debug` 相同。" -#: ../../library/logging.rst:367 +#: ../../library/logging.rst:368 msgid "" "There is an obsolete method ``warn`` which is functionally identical to " "``warning``. As ``warn`` is deprecated, please do not use it - use " "``warning`` instead." msgstr "" -#: ../../library/logging.rst:373 +#: ../../library/logging.rst:374 msgid "" "Logs a message with level :const:`ERROR` on this logger. The arguments are " "interpreted as for :meth:`debug`." msgstr "" -#: ../../library/logging.rst:379 +#: ../../library/logging.rst:380 msgid "" "Logs a message with level :const:`CRITICAL` on this logger. The arguments " "are interpreted as for :meth:`debug`." msgstr "" -#: ../../library/logging.rst:385 +#: ../../library/logging.rst:386 msgid "" "Logs a message with integer level *level* on this logger. The other " "arguments are interpreted as for :meth:`debug`." msgstr "" -#: ../../library/logging.rst:391 +#: ../../library/logging.rst:392 msgid "" "Logs a message with level :const:`ERROR` on this logger. The arguments are " "interpreted as for :meth:`debug`. Exception info is added to the logging " "message. This method should only be called from an exception handler." msgstr "" -#: ../../library/logging.rst:398 +#: ../../library/logging.rst:399 msgid "Adds the specified filter *filter* to this logger." msgstr "在該 logger 內增加指定的 filter *filter*。" -#: ../../library/logging.rst:403 +#: ../../library/logging.rst:404 msgid "Removes the specified filter *filter* from this logger." msgstr "在該 logger 內移除指定的 filter *filter*。" -#: ../../library/logging.rst:408 +#: ../../library/logging.rst:409 msgid "" "Apply this logger's filters to the record and return ``True`` if the record " "is to be processed. The filters are consulted in turn, until one of them " @@ -605,22 +605,22 @@ msgid "" "processing of the record occurs." msgstr "" -#: ../../library/logging.rst:417 +#: ../../library/logging.rst:418 msgid "Adds the specified handler *hdlr* to this logger." msgstr "" -#: ../../library/logging.rst:422 +#: ../../library/logging.rst:423 msgid "Removes the specified handler *hdlr* from this logger." msgstr "" -#: ../../library/logging.rst:427 +#: ../../library/logging.rst:428 msgid "" "Finds the caller's source filename and line number. Returns the filename, " "line number, function name and stack information as a 4-element tuple. The " "stack information is returned as ``None`` unless *stack_info* is ``True``." msgstr "" -#: ../../library/logging.rst:431 +#: ../../library/logging.rst:432 msgid "" "The *stacklevel* parameter is passed from code calling the :meth:`debug` and " "other APIs. If greater than 1, the excess is used to skip stack frames " @@ -630,7 +630,7 @@ msgid "" "calls it." msgstr "" -#: ../../library/logging.rst:441 +#: ../../library/logging.rst:442 msgid "" "Handles a record by passing it to all handlers associated with this logger " "and its ancestors (until a false value of *propagate* is found). This method " @@ -639,13 +639,13 @@ msgid "" "filter`." msgstr "" -#: ../../library/logging.rst:449 +#: ../../library/logging.rst:450 msgid "" "This is a factory method which can be overridden in subclasses to create " "specialized :class:`LogRecord` instances." msgstr "" -#: ../../library/logging.rst:454 +#: ../../library/logging.rst:455 msgid "" "Checks to see if this logger has any handlers configured. This is done by " "looking for handlers in this logger and its parents in the logger hierarchy. " @@ -655,15 +655,15 @@ msgid "" "the existence of handlers." msgstr "" -#: ../../library/logging.rst:463 +#: ../../library/logging.rst:464 msgid "Loggers can now be pickled and unpickled." msgstr "" -#: ../../library/logging.rst:469 +#: ../../library/logging.rst:470 msgid "Logging Levels" msgstr "" -#: ../../library/logging.rst:471 +#: ../../library/logging.rst:472 msgid "" "The numeric values of logging levels are given in the following table. These " "are primarily of interest if you want to define your own levels, and need " @@ -672,83 +672,83 @@ msgid "" "value; the predefined name is lost." msgstr "" -#: ../../library/logging.rst:478 +#: ../../library/logging.rst:479 msgid "Level" msgstr "" -#: ../../library/logging.rst:478 +#: ../../library/logging.rst:479 msgid "Numeric value" msgstr "" -#: ../../library/logging.rst:478 +#: ../../library/logging.rst:479 msgid "What it means / When to use it" msgstr "" -#: ../../library/logging.rst:480 +#: ../../library/logging.rst:481 msgid "0" msgstr "0" -#: ../../library/logging.rst:480 +#: ../../library/logging.rst:481 msgid "" "When set on a logger, indicates that ancestor loggers are to be consulted to " "determine the effective level. If that still resolves to :const:`!NOTSET`, " "then all events are logged. When set on a handler, all events are handled." msgstr "" -#: ../../library/logging.rst:488 +#: ../../library/logging.rst:489 msgid "10" msgstr "10" -#: ../../library/logging.rst:488 +#: ../../library/logging.rst:489 msgid "" "Detailed information, typically only of interest to a developer trying to " "diagnose a problem." msgstr "" -#: ../../library/logging.rst:492 +#: ../../library/logging.rst:493 msgid "20" msgstr "20" -#: ../../library/logging.rst:492 +#: ../../library/logging.rst:493 msgid "Confirmation that things are working as expected." msgstr "" -#: ../../library/logging.rst:495 +#: ../../library/logging.rst:496 msgid "30" msgstr "30" -#: ../../library/logging.rst:495 +#: ../../library/logging.rst:496 msgid "" "An indication that something unexpected happened, or that a problem might " "occur in the near future (e.g. 'disk space low'). The software is still " "working as expected." msgstr "" -#: ../../library/logging.rst:502 +#: ../../library/logging.rst:503 msgid "40" msgstr "40" -#: ../../library/logging.rst:502 +#: ../../library/logging.rst:503 msgid "" "Due to a more serious problem, the software has not been able to perform " "some function." msgstr "" -#: ../../library/logging.rst:506 +#: ../../library/logging.rst:507 msgid "50" msgstr "50" -#: ../../library/logging.rst:506 +#: ../../library/logging.rst:507 msgid "" "A serious error, indicating that the program itself may be unable to " "continue running." msgstr "" -#: ../../library/logging.rst:515 +#: ../../library/logging.rst:516 msgid "Handler Objects" msgstr "" -#: ../../library/logging.rst:517 +#: ../../library/logging.rst:518 msgid "" "Handlers have the following attributes and methods. Note that :class:" "`Handler` is never instantiated directly; this class acts as a base for more " @@ -756,53 +756,53 @@ msgid "" "to call :meth:`Handler.__init__`." msgstr "" -#: ../../library/logging.rst:526 +#: ../../library/logging.rst:527 msgid "" "Initializes the :class:`Handler` instance by setting its level, setting the " "list of filters to the empty list and creating a lock (using :meth:" "`createLock`) for serializing access to an I/O mechanism." msgstr "" -#: ../../library/logging.rst:533 +#: ../../library/logging.rst:534 msgid "" "Initializes a thread lock which can be used to serialize access to " "underlying I/O functionality which may not be threadsafe." msgstr "" -#: ../../library/logging.rst:539 +#: ../../library/logging.rst:540 msgid "Acquires the thread lock created with :meth:`createLock`." msgstr "" -#: ../../library/logging.rst:544 +#: ../../library/logging.rst:545 msgid "Releases the thread lock acquired with :meth:`acquire`." msgstr "" -#: ../../library/logging.rst:549 +#: ../../library/logging.rst:550 msgid "" "Sets the threshold for this handler to *level*. Logging messages which are " "less severe than *level* will be ignored. When a handler is created, the " "level is set to :const:`NOTSET` (which causes all messages to be processed)." msgstr "" -#: ../../library/logging.rst:556 +#: ../../library/logging.rst:557 msgid "" "The *level* parameter now accepts a string representation of the level such " "as 'INFO' as an alternative to the integer constants such as :const:`INFO`." msgstr "" -#: ../../library/logging.rst:564 +#: ../../library/logging.rst:565 msgid "Sets the :class:`Formatter` for this handler to *fmt*." msgstr "" -#: ../../library/logging.rst:569 +#: ../../library/logging.rst:570 msgid "Adds the specified filter *filter* to this handler." msgstr "" -#: ../../library/logging.rst:574 +#: ../../library/logging.rst:575 msgid "Removes the specified filter *filter* from this handler." msgstr "" -#: ../../library/logging.rst:579 +#: ../../library/logging.rst:580 msgid "" "Apply this handler's filters to the record and return ``True`` if the record " "is to be processed. The filters are consulted in turn, until one of them " @@ -811,13 +811,13 @@ msgid "" "record." msgstr "" -#: ../../library/logging.rst:588 +#: ../../library/logging.rst:589 msgid "" "Ensure all logging output has been flushed. This version does nothing and is " "intended to be implemented by subclasses." msgstr "" -#: ../../library/logging.rst:594 +#: ../../library/logging.rst:595 msgid "" "Tidy up any resources used by the handler. This version does no output but " "removes the handler from an internal list of handlers which is closed when :" @@ -825,14 +825,14 @@ msgid "" "from overridden :meth:`close` methods." msgstr "" -#: ../../library/logging.rst:602 +#: ../../library/logging.rst:603 msgid "" "Conditionally emits the specified logging record, depending on filters which " "may have been added to the handler. Wraps the actual emission of the record " "with acquisition/release of the I/O thread lock." msgstr "" -#: ../../library/logging.rst:609 +#: ../../library/logging.rst:610 msgid "" "This method should be called from handlers when an exception is encountered " "during an :meth:`emit` call. If the module-level attribute :data:" @@ -845,20 +845,20 @@ msgid "" "is more useful during development)." msgstr "" -#: ../../library/logging.rst:622 +#: ../../library/logging.rst:623 msgid "" "Do formatting for a record - if a formatter is set, use it. Otherwise, use " "the default formatter for the module." msgstr "" -#: ../../library/logging.rst:628 +#: ../../library/logging.rst:629 msgid "" "Do whatever it takes to actually log the specified logging record. This " "version is intended to be implemented by subclasses and so raises a :exc:" "`NotImplementedError`." msgstr "" -#: ../../library/logging.rst:632 +#: ../../library/logging.rst:633 msgid "" "This method is called after a handler-level lock is acquired, which is " "released after this method returns. When you override this method, note that " @@ -867,13 +867,13 @@ msgid "" "Specifically:" msgstr "" -#: ../../library/logging.rst:638 +#: ../../library/logging.rst:639 msgid "" "Logging configuration APIs acquire the module-level lock, and then " "individual handler-level locks as those handlers are configured." msgstr "" -#: ../../library/logging.rst:641 +#: ../../library/logging.rst:642 msgid "" "Many logging APIs lock the module-level lock. If such an API is called from " "this method, it could cause a deadlock if a configuration call is made on " @@ -883,16 +883,16 @@ msgid "" "method, the handler-level lock has already been acquired)." msgstr "" -#: ../../library/logging.rst:648 +#: ../../library/logging.rst:649 msgid "" "For a list of handlers included as standard, see :mod:`logging.handlers`." msgstr "" -#: ../../library/logging.rst:653 +#: ../../library/logging.rst:654 msgid "Formatter Objects" msgstr "" -#: ../../library/logging.rst:659 +#: ../../library/logging.rst:660 msgid "" "Responsible for converting a :class:`LogRecord` to an output string to be " "interpreted by a human or external system." @@ -902,7 +902,7 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/logging.rst:662 +#: ../../library/logging.rst:663 msgid "" "A format string in the given *style* for the logged output as a whole. The " "possible mapping keys are drawn from the :class:`LogRecord` object's :ref:" @@ -910,14 +910,14 @@ msgid "" "is just the logged message." msgstr "" -#: ../../library/logging.rst:670 +#: ../../library/logging.rst:671 msgid "" "A format string in the given *style* for the date/time portion of the logged " "output. If not specified, the default described in :meth:`formatTime` is " "used." msgstr "" -#: ../../library/logging.rst:675 +#: ../../library/logging.rst:676 msgid "" "Can be one of ``'%'``, ``'{'`` or ``'$'`` and determines how the format " "string will be merged with its data: using one of :ref:`old-string-" @@ -928,32 +928,32 @@ msgid "" "use ``{``- and ``$``-formatting for log messages." msgstr "" -#: ../../library/logging.rst:685 +#: ../../library/logging.rst:686 msgid "" "If ``True`` (the default), incorrect or mismatched *fmt* and *style* will " "raise a :exc:`ValueError`; for example, ``logging.Formatter('%(asctime)s - " "%(message)s', style='{')``." msgstr "" -#: ../../library/logging.rst:690 +#: ../../library/logging.rst:691 msgid "" "A dictionary with default values to use in custom fields. For example, " "``logging.Formatter('%(ip)s %(message)s', defaults={\"ip\": None})``" msgstr "" -#: ../../library/logging.rst:695 +#: ../../library/logging.rst:696 msgid "Added the *style* parameter." msgstr "新增 *style* 參數。" -#: ../../library/logging.rst:698 +#: ../../library/logging.rst:699 msgid "Added the *validate* parameter." msgstr "新增 *validate* 參數。" -#: ../../library/logging.rst:701 +#: ../../library/logging.rst:702 msgid "Added the *defaults* parameter." msgstr "新增 *defaults* 參數。" -#: ../../library/logging.rst:707 +#: ../../library/logging.rst:708 msgid "" "The record's attribute dictionary is used as the operand to a string " "formatting operation. Returns the resulting string. Before formatting the " @@ -972,13 +972,13 @@ msgid "" "recalculates it afresh." msgstr "" -#: ../../library/logging.rst:723 +#: ../../library/logging.rst:724 msgid "" "If stack information is available, it's appended after the exception " "information, using :meth:`formatStack` to transform it if necessary." msgstr "" -#: ../../library/logging.rst:729 +#: ../../library/logging.rst:730 msgid "" "This method should be called from :meth:`format` by a formatter which wants " "to make use of a formatted time. This method can be overridden in formatters " @@ -991,7 +991,7 @@ msgid "" "resulting string is returned." msgstr "" -#: ../../library/logging.rst:739 +#: ../../library/logging.rst:740 msgid "" "This function uses a user-configurable function to convert the creation time " "to a tuple. By default, :func:`time.localtime` is used; to change this for a " @@ -1001,7 +1001,7 @@ msgid "" "be shown in GMT, set the ``converter`` attribute in the ``Formatter`` class." msgstr "" -#: ../../library/logging.rst:747 +#: ../../library/logging.rst:748 msgid "" "Previously, the default format was hard-coded as in this example: " "``2010-09-06 22:38:15,292`` where the part before the comma is handled by a " @@ -1016,11 +1016,11 @@ msgid "" "the millisecond value)." msgstr "" -#: ../../library/logging.rst:760 +#: ../../library/logging.rst:761 msgid "The ``default_msec_format`` can be ``None``." msgstr "" -#: ../../library/logging.rst:765 +#: ../../library/logging.rst:766 msgid "" "Formats the specified exception information (a standard exception tuple as " "returned by :func:`sys.exc_info`) as a string. This default implementation " @@ -1028,14 +1028,14 @@ msgid "" "returned." msgstr "" -#: ../../library/logging.rst:772 +#: ../../library/logging.rst:773 msgid "" "Formats the specified stack information (a string as returned by :func:" "`traceback.print_stack`, but with the last newline removed) as a string. " "This default implementation just returns the input value." msgstr "" -#: ../../library/logging.rst:778 +#: ../../library/logging.rst:779 msgid "" "A base formatter class suitable for subclassing when you want to format a " "number of records. You can pass a :class:`Formatter` instance which you want " @@ -1044,7 +1044,7 @@ msgid "" "used as the line formatter." msgstr "" -#: ../../library/logging.rst:786 +#: ../../library/logging.rst:787 msgid "" "Return a header for a list of *records*. The base implementation just " "returns the empty string. You will need to override this method if you want " @@ -1052,14 +1052,14 @@ msgid "" "separator line." msgstr "" -#: ../../library/logging.rst:793 +#: ../../library/logging.rst:794 msgid "" "Return a footer for a list of *records*. The base implementation just " "returns the empty string. You will need to override this method if you want " "specific behaviour, e.g. to show the count of records or a separator line." msgstr "" -#: ../../library/logging.rst:800 +#: ../../library/logging.rst:801 msgid "" "Return formatted text for a list of *records*. The base implementation just " "returns the empty string if there are no records; otherwise, it returns the " @@ -1067,11 +1067,11 @@ msgid "" "and the footer." msgstr "" -#: ../../library/logging.rst:808 +#: ../../library/logging.rst:809 msgid "Filter Objects" msgstr "" -#: ../../library/logging.rst:810 +#: ../../library/logging.rst:811 msgid "" "``Filters`` can be used by ``Handlers`` and ``Loggers`` for more " "sophisticated filtering than is provided by levels. The base filter class " @@ -1081,7 +1081,7 @@ msgid "" "If initialized with the empty string, all events are passed." msgstr "" -#: ../../library/logging.rst:820 +#: ../../library/logging.rst:821 msgid "" "Returns an instance of the :class:`Filter` class. If *name* is specified, it " "names a logger which, together with its children, will have its events " @@ -1089,7 +1089,7 @@ msgid "" "event." msgstr "" -#: ../../library/logging.rst:827 +#: ../../library/logging.rst:828 msgid "" "Is the specified record to be logged? Returns false for no, true for yes. " "Filters can either modify log records in-place or return a completely " @@ -1097,7 +1097,7 @@ msgid "" "future processing of the event." msgstr "" -#: ../../library/logging.rst:832 +#: ../../library/logging.rst:833 msgid "" "Note that filters attached to handlers are consulted before an event is " "emitted by the handler, whereas filters attached to loggers are consulted " @@ -1107,13 +1107,13 @@ msgid "" "setting, unless the filter has also been applied to those descendant loggers." msgstr "" -#: ../../library/logging.rst:839 +#: ../../library/logging.rst:840 msgid "" "You don't actually need to subclass ``Filter``: you can pass any instance " "which has a ``filter`` method with the same semantics." msgstr "" -#: ../../library/logging.rst:842 +#: ../../library/logging.rst:843 msgid "" "You don't need to create specialized ``Filter`` classes, or use other " "classes with a ``filter`` method: you can use a function (or other callable) " @@ -1124,7 +1124,7 @@ msgid "" "value should conform to that returned by :meth:`~Filter.filter`." msgstr "" -#: ../../library/logging.rst:852 +#: ../../library/logging.rst:853 msgid "" "You can now return a :class:`LogRecord` instance from filters to replace the " "log record rather than modifying it in place. This allows filters attached " @@ -1132,7 +1132,7 @@ msgid "" "having side effects on other handlers." msgstr "" -#: ../../library/logging.rst:858 +#: ../../library/logging.rst:859 msgid "" "Although filters are used primarily to filter records based on more " "sophisticated criteria than levels, they get to see every record which is " @@ -1144,11 +1144,11 @@ msgid "" "contextual information into logs (see :ref:`filters-contextual`)." msgstr "" -#: ../../library/logging.rst:871 +#: ../../library/logging.rst:872 msgid "LogRecord Objects" msgstr "LogRecord 物件" -#: ../../library/logging.rst:873 +#: ../../library/logging.rst:874 msgid "" ":class:`LogRecord` instances are created automatically by the :class:" "`Logger` every time something is logged, and can be created manually via :" @@ -1156,17 +1156,17 @@ msgid "" "wire)." msgstr "" -#: ../../library/logging.rst:881 +#: ../../library/logging.rst:882 msgid "Contains all the information pertinent to the event being logged." msgstr "" -#: ../../library/logging.rst:883 +#: ../../library/logging.rst:884 msgid "" "The primary information is passed in *msg* and *args*, which are combined " "using ``msg % args`` to create the :attr:`!message` attribute of the record." msgstr "" -#: ../../library/logging.rst:887 +#: ../../library/logging.rst:888 msgid "" "The name of the logger used to log the event represented by this :class:`!" "LogRecord`. Note that the logger name in the :class:`!LogRecord` will always " @@ -1174,7 +1174,7 @@ msgid "" "different (ancestor) logger." msgstr "" -#: ../../library/logging.rst:895 +#: ../../library/logging.rst:896 msgid "" "The :ref:`numeric level ` of the logging event (such as ``10`` for " "``DEBUG``, ``20`` for ``INFO``, etc). Note that this is converted to *two* " @@ -1182,46 +1182,46 @@ msgid "" "attr:`!levelname` for the corresponding level name." msgstr "" -#: ../../library/logging.rst:902 +#: ../../library/logging.rst:903 msgid "" "The full string path of the source file where the logging call was made." msgstr "" -#: ../../library/logging.rst:906 +#: ../../library/logging.rst:907 msgid "The line number in the source file where the logging call was made." msgstr "" -#: ../../library/logging.rst:910 +#: ../../library/logging.rst:911 msgid "" "The event description message, which can be a %-format string with " "placeholders for variable data, or an arbitrary object (see :ref:`arbitrary-" "object-messages`)." msgstr "" -#: ../../library/logging.rst:915 +#: ../../library/logging.rst:916 msgid "" "Variable data to merge into the *msg* argument to obtain the event " "description." msgstr "" -#: ../../library/logging.rst:919 +#: ../../library/logging.rst:920 msgid "" "An exception tuple with the current exception information, as returned by :" "func:`sys.exc_info`, or ``None`` if no exception information is available." msgstr "" -#: ../../library/logging.rst:924 +#: ../../library/logging.rst:925 msgid "" "The name of the function or method from which the logging call was invoked." msgstr "" -#: ../../library/logging.rst:928 +#: ../../library/logging.rst:929 msgid "" "A text string representing stack information from the base of the stack in " "the current thread, up to the logging call." msgstr "" -#: ../../library/logging.rst:935 +#: ../../library/logging.rst:936 msgid "" "Returns the message for this :class:`LogRecord` instance after merging any " "user-supplied arguments with the message. If the user-supplied message " @@ -1230,7 +1230,7 @@ msgid "" "whose ``__str__`` method can return the actual format string to be used." msgstr "" -#: ../../library/logging.rst:942 +#: ../../library/logging.rst:943 msgid "" "The creation of a :class:`LogRecord` has been made more configurable by " "providing a factory which is used to create the record. The factory can be " @@ -1238,13 +1238,13 @@ msgid "" "this for the factory's signature)." msgstr "" -#: ../../library/logging.rst:948 +#: ../../library/logging.rst:949 msgid "" "This functionality can be used to inject your own values into a :class:" "`LogRecord` at creation time. You can use the following pattern::" msgstr "" -#: ../../library/logging.rst:951 +#: ../../library/logging.rst:952 msgid "" "old_factory = logging.getLogRecordFactory()\n" "\n" @@ -1264,18 +1264,18 @@ msgstr "" "\n" "logging.setLogRecordFactory(record_factory)" -#: ../../library/logging.rst:960 +#: ../../library/logging.rst:961 msgid "" "With this pattern, multiple factories could be chained, and as long as they " "don't overwrite each other's attributes or unintentionally overwrite the " "standard attributes listed above, there should be no surprises." msgstr "" -#: ../../library/logging.rst:969 +#: ../../library/logging.rst:970 msgid "LogRecord attributes" -msgstr "" +msgstr "LogRecord 屬性" -#: ../../library/logging.rst:971 +#: ../../library/logging.rst:972 msgid "" "The LogRecord has a number of attributes, most of which are derived from the " "parameters to the constructor. (Note that the names do not always correspond " @@ -1286,7 +1286,7 @@ msgid "" "style format string." msgstr "" -#: ../../library/logging.rst:979 +#: ../../library/logging.rst:980 msgid "" "If you are using {}-formatting (:func:`str.format`), you can use ``{attrname}" "`` as the placeholder in the format string. If you are using $-formatting (:" @@ -1294,7 +1294,7 @@ msgid "" "course, replace ``attrname`` with the actual attribute name you want to use." msgstr "" -#: ../../library/logging.rst:985 +#: ../../library/logging.rst:986 msgid "" "In the case of {}-formatting, you can specify formatting flags by placing " "them after the attribute name, separated from it with a colon. For example: " @@ -1303,318 +1303,318 @@ msgid "" "on the options available to you." msgstr "" -#: ../../library/logging.rst:992 +#: ../../library/logging.rst:993 msgid "Attribute name" -msgstr "" +msgstr "屬性名稱" -#: ../../library/logging.rst:992 ../../library/logging.rst:1362 +#: ../../library/logging.rst:993 ../../library/logging.rst:1363 msgid "Format" msgstr "格式" -#: ../../library/logging.rst:992 ../../library/logging.rst:1362 +#: ../../library/logging.rst:993 ../../library/logging.rst:1363 msgid "Description" msgstr "描述" -#: ../../library/logging.rst:0 ../../library/logging.rst:994 +#: ../../library/logging.rst:0 ../../library/logging.rst:995 msgid "args" -msgstr "" +msgstr "args" -#: ../../library/logging.rst:994 ../../library/logging.rst:1008 -#: ../../library/logging.rst:1036 ../../library/logging.rst:1054 +#: ../../library/logging.rst:995 ../../library/logging.rst:1009 +#: ../../library/logging.rst:1037 ../../library/logging.rst:1055 msgid "You shouldn't need to format this yourself." msgstr "你不應該需要自己格式化它。" -#: ../../library/logging.rst:994 +#: ../../library/logging.rst:995 msgid "" "The tuple of arguments merged into ``msg`` to produce ``message``, or a dict " "whose values are used for the merge (when there is only one argument, and it " "is a dictionary)." msgstr "" -#: ../../library/logging.rst:999 +#: ../../library/logging.rst:1000 msgid "asctime" -msgstr "" +msgstr "asctime" -#: ../../library/logging.rst:999 +#: ../../library/logging.rst:1000 msgid "``%(asctime)s``" msgstr "``%(asctime)s``" -#: ../../library/logging.rst:999 +#: ../../library/logging.rst:1000 msgid "" "Human-readable time when the :class:`LogRecord` was created. By default " "this is of the form '2003-07-08 16:49:45,896' (the numbers after the comma " "are millisecond portion of the time)." msgstr "" -#: ../../library/logging.rst:1005 +#: ../../library/logging.rst:1006 msgid "created" -msgstr "" +msgstr "created" -#: ../../library/logging.rst:1005 +#: ../../library/logging.rst:1006 msgid "``%(created)f``" msgstr "``%(created)f``" -#: ../../library/logging.rst:1005 +#: ../../library/logging.rst:1006 msgid "" "Time when the :class:`LogRecord` was created (as returned by :func:`time." "time_ns` / 1e9)." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1008 +#: ../../library/logging.rst:0 ../../library/logging.rst:1009 msgid "exc_info" msgstr "exc_info" -#: ../../library/logging.rst:1008 +#: ../../library/logging.rst:1009 msgid "" "Exception tuple (à la ``sys.exc_info``) or, if no exception has occurred, " "``None``." msgstr "" -#: ../../library/logging.rst:1011 +#: ../../library/logging.rst:1012 msgid "filename" msgstr "filename" -#: ../../library/logging.rst:1011 +#: ../../library/logging.rst:1012 msgid "``%(filename)s``" msgstr "``%(filename)s``" -#: ../../library/logging.rst:1011 +#: ../../library/logging.rst:1012 msgid "Filename portion of ``pathname``." -msgstr "" +msgstr "``pathname`` 的檔案名稱部分。" -#: ../../library/logging.rst:1013 +#: ../../library/logging.rst:1014 msgid "funcName" -msgstr "" +msgstr "funcName" -#: ../../library/logging.rst:1013 +#: ../../library/logging.rst:1014 msgid "``%(funcName)s``" msgstr "``%(funcName)s``" -#: ../../library/logging.rst:1013 +#: ../../library/logging.rst:1014 msgid "Name of function containing the logging call." msgstr "" -#: ../../library/logging.rst:1015 +#: ../../library/logging.rst:1016 msgid "levelname" -msgstr "" +msgstr "levelname" -#: ../../library/logging.rst:1015 +#: ../../library/logging.rst:1016 msgid "``%(levelname)s``" msgstr "``%(levelname)s``" -#: ../../library/logging.rst:1015 +#: ../../library/logging.rst:1016 msgid "" "Text logging level for the message (``'DEBUG'``, ``'INFO'``, ``'WARNING'``, " "``'ERROR'``, ``'CRITICAL'``)." msgstr "" -#: ../../library/logging.rst:1019 +#: ../../library/logging.rst:1020 msgid "levelno" -msgstr "" +msgstr "levelno" -#: ../../library/logging.rst:1019 +#: ../../library/logging.rst:1020 msgid "``%(levelno)s``" msgstr "``%(levelno)s``" -#: ../../library/logging.rst:1019 +#: ../../library/logging.rst:1020 msgid "" "Numeric logging level for the message (:const:`DEBUG`, :const:`INFO`, :const:" "`WARNING`, :const:`ERROR`, :const:`CRITICAL`)." msgstr "" -#: ../../library/logging.rst:1024 +#: ../../library/logging.rst:1025 msgid "lineno" -msgstr "" +msgstr "lineno" -#: ../../library/logging.rst:1024 +#: ../../library/logging.rst:1025 msgid "``%(lineno)d``" msgstr "``%(lineno)d``" -#: ../../library/logging.rst:1024 +#: ../../library/logging.rst:1025 msgid "Source line number where the logging call was issued (if available)." msgstr "" -#: ../../library/logging.rst:1027 +#: ../../library/logging.rst:1028 msgid "message" -msgstr "" +msgstr "message" -#: ../../library/logging.rst:1027 +#: ../../library/logging.rst:1028 msgid "``%(message)s``" msgstr "``%(message)s``" -#: ../../library/logging.rst:1027 +#: ../../library/logging.rst:1028 msgid "" "The logged message, computed as ``msg % args``. This is set when :meth:" "`Formatter.format` is invoked." msgstr "" -#: ../../library/logging.rst:1031 +#: ../../library/logging.rst:1032 msgid "module" msgstr "模組" -#: ../../library/logging.rst:1031 +#: ../../library/logging.rst:1032 msgid "``%(module)s``" msgstr "``%(module)s``" -#: ../../library/logging.rst:1031 +#: ../../library/logging.rst:1032 msgid "Module (name portion of ``filename``)." -msgstr "" +msgstr "模組(``filename`` 的名稱部分)。" -#: ../../library/logging.rst:1033 +#: ../../library/logging.rst:1034 msgid "msecs" -msgstr "" +msgstr "msecs" -#: ../../library/logging.rst:1033 +#: ../../library/logging.rst:1034 msgid "``%(msecs)d``" msgstr "``%(msecs)d``" -#: ../../library/logging.rst:1033 +#: ../../library/logging.rst:1034 msgid "" "Millisecond portion of the time when the :class:`LogRecord` was created." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1036 +#: ../../library/logging.rst:0 ../../library/logging.rst:1037 msgid "msg" -msgstr "" +msgstr "msg" -#: ../../library/logging.rst:1036 +#: ../../library/logging.rst:1037 msgid "" "The format string passed in the original logging call. Merged with ``args`` " "to produce ``message``, or an arbitrary object (see :ref:`arbitrary-object-" "messages`)." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1041 +#: ../../library/logging.rst:0 ../../library/logging.rst:1042 msgid "name" msgstr "name" -#: ../../library/logging.rst:1041 +#: ../../library/logging.rst:1042 msgid "``%(name)s``" msgstr "``%(name)s``" -#: ../../library/logging.rst:1041 +#: ../../library/logging.rst:1042 msgid "Name of the logger used to log the call." msgstr "" -#: ../../library/logging.rst:1043 +#: ../../library/logging.rst:1044 msgid "pathname" -msgstr "" +msgstr "pathname" -#: ../../library/logging.rst:1043 +#: ../../library/logging.rst:1044 msgid "``%(pathname)s``" msgstr "``%(pathname)s``" -#: ../../library/logging.rst:1043 +#: ../../library/logging.rst:1044 msgid "" "Full pathname of the source file where the logging call was issued (if " "available)." msgstr "" -#: ../../library/logging.rst:1046 +#: ../../library/logging.rst:1047 msgid "process" -msgstr "" +msgstr "process" -#: ../../library/logging.rst:1046 +#: ../../library/logging.rst:1047 msgid "``%(process)d``" msgstr "``%(process)d``" -#: ../../library/logging.rst:1046 +#: ../../library/logging.rst:1047 msgid "Process ID (if available)." -msgstr "" +msgstr "行程 ID(如果可用)。" -#: ../../library/logging.rst:1048 +#: ../../library/logging.rst:1049 msgid "processName" -msgstr "" +msgstr "processName" -#: ../../library/logging.rst:1048 +#: ../../library/logging.rst:1049 msgid "``%(processName)s``" msgstr "``%(processName)s``" -#: ../../library/logging.rst:1048 +#: ../../library/logging.rst:1049 msgid "Process name (if available)." -msgstr "" +msgstr "行程名稱(如果可用)。" -#: ../../library/logging.rst:1050 +#: ../../library/logging.rst:1051 msgid "relativeCreated" -msgstr "" +msgstr "relativeCreated" -#: ../../library/logging.rst:1050 +#: ../../library/logging.rst:1051 msgid "``%(relativeCreated)d``" msgstr "``%(relativeCreated)d``" -#: ../../library/logging.rst:1050 +#: ../../library/logging.rst:1051 msgid "" "Time in milliseconds when the LogRecord was created, relative to the time " "the logging module was loaded." msgstr "" -#: ../../library/logging.rst:1054 +#: ../../library/logging.rst:1055 msgid "stack_info" msgstr "stack_info" -#: ../../library/logging.rst:1054 +#: ../../library/logging.rst:1055 msgid "" "Stack frame information (where available) from the bottom of the stack in " "the current thread, up to and including the stack frame of the logging call " "which resulted in the creation of this record." msgstr "" -#: ../../library/logging.rst:1060 +#: ../../library/logging.rst:1061 msgid "thread" -msgstr "" +msgstr "thread" -#: ../../library/logging.rst:1060 +#: ../../library/logging.rst:1061 msgid "``%(thread)d``" msgstr "``%(thread)d``" -#: ../../library/logging.rst:1060 +#: ../../library/logging.rst:1061 msgid "Thread ID (if available)." -msgstr "" +msgstr "執行緒 ID(如果可用)。" -#: ../../library/logging.rst:1062 +#: ../../library/logging.rst:1063 msgid "threadName" -msgstr "" +msgstr "threadName" -#: ../../library/logging.rst:1062 +#: ../../library/logging.rst:1063 msgid "``%(threadName)s``" msgstr "``%(threadName)s``" -#: ../../library/logging.rst:1062 +#: ../../library/logging.rst:1063 msgid "Thread name (if available)." msgstr "" -#: ../../library/logging.rst:1064 +#: ../../library/logging.rst:1065 msgid "taskName" msgstr "taskName" -#: ../../library/logging.rst:1064 +#: ../../library/logging.rst:1065 msgid "``%(taskName)s``" msgstr "``%(taskName)s``" -#: ../../library/logging.rst:1064 +#: ../../library/logging.rst:1065 msgid ":class:`asyncio.Task` name (if available)." msgstr "" -#: ../../library/logging.rst:1067 +#: ../../library/logging.rst:1068 msgid "*processName* was added." msgstr "新增 *processName*。" -#: ../../library/logging.rst:1070 +#: ../../library/logging.rst:1071 msgid "*taskName* was added." msgstr "新增 *taskName*。" -#: ../../library/logging.rst:1076 +#: ../../library/logging.rst:1077 msgid "LoggerAdapter Objects" msgstr "LoggerAdapter 物件" -#: ../../library/logging.rst:1078 +#: ../../library/logging.rst:1079 msgid "" ":class:`LoggerAdapter` instances are used to conveniently pass contextual " "information into logging calls. For a usage example, see the section on :ref:" "`adding contextual information to your logging output `." msgstr "" -#: ../../library/logging.rst:1084 +#: ../../library/logging.rst:1085 msgid "" "Returns an instance of :class:`LoggerAdapter` initialized with an " "underlying :class:`Logger` instance, a dict-like object (*extra*), and a " @@ -1624,7 +1624,7 @@ msgid "" "calls and only use the one of the :class:`LoggerAdapter` instance" msgstr "" -#: ../../library/logging.rst:1093 +#: ../../library/logging.rst:1094 msgid "" "Modifies the message and/or keyword arguments passed to a logging call in " "order to insert contextual information. This implementation takes the object " @@ -1633,15 +1633,15 @@ msgid "" "(possibly modified) versions of the arguments passed in." msgstr "" -#: ../../library/logging.rst:1101 -msgid "Delegates to the underlying :attr:`!manager`` on *logger*." +#: ../../library/logging.rst:1102 +msgid "Delegates to the underlying :attr:`!manager` on *logger*." msgstr "" -#: ../../library/logging.rst:1105 -msgid "Delegates to the underlying :meth:`!_log`` method on *logger*." +#: ../../library/logging.rst:1106 +msgid "Delegates to the underlying :meth:`!_log` method on *logger*." msgstr "" -#: ../../library/logging.rst:1107 +#: ../../library/logging.rst:1108 msgid "" "In addition to the above, :class:`LoggerAdapter` supports the following " "methods of :class:`Logger`: :meth:`~Logger.debug`, :meth:`~Logger.info`, :" @@ -1653,29 +1653,28 @@ msgid "" "interchangeably." msgstr "" -#: ../../library/logging.rst:1118 +#: ../../library/logging.rst:1119 msgid "" "The :meth:`~Logger.isEnabledFor`, :meth:`~Logger.getEffectiveLevel`, :meth:" "`~Logger.setLevel` and :meth:`~Logger.hasHandlers` methods were added to :" "class:`LoggerAdapter`. These methods delegate to the underlying logger." msgstr "" -#: ../../library/logging.rst:1124 +#: ../../library/logging.rst:1125 msgid "" "Attribute :attr:`!manager` and method :meth:`!_log` were added, which " "delegate to the underlying logger and allow adapters to be nested." msgstr "" -#: ../../library/logging.rst:1129 -#, fuzzy +#: ../../library/logging.rst:1130 msgid "The *merge_extra* argument was added." -msgstr "新增 *force* 引數。" +msgstr "新增 *merge_extra* 引數。" -#: ../../library/logging.rst:1133 +#: ../../library/logging.rst:1134 msgid "Thread Safety" -msgstr "" +msgstr "執行緒安全" -#: ../../library/logging.rst:1135 +#: ../../library/logging.rst:1136 msgid "" "The logging module is intended to be thread-safe without any special work " "needing to be done by its clients. It achieves this though using threading " @@ -1684,7 +1683,7 @@ msgid "" "O." msgstr "" -#: ../../library/logging.rst:1140 +#: ../../library/logging.rst:1141 msgid "" "If you are implementing asynchronous signal handlers using the :mod:`signal` " "module, you may not be able to use logging from within such handlers. This " @@ -1692,17 +1691,17 @@ msgid "" "always re-entrant, and so cannot be invoked from such signal handlers." msgstr "" -#: ../../library/logging.rst:1147 +#: ../../library/logging.rst:1148 msgid "Module-Level Functions" -msgstr "" +msgstr "模組層級函式" -#: ../../library/logging.rst:1149 +#: ../../library/logging.rst:1150 msgid "" "In addition to the classes described above, there are a number of module-" "level functions." msgstr "" -#: ../../library/logging.rst:1155 +#: ../../library/logging.rst:1156 msgid "" "Return a logger with the specified name or, if name is ``None``, return the " "root logger of the hierarchy. If specified, the name is typically a dot-" @@ -1712,14 +1711,14 @@ msgid "" "for not doing that, as mentioned in :ref:`logger`." msgstr "" -#: ../../library/logging.rst:1162 +#: ../../library/logging.rst:1163 msgid "" "All calls to this function with a given name return the same logger " "instance. This means that logger instances never need to be passed between " "different parts of an application." msgstr "" -#: ../../library/logging.rst:1169 +#: ../../library/logging.rst:1170 msgid "" "Return either the standard :class:`Logger` class, or the last class passed " "to :func:`setLoggerClass`. This function may be called from within a new " @@ -1728,43 +1727,45 @@ msgid "" "example::" msgstr "" -#: ../../library/logging.rst:1174 +#: ../../library/logging.rst:1175 msgid "" "class MyLogger(logging.getLoggerClass()):\n" " # ... override behaviour here" msgstr "" +"class MyLogger(logging.getLoggerClass()):\n" +" # ... 在這裡覆蓋其行為" -#: ../../library/logging.rst:1180 +#: ../../library/logging.rst:1181 msgid "Return a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1182 +#: ../../library/logging.rst:1183 msgid "" "This function has been provided, along with :func:`setLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1187 +#: ../../library/logging.rst:1188 msgid "" "See :func:`setLogRecordFactory` for more information about the how the " "factory is called." msgstr "" -#: ../../library/logging.rst:1192 +#: ../../library/logging.rst:1193 msgid "" "This is a convenience function that calls :meth:`Logger.debug`, on the root " "logger. The handling of the arguments is in every way identical to what is " "described in that method." msgstr "" -#: ../../library/logging.rst:1196 +#: ../../library/logging.rst:1197 msgid "" "The only difference is that if the root logger has no handlers, then :func:" "`basicConfig` is called, prior to calling ``debug`` on the root logger." msgstr "" -#: ../../library/logging.rst:1199 +#: ../../library/logging.rst:1200 msgid "" "For very short scripts or quick demonstrations of ``logging`` facilities, " "``debug`` and the other module-level functions may be convenient. However, " @@ -1774,38 +1775,38 @@ msgid "" "described at the beginnning of this documentation." msgstr "" -#: ../../library/logging.rst:1209 +#: ../../library/logging.rst:1210 msgid "" "Logs a message with level :const:`INFO` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1215 +#: ../../library/logging.rst:1216 msgid "" "Logs a message with level :const:`WARNING` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1218 +#: ../../library/logging.rst:1219 msgid "" "There is an obsolete function ``warn`` which is functionally identical to " "``warning``. As ``warn`` is deprecated, please do not use it - use " "``warning`` instead." msgstr "" -#: ../../library/logging.rst:1225 +#: ../../library/logging.rst:1226 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1231 +#: ../../library/logging.rst:1232 msgid "" "Logs a message with level :const:`CRITICAL` on the root logger. The " "arguments and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1237 +#: ../../library/logging.rst:1238 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`. Exception info is " @@ -1813,13 +1814,13 @@ msgid "" "exception handler." msgstr "" -#: ../../library/logging.rst:1243 +#: ../../library/logging.rst:1244 msgid "" "Logs a message with level *level* on the root logger. The arguments and " "behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1248 +#: ../../library/logging.rst:1249 msgid "" "Provides an overriding level *level* for all loggers which takes precedence " "over the logger's own level. When the need arises to temporarily throttle " @@ -1833,7 +1834,7 @@ msgid "" "individual loggers." msgstr "" -#: ../../library/logging.rst:1259 +#: ../../library/logging.rst:1260 msgid "" "Note that if you have defined any custom logging level higher than " "``CRITICAL`` (this is not recommended), you won't be able to rely on the " @@ -1841,13 +1842,13 @@ msgid "" "a suitable value." msgstr "" -#: ../../library/logging.rst:1264 +#: ../../library/logging.rst:1265 msgid "" "The *level* parameter was defaulted to level ``CRITICAL``. See :issue:" "`28524` for more information about this change." msgstr "" -#: ../../library/logging.rst:1270 +#: ../../library/logging.rst:1271 msgid "" "Associates level *level* with text *levelName* in an internal dictionary, " "which is used to map numeric levels to a textual representation, for example " @@ -1857,24 +1858,24 @@ msgid "" "and they should increase in increasing order of severity." msgstr "" -#: ../../library/logging.rst:1277 +#: ../../library/logging.rst:1278 msgid "" "If you are thinking of defining your own levels, please see the section on :" "ref:`custom-levels`." msgstr "" -#: ../../library/logging.rst:1282 +#: ../../library/logging.rst:1283 msgid "" "Returns a mapping from level names to their corresponding logging levels. " "For example, the string \"CRITICAL\" maps to :const:`CRITICAL`. The returned " "mapping is copied from an internal mapping on each call to this function." msgstr "" -#: ../../library/logging.rst:1290 +#: ../../library/logging.rst:1291 msgid "Returns the textual or numeric representation of logging level *level*." msgstr "" -#: ../../library/logging.rst:1292 +#: ../../library/logging.rst:1293 msgid "" "If *level* is one of the predefined levels :const:`CRITICAL`, :const:" "`ERROR`, :const:`WARNING`, :const:`INFO` or :const:`DEBUG` then you get the " @@ -1884,20 +1885,20 @@ msgid "" "the corresponding string representation is returned." msgstr "" -#: ../../library/logging.rst:1299 +#: ../../library/logging.rst:1300 msgid "" "The *level* parameter also accepts a string representation of the level such " "as 'INFO'. In such cases, this functions returns the corresponding numeric " "value of the level." msgstr "" -#: ../../library/logging.rst:1303 +#: ../../library/logging.rst:1304 msgid "" "If no matching numeric or string value is passed in, the string 'Level %s' % " "level is returned." msgstr "" -#: ../../library/logging.rst:1306 +#: ../../library/logging.rst:1307 msgid "" "Levels are internally integers (as they need to be compared in the logging " "logic). This function is used to convert between an integer level and the " @@ -1906,7 +1907,7 @@ msgid "" "vice versa." msgstr "" -#: ../../library/logging.rst:1312 +#: ../../library/logging.rst:1313 msgid "" "In Python versions earlier than 3.4, this function could also be passed a " "text level, and would return the corresponding numeric value of the level. " @@ -1914,17 +1915,17 @@ msgid "" "Python 3.4, but reinstated in 3.4.2 due to retain backward compatibility." msgstr "" -#: ../../library/logging.rst:1320 +#: ../../library/logging.rst:1321 msgid "" "Returns a handler with the specified *name*, or ``None`` if there is no " "handler with that name." msgstr "" -#: ../../library/logging.rst:1327 +#: ../../library/logging.rst:1328 msgid "Returns an immutable set of all known handler names." msgstr "" -#: ../../library/logging.rst:1333 +#: ../../library/logging.rst:1334 msgid "" "Creates and returns a new :class:`LogRecord` instance whose attributes are " "defined by *attrdict*. This function is useful for taking a pickled :class:" @@ -1932,7 +1933,7 @@ msgid "" "as a :class:`LogRecord` instance at the receiving end." msgstr "" -#: ../../library/logging.rst:1341 +#: ../../library/logging.rst:1342 msgid "" "Does basic configuration for the logging system by creating a :class:" "`StreamHandler` with a default :class:`Formatter` and adding it to the root " @@ -1941,13 +1942,13 @@ msgid "" "no handlers are defined for the root logger." msgstr "" -#: ../../library/logging.rst:1347 +#: ../../library/logging.rst:1348 msgid "" "This function does nothing if the root logger already has handlers " "configured, unless the keyword argument *force* is set to ``True``." msgstr "" -#: ../../library/logging.rst:1350 +#: ../../library/logging.rst:1351 msgid "" "This function should be called from the main thread before other threads are " "started. In versions of Python prior to 2.7.1 and 3.2, if this function is " @@ -1956,54 +1957,54 @@ msgid "" "unexpected results such as messages being duplicated in the log." msgstr "" -#: ../../library/logging.rst:1357 +#: ../../library/logging.rst:1358 msgid "The following keyword arguments are supported." -msgstr "" +msgstr "支援以下的關鍵字引數。" -#: ../../library/logging.rst:1364 +#: ../../library/logging.rst:1365 msgid "*filename*" msgstr "*filename*" -#: ../../library/logging.rst:1364 +#: ../../library/logging.rst:1365 msgid "" "Specifies that a :class:`FileHandler` be created, using the specified " "filename, rather than a :class:`StreamHandler`." msgstr "" -#: ../../library/logging.rst:1368 +#: ../../library/logging.rst:1369 msgid "*filemode*" msgstr "*filemode*" -#: ../../library/logging.rst:1368 +#: ../../library/logging.rst:1369 msgid "" "If *filename* is specified, open the file in this :ref:`mode `. " "Defaults to ``'a'``." msgstr "" -#: ../../library/logging.rst:1372 +#: ../../library/logging.rst:1373 msgid "*format*" msgstr "*format*" -#: ../../library/logging.rst:1372 +#: ../../library/logging.rst:1373 msgid "" "Use the specified format string for the handler. Defaults to attributes " "``levelname``, ``name`` and ``message`` separated by colons." msgstr "" -#: ../../library/logging.rst:1377 +#: ../../library/logging.rst:1378 msgid "*datefmt*" msgstr "*datefmt*" -#: ../../library/logging.rst:1377 +#: ../../library/logging.rst:1378 msgid "" "Use the specified date/time format, as accepted by :func:`time.strftime`." msgstr "" -#: ../../library/logging.rst:1380 +#: ../../library/logging.rst:1381 msgid "*style*" msgstr "*style*" -#: ../../library/logging.rst:1380 +#: ../../library/logging.rst:1381 msgid "" "If *format* is specified, use this style for the format string. One of " "``'%'``, ``'{'`` or ``'$'`` for :ref:`printf-style `." msgstr "" -#: ../../library/logging.rst:1391 +#: ../../library/logging.rst:1392 msgid "*stream*" msgstr "*stream*" -#: ../../library/logging.rst:1391 +#: ../../library/logging.rst:1392 msgid "" "Use the specified stream to initialize the :class:`StreamHandler`. Note that " "this argument is incompatible with *filename* - if both are present, a " "``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1397 +#: ../../library/logging.rst:1398 msgid "*handlers*" msgstr "*handlers*" -#: ../../library/logging.rst:1397 +#: ../../library/logging.rst:1398 msgid "" "If specified, this should be an iterable of already created handlers to add " "to the root logger. Any handlers which don't already have a formatter set " @@ -2043,33 +2044,33 @@ msgid "" "present, a ``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1406 +#: ../../library/logging.rst:1407 msgid "*force*" msgstr "*force*" -#: ../../library/logging.rst:1406 +#: ../../library/logging.rst:1407 msgid "" "If this keyword argument is specified as true, any existing handlers " "attached to the root logger are removed and closed, before carrying out the " "configuration as specified by the other arguments." msgstr "" -#: ../../library/logging.rst:1412 +#: ../../library/logging.rst:1413 msgid "*encoding*" msgstr "*encoding*" -#: ../../library/logging.rst:1412 +#: ../../library/logging.rst:1413 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " "the output file." msgstr "" -#: ../../library/logging.rst:1417 +#: ../../library/logging.rst:1418 msgid "*errors*" msgstr "*errors*" -#: ../../library/logging.rst:1417 +#: ../../library/logging.rst:1418 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " @@ -2078,39 +2079,39 @@ msgid "" "`open`, which means that it will be treated the same as passing 'errors'." msgstr "" -#: ../../library/logging.rst:1428 +#: ../../library/logging.rst:1429 msgid "The *style* argument was added." msgstr "新增 *style* 引數。" -#: ../../library/logging.rst:1431 +#: ../../library/logging.rst:1432 msgid "" "The *handlers* argument was added. Additional checks were added to catch " "situations where incompatible arguments are specified (e.g. *handlers* " "together with *stream* or *filename*, or *stream* together with *filename*)." msgstr "" -#: ../../library/logging.rst:1437 +#: ../../library/logging.rst:1438 msgid "The *force* argument was added." msgstr "新增 *force* 引數。" -#: ../../library/logging.rst:1440 +#: ../../library/logging.rst:1441 msgid "The *encoding* and *errors* arguments were added." msgstr "新增 *encoding* 與 *errors* 引數。" -#: ../../library/logging.rst:1445 +#: ../../library/logging.rst:1446 msgid "" "Informs the logging system to perform an orderly shutdown by flushing and " "closing all handlers. This should be called at application exit and no " "further use of the logging system should be made after this call." msgstr "" -#: ../../library/logging.rst:1449 +#: ../../library/logging.rst:1450 msgid "" "When the logging module is imported, it registers this function as an exit " "handler (see :mod:`atexit`), so normally there's no need to do that manually." msgstr "" -#: ../../library/logging.rst:1456 +#: ../../library/logging.rst:1457 msgid "" "Tells the logging system to use the class *klass* when instantiating a " "logger. The class should define :meth:`!__init__` such that only a name " @@ -2122,32 +2123,32 @@ msgid "" "loggers." msgstr "" -#: ../../library/logging.rst:1467 +#: ../../library/logging.rst:1468 msgid "Set a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1469 +#: ../../library/logging.rst:1470 msgid "The factory callable to be used to instantiate a log record." msgstr "" -#: ../../library/logging.rst:1471 +#: ../../library/logging.rst:1472 msgid "" "This function has been provided, along with :func:`getLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1476 +#: ../../library/logging.rst:1477 msgid "The factory has the following signature:" msgstr "" -#: ../../library/logging.rst:1478 +#: ../../library/logging.rst:1479 msgid "" "``factory(name, level, fn, lno, msg, args, exc_info, func=None, sinfo=None, " "**kwargs)``" msgstr "" -#: ../../library/logging.rst:1480 +#: ../../library/logging.rst:1481 msgid "The logger name." msgstr "" @@ -2155,7 +2156,7 @@ msgstr "" msgid "level" msgstr "" -#: ../../library/logging.rst:1481 +#: ../../library/logging.rst:1482 msgid "The logging level (numeric)." msgstr "" @@ -2163,7 +2164,7 @@ msgstr "" msgid "fn" msgstr "fn" -#: ../../library/logging.rst:1482 +#: ../../library/logging.rst:1483 msgid "The full pathname of the file where the logging call was made." msgstr "" @@ -2171,19 +2172,19 @@ msgstr "" msgid "lno" msgstr "lno" -#: ../../library/logging.rst:1483 +#: ../../library/logging.rst:1484 msgid "The line number in the file where the logging call was made." msgstr "" -#: ../../library/logging.rst:1484 +#: ../../library/logging.rst:1485 msgid "The logging message." msgstr "" -#: ../../library/logging.rst:1485 +#: ../../library/logging.rst:1486 msgid "The arguments for the logging message." msgstr "" -#: ../../library/logging.rst:1486 +#: ../../library/logging.rst:1487 msgid "An exception tuple, or ``None``." msgstr "" @@ -2191,7 +2192,7 @@ msgstr "" msgid "func" msgstr "func" -#: ../../library/logging.rst:1487 +#: ../../library/logging.rst:1488 msgid "The name of the function or method which invoked the logging call." msgstr "" @@ -2199,7 +2200,7 @@ msgstr "" msgid "sinfo" msgstr "sinfo" -#: ../../library/logging.rst:1489 +#: ../../library/logging.rst:1490 msgid "" "A stack traceback such as is provided by :func:`traceback.print_stack`, " "showing the call hierarchy." @@ -2209,15 +2210,15 @@ msgstr "" msgid "kwargs" msgstr "kwargs" -#: ../../library/logging.rst:1491 +#: ../../library/logging.rst:1492 msgid "Additional keyword arguments." msgstr "額外的關鍵字引數。" -#: ../../library/logging.rst:1495 +#: ../../library/logging.rst:1496 msgid "Module-Level Attributes" -msgstr "" +msgstr "模組層級屬性" -#: ../../library/logging.rst:1499 +#: ../../library/logging.rst:1500 msgid "" "A \"handler of last resort\" is available through this attribute. This is a :" "class:`StreamHandler` writing to ``sys.stderr`` with a level of ``WARNING``, " @@ -2228,15 +2229,15 @@ msgid "" "reason, ``lastResort`` can be set to ``None``." msgstr "" -#: ../../library/logging.rst:1511 +#: ../../library/logging.rst:1512 msgid "Used to see if exceptions during handling should be propagated." msgstr "" -#: ../../library/logging.rst:1513 +#: ../../library/logging.rst:1514 msgid "Default: ``True``." msgstr "" -#: ../../library/logging.rst:1515 +#: ../../library/logging.rst:1516 msgid "" "If :data:`raiseExceptions` is ``False``, exceptions get silently ignored. " "This is what is mostly wanted for a logging system - most users will not " @@ -2244,22 +2245,22 @@ msgid "" "application errors." msgstr "" -#: ../../library/logging.rst:1522 +#: ../../library/logging.rst:1523 msgid "Integration with the warnings module" msgstr "" -#: ../../library/logging.rst:1524 +#: ../../library/logging.rst:1525 msgid "" "The :func:`captureWarnings` function can be used to integrate :mod:`logging` " "with the :mod:`warnings` module." msgstr "" -#: ../../library/logging.rst:1529 +#: ../../library/logging.rst:1530 msgid "" "This function is used to turn the capture of warnings by logging on and off." msgstr "" -#: ../../library/logging.rst:1532 +#: ../../library/logging.rst:1533 msgid "" "If *capture* is ``True``, warnings issued by the :mod:`warnings` module will " "be redirected to the logging system. Specifically, a warning will be " @@ -2268,46 +2269,46 @@ msgid "" "`WARNING`." msgstr "" -#: ../../library/logging.rst:1537 +#: ../../library/logging.rst:1538 msgid "" "If *capture* is ``False``, the redirection of warnings to the logging system " "will stop, and warnings will be redirected to their original destinations (i." "e. those in effect before ``captureWarnings(True)`` was called)." msgstr "" -#: ../../library/logging.rst:1544 +#: ../../library/logging.rst:1545 msgid "Module :mod:`logging.config`" -msgstr "" +msgstr ":mod:`logging.config` 模組" -#: ../../library/logging.rst:1545 +#: ../../library/logging.rst:1546 msgid "Configuration API for the logging module." msgstr "" -#: ../../library/logging.rst:1547 +#: ../../library/logging.rst:1548 msgid "Module :mod:`logging.handlers`" -msgstr "" +msgstr ":mod:`logging.handlers` 模組" -#: ../../library/logging.rst:1548 +#: ../../library/logging.rst:1549 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../library/logging.rst:1550 +#: ../../library/logging.rst:1551 msgid ":pep:`282` - A Logging System" msgstr "" -#: ../../library/logging.rst:1551 +#: ../../library/logging.rst:1552 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "" -#: ../../library/logging.rst:1554 +#: ../../library/logging.rst:1555 msgid "" "`Original Python logging package `_" msgstr "" -#: ../../library/logging.rst:1555 +#: ../../library/logging.rst:1556 msgid "" "This is the original source for the :mod:`logging` package. The version of " "the package available from this site is suitable for use with Python 1.5.2, " @@ -2322,6 +2323,3 @@ msgstr "Errors(錯誤)" #: ../../library/logging.rst:12 msgid "logging" msgstr "logging(日誌)" - -#~ msgid "The simplest example:" -#~ msgstr "最簡單的示範:" diff --git a/library/mmap.po b/library/mmap.po index 753e0bb140..2d33ddb42b 100644 --- a/library/mmap.po +++ b/library/mmap.po @@ -19,7 +19,7 @@ msgstr "" #: ../../library/mmap.rst:2 msgid ":mod:`!mmap` --- Memory-mapped file support" -msgstr ":mod:`!mmap` --- 記憶體映射檔案的支援" +msgstr ":mod:`!mmap` --- 記憶體對映檔案的支援" #: ../../includes/wasm-notavail.rst:3 msgid ":ref:`Availability `: not WASI." diff --git a/library/os.po b/library/os.po index 7968086daf..e840cd0740 100644 --- a/library/os.po +++ b/library/os.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+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-" @@ -5238,8 +5238,12 @@ msgid "See the :manpage:`pidfd_open(2)` man page for more details." msgstr "更多細節請見 :manpage:`pidfd_open(2)` 手冊頁。" #: ../../library/os.rst:4575 -msgid ":ref:`Availability `: Linux >= 5.3" -msgstr ":ref:`適用 `:Linux 5.3 以上" +msgid "" +":ref:`Availability `: Linux >= 5.3, Android >= :func:`build-" +"time ` API level 31" +msgstr "" +":ref:`適用 `:Linux 5.3 Android 6.0 以上、Android :func:`build-" +"time ` API level 31 以上" #: ../../library/os.rst:4580 msgid "" @@ -6772,6 +6776,9 @@ msgstr "path separator (POSIX)(路徑分隔器 (POSIX))" msgid "; (semicolon)" msgstr "; (分號)" +#~ msgid ":ref:`Availability `: Linux >= 5.3" +#~ msgstr ":ref:`適用 `:Linux 5.3 以上" + #~ msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." #~ msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" diff --git a/library/pydoc.po b/library/pydoc.po index 405db7041e..d301141ac0 100644 --- a/library/pydoc.po +++ b/library/pydoc.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,8 +36,8 @@ msgstr "" #: ../../library/pydoc.rst:23 msgid "" "For modules, classes, functions and methods, the displayed documentation is " -"derived from the docstring (i.e. the :attr:`!__doc__` attribute) of the " -"object, and recursively of its documentable members. If there is no " +"derived from the docstring (i.e. the :attr:`~definition.__doc__` attribute) " +"of the object, and recursively of its documentable members. If there is no " "docstring, :mod:`!pydoc` tries to obtain a description from the block of " "comment lines just above the definition of the class, function or method in " "the source file, or at the top of the module (see :func:`inspect." diff --git a/library/random.po b/library/random.po index 470f0084d7..08679f4e90 100644 --- a/library/random.po +++ b/library/random.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2023-01-23 22:47+0800\n" "Last-Translator: Allen Wu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1162,7 +1162,7 @@ msgstr "" #: ../../library/random.rst:744 msgid "" -"Print a random floating-point number between 1 and N inclusive, using :meth:" +"Print a random floating-point number between 0 and N inclusive, using :meth:" "`uniform`." msgstr "" diff --git a/library/secrets.po b/library/secrets.po index 2a0d0b4b79..d2bfde8612 100644 --- a/library/secrets.po +++ b/library/secrets.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2022-11-30 13:42+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -78,7 +78,7 @@ msgid "Return a random int in the range [0, *exclusive_upper_bound*)." msgstr "回傳一個 [0, *exclusive_upper_bound*) 範圍之內的隨機整數。" #: ../../library/secrets.rst:55 -msgid "Return an int with *k* random bits." +msgid "Return a non-negative int with *k* random bits." msgstr "回傳一個具 *k* 個隨機位元的非負整數。" #: ../../library/secrets.rst:59 diff --git a/library/shutil.po b/library/shutil.po index ab9054224c..6eab863585 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-26 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -590,12 +590,13 @@ msgstr "" #: ../../library/shutil.rst:452 msgid "" -"*path* is a \"``PATH`` string\" specifying the lookup directory list. When " -"no *path* is specified, the results of :func:`os.environ` are used, " -"returning either the \"PATH\" value or a fallback of :data:`os.defpath`." +"*path* is a \"``PATH`` string\" specifying the directories to look in, " +"delimited by :data:`os.pathsep`. When no *path* is specified, the :envvar:" +"`PATH` environment variable is read from :data:`os.environ`, falling back " +"to :data:`os.defpath` if it is not set." msgstr "" -#: ../../library/shutil.rst:456 +#: ../../library/shutil.rst:457 msgid "" "On Windows, the current directory is prepended to the *path* if *mode* does " "not include ``os.X_OK``. When the *mode* does include ``os.X_OK``, the " @@ -605,16 +606,16 @@ msgid "" "environment variable ``NoDefaultCurrentDirectoryInExePath``." msgstr "" -#: ../../library/shutil.rst:463 +#: ../../library/shutil.rst:464 msgid "" -"Also on Windows, the ``PATHEXT`` variable is used to resolve commands that " -"may not already include an extension. For example, if you call ``shutil." -"which(\"python\")``, :func:`which` will search ``PATHEXT`` to know that it " -"should look for ``python.exe`` within the *path* directories. For example, " -"on Windows::" +"Also on Windows, the :envvar:`PATHEXT` environment variable is used to " +"resolve commands that may not already include an extension. For example, if " +"you call ``shutil.which(\"python\")``, :func:`which` will search ``PATHEXT`` " +"to know that it should look for ``python.exe`` within the *path* " +"directories. For example, on Windows::" msgstr "" -#: ../../library/shutil.rst:469 +#: ../../library/shutil.rst:470 msgid "" ">>> shutil.which(\"python\")\n" "'C:\\\\Python33\\\\python.EXE'" @@ -622,25 +623,25 @@ msgstr "" ">>> shutil.which(\"python\")\n" "'C:\\\\Python33\\\\python.EXE'" -#: ../../library/shutil.rst:472 +#: ../../library/shutil.rst:473 msgid "" "This is also applied when *cmd* is a path that contains a directory " "component::" msgstr "" -#: ../../library/shutil.rst:475 +#: ../../library/shutil.rst:476 msgid "" ">> shutil.which(\"C:\\\\Python33\\\\python\")\n" "'C:\\\\Python33\\\\python.EXE'" msgstr "" -#: ../../library/shutil.rst:480 +#: ../../library/shutil.rst:481 msgid "" "The :class:`bytes` type is now accepted. If *cmd* type is :class:`bytes`, " "the result type is also :class:`bytes`." msgstr "" -#: ../../library/shutil.rst:484 +#: ../../library/shutil.rst:485 msgid "" "On Windows, the current directory is no longer prepended to the search path " "if *mode* includes ``os.X_OK`` and WinAPI " @@ -651,25 +652,25 @@ msgid "" "now be found." msgstr "" -#: ../../library/shutil.rst:493 +#: ../../library/shutil.rst:494 msgid "" "On Windows, if *mode* includes ``os.X_OK``, executables with an extension in " "``PATHEXT`` will be preferred over executables without a matching extension. " "This brings behavior closer to that of Python 3.11." msgstr "" -#: ../../library/shutil.rst:501 +#: ../../library/shutil.rst:502 msgid "" "This exception collects exceptions that are raised during a multi-file " "operation. For :func:`copytree`, the exception argument is a list of 3-" "tuples (*srcname*, *dstname*, *exception*)." msgstr "" -#: ../../library/shutil.rst:508 +#: ../../library/shutil.rst:509 msgid "Platform-dependent efficient copy operations" msgstr "" -#: ../../library/shutil.rst:510 +#: ../../library/shutil.rst:511 msgid "" "Starting from Python 3.8, all functions involving a file copy (:func:" "`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, and :func:" @@ -679,37 +680,37 @@ msgid "" "buffers in Python as in \"``outfd.write(infd.read())``\"." msgstr "" -#: ../../library/shutil.rst:518 +#: ../../library/shutil.rst:519 msgid "On macOS `fcopyfile`_ is used to copy the file content (not metadata)." msgstr "" -#: ../../library/shutil.rst:520 +#: ../../library/shutil.rst:521 msgid "On Linux :func:`os.sendfile` is used." msgstr "" -#: ../../library/shutil.rst:522 +#: ../../library/shutil.rst:523 msgid "" "On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " "instead of 64 KiB) and a :func:`memoryview`-based variant of :func:`shutil." "copyfileobj` is used." msgstr "" -#: ../../library/shutil.rst:526 +#: ../../library/shutil.rst:527 msgid "" "If the fast-copy operation fails and no data was written in the destination " "file then shutil will silently fallback on using less efficient :func:" "`copyfileobj` function internally." msgstr "" -#: ../../library/shutil.rst:535 +#: ../../library/shutil.rst:536 msgid "copytree example" msgstr "" -#: ../../library/shutil.rst:537 +#: ../../library/shutil.rst:538 msgid "An example that uses the :func:`ignore_patterns` helper::" msgstr "" -#: ../../library/shutil.rst:539 +#: ../../library/shutil.rst:540 msgid "" "from shutil import copytree, ignore_patterns\n" "\n" @@ -719,17 +720,17 @@ msgstr "" "\n" "copytree(source, destination, ignore=ignore_patterns('*.pyc', 'tmp*'))" -#: ../../library/shutil.rst:543 +#: ../../library/shutil.rst:544 msgid "" "This will copy everything except ``.pyc`` files and files or directories " "whose name starts with ``tmp``." msgstr "" -#: ../../library/shutil.rst:546 +#: ../../library/shutil.rst:547 msgid "Another example that uses the *ignore* argument to add a logging call::" msgstr "" -#: ../../library/shutil.rst:548 +#: ../../library/shutil.rst:549 msgid "" "from shutil import copytree\n" "import logging\n" @@ -741,11 +742,11 @@ msgid "" "copytree(source, destination, ignore=_logpath)" msgstr "" -#: ../../library/shutil.rst:561 +#: ../../library/shutil.rst:562 msgid "rmtree example" msgstr "rmtree 範例" -#: ../../library/shutil.rst:563 +#: ../../library/shutil.rst:564 msgid "" "This example shows how to remove a directory tree on Windows where some of " "the files have their read-only bit set. It uses the onexc callback to clear " @@ -753,7 +754,7 @@ msgid "" "propagate. ::" msgstr "" -#: ../../library/shutil.rst:568 +#: ../../library/shutil.rst:569 msgid "" "import os, stat\n" "import shutil\n" @@ -766,31 +767,31 @@ msgid "" "shutil.rmtree(directory, onexc=remove_readonly)" msgstr "" -#: ../../library/shutil.rst:581 +#: ../../library/shutil.rst:582 msgid "Archiving operations" msgstr "" -#: ../../library/shutil.rst:585 +#: ../../library/shutil.rst:586 msgid "Added support for the *xztar* format." msgstr "新增 *xztar* 格式的支援。" -#: ../../library/shutil.rst:589 +#: ../../library/shutil.rst:590 msgid "" "High-level utilities to create and read compressed and archived files are " "also provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules." msgstr "" -#: ../../library/shutil.rst:594 +#: ../../library/shutil.rst:595 msgid "Create an archive file (such as zip or tar) and return its name." msgstr "" -#: ../../library/shutil.rst:596 +#: ../../library/shutil.rst:597 msgid "" "*base_name* is the name of the file to create, including the path, minus any " "format-specific extension." msgstr "" -#: ../../library/shutil.rst:599 +#: ../../library/shutil.rst:600 msgid "" "*format* is the archive format: one of \"zip\" (if the :mod:`zlib` module is " "available), \"tar\", \"gztar\" (if the :mod:`zlib` module is available), " @@ -798,14 +799,14 @@ msgid "" "`lzma` module is available)." msgstr "" -#: ../../library/shutil.rst:604 +#: ../../library/shutil.rst:605 msgid "" "*root_dir* is a directory that will be the root directory of the archive, " "all paths in the archive will be relative to it; for example, we typically " "chdir into *root_dir* before creating the archive." msgstr "" -#: ../../library/shutil.rst:608 +#: ../../library/shutil.rst:609 msgid "" "*base_dir* is the directory where we start archiving from; i.e. *base_dir* " "will be the common prefix of all files and directories in the archive. " @@ -813,33 +814,33 @@ msgid "" "example-with-basedir` for how to use *base_dir* and *root_dir* together." msgstr "" -#: ../../library/shutil.rst:614 +#: ../../library/shutil.rst:615 msgid "*root_dir* and *base_dir* both default to the current directory." msgstr "" -#: ../../library/shutil.rst:616 +#: ../../library/shutil.rst:617 msgid "" "If *dry_run* is true, no archive is created, but the operations that would " "be executed are logged to *logger*." msgstr "" -#: ../../library/shutil.rst:619 +#: ../../library/shutil.rst:620 msgid "" "*owner* and *group* are used when creating a tar archive. By default, uses " "the current owner and group." msgstr "" -#: ../../library/shutil.rst:622 +#: ../../library/shutil.rst:623 msgid "" "*logger* must be an object compatible with :pep:`282`, usually an instance " "of :class:`logging.Logger`." msgstr "" -#: ../../library/shutil.rst:625 +#: ../../library/shutil.rst:626 msgid "The *verbose* argument is unused and deprecated." msgstr "" -#: ../../library/shutil.rst:627 +#: ../../library/shutil.rst:628 msgid "" "Raises an :ref:`auditing event ` ``shutil.make_archive`` with " "arguments ``base_name``, ``format``, ``root_dir``, ``base_dir``." @@ -847,7 +848,7 @@ msgstr "" "引發一個附帶引數 ``base_name``、``format``、``root_dir``、``base_dir`` 的\\ :" "ref:`稽核事件 ` ``shutil.make_archive``。" -#: ../../library/shutil.rst:631 +#: ../../library/shutil.rst:632 msgid "" "This function is not thread-safe when custom archivers registered with :func:" "`register_archive_format` do not support the *root_dir* argument. In this " @@ -855,60 +856,60 @@ msgid "" "*root_dir* to perform archiving." msgstr "" -#: ../../library/shutil.rst:637 +#: ../../library/shutil.rst:638 msgid "" "The modern pax (POSIX.1-2001) format is now used instead of the legacy GNU " "format for archives created with ``format=\"tar\"``." msgstr "" -#: ../../library/shutil.rst:641 +#: ../../library/shutil.rst:642 msgid "" "This function is now made thread-safe during creation of standard ``.zip`` " "and tar archives." msgstr "" -#: ../../library/shutil.rst:647 +#: ../../library/shutil.rst:648 msgid "" "Return a list of supported formats for archiving. Each element of the " "returned sequence is a tuple ``(name, description)``." msgstr "" -#: ../../library/shutil.rst:650 ../../library/shutil.rst:761 +#: ../../library/shutil.rst:651 ../../library/shutil.rst:762 msgid "By default :mod:`shutil` provides these formats:" msgstr "" -#: ../../library/shutil.rst:652 +#: ../../library/shutil.rst:653 msgid "*zip*: ZIP file (if the :mod:`zlib` module is available)." msgstr "" -#: ../../library/shutil.rst:653 +#: ../../library/shutil.rst:654 msgid "" "*tar*: Uncompressed tar file. Uses POSIX.1-2001 pax format for new archives." msgstr "" -#: ../../library/shutil.rst:654 ../../library/shutil.rst:766 +#: ../../library/shutil.rst:655 ../../library/shutil.rst:767 msgid "*gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available)." msgstr "" -#: ../../library/shutil.rst:655 ../../library/shutil.rst:767 +#: ../../library/shutil.rst:656 ../../library/shutil.rst:768 msgid "*bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available)." msgstr "" -#: ../../library/shutil.rst:656 ../../library/shutil.rst:768 +#: ../../library/shutil.rst:657 ../../library/shutil.rst:769 msgid "*xztar*: xz'ed tar-file (if the :mod:`lzma` module is available)." msgstr "" -#: ../../library/shutil.rst:658 +#: ../../library/shutil.rst:659 msgid "" "You can register new formats or provide your own archiver for any existing " "formats, by using :func:`register_archive_format`." msgstr "" -#: ../../library/shutil.rst:664 +#: ../../library/shutil.rst:665 msgid "Register an archiver for the format *name*." msgstr "" -#: ../../library/shutil.rst:666 +#: ../../library/shutil.rst:667 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive the *base_name* of the file to create, followed by the " @@ -917,7 +918,7 @@ msgid "" "*dry_run* and *logger* (as passed in :func:`make_archive`)." msgstr "" -#: ../../library/shutil.rst:672 +#: ../../library/shutil.rst:673 msgid "" "If *function* has the custom attribute ``function.supports_root_dir`` set to " "``True``, the *root_dir* argument is passed as a keyword argument. Otherwise " @@ -926,37 +927,37 @@ msgid "" "not thread-safe." msgstr "" -#: ../../library/shutil.rst:678 +#: ../../library/shutil.rst:679 msgid "" "If given, *extra_args* is a sequence of ``(name, value)`` pairs that will be " "used as extra keywords arguments when the archiver callable is used." msgstr "" -#: ../../library/shutil.rst:681 +#: ../../library/shutil.rst:682 msgid "" "*description* is used by :func:`get_archive_formats` which returns the list " "of archivers. Defaults to an empty string." msgstr "" -#: ../../library/shutil.rst:684 +#: ../../library/shutil.rst:685 msgid "Added support for functions supporting the *root_dir* argument." msgstr "" -#: ../../library/shutil.rst:690 +#: ../../library/shutil.rst:691 msgid "Remove the archive format *name* from the list of supported formats." msgstr "" -#: ../../library/shutil.rst:695 +#: ../../library/shutil.rst:696 msgid "Unpack an archive. *filename* is the full path of the archive." msgstr "" -#: ../../library/shutil.rst:697 +#: ../../library/shutil.rst:698 msgid "" "*extract_dir* is the name of the target directory where the archive is " "unpacked. If not provided, the current working directory is used." msgstr "" -#: ../../library/shutil.rst:700 +#: ../../library/shutil.rst:701 msgid "" "*format* is the archive format: one of \"zip\", \"tar\", \"gztar\", " "\"bztar\", or \"xztar\". Or any other format registered with :func:" @@ -965,7 +966,7 @@ msgid "" "that extension. In case none is found, a :exc:`ValueError` is raised." msgstr "" -#: ../../library/shutil.rst:707 +#: ../../library/shutil.rst:708 msgid "" "The keyword-only *filter* argument is passed to the underlying unpacking " "function. For zip files, *filter* is not accepted. For tar files, it is " @@ -975,7 +976,7 @@ msgid "" "Python 3.14." msgstr "" -#: ../../library/shutil.rst:715 +#: ../../library/shutil.rst:716 msgid "" "Raises an :ref:`auditing event ` ``shutil.unpack_archive`` with " "arguments ``filename``, ``extract_dir``, ``format``." @@ -983,7 +984,7 @@ msgstr "" "引發一個附帶引數 ``filename``、``extract_dir``、``format`` 的\\ :ref:`稽核事" "件 ` ``shutil.unpack_archive``。" -#: ../../library/shutil.rst:719 +#: ../../library/shutil.rst:720 msgid "" "Never extract archives from untrusted sources without prior inspection. It " "is possible that files are created outside of the path specified in the " @@ -991,91 +992,91 @@ msgid "" "with \"/\" or filenames with two dots \"..\"." msgstr "" -#: ../../library/shutil.rst:724 +#: ../../library/shutil.rst:725 msgid "Accepts a :term:`path-like object` for *filename* and *extract_dir*." msgstr "" -#: ../../library/shutil.rst:727 +#: ../../library/shutil.rst:728 msgid "Added the *filter* argument." msgstr "新增 *filter* 引數。" -#: ../../library/shutil.rst:732 +#: ../../library/shutil.rst:733 msgid "" "Registers an unpack format. *name* is the name of the format and " "*extensions* is a list of extensions corresponding to the format, like ``." "zip`` for Zip files." msgstr "" -#: ../../library/shutil.rst:736 +#: ../../library/shutil.rst:737 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive:" msgstr "" -#: ../../library/shutil.rst:739 +#: ../../library/shutil.rst:740 msgid "the path of the archive, as a positional argument;" msgstr "" -#: ../../library/shutil.rst:740 +#: ../../library/shutil.rst:741 msgid "" "the directory the archive must be extracted to, as a positional argument;" msgstr "" -#: ../../library/shutil.rst:741 +#: ../../library/shutil.rst:742 msgid "" "possibly a *filter* keyword argument, if it was given to :func:" "`unpack_archive`;" msgstr "" -#: ../../library/shutil.rst:743 +#: ../../library/shutil.rst:744 msgid "" "additional keyword arguments, specified by *extra_args* as a sequence of " "``(name, value)`` tuples." msgstr "" -#: ../../library/shutil.rst:746 +#: ../../library/shutil.rst:747 msgid "" "*description* can be provided to describe the format, and will be returned " "by the :func:`get_unpack_formats` function." msgstr "" -#: ../../library/shutil.rst:752 +#: ../../library/shutil.rst:753 msgid "Unregister an unpack format. *name* is the name of the format." msgstr "" -#: ../../library/shutil.rst:757 +#: ../../library/shutil.rst:758 msgid "" "Return a list of all registered formats for unpacking. Each element of the " "returned sequence is a tuple ``(name, extensions, description)``." msgstr "" -#: ../../library/shutil.rst:763 +#: ../../library/shutil.rst:764 msgid "" "*zip*: ZIP file (unpacking compressed files works only if the corresponding " "module is available)." msgstr "" -#: ../../library/shutil.rst:765 +#: ../../library/shutil.rst:766 msgid "*tar*: uncompressed tar file." msgstr "" -#: ../../library/shutil.rst:770 +#: ../../library/shutil.rst:771 msgid "" "You can register new formats or provide your own unpacker for any existing " "formats, by using :func:`register_unpack_format`." msgstr "" -#: ../../library/shutil.rst:777 +#: ../../library/shutil.rst:778 msgid "Archiving example" msgstr "" -#: ../../library/shutil.rst:779 +#: ../../library/shutil.rst:780 msgid "" "In this example, we create a gzip'ed tar-file archive containing all files " "found in the :file:`.ssh` directory of the user::" msgstr "" -#: ../../library/shutil.rst:782 +#: ../../library/shutil.rst:783 msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1085,11 +1086,11 @@ msgid "" "'/Users/tarek/myarchive.tar.gz'" msgstr "" -#: ../../library/shutil.rst:789 +#: ../../library/shutil.rst:790 msgid "The resulting archive contains:" msgstr "" -#: ../../library/shutil.rst:791 +#: ../../library/shutil.rst:792 msgid "" "$ tar -tzvf /Users/tarek/myarchive.tar.gz\n" "drwx------ tarek/staff 0 2010-02-01 16:23:40 ./\n" @@ -1111,18 +1112,18 @@ msgstr "" "-rw-r--r-- tarek/staff 397 2008-06-09 13:26:54 ./id_rsa.pub\n" "-rw-r--r-- tarek/staff 37192 2010-02-06 18:23:10 ./known_hosts" -#: ../../library/shutil.rst:807 +#: ../../library/shutil.rst:808 msgid "Archiving example with *base_dir*" msgstr "" -#: ../../library/shutil.rst:809 +#: ../../library/shutil.rst:810 msgid "" "In this example, similar to the `one above `_, we " "show how to use :func:`make_archive`, but this time with the usage of " "*base_dir*. We now have the following directory structure:" msgstr "" -#: ../../library/shutil.rst:813 +#: ../../library/shutil.rst:814 msgid "" "$ tree tmp\n" "tmp\n" @@ -1140,13 +1141,13 @@ msgstr "" " └── please_add.txt\n" " └── do_not_add.txt" -#: ../../library/shutil.rst:823 +#: ../../library/shutil.rst:824 msgid "" "In the final archive, :file:`please_add.txt` should be included, but :file:" "`do_not_add.txt` should not. Therefore we use the following::" msgstr "" -#: ../../library/shutil.rst:826 +#: ../../library/shutil.rst:827 msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1170,11 +1171,11 @@ msgstr "" "... )\n" "'/Users/tarek/my_archive.tar'" -#: ../../library/shutil.rst:837 +#: ../../library/shutil.rst:838 msgid "Listing the files in the resulting archive gives us:" msgstr "" -#: ../../library/shutil.rst:839 +#: ../../library/shutil.rst:840 msgid "" "$ python -m tarfile -l /Users/tarek/myarchive.tar\n" "structure/content/\n" @@ -1184,29 +1185,29 @@ msgstr "" "structure/content/\n" "structure/content/please_add.txt" -#: ../../library/shutil.rst:847 +#: ../../library/shutil.rst:848 msgid "Querying the size of the output terminal" msgstr "" -#: ../../library/shutil.rst:851 +#: ../../library/shutil.rst:852 msgid "Get the size of the terminal window." msgstr "" -#: ../../library/shutil.rst:853 +#: ../../library/shutil.rst:854 msgid "" "For each of the two dimensions, the environment variable, ``COLUMNS`` and " "``LINES`` respectively, is checked. If the variable is defined and the value " "is a positive integer, it is used." msgstr "" -#: ../../library/shutil.rst:857 +#: ../../library/shutil.rst:858 msgid "" "When ``COLUMNS`` or ``LINES`` is not defined, which is the common case, the " "terminal connected to :data:`sys.__stdout__` is queried by invoking :func:" "`os.get_terminal_size`." msgstr "" -#: ../../library/shutil.rst:861 +#: ../../library/shutil.rst:862 msgid "" "If the terminal size cannot be successfully queried, either because the " "system doesn't support querying, or because we are not connected to a " @@ -1215,17 +1216,17 @@ msgid "" "emulators." msgstr "" -#: ../../library/shutil.rst:867 +#: ../../library/shutil.rst:868 msgid "The value returned is a named tuple of type :class:`os.terminal_size`." msgstr "" -#: ../../library/shutil.rst:869 +#: ../../library/shutil.rst:870 msgid "" "See also: The Single UNIX Specification, Version 2, `Other Environment " "Variables`_." msgstr "" -#: ../../library/shutil.rst:874 +#: ../../library/shutil.rst:875 msgid "" "The ``fallback`` values are also used if :func:`os.get_terminal_size` " "returns zeroes." diff --git a/library/signal.po b/library/signal.po index 12239bc8b0..f177d710de 100644 --- a/library/signal.po +++ b/library/signal.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -469,8 +469,10 @@ msgid "See the :manpage:`pidfd_send_signal(2)` man page for more information." msgstr "更多資訊請見 :manpage:`pidfd_send_signal(2)` 手冊頁。" #: ../../library/signal.rst:414 -msgid ":ref:`Availability `: Linux >= 5.1" -msgstr ":ref:`適用 `:Linux 5.1 以上" +msgid "" +":ref:`Availability `: Linux >= 5.1, Android >= :func:`build-" +"time ` API level 31" +msgstr "" #: ../../library/signal.rst:420 msgid "" @@ -950,3 +952,6 @@ msgid "" "serve_forever(httpd)\n" "print(\"Shutdown...\")" msgstr "" + +#~ msgid ":ref:`Availability `: Linux >= 5.1" +#~ msgstr ":ref:`適用 `:Linux 5.1 以上" diff --git a/library/stdtypes.po b/library/stdtypes.po index d677d5a401..6ba75aed17 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,7 +35,7 @@ msgstr "以下章節描述了直譯器中内建的標準型別。" msgid "" "The principal built-in types are numerics, sequences, mappings, classes, " "instances and exceptions." -msgstr "主要內建型別為數字、序列、映射、class(類別)、實例和例外。" +msgstr "主要內建型別為數字、序列、對映、class(類別)、實例和例外。" #: ../../library/stdtypes.rst:18 msgid "" @@ -7894,76 +7894,36 @@ msgstr "" #: ../../library/stdtypes.rst:5491 msgid "" -"A dictionary or other mapping object used to store an object's (writable) " -"attributes." -msgstr "" - -#: ../../library/stdtypes.rst:5497 -msgid "The class to which a class instance belongs." -msgstr "" - -#: ../../library/stdtypes.rst:5502 -msgid "The tuple of base classes of a class object." -msgstr "" - -#: ../../library/stdtypes.rst:5507 -msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5513 +#: ../../library/stdtypes.rst:5497 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5521 -msgid "" -"The :ref:`type parameters ` of generic classes, functions, and :" -"ref:`type aliases `." +#: ../../library/stdtypes.rst:5505 +msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:5529 +#: ../../library/stdtypes.rst:5510 msgid "" -"This attribute is a tuple of classes that are considered when looking for " -"base classes during method resolution." +"The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:5535 +#: ../../library/stdtypes.rst:5515 msgid "" -"This method can be overridden by a metaclass to customize the method " -"resolution order for its instances. It is called at class instantiation, " -"and its result is stored in :attr:`~class.__mro__`." -msgstr "" - -#: ../../library/stdtypes.rst:5542 -msgid "" -"Each class keeps a list of weak references to its immediate subclasses. " -"This method returns a list of all those references still alive. The list is " -"in definition order. Example::" -msgstr "" - -#: ../../library/stdtypes.rst:5546 -msgid "" -">>> int.__subclasses__()\n" -"[, , , ]" -msgstr "" -">>> int.__subclasses__()\n" -"[, , , ]" - -#: ../../library/stdtypes.rst:5552 -msgid "" -"A tuple containing names of attributes of this class which are accessed " -"through ``self.X`` from any function in its body." +"The :ref:`type parameters ` of generic classes, functions, and :" +"ref:`type aliases `. For classes and functions that are not " +"generic, this will be an empty tuple." msgstr "" -#: ../../library/stdtypes.rst:5560 +#: ../../library/stdtypes.rst:5525 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:5562 +#: ../../library/stdtypes.rst:5527 msgid "" "CPython has a global limit for converting between :class:`int` and :class:" "`str` to mitigate denial of service attacks. This limit *only* applies to " @@ -7971,7 +7931,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:5567 +#: ../../library/stdtypes.rst:5532 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -7981,24 +7941,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:5574 +#: ../../library/stdtypes.rst:5539 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:5576 +#: ../../library/stdtypes.rst:5541 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" -#: ../../library/stdtypes.rst:5580 +#: ../../library/stdtypes.rst:5545 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:5582 +#: ../../library/stdtypes.rst:5547 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -8022,7 +7982,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:5602 +#: ../../library/stdtypes.rst:5567 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -8030,11 +7990,11 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:5607 +#: ../../library/stdtypes.rst:5572 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:5609 +#: ../../library/stdtypes.rst:5574 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8045,84 +8005,84 @@ msgid "" "..." msgstr "" -#: ../../library/stdtypes.rst:5622 +#: ../../library/stdtypes.rst:5587 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:5624 +#: ../../library/stdtypes.rst:5589 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:5627 +#: ../../library/stdtypes.rst:5592 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:5628 +#: ../../library/stdtypes.rst:5593 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:5629 +#: ../../library/stdtypes.rst:5594 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:5630 +#: ../../library/stdtypes.rst:5595 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:5631 +#: ../../library/stdtypes.rst:5596 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:5634 +#: ../../library/stdtypes.rst:5599 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:5636 +#: ../../library/stdtypes.rst:5601 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:5637 +#: ../../library/stdtypes.rst:5602 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:5638 +#: ../../library/stdtypes.rst:5603 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:5639 +#: ../../library/stdtypes.rst:5604 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:5640 +#: ../../library/stdtypes.rst:5605 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:5641 +#: ../../library/stdtypes.rst:5606 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:5644 +#: ../../library/stdtypes.rst:5609 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:5646 +#: ../../library/stdtypes.rst:5611 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" -#: ../../library/stdtypes.rst:5649 +#: ../../library/stdtypes.rst:5614 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" -#: ../../library/stdtypes.rst:5652 +#: ../../library/stdtypes.rst:5617 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -8130,7 +8090,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:5654 +#: ../../library/stdtypes.rst:5619 msgid "" ":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" "`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " @@ -8139,38 +8099,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:5660 +#: ../../library/stdtypes.rst:5625 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:5663 +#: ../../library/stdtypes.rst:5628 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" -#: ../../library/stdtypes.rst:5667 +#: ../../library/stdtypes.rst:5632 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:5669 +#: ../../library/stdtypes.rst:5634 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:5671 +#: ../../library/stdtypes.rst:5636 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" -#: ../../library/stdtypes.rst:5678 +#: ../../library/stdtypes.rst:5643 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -8182,7 +8142,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:5687 +#: ../../library/stdtypes.rst:5652 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " @@ -8190,11 +8150,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:5693 +#: ../../library/stdtypes.rst:5658 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:5695 +#: ../../library/stdtypes.rst:5660 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " @@ -8202,11 +8162,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:5700 +#: ../../library/stdtypes.rst:5665 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:5702 +#: ../../library/stdtypes.rst:5667 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -8219,38 +8179,38 @@ msgid "" "... sys.set_int_max_str_digits(lower_bound)" msgstr "" -#: ../../library/stdtypes.rst:5712 +#: ../../library/stdtypes.rst:5677 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:5716 +#: ../../library/stdtypes.rst:5681 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:5717 +#: ../../library/stdtypes.rst:5682 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5720 +#: ../../library/stdtypes.rst:5685 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5723 +#: ../../library/stdtypes.rst:5688 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5725 +#: ../../library/stdtypes.rst:5690 msgid "" "Cased characters are those with general category property being one of " "\"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:5728 +#: ../../library/stdtypes.rst:5693 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -9002,3 +8962,12 @@ msgstr "..." #: ../../library/stdtypes.rst:5442 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" + +#~ msgid "" +#~ ">>> int.__subclasses__()\n" +#~ "[, , , ]" +#~ msgstr "" +#~ ">>> int.__subclasses__()\n" +#~ "[, , , ]" diff --git a/library/string.po b/library/string.po index acd1fea713..f35d8e3922 100644 --- a/library/string.po +++ b/library/string.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-03-10 15:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -884,36 +884,37 @@ msgstr "" #: ../../library/string.rst:577 msgid "" -"For :class:`float` this is the same as ``'g'``, except that when fixed-point " -"notation is used to format the result, it always includes at least one digit " -"past the decimal point. The precision used is as large as needed to " -"represent the given value faithfully." +"For :class:`float` this is like the ``'g'`` type, except that when fixed-" +"point notation is used to format the result, it always includes at least one " +"digit past the decimal point, and switches to the scientific notation when " +"``exp >= p - 1``. When the precision is not specified, the latter will be " +"as large as needed to represent the given value faithfully." msgstr "" -#: ../../library/string.rst:583 +#: ../../library/string.rst:585 msgid "" "For :class:`~decimal.Decimal`, this is the same as either ``'g'`` or ``'G'`` " "depending on the value of ``context.capitals`` for the current decimal " "context." msgstr "" -#: ../../library/string.rst:587 +#: ../../library/string.rst:589 msgid "" "The overall effect is to match the output of :func:`str` as altered by the " "other format modifiers." msgstr "" -#: ../../library/string.rst:595 +#: ../../library/string.rst:597 msgid "Format examples" msgstr "格式範例" -#: ../../library/string.rst:597 +#: ../../library/string.rst:599 msgid "" "This section contains examples of the :meth:`str.format` syntax and " "comparison with the old ``%``-formatting." msgstr "本節包含 :meth:`str.format` 語法以及與舊式 ``%`` 格式的比較。" -#: ../../library/string.rst:600 +#: ../../library/string.rst:602 msgid "" "In most of the cases the syntax is similar to the old ``%``-formatting, with " "the addition of the ``{}`` and with ``:`` used instead of ``%``. For " @@ -922,17 +923,17 @@ msgstr "" "此語法在大多情況下與舊式的 ``%`` 格式類似,只是增加了 ``{}`` 和 ``:`` 來取代 " "``%``。例如,``'%03.2f'`` 可以改寫為 ``'{:03.2f}'``。" -#: ../../library/string.rst:604 +#: ../../library/string.rst:606 msgid "" "The new format syntax also supports new and different options, shown in the " "following examples." msgstr "新的語法還支援新的選項,將在以下的範例中說明。" -#: ../../library/string.rst:607 +#: ../../library/string.rst:609 msgid "Accessing arguments by position::" msgstr "按位置存取引數: ::" -#: ../../library/string.rst:609 +#: ../../library/string.rst:611 msgid "" ">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" "'a, b, c'\n" @@ -947,11 +948,11 @@ msgid "" "'abracadabra'" msgstr "" -#: ../../library/string.rst:620 +#: ../../library/string.rst:622 msgid "Accessing arguments by name::" msgstr "按名稱存取引數: ::" -#: ../../library/string.rst:622 +#: ../../library/string.rst:624 msgid "" ">>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', " "longitude='-115.81W')\n" @@ -961,11 +962,11 @@ msgid "" "'Coordinates: 37.24N, -115.81W'" msgstr "" -#: ../../library/string.rst:628 +#: ../../library/string.rst:630 msgid "Accessing arguments' attributes::" msgstr "存取引數的屬性: ::" -#: ../../library/string.rst:630 +#: ../../library/string.rst:632 msgid "" ">>> c = 3-5j\n" ">>> ('The complex number {0} is formed from the real part {0.real} '\n" @@ -982,22 +983,22 @@ msgid "" "'Point(4, 2)'" msgstr "" -#: ../../library/string.rst:643 +#: ../../library/string.rst:645 msgid "Accessing arguments' items::" msgstr "存取引數的內容: ::" -#: ../../library/string.rst:645 +#: ../../library/string.rst:647 msgid "" ">>> coord = (3, 5)\n" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" "'X: 3; Y: 5'" msgstr "" -#: ../../library/string.rst:649 +#: ../../library/string.rst:651 msgid "Replacing ``%s`` and ``%r``::" msgstr "替換 ``%s`` 和 ``%r``: ::" -#: ../../library/string.rst:651 +#: ../../library/string.rst:653 msgid "" ">>> \"repr() shows quotes: {!r}; str() doesn't: {!s}\".format('test1', " "'test2')\n" @@ -1007,11 +1008,11 @@ msgstr "" "'test2')\n" "\"repr() shows quotes: 'test1'; str() doesn't: test2\"" -#: ../../library/string.rst:654 +#: ../../library/string.rst:656 msgid "Aligning the text and specifying a width::" msgstr "對齊文字以及指定寬度: ::" -#: ../../library/string.rst:656 +#: ../../library/string.rst:658 msgid "" ">>> '{:<30}'.format('left aligned')\n" "'left aligned '\n" @@ -1023,11 +1024,11 @@ msgid "" "'***********centered***********'" msgstr "" -#: ../../library/string.rst:665 +#: ../../library/string.rst:667 msgid "Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::" msgstr "替換 ``%+f``、``%-f`` 和 ``% f`` 以及指定正負號: ::" -#: ../../library/string.rst:667 +#: ../../library/string.rst:669 msgid "" ">>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always\n" "'+3.140000; -3.140000'\n" @@ -1038,12 +1039,12 @@ msgid "" "'3.140000; -3.140000'" msgstr "" -#: ../../library/string.rst:674 +#: ../../library/string.rst:676 msgid "" "Replacing ``%x`` and ``%o`` and converting the value to different bases::" msgstr "替換 ``%x`` 和 ``%o`` 並將其值轉換為不同的進位制: ::" -#: ../../library/string.rst:676 +#: ../../library/string.rst:678 msgid "" ">>> # format also supports binary numbers\n" ">>> \"int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}\".format(42)\n" @@ -1053,11 +1054,11 @@ msgid "" "'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'" msgstr "" -#: ../../library/string.rst:683 +#: ../../library/string.rst:685 msgid "Using the comma as a thousands separator::" msgstr "使用逗號作為千位分隔符: ::" -#: ../../library/string.rst:685 +#: ../../library/string.rst:687 msgid "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" @@ -1065,11 +1066,11 @@ msgstr "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" -#: ../../library/string.rst:688 +#: ../../library/string.rst:690 msgid "Expressing a percentage::" msgstr "表示為百分比: ::" -#: ../../library/string.rst:690 +#: ../../library/string.rst:692 msgid "" ">>> points = 19\n" ">>> total = 22\n" @@ -1081,11 +1082,11 @@ msgstr "" ">>> 'Correct answers: {:.2%}'.format(points/total)\n" "'Correct answers: 86.36%'" -#: ../../library/string.rst:695 +#: ../../library/string.rst:697 msgid "Using type-specific formatting::" msgstr "作為特定型別格式: ::" -#: ../../library/string.rst:697 +#: ../../library/string.rst:699 msgid "" ">>> import datetime\n" ">>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n" @@ -1097,11 +1098,11 @@ msgstr "" ">>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" "'2010-07-04 12:15:58'" -#: ../../library/string.rst:702 +#: ../../library/string.rst:704 msgid "Nesting arguments and more complex examples::" msgstr "巢狀引數及更多複雜範例: ::" -#: ../../library/string.rst:704 +#: ../../library/string.rst:706 msgid "" ">>> for align, text in zip('<^>', ['left', 'center', 'right']):\n" "... '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n" @@ -1159,11 +1160,11 @@ msgstr "" " 10 A 12 1010\n" " 11 B 13 1011" -#: ../../library/string.rst:736 +#: ../../library/string.rst:738 msgid "Template strings" msgstr "模板字串" -#: ../../library/string.rst:738 +#: ../../library/string.rst:740 msgid "" "Template strings provide simpler string substitutions as described in :pep:" "`292`. A primary use case for template strings is for internationalization " @@ -1177,17 +1178,17 @@ msgstr "" "化工具更容易翻譯。基於模板字串建構的 i18n 函式庫範例,請參閱 `flufl.i18n " "`_ 套件。" -#: ../../library/string.rst:748 +#: ../../library/string.rst:750 msgid "" "Template strings support ``$``-based substitutions, using the following " "rules:" msgstr "" -#: ../../library/string.rst:750 +#: ../../library/string.rst:752 msgid "``$$`` is an escape; it is replaced with a single ``$``." msgstr "" -#: ../../library/string.rst:752 +#: ../../library/string.rst:754 msgid "" "``$identifier`` names a substitution placeholder matching a mapping key of " "``\"identifier\"``. By default, ``\"identifier\"`` is restricted to any " @@ -1197,30 +1198,30 @@ msgid "" "specification." msgstr "" -#: ../../library/string.rst:759 +#: ../../library/string.rst:761 msgid "" "``${identifier}`` is equivalent to ``$identifier``. It is required when " "valid identifier characters follow the placeholder but are not part of the " "placeholder, such as ``\"${noun}ification\"``." msgstr "" -#: ../../library/string.rst:763 +#: ../../library/string.rst:765 msgid "" "Any other appearance of ``$`` in the string will result in a :exc:" "`ValueError` being raised." msgstr "" -#: ../../library/string.rst:766 +#: ../../library/string.rst:768 msgid "" "The :mod:`string` module provides a :class:`Template` class that implements " "these rules. The methods of :class:`Template` are:" msgstr "" -#: ../../library/string.rst:772 +#: ../../library/string.rst:774 msgid "The constructor takes a single argument which is the template string." msgstr "" -#: ../../library/string.rst:777 +#: ../../library/string.rst:779 msgid "" "Performs the template substitution, returning a new string. *mapping* is " "any dictionary-like object with keys that match the placeholders in the " @@ -1232,7 +1233,7 @@ msgstr "" "的字典型物件。或者如果關鍵字就是佔位符號時,你也可以改提供關鍵字引數。當 " "*mapping* 跟 *kwds* 同時給定並存在重複時,*kwds* 的佔位符號會被優先使用。" -#: ../../library/string.rst:786 +#: ../../library/string.rst:788 msgid "" "Like :meth:`substitute`, except that if placeholders are missing from " "*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the " @@ -1245,7 +1246,7 @@ msgstr "" "與 :meth:`substitute` 不同的是,任何包含 ``$`` 的字句會直接回傳 ``$`` 而非引" "發 :exc:`ValueError`。" -#: ../../library/string.rst:792 +#: ../../library/string.rst:794 msgid "" "While other exceptions may still occur, this method is called \"safe\" " "because it always tries to return a usable string instead of raising an " @@ -1259,7 +1260,7 @@ msgstr "" "完全安全,因為它會默默忽略格式錯誤的模板,這些模板包含了多餘的左右定界符、不" "匹配的括號,或者不是有效的 Python 識別字的佔位符號。" -#: ../../library/string.rst:802 +#: ../../library/string.rst:804 msgid "" "Returns false if the template has invalid placeholders that will cause :meth:" "`substitute` to raise :exc:`ValueError`." @@ -1267,18 +1268,18 @@ msgstr "" "如果模板有將導致 :meth:`substitute` 引發 :exc:`ValueError` 的無效佔位符號,就" "會回傳 false。" -#: ../../library/string.rst:810 +#: ../../library/string.rst:812 msgid "" "Returns a list of the valid identifiers in the template, in the order they " "first appear, ignoring any invalid identifiers." msgstr "" "回傳模板中有效識別字的串列,按照它們首次出現的順序,並忽略任何無效的識別字。" -#: ../../library/string.rst:815 +#: ../../library/string.rst:817 msgid ":class:`Template` instances also provide one public data attribute:" msgstr ":class:`Template` 實例也提供一個公開的資料屬性:" -#: ../../library/string.rst:819 +#: ../../library/string.rst:821 msgid "" "This is the object passed to the constructor's *template* argument. In " "general, you shouldn't change it, but read-only access is not enforced." @@ -1286,11 +1287,11 @@ msgstr "" "這是傳遞給建構函式 *template* 引數的物件。一般來說,你不應該改變它,但並沒有" "強制設定成唯讀。" -#: ../../library/string.rst:822 +#: ../../library/string.rst:824 msgid "Here is an example of how to use a Template::" msgstr "以下是如何使用 Template 的一個範例: ::" -#: ../../library/string.rst:824 +#: ../../library/string.rst:826 msgid "" ">>> from string import Template\n" ">>> s = Template('$who likes $what')\n" @@ -1324,7 +1325,7 @@ msgstr "" ">>> Template('$who likes $what').safe_substitute(d)\n" "'tim likes $what'" -#: ../../library/string.rst:840 +#: ../../library/string.rst:842 msgid "" "Advanced usage: you can derive subclasses of :class:`Template` to customize " "the placeholder syntax, delimiter character, or the entire regular " @@ -1334,7 +1335,7 @@ msgstr "" "進階用法:你可以衍生 :class:`Template` 類別來自定義佔位符號語法、左右定界符字" "元,或者用於剖析模板字串的正規表示式。你可以透過覆寫這些類別屬性來達成:" -#: ../../library/string.rst:845 +#: ../../library/string.rst:847 msgid "" "*delimiter* -- This is the literal string describing a placeholder " "introducing delimiter. The default value is ``$``. Note that this should " @@ -1348,7 +1349,7 @@ msgstr "" "注意你不能在建立類別後修改左右定界符。(意即在子類別的命名空間中必須設置不同" "的左右定界符)" -#: ../../library/string.rst:852 +#: ../../library/string.rst:854 msgid "" "*idpattern* -- This is the regular expression describing the pattern for non-" "braced placeholders. The default value is the regular expression ``(?a:[_a-" @@ -1356,19 +1357,19 @@ msgid "" "pattern will also apply to braced placeholders." msgstr "" -#: ../../library/string.rst:859 +#: ../../library/string.rst:861 msgid "" "Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with " "some non-ASCII characters. That's why we use the local ``a`` flag here." msgstr "" -#: ../../library/string.rst:863 +#: ../../library/string.rst:865 msgid "" "*braceidpattern* can be used to define separate patterns used inside and " "outside the braces." msgstr "" -#: ../../library/string.rst:867 +#: ../../library/string.rst:869 msgid "" "*braceidpattern* -- This is like *idpattern* but describes the pattern for " "braced placeholders. Defaults to ``None`` which means to fall back to " @@ -1377,7 +1378,7 @@ msgid "" "unbraced placeholders." msgstr "" -#: ../../library/string.rst:875 +#: ../../library/string.rst:877 msgid "" "*flags* -- The regular expression flags that will be applied when compiling " "the regular expression used for recognizing substitutions. The default " @@ -1386,7 +1387,7 @@ msgid "" "regular expressions." msgstr "" -#: ../../library/string.rst:883 +#: ../../library/string.rst:885 msgid "" "Alternatively, you can provide the entire regular expression pattern by " "overriding the class attribute *pattern*. If you do this, the value must be " @@ -1395,13 +1396,13 @@ msgid "" "placeholder rule:" msgstr "" -#: ../../library/string.rst:889 +#: ../../library/string.rst:891 msgid "" "*escaped* -- This group matches the escape sequence, e.g. ``$$``, in the " "default pattern." msgstr "*escaped* -- 此群組與跳脫序列匹配,例如在預設模式下為 ``$$``。" -#: ../../library/string.rst:892 +#: ../../library/string.rst:894 msgid "" "*named* -- This group matches the unbraced placeholder name; it should not " "include the delimiter in capturing group." @@ -1409,7 +1410,7 @@ msgstr "" "*named* -- 此群組與不帶大括號的佔位符號名稱匹配;它不應包含擷取群組中的左右定" "界符號。" -#: ../../library/string.rst:895 +#: ../../library/string.rst:897 msgid "" "*braced* -- This group matches the brace enclosed placeholder name; it " "should not include either the delimiter or braces in the capturing group." @@ -1417,7 +1418,7 @@ msgstr "" "*braced* -- 此群組與大括號括起來的佔位符號名稱匹配;它不應在擷取群組中包含左" "右定界符或大括號。" -#: ../../library/string.rst:898 +#: ../../library/string.rst:900 msgid "" "*invalid* -- This group matches any other delimiter pattern (usually a " "single delimiter), and it should appear last in the regular expression." @@ -1425,7 +1426,7 @@ msgstr "" "*invalid* -- 此群組與任何其他左右定界符模式(通常是單一左右定界符)匹配,且它" "應該出現在正規表示式的最後。" -#: ../../library/string.rst:901 +#: ../../library/string.rst:903 msgid "" "The methods on this class will raise :exc:`ValueError` if the pattern " "matches the template without one of these named groups matching." @@ -1433,11 +1434,11 @@ msgstr "" "當此模式有匹配於模板但這些命名組中卻有任一個不匹配,此類別的方法將引發 :exc:" "`ValueError`。" -#: ../../library/string.rst:906 +#: ../../library/string.rst:908 msgid "Helper functions" msgstr "輔助函式" -#: ../../library/string.rst:910 +#: ../../library/string.rst:912 msgid "" "Split the argument into words using :meth:`str.split`, capitalize each word " "using :meth:`str.capitalize`, and join the capitalized words using :meth:" @@ -1518,10 +1519,10 @@ msgstr ", (逗號)" msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../library/string.rst:746 +#: ../../library/string.rst:748 msgid "$ (dollar)" msgstr "$ (金錢符號)" -#: ../../library/string.rst:746 +#: ../../library/string.rst:748 msgid "in template strings" msgstr "於 template strings(模板字串)" diff --git a/library/test.po b/library/test.po index a3d5c4d723..e0fe8b9e31 100644 --- a/library/test.po +++ b/library/test.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1156,9 +1156,9 @@ msgstr "" #: ../../library/test.rst:948 msgid "" "The *extra* argument can be a set of names that wouldn't otherwise be " -"automatically detected as \"public\", like objects without a proper " -"``__module__`` attribute. If provided, it will be added to the automatically " -"detected ones." +"automatically detected as \"public\", like objects without a proper :attr:" +"`~definition.__module__` attribute. If provided, it will be added to the " +"automatically detected ones." msgstr "" #: ../../library/test.rst:952 diff --git a/library/tomllib.po b/library/tomllib.po index 438b4e5eb0..45bf2403d2 100644 --- a/library/tomllib.po +++ b/library/tomllib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2022-11-18 01:56+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,11 +27,10 @@ msgid "**Source code:** :source:`Lib/tomllib`" msgstr "**原始碼:**\\ :source:`Lib/tomllib`" #: ../../library/tomllib.rst:16 -#, fuzzy msgid "" -"This module provides an interface for parsing TOML (Tom's Obvious Minimal " -"Language, `https://toml.io `_). This module does not " -"support writing TOML." +"This module provides an interface for parsing TOML 1.0.0 (Tom's Obvious " +"Minimal Language, `https://toml.io `_). This module " +"does not support writing TOML." msgstr "" "此模組提供了剖析 TOML 1.0.0 (Tom's Obvious Minimal Language, `https://toml." "io `_) 的一個介面,此模組並不支援寫入 TOML。" diff --git a/library/types.po b/library/types.po index 6cae9bb452..cd7e8ca1ba 100644 --- a/library/types.po +++ b/library/types.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -141,7 +141,8 @@ msgstr "" msgid "" "For classes that have an ``__orig_bases__`` attribute, this function returns " "the value of ``cls.__orig_bases__``. For classes without the " -"``__orig_bases__`` attribute, ``cls.__bases__`` is returned." +"``__orig_bases__`` attribute, :attr:`cls.__bases__ ` is " +"returned." msgstr "" #: ../../library/types.rst:97 @@ -510,7 +511,7 @@ msgid "" "In addition, when a class is defined with a :attr:`~object.__slots__` " "attribute, then for each slot, an instance of :class:`!MemberDescriptorType` " "will be added as an attribute on the class. This allows the slot to appear " -"in the class's :attr:`~object.__dict__`." +"in the class's :attr:`~type.__dict__`." msgstr "" #: ../../library/types.rst:399 diff --git a/library/typing.po b/library/typing.po index 60f44beffd..f9b1cfb9a4 100644 --- a/library/typing.po +++ b/library/typing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-30 09:19+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-" @@ -387,8 +387,8 @@ msgstr "" "str]`` 象徵為一個函式,可以接受一個型別為 :class:`int` 的引數,並回傳一個 :" "class:`str`。" -#: ../../library/typing.rst:215 ../../library/typing.rst:3109 -#: ../../library/typing.rst:3287 +#: ../../library/typing.rst:215 ../../library/typing.rst:3128 +#: ../../library/typing.rst:3308 msgid "For example:" msgstr "舉例來說:" @@ -492,7 +492,7 @@ msgstr "" "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " "ReturnType]`` 的形式。" -#: ../../library/typing.rst:285 ../../library/typing.rst:3777 +#: ../../library/typing.rst:285 ../../library/typing.rst:3798 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" "pep:`612` for more details." @@ -1434,8 +1434,8 @@ msgstr "" #: ../../library/typing.rst:868 ../../library/typing.rst:986 #: ../../library/typing.rst:1043 ../../library/typing.rst:1209 #: ../../library/typing.rst:1270 ../../library/typing.rst:1312 -#: ../../library/typing.rst:1510 ../../library/typing.rst:1571 -#: ../../library/typing.rst:3046 ../../library/typing.rst:3272 +#: ../../library/typing.rst:1527 ../../library/typing.rst:1588 +#: ../../library/typing.rst:3065 ../../library/typing.rst:3293 msgid "For example::" msgstr "舉例來說: ::" @@ -1502,7 +1502,7 @@ msgstr "" "此。然而,若是一個型別僅為 ``str`` 的物件則不相容。一個字串若是透過組合多個 " "``LiteralString`` 型別的物件建立,則此字串也可以視為 ``LiteralString``。" -#: ../../library/typing.rst:912 ../../library/typing.rst:2142 +#: ../../library/typing.rst:912 ../../library/typing.rst:2159 msgid "Example:" msgstr "舉例來說: ::" @@ -1957,7 +1957,7 @@ msgid "" "sum_threadsafe([1.1, 2.2, 3.3])" msgstr "" -#: ../../library/typing.rst:1196 ../../library/typing.rst:2110 +#: ../../library/typing.rst:1196 ../../library/typing.rst:2127 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)" @@ -1967,7 +1967,7 @@ msgstr ":pep:`612` -- 參數技術規範變數" msgid ":class:`ParamSpec`" msgstr ":class:`ParamSpec`" -#: ../../library/typing.rst:1199 ../../library/typing.rst:2113 +#: ../../library/typing.rst:1199 ../../library/typing.rst:2130 msgid ":ref:`annotating-callables`" msgstr ":ref:`annotating-callables`" @@ -2066,7 +2066,7 @@ msgstr "" #: ../../library/typing.rst:1265 msgid "Special typing construct to indicate final names to type checkers." -msgstr "特殊型別建構,用來指出最終名稱給型別檢查器。" +msgstr "特殊型別建構,用來指出給型別檢查器的最終名稱。" #: ../../library/typing.rst:1267 msgid "" @@ -2088,7 +2088,7 @@ msgid "" " TIMEOUT = 1 # Error reported by type checker" msgstr "" -#: ../../library/typing.rst:1281 ../../library/typing.rst:3062 +#: ../../library/typing.rst:1281 ../../library/typing.rst:3081 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." @@ -2122,11 +2122,10 @@ msgid "See :class:`TypedDict` and :pep:`655` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" #: ../../library/typing.rst:1310 -#, fuzzy msgid "" "A special typing construct to mark an item of a :class:`TypedDict` as read-" "only." -msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是必須的。" +msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 的項目是唯讀的。" #: ../../library/typing.rst:1314 msgid "" @@ -2140,15 +2139,12 @@ msgid "" msgstr "" #: ../../library/typing.rst:1322 -#, fuzzy msgid "There is no runtime checking for this property." -msgstr "" -"這些屬性 (property) 不會在 runtime 時進行檢查。更多詳細資訊請看 :pep:`591`。" +msgstr "這些屬性 (property) 不會在 runtime 時進行檢查。" #: ../../library/typing.rst:1324 -#, fuzzy msgid "See :class:`TypedDict` and :pep:`705` for more details." -msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" +msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`705`。" #: ../../library/typing.rst:1330 msgid "Special typing form to add context-specific metadata to an annotation." @@ -2388,21 +2384,50 @@ msgstr "" ">>> X.__metadata__\n" "('very', 'important', 'metadata')" -#: ../../library/typing.rst:1463 -msgid ":pep:`593` - Flexible function and variable annotations" +#: ../../library/typing.rst:1461 +msgid "" +"At runtime, if you want to retrieve the original type wrapped by " +"``Annotated``, use the :attr:`!__origin__` attribute:" msgstr "" #: ../../library/typing.rst:1464 +msgid "" +">>> from typing import Annotated, get_origin\n" +">>> Password = Annotated[str, \"secret\"]\n" +">>> Password.__origin__\n" +"" +msgstr "" +">>> from typing import Annotated, get_origin\n" +">>> Password = Annotated[str, \"secret\"]\n" +">>> Password.__origin__\n" +"" + +#: ../../library/typing.rst:1471 +msgid "Note that using :func:`get_origin` will return ``Annotated`` itself:" +msgstr "" + +#: ../../library/typing.rst:1473 +msgid "" +">>> get_origin(Password)\n" +"typing.Annotated" +msgstr "" +">>> get_origin(Password)\n" +"typing.Annotated" + +#: ../../library/typing.rst:1480 +msgid ":pep:`593` - Flexible function and variable annotations" +msgstr "" + +#: ../../library/typing.rst:1481 msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "" -#: ../../library/typing.rst:1471 ../../library/typing.rst:1555 -#, fuzzy +#: ../../library/typing.rst:1488 ../../library/typing.rst:1572 msgid "" "Special typing construct for marking user-defined type predicate functions." -msgstr "特殊型別建構,用來指出最終名稱給型別檢查器。" +msgstr "" -#: ../../library/typing.rst:1473 +#: ../../library/typing.rst:1490 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 " @@ -2410,7 +2435,7 @@ msgid "" "one positional argument." msgstr "" -#: ../../library/typing.rst:1478 +#: ../../library/typing.rst:1495 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 " @@ -2420,7 +2445,7 @@ msgid "" "predicate\"::" msgstr "" -#: ../../library/typing.rst:1484 +#: ../../library/typing.rst:1501 msgid "" "def is_str(val: str | float):\n" " # \"isinstance\" type predicate\n" @@ -2432,7 +2457,7 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1493 +#: ../../library/typing.rst:1510 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:" @@ -2443,29 +2468,29 @@ msgid "" "does not return ``True`` for all instances of the narrowed type." msgstr "" -#: ../../library/typing.rst:1501 +#: ../../library/typing.rst:1518 msgid "" "Using ``-> TypeIs[NarrowedType]`` tells the static type checker that for a " "given function:" msgstr "" -#: ../../library/typing.rst:1504 ../../library/typing.rst:1565 +#: ../../library/typing.rst:1521 ../../library/typing.rst:1582 msgid "The return value is a boolean." msgstr "" -#: ../../library/typing.rst:1505 +#: ../../library/typing.rst:1522 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:1507 +#: ../../library/typing.rst:1524 msgid "" "If the return value is ``False``, the type of its argument is narrowed to " "exclude ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1512 +#: ../../library/typing.rst:1529 msgid "" "from typing import assert_type, final, TypeIs\n" "\n" @@ -2489,7 +2514,7 @@ msgid "" " assert_type(arg, Unrelated)" msgstr "" -#: ../../library/typing.rst:1533 +#: ../../library/typing.rst:1550 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 " @@ -2498,27 +2523,27 @@ msgid "" "functions in a type-safe manner." msgstr "" -#: ../../library/typing.rst:1539 +#: ../../library/typing.rst:1556 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:1543 +#: ../../library/typing.rst:1560 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:1547 +#: ../../library/typing.rst:1564 msgid "" "``TypeIs`` also works with type variables. For more information, see :pep:" "`742` (Narrowing types with ``TypeIs``)." msgstr "" -#: ../../library/typing.rst:1557 +#: ../../library/typing.rst:1574 msgid "" "Type predicate functions are user-defined functions that return whether " "their argument is an instance of a particular type. ``TypeGuard`` works " @@ -2526,25 +2551,25 @@ msgid "" "checking behavior (see below)." msgstr "" -#: ../../library/typing.rst:1562 +#: ../../library/typing.rst:1579 msgid "" "Using ``-> TypeGuard`` tells the static type checker that for a given " "function:" msgstr "" -#: ../../library/typing.rst:1566 +#: ../../library/typing.rst:1583 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1569 +#: ../../library/typing.rst:1586 msgid "" "``TypeGuard`` also works with type variables. See :pep:`647` for more " "details." msgstr "" -#: ../../library/typing.rst:1573 +#: ../../library/typing.rst:1590 msgid "" "def is_str_list(val: list[object]) -> TypeGuard[list[str]]:\n" " '''Determines whether all objects in the list are strings'''\n" @@ -2559,11 +2584,11 @@ msgid "" " print(\"Not a list of strings!\")" msgstr "" -#: ../../library/typing.rst:1585 +#: ../../library/typing.rst:1602 msgid "``TypeIs`` and ``TypeGuard`` differ in the following ways:" msgstr "" -#: ../../library/typing.rst:1587 +#: ../../library/typing.rst:1604 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 " @@ -2571,7 +2596,7 @@ msgid "" "subtype of the former, since ``list`` is invariant." msgstr "" -#: ../../library/typing.rst:1591 +#: ../../library/typing.rst:1608 msgid "" "When a ``TypeGuard`` function returns ``True``, type checkers narrow the " "type of the variable to exactly the ``TypeGuard`` type. When a ``TypeIs`` " @@ -2580,7 +2605,7 @@ msgid "" "type. (Technically, this is known as an intersection type.)" msgstr "" -#: ../../library/typing.rst:1595 +#: ../../library/typing.rst:1612 msgid "" "When a ``TypeGuard`` function returns ``False``, type checkers cannot narrow " "the type of the variable at all. When a ``TypeIs`` function returns " @@ -2588,18 +2613,18 @@ msgid "" "``TypeIs`` type." msgstr "" -#: ../../library/typing.rst:1604 +#: ../../library/typing.rst:1621 msgid "Typing operator to conceptually mark an object as having been unpacked." msgstr "" -#: ../../library/typing.rst:1606 +#: ../../library/typing.rst:1623 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:1610 +#: ../../library/typing.rst:1627 msgid "" "Ts = TypeVarTuple('Ts')\n" "tup: tuple[*Ts]\n" @@ -2607,7 +2632,7 @@ msgid "" "tup: tuple[Unpack[Ts]]" msgstr "" -#: ../../library/typing.rst:1615 +#: ../../library/typing.rst:1632 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " @@ -2615,7 +2640,7 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" -#: ../../library/typing.rst:1621 +#: ../../library/typing.rst:1638 msgid "" "# In older versions of Python, TypeVarTuple and Unpack\n" "# are located in the `typing_extensions` backports package.\n" @@ -2626,13 +2651,13 @@ msgid "" "tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible" msgstr "" -#: ../../library/typing.rst:1629 +#: ../../library/typing.rst:1646 msgid "" "``Unpack`` can also be used along with :class:`typing.TypedDict` for typing " "``**kwargs`` in a function signature::" msgstr "" -#: ../../library/typing.rst:1632 +#: ../../library/typing.rst:1649 msgid "" "from typing import TypedDict, Unpack\n" "\n" @@ -2645,23 +2670,23 @@ msgid "" "def foo(**kwargs: Unpack[Movie]): ..." msgstr "" -#: ../../library/typing.rst:1642 +#: ../../library/typing.rst:1659 msgid "" "See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` typing." msgstr "" -#: ../../library/typing.rst:1647 +#: ../../library/typing.rst:1664 msgid "Building generic types and type aliases" msgstr "" -#: ../../library/typing.rst:1649 +#: ../../library/typing.rst:1666 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:1653 +#: ../../library/typing.rst:1670 msgid "" "These objects can be created through special syntax (:ref:`type parameter " "lists ` and the :keyword:`type` statement). For compatibility " @@ -2669,17 +2694,17 @@ msgid "" "syntax, as documented below." msgstr "" -#: ../../library/typing.rst:1660 +#: ../../library/typing.rst:1677 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1662 +#: ../../library/typing.rst:1679 msgid "" "A generic type is typically declared by adding a list of type parameters " "after the class name::" msgstr "" -#: ../../library/typing.rst:1665 +#: ../../library/typing.rst:1682 msgid "" "class Mapping[KT, VT]:\n" " def __getitem__(self, key: KT) -> VT:\n" @@ -2687,17 +2712,17 @@ msgid "" " # Etc." msgstr "" -#: ../../library/typing.rst:1670 +#: ../../library/typing.rst:1687 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:1674 +#: ../../library/typing.rst:1691 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1676 +#: ../../library/typing.rst:1693 msgid "" "def lookup_name[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:\n" " try:\n" @@ -2711,20 +2736,20 @@ msgstr "" " except KeyError:\n" " return default" -#: ../../library/typing.rst:1682 +#: ../../library/typing.rst:1699 msgid "" "Here the brackets after the function name indicate a :ref:`generic function " "`." msgstr "" -#: ../../library/typing.rst:1685 +#: ../../library/typing.rst:1702 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:1690 +#: ../../library/typing.rst:1707 msgid "" "KT = TypeVar('KT')\n" "VT = TypeVar('VT')\n" @@ -2742,18 +2767,18 @@ msgstr "" " ...\n" " # Etc." -#: ../../library/typing.rst:1702 +#: ../../library/typing.rst:1719 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1704 +#: ../../library/typing.rst:1721 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:1709 +#: ../../library/typing.rst:1726 msgid "" "class Sequence[T]: # T is a TypeVar\n" " ..." @@ -2761,12 +2786,12 @@ msgstr "" "class Sequence[T]: # T 是一個 TypeVar\n" " ..." -#: ../../library/typing.rst:1712 +#: ../../library/typing.rst:1729 msgid "" "This syntax can also be used to create bound and constrained type variables::" msgstr "" -#: ../../library/typing.rst:1715 +#: ../../library/typing.rst:1732 msgid "" "class StrSequence[S: str]: # S is a TypeVar bound to str\n" " ...\n" @@ -2777,20 +2802,20 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1722 +#: ../../library/typing.rst:1739 msgid "" "However, if desired, reusable type variables can also be constructed " "manually, like so::" msgstr "" -#: ../../library/typing.rst:1724 +#: ../../library/typing.rst:1741 msgid "" "T = TypeVar('T') # Can be anything\n" "S = TypeVar('S', bound=str) # Can be any subtype of str\n" "A = TypeVar('A', str, bytes) # Must be exactly str or bytes" msgstr "" -#: ../../library/typing.rst:1728 +#: ../../library/typing.rst:1745 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 " @@ -2798,7 +2823,7 @@ msgid "" "information on generic types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1734 +#: ../../library/typing.rst:1751 msgid "" "def repeat[T](x: T, n: int) -> Sequence[T]:\n" " \"\"\"Return a list containing n references to x.\"\"\"\n" @@ -2816,13 +2841,13 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:1749 +#: ../../library/typing.rst:1766 msgid "" "Note that type variables can be *bound*, *constrained*, or neither, but " "cannot be both bound *and* constrained." msgstr "" -#: ../../library/typing.rst:1752 +#: ../../library/typing.rst:1769 msgid "" "The variance of type variables is inferred by type checkers when they are " "created through the :ref:`type parameter syntax ` or when " @@ -2832,14 +2857,14 @@ msgid "" "invariant. See :pep:`484` and :pep:`695` for more details." msgstr "" -#: ../../library/typing.rst:1760 +#: ../../library/typing.rst:1777 msgid "" "Bound type variables and constrained type variables have different semantics " "in several important ways. Using a *bound* type variable means that the " "``TypeVar`` will be solved using the most specific type possible::" msgstr "" -#: ../../library/typing.rst:1764 +#: ../../library/typing.rst:1781 msgid "" "x = print_capitalized('a string')\n" "reveal_type(x) # revealed type is str\n" @@ -2853,13 +2878,13 @@ msgid "" "z = print_capitalized(45) # error: int is not a subtype of str" msgstr "" -#: ../../library/typing.rst:1775 +#: ../../library/typing.rst:1792 msgid "" "Type variables can be bound to concrete types, abstract types (ABCs or " "protocols), and even unions of types::" msgstr "" -#: ../../library/typing.rst:1778 +#: ../../library/typing.rst:1795 msgid "" "# Can be anything with an __abs__ method\n" "def print_abs[T: SupportsAbs](arg: T) -> None:\n" @@ -2870,13 +2895,13 @@ msgid "" "V = TypeVar('V', bound=SupportsAbs) # Can be anything with an __abs__ method" msgstr "" -#: ../../library/typing.rst:1787 +#: ../../library/typing.rst:1804 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:1790 +#: ../../library/typing.rst:1807 msgid "" "a = concatenate('one', 'two')\n" "reveal_type(a) # revealed type is str\n" @@ -2889,56 +2914,56 @@ msgid "" "or bytes in a function call, but not both" msgstr "" -#: ../../library/typing.rst:1798 +#: ../../library/typing.rst:1815 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." msgstr "" -#: ../../library/typing.rst:1802 +#: ../../library/typing.rst:1819 msgid "The name of the type variable." msgstr "" -#: ../../library/typing.rst:1806 +#: ../../library/typing.rst:1823 msgid "Whether the type var has been explicitly marked as covariant." msgstr "" -#: ../../library/typing.rst:1810 +#: ../../library/typing.rst:1827 msgid "Whether the type var has been explicitly marked as contravariant." msgstr "" -#: ../../library/typing.rst:1814 +#: ../../library/typing.rst:1831 msgid "" "Whether the type variable's variance should be inferred by type checkers." msgstr "" -#: ../../library/typing.rst:1820 +#: ../../library/typing.rst:1837 msgid "The bound of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1824 +#: ../../library/typing.rst:1841 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:1830 +#: ../../library/typing.rst:1847 msgid "A tuple containing the constraints of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1834 +#: ../../library/typing.rst:1851 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:1840 +#: ../../library/typing.rst:1857 msgid "" "The default value of the type variable, or :data:`typing.NoDefault` if it " "has no default." msgstr "" -#: ../../library/typing.rst:1847 +#: ../../library/typing.rst:1864 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." @@ -2946,31 +2971,31 @@ msgid "" "`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:1856 +#: ../../library/typing.rst:1873 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:1862 ../../library/typing.rst:2001 -#: ../../library/typing.rst:2103 +#: ../../library/typing.rst:1879 ../../library/typing.rst:2018 +#: ../../library/typing.rst:2120 msgid "Support for default values was added." msgstr "" -#: ../../library/typing.rst:1868 +#: ../../library/typing.rst:1885 msgid "" "Type variable tuple. A specialized form of :ref:`type variable ` " "that enables *variadic* generics." msgstr "" -#: ../../library/typing.rst:1871 +#: ../../library/typing.rst:1888 msgid "" "Type variable tuples can be declared in :ref:`type parameter lists ` using a single asterisk (``*``) before the name::" msgstr "" -#: ../../library/typing.rst:1874 +#: ../../library/typing.rst:1891 msgid "" "def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, " "T]:\n" @@ -2980,11 +3005,11 @@ msgstr "" "T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1877 +#: ../../library/typing.rst:1894 msgid "Or by explicitly invoking the ``TypeVarTuple`` constructor::" msgstr "" -#: ../../library/typing.rst:1879 +#: ../../library/typing.rst:1896 msgid "" "T = TypeVar(\"T\")\n" "Ts = TypeVarTuple(\"Ts\")\n" @@ -2998,7 +3023,7 @@ msgstr "" "def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1885 +#: ../../library/typing.rst:1902 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " @@ -3006,7 +3031,7 @@ msgid "" "wrapped in a tuple. For example::" msgstr "" -#: ../../library/typing.rst:1890 +#: ../../library/typing.rst:1907 msgid "" "# T is bound to int, Ts is bound to ()\n" "# Return value is (1,), which has type tuple[int]\n" @@ -3026,7 +3051,7 @@ msgid "" "move_first_element_to_last(tup=())" msgstr "" -#: ../../library/typing.rst:1907 +#: ../../library/typing.rst:1924 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, " @@ -3036,26 +3061,26 @@ msgid "" "` instead, as ``Unpack[Ts]``.)" msgstr "" -#: ../../library/typing.rst:1915 +#: ../../library/typing.rst:1932 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" -#: ../../library/typing.rst:1918 +#: ../../library/typing.rst:1935 msgid "" "x: Ts # Not valid\n" "x: tuple[Ts] # Not valid\n" "x: tuple[*Ts] # The correct way to do it" msgstr "" -#: ../../library/typing.rst:1922 +#: ../../library/typing.rst:1939 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:1925 +#: ../../library/typing.rst:1942 msgid "" "class Array[*Shape]:\n" " def __getitem__(self, key: tuple[*Shape]) -> float: ...\n" @@ -3067,12 +3092,12 @@ msgstr "" " def __abs__(self) -> \"Array[*Shape]\": ...\n" " def get_shape(self) -> tuple[*Shape]: ..." -#: ../../library/typing.rst:1930 +#: ../../library/typing.rst:1947 msgid "" "Type variable tuples can be happily combined with normal type variables:" msgstr "" -#: ../../library/typing.rst:1932 +#: ../../library/typing.rst:1949 msgid "" "class Array[DType, *Shape]: # This is fine\n" " pass\n" @@ -3087,26 +3112,26 @@ msgid "" "int_array_2d: Array[int, Height, Width] = Array() # Yup, fine too" msgstr "" -#: ../../library/typing.rst:1946 +#: ../../library/typing.rst:1963 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:1949 +#: ../../library/typing.rst:1966 msgid "" "x: tuple[*Ts, *Ts] # Not valid\n" "class Array[*Shape, *Shape]: # Not valid\n" " pass" msgstr "" -#: ../../library/typing.rst:1953 +#: ../../library/typing.rst:1970 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" -#: ../../library/typing.rst:1956 +#: ../../library/typing.rst:1973 msgid "" "def call_soon[*Ts](\n" " callback: Callable[[*Ts], None],\n" @@ -3122,7 +3147,7 @@ msgstr "" " ...\n" " callback(*args)" -#: ../../library/typing.rst:1963 +#: ../../library/typing.rst:1980 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -3131,21 +3156,21 @@ msgid "" "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" -#: ../../library/typing.rst:1970 +#: ../../library/typing.rst:1987 msgid "See :pep:`646` for more details on type variable tuples." msgstr "" -#: ../../library/typing.rst:1974 +#: ../../library/typing.rst:1991 msgid "The name of the type variable tuple." msgstr "" -#: ../../library/typing.rst:1978 +#: ../../library/typing.rst:1995 msgid "" "The default value of the type variable tuple, or :data:`typing.NoDefault` if " "it has no default." msgstr "" -#: ../../library/typing.rst:1985 +#: ../../library/typing.rst:2002 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." @@ -3153,39 +3178,39 @@ msgid "" "`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:1996 +#: ../../library/typing.rst:2013 msgid "" "Type variable tuples can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2005 +#: ../../library/typing.rst:2022 msgid "" "Parameter specification variable. A specialized version of :ref:`type " "variables `." msgstr "" -#: ../../library/typing.rst:2008 +#: ../../library/typing.rst:2025 msgid "" "In :ref:`type parameter lists `, parameter specifications can " "be declared with two asterisks (``**``)::" msgstr "" -#: ../../library/typing.rst:2011 +#: ../../library/typing.rst:2028 msgid "type IntFunc[**P] = Callable[P, int]" msgstr "type IntFunc[**P] = Callable[P, int]" -#: ../../library/typing.rst:2013 +#: ../../library/typing.rst:2030 msgid "" "For compatibility with Python 3.11 and earlier, ``ParamSpec`` objects can " "also be created as follows::" msgstr "" -#: ../../library/typing.rst:2016 +#: ../../library/typing.rst:2033 msgid "P = ParamSpec('P')" msgstr "P = ParamSpec('P')" -#: ../../library/typing.rst:2018 +#: ../../library/typing.rst:2035 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -3195,7 +3220,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:2025 +#: ../../library/typing.rst:2042 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 " @@ -3203,7 +3228,7 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:2030 +#: ../../library/typing.rst:2047 msgid "" "from collections.abc import Callable\n" "import logging\n" @@ -3221,27 +3246,27 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:2045 +#: ../../library/typing.rst:2062 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " "use a :class:`TypeVar` with bound ``Callable[..., Any]``. However this " "causes two problems:" msgstr "" -#: ../../library/typing.rst:2049 +#: ../../library/typing.rst:2066 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:2051 +#: ../../library/typing.rst:2068 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:2058 +#: ../../library/typing.rst:2075 msgid "" "Since ``ParamSpec`` captures both positional and keyword parameters, ``P." "args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " @@ -3254,17 +3279,17 @@ msgid "" "`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:2070 +#: ../../library/typing.rst:2087 msgid "The name of the parameter specification." msgstr "" -#: ../../library/typing.rst:2074 +#: ../../library/typing.rst:2091 msgid "" "The default value of the parameter specification, or :data:`typing." "NoDefault` if it has no default." msgstr "" -#: ../../library/typing.rst:2081 +#: ../../library/typing.rst:2098 msgid "" "Return whether or not the parameter specification has a default value. This " "is equivalent to checking whether :attr:`__default__` is not the :data:" @@ -3272,7 +3297,7 @@ msgid "" "the :ref:`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:2088 +#: ../../library/typing.rst:2105 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " @@ -3281,23 +3306,23 @@ msgid "" "decided." msgstr "" -#: ../../library/typing.rst:2098 +#: ../../library/typing.rst:2115 msgid "" "Parameter specifications can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2106 +#: ../../library/typing.rst:2123 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:2112 +#: ../../library/typing.rst:2129 msgid ":data:`Concatenate`" msgstr ":data:`Concatenate`" -#: ../../library/typing.rst:2118 +#: ../../library/typing.rst:2135 msgid "" "Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." "args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " @@ -3305,13 +3330,13 @@ msgid "" "runtime introspection and have no special meaning to static type checkers." msgstr "" -#: ../../library/typing.rst:2123 +#: ../../library/typing.rst:2140 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" -#: ../../library/typing.rst:2126 +#: ../../library/typing.rst:2143 msgid "" ">>> from typing import ParamSpec, get_origin\n" ">>> P = ParamSpec(\"P\")\n" @@ -3327,11 +3352,11 @@ msgstr "" ">>> get_origin(P.kwargs) is P\n" "True" -#: ../../library/typing.rst:2140 +#: ../../library/typing.rst:2157 msgid "The type of type aliases created through the :keyword:`type` statement." msgstr "" -#: ../../library/typing.rst:2144 +#: ../../library/typing.rst:2161 msgid "" ">>> type Alias = int\n" ">>> type(Alias)\n" @@ -3341,11 +3366,11 @@ msgstr "" ">>> type(Alias)\n" "" -#: ../../library/typing.rst:2154 +#: ../../library/typing.rst:2171 msgid "The name of the type alias:" msgstr "" -#: ../../library/typing.rst:2156 +#: ../../library/typing.rst:2173 msgid "" ">>> type Alias = int\n" ">>> Alias.__name__\n" @@ -3355,11 +3380,11 @@ msgstr "" ">>> Alias.__name__\n" "'Alias'" -#: ../../library/typing.rst:2164 +#: ../../library/typing.rst:2181 msgid "The module in which the type alias was defined::" msgstr "" -#: ../../library/typing.rst:2166 +#: ../../library/typing.rst:2183 msgid "" ">>> type Alias = int\n" ">>> Alias.__module__\n" @@ -3369,13 +3394,13 @@ msgstr "" ">>> Alias.__module__\n" "'__main__'" -#: ../../library/typing.rst:2172 +#: ../../library/typing.rst:2189 msgid "" "The type parameters of the type alias, or an empty tuple if the alias is not " "generic:" msgstr "" -#: ../../library/typing.rst:2175 +#: ../../library/typing.rst:2192 msgid "" ">>> type ListOrSet[T] = list[T] | set[T]\n" ">>> ListOrSet.__type_params__\n" @@ -3391,14 +3416,14 @@ msgstr "" ">>> NotGeneric.__type_params__\n" "()" -#: ../../library/typing.rst:2186 +#: ../../library/typing.rst:2203 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:2190 +#: ../../library/typing.rst:2207 msgid "" ">>> type Mutually = Recursive\n" ">>> type Recursive = Mutually\n" @@ -3422,27 +3447,27 @@ msgstr "" ">>> Recursive.__value__\n" "Mutually" -#: ../../library/typing.rst:2204 +#: ../../library/typing.rst:2221 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:2206 +#: ../../library/typing.rst:2223 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:2212 +#: ../../library/typing.rst:2229 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:2214 ../../library/typing.rst:2304 -#: ../../library/typing.rst:3343 +#: ../../library/typing.rst:2231 ../../library/typing.rst:2323 +#: ../../library/typing.rst:3364 msgid "Usage::" msgstr "" -#: ../../library/typing.rst:2216 +#: ../../library/typing.rst:2233 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3452,20 +3477,20 @@ msgstr "" " name: str\n" " id: int" -#: ../../library/typing.rst:2220 +#: ../../library/typing.rst:2237 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../library/typing.rst:2222 +#: ../../library/typing.rst:2239 msgid "Employee = collections.namedtuple('Employee', ['name', 'id'])" msgstr "Employee = collections.namedtuple('Employee', ['name', 'id'])" -#: ../../library/typing.rst:2224 +#: ../../library/typing.rst:2241 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:2226 +#: ../../library/typing.rst:2243 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3481,12 +3506,12 @@ msgstr "" "employee = Employee('Guido')\n" "assert employee.id == 3" -#: ../../library/typing.rst:2233 +#: ../../library/typing.rst:2250 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:2235 +#: ../../library/typing.rst:2252 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 " @@ -3495,11 +3520,11 @@ msgid "" "API.)" msgstr "" -#: ../../library/typing.rst:2241 +#: ../../library/typing.rst:2258 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:2243 +#: ../../library/typing.rst:2260 msgid "" "class Employee(NamedTuple):\n" " \"\"\"Represents an employee.\"\"\"\n" @@ -3510,11 +3535,11 @@ msgid "" " return f''" msgstr "" -#: ../../library/typing.rst:2251 +#: ../../library/typing.rst:2268 msgid "``NamedTuple`` subclasses can be generic::" msgstr "" -#: ../../library/typing.rst:2253 +#: ../../library/typing.rst:2270 msgid "" "class Group[T](NamedTuple):\n" " key: T\n" @@ -3524,13 +3549,15 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2257 +#: ../../library/typing.rst:2274 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:2259 +#: ../../library/typing.rst:2276 msgid "" -"# For creating a generic NamedTuple on Python 3.11 or lower\n" +"# For creating a generic NamedTuple on Python 3.11\n" +"T = TypeVar(\"T\")\n" +"\n" "class Group(NamedTuple, Generic[T]):\n" " key: T\n" " group: list[T]\n" @@ -3539,38 +3566,38 @@ msgid "" "Employee = NamedTuple('Employee', [('name', str), ('id', int)])" msgstr "" -#: ../../library/typing.rst:2267 +#: ../../library/typing.rst:2286 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:2270 +#: ../../library/typing.rst:2289 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:2273 +#: ../../library/typing.rst:2292 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:2277 +#: ../../library/typing.rst:2296 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:2281 +#: ../../library/typing.rst:2300 msgid "Added support for generic namedtuples." msgstr "" -#: ../../library/typing.rst:2284 +#: ../../library/typing.rst:2303 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:2289 +#: ../../library/typing.rst:2308 msgid "" "When using the functional syntax to create a NamedTuple class, failing to " "pass a value to the 'fields' parameter (``NT = NamedTuple(\"NT\")``) is " @@ -3580,48 +3607,48 @@ msgid "" "NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", [])``." msgstr "" -#: ../../library/typing.rst:2299 +#: ../../library/typing.rst:2318 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" -#: ../../library/typing.rst:2301 +#: ../../library/typing.rst:2320 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:2306 +#: ../../library/typing.rst:2325 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:2311 +#: ../../library/typing.rst:2330 msgid "The module in which the new type is defined." msgstr "" -#: ../../library/typing.rst:2315 +#: ../../library/typing.rst:2334 msgid "The name of the new type." msgstr "" -#: ../../library/typing.rst:2319 +#: ../../library/typing.rst:2338 msgid "The type that the new type is based on." msgstr "" -#: ../../library/typing.rst:2323 +#: ../../library/typing.rst:2342 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:2328 +#: ../../library/typing.rst:2347 msgid "Base class for protocol classes." msgstr "" -#: ../../library/typing.rst:2330 +#: ../../library/typing.rst:2349 msgid "Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:2332 +#: ../../library/typing.rst:2351 msgid "" "class Proto(Protocol):\n" " def meth(self) -> int:\n" @@ -3631,13 +3658,13 @@ msgstr "" " def meth(self) -> int:\n" " ..." -#: ../../library/typing.rst:2336 +#: ../../library/typing.rst:2355 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:2339 +#: ../../library/typing.rst:2358 msgid "" "class C:\n" " def meth(self) -> int:\n" @@ -3649,7 +3676,7 @@ msgid "" "func(C()) # Passes static type check" msgstr "" -#: ../../library/typing.rst:2348 +#: ../../library/typing.rst:2367 msgid "" "See :pep:`544` for more details. Protocol classes decorated with :func:" "`runtime_checkable` (described later) act as simple-minded runtime protocols " @@ -3657,11 +3684,11 @@ msgid "" "signatures." msgstr "" -#: ../../library/typing.rst:2353 +#: ../../library/typing.rst:2372 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:2355 +#: ../../library/typing.rst:2374 msgid "" "class GenProto[T](Protocol):\n" " def meth(self) -> T:\n" @@ -3671,13 +3698,13 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2359 +#: ../../library/typing.rst:2378 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:2362 +#: ../../library/typing.rst:2381 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -3691,11 +3718,11 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2372 +#: ../../library/typing.rst:2391 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:2374 +#: ../../library/typing.rst:2393 msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " "This raises :exc:`TypeError` when applied to a non-protocol class. This " @@ -3704,7 +3731,7 @@ msgid "" "Iterable`. For example::" msgstr "" -#: ../../library/typing.rst:2379 +#: ../../library/typing.rst:2398 msgid "" "@runtime_checkable\n" "class Closable(Protocol):\n" @@ -3732,7 +3759,7 @@ msgstr "" "import threading\n" "assert isinstance(threading.Thread(name='Bob'), Named)" -#: ../../library/typing.rst:2394 +#: ../../library/typing.rst:2413 msgid "" ":func:`!runtime_checkable` will check only the presence of the required " "methods or attributes, not their type signatures or types. For example, :" @@ -3743,7 +3770,7 @@ msgid "" "(instantiate) :class:`ssl.SSLObject`." msgstr "" -#: ../../library/typing.rst:2405 +#: ../../library/typing.rst:2424 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" @@ -3751,7 +3778,7 @@ msgid "" "calls for structural checks in performance-sensitive code." msgstr "" -#: ../../library/typing.rst:2413 +#: ../../library/typing.rst:2432 msgid "" "The internal implementation of :func:`isinstance` checks against runtime-" "checkable protocols now uses :func:`inspect.getattr_static` to look up " @@ -3761,7 +3788,7 @@ msgid "" "versa. Most users are unlikely to be affected by this change." msgstr "" -#: ../../library/typing.rst:2422 +#: ../../library/typing.rst:2441 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 " @@ -3770,13 +3797,13 @@ msgid "" "`\"What's new in Python 3.12\" ` for more details." msgstr "" -#: ../../library/typing.rst:2433 +#: ../../library/typing.rst:2452 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: ../../library/typing.rst:2436 +#: ../../library/typing.rst:2455 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 " @@ -3784,7 +3811,7 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:2442 +#: ../../library/typing.rst:2461 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3797,24 +3824,24 @@ msgid "" "assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')" msgstr "" -#: ../../library/typing.rst:2452 +#: ../../library/typing.rst:2471 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:2455 +#: ../../library/typing.rst:2474 msgid "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" msgstr "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" -#: ../../library/typing.rst:2457 +#: ../../library/typing.rst:2476 msgid "" "This functional syntax allows defining keys which are not valid :ref:" "`identifiers `, for example because they are keywords or " "contain hyphens::" msgstr "" -#: ../../library/typing.rst:2461 +#: ../../library/typing.rst:2480 msgid "" "# raises SyntaxError\n" "class Point2D(TypedDict):\n" @@ -3825,13 +3852,13 @@ msgid "" "Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})" msgstr "" -#: ../../library/typing.rst:2469 +#: ../../library/typing.rst:2488 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:2472 +#: ../../library/typing.rst:2491 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3843,19 +3870,19 @@ msgid "" "NotRequired[str]})" msgstr "" -#: ../../library/typing.rst:2480 +#: ../../library/typing.rst:2499 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." msgstr "" -#: ../../library/typing.rst:2483 +#: ../../library/typing.rst:2502 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" -#: ../../library/typing.rst:2486 +#: ../../library/typing.rst:2505 msgid "" "class Point2D(TypedDict, total=False):\n" " x: int\n" @@ -3865,7 +3892,7 @@ msgid "" "Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" msgstr "" -#: ../../library/typing.rst:2493 +#: ../../library/typing.rst:2512 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 " @@ -3873,13 +3900,13 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:2498 +#: ../../library/typing.rst:2517 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" -#: ../../library/typing.rst:2501 +#: ../../library/typing.rst:2520 msgid "" "class Point2D(TypedDict, total=False):\n" " x: Required[int]\n" @@ -3894,13 +3921,13 @@ msgid "" "}, total=False)" msgstr "" -#: ../../library/typing.rst:2513 +#: ../../library/typing.rst:2532 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:2517 +#: ../../library/typing.rst:2536 msgid "" "class Point3D(Point2D):\n" " z: int" @@ -3908,13 +3935,13 @@ msgstr "" "class Point3D(Point2D):\n" " z: int" -#: ../../library/typing.rst:2520 +#: ../../library/typing.rst:2539 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:2523 +#: ../../library/typing.rst:2542 msgid "" "class Point3D(TypedDict):\n" " x: int\n" @@ -3926,13 +3953,13 @@ msgstr "" " y: int\n" " z: int" -#: ../../library/typing.rst:2528 +#: ../../library/typing.rst:2547 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:2531 +#: ../../library/typing.rst:2550 msgid "" "class X(TypedDict):\n" " x: int\n" @@ -3947,11 +3974,11 @@ msgid "" "class XZ(X, Z): pass # raises TypeError" msgstr "" -#: ../../library/typing.rst:2543 +#: ../../library/typing.rst:2562 msgid "A ``TypedDict`` can be generic::" msgstr "" -#: ../../library/typing.rst:2545 +#: ../../library/typing.rst:2564 msgid "" "class Group[T](TypedDict):\n" " key: T\n" @@ -3961,13 +3988,13 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2549 +#: ../../library/typing.rst:2568 msgid "" "To create a generic ``TypedDict`` that is compatible with Python 3.11 or " "lower, inherit from :class:`Generic` explicitly:" msgstr "" -#: ../../library/typing.rst:2552 +#: ../../library/typing.rst:2571 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -3981,19 +4008,19 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2560 +#: ../../library/typing.rst:2579 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:2566 +#: ../../library/typing.rst:2585 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" -#: ../../library/typing.rst:2569 +#: ../../library/typing.rst:2588 msgid "" ">>> from typing import TypedDict\n" ">>> class Point2D(TypedDict): pass\n" @@ -4017,7 +4044,7 @@ msgstr "" ">>> Point3D.__total__\n" "True" -#: ../../library/typing.rst:2582 +#: ../../library/typing.rst:2601 msgid "" "This attribute reflects *only* the value of the ``total`` argument to the " "current ``TypedDict`` class, not whether the class is semantically total. " @@ -4028,21 +4055,21 @@ msgid "" "introspection." msgstr "" -#: ../../library/typing.rst:2595 +#: ../../library/typing.rst:2614 msgid "" "``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" "class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" -#: ../../library/typing.rst:2598 +#: ../../library/typing.rst:2617 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:2601 +#: ../../library/typing.rst:2620 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 " @@ -4051,7 +4078,7 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: ../../library/typing.rst:2608 +#: ../../library/typing.rst:2627 msgid "" ">>> class Point2D(TypedDict, total=False):\n" "... x: int\n" @@ -4077,7 +4104,7 @@ msgstr "" ">>> Point3D.__optional_keys__ == frozenset({'x', 'y'})\n" "True" -#: ../../library/typing.rst:2626 +#: ../../library/typing.rst:2645 msgid "" "If ``from __future__ import annotations`` is used or if annotations are " "given as strings, annotations are not evaluated when the ``TypedDict`` is " @@ -4086,48 +4113,48 @@ msgid "" "attributes may be incorrect." msgstr "" -#: ../../library/typing.rst:2632 +#: ../../library/typing.rst:2651 msgid "Support for :data:`ReadOnly` is reflected in the following attributes:" msgstr "" -#: ../../library/typing.rst:2636 +#: ../../library/typing.rst:2655 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:2643 +#: ../../library/typing.rst:2662 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:2648 +#: ../../library/typing.rst:2667 msgid "" "See :pep:`589` for more examples and detailed rules of using ``TypedDict``." msgstr "" -#: ../../library/typing.rst:2652 +#: ../../library/typing.rst:2671 msgid "" "Added support for marking individual keys as :data:`Required` or :data:" "`NotRequired`. See :pep:`655`." msgstr "" -#: ../../library/typing.rst:2656 +#: ../../library/typing.rst:2675 msgid "Added support for generic ``TypedDict``\\ s." msgstr "" -#: ../../library/typing.rst:2659 +#: ../../library/typing.rst:2678 msgid "" "Removed support for the keyword-argument method of creating ``TypedDict``\\ " "s." msgstr "" -#: ../../library/typing.rst:2662 +#: ../../library/typing.rst:2681 msgid "Support for the :data:`ReadOnly` qualifier was added." msgstr "" -#: ../../library/typing.rst:2665 +#: ../../library/typing.rst:2684 msgid "" "When using the functional syntax to create a TypedDict class, failing to " "pass a value to the 'fields' parameter (``TD = TypedDict(\"TD\")``) is " @@ -4137,106 +4164,106 @@ msgid "" "TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." msgstr "" -#: ../../library/typing.rst:2674 +#: ../../library/typing.rst:2693 msgid "Protocols" msgstr "協定" -#: ../../library/typing.rst:2676 +#: ../../library/typing.rst:2695 msgid "" "The following protocols are provided by the typing module. All are decorated " "with :func:`@runtime_checkable `." msgstr "" -#: ../../library/typing.rst:2681 +#: ../../library/typing.rst:2700 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:2686 +#: ../../library/typing.rst:2705 msgid "An ABC with one abstract method ``__bytes__``." msgstr "一個有抽象方法 ``__bytes__`` 的 ABC。" -#: ../../library/typing.rst:2690 +#: ../../library/typing.rst:2709 msgid "An ABC with one abstract method ``__complex__``." msgstr "一個有抽象方法 ``__complex__`` 的 ABC。" -#: ../../library/typing.rst:2694 +#: ../../library/typing.rst:2713 msgid "An ABC with one abstract method ``__float__``." msgstr "一個有抽象方法 ``__float__`` 的 ABC。" -#: ../../library/typing.rst:2698 +#: ../../library/typing.rst:2717 msgid "An ABC with one abstract method ``__index__``." msgstr "一個有抽象方法 ``__index__`` 的 ABC。" -#: ../../library/typing.rst:2704 +#: ../../library/typing.rst:2723 msgid "An ABC with one abstract method ``__int__``." msgstr "一個有抽象方法 ``__int__`` 的 ABC。" -#: ../../library/typing.rst:2708 +#: ../../library/typing.rst:2727 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2712 +#: ../../library/typing.rst:2731 msgid "ABCs for working with IO" msgstr "" -#: ../../library/typing.rst:2718 +#: ../../library/typing.rst:2737 msgid "" "Generic type ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " "by :func:`open`." msgstr "" -#: ../../library/typing.rst:2724 +#: ../../library/typing.rst:2743 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2728 +#: ../../library/typing.rst:2747 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2730 +#: ../../library/typing.rst:2749 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:2737 +#: ../../library/typing.rst:2756 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" -#: ../../library/typing.rst:2739 +#: ../../library/typing.rst:2758 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:2742 +#: ../../library/typing.rst:2761 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:2745 +#: ../../library/typing.rst:2764 msgid "" "def greet(name: str) -> None:\n" " assert_type(name, str) # OK, inferred type of `name` is `str`\n" " assert_type(name, int) # type checker error" msgstr "" -#: ../../library/typing.rst:2749 +#: ../../library/typing.rst:2768 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:2752 +#: ../../library/typing.rst:2771 msgid "" "def complex_function(arg: object):\n" " # Do some complex type-narrowing logic,\n" @@ -4246,16 +4273,16 @@ msgid "" " assert_type(arg, int)" msgstr "" -#: ../../library/typing.rst:2763 +#: ../../library/typing.rst:2782 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" -#: ../../library/typing.rst:2765 +#: ../../library/typing.rst:2784 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/typing.rst:2767 +#: ../../library/typing.rst:2786 msgid "" "def int_or_str(arg: int | str) -> None:\n" " match arg:\n" @@ -4275,14 +4302,14 @@ msgstr "" " case _ as unreachable:\n" " assert_never(unreachable)" -#: ../../library/typing.rst:2776 +#: ../../library/typing.rst:2795 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:2781 +#: ../../library/typing.rst:2800 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 " @@ -4292,47 +4319,47 @@ msgid "" "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" -#: ../../library/typing.rst:2789 +#: ../../library/typing.rst:2808 msgid "At runtime, this throws an exception when called." msgstr "" -#: ../../library/typing.rst:2792 +#: ../../library/typing.rst:2811 msgid "" "`Unreachable Code and Exhaustiveness Checking `__ has more information about " "exhaustiveness checking with static typing." msgstr "" -#: ../../library/typing.rst:2800 +#: ../../library/typing.rst:2819 msgid "Ask a static type checker to reveal the inferred type of an expression." msgstr "" -#: ../../library/typing.rst:2802 +#: ../../library/typing.rst:2821 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:2805 +#: ../../library/typing.rst:2824 msgid "" "x: int = 1\n" "reveal_type(x) # Revealed type is \"builtins.int\"" msgstr "" -#: ../../library/typing.rst:2808 +#: ../../library/typing.rst:2827 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" -#: ../../library/typing.rst:2811 +#: ../../library/typing.rst:2830 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:2815 +#: ../../library/typing.rst:2834 msgid "" "x = reveal_type(1) # prints \"Runtime type is int\"\n" "print(x) # prints \"1\"" @@ -4340,13 +4367,13 @@ msgstr "" "x = reveal_type(1) # 印出 \"Runtime type is int\"\n" "print(x) # 印出 \"1\"" -#: ../../library/typing.rst:2818 +#: ../../library/typing.rst:2837 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:2821 +#: ../../library/typing.rst:2840 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing``, however, " @@ -4354,13 +4381,13 @@ msgid "" "clearly." msgstr "" -#: ../../library/typing.rst:2832 +#: ../../library/typing.rst:2851 msgid "" "Decorator to mark an object as providing :func:`dataclass `-like behavior." msgstr "" -#: ../../library/typing.rst:2835 +#: ../../library/typing.rst:2854 msgid "" "``dataclass_transform`` may be used to decorate a class, metaclass, or a " "function that is itself a decorator. The presence of " @@ -4369,11 +4396,11 @@ msgid "" "to :func:`@dataclasses.dataclass `." msgstr "" -#: ../../library/typing.rst:2842 +#: ../../library/typing.rst:2861 msgid "Example usage with a decorator function:" msgstr "" -#: ../../library/typing.rst:2844 +#: ../../library/typing.rst:2863 msgid "" "@dataclass_transform()\n" "def create_model[T](cls: type[T]) -> type[T]:\n" @@ -4395,11 +4422,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2856 +#: ../../library/typing.rst:2875 msgid "On a base class::" msgstr "" -#: ../../library/typing.rst:2858 +#: ../../library/typing.rst:2877 msgid "" "@dataclass_transform()\n" "class ModelBase: ...\n" @@ -4415,11 +4442,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2865 +#: ../../library/typing.rst:2884 msgid "On a metaclass::" msgstr "" -#: ../../library/typing.rst:2867 +#: ../../library/typing.rst:2886 msgid "" "@dataclass_transform()\n" "class ModelMeta(type): ...\n" @@ -4439,7 +4466,7 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2876 +#: ../../library/typing.rst:2895 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " "similarly to classes created with :func:`@dataclasses.dataclass None:\n" @@ -4645,24 +4672,24 @@ msgid "" " ... # actual implementation goes here" msgstr "" -#: ../../library/typing.rst:3004 +#: ../../library/typing.rst:3023 msgid "" "See :pep:`484` for more details and comparison with other typing semantics." msgstr "" -#: ../../library/typing.rst:3006 +#: ../../library/typing.rst:3025 msgid "" "Overloaded functions can now be introspected at runtime using :func:" "`get_overloads`." msgstr "" -#: ../../library/typing.rst:3013 +#: ../../library/typing.rst:3032 msgid "" "Return a sequence of :func:`@overload `-decorated definitions for " "*func*." msgstr "" -#: ../../library/typing.rst:3016 +#: ../../library/typing.rst:3035 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " @@ -4672,32 +4699,32 @@ msgid "" "returns an empty sequence." msgstr "" -#: ../../library/typing.rst:3023 +#: ../../library/typing.rst:3042 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" -#: ../../library/typing.rst:3031 +#: ../../library/typing.rst:3050 msgid "Clear all registered overloads in the internal registry." msgstr "" -#: ../../library/typing.rst:3033 +#: ../../library/typing.rst:3052 msgid "This can be used to reclaim the memory used by the registry." msgstr "" -#: ../../library/typing.rst:3040 +#: ../../library/typing.rst:3059 msgid "Decorator to indicate final methods and final classes." msgstr "" -#: ../../library/typing.rst:3042 +#: ../../library/typing.rst:3061 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:3048 +#: ../../library/typing.rst:3067 msgid "" "class Base:\n" " @final\n" @@ -4714,7 +4741,7 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:3067 +#: ../../library/typing.rst:3086 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__\", " @@ -4724,11 +4751,11 @@ msgid "" "exception." msgstr "" -#: ../../library/typing.rst:3078 +#: ../../library/typing.rst:3097 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:3080 +#: ../../library/typing.rst:3099 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 " @@ -4736,40 +4763,40 @@ msgid "" "will ignore all annotations in a function or class with this decorator." msgstr "" -#: ../../library/typing.rst:3086 +#: ../../library/typing.rst:3105 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" -#: ../../library/typing.rst:3090 +#: ../../library/typing.rst:3109 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:3092 +#: ../../library/typing.rst:3111 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:3095 +#: ../../library/typing.rst:3114 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:3101 +#: ../../library/typing.rst:3120 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:3104 +#: ../../library/typing.rst:3123 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:3111 +#: ../../library/typing.rst:3130 msgid "" "class Base:\n" " def log_status(self) -> None:\n" @@ -4785,11 +4812,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:3126 +#: ../../library/typing.rst:3145 msgid "There is no runtime checking of this property." msgstr "" -#: ../../library/typing.rst:3128 +#: ../../library/typing.rst:3147 msgid "" "The decorator will attempt to set an ``__override__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, " @@ -4799,22 +4826,22 @@ msgid "" "without raising an exception." msgstr "" -#: ../../library/typing.rst:3135 +#: ../../library/typing.rst:3154 msgid "See :pep:`698` for more details." msgstr "更多細節請見 :pep:`698`。" -#: ../../library/typing.rst:3142 +#: ../../library/typing.rst:3161 msgid "Decorator to mark a class or function as unavailable at runtime." msgstr "" -#: ../../library/typing.rst:3144 +#: ../../library/typing.rst:3163 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:3148 +#: ../../library/typing.rst:3167 msgid "" "@type_check_only\n" "class Response: # private or not available at runtime\n" @@ -4824,29 +4851,29 @@ msgid "" "def fetch_response() -> Response: ..." msgstr "" -#: ../../library/typing.rst:3155 +#: ../../library/typing.rst:3174 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:3159 +#: ../../library/typing.rst:3178 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:3163 +#: ../../library/typing.rst:3182 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: ../../library/typing.rst:3166 +#: ../../library/typing.rst:3185 msgid "" "This is often the same as ``obj.__annotations__``, but this function makes " "the following changes to the annotations dictionary:" msgstr "" -#: ../../library/typing.rst:3169 +#: ../../library/typing.rst:3188 msgid "" "Forward references encoded as string literals or :class:`ForwardRef` objects " "are handled by evaluating them in *globalns*, *localns*, and (where " @@ -4855,40 +4882,40 @@ msgid "" "inferred from *obj*." msgstr "" -#: ../../library/typing.rst:3174 +#: ../../library/typing.rst:3193 msgid "``None`` is replaced with :class:`types.NoneType`." msgstr "" -#: ../../library/typing.rst:3175 +#: ../../library/typing.rst:3194 msgid "" "If :func:`@no_type_check ` has been applied to *obj*, an " "empty dictionary is returned." msgstr "" -#: ../../library/typing.rst:3177 +#: ../../library/typing.rst:3196 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 ``C.__mro__`` and iteratively combining " -"``__annotations__`` dictionaries. Annotations on classes appearing earlier " -"in the :term:`method resolution order` always take precedence over " +"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." msgstr "" -#: ../../library/typing.rst:3183 +#: ../../library/typing.rst:3203 msgid "" "The function recursively replaces all occurrences of ``Annotated[T, ...]`` " "with ``T``, unless *include_extras* is set to ``True`` (see :class:" "`Annotated` for more information)." msgstr "" -#: ../../library/typing.rst:3187 +#: ../../library/typing.rst:3207 msgid "" "See also :func:`inspect.get_annotations`, a lower-level function that " "returns annotations more directly." msgstr "" -#: ../../library/typing.rst:3192 +#: ../../library/typing.rst:3212 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 :" @@ -4897,7 +4924,7 @@ msgid "" "imported under :data:`if TYPE_CHECKING `." msgstr "" -#: ../../library/typing.rst:3198 +#: ../../library/typing.rst:3218 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." @@ -4905,20 +4932,20 @@ msgstr "" "新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" "`Annotated` 的文件。" -#: ../../library/typing.rst:3202 +#: ../../library/typing.rst:3222 msgid "" "Previously, ``Optional[t]`` was added for function and method annotations if " "a default value equal to ``None`` was set. Now the annotation is returned " "unchanged." msgstr "" -#: ../../library/typing.rst:3209 +#: ../../library/typing.rst:3229 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:3212 +#: ../../library/typing.rst:3232 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 :" @@ -4926,15 +4953,16 @@ msgid "" "class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:3218 ../../library/typing.rst:3241 +#: ../../library/typing.rst:3238 ../../library/typing.rst:3262 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:3220 +#: ../../library/typing.rst:3240 msgid "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" "assert get_origin(Union[int, str]) is Union\n" +"assert get_origin(Annotated[str, \"metadata\"]) is Annotated\n" "P = ParamSpec('P')\n" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" @@ -4942,17 +4970,18 @@ msgstr "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" "assert get_origin(Union[int, str]) is Union\n" +"assert get_origin(Annotated[str, \"metadata\"]) is Annotated\n" "P = ParamSpec('P')\n" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" -#: ../../library/typing.rst:3233 +#: ../../library/typing.rst:3254 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:3236 +#: ../../library/typing.rst:3257 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 " @@ -4960,7 +4989,7 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:3243 +#: ../../library/typing.rst:3264 msgid "" "assert get_args(int) == ()\n" "assert get_args(Dict[int, str]) == (int, str)\n" @@ -4970,11 +4999,11 @@ msgstr "" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" -#: ../../library/typing.rst:3253 +#: ../../library/typing.rst:3274 msgid "Return the set of members defined in a :class:`Protocol`." msgstr "" -#: ../../library/typing.rst:3255 +#: ../../library/typing.rst:3276 msgid "" ">>> from typing import Protocol, get_protocol_members\n" ">>> class P(Protocol):\n" @@ -4984,16 +5013,15 @@ msgid "" "True" msgstr "" -#: ../../library/typing.rst:3264 +#: ../../library/typing.rst:3285 msgid "Raise :exc:`TypeError` for arguments that are not Protocols." msgstr "" -#: ../../library/typing.rst:3270 -#, fuzzy +#: ../../library/typing.rst:3291 msgid "Determine if a type is a :class:`Protocol`." -msgstr "棄用 :class:`tuple` 的別名。" +msgstr "確定一個型別是否 :class:`Protocol`。" -#: ../../library/typing.rst:3274 +#: ../../library/typing.rst:3295 msgid "" "class P(Protocol):\n" " def a(self) -> str: ...\n" @@ -5003,11 +5031,11 @@ msgid "" "is_protocol(int) # => False" msgstr "" -#: ../../library/typing.rst:3285 +#: ../../library/typing.rst:3306 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:3289 +#: ../../library/typing.rst:3310 msgid "" "class Film(TypedDict):\n" " title: str\n" @@ -5021,32 +5049,32 @@ msgid "" "assert not is_typeddict(TypedDict)" msgstr "" -#: ../../library/typing.rst:3306 +#: ../../library/typing.rst:3327 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:3308 +#: ../../library/typing.rst:3329 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. ``ForwardRef`` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:3313 +#: ../../library/typing.rst:3334 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:3321 +#: ../../library/typing.rst:3342 msgid "" "A sentinel object used to indicate that a type parameter has no default " "value. For example:" msgstr "" -#: ../../library/typing.rst:3324 +#: ../../library/typing.rst:3345 msgid "" ">>> T = TypeVar(\"T\")\n" ">>> T.__default__ is typing.NoDefault\n" @@ -5056,17 +5084,17 @@ msgid "" "True" msgstr "" -#: ../../library/typing.rst:3336 +#: ../../library/typing.rst:3357 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:3340 +#: ../../library/typing.rst:3361 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It is ``False`` at runtime." msgstr "" -#: ../../library/typing.rst:3345 +#: ../../library/typing.rst:3366 msgid "" "if TYPE_CHECKING:\n" " import expensive_mod\n" @@ -5080,7 +5108,7 @@ msgstr "" "def fun(arg: 'expensive_mod.SomeType') -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" -#: ../../library/typing.rst:3351 +#: ../../library/typing.rst:3372 msgid "" "The first type annotation must be enclosed in quotes, making it a \"forward " "reference\", to hide the ``expensive_mod`` reference from the interpreter " @@ -5088,7 +5116,7 @@ msgid "" "second annotation does not need to be enclosed in quotes." msgstr "" -#: ../../library/typing.rst:3358 +#: ../../library/typing.rst:3379 msgid "" "If ``from __future__ import annotations`` is used, annotations are not " "evaluated at function definition time. Instead, they are stored as strings " @@ -5096,11 +5124,11 @@ msgid "" "annotation (see :pep:`563`)." msgstr "" -#: ../../library/typing.rst:3370 +#: ../../library/typing.rst:3391 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:3372 +#: ../../library/typing.rst:3393 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the typing module in " @@ -5109,7 +5137,7 @@ msgid "" "existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:3379 +#: ../../library/typing.rst:3400 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 " @@ -5117,7 +5145,7 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:3384 +#: ../../library/typing.rst:3405 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 " @@ -5125,38 +5153,38 @@ msgid "" "typing module without deprecation warnings until at least Python 3.14." msgstr "" -#: ../../library/typing.rst:3389 +#: ../../library/typing.rst:3410 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:3395 +#: ../../library/typing.rst:3416 msgid "Aliases to built-in types" msgstr "內建型別的別名" -#: ../../library/typing.rst:3399 +#: ../../library/typing.rst:3420 msgid "Deprecated alias to :class:`dict`." msgstr "棄用 :class:`dict` 的別名。" -#: ../../library/typing.rst:3401 +#: ../../library/typing.rst:3422 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:3405 +#: ../../library/typing.rst:3426 msgid "" ":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3411 +#: ../../library/typing.rst:3432 msgid "Deprecated alias to :class:`list`." msgstr "棄用 :class:`list` 的別名。" -#: ../../library/typing.rst:3413 +#: ../../library/typing.rst:3434 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Sequence` or :class:" @@ -5164,136 +5192,136 @@ msgid "" "typing.List`." msgstr "" -#: ../../library/typing.rst:3418 +#: ../../library/typing.rst:3439 msgid "" ":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3424 +#: ../../library/typing.rst:3445 msgid "Deprecated alias to :class:`builtins.set `." msgstr "棄用 :class:`builtins.set ` 的別名。" -#: ../../library/typing.rst:3426 +#: ../../library/typing.rst:3447 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:3430 +#: ../../library/typing.rst:3451 msgid "" ":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3436 +#: ../../library/typing.rst:3457 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "棄用 :class:`builtins.frozenset ` 的別名。" -#: ../../library/typing.rst:3438 +#: ../../library/typing.rst:3459 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3445 +#: ../../library/typing.rst:3466 msgid "Deprecated alias for :class:`tuple`." msgstr "棄用 :class:`tuple` 的別名。" -#: ../../library/typing.rst:3447 +#: ../../library/typing.rst:3468 msgid "" ":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" "`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:3450 +#: ../../library/typing.rst:3471 msgid "" ":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3456 +#: ../../library/typing.rst:3477 msgid "Deprecated alias to :class:`type`." msgstr "棄用 :class:`type` 的別名。" -#: ../../library/typing.rst:3458 +#: ../../library/typing.rst:3479 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:3463 +#: ../../library/typing.rst:3484 msgid "" ":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3470 +#: ../../library/typing.rst:3491 msgid "Aliases to types in :mod:`collections`" msgstr ":mod:`collections` 中型別的別名" -#: ../../library/typing.rst:3474 +#: ../../library/typing.rst:3495 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "棄用 :class:`collections.defaultdict` 的別名。" -#: ../../library/typing.rst:3478 +#: ../../library/typing.rst:3499 msgid "" ":class:`collections.defaultdict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3484 +#: ../../library/typing.rst:3505 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "棄用 :class:`collections.OrderedDict` 的別名。" -#: ../../library/typing.rst:3488 +#: ../../library/typing.rst:3509 msgid "" ":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3494 +#: ../../library/typing.rst:3515 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "棄用 :class:`collections.ChainMap` 的別名。" -#: ../../library/typing.rst:3498 +#: ../../library/typing.rst:3519 msgid "" ":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3504 +#: ../../library/typing.rst:3525 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "棄用 :class:`collections.Counter` 的別名。" -#: ../../library/typing.rst:3508 +#: ../../library/typing.rst:3529 msgid "" ":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3514 +#: ../../library/typing.rst:3535 msgid "Deprecated alias to :class:`collections.deque`." msgstr "棄用 :class:`collections.deque` 的別名。" -#: ../../library/typing.rst:3518 +#: ../../library/typing.rst:3539 msgid "" ":class:`collections.deque` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3525 +#: ../../library/typing.rst:3546 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:3530 +#: ../../library/typing.rst:3551 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3533 +#: ../../library/typing.rst:3554 msgid "" "These types (and the corresponding functions) are generic over :data:" "`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " @@ -5301,343 +5329,343 @@ msgid "" "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:3538 +#: ../../library/typing.rst:3559 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3544 +#: ../../library/typing.rst:3565 msgid "Deprecated alias for :class:`str`." msgstr "棄用 :class:`str` 的別名。" -#: ../../library/typing.rst:3546 +#: ../../library/typing.rst:3567 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:3550 +#: ../../library/typing.rst:3571 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:3553 +#: ../../library/typing.rst:3574 msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" msgstr "" -#: ../../library/typing.rst:3558 +#: ../../library/typing.rst:3579 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:3568 +#: ../../library/typing.rst:3589 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中容器 ABC 的別名" -#: ../../library/typing.rst:3572 +#: ../../library/typing.rst:3593 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "棄用 :class:`collections.abc.Set` 的別名。" -#: ../../library/typing.rst:3574 +#: ../../library/typing.rst:3595 msgid "" ":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3580 +#: ../../library/typing.rst:3601 msgid "" "This type represents the types :class:`bytes`, :class:`bytearray`, and :" "class:`memoryview` of byte sequences." msgstr "" -#: ../../library/typing.rst:3583 +#: ../../library/typing.rst:3604 msgid "" "Prefer :class:`collections.abc.Buffer`, or a union like ``bytes | bytearray " "| memoryview``." msgstr "" -#: ../../library/typing.rst:3588 +#: ../../library/typing.rst:3609 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "棄用 :class:`collections.abc.Collection` 的別名。" -#: ../../library/typing.rst:3592 +#: ../../library/typing.rst:3613 msgid "" ":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3598 +#: ../../library/typing.rst:3619 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "棄用 :class:`collections.abc.Container` 的別名。" -#: ../../library/typing.rst:3600 +#: ../../library/typing.rst:3621 msgid "" ":class:`collections.abc.Container` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3606 +#: ../../library/typing.rst:3627 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "棄用 :class:`collections.abc.ItemsView` 的別名。" -#: ../../library/typing.rst:3608 +#: ../../library/typing.rst:3629 msgid "" ":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3614 +#: ../../library/typing.rst:3635 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "棄用 :class:`collections.abc.KeysView` 的別名。" -#: ../../library/typing.rst:3616 +#: ../../library/typing.rst:3637 msgid "" ":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3622 +#: ../../library/typing.rst:3643 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "棄用 :class:`collections.abc.Mapping` 的別名。" -#: ../../library/typing.rst:3624 +#: ../../library/typing.rst:3645 msgid "" ":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3630 +#: ../../library/typing.rst:3651 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "棄用 :class:`collections.abc.MappingView` 的別名。" -#: ../../library/typing.rst:3632 +#: ../../library/typing.rst:3653 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3638 +#: ../../library/typing.rst:3659 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "棄用 :class:`collections.abc.MutableMapping` 的別名。" -#: ../../library/typing.rst:3640 +#: ../../library/typing.rst:3661 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3647 +#: ../../library/typing.rst:3668 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "棄用 :class:`collections.abc.MutableSequence` 的別名。" -#: ../../library/typing.rst:3649 +#: ../../library/typing.rst:3670 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3656 +#: ../../library/typing.rst:3677 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "棄用 :class:`collections.abc.MutableSet` 的別名。" -#: ../../library/typing.rst:3658 +#: ../../library/typing.rst:3679 msgid "" ":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3664 +#: ../../library/typing.rst:3685 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "棄用 :class:`collections.abc.Sequence` 的別名。" -#: ../../library/typing.rst:3666 +#: ../../library/typing.rst:3687 msgid "" ":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3672 +#: ../../library/typing.rst:3693 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "棄用 :class:`collections.abc.ValuesView` 的別名。" -#: ../../library/typing.rst:3674 +#: ../../library/typing.rst:3695 msgid "" ":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3681 +#: ../../library/typing.rst:3702 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3685 +#: ../../library/typing.rst:3706 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "棄用 :class:`collections.abc.Coroutine` 的別名。" -#: ../../library/typing.rst:3687 +#: ../../library/typing.rst:3708 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:3693 +#: ../../library/typing.rst:3714 msgid "" ":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3699 +#: ../../library/typing.rst:3720 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "棄用 :class:`collections.abc.AsyncGenerator` 的別名。" -#: ../../library/typing.rst:3701 +#: ../../library/typing.rst:3722 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:3707 +#: ../../library/typing.rst:3728 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3712 +#: ../../library/typing.rst:3733 msgid "The ``SendType`` parameter now has a default." msgstr "" -#: ../../library/typing.rst:3717 +#: ../../library/typing.rst:3738 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "棄用 :class:`collections.abc.AsyncIterable` 的別名。" -#: ../../library/typing.rst:3721 +#: ../../library/typing.rst:3742 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3727 +#: ../../library/typing.rst:3748 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "棄用 :class:`collections.abc.AsyncIterator` 的別名。" -#: ../../library/typing.rst:3731 +#: ../../library/typing.rst:3752 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3737 +#: ../../library/typing.rst:3758 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "棄用 :class:`collections.abc.Awaitable` 的別名。" -#: ../../library/typing.rst:3741 +#: ../../library/typing.rst:3762 msgid "" ":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3748 +#: ../../library/typing.rst:3769 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3752 +#: ../../library/typing.rst:3773 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "棄用 :class:`collections.abc.Iterable` 的別名。" -#: ../../library/typing.rst:3754 +#: ../../library/typing.rst:3775 msgid "" ":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3760 +#: ../../library/typing.rst:3781 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "棄用 :class:`collections.abc.Iterator` 的別名。" -#: ../../library/typing.rst:3762 +#: ../../library/typing.rst:3783 msgid "" ":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3768 +#: ../../library/typing.rst:3789 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "棄用 :class:`collections.abc.Callable` 的別名。" -#: ../../library/typing.rst:3770 +#: ../../library/typing.rst:3791 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:3773 +#: ../../library/typing.rst:3794 msgid "" ":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3783 +#: ../../library/typing.rst:3804 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "棄用 :class:`collections.abc.Generator` 的別名。" -#: ../../library/typing.rst:3785 +#: ../../library/typing.rst:3806 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:3789 +#: ../../library/typing.rst:3810 msgid "" ":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3793 +#: ../../library/typing.rst:3814 msgid "Default values for the send and return types were added." msgstr "" -#: ../../library/typing.rst:3798 +#: ../../library/typing.rst:3819 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "棄用 :class:`collections.abc.Hashable` 的別名。" -#: ../../library/typing.rst:3800 +#: ../../library/typing.rst:3821 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "改為直接使用 :class:`collections.abc.Hashable`。" -#: ../../library/typing.rst:3805 +#: ../../library/typing.rst:3826 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "棄用 :class:`collections.abc.Reversible` 的別名。" -#: ../../library/typing.rst:3807 +#: ../../library/typing.rst:3828 msgid "" ":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3813 +#: ../../library/typing.rst:3834 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "棄用 :class:`collections.abc.Sized` 的別名。" -#: ../../library/typing.rst:3815 +#: ../../library/typing.rst:3836 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "改為直接使用 :class:`collections.abc.Sized`。" -#: ../../library/typing.rst:3821 +#: ../../library/typing.rst:3842 msgid "Aliases to :mod:`contextlib` ABCs" msgstr ":mod:`contextlib` ABC 的別名" -#: ../../library/typing.rst:3825 +#: ../../library/typing.rst:3846 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:3827 +#: ../../library/typing.rst:3848 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__enter__` method. The optional second type parameter, " @@ -5645,21 +5673,21 @@ msgid "" "returned by the :meth:`~object.__exit__` method." msgstr "" -#: ../../library/typing.rst:3834 +#: ../../library/typing.rst:3855 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3839 +#: ../../library/typing.rst:3860 msgid "Added the optional second type parameter, ``ExitT_co``." msgstr "" -#: ../../library/typing.rst:3844 +#: ../../library/typing.rst:3865 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:3846 +#: ../../library/typing.rst:3867 msgid "" "The first type parameter, ``T_co``, represents the type returned by the :" "meth:`~object.__aenter__` method. The optional second type parameter, " @@ -5667,21 +5695,21 @@ msgid "" "returned by the :meth:`~object.__aexit__` method." msgstr "" -#: ../../library/typing.rst:3853 +#: ../../library/typing.rst:3874 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3858 +#: ../../library/typing.rst:3879 msgid "Added the optional second type parameter, ``AExitT_co``." msgstr "" -#: ../../library/typing.rst:3862 +#: ../../library/typing.rst:3883 msgid "Deprecation Timeline of Major Features" msgstr "" -#: ../../library/typing.rst:3864 +#: ../../library/typing.rst:3885 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -5689,111 +5717,111 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:3871 +#: ../../library/typing.rst:3892 msgid "Feature" msgstr "" -#: ../../library/typing.rst:3872 +#: ../../library/typing.rst:3893 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:3873 +#: ../../library/typing.rst:3894 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:3874 +#: ../../library/typing.rst:3895 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:3875 +#: ../../library/typing.rst:3896 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:3876 ../../library/typing.rst:3880 +#: ../../library/typing.rst:3897 ../../library/typing.rst:3901 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:3877 +#: ../../library/typing.rst:3898 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:3878 +#: ../../library/typing.rst:3899 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:3879 +#: ../../library/typing.rst:3900 msgid ":class:`typing.ByteString`" msgstr ":class:`typing.ByteString`" -#: ../../library/typing.rst:3881 +#: ../../library/typing.rst:3902 msgid "3.14" msgstr "3.14" -#: ../../library/typing.rst:3882 +#: ../../library/typing.rst:3903 msgid ":gh:`91896`" msgstr ":gh:`91896`" -#: ../../library/typing.rst:3883 +#: ../../library/typing.rst:3904 msgid ":data:`typing.Text`" msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:3884 +#: ../../library/typing.rst:3905 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:3885 ../../library/typing.rst:3889 -#: ../../library/typing.rst:3893 +#: ../../library/typing.rst:3906 ../../library/typing.rst:3910 +#: ../../library/typing.rst:3914 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:3886 +#: ../../library/typing.rst:3907 msgid ":gh:`92332`" msgstr ":gh:`92332`" -#: ../../library/typing.rst:3887 +#: ../../library/typing.rst:3908 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" -#: ../../library/typing.rst:3888 ../../library/typing.rst:3892 +#: ../../library/typing.rst:3909 ../../library/typing.rst:3913 msgid "3.12" msgstr "3.12" -#: ../../library/typing.rst:3890 +#: ../../library/typing.rst:3911 msgid ":gh:`94309`" msgstr ":gh:`94309`" -#: ../../library/typing.rst:3891 +#: ../../library/typing.rst:3912 msgid ":data:`typing.TypeAlias`" msgstr ":data:`typing.TypeAlias`" -#: ../../library/typing.rst:3894 +#: ../../library/typing.rst:3915 msgid ":pep:`695`" msgstr ":pep:`695`" -#: ../../library/typing.rst:3895 +#: ../../library/typing.rst:3916 msgid ":func:`@typing.no_type_check_decorator `" msgstr "" -#: ../../library/typing.rst:3896 ../../library/typing.rst:3900 +#: ../../library/typing.rst:3917 ../../library/typing.rst:3921 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:3897 +#: ../../library/typing.rst:3918 msgid "3.15" msgstr "3.15" -#: ../../library/typing.rst:3898 +#: ../../library/typing.rst:3919 msgid ":gh:`106309`" msgstr ":gh:`106309`" -#: ../../library/typing.rst:3899 +#: ../../library/typing.rst:3920 msgid ":data:`typing.AnyStr`" msgstr ":data:`typing.AnyStr`" -#: ../../library/typing.rst:3901 +#: ../../library/typing.rst:3922 msgid "3.18" msgstr "3.18" -#: ../../library/typing.rst:3902 +#: ../../library/typing.rst:3923 msgid ":gh:`105578`" msgstr ":gh:`105578`" diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 46210eedbc..c4159ff0b8 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-02-19 21:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -304,11 +304,11 @@ msgstr "" #: ../../library/unittest.mock.rst:241 msgid "" -"If *spec* is an object (rather than a list of strings) then :attr:`~instance." +"If *spec* is an object (rather than a list of strings) then :attr:`~object." "__class__` returns the class of the spec object. This allows mocks to pass :" "func:`isinstance` tests." msgstr "" -"如果 *spec* 是一個物件(而不是一個字串的串列),那麼 :attr:`~instance." +"如果 *spec* 是一個物件(而不是一個字串的串列),那麼 :attr:`~object." "__class__` 會回傳 spec 物件的類別。這允許 mocks 通過 :func:`isinstance` 測" "試。" @@ -1147,9 +1147,8 @@ msgid "" msgstr "" #: ../../library/unittest.mock.rst:1133 -#, fuzzy msgid "Waits until the mock is called." -msgstr "斷言 mock 從未被呼叫。" +msgstr "等待直到 mock 被呼叫。" #: ../../library/unittest.mock.rst:1135 msgid "" @@ -1159,9 +1158,8 @@ msgid "" msgstr "" #: ../../library/unittest.mock.rst:1147 -#, fuzzy msgid "Waits until the mock is called with the specified arguments." -msgstr "斷言 mock 已經被使用指定的引數呼叫。" +msgstr "等到直到 mock 被以特定引數呼叫。" #: ../../library/unittest.mock.rst:1149 msgid "" diff --git a/library/venv.po b/library/venv.po index 2318e51ea4..ab4f0f4050 100644 --- a/library/venv.po +++ b/library/venv.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-30 09:19+0000\n" "PO-Revision-Date: 2023-07-09 15:09+0800\n" "Last-Translator: Po-Chuan Chen \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -59,8 +59,8 @@ msgstr "" #: ../../library/venv.rst:40 msgid "" -"Contained in a directory, conventionally either named ``venv`` or ``.venv`` " -"in the project directory, or under a container directory for lots of virtual " +"Contained in a directory, conventionally named ``.venv`` or ``venv`` in the " +"project directory, or under a container directory for lots of virtual " "environments, such as ``~/.virtualenvs``." msgstr "" @@ -71,7 +71,7 @@ msgstr "" #: ../../library/venv.rst:46 msgid "" "Considered as disposable -- it should be simple to delete and recreate it " -"from scratch. You don't place any project code in the environment" +"from scratch. You don't place any project code in the environment." msgstr "" #: ../../library/venv.rst:49 @@ -107,118 +107,102 @@ msgstr "" msgid "Creating virtual environments" msgstr "建立虛擬環境" -#: ../../using/venv-create.inc:1 +#: ../../library/venv.rst:64 msgid "" -"Creation of :ref:`virtual environments ` is done by executing the " -"command ``venv``::" -msgstr "建立\\ :ref:`虛擬環境 `\\ 的方法是透過執行指令 ``venv``:" +":ref:`Virtual environments ` are created by executing the ``venv`` " +"module:" +msgstr ":ref:`虛擬環境 `\\ 是透過執行 ``venv`` 模組來建立:" -#: ../../using/venv-create.inc:4 +#: ../../library/venv.rst:67 msgid "python -m venv /path/to/new/virtual/environment" msgstr "python -m venv /path/to/new/virtual/environment" -#: ../../using/venv-create.inc:6 +#: ../../library/venv.rst:71 msgid "" -"Running this command creates the target directory (creating any parent " -"directories that don't exist already) and places a ``pyvenv.cfg`` file in it " -"with a ``home`` key pointing to the Python installation from which the " -"command was run (a common name for the target directory is ``.venv``). It " -"also creates a ``bin`` (or ``Scripts`` on Windows) subdirectory containing a " -"copy/symlink of the Python binary/binaries (as appropriate for the platform " -"or arguments used at environment creation time). It also creates an " -"(initially empty) ``lib/pythonX.Y/site-packages`` subdirectory (on Windows, " -"this is ``Lib\\site-packages``). If an existing directory is specified, it " -"will be re-used." +"This creates the target directory (including parent directories as needed) " +"and places a :file:`pyvenv.cfg` file in it with a ``home`` key pointing to " +"the Python installation from which the command was run. It also creates a :" +"file:`bin` (or :file:`Scripts` on Windows) subdirectory containing a copy or " +"symlink of the Python executable (as appropriate for the platform or " +"arguments used at environment creation time). It also creates a :file:`lib/" +"pythonX.Y/site-packages` subdirectory (on Windows, this is :file:`Lib\\site-" +"packages`). If an existing directory is specified, it will be re-used." msgstr "" "執行此命令會建立目標目錄(同時也會建立任何還不存在的父目錄)並在目錄中放置一" -"個名為 ``pyvenv.cfg`` 的檔案,其中包含一個指向執行該命令的 Python 安裝路徑的 " -"``home`` 鍵(目標目錄的常見名稱為 ``.venv``)。同時,它會建立一個 ``bin`` " -"(在 Windows 上為 ``Scripts``)子目錄,其中包含一個 Python 二進位檔案的副本/" -"符號連結(根據建立環境時使用的平台或引數而定)。此外,它還會建立一個(最初為" -"空的) ``lib/pythonX.Y/site-packages`` 子目錄(在 Windows 上為 ``Lib\\site-" -"packages``)。如果指定的目錄已存在,則將重新使用該目錄。" +"個名為 :file:`pyvenv.cfg` 的檔案,其中包含一個指向執行該命令的 Python 安裝路" +"徑的 ``home`` 鍵。它同時會建立一個 :file:`bin` (在 Windows 上為 :file:" +"`Scripts`)子目錄,其中包含一個 Python 二進位檔案的副本/符號連結(根據建立環" +"境時使用的平台或引數而定)。此外,它還會建立一個 :file:`lib/pythonX.Y/site-" +"packages` 子目錄(在 Windows 上為 :file:`Lib\\site-packages`)。如果指定的目" +"錄已存在,則將重新使用該目錄。" -#: ../../using/venv-create.inc:17 +#: ../../library/venv.rst:81 msgid "" "The use of ``venv`` is now recommended for creating virtual environments." msgstr "目前建議使用 ``venv`` 來建立虛擬環境。" -#: ../../using/venv-create.inc:20 +#: ../../library/venv.rst:84 msgid "" -"``pyvenv`` was the recommended tool for creating virtual environments for " -"Python 3.3 and 3.4, and is :ref:`deprecated in Python 3.6 `." +":program:`pyvenv` was the recommended tool for creating virtual environments " +"for Python 3.3 and 3.4, and replaced in 3.5 by executing ``venv`` directly." msgstr "" -"``pyvenv`` 是在 Python 3.3 和 3.4 中建立虛擬環境的推薦工具,但在 Python 3.6 " -"中已被\\ :ref:`棄用 `。" +":program:`pyvenv` 是在 Python 3.3 和 3.4 中建立虛擬環境的推薦工具,但在 " +"Python 3.5 中已被直接執行 ``venv`` 所取代。" -#: ../../using/venv-create.inc:27 -msgid "On Windows, invoke the ``venv`` command as follows::" +#: ../../library/venv.rst:90 +msgid "On Windows, invoke the ``venv`` command as follows:" msgstr "在 Windows 上,執行以下命令以使用 ``venv``:" -#: ../../using/venv-create.inc:29 -msgid "c:\\>Python35\\python -m venv c:\\path\\to\\myenv" -msgstr "c:\\>Python35\\python -m venv c:\\path\\to\\myenv" - -#: ../../using/venv-create.inc:31 -msgid "" -"Alternatively, if you configured the ``PATH`` and ``PATHEXT`` variables for " -"your :ref:`Python installation `::" -msgstr "" -"或者,如你已經為你的 :ref:`Python 安裝 `\\ 配置了 ``PATH`` " -"和 ``PATHEXT`` 變數,則可以執行以下命令:" - -#: ../../using/venv-create.inc:34 -msgid "c:\\>python -m venv c:\\path\\to\\myenv" -msgstr "c:\\>python -m venv c:\\path\\to\\myenv" +#: ../../library/venv.rst:92 +msgid "PS> python -m venv C:\\path\\to\\new\\virtual\\environment" +msgstr "PS> python -m venv C:\\path\\to\\new\\virtual\\environment" -#: ../../using/venv-create.inc:36 +#: ../../library/venv.rst:96 msgid "The command, if run with ``-h``, will show the available options::" msgstr "如果使用 ``-h`` 選項執行該命令,將會顯示可用的選項:" -#: ../../using/venv-create.inc:38 -#, fuzzy +#: ../../library/venv.rst:98 msgid "" "usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear]\n" " [--upgrade] [--without-pip] [--prompt PROMPT] [--upgrade-deps]\n" -" [--without-scm-ignore-file]\n" +" [--without-scm-ignore-files]\n" " ENV_DIR [ENV_DIR ...]\n" "\n" "Creates virtual Python environments in one or more target directories.\n" "\n" "positional arguments:\n" -"ENV_DIR A directory to create the environment in.\n" +" ENV_DIR A directory to create the environment in.\n" "\n" "options:\n" -"-h, --help show this help message and exit\n" -"--system-site-packages\n" +" -h, --help show this help message and exit\n" +" --system-site-packages\n" " Give the virtual environment access to the system\n" " site-packages dir.\n" -"--symlinks Try to use symlinks rather than copies, when\n" +" --symlinks Try to use symlinks rather than copies, when\n" " symlinks are not the default for the platform.\n" -"--copies Try to use copies rather than symlinks, even when\n" +" --copies Try to use copies rather than symlinks, even when\n" " symlinks are the default for the platform.\n" -"--clear Delete the contents of the environment directory if\n" -" it already exists, before environment creation.\n" -"--upgrade Upgrade the environment directory to use this\n" -" version of Python, assuming Python has been " -"upgraded\n" -" in-place.\n" -"--without-pip Skips installing or upgrading pip in the virtual\n" +" --clear Delete the contents of the environment directory\n" +" if it already exists, before environment creation.\n" +" --upgrade Upgrade the environment directory to use this\n" +" version of Python, assuming Python has been\n" +" upgraded in-place.\n" +" --without-pip Skips installing or upgrading pip in the virtual\n" " environment (pip is bootstrapped by default)\n" -"--prompt PROMPT Provides an alternative prompt prefix for this\n" +" --prompt PROMPT Provides an alternative prompt prefix for this\n" " environment.\n" -"--upgrade-deps Upgrade core dependencies (pip) to the latest\n" +" --upgrade-deps Upgrade core dependencies (pip) to the latest\n" " version in PyPI\n" -"--without-scm-ignore-file\n" -" Skips adding the default SCM ignore file to the\n" -" environment directory (the default is a .gitignore\n" -" file).\n" +" --without-scm-ignore-files\n" +" Skips adding SCM ignore files to the environment\n" +" directory (Git is supported by default).\n" "\n" "Once an environment has been created, you may wish to activate it, e.g. by\n" "sourcing an activate script in its bin directory." msgstr "" "usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear]\n" " [--upgrade] [--without-pip] [--prompt PROMPT] [--upgrade-deps]\n" +" [--without-scm-ignore-files]\n" " ENV_DIR [ENV_DIR ...]\n" "\n" "Creates virtual Python environments in one or more target directories.\n" @@ -226,65 +210,67 @@ msgstr "" "positional arguments:\n" " ENV_DIR A directory to create the environment in.\n" "\n" -"optional arguments:\n" +"options:\n" " -h, --help show this help message and exit\n" " --system-site-packages\n" " Give the virtual environment access to the system\n" " site-packages dir.\n" -" --symlinks Try to use symlinks rather than copies, when " -"symlinks\n" -" are not the default for the platform.\n" +" --symlinks Try to use symlinks rather than copies, when\n" +" symlinks are not the default for the platform.\n" " --copies Try to use copies rather than symlinks, even when\n" " symlinks are the default for the platform.\n" -" --clear Delete the contents of the environment directory if " -"it\n" -" already exists, before environment creation.\n" -" --upgrade Upgrade the environment directory to use this " -"version\n" -" of Python, assuming Python has been upgraded in-" -"place.\n" +" --clear Delete the contents of the environment directory\n" +" if it already exists, before environment creation.\n" +" --upgrade Upgrade the environment directory to use this\n" +" version of Python, assuming Python has been\n" +" upgraded in-place.\n" " --without-pip Skips installing or upgrading pip in the virtual\n" " environment (pip is bootstrapped by default)\n" " --prompt PROMPT Provides an alternative prompt prefix for this\n" " environment.\n" -" --upgrade-deps Upgrade core dependencies (pip) to the\n" -" latest version in PyPI\n" +" --upgrade-deps Upgrade core dependencies (pip) to the latest\n" +" version in PyPI\n" +" --without-scm-ignore-files\n" +" Skips adding SCM ignore files to the environment\n" +" directory (Git is supported by default).\n" "\n" "Once an environment has been created, you may wish to activate it, e.g. by\n" "sourcing an activate script in its bin directory." -#: ../../using/venv-create.inc:78 +#: ../../library/venv.rst:136 msgid "" -"``--without-scm-ignore-file`` was added along with creating an ignore file " -"for ``git`` by default." -msgstr "" +"Installs pip by default, added the ``--without-pip`` and ``--copies`` " +"options." +msgstr "預設會安裝 pip,並新增了 ``--without-pip`` 和 ``--copies`` 選項" -#: ../../library/venv.rst:323 ../../using/venv-create.inc:83 -msgid "``setuptools`` is no longer a core venv dependency." +#: ../../library/venv.rst:140 +msgid "" +"In earlier versions, if the target directory already existed, an error was " +"raised, unless the ``--clear`` or ``--upgrade`` option was provided." msgstr "" +"在較早的版本中,如果目標目錄已存在,除非提供了 ``--clear`` 或 ``--upgrade`` " +"選項,否則會引發錯誤。" -#: ../../using/venv-create.inc:85 +#: ../../library/venv.rst:144 msgid "" "Add ``--upgrade-deps`` option to upgrade pip + setuptools to the latest on " -"PyPI" +"PyPI." msgstr "" "新增 ``--upgrade-deps`` 選項以將 pip 和 setuptools 升級至 PyPI 上的最新版本" -#: ../../using/venv-create.inc:88 -msgid "" -"Installs pip by default, added the ``--without-pip`` and ``--copies`` " -"options" -msgstr "預設情況下安裝 pip,並新增了 ``--without-pip`` 和 ``--copies`` 選項" +#: ../../library/venv.rst:149 +msgid "``setuptools`` is no longer a core venv dependency." +msgstr "" -#: ../../using/venv-create.inc:92 -msgid "" -"In earlier versions, if the target directory already existed, an error was " -"raised, unless the ``--clear`` or ``--upgrade`` option was provided." +#: ../../library/venv.rst:153 +msgid "Added the ``--without-scm-ignore-files`` option." +msgstr "新增 ``--without-scm-ignore-files`` 選項" + +#: ../../library/venv.rst:154 +msgid "``venv`` now creates a :file:`.gitignore` file for Git by default." msgstr "" -"在較早的版本中,如果目標目錄已存在,除非提供了 ``--clear`` 或 ``--upgrade`` " -"選項,否則會引發錯誤。" -#: ../../using/venv-create.inc:97 +#: ../../library/venv.rst:158 msgid "" "While symlinks are supported on Windows, they are not recommended. Of " "particular note is that double-clicking ``python.exe`` in File Explorer will " @@ -293,7 +279,7 @@ msgstr "" "雖然在 Windows 上支援符號連結,但並不建議使用。特別需要注意的是,在檔案總管中" "按兩下 ``python.exe`` 會急切地解析符號連結並忽略虛擬環境。" -#: ../../using/venv-create.inc:102 +#: ../../library/venv.rst:163 msgid "" "On Microsoft Windows, it may be required to enable the ``Activate.ps1`` " "script by setting the execution policy for the user. You can do this by " @@ -302,12 +288,13 @@ msgstr "" "在 Microsoft Windows 上,可能需要通過設置使用者的執行策略來啟用 ``Activate." "ps1`` 腳本。你可以發出以下 PowerShell 命令來執行此操作:" -#: ../../using/venv-create.inc:106 +#: ../../library/venv.rst:167 msgid "" "PS C:\\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser" msgstr "" +"PS C:\\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser" -#: ../../using/venv-create.inc:108 +#: ../../library/venv.rst:171 msgid "" "See `About Execution Policies `_ for more information." @@ -315,17 +302,17 @@ msgstr "" "有關更多資訊,請參閱\\ `關於執行策略 `_。" -#: ../../using/venv-create.inc:112 +#: ../../library/venv.rst:175 msgid "" -"The created ``pyvenv.cfg`` file also includes the ``include-system-site-" +"The created :file:`pyvenv.cfg` file also includes the ``include-system-site-" "packages`` key, set to ``true`` if ``venv`` is run with the ``--system-site-" "packages`` option, ``false`` otherwise." msgstr "" -"被建立的 ``pyvenv.cfg`` 檔案還包括了 ``include-system-site-packages`` 的鍵," -"如果使用 ``venv`` 執行時帶有 ``--system-site-packages`` 選項,則設置為 " +"被建立的 :file:`pyvenv.cfg` 檔案還包括了 ``include-system-site-packages`` 的" +"鍵,如果使用 ``venv`` 執行時帶有 ``--system-site-packages`` 選項,則設置為 " "``true``,否則設置為 ``false``。" -#: ../../using/venv-create.inc:116 +#: ../../library/venv.rst:179 msgid "" "Unless the ``--without-pip`` option is given, :mod:`ensurepip` will be " "invoked to bootstrap ``pip`` into the virtual environment." @@ -333,7 +320,7 @@ msgstr "" "除非 ``--without-pip`` 選項被提供,否則將調用 :mod:`ensurepip` 來啟動 " "``pip`` 到虛擬環境中。" -#: ../../using/venv-create.inc:119 +#: ../../library/venv.rst:182 msgid "" "Multiple paths can be given to ``venv``, in which case an identical virtual " "environment will be created, according to the given options, at each " @@ -342,11 +329,11 @@ msgstr "" "可以向 ``venv`` 提供多個路徑,這樣每個提供的路徑都將根據給定的選項建立一個相" "同的虛擬環境。" -#: ../../library/venv.rst:69 +#: ../../library/venv.rst:189 msgid "How venvs work" msgstr "虛擬環境如何運作" -#: ../../library/venv.rst:71 +#: ../../library/venv.rst:191 msgid "" "When a Python interpreter is running from a virtual environment, :data:`sys." "prefix` and :data:`sys.exec_prefix` point to the directories of the virtual " @@ -360,7 +347,7 @@ msgstr "" "base_exec_prefix` 會指向建立虛擬環境的基礎 Python 的目錄。檢查 ``sys.prefix !" "= sys.base_prefix`` 就可以確定目前的直譯器是否跑在虛擬環境中。" -#: ../../library/venv.rst:80 +#: ../../library/venv.rst:200 msgid "" "A virtual environment may be \"activated\" using a script in its binary " "directory (``bin`` on POSIX; ``Scripts`` on Windows). This will prepend that " @@ -376,81 +363,81 @@ msgstr "" "用完整的路徑。啟動腳本的方式因平台而異(:samp:`{}` 需要替換成包含虛擬環" "境的目錄路徑)" -#: ../../library/venv.rst:90 +#: ../../library/venv.rst:210 msgid "Platform" msgstr "平台" -#: ../../library/venv.rst:90 +#: ../../library/venv.rst:210 msgid "Shell" msgstr "Shell" -#: ../../library/venv.rst:90 +#: ../../library/venv.rst:210 msgid "Command to activate virtual environment" msgstr "啟動虛擬環境的指令" -#: ../../library/venv.rst:92 +#: ../../library/venv.rst:212 msgid "POSIX" msgstr "POSIX" -#: ../../library/venv.rst:92 +#: ../../library/venv.rst:212 msgid "bash/zsh" msgstr "bash/zsh" -#: ../../library/venv.rst:92 +#: ../../library/venv.rst:212 msgid ":samp:`$ source {}/bin/activate`" msgstr ":samp:`$ source {}/bin/activate`" -#: ../../library/venv.rst:94 +#: ../../library/venv.rst:214 msgid "fish" msgstr "fish" -#: ../../library/venv.rst:94 +#: ../../library/venv.rst:214 msgid ":samp:`$ source {}/bin/activate.fish`" msgstr ":samp:`$ source {}/bin/activate.fish`" -#: ../../library/venv.rst:96 +#: ../../library/venv.rst:216 msgid "csh/tcsh" msgstr "csh/tcsh" -#: ../../library/venv.rst:96 +#: ../../library/venv.rst:216 msgid ":samp:`$ source {}/bin/activate.csh`" msgstr ":samp:`$ source {}/bin/activate.csh`" -#: ../../library/venv.rst:98 ../../library/venv.rst:102 +#: ../../library/venv.rst:218 ../../library/venv.rst:222 msgid "PowerShell" msgstr "PowerShell" -#: ../../library/venv.rst:98 +#: ../../library/venv.rst:218 msgid ":samp:`$ {}/bin/Activate.ps1`" msgstr ":samp:`$ {}/bin/Activate.ps1`" -#: ../../library/venv.rst:100 +#: ../../library/venv.rst:220 msgid "Windows" msgstr "Windows" -#: ../../library/venv.rst:100 +#: ../../library/venv.rst:220 msgid "cmd.exe" msgstr "cmd.exe" -#: ../../library/venv.rst:100 +#: ../../library/venv.rst:220 msgid ":samp:`C:\\\\> {}\\\\Scripts\\\\activate.bat`" msgstr ":samp:`C:\\\\> {}\\\\Scripts\\\\activate.bat`" -#: ../../library/venv.rst:102 +#: ../../library/venv.rst:222 msgid ":samp:`PS C:\\\\> {}\\\\Scripts\\\\Activate.ps1`" msgstr ":samp:`PS C:\\\\> {}\\\\Scripts\\\\Activate.ps1`" -#: ../../library/venv.rst:105 +#: ../../library/venv.rst:225 msgid ":program:`fish` and :program:`csh` activation scripts." msgstr ":program:`fish` 和 :program:`csh` 啟動腳本。" -#: ../../library/venv.rst:108 +#: ../../library/venv.rst:228 msgid "" "PowerShell activation scripts installed under POSIX for PowerShell Core " "support." msgstr "PowerShell 的啟動腳本安裝在 POSIX 上支援 PowerShell Core。" -#: ../../library/venv.rst:112 +#: ../../library/venv.rst:232 msgid "" "You don't specifically *need* to activate a virtual environment, as you can " "just specify the full path to that environment's Python interpreter when " @@ -461,25 +448,25 @@ msgstr "" "整路徑。此外,所有安裝在環境裡的腳本都應該都可以在未啟用虛擬環境的情況下運" "行。" -#: ../../library/venv.rst:118 +#: ../../library/venv.rst:238 msgid "" "In order to achieve this, scripts installed into virtual environments have a " -"\"shebang\" line which points to the environment's Python interpreter, i.e. :" -"samp:`#!/{}/bin/python`. This means that the script will run " -"with that interpreter regardless of the value of :envvar:`PATH`. On Windows, " +"\"shebang\" line which points to the environment's Python interpreter, :samp:" +"`#!/{}/bin/python`. This means that the script will run with " +"that interpreter regardless of the value of :envvar:`PATH`. On Windows, " "\"shebang\" line processing is supported if you have the :ref:`launcher` " "installed. Thus, double-clicking an installed script in a Windows Explorer " "window should run it with the correct interpreter without the environment " "needing to be activated or on the :envvar:`PATH`." msgstr "" "為了實現這一點,安裝在虛擬環境中的腳本會有一個 \"shebang\" 列,此列指向該環境" -"的 Python 直譯器,例如: :samp:`#!/{}/bin/python`。這代表無論 :" -"envvar:`PATH` 的值為何,該腳本都會在直譯器上運行。在 Windows 上,如果你安裝" -"了 :ref:`launcher`,則支援 \"shebang\" 列處理。因此,在 Windows 檔案總管" -"(Windows Explorer)中雙擊已安裝的腳本,應該可以在沒有啟用環境或將其加入 :" -"envvar:`PATH` 的情況下正確地運行。" +"的 Python 直譯器 :samp:`#!/{}/bin/python`。這代表無論 :envvar:" +"`PATH` 的值為何,該腳本都會在直譯器上運行。在 Windows 上,如果你安裝了 :ref:" +"`launcher`,則支援 \"shebang\" 列處理。因此,在 Windows 檔案總管(Windows " +"Explorer)中雙擊已安裝的腳本,應該可以在沒有啟用環境或將其加入 :envvar:" +"`PATH` 的情況下正確地運行。" -#: ../../library/venv.rst:127 +#: ../../library/venv.rst:247 msgid "" "When a virtual environment has been activated, the :envvar:`!VIRTUAL_ENV` " "environment variable is set to the path of the environment. Since explicitly " @@ -491,7 +478,7 @@ msgstr "" "於不需要明確啟用虛擬環境才能使用它。因此,無法依賴 :envvar:`!VIRTUAL_ENV` 來" "判斷是否正在使用虛擬環境。" -#: ../../library/venv.rst:133 +#: ../../library/venv.rst:253 msgid "" "Because scripts installed in environments should not expect the environment " "to be activated, their shebang lines contain the absolute paths to their " @@ -514,7 +501,7 @@ msgstr "" "位置重新建立它,並刪除舊位置的環境。如果你移動環境是因為移動了其父目錄,你應" "該在新位置重新建立環境。否則,安裝在該環境中的軟體可能無法正常運作。" -#: ../../library/venv.rst:147 +#: ../../library/venv.rst:267 msgid "" "You can deactivate a virtual environment by typing ``deactivate`` in your " "shell. The exact mechanism is platform-specific and is an internal " @@ -523,11 +510,11 @@ msgstr "" "你可以在 shell 輸入 ``deactivate`` 來關閉虛擬環境。具體的使用方式因平台而異," "是內部實作的細節(通常會使用腳本或是 shell 函式)" -#: ../../library/venv.rst:155 +#: ../../library/venv.rst:275 msgid "API" msgstr "API" -#: ../../library/venv.rst:159 +#: ../../library/venv.rst:279 msgid "" "The high-level method described above makes use of a simple API which " "provides mechanisms for third-party virtual environment creators to " @@ -537,108 +524,98 @@ msgstr "" "上述提到的高階 method(方法)透過簡單的 API 使用, 為第三方虛擬環境建立者提供" "可以依據他們需求來建立環境的客製化機制: :class:`EnvBuilder` class。" -#: ../../library/venv.rst:168 +#: ../../library/venv.rst:288 msgid "" "The :class:`EnvBuilder` class accepts the following keyword arguments on " "instantiation:" msgstr "進行實例化時,class :class:`EnvBuilder` 接受下列的關鍵字引數:" -#: ../../library/venv.rst:171 +#: ../../library/venv.rst:291 msgid "" -"``system_site_packages`` -- a Boolean value indicating that the system " -"Python site-packages should be available to the environment (defaults to " -"``False``)." +"*system_site_packages* -- a boolean value indicating that the system Python " +"site-packages should be available to the environment (defaults to ``False``)." msgstr "" -"``system_site_packages`` -- 為一個 Boolean (布林值),並表明系統的 Python " +"*system_site_packages* -- 為一個 boolean (布林值),並表明系統的 Python " "site-packages 是否可以在環境中可用(預設為 ``False`` )。" -#: ../../library/venv.rst:174 +#: ../../library/venv.rst:294 msgid "" -"``clear`` -- a Boolean value which, if true, will delete the contents of any " +"*clear* -- a boolean value which, if true, will delete the contents of any " "existing target directory, before creating the environment." msgstr "" -"``clear`` -- 為一個 Boolean,如果為 true,則在建立環境之前,刪除目標目錄內所" -"有存在的內容。" +"*clear* -- 為一個 boolean,如果為 true,則在建立環境之前,刪除目標目錄內所有" +"存在的內容。" -#: ../../library/venv.rst:177 +#: ../../library/venv.rst:297 msgid "" -"``symlinks`` -- a Boolean value indicating whether to attempt to symlink the " +"*symlinks* -- a boolean value indicating whether to attempt to symlink the " "Python binary rather than copying." msgstr "" -"``symlinks`` -- 為一個 Boolean,並表明是否嘗試與 Python 二進位檔案建立符號連" -"結而不是複製該檔案。" +"*symlinks* -- 為一個 boolean,並表明是否嘗試與 Python 二進位檔案建立符號連結" +"而不是複製該檔案。" -#: ../../library/venv.rst:180 +#: ../../library/venv.rst:300 msgid "" -"``upgrade`` -- a Boolean value which, if true, will upgrade an existing " +"*upgrade* -- a boolean value which, if true, will upgrade an existing " "environment with the running Python - for use when that Python has been " "upgraded in-place (defaults to ``False``)." msgstr "" -"``upgrade`` -- 為一個 Boolean,若為 true,則會在執行 Python 時為現有的環境進" -"行升級。目的是讓 Python 可以升級到位(預設為 ``False``)。" +"*upgrade* -- 為一個 boolean,若為 true,則會在執行 Python 時為現有的環境進行" +"升級。目的是讓 Python 可以升級到位(預設為 ``False``)。" -#: ../../library/venv.rst:184 +#: ../../library/venv.rst:304 msgid "" -"``with_pip`` -- a Boolean value which, if true, ensures pip is installed in " +"*with_pip* -- a boolean value which, if true, ensures pip is installed in " "the virtual environment. This uses :mod:`ensurepip` with the ``--default-" "pip`` option." msgstr "" -"``with_pip`` -- 為一個 Boolean,若為 true,則確保 pip 有安裝至虛擬環境之中。" -"當有 ``--default-pip`` 的選項時,會使用 :mod:`ensurepip`。" +"*with_pip* -- 為一個 boolean,若為 true,則確保 pip 有安裝至虛擬環境之中。當" +"有 ``--default-pip`` 的選項時,會使用 :mod:`ensurepip`。" -#: ../../library/venv.rst:188 +#: ../../library/venv.rst:308 msgid "" -"``prompt`` -- a String to be used after virtual environment is activated " +"*prompt* -- a string to be used after virtual environment is activated " "(defaults to ``None`` which means directory name of the environment would be " "used). If the special string ``\".\"`` is provided, the basename of the " "current directory is used as the prompt." msgstr "" -"``prompt`` -- 為一個 String(字串),該字串會在虛擬環境啟動時被使用。(預設" -"為 ``None``,代表該環境的目錄名稱會被使用)倘若出現特殊字串 ``\".\"`` ,則當" -"前目錄的 basename 會做為提示路徑使用。" +"*prompt* -- 為一個 String(字串),該字串會在虛擬環境啟動時被使用。(預設為 " +"``None``,代表該環境的目錄名稱會被使用)倘若出現特殊字串 ``\".\"`` ,則當前目" +"錄的 basename 會做為提示路徑使用。" -#: ../../library/venv.rst:193 -msgid "``upgrade_deps`` -- Update the base venv modules to the latest on PyPI" -msgstr "``upgrade_deps`` -- 更新基礎 venv 模組至 PyPI 的最新版本" +#: ../../library/venv.rst:313 +msgid "*upgrade_deps* -- Update the base venv modules to the latest on PyPI" +msgstr "*upgrade_deps* -- 更新基礎 venv 模組至 PyPI 的最新版本" -#: ../../library/venv.rst:195 +#: ../../library/venv.rst:315 msgid "" -"``scm_ignore_files`` -- Create ignore files based for the specified source " +"*scm_ignore_files* -- Create ignore files based for the specified source " "control managers (SCM) in the iterable. Support is defined by having a " "method named ``create_{scm}_ignore_file``. The only value supported by " "default is ``\"git\"`` via :meth:`create_git_ignore_file`." msgstr "" -#: ../../library/venv.rst:201 ../../library/venv.rst:389 +#: ../../library/venv.rst:321 msgid "Added the ``with_pip`` parameter" msgstr "新增 ``with_pip`` 參數" -#: ../../library/venv.rst:204 ../../library/venv.rst:392 +#: ../../library/venv.rst:324 msgid "Added the ``prompt`` parameter" msgstr "新增 ``prompt`` 參數" -#: ../../library/venv.rst:207 ../../library/venv.rst:395 +#: ../../library/venv.rst:327 msgid "Added the ``upgrade_deps`` parameter" msgstr "新增 ``upgrade_deps`` 參數" -#: ../../library/venv.rst:210 ../../library/venv.rst:398 -#, fuzzy +#: ../../library/venv.rst:330 msgid "Added the ``scm_ignore_files`` parameter" -msgstr "新增 ``upgrade_deps`` 參數" +msgstr "新增 ``scm_ignore_files`` 參數" -#: ../../library/venv.rst:213 -msgid "" -"Creators of third-party virtual environment tools will be free to use the " -"provided :class:`EnvBuilder` class as a base class." +#: ../../library/venv.rst:333 +msgid ":class:`EnvBuilder` may be used as a base class." msgstr "" -"第三方虛擬環境工具的建立者可以自由地使用 :class:`EnvBuilder` class 作為 base " -"class(基底類別)使用." - -#: ../../library/venv.rst:216 -msgid "The returned env-builder is an object which has a method, ``create``:" -msgstr "回傳的 env-builder 為一個物件,且帶有一個 method ``create``:" -#: ../../library/venv.rst:220 +#: ../../library/venv.rst:337 msgid "" "Create a virtual environment by specifying the target directory (absolute or " "relative to the current directory) which is to contain the virtual " @@ -649,7 +626,7 @@ msgstr "" "目錄),也就是在該目錄中容納虛擬環境。``create`` method 將會在指定的目錄下建" "立環境,或是觸發適當的例外。" -#: ../../library/venv.rst:226 +#: ../../library/venv.rst:343 msgid "" "The ``create`` method of the :class:`EnvBuilder` class illustrates the hooks " "available for subclass customization::" @@ -657,7 +634,7 @@ msgstr "" ":class:`EnvBuilder` class 的 ``create`` method 會闡述可用的 Hooks 以客製化 " "subclass (子類別)::" -#: ../../library/venv.rst:229 +#: ../../library/venv.rst:346 msgid "" "def create(self, env_dir):\n" " \"\"\"\n" @@ -672,7 +649,7 @@ msgid "" " self.post_setup(context)" msgstr "" -#: ../../library/venv.rst:241 +#: ../../library/venv.rst:358 msgid "" "Each of the methods :meth:`ensure_directories`, :meth:" "`create_configuration`, :meth:`setup_python`, :meth:`setup_scripts` and :" @@ -681,7 +658,7 @@ msgstr "" "每個 methods :meth:`ensure_directories`、:meth:`create_configuration`、:meth:" "`setup_python`、:meth:`setup_scripts` 及 :meth:`post_setup` 都可以被覆寫。" -#: ../../library/venv.rst:247 +#: ../../library/venv.rst:364 msgid "" "Creates the environment directory and all necessary subdirectories that " "don't already exist, and returns a context object. This context object is " @@ -695,7 +672,7 @@ msgstr "" "class:`EnvBuilder` 已被建立且帶有 ``clear=True`` 的引數,該環境目錄下的內容將" "被清空,以及所有必要的子目錄將被重新建立。" -#: ../../library/venv.rst:254 +#: ../../library/venv.rst:371 msgid "" "The returned context object is a :class:`types.SimpleNamespace` with the " "following attributes:" @@ -703,81 +680,81 @@ msgstr "" "回傳的情境物件(context object)其型別會是 :class:`types.SimpleNamespace`,並" "包含以下屬性:" -#: ../../library/venv.rst:257 +#: ../../library/venv.rst:374 msgid "" "``env_dir`` - The location of the virtual environment. Used for " "``__VENV_DIR__`` in activation scripts (see :meth:`install_scripts`)." msgstr "" -#: ../../library/venv.rst:260 +#: ../../library/venv.rst:377 msgid "" "``env_name`` - The name of the virtual environment. Used for " "``__VENV_NAME__`` in activation scripts (see :meth:`install_scripts`)." msgstr "" -#: ../../library/venv.rst:263 +#: ../../library/venv.rst:380 msgid "" "``prompt`` - The prompt to be used by the activation scripts. Used for " "``__VENV_PROMPT__`` in activation scripts (see :meth:`install_scripts`)." msgstr "" -#: ../../library/venv.rst:266 +#: ../../library/venv.rst:383 msgid "" "``executable`` - The underlying Python executable used by the virtual " "environment. This takes into account the case where a virtual environment is " "created from another virtual environment." msgstr "" -#: ../../library/venv.rst:270 +#: ../../library/venv.rst:387 msgid "``inc_path`` - The include path for the virtual environment." msgstr "" -#: ../../library/venv.rst:272 +#: ../../library/venv.rst:389 msgid "``lib_path`` - The purelib path for the virtual environment." msgstr "" -#: ../../library/venv.rst:274 +#: ../../library/venv.rst:391 msgid "``bin_path`` - The script path for the virtual environment." -msgstr "" +msgstr "``bin_path`` - 虛擬環境的腳本路徑。" -#: ../../library/venv.rst:276 +#: ../../library/venv.rst:393 msgid "" "``bin_name`` - The name of the script path relative to the virtual " "environment location. Used for ``__VENV_BIN_NAME__`` in activation scripts " "(see :meth:`install_scripts`)." msgstr "" -#: ../../library/venv.rst:280 +#: ../../library/venv.rst:397 msgid "" "``env_exe`` - The name of the Python interpreter in the virtual environment. " "Used for ``__VENV_PYTHON__`` in activation scripts (see :meth:" "`install_scripts`)." msgstr "" -#: ../../library/venv.rst:284 +#: ../../library/venv.rst:401 msgid "" "``env_exec_cmd`` - The name of the Python interpreter, taking into account " "filesystem redirections. This can be used to run Python in the virtual " "environment." msgstr "" -#: ../../library/venv.rst:289 +#: ../../library/venv.rst:406 msgid "" "The *venv* :ref:`sysconfig installation scheme ` is used " "to construct the paths of the created directories." msgstr "" -#: ../../library/venv.rst:294 +#: ../../library/venv.rst:411 msgid "" "The attribute ``lib_path`` was added to the context, and the context object " "was documented." msgstr "" -#: ../../library/venv.rst:300 +#: ../../library/venv.rst:417 msgid "Creates the ``pyvenv.cfg`` configuration file in the environment." -msgstr "" +msgstr "在環境中建立 ``pyvenv.cfg`` 設定檔。" -#: ../../library/venv.rst:304 +#: ../../library/venv.rst:421 msgid "" "Creates a copy or symlink to the Python executable in the environment. On " "POSIX systems, if a specific executable ``python3.x`` was used, symlinks to " @@ -785,120 +762,140 @@ msgid "" "unless files with those names already exist." msgstr "" -#: ../../library/venv.rst:311 +#: ../../library/venv.rst:428 msgid "" "Installs activation scripts appropriate to the platform into the virtual " "environment." msgstr "" -#: ../../library/venv.rst:316 +#: ../../library/venv.rst:433 msgid "" -"Upgrades the core venv dependency packages (currently ``pip``) in the " +"Upgrades the core venv dependency packages (currently :pypi:`pip`) in the " "environment. This is done by shelling out to the ``pip`` executable in the " "environment." msgstr "" -#: ../../library/venv.rst:327 +#: ../../library/venv.rst:440 +msgid ":pypi:`setuptools` is no longer a core venv dependency." +msgstr ":pypi:`setuptools` 不再是核心 venv 的依賴。" + +#: ../../library/venv.rst:444 msgid "" "A placeholder method which can be overridden in third party implementations " "to pre-install packages in the virtual environment or perform other post-" "creation steps." msgstr "" -#: ../../library/venv.rst:331 -msgid "" -"Windows now uses redirector scripts for ``python[w].exe`` instead of copying " -"the actual binaries. In 3.7.2 only :meth:`setup_python` does nothing unless " -"running from a build in the source tree." -msgstr "" - -#: ../../library/venv.rst:336 +#: ../../library/venv.rst:450 msgid "" -"Windows copies the redirector scripts as part of :meth:`setup_python` " -"instead of :meth:`setup_scripts`. This was not the case in 3.7.2. When using " -"symlinks, the original executables will be linked." -msgstr "" - -#: ../../library/venv.rst:341 -msgid "" -"In addition, :class:`EnvBuilder` provides this utility method that can be " -"called from :meth:`setup_scripts` or :meth:`post_setup` in subclasses to " -"assist in installing custom scripts into the virtual environment." +"This method can be called from :meth:`setup_scripts` or :meth:`post_setup` " +"in subclasses to assist in installing custom scripts into the virtual " +"environment." msgstr "" -#: ../../library/venv.rst:347 +#: ../../library/venv.rst:454 msgid "" "*path* is the path to a directory that should contain subdirectories " -"\"common\", \"posix\", \"nt\", each containing scripts destined for the bin " -"directory in the environment. The contents of \"common\" and the directory " -"corresponding to :data:`os.name` are copied after some text replacement of " -"placeholders:" +"``common``, ``posix``, ``nt``; each containing scripts destined for the " +"``bin`` directory in the environment. The contents of ``common`` and the " +"directory corresponding to :data:`os.name` are copied after some text " +"replacement of placeholders:" msgstr "" -#: ../../library/venv.rst:353 +#: ../../library/venv.rst:460 msgid "" "``__VENV_DIR__`` is replaced with the absolute path of the environment " "directory." msgstr "" -#: ../../library/venv.rst:356 +#: ../../library/venv.rst:463 msgid "" "``__VENV_NAME__`` is replaced with the environment name (final path segment " "of environment directory)." msgstr "" -#: ../../library/venv.rst:359 +#: ../../library/venv.rst:466 msgid "" "``__VENV_PROMPT__`` is replaced with the prompt (the environment name " "surrounded by parentheses and with a following space)" msgstr "" -#: ../../library/venv.rst:362 +#: ../../library/venv.rst:469 msgid "" "``__VENV_BIN_NAME__`` is replaced with the name of the bin directory (either " "``bin`` or ``Scripts``)." msgstr "" -#: ../../library/venv.rst:365 +#: ../../library/venv.rst:472 msgid "" "``__VENV_PYTHON__`` is replaced with the absolute path of the environment's " "executable." msgstr "" -#: ../../library/venv.rst:368 +#: ../../library/venv.rst:475 msgid "" "The directories are allowed to exist (for when an existing environment is " "being upgraded)." msgstr "" -#: ../../library/venv.rst:373 +#: ../../library/venv.rst:480 msgid "" "Creates a ``.gitignore`` file within the virtual environment that causes the " -"entire directory to be ignored by the ``git`` source control manager." +"entire directory to be ignored by the Git source control manager." +msgstr "" + +#: ../../library/venv.rst:485 +msgid "" +"Windows now uses redirector scripts for ``python[w].exe`` instead of copying " +"the actual binaries. In 3.7.2 only :meth:`setup_python` does nothing unless " +"running from a build in the source tree." msgstr "" -#: ../../library/venv.rst:378 +#: ../../library/venv.rst:490 +msgid "" +"Windows copies the redirector scripts as part of :meth:`setup_python` " +"instead of :meth:`setup_scripts`. This was not the case in 3.7.2. When using " +"symlinks, the original executables will be linked." +msgstr "" + +#: ../../library/venv.rst:495 msgid "There is also a module-level convenience function:" msgstr "" -#: ../../library/venv.rst:384 +#: ../../library/venv.rst:501 msgid "" "Create an :class:`EnvBuilder` with the given keyword arguments, and call " "its :meth:`~EnvBuilder.create` method with the *env_dir* argument." msgstr "" -#: ../../library/venv.rst:402 +#: ../../library/venv.rst:506 +msgid "Added the *with_pip* parameter" +msgstr "新增 *with_pip* 參數" + +#: ../../library/venv.rst:509 +msgid "Added the *prompt* parameter" +msgstr "新增 *prompt* 參數" + +#: ../../library/venv.rst:512 +msgid "Added the *upgrade_deps* parameter" +msgstr "新增 *upgrade_deps* 參數" + +#: ../../library/venv.rst:515 +msgid "Added the *scm_ignore_files* parameter" +msgstr "新增 *scm_ignore_files* 參數" + +#: ../../library/venv.rst:519 msgid "An example of extending ``EnvBuilder``" -msgstr "" +msgstr "一個擴展 ``EnvBuilder`` 的範例" -#: ../../library/venv.rst:404 +#: ../../library/venv.rst:521 msgid "" "The following script shows how to extend :class:`EnvBuilder` by implementing " "a subclass which installs setuptools and pip into a created virtual " "environment::" msgstr "" -#: ../../library/venv.rst:407 +#: ../../library/venv.rst:524 msgid "" "import os\n" "import os.path\n" @@ -1114,7 +1111,7 @@ msgid "" " sys.exit(rc)" msgstr "" -#: ../../library/venv.rst:615 +#: ../../library/venv.rst:732 msgid "" "This script is also available for download `online `_." @@ -1127,13 +1124,3 @@ msgstr "Environments (環境)" #: ../../library/venv.rst:14 msgid "virtual" msgstr "virtual (虛擬)" - -#, fuzzy -#~ msgid "" -#~ "This module does not work or is not available on WebAssembly platforms, " -#~ "or on iOS. See :ref:`wasm-availability` for more information on WASM " -#~ "availability; see :ref:`iOS-availability` for more information on iOS " -#~ "availability." -#~ msgstr "" -#~ "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法" -#~ "作用或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/warnings.po b/library/warnings.po index 702e2744ea..14bf51843b 100644 --- a/library/warnings.po +++ b/library/warnings.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -912,7 +912,13 @@ msgid "" "context." msgstr "" -#: ../../library/warnings.rst:600 +#: ../../library/warnings.rst:598 +msgid "" +"See :ref:`warning-filter` for the meaning of the *category* and *lineno* " +"parameters." +msgstr "" + +#: ../../library/warnings.rst:603 msgid "" "The :class:`catch_warnings` manager works by replacing and then later " "restoring the module's :func:`showwarning` function and internal list of " @@ -920,7 +926,7 @@ msgid "" "state and therefore is not thread-safe." msgstr "" -#: ../../library/warnings.rst:608 +#: ../../library/warnings.rst:611 msgid "Added the *action*, *category*, *lineno*, and *append* parameters." msgstr "新增 *action*、*category*、*lineno* 和 *append* 參數。" diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index 442b455961..db077dfd9a 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -610,8 +610,8 @@ msgid "" msgstr "" #: ../../reference/compound_stmts.rst:526 -#: ../../reference/compound_stmts.rst:1541 -#: ../../reference/compound_stmts.rst:1582 +#: ../../reference/compound_stmts.rst:1547 +#: ../../reference/compound_stmts.rst:1588 msgid "The following code::" msgstr "" @@ -625,7 +625,7 @@ msgstr "" #: ../../reference/compound_stmts.rst:531 #: ../../reference/compound_stmts.rst:556 -#: ../../reference/compound_stmts.rst:1587 +#: ../../reference/compound_stmts.rst:1593 msgid "is semantically equivalent to::" msgstr "" @@ -1543,7 +1543,7 @@ msgid ":class:`int`" msgstr ":class:`int`" #: ../../reference/compound_stmts.rst:1160 -#: ../../reference/compound_stmts.rst:1872 +#: ../../reference/compound_stmts.rst:1878 msgid ":class:`list`" msgstr ":class:`list`" @@ -1556,7 +1556,7 @@ msgid ":class:`str`" msgstr ":class:`str`" #: ../../reference/compound_stmts.rst:1163 -#: ../../reference/compound_stmts.rst:1875 +#: ../../reference/compound_stmts.rst:1881 msgid ":class:`tuple`" msgstr ":class:`tuple`" @@ -1606,7 +1606,7 @@ msgid "" "ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1227 +#: ../../reference/compound_stmts.rst:1228 msgid "" "A function definition is an executable statement. Its execution binds the " "function name in the current local namespace to a function object (a wrapper " @@ -1615,13 +1615,13 @@ msgid "" "used when the function is called." msgstr "" -#: ../../reference/compound_stmts.rst:1233 +#: ../../reference/compound_stmts.rst:1234 msgid "" "The function definition does not execute the function body; this gets " "executed only when the function is called. [#]_" msgstr "" -#: ../../reference/compound_stmts.rst:1239 +#: ../../reference/compound_stmts.rst:1240 msgid "" "A function definition may be wrapped by one or more :term:`decorator` " "expressions. Decorator expressions are evaluated when the function is " @@ -1632,7 +1632,7 @@ msgid "" "example, the following code ::" msgstr "" -#: ../../reference/compound_stmts.rst:1246 +#: ../../reference/compound_stmts.rst:1247 msgid "" "@f1(arg)\n" "@f2\n" @@ -1642,12 +1642,12 @@ msgstr "" "@f2\n" "def func(): pass" -#: ../../reference/compound_stmts.rst:1250 -#: ../../reference/compound_stmts.rst:1440 +#: ../../reference/compound_stmts.rst:1251 +#: ../../reference/compound_stmts.rst:1446 msgid "is roughly equivalent to ::" msgstr "大致等價於: ::" -#: ../../reference/compound_stmts.rst:1252 +#: ../../reference/compound_stmts.rst:1253 msgid "" "def func(): pass\n" "func = f1(arg)(f2(func))" @@ -1655,20 +1655,20 @@ msgstr "" "def func(): pass\n" "func = f1(arg)(f2(func))" -#: ../../reference/compound_stmts.rst:1255 +#: ../../reference/compound_stmts.rst:1256 msgid "" "except that the original function is not temporarily bound to the name " "``func``." msgstr "" -#: ../../reference/compound_stmts.rst:1257 +#: ../../reference/compound_stmts.rst:1258 msgid "" "Functions may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1262 +#: ../../reference/compound_stmts.rst:1263 msgid "" "A list of :ref:`type parameters ` may be given in square " "brackets between the function's name and the opening parenthesis for its " @@ -1678,12 +1678,12 @@ msgid "" "functions` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1269 -#: ../../reference/compound_stmts.rst:1459 +#: ../../reference/compound_stmts.rst:1270 +#: ../../reference/compound_stmts.rst:1465 msgid "Type parameter lists are new in Python 3.12." msgstr "" -#: ../../reference/compound_stmts.rst:1277 +#: ../../reference/compound_stmts.rst:1278 msgid "" "When one or more :term:`parameters ` have the form *parameter* " "``=`` *expression*, the function is said to have \"default parameter values." @@ -1694,7 +1694,7 @@ msgid "" "syntactic restriction that is not expressed by the grammar." msgstr "" -#: ../../reference/compound_stmts.rst:1285 +#: ../../reference/compound_stmts.rst:1286 msgid "" "**Default parameter values are evaluated from left to right when the " "function definition is executed.** This means that the expression is " @@ -1707,7 +1707,7 @@ msgid "" "the default, and explicitly test for it in the body of the function, e.g.::" msgstr "" -#: ../../reference/compound_stmts.rst:1295 +#: ../../reference/compound_stmts.rst:1296 msgid "" "def whats_on_the_telly(penguin=None):\n" " if penguin is None:\n" @@ -1716,7 +1716,7 @@ msgid "" " return penguin" msgstr "" -#: ../../reference/compound_stmts.rst:1306 +#: ../../reference/compound_stmts.rst:1307 msgid "" "Function call semantics are described in more detail in section :ref:" "`calls`. A function call always assigns values to all parameters mentioned " @@ -1732,31 +1732,39 @@ msgid "" "positional arguments." msgstr "" -#: ../../reference/compound_stmts.rst:1318 +#: ../../reference/compound_stmts.rst:1319 msgid "" "The ``/`` function parameter syntax may be used to indicate positional-only " "parameters. See :pep:`570` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1327 +#: ../../reference/compound_stmts.rst:1328 msgid "" "Parameters may have an :term:`annotation ` of the form " "\"``: expression``\" following the parameter name. Any parameter may have " -"an annotation, even those of the form ``*identifier`` or ``**identifier``. " -"Functions may have \"return\" annotation of the form \"``-> expression``\" " -"after the parameter list. These annotations can be any valid Python " -"expression. The presence of annotations does not change the semantics of a " -"function. The annotation values are available as values of a dictionary " -"keyed by the parameters' names in the :attr:`__annotations__` attribute of " -"the function object. If the ``annotations`` import from :mod:`__future__` " -"is used, annotations are preserved as strings at runtime which enables " -"postponed evaluation. Otherwise, they are evaluated when the function " -"definition is executed. In this case annotations may be evaluated in a " -"different order than they appear in the source code." +"an annotation, even those of the form ``*identifier`` or ``**identifier``. " +"(As a special case, parameters of the form ``*identifier`` may have an " +"annotation \"``: *expression``\".) Functions may have \"return\" annotation " +"of the form \"``-> expression``\" after the parameter list. These " +"annotations can be any valid Python expression. The presence of annotations " +"does not change the semantics of a function. The annotation values are " +"available as values of a dictionary keyed by the parameters' names in the :" +"attr:`__annotations__` attribute of the function object. If the " +"``annotations`` import from :mod:`__future__` is used, annotations are " +"preserved as strings at runtime which enables postponed evaluation. " +"Otherwise, they are evaluated when the function definition is executed. In " +"this case annotations may be evaluated in a different order than they appear " +"in the source code." msgstr "" #: ../../reference/compound_stmts.rst:1342 msgid "" +"Parameters of the form \"``*identifier``\" may have an annotation \"``: " +"*expression``\". See :pep:`646`." +msgstr "" + +#: ../../reference/compound_stmts.rst:1348 +msgid "" "It is also possible to create anonymous functions (functions not bound to a " "name), for immediate use in expressions. This uses lambda expressions, " "described in section :ref:`lambda`. Note that the lambda expression is " @@ -1767,7 +1775,7 @@ msgid "" "execution of multiple statements and annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1350 +#: ../../reference/compound_stmts.rst:1356 msgid "" "**Programmer's note:** Functions are first-class objects. A \"``def``\" " "statement executed inside a function definition defines a local function " @@ -1776,61 +1784,61 @@ msgid "" "See section :ref:`naming` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1358 +#: ../../reference/compound_stmts.rst:1364 msgid ":pep:`3107` - Function Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1359 +#: ../../reference/compound_stmts.rst:1365 msgid "The original specification for function annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1361 +#: ../../reference/compound_stmts.rst:1367 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/compound_stmts.rst:1362 +#: ../../reference/compound_stmts.rst:1368 msgid "Definition of a standard meaning for annotations: type hints." msgstr "" -#: ../../reference/compound_stmts.rst:1364 +#: ../../reference/compound_stmts.rst:1370 msgid ":pep:`526` - Syntax for Variable Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1365 +#: ../../reference/compound_stmts.rst:1371 msgid "" "Ability to type hint variable declarations, including class variables and " "instance variables." msgstr "" -#: ../../reference/compound_stmts.rst:1368 +#: ../../reference/compound_stmts.rst:1374 msgid ":pep:`563` - Postponed Evaluation of Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1369 +#: ../../reference/compound_stmts.rst:1375 msgid "" "Support for forward references within annotations by preserving annotations " "in a string form at runtime instead of eager evaluation." msgstr "" -#: ../../reference/compound_stmts.rst:1372 +#: ../../reference/compound_stmts.rst:1378 msgid ":pep:`318` - Decorators for Functions and Methods" msgstr "" -#: ../../reference/compound_stmts.rst:1373 +#: ../../reference/compound_stmts.rst:1379 msgid "" "Function and method decorators were introduced. Class decorators were " "introduced in :pep:`3129`." msgstr "" -#: ../../reference/compound_stmts.rst:1379 +#: ../../reference/compound_stmts.rst:1385 msgid "Class definitions" msgstr "類別定義" -#: ../../reference/compound_stmts.rst:1394 +#: ../../reference/compound_stmts.rst:1400 msgid "A class definition defines a class object (see section :ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1401 +#: ../../reference/compound_stmts.rst:1407 msgid "" "A class definition is an executable statement. The inheritance list usually " "gives a list of base classes (see :ref:`metaclasses` for more advanced " @@ -1839,7 +1847,7 @@ msgid "" "default, from the base class :class:`object`; hence, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1407 +#: ../../reference/compound_stmts.rst:1413 msgid "" "class Foo:\n" " pass" @@ -1847,11 +1855,11 @@ msgstr "" "class Foo:\n" " pass" -#: ../../reference/compound_stmts.rst:1410 +#: ../../reference/compound_stmts.rst:1416 msgid "is equivalent to ::" msgstr "" -#: ../../reference/compound_stmts.rst:1412 +#: ../../reference/compound_stmts.rst:1418 msgid "" "class Foo(object):\n" " pass" @@ -1859,7 +1867,7 @@ msgstr "" "class Foo(object):\n" " pass" -#: ../../reference/compound_stmts.rst:1415 +#: ../../reference/compound_stmts.rst:1421 msgid "" "The class's suite is then executed in a new execution frame (see :ref:" "`naming`), using a newly created local namespace and the original global " @@ -1871,25 +1879,25 @@ msgid "" "original local namespace." msgstr "" -#: ../../reference/compound_stmts.rst:1424 +#: ../../reference/compound_stmts.rst:1430 msgid "" "The order in which attributes are defined in the class body is preserved in " -"the new class's ``__dict__``. Note that this is reliable only right after " -"the class is created and only for classes that were defined using the " -"definition syntax." +"the new class's :attr:`~type.__dict__`. Note that this is reliable only " +"right after the class is created and only for classes that were defined " +"using the definition syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1429 +#: ../../reference/compound_stmts.rst:1435 msgid "" "Class creation can be customized heavily using :ref:`metaclasses " "`." msgstr "" -#: ../../reference/compound_stmts.rst:1434 +#: ../../reference/compound_stmts.rst:1440 msgid "Classes can also be decorated: just like when decorating functions, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1436 +#: ../../reference/compound_stmts.rst:1442 msgid "" "@f1(arg)\n" "@f2\n" @@ -1899,7 +1907,7 @@ msgstr "" "@f2\n" "class Foo: pass" -#: ../../reference/compound_stmts.rst:1442 +#: ../../reference/compound_stmts.rst:1448 msgid "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" @@ -1907,29 +1915,29 @@ msgstr "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" -#: ../../reference/compound_stmts.rst:1445 +#: ../../reference/compound_stmts.rst:1451 msgid "" "The evaluation rules for the decorator expressions are the same as for " "function decorators. The result is then bound to the class name." msgstr "" -#: ../../reference/compound_stmts.rst:1448 +#: ../../reference/compound_stmts.rst:1454 msgid "" "Classes may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1453 +#: ../../reference/compound_stmts.rst:1459 msgid "" "A list of :ref:`type parameters ` may be given in square " "brackets immediately after the class's name. This indicates to static type " "checkers that the class is generic. At runtime, the type parameters can be " -"retrieved from the class's ``__type_params__`` attribute. See :ref:`generic-" -"classes` for more." +"retrieved from the class's :attr:`~type.__type_params__` attribute. See :ref:" +"`generic-classes` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1462 +#: ../../reference/compound_stmts.rst:1468 msgid "" "**Programmer's note:** Variables defined in the class definition are class " "attributes; they are shared by instances. Instance attributes can be set in " @@ -1942,35 +1950,35 @@ msgid "" "implementation details." msgstr "" -#: ../../reference/compound_stmts.rst:1474 +#: ../../reference/compound_stmts.rst:1480 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/compound_stmts.rst:1475 +#: ../../reference/compound_stmts.rst:1481 msgid "" "The proposal that changed the declaration of metaclasses to the current " "syntax, and the semantics for how classes with metaclasses are constructed." msgstr "" -#: ../../reference/compound_stmts.rst:1479 +#: ../../reference/compound_stmts.rst:1485 msgid ":pep:`3129` - Class Decorators" msgstr ":pep:`3129` - 類別裝飾器" -#: ../../reference/compound_stmts.rst:1480 +#: ../../reference/compound_stmts.rst:1486 msgid "" "The proposal that added class decorators. Function and method decorators " "were introduced in :pep:`318`." msgstr "" -#: ../../reference/compound_stmts.rst:1487 +#: ../../reference/compound_stmts.rst:1493 msgid "Coroutines" msgstr "協程" -#: ../../reference/compound_stmts.rst:1495 +#: ../../reference/compound_stmts.rst:1501 msgid "Coroutine function definition" msgstr "協程函式定義" -#: ../../reference/compound_stmts.rst:1505 +#: ../../reference/compound_stmts.rst:1511 msgid "" "Execution of Python coroutines can be suspended and resumed at many points " "(see :term:`coroutine`). :keyword:`await` expressions, :keyword:`async for` " @@ -1978,23 +1986,23 @@ msgid "" "function." msgstr "" -#: ../../reference/compound_stmts.rst:1509 +#: ../../reference/compound_stmts.rst:1515 msgid "" "Functions defined with ``async def`` syntax are always coroutine functions, " "even if they do not contain ``await`` or ``async`` keywords." msgstr "" -#: ../../reference/compound_stmts.rst:1512 +#: ../../reference/compound_stmts.rst:1518 msgid "" "It is a :exc:`SyntaxError` to use a ``yield from`` expression inside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1515 +#: ../../reference/compound_stmts.rst:1521 msgid "An example of a coroutine function::" msgstr "一個協程函式範例: ::" -#: ../../reference/compound_stmts.rst:1517 +#: ../../reference/compound_stmts.rst:1523 msgid "" "async def func(param1, param2):\n" " do_stuff()\n" @@ -2004,30 +2012,30 @@ msgstr "" " do_stuff()\n" " await some_coroutine()" -#: ../../reference/compound_stmts.rst:1521 +#: ../../reference/compound_stmts.rst:1527 msgid "" "``await`` and ``async`` are now keywords; previously they were only treated " "as such inside the body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1529 +#: ../../reference/compound_stmts.rst:1535 msgid "The :keyword:`!async for` statement" msgstr ":keyword:`!async for` 陳述式" -#: ../../reference/compound_stmts.rst:1534 +#: ../../reference/compound_stmts.rst:1540 msgid "" "An :term:`asynchronous iterable` provides an ``__aiter__`` method that " "directly returns an :term:`asynchronous iterator`, which can call " "asynchronous code in its ``__anext__`` method." msgstr "" -#: ../../reference/compound_stmts.rst:1538 +#: ../../reference/compound_stmts.rst:1544 msgid "" "The ``async for`` statement allows convenient iteration over asynchronous " "iterables." msgstr "" -#: ../../reference/compound_stmts.rst:1543 +#: ../../reference/compound_stmts.rst:1549 msgid "" "async for TARGET in ITER:\n" " SUITE\n" @@ -2039,11 +2047,11 @@ msgstr "" "else:\n" " SUITE2" -#: ../../reference/compound_stmts.rst:1548 +#: ../../reference/compound_stmts.rst:1554 msgid "Is semantically equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1550 +#: ../../reference/compound_stmts.rst:1556 msgid "" "iter = (ITER)\n" "iter = type(iter).__aiter__(iter)\n" @@ -2073,28 +2081,28 @@ msgstr "" "else:\n" " SUITE2" -#: ../../reference/compound_stmts.rst:1564 +#: ../../reference/compound_stmts.rst:1570 msgid "" "See also :meth:`~object.__aiter__` and :meth:`~object.__anext__` for details." msgstr "更多細節請見 :meth:`~object.__aiter__` 與 :meth:`~object.__anext__`。" -#: ../../reference/compound_stmts.rst:1566 +#: ../../reference/compound_stmts.rst:1572 msgid "" "It is a :exc:`SyntaxError` to use an ``async for`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1574 +#: ../../reference/compound_stmts.rst:1580 msgid "The :keyword:`!async with` statement" msgstr ":keyword:`!async with` 陳述式" -#: ../../reference/compound_stmts.rst:1579 +#: ../../reference/compound_stmts.rst:1585 msgid "" "An :term:`asynchronous context manager` is a :term:`context manager` that is " "able to suspend execution in its *enter* and *exit* methods." msgstr "" -#: ../../reference/compound_stmts.rst:1584 +#: ../../reference/compound_stmts.rst:1590 msgid "" "async with EXPRESSION as TARGET:\n" " SUITE" @@ -2102,7 +2110,7 @@ msgstr "" "async with EXPRESSION as TARGET:\n" " SUITE" -#: ../../reference/compound_stmts.rst:1589 +#: ../../reference/compound_stmts.rst:1595 msgid "" "manager = (EXPRESSION)\n" "aenter = type(manager).__aenter__\n" @@ -2138,44 +2146,44 @@ msgstr "" " if not hit_except:\n" " await aexit(manager, None, None, None)" -#: ../../reference/compound_stmts.rst:1606 +#: ../../reference/compound_stmts.rst:1612 msgid "" "See also :meth:`~object.__aenter__` and :meth:`~object.__aexit__` for " "details." msgstr "更多細節請見 :meth:`~object.__aenter__` 與 :meth:`~object.__aexit__`。" -#: ../../reference/compound_stmts.rst:1608 +#: ../../reference/compound_stmts.rst:1614 msgid "" "It is a :exc:`SyntaxError` to use an ``async with`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1613 +#: ../../reference/compound_stmts.rst:1619 msgid ":pep:`492` - Coroutines with async and await syntax" msgstr "" -#: ../../reference/compound_stmts.rst:1614 +#: ../../reference/compound_stmts.rst:1620 msgid "" "The proposal that made coroutines a proper standalone concept in Python, and " "added supporting syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1620 +#: ../../reference/compound_stmts.rst:1626 msgid "Type parameter lists" msgstr "" -#: ../../reference/compound_stmts.rst:1624 +#: ../../reference/compound_stmts.rst:1630 msgid "Support for default values was added (see :pep:`696`)." msgstr "" -#: ../../reference/compound_stmts.rst:1637 +#: ../../reference/compound_stmts.rst:1643 msgid "" ":ref:`Functions ` (including :ref:`coroutines `), :ref:" "`classes ` and :ref:`type aliases ` may contain a type " "parameter list::" msgstr "" -#: ../../reference/compound_stmts.rst:1641 +#: ../../reference/compound_stmts.rst:1647 msgid "" "def max[T](args: list[T]) -> T:\n" " ...\n" @@ -2207,7 +2215,7 @@ msgstr "" "\n" "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1656 +#: ../../reference/compound_stmts.rst:1662 msgid "" "Semantically, this indicates that the function, class, or type alias is " "generic over a type variable. This information is primarily used by static " @@ -2215,7 +2223,7 @@ msgid "" "generic counterparts." msgstr "" -#: ../../reference/compound_stmts.rst:1661 +#: ../../reference/compound_stmts.rst:1667 msgid "" "Type parameters are declared in square brackets (``[]``) immediately after " "the name of the function, class, or type alias. The type parameters are " @@ -2227,36 +2235,36 @@ msgid "" "wraps the creation of the generic object." msgstr "" -#: ../../reference/compound_stmts.rst:1670 +#: ../../reference/compound_stmts.rst:1676 msgid "" -"Generic functions, classes, and type aliases have a :attr:`!__type_params__` " -"attribute listing their type parameters." +"Generic functions, classes, and type aliases have a :attr:`~definition." +"__type_params__` attribute listing their type parameters." msgstr "" -#: ../../reference/compound_stmts.rst:1673 +#: ../../reference/compound_stmts.rst:1679 msgid "Type parameters come in three kinds:" msgstr "" -#: ../../reference/compound_stmts.rst:1675 +#: ../../reference/compound_stmts.rst:1681 msgid "" ":data:`typing.TypeVar`, introduced by a plain name (e.g., ``T``). " "Semantically, this represents a single type to a type checker." msgstr "" -#: ../../reference/compound_stmts.rst:1677 +#: ../../reference/compound_stmts.rst:1683 msgid "" ":data:`typing.TypeVarTuple`, introduced by a name prefixed with a single " "asterisk (e.g., ``*Ts``). Semantically, this stands for a tuple of any " "number of types." msgstr "" -#: ../../reference/compound_stmts.rst:1680 +#: ../../reference/compound_stmts.rst:1686 msgid "" ":data:`typing.ParamSpec`, introduced by a name prefixed with two asterisks " "(e.g., ``**P``). Semantically, this stands for the parameters of a callable." msgstr "" -#: ../../reference/compound_stmts.rst:1683 +#: ../../reference/compound_stmts.rst:1689 msgid "" ":data:`typing.TypeVar` declarations can define *bounds* and *constraints* " "with a colon (``:``) followed by an expression. A single expression after " @@ -2268,7 +2276,7 @@ msgid "" "variables can only take on one of the types in the list of constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1692 +#: ../../reference/compound_stmts.rst:1698 msgid "" "For :data:`!typing.TypeVar`\\ s declared using the type parameter list " "syntax, the bound and constraints are not evaluated when the generic object " @@ -2278,13 +2286,13 @@ msgid "" "`." msgstr "" -#: ../../reference/compound_stmts.rst:1698 +#: ../../reference/compound_stmts.rst:1704 msgid "" ":data:`typing.TypeVarTuple`\\ s and :data:`typing.ParamSpec`\\ s cannot have " "bounds or constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1701 +#: ../../reference/compound_stmts.rst:1707 msgid "" "All three flavors of type parameters can also have a *default value*, which " "is used when the type parameter is not explicitly provided. This is added by " @@ -2297,13 +2305,13 @@ msgid "" "attribute is set to the special sentinel object :data:`typing.NoDefault`." msgstr "" -#: ../../reference/compound_stmts.rst:1711 +#: ../../reference/compound_stmts.rst:1717 msgid "" "The following example indicates the full set of allowed type parameter " "declarations::" msgstr "" -#: ../../reference/compound_stmts.rst:1713 +#: ../../reference/compound_stmts.rst:1719 msgid "" "def overly_generic[\n" " SimpleTypeVar,\n" @@ -2335,24 +2343,24 @@ msgstr "" " *e: SimpleTypeVarTuple,\n" "): ..." -#: ../../reference/compound_stmts.rst:1731 +#: ../../reference/compound_stmts.rst:1737 msgid "Generic functions" msgstr "" -#: ../../reference/compound_stmts.rst:1733 +#: ../../reference/compound_stmts.rst:1739 msgid "Generic functions are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1735 +#: ../../reference/compound_stmts.rst:1741 msgid "def func[T](arg: T): ..." msgstr "def func[T](arg: T): ..." -#: ../../reference/compound_stmts.rst:1737 -#: ../../reference/compound_stmts.rst:1797 +#: ../../reference/compound_stmts.rst:1743 +#: ../../reference/compound_stmts.rst:1803 msgid "This syntax is equivalent to::" msgstr "語法大致等價於: ::" -#: ../../reference/compound_stmts.rst:1739 +#: ../../reference/compound_stmts.rst:1745 msgid "" "annotation-def TYPE_PARAMS_OF_func():\n" " T = typing.TypeVar(\"T\")\n" @@ -2368,7 +2376,7 @@ msgstr "" " return func\n" "func = TYPE_PARAMS_OF_func()" -#: ../../reference/compound_stmts.rst:1746 +#: ../../reference/compound_stmts.rst:1752 msgid "" "Here ``annotation-def`` indicates an :ref:`annotation scope `, which is not actually bound to any name at runtime. (One other " @@ -2377,20 +2385,20 @@ msgid "" "data:`typing.TypeVar` directly.)" msgstr "" -#: ../../reference/compound_stmts.rst:1752 +#: ../../reference/compound_stmts.rst:1758 msgid "" "The annotations of generic functions are evaluated within the annotation " "scope used for declaring the type parameters, but the function's defaults " "and decorators are not." msgstr "" -#: ../../reference/compound_stmts.rst:1756 +#: ../../reference/compound_stmts.rst:1762 msgid "" "The following example illustrates the scoping rules for these cases, as well " "as for additional flavors of type parameters::" msgstr "" -#: ../../reference/compound_stmts.rst:1759 +#: ../../reference/compound_stmts.rst:1765 msgid "" "@decorator\n" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" @@ -2400,13 +2408,13 @@ msgstr "" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" " ..." -#: ../../reference/compound_stmts.rst:1763 +#: ../../reference/compound_stmts.rst:1769 msgid "" "Except for the :ref:`lazy evaluation ` of the :class:" "`~typing.TypeVar` bound, this is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1766 +#: ../../reference/compound_stmts.rst:1772 msgid "" "DEFAULT_OF_arg = some_default\n" "\n" @@ -2428,25 +2436,25 @@ msgid "" "func = decorator(TYPE_PARAMS_OF_func())" msgstr "" -#: ../../reference/compound_stmts.rst:1785 +#: ../../reference/compound_stmts.rst:1791 msgid "" "The capitalized names like ``DEFAULT_OF_arg`` are not actually bound at " "runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1791 +#: ../../reference/compound_stmts.rst:1797 msgid "Generic classes" msgstr "" -#: ../../reference/compound_stmts.rst:1793 +#: ../../reference/compound_stmts.rst:1799 msgid "Generic classes are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1795 +#: ../../reference/compound_stmts.rst:1801 msgid "class Bag[T]: ..." msgstr "class Bag[T]: ..." -#: ../../reference/compound_stmts.rst:1799 +#: ../../reference/compound_stmts.rst:1805 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2464,14 +2472,14 @@ msgstr "" " return Bag\n" "Bag = TYPE_PARAMS_OF_Bag()" -#: ../../reference/compound_stmts.rst:1807 +#: ../../reference/compound_stmts.rst:1813 msgid "" "Here again ``annotation-def`` (not a real keyword) indicates an :ref:" "`annotation scope `, and the name ``TYPE_PARAMS_OF_Bag`` " "is not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1811 +#: ../../reference/compound_stmts.rst:1817 msgid "" "Generic classes implicitly inherit from :data:`typing.Generic`. The base " "classes and keyword arguments of generic classes are evaluated within the " @@ -2479,7 +2487,7 @@ msgid "" "that scope. This is illustrated by this example::" msgstr "" -#: ../../reference/compound_stmts.rst:1817 +#: ../../reference/compound_stmts.rst:1823 msgid "" "@decorator\n" "class Bag(Base[T], arg=T): ..." @@ -2487,11 +2495,11 @@ msgstr "" "@decorator\n" "class Bag(Base[T], arg=T): ..." -#: ../../reference/compound_stmts.rst:1820 +#: ../../reference/compound_stmts.rst:1826 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../reference/compound_stmts.rst:1822 +#: ../../reference/compound_stmts.rst:1828 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2509,27 +2517,27 @@ msgstr "" " return Bag\n" "Bag = decorator(TYPE_PARAMS_OF_Bag())" -#: ../../reference/compound_stmts.rst:1833 +#: ../../reference/compound_stmts.rst:1839 msgid "Generic type aliases" msgstr "" -#: ../../reference/compound_stmts.rst:1835 +#: ../../reference/compound_stmts.rst:1841 msgid "" "The :keyword:`type` statement can also be used to create a generic type " "alias::" msgstr "" -#: ../../reference/compound_stmts.rst:1837 +#: ../../reference/compound_stmts.rst:1843 msgid "type ListOrSet[T] = list[T] | set[T]" msgstr "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1839 +#: ../../reference/compound_stmts.rst:1845 msgid "" "Except for the :ref:`lazy evaluation ` of the value, this " "is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1842 +#: ../../reference/compound_stmts.rst:1848 msgid "" "annotation-def TYPE_PARAMS_OF_ListOrSet():\n" " T = typing.TypeVar(\"T\")\n" @@ -2542,109 +2550,109 @@ msgid "" "ListOrSet = TYPE_PARAMS_OF_ListOrSet()" msgstr "" -#: ../../reference/compound_stmts.rst:1851 +#: ../../reference/compound_stmts.rst:1857 msgid "" "Here, ``annotation-def`` (not a real keyword) indicates an :ref:`annotation " "scope `. The capitalized names like " "``TYPE_PARAMS_OF_ListOrSet`` are not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1856 +#: ../../reference/compound_stmts.rst:1862 msgid "Footnotes" msgstr "註解" -#: ../../reference/compound_stmts.rst:1857 +#: ../../reference/compound_stmts.rst:1863 msgid "" "The exception is propagated to the invocation stack unless there is a :" "keyword:`finally` clause which happens to raise another exception. That new " "exception causes the old one to be lost." msgstr "" -#: ../../reference/compound_stmts.rst:1861 +#: ../../reference/compound_stmts.rst:1867 msgid "In pattern matching, a sequence is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1863 +#: ../../reference/compound_stmts.rst:1869 msgid "a class that inherits from :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1864 +#: ../../reference/compound_stmts.rst:1870 msgid "" "a Python class that has been registered as :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1865 +#: ../../reference/compound_stmts.rst:1871 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_SEQUENCE` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1866 -#: ../../reference/compound_stmts.rst:1885 +#: ../../reference/compound_stmts.rst:1872 +#: ../../reference/compound_stmts.rst:1891 msgid "a class that inherits from any of the above" msgstr "" -#: ../../reference/compound_stmts.rst:1868 +#: ../../reference/compound_stmts.rst:1874 msgid "The following standard library classes are sequences:" msgstr "" -#: ../../reference/compound_stmts.rst:1870 +#: ../../reference/compound_stmts.rst:1876 msgid ":class:`array.array`" msgstr ":class:`array.array`" -#: ../../reference/compound_stmts.rst:1871 +#: ../../reference/compound_stmts.rst:1877 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../reference/compound_stmts.rst:1873 +#: ../../reference/compound_stmts.rst:1879 msgid ":class:`memoryview`" msgstr ":class:`memoryview`" -#: ../../reference/compound_stmts.rst:1874 +#: ../../reference/compound_stmts.rst:1880 msgid ":class:`range`" msgstr ":class:`range`" -#: ../../reference/compound_stmts.rst:1877 +#: ../../reference/compound_stmts.rst:1883 msgid "" "Subject values of type ``str``, ``bytes``, and ``bytearray`` do not match " "sequence patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1880 +#: ../../reference/compound_stmts.rst:1886 msgid "In pattern matching, a mapping is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1882 +#: ../../reference/compound_stmts.rst:1888 msgid "a class that inherits from :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1883 +#: ../../reference/compound_stmts.rst:1889 msgid "" "a Python class that has been registered as :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1884 +#: ../../reference/compound_stmts.rst:1890 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_MAPPING` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1887 +#: ../../reference/compound_stmts.rst:1893 msgid "" "The standard library classes :class:`dict` and :class:`types." "MappingProxyType` are mappings." msgstr "" -#: ../../reference/compound_stmts.rst:1890 +#: ../../reference/compound_stmts.rst:1896 msgid "" "A string literal appearing as the first statement in the function body is " "transformed into the function's :attr:`~function.__doc__` attribute and " "therefore the function's :term:`docstring`." msgstr "" -#: ../../reference/compound_stmts.rst:1894 +#: ../../reference/compound_stmts.rst:1900 msgid "" "A string literal appearing as the first statement in the class body is " -"transformed into the namespace's ``__doc__`` item and therefore the class's :" -"term:`docstring`." +"transformed into the namespace's :attr:`~type.__doc__` item and therefore " +"the class's :term:`docstring`." msgstr "" #: ../../reference/compound_stmts.rst:7 @@ -2662,10 +2670,10 @@ msgstr "compound(複合)" #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:588 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 -#: ../../reference/compound_stmts.rst:1491 -#: ../../reference/compound_stmts.rst:1525 -#: ../../reference/compound_stmts.rst:1570 +#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1497 +#: ../../reference/compound_stmts.rst:1531 +#: ../../reference/compound_stmts.rst:1576 msgid "statement" msgstr "statement(陳述式)" @@ -2713,7 +2721,7 @@ msgstr "if" #: ../../reference/compound_stmts.rst:408 #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:588 -#: ../../reference/compound_stmts.rst:1501 +#: ../../reference/compound_stmts.rst:1507 msgid "keyword" msgstr "keyword(關鍵字)" @@ -2727,8 +2735,8 @@ msgstr "elif" #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:588 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1322 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1323 +#: ../../reference/compound_stmts.rst:1387 msgid ": (colon)" msgstr ": (冒號)" @@ -2738,7 +2746,7 @@ msgstr ": (冒號)" #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:588 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "compound statement" msgstr "compound statement(複合陳述式)" @@ -2784,7 +2792,7 @@ msgstr "list(串列)" #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:298 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "object" msgstr "object(物件)" @@ -2855,7 +2863,7 @@ msgstr "with statement(with 陳述式)" #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid ", (comma)" msgstr ", (逗號)" @@ -2896,15 +2904,15 @@ msgid "AS pattern, OR pattern, capture pattern, wildcard pattern" msgstr "" #: ../../reference/compound_stmts.rst:1186 -#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1273 msgid "parameter" msgstr "parameter(參數)" #: ../../reference/compound_stmts.rst:1186 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1236 -#: ../../reference/compound_stmts.rst:1272 -#: ../../reference/compound_stmts.rst:1301 +#: ../../reference/compound_stmts.rst:1237 +#: ../../reference/compound_stmts.rst:1273 +#: ../../reference/compound_stmts.rst:1302 msgid "function definition" msgstr "function definition(函式定義)" @@ -2913,22 +2921,22 @@ msgid "def" msgstr "def" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1322 +#: ../../reference/compound_stmts.rst:1323 msgid "function" msgstr "function (函式)" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "definition" msgstr "definition(定義)" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "name" msgstr "name(名稱)" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "binding" msgstr "binding(綁定)" @@ -2937,7 +2945,7 @@ msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "() (parentheses)" msgstr "() (圓括號)" @@ -2945,108 +2953,108 @@ msgstr "() (圓括號)" msgid "parameter list" msgstr "parameter list(參數列表)" -#: ../../reference/compound_stmts.rst:1236 -#: ../../reference/compound_stmts.rst:1431 +#: ../../reference/compound_stmts.rst:1237 +#: ../../reference/compound_stmts.rst:1437 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1273 msgid "default" msgstr "default(預設)" -#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1273 msgid "value" msgstr "value(值)" -#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1273 msgid "argument" msgstr "argument(引數)" -#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1273 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/compound_stmts.rst:1301 +#: ../../reference/compound_stmts.rst:1302 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/compound_stmts.rst:1301 +#: ../../reference/compound_stmts.rst:1302 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/compound_stmts.rst:1301 +#: ../../reference/compound_stmts.rst:1302 msgid "**" msgstr "**" -#: ../../reference/compound_stmts.rst:1322 +#: ../../reference/compound_stmts.rst:1323 msgid "annotations" msgstr "annotations(註釋)" -#: ../../reference/compound_stmts.rst:1322 +#: ../../reference/compound_stmts.rst:1323 msgid "->" msgstr "->" -#: ../../reference/compound_stmts.rst:1322 +#: ../../reference/compound_stmts.rst:1323 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../reference/compound_stmts.rst:1340 +#: ../../reference/compound_stmts.rst:1346 msgid "lambda" msgstr "lambda" -#: ../../reference/compound_stmts.rst:1340 +#: ../../reference/compound_stmts.rst:1346 msgid "expression" msgstr "expression(運算式)" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "class" msgstr "class(類別)" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "execution" msgstr "execution(執行)" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "frame" msgstr "frame" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "inheritance" msgstr "inheritance(繼承)" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../reference/compound_stmts.rst:1381 -#: ../../reference/compound_stmts.rst:1431 +#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1437 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "expression list" msgstr "expression list(表達式列表)" -#: ../../reference/compound_stmts.rst:1491 +#: ../../reference/compound_stmts.rst:1497 msgid "async def" msgstr "async def" -#: ../../reference/compound_stmts.rst:1501 +#: ../../reference/compound_stmts.rst:1507 msgid "async" msgstr "async" -#: ../../reference/compound_stmts.rst:1501 +#: ../../reference/compound_stmts.rst:1507 msgid "await" msgstr "await" -#: ../../reference/compound_stmts.rst:1525 +#: ../../reference/compound_stmts.rst:1531 msgid "async for" msgstr "async for" -#: ../../reference/compound_stmts.rst:1570 +#: ../../reference/compound_stmts.rst:1576 msgid "async with" msgstr "async with" -#: ../../reference/compound_stmts.rst:1627 +#: ../../reference/compound_stmts.rst:1633 msgid "type parameters" msgstr "type parameter(型別參數)" diff --git a/reference/datamodel.po b/reference/datamodel.po index 0d583e4d37..4a7709654d 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-27 00:03+0000\n" +"POT-Creation-Date: 2024-10-04 00:13+0000\n" "PO-Revision-Date: 2024-09-24 19:03+0900\n" "Last-Translator: Kisaragi Hiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -668,16 +668,18 @@ msgid "" "containing the same number of items as the function's formal parameter list." msgstr "" -#: ../../reference/datamodel.rst:545 ../../reference/datamodel.rst:1133 -#: ../../reference/datamodel.rst:1330 +#: ../../reference/datamodel.rst:545 ../../reference/datamodel.rst:1206 +#: ../../reference/datamodel.rst:1403 msgid "Special read-only attributes" msgstr "特殊唯讀屬性" #: ../../reference/datamodel.rst:555 ../../reference/datamodel.rst:589 +#: ../../reference/datamodel.rst:981 msgid "Attribute" msgstr "屬性" #: ../../reference/datamodel.rst:556 ../../reference/datamodel.rst:590 +#: ../../reference/datamodel.rst:982 msgid "Meaning" msgstr "含義" @@ -700,7 +702,7 @@ msgid "" "the value of the cell, as well as set the value." msgstr "" -#: ../../reference/datamodel.rst:571 ../../reference/datamodel.rst:1372 +#: ../../reference/datamodel.rst:571 ../../reference/datamodel.rst:1445 msgid "Special writable attributes" msgstr "特殊可寫屬性" @@ -709,49 +711,47 @@ msgid "Most of these attributes check the type of the assigned value:" msgstr "" #: ../../reference/datamodel.rst:593 -msgid "" -"The function's documentation string, or ``None`` if unavailable. Not " -"inherited by subclasses." -msgstr "" +msgid "The function's documentation string, or ``None`` if unavailable." +msgstr "函式的文件字串,若不可用則為 ``None``。" -#: ../../reference/datamodel.rst:597 +#: ../../reference/datamodel.rst:596 msgid "" "The function's name. See also: :attr:`__name__ attributes `." msgstr "" -#: ../../reference/datamodel.rst:601 +#: ../../reference/datamodel.rst:600 msgid "" "The function's :term:`qualified name`. See also: :attr:`__qualname__ " "attributes `." msgstr "" -#: ../../reference/datamodel.rst:607 +#: ../../reference/datamodel.rst:606 msgid "" "The name of the module the function was defined in, or ``None`` if " "unavailable." msgstr "" -#: ../../reference/datamodel.rst:611 +#: ../../reference/datamodel.rst:610 msgid "" "A :class:`tuple` containing default :term:`parameter` values for those " "parameters that have defaults, or ``None`` if no parameters have a default " "value." msgstr "" -#: ../../reference/datamodel.rst:616 +#: ../../reference/datamodel.rst:615 msgid "" "The :ref:`code object ` representing the compiled function " "body." msgstr "代表編譯函式主體的\\ :ref:`程式碼物件 `。" -#: ../../reference/datamodel.rst:620 +#: ../../reference/datamodel.rst:619 msgid "" "The namespace supporting arbitrary function attributes. See also: :attr:" "`__dict__ attributes `." msgstr "" -#: ../../reference/datamodel.rst:624 +#: ../../reference/datamodel.rst:623 msgid "" "A :class:`dictionary ` containing annotations of :term:`parameters " "`. The keys of the dictionary are the parameter names, and " @@ -759,88 +759,88 @@ msgid "" "`annotations-howto`." msgstr "" -#: ../../reference/datamodel.rst:631 +#: ../../reference/datamodel.rst:630 msgid "" "A :class:`dictionary ` containing defaults for keyword-only :term:" "`parameters `." msgstr "" -#: ../../reference/datamodel.rst:635 +#: ../../reference/datamodel.rst:634 msgid "" "A :class:`tuple` containing the :ref:`type parameters ` of a :" "ref:`generic function `." msgstr "" -#: ../../reference/datamodel.rst:640 +#: ../../reference/datamodel.rst:639 msgid "" "Function objects also support getting and setting arbitrary attributes, " "which can be used, for example, to attach metadata to functions. Regular " "attribute dot-notation is used to get and set such attributes." msgstr "" -#: ../../reference/datamodel.rst:646 +#: ../../reference/datamodel.rst:645 msgid "" "CPython's current implementation only supports function attributes on user-" "defined functions. Function attributes on :ref:`built-in functions ` may be supported in the future." msgstr "" -#: ../../reference/datamodel.rst:651 +#: ../../reference/datamodel.rst:650 msgid "" "Additional information about a function's definition can be retrieved from " "its :ref:`code object ` (accessible via the :attr:`~function." "__code__` attribute)." msgstr "" -#: ../../reference/datamodel.rst:659 +#: ../../reference/datamodel.rst:658 msgid "Instance methods" msgstr "" -#: ../../reference/datamodel.rst:666 +#: ../../reference/datamodel.rst:665 msgid "" "An instance method object combines a class, a class instance and any " "callable object (normally a user-defined function)." msgstr "" -#: ../../reference/datamodel.rst:676 ../../reference/datamodel.rst:1468 +#: ../../reference/datamodel.rst:675 ../../reference/datamodel.rst:1541 msgid "Special read-only attributes:" msgstr "特殊唯讀屬性:" -#: ../../reference/datamodel.rst:681 +#: ../../reference/datamodel.rst:680 msgid "" "Refers to the class instance object to which the method is :ref:`bound " "`" msgstr "" -#: ../../reference/datamodel.rst:685 +#: ../../reference/datamodel.rst:684 msgid "Refers to the original :ref:`function object `" msgstr "" -#: ../../reference/datamodel.rst:688 +#: ../../reference/datamodel.rst:687 msgid "" "The method's documentation (same as :attr:`method.__func__.__doc__ `). A :class:`string ` if the original function had a " "docstring, else ``None``." msgstr "" -#: ../../reference/datamodel.rst:694 +#: ../../reference/datamodel.rst:693 msgid "" "The name of the method (same as :attr:`method.__func__.__name__ `)" msgstr "" -#: ../../reference/datamodel.rst:698 +#: ../../reference/datamodel.rst:697 msgid "" "The name of the module the method was defined in, or ``None`` if unavailable." msgstr "" -#: ../../reference/datamodel.rst:701 +#: ../../reference/datamodel.rst:700 msgid "" "Methods also support accessing (but not setting) the arbitrary function " "attributes on the underlying :ref:`function object `." msgstr "" -#: ../../reference/datamodel.rst:704 +#: ../../reference/datamodel.rst:703 msgid "" "User-defined method objects may be created when getting an attribute of a " "class (perhaps via an instance of that class), if that attribute is a user-" @@ -848,7 +848,7 @@ msgid "" "`classmethod` object." msgstr "" -#: ../../reference/datamodel.rst:711 +#: ../../reference/datamodel.rst:710 msgid "" "When an instance method object is created by retrieving a user-defined :ref:" "`function object ` from a class via one of its " @@ -857,7 +857,7 @@ msgid "" "__func__` attribute is the original function object." msgstr "" -#: ../../reference/datamodel.rst:717 +#: ../../reference/datamodel.rst:716 msgid "" "When an instance method object is created by retrieving a :class:" "`classmethod` object from a class or instance, its :attr:`~method.__self__` " @@ -865,7 +865,7 @@ msgid "" "the function object underlying the class method." msgstr "" -#: ../../reference/datamodel.rst:722 +#: ../../reference/datamodel.rst:721 msgid "" "When an instance method object is called, the underlying function (:attr:" "`~method.__func__`) is called, inserting the class instance (:attr:`~method." @@ -875,7 +875,7 @@ msgid "" "f(x, 1)``." msgstr "" -#: ../../reference/datamodel.rst:729 +#: ../../reference/datamodel.rst:728 msgid "" "When an instance method object is derived from a :class:`classmethod` " "object, the \"class instance\" stored in :attr:`~method.__self__` will " @@ -884,18 +884,18 @@ msgid "" "function." msgstr "" -#: ../../reference/datamodel.rst:734 +#: ../../reference/datamodel.rst:733 msgid "" "It is important to note that user-defined functions which are attributes of " "a class instance are not converted to bound methods; this *only* happens " "when the function is an attribute of the class." msgstr "" -#: ../../reference/datamodel.rst:741 +#: ../../reference/datamodel.rst:740 msgid "Generator functions" msgstr "Generator(產生器)函式" -#: ../../reference/datamodel.rst:747 +#: ../../reference/datamodel.rst:746 msgid "" "A function or method which uses the :keyword:`yield` statement (see section :" "ref:`yield`) is called a :dfn:`generator function`. Such a function, when " @@ -908,11 +908,11 @@ msgid "" "values to be returned." msgstr "" -#: ../../reference/datamodel.rst:759 +#: ../../reference/datamodel.rst:758 msgid "Coroutine functions" msgstr "Coroutine(協程)函式" -#: ../../reference/datamodel.rst:764 +#: ../../reference/datamodel.rst:763 msgid "" "A function or method which is defined using :keyword:`async def` is called " "a :dfn:`coroutine function`. Such a function, when called, returns a :term:" @@ -921,11 +921,11 @@ msgid "" "ref:`coroutine-objects` section." msgstr "" -#: ../../reference/datamodel.rst:772 +#: ../../reference/datamodel.rst:771 msgid "Asynchronous generator functions" msgstr "" -#: ../../reference/datamodel.rst:778 +#: ../../reference/datamodel.rst:777 msgid "" "A function or method which is defined using :keyword:`async def` and which " "uses the :keyword:`yield` statement is called a :dfn:`asynchronous generator " @@ -934,7 +934,7 @@ msgid "" "execute the body of the function." msgstr "" -#: ../../reference/datamodel.rst:784 +#: ../../reference/datamodel.rst:783 msgid "" "Calling the asynchronous iterator's :meth:`aiterator.__anext__ ` method will return an :term:`awaitable` which when awaited will " @@ -945,11 +945,11 @@ msgid "" "yielded." msgstr "" -#: ../../reference/datamodel.rst:797 +#: ../../reference/datamodel.rst:796 msgid "Built-in functions" msgstr "內建函式" -#: ../../reference/datamodel.rst:804 +#: ../../reference/datamodel.rst:803 msgid "" "A built-in function object is a wrapper around a C function. Examples of " "built-in functions are :func:`len` and :func:`math.sin` (:mod:`math` is a " @@ -960,7 +960,7 @@ msgstr "" "func:`math.sin`\\ (\\ :mod:`math` 是一個標準的內建模組)。內建函式的引數數量" "與其型別由其包裝的 C 函式所決定。特殊唯讀屬性:" -#: ../../reference/datamodel.rst:809 +#: ../../reference/datamodel.rst:808 msgid "" ":attr:`!__doc__` is the function's documentation string, or ``None`` if " "unavailable. See :attr:`function.__doc__`." @@ -968,26 +968,26 @@ msgstr "" ":attr:`!__doc__` 是函式的文件字串,若不可用則為 ``None``。請見 :attr:" "`function.__doc__`。" -#: ../../reference/datamodel.rst:811 +#: ../../reference/datamodel.rst:810 msgid "" ":attr:`!__name__` is the function's name. See :attr:`function.__name__`." msgstr ":attr:`!__name__` 是函式的名稱。請見 :attr:`function.__name__`。" -#: ../../reference/datamodel.rst:812 +#: ../../reference/datamodel.rst:811 msgid ":attr:`!__self__` is set to ``None`` (but see the next item)." msgstr "" -#: ../../reference/datamodel.rst:813 +#: ../../reference/datamodel.rst:812 msgid "" ":attr:`!__module__` is the name of the module the function was defined in or " "``None`` if unavailable. See :attr:`function.__module__`." msgstr "" -#: ../../reference/datamodel.rst:821 +#: ../../reference/datamodel.rst:820 msgid "Built-in methods" msgstr "" -#: ../../reference/datamodel.rst:828 +#: ../../reference/datamodel.rst:827 msgid "" "This is really a different disguise of a built-in function, this time " "containing an object passed to the C function as an implicit extra " @@ -1058,7 +1058,7 @@ msgstr ":attr:`__name__`" msgid "The module's name." msgstr "" -#: ../../reference/datamodel.rst:888 ../../reference/datamodel.rst:988 +#: ../../reference/datamodel.rst:888 msgid ":attr:`__doc__`" msgstr ":attr:`__doc__`" @@ -1079,7 +1079,7 @@ msgid "" "library, it's the pathname of the shared library file." msgstr "" -#: ../../reference/datamodel.rst:901 ../../reference/datamodel.rst:991 +#: ../../reference/datamodel.rst:901 msgid ":attr:`__annotations__`" msgstr ":attr:`__annotations__`" @@ -1104,11 +1104,11 @@ msgid "" "module around while using its dictionary directly." msgstr "" -#: ../../reference/datamodel.rst:921 +#: ../../reference/datamodel.rst:923 msgid "Custom classes" msgstr "" -#: ../../reference/datamodel.rst:923 +#: ../../reference/datamodel.rst:925 msgid "" "Custom class types are typically created by class definitions (see section :" "ref:`class`). A class has a namespace implemented by a dictionary object. " @@ -1123,7 +1123,7 @@ msgid "" "found at :ref:`python_2.3_mro`." msgstr "" -#: ../../reference/datamodel.rst:944 +#: ../../reference/datamodel.rst:946 msgid "" "When a class attribute reference (for class :class:`!C`, say) would yield a " "class method object, it is transformed into an instance method object whose :" @@ -1134,102 +1134,135 @@ msgid "" "contained in its :attr:`~object.__dict__`." msgstr "" -#: ../../reference/datamodel.rst:955 +#: ../../reference/datamodel.rst:957 msgid "" "Class attribute assignments update the class's dictionary, never the " "dictionary of a base class." msgstr "" -#: ../../reference/datamodel.rst:960 +#: ../../reference/datamodel.rst:962 msgid "" "A class object can be called (see above) to yield a class instance (see " "below)." msgstr "" -#: ../../reference/datamodel.rst:973 -msgid "Special attributes:" -msgstr "特殊屬性:" - -#: ../../reference/datamodel.rst:975 -msgid ":attr:`~definition.__name__`" -msgstr ":attr:`~definition.__name__`" +#: ../../reference/datamodel.rst:965 ../../reference/datamodel.rst:1112 +msgid "Special attributes" +msgstr "特殊屬性" -#: ../../reference/datamodel.rst:976 -msgid "The class name." +#: ../../reference/datamodel.rst:985 +msgid "" +"The class's name. See also: :attr:`__name__ attributes `." msgstr "" -#: ../../reference/datamodel.rst:978 -msgid ":attr:`__module__`" -msgstr ":attr:`__module__`" +#: ../../reference/datamodel.rst:989 +msgid "" +"The class's :term:`qualified name`. See also: :attr:`__qualname__ attributes " +"`." +msgstr "" -#: ../../reference/datamodel.rst:979 +#: ../../reference/datamodel.rst:993 msgid "The name of the module in which the class was defined." msgstr "" -#: ../../reference/datamodel.rst:981 -msgid ":attr:`~object.__dict__`" -msgstr ":attr:`~object.__dict__`" +#: ../../reference/datamodel.rst:996 +msgid "" +"A :class:`mapping proxy ` providing a read-only view " +"of the class's namespace. See also: :attr:`__dict__ attributes `." +msgstr "" -#: ../../reference/datamodel.rst:982 -msgid "The dictionary containing the class's namespace." +#: ../../reference/datamodel.rst:1001 +msgid "" +"A :class:`tuple` containing the class's bases. In most cases, for a class " +"defined as ``class X(A, B, C)``, ``X.__bases__`` will be exactly equal to " +"``(A, B, C)``." msgstr "" -#: ../../reference/datamodel.rst:984 -msgid ":attr:`~class.__bases__`" -msgstr ":attr:`~class.__bases__`" +#: ../../reference/datamodel.rst:1006 +msgid "" +"The class's documentation string, or ``None`` if undefined. Not inherited by " +"subclasses." +msgstr "" -#: ../../reference/datamodel.rst:985 +#: ../../reference/datamodel.rst:1010 msgid "" -"A tuple containing the base classes, in the order of their occurrence in the " -"base class list." +"A dictionary containing :term:`variable annotations ` " +"collected during class body execution. For best practices on working with :" +"attr:`!__annotations__`, please see :ref:`annotations-howto`." msgstr "" -#: ../../reference/datamodel.rst:989 -msgid "The class's documentation string, or ``None`` if undefined." +#: ../../reference/datamodel.rst:1017 +msgid "" +"Accessing the :attr:`!__annotations__` attribute of a class object directly " +"may yield incorrect results in the presence of metaclasses. In addition, the " +"attribute may not exist for some classes. Use :func:`inspect." +"get_annotations` to retrieve class annotations safely." msgstr "" -#: ../../reference/datamodel.rst:992 +#: ../../reference/datamodel.rst:1024 msgid "" -"A dictionary containing :term:`variable annotations ` " -"collected during class body execution. For best practices on working with :" -"attr:`__annotations__`, please see :ref:`annotations-howto`." +"A :class:`tuple` containing the :ref:`type parameters ` of a :" +"ref:`generic class `." +msgstr "" + +#: ../../reference/datamodel.rst:1030 +msgid "" +"A :class:`tuple` containing names of attributes of this class which are " +"assigned through ``self.X`` from any function in its body." msgstr "" -#: ../../reference/datamodel.rst:998 -msgid ":attr:`__type_params__`" -msgstr ":attr:`__type_params__`" +#: ../../reference/datamodel.rst:1036 +msgid "" +"The line number of the first line of the class definition, including " +"decorators. Setting the :attr:`__module__` attribute removes the :attr:`!" +"__firstlineno__` item from the type's dictionary." +msgstr "" -#: ../../reference/datamodel.rst:999 +#: ../../reference/datamodel.rst:1044 msgid "" -"A tuple containing the :ref:`type parameters ` of a :ref:" -"`generic class `." +"The :class:`tuple` of classes that are considered when looking for base " +"classes during method resolution." msgstr "" -#: ../../reference/datamodel.rst:1002 -msgid ":attr:`~class.__static_attributes__`" -msgstr ":attr:`~class.__static_attributes__`" +#: ../../reference/datamodel.rst:1049 +msgid "Special methods" +msgstr "特殊方法" -#: ../../reference/datamodel.rst:1003 +#: ../../reference/datamodel.rst:1051 msgid "" -"A tuple containing names of attributes of this class which are assigned " -"through ``self.X`` from any function in its body." +"In addition to the special attributes described above, all Python classes " +"also have the following two methods available:" msgstr "" -#: ../../reference/datamodel.rst:1006 -msgid ":attr:`__firstlineno__`" -msgstr ":attr:`__firstlineno__`" +#: ../../reference/datamodel.rst:1056 +msgid "" +"This method can be overridden by a metaclass to customize the method " +"resolution order for its instances. It is called at class instantiation, " +"and its result is stored in :attr:`~type.__mro__`." +msgstr "" -#: ../../reference/datamodel.rst:1007 +#: ../../reference/datamodel.rst:1062 msgid "" -"The line number of the first line of the class definition, including " -"decorators." +"Each class keeps a list of weak references to its immediate subclasses. This " +"method returns a list of all those references still alive. The list is in " +"definition order. Example:" +msgstr "" + +#: ../../reference/datamodel.rst:1066 +msgid "" +">>> class A: pass\n" +">>> class B(A): pass\n" +">>> A.__subclasses__()\n" +"[]" msgstr "" -#: ../../reference/datamodel.rst:1011 +#: ../../reference/datamodel.rst:1074 msgid "Class instances" msgstr "" -#: ../../reference/datamodel.rst:1019 +#: ../../reference/datamodel.rst:1082 msgid "" "A class instance is created by calling a class object (see above). A class " "instance has a namespace implemented as a dictionary which is the first " @@ -1246,7 +1279,7 @@ msgid "" "__getattr__` method, that is called to satisfy the lookup." msgstr "" -#: ../../reference/datamodel.rst:1035 +#: ../../reference/datamodel.rst:1098 msgid "" "Attribute assignments and deletions update the instance's dictionary, never " "a class's dictionary. If the class has a :meth:`~object.__setattr__` or :" @@ -1254,23 +1287,28 @@ msgid "" "instance dictionary directly." msgstr "" -#: ../../reference/datamodel.rst:1045 +#: ../../reference/datamodel.rst:1108 msgid "" "Class instances can pretend to be numbers, sequences, or mappings if they " "have methods with certain special names. See section :ref:`specialnames`." msgstr "" -#: ../../reference/datamodel.rst:1052 +#: ../../reference/datamodel.rst:1120 +msgid "The class to which a class instance belongs." +msgstr "" + +#: ../../reference/datamodel.rst:1124 msgid "" -"Special attributes: :attr:`~object.__dict__` is the attribute dictionary; :" -"attr:`~instance.__class__` is the instance's class." +"A dictionary or other mapping object used to store an object's (writable) " +"attributes. Not all instances have a :attr:`!__dict__` attribute; see the " +"section on :ref:`slots` for more details." msgstr "" -#: ../../reference/datamodel.rst:1057 +#: ../../reference/datamodel.rst:1130 msgid "I/O objects (also known as file objects)" msgstr "" -#: ../../reference/datamodel.rst:1072 +#: ../../reference/datamodel.rst:1145 msgid "" "A :term:`file object` represents an open file. Various shortcuts are " "available to create file objects: the :func:`open` built-in function, and " @@ -1279,7 +1317,7 @@ msgid "" "methods provided by extension modules)." msgstr "" -#: ../../reference/datamodel.rst:1078 +#: ../../reference/datamodel.rst:1151 msgid "" "The objects ``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` are initialized " "to file objects corresponding to the interpreter's standard input, output " @@ -1287,22 +1325,22 @@ msgid "" "interface defined by the :class:`io.TextIOBase` abstract class." msgstr "" -#: ../../reference/datamodel.rst:1086 +#: ../../reference/datamodel.rst:1159 msgid "Internal types" msgstr "" -#: ../../reference/datamodel.rst:1092 +#: ../../reference/datamodel.rst:1165 msgid "" "A few types used internally by the interpreter are exposed to the user. " "Their definitions may change with future versions of the interpreter, but " "they are mentioned here for completeness." msgstr "" -#: ../../reference/datamodel.rst:1100 +#: ../../reference/datamodel.rst:1173 msgid "Code objects" msgstr "" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1177 msgid "" "Code objects represent *byte-compiled* executable Python code, or :term:" "`bytecode`. The difference between a code object and a function object is " @@ -1314,103 +1352,103 @@ msgid "" "no references (directly or indirectly) to mutable objects." msgstr "" -#: ../../reference/datamodel.rst:1138 +#: ../../reference/datamodel.rst:1211 msgid "The function name" msgstr "函式名稱" -#: ../../reference/datamodel.rst:1141 +#: ../../reference/datamodel.rst:1214 msgid "The fully qualified function name" msgstr "" -#: ../../reference/datamodel.rst:1146 +#: ../../reference/datamodel.rst:1219 msgid "" "The total number of positional :term:`parameters ` (including " "positional-only parameters and parameters with default values) that the " "function has" msgstr "" -#: ../../reference/datamodel.rst:1151 +#: ../../reference/datamodel.rst:1224 msgid "" "The number of positional-only :term:`parameters ` (including " "arguments with default values) that the function has" msgstr "" -#: ../../reference/datamodel.rst:1155 +#: ../../reference/datamodel.rst:1228 msgid "" "The number of keyword-only :term:`parameters ` (including " "arguments with default values) that the function has" msgstr "" -#: ../../reference/datamodel.rst:1159 +#: ../../reference/datamodel.rst:1232 msgid "" "The number of :ref:`local variables ` used by the function " "(including parameters)" msgstr "" -#: ../../reference/datamodel.rst:1163 +#: ../../reference/datamodel.rst:1236 msgid "" "A :class:`tuple` containing the names of the local variables in the function " "(starting with the parameter names)" msgstr "" -#: ../../reference/datamodel.rst:1167 +#: ../../reference/datamodel.rst:1240 msgid "" "A :class:`tuple` containing the names of :ref:`local variables ` " "that are referenced by nested functions inside the function" msgstr "" -#: ../../reference/datamodel.rst:1171 +#: ../../reference/datamodel.rst:1244 msgid "A :class:`tuple` containing the names of free variables in the function" msgstr "" -#: ../../reference/datamodel.rst:1174 +#: ../../reference/datamodel.rst:1247 msgid "" "A string representing the sequence of :term:`bytecode` instructions in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1178 +#: ../../reference/datamodel.rst:1251 msgid "" "A :class:`tuple` containing the literals used by the :term:`bytecode` in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1182 +#: ../../reference/datamodel.rst:1255 msgid "" "A :class:`tuple` containing the names used by the :term:`bytecode` in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1259 msgid "The name of the file from which the code was compiled" msgstr "" -#: ../../reference/datamodel.rst:1189 +#: ../../reference/datamodel.rst:1262 msgid "The line number of the first line of the function" msgstr "" -#: ../../reference/datamodel.rst:1192 +#: ../../reference/datamodel.rst:1265 msgid "" "A string encoding the mapping from :term:`bytecode` offsets to line numbers. " "For details, see the source code of the interpreter." msgstr "" -#: ../../reference/datamodel.rst:1195 +#: ../../reference/datamodel.rst:1268 msgid "" "This attribute of code objects is deprecated, and may be removed in Python " "3.14." msgstr "" -#: ../../reference/datamodel.rst:1200 +#: ../../reference/datamodel.rst:1273 msgid "The required stack size of the code object" msgstr "" -#: ../../reference/datamodel.rst:1203 +#: ../../reference/datamodel.rst:1276 msgid "" "An :class:`integer ` encoding a number of flags for the interpreter." msgstr "" -#: ../../reference/datamodel.rst:1208 +#: ../../reference/datamodel.rst:1281 msgid "" "The following flag bits are defined for :attr:`~codeobject.co_flags`: bit " "``0x04`` is set if the function uses the ``*arguments`` syntax to accept an " @@ -1421,7 +1459,7 @@ msgid "" "might be present." msgstr "" -#: ../../reference/datamodel.rst:1216 +#: ../../reference/datamodel.rst:1289 msgid "" "Future feature declarations (``from __future__ import division``) also use " "bits in :attr:`~codeobject.co_flags` to indicate whether a code object was " @@ -1430,29 +1468,29 @@ msgid "" "``0x1000`` were used in earlier versions of Python." msgstr "" -#: ../../reference/datamodel.rst:1222 +#: ../../reference/datamodel.rst:1295 msgid "" "Other bits in :attr:`~codeobject.co_flags` are reserved for internal use." msgstr "" -#: ../../reference/datamodel.rst:1226 +#: ../../reference/datamodel.rst:1299 msgid "" "If a code object represents a function, the first item in :attr:`~codeobject." "co_consts` is the documentation string of the function, or ``None`` if " "undefined." msgstr "" -#: ../../reference/datamodel.rst:1231 +#: ../../reference/datamodel.rst:1304 msgid "Methods on code objects" msgstr "用於程式碼物件的方法" -#: ../../reference/datamodel.rst:1235 +#: ../../reference/datamodel.rst:1308 msgid "" "Returns an iterable over the source code positions of each :term:`bytecode` " "instruction in the code object." msgstr "" -#: ../../reference/datamodel.rst:1238 +#: ../../reference/datamodel.rst:1311 msgid "" "The iterator returns :class:`tuple`\\s containing the ``(start_line, " "end_line, start_column, end_column)``. The *i-th* tuple corresponds to the " @@ -1460,37 +1498,37 @@ msgid "" "information is 0-indexed utf-8 byte offsets on the given source line." msgstr "" -#: ../../reference/datamodel.rst:1244 +#: ../../reference/datamodel.rst:1317 msgid "" "This positional information can be missing. A non-exhaustive lists of cases " "where this may happen:" msgstr "" -#: ../../reference/datamodel.rst:1247 +#: ../../reference/datamodel.rst:1320 msgid "Running the interpreter with :option:`-X` ``no_debug_ranges``." msgstr "" -#: ../../reference/datamodel.rst:1248 +#: ../../reference/datamodel.rst:1321 msgid "" "Loading a pyc file compiled while using :option:`-X` ``no_debug_ranges``." msgstr "" -#: ../../reference/datamodel.rst:1249 +#: ../../reference/datamodel.rst:1322 msgid "Position tuples corresponding to artificial instructions." msgstr "" -#: ../../reference/datamodel.rst:1250 +#: ../../reference/datamodel.rst:1323 msgid "" "Line and column numbers that can't be represented due to implementation " "specific limitations." msgstr "" -#: ../../reference/datamodel.rst:1253 +#: ../../reference/datamodel.rst:1326 msgid "" "When this occurs, some or all of the tuple elements can be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:1259 +#: ../../reference/datamodel.rst:1332 msgid "" "This feature requires storing column positions in code objects which may " "result in a small increase of disk usage of compiled Python files or " @@ -1500,100 +1538,100 @@ msgid "" "environment variable can be used." msgstr "" -#: ../../reference/datamodel.rst:1268 +#: ../../reference/datamodel.rst:1341 msgid "" "Returns an iterator that yields information about successive ranges of :term:" "`bytecode`\\s. Each item yielded is a ``(start, end, lineno)`` :class:" "`tuple`:" msgstr "" -#: ../../reference/datamodel.rst:1272 +#: ../../reference/datamodel.rst:1345 msgid "" "``start`` (an :class:`int`) represents the offset (inclusive) of the start " "of the :term:`bytecode` range" msgstr "" -#: ../../reference/datamodel.rst:1274 +#: ../../reference/datamodel.rst:1347 msgid "" "``end`` (an :class:`int`) represents the offset (exclusive) of the end of " "the :term:`bytecode` range" msgstr "" -#: ../../reference/datamodel.rst:1276 +#: ../../reference/datamodel.rst:1349 msgid "" "``lineno`` is an :class:`int` representing the line number of the :term:" "`bytecode` range, or ``None`` if the bytecodes in the given range have no " "line number" msgstr "" -#: ../../reference/datamodel.rst:1280 +#: ../../reference/datamodel.rst:1353 msgid "The items yielded will have the following properties:" msgstr "" -#: ../../reference/datamodel.rst:1282 +#: ../../reference/datamodel.rst:1355 msgid "The first range yielded will have a ``start`` of 0." msgstr "" -#: ../../reference/datamodel.rst:1283 +#: ../../reference/datamodel.rst:1356 msgid "" "The ``(start, end)`` ranges will be non-decreasing and consecutive. That is, " "for any pair of :class:`tuple`\\s, the ``start`` of the second will be equal " "to the ``end`` of the first." msgstr "" -#: ../../reference/datamodel.rst:1286 +#: ../../reference/datamodel.rst:1359 msgid "No range will be backwards: ``end >= start`` for all triples." msgstr "" -#: ../../reference/datamodel.rst:1287 +#: ../../reference/datamodel.rst:1360 msgid "" "The last :class:`tuple` yielded will have ``end`` equal to the size of the :" "term:`bytecode`." msgstr "" -#: ../../reference/datamodel.rst:1290 +#: ../../reference/datamodel.rst:1363 msgid "" "Zero-width ranges, where ``start == end``, are allowed. Zero-width ranges " "are used for lines that are present in the source code, but have been " "eliminated by the :term:`bytecode` compiler." msgstr "" -#: ../../reference/datamodel.rst:1298 +#: ../../reference/datamodel.rst:1371 msgid ":pep:`626` - Precise line numbers for debugging and other tools." msgstr "" -#: ../../reference/datamodel.rst:1299 +#: ../../reference/datamodel.rst:1372 msgid "The PEP that introduced the :meth:`!co_lines` method." msgstr "" -#: ../../reference/datamodel.rst:1303 +#: ../../reference/datamodel.rst:1376 msgid "" "Return a copy of the code object with new values for the specified fields." msgstr "" -#: ../../reference/datamodel.rst:1305 +#: ../../reference/datamodel.rst:1378 msgid "" "Code objects are also supported by the generic function :func:`copy.replace`." msgstr "" -#: ../../reference/datamodel.rst:1313 +#: ../../reference/datamodel.rst:1386 msgid "Frame objects" msgstr "" -#: ../../reference/datamodel.rst:1317 +#: ../../reference/datamodel.rst:1390 msgid "" "Frame objects represent execution frames. They may occur in :ref:`traceback " "objects `, and are also passed to registered trace " "functions." msgstr "" -#: ../../reference/datamodel.rst:1335 +#: ../../reference/datamodel.rst:1408 msgid "" "Points to the previous stack frame (towards the caller), or ``None`` if this " "is the bottom stack frame" msgstr "" -#: ../../reference/datamodel.rst:1339 +#: ../../reference/datamodel.rst:1412 msgid "" "The :ref:`code object ` being executed in this frame. " "Accessing this attribute raises an :ref:`auditing event ` ``object." @@ -1603,55 +1641,55 @@ msgstr "" "這個屬性會引發一個附帶引數 ``obj`` 與 ``\"f_code\"`` 的\\ :ref:`稽核事件 " "` ``object.__getattr__``。" -#: ../../reference/datamodel.rst:1344 +#: ../../reference/datamodel.rst:1417 msgid "" "The mapping used by the frame to look up :ref:`local variables `. If " "the frame refers to an :term:`optimized scope`, this may return a write-" "through proxy object." msgstr "" -#: ../../reference/datamodel.rst:1349 +#: ../../reference/datamodel.rst:1422 msgid "Return a proxy for optimized scopes." msgstr "" -#: ../../reference/datamodel.rst:1353 +#: ../../reference/datamodel.rst:1426 msgid "" "The dictionary used by the frame to look up :ref:`global variables `" msgstr "" -#: ../../reference/datamodel.rst:1357 +#: ../../reference/datamodel.rst:1430 msgid "" "The dictionary used by the frame to look up :ref:`built-in (intrinsic) names " "`" msgstr "" -#: ../../reference/datamodel.rst:1361 +#: ../../reference/datamodel.rst:1434 msgid "" "The \"precise instruction\" of the frame object (this is an index into the :" "term:`bytecode` string of the :ref:`code object `)" msgstr "" -#: ../../reference/datamodel.rst:1377 +#: ../../reference/datamodel.rst:1450 msgid "" "If not ``None``, this is a function called for various events during code " "execution (this is used by debuggers). Normally an event is triggered for " "each new source line (see :attr:`~frame.f_trace_lines`)." msgstr "" -#: ../../reference/datamodel.rst:1382 +#: ../../reference/datamodel.rst:1455 msgid "" "Set this attribute to :const:`False` to disable triggering a tracing event " "for each source line." msgstr "" -#: ../../reference/datamodel.rst:1386 +#: ../../reference/datamodel.rst:1459 msgid "" "Set this attribute to :const:`True` to allow per-opcode events to be " "requested. Note that this may lead to undefined interpreter behaviour if " "exceptions raised by the trace function escape to the function being traced." msgstr "" -#: ../../reference/datamodel.rst:1392 +#: ../../reference/datamodel.rst:1465 msgid "" "The current line number of the frame -- writing to this from within a trace " "function jumps to the given line (only for the bottom-most frame). A " @@ -1659,15 +1697,15 @@ msgid "" "this attribute." msgstr "" -#: ../../reference/datamodel.rst:1398 +#: ../../reference/datamodel.rst:1471 msgid "Frame object methods" msgstr "" -#: ../../reference/datamodel.rst:1400 +#: ../../reference/datamodel.rst:1473 msgid "Frame objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1477 msgid "" "This method clears all references to :ref:`local variables ` held by " "the frame. Also, if the frame belonged to a :term:`generator`, the " @@ -1676,34 +1714,34 @@ msgid "" "and storing its :ref:`traceback ` for later use)." msgstr "" -#: ../../reference/datamodel.rst:1410 +#: ../../reference/datamodel.rst:1483 msgid "" ":exc:`RuntimeError` is raised if the frame is currently executing or " "suspended." msgstr "" -#: ../../reference/datamodel.rst:1415 +#: ../../reference/datamodel.rst:1488 msgid "" "Attempting to clear a suspended frame raises :exc:`RuntimeError` (as has " "always been the case for executing frames)." msgstr "" -#: ../../reference/datamodel.rst:1423 +#: ../../reference/datamodel.rst:1496 msgid "Traceback objects" msgstr "" -#: ../../reference/datamodel.rst:1436 +#: ../../reference/datamodel.rst:1509 msgid "" "Traceback objects represent the stack trace of an :ref:`exception `. A traceback object is implicitly created when an exception occurs, " "and may also be explicitly created by calling :class:`types.TracebackType`." msgstr "" -#: ../../reference/datamodel.rst:1441 +#: ../../reference/datamodel.rst:1514 msgid "Traceback objects can now be explicitly instantiated from Python code." msgstr "" -#: ../../reference/datamodel.rst:1444 +#: ../../reference/datamodel.rst:1517 msgid "" "For implicitly created tracebacks, when the search for an exception handler " "unwinds the execution stack, at each unwound level a traceback object is " @@ -1714,7 +1752,7 @@ msgid "" "the caught exception." msgstr "" -#: ../../reference/datamodel.rst:1453 +#: ../../reference/datamodel.rst:1526 msgid "" "When the program contains no suitable handler, the stack trace is written " "(nicely formatted) to the standard error stream; if the interpreter is " @@ -1722,19 +1760,19 @@ msgid "" "last_traceback`." msgstr "" -#: ../../reference/datamodel.rst:1458 +#: ../../reference/datamodel.rst:1531 msgid "" "For explicitly created tracebacks, it is up to the creator of the traceback " "to determine how the :attr:`~traceback.tb_next` attributes should be linked " "to form a full stack trace." msgstr "" -#: ../../reference/datamodel.rst:1473 +#: ../../reference/datamodel.rst:1546 msgid "" "Points to the execution :ref:`frame ` of the current level." msgstr "" -#: ../../reference/datamodel.rst:1476 +#: ../../reference/datamodel.rst:1549 msgid "" "Accessing this attribute raises an :ref:`auditing event ` ``object." "__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." @@ -1742,15 +1780,15 @@ msgstr "" "存取此屬性會引發一個附帶引數 ``obj`` 與 ``\"tb_frame\"`` 的\\ :ref:`稽核事件 " "` ``object.__getattr__``。" -#: ../../reference/datamodel.rst:1481 +#: ../../reference/datamodel.rst:1554 msgid "Gives the line number where the exception occurred" msgstr "" -#: ../../reference/datamodel.rst:1484 +#: ../../reference/datamodel.rst:1557 msgid "Indicates the \"precise instruction\"." msgstr "" -#: ../../reference/datamodel.rst:1486 +#: ../../reference/datamodel.rst:1559 msgid "" "The line number and last instruction in the traceback may differ from the " "line number of its :ref:`frame object ` if the exception " @@ -1758,39 +1796,39 @@ msgid "" "with a :keyword:`finally` clause." msgstr "" -#: ../../reference/datamodel.rst:1497 +#: ../../reference/datamodel.rst:1570 msgid "" "The special writable attribute :attr:`!tb_next` is the next level in the " "stack trace (towards the frame where the exception occurred), or ``None`` if " "there is no next level." msgstr "" -#: ../../reference/datamodel.rst:1501 +#: ../../reference/datamodel.rst:1574 msgid "This attribute is now writable" msgstr "" -#: ../../reference/datamodel.rst:1506 +#: ../../reference/datamodel.rst:1579 msgid "Slice objects" msgstr "" -#: ../../reference/datamodel.rst:1510 +#: ../../reference/datamodel.rst:1583 msgid "" "Slice objects are used to represent slices for :meth:`~object.__getitem__` " "methods. They are also created by the built-in :func:`slice` function." msgstr "" -#: ../../reference/datamodel.rst:1519 +#: ../../reference/datamodel.rst:1592 msgid "" "Special read-only attributes: :attr:`~slice.start` is the lower bound; :attr:" "`~slice.stop` is the upper bound; :attr:`~slice.step` is the step value; " "each is ``None`` if omitted. These attributes can have any type." msgstr "" -#: ../../reference/datamodel.rst:1523 +#: ../../reference/datamodel.rst:1596 msgid "Slice objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1527 +#: ../../reference/datamodel.rst:1600 msgid "" "This method takes a single integer argument *length* and computes " "information about the slice that the slice object would describe if applied " @@ -1800,11 +1838,11 @@ msgid "" "a manner consistent with regular slices." msgstr "" -#: ../../reference/datamodel.rst:1536 +#: ../../reference/datamodel.rst:1609 msgid "Static method objects" msgstr "" -#: ../../reference/datamodel.rst:1538 +#: ../../reference/datamodel.rst:1611 msgid "" "Static method objects provide a way of defeating the transformation of " "function objects to method objects described above. A static method object " @@ -1815,11 +1853,11 @@ msgid "" "method objects are created by the built-in :func:`staticmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1548 +#: ../../reference/datamodel.rst:1621 msgid "Class method objects" msgstr "" -#: ../../reference/datamodel.rst:1550 +#: ../../reference/datamodel.rst:1623 msgid "" "A class method object, like a static method object, is a wrapper around " "another object that alters the way in which that object is retrieved from " @@ -1829,11 +1867,11 @@ msgid "" "`classmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1560 +#: ../../reference/datamodel.rst:1633 msgid "Special method names" msgstr "" -#: ../../reference/datamodel.rst:1566 +#: ../../reference/datamodel.rst:1639 msgid "" "A class can implement certain operations that are invoked by special syntax " "(such as arithmetic operations or subscripting and slicing) by defining " @@ -1847,7 +1885,7 @@ msgid "" "`TypeError`)." msgstr "" -#: ../../reference/datamodel.rst:1577 +#: ../../reference/datamodel.rst:1650 msgid "" "Setting a special method to ``None`` indicates that the corresponding " "operation is not available. For example, if a class sets :meth:`~object." @@ -1856,7 +1894,7 @@ msgid "" "`~object.__getitem__`). [#]_" msgstr "" -#: ../../reference/datamodel.rst:1583 +#: ../../reference/datamodel.rst:1656 msgid "" "When implementing a class that emulates any built-in type, it is important " "that the emulation only be implemented to the degree that it makes sense for " @@ -1866,11 +1904,11 @@ msgid "" "the W3C's Document Object Model.)" msgstr "" -#: ../../reference/datamodel.rst:1594 +#: ../../reference/datamodel.rst:1667 msgid "Basic customization" msgstr "" -#: ../../reference/datamodel.rst:1600 +#: ../../reference/datamodel.rst:1673 msgid "" "Called to create a new instance of class *cls*. :meth:`__new__` is a static " "method (special-cased so you need not declare it as such) that takes the " @@ -1880,7 +1918,7 @@ msgid "" "new object instance (usually an instance of *cls*)." msgstr "" -#: ../../reference/datamodel.rst:1607 +#: ../../reference/datamodel.rst:1680 msgid "" "Typical implementations create a new instance of the class by invoking the " "superclass's :meth:`__new__` method using ``super().__new__(cls[, ...])`` " @@ -1888,7 +1926,7 @@ msgid "" "necessary before returning it." msgstr "" -#: ../../reference/datamodel.rst:1612 +#: ../../reference/datamodel.rst:1685 msgid "" "If :meth:`__new__` is invoked during object construction and it returns an " "instance of *cls*, then the new instance’s :meth:`__init__` method will be " @@ -1897,13 +1935,13 @@ msgid "" "constructor." msgstr "" -#: ../../reference/datamodel.rst:1617 +#: ../../reference/datamodel.rst:1690 msgid "" "If :meth:`__new__` does not return an instance of *cls*, then the new " "instance's :meth:`__init__` method will not be invoked." msgstr "" -#: ../../reference/datamodel.rst:1620 +#: ../../reference/datamodel.rst:1693 msgid "" ":meth:`__new__` is intended mainly to allow subclasses of immutable types " "(like int, str, or tuple) to customize instance creation. It is also " @@ -1911,7 +1949,7 @@ msgid "" "creation." msgstr "" -#: ../../reference/datamodel.rst:1629 +#: ../../reference/datamodel.rst:1702 msgid "" "Called after the instance has been created (by :meth:`__new__`), but before " "it is returned to the caller. The arguments are those passed to the class " @@ -1921,7 +1959,7 @@ msgid "" "example: ``super().__init__([args...])``." msgstr "" -#: ../../reference/datamodel.rst:1636 +#: ../../reference/datamodel.rst:1709 msgid "" "Because :meth:`__new__` and :meth:`__init__` work together in constructing " "objects (:meth:`__new__` to create it, and :meth:`__init__` to customize " @@ -1929,7 +1967,7 @@ msgid "" "will cause a :exc:`TypeError` to be raised at runtime." msgstr "" -#: ../../reference/datamodel.rst:1649 +#: ../../reference/datamodel.rst:1722 msgid "" "Called when the instance is about to be destroyed. This is also called a " "finalizer or (improperly) a destructor. If a base class has a :meth:" @@ -1938,7 +1976,7 @@ msgid "" "instance." msgstr "" -#: ../../reference/datamodel.rst:1655 +#: ../../reference/datamodel.rst:1728 msgid "" "It is possible (though not recommended!) for the :meth:`__del__` method to " "postpone destruction of the instance by creating a new reference to it. " @@ -1948,7 +1986,7 @@ msgid "" "it once." msgstr "" -#: ../../reference/datamodel.rst:1662 +#: ../../reference/datamodel.rst:1735 msgid "" "It is not guaranteed that :meth:`__del__` methods are called for objects " "that still exist when the interpreter exits. :class:`weakref.finalize` " @@ -1956,14 +1994,14 @@ msgid "" "when an object is garbage collected." msgstr "" -#: ../../reference/datamodel.rst:1669 +#: ../../reference/datamodel.rst:1742 msgid "" "``del x`` doesn't directly call ``x.__del__()`` --- the former decrements " "the reference count for ``x`` by one, and the latter is only called when " "``x``'s reference count reaches zero." msgstr "" -#: ../../reference/datamodel.rst:1674 +#: ../../reference/datamodel.rst:1747 msgid "" "It is possible for a reference cycle to prevent the reference count of an " "object from going to zero. In this case, the cycle will be later detected " @@ -1974,18 +2012,18 @@ msgid "" "caught in the traceback." msgstr "" -#: ../../reference/datamodel.rst:1684 +#: ../../reference/datamodel.rst:1757 msgid "Documentation for the :mod:`gc` module." msgstr "" -#: ../../reference/datamodel.rst:1688 +#: ../../reference/datamodel.rst:1761 msgid "" "Due to the precarious circumstances under which :meth:`__del__` methods are " "invoked, exceptions that occur during their execution are ignored, and a " "warning is printed to ``sys.stderr`` instead. In particular:" msgstr "" -#: ../../reference/datamodel.rst:1692 +#: ../../reference/datamodel.rst:1765 msgid "" ":meth:`__del__` can be invoked when arbitrary code is being executed, " "including from any arbitrary thread. If :meth:`__del__` needs to take a " @@ -1994,7 +2032,7 @@ msgid "" "`__del__`." msgstr "" -#: ../../reference/datamodel.rst:1698 +#: ../../reference/datamodel.rst:1771 msgid "" ":meth:`__del__` can be executed during interpreter shutdown. As a " "consequence, the global variables it needs to access (including other " @@ -2005,7 +2043,7 @@ msgid "" "still available at the time when the :meth:`__del__` method is called." msgstr "" -#: ../../reference/datamodel.rst:1713 +#: ../../reference/datamodel.rst:1786 msgid "" "Called by the :func:`repr` built-in function to compute the \"official\" " "string representation of an object. If at all possible, this should look " @@ -2017,13 +2055,13 @@ msgid "" "an \"informal\" string representation of instances of that class is required." msgstr "" -#: ../../reference/datamodel.rst:1722 +#: ../../reference/datamodel.rst:1795 msgid "" "This is typically used for debugging, so it is important that the " "representation is information-rich and unambiguous." msgstr "" -#: ../../reference/datamodel.rst:1733 +#: ../../reference/datamodel.rst:1806 msgid "" "Called by :func:`str(object) ` and the built-in functions :func:" "`format` and :func:`print` to compute the \"informal\" or nicely printable " @@ -2031,26 +2069,26 @@ msgid "" "` object." msgstr "" -#: ../../reference/datamodel.rst:1738 +#: ../../reference/datamodel.rst:1811 msgid "" "This method differs from :meth:`object.__repr__` in that there is no " "expectation that :meth:`__str__` return a valid Python expression: a more " "convenient or concise representation can be used." msgstr "" -#: ../../reference/datamodel.rst:1742 +#: ../../reference/datamodel.rst:1815 msgid "" "The default implementation defined by the built-in type :class:`object` " "calls :meth:`object.__repr__`." msgstr "" -#: ../../reference/datamodel.rst:1752 +#: ../../reference/datamodel.rst:1825 msgid "" "Called by :ref:`bytes ` to compute a byte-string representation " "of an object. This should return a :class:`bytes` object." msgstr "" -#: ../../reference/datamodel.rst:1763 +#: ../../reference/datamodel.rst:1836 msgid "" "Called by the :func:`format` built-in function, and by extension, evaluation " "of :ref:`formatted string literals ` and the :meth:`str.format` " @@ -2062,28 +2100,28 @@ msgid "" "formatting option syntax." msgstr "" -#: ../../reference/datamodel.rst:1773 +#: ../../reference/datamodel.rst:1846 msgid "" "See :ref:`formatspec` for a description of the standard formatting syntax." msgstr "" -#: ../../reference/datamodel.rst:1775 +#: ../../reference/datamodel.rst:1848 msgid "The return value must be a string object." msgstr "" -#: ../../reference/datamodel.rst:1777 +#: ../../reference/datamodel.rst:1850 msgid "" "The __format__ method of ``object`` itself raises a :exc:`TypeError` if " "passed any non-empty string." msgstr "" -#: ../../reference/datamodel.rst:1781 +#: ../../reference/datamodel.rst:1854 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " "``format(str(x), '')``." msgstr "" -#: ../../reference/datamodel.rst:1797 +#: ../../reference/datamodel.rst:1870 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " "between operator symbols and method names is as follows: ``x.__hash__``." msgstr "" -#: ../../reference/datamodel.rst:1889 +#: ../../reference/datamodel.rst:1962 msgid "" "If a class that does not override :meth:`__eq__` wishes to suppress hash " "support, it should include ``__hash__ = None`` in the class definition. A " @@ -2217,7 +2255,7 @@ msgid "" "``isinstance(obj, collections.abc.Hashable)`` call." msgstr "" -#: ../../reference/datamodel.rst:1898 +#: ../../reference/datamodel.rst:1971 msgid "" "By default, the :meth:`__hash__` values of str and bytes objects are " "\"salted\" with an unpredictable random value. Although they remain " @@ -2225,7 +2263,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: ../../reference/datamodel.rst:1903 +#: ../../reference/datamodel.rst:1976 msgid "" "This is intended to provide protection against a denial-of-service caused by " "carefully chosen inputs that exploit the worst case performance of a dict " @@ -2233,22 +2271,22 @@ msgid "" "advisories/ocert-2011-003.html for details." msgstr "" -#: ../../reference/datamodel.rst:1908 +#: ../../reference/datamodel.rst:1981 msgid "" "Changing hash values affects the iteration order of sets. Python has never " "made guarantees about this ordering (and it typically varies between 32-bit " "and 64-bit builds)." msgstr "" -#: ../../reference/datamodel.rst:1912 +#: ../../reference/datamodel.rst:1985 msgid "See also :envvar:`PYTHONHASHSEED`." msgstr "另請參閱 :envvar:`PYTHONHASHSEED`。" -#: ../../reference/datamodel.rst:1914 +#: ../../reference/datamodel.rst:1987 msgid "Hash randomization is enabled by default." msgstr "" -#: ../../reference/datamodel.rst:1922 +#: ../../reference/datamodel.rst:1995 msgid "" "Called to implement truth value testing and the built-in operation " "``bool()``; should return ``False`` or ``True``. When this method is not " @@ -2257,18 +2295,18 @@ msgid "" "meth:`!__len__` nor :meth:`!__bool__`, all its instances are considered true." msgstr "" -#: ../../reference/datamodel.rst:1933 +#: ../../reference/datamodel.rst:2006 msgid "Customizing attribute access" msgstr "" -#: ../../reference/datamodel.rst:1935 +#: ../../reference/datamodel.rst:2008 msgid "" "The following methods can be defined to customize the meaning of attribute " "access (use of, assignment to, or deletion of ``x.name``) for class " "instances." msgstr "" -#: ../../reference/datamodel.rst:1943 +#: ../../reference/datamodel.rst:2016 msgid "" "Called when the default attribute access fails with an :exc:`AttributeError` " "(either :meth:`__getattribute__` raises an :exc:`AttributeError` because " @@ -2278,7 +2316,7 @@ msgid "" "attribute value or raise an :exc:`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:1950 +#: ../../reference/datamodel.rst:2023 msgid "" "Note that if the attribute is found through the normal mechanism, :meth:" "`__getattr__` is not called. (This is an intentional asymmetry between :" @@ -2291,7 +2329,7 @@ msgid "" "actually get total control over attribute access." msgstr "" -#: ../../reference/datamodel.rst:1963 +#: ../../reference/datamodel.rst:2036 msgid "" "Called unconditionally to implement attribute accesses for instances of the " "class. If the class also defines :meth:`__getattr__`, the latter will not be " @@ -2303,64 +2341,64 @@ msgid "" "example, ``object.__getattribute__(self, name)``." msgstr "" -#: ../../reference/datamodel.rst:1974 +#: ../../reference/datamodel.rst:2047 msgid "" "This method may still be bypassed when looking up special methods as the " "result of implicit invocation via language syntax or :ref:`built-in " "functions `. See :ref:`special-lookup`." msgstr "" -#: ../../reference/datamodel.rst:1979 ../../reference/datamodel.rst:1981 +#: ../../reference/datamodel.rst:2052 ../../reference/datamodel.rst:2054 msgid "" "For certain sensitive attribute accesses, raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:1988 +#: ../../reference/datamodel.rst:2061 msgid "" "Called when an attribute assignment is attempted. This is called instead of " "the normal mechanism (i.e. store the value in the instance dictionary). " "*name* is the attribute name, *value* is the value to be assigned to it." msgstr "" -#: ../../reference/datamodel.rst:1992 +#: ../../reference/datamodel.rst:2065 msgid "" "If :meth:`__setattr__` wants to assign to an instance attribute, it should " "call the base class method with the same name, for example, ``object." "__setattr__(self, name, value)``." msgstr "" -#: ../../reference/datamodel.rst:1996 ../../reference/datamodel.rst:1998 +#: ../../reference/datamodel.rst:2069 ../../reference/datamodel.rst:2071 msgid "" "For certain sensitive attribute assignments, raises an :ref:`auditing event " "` ``object.__setattr__`` with arguments ``obj``, ``name``, " "``value``." msgstr "" -#: ../../reference/datamodel.rst:2005 +#: ../../reference/datamodel.rst:2078 msgid "" "Like :meth:`__setattr__` but for attribute deletion instead of assignment. " "This should only be implemented if ``del obj.name`` is meaningful for the " "object." msgstr "" -#: ../../reference/datamodel.rst:2008 ../../reference/datamodel.rst:2010 +#: ../../reference/datamodel.rst:2081 ../../reference/datamodel.rst:2083 msgid "" "For certain sensitive attribute deletions, raises an :ref:`auditing event " "` ``object.__delattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:2017 +#: ../../reference/datamodel.rst:2090 msgid "" "Called when :func:`dir` is called on the object. An iterable must be " "returned. :func:`dir` converts the returned iterable to a list and sorts it." msgstr "" -#: ../../reference/datamodel.rst:2022 +#: ../../reference/datamodel.rst:2095 msgid "Customizing module attribute access" msgstr "" -#: ../../reference/datamodel.rst:2029 +#: ../../reference/datamodel.rst:2102 msgid "" "Special names ``__getattr__`` and ``__dir__`` can be also used to customize " "access to module attributes. The ``__getattr__`` function at the module " @@ -2372,21 +2410,21 @@ msgid "" "with the attribute name and the result is returned." msgstr "" -#: ../../reference/datamodel.rst:2038 +#: ../../reference/datamodel.rst:2111 msgid "" "The ``__dir__`` function should accept no arguments, and return an iterable " "of strings that represents the names accessible on module. If present, this " "function overrides the standard :func:`dir` search on a module." msgstr "" -#: ../../reference/datamodel.rst:2042 +#: ../../reference/datamodel.rst:2115 msgid "" "For a more fine grained customization of the module behavior (setting " "attributes, properties, etc.), one can set the ``__class__`` attribute of a " "module object to a subclass of :class:`types.ModuleType`. For example::" msgstr "" -#: ../../reference/datamodel.rst:2046 +#: ../../reference/datamodel.rst:2119 msgid "" "import sys\n" "from types import ModuleType\n" @@ -2414,7 +2452,7 @@ msgstr "" "\n" "sys.modules[__name__].__class__ = VerboseModule" -#: ../../reference/datamodel.rst:2060 +#: ../../reference/datamodel.rst:2133 msgid "" "Defining module ``__getattr__`` and setting module ``__class__`` only affect " "lookups made using the attribute access syntax -- directly accessing the " @@ -2422,27 +2460,27 @@ msgid "" "module's globals dictionary) is unaffected." msgstr "" -#: ../../reference/datamodel.rst:2065 +#: ../../reference/datamodel.rst:2138 msgid "``__class__`` module attribute is now writable." msgstr "" -#: ../../reference/datamodel.rst:2068 +#: ../../reference/datamodel.rst:2141 msgid "``__getattr__`` and ``__dir__`` module attributes." msgstr "" -#: ../../reference/datamodel.rst:2073 +#: ../../reference/datamodel.rst:2146 msgid ":pep:`562` - Module __getattr__ and __dir__" msgstr ":pep:`562` - 模組 __getattr__ 和 __dir__" -#: ../../reference/datamodel.rst:2074 +#: ../../reference/datamodel.rst:2147 msgid "Describes the ``__getattr__`` and ``__dir__`` functions on modules." msgstr "" -#: ../../reference/datamodel.rst:2080 +#: ../../reference/datamodel.rst:2153 msgid "Implementing Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2082 +#: ../../reference/datamodel.rst:2155 msgid "" "The following methods only apply when an instance of the class containing " "the method (a so-called *descriptor* class) appears in an *owner* class (the " @@ -2452,7 +2490,7 @@ msgid "" "the owner class' :attr:`~object.__dict__`." msgstr "" -#: ../../reference/datamodel.rst:2092 +#: ../../reference/datamodel.rst:2165 msgid "" "Called to get the attribute of the owner class (class attribute access) or " "of an instance of that class (instance attribute access). The optional " @@ -2461,13 +2499,13 @@ msgid "" "accessed through the *owner*." msgstr "" -#: ../../reference/datamodel.rst:2098 +#: ../../reference/datamodel.rst:2171 msgid "" "This method should return the computed attribute value or raise an :exc:" "`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:2101 +#: ../../reference/datamodel.rst:2174 msgid "" ":PEP:`252` specifies that :meth:`__get__` is callable with one or two " "arguments. Python's own built-in descriptors support this specification; " @@ -2477,31 +2515,31 @@ msgid "" "not." msgstr "" -#: ../../reference/datamodel.rst:2110 +#: ../../reference/datamodel.rst:2183 msgid "" "Called to set the attribute on an instance *instance* of the owner class to " "a new value, *value*." msgstr "" -#: ../../reference/datamodel.rst:2113 +#: ../../reference/datamodel.rst:2186 msgid "" "Note, adding :meth:`__set__` or :meth:`__delete__` changes the kind of " "descriptor to a \"data descriptor\". See :ref:`descriptor-invocation` for " "more details." msgstr "" -#: ../../reference/datamodel.rst:2119 +#: ../../reference/datamodel.rst:2192 msgid "" "Called to delete the attribute on an instance *instance* of the owner class." msgstr "" -#: ../../reference/datamodel.rst:2121 +#: ../../reference/datamodel.rst:2194 msgid "" "Instances of descriptors may also have the :attr:`!__objclass__` attribute " "present:" msgstr "" -#: ../../reference/datamodel.rst:2126 +#: ../../reference/datamodel.rst:2199 msgid "" "The attribute :attr:`!__objclass__` is interpreted by the :mod:`inspect` " "module as specifying the class where this object was defined (setting this " @@ -2512,11 +2550,11 @@ msgid "" "are implemented in C)." msgstr "" -#: ../../reference/datamodel.rst:2137 +#: ../../reference/datamodel.rst:2210 msgid "Invoking Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2139 +#: ../../reference/datamodel.rst:2212 msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " @@ -2525,7 +2563,7 @@ msgid "" "is said to be a descriptor." msgstr "" -#: ../../reference/datamodel.rst:2145 +#: ../../reference/datamodel.rst:2218 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " @@ -2533,7 +2571,7 @@ msgid "" "continuing through the base classes of ``type(a)`` excluding metaclasses." msgstr "" -#: ../../reference/datamodel.rst:2150 +#: ../../reference/datamodel.rst:2223 msgid "" "However, if the looked-up value is an object defining one of the descriptor " "methods, then Python may override the default behavior and invoke the " @@ -2541,54 +2579,54 @@ msgid "" "depends on which descriptor methods were defined and how they were called." msgstr "" -#: ../../reference/datamodel.rst:2155 +#: ../../reference/datamodel.rst:2228 msgid "" "The starting point for descriptor invocation is a binding, ``a.x``. How the " "arguments are assembled depends on ``a``:" msgstr "" -#: ../../reference/datamodel.rst:2158 +#: ../../reference/datamodel.rst:2231 msgid "Direct Call" msgstr "" -#: ../../reference/datamodel.rst:2159 +#: ../../reference/datamodel.rst:2232 msgid "" "The simplest and least common call is when user code directly invokes a " "descriptor method: ``x.__get__(a)``." msgstr "" -#: ../../reference/datamodel.rst:2162 +#: ../../reference/datamodel.rst:2235 msgid "Instance Binding" msgstr "" -#: ../../reference/datamodel.rst:2163 +#: ../../reference/datamodel.rst:2236 msgid "" "If binding to an object instance, ``a.x`` is transformed into the call: " "``type(a).__dict__['x'].__get__(a, type(a))``." msgstr "" -#: ../../reference/datamodel.rst:2166 +#: ../../reference/datamodel.rst:2239 msgid "Class Binding" msgstr "" -#: ../../reference/datamodel.rst:2167 +#: ../../reference/datamodel.rst:2240 msgid "" "If binding to a class, ``A.x`` is transformed into the call: ``A." "__dict__['x'].__get__(None, A)``." msgstr "" -#: ../../reference/datamodel.rst:2170 +#: ../../reference/datamodel.rst:2243 msgid "Super Binding" msgstr "" -#: ../../reference/datamodel.rst:2171 +#: ../../reference/datamodel.rst:2244 msgid "" "A dotted lookup such as ``super(A, a).x`` searches ``a.__class__.__mro__`` " "for a base class ``B`` following ``A`` and then returns ``B.__dict__['x']." "__get__(a, A)``. If not a descriptor, ``x`` is returned unchanged." msgstr "" -#: ../../reference/datamodel.rst:2208 +#: ../../reference/datamodel.rst:2281 msgid "" "For instance bindings, the precedence of descriptor invocation depends on " "which descriptor methods are defined. A descriptor can define any " @@ -2606,7 +2644,7 @@ msgid "" "instances." msgstr "" -#: ../../reference/datamodel.rst:2223 +#: ../../reference/datamodel.rst:2296 msgid "" "Python methods (including those decorated with :func:`@staticmethod " "` and :func:`@classmethod `) are implemented as " @@ -2615,30 +2653,30 @@ msgid "" "from other instances of the same class." msgstr "" -#: ../../reference/datamodel.rst:2229 +#: ../../reference/datamodel.rst:2302 msgid "" "The :func:`property` function is implemented as a data descriptor. " "Accordingly, instances cannot override the behavior of a property." msgstr "" -#: ../../reference/datamodel.rst:2236 +#: ../../reference/datamodel.rst:2309 msgid "__slots__" msgstr "__slots__" -#: ../../reference/datamodel.rst:2238 +#: ../../reference/datamodel.rst:2311 msgid "" "*__slots__* allow us to explicitly declare data members (like properties) " "and deny the creation of :attr:`~object.__dict__` and *__weakref__* (unless " "explicitly declared in *__slots__* or available in a parent.)" msgstr "" -#: ../../reference/datamodel.rst:2242 +#: ../../reference/datamodel.rst:2315 msgid "" "The space saved over using :attr:`~object.__dict__` can be significant. " "Attribute lookup speed can be significantly improved as well." msgstr "" -#: ../../reference/datamodel.rst:2247 +#: ../../reference/datamodel.rst:2320 msgid "" "This class variable can be assigned a string, iterable, or sequence of " "strings with variable names used by instances. *__slots__* reserves space " @@ -2646,18 +2684,18 @@ msgid "" "`~object.__dict__` and *__weakref__* for each instance." msgstr "" -#: ../../reference/datamodel.rst:2256 +#: ../../reference/datamodel.rst:2329 msgid "Notes on using *__slots__*:" msgstr "" -#: ../../reference/datamodel.rst:2258 +#: ../../reference/datamodel.rst:2331 msgid "" "When inheriting from a class without *__slots__*, the :attr:`~object." "__dict__` and *__weakref__* attribute of the instances will always be " "accessible." msgstr "" -#: ../../reference/datamodel.rst:2262 +#: ../../reference/datamodel.rst:2335 msgid "" "Without a :attr:`~object.__dict__` variable, instances cannot be assigned " "new variables not listed in the *__slots__* definition. Attempts to assign " @@ -2666,7 +2704,7 @@ msgid "" "sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2269 +#: ../../reference/datamodel.rst:2342 msgid "" "Without a *__weakref__* variable for each instance, classes defining " "*__slots__* do not support :mod:`weak references ` to its " @@ -2674,7 +2712,7 @@ msgid "" "to the sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2275 +#: ../../reference/datamodel.rst:2348 msgid "" "*__slots__* are implemented at the class level by creating :ref:`descriptors " "` for each variable name. As a result, class attributes cannot " @@ -2682,16 +2720,16 @@ msgid "" "otherwise, the class attribute would overwrite the descriptor assignment." msgstr "" -#: ../../reference/datamodel.rst:2281 +#: ../../reference/datamodel.rst:2354 msgid "" "The action of a *__slots__* declaration is not limited to the class where it " "is defined. *__slots__* declared in parents are available in child classes. " -"However, child subclasses will get a :attr:`~object.__dict__` and " -"*__weakref__* unless they also define *__slots__* (which should only contain " -"names of any *additional* slots)." +"However, instances of a child subclass will get a :attr:`~object.__dict__` " +"and *__weakref__* unless the subclass also defines *__slots__* (which should " +"only contain names of any *additional* slots)." msgstr "" -#: ../../reference/datamodel.rst:2287 +#: ../../reference/datamodel.rst:2360 msgid "" "If a class defines a slot also defined in a base class, the instance " "variable defined by the base class slot is inaccessible (except by " @@ -2700,7 +2738,7 @@ msgid "" "prevent this." msgstr "" -#: ../../reference/datamodel.rst:2292 +#: ../../reference/datamodel.rst:2365 msgid "" ":exc:`TypeError` will be raised if nonempty *__slots__* are defined for a " "class derived from a :c:member:`\"variable-length\" built-in type " @@ -2708,11 +2746,11 @@ msgid "" "`tuple`." msgstr "" -#: ../../reference/datamodel.rst:2297 +#: ../../reference/datamodel.rst:2370 msgid "Any non-string :term:`iterable` may be assigned to *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2299 +#: ../../reference/datamodel.rst:2372 msgid "" "If a :class:`dictionary ` is used to assign *__slots__*, the " "dictionary keys will be used as the slot names. The values of the dictionary " @@ -2720,13 +2758,13 @@ msgid "" "func:`inspect.getdoc` and displayed in the output of :func:`help`." msgstr "" -#: ../../reference/datamodel.rst:2304 +#: ../../reference/datamodel.rst:2377 msgid "" -":attr:`~instance.__class__` assignment works only if both classes have the " +":attr:`~object.__class__` assignment works only if both classes have the " "same *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2307 +#: ../../reference/datamodel.rst:2380 msgid "" ":ref:`Multiple inheritance ` with multiple slotted parent " "classes can be used, but only one parent is allowed to have attributes " @@ -2734,18 +2772,18 @@ msgid "" "raise :exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:2313 +#: ../../reference/datamodel.rst:2386 msgid "" "If an :term:`iterator` is used for *__slots__* then a :term:`descriptor` is " "created for each of the iterator's values. However, the *__slots__* " "attribute will be an empty iterator." msgstr "" -#: ../../reference/datamodel.rst:2321 +#: ../../reference/datamodel.rst:2394 msgid "Customizing class creation" msgstr "" -#: ../../reference/datamodel.rst:2323 +#: ../../reference/datamodel.rst:2396 msgid "" "Whenever a class inherits from another class, :meth:`~object." "__init_subclass__` is called on the parent class. This way, it is possible " @@ -2755,14 +2793,14 @@ msgid "" "future subclasses of the class defining the method." msgstr "" -#: ../../reference/datamodel.rst:2332 +#: ../../reference/datamodel.rst:2405 msgid "" "This method is called whenever the containing class is subclassed. *cls* is " "then the new subclass. If defined as a normal instance method, this method " "is implicitly converted to a class method." msgstr "" -#: ../../reference/datamodel.rst:2336 +#: ../../reference/datamodel.rst:2409 msgid "" "Keyword arguments which are given to a new class are passed to the parent " "class's ``__init_subclass__``. For compatibility with other classes using " @@ -2770,7 +2808,7 @@ msgid "" "pass the others over to the base class, as in::" msgstr "" -#: ../../reference/datamodel.rst:2342 +#: ../../reference/datamodel.rst:2415 msgid "" "class Philosopher:\n" " def __init_subclass__(cls, /, default_name, **kwargs):\n" @@ -2788,13 +2826,13 @@ msgstr "" "class AustralianPhilosopher(Philosopher, default_name=\"Bruce\"):\n" " pass" -#: ../../reference/datamodel.rst:2350 +#: ../../reference/datamodel.rst:2423 msgid "" "The default implementation ``object.__init_subclass__`` does nothing, but " "raises an error if it is called with any arguments." msgstr "" -#: ../../reference/datamodel.rst:2355 +#: ../../reference/datamodel.rst:2428 msgid "" "The metaclass hint ``metaclass`` is consumed by the rest of the type " "machinery, and is never passed to ``__init_subclass__`` implementations. The " @@ -2802,19 +2840,19 @@ msgid "" "``type(cls)``." msgstr "" -#: ../../reference/datamodel.rst:2363 +#: ../../reference/datamodel.rst:2436 msgid "" "When a class is created, :meth:`type.__new__` scans the class variables and " "makes callbacks to those with a :meth:`~object.__set_name__` hook." msgstr "" -#: ../../reference/datamodel.rst:2368 +#: ../../reference/datamodel.rst:2441 msgid "" "Automatically called at the time the owning class *owner* is created. The " "object has been assigned to *name* in that class::" msgstr "" -#: ../../reference/datamodel.rst:2371 +#: ../../reference/datamodel.rst:2444 msgid "" "class A:\n" " x = C() # Automatically calls: x.__set_name__(A, 'x')" @@ -2822,14 +2860,14 @@ msgstr "" "class A:\n" " x = C() # 自動呼叫:x.__set_name__(A, 'x')" -#: ../../reference/datamodel.rst:2374 +#: ../../reference/datamodel.rst:2447 msgid "" "If the class variable is assigned after the class is created, :meth:" "`__set_name__` will not be called automatically. If needed, :meth:" "`__set_name__` can be called directly::" msgstr "" -#: ../../reference/datamodel.rst:2378 +#: ../../reference/datamodel.rst:2451 msgid "" "class A:\n" " pass\n" @@ -2839,22 +2877,22 @@ msgid "" "c.__set_name__(A, 'x') # Manually invoke the hook" msgstr "" -#: ../../reference/datamodel.rst:2385 +#: ../../reference/datamodel.rst:2458 msgid "See :ref:`class-object-creation` for more details." msgstr "更多細節請見 :ref:`class-object-creation`。" -#: ../../reference/datamodel.rst:2393 +#: ../../reference/datamodel.rst:2466 msgid "Metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2400 +#: ../../reference/datamodel.rst:2473 msgid "" "By default, classes are constructed using :func:`type`. The class body is " "executed in a new namespace and the class name is bound locally to the " "result of ``type(name, bases, namespace)``." msgstr "" -#: ../../reference/datamodel.rst:2404 +#: ../../reference/datamodel.rst:2477 msgid "" "The class creation process can be customized by passing the ``metaclass`` " "keyword argument in the class definition line, or by inheriting from an " @@ -2862,7 +2900,7 @@ msgid "" "both ``MyClass`` and ``MySubclass`` are instances of ``Meta``::" msgstr "" -#: ../../reference/datamodel.rst:2409 +#: ../../reference/datamodel.rst:2482 msgid "" "class Meta(type):\n" " pass\n" @@ -2882,41 +2920,41 @@ msgstr "" "class MySubclass(MyClass):\n" " pass" -#: ../../reference/datamodel.rst:2418 +#: ../../reference/datamodel.rst:2491 msgid "" "Any other keyword arguments that are specified in the class definition are " "passed through to all metaclass operations described below." msgstr "" -#: ../../reference/datamodel.rst:2421 +#: ../../reference/datamodel.rst:2494 msgid "When a class definition is executed, the following steps occur:" msgstr "" -#: ../../reference/datamodel.rst:2423 +#: ../../reference/datamodel.rst:2496 msgid "MRO entries are resolved;" msgstr "" -#: ../../reference/datamodel.rst:2424 +#: ../../reference/datamodel.rst:2497 msgid "the appropriate metaclass is determined;" msgstr "" -#: ../../reference/datamodel.rst:2425 +#: ../../reference/datamodel.rst:2498 msgid "the class namespace is prepared;" msgstr "" -#: ../../reference/datamodel.rst:2426 +#: ../../reference/datamodel.rst:2499 msgid "the class body is executed;" msgstr "" -#: ../../reference/datamodel.rst:2427 +#: ../../reference/datamodel.rst:2500 msgid "the class object is created." msgstr "" -#: ../../reference/datamodel.rst:2431 +#: ../../reference/datamodel.rst:2504 msgid "Resolving MRO entries" msgstr "" -#: ../../reference/datamodel.rst:2435 +#: ../../reference/datamodel.rst:2508 msgid "" "If a base that appears in a class definition is not an instance of :class:" "`type`, then an :meth:`!__mro_entries__` method is searched on the base. If " @@ -2928,59 +2966,59 @@ msgid "" "is ignored." msgstr "" -#: ../../reference/datamodel.rst:2446 +#: ../../reference/datamodel.rst:2519 msgid ":func:`types.resolve_bases`" msgstr ":func:`types.resolve_bases`" -#: ../../reference/datamodel.rst:2447 +#: ../../reference/datamodel.rst:2520 msgid "Dynamically resolve bases that are not instances of :class:`type`." msgstr "" -#: ../../reference/datamodel.rst:2449 +#: ../../reference/datamodel.rst:2522 msgid ":func:`types.get_original_bases`" msgstr ":func:`types.get_original_bases`" -#: ../../reference/datamodel.rst:2450 +#: ../../reference/datamodel.rst:2523 msgid "" "Retrieve a class's \"original bases\" prior to modifications by :meth:" "`~object.__mro_entries__`." msgstr "" -#: ../../reference/datamodel.rst:2453 +#: ../../reference/datamodel.rst:2526 msgid ":pep:`560`" msgstr ":pep:`560`" -#: ../../reference/datamodel.rst:2454 +#: ../../reference/datamodel.rst:2527 msgid "Core support for typing module and generic types." msgstr "" -#: ../../reference/datamodel.rst:2458 +#: ../../reference/datamodel.rst:2531 msgid "Determining the appropriate metaclass" msgstr "" -#: ../../reference/datamodel.rst:2462 +#: ../../reference/datamodel.rst:2535 msgid "" "The appropriate metaclass for a class definition is determined as follows:" msgstr "" -#: ../../reference/datamodel.rst:2464 +#: ../../reference/datamodel.rst:2537 msgid "" "if no bases and no explicit metaclass are given, then :func:`type` is used;" msgstr "" -#: ../../reference/datamodel.rst:2465 +#: ../../reference/datamodel.rst:2538 msgid "" "if an explicit metaclass is given and it is *not* an instance of :func:" "`type`, then it is used directly as the metaclass;" msgstr "" -#: ../../reference/datamodel.rst:2467 +#: ../../reference/datamodel.rst:2540 msgid "" "if an instance of :func:`type` is given as the explicit metaclass, or bases " "are defined, then the most derived metaclass is used." msgstr "" -#: ../../reference/datamodel.rst:2470 +#: ../../reference/datamodel.rst:2543 msgid "" "The most derived metaclass is selected from the explicitly specified " "metaclass (if any) and the metaclasses (i.e. ``type(cls)``) of all specified " @@ -2989,11 +3027,11 @@ msgid "" "that criterion, then the class definition will fail with ``TypeError``." msgstr "" -#: ../../reference/datamodel.rst:2480 +#: ../../reference/datamodel.rst:2553 msgid "Preparing the class namespace" msgstr "" -#: ../../reference/datamodel.rst:2485 +#: ../../reference/datamodel.rst:2558 msgid "" "Once the appropriate metaclass has been identified, then the class namespace " "is prepared. If the metaclass has a ``__prepare__`` attribute, it is called " @@ -3005,25 +3043,25 @@ msgid "" "copied into a new ``dict``." msgstr "" -#: ../../reference/datamodel.rst:2494 +#: ../../reference/datamodel.rst:2567 msgid "" "If the metaclass has no ``__prepare__`` attribute, then the class namespace " "is initialised as an empty ordered mapping." msgstr "" -#: ../../reference/datamodel.rst:2499 +#: ../../reference/datamodel.rst:2572 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/datamodel.rst:2500 +#: ../../reference/datamodel.rst:2573 msgid "Introduced the ``__prepare__`` namespace hook" msgstr "" -#: ../../reference/datamodel.rst:2504 +#: ../../reference/datamodel.rst:2577 msgid "Executing the class body" msgstr "" -#: ../../reference/datamodel.rst:2509 +#: ../../reference/datamodel.rst:2582 msgid "" "The class body is executed (approximately) as ``exec(body, globals(), " "namespace)``. The key difference from a normal call to :func:`exec` is that " @@ -3032,7 +3070,7 @@ msgid "" "inside a function." msgstr "" -#: ../../reference/datamodel.rst:2515 +#: ../../reference/datamodel.rst:2588 msgid "" "However, even when the class definition occurs inside the function, methods " "defined inside the class still cannot see names defined at the class scope. " @@ -3041,11 +3079,11 @@ msgid "" "reference described in the next section." msgstr "" -#: ../../reference/datamodel.rst:2524 +#: ../../reference/datamodel.rst:2597 msgid "Creating the class object" msgstr "" -#: ../../reference/datamodel.rst:2531 +#: ../../reference/datamodel.rst:2604 msgid "" "Once the class namespace has been populated by executing the class body, the " "class object is created by calling ``metaclass(name, bases, namespace, " @@ -3053,7 +3091,7 @@ msgid "" "to ``__prepare__``)." msgstr "" -#: ../../reference/datamodel.rst:2536 +#: ../../reference/datamodel.rst:2609 msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " @@ -3064,7 +3102,7 @@ msgid "" "is identified based on the first argument passed to the method." msgstr "" -#: ../../reference/datamodel.rst:2546 +#: ../../reference/datamodel.rst:2619 msgid "" "In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass " "as a ``__classcell__`` entry in the class namespace. If present, this must " @@ -3073,59 +3111,59 @@ msgid "" "in Python 3.8." msgstr "" -#: ../../reference/datamodel.rst:2552 +#: ../../reference/datamodel.rst:2625 msgid "" "When using the default metaclass :class:`type`, or any metaclass that " "ultimately calls ``type.__new__``, the following additional customization " "steps are invoked after creating the class object:" msgstr "" -#: ../../reference/datamodel.rst:2556 +#: ../../reference/datamodel.rst:2629 msgid "" "The ``type.__new__`` method collects all of the attributes in the class " "namespace that define a :meth:`~object.__set_name__` method;" msgstr "" -#: ../../reference/datamodel.rst:2558 +#: ../../reference/datamodel.rst:2631 msgid "" "Those ``__set_name__`` methods are called with the class being defined and " "the assigned name of that particular attribute;" msgstr "" -#: ../../reference/datamodel.rst:2560 +#: ../../reference/datamodel.rst:2633 msgid "" "The :meth:`~object.__init_subclass__` hook is called on the immediate parent " "of the new class in its method resolution order." msgstr "" -#: ../../reference/datamodel.rst:2563 +#: ../../reference/datamodel.rst:2636 msgid "" "After the class object is created, it is passed to the class decorators " "included in the class definition (if any) and the resulting object is bound " "in the local namespace as the defined class." msgstr "" -#: ../../reference/datamodel.rst:2567 +#: ../../reference/datamodel.rst:2640 msgid "" "When a new class is created by ``type.__new__``, the object provided as the " "namespace parameter is copied to a new ordered mapping and the original " "object is discarded. The new copy is wrapped in a read-only proxy, which " -"becomes the :attr:`~object.__dict__` attribute of the class object." +"becomes the :attr:`~type.__dict__` attribute of the class object." msgstr "" -#: ../../reference/datamodel.rst:2574 +#: ../../reference/datamodel.rst:2647 msgid ":pep:`3135` - New super" msgstr "" -#: ../../reference/datamodel.rst:2575 +#: ../../reference/datamodel.rst:2648 msgid "Describes the implicit ``__class__`` closure reference" msgstr "" -#: ../../reference/datamodel.rst:2579 +#: ../../reference/datamodel.rst:2652 msgid "Uses for metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2581 +#: ../../reference/datamodel.rst:2654 msgid "" "The potential uses for metaclasses are boundless. Some ideas that have been " "explored include enum, logging, interface checking, automatic delegation, " @@ -3133,17 +3171,17 @@ msgid "" "locking/synchronization." msgstr "" -#: ../../reference/datamodel.rst:2588 +#: ../../reference/datamodel.rst:2661 msgid "Customizing instance and subclass checks" msgstr "" -#: ../../reference/datamodel.rst:2590 +#: ../../reference/datamodel.rst:2663 msgid "" "The following methods are used to override the default behavior of the :func:" "`isinstance` and :func:`issubclass` built-in functions." msgstr "" -#: ../../reference/datamodel.rst:2593 +#: ../../reference/datamodel.rst:2666 msgid "" "In particular, the metaclass :class:`abc.ABCMeta` implements these methods " "in order to allow the addition of Abstract Base Classes (ABCs) as \"virtual " @@ -3151,21 +3189,21 @@ msgid "" "other ABCs." msgstr "" -#: ../../reference/datamodel.rst:2600 +#: ../../reference/datamodel.rst:2673 msgid "" "Return true if *instance* should be considered a (direct or indirect) " "instance of *class*. If defined, called to implement ``isinstance(instance, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2607 +#: ../../reference/datamodel.rst:2680 msgid "" "Return true if *subclass* should be considered a (direct or indirect) " "subclass of *class*. If defined, called to implement ``issubclass(subclass, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2612 +#: ../../reference/datamodel.rst:2685 msgid "" "Note that these methods are looked up on the type (metaclass) of a class. " "They cannot be defined as class methods in the actual class. This is " @@ -3173,24 +3211,24 @@ msgid "" "only in this case the instance is itself a class." msgstr "" -#: ../../reference/datamodel.rst:2619 +#: ../../reference/datamodel.rst:2692 msgid ":pep:`3119` - Introducing Abstract Base Classes" msgstr "" -#: ../../reference/datamodel.rst:2620 +#: ../../reference/datamodel.rst:2693 msgid "" "Includes the specification for customizing :func:`isinstance` and :func:" -"`issubclass` behavior through :meth:`~class.__instancecheck__` and :meth:" -"`~class.__subclasscheck__`, with motivation for this functionality in the " +"`issubclass` behavior through :meth:`~type.__instancecheck__` and :meth:" +"`~type.__subclasscheck__`, with motivation for this functionality in the " "context of adding Abstract Base Classes (see the :mod:`abc` module) to the " "language." msgstr "" -#: ../../reference/datamodel.rst:2628 +#: ../../reference/datamodel.rst:2701 msgid "Emulating generic types" msgstr "" -#: ../../reference/datamodel.rst:2630 +#: ../../reference/datamodel.rst:2703 msgid "" "When using :term:`type annotations`, it is often useful to " "*parameterize* a :term:`generic type` using Python's square-brackets " @@ -3198,65 +3236,65 @@ msgid "" "a :class:`list` in which all the elements are of type :class:`int`." msgstr "" -#: ../../reference/datamodel.rst:2637 +#: ../../reference/datamodel.rst:2710 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/datamodel.rst:2638 +#: ../../reference/datamodel.rst:2711 msgid "Introducing Python's framework for type annotations" msgstr "" -#: ../../reference/datamodel.rst:2640 +#: ../../reference/datamodel.rst:2713 msgid ":ref:`Generic Alias Types`" msgstr ":ref:`泛型別名型別 `" -#: ../../reference/datamodel.rst:2641 +#: ../../reference/datamodel.rst:2714 msgid "Documentation for objects representing parameterized generic classes" msgstr "" -#: ../../reference/datamodel.rst:2643 +#: ../../reference/datamodel.rst:2716 msgid "" ":ref:`Generics`, :ref:`user-defined generics` and :" "class:`typing.Generic`" msgstr "" -#: ../../reference/datamodel.rst:2644 +#: ../../reference/datamodel.rst:2717 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" -#: ../../reference/datamodel.rst:2647 +#: ../../reference/datamodel.rst:2720 msgid "" "A class can *generally* only be parameterized if it defines the special " "class method ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2652 +#: ../../reference/datamodel.rst:2725 msgid "" "Return an object representing the specialization of a generic class by type " "arguments found in *key*." msgstr "" -#: ../../reference/datamodel.rst:2655 +#: ../../reference/datamodel.rst:2728 msgid "" "When defined on a class, ``__class_getitem__()`` is automatically a class " "method. As such, there is no need for it to be decorated with :func:" "`@classmethod` when it is defined." msgstr "" -#: ../../reference/datamodel.rst:2661 +#: ../../reference/datamodel.rst:2734 msgid "The purpose of *__class_getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2663 +#: ../../reference/datamodel.rst:2736 msgid "" "The purpose of :meth:`~object.__class_getitem__` is to allow runtime " "parameterization of standard-library generic classes in order to more easily " "apply :term:`type hints` to these classes." msgstr "" -#: ../../reference/datamodel.rst:2667 +#: ../../reference/datamodel.rst:2740 msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " @@ -3265,7 +3303,7 @@ msgid "" "own implementation of ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2673 +#: ../../reference/datamodel.rst:2746 msgid "" "Custom implementations of :meth:`~object.__class_getitem__` on classes " "defined outside of the standard library may not be understood by third-party " @@ -3273,11 +3311,11 @@ msgid "" "purposes other than type hinting is discouraged." msgstr "" -#: ../../reference/datamodel.rst:2683 +#: ../../reference/datamodel.rst:2756 msgid "*__class_getitem__* versus *__getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2685 +#: ../../reference/datamodel.rst:2758 msgid "" "Usually, the :ref:`subscription` of an object using square " "brackets will call the :meth:`~object.__getitem__` instance method defined " @@ -3287,14 +3325,14 @@ msgid "" "genericalias>` object if it is properly defined." msgstr "" -#: ../../reference/datamodel.rst:2692 +#: ../../reference/datamodel.rst:2765 msgid "" "Presented with the :term:`expression` ``obj[x]``, the Python interpreter " "follows something like the following process to decide whether :meth:" "`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" msgstr "" -#: ../../reference/datamodel.rst:2697 +#: ../../reference/datamodel.rst:2770 msgid "" "from inspect import isclass\n" "\n" @@ -3320,7 +3358,7 @@ msgid "" " )" msgstr "" -#: ../../reference/datamodel.rst:2720 +#: ../../reference/datamodel.rst:2793 msgid "" "In Python, all classes are themselves instances of other classes. The class " "of a class is known as that class's :term:`metaclass`, and most classes have " @@ -3330,7 +3368,7 @@ msgid "" "__class_getitem__` being called::" msgstr "" -#: ../../reference/datamodel.rst:2727 +#: ../../reference/datamodel.rst:2800 msgid "" ">>> # list has class \"type\" as its metaclass, like most classes:\n" ">>> type(list)\n" @@ -3345,14 +3383,14 @@ msgid "" "" msgstr "" -#: ../../reference/datamodel.rst:2739 +#: ../../reference/datamodel.rst:2812 msgid "" "However, if a class has a custom metaclass that defines :meth:`~object." "__getitem__`, subscribing the class may result in different behaviour. An " "example of this can be found in the :mod:`enum` module::" msgstr "" -#: ../../reference/datamodel.rst:2743 +#: ../../reference/datamodel.rst:2816 msgid "" ">>> from enum import Enum\n" ">>> class Menu(Enum):\n" @@ -3372,33 +3410,33 @@ msgid "" "" msgstr "" -#: ../../reference/datamodel.rst:2762 +#: ../../reference/datamodel.rst:2835 msgid ":pep:`560` - Core Support for typing module and generic types" msgstr "" -#: ../../reference/datamodel.rst:2763 +#: ../../reference/datamodel.rst:2836 msgid "" "Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" "`subscription` results in ``__class_getitem__()`` being " "called instead of :meth:`~object.__getitem__`" msgstr "" -#: ../../reference/datamodel.rst:2771 +#: ../../reference/datamodel.rst:2844 msgid "Emulating callable objects" msgstr "" -#: ../../reference/datamodel.rst:2778 +#: ../../reference/datamodel.rst:2851 msgid "" "Called when the instance is \"called\" as a function; if this method is " "defined, ``x(arg1, arg2, ...)`` roughly translates to ``type(x).__call__(x, " "arg1, ...)``." msgstr "" -#: ../../reference/datamodel.rst:2785 +#: ../../reference/datamodel.rst:2858 msgid "Emulating container types" msgstr "" -#: ../../reference/datamodel.rst:2787 +#: ../../reference/datamodel.rst:2860 msgid "" "The following methods can be defined to implement container objects. " "Containers usually are :term:`sequences ` (such as :class:`lists " @@ -3434,7 +3472,7 @@ msgid "" "should iterate through the values." msgstr "" -#: ../../reference/datamodel.rst:2828 +#: ../../reference/datamodel.rst:2901 msgid "" "Called to implement the built-in function :func:`len`. Should return the " "length of the object, an integer ``>=`` 0. Also, an object that doesn't " @@ -3442,7 +3480,7 @@ msgid "" "returns zero is considered to be false in a Boolean context." msgstr "" -#: ../../reference/datamodel.rst:2835 +#: ../../reference/datamodel.rst:2908 msgid "" "In CPython, the length is required to be at most :data:`sys.maxsize`. If the " "length is larger than :data:`!sys.maxsize` some features (such as :func:" @@ -3451,7 +3489,7 @@ msgid "" "`~object.__bool__` method." msgstr "" -#: ../../reference/datamodel.rst:2844 +#: ../../reference/datamodel.rst:2917 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " @@ -3461,28 +3499,28 @@ msgid "" "never required for correctness." msgstr "" -#: ../../reference/datamodel.rst:2858 +#: ../../reference/datamodel.rst:2931 msgid "" "Slicing is done exclusively with the following three methods. A call like ::" msgstr "" -#: ../../reference/datamodel.rst:2860 +#: ../../reference/datamodel.rst:2933 msgid "a[1:2] = b" msgstr "a[1:2] = b" -#: ../../reference/datamodel.rst:2862 +#: ../../reference/datamodel.rst:2935 msgid "is translated to ::" msgstr "" -#: ../../reference/datamodel.rst:2864 +#: ../../reference/datamodel.rst:2937 msgid "a[slice(1, 2, None)] = b" msgstr "a[slice(1, 2, None)] = b" -#: ../../reference/datamodel.rst:2866 +#: ../../reference/datamodel.rst:2939 msgid "and so forth. Missing slice items are always filled in with ``None``." msgstr "" -#: ../../reference/datamodel.rst:2871 +#: ../../reference/datamodel.rst:2944 msgid "" "Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " "the accepted keys should be integers. Optionally, they may support :class:" @@ -3494,20 +3532,20 @@ msgid "" "`KeyError` should be raised." msgstr "" -#: ../../reference/datamodel.rst:2883 +#: ../../reference/datamodel.rst:2956 msgid "" ":keyword:`for` loops expect that an :exc:`IndexError` will be raised for " "illegal indexes to allow proper detection of the end of the sequence." msgstr "" -#: ../../reference/datamodel.rst:2888 +#: ../../reference/datamodel.rst:2961 msgid "" "When :ref:`subscripting` a *class*, the special class method :" "meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " "See :ref:`classgetitem-versus-getitem` for more details." msgstr "" -#: ../../reference/datamodel.rst:2896 +#: ../../reference/datamodel.rst:2969 msgid "" "Called to implement assignment to ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3516,7 +3554,7 @@ msgid "" "for improper *key* values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2905 +#: ../../reference/datamodel.rst:2978 msgid "" "Called to implement deletion of ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3525,13 +3563,13 @@ msgid "" "values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2914 +#: ../../reference/datamodel.rst:2987 msgid "" "Called by :class:`dict`\\ .\\ :meth:`__getitem__` to implement ``self[key]`` " "for dict subclasses when key is not in the dictionary." msgstr "" -#: ../../reference/datamodel.rst:2920 +#: ../../reference/datamodel.rst:2993 msgid "" "This method is called when an :term:`iterator` is required for a container. " "This method should return a new iterator object that can iterate over all " @@ -3539,14 +3577,14 @@ msgid "" "of the container." msgstr "" -#: ../../reference/datamodel.rst:2928 +#: ../../reference/datamodel.rst:3001 msgid "" "Called (if present) by the :func:`reversed` built-in to implement reverse " "iteration. It should return a new iterator object that iterates over all " "the objects in the container in reverse order." msgstr "" -#: ../../reference/datamodel.rst:2932 +#: ../../reference/datamodel.rst:3005 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " "built-in will fall back to using the sequence protocol (:meth:`__len__` and :" @@ -3555,7 +3593,7 @@ msgid "" "more efficient than the one provided by :func:`reversed`." msgstr "" -#: ../../reference/datamodel.rst:2939 +#: ../../reference/datamodel.rst:3012 msgid "" "The membership test operators (:keyword:`in` and :keyword:`not in`) are " "normally implemented as an iteration through a container. However, container " @@ -3563,14 +3601,14 @@ msgid "" "implementation, which also does not require the object be iterable." msgstr "" -#: ../../reference/datamodel.rst:2946 +#: ../../reference/datamodel.rst:3019 msgid "" "Called to implement membership test operators. Should return true if *item* " "is in *self*, false otherwise. For mapping objects, this should consider " "the keys of the mapping rather than the values or the key-item pairs." msgstr "" -#: ../../reference/datamodel.rst:2950 +#: ../../reference/datamodel.rst:3023 msgid "" "For objects that don't define :meth:`__contains__`, the membership test " "first tries iteration via :meth:`__iter__`, then the old sequence iteration " @@ -3578,11 +3616,11 @@ msgid "" "reference `." msgstr "" -#: ../../reference/datamodel.rst:2959 +#: ../../reference/datamodel.rst:3032 msgid "Emulating numeric types" msgstr "" -#: ../../reference/datamodel.rst:2961 +#: ../../reference/datamodel.rst:3034 msgid "" "The following methods can be defined to emulate numeric objects. Methods " "corresponding to operations that are not supported by the particular kind of " @@ -3590,7 +3628,7 @@ msgid "" "should be left undefined." msgstr "" -#: ../../reference/datamodel.rst:2987 +#: ../../reference/datamodel.rst:3060 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3604,13 +3642,13 @@ msgid "" "function is to be supported." msgstr "" -#: ../../reference/datamodel.rst:2998 +#: ../../reference/datamodel.rst:3071 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return :data:`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3021 +#: ../../reference/datamodel.rst:3094 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3623,13 +3661,13 @@ msgid "" "`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3033 +#: ../../reference/datamodel.rst:3106 msgid "" "Note that ternary :func:`pow` will not try calling :meth:`__rpow__` (the " "coercion rules would become too complicated)." msgstr "" -#: ../../reference/datamodel.rst:3038 +#: ../../reference/datamodel.rst:3111 msgid "" "If the right operand's type is a subclass of the left operand's type and " "that subclass provides a different implementation of the reflected method " @@ -3638,7 +3676,7 @@ msgid "" "ancestors' operations." msgstr "" -#: ../../reference/datamodel.rst:3059 +#: ../../reference/datamodel.rst:3132 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -3656,19 +3694,19 @@ msgid "" "data model." msgstr "" -#: ../../reference/datamodel.rst:3082 +#: ../../reference/datamodel.rst:3155 msgid "" "Called to implement the unary arithmetic operations (``-``, ``+``, :func:" "`abs` and ``~``)." msgstr "" -#: ../../reference/datamodel.rst:3095 +#: ../../reference/datamodel.rst:3168 msgid "" "Called to implement the built-in functions :func:`complex`, :func:`int` and :" "func:`float`. Should return a value of the appropriate type." msgstr "" -#: ../../reference/datamodel.rst:3102 +#: ../../reference/datamodel.rst:3175 msgid "" "Called to implement :func:`operator.index`, and whenever Python needs to " "losslessly convert the numeric object to an integer object (such as in " @@ -3677,14 +3715,14 @@ msgid "" "integer type. Must return an integer." msgstr "" -#: ../../reference/datamodel.rst:3108 +#: ../../reference/datamodel.rst:3181 msgid "" "If :meth:`__int__`, :meth:`__float__` and :meth:`__complex__` are not " "defined then corresponding built-in functions :func:`int`, :func:`float` " "and :func:`complex` fall back to :meth:`__index__`." msgstr "" -#: ../../reference/datamodel.rst:3120 +#: ../../reference/datamodel.rst:3193 msgid "" "Called to implement the built-in function :func:`round` and :mod:`math` " "functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`. " @@ -3693,21 +3731,21 @@ msgid "" "(typically an :class:`int`)." msgstr "" -#: ../../reference/datamodel.rst:3126 +#: ../../reference/datamodel.rst:3199 msgid "" "The built-in function :func:`int` falls back to :meth:`__trunc__` if " "neither :meth:`__int__` nor :meth:`__index__` is defined." msgstr "" -#: ../../reference/datamodel.rst:3129 +#: ../../reference/datamodel.rst:3202 msgid "The delegation of :func:`int` to :meth:`__trunc__` is deprecated." msgstr "" -#: ../../reference/datamodel.rst:3136 +#: ../../reference/datamodel.rst:3209 msgid "With Statement Context Managers" msgstr "With 陳述式的情境管理器" -#: ../../reference/datamodel.rst:3138 +#: ../../reference/datamodel.rst:3211 msgid "" "A :dfn:`context manager` is an object that defines the runtime context to be " "established when executing a :keyword:`with` statement. The context manager " @@ -3717,32 +3755,32 @@ msgid "" "can also be used by directly invoking their methods." msgstr "" -#: ../../reference/datamodel.rst:3149 +#: ../../reference/datamodel.rst:3222 msgid "" "Typical uses of context managers include saving and restoring various kinds " "of global state, locking and unlocking resources, closing opened files, etc." msgstr "" -#: ../../reference/datamodel.rst:3152 +#: ../../reference/datamodel.rst:3225 msgid "" "For more information on context managers, see :ref:`typecontextmanager`." msgstr "" -#: ../../reference/datamodel.rst:3157 +#: ../../reference/datamodel.rst:3230 msgid "" "Enter the runtime context related to this object. The :keyword:`with` " "statement will bind this method's return value to the target(s) specified in " "the :keyword:`!as` clause of the statement, if any." msgstr "" -#: ../../reference/datamodel.rst:3164 +#: ../../reference/datamodel.rst:3237 msgid "" "Exit the runtime context related to this object. The parameters describe the " "exception that caused the context to be exited. If the context was exited " "without an exception, all three arguments will be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:3168 +#: ../../reference/datamodel.rst:3241 msgid "" "If an exception is supplied, and the method wishes to suppress the exception " "(i.e., prevent it from being propagated), it should return a true value. " @@ -3750,27 +3788,27 @@ msgid "" "method." msgstr "" -#: ../../reference/datamodel.rst:3172 +#: ../../reference/datamodel.rst:3245 msgid "" "Note that :meth:`~object.__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" -#: ../../reference/datamodel.rst:3178 +#: ../../reference/datamodel.rst:3251 msgid ":pep:`343` - The \"with\" statement" msgstr ":pep:`343` - \"with\" 陳述式" -#: ../../reference/datamodel.rst:3179 +#: ../../reference/datamodel.rst:3252 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3186 +#: ../../reference/datamodel.rst:3259 msgid "Customizing positional arguments in class pattern matching" msgstr "" -#: ../../reference/datamodel.rst:3188 +#: ../../reference/datamodel.rst:3261 msgid "" "When using a class name in a pattern, positional arguments in the pattern " "are not allowed by default, i.e. ``case MyClass(x, y)`` is typically invalid " @@ -3778,7 +3816,7 @@ msgid "" "pattern, the class needs to define a *__match_args__* attribute." msgstr "" -#: ../../reference/datamodel.rst:3195 +#: ../../reference/datamodel.rst:3268 msgid "" "This class variable can be assigned a tuple of strings. When this class is " "used in a class pattern with positional arguments, each positional argument " @@ -3787,7 +3825,7 @@ msgid "" "to setting it to ``()``." msgstr "" -#: ../../reference/datamodel.rst:3201 +#: ../../reference/datamodel.rst:3274 msgid "" "For example, if ``MyClass.__match_args__`` is ``(\"left\", \"center\", " "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " @@ -3797,19 +3835,19 @@ msgid "" "exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:3211 +#: ../../reference/datamodel.rst:3284 msgid ":pep:`634` - Structural Pattern Matching" msgstr "" -#: ../../reference/datamodel.rst:3212 +#: ../../reference/datamodel.rst:3285 msgid "The specification for the Python ``match`` statement." msgstr "" -#: ../../reference/datamodel.rst:3218 +#: ../../reference/datamodel.rst:3291 msgid "Emulating buffer types" msgstr "" -#: ../../reference/datamodel.rst:3220 +#: ../../reference/datamodel.rst:3293 msgid "" "The :ref:`buffer protocol ` provides a way for Python objects " "to expose efficient access to a low-level memory array. This protocol is " @@ -3817,13 +3855,13 @@ msgid "" "and third-party libraries may define additional buffer types." msgstr "" -#: ../../reference/datamodel.rst:3225 +#: ../../reference/datamodel.rst:3298 msgid "" "While buffer types are usually implemented in C, it is also possible to " "implement the protocol in Python." msgstr "" -#: ../../reference/datamodel.rst:3230 +#: ../../reference/datamodel.rst:3303 msgid "" "Called when a buffer is requested from *self* (for example, by the :class:" "`memoryview` constructor). The *flags* argument is an integer representing " @@ -3833,7 +3871,7 @@ msgid "" "`memoryview` object." msgstr "" -#: ../../reference/datamodel.rst:3239 +#: ../../reference/datamodel.rst:3312 msgid "" "Called when a buffer is no longer needed. The *buffer* argument is a :class:" "`memoryview` object that was previously returned by :meth:`~object." @@ -3842,28 +3880,28 @@ msgid "" "to perform any cleanup are not required to implement this method." msgstr "" -#: ../../reference/datamodel.rst:3250 +#: ../../reference/datamodel.rst:3323 msgid ":pep:`688` - Making the buffer protocol accessible in Python" msgstr "" -#: ../../reference/datamodel.rst:3251 +#: ../../reference/datamodel.rst:3324 msgid "" "Introduces the Python ``__buffer__`` and ``__release_buffer__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3253 +#: ../../reference/datamodel.rst:3326 msgid ":class:`collections.abc.Buffer`" msgstr ":class:`collections.abc.Buffer`" -#: ../../reference/datamodel.rst:3254 +#: ../../reference/datamodel.rst:3327 msgid "ABC for buffer types." msgstr "" -#: ../../reference/datamodel.rst:3259 +#: ../../reference/datamodel.rst:3332 msgid "Special method lookup" msgstr "" -#: ../../reference/datamodel.rst:3261 +#: ../../reference/datamodel.rst:3334 msgid "" "For custom classes, implicit invocations of special methods are only " "guaranteed to work correctly if defined on an object's type, not in the " @@ -3871,7 +3909,7 @@ msgid "" "following code raises an exception::" msgstr "" -#: ../../reference/datamodel.rst:3266 +#: ../../reference/datamodel.rst:3339 msgid "" ">>> class C:\n" "... pass\n" @@ -3893,7 +3931,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: object of type 'C' has no len()" -#: ../../reference/datamodel.rst:3276 +#: ../../reference/datamodel.rst:3349 msgid "" "The rationale behind this behaviour lies with a number of special methods " "such as :meth:`~object.__hash__` and :meth:`~object.__repr__` that are " @@ -3902,7 +3940,7 @@ msgid "" "invoked on the type object itself::" msgstr "" -#: ../../reference/datamodel.rst:3283 +#: ../../reference/datamodel.rst:3356 msgid "" ">>> 1 .__hash__() == hash(1)\n" "True\n" @@ -3918,14 +3956,14 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: descriptor '__hash__' of 'int' object needs an argument" -#: ../../reference/datamodel.rst:3290 +#: ../../reference/datamodel.rst:3363 msgid "" "Incorrectly attempting to invoke an unbound method of a class in this way is " "sometimes referred to as 'metaclass confusion', and is avoided by bypassing " "the instance when looking up special methods::" msgstr "" -#: ../../reference/datamodel.rst:3294 +#: ../../reference/datamodel.rst:3367 msgid "" ">>> type(1).__hash__(1) == hash(1)\n" "True\n" @@ -3937,14 +3975,14 @@ msgstr "" ">>> type(int).__hash__(int) == hash(int)\n" "True" -#: ../../reference/datamodel.rst:3299 +#: ../../reference/datamodel.rst:3372 msgid "" "In addition to bypassing any instance attributes in the interest of " "correctness, implicit special method lookup generally also bypasses the :" "meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" -#: ../../reference/datamodel.rst:3303 +#: ../../reference/datamodel.rst:3376 msgid "" ">>> class Meta(type):\n" "... def __getattribute__(*args):\n" @@ -3969,7 +4007,7 @@ msgid "" "10" msgstr "" -#: ../../reference/datamodel.rst:3325 +#: ../../reference/datamodel.rst:3398 msgid "" "Bypassing the :meth:`~object.__getattribute__` machinery in this fashion " "provides significant scope for speed optimisations within the interpreter, " @@ -3978,36 +4016,36 @@ msgid "" "consistently invoked by the interpreter)." msgstr "" -#: ../../reference/datamodel.rst:3336 +#: ../../reference/datamodel.rst:3409 msgid "Coroutines" msgstr "協程" -#: ../../reference/datamodel.rst:3340 +#: ../../reference/datamodel.rst:3413 msgid "Awaitable Objects" msgstr "" -#: ../../reference/datamodel.rst:3342 +#: ../../reference/datamodel.rst:3415 msgid "" "An :term:`awaitable` object generally implements an :meth:`~object." "__await__` method. :term:`Coroutine objects ` returned from :" "keyword:`async def` functions are awaitable." msgstr "" -#: ../../reference/datamodel.rst:3348 +#: ../../reference/datamodel.rst:3421 msgid "" "The :term:`generator iterator` objects returned from generators decorated " "with :func:`types.coroutine` are also awaitable, but they do not implement :" "meth:`~object.__await__`." msgstr "" -#: ../../reference/datamodel.rst:3354 +#: ../../reference/datamodel.rst:3427 msgid "" "Must return an :term:`iterator`. Should be used to implement :term:" "`awaitable` objects. For instance, :class:`asyncio.Future` implements this " "method to be compatible with the :keyword:`await` expression." msgstr "" -#: ../../reference/datamodel.rst:3360 +#: ../../reference/datamodel.rst:3433 msgid "" "The language doesn't place any restriction on the type or value of the " "objects yielded by the iterator returned by ``__await__``, as this is " @@ -4015,15 +4053,15 @@ msgid "" "g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." msgstr "" -#: ../../reference/datamodel.rst:3368 +#: ../../reference/datamodel.rst:3441 msgid ":pep:`492` for additional information about awaitable objects." msgstr "" -#: ../../reference/datamodel.rst:3374 +#: ../../reference/datamodel.rst:3447 msgid "Coroutine Objects" msgstr "" -#: ../../reference/datamodel.rst:3376 +#: ../../reference/datamodel.rst:3449 msgid "" ":term:`Coroutine objects ` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`~object.__await__` " @@ -4034,18 +4072,18 @@ msgid "" "should not directly raise unhandled :exc:`StopIteration` exceptions." msgstr "" -#: ../../reference/datamodel.rst:3384 +#: ../../reference/datamodel.rst:3457 msgid "" "Coroutines also have the methods listed below, which are analogous to those " "of generators (see :ref:`generator-methods`). However, unlike generators, " "coroutines do not directly support iteration." msgstr "" -#: ../../reference/datamodel.rst:3388 +#: ../../reference/datamodel.rst:3461 msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" -#: ../../reference/datamodel.rst:3394 +#: ../../reference/datamodel.rst:3467 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " "is equivalent to advancing the iterator returned by :meth:`~object." @@ -4056,7 +4094,7 @@ msgid "" "value, described above." msgstr "" -#: ../../reference/datamodel.rst:3405 +#: ../../reference/datamodel.rst:3478 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " @@ -4067,13 +4105,13 @@ msgid "" "not caught in the coroutine, it propagates back to the caller." msgstr "" -#: ../../reference/datamodel.rst:3416 +#: ../../reference/datamodel.rst:3489 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" -#: ../../reference/datamodel.rst:3421 +#: ../../reference/datamodel.rst:3494 msgid "" "Causes the coroutine to clean itself up and exit. If the coroutine is " "suspended, this method first delegates to the :meth:`~generator.close` " @@ -4083,42 +4121,42 @@ msgid "" "is marked as having finished executing, even if it was never started." msgstr "" -#: ../../reference/datamodel.rst:3429 +#: ../../reference/datamodel.rst:3502 msgid "" "Coroutine objects are automatically closed using the above process when they " "are about to be destroyed." msgstr "" -#: ../../reference/datamodel.rst:3435 +#: ../../reference/datamodel.rst:3508 msgid "Asynchronous Iterators" msgstr "" -#: ../../reference/datamodel.rst:3437 +#: ../../reference/datamodel.rst:3510 msgid "" "An *asynchronous iterator* can call asynchronous code in its ``__anext__`` " "method." msgstr "" -#: ../../reference/datamodel.rst:3440 +#: ../../reference/datamodel.rst:3513 msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "" -#: ../../reference/datamodel.rst:3444 +#: ../../reference/datamodel.rst:3517 msgid "Must return an *asynchronous iterator* object." msgstr "" -#: ../../reference/datamodel.rst:3448 +#: ../../reference/datamodel.rst:3521 msgid "" "Must return an *awaitable* resulting in a next value of the iterator. " "Should raise a :exc:`StopAsyncIteration` error when the iteration is over." msgstr "" -#: ../../reference/datamodel.rst:3451 +#: ../../reference/datamodel.rst:3524 msgid "An example of an asynchronous iterable object::" msgstr "" -#: ../../reference/datamodel.rst:3453 +#: ../../reference/datamodel.rst:3526 msgid "" "class Reader:\n" " async def readline(self):\n" @@ -4146,53 +4184,53 @@ msgstr "" " raise StopAsyncIteration\n" " return val" -#: ../../reference/datamodel.rst:3468 +#: ../../reference/datamodel.rst:3541 msgid "" "Prior to Python 3.7, :meth:`~object.__aiter__` could return an *awaitable* " "that would resolve to an :term:`asynchronous iterator `." msgstr "" -#: ../../reference/datamodel.rst:3473 +#: ../../reference/datamodel.rst:3546 msgid "" "Starting with Python 3.7, :meth:`~object.__aiter__` must return an " "asynchronous iterator object. Returning anything else will result in a :exc:" "`TypeError` error." msgstr "" -#: ../../reference/datamodel.rst:3481 +#: ../../reference/datamodel.rst:3554 msgid "Asynchronous Context Managers" msgstr "" -#: ../../reference/datamodel.rst:3483 +#: ../../reference/datamodel.rst:3556 msgid "" "An *asynchronous context manager* is a *context manager* that is able to " "suspend execution in its ``__aenter__`` and ``__aexit__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3486 +#: ../../reference/datamodel.rst:3559 msgid "" "Asynchronous context managers can be used in an :keyword:`async with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3490 +#: ../../reference/datamodel.rst:3563 msgid "" "Semantically similar to :meth:`~object.__enter__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3495 +#: ../../reference/datamodel.rst:3568 msgid "" "Semantically similar to :meth:`~object.__exit__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3498 +#: ../../reference/datamodel.rst:3571 msgid "An example of an asynchronous context manager class::" msgstr "" -#: ../../reference/datamodel.rst:3500 +#: ../../reference/datamodel.rst:3573 msgid "" "class AsyncContextManager:\n" " async def __aenter__(self):\n" @@ -4208,18 +4246,18 @@ msgstr "" " async def __aexit__(self, exc_type, exc, tb):\n" " await log('exiting context')" -#: ../../reference/datamodel.rst:3511 +#: ../../reference/datamodel.rst:3584 msgid "Footnotes" msgstr "註解" -#: ../../reference/datamodel.rst:3512 +#: ../../reference/datamodel.rst:3585 msgid "" "It *is* possible in some cases to change an object's type, under certain " "controlled conditions. It generally isn't a good idea though, since it can " "lead to some very strange behaviour if it is handled incorrectly." msgstr "" -#: ../../reference/datamodel.rst:3516 +#: ../../reference/datamodel.rst:3589 msgid "" "The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." "__reversed__`, :meth:`~object.__contains__`, :meth:`~object." @@ -4228,7 +4266,7 @@ msgid "" "by relying on the behavior that ``None`` is not callable." msgstr "" -#: ../../reference/datamodel.rst:3523 +#: ../../reference/datamodel.rst:3596 msgid "" "\"Does not support\" here means that the class has no such method, or the " "method returns :data:`NotImplemented`. Do not set the method to ``None`` if " @@ -4236,7 +4274,7 @@ msgid "" "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" -#: ../../reference/datamodel.rst:3529 +#: ../../reference/datamodel.rst:3602 msgid "" "For operands of the same type, it is assumed that if the non-reflected " "method -- such as :meth:`~object.__add__` -- fails then the overall " @@ -4253,13 +4291,13 @@ msgstr "" #: ../../reference/datamodel.rst:427 ../../reference/datamodel.rst:447 #: ../../reference/datamodel.rst:455 ../../reference/datamodel.rst:466 #: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:519 -#: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:661 -#: ../../reference/datamodel.rst:799 ../../reference/datamodel.rst:823 -#: ../../reference/datamodel.rst:856 ../../reference/datamodel.rst:935 -#: ../../reference/datamodel.rst:1013 ../../reference/datamodel.rst:1040 -#: ../../reference/datamodel.rst:1102 ../../reference/datamodel.rst:1206 -#: ../../reference/datamodel.rst:1315 ../../reference/datamodel.rst:1425 -#: ../../reference/datamodel.rst:1839 ../../reference/datamodel.rst:2854 +#: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:660 +#: ../../reference/datamodel.rst:798 ../../reference/datamodel.rst:822 +#: ../../reference/datamodel.rst:856 ../../reference/datamodel.rst:937 +#: ../../reference/datamodel.rst:1076 ../../reference/datamodel.rst:1103 +#: ../../reference/datamodel.rst:1175 ../../reference/datamodel.rst:1279 +#: ../../reference/datamodel.rst:1388 ../../reference/datamodel.rst:1498 +#: ../../reference/datamodel.rst:1912 ../../reference/datamodel.rst:2927 msgid "object" msgstr "object(物件)" @@ -4269,14 +4307,14 @@ msgstr "data(資料)" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:296 #: ../../reference/datamodel.rst:343 ../../reference/datamodel.rst:427 -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:799 -#: ../../reference/datamodel.rst:1059 ../../reference/datamodel.rst:1508 -#: ../../reference/datamodel.rst:1750 ../../reference/datamodel.rst:1755 -#: ../../reference/datamodel.rst:1839 ../../reference/datamodel.rst:2395 -#: ../../reference/datamodel.rst:2824 ../../reference/datamodel.rst:2982 -#: ../../reference/datamodel.rst:3017 ../../reference/datamodel.rst:3031 -#: ../../reference/datamodel.rst:3080 ../../reference/datamodel.rst:3090 -#: ../../reference/datamodel.rst:3118 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:798 +#: ../../reference/datamodel.rst:1132 ../../reference/datamodel.rst:1581 +#: ../../reference/datamodel.rst:1823 ../../reference/datamodel.rst:1828 +#: ../../reference/datamodel.rst:1912 ../../reference/datamodel.rst:2468 +#: ../../reference/datamodel.rst:2897 ../../reference/datamodel.rst:3055 +#: ../../reference/datamodel.rst:3090 ../../reference/datamodel.rst:3104 +#: ../../reference/datamodel.rst:3153 ../../reference/datamodel.rst:3163 +#: ../../reference/datamodel.rst:3191 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -4285,7 +4323,7 @@ msgid "id" msgstr "id" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:126 -#: ../../reference/datamodel.rst:2395 +#: ../../reference/datamodel.rst:2468 msgid "type" msgstr "type(型別)" @@ -4321,7 +4359,7 @@ msgstr "reference counting(參照計數)" msgid "unreachable object" msgstr "unreachable object(不可達物件)" -#: ../../reference/datamodel.rst:95 ../../reference/datamodel.rst:935 +#: ../../reference/datamodel.rst:95 ../../reference/datamodel.rst:937 msgid "container" msgstr "container(容器)" @@ -4336,23 +4374,23 @@ msgstr "extension(擴充)" #: ../../reference/datamodel.rst:126 ../../reference/datamodel.rst:400 #: ../../reference/datamodel.rst:401 ../../reference/datamodel.rst:502 #: ../../reference/datamodel.rst:856 ../../reference/datamodel.rst:876 -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "module" msgstr "module(模組)" #: ../../reference/datamodel.rst:126 ../../reference/datamodel.rst:265 -#: ../../reference/datamodel.rst:799 +#: ../../reference/datamodel.rst:798 msgid "C" msgstr "C" #: ../../reference/datamodel.rst:126 ../../reference/datamodel.rst:265 -#: ../../reference/datamodel.rst:799 +#: ../../reference/datamodel.rst:798 msgid "language" msgstr "language(語言)" -#: ../../reference/datamodel.rst:139 ../../reference/datamodel.rst:935 -#: ../../reference/datamodel.rst:953 ../../reference/datamodel.rst:1013 -#: ../../reference/datamodel.rst:1033 +#: ../../reference/datamodel.rst:139 ../../reference/datamodel.rst:937 +#: ../../reference/datamodel.rst:955 ../../reference/datamodel.rst:1076 +#: ../../reference/datamodel.rst:1096 msgid "attribute" msgstr "attribute(屬性)" @@ -4372,7 +4410,7 @@ msgstr "..." msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" -#: ../../reference/datamodel.rst:196 ../../reference/datamodel.rst:1040 +#: ../../reference/datamodel.rst:196 ../../reference/datamodel.rst:1103 msgid "numeric" msgstr "numeric(數值)" @@ -4409,16 +4447,16 @@ msgstr "number(數字)" msgid "Java" msgstr "Java" -#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3090 +#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3163 msgid "complex" msgstr "complex(複數)" #: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:427 -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:2824 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:2897 msgid "len" msgstr "len" -#: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:1040 +#: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:1103 msgid "sequence" msgstr "sequence(序列)" @@ -4447,8 +4485,8 @@ msgstr "immutable sequence(不可變序列)" msgid "immutable" msgstr "immutable(不可變)" -#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1725 -#: ../../reference/datamodel.rst:1755 +#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1798 +#: ../../reference/datamodel.rst:1828 msgid "string" msgstr "string(字串)" @@ -4484,7 +4522,7 @@ msgstr "singleton(單例)" msgid "empty" msgstr "empty(空的)" -#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:1750 +#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:1823 msgid "bytes" msgstr "bytes(位元組)" @@ -4500,14 +4538,14 @@ msgstr "mutable sequence(可變序列)" msgid "mutable" msgstr "mutable(可變的)" -#: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:953 -#: ../../reference/datamodel.rst:1033 +#: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:955 +#: ../../reference/datamodel.rst:1096 msgid "assignment" msgstr "assignment(賦值)" #: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:856 -#: ../../reference/datamodel.rst:1462 ../../reference/datamodel.rst:1644 -#: ../../reference/datamodel.rst:3145 +#: ../../reference/datamodel.rst:1535 ../../reference/datamodel.rst:1717 +#: ../../reference/datamodel.rst:3218 msgid "statement" msgstr "statement(陳述式)" @@ -4539,12 +4577,12 @@ msgstr "set(集合)" msgid "frozenset" msgstr "frozenset(凍結集合)" -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:1040 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:1103 msgid "mapping" msgstr "mapping(對映)" -#: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:935 -#: ../../reference/datamodel.rst:1839 +#: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:937 +#: ../../reference/datamodel.rst:1912 msgid "dictionary" msgstr "dictionary(字典)" @@ -4561,13 +4599,13 @@ msgid "callable" msgstr "callable(可呼叫物件)" #: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:534 -#: ../../reference/datamodel.rst:743 ../../reference/datamodel.rst:761 -#: ../../reference/datamodel.rst:774 ../../reference/datamodel.rst:799 +#: ../../reference/datamodel.rst:742 ../../reference/datamodel.rst:760 +#: ../../reference/datamodel.rst:773 ../../reference/datamodel.rst:798 msgid "function" msgstr "function (函式)" -#: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:935 -#: ../../reference/datamodel.rst:958 ../../reference/datamodel.rst:2776 +#: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:937 +#: ../../reference/datamodel.rst:960 ../../reference/datamodel.rst:2849 msgid "call" msgstr "call(呼叫)" @@ -4579,7 +4617,7 @@ msgstr "invocation(調用)" msgid "argument" msgstr "argument(引數)" -#: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:661 +#: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:660 msgid "user-defined" msgstr "user-defined(使用者定義)" @@ -4639,59 +4677,59 @@ msgstr "__kwdefaults__ (函式屬性)" msgid "__type_params__ (function attribute)" msgstr "__type_params__ (函式屬性)" -#: ../../reference/datamodel.rst:661 ../../reference/datamodel.rst:823 +#: ../../reference/datamodel.rst:660 ../../reference/datamodel.rst:822 msgid "method" msgstr "method(方法)" -#: ../../reference/datamodel.rst:661 +#: ../../reference/datamodel.rst:660 msgid "user-defined method" msgstr "user-defined method(使用者定義方法)" -#: ../../reference/datamodel.rst:669 +#: ../../reference/datamodel.rst:668 msgid "__func__ (method attribute)" msgstr "__func__ (方法屬性)" -#: ../../reference/datamodel.rst:669 +#: ../../reference/datamodel.rst:668 msgid "__self__ (method attribute)" msgstr "__self__ (方法屬性)" -#: ../../reference/datamodel.rst:669 +#: ../../reference/datamodel.rst:668 msgid "__doc__ (method attribute)" msgstr "__doc__ (方法屬性)" -#: ../../reference/datamodel.rst:669 +#: ../../reference/datamodel.rst:668 msgid "__name__ (method attribute)" msgstr "__name__ (方法屬性)" -#: ../../reference/datamodel.rst:669 +#: ../../reference/datamodel.rst:668 msgid "__module__ (method attribute)" msgstr "__module__ (方法屬性)" -#: ../../reference/datamodel.rst:743 ../../reference/datamodel.rst:1206 +#: ../../reference/datamodel.rst:742 ../../reference/datamodel.rst:1279 msgid "generator" msgstr "generator(產生器)" -#: ../../reference/datamodel.rst:743 +#: ../../reference/datamodel.rst:742 msgid "iterator" msgstr "itorator(疊代器)" -#: ../../reference/datamodel.rst:761 ../../reference/datamodel.rst:3332 +#: ../../reference/datamodel.rst:760 ../../reference/datamodel.rst:3405 msgid "coroutine" msgstr "coroutine(協程)" -#: ../../reference/datamodel.rst:774 +#: ../../reference/datamodel.rst:773 msgid "asynchronous generator" msgstr "asynchronous generator(非同步產生器)" -#: ../../reference/datamodel.rst:774 +#: ../../reference/datamodel.rst:773 msgid "asynchronous iterator" msgstr "asynchronous iterator(非同步疊代器)" -#: ../../reference/datamodel.rst:823 +#: ../../reference/datamodel.rst:822 msgid "built-in method" msgstr "built-in method(內建方法)" -#: ../../reference/datamodel.rst:823 +#: ../../reference/datamodel.rst:822 msgid "built-in" msgstr "built-in(內建)" @@ -4719,489 +4757,508 @@ msgstr "__annotations__ (模組屬性)" msgid "__dict__ (module attribute)" msgstr "__dict__ (模組屬性)" -#: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:953 -#: ../../reference/datamodel.rst:1013 ../../reference/datamodel.rst:1627 -#: ../../reference/datamodel.rst:2506 +#: ../../reference/datamodel.rst:937 ../../reference/datamodel.rst:955 +#: ../../reference/datamodel.rst:1076 ../../reference/datamodel.rst:1700 +#: ../../reference/datamodel.rst:2579 msgid "class" msgstr "class(類別)" -#: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:1013 -#: ../../reference/datamodel.rst:1033 +#: ../../reference/datamodel.rst:937 ../../reference/datamodel.rst:1076 +#: ../../reference/datamodel.rst:1096 msgid "class instance" msgstr "class instance(類別實例)" -#: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:1013 -#: ../../reference/datamodel.rst:2776 +#: ../../reference/datamodel.rst:937 ../../reference/datamodel.rst:1076 +#: ../../reference/datamodel.rst:2849 msgid "instance" msgstr "instance(實例)" -#: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:958 +#: ../../reference/datamodel.rst:937 ../../reference/datamodel.rst:960 msgid "class object" msgstr "class object(類別物件)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__name__ (class attribute)" msgstr "__name__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__module__ (class attribute)" msgstr "__module__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__dict__ (class attribute)" msgstr "__dict__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__bases__ (class attribute)" msgstr "__bases__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__doc__ (class attribute)" msgstr "__doc__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__annotations__ (class attribute)" msgstr "__annotations__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__type_params__ (class attribute)" msgstr "__type_params__ (類別屬性)" -#: ../../reference/datamodel.rst:962 -#, fuzzy +#: ../../reference/datamodel.rst:967 msgid "__static_attributes__ (class attribute)" -msgstr "__annotations__ (類別屬性)" +msgstr "__static_attributes__ (類別屬性)" -#: ../../reference/datamodel.rst:962 -#, fuzzy +#: ../../reference/datamodel.rst:967 msgid "__firstlineno__ (class attribute)" -msgstr "__name__ (類別屬性)" +msgstr "__firstlineno__ (類別屬性)" -#: ../../reference/datamodel.rst:1048 +#: ../../reference/datamodel.rst:1114 msgid "__dict__ (instance attribute)" msgstr "__dict__ (實例屬性)" -#: ../../reference/datamodel.rst:1048 +#: ../../reference/datamodel.rst:1114 msgid "__class__ (instance attribute)" msgstr "__class__ (實例屬性)" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "open" msgstr "open" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "io" msgstr "io" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "popen() (in module os)" msgstr "popen() (於 os 模組中)" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "makefile() (socket method)" msgstr "makefile() (socket 方法)" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "sys.stdin" msgstr "sys.stdin" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "sys.stdout" msgstr "sys.stdout" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "sys.stderr" msgstr "sys.stderr" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "stdio" msgstr "stdio" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "stdin (in module sys)" msgstr "stdin (sys 模組中)" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "stdout (in module sys)" msgstr "stdout (sys 模組中)" -#: ../../reference/datamodel.rst:1059 +#: ../../reference/datamodel.rst:1132 msgid "stderr (in module sys)" msgstr "stderr (sys 模組中)" -#: ../../reference/datamodel.rst:1088 +#: ../../reference/datamodel.rst:1161 msgid "internal type" msgstr "internal type(內部型別)" -#: ../../reference/datamodel.rst:1088 +#: ../../reference/datamodel.rst:1161 msgid "types, internal" msgstr "types(型別), internal(內部)" -#: ../../reference/datamodel.rst:1102 +#: ../../reference/datamodel.rst:1175 msgid "bytecode" msgstr "bytecode(位元組碼)" -#: ../../reference/datamodel.rst:1102 +#: ../../reference/datamodel.rst:1175 msgid "code" msgstr "code(程式碼)" -#: ../../reference/datamodel.rst:1102 +#: ../../reference/datamodel.rst:1175 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_argcount (code object attribute)" msgstr "co_argcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_posonlyargcount (code object attribute)" msgstr "co_posonlyargcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_kwonlyargcount (code object attribute)" msgstr "co_kwonlyargcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_code (code object attribute)" msgstr "co_code (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_consts (code object attribute)" msgstr "co_consts (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_filename (code object attribute)" msgstr "co_filename (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_firstlineno (code object attribute)" msgstr "co_firstlineno (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_flags (code object attribute)" msgstr "co_flags (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_lnotab (code object attribute)" msgstr "co_lnotab (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_name (code object attribute)" msgstr "co_name (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_names (code object attribute)" msgstr "co_names (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_nlocals (code object attribute)" msgstr "co_nlocals (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_stacksize (code object attribute)" msgstr "co_stacksize (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_varnames (code object attribute)" msgstr "co_varnames (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_cellvars (code object attribute)" msgstr "co_cellvars (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_freevars (code object attribute)" msgstr "co_freevars (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1113 +#: ../../reference/datamodel.rst:1186 msgid "co_qualname (code object attribute)" msgstr "co_qualname (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1224 +#: ../../reference/datamodel.rst:1297 msgid "documentation string" msgstr "documentation string(文件字串)" -#: ../../reference/datamodel.rst:1315 +#: ../../reference/datamodel.rst:1388 msgid "frame" msgstr "frame" -#: ../../reference/datamodel.rst:1321 +#: ../../reference/datamodel.rst:1394 msgid "f_back (frame attribute)" msgstr "f_back (frame 屬性)" -#: ../../reference/datamodel.rst:1321 +#: ../../reference/datamodel.rst:1394 msgid "f_code (frame attribute)" msgstr "f_code (frame 屬性)" -#: ../../reference/datamodel.rst:1321 +#: ../../reference/datamodel.rst:1394 msgid "f_globals (frame attribute)" msgstr "f_globals (frame 屬性)" -#: ../../reference/datamodel.rst:1321 +#: ../../reference/datamodel.rst:1394 msgid "f_locals (frame attribute)" msgstr "f_locals (frame 屬性)" -#: ../../reference/datamodel.rst:1321 +#: ../../reference/datamodel.rst:1394 msgid "f_lasti (frame attribute)" msgstr "f_lasti (frame 屬性)" -#: ../../reference/datamodel.rst:1321 +#: ../../reference/datamodel.rst:1394 msgid "f_builtins (frame attribute)" msgstr "f_builtins (frame 屬性)" -#: ../../reference/datamodel.rst:1365 +#: ../../reference/datamodel.rst:1438 msgid "f_trace (frame attribute)" msgstr "f_trace (frame 屬性)" -#: ../../reference/datamodel.rst:1365 +#: ../../reference/datamodel.rst:1438 msgid "f_trace_lines (frame attribute)" msgstr "f_trace_lines (frame 屬性)" -#: ../../reference/datamodel.rst:1365 +#: ../../reference/datamodel.rst:1438 msgid "f_trace_opcodes (frame attribute)" msgstr "f_trace_opcodes (frame 屬性)" -#: ../../reference/datamodel.rst:1365 +#: ../../reference/datamodel.rst:1438 msgid "f_lineno (frame attribute)" msgstr "f_lineno (frame 屬性)" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "traceback" msgstr "traceback" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "stack" msgstr "stack(堆疊)" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "trace" msgstr "trace(追蹤)" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "exception" msgstr "exception(例外)" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "handler" msgstr "handler(處理器)" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "execution" msgstr "execution(執行)" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "exc_info (in module sys)" msgstr "exc_info (sys 模組中)" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "last_traceback (in module sys)" msgstr "last_traceback (sys 模組中)" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "sys.exc_info" msgstr "sys.exc_info" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "sys.exception" msgstr "sys.exception" -#: ../../reference/datamodel.rst:1425 +#: ../../reference/datamodel.rst:1498 msgid "sys.last_traceback" msgstr "sys.last_traceback" -#: ../../reference/datamodel.rst:1462 +#: ../../reference/datamodel.rst:1535 msgid "tb_frame (traceback attribute)" msgstr "tb_frame (traceback 屬性)" -#: ../../reference/datamodel.rst:1462 +#: ../../reference/datamodel.rst:1535 msgid "tb_lineno (traceback attribute)" msgstr "tb_lineno (traceback 屬性)" -#: ../../reference/datamodel.rst:1462 +#: ../../reference/datamodel.rst:1535 msgid "tb_lasti (traceback attribute)" msgstr "tb_lasti (traceback 屬性)" -#: ../../reference/datamodel.rst:1462 +#: ../../reference/datamodel.rst:1535 msgid "try" msgstr "try" -#: ../../reference/datamodel.rst:1492 +#: ../../reference/datamodel.rst:1565 msgid "tb_next (traceback attribute)" msgstr "tb_next (traceback 屬性)" -#: ../../reference/datamodel.rst:1508 ../../reference/datamodel.rst:2854 +#: ../../reference/datamodel.rst:1581 ../../reference/datamodel.rst:2927 msgid "slice" msgstr "slice(切片)" -#: ../../reference/datamodel.rst:1514 +#: ../../reference/datamodel.rst:1587 msgid "start (slice object attribute)" msgstr "start (slice 物件屬性)" -#: ../../reference/datamodel.rst:1514 +#: ../../reference/datamodel.rst:1587 msgid "stop (slice object attribute)" msgstr "stop (slice 物件屬性)" -#: ../../reference/datamodel.rst:1514 +#: ../../reference/datamodel.rst:1587 msgid "step (slice object attribute)" msgstr "step (slice 物件屬性)" -#: ../../reference/datamodel.rst:1562 +#: ../../reference/datamodel.rst:1635 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/datamodel.rst:1562 +#: ../../reference/datamodel.rst:1635 msgid "overloading" msgstr "overloading(多載)" -#: ../../reference/datamodel.rst:1562 +#: ../../reference/datamodel.rst:1635 msgid "__getitem__() (mapping object method)" msgstr "__getitem__() (對映物件方法)" -#: ../../reference/datamodel.rst:1598 +#: ../../reference/datamodel.rst:1671 msgid "subclassing" msgstr "subclassing(子類別化)" -#: ../../reference/datamodel.rst:1598 +#: ../../reference/datamodel.rst:1671 msgid "immutable types" msgstr "immutable types(不可變型別)" -#: ../../reference/datamodel.rst:1627 +#: ../../reference/datamodel.rst:1700 msgid "constructor" msgstr "constructor(建構函式)" -#: ../../reference/datamodel.rst:1644 +#: ../../reference/datamodel.rst:1717 msgid "destructor" msgstr "destructor(解構函式)" -#: ../../reference/datamodel.rst:1644 +#: ../../reference/datamodel.rst:1717 msgid "finalizer" msgstr "finalizer(終結函式)" -#: ../../reference/datamodel.rst:1644 +#: ../../reference/datamodel.rst:1717 msgid "del" msgstr "del" -#: ../../reference/datamodel.rst:1708 +#: ../../reference/datamodel.rst:1781 msgid "repr() (built-in function)" msgstr "repr() (內建函式)" -#: ../../reference/datamodel.rst:1708 +#: ../../reference/datamodel.rst:1781 msgid "__repr__() (object method)" msgstr "__repr__() (物件方法)" -#: ../../reference/datamodel.rst:1725 +#: ../../reference/datamodel.rst:1798 msgid "__str__() (object method)" msgstr "__str__() (物件方法)" -#: ../../reference/datamodel.rst:1725 +#: ../../reference/datamodel.rst:1798 msgid "format() (built-in function)" msgstr "format() (內建函式)" -#: ../../reference/datamodel.rst:1725 +#: ../../reference/datamodel.rst:1798 msgid "print() (built-in function)" msgstr "print() (內建函式)" -#: ../../reference/datamodel.rst:1755 +#: ../../reference/datamodel.rst:1828 msgid "__format__() (object method)" msgstr "__format__() (物件方法)" -#: ../../reference/datamodel.rst:1755 +#: ../../reference/datamodel.rst:1828 msgid "conversion" msgstr "conversion" -#: ../../reference/datamodel.rst:1755 +#: ../../reference/datamodel.rst:1828 msgid "print" msgstr "print" -#: ../../reference/datamodel.rst:1794 +#: ../../reference/datamodel.rst:1867 msgid "comparisons" msgstr "comparison(比較)" -#: ../../reference/datamodel.rst:1839 +#: ../../reference/datamodel.rst:1912 msgid "hash" msgstr "hash(雜湊)" -#: ../../reference/datamodel.rst:1920 +#: ../../reference/datamodel.rst:1993 msgid "__len__() (mapping object method)" msgstr "__len__() (對映物件方法)" -#: ../../reference/datamodel.rst:2024 +#: ../../reference/datamodel.rst:2097 msgid "__getattr__ (module attribute)" msgstr "__getattr__ (模組屬性)" -#: ../../reference/datamodel.rst:2024 +#: ../../reference/datamodel.rst:2097 msgid "__dir__ (module attribute)" msgstr "__dir__ (模組屬性)" -#: ../../reference/datamodel.rst:2024 +#: ../../reference/datamodel.rst:2097 msgid "__class__ (module attribute)" msgstr "__class__ (模組屬性)" -#: ../../reference/datamodel.rst:2395 +#: ../../reference/datamodel.rst:2468 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../reference/datamodel.rst:2395 +#: ../../reference/datamodel.rst:2468 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/datamodel.rst:2395 +#: ../../reference/datamodel.rst:2468 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/datamodel.rst:2459 +#: ../../reference/datamodel.rst:2532 msgid "metaclass hint" msgstr "metaclass hint(元類別提示)" -#: ../../reference/datamodel.rst:2482 +#: ../../reference/datamodel.rst:2555 msgid "__prepare__ (metaclass method)" msgstr "__prepare__ (元類別方法)" -#: ../../reference/datamodel.rst:2506 +#: ../../reference/datamodel.rst:2579 msgid "body" msgstr "body" -#: ../../reference/datamodel.rst:2526 +#: ../../reference/datamodel.rst:2599 msgid "__class__ (method cell)" msgstr "__class__ (方法 cell)" -#: ../../reference/datamodel.rst:2526 +#: ../../reference/datamodel.rst:2599 msgid "__classcell__ (class namespace entry)" msgstr "__classcell__ (類別命名空間項目)" -#: ../../reference/datamodel.rst:2824 +#: ../../reference/datamodel.rst:2897 msgid "__bool__() (object method)" msgstr "__bool__() (物件方法)" -#: ../../reference/datamodel.rst:2982 ../../reference/datamodel.rst:3017 +#: ../../reference/datamodel.rst:3055 ../../reference/datamodel.rst:3090 msgid "divmod" msgstr "divmod" -#: ../../reference/datamodel.rst:2982 ../../reference/datamodel.rst:3017 -#: ../../reference/datamodel.rst:3031 +#: ../../reference/datamodel.rst:3055 ../../reference/datamodel.rst:3090 +#: ../../reference/datamodel.rst:3104 msgid "pow" msgstr "pow" -#: ../../reference/datamodel.rst:3080 +#: ../../reference/datamodel.rst:3153 msgid "abs" msgstr "abs" -#: ../../reference/datamodel.rst:3090 +#: ../../reference/datamodel.rst:3163 msgid "int" msgstr "int" -#: ../../reference/datamodel.rst:3090 +#: ../../reference/datamodel.rst:3163 msgid "float" msgstr "float" -#: ../../reference/datamodel.rst:3118 +#: ../../reference/datamodel.rst:3191 msgid "round" msgstr "round" -#: ../../reference/datamodel.rst:3145 +#: ../../reference/datamodel.rst:3218 msgid "with" msgstr "with" -#: ../../reference/datamodel.rst:3145 +#: ../../reference/datamodel.rst:3218 msgid "context manager" msgstr "context manager(情境管理器)" + +#~ msgid ":attr:`~definition.__name__`" +#~ msgstr ":attr:`~definition.__name__`" + +#~ msgid ":attr:`__module__`" +#~ msgstr ":attr:`__module__`" + +#~ msgid ":attr:`~object.__dict__`" +#~ msgstr ":attr:`~object.__dict__`" + +#~ msgid ":attr:`~class.__bases__`" +#~ msgstr ":attr:`~class.__bases__`" + +#~ msgid ":attr:`__type_params__`" +#~ msgstr ":attr:`__type_params__`" + +#~ msgid ":attr:`~class.__static_attributes__`" +#~ msgstr ":attr:`~class.__static_attributes__`" + +#~ msgid ":attr:`__firstlineno__`" +#~ msgstr ":attr:`__firstlineno__`" diff --git a/reference/executionmodel.po b/reference/executionmodel.po index 63aff5c713..4dabdcd7f3 100644 --- a/reference/executionmodel.po +++ b/reference/executionmodel.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -347,9 +347,9 @@ msgstr "" #: ../../reference/executionmodel.rst:227 msgid "" "While annotation scopes have an internal name, that name is not reflected in " -"the :term:`__qualname__ ` of objects defined within the " -"scope. Instead, the :attr:`!__qualname__` of such objects is as if the " -"object were defined in the enclosing scope." +"the :term:`qualified name` of objects defined within the scope. Instead, " +"the :attr:`~definition.__qualname__` of such objects is as if the object " +"were defined in the enclosing scope." msgstr "" #: ../../reference/executionmodel.rst:232 diff --git a/reference/expressions.po b/reference/expressions.po index 366629e070..959ecdaa17 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -138,8 +138,8 @@ msgstr "" #: ../../reference/expressions.rst:107 msgid "" -"The ``__name__`` attribute of nested functions, classes, and type aliases is " -"however not mangled." +"The :attr:`~definition.__name__` attribute of nested functions, classes, and " +"type aliases is however not mangled." msgstr "" #: ../../reference/expressions.rst:110 @@ -541,9 +541,9 @@ msgid "" "function. The execution starts when one of the generator's methods is " "called. At that time, the execution proceeds to the first yield expression, " "where it is suspended again, returning the value of :token:`~python-grammar:" -"expression_list` to the generator's caller, or ``None`` if :token:`~python-" -"grammar:expression_list` is omitted. By suspended, we mean that all local " -"state is retained, including the current bindings of local variables, the " +"yield_list` to the generator's caller, or ``None`` if :token:`~python-" +"grammar:yield_list` is omitted. By suspended, we mean that all local state " +"is retained, including the current bindings of local variables, the " "instruction pointer, the internal evaluation stack, and the state of any " "exception handling. When the execution is resumed by calling one of the " "generator's methods, the function can proceed exactly as if the yield " @@ -667,7 +667,7 @@ msgid "" "meth:`~generator.__next__` method, the current yield expression always " "evaluates to :const:`None`. The execution then continues to the next yield " "expression, where the generator is suspended again, and the value of the :" -"token:`~python-grammar:expression_list` is returned to :meth:`__next__`'s " +"token:`~python-grammar:yield_list` is returned to :meth:`__next__`'s " "caller. If the generator exits without yielding another value, a :exc:" "`StopIteration` exception is raised." msgstr "" @@ -811,17 +811,16 @@ msgid "" "`awaitable` object, and the execution starts when this object is awaited on. " "At that time, the execution proceeds to the first yield expression, where it " "is suspended again, returning the value of :token:`~python-grammar:" -"expression_list` to the awaiting coroutine. As with a generator, suspension " -"means that all local state is retained, including the current bindings of " -"local variables, the instruction pointer, the internal evaluation stack, and " -"the state of any exception handling. When the execution is resumed by " -"awaiting on the next object returned by the asynchronous generator's " -"methods, the function can proceed exactly as if the yield expression were " -"just another external call. The value of the yield expression after resuming " -"depends on the method which resumed the execution. If :meth:`~agen." -"__anext__` is used then the result is :const:`None`. Otherwise, if :meth:" -"`~agen.asend` is used, then the result will be the value passed in to that " -"method." +"yield_list` to the awaiting coroutine. As with a generator, suspension means " +"that all local state is retained, including the current bindings of local " +"variables, the instruction pointer, the internal evaluation stack, and the " +"state of any exception handling. When the execution is resumed by awaiting " +"on the next object returned by the asynchronous generator's methods, the " +"function can proceed exactly as if the yield expression were just another " +"external call. The value of the yield expression after resuming depends on " +"the method which resumed the execution. If :meth:`~agen.__anext__` is used " +"then the result is :const:`None`. Otherwise, if :meth:`~agen.asend` is used, " +"then the result will be the value passed in to that method." msgstr "" #: ../../reference/expressions.rst:710 @@ -886,7 +885,7 @@ msgid "" "asynchronous generator function is resumed with an :meth:`~agen.__anext__` " "method, the current yield expression always evaluates to :const:`None` in " "the returned awaitable, which when run will continue to the next yield " -"expression. The value of the :token:`~python-grammar:expression_list` of the " +"expression. The value of the :token:`~python-grammar:yield_list` of the " "yield expression is the value of the :exc:`StopIteration` exception raised " "by the completing coroutine. If the asynchronous generator exits without " "yielding another value, the awaitable instead raises a :exc:" @@ -1013,18 +1012,23 @@ msgstr "" #: ../../reference/expressions.rst:907 msgid "" -"If the expression list contains at least one comma, it will evaluate to a :" -"class:`tuple` containing the items of the expression list. Otherwise, the " +"If the expression list contains at least one comma, or if any of the " +"expressions are starred, the expression list will evaluate to a :class:" +"`tuple` containing the items of the expression list. Otherwise, the " "expression list will evaluate to the value of the list's sole member." msgstr "" -#: ../../reference/expressions.rst:911 +#: ../../reference/expressions.rst:912 +msgid "Expressions in an expression list may be starred. See :pep:`646`." +msgstr "" + +#: ../../reference/expressions.rst:915 msgid "" "For built-in objects, there are two types of objects that support " "subscription via :meth:`~object.__getitem__`:" msgstr "" -#: ../../reference/expressions.rst:914 +#: ../../reference/expressions.rst:918 msgid "" "Mappings. If the primary is a :term:`mapping`, the expression list must " "evaluate to an object whose value is one of the keys of the mapping, and the " @@ -1032,7 +1036,7 @@ msgid "" "An example of a builtin mapping class is the :class:`dict` class." msgstr "" -#: ../../reference/expressions.rst:918 +#: ../../reference/expressions.rst:922 msgid "" "Sequences. If the primary is a :term:`sequence`, the expression list must " "evaluate to an :class:`int` or a :class:`slice` (as discussed in the " @@ -1040,7 +1044,7 @@ msgid "" "`str`, :class:`list` and :class:`tuple` classes." msgstr "" -#: ../../reference/expressions.rst:923 +#: ../../reference/expressions.rst:927 msgid "" "The formal syntax makes no special provision for negative indices in :term:" "`sequences `. However, built-in sequences all provide a :meth:" @@ -1054,25 +1058,25 @@ msgid "" "explicitly add that support." msgstr "" -#: ../../reference/expressions.rst:937 +#: ../../reference/expressions.rst:941 msgid "" "A :class:`string ` is a special kind of sequence whose items are " "*characters*. A character is not a separate data type but a string of " "exactly one character." msgstr "" -#: ../../reference/expressions.rst:945 +#: ../../reference/expressions.rst:949 msgid "Slicings" msgstr "" -#: ../../reference/expressions.rst:959 +#: ../../reference/expressions.rst:963 msgid "" "A slicing selects a range of items in a sequence object (e.g., a string, " "tuple or list). Slicings may be used as expressions or as targets in " "assignment or :keyword:`del` statements. The syntax for a slicing:" msgstr "" -#: ../../reference/expressions.rst:972 +#: ../../reference/expressions.rst:976 msgid "" "There is ambiguity in the formal syntax here: anything that looks like an " "expression list also looks like a slice list, so any subscription can be " @@ -1082,7 +1086,7 @@ msgid "" "the case if the slice list contains no proper slice)." msgstr "" -#: ../../reference/expressions.rst:984 +#: ../../reference/expressions.rst:988 msgid "" "The semantics for a slicing are as follows. The primary is indexed (using " "the same :meth:`~object.__getitem__` method as normal subscription) with a " @@ -1097,23 +1101,23 @@ msgid "" "missing expressions." msgstr "" -#: ../../reference/expressions.rst:1008 +#: ../../reference/expressions.rst:1012 msgid "Calls" msgstr "" -#: ../../reference/expressions.rst:1010 +#: ../../reference/expressions.rst:1014 msgid "" "A call calls a callable object (e.g., a :term:`function`) with a possibly " "empty series of :term:`arguments `:" msgstr "" -#: ../../reference/expressions.rst:1027 +#: ../../reference/expressions.rst:1031 msgid "" "An optional trailing comma may be present after the positional and keyword " "arguments but does not affect the semantics." msgstr "" -#: ../../reference/expressions.rst:1033 +#: ../../reference/expressions.rst:1037 msgid "" "The primary must evaluate to a callable object (user-defined functions, " "built-in functions, methods of built-in objects, class objects, methods of " @@ -1123,7 +1127,7 @@ msgid "" "formal :term:`parameter` lists." msgstr "" -#: ../../reference/expressions.rst:1041 +#: ../../reference/expressions.rst:1045 msgid "" "If keyword arguments are present, they are first converted to positional " "arguments, as follows. First, a list of unfilled slots is created for the " @@ -1144,7 +1148,7 @@ msgid "" "filled slots is used as the argument list for the call." msgstr "" -#: ../../reference/expressions.rst:1061 +#: ../../reference/expressions.rst:1065 msgid "" "An implementation may provide built-in functions whose positional parameters " "do not have names, even if they are 'named' for the purpose of " @@ -1153,7 +1157,7 @@ msgid "" "`PyArg_ParseTuple` to parse their arguments." msgstr "" -#: ../../reference/expressions.rst:1067 +#: ../../reference/expressions.rst:1071 msgid "" "If there are more positional arguments than there are formal parameter " "slots, a :exc:`TypeError` exception is raised, unless a formal parameter " @@ -1162,7 +1166,7 @@ msgid "" "empty tuple if there were no excess positional arguments)." msgstr "" -#: ../../reference/expressions.rst:1073 +#: ../../reference/expressions.rst:1077 msgid "" "If any keyword argument does not correspond to a formal parameter name, a :" "exc:`TypeError` exception is raised, unless a formal parameter using the " @@ -1172,7 +1176,7 @@ msgid "" "(new) empty dictionary if there were no excess keyword arguments." msgstr "" -#: ../../reference/expressions.rst:1084 +#: ../../reference/expressions.rst:1088 msgid "" "If the syntax ``*expression`` appears in the function call, ``expression`` " "must evaluate to an :term:`iterable`. Elements from these iterables are " @@ -1182,14 +1186,14 @@ msgid "" "*y1*, ..., *yM*, *x3*, *x4*." msgstr "" -#: ../../reference/expressions.rst:1091 +#: ../../reference/expressions.rst:1095 msgid "" "A consequence of this is that although the ``*expression`` syntax may appear " "*after* explicit keyword arguments, it is processed *before* the keyword " "arguments (and any ``**expression`` arguments -- see below). So::" msgstr "" -#: ../../reference/expressions.rst:1095 +#: ../../reference/expressions.rst:1099 msgid "" ">>> def f(a, b):\n" "... print(a, b)\n" @@ -1215,13 +1219,13 @@ msgstr "" ">>> f(1, *(2,))\n" "1 2" -#: ../../reference/expressions.rst:1107 +#: ../../reference/expressions.rst:1111 msgid "" "It is unusual for both keyword arguments and the ``*expression`` syntax to " "be used in the same call, so in practice this confusion does not often arise." msgstr "" -#: ../../reference/expressions.rst:1113 +#: ../../reference/expressions.rst:1117 msgid "" "If the syntax ``**expression`` appears in the function call, ``expression`` " "must evaluate to a :term:`mapping`, the contents of which are treated as " @@ -1230,7 +1234,7 @@ msgid "" "a :exc:`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1119 +#: ../../reference/expressions.rst:1123 msgid "" "When ``**expression`` is used, each key in this mapping must be a string. " "Each value from the mapping is assigned to the first formal parameter " @@ -1242,35 +1246,35 @@ msgid "" "is raised." msgstr "" -#: ../../reference/expressions.rst:1129 +#: ../../reference/expressions.rst:1133 msgid "" "Formal parameters using the syntax ``*identifier`` or ``**identifier`` " "cannot be used as positional argument slots or as keyword argument names." msgstr "" -#: ../../reference/expressions.rst:1132 +#: ../../reference/expressions.rst:1136 msgid "" "Function calls accept any number of ``*`` and ``**`` unpackings, positional " "arguments may follow iterable unpackings (``*``), and keyword arguments may " "follow dictionary unpackings (``**``). Originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1138 +#: ../../reference/expressions.rst:1142 msgid "" "A call always returns some value, possibly ``None``, unless it raises an " "exception. How this value is computed depends on the type of the callable " "object." msgstr "" -#: ../../reference/expressions.rst:1142 +#: ../../reference/expressions.rst:1146 msgid "If it is---" msgstr "" -#: ../../reference/expressions.rst:1144 +#: ../../reference/expressions.rst:1148 msgid "a user-defined function:" msgstr "" -#: ../../reference/expressions.rst:1151 +#: ../../reference/expressions.rst:1155 msgid "" "The code block for the function is executed, passing it the argument list. " "The first thing the code block will do is bind the formal parameters to the " @@ -1279,73 +1283,73 @@ msgid "" "value of the function call." msgstr "" -#: ../../reference/expressions.rst:1157 +#: ../../reference/expressions.rst:1161 msgid "a built-in function or method:" msgstr "" -#: ../../reference/expressions.rst:1168 +#: ../../reference/expressions.rst:1172 msgid "" "The result is up to the interpreter; see :ref:`built-in-funcs` for the " "descriptions of built-in functions and methods." msgstr "" -#: ../../reference/expressions.rst:1171 +#: ../../reference/expressions.rst:1175 msgid "a class object:" msgstr "" -#: ../../reference/expressions.rst:1176 +#: ../../reference/expressions.rst:1180 msgid "A new instance of that class is returned." msgstr "" -#: ../../reference/expressions.rst:1178 +#: ../../reference/expressions.rst:1182 msgid "a class instance method:" msgstr "" -#: ../../reference/expressions.rst:1184 +#: ../../reference/expressions.rst:1188 msgid "" "The corresponding user-defined function is called, with an argument list " "that is one longer than the argument list of the call: the instance becomes " "the first argument." msgstr "" -#: ../../reference/expressions.rst:1188 +#: ../../reference/expressions.rst:1192 msgid "a class instance:" msgstr "" -#: ../../reference/expressions.rst:1193 +#: ../../reference/expressions.rst:1197 msgid "" "The class must define a :meth:`~object.__call__` method; the effect is then " "the same as if that method was called." msgstr "" -#: ../../reference/expressions.rst:1201 ../../reference/expressions.rst:1994 +#: ../../reference/expressions.rst:1205 ../../reference/expressions.rst:2004 msgid "Await expression" msgstr "" -#: ../../reference/expressions.rst:1203 +#: ../../reference/expressions.rst:1207 msgid "" "Suspend the execution of :term:`coroutine` on an :term:`awaitable` object. " "Can only be used inside a :term:`coroutine function`." msgstr "" -#: ../../reference/expressions.rst:1215 +#: ../../reference/expressions.rst:1219 msgid "The power operator" msgstr "" -#: ../../reference/expressions.rst:1221 +#: ../../reference/expressions.rst:1225 msgid "" "The power operator binds more tightly than unary operators on its left; it " "binds less tightly than unary operators on its right. The syntax is:" msgstr "" -#: ../../reference/expressions.rst:1227 +#: ../../reference/expressions.rst:1231 msgid "" "Thus, in an unparenthesized sequence of power and unary operators, the " "operators are evaluated from right to left (this does not constrain the " "evaluation order for the operands): ``-1**2`` results in ``-1``." msgstr "" -#: ../../reference/expressions.rst:1231 +#: ../../reference/expressions.rst:1235 msgid "" "The power operator has the same semantics as the built-in :func:`pow` " "function, when called with two arguments: it yields its left argument raised " @@ -1353,7 +1357,7 @@ msgid "" "converted to a common type, and the result is of that type." msgstr "" -#: ../../reference/expressions.rst:1236 +#: ../../reference/expressions.rst:1240 msgid "" "For int operands, the result has the same type as the operands unless the " "second argument is negative; in that case, all arguments are converted to " @@ -1361,41 +1365,41 @@ msgid "" "``100``, but ``10**-2`` returns ``0.01``." msgstr "" -#: ../../reference/expressions.rst:1241 +#: ../../reference/expressions.rst:1245 msgid "" "Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`. " "Raising a negative number to a fractional power results in a :class:" "`complex` number. (In earlier versions it raised a :exc:`ValueError`.)" msgstr "" -#: ../../reference/expressions.rst:1245 +#: ../../reference/expressions.rst:1249 msgid "" "This operation can be customized using the special :meth:`~object.__pow__` " "and :meth:`~object.__rpow__` methods." msgstr "" -#: ../../reference/expressions.rst:1251 +#: ../../reference/expressions.rst:1255 msgid "Unary arithmetic and bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1257 +#: ../../reference/expressions.rst:1261 msgid "All unary arithmetic and bitwise operations have the same priority:" msgstr "" -#: ../../reference/expressions.rst:1268 +#: ../../reference/expressions.rst:1272 msgid "" "The unary ``-`` (minus) operator yields the negation of its numeric " "argument; the operation can be overridden with the :meth:`~object.__neg__` " "special method." msgstr "" -#: ../../reference/expressions.rst:1276 +#: ../../reference/expressions.rst:1280 msgid "" "The unary ``+`` (plus) operator yields its numeric argument unchanged; the " "operation can be overridden with the :meth:`~object.__pos__` special method." msgstr "" -#: ../../reference/expressions.rst:1283 +#: ../../reference/expressions.rst:1287 msgid "" "The unary ``~`` (invert) operator yields the bitwise inversion of its " "integer argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. " @@ -1403,17 +1407,17 @@ msgid "" "meth:`~object.__invert__` special method." msgstr "" -#: ../../reference/expressions.rst:1292 +#: ../../reference/expressions.rst:1296 msgid "" "In all three cases, if the argument does not have the proper type, a :exc:" "`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1299 +#: ../../reference/expressions.rst:1303 msgid "Binary arithmetic operations" msgstr "" -#: ../../reference/expressions.rst:1303 +#: ../../reference/expressions.rst:1307 msgid "" "The binary arithmetic operations have the conventional priority levels. " "Note that some of these operations also apply to certain non-numeric types. " @@ -1421,7 +1425,7 @@ msgid "" "multiplicative operators and one for additive operators:" msgstr "" -#: ../../reference/expressions.rst:1318 +#: ../../reference/expressions.rst:1322 msgid "" "The ``*`` (multiplication) operator yields the product of its arguments. " "The arguments must either both be numbers, or one argument must be an " @@ -1431,25 +1435,25 @@ msgid "" "an empty sequence." msgstr "" -#: ../../reference/expressions.rst:1324 +#: ../../reference/expressions.rst:1328 msgid "" "This operation can be customized using the special :meth:`~object.__mul__` " "and :meth:`~object.__rmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1331 +#: ../../reference/expressions.rst:1335 msgid "" "The ``@`` (at) operator is intended to be used for matrix multiplication. " "No builtin Python types implement this operator." msgstr "" -#: ../../reference/expressions.rst:1334 +#: ../../reference/expressions.rst:1338 msgid "" "This operation can be customized using the special :meth:`~object." "__matmul__` and :meth:`~object.__rmatmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1345 +#: ../../reference/expressions.rst:1349 msgid "" "The ``/`` (division) and ``//`` (floor division) operators yield the " "quotient of their arguments. The numeric arguments are first converted to a " @@ -1459,7 +1463,7 @@ msgid "" "the :exc:`ZeroDivisionError` exception." msgstr "" -#: ../../reference/expressions.rst:1352 +#: ../../reference/expressions.rst:1356 msgid "" "The division operation can be customized using the special :meth:`~object." "__truediv__` and :meth:`~object.__rtruediv__` methods. The floor division " @@ -1467,7 +1471,7 @@ msgid "" "and :meth:`~object.__rfloordiv__` methods." msgstr "" -#: ../../reference/expressions.rst:1361 +#: ../../reference/expressions.rst:1365 msgid "" "The ``%`` (modulo) operator yields the remainder from the division of the " "first argument by the second. The numeric arguments are first converted to " @@ -1479,7 +1483,7 @@ msgid "" "absolute value of the second operand [#]_." msgstr "" -#: ../../reference/expressions.rst:1370 +#: ../../reference/expressions.rst:1374 msgid "" "The floor division and modulo operators are connected by the following " "identity: ``x == (x//y)*y + (x%y)``. Floor division and modulo are also " @@ -1487,7 +1491,7 @@ msgid "" "y, x%y)``. [#]_." msgstr "" -#: ../../reference/expressions.rst:1375 +#: ../../reference/expressions.rst:1379 msgid "" "In addition to performing the modulo operation on numbers, the ``%`` " "operator is also overloaded by string objects to perform old-style string " @@ -1496,20 +1500,20 @@ msgid "" "formatting`." msgstr "" -#: ../../reference/expressions.rst:1380 +#: ../../reference/expressions.rst:1384 msgid "" "The *modulo* operation can be customized using the special :meth:`~object." "__mod__` and :meth:`~object.__rmod__` methods." msgstr "" -#: ../../reference/expressions.rst:1383 +#: ../../reference/expressions.rst:1387 msgid "" "The floor division operator, the modulo operator, and the :func:`divmod` " "function are not defined for complex numbers. Instead, convert to a " "floating-point number using the :func:`abs` function if appropriate." msgstr "" -#: ../../reference/expressions.rst:1392 +#: ../../reference/expressions.rst:1396 msgid "" "The ``+`` (addition) operator yields the sum of its arguments. The " "arguments must either both be numbers or both be sequences of the same " @@ -1517,40 +1521,40 @@ msgid "" "then added together. In the latter case, the sequences are concatenated." msgstr "" -#: ../../reference/expressions.rst:1397 +#: ../../reference/expressions.rst:1401 msgid "" "This operation can be customized using the special :meth:`~object.__add__` " "and :meth:`~object.__radd__` methods." msgstr "" -#: ../../reference/expressions.rst:1405 +#: ../../reference/expressions.rst:1409 msgid "" "The ``-`` (subtraction) operator yields the difference of its arguments. " "The numeric arguments are first converted to a common type." msgstr "" -#: ../../reference/expressions.rst:1408 +#: ../../reference/expressions.rst:1412 msgid "" "This operation can be customized using the special :meth:`~object.__sub__` " "and :meth:`~object.__rsub__` methods." msgstr "" -#: ../../reference/expressions.rst:1415 +#: ../../reference/expressions.rst:1419 msgid "Shifting operations" msgstr "" -#: ../../reference/expressions.rst:1422 +#: ../../reference/expressions.rst:1426 msgid "" "The shifting operations have lower priority than the arithmetic operations:" msgstr "" -#: ../../reference/expressions.rst:1427 +#: ../../reference/expressions.rst:1431 msgid "" "These operators accept integers as arguments. They shift the first argument " "to the left or right by the number of bits given by the second argument." msgstr "" -#: ../../reference/expressions.rst:1430 +#: ../../reference/expressions.rst:1434 msgid "" "The left shift operation can be customized using the special :meth:`~object." "__lshift__` and :meth:`~object.__rlshift__` methods. The right shift " @@ -1558,46 +1562,46 @@ msgid "" "and :meth:`~object.__rrshift__` methods." msgstr "" -#: ../../reference/expressions.rst:1437 +#: ../../reference/expressions.rst:1441 msgid "" "A right shift by *n* bits is defined as floor division by ``pow(2,n)``. A " "left shift by *n* bits is defined as multiplication with ``pow(2,n)``." msgstr "" -#: ../../reference/expressions.rst:1444 +#: ../../reference/expressions.rst:1448 msgid "Binary bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1448 +#: ../../reference/expressions.rst:1452 msgid "Each of the three bitwise operations has a different priority level:" msgstr "" -#: ../../reference/expressions.rst:1459 +#: ../../reference/expressions.rst:1463 msgid "" "The ``&`` operator yields the bitwise AND of its arguments, which must be " "integers or one of them must be a custom object overriding :meth:`~object." "__and__` or :meth:`~object.__rand__` special methods." msgstr "" -#: ../../reference/expressions.rst:1468 +#: ../../reference/expressions.rst:1472 msgid "" "The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, " "which must be integers or one of them must be a custom object overriding :" "meth:`~object.__xor__` or :meth:`~object.__rxor__` special methods." msgstr "" -#: ../../reference/expressions.rst:1477 +#: ../../reference/expressions.rst:1481 msgid "" "The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which " "must be integers or one of them must be a custom object overriding :meth:" "`~object.__or__` or :meth:`~object.__ror__` special methods." msgstr "" -#: ../../reference/expressions.rst:1485 +#: ../../reference/expressions.rst:1489 msgid "Comparisons" msgstr "" -#: ../../reference/expressions.rst:1497 +#: ../../reference/expressions.rst:1501 msgid "" "Unlike C, all comparison operations in Python have the same priority, which " "is lower than that of any arithmetic, shifting or bitwise operation. Also " @@ -1605,14 +1609,14 @@ msgid "" "conventional in mathematics:" msgstr "" -#: ../../reference/expressions.rst:1507 +#: ../../reference/expressions.rst:1511 msgid "" "Comparisons yield boolean values: ``True`` or ``False``. Custom :dfn:`rich " "comparison methods` may return non-boolean values. In this case Python will " "call :func:`bool` on such value in boolean contexts." msgstr "" -#: ../../reference/expressions.rst:1513 +#: ../../reference/expressions.rst:1517 msgid "" "Comparisons can be chained arbitrarily, e.g., ``x < y <= z`` is equivalent " "to ``x < y and y <= z``, except that ``y`` is evaluated only once (but in " @@ -1620,7 +1624,7 @@ msgid "" "false)." msgstr "" -#: ../../reference/expressions.rst:1517 +#: ../../reference/expressions.rst:1521 msgid "" "Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*, " "*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y opN " @@ -1628,24 +1632,24 @@ msgid "" "each expression is evaluated at most once." msgstr "" -#: ../../reference/expressions.rst:1522 +#: ../../reference/expressions.rst:1526 msgid "" "Note that ``a op1 b op2 c`` doesn't imply any kind of comparison between *a* " "and *c*, so that, e.g., ``x < y > z`` is perfectly legal (though perhaps not " "pretty)." msgstr "" -#: ../../reference/expressions.rst:1529 +#: ../../reference/expressions.rst:1533 msgid "Value comparisons" msgstr "" -#: ../../reference/expressions.rst:1531 +#: ../../reference/expressions.rst:1535 msgid "" "The operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare the " "values of two objects. The objects do not need to have the same type." msgstr "" -#: ../../reference/expressions.rst:1534 +#: ../../reference/expressions.rst:1538 msgid "" "Chapter :ref:`objects` states that objects have a value (in addition to type " "and identity). The value of an object is a rather abstract notion in " @@ -1657,7 +1661,7 @@ msgid "" "indirectly, by means of their comparison implementation." msgstr "" -#: ../../reference/expressions.rst:1543 +#: ../../reference/expressions.rst:1547 msgid "" "Because all types are (direct or indirect) subtypes of :class:`object`, they " "inherit the default comparison behavior from :class:`object`. Types can " @@ -1665,7 +1669,7 @@ msgid "" "methods` like :meth:`~object.__lt__`, described in :ref:`customization`." msgstr "" -#: ../../reference/expressions.rst:1549 +#: ../../reference/expressions.rst:1553 msgid "" "The default behavior for equality comparison (``==`` and ``!=``) is based on " "the identity of the objects. Hence, equality comparison of instances with " @@ -1675,14 +1679,14 @@ msgid "" "``x is y`` implies ``x == y``)." msgstr "" -#: ../../reference/expressions.rst:1556 +#: ../../reference/expressions.rst:1560 msgid "" "A default order comparison (``<``, ``>``, ``<=``, and ``>=``) is not " "provided; an attempt raises :exc:`TypeError`. A motivation for this default " "behavior is the lack of a similar invariant as for equality." msgstr "" -#: ../../reference/expressions.rst:1560 +#: ../../reference/expressions.rst:1564 msgid "" "The behavior of the default equality comparison, that instances with " "different identities are always unequal, may be in contrast to what types " @@ -1691,13 +1695,13 @@ msgid "" "in fact, a number of built-in types have done that." msgstr "" -#: ../../reference/expressions.rst:1566 +#: ../../reference/expressions.rst:1570 msgid "" "The following list describes the comparison behavior of the most important " "built-in types." msgstr "" -#: ../../reference/expressions.rst:1569 +#: ../../reference/expressions.rst:1573 msgid "" "Numbers of built-in numeric types (:ref:`typesnumeric`) and of the standard " "library types :class:`fractions.Fraction` and :class:`decimal.Decimal` can " @@ -1707,7 +1711,7 @@ msgid "" "of precision." msgstr "" -#: ../../reference/expressions.rst:1576 +#: ../../reference/expressions.rst:1580 msgid "" "The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are " "special. Any ordered comparison of a number to a not-a-number value is " @@ -1717,32 +1721,32 @@ msgid "" "is compliant with IEEE 754." msgstr "" -#: ../../reference/expressions.rst:1583 +#: ../../reference/expressions.rst:1587 msgid "" "``None`` and :data:`NotImplemented` are singletons. :PEP:`8` advises that " "comparisons for singletons should always be done with ``is`` or ``is not``, " "never the equality operators." msgstr "" -#: ../../reference/expressions.rst:1587 +#: ../../reference/expressions.rst:1591 msgid "" "Binary sequences (instances of :class:`bytes` or :class:`bytearray`) can be " "compared within and across their types. They compare lexicographically " "using the numeric values of their elements." msgstr "" -#: ../../reference/expressions.rst:1591 +#: ../../reference/expressions.rst:1595 msgid "" "Strings (instances of :class:`str`) compare lexicographically using the " "numerical Unicode code points (the result of the built-in function :func:" "`ord`) of their characters. [#]_" msgstr "" -#: ../../reference/expressions.rst:1595 +#: ../../reference/expressions.rst:1599 msgid "Strings and binary sequences cannot be directly compared." msgstr "" -#: ../../reference/expressions.rst:1597 +#: ../../reference/expressions.rst:1601 msgid "" "Sequences (instances of :class:`tuple`, :class:`list`, or :class:`range`) " "can be compared only within each of their types, with the restriction that " @@ -1751,7 +1755,7 @@ msgid "" "raises :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1603 +#: ../../reference/expressions.rst:1607 msgid "" "Sequences compare lexicographically using comparison of corresponding " "elements. The built-in containers typically assume identical objects are " @@ -1759,19 +1763,19 @@ msgid "" "objects to improve performance and to maintain their internal invariants." msgstr "" -#: ../../reference/expressions.rst:1608 +#: ../../reference/expressions.rst:1612 msgid "" "Lexicographical comparison between built-in collections works as follows:" msgstr "" -#: ../../reference/expressions.rst:1610 +#: ../../reference/expressions.rst:1614 msgid "" "For two collections to compare equal, they must be of the same type, have " "the same length, and each pair of corresponding elements must compare equal " "(for example, ``[1,2] == (1,2)`` is false because the type is not the same)." msgstr "" -#: ../../reference/expressions.rst:1615 +#: ../../reference/expressions.rst:1619 msgid "" "Collections that support order comparison are ordered the same as their " "first unequal elements (for example, ``[1,2,x] <= [1,2,y]`` has the same " @@ -1780,25 +1784,25 @@ msgid "" "true)." msgstr "" -#: ../../reference/expressions.rst:1621 +#: ../../reference/expressions.rst:1625 msgid "" "Mappings (instances of :class:`dict`) compare equal if and only if they have " "equal ``(key, value)`` pairs. Equality comparison of the keys and values " "enforces reflexivity." msgstr "" -#: ../../reference/expressions.rst:1625 +#: ../../reference/expressions.rst:1629 msgid "" "Order comparisons (``<``, ``>``, ``<=``, and ``>=``) raise :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1627 +#: ../../reference/expressions.rst:1631 msgid "" "Sets (instances of :class:`set` or :class:`frozenset`) can be compared " "within and across their types." msgstr "" -#: ../../reference/expressions.rst:1630 +#: ../../reference/expressions.rst:1634 msgid "" "They define order comparison operators to mean subset and superset tests. " "Those relations do not define total orderings (for example, the two sets " @@ -1809,110 +1813,110 @@ msgid "" "sets as inputs)." msgstr "" -#: ../../reference/expressions.rst:1638 +#: ../../reference/expressions.rst:1642 msgid "Comparison of sets enforces reflexivity of its elements." msgstr "" -#: ../../reference/expressions.rst:1640 +#: ../../reference/expressions.rst:1644 msgid "" "Most other built-in types have no comparison methods implemented, so they " "inherit the default comparison behavior." msgstr "" -#: ../../reference/expressions.rst:1643 +#: ../../reference/expressions.rst:1647 msgid "" "User-defined classes that customize their comparison behavior should follow " "some consistency rules, if possible:" msgstr "" -#: ../../reference/expressions.rst:1646 +#: ../../reference/expressions.rst:1650 msgid "" "Equality comparison should be reflexive. In other words, identical objects " "should compare equal:" msgstr "" -#: ../../reference/expressions.rst:1649 +#: ../../reference/expressions.rst:1653 msgid "``x is y`` implies ``x == y``" msgstr "" -#: ../../reference/expressions.rst:1651 +#: ../../reference/expressions.rst:1655 msgid "" "Comparison should be symmetric. In other words, the following expressions " "should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1654 +#: ../../reference/expressions.rst:1658 msgid "``x == y`` and ``y == x``" msgstr "``x == y`` 和 ``y == x``" -#: ../../reference/expressions.rst:1656 +#: ../../reference/expressions.rst:1660 msgid "``x != y`` and ``y != x``" msgstr "``x != y`` 和 ``y != x``" -#: ../../reference/expressions.rst:1658 +#: ../../reference/expressions.rst:1662 msgid "``x < y`` and ``y > x``" msgstr "``x < y`` 和 ``y > x``" -#: ../../reference/expressions.rst:1660 +#: ../../reference/expressions.rst:1664 msgid "``x <= y`` and ``y >= x``" msgstr "``x <= y`` 和 ``y >= x``" -#: ../../reference/expressions.rst:1662 +#: ../../reference/expressions.rst:1666 msgid "" "Comparison should be transitive. The following (non-exhaustive) examples " "illustrate that:" msgstr "" -#: ../../reference/expressions.rst:1665 +#: ../../reference/expressions.rst:1669 msgid "``x > y and y > z`` implies ``x > z``" msgstr "``x > y and y > z`` 暗示了 ``x > z``" -#: ../../reference/expressions.rst:1667 +#: ../../reference/expressions.rst:1671 msgid "``x < y and y <= z`` implies ``x < z``" msgstr "``x < y and y <= z`` 暗示了 ``x < z``" -#: ../../reference/expressions.rst:1669 +#: ../../reference/expressions.rst:1673 msgid "" "Inverse comparison should result in the boolean negation. In other words, " "the following expressions should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1672 +#: ../../reference/expressions.rst:1676 msgid "``x == y`` and ``not x != y``" msgstr "``x == y`` 和 ``not x != y``" -#: ../../reference/expressions.rst:1674 +#: ../../reference/expressions.rst:1678 msgid "``x < y`` and ``not x >= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1676 +#: ../../reference/expressions.rst:1680 msgid "``x > y`` and ``not x <= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1678 +#: ../../reference/expressions.rst:1682 msgid "" "The last two expressions apply to totally ordered collections (e.g. to " "sequences, but not to sets or mappings). See also the :func:`~functools." "total_ordering` decorator." msgstr "" -#: ../../reference/expressions.rst:1682 +#: ../../reference/expressions.rst:1686 msgid "" "The :func:`hash` result should be consistent with equality. Objects that are " "equal should either have the same hash value, or be marked as unhashable." msgstr "" -#: ../../reference/expressions.rst:1686 +#: ../../reference/expressions.rst:1690 msgid "" "Python does not enforce these consistency rules. In fact, the not-a-number " "values are an example for not following these rules." msgstr "" -#: ../../reference/expressions.rst:1695 +#: ../../reference/expressions.rst:1699 msgid "Membership test operations" msgstr "" -#: ../../reference/expressions.rst:1697 +#: ../../reference/expressions.rst:1701 msgid "" "The operators :keyword:`in` and :keyword:`not in` test for membership. ``x " "in s`` evaluates to ``True`` if *x* is a member of *s*, and ``False`` " @@ -1923,7 +1927,7 @@ msgid "" "expression ``x in y`` is equivalent to ``any(x is e or x == e for e in y)``." msgstr "" -#: ../../reference/expressions.rst:1705 +#: ../../reference/expressions.rst:1709 msgid "" "For the string and bytes types, ``x in y`` is ``True`` if and only if *x* is " "a substring of *y*. An equivalent test is ``y.find(x) != -1``. Empty " @@ -1931,14 +1935,14 @@ msgid "" "``\"\" in \"abc\"`` will return ``True``." msgstr "" -#: ../../reference/expressions.rst:1710 +#: ../../reference/expressions.rst:1714 msgid "" "For user-defined classes which define the :meth:`~object.__contains__` " "method, ``x in y`` returns ``True`` if ``y.__contains__(x)`` returns a true " "value, and ``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1714 +#: ../../reference/expressions.rst:1718 msgid "" "For user-defined classes which do not define :meth:`~object.__contains__` " "but do define :meth:`~object.__iter__`, ``x in y`` is ``True`` if some value " @@ -1947,7 +1951,7 @@ msgid "" "it is as if :keyword:`in` raised that exception." msgstr "" -#: ../../reference/expressions.rst:1720 +#: ../../reference/expressions.rst:1724 msgid "" "Lastly, the old-style iteration protocol is tried: if a class defines :meth:" "`~object.__getitem__`, ``x in y`` is ``True`` if and only if there is a non-" @@ -1956,17 +1960,17 @@ msgid "" "exception is raised, it is as if :keyword:`in` raised that exception)." msgstr "" -#: ../../reference/expressions.rst:1732 +#: ../../reference/expressions.rst:1736 msgid "" "The operator :keyword:`not in` is defined to have the inverse truth value " "of :keyword:`in`." msgstr "" -#: ../../reference/expressions.rst:1745 +#: ../../reference/expressions.rst:1749 msgid "Identity comparisons" msgstr "" -#: ../../reference/expressions.rst:1747 +#: ../../reference/expressions.rst:1751 msgid "" "The operators :keyword:`is` and :keyword:`is not` test for an object's " "identity: ``x is y`` is true if and only if *x* and *y* are the same " @@ -1974,11 +1978,11 @@ msgid "" "``x is not y`` yields the inverse truth value. [#]_" msgstr "" -#: ../../reference/expressions.rst:1759 +#: ../../reference/expressions.rst:1763 msgid "Boolean operations" msgstr "" -#: ../../reference/expressions.rst:1770 +#: ../../reference/expressions.rst:1774 msgid "" "In the context of Boolean operations, and also when expressions are used by " "control flow statements, the following values are interpreted as false: " @@ -1989,25 +1993,25 @@ msgid "" "__bool__` method." msgstr "" -#: ../../reference/expressions.rst:1779 +#: ../../reference/expressions.rst:1783 msgid "" "The operator :keyword:`not` yields ``True`` if its argument is false, " "``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1784 +#: ../../reference/expressions.rst:1788 msgid "" "The expression ``x and y`` first evaluates *x*; if *x* is false, its value " "is returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1789 +#: ../../reference/expressions.rst:1793 msgid "" "The expression ``x or y`` first evaluates *x*; if *x* is true, its value is " "returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1792 +#: ../../reference/expressions.rst:1796 msgid "" "Note that neither :keyword:`and` nor :keyword:`or` restrict the value and " "type they return to ``False`` and ``True``, but rather return the last " @@ -2018,11 +2022,11 @@ msgid "" "argument (for example, ``not 'foo'`` produces ``False`` rather than ``''``.)" msgstr "" -#: ../../reference/expressions.rst:1808 +#: ../../reference/expressions.rst:1813 msgid "Assignment expressions" msgstr "" -#: ../../reference/expressions.rst:1813 +#: ../../reference/expressions.rst:1818 msgid "" "An assignment expression (sometimes also called a \"named expression\" or " "\"walrus\") assigns an :token:`~python-grammar:expression` to an :token:" @@ -2030,11 +2034,11 @@ msgid "" "`~python-grammar:expression`." msgstr "" -#: ../../reference/expressions.rst:1818 +#: ../../reference/expressions.rst:1823 msgid "One common use case is when handling matched regular expressions:" msgstr "" -#: ../../reference/expressions.rst:1820 +#: ../../reference/expressions.rst:1825 msgid "" "if matching := pattern.search(data):\n" " do_something(matching)" @@ -2042,11 +2046,11 @@ msgstr "" "if matching := pattern.search(data):\n" " do_something(matching)" -#: ../../reference/expressions.rst:1825 +#: ../../reference/expressions.rst:1830 msgid "Or, when processing a file stream in chunks:" msgstr "" -#: ../../reference/expressions.rst:1827 +#: ../../reference/expressions.rst:1832 msgid "" "while chunk := file.read(9000):\n" " process(chunk)" @@ -2054,7 +2058,7 @@ msgstr "" "while chunk := file.read(9000):\n" " process(chunk)" -#: ../../reference/expressions.rst:1832 +#: ../../reference/expressions.rst:1837 msgid "" "Assignment expressions must be surrounded by parentheses when used as " "expression statements and when used as sub-expressions in slicing, " @@ -2064,36 +2068,36 @@ msgid "" "and ``while`` statements." msgstr "" -#: ../../reference/expressions.rst:1840 +#: ../../reference/expressions.rst:1845 msgid "See :pep:`572` for more details about assignment expressions." msgstr "" -#: ../../reference/expressions.rst:1847 +#: ../../reference/expressions.rst:1852 msgid "Conditional expressions" msgstr "" -#: ../../reference/expressions.rst:1859 +#: ../../reference/expressions.rst:1864 msgid "" "Conditional expressions (sometimes called a \"ternary operator\") have the " "lowest priority of all Python operations." msgstr "" -#: ../../reference/expressions.rst:1862 +#: ../../reference/expressions.rst:1867 msgid "" "The expression ``x if C else y`` first evaluates the condition, *C* rather " "than *x*. If *C* is true, *x* is evaluated and its value is returned; " "otherwise, *y* is evaluated and its value is returned." msgstr "" -#: ../../reference/expressions.rst:1866 +#: ../../reference/expressions.rst:1871 msgid "See :pep:`308` for more details about conditional expressions." msgstr "" -#: ../../reference/expressions.rst:1873 +#: ../../reference/expressions.rst:1878 msgid "Lambdas" msgstr "" -#: ../../reference/expressions.rst:1884 +#: ../../reference/expressions.rst:1889 msgid "" "Lambda expressions (sometimes called lambda forms) are used to create " "anonymous functions. The expression ``lambda parameters: expression`` yields " @@ -2101,7 +2105,7 @@ msgid "" "defined with:" msgstr "" -#: ../../reference/expressions.rst:1888 +#: ../../reference/expressions.rst:1893 msgid "" "def (parameters):\n" " return expression" @@ -2109,25 +2113,25 @@ msgstr "" "def (parameters):\n" " return expression" -#: ../../reference/expressions.rst:1893 +#: ../../reference/expressions.rst:1898 msgid "" "See section :ref:`function` for the syntax of parameter lists. Note that " "functions created with lambda expressions cannot contain statements or " "annotations." msgstr "" -#: ../../reference/expressions.rst:1901 +#: ../../reference/expressions.rst:1906 msgid "Expression lists" msgstr "" -#: ../../reference/expressions.rst:1915 +#: ../../reference/expressions.rst:1922 msgid "" "Except when part of a list or set display, an expression list containing at " "least one comma yields a tuple. The length of the tuple is the number of " "expressions in the list. The expressions are evaluated from left to right." msgstr "" -#: ../../reference/expressions.rst:1924 +#: ../../reference/expressions.rst:1931 msgid "" "An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be " "an :term:`iterable`. The iterable is expanded into a sequence of items, " @@ -2135,12 +2139,16 @@ msgid "" "unpacking." msgstr "" -#: ../../reference/expressions.rst:1929 +#: ../../reference/expressions.rst:1936 msgid "" "Iterable unpacking in expression lists, originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1934 +#: ../../reference/expressions.rst:1939 +msgid "Any item in an expression list may be starred. See :pep:`646`." +msgstr "" + +#: ../../reference/expressions.rst:1944 msgid "" "A trailing comma is required only to create a one-item tuple, such as ``1," "``; it is optional in all other cases. A single expression without a " @@ -2149,24 +2157,24 @@ msgid "" "``()``.)" msgstr "" -#: ../../reference/expressions.rst:1945 +#: ../../reference/expressions.rst:1955 msgid "Evaluation order" msgstr "" -#: ../../reference/expressions.rst:1949 +#: ../../reference/expressions.rst:1959 msgid "" "Python evaluates expressions from left to right. Notice that while " "evaluating an assignment, the right-hand side is evaluated before the left-" "hand side." msgstr "" -#: ../../reference/expressions.rst:1952 +#: ../../reference/expressions.rst:1962 msgid "" "In the following lines, expressions will be evaluated in the arithmetic " "order of their suffixes::" msgstr "" -#: ../../reference/expressions.rst:1955 +#: ../../reference/expressions.rst:1965 msgid "" "expr1, expr2, expr3, expr4\n" "(expr1, expr2, expr3, expr4)\n" @@ -2182,11 +2190,11 @@ msgstr "" "expr1(expr2, expr3, *expr4, **expr5)\n" "expr3, expr4 = expr1, expr2" -#: ../../reference/expressions.rst:1966 +#: ../../reference/expressions.rst:1976 msgid "Operator precedence" msgstr "" -#: ../../reference/expressions.rst:1971 +#: ../../reference/expressions.rst:1981 msgid "" "The following table summarizes the operator precedence in Python, from " "highest precedence (most binding) to lowest precedence (least binding). " @@ -2196,176 +2204,176 @@ msgid "" "group from right to left)." msgstr "" -#: ../../reference/expressions.rst:1977 +#: ../../reference/expressions.rst:1987 msgid "" "Note that comparisons, membership tests, and identity tests, all have the " "same precedence and have a left-to-right chaining feature as described in " "the :ref:`comparisons` section." msgstr "" -#: ../../reference/expressions.rst:1983 +#: ../../reference/expressions.rst:1993 msgid "Operator" msgstr "" -#: ../../reference/expressions.rst:1983 +#: ../../reference/expressions.rst:1993 msgid "Description" msgstr "描述" -#: ../../reference/expressions.rst:1985 +#: ../../reference/expressions.rst:1995 msgid "``(expressions...)``," msgstr "``(expressions...)``," -#: ../../reference/expressions.rst:1987 +#: ../../reference/expressions.rst:1997 msgid "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" msgstr "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" -#: ../../reference/expressions.rst:1985 +#: ../../reference/expressions.rst:1995 msgid "" "Binding or parenthesized expression, list display, dictionary display, set " "display" msgstr "" -#: ../../reference/expressions.rst:1991 +#: ../../reference/expressions.rst:2001 msgid "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" msgstr "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" -#: ../../reference/expressions.rst:1991 +#: ../../reference/expressions.rst:2001 msgid "Subscription, slicing, call, attribute reference" msgstr "" -#: ../../reference/expressions.rst:1994 +#: ../../reference/expressions.rst:2004 msgid ":keyword:`await x `" msgstr ":keyword:`await x `" -#: ../../reference/expressions.rst:1996 +#: ../../reference/expressions.rst:2006 msgid "``**``" msgstr "``**``" -#: ../../reference/expressions.rst:1996 +#: ../../reference/expressions.rst:2006 msgid "Exponentiation [#]_" msgstr "" -#: ../../reference/expressions.rst:1998 +#: ../../reference/expressions.rst:2008 msgid "``+x``, ``-x``, ``~x``" msgstr "``+x``, ``-x``, ``~x``" -#: ../../reference/expressions.rst:1998 +#: ../../reference/expressions.rst:2008 msgid "Positive, negative, bitwise NOT" msgstr "" -#: ../../reference/expressions.rst:2000 +#: ../../reference/expressions.rst:2010 msgid "``*``, ``@``, ``/``, ``//``, ``%``" msgstr "``*``, ``@``, ``/``, ``//``, ``%``" -#: ../../reference/expressions.rst:2000 +#: ../../reference/expressions.rst:2010 msgid "" "Multiplication, matrix multiplication, division, floor division, remainder " "[#]_" msgstr "" -#: ../../reference/expressions.rst:2004 +#: ../../reference/expressions.rst:2014 msgid "``+``, ``-``" msgstr "``+``, ``-``" -#: ../../reference/expressions.rst:2004 +#: ../../reference/expressions.rst:2014 msgid "Addition and subtraction" msgstr "" -#: ../../reference/expressions.rst:2006 +#: ../../reference/expressions.rst:2016 msgid "``<<``, ``>>``" msgstr "``<<``, ``>>``" -#: ../../reference/expressions.rst:2006 +#: ../../reference/expressions.rst:2016 msgid "Shifts" msgstr "" -#: ../../reference/expressions.rst:2008 +#: ../../reference/expressions.rst:2018 msgid "``&``" msgstr "``&``" -#: ../../reference/expressions.rst:2008 +#: ../../reference/expressions.rst:2018 msgid "Bitwise AND" msgstr "" -#: ../../reference/expressions.rst:2010 +#: ../../reference/expressions.rst:2020 msgid "``^``" msgstr "``^``" -#: ../../reference/expressions.rst:2010 +#: ../../reference/expressions.rst:2020 msgid "Bitwise XOR" msgstr "" -#: ../../reference/expressions.rst:2012 +#: ../../reference/expressions.rst:2022 msgid "``|``" msgstr "``|``" -#: ../../reference/expressions.rst:2012 +#: ../../reference/expressions.rst:2022 msgid "Bitwise OR" msgstr "" -#: ../../reference/expressions.rst:2014 +#: ../../reference/expressions.rst:2024 msgid "" ":keyword:`in`, :keyword:`not in`, :keyword:`is`, :keyword:`is not`, ``<``, " "``<=``, ``>``, ``>=``, ``!=``, ``==``" msgstr "" -#: ../../reference/expressions.rst:2014 +#: ../../reference/expressions.rst:2024 msgid "Comparisons, including membership tests and identity tests" msgstr "" -#: ../../reference/expressions.rst:2018 +#: ../../reference/expressions.rst:2028 msgid ":keyword:`not x `" msgstr ":keyword:`not x `" -#: ../../reference/expressions.rst:2018 +#: ../../reference/expressions.rst:2028 msgid "Boolean NOT" msgstr "" -#: ../../reference/expressions.rst:2020 +#: ../../reference/expressions.rst:2030 msgid ":keyword:`and`" msgstr ":keyword:`and`" -#: ../../reference/expressions.rst:2020 +#: ../../reference/expressions.rst:2030 msgid "Boolean AND" msgstr "" -#: ../../reference/expressions.rst:2022 +#: ../../reference/expressions.rst:2032 msgid ":keyword:`or`" msgstr ":keyword:`or`" -#: ../../reference/expressions.rst:2022 +#: ../../reference/expressions.rst:2032 msgid "Boolean OR" msgstr "" -#: ../../reference/expressions.rst:2024 +#: ../../reference/expressions.rst:2034 msgid ":keyword:`if ` -- :keyword:`!else`" msgstr ":keyword:`if ` -- :keyword:`!else`" -#: ../../reference/expressions.rst:2024 +#: ../../reference/expressions.rst:2034 msgid "Conditional expression" msgstr "" -#: ../../reference/expressions.rst:2026 +#: ../../reference/expressions.rst:2036 msgid ":keyword:`lambda`" msgstr ":keyword:`lambda`" -#: ../../reference/expressions.rst:2026 +#: ../../reference/expressions.rst:2036 msgid "Lambda expression" msgstr "" -#: ../../reference/expressions.rst:2028 +#: ../../reference/expressions.rst:2038 msgid "``:=``" msgstr "``:=``" -#: ../../reference/expressions.rst:2028 +#: ../../reference/expressions.rst:2038 msgid "Assignment expression" msgstr "" -#: ../../reference/expressions.rst:2033 +#: ../../reference/expressions.rst:2043 msgid "Footnotes" msgstr "註解" -#: ../../reference/expressions.rst:2034 +#: ../../reference/expressions.rst:2044 msgid "" "While ``abs(x%y) < abs(y)`` is true mathematically, for floats it may not be " "true numerically due to roundoff. For example, and assuming a platform on " @@ -2377,7 +2385,7 @@ msgid "" "approach is more appropriate depends on the application." msgstr "" -#: ../../reference/expressions.rst:2043 +#: ../../reference/expressions.rst:2053 msgid "" "If x is very close to an exact integer multiple of y, it's possible for ``x//" "y`` to be one larger than ``(x-x%y)//y`` due to rounding. In such cases, " @@ -2385,7 +2393,7 @@ msgid "" "* y + x % y`` be very close to ``x``." msgstr "" -#: ../../reference/expressions.rst:2048 +#: ../../reference/expressions.rst:2058 msgid "" "The Unicode standard distinguishes between :dfn:`code points` (e.g. U+0041) " "and :dfn:`abstract characters` (e.g. \"LATIN CAPITAL LETTER A\"). While most " @@ -2399,7 +2407,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: ../../reference/expressions.rst:2059 +#: ../../reference/expressions.rst:2069 msgid "" "The comparison operators on strings compare at the level of Unicode code " "points. This may be counter-intuitive to humans. For example, ``\"\\u00C7\" " @@ -2407,13 +2415,13 @@ msgid "" "same abstract character \"LATIN CAPITAL LETTER C WITH CEDILLA\"." msgstr "" -#: ../../reference/expressions.rst:2064 +#: ../../reference/expressions.rst:2074 msgid "" "To compare strings at the level of abstract characters (that is, in a way " "intuitive to humans), use :func:`unicodedata.normalize`." msgstr "" -#: ../../reference/expressions.rst:2067 +#: ../../reference/expressions.rst:2077 msgid "" "Due to automatic garbage-collection, free lists, and the dynamic nature of " "descriptors, you may notice seemingly unusual behaviour in certain uses of " @@ -2421,22 +2429,22 @@ msgid "" "instance methods, or constants. Check their documentation for more info." msgstr "" -#: ../../reference/expressions.rst:2072 +#: ../../reference/expressions.rst:2082 msgid "" "The power operator ``**`` binds less tightly than an arithmetic or bitwise " "unary operator on its right, that is, ``2**-1`` is ``0.5``." msgstr "" -#: ../../reference/expressions.rst:2075 +#: ../../reference/expressions.rst:2085 msgid "" "The ``%`` operator is also used for string formatting; the same precedence " "applies." msgstr "" #: ../../reference/expressions.rst:8 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1761 -#: ../../reference/expressions.rst:1849 ../../reference/expressions.rst:1875 -#: ../../reference/expressions.rst:1903 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1765 +#: ../../reference/expressions.rst:1805 ../../reference/expressions.rst:1854 +#: ../../reference/expressions.rst:1880 ../../reference/expressions.rst:1908 msgid "expression" msgstr "" @@ -2444,8 +2452,8 @@ msgstr "" msgid "BNF" msgstr "BNF" -#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1253 -#: ../../reference/expressions.rst:1301 +#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1257 +#: ../../reference/expressions.rst:1305 msgid "arithmetic" msgstr "" @@ -2468,8 +2476,8 @@ msgstr "" #: ../../reference/expressions.rst:74 ../../reference/expressions.rst:569 #: ../../reference/expressions.rst:624 ../../reference/expressions.rst:753 #: ../../reference/expressions.rst:805 ../../reference/expressions.rst:851 -#: ../../reference/expressions.rst:1290 ../../reference/expressions.rst:1339 -#: ../../reference/expressions.rst:1435 +#: ../../reference/expressions.rst:1294 ../../reference/expressions.rst:1343 +#: ../../reference/expressions.rst:1439 msgid "exception" msgstr "" @@ -2510,10 +2518,10 @@ msgstr "type(型別)" #: ../../reference/expressions.rst:372 ../../reference/expressions.rst:393 #: ../../reference/expressions.rst:557 ../../reference/expressions.rst:743 #: ../../reference/expressions.rst:851 ../../reference/expressions.rst:880 -#: ../../reference/expressions.rst:953 ../../reference/expressions.rst:997 -#: ../../reference/expressions.rst:1145 ../../reference/expressions.rst:1158 -#: ../../reference/expressions.rst:1172 ../../reference/expressions.rst:1179 -#: ../../reference/expressions.rst:1726 ../../reference/expressions.rst:1913 +#: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1149 ../../reference/expressions.rst:1162 +#: ../../reference/expressions.rst:1176 ../../reference/expressions.rst:1183 +#: ../../reference/expressions.rst:1730 ../../reference/expressions.rst:1920 msgid "object" msgstr "object(物件)" @@ -2522,7 +2530,7 @@ msgid "parenthesized form" msgstr "" #: ../../reference/expressions.rst:162 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:997 +#: ../../reference/expressions.rst:1001 msgid "() (parentheses)" msgstr "() (圓括號)" @@ -2535,18 +2543,18 @@ msgid "empty" msgstr "" #: ../../reference/expressions.rst:175 ../../reference/expressions.rst:880 -#: ../../reference/expressions.rst:953 ../../reference/expressions.rst:1913 +#: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1920 msgid "tuple" msgstr "" -#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1932 +#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1942 msgid "comma" msgstr "" #: ../../reference/expressions.rst:181 ../../reference/expressions.rst:275 #: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 -#: ../../reference/expressions.rst:947 ../../reference/expressions.rst:997 -#: ../../reference/expressions.rst:1903 +#: ../../reference/expressions.rst:951 ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1908 msgid ", (comma)" msgstr ", (逗號)" @@ -2563,7 +2571,7 @@ msgstr "for" msgid "in comprehensions" msgstr "於 comprehensions(綜合運算)" -#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1849 +#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1854 msgid "if" msgstr "if" @@ -2571,13 +2579,13 @@ msgstr "if" msgid "async for" msgstr "async for" -#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1197 +#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1201 msgid "await" msgstr "await" #: ../../reference/expressions.rst:275 ../../reference/expressions.rst:851 -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:953 -#: ../../reference/expressions.rst:1903 +#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:957 +#: ../../reference/expressions.rst:1908 msgid "list" msgstr "list(串列)" @@ -2595,7 +2603,7 @@ msgid "list expression" msgstr "list expression(串列運算式)" #: ../../reference/expressions.rst:275 ../../reference/expressions.rst:301 -#: ../../reference/expressions.rst:1903 +#: ../../reference/expressions.rst:1908 msgid "expression list" msgstr "expression list(運算式串列)" @@ -2632,8 +2640,8 @@ msgstr "key/value pair(鍵/值對)" msgid "dictionary expression" msgstr "dictionary expression(字典運算式)" -#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:947 -#: ../../reference/expressions.rst:1875 +#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:951 +#: ../../reference/expressions.rst:1880 msgid ": (colon)" msgstr ": (冒號)" @@ -2645,13 +2653,13 @@ msgstr "於字典運算式" msgid "in dictionary displays" msgstr "於字典顯示" -#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1080 -#: ../../reference/expressions.rst:1920 +#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1084 +#: ../../reference/expressions.rst:1927 msgid "unpacking" msgstr "unpacking(解包)" -#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1110 -#: ../../reference/expressions.rst:1217 +#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1114 +#: ../../reference/expressions.rst:1221 msgid "**" msgstr "**" @@ -2668,7 +2676,7 @@ msgstr "generator(產生器)" msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1197 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1201 msgid "keyword" msgstr "keyword(關鍵字)" @@ -2680,8 +2688,8 @@ msgstr "yield" msgid "from" msgstr "from" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1145 -#: ../../reference/expressions.rst:1158 ../../reference/expressions.rst:1875 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1149 +#: ../../reference/expressions.rst:1162 ../../reference/expressions.rst:1880 msgid "function" msgstr "function (函式)" @@ -2745,8 +2753,8 @@ msgstr "module(模組)" msgid "subscription" msgstr "subscription(下標)" -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:953 -#: ../../reference/expressions.rst:1726 +#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:957 +#: ../../reference/expressions.rst:1730 msgid "sequence" msgstr "sequence(序列)" @@ -2754,443 +2762,447 @@ msgstr "sequence(序列)" msgid "mapping" msgstr "mapping(對映)" -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:933 -#: ../../reference/expressions.rst:953 +#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:937 +#: ../../reference/expressions.rst:957 msgid "string" msgstr "string(字串)" -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:933 +#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:937 msgid "item" msgstr "item(項目)" -#: ../../reference/expressions.rst:933 +#: ../../reference/expressions.rst:937 msgid "character" msgstr "character(字元)" -#: ../../reference/expressions.rst:947 +#: ../../reference/expressions.rst:951 msgid "slicing" msgstr "slicing(切片)" -#: ../../reference/expressions.rst:947 +#: ../../reference/expressions.rst:951 msgid "slice" msgstr "slice(切片)" -#: ../../reference/expressions.rst:979 +#: ../../reference/expressions.rst:983 msgid "start (slice object attribute)" msgstr "start(切片物件屬性)" -#: ../../reference/expressions.rst:979 +#: ../../reference/expressions.rst:983 msgid "stop (slice object attribute)" msgstr "stop(切片物件屬性)" -#: ../../reference/expressions.rst:979 +#: ../../reference/expressions.rst:983 msgid "step (slice object attribute)" msgstr "step(切片物件屬性)" -#: ../../reference/expressions.rst:997 +#: ../../reference/expressions.rst:1001 msgid "callable" msgstr "callable(可呼叫物件)" -#: ../../reference/expressions.rst:997 ../../reference/expressions.rst:1145 -#: ../../reference/expressions.rst:1158 ../../reference/expressions.rst:1172 -#: ../../reference/expressions.rst:1179 ../../reference/expressions.rst:1189 +#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1149 +#: ../../reference/expressions.rst:1162 ../../reference/expressions.rst:1176 +#: ../../reference/expressions.rst:1183 ../../reference/expressions.rst:1193 msgid "call" msgstr "call(呼叫)" -#: ../../reference/expressions.rst:997 +#: ../../reference/expressions.rst:1001 msgid "argument" msgstr "argument(引數)" -#: ../../reference/expressions.rst:997 ../../reference/expressions.rst:1030 +#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1034 msgid "call semantics" msgstr "call semantics(呼叫語意)" -#: ../../reference/expressions.rst:997 +#: ../../reference/expressions.rst:1001 msgid "argument list" msgstr "argument list(引數列表)" -#: ../../reference/expressions.rst:997 +#: ../../reference/expressions.rst:1001 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/expressions.rst:997 ../../reference/expressions.rst:1080 -#: ../../reference/expressions.rst:1110 +#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1084 +#: ../../reference/expressions.rst:1114 msgid "in function calls" msgstr "於函式呼叫中" -#: ../../reference/expressions.rst:1030 +#: ../../reference/expressions.rst:1034 msgid "parameter" msgstr "parameter(參數)" -#: ../../reference/expressions.rst:1080 ../../reference/expressions.rst:1314 -#: ../../reference/expressions.rst:1920 +#: ../../reference/expressions.rst:1084 ../../reference/expressions.rst:1318 +#: ../../reference/expressions.rst:1927 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/expressions.rst:1145 +#: ../../reference/expressions.rst:1149 msgid "user-defined" msgstr "user-defined(使用者定義)" -#: ../../reference/expressions.rst:1145 +#: ../../reference/expressions.rst:1149 msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" -#: ../../reference/expressions.rst:1158 +#: ../../reference/expressions.rst:1162 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../reference/expressions.rst:1158 +#: ../../reference/expressions.rst:1162 msgid "method" msgstr "method(方法)" -#: ../../reference/expressions.rst:1158 +#: ../../reference/expressions.rst:1162 msgid "built-in method" msgstr "built-in method(內建方法)" -#: ../../reference/expressions.rst:1172 +#: ../../reference/expressions.rst:1176 msgid "class" msgstr "class(類別)" -#: ../../reference/expressions.rst:1172 +#: ../../reference/expressions.rst:1176 msgid "class object" msgstr "class object(類別物件)" -#: ../../reference/expressions.rst:1179 +#: ../../reference/expressions.rst:1183 msgid "class instance" msgstr "class instance(類別實例)" -#: ../../reference/expressions.rst:1179 ../../reference/expressions.rst:1189 +#: ../../reference/expressions.rst:1183 ../../reference/expressions.rst:1193 msgid "instance" msgstr "instance(實例)" -#: ../../reference/expressions.rst:1189 +#: ../../reference/expressions.rst:1193 msgid "__call__() (object method)" msgstr "__call__() (物件方法)" -#: ../../reference/expressions.rst:1217 +#: ../../reference/expressions.rst:1221 msgid "power" msgstr "power(次方)" -#: ../../reference/expressions.rst:1217 ../../reference/expressions.rst:1253 -#: ../../reference/expressions.rst:1301 ../../reference/expressions.rst:1417 -#: ../../reference/expressions.rst:1446 ../../reference/expressions.rst:1761 +#: ../../reference/expressions.rst:1221 ../../reference/expressions.rst:1257 +#: ../../reference/expressions.rst:1305 ../../reference/expressions.rst:1421 +#: ../../reference/expressions.rst:1450 ../../reference/expressions.rst:1765 msgid "operation" msgstr "operation(操作)" -#: ../../reference/expressions.rst:1217 ../../reference/expressions.rst:1262 -#: ../../reference/expressions.rst:1271 ../../reference/expressions.rst:1279 -#: ../../reference/expressions.rst:1314 ../../reference/expressions.rst:1327 -#: ../../reference/expressions.rst:1339 ../../reference/expressions.rst:1357 -#: ../../reference/expressions.rst:1387 ../../reference/expressions.rst:1400 -#: ../../reference/expressions.rst:1417 ../../reference/expressions.rst:1455 -#: ../../reference/expressions.rst:1463 ../../reference/expressions.rst:1472 -#: ../../reference/expressions.rst:1487 ../../reference/expressions.rst:1726 -#: ../../reference/expressions.rst:1735 ../../reference/expressions.rst:1777 -#: ../../reference/expressions.rst:1782 ../../reference/expressions.rst:1787 -#: ../../reference/expressions.rst:1849 ../../reference/expressions.rst:1968 +#: ../../reference/expressions.rst:1221 ../../reference/expressions.rst:1266 +#: ../../reference/expressions.rst:1275 ../../reference/expressions.rst:1283 +#: ../../reference/expressions.rst:1318 ../../reference/expressions.rst:1331 +#: ../../reference/expressions.rst:1343 ../../reference/expressions.rst:1361 +#: ../../reference/expressions.rst:1391 ../../reference/expressions.rst:1404 +#: ../../reference/expressions.rst:1421 ../../reference/expressions.rst:1459 +#: ../../reference/expressions.rst:1467 ../../reference/expressions.rst:1476 +#: ../../reference/expressions.rst:1491 ../../reference/expressions.rst:1730 +#: ../../reference/expressions.rst:1739 ../../reference/expressions.rst:1781 +#: ../../reference/expressions.rst:1786 ../../reference/expressions.rst:1791 +#: ../../reference/expressions.rst:1854 ../../reference/expressions.rst:1978 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/expressions.rst:1253 +#: ../../reference/expressions.rst:1257 msgid "unary" msgstr "unary(一元)" -#: ../../reference/expressions.rst:1253 ../../reference/expressions.rst:1446 -#: ../../reference/expressions.rst:1455 ../../reference/expressions.rst:1463 -#: ../../reference/expressions.rst:1472 +#: ../../reference/expressions.rst:1257 ../../reference/expressions.rst:1450 +#: ../../reference/expressions.rst:1459 ../../reference/expressions.rst:1467 +#: ../../reference/expressions.rst:1476 msgid "bitwise" msgstr "bitwise(位元)" -#: ../../reference/expressions.rst:1262 +#: ../../reference/expressions.rst:1266 msgid "negation" msgstr "negation(否定)" -#: ../../reference/expressions.rst:1262 +#: ../../reference/expressions.rst:1266 msgid "minus" msgstr "minus(減)" -#: ../../reference/expressions.rst:1262 ../../reference/expressions.rst:1400 +#: ../../reference/expressions.rst:1266 ../../reference/expressions.rst:1404 msgid "- (minus)" msgstr "- (減號)" -#: ../../reference/expressions.rst:1262 ../../reference/expressions.rst:1271 +#: ../../reference/expressions.rst:1266 ../../reference/expressions.rst:1275 msgid "unary operator" msgstr "unary operator(一元運算子)" -#: ../../reference/expressions.rst:1271 +#: ../../reference/expressions.rst:1275 msgid "plus" msgstr "plus(加)" -#: ../../reference/expressions.rst:1271 ../../reference/expressions.rst:1387 +#: ../../reference/expressions.rst:1275 ../../reference/expressions.rst:1391 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../reference/expressions.rst:1279 +#: ../../reference/expressions.rst:1283 msgid "inversion" msgstr "inversion(反轉)" -#: ../../reference/expressions.rst:1279 +#: ../../reference/expressions.rst:1283 msgid "~ (tilde)" msgstr "~ (波浪號)" -#: ../../reference/expressions.rst:1290 +#: ../../reference/expressions.rst:1294 msgid "TypeError" msgstr "TypeError" -#: ../../reference/expressions.rst:1301 ../../reference/expressions.rst:1446 +#: ../../reference/expressions.rst:1305 ../../reference/expressions.rst:1450 msgid "binary" msgstr "binary(二進位)" -#: ../../reference/expressions.rst:1314 +#: ../../reference/expressions.rst:1318 msgid "multiplication" msgstr "multiplication(乘)" -#: ../../reference/expressions.rst:1327 +#: ../../reference/expressions.rst:1331 msgid "matrix multiplication" msgstr "matrix multiplication(矩陣乘法)" -#: ../../reference/expressions.rst:1327 +#: ../../reference/expressions.rst:1331 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/expressions.rst:1339 +#: ../../reference/expressions.rst:1343 msgid "ZeroDivisionError" msgstr "ZeroDivisionError" -#: ../../reference/expressions.rst:1339 +#: ../../reference/expressions.rst:1343 msgid "division" msgstr "division(除)" -#: ../../reference/expressions.rst:1339 +#: ../../reference/expressions.rst:1343 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/expressions.rst:1339 +#: ../../reference/expressions.rst:1343 msgid "//" msgstr "//" -#: ../../reference/expressions.rst:1357 +#: ../../reference/expressions.rst:1361 msgid "modulo" msgstr "modulo(餘數)" -#: ../../reference/expressions.rst:1357 +#: ../../reference/expressions.rst:1361 msgid "% (percent)" msgstr "% (百分號)" -#: ../../reference/expressions.rst:1387 +#: ../../reference/expressions.rst:1391 msgid "addition" msgstr "addition(加)" -#: ../../reference/expressions.rst:1387 ../../reference/expressions.rst:1400 +#: ../../reference/expressions.rst:1391 ../../reference/expressions.rst:1404 msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../reference/expressions.rst:1400 +#: ../../reference/expressions.rst:1404 msgid "subtraction" msgstr "subtraction(減)" -#: ../../reference/expressions.rst:1417 +#: ../../reference/expressions.rst:1421 msgid "shifting" msgstr "shifting(移動)" -#: ../../reference/expressions.rst:1417 +#: ../../reference/expressions.rst:1421 msgid "<<" msgstr "<<" -#: ../../reference/expressions.rst:1417 +#: ../../reference/expressions.rst:1421 msgid ">>" msgstr ">>" -#: ../../reference/expressions.rst:1435 +#: ../../reference/expressions.rst:1439 msgid "ValueError" msgstr "ValueError" -#: ../../reference/expressions.rst:1455 ../../reference/expressions.rst:1782 +#: ../../reference/expressions.rst:1459 ../../reference/expressions.rst:1786 msgid "and" msgstr "and" -#: ../../reference/expressions.rst:1455 +#: ../../reference/expressions.rst:1459 msgid "& (ampersand)" msgstr "& (和號)" -#: ../../reference/expressions.rst:1463 +#: ../../reference/expressions.rst:1467 msgid "xor" msgstr "xor" -#: ../../reference/expressions.rst:1463 +#: ../../reference/expressions.rst:1467 msgid "exclusive" msgstr "exclusive(排外)" -#: ../../reference/expressions.rst:1463 ../../reference/expressions.rst:1472 -#: ../../reference/expressions.rst:1787 +#: ../../reference/expressions.rst:1467 ../../reference/expressions.rst:1476 +#: ../../reference/expressions.rst:1791 msgid "or" msgstr "or" -#: ../../reference/expressions.rst:1463 +#: ../../reference/expressions.rst:1467 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../reference/expressions.rst:1472 +#: ../../reference/expressions.rst:1476 msgid "inclusive" msgstr "inclusive(包含)" -#: ../../reference/expressions.rst:1472 +#: ../../reference/expressions.rst:1476 msgid "| (vertical bar)" msgstr "| (垂直線)" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid "comparison" msgstr "comparison(比較)" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid "C" msgstr "C" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid "language" msgstr "language(語言)" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid "< (less)" msgstr "< (小於)" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid "> (greater)" msgstr "> (大於)" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid "<=" msgstr "<=" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid ">=" msgstr ">=" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid "==" msgstr "==" -#: ../../reference/expressions.rst:1487 +#: ../../reference/expressions.rst:1491 msgid "!=" msgstr "!=" -#: ../../reference/expressions.rst:1511 +#: ../../reference/expressions.rst:1515 msgid "chaining" msgstr "chaining(鏈接)" -#: ../../reference/expressions.rst:1511 +#: ../../reference/expressions.rst:1515 msgid "comparisons" msgstr "comparisons(比較)" -#: ../../reference/expressions.rst:1726 +#: ../../reference/expressions.rst:1730 msgid "in" msgstr "in" -#: ../../reference/expressions.rst:1726 +#: ../../reference/expressions.rst:1730 msgid "not in" msgstr "not in" -#: ../../reference/expressions.rst:1726 +#: ../../reference/expressions.rst:1730 msgid "membership" msgstr "membership(成員)" -#: ../../reference/expressions.rst:1726 ../../reference/expressions.rst:1735 +#: ../../reference/expressions.rst:1730 ../../reference/expressions.rst:1739 msgid "test" msgstr "test(測試)" -#: ../../reference/expressions.rst:1735 +#: ../../reference/expressions.rst:1739 msgid "is" msgstr "is" -#: ../../reference/expressions.rst:1735 +#: ../../reference/expressions.rst:1739 msgid "is not" msgstr "is not" -#: ../../reference/expressions.rst:1735 +#: ../../reference/expressions.rst:1739 msgid "identity" msgstr "identity" -#: ../../reference/expressions.rst:1761 +#: ../../reference/expressions.rst:1765 msgid "Conditional" msgstr "Conditional(條件式)" -#: ../../reference/expressions.rst:1761 +#: ../../reference/expressions.rst:1765 msgid "Boolean" msgstr "Boolean(布林)" -#: ../../reference/expressions.rst:1777 +#: ../../reference/expressions.rst:1781 msgid "not" msgstr "not" -#: ../../reference/expressions.rst:1801 +#: ../../reference/expressions.rst:1805 msgid ":= (colon equals)" msgstr ":= (冒號等於)" -#: ../../reference/expressions.rst:1801 +#: ../../reference/expressions.rst:1805 msgid "assignment expression" msgstr "assignment expression(賦值運算式)" -#: ../../reference/expressions.rst:1801 +#: ../../reference/expressions.rst:1805 msgid "walrus operator" msgstr "walrus operator(海象運算子)" -#: ../../reference/expressions.rst:1801 +#: ../../reference/expressions.rst:1805 msgid "named expression" msgstr "named expression(附名運算式)" -#: ../../reference/expressions.rst:1849 +#: ../../reference/expressions.rst:1805 +msgid "assignment" +msgstr "assignment(賦值)" + +#: ../../reference/expressions.rst:1854 msgid "conditional" msgstr "conditional(條件式)" -#: ../../reference/expressions.rst:1849 +#: ../../reference/expressions.rst:1854 msgid "ternary" msgstr "ternary(三元)" -#: ../../reference/expressions.rst:1849 +#: ../../reference/expressions.rst:1854 msgid "conditional expression" msgstr "conditional expression(條件運算式)" -#: ../../reference/expressions.rst:1849 +#: ../../reference/expressions.rst:1854 msgid "else" msgstr "else" -#: ../../reference/expressions.rst:1875 +#: ../../reference/expressions.rst:1880 msgid "lambda" msgstr "lambda" -#: ../../reference/expressions.rst:1875 +#: ../../reference/expressions.rst:1880 msgid "form" msgstr "form" -#: ../../reference/expressions.rst:1875 +#: ../../reference/expressions.rst:1880 msgid "anonymous" msgstr "anonymous(匿名)" -#: ../../reference/expressions.rst:1875 +#: ../../reference/expressions.rst:1880 msgid "lambda expression" msgstr "lambda expression(lambda 運算式)" -#: ../../reference/expressions.rst:1920 +#: ../../reference/expressions.rst:1927 msgid "iterable" msgstr "iterable(可疊代)" -#: ../../reference/expressions.rst:1920 +#: ../../reference/expressions.rst:1927 msgid "in expression lists" msgstr "於 expression list(運算式串列)" -#: ../../reference/expressions.rst:1932 +#: ../../reference/expressions.rst:1942 msgid "trailing" msgstr "trailing" -#: ../../reference/expressions.rst:1947 +#: ../../reference/expressions.rst:1957 msgid "evaluation" msgstr "evaluation" -#: ../../reference/expressions.rst:1947 +#: ../../reference/expressions.rst:1957 msgid "order" msgstr "order(順序)" -#: ../../reference/expressions.rst:1968 +#: ../../reference/expressions.rst:1978 msgid "precedence" msgstr "precedence(優先順序)" diff --git a/reference/import.po b/reference/import.po index 9a98a69bd1..4fb01ece71 100644 --- a/reference/import.po +++ b/reference/import.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -830,7 +830,13 @@ msgid "" "back to ``__package__``." msgstr "" -#: ../../reference/import.rst:602 +#: ../../reference/import.rst:599 +msgid "" +"``__package__`` will cease to be set or taken into consideration by the " +"import system or standard library." +msgstr "" + +#: ../../reference/import.rst:606 msgid "" "The ``__spec__`` attribute must be set to the module spec that was used when " "importing the module. Setting ``__spec__`` appropriately applies equally to :" @@ -839,18 +845,18 @@ msgid "" "cases `." msgstr "" -#: ../../reference/import.rst:608 +#: ../../reference/import.rst:612 msgid "" "When ``__spec__.parent`` is not set, ``__package__`` is used as a fallback." msgstr "" -#: ../../reference/import.rst:613 +#: ../../reference/import.rst:617 msgid "" "``__spec__.parent`` is used as a fallback when ``__package__`` is not " "defined." msgstr "" -#: ../../reference/import.rst:619 +#: ../../reference/import.rst:623 msgid "" "If the module is a package (either regular or namespace), the module " "object's ``__path__`` attribute must be set. The value must be iterable, " @@ -860,11 +866,11 @@ msgid "" "rules>`." msgstr "" -#: ../../reference/import.rst:626 +#: ../../reference/import.rst:630 msgid "Non-package modules should not have a ``__path__`` attribute." msgstr "" -#: ../../reference/import.rst:631 +#: ../../reference/import.rst:635 msgid "" "``__file__`` is optional (if set, value must be a string). It indicates the " "pathname of the file from which the module was loaded (if loaded from a " @@ -875,7 +881,7 @@ msgid "" "semantic meaning (e.g. a module loaded from a database)." msgstr "" -#: ../../reference/import.rst:640 +#: ../../reference/import.rst:644 msgid "" "If ``__file__`` is set then the ``__cached__`` attribute might also be set, " "which is the path to any compiled version of the code (e.g. byte-compiled " @@ -883,7 +889,7 @@ msgid "" "simply point to where the compiled file would exist (see :pep:`3147`)." msgstr "" -#: ../../reference/import.rst:646 +#: ../../reference/import.rst:650 msgid "" "Note that ``__cached__`` may be set even if ``__file__`` is not set. " "However, that scenario is quite atypical. Ultimately, the loader is what " @@ -893,22 +899,28 @@ msgid "" "be appropriate." msgstr "" -#: ../../reference/import.rst:653 +#: ../../reference/import.rst:657 msgid "" "It is **strongly** recommended that you rely on :attr:`__spec__` instead of " "``__cached__``." msgstr "" -#: ../../reference/import.rst:659 +#: ../../reference/import.rst:660 +msgid "" +"``__cached__`` will cease to be set or taken into consideration by the " +"import system or standard library." +msgstr "" + +#: ../../reference/import.rst:667 msgid "module.__path__" msgstr "module.__path__" -#: ../../reference/import.rst:661 +#: ../../reference/import.rst:669 msgid "" "By definition, if a module has a ``__path__`` attribute, it is a package." msgstr "" -#: ../../reference/import.rst:663 +#: ../../reference/import.rst:671 msgid "" "A package's ``__path__`` attribute is used during imports of its " "subpackages. Within the import machinery, it functions much the same as :" @@ -917,7 +929,7 @@ msgid "" "than :data:`sys.path`." msgstr "" -#: ../../reference/import.rst:669 +#: ../../reference/import.rst:677 msgid "" "``__path__`` must be an iterable of strings, but it may be empty. The same " "rules used for :data:`sys.path` also apply to a package's ``__path__``, and :" @@ -925,7 +937,7 @@ msgid "" "package's ``__path__``." msgstr "" -#: ../../reference/import.rst:674 +#: ../../reference/import.rst:682 msgid "" "A package's ``__init__.py`` file may set or alter the package's ``__path__`` " "attribute, and this was typically the way namespace packages were " @@ -935,18 +947,18 @@ msgid "" "``__path__`` correctly for the namespace package." msgstr "" -#: ../../reference/import.rst:682 +#: ../../reference/import.rst:690 msgid "Module reprs" msgstr "" -#: ../../reference/import.rst:684 +#: ../../reference/import.rst:692 msgid "" "By default, all modules have a usable repr, however depending on the " "attributes set above, and in the module's spec, you can more explicitly " "control the repr of module objects." msgstr "" -#: ../../reference/import.rst:688 +#: ../../reference/import.rst:696 msgid "" "If the module has a spec (``__spec__``), the import machinery will try to " "generate a repr from it. If that fails or there is no spec, the import " @@ -956,45 +968,45 @@ msgid "" "for whatever information is missing." msgstr "" -#: ../../reference/import.rst:695 +#: ../../reference/import.rst:703 msgid "Here are the exact rules used:" msgstr "" -#: ../../reference/import.rst:697 +#: ../../reference/import.rst:705 msgid "" "If the module has a ``__spec__`` attribute, the information in the spec is " "used to generate the repr. The \"name\", \"loader\", \"origin\", and " "\"has_location\" attributes are consulted." msgstr "" -#: ../../reference/import.rst:701 +#: ../../reference/import.rst:709 msgid "" "If the module has a ``__file__`` attribute, this is used as part of the " "module's repr." msgstr "" -#: ../../reference/import.rst:704 +#: ../../reference/import.rst:712 msgid "" "If the module has no ``__file__`` but does have a ``__loader__`` that is not " "``None``, then the loader's repr is used as part of the module's repr." msgstr "" -#: ../../reference/import.rst:707 +#: ../../reference/import.rst:715 msgid "Otherwise, just use the module's ``__name__`` in the repr." msgstr "" -#: ../../reference/import.rst:709 +#: ../../reference/import.rst:717 msgid "" "Use of :meth:`!module_repr`, having been deprecated since Python 3.4, was " "removed in Python 3.12 and is no longer called during the resolution of a " "module's repr." msgstr "" -#: ../../reference/import.rst:717 +#: ../../reference/import.rst:725 msgid "Cached bytecode invalidation" msgstr "" -#: ../../reference/import.rst:719 +#: ../../reference/import.rst:727 msgid "" "Before Python loads cached bytecode from a ``.pyc`` file, it checks whether " "the cache is up-to-date with the source ``.py`` file. By default, Python " @@ -1004,7 +1016,7 @@ msgid "" "source's metadata." msgstr "" -#: ../../reference/import.rst:726 +#: ../../reference/import.rst:734 msgid "" "Python also supports \"hash-based\" cache files, which store a hash of the " "source file's contents rather than its metadata. There are two variants of " @@ -1018,17 +1030,17 @@ msgid "" "option:`--check-hash-based-pycs` flag." msgstr "" -#: ../../reference/import.rst:737 +#: ../../reference/import.rst:745 msgid "" "Added hash-based ``.pyc`` files. Previously, Python only supported timestamp-" "based invalidation of bytecode caches." msgstr "" -#: ../../reference/import.rst:743 +#: ../../reference/import.rst:751 msgid "The Path Based Finder" msgstr "" -#: ../../reference/import.rst:748 +#: ../../reference/import.rst:756 msgid "" "As mentioned previously, Python comes with several default meta path " "finders. One of these, called the :term:`path based finder` (:class:" @@ -1037,14 +1049,14 @@ msgid "" "a location to search for modules." msgstr "" -#: ../../reference/import.rst:754 +#: ../../reference/import.rst:762 msgid "" "The path based finder itself doesn't know how to import anything. Instead, " "it traverses the individual path entries, associating each of them with a " "path entry finder that knows how to handle that particular kind of path." msgstr "" -#: ../../reference/import.rst:758 +#: ../../reference/import.rst:766 msgid "" "The default set of path entry finders implement all the semantics for " "finding modules on the file system, handling special file types such as " @@ -1055,14 +1067,14 @@ msgid "" "from zipfiles." msgstr "" -#: ../../reference/import.rst:765 +#: ../../reference/import.rst:773 msgid "" "Path entries need not be limited to file system locations. They can refer " "to URLs, database queries, or any other location that can be specified as a " "string." msgstr "" -#: ../../reference/import.rst:769 +#: ../../reference/import.rst:777 msgid "" "The path based finder provides additional hooks and protocols so that you " "can extend and customize the types of searchable path entries. For example, " @@ -1073,7 +1085,7 @@ msgid "" "from the web." msgstr "" -#: ../../reference/import.rst:777 +#: ../../reference/import.rst:785 msgid "" "A word of warning: this section and the previous both use the term *finder*, " "distinguishing between them by using the terms :term:`meta path finder` and :" @@ -1084,7 +1096,7 @@ msgid "" "process, as keyed off the :data:`sys.meta_path` traversal." msgstr "" -#: ../../reference/import.rst:785 +#: ../../reference/import.rst:793 msgid "" "By contrast, path entry finders are in a sense an implementation detail of " "the path based finder, and in fact, if the path based finder were to be " @@ -1092,11 +1104,11 @@ msgid "" "would be invoked." msgstr "" -#: ../../reference/import.rst:792 +#: ../../reference/import.rst:800 msgid "Path entry finders" msgstr "" -#: ../../reference/import.rst:800 +#: ../../reference/import.rst:808 msgid "" "The :term:`path based finder` is responsible for finding and loading Python " "modules and packages whose location is specified with a string :term:`path " @@ -1104,7 +1116,7 @@ msgid "" "not be limited to this." msgstr "" -#: ../../reference/import.rst:805 +#: ../../reference/import.rst:813 msgid "" "As a meta path finder, the :term:`path based finder` implements the :meth:" "`~importlib.abc.MetaPathFinder.find_spec` protocol previously described, " @@ -1112,7 +1124,7 @@ msgid "" "modules are found and loaded from the :term:`import path`." msgstr "" -#: ../../reference/import.rst:810 +#: ../../reference/import.rst:818 msgid "" "Three variables are used by the :term:`path based finder`, :data:`sys." "path`, :data:`sys.path_hooks` and :data:`sys.path_importer_cache`. The " @@ -1120,7 +1132,7 @@ msgid "" "additional ways that the import machinery can be customized." msgstr "" -#: ../../reference/import.rst:815 +#: ../../reference/import.rst:823 msgid "" ":data:`sys.path` contains a list of strings providing search locations for " "modules and packages. It is initialized from the :envvar:`PYTHONPATH` " @@ -1132,7 +1144,7 @@ msgid "" "other data types are ignored." msgstr "" -#: ../../reference/import.rst:824 +#: ../../reference/import.rst:832 msgid "" "The :term:`path based finder` is a :term:`meta path finder`, so the import " "machinery begins the :term:`import path` search by calling the path based " @@ -1144,7 +1156,7 @@ msgid "" "top level import and :data:`sys.path` is used." msgstr "" -#: ../../reference/import.rst:833 +#: ../../reference/import.rst:841 msgid "" "The path based finder iterates over every entry in the search path, and for " "each of these, looks for an appropriate :term:`path entry finder` (:class:" @@ -1160,7 +1172,7 @@ msgid "" "finder to perform the path entry search again." msgstr "" -#: ../../reference/import.rst:846 +#: ../../reference/import.rst:854 msgid "" "If the path entry is not present in the cache, the path based finder " "iterates over every callable in :data:`sys.path_hooks`. Each of the :term:" @@ -1176,7 +1188,7 @@ msgid "" "decode the argument, it should raise :exc:`ImportError`." msgstr "" -#: ../../reference/import.rst:860 +#: ../../reference/import.rst:868 msgid "" "If :data:`sys.path_hooks` iteration ends with no :term:`path entry finder` " "being returned, then the path based finder's :meth:`~importlib.machinery." @@ -1186,7 +1198,7 @@ msgid "" "could not find the module." msgstr "" -#: ../../reference/import.rst:867 +#: ../../reference/import.rst:875 msgid "" "If a :term:`path entry finder` *is* returned by one of the :term:`path entry " "hook` callables on :data:`sys.path_hooks`, then the following protocol is " @@ -1194,7 +1206,7 @@ msgid "" "the module." msgstr "" -#: ../../reference/import.rst:872 +#: ../../reference/import.rst:880 msgid "" "The current working directory -- denoted by an empty string -- is handled " "slightly differently from other entries on :data:`sys.path`. First, if the " @@ -1206,18 +1218,18 @@ msgid "" "and not the empty string." msgstr "" -#: ../../reference/import.rst:882 +#: ../../reference/import.rst:890 msgid "Path entry finder protocol" msgstr "" -#: ../../reference/import.rst:884 +#: ../../reference/import.rst:892 msgid "" "In order to support imports of modules and initialized packages and also to " "contribute portions to namespace packages, path entry finders must implement " "the :meth:`~importlib.abc.PathEntryFinder.find_spec` method." msgstr "" -#: ../../reference/import.rst:888 +#: ../../reference/import.rst:896 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` takes two arguments: the " "fully qualified name of the module being imported, and the (optional) target " @@ -1225,21 +1237,21 @@ msgid "" "spec will always have \"loader\" set (with one exception)." msgstr "" -#: ../../reference/import.rst:893 +#: ../../reference/import.rst:901 msgid "" "To indicate to the import machinery that the spec represents a namespace :" "term:`portion`, the path entry finder sets ``submodule_search_locations`` to " "a list containing the portion." msgstr "" -#: ../../reference/import.rst:897 +#: ../../reference/import.rst:905 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` replaced :meth:`!" "find_loader` and :meth:`!find_module`, both of which are now deprecated, but " "will be used if ``find_spec()`` is not defined." msgstr "" -#: ../../reference/import.rst:903 +#: ../../reference/import.rst:911 msgid "" "Older path entry finders may implement one of these two deprecated methods " "instead of ``find_spec()``. The methods are still respected for the sake of " @@ -1247,14 +1259,14 @@ msgid "" "path entry finder, the legacy methods are ignored." msgstr "" -#: ../../reference/import.rst:908 +#: ../../reference/import.rst:916 msgid "" ":meth:`!find_loader` takes one argument, the fully qualified name of the " "module being imported. ``find_loader()`` returns a 2-tuple where the first " "item is the loader and the second item is a namespace :term:`portion`." msgstr "" -#: ../../reference/import.rst:913 +#: ../../reference/import.rst:921 msgid "" "For backwards compatibility with other implementations of the import " "protocol, many path entry finders also support the same, traditional " @@ -1264,7 +1276,7 @@ msgid "" "initial call to the path hook)." msgstr "" -#: ../../reference/import.rst:920 +#: ../../reference/import.rst:928 msgid "" "The ``find_module()`` method on path entry finders is deprecated, as it does " "not allow the path entry finder to contribute portions to namespace " @@ -1273,28 +1285,28 @@ msgid "" "preference to ``find_module()``." msgstr "" -#: ../../reference/import.rst:926 +#: ../../reference/import.rst:934 msgid "" "Calls to :meth:`!find_module` and :meth:`!find_loader` by the import system " "will raise :exc:`ImportWarning`." msgstr "" -#: ../../reference/import.rst:931 +#: ../../reference/import.rst:939 msgid "``find_module()`` and ``find_loader()`` have been removed." msgstr "" -#: ../../reference/import.rst:936 +#: ../../reference/import.rst:944 msgid "Replacing the standard import system" msgstr "" -#: ../../reference/import.rst:938 +#: ../../reference/import.rst:946 msgid "" "The most reliable mechanism for replacing the entire import system is to " "delete the default contents of :data:`sys.meta_path`, replacing them " "entirely with a custom meta path hook." msgstr "" -#: ../../reference/import.rst:942 +#: ../../reference/import.rst:950 msgid "" "If it is acceptable to only alter the behaviour of import statements without " "affecting other APIs that access the import system, then replacing the " @@ -1303,7 +1315,7 @@ msgid "" "statements within that module." msgstr "" -#: ../../reference/import.rst:948 +#: ../../reference/import.rst:956 msgid "" "To selectively prevent the import of some modules from a hook early on the " "meta path (rather than disabling the standard import system entirely), it is " @@ -1313,11 +1325,11 @@ msgid "" "exception terminates it immediately." msgstr "" -#: ../../reference/import.rst:958 +#: ../../reference/import.rst:966 msgid "Package Relative Imports" msgstr "" -#: ../../reference/import.rst:960 +#: ../../reference/import.rst:968 msgid "" "Relative imports use leading dots. A single leading dot indicates a relative " "import, starting with the current package. Two or more leading dots indicate " @@ -1325,7 +1337,7 @@ msgid "" "after the first. For example, given the following package layout::" msgstr "" -#: ../../reference/import.rst:965 +#: ../../reference/import.rst:973 msgid "" "package/\n" " __init__.py\n" @@ -1349,13 +1361,13 @@ msgstr "" " moduleZ.py\n" " moduleA.py" -#: ../../reference/import.rst:976 +#: ../../reference/import.rst:984 msgid "" "In either ``subpackage1/moduleX.py`` or ``subpackage1/__init__.py``, the " "following are valid relative imports::" msgstr "" -#: ../../reference/import.rst:979 +#: ../../reference/import.rst:987 msgid "" "from .moduleY import spam\n" "from .moduleY import spam as ham\n" @@ -1371,28 +1383,28 @@ msgstr "" "from ..subpackage2.moduleZ import eggs\n" "from ..moduleA import foo" -#: ../../reference/import.rst:986 +#: ../../reference/import.rst:994 msgid "" "Absolute imports may use either the ``import <>`` or ``from <> import <>`` " "syntax, but relative imports may only use the second form; the reason for " "this is that::" msgstr "" -#: ../../reference/import.rst:990 +#: ../../reference/import.rst:998 msgid "import XXX.YYY.ZZZ" msgstr "import XXX.YYY.ZZZ" -#: ../../reference/import.rst:992 +#: ../../reference/import.rst:1000 msgid "" "should expose ``XXX.YYY.ZZZ`` as a usable expression, but .moduleY is not a " "valid expression." msgstr "" -#: ../../reference/import.rst:999 +#: ../../reference/import.rst:1007 msgid "Special considerations for __main__" msgstr "" -#: ../../reference/import.rst:1001 +#: ../../reference/import.rst:1009 msgid "" "The :mod:`__main__` module is a special case relative to Python's import " "system. As noted :ref:`elsewhere `, the ``__main__`` module is " @@ -1403,17 +1415,17 @@ msgid "" "interpreter is invoked." msgstr "" -#: ../../reference/import.rst:1012 +#: ../../reference/import.rst:1020 msgid "__main__.__spec__" msgstr "__main__.__spec__" -#: ../../reference/import.rst:1014 +#: ../../reference/import.rst:1022 msgid "" "Depending on how :mod:`__main__` is initialized, ``__main__.__spec__`` gets " "set appropriately or to ``None``." msgstr "" -#: ../../reference/import.rst:1017 +#: ../../reference/import.rst:1025 msgid "" "When Python is started with the :option:`-m` option, ``__spec__`` is set to " "the module spec of the corresponding module or package. ``__spec__`` is also " @@ -1421,30 +1433,30 @@ msgid "" "directory, zipfile or other :data:`sys.path` entry." msgstr "" -#: ../../reference/import.rst:1022 +#: ../../reference/import.rst:1030 msgid "" "In :ref:`the remaining cases ` ``__main__." "__spec__`` is set to ``None``, as the code used to populate the :mod:" "`__main__` does not correspond directly with an importable module:" msgstr "" -#: ../../reference/import.rst:1026 +#: ../../reference/import.rst:1034 msgid "interactive prompt" msgstr "" -#: ../../reference/import.rst:1027 +#: ../../reference/import.rst:1035 msgid ":option:`-c` option" msgstr ":option:`-c` 選項" -#: ../../reference/import.rst:1028 +#: ../../reference/import.rst:1036 msgid "running from stdin" msgstr "" -#: ../../reference/import.rst:1029 +#: ../../reference/import.rst:1037 msgid "running directly from a source or bytecode file" msgstr "" -#: ../../reference/import.rst:1031 +#: ../../reference/import.rst:1039 msgid "" "Note that ``__main__.__spec__`` is always ``None`` in the last case, *even " "if* the file could technically be imported directly as a module instead. Use " @@ -1452,7 +1464,7 @@ msgid "" "`__main__`." msgstr "" -#: ../../reference/import.rst:1036 +#: ../../reference/import.rst:1044 msgid "" "Note also that even when ``__main__`` corresponds with an importable module " "and ``__main__.__spec__`` is set accordingly, they're still considered " @@ -1461,11 +1473,11 @@ msgid "" "populate the ``__main__`` namespace, and not during normal import." msgstr "" -#: ../../reference/import.rst:1044 +#: ../../reference/import.rst:1052 msgid "References" msgstr "" -#: ../../reference/import.rst:1046 +#: ../../reference/import.rst:1054 msgid "" "The import machinery has evolved considerably since Python's early days. " "The original `specification for packages ` for " "Python 3.3. :pep:`420` also introduced the :meth:`!find_loader` protocol as " "an alternative to :meth:`!find_module`." msgstr "" -#: ../../reference/import.rst:1058 +#: ../../reference/import.rst:1066 msgid "" ":pep:`366` describes the addition of the ``__package__`` attribute for " "explicit relative imports in main modules." msgstr "" -#: ../../reference/import.rst:1061 +#: ../../reference/import.rst:1069 msgid "" ":pep:`328` introduced absolute and explicit relative imports and initially " "proposed ``__name__`` for semantics :pep:`366` would eventually specify for " "``__package__``." msgstr "" -#: ../../reference/import.rst:1065 +#: ../../reference/import.rst:1073 msgid ":pep:`338` defines executing modules as scripts." msgstr "" -#: ../../reference/import.rst:1067 +#: ../../reference/import.rst:1075 msgid "" ":pep:`451` adds the encapsulation of per-module import state in spec " "objects. It also off-loads most of the boilerplate responsibilities of " @@ -1512,15 +1524,15 @@ msgid "" "finders and loaders." msgstr "" -#: ../../reference/import.rst:1074 +#: ../../reference/import.rst:1082 msgid "Footnotes" msgstr "註解" -#: ../../reference/import.rst:1075 +#: ../../reference/import.rst:1083 msgid "See :class:`types.ModuleType`." msgstr "參閱 :class:`types.ModuleType`。" -#: ../../reference/import.rst:1077 +#: ../../reference/import.rst:1085 msgid "" "The importlib implementation avoids using the return value directly. " "Instead, it gets the module object by looking the module name up in :data:" @@ -1602,22 +1614,22 @@ msgstr "sys.meta_path" msgid "find_spec" msgstr "find_spec" -#: ../../reference/import.rst:745 +#: ../../reference/import.rst:753 msgid "path based finder" msgstr "path based finder(基於路徑的搜尋器)" -#: ../../reference/import.rst:794 +#: ../../reference/import.rst:802 msgid "sys.path" msgstr "sys.path" -#: ../../reference/import.rst:794 +#: ../../reference/import.rst:802 msgid "sys.path_hooks" msgstr "sys.path_hooks" -#: ../../reference/import.rst:794 +#: ../../reference/import.rst:802 msgid "sys.path_importer_cache" msgstr "sys.path_importer_cache" -#: ../../reference/import.rst:794 +#: ../../reference/import.rst:802 msgid "PYTHONPATH" msgstr "PYTHONPATH" diff --git a/sphinx.po b/sphinx.po index 5729a9b54b..f044d5a9c6 100644 --- a/sphinx.po +++ b/sphinx.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+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-" @@ -37,15 +37,15 @@ msgstr "顯示原始碼" msgid "Download" msgstr "下載" -#: ../../tools/templates/download.html:14 -msgid "Download Python %(release)s Documentation" -msgstr "下載 Python %(release)s 說明文件" - #: ../../tools/templates/download.html:16 +msgid "Download Python %(dl_version)s Documentation" +msgstr "下載 Python %(dl_version)s 說明文件" + +#: ../../tools/templates/download.html:18 msgid "Last updated on: %(last_updated)s." msgstr "最後更新時間:%(last_updated)s。" -#: ../../tools/templates/download.html:18 +#: ../../tools/templates/download.html:20 msgid "" "To download an archive containing all the documents for this version of\n" "Python in one of various formats, follow one of links in this table." @@ -53,119 +53,119 @@ msgstr "" "要下載包含這個 Python 版本所有文件的歸檔,可以遵循這個表格中的其中一個連結," "以取得各種格式的文件。" -#: ../../tools/templates/download.html:23 +#: ../../tools/templates/download.html:25 msgid "Format" msgstr "格式" -#: ../../tools/templates/download.html:24 +#: ../../tools/templates/download.html:26 msgid "Packed as .zip" msgstr "打包成 .zip" -#: ../../tools/templates/download.html:25 +#: ../../tools/templates/download.html:27 msgid "Packed as .tar.bz2" msgstr "打包成 .tar.bz2" -#: ../../tools/templates/download.html:28 +#: ../../tools/templates/download.html:30 msgid "PDF" msgstr "PDF" -#: ../../tools/templates/download.html:29 +#: ../../tools/templates/download.html:31 msgid "" -"Download (ca. " -"%(download_size)s MiB)" +"Download " +"(ca. %(download_size)s MiB)" msgstr "" -"下載 (ca. " +"下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:30 +#: ../../tools/templates/download.html:32 msgid "" -"Download " -"(ca. %(download_size)s MiB)" +"Download (ca. %(download_size)s MiB)" msgstr "" -"下載 (ca. " -"%(download_size)s MiB)" +"下載 " +"(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:33 +#: ../../tools/templates/download.html:35 msgid "HTML" msgstr "HTML" -#: ../../tools/templates/download.html:34 +#: ../../tools/templates/download.html:36 msgid "" -"Download (ca. " -"%(download_size)s MiB)" +"Download " +"(ca. %(download_size)s MiB)" msgstr "" -"下載 (ca. " +"下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:35 +#: ../../tools/templates/download.html:37 msgid "" -"Download " +"Download " "(ca. %(download_size)s MiB)" msgstr "" -"下載 (ca. " -"%(download_size)s MiB)" +"下載 " +"(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:38 +#: ../../tools/templates/download.html:40 msgid "Plain text" msgstr "純文字" -#: ../../tools/templates/download.html:39 +#: ../../tools/templates/download.html:41 msgid "" -"Download (ca. " -"%(download_size)s MiB)" +"Download " +"(ca. %(download_size)s MiB)" msgstr "" -"下載 (ca. " +"下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:40 +#: ../../tools/templates/download.html:42 msgid "" -"Download " +"Download " "(ca. %(download_size)s MiB)" msgstr "" -"下載 (ca. " -"%(download_size)s MiB)" +"下載 " +"(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:43 +#: ../../tools/templates/download.html:45 msgid "Texinfo" msgstr "Texinfo" -#: ../../tools/templates/download.html:44 +#: ../../tools/templates/download.html:46 msgid "" -"Download (ca. " -"%(download_size)s MiB)" +"Download " +"(ca. %(download_size)s MiB)" msgstr "" -"下載 (ca. " +"下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:45 +#: ../../tools/templates/download.html:47 msgid "" -"Download " -"(ca. %(download_size)s MiB)" +"Download (ca. %(download_size)s MiB)" msgstr "" -"下載 (ca. " -"%(download_size)s MiB)" +"下載 " +"(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:48 +#: ../../tools/templates/download.html:50 msgid "EPUB" msgstr "EPUB" -#: ../../tools/templates/download.html:49 +#: ../../tools/templates/download.html:51 msgid "" -"Download (ca. " +"Download (ca. " "%(download_size)s MiB)" msgstr "" -"下載 (ca. " +"下載 (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:54 +#: ../../tools/templates/download.html:56 msgid "These archives contain all the content in the documentation." msgstr "這些歸檔包含了說明文件中的所有內容。" -#: ../../tools/templates/download.html:57 +#: ../../tools/templates/download.html:59 msgid "Unpacking" msgstr "解壓縮" -#: ../../tools/templates/download.html:59 +#: ../../tools/templates/download.html:61 msgid "" "Unix users should download the .tar.bz2 archives; these are bzipped tar\n" "archives and can be handled in the usual way using tar and the bzip2\n" @@ -180,7 +180,7 @@ msgstr "" "net\">Info-ZIP 解壓縮程式來處理 ZIP 歸檔。.tar.bz2 歸檔提供最佳壓縮率和最" "快的下載時間。" -#: ../../tools/templates/download.html:65 +#: ../../tools/templates/download.html:67 msgid "" "Windows users can use the ZIP archives since those are customary on that\n" "platform. These are created on Unix using the Info-ZIP zip program." @@ -188,11 +188,11 @@ msgstr "" "Windows 使用者可以使用 ZIP 歸檔,因為這在該平台上是常見的。這些是在 Unix 上使" "用 Info-ZIP zip 程式建立的。" -#: ../../tools/templates/download.html:69 +#: ../../tools/templates/download.html:71 msgid "Problems" msgstr "問題" -#: ../../tools/templates/download.html:71 +#: ../../tools/templates/download.html:73 msgid "" "If you have comments or suggestions for the Python documentation, please " "send\n" diff --git a/tutorial/classes.po b/tutorial/classes.po index f102da185e..491479937b 100644 --- a/tutorial/classes.po +++ b/tutorial/classes.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2022-12-26 23:12+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -156,7 +156,7 @@ msgid "" "may both define a function ``maximize`` without confusion --- users of the " "modules must prefix it with the module name." msgstr "" -"*命名空間*\\ 是從名稱到物件的映射。大部分的命名空間現在都是以 Python 的 " +"*命名空間*\\ 是從名稱到物件的對映。大部分的命名空間現在都是以 Python 的 " "dictionary 被實作,但通常不會以任何方式被察覺(除了性能),且它可能會在未來改" "變。命名空間的例子有:內建名稱的集合(包含如 :func:`abs` 的函式,和內建的例外" "名稱);模組中的全域 (global) 名稱;和在函式調用中的區域 (local) 名稱。某種意" @@ -533,13 +533,13 @@ msgid "" "then ``MyClass.i`` and ``MyClass.f`` are valid attribute references, " "returning an integer and a function object, respectively. Class attributes " "can also be assigned to, so you can change the value of ``MyClass.i`` by " -"assignment. :attr:`!__doc__` is also a valid attribute, returning the " +"assignment. :attr:`~type.__doc__` is also a valid attribute, returning the " "docstring belonging to the class: ``\"A simple example class\"``." msgstr "" "那麼 ``MyClass.i`` 和 ``MyClass.f`` 都是有效的屬性參照,會分別回傳一個整數和" "一個函式物件。Class 屬性也可以被指派 (assign),所以你可以透過賦值改變 " -"``MyClass.i`` 的值。:attr:`!__doc__` 也是一個有效的屬性,會回傳屬於該 class " -"的說明字串 (docstring):``\"A simple example class\"``。" +"``MyClass.i`` 的值。:attr:`~type.__doc__` 也是一個有效的屬性,會回傳屬於該 " +"class 的說明字串 (docstring):``\"A simple example class\"``。" #: ../../tutorial/classes.rst:282 msgid "" @@ -828,6 +828,22 @@ msgid "" ">>> d.tricks # unexpectedly shared by all dogs\n" "['roll over', 'play dead']" msgstr "" +"class Dog:\n" +"\n" +" tricks = [] # 誤用類別變數\n" +"\n" +" def __init__(self, name):\n" +" self.name = name\n" +"\n" +" def add_trick(self, trick):\n" +" self.tricks.append(trick)\n" +"\n" +">>> d = Dog('Fido')\n" +">>> e = Dog('Buddy')\n" +">>> d.add_trick('roll over')\n" +">>> e.add_trick('play dead')\n" +">>> d.tricks # 出乎意料地被所有 dog 共享\n" +"['roll over', 'play dead']" #: ../../tutorial/classes.rst:445 msgid "Correct design of the class should use an instance variable instead::" @@ -853,6 +869,23 @@ msgid "" ">>> e.tricks\n" "['play dead']" msgstr "" +"class Dog:\n" +"\n" +" def __init__(self, name):\n" +" self.name = name\n" +" self.tricks = [] # 為每一個 dog 建立空 list\n" +"\n" +" def add_trick(self, trick):\n" +" self.tricks.append(trick)\n" +"\n" +">>> d = Dog('Fido')\n" +">>> e = Dog('Buddy')\n" +">>> d.add_trick('roll over')\n" +">>> e.add_trick('play dead')\n" +">>> d.tricks\n" +"['roll over']\n" +">>> e.tricks\n" +"['play dead']" #: ../../tutorial/classes.rst:469 msgid "Random Remarks" @@ -970,6 +1003,17 @@ msgid "" "\n" " h = g" msgstr "" +"# 在類別以外定義的函式\n" +"def f1(self, x, y):\n" +" return min(x, x+y)\n" +"\n" +"class C:\n" +" f = f1\n" +"\n" +" def g(self):\n" +" return 'hello world'\n" +"\n" +" h = g" #: ../../tutorial/classes.rst:530 msgid "" @@ -1702,15 +1746,15 @@ msgstr "註解" msgid "" "Except for one thing. Module objects have a secret read-only attribute " "called :attr:`~object.__dict__` which returns the dictionary used to " -"implement the module's namespace; the name :attr:`~object.__dict__` is an " -"attribute but not a global name. Obviously, using this violates the " -"abstraction of namespace implementation, and should be restricted to things " -"like post-mortem debuggers." +"implement the module's namespace; the name ``__dict__`` is an attribute but " +"not a global name. Obviously, using this violates the abstraction of " +"namespace implementation, and should be restricted to things like post-" +"mortem debuggers." msgstr "" "有一個例外。模組物件有一個秘密的唯讀屬性,稱為 :attr:`~object.__dict__`,它回" -"傳用於實作模組命名空間的 dictionary;:attr:`~object.__dict__` 這個名稱是一個" -"屬性但不是全域名稱。顯然,使用此屬性將違反命名空間實作的抽象化,而應該僅限用" -"於事後除錯器 (post-mortem debugger) 之類的東西。" +"傳用於實作模組命名空間的 dictionary;``__dict__`` 這個名稱是一個屬性但不是全" +"域名稱。顯然,使用此屬性將違反命名空間實作的抽象化,而應該僅限用於事後除錯器 " +"(post-mortem debugger) 之類的東西。" #: ../../tutorial/classes.rst:343 msgid "object" @@ -1727,18 +1771,3 @@ msgstr "name(名稱)" #: ../../tutorial/classes.rst:679 msgid "mangling" msgstr "mangling(修飾)" - -#~ msgid "" -#~ "The other kind of instance attribute reference is a *method*. A method is " -#~ "a function that \"belongs to\" an object. (In Python, the term method is " -#~ "not unique to class instances: other object types can have methods as " -#~ "well. For example, list objects have methods called append, insert, " -#~ "remove, sort, and so on. However, in the following discussion, we'll use " -#~ "the term method exclusively to mean methods of class instance objects, " -#~ "unless explicitly stated otherwise.)" -#~ msgstr "" -#~ "實例的另一種屬性參照是 *method*。Method 是一個「屬於」物件的函式。(在 " -#~ "Python 中,術語 method 並不是 class 實例所獨有的:其他物件型別也可以有 " -#~ "method。例如,list 物件具有稱為 append、insert、remove、sort 等 method。但" -#~ "是,在下面的討論中,我們將用術語 method 來專門表示 class 實例物件的 " -#~ "method,除非另有明確說明。)" diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index 58684f4aa7..c0a2f46f22 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2022-07-24 14:52+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -293,56 +293,122 @@ msgstr "" "`tut-structures`\\ 章節中,我們會討論更多關於 :func:`list` 的細節。" #: ../../tutorial/controlflow.rst:164 -msgid "" -":keyword:`!break` and :keyword:`!continue` Statements, and :keyword:`!else` " -"Clauses on Loops" -msgstr "" -"迴圈內的 :keyword:`!break` 和 :keyword:`!continue` 陳述式及 :keyword:`!else` " -"子句" +msgid ":keyword:`!break` and :keyword:`!continue` Statements" +msgstr ":keyword:`!break` 和 :keyword:`!continue` 陳述式" #: ../../tutorial/controlflow.rst:166 msgid "" "The :keyword:`break` statement breaks out of the innermost enclosing :" -"keyword:`for` or :keyword:`while` loop." +"keyword:`for` or :keyword:`while` loop::" msgstr "" ":keyword:`break` 陳述式,終止包含它的最內部 :keyword:`for` 或 :keyword:" -"`while` 迴圈。" +"`while` 迴圈: ::" #: ../../tutorial/controlflow.rst:169 msgid "" -"A :keyword:`!for` or :keyword:`!while` loop can include an :keyword:`!else` " -"clause." +">>> for n in range(2, 10):\n" +"... for x in range(2, n):\n" +"... if n % x == 0:\n" +"... print(f\"{n} equals {x} * {n//x}\")\n" +"... break\n" +"...\n" +"4 equals 2 * 2\n" +"6 equals 2 * 3\n" +"8 equals 2 * 4\n" +"9 equals 3 * 3" msgstr "" -":keyword:`!for` 和 :keyword:`!while` 迴圈可帶有一個 :keyword:`!else` 子句" +">>> for n in range(2, 10):\n" +"... for x in range(2, n):\n" +"... if n % x == 0:\n" +"... print(f\"{n} equals {x} * {n//x}\")\n" +"... break\n" +"...\n" +"4 equals 2 * 2\n" +"6 equals 2 * 3\n" +"8 equals 2 * 4\n" +"9 equals 3 * 3" -#: ../../tutorial/controlflow.rst:171 +#: ../../tutorial/controlflow.rst:180 +msgid "" +"The :keyword:`continue` statement continues with the next iteration of the " +"loop::" +msgstr ":keyword:`continue` 陳述式讓所屬的迴圈繼續執行下個疊代: ::" + +#: ../../tutorial/controlflow.rst:183 +msgid "" +">>> for num in range(2, 10):\n" +"... if num % 2 == 0:\n" +"... print(f\"Found an even number {num}\")\n" +"... continue\n" +"... print(f\"Found an odd number {num}\")\n" +"...\n" +"Found an even number 2\n" +"Found an odd number 3\n" +"Found an even number 4\n" +"Found an odd number 5\n" +"Found an even number 6\n" +"Found an odd number 7\n" +"Found an even number 8\n" +"Found an odd number 9" +msgstr "" +">>> for num in range(2, 10):\n" +"... if num % 2 == 0:\n" +"... print(f\"Found an even number {num}\")\n" +"... continue\n" +"... print(f\"Found an odd number {num}\")\n" +"...\n" +"Found an even number 2\n" +"Found an odd number 3\n" +"Found an even number 4\n" +"Found an odd number 5\n" +"Found an even number 6\n" +"Found an odd number 7\n" +"Found an even number 8\n" +"Found an odd number 9" + +#: ../../tutorial/controlflow.rst:201 +msgid ":keyword:`!else` Clauses on Loops" +msgstr "迴圈的 :keyword:`!else` 子句" + +#: ../../tutorial/controlflow.rst:203 +msgid "" +"In a :keyword:`!for` or :keyword:`!while` loop the :keyword:`!break` " +"statement may be paired with an :keyword:`!else` clause. If the loop " +"finishes without executing the :keyword:`!break`, the :keyword:`!else` " +"clause executes." +msgstr "" + +#: ../../tutorial/controlflow.rst:207 msgid "" "In a :keyword:`for` loop, the :keyword:`!else` clause is executed after the " -"loop reaches its final iteration." +"loop finishes its final iteration, that is, if no break occurred." msgstr "" -"在 :keyword:`for` 迴圈中,:keyword:`!else` 子句會在迴圈到達最終的疊代後執行。" +"在 :keyword:`for` 迴圈中,:keyword:`!else` 子句會在迴圈完成最終的疊代後執行。" -#: ../../tutorial/controlflow.rst:174 +#: ../../tutorial/controlflow.rst:210 msgid "" "In a :keyword:`while` loop, it's executed after the loop's condition becomes " "false." msgstr "在 :keyword:`while` 迴圈中,它會在迴圈條件變為 false 後執行。" -#: ../../tutorial/controlflow.rst:176 +#: ../../tutorial/controlflow.rst:212 msgid "" "In either kind of loop, the :keyword:`!else` clause is **not** executed if " -"the loop was terminated by a :keyword:`break`." +"the loop was terminated by a :keyword:`break`. Of course, other ways of " +"ending the loop early, such as a :keyword:`return` or a raised exception, " +"will also skip execution of the :keyword:`else` clause." msgstr "" "在任何一種迴圈中,如果迴圈由 :keyword:`break` 終止,則不會執行 :keyword:`!" -"else` 子句。" +"else` 子句。當然其他提早結束迴圈的方式(例如 :keyword:`return` 或引發例外)也" +"會跳過 :keyword:`else` 子句的執行。" -#: ../../tutorial/controlflow.rst:179 +#: ../../tutorial/controlflow.rst:217 msgid "" "This is exemplified in the following :keyword:`!for` loop, which searches " "for prime numbers::" msgstr "下面的 :keyword:`!for` 迴圈對此進行了舉例說明,該迴圈用以搜索質數: ::" -#: ../../tutorial/controlflow.rst:182 +#: ../../tutorial/controlflow.rst:220 msgid "" ">>> for n in range(2, 10):\n" "... for x in range(2, n):\n" @@ -363,74 +429,43 @@ msgid "" "9 equals 3 * 3" msgstr "" -#: ../../tutorial/controlflow.rst:200 +#: ../../tutorial/controlflow.rst:238 msgid "" "(Yes, this is the correct code. Look closely: the ``else`` clause belongs " -"to the :keyword:`for` loop, **not** the :keyword:`if` statement.)" +"to the ``for`` loop, **not** the ``if`` statement.)" msgstr "" -"(沒錯,這是正確的程式碼。請看仔細:``else`` 子句屬於 :keyword:`for` 迴圈,**" -"並非** :keyword:`if` 陳述式。)" +"(沒錯,這是正確的程式碼。請看仔細:``else`` 子句屬於 ``for`` 迴圈,**並非** " +"``if`` 陳述式。)" -#: ../../tutorial/controlflow.rst:203 -msgid "" -"When used with a loop, the ``else`` clause has more in common with the " -"``else`` clause of a :keyword:`try` statement than it does with that of :" -"keyword:`if` statements: a :keyword:`try` statement's ``else`` clause runs " -"when no exception occurs, and a loop's ``else`` clause runs when no " -"``break`` occurs. For more on the :keyword:`!try` statement and exceptions, " -"see :ref:`tut-handling`." -msgstr "" -"當 ``else`` 子句用於迴圈時,相較於搭配 :keyword:`if` 陳述式使用,它的行為與 :" -"keyword:`try` 陳述式中的 ``else`` 子句更為相似::keyword:`try` 陳述式的 " -"``else`` 子句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有" -"任何 ``break`` 發生時執行。更多有關 :keyword:`!try` 陳述式和例外的介紹,見" -"\\ :ref:`tut-handling`。" - -#: ../../tutorial/controlflow.rst:210 +#: ../../tutorial/controlflow.rst:241 msgid "" -"The :keyword:`continue` statement, also borrowed from C, continues with the " -"next iteration of the loop::" +"One way to think of the else clause is to imagine it paired with the ``if`` " +"inside the loop. As the loop executes, it will run a sequence like if/if/if/" +"else. The ``if`` is inside the loop, encountered a number of times. If the " +"condition is ever true, a ``break`` will happen. If the condition is never " +"true, the ``else`` clause outside the loop will execute." msgstr "" -":keyword:`continue` 陳述式,亦承襲於 C 語言,讓所屬的迴圈繼續執行下個疊" -"代: ::" -#: ../../tutorial/controlflow.rst:213 +#: ../../tutorial/controlflow.rst:247 msgid "" -">>> for num in range(2, 10):\n" -"... if num % 2 == 0:\n" -"... print(\"Found an even number\", num)\n" -"... continue\n" -"... print(\"Found an odd number\", num)\n" -"...\n" -"Found an even number 2\n" -"Found an odd number 3\n" -"Found an even number 4\n" -"Found an odd number 5\n" -"Found an even number 6\n" -"Found an odd number 7\n" -"Found an even number 8\n" -"Found an odd number 9" -msgstr "" -">>> for num in range(2, 10):\n" -"... if num % 2 == 0:\n" -"... print(\"Found an even number\", num)\n" -"... continue\n" -"... print(\"Found an odd number\", num)\n" -"...\n" -"Found an even number 2\n" -"Found an odd number 3\n" -"Found an even number 4\n" -"Found an odd number 5\n" -"Found an even number 6\n" -"Found an odd number 7\n" -"Found an even number 8\n" -"Found an odd number 9" - -#: ../../tutorial/controlflow.rst:231 +"When used with a loop, the ``else`` clause has more in common with the " +"``else`` clause of a :keyword:`try` statement than it does with that of " +"``if`` statements: a ``try`` statement's ``else`` clause runs when no " +"exception occurs, and a loop's ``else`` clause runs when no ``break`` " +"occurs. For more on the ``try`` statement and exceptions, see :ref:`tut-" +"handling`." +msgstr "" +"當 ``else`` 子句用於迴圈時,相較於搭配 ``if`` 陳述式使用,它的行為與 :" +"keyword:`try` 陳述式中的 ``else`` 子句更為相似:``try`` 陳述式的 ``else`` 子" +"句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有任何 " +"``break`` 發生時執行。更多有關 ``try`` 陳述式和例外的介紹,見\\ :ref:`tut-" +"handling`。" + +#: ../../tutorial/controlflow.rst:256 msgid ":keyword:`!pass` Statements" msgstr ":keyword:`!pass` 陳述式" -#: ../../tutorial/controlflow.rst:233 +#: ../../tutorial/controlflow.rst:258 msgid "" "The :keyword:`pass` statement does nothing. It can be used when a statement " "is required syntactically but the program requires no action. For example::" @@ -438,18 +473,18 @@ msgstr "" ":keyword:`pass` 陳述式不執行任何動作。它可用在語法上需要一個陳述式但程式不需" "要執行任何動作的時候。例如: ::" -#: ../../tutorial/controlflow.rst:236 +#: ../../tutorial/controlflow.rst:261 msgid "" ">>> while True:\n" "... pass # Busy-wait for keyboard interrupt (Ctrl+C)\n" "..." msgstr "" -#: ../../tutorial/controlflow.rst:240 +#: ../../tutorial/controlflow.rst:265 msgid "This is commonly used for creating minimal classes::" msgstr "這經常用於建立簡單的 class(類別): ::" -#: ../../tutorial/controlflow.rst:242 +#: ../../tutorial/controlflow.rst:267 msgid "" ">>> class MyEmptyClass:\n" "... pass\n" @@ -459,7 +494,7 @@ msgstr "" "... pass\n" "..." -#: ../../tutorial/controlflow.rst:246 +#: ../../tutorial/controlflow.rst:271 msgid "" "Another place :keyword:`pass` can be used is as a place-holder for a " "function or conditional body when you are working on new code, allowing you " @@ -469,18 +504,18 @@ msgstr "" ":keyword:`pass` 亦可作為一個函式或條件判斷主體的預留位置,在你撰寫新的程式碼" "時讓你保持在更抽象的思維層次。:keyword:`!pass` 會直接被忽略: ::" -#: ../../tutorial/controlflow.rst:250 +#: ../../tutorial/controlflow.rst:275 msgid "" ">>> def initlog(*args):\n" "... pass # Remember to implement this!\n" "..." msgstr "" -#: ../../tutorial/controlflow.rst:258 +#: ../../tutorial/controlflow.rst:283 msgid ":keyword:`!match` Statements" msgstr ":keyword:`!match` 陳述式" -#: ../../tutorial/controlflow.rst:260 +#: ../../tutorial/controlflow.rst:285 msgid "" "A :keyword:`match` statement takes an expression and compares its value to " "successive patterns given as one or more case blocks. This is superficially " @@ -496,14 +531,14 @@ msgstr "" "言中的模式匹配 (pattern matching) 更為相近。只有第一個匹配成功的模式會被執" "行,而它也可以將成分(序列元素或物件屬性)從值中提取到變數中。" -#: ../../tutorial/controlflow.rst:268 +#: ../../tutorial/controlflow.rst:293 msgid "" "The simplest form compares a subject value against one or more literals::" msgstr "" "最簡單的形式,是將一個主題值 (subject value) 與一個或多個字面值 (literal) 進" "行比較: ::" -#: ../../tutorial/controlflow.rst:270 +#: ../../tutorial/controlflow.rst:295 msgid "" "def http_error(status):\n" " match status:\n" @@ -527,7 +562,7 @@ msgstr "" " case _:\n" " return \"Something's wrong with the internet\"" -#: ../../tutorial/controlflow.rst:281 +#: ../../tutorial/controlflow.rst:306 msgid "" "Note the last block: the \"variable name\" ``_`` acts as a *wildcard* and " "never fails to match. If no case matches, none of the branches is executed." @@ -535,12 +570,12 @@ msgstr "" "請注意最後一段:「變數名稱」\\ ``_`` 是作為\\ *通用字元 (wildcard)*\\ 的角" "色,且永遠不會匹配失敗。如果沒有 case 匹配成功,則不會執行任何的分支。" -#: ../../tutorial/controlflow.rst:284 +#: ../../tutorial/controlflow.rst:309 msgid "" "You can combine several literals in a single pattern using ``|`` (\"or\")::" msgstr "你可以使用 ``|``\\ (「或」)來將多個字面值組合在單一模式中: ::" -#: ../../tutorial/controlflow.rst:286 +#: ../../tutorial/controlflow.rst:311 msgid "" "case 401 | 403 | 404:\n" " return \"Not allowed\"" @@ -548,14 +583,14 @@ msgstr "" "case 401 | 403 | 404:\n" " return \"Not allowed\"" -#: ../../tutorial/controlflow.rst:289 +#: ../../tutorial/controlflow.rst:314 msgid "" "Patterns can look like unpacking assignments, and can be used to bind " "variables::" msgstr "" "模式可以看起來像是拆解賦值 (unpacking assignment),且可以用來連結變數: ::" -#: ../../tutorial/controlflow.rst:292 +#: ../../tutorial/controlflow.rst:317 msgid "" "# point is an (x, y) tuple\n" "match point:\n" @@ -571,7 +606,7 @@ msgid "" " raise ValueError(\"Not a point\")" msgstr "" -#: ../../tutorial/controlflow.rst:305 +#: ../../tutorial/controlflow.rst:330 msgid "" "Study that one carefully! The first pattern has two literals, and can be " "thought of as an extension of the literal pattern shown above. But the next " @@ -585,7 +620,7 @@ msgstr "" "(bind)* 了來自主題 (``point``) 的一個值。第四個模式會擷取兩個值,這使得它在概" "念上類似於拆解賦值 ``(x, y) = point``。" -#: ../../tutorial/controlflow.rst:312 +#: ../../tutorial/controlflow.rst:337 msgid "" "If you are using classes to structure your data you can use the class name " "followed by an argument list resembling a constructor, but with the ability " @@ -594,7 +629,7 @@ msgstr "" "如果你要用 class 來結構化你的資料,你可以使用該 class 的名稱加上一個引數列" "表,類似一個建構式 (constructor),但它能夠將屬性擷取到變數中: ::" -#: ../../tutorial/controlflow.rst:316 +#: ../../tutorial/controlflow.rst:341 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -632,7 +667,7 @@ msgstr "" " case _:\n" " print(\"Not a point\")" -#: ../../tutorial/controlflow.rst:334 +#: ../../tutorial/controlflow.rst:359 msgid "" "You can use positional parameters with some builtin classes that provide an " "ordering for their attributes (e.g. dataclasses). You can also define a " @@ -646,7 +681,7 @@ msgstr "" "``__match_args__``,來定義模式中屬性們的特定位置。如果它被設定為 (\"x\", " "\"y\"),則以下的模式都是等價的(且都會將屬性 ``y`` 連結到變數 ``var``): ::" -#: ../../tutorial/controlflow.rst:340 +#: ../../tutorial/controlflow.rst:365 msgid "" "Point(1, var)\n" "Point(1, y=var)\n" @@ -658,7 +693,7 @@ msgstr "" "Point(x=1, y=var)\n" "Point(y=var, x=1)" -#: ../../tutorial/controlflow.rst:345 +#: ../../tutorial/controlflow.rst:370 msgid "" "A recommended way to read patterns is to look at them as an extended form of " "what you would put on the left of an assignment, to understand which " @@ -674,7 +709,7 @@ msgstr "" "的 ``x=`` 及 ``y=``)或 class 名稱(由它們後面的 \"(...)\" 被辨識,如上面的 " "``Point``)則永遠無法被賦值。" -#: ../../tutorial/controlflow.rst:352 +#: ../../tutorial/controlflow.rst:377 msgid "" "Patterns can be arbitrarily nested. For example, if we have a short list of " "Points, with ``__match_args__`` added, we could match it like this::" @@ -682,7 +717,7 @@ msgstr "" "模式可以任意地被巢套 (nested)。例如,如果我們有一個由某些點所組成的簡短 " "list,我們就可以像這樣加入 ``__match_args__`` 來對它進行匹配: ::" -#: ../../tutorial/controlflow.rst:355 +#: ../../tutorial/controlflow.rst:380 msgid "" "class Point:\n" " __match_args__ = ('x', 'y')\n" @@ -720,7 +755,7 @@ msgstr "" " case _:\n" " print(\"Something else\")" -#: ../../tutorial/controlflow.rst:373 +#: ../../tutorial/controlflow.rst:398 msgid "" "We can add an ``if`` clause to a pattern, known as a \"guard\". If the " "guard is false, ``match`` goes on to try the next case block. Note that " @@ -730,7 +765,7 @@ msgstr "" "則 ``match`` 會繼續嘗試下一個 case 區塊。請注意,值的擷取會發生在防護的評估之" "前: ::" -#: ../../tutorial/controlflow.rst:377 +#: ../../tutorial/controlflow.rst:402 msgid "" "match point:\n" " case Point(x, y) if x == y:\n" @@ -744,11 +779,11 @@ msgstr "" " case Point(x, y):\n" " print(f\"Not on the diagonal\")" -#: ../../tutorial/controlflow.rst:383 +#: ../../tutorial/controlflow.rst:408 msgid "Several other key features of this statement:" msgstr "此種陳述式的其他幾個重要特色:" -#: ../../tutorial/controlflow.rst:385 +#: ../../tutorial/controlflow.rst:410 msgid "" "Like unpacking assignments, tuple and list patterns have exactly the same " "meaning and actually match arbitrary sequences. An important exception is " @@ -757,7 +792,7 @@ msgstr "" "與拆解賦值的情況類似,tuple(元組)和 list 模式具有完全相同的意義,而且實際上" "可以匹配任意的序列。一個重要的例外,是它們不能匹配疊代器 (iterator) 或字串。" -#: ../../tutorial/controlflow.rst:389 +#: ../../tutorial/controlflow.rst:414 msgid "" "Sequence patterns support extended unpacking: ``[x, y, *rest]`` and ``(x, y, " "*rest)`` work similar to unpacking assignments. The name after ``*`` may " @@ -769,27 +804,27 @@ msgstr "" "``_``,所以 ``(x, y, *_)`` 會匹配一個至少兩項的序列,且不會連結那兩項以外的其" "餘項。" -#: ../../tutorial/controlflow.rst:394 +#: ../../tutorial/controlflow.rst:419 msgid "" "Mapping patterns: ``{\"bandwidth\": b, \"latency\": l}`` captures the " "``\"bandwidth\"`` and ``\"latency\"`` values from a dictionary. Unlike " "sequence patterns, extra keys are ignored. An unpacking like ``**rest`` is " "also supported. (But ``**_`` would be redundant, so it is not allowed.)" msgstr "" -"映射模式 (mapping pattern):``{\"bandwidth\": b, \"latency\": l}`` 能從一個 " +"對映模式 (mapping pattern):``{\"bandwidth\": b, \"latency\": l}`` 能從一個 " "dictionary(字典)中擷取 ``\"bandwidth\"`` 及 ``\"latency\"`` 的值。與序列模" "式不同,額外的鍵 (key) 會被忽略。一種像是 ``**rest`` 的拆解方式,也是可被支援" "的。(但 ``**_`` 則是多餘的做法,所以它並不被允許。)" -#: ../../tutorial/controlflow.rst:399 +#: ../../tutorial/controlflow.rst:424 msgid "Subpatterns may be captured using the ``as`` keyword::" msgstr "使用關鍵字 ``as`` 可以擷取子模式 (subpattern): ::" -#: ../../tutorial/controlflow.rst:401 +#: ../../tutorial/controlflow.rst:426 msgid "case (Point(x1, y1), Point(x2, y2) as p2): ..." msgstr "case (Point(x1, y1), Point(x2, y2) as p2): ..." -#: ../../tutorial/controlflow.rst:403 +#: ../../tutorial/controlflow.rst:428 msgid "" "will capture the second element of the input as ``p2`` (as long as the input " "is a sequence of two points)" @@ -797,7 +832,7 @@ msgstr "" "將會擷取輸入的第二個元素作為 ``p2``\\ (只要該輸入是一個由兩個點所組成的序" "列)。" -#: ../../tutorial/controlflow.rst:406 +#: ../../tutorial/controlflow.rst:431 msgid "" "Most literals are compared by equality, however the singletons ``True``, " "``False`` and ``None`` are compared by identity." @@ -805,7 +840,7 @@ msgstr "" "大部分的字面值是藉由相等性 (equality) 來比較,但是單例物件 (singleton) " "``True``、``False`` 和 ``None`` 是藉由標識值 (identity) 來比較。" -#: ../../tutorial/controlflow.rst:409 +#: ../../tutorial/controlflow.rst:434 msgid "" "Patterns may use named constants. These must be dotted names to prevent " "them from being interpreted as capture variable::" @@ -813,7 +848,7 @@ msgstr "" "模式可以使用附名常數 (named constant)。這些模式必須是點分隔名稱,以免它們被解" "釋為擷取變數: ::" -#: ../../tutorial/controlflow.rst:412 +#: ../../tutorial/controlflow.rst:437 msgid "" "from enum import Enum\n" "class Color(Enum):\n" @@ -847,24 +882,24 @@ msgstr "" " case Color.BLUE:\n" " print(\"I'm feeling the blues :(\")" -#: ../../tutorial/controlflow.rst:428 +#: ../../tutorial/controlflow.rst:453 msgid "" "For a more detailed explanation and additional examples, you can look into :" "pep:`636` which is written in a tutorial format." msgstr "" "關於更詳細的解釋和其他範例,你可以閱讀 :pep:`636`,它是以教學的格式編寫而成。" -#: ../../tutorial/controlflow.rst:434 +#: ../../tutorial/controlflow.rst:459 msgid "Defining Functions" msgstr "定義函式 (function)" -#: ../../tutorial/controlflow.rst:436 +#: ../../tutorial/controlflow.rst:461 msgid "" "We can create a function that writes the Fibonacci series to an arbitrary " "boundary::" msgstr "我們可以建立一個函式來產生費式數列到任何一個上界: ::" -#: ../../tutorial/controlflow.rst:439 +#: ../../tutorial/controlflow.rst:464 msgid "" ">>> def fib(n): # write Fibonacci series up to n\n" "... \"\"\"Print a Fibonacci series up to n.\"\"\"\n" @@ -879,7 +914,7 @@ msgid "" "0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597" msgstr "" -#: ../../tutorial/controlflow.rst:456 +#: ../../tutorial/controlflow.rst:481 msgid "" "The keyword :keyword:`def` introduces a function *definition*. It must be " "followed by the function name and the parenthesized list of formal " @@ -889,7 +924,7 @@ msgstr "" "關鍵字 :keyword:`def` 介紹一個函式的\\ *定義*。它之後必須連著該函式的名稱和置" "於括號之中的一串參數。自下一行起,所有縮排的陳述式成為該函式的主體。" -#: ../../tutorial/controlflow.rst:461 +#: ../../tutorial/controlflow.rst:486 msgid "" "The first statement of the function body can optionally be a string literal; " "this string literal is the function's documentation string, or :dfn:" @@ -905,7 +940,7 @@ msgstr "" "件,或讓使用者能以互動的方式在原始碼中瀏覽文件。在原始碼中加入 docstring 是個" "好慣例,應該養成這樣的習慣。" -#: ../../tutorial/controlflow.rst:468 +#: ../../tutorial/controlflow.rst:493 msgid "" "The *execution* of a function introduces a new symbol table used for the " "local variables of the function. More precisely, all variable assignments " @@ -926,7 +961,7 @@ msgstr "" "域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數在 :keyword:" "`nonlocal` 陳述式中被定義)。" -#: ../../tutorial/controlflow.rst:479 +#: ../../tutorial/controlflow.rst:504 msgid "" "The actual parameters (arguments) to a function call are introduced in the " "local symbol table of the called function when it is called; thus, arguments " @@ -940,7 +975,7 @@ msgstr "" "永遠是一個物件的\\ *參照 (reference)*,而不是該物件的值)。 [#]_ 當一個函式呼" "叫別的函式或遞迴呼叫它自己時,在被呼叫的函式中會建立一個新的區域符號表。" -#: ../../tutorial/controlflow.rst:486 +#: ../../tutorial/controlflow.rst:511 msgid "" "A function definition associates the function name with the function object " "in the current symbol table. The interpreter recognizes the object pointed " @@ -951,7 +986,7 @@ msgstr "" "直譯器辨識為使用者自定函式 (user-defined function)。該值可以被指定給別的變數" "名,使該變數名也可以被當作函式使用。這是常見的重新命名方式: ::" -#: ../../tutorial/controlflow.rst:491 +#: ../../tutorial/controlflow.rst:516 msgid "" ">>> fib\n" "\n" @@ -965,7 +1000,7 @@ msgstr "" ">>> f(100)\n" "0 1 1 2 3 5 8 13 21 34 55 89" -#: ../../tutorial/controlflow.rst:497 +#: ../../tutorial/controlflow.rst:522 msgid "" "Coming from other languages, you might object that ``fib`` is not a function " "but a procedure since it doesn't return a value. In fact, even functions " @@ -980,7 +1015,7 @@ msgstr "" "亦有一個固定的回傳值。這個值稱為 ``None``\\ (它是一個內建名稱)。在直譯器中" "單獨使用 ``None`` 時,通常不會被顯示。你可以使用 :func:`print` 來看到它: ::" -#: ../../tutorial/controlflow.rst:504 +#: ../../tutorial/controlflow.rst:529 msgid "" ">>> fib(0)\n" ">>> print(fib(0))\n" @@ -990,13 +1025,13 @@ msgstr "" ">>> print(fib(0))\n" "None" -#: ../../tutorial/controlflow.rst:508 +#: ../../tutorial/controlflow.rst:533 msgid "" "It is simple to write a function that returns a list of the numbers of the " "Fibonacci series, instead of printing it::" msgstr "如果要寫一個函式回傳費式數列的 list 而不是直接印出它,這也很容易: ::" -#: ../../tutorial/controlflow.rst:511 +#: ../../tutorial/controlflow.rst:536 msgid "" ">>> def fib2(n): # return Fibonacci series up to n\n" "... \"\"\"Return a list containing the Fibonacci series up to n.\"\"\"\n" @@ -1012,11 +1047,11 @@ msgid "" "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]" msgstr "" -#: ../../tutorial/controlflow.rst:524 +#: ../../tutorial/controlflow.rst:549 msgid "This example, as usual, demonstrates some new Python features:" msgstr "這個例子一樣示範了一些新的 Python 特性:" -#: ../../tutorial/controlflow.rst:526 +#: ../../tutorial/controlflow.rst:551 msgid "" "The :keyword:`return` statement returns with a value from a function. :" "keyword:`!return` without an expression argument returns ``None``. Falling " @@ -1026,7 +1061,7 @@ msgstr "" "不外加一個運算式作為引數時會回傳 ``None``。一個函式執行到結束也會回傳 " "``None``。" -#: ../../tutorial/controlflow.rst:530 +#: ../../tutorial/controlflow.rst:555 msgid "" "The statement ``result.append(a)`` calls a *method* of the list object " "``result``. A method is a function that 'belongs' to an object and is named " @@ -1049,22 +1084,22 @@ msgstr "" "義在 list 物件中;它會在該 list 的末端加入一個新的元素。這個例子等同於 " "``result = result + [a]``,但更有效率。" -#: ../../tutorial/controlflow.rst:545 +#: ../../tutorial/controlflow.rst:570 msgid "More on Defining Functions" msgstr "深入了解函式定義" -#: ../../tutorial/controlflow.rst:547 +#: ../../tutorial/controlflow.rst:572 msgid "" "It is also possible to define functions with a variable number of arguments. " "There are three forms, which can be combined." msgstr "" "定義函式時使用的引數 (argument) 數量是可變的。總共有三種可以組合使用的形式。" -#: ../../tutorial/controlflow.rst:554 +#: ../../tutorial/controlflow.rst:579 msgid "Default Argument Values" msgstr "預設引數值" -#: ../../tutorial/controlflow.rst:556 +#: ../../tutorial/controlflow.rst:581 msgid "" "The most useful form is to specify a default value for one or more " "arguments. This creates a function that can be called with fewer arguments " @@ -1073,7 +1108,7 @@ msgstr "" "為一個或多個引數指定預設值是很有用的方式。函式建立後,可以用比定義時更少的引" "數呼叫該函式。例如: ::" -#: ../../tutorial/controlflow.rst:560 +#: ../../tutorial/controlflow.rst:585 msgid "" "def ask_ok(prompt, retries=4, reminder='Please try again!'):\n" " while True:\n" @@ -1099,22 +1134,22 @@ msgstr "" " raise ValueError('invalid user response')\n" " print(reminder)" -#: ../../tutorial/controlflow.rst:572 +#: ../../tutorial/controlflow.rst:597 msgid "This function can be called in several ways:" msgstr "該函式可以用以下幾種方式被呼叫:" -#: ../../tutorial/controlflow.rst:574 +#: ../../tutorial/controlflow.rst:599 msgid "" "giving only the mandatory argument: ``ask_ok('Do you really want to quit?')``" msgstr "只給必要引數:``ask_ok('Do you really want to quit?')``" -#: ../../tutorial/controlflow.rst:576 +#: ../../tutorial/controlflow.rst:601 msgid "" "giving one of the optional arguments: ``ask_ok('OK to overwrite the file?', " "2)``" msgstr "給予一個選擇性引數:``ask_ok('OK to overwrite the file?', 2)``" -#: ../../tutorial/controlflow.rst:578 +#: ../../tutorial/controlflow.rst:603 msgid "" "or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come " "on, only yes or no!')``" @@ -1122,19 +1157,19 @@ msgstr "" "給予所有引數:``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or " "no!')``" -#: ../../tutorial/controlflow.rst:581 +#: ../../tutorial/controlflow.rst:606 msgid "" "This example also introduces the :keyword:`in` keyword. This tests whether " "or not a sequence contains a certain value." msgstr "此例也使用了關鍵字 :keyword:`in`,用於測試序列中是否包含某個特定值。" -#: ../../tutorial/controlflow.rst:584 +#: ../../tutorial/controlflow.rst:609 msgid "" "The default values are evaluated at the point of function definition in the " "*defining* scope, so that ::" msgstr "預設值是在函式定義當下,於\\ *定義時*\\ 的作用域中求值,所以: ::" -#: ../../tutorial/controlflow.rst:587 +#: ../../tutorial/controlflow.rst:612 msgid "" "i = 5\n" "\n" @@ -1152,11 +1187,11 @@ msgstr "" "i = 6\n" "f()" -#: ../../tutorial/controlflow.rst:595 +#: ../../tutorial/controlflow.rst:620 msgid "will print ``5``." msgstr "將會輸出 ``5``。" -#: ../../tutorial/controlflow.rst:597 +#: ../../tutorial/controlflow.rst:622 msgid "" "**Important warning:** The default value is evaluated only once. This makes " "a difference when the default is a mutable object such as a list, " @@ -1167,7 +1202,7 @@ msgstr "" "(字典)或許多類別實例時,會產生不同的結果。例如,以下函式於後續呼叫時會累積" "曾經傳遞的引數: ::" -#: ../../tutorial/controlflow.rst:602 +#: ../../tutorial/controlflow.rst:627 msgid "" "def f(a, L=[]):\n" " L.append(a)\n" @@ -1185,11 +1220,11 @@ msgstr "" "print(f(2))\n" "print(f(3))" -#: ../../tutorial/controlflow.rst:610 +#: ../../tutorial/controlflow.rst:635 msgid "This will print ::" msgstr "將會輸出: ::" -#: ../../tutorial/controlflow.rst:612 +#: ../../tutorial/controlflow.rst:637 msgid "" "[1]\n" "[1, 2]\n" @@ -1199,13 +1234,13 @@ msgstr "" "[1, 2]\n" "[1, 2, 3]" -#: ../../tutorial/controlflow.rst:616 +#: ../../tutorial/controlflow.rst:641 msgid "" "If you don't want the default to be shared between subsequent calls, you can " "write the function like this instead::" msgstr "如果不想在後續呼叫之間共用預設值,應以如下方式編寫函式:" -#: ../../tutorial/controlflow.rst:619 +#: ../../tutorial/controlflow.rst:644 msgid "" "def f(a, L=None):\n" " if L is None:\n" @@ -1219,11 +1254,11 @@ msgstr "" " L.append(a)\n" " return L" -#: ../../tutorial/controlflow.rst:629 +#: ../../tutorial/controlflow.rst:654 msgid "Keyword Arguments" msgstr "關鍵字引數" -#: ../../tutorial/controlflow.rst:631 +#: ../../tutorial/controlflow.rst:656 msgid "" "Functions can also be called using :term:`keyword arguments ` of the form ``kwarg=value``. For instance, the following " @@ -1232,7 +1267,7 @@ msgstr "" "函式也可以使用\\ :term:`關鍵字引數 `,以 ``kwarg=value`` 的" "形式呼叫。舉例來說,以下函式: ::" -#: ../../tutorial/controlflow.rst:634 +#: ../../tutorial/controlflow.rst:659 msgid "" "def parrot(voltage, state='a stiff', action='http://github.com/voom', type='Norwegian Blue'):\n" " print(\"-- This parrot wouldn't\", action, end=' ')\n" @@ -1246,7 +1281,7 @@ msgstr "" " print(\"-- Lovely plumage, the\", type)\n" " print(\"-- It's\", state, \"!\")" -#: ../../tutorial/controlflow.rst:640 +#: ../../tutorial/controlflow.rst:665 msgid "" "accepts one required argument (``voltage``) and three optional arguments " "(``state``, ``action``, and ``type``). This function can be called in any " @@ -1255,7 +1290,7 @@ msgstr "" "接受一個必要引數 (``voltage``) 和三個選擇性引數 (``state``,``action``,和 " "``type``)。該函式可用下列任一方式呼叫: ::" -#: ../../tutorial/controlflow.rst:644 +#: ../../tutorial/controlflow.rst:669 msgid "" "parrot(1000) # 1 positional " "argument\n" @@ -1268,11 +1303,11 @@ msgid "" "keyword" msgstr "" -#: ../../tutorial/controlflow.rst:651 +#: ../../tutorial/controlflow.rst:676 msgid "but all the following calls would be invalid::" msgstr "但以下呼叫方式都無效: ::" -#: ../../tutorial/controlflow.rst:653 +#: ../../tutorial/controlflow.rst:678 msgid "" "parrot() # required argument missing\n" "parrot(voltage=5.0, 'dead') # non-keyword argument after a keyword " @@ -1281,7 +1316,7 @@ msgid "" "parrot(actor='John Cleese') # unknown keyword argument" msgstr "" -#: ../../tutorial/controlflow.rst:658 +#: ../../tutorial/controlflow.rst:683 msgid "" "In a function call, keyword arguments must follow positional arguments. All " "the keyword arguments passed must match one of the arguments accepted by the " @@ -1297,7 +1332,7 @@ msgstr "" "則也包括必要引數,(\\ ``parrot(voltage=1000)`` 也有效)。一個引數不可多次被" "賦值,下面就是一個因此限制而無效的例子: ::" -#: ../../tutorial/controlflow.rst:666 +#: ../../tutorial/controlflow.rst:691 msgid "" ">>> def function(a):\n" "... pass\n" @@ -1315,7 +1350,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: function() got multiple values for argument 'a'" -#: ../../tutorial/controlflow.rst:674 +#: ../../tutorial/controlflow.rst:699 msgid "" "When a final formal parameter of the form ``**name`` is present, it receives " "a dictionary (see :ref:`typesmapping`) containing all keyword arguments " @@ -1331,7 +1366,7 @@ msgstr "" "個 :ref:`tuple `,該 tuple 包含一般參數以外的位置引數(\\ " "``*name`` 必須出現在 ``**name`` 前面)。例如,若我們定義這樣的函式: ::" -#: ../../tutorial/controlflow.rst:682 +#: ../../tutorial/controlflow.rst:707 msgid "" "def cheeseshop(kind, *arguments, **keywords):\n" " print(\"-- Do you have any\", kind, \"?\")\n" @@ -1351,11 +1386,11 @@ msgstr "" " for kw in keywords:\n" " print(kw, \":\", keywords[kw])" -#: ../../tutorial/controlflow.rst:691 +#: ../../tutorial/controlflow.rst:716 msgid "It could be called like this::" msgstr "它可以被如此呼叫: ::" -#: ../../tutorial/controlflow.rst:693 +#: ../../tutorial/controlflow.rst:718 msgid "" "cheeseshop(\"Limburger\", \"It's very runny, sir.\",\n" " \"It's really very, VERY runny, sir.\",\n" @@ -1369,11 +1404,11 @@ msgstr "" " client=\"John Cleese\",\n" " sketch=\"Cheese Shop Sketch\")" -#: ../../tutorial/controlflow.rst:699 +#: ../../tutorial/controlflow.rst:724 msgid "and of course it would print:" msgstr "輸出結果如下: ::" -#: ../../tutorial/controlflow.rst:701 +#: ../../tutorial/controlflow.rst:726 msgid "" "-- Do you have any Limburger ?\n" "-- I'm sorry, we're all out of Limburger\n" @@ -1393,17 +1428,17 @@ msgstr "" "client : John Cleese\n" "sketch : Cheese Shop Sketch" -#: ../../tutorial/controlflow.rst:712 +#: ../../tutorial/controlflow.rst:737 msgid "" "Note that the order in which the keyword arguments are printed is guaranteed " "to match the order in which they were provided in the function call." msgstr "注意,關鍵字引數的輸出順序與呼叫函式時被提供的順序必定一致。" -#: ../../tutorial/controlflow.rst:716 +#: ../../tutorial/controlflow.rst:741 msgid "Special parameters" msgstr "特殊參數" -#: ../../tutorial/controlflow.rst:718 +#: ../../tutorial/controlflow.rst:743 msgid "" "By default, arguments may be passed to a Python function either by position " "or explicitly by keyword. For readability and performance, it makes sense to " @@ -1415,11 +1450,11 @@ msgstr "" "及效能,限制引數的傳遞方式是合理的,如此,開發者只需查看函式定義,即可確定各" "項目是按位置,按位置或關鍵字,還是按關鍵字傳遞。" -#: ../../tutorial/controlflow.rst:724 +#: ../../tutorial/controlflow.rst:749 msgid "A function definition may look like:" msgstr "函式定義可能如以下樣式:" -#: ../../tutorial/controlflow.rst:726 +#: ../../tutorial/controlflow.rst:751 msgid "" "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):\n" " ----------- ---------- ----------\n" @@ -1435,7 +1470,7 @@ msgstr "" " | - Keyword only\n" " -- Positional only" -#: ../../tutorial/controlflow.rst:735 +#: ../../tutorial/controlflow.rst:760 msgid "" "where ``/`` and ``*`` are optional. If used, these symbols indicate the kind " "of parameter by how the arguments may be passed to the function: positional-" @@ -1446,22 +1481,22 @@ msgstr "" "類:僅限位置、位置或關鍵字、僅限關鍵字。關鍵字參數也稱為附名參數 (named " "parameters)。" -#: ../../tutorial/controlflow.rst:742 +#: ../../tutorial/controlflow.rst:767 msgid "Positional-or-Keyword Arguments" msgstr "位置或關鍵字引數 (Positional-or-Keyword Arguments)" -#: ../../tutorial/controlflow.rst:744 +#: ../../tutorial/controlflow.rst:769 msgid "" "If ``/`` and ``*`` are not present in the function definition, arguments may " "be passed to a function by position or by keyword." msgstr "" "若函式定義中未使用 ``/`` 和 ``*`` 時,引數可以按位置或關鍵字傳遞給函式。" -#: ../../tutorial/controlflow.rst:749 +#: ../../tutorial/controlflow.rst:774 msgid "Positional-Only Parameters" msgstr "僅限位置參數 (Positional-Only Parameters)" -#: ../../tutorial/controlflow.rst:751 +#: ../../tutorial/controlflow.rst:776 msgid "" "Looking at this in a bit more detail, it is possible to mark certain " "parameters as *positional-only*. If *positional-only*, the parameters' order " @@ -1476,17 +1511,17 @@ msgstr "" "``\\ (斜線)之前。``/`` 用於在邏輯上分開僅限位置參數與其餘參數。如果函式定義" "中沒有 ``/``,則表示沒有任何僅限位置參數。" -#: ../../tutorial/controlflow.rst:759 +#: ../../tutorial/controlflow.rst:784 msgid "" "Parameters following the ``/`` may be *positional-or-keyword* or *keyword-" "only*." msgstr "``/`` 後面的參數可以是\\ *位置或關鍵字*\\ 或\\ *僅限關鍵字*\\ 參數。" -#: ../../tutorial/controlflow.rst:763 +#: ../../tutorial/controlflow.rst:788 msgid "Keyword-Only Arguments" msgstr "僅限關鍵字引數 (Keyword-Only Arguments)" -#: ../../tutorial/controlflow.rst:765 +#: ../../tutorial/controlflow.rst:790 msgid "" "To mark parameters as *keyword-only*, indicating the parameters must be " "passed by keyword argument, place an ``*`` in the arguments list just before " @@ -1495,17 +1530,17 @@ msgstr "" "要把參數標記為\\ *僅限關鍵字*,表明參數必須以關鍵字引數傳遞,必須在引數列表中" "第一個\\ *僅限關鍵字*\\ 參數前放上 ``*``。" -#: ../../tutorial/controlflow.rst:771 +#: ../../tutorial/controlflow.rst:796 msgid "Function Examples" msgstr "函式範例" -#: ../../tutorial/controlflow.rst:773 +#: ../../tutorial/controlflow.rst:798 msgid "" "Consider the following example function definitions paying close attention " "to the markers ``/`` and ``*``::" msgstr "請看以下的函式定義範例,注意 ``/`` 和 ``*`` 記號: ::" -#: ../../tutorial/controlflow.rst:776 +#: ../../tutorial/controlflow.rst:801 msgid "" ">>> def standard_arg(arg):\n" "... print(arg)\n" @@ -1531,7 +1566,7 @@ msgstr "" ">>> def combined_example(pos_only, /, standard, *, kwd_only):\n" "... print(pos_only, standard, kwd_only)" -#: ../../tutorial/controlflow.rst:789 +#: ../../tutorial/controlflow.rst:814 msgid "" "The first function definition, ``standard_arg``, the most familiar form, " "places no restrictions on the calling convention and arguments may be passed " @@ -1540,7 +1575,7 @@ msgstr "" "第一個函式定義 ``standard_arg`` 是我們最熟悉的形式,對呼叫方式沒有任何限制," "可以按位置或關鍵字傳遞引數: ::" -#: ../../tutorial/controlflow.rst:793 +#: ../../tutorial/controlflow.rst:818 msgid "" ">>> standard_arg(2)\n" "2\n" @@ -1554,14 +1589,14 @@ msgstr "" ">>> standard_arg(arg=2)\n" "2" -#: ../../tutorial/controlflow.rst:799 +#: ../../tutorial/controlflow.rst:824 msgid "" "The second function ``pos_only_arg`` is restricted to only use positional " "parameters as there is a ``/`` in the function definition::" msgstr "" "第二個函式 ``pos_only_arg`` 的函式定義中有 ``/``,因此僅限使用位置參數: ::" -#: ../../tutorial/controlflow.rst:802 +#: ../../tutorial/controlflow.rst:827 msgid "" ">>> pos_only_arg(1)\n" "1\n" @@ -1581,14 +1616,14 @@ msgstr "" "TypeError: pos_only_arg() got some positional-only arguments passed as " "keyword arguments: 'arg'" -#: ../../tutorial/controlflow.rst:810 +#: ../../tutorial/controlflow.rst:835 msgid "" "The third function ``kwd_only_args`` only allows keyword arguments as " "indicated by a ``*`` in the function definition::" msgstr "" "第三個函式 ``kwd_only_args`` 的函式定義透過 ``*`` 表明僅限關鍵字引數: ::" -#: ../../tutorial/controlflow.rst:813 +#: ../../tutorial/controlflow.rst:838 msgid "" ">>> kwd_only_arg(3)\n" "Traceback (most recent call last):\n" @@ -1606,13 +1641,13 @@ msgstr "" ">>> kwd_only_arg(arg=3)\n" "3" -#: ../../tutorial/controlflow.rst:821 +#: ../../tutorial/controlflow.rst:846 msgid "" "And the last uses all three calling conventions in the same function " "definition::" msgstr "最後一個函式在同一個函式定義中,使用了全部三種呼叫方式: ::" -#: ../../tutorial/controlflow.rst:824 +#: ../../tutorial/controlflow.rst:849 msgid "" ">>> combined_example(1, 2, 3)\n" "Traceback (most recent call last):\n" @@ -1648,7 +1683,7 @@ msgstr "" "TypeError: combined_example() got some positional-only arguments passed as " "keyword arguments: 'pos_only'" -#: ../../tutorial/controlflow.rst:841 +#: ../../tutorial/controlflow.rst:866 msgid "" "Finally, consider this function definition which has a potential collision " "between the positional argument ``name`` and ``**kwds`` which has ``name`` " @@ -1657,7 +1692,7 @@ msgstr "" "最後,請看這個函式定義,如果 ``**kwds`` 內有 ``name`` 這個鍵,可能與位置引數 " "``name`` 產生潛在衝突: ::" -#: ../../tutorial/controlflow.rst:843 +#: ../../tutorial/controlflow.rst:868 msgid "" "def foo(name, **kwds):\n" " return 'name' in kwds" @@ -1665,7 +1700,7 @@ msgstr "" "def foo(name, **kwds):\n" " return 'name' in kwds" -#: ../../tutorial/controlflow.rst:846 +#: ../../tutorial/controlflow.rst:871 msgid "" "There is no possible call that will make it return ``True`` as the keyword " "``'name'`` will always bind to the first parameter. For example::" @@ -1673,7 +1708,7 @@ msgstr "" "呼叫該函式不可能回傳 ``True``,因為關鍵字 ``'name'`` 永遠是連結在第一個參數。" "例如: ::" -#: ../../tutorial/controlflow.rst:849 +#: ../../tutorial/controlflow.rst:874 msgid "" ">>> foo(1, **{'name': 2})\n" "Traceback (most recent call last):\n" @@ -1687,7 +1722,7 @@ msgstr "" "TypeError: foo() got multiple values for argument 'name'\n" ">>>" -#: ../../tutorial/controlflow.rst:855 +#: ../../tutorial/controlflow.rst:880 msgid "" "But using ``/`` (positional only arguments), it is possible since it allows " "``name`` as a positional argument and ``'name'`` as a key in the keyword " @@ -1696,7 +1731,7 @@ msgstr "" "使用 ``/``\\ (僅限位置引數)後,就可以了。函式定義會允許 ``name`` 當作位置引" "數,而 ``'name'`` 也可以當作關鍵字引數中的鍵: ::" -#: ../../tutorial/controlflow.rst:857 +#: ../../tutorial/controlflow.rst:882 msgid "" ">>> def foo(name, /, **kwds):\n" "... return 'name' in kwds\n" @@ -1710,31 +1745,31 @@ msgstr "" ">>> foo(1, **{'name': 2})\n" "True" -#: ../../tutorial/controlflow.rst:863 +#: ../../tutorial/controlflow.rst:888 msgid "" "In other words, the names of positional-only parameters can be used in " "``**kwds`` without ambiguity." msgstr "換句話說,僅限位置參數的名稱可以在 ``**kwds`` 中使用,而不產生歧義。" -#: ../../tutorial/controlflow.rst:868 +#: ../../tutorial/controlflow.rst:893 msgid "Recap" msgstr "回顧" -#: ../../tutorial/controlflow.rst:870 +#: ../../tutorial/controlflow.rst:895 msgid "" "The use case will determine which parameters to use in the function " "definition::" msgstr "此用例決定哪些參數可以用於函式定義: ::" -#: ../../tutorial/controlflow.rst:872 +#: ../../tutorial/controlflow.rst:897 msgid "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):" msgstr "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):" -#: ../../tutorial/controlflow.rst:874 +#: ../../tutorial/controlflow.rst:899 msgid "As guidance:" msgstr "說明:" -#: ../../tutorial/controlflow.rst:876 +#: ../../tutorial/controlflow.rst:901 msgid "" "Use positional-only if you want the name of the parameters to not be " "available to the user. This is useful when parameter names have no real " @@ -1746,7 +1781,7 @@ msgstr "" "想控制引數在函式呼叫的排列順序,或同時使用位置參數和任意關鍵字時,這種方式很" "有用。" -#: ../../tutorial/controlflow.rst:881 +#: ../../tutorial/controlflow.rst:906 msgid "" "Use keyword-only when names have meaning and the function definition is more " "understandable by being explicit with names or you want to prevent users " @@ -1755,7 +1790,7 @@ msgstr "" "當參數名稱有意義,且明確的名稱可讓函式定義更易理解,或是你不希望使用者依賴引" "數被傳遞時的位置時,請使用僅限關鍵字。" -#: ../../tutorial/controlflow.rst:884 +#: ../../tutorial/controlflow.rst:909 msgid "" "For an API, use positional-only to prevent breaking API changes if the " "parameter's name is modified in the future." @@ -1763,11 +1798,11 @@ msgstr "" "對於應用程式介面 (API),使用僅限位置,以防止未來參數名稱被修改時造成 API 的中" "斷性變更。" -#: ../../tutorial/controlflow.rst:890 +#: ../../tutorial/controlflow.rst:915 msgid "Arbitrary Argument Lists" msgstr "任意引數列表 (Arbitrary Argument Lists)" -#: ../../tutorial/controlflow.rst:895 +#: ../../tutorial/controlflow.rst:920 msgid "" "Finally, the least frequently used option is to specify that a function can " "be called with an arbitrary number of arguments. These arguments will be " @@ -1778,7 +1813,7 @@ msgstr "" "數會被包裝進一個 tuple 中(詳見 :ref:`tut-tuples`\\ )。在可變數量的引數之" "前,可能有零個或多個普通引數: ::" -#: ../../tutorial/controlflow.rst:900 +#: ../../tutorial/controlflow.rst:925 msgid "" "def write_multiple_items(file, separator, *args):\n" " file.write(separator.join(args))" @@ -1786,7 +1821,7 @@ msgstr "" "def write_multiple_items(file, separator, *args):\n" " file.write(separator.join(args))" -#: ../../tutorial/controlflow.rst:904 +#: ../../tutorial/controlflow.rst:929 msgid "" "Normally, these *variadic* arguments will be last in the list of formal " "parameters, because they scoop up all remaining input arguments that are " @@ -1800,7 +1835,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:910 +#: ../../tutorial/controlflow.rst:935 msgid "" ">>> def concat(*args, sep=\"/\"):\n" "... return sep.join(args)\n" @@ -1818,11 +1853,11 @@ msgstr "" ">>> concat(\"earth\", \"mars\", \"venus\", sep=\".\")\n" "'earth.mars.venus'" -#: ../../tutorial/controlflow.rst:921 +#: ../../tutorial/controlflow.rst:946 msgid "Unpacking Argument Lists" msgstr "拆解引數列表(Unpacking Argument Lists)" -#: ../../tutorial/controlflow.rst:923 +#: ../../tutorial/controlflow.rst:948 msgid "" "The reverse situation occurs when the arguments are already in a list or " "tuple but need to be unpacked for a function call requiring separate " @@ -1836,7 +1871,7 @@ msgstr "" "的 *start* 和 *stop* 引數。如果這些引數不是分開的,則要在呼叫函式時,用 " "``*`` 運算子把引數們從 list 或 tuple 中拆解出來: ::" -#: ../../tutorial/controlflow.rst:930 +#: ../../tutorial/controlflow.rst:955 msgid "" ">>> list(range(3, 6)) # normal call with separate arguments\n" "[3, 4, 5]\n" @@ -1846,13 +1881,13 @@ msgid "" "[3, 4, 5]" msgstr "" -#: ../../tutorial/controlflow.rst:939 +#: ../../tutorial/controlflow.rst:964 msgid "" "In the same fashion, dictionaries can deliver keyword arguments with the " "``**``\\ -operator::" msgstr "同樣地,dictionary(字典)可以用 ``**`` 運算子傳遞關鍵字引數: ::" -#: ../../tutorial/controlflow.rst:942 +#: ../../tutorial/controlflow.rst:967 msgid "" ">>> def parrot(voltage, state='a stiff', action='http://github.com/voom'):\n" "... print(\"-- This parrot wouldn't\", action, end=' ')\n" @@ -1876,11 +1911,11 @@ msgstr "" "-- This parrot wouldn't VOOM if you put four million volts through it. E's " "bleedin' demised !" -#: ../../tutorial/controlflow.rst:955 +#: ../../tutorial/controlflow.rst:980 msgid "Lambda Expressions" msgstr "Lambda 運算式" -#: ../../tutorial/controlflow.rst:957 +#: ../../tutorial/controlflow.rst:982 msgid "" "Small anonymous functions can be created with the :keyword:`lambda` keyword. " "This function returns the sum of its two arguments: ``lambda a, b: a+b``. " @@ -1895,7 +1930,7 @@ msgstr "" "能是單一運算式。在語義上,它就是一個普通函式定義的語法糖 (syntactic sugar)。" "與巢狀函式定義一樣,lambda 函式可以從包含它的作用域中引用變數: ::" -#: ../../tutorial/controlflow.rst:965 +#: ../../tutorial/controlflow.rst:990 msgid "" ">>> def make_incrementor(n):\n" "... return lambda x: x + n\n" @@ -1915,7 +1950,7 @@ msgstr "" ">>> f(1)\n" "43" -#: ../../tutorial/controlflow.rst:974 +#: ../../tutorial/controlflow.rst:999 msgid "" "The above example uses a lambda expression to return a function. Another " "use is to pass a small function as an argument::" @@ -1923,7 +1958,7 @@ msgstr "" "上面的例子用 lambda 運算式回傳了一個函式。另外的用法是傳遞一個小函式當作引" "數: ::" -#: ../../tutorial/controlflow.rst:977 +#: ../../tutorial/controlflow.rst:1002 msgid "" ">>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]\n" ">>> pairs.sort(key=lambda pair: pair[1])\n" @@ -1935,17 +1970,17 @@ msgstr "" ">>> pairs\n" "[(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]" -#: ../../tutorial/controlflow.rst:986 +#: ../../tutorial/controlflow.rst:1011 msgid "Documentation Strings" msgstr "說明文件字串 (Documentation Strings)" -#: ../../tutorial/controlflow.rst:993 +#: ../../tutorial/controlflow.rst:1018 msgid "" "Here are some conventions about the content and formatting of documentation " "strings." msgstr "以下是關於說明文件字串內容和格式的慣例。" -#: ../../tutorial/controlflow.rst:996 +#: ../../tutorial/controlflow.rst:1021 msgid "" "The first line should always be a short, concise summary of the object's " "purpose. For brevity, it should not explicitly state the object's name or " @@ -1957,7 +1992,7 @@ msgstr "" "的名稱或型別,因為有其他方法可以達到相同目的(除非該名稱剛好是一個描述函式運" "算的動詞)。這一行應以大寫字母開頭,以句號結尾。" -#: ../../tutorial/controlflow.rst:1002 +#: ../../tutorial/controlflow.rst:1027 msgid "" "If there are more lines in the documentation string, the second line should " "be blank, visually separating the summary from the rest of the description. " @@ -1967,7 +2002,7 @@ msgstr "" "文件字串為多行時,第二行應為空白行,在視覺上將摘要與其餘描述分開。後面幾行可" "包含一或多個段落,描述此物件的呼叫慣例、副作用等。" -#: ../../tutorial/controlflow.rst:1007 +#: ../../tutorial/controlflow.rst:1032 msgid "" "The Python parser does not strip indentation from multi-line string literals " "in Python, so tools that process documentation have to strip indentation if " @@ -1989,11 +2024,11 @@ msgstr "" "出現了,這些行的全部前導空白字元都應被去除。展開 tab 鍵後(通常為八個空格)," "應測試空白字元量是否等價。" -#: ../../tutorial/controlflow.rst:1019 +#: ../../tutorial/controlflow.rst:1044 msgid "Here is an example of a multi-line docstring::" msgstr "下面是多行說明字串的一個範例: ::" -#: ../../tutorial/controlflow.rst:1021 +#: ../../tutorial/controlflow.rst:1046 msgid "" ">>> def my_function():\n" "... \"\"\"Do nothing, but document it.\n" @@ -2008,11 +2043,11 @@ msgid "" " No, really, it doesn't do anything." msgstr "" -#: ../../tutorial/controlflow.rst:1037 +#: ../../tutorial/controlflow.rst:1062 msgid "Function Annotations" msgstr "函式註釋 (Function Annotations)" -#: ../../tutorial/controlflow.rst:1045 +#: ../../tutorial/controlflow.rst:1070 msgid "" ":ref:`Function annotations ` are completely optional metadata " "information about the types used by user-defined functions (see :pep:`3107` " @@ -2021,7 +2056,7 @@ msgstr "" ":ref:`函式註釋 `\\ 是選擇性的元資料(metadata)資訊,描述使用者定義" "函式所使用的型別(更多資訊詳見 :pep:`3107` 和 :pep:`484`\\ )。" -#: ../../tutorial/controlflow.rst:1049 +#: ../../tutorial/controlflow.rst:1074 msgid "" ":term:`Annotations ` are stored in the :attr:`!" "__annotations__` attribute of the function as a dictionary and have no " @@ -2039,7 +2074,7 @@ msgstr "" ">`` 文字接著一個運算式。以下範例註釋了一個必要引數、一個選擇性引數,以及回傳" "值: ::" -#: ../../tutorial/controlflow.rst:1058 +#: ../../tutorial/controlflow.rst:1083 msgid "" ">>> def f(ham: str, eggs: str = 'eggs') -> str:\n" "... print(\"Annotations:\", f.__annotations__)\n" @@ -2063,11 +2098,11 @@ msgstr "" "Arguments: spam eggs\n" "'spam and eggs'" -#: ../../tutorial/controlflow.rst:1071 +#: ../../tutorial/controlflow.rst:1096 msgid "Intermezzo: Coding Style" msgstr "間奏曲:程式碼風格 (Coding Style)" -#: ../../tutorial/controlflow.rst:1076 +#: ../../tutorial/controlflow.rst:1101 msgid "" "Now that you are about to write longer, more complex pieces of Python, it is " "a good time to talk about *coding style*. Most languages can be written (or " @@ -2080,7 +2115,7 @@ msgstr "" "式比其他的更具可讀性。能讓其他人輕鬆閱讀你的程式碼永遠是一個好主意,而使用優" "良的編碼樣式對此有極大的幫助。" -#: ../../tutorial/controlflow.rst:1082 +#: ../../tutorial/controlflow.rst:1107 msgid "" "For Python, :pep:`8` has emerged as the style guide that most projects " "adhere to; it promotes a very readable and eye-pleasing coding style. Every " @@ -2090,11 +2125,11 @@ msgstr "" "對於 Python,大多數的專案都遵循 :pep:`8` 的樣式指南;它推行的編碼樣式相當可讀" "且賞心悅目。每個 Python 開發者都應該花點時間研讀;這裡是該指南的核心重點:" -#: ../../tutorial/controlflow.rst:1087 +#: ../../tutorial/controlflow.rst:1112 msgid "Use 4-space indentation, and no tabs." msgstr "用 4 個空格縮排,不要用 tab 鍵。" -#: ../../tutorial/controlflow.rst:1089 +#: ../../tutorial/controlflow.rst:1114 msgid "" "4 spaces are a good compromise between small indentation (allows greater " "nesting depth) and large indentation (easier to read). Tabs introduce " @@ -2103,11 +2138,11 @@ msgstr "" "4 個空格是小縮排(容許更大的巢套深度)和大縮排(較易閱讀)之間的折衷方案。" "Tab 鍵會造成混亂,最好別用。" -#: ../../tutorial/controlflow.rst:1093 +#: ../../tutorial/controlflow.rst:1118 msgid "Wrap lines so that they don't exceed 79 characters." msgstr "換行,使一行不超過 79 個字元。" -#: ../../tutorial/controlflow.rst:1095 +#: ../../tutorial/controlflow.rst:1120 msgid "" "This helps users with small displays and makes it possible to have several " "code files side-by-side on larger displays." @@ -2115,21 +2150,21 @@ msgstr "" "換行能讓使用小顯示器的使用者方便閱讀,也可以在較大顯示器上並排陳列多個程式碼" "檔案。" -#: ../../tutorial/controlflow.rst:1098 +#: ../../tutorial/controlflow.rst:1123 msgid "" "Use blank lines to separate functions and classes, and larger blocks of code " "inside functions." msgstr "用空行分隔函式和 class(類別),及函式內較大塊的程式碼。" -#: ../../tutorial/controlflow.rst:1101 +#: ../../tutorial/controlflow.rst:1126 msgid "When possible, put comments on a line of their own." msgstr "如果可以,把註解放在單獨一行。" -#: ../../tutorial/controlflow.rst:1103 +#: ../../tutorial/controlflow.rst:1128 msgid "Use docstrings." msgstr "使用說明字串。" -#: ../../tutorial/controlflow.rst:1105 +#: ../../tutorial/controlflow.rst:1130 msgid "" "Use spaces around operators and after commas, but not directly inside " "bracketing constructs: ``a = f(1, 2) + g(3, 4)``." @@ -2137,7 +2172,7 @@ msgstr "" "運算子前後、逗號後要加空格,但不要直接放在括號內側:``a = f(1, 2) + g(3, " "4)``。" -#: ../../tutorial/controlflow.rst:1108 +#: ../../tutorial/controlflow.rst:1133 msgid "" "Name your classes and functions consistently; the convention is to use " "``UpperCamelCase`` for classes and ``lowercase_with_underscores`` for " @@ -2149,7 +2184,7 @@ msgstr "" "底線)。永遠用 ``self`` 作為 method 第一個引數的名稱(關於 class 和 method," "詳見 :ref:`tut-firstclasses`\\ )。" -#: ../../tutorial/controlflow.rst:1113 +#: ../../tutorial/controlflow.rst:1138 msgid "" "Don't use fancy encodings if your code is meant to be used in international " "environments. Python's default, UTF-8, or even plain ASCII work best in any " @@ -2158,7 +2193,7 @@ msgstr "" "若程式碼是為了用於國際環境時,不要用花俏的編碼。Python 預設的 UTF-8 或甚至普" "通的 ASCII,就可以勝任各種情況。" -#: ../../tutorial/controlflow.rst:1117 +#: ../../tutorial/controlflow.rst:1142 msgid "" "Likewise, don't use non-ASCII characters in identifiers if there is only the " "slightest chance people speaking a different language will read or maintain " @@ -2167,11 +2202,11 @@ msgstr "" "同樣地,若不同語言使用者閱讀或維護程式碼的可能性微乎其微,就不要在命名時使用" "非 ASCII 字元。" -#: ../../tutorial/controlflow.rst:1123 +#: ../../tutorial/controlflow.rst:1148 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/controlflow.rst:1124 +#: ../../tutorial/controlflow.rst:1149 msgid "" "Actually, *call by object reference* would be a better description, since if " "a mutable object is passed, the caller will see any changes the callee makes " @@ -2189,54 +2224,60 @@ msgstr "statement(陳述式)" msgid "for" msgstr "for" -#: ../../tutorial/controlflow.rst:451 ../../tutorial/controlflow.rst:988 +#: ../../tutorial/controlflow.rst:476 ../../tutorial/controlflow.rst:1013 msgid "documentation strings" msgstr "ddocumentation strings(說明字串)" -#: ../../tutorial/controlflow.rst:451 ../../tutorial/controlflow.rst:988 +#: ../../tutorial/controlflow.rst:476 ../../tutorial/controlflow.rst:1013 msgid "docstrings" msgstr "docstrings(說明字串)" -#: ../../tutorial/controlflow.rst:451 ../../tutorial/controlflow.rst:988 +#: ../../tutorial/controlflow.rst:476 ../../tutorial/controlflow.rst:1013 msgid "strings, documentation" msgstr "strings(字串), documentation(說明文件)" -#: ../../tutorial/controlflow.rst:892 +#: ../../tutorial/controlflow.rst:917 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../tutorial/controlflow.rst:892 ../../tutorial/controlflow.rst:936 +#: ../../tutorial/controlflow.rst:917 ../../tutorial/controlflow.rst:961 msgid "in function calls" msgstr "於函式呼叫中" -#: ../../tutorial/controlflow.rst:936 +#: ../../tutorial/controlflow.rst:961 msgid "**" msgstr "**" -#: ../../tutorial/controlflow.rst:1040 +#: ../../tutorial/controlflow.rst:1065 msgid "function" msgstr "function(函式)" -#: ../../tutorial/controlflow.rst:1040 +#: ../../tutorial/controlflow.rst:1065 msgid "annotations" msgstr "annotations(註釋)" -#: ../../tutorial/controlflow.rst:1040 +#: ../../tutorial/controlflow.rst:1065 msgid "->" msgstr "->" -#: ../../tutorial/controlflow.rst:1040 +#: ../../tutorial/controlflow.rst:1065 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../tutorial/controlflow.rst:1040 +#: ../../tutorial/controlflow.rst:1065 msgid ": (colon)" msgstr ": (冒號)" -#: ../../tutorial/controlflow.rst:1074 +#: ../../tutorial/controlflow.rst:1099 msgid "coding" msgstr "coding(程式編寫)" -#: ../../tutorial/controlflow.rst:1074 +#: ../../tutorial/controlflow.rst:1099 msgid "style" msgstr "style(風格)" + +#~ msgid "" +#~ "A :keyword:`!for` or :keyword:`!while` loop can include an :keyword:`!" +#~ "else` clause." +#~ msgstr "" +#~ ":keyword:`!for` 和 :keyword:`!while` 迴圈可帶有一個 :keyword:`!else` 子句" diff --git a/using/mac.po b/using/mac.po index f346362e0e..79ab0b1827 100644 --- a/using/mac.po +++ b/using/mac.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-09-30 09:19+0000\n" "PO-Revision-Date: 2022-08-31 22:26+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,346 +23,669 @@ msgstr "" "X-Generator: Poedit 3.1.1\n" #: ../../using/mac.rst:6 -msgid "Using Python on a Mac" -msgstr "在 Mac 系統使用 Python" +msgid "Using Python on macOS" +msgstr "於 macOS 使用 Python" -#: ../../using/mac.rst:0 -msgid "Author" -msgstr "作者" +#: ../../using/mac.rst:11 +msgid "" +"This document aims to give an overview of macOS-specific behavior you should " +"know about to get started with Python on Mac computers. Python on a Mac " +"running macOS is very similar to Python on other Unix-derived platforms, but " +"there are some differences in installation and some features." +msgstr "" + +#: ../../using/mac.rst:16 +msgid "" +"There are various ways to obtain and install Python for macOS. Pre-built " +"versions of the most recent versions of Python are available from a number " +"of distributors. Much of this document describes use of the Pythons provided " +"by the CPython release team for download from the `python.org website " +"`_. See :ref:`alternative_bundles` for " +"some other options." +msgstr "" -#: ../../using/mac.rst:8 -msgid "Bob Savage " -msgstr "Bob Savage " +#: ../../using/mac.rst:34 +msgid "Using Python for macOS from ``python.org``" +msgstr "" -#: ../../using/mac.rst:11 +#: ../../using/mac.rst:37 +msgid "Installation steps" +msgstr "安裝步驟" + +#: ../../using/mac.rst:39 +msgid "" +"For `current Python versions `_ (other " +"than those in ``security`` status), the release team produces a **Python for " +"macOS** installer package for each new release. A list of available " +"installers is available `here `_. " +"We recommend using the most recent supported Python version where possible. " +"Current installers provide a `universal2 binary `_ build of Python which runs natively on all Macs " +"(Apple Silicon and Intel) that are supported by a wide range of macOS " +"versions, currently typically from at least **macOS 10.13 High Sierra** on." +msgstr "" + +#: ../../using/mac.rst:51 msgid "" -"Python on a Mac running macOS is in principle very similar to Python on any " -"other Unix platform, but there are a number of additional features such as " -"the integrated development environment (IDE) and the Package Manager that " -"are worth pointing out." +"The downloaded file is a standard macOS installer package file (``.pkg``). " +"File integrity information (checksum, size, sigstore signature, etc) for " +"each file is included on the release download page. Installer packages and " +"their contents are signed and notarized with ``Python Software Foundation`` " +"Apple Developer ID certificates to meet `macOS Gatekeeper requirements " +"`_." msgstr "" -"Python 在 Mac 的 macOS 上執行和在其他 Unix 平台上執行的原理非常相似,但值得一" -"提的是在 macOS 上有其他額外的功能,例如整合開發環境 (IDE) 與套件管理。" -#: ../../using/mac.rst:21 -msgid "Getting and Installing Python" -msgstr "取得和安裝 Python" +#: ../../using/mac.rst:57 +msgid "" +"For a default installation, double-click on the downloaded installer package " +"file. This should launch the standard macOS Installer app and display the " +"first of several installer windows steps." +msgstr "" -#: ../../using/mac.rst:23 +#: ../../using/mac.rst:63 msgid "" -"macOS used to come with Python 2.7 pre-installed between versions 10.8 and " -"`12.3 `_. You are invited to install the most " -"recent version of Python 3 from the `Python website `__. A current \"universal2 binary\" build of Python, which " -"runs natively on the Mac's new Apple Silicon and legacy Intel processors, is " -"available there." +"Clicking on the **Continue** button brings up the **Read Me** for this " +"installer. Besides other important information, the **Read Me** documents " +"which Python version is going to be installed and on what versions of macOS " +"it is supported. You may need to scroll through to read the whole file. By " +"default, this **Read Me** will also be installed in |" +"usemac_applications_folder_version| and available to read anytime." msgstr "" -"macOS 自 10.8 版本開始至 `12.3 版本 `_\\ 之間預" -"設安裝 Python 2.7。你也可以到 `Python 網站 `__\\ 安裝最新的 Python 3 版本。你可以找到建立在\"通用二進位 " -"(universal2 binary)\" 上的 Python 建置版本,它能夠原生地運行在 Mac 新的 " -"Apple Silicon CPU 與過去的 Intel CPU 上。" -#: ../../using/mac.rst:30 -msgid "What you get after installing is a number of things:" -msgstr "在安裝後你必須要做幾件事:" +#: ../../using/mac.rst:71 +msgid "" +"Clicking on **Continue** proceeds to display the license for Python and for " +"other included software. You will then need to **Agree** to the license " +"terms before proceeding to the next step. This license file will also be " +"installed and available to be read later." +msgstr "" -#: ../../using/mac.rst:32 +#: ../../using/mac.rst:78 msgid "" -"A |python_version_literal| folder in your :file:`Applications` folder. In " -"here you find IDLE, the development environment that is a standard part of " -"official Python distributions; and :program:`Python Launcher`, which handles " -"double-clicking Python scripts from the Finder." +"After the license terms are accepted, the next step is the **Installation " +"Type** display. For most uses, the standard set of installation operations " +"is appropriate." msgstr "" -"會有一個 |python_version_literal| 資料夾在你的 :file:`Applications` 資料夾" -"中。在這裡你可以找到 IDLE,它是作為官方 Python 發行版標準組成的開發環境;以" -"及 :program:`Python Launcher`,它負責處理在 Finder 中雙擊 Python 腳本的操作。" -#: ../../using/mac.rst:37 +#: ../../using/mac.rst:83 msgid "" -"A framework :file:`/Library/Frameworks/Python.framework`, which includes the " -"Python executable and libraries. The installer adds this location to your " -"shell path. To uninstall Python, you can remove these three things. A " -"symlink to the Python executable is placed in :file:`/usr/local/bin/`." +"By pressing the **Customize** button, you can choose to omit or select " +"certain package components of the installer. Click on each package name to " +"see a description of what it installs. To also install support for the " +"optional experimental free-threaded feature, see :ref:`install-freethreaded-" +"macos`." +msgstr "" + +#: ../../using/mac.rst:91 +msgid "" +"In either case, clicking **Install** will begin the install process by " +"asking permission to install new software. A macOS user name with " +"``Administrator`` privilege is needed as the installed Python will be " +"available to all users of the Mac." msgstr "" -":file:`/Library/Frameworks/Python.framework` 框架,包括 Python 可執行檔案 " -"(executable) 和函式庫 (library)。安裝程式將此位置新增到 shell 路徑。要解除安" -"裝 Python ,你可以移除這三個專案。Python 可執行檔案的符號連結 (symlink) 則放" -"在 :file:`/usr/local/bin/` 中。" -#: ../../using/mac.rst:44 +#: ../../using/mac.rst:95 +msgid "When the installation is complete, the **Summary** window will appear." +msgstr "" + +#: ../../using/mac.rst:99 msgid "" -"On macOS 10.8-12.3, the Apple-provided build of Python is installed in :file:" -"`/System/Library/Frameworks/Python.framework` and :file:`/usr/bin/python`, " -"respectively. You should never modify or delete these, as they are Apple-" -"controlled and are used by Apple- or third-party software. Remember that if " -"you choose to install a newer Python version from python.org, you will have " -"two different but functional Python installations on your computer, so it " -"will be important that your paths and usages are consistent with what you " -"want to do." +"Double-click on the :command:`Install Certificates.command` icon or file in " +"the |usemac_applications_folder_version| window to complete the installation." msgstr "" -"在 macOS 10.8-12.3,Apple 提供的 Python 建置版本分別安裝在 :file:`/System/" -"Library/Frameworks/Python.framework` 和 :file:`/usr/bin/python` 中。你不應該" -"去修改或刪除這些內容,因為它們由 Apple 控制並且被 Apple 或第三方軟體使用。請" -"記住,如果你選擇從 python.org 安裝較新的 Python 版本,那麼你的計算機上將安裝" -"兩個不同但都可運作的 Python,因此你的路徑和用法與你想要執行的操作一致非常重" -"要。" -#: ../../using/mac.rst:52 +#: ../../using/mac.rst:105 msgid "" -"IDLE includes a Help menu that allows you to access Python documentation. If " -"you are completely new to Python you should start reading the tutorial " -"introduction in that document." +"This will open a temporary :program:`Terminal` shell window that will use " +"the new Python to download and install SSL root certificates for its use." msgstr "" -"IDLE 包含一個幫助 (Help) 選單,讓你可以參閱 Python 文件。如果你是 Python 的新" -"手,你應該開始閱讀該文件中的教學介紹。" -#: ../../using/mac.rst:56 +#: ../../using/mac.rst:111 msgid "" -"If you are familiar with Python on other Unix platforms you should read the " -"section on running Python scripts from the Unix shell." +"If ``Successfully installed certifi`` and ``update complete`` appears in the " +"terminal window, the installation is complete. Close this terminal window " +"and the installer window." +msgstr "" + +#: ../../using/mac.rst:115 +msgid "A default install will include:" +msgstr "預設安裝會包含:" + +#: ../../using/mac.rst:117 +msgid "" +"A |usemac_applications_folder_name| folder in your :file:`Applications` " +"folder. In here you find :program:`IDLE`, the development environment that " +"is a standard part of official Python distributions; and :program:`Python " +"Launcher`, which handles double-clicking Python scripts from the macOS " +"`Finder `_." +msgstr "" +"會有一個 |usemac_applications_folder_name| 資料夾在你的 :file:`Applications` " +"資料夾中。在這裡你可以找到 :program:`IDLE`,它是作為官方 Python 發行版標準組" +"成的開發環境;以及 :program:`Python Launcher`,它負責處理在 `Finder `_ 中雙擊 Python 腳本的操作。" + +#: ../../using/mac.rst:122 +msgid "" +"A framework :file:`/Library/Frameworks/Python.framework`, which includes the " +"Python executable and libraries. The installer adds this location to your " +"shell path. To uninstall Python, you can remove these three things. Symlinks " +"to the Python executable are placed in :file:`/usr/local/bin/`." +msgstr "" +":file:`/Library/Frameworks/Python.framework` 框架,包括 Python 可執行檔案 " +"(executable) 和函式庫 (library)。安裝程式將此位置新增到 shell 路徑。要解除安" +"裝 Python ,你可以移除這三個東西。Python 可執行檔案的符號連結 (symlink) 則放" +"在 :file:`/usr/local/bin/` 中。" + +#: ../../using/mac.rst:129 +msgid "" +"Recent versions of macOS include a :command:`python3` command in :file:`/usr/" +"bin/python3` that links to a usually older and incomplete version of Python " +"provided by and for use by the Apple development tools, :program:`Xcode` or " +"the :program:`Command Line Tools for Xcode`. You should never modify or " +"attempt to delete this installation, as it is Apple-controlled and is used " +"by Apple-provided or third-party software. If you choose to install a newer " +"Python version from ``python.org``, you will have two different but " +"functional Python installations on your computer that can co-exist. The " +"default installer options should ensure that its :command:`python3` will be " +"used instead of the system :command:`python3`." msgstr "" -"如果你熟悉其他 Unix 平臺上的 Python,那麼你應該閱讀有關從 Unix shell 執行 " -"Python 腳本的部分。" -#: ../../using/mac.rst:61 +#: ../../using/mac.rst:140 msgid "How to run a Python script" msgstr "如何執行 Python 腳本" -#: ../../using/mac.rst:63 +#: ../../using/mac.rst:142 +msgid "" +"There are two ways to invoke the Python interpreter. If you are familiar " +"with using a Unix shell in a terminal window, you can invoke |" +"usemac_python_x_dot_y_literal| or ``python3`` optionally followed by one or " +"more command line options (described in :ref:`using-on-general`). The Python " +"tutorial also has a useful section on :ref:`using Python interactively from " +"a shell `." +msgstr "" + +#: ../../using/mac.rst:149 msgid "" -"Your best way to get started with Python on macOS is through the IDLE " -"integrated development environment; see section :ref:`ide` and use the Help " -"menu when the IDE is running." +"You can also invoke the interpreter through an integrated development " +"environment. :ref:`idle` is a basic editor and interpreter environment which " +"is included with the standard distribution of Python. :program:`IDLE` " +"includes a Help menu that allows you to access Python documentation. If you " +"are completely new to Python, you can read the tutorial introduction in that " +"document." msgstr "" -"在 macOS 上開始使用 Python 的最佳方法是透過 IDLE 整合開發環境;參見 :ref:" -"`ide` 部分,並在 IDE 執行時使用幫助選單。" -#: ../../using/mac.rst:67 +#: ../../using/mac.rst:157 msgid "" -"If you want to run Python scripts from the Terminal window command line or " -"from the Finder you first need an editor to create your script. macOS comes " -"with a number of standard Unix command line editors, :program:`vim` :program:" -"`nano` among them. If you want a more Mac-like editor, :program:`BBEdit` " -"from Bare Bones Software (see https://www.barebones.com/products/bbedit/" -"index.html) are good choices, as is :program:`TextMate` (see https://" -"macromates.com). Other editors include :program:`MacVim` (https://macvim." -"org) and :program:`Aquamacs` (https://aquamacs.org)." +"There are many other editors and IDEs available, see :ref:`editors` for more " +"information." msgstr "" -"如果要從終端機視窗命令列或 Finder 執行 Python 腳本,首先需要一個編輯器來建立" -"腳本。macOS 附帶了許多標準的 Unix 命令列編輯器,如 :program:`vim` 和 :" -"program:`nano`。如果你想要一個更 Mac 化的編輯器,那麼來自 Bare Bones " -"Software 的 :program:`BBEdit`\\ (參見 http://www.barebones.com/products/" -"bbedit/index.html) 是不錯的選擇,:program:`TextMate` (參見 https://" -"macromates.com/)也是個選擇。其他編輯器包括 :program:`MacVim` (https://" -"macvim.org) 和 :program:`Aquamacs` (https://aquamacs.org/)。" -#: ../../using/mac.rst:77 +#: ../../using/mac.rst:160 msgid "" -"To run your script from the Terminal window you must make sure that :file:`/" -"usr/local/bin` is in your shell search path." +"To run a Python script file from the terminal window, you can invoke the " +"interpreter with the name of the script file:" +msgstr "" + +#: ../../using/mac.rst:163 +msgid "|usemac_python_x_dot_y_literal| ``myscript.py``" msgstr "" -"要從終端機視窗執行腳本,你必須確保 :file:`/usr/local/bin` 位於 shell 搜尋路徑" -"中。" -#: ../../using/mac.rst:80 -msgid "To run your script from the Finder you have two options:" -msgstr "從 Finder 執行你的腳本時,你有兩個選項:" +#: ../../using/mac.rst:165 +msgid "To run your script from the Finder, you can either:" +msgstr "從 Finder 執行你的腳本時,你可以:" -#: ../../using/mac.rst:82 +#: ../../using/mac.rst:167 msgid "Drag it to :program:`Python Launcher`." msgstr "把它拖曳到 :program:`Python Launcher`" -#: ../../using/mac.rst:84 +#: ../../using/mac.rst:169 msgid "" "Select :program:`Python Launcher` as the default application to open your " -"script (or any ``.py`` script) through the finder Info window and double-" +"script (or any ``.py`` script) through the Finder Info window and double-" "click it. :program:`Python Launcher` has various preferences to control how " "your script is launched. Option-dragging allows you to change these for one " -"invocation, or use its Preferences menu to change things globally." +"invocation, or use its ``Preferences`` menu to change things globally." msgstr "" -"透過 finder Info 視窗選擇 :program:`Python Launcher` 作為開啟腳本(或任何 ``." +"透過 Finder Info 視窗選擇 :program:`Python Launcher` 作為開啟腳本(或任何 ``." "py`` 腳本)的預設應用程式,然後雙擊腳本。:program:`Python Launcher` 有各種用" -"來控制腳本啟動方式的選項。拖曳選項可以讓你一次更改多個選項,或使用其偏好設定" -"選單以全域性地更改內容。" - -#: ../../using/mac.rst:94 -msgid "Running scripts with a GUI" -msgstr "透過 GUI 執行腳本" +"來控制腳本啟動方式的選項。拖曳選項可以讓你一次更改多個選項,或使用其 " +"``Preferences`` 選單以全域性地更改內容。" -#: ../../using/mac.rst:96 +#: ../../using/mac.rst:175 msgid "" -"With older versions of Python, there is one macOS quirk that you need to be " -"aware of: programs that talk to the Aqua window manager (in other words, " -"anything that has a GUI) need to be run in a special way. Use :program:" -"`pythonw` instead of :program:`python` to start such scripts." +"Be aware that running the script directly from the macOS Finder might " +"produce different results than when running from a terminal window as the " +"script will not be run in the usual shell environment including any setting " +"of environment variables in shell profiles. And, as with any other script or " +"program, be certain of what you are about to run." +msgstr "" + +#: ../../using/mac.rst:185 +msgid "Alternative Distributions" msgstr "" -"對於舊版本的 Python,你需要注意一個 macOS 的怪異之處:與 Aqua 視窗管理器溝通" -"的程式(換而言之,任何具有 GUI(圖形化使用者介面)的程式)需要以特殊方式執" -"行。使用 :program:`pythonw` 而不是 :program:`python` 來啟動這樣的腳本。" -#: ../../using/mac.rst:101 +#: ../../using/mac.rst:187 msgid "" -"With Python 3.9, you can use either :program:`python` or :program:`pythonw`." -msgstr "Python 3.9 上,你可以使用 :program:`python` 或者 :program:`pythonw`。" +"Besides the standard ``python.org`` for macOS installer, there are third-" +"party distributions for macOS that may include additional functionality. " +"Some popular distributions and their key features:" +msgstr "" -#: ../../using/mac.rst:105 -msgid "Configuration" -msgstr "設定" +#: ../../using/mac.rst:191 +msgid "`ActivePython `_" +msgstr "`ActivePython `_" + +#: ../../using/mac.rst:192 +msgid "Installer with multi-platform compatibility, documentation" +msgstr "" -#: ../../using/mac.rst:107 +#: ../../using/mac.rst:194 +msgid "`Anaconda `_" +msgstr "`Anaconda `_" + +#: ../../using/mac.rst:195 msgid "" -"Python on macOS honors all standard Unix environment variables such as :" -"envvar:`PYTHONPATH`, but setting these variables for programs started from " -"the Finder is non-standard as the Finder does not read your :file:`.profile` " -"or :file:`.cshrc` at startup. You need to create a file :file:`~/.MacOSX/" -"environment.plist`. See Apple's `Technical Q&A QA1067 `__ for details." +"Popular scientific modules (such as numpy, scipy, and pandas) and the " +"``conda`` package manager." msgstr "" -"macOS 上的 Python 遵循所有標準的 Unix 環境變數,例如 :envvar:`PYTHONPATH`,但" -"是為 Finder 啟動的程式設定這些變數並非是標準做法,因為 Finder 在啟動時不會讀" -"取你的 :file:`.profile` 或 :file:`.cshrc`。你需要建立一個檔案 :file:`~/." -"MacOSX/environment.plist`。相關資訊請參閱 Apple 的\\ `技術問答集 QA1067 " -"`__。" -#: ../../using/mac.rst:115 +#: ../../using/mac.rst:198 +msgid "`Homebrew `_" +msgstr "`Homebrew `_" + +#: ../../using/mac.rst:199 msgid "" -"For more information on installation Python packages, see section :ref:`mac-" -"package-manager`." -msgstr "更多關於安裝 Python 套件的資訊,參閱 :ref:`mac-package-manager` 部分。" +"Package manager for macOS including multiple versions of Python and many " +"third-party Python-based packages (including numpy, scipy, and pandas)." +msgstr "" -#: ../../using/mac.rst:122 -msgid "The IDE" -msgstr "整合化開發工具 (IDE)" +#: ../../using/mac.rst:202 +msgid "`MacPorts `_" +msgstr "`MacPorts `_" -#: ../../using/mac.rst:124 +#: ../../using/mac.rst:203 msgid "" -"Python ships with the standard IDLE development environment. A good " -"introduction to using IDLE can be found at https://www.hashcollision.org/hkn/" -"python/idle_intro/index.html." +"Another package manager for macOS including multiple versions of Python and " +"many third-party Python-based packages. May include pre-built versions of " +"Python and many packages for older versions of macOS." msgstr "" -"Python 附帶標準的 IDLE 開發環境。有關使用 IDLE 的詳細介紹,請見 https://www." -"hashcollision.org/hkn/python/idle_intro/index.html。" -#: ../../using/mac.rst:132 +#: ../../using/mac.rst:207 +msgid "" +"Note that distributions might not include the latest versions of Python or " +"other libraries, and are not maintained or supported by the core Python team." +msgstr "" + +#: ../../using/mac.rst:213 msgid "Installing Additional Python Packages" msgstr "安裝額外的 Python 套件" -#: ../../using/mac.rst:134 -msgid "This section has moved to the `Python Packaging User Guide`_." -msgstr "這個章節已經被移動到 `Python Packaging User Guide`_。" +#: ../../using/mac.rst:215 +msgid "Refer to the `Python Packaging User Guide`_ for more information." +msgstr "更多資訊請見 `Python Packaging User Guide`_。" -#: ../../using/mac.rst:142 +#: ../../using/mac.rst:225 msgid "GUI Programming" msgstr "開發 GUI 程式" -#: ../../using/mac.rst:144 +#: ../../using/mac.rst:227 msgid "" "There are several options for building GUI applications on the Mac with " "Python." msgstr "於 Mac 上使用 Python 來建立 GUI 應用程式有許多選項。" -#: ../../using/mac.rst:146 +#: ../../using/mac.rst:229 msgid "" -"*PyObjC* is a Python binding to Apple's Objective-C/Cocoa framework, which " -"is the foundation of most modern Mac development. Information on PyObjC is " -"available from :pypi:`pyobjc`." +"The standard Python GUI toolkit is :mod:`tkinter`, based on the cross-" +"platform Tk toolkit (https://www.tcl.tk). A macOS-native version of Tk is " +"included with the installer." msgstr "" -"*PyObjC* 是一個 Apple Objective-C/Cocoa 框架的 Python 繫結 (binding),這是大" -"多數現代 Mac 開發的基礎。有關 PyObjC 的資訊,請見 :pypi:`pyobjc`。" +"標準的 Python GUI 工具套件是基於跨平臺 Tk 工具套件 (https://www.tcl.tk) 的 :" +"mod:`tkinter`。macOS 原生版本的 Tk 有包含於安裝程式中。" -#: ../../using/mac.rst:150 +#: ../../using/mac.rst:233 msgid "" -"The standard Python GUI toolkit is :mod:`tkinter`, based on the cross-" -"platform Tk toolkit (https://www.tcl.tk). An Aqua-native version of Tk is " -"bundled with macOS by Apple, and the latest version can be downloaded and " -"installed from https://www.activestate.com; it can also be built from source." +"*PyObjC* is a Python binding to Apple's Objective-C/Cocoa framework. " +"Information on PyObjC is available from :pypi:`pyobjc`." msgstr "" -"標準的 Python GUI 工具套件是 :mod:`tkinter`,基於跨平臺的 Tk 工具套件 " -"(https://www.tcl.tk)。Apple 的 macOS 包含了 Aqua 原生版本的 Tk,最新版本可以" -"從 https://www.activestate.com 下載和安裝;它也可以從原始碼開始建置。" +"*PyObjC* 是一個 Apple Objective-C/Cocoa 框架的 Python 繫結 (binding)。有關 " +"PyObjC 的資訊請見 :pypi:`pyobjc`。" -#: ../../using/mac.rst:155 -msgid "A number of alternative macOS GUI toolkits are available:" -msgstr "有許多替代 macOS GUI 工具套件可用:" +#: ../../using/mac.rst:236 +msgid "A number of alternative macOS GUI toolkits are available including:" +msgstr "有許多替代 macOS GUI 工具套件可用,包含:" -#: ../../using/mac.rst:157 +#: ../../using/mac.rst:238 msgid "" -"`PySide `__: Official Python bindings to " -"the `Qt GUI toolkit `__." +"`PySide `_: Official Python bindings to the " +"`Qt GUI toolkit `_." msgstr "" -"`PySide `__:`Qt GUI 工具包 `__\\ 的官方 Python 繫結。" +"`PySide `_:`Qt GUI 工具包 `_\\ 的官方 Python 繫結。" -#: ../../using/mac.rst:160 +#: ../../using/mac.rst:241 msgid "" -"`PyQt `__: Alternative " -"Python bindings to Qt." +"`PyQt `_: Alternative Python " +"bindings to Qt." msgstr "" -"`PyQt `__:Qt 的替代 " -"Python 繫結。" +"`PyQt `_:Qt 的替代 Python 繫" +"結。" -#: ../../using/mac.rst:163 +#: ../../using/mac.rst:244 msgid "" -"`Kivy `__: A cross-platform GUI toolkit that supports " +"`Kivy `_: A cross-platform GUI toolkit that supports " "desktop and mobile platforms." msgstr "" -"`Kivy `__:一個支援桌面和行動平臺的跨平臺 GUI 工具包。" +"`Kivy `_:一個支援桌面和行動平臺的跨平臺 GUI 工具包。" -#: ../../using/mac.rst:166 +#: ../../using/mac.rst:247 msgid "" -"`Toga `__: Part of the `BeeWare Project " -"`__; supports desktop, mobile, web and console apps." +"`Toga `_: Part of the `BeeWare Project `_; supports desktop, mobile, web and console apps." msgstr "" -"`Toga `__:`BeeWare 專案 `__\\ 的一部分;支援桌面、行動、網頁和控制台應用程式。" +"`Toga `_:`BeeWare 專案 `_\\ 的一部分;支援桌面、行動、網頁和控制台應用程式。" -#: ../../using/mac.rst:169 +#: ../../using/mac.rst:250 msgid "" -"`wxPython `__: A cross-platform toolkit that " -"supports desktop operating systems." +"`wxPython `_: A cross-platform toolkit that supports " +"desktop operating systems." msgstr "" -"`wxPython `__:一個支援桌面作業系統的跨平臺工具包。" +"`wxPython `_:一個支援桌面作業系統的跨平臺工具包。" -#: ../../using/mac.rst:175 +#: ../../using/mac.rst:255 +msgid "Advanced Topics" +msgstr "進階主題" + +#: ../../using/mac.rst:260 +msgid "Installing Free-threaded Binaries" +msgstr "" + +#: ../../using/mac.rst:262 +msgid "(Experimental)" +msgstr "" + +#: ../../using/mac.rst:266 +msgid "" +"Everything described in this section is considered experimental, and should " +"be expected to change in future releases." +msgstr "" + +#: ../../using/mac.rst:269 +msgid "" +"The ``python.org`` :ref:`Python for macOS ` installer package can optionally install an additional build of " +"Python |usemac_x_dot_y| that supports :pep:`703`, the experimental free-" +"threading feature (running with the :term:`global interpreter lock` " +"disabled). Check the release page on ``python.org`` for possible updated " +"information." +msgstr "" + +#: ../../using/mac.rst:275 +msgid "" +"Because this feature is still considered experimental, the support for it is " +"not installed by default. It is packaged as a separate install option, " +"available by clicking the **Customize** button on the **Installation Type** " +"step of the installer as described above." +msgstr "" + +#: ../../using/mac.rst:282 +msgid "" +"If the box next to the **Free-threaded Python** package name is checked, a " +"separate :file:`PythonT.framework` will also be installed alongside the " +"normal :file:`Python.framework` in :file:`/Library/Frameworks`. This " +"configuration allows a free-threaded Python |usemac_x_dot_y| build to co-" +"exist on your system with a traditional (GIL only) Python |usemac_x_dot_y| " +"build with minimal risk while installing or testing. This installation " +"layout is itself experimental and is subject to change in future releases." +msgstr "" + +#: ../../using/mac.rst:290 +msgid "Known cautions and limitations:" +msgstr "" + +#: ../../using/mac.rst:292 +msgid "" +"The **UNIX command-line tools** package, which is selected by default, will " +"install links in :file:`/usr/local/bin` for |" +"usemac_python_x_dot_y_t_literal|, the free-threaded interpreter, and |" +"usemac_python_x_dot_y_t_literal_config|, a configuration utility which may " +"be useful for package builders. Since :file:`/usr/local/bin` is typically " +"included in your shell ``PATH``, in most cases no changes to your ``PATH`` " +"environment variables should be needed to use |" +"usemac_python_x_dot_y_t_literal|." +msgstr "" + +#: ../../using/mac.rst:300 +msgid "" +"For this release, the **Shell profile updater** package and the :file:" +"`Update Shell Profile.command` in |usemac_applications_folder_version| do " +"not support the free-threaded package." +msgstr "" + +#: ../../using/mac.rst:304 +msgid "" +"The free-threaded build and the traditional build have separate search paths " +"and separate :file:`site-packages` directories so, by default, if you need a " +"package available in both builds, it may need to be installed in both. The " +"free-threaded package will install a separate instance of :program:`pip` for " +"use with |usemac_python_x_dot_y_t_literal|." +msgstr "" + +#: ../../using/mac.rst:310 +msgid "To install a package using :command:`pip` without a :command:`venv`:" +msgstr "" + +#: ../../using/mac.rst:312 +msgid "|usemac_python_x_dot_y_t_literal| ``-m pip install ``" +msgstr "|usemac_python_x_dot_y_t_literal| ``-m pip install ``" + +#: ../../using/mac.rst:314 +msgid "" +"When working with multiple Python environments, it is usually safest and " +"easiest to :ref:`create and use virtual environments `. This can " +"avoid possible command name conflicts and confusion about which Python is in " +"use:" +msgstr "" + +#: ../../using/mac.rst:318 +msgid "|usemac_python_x_dot_y_t_literal| ``-m venv ``" +msgstr "|usemac_python_x_dot_y_t_literal| ``-m venv ``" + +#: ../../using/mac.rst:320 +msgid "then :command:`activate`." +msgstr "然後 :command:`activate`。" + +#: ../../using/mac.rst:322 +msgid "To run a free-threaded version of IDLE:" +msgstr "執行 free-threaded(自由執行緒)版本的 IDLE:" + +#: ../../using/mac.rst:324 +msgid "|usemac_python_x_dot_y_t_literal| ``-m idlelib``" +msgstr "|usemac_python_x_dot_y_t_literal| ``-m idlelib``" + +#: ../../using/mac.rst:326 +msgid "" +"The interpreters in both builds respond to the same :ref:`PYTHON environment " +"variables ` which may have unexpected results, for " +"example, if you have ``PYTHONPATH`` set in a shell profile. If necessary, " +"there are :ref:`command line options ` like ``-" +"E`` to ignore these environment variables." +msgstr "" + +#: ../../using/mac.rst:333 +msgid "" +"The free-threaded build links to the third-party shared libraries, such as " +"``OpenSSL`` and ``Tk``, installed in the traditional framework. This means " +"that both builds also share one set of trust certificates as installed by " +"the :command:`Install Certificates.command` script, thus it only needs to be " +"run once." +msgstr "" + +#: ../../using/mac.rst:339 +msgid "" +"If you cannot depend on the link in ``/usr/local/bin`` pointing to the " +"``python.org`` free-threaded |usemac_python_x_dot_y_t_literal| (for example, " +"if you want to install your own version there or some other distribution " +"does), you can explicitly set your shell ``PATH`` environment variable to " +"include the ``PythonT`` framework ``bin`` directory:" +msgstr "" + +#: ../../using/mac.rst:345 +msgid "" +"export PATH=\"/Library/Frameworks/PythonT.framework/Versions/3.13/bin\":" +"\"$PATH\"" +msgstr "" +"export PATH=\"/Library/Frameworks/PythonT.framework/Versions/3.13/bin\":" +"\"$PATH\"" + +#: ../../using/mac.rst:349 +msgid "" +"The traditional framework installation by default does something similar, " +"except for :file:`Python.framework`. Be aware that having both framework " +"``bin`` directories in ``PATH`` can lead to confusion if there are duplicate " +"names like ``python3.13`` in both; which one is actually used depends on the " +"order they appear in ``PATH``. The ``which python3.x`` or ``which python3." +"xt`` commands can show which path is being used. Using virtual environments " +"can help avoid such ambiguities. Another option might be to create a shell :" +"command:`alias` to the desired interpreter, like:" +msgstr "" + +#: ../../using/mac.rst:358 +msgid "" +"alias py3.13=\"/Library/Frameworks/Python.framework/Versions/3.13/bin/" +"python3.13\"\n" +"alias py3.13t=\"/Library/Frameworks/PythonT.framework/Versions/3.13/bin/" +"python3.13t\"" +msgstr "" +"alias py3.13=\"/Library/Frameworks/Python.framework/Versions/3.13/bin/" +"python3.13\"\n" +"alias py3.13t=\"/Library/Frameworks/PythonT.framework/Versions/3.13/bin/" +"python3.13t\"" + +#: ../../using/mac.rst:364 +msgid "Installing using the command line" +msgstr "使用命令列安裝" + +#: ../../using/mac.rst:366 +msgid "" +"If you want to use automation to install the ``python.org`` installer " +"package (rather than by using the familiar macOS :program:`Installer` GUI " +"app), the macOS command line :command:`installer` utility lets you select " +"non-default options, too. If you are not familiar with :command:`installer`, " +"it can be somewhat cryptic (see :command:`man installer` for more " +"information). As an example, the following shell snippet shows one way to do " +"it, using the ``3.13.0b2`` release and selecting the free-threaded " +"interpreter option:" +msgstr "" + +#: ../../using/mac.rst:375 +msgid "" +"RELEASE=\"python-3.13.0b2-macos11.pkg\"\n" +"\n" +"# download installer pkg\n" +"curl -O https://www.python.org/ftp/python/3.13.0/${RELEASE}\n" +"\n" +"# create installer choicechanges to customize the install:\n" +"# enable the PythonTFramework-3.13 package\n" +"# while accepting the other defaults (install all other packages)\n" +"cat > ./choicechanges.plist <\n" +"\n" +"\n" +"\n" +" \n" +" attributeSetting\n" +" 1\n" +" choiceAttribute\n" +" selected\n" +" choiceIdentifier\n" +" org.python.Python.PythonTFramework-3.13\n" +" \n" +"\n" +"\n" +"EOF\n" +"\n" +"sudo installer -pkg ./${RELEASE} -applyChoiceChangesXML ./choicechanges." +"plist -target /" +msgstr "" + +#: ../../using/mac.rst:405 +msgid "" +"You can then test that both installer builds are now available with " +"something like:" +msgstr "" + +#: ../../using/mac.rst:407 +msgid "" +"$ # test that the free-threaded interpreter was installed if the Unix " +"Command Tools package was enabled\n" +"$ /usr/local/bin/python3.13t -VV\n" +"Python 3.13.0b2 experimental free-threading build (v3.13.0b2:3a83b172af, " +"Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]\n" +"$ # and the traditional interpreter\n" +"$ /usr/local/bin/python3.13 -VV\n" +"Python 3.13.0b2 (v3.13.0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 " +"(clang-1500.3.9.4)]\n" +"$ # test that they are also available without the prefix if /usr/local/bin " +"is on $PATH\n" +"$ python3.13t -VV\n" +"Python 3.13.0b2 experimental free-threading build (v3.13.0b2:3a83b172af, " +"Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]\n" +"$ python3.13 -VV\n" +"Python 3.13.0b2 (v3.13.0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 " +"(clang-1500.3.9.4)]" +msgstr "" + +#: ../../using/mac.rst:423 +msgid "" +"Current ``python.org`` installers only install to fixed locations like :file:" +"`/Library/Frameworks/`, :file:`/Applications`, and :file:`/usr/local/bin`. " +"You cannot use the :command:`installer` ``-domain`` option to install to " +"other locations." +msgstr "" + +#: ../../using/mac.rst:431 msgid "Distributing Python Applications" msgstr "發行 Python 應用程式" -#: ../../using/mac.rst:177 +#: ../../using/mac.rst:433 msgid "" "A range of tools exist for converting your Python code into a standalone " "distributable application:" msgstr "" -#: ../../using/mac.rst:180 +#: ../../using/mac.rst:436 msgid "" ":pypi:`py2app`: Supports creating macOS ``.app`` bundles from a Python " "project." msgstr ":pypi:`py2app`:支援從 Python 專案打包成 macOS ``.app``。" -#: ../../using/mac.rst:183 +#: ../../using/mac.rst:439 msgid "" -"`Briefcase `__: Part of the `BeeWare " -"Project `__; a cross-platform packaging tool that " +"`Briefcase `_: Part of the `BeeWare " +"Project `_; a cross-platform packaging tool that " "supports creation of ``.app`` bundles on macOS, as well as managing signing " "and notarization." msgstr "" +"`Briefcase `_:`BeeWare 專案 `__\\ 的一部分;支援建立 macOS ``.app`` 的跨平台打包工具,亦為管" +"理簽署和驗證 (notarization) 的工具。" -#: ../../using/mac.rst:188 +#: ../../using/mac.rst:444 msgid "" -"`PyInstaller `__: A cross-platform packaging tool " +"`PyInstaller `_: A cross-platform packaging tool " "that creates a single file or folder as a distributable artifact." msgstr "" -"`PyInstaller `__:一個跨平臺打包工具,可以將單一檔" -"案或資料夾打包成可分發的檔案。" +"`PyInstaller `_:一個跨平臺打包工具,可以將單一檔案" +"或資料夾打包成可分發的檔案。" -#: ../../using/mac.rst:192 +#: ../../using/mac.rst:448 msgid "App Store Compliance" msgstr "" -#: ../../using/mac.rst:194 +#: ../../using/mac.rst:450 msgid "" "Apps submitted for distribution through the macOS App Store must pass " "Apple's app review process. This process includes a set of automated " @@ -370,7 +693,7 @@ msgid "" "problematic code." msgstr "" -#: ../../using/mac.rst:198 +#: ../../using/mac.rst:454 msgid "" "The Python standard library contains some code that is known to violate " "these automated rules. While these violations appear to be false positives, " @@ -378,7 +701,7 @@ msgid "" "modify the Python standard library for an app to pass App Store review." msgstr "" -#: ../../using/mac.rst:203 +#: ../../using/mac.rst:459 msgid "" "The Python source tree contains :source:`a patch file ` that will remove all code that is known to cause " @@ -387,7 +710,7 @@ msgid "" "compliance` option." msgstr "" -#: ../../using/mac.rst:209 +#: ../../using/mac.rst:465 msgid "" "This patch is not normally required to use CPython on a Mac; nor is it " "required if you are distributing an app *outside* the macOS App Store. It is " @@ -395,26 +718,14 @@ msgid "" "channel." msgstr "" -#: ../../using/mac.rst:214 +#: ../../using/mac.rst:470 msgid "Other Resources" msgstr "其他資源" -#: ../../using/mac.rst:216 +#: ../../using/mac.rst:472 msgid "" -"The Pythonmac-SIG mailing list is an excellent support resource for Python " -"users and developers on the Mac:" +"The `python.org Help page `_ has links " +"to many useful resources. The `Pythonmac-SIG mailing list `_ is another support " +"resource specifically for Python users and developers on the Mac." msgstr "" -"Pythonmac-SIG 郵件清單對於 Mac 上的 Python 使用者和開發者是一個極佳的支援資" -"源:" - -#: ../../using/mac.rst:219 -msgid "https://www.python.org/community/sigs/current/pythonmac-sig/" -msgstr "https://www.python.org/community/sigs/current/pythonmac-sig/" - -#: ../../using/mac.rst:221 -msgid "Another useful resource is the MacPython wiki:" -msgstr "另一個好用資源是 MacPython wiki:" - -#: ../../using/mac.rst:223 -msgid "https://wiki.python.org/moin/MacPython" -msgstr "https://wiki.python.org/moin/MacPython" diff --git a/whatsnew/2.1.po b/whatsnew/2.1.po index bdb865bf96..72d4b9a90d 100644 --- a/whatsnew/2.1.po +++ b/whatsnew/2.1.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -705,9 +705,9 @@ msgstr "" #: ../../whatsnew/2.1.rst:445 msgid "" "The dictionary containing attributes can be accessed as the function's :attr:" -"`~object.__dict__`. Unlike the :attr:`~object.__dict__` attribute of class " +"`~function.__dict__`. Unlike the :attr:`~type.__dict__` attribute of class " "instances, in functions you can actually assign a new dictionary to :attr:" -"`~object.__dict__`, though the new value is restricted to a regular Python " +"`~function.__dict__`, though the new value is restricted to a regular Python " "dictionary; you *can't* be tricky and set it to a :class:`!UserDict` " "instance, or any other random object that behaves like a mapping." msgstr "" diff --git a/whatsnew/2.2.po b/whatsnew/2.2.po index 337bc0870a..440d72550b 100644 --- a/whatsnew/2.2.po +++ b/whatsnew/2.2.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -266,8 +266,8 @@ msgid ":attr:`~definition.__name__` is the attribute's name." msgstr ":attr:`~definition.__name__` 是屬性的名稱。" #: ../../whatsnew/2.2.rst:174 -msgid ":attr:`!__doc__` is the attribute's docstring." -msgstr ":attr:`!__doc__` 是屬性的文件字串 (docstring)。" +msgid ":attr:`~definition.__doc__` is the attribute's docstring." +msgstr ":attr:`~definition.__doc__` 是屬性的文件字串 (docstring)。" #: ../../whatsnew/2.2.rst:176 msgid "" @@ -298,17 +298,17 @@ msgstr "" #: ../../whatsnew/2.2.rst:189 msgid "" -"For methods, :meth:`!descriptor.__get__` returns a temporary object that's " -"callable, and wraps up the instance and the method to be called on it. This " -"is also why static methods and class methods are now possible; they have " -"descriptors that wrap up just the method, or the method and the class. As a " -"brief explanation of these new kinds of methods, static methods aren't " -"passed the instance, and therefore resemble regular functions. Class " -"methods are passed the class of the object, but not the object itself. " -"Static and class methods are defined like this::" +"For methods, :meth:`descriptor.__get__ ` returns a temporary " +"object that's callable, and wraps up the instance and the method to be " +"called on it. This is also why static methods and class methods are now " +"possible; they have descriptors that wrap up just the method, or the method " +"and the class. As a brief explanation of these new kinds of methods, static " +"methods aren't passed the instance, and therefore resemble regular " +"functions. Class methods are passed the class of the object, but not the " +"object itself. Static and class methods are defined like this::" msgstr "" -#: ../../whatsnew/2.2.rst:198 +#: ../../whatsnew/2.2.rst:199 msgid "" "class C(object):\n" " def f(arg1, arg2):\n" @@ -319,8 +319,16 @@ msgid "" " ...\n" " g = classmethod(g)" msgstr "" +"class C(object):\n" +" def f(arg1, arg2):\n" +" ...\n" +" f = staticmethod(f)\n" +"\n" +" def g(cls, arg1, arg2):\n" +" ...\n" +" g = classmethod(g)" -#: ../../whatsnew/2.2.rst:207 +#: ../../whatsnew/2.2.rst:208 msgid "" "The :func:`staticmethod` function takes the function :func:`!f`, and returns " "it wrapped up in a descriptor so it can be stored in the class object. You " @@ -329,7 +337,7 @@ msgid "" "has been defined yet; that's been left for future versions of Python." msgstr "" -#: ../../whatsnew/2.2.rst:213 +#: ../../whatsnew/2.2.rst:214 msgid "" "More new features, such as slots and properties, are also implemented as new " "kinds of descriptors, and it's not difficult to write a descriptor class " @@ -339,7 +347,7 @@ msgid "" "defined like this::" msgstr "" -#: ../../whatsnew/2.2.rst:220 +#: ../../whatsnew/2.2.rst:221 msgid "" "from eiffel import eiffelmethod\n" "\n" @@ -357,7 +365,7 @@ msgid "" " f = eiffelmethod(f, pre_f, post_f)" msgstr "" -#: ../../whatsnew/2.2.rst:235 +#: ../../whatsnew/2.2.rst:236 msgid "" "Note that a person using the new :func:`!eiffelmethod` doesn't have to " "understand anything about descriptors. This is why I think the new features " @@ -367,18 +375,18 @@ msgid "" "resulting libraries and ignore the implementation details." msgstr "" -#: ../../whatsnew/2.2.rst:244 +#: ../../whatsnew/2.2.rst:245 msgid "Multiple Inheritance: The Diamond Rule" msgstr "" -#: ../../whatsnew/2.2.rst:246 +#: ../../whatsnew/2.2.rst:247 msgid "" "Multiple inheritance has also been made more useful through changing the " "rules under which names are resolved. Consider this set of classes (diagram " "taken from :pep:`253` by Guido van Rossum)::" msgstr "" -#: ../../whatsnew/2.2.rst:250 +#: ../../whatsnew/2.2.rst:251 msgid "" " class A:\n" " ^ ^ def save(self): ...\n" @@ -394,8 +402,21 @@ msgid "" " \\ /\n" " class D" msgstr "" +" class A:\n" +" ^ ^ def save(self): ...\n" +" / \\\n" +" / \\\n" +" / \\\n" +" / \\\n" +"class B class C:\n" +" ^ ^ def save(self): ...\n" +" \\ /\n" +" \\ /\n" +" \\ /\n" +" \\ /\n" +" class D" -#: ../../whatsnew/2.2.rst:264 +#: ../../whatsnew/2.2.rst:265 msgid "" "The lookup rule for classic classes is simple but not very smart; the base " "classes are searched depth-first, going from left to right. A reference to :" @@ -406,7 +427,7 @@ msgid "" "not calling it will result in that state never getting saved." msgstr "" -#: ../../whatsnew/2.2.rst:272 +#: ../../whatsnew/2.2.rst:273 msgid "" "New-style classes follow a different algorithm that's a bit more complicated " "to explain, but does the right thing in this situation. (Note that Python " @@ -415,7 +436,7 @@ msgid "" "graphs.)" msgstr "" -#: ../../whatsnew/2.2.rst:277 +#: ../../whatsnew/2.2.rst:278 msgid "" "List all the base classes, following the classic lookup rule and include a " "class multiple times if it's visited repeatedly. In the above example, the " @@ -423,7 +444,7 @@ msgid "" "C`, :class:`!A`]." msgstr "" -#: ../../whatsnew/2.2.rst:282 +#: ../../whatsnew/2.2.rst:283 msgid "" "Scan the list for duplicated classes. If any are found, remove all but one " "occurrence, leaving the *last* one in the list. In the above example, the " @@ -431,7 +452,7 @@ msgid "" "dropping duplicates." msgstr "" -#: ../../whatsnew/2.2.rst:287 +#: ../../whatsnew/2.2.rst:288 msgid "" "Following this rule, referring to :meth:`!D.save` will return :meth:`!C." "save`, which is the behaviour we're after. This lookup rule is the same as " @@ -444,7 +465,7 @@ msgid "" "like this::" msgstr "" -#: ../../whatsnew/2.2.rst:296 +#: ../../whatsnew/2.2.rst:297 msgid "" "class D (B,C):\n" " def save (self):\n" @@ -454,18 +475,18 @@ msgid "" " ..." msgstr "" -#: ../../whatsnew/2.2.rst:303 +#: ../../whatsnew/2.2.rst:304 msgid "" ":func:`super` can also return unbound superclass objects when called as " "``super(class)`` or ``super(class1, class2)``, but this probably won't often " "be useful." msgstr "" -#: ../../whatsnew/2.2.rst:309 +#: ../../whatsnew/2.2.rst:310 msgid "Attribute Access" msgstr "" -#: ../../whatsnew/2.2.rst:311 +#: ../../whatsnew/2.2.rst:312 msgid "" "A fair number of sophisticated Python classes define hooks for attribute " "access using :meth:`~object.__getattr__`; most commonly this is done for " @@ -474,7 +495,7 @@ msgid "" "get_parent``. Python 2.2 adds some new ways of controlling attribute access." msgstr "" -#: ../../whatsnew/2.2.rst:317 +#: ../../whatsnew/2.2.rst:318 msgid "" "First, ``__getattr__(attr_name)`` is still supported by new-style classes, " "and nothing about it has changed. As before, it will be called when an " @@ -482,7 +503,7 @@ msgid "" "found in the instance's dictionary." msgstr "" -#: ../../whatsnew/2.2.rst:322 +#: ../../whatsnew/2.2.rst:323 msgid "" "New-style classes also support a new method, " "``__getattribute__(attr_name)``. The difference between the two methods is " @@ -491,7 +512,7 @@ msgid "" "called if ``foo`` isn't found in the instance's dictionary." msgstr "" -#: ../../whatsnew/2.2.rst:328 +#: ../../whatsnew/2.2.rst:329 msgid "" "However, Python 2.2's support for :dfn:`properties` will often be a simpler " "way to trap attribute references. Writing a :meth:`!__getattr__` method is " @@ -504,7 +525,7 @@ msgid "" "in a sizable performance loss." msgstr "" -#: ../../whatsnew/2.2.rst:337 +#: ../../whatsnew/2.2.rst:338 msgid "" ":class:`property` is a new built-in type that packages up three functions " "that get, set, or delete an attribute, and a docstring. For example, if you " @@ -512,7 +533,7 @@ msgid "" "you could write::" msgstr "" -#: ../../whatsnew/2.2.rst:342 +#: ../../whatsnew/2.2.rst:343 msgid "" "class C(object):\n" " def get_size (self):\n" @@ -530,7 +551,7 @@ msgid "" " \"Storage size of this instance\")" msgstr "" -#: ../../whatsnew/2.2.rst:357 +#: ../../whatsnew/2.2.rst:358 msgid "" "That is certainly clearer and easier to write than a pair of :meth:`!" "__getattr__`/:meth:`!__setattr__` methods that check for the :attr:`!size` " @@ -540,7 +561,7 @@ msgid "" "references to other attributes run at their usual speed." msgstr "" -#: ../../whatsnew/2.2.rst:364 +#: ../../whatsnew/2.2.rst:365 msgid "" "Finally, it's possible to constrain the list of attributes that can be " "referenced on an object using the new :attr:`~object.__slots__` class " @@ -551,7 +572,7 @@ msgid "" "names. An example will make this clear::" msgstr "" -#: ../../whatsnew/2.2.rst:371 +#: ../../whatsnew/2.2.rst:372 msgid "" ">>> class C(object):\n" "... __slots__ = ('template', 'name')\n" @@ -568,17 +589,17 @@ msgid "" "AttributeError: 'C' object has no attribute 'newattr'" msgstr "" -#: ../../whatsnew/2.2.rst:385 +#: ../../whatsnew/2.2.rst:386 msgid "" "Note how you get an :exc:`AttributeError` on the attempt to assign to an " "attribute not listed in :attr:`~object.__slots__`." msgstr "" -#: ../../whatsnew/2.2.rst:392 +#: ../../whatsnew/2.2.rst:393 msgid "Related Links" msgstr "相關連結" -#: ../../whatsnew/2.2.rst:394 +#: ../../whatsnew/2.2.rst:395 msgid "" "This section has just been a quick overview of the new features, giving " "enough of an explanation to start you programming, but many details have " @@ -586,7 +607,7 @@ msgid "" "picture?" msgstr "" -#: ../../whatsnew/2.2.rst:398 +#: ../../whatsnew/2.2.rst:399 msgid "" "The :ref:`descriptorhowto` is a lengthy tutorial introduction to the " "descriptor features, written by Guido van Rossum. If my description has " @@ -594,7 +615,7 @@ msgid "" "more detail about the new features while still remaining quite easy to read." msgstr "" -#: ../../whatsnew/2.2.rst:403 +#: ../../whatsnew/2.2.rst:404 msgid "" "Next, there are two relevant PEPs, :pep:`252` and :pep:`253`. :pep:`252` is " "titled \"Making Types Look More Like Classes\", and covers the descriptor " @@ -606,7 +627,7 @@ msgid "" "substantial assistance from the rest of the Zope Corp. team." msgstr "" -#: ../../whatsnew/2.2.rst:412 +#: ../../whatsnew/2.2.rst:413 msgid "" "Finally, there's the ultimate authority: the source code. Most of the " "machinery for the type handling is in :file:`Objects/typeobject.c`, but you " @@ -614,31 +635,31 @@ msgid "" "including posting a question to python-list or python-dev." msgstr "" -#: ../../whatsnew/2.2.rst:421 +#: ../../whatsnew/2.2.rst:422 msgid "PEP 234: Iterators" msgstr "PEP 234:疊代器" -#: ../../whatsnew/2.2.rst:423 +#: ../../whatsnew/2.2.rst:424 msgid "" "Another significant addition to 2.2 is an iteration interface at both the C " "and Python levels. Objects can define how they can be looped over by " "callers." msgstr "" -#: ../../whatsnew/2.2.rst:426 +#: ../../whatsnew/2.2.rst:427 msgid "" "In Python versions up to 2.1, the usual way to make ``for item in obj`` work " "is to define a :meth:`~object.__getitem__` method that looks something like " "this::" msgstr "" -#: ../../whatsnew/2.2.rst:429 +#: ../../whatsnew/2.2.rst:430 msgid "" "def __getitem__(self, index):\n" " return " msgstr "" -#: ../../whatsnew/2.2.rst:432 +#: ../../whatsnew/2.2.rst:433 msgid "" ":meth:`~object.__getitem__` is more properly used to define an indexing " "operation on an object so that you can write ``obj[5]`` to retrieve the " @@ -652,7 +673,7 @@ msgid "" "really should." msgstr "" -#: ../../whatsnew/2.2.rst:442 +#: ../../whatsnew/2.2.rst:443 msgid "" "In Python 2.2, iteration can be implemented separately, and :meth:`~object." "__getitem__` methods can be limited to classes that really do support random " @@ -663,7 +684,7 @@ msgid "" "until it returns *sentinel* to signal that the iterator is done." msgstr "" -#: ../../whatsnew/2.2.rst:450 +#: ../../whatsnew/2.2.rst:451 msgid "" "Python classes can define an :meth:`!__iter__` method, which should create " "and return a new iterator for the object; if the object is its own iterator, " @@ -674,7 +695,7 @@ msgid "" "`~PyTypeObject.tp_iternext` function." msgstr "" -#: ../../whatsnew/2.2.rst:457 +#: ../../whatsnew/2.2.rst:458 msgid "" "So, after all this, what do iterators actually do? They have one required " "method, :meth:`next`, which takes no arguments and returns the next value. " @@ -682,7 +703,7 @@ msgid "" "raise the :exc:`StopIteration` exception. ::" msgstr "" -#: ../../whatsnew/2.2.rst:462 +#: ../../whatsnew/2.2.rst:463 msgid "" ">>> L = [1,2,3]\n" ">>> i = iter(L)\n" @@ -701,7 +722,7 @@ msgid "" ">>>" msgstr "" -#: ../../whatsnew/2.2.rst:478 +#: ../../whatsnew/2.2.rst:479 msgid "" "In 2.2, Python's :keyword:`for` statement no longer expects a sequence; it " "expects something for which :func:`iter` will return an iterator. For " @@ -713,7 +734,7 @@ msgid "" "this::" msgstr "" -#: ../../whatsnew/2.2.rst:486 +#: ../../whatsnew/2.2.rst:487 msgid "" ">>> L = [1,2,3]\n" ">>> i = iter(L)\n" @@ -722,14 +743,14 @@ msgid "" "(1, 2, 3)" msgstr "" -#: ../../whatsnew/2.2.rst:492 +#: ../../whatsnew/2.2.rst:493 msgid "" "Iterator support has been added to some of Python's basic types. Calling :" "func:`iter` on a dictionary will return an iterator which loops over its " "keys::" msgstr "" -#: ../../whatsnew/2.2.rst:495 +#: ../../whatsnew/2.2.rst:496 msgid "" ">>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,\n" "... 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}\n" @@ -749,7 +770,7 @@ msgid "" "Oct 10" msgstr "" -#: ../../whatsnew/2.2.rst:512 +#: ../../whatsnew/2.2.rst:513 msgid "" "That's just the default behaviour. If you want to iterate over keys, " "values, or key/value pairs, you can explicitly call the :meth:`!iterkeys`, :" @@ -758,21 +779,21 @@ msgid "" "dictionaries, so ``key in dict`` is now equivalent to ``dict.has_key(key)``." msgstr "" -#: ../../whatsnew/2.2.rst:518 +#: ../../whatsnew/2.2.rst:519 msgid "" "Files also provide an iterator, which calls the :meth:`readline` method " "until there are no more lines in the file. This means you can now read each " "line of a file using code like this::" msgstr "" -#: ../../whatsnew/2.2.rst:522 +#: ../../whatsnew/2.2.rst:523 msgid "" "for line in file:\n" " # do something for each line\n" " ..." msgstr "" -#: ../../whatsnew/2.2.rst:526 +#: ../../whatsnew/2.2.rst:527 msgid "" "Note that you can only go forward in an iterator; there's no way to get the " "previous element, reset the iterator, or make a copy of it. An iterator " @@ -780,11 +801,11 @@ msgid "" "only requires a :meth:`next` method." msgstr "" -#: ../../whatsnew/2.2.rst:534 +#: ../../whatsnew/2.2.rst:535 msgid ":pep:`234` - Iterators" msgstr ":pep:`234` - 疊代器" -#: ../../whatsnew/2.2.rst:535 +#: ../../whatsnew/2.2.rst:536 msgid "" "Written by Ka-Ping Yee and GvR; implemented by the Python Labs crew, mostly " "by GvR and Tim Peters." @@ -792,17 +813,17 @@ msgstr "" "由 Ka-Ping Yee 和 GvR 撰寫;由 Python Labs 團隊實作,主要為 GvR 和 Tim " "Peters 所貢獻。" -#: ../../whatsnew/2.2.rst:542 +#: ../../whatsnew/2.2.rst:543 msgid "PEP 255: Simple Generators" msgstr "" -#: ../../whatsnew/2.2.rst:544 +#: ../../whatsnew/2.2.rst:545 msgid "" "Generators are another new feature, one that interacts with the introduction " "of iterators." msgstr "" -#: ../../whatsnew/2.2.rst:547 +#: ../../whatsnew/2.2.rst:548 msgid "" "You're doubtless familiar with how function calls work in Python or C. When " "you call a function, it gets a private namespace where its local variables " @@ -815,18 +836,18 @@ msgid "" "functions." msgstr "" -#: ../../whatsnew/2.2.rst:556 +#: ../../whatsnew/2.2.rst:557 msgid "Here's the simplest example of a generator function::" msgstr "" -#: ../../whatsnew/2.2.rst:558 +#: ../../whatsnew/2.2.rst:559 msgid "" "def generate_ints(N):\n" " for i in range(N):\n" " yield i" msgstr "" -#: ../../whatsnew/2.2.rst:562 +#: ../../whatsnew/2.2.rst:563 msgid "" "A new keyword, :keyword:`yield`, was introduced for generators. Any " "function containing a :keyword:`!yield` statement is a generator function; " @@ -837,7 +858,7 @@ msgid "" "Python 2.3 this statement will become unnecessary." msgstr "" -#: ../../whatsnew/2.2.rst:570 +#: ../../whatsnew/2.2.rst:571 msgid "" "When you call a generator function, it doesn't return a single value; " "instead it returns a generator object that supports the iterator protocol. " @@ -853,11 +874,11 @@ msgid "" "explanation of the interaction between :keyword:`!yield` and exceptions.)" msgstr "" -#: ../../whatsnew/2.2.rst:583 +#: ../../whatsnew/2.2.rst:584 msgid "Here's a sample usage of the :func:`!generate_ints` generator::" msgstr "" -#: ../../whatsnew/2.2.rst:585 +#: ../../whatsnew/2.2.rst:586 msgid "" ">>> gen = generate_ints(3)\n" ">>> gen\n" @@ -875,13 +896,13 @@ msgid "" "StopIteration" msgstr "" -#: ../../whatsnew/2.2.rst:600 +#: ../../whatsnew/2.2.rst:601 msgid "" "You could equally write ``for i in generate_ints(5)``, or ``a,b,c = " "generate_ints(3)``." msgstr "" -#: ../../whatsnew/2.2.rst:603 +#: ../../whatsnew/2.2.rst:604 msgid "" "Inside a generator function, the :keyword:`return` statement can only be " "used without a value, and signals the end of the procession of values; " @@ -892,7 +913,7 @@ msgid "" "flow of execution fall off the bottom of the function." msgstr "" -#: ../../whatsnew/2.2.rst:611 +#: ../../whatsnew/2.2.rst:612 msgid "" "You could achieve the effect of generators manually by writing your own " "class and storing all the local variables of the generator as instance " @@ -905,7 +926,7 @@ msgid "" "recursively. ::" msgstr "" -#: ../../whatsnew/2.2.rst:620 +#: ../../whatsnew/2.2.rst:621 msgid "" "# A recursive generator that generates Tree leaves in in-order.\n" "def inorder(t):\n" @@ -917,7 +938,7 @@ msgid "" " yield x" msgstr "" -#: ../../whatsnew/2.2.rst:629 +#: ../../whatsnew/2.2.rst:630 msgid "" "Two other examples in :file:`Lib/test/test_generators.py` produce solutions " "for the N-Queens problem (placing $N$ queens on an $NxN$ chess board so that " @@ -926,7 +947,7 @@ msgid "" "twice)." msgstr "" -#: ../../whatsnew/2.2.rst:634 +#: ../../whatsnew/2.2.rst:635 msgid "" "The idea of generators comes from other programming languages, especially " "Icon (https://www2.cs.arizona.edu/icon/), where the idea of generators is " @@ -936,13 +957,13 @@ msgid "" "of what this looks like::" msgstr "" -#: ../../whatsnew/2.2.rst:641 +#: ../../whatsnew/2.2.rst:642 msgid "" "sentence := \"Store it in the neighboring harbor\"\n" "if (i := find(\"or\", sentence)) > 5 then write(i)" msgstr "" -#: ../../whatsnew/2.2.rst:644 +#: ../../whatsnew/2.2.rst:645 msgid "" "In Icon the :func:`!find` function returns the indexes at which the " "substring \"or\" is found: 3, 23, 33. In the :keyword:`if` statement, ``i`` " @@ -952,7 +973,7 @@ msgid "" "screen." msgstr "" -#: ../../whatsnew/2.2.rst:650 +#: ../../whatsnew/2.2.rst:651 msgid "" "Python doesn't go nearly as far as Icon in adopting generators as a central " "concept. Generators are considered a new part of the core Python language, " @@ -963,22 +984,22 @@ msgid "" "other functions or stored in a data structure." msgstr "" -#: ../../whatsnew/2.2.rst:661 +#: ../../whatsnew/2.2.rst:662 msgid ":pep:`255` - Simple Generators" msgstr "" -#: ../../whatsnew/2.2.rst:662 +#: ../../whatsnew/2.2.rst:663 msgid "" "Written by Neil Schemenauer, Tim Peters, Magnus Lie Hetland. Implemented " "mostly by Neil Schemenauer and Tim Peters, with other fixes from the Python " "Labs crew." msgstr "" -#: ../../whatsnew/2.2.rst:669 +#: ../../whatsnew/2.2.rst:670 msgid "PEP 237: Unifying Long Integers and Integers" msgstr "" -#: ../../whatsnew/2.2.rst:671 +#: ../../whatsnew/2.2.rst:672 msgid "" "In recent versions, the distinction between regular integers, which are 32-" "bit values on most machines, and long integers, which can be of arbitrary " @@ -991,7 +1012,7 @@ msgid "" "exception with the message 'slice index must be int'." msgstr "" -#: ../../whatsnew/2.2.rst:681 +#: ../../whatsnew/2.2.rst:682 msgid "" "Python 2.2 will shift values from short to long integers as required. The " "'L' suffix is no longer needed to indicate a long integer literal, as now " @@ -1002,7 +1023,7 @@ msgid "" "result. For example::" msgstr "" -#: ../../whatsnew/2.2.rst:689 +#: ../../whatsnew/2.2.rst:690 msgid "" ">>> 1234567890123\n" "1234567890123L\n" @@ -1010,28 +1031,28 @@ msgid "" "18446744073709551616L" msgstr "" -#: ../../whatsnew/2.2.rst:694 +#: ../../whatsnew/2.2.rst:695 msgid "" "In most cases, integers and long integers will now be treated identically. " "You can still distinguish them with the :func:`type` built-in function, but " "that's rarely needed." msgstr "" -#: ../../whatsnew/2.2.rst:701 +#: ../../whatsnew/2.2.rst:702 msgid ":pep:`237` - Unifying Long Integers and Integers" msgstr "" -#: ../../whatsnew/2.2.rst:702 +#: ../../whatsnew/2.2.rst:703 msgid "" "Written by Moshe Zadka and Guido van Rossum. Implemented mostly by Guido " "van Rossum." msgstr "" -#: ../../whatsnew/2.2.rst:709 +#: ../../whatsnew/2.2.rst:710 msgid "PEP 238: Changing the Division Operator" msgstr "" -#: ../../whatsnew/2.2.rst:711 +#: ../../whatsnew/2.2.rst:712 msgid "" "The most controversial change in Python 2.2 heralds the start of an effort " "to fix an old design flaw that's been in Python from the beginning. " @@ -1044,7 +1065,7 @@ msgid "" "difficult to determine the possible types of the operands." msgstr "" -#: ../../whatsnew/2.2.rst:721 +#: ../../whatsnew/2.2.rst:722 msgid "" "(The controversy is over whether this is *really* a design flaw, and whether " "it's worth breaking existing code to fix this. It's caused endless " @@ -1054,14 +1075,14 @@ msgid "" "Read :pep:`238` for a summary of arguments and counter-arguments.)" msgstr "" -#: ../../whatsnew/2.2.rst:728 +#: ../../whatsnew/2.2.rst:729 msgid "" "Because this change might break code, it's being introduced very gradually. " "Python 2.2 begins the transition, but the switch won't be complete until " "Python 3.0." msgstr "" -#: ../../whatsnew/2.2.rst:732 +#: ../../whatsnew/2.2.rst:733 msgid "" "First, I'll borrow some terminology from :pep:`238`. \"True division\" is " "the division that most non-programmers are familiar with: 3/2 is 1.5, 1/4 is " @@ -1073,11 +1094,11 @@ msgid "" "the operands is a floating-point number." msgstr "" -#: ../../whatsnew/2.2.rst:740 +#: ../../whatsnew/2.2.rst:741 msgid "Here are the changes 2.2 introduces:" msgstr "" -#: ../../whatsnew/2.2.rst:742 +#: ../../whatsnew/2.2.rst:743 msgid "" "A new operator, ``//``, is the floor division operator. (Yes, we know it " "looks like C++'s comment symbol.) ``//`` *always* performs floor division " @@ -1085,13 +1106,13 @@ msgid "" "``1.0 // 2.0`` is also 0.0." msgstr "" -#: ../../whatsnew/2.2.rst:747 +#: ../../whatsnew/2.2.rst:748 msgid "" "``//`` is always available in Python 2.2; you don't need to enable it using " "a ``__future__`` statement." msgstr "" -#: ../../whatsnew/2.2.rst:750 +#: ../../whatsnew/2.2.rst:751 msgid "" "By including a ``from __future__ import division`` in a module, the ``/`` " "operator will be changed to return the result of true division, so ``1/2`` " @@ -1099,7 +1120,7 @@ msgid "" "division. The default meaning of ``/`` will not change until Python 3.0." msgstr "" -#: ../../whatsnew/2.2.rst:755 +#: ../../whatsnew/2.2.rst:756 msgid "" "Classes can define methods called :meth:`~object.__truediv__` and :meth:" "`~object.__floordiv__` to overload the two division operators. At the C " @@ -1107,7 +1128,7 @@ msgid "" "extension types can define the two operators." msgstr "" -#: ../../whatsnew/2.2.rst:760 +#: ../../whatsnew/2.2.rst:761 msgid "" "Python 2.2 supports some command-line arguments for testing whether code " "will work with the changed division semantics. Running python with :option:" @@ -1117,21 +1138,21 @@ msgid "" "without a warning; the warning will be turned on by default in Python 2.3." msgstr "" -#: ../../whatsnew/2.2.rst:770 +#: ../../whatsnew/2.2.rst:771 msgid ":pep:`238` - Changing the Division Operator" msgstr "" -#: ../../whatsnew/2.2.rst:771 +#: ../../whatsnew/2.2.rst:772 msgid "" "Written by Moshe Zadka and Guido van Rossum. Implemented by Guido van " "Rossum.." msgstr "" -#: ../../whatsnew/2.2.rst:777 +#: ../../whatsnew/2.2.rst:778 msgid "Unicode Changes" msgstr "Unicode 變更" -#: ../../whatsnew/2.2.rst:779 +#: ../../whatsnew/2.2.rst:780 msgid "" "Python's Unicode support has been enhanced a bit in 2.2. Unicode strings " "are usually stored as UCS-2, as 16-bit unsigned integers. Python 2.2 can " @@ -1141,7 +1162,7 @@ msgid "" "completely disable Unicode support.)" msgstr "" -#: ../../whatsnew/2.2.rst:786 +#: ../../whatsnew/2.2.rst:787 msgid "" "When built to use UCS-4 (a \"wide Python\"), the interpreter can natively " "handle Unicode characters from U+000000 to U+110000, so the range of legal " @@ -1152,7 +1173,7 @@ msgid "" "characters\"; consult it for further details." msgstr "" -#: ../../whatsnew/2.2.rst:794 +#: ../../whatsnew/2.2.rst:795 msgid "" "Another change is simpler to explain. Since their introduction, Unicode " "strings have supported an :meth:`!encode` method to convert the string to a " @@ -1163,14 +1184,14 @@ msgid "" "codec." msgstr "" -#: ../../whatsnew/2.2.rst:801 +#: ../../whatsnew/2.2.rst:802 msgid "" "Using this new feature, codecs have been added for tasks not directly " "related to Unicode. For example, codecs have been added for uu-encoding, " "MIME's base64 encoding, and compression with the :mod:`zlib` module::" msgstr "" -#: ../../whatsnew/2.2.rst:805 +#: ../../whatsnew/2.2.rst:806 msgid "" ">>> s = \"\"\"Here is a lengthy piece of redundant, overly verbose,\n" "... and repetitive text.\n" @@ -1191,32 +1212,32 @@ msgid "" "'furrfu'" msgstr "" -#: ../../whatsnew/2.2.rst:822 +#: ../../whatsnew/2.2.rst:823 msgid "" "To convert a class instance to Unicode, a :meth:`!__unicode__` method can be " "defined by a class, analogous to :meth:`!__str__`." msgstr "" -#: ../../whatsnew/2.2.rst:825 +#: ../../whatsnew/2.2.rst:826 msgid "" ":meth:`!encode`, :meth:`!decode`, and :meth:`!__unicode__` were implemented " "by Marc-André Lemburg. The changes to support using UCS-4 internally were " "implemented by Fredrik Lundh and Martin von Löwis." msgstr "" -#: ../../whatsnew/2.2.rst:832 +#: ../../whatsnew/2.2.rst:833 msgid ":pep:`261` - Support for 'wide' Unicode characters" msgstr ":pep:`261` - 支援 'wide' Unicode 字元" -#: ../../whatsnew/2.2.rst:833 +#: ../../whatsnew/2.2.rst:834 msgid "Written by Paul Prescod." msgstr "由 Paul Prescod 撰寫。" -#: ../../whatsnew/2.2.rst:839 +#: ../../whatsnew/2.2.rst:840 msgid "PEP 227: Nested Scopes" msgstr "" -#: ../../whatsnew/2.2.rst:841 +#: ../../whatsnew/2.2.rst:842 msgid "" "In Python 2.1, statically nested scopes were added as an optional feature, " "to be enabled by a ``from __future__ import nested_scopes`` directive. In " @@ -1226,7 +1247,7 @@ msgid "" "2.1 came out, you can skip the rest of this section." msgstr "" -#: ../../whatsnew/2.2.rst:848 +#: ../../whatsnew/2.2.rst:849 msgid "" "The largest change introduced in Python 2.1, and made complete in 2.2, is to " "Python's scoping rules. In Python 2.0, at any given time there are at most " @@ -1236,7 +1257,7 @@ msgid "" "definition doesn't work::" msgstr "" -#: ../../whatsnew/2.2.rst:855 +#: ../../whatsnew/2.2.rst:856 msgid "" "def f():\n" " ...\n" @@ -1246,7 +1267,7 @@ msgid "" " ..." msgstr "" -#: ../../whatsnew/2.2.rst:862 +#: ../../whatsnew/2.2.rst:863 msgid "" "The function :func:`!g` will always raise a :exc:`NameError` exception, " "because the binding of the name ``g`` isn't in either its local namespace or " @@ -1258,7 +1279,7 @@ msgid "" "arguments. ::" msgstr "" -#: ../../whatsnew/2.2.rst:870 +#: ../../whatsnew/2.2.rst:871 msgid "" "def find(self, name):\n" " \"Return list of any entries equal to 'name'\"\n" @@ -1267,13 +1288,13 @@ msgid "" " return L" msgstr "" -#: ../../whatsnew/2.2.rst:876 +#: ../../whatsnew/2.2.rst:877 msgid "" "The readability of Python code written in a strongly functional style " "suffers greatly as a result." msgstr "" -#: ../../whatsnew/2.2.rst:879 +#: ../../whatsnew/2.2.rst:880 msgid "" "The most significant change to Python 2.2 is that static scoping has been " "added to the language to fix this problem. As a first effect, the " @@ -1285,7 +1306,7 @@ msgid "" "rules, and a dissection of the implementation, can be found in the PEP." msgstr "" -#: ../../whatsnew/2.2.rst:888 +#: ../../whatsnew/2.2.rst:889 msgid "" "This change may cause some compatibility problems for code where the same " "variable name is used both at the module level and as a local variable " @@ -1294,7 +1315,7 @@ msgid "" "read in the first place." msgstr "" -#: ../../whatsnew/2.2.rst:894 +#: ../../whatsnew/2.2.rst:895 msgid "" "One side effect of the change is that the ``from module import *`` and " "``exec`` statements have been made illegal inside a function scope under " @@ -1310,11 +1331,11 @@ msgid "" "the compiler will flag this by raising a :exc:`SyntaxError` exception." msgstr "" -#: ../../whatsnew/2.2.rst:907 +#: ../../whatsnew/2.2.rst:908 msgid "To make the preceding explanation a bit clearer, here's an example::" msgstr "" -#: ../../whatsnew/2.2.rst:909 +#: ../../whatsnew/2.2.rst:910 msgid "" "x = 1\n" "def f():\n" @@ -1324,33 +1345,33 @@ msgid "" " return x" msgstr "" -#: ../../whatsnew/2.2.rst:916 +#: ../../whatsnew/2.2.rst:917 msgid "" "Line 4 containing the ``exec`` statement is a syntax error, since ``exec`` " "would define a new local variable named ``x`` whose value should be accessed " "by :func:`!g`." msgstr "" -#: ../../whatsnew/2.2.rst:920 +#: ../../whatsnew/2.2.rst:921 msgid "" "This shouldn't be much of a limitation, since ``exec`` is rarely used in " "most Python code (and when it is used, it's often a sign of a poor design " "anyway)." msgstr "" -#: ../../whatsnew/2.2.rst:927 +#: ../../whatsnew/2.2.rst:928 msgid ":pep:`227` - Statically Nested Scopes" msgstr "" -#: ../../whatsnew/2.2.rst:928 +#: ../../whatsnew/2.2.rst:929 msgid "Written and implemented by Jeremy Hylton." msgstr "" -#: ../../whatsnew/2.2.rst:934 +#: ../../whatsnew/2.2.rst:935 msgid "New and Improved Modules" msgstr "" -#: ../../whatsnew/2.2.rst:936 +#: ../../whatsnew/2.2.rst:937 msgid "" "The :mod:`xmlrpclib ` module was contributed to the standard " "library by Fredrik Lundh, providing support for writing XML-RPC clients. " @@ -1360,7 +1381,7 @@ msgid "" "channel::" msgstr "" -#: ../../whatsnew/2.2.rst:942 +#: ../../whatsnew/2.2.rst:943 msgid "" "import xmlrpclib\n" "s = xmlrpclib.Server(\n" @@ -1380,20 +1401,20 @@ msgid "" "# 'title': 'html2fo 0.3 (Default)'}, ... ]" msgstr "" -#: ../../whatsnew/2.2.rst:959 +#: ../../whatsnew/2.2.rst:960 msgid "" "The :mod:`SimpleXMLRPCServer ` module makes it easy to create " "straightforward XML-RPC servers. See http://xmlrpc.scripting.com/ for more " "information about XML-RPC." msgstr "" -#: ../../whatsnew/2.2.rst:962 +#: ../../whatsnew/2.2.rst:963 msgid "" "The new :mod:`hmac` module implements the HMAC algorithm described by :rfc:" "`2104`. (Contributed by Gerhard Häring.)" msgstr "" -#: ../../whatsnew/2.2.rst:965 +#: ../../whatsnew/2.2.rst:966 msgid "" "Several functions that originally returned lengthy tuples now return pseudo-" "sequences that still behave like tuples but also have mnemonic attributes " @@ -1404,7 +1425,7 @@ msgid "" "`time` module." msgstr "" -#: ../../whatsnew/2.2.rst:972 +#: ../../whatsnew/2.2.rst:973 msgid "" "For example, to obtain a file's size using the old tuples, you'd end up " "writing something like ``file_size = os.stat(filename)[stat.ST_SIZE]``, but " @@ -1412,25 +1433,25 @@ msgid "" "st_size``." msgstr "" -#: ../../whatsnew/2.2.rst:976 +#: ../../whatsnew/2.2.rst:977 msgid "The original patch for this feature was contributed by Nick Mathewson." msgstr "" -#: ../../whatsnew/2.2.rst:978 +#: ../../whatsnew/2.2.rst:979 msgid "" "The Python profiler has been extensively reworked and various errors in its " "output have been corrected. (Contributed by Fred L. Drake, Jr. and Tim " "Peters.)" msgstr "" -#: ../../whatsnew/2.2.rst:981 +#: ../../whatsnew/2.2.rst:982 msgid "" "The :mod:`socket` module can be compiled to support IPv6; specify the :" "option:`!--enable-ipv6` option to Python's configure script. (Contributed " "by Jun-ichiro \"itojun\" Hagino.)" msgstr "" -#: ../../whatsnew/2.2.rst:985 +#: ../../whatsnew/2.2.rst:986 msgid "" "Two new format characters were added to the :mod:`struct` module for 64-bit " "integers on platforms that support the C :c:expr:`long long` type. ``q`` is " @@ -1438,7 +1459,7 @@ msgid "" "returned in Python's long integer type. (Contributed by Tim Peters.)" msgstr "" -#: ../../whatsnew/2.2.rst:990 +#: ../../whatsnew/2.2.rst:991 msgid "" "In the interpreter's interactive mode, there's a new built-in function :func:" "`help` that uses the :mod:`pydoc` module introduced in Python 2.1 to provide " @@ -1449,7 +1470,7 @@ msgid "" "`pydoc` module.)" msgstr "" -#: ../../whatsnew/2.2.rst:998 +#: ../../whatsnew/2.2.rst:999 msgid "" "Various bugfixes and performance improvements have been made to the SRE " "engine underlying the :mod:`re` module. For example, the :func:`re.sub` " @@ -1460,7 +1481,7 @@ msgid "" "Fredrik Lundh. The BIGCHARSET patch was contributed by Martin von Löwis.)" msgstr "" -#: ../../whatsnew/2.2.rst:1006 +#: ../../whatsnew/2.2.rst:1007 msgid "" "The :mod:`smtplib` module now supports :rfc:`2487`, \"Secure SMTP over " "TLS\", so it's now possible to encrypt the SMTP traffic between a Python " @@ -1468,7 +1489,7 @@ msgid "" "also supports SMTP authentication. (Contributed by Gerhard Häring.)" msgstr "" -#: ../../whatsnew/2.2.rst:1011 +#: ../../whatsnew/2.2.rst:1012 msgid "" "The :mod:`imaplib` module, maintained by Piers Lauder, has support for " "several new extensions: the NAMESPACE extension defined in :rfc:`2342`, " @@ -1476,7 +1497,7 @@ msgid "" "Pelletier.)" msgstr "" -#: ../../whatsnew/2.2.rst:1015 +#: ../../whatsnew/2.2.rst:1016 msgid "" "The :mod:`!rfc822` module's parsing of email addresses is now compliant " "with :rfc:`2822`, an update to :rfc:`822`. (The module's name is *not* " @@ -1485,7 +1506,7 @@ msgid "" "Barry Warsaw, and arising out of his work on Mailman.)" msgstr "" -#: ../../whatsnew/2.2.rst:1021 +#: ../../whatsnew/2.2.rst:1022 msgid "" "The :mod:`difflib` module now contains a new :class:`!Differ` class for " "producing human-readable lists of changes (a \"delta\") between two " @@ -1496,7 +1517,7 @@ msgid "" "the generatorization.)" msgstr "" -#: ../../whatsnew/2.2.rst:1028 +#: ../../whatsnew/2.2.rst:1029 msgid "" "New constants :const:`!ascii_letters`, :const:`!ascii_lowercase`, and :const:" "`!ascii_uppercase` were added to the :mod:`string` module. There were " @@ -1508,25 +1529,25 @@ msgid "" "person; fixed by Fred L. Drake, Jr.)" msgstr "" -#: ../../whatsnew/2.2.rst:1037 +#: ../../whatsnew/2.2.rst:1038 msgid "" "The :mod:`mimetypes` module now makes it easier to use alternative MIME-type " "databases by the addition of a :class:`~mimetypes.MimeTypes` class, which " "takes a list of filenames to be parsed. (Contributed by Fred L. Drake, Jr.)" msgstr "" -#: ../../whatsnew/2.2.rst:1041 +#: ../../whatsnew/2.2.rst:1042 msgid "" "A :class:`~threading.Timer` class was added to the :mod:`threading` module " "that allows scheduling an activity to happen at some future time. " "(Contributed by Itamar Shtull-Trauring.)" msgstr "" -#: ../../whatsnew/2.2.rst:1049 +#: ../../whatsnew/2.2.rst:1050 msgid "Interpreter Changes and Fixes" msgstr "直譯器的變更與修正" -#: ../../whatsnew/2.2.rst:1051 +#: ../../whatsnew/2.2.rst:1052 msgid "" "Some of the changes only affect people who deal with the Python interpreter " "at the C level because they're writing Python extension modules, embedding " @@ -1535,7 +1556,7 @@ msgid "" "much." msgstr "" -#: ../../whatsnew/2.2.rst:1056 +#: ../../whatsnew/2.2.rst:1057 msgid "" "Profiling and tracing functions can now be implemented in C, which can " "operate at much higher speeds than Python-based functions and should reduce " @@ -1547,7 +1568,7 @@ msgid "" "(Contributed by Fred L. Drake, Jr.)" msgstr "" -#: ../../whatsnew/2.2.rst:1065 +#: ../../whatsnew/2.2.rst:1066 msgid "" "Another low-level API, primarily of interest to implementers of Python " "debuggers and development tools, was added. :c:func:" @@ -1558,7 +1579,7 @@ msgid "" "David Beazley.)" msgstr "" -#: ../../whatsnew/2.2.rst:1072 +#: ../../whatsnew/2.2.rst:1073 msgid "" "The C-level interface to the garbage collector has been changed to make it " "easier to write extension types that support garbage collection and to debug " @@ -1569,41 +1590,41 @@ msgid "" "priority." msgstr "" -#: ../../whatsnew/2.2.rst:1079 +#: ../../whatsnew/2.2.rst:1080 msgid "" "To upgrade an extension module to the new API, perform the following steps:" msgstr "" -#: ../../whatsnew/2.2.rst:1081 +#: ../../whatsnew/2.2.rst:1082 msgid "Rename :c:macro:`!Py_TPFLAGS_GC` to :c:macro:`Py_TPFLAGS_HAVE_GC`." msgstr "" "將 :c:macro:`!Py_TPFLAGS_GC` 重新命名為 :c:macro:`Py_TPFLAGS_HAVE_GC`。" -#: ../../whatsnew/2.2.rst:1083 +#: ../../whatsnew/2.2.rst:1084 msgid "" "Use :c:func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar` to allocate" msgstr "" -#: ../../whatsnew/2.2.rst:1084 +#: ../../whatsnew/2.2.rst:1085 msgid "objects, and :c:func:`PyObject_GC_Del` to deallocate them." msgstr "" -#: ../../whatsnew/2.2.rst:1086 +#: ../../whatsnew/2.2.rst:1087 msgid "" "Rename :c:func:`!PyObject_GC_Init` to :c:func:`PyObject_GC_Track` and :c:" "func:`!PyObject_GC_Fini` to :c:func:`PyObject_GC_UnTrack`." msgstr "" -#: ../../whatsnew/2.2.rst:1089 +#: ../../whatsnew/2.2.rst:1090 msgid "Remove :c:macro:`!PyGC_HEAD_SIZE` from object size calculations." msgstr "" -#: ../../whatsnew/2.2.rst:1091 +#: ../../whatsnew/2.2.rst:1092 msgid "" "Remove calls to :c:func:`!PyObject_AS_GC` and :c:func:`!PyObject_FROM_GC`." msgstr "" -#: ../../whatsnew/2.2.rst:1093 +#: ../../whatsnew/2.2.rst:1094 msgid "" "A new ``et`` format sequence was added to :c:func:`PyArg_ParseTuple`; ``et`` " "takes both a parameter and an encoding name, and converts the parameter to " @@ -1615,7 +1636,7 @@ msgid "" "and used for the MBCS support on Windows described in the following section.)" msgstr "" -#: ../../whatsnew/2.2.rst:1102 +#: ../../whatsnew/2.2.rst:1103 msgid "" "A different argument parsing function, :c:func:`PyArg_UnpackTuple`, has been " "added that's simpler and presumably faster. Instead of specifying a format " @@ -1624,7 +1645,7 @@ msgid "" "be filled in with argument values." msgstr "" -#: ../../whatsnew/2.2.rst:1108 +#: ../../whatsnew/2.2.rst:1109 msgid "" "Two new flags :c:macro:`METH_NOARGS` and :c:macro:`METH_O` are available in " "method definition tables to simplify implementation of methods with no " @@ -1634,7 +1655,7 @@ msgid "" "methods is now officially deprecated." msgstr "" -#: ../../whatsnew/2.2.rst:1114 +#: ../../whatsnew/2.2.rst:1115 msgid "" "Two new wrapper functions, :c:func:`PyOS_snprintf` and :c:func:" "`PyOS_vsnprintf` were added to provide cross-platform implementations for " @@ -1644,7 +1665,7 @@ msgid "" "protect against buffer overruns. (Contributed by M.-A. Lemburg.)" msgstr "" -#: ../../whatsnew/2.2.rst:1121 +#: ../../whatsnew/2.2.rst:1122 msgid "" "The :c:func:`_PyTuple_Resize` function has lost an unused parameter, so now " "it takes 2 parameters instead of 3. The third argument was never used, and " @@ -1652,11 +1673,11 @@ msgid "" "2.2." msgstr "" -#: ../../whatsnew/2.2.rst:1129 +#: ../../whatsnew/2.2.rst:1130 msgid "Other Changes and Fixes" msgstr "其他改動與修正" -#: ../../whatsnew/2.2.rst:1131 +#: ../../whatsnew/2.2.rst:1132 msgid "" "As usual there were a bunch of other improvements and bugfixes scattered " "throughout the source tree. A search through the CVS change logs finds " @@ -1665,18 +1686,18 @@ msgid "" "and fixed 82 bugs. These figures are likely to be underestimates." msgstr "" -#: ../../whatsnew/2.2.rst:1137 +#: ../../whatsnew/2.2.rst:1138 msgid "Some of the more notable changes are:" msgstr "一些較顯著的變更為:" -#: ../../whatsnew/2.2.rst:1139 +#: ../../whatsnew/2.2.rst:1140 msgid "" "The code for the MacOS port for Python, maintained by Jack Jansen, is now " "kept in the main Python CVS tree, and many changes have been made to support " "MacOS X." msgstr "" -#: ../../whatsnew/2.2.rst:1142 +#: ../../whatsnew/2.2.rst:1143 msgid "" "The most significant change is the ability to build Python as a framework, " "enabled by supplying the :option:`!--enable-framework` option to the " @@ -1690,7 +1711,7 @@ msgid "" "OSA scripting language and much more.\"" msgstr "" -#: ../../whatsnew/2.2.rst:1153 +#: ../../whatsnew/2.2.rst:1154 msgid "" "Most of the MacPython toolbox modules, which interface to MacOS APIs such as " "windowing, QuickTime, scripting, etc. have been ported to OS X, but they've " @@ -1698,14 +1719,14 @@ msgid "" "with these modules can uncomment them manually." msgstr "" -#: ../../whatsnew/2.2.rst:1176 +#: ../../whatsnew/2.2.rst:1177 msgid "" "Keyword arguments passed to built-in functions that don't take them now " "cause a :exc:`TypeError` exception to be raised, with the message " "\"*function* takes no keyword arguments\"." msgstr "" -#: ../../whatsnew/2.2.rst:1180 +#: ../../whatsnew/2.2.rst:1181 msgid "" "Weak references, added in Python 2.1 as an extension module, are now part of " "the core because they're used in the implementation of new-style classes. " @@ -1713,14 +1734,14 @@ msgid "" "`weakref` module to become a built-in exception." msgstr "" -#: ../../whatsnew/2.2.rst:1185 +#: ../../whatsnew/2.2.rst:1186 msgid "" "A new script, :file:`Tools/scripts/cleanfuture.py` by Tim Peters, " "automatically removes obsolete ``__future__`` statements from Python source " "code." msgstr "" -#: ../../whatsnew/2.2.rst:1189 +#: ../../whatsnew/2.2.rst:1190 msgid "" "An additional *flags* argument has been added to the built-in function :func:" "`compile`, so the behaviour of ``__future__`` statements can now be " @@ -1729,7 +1750,7 @@ msgid "" "(Contributed by Michael Hudson.)" msgstr "" -#: ../../whatsnew/2.2.rst:1195 +#: ../../whatsnew/2.2.rst:1196 msgid "" "The new license introduced with Python 1.6 wasn't GPL-compatible. This is " "fixed by some minor textual changes to the 2.2 license, so it's now legal to " @@ -1739,7 +1760,7 @@ msgid "" "to the Python 2.0.1 and 2.1.1 releases." msgstr "" -#: ../../whatsnew/2.2.rst:1202 +#: ../../whatsnew/2.2.rst:1203 msgid "" "When presented with a Unicode filename on Windows, Python will now convert " "it to an MBCS encoded string, as used by the Microsoft file APIs. As MBCS " @@ -1750,18 +1771,18 @@ msgid "" "Unix support was added by Martin von Löwis.)" msgstr "" -#: ../../whatsnew/2.2.rst:1210 +#: ../../whatsnew/2.2.rst:1211 msgid "" "Large file support is now enabled on Windows. (Contributed by Tim Peters.)" msgstr "" -#: ../../whatsnew/2.2.rst:1212 +#: ../../whatsnew/2.2.rst:1213 msgid "" "The :file:`Tools/scripts/ftpmirror.py` script now parses a :file:`.netrc` " "file, if you have one. (Contributed by Mike Romberg.)" msgstr "" -#: ../../whatsnew/2.2.rst:1215 +#: ../../whatsnew/2.2.rst:1216 msgid "" "Some features of the object returned by the :func:`!xrange` function are now " "deprecated, and trigger warnings when they're accessed; they'll disappear in " @@ -1774,7 +1795,7 @@ msgid "" "been deprecated." msgstr "" -#: ../../whatsnew/2.2.rst:1224 +#: ../../whatsnew/2.2.rst:1225 msgid "" "There were a bunch of patches to the dictionary implementation, mostly to " "fix potential core dumps if a dictionary contains objects that sneakily " @@ -1784,14 +1805,14 @@ msgid "" "case, and round and round it went." msgstr "" -#: ../../whatsnew/2.2.rst:1231 +#: ../../whatsnew/2.2.rst:1232 msgid "" "On Windows, Python can now be compiled with Borland C thanks to a number of " "patches contributed by Stephen Hansen, though the result isn't fully " "functional yet. (But this *is* progress...)" msgstr "" -#: ../../whatsnew/2.2.rst:1235 +#: ../../whatsnew/2.2.rst:1236 msgid "" "Another Windows enhancement: Wise Solutions generously offered PythonLabs " "use of their InstallerMaster 8.1 system. Earlier PythonLabs Windows " @@ -1799,7 +1820,7 @@ msgid "" "up by Tim Peters.)" msgstr "" -#: ../../whatsnew/2.2.rst:1239 +#: ../../whatsnew/2.2.rst:1240 msgid "" "Files ending in ``.pyw`` can now be imported on Windows. ``.pyw`` is a " "Windows-only thing, used to indicate that a script needs to be run using " @@ -1809,7 +1830,7 @@ msgid "" "Bolen.)" msgstr "" -#: ../../whatsnew/2.2.rst:1245 +#: ../../whatsnew/2.2.rst:1246 msgid "" "On platforms where Python uses the C :c:func:`dlopen` function to load " "extension modules, it's now possible to set the flags used by :c:func:" @@ -1817,7 +1838,7 @@ msgid "" "functions. (Contributed by Bram Stolk.)" msgstr "" -#: ../../whatsnew/2.2.rst:1250 +#: ../../whatsnew/2.2.rst:1251 msgid "" "The :func:`pow` built-in function no longer supports 3 arguments when " "floating-point numbers are supplied. ``pow(x, y, z)`` returns ``(x**y) % " @@ -1826,11 +1847,11 @@ msgid "" "``pow(2.0, 8.0, 7.0)`` will now raise a :exc:`TypeError` exception." msgstr "" -#: ../../whatsnew/2.2.rst:1260 +#: ../../whatsnew/2.2.rst:1261 msgid "Acknowledgements" msgstr "致謝" -#: ../../whatsnew/2.2.rst:1262 +#: ../../whatsnew/2.2.rst:1263 msgid "" "The author would like to thank the following people for offering " "suggestions, corrections and assistance with various drafts of this article: " diff --git a/whatsnew/2.3.po b/whatsnew/2.3.po index 6e32c82426..3173149b94 100644 --- a/whatsnew/2.3.po +++ b/whatsnew/2.3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -874,9 +874,9 @@ msgstr "" msgid "" "When encoding a Unicode string into a byte string, unencodable characters " "may be encountered. So far, Python has allowed specifying the error " -"processing as either \"strict\" (raising :exc:`UnicodeError`), \"ignore\" " -"(skipping the character), or \"replace\" (using a question mark in the " -"output string), with \"strict\" being the default behavior. It may be " +"processing as either \"strict\" (raising :exc:`UnicodeError`), " +"\"ignore\" (skipping the character), or \"replace\" (using a question mark " +"in the output string), with \"strict\" being the default behavior. It may be " "desirable to specify alternative processing of such errors, such as " "inserting an XML character reference or HTML entity reference into the " "converted string." @@ -1663,11 +1663,11 @@ msgstr "" #: ../../whatsnew/2.3.rst:1115 msgid "" "One of the noted incompatibilities between old- and new-style classes has " -"been removed: you can now assign to the :attr:`~definition.__name__` and :" -"attr:`~class.__bases__` attributes of new-style classes. There are some " -"restrictions on what can be assigned to :attr:`~class.__bases__` along the " -"lines of those relating to assigning to an instance's :attr:`~instance." -"__class__` attribute." +"been removed: you can now assign to the :attr:`~type.__name__` and :attr:" +"`~type.__bases__` attributes of new-style classes. There are some " +"restrictions on what can be assigned to :attr:`!__bases__` along the lines " +"of those relating to assigning to an instance's :attr:`~object.__class__` " +"attribute." msgstr "" #: ../../whatsnew/2.3.rst:1125 @@ -2892,8 +2892,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1927 msgid "" "If you dynamically allocate type objects in your extension, you should be " -"aware of a change in the rules relating to the :attr:`!__module__` and :attr:" -"`~definition.__name__` attributes. In summary, you will want to ensure the " +"aware of a change in the rules relating to the :attr:`~type.__module__` and :" +"attr:`~type.__name__` attributes. In summary, you will want to ensure the " "type's dictionary contains a ``'__module__'`` key; making the module name " "the part of the type name leading up to the final period will no longer have " "the desired effect. For more detail, read the API reference documentation " diff --git a/whatsnew/3.1.po b/whatsnew/3.1.po index c931bef0cf..df59f43bf2 100644 --- a/whatsnew/3.1.po +++ b/whatsnew/3.1.po @@ -34,6 +34,8 @@ msgid "" "This article explains the new features in Python 3.1, compared to 3.0. " "Python 3.1 was released on June 27, 2009." msgstr "" +"本文介紹了 Python 3.1 與 3.0 相比的新功能。Python 3.1 已於 2009 年 6 月 27 日" +"發布。" #: ../../whatsnew/3.1.rst:54 msgid "PEP 372: Ordered Dictionaries" @@ -912,7 +914,7 @@ msgstr "(由 Larry Hastings 貢獻;:issue:`5630`。)" #: ../../whatsnew/3.1.rst:548 msgid "Porting to Python 3.1" -msgstr "" +msgstr "移植至 Python 3.1" #: ../../whatsnew/3.1.rst:550 msgid "" diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index d81741b506..ee2fe63fc7 100644 --- a/whatsnew/3.10.po +++ b/whatsnew/3.10.po @@ -35,12 +35,12 @@ msgid "" "Python 3.10 was released on October 4, 2021. For full details, see the :ref:" "`changelog `." msgstr "" -"本文介紹了 Python 3.10 與 3.9 相比的新功能。Python 3.10 於 2021 年 10 月 4 日" -"發布。有關完整詳細資訊,請參閱 :ref:`changelog `。" +"本文介紹了 Python 3.10 與 3.9 相比多了哪些新功能。Python 3.10 已於 2021 年 " +"10 月 4 日發布。有關完整詳細資訊,請參閱 :ref:`changelog `。" #: ../../whatsnew/3.10.rst:52 msgid "Summary -- Release highlights" -msgstr "摘要 -- 發布重點" +msgstr "發布重點摘要" #: ../../whatsnew/3.10.rst:60 msgid "New syntax features:" @@ -127,7 +127,7 @@ msgstr ":pep:`597`,新增可選的 EncodingWarning" #: ../../whatsnew/3.10.rst:92 ../../whatsnew/3.10.rst:2053 msgid "New Features" -msgstr "新功能" +msgstr "新增功能" #: ../../whatsnew/3.10.rst:97 msgid "Parenthesized context managers" diff --git a/whatsnew/3.11.po b/whatsnew/3.11.po index ee765c9437..0d18eb3a67 100644 --- a/whatsnew/3.11.po +++ b/whatsnew/3.11.po @@ -36,7 +36,7 @@ msgid "" "Python 3.11 was released on October 24, 2022. For full details, see the :ref:" "`changelog `." msgstr "" -"此文章解釋了 Python 3.11 和 3.10 相比多了哪些新特性。Python 3.11 於 2022 年 " +"此文章解釋了 Python 3.11 和 3.10 相比多了哪些新功能。Python 3.11 於 2022 年 " "10 月 24 日發布。完整細節請見 :ref:`changelog`。" #: ../../whatsnew/3.11.rst:55 @@ -63,7 +63,7 @@ msgstr ":ref:`whatsnew311-pep654`" #: ../../whatsnew/3.11.rst:70 msgid "New built-in features:" -msgstr "新增內建特性:" +msgstr "新的內建功能:" #: ../../whatsnew/3.11.rst:72 msgid ":ref:`whatsnew311-pep678`" @@ -149,7 +149,7 @@ msgstr ":pep:`670`::ref:`轉換為靜態行內函式的巨集 \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,8 +34,8 @@ msgid "" "Python 3.12 was released on October 2, 2023. For full details, see the :ref:" "`changelog `." msgstr "" -"本文介紹了 Python 3.12 與 3.11 相比的新功能。 Python 3.12 於 2023 年 10 月 2 " -"日發布。完整詳請請見 :ref:`changelog `。" +"本文介紹了 Python 3.12 與 3.11 相比多了哪些新功能。 Python 3.12 於 2023 年 " +"10 月 2 日發布。完整詳請請見 :ref:`changelog `。" #: ../../whatsnew/3.12.rst:54 msgid ":pep:`693` -- Python 3.12 Release Schedule" @@ -129,7 +129,7 @@ msgstr "" #: ../../whatsnew/3.12.rst:111 msgid "Significant improvements in the standard library:" -msgstr "" +msgstr "標準函式庫中的顯著改進" #: ../../whatsnew/3.12.rst:113 msgid "The :class:`pathlib.Path` class now supports subclassing" @@ -267,7 +267,7 @@ msgstr "" #: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1825 msgid "New Features" -msgstr "新增特性" +msgstr "新增功能" #: ../../whatsnew/3.12.rst:181 msgid "PEP 695: Type Parameter Syntax" @@ -1844,37 +1844,37 @@ msgid "" msgstr ":mod:`importlib.abc`:棄用下列類別,預定於 Python 3.14 中移除:" #: ../../whatsnew/3.12.rst:1205 -#: ../../deprecations/pending-removal-in-3.14.rst:55 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" #: ../../whatsnew/3.12.rst:1206 -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" #: ../../whatsnew/3.12.rst:1207 -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" #: ../../whatsnew/3.12.rst:1209 -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" #: ../../whatsnew/3.12.rst:1211 -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" #: ../../whatsnew/3.12.rst:1212 -#: ../../deprecations/pending-removal-in-3.14.rst:62 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" #: ../../whatsnew/3.12.rst:1214 -#: ../../deprecations/pending-removal-in-3.14.rst:64 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" @@ -1958,7 +1958,7 @@ msgstr "" "*onexc*。(由 Irit Katriel 於 :gh:`102828` 中貢獻。)" #: ../../whatsnew/3.12.rst:1267 -#: ../../deprecations/pending-removal-in-3.14.rst:94 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" @@ -1994,7 +1994,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.12.rst:1290 -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:53 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" @@ -2281,18 +2281,10 @@ msgstr "" "Alan Williams 於 :gh:`72346` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:50 -msgid "" -":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " -"taken into consideration by the import system (:gh:`97879`)." -msgstr "" -":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " -"系統考慮。 (:gh:`97879`)" - -#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -2303,7 +2295,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:72 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -2320,7 +2312,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:80 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -2328,7 +2320,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -2338,23 +2330,23 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:92 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -2364,7 +2356,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" "date and datetime adapter, date and timestamp converter: see the :mod:" "`sqlite3` documentation for suggested replacement recipes." @@ -2372,7 +2364,7 @@ msgstr "" "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" "參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" -#: ../../deprecations/pending-removal-in-3.14.rst:105 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -2384,7 +2376,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:112 +#: ../../deprecations/pending-removal-in-3.14.rst:109 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -2392,7 +2384,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:115 +#: ../../deprecations/pending-removal-in-3.14.rst:112 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -2440,10 +2432,18 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:20 +msgid "" +":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " +"taken into consideration by the import system (:gh:`97879`)." +msgstr "" +":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " +"系統考慮。 (:gh:`97879`)" + +#: ../../deprecations/pending-removal-in-3.15.rst:23 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:22 +#: ../../deprecations/pending-removal-in-3.15.rst:25 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" @@ -2456,11 +2456,11 @@ msgstr "" "`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." "getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:30 +#: ../../deprecations/pending-removal-in-3.15.rst:33 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-3.15.rst:35 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows." @@ -2468,11 +2468,11 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." "isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:36 +#: ../../deprecations/pending-removal-in-3.15.rst:39 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:38 +#: ../../deprecations/pending-removal-in-3.15.rst:41 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -2481,11 +2481,11 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:45 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:47 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -2496,7 +2496,7 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:52 +#: ../../deprecations/pending-removal-in-3.15.rst:55 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -2507,7 +2507,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:58 +#: ../../deprecations/pending-removal-in-3.15.rst:61 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -2517,11 +2517,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:63 +#: ../../deprecations/pending-removal-in-3.15.rst:66 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:65 +#: ../../deprecations/pending-removal-in-3.15.rst:68 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -3702,7 +3702,7 @@ msgstr "" #: ../../whatsnew/3.12.rst:1663 ../../whatsnew/3.12.rst:1987 msgid "Porting to Python 3.12" -msgstr "" +msgstr "移植至 Python 3.12" #: ../../whatsnew/3.12.rst:1665 msgid "" @@ -4094,8 +4094,8 @@ msgstr "" msgid "" "The :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows extensions " -"classes to support object ``__dict__`` and weakrefs with less bookkeeping, " -"using less memory and with faster access." +"classes to support object :attr:`~object.__dict__` and weakrefs with less " +"bookkeeping, using less memory and with faster access." msgstr "" #: ../../whatsnew/3.12.rst:1893 @@ -4304,7 +4304,7 @@ msgstr "" #: ../../whatsnew/3.12.rst:2008 msgid "" -"To get a list of subclasses, call the Python method :py:meth:`~class." +"To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__` (using :c:func:`PyObject_CallMethod`, for example)." msgstr "" @@ -4334,8 +4334,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:2028 msgid "" -"Extension classes wanting to add a ``__dict__`` or weak reference slot " -"should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" +"Extension classes wanting to add a :attr:`~object.__dict__` or weak " +"reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and " "``tp_weaklistoffset``, respectively. The use of ``tp_dictoffset`` and " "``tp_weaklistoffset`` is still supported, but does not fully support " diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index 22c2f71389..48215f745d 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 15:56+0800\n" +"POT-Creation-Date: 2024-10-05 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,9 +31,11 @@ msgstr "Adam Turner 和 Thomas Wouters" #: ../../whatsnew/3.13.rst:48 msgid "" "This article explains the new features in Python 3.13, compared to 3.12. " -"Python 3.13 will be released on October 1, 2024. For full details, see the :" +"Python 3.13 will be released on October 7, 2024. For full details, see the :" "ref:`changelog `." msgstr "" +"本文介紹了 Python 3.13 與 3.12 相比多了哪些新功能。Python 3.13 將於 2024 年 " +"10 月 7 日發布。完整詳請請見 :ref:`changelog `。" #: ../../whatsnew/3.13.rst:54 msgid ":pep:`719` -- Python 3.13 Release Schedule" @@ -131,157 +133,158 @@ msgstr "Python 資料模型改進:" #: ../../whatsnew/3.13.rst:124 msgid "" -":attr:`~class.__static_attributes__` stores the names of attributes accessed " +":attr:`~type.__static_attributes__` stores the names of attributes accessed " "through ``self.X`` in any function in a class body." msgstr "" #: ../../whatsnew/3.13.rst:126 msgid "" -":attr:`!__firstlineno__` records the first line number of a class definition." +":attr:`~type.__firstlineno__` records the first line number of a class " +"definition." msgstr "" -#: ../../whatsnew/3.13.rst:128 +#: ../../whatsnew/3.13.rst:129 msgid "Significant improvements in the standard library:" -msgstr "" +msgstr "標準函式庫中的顯著改進" -#: ../../whatsnew/3.13.rst:130 +#: ../../whatsnew/3.13.rst:131 msgid "" "Add a new :exc:`PythonFinalizationError` exception, raised when an operation " "is blocked during :term:`finalization `." msgstr "" -#: ../../whatsnew/3.13.rst:132 +#: ../../whatsnew/3.13.rst:133 msgid "" "The :mod:`argparse` module now supports deprecating command-line options, " "positional arguments, and subcommands." msgstr "" -#: ../../whatsnew/3.13.rst:134 +#: ../../whatsnew/3.13.rst:135 msgid "" "The new functions :func:`base64.z85encode` and :func:`base64.z85decode` " "support encoding and decoding `Z85 data`_." msgstr "" -#: ../../whatsnew/3.13.rst:136 +#: ../../whatsnew/3.13.rst:137 msgid "" "The :mod:`copy` module now has a :func:`copy.replace` function, with support " "for many builtin types and any class defining the :func:`~object." "__replace__` method." msgstr "" -#: ../../whatsnew/3.13.rst:139 +#: ../../whatsnew/3.13.rst:140 msgid "" "The new :mod:`dbm.sqlite3` module is now the default :mod:`dbm` backend." -msgstr "" +msgstr "新的 :mod:`dbm.sqlite3` 模組現在是預設的 :mod:`dbm` 後端。" -#: ../../whatsnew/3.13.rst:140 +#: ../../whatsnew/3.13.rst:141 msgid "" "The :mod:`os` module has a :ref:`suite of new functions ` for " "working with Linux's timer notification file descriptors." msgstr "" -#: ../../whatsnew/3.13.rst:142 +#: ../../whatsnew/3.13.rst:143 msgid "" "The :mod:`random` module now has a :ref:`command-line interface `." -msgstr "" +msgstr "現在 :mod:`random` 模組有一個\\ :ref:`命令列介面 `。" -#: ../../whatsnew/3.13.rst:144 +#: ../../whatsnew/3.13.rst:145 msgid "Security improvements:" msgstr "安全性改進:" -#: ../../whatsnew/3.13.rst:146 +#: ../../whatsnew/3.13.rst:147 msgid "" ":func:`ssl.create_default_context` sets :data:`ssl." "VERIFY_X509_PARTIAL_CHAIN` and :data:`ssl.VERIFY_X509_STRICT` as default " "flags." msgstr "" -#: ../../whatsnew/3.13.rst:149 +#: ../../whatsnew/3.13.rst:150 msgid "C API improvements:" msgstr "C API 改進:" -#: ../../whatsnew/3.13.rst:151 +#: ../../whatsnew/3.13.rst:152 msgid "" "The :c:data:`Py_mod_gil` slot is now used to indicate that an extension " "module supports running with the :term:`GIL` disabled." msgstr "" -#: ../../whatsnew/3.13.rst:153 +#: ../../whatsnew/3.13.rst:154 msgid "" "The :doc:`PyTime C API ` has been added, providing access to " "system clocks." msgstr "" -#: ../../whatsnew/3.13.rst:155 +#: ../../whatsnew/3.13.rst:156 msgid "" ":c:type:`PyMutex` is a new lightweight mutex that occupies a single byte." msgstr "" -#: ../../whatsnew/3.13.rst:156 +#: ../../whatsnew/3.13.rst:157 msgid "" "There is a new :ref:`suite of functions ` for generating :" "pep:`669` monitoring events in the C API." msgstr "" -#: ../../whatsnew/3.13.rst:159 +#: ../../whatsnew/3.13.rst:160 msgid "New typing features:" msgstr "新增型別特性:" -#: ../../whatsnew/3.13.rst:161 +#: ../../whatsnew/3.13.rst:162 msgid "" ":pep:`696`: Type parameters (:data:`typing.TypeVar`, :data:`typing." "ParamSpec`, and :data:`typing.TypeVarTuple`) now support defaults." msgstr "" -#: ../../whatsnew/3.13.rst:163 +#: ../../whatsnew/3.13.rst:164 msgid "" ":pep:`702`: The new :func:`warnings.deprecated` decorator adds support for " "marking deprecations in the type system and at runtime." msgstr "" -#: ../../whatsnew/3.13.rst:165 +#: ../../whatsnew/3.13.rst:166 msgid "" ":pep:`705`: :data:`typing.ReadOnly` can be used to mark an item of a :class:" "`typing.TypedDict` as read-only for type checkers." msgstr "" -#: ../../whatsnew/3.13.rst:167 +#: ../../whatsnew/3.13.rst:168 msgid "" ":pep:`742`: :data:`typing.TypeIs` provides more intuitive type narrowing " "behavior, as an alternative to :data:`typing.TypeGuard`." msgstr "" -#: ../../whatsnew/3.13.rst:170 +#: ../../whatsnew/3.13.rst:171 msgid "Platform support:" -msgstr "" +msgstr "平台支援:" -#: ../../whatsnew/3.13.rst:172 +#: ../../whatsnew/3.13.rst:173 msgid "" ":pep:`730`: Apple's iOS is now an :ref:`officially supported platform " "`, at :pep:`tier 3 <11#tier-3>`." msgstr "" -#: ../../whatsnew/3.13.rst:174 +#: ../../whatsnew/3.13.rst:175 msgid "" ":pep:`738`: Android is now an :ref:`officially supported platform " "`, at :pep:`tier 3 <11#tier-3>`." msgstr "" -#: ../../whatsnew/3.13.rst:176 +#: ../../whatsnew/3.13.rst:177 msgid "" "``wasm32-wasi`` is now supported as a :pep:`tier 2 <11#tier-2>` platform." -msgstr "" +msgstr "``wasm32-wasi`` 現在作為 :pep:`tier 2 <11#tier-2>` 平台支援。" -#: ../../whatsnew/3.13.rst:177 +#: ../../whatsnew/3.13.rst:178 msgid "``wasm32-emscripten`` is no longer an officially supported platform." -msgstr "" +msgstr "``wasm32-emscripten`` 不再是官方支援的平台。" -#: ../../whatsnew/3.13.rst:179 +#: ../../whatsnew/3.13.rst:180 msgid "Important removals:" -msgstr "" +msgstr "重要的移除:" -#: ../../whatsnew/3.13.rst:181 +#: ../../whatsnew/3.13.rst:182 msgid "" ":ref:`PEP 594 `: The remaining 19 \"dead batteries\" " "(legacy stdlib modules) have been removed from the standard library: :mod:`!" @@ -290,118 +293,124 @@ msgid "" "nntplib`, :mod:`!ossaudiodev`, :mod:`!pipes`, :mod:`!sndhdr`, :mod:`!spwd`, :" "mod:`!sunau`, :mod:`!telnetlib`, :mod:`!uu` and :mod:`!xdrlib`." msgstr "" +":ref:`PEP 594 `: 剩下的 19 個 \"dead batteries\" (遺留標" +"準函式庫模組)以字標準函式庫中移除::mod:`!aifc`、:mod:`!audioop`、:mod:`!" +"cgi`、:mod:`!cgitb`、:mod:`!chunk`、:mod:`!crypt`、:mod:`!imghdr`、:mod:`!" +"mailcap`、:mod:`!msilib`、:mod:`!nis`、:mod:`!nntplib`、:mod:`!" +"ossaudiodev`、:mod:`!pipes`、:mod:`!sndhdr`、:mod:`!spwd`、:mod:`!sunau`、:" +"mod:`!telnetlib`、:mod:`!uu` 和 :mod:`!xdrlib`." -#: ../../whatsnew/3.13.rst:187 +#: ../../whatsnew/3.13.rst:188 msgid "" "Remove the :program:`2to3` tool and :mod:`!lib2to3` module (deprecated in " "Python 3.11)." msgstr "" -#: ../../whatsnew/3.13.rst:189 +#: ../../whatsnew/3.13.rst:190 msgid "Remove the :mod:`!tkinter.tix` module (deprecated in Python 3.6)." -msgstr "" +msgstr "移除 :mod:`!tkinter.tix` 模組(在 Python 3.6 中已棄用)。" -#: ../../whatsnew/3.13.rst:190 +#: ../../whatsnew/3.13.rst:191 msgid "Remove the :func:`!locale.resetlocale` function." -msgstr "" +msgstr "移除 :func:`!locale.resetlocale` 函式。" -#: ../../whatsnew/3.13.rst:191 +#: ../../whatsnew/3.13.rst:192 msgid "Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces." -msgstr "" +msgstr "移除 :mod:`!typing.io` 和 :mod:`!typing.re` 命名空間。" -#: ../../whatsnew/3.13.rst:192 +#: ../../whatsnew/3.13.rst:193 msgid "Remove chained :class:`classmethod` descriptors." msgstr "" -#: ../../whatsnew/3.13.rst:194 +#: ../../whatsnew/3.13.rst:195 msgid "Release schedule changes:" msgstr "" -#: ../../whatsnew/3.13.rst:196 +#: ../../whatsnew/3.13.rst:197 msgid "" ":pep:`602` (\"Annual Release Cycle for Python\") has been updated to extend " "the full support ('bugfix') period for new releases to two years. This " "updated policy means that:" msgstr "" -#: ../../whatsnew/3.13.rst:200 +#: ../../whatsnew/3.13.rst:201 msgid "" "Python 3.9--3.12 have one and a half years of full support, followed by " "three and a half years of security fixes." msgstr "" -#: ../../whatsnew/3.13.rst:202 +#: ../../whatsnew/3.13.rst:203 msgid "" "Python 3.13 and later have two years of full support, followed by three " "years of security fixes." msgstr "" -#: ../../whatsnew/3.13.rst:207 ../../whatsnew/3.13.rst:2005 +#: ../../whatsnew/3.13.rst:208 ../../whatsnew/3.13.rst:1964 msgid "New Features" -msgstr "新增特性" +msgstr "新增功能" -#: ../../whatsnew/3.13.rst:213 +#: ../../whatsnew/3.13.rst:214 msgid "A better interactive interpreter" msgstr "" -#: ../../whatsnew/3.13.rst:215 +#: ../../whatsnew/3.13.rst:216 msgid "" "Python now uses a new :term:`interactive` shell by default, based on code " "from the `PyPy project`_. When the user starts the :term:`REPL` from an " "interactive terminal, the following new features are now supported:" msgstr "" -#: ../../whatsnew/3.13.rst:220 +#: ../../whatsnew/3.13.rst:221 msgid "Multiline editing with history preservation." msgstr "" -#: ../../whatsnew/3.13.rst:221 +#: ../../whatsnew/3.13.rst:222 msgid "" "Direct support for REPL-specific commands like :kbd:`help`, :kbd:`exit`, " "and :kbd:`quit`, without the need to call them as functions." msgstr "" -#: ../../whatsnew/3.13.rst:223 +#: ../../whatsnew/3.13.rst:224 msgid "" "Prompts and tracebacks with :ref:`color enabled by default `." msgstr "" -#: ../../whatsnew/3.13.rst:225 +#: ../../whatsnew/3.13.rst:226 msgid "" "Interactive help browsing using :kbd:`F1` with a separate command history." msgstr "" -#: ../../whatsnew/3.13.rst:227 +#: ../../whatsnew/3.13.rst:228 msgid "" "History browsing using :kbd:`F2` that skips output as well as the :term:" "`>>>` and :term:`...` prompts." msgstr "" -#: ../../whatsnew/3.13.rst:229 +#: ../../whatsnew/3.13.rst:230 msgid "" "\"Paste mode\" with :kbd:`F3` that makes pasting larger blocks of code " "easier (press :kbd:`F3` again to return to the regular prompt)." msgstr "" -#: ../../whatsnew/3.13.rst:232 +#: ../../whatsnew/3.13.rst:233 msgid "" "To disable the new interactive shell, set the :envvar:`PYTHON_BASIC_REPL` " "environment variable. For more on interactive mode, see :ref:`tut-interac`." msgstr "" -#: ../../whatsnew/3.13.rst:236 +#: ../../whatsnew/3.13.rst:237 msgid "" "(Contributed by Pablo Galindo Salgado, Łukasz Langa, and Lysandros Nikolaou " "in :gh:`111201` based on code from the PyPy project. Windows support " "contributed by Dino Viehland and Anthony Shaw.)" msgstr "" -#: ../../whatsnew/3.13.rst:246 +#: ../../whatsnew/3.13.rst:247 msgid "Improved error messages" msgstr "" -#: ../../whatsnew/3.13.rst:248 +#: ../../whatsnew/3.13.rst:249 msgid "" "The interpreter now uses color by default when displaying tracebacks in the " "terminal. This feature :ref:`can be controlled ` " @@ -410,14 +419,14 @@ msgid "" "by Pablo Galindo Salgado in :gh:`112730`.)" msgstr "" -#: ../../whatsnew/3.13.rst:263 +#: ../../whatsnew/3.13.rst:264 msgid "" "A common mistake is to write a script with the same name as a standard " "library module. When this results in errors, we now display a more helpful " "error message:" msgstr "" -#: ../../whatsnew/3.13.rst:267 +#: ../../whatsnew/3.13.rst:268 msgid "" "$ python random.py\n" "Traceback (most recent call last):\n" @@ -430,15 +439,25 @@ msgid "" "renaming '/home/me/random.py' since it has the same name as the standard " "library module named 'random' and the import system gives it precedence)" msgstr "" +"$ python random.py\n" +"Traceback (most recent call last):\n" +" File \"/home/me/random.py\", line 1, in \n" +" import random\n" +" File \"/home/me/random.py\", line 3, in \n" +" print(random.randint(5))\n" +" ^^^^^^^^^^^^^^\n" +"AttributeError: module 'random' has no attribute 'randint' (consider " +"renaming '/home/me/random.py' since it has the same name as the standard " +"library module named 'random' and the import system gives it precedence)" -#: ../../whatsnew/3.13.rst:278 +#: ../../whatsnew/3.13.rst:279 msgid "" "Similarly, if a script has the same name as a third-party module that it " "attempts to import and this results in errors, we also display a more " "helpful error message:" msgstr "" -#: ../../whatsnew/3.13.rst:282 +#: ../../whatsnew/3.13.rst:283 msgid "" "$ python numpy.py\n" "Traceback (most recent call last):\n" @@ -451,18 +470,28 @@ msgid "" "home/me/numpy.py' if it has the same name as a third-party module you " "intended to import)" msgstr "" +"$ python numpy.py\n" +"Traceback (most recent call last):\n" +" File \"/home/me/numpy.py\", line 1, in \n" +" import numpy as np\n" +" File \"/home/me/numpy.py\", line 3, in \n" +" np.array([1, 2, 3])\n" +" ^^^^^^^^\n" +"AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/" +"home/me/numpy.py' if it has the same name as a third-party module you " +"intended to import)" -#: ../../whatsnew/3.13.rst:293 +#: ../../whatsnew/3.13.rst:294 msgid "(Contributed by Shantanu Jain in :gh:`95754`.)" msgstr "" -#: ../../whatsnew/3.13.rst:295 +#: ../../whatsnew/3.13.rst:296 msgid "" "The error message now tries to suggest the correct keyword argument when an " "incorrect keyword argument is passed to a function." msgstr "" -#: ../../whatsnew/3.13.rst:298 +#: ../../whatsnew/3.13.rst:299 msgid "" ">>> \"Better error messages!\".split(max_split=1)\n" "Traceback (most recent call last):\n" @@ -472,17 +501,24 @@ msgid "" "TypeError: split() got an unexpected keyword argument 'max_split'. Did you " "mean 'maxsplit'?" msgstr "" +">>> \"Better error messages!\".split(max_split=1)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" \"Better error messages!\".split(max_split=1)\n" +" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^\n" +"TypeError: split() got an unexpected keyword argument 'max_split'. Did you " +"mean 'maxsplit'?" -#: ../../whatsnew/3.13.rst:307 +#: ../../whatsnew/3.13.rst:308 msgid "" "(Contributed by Pablo Galindo Salgado and Shantanu Jain in :gh:`107944`.)" msgstr "" -#: ../../whatsnew/3.13.rst:313 +#: ../../whatsnew/3.13.rst:314 msgid "Free-threaded CPython" msgstr "" -#: ../../whatsnew/3.13.rst:315 +#: ../../whatsnew/3.13.rst:316 msgid "" "CPython now has experimental support for running in a free-threaded mode, " "with the :term:`global interpreter lock` (GIL) disabled. This is an " @@ -490,12 +526,12 @@ msgid "" "threaded mode requires a different executable, usually called " "``python3.13t`` or ``python3.13t.exe``. Pre-built binaries marked as *free-" "threaded* can be installed as part of the official :ref:`Windows ` and :ref:`macOS ` " +"freethreaded-windows>` and :ref:`macOS ` " "installers, or CPython can be built from source with the :option:`--disable-" "gil` option." msgstr "" -#: ../../whatsnew/3.13.rst:328 +#: ../../whatsnew/3.13.rst:326 msgid "" "Free-threaded execution allows for full utilization of the available " "processing power by running threads in parallel on available CPU cores. " @@ -508,7 +544,7 @@ msgid "" "command-line option :option:`-X gil=1`." msgstr "" -#: ../../whatsnew/3.13.rst:338 +#: ../../whatsnew/3.13.rst:336 msgid "" "To check if the current interpreter supports free-threading, :option:`python " "-VV <-V>` and :attr:`sys.version` contain \"experimental free-threading " @@ -516,7 +552,7 @@ msgid "" "whether the GIL is actually disabled in the running process." msgstr "" -#: ../../whatsnew/3.13.rst:343 +#: ../../whatsnew/3.13.rst:341 msgid "" "C-API extension modules need to be built specifically for the free-threaded " "build. Extensions that support running with the :term:`GIL` disabled should " @@ -529,24 +565,35 @@ msgid "" "extensions in the free-threaded build." msgstr "" -#: ../../whatsnew/3.13.rst:356 +#: ../../whatsnew/3.13.rst:352 +msgid "" +"This work was made possible thanks to many individuals and organizations, " +"including the large community of contributors to Python and third-party " +"projects to test and enable free-threading support. Notable contributors " +"include: Sam Gross, Ken Jin, Donghee Na, Itamar Oren, Matt Page, Brett " +"Simmers, Dino Viehland, Carl Meyer, Nathan Goldbaum, Ralf Gommers, Lysandros " +"Nikolaou, and many others. Many of these contributors are employed by Meta, " +"which has provided significant engineering resources to support this project." +msgstr "" + +#: ../../whatsnew/3.13.rst:364 msgid "" ":pep:`703` \"Making the Global Interpreter Lock Optional in CPython\" " "contains rationale and information surrounding this work." msgstr "" -#: ../../whatsnew/3.13.rst:359 +#: ../../whatsnew/3.13.rst:367 msgid "" "`Porting Extension Modules to Support Free-Threading `_: A community-maintained porting guide for " "extension authors." msgstr "" -#: ../../whatsnew/3.13.rst:367 +#: ../../whatsnew/3.13.rst:375 msgid "An experimental just-in-time (JIT) compiler" msgstr "" -#: ../../whatsnew/3.13.rst:369 +#: ../../whatsnew/3.13.rst:377 msgid "" "When CPython is configured and built using the :option:`!--enable-" "experimental-jit` option, a just-in-time (JIT) compiler is added which may " @@ -556,100 +603,100 @@ msgid "" "information `are contained at`__ :file:`Tools/jit/README.md`." msgstr "" -#: ../../whatsnew/3.13.rst:379 +#: ../../whatsnew/3.13.rst:387 msgid "" "The :option:`!--enable-experimental-jit` option takes these (optional) " "values, defaulting to ``yes`` if :option:`!--enable-experimental-jit` is " "present without the optional value." msgstr "" -#: ../../whatsnew/3.13.rst:383 +#: ../../whatsnew/3.13.rst:391 msgid "``no``: Disable the entire Tier 2 and JIT pipeline." msgstr "" -#: ../../whatsnew/3.13.rst:384 +#: ../../whatsnew/3.13.rst:392 msgid "" "``yes``: Enable the JIT. To disable the JIT at runtime, pass the environment " "variable ``PYTHON_JIT=0``." msgstr "" -#: ../../whatsnew/3.13.rst:386 +#: ../../whatsnew/3.13.rst:394 msgid "" "``yes-off``: Build the JIT but disable it by default. To enable the JIT at " "runtime, pass the environment variable ``PYTHON_JIT=1``." msgstr "" -#: ../../whatsnew/3.13.rst:388 +#: ../../whatsnew/3.13.rst:396 msgid "" "``interpreter``: Enable the Tier 2 interpreter but disable the JIT. The " "interpreter can be disabled by running with ``PYTHON_JIT=0``." msgstr "" -#: ../../whatsnew/3.13.rst:391 +#: ../../whatsnew/3.13.rst:399 msgid "The internal architecture is roughly as follows:" msgstr "" -#: ../../whatsnew/3.13.rst:393 +#: ../../whatsnew/3.13.rst:401 msgid "" "We start with specialized *Tier 1 bytecode*. See :ref:`What's new in 3.11 " "` for details." msgstr "" -#: ../../whatsnew/3.13.rst:395 +#: ../../whatsnew/3.13.rst:403 msgid "" "When the Tier 1 bytecode gets hot enough, it gets translated to a new purely " "internal intermediate representation (IR), called the *Tier 2 IR*, and " "sometimes referred to as micro-ops (\"uops\")." msgstr "" -#: ../../whatsnew/3.13.rst:398 +#: ../../whatsnew/3.13.rst:406 msgid "" "The Tier 2 IR uses the same stack-based virtual machine as Tier 1, but the " "instruction format is better suited to translation to machine code." msgstr "" -#: ../../whatsnew/3.13.rst:400 +#: ../../whatsnew/3.13.rst:408 msgid "" "We have several optimization passes for Tier 2 IR, which are applied before " "it is interpreted or translated to machine code." msgstr "" -#: ../../whatsnew/3.13.rst:402 +#: ../../whatsnew/3.13.rst:410 msgid "" "There is a Tier 2 interpreter, but it is mostly intended for debugging the " "earlier stages of the optimization pipeline. The Tier 2 interpreter can be " "enabled by configuring Python with ``--enable-experimental-jit=interpreter``." msgstr "" -#: ../../whatsnew/3.13.rst:406 +#: ../../whatsnew/3.13.rst:414 msgid "" "When the JIT is enabled, the optimized Tier 2 IR is translated to machine " "code, which is then executed." msgstr "" -#: ../../whatsnew/3.13.rst:408 +#: ../../whatsnew/3.13.rst:416 msgid "" "The machine code translation process uses a technique called *copy-and-" "patch*. It has no runtime dependencies, but there is a new build-time " "dependency on LLVM." msgstr "" -#: ../../whatsnew/3.13.rst:412 +#: ../../whatsnew/3.13.rst:420 msgid ":pep:`744`" msgstr ":pep:`744`" -#: ../../whatsnew/3.13.rst:414 +#: ../../whatsnew/3.13.rst:422 msgid "" "(JIT by Brandt Bucher, inspired by a paper by Haoran Xu and Fredrik " "Kjolstad. Tier 2 IR by Mark Shannon and Guido van Rossum. Tier 2 optimizer " "by Ken Jin.)" msgstr "" -#: ../../whatsnew/3.13.rst:422 +#: ../../whatsnew/3.13.rst:430 msgid "Defined mutation semantics for :py:func:`locals`" msgstr "" -#: ../../whatsnew/3.13.rst:424 +#: ../../whatsnew/3.13.rst:432 msgid "" "Historically, the expected result of mutating the return value of :func:" "`locals` has been left to individual Python implementations to define. " @@ -661,7 +708,7 @@ msgid "" "referenced nonlocal variables captured in closures." msgstr "" -#: ../../whatsnew/3.13.rst:433 +#: ../../whatsnew/3.13.rst:441 msgid "" "This change to the semantics of :func:`locals` in optimized scopes also " "affects the default behavior of code execution functions that implicitly " @@ -682,7 +729,7 @@ msgid "" "disk)." msgstr "" -#: ../../whatsnew/3.13.rst:452 +#: ../../whatsnew/3.13.rst:460 msgid "" "To ensure debuggers and similar tools can reliably update local variables in " "scopes affected by this change, :attr:`FrameType.f_locals ` " @@ -692,7 +739,7 @@ msgid "" "semantics." msgstr "" -#: ../../whatsnew/3.13.rst:458 +#: ../../whatsnew/3.13.rst:466 msgid "" "See :pep:`667` for more details, including related C API changes and " "deprecations. Porting notes are also provided below for the affected :ref:" @@ -700,18 +747,18 @@ msgid "" "notes-c>`." msgstr "" -#: ../../whatsnew/3.13.rst:463 +#: ../../whatsnew/3.13.rst:471 msgid "" "(PEP and implementation contributed by Mark Shannon and Tian Gao in :gh:" "`74929`. Documentation updates provided by Guido van Rossum and Alyssa " "Coghlan.)" msgstr "" -#: ../../whatsnew/3.13.rst:471 +#: ../../whatsnew/3.13.rst:479 msgid "Support for mobile platforms" msgstr "" -#: ../../whatsnew/3.13.rst:473 +#: ../../whatsnew/3.13.rst:481 msgid "" ":pep:`730`: iOS is now a :pep:`11` supported platform, with the ``arm64-" "apple-ios`` and ``arm64-apple-ios-simulator`` targets at tier 3 (iPhone and " @@ -722,7 +769,7 @@ msgid "" "implementation contributed by Russell Keith-Magee in :gh:`114099`.)" msgstr "" -#: ../../whatsnew/3.13.rst:483 +#: ../../whatsnew/3.13.rst:491 msgid "" ":pep:`738`: Android is now a :pep:`11` supported platform, with the " "``aarch64-linux-android`` and ``x86_64-linux-android`` targets at tier 3. " @@ -731,51 +778,15 @@ msgid "" "written and implementation contributed by Malcolm Smith in :gh:`116622`.)" msgstr "" -#: ../../whatsnew/3.13.rst:490 +#: ../../whatsnew/3.13.rst:498 msgid ":pep:`730`, :pep:`738`" msgstr ":pep:`730`、:pep:`738`" -#: ../../whatsnew/3.13.rst:496 -msgid "Incremental garbage collection" -msgstr "" - -#: ../../whatsnew/3.13.rst:498 -msgid "" -"The cycle garbage collector is now incremental. This means that maximum " -"pause times are reduced by an order of magnitude or more for larger heaps." -msgstr "" - #: ../../whatsnew/3.13.rst:502 -msgid "" -"There are now only two generations: young and old. When :func:`gc.collect` " -"is not called directly, the GC is invoked a little less frequently. When " -"invoked, it collects the young generation and an increment of the old " -"generation, instead of collecting one or more generations." -msgstr "" - -#: ../../whatsnew/3.13.rst:508 -msgid "The behavior of :func:`!gc.collect` changes slightly:" -msgstr "" - -#: ../../whatsnew/3.13.rst:510 ../../whatsnew/3.13.rst:2617 -msgid "" -"``gc.collect(1)``: Performs an increment of garbage collection, rather than " -"collecting generation 1." -msgstr "" - -#: ../../whatsnew/3.13.rst:512 ../../whatsnew/3.13.rst:2619 -msgid "Other calls to :func:`!gc.collect` are unchanged." -msgstr "" - -#: ../../whatsnew/3.13.rst:514 -msgid "(Contributed by Mark Shannon in :gh:`108362`.)" -msgstr "" - -#: ../../whatsnew/3.13.rst:518 msgid "Other Language Changes" msgstr "其他語言更動" -#: ../../whatsnew/3.13.rst:520 +#: ../../whatsnew/3.13.rst:504 msgid "" "The compiler now strips common leading whitespace from every line in a " "docstring. This reduces the size of the :term:`bytecode cache ` " @@ -784,7 +795,7 @@ msgid "" "affects tools that use docstrings, such as :mod:`doctest`." msgstr "" -#: ../../whatsnew/3.13.rst:527 +#: ../../whatsnew/3.13.rst:511 msgid "" ">>> def spam():\n" "... \"\"\"\n" @@ -799,18 +810,18 @@ msgid "" "multiple paragraphs!\\n'" msgstr "" -#: ../../whatsnew/3.13.rst:540 +#: ../../whatsnew/3.13.rst:524 msgid "(Contributed by Inada Naoki in :gh:`81283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:542 +#: ../../whatsnew/3.13.rst:526 msgid "" ":ref:`Annotation scopes ` within class scopes can now " "contain lambdas and comprehensions. Comprehensions that are located within " "class scopes are not inlined into their parent scope." msgstr "" -#: ../../whatsnew/3.13.rst:547 +#: ../../whatsnew/3.13.rst:531 msgid "" "class C[T]:\n" " type Alias = lambda: T" @@ -818,11 +829,11 @@ msgstr "" "class C[T]:\n" " type Alias = lambda: T" -#: ../../whatsnew/3.13.rst:552 +#: ../../whatsnew/3.13.rst:536 msgid "(Contributed by Jelle Zijlstra in :gh:`109118` and :gh:`118160`.)" msgstr "" -#: ../../whatsnew/3.13.rst:554 +#: ../../whatsnew/3.13.rst:538 msgid "" ":ref:`Future statements ` are no longer triggered by relative " "imports of the :mod:`__future__` module, meaning that statements of the form " @@ -831,7 +842,7 @@ msgid "" "in :gh:`118216`.)" msgstr "" -#: ../../whatsnew/3.13.rst:560 +#: ../../whatsnew/3.13.rst:544 msgid "" ":keyword:`global` declarations are now permitted in :keyword:`except` blocks " "when that global is used in the :keyword:`else` block. Previously this " @@ -839,7 +850,7 @@ msgid "" "`111123`.)" msgstr "" -#: ../../whatsnew/3.13.rst:565 +#: ../../whatsnew/3.13.rst:549 msgid "" "Add :envvar:`PYTHON_FROZEN_MODULES`, a new environment variable that " "determines whether frozen modules are ignored by the import machinery, " @@ -847,7 +858,7 @@ msgid "" "(Contributed by Yilei Yang in :gh:`111374`.)" msgstr "" -#: ../../whatsnew/3.13.rst:570 +#: ../../whatsnew/3.13.rst:554 msgid "" "Add :ref:`support for the perf profiler ` working without " "`frame pointers `_ through the new " @@ -856,36 +867,36 @@ msgid "" "`118518`.)" msgstr "" -#: ../../whatsnew/3.13.rst:576 +#: ../../whatsnew/3.13.rst:560 msgid "" "The location of a :file:`.python_history` file can be changed via the new :" "envvar:`PYTHON_HISTORY` environment variable. (Contributed by Levi Sabah, " "Zackery Spytz and Hugo van Kemenade in :gh:`73965`.)" msgstr "" -#: ../../whatsnew/3.13.rst:581 +#: ../../whatsnew/3.13.rst:565 msgid "" -"Classes have a new :attr:`~class.__static_attributes__` attribute. This is " +"Classes have a new :attr:`~type.__static_attributes__` attribute. This is " "populated by the compiler with a tuple of the class's attribute names which " "are assigned through ``self.`` from any function in its body. " "(Contributed by Irit Katriel in :gh:`115775`.)" msgstr "" -#: ../../whatsnew/3.13.rst:586 +#: ../../whatsnew/3.13.rst:570 msgid "" "The compiler now creates a :attr:`!__firstlineno__` attribute on classes " "with the line number of the first line of the class definition. (Contributed " "by Serhiy Storchaka in :gh:`118465`.)" msgstr "" -#: ../../whatsnew/3.13.rst:590 +#: ../../whatsnew/3.13.rst:574 msgid "" "The :func:`exec` and :func:`eval` builtins now accept the *globals* and " "*locals* arguments as keywords. (Contributed by Raphael Gaschignard in :gh:" "`105879`)" msgstr "" -#: ../../whatsnew/3.13.rst:594 +#: ../../whatsnew/3.13.rst:578 msgid "" "The :func:`compile` builtin now accepts a new flag, ``ast." "PyCF_OPTIMIZED_AST``, which is similar to ``ast.PyCF_ONLY_AST`` except that " @@ -893,13 +904,13 @@ msgid "" "argument. (Contributed by Irit Katriel in :gh:`108113`)." msgstr "" -#: ../../whatsnew/3.13.rst:600 +#: ../../whatsnew/3.13.rst:584 msgid "" "Add a :attr:`~property.__name__` attribute on :class:`property` objects. " "(Contributed by Eugene Toder in :gh:`101860`.)" msgstr "" -#: ../../whatsnew/3.13.rst:603 +#: ../../whatsnew/3.13.rst:587 msgid "" "Add :exc:`PythonFinalizationError`, a new exception derived from :exc:" "`RuntimeError` and used to signal when operations are blocked during :term:" @@ -907,65 +918,65 @@ msgid "" "exc:`!PythonFinalizationError`, instead of :exc:`RuntimeError`:" msgstr "" -#: ../../whatsnew/3.13.rst:609 +#: ../../whatsnew/3.13.rst:593 msgid ":func:`_thread.start_new_thread`" msgstr ":func:`_thread.start_new_thread`" -#: ../../whatsnew/3.13.rst:610 +#: ../../whatsnew/3.13.rst:594 msgid ":func:`os.fork`" msgstr ":func:`os.fork`" -#: ../../whatsnew/3.13.rst:611 +#: ../../whatsnew/3.13.rst:595 msgid ":func:`os.forkpty`" msgstr ":func:`os.forkpty`" -#: ../../whatsnew/3.13.rst:612 +#: ../../whatsnew/3.13.rst:596 msgid ":class:`subprocess.Popen`" msgstr ":class:`subprocess.Popen`" -#: ../../whatsnew/3.13.rst:614 +#: ../../whatsnew/3.13.rst:598 msgid "(Contributed by Victor Stinner in :gh:`114570`.)" msgstr "" -#: ../../whatsnew/3.13.rst:616 +#: ../../whatsnew/3.13.rst:600 msgid "" "Allow the *count* argument of :meth:`str.replace` to be a keyword. " "(Contributed by Hugo van Kemenade in :gh:`106487`.)" msgstr "" -#: ../../whatsnew/3.13.rst:619 +#: ../../whatsnew/3.13.rst:603 msgid "" "Many functions now emit a warning if a boolean value is passed as a file " "descriptor argument. This can help catch some errors earlier. (Contributed " "by Serhiy Storchaka in :gh:`82626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:624 +#: ../../whatsnew/3.13.rst:608 msgid "" "Added :attr:`!name` and :attr:`!mode` attributes for compressed and archived " "file-like objects in the :mod:`bz2`, :mod:`lzma`, :mod:`tarfile`, and :mod:" "`zipfile` modules. (Contributed by Serhiy Storchaka in :gh:`115961`.)" msgstr "" -#: ../../whatsnew/3.13.rst:631 +#: ../../whatsnew/3.13.rst:615 msgid "New Modules" msgstr "新增模組" -#: ../../whatsnew/3.13.rst:633 +#: ../../whatsnew/3.13.rst:617 msgid "" ":mod:`dbm.sqlite3`: An SQLite backend for :mod:`dbm`. (Contributed by " "Raymond Hettinger and Erlend E. Aasland in :gh:`100414`.)" msgstr "" -#: ../../whatsnew/3.13.rst:638 +#: ../../whatsnew/3.13.rst:622 msgid "Improved Modules" msgstr "改進的模組" -#: ../../whatsnew/3.13.rst:642 +#: ../../whatsnew/3.13.rst:626 msgid "argparse" msgstr "argparse" -#: ../../whatsnew/3.13.rst:644 +#: ../../whatsnew/3.13.rst:628 msgid "" "Add the *deprecated* parameter to the :meth:`~argparse.ArgumentParser." "add_argument` and :meth:`!add_parser` methods, to enable deprecating command-" @@ -973,36 +984,36 @@ msgid "" "Storchaka in :gh:`83648`.)" msgstr "" -#: ../../whatsnew/3.13.rst:652 +#: ../../whatsnew/3.13.rst:636 msgid "array" msgstr "array" -#: ../../whatsnew/3.13.rst:654 +#: ../../whatsnew/3.13.rst:638 msgid "" "Add the ``'w'`` type code (``Py_UCS4``) for Unicode characters. It should be " "used instead of the deprecated ``'u'`` type code. (Contributed by Inada " "Naoki in :gh:`80480`.)" msgstr "" -#: ../../whatsnew/3.13.rst:658 +#: ../../whatsnew/3.13.rst:642 msgid "" "Register :class:`array.array` as a :class:`~collections.abc.MutableSequence` " "by implementing the :meth:`~array.array.clear` method. (Contributed by Mike " "Zimin in :gh:`114894`.)" msgstr "" -#: ../../whatsnew/3.13.rst:664 +#: ../../whatsnew/3.13.rst:648 msgid "ast" msgstr "ast" -#: ../../whatsnew/3.13.rst:666 +#: ../../whatsnew/3.13.rst:650 msgid "" "The constructors of node types in the :mod:`ast` module are now stricter in " "the arguments they accept, with more intuitive behavior when arguments are " "omitted." msgstr "" -#: ../../whatsnew/3.13.rst:670 +#: ../../whatsnew/3.13.rst:654 msgid "" "If an optional field on an AST node is not included as an argument when " "constructing an instance, the field will now be set to ``None``. Similarly, " @@ -1012,7 +1023,7 @@ msgid "" "the newly constructed AST node instance.)" msgstr "" -#: ../../whatsnew/3.13.rst:678 +#: ../../whatsnew/3.13.rst:662 msgid "" "In all other cases, where a required argument is omitted, the node " "constructor will emit a :exc:`DeprecationWarning`. This will raise an " @@ -1021,31 +1032,31 @@ msgid "" "and will raise an exception in Python 3.15." msgstr "" -#: ../../whatsnew/3.13.rst:685 +#: ../../whatsnew/3.13.rst:669 msgid "" "These changes do not apply to user-defined subclasses of :class:`ast.AST` " "unless the class opts in to the new behavior by defining the :attr:`.AST." "_field_types` mapping." msgstr "" -#: ../../whatsnew/3.13.rst:689 +#: ../../whatsnew/3.13.rst:673 msgid "" "(Contributed by Jelle Zijlstra in :gh:`105858`, :gh:`117486`, and :gh:" "`118851`.)" msgstr "" -#: ../../whatsnew/3.13.rst:691 +#: ../../whatsnew/3.13.rst:675 msgid "" ":func:`ast.parse` now accepts an optional argument *optimize* which is " "passed on to :func:`compile`. This makes it possible to obtain an optimized " "AST. (Contributed by Irit Katriel in :gh:`108113`.)" msgstr "" -#: ../../whatsnew/3.13.rst:698 +#: ../../whatsnew/3.13.rst:682 msgid "asyncio" msgstr "asyncio" -#: ../../whatsnew/3.13.rst:700 +#: ../../whatsnew/3.13.rst:684 msgid "" ":func:`asyncio.as_completed` now returns an object that is both an :term:" "`asynchronous iterator` and a plain :term:`iterator` of :term:`awaitables " @@ -1055,14 +1066,14 @@ msgid "" "Arthur in :gh:`77714`.)" msgstr "" -#: ../../whatsnew/3.13.rst:708 +#: ../../whatsnew/3.13.rst:692 msgid "" ":meth:`asyncio.loop.create_unix_server` will now automatically remove the " "Unix socket when the server is closed. (Contributed by Pierre Ossman in :gh:" "`111246`.)" msgstr "" -#: ../../whatsnew/3.13.rst:712 +#: ../../whatsnew/3.13.rst:696 msgid "" ":meth:`.DatagramTransport.sendto` will now send zero-length datagrams if " "called with an empty bytes object. The transport flow control also now " @@ -1070,28 +1081,28 @@ msgid "" "(Contributed by Jamie Phan in :gh:`115199`.)" msgstr "" -#: ../../whatsnew/3.13.rst:718 +#: ../../whatsnew/3.13.rst:702 msgid "" "Add :meth:`Queue.shutdown ` and :exc:`~asyncio." "QueueShutDown` to manage queue termination. (Contributed by Laurie Opperman " "and Yves Duprat in :gh:`104228`.)" msgstr "" -#: ../../whatsnew/3.13.rst:722 +#: ../../whatsnew/3.13.rst:706 msgid "" "Add the :meth:`.Server.close_clients` and :meth:`.Server.abort_clients` " "methods, which more forcefully close an asyncio server. (Contributed by " "Pierre Ossman in :gh:`113538`.)" msgstr "" -#: ../../whatsnew/3.13.rst:726 +#: ../../whatsnew/3.13.rst:710 msgid "" "Accept a tuple of separators in :meth:`.StreamReader.readuntil`, stopping " "when any one of them is encountered. (Contributed by Bruce Merry in :gh:" "`81322`.)" msgstr "" -#: ../../whatsnew/3.13.rst:730 +#: ../../whatsnew/3.13.rst:714 msgid "" "Improve the behavior of :class:`~asyncio.TaskGroup` when an external " "cancellation collides with an internal cancellation. For example, when two " @@ -1100,7 +1111,7 @@ msgid "" "because its internal cancellation was swallowed by the inner task group." msgstr "" -#: ../../whatsnew/3.13.rst:737 +#: ../../whatsnew/3.13.rst:721 msgid "" "In the case where a task group is cancelled externally and also must raise " "an :exc:`ExceptionGroup`, it will now call the parent task's :meth:`~asyncio." @@ -1108,24 +1119,24 @@ msgid "" "be raised at the next :keyword:`await`, so the cancellation is not lost." msgstr "" -#: ../../whatsnew/3.13.rst:743 +#: ../../whatsnew/3.13.rst:727 msgid "" "An added benefit of these changes is that task groups now preserve the " "cancellation count (:meth:`~asyncio.Task.cancelling`)." msgstr "" -#: ../../whatsnew/3.13.rst:746 +#: ../../whatsnew/3.13.rst:730 msgid "" "In order to handle some corner cases, :meth:`~asyncio.Task.uncancel` may now " "reset the undocumented ``_must_cancel`` flag when the cancellation count " "reaches zero." msgstr "" -#: ../../whatsnew/3.13.rst:750 +#: ../../whatsnew/3.13.rst:734 msgid "(Inspired by an issue reported by Arthur Tacca in :gh:`116720`.)" msgstr "" -#: ../../whatsnew/3.13.rst:752 +#: ../../whatsnew/3.13.rst:736 msgid "" "When :meth:`.TaskGroup.create_task` is called on an inactive :class:" "`~asyncio.TaskGroup`, the given coroutine will be closed (which prevents a :" @@ -1133,46 +1144,38 @@ msgid "" "(Contributed by Arthur Tacca and Jason Zhang in :gh:`115957`.)" msgstr "" -#: ../../whatsnew/3.13.rst:760 +#: ../../whatsnew/3.13.rst:744 msgid "base64" msgstr "base64" -#: ../../whatsnew/3.13.rst:762 +#: ../../whatsnew/3.13.rst:746 msgid "" "Add :func:`~base64.z85encode` and :func:`~base64.z85decode` functions for " "encoding :class:`bytes` as `Z85 data`_ and decoding Z85-encoded data to :" "class:`!bytes`. (Contributed by Matan Perelman in :gh:`75299`.)" msgstr "" -#: ../../whatsnew/3.13.rst:771 +#: ../../whatsnew/3.13.rst:755 msgid "compileall" msgstr "compileall" -#: ../../whatsnew/3.13.rst:773 ../../whatsnew/3.13.rst:789 -#: ../../whatsnew/3.13.rst:1049 +#: ../../whatsnew/3.13.rst:757 ../../whatsnew/3.13.rst:765 +#: ../../whatsnew/3.13.rst:1013 msgid "" "The default number of worker threads and processes is now selected using :" "func:`os.process_cpu_count` instead of :func:`os.cpu_count`. (Contributed by " "Victor Stinner in :gh:`109649`.)" msgstr "" -#: ../../whatsnew/3.13.rst:779 ../../whatsnew/3.13.rst:795 -#: ../../whatsnew/3.13.rst:1649 -msgid "configparser" -msgstr "configparser" - -#: ../../whatsnew/3.13.rst:781 -msgid "" -"The :class:`configparser.ConfigParser` now accepts unnamed sections before " -"named ones if configured to do so. (Contributed by Pedro Sousa Lacerda in :" -"gh:`66449`.)" -msgstr "" - -#: ../../whatsnew/3.13.rst:787 +#: ../../whatsnew/3.13.rst:763 msgid "concurrent.futures" msgstr "concurrent.futures" -#: ../../whatsnew/3.13.rst:797 +#: ../../whatsnew/3.13.rst:771 ../../whatsnew/3.13.rst:1608 +msgid "configparser" +msgstr "configparser" + +#: ../../whatsnew/3.13.rst:773 msgid "" ":class:`~configparser.ConfigParser` now has support for unnamed sections, " "which allows for top-level key-value pairs. This can be enabled with the new " @@ -1180,11 +1183,11 @@ msgid "" "gh:`66449`.)" msgstr "" -#: ../../whatsnew/3.13.rst:804 +#: ../../whatsnew/3.13.rst:780 msgid "copy" msgstr "copy" -#: ../../whatsnew/3.13.rst:806 +#: ../../whatsnew/3.13.rst:782 msgid "" "The new :func:`~copy.replace` function and the :meth:`replace protocol " "` make creating modified copies of objects much simpler. " @@ -1193,62 +1196,92 @@ msgid "" "protocol:" msgstr "" -#: ../../whatsnew/3.13.rst:812 +#: ../../whatsnew/3.13.rst:788 msgid ":func:`collections.namedtuple`" msgstr ":func:`collections.namedtuple`" -#: ../../whatsnew/3.13.rst:813 +#: ../../whatsnew/3.13.rst:789 msgid ":class:`dataclasses.dataclass`" msgstr ":class:`dataclasses.dataclass`" -#: ../../whatsnew/3.13.rst:814 +#: ../../whatsnew/3.13.rst:790 msgid "" ":class:`datetime.datetime`, :class:`datetime.date`, :class:`datetime.time`" msgstr "" ":class:`datetime.datetime`、:class:`datetime.date`、:class:`datetime.time`" -#: ../../whatsnew/3.13.rst:815 +#: ../../whatsnew/3.13.rst:791 msgid ":class:`inspect.Signature`, :class:`inspect.Parameter`" msgstr ":class:`inspect.Signature`、:class:`inspect.Parameter`" -#: ../../whatsnew/3.13.rst:816 +#: ../../whatsnew/3.13.rst:792 msgid ":class:`types.SimpleNamespace`" msgstr ":class:`types.SimpleNamespace`" -#: ../../whatsnew/3.13.rst:817 +#: ../../whatsnew/3.13.rst:793 msgid ":ref:`code objects `" -msgstr "" +msgstr ":ref:`程式碼物件 `" -#: ../../whatsnew/3.13.rst:819 +#: ../../whatsnew/3.13.rst:795 msgid "" "Any user-defined class can also support :func:`copy.replace` by defining " "the :meth:`~object.__replace__` method. (Contributed by Serhiy Storchaka in :" "gh:`108751`.)" msgstr "" -#: ../../whatsnew/3.13.rst:825 +#: ../../whatsnew/3.13.rst:801 +msgid "ctypes" +msgstr "ctypes" + +#: ../../whatsnew/3.13.rst:803 +msgid "" +"As a consequence of necessary internal refactoring, initialization of " +"internal metaclasses now happens in ``__init__`` rather than in ``__new__``. " +"This affects projects that subclass these internal metaclasses to provide " +"custom initialization. Generally:" +msgstr "" + +#: ../../whatsnew/3.13.rst:809 +msgid "" +"Custom logic that was done in ``__new__`` after calling ``super().__new__`` " +"should be moved to ``__init__``." +msgstr "" + +#: ../../whatsnew/3.13.rst:811 +msgid "" +"To create a class, call the metaclass, not only the metaclass's ``__new__`` " +"method." +msgstr "" + +#: ../../whatsnew/3.13.rst:814 +msgid "" +"See :gh:`124520` for discussion and links to changes in some affected " +"projects." +msgstr "" + +#: ../../whatsnew/3.13.rst:819 msgid "dbm" msgstr "dbm" -#: ../../whatsnew/3.13.rst:827 +#: ../../whatsnew/3.13.rst:821 msgid "" "Add :mod:`dbm.sqlite3`, a new module which implements an SQLite backend, and " "make it the default :mod:`!dbm` backend. (Contributed by Raymond Hettinger " "and Erlend E. Aasland in :gh:`100414`.)" msgstr "" -#: ../../whatsnew/3.13.rst:831 +#: ../../whatsnew/3.13.rst:825 msgid "" "Allow removing all items from the database through the new :meth:`.gdbm." "clear` and :meth:`.ndbm.clear` methods. (Contributed by Donghee Na in :gh:" "`107122`.)" msgstr "" -#: ../../whatsnew/3.13.rst:837 +#: ../../whatsnew/3.13.rst:831 msgid "dis" msgstr "dis" -#: ../../whatsnew/3.13.rst:839 +#: ../../whatsnew/3.13.rst:833 msgid "" "Change the output of :mod:`dis` module functions to show logical labels for " "jump targets and exception handlers, rather than offsets. The offsets can be " @@ -1256,7 +1289,7 @@ msgid "" "the *show_offsets* argument. (Contributed by Irit Katriel in :gh:`112137`.)" msgstr "" -#: ../../whatsnew/3.13.rst:846 +#: ../../whatsnew/3.13.rst:840 msgid "" ":meth:`~dis.get_instructions` no longer represents cache entries as separate " "instructions. Instead, it returns them as part of the :class:`~dis." @@ -1265,11 +1298,11 @@ msgid "" "(Contributed by Irit Katriel in :gh:`112962`.)" msgstr "" -#: ../../whatsnew/3.13.rst:858 +#: ../../whatsnew/3.13.rst:852 msgid "doctest" msgstr "doctest" -#: ../../whatsnew/3.13.rst:860 +#: ../../whatsnew/3.13.rst:854 msgid "" ":mod:`doctest` output is now colored by default. This can be controlled via " "the new :envvar:`PYTHON_COLORS` environment variable as well as the " @@ -1278,18 +1311,18 @@ msgid "" "`117225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:867 +#: ../../whatsnew/3.13.rst:861 msgid "" "The :meth:`.DocTestRunner.run` method now counts the number of skipped " "tests. Add the :attr:`.DocTestRunner.skips` and :attr:`.TestResults.skipped` " "attributes. (Contributed by Victor Stinner in :gh:`108794`.)" msgstr "" -#: ../../whatsnew/3.13.rst:873 +#: ../../whatsnew/3.13.rst:867 msgid "email" msgstr "email" -#: ../../whatsnew/3.13.rst:875 +#: ../../whatsnew/3.13.rst:869 msgid "" "Headers with embedded newlines are now quoted on output. The :mod:`~email." "generator` will now refuse to serialize (write) headers that are improperly " @@ -1299,7 +1332,7 @@ msgid "" "Bloemsaat and Petr Viktorin in :gh:`121650`.)" msgstr "" -#: ../../whatsnew/3.13.rst:883 +#: ../../whatsnew/3.13.rst:877 msgid "" ":func:`~email.utils.getaddresses` and :func:`~email.utils.parseaddr` now " "return ``('', '')`` pairs in more situations where invalid email addresses " @@ -1311,11 +1344,11 @@ msgid "" "Stinner for :gh:`102988` to improve the :cve:`2023-27043` fix.)" msgstr "" -#: ../../whatsnew/3.13.rst:895 +#: ../../whatsnew/3.13.rst:889 msgid "fractions" msgstr "fractions" -#: ../../whatsnew/3.13.rst:897 +#: ../../whatsnew/3.13.rst:891 msgid "" ":class:`~fractions.Fraction` objects now support the standard :ref:`format " "specification mini-language ` rules for fill, alignment, sign " @@ -1323,61 +1356,22 @@ msgid "" "`111320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:904 -msgid "gc" -msgstr "gc" - -#: ../../whatsnew/3.13.rst:906 -msgid "" -"The cyclic garbage collector is now incremental, which changes the meaning " -"of the results of :meth:`~gc.get_threshold` and :meth:`~gc.set_threshold` as " -"well as :meth:`~gc.get_count` and :meth:`~gc.get_stats`." -msgstr "" - -#: ../../whatsnew/3.13.rst:911 -msgid "" -"For backwards compatibility, :meth:`~gc.get_threshold` continues to return a " -"three-item tuple. The first value is the threshold for young collections, as " -"before; the second value determines the rate at which the old collection is " -"scanned (the default is 10, and higher values mean that the old collection " -"is scanned more slowly). The third value is meaningless and is always zero." -msgstr "" - -#: ../../whatsnew/3.13.rst:919 -msgid ":meth:`~gc.set_threshold` ignores any items after the second." -msgstr "" - -#: ../../whatsnew/3.13.rst:921 -msgid "" -":meth:`~gc.get_count` and :meth:`~gc.get_stats` continue to return the same " -"format of results. The only difference is that instead of the results " -"referring to the young, aging and old generations, the results refer to the " -"young generation and the aging and collecting spaces of the old generation." -msgstr "" - -#: ../../whatsnew/3.13.rst:928 -msgid "" -"In summary, code that attempted to manipulate the behavior of the cycle GC " -"may not work exactly as intended, but it is very unlikely to be harmful. All " -"other code will work just fine." -msgstr "" - -#: ../../whatsnew/3.13.rst:934 +#: ../../whatsnew/3.13.rst:898 msgid "glob" msgstr "glob" -#: ../../whatsnew/3.13.rst:936 +#: ../../whatsnew/3.13.rst:900 msgid "" "Add :func:`~glob.translate`, a function to convert a path specification with " "shell-style wildcards to a regular expression. (Contributed by Barney Gale " "in :gh:`72904`.)" msgstr "" -#: ../../whatsnew/3.13.rst:942 +#: ../../whatsnew/3.13.rst:906 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.13.rst:944 +#: ../../whatsnew/3.13.rst:908 msgid "" "The following functions in :mod:`importlib.resources` now allow accessing a " "directory (or tree) of resources, using multiple positional arguments (the " @@ -1385,37 +1379,37 @@ msgid "" "keyword-only):" msgstr "" -#: ../../whatsnew/3.13.rst:949 +#: ../../whatsnew/3.13.rst:913 msgid ":func:`~importlib.resources.is_resource`" msgstr ":func:`~importlib.resources.is_resource`" -#: ../../whatsnew/3.13.rst:950 +#: ../../whatsnew/3.13.rst:914 msgid ":func:`~importlib.resources.open_binary`" msgstr ":func:`~importlib.resources.open_binary`" -#: ../../whatsnew/3.13.rst:951 +#: ../../whatsnew/3.13.rst:915 msgid ":func:`~importlib.resources.open_text`" msgstr ":func:`~importlib.resources.open_text`" -#: ../../whatsnew/3.13.rst:952 +#: ../../whatsnew/3.13.rst:916 msgid ":func:`~importlib.resources.path`" msgstr ":func:`~importlib.resources.path`" -#: ../../whatsnew/3.13.rst:953 +#: ../../whatsnew/3.13.rst:917 msgid ":func:`~importlib.resources.read_binary`" msgstr ":func:`~importlib.resources.read_binary`" -#: ../../whatsnew/3.13.rst:954 +#: ../../whatsnew/3.13.rst:918 msgid ":func:`~importlib.resources.read_text`" msgstr ":func:`~importlib.resources.read_text`" -#: ../../whatsnew/3.13.rst:956 +#: ../../whatsnew/3.13.rst:920 msgid "" "These functions are no longer deprecated and are not scheduled for removal. " "(Contributed by Petr Viktorin in :gh:`106532`.)" msgstr "" -#: ../../whatsnew/3.13.rst:959 +#: ../../whatsnew/3.13.rst:923 msgid "" ":func:`~importlib.resources.contents` remains deprecated in favor of the " "fully-featured :class:`~importlib.resources.abc.Traversable` API. However, " @@ -1423,11 +1417,11 @@ msgid "" "`106532`.)" msgstr "" -#: ../../whatsnew/3.13.rst:966 +#: ../../whatsnew/3.13.rst:930 msgid "io" msgstr "io" -#: ../../whatsnew/3.13.rst:968 +#: ../../whatsnew/3.13.rst:932 msgid "" "The :class:`~io.IOBase` finalizer now logs any errors raised by the :meth:" "`~io.IOBase.close` method with :data:`sys.unraisablehook`. Previously, " @@ -1436,17 +1430,17 @@ msgid "" "build>`. (Contributed by Victor Stinner in :gh:`62948`.)" msgstr "" -#: ../../whatsnew/3.13.rst:977 +#: ../../whatsnew/3.13.rst:941 msgid "ipaddress" msgstr "ipaddress" -#: ../../whatsnew/3.13.rst:979 +#: ../../whatsnew/3.13.rst:943 msgid "" "Add the :attr:`.IPv4Address.ipv6_mapped` property, which returns the IPv4-" "mapped IPv6 address. (Contributed by Charles Machalow in :gh:`109466`.)" msgstr "" -#: ../../whatsnew/3.13.rst:983 +#: ../../whatsnew/3.13.rst:947 msgid "" "Fix ``is_global`` and ``is_private`` behavior in :class:`~ipaddress." "IPv4Address`, :class:`~ipaddress.IPv6Address`, :class:`~ipaddress." @@ -1454,22 +1448,22 @@ msgid "" "Stasiak in :gh:`113171`.)" msgstr "" -#: ../../whatsnew/3.13.rst:990 +#: ../../whatsnew/3.13.rst:954 msgid "itertools" msgstr "itertools" -#: ../../whatsnew/3.13.rst:992 +#: ../../whatsnew/3.13.rst:956 msgid "" ":func:`~itertools.batched` has a new *strict* parameter, which raises a :exc:" "`ValueError` if the final batch is shorter than the specified batch size. " "(Contributed by Raymond Hettinger in :gh:`113202`.)" msgstr "" -#: ../../whatsnew/3.13.rst:999 +#: ../../whatsnew/3.13.rst:963 msgid "marshal" msgstr "marshal" -#: ../../whatsnew/3.13.rst:1001 +#: ../../whatsnew/3.13.rst:965 msgid "" "Add the *allow_code* parameter in module functions. Passing " "``allow_code=False`` prevents serialization and de-serialization of code " @@ -1477,11 +1471,11 @@ msgid "" "Serhiy Storchaka in :gh:`113626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1008 +#: ../../whatsnew/3.13.rst:972 msgid "math" msgstr "math" -#: ../../whatsnew/3.13.rst:1010 +#: ../../whatsnew/3.13.rst:974 msgid "" "The new function :func:`~math.fma` performs fused multiply-add operations. " "This computes ``x * y + z`` with only a single round, and so avoids any " @@ -1491,11 +1485,11 @@ msgid "" "Stinner in :gh:`73468`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1020 +#: ../../whatsnew/3.13.rst:984 msgid "mimetypes" msgstr "mimetypes" -#: ../../whatsnew/3.13.rst:1022 +#: ../../whatsnew/3.13.rst:986 msgid "" "Add the :func:`~mimetypes.guess_file_type` function to guess a MIME type " "from a filesystem path. Using paths with :func:`~mimetypes.guess_type` is " @@ -1503,18 +1497,18 @@ msgid "" "`66543`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1029 +#: ../../whatsnew/3.13.rst:993 msgid "mmap" msgstr "mmap" -#: ../../whatsnew/3.13.rst:1031 +#: ../../whatsnew/3.13.rst:995 msgid "" ":class:`~mmap.mmap` is now protected from crashing on Windows when the " "mapped memory is inaccessible due to file system errors or access " "violations. (Contributed by Jannis Weigend in :gh:`118209`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1035 +#: ../../whatsnew/3.13.rst:999 msgid "" ":class:`~mmap.mmap` has a new :meth:`~mmap.mmap.seekable` method that can be " "used when a seekable file-like object is required. The :meth:`~mmap.mmap." @@ -1522,7 +1516,7 @@ msgid "" "Na and Sylvie Liberman in :gh:`111835`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1040 +#: ../../whatsnew/3.13.rst:1004 msgid "" "The new UNIX-only *trackfd* parameter for :class:`~mmap.mmap` controls file " "descriptor duplication; if false, the file descriptor specified by *fileno* " @@ -1530,22 +1524,22 @@ msgid "" "gh:`78502`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1047 +#: ../../whatsnew/3.13.rst:1011 msgid "multiprocessing" msgstr "multiprocessing" -#: ../../whatsnew/3.13.rst:1055 +#: ../../whatsnew/3.13.rst:1019 msgid "os" msgstr "os" -#: ../../whatsnew/3.13.rst:1057 +#: ../../whatsnew/3.13.rst:1021 msgid "" "Add :func:`~os.process_cpu_count` function to get the number of logical CPU " "cores usable by the calling thread of the current process. (Contributed by " "Victor Stinner in :gh:`109649`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1061 +#: ../../whatsnew/3.13.rst:1025 msgid "" ":func:`~os.cpu_count` and :func:`~os.process_cpu_count` can be overridden " "through the new environment variable :envvar:`PYTHON_CPU_COUNT` or the new " @@ -1555,7 +1549,7 @@ msgid "" "Na in :gh:`109595`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1069 +#: ../../whatsnew/3.13.rst:1033 msgid "" "Add a :ref:`low level interface ` to Linux's :manpage:`timer " "file descriptors ` via :func:`~os.timerfd_create`, :func:" @@ -1566,7 +1560,7 @@ msgid "" "in :gh:`108277`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1078 +#: ../../whatsnew/3.13.rst:1042 msgid "" ":func:`~os.lchmod` and the *follow_symlinks* argument of :func:`~os.chmod` " "are both now available on Windows. Note that the default value of " @@ -1574,14 +1568,14 @@ msgid "" "by Serhiy Storchaka in :gh:`59616`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1084 +#: ../../whatsnew/3.13.rst:1048 msgid "" ":func:`~os.fchmod` and support for file descriptors in :func:`~os.chmod` are " "both now available on Windows. (Contributed by Serhiy Storchaka in :gh:" "`113191`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1088 +#: ../../whatsnew/3.13.rst:1052 msgid "" "On Windows, :func:`~os.mkdir` and :func:`~os.makedirs` now support passing a " "*mode* value of ``0o700`` to apply access control to the new directory. This " @@ -1590,14 +1584,14 @@ msgid "" "Steve Dower in :gh:`118486`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1095 +#: ../../whatsnew/3.13.rst:1059 msgid "" ":func:`~os.posix_spawn` now accepts ``None`` for the *env* argument, which " "makes the newly spawned process use the current process environment. " "(Contributed by Jakub Kulik in :gh:`113119`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1099 +#: ../../whatsnew/3.13.rst:1063 msgid "" ":func:`~os.posix_spawn` can now use the :attr:`~os.POSIX_SPAWN_CLOSEFROM` " "attribute in the *file_actions* parameter on platforms that support :c:func:" @@ -1605,76 +1599,76 @@ msgid "" "gh:`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1106 +#: ../../whatsnew/3.13.rst:1070 msgid "os.path" msgstr "os.path" -#: ../../whatsnew/3.13.rst:1108 +#: ../../whatsnew/3.13.rst:1072 msgid "" "Add :func:`~os.path.isreserved` to check if a path is reserved on the " "current system. This function is only available on Windows. (Contributed by " "Barney Gale in :gh:`88569`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1113 +#: ../../whatsnew/3.13.rst:1077 msgid "" "On Windows, :func:`~os.path.isabs` no longer considers paths starting with " "exactly one slash (``\\`` or ``/``) to be absolute. (Contributed by Barney " "Gale and Jon Foster in :gh:`44626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1117 +#: ../../whatsnew/3.13.rst:1081 msgid "" ":func:`~os.path.realpath` now resolves MS-DOS style file names even if the " "file is not accessible. (Contributed by Moonsik Park in :gh:`82367`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1123 ../../whatsnew/3.13.rst:1689 +#: ../../whatsnew/3.13.rst:1087 ../../whatsnew/3.13.rst:1648 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.13.rst:1125 +#: ../../whatsnew/3.13.rst:1089 msgid "" "Add :exc:`~pathlib.UnsupportedOperation`, which is raised instead of :exc:" "`NotImplementedError` when a path operation isn't supported. (Contributed by " "Barney Gale in :gh:`89812`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1129 +#: ../../whatsnew/3.13.rst:1093 msgid "" "Add a new constructor for creating :class:`~pathlib.Path` objects from " "'file' URIs (``file:///``), :meth:`.Path.from_uri`. (Contributed by Barney " "Gale in :gh:`107465`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1133 +#: ../../whatsnew/3.13.rst:1097 msgid "" "Add :meth:`.PurePath.full_match` for matching paths with shell-style " "wildcards, including the recursive wildcard \"``**``\". (Contributed by " "Barney Gale in :gh:`73435`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1137 +#: ../../whatsnew/3.13.rst:1101 msgid "" "Add the :attr:`.PurePath.parser` class attribute to store the implementation " "of :mod:`os.path` used for low-level path parsing and joining. This will be " "either :mod:`!posixpath` or :mod:`!ntpath`." msgstr "" -#: ../../whatsnew/3.13.rst:1142 +#: ../../whatsnew/3.13.rst:1106 msgid "" "Add *recurse_symlinks* keyword-only argument to :meth:`.Path.glob` and :meth:" "`~pathlib.Path.rglob`. (Contributed by Barney Gale in :gh:`77609`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1146 +#: ../../whatsnew/3.13.rst:1110 msgid "" ":meth:`.Path.glob` and :meth:`~pathlib.Path.rglob` now return files and " "directories when given a pattern that ends with \"``**``\". Previously, only " "directories were returned. (Contributed by Barney Gale in :gh:`70303`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1151 +#: ../../whatsnew/3.13.rst:1115 msgid "" "Add the *follow_symlinks* keyword-only argument to :meth:`Path.is_file " "`, :meth:`Path.is_dir `, :meth:`." @@ -1682,11 +1676,11 @@ msgid "" "`105793` and Kamil Turek in :gh:`107962`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1159 +#: ../../whatsnew/3.13.rst:1123 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.13.rst:1161 +#: ../../whatsnew/3.13.rst:1125 msgid "" ":func:`breakpoint` and :func:`~pdb.set_trace` now enter the debugger " "immediately rather than on the next line of code to be executed. This change " @@ -1695,20 +1689,20 @@ msgid "" "Gao in :gh:`118579`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1167 +#: ../../whatsnew/3.13.rst:1131 msgid "" "``sys.path[0]`` is no longer replaced by the directory of the script being " "debugged when :attr:`sys.flags.safe_path` is set. (Contributed by Tian Gao " "and Christian Walther in :gh:`111762`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1171 +#: ../../whatsnew/3.13.rst:1135 msgid "" ":mod:`zipapp` is now supported as a debugging target. (Contributed by Tian " "Gao in :gh:`118501`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1174 +#: ../../whatsnew/3.13.rst:1138 msgid "" "Add ability to move between chained exceptions during post-mortem debugging " "in :func:`~pdb.pm` using the new :pdbcmd:`exceptions [exc_number] " @@ -1716,117 +1710,121 @@ msgid "" "`106676`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1179 +#: ../../whatsnew/3.13.rst:1143 msgid "" "Expressions and statements whose prefix is a pdb command are now correctly " "identified and executed. (Contributed by Tian Gao in :gh:`108464`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1185 +#: ../../whatsnew/3.13.rst:1149 msgid "queue" msgstr "queue" -#: ../../whatsnew/3.13.rst:1187 +#: ../../whatsnew/3.13.rst:1151 msgid "" "Add :meth:`Queue.shutdown ` and :exc:`~queue.ShutDown` " "to manage queue termination. (Contributed by Laurie Opperman and Yves Duprat " "in :gh:`104750`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1193 +#: ../../whatsnew/3.13.rst:1157 msgid "random" msgstr "random" -#: ../../whatsnew/3.13.rst:1195 +#: ../../whatsnew/3.13.rst:1159 msgid "" "Add a :ref:`command-line interface `. (Contributed by Hugo van " "Kemenade in :gh:`118131`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1200 ../../whatsnew/3.13.rst:1697 +#: ../../whatsnew/3.13.rst:1164 ../../whatsnew/3.13.rst:1656 msgid "re" msgstr "re" -#: ../../whatsnew/3.13.rst:1202 +#: ../../whatsnew/3.13.rst:1166 msgid "" "Rename :exc:`!re.error` to :exc:`~re.PatternError` for improved clarity. :" "exc:`!re.error` is kept for backward compatibility." msgstr "" -#: ../../whatsnew/3.13.rst:1207 +#: ../../whatsnew/3.13.rst:1171 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.13.rst:1209 +#: ../../whatsnew/3.13.rst:1173 msgid "" "Support the *dir_fd* and *follow_symlinks* keyword arguments in :func:" "`~shutil.chown`. (Contributed by Berker Peksag and Tahia K in :gh:`62308`)" msgstr "" -#: ../../whatsnew/3.13.rst:1215 +#: ../../whatsnew/3.13.rst:1179 msgid "site" msgstr "site" -#: ../../whatsnew/3.13.rst:1217 +#: ../../whatsnew/3.13.rst:1181 msgid "" ":file:`.pth` files are now decoded using UTF-8 first, and then with the :" "term:`locale encoding` if UTF-8 decoding fails. (Contributed by Inada Naoki " "in :gh:`117802`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1223 +#: ../../whatsnew/3.13.rst:1187 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.13.rst:1225 +#: ../../whatsnew/3.13.rst:1189 msgid "" "A :exc:`ResourceWarning` is now emitted if a :class:`~sqlite3.Connection` " "object is not :meth:`closed ` explicitly. " "(Contributed by Erlend E. Aasland in :gh:`105539`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1229 +#: ../../whatsnew/3.13.rst:1193 msgid "" "Add the *filter* keyword-only parameter to :meth:`.Connection.iterdump` for " "filtering database objects to dump. (Contributed by Mariusz Felisiak in :gh:" "`91602`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1235 +#: ../../whatsnew/3.13.rst:1199 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.13.rst:1237 +#: ../../whatsnew/3.13.rst:1201 msgid "" "The :func:`~ssl.create_default_context` API now includes :data:`~ssl." "VERIFY_X509_PARTIAL_CHAIN` and :data:`~ssl.VERIFY_X509_STRICT` in its " "default flags." msgstr "" -#: ../../whatsnew/3.13.rst:1243 +#: ../../whatsnew/3.13.rst:1207 msgid "" ":data:`~ssl.VERIFY_X509_STRICT` may reject pre-:rfc:`5280` or malformed " "certificates that the underlying OpenSSL implementation might otherwise " "accept. Whilst disabling this is not recommended, you can do so using:" msgstr "" -#: ../../whatsnew/3.13.rst:1248 +#: ../../whatsnew/3.13.rst:1212 msgid "" "import ssl\n" "\n" "ctx = ssl.create_default_context()\n" "ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" msgstr "" +"import ssl\n" +"\n" +"ctx = ssl.create_default_context()\n" +"ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" -#: ../../whatsnew/3.13.rst:1255 +#: ../../whatsnew/3.13.rst:1219 msgid "(Contributed by William Woodruff in :gh:`112389`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1259 +#: ../../whatsnew/3.13.rst:1223 msgid "statistics" msgstr "statistics" -#: ../../whatsnew/3.13.rst:1261 +#: ../../whatsnew/3.13.rst:1225 msgid "" "Add :func:`~statistics.kde` for kernel density estimation. This makes it " "possible to estimate a continuous probability density function from a fixed " @@ -1834,24 +1832,24 @@ msgid "" "`115863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1266 +#: ../../whatsnew/3.13.rst:1230 msgid "" "Add :func:`~statistics.kde_random` for sampling from an estimated " "probability density function created by :func:`~statistics.kde`. " "(Contributed by Raymond Hettinger in :gh:`115863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1274 +#: ../../whatsnew/3.13.rst:1238 msgid "subprocess" msgstr "subprocess" -#: ../../whatsnew/3.13.rst:1276 +#: ../../whatsnew/3.13.rst:1240 msgid "" "The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " "in more situations." msgstr "" -#: ../../whatsnew/3.13.rst:1279 +#: ../../whatsnew/3.13.rst:1243 msgid "" "Notably, when *close_fds* is ``True`` (the default), :func:`~os.posix_spawn` " "will be used when the C library provides :c:func:`!" @@ -1860,7 +1858,7 @@ msgid "" "existing Linux :c:func:`!vfork` based code." msgstr "" -#: ../../whatsnew/3.13.rst:1286 +#: ../../whatsnew/3.13.rst:1250 msgid "" "A private control knob :attr:`!subprocess._USE_POSIX_SPAWN` can be set to " "``False`` if you need to force :mod:`subprocess` to never use :func:`~os." @@ -1870,22 +1868,22 @@ msgid "" "`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1296 +#: ../../whatsnew/3.13.rst:1260 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.13.rst:1298 +#: ../../whatsnew/3.13.rst:1262 msgid "" "Add the :func:`~sys._is_interned` function to test if a string was interned. " "This function is not guaranteed to exist in all implementations of Python. " "(Contributed by Serhiy Storchaka in :gh:`78573`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1304 +#: ../../whatsnew/3.13.rst:1268 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.13.rst:1306 +#: ../../whatsnew/3.13.rst:1270 msgid "" "On Windows, the default mode ``0o700`` used by :func:`tempfile.mkdtemp` now " "limits access to the new directory due to changes to :func:`os.mkdir`. This " @@ -1893,11 +1891,11 @@ msgid "" "`118486`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1313 +#: ../../whatsnew/3.13.rst:1277 msgid "time" msgstr "time" -#: ../../whatsnew/3.13.rst:1315 +#: ../../whatsnew/3.13.rst:1279 msgid "" "On Windows, :func:`~time.monotonic` now uses the " "``QueryPerformanceCounter()`` clock for a resolution of 1 microsecond, " @@ -1905,7 +1903,7 @@ msgid "" "milliseconds. (Contributed by Victor Stinner in :gh:`88494`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1321 +#: ../../whatsnew/3.13.rst:1285 msgid "" "On Windows, :func:`~time.time` now uses the " "``GetSystemTimePreciseAsFileTime()`` clock for a resolution of 1 " @@ -1914,11 +1912,11 @@ msgid "" "`63207`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1329 +#: ../../whatsnew/3.13.rst:1293 msgid "tkinter" msgstr "tkinter" -#: ../../whatsnew/3.13.rst:1331 +#: ../../whatsnew/3.13.rst:1295 msgid "" "Add :mod:`tkinter` widget methods: :meth:`!tk_busy_hold`, :meth:`!" "tk_busy_configure`, :meth:`!tk_busy_cget`, :meth:`!tk_busy_forget`, :meth:`!" @@ -1926,7 +1924,7 @@ msgid "" "klappnase and Serhiy Storchaka in :gh:`72684`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1337 +#: ../../whatsnew/3.13.rst:1301 msgid "" "The :mod:`tkinter` widget method :meth:`!wm_attributes` now accepts the " "attribute name without the minus prefix to get window attributes, for " @@ -1935,14 +1933,14 @@ msgid "" "wm_attributes(alpha=0.5)``. (Contributed by Serhiy Storchaka in :gh:`43457`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1344 +#: ../../whatsnew/3.13.rst:1308 msgid "" ":meth:`!wm_attributes` can now return attributes as a :class:`dict`, by " "using the new optional keyword-only parameter *return_python_dict*. " "(Contributed by Serhiy Storchaka in :gh:`43457`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1348 +#: ../../whatsnew/3.13.rst:1312 msgid "" ":meth:`!Text.count` can now return a simple :class:`int` when the new " "optional keyword-only parameter *return_ints* is used. Otherwise, the single " @@ -1950,27 +1948,27 @@ msgid "" "in :gh:`97928`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1353 +#: ../../whatsnew/3.13.rst:1317 msgid "" "Support the \"vsapi\" element type in the :meth:`~tkinter.ttk.Style." "element_create` method of :class:`tkinter.ttk.Style`. (Contributed by Serhiy " "Storchaka in :gh:`68166`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1358 +#: ../../whatsnew/3.13.rst:1322 msgid "" "Add the :meth:`!after_info` method for Tkinter widgets. (Contributed by " "Cheryl Sabella in :gh:`77020`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1361 +#: ../../whatsnew/3.13.rst:1325 msgid "" "Add a new :meth:`!copy_replace` method to :class:`!PhotoImage` to copy a " "region from one image to another, possibly with pixel zooming, subsampling, " "or both. (Contributed by Serhiy Storchaka in :gh:`118225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1366 +#: ../../whatsnew/3.13.rst:1330 msgid "" "Add *from_coords* parameter to the :class:`!PhotoImage` methods :meth:`!" "copy`, :meth:`!zoom` and :meth:`!subsample`. Add *zoom* and *subsample* " @@ -1978,7 +1976,7 @@ msgid "" "Serhiy Storchaka in :gh:`118225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1372 +#: ../../whatsnew/3.13.rst:1336 msgid "" "Add the :class:`!PhotoImage` methods :meth:`!read` to read an image from a " "file and :meth:`!data` to get the image data. Add *background* and " @@ -1986,11 +1984,11 @@ msgid "" "Storchaka in :gh:`118271`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1380 +#: ../../whatsnew/3.13.rst:1344 msgid "traceback" msgstr "traceback" -#: ../../whatsnew/3.13.rst:1382 +#: ../../whatsnew/3.13.rst:1346 msgid "" "Add the :attr:`~traceback.TracebackException.exc_type_str` attribute to :" "class:`~traceback.TracebackException`, which holds a string display of the " @@ -2000,7 +1998,7 @@ msgid "" "(Contributed by Irit Katriel in :gh:`112332`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1391 +#: ../../whatsnew/3.13.rst:1355 msgid "" "Add a new *show_group* keyword-only parameter to :meth:`.TracebackException." "format_exception_only` to (recursively) format the nested exceptions of a :" @@ -2008,11 +2006,11 @@ msgid "" "`105292`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1398 +#: ../../whatsnew/3.13.rst:1362 msgid "types" msgstr "types" -#: ../../whatsnew/3.13.rst:1400 +#: ../../whatsnew/3.13.rst:1364 msgid "" ":class:`~types.SimpleNamespace` can now take a single positional argument to " "initialise the namespace's arguments. This argument must either be a mapping " @@ -2020,63 +2018,63 @@ msgid "" "`108191`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1407 ../../whatsnew/3.13.rst:1722 +#: ../../whatsnew/3.13.rst:1371 ../../whatsnew/3.13.rst:1681 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.13.rst:1409 +#: ../../whatsnew/3.13.rst:1373 msgid "" ":pep:`705`: Add :data:`~typing.ReadOnly`, a special typing construct to mark " "a :class:`~typing.TypedDict` item as read-only for type checkers." msgstr "" -#: ../../whatsnew/3.13.rst:1412 +#: ../../whatsnew/3.13.rst:1376 msgid "" ":pep:`742`: Add :data:`~typing.TypeIs`, a typing construct that can be used " "to instruct a type checker how to narrow a type." msgstr "" -#: ../../whatsnew/3.13.rst:1415 +#: ../../whatsnew/3.13.rst:1379 msgid "" "Add :data:`~typing.NoDefault`, a sentinel object used to represent the " "defaults of some parameters in the :mod:`typing` module. (Contributed by " "Jelle Zijlstra in :gh:`116126`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1419 +#: ../../whatsnew/3.13.rst:1383 msgid "" "Add :func:`~typing.get_protocol_members` to return the set of members " "defining a :class:`typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:" "`104873`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1423 +#: ../../whatsnew/3.13.rst:1387 msgid "" "Add :func:`~typing.is_protocol` to check whether a class is a :class:" "`~typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:`104873`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1427 +#: ../../whatsnew/3.13.rst:1391 msgid "" ":data:`~typing.ClassVar` can now be nested in :data:`~typing.Final`, and " "vice versa. (Contributed by Mehdi Drissi in :gh:`89547`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1433 +#: ../../whatsnew/3.13.rst:1397 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.13.rst:1435 +#: ../../whatsnew/3.13.rst:1399 msgid "" "Update the Unicode database to `version 15.1.0`__. (Contributed by James " "Gerity in :gh:`109559`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1442 +#: ../../whatsnew/3.13.rst:1406 msgid "venv" msgstr "venv" -#: ../../whatsnew/3.13.rst:1444 +#: ../../whatsnew/3.13.rst:1408 msgid "" "Add support for creating source control management (SCM) ignore files in a " "virtual environment's directory. By default, Git is supported. This is " @@ -2086,11 +2084,11 @@ msgid "" "Cannon in :gh:`108125`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1455 +#: ../../whatsnew/3.13.rst:1419 msgid "warnings" msgstr "warnings" -#: ../../whatsnew/3.13.rst:1457 +#: ../../whatsnew/3.13.rst:1421 msgid "" ":pep:`702`: The new :func:`warnings.deprecated` decorator provides a way to " "communicate deprecations to a :term:`static type checker` and to warn on " @@ -2099,69 +2097,62 @@ msgid "" "(Contributed by Jelle Zijlstra in :gh:`104003`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1466 +#: ../../whatsnew/3.13.rst:1430 msgid "xml" msgstr "xml" -#: ../../whatsnew/3.13.rst:1468 +#: ../../whatsnew/3.13.rst:1432 msgid "" "Allow controlling Expat >=2.6.0 reparse deferral (:cve:`2023-52425`) by " "adding five new methods:" msgstr "" -#: ../../whatsnew/3.13.rst:1471 +#: ../../whatsnew/3.13.rst:1435 msgid ":meth:`xml.etree.ElementTree.XMLParser.flush`" msgstr ":meth:`xml.etree.ElementTree.XMLParser.flush`" -#: ../../whatsnew/3.13.rst:1472 +#: ../../whatsnew/3.13.rst:1436 msgid ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" msgstr ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" -#: ../../whatsnew/3.13.rst:1473 +#: ../../whatsnew/3.13.rst:1437 msgid ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" msgstr ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" -#: ../../whatsnew/3.13.rst:1474 +#: ../../whatsnew/3.13.rst:1438 msgid ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" msgstr ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" -#: ../../whatsnew/3.13.rst:1475 +#: ../../whatsnew/3.13.rst:1439 msgid ":meth:`!xml.sax.expatreader.ExpatParser.flush`" msgstr ":meth:`!xml.sax.expatreader.ExpatParser.flush`" -#: ../../whatsnew/3.13.rst:1477 +#: ../../whatsnew/3.13.rst:1441 msgid "(Contributed by Sebastian Pipping in :gh:`115623`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1479 +#: ../../whatsnew/3.13.rst:1443 msgid "" "Add the :meth:`!close` method for the iterator returned by :func:`~xml.etree." "ElementTree.iterparse` for explicit cleanup. (Contributed by Serhiy " "Storchaka in :gh:`69893`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1485 +#: ../../whatsnew/3.13.rst:1449 msgid "zipimport" msgstr "zipimport" -#: ../../whatsnew/3.13.rst:1487 +#: ../../whatsnew/3.13.rst:1451 msgid "" "Add support for ZIP64_ format files. Everybody loves huge data, right? " "(Contributed by Tim Hatch in :gh:`94146`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1495 +#: ../../whatsnew/3.13.rst:1459 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.13.rst:1497 -msgid "" -"The new :ref:`incremental garbage collector ` " -"means that maximum pause times are reduced by an order of magnitude or more " -"for larger heaps. (Contributed by Mark Shannon in :gh:`108362`.)" -msgstr "" - -#: ../../whatsnew/3.13.rst:1502 +#: ../../whatsnew/3.13.rst:1461 msgid "" "Several standard library modules have had their import times significantly " "improved. For example, the import time of the :mod:`typing` module has been " @@ -2172,13 +2163,13 @@ msgid "" "Turner, Daniel Hollas, and others in :gh:`109653`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1513 +#: ../../whatsnew/3.13.rst:1472 msgid "" ":func:`textwrap.indent` is now around 30% faster than before for large " "input. (Contributed by Inada Naoki in :gh:`107369`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1516 +#: ../../whatsnew/3.13.rst:1475 msgid "" "The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " "in more situations, including when *close_fds* is ``True`` (the default) on " @@ -2188,15 +2179,15 @@ msgid "" "Kulik in :gh:`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1526 +#: ../../whatsnew/3.13.rst:1485 msgid "Removed Modules And APIs" msgstr "" -#: ../../whatsnew/3.13.rst:1532 +#: ../../whatsnew/3.13.rst:1491 msgid "PEP 594: Remove \"dead batteries\" from the standard library" msgstr "" -#: ../../whatsnew/3.13.rst:1534 +#: ../../whatsnew/3.13.rst:1493 msgid "" ":pep:`594` proposed removing 19 modules from the standard library, " "colloquially referred to as 'dead batteries' due to their historic, " @@ -2204,23 +2195,23 @@ msgid "" "in Python 3.11, and are now removed:" msgstr "" -#: ../../whatsnew/3.13.rst:1540 +#: ../../whatsnew/3.13.rst:1499 msgid ":mod:`!aifc`" msgstr ":mod:`!aifc`" -#: ../../whatsnew/3.13.rst:1541 +#: ../../whatsnew/3.13.rst:1500 msgid ":mod:`!audioop`" msgstr ":mod:`!audioop`" -#: ../../whatsnew/3.13.rst:1542 +#: ../../whatsnew/3.13.rst:1501 msgid ":mod:`!chunk`" msgstr ":mod:`!chunk`" -#: ../../whatsnew/3.13.rst:1543 +#: ../../whatsnew/3.13.rst:1502 msgid ":mod:`!cgi` and :mod:`!cgitb`" msgstr ":mod:`!cgi` 和 :mod:`!cgitb`" -#: ../../whatsnew/3.13.rst:1545 +#: ../../whatsnew/3.13.rst:1504 msgid "" ":class:`!cgi.FieldStorage` can typically be replaced with :func:`urllib." "parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." @@ -2228,7 +2219,7 @@ msgid "" "requests." msgstr "" -#: ../../whatsnew/3.13.rst:1550 +#: ../../whatsnew/3.13.rst:1509 msgid "" ":func:`!cgi.parse` can be replaced by calling :func:`urllib.parse.parse_qs` " "directly on the desired query string, unless the input is ``multipart/form-" @@ -2236,14 +2227,14 @@ msgid "" "parse_multipart`." msgstr "" -#: ../../whatsnew/3.13.rst:1555 +#: ../../whatsnew/3.13.rst:1514 msgid "" ":func:`!cgi.parse_header` can be replaced with the functionality in the :mod:" "`email` package, which implements the same MIME RFCs. For example, with :" "class:`email.message.EmailMessage`:" msgstr "" -#: ../../whatsnew/3.13.rst:1559 +#: ../../whatsnew/3.13.rst:1518 msgid "" "from email.message import EmailMessage\n" "\n" @@ -2252,7 +2243,7 @@ msgid "" "main, params = msg.get_content_type(), msg['content-type'].params" msgstr "" -#: ../../whatsnew/3.13.rst:1567 +#: ../../whatsnew/3.13.rst:1526 msgid "" ":func:`!cgi.parse_multipart` can be replaced with the functionality in the :" "mod:`email` package, which implements the same MIME RFCs, or with the :pypi:" @@ -2260,41 +2251,41 @@ msgid "" "and :class:`email.message.Message` classes." msgstr "" -#: ../../whatsnew/3.13.rst:1573 +#: ../../whatsnew/3.13.rst:1532 msgid "" ":mod:`!crypt` and the private :mod:`!_crypt` extension. The :mod:`hashlib` " "module may be an appropriate replacement when simply hashing a value is " "required. Otherwise, various third-party libraries on PyPI are available:" msgstr "" -#: ../../whatsnew/3.13.rst:1578 +#: ../../whatsnew/3.13.rst:1537 msgid "" ":pypi:`bcrypt`: Modern password hashing for your software and your servers." msgstr "" -#: ../../whatsnew/3.13.rst:1580 +#: ../../whatsnew/3.13.rst:1539 msgid "" ":pypi:`passlib`: Comprehensive password hashing framework supporting over 30 " "schemes." msgstr "" -#: ../../whatsnew/3.13.rst:1582 +#: ../../whatsnew/3.13.rst:1541 msgid ":pypi:`argon2-cffi`: The secure Argon2 password hashing algorithm." msgstr "" -#: ../../whatsnew/3.13.rst:1584 +#: ../../whatsnew/3.13.rst:1543 msgid "" ":pypi:`legacycrypt`: :mod:`ctypes` wrapper to the POSIX crypt library call " "and associated functionality." msgstr "" -#: ../../whatsnew/3.13.rst:1587 +#: ../../whatsnew/3.13.rst:1546 msgid "" ":pypi:`crypt_r`: Fork of the :mod:`!crypt` module, wrapper to the :manpage:" "`crypt_r(3)` library call and associated functionality." msgstr "" -#: ../../whatsnew/3.13.rst:1592 +#: ../../whatsnew/3.13.rst:1551 msgid "" ":mod:`!imghdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements. For example, the :func:`!" @@ -2302,83 +2293,83 @@ msgid "" "function for all file formats that were supported by :mod:`!imghdr`." msgstr "" -#: ../../whatsnew/3.13.rst:1598 +#: ../../whatsnew/3.13.rst:1557 msgid ":mod:`!mailcap`: Use the :mod:`mimetypes` module instead." msgstr "" -#: ../../whatsnew/3.13.rst:1600 +#: ../../whatsnew/3.13.rst:1559 msgid ":mod:`!msilib`" msgstr ":mod:`!msilib`" -#: ../../whatsnew/3.13.rst:1601 +#: ../../whatsnew/3.13.rst:1560 msgid ":mod:`!nis`" msgstr ":mod:`!nis`" -#: ../../whatsnew/3.13.rst:1602 -msgid ":mod:`!nntplib`: Use the :pypi:`nntplib` library from PyPI instead." +#: ../../whatsnew/3.13.rst:1561 +msgid ":mod:`!nntplib`: Use the :pypi:`pynntp` library from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1604 +#: ../../whatsnew/3.13.rst:1563 msgid "" ":mod:`!ossaudiodev`: For audio playback, use the :pypi:`pygame` library from " "PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1606 +#: ../../whatsnew/3.13.rst:1565 msgid ":mod:`!pipes`: Use the :mod:`subprocess` module instead." msgstr "" -#: ../../whatsnew/3.13.rst:1608 +#: ../../whatsnew/3.13.rst:1567 msgid "" ":mod:`!sndhdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements." msgstr "" -#: ../../whatsnew/3.13.rst:1611 +#: ../../whatsnew/3.13.rst:1570 msgid ":mod:`!spwd`: Use the :pypi:`python-pam` library from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1613 +#: ../../whatsnew/3.13.rst:1572 msgid ":mod:`!sunau`" msgstr ":mod:`!sunau`" -#: ../../whatsnew/3.13.rst:1614 +#: ../../whatsnew/3.13.rst:1573 msgid "" ":mod:`!telnetlib`, Use the :pypi:`telnetlib3` or :pypi:`Exscript` libraries " "from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1616 +#: ../../whatsnew/3.13.rst:1575 msgid "" ":mod:`!uu`: Use the :mod:`base64` module instead, as a modern alternative." msgstr "" -#: ../../whatsnew/3.13.rst:1618 +#: ../../whatsnew/3.13.rst:1577 msgid ":mod:`!xdrlib`" msgstr ":mod:`!xdrlib`" -#: ../../whatsnew/3.13.rst:1620 +#: ../../whatsnew/3.13.rst:1579 msgid "" "(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` and :gh:" "`104780`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1624 +#: ../../whatsnew/3.13.rst:1583 msgid "2to3" msgstr "2to3" -#: ../../whatsnew/3.13.rst:1626 +#: ../../whatsnew/3.13.rst:1585 msgid "" "Remove the :program:`2to3` program and the :mod:`!lib2to3` module, " "previously deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:" "`104780`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1632 +#: ../../whatsnew/3.13.rst:1591 msgid "builtins" msgstr "builtins" -#: ../../whatsnew/3.13.rst:1634 +#: ../../whatsnew/3.13.rst:1593 msgid "" "Remove support for chained :class:`classmethod` descriptors (introduced in :" "gh:`63272`). These can no longer be used to wrap other descriptors, such as :" @@ -2388,47 +2379,47 @@ msgid "" "(Contributed by Raymond Hettinger in :gh:`89519`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1643 +#: ../../whatsnew/3.13.rst:1602 msgid "" "Raise a :exc:`RuntimeError` when calling :meth:`frame.clear` on a suspended " "frame (as has always been the case for an executing frame). (Contributed by " "Irit Katriel in :gh:`79932`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1651 +#: ../../whatsnew/3.13.rst:1610 msgid "" "Remove the undocumented :class:`!LegacyInterpolation` class, deprecated in " "the docstring since Python 3.2, and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104886`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1658 +#: ../../whatsnew/3.13.rst:1617 msgid "importlib.metadata" msgstr "importlib.metadata" -#: ../../whatsnew/3.13.rst:1660 +#: ../../whatsnew/3.13.rst:1619 msgid "" "Remove deprecated subscript (:meth:`~object.__getitem__`) access for :ref:" "`EntryPoint ` objects. (Contributed by Jason R. Coombs in :gh:" "`113175`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1666 +#: ../../whatsnew/3.13.rst:1625 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.13.rst:1668 +#: ../../whatsnew/3.13.rst:1627 msgid "" "Remove the :func:`!locale.resetlocale` function, deprecated in Python 3.11. " "Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. (Contributed by " "Victor Stinner in :gh:`104783`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1674 +#: ../../whatsnew/3.13.rst:1633 msgid "opcode" msgstr "opcode" -#: ../../whatsnew/3.13.rst:1676 +#: ../../whatsnew/3.13.rst:1635 msgid "" "Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!_opcode." "ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " @@ -2436,7 +2427,7 @@ msgid "" "Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1681 +#: ../../whatsnew/3.13.rst:1640 msgid "" "Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, and :" "attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but were " @@ -2444,43 +2435,43 @@ msgid "" "be used externally. (Contributed by Irit Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1691 +#: ../../whatsnew/3.13.rst:1650 msgid "" "Remove the ability to use :class:`~pathlib.Path` objects as context " "managers. This functionality was deprecated and has had no effect since " "Python 3.9. (Contributed by Barney Gale in :gh:`83863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1699 +#: ../../whatsnew/3.13.rst:1658 msgid "" "Remove the undocumented, deprecated, and broken :func:`!re.template` " "function and :attr:`!re.TEMPLATE` / :attr:`!re.T` flag. (Contributed by " "Serhiy Storchaka and Nikita Sobolev in :gh:`105687`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1705 +#: ../../whatsnew/3.13.rst:1664 msgid "tkinter.tix" msgstr "tkinter.tix" -#: ../../whatsnew/3.13.rst:1707 +#: ../../whatsnew/3.13.rst:1666 msgid "" "Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6. The third-" "party Tix library which the module wrapped is unmaintained. (Contributed by " "Zachary Ware in :gh:`75552`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1713 +#: ../../whatsnew/3.13.rst:1672 msgid "turtle" msgstr "turtle" -#: ../../whatsnew/3.13.rst:1715 +#: ../../whatsnew/3.13.rst:1674 msgid "" "Remove the :meth:`!RawTurtle.settiltangle` method, deprecated in the " "documentation since Python 3.1 and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104876`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1724 +#: ../../whatsnew/3.13.rst:1683 msgid "" "Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces, deprecated " "since Python 3.8. The items in those namespaces can be imported directly " @@ -2488,66 +2479,66 @@ msgid "" "`92871`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1730 +#: ../../whatsnew/3.13.rst:1689 msgid "" "Remove the keyword-argument method of creating :class:`~typing.TypedDict` " "types, deprecated in Python 3.11. (Contributed by Tomas Roun in :gh:" "`104786`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1736 +#: ../../whatsnew/3.13.rst:1695 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.13.rst:1738 +#: ../../whatsnew/3.13.rst:1697 msgid "" "Remove the following :mod:`unittest` functions, deprecated in Python 3.11:" msgstr "" -#: ../../whatsnew/3.13.rst:1740 +#: ../../whatsnew/3.13.rst:1699 msgid ":func:`!unittest.findTestCases`" msgstr ":func:`!unittest.findTestCases`" -#: ../../whatsnew/3.13.rst:1741 +#: ../../whatsnew/3.13.rst:1700 msgid ":func:`!unittest.makeSuite`" msgstr ":func:`!unittest.makeSuite`" -#: ../../whatsnew/3.13.rst:1742 +#: ../../whatsnew/3.13.rst:1701 msgid ":func:`!unittest.getTestCaseNames`" msgstr ":func:`!unittest.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1744 +#: ../../whatsnew/3.13.rst:1703 msgid "Use :class:`~unittest.TestLoader` methods instead:" msgstr "" -#: ../../whatsnew/3.13.rst:1746 +#: ../../whatsnew/3.13.rst:1705 msgid ":meth:`~unittest.TestLoader.loadTestsFromModule`" msgstr ":meth:`~unittest.TestLoader.loadTestsFromModule`" -#: ../../whatsnew/3.13.rst:1747 +#: ../../whatsnew/3.13.rst:1706 msgid ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" msgstr ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" -#: ../../whatsnew/3.13.rst:1748 +#: ../../whatsnew/3.13.rst:1707 msgid ":meth:`~unittest.TestLoader.getTestCaseNames`" msgstr ":meth:`~unittest.TestLoader.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1750 +#: ../../whatsnew/3.13.rst:1709 msgid "(Contributed by Hugo van Kemenade in :gh:`104835`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1752 +#: ../../whatsnew/3.13.rst:1711 msgid "" "Remove the untested and undocumented :meth:`!TestProgram.usageExit` method, " "deprecated in Python 3.11. (Contributed by Hugo van Kemenade in :gh:" "`104992`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1758 +#: ../../whatsnew/3.13.rst:1717 msgid "urllib" msgstr "urllib" -#: ../../whatsnew/3.13.rst:1760 +#: ../../whatsnew/3.13.rst:1719 msgid "" "Remove the *cafile*, *capath*, and *cadefault* parameters of the :func:" "`urllib.request.urlopen` function, deprecated in Python 3.6. Use the " @@ -2558,33 +2549,33 @@ msgid "" "Victor Stinner in :gh:`105382`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1771 +#: ../../whatsnew/3.13.rst:1730 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.13.rst:1773 +#: ../../whatsnew/3.13.rst:1732 msgid "" "Remove the untested and undocumented :class:`!MacOSX` class, deprecated in " "Python 3.11. Use the :class:`!MacOSXOSAScript` class (introduced in Python " "3.2) instead. (Contributed by Hugo van Kemenade in :gh:`104804`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1778 +#: ../../whatsnew/3.13.rst:1737 msgid "" "Remove the deprecated :attr:`!MacOSXOSAScript._name` attribute. Use the :" "attr:`MacOSXOSAScript.name ` attribute instead. " "(Contributed by Nikita Sobolev in :gh:`105546`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1785 +#: ../../whatsnew/3.13.rst:1744 msgid "New Deprecations" msgstr "" -#: ../../whatsnew/3.13.rst:1787 +#: ../../whatsnew/3.13.rst:1746 msgid ":ref:`User-defined functions `:" msgstr "" -#: ../../whatsnew/3.13.rst:1789 +#: ../../whatsnew/3.13.rst:1748 msgid "" "Deprecate assignment to a function's :attr:`~function.__code__` attribute, " "where the new code object's type does not match the function's type. The " @@ -2592,12 +2583,12 @@ msgid "" "coroutine. (Contributed by Irit Katriel in :gh:`81137`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1795 +#: ../../whatsnew/3.13.rst:1754 #: ../../deprecations/pending-removal-in-3.16.rst:13 msgid ":mod:`array`:" msgstr ":mod:`array`:" -#: ../../whatsnew/3.13.rst:1797 +#: ../../whatsnew/3.13.rst:1756 msgid "" "Deprecate the ``'u'`` format code (:c:type:`wchar_t`) at runtime. This " "format code has been deprecated in documentation since Python 3.3, and will " @@ -2606,50 +2597,50 @@ msgid "" "`80480`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1804 +#: ../../whatsnew/3.13.rst:1763 #: ../../deprecations/pending-removal-in-3.15.rst:4 msgid ":mod:`ctypes`:" msgstr ":mod:`ctypes`:" -#: ../../whatsnew/3.13.rst:1806 +#: ../../whatsnew/3.13.rst:1765 msgid "" "Deprecate the undocumented :func:`!SetPointerType` function, to be removed " "in Python 3.15. (Contributed by Victor Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1810 +#: ../../whatsnew/3.13.rst:1769 msgid "" ":term:`Soft-deprecate ` the :func:`~ctypes.ARRAY` function " "in favour of ``type * length`` multiplication. (Contributed by Victor " "Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1814 +#: ../../whatsnew/3.13.rst:1773 msgid ":mod:`decimal`:" msgstr ":mod:`decimal`:" -#: ../../whatsnew/3.13.rst:1816 +#: ../../whatsnew/3.13.rst:1775 msgid "" "Deprecate the non-standard and undocumented :class:`~decimal.Decimal` format " "specifier ``'N'``, which is only supported in the :mod:`!decimal` module's C " "implementation. (Contributed by Serhiy Storchaka in :gh:`89902`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1821 +#: ../../whatsnew/3.13.rst:1780 msgid ":mod:`dis`:" msgstr ":mod:`dis`:" -#: ../../whatsnew/3.13.rst:1823 +#: ../../whatsnew/3.13.rst:1782 msgid "" "Deprecate the :attr:`!HAVE_ARGUMENT` separator. Check membership in :data:" "`~dis.hasarg` instead. (Contributed by Irit Katriel in :gh:`109319`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1827 +#: ../../whatsnew/3.13.rst:1786 msgid ":mod:`getopt` and :mod:`optparse`:" msgstr ":mod:`getopt` 和 :mod:`optparse`:" -#: ../../whatsnew/3.13.rst:1829 +#: ../../whatsnew/3.13.rst:1788 msgid "" "Both modules are now :term:`soft deprecated`, with :mod:`argparse` preferred " "for new projects. This is a new soft-deprecation for the :mod:`!getopt` " @@ -2657,22 +2648,22 @@ msgid "" "deprecated. (Contributed by Victor Stinner in :gh:`106535`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1835 +#: ../../whatsnew/3.13.rst:1794 msgid ":mod:`gettext`:" msgstr ":mod:`gettext`:" -#: ../../whatsnew/3.13.rst:1837 +#: ../../whatsnew/3.13.rst:1796 msgid "" "Deprecate non-integer numbers as arguments to functions and methods that " "consider plural forms in the :mod:`!gettext` module, even if no translation " "was found. (Contributed by Serhiy Storchaka in :gh:`88434`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1842 +#: ../../whatsnew/3.13.rst:1801 msgid ":mod:`glob`:" msgstr ":mod:`glob`:" -#: ../../whatsnew/3.13.rst:1844 +#: ../../whatsnew/3.13.rst:1803 msgid "" "Deprecate the undocumented :func:`!glob0` and :func:`!glob1` functions. Use :" "func:`~glob.glob` and pass a :term:`path-like object` specifying the root " @@ -2680,12 +2671,12 @@ msgid "" "in :gh:`117337`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1849 +#: ../../whatsnew/3.13.rst:1808 #: ../../deprecations/pending-removal-in-3.15.rst:9 msgid ":mod:`http.server`:" msgstr ":mod:`http.server`:" -#: ../../whatsnew/3.13.rst:1851 +#: ../../whatsnew/3.13.rst:1810 msgid "" "Deprecate :class:`~http.server.CGIHTTPRequestHandler`, to be removed in " "Python 3.15. Process-based CGI HTTP servers have been out of favor for a " @@ -2694,30 +2685,29 @@ msgid "" "by Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1858 +#: ../../whatsnew/3.13.rst:1817 msgid "" "Deprecate the :option:`!--cgi` flag to the :program:`python -m http.server` " "command-line interface, to be removed in Python 3.15. (Contributed by " "Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1863 +#: ../../whatsnew/3.13.rst:1822 msgid ":mod:`mimetypes`:" msgstr ":mod:`mimetypes`:" -#: ../../whatsnew/3.13.rst:1865 +#: ../../whatsnew/3.13.rst:1824 msgid "" ":term:`Soft-deprecate ` file path arguments to :func:" "`~mimetypes.guess_type`, use :func:`~mimetypes.guess_file_type` instead. " "(Contributed by Serhiy Storchaka in :gh:`66543`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1870 -#, fuzzy +#: ../../whatsnew/3.13.rst:1829 msgid ":mod:`re`:" -msgstr ":mod:`re`。" +msgstr ":mod:`re`:" -#: ../../whatsnew/3.13.rst:1872 +#: ../../whatsnew/3.13.rst:1831 msgid "" "Deprecate passing the optional *maxsplit*, *count*, or *flags* arguments as " "positional arguments to the module-level :func:`~re.split`, :func:`~re.sub`, " @@ -2726,46 +2716,46 @@ msgid "" "by Serhiy Storchaka in :gh:`56166`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1879 -#: ../../deprecations/pending-removal-in-3.15.rst:30 +#: ../../whatsnew/3.13.rst:1838 +#: ../../deprecations/pending-removal-in-3.15.rst:33 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../whatsnew/3.13.rst:1881 +#: ../../whatsnew/3.13.rst:1840 msgid "" "Deprecate :meth:`.PurePath.is_reserved`, to be removed in Python 3.15. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows. (Contributed " "by Barney Gale in :gh:`88569`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1886 -#: ../../deprecations/pending-removal-in-3.15.rst:36 +#: ../../whatsnew/3.13.rst:1845 +#: ../../deprecations/pending-removal-in-3.15.rst:39 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../whatsnew/3.13.rst:1888 +#: ../../whatsnew/3.13.rst:1847 msgid "" "Deprecate :func:`~platform.java_ver`, to be removed in Python 3.15. This " "function is only useful for Jython support, has a confusing API, and is " "largely untested. (Contributed by Nikita Sobolev in :gh:`116349`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1894 +#: ../../whatsnew/3.13.rst:1853 msgid ":mod:`pydoc`:" msgstr ":mod:`pydoc`:" -#: ../../whatsnew/3.13.rst:1896 +#: ../../whatsnew/3.13.rst:1855 msgid "" "Deprecate the undocumented :func:`!ispackage` function. (Contributed by " "Zackery Spytz in :gh:`64020`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1899 -#: ../../deprecations/pending-removal-in-3.14.rst:94 +#: ../../whatsnew/3.13.rst:1858 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../whatsnew/3.13.rst:1901 +#: ../../whatsnew/3.13.rst:1860 msgid "" "Deprecate passing more than one positional argument to the :func:`~sqlite3." "connect` function and the :class:`~sqlite3.Connection` constructor. The " @@ -2773,7 +2763,7 @@ msgid "" "by Erlend E. Aasland in :gh:`107948`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1907 +#: ../../whatsnew/3.13.rst:1866 msgid "" "Deprecate passing name, number of arguments, and the callable as keyword " "arguments for :meth:`.Connection.create_function` and :meth:`.Connection." @@ -2781,7 +2771,7 @@ msgid "" "3.15. (Contributed by Erlend E. Aasland in :gh:`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1913 +#: ../../whatsnew/3.13.rst:1872 msgid "" "Deprecate passing the callback callable by keyword for the :meth:`~sqlite3." "Connection.set_authorizer`, :meth:`~sqlite3.Connection." @@ -2791,47 +2781,46 @@ msgid "" "`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1921 +#: ../../whatsnew/3.13.rst:1880 #: ../../deprecations/pending-removal-in-3.16.rst:33 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" -#: ../../whatsnew/3.13.rst:1923 +#: ../../whatsnew/3.13.rst:1882 msgid "" "Deprecate the :func:`~sys._enablelegacywindowsfsencoding` function, to be " "removed in Python 3.16. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable instead. (Contributed by Inada Naoki in :gh:`73427`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1928 +#: ../../whatsnew/3.13.rst:1887 #: ../../deprecations/pending-removal-in-3.16.rst:39 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" -#: ../../whatsnew/3.13.rst:1930 +#: ../../whatsnew/3.13.rst:1889 msgid "" "Deprecate the undocumented and unused :attr:`!TarFile.tarfile` attribute, to " "be removed in Python 3.16. (Contributed in :gh:`115256`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1934 -#, fuzzy +#: ../../whatsnew/3.13.rst:1893 msgid ":mod:`traceback`:" -msgstr ":mod:`traceback`。" +msgstr ":mod:`traceback`:" -#: ../../whatsnew/3.13.rst:1936 +#: ../../whatsnew/3.13.rst:1895 msgid "" "Deprecate the :attr:`.TracebackException.exc_type` attribute. Use :attr:`." "TracebackException.exc_type_str` instead. (Contributed by Irit Katriel in :" "gh:`112332`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1940 -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../whatsnew/3.13.rst:1899 +#: ../../deprecations/pending-removal-in-3.15.rst:53 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../whatsnew/3.13.rst:1942 +#: ../../whatsnew/3.13.rst:1901 msgid "" "Deprecate the undocumented keyword argument syntax for creating :class:" "`~typing.NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, " @@ -2839,7 +2828,7 @@ msgid "" "functional syntax instead. (Contributed by Alex Waygood in :gh:`105566`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1949 +#: ../../whatsnew/3.13.rst:1908 msgid "" "Deprecate omitting the *fields* parameter when creating a :class:`~typing." "NamedTuple` or :class:`typing.TypedDict` class, and deprecate passing " @@ -2851,7 +2840,7 @@ msgid "" "Alex Waygood in :gh:`105566` and :gh:`105570`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1959 +#: ../../whatsnew/3.13.rst:1918 msgid "" "Deprecate the :func:`typing.no_type_check_decorator` decorator function, to " "be removed in in Python 3.15. After eight years in the :mod:`typing` module, " @@ -2859,7 +2848,7 @@ msgid "" "Waygood in :gh:`106309`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1965 +#: ../../whatsnew/3.13.rst:1924 msgid "" "Deprecate :data:`typing.AnyStr`. In Python 3.16, it will be removed from " "``typing.__all__``, and a :exc:`DeprecationWarning` will be emitted at " @@ -2868,12 +2857,12 @@ msgid "" "(Contributed by Michael The in :gh:`107116`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1973 -#: ../../deprecations/pending-removal-in-3.15.rst:63 +#: ../../whatsnew/3.13.rst:1932 +#: ../../deprecations/pending-removal-in-3.15.rst:66 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../whatsnew/3.13.rst:1975 +#: ../../whatsnew/3.13.rst:1934 msgid "" "Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:" "`~wave.Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :" @@ -2992,46 +2981,38 @@ msgstr "" "Alan Williams 於 :gh:`72346` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:50 -msgid "" -":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " -"taken into consideration by the import system (:gh:`97879`)." -msgstr "" -":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " -"系統考慮。 (:gh:`97879`)" - -#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:55 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:62 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:64 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -3042,7 +3023,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:72 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -3059,7 +3040,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:80 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -3067,7 +3048,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -3077,23 +3058,23 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:92 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -3103,7 +3084,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" "date and datetime adapter, date and timestamp converter: see the :mod:" "`sqlite3` documentation for suggested replacement recipes." @@ -3111,7 +3092,7 @@ msgstr "" "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" "參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" -#: ../../deprecations/pending-removal-in-3.14.rst:105 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -3123,7 +3104,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:112 +#: ../../deprecations/pending-removal-in-3.14.rst:109 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -3131,7 +3112,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:115 +#: ../../deprecations/pending-removal-in-3.14.rst:112 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -3171,10 +3152,18 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:20 +msgid "" +":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " +"taken into consideration by the import system (:gh:`97879`)." +msgstr "" +":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " +"系統考慮。 (:gh:`97879`)" + +#: ../../deprecations/pending-removal-in-3.15.rst:23 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:22 +#: ../../deprecations/pending-removal-in-3.15.rst:25 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" @@ -3187,7 +3176,7 @@ msgstr "" "`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." "getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-3.15.rst:35 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows." @@ -3195,7 +3184,7 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." "isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:38 +#: ../../deprecations/pending-removal-in-3.15.rst:41 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -3204,11 +3193,11 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:45 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:47 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -3219,7 +3208,7 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:52 +#: ../../deprecations/pending-removal-in-3.15.rst:55 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -3230,7 +3219,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:58 +#: ../../deprecations/pending-removal-in-3.15.rst:61 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -3240,7 +3229,7 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:65 +#: ../../deprecations/pending-removal-in-3.15.rst:68 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -3739,11 +3728,11 @@ msgstr "" ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." "zipimporter.exec_module`。" -#: ../../whatsnew/3.13.rst:1992 +#: ../../whatsnew/3.13.rst:1951 msgid "CPython Bytecode Changes" msgstr "" -#: ../../whatsnew/3.13.rst:1994 +#: ../../whatsnew/3.13.rst:1953 msgid "" "The oparg of :opcode:`YIELD_VALUE` is now ``1`` if the yield is part of a " "yield-from or await, and ``0`` otherwise. The oparg of :opcode:`RESUME` was " @@ -3752,97 +3741,97 @@ msgid "" "`111354`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2002 +#: ../../whatsnew/3.13.rst:1961 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.13.rst:2007 +#: ../../whatsnew/3.13.rst:1966 msgid "" "Add the :ref:`PyMonitoring C API ` for generating :pep:" "`669` monitoring events:" msgstr "" -#: ../../whatsnew/3.13.rst:2010 +#: ../../whatsnew/3.13.rst:1969 msgid ":c:type:`PyMonitoringState`" msgstr ":c:type:`PyMonitoringState`" -#: ../../whatsnew/3.13.rst:2011 +#: ../../whatsnew/3.13.rst:1970 msgid ":c:func:`PyMonitoring_FirePyStartEvent`" msgstr ":c:func:`PyMonitoring_FirePyStartEvent`" -#: ../../whatsnew/3.13.rst:2012 +#: ../../whatsnew/3.13.rst:1971 msgid ":c:func:`PyMonitoring_FirePyResumeEvent`" msgstr ":c:func:`PyMonitoring_FirePyResumeEvent`" -#: ../../whatsnew/3.13.rst:2013 +#: ../../whatsnew/3.13.rst:1972 msgid ":c:func:`PyMonitoring_FirePyReturnEvent`" msgstr ":c:func:`PyMonitoring_FirePyReturnEvent`" -#: ../../whatsnew/3.13.rst:2014 +#: ../../whatsnew/3.13.rst:1973 msgid ":c:func:`PyMonitoring_FirePyYieldEvent`" msgstr ":c:func:`PyMonitoring_FirePyYieldEvent`" -#: ../../whatsnew/3.13.rst:2015 +#: ../../whatsnew/3.13.rst:1974 msgid ":c:func:`PyMonitoring_FireCallEvent`" msgstr ":c:func:`PyMonitoring_FireCallEvent`" -#: ../../whatsnew/3.13.rst:2016 +#: ../../whatsnew/3.13.rst:1975 msgid ":c:func:`PyMonitoring_FireLineEvent`" msgstr ":c:func:`PyMonitoring_FireLineEvent`" -#: ../../whatsnew/3.13.rst:2017 +#: ../../whatsnew/3.13.rst:1976 msgid ":c:func:`PyMonitoring_FireJumpEvent`" msgstr ":c:func:`PyMonitoring_FireJumpEvent`" -#: ../../whatsnew/3.13.rst:2018 +#: ../../whatsnew/3.13.rst:1977 msgid ":c:func:`PyMonitoring_FireBranchEvent`" msgstr ":c:func:`PyMonitoring_FireBranchEvent`" -#: ../../whatsnew/3.13.rst:2019 +#: ../../whatsnew/3.13.rst:1978 msgid ":c:func:`PyMonitoring_FireCReturnEvent`" msgstr ":c:func:`PyMonitoring_FireCReturnEvent`" -#: ../../whatsnew/3.13.rst:2020 +#: ../../whatsnew/3.13.rst:1979 msgid ":c:func:`PyMonitoring_FirePyThrowEvent`" msgstr ":c:func:`PyMonitoring_FirePyThrowEvent`" -#: ../../whatsnew/3.13.rst:2021 +#: ../../whatsnew/3.13.rst:1980 msgid ":c:func:`PyMonitoring_FireRaiseEvent`" msgstr ":c:func:`PyMonitoring_FireRaiseEvent`" -#: ../../whatsnew/3.13.rst:2022 +#: ../../whatsnew/3.13.rst:1981 msgid ":c:func:`PyMonitoring_FireCRaiseEvent`" msgstr ":c:func:`PyMonitoring_FireCRaiseEvent`" -#: ../../whatsnew/3.13.rst:2023 +#: ../../whatsnew/3.13.rst:1982 msgid ":c:func:`PyMonitoring_FireReraiseEvent`" msgstr ":c:func:`PyMonitoring_FireReraiseEvent`" -#: ../../whatsnew/3.13.rst:2024 +#: ../../whatsnew/3.13.rst:1983 msgid ":c:func:`PyMonitoring_FireExceptionHandledEvent`" msgstr ":c:func:`PyMonitoring_FireExceptionHandledEvent`" -#: ../../whatsnew/3.13.rst:2025 +#: ../../whatsnew/3.13.rst:1984 msgid ":c:func:`PyMonitoring_FirePyUnwindEvent`" msgstr ":c:func:`PyMonitoring_FirePyUnwindEvent`" -#: ../../whatsnew/3.13.rst:2026 +#: ../../whatsnew/3.13.rst:1985 msgid ":c:func:`PyMonitoring_FireStopIterationEvent`" msgstr ":c:func:`PyMonitoring_FireStopIterationEvent`" -#: ../../whatsnew/3.13.rst:2027 +#: ../../whatsnew/3.13.rst:1986 msgid ":c:func:`PyMonitoring_EnterScope`" msgstr ":c:func:`PyMonitoring_EnterScope`" -#: ../../whatsnew/3.13.rst:2028 +#: ../../whatsnew/3.13.rst:1987 msgid ":c:func:`PyMonitoring_ExitScope`" msgstr ":c:func:`PyMonitoring_ExitScope`" -#: ../../whatsnew/3.13.rst:2030 +#: ../../whatsnew/3.13.rst:1989 msgid "(Contributed by Irit Katriel in :gh:`111997`)." msgstr "" -#: ../../whatsnew/3.13.rst:2032 +#: ../../whatsnew/3.13.rst:1991 msgid "" "Add :c:type:`PyMutex`, a lightweight mutex that occupies a single byte, and " "the new :c:func:`PyMutex_Lock` and :c:func:`PyMutex_Unlock` functions. :c:" @@ -3850,52 +3839,52 @@ msgid "" "operation needs to block. (Contributed by Sam Gross in :gh:`108724`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2038 +#: ../../whatsnew/3.13.rst:1997 msgid "" "Add the :ref:`PyTime C API ` to provide access to system clocks:" msgstr "" -#: ../../whatsnew/3.13.rst:2040 +#: ../../whatsnew/3.13.rst:1999 msgid ":c:type:`PyTime_t`." msgstr ":c:type:`PyTime_t`。" -#: ../../whatsnew/3.13.rst:2041 +#: ../../whatsnew/3.13.rst:2000 msgid ":c:var:`PyTime_MIN` and :c:var:`PyTime_MAX`." msgstr "" -#: ../../whatsnew/3.13.rst:2042 +#: ../../whatsnew/3.13.rst:2001 msgid ":c:func:`PyTime_AsSecondsDouble`." msgstr ":c:func:`PyTime_AsSecondsDouble`。" -#: ../../whatsnew/3.13.rst:2043 +#: ../../whatsnew/3.13.rst:2002 msgid ":c:func:`PyTime_Monotonic`." msgstr ":c:func:`PyTime_Monotonic`。" -#: ../../whatsnew/3.13.rst:2044 +#: ../../whatsnew/3.13.rst:2003 msgid ":c:func:`PyTime_MonotonicRaw`." msgstr ":c:func:`PyTime_MonotonicRaw`。" -#: ../../whatsnew/3.13.rst:2045 +#: ../../whatsnew/3.13.rst:2004 msgid ":c:func:`PyTime_PerfCounter`." msgstr ":c:func:`PyTime_PerfCounter`。" -#: ../../whatsnew/3.13.rst:2046 +#: ../../whatsnew/3.13.rst:2005 msgid ":c:func:`PyTime_PerfCounterRaw`." msgstr ":c:func:`PyTime_PerfCounterRaw`。" -#: ../../whatsnew/3.13.rst:2047 +#: ../../whatsnew/3.13.rst:2006 msgid ":c:func:`PyTime_Time`." msgstr ":c:func:`PyTime_Time`。" -#: ../../whatsnew/3.13.rst:2048 +#: ../../whatsnew/3.13.rst:2007 msgid ":c:func:`PyTime_TimeRaw`." msgstr ":c:func:`PyTime_TimeRaw`。" -#: ../../whatsnew/3.13.rst:2050 +#: ../../whatsnew/3.13.rst:2009 msgid "(Contributed by Victor Stinner and Petr Viktorin in :gh:`110850`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2052 +#: ../../whatsnew/3.13.rst:2011 msgid "" "Add the :c:func:`PyDict_ContainsString` function with the same behavior as :" "c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const char*` " @@ -3903,7 +3892,7 @@ msgid "" "by Victor Stinner in :gh:`108314`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2058 +#: ../../whatsnew/3.13.rst:2017 msgid "" "Add the :c:func:`PyDict_GetItemRef` and :c:func:`PyDict_GetItemStringRef` " "functions, which behave similarly to :c:func:`PyDict_GetItemWithError`, but " @@ -3913,7 +3902,7 @@ msgid "" "`106004`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2066 +#: ../../whatsnew/3.13.rst:2025 msgid "" "Add the :c:func:`PyDict_SetDefaultRef` function, which behaves similarly to :" "c:func:`PyDict_SetDefault`, but returns a :term:`strong reference` instead " @@ -3922,7 +3911,7 @@ msgid "" "dictionary. (Contributed by Sam Gross in :gh:`112066`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2074 +#: ../../whatsnew/3.13.rst:2033 msgid "" "Add the :c:func:`PyDict_Pop` and :c:func:`PyDict_PopString` functions to " "remove a key from a dictionary and optionally return the removed value. This " @@ -3931,7 +3920,7 @@ msgid "" "Victor Stinner in :gh:`111262`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2081 +#: ../../whatsnew/3.13.rst:2040 msgid "" "Add the :c:func:`PyMapping_GetOptionalItem` and :c:func:" "`PyMapping_GetOptionalItemString` functions as alternatives to :c:func:" @@ -3942,7 +3931,7 @@ msgid "" "gh:`106307`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2091 +#: ../../whatsnew/3.13.rst:2050 msgid "" "Add the :c:func:`PyObject_GetOptionalAttr` and :c:func:" "`PyObject_GetOptionalAttrString` functions as alternatives to :c:func:" @@ -3953,37 +3942,37 @@ msgid "" "Serhiy Storchaka in :gh:`106521`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2101 +#: ../../whatsnew/3.13.rst:2060 msgid "" "Add the :c:func:`PyErr_FormatUnraisable` function as an extension to :c:func:" "`PyErr_WriteUnraisable` that allows customizing the warning message. " "(Contributed by Serhiy Storchaka in :gh:`108082`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2106 +#: ../../whatsnew/3.13.rst:2065 msgid "" "Add new functions that return a :term:`strong reference` instead of a :term:" "`borrowed reference` for frame locals, globals, and builtins, as part of :" "ref:`PEP 667 `:" msgstr "" -#: ../../whatsnew/3.13.rst:2110 +#: ../../whatsnew/3.13.rst:2069 msgid ":c:func:`PyEval_GetFrameBuiltins` replaces :c:func:`PyEval_GetBuiltins`" msgstr "" -#: ../../whatsnew/3.13.rst:2111 +#: ../../whatsnew/3.13.rst:2070 msgid ":c:func:`PyEval_GetFrameGlobals` replaces :c:func:`PyEval_GetGlobals`" msgstr "" -#: ../../whatsnew/3.13.rst:2112 +#: ../../whatsnew/3.13.rst:2071 msgid ":c:func:`PyEval_GetFrameLocals` replaces :c:func:`PyEval_GetLocals`" msgstr "" -#: ../../whatsnew/3.13.rst:2114 +#: ../../whatsnew/3.13.rst:2073 msgid "(Contributed by Mark Shannon and Tian Gao in :gh:`74929`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2116 +#: ../../whatsnew/3.13.rst:2075 msgid "" "Add the :c:func:`Py_GetConstant` and :c:func:`Py_GetConstantBorrowed` " "functions to get :term:`strong ` or :term:`borrowed " @@ -3992,7 +3981,7 @@ msgid "" "constant zero. (Contributed by Victor Stinner in :gh:`115754`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2123 +#: ../../whatsnew/3.13.rst:2082 msgid "" "Add the :c:func:`PyImport_AddModuleRef` function as a replacement for :c:" "func:`PyImport_AddModule` that returns a :term:`strong reference` instead of " @@ -4000,35 +3989,35 @@ msgid "" "`105922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2128 +#: ../../whatsnew/3.13.rst:2087 msgid "" "Add the :c:func:`Py_IsFinalizing` function to check whether the main Python " "interpreter is :term:`shutting down `. (Contributed by " "Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2133 +#: ../../whatsnew/3.13.rst:2092 msgid "" "Add the :c:func:`PyList_GetItemRef` function as a replacement for :c:func:" "`PyList_GetItem` that returns a :term:`strong reference` instead of a :term:" "`borrowed reference`. (Contributed by Sam Gross in :gh:`114329`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2138 +#: ../../whatsnew/3.13.rst:2097 msgid "" "Add the :c:func:`PyList_Extend` and :c:func:`PyList_Clear` functions, " "mirroring the Python :meth:`!list.extend` and :meth:`!list.clear` methods. " "(Contributed by Victor Stinner in :gh:`111138`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2142 +#: ../../whatsnew/3.13.rst:2101 msgid "" "Add the :c:func:`PyLong_AsInt` function. It behaves similarly to :c:func:" "`PyLong_AsLong`, but stores the result in a C :c:expr:`int` instead of a C :" "c:expr:`long`. (Contributed by Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2147 +#: ../../whatsnew/3.13.rst:2106 msgid "" "Add the :c:func:`PyLong_AsNativeBytes`, :c:func:`PyLong_FromNativeBytes`, " "and :c:func:`PyLong_FromUnsignedNativeBytes` functions to simplify " @@ -4036,27 +4025,27 @@ msgid "" "(Contributed by Steve Dower in :gh:`111140`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2153 +#: ../../whatsnew/3.13.rst:2112 msgid "" "Add :c:func:`PyModule_Add` function, which is similar to :c:func:" "`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but always steals " "a reference to the value. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2158 +#: ../../whatsnew/3.13.rst:2117 msgid "" "Add the :c:func:`PyObject_GenericHash` function that implements the default " "hashing function of a Python object. (Contributed by Serhiy Storchaka in :gh:" "`113024`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2162 +#: ../../whatsnew/3.13.rst:2121 msgid "" "Add the :c:func:`Py_HashPointer` function to hash a raw pointer. " "(Contributed by Victor Stinner in :gh:`111545`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2165 +#: ../../whatsnew/3.13.rst:2124 msgid "" "Add the :c:func:`PyObject_VisitManagedDict` and :c:func:" "`PyObject_ClearManagedDict` functions. which must be called by the traverse " @@ -4065,7 +4054,7 @@ msgid "" "with Python 3.11 and 3.12. (Contributed by Victor Stinner in :gh:`107073`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2173 +#: ../../whatsnew/3.13.rst:2132 msgid "" "Add the :c:func:`PyRefTracer_SetTracer` and :c:func:`PyRefTracer_GetTracer` " "functions, which enable tracking object creation and destruction in the same " @@ -4073,14 +4062,14 @@ msgid "" "in :gh:`93502`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2179 +#: ../../whatsnew/3.13.rst:2138 msgid "" "Add the :c:func:`PySys_AuditTuple` function as an alternative to :c:func:" "`PySys_Audit` that takes event arguments as a Python :class:`tuple` object. " "(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2184 +#: ../../whatsnew/3.13.rst:2143 msgid "" "Add the :c:func:`PyThreadState_GetUnchecked()` function as an alternative " "to :c:func:`PyThreadState_Get()` that doesn't kill the process with a fatal " @@ -4088,22 +4077,22 @@ msgid "" "result is ``NULL``. (Contributed by Victor Stinner in :gh:`108867`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2190 +#: ../../whatsnew/3.13.rst:2149 msgid "" "Add the :c:func:`PyType_GetFullyQualifiedName` function to get the type's " -"fully qualified name. The module name is prepended if ``type.__module__`` is " -"a string and is not equal to either ``'builtins'`` or ``'__main__'``. " -"(Contributed by Victor Stinner in :gh:`111696`.)" +"fully qualified name. The module name is prepended if :attr:`type." +"__module__` is a string and is not equal to either ``'builtins'`` or " +"``'__main__'``. (Contributed by Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2196 +#: ../../whatsnew/3.13.rst:2155 msgid "" "Add the :c:func:`PyType_GetModuleName` function to get the type's module " -"name. This is equivalent to getting the ``type.__module__`` attribute. " +"name. This is equivalent to getting the :attr:`type.__module__` attribute. " "(Contributed by Eric Snow and Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2201 +#: ../../whatsnew/3.13.rst:2160 msgid "" "Add the :c:func:`PyUnicode_EqualToUTF8AndSize` and :c:func:" "`PyUnicode_EqualToUTF8` functions to compare a Unicode object with a :c:expr:" @@ -4112,7 +4101,7 @@ msgid "" "Storchaka in :gh:`110289`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2208 +#: ../../whatsnew/3.13.rst:2167 msgid "" "Add the :c:func:`PyWeakref_GetRef` function as an alternative to :c:func:" "`PyWeakref_GetObject` that returns a :term:`strong reference` or ``NULL`` if " @@ -4120,47 +4109,47 @@ msgid "" "`105927`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2214 +#: ../../whatsnew/3.13.rst:2173 msgid "Add fixed variants of functions which silently ignore errors:" msgstr "" -#: ../../whatsnew/3.13.rst:2216 +#: ../../whatsnew/3.13.rst:2175 msgid "" ":c:func:`PyObject_HasAttrWithError` replaces :c:func:`PyObject_HasAttr`." msgstr "" -#: ../../whatsnew/3.13.rst:2217 +#: ../../whatsnew/3.13.rst:2176 msgid "" ":c:func:`PyObject_HasAttrStringWithError` replaces :c:func:" "`PyObject_HasAttrString`." msgstr "" -#: ../../whatsnew/3.13.rst:2219 +#: ../../whatsnew/3.13.rst:2178 msgid "" ":c:func:`PyMapping_HasKeyWithError` replaces :c:func:`PyMapping_HasKey`." msgstr "" -#: ../../whatsnew/3.13.rst:2220 +#: ../../whatsnew/3.13.rst:2179 msgid "" ":c:func:`PyMapping_HasKeyStringWithError` replaces :c:func:" "`PyMapping_HasKeyString`." msgstr "" -#: ../../whatsnew/3.13.rst:2223 +#: ../../whatsnew/3.13.rst:2182 msgid "" "The new functions return ``-1`` for errors and the standard ``1`` for true " "and ``0`` for false." msgstr "" -#: ../../whatsnew/3.13.rst:2226 +#: ../../whatsnew/3.13.rst:2185 msgid "(Contributed by Serhiy Storchaka in :gh:`108511`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2230 +#: ../../whatsnew/3.13.rst:2189 msgid "Changed C APIs" msgstr "" -#: ../../whatsnew/3.13.rst:2232 +#: ../../whatsnew/3.13.rst:2191 msgid "" "The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and :c:" "func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * const *` " @@ -4173,20 +4162,20 @@ msgid "" "`65210`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2244 +#: ../../whatsnew/3.13.rst:2203 msgid "" ":c:func:`PyArg_ParseTupleAndKeywords` now supports non-ASCII keyword " "parameter names. (Contributed by Serhiy Storchaka in :gh:`110815`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2248 +#: ../../whatsnew/3.13.rst:2207 msgid "" "The :c:func:`!PyCode_GetFirstFree` function is now unstable API and is now " "named :c:func:`PyUnstable_Code_GetFirstFree`. (Contributed by Bogdan " "Romanyuk in :gh:`115781`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2252 +#: ../../whatsnew/3.13.rst:2211 msgid "" "The :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:" "`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:" @@ -4197,35 +4186,35 @@ msgid "" "documentation. (Contributed by Serhiy Storchaka in :gh:`106672`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2261 +#: ../../whatsnew/3.13.rst:2220 msgid "" "Add support for the ``%T``, ``%#T``, ``%N`` and ``%#N`` formats to :c:func:" "`PyUnicode_FromFormat`:" msgstr "" -#: ../../whatsnew/3.13.rst:2264 +#: ../../whatsnew/3.13.rst:2223 msgid "``%T``: Get the fully qualified name of an object type" msgstr "" -#: ../../whatsnew/3.13.rst:2265 +#: ../../whatsnew/3.13.rst:2224 msgid "``%#T``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2266 +#: ../../whatsnew/3.13.rst:2225 msgid "``%N``: Get the fully qualified name of a type" msgstr "" -#: ../../whatsnew/3.13.rst:2267 +#: ../../whatsnew/3.13.rst:2226 msgid "``%#N``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2269 +#: ../../whatsnew/3.13.rst:2228 msgid "" "See :pep:`737` for more information. (Contributed by Victor Stinner in :gh:" "`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2272 +#: ../../whatsnew/3.13.rst:2231 msgid "" "You no longer have to define the ``PY_SSIZE_T_CLEAN`` macro before " "including :file:`Python.h` when using ``#`` formats in :ref:`format codes " @@ -4234,7 +4223,7 @@ msgid "" "`104922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2278 +#: ../../whatsnew/3.13.rst:2237 msgid "" "If Python is built in :ref:`debug mode ` or :option:`with " "assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and :c:func:" @@ -4242,60 +4231,60 @@ msgid "" "(Contributed by Victor Stinner in :gh:`106168`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2286 +#: ../../whatsnew/3.13.rst:2245 msgid "Limited C API Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2288 +#: ../../whatsnew/3.13.rst:2247 msgid "The following functions are now included in the Limited C API:" msgstr "" -#: ../../whatsnew/3.13.rst:2290 +#: ../../whatsnew/3.13.rst:2249 msgid ":c:func:`PyMem_RawMalloc`" msgstr ":c:func:`PyMem_RawMalloc`" -#: ../../whatsnew/3.13.rst:2291 +#: ../../whatsnew/3.13.rst:2250 msgid ":c:func:`PyMem_RawCalloc`" msgstr ":c:func:`PyMem_RawCalloc`" -#: ../../whatsnew/3.13.rst:2292 +#: ../../whatsnew/3.13.rst:2251 msgid ":c:func:`PyMem_RawRealloc`" msgstr ":c:func:`PyMem_RawRealloc`" -#: ../../whatsnew/3.13.rst:2293 +#: ../../whatsnew/3.13.rst:2252 msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" -#: ../../whatsnew/3.13.rst:2294 +#: ../../whatsnew/3.13.rst:2253 msgid ":c:func:`PySys_Audit`" msgstr ":c:func:`PySys_Audit`" -#: ../../whatsnew/3.13.rst:2295 +#: ../../whatsnew/3.13.rst:2254 msgid ":c:func:`PySys_AuditTuple`" msgstr ":c:func:`PySys_AuditTuple`" -#: ../../whatsnew/3.13.rst:2296 +#: ../../whatsnew/3.13.rst:2255 msgid ":c:func:`PyType_GetModuleByDef`" msgstr ":c:func:`PyType_GetModuleByDef`" -#: ../../whatsnew/3.13.rst:2298 +#: ../../whatsnew/3.13.rst:2257 msgid "" "(Contributed by Victor Stinner in :gh:`85283`, :gh:`85283`, and :gh:" "`116936`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2300 +#: ../../whatsnew/3.13.rst:2259 msgid "" "Python built with :option:`--with-trace-refs` (tracing references) now " "supports the :ref:`Limited API `. (Contributed by Victor " "Stinner in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2306 +#: ../../whatsnew/3.13.rst:2265 msgid "Removed C APIs" msgstr "" -#: ../../whatsnew/3.13.rst:2308 +#: ../../whatsnew/3.13.rst:2267 msgid "" "Remove several functions, macros, variables, etc with names prefixed by " "``_Py`` or ``_PY`` (which are considered private). If your project is " @@ -4305,13 +4294,13 @@ msgid "" "Victor Stinner. (Contributed by Victor Stinner in :gh:`106320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2316 +#: ../../whatsnew/3.13.rst:2275 msgid "" "Remove old buffer protocols deprecated in Python 3.0. Use :ref:" "`bufferobjects` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2319 +#: ../../whatsnew/3.13.rst:2278 msgid "" ":c:func:`!PyObject_CheckReadBuffer`: Use :c:func:`PyObject_CheckBuffer` to " "test whether the object supports the buffer protocol. Note that :c:func:" @@ -4320,13 +4309,13 @@ msgid "" "example of :c:func:`PyObject_GetBuffer`." msgstr "" -#: ../../whatsnew/3.13.rst:2327 +#: ../../whatsnew/3.13.rst:2286 msgid "" ":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: Use :c:" "func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" msgstr "" -#: ../../whatsnew/3.13.rst:2330 +#: ../../whatsnew/3.13.rst:2289 msgid "" "Py_buffer view;\n" "if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) < 0) {\n" @@ -4337,13 +4326,13 @@ msgid "" "PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2340 +#: ../../whatsnew/3.13.rst:2299 msgid "" ":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` and :c:" "func:`PyBuffer_Release` instead:" msgstr "" -#: ../../whatsnew/3.13.rst:2343 +#: ../../whatsnew/3.13.rst:2302 msgid "" "Py_buffer view;\n" "if (PyObject_GetBuffer(obj, &view, PyBUF_WRITABLE) < 0) {\n" @@ -4353,21 +4342,21 @@ msgid "" "PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2352 +#: ../../whatsnew/3.13.rst:2311 msgid "(Contributed by Inada Naoki in :gh:`85275`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2354 +#: ../../whatsnew/3.13.rst:2313 msgid "Remove various functions deprecated in Python 3.9:" msgstr "" -#: ../../whatsnew/3.13.rst:2356 +#: ../../whatsnew/3.13.rst:2315 msgid "" ":c:func:`!PyEval_CallObject`, :c:func:`!PyEval_CallObjectWithKeywords`: Use :" "c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2361 +#: ../../whatsnew/3.13.rst:2320 msgid "" "In :c:func:`PyObject_Call`, positional arguments must be a :class:`tuple` " "and must not be ``NULL``, and keyword arguments must be a :class:`dict` or " @@ -4378,106 +4367,106 @@ msgid "" "`PyTuple_New(0) `." msgstr "" -#: ../../whatsnew/3.13.rst:2371 +#: ../../whatsnew/3.13.rst:2330 msgid "" ":c:func:`!PyEval_CallFunction`: Use :c:func:`PyObject_CallFunction` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2373 +#: ../../whatsnew/3.13.rst:2332 msgid "" ":c:func:`!PyEval_CallMethod`: Use :c:func:`PyObject_CallMethod` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2375 +#: ../../whatsnew/3.13.rst:2334 msgid ":c:func:`!PyCFunction_Call`: Use :c:func:`PyObject_Call` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2378 +#: ../../whatsnew/3.13.rst:2337 msgid "(Contributed by Victor Stinner in :gh:`105107`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2380 +#: ../../whatsnew/3.13.rst:2339 msgid "" "Remove the following old functions to configure the Python initialization, " "deprecated in Python 3.11:" msgstr "" -#: ../../whatsnew/3.13.rst:2383 +#: ../../whatsnew/3.13.rst:2342 msgid "" ":c:func:`!PySys_AddWarnOptionUnicode`: Use :c:member:`PyConfig.warnoptions` " "instead." msgstr "" -#: ../../whatsnew/3.13.rst:2385 +#: ../../whatsnew/3.13.rst:2344 msgid "" ":c:func:`!PySys_AddWarnOption`: Use :c:member:`PyConfig.warnoptions` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2387 +#: ../../whatsnew/3.13.rst:2346 msgid ":c:func:`!PySys_AddXOption`: Use :c:member:`PyConfig.xoptions` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2389 +#: ../../whatsnew/3.13.rst:2348 msgid "" ":c:func:`!PySys_HasWarnOptions`: Use :c:member:`PyConfig.xoptions` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2391 +#: ../../whatsnew/3.13.rst:2350 msgid "" ":c:func:`!PySys_SetPath`: Set :c:member:`PyConfig.module_search_paths` " "instead." msgstr "" -#: ../../whatsnew/3.13.rst:2393 +#: ../../whatsnew/3.13.rst:2352 msgid "" ":c:func:`!Py_SetPath`: Set :c:member:`PyConfig.module_search_paths` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2395 +#: ../../whatsnew/3.13.rst:2354 msgid "" ":c:func:`!Py_SetStandardStreamEncoding`: Set :c:member:`PyConfig." "stdio_encoding` instead, and set also maybe :c:member:`PyConfig." "legacy_windows_stdio` (on Windows)." msgstr "" -#: ../../whatsnew/3.13.rst:2398 +#: ../../whatsnew/3.13.rst:2357 msgid "" ":c:func:`!_Py_SetProgramFullPath`: Set :c:member:`PyConfig.executable` " "instead." msgstr "" -#: ../../whatsnew/3.13.rst:2401 +#: ../../whatsnew/3.13.rst:2360 msgid "" "Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " "Configuration ` instead (:pep:`587`), added to Python 3.8. " "(Contributed by Victor Stinner in :gh:`105145`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2405 +#: ../../whatsnew/3.13.rst:2364 msgid "" "Remove :c:func:`!PyEval_AcquireLock` and :c:func:`!PyEval_ReleaseLock` " "functions, deprecated in Python 3.2. They didn't update the current thread " "state. They can be replaced with:" msgstr "" -#: ../../whatsnew/3.13.rst:2410 +#: ../../whatsnew/3.13.rst:2369 msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`;" msgstr ":c:func:`PyEval_SaveThread` 和 :c:func:`PyEval_RestoreThread`;" -#: ../../whatsnew/3.13.rst:2411 +#: ../../whatsnew/3.13.rst:2370 msgid "" "low-level :c:func:`PyEval_AcquireThread` and :c:func:`PyEval_RestoreThread`;" msgstr "" -#: ../../whatsnew/3.13.rst:2412 +#: ../../whatsnew/3.13.rst:2371 msgid "or :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`." msgstr "" -#: ../../whatsnew/3.13.rst:2414 +#: ../../whatsnew/3.13.rst:2373 msgid "(Contributed by Victor Stinner in :gh:`105182`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2416 +#: ../../whatsnew/3.13.rst:2375 msgid "" "Remove the :c:func:`!PyEval_ThreadsInitialized` function, deprecated in " "Python 3.9. Since Python 3.7, :c:func:`!Py_Initialize` always creates the " @@ -4486,7 +4475,7 @@ msgid "" "Stinner in :gh:`105182`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2423 +#: ../../whatsnew/3.13.rst:2382 msgid "" "Remove the :c:func:`!_PyInterpreterState_Get` alias to :c:func:" "`PyInterpreterState_Get()` which was kept for backward compatibility with " @@ -4495,26 +4484,26 @@ msgid "" "Stinner in :gh:`106320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2430 +#: ../../whatsnew/3.13.rst:2389 msgid "" "Remove the private :c:func:`!_PyObject_FastCall` function: use :c:func:`!" "PyObject_Vectorcall` which is available since Python 3.8 (:pep:`590`). " "(Contributed by Victor Stinner in :gh:`106023`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2435 +#: ../../whatsnew/3.13.rst:2394 msgid "" "Remove the ``cpython/pytime.h`` header file, which only contained private " "functions. (Contributed by Victor Stinner in :gh:`106316`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2439 +#: ../../whatsnew/3.13.rst:2398 msgid "" "Remove the undocumented ``PY_TIMEOUT_MAX`` constant from the limited C API. " "(Contributed by Victor Stinner in :gh:`110014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2442 +#: ../../whatsnew/3.13.rst:2401 msgid "" "Remove the old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " "``Py_TRASHCAN_SAFE_END``. Replace both with the new macros " @@ -4522,15 +4511,15 @@ msgid "" "in :gh:`105111`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2449 +#: ../../whatsnew/3.13.rst:2408 msgid "Deprecated C APIs" msgstr "器用的 C API" -#: ../../whatsnew/3.13.rst:2451 +#: ../../whatsnew/3.13.rst:2410 msgid "Deprecate old Python initialization functions:" msgstr "" -#: ../../whatsnew/3.13.rst:2453 +#: ../../whatsnew/3.13.rst:2412 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" @@ -4539,32 +4528,32 @@ msgstr "" ":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" "data:`!warnings.filters`。" -#: ../../whatsnew/3.13.rst:2455 +#: ../../whatsnew/3.13.rst:2414 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" -#: ../../whatsnew/3.13.rst:2457 +#: ../../whatsnew/3.13.rst:2416 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" -#: ../../whatsnew/3.13.rst:2459 +#: ../../whatsnew/3.13.rst:2418 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" -#: ../../whatsnew/3.13.rst:2461 +#: ../../whatsnew/3.13.rst:2420 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" -#: ../../whatsnew/3.13.rst:2463 +#: ../../whatsnew/3.13.rst:2422 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:23 msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" -#: ../../whatsnew/3.13.rst:2465 +#: ../../whatsnew/3.13.rst:2424 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" ":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" @@ -4573,32 +4562,32 @@ msgstr "" ":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" "`PYTHONHOME` 環境變數。" -#: ../../whatsnew/3.13.rst:2469 +#: ../../whatsnew/3.13.rst:2428 msgid "(Contributed by Victor Stinner in :gh:`105145`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2471 +#: ../../whatsnew/3.13.rst:2430 msgid "" ":term:`Soft deprecate ` the :c:func:`PyEval_GetBuiltins`, :" "c:func:`PyEval_GetGlobals`, and :c:func:`PyEval_GetLocals` functions, which " "return a :term:`borrowed reference`. (Soft deprecated as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2477 +#: ../../whatsnew/3.13.rst:2436 msgid "" "Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function, which is just " "an alias to :c:func:`PyImport_ImportModule` since Python 3.3. (Contributed " "by Victor Stinner in :gh:`105396`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2481 +#: ../../whatsnew/3.13.rst:2440 msgid "" ":term:`Soft deprecate ` the :c:func:`PyModule_AddObject` " "function. It should be replaced with :c:func:`PyModule_Add` or :c:func:" "`PyModule_AddObjectRef`. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2487 +#: ../../whatsnew/3.13.rst:2446 msgid "" "Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types and the :c:" "macro:`!Py_UNICODE_WIDE` define. Use the :c:type:`wchar_t` type directly " @@ -4607,7 +4596,7 @@ msgid "" "`105156`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2494 +#: ../../whatsnew/3.13.rst:2453 msgid "" "Deprecate the :c:func:`PyWeakref_GetObject` and :c:func:" "`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed reference`. " @@ -4968,55 +4957,55 @@ msgstr "" msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.13.rst:2514 +#: ../../whatsnew/3.13.rst:2473 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.13.rst:2516 +#: ../../whatsnew/3.13.rst:2475 msgid "" "``arm64-apple-ios`` and ``arm64-apple-ios-simulator`` are both now :pep:`11` " "tier 3 platforms. (:ref:`PEP 730 ` written and " "implementation contributed by Russell Keith-Magee in :gh:`114099`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2521 +#: ../../whatsnew/3.13.rst:2480 msgid "" "``aarch64-linux-android`` and ``x86_64-linux-android`` are both now :pep:" "`11` tier 3 platforms. (:ref:`PEP 738 ` " "written and implementation contributed by Malcolm Smith in :gh:`116622`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2526 +#: ../../whatsnew/3.13.rst:2485 msgid "" "``wasm32-wasi`` is now a :pep:`11` tier 2 platform. (Contributed by Brett " "Cannon in :gh:`115192`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2529 +#: ../../whatsnew/3.13.rst:2488 msgid "" "``wasm32-emscripten`` is no longer a :pep:`11` supported platform. " "(Contributed by Brett Cannon in :gh:`115192`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2532 +#: ../../whatsnew/3.13.rst:2491 msgid "" "Building CPython now requires a compiler with support for the C11 atomic " "library, GCC built-in atomic functions, or MSVC interlocked intrinsics." msgstr "" -#: ../../whatsnew/3.13.rst:2535 +#: ../../whatsnew/3.13.rst:2494 msgid "" "Autoconf 2.71 and aclocal 1.16.4 are now required to regenerate the :file:" "`configure` script. (Contributed by Christian Heimes in :gh:`89886`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2539 +#: ../../whatsnew/3.13.rst:2498 msgid "" "SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension " "module. (Contributed by Erlend Aasland in :gh:`105875`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2543 +#: ../../whatsnew/3.13.rst:2502 msgid "" "CPython now bundles the `mimalloc library`_ by default. It is licensed under " "the MIT license; see :ref:`mimalloc license `. The bundled " @@ -5024,28 +5013,28 @@ msgid "" "Dino Viehland in :gh:`109914`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2551 +#: ../../whatsnew/3.13.rst:2510 msgid "" "The :file:`configure` option :option:`--with-system-libmpdec` now defaults " "to ``yes``. The bundled copy of ``libmpdecimal`` will be removed in Python " "3.15." msgstr "" -#: ../../whatsnew/3.13.rst:2555 +#: ../../whatsnew/3.13.rst:2514 msgid "" "Python built with :file:`configure` :option:`--with-trace-refs` (tracing " "references) is now ABI compatible with the Python release build and :ref:" "`debug build `. (Contributed by Victor Stinner in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2560 +#: ../../whatsnew/3.13.rst:2519 msgid "" "On POSIX systems, the pkg-config (``.pc``) filenames now include the ABI " "flags. For example, the free-threaded build generates ``python-3.13t.pc`` " "and the debug build generates ``python-3.13d.pc``." msgstr "" -#: ../../whatsnew/3.13.rst:2564 +#: ../../whatsnew/3.13.rst:2523 msgid "" "The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``, " "``termios``, ``winsound``, ``_ctypes_test``, ``_multiprocessing." @@ -5055,27 +5044,27 @@ msgid "" "`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2573 +#: ../../whatsnew/3.13.rst:2532 msgid "Porting to Python 3.13" -msgstr "" +msgstr "移植至 Python 3.13" -#: ../../whatsnew/3.13.rst:2575 +#: ../../whatsnew/3.13.rst:2534 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.13.rst:2579 +#: ../../whatsnew/3.13.rst:2538 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.13.rst:2583 +#: ../../whatsnew/3.13.rst:2542 msgid "" ":ref:`PEP 667 ` introduces several changes to " "the semantics of :func:`locals` and :attr:`f_locals `:" msgstr "" -#: ../../whatsnew/3.13.rst:2586 +#: ../../whatsnew/3.13.rst:2545 msgid "" "Calling :func:`locals` in an :term:`optimized scope` now produces an " "independent snapshot on each call, and hence no longer implicitly updates " @@ -5087,7 +5076,7 @@ msgid "" "scope. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2595 +#: ../../whatsnew/3.13.rst:2554 msgid "" "Calling :func:`locals` from a comprehension at module or class scope " "(including via ``exec`` or ``eval``) once more behaves as if the " @@ -5097,7 +5086,7 @@ msgid "" "implementing :pep:`709`. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2602 +#: ../../whatsnew/3.13.rst:2561 msgid "" "Accessing :attr:`FrameType.f_locals ` in an :term:`optimized " "scope` now returns a write-through proxy rather than a snapshot that gets " @@ -5106,7 +5095,7 @@ msgid "" "of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2608 +#: ../../whatsnew/3.13.rst:2567 msgid "" ":class:`functools.partial` now emits a :exc:`FutureWarning` when used as a " "method. The behavior will change in future Python versions. Wrap it in :func:" @@ -5114,20 +5103,14 @@ msgid "" "Serhiy Storchaka in :gh:`121027`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2614 -msgid "" -"The :ref:`garbage collector is now incremental `, which means that the behavior of :func:`gc.collect` changes slightly:" -msgstr "" - -#: ../../whatsnew/3.13.rst:2621 +#: ../../whatsnew/3.13.rst:2573 msgid "" "An :exc:`OSError` is now raised by :func:`getpass.getuser` for any failure " "to retrieve a username, instead of :exc:`ImportError` on non-Unix platforms " "or :exc:`KeyError` on Unix platforms where the password database is empty." msgstr "" -#: ../../whatsnew/3.13.rst:2626 +#: ../../whatsnew/3.13.rst:2578 msgid "" "The value of the :attr:`!mode` attribute of :class:`gzip.GzipFile` is now a " "string (``'rb'`` or ``'wb'``) instead of an integer (``1`` or ``2``). The " @@ -5136,13 +5119,13 @@ msgid "" "(Contributed by Serhiy Storchaka in :gh:`115961`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2632 +#: ../../whatsnew/3.13.rst:2584 msgid "" ":class:`mailbox.Maildir` now ignores files with a leading dot (``.``). " "(Contributed by Zackery Spytz in :gh:`65559`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2635 +#: ../../whatsnew/3.13.rst:2587 msgid "" ":meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` now return both " "files and directories if a pattern that ends with \"``**``\" is given, " @@ -5150,25 +5133,25 @@ msgid "" "behavior and only match directories." msgstr "" -#: ../../whatsnew/3.13.rst:2640 +#: ../../whatsnew/3.13.rst:2592 msgid "" "The :mod:`threading` module now expects the :mod:`!_thread` module to have " "an :func:`!_is_main_interpreter` function. This function takes no arguments " "and returns ``True`` if the current interpreter is the main interpreter." msgstr "" -#: ../../whatsnew/3.13.rst:2645 +#: ../../whatsnew/3.13.rst:2597 msgid "" "Any library or application that provides a custom :mod:`!_thread` module " "must provide :func:`!_is_main_interpreter`, just like the module's other " "\"private\" attributes. (:gh:`112826`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2652 +#: ../../whatsnew/3.13.rst:2604 msgid "Changes in the C API" -msgstr "" +msgstr "C API 中的改動" -#: ../../whatsnew/3.13.rst:2654 +#: ../../whatsnew/3.13.rst:2606 msgid "" "``Python.h`` no longer includes the ```` standard header. It was " "included for the :c:func:`!finite` function which is now provided by the " @@ -5177,7 +5160,7 @@ msgid "" "`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2660 +#: ../../whatsnew/3.13.rst:2612 msgid "" "``Python.h`` no longer includes these standard header files: ````, " "```` and ````. If needed, they should now be " @@ -5188,7 +5171,7 @@ msgid "" "Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2668 +#: ../../whatsnew/3.13.rst:2620 msgid "" "On Windows, ``Python.h`` no longer includes the ```` standard " "header file. If needed, it should now be included explicitly. For example, " @@ -5198,7 +5181,7 @@ msgid "" "(Contributed by Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2675 +#: ../../whatsnew/3.13.rst:2627 msgid "" "If the :c:macro:`Py_LIMITED_API` macro is defined, :c:macro:`!" "Py_BUILD_CORE`, :c:macro:`!Py_BUILD_CORE_BUILTIN` and :c:macro:`!" @@ -5206,18 +5189,18 @@ msgid "" "(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2680 +#: ../../whatsnew/3.13.rst:2632 msgid "" "The old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " "``Py_TRASHCAN_SAFE_END`` were removed. They should be replaced by the new " "macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``." msgstr "" -#: ../../whatsnew/3.13.rst:2684 +#: ../../whatsnew/3.13.rst:2636 msgid "A ``tp_dealloc`` function that has the old macros, such as::" msgstr "" -#: ../../whatsnew/3.13.rst:2686 +#: ../../whatsnew/3.13.rst:2638 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -5228,12 +5211,20 @@ msgid "" " Py_TRASHCAN_SAFE_END\n" "}" msgstr "" +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_SAFE_BEGIN(p);\n" +" ...\n" +" Py_TRASHCAN_SAFE_END\n" +"}" -#: ../../whatsnew/3.13.rst:2695 +#: ../../whatsnew/3.13.rst:2647 msgid "should migrate to the new macros as follows::" msgstr "" -#: ../../whatsnew/3.13.rst:2697 +#: ../../whatsnew/3.13.rst:2649 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -5244,8 +5235,16 @@ msgid "" " Py_TRASHCAN_END\n" "}" msgstr "" +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_BEGIN(p, mytype_dealloc)\n" +" ...\n" +" Py_TRASHCAN_END\n" +"}" -#: ../../whatsnew/3.13.rst:2706 +#: ../../whatsnew/3.13.rst:2658 msgid "" "Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " "deallocation function it is in. The new macros were added in Python 3.8 and " @@ -5253,13 +5252,13 @@ msgid "" "in :gh:`105111`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2713 +#: ../../whatsnew/3.13.rst:2665 msgid "" ":ref:`PEP 667 ` introduces several changes to " "frame-related functions:" msgstr "" -#: ../../whatsnew/3.13.rst:2716 +#: ../../whatsnew/3.13.rst:2668 msgid "" "The effects of mutating the dictionary returned from :c:func:" "`PyEval_GetLocals` in an :term:`optimized scope` have changed. New dict " @@ -5273,7 +5272,7 @@ msgid "" "being used, so refer to the deprecation notice on the function for details." msgstr "" -#: ../../whatsnew/3.13.rst:2729 +#: ../../whatsnew/3.13.rst:2681 msgid "" "Calling :c:func:`PyFrame_GetLocals` in an :term:`optimized scope` now " "returns a write-through proxy rather than a snapshot that gets updated at " @@ -5282,25 +5281,25 @@ msgid "" "`PyEval_GetFrameLocals` API." msgstr "" -#: ../../whatsnew/3.13.rst:2736 +#: ../../whatsnew/3.13.rst:2688 msgid "" ":c:func:`!PyFrame_FastToLocals` and :c:func:`!PyFrame_FastToLocalsWithError` " "no longer have any effect. Calling these functions has been redundant since " "Python 3.11, when :c:func:`PyFrame_GetLocals` was first introduced." msgstr "" -#: ../../whatsnew/3.13.rst:2741 +#: ../../whatsnew/3.13.rst:2693 msgid "" ":c:func:`!PyFrame_LocalsToFast` no longer has any effect. Calling this " "function is redundant now that :c:func:`PyFrame_GetLocals` returns a write-" "through proxy for :term:`optimized scopes `." msgstr "" -#: ../../whatsnew/3.13.rst:2746 +#: ../../whatsnew/3.13.rst:2698 msgid "Regression Test Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2748 +#: ../../whatsnew/3.13.rst:2700 msgid "" "Python built with :file:`configure` :option:`--with-pydebug` now supports a :" "option:`-X presite=package.module <-X>` command-line option. If used, it " diff --git a/whatsnew/3.2.po b/whatsnew/3.2.po index 5f49805ffb..a451e0c31c 100644 --- a/whatsnew/3.2.po +++ b/whatsnew/3.2.po @@ -40,7 +40,7 @@ msgstr "" #: ../../whatsnew/3.2.rst:60 msgid ":pep:`392` - Python 3.2 Release Schedule" -msgstr "" +msgstr ":pep:`392` - Python 3.2 發佈時程" #: ../../whatsnew/3.2.rst:64 msgid "PEP 384: Defining a Stable ABI" @@ -4251,7 +4251,7 @@ msgstr "" #: ../../whatsnew/3.2.rst:2611 msgid "Porting to Python 3.2" -msgstr "" +msgstr "移植至 Python 3.2" #: ../../whatsnew/3.2.rst:2613 msgid "" diff --git a/whatsnew/3.3.po b/whatsnew/3.3.po index bba85bbba6..bd3546dee4 100644 --- a/whatsnew/3.3.po +++ b/whatsnew/3.3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,14 +27,17 @@ msgid "" "Python 3.3 was released on September 29, 2012. For full details, see the " "`changelog `_." msgstr "" +"本文介紹了 Python 3.3 與 3.2 相比多了哪些新功能。Python 3.1 已於 2012 年 9 " +"月 29 日發布。完整詳情請見 `changelog `_。" #: ../../whatsnew/3.3.rst:51 msgid ":pep:`398` - Python 3.3 Release Schedule" -msgstr ":pep:`398` - Python 3.3 發佈時間表" +msgstr ":pep:`398` - Python 3.3 發佈時程" #: ../../whatsnew/3.3.rst:55 msgid "Summary -- Release highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.3.rst:60 msgid "New syntax features:" @@ -216,7 +219,7 @@ msgid "" "dimensional NumPy-style arrays is explained." msgstr "" -#: ../../whatsnew/3.3.rst:161 ../../whatsnew/3.3.rst:1123 +#: ../../whatsnew/3.3.rst:161 ../../whatsnew/3.3.rst:1125 msgid "Features" msgstr "功能" @@ -253,7 +256,7 @@ msgid "" "now possible to reverse a memoryview in *O*\\ (1) by using a negative step." msgstr "" -#: ../../whatsnew/3.3.rst:180 ../../whatsnew/3.3.rst:1133 +#: ../../whatsnew/3.3.rst:180 ../../whatsnew/3.3.rst:1135 msgid "API changes" msgstr "API 變更" @@ -872,19 +875,19 @@ msgstr "" #: ../../whatsnew/3.3.rst:552 msgid "" -"Functions and class objects have a new ``__qualname__`` attribute " -"representing the \"path\" from the module top-level to their definition. " -"For global functions and classes, this is the same as ``__name__``. For " -"other functions and classes, it provides better information about where they " -"were actually defined, and how they might be accessible from the global " -"scope." +"Functions and class objects have a new :attr:`~definition.__qualname__` " +"attribute representing the \"path\" from the module top-level to their " +"definition. For global functions and classes, this is the same as :attr:" +"`~definition.__name__`. For other functions and classes, it provides better " +"information about where they were actually defined, and how they might be " +"accessible from the global scope." msgstr "" -#: ../../whatsnew/3.3.rst:558 +#: ../../whatsnew/3.3.rst:560 msgid "Example with (non-bound) methods::" msgstr "" -#: ../../whatsnew/3.3.rst:560 +#: ../../whatsnew/3.3.rst:562 msgid "" ">>> class C:\n" "... def meth(self):\n" @@ -904,11 +907,11 @@ msgstr "" ">>> C.meth.__qualname__\n" "'C.meth'" -#: ../../whatsnew/3.3.rst:569 +#: ../../whatsnew/3.3.rst:571 msgid "Example with nested classes::" msgstr "巢狀類別範例: ::" -#: ../../whatsnew/3.3.rst:571 +#: ../../whatsnew/3.3.rst:573 msgid "" ">>> class C:\n" "... class D:\n" @@ -938,11 +941,11 @@ msgstr "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" -#: ../../whatsnew/3.3.rst:585 +#: ../../whatsnew/3.3.rst:587 msgid "Example with nested functions::" msgstr "巢狀函式範例: ::" -#: ../../whatsnew/3.3.rst:587 +#: ../../whatsnew/3.3.rst:589 msgid "" ">>> def outer():\n" "... def inner():\n" @@ -964,13 +967,13 @@ msgstr "" ">>> outer().__qualname__\n" "'outer..inner'" -#: ../../whatsnew/3.3.rst:597 +#: ../../whatsnew/3.3.rst:599 msgid "" "The string representation of those objects is also changed to include the " "new, more precise information::" msgstr "" -#: ../../whatsnew/3.3.rst:600 +#: ../../whatsnew/3.3.rst:602 msgid "" ">>> str(C.D)\n" "\"\"\n" @@ -982,19 +985,19 @@ msgstr "" ">>> str(C.D.meth)\n" "''" -#: ../../whatsnew/3.3.rst:607 +#: ../../whatsnew/3.3.rst:609 msgid ":pep:`3155` - Qualified name for classes and functions" msgstr "" -#: ../../whatsnew/3.3.rst:608 +#: ../../whatsnew/3.3.rst:610 msgid "PEP written and implemented by Antoine Pitrou." msgstr "由 Antoine Pitrou 撰寫 PEP 與實作。" -#: ../../whatsnew/3.3.rst:614 +#: ../../whatsnew/3.3.rst:616 msgid "PEP 412: Key-Sharing Dictionary" msgstr "" -#: ../../whatsnew/3.3.rst:616 +#: ../../whatsnew/3.3.rst:618 msgid "" "Dictionaries used for the storage of objects' attributes are now able to " "share part of their internal storage between each other (namely, the part " @@ -1002,19 +1005,19 @@ msgid "" "consumption of programs creating many instances of non-builtin types." msgstr "" -#: ../../whatsnew/3.3.rst:623 +#: ../../whatsnew/3.3.rst:625 msgid ":pep:`412` - Key-Sharing Dictionary" msgstr ":pep:`412` - 密鑰共享字典" -#: ../../whatsnew/3.3.rst:624 +#: ../../whatsnew/3.3.rst:626 msgid "PEP written and implemented by Mark Shannon." msgstr "由 Mark Shannon 撰寫 PEP 與實作。" -#: ../../whatsnew/3.3.rst:628 +#: ../../whatsnew/3.3.rst:630 msgid "PEP 362: Function Signature Object" msgstr "PEP 362:函式簽名物件" -#: ../../whatsnew/3.3.rst:630 +#: ../../whatsnew/3.3.rst:632 msgid "" "A new function :func:`inspect.signature` makes introspection of python " "callables easy and straightforward. A broad range of callables is " @@ -1026,11 +1029,11 @@ msgid "" "code that validates or amends calling signatures or arguments." msgstr "" -#: ../../whatsnew/3.3.rst:641 +#: ../../whatsnew/3.3.rst:643 msgid ":pep:`362`: - Function Signature Object" msgstr ":pep:`362`: - 函式簽名物件" -#: ../../whatsnew/3.3.rst:642 +#: ../../whatsnew/3.3.rst:644 msgid "" "PEP written by Brett Cannon, Yury Selivanov, Larry Hastings, Jiwon Seo; " "implemented by Yury Selivanov." @@ -1038,11 +1041,11 @@ msgstr "" "PEP 由 Brett Cannon、Yury Selivanov、Larry Hastings、Jiwon Seo 撰寫;由 Yury " "Selivanov 實作。" -#: ../../whatsnew/3.3.rst:647 +#: ../../whatsnew/3.3.rst:649 msgid "PEP 421: Adding sys.implementation" msgstr "PEP 421:新增 sys.implementation" -#: ../../whatsnew/3.3.rst:649 +#: ../../whatsnew/3.3.rst:651 msgid "" "A new attribute on the :mod:`sys` module exposes details specific to the " "implementation of the currently running interpreter. The initial set of " @@ -1050,7 +1053,7 @@ msgid "" "``hexversion``, and ``cache_tag``." msgstr "" -#: ../../whatsnew/3.3.rst:654 +#: ../../whatsnew/3.3.rst:656 msgid "" "The intention of ``sys.implementation`` is to consolidate into one namespace " "the implementation-specific data used by the standard library. This allows " @@ -1060,7 +1063,7 @@ msgid "" "ratio will shift in order to make the standard library more portable." msgstr "" -#: ../../whatsnew/3.3.rst:661 +#: ../../whatsnew/3.3.rst:663 msgid "" "One example of improved standard library portability is ``cache_tag``. As " "of Python 3.3, ``sys.implementation.cache_tag`` is used by :mod:`importlib` " @@ -1069,11 +1072,11 @@ msgid "" "control the caching behavior for modules." msgstr "" -#: ../../whatsnew/3.3.rst:668 +#: ../../whatsnew/3.3.rst:670 msgid "SimpleNamespace" msgstr "SimpleNamespace" -#: ../../whatsnew/3.3.rst:670 +#: ../../whatsnew/3.3.rst:672 msgid "" "The implementation of ``sys.implementation`` also introduces a new type to " "Python: :class:`types.SimpleNamespace`. In contrast to a mapping-based " @@ -1083,19 +1086,19 @@ msgid "" "through normal attribute access." msgstr "" -#: ../../whatsnew/3.3.rst:679 +#: ../../whatsnew/3.3.rst:681 msgid ":pep:`421` - Adding sys.implementation" msgstr ":pep:`421` - 新增 sys.implementation" -#: ../../whatsnew/3.3.rst:680 +#: ../../whatsnew/3.3.rst:682 msgid "PEP written and implemented by Eric Snow." msgstr "由 Eric Snow 撰寫 PEP 與實作。" -#: ../../whatsnew/3.3.rst:686 +#: ../../whatsnew/3.3.rst:688 msgid "Using importlib as the Implementation of Import" msgstr "使用 importlib 作為 import 的實作" -#: ../../whatsnew/3.3.rst:687 +#: ../../whatsnew/3.3.rst:689 msgid "" ":issue:`2377` - Replace __import__ w/ importlib.__import__ :issue:`13959` - " "Re-implement parts of :mod:`!imp` in pure Python :issue:`14605` - Make " @@ -1103,7 +1106,7 @@ msgid "" "and __package__" msgstr "" -#: ../../whatsnew/3.3.rst:692 +#: ../../whatsnew/3.3.rst:694 msgid "" "The :func:`__import__` function is now powered by :func:`importlib." "__import__`. This work leads to the completion of \"phase 2\" of :pep:`302`. " @@ -1115,7 +1118,7 @@ msgid "" "import, allowing for future growth to occur." msgstr "" -#: ../../whatsnew/3.3.rst:701 +#: ../../whatsnew/3.3.rst:703 msgid "" "For the common user, there should be no visible change in semantics. For " "those whose code currently manipulates import or calls import " @@ -1123,18 +1126,18 @@ msgid "" "covered in the `Porting Python code`_ section of this document." msgstr "" -#: ../../whatsnew/3.3.rst:707 +#: ../../whatsnew/3.3.rst:709 msgid "New APIs" msgstr "新 API" -#: ../../whatsnew/3.3.rst:708 +#: ../../whatsnew/3.3.rst:710 msgid "" "One of the large benefits of this work is the exposure of what goes into " "making the import statement work. That means the various importers that were " "once implicit are now fully exposed as part of the :mod:`importlib` package." msgstr "" -#: ../../whatsnew/3.3.rst:712 +#: ../../whatsnew/3.3.rst:714 msgid "" "The abstract base classes defined in :mod:`importlib.abc` have been expanded " "to properly delineate between :term:`meta path finders ` " @@ -1145,14 +1148,14 @@ msgid "" "requirements." msgstr "" -#: ../../whatsnew/3.3.rst:720 +#: ../../whatsnew/3.3.rst:722 msgid "" "In terms of finders, :class:`importlib.machinery.FileFinder` exposes the " "mechanism used to search for source and bytecode files of a module. " "Previously this class was an implicit member of :data:`sys.path_hooks`." msgstr "" -#: ../../whatsnew/3.3.rst:724 +#: ../../whatsnew/3.3.rst:726 msgid "" "For loaders, the new abstract base class :class:`importlib.abc.FileLoader` " "helps write a loader that uses the file system as the storage mechanism for " @@ -1162,7 +1165,7 @@ msgid "" "ExtensionFileLoader`) are now available for direct use." msgstr "" -#: ../../whatsnew/3.3.rst:732 +#: ../../whatsnew/3.3.rst:734 msgid "" ":exc:`ImportError` now has ``name`` and ``path`` attributes which are set " "when there is relevant data to provide. The message for failed imports will " @@ -1170,24 +1173,24 @@ msgid "" "the module's name." msgstr "" -#: ../../whatsnew/3.3.rst:737 +#: ../../whatsnew/3.3.rst:739 msgid "" "The :func:`importlib.invalidate_caches` function will now call the method " "with the same name on all finders cached in :data:`sys.path_importer_cache` " "to help clean up any stored state as necessary." msgstr "" -#: ../../whatsnew/3.3.rst:742 +#: ../../whatsnew/3.3.rst:744 msgid "Visible Changes" msgstr "明顯的變更" -#: ../../whatsnew/3.3.rst:744 +#: ../../whatsnew/3.3.rst:746 msgid "" "For potential required changes to code, see the `Porting Python code`_ " "section." msgstr "" -#: ../../whatsnew/3.3.rst:747 +#: ../../whatsnew/3.3.rst:749 msgid "" "Beyond the expanse of what :mod:`importlib` now exposes, there are other " "visible changes to import. The biggest is that :data:`sys.meta_path` and :" @@ -1198,7 +1201,7 @@ msgid "" "fit one's needs." msgstr "" -#: ../../whatsnew/3.3.rst:754 +#: ../../whatsnew/3.3.rst:756 msgid "" "Another change is that all modules have a ``__loader__`` attribute, storing " "the loader used to create the module. :pep:`302` has been updated to make " @@ -1208,14 +1211,14 @@ msgid "" "load." msgstr "" -#: ../../whatsnew/3.3.rst:760 +#: ../../whatsnew/3.3.rst:762 msgid "" "Loaders are also now expected to set the ``__package__`` attribute from :pep:" "`366`. Once again, import itself is already setting this on all loaders " "from :mod:`importlib` and import itself is setting the attribute post-load." msgstr "" -#: ../../whatsnew/3.3.rst:764 +#: ../../whatsnew/3.3.rst:766 msgid "" "``None`` is now inserted into :data:`sys.path_importer_cache` when no finder " "can be found on :data:`sys.path_hooks`. Since :class:`!imp.NullImporter` is " @@ -1223,66 +1226,66 @@ msgid "" "upon to always be available to use as a value representing no finder found." msgstr "" -#: ../../whatsnew/3.3.rst:769 +#: ../../whatsnew/3.3.rst:771 msgid "" "All other changes relate to semantic changes which should be taken into " "consideration when updating code for Python 3.3, and thus should be read " "about in the `Porting Python code`_ section of this document." msgstr "" -#: ../../whatsnew/3.3.rst:773 +#: ../../whatsnew/3.3.rst:775 msgid "(Implementation by Brett Cannon)" msgstr "(由 Brett Cannon 實作)" -#: ../../whatsnew/3.3.rst:777 +#: ../../whatsnew/3.3.rst:779 msgid "Other Language Changes" msgstr "其他語言更動" -#: ../../whatsnew/3.3.rst:779 +#: ../../whatsnew/3.3.rst:781 msgid "Some smaller changes made to the core Python language are:" msgstr "對核心 Python 語言所做的一些較小的更改包括:" -#: ../../whatsnew/3.3.rst:781 +#: ../../whatsnew/3.3.rst:783 msgid "" "Added support for Unicode name aliases and named sequences. Both :func:" "`unicodedata.lookup` and ``'\\N{...}'`` now resolve name aliases, and :func:" "`unicodedata.lookup` resolves named sequences too." msgstr "" -#: ../../whatsnew/3.3.rst:785 +#: ../../whatsnew/3.3.rst:787 msgid "(Contributed by Ezio Melotti in :issue:`12753`.)" msgstr "(由 Ezio Melotti 在 :issue:`12753` 中貢獻。)" -#: ../../whatsnew/3.3.rst:787 +#: ../../whatsnew/3.3.rst:789 msgid "Unicode database updated to UCD version 6.1.0" msgstr "Unicode 資料庫更新至 UCD 版本 6.1.0" -#: ../../whatsnew/3.3.rst:789 +#: ../../whatsnew/3.3.rst:791 msgid "" "Equality comparisons on :func:`range` objects now return a result reflecting " "the equality of the underlying sequences generated by those range objects. (:" "issue:`13201`)" msgstr "" -#: ../../whatsnew/3.3.rst:793 +#: ../../whatsnew/3.3.rst:795 msgid "" "The ``count()``, ``find()``, ``rfind()``, ``index()`` and ``rindex()`` " "methods of :class:`bytes` and :class:`bytearray` objects now accept an " "integer between 0 and 255 as their first argument." msgstr "" -#: ../../whatsnew/3.3.rst:797 +#: ../../whatsnew/3.3.rst:799 msgid "(Contributed by Petri Lehtinen in :issue:`12170`.)" msgstr "(由 Petri Lehtinen 在 :issue:`12170` 中貢獻。)" -#: ../../whatsnew/3.3.rst:799 +#: ../../whatsnew/3.3.rst:801 msgid "" "The ``rjust()``, ``ljust()``, and ``center()`` methods of :class:`bytes` " "and :class:`bytearray` now accept a :class:`bytearray` for the ``fill`` " "argument. (Contributed by Petri Lehtinen in :issue:`12380`.)" msgstr "" -#: ../../whatsnew/3.3.rst:803 +#: ../../whatsnew/3.3.rst:805 msgid "" "New methods have been added to :class:`list` and :class:`bytearray`: " "``copy()`` and ``clear()`` (:issue:`10516`). Consequently, :class:" @@ -1290,40 +1293,40 @@ msgid "" "abc.MutableSequence.clear` method (:issue:`11388`)." msgstr "" -#: ../../whatsnew/3.3.rst:808 +#: ../../whatsnew/3.3.rst:810 msgid "" "Raw bytes literals can now be written ``rb\"...\"`` as well as ``br\"...\"``." msgstr "" -#: ../../whatsnew/3.3.rst:810 +#: ../../whatsnew/3.3.rst:812 msgid "(Contributed by Antoine Pitrou in :issue:`13748`.)" msgstr "(由 Antoine Pitrou 在 :issue:`13748` 中貢獻。)" -#: ../../whatsnew/3.3.rst:812 +#: ../../whatsnew/3.3.rst:814 msgid "" ":meth:`dict.setdefault` now does only one lookup for the given key, making " "it atomic when used with built-in types." msgstr "" -#: ../../whatsnew/3.3.rst:815 +#: ../../whatsnew/3.3.rst:817 msgid "(Contributed by Filip Gruszczyński in :issue:`13521`.)" msgstr "(由 Filip Gruszczyński 在 :issue:`13521` 中貢獻。)" -#: ../../whatsnew/3.3.rst:817 +#: ../../whatsnew/3.3.rst:819 msgid "" "The error messages produced when a function call does not match the function " "signature have been significantly improved." msgstr "" -#: ../../whatsnew/3.3.rst:820 +#: ../../whatsnew/3.3.rst:822 msgid "(Contributed by Benjamin Peterson.)" msgstr "(由 Benjamin Peterson 貢獻。)" -#: ../../whatsnew/3.3.rst:824 +#: ../../whatsnew/3.3.rst:826 msgid "A Finer-Grained Import Lock" msgstr "" -#: ../../whatsnew/3.3.rst:826 +#: ../../whatsnew/3.3.rst:828 msgid "" "Previous versions of CPython have always relied on a global import lock. " "This led to unexpected annoyances, such as deadlocks when importing a module " @@ -1332,7 +1335,7 @@ msgid "" "`PyImport_ImportModuleNoBlock` C API function." msgstr "" -#: ../../whatsnew/3.3.rst:832 +#: ../../whatsnew/3.3.rst:834 msgid "" "In Python 3.3, importing a module takes a per-module lock. This correctly " "serializes importation of a given module from multiple threads (preventing " @@ -1340,15 +1343,15 @@ msgid "" "aforementioned annoyances." msgstr "" -#: ../../whatsnew/3.3.rst:837 +#: ../../whatsnew/3.3.rst:839 msgid "(Contributed by Antoine Pitrou in :issue:`9260`.)" msgstr "(由 Antoine Pitrou 在 :issue:`9260` 中貢獻。)" -#: ../../whatsnew/3.3.rst:841 +#: ../../whatsnew/3.3.rst:843 msgid "Builtin functions and types" msgstr "內建函式和型別" -#: ../../whatsnew/3.3.rst:843 +#: ../../whatsnew/3.3.rst:845 msgid "" ":func:`open` gets a new *opener* parameter: the underlying file descriptor " "for the file object is then obtained by calling *opener* with (*file*, " @@ -1357,26 +1360,26 @@ msgid "" "the file already exists." msgstr "" -#: ../../whatsnew/3.3.rst:848 +#: ../../whatsnew/3.3.rst:850 msgid "" ":func:`print`: added the *flush* keyword argument. If the *flush* keyword " "argument is true, the stream is forcibly flushed." msgstr "" -#: ../../whatsnew/3.3.rst:850 +#: ../../whatsnew/3.3.rst:852 msgid "" ":func:`hash`: hash randomization is enabled by default, see :meth:`object." "__hash__` and :envvar:`PYTHONHASHSEED`." msgstr "" -#: ../../whatsnew/3.3.rst:852 +#: ../../whatsnew/3.3.rst:854 msgid "" "The :class:`str` type gets a new :meth:`~str.casefold` method: return a " "casefolded copy of the string, casefolded strings may be used for caseless " "matching. For example, ``'ß'.casefold()`` returns ``'ss'``." msgstr "" -#: ../../whatsnew/3.3.rst:855 +#: ../../whatsnew/3.3.rst:857 msgid "" "The sequence documentation has been substantially rewritten to better " "explain the binary/text sequence distinction and to provide specific " @@ -1384,15 +1387,15 @@ msgid "" "`4966`)." msgstr "" -#: ../../whatsnew/3.3.rst:862 +#: ../../whatsnew/3.3.rst:864 msgid "New Modules" msgstr "新模組" -#: ../../whatsnew/3.3.rst:865 +#: ../../whatsnew/3.3.rst:867 msgid "faulthandler" msgstr "faulthandler" -#: ../../whatsnew/3.3.rst:867 +#: ../../whatsnew/3.3.rst:869 msgid "" "This new debug module :mod:`faulthandler` contains functions to dump Python " "tracebacks explicitly, on a fault (a crash like a segmentation fault), after " @@ -1403,11 +1406,11 @@ msgid "" "by using :option:`-X` ``faulthandler`` command line option." msgstr "" -#: ../../whatsnew/3.3.rst:875 +#: ../../whatsnew/3.3.rst:877 msgid "Example of a segmentation fault on Linux:" msgstr "" -#: ../../whatsnew/3.3.rst:877 +#: ../../whatsnew/3.3.rst:879 msgid "" "$ python -q -X faulthandler\n" ">>> import ctypes\n" @@ -1431,45 +1434,45 @@ msgstr "" " File \"\", line 1 in \n" "Segmentation fault" -#: ../../whatsnew/3.3.rst:891 +#: ../../whatsnew/3.3.rst:893 msgid "ipaddress" msgstr "ipaddress" -#: ../../whatsnew/3.3.rst:893 +#: ../../whatsnew/3.3.rst:895 msgid "" "The new :mod:`ipaddress` module provides tools for creating and manipulating " "objects representing IPv4 and IPv6 addresses, networks and interfaces (i.e. " "an IP address associated with a specific IP subnet)." msgstr "" -#: ../../whatsnew/3.3.rst:897 +#: ../../whatsnew/3.3.rst:899 msgid "(Contributed by Google and Peter Moody in :pep:`3144`.)" msgstr "(由 Google 和 Peter Moody 在 :pep:`3144` 中貢獻。)" -#: ../../whatsnew/3.3.rst:900 +#: ../../whatsnew/3.3.rst:902 msgid "lzma" msgstr "lzma" -#: ../../whatsnew/3.3.rst:902 +#: ../../whatsnew/3.3.rst:904 msgid "" "The newly added :mod:`lzma` module provides data compression and " "decompression using the LZMA algorithm, including support for the ``.xz`` " "and ``.lzma`` file formats." msgstr "" -#: ../../whatsnew/3.3.rst:906 +#: ../../whatsnew/3.3.rst:908 msgid "(Contributed by Nadeem Vawda and Per Øyvind Karlsen in :issue:`6715`.)" msgstr "(由 Nadeem Vawda 和 Per Øyvind Karlsen 在 :issue:`6715` 中貢獻。)" -#: ../../whatsnew/3.3.rst:910 +#: ../../whatsnew/3.3.rst:912 msgid "Improved Modules" msgstr "改進的模組" -#: ../../whatsnew/3.3.rst:913 +#: ../../whatsnew/3.3.rst:915 msgid "abc" msgstr "abc" -#: ../../whatsnew/3.3.rst:915 +#: ../../whatsnew/3.3.rst:917 msgid "" "Improved support for abstract base classes containing descriptors composed " "with abstract methods. The recommended approach to declaring abstract " @@ -1477,7 +1480,7 @@ msgid "" "updated property. The built-in descriptors have been updated accordingly." msgstr "" -#: ../../whatsnew/3.3.rst:920 ../../whatsnew/3.3.rst:2246 +#: ../../whatsnew/3.3.rst:922 ../../whatsnew/3.3.rst:2248 msgid "" ":class:`abc.abstractproperty` has been deprecated, use :class:`property` " "with :func:`abc.abstractmethod` instead." @@ -1485,7 +1488,7 @@ msgstr "" ":class:`abc.abstractproperty` 已被棄用,請改 :class:`property` 和 :func:`abc." "abstractmethod`。" -#: ../../whatsnew/3.3.rst:922 ../../whatsnew/3.3.rst:2248 +#: ../../whatsnew/3.3.rst:924 ../../whatsnew/3.3.rst:2250 msgid "" ":class:`abc.abstractclassmethod` has been deprecated, use :class:" "`classmethod` with :func:`abc.abstractmethod` instead." @@ -1493,7 +1496,7 @@ msgstr "" ":class:`abc.abstractclassmethod` 已被棄用,請改用 :class:`classmethod` 和 :" "func:`abc.abstractmethod`。" -#: ../../whatsnew/3.3.rst:924 ../../whatsnew/3.3.rst:2250 +#: ../../whatsnew/3.3.rst:926 ../../whatsnew/3.3.rst:2252 msgid "" ":class:`abc.abstractstaticmethod` has been deprecated, use :class:" "`staticmethod` with :func:`abc.abstractmethod` instead." @@ -1501,35 +1504,35 @@ msgstr "" ":class:`abc.abstractstaticmethod` 已被棄用,請改用 :class:`staticmethod` 和 :" "func:`abc.abstractmethod`。" -#: ../../whatsnew/3.3.rst:927 +#: ../../whatsnew/3.3.rst:929 msgid "(Contributed by Darren Dale in :issue:`11610`.)" msgstr "(由 Darren Dale 在 :issue:`11610` 中貢獻。)" -#: ../../whatsnew/3.3.rst:929 +#: ../../whatsnew/3.3.rst:931 msgid "" ":meth:`abc.ABCMeta.register` now returns the registered subclass, which " "means it can now be used as a class decorator (:issue:`10868`)." msgstr "" -#: ../../whatsnew/3.3.rst:934 +#: ../../whatsnew/3.3.rst:936 msgid "array" msgstr "array" -#: ../../whatsnew/3.3.rst:936 +#: ../../whatsnew/3.3.rst:938 msgid "" "The :mod:`array` module supports the :c:expr:`long long` type using ``q`` " "and ``Q`` type codes." msgstr "" -#: ../../whatsnew/3.3.rst:939 +#: ../../whatsnew/3.3.rst:941 msgid "(Contributed by Oren Tirosh and Hirokazu Yamamoto in :issue:`1172711`.)" msgstr "(由 Oren Tirosh 和 Hirokazu Yamamoto 在 :issue:`1172711` 中貢獻。)" -#: ../../whatsnew/3.3.rst:943 +#: ../../whatsnew/3.3.rst:945 msgid "base64" msgstr "base64" -#: ../../whatsnew/3.3.rst:945 +#: ../../whatsnew/3.3.rst:947 msgid "" "ASCII-only Unicode strings are now accepted by the decoding functions of " "the :mod:`base64` modern interface. For example, ``base64." @@ -1537,44 +1540,44 @@ msgid "" "issue:`13641`.)" msgstr "" -#: ../../whatsnew/3.3.rst:951 +#: ../../whatsnew/3.3.rst:953 msgid "binascii" msgstr "binascii" -#: ../../whatsnew/3.3.rst:953 +#: ../../whatsnew/3.3.rst:955 msgid "" "In addition to the binary objects they normally accept, the ``a2b_`` " "functions now all also accept ASCII-only strings as input. (Contributed by " "Antoine Pitrou in :issue:`13637`.)" msgstr "" -#: ../../whatsnew/3.3.rst:959 +#: ../../whatsnew/3.3.rst:961 msgid "bz2" msgstr "bz2" -#: ../../whatsnew/3.3.rst:961 +#: ../../whatsnew/3.3.rst:963 msgid "" "The :mod:`bz2` module has been rewritten from scratch. In the process, " "several new features have been added:" msgstr "" -#: ../../whatsnew/3.3.rst:964 +#: ../../whatsnew/3.3.rst:966 msgid "" "New :func:`bz2.open` function: open a bzip2-compressed file in binary or " "text mode." msgstr "" -#: ../../whatsnew/3.3.rst:967 +#: ../../whatsnew/3.3.rst:969 msgid "" ":class:`bz2.BZ2File` can now read from and write to arbitrary file-like " "objects, by means of its constructor's *fileobj* argument." msgstr "" -#: ../../whatsnew/3.3.rst:970 +#: ../../whatsnew/3.3.rst:972 msgid "(Contributed by Nadeem Vawda in :issue:`5863`.)" msgstr "(由 Nadeem Vawda 在 :issue:`5863` 中貢獻。)" -#: ../../whatsnew/3.3.rst:972 +#: ../../whatsnew/3.3.rst:974 msgid "" ":class:`bz2.BZ2File` and :func:`bz2.decompress` can now decompress multi-" "stream inputs (such as those produced by the :program:`pbzip2` tool). :class:" @@ -1582,21 +1585,21 @@ msgid "" "``'a'`` (append) mode." msgstr "" -#: ../../whatsnew/3.3.rst:977 +#: ../../whatsnew/3.3.rst:979 msgid "(Contributed by Nir Aides in :issue:`1625`.)" msgstr "(由 Nir Aides 在 :issue:`1625` 中貢獻。)" -#: ../../whatsnew/3.3.rst:979 +#: ../../whatsnew/3.3.rst:981 msgid "" ":class:`bz2.BZ2File` now implements all of the :class:`io.BufferedIOBase` " "API, except for the :meth:`detach` and :meth:`truncate` methods." msgstr "" -#: ../../whatsnew/3.3.rst:984 +#: ../../whatsnew/3.3.rst:986 msgid "codecs" msgstr "codecs" -#: ../../whatsnew/3.3.rst:986 +#: ../../whatsnew/3.3.rst:988 msgid "" "The :mod:`~encodings.mbcs` codec has been rewritten to handle correctly " "``replace`` and ``ignore`` error handlers on all Windows versions. The :mod:" @@ -1604,7 +1607,7 @@ msgid "" "``replace`` to encode and ``ignore`` to decode." msgstr "" -#: ../../whatsnew/3.3.rst:991 +#: ../../whatsnew/3.3.rst:993 msgid "" "A new Windows-only codec has been added: ``cp65001`` (:issue:`13216`). It is " "the Windows code page 65001 (Windows UTF-8, ``CP_UTF8``). For example, it " @@ -1612,7 +1615,7 @@ msgid "" "(e.g., using ``chcp 65001`` command)." msgstr "" -#: ../../whatsnew/3.3.rst:996 +#: ../../whatsnew/3.3.rst:998 msgid "" "Multibyte CJK decoders now resynchronize faster. They only ignore the first " "byte of an invalid byte sequence. For example, ``b'\\xff\\n'." @@ -1620,17 +1623,17 @@ msgid "" "character." msgstr "" -#: ../../whatsnew/3.3.rst:1000 +#: ../../whatsnew/3.3.rst:1002 msgid "(:issue:`12016`)" msgstr "(:issue:`12016`)" -#: ../../whatsnew/3.3.rst:1002 +#: ../../whatsnew/3.3.rst:1004 msgid "" "Incremental CJK codec encoders are no longer reset at each call to their " "encode() methods. For example::" msgstr "" -#: ../../whatsnew/3.3.rst:1005 +#: ../../whatsnew/3.3.rst:1007 msgid "" ">>> import codecs\n" ">>> encoder = codecs.getincrementalencoder('hz')('strict')\n" @@ -1644,32 +1647,32 @@ msgstr "" "Bye.')\n" "b'~{NpJ)l6HK!#~} Bye.'" -#: ../../whatsnew/3.3.rst:1010 +#: ../../whatsnew/3.3.rst:1012 msgid "" "This example gives ``b'~{Np~}~{J)~}~{l6~}~{HK~}~{!#~} Bye.'`` with older " "Python versions." msgstr "" -#: ../../whatsnew/3.3.rst:1013 +#: ../../whatsnew/3.3.rst:1015 msgid "(:issue:`12100`)" msgstr "(:issue:`12100`)" -#: ../../whatsnew/3.3.rst:1015 +#: ../../whatsnew/3.3.rst:1017 msgid "The ``unicode_internal`` codec has been deprecated." msgstr "``unicode_internal`` 編解碼器已被棄用。" -#: ../../whatsnew/3.3.rst:1019 +#: ../../whatsnew/3.3.rst:1021 msgid "collections" msgstr "collections" -#: ../../whatsnew/3.3.rst:1021 +#: ../../whatsnew/3.3.rst:1023 msgid "" "Addition of a new :class:`~collections.ChainMap` class to allow treating a " "number of mappings as a single unit. (Written by Raymond Hettinger for :" "issue:`11089`, made public in :issue:`11297`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1025 +#: ../../whatsnew/3.3.rst:1027 msgid "" "The abstract base classes have been moved in a new :mod:`collections.abc` " "module, to better differentiate between the abstract and the concrete " @@ -1677,18 +1680,18 @@ msgid "" "`collections` module to preserve existing imports. (:issue:`11085`)" msgstr "" -#: ../../whatsnew/3.3.rst:1032 +#: ../../whatsnew/3.3.rst:1034 msgid "" "The :class:`~collections.Counter` class now supports the unary ``+`` and ``-" "`` operators, as well as the in-place operators ``+=``, ``-=``, ``|=``, and " "``&=``. (Contributed by Raymond Hettinger in :issue:`13121`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1038 +#: ../../whatsnew/3.3.rst:1040 msgid "contextlib" msgstr "contextlib" -#: ../../whatsnew/3.3.rst:1040 +#: ../../whatsnew/3.3.rst:1042 msgid "" ":class:`~contextlib.ExitStack` now provides a solid foundation for " "programmatic manipulation of context managers and similar cleanup " @@ -1700,46 +1703,46 @@ msgid "" "module)." msgstr "" -#: ../../whatsnew/3.3.rst:1049 +#: ../../whatsnew/3.3.rst:1051 msgid "(:issue:`13585`)" msgstr "(:issue:`13585`)" -#: ../../whatsnew/3.3.rst:1053 +#: ../../whatsnew/3.3.rst:1055 msgid "crypt" msgstr "crypt" -#: ../../whatsnew/3.3.rst:1055 +#: ../../whatsnew/3.3.rst:1057 msgid "" "Addition of salt and modular crypt format (hashing method) and the :func:`!" "mksalt` function to the :mod:`!crypt` module." msgstr "" -#: ../../whatsnew/3.3.rst:1058 +#: ../../whatsnew/3.3.rst:1060 msgid "(:issue:`10924`)" msgstr "(:issue:`10924`)" -#: ../../whatsnew/3.3.rst:1061 +#: ../../whatsnew/3.3.rst:1063 msgid "curses" msgstr "curses" -#: ../../whatsnew/3.3.rst:1063 +#: ../../whatsnew/3.3.rst:1065 msgid "" "If the :mod:`curses` module is linked to the ncursesw library, use Unicode " "functions when Unicode strings or characters are passed (e.g. :c:func:" "`waddwstr`), and bytes functions otherwise (e.g. :c:func:`waddstr`)." msgstr "" -#: ../../whatsnew/3.3.rst:1066 +#: ../../whatsnew/3.3.rst:1068 msgid "Use the locale encoding instead of ``utf-8`` to encode Unicode strings." msgstr "" -#: ../../whatsnew/3.3.rst:1067 +#: ../../whatsnew/3.3.rst:1069 msgid "" ":class:`curses.window` has a new :attr:`curses.window.encoding` attribute." msgstr "" ":class:`curses.window` 有一個新的 :attr:`curses.window.encoding` 屬性。" -#: ../../whatsnew/3.3.rst:1068 +#: ../../whatsnew/3.3.rst:1070 msgid "" "The :class:`curses.window` class has a new :meth:`~curses.window.get_wch` " "method to get a wide character" @@ -1747,59 +1750,59 @@ msgstr "" ":class:`curses.window` 類別有一個新的 :meth:`~curses.window.get_wch` 方法來獲" "取寬字元" -#: ../../whatsnew/3.3.rst:1070 +#: ../../whatsnew/3.3.rst:1072 msgid "" "The :mod:`curses` module has a new :meth:`~curses.unget_wch` function to " "push a wide character so the next :meth:`~curses.window.get_wch` will return " "it" msgstr "" -#: ../../whatsnew/3.3.rst:1074 +#: ../../whatsnew/3.3.rst:1076 msgid "(Contributed by Iñigo Serna in :issue:`6755`.)" msgstr "(由 Iñigo Serna 在 :issue:`6755` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1077 +#: ../../whatsnew/3.3.rst:1079 msgid "datetime" msgstr "datetime" -#: ../../whatsnew/3.3.rst:1079 +#: ../../whatsnew/3.3.rst:1081 msgid "" "Equality comparisons between naive and aware :class:`~datetime.datetime` " "instances now return :const:`False` instead of raising :exc:`TypeError` (:" "issue:`15006`)." msgstr "" -#: ../../whatsnew/3.3.rst:1082 +#: ../../whatsnew/3.3.rst:1084 msgid "" "New :meth:`datetime.datetime.timestamp` method: Return POSIX timestamp " "corresponding to the :class:`~datetime.datetime` instance." msgstr "" -#: ../../whatsnew/3.3.rst:1084 +#: ../../whatsnew/3.3.rst:1086 msgid "" "The :meth:`datetime.datetime.strftime` method supports formatting years " "older than 1000." msgstr "" -#: ../../whatsnew/3.3.rst:1086 +#: ../../whatsnew/3.3.rst:1088 msgid "" "The :meth:`datetime.datetime.astimezone` method can now be called without " "arguments to convert datetime instance to the system timezone." msgstr "" -#: ../../whatsnew/3.3.rst:1094 +#: ../../whatsnew/3.3.rst:1096 msgid "decimal" msgstr "decimal" -#: ../../whatsnew/3.3.rst:1096 +#: ../../whatsnew/3.3.rst:1098 msgid ":issue:`7652` - integrate fast native decimal arithmetic." msgstr "" -#: ../../whatsnew/3.3.rst:1097 +#: ../../whatsnew/3.3.rst:1099 msgid "C-module and libmpdec written by Stefan Krah." msgstr "由 Stefan Krah 編寫的 C 模組和 libmpdec。" -#: ../../whatsnew/3.3.rst:1099 +#: ../../whatsnew/3.3.rst:1101 msgid "" "The new C version of the decimal module integrates the high speed libmpdec " "library for arbitrary precision correctly rounded decimal floating-point " @@ -1807,7 +1810,7 @@ msgid "" "Specification." msgstr "" -#: ../../whatsnew/3.3.rst:1103 +#: ../../whatsnew/3.3.rst:1105 msgid "" "Performance gains range from 10x for database applications to 100x for " "numerically intensive applications. These numbers are expected gains for " @@ -1816,128 +1819,128 @@ msgid "" "integer bignum arithmetic the differences can be significantly higher." msgstr "" -#: ../../whatsnew/3.3.rst:1109 +#: ../../whatsnew/3.3.rst:1111 msgid "" "The following table is meant as an illustration. Benchmarks are available at " "https://www.bytereef.org/mpdecimal/quickstart.html." msgstr "" -#: ../../whatsnew/3.3.rst:1113 +#: ../../whatsnew/3.3.rst:1115 msgid "decimal.py" msgstr "decimal.py" -#: ../../whatsnew/3.3.rst:1113 +#: ../../whatsnew/3.3.rst:1115 msgid "_decimal" msgstr "_decimal" -#: ../../whatsnew/3.3.rst:1113 +#: ../../whatsnew/3.3.rst:1115 msgid "speedup" msgstr "speedup" -#: ../../whatsnew/3.3.rst:1115 +#: ../../whatsnew/3.3.rst:1117 msgid "pi" msgstr "pi" -#: ../../whatsnew/3.3.rst:1115 +#: ../../whatsnew/3.3.rst:1117 msgid "42.02s" msgstr "42.02s" -#: ../../whatsnew/3.3.rst:1115 +#: ../../whatsnew/3.3.rst:1117 msgid "0.345s" msgstr "0.345s" -#: ../../whatsnew/3.3.rst:1115 +#: ../../whatsnew/3.3.rst:1117 msgid "120x" msgstr "120x" -#: ../../whatsnew/3.3.rst:1117 +#: ../../whatsnew/3.3.rst:1119 msgid "telco" msgstr "telco" -#: ../../whatsnew/3.3.rst:1117 +#: ../../whatsnew/3.3.rst:1119 msgid "172.19s" msgstr "172.19s" -#: ../../whatsnew/3.3.rst:1117 +#: ../../whatsnew/3.3.rst:1119 msgid "5.68s" msgstr "5.68s" -#: ../../whatsnew/3.3.rst:1117 +#: ../../whatsnew/3.3.rst:1119 msgid "30x" msgstr "30x" -#: ../../whatsnew/3.3.rst:1119 +#: ../../whatsnew/3.3.rst:1121 msgid "psycopg" msgstr "psycopg" -#: ../../whatsnew/3.3.rst:1119 +#: ../../whatsnew/3.3.rst:1121 msgid "3.57s" msgstr "3.57s" -#: ../../whatsnew/3.3.rst:1119 +#: ../../whatsnew/3.3.rst:1121 msgid "0.29s" msgstr "0.29s" -#: ../../whatsnew/3.3.rst:1119 +#: ../../whatsnew/3.3.rst:1121 msgid "12x" msgstr "12x" -#: ../../whatsnew/3.3.rst:1125 +#: ../../whatsnew/3.3.rst:1127 msgid "" "The :exc:`~decimal.FloatOperation` signal optionally enables stricter " "semantics for mixing floats and Decimals." msgstr "" -#: ../../whatsnew/3.3.rst:1128 +#: ../../whatsnew/3.3.rst:1130 msgid "" "If Python is compiled without threads, the C version automatically disables " "the expensive thread local context machinery. In this case, the variable :" "const:`~decimal.HAVE_THREADS` is set to ``False``." msgstr "" -#: ../../whatsnew/3.3.rst:1135 +#: ../../whatsnew/3.3.rst:1137 msgid "" "The C module has the following context limits, depending on the machine " "architecture:" msgstr "" -#: ../../whatsnew/3.3.rst:1139 +#: ../../whatsnew/3.3.rst:1141 msgid "32-bit" msgstr "32 位元" -#: ../../whatsnew/3.3.rst:1139 +#: ../../whatsnew/3.3.rst:1141 msgid "64-bit" msgstr "64 位元" -#: ../../whatsnew/3.3.rst:1141 +#: ../../whatsnew/3.3.rst:1143 msgid ":const:`MAX_PREC`" msgstr ":const:`MAX_PREC`" -#: ../../whatsnew/3.3.rst:1141 ../../whatsnew/3.3.rst:1143 +#: ../../whatsnew/3.3.rst:1143 ../../whatsnew/3.3.rst:1145 msgid "``425000000``" msgstr "``425000000``" -#: ../../whatsnew/3.3.rst:1141 ../../whatsnew/3.3.rst:1143 +#: ../../whatsnew/3.3.rst:1143 ../../whatsnew/3.3.rst:1145 msgid "``999999999999999999``" msgstr "``999999999999999999``" -#: ../../whatsnew/3.3.rst:1143 +#: ../../whatsnew/3.3.rst:1145 msgid ":const:`MAX_EMAX`" msgstr ":const:`MAX_EMAX`" -#: ../../whatsnew/3.3.rst:1145 +#: ../../whatsnew/3.3.rst:1147 msgid ":const:`MIN_EMIN`" msgstr ":const:`MIN_EMIN`" -#: ../../whatsnew/3.3.rst:1145 +#: ../../whatsnew/3.3.rst:1147 msgid "``-425000000``" msgstr "``-425000000``" -#: ../../whatsnew/3.3.rst:1145 +#: ../../whatsnew/3.3.rst:1147 msgid "``-999999999999999999``" msgstr "``-999999999999999999``" -#: ../../whatsnew/3.3.rst:1148 +#: ../../whatsnew/3.3.rst:1150 msgid "" "In the context templates (:class:`~decimal.DefaultContext`, :class:`~decimal." "BasicContext` and :class:`~decimal.ExtendedContext`) the magnitude of :attr:" @@ -1945,7 +1948,7 @@ msgid "" "``999999``." msgstr "" -#: ../../whatsnew/3.3.rst:1153 +#: ../../whatsnew/3.3.rst:1155 msgid "" "The :class:`~decimal.Decimal` constructor in decimal.py does not observe the " "context limits and converts values with arbitrary exponents or precision " @@ -1956,7 +1959,7 @@ msgid "" "obtain a rounded or inexact value." msgstr "" -#: ../../whatsnew/3.3.rst:1162 +#: ../../whatsnew/3.3.rst:1164 msgid "" "The power function in decimal.py is always correctly rounded. In the C " "version, it is defined in terms of the correctly rounded :meth:`~decimal." @@ -1964,7 +1967,7 @@ msgid "" "is only \"almost always correctly rounded\"." msgstr "" -#: ../../whatsnew/3.3.rst:1168 +#: ../../whatsnew/3.3.rst:1170 msgid "" "In the C version, the context dictionary containing the signals is a :class:" "`~collections.abc.MutableMapping`. For speed reasons, :attr:`~decimal." @@ -1975,33 +1978,33 @@ msgid "" "do not reference the RHS dictionary." msgstr "" -#: ../../whatsnew/3.3.rst:1178 +#: ../../whatsnew/3.3.rst:1180 msgid "" "Pickling a :class:`~decimal.Context` produces a different output in order to " "have a common interchange format for the Python and C versions." msgstr "" -#: ../../whatsnew/3.3.rst:1182 +#: ../../whatsnew/3.3.rst:1184 msgid "" "The order of arguments in the :class:`~decimal.Context` constructor has been " "changed to match the order displayed by :func:`repr`." msgstr "" -#: ../../whatsnew/3.3.rst:1186 +#: ../../whatsnew/3.3.rst:1188 msgid "" "The ``watchexp`` parameter in the :meth:`~decimal.Decimal.quantize` method " "is deprecated." msgstr ":meth:`~decimal.Decimal.quantize` 方法中的 ``watchexp`` 參數已棄用。" -#: ../../whatsnew/3.3.rst:1193 +#: ../../whatsnew/3.3.rst:1195 msgid "email" msgstr "email" -#: ../../whatsnew/3.3.rst:1196 +#: ../../whatsnew/3.3.rst:1198 msgid "Policy Framework" msgstr "" -#: ../../whatsnew/3.3.rst:1198 +#: ../../whatsnew/3.3.rst:1200 msgid "" "The email package now has a :mod:`~email.policy` framework. A :class:" "`~email.policy.Policy` is an object with several methods and properties that " @@ -2017,52 +2020,52 @@ msgid "" "data:`~email.policy.compat32`." msgstr "" -#: ../../whatsnew/3.3.rst:1211 +#: ../../whatsnew/3.3.rst:1213 msgid "The minimum set of controls implemented by all ``policy`` objects are:" msgstr "" -#: ../../whatsnew/3.3.rst:1216 +#: ../../whatsnew/3.3.rst:1218 msgid "max_line_length" msgstr "max_line_length" -#: ../../whatsnew/3.3.rst:1216 +#: ../../whatsnew/3.3.rst:1218 msgid "" "The maximum length, excluding the linesep character(s), individual lines may " "have when a ``Message`` is serialized. Defaults to 78." msgstr "" -#: ../../whatsnew/3.3.rst:1220 +#: ../../whatsnew/3.3.rst:1222 msgid "linesep" msgstr "linesep" -#: ../../whatsnew/3.3.rst:1220 +#: ../../whatsnew/3.3.rst:1222 msgid "" "The character used to separate individual lines when a ``Message`` is " "serialized. Defaults to ``\\n``." msgstr "" -#: ../../whatsnew/3.3.rst:1223 +#: ../../whatsnew/3.3.rst:1225 msgid "cte_type" msgstr "cte_type" -#: ../../whatsnew/3.3.rst:1223 +#: ../../whatsnew/3.3.rst:1225 msgid "" "``7bit`` or ``8bit``. ``8bit`` applies only to a ``Bytes`` ``generator``, " "and means that non-ASCII may be used where allowed by the protocol (or where " "it exists in the original input)." msgstr "" -#: ../../whatsnew/3.3.rst:1228 +#: ../../whatsnew/3.3.rst:1230 msgid "raise_on_defect" msgstr "raise_on_defect" -#: ../../whatsnew/3.3.rst:1228 +#: ../../whatsnew/3.3.rst:1230 msgid "" "Causes a ``parser`` to raise error when defects are encountered instead of " "adding them to the ``Message`` object's ``defects`` list." msgstr "" -#: ../../whatsnew/3.3.rst:1233 +#: ../../whatsnew/3.3.rst:1235 msgid "" "A new policy instance, with new settings, is created using the :meth:`~email." "policy.Policy.clone` method of policy objects. ``clone`` takes any of the " @@ -2071,11 +2074,11 @@ msgid "" "``\\r\\n`` linesep characters like this::" msgstr "" -#: ../../whatsnew/3.3.rst:1239 +#: ../../whatsnew/3.3.rst:1241 msgid "mypolicy = compat32.clone(linesep='\\r\\n')" msgstr "mypolicy = compat32.clone(linesep='\\r\\n')" -#: ../../whatsnew/3.3.rst:1241 +#: ../../whatsnew/3.3.rst:1243 msgid "" "Policies can be used to make the generation of messages in the format needed " "by your application simpler. Instead of having to remember to specify " @@ -2088,11 +2091,11 @@ msgid "" "when you create the ``generator``." msgstr "" -#: ../../whatsnew/3.3.rst:1253 +#: ../../whatsnew/3.3.rst:1255 msgid "Provisional Policy with New Header API" msgstr "" -#: ../../whatsnew/3.3.rst:1255 +#: ../../whatsnew/3.3.rst:1257 msgid "" "While the policy framework is worthwhile all by itself, the main motivation " "for introducing it is to allow the creation of new policies that implement " @@ -2104,17 +2107,17 @@ msgid "" "the core developers." msgstr "" -#: ../../whatsnew/3.3.rst:1263 +#: ../../whatsnew/3.3.rst:1265 msgid "" "The new policies are instances of :class:`~email.policy.EmailPolicy`, and " "add the following additional controls:" msgstr "" -#: ../../whatsnew/3.3.rst:1269 +#: ../../whatsnew/3.3.rst:1271 msgid "refold_source" msgstr "refold_source" -#: ../../whatsnew/3.3.rst:1269 +#: ../../whatsnew/3.3.rst:1271 msgid "" "Controls whether or not headers parsed by a :mod:`~email.parser` are " "refolded by the :mod:`~email.generator`. It can be ``none``, ``long``, or " @@ -2123,17 +2126,17 @@ msgid "" "get refolded, and ``all`` means that all lines get refolded." msgstr "" -#: ../../whatsnew/3.3.rst:1278 +#: ../../whatsnew/3.3.rst:1280 msgid "header_factory" msgstr "header_factory" -#: ../../whatsnew/3.3.rst:1278 +#: ../../whatsnew/3.3.rst:1280 msgid "" "A callable that take a ``name`` and ``value`` and produces a custom header " "object." msgstr "" -#: ../../whatsnew/3.3.rst:1282 +#: ../../whatsnew/3.3.rst:1284 msgid "" "The ``header_factory`` is the key to the new features provided by the new " "policies. When one of the new policies is used, any header retrieved from a " @@ -2145,7 +2148,7 @@ msgid "" "now do things like this::" msgstr "" -#: ../../whatsnew/3.3.rst:1291 +#: ../../whatsnew/3.3.rst:1293 msgid "" ">>> m = Message(policy=SMTP)\n" ">>> m['To'] = 'Éric '\n" @@ -2187,7 +2190,7 @@ msgstr "" "To: =?utf-8?q?=C3=89ric?= \n" "Date: Fri, 25 May 2012 21:44:27 -0400" -#: ../../whatsnew/3.3.rst:1310 +#: ../../whatsnew/3.3.rst:1312 msgid "" "You will note that the unicode display name is automatically encoded as " "``utf-8`` when the message is serialized, but that when the header is " @@ -2196,11 +2199,11 @@ msgid "" "meth:`~email.header.make_header` functions." msgstr "" -#: ../../whatsnew/3.3.rst:1316 +#: ../../whatsnew/3.3.rst:1318 msgid "You can also create addresses from parts::" msgstr "" -#: ../../whatsnew/3.3.rst:1318 +#: ../../whatsnew/3.3.rst:1320 msgid "" ">>> m['cc'] = [Group('pals', [Address('Bob', 'bob', 'example.com'),\n" "... Address('Sally', 'sally', 'example.com')]),\n" @@ -2212,25 +2215,25 @@ msgid "" "" msgstr "" -#: ../../whatsnew/3.3.rst:1326 +#: ../../whatsnew/3.3.rst:1328 msgid "Decoding to unicode is done automatically::" msgstr "解碼為 unicode 是自動完成的: ::" -#: ../../whatsnew/3.3.rst:1328 +#: ../../whatsnew/3.3.rst:1330 msgid "" ">>> m2 = message_from_string(str(m))\n" ">>> m2['to']\n" "'Éric '" msgstr "" -#: ../../whatsnew/3.3.rst:1332 +#: ../../whatsnew/3.3.rst:1334 msgid "" "When you parse a message, you can use the ``addresses`` and ``groups`` " "attributes of the header objects to access the groups and individual " "addresses::" msgstr "" -#: ../../whatsnew/3.3.rst:1336 +#: ../../whatsnew/3.3.rst:1338 msgid "" ">>> m2['cc'].addresses\n" "(Address(display_name='Bob', username='bob', domain='example.com'), " @@ -2254,7 +2257,7 @@ msgstr "" "addresses=(Address(display_name='Bonzo', username='bonz', domain='laugh." "com'),))" -#: ../../whatsnew/3.3.rst:1341 +#: ../../whatsnew/3.3.rst:1343 msgid "" "In summary, if you use one of the new policies, header manipulation works " "the way it ought to: your application works with unicode strings, and the " @@ -2262,35 +2265,35 @@ msgid "" "RFC standard Content Transfer Encodings." msgstr "" -#: ../../whatsnew/3.3.rst:1347 +#: ../../whatsnew/3.3.rst:1349 msgid "Other API Changes" msgstr "其他 API 變更" -#: ../../whatsnew/3.3.rst:1349 +#: ../../whatsnew/3.3.rst:1351 msgid "" "New :class:`~email.parser.BytesHeaderParser`, added to the :mod:`~email." "parser` module to complement :class:`~email.parser.HeaderParser` and " "complete the Bytes API." msgstr "" -#: ../../whatsnew/3.3.rst:1353 +#: ../../whatsnew/3.3.rst:1355 msgid "New utility functions:" msgstr "新工具函式:" -#: ../../whatsnew/3.3.rst:1355 +#: ../../whatsnew/3.3.rst:1357 msgid "" ":func:`~email.utils.format_datetime`: given a :class:`~datetime.datetime`, " "produce a string formatted for use in an email header." msgstr "" -#: ../../whatsnew/3.3.rst:1358 +#: ../../whatsnew/3.3.rst:1360 msgid "" ":func:`~email.utils.parsedate_to_datetime`: given a date string from an " "email header, convert it into an aware :class:`~datetime.datetime`, or a " "naive :class:`~datetime.datetime` if the offset is ``-0000``." msgstr "" -#: ../../whatsnew/3.3.rst:1362 +#: ../../whatsnew/3.3.rst:1364 msgid "" ":func:`~email.utils.localtime`: With no argument, returns the current local " "time as an aware :class:`~datetime.datetime` using the local :class:" @@ -2299,11 +2302,11 @@ msgid "" "`~datetime.timezone`." msgstr "" -#: ../../whatsnew/3.3.rst:1370 +#: ../../whatsnew/3.3.rst:1372 msgid "ftplib" msgstr "ftplib" -#: ../../whatsnew/3.3.rst:1372 +#: ../../whatsnew/3.3.rst:1374 msgid "" ":class:`ftplib.FTP` now accepts a ``source_address`` keyword argument to " "specify the ``(host, port)`` to use as the source address in the bind call " @@ -2311,7 +2314,7 @@ msgid "" "issue:`8594`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1377 +#: ../../whatsnew/3.3.rst:1379 msgid "" "The :class:`~ftplib.FTP_TLS` class now provides a new :func:`~ftplib.FTP_TLS." "ccc` function to revert control channel back to plaintext. This can be " @@ -2320,18 +2323,18 @@ msgid "" "in :issue:`12139`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1383 +#: ../../whatsnew/3.3.rst:1385 msgid "" "Added :meth:`ftplib.FTP.mlsd` method which provides a parsable directory " "listing format and deprecates :meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP." "dir`. (Contributed by Giampaolo Rodolà in :issue:`11072`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1389 +#: ../../whatsnew/3.3.rst:1391 msgid "functools" msgstr "functools" -#: ../../whatsnew/3.3.rst:1391 +#: ../../whatsnew/3.3.rst:1393 msgid "" "The :func:`functools.lru_cache` decorator now accepts a ``typed`` keyword " "argument (that defaults to ``False`` to ensure that it caches values of " @@ -2339,32 +2342,32 @@ msgid "" "Raymond Hettinger in :issue:`13227`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1398 +#: ../../whatsnew/3.3.rst:1400 msgid "gc" msgstr "gc" -#: ../../whatsnew/3.3.rst:1400 +#: ../../whatsnew/3.3.rst:1402 msgid "" "It is now possible to register callbacks invoked by the garbage collector " "before and after collection using the new :data:`~gc.callbacks` list." msgstr "" -#: ../../whatsnew/3.3.rst:1405 +#: ../../whatsnew/3.3.rst:1407 msgid "hmac" msgstr "hmac" -#: ../../whatsnew/3.3.rst:1407 +#: ../../whatsnew/3.3.rst:1409 msgid "" "A new :func:`~hmac.compare_digest` function has been added to prevent side " "channel attacks on digests through timing analysis. (Contributed by Nick " "Coghlan and Christian Heimes in :issue:`15061`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1413 +#: ../../whatsnew/3.3.rst:1415 msgid "http" msgstr "http" -#: ../../whatsnew/3.3.rst:1415 +#: ../../whatsnew/3.3.rst:1417 msgid "" ":class:`http.server.BaseHTTPRequestHandler` now buffers the headers and " "writes them all at once when :meth:`~http.server.BaseHTTPRequestHandler." @@ -2374,24 +2377,24 @@ msgid "" "`3709`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1421 +#: ../../whatsnew/3.3.rst:1423 msgid "" ":class:`http.server` now produces valid ``HTML 4.01 strict`` output. " "(Contributed by Ezio Melotti in :issue:`13295`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1424 +#: ../../whatsnew/3.3.rst:1426 msgid "" ":class:`http.client.HTTPResponse` now has a :meth:`~http.client.HTTPResponse." "readinto` method, which means it can be used as an :class:`io.RawIOBase` " "class. (Contributed by John Kuhn in :issue:`13464`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1431 +#: ../../whatsnew/3.3.rst:1433 msgid "html" msgstr "html" -#: ../../whatsnew/3.3.rst:1433 +#: ../../whatsnew/3.3.rst:1435 msgid "" ":class:`html.parser.HTMLParser` is now able to parse broken markup without " "raising errors, therefore the *strict* argument of the constructor and the :" @@ -2404,7 +2407,7 @@ msgid "" "`12888`, :issue:`7311`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1443 +#: ../../whatsnew/3.3.rst:1445 msgid "" "A new :data:`~html.entities.html5` dictionary that maps HTML5 named " "character references to the equivalent Unicode character(s) (e.g. " @@ -2413,25 +2416,25 @@ msgid "" "(Contributed by Ezio Melotti in :issue:`11113` and :issue:`15156`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1451 +#: ../../whatsnew/3.3.rst:1453 msgid "imaplib" msgstr "imaplib" -#: ../../whatsnew/3.3.rst:1453 +#: ../../whatsnew/3.3.rst:1455 msgid "" "The :class:`~imaplib.IMAP4_SSL` constructor now accepts an SSLContext " "parameter to control parameters of the secure channel." msgstr "" -#: ../../whatsnew/3.3.rst:1456 +#: ../../whatsnew/3.3.rst:1458 msgid "(Contributed by Sijin Joseph in :issue:`8808`.)" msgstr "(由 Sijin Joseph 在 :issue:`8808` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1460 +#: ../../whatsnew/3.3.rst:1462 msgid "inspect" msgstr "inspect" -#: ../../whatsnew/3.3.rst:1462 +#: ../../whatsnew/3.3.rst:1464 msgid "" "A new :func:`~inspect.getclosurevars` function has been added. This function " "reports the current binding of all names referenced from the function body " @@ -2439,11 +2442,11 @@ msgid "" "internal state when testing code that relies on stateful closures." msgstr "" -#: ../../whatsnew/3.3.rst:1467 +#: ../../whatsnew/3.3.rst:1469 msgid "(Contributed by Meador Inge and Nick Coghlan in :issue:`13062`.)" msgstr "(由 Meador Inge 與 Nick Coghlan 在 :issue:`13062` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1469 +#: ../../whatsnew/3.3.rst:1471 msgid "" "A new :func:`~inspect.getgeneratorlocals` function has been added. This " "function reports the current binding of local variables in the generator's " @@ -2451,26 +2454,26 @@ msgid "" "generators." msgstr "" -#: ../../whatsnew/3.3.rst:1474 +#: ../../whatsnew/3.3.rst:1476 msgid "(Contributed by Meador Inge in :issue:`15153`.)" msgstr "(由 Meador Inge 於 :issue:`15153` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1477 +#: ../../whatsnew/3.3.rst:1479 msgid "io" msgstr "io" -#: ../../whatsnew/3.3.rst:1479 +#: ../../whatsnew/3.3.rst:1481 msgid "" "The :func:`~io.open` function has a new ``'x'`` mode that can be used to " "exclusively create a new file, and raise a :exc:`FileExistsError` if the " "file already exists. It is based on the C11 'x' mode to fopen()." msgstr "" -#: ../../whatsnew/3.3.rst:1483 +#: ../../whatsnew/3.3.rst:1485 msgid "(Contributed by David Townshend in :issue:`12760`.)" msgstr "(由 David Townshend 於 :issue:`12760` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1485 +#: ../../whatsnew/3.3.rst:1487 msgid "" "The constructor of the :class:`~io.TextIOWrapper` class has a new " "*write_through* optional argument. If *write_through* is ``True``, calls to :" @@ -2479,28 +2482,28 @@ msgid "" "its underlying binary buffer." msgstr "" -#: ../../whatsnew/3.3.rst:1493 +#: ../../whatsnew/3.3.rst:1495 msgid "itertools" msgstr "itertools" -#: ../../whatsnew/3.3.rst:1495 +#: ../../whatsnew/3.3.rst:1497 msgid "" ":func:`~itertools.accumulate` now takes an optional ``func`` argument for " "providing a user-supplied binary function." msgstr "" -#: ../../whatsnew/3.3.rst:1500 +#: ../../whatsnew/3.3.rst:1502 msgid "logging" msgstr "logging" -#: ../../whatsnew/3.3.rst:1502 +#: ../../whatsnew/3.3.rst:1504 msgid "" "The :func:`~logging.basicConfig` function now supports an optional " "``handlers`` argument taking an iterable of handlers to be added to the root " "logger." msgstr "" -#: ../../whatsnew/3.3.rst:1505 +#: ../../whatsnew/3.3.rst:1507 msgid "" "A class level attribute :attr:`~logging.handlers.SysLogHandler.append_nul` " "has been added to :class:`~logging.handlers.SysLogHandler` to allow control " @@ -2509,25 +2512,25 @@ msgid "" "log." msgstr "" -#: ../../whatsnew/3.3.rst:1513 +#: ../../whatsnew/3.3.rst:1515 msgid "math" msgstr "math" -#: ../../whatsnew/3.3.rst:1515 +#: ../../whatsnew/3.3.rst:1517 msgid "" "The :mod:`math` module has a new function, :func:`~math.log2`, which " "returns the base-2 logarithm of *x*." msgstr "" -#: ../../whatsnew/3.3.rst:1518 +#: ../../whatsnew/3.3.rst:1520 msgid "(Written by Mark Dickinson in :issue:`11888`.)" msgstr "(由 Mark Dickinson 於 :issue:`11888` 中撰寫)" -#: ../../whatsnew/3.3.rst:1522 +#: ../../whatsnew/3.3.rst:1524 msgid "mmap" msgstr "mmap" -#: ../../whatsnew/3.3.rst:1524 +#: ../../whatsnew/3.3.rst:1526 msgid "" "The :meth:`~mmap.mmap.read` method is now more compatible with other file-" "like objects: if the argument is omitted or specified as ``None``, it " @@ -2535,39 +2538,39 @@ msgid "" "(Contributed by Petri Lehtinen in :issue:`12021`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1531 +#: ../../whatsnew/3.3.rst:1533 msgid "multiprocessing" msgstr "multiprocessing" -#: ../../whatsnew/3.3.rst:1533 +#: ../../whatsnew/3.3.rst:1535 msgid "" "The new :func:`multiprocessing.connection.wait` function allows polling " "multiple objects (such as connections, sockets and pipes) with a timeout. " "(Contributed by Richard Oudkerk in :issue:`12328`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1537 +#: ../../whatsnew/3.3.rst:1539 msgid "" ":class:`multiprocessing.Connection` objects can now be transferred over " "multiprocessing connections. (Contributed by Richard Oudkerk in :issue:" "`4892`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1541 +#: ../../whatsnew/3.3.rst:1543 msgid "" ":class:`multiprocessing.Process` now accepts a ``daemon`` keyword argument " "to override the default behavior of inheriting the ``daemon`` flag from the " "parent process (:issue:`6064`)." msgstr "" -#: ../../whatsnew/3.3.rst:1545 +#: ../../whatsnew/3.3.rst:1547 msgid "" "New attribute :data:`multiprocessing.Process.sentinel` allows a program to " "wait on multiple :class:`~multiprocessing.Process` objects at one time using " "the appropriate OS primitives (for example, :mod:`select` on posix systems)." msgstr "" -#: ../../whatsnew/3.3.rst:1550 +#: ../../whatsnew/3.3.rst:1552 msgid "" "New methods :meth:`multiprocessing.pool.Pool.starmap` and :meth:" "`~multiprocessing.pool.Pool.starmap_async` provide :func:`itertools.starmap` " @@ -2576,18 +2579,18 @@ msgid "" "Schlawack in :issue:`12708`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1559 +#: ../../whatsnew/3.3.rst:1561 msgid "nntplib" msgstr "nntplib" -#: ../../whatsnew/3.3.rst:1561 +#: ../../whatsnew/3.3.rst:1563 msgid "" "The :class:`!nntplib.NNTP` class now supports the context management " "protocol to unconditionally consume :exc:`socket.error` exceptions and to " "close the NNTP connection when done::" msgstr "" -#: ../../whatsnew/3.3.rst:1565 +#: ../../whatsnew/3.3.rst:1567 msgid "" ">>> from nntplib import NNTP\n" ">>> with NNTP('news.gmane.org') as n:\n" @@ -2605,15 +2608,15 @@ msgstr "" "python.committers')\n" ">>>" -#: ../../whatsnew/3.3.rst:1572 +#: ../../whatsnew/3.3.rst:1574 msgid "(Contributed by Giampaolo Rodolà in :issue:`9795`.)" msgstr "(由 Giampaolo Rodolà 於 :issue:`9795` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1576 +#: ../../whatsnew/3.3.rst:1578 msgid "os" msgstr "os" -#: ../../whatsnew/3.3.rst:1578 +#: ../../whatsnew/3.3.rst:1580 msgid "" "The :mod:`os` module has a new :func:`~os.pipe2` function that makes it " "possible to create a pipe with :const:`~os.O_CLOEXEC` or :const:`~os." @@ -2621,7 +2624,7 @@ msgid "" "conditions in multi-threaded programs." msgstr "" -#: ../../whatsnew/3.3.rst:1583 +#: ../../whatsnew/3.3.rst:1585 msgid "" "The :mod:`os` module has a new :func:`~os.sendfile` function which provides " "an efficient \"zero-copy\" way for copying data from one file (or socket) " @@ -2632,12 +2635,12 @@ msgid "" "socket, e.g. for downloading a file." msgstr "" -#: ../../whatsnew/3.3.rst:1591 +#: ../../whatsnew/3.3.rst:1593 msgid "" "(Patch submitted by Ross Lagerwall and Giampaolo Rodolà in :issue:`10882`.)" msgstr "(由 Ross Lagerwall 和 Giampaolo Rodolà 於 :issue:`10882` 提交補丁。)" -#: ../../whatsnew/3.3.rst:1593 +#: ../../whatsnew/3.3.rst:1595 msgid "" "To avoid race conditions like symlink attacks and issues with temporary " "files and directories, it is more reliable (and also faster) to manipulate " @@ -2646,14 +2649,14 @@ msgid "" "`4761`, :issue:`10755` and :issue:`14626`)." msgstr "" -#: ../../whatsnew/3.3.rst:1599 +#: ../../whatsnew/3.3.rst:1601 msgid "" "The :mod:`os` module has a new :func:`~os.fwalk` function similar to :func:" "`~os.walk` except that it also yields file descriptors referring to the " "directories visited. This is especially useful to avoid symlink races." msgstr "" -#: ../../whatsnew/3.3.rst:1603 +#: ../../whatsnew/3.3.rst:1605 msgid "" "The following functions get new optional *dir_fd* (:ref:`paths relative to " "directory descriptors `) and/or *follow_symlinks* (:ref:`not " @@ -2667,7 +2670,7 @@ msgid "" "`os.supports_follows_symlinks`." msgstr "" -#: ../../whatsnew/3.3.rst:1614 +#: ../../whatsnew/3.3.rst:1616 msgid "" "The following functions now support a file descriptor for their path " "argument: :func:`~os.chdir`, :func:`~os.chmod`, :func:`~os.chown`, :func:" @@ -2676,7 +2679,7 @@ msgid "" "support for this can be checked via the :data:`os.supports_fd` set." msgstr "" -#: ../../whatsnew/3.3.rst:1620 +#: ../../whatsnew/3.3.rst:1622 msgid "" ":func:`~os.access` accepts an ``effective_ids`` keyword argument to turn on " "using the effective uid/gid rather than the real uid/gid in the access " @@ -2684,7 +2687,7 @@ msgid "" "supports_effective_ids` set." msgstr "" -#: ../../whatsnew/3.3.rst:1625 +#: ../../whatsnew/3.3.rst:1627 msgid "" "The :mod:`os` module has two new functions: :func:`~os.getpriority` and :" "func:`~os.setpriority`. They can be used to get or set process niceness/" @@ -2692,11 +2695,11 @@ msgid "" "processes instead of just the current one." msgstr "" -#: ../../whatsnew/3.3.rst:1630 +#: ../../whatsnew/3.3.rst:1632 msgid "(Patch submitted by Giampaolo Rodolà in :issue:`10784`.)" msgstr "(由 Giampaolo Rodolà 於 :issue:`10784` 提交補丁。)" -#: ../../whatsnew/3.3.rst:1632 +#: ../../whatsnew/3.3.rst:1634 msgid "" "The new :func:`os.replace` function allows cross-platform renaming of a file " "with overwriting the destination. With :func:`os.rename`, an existing " @@ -2704,7 +2707,7 @@ msgid "" "Windows. (Contributed by Antoine Pitrou in :issue:`8828`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1638 +#: ../../whatsnew/3.3.rst:1640 msgid "" "The stat family of functions (:func:`~os.stat`, :func:`~os.fstat`, and :func:" "`~os.lstat`) now support reading a file's timestamps with nanosecond " @@ -2713,7 +2716,7 @@ msgid "" "`14127`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1644 +#: ../../whatsnew/3.3.rst:1646 msgid "" "The new :func:`os.get_terminal_size` function queries the size of the " "terminal attached to a file descriptor. See also :func:`shutil." @@ -2721,14 +2724,14 @@ msgid "" "`13609`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1651 +#: ../../whatsnew/3.3.rst:1653 msgid "" "New functions to support Linux extended attributes (:issue:`12720`): :func:" "`~os.getxattr`, :func:`~os.listxattr`, :func:`~os.removexattr`, :func:`~os." "setxattr`." msgstr "" -#: ../../whatsnew/3.3.rst:1655 +#: ../../whatsnew/3.3.rst:1657 msgid "" "New interface to the scheduler. These functions control how a process is " "allocated CPU time by the operating system. New functions: :func:`~os." @@ -2739,90 +2742,90 @@ msgid "" "sched_setscheduler`, :func:`~os.sched_yield`," msgstr "" -#: ../../whatsnew/3.3.rst:1664 +#: ../../whatsnew/3.3.rst:1666 msgid "New functions to control the file system:" msgstr "" -#: ../../whatsnew/3.3.rst:1666 +#: ../../whatsnew/3.3.rst:1668 msgid "" ":func:`~os.posix_fadvise`: Announces an intention to access data in a " "specific pattern thus allowing the kernel to make optimizations." msgstr "" -#: ../../whatsnew/3.3.rst:1668 +#: ../../whatsnew/3.3.rst:1670 msgid "" ":func:`~os.posix_fallocate`: Ensures that enough disk space is allocated for " "a file." msgstr "" -#: ../../whatsnew/3.3.rst:1670 +#: ../../whatsnew/3.3.rst:1672 msgid ":func:`~os.sync`: Force write of everything to disk." msgstr "" -#: ../../whatsnew/3.3.rst:1672 +#: ../../whatsnew/3.3.rst:1674 msgid "Additional new posix functions:" msgstr "其他新的 posix 函式:" -#: ../../whatsnew/3.3.rst:1674 +#: ../../whatsnew/3.3.rst:1676 msgid "" ":func:`~os.lockf`: Apply, test or remove a POSIX lock on an open file " "descriptor." msgstr "" -#: ../../whatsnew/3.3.rst:1675 +#: ../../whatsnew/3.3.rst:1677 msgid "" ":func:`~os.pread`: Read from a file descriptor at an offset, the file offset " "remains unchanged." msgstr "" -#: ../../whatsnew/3.3.rst:1677 +#: ../../whatsnew/3.3.rst:1679 msgid "" ":func:`~os.pwrite`: Write to a file descriptor from an offset, leaving the " "file offset unchanged." msgstr "" -#: ../../whatsnew/3.3.rst:1679 +#: ../../whatsnew/3.3.rst:1681 msgid "" ":func:`~os.readv`: Read from a file descriptor into a number of writable " "buffers." msgstr "" -#: ../../whatsnew/3.3.rst:1680 +#: ../../whatsnew/3.3.rst:1682 msgid "" ":func:`~os.truncate`: Truncate the file corresponding to *path*, so that it " "is at most *length* bytes in size." msgstr "" -#: ../../whatsnew/3.3.rst:1682 +#: ../../whatsnew/3.3.rst:1684 msgid "" ":func:`~os.waitid`: Wait for the completion of one or more child processes." msgstr "" -#: ../../whatsnew/3.3.rst:1683 +#: ../../whatsnew/3.3.rst:1685 msgid "" ":func:`~os.writev`: Write the contents of *buffers* to a file descriptor, " "where *buffers* is an arbitrary sequence of buffers." msgstr "" -#: ../../whatsnew/3.3.rst:1685 +#: ../../whatsnew/3.3.rst:1687 msgid "" ":func:`~os.getgrouplist` (:issue:`9344`): Return list of group ids that " "specified user belongs to." msgstr "" -#: ../../whatsnew/3.3.rst:1688 +#: ../../whatsnew/3.3.rst:1690 msgid "" ":func:`~os.times` and :func:`~os.uname`: Return type changed from a tuple to " "a tuple-like object with named attributes." msgstr "" -#: ../../whatsnew/3.3.rst:1691 +#: ../../whatsnew/3.3.rst:1693 msgid "" "Some platforms now support additional constants for the :func:`~os.lseek` " "function, such as ``os.SEEK_HOLE`` and ``os.SEEK_DATA``." msgstr "" -#: ../../whatsnew/3.3.rst:1694 +#: ../../whatsnew/3.3.rst:1696 msgid "" "New constants :const:`~os.RTLD_LAZY`, :const:`~os.RTLD_NOW`, :const:`~os." "RTLD_GLOBAL`, :const:`~os.RTLD_LOCAL`, :const:`~os.RTLD_NODELETE`, :const:" @@ -2832,70 +2835,70 @@ msgid "" "mod:`DLFCN`. (Contributed by Victor Stinner in :issue:`13226`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1702 +#: ../../whatsnew/3.3.rst:1704 msgid "" ":func:`os.symlink` now accepts (and ignores) the ``target_is_directory`` " "keyword argument on non-Windows platforms, to ease cross-platform support." msgstr "" -#: ../../whatsnew/3.3.rst:1707 +#: ../../whatsnew/3.3.rst:1709 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.3.rst:1709 +#: ../../whatsnew/3.3.rst:1711 msgid "" "Tab-completion is now available not only for command names, but also their " "arguments. For example, for the ``break`` command, function and file names " "are completed." msgstr "" -#: ../../whatsnew/3.3.rst:1713 +#: ../../whatsnew/3.3.rst:1715 msgid "(Contributed by Georg Brandl in :issue:`14210`)" msgstr "(由 Georg Brandl 在 :issue:`14210` 中貢獻)" -#: ../../whatsnew/3.3.rst:1717 +#: ../../whatsnew/3.3.rst:1719 msgid "pickle" msgstr "pickle" -#: ../../whatsnew/3.3.rst:1719 +#: ../../whatsnew/3.3.rst:1721 msgid "" ":class:`pickle.Pickler` objects now have an optional :attr:`~pickle.Pickler." "dispatch_table` attribute allowing per-pickler reduction functions to be set." msgstr "" -#: ../../whatsnew/3.3.rst:1723 +#: ../../whatsnew/3.3.rst:1725 msgid "(Contributed by Richard Oudkerk in :issue:`14166`.)" msgstr "(由 Richard Oudkerk 在 :issue:`14166` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1727 +#: ../../whatsnew/3.3.rst:1729 msgid "pydoc" msgstr "pydoc" -#: ../../whatsnew/3.3.rst:1729 +#: ../../whatsnew/3.3.rst:1731 msgid "" "The Tk GUI and the :func:`~pydoc.serve` function have been removed from the :" "mod:`pydoc` module: ``pydoc -g`` and :func:`~pydoc.serve` have been " "deprecated in Python 3.2." msgstr "" -#: ../../whatsnew/3.3.rst:1735 +#: ../../whatsnew/3.3.rst:1737 msgid "re" msgstr "re" -#: ../../whatsnew/3.3.rst:1737 +#: ../../whatsnew/3.3.rst:1739 msgid "" ":class:`str` regular expressions now support ``\\u`` and ``\\U`` escapes." msgstr "" -#: ../../whatsnew/3.3.rst:1739 +#: ../../whatsnew/3.3.rst:1741 msgid "(Contributed by Serhiy Storchaka in :issue:`3665`.)" msgstr "(由 Serhiy Storchaka 在 :issue:`3665` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1743 +#: ../../whatsnew/3.3.rst:1745 msgid "sched" msgstr "sched" -#: ../../whatsnew/3.3.rst:1745 +#: ../../whatsnew/3.3.rst:1747 msgid "" ":meth:`~sched.scheduler.run` now accepts a *blocking* parameter which when " "set to false makes the method execute the scheduled events due to expire " @@ -2904,21 +2907,21 @@ msgid "" "(Contributed by Giampaolo Rodolà in :issue:`13449`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1751 +#: ../../whatsnew/3.3.rst:1753 msgid "" ":class:`~sched.scheduler` class can now be safely used in multi-threaded " "environments. (Contributed by Josiah Carlson and Giampaolo Rodolà in :issue:" "`8684`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1755 +#: ../../whatsnew/3.3.rst:1757 msgid "" "*timefunc* and *delayfunct* parameters of :class:`~sched.scheduler` class " "constructor are now optional and defaults to :func:`time.time` and :func:" "`time.sleep` respectively. (Contributed by Chris Clark in :issue:`13245`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1760 +#: ../../whatsnew/3.3.rst:1762 msgid "" ":meth:`~sched.scheduler.enter` and :meth:`~sched.scheduler.enterabs` " "*argument* parameter is now optional. (Contributed by Chris Clark in :issue:" @@ -2927,7 +2930,7 @@ msgstr "" ":meth:`~sched.scheduler.enter` 和 :meth:`~sched.scheduler.enterabs` " "*argument* 參數現在是可選的。(由 Chris Clark 在 :issue:`13245` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1764 +#: ../../whatsnew/3.3.rst:1766 msgid "" ":meth:`~sched.scheduler.enter` and :meth:`~sched.scheduler.enterabs` now " "accept a *kwargs* parameter. (Contributed by Chris Clark in :issue:`13245`.)" @@ -2935,22 +2938,22 @@ msgstr "" ":meth:`~sched.scheduler.enter` 和 :meth:`~sched.scheduler.enterabs` 現在接受 " "*kwargs* 參數。(由 Chris Clark 在 :issue:`13245` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1770 +#: ../../whatsnew/3.3.rst:1772 msgid "select" msgstr "select" -#: ../../whatsnew/3.3.rst:1772 +#: ../../whatsnew/3.3.rst:1774 msgid "" "Solaris and derivative platforms have a new class :class:`select.devpoll` " "for high performance asynchronous sockets via :file:`/dev/poll`. " "(Contributed by Jesús Cea Avión in :issue:`6397`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1778 +#: ../../whatsnew/3.3.rst:1780 msgid "shlex" msgstr "shlex" -#: ../../whatsnew/3.3.rst:1780 +#: ../../whatsnew/3.3.rst:1782 msgid "" "The previously undocumented helper function ``quote`` from the :mod:`!pipes` " "modules has been moved to the :mod:`shlex` module and documented. :func:" @@ -2958,35 +2961,35 @@ msgid "" "otherwise given special meaning by the shell." msgstr "" -#: ../../whatsnew/3.3.rst:1787 +#: ../../whatsnew/3.3.rst:1789 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.3.rst:1789 +#: ../../whatsnew/3.3.rst:1791 msgid "New functions:" msgstr "新功能:" -#: ../../whatsnew/3.3.rst:1791 +#: ../../whatsnew/3.3.rst:1793 msgid "" ":func:`~shutil.disk_usage`: provides total, used and free disk space " "statistics. (Contributed by Giampaolo Rodolà in :issue:`12442`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1793 +#: ../../whatsnew/3.3.rst:1795 msgid "" ":func:`~shutil.chown`: allows one to change user and/or group of the given " "path also specifying the user/group names and not only their numeric ids. " "(Contributed by Sandro Tosi in :issue:`12191`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1796 +#: ../../whatsnew/3.3.rst:1798 msgid "" ":func:`shutil.get_terminal_size`: returns the size of the terminal window to " "which the interpreter is attached. (Contributed by Zbigniew Jędrzejewski-" "Szmek in :issue:`13609`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1800 +#: ../../whatsnew/3.3.rst:1802 msgid "" ":func:`~shutil.copy2` and :func:`~shutil.copystat` now preserve file " "timestamps with nanosecond precision on platforms that support it. They also " @@ -2994,7 +2997,7 @@ msgid "" "Hastings in :issue:`14127` and :issue:`15238`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1805 +#: ../../whatsnew/3.3.rst:1807 msgid "" "Several functions now take an optional ``symlinks`` argument: when that " "parameter is true, symlinks aren't dereferenced and the operation instead " @@ -3002,7 +3005,7 @@ msgid "" "Hynek Schlawack in :issue:`12715`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1810 +#: ../../whatsnew/3.3.rst:1812 msgid "" "When copying files to a different file system, :func:`~shutil.move` now " "handles symlinks the way the posix ``mv`` command does, recreating the " @@ -3011,7 +3014,7 @@ msgid "" "the ``dst`` argument as its result." msgstr "" -#: ../../whatsnew/3.3.rst:1816 +#: ../../whatsnew/3.3.rst:1818 msgid "" ":func:`~shutil.rmtree` is now resistant to symlink attacks on platforms " "which support the new ``dir_fd`` parameter in :func:`os.open` and :func:`os." @@ -3019,53 +3022,53 @@ msgid "" "`4489`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1823 +#: ../../whatsnew/3.3.rst:1825 msgid "signal" msgstr "signal" -#: ../../whatsnew/3.3.rst:1825 +#: ../../whatsnew/3.3.rst:1827 msgid "The :mod:`signal` module has new functions:" msgstr ":mod:`signal` 模組有了新的函式:" -#: ../../whatsnew/3.3.rst:1827 +#: ../../whatsnew/3.3.rst:1829 msgid "" ":func:`~signal.pthread_sigmask`: fetch and/or change the signal mask of the " "calling thread (Contributed by Jean-Paul Calderone in :issue:`8407`);" msgstr "" -#: ../../whatsnew/3.3.rst:1829 +#: ../../whatsnew/3.3.rst:1831 msgid ":func:`~signal.pthread_kill`: send a signal to a thread;" msgstr ":func:`~signal.pthread_kill`:向執行緒發送訊號;" -#: ../../whatsnew/3.3.rst:1830 +#: ../../whatsnew/3.3.rst:1832 msgid ":func:`~signal.sigpending`: examine pending functions;" msgstr ":func:`~signal.sigpending`:檢查未定的函式;" -#: ../../whatsnew/3.3.rst:1831 +#: ../../whatsnew/3.3.rst:1833 msgid ":func:`~signal.sigwait`: wait a signal;" msgstr ":func:`~signal.sigwait`:等待訊號;" -#: ../../whatsnew/3.3.rst:1832 +#: ../../whatsnew/3.3.rst:1834 msgid "" ":func:`~signal.sigwaitinfo`: wait for a signal, returning detailed " "information about it;" msgstr ":func:`~signal.sigwaitinfo`:等待訊號,回傳有關該訊號的詳細資訊;" -#: ../../whatsnew/3.3.rst:1834 +#: ../../whatsnew/3.3.rst:1836 msgid "" ":func:`~signal.sigtimedwait`: like :func:`~signal.sigwaitinfo` but with a " "timeout." msgstr "" ":func:`~signal.sigtimedwait`:類似於 :func:`~signal.sigwaitinfo` 但有超時。" -#: ../../whatsnew/3.3.rst:1837 +#: ../../whatsnew/3.3.rst:1839 msgid "" "The signal handler writes the signal number as a single byte instead of a " "nul byte into the wakeup file descriptor. So it is possible to wait more " "than one signal and know which signals were raised." msgstr "" -#: ../../whatsnew/3.3.rst:1841 +#: ../../whatsnew/3.3.rst:1843 msgid "" ":func:`signal.signal` and :func:`signal.siginterrupt` raise an OSError, " "instead of a RuntimeError: OSError has an errno attribute." @@ -3073,29 +3076,29 @@ msgstr "" ":func:`signal.signal` 和 :func:`signal.siginterrupt` 會引發 OSError,而不是 " "RuntimeError:OSError 有一個 errno 屬性。" -#: ../../whatsnew/3.3.rst:1846 +#: ../../whatsnew/3.3.rst:1848 msgid "smtpd" msgstr "smtpd" -#: ../../whatsnew/3.3.rst:1848 +#: ../../whatsnew/3.3.rst:1850 msgid "" "The :mod:`!smtpd` module now supports :rfc:`5321` (extended SMTP) and :rfc:" "`1870` (size extension). Per the standard, these extensions are enabled if " "and only if the client initiates the session with an ``EHLO`` command." msgstr "" -#: ../../whatsnew/3.3.rst:1852 +#: ../../whatsnew/3.3.rst:1854 msgid "" "(Initial ``ELHO`` support by Alberto Trevino. Size extension by Juhana " "Jauhiainen. Substantial additional work on the patch contributed by Michele " "Orrù and Dan Boswell. :issue:`8739`)" msgstr "" -#: ../../whatsnew/3.3.rst:1858 +#: ../../whatsnew/3.3.rst:1860 msgid "smtplib" msgstr "smtplib" -#: ../../whatsnew/3.3.rst:1860 +#: ../../whatsnew/3.3.rst:1862 msgid "" "The :class:`~smtplib.SMTP`, :class:`~smtplib.SMTP_SSL`, and :class:`~smtplib." "LMTP` classes now accept a ``source_address`` keyword argument to specify " @@ -3104,7 +3107,7 @@ msgid "" "`11281`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1866 +#: ../../whatsnew/3.3.rst:1868 msgid "" ":class:`~smtplib.SMTP` now supports the context management protocol, " "allowing an ``SMTP`` instance to be used in a ``with`` statement. " @@ -3113,7 +3116,7 @@ msgstr "" ":class:`~smtplib.SMTP` 現在支援情境管理協議,允許在 ``with`` 陳述式中使用 " "``SMTP`` 實例。(由 Giampaolo Rodolà 在 :issue:`11289` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1870 +#: ../../whatsnew/3.3.rst:1872 msgid "" "The :class:`~smtplib.SMTP_SSL` constructor and the :meth:`~smtplib.SMTP." "starttls` method now accept an SSLContext parameter to control parameters of " @@ -3123,11 +3126,11 @@ msgstr "" "接受 SSLContext 參數來控制安全通道的參數。(由 Kasun Herath 在 :issue:`8809` " "中貢獻。)" -#: ../../whatsnew/3.3.rst:1876 +#: ../../whatsnew/3.3.rst:1878 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.3.rst:1878 +#: ../../whatsnew/3.3.rst:1880 msgid "" "The :class:`~socket.socket` class now exposes additional methods to process " "ancillary data when supported by the underlying platform:" @@ -3135,26 +3138,26 @@ msgstr "" "當底層平台支援時,:class:`~socket.socket` 類現在公開了額外的方法來處理輔助資" "料:" -#: ../../whatsnew/3.3.rst:1881 +#: ../../whatsnew/3.3.rst:1883 msgid ":func:`~socket.socket.sendmsg`" msgstr ":func:`~socket.socket.sendmsg`" -#: ../../whatsnew/3.3.rst:1882 +#: ../../whatsnew/3.3.rst:1884 msgid ":func:`~socket.socket.recvmsg`" msgstr ":func:`~socket.socket.recvmsg`" -#: ../../whatsnew/3.3.rst:1883 +#: ../../whatsnew/3.3.rst:1885 msgid ":func:`~socket.socket.recvmsg_into`" msgstr ":func:`~socket.socket.recvmsg_into`" -#: ../../whatsnew/3.3.rst:1885 +#: ../../whatsnew/3.3.rst:1887 msgid "" "(Contributed by David Watson in :issue:`6560`, based on an earlier patch by " "Heiko Wundram)" msgstr "" "(由 David Watson 在 :issue:`6560` 中貢獻,其基於 Heiko Wundram 的早期補丁)" -#: ../../whatsnew/3.3.rst:1888 +#: ../../whatsnew/3.3.rst:1890 msgid "" "The :class:`~socket.socket` class now supports the PF_CAN protocol family " "(https://en.wikipedia.org/wiki/Socketcan), on Linux (https://lwn.net/" @@ -3163,14 +3166,14 @@ msgstr "" ":class:`~socket.socket` 類別現在支援 Linux (https://lwn.net/Articles/253425) " "上的 PF_CAN 協議系列 (https://en.wikipedia.org/wiki/Socketcan)。" -#: ../../whatsnew/3.3.rst:1892 +#: ../../whatsnew/3.3.rst:1894 msgid "" "(Contributed by Matthias Fuchs, updated by Tiago Gonçalves in :issue:" "`10141`.)" msgstr "" "(在 :issue:`10141` 中由 Matthias Fuchs 貢獻、並由 Tiago Gonçalves 更新。)" -#: ../../whatsnew/3.3.rst:1894 +#: ../../whatsnew/3.3.rst:1896 msgid "" "The :class:`~socket.socket` class now supports the PF_RDS protocol family " "(https://en.wikipedia.org/wiki/Reliable_Datagram_Sockets and `https://oss." @@ -3182,7 +3185,7 @@ msgstr "" "`__\\ )。" -#: ../../whatsnew/3.3.rst:1898 +#: ../../whatsnew/3.3.rst:1900 msgid "" "The :class:`~socket.socket` class now supports the ``PF_SYSTEM`` protocol " "family on OS X. (Contributed by Michael Goderbauer in :issue:`13777`.)" @@ -3190,18 +3193,18 @@ msgstr "" ":class:`~socket.socket` 類別現在支援 OS X 上的 ``PF_SYSTEM`` 協議系列。(由 " "Michael Goderbauer 在 :issue:`13777` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1901 +#: ../../whatsnew/3.3.rst:1903 msgid "" "New function :func:`~socket.sethostname` allows the hostname to be set on " "Unix systems if the calling process has sufficient privileges. (Contributed " "by Ross Lagerwall in :issue:`10866`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1907 +#: ../../whatsnew/3.3.rst:1909 msgid "socketserver" msgstr "socketserver" -#: ../../whatsnew/3.3.rst:1909 +#: ../../whatsnew/3.3.rst:1911 msgid "" ":class:`~socketserver.BaseServer` now has an overridable method :meth:" "`~socketserver.BaseServer.service_actions` that is called by the :meth:" @@ -3210,54 +3213,54 @@ msgid "" "processes. (Contributed by Justin Warkentin in :issue:`11109`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1917 +#: ../../whatsnew/3.3.rst:1919 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.3.rst:1919 +#: ../../whatsnew/3.3.rst:1921 msgid "" "New :class:`sqlite3.Connection` method :meth:`~sqlite3.Connection." "set_trace_callback` can be used to capture a trace of all sql commands " "processed by sqlite. (Contributed by Torsten Landschoff in :issue:`11688`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1926 +#: ../../whatsnew/3.3.rst:1928 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.3.rst:1928 +#: ../../whatsnew/3.3.rst:1930 msgid "The :mod:`ssl` module has two new random generation functions:" msgstr ":mod:`ssl` 模組有兩個新的隨機生成函式:" -#: ../../whatsnew/3.3.rst:1930 +#: ../../whatsnew/3.3.rst:1932 msgid "" ":func:`~ssl.RAND_bytes`: generate cryptographically strong pseudo-random " "bytes." msgstr ":func:`~ssl.RAND_bytes`:生成加密的強偽隨機位元組。" -#: ../../whatsnew/3.3.rst:1932 +#: ../../whatsnew/3.3.rst:1934 msgid ":func:`~ssl.RAND_pseudo_bytes`: generate pseudo-random bytes." msgstr ":func:`~ssl.RAND_pseudo_bytes`:生成偽隨機位元組。" -#: ../../whatsnew/3.3.rst:1934 +#: ../../whatsnew/3.3.rst:1936 msgid "(Contributed by Victor Stinner in :issue:`12049`.)" msgstr "(由 Victor Stinner 在 :issue:`12049` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1936 +#: ../../whatsnew/3.3.rst:1938 msgid "" "The :mod:`ssl` module now exposes a finer-grained exception hierarchy in " "order to make it easier to inspect the various kinds of errors. (Contributed " "by Antoine Pitrou in :issue:`11183`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1940 +#: ../../whatsnew/3.3.rst:1942 msgid "" ":meth:`~ssl.SSLContext.load_cert_chain` now accepts a *password* argument to " "be used if the private key is encrypted. (Contributed by Adam Simpkins in :" "issue:`12803`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1944 +#: ../../whatsnew/3.3.rst:1946 msgid "" "Diffie-Hellman key exchange, both regular and Elliptic Curve-based, is now " "supported through the :meth:`~ssl.SSLContext.load_dh_params` and :meth:`~ssl." @@ -3265,14 +3268,14 @@ msgid "" "`13626` and :issue:`13627`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1949 +#: ../../whatsnew/3.3.rst:1951 msgid "" "SSL sockets have a new :meth:`~ssl.SSLSocket.get_channel_binding` method " "allowing the implementation of certain authentication mechanisms such as " "SCRAM-SHA-1-PLUS. (Contributed by Jacek Konieczny in :issue:`12551`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1953 +#: ../../whatsnew/3.3.rst:1955 msgid "" "You can query the SSL compression algorithm used by an SSL socket, thanks to " "its new :meth:`~ssl.SSLSocket.compression` method. The new attribute :const:" @@ -3280,91 +3283,91 @@ msgid "" "Antoine Pitrou in :issue:`13634`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1958 +#: ../../whatsnew/3.3.rst:1960 msgid "" "Support has been added for the Next Protocol Negotiation extension using " "the :meth:`ssl.SSLContext.set_npn_protocols` method. (Contributed by Colin " "Marc in :issue:`14204`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1962 +#: ../../whatsnew/3.3.rst:1964 msgid "" "SSL errors can now be introspected more easily thanks to :attr:`~ssl." "SSLError.library` and :attr:`~ssl.SSLError.reason` attributes. (Contributed " "by Antoine Pitrou in :issue:`14837`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1966 +#: ../../whatsnew/3.3.rst:1968 msgid "" "The :func:`~ssl.get_server_certificate` function now supports IPv6. " "(Contributed by Charles-François Natali in :issue:`11811`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1969 +#: ../../whatsnew/3.3.rst:1971 msgid "" "New attribute :const:`~ssl.OP_CIPHER_SERVER_PREFERENCE` allows setting SSLv3 " "server sockets to use the server's cipher ordering preference rather than " "the client's (:issue:`13635`)." msgstr "" -#: ../../whatsnew/3.3.rst:1975 +#: ../../whatsnew/3.3.rst:1977 msgid "stat" msgstr "stat" -#: ../../whatsnew/3.3.rst:1977 +#: ../../whatsnew/3.3.rst:1979 msgid "" "The undocumented tarfile.filemode function has been moved to :func:`stat." "filemode`. It can be used to convert a file's mode to a string of the form '-" "rwxrwxrwx'." msgstr "" -#: ../../whatsnew/3.3.rst:1981 +#: ../../whatsnew/3.3.rst:1983 msgid "(Contributed by Giampaolo Rodolà in :issue:`14807`.)" msgstr "(由 Giampaolo Rodolà 在 :issue:`14807` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1985 +#: ../../whatsnew/3.3.rst:1987 msgid "struct" msgstr "struct" -#: ../../whatsnew/3.3.rst:1987 +#: ../../whatsnew/3.3.rst:1989 msgid "" "The :mod:`struct` module now supports :c:type:`ssize_t` and :c:type:`size_t` " "via the new codes ``n`` and ``N``, respectively. (Contributed by Antoine " "Pitrou in :issue:`3163`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1993 +#: ../../whatsnew/3.3.rst:1995 msgid "subprocess" msgstr "subprocess" -#: ../../whatsnew/3.3.rst:1995 +#: ../../whatsnew/3.3.rst:1997 msgid "" "Command strings can now be bytes objects on posix platforms. (Contributed " "by Victor Stinner in :issue:`8513`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1998 +#: ../../whatsnew/3.3.rst:2000 msgid "" "A new constant :const:`~subprocess.DEVNULL` allows suppressing output in a " "platform-independent fashion. (Contributed by Ross Lagerwall in :issue:" "`5870`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2004 +#: ../../whatsnew/3.3.rst:2006 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.3.rst:2006 +#: ../../whatsnew/3.3.rst:2008 msgid "" "The :mod:`sys` module has a new :data:`~sys.thread_info` :term:`named tuple` " "holding information about the thread implementation (:issue:`11223`)." msgstr "" -#: ../../whatsnew/3.3.rst:2012 +#: ../../whatsnew/3.3.rst:2014 msgid "tarfile" msgstr "tarfile" -#: ../../whatsnew/3.3.rst:2014 +#: ../../whatsnew/3.3.rst:2016 msgid "" ":mod:`tarfile` now supports ``lzma`` encoding via the :mod:`lzma` module. " "(Contributed by Lars Gustäbel in :issue:`5689`.)" @@ -3372,33 +3375,33 @@ msgstr "" ":mod:`tarfile` 現在透過 :mod:`lzma` 模組支援 ``lzma`` 編碼。(由 Lars " "Gustäbel 在 :issue:`5689` 中貢獻。)" -#: ../../whatsnew/3.3.rst:2019 +#: ../../whatsnew/3.3.rst:2021 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.3.rst:2021 +#: ../../whatsnew/3.3.rst:2023 msgid "" ":class:`tempfile.SpooledTemporaryFile`\\'s :meth:`~tempfile." "SpooledTemporaryFile.truncate` method now accepts a ``size`` parameter. " "(Contributed by Ryan Kelly in :issue:`9957`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2027 +#: ../../whatsnew/3.3.rst:2029 msgid "textwrap" msgstr "textwrap" -#: ../../whatsnew/3.3.rst:2029 +#: ../../whatsnew/3.3.rst:2031 msgid "" "The :mod:`textwrap` module has a new :func:`~textwrap.indent` that makes it " "straightforward to add a common prefix to selected lines in a block of text " "(:issue:`13857`)." msgstr "" -#: ../../whatsnew/3.3.rst:2035 +#: ../../whatsnew/3.3.rst:2037 msgid "threading" msgstr "threading" -#: ../../whatsnew/3.3.rst:2037 +#: ../../whatsnew/3.3.rst:2039 msgid "" ":class:`threading.Condition`, :class:`threading.Semaphore`, :class:" "`threading.BoundedSemaphore`, :class:`threading.Event`, and :class:" @@ -3407,14 +3410,14 @@ msgid "" "Araujo in :issue:`10968`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2043 +#: ../../whatsnew/3.3.rst:2045 msgid "" "The :class:`threading.Thread` constructor now accepts a ``daemon`` keyword " "argument to override the default behavior of inheriting the ``daemon`` flag " "value from the parent thread (:issue:`6064`)." msgstr "" -#: ../../whatsnew/3.3.rst:2047 +#: ../../whatsnew/3.3.rst:2049 msgid "" "The formerly private function ``_thread.get_ident`` is now available as the " "public function :func:`threading.get_ident`. This eliminates several cases " @@ -3423,42 +3426,42 @@ msgid "" "public interface." msgstr "" -#: ../../whatsnew/3.3.rst:2055 +#: ../../whatsnew/3.3.rst:2057 msgid "time" msgstr "time" -#: ../../whatsnew/3.3.rst:2057 +#: ../../whatsnew/3.3.rst:2059 msgid "The :pep:`418` added new functions to the :mod:`time` module:" msgstr ":pep:`418` 向 :mod:`time` 模組新增了新功能:" -#: ../../whatsnew/3.3.rst:2059 +#: ../../whatsnew/3.3.rst:2061 msgid ":func:`~time.get_clock_info`: Get information on a clock." msgstr ":func:`~time.get_clock_info`:獲取時鐘資訊。" -#: ../../whatsnew/3.3.rst:2060 +#: ../../whatsnew/3.3.rst:2062 msgid "" ":func:`~time.monotonic`: Monotonic clock (cannot go backward), not affected " "by system clock updates." msgstr "" ":func:`~time.monotonic`:單調時鐘(不能倒退),不受系統時鐘更新的影響。" -#: ../../whatsnew/3.3.rst:2062 +#: ../../whatsnew/3.3.rst:2064 msgid "" ":func:`~time.perf_counter`: Performance counter with the highest available " "resolution to measure a short duration." msgstr "" -#: ../../whatsnew/3.3.rst:2064 +#: ../../whatsnew/3.3.rst:2066 msgid "" ":func:`~time.process_time`: Sum of the system and user CPU time of the " "current process." msgstr ":func:`~time.process_time`:當前行程的系統和使用者 CPU 時間總和。" -#: ../../whatsnew/3.3.rst:2067 +#: ../../whatsnew/3.3.rst:2069 msgid "Other new functions:" msgstr "其他新功能:" -#: ../../whatsnew/3.3.rst:2069 +#: ../../whatsnew/3.3.rst:2071 msgid "" ":func:`~time.clock_getres`, :func:`~time.clock_gettime` and :func:`~time." "clock_settime` functions with :samp:`CLOCK_{xxx}` constants. (Contributed by " @@ -3468,35 +3471,35 @@ msgstr "" "clock_settime` 函式帶有 :samp:`CLOCK_{xxx}` 常數。(由 Victor Stinner 在 :" "issue:`10278` 中貢獻。)" -#: ../../whatsnew/3.3.rst:2073 +#: ../../whatsnew/3.3.rst:2075 msgid "" "To improve cross platform consistency, :func:`~time.sleep` now raises a :exc:" "`ValueError` when passed a negative sleep value. Previously this was an " "error on posix, but produced an infinite sleep on Windows." msgstr "" -#: ../../whatsnew/3.3.rst:2079 +#: ../../whatsnew/3.3.rst:2081 msgid "types" msgstr "types" -#: ../../whatsnew/3.3.rst:2081 +#: ../../whatsnew/3.3.rst:2083 msgid "" "Add a new :class:`types.MappingProxyType` class: Read-only proxy of a " "mapping. (:issue:`14386`)" msgstr "" -#: ../../whatsnew/3.3.rst:2085 +#: ../../whatsnew/3.3.rst:2087 msgid "" "The new functions :func:`types.new_class` and :func:`types.prepare_class` " "provide support for :pep:`3115` compliant dynamic type creation. (:issue:" "`14588`)" msgstr "" -#: ../../whatsnew/3.3.rst:2090 +#: ../../whatsnew/3.3.rst:2092 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.3.rst:2092 +#: ../../whatsnew/3.3.rst:2094 msgid "" ":meth:`.assertRaises`, :meth:`.assertRaisesRegex`, :meth:`.assertWarns`, " "and :meth:`.assertWarnsRegex` now accept a keyword argument *msg* when used " @@ -3504,37 +3507,37 @@ msgid "" "issue:`10775`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2097 +#: ../../whatsnew/3.3.rst:2099 msgid "" ":meth:`unittest.TestCase.run` now returns the :class:`~unittest.TestResult` " "object." msgstr "" ":meth:`unittest.TestCase.run` 現在回傳 :class:`~unittest.TestResult` 物件。" -#: ../../whatsnew/3.3.rst:2102 +#: ../../whatsnew/3.3.rst:2104 msgid "urllib" msgstr "urllib" -#: ../../whatsnew/3.3.rst:2104 +#: ../../whatsnew/3.3.rst:2106 msgid "" "The :class:`~urllib.request.Request` class, now accepts a *method* argument " "used by :meth:`~urllib.request.Request.get_method` to determine what HTTP " "method should be used. For example, this will send a ``'HEAD'`` request::" msgstr "" -#: ../../whatsnew/3.3.rst:2108 +#: ../../whatsnew/3.3.rst:2110 msgid ">>> urlopen(Request('https://www.python.org/', method='HEAD'))" msgstr ">>> urlopen(Request('https://www.python.org/', method='HEAD'))" -#: ../../whatsnew/3.3.rst:2110 +#: ../../whatsnew/3.3.rst:2112 msgid "(:issue:`1673007`)" msgstr "(:issue:`1673007`)" -#: ../../whatsnew/3.3.rst:2114 +#: ../../whatsnew/3.3.rst:2116 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.3.rst:2116 +#: ../../whatsnew/3.3.rst:2118 msgid "" "The :mod:`webbrowser` module supports more \"browsers\": Google Chrome " "(named :program:`chrome`, :program:`chromium`, :program:`chrome-browser` or :" @@ -3545,11 +3548,11 @@ msgid "" "latter by Matthias Klose in :issue:`14493`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2126 +#: ../../whatsnew/3.3.rst:2128 msgid "xml.etree.ElementTree" msgstr "xml.etree.ElementTree" -#: ../../whatsnew/3.3.rst:2128 +#: ../../whatsnew/3.3.rst:2130 msgid "" "The :mod:`xml.etree.ElementTree` module now imports its C accelerator by " "default; there is no longer a need to explicitly import :mod:`xml.etree." @@ -3560,62 +3563,62 @@ msgid "" "detailed reference." msgstr "" -#: ../../whatsnew/3.3.rst:2138 +#: ../../whatsnew/3.3.rst:2140 msgid "zlib" msgstr "zlib" -#: ../../whatsnew/3.3.rst:2140 +#: ../../whatsnew/3.3.rst:2142 msgid "" "New attribute :attr:`zlib.Decompress.eof` makes it possible to distinguish " "between a properly formed compressed stream and an incomplete or truncated " "one. (Contributed by Nadeem Vawda in :issue:`12646`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2144 +#: ../../whatsnew/3.3.rst:2146 msgid "" "New attribute :const:`zlib.ZLIB_RUNTIME_VERSION` reports the version string " "of the underlying ``zlib`` library that is loaded at runtime. (Contributed " "by Torsten Landschoff in :issue:`12306`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2150 +#: ../../whatsnew/3.3.rst:2152 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.3.rst:2152 +#: ../../whatsnew/3.3.rst:2154 msgid "Major performance enhancements have been added:" msgstr "" -#: ../../whatsnew/3.3.rst:2154 +#: ../../whatsnew/3.3.rst:2156 msgid "" "Thanks to :pep:`393`, some operations on Unicode strings have been optimized:" msgstr "" -#: ../../whatsnew/3.3.rst:2156 +#: ../../whatsnew/3.3.rst:2158 msgid "the memory footprint is divided by 2 to 4 depending on the text" msgstr "" -#: ../../whatsnew/3.3.rst:2157 +#: ../../whatsnew/3.3.rst:2159 msgid "" "encode an ASCII string to UTF-8 doesn't need to encode characters anymore, " "the UTF-8 representation is shared with the ASCII representation" msgstr "" -#: ../../whatsnew/3.3.rst:2159 +#: ../../whatsnew/3.3.rst:2161 msgid "the UTF-8 encoder has been optimized" msgstr "" -#: ../../whatsnew/3.3.rst:2160 +#: ../../whatsnew/3.3.rst:2162 msgid "" "repeating a single ASCII letter and getting a substring of an ASCII string " "is 4 times faster" msgstr "" -#: ../../whatsnew/3.3.rst:2163 +#: ../../whatsnew/3.3.rst:2165 msgid "UTF-8 is now 2x to 4x faster. UTF-16 encoding is now up to 10x faster." msgstr "" -#: ../../whatsnew/3.3.rst:2165 +#: ../../whatsnew/3.3.rst:2167 msgid "" "(Contributed by Serhiy Storchaka, :issue:`14624`, :issue:`14738` and :issue:" "`15026`.)" @@ -3623,79 +3626,79 @@ msgstr "" "(由 Serhiy Storchaka 於 :issue:`14624`、:issue:`14738` 和 :issue:`15026` 貢" "獻。)" -#: ../../whatsnew/3.3.rst:2170 +#: ../../whatsnew/3.3.rst:2172 msgid "Build and C API Changes" msgstr "建置和 C API 更改" -#: ../../whatsnew/3.3.rst:2172 +#: ../../whatsnew/3.3.rst:2174 msgid "Changes to Python's build process and to the C API include:" msgstr "Python 建置程序和 C API 的更改包括:" -#: ../../whatsnew/3.3.rst:2174 +#: ../../whatsnew/3.3.rst:2176 msgid "New :pep:`3118` related function:" msgstr "新的 :pep:`3118` 相關功能:" -#: ../../whatsnew/3.3.rst:2176 +#: ../../whatsnew/3.3.rst:2178 msgid ":c:func:`PyMemoryView_FromMemory`" msgstr ":c:func:`PyMemoryView_FromMemory`" -#: ../../whatsnew/3.3.rst:2178 +#: ../../whatsnew/3.3.rst:2180 msgid ":pep:`393` added new Unicode types, macros and functions:" msgstr "" -#: ../../whatsnew/3.3.rst:2180 +#: ../../whatsnew/3.3.rst:2182 msgid "High-level API:" msgstr "高階 API:" -#: ../../whatsnew/3.3.rst:2182 +#: ../../whatsnew/3.3.rst:2184 msgid ":c:func:`PyUnicode_CopyCharacters`" msgstr ":c:func:`PyUnicode_CopyCharacters`" -#: ../../whatsnew/3.3.rst:2183 +#: ../../whatsnew/3.3.rst:2185 msgid ":c:func:`PyUnicode_FindChar`" msgstr ":c:func:`PyUnicode_FindChar`" -#: ../../whatsnew/3.3.rst:2184 +#: ../../whatsnew/3.3.rst:2186 msgid ":c:func:`PyUnicode_GetLength`, :c:macro:`PyUnicode_GET_LENGTH`" msgstr ":c:func:`PyUnicode_GetLength`, :c:macro:`PyUnicode_GET_LENGTH`" -#: ../../whatsnew/3.3.rst:2185 +#: ../../whatsnew/3.3.rst:2187 msgid ":c:func:`PyUnicode_New`" msgstr ":c:func:`PyUnicode_New`" -#: ../../whatsnew/3.3.rst:2186 +#: ../../whatsnew/3.3.rst:2188 msgid ":c:func:`PyUnicode_Substring`" msgstr ":c:func:`PyUnicode_Substring`" -#: ../../whatsnew/3.3.rst:2187 +#: ../../whatsnew/3.3.rst:2189 msgid ":c:func:`PyUnicode_ReadChar`, :c:func:`PyUnicode_WriteChar`" msgstr ":c:func:`PyUnicode_ReadChar`, :c:func:`PyUnicode_WriteChar`" -#: ../../whatsnew/3.3.rst:2189 +#: ../../whatsnew/3.3.rst:2191 msgid "Low-level API:" msgstr "低階 API:" -#: ../../whatsnew/3.3.rst:2191 +#: ../../whatsnew/3.3.rst:2193 msgid ":c:type:`Py_UCS1`, :c:type:`Py_UCS2`, :c:type:`Py_UCS4` types" msgstr ":c:type:`Py_UCS1`、:c:type:`Py_UCS2`、:c:type:`Py_UCS4` 型別" -#: ../../whatsnew/3.3.rst:2192 +#: ../../whatsnew/3.3.rst:2194 msgid ":c:type:`PyASCIIObject` and :c:type:`PyCompactUnicodeObject` structures" msgstr ":c:type:`PyASCIIObject` 和 :c:type:`PyCompactUnicodeObject` 結構" -#: ../../whatsnew/3.3.rst:2193 +#: ../../whatsnew/3.3.rst:2195 msgid ":c:macro:`PyUnicode_READY`" msgstr ":c:macro:`PyUnicode_READY`" -#: ../../whatsnew/3.3.rst:2194 +#: ../../whatsnew/3.3.rst:2196 msgid ":c:func:`PyUnicode_FromKindAndData`" msgstr ":c:func:`PyUnicode_FromKindAndData`" -#: ../../whatsnew/3.3.rst:2195 +#: ../../whatsnew/3.3.rst:2197 msgid ":c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsUCS4Copy`" msgstr ":c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsUCS4Copy`" -#: ../../whatsnew/3.3.rst:2196 +#: ../../whatsnew/3.3.rst:2198 msgid "" ":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:" "`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" @@ -3703,14 +3706,14 @@ msgstr "" ":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:" "`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" -#: ../../whatsnew/3.3.rst:2198 +#: ../../whatsnew/3.3.rst:2200 msgid "" ":c:macro:`PyUnicode_KIND` with :c:enum:`PyUnicode_Kind` enum: :c:data:`!" "PyUnicode_WCHAR_KIND`, :c:data:`PyUnicode_1BYTE_KIND`, :c:data:" "`PyUnicode_2BYTE_KIND`, :c:data:`PyUnicode_4BYTE_KIND`" msgstr "" -#: ../../whatsnew/3.3.rst:2201 +#: ../../whatsnew/3.3.rst:2203 msgid "" ":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:" "`PyUnicode_WRITE`" @@ -3718,11 +3721,11 @@ msgstr "" ":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:" "`PyUnicode_WRITE`" -#: ../../whatsnew/3.3.rst:2202 +#: ../../whatsnew/3.3.rst:2204 msgid ":c:macro:`PyUnicode_MAX_CHAR_VALUE`" msgstr ":c:macro:`PyUnicode_MAX_CHAR_VALUE`" -#: ../../whatsnew/3.3.rst:2204 +#: ../../whatsnew/3.3.rst:2206 msgid "" ":c:macro:`PyArg_ParseTuple` now accepts a :class:`bytearray` for the ``c`` " "format (:issue:`12380`)." @@ -3730,46 +3733,46 @@ msgstr "" ":c:macro:`PyArg_ParseTuple` 現在接受 :class:`bytearray` 為 ``c`` 格式 (:" "issue:`12380`)。" -#: ../../whatsnew/3.3.rst:2210 +#: ../../whatsnew/3.3.rst:2212 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.3.rst:2213 +#: ../../whatsnew/3.3.rst:2215 msgid "Unsupported Operating Systems" msgstr "不支援的作業系統" -#: ../../whatsnew/3.3.rst:2215 +#: ../../whatsnew/3.3.rst:2217 msgid "OS/2 and VMS are no longer supported due to the lack of a maintainer." msgstr "由於缺乏維護者,OS/2 和 VMS 不再受支援。" -#: ../../whatsnew/3.3.rst:2217 +#: ../../whatsnew/3.3.rst:2219 msgid "" "Windows 2000 and Windows platforms which set ``COMSPEC`` to ``command.com`` " "are no longer supported due to maintenance burden." msgstr "" -#: ../../whatsnew/3.3.rst:2220 +#: ../../whatsnew/3.3.rst:2222 msgid "OSF support, which was deprecated in 3.2, has been completely removed." msgstr "OSF 支援在 3.2 中已棄用,現已完全刪除。" -#: ../../whatsnew/3.3.rst:2224 +#: ../../whatsnew/3.3.rst:2226 msgid "Deprecated Python modules, functions and methods" msgstr "已棄用的 Python 模組、函式和方法" -#: ../../whatsnew/3.3.rst:2226 +#: ../../whatsnew/3.3.rst:2228 msgid "" "Passing a non-empty string to ``object.__format__()`` is deprecated, and " "will produce a :exc:`TypeError` in Python 3.4 (:issue:`9856`)." msgstr "" -#: ../../whatsnew/3.3.rst:2228 +#: ../../whatsnew/3.3.rst:2230 msgid "" "The ``unicode_internal`` codec has been deprecated because of the :pep:" "`393`, use UTF-8, UTF-16 (``utf-16-le`` or ``utf-16-be``), or UTF-32 " "(``utf-32-le`` or ``utf-32-be``)" msgstr "" -#: ../../whatsnew/3.3.rst:2231 +#: ../../whatsnew/3.3.rst:2233 msgid "" ":meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP.dir`: use :meth:`ftplib.FTP." "mlsd`" @@ -3777,7 +3780,7 @@ msgstr "" ":meth:`ftplib.FTP.nlst` 和 :meth:`ftplib.FTP.dir`:使用 :meth:`ftplib.FTP." "mlsd`" -#: ../../whatsnew/3.3.rst:2233 +#: ../../whatsnew/3.3.rst:2235 msgid "" ":func:`platform.popen`: use the :mod:`subprocess` module. Check especially " "the :ref:`subprocess-replacements` section (:issue:`11377`)." @@ -3785,39 +3788,39 @@ msgstr "" ":func:`platform.popen`:使用 :mod:`subprocess` 模組。請特別檢查 :ref:" "`subprocess-replacements` 部分 (:issue:`11377`)。" -#: ../../whatsnew/3.3.rst:2235 +#: ../../whatsnew/3.3.rst:2237 msgid "" ":issue:`13374`: The Windows bytes API has been deprecated in the :mod:`os` " "module. Use Unicode filenames, instead of bytes filenames, to not depend on " "the ANSI code page anymore and to support any filename." msgstr "" -#: ../../whatsnew/3.3.rst:2238 +#: ../../whatsnew/3.3.rst:2240 msgid "" ":issue:`13988`: The :mod:`xml.etree.cElementTree` module is deprecated. The " "accelerator is used automatically whenever available." msgstr "" -#: ../../whatsnew/3.3.rst:2240 +#: ../../whatsnew/3.3.rst:2242 msgid "" "The behaviour of :func:`time.clock` depends on the platform: use the new :" "func:`time.perf_counter` or :func:`time.process_time` function instead, " "depending on your requirements, to have a well defined behaviour." msgstr "" -#: ../../whatsnew/3.3.rst:2243 +#: ../../whatsnew/3.3.rst:2245 msgid "The :func:`os.stat_float_times` function is deprecated." msgstr ":func:`os.stat_float_times` 函式已棄用。" -#: ../../whatsnew/3.3.rst:2244 +#: ../../whatsnew/3.3.rst:2246 msgid ":mod:`abc` module:" msgstr ":mod:`abc` 模組:" -#: ../../whatsnew/3.3.rst:2253 +#: ../../whatsnew/3.3.rst:2255 msgid ":mod:`importlib` package:" msgstr ":mod:`importlib` 套件:" -#: ../../whatsnew/3.3.rst:2255 +#: ../../whatsnew/3.3.rst:2257 msgid "" ":meth:`importlib.abc.SourceLoader.path_mtime` is now deprecated in favour " "of :meth:`importlib.abc.SourceLoader.path_stats` as bytecode files now store " @@ -3825,11 +3828,11 @@ msgid "" "compiled from." msgstr "" -#: ../../whatsnew/3.3.rst:2265 +#: ../../whatsnew/3.3.rst:2267 msgid "Deprecated functions and types of the C API" msgstr "C API 中已棄用的函式和型別" -#: ../../whatsnew/3.3.rst:2267 +#: ../../whatsnew/3.3.rst:2269 msgid "" "The :c:type:`Py_UNICODE` has been deprecated by :pep:`393` and will be " "removed in Python 4. All functions using this type are deprecated:" @@ -3837,13 +3840,13 @@ msgstr "" ":c:type:`Py_UNICODE` 已被 :pep:`393` 棄用,並將在 Python 4 中刪除。所有使用此" "型別的函式均已棄用:" -#: ../../whatsnew/3.3.rst:2270 +#: ../../whatsnew/3.3.rst:2272 msgid "" "Unicode functions and methods using :c:type:`Py_UNICODE` and :c:expr:" "`Py_UNICODE*` types:" msgstr "" -#: ../../whatsnew/3.3.rst:2273 +#: ../../whatsnew/3.3.rst:2275 msgid "" ":c:macro:`!PyUnicode_FromUnicode`: use :c:func:`PyUnicode_FromWideChar` or :" "c:func:`PyUnicode_FromKindAndData`" @@ -3851,7 +3854,7 @@ msgstr "" ":c:macro:`!PyUnicode_FromUnicode`:使用 :c:func:`PyUnicode_FromWideChar` 或 :" "c:func:`PyUnicode_FromKindAndData`" -#: ../../whatsnew/3.3.rst:2275 +#: ../../whatsnew/3.3.rst:2277 msgid "" ":c:macro:`!PyUnicode_AS_UNICODE`, :c:func:`!PyUnicode_AsUnicode`, :c:func:`!" "PyUnicode_AsUnicodeAndSize`: use :c:func:`PyUnicode_AsWideCharString`" @@ -3859,7 +3862,7 @@ msgstr "" ":c:macro:`!PyUnicode_AS_UNICODE`、:c:func:`!PyUnicode_AsUnicode`、:c:func:`!" "PyUnicode_AsUnicodeAndSize`:使用 :c:func:`PyUnicode_AsWideCharString`" -#: ../../whatsnew/3.3.rst:2277 +#: ../../whatsnew/3.3.rst:2279 msgid "" ":c:macro:`!PyUnicode_AS_DATA`: use :c:macro:`PyUnicode_DATA` with :c:macro:" "`PyUnicode_READ` and :c:macro:`PyUnicode_WRITE`" @@ -3867,7 +3870,7 @@ msgstr "" ":c:macro:`!PyUnicode_AS_DATA`:將 :c:macro:`PyUnicode_DATA` 與 :c:macro:" "`PyUnicode_READ` 和 :c:macro:`PyUnicode_WRITE` 一起使用" -#: ../../whatsnew/3.3.rst:2279 +#: ../../whatsnew/3.3.rst:2281 msgid "" ":c:macro:`!PyUnicode_GET_SIZE`, :c:func:`!PyUnicode_GetSize`: use :c:macro:" "`PyUnicode_GET_LENGTH` or :c:func:`PyUnicode_GetLength`" @@ -3875,7 +3878,7 @@ msgstr "" ":c:macro:`!PyUnicode_GET_SIZE`、:c:func:`!PyUnicode_GetSize`:使用 :c:macro:" "`PyUnicode_GET_LENGTH` 或 :c:func:`PyUnicode_GetLength`" -#: ../../whatsnew/3.3.rst:2281 +#: ../../whatsnew/3.3.rst:2283 msgid "" ":c:macro:`!PyUnicode_GET_DATA_SIZE`: use ``PyUnicode_GET_LENGTH(str) * " "PyUnicode_KIND(str)`` (only work on ready strings)" @@ -3883,7 +3886,7 @@ msgstr "" ":c:macro:`!PyUnicode_GET_DATA_SIZE`:使用 ``PyUnicode_GET_LENGTH(str) * " "PyUnicode_KIND(str)``\\ (僅適用於準備好的字串)" -#: ../../whatsnew/3.3.rst:2284 +#: ../../whatsnew/3.3.rst:2286 msgid "" ":c:func:`!PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy` or :c:" "func:`PyUnicode_AsWideCharString`" @@ -3891,15 +3894,15 @@ msgstr "" ":c:func:`!PyUnicode_AsUnicodeCopy`:使用 :c:func:`PyUnicode_AsUCS4Copy` 或 :" "c:func:`PyUnicode_AsWideCharString`" -#: ../../whatsnew/3.3.rst:2286 +#: ../../whatsnew/3.3.rst:2288 msgid ":c:func:`!PyUnicode_GetMax`" msgstr ":c:func:`!PyUnicode_GetMax`" -#: ../../whatsnew/3.3.rst:2289 +#: ../../whatsnew/3.3.rst:2291 msgid "Functions and macros manipulating Py_UNICODE* strings:" msgstr "操作 Py_UNICODE* 字串的函式和巨集:" -#: ../../whatsnew/3.3.rst:2291 +#: ../../whatsnew/3.3.rst:2293 msgid "" ":c:macro:`!Py_UNICODE_strlen()`: use :c:func:`PyUnicode_GetLength` or :c:" "macro:`PyUnicode_GET_LENGTH`" @@ -3907,7 +3910,7 @@ msgstr "" ":c:macro:`!Py_UNICODE_strlen()`:使用 :c:func:`PyUnicode_GetLength` 或 :c:" "macro:`PyUnicode_GET_LENGTH`" -#: ../../whatsnew/3.3.rst:2293 +#: ../../whatsnew/3.3.rst:2295 msgid "" ":c:macro:`!Py_UNICODE_strcat()`: use :c:func:`PyUnicode_CopyCharacters` or :" "c:func:`PyUnicode_FromFormat`" @@ -3915,7 +3918,7 @@ msgstr "" ":c:macro:`!Py_UNICODE_strcat()`:使用 :c:func:`PyUnicode_CopyCharacters` 或 :" "c:func:`PyUnicode_FromFormat`" -#: ../../whatsnew/3.3.rst:2295 +#: ../../whatsnew/3.3.rst:2297 msgid "" ":c:macro:`!Py_UNICODE_strcpy()`, :c:macro:`!Py_UNICODE_strncpy()`, :c:macro:" "`!Py_UNICODE_COPY()`: use :c:func:`PyUnicode_CopyCharacters` or :c:func:" @@ -3925,15 +3928,15 @@ msgstr "" "`!Py_UNICODE_COPY()`:使用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:" "`PyUnicode_Substring`" -#: ../../whatsnew/3.3.rst:2298 +#: ../../whatsnew/3.3.rst:2300 msgid ":c:macro:`!Py_UNICODE_strcmp()`: use :c:func:`PyUnicode_Compare`" msgstr ":c:macro:`!Py_UNICODE_strcmp()`:使用 :c:func:`PyUnicode_Compare`" -#: ../../whatsnew/3.3.rst:2299 +#: ../../whatsnew/3.3.rst:2301 msgid ":c:macro:`!Py_UNICODE_strncmp()`: use :c:func:`PyUnicode_Tailmatch`" msgstr ":c:macro:`!Py_UNICODE_strncmp()`: 使用 :c:func:`PyUnicode_Tailmatch`" -#: ../../whatsnew/3.3.rst:2300 +#: ../../whatsnew/3.3.rst:2302 msgid "" ":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: use :c:" "func:`PyUnicode_FindChar`" @@ -3941,27 +3944,27 @@ msgstr "" ":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: 使用 :c:" "func:`PyUnicode_FindChar`" -#: ../../whatsnew/3.3.rst:2302 +#: ../../whatsnew/3.3.rst:2304 msgid ":c:macro:`!Py_UNICODE_FILL()`: use :c:func:`PyUnicode_Fill`" msgstr ":c:macro:`!Py_UNICODE_FILL()`: 使用 :c:func:`PyUnicode_Fill`" -#: ../../whatsnew/3.3.rst:2303 +#: ../../whatsnew/3.3.rst:2305 msgid ":c:macro:`!Py_UNICODE_MATCH`" msgstr ":c:macro:`!Py_UNICODE_MATCH`" -#: ../../whatsnew/3.3.rst:2305 +#: ../../whatsnew/3.3.rst:2307 msgid "Encoders:" msgstr "編碼器:" -#: ../../whatsnew/3.3.rst:2307 +#: ../../whatsnew/3.3.rst:2309 msgid ":c:func:`!PyUnicode_Encode`: use :c:func:`!PyUnicode_AsEncodedObject`" msgstr ":c:func:`!PyUnicode_Encode`:使用 :c:func:`!PyUnicode_AsEncodedObject`" -#: ../../whatsnew/3.3.rst:2308 +#: ../../whatsnew/3.3.rst:2310 msgid ":c:func:`!PyUnicode_EncodeUTF7`" msgstr ":c:func:`!PyUnicode_EncodeUTF7`" -#: ../../whatsnew/3.3.rst:2309 +#: ../../whatsnew/3.3.rst:2311 msgid "" ":c:func:`!PyUnicode_EncodeUTF8`: use :c:func:`PyUnicode_AsUTF8` or :c:func:" "`PyUnicode_AsUTF8String`" @@ -3969,15 +3972,15 @@ msgstr "" ":c:func:`!PyUnicode_EncodeUTF8`:使用 :c:func:`PyUnicode_AsUTF8` 或 :c:func:" "`PyUnicode_AsUTF8String`" -#: ../../whatsnew/3.3.rst:2311 +#: ../../whatsnew/3.3.rst:2313 msgid ":c:func:`!PyUnicode_EncodeUTF32`" msgstr ":c:func:`!PyUnicode_EncodeUTF32`" -#: ../../whatsnew/3.3.rst:2312 +#: ../../whatsnew/3.3.rst:2314 msgid ":c:func:`!PyUnicode_EncodeUTF16`" msgstr ":c:func:`!PyUnicode_EncodeUTF16`" -#: ../../whatsnew/3.3.rst:2313 +#: ../../whatsnew/3.3.rst:2315 msgid "" ":c:func:`!PyUnicode_EncodeUnicodeEscape` use :c:func:" "`PyUnicode_AsUnicodeEscapeString`" @@ -3985,7 +3988,7 @@ msgstr "" ":c:func:`!PyUnicode_EncodeUnicodeEscape` 使用 :c:func:" "`PyUnicode_AsUnicodeEscapeString`" -#: ../../whatsnew/3.3.rst:2315 +#: ../../whatsnew/3.3.rst:2317 msgid "" ":c:func:`!PyUnicode_EncodeRawUnicodeEscape` use :c:func:" "`PyUnicode_AsRawUnicodeEscapeString`" @@ -3993,26 +3996,26 @@ msgstr "" ":c:func:`!PyUnicode_EncodeRawUnicodeEscape` 使用 :c:func:" "`PyUnicode_AsRawUnicodeEscapeString`" -#: ../../whatsnew/3.3.rst:2317 +#: ../../whatsnew/3.3.rst:2319 msgid "" ":c:func:`!PyUnicode_EncodeLatin1`: use :c:func:`PyUnicode_AsLatin1String`" msgstr "" ":c:func:`!PyUnicode_EncodeLatin1`: 使用 :c:func:`PyUnicode_AsLatin1String`" -#: ../../whatsnew/3.3.rst:2318 +#: ../../whatsnew/3.3.rst:2320 msgid ":c:func:`!PyUnicode_EncodeASCII`: use :c:func:`PyUnicode_AsASCIIString`" msgstr "" ":c:func:`!PyUnicode_EncodeASCII`:使用 :c:func:`PyUnicode_AsASCIIString`" -#: ../../whatsnew/3.3.rst:2319 +#: ../../whatsnew/3.3.rst:2321 msgid ":c:func:`!PyUnicode_EncodeCharmap`" msgstr ":c:func:`!PyUnicode_EncodeCharmap`" -#: ../../whatsnew/3.3.rst:2320 +#: ../../whatsnew/3.3.rst:2322 msgid ":c:func:`!PyUnicode_TranslateCharmap`" msgstr ":c:func:`!PyUnicode_TranslateCharmap`" -#: ../../whatsnew/3.3.rst:2321 +#: ../../whatsnew/3.3.rst:2323 msgid "" ":c:func:`!PyUnicode_EncodeMBCS`: use :c:func:`PyUnicode_AsMBCSString` or :c:" "func:`PyUnicode_EncodeCodePage` (with ``CP_ACP`` code_page)" @@ -4020,7 +4023,7 @@ msgstr "" ":c:func:`!PyUnicode_EncodeMBCS`:使用 :c:func:`PyUnicode_AsMBCSString` 或 :c:" "func:`PyUnicode_EncodeCodePage` (帶有 ``CP_ACP`` code_page)" -#: ../../whatsnew/3.3.rst:2323 +#: ../../whatsnew/3.3.rst:2325 msgid "" ":c:func:`!PyUnicode_EncodeDecimal`, :c:func:`!" "PyUnicode_TransformDecimalToASCII`" @@ -4028,38 +4031,38 @@ msgstr "" ":c:func:`!PyUnicode_EncodeDecimal`、:c:func:`!" "PyUnicode_TransformDecimalToASCII`" -#: ../../whatsnew/3.3.rst:2328 +#: ../../whatsnew/3.3.rst:2330 msgid "Deprecated features" msgstr "已棄用的功能" -#: ../../whatsnew/3.3.rst:2330 +#: ../../whatsnew/3.3.rst:2332 msgid "" "The :mod:`array` module's ``'u'`` format code is now deprecated and will be " "removed in Python 4 together with the rest of the (:c:type:`Py_UNICODE`) API." msgstr "" -#: ../../whatsnew/3.3.rst:2335 +#: ../../whatsnew/3.3.rst:2337 msgid "Porting to Python 3.3" msgstr "移植到 Python 3.3" -#: ../../whatsnew/3.3.rst:2337 +#: ../../whatsnew/3.3.rst:2339 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "本節列出了前面描述的更改以及可能需要你更改程式碼的其他錯誤修復。" -#: ../../whatsnew/3.3.rst:2343 +#: ../../whatsnew/3.3.rst:2345 msgid "Porting Python code" msgstr "移植 Python 程式碼" -#: ../../whatsnew/3.3.rst:2345 +#: ../../whatsnew/3.3.rst:2347 msgid "" "Hash randomization is enabled by default. Set the :envvar:`PYTHONHASHSEED` " "environment variable to ``0`` to disable hash randomization. See also the :" "meth:`object.__hash__` method." msgstr "" -#: ../../whatsnew/3.3.rst:2349 +#: ../../whatsnew/3.3.rst:2351 msgid "" ":issue:`12326`: On Linux, sys.platform doesn't contain the major version " "anymore. It is now always 'linux', instead of 'linux2' or 'linux3' depending " @@ -4068,7 +4071,7 @@ msgid "" "if you don't need to support older Python versions." msgstr "" -#: ../../whatsnew/3.3.rst:2355 +#: ../../whatsnew/3.3.rst:2357 msgid "" ":issue:`13847`, :issue:`14180`: :mod:`time` and :mod:`datetime`: :exc:" "`OverflowError` is now raised instead of :exc:`ValueError` if a timestamp is " @@ -4076,7 +4079,7 @@ msgid "" "or :c:func:`localtime` failed." msgstr "" -#: ../../whatsnew/3.3.rst:2360 +#: ../../whatsnew/3.3.rst:2362 msgid "" "The default finders used by import now utilize a cache of what is contained " "within a specific directory. If you create a Python source file or " @@ -4085,7 +4088,7 @@ msgid "" "file." msgstr "" -#: ../../whatsnew/3.3.rst:2365 +#: ../../whatsnew/3.3.rst:2367 msgid "" ":exc:`ImportError` now uses the full name of the module that was attempted " "to be imported. Doctests that check ImportErrors' message will need to be " @@ -4093,7 +4096,7 @@ msgid "" "name." msgstr "" -#: ../../whatsnew/3.3.rst:2370 +#: ../../whatsnew/3.3.rst:2372 msgid "" "The *index* argument to :func:`__import__` now defaults to 0 instead of -1 " "and no longer support negative values. It was an oversight when :pep:`328` " @@ -4104,20 +4107,20 @@ msgid "" "import_module` rather than call :func:`__import__` directly." msgstr "" -#: ../../whatsnew/3.3.rst:2378 +#: ../../whatsnew/3.3.rst:2380 msgid "" ":func:`__import__` no longer allows one to use an index value other than 0 " "for top-level modules. E.g. ``__import__('sys', level=1)`` is now an error." msgstr "" -#: ../../whatsnew/3.3.rst:2381 +#: ../../whatsnew/3.3.rst:2383 msgid "" "Because :data:`sys.meta_path` and :data:`sys.path_hooks` now have finders on " "them by default, you will most likely want to use :meth:`list.insert` " "instead of :meth:`list.append` to add to those lists." msgstr "" -#: ../../whatsnew/3.3.rst:2385 +#: ../../whatsnew/3.3.rst:2387 msgid "" "Because ``None`` is now inserted into :data:`sys.path_importer_cache`, if " "you are clearing out entries in the dictionary of paths that do not have a " @@ -4128,7 +4131,7 @@ msgid "" "finders, but semantically it should not change anything." msgstr "" -#: ../../whatsnew/3.3.rst:2393 +#: ../../whatsnew/3.3.rst:2395 msgid "" ":class:`!importlib.abc.Finder` no longer specifies a ``find_module()`` " "abstract method that must be implemented. If you were relying on subclasses " @@ -4137,7 +4140,7 @@ msgid "" "in the case of working with :term:`path entry finders `." msgstr "" -#: ../../whatsnew/3.3.rst:2399 +#: ../../whatsnew/3.3.rst:2401 msgid "" ":mod:`pkgutil` has been converted to use :mod:`importlib` internally. This " "eliminates many edge cases where the old behaviour of the :pep:`302` import " @@ -4148,7 +4151,7 @@ msgid "" "do not provide the non-standard ``iter_modules()`` method." msgstr "" -#: ../../whatsnew/3.3.rst:2407 +#: ../../whatsnew/3.3.rst:2409 msgid "" "A longstanding RFC-compliance bug (:issue:`1079`) in the parsing done by :" "func:`email.header.decode_header` has been fixed. Code that uses the " @@ -4162,7 +4165,7 @@ msgid "" "already present in the input strings." msgstr "" -#: ../../whatsnew/3.3.rst:2418 +#: ../../whatsnew/3.3.rst:2420 msgid "" ":func:`email.utils.formataddr` now does the correct content transfer " "encoding when passed non-``ASCII`` display names. Any code that depended on " @@ -4170,7 +4173,7 @@ msgid "" "formatted output string will need to be changed (:issue:`1690608`)." msgstr "" -#: ../../whatsnew/3.3.rst:2423 +#: ../../whatsnew/3.3.rst:2425 msgid "" ":meth:`poplib.POP3.quit` may now raise protocol errors like all other " "``poplib`` methods. Code that assumes ``quit`` does not raise :exc:`poplib." @@ -4178,7 +4181,7 @@ msgid "" "encountered by a particular application (:issue:`11291`)." msgstr "" -#: ../../whatsnew/3.3.rst:2428 +#: ../../whatsnew/3.3.rst:2430 msgid "" "The ``strict`` argument to :class:`email.parser.Parser`, deprecated since " "Python 2.4, has finally been removed." @@ -4186,51 +4189,51 @@ msgstr "" "自 Python 2.4 以來已棄用的 :class:`email.parser.Parser` 的 ``strict`` 引數終" "於被刪除了。" -#: ../../whatsnew/3.3.rst:2431 +#: ../../whatsnew/3.3.rst:2433 msgid "" "The deprecated method ``unittest.TestCase.assertSameElements`` has been " "removed." msgstr "已棄用的方法 ``unittest.TestCase.assertSameElements`` 已被刪除。" -#: ../../whatsnew/3.3.rst:2434 +#: ../../whatsnew/3.3.rst:2436 msgid "The deprecated variable ``time.accept2dyear`` has been removed." msgstr "已棄用的變數 ``time.accept2dyear`` 已被刪除。" -#: ../../whatsnew/3.3.rst:2436 +#: ../../whatsnew/3.3.rst:2438 msgid "" "The deprecated ``Context._clamp`` attribute has been removed from the :mod:" "`decimal` module. It was previously replaced by the public attribute :attr:" "`~decimal.Context.clamp`. (See :issue:`8540`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2440 +#: ../../whatsnew/3.3.rst:2442 msgid "" "The undocumented internal helper class ``SSLFakeFile`` has been removed " "from :mod:`smtplib`, since its functionality has long been provided directly " "by :meth:`socket.socket.makefile`." msgstr "" -#: ../../whatsnew/3.3.rst:2444 +#: ../../whatsnew/3.3.rst:2446 msgid "" "Passing a negative value to :func:`time.sleep` on Windows now raises an " "error instead of sleeping forever. It has always raised an error on posix." msgstr "" -#: ../../whatsnew/3.3.rst:2447 +#: ../../whatsnew/3.3.rst:2449 msgid "" "The ``ast.__version__`` constant has been removed. If you need to make " "decisions affected by the AST version, use :data:`sys.version_info` to make " "the decision." msgstr "" -#: ../../whatsnew/3.3.rst:2451 +#: ../../whatsnew/3.3.rst:2453 msgid "" "Code that used to work around the fact that the :mod:`threading` module used " "factory functions by subclassing the private classes will need to change to " "subclass the now-public classes." msgstr "" -#: ../../whatsnew/3.3.rst:2455 +#: ../../whatsnew/3.3.rst:2457 msgid "" "The undocumented debugging machinery in the threading module has been " "removed, simplifying the code. This should have no effect on production " @@ -4238,24 +4241,24 @@ msgid "" "interacting with it (:issue:`13550`)." msgstr "" -#: ../../whatsnew/3.3.rst:2462 +#: ../../whatsnew/3.3.rst:2464 msgid "Porting C code" msgstr "" -#: ../../whatsnew/3.3.rst:2464 +#: ../../whatsnew/3.3.rst:2466 msgid "" "In the course of changes to the buffer API the undocumented :c:member:`!" "smalltable` member of the :c:type:`Py_buffer` structure has been removed and " "the layout of the :c:type:`PyMemoryViewObject` has changed." msgstr "" -#: ../../whatsnew/3.3.rst:2469 +#: ../../whatsnew/3.3.rst:2471 msgid "" "All extensions relying on the relevant parts in ``memoryobject.h`` or " "``object.h`` must be rebuilt." msgstr "" -#: ../../whatsnew/3.3.rst:2472 +#: ../../whatsnew/3.3.rst:2474 msgid "" "Due to :ref:`PEP 393 `, the :c:type:`Py_UNICODE` type and all " "functions using this type are deprecated (but will stay available for at " @@ -4265,7 +4268,7 @@ msgid "" "doc:`Unicode API <../c-api/unicode>`." msgstr "" -#: ../../whatsnew/3.3.rst:2479 +#: ../../whatsnew/3.3.rst:2481 msgid "" "However, if you only have been using high-level functions such as :c:func:" "`PyUnicode_Concat()`, :c:func:`PyUnicode_Join` or :c:func:" @@ -4273,11 +4276,11 @@ msgid "" "new unicode representations." msgstr "" -#: ../../whatsnew/3.3.rst:2484 +#: ../../whatsnew/3.3.rst:2486 msgid ":c:func:`PyImport_GetMagicNumber` now returns ``-1`` upon failure." msgstr ":c:func:`PyImport_GetMagicNumber` 現在在失敗時回傳 ``-1``。" -#: ../../whatsnew/3.3.rst:2486 +#: ../../whatsnew/3.3.rst:2488 msgid "" "As a negative value for the *level* argument to :func:`__import__` is no " "longer valid, the same now holds for :c:func:`PyImport_ImportModuleLevel`. " @@ -4285,11 +4288,11 @@ msgid "" "`PyImport_ImportModuleEx` is now ``0`` instead of ``-1``." msgstr "" -#: ../../whatsnew/3.3.rst:2493 +#: ../../whatsnew/3.3.rst:2495 msgid "Building C extensions" msgstr "" -#: ../../whatsnew/3.3.rst:2495 +#: ../../whatsnew/3.3.rst:2497 msgid "" "The range of possible file names for C extensions has been narrowed. Very " "rarely used spellings have been suppressed: under POSIX, files named " @@ -4299,32 +4302,32 @@ msgid "" "remove the ``module`` string from the file names)." msgstr "" -#: ../../whatsnew/3.3.rst:2503 +#: ../../whatsnew/3.3.rst:2505 msgid "(implemented in :issue:`14040`.)" msgstr "(於 :issue:`14040` 中實作。)" -#: ../../whatsnew/3.3.rst:2507 +#: ../../whatsnew/3.3.rst:2509 msgid "Command Line Switch Changes" msgstr "命令列開關更改" -#: ../../whatsnew/3.3.rst:2509 +#: ../../whatsnew/3.3.rst:2511 msgid "" "The -Q command-line flag and related artifacts have been removed. Code " "checking sys.flags.division_warning will need updating." msgstr "" -#: ../../whatsnew/3.3.rst:2512 +#: ../../whatsnew/3.3.rst:2514 msgid "(:issue:`10998`, contributed by Éric Araujo.)" msgstr "(由 Éric Araujo 於 :issue:`10998` 中實作。)" -#: ../../whatsnew/3.3.rst:2514 +#: ../../whatsnew/3.3.rst:2516 msgid "" "When :program:`python` is started with :option:`-S`, ``import site`` will no " "longer add site-specific paths to the module search paths. In previous " "versions, it did." msgstr "" -#: ../../whatsnew/3.3.rst:2518 +#: ../../whatsnew/3.3.rst:2520 msgid "" "(:issue:`11591`, contributed by Carl Meyer with editions by Éric Araujo.)" msgstr "(:issue:`11591`,由 Carl Meyer 貢獻並由 Éric Araujo 修訂。)" diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index 49ff4555d8..8323096a63 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -35,14 +35,17 @@ msgid "" "Python 3.4 was released on March 16, 2014. For full details, see the " "`changelog `_." msgstr "" +"本文介紹了 Python 3.4 與 3.3 相比多了哪些新功能。Python 3.1 已於 2014 年 3 " +"月 16 日發布。完整詳情請見 `changelog `_。" #: ../../whatsnew/3.4.rst:70 msgid ":pep:`429` -- Python 3.4 Release Schedule" -msgstr "" +msgstr ":pep:`429` - Python 3.4 發佈時程" #: ../../whatsnew/3.4.rst:75 msgid "Summary -- Release Highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.4.rst:80 msgid "New syntax features:" @@ -279,7 +282,7 @@ msgstr "" #: ../../whatsnew/3.4.rst:175 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.4.rst:180 msgid "PEP 453: Explicit Bootstrapping of PIP in Python Installations" @@ -3216,7 +3219,7 @@ msgstr "" #: ../../whatsnew/3.4.rst:2239 msgid "Porting to Python 3.4" -msgstr "" +msgstr "移植至 Python 3.4" #: ../../whatsnew/3.4.rst:2241 msgid "" diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index 00e2e09a2f..43c8937a1d 100644 --- a/whatsnew/3.5.po +++ b/whatsnew/3.5.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,14 +37,17 @@ msgid "" "Python 3.5 was released on September 13, 2015.  See the `changelog `_ for a full list of changes." msgstr "" +"本文介紹了 Python 3.5 與 3.4 相比多了哪些新功能。Python 3.1 已於 2015 年 9 " +"月 13 日發布。完整詳情請見 `changelog `_。" #: ../../whatsnew/3.5.rst:54 msgid ":pep:`478` - Python 3.5 Release Schedule" -msgstr "" +msgstr ":pep:`478` - Python 3.5 發佈時程" #: ../../whatsnew/3.5.rst:58 msgid "Summary -- Release highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.5.rst:60 msgid "New syntax features:" @@ -143,7 +146,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:110 msgid "Significant improvements in the standard library:" -msgstr "" +msgstr "標準函式庫中的顯著改進" #: ../../whatsnew/3.5.rst:112 msgid "" @@ -223,7 +226,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:163 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.5.rst:168 msgid "PEP 492 - Coroutines with async and await syntax" @@ -3694,7 +3697,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:2377 msgid "Porting to Python 3.5" -msgstr "" +msgstr "移植至 Python 3.5" #: ../../whatsnew/3.5.rst:2379 msgid "" @@ -3927,10 +3930,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:2529 msgid "" -"Because the lack of the :attr:`__module__` attribute breaks pickling and " -"introspection, a deprecation warning is now raised for builtin types without " -"the :attr:`__module__` attribute. This would be an AttributeError in the " -"future. (Contributed by Serhiy Storchaka in :issue:`20204`.)" +"Because the lack of the :attr:`~type.__module__` attribute breaks pickling " +"and introspection, a deprecation warning is now raised for builtin types " +"without the :attr:`~type.__module__` attribute. This will be an :exc:" +"`AttributeError` in the future. (Contributed by Serhiy Storchaka in :issue:" +"`20204`.)" msgstr "" #: ../../whatsnew/3.5.rst:2535 diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index e3ad5e1ef2..53d989f8b5 100644 --- a/whatsnew/3.6.po +++ b/whatsnew/3.6.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -32,14 +32,17 @@ msgid "" "Python 3.6 was released on December 23, 2016.  See the `changelog `_ for a full list of changes." msgstr "" +"本文介紹了 Python 3.6 與 3.5 相比多了哪些新功能。Python 3.6 已於 2016 年 12 " +"月 23 日發布。完整詳情請見 `changelog `_。" #: ../../whatsnew/3.6.rst:54 msgid ":pep:`494` - Python 3.6 Release Schedule" -msgstr "" +msgstr ":pep:`494` - Python 3.6 發佈時程" #: ../../whatsnew/3.6.rst:58 msgid "Summary -- Release highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.6.rst:60 msgid "New syntax features:" @@ -121,7 +124,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:105 msgid "Significant improvements in the standard library:" -msgstr "" +msgstr "標準函式庫中的顯著改進" #: ../../whatsnew/3.6.rst:107 msgid "" @@ -234,7 +237,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:176 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.6.rst:181 msgid "PEP 498: Formatted string literals" @@ -771,7 +774,7 @@ msgstr "" msgid "" "Attributes in a class definition body have a natural ordering: the same " "order in which the names appear in the source. This order is now preserved " -"in the new class's :attr:`~object.__dict__` attribute." +"in the new class's :attr:`~type.__dict__` attribute." msgstr "" #: ../../whatsnew/3.6.rst:554 @@ -1368,9 +1371,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:935 msgid "" "The :func:`~collections.namedtuple` function now accepts an optional keyword " -"argument *module*, which, when specified, is used for the ``__module__`` " -"attribute of the returned named tuple class. (Contributed by Raymond " -"Hettinger in :issue:`17941`.)" +"argument *module*, which, when specified, is used for the :attr:`~type." +"__module__` attribute of the returned named tuple class. (Contributed by " +"Raymond Hettinger in :issue:`17941`.)" msgstr "" #: ../../whatsnew/3.6.rst:940 ../../whatsnew/3.6.rst:2295 @@ -3130,7 +3133,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:2142 msgid "Porting to Python 3.6" -msgstr "" +msgstr "移植至 Python 3.6" #: ../../whatsnew/3.6.rst:2144 msgid "" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index 2d895c796f..c9c6896a50 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -32,10 +32,12 @@ msgid "" "Python 3.7 was released on June 27, 2018. For full details, see the :ref:" "`changelog `." msgstr "" +"本文介紹了 Python 3.7 與 3.6 相比多了哪些新功能。Python 3.7 已於 2018 年 6 " +"月 27 日發布。有關完整詳細資訊,請參閱 :ref:`changelog `。" #: ../../whatsnew/3.7.rst:53 msgid "Summary -- Release Highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.7.rst:58 msgid "New syntax features:" @@ -73,7 +75,7 @@ msgstr ":ref:`whatsnew37_importlib_resources`" #: ../../whatsnew/3.7.rst:72 msgid "New built-in features:" -msgstr "" +msgstr "新的內建功能:" #: ../../whatsnew/3.7.rst:74 msgid "" @@ -82,7 +84,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:76 msgid "Python data model improvements:" -msgstr "" +msgstr "Python 資料模型改進:" #: ../../whatsnew/3.7.rst:78 msgid "" @@ -105,7 +107,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:90 msgid "Significant improvements in the standard library:" -msgstr "" +msgstr "標準函式庫中的顯著改進" #: ../../whatsnew/3.7.rst:92 msgid "" @@ -186,7 +188,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:128 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.7.rst:133 msgid "PEP 563: Postponed Evaluation of Annotations" @@ -3181,7 +3183,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:2230 msgid "Porting to Python 3.7" -msgstr "" +msgstr "移植至 Python 3.7" #: ../../whatsnew/3.7.rst:2232 msgid "" diff --git a/whatsnew/3.8.po b/whatsnew/3.8.po index 5603747792..ca437cad1c 100644 --- a/whatsnew/3.8.po +++ b/whatsnew/3.8.po @@ -35,14 +35,16 @@ msgid "" "Python 3.8 was released on October 14, 2019. For full details, see the :ref:" "`changelog `." msgstr "" +"本文介紹了 Python 3.8 與 3.7 相比多了哪些新功能。Python 3.8 已於 2019 年 10 " +"月 14 日發布。有關完整詳細資訊,請參閱 :ref:`changelog `。" #: ../../whatsnew/3.8.rst:61 msgid "Summary -- Release highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.8.rst:72 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.8.rst:75 msgid "Assignment expressions" @@ -2869,7 +2871,7 @@ msgstr "" #: ../../whatsnew/3.8.rst:1809 msgid "Porting to Python 3.8" -msgstr "" +msgstr "移植至 Python 3.8" #: ../../whatsnew/3.8.rst:1811 msgid "" diff --git a/whatsnew/3.9.po b/whatsnew/3.9.po index 96ce53c7f5..4c88343623 100644 --- a/whatsnew/3.9.po +++ b/whatsnew/3.9.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,14 +35,16 @@ msgid "" "Python 3.9 was released on October 5, 2020. For full details, see the :ref:" "`changelog `." msgstr "" +"本文介紹了 Python 3.9 與 3.8 相比多了哪些新功能。Python 3.9 已於 2020 年 10 " +"月 5 日發布。有關完整詳細資訊,請參閱 :ref:`changelog `。" #: ../../whatsnew/3.9.rst:51 msgid ":pep:`596` - Python 3.9 Release Schedule" -msgstr "" +msgstr ":pep:`596` - Python 3.9 發佈時程" #: ../../whatsnew/3.9.rst:55 msgid "Summary -- Release highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.9.rst:60 msgid "New syntax features:" @@ -62,7 +64,7 @@ msgstr "" #: ../../whatsnew/3.9.rst:66 msgid "New built-in features:" -msgstr "" +msgstr "新的內建功能:" #: ../../whatsnew/3.9.rst:68 msgid ":pep:`616`, string methods to remove prefixes and suffixes." @@ -198,9 +200,9 @@ msgid "" "Python as well. Consult the :ref:`removed-in-python-39` section." msgstr "" -#: ../../whatsnew/3.9.rst:140 ../../whatsnew/3.9.rst:1270 +#: ../../whatsnew/3.9.rst:140 ../../whatsnew/3.9.rst:1271 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.9.rst:143 msgid "Dictionary Merge & Update Operators" @@ -266,7 +268,7 @@ msgid "" "for example ``queue.Queue``." msgstr "" -#: ../../whatsnew/3.9.rst:180 ../../whatsnew/3.9.rst:1158 +#: ../../whatsnew/3.9.rst:180 ../../whatsnew/3.9.rst:1159 msgid "Example:" msgstr "範例:" @@ -985,36 +987,36 @@ msgstr "pydoc" #: ../../whatsnew/3.9.rst:639 msgid "" "The documentation string is now shown not only for class, function, method " -"etc, but for any object that has its own ``__doc__`` attribute. (Contributed " -"by Serhiy Storchaka in :issue:`40257`.)" +"etc, but for any object that has its own :attr:`~definition.__doc__` " +"attribute. (Contributed by Serhiy Storchaka in :issue:`40257`.)" msgstr "" -#: ../../whatsnew/3.9.rst:644 +#: ../../whatsnew/3.9.rst:645 msgid "random" msgstr "random" -#: ../../whatsnew/3.9.rst:646 +#: ../../whatsnew/3.9.rst:647 msgid "" "Added a new :attr:`random.Random.randbytes` method: generate random bytes. " "(Contributed by Victor Stinner in :issue:`40286`.)" msgstr "" -#: ../../whatsnew/3.9.rst:650 +#: ../../whatsnew/3.9.rst:651 msgid "signal" msgstr "signal" -#: ../../whatsnew/3.9.rst:652 +#: ../../whatsnew/3.9.rst:653 msgid "" "Exposed the Linux-specific :func:`signal.pidfd_send_signal` for sending to " "signals to a process using a file descriptor instead of a pid. (:issue:" "`38712`)" msgstr "" -#: ../../whatsnew/3.9.rst:656 +#: ../../whatsnew/3.9.rst:657 msgid "smtplib" msgstr "smtplib" -#: ../../whatsnew/3.9.rst:658 +#: ../../whatsnew/3.9.rst:659 msgid "" ":class:`~smtplib.SMTP` and :class:`~smtplib.SMTP_SSL` now raise a :class:" "`ValueError` if the given timeout for their constructor is zero to prevent " @@ -1022,41 +1024,41 @@ msgid "" "`39259`.)" msgstr "" -#: ../../whatsnew/3.9.rst:662 +#: ../../whatsnew/3.9.rst:663 msgid "" ":class:`~smtplib.LMTP` constructor now has an optional *timeout* parameter. " "(Contributed by Donghee Na in :issue:`39329`.)" msgstr "" -#: ../../whatsnew/3.9.rst:666 +#: ../../whatsnew/3.9.rst:667 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.9.rst:668 +#: ../../whatsnew/3.9.rst:669 msgid "" "The :mod:`socket` module now exports the :const:`~socket." "CAN_RAW_JOIN_FILTERS` constant on Linux 4.1 and greater. (Contributed by " "Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" msgstr "" -#: ../../whatsnew/3.9.rst:672 +#: ../../whatsnew/3.9.rst:673 msgid "" "The socket module now supports the :const:`~socket.CAN_J1939` protocol on " "platforms that support it. (Contributed by Karl Ding in :issue:`40291`.)" msgstr "" -#: ../../whatsnew/3.9.rst:675 +#: ../../whatsnew/3.9.rst:676 msgid "" "The socket module now has the :func:`socket.send_fds` and :func:`socket." "recv_fds` functions. (Contributed by Joannah Nanjekye, Shinya Okano and " "Victor Stinner in :issue:`28724`.)" msgstr "" -#: ../../whatsnew/3.9.rst:681 +#: ../../whatsnew/3.9.rst:682 msgid "time" msgstr "time" -#: ../../whatsnew/3.9.rst:683 +#: ../../whatsnew/3.9.rst:684 msgid "" "On AIX, :func:`~time.thread_time` is now implemented with " "``thread_cputime()`` which has nanosecond resolution, rather than " @@ -1064,11 +1066,11 @@ msgid "" "milliseconds. (Contributed by Batuhan Taskaya in :issue:`40192`)" msgstr "" -#: ../../whatsnew/3.9.rst:689 +#: ../../whatsnew/3.9.rst:690 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.9.rst:691 +#: ../../whatsnew/3.9.rst:692 msgid "" "Added a new :data:`sys.platlibdir` attribute: name of the platform-specific " "library directory. It is used to build the path of standard library and the " @@ -1078,29 +1080,29 @@ msgid "" "and Victor Stinner in :issue:`1294959`.)" msgstr "" -#: ../../whatsnew/3.9.rst:697 +#: ../../whatsnew/3.9.rst:698 msgid "" "Previously, :data:`sys.stderr` was block-buffered when non-interactive. Now " "``stderr`` defaults to always being line-buffered. (Contributed by Jendrik " "Seipp in :issue:`13601`.)" msgstr "" -#: ../../whatsnew/3.9.rst:702 +#: ../../whatsnew/3.9.rst:703 msgid "tracemalloc" msgstr "tracemalloc" -#: ../../whatsnew/3.9.rst:704 +#: ../../whatsnew/3.9.rst:705 msgid "" "Added :func:`tracemalloc.reset_peak` to set the peak size of traced memory " "blocks to the current size, to measure the peak of specific pieces of code. " "(Contributed by Huon Wilson in :issue:`40630`.)" msgstr "" -#: ../../whatsnew/3.9.rst:709 ../../whatsnew/3.9.rst:1492 +#: ../../whatsnew/3.9.rst:710 ../../whatsnew/3.9.rst:1493 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.9.rst:711 +#: ../../whatsnew/3.9.rst:712 msgid "" ":pep:`593` introduced an :data:`typing.Annotated` type to decorate existing " "types with context-specific metadata and new ``include_extras`` parameter " @@ -1108,20 +1110,20 @@ msgid "" "(Contributed by Till Varoquaux and Konstantin Kashin.)" msgstr "" -#: ../../whatsnew/3.9.rst:717 +#: ../../whatsnew/3.9.rst:718 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.9.rst:719 +#: ../../whatsnew/3.9.rst:720 msgid "" "The Unicode database has been updated to version 13.0.0. (:issue:`39926`)." msgstr "" -#: ../../whatsnew/3.9.rst:722 +#: ../../whatsnew/3.9.rst:723 msgid "venv" msgstr "venv" -#: ../../whatsnew/3.9.rst:724 +#: ../../whatsnew/3.9.rst:725 msgid "" "The activation scripts provided by :mod:`venv` now all specify their prompt " "customization consistently by always using the value specified by " @@ -1131,11 +1133,11 @@ msgid "" "Cannon in :issue:`37663`.)" msgstr "" -#: ../../whatsnew/3.9.rst:732 +#: ../../whatsnew/3.9.rst:733 msgid "xml" msgstr "xml" -#: ../../whatsnew/3.9.rst:734 +#: ../../whatsnew/3.9.rst:735 msgid "" "White space characters within attributes are now preserved when serializing :" "mod:`xml.etree.ElementTree` to XML file. EOLNs are no longer normalized to " @@ -1143,32 +1145,32 @@ msgid "" "2.11 of XML spec. (Contributed by Mefistotelis in :issue:`39011`.)" msgstr "" -#: ../../whatsnew/3.9.rst:742 +#: ../../whatsnew/3.9.rst:743 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.9.rst:744 +#: ../../whatsnew/3.9.rst:745 msgid "" "Optimized the idiom for assignment a temporary variable in comprehensions. " "Now ``for y in [expr]`` in comprehensions is as fast as a simple assignment " "``y = expr``. For example:" msgstr "" -#: ../../whatsnew/3.9.rst:748 +#: ../../whatsnew/3.9.rst:749 msgid "sums = [s for s in [0] for x in data for s in [s + x]]" msgstr "sums = [s for s in [0] for x in data for s in [s + x]]" -#: ../../whatsnew/3.9.rst:750 +#: ../../whatsnew/3.9.rst:751 msgid "" "Unlike the ``:=`` operator this idiom does not leak a variable to the outer " "scope." msgstr "" -#: ../../whatsnew/3.9.rst:753 +#: ../../whatsnew/3.9.rst:754 msgid "(Contributed by Serhiy Storchaka in :issue:`32856`.)" msgstr "(由 Serhiy Storchaka 在 :issue:`32856` 中貢獻。)" -#: ../../whatsnew/3.9.rst:755 +#: ../../whatsnew/3.9.rst:756 msgid "" "Optimized signal handling in multithreaded applications. If a thread " "different than the main thread gets a signal, the bytecode evaluation loop " @@ -1177,27 +1179,27 @@ msgid "" "interpreter can handle signals." msgstr "" -#: ../../whatsnew/3.9.rst:761 +#: ../../whatsnew/3.9.rst:762 msgid "" "Previously, the bytecode evaluation loop was interrupted at each instruction " "until the main thread handles signals. (Contributed by Victor Stinner in :" "issue:`40010`.)" msgstr "" -#: ../../whatsnew/3.9.rst:765 +#: ../../whatsnew/3.9.rst:766 msgid "" "Optimized the :mod:`subprocess` module on FreeBSD using ``closefrom()``. " "(Contributed by Ed Maste, Conrad Meyer, Kyle Evans, Kubilay Kocak and Victor " "Stinner in :issue:`38061`.)" msgstr "" -#: ../../whatsnew/3.9.rst:769 +#: ../../whatsnew/3.9.rst:770 msgid "" ":c:func:`PyLong_FromDouble` is now up to 1.87x faster for values that fit " "into :c:expr:`long`. (Contributed by Sergey Fedoseev in :issue:`37986`.)" msgstr "" -#: ../../whatsnew/3.9.rst:773 +#: ../../whatsnew/3.9.rst:774 msgid "" "A number of Python builtins (:class:`range`, :class:`tuple`, :class:`set`, :" "class:`frozenset`, :class:`list`, :class:`dict`) are now sped up by using :" @@ -1205,14 +1207,14 @@ msgid "" "Jeroen Demeyer and Petr Viktorin in :issue:`37207`.)" msgstr "" -#: ../../whatsnew/3.9.rst:778 +#: ../../whatsnew/3.9.rst:779 msgid "" "Optimized :func:`~set.difference_update` for the case when the other set is " "much larger than the base set. (Suggested by Evgeny Kapun with code " "contributed by Michele Orrù in :issue:`8425`.)" msgstr "" -#: ../../whatsnew/3.9.rst:782 +#: ../../whatsnew/3.9.rst:783 msgid "" "Python's small object allocator (``obmalloc.c``) now allows (no more than) " "one empty arena to remain available for immediate reuse, without returning " @@ -1221,26 +1223,26 @@ msgid "" "in :issue:`37257`.)" msgstr "" -#: ../../whatsnew/3.9.rst:788 +#: ../../whatsnew/3.9.rst:789 msgid "" ":term:`floor division` of float operation now has a better performance. Also " "the message of :exc:`ZeroDivisionError` for this operation is updated. " "(Contributed by Donghee Na in :issue:`39434`.)" msgstr "" -#: ../../whatsnew/3.9.rst:792 +#: ../../whatsnew/3.9.rst:793 msgid "" "Decoding short ASCII strings with UTF-8 and ascii codecs is now about 15% " "faster. (Contributed by Inada Naoki in :issue:`37348`.)" msgstr "" -#: ../../whatsnew/3.9.rst:795 +#: ../../whatsnew/3.9.rst:796 msgid "" "Here's a summary of performance improvements from Python 3.4 through Python " "3.9:" msgstr "" -#: ../../whatsnew/3.9.rst:797 +#: ../../whatsnew/3.9.rst:798 msgid "" "Python version 3.4 3.5 3.6 3.7 3.8 " "3.9\n" @@ -1388,7 +1390,7 @@ msgstr "" " loop_overhead 0.5 0.6 0.4 0.3 0.3 " "0.3" -#: ../../whatsnew/3.9.rst:842 +#: ../../whatsnew/3.9.rst:843 msgid "" "These results were generated from the variable access benchmark script at: " "``Tools/scripts/var_access_benchmark.py``. The benchmark script displays " @@ -1399,18 +1401,18 @@ msgid "" "python.org/downloads/macos/>`_." msgstr "" -#: ../../whatsnew/3.9.rst:852 +#: ../../whatsnew/3.9.rst:853 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.9.rst:854 +#: ../../whatsnew/3.9.rst:855 msgid "" "The distutils ``bdist_msi`` command is now deprecated, use ``bdist_wheel`` " "(wheel packages) instead. (Contributed by Hugo van Kemenade in :issue:" "`39586`.)" msgstr "" -#: ../../whatsnew/3.9.rst:858 +#: ../../whatsnew/3.9.rst:859 msgid "" "Currently :func:`math.factorial` accepts :class:`float` instances with non-" "negative integer values (like ``5.0``). It raises a :exc:`ValueError` for " @@ -1419,7 +1421,7 @@ msgid "" "Serhiy Storchaka in :issue:`37315`.)" msgstr "" -#: ../../whatsnew/3.9.rst:864 +#: ../../whatsnew/3.9.rst:865 msgid "" "The :mod:`!parser` and :mod:`!symbol` modules are deprecated and will be " "removed in future versions of Python. For the majority of use cases, users " @@ -1427,7 +1429,7 @@ msgid "" "stage, using the :mod:`ast` module." msgstr "" -#: ../../whatsnew/3.9.rst:869 +#: ../../whatsnew/3.9.rst:870 msgid "" "The Public C API functions :c:func:`!PyParser_SimpleParseStringFlags`, :c:" "func:`!PyParser_SimpleParseStringFlagsFilename`, :c:func:`!" @@ -1435,7 +1437,7 @@ msgid "" "and will be removed in Python 3.10 together with the old parser." msgstr "" -#: ../../whatsnew/3.9.rst:874 +#: ../../whatsnew/3.9.rst:875 msgid "" "Using :data:`NotImplemented` in a boolean context has been deprecated, as it " "is almost exclusively the result of incorrect rich comparator " @@ -1443,7 +1445,7 @@ msgid "" "Python. (Contributed by Josh Rosenberg in :issue:`35712`.)" msgstr "" -#: ../../whatsnew/3.9.rst:880 +#: ../../whatsnew/3.9.rst:881 msgid "" "The :mod:`random` module currently accepts any hashable type as a possible " "seed value. Unfortunately, some of those types are not guaranteed to have a " @@ -1452,7 +1454,7 @@ msgid "" "`bytes`, and :class:`bytearray`." msgstr "" -#: ../../whatsnew/3.9.rst:886 +#: ../../whatsnew/3.9.rst:887 msgid "" "Opening the :class:`~gzip.GzipFile` file for writing without specifying the " "*mode* argument is deprecated. In future Python versions it will always be " @@ -1461,39 +1463,39 @@ msgid "" "issue:`28286`.)" msgstr "" -#: ../../whatsnew/3.9.rst:892 +#: ../../whatsnew/3.9.rst:893 msgid "" "Deprecated the ``split()`` method of :class:`!_tkinter.TkappType` in favour " "of the ``splitlist()`` method which has more consistent and predictable " "behavior. (Contributed by Serhiy Storchaka in :issue:`38371`.)" msgstr "" -#: ../../whatsnew/3.9.rst:897 +#: ../../whatsnew/3.9.rst:898 msgid "" "The explicit passing of coroutine objects to :func:`asyncio.wait` has been " "deprecated and will be removed in version 3.11. (Contributed by Yury " "Selivanov and Kyle Stanley in :issue:`34790`.)" msgstr "" -#: ../../whatsnew/3.9.rst:901 +#: ../../whatsnew/3.9.rst:902 msgid "" "binhex4 and hexbin4 standards are now deprecated. The :mod:`!binhex` module " "and the following :mod:`binascii` functions are now deprecated:" msgstr "" -#: ../../whatsnew/3.9.rst:904 +#: ../../whatsnew/3.9.rst:905 msgid ":func:`!b2a_hqx`, :func:`!a2b_hqx`" msgstr ":func:`!b2a_hqx`、:func:`!a2b_hqx`" -#: ../../whatsnew/3.9.rst:905 +#: ../../whatsnew/3.9.rst:906 msgid ":func:`!rlecode_hqx`, :func:`!rledecode_hqx`" msgstr ":func:`!rlecode_hqx`、:func:`!rledecode_hqx`" -#: ../../whatsnew/3.9.rst:907 +#: ../../whatsnew/3.9.rst:908 msgid "(Contributed by Victor Stinner in :issue:`39353`.)" msgstr "(由 Victor Stinner 在 :issue:`39353` 中貢獻。)" -#: ../../whatsnew/3.9.rst:909 +#: ../../whatsnew/3.9.rst:910 msgid "" ":mod:`ast` classes ``slice``, ``Index`` and ``ExtSlice`` are considered " "deprecated and will be removed in future Python versions. ``value`` itself " @@ -1502,7 +1504,7 @@ msgid "" "Storchaka in :issue:`34822`.)" msgstr "" -#: ../../whatsnew/3.9.rst:915 +#: ../../whatsnew/3.9.rst:916 msgid "" ":mod:`ast` classes ``Suite``, ``Param``, ``AugLoad`` and ``AugStore`` are " "considered deprecated and will be removed in future Python versions. They " @@ -1511,7 +1513,7 @@ msgid "" "`39969` and Serhiy Storchaka in :issue:`39988`.)" msgstr "" -#: ../../whatsnew/3.9.rst:922 +#: ../../whatsnew/3.9.rst:923 msgid "" "The :c:func:`!PyEval_InitThreads` and :c:func:`!PyEval_ThreadsInitialized` " "functions are now deprecated and will be removed in Python 3.11. Calling :c:" @@ -1520,20 +1522,20 @@ msgid "" "in :issue:`39877`.)" msgstr "" -#: ../../whatsnew/3.9.rst:928 +#: ../../whatsnew/3.9.rst:929 msgid "" "Passing ``None`` as the first argument to the :func:`shlex.split` function " "has been deprecated. (Contributed by Zackery Spytz in :issue:`33262`.)" msgstr "" -#: ../../whatsnew/3.9.rst:931 +#: ../../whatsnew/3.9.rst:932 msgid "" ":func:`!smtpd.MailmanProxy` is now deprecated as it is unusable without an " "external module, ``mailman``. (Contributed by Samuel Colvin in :issue:" "`35800`.)" msgstr "" -#: ../../whatsnew/3.9.rst:934 +#: ../../whatsnew/3.9.rst:935 msgid "" "The :mod:`!lib2to3` module now emits a :exc:`PendingDeprecationWarning`. " "Python 3.9 switched to a PEG parser (see :pep:`617`), and Python 3.10 may " @@ -1543,22 +1545,22 @@ msgid "" "or `parso`_. (Contributed by Carl Meyer in :issue:`40360`.)" msgstr "" -#: ../../whatsnew/3.9.rst:942 +#: ../../whatsnew/3.9.rst:943 msgid "" "The *random* parameter of :func:`random.shuffle` has been deprecated. " "(Contributed by Raymond Hettinger in :issue:`40465`)" msgstr "" -#: ../../whatsnew/3.9.rst:951 ../../whatsnew/3.9.rst:1406 +#: ../../whatsnew/3.9.rst:952 ../../whatsnew/3.9.rst:1407 msgid "Removed" msgstr "已移除" -#: ../../whatsnew/3.9.rst:953 +#: ../../whatsnew/3.9.rst:954 msgid "" "The erroneous version at :data:`!unittest.mock.__version__` has been removed." msgstr "" -#: ../../whatsnew/3.9.rst:955 +#: ../../whatsnew/3.9.rst:956 msgid "" ":class:`!nntplib.NNTP`: ``xpath()`` and ``xgtitle()`` methods have been " "removed. These methods are deprecated since Python 3.3. Generally, these " @@ -1568,14 +1570,14 @@ msgid "" "`39366`.)" msgstr "" -#: ../../whatsnew/3.9.rst:962 +#: ../../whatsnew/3.9.rst:963 msgid "" ":class:`array.array`: ``tostring()`` and ``fromstring()`` methods have been " "removed. They were aliases to ``tobytes()`` and ``frombytes()``, deprecated " "since Python 3.2. (Contributed by Victor Stinner in :issue:`38916`.)" msgstr "" -#: ../../whatsnew/3.9.rst:967 +#: ../../whatsnew/3.9.rst:968 msgid "" "The undocumented ``sys.callstats()`` function has been removed. Since Python " "3.7, it was deprecated and always returned :const:`None`. It required a " @@ -1583,7 +1585,7 @@ msgid "" "3.7. (Contributed by Victor Stinner in :issue:`37414`.)" msgstr "" -#: ../../whatsnew/3.9.rst:972 +#: ../../whatsnew/3.9.rst:973 msgid "" "The ``sys.getcheckinterval()`` and ``sys.setcheckinterval()`` functions have " "been removed. They were deprecated since Python 3.2. Use :func:`sys." @@ -1591,21 +1593,21 @@ msgid "" "by Victor Stinner in :issue:`37392`.)" msgstr "" -#: ../../whatsnew/3.9.rst:977 +#: ../../whatsnew/3.9.rst:978 msgid "" "The C function ``PyImport_Cleanup()`` has been removed. It was documented " "as: \"Empty the module table. For internal use only.\" (Contributed by " "Victor Stinner in :issue:`36710`.)" msgstr "" -#: ../../whatsnew/3.9.rst:981 +#: ../../whatsnew/3.9.rst:982 msgid "" "``_dummy_thread`` and ``dummy_threading`` modules have been removed. These " "modules were deprecated since Python 3.7 which requires threading support. " "(Contributed by Victor Stinner in :issue:`37312`.)" msgstr "" -#: ../../whatsnew/3.9.rst:985 +#: ../../whatsnew/3.9.rst:986 msgid "" "``aifc.openfp()`` alias to ``aifc.open()``, ``sunau.openfp()`` alias to " "``sunau.open()``, and ``wave.openfp()`` alias to :func:`wave.open` have been " @@ -1613,14 +1615,14 @@ msgid "" "Stinner in :issue:`37320`.)" msgstr "" -#: ../../whatsnew/3.9.rst:990 +#: ../../whatsnew/3.9.rst:991 msgid "" "The :meth:`!isAlive` method of :class:`threading.Thread` has been removed. " "It was deprecated since Python 3.8. Use :meth:`~threading.Thread.is_alive` " "instead. (Contributed by Donghee Na in :issue:`37804`.)" msgstr "" -#: ../../whatsnew/3.9.rst:995 +#: ../../whatsnew/3.9.rst:996 msgid "" "Methods ``getchildren()`` and ``getiterator()`` of classes :class:`~xml." "etree.ElementTree.ElementTree` and :class:`~xml.etree.ElementTree.Element` " @@ -1630,7 +1632,7 @@ msgid "" "getiterator()``. (Contributed by Serhiy Storchaka in :issue:`36543`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1003 +#: ../../whatsnew/3.9.rst:1004 msgid "" "The old :mod:`plistlib` API has been removed, it was deprecated since Python " "3.4. Use the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:" @@ -1639,7 +1641,7 @@ msgid "" "are always used instead. (Contributed by Jon Janzen in :issue:`36409`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1009 +#: ../../whatsnew/3.9.rst:1010 msgid "" "The C function ``PyGen_NeedsFinalizing`` has been removed. It was not " "documented, tested, or used anywhere within CPython after the implementation " @@ -1647,7 +1649,7 @@ msgid "" "in :issue:`15088`)" msgstr "" -#: ../../whatsnew/3.9.rst:1014 +#: ../../whatsnew/3.9.rst:1015 msgid "" "``base64.encodestring()`` and ``base64.decodestring()``, aliases deprecated " "since Python 3.1, have been removed: use :func:`base64.encodebytes` and :" @@ -1655,14 +1657,14 @@ msgid "" "`39351`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1019 +#: ../../whatsnew/3.9.rst:1020 msgid "" "``fractions.gcd()`` function has been removed, it was deprecated since " "Python 3.5 (:issue:`22486`): use :func:`math.gcd` instead. (Contributed by " "Victor Stinner in :issue:`39350`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1023 +#: ../../whatsnew/3.9.rst:1024 msgid "" "The *buffering* parameter of :class:`bz2.BZ2File` has been removed. Since " "Python 3.0, it was ignored and using it emitted a :exc:`DeprecationWarning`. " @@ -1670,7 +1672,7 @@ msgid "" "Victor Stinner in :issue:`39357`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1028 +#: ../../whatsnew/3.9.rst:1029 msgid "" "The *encoding* parameter of :func:`json.loads` has been removed. As of " "Python 3.1, it was deprecated and ignored; using it has emitted a :exc:" @@ -1678,7 +1680,7 @@ msgid "" "`39377`)" msgstr "" -#: ../../whatsnew/3.9.rst:1033 +#: ../../whatsnew/3.9.rst:1034 msgid "" "``with (await asyncio.lock):`` and ``with (yield from asyncio.lock):`` " "statements are not longer supported, use ``async with lock`` instead. The " @@ -1686,7 +1688,7 @@ msgid "" "(Contributed by Andrew Svetlov in :issue:`34793`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1038 +#: ../../whatsnew/3.9.rst:1039 msgid "" "The :func:`!sys.getcounts` function, the ``-X showalloccount`` command line " "option and the ``show_alloc_count`` field of the C structure :c:type:" @@ -1695,7 +1697,7 @@ msgid "" "`39489`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1044 +#: ../../whatsnew/3.9.rst:1045 msgid "" "The ``_field_types`` attribute of the :class:`typing.NamedTuple` class has " "been removed. It was deprecated since Python 3.8. Use the " @@ -1703,14 +1705,14 @@ msgid "" "issue:`40182`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1049 +#: ../../whatsnew/3.9.rst:1050 msgid "" "The :meth:`!symtable.SymbolTable.has_exec` method has been removed. It was " "deprecated since 2006, and only returning ``False`` when it's called. " "(Contributed by Batuhan Taskaya in :issue:`40208`)" msgstr "" -#: ../../whatsnew/3.9.rst:1053 +#: ../../whatsnew/3.9.rst:1054 msgid "" "The :meth:`!asyncio.Task.current_task` and :meth:`!asyncio.Task.all_tasks` " "have been removed. They were deprecated since Python 3.7 and you can use :" @@ -1718,7 +1720,7 @@ msgid "" "(Contributed by Rémi Lapeyre in :issue:`40967`)" msgstr "" -#: ../../whatsnew/3.9.rst:1058 +#: ../../whatsnew/3.9.rst:1059 msgid "" "The ``unescape()`` method in the :class:`html.parser.HTMLParser` class has " "been removed (it was deprecated since Python 3.4). :func:`html.unescape` " @@ -1726,21 +1728,21 @@ msgid "" "unicode characters." msgstr "" -#: ../../whatsnew/3.9.rst:1065 ../../whatsnew/3.9.rst:1332 +#: ../../whatsnew/3.9.rst:1066 ../../whatsnew/3.9.rst:1333 msgid "Porting to Python 3.9" -msgstr "" +msgstr "移植至 Python 3.9" -#: ../../whatsnew/3.9.rst:1067 +#: ../../whatsnew/3.9.rst:1068 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.9.rst:1072 +#: ../../whatsnew/3.9.rst:1073 msgid "Changes in the Python API" msgstr "" -#: ../../whatsnew/3.9.rst:1074 +#: ../../whatsnew/3.9.rst:1075 msgid "" ":func:`__import__` and :func:`importlib.util.resolve_name` now raise :exc:" "`ImportError` where it previously raised :exc:`ValueError`. Callers catching " @@ -1748,26 +1750,26 @@ msgid "" "versions will need to catch both using ``except (ImportError, ValueError):``." msgstr "" -#: ../../whatsnew/3.9.rst:1079 +#: ../../whatsnew/3.9.rst:1080 msgid "" "The :mod:`venv` activation scripts no longer special-case when " "``__VENV_PROMPT__`` is set to ``\"\"``." msgstr "" -#: ../../whatsnew/3.9.rst:1082 +#: ../../whatsnew/3.9.rst:1083 msgid "" "The :meth:`select.epoll.unregister` method no longer ignores the :const:" "`~errno.EBADF` error. (Contributed by Victor Stinner in :issue:`39239`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1086 +#: ../../whatsnew/3.9.rst:1087 msgid "" "The *compresslevel* parameter of :class:`bz2.BZ2File` became keyword-only, " "since the *buffering* parameter has been removed. (Contributed by Victor " "Stinner in :issue:`39357`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1090 +#: ../../whatsnew/3.9.rst:1091 msgid "" "Simplified AST for subscription. Simple indices will be represented by their " "value, extended slices will be represented as tuples. ``Index(value)`` will " @@ -1775,21 +1777,21 @@ msgid "" "Load())``. (Contributed by Serhiy Storchaka in :issue:`34822`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1096 +#: ../../whatsnew/3.9.rst:1097 msgid "" "The :mod:`importlib` module now ignores the :envvar:`PYTHONCASEOK` " "environment variable when the :option:`-E` or :option:`-I` command line " "options are being used." msgstr "" -#: ../../whatsnew/3.9.rst:1100 +#: ../../whatsnew/3.9.rst:1101 msgid "" "The *encoding* parameter has been added to the classes :class:`ftplib.FTP` " "and :class:`ftplib.FTP_TLS` as a keyword-only parameter, and the default " "encoding is changed from Latin-1 to UTF-8 to follow :rfc:`2640`." msgstr "" -#: ../../whatsnew/3.9.rst:1104 +#: ../../whatsnew/3.9.rst:1105 msgid "" ":meth:`asyncio.loop.shutdown_default_executor` has been added to :class:" "`~asyncio.AbstractEventLoop`, meaning alternative event loops that inherit " @@ -1797,7 +1799,7 @@ msgid "" "issue:`34037`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1109 +#: ../../whatsnew/3.9.rst:1110 msgid "" "The constant values of future flags in the :mod:`__future__` module is " "updated in order to prevent collision with compiler flags. Previously " @@ -1805,7 +1807,7 @@ msgid "" "(Contributed by Batuhan Taskaya in :issue:`39562`)" msgstr "" -#: ../../whatsnew/3.9.rst:1114 +#: ../../whatsnew/3.9.rst:1115 msgid "" "``array('u')`` now uses :c:type:`wchar_t` as C type instead of " "``Py_UNICODE``. This change doesn't affect to its behavior because " @@ -1813,7 +1815,7 @@ msgid "" "by Inada Naoki in :issue:`34538`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1119 +#: ../../whatsnew/3.9.rst:1120 msgid "" "The :func:`logging.getLogger` API now returns the root logger when passed " "the name ``'root'``, whereas previously it returned a non-root logger named " @@ -1823,7 +1825,7 @@ msgid "" "(Contributed by Vinay Sajip in :issue:`37742`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1126 +#: ../../whatsnew/3.9.rst:1127 msgid "" "Division handling of :class:`~pathlib.PurePath` now returns :data:" "`NotImplemented` instead of raising a :exc:`TypeError` when passed something " @@ -1832,7 +1834,7 @@ msgid "" "types. (Contributed by Roger Aiudi in :issue:`34775`)." msgstr "" -#: ../../whatsnew/3.9.rst:1132 +#: ../../whatsnew/3.9.rst:1133 msgid "" "Starting with Python 3.9.5 the :mod:`ipaddress` module no longer accepts any " "leading zeros in IPv4 address strings. Leading zeros are ambiguous and " @@ -1842,7 +1844,7 @@ msgid "" "leading zeros. (Contributed by Christian Heimes in :issue:`36384`)." msgstr "" -#: ../../whatsnew/3.9.rst:1140 +#: ../../whatsnew/3.9.rst:1141 msgid "" ":func:`codecs.lookup` now normalizes the encoding name the same way as :func:" "`encodings.normalize_encoding`, except that :func:`codecs.lookup` also " @@ -1851,11 +1853,11 @@ msgid "" "in :issue:`37751`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1148 +#: ../../whatsnew/3.9.rst:1149 msgid "Changes in the C API" msgstr "C API 中的改動" -#: ../../whatsnew/3.9.rst:1150 +#: ../../whatsnew/3.9.rst:1151 msgid "" "Instances of :ref:`heap-allocated types ` (such as those created " "with :c:func:`PyType_FromSpec` and similar APIs) hold a reference to their " @@ -1866,7 +1868,7 @@ msgid "" "heap-allocated types visit the object's type." msgstr "" -#: ../../whatsnew/3.9.rst:1160 +#: ../../whatsnew/3.9.rst:1161 msgid "" "int\n" "foo_traverse(foo_struct *self, visitproc visit, void *arg) {\n" @@ -1878,7 +1880,7 @@ msgid "" "}" msgstr "" -#: ../../whatsnew/3.9.rst:1171 +#: ../../whatsnew/3.9.rst:1172 msgid "" "If your traverse function delegates to ``tp_traverse`` of its base class (or " "another type), ensure that ``Py_TYPE(self)`` is visited only once. Note that " @@ -1886,19 +1888,19 @@ msgid "" "``tp_traverse``." msgstr "" -#: ../../whatsnew/3.9.rst:1176 +#: ../../whatsnew/3.9.rst:1177 msgid "For example, if your ``tp_traverse`` function includes:" msgstr "" -#: ../../whatsnew/3.9.rst:1178 +#: ../../whatsnew/3.9.rst:1179 msgid "base->tp_traverse(self, visit, arg)" msgstr "base->tp_traverse(self, visit, arg)" -#: ../../whatsnew/3.9.rst:1182 +#: ../../whatsnew/3.9.rst:1183 msgid "then add:" msgstr "" -#: ../../whatsnew/3.9.rst:1184 +#: ../../whatsnew/3.9.rst:1185 msgid "" "#if PY_VERSION_HEX >= 0x03090000\n" " // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)\n" @@ -1910,11 +1912,11 @@ msgid "" "#else" msgstr "" -#: ../../whatsnew/3.9.rst:1195 +#: ../../whatsnew/3.9.rst:1196 msgid "(See :issue:`35810` and :issue:`40217` for more information.)" msgstr "(更多資訊請見 :issue:`35810` 與 :issue:`40217`。)" -#: ../../whatsnew/3.9.rst:1197 +#: ../../whatsnew/3.9.rst:1198 msgid "" "The functions ``PyEval_CallObject``, ``PyEval_CallFunction``, " "``PyEval_CallMethod`` and ``PyEval_CallObjectWithKeywords`` are deprecated. " @@ -1922,11 +1924,11 @@ msgid "" "issue:`29548`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1203 +#: ../../whatsnew/3.9.rst:1204 msgid "CPython bytecode changes" msgstr "CPython 位元組碼變更" -#: ../../whatsnew/3.9.rst:1205 +#: ../../whatsnew/3.9.rst:1206 msgid "" "The :opcode:`LOAD_ASSERTION_ERROR` opcode was added for handling the :" "keyword:`assert` statement. Previously, the assert statement would not work " @@ -1934,37 +1936,37 @@ msgid "" "(Contributed by Zackery Spytz in :issue:`34880`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1210 +#: ../../whatsnew/3.9.rst:1211 msgid "" "The :opcode:`COMPARE_OP` opcode was split into four distinct instructions:" msgstr "" -#: ../../whatsnew/3.9.rst:1212 +#: ../../whatsnew/3.9.rst:1213 msgid "``COMPARE_OP`` for rich comparisons" msgstr "" -#: ../../whatsnew/3.9.rst:1213 +#: ../../whatsnew/3.9.rst:1214 msgid "``IS_OP`` for 'is' and 'is not' tests" msgstr "" -#: ../../whatsnew/3.9.rst:1214 +#: ../../whatsnew/3.9.rst:1215 msgid "``CONTAINS_OP`` for 'in' and 'not in' tests" msgstr "" -#: ../../whatsnew/3.9.rst:1215 +#: ../../whatsnew/3.9.rst:1216 msgid "" "``JUMP_IF_NOT_EXC_MATCH`` for checking exceptions in 'try-except' statements." msgstr "" -#: ../../whatsnew/3.9.rst:1218 +#: ../../whatsnew/3.9.rst:1219 msgid "(Contributed by Mark Shannon in :issue:`39156`.)" msgstr "(由 Mark Shannon 在 :issue:`39156` 中貢獻。)" -#: ../../whatsnew/3.9.rst:1222 +#: ../../whatsnew/3.9.rst:1223 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.9.rst:1224 +#: ../../whatsnew/3.9.rst:1225 msgid "" "Added ``--with-platlibdir`` option to the ``configure`` script: name of the " "platform-specific library directory, stored in the new :data:`sys." @@ -1973,26 +1975,26 @@ msgid "" "and Victor Stinner in :issue:`1294959`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1230 +#: ../../whatsnew/3.9.rst:1231 msgid "" "The ``COUNT_ALLOCS`` special build macro has been removed. (Contributed by " "Victor Stinner in :issue:`39489`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1233 +#: ../../whatsnew/3.9.rst:1234 msgid "" "On non-Windows platforms, the :c:func:`!setenv` and :c:func:`!unsetenv` " "functions are now required to build Python. (Contributed by Victor Stinner " "in :issue:`39395`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1237 +#: ../../whatsnew/3.9.rst:1238 msgid "" "On non-Windows platforms, creating ``bdist_wininst`` installers is now " "officially unsupported. (See :issue:`10945` for more details.)" msgstr "" -#: ../../whatsnew/3.9.rst:1240 +#: ../../whatsnew/3.9.rst:1241 msgid "" "When building Python on macOS from source, ``_tkinter`` now links with non-" "system Tcl and Tk frameworks if they are installed in ``/Library/" @@ -2003,13 +2005,13 @@ msgid "" "(Contributed by Ned Deily in :issue:`34956`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1249 +#: ../../whatsnew/3.9.rst:1250 msgid "" "Python can now be built for Windows 10 ARM64. (Contributed by Steve Dower " "in :issue:`33125`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1252 +#: ../../whatsnew/3.9.rst:1253 msgid "" "Some individual tests are now skipped when ``--pgo`` is used. The tests in " "question increased the PGO task time significantly and likely didn't help " @@ -2025,11 +2027,11 @@ msgid "" "details.)" msgstr "" -#: ../../whatsnew/3.9.rst:1267 +#: ../../whatsnew/3.9.rst:1268 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.9.rst:1272 +#: ../../whatsnew/3.9.rst:1273 msgid "" ":pep:`573`: Added :c:func:`PyType_FromModuleAndSpec` to associate a module " "with a class; :c:func:`PyType_GetModule` and :c:func:`PyType_GetModuleState` " @@ -2038,20 +2040,20 @@ msgid "" "(Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1279 +#: ../../whatsnew/3.9.rst:1280 msgid "" "Added :c:func:`PyFrame_GetCode` function: get a frame code. Added :c:func:" "`PyFrame_GetBack` function: get the frame next outer frame. (Contributed by " "Victor Stinner in :issue:`40421`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1283 +#: ../../whatsnew/3.9.rst:1284 msgid "" "Added :c:func:`PyFrame_GetLineNumber` to the limited C API. (Contributed by " "Victor Stinner in :issue:`40421`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1286 +#: ../../whatsnew/3.9.rst:1287 msgid "" "Added :c:func:`PyThreadState_GetInterpreter` and :c:func:" "`PyInterpreterState_Get` functions to get the interpreter. Added :c:func:" @@ -2061,7 +2063,7 @@ msgid "" "issue:`39947`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1294 +#: ../../whatsnew/3.9.rst:1295 msgid "" "Added a new public :c:func:`PyObject_CallNoArgs` function to the C API, " "which calls a callable Python object without any arguments. It is the most " @@ -2069,11 +2071,11 @@ msgid "" "(Contributed by Victor Stinner in :issue:`37194`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1299 ../../whatsnew/3.9.rst:1417 +#: ../../whatsnew/3.9.rst:1300 ../../whatsnew/3.9.rst:1418 msgid "Changes in the limited C API (if ``Py_LIMITED_API`` macro is defined):" msgstr "" -#: ../../whatsnew/3.9.rst:1301 +#: ../../whatsnew/3.9.rst:1302 msgid "" "Provide :c:func:`Py_EnterRecursiveCall` and :c:func:`Py_LeaveRecursiveCall` " "as regular functions for the limited API. Previously, there were defined as " @@ -2082,23 +2084,23 @@ msgid "" "the limited C API)." msgstr "" -#: ../../whatsnew/3.9.rst:1307 +#: ../../whatsnew/3.9.rst:1308 msgid "" "``PyObject_INIT()`` and ``PyObject_INIT_VAR()`` become regular \"opaque\" " "function to hide implementation details." msgstr "" -#: ../../whatsnew/3.9.rst:1310 ../../whatsnew/3.9.rst:1444 +#: ../../whatsnew/3.9.rst:1311 ../../whatsnew/3.9.rst:1445 msgid "(Contributed by Victor Stinner in :issue:`38644` and :issue:`39542`.)" msgstr "(由 Victor Stinner 在 38644 和 39542 中貢獻。)" -#: ../../whatsnew/3.9.rst:1312 +#: ../../whatsnew/3.9.rst:1313 msgid "" "The :c:func:`PyModule_AddType` function is added to help adding a type to a " "module. (Contributed by Donghee Na in :issue:`40024`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1316 +#: ../../whatsnew/3.9.rst:1317 msgid "" "Added the functions :c:func:`PyObject_GC_IsTracked` and :c:func:" "`PyObject_GC_IsFinalized` to the public API to allow to query if Python " @@ -2107,27 +2109,27 @@ msgid "" "issue:`40241`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1322 +#: ../../whatsnew/3.9.rst:1323 msgid "" "Added :c:func:`!_PyObject_FunctionStr` to get a user-friendly string " "representation of a function-like object. (Patch by Jeroen Demeyer in :issue:" "`37645`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1326 +#: ../../whatsnew/3.9.rst:1327 msgid "" "Added :c:func:`PyObject_CallOneArg` for calling an object with one " "positional argument (Patch by Jeroen Demeyer in :issue:`37483`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1334 +#: ../../whatsnew/3.9.rst:1335 msgid "" "``PyInterpreterState.eval_frame`` (:pep:`523`) now requires a new mandatory " "*tstate* parameter (``PyThreadState*``). (Contributed by Victor Stinner in :" "issue:`38500`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1338 +#: ../../whatsnew/3.9.rst:1339 msgid "" "Extension modules: :c:member:`~PyModuleDef.m_traverse`, :c:member:" "`~PyModuleDef.m_clear` and :c:member:`~PyModuleDef.m_free` functions of :c:" @@ -2139,12 +2141,12 @@ msgid "" "`PyModule_GetState`) is ``NULL``." msgstr "" -#: ../../whatsnew/3.9.rst:1347 +#: ../../whatsnew/3.9.rst:1348 msgid "" "Extension modules without module state (``m_size <= 0``) are not affected." msgstr "" -#: ../../whatsnew/3.9.rst:1349 +#: ../../whatsnew/3.9.rst:1350 msgid "" "If :c:func:`Py_AddPendingCall` is called in a subinterpreter, the function " "is now scheduled to be called from the subinterpreter, rather than being " @@ -2152,7 +2154,7 @@ msgid "" "of scheduled calls. (Contributed by Victor Stinner in :issue:`39984`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1355 +#: ../../whatsnew/3.9.rst:1356 msgid "" "The Windows registry is no longer used to initialize :data:`sys.path` when " "the ``-E`` option is used (if :c:member:`PyConfig.use_environment` is set to " @@ -2160,21 +2162,21 @@ msgid "" "by Zackery Spytz in :issue:`8901`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1360 +#: ../../whatsnew/3.9.rst:1361 msgid "" "The global variable :c:data:`PyStructSequence_UnnamedField` is now a " "constant and refers to a constant string. (Contributed by Serhiy Storchaka " "in :issue:`38650`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1364 +#: ../../whatsnew/3.9.rst:1365 msgid "" "The :c:type:`!PyGC_Head` structure is now opaque. It is only defined in the " "internal C API (``pycore_gc.h``). (Contributed by Victor Stinner in :issue:" "`40241`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1368 +#: ../../whatsnew/3.9.rst:1369 msgid "" "The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, ``PyUnicode_WSTR_LENGTH``, :c:" "func:`!PyUnicode_FromUnicode`, :c:func:`!PyUnicode_AsUnicode`, " @@ -2183,7 +2185,7 @@ msgid "" "Python 3.3. (Contributed by Inada Naoki in :issue:`36346`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1375 +#: ../../whatsnew/3.9.rst:1376 msgid "" "The :c:func:`Py_FatalError` function is replaced with a macro which logs " "automatically the name of the current function, unless the " @@ -2191,22 +2193,22 @@ msgid "" "issue:`39882`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1380 +#: ../../whatsnew/3.9.rst:1381 msgid "" "The vectorcall protocol now requires that the caller passes only strings as " "keyword names. (See :issue:`37540` for more information.)" msgstr "" -#: ../../whatsnew/3.9.rst:1383 +#: ../../whatsnew/3.9.rst:1384 msgid "" "Implementation details of a number of macros and functions are now hidden:" msgstr "" -#: ../../whatsnew/3.9.rst:1385 +#: ../../whatsnew/3.9.rst:1386 msgid ":c:func:`PyObject_IS_GC` macro was converted to a function." msgstr "" -#: ../../whatsnew/3.9.rst:1387 +#: ../../whatsnew/3.9.rst:1388 msgid "" "The :c:func:`!PyObject_NEW` macro becomes an alias to the :c:macro:" "`PyObject_New` macro, and the :c:func:`!PyObject_NEW_VAR` macro becomes an " @@ -2214,38 +2216,38 @@ msgid "" "directly the :c:member:`PyTypeObject.tp_basicsize` member." msgstr "" -#: ../../whatsnew/3.9.rst:1392 +#: ../../whatsnew/3.9.rst:1393 msgid "" ":c:func:`!PyObject_GET_WEAKREFS_LISTPTR` macro was converted to a function: " "the macro accessed directly the :c:member:`PyTypeObject.tp_weaklistoffset` " "member." msgstr "" -#: ../../whatsnew/3.9.rst:1396 +#: ../../whatsnew/3.9.rst:1397 msgid "" ":c:func:`PyObject_CheckBuffer` macro was converted to a function: the macro " "accessed directly the :c:member:`PyTypeObject.tp_as_buffer` member." msgstr "" -#: ../../whatsnew/3.9.rst:1399 +#: ../../whatsnew/3.9.rst:1400 msgid "" ":c:func:`PyIndex_Check` is now always declared as an opaque function to hide " "implementation details: removed the ``PyIndex_Check()`` macro. The macro " "accessed directly the :c:member:`PyTypeObject.tp_as_number` member." msgstr "" -#: ../../whatsnew/3.9.rst:1403 +#: ../../whatsnew/3.9.rst:1404 msgid "(See :issue:`40170` for more details.)" msgstr "(更多資訊請見 :issue:`40170`。)" -#: ../../whatsnew/3.9.rst:1408 +#: ../../whatsnew/3.9.rst:1409 msgid "" "Excluded ``PyFPE_START_PROTECT()`` and ``PyFPE_END_PROTECT()`` macros of " "``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner in :issue:" "`38835`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1412 +#: ../../whatsnew/3.9.rst:1413 msgid "" "The ``tp_print`` slot of :ref:`PyTypeObject ` has been " "removed. It was used for printing objects to files in Python 2.7 and before. " @@ -2253,89 +2255,89 @@ msgid "" "Demeyer in :issue:`36974`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1419 +#: ../../whatsnew/3.9.rst:1420 msgid "Excluded the following functions from the limited C API:" msgstr "" -#: ../../whatsnew/3.9.rst:1421 +#: ../../whatsnew/3.9.rst:1422 msgid "" "``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye in :issue:" "`37878`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1423 +#: ../../whatsnew/3.9.rst:1424 msgid "``_Py_CheckRecursionLimit``" msgstr "``_Py_CheckRecursionLimit``" -#: ../../whatsnew/3.9.rst:1424 +#: ../../whatsnew/3.9.rst:1425 msgid "``_Py_NewReference()``" msgstr "``_Py_NewReference()``" -#: ../../whatsnew/3.9.rst:1425 +#: ../../whatsnew/3.9.rst:1426 msgid "``_Py_ForgetReference()``" msgstr "``_Py_ForgetReference()``" -#: ../../whatsnew/3.9.rst:1426 +#: ../../whatsnew/3.9.rst:1427 msgid "``_PyTraceMalloc_NewReference()``" msgstr "``_PyTraceMalloc_NewReference()``" -#: ../../whatsnew/3.9.rst:1427 +#: ../../whatsnew/3.9.rst:1428 msgid "``_Py_GetRefTotal()``" msgstr "``_Py_GetRefTotal()``" -#: ../../whatsnew/3.9.rst:1428 +#: ../../whatsnew/3.9.rst:1429 msgid "The trashcan mechanism which never worked in the limited C API." msgstr "" -#: ../../whatsnew/3.9.rst:1429 +#: ../../whatsnew/3.9.rst:1430 msgid "``PyTrash_UNWIND_LEVEL``" msgstr "``PyTrash_UNWIND_LEVEL``" -#: ../../whatsnew/3.9.rst:1430 +#: ../../whatsnew/3.9.rst:1431 msgid "``Py_TRASHCAN_BEGIN_CONDITION``" msgstr "``Py_TRASHCAN_BEGIN_CONDITION``" -#: ../../whatsnew/3.9.rst:1431 +#: ../../whatsnew/3.9.rst:1432 msgid "``Py_TRASHCAN_BEGIN``" msgstr "``Py_TRASHCAN_BEGIN``" -#: ../../whatsnew/3.9.rst:1432 +#: ../../whatsnew/3.9.rst:1433 msgid "``Py_TRASHCAN_END``" msgstr "``Py_TRASHCAN_END``" -#: ../../whatsnew/3.9.rst:1433 +#: ../../whatsnew/3.9.rst:1434 msgid "``Py_TRASHCAN_SAFE_BEGIN``" msgstr "``Py_TRASHCAN_SAFE_BEGIN``" -#: ../../whatsnew/3.9.rst:1434 +#: ../../whatsnew/3.9.rst:1435 msgid "``Py_TRASHCAN_SAFE_END``" msgstr "``Py_TRASHCAN_SAFE_END``" -#: ../../whatsnew/3.9.rst:1436 +#: ../../whatsnew/3.9.rst:1437 msgid "Moved following functions and definitions to the internal C API:" msgstr "" -#: ../../whatsnew/3.9.rst:1438 +#: ../../whatsnew/3.9.rst:1439 msgid "``_PyDebug_PrintTotalRefs()``" msgstr "``_PyDebug_PrintTotalRefs()``" -#: ../../whatsnew/3.9.rst:1439 +#: ../../whatsnew/3.9.rst:1440 msgid "``_Py_PrintReferences()``" msgstr "``_Py_PrintReferences()``" -#: ../../whatsnew/3.9.rst:1440 +#: ../../whatsnew/3.9.rst:1441 msgid "``_Py_PrintReferenceAddresses()``" msgstr "``_Py_PrintReferenceAddresses()``" -#: ../../whatsnew/3.9.rst:1441 +#: ../../whatsnew/3.9.rst:1442 msgid "``_Py_tracemalloc_config``" msgstr "``_Py_tracemalloc_config``" -#: ../../whatsnew/3.9.rst:1442 +#: ../../whatsnew/3.9.rst:1443 msgid "``_Py_AddToAllObjects()`` (specific to ``Py_TRACE_REFS`` build)" msgstr "" -#: ../../whatsnew/3.9.rst:1446 +#: ../../whatsnew/3.9.rst:1447 msgid "" "Removed ``_PyRuntime.getframe`` hook and removed ``_PyThreadState_GetFrame`` " "macro which was an alias to ``_PyRuntime.getframe``. They were only exposed " @@ -2343,72 +2345,72 @@ msgid "" "(Contributed by Victor Stinner in :issue:`39946`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1451 +#: ../../whatsnew/3.9.rst:1452 msgid "" "Removed the following functions from the C API. Call :c:func:`PyGC_Collect` " "explicitly to clear all free lists. (Contributed by Inada Naoki and Victor " "Stinner in :issue:`37340`, :issue:`38896` and :issue:`40428`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1456 +#: ../../whatsnew/3.9.rst:1457 msgid "``PyAsyncGen_ClearFreeLists()``" msgstr "``PyAsyncGen_ClearFreeLists()``" -#: ../../whatsnew/3.9.rst:1457 +#: ../../whatsnew/3.9.rst:1458 msgid "``PyContext_ClearFreeList()``" msgstr "``PyContext_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1458 +#: ../../whatsnew/3.9.rst:1459 msgid "``PyDict_ClearFreeList()``" msgstr "``PyDict_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1459 +#: ../../whatsnew/3.9.rst:1460 msgid "``PyFloat_ClearFreeList()``" msgstr "``PyFloat_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1460 +#: ../../whatsnew/3.9.rst:1461 msgid "``PyFrame_ClearFreeList()``" msgstr "``PyFrame_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1461 +#: ../../whatsnew/3.9.rst:1462 msgid "``PyList_ClearFreeList()``" msgstr "``PyList_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1462 +#: ../../whatsnew/3.9.rst:1463 msgid "" "``PyMethod_ClearFreeList()`` and ``PyCFunction_ClearFreeList()``: the free " "lists of bound method objects have been removed." msgstr "" -#: ../../whatsnew/3.9.rst:1464 +#: ../../whatsnew/3.9.rst:1465 msgid "" "``PySet_ClearFreeList()``: the set free list has been removed in Python 3.4." msgstr "" -#: ../../whatsnew/3.9.rst:1466 +#: ../../whatsnew/3.9.rst:1467 msgid "``PyTuple_ClearFreeList()``" msgstr "``PyTuple_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1467 +#: ../../whatsnew/3.9.rst:1468 msgid "" "``PyUnicode_ClearFreeList()``: the Unicode free list has been removed in " "Python 3.3." msgstr "" -#: ../../whatsnew/3.9.rst:1470 +#: ../../whatsnew/3.9.rst:1471 msgid "" "Removed ``_PyUnicode_ClearStaticStrings()`` function. (Contributed by Victor " "Stinner in :issue:`39465`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1473 +#: ../../whatsnew/3.9.rst:1474 msgid "" "Removed ``Py_UNICODE_MATCH``. It has been deprecated by :pep:`393`, and " "broken since Python 3.3. The :c:func:`PyUnicode_Tailmatch` function can be " "used instead. (Contributed by Inada Naoki in :issue:`36346`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1478 +#: ../../whatsnew/3.9.rst:1479 msgid "" "Cleaned header files of interfaces defined but with no implementation. The " "public API symbols being removed are: " @@ -2421,26 +2423,26 @@ msgid "" "`39372`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1489 +#: ../../whatsnew/3.9.rst:1490 msgid "Notable changes in Python 3.9.1" msgstr "Python 3.9.1 中顯著的變更" -#: ../../whatsnew/3.9.rst:1494 +#: ../../whatsnew/3.9.rst:1495 msgid "" "The behavior of :class:`typing.Literal` was changed to conform with :pep:" "`586` and to match the behavior of static type checkers specified in the PEP." msgstr "" -#: ../../whatsnew/3.9.rst:1497 +#: ../../whatsnew/3.9.rst:1498 msgid "``Literal`` now de-duplicates parameters." msgstr "" -#: ../../whatsnew/3.9.rst:1498 +#: ../../whatsnew/3.9.rst:1499 msgid "" "Equality comparisons between ``Literal`` objects are now order independent." msgstr "" -#: ../../whatsnew/3.9.rst:1499 +#: ../../whatsnew/3.9.rst:1500 msgid "" "``Literal`` comparisons now respect types. For example, ``Literal[0] == " "Literal[False]`` previously evaluated to ``True``. It is now ``False``. To " @@ -2448,7 +2450,7 @@ msgid "" "differentiating types." msgstr "" -#: ../../whatsnew/3.9.rst:1503 +#: ../../whatsnew/3.9.rst:1504 msgid "" "``Literal`` objects will now raise a :exc:`TypeError` exception during " "equality comparisons if any of their parameters are not :term:`hashable`. " @@ -2456,7 +2458,7 @@ msgid "" "error::" msgstr "" -#: ../../whatsnew/3.9.rst:1508 +#: ../../whatsnew/3.9.rst:1509 msgid "" ">>> from typing import Literal\n" ">>> Literal[{0}]\n" @@ -2472,15 +2474,15 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: unhashable type: 'set'" -#: ../../whatsnew/3.9.rst:1515 +#: ../../whatsnew/3.9.rst:1516 msgid "(Contributed by Yurii Karabas in :issue:`42345`.)" msgstr "(由 Yurii Karabas 在 :issue:`42345` 中貢獻。)" -#: ../../whatsnew/3.9.rst:1518 +#: ../../whatsnew/3.9.rst:1519 msgid "macOS 11.0 (Big Sur) and Apple Silicon Mac support" msgstr "" -#: ../../whatsnew/3.9.rst:1520 +#: ../../whatsnew/3.9.rst:1521 msgid "" "As of 3.9.1, Python now fully supports building and running on macOS 11.0 " "(Big Sur) and on Apple Silicon Macs (based on the ``ARM64`` architecture). A " @@ -2492,19 +2494,19 @@ msgid "" "version in use at runtime (\"weaklinking\")." msgstr "" -#: ../../whatsnew/3.9.rst:1529 +#: ../../whatsnew/3.9.rst:1530 msgid "(Contributed by Ronald Oussoren and Lawrence D'Anna in :issue:`41100`.)" msgstr "(由 Ronald Oussoren 和 Lawrence D'Anna 在 :issue:`41100` 中貢獻。)" -#: ../../whatsnew/3.9.rst:1532 +#: ../../whatsnew/3.9.rst:1533 msgid "Notable changes in Python 3.9.2" msgstr "Python 3.9.2 中顯著的變更" -#: ../../whatsnew/3.9.rst:1535 +#: ../../whatsnew/3.9.rst:1536 msgid "collections.abc" msgstr "collections.abc" -#: ../../whatsnew/3.9.rst:1537 +#: ../../whatsnew/3.9.rst:1538 msgid "" ":class:`collections.abc.Callable` generic now flattens type parameters, " "similar to what :data:`typing.Callable` currently does. This means that " @@ -2520,11 +2522,11 @@ msgid "" "Python 3.10. (Contributed by Ken Jin in :issue:`42195`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1551 ../../whatsnew/3.9.rst:1576 +#: ../../whatsnew/3.9.rst:1552 ../../whatsnew/3.9.rst:1577 msgid "urllib.parse" msgstr "urllib.parse" -#: ../../whatsnew/3.9.rst:1553 +#: ../../whatsnew/3.9.rst:1554 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " "parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." @@ -2536,11 +2538,11 @@ msgid "" "Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1564 +#: ../../whatsnew/3.9.rst:1565 msgid "Notable changes in Python 3.9.3" msgstr "Python 3.9.3 中顯著的變更" -#: ../../whatsnew/3.9.rst:1566 +#: ../../whatsnew/3.9.rst:1567 msgid "" "A security fix alters the :class:`ftplib.FTP` behavior to not trust the IPv4 " "address sent from the remote server when setting up a passive data channel. " @@ -2549,11 +2551,11 @@ msgid "" "instance to ``True``. (See :gh:`87451`)" msgstr "" -#: ../../whatsnew/3.9.rst:1573 +#: ../../whatsnew/3.9.rst:1574 msgid "Notable changes in Python 3.9.5" msgstr "Python 3.9.5 中顯著的變更" -#: ../../whatsnew/3.9.rst:1578 +#: ../../whatsnew/3.9.rst:1579 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " "forms of attacks. Following the WHATWG specification that updates :rfc:" @@ -2563,11 +2565,11 @@ msgid "" "variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" -#: ../../whatsnew/3.9.rst:1586 +#: ../../whatsnew/3.9.rst:1587 msgid "Notable security feature in 3.9.14" msgstr "" -#: ../../whatsnew/3.9.rst:1588 +#: ../../whatsnew/3.9.rst:1589 msgid "" "Converting between :class:`int` and :class:`str` in bases other than 2 " "(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " @@ -2580,15 +2582,15 @@ msgid "" "digits in string form." msgstr "" -#: ../../whatsnew/3.9.rst:1599 +#: ../../whatsnew/3.9.rst:1600 msgid "Notable changes in 3.9.17" msgstr "" -#: ../../whatsnew/3.9.rst:1602 +#: ../../whatsnew/3.9.rst:1603 msgid "tarfile" msgstr "tarfile" -#: ../../whatsnew/3.9.rst:1604 +#: ../../whatsnew/3.9.rst:1605 msgid "" "The extraction methods in :mod:`tarfile`, and :func:`shutil.unpack_archive`, " "have a new a *filter* argument that allows limiting tar features than may be " From 1707687320c6158060e2bb9ca0675787e63b4fd7 Mon Sep 17 00:00:00 2001 From: Payon Date: Mon, 7 Oct 2024 21:41:44 +0800 Subject: [PATCH 31/89] Translate reference/import.po (#983) * feat: to rst:241 feat: to rst:241 * fix: to rst: 336 * fix: Apply suggestions from code review --- reference/import.po | 166 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 155 insertions(+), 11 deletions(-) diff --git a/reference/import.po b/reference/import.po index 4fb01ece71..5dd27d0187 100644 --- a/reference/import.po +++ b/reference/import.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-28 00:13+0000\n" -"PO-Revision-Date: 2018-05-23 16:17+0000\n" +"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"PO-Revision-Date: 2024-10-07 21:14+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -16,6 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.5\n" #: ../../reference/import.rst:6 msgid "The import system" @@ -29,6 +30,10 @@ msgid "" "way. Functions such as :func:`importlib.import_module` and built-in :func:" "`__import__` can also be used to invoke the import machinery." msgstr "" +"一個 :term:`module` 中的 Python 程式碼透過 :term:`importing` 的過程來存取另一" +"個模組中的程式碼。:keyword:`import` 陳述式是調用 (invoke) 引入機制最常見的方" +"法,但這不是唯一的方法。函式如 :func:`importlib.import_module` 以及內建函式 :" +"func:`__import__` 也可以用來調用引入機制。" #: ../../reference/import.rst:16 msgid "" @@ -41,6 +46,11 @@ msgid "" "keyword:`!import` statement for the exact details of that name binding " "operation." msgstr "" +":keyword:`import` 陳述式結合了兩個操作:首先搜尋指定的模組,然後將搜尋結果繫" +"結到本地作用域中的一個名稱。:keyword:`!import` 陳述式的搜尋操作被定義為一個" +"對 :func:`__import__` 函式的呼叫,並帶有相應的引數。:func:`__import__` 的回傳" +"值用於執行 :keyword:`!import` 陳述式的名稱繫結操作。有關名稱繫結操作的詳細資" +"訊,請參見 :keyword:`!import` 陳述式。" #: ../../reference/import.rst:25 msgid "" @@ -50,6 +60,10 @@ msgid "" "(including :data:`sys.modules`), only the :keyword:`import` statement " "performs a name binding operation." msgstr "" +"直接呼叫 :func:`__import__` 只會執行模組搜尋操作,以及在找到時執行模組的建立" +"操作。雖然某些副作用可能會發生,例如引入父套件 (parent package),以及更新各種" +"快取(包括 :data:`sys.modules`),但只有 :keyword:`import` 陳述式會執行名稱繫" +"結操作。" #: ../../reference/import.rst:31 msgid "" @@ -58,6 +72,9 @@ msgid "" "system (such as :func:`importlib.import_module`) may choose to bypass :func:" "`__import__` and use their own solutions to implement import semantics." msgstr "" +"當執行 :keyword:`import` 陳述式時,會呼叫內建的 :func:`__import__` 函式。其他" +"調用引入系統的機制(如 :func:`importlib.import_module`)可以選擇略過 :func:" +"`__import__`,並使用它們自己的解決方案來實作引入語意。" #: ../../reference/import.rst:36 msgid "" @@ -68,6 +85,10 @@ msgid "" "machinery is invoked. These strategies can be modified and extended by " "using various hooks described in the sections below." msgstr "" +"當模組首次被引入時,Python 會搜尋該模組,若找到則會建立一個模組物件 " +"[#fnmo]_,並對其進行初始化。如果找不到指定的模組,則會引發 :exc:" +"`ModuleNotFoundError`。當引入機制被調用時,Python 會實作各種策略來搜尋指定的" +"模組。這些策略可以透過使用以下章節描述的各種 hook(掛鉤)來修改和擴展。" #: ../../reference/import.rst:43 msgid "" @@ -76,6 +97,9 @@ msgid "" "import system is exposed through :data:`sys.meta_path`. In addition, native " "namespace package support has been implemented (see :pep:`420`)." msgstr "" +"引入系統已被更新,以完全實作 :pep:`302` 的第二階段。不再有隱式引入機制——完整" +"的引入系統已透過 :data:`sys.meta_path` 公開。此外,原生命名空間套件支援(請參" +"閱 :pep:`420`)也已被實作。" #: ../../reference/import.rst:51 msgid ":mod:`importlib`" @@ -89,6 +113,9 @@ msgid "" "import machinery. Refer to the :mod:`importlib` library documentation for " "additional detail." msgstr "" +":mod:`importlib` 模組提供了豐富的 API 來與引入系統互動。例如,:func:" +"`importlib.import_module` 提供了一個比內建的 :func:`__import__` 更推薦且更簡" +"單的 API 來調用引入機制。更多詳細資訊請參閱 :mod:`importlib` 函式庫文件。" #: ../../reference/import.rst:62 msgid "Packages" @@ -101,6 +128,9 @@ msgid "" "else. To help organize modules and provide a naming hierarchy, Python has a " "concept of :term:`packages `." msgstr "" +"Python 只有一種類型的模組物件,且所有模組,無論其是使用 Python、C 還是其他語" +"言實作,都是這種類型。為了幫助組織模組並提供命名階層,Python 導入了\\ :term:`" +"套件 `\\ 的概念。" #: ../../reference/import.rst:72 msgid "" @@ -112,6 +142,10 @@ msgid "" "hierarchically, and packages may themselves contain subpackages, as well as " "regular modules." msgstr "" +"你可以將套件視為檔案系統中的目錄,模組則是目錄中的檔案,但不要過於字面地理解" +"這個比喻,因為套件和模組不一定來自檔案系統。為了方便解釋,我們將使用這個目錄" +"和檔案的比喻。就像檔案系統目錄一樣,套件是分層組織的,套件本身可以包含子套件" +"以及一般模組。" #: ../../reference/import.rst:80 msgid "" @@ -120,6 +154,8 @@ msgid "" "of module. Specifically, any module that contains a ``__path__`` attribute " "is considered a package." msgstr "" +"請記住,所有的套件都是模組,但並非所有模組都是套件。換句話說,套件只是一種特" +"殊的模組。具體來說,任何包含 ``__path__`` 屬性的模組都被視為套件。" #: ../../reference/import.rst:85 msgid "" @@ -129,10 +165,14 @@ msgid "" "subpackage called :mod:`email.mime` and a module within that subpackage " "called :mod:`email.mime.text`." msgstr "" +"所有模組都有一個名稱。子套件的名稱與其父套件名稱之間用一個點來分隔,類似於 " +"Python 的標準屬性存取語法。因此,你可能會有一個名為 :mod:`email` 的套件,該套" +"件又有一個名為 :mod:`email.mime` 的子套件,並且該子套件中有一個名為 :mod:" +"`email.mime.text` 的模組。" #: ../../reference/import.rst:93 msgid "Regular packages" -msgstr "" +msgstr "一般套件" #: ../../reference/import.rst:98 msgid "" @@ -146,12 +186,20 @@ msgid "" "same Python code that any other module can contain, and Python will add some " "additional attributes to the module when it is imported." msgstr "" +"Python 定義了兩種類型的套件,:term:`一般套件 `\\ 和\\ :term:" +"`命名空間套件 `。一般套件是 Python 3.2 及更早版本中存在的" +"傳統套件。一般套件通常實作成一個包含 ``__init__.py`` 檔案的目錄。當引入一般套" +"件時,該 ``__init__.py`` 檔案會被隱式執行,其定義的物件會繫結到該套件的命名空" +"間中的名稱。``__init__.py`` 檔案可以包含與任何其他模組相同的 Python 程式碼," +"並且 Python 會在引入時為該模組增加一些額外的屬性。" #: ../../reference/import.rst:108 msgid "" "For example, the following file system layout defines a top level ``parent`` " "package with three subpackages::" msgstr "" +"例如,以下檔案系統布置定義了一個頂層的 ``parent`` 套件,該套件包含三個子套" +"件: ::" #: ../../reference/import.rst:111 msgid "" @@ -180,10 +228,13 @@ msgid "" "``parent.three`` will execute ``parent/two/__init__.py`` and ``parent/three/" "__init__.py`` respectively." msgstr "" +"引入 ``parent.one`` 將隱式執行 ``parent/__init__.py`` 和 ``parent/one/" +"__init__.py``。隨後引入 ``parent.two`` 或 ``parent.three`` 將分別執行 " +"``parent/two/__init__.py`` 和 ``parent/three/__init__.py``。" #: ../../reference/import.rst:127 msgid "Namespace packages" -msgstr "" +msgstr "命名空間套件" #: ../../reference/import.rst:133 msgid "" @@ -195,6 +246,10 @@ msgid "" "objects on the file system; they may be virtual modules that have no " "concrete representation." msgstr "" +"命名空間套件是由不同的\\ :term:`部分 ` 組成的,每個部分都為父套件提" +"供一個子套件。這些部分可以位於檔案系統上的不同位置。部分可能也存在於壓縮檔案" +"中、網路上,或 Python 在引入時搜尋的任何其他地方。命名空間套件不一定直接對應" +"於檔案系統中的對象;它們可能是沒有具體表示的虛擬模組。" #: ../../reference/import.rst:141 msgid "" @@ -204,6 +259,9 @@ msgid "" "that package if the path of their parent package (or :data:`sys.path` for a " "top level package) changes." msgstr "" +"命名空間套件的 ``__path__`` 屬性不使用普通的串列。它們使用自定義的可疊代型" +"別,當父套件的路徑(或頂層套件的 :data:`sys.path`)發生變化時,會在下一次引入" +"嘗試時自動執行新一輪的套件部分搜尋。" #: ../../reference/import.rst:147 msgid "" @@ -214,14 +272,19 @@ msgid "" "create a namespace package for the top-level ``parent`` package whenever it " "or one of its subpackages is imported." msgstr "" +"在命名空間套件中,不存在 ``parent/__init__.py`` 檔案。實際上,在引入搜尋過程" +"中可能會找到多個 ``parent`` 目錄,每個目錄由不同的部分提供。因此,``parent/" +"one`` 可能與 ``parent/two`` 不會實際位於一起。在這種情況下,每當引入頂層 " +"``parent`` 套件或其子套件之一時,Python 會為頂層 ``parent`` 套件建立一個命名" +"空間套件。" #: ../../reference/import.rst:154 msgid "See also :pep:`420` for the namespace package specification." -msgstr "" +msgstr "有關命名空間套件的規範,請參見 :pep:`420`。" #: ../../reference/import.rst:158 msgid "Searching" -msgstr "" +msgstr "搜尋" #: ../../reference/import.rst:160 msgid "" @@ -232,6 +295,10 @@ msgid "" "parameters to the :func:`importlib.import_module` or :func:`__import__` " "functions." msgstr "" +"在開始搜尋之前,Python 需要被引入模組(或套件,但在本討論中,兩者的區別無關緊" +"要)的完整\\ :term:`限定名稱 (qualified name) `。此名稱可能來" +"自 :keyword:`import` 陳述式的各種引數,或來自 :func:`importlib." +"import_module` 或 :func:`__import__` 函式的參數。" #: ../../reference/import.rst:166 msgid "" @@ -241,10 +308,14 @@ msgid "" "baz``. If any of the intermediate imports fail, a :exc:`ModuleNotFoundError` " "is raised." msgstr "" +"此名稱將在引入搜尋的各個階段中使用,並且它可能是指向子模組的點分隔路徑,例如 " +"``foo.bar.baz``。在這種情況下,Python 會首先嘗試引入 ``foo``,然後是 ``foo." +"bar``,最後是 ``foo.bar.baz``。如果任何中間引入失敗,則會引發 :exc:" +"`ModuleNotFoundError`。" #: ../../reference/import.rst:173 msgid "The module cache" -msgstr "" +msgstr "模組快取" #: ../../reference/import.rst:178 msgid "" @@ -255,6 +326,10 @@ msgid "" "and ``foo.bar.baz``. Each key will have as its value the corresponding " "module object." msgstr "" +"在引入搜尋過程中首先檢查的地方是 :data:`sys.modules`。此對映用作所有先前引入" +"過的模組的快取,包括中間路徑。因此,如果 ``foo.bar.baz`` 之前已被引入,:data:" +"`sys.modules` 將包含 ``foo``、``foo.bar`` 和 ``foo.bar.baz`` 的條目。每個鍵的" +"值都是相應的模組物件。" #: ../../reference/import.rst:185 msgid "" @@ -264,6 +339,9 @@ msgid "" "`ModuleNotFoundError` is raised. If the module name is missing, Python will " "continue searching for the module." msgstr "" +"在引入過程中,會在 :data:`sys.modules` 中查找模組名稱,如果存在,則相關的值為" +"滿足此引入的模組,此引入過程即完成。然而,如果值是 ``None``,則會引發 :exc:" +"`ModuleNotFoundError`。如果模組名稱不存在,Python 會繼續搜尋該模組。" #: ../../reference/import.rst:191 msgid "" @@ -274,6 +352,10 @@ msgid "" "to ``None``, forcing the next import of the module to result in a :exc:" "`ModuleNotFoundError`." msgstr "" +":data:`sys.modules` 是可寫入的。刪除一個鍵可能不會銷毀相關聯的模組(因為其他" +"模組可能持有對它的參照),但會使指定的模組的快取條目失效,導致 Python 在下一" +"次引入該模組時重新搜尋。也可以將鍵賦值為 ``None``,這會強制下一次引入該模組時" +"引發 :exc:`ModuleNotFoundError`。" #: ../../reference/import.rst:198 msgid "" @@ -283,10 +365,14 @@ msgid "" "reload` will reuse the *same* module object, and simply reinitialise the " "module contents by rerunning the module's code." msgstr "" +"但請注意,如果你保留了對模組物件的參照,並在 :data:`sys.modules` 中使其快取條" +"目失效,然後重新引入指定的模組,這兩個模組物件將\\ *不會*\\ 相同。相比之下,:" +"func:`importlib.reload` 會重用\\ *相同的*\\ 模組物件,並透過重新執行模組的程" +"式碼來簡單地重新初始化模組內容。" #: ../../reference/import.rst:208 msgid "Finders and loaders" -msgstr "" +msgstr "尋檢器 (Finder) 與載入器 (Loader)" #: ../../reference/import.rst:215 msgid "" @@ -299,6 +385,11 @@ msgid "" "they return themselves when they find that they can load the requested " "module." msgstr "" +"如果在 :data:`sys.modules` 中找不到指定的模組,則會調用 Python 的引入協定來尋" +"找並載入該模組。這個協定由兩個概念性物件組成,:term:`尋檢器 ` 和\\ :" +"term:`載入器 `。尋檢器的任務是使用其已知的策略來確定是否能找到命名模" +"組。實作這兩個介面的物件稱為\\ :term:`引入器 (importer) ` ——當它們" +"發現可以載入所請求的模組時,會回傳它們自己。" #: ../../reference/import.rst:223 msgid "" @@ -309,12 +400,17 @@ msgid "" "system paths or zip files. It can also be extended to search for any " "locatable resource, such as those identified by URLs." msgstr "" +"Python 包含多個預設的尋檢器和引入器。第一個尋檢器知道如何定位內建模組,第二個" +"尋檢器知道如何定位凍結模組。第三個預設尋檢器會在 :term:`import path` 中搜尋模" +"組。:term:`import path` 是一個位置的列表,這些位置可能是檔案系統路徑或壓縮檔" +"案,也可以擴展以搜尋任何可定位的資源,例如由 URL 識別的資源。" #: ../../reference/import.rst:230 msgid "" "The import machinery is extensible, so new finders can be added to extend " "the range and scope of module searching." msgstr "" +"引入機制是可擴展的,因此可以增加新的尋檢器來擴展模組搜尋的範圍和作用域。" #: ../../reference/import.rst:233 msgid "" @@ -323,6 +419,9 @@ msgid "" "related information, which the import machinery then uses when loading the " "module." msgstr "" +"尋檢器實際上不會載入模組。如果它們能找到指定的模組,它們會回傳一個\\ :dfn:`模" +"組規格`,這是一個模組的引入相關資訊的封裝,引入機制會在載入模組時使用這些資" +"訊。" #: ../../reference/import.rst:237 msgid "" @@ -330,6 +429,8 @@ msgid "" "detail, including how you can create and register new ones to extend the " "import machinery." msgstr "" +"以下各節將更詳細地描述尋檢器和載入器的協定,包括如何建立和註冊新的尋檢器和載" +"入器來擴展引入機制。" #: ../../reference/import.rst:241 msgid "" @@ -337,10 +438,13 @@ msgid "" "directly, whereas now they return module specs which *contain* loaders. " "Loaders are still used during import but have fewer responsibilities." msgstr "" +"Python 在之前的版本中,尋檢器會直接回傳\\ :term:`載入器 `,而現在它們" +"回傳的是\\ *包含*\\ 載入器的模組規格。載入器仍在引入過程中使用,但其責任減少" +"了。" #: ../../reference/import.rst:247 msgid "Import hooks" -msgstr "" +msgstr "引入掛鉤 (Import hooks)" #: ../../reference/import.rst:257 msgid "" @@ -348,6 +452,8 @@ msgid "" "this are the *import hooks*. There are two types of import hooks: *meta " "hooks* and *import path hooks*." msgstr "" +"引入機制的設計是可擴展的;其主要機制是\\ *引入掛鉤*。引入掛鉤有兩種類型:*元" +"掛鉤 (meta hooks)* 和\\ *引入路徑掛鉤*。" #: ../../reference/import.rst:261 msgid "" @@ -357,6 +463,10 @@ msgid "" "modules, or even built-in modules. Meta hooks are registered by adding new " "finder objects to :data:`sys.meta_path`, as described below." msgstr "" +"元掛鉤會在引入處理的開始階段被呼叫,除了查找 :data:`sys.modules` 快取外,其他" +"引入處理還未發生時就會呼叫。這允許元掛鉤覆蓋 :data:`sys.path` 的處理、凍結模" +"組,甚至是內建模組。元掛鉤透過將新的尋檢器物件添加到 :data:`sys.meta_path` 中" +"來註冊,具體描述請參閱以下段落。" #: ../../reference/import.rst:267 msgid "" @@ -365,10 +475,13 @@ msgid "" "encountered. Import path hooks are registered by adding new callables to :" "data:`sys.path_hooks` as described below." msgstr "" +"引入路徑掛鉤被視為 :data:`sys.path`\\ (或 ``package.__path__``)處理過程的一" +"部分來呼叫,當遇到與其相關聯的路徑項目時就會被觸發。引入路徑掛鉤透過將新的可" +"呼叫對象增加到 :data:`sys.path_hooks` 中來註冊,具體描述請參閱以下段落。" #: ../../reference/import.rst:274 msgid "The meta path" -msgstr "" +msgstr "元路徑" #: ../../reference/import.rst:280 msgid "" @@ -381,6 +494,11 @@ msgid "" "finder can use any strategy it wants to determine whether it can handle the " "named module or not." msgstr "" +"當在 :data:`sys.modules` 中找不到命名模組時,Python 接下來會搜尋 :data:`sys." +"meta_path`,其中包含一個元路徑尋檢器物件串列。這些尋檢器會依次被查詢,看它們" +"是否知道如何處理命名模組。元路徑尋檢器必須實作一個名為 :meth:`~importlib.abc." +"MetaPathFinder.find_spec` 的方法,該方法接收三個引數:名稱、引入路徑和(可選" +"的)目標模組。元路徑尋檢器可以使用任何策略來確定它是否能處理命名模組。" #: ../../reference/import.rst:289 msgid "" @@ -390,6 +508,10 @@ msgid "" "returning a spec, then a :exc:`ModuleNotFoundError` is raised. Any other " "exceptions raised are simply propagated up, aborting the import process." msgstr "" +"如果元路徑尋檢器知道如何處理命名模組,它會回傳一個規格物件。如果它無法處理命" +"名模組,則回傳 ``None``。如果 :data:`sys.meta_path` 的處理到達串列的末尾仍未" +"回傳規格,則會引發 :exc:`ModuleNotFoundError`。任何其他引發的例外將直接向上傳" +"播,並中止引入過程。" #: ../../reference/import.rst:295 msgid "" @@ -404,6 +526,12 @@ msgid "" "existing module object that will be the target of loading later. The import " "system passes in a target module only during reload." msgstr "" +"元路徑尋檢器的 :meth:`~importlib.abc.MetaPathFinder.find_spec` 方法會以兩個或" +"三個引數來呼叫。第一個是被引入模組的完全限定名稱,例如 ``foo.bar.baz``。第二" +"個引數是用於模組搜尋的路徑條目。對於頂層模組,第二個引數是 ``None``,但對於子" +"模組或子套件,第二個引數是父套件的 ``__path__`` 屬性的值。如果無法存取相應的 " +"``__path__`` 屬性,將引發 :exc:`ModuleNotFoundError`。第三個引數是一個現有的" +"模組物件,該物件將成為後續載入的目標。引入系統只會在重新載入時傳入目標模組。" #: ../../reference/import.rst:306 msgid "" @@ -416,6 +544,12 @@ msgid "" "__path__, None)``. Once ``foo.bar`` has been imported, the final traversal " "will call ``mpf.find_spec(\"foo.bar.baz\", foo.bar.__path__, None)``." msgstr "" +"對於一個引入請求,元路徑可能會被遍歷多次。例如,假設參與的模組都沒有被快取," +"則引入 ``foo.bar.baz`` 將首先執行頂層引入,對每個元路徑尋檢器(``mpf``)呼叫 " +"``mpf.find_spec(\"foo\", None, None)``。當 ``foo`` 被引入後,將再次藉由遍歷元" +"路徑引入 ``foo.bar``,並呼叫 ``mpf.find_spec(\"foo.bar\", foo.__path__, " +"None)``。當 ``foo.bar`` 被引入後,最後一次遍歷會呼叫 ``mpf.find_spec(\"foo." +"bar.baz\", foo.bar.__path__, None)``。" #: ../../reference/import.rst:316 msgid "" @@ -423,6 +557,8 @@ msgid "" "always return ``None`` when anything other than ``None`` is passed as the " "second argument." msgstr "" +"一些元路徑尋檢器僅支援頂層引入。當第二個引數傳入 ``None`` 以外的值時,這些引" +"入器將始終回傳 ``None``。" #: ../../reference/import.rst:320 msgid "" @@ -431,6 +567,9 @@ msgid "" "modules, and one that knows how to import modules from an :term:`import " "path` (i.e. the :term:`path based finder`)." msgstr "" +"Python 的預設 :data:`sys.meta_path` 有三個元路徑尋檢器,一個知道如何引入內建" +"模組,一個知道如何引入凍結模組,還有一個知道如何從 :term:`import path` 引入模" +"組(即 :term:`path based finder`)。" #: ../../reference/import.rst:325 msgid "" @@ -440,18 +579,23 @@ msgid "" "if the finder does not implement :meth:`~importlib.abc.MetaPathFinder." "find_spec`." msgstr "" +"元路徑尋檢器的 :meth:`~importlib.abc.MetaPathFinder.find_spec` 方法取代了 :" +"meth:`!find_module`,後者現在已被棄用。雖然它將繼續正常工作,但引入機制僅在尋" +"檢器未實作 :meth:`~importlib.abc.MetaPathFinder.find_spec` 時才會嘗試使用它。" #: ../../reference/import.rst:332 msgid "" "Use of :meth:`!find_module` by the import system now raises :exc:" "`ImportWarning`." -msgstr "" +msgstr "引入系統現在使用 :meth:`!find_module` 時將引發 :exc:`ImportWarning`。" #: ../../reference/import.rst:336 msgid "" ":meth:`!find_module` has been removed. Use :meth:`~importlib.abc." "MetaPathFinder.find_spec` instead." msgstr "" +":meth:`!find_module` 已被移除。請改用 :meth:`~importlib.abc.MetaPathFinder." +"find_spec`。" #: ../../reference/import.rst:342 msgid "Loading" From fabbfa0a83b81ca7900548dc70890f8d8c9865d3 Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Tue, 8 Oct 2024 02:14:46 +0800 Subject: [PATCH 32/89] Translate `library/webbrowser.po` (#974) * translate `library/webbrowser.po` * Apply suggestions from code review --- library/webbrowser.po | 111 +++++++++++++++++++++++++++++++++--------- 1 file changed, 87 insertions(+), 24 deletions(-) diff --git a/library/webbrowser.po b/library/webbrowser.po index 425faf6782..0bed38a963 100644 --- a/library/webbrowser.po +++ b/library/webbrowser.po @@ -1,15 +1,16 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Liang-Bo Wang , 2017 +# Matt Wang , 2024 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-24 07:20+0000\n" -"PO-Revision-Date: 2017-09-22 18:27+0000\n" -"Last-Translator: Liang-Bo Wang \n" +"PO-Revision-Date: 2024-09-24 18:27+0000\n" +"Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -32,6 +33,8 @@ msgid "" "displaying web-based documents to users. Under most circumstances, simply " "calling the :func:`.open` function from this module will do the right thing." msgstr "" +":mod:`webbrowser` 模組提供了一個高階介面,允許向使用者顯示基於網頁的文件。在" +"大多數情況下,只需從此模組呼叫 :func:`.open` 函式即可完成正確的操作。" #: ../../library/webbrowser.rst:18 msgid "" @@ -40,6 +43,9 @@ msgid "" "display isn't available. If text-mode browsers are used, the calling " "process will block until the user exits the browser." msgstr "" +"在 Unix 下,X11 下首選圖形瀏覽器,但如果圖形瀏覽器不可用或 X11 顯示不可用,則" +"將使用文字模式瀏覽器。如果使用文字模式瀏覽器,則呼叫程序將會阻塞 (block),直" +"到使用者退出瀏覽器。" #: ../../library/webbrowser.rst:23 msgid "" @@ -50,6 +56,10 @@ msgid "" "with the argument URL substituted for ``%s``; if the part does not contain " "``%s``, it is simply interpreted as the name of the browser to launch. [1]_" msgstr "" +"如果環境變數 :envvar:`BROWSER` 存在,它會被直譯為以 :data:`os.pathsep` 分隔的瀏" +"覽器串列,以在平台預設值之前嘗試。當串列部分的值包含字串 ``%s`` 時,它會被直" +"譯為字面瀏覽器命令列,並使用引數 URL 替換 ``%s``;如果該部分不包含 ``%s``,則" +"它僅被直譯為要啟動的瀏覽器的名稱。 [1]_" #: ../../library/webbrowser.rst:30 msgid "" @@ -59,6 +69,9 @@ msgid "" "remote browsers are not available on Unix, the controlling process will " "launch a new browser and wait." msgstr "" +"對於非 Unix 平台,或當 Unix 上有可用的遠端瀏覽器時,控制行程不會等待使用者以" +"完成瀏覽器,而是允許遠端瀏覽器在顯示器上維護自己的視窗。如果遠端瀏覽器在 " +"Unix 上不可用,控制行程將啟動新的瀏覽器並等待。" #: ../../library/webbrowser.rst:36 msgid "" @@ -69,6 +82,11 @@ msgid "" "use of the :mod:`webbrowser` module on iOS requires the :mod:`ctypes` " "module. If :mod:`ctypes` isn't available, calls to :func:`.open` will fail." msgstr "" +"在 iOS 上,:envvar:`BROWSER` 環境變數以及控制自動引發 (autoraise)、瀏覽器設定" +"和新分頁/視窗建立的任何引數都將被忽略。網頁將\\ *始終*\\ 在使用者偏好的瀏覽器" +"中的新分頁中開啟,並將瀏覽器帶到前台。在 iOS 上使用 :mod:`webbrowser` 模組需" +"要 :mod:`ctypes` 模組。如果 :mod:`ctypes` 不可用,則呼叫 :func:`.open` 將會失" +"敗。" #: ../../library/webbrowser.rst:43 msgid "" @@ -76,19 +94,21 @@ msgid "" "the module. It accepts a URL as the argument. It accepts the following " "optional parameters:" msgstr "" +"腳本 :program:`webbrowser` 可以用作模組的命令列介面。它接受 URL 作為引數。它" +"接受以下可選參數:" #: ../../library/webbrowser.rst:47 msgid "" "``-n``/``--new-window`` opens the URL in a new browser window, if possible." -msgstr "" +msgstr "如果可能的話,``-n``/``--new-window`` 會在新的瀏覽器視窗中開啟 URL。" #: ../../library/webbrowser.rst:48 msgid "``-t``/``--new-tab`` opens the URL in a new browser page (\"tab\")." -msgstr "" +msgstr "``-t``/``--new-tab`` 會在新的瀏覽器分頁 (\"tab\") 中開啟 URL。" #: ../../library/webbrowser.rst:50 msgid "The options are, naturally, mutually exclusive. Usage example::" -msgstr "" +msgstr "這些選項自然是相互排斥的。用法範例: ::" #: ../../library/webbrowser.rst:52 msgid "python -m webbrowser -t \"https://www.python.org/"" @@ -96,19 +116,19 @@ msgstr "python -m webbrowser -t \"https://www.python.org/"" #: ../../library/webbrowser.rst:54 msgid ":ref:`Availability `: not WASI, not Android." -msgstr "" +msgstr ":ref:`可用性 `:非 WASI、非 Android。" #: ../../library/webbrowser.rst:56 msgid "The following exception is defined:" -msgstr "" +msgstr "以下例外有被定義於該模組:" #: ../../library/webbrowser.rst:61 msgid "Exception raised when a browser control error occurs." -msgstr "" +msgstr "當瀏覽器控制項發生錯誤時引發例外。" #: ../../library/webbrowser.rst:63 msgid "The following functions are defined:" -msgstr "" +msgstr "以下函式有被定義於該模組:" #: ../../library/webbrowser.rst:68 msgid "" @@ -119,12 +139,16 @@ msgid "" "possible (note that under many window managers this will occur regardless of " "the setting of this variable)." msgstr "" +"使用預設瀏覽器顯示 *url*。如果 *new* 為 0,則盡可能在同一瀏覽器視窗中開啟 " +"*url*。如果 *new* 為 1,則盡可能開啟一個新的瀏覽器視窗。如果 *new* 為 2,則盡" +"可能開啟一個新的瀏覽器分頁 (\"tab\")。如果 *autoraise* 為 ``True``,則盡可能" +"提升視窗(請注意,無論此變數的設定如何,許多視窗管理器下都會發生這種情況)。" #: ../../library/webbrowser.rst:75 ../../library/webbrowser.rst:89 #: ../../library/webbrowser.rst:97 msgid "" "Returns ``True`` if a browser was successfully launched, ``False`` otherwise." -msgstr "" +msgstr "如果瀏覽器成功啟動則回傳 ``True``,否則回傳 ``False``。" #: ../../library/webbrowser.rst:77 msgid "" @@ -132,6 +156,8 @@ msgid "" "may work and start the operating system's associated program. However, this " "is neither supported nor portable." msgstr "" +"請注意,在某些平台上,嘗試使用此函式開啟檔案名稱可能能夠運作並啟動作業系統的" +"關聯程式。然而這既不支援也不可移植。" #: ../../library/webbrowser.rst:81 msgid "" @@ -146,12 +172,15 @@ msgid "" "Open *url* in a new window of the default browser, if possible, otherwise, " "open *url* in the only browser window." msgstr "" +"盡可能在預設瀏覽器的新視窗中開啟 *url*,否則在唯一的瀏覽器視窗中開啟 *url*。" #: ../../library/webbrowser.rst:94 msgid "" "Open *url* in a new page (\"tab\") of the default browser, if possible, " "otherwise equivalent to :func:`open_new`." msgstr "" +"盡可能在預設瀏覽器的新分頁 (\"tab\") 中開啟 *url*,否則相當於 :func:" +"`open_new`。" #: ../../library/webbrowser.rst:102 msgid "" @@ -159,6 +188,8 @@ msgid "" "``None``, return a controller for a default browser appropriate to the " "caller's environment." msgstr "" +"回傳瀏覽器類型\\ *使用*(以引數 *using* 給定)的控制器物件。如果 *using* 為 ``None``,則回傳適合" +"呼叫者環境的預設瀏覽器控制器。" #: ../../library/webbrowser.rst:109 msgid "" @@ -168,6 +199,10 @@ msgid "" "without parameters to create an instance when needed. If *instance* is " "provided, *constructor* will never be called, and may be ``None``." msgstr "" +"註冊瀏覽器類型\\ *名稱*(以引數 *name* 給定)。一旦註冊了瀏覽器類型,:func:`get` 函式就可以回傳該瀏" +"覽器類型的控制器。如果沒有提供 *instance* 或為 ``None``,則會在需要時不帶參數" +"地呼叫 *constructor* 來建立實例。如果提供了 *instance*,*constructor* 將永遠" +"不會被呼叫,並且可能為 ``None``。" #: ../../library/webbrowser.rst:115 msgid "" @@ -177,10 +212,13 @@ msgid "" "func:`get` with a nonempty argument matching the name of a handler you " "declare." msgstr "" +"將 *preferred* 設為 ``True`` 會使該瀏覽器成為不帶引數的 :func:`get` 呼叫的偏" +"好結果。否則只有當你計劃設定 :envvar:`BROWSER` 變數或使用與你宣告的處理程序名" +"稱相符的非空引數呼叫 :func:`get` 時,此入口點才會有用。" #: ../../library/webbrowser.rst:121 msgid "*preferred* keyword-only parameter was added." -msgstr "" +msgstr "新增了 *preferred* 僅限關鍵字參數。" #: ../../library/webbrowser.rst:124 msgid "" @@ -188,14 +226,16 @@ msgid "" "that may be passed to the :func:`get` function and the corresponding " "instantiations for the controller classes, all defined in this module." msgstr "" +"預先定義了多種瀏覽器類型。此表給出了可以傳遞給 :func:`get` 函式的類型名稱以及" +"控制器類別的相應實例化方式,這些都定義於此模組中。" #: ../../library/webbrowser.rst:129 msgid "Type Name" -msgstr "" +msgstr "類型名稱" #: ../../library/webbrowser.rst:129 msgid "Class Name" -msgstr "" +msgstr "類別名稱" #: ../../library/webbrowser.rst:129 msgid "Notes" @@ -372,18 +412,22 @@ msgid "" "program:`konqueror` command with KDE 2 --- the implementation selects the " "best strategy for running Konqueror." msgstr "" +"\"Konqueror\" 是 Unix 的 KDE 桌面環境的檔案管理器,只有在 KDE 運作時才有意" +"義。最好能有某種可靠的 KDE 檢測方法;僅有 :envvar:`!KDEDIR` 變數是不夠的。另" +"請注意,即使在 KDE 2 中使用 :program:`konqueror` 命令時,也會使用 \"kfm\" 名" +"稱 --- 該實作會選擇執行 Konqueror 的最佳策略。" #: ../../library/webbrowser.rst:180 msgid "Only on Windows platforms." -msgstr "" +msgstr "僅在 Windows 平台上。" #: ../../library/webbrowser.rst:183 msgid "Only on macOS." -msgstr "" +msgstr "僅在 macOS 上。" #: ../../library/webbrowser.rst:186 msgid "Only on iOS." -msgstr "" +msgstr "僅在 iOS 上。" #: ../../library/webbrowser.rst:188 msgid "" @@ -391,10 +435,12 @@ msgid "" "instead of the previous :class:`!MacOSX` class. This adds support for " "opening browsers not currently set as the OS default." msgstr "" +"新增了 :class:`!MacOSXOSAScript` 類別並於 Mac 上使用,而非使用先前的 :class:" +"`!MacOSX` 類別。這增加了對開啟目前未設定為作業系統預設之瀏覽器的支援。" #: ../../library/webbrowser.rst:193 msgid "Support for Chrome/Chromium has been added." -msgstr "" +msgstr "新增了對 Chrome/Chromium 的支援。" #: ../../library/webbrowser.rst:196 msgid "" @@ -402,10 +448,12 @@ msgid "" "include Grail, Mosaic, Netscape, Galeon, Skipstone, Iceape, and Firefox " "versions 35 and below." msgstr "" +"對多個過時瀏覽器的支援已被刪除。已刪除的瀏覽器包括 Grail、Mosaic、Netscape、" +"Galeon、Skipstone、Iceape 和 Firefox 35 及以下版本。" #: ../../library/webbrowser.rst:201 msgid "Support for iOS has been added." -msgstr "" +msgstr "新增了對 iOS 的支援。" #: ../../library/webbrowser.rst:204 msgid "Here are some simple examples::" @@ -421,20 +469,27 @@ msgid "" "# Open URL in new window, raising the window if possible.\n" "webbrowser.open_new(url)" msgstr "" +"url = 'https://docs.python.org/'\n" +"\n" +"# 如果瀏覽器視窗已打開,則在新分頁中開啟 URL。\n" +"webbrowser.open_new_tab(url)\n" +"\n" +"# 在新視窗中開啟 URL,如果可能的話提升視窗。\n" +"webbrowser.open_new(url)" #: ../../library/webbrowser.rst:218 msgid "Browser Controller Objects" -msgstr "" +msgstr "瀏覽器控制器物件" #: ../../library/webbrowser.rst:220 msgid "" "Browser controllers provide these methods which parallel three of the module-" "level convenience functions:" -msgstr "" +msgstr "瀏覽器控制器提供了這些與三個模組層級便利函式相同的方法:" #: ../../library/webbrowser.rst:226 msgid "System-dependent name for the browser." -msgstr "" +msgstr "瀏覽器的系統相依名稱 (system-dependent name)。" #: ../../library/webbrowser.rst:231 msgid "" @@ -442,6 +497,8 @@ msgid "" "new browser window is opened if possible. If *new* is 2, a new browser page " "(\"tab\") is opened if possible." msgstr "" +"使用此控制器處理的瀏覽器顯示 *url*。如果 *new* 為 1,則盡可能開啟一個新的瀏覽" +"器視窗。如果 *new* 為 2,則盡可能開啟一個新的瀏覽器分頁 (\"tab\")。" #: ../../library/webbrowser.rst:238 msgid "" @@ -449,19 +506,25 @@ msgid "" "possible, otherwise, open *url* in the only browser window. Alias :func:" "`open_new`." msgstr "" +"盡可能在此控制器處理的瀏覽器的新視窗中開啟 *url*,否則在唯一的瀏覽器視窗中開" +"啟 *url*。別名為 :func:`open_new`。" #: ../../library/webbrowser.rst:245 msgid "" "Open *url* in a new page (\"tab\") of the browser handled by this " "controller, if possible, otherwise equivalent to :func:`open_new`." msgstr "" +"盡可能在此控制器處理的瀏覽器的新分頁 (\"tab\") 中開啟 *url*,否則相當於 :" +"func:`open_new`。" #: ../../library/webbrowser.rst:250 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../library/webbrowser.rst:251 msgid "" "Executables named here without a full path will be searched in the " "directories given in the :envvar:`PATH` environment variable." msgstr "" +"此處命名的無完整路徑可執行檔將在 :envvar:`PATH` 環境變數中給定的目錄中被搜" +"尋。" From 18ec5f062db1fed187bbeca1680e2f62603c0f1a Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Tue, 8 Oct 2024 02:25:03 +0800 Subject: [PATCH 33/89] translate Lock & RLock part of `library/threading.po` --- library/threading.po | 99 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 83 insertions(+), 16 deletions(-) diff --git a/library/threading.po b/library/threading.po index 13f67b22f7..9ad9e1c1bb 100644 --- a/library/threading.po +++ b/library/threading.po @@ -673,7 +673,7 @@ msgstr "" #: ../../library/threading.rst:503 msgid "Lock Objects" -msgstr "" +msgstr "Lock 物件" #: ../../library/threading.rst:505 msgid "" @@ -682,6 +682,9 @@ msgid "" "synchronization primitive available, implemented directly by the :mod:" "`_thread` extension module." msgstr "" +"原始鎖 (primitive lock) 是一種同步原語 (synchronization primitive),在鎖定時" +"不屬於特定執行緒。在 Python 中,它是目前可用的最低階同步原語,直接由 :mod:" +"`_thread` 擴充模組實作。" #: ../../library/threading.rst:510 msgid "" @@ -696,10 +699,18 @@ msgid "" "state to unlocked and returns immediately. If an attempt is made to release " "an unlocked lock, a :exc:`RuntimeError` will be raised." msgstr "" +"原始鎖會處於兩種狀態之一:「鎖定 (locked)」或「未鎖定 (unclocked)」,建立時會" +"處於未鎖定狀態。它有兩個基本方法 :meth:`~Lock.acquire` 和 :meth:`~Lock." +"release`。當狀態為未鎖定時,:meth:`~Lock.acquire` 會將狀態變更為鎖定並立即回" +"傳。當狀態被鎖定時,:meth:`~Lock.acquire` 會阻塞 (block),直到另一個執行緒中" +"對 :meth:`~Lock.release` 的呼叫將其更改為未鎖定狀態,然後 :meth:`~Lock." +"acquire` 呼叫會將其重置為鎖定並回傳。:meth:`~Lock.release` 方法只能在鎖定狀態" +"下呼叫;它將狀態更改為未鎖定並立即回傳。如果嘗試釋放未鎖定的鎖,則會引發 :" +"exc:`RuntimeError`。" #: ../../library/threading.rst:521 msgid "Locks also support the :ref:`context management protocol `." -msgstr "" +msgstr "鎖也支援\\ :ref:`情境管理協定 `。" #: ../../library/threading.rst:523 msgid "" @@ -708,10 +719,13 @@ msgid "" "release` call resets the state to unlocked; which one of the waiting threads " "proceeds is not defined, and may vary across implementations." msgstr "" +"當多個執行緒阻塞在 :meth:`~Lock.acquire` 中等待狀態轉變為未鎖定,此時若呼叫 :" +"meth:`~Lock.release` 將狀態重置為未鎖定,則只會有一個執行緒繼續進行;哪一個等" +"待執行緒會繼續進行是未定義的,並且可能因實作而異。" #: ../../library/threading.rst:528 msgid "All methods are executed atomically." -msgstr "" +msgstr "所有方法均以最小操作方式 (atomically) 執行。" #: ../../library/threading.rst:533 msgid "" @@ -719,22 +733,28 @@ msgid "" "lock, subsequent attempts to acquire it block, until it is released; any " "thread may release it." msgstr "" +"實作原始鎖物件的類別。一旦執行緒獲得了鎖,後續再嘗試獲得它就會被阻塞,直到鎖" +"被釋放;任何執行緒都可以去釋放它。" #: ../../library/threading.rst:537 msgid "" "``Lock`` is now a class. In earlier Pythons, ``Lock`` was a factory function " "which returned an instance of the underlying private lock type." msgstr "" +"``Lock`` 現在是一個類別。在早期的 Python 中,``Lock`` 是一個會回傳底層私有鎖" +"型別實例的工廠函式。" #: ../../library/threading.rst:545 ../../library/threading.rst:636 msgid "Acquire a lock, blocking or non-blocking." -msgstr "" +msgstr "阻塞或非阻塞地取得鎖。" #: ../../library/threading.rst:547 msgid "" "When invoked with the *blocking* argument set to ``True`` (the default), " "block until the lock is unlocked, then set it to locked and return ``True``." msgstr "" +"當以 *blocking* 引數設為 ``True``\\ (預設值)來調用,將會阻塞直到鎖被解鎖," +"然後將其設為鎖定並回傳 ``True``。" #: ../../library/threading.rst:550 msgid "" @@ -742,6 +762,9 @@ msgid "" "a call with *blocking* set to ``True`` would block, return ``False`` " "immediately; otherwise, set the lock to locked and return ``True``." msgstr "" +"當以 *blocking* 引數設為 ``False`` 調用則不會阻塞。如果 *blocking* 設定為 " +"``True`` 的呼叫會阻塞,則立即回傳 ``False``;否則將鎖設為鎖定並回傳 " +"``True``。" #: ../../library/threading.rst:554 msgid "" @@ -751,29 +774,34 @@ msgid "" "specifies an unbounded wait. It is forbidden to specify a *timeout* when " "*blocking* is ``False``." msgstr "" +"當使用設定為正值的浮點 *timeout* 引數進行調用,只要持續無法取得鎖,最多會阻" +"塞 *timeout* 指定的秒數。``-1`` 的 *timeout* 引數代表指定為不會停止的等待。" +"當 *blocking* 為 ``False`` 時禁止指定 *timeout*。" #: ../../library/threading.rst:560 msgid "" "The return value is ``True`` if the lock is acquired successfully, ``False`` " "if not (for example if the *timeout* expired)." msgstr "" +"如果成功取得鎖,則回傳值為 ``True``,否則回傳值為 ``False``\\ (例如像是 " +"*timeout* 已逾期)。" #: ../../library/threading.rst:563 ../../library/threading.rst:674 #: ../../library/threading.rst:921 msgid "The *timeout* parameter is new." -msgstr "" +msgstr "新的 *timeout* 參數。" #: ../../library/threading.rst:566 msgid "" "Lock acquisition can now be interrupted by signals on POSIX if the " "underlying threading implementation supports it." -msgstr "" +msgstr "如果底層執行緒實作支援的話,鎖的獲取現在可以被 POSIX 上的訊號中斷。" #: ../../library/threading.rst:573 msgid "" "Release a lock. This can be called from any thread, not only the thread " "which has acquired the lock." -msgstr "" +msgstr "釋放鎖。這可以從任何執行緒呼叫,而不是只有獲得鎖的執行緒。" #: ../../library/threading.rst:576 msgid "" @@ -781,18 +809,20 @@ msgid "" "threads are blocked waiting for the lock to become unlocked, allow exactly " "one of them to proceed." msgstr "" +"當鎖被鎖定時,將其重置為未鎖定然後回傳。如果任何其他執行緒在等待鎖被解鎖時被" +"阻塞,只允許其中一個執行緒繼續進行。" #: ../../library/threading.rst:580 msgid "When invoked on an unlocked lock, a :exc:`RuntimeError` is raised." -msgstr "" +msgstr "當在未鎖定的鎖上調用時,會引發 :exc:`RuntimeError`" #: ../../library/threading.rst:582 ../../library/threading.rst:690 msgid "There is no return value." -msgstr "" +msgstr "沒有回傳值。" #: ../../library/threading.rst:586 msgid "Return ``True`` if the lock is acquired." -msgstr "" +msgstr "如果有取得了鎖,則回傳 ``True``。" #: ../../library/threading.rst:593 msgid "RLock Objects" @@ -806,12 +836,18 @@ msgid "" "state used by primitive locks. In the locked state, some thread owns the " "lock; in the unlocked state, no thread owns it." msgstr "" +"可重入鎖 (reentrant lock) 是一種同步原語,同一執行緒可以多次取得它。在內部," +"除了原始鎖使用的鎖定/未鎖定狀態之外,它還使用「所屬執行緒 (owning thread)」和" +"「遞迴等級 (recursion level)」的概念。在鎖定狀態下,某個執行緒會擁有鎖;在未" +"鎖定狀態下則沒有執行緒擁有它。" #: ../../library/threading.rst:601 msgid "" "Threads call a lock's :meth:`~RLock.acquire` method to lock it, and its :" "meth:`~Lock.release` method to unlock it." msgstr "" +"執行緒呼叫鎖的 :meth:`~RLock.acquire` 方法來鎖定它,並呼叫它的 :meth:`~Lock." +"release` 方法來解鎖它。" #: ../../library/threading.rst:606 msgid "" @@ -820,6 +856,9 @@ msgid "" "meth:`~RLock.acquire` and :meth:`~RLock.release` to handle acquiring and " "releasing the lock for a block of code." msgstr "" +"可重入鎖支援\\ :ref:`情境管理協定`,因此建議使用 :keyword:`with` " +"而不是手動呼叫 :meth:`~RLock.acquire` 和 :meth:`~RLock.release` 來對程式碼區" +"塊處理鎖的獲得和釋放。" #: ../../library/threading.rst:611 msgid "" @@ -829,6 +868,10 @@ msgid "" "pair) resets the lock to an unlocked state and allows another thread blocked " "in :meth:`~RLock.acquire` to proceed." msgstr "" +"RLock 的 :meth:`~RLock.acquire`/:meth:`~RLock.release` 呼叫成對組合可以嵌套使" +"用,這與Lock 的 :meth:`~Lock.acquire`/:meth:`~Lock.release` 不同。只有最後一" +"個 :meth:`~RLock.release`\\ (最外面一對的 :meth:`~Lock.release`)會將鎖重置" +"為未鎖定狀態,並允許在 :meth:`~RLock.acquire` 中阻塞的另一個執行緒繼續進行。" #: ../../library/threading.rst:617 msgid "" @@ -837,6 +880,9 @@ msgid "" "Failing to call release as many times the lock has been acquired can lead to " "deadlock." msgstr "" +":meth:`~RLock.acquire`/:meth:`~RLock.release` 必須成對使用:每次獲得都必須在" +"已獲得鎖的執行緒中有一個釋放。如果鎖釋放的次數不能和獲取的次數一樣的話,可能" +"會導致死鎖 (deadlock)。" #: ../../library/threading.rst:624 msgid "" @@ -845,6 +891,9 @@ msgid "" "reentrant lock, the same thread may acquire it again without blocking; the " "thread must release it once for each time it has acquired it." msgstr "" +"此類別實作了可重入鎖物件。可重入鎖必須由獲得它的執行緒釋放。一旦一個執行緒獲" +"得了可重入鎖,同一個執行緒可以再次獲得它而不會阻塞;執行緒每次獲得它也都必須" +"釋放它一次。" #: ../../library/threading.rst:629 msgid "" @@ -852,31 +901,37 @@ msgid "" "of the most efficient version of the concrete RLock class that is supported " "by the platform." msgstr "" +"請注意,``RLock`` 實際上是一個工廠函式,它會回傳平台有支援的特定 RLock 類別的" +"最有效版本的實例。" #: ../../library/threading.rst:640 msgid ":ref:`Using RLock as a context manager `" -msgstr "" +msgstr ":ref:`將 RLock 用作為情境管理器 `" #: ../../library/threading.rst:641 msgid "" "Recommended over manual :meth:`!acquire` and :meth:`release` calls whenever " "practical." msgstr "" +"若是使用場景合理,和手動呼叫 :meth:`!acquire` 和 :meth:`release` 相比,會是更" +"為推薦的使用方式。" #: ../../library/threading.rst:645 msgid "" "When invoked with the *blocking* argument set to ``True`` (the default):" -msgstr "" +msgstr "當以 *blocking* 引數設為 ``True``\\ (預設值)來調用:" #: ../../library/threading.rst:647 ../../library/threading.rst:659 msgid "If no thread owns the lock, acquire the lock and return immediately." -msgstr "" +msgstr "如果沒有執行緒擁有鎖,則獲得鎖並立即回傳。" #: ../../library/threading.rst:649 msgid "" "If another thread owns the lock, block until we are able to acquire lock, or " "*timeout*, if set to a positive float value." msgstr "" +"如果另一個執行緒擁有鎖,則阻塞直到能夠取得鎖,或者達到 *timeout*\\ (如果設定" +"為正浮點值)。" #: ../../library/threading.rst:652 msgid "" @@ -885,20 +940,23 @@ msgid "" "RLock`; :class:`Lock` handles this case the same as the previous, blocking " "until the lock can be acquired." msgstr "" +"如果同一個執行緒擁有鎖,則再次取得鎖,並立即回傳。這就是 :class:`Lock` 和 :" +"class:`!RLock` 之間的差別;:class:`Lock` 處理方式與上一種情況相同,會阻塞直到" +"能夠取得鎖。" #: ../../library/threading.rst:657 msgid "When invoked with the *blocking* argument set to ``False``:" -msgstr "" +msgstr "當以 *blocking* 引數設為 ``False`` 來調用:" #: ../../library/threading.rst:661 msgid "If another thread owns the lock, return immediately." -msgstr "" +msgstr "如果另一個執行緒擁有該鎖,則立即回傳。" #: ../../library/threading.rst:663 msgid "" "If the same thread owns the lock, acquire the lock again and return " "immediately." -msgstr "" +msgstr "如果同一個執行緒擁有鎖,則再次取得鎖並立即回傳。" #: ../../library/threading.rst:666 msgid "" @@ -906,6 +964,8 @@ msgid "" "If the thread was unable to acquire the lock (i.e. if not blocking or the " "timeout was reached) return ``False``." msgstr "" +"在所有情況下,如果執行緒能夠取得鎖則回傳 ``True``。如果執行緒無法取得鎖(即沒" +"有阻塞或已達超時限制)則回傳 ``False``。" #: ../../library/threading.rst:670 msgid "" @@ -913,6 +973,8 @@ msgid "" "times may lead to deadlock. Consider using :class:`!RLock` as a context " "manager rather than calling acquire/release directly." msgstr "" +"如果多次呼叫,又未能呼叫相同次數的 :meth:`~RLock.release`,則可能會導致死鎖。" +"考慮將 :class:`!RLock` 作為情境管理器使用,而不是直接呼叫 acquire/release。" #: ../../library/threading.rst:680 msgid "" @@ -922,6 +984,9 @@ msgid "" "exactly one of them to proceed. If after the decrement the recursion level " "is still nonzero, the lock remains locked and owned by the calling thread." msgstr "" +"釋放鎖並減少遞迴等級。如果被減至零,則將鎖重置為未鎖定(不屬於任何執行緒)," +"並且如果任何其他執行緒被阻塞以等待鎖變成未鎖定狀態,則僅允許其中一個執行緒繼" +"續進行。如果遞減後遞迴等級仍然非零,則鎖會保持鎖定並由呼叫它的執行緒所擁有。" #: ../../library/threading.rst:686 msgid "" @@ -929,6 +994,8 @@ msgid "" "`RuntimeError` is raised if this method is called when the lock is not " "acquired." msgstr "" +"僅當呼叫的執行緒擁有鎖時才能呼叫此方法。如果在未取得鎖時呼叫此方法則會引發 :" +"exc:`RuntimeError`。" #: ../../library/threading.rst:696 msgid "Condition Objects" From 8c391a3673b5d4b5e39a893ec87d9e904b2a498a Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Tue, 8 Oct 2024 11:12:14 +0800 Subject: [PATCH 34/89] Apply suggestions from code review Co-authored-by: Josix --- library/threading.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/threading.po b/library/threading.po index 9ad9e1c1bb..35adbe0595 100644 --- a/library/threading.po +++ b/library/threading.po @@ -725,7 +725,7 @@ msgstr "" #: ../../library/threading.rst:528 msgid "All methods are executed atomically." -msgstr "所有方法均以最小操作方式 (atomically) 執行。" +msgstr "所有方法均以最小不可分割的操作方式 (atomically) 執行。" #: ../../library/threading.rst:533 msgid "" @@ -869,7 +869,7 @@ msgid "" "in :meth:`~RLock.acquire` to proceed." msgstr "" "RLock 的 :meth:`~RLock.acquire`/:meth:`~RLock.release` 呼叫成對組合可以嵌套使" -"用,這與Lock 的 :meth:`~Lock.acquire`/:meth:`~Lock.release` 不同。只有最後一" +"用,這與 Lock 的 :meth:`~Lock.acquire`/:meth:`~Lock.release` 不同。只有最後一" "個 :meth:`~RLock.release`\\ (最外面一對的 :meth:`~Lock.release`)會將鎖重置" "為未鎖定狀態,並允許在 :meth:`~RLock.acquire` 中阻塞的另一個執行緒繼續進行。" @@ -902,7 +902,7 @@ msgid "" "by the platform." msgstr "" "請注意,``RLock`` 實際上是一個工廠函式,它會回傳平台有支援的特定 RLock 類別的" -"最有效版本的實例。" +"最高效率版本的實例。" #: ../../library/threading.rst:640 msgid ":ref:`Using RLock as a context manager `" From 587adf237878d2eb4af82cc87633b59f2a27bc7b Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Fri, 11 Oct 2024 06:19:56 +0800 Subject: [PATCH 35/89] ci: use ubuntu 22.04 instead and handle params --- .github/workflows/ci.yml | 4 ++-- .github/workflows/deploy-gh-page.yml | 2 +- Makefile | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f96ff72e0..dae76878a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: jobs: ci: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -13,4 +13,4 @@ jobs: run: sudo apt-get install gettext - name: Validate - run: VERSION=${{ github.event.repository.default_branch }} MODE=dummy make all + run: VERSION=${{ github.event.repository.default_branch }} JOBS=4 MODE=html make all diff --git a/.github/workflows/deploy-gh-page.yml b/.github/workflows/deploy-gh-page.yml index 3ccd22d104..3332208dad 100644 --- a/.github/workflows/deploy-gh-page.yml +++ b/.github/workflows/deploy-gh-page.yml @@ -15,7 +15,7 @@ jobs: run: sudo apt-get install gettext - name: Build - run: make all + run: JOBS=4 MODE=html make all - name: Deploy to gh page uses: JamesIves/github-pages-deploy-action@v4.6.4 diff --git a/Makefile b/Makefile index db5116d478..f255eb901d 100644 --- a/Makefile +++ b/Makefile @@ -43,8 +43,8 @@ SPHINX_CONF := $(CPYTHON_CLONE)/Doc/conf.py LANGUAGE := zh_TW LC_MESSAGES := $(CPYTHON_CLONE)/Doc/locales/$(LANGUAGE)/LC_MESSAGES VENV := ~/.venvs/python-docs-i18n/ -MODE := autobuild-dev-html -JOBS := 4 +MODE := $(or $(MODE), autobuild-dev-html) +JOBS := $(or $(JOBS), auto) .PHONY: all all: prepare_deps ## Automatically build an html local version From 4dd1468cc4377df739ea402f3d701d06a00cedf8 Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Mon, 14 Oct 2024 13:08:13 +0800 Subject: [PATCH 36/89] docs(library/pickle.po): fixes of all suggestions before 10/14 --- library/pickle.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/pickle.po b/library/pickle.po index 78f566f976..da84ddf558 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -128,7 +128,7 @@ msgid "" msgstr "" "這對遞迴物件和物件共用都有影響。遞迴物件是指包含自我參照的物件。這些情況在 " "marshal 模組中不會被處理,若嘗試使用 marshal 處理遞迴物件會導致 Python 直譯器" -"崩潰。物件共用發生在序列化的物件階層中,不同位置對同一物件有多個參照時。:mod:" +"崩潰。物件共用發生在序列化的物件階層中、不同位置對同一物件有多個參照時。:mod:" "`pickle` 只會儲存這個被參照的物件一次,並確保所有其他參照指向這個主要的版本。" "共用的物件會保持共用,這對於可變(mutable)物件來說非常重要。" @@ -240,7 +240,7 @@ msgid "" "Python programs may not be able to reconstruct pickled Python objects." msgstr "" ":mod:`pickle` 使用的資料格式是針對 Python 而設計的。好處是他不會受到外部標準" -"(像是 JSON 或 XDR,而 XDR 無法紀錄指標共用)的限制;不過這也代表其他不是 " +"(像是 JSON,無法紀錄指標共用)的限制;不過這也代表其他不是 " "Python 的程式可能無法重建 pickle 封裝的 Python 物件。" #: ../../library/pickle.rst:131 @@ -267,7 +267,7 @@ msgid "" "The higher the protocol used, the more recent the version of Python needed " "to read the pickle produced." msgstr "" -"截至目前為止,共有六種不同版本的協定可用於封裝 pickle。數字越大版本代表你需" +"截至目前為止,共有六種不同版本的協定可用於封裝 pickle。數字越大版本代表你需" "要使用越新的 Python 版本來拆封相應的 pickle 封裝。" #: ../../library/pickle.rst:143 From b92df3ccd5fd929c007eb36bed08520b018f6842 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Oct 2024 17:52:07 +0000 Subject: [PATCH 37/89] build(deps): bump JamesIves/github-pages-deploy-action (#982) --- .github/workflows/deploy-gh-page.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-gh-page.yml b/.github/workflows/deploy-gh-page.yml index 3332208dad..f1fad14f30 100644 --- a/.github/workflows/deploy-gh-page.yml +++ b/.github/workflows/deploy-gh-page.yml @@ -18,7 +18,7 @@ jobs: run: JOBS=4 MODE=html make all - name: Deploy to gh page - uses: JamesIves/github-pages-deploy-action@v4.6.4 + uses: JamesIves/github-pages-deploy-action@v4.6.8 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BRANCH: gh-pages From c08a2fce5272d294b5888f34851a3289a7620e21 Mon Sep 17 00:00:00 2001 From: "pydoc-zh-tw[bot]" <90344106+pydoc-zh-tw[bot]@users.noreply.github.com> Date: Sat, 19 Oct 2024 02:33:14 +0800 Subject: [PATCH 38/89] Sync with CPython 3.13 (#984) --- .scripts/poetry.lock | 228 +-- c-api/code.po | 115 +- c-api/exceptions.po | 6 +- c-api/import.po | 30 +- c-api/init.po | 1167 +++++++------ c-api/init_config.po | 208 +-- c-api/long.po | 6 +- c-api/module.po | 280 ++-- c-api/tuple.po | 44 +- c-api/veryhigh.po | 126 +- deprecations/index.po | 156 +- deprecations/pending-removal-in-3.14.po | 88 +- deprecations/pending-removal-in-3.15.po | 71 +- deprecations/pending-removal-in-future.po | 2 + glossary.po | 773 +++++---- howto/argparse-optparse.po | 119 ++ howto/argparse.po | 90 +- includes/wasm-notavail.po | 29 - library/_thread.po | 64 +- library/argparse.po | 1845 +++++++++------------ library/ast.po | 8 +- library/asyncio-eventloop.po | 16 +- library/asyncio-policy.po | 6 +- library/asyncio-stream.po | 6 +- library/asyncio-task.po | 4 +- library/asyncio.po | 6 +- library/codecs.po | 11 +- library/compileall.po | 6 +- library/concurrent.futures.po | 6 +- library/configparser.po | 408 ++--- library/ctypes.po | 44 +- library/curses.po | 6 +- library/datetime.po | 897 +++++----- library/dbm.po | 15 +- library/dis.po | 471 +++--- library/ensurepip.po | 16 +- library/errno.po | 6 +- library/fcntl.po | 15 +- library/ftplib.po | 6 +- library/functions.po | 645 +++---- library/getpass.po | 6 +- library/grp.po | 18 +- library/http.client.po | 6 +- library/http.server.po | 6 +- library/imaplib.po | 6 +- library/importlib.metadata.po | 404 +++-- library/importlib.po | 622 ++++--- library/itertools.po | 379 +++-- library/locale.po | 63 +- library/logging.config.po | 94 +- library/mimetypes.po | 6 +- library/mmap.po | 11 +- library/multiprocessing.po | 21 +- library/os.path.po | 6 +- library/os.po | 308 +--- library/pkgutil.po | 102 +- library/poplib.po | 22 +- library/posix.po | 6 +- library/pty.po | 6 +- library/pwd.po | 27 +- library/readline.po | 6 +- library/resource.po | 47 +- library/select.po | 12 +- library/selectors.po | 6 +- library/shutil.po | 12 +- library/signal.po | 39 +- library/smtplib.po | 6 +- library/socket.po | 158 +- library/socketserver.po | 6 +- library/ssl.po | 14 +- library/stat.po | 4 +- library/stdtypes.po | 593 +++---- library/string.po | 179 +- library/subprocess.po | 30 +- library/symtable.po | 131 +- library/sys.po | 427 +++-- library/syslog.po | 7 +- library/termios.po | 6 +- library/threading.po | 25 +- library/time.po | 95 +- library/traceback.po | 360 ++-- library/tty.po | 6 +- library/types.po | 171 +- library/typing.po | 2 +- library/unittest.mock.po | 212 +-- library/urllib.request.po | 47 +- library/venv.po | 21 +- library/webbrowser.po | 26 +- library/xmlrpc.client.po | 6 +- library/xmlrpc.server.po | 6 +- library/zoneinfo.po | 8 +- reference/datamodel.po | 1742 ++++++++++--------- reference/executionmodel.po | 42 +- reference/expressions.po | 212 +-- reference/import.po | 387 ++--- reference/lexical_analysis.po | 542 +++--- tutorial/appendix.po | 6 +- tutorial/controlflow.po | 10 +- tutorial/introduction.po | 191 +-- tutorial/modules.po | 25 +- using/cmdline.po | 11 +- using/configure.po | 6 +- whatsnew/2.6.po | 16 +- whatsnew/3.0.po | 8 +- whatsnew/3.12.po | 824 ++++----- whatsnew/3.13.po | 1116 +++++++------ whatsnew/3.2.po | 6 +- whatsnew/3.4.po | 98 +- whatsnew/3.5.po | 4 +- whatsnew/3.7.po | 2 +- 110 files changed, 9086 insertions(+), 8994 deletions(-) create mode 100644 howto/argparse-optparse.po delete mode 100644 includes/wasm-notavail.po diff --git a/.scripts/poetry.lock b/.scripts/poetry.lock index 5f06f9c25c..7b17f463ce 100644 --- a/.scripts/poetry.lock +++ b/.scripts/poetry.lock @@ -1,9 +1,10 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. [[package]] name = "certifi" version = "2024.8.30" description = "Python package for providing Mozilla's CA Bundle." +category = "main" optional = false python-versions = ">=3.6" files = [ @@ -15,6 +16,7 @@ files = [ name = "chardet" version = "3.0.4" description = "Universal encoding detector for Python 2 and 3" +category = "main" optional = false python-versions = "*" files = [ @@ -24,107 +26,124 @@ files = [ [[package]] name = "charset-normalizer" -version = "3.3.2" +version = "3.4.0" description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." +category = "main" optional = false python-versions = ">=3.7.0" files = [ - {file = "charset-normalizer-3.3.2.tar.gz", hash = "sha256:f30c3cb33b24454a82faecaf01b19c18562b1e89558fb6c56de4d9118a032fd5"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:25baf083bf6f6b341f4121c2f3c548875ee6f5339300e08be3f2b2ba1721cdd3"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:06435b539f889b1f6f4ac1758871aae42dc3a8c0e24ac9e60c2384973ad73027"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9063e24fdb1e498ab71cb7419e24622516c4a04476b17a2dab57e8baa30d6e03"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6897af51655e3691ff853668779c7bad41579facacf5fd7253b0133308cf000d"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1d3193f4a680c64b4b6a9115943538edb896edc190f0b222e73761716519268e"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cd70574b12bb8a4d2aaa0094515df2463cb429d8536cfb6c7ce983246983e5a6"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8465322196c8b4d7ab6d1e049e4c5cb460d0394da4a27d23cc242fbf0034b6b5"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a9a8e9031d613fd2009c182b69c7b2c1ef8239a0efb1df3f7c8da66d5dd3d537"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:beb58fe5cdb101e3a055192ac291b7a21e3b7ef4f67fa1d74e331a7f2124341c"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:e06ed3eb3218bc64786f7db41917d4e686cc4856944f53d5bdf83a6884432e12"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:2e81c7b9c8979ce92ed306c249d46894776a909505d8f5a4ba55b14206e3222f"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:572c3763a264ba47b3cf708a44ce965d98555f618ca42c926a9c1616d8f34269"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fd1abc0d89e30cc4e02e4064dc67fcc51bd941eb395c502aac3ec19fab46b519"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-win32.whl", hash = "sha256:3d47fa203a7bd9c5b6cee4736ee84ca03b8ef23193c0d1ca99b5089f72645c73"}, - {file = "charset_normalizer-3.3.2-cp310-cp310-win_amd64.whl", hash = "sha256:10955842570876604d404661fbccbc9c7e684caf432c09c715ec38fbae45ae09"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:802fe99cca7457642125a8a88a084cef28ff0cf9407060f7b93dca5aa25480db"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:573f6eac48f4769d667c4442081b1794f52919e7edada77495aaed9236d13a96"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:549a3a73da901d5bc3ce8d24e0600d1fa85524c10287f6004fbab87672bf3e1e"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f27273b60488abe721a075bcca6d7f3964f9f6f067c8c4c605743023d7d3944f"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ceae2f17a9c33cb48e3263960dc5fc8005351ee19db217e9b1bb15d28c02574"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:65f6f63034100ead094b8744b3b97965785388f308a64cf8d7c34f2f2e5be0c4"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:753f10e867343b4511128c6ed8c82f7bec3bd026875576dfd88483c5c73b2fd8"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4a78b2b446bd7c934f5dcedc588903fb2f5eec172f3d29e52a9096a43722adfc"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e537484df0d8f426ce2afb2d0f8e1c3d0b114b83f8850e5f2fbea0e797bd82ae"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:eb6904c354526e758fda7167b33005998fb68c46fbc10e013ca97f21ca5c8887"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:deb6be0ac38ece9ba87dea880e438f25ca3eddfac8b002a2ec3d9183a454e8ae"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:4ab2fe47fae9e0f9dee8c04187ce5d09f48eabe611be8259444906793ab7cbce"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:80402cd6ee291dcb72644d6eac93785fe2c8b9cb30893c1af5b8fdd753b9d40f"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-win32.whl", hash = "sha256:7cd13a2e3ddeed6913a65e66e94b51d80a041145a026c27e6bb76c31a853c6ab"}, - {file = "charset_normalizer-3.3.2-cp311-cp311-win_amd64.whl", hash = "sha256:663946639d296df6a2bb2aa51b60a2454ca1cb29835324c640dafb5ff2131a77"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:0b2b64d2bb6d3fb9112bafa732def486049e63de9618b5843bcdd081d8144cd8"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:ddbb2551d7e0102e7252db79ba445cdab71b26640817ab1e3e3648dad515003b"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:55086ee1064215781fff39a1af09518bc9255b50d6333f2e4c74ca09fac6a8f6"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8f4a014bc36d3c57402e2977dada34f9c12300af536839dc38c0beab8878f38a"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a10af20b82360ab00827f916a6058451b723b4e65030c5a18577c8b2de5b3389"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8d756e44e94489e49571086ef83b2bb8ce311e730092d2c34ca8f7d925cb20aa"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:90d558489962fd4918143277a773316e56c72da56ec7aa3dc3dbbe20fdfed15b"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6ac7ffc7ad6d040517be39eb591cac5ff87416c2537df6ba3cba3bae290c0fed"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:7ed9e526742851e8d5cc9e6cf41427dfc6068d4f5a3bb03659444b4cabf6bc26"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:8bdb58ff7ba23002a4c5808d608e4e6c687175724f54a5dade5fa8c67b604e4d"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:6b3251890fff30ee142c44144871185dbe13b11bab478a88887a639655be1068"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:b4a23f61ce87adf89be746c8a8974fe1c823c891d8f86eb218bb957c924bb143"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:efcb3f6676480691518c177e3b465bcddf57cea040302f9f4e6e191af91174d4"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-win32.whl", hash = "sha256:d965bba47ddeec8cd560687584e88cf699fd28f192ceb452d1d7ee807c5597b7"}, - {file = "charset_normalizer-3.3.2-cp312-cp312-win_amd64.whl", hash = "sha256:96b02a3dc4381e5494fad39be677abcb5e6634bf7b4fa83a6dd3112607547001"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:95f2a5796329323b8f0512e09dbb7a1860c46a39da62ecb2324f116fa8fdc85c"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c002b4ffc0be611f0d9da932eb0f704fe2602a9a949d1f738e4c34c75b0863d5"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a981a536974bbc7a512cf44ed14938cf01030a99e9b3a06dd59578882f06f985"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3287761bc4ee9e33561a7e058c72ac0938c4f57fe49a09eae428fd88aafe7bb6"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:42cb296636fcc8b0644486d15c12376cb9fa75443e00fb25de0b8602e64c1714"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0a55554a2fa0d408816b3b5cedf0045f4b8e1a6065aec45849de2d6f3f8e9786"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:c083af607d2515612056a31f0a8d9e0fcb5876b7bfc0abad3ecd275bc4ebc2d5"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:87d1351268731db79e0f8e745d92493ee2841c974128ef629dc518b937d9194c"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:bd8f7df7d12c2db9fab40bdd87a7c09b1530128315d047a086fa3ae3435cb3a8"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:c180f51afb394e165eafe4ac2936a14bee3eb10debc9d9e4db8958fe36afe711"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:8c622a5fe39a48f78944a87d4fb8a53ee07344641b0562c540d840748571b811"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-win32.whl", hash = "sha256:db364eca23f876da6f9e16c9da0df51aa4f104a972735574842618b8c6d999d4"}, - {file = "charset_normalizer-3.3.2-cp37-cp37m-win_amd64.whl", hash = "sha256:86216b5cee4b06df986d214f664305142d9c76df9b6512be2738aa72a2048f99"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:6463effa3186ea09411d50efc7d85360b38d5f09b870c48e4600f63af490e56a"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6c4caeef8fa63d06bd437cd4bdcf3ffefe6738fb1b25951440d80dc7df8c03ac"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:37e55c8e51c236f95b033f6fb391d7d7970ba5fe7ff453dad675e88cf303377a"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fb69256e180cb6c8a894fee62b3afebae785babc1ee98b81cdf68bbca1987f33"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ae5f4161f18c61806f411a13b0310bea87f987c7d2ecdbdaad0e94eb2e404238"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b2b0a0c0517616b6869869f8c581d4eb2dd83a4d79e0ebcb7d373ef9956aeb0a"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:45485e01ff4d3630ec0d9617310448a8702f70e9c01906b0d0118bdf9d124cf2"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:eb00ed941194665c332bf8e078baf037d6c35d7c4f3102ea2d4f16ca94a26dc8"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:2127566c664442652f024c837091890cb1942c30937add288223dc895793f898"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:a50aebfa173e157099939b17f18600f72f84eed3049e743b68ad15bd69b6bf99"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:4d0d1650369165a14e14e1e47b372cfcb31d6ab44e6e33cb2d4e57265290044d"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:923c0c831b7cfcb071580d3f46c4baf50f174be571576556269530f4bbd79d04"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:06a81e93cd441c56a9b65d8e1d043daeb97a3d0856d177d5c90ba85acb3db087"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-win32.whl", hash = "sha256:6ef1d82a3af9d3eecdba2321dc1b3c238245d890843e040e41e470ffa64c3e25"}, - {file = "charset_normalizer-3.3.2-cp38-cp38-win_amd64.whl", hash = "sha256:eb8821e09e916165e160797a6c17edda0679379a4be5c716c260e836e122f54b"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:c235ebd9baae02f1b77bcea61bce332cb4331dc3617d254df3323aa01ab47bd4"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:5b4c145409bef602a690e7cfad0a15a55c13320ff7a3ad7ca59c13bb8ba4d45d"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:68d1f8a9e9e37c1223b656399be5d6b448dea850bed7d0f87a8311f1ff3dabb0"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:22afcb9f253dac0696b5a4be4a1c0f8762f8239e21b99680099abd9b2b1b2269"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e27ad930a842b4c5eb8ac0016b0a54f5aebbe679340c26101df33424142c143c"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1f79682fbe303db92bc2b1136016a38a42e835d932bab5b3b1bfcfbf0640e519"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b261ccdec7821281dade748d088bb6e9b69e6d15b30652b74cbbac25e280b796"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:122c7fa62b130ed55f8f285bfd56d5f4b4a5b503609d181f9ad85e55c89f4185"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:d0eccceffcb53201b5bfebb52600a5fb483a20b61da9dbc885f8b103cbe7598c"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:9f96df6923e21816da7e0ad3fd47dd8f94b2a5ce594e00677c0013018b813458"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:7f04c839ed0b6b98b1a7501a002144b76c18fb1c1850c8b98d458ac269e26ed2"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:34d1c8da1e78d2e001f363791c98a272bb734000fcef47a491c1e3b0505657a8"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:ff8fa367d09b717b2a17a052544193ad76cd49979c805768879cb63d9ca50561"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-win32.whl", hash = "sha256:aed38f6e4fb3f5d6bf81bfa990a07806be9d83cf7bacef998ab1a9bd660a581f"}, - {file = "charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl", hash = "sha256:b01b88d45a6fcb69667cd6d2f7a9aeb4bf53760d7fc536bf679ec94fe9f3ff3d"}, - {file = "charset_normalizer-3.3.2-py3-none-any.whl", hash = "sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:4f9fc98dad6c2eaa32fc3af1417d95b5e3d08aff968df0cd320066def971f9a6"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:0de7b687289d3c1b3e8660d0741874abe7888100efe14bd0f9fd7141bcbda92b"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5ed2e36c3e9b4f21dd9422f6893dec0abf2cca553af509b10cd630f878d3eb99"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:40d3ff7fc90b98c637bda91c89d51264a3dcf210cade3a2c6f838c7268d7a4ca"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1110e22af8ca26b90bd6364fe4c763329b0ebf1ee213ba32b68c73de5752323d"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:86f4e8cca779080f66ff4f191a685ced73d2f72d50216f7112185dc02b90b9b7"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7f683ddc7eedd742e2889d2bfb96d69573fde1d92fcb811979cdb7165bb9c7d3"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:27623ba66c183eca01bf9ff833875b459cad267aeeb044477fedac35e19ba907"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:f606a1881d2663630ea5b8ce2efe2111740df4b687bd78b34a8131baa007f79b"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:0b309d1747110feb25d7ed6b01afdec269c647d382c857ef4663bbe6ad95a912"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:136815f06a3ae311fae551c3df1f998a1ebd01ddd424aa5603a4336997629e95"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:14215b71a762336254351b00ec720a8e85cada43b987da5a042e4ce3e82bd68e"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:79983512b108e4a164b9c8d34de3992f76d48cadc9554c9e60b43f308988aabe"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-win32.whl", hash = "sha256:c94057af19bc953643a33581844649a7fdab902624d2eb739738a30e2b3e60fc"}, + {file = "charset_normalizer-3.4.0-cp310-cp310-win_amd64.whl", hash = "sha256:55f56e2ebd4e3bc50442fbc0888c9d8c94e4e06a933804e2af3e89e2f9c1c749"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:0d99dd8ff461990f12d6e42c7347fd9ab2532fb70e9621ba520f9e8637161d7c"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c57516e58fd17d03ebe67e181a4e4e2ccab1168f8c2976c6a334d4f819fe5944"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:6dba5d19c4dfab08e58d5b36304b3f92f3bd5d42c1a3fa37b5ba5cdf6dfcbcee"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bf4475b82be41b07cc5e5ff94810e6a01f276e37c2d55571e3fe175e467a1a1c"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ce031db0408e487fd2775d745ce30a7cd2923667cf3b69d48d219f1d8f5ddeb6"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8ff4e7cdfdb1ab5698e675ca622e72d58a6fa2a8aa58195de0c0061288e6e3ea"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3710a9751938947e6327ea9f3ea6332a09bf0ba0c09cae9cb1f250bd1f1549bc"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:82357d85de703176b5587dbe6ade8ff67f9f69a41c0733cf2425378b49954de5"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:47334db71978b23ebcf3c0f9f5ee98b8d65992b65c9c4f2d34c2eaf5bcaf0594"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:8ce7fd6767a1cc5a92a639b391891bf1c268b03ec7e021c7d6d902285259685c"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:f1a2f519ae173b5b6a2c9d5fa3116ce16e48b3462c8b96dfdded11055e3d6365"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:63bc5c4ae26e4bc6be6469943b8253c0fd4e4186c43ad46e713ea61a0ba49129"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:bcb4f8ea87d03bc51ad04add8ceaf9b0f085ac045ab4d74e73bbc2dc033f0236"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-win32.whl", hash = "sha256:9ae4ef0b3f6b41bad6366fb0ea4fc1d7ed051528e113a60fa2a65a9abb5b1d99"}, + {file = "charset_normalizer-3.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:cee4373f4d3ad28f1ab6290684d8e2ebdb9e7a1b74fdc39e4c211995f77bec27"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:0713f3adb9d03d49d365b70b84775d0a0d18e4ab08d12bc46baa6132ba78aaf6"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:de7376c29d95d6719048c194a9cf1a1b0393fbe8488a22008610b0361d834ecf"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4a51b48f42d9358460b78725283f04bddaf44a9358197b889657deba38f329db"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b295729485b06c1a0683af02a9e42d2caa9db04a373dc38a6a58cdd1e8abddf1"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ee803480535c44e7f5ad00788526da7d85525cfefaf8acf8ab9a310000be4b03"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3d59d125ffbd6d552765510e3f31ed75ebac2c7470c7274195b9161a32350284"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8cda06946eac330cbe6598f77bb54e690b4ca93f593dee1568ad22b04f347c15"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:07afec21bbbbf8a5cc3651aa96b980afe2526e7f048fdfb7f1014d84acc8b6d8"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6b40e8d38afe634559e398cc32b1472f376a4099c75fe6299ae607e404c033b2"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:b8dcd239c743aa2f9c22ce674a145e0a25cb1566c495928440a181ca1ccf6719"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:84450ba661fb96e9fd67629b93d2941c871ca86fc38d835d19d4225ff946a631"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:44aeb140295a2f0659e113b31cfe92c9061622cadbc9e2a2f7b8ef6b1e29ef4b"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1db4e7fefefd0f548d73e2e2e041f9df5c59e178b4c72fbac4cc6f535cfb1565"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-win32.whl", hash = "sha256:5726cf76c982532c1863fb64d8c6dd0e4c90b6ece9feb06c9f202417a31f7dd7"}, + {file = "charset_normalizer-3.4.0-cp312-cp312-win_amd64.whl", hash = "sha256:b197e7094f232959f8f20541ead1d9862ac5ebea1d58e9849c1bf979255dfac9"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:dd4eda173a9fcccb5f2e2bd2a9f423d180194b1bf17cf59e3269899235b2a114"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e9e3c4c9e1ed40ea53acf11e2a386383c3304212c965773704e4603d589343ed"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:92a7e36b000bf022ef3dbb9c46bfe2d52c047d5e3f3343f43204263c5addc250"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:54b6a92d009cbe2fb11054ba694bc9e284dad30a26757b1e372a1fdddaf21920"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ffd9493de4c922f2a38c2bf62b831dcec90ac673ed1ca182fe11b4d8e9f2a64"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:35c404d74c2926d0287fbd63ed5d27eb911eb9e4a3bb2c6d294f3cfd4a9e0c23"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4796efc4faf6b53a18e3d46343535caed491776a22af773f366534056c4e1fbc"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e7fdd52961feb4c96507aa649550ec2a0d527c086d284749b2f582f2d40a2e0d"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:92db3c28b5b2a273346bebb24857fda45601aef6ae1c011c0a997106581e8a88"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:ab973df98fc99ab39080bfb0eb3a925181454d7c3ac8a1e695fddfae696d9e90"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:4b67fdab07fdd3c10bb21edab3cbfe8cf5696f453afce75d815d9d7223fbe88b"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:aa41e526a5d4a9dfcfbab0716c7e8a1b215abd3f3df5a45cf18a12721d31cb5d"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ffc519621dce0c767e96b9c53f09c5d215578e10b02c285809f76509a3931482"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-win32.whl", hash = "sha256:f19c1585933c82098c2a520f8ec1227f20e339e33aca8fa6f956f6691b784e67"}, + {file = "charset_normalizer-3.4.0-cp313-cp313-win_amd64.whl", hash = "sha256:707b82d19e65c9bd28b81dde95249b07bf9f5b90ebe1ef17d9b57473f8a64b7b"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:dbe03226baf438ac4fda9e2d0715022fd579cb641c4cf639fa40d53b2fe6f3e2"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dd9a8bd8900e65504a305bf8ae6fa9fbc66de94178c420791d0293702fce2df7"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b8831399554b92b72af5932cdbbd4ddc55c55f631bb13ff8fe4e6536a06c5c51"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a14969b8691f7998e74663b77b4c36c0337cb1df552da83d5c9004a93afdb574"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dcaf7c1524c0542ee2fc82cc8ec337f7a9f7edee2532421ab200d2b920fc97cf"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:425c5f215d0eecee9a56cdb703203dda90423247421bf0d67125add85d0c4455"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:d5b054862739d276e09928de37c79ddeec42a6e1bfc55863be96a36ba22926f6"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_i686.whl", hash = "sha256:f3e73a4255342d4eb26ef6df01e3962e73aa29baa3124a8e824c5d3364a65748"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_ppc64le.whl", hash = "sha256:2f6c34da58ea9c1a9515621f4d9ac379871a8f21168ba1b5e09d74250de5ad62"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_s390x.whl", hash = "sha256:f09cb5a7bbe1ecae6e87901a2eb23e0256bb524a79ccc53eb0b7629fbe7677c4"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:0099d79bdfcf5c1f0c2c72f91516702ebf8b0b8ddd8905f97a8aecf49712c621"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-win32.whl", hash = "sha256:9c98230f5042f4945f957d006edccc2af1e03ed5e37ce7c373f00a5a4daa6149"}, + {file = "charset_normalizer-3.4.0-cp37-cp37m-win_amd64.whl", hash = "sha256:62f60aebecfc7f4b82e3f639a7d1433a20ec32824db2199a11ad4f5e146ef5ee"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:af73657b7a68211996527dbfeffbb0864e043d270580c5aef06dc4b659a4b578"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:cab5d0b79d987c67f3b9e9c53f54a61360422a5a0bc075f43cab5621d530c3b6"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:9289fd5dddcf57bab41d044f1756550f9e7cf0c8e373b8cdf0ce8773dc4bd417"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6b493a043635eb376e50eedf7818f2f322eabbaa974e948bd8bdd29eb7ef2a51"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9fa2566ca27d67c86569e8c85297aaf413ffab85a8960500f12ea34ff98e4c41"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a8e538f46104c815be19c975572d74afb53f29650ea2025bbfaef359d2de2f7f"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6fd30dc99682dc2c603c2b315bded2799019cea829f8bf57dc6b61efde6611c8"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2006769bd1640bdf4d5641c69a3d63b71b81445473cac5ded39740a226fa88ab"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:dc15e99b2d8a656f8e666854404f1ba54765871104e50c8e9813af8a7db07f12"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:ab2e5bef076f5a235c3774b4f4028a680432cded7cad37bba0fd90d64b187d19"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:4ec9dd88a5b71abfc74e9df5ebe7921c35cbb3b641181a531ca65cdb5e8e4dea"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:43193c5cda5d612f247172016c4bb71251c784d7a4d9314677186a838ad34858"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:aa693779a8b50cd97570e5a0f343538a8dbd3e496fa5dcb87e29406ad0299654"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-win32.whl", hash = "sha256:7706f5850360ac01d80c89bcef1640683cc12ed87f42579dab6c5d3ed6888613"}, + {file = "charset_normalizer-3.4.0-cp38-cp38-win_amd64.whl", hash = "sha256:c3e446d253bd88f6377260d07c895816ebf33ffffd56c1c792b13bff9c3e1ade"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:980b4f289d1d90ca5efcf07958d3eb38ed9c0b7676bf2831a54d4f66f9c27dfa"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f28f891ccd15c514a0981f3b9db9aa23d62fe1a99997512b0491d2ed323d229a"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a8aacce6e2e1edcb6ac625fb0f8c3a9570ccc7bfba1f63419b3769ccf6a00ed0"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bd7af3717683bea4c87acd8c0d3d5b44d56120b26fd3f8a692bdd2d5260c620a"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5ff2ed8194587faf56555927b3aa10e6fb69d931e33953943bc4f837dfee2242"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e91f541a85298cf35433bf66f3fab2a4a2cff05c127eeca4af174f6d497f0d4b"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:309a7de0a0ff3040acaebb35ec45d18db4b28232f21998851cfa709eeff49d62"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:285e96d9d53422efc0d7a17c60e59f37fbf3dfa942073f666db4ac71e8d726d0"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:5d447056e2ca60382d460a604b6302d8db69476fd2015c81e7c35417cfabe4cd"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:20587d20f557fe189b7947d8e7ec5afa110ccf72a3128d61a2a387c3313f46be"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:130272c698667a982a5d0e626851ceff662565379baf0ff2cc58067b81d4f11d"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:ab22fbd9765e6954bc0bcff24c25ff71dcbfdb185fcdaca49e81bac68fe724d3"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:7782afc9b6b42200f7362858f9e73b1f8316afb276d316336c0ec3bd73312742"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-win32.whl", hash = "sha256:2de62e8801ddfff069cd5c504ce3bc9672b23266597d4e4f50eda28846c322f2"}, + {file = "charset_normalizer-3.4.0-cp39-cp39-win_amd64.whl", hash = "sha256:95c3c157765b031331dd4db3c775e58deaee050a3042fcad72cbc4189d7c8dca"}, + {file = "charset_normalizer-3.4.0-py3-none-any.whl", hash = "sha256:fe9f97feb71aa9896b81973a7bbada8c49501dc73e58a10fcef6663af95e5079"}, + {file = "charset_normalizer-3.4.0.tar.gz", hash = "sha256:223217c3d4f82c3ac5e29032b3f1c2eb0fb591b72161f86d93f5719079dae93e"}, ] [[package]] name = "googletrans" version = "3.1.0a0" description = "Free Google Translate API for Python. Translates totally free of charge." +category = "main" optional = false python-versions = ">=3.6" files = [ @@ -138,6 +157,7 @@ httpx = "0.13.3" name = "h11" version = "0.9.0" description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" +category = "main" optional = false python-versions = "*" files = [ @@ -149,6 +169,7 @@ files = [ name = "h2" version = "3.2.0" description = "HTTP/2 State-Machine based protocol implementation" +category = "main" optional = false python-versions = "*" files = [ @@ -164,6 +185,7 @@ hyperframe = ">=5.2.0,<6" name = "hpack" version = "3.0.0" description = "Pure-Python HPACK header compression" +category = "main" optional = false python-versions = "*" files = [ @@ -175,6 +197,7 @@ files = [ name = "hstspreload" version = "2024.10.1" description = "Chromium HSTS Preload list as a Python package" +category = "main" optional = false python-versions = ">=3.6" files = [ @@ -186,6 +209,7 @@ files = [ name = "httpcore" version = "0.9.1" description = "A minimal low-level HTTP client." +category = "main" optional = false python-versions = ">=3.6" files = [ @@ -195,13 +219,14 @@ files = [ [package.dependencies] h11 = ">=0.8,<0.10" -h2 = "==3.*" -sniffio = "==1.*" +h2 = ">=3.0.0,<4.0.0" +sniffio = ">=1.0.0,<2.0.0" [[package]] name = "httpx" version = "0.13.3" description = "The next generation HTTP client." +category = "main" optional = false python-versions = ">=3.6" files = [ @@ -211,10 +236,10 @@ files = [ [package.dependencies] certifi = "*" -chardet = "==3.*" +chardet = ">=3.0.0,<4.0.0" hstspreload = "*" -httpcore = "==0.9.*" -idna = "==2.*" +httpcore = ">=0.9.0,<0.10.0" +idna = ">=2.0.0,<3.0.0" rfc3986 = ">=1.3,<2" sniffio = "*" @@ -222,6 +247,7 @@ sniffio = "*" name = "hyperframe" version = "5.2.0" description = "HTTP/2 framing layer for Python" +category = "main" optional = false python-versions = "*" files = [ @@ -233,6 +259,7 @@ files = [ name = "idna" version = "2.10" description = "Internationalized Domain Names in Applications (IDNA)" +category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" files = [ @@ -244,6 +271,7 @@ files = [ name = "lxml" version = "5.3.0" description = "Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API." +category = "main" optional = false python-versions = ">=3.6" files = [ @@ -398,6 +426,7 @@ source = ["Cython (>=3.0.11)"] name = "polib" version = "1.1.1" description = "A library to manipulate gettext files (po and mo files)." +category = "main" optional = false python-versions = "*" files = [ @@ -409,6 +438,7 @@ files = [ name = "requests" version = "2.31.0" description = "Python HTTP for Humans." +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -430,6 +460,7 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] name = "rfc3986" version = "1.5.0" description = "Validating URI References per RFC 3986" +category = "main" optional = false python-versions = "*" files = [ @@ -444,6 +475,7 @@ idna2008 = ["idna"] name = "sniffio" version = "1.3.1" description = "Sniff out which async library your code is running under" +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -455,6 +487,7 @@ files = [ name = "translate-toolkit" version = "3.8.1" description = "Tools and API for translation and localization engineering." +category = "main" optional = false python-versions = ">=3.7" files = [ @@ -485,6 +518,7 @@ yaml = ["ruamel.yaml (==0.17.21)"] name = "urllib3" version = "2.2.3" description = "HTTP library with thread-safe connection pooling, file post, and more." +category = "main" optional = false python-versions = ">=3.8" files = [ diff --git a/c-api/code.po b/c-api/code.po index 79fec6db3e..19d27d2885 100644 --- a/c-api/code.po +++ b/c-api/code.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-09 00:13+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -48,123 +48,127 @@ msgid "" msgstr "" #: ../../c-api/code.rst:35 -msgid "Return the number of free variables in a code object." +msgid "" +"Return the number of :term:`free (closure) variables ` in " +"a code object." msgstr "" -#: ../../c-api/code.rst:39 -msgid "Return the position of the first free variable in a code object." +#: ../../c-api/code.rst:40 +msgid "" +"Return the position of the first :term:`free (closure) variable ` in a code object." msgstr "" -#: ../../c-api/code.rst:43 +#: ../../c-api/code.rst:45 msgid "" "Renamed from ``PyCode_GetFirstFree`` as part of :ref:`unstable-c-api`. The " "old name is deprecated, but will remain available until the signature " "changes again." msgstr "" -#: ../../c-api/code.rst:49 +#: ../../c-api/code.rst:51 msgid "" "Return a new code object. If you need a dummy code object to create a " "frame, use :c:func:`PyCode_NewEmpty` instead." msgstr "" -#: ../../c-api/code.rst:52 +#: ../../c-api/code.rst:54 msgid "" "Since the definition of the bytecode changes often, calling :c:func:" "`PyUnstable_Code_New` directly can bind you to a precise Python version." msgstr "" -#: ../../c-api/code.rst:55 +#: ../../c-api/code.rst:57 msgid "" "The many arguments of this function are inter-dependent in complex ways, " "meaning that subtle changes to values are likely to result in incorrect " "execution or VM crashes. Use this function only with extreme care." msgstr "" -#: ../../c-api/code.rst:59 +#: ../../c-api/code.rst:61 msgid "Added ``qualname`` and ``exceptiontable`` parameters." msgstr "新增 ``qualname`` 和 ``exceptiontable`` 參數。" -#: ../../c-api/code.rst:66 +#: ../../c-api/code.rst:68 msgid "" "Renamed from ``PyCode_New`` as part of :ref:`unstable-c-api`. The old name " "is deprecated, but will remain available until the signature changes again." msgstr "" -#: ../../c-api/code.rst:72 +#: ../../c-api/code.rst:74 msgid "" "Similar to :c:func:`PyUnstable_Code_New`, but with an extra " "\"posonlyargcount\" for positional-only arguments. The same caveats that " "apply to ``PyUnstable_Code_New`` also apply to this function." msgstr "" -#: ../../c-api/code.rst:77 +#: ../../c-api/code.rst:79 msgid "as ``PyCode_NewWithPosOnlyArgs``" msgstr "" -#: ../../c-api/code.rst:79 +#: ../../c-api/code.rst:81 msgid "Added ``qualname`` and ``exceptiontable`` parameters." msgstr "新增 ``qualname`` 和 ``exceptiontable`` 參數。" -#: ../../c-api/code.rst:84 +#: ../../c-api/code.rst:86 msgid "" "Renamed to ``PyUnstable_Code_NewWithPosOnlyArgs``. The old name is " "deprecated, but will remain available until the signature changes again." msgstr "" -#: ../../c-api/code.rst:90 +#: ../../c-api/code.rst:92 msgid "" "Return a new empty code object with the specified filename, function name, " "and first line number. The resulting code object will raise an ``Exception`` " "if executed." msgstr "" -#: ../../c-api/code.rst:96 +#: ../../c-api/code.rst:98 msgid "" "Return the line number of the instruction that occurs on or before " "``byte_offset`` and ends after it. If you just need the line number of a " "frame, use :c:func:`PyFrame_GetLineNumber` instead." msgstr "" -#: ../../c-api/code.rst:99 +#: ../../c-api/code.rst:101 msgid "" "For efficiently iterating over the line numbers in a code object, use :pep:" "`the API described in PEP 626 <0626#out-of-process-debuggers-and-profilers>`." msgstr "" -#: ../../c-api/code.rst:104 +#: ../../c-api/code.rst:106 msgid "" "Sets the passed ``int`` pointers to the source code line and column numbers " "for the instruction at ``byte_offset``. Sets the value to ``0`` when " "information is not available for any particular element." msgstr "" -#: ../../c-api/code.rst:108 +#: ../../c-api/code.rst:110 msgid "Returns ``1`` if the function succeeds and 0 otherwise." msgstr "" -#: ../../c-api/code.rst:114 +#: ../../c-api/code.rst:116 msgid "" "Equivalent to the Python code ``getattr(co, 'co_code')``. Returns a strong " "reference to a :c:type:`PyBytesObject` representing the bytecode in a code " "object. On error, ``NULL`` is returned and an exception is raised." msgstr "" -#: ../../c-api/code.rst:119 +#: ../../c-api/code.rst:121 msgid "" "This ``PyBytesObject`` may be created on-demand by the interpreter and does " "not necessarily represent the bytecode actually executed by CPython. The " "primary use case for this function is debuggers and profilers." msgstr "" -#: ../../c-api/code.rst:127 +#: ../../c-api/code.rst:129 msgid "" "Equivalent to the Python code ``getattr(co, 'co_varnames')``. Returns a new " "reference to a :c:type:`PyTupleObject` containing the names of the local " "variables. On error, ``NULL`` is returned and an exception is raised." msgstr "" -#: ../../c-api/code.rst:136 +#: ../../c-api/code.rst:138 msgid "" "Equivalent to the Python code ``getattr(co, 'co_cellvars')``. Returns a new " "reference to a :c:type:`PyTupleObject` containing the names of the local " @@ -172,14 +176,15 @@ msgid "" "returned and an exception is raised." msgstr "" -#: ../../c-api/code.rst:145 +#: ../../c-api/code.rst:147 msgid "" "Equivalent to the Python code ``getattr(co, 'co_freevars')``. Returns a new " -"reference to a :c:type:`PyTupleObject` containing the names of the free " -"variables. On error, ``NULL`` is returned and an exception is raised." +"reference to a :c:type:`PyTupleObject` containing the names of the :term:" +"`free (closure) variables `. On error, ``NULL`` is " +"returned and an exception is raised." msgstr "" -#: ../../c-api/code.rst:153 +#: ../../c-api/code.rst:156 msgid "" "Register *callback* as a code object watcher for the current interpreter. " "Return an ID which may be passed to :c:func:`PyCode_ClearWatcher`. In case " @@ -187,7 +192,7 @@ msgid "" "exception." msgstr "" -#: ../../c-api/code.rst:162 +#: ../../c-api/code.rst:165 msgid "" "Clear watcher identified by *watcher_id* previously returned from :c:func:" "`PyCode_AddWatcher` for the current interpreter. Return ``0`` on success, or " @@ -195,17 +200,17 @@ msgid "" "never registered.)" msgstr "" -#: ../../c-api/code.rst:171 +#: ../../c-api/code.rst:174 msgid "" "Enumeration of possible code object watcher events: - " "``PY_CODE_EVENT_CREATE`` - ``PY_CODE_EVENT_DESTROY``" msgstr "" -#: ../../c-api/code.rst:179 +#: ../../c-api/code.rst:182 msgid "Type of a code object watcher callback function." msgstr "" -#: ../../c-api/code.rst:181 +#: ../../c-api/code.rst:184 msgid "" "If *event* is ``PY_CODE_EVENT_CREATE``, then the callback is invoked after " "`co` has been fully initialized. Otherwise, the callback is invoked before " @@ -213,7 +218,7 @@ msgid "" "inspected." msgstr "" -#: ../../c-api/code.rst:186 +#: ../../c-api/code.rst:189 msgid "" "If *event* is ``PY_CODE_EVENT_DESTROY``, taking a reference in the callback " "to the about-to-be-destroyed code object will resurrect it and prevent it " @@ -221,7 +226,7 @@ msgid "" "later, any watcher callbacks active at that time will be called again." msgstr "" -#: ../../c-api/code.rst:191 +#: ../../c-api/code.rst:194 msgid "" "Users of this API should not rely on internal runtime implementation " "details. Such details may include, but are not limited to, the exact order " @@ -231,14 +236,14 @@ msgid "" "the Python code being executed." msgstr "" -#: ../../c-api/code.rst:198 +#: ../../c-api/code.rst:201 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " "will be printed as an unraisable exception using :c:func:" "`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" -#: ../../c-api/code.rst:202 +#: ../../c-api/code.rst:205 msgid "" "There may already be a pending exception set on entry to the callback. In " "this case, the callback should return ``0`` with the same exception still " @@ -247,85 +252,85 @@ msgid "" "it before returning." msgstr "" -#: ../../c-api/code.rst:212 +#: ../../c-api/code.rst:215 msgid "Extra information" msgstr "" -#: ../../c-api/code.rst:214 +#: ../../c-api/code.rst:217 msgid "" "To support low-level extensions to frame evaluation, such as external just-" "in-time compilers, it is possible to attach arbitrary extra data to code " "objects." msgstr "" -#: ../../c-api/code.rst:218 +#: ../../c-api/code.rst:221 msgid "" "These functions are part of the unstable C API tier: this functionality is a " "CPython implementation detail, and the API may change without deprecation " "warnings." msgstr "" -#: ../../c-api/code.rst:224 +#: ../../c-api/code.rst:227 msgid "Return a new an opaque index value used to adding data to code objects." msgstr "" -#: ../../c-api/code.rst:226 +#: ../../c-api/code.rst:229 msgid "" "You generally call this function once (per interpreter) and use the result " "with ``PyCode_GetExtra`` and ``PyCode_SetExtra`` to manipulate data on " "individual code objects." msgstr "" -#: ../../c-api/code.rst:230 +#: ../../c-api/code.rst:233 msgid "" "If *free* is not ``NULL``: when a code object is deallocated, *free* will be " "called on non-``NULL`` data stored under the new index. Use :c:func:" "`Py_DecRef` when storing :c:type:`PyObject`." msgstr "" -#: ../../c-api/code.rst:236 +#: ../../c-api/code.rst:239 msgid "as ``_PyEval_RequestCodeExtraIndex``" msgstr "" -#: ../../c-api/code.rst:240 +#: ../../c-api/code.rst:243 msgid "" "Renamed to ``PyUnstable_Eval_RequestCodeExtraIndex``. The old private name " "is deprecated, but will be available until the API changes." msgstr "" -#: ../../c-api/code.rst:246 +#: ../../c-api/code.rst:249 msgid "" "Set *extra* to the extra data stored under the given index. Return 0 on " "success. Set an exception and return -1 on failure." msgstr "" -#: ../../c-api/code.rst:249 +#: ../../c-api/code.rst:252 msgid "" "If no data was set under the index, set *extra* to ``NULL`` and return 0 " "without setting an exception." msgstr "" -#: ../../c-api/code.rst:254 +#: ../../c-api/code.rst:257 msgid "as ``_PyCode_GetExtra``" msgstr "" -#: ../../c-api/code.rst:258 +#: ../../c-api/code.rst:261 msgid "" "Renamed to ``PyUnstable_Code_GetExtra``. The old private name is deprecated, " "but will be available until the API changes." msgstr "" -#: ../../c-api/code.rst:264 +#: ../../c-api/code.rst:267 msgid "" "Set the extra data stored under the given index to *extra*. Return 0 on " "success. Set an exception and return -1 on failure." msgstr "" -#: ../../c-api/code.rst:269 +#: ../../c-api/code.rst:272 msgid "as ``_PyCode_SetExtra``" msgstr "" -#: ../../c-api/code.rst:273 +#: ../../c-api/code.rst:276 msgid "" "Renamed to ``PyUnstable_Code_SetExtra``. The old private name is deprecated, " "but will be available until the API changes." @@ -343,22 +348,22 @@ msgstr "code(程式碼)" msgid "code object" msgstr "code object(程式碼物件)" -#: ../../c-api/code.rst:62 +#: ../../c-api/code.rst:64 msgid "PyCode_New (C function)" msgstr "PyCode_New(C 函式)" -#: ../../c-api/code.rst:75 +#: ../../c-api/code.rst:77 msgid "PyCode_NewWithPosOnlyArgs (C function)" msgstr "PyCode_NewWithPosOnlyArgs(C 函式)" -#: ../../c-api/code.rst:234 +#: ../../c-api/code.rst:237 msgid "_PyEval_RequestCodeExtraIndex (C function)" msgstr "_PyEval_RequestCodeExtraIndex(C 函式)" -#: ../../c-api/code.rst:252 +#: ../../c-api/code.rst:255 msgid "_PyCode_GetExtra (C function)" msgstr "_PyCode_GetExtra(C 函式)" -#: ../../c-api/code.rst:267 +#: ../../c-api/code.rst:270 msgid "_PyCode_SetExtra (C function)" msgstr "_PyCode_SetExtra(C 函式)" diff --git a/c-api/exceptions.po b/c-api/exceptions.po index faaa283f82..a2e93cc598 100644 --- a/c-api/exceptions.po +++ b/c-api/exceptions.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -267,8 +267,8 @@ msgstr "" #: ../../c-api/exceptions.rst:234 ../../c-api/exceptions.rst:242 #: ../../c-api/exceptions.rst:253 ../../c-api/exceptions.rst:263 #: ../../c-api/exceptions.rst:271 ../../c-api/exceptions.rst:281 -msgid ":ref:`Availability `: Windows." -msgstr ":ref:`適用 `:Windows。" +msgid "Availability" +msgstr "" #: ../../c-api/exceptions.rst:239 msgid "" diff --git a/c-api/import.po b/c-api/import.po index 96b3529885..8f830d9e96 100644 --- a/c-api/import.po +++ b/c-api/import.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-10 00:13+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-" @@ -159,17 +159,17 @@ msgstr "" #: ../../c-api/import.rst:139 msgid "" -"The module's :attr:`__spec__` and :attr:`__loader__` will be set, if not set " -"already, with the appropriate values. The spec's loader will be set to the " -"module's ``__loader__`` (if set) and to an instance of :class:`~importlib." -"machinery.SourceFileLoader` otherwise." +"The module's :attr:`~module.__spec__` and :attr:`~module.__loader__` will be " +"set, if not set already, with the appropriate values. The spec's loader " +"will be set to the module's :attr:`!__loader__` (if set) and to an instance " +"of :class:`~importlib.machinery.SourceFileLoader` otherwise." msgstr "" #: ../../c-api/import.rst:144 msgid "" -"The module's :attr:`__file__` attribute will be set to the code object's :" -"attr:`~codeobject.co_filename`. If applicable, :attr:`__cached__` will also " -"be set." +"The module's :attr:`~module.__file__` attribute will be set to the code " +"object's :attr:`~codeobject.co_filename`. If applicable, :attr:`~module." +"__cached__` will also be set." msgstr "" #: ../../c-api/import.rst:148 @@ -192,14 +192,14 @@ msgstr "" #: ../../c-api/import.rst:157 msgid "" -"The setting of :attr:`__cached__` and :attr:`__loader__` is deprecated. See :" -"class:`~importlib.machinery.ModuleSpec` for alternatives." +"The setting of :attr:`~module.__cached__` and :attr:`~module.__loader__` is " +"deprecated. See :class:`~importlib.machinery.ModuleSpec` for alternatives." msgstr "" #: ../../c-api/import.rst:165 msgid "" -"Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`__file__` attribute " -"of the module object is set to *pathname* if it is non-``NULL``." +"Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`~module.__file__` " +"attribute of the module object is set to *pathname* if it is non-``NULL``." msgstr "" #: ../../c-api/import.rst:168 @@ -208,15 +208,15 @@ msgstr "也請見 :c:func:`PyImport_ExecCodeModuleWithPathnames`。" #: ../../c-api/import.rst:173 msgid "" -"Like :c:func:`PyImport_ExecCodeModuleEx`, but the :attr:`__cached__` " +"Like :c:func:`PyImport_ExecCodeModuleEx`, but the :attr:`~module.__cached__` " "attribute of the module object is set to *cpathname* if it is non-``NULL``. " "Of the three functions, this is the preferred one to use." msgstr "" #: ../../c-api/import.rst:179 msgid "" -"Setting :attr:`__cached__` is deprecated. See :class:`~importlib.machinery." -"ModuleSpec` for alternatives." +"Setting :attr:`~module.__cached__` is deprecated. See :class:`~importlib." +"machinery.ModuleSpec` for alternatives." msgstr "" #: ../../c-api/import.rst:186 diff --git a/c-api/init.po b/c-api/init.po index f06d0dbb97..4dbcd74843 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-04 00:13+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,14 +25,18 @@ msgid "Initialization, Finalization, and Threads" msgstr "" #: ../../c-api/init.rst:10 -msgid "See also :ref:`Python Initialization Configuration `." -msgstr "也請參見 :ref:`Python 初始化設定 `。" +msgid "" +"See :ref:`Python Initialization Configuration ` for details on " +"how to configure the interpreter prior to initialization." +msgstr "" +"關於如何在初始化之前設定直譯器的細節,請參見 :ref:`Python 初始化設定 `。" -#: ../../c-api/init.rst:15 +#: ../../c-api/init.rst:16 msgid "Before Python Initialization" msgstr "Python 初始化之前" -#: ../../c-api/init.rst:17 +#: ../../c-api/init.rst:18 msgid "" "In an application embedding Python, the :c:func:`Py_Initialize` function " "must be called before using any other Python/C API functions; with the " @@ -40,148 +44,186 @@ msgid "" "`." msgstr "" -#: ../../c-api/init.rst:22 +#: ../../c-api/init.rst:23 msgid "" "The following functions can be safely called before Python is initialized:" msgstr "" -#: ../../c-api/init.rst:24 +#: ../../c-api/init.rst:25 +msgid "Functions that initialize the interpreter:" +msgstr "" + +#: ../../c-api/init.rst:27 +msgid ":c:func:`Py_Initialize`" +msgstr ":c:func:`Py_Initialize`" + +#: ../../c-api/init.rst:28 +msgid ":c:func:`Py_InitializeEx`" +msgstr ":c:func:`Py_InitializeEx`" + +#: ../../c-api/init.rst:29 +msgid ":c:func:`Py_InitializeFromConfig`" +msgstr ":c:func:`Py_InitializeFromConfig`" + +#: ../../c-api/init.rst:30 +msgid ":c:func:`Py_BytesMain`" +msgstr ":c:func:`Py_BytesMain`" + +#: ../../c-api/init.rst:31 +msgid ":c:func:`Py_Main`" +msgstr ":c:func:`Py_Main`" + +#: ../../c-api/init.rst:32 +msgid "the runtime pre-initialization functions covered in :ref:`init-config`" +msgstr "" + +#: ../../c-api/init.rst:34 msgid "Configuration functions:" msgstr "" -#: ../../c-api/init.rst:26 +#: ../../c-api/init.rst:36 msgid ":c:func:`PyImport_AppendInittab`" msgstr ":c:func:`PyImport_AppendInittab`" -#: ../../c-api/init.rst:27 +#: ../../c-api/init.rst:37 msgid ":c:func:`PyImport_ExtendInittab`" msgstr ":c:func:`PyImport_ExtendInittab`" -#: ../../c-api/init.rst:28 +#: ../../c-api/init.rst:38 msgid ":c:func:`!PyInitFrozenExtensions`" msgstr ":c:func:`!PyInitFrozenExtensions`" -#: ../../c-api/init.rst:29 +#: ../../c-api/init.rst:39 msgid ":c:func:`PyMem_SetAllocator`" msgstr ":c:func:`PyMem_SetAllocator`" -#: ../../c-api/init.rst:30 +#: ../../c-api/init.rst:40 msgid ":c:func:`PyMem_SetupDebugHooks`" msgstr ":c:func:`PyMem_SetupDebugHooks`" -#: ../../c-api/init.rst:31 +#: ../../c-api/init.rst:41 msgid ":c:func:`PyObject_SetArenaAllocator`" msgstr ":c:func:`PyObject_SetArenaAllocator`" -#: ../../c-api/init.rst:32 +#: ../../c-api/init.rst:42 msgid ":c:func:`Py_SetProgramName`" msgstr ":c:func:`Py_SetProgramName`" -#: ../../c-api/init.rst:33 +#: ../../c-api/init.rst:43 msgid ":c:func:`Py_SetPythonHome`" msgstr ":c:func:`Py_SetPythonHome`" -#: ../../c-api/init.rst:34 +#: ../../c-api/init.rst:44 msgid ":c:func:`PySys_ResetWarnOptions`" msgstr ":c:func:`PySys_ResetWarnOptions`" -#: ../../c-api/init.rst:36 +#: ../../c-api/init.rst:45 +msgid "the configuration functions covered in :ref:`init-config`" +msgstr "" + +#: ../../c-api/init.rst:47 msgid "Informative functions:" msgstr "" -#: ../../c-api/init.rst:38 +#: ../../c-api/init.rst:49 ../../c-api/init.rst:57 msgid ":c:func:`Py_IsInitialized`" msgstr ":c:func:`Py_IsInitialized`" -#: ../../c-api/init.rst:39 +#: ../../c-api/init.rst:50 msgid ":c:func:`PyMem_GetAllocator`" msgstr ":c:func:`PyMem_GetAllocator`" -#: ../../c-api/init.rst:40 +#: ../../c-api/init.rst:51 msgid ":c:func:`PyObject_GetArenaAllocator`" msgstr ":c:func:`PyObject_GetArenaAllocator`" -#: ../../c-api/init.rst:41 +#: ../../c-api/init.rst:52 msgid ":c:func:`Py_GetBuildInfo`" msgstr ":c:func:`Py_GetBuildInfo`" -#: ../../c-api/init.rst:42 +#: ../../c-api/init.rst:53 msgid ":c:func:`Py_GetCompiler`" msgstr ":c:func:`Py_GetCompiler`" -#: ../../c-api/init.rst:43 +#: ../../c-api/init.rst:54 msgid ":c:func:`Py_GetCopyright`" msgstr ":c:func:`Py_GetCopyright`" -#: ../../c-api/init.rst:44 +#: ../../c-api/init.rst:55 msgid ":c:func:`Py_GetPlatform`" msgstr ":c:func:`Py_GetPlatform`" -#: ../../c-api/init.rst:45 +#: ../../c-api/init.rst:56 msgid ":c:func:`Py_GetVersion`" msgstr ":c:func:`Py_GetVersion`" -#: ../../c-api/init.rst:47 +#: ../../c-api/init.rst:59 msgid "Utilities:" msgstr "" -#: ../../c-api/init.rst:49 +#: ../../c-api/init.rst:61 msgid ":c:func:`Py_DecodeLocale`" msgstr ":c:func:`Py_DecodeLocale`" -#: ../../c-api/init.rst:51 +#: ../../c-api/init.rst:62 +msgid "" +"the status reporting and utility functions covered in :ref:`init-config`" +msgstr "" + +#: ../../c-api/init.rst:64 msgid "Memory allocators:" msgstr "" -#: ../../c-api/init.rst:53 +#: ../../c-api/init.rst:66 msgid ":c:func:`PyMem_RawMalloc`" msgstr ":c:func:`PyMem_RawMalloc`" -#: ../../c-api/init.rst:54 +#: ../../c-api/init.rst:67 msgid ":c:func:`PyMem_RawRealloc`" msgstr ":c:func:`PyMem_RawRealloc`" -#: ../../c-api/init.rst:55 +#: ../../c-api/init.rst:68 msgid ":c:func:`PyMem_RawCalloc`" msgstr ":c:func:`PyMem_RawCalloc`" -#: ../../c-api/init.rst:56 +#: ../../c-api/init.rst:69 msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" -#: ../../c-api/init.rst:58 +#: ../../c-api/init.rst:71 msgid "Synchronization:" msgstr "" -#: ../../c-api/init.rst:60 +#: ../../c-api/init.rst:73 msgid ":c:func:`PyMutex_Lock`" msgstr ":c:func:`PyMutex_Lock`" -#: ../../c-api/init.rst:61 +#: ../../c-api/init.rst:74 msgid ":c:func:`PyMutex_Unlock`" msgstr ":c:func:`PyMutex_Unlock`" -#: ../../c-api/init.rst:65 +#: ../../c-api/init.rst:78 msgid "" -"The following functions **should not be called** before :c:func:" -"`Py_Initialize`: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:" +"Despite their apparent similarity to some of the functions listed above, the " +"following functions **should not be called** before the interpreter has been " +"initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:" "`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:" "`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, :c:func:" -"`Py_GetProgramName` and :c:func:`PyEval_InitThreads`." +"`Py_GetProgramName`, :c:func:`PyEval_InitThreads`, and :c:func:`Py_RunMain`." msgstr "" -#: ../../c-api/init.rst:75 +#: ../../c-api/init.rst:90 msgid "Global configuration variables" msgstr "" -#: ../../c-api/init.rst:77 +#: ../../c-api/init.rst:92 msgid "" "Python has variables for the global configuration to control different " "features and options. By default, these flags are controlled by :ref:" "`command line options `." msgstr "" -#: ../../c-api/init.rst:81 +#: ../../c-api/init.rst:96 msgid "" "When a flag is set by an option, the value of the flag is the number of " "times that the option was set. For example, ``-b`` sets :c:data:" @@ -189,108 +231,108 @@ msgid "" "2." msgstr "" -#: ../../c-api/init.rst:87 +#: ../../c-api/init.rst:102 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "bytes_warning` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:91 +#: ../../c-api/init.rst:106 msgid "" "Issue a warning when comparing :class:`bytes` or :class:`bytearray` with :" "class:`str` or :class:`bytes` with :class:`int`. Issue an error if greater " "or equal to ``2``." msgstr "" -#: ../../c-api/init.rst:95 +#: ../../c-api/init.rst:110 msgid "Set by the :option:`-b` option." msgstr "由 :option:`-b` 選項設定。" -#: ../../c-api/init.rst:101 +#: ../../c-api/init.rst:116 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "parser_debug` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:105 +#: ../../c-api/init.rst:120 msgid "" "Turn on parser debugging output (for expert only, depending on compilation " "options)." msgstr "" -#: ../../c-api/init.rst:108 +#: ../../c-api/init.rst:123 msgid "" "Set by the :option:`-d` option and the :envvar:`PYTHONDEBUG` environment " "variable." msgstr "由 :option:`-d` 選項與 :envvar:`PYTHONDEBUG` 環境變數設定。" -#: ../../c-api/init.rst:115 +#: ../../c-api/init.rst:130 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "write_bytecode` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:119 +#: ../../c-api/init.rst:134 msgid "" "If set to non-zero, Python won't try to write ``.pyc`` files on the import " "of source modules." msgstr "" -#: ../../c-api/init.rst:122 +#: ../../c-api/init.rst:137 msgid "" "Set by the :option:`-B` option and the :envvar:`PYTHONDONTWRITEBYTECODE` " "environment variable." msgstr "" "由 :option:`-B` 選項與 :envvar:`PYTHONDONTWRITEBYTECODE` 環境變數設定。" -#: ../../c-api/init.rst:129 +#: ../../c-api/init.rst:144 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "pathconfig_warnings` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:133 +#: ../../c-api/init.rst:148 msgid "" "Suppress error messages when calculating the module search path in :c:func:" "`Py_GetPath`." msgstr "" -#: ../../c-api/init.rst:136 +#: ../../c-api/init.rst:151 msgid "Private flag used by ``_freeze_module`` and ``frozenmain`` programs." msgstr "" -#: ../../c-api/init.rst:142 +#: ../../c-api/init.rst:157 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "hash_seed` and :c:member:`PyConfig.use_hash_seed` should be used instead, " "see :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:147 +#: ../../c-api/init.rst:162 msgid "" "Set to ``1`` if the :envvar:`PYTHONHASHSEED` environment variable is set to " "a non-empty string." msgstr "" "如果環境變數 :envvar:`PYTHONHASHSEED` 被設定為一個非空字串則設為 ``1``。" -#: ../../c-api/init.rst:150 +#: ../../c-api/init.rst:165 msgid "" "If the flag is non-zero, read the :envvar:`PYTHONHASHSEED` environment " "variable to initialize the secret hash seed." msgstr "" -#: ../../c-api/init.rst:157 +#: ../../c-api/init.rst:172 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "use_environment` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:161 +#: ../../c-api/init.rst:176 msgid "" "Ignore all :envvar:`!PYTHON*` environment variables, e.g. :envvar:" "`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." @@ -298,73 +340,73 @@ msgstr "" "忽略所有可能被設定的 :envvar:`!PYTHON*` 環境變數,例如 :envvar:`PYTHONPATH` " "與 :envvar:`PYTHONHOME`。" -#: ../../c-api/init.rst:164 +#: ../../c-api/init.rst:179 msgid "Set by the :option:`-E` and :option:`-I` options." msgstr "由 :option:`-E` 與 :option:`-I` 選項設定。" -#: ../../c-api/init.rst:170 +#: ../../c-api/init.rst:185 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "inspect` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:174 +#: ../../c-api/init.rst:189 msgid "" "When a script is passed as first argument or the :option:`-c` option is " "used, enter interactive mode after executing the script or the command, even " "when :data:`sys.stdin` does not appear to be a terminal." msgstr "" -#: ../../c-api/init.rst:178 +#: ../../c-api/init.rst:193 msgid "" "Set by the :option:`-i` option and the :envvar:`PYTHONINSPECT` environment " "variable." msgstr "由 :option:`-i` 選項與 :envvar:`PYTHONINSPECT` 環境變數設定。" -#: ../../c-api/init.rst:185 +#: ../../c-api/init.rst:200 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "interactive` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:189 +#: ../../c-api/init.rst:204 msgid "Set by the :option:`-i` option." msgstr "由 :option:`-i` 選項設定。" -#: ../../c-api/init.rst:195 +#: ../../c-api/init.rst:210 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "isolated` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:199 +#: ../../c-api/init.rst:214 msgid "" "Run Python in isolated mode. In isolated mode :data:`sys.path` contains " "neither the script's directory nor the user's site-packages directory." msgstr "" -#: ../../c-api/init.rst:202 +#: ../../c-api/init.rst:217 msgid "Set by the :option:`-I` option." msgstr "由 :option:`-i` 選項設定。" -#: ../../c-api/init.rst:210 +#: ../../c-api/init.rst:225 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyPreConfig." "legacy_windows_fs_encoding` should be used instead, see :ref:`Python " "Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:214 +#: ../../c-api/init.rst:229 msgid "" "If the flag is non-zero, use the ``mbcs`` encoding with ``replace`` error " "handler, instead of the UTF-8 encoding with ``surrogatepass`` error handler, " "for the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/init.rst:218 +#: ../../c-api/init.rst:233 msgid "" "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment " "variable is set to a non-empty string." @@ -372,45 +414,45 @@ msgstr "" "如果環境變數 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 被設定為一個非空字串則設" "為 ``1``。" -#: ../../c-api/init.rst:221 +#: ../../c-api/init.rst:236 msgid "See :pep:`529` for more details." msgstr "更多詳情請見 :pep:`529`。" -#: ../../c-api/init.rst:223 ../../c-api/init.rst:241 -msgid ":ref:`Availability `: Windows." -msgstr ":ref:`適用 `:Windows。" +#: ../../c-api/init.rst:238 ../../c-api/init.rst:256 +msgid "Availability" +msgstr "" -#: ../../c-api/init.rst:229 +#: ../../c-api/init.rst:244 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "legacy_windows_stdio` should be used instead, see :ref:`Python " "Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:233 +#: ../../c-api/init.rst:248 msgid "" "If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!io." "_WindowsConsoleIO` for :mod:`sys` standard streams." msgstr "" -#: ../../c-api/init.rst:236 +#: ../../c-api/init.rst:251 msgid "" "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSSTDIO` environment variable " "is set to a non-empty string." msgstr "" -#: ../../c-api/init.rst:239 +#: ../../c-api/init.rst:254 msgid "See :pep:`528` for more details." msgstr "更多詳情請見 :pep:`528`。" -#: ../../c-api/init.rst:247 +#: ../../c-api/init.rst:262 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "site_import` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:251 +#: ../../c-api/init.rst:266 msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " @@ -418,24 +460,24 @@ msgid "" "main` if you want them to be triggered)." msgstr "" -#: ../../c-api/init.rst:256 +#: ../../c-api/init.rst:271 msgid "Set by the :option:`-S` option." msgstr "由 :option:`-S` 選項設定。" -#: ../../c-api/init.rst:262 +#: ../../c-api/init.rst:277 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "user_site_directory` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:266 +#: ../../c-api/init.rst:281 msgid "" "Don't add the :data:`user site-packages directory ` to :data:" "`sys.path`." msgstr "" -#: ../../c-api/init.rst:269 +#: ../../c-api/init.rst:284 msgid "" "Set by the :option:`-s` and :option:`-I` options, and the :envvar:" "`PYTHONNOUSERSITE` environment variable." @@ -443,60 +485,60 @@ msgstr "" "由 :option:`-s` 選項、:option:`-I` 選項與 :envvar:`PYTHONNOUSERSITE` 環境變數" "設定。" -#: ../../c-api/init.rst:276 +#: ../../c-api/init.rst:291 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "optimization_level` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:280 +#: ../../c-api/init.rst:295 msgid "" "Set by the :option:`-O` option and the :envvar:`PYTHONOPTIMIZE` environment " "variable." msgstr "由 :option:`-O` 選項與 :envvar:`PYTHONOPTIMIZE` 環境變數設定。" -#: ../../c-api/init.rst:287 +#: ../../c-api/init.rst:302 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "quiet` should be used instead, see :ref:`Python Initialization Configuration " "`." msgstr "" -#: ../../c-api/init.rst:291 +#: ../../c-api/init.rst:306 msgid "" "Don't display the copyright and version messages even in interactive mode." msgstr "" -#: ../../c-api/init.rst:293 +#: ../../c-api/init.rst:308 msgid "Set by the :option:`-q` option." msgstr "由 :option:`-q` 選項設定。" -#: ../../c-api/init.rst:301 +#: ../../c-api/init.rst:316 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "buffered_stdio` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:305 +#: ../../c-api/init.rst:320 msgid "Force the stdout and stderr streams to be unbuffered." msgstr "" -#: ../../c-api/init.rst:307 +#: ../../c-api/init.rst:322 msgid "" "Set by the :option:`-u` option and the :envvar:`PYTHONUNBUFFERED` " "environment variable." msgstr "由 :option:`-u` 選項與 :envvar:`PYTHONUNBUFFERED` 環境變數設定。" -#: ../../c-api/init.rst:314 +#: ../../c-api/init.rst:329 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "verbose` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:318 +#: ../../c-api/init.rst:333 msgid "" "Print a message each time a module is initialized, showing the place " "(filename or built-in module) from which it is loaded. If greater or equal " @@ -504,67 +546,81 @@ msgid "" "for a module. Also provides information on module cleanup at exit." msgstr "" -#: ../../c-api/init.rst:323 +#: ../../c-api/init.rst:338 msgid "" "Set by the :option:`-v` option and the :envvar:`PYTHONVERBOSE` environment " "variable." msgstr "由 :option:`-v` 選項與 :envvar:`PYTHONVERBOSE` 環境變數設定。" -#: ../../c-api/init.rst:330 +#: ../../c-api/init.rst:345 msgid "Initializing and finalizing the interpreter" msgstr "" -#: ../../c-api/init.rst:345 +#: ../../c-api/init.rst:360 msgid "" "Initialize the Python interpreter. In an application embedding Python, " "this should be called before using any other Python/C API functions; see :" "ref:`Before Python Initialization ` for the few exceptions." msgstr "" -#: ../../c-api/init.rst:349 +#: ../../c-api/init.rst:364 msgid "" "This initializes the table of loaded modules (``sys.modules``), and creates " -"the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. It " +"the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. It " "also initializes the module search path (``sys.path``). It does not set " -"``sys.argv``; use the new :c:type:`PyConfig` API of the :ref:`Python " -"Initialization Configuration ` for that. This is a no-op when " -"called for a second time (without calling :c:func:`Py_FinalizeEx` first). " -"There is no return value; it is a fatal error if the initialization fails." +"``sys.argv``; use the :ref:`Python Initialization Configuration ` API for that. This is a no-op when called for a second time " +"(without calling :c:func:`Py_FinalizeEx` first). There is no return value; " +"it is a fatal error if the initialization fails." msgstr "" -#: ../../c-api/init.rst:359 ../../c-api/init.rst:373 +#: ../../c-api/init.rst:372 ../../c-api/init.rst:386 msgid "" -"Use the :c:func:`Py_InitializeFromConfig` function to customize the :ref:" -"`Python Initialization Configuration `." +"Use :c:func:`Py_InitializeFromConfig` to customize the :ref:`Python " +"Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:363 +#: ../../c-api/init.rst:376 msgid "" "On Windows, changes the console mode from ``O_TEXT`` to ``O_BINARY``, which " "will also affect non-Python uses of the console using the C Runtime." msgstr "" -#: ../../c-api/init.rst:369 +#: ../../c-api/init.rst:382 msgid "" "This function works like :c:func:`Py_Initialize` if *initsigs* is ``1``. If " "*initsigs* is ``0``, it skips initialization registration of signal " -"handlers, which might be useful when Python is embedded." +"handlers, which may be useful when CPython is embedded as part of a larger " +"application." +msgstr "" + +#: ../../c-api/init.rst:392 +msgid "" +"Initialize Python from *config* configuration, as described in :ref:`init-" +"from-config`." +msgstr "" + +#: ../../c-api/init.rst:395 +msgid "" +"See the :ref:`init-config` section for details on pre-initializing the " +"interpreter, populating the runtime configuration structure, and querying " +"the returned status structure." msgstr "" -#: ../../c-api/init.rst:379 +#: ../../c-api/init.rst:402 msgid "" "Return true (nonzero) when the Python interpreter has been initialized, " "false (zero) if not. After :c:func:`Py_FinalizeEx` is called, this returns " "false until :c:func:`Py_Initialize` is called again." msgstr "" -#: ../../c-api/init.rst:386 +#: ../../c-api/init.rst:409 msgid "" "Return true (non-zero) if the main Python interpreter is :term:`shutting " "down `. Return false (zero) otherwise." msgstr "" -#: ../../c-api/init.rst:394 +#: ../../c-api/init.rst:417 msgid "" "Undo all initializations made by :c:func:`Py_Initialize` and subsequent use " "of Python/C API functions, and destroy all sub-interpreters (see :c:func:" @@ -574,7 +630,7 @@ msgid "" "second time (without calling :c:func:`Py_Initialize` again first)." msgstr "" -#: ../../c-api/init.rst:401 +#: ../../c-api/init.rst:424 msgid "" "Since this is the reverse of :c:func:`Py_Initialize`, it should be called in " "the same thread with the same interpreter active. That means the main " @@ -582,13 +638,13 @@ msgid "" "`Py_RunMain` is running." msgstr "" -#: ../../c-api/init.rst:406 +#: ../../c-api/init.rst:429 msgid "" "Normally the return value is ``0``. If there were errors during finalization " "(flushing buffered data), ``-1`` is returned." msgstr "" -#: ../../c-api/init.rst:410 +#: ../../c-api/init.rst:433 msgid "" "This function is provided for a number of reasons. An embedding application " "might want to restart Python without having to restart the application " @@ -599,7 +655,7 @@ msgid "" "Python before exiting from the application." msgstr "" -#: ../../c-api/init.rst:418 +#: ../../c-api/init.rst:441 msgid "" "**Bugs and caveats:** The destruction of modules and objects in modules is " "done in random order; this may cause destructors (:meth:`~object.__del__` " @@ -614,7 +670,7 @@ msgid "" "more than once." msgstr "" -#: ../../c-api/init.rst:429 +#: ../../c-api/init.rst:452 msgid "" "Raises an :ref:`auditing event ` ``cpython." "_PySys_ClearAuditHooks`` with no arguments." @@ -622,24 +678,154 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "_PySys_ClearAuditHooks``。" -#: ../../c-api/init.rst:435 +#: ../../c-api/init.rst:459 msgid "" "This is a backwards-compatible version of :c:func:`Py_FinalizeEx` that " "disregards the return value." msgstr "" -#: ../../c-api/init.rst:440 +#: ../../c-api/init.rst:465 +msgid "" +"Similar to :c:func:`Py_Main` but *argv* is an array of bytes strings, " +"allowing the calling application to delegate the text decoding step to the " +"CPython runtime." +msgstr "" + +#: ../../c-api/init.rst:474 +msgid "" +"The main program for the standard interpreter, encapsulating a full " +"initialization/finalization cycle, as well as additional behaviour to " +"implement reading configurations settings from the environment and command " +"line, and then executing ``__main__`` in accordance with :ref:`using-on-" +"cmdline`." +msgstr "" + +#: ../../c-api/init.rst:480 +msgid "" +"This is made available for programs which wish to support the full CPython " +"command line interface, rather than just embedding a Python runtime in a " +"larger application." +msgstr "" + +#: ../../c-api/init.rst:484 +msgid "" +"The *argc* and *argv* parameters are similar to those which are passed to a " +"C program's :c:func:`main` function, except that the *argv* entries are " +"first converted to ``wchar_t`` using :c:func:`Py_DecodeLocale`. It is also " +"important to note that the argument list entries may be modified to point to " +"strings other than those passed in (however, the contents of the strings " +"pointed to by the argument list are not modified)." +msgstr "" + +#: ../../c-api/init.rst:491 +msgid "" +"The return value will be ``0`` if the interpreter exits normally (i.e., " +"without an exception), ``1`` if the interpreter exits due to an exception, " +"or ``2`` if the argument list does not represent a valid Python command line." +msgstr "" + +#: ../../c-api/init.rst:496 +msgid "" +"Note that if an otherwise unhandled :exc:`SystemExit` is raised, this " +"function will not return ``1``, but exit the process, as long as " +"``Py_InspectFlag`` is not set. If ``Py_InspectFlag`` is set, execution will " +"drop into the interactive Python prompt, at which point a second otherwise " +"unhandled :exc:`SystemExit` will still exit the process, while any other " +"means of exiting will set the return value as described above." +msgstr "" + +#: ../../c-api/init.rst:503 +msgid "" +"In terms of the CPython runtime configuration APIs documented in the :ref:" +"`runtime configuration ` section (and without accounting for " +"error handling), ``Py_Main`` is approximately equivalent to::" +msgstr "" + +#: ../../c-api/init.rst:507 +msgid "" +"PyConfig config;\n" +"PyConfig_InitPythonConfig(&config);\n" +"PyConfig_SetArgv(&config, argc, argv);\n" +"Py_InitializeFromConfig(&config);\n" +"PyConfig_Clear(&config);\n" +"\n" +"Py_RunMain();" +msgstr "" + +#: ../../c-api/init.rst:515 +msgid "" +"In normal usage, an embedding application will call this function *instead* " +"of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` or :c:func:" +"`Py_InitializeFromConfig` directly, and all settings will be applied as " +"described elsewhere in this documentation. If this function is instead " +"called *after* a preceding runtime initialization API call, then exactly " +"which environmental and command line configuration settings will be updated " +"is version dependent (as it depends on which settings correctly support " +"being modified after they have already been set once when the runtime was " +"first initialized)." +msgstr "" + +#: ../../c-api/init.rst:528 +msgid "Executes the main module in a fully configured CPython runtime." +msgstr "" + +#: ../../c-api/init.rst:530 +msgid "" +"Executes the command (:c:member:`PyConfig.run_command`), the script (:c:" +"member:`PyConfig.run_filename`) or the module (:c:member:`PyConfig." +"run_module`) specified on the command line or in the configuration. If none " +"of these values are set, runs the interactive Python prompt (REPL) using the " +"``__main__`` module's global namespace." +msgstr "" + +#: ../../c-api/init.rst:536 +msgid "" +"If :c:member:`PyConfig.inspect` is not set (the default), the return value " +"will be ``0`` if the interpreter exits normally (that is, without raising an " +"exception), or ``1`` if the interpreter exits due to an exception. If an " +"otherwise unhandled :exc:`SystemExit` is raised, the function will " +"immediately exit the process instead of returning ``1``." +msgstr "" + +#: ../../c-api/init.rst:542 +msgid "" +"If :c:member:`PyConfig.inspect` is set (such as when the :option:`-i` option " +"is used), rather than returning when the interpreter exits, execution will " +"instead resume in an interactive Python prompt (REPL) using the ``__main__`` " +"module's global namespace. If the interpreter exited with an exception, it " +"is immediately raised in the REPL session. The function return value is then " +"determined by the way the *REPL session* terminates: returning ``0`` if the " +"session terminates without raising an unhandled exception, exiting " +"immediately for an unhandled :exc:`SystemExit`, and returning ``1`` for any " +"other unhandled exception." +msgstr "" + +#: ../../c-api/init.rst:552 +msgid "" +"This function always finalizes the Python interpreter regardless of whether " +"it returns a value or immediately exits the process due to an unhandled :exc:" +"`SystemExit` exception." +msgstr "" + +#: ../../c-api/init.rst:556 +msgid "" +"See :ref:`Python Configuration ` for an example of a " +"customized Python that always runs in isolated mode using :c:func:" +"`Py_RunMain`." +msgstr "" + +#: ../../c-api/init.rst:562 msgid "Process-wide parameters" msgstr "" -#: ../../c-api/init.rst:450 +#: ../../c-api/init.rst:572 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "program_name` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:454 +#: ../../c-api/init.rst:576 msgid "" "This function should be called before :c:func:`Py_Initialize` is called for " "the first time, if it is called at all. It tells the interpreter the value " @@ -653,37 +839,37 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:465 ../../c-api/init.rst:704 ../../c-api/init.rst:740 -#: ../../c-api/init.rst:766 +#: ../../c-api/init.rst:587 ../../c-api/init.rst:826 ../../c-api/init.rst:862 +#: ../../c-api/init.rst:888 msgid "" "Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" "`wchar_*` string." msgstr "" -#: ../../c-api/init.rst:473 +#: ../../c-api/init.rst:595 msgid "" "Return the program name set with :c:member:`PyConfig.program_name`, or the " "default. The returned string points into static storage; the caller should " "not modify its value." msgstr "" -#: ../../c-api/init.rst:477 ../../c-api/init.rst:499 ../../c-api/init.rst:543 -#: ../../c-api/init.rst:564 ../../c-api/init.rst:590 ../../c-api/init.rst:778 +#: ../../c-api/init.rst:599 ../../c-api/init.rst:621 ../../c-api/init.rst:665 +#: ../../c-api/init.rst:686 ../../c-api/init.rst:712 ../../c-api/init.rst:900 msgid "" "This function should not be called before :c:func:`Py_Initialize`, otherwise " "it returns ``NULL``." msgstr "此函式不應該在 :c:func:`Py_Initialize` 之前呼叫,否則會回傳 ``NULL``。" -#: ../../c-api/init.rst:480 ../../c-api/init.rst:502 ../../c-api/init.rst:546 -#: ../../c-api/init.rst:567 ../../c-api/init.rst:595 ../../c-api/init.rst:781 +#: ../../c-api/init.rst:602 ../../c-api/init.rst:624 ../../c-api/init.rst:668 +#: ../../c-api/init.rst:689 ../../c-api/init.rst:717 ../../c-api/init.rst:903 msgid "It now returns ``NULL`` if called before :c:func:`Py_Initialize`." msgstr "如果在 :c:func:`Py_Initialize` 之前呼叫,現在會回傳 ``NULL``。" -#: ../../c-api/init.rst:483 ../../c-api/init.rst:570 +#: ../../c-api/init.rst:605 ../../c-api/init.rst:692 msgid "Get :data:`sys.executable` instead." msgstr "" -#: ../../c-api/init.rst:489 +#: ../../c-api/init.rst:611 msgid "" "Return the *prefix* for installed platform-independent files. This is " "derived through a number of complicated rules from the program name set " @@ -697,11 +883,11 @@ msgid "" "also the next function." msgstr "" -#: ../../c-api/init.rst:505 +#: ../../c-api/init.rst:627 msgid "Get :data:`sys.prefix` instead." msgstr "" -#: ../../c-api/init.rst:511 +#: ../../c-api/init.rst:633 msgid "" "Return the *exec-prefix* for installed platform-*dependent* files. This is " "derived through a number of complicated rules from the program name set " @@ -715,7 +901,7 @@ msgid "" "on Unix." msgstr "" -#: ../../c-api/init.rst:521 +#: ../../c-api/init.rst:643 msgid "" "Background: The exec-prefix differs from the prefix when platform dependent " "files (such as executables and shared libraries) are installed in a " @@ -724,7 +910,7 @@ msgid "" "independent may be installed in :file:`/usr/local`." msgstr "" -#: ../../c-api/init.rst:527 +#: ../../c-api/init.rst:649 msgid "" "Generally speaking, a platform is a combination of hardware and software " "families, e.g. Sparc machines running the Solaris 2.x operating system are " @@ -738,7 +924,7 @@ msgid "" "independent from the Python version by which they were compiled!)." msgstr "" -#: ../../c-api/init.rst:538 +#: ../../c-api/init.rst:660 msgid "" "System administrators will know how to configure the :program:`mount` or :" "program:`automount` programs to share :file:`/usr/local` between platforms " @@ -746,11 +932,11 @@ msgid "" "platform." msgstr "" -#: ../../c-api/init.rst:549 +#: ../../c-api/init.rst:671 msgid "Get :data:`sys.exec_prefix` instead." msgstr "" -#: ../../c-api/init.rst:558 +#: ../../c-api/init.rst:680 msgid "" "Return the full program name of the Python executable; this is computed as " "a side-effect of deriving the default module search path from the program " @@ -759,7 +945,7 @@ msgid "" "available to Python code as ``sys.executable``." msgstr "" -#: ../../c-api/init.rst:580 +#: ../../c-api/init.rst:702 msgid "" "Return the default module search path; this is computed from the program " "name (set by :c:member:`PyConfig.program_name`) and some environment " @@ -772,21 +958,21 @@ msgid "" "for loading modules." msgstr "" -#: ../../c-api/init.rst:598 +#: ../../c-api/init.rst:720 msgid "Get :data:`sys.path` instead." msgstr "" -#: ../../c-api/init.rst:604 +#: ../../c-api/init.rst:726 msgid "" "Return the version of this Python interpreter. This is a string that looks " "something like ::" msgstr "" -#: ../../c-api/init.rst:607 +#: ../../c-api/init.rst:729 msgid "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" msgstr "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" -#: ../../c-api/init.rst:611 +#: ../../c-api/init.rst:733 msgid "" "The first word (up to the first space character) is the current Python " "version; the first characters are the major and minor version separated by a " @@ -795,11 +981,11 @@ msgid "" "version`." msgstr "" -#: ../../c-api/init.rst:616 +#: ../../c-api/init.rst:738 msgid "See also the :c:var:`Py_Version` constant." msgstr "" -#: ../../c-api/init.rst:623 +#: ../../c-api/init.rst:745 msgid "" "Return the platform identifier for the current platform. On Unix, this is " "formed from the \"official\" name of the operating system, converted to " @@ -810,50 +996,50 @@ msgid "" "available to Python code as ``sys.platform``." msgstr "" -#: ../../c-api/init.rst:634 +#: ../../c-api/init.rst:756 msgid "" "Return the official copyright string for the current Python version, for " "example" msgstr "" -#: ../../c-api/init.rst:636 +#: ../../c-api/init.rst:758 msgid "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" msgstr "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" -#: ../../c-api/init.rst:640 +#: ../../c-api/init.rst:762 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as ``sys.copyright``." msgstr "" -#: ../../c-api/init.rst:646 +#: ../../c-api/init.rst:768 msgid "" "Return an indication of the compiler used to build the current Python " "version, in square brackets, for example::" msgstr "" -#: ../../c-api/init.rst:649 +#: ../../c-api/init.rst:771 msgid "\"[GCC 2.7.2.2]\"" msgstr "\"[GCC 2.7.2.2]\"" -#: ../../c-api/init.rst:653 ../../c-api/init.rst:667 +#: ../../c-api/init.rst:775 ../../c-api/init.rst:789 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as part of the variable " "``sys.version``." msgstr "" -#: ../../c-api/init.rst:660 +#: ../../c-api/init.rst:782 msgid "" "Return information about the sequence number and build date and time of the " "current Python interpreter instance, for example ::" msgstr "" -#: ../../c-api/init.rst:663 +#: ../../c-api/init.rst:785 msgid "\"#67, Aug 1 1997, 22:34:28\"" msgstr "\"#67, Aug 1 1997, 22:34:28\"" -#: ../../c-api/init.rst:679 +#: ../../c-api/init.rst:801 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` " @@ -861,7 +1047,7 @@ msgid "" "config>`." msgstr "" -#: ../../c-api/init.rst:684 +#: ../../c-api/init.rst:806 msgid "" "Set :data:`sys.argv` based on *argc* and *argv*. These parameters are " "similar to those passed to the program's :c:func:`main` function with the " @@ -872,84 +1058,84 @@ msgid "" "fatal condition is signalled using :c:func:`Py_FatalError`." msgstr "" -#: ../../c-api/init.rst:692 +#: ../../c-api/init.rst:814 msgid "" "If *updatepath* is zero, this is all the function does. If *updatepath* is " "non-zero, the function also modifies :data:`sys.path` according to the " "following algorithm:" msgstr "" -#: ../../c-api/init.rst:696 +#: ../../c-api/init.rst:818 msgid "" "If the name of an existing script is passed in ``argv[0]``, the absolute " "path of the directory where the script is located is prepended to :data:`sys." "path`." msgstr "" -#: ../../c-api/init.rst:699 +#: ../../c-api/init.rst:821 msgid "" "Otherwise (that is, if *argc* is ``0`` or ``argv[0]`` doesn't point to an " "existing file name), an empty string is prepended to :data:`sys.path`, which " "is the same as prepending the current working directory (``\".\"``)." msgstr "" -#: ../../c-api/init.rst:707 ../../c-api/init.rst:743 +#: ../../c-api/init.rst:829 ../../c-api/init.rst:865 msgid "" "See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv` " "members of the :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:711 +#: ../../c-api/init.rst:833 msgid "" "It is recommended that applications embedding the Python interpreter for " "purposes other than executing a single script pass ``0`` as *updatepath*, " "and update :data:`sys.path` themselves if desired. See :cve:`2008-5983`." msgstr "" -#: ../../c-api/init.rst:716 +#: ../../c-api/init.rst:838 msgid "" "On versions before 3.1.3, you can achieve the same effect by manually " "popping the first :data:`sys.path` element after having called :c:func:" "`PySys_SetArgv`, for example using::" msgstr "" -#: ../../c-api/init.rst:720 +#: ../../c-api/init.rst:842 msgid "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" msgstr "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" -#: ../../c-api/init.rst:732 +#: ../../c-api/init.rst:854 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv` and :c:member:`PyConfig.parse_argv` should be used instead, see :ref:" "`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:736 +#: ../../c-api/init.rst:858 msgid "" "This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to " "``1`` unless the :program:`python` interpreter was started with the :option:" "`-I`." msgstr "" -#: ../../c-api/init.rst:746 +#: ../../c-api/init.rst:868 msgid "The *updatepath* value depends on :option:`-I`." msgstr "" -#: ../../c-api/init.rst:753 +#: ../../c-api/init.rst:875 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "home` should be used instead, see :ref:`Python Initialization Configuration " "`." msgstr "" -#: ../../c-api/init.rst:757 +#: ../../c-api/init.rst:879 msgid "" "Set the default \"home\" directory, that is, the location of the standard " "Python libraries. See :envvar:`PYTHONHOME` for the meaning of the argument " "string." msgstr "" -#: ../../c-api/init.rst:761 +#: ../../c-api/init.rst:883 msgid "" "The argument should point to a zero-terminated character string in static " "storage whose contents will not change for the duration of the program's " @@ -957,24 +1143,24 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:774 +#: ../../c-api/init.rst:896 msgid "" "Return the default \"home\", that is, the value set by :c:member:`PyConfig." "home`, or the value of the :envvar:`PYTHONHOME` environment variable if it " "is set." msgstr "" -#: ../../c-api/init.rst:784 +#: ../../c-api/init.rst:906 msgid "" "Get :c:member:`PyConfig.home` or :envvar:`PYTHONHOME` environment variable " "instead." msgstr "改為取得 :c:member:`PyConfig.home` 或 :envvar:`PYTHONHOME` 環境變數。" -#: ../../c-api/init.rst:792 +#: ../../c-api/init.rst:914 msgid "Thread State and the Global Interpreter Lock" msgstr "" -#: ../../c-api/init.rst:799 +#: ../../c-api/init.rst:921 msgid "" "The Python interpreter is not fully thread-safe. In order to support multi-" "threaded Python programs, there's a global lock, called the :term:`global " @@ -986,7 +1172,7 @@ msgid "" "once instead of twice." msgstr "" -#: ../../c-api/init.rst:809 +#: ../../c-api/init.rst:931 msgid "" "Therefore, the rule exists that only the thread that has acquired the :term:" "`GIL` may operate on Python objects or call Python/C API functions. In order " @@ -996,7 +1182,7 @@ msgid "" "a file, so that other Python threads can run in the meantime." msgstr "" -#: ../../c-api/init.rst:819 +#: ../../c-api/init.rst:941 msgid "" "The Python interpreter keeps some thread-specific bookkeeping information " "inside a data structure called :c:type:`PyThreadState`. There's also one " @@ -1004,17 +1190,17 @@ msgid "" "retrieved using :c:func:`PyThreadState_Get`." msgstr "" -#: ../../c-api/init.rst:825 +#: ../../c-api/init.rst:947 msgid "Releasing the GIL from extension code" msgstr "" -#: ../../c-api/init.rst:827 +#: ../../c-api/init.rst:949 msgid "" "Most extension code manipulating the :term:`GIL` has the following simple " "structure::" msgstr "" -#: ../../c-api/init.rst:830 +#: ../../c-api/init.rst:952 msgid "" "Save the thread state in a local variable.\n" "Release the global interpreter lock.\n" @@ -1023,29 +1209,29 @@ msgid "" "Restore the thread state from the local variable." msgstr "" -#: ../../c-api/init.rst:836 +#: ../../c-api/init.rst:958 msgid "This is so common that a pair of macros exists to simplify it::" msgstr "" -#: ../../c-api/init.rst:838 +#: ../../c-api/init.rst:960 msgid "" "Py_BEGIN_ALLOW_THREADS\n" "... Do some blocking I/O operation ...\n" "Py_END_ALLOW_THREADS" msgstr "" -#: ../../c-api/init.rst:846 +#: ../../c-api/init.rst:968 msgid "" "The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a " "hidden local variable; the :c:macro:`Py_END_ALLOW_THREADS` macro closes the " "block." msgstr "" -#: ../../c-api/init.rst:850 +#: ../../c-api/init.rst:972 msgid "The block above expands to the following code::" msgstr "" -#: ../../c-api/init.rst:852 +#: ../../c-api/init.rst:974 msgid "" "PyThreadState *_save;\n" "\n" @@ -1054,7 +1240,7 @@ msgid "" "PyEval_RestoreThread(_save);" msgstr "" -#: ../../c-api/init.rst:862 +#: ../../c-api/init.rst:984 msgid "" "Here is how these functions work: the global interpreter lock is used to " "protect the pointer to the current thread state. When releasing the lock " @@ -1065,7 +1251,7 @@ msgid "" "state, the lock must be acquired before storing the thread state pointer." msgstr "" -#: ../../c-api/init.rst:871 +#: ../../c-api/init.rst:993 msgid "" "Calling system I/O functions is the most common use case for releasing the " "GIL, but it can also be useful before calling long-running computations " @@ -1075,11 +1261,11 @@ msgid "" "compressing or hashing data." msgstr "" -#: ../../c-api/init.rst:882 +#: ../../c-api/init.rst:1004 msgid "Non-Python created threads" msgstr "" -#: ../../c-api/init.rst:884 +#: ../../c-api/init.rst:1006 msgid "" "When threads are created using the dedicated Python APIs (such as the :mod:" "`threading` module), a thread state is automatically associated to them and " @@ -1089,7 +1275,7 @@ msgid "" "for them." msgstr "" -#: ../../c-api/init.rst:891 +#: ../../c-api/init.rst:1013 msgid "" "If you need to call Python code from these threads (often this will be part " "of a callback API provided by the aforementioned third-party library), you " @@ -1100,14 +1286,14 @@ msgid "" "finally free the thread state data structure." msgstr "" -#: ../../c-api/init.rst:899 +#: ../../c-api/init.rst:1021 msgid "" "The :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` functions " "do all of the above automatically. The typical idiom for calling into " "Python from a C thread is::" msgstr "" -#: ../../c-api/init.rst:903 +#: ../../c-api/init.rst:1025 msgid "" "PyGILState_STATE gstate;\n" "gstate = PyGILState_Ensure();\n" @@ -1120,7 +1306,7 @@ msgid "" "PyGILState_Release(gstate);" msgstr "" -#: ../../c-api/init.rst:913 +#: ../../c-api/init.rst:1035 msgid "" "Note that the ``PyGILState_*`` functions assume there is only one global " "interpreter (created automatically by :c:func:`Py_Initialize`). Python " @@ -1129,11 +1315,11 @@ msgid "" "``PyGILState_*`` API is unsupported." msgstr "" -#: ../../c-api/init.rst:923 +#: ../../c-api/init.rst:1045 msgid "Cautions about fork()" msgstr "" -#: ../../c-api/init.rst:925 +#: ../../c-api/init.rst:1047 msgid "" "Another important thing to note about threads is their behaviour in the face " "of the C :c:func:`fork` call. On most systems with :c:func:`fork`, after a " @@ -1142,7 +1328,7 @@ msgid "" "CPython's runtime." msgstr "" -#: ../../c-api/init.rst:931 +#: ../../c-api/init.rst:1053 msgid "" "The fact that only the \"current\" thread remains means any locks held by " "other threads will never be released. Python solves this for :func:`os.fork` " @@ -1159,7 +1345,7 @@ msgid "" "locks, but is not always able to." msgstr "" -#: ../../c-api/init.rst:946 +#: ../../c-api/init.rst:1068 msgid "" "The fact that all other threads go away also means that CPython's runtime " "state there must be cleaned up properly, which :func:`os.fork` does. This " @@ -1172,17 +1358,17 @@ msgid "" "called immediately after." msgstr "" -#: ../../c-api/init.rst:959 +#: ../../c-api/init.rst:1081 msgid "High-level API" msgstr "高階 API" -#: ../../c-api/init.rst:961 +#: ../../c-api/init.rst:1083 msgid "" "These are the most commonly used types and functions when writing C " "extension code, or when embedding the Python interpreter:" msgstr "" -#: ../../c-api/init.rst:966 +#: ../../c-api/init.rst:1088 msgid "" "This data structure represents the state shared by a number of cooperating " "threads. Threads belonging to the same interpreter share their module " @@ -1190,7 +1376,7 @@ msgid "" "in this structure." msgstr "" -#: ../../c-api/init.rst:971 +#: ../../c-api/init.rst:1093 msgid "" "Threads belonging to different interpreters initially share nothing, except " "process state like available memory, open file descriptors and such. The " @@ -1198,41 +1384,41 @@ msgid "" "which interpreter they belong." msgstr "" -#: ../../c-api/init.rst:979 +#: ../../c-api/init.rst:1101 msgid "" "This data structure represents the state of a single thread. The only " "public data member is:" msgstr "" -#: ../../c-api/init.rst:984 +#: ../../c-api/init.rst:1106 msgid "This thread's interpreter state." msgstr "" -#: ../../c-api/init.rst:995 +#: ../../c-api/init.rst:1117 msgid "Deprecated function which does nothing." msgstr "" -#: ../../c-api/init.rst:997 +#: ../../c-api/init.rst:1119 msgid "" "In Python 3.6 and older, this function created the GIL if it didn't exist." msgstr "" -#: ../../c-api/init.rst:999 +#: ../../c-api/init.rst:1121 msgid "The function now does nothing." msgstr "此函式現在不會做任何事情。" -#: ../../c-api/init.rst:1002 +#: ../../c-api/init.rst:1124 msgid "" "This function is now called by :c:func:`Py_Initialize()`, so you don't have " "to call it yourself anymore." msgstr "" -#: ../../c-api/init.rst:1006 +#: ../../c-api/init.rst:1128 msgid "" "This function cannot be called before :c:func:`Py_Initialize()` anymore." msgstr "" -#: ../../c-api/init.rst:1016 +#: ../../c-api/init.rst:1138 msgid "" "Release the global interpreter lock (if it has been created) and reset the " "thread state to ``NULL``, returning the previous thread state (which is not " @@ -1240,7 +1426,7 @@ msgid "" "acquired it." msgstr "" -#: ../../c-api/init.rst:1024 +#: ../../c-api/init.rst:1146 msgid "" "Acquire the global interpreter lock (if it has been created) and set the " "thread state to *tstate*, which must not be ``NULL``. If the lock has been " @@ -1248,8 +1434,8 @@ msgid "" "ensues." msgstr "" -#: ../../c-api/init.rst:1030 ../../c-api/init.rst:1089 -#: ../../c-api/init.rst:1371 +#: ../../c-api/init.rst:1152 ../../c-api/init.rst:1211 +#: ../../c-api/init.rst:1493 msgid "" "Calling this function from a thread when the runtime is finalizing will " "terminate the thread, even if the thread was not created by Python. You can " @@ -1258,44 +1444,44 @@ msgid "" "avoid unwanted termination." msgstr "" -#: ../../c-api/init.rst:1038 +#: ../../c-api/init.rst:1160 msgid "" "Return the current thread state. The global interpreter lock must be held. " "When the current thread state is ``NULL``, this issues a fatal error (so " "that the caller needn't check for ``NULL``)." msgstr "" -#: ../../c-api/init.rst:1042 +#: ../../c-api/init.rst:1164 msgid "See also :c:func:`PyThreadState_GetUnchecked`." msgstr "也請見 :c:func:`PyThreadState_GetUnchecked`。" -#: ../../c-api/init.rst:1047 +#: ../../c-api/init.rst:1169 msgid "" "Similar to :c:func:`PyThreadState_Get`, but don't kill the process with a " "fatal error if it is NULL. The caller is responsible to check if the result " "is NULL." msgstr "" -#: ../../c-api/init.rst:1051 +#: ../../c-api/init.rst:1173 msgid "" "In Python 3.5 to 3.12, the function was private and known as " "``_PyThreadState_UncheckedGet()``." msgstr "" -#: ../../c-api/init.rst:1058 +#: ../../c-api/init.rst:1180 msgid "" "Swap the current thread state with the thread state given by the argument " "*tstate*, which may be ``NULL``. The global interpreter lock must be held " "and is not released." msgstr "" -#: ../../c-api/init.rst:1063 +#: ../../c-api/init.rst:1185 msgid "" "The following functions use thread-local storage, and are not compatible " "with sub-interpreters:" msgstr "" -#: ../../c-api/init.rst:1068 +#: ../../c-api/init.rst:1190 msgid "" "Ensure that the current thread is ready to call the Python C API regardless " "of the current state of Python, or of the global interpreter lock. This may " @@ -1308,7 +1494,7 @@ msgid "" "is acceptable." msgstr "" -#: ../../c-api/init.rst:1078 +#: ../../c-api/init.rst:1200 msgid "" "The return value is an opaque \"handle\" to the thread state when :c:func:" "`PyGILState_Ensure` was called, and must be passed to :c:func:" @@ -1318,13 +1504,13 @@ msgid "" "func:`PyGILState_Release`." msgstr "" -#: ../../c-api/init.rst:1085 +#: ../../c-api/init.rst:1207 msgid "" "When the function returns, the current thread will hold the GIL and be able " "to call arbitrary Python code. Failure is a fatal error." msgstr "" -#: ../../c-api/init.rst:1097 +#: ../../c-api/init.rst:1219 msgid "" "Release any resources previously acquired. After this call, Python's state " "will be the same as it was prior to the corresponding :c:func:" @@ -1332,13 +1518,13 @@ msgid "" "caller, hence the use of the GILState API)." msgstr "" -#: ../../c-api/init.rst:1102 +#: ../../c-api/init.rst:1224 msgid "" "Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:" "func:`PyGILState_Release` on the same thread." msgstr "" -#: ../../c-api/init.rst:1108 +#: ../../c-api/init.rst:1230 msgid "" "Get the current thread state for this thread. May return ``NULL`` if no " "GILState API has been used on the current thread. Note that the main thread " @@ -1346,7 +1532,7 @@ msgid "" "made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -#: ../../c-api/init.rst:1116 +#: ../../c-api/init.rst:1238 msgid "" "Return ``1`` if the current thread is holding the GIL and ``0`` otherwise. " "This function can be called from any thread at any time. Only if it has had " @@ -1357,13 +1543,13 @@ msgid "" "otherwise behave differently." msgstr "" -#: ../../c-api/init.rst:1128 +#: ../../c-api/init.rst:1250 msgid "" "The following macros are normally used without a trailing semicolon; look " "for example usage in the Python source distribution." msgstr "" -#: ../../c-api/init.rst:1134 +#: ../../c-api/init.rst:1256 msgid "" "This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" "``. Note that it contains an opening brace; it must be matched with a " @@ -1371,7 +1557,7 @@ msgid "" "discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1142 +#: ../../c-api/init.rst:1264 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " "contains a closing brace; it must be matched with an earlier :c:macro:" @@ -1379,40 +1565,40 @@ msgid "" "macro." msgstr "" -#: ../../c-api/init.rst:1150 +#: ../../c-api/init.rst:1272 msgid "" "This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :" "c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" -#: ../../c-api/init.rst:1156 +#: ../../c-api/init.rst:1278 msgid "" "This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :" "c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " "declaration." msgstr "" -#: ../../c-api/init.rst:1162 +#: ../../c-api/init.rst:1284 msgid "Low-level API" msgstr "低階 API" -#: ../../c-api/init.rst:1164 +#: ../../c-api/init.rst:1286 msgid "" "All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:1166 +#: ../../c-api/init.rst:1288 msgid ":c:func:`Py_Initialize()` now initializes the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:1172 +#: ../../c-api/init.rst:1294 msgid "" "Create a new interpreter state object. The global interpreter lock need not " "be held, but may be held if it is necessary to serialize calls to this " "function." msgstr "" -#: ../../c-api/init.rst:1176 +#: ../../c-api/init.rst:1298 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_New`` with no arguments." @@ -1420,13 +1606,13 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_New``。" -#: ../../c-api/init.rst:1181 +#: ../../c-api/init.rst:1303 msgid "" "Reset all information in an interpreter state object. The global " "interpreter lock must be held." msgstr "" -#: ../../c-api/init.rst:1184 +#: ../../c-api/init.rst:1306 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_Clear`` with no arguments." @@ -1434,40 +1620,40 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_Clear``。" -#: ../../c-api/init.rst:1189 +#: ../../c-api/init.rst:1311 msgid "" "Destroy an interpreter state object. The global interpreter lock need not " "be held. The interpreter state must have been reset with a previous call " "to :c:func:`PyInterpreterState_Clear`." msgstr "" -#: ../../c-api/init.rst:1196 +#: ../../c-api/init.rst:1318 msgid "" "Create a new thread state object belonging to the given interpreter object. " "The global interpreter lock need not be held, but may be held if it is " "necessary to serialize calls to this function." msgstr "" -#: ../../c-api/init.rst:1203 +#: ../../c-api/init.rst:1325 msgid "" "Reset all information in a thread state object. The global interpreter lock " "must be held." msgstr "" -#: ../../c-api/init.rst:1206 +#: ../../c-api/init.rst:1328 msgid "" "This function now calls the :c:member:`PyThreadState.on_delete` callback. " "Previously, that happened in :c:func:`PyThreadState_Delete`." msgstr "" -#: ../../c-api/init.rst:1213 +#: ../../c-api/init.rst:1335 msgid "" "Destroy a thread state object. The global interpreter lock need not be " "held. The thread state must have been reset with a previous call to :c:func:" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1220 +#: ../../c-api/init.rst:1342 msgid "" "Destroy the current thread state and release the global interpreter lock. " "Like :c:func:`PyThreadState_Delete`, the global interpreter lock must be " @@ -1475,119 +1661,119 @@ msgid "" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1228 +#: ../../c-api/init.rst:1350 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1230 +#: ../../c-api/init.rst:1352 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: ../../c-api/init.rst:1233 +#: ../../c-api/init.rst:1355 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "也請見 :c:func:`PyEval_GetFrame`。" -#: ../../c-api/init.rst:1235 ../../c-api/init.rst:1244 -#: ../../c-api/init.rst:1253 +#: ../../c-api/init.rst:1357 ../../c-api/init.rst:1366 +#: ../../c-api/init.rst:1375 msgid "*tstate* must not be ``NULL``." msgstr "*tstate* 不可為 ``NULL``。" -#: ../../c-api/init.rst:1242 +#: ../../c-api/init.rst:1364 msgid "" "Get the unique thread state identifier of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1251 +#: ../../c-api/init.rst:1373 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1260 +#: ../../c-api/init.rst:1382 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1262 +#: ../../c-api/init.rst:1384 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -#: ../../c-api/init.rst:1269 +#: ../../c-api/init.rst:1391 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -#: ../../c-api/init.rst:1272 +#: ../../c-api/init.rst:1394 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -#: ../../c-api/init.rst:1280 +#: ../../c-api/init.rst:1402 msgid "Get the current interpreter." msgstr "" -#: ../../c-api/init.rst:1282 +#: ../../c-api/init.rst:1404 msgid "" "Issue a fatal error if there no current Python thread state or no current " "interpreter. It cannot return NULL." msgstr "" -#: ../../c-api/init.rst:1285 ../../c-api/init.rst:1295 +#: ../../c-api/init.rst:1407 ../../c-api/init.rst:1417 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/init.rst:1292 +#: ../../c-api/init.rst:1414 msgid "" "Return the interpreter's unique ID. If there was any error in doing so then " "``-1`` is returned and an error is set." msgstr "" -#: ../../c-api/init.rst:1302 +#: ../../c-api/init.rst:1424 msgid "" "Return a dictionary in which interpreter-specific data may be stored. If " "this function returns ``NULL`` then no exception has been raised and the " "caller should assume no interpreter-specific dict is available." msgstr "" -#: ../../c-api/init.rst:1306 +#: ../../c-api/init.rst:1428 msgid "" "This is not a replacement for :c:func:`PyModule_GetState()`, which " "extensions should use to store interpreter-specific state information." msgstr "" -#: ../../c-api/init.rst:1313 +#: ../../c-api/init.rst:1435 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1315 +#: ../../c-api/init.rst:1437 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1318 +#: ../../c-api/init.rst:1440 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1321 +#: ../../c-api/init.rst:1443 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: ../../c-api/init.rst:1326 +#: ../../c-api/init.rst:1448 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1328 ../../c-api/init.rst:1336 +#: ../../c-api/init.rst:1450 ../../c-api/init.rst:1458 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1334 +#: ../../c-api/init.rst:1456 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1343 +#: ../../c-api/init.rst:1465 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " @@ -1596,7 +1782,7 @@ msgid "" "raised and the caller should assume no current thread state is available." msgstr "" -#: ../../c-api/init.rst:1352 +#: ../../c-api/init.rst:1474 msgid "" "Asynchronously raise an exception in a thread. The *id* argument is the " "thread id of the target thread; *exc* is the exception object to be raised. " @@ -1608,33 +1794,33 @@ msgid "" "raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1360 +#: ../../c-api/init.rst:1482 msgid "" "The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" "`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1366 +#: ../../c-api/init.rst:1488 msgid "" "Acquire the global interpreter lock and set the current thread state to " "*tstate*, which must not be ``NULL``. The lock must have been created " "earlier. If this thread already has the lock, deadlock ensues." msgstr "" -#: ../../c-api/init.rst:1377 +#: ../../c-api/init.rst:1499 msgid "" "Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" "`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " "current thread if called while the interpreter is finalizing." msgstr "" -#: ../../c-api/init.rst:1382 +#: ../../c-api/init.rst:1504 msgid "" ":c:func:`PyEval_RestoreThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1388 +#: ../../c-api/init.rst:1510 msgid "" "Reset the current thread state to ``NULL`` and release the global " "interpreter lock. The lock must have been created earlier and must be held " @@ -1643,17 +1829,17 @@ msgid "" "isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1394 +#: ../../c-api/init.rst:1516 msgid "" ":c:func:`PyEval_SaveThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1401 +#: ../../c-api/init.rst:1523 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1403 +#: ../../c-api/init.rst:1525 msgid "" "While in most uses, you will only embed a single Python interpreter, there " "are cases where you need to create several independent interpreters in the " @@ -1661,7 +1847,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1408 +#: ../../c-api/init.rst:1530 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -1672,31 +1858,31 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1415 +#: ../../c-api/init.rst:1537 msgid "" "You can switch between sub-interpreters using the :c:func:" "`PyThreadState_Swap` function. You can create and destroy them using the " "following functions:" msgstr "" -#: ../../c-api/init.rst:1421 +#: ../../c-api/init.rst:1543 msgid "" "Structure containing most parameters to configure a sub-interpreter. Its " "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " "modified by the runtime." msgstr "" -#: ../../c-api/init.rst:1427 +#: ../../c-api/init.rst:1549 msgid "Structure fields:" msgstr "" -#: ../../c-api/init.rst:1431 +#: ../../c-api/init.rst:1553 msgid "" "If this is ``0`` then the sub-interpreter will use its own \"object\" " "allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" -#: ../../c-api/init.rst:1435 +#: ../../c-api/init.rst:1557 msgid "" "If this is ``0`` then :c:member:`~PyInterpreterConfig." "check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " @@ -1704,44 +1890,44 @@ msgid "" "`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: ../../c-api/init.rst:1443 +#: ../../c-api/init.rst:1565 msgid "" "If this is ``0`` then the runtime will not support forking the process in " "any thread where the sub-interpreter is currently active. Otherwise fork is " "unrestricted." msgstr "" -#: ../../c-api/init.rst:1447 +#: ../../c-api/init.rst:1569 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: ../../c-api/init.rst:1452 +#: ../../c-api/init.rst:1574 msgid "" "If this is ``0`` then the runtime will not support replacing the current " "process via exec (e.g. :func:`os.execv`) in any thread where the sub-" "interpreter is currently active. Otherwise exec is unrestricted." msgstr "" -#: ../../c-api/init.rst:1457 +#: ../../c-api/init.rst:1579 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: ../../c-api/init.rst:1462 +#: ../../c-api/init.rst:1584 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create threads. Otherwise threads are allowed." msgstr "" -#: ../../c-api/init.rst:1468 +#: ../../c-api/init.rst:1590 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create daemon threads. Otherwise daemon threads are allowed (as long as :c:" "member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" -#: ../../c-api/init.rst:1475 +#: ../../c-api/init.rst:1597 msgid "" "If this is ``0`` then all extension modules may be imported, including " "legacy (single-phase init) modules, in any thread where the sub-interpreter " @@ -1750,37 +1936,37 @@ msgid "" "`Py_mod_multiple_interpreters`.)" msgstr "" -#: ../../c-api/init.rst:1482 +#: ../../c-api/init.rst:1604 msgid "" "This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." "use_main_obmalloc` is ``0``." msgstr "" -#: ../../c-api/init.rst:1487 +#: ../../c-api/init.rst:1609 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: ../../c-api/init.rst:1494 +#: ../../c-api/init.rst:1616 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: ../../c-api/init.rst:1498 +#: ../../c-api/init.rst:1620 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: ../../c-api/init.rst:1502 +#: ../../c-api/init.rst:1624 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: ../../c-api/init.rst:1504 +#: ../../c-api/init.rst:1626 msgid "" "If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" "`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: ../../c-api/init.rst:1518 +#: ../../c-api/init.rst:1640 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " @@ -1793,13 +1979,13 @@ msgid "" "underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1528 +#: ../../c-api/init.rst:1650 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: ../../c-api/init.rst:1531 +#: ../../c-api/init.rst:1653 msgid "" "Upon success, *tstate_p* will be set to the first thread state created in " "the new sub-interpreter. This thread state is made in the current thread " @@ -1810,7 +1996,7 @@ msgid "" "state." msgstr "" -#: ../../c-api/init.rst:1540 +#: ../../c-api/init.rst:1662 msgid "" "Like all other Python/C API functions, the global interpreter lock must be " "held before calling this function and is still held when it returns. " @@ -1822,13 +2008,13 @@ msgid "" "released here." msgstr "" -#: ../../c-api/init.rst:1551 +#: ../../c-api/init.rst:1673 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: ../../c-api/init.rst:1554 +#: ../../c-api/init.rst:1676 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -1852,7 +2038,7 @@ msgstr "" "};\n" "PyThreadState *tstate = Py_NewInterpreterFromConfig(&config);" -#: ../../c-api/init.rst:1565 +#: ../../c-api/init.rst:1687 msgid "" "Note that the config is used only briefly and does not get modified. During " "initialization the config's values are converted into various :c:type:" @@ -1860,11 +2046,11 @@ msgid "" "internally on the :c:type:`PyInterpreterState`." msgstr "" -#: ../../c-api/init.rst:1574 +#: ../../c-api/init.rst:1696 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1576 +#: ../../c-api/init.rst:1698 msgid "" "For modules using multi-phase initialization, e.g. :c:func:" "`PyModule_FromDefAndSpec`, a separate module object is created and " @@ -1872,7 +2058,7 @@ msgid "" "are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1582 +#: ../../c-api/init.rst:1704 msgid "" "For modules using single-phase initialization, e.g. :c:func:" "`PyModule_Create`, the first time a particular extension is imported, it is " @@ -1884,7 +2070,7 @@ msgid "" "might cause unwanted behavior (see `Bugs and caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1593 +#: ../../c-api/init.rst:1715 msgid "" "Note that this is different from what happens when an extension is imported " "after the interpreter has been completely re-initialized by calling :c:func:" @@ -1894,7 +2080,7 @@ msgid "" "shared between these modules." msgstr "" -#: ../../c-api/init.rst:1613 +#: ../../c-api/init.rst:1735 msgid "" "Create a new sub-interpreter. This is essentially just a wrapper around :c:" "func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " @@ -1903,7 +2089,7 @@ msgid "" "single-phase init modules." msgstr "" -#: ../../c-api/init.rst:1625 +#: ../../c-api/init.rst:1747 msgid "" "Destroy the (sub-)interpreter represented by the given thread state. The " "given thread state must be the current thread state. See the discussion of " @@ -1913,17 +2099,17 @@ msgid "" "be held before calling this function. No GIL is held when it returns." msgstr "" -#: ../../c-api/init.rst:1633 +#: ../../c-api/init.rst:1755 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: ../../c-api/init.rst:1638 +#: ../../c-api/init.rst:1760 msgid "A Per-Interpreter GIL" msgstr "" -#: ../../c-api/init.rst:1640 +#: ../../c-api/init.rst:1762 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -1935,7 +2121,7 @@ msgid "" "just using threads. (See :pep:`554`.)" msgstr "" -#: ../../c-api/init.rst:1650 +#: ../../c-api/init.rst:1772 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -1949,7 +2135,7 @@ msgid "" "builtin objects." msgstr "" -#: ../../c-api/init.rst:1661 +#: ../../c-api/init.rst:1783 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -1957,7 +2143,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: ../../c-api/init.rst:1666 +#: ../../c-api/init.rst:1788 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -1967,11 +2153,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: ../../c-api/init.rst:1677 +#: ../../c-api/init.rst:1799 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1679 +#: ../../c-api/init.rst:1801 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -1984,7 +2170,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:1811 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -1993,7 +2179,7 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1695 +#: ../../c-api/init.rst:1817 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " @@ -2005,25 +2191,25 @@ msgid "" "created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1706 +#: ../../c-api/init.rst:1828 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1708 +#: ../../c-api/init.rst:1830 msgid "" "A mechanism is provided to make asynchronous notifications to the main " "interpreter thread. These notifications take the form of a function pointer " "and a void pointer argument." msgstr "" -#: ../../c-api/init.rst:1715 +#: ../../c-api/init.rst:1837 msgid "" "Schedule a function to be called from the main interpreter thread. On " "success, ``0`` is returned and *func* is queued for being called in the main " "thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -#: ../../c-api/init.rst:1719 +#: ../../c-api/init.rst:1841 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2031,17 +2217,17 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1724 +#: ../../c-api/init.rst:1846 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1725 +#: ../../c-api/init.rst:1847 msgid "" "with the main thread holding the :term:`global interpreter lock` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1728 +#: ../../c-api/init.rst:1850 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " @@ -2049,20 +2235,20 @@ msgid "" "if the global interpreter lock is released." msgstr "" -#: ../../c-api/init.rst:1733 +#: ../../c-api/init.rst:1855 msgid "" "This function doesn't need a current thread state to run, and it doesn't " "need the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:1736 +#: ../../c-api/init.rst:1858 msgid "" "To call this function in a subinterpreter, the caller must hold the GIL. " "Otherwise, the function *func* can be scheduled to be called from the wrong " "interpreter." msgstr "" -#: ../../c-api/init.rst:1741 +#: ../../c-api/init.rst:1863 msgid "" "This is a low-level function, only useful for very special cases. There is " "no guarantee that *func* will be called as quick as possible. If the main " @@ -2072,7 +2258,7 @@ msgid "" "`PyGILState API`." msgstr "" -#: ../../c-api/init.rst:1750 +#: ../../c-api/init.rst:1872 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " @@ -2080,18 +2266,18 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:1759 +#: ../../c-api/init.rst:1881 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:1764 +#: ../../c-api/init.rst:1886 msgid "" "The Python interpreter provides some low-level support for attaching " "profiling and execution tracing facilities. These are used for profiling, " "debugging, and coverage analysis tools." msgstr "" -#: ../../c-api/init.rst:1768 +#: ../../c-api/init.rst:1890 msgid "" "This C interface allows the profiling or tracing code to avoid the overhead " "of calling through Python-level callable objects, making a direct C function " @@ -2101,7 +2287,7 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:1778 +#: ../../c-api/init.rst:1900 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " @@ -2113,66 +2299,66 @@ msgid "" "value of *what*:" msgstr "" -#: ../../c-api/init.rst:1787 +#: ../../c-api/init.rst:1909 msgid "Value of *what*" msgstr "" -#: ../../c-api/init.rst:1787 +#: ../../c-api/init.rst:1909 msgid "Meaning of *arg*" msgstr "*arg* 的含義" -#: ../../c-api/init.rst:1789 +#: ../../c-api/init.rst:1911 msgid ":c:data:`PyTrace_CALL`" msgstr ":c:data:`PyTrace_CALL`" -#: ../../c-api/init.rst:1789 ../../c-api/init.rst:1794 -#: ../../c-api/init.rst:1805 +#: ../../c-api/init.rst:1911 ../../c-api/init.rst:1916 +#: ../../c-api/init.rst:1927 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:1791 +#: ../../c-api/init.rst:1913 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr ":c:data:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:1791 +#: ../../c-api/init.rst:1913 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:1794 +#: ../../c-api/init.rst:1916 msgid ":c:data:`PyTrace_LINE`" msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:1796 +#: ../../c-api/init.rst:1918 msgid ":c:data:`PyTrace_RETURN`" msgstr ":c:data:`PyTrace_RETURN`" -#: ../../c-api/init.rst:1796 +#: ../../c-api/init.rst:1918 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:1799 +#: ../../c-api/init.rst:1921 msgid ":c:data:`PyTrace_C_CALL`" msgstr ":c:data:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:1799 ../../c-api/init.rst:1801 -#: ../../c-api/init.rst:1803 +#: ../../c-api/init.rst:1921 ../../c-api/init.rst:1923 +#: ../../c-api/init.rst:1925 msgid "Function object being called." msgstr "被呼叫的函式物件。" -#: ../../c-api/init.rst:1801 +#: ../../c-api/init.rst:1923 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:1803 +#: ../../c-api/init.rst:1925 msgid ":c:data:`PyTrace_C_RETURN`" msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:1805 +#: ../../c-api/init.rst:1927 msgid ":c:data:`PyTrace_OPCODE`" msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:1810 +#: ../../c-api/init.rst:1932 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -2181,7 +2367,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:1819 +#: ../../c-api/init.rst:1941 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "an exception has been raised. The callback function is called with this " @@ -2193,7 +2379,7 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:1830 +#: ../../c-api/init.rst:1952 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " @@ -2201,31 +2387,31 @@ msgid "" "f_trace_lines` to *0* on that frame." msgstr "" -#: ../../c-api/init.rst:1838 +#: ../../c-api/init.rst:1960 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a call is about to return." msgstr "" -#: ../../c-api/init.rst:1844 +#: ../../c-api/init.rst:1966 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function is about to be called." msgstr "" -#: ../../c-api/init.rst:1850 +#: ../../c-api/init.rst:1972 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has raised an exception." msgstr "" -#: ../../c-api/init.rst:1856 +#: ../../c-api/init.rst:1978 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:1862 +#: ../../c-api/init.rst:1984 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " @@ -2233,7 +2419,7 @@ msgid "" "attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:1870 +#: ../../c-api/init.rst:1992 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " @@ -2243,29 +2429,29 @@ msgid "" "`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:1877 +#: ../../c-api/init.rst:1999 msgid "See also the :func:`sys.setprofile` function." msgstr "" -#: ../../c-api/init.rst:1879 ../../c-api/init.rst:1886 -#: ../../c-api/init.rst:1905 ../../c-api/init.rst:1912 +#: ../../c-api/init.rst:2001 ../../c-api/init.rst:2008 +#: ../../c-api/init.rst:2027 ../../c-api/init.rst:2034 msgid "The caller must hold the :term:`GIL`." msgstr "呼叫者必須持有 :term:`GIL`。" -#: ../../c-api/init.rst:1883 +#: ../../c-api/init.rst:2005 msgid "" "Like :c:func:`PyEval_SetProfile` but sets the profile function in all " "running threads belonging to the current interpreter instead of the setting " "it only on the current thread." msgstr "" -#: ../../c-api/init.rst:1888 +#: ../../c-api/init.rst:2010 msgid "" "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " "while setting the profile functions in all threads." msgstr "" -#: ../../c-api/init.rst:1896 +#: ../../c-api/init.rst:2018 msgid "" "Set the tracing function to *func*. This is similar to :c:func:" "`PyEval_SetProfile`, except the tracing function does receive line-number " @@ -2276,28 +2462,28 @@ msgid "" "*what* parameter." msgstr "" -#: ../../c-api/init.rst:1903 +#: ../../c-api/init.rst:2025 msgid "See also the :func:`sys.settrace` function." msgstr "也請見 :func:`sys.settrace` 函式。" -#: ../../c-api/init.rst:1909 +#: ../../c-api/init.rst:2031 msgid "" "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " "threads belonging to the current interpreter instead of the setting it only " "on the current thread." msgstr "" -#: ../../c-api/init.rst:1914 +#: ../../c-api/init.rst:2036 msgid "" "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " "while setting the trace functions in all threads." msgstr "" -#: ../../c-api/init.rst:1920 +#: ../../c-api/init.rst:2042 msgid "Reference tracing" msgstr "" -#: ../../c-api/init.rst:1926 +#: ../../c-api/init.rst:2048 msgid "" "The type of the trace function registered using :c:func:" "`PyRefTracer_SetTracer`. The first parameter is a Python object that has " @@ -2307,19 +2493,19 @@ msgid "" "provided when :c:func:`PyRefTracer_SetTracer` was called." msgstr "" -#: ../../c-api/init.rst:1936 +#: ../../c-api/init.rst:2058 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been created." msgstr "" -#: ../../c-api/init.rst:1941 +#: ../../c-api/init.rst:2063 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been destroyed." msgstr "" -#: ../../c-api/init.rst:1946 +#: ../../c-api/init.rst:2068 msgid "" "Register a reference tracer function. The function will be called when a new " "Python has been created or when an object is going to be destroyed. If " @@ -2328,7 +2514,7 @@ msgid "" "return ``-1`` on error." msgstr "" -#: ../../c-api/init.rst:1952 +#: ../../c-api/init.rst:2074 msgid "" "Not that tracer functions **must not** create Python objects inside or " "otherwise the call will be re-entrant. The tracer also **must not** clear " @@ -2336,11 +2522,11 @@ msgid "" "the tracer function is called." msgstr "" -#: ../../c-api/init.rst:1957 ../../c-api/init.rst:1968 +#: ../../c-api/init.rst:2079 ../../c-api/init.rst:2090 msgid "The GIL must be held when calling this function." msgstr "" -#: ../../c-api/init.rst:1963 +#: ../../c-api/init.rst:2085 msgid "" "Get the registered reference tracer function and the value of the opaque " "data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " @@ -2348,48 +2534,48 @@ msgid "" "set the **data** pointer to NULL." msgstr "" -#: ../../c-api/init.rst:1975 +#: ../../c-api/init.rst:2097 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:1980 +#: ../../c-api/init.rst:2102 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:1985 +#: ../../c-api/init.rst:2107 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:1990 +#: ../../c-api/init.rst:2112 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:1995 +#: ../../c-api/init.rst:2117 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:2001 +#: ../../c-api/init.rst:2123 msgid "" "Return the pointer to the first :c:type:`PyThreadState` object in the list " "of threads associated with the interpreter *interp*." msgstr "" -#: ../../c-api/init.rst:2007 +#: ../../c-api/init.rst:2129 msgid "" "Return the next thread state object after *tstate* from the list of all such " "objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" -#: ../../c-api/init.rst:2014 +#: ../../c-api/init.rst:2136 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:2018 +#: ../../c-api/init.rst:2140 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2399,19 +2585,19 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:2025 +#: ../../c-api/init.rst:2147 msgid "" "The GIL does *not* need to be held when calling these functions; they supply " "their own locking." msgstr "" -#: ../../c-api/init.rst:2028 +#: ../../c-api/init.rst:2150 msgid "" "Note that :file:`Python.h` does not include the declaration of the TLS APIs, " "you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -#: ../../c-api/init.rst:2032 +#: ../../c-api/init.rst:2154 msgid "" "None of these API functions handle memory management on behalf of the :c:" "expr:`void*` values. You need to allocate and deallocate them yourself. If " @@ -2419,22 +2605,22 @@ msgid "" "don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:2040 +#: ../../c-api/init.rst:2162 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:2042 +#: ../../c-api/init.rst:2164 msgid "" "TSS API is introduced to supersede the use of the existing TLS API within " "the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` " "instead of :c:expr:`int` to represent thread keys." msgstr "" -#: ../../c-api/init.rst:2048 +#: ../../c-api/init.rst:2170 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:2053 +#: ../../c-api/init.rst:2175 msgid "" "This data structure represents the state of a thread key, the definition of " "which may depend on the underlying TLS implementation, and it has an " @@ -2442,52 +2628,52 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:2058 +#: ../../c-api/init.rst:2180 msgid "" "When :ref:`Py_LIMITED_API ` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -#: ../../c-api/init.rst:2064 +#: ../../c-api/init.rst:2186 msgid "" "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " "that this macro won't be defined with :ref:`Py_LIMITED_API `." msgstr "" -#: ../../c-api/init.rst:2069 +#: ../../c-api/init.rst:2191 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:2071 +#: ../../c-api/init.rst:2193 msgid "" "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " "built with :ref:`Py_LIMITED_API `, where static allocation of this " "type is not possible due to its implementation being opaque at build time." msgstr "" -#: ../../c-api/init.rst:2078 +#: ../../c-api/init.rst:2200 msgid "" "Return a value which is the same state as a value initialized with :c:macro:" "`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." msgstr "" -#: ../../c-api/init.rst:2085 +#: ../../c-api/init.rst:2207 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" -#: ../../c-api/init.rst:2091 +#: ../../c-api/init.rst:2213 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: ../../c-api/init.rst:2096 +#: ../../c-api/init.rst:2218 msgid "Methods" msgstr "方法" -#: ../../c-api/init.rst:2098 +#: ../../c-api/init.rst:2220 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " @@ -2495,13 +2681,13 @@ msgid "" "func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2106 +#: ../../c-api/init.rst:2228 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2112 +#: ../../c-api/init.rst:2234 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -2510,7 +2696,7 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:2121 +#: ../../c-api/init.rst:2243 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " @@ -2519,31 +2705,31 @@ msgid "" "key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:2130 +#: ../../c-api/init.rst:2252 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" -#: ../../c-api/init.rst:2137 +#: ../../c-api/init.rst:2259 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" -#: ../../c-api/init.rst:2145 +#: ../../c-api/init.rst:2267 msgid "Thread Local Storage (TLS) API" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../c-api/init.rst:2147 +#: ../../c-api/init.rst:2269 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API `." msgstr "" -#: ../../c-api/init.rst:2152 +#: ../../c-api/init.rst:2274 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -2552,62 +2738,62 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:2157 +#: ../../c-api/init.rst:2279 msgid "" "Due to the compatibility problem noted above, this version of the API should " "not be used in new code." msgstr "" -#: ../../c-api/init.rst:2168 +#: ../../c-api/init.rst:2290 msgid "Synchronization Primitives" msgstr "" -#: ../../c-api/init.rst:2170 +#: ../../c-api/init.rst:2292 msgid "The C-API provides a basic mutual exclusion lock." msgstr "" -#: ../../c-api/init.rst:2174 +#: ../../c-api/init.rst:2296 msgid "" "A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " "zero to represent the unlocked state. For example::" msgstr "" -#: ../../c-api/init.rst:2177 +#: ../../c-api/init.rst:2299 msgid "PyMutex mutex = {0};" msgstr "" -#: ../../c-api/init.rst:2179 +#: ../../c-api/init.rst:2301 msgid "" "Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " "contents and address of a :c:type:`!PyMutex` are meaningful, and it must " "remain at a fixed, writable location in memory." msgstr "" -#: ../../c-api/init.rst:2185 +#: ../../c-api/init.rst:2307 msgid "" "A :c:type:`!PyMutex` currently occupies one byte, but the size should be " "considered unstable. The size may change in future Python releases without " "a deprecation period." msgstr "" -#: ../../c-api/init.rst:2193 +#: ../../c-api/init.rst:2315 msgid "" "Lock mutex *m*. If another thread has already locked it, the calling thread " "will block until the mutex is unlocked. While blocked, the thread will " "temporarily release the :term:`GIL` if it is held." msgstr "" -#: ../../c-api/init.rst:2201 +#: ../../c-api/init.rst:2323 msgid "" "Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " "issue a fatal error." msgstr "" -#: ../../c-api/init.rst:2209 +#: ../../c-api/init.rst:2331 msgid "Python Critical Section API" msgstr "" -#: ../../c-api/init.rst:2211 +#: ../../c-api/init.rst:2333 msgid "" "The critical section API provides a deadlock avoidance layer on top of per-" "object locks for :term:`free-threaded ` CPython. They are " @@ -2615,7 +2801,7 @@ msgid "" "no-ops in versions of Python with the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:2216 +#: ../../c-api/init.rst:2338 msgid "" "Critical sections avoid deadlocks by implicitly suspending active critical " "sections and releasing the locks during calls to :c:func:" @@ -2625,7 +2811,7 @@ msgid "" "-- they are useful because their behavior is similar to the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:2223 +#: ../../c-api/init.rst:2345 msgid "" "The functions and structs used by the macros are exposed for cases where C " "macros are not available. They should only be used as in the given macro " @@ -2633,7 +2819,7 @@ msgid "" "future Python versions." msgstr "" -#: ../../c-api/init.rst:2230 +#: ../../c-api/init.rst:2352 msgid "" "Operations that need to lock two objects at once must use :c:macro:" "`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " @@ -2642,11 +2828,11 @@ msgid "" "lock more than two objects at once." msgstr "" -#: ../../c-api/init.rst:2236 +#: ../../c-api/init.rst:2358 msgid "Example usage::" msgstr "" -#: ../../c-api/init.rst:2238 +#: ../../c-api/init.rst:2360 msgid "" "static PyObject *\n" "set_field(MyObject *self, PyObject *value)\n" @@ -2658,7 +2844,7 @@ msgid "" "}" msgstr "" -#: ../../c-api/init.rst:2247 +#: ../../c-api/init.rst:2369 msgid "" "In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " "can call arbitrary code through an object's deallocation function. The " @@ -2668,248 +2854,215 @@ msgid "" "`PyEval_SaveThread`." msgstr "" -#: ../../c-api/init.rst:2255 +#: ../../c-api/init.rst:2377 msgid "" "Acquires the per-object lock for the object *op* and begins a critical " "section." msgstr "" -#: ../../c-api/init.rst:2258 ../../c-api/init.rst:2272 -#: ../../c-api/init.rst:2287 ../../c-api/init.rst:2301 +#: ../../c-api/init.rst:2380 ../../c-api/init.rst:2394 +#: ../../c-api/init.rst:2409 ../../c-api/init.rst:2423 msgid "In the free-threaded build, this macro expands to::" msgstr "" -#: ../../c-api/init.rst:2260 +#: ../../c-api/init.rst:2382 msgid "" "{\n" " PyCriticalSection _py_cs;\n" " PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" msgstr "" -#: ../../c-api/init.rst:2264 ../../c-api/init.rst:2293 +#: ../../c-api/init.rst:2386 ../../c-api/init.rst:2415 msgid "In the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2270 +#: ../../c-api/init.rst:2392 msgid "Ends the critical section and releases the per-object lock." msgstr "" -#: ../../c-api/init.rst:2274 +#: ../../c-api/init.rst:2396 msgid "" " PyCriticalSection_End(&_py_cs);\n" "}" msgstr "" -#: ../../c-api/init.rst:2277 ../../c-api/init.rst:2306 +#: ../../c-api/init.rst:2399 ../../c-api/init.rst:2428 msgid "In the default build, this macro expands to ``}``." msgstr "" -#: ../../c-api/init.rst:2283 +#: ../../c-api/init.rst:2405 msgid "" "Acquires the per-objects locks for the objects *a* and *b* and begins a " "critical section. The locks are acquired in a consistent order (lowest " "address first) to avoid lock ordering deadlocks." msgstr "" -#: ../../c-api/init.rst:2289 +#: ../../c-api/init.rst:2411 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection_Begin2(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" msgstr "" -#: ../../c-api/init.rst:2299 +#: ../../c-api/init.rst:2421 msgid "Ends the critical section and releases the per-object locks." msgstr "" -#: ../../c-api/init.rst:2303 +#: ../../c-api/init.rst:2425 msgid "" " PyCriticalSection_End2(&_py_cs2);\n" "}" msgstr "" -#: ../../c-api/init.rst:335 +#: ../../c-api/init.rst:350 msgid "PyEval_InitThreads()" msgstr "PyEval_InitThreads()" -#: ../../c-api/init.rst:335 +#: ../../c-api/init.rst:350 msgid "modules (in module sys)" msgstr "modules(sys 模組中)" -#: ../../c-api/init.rst:335 ../../c-api/init.rst:576 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:698 msgid "path (in module sys)" msgstr "path(sys 模組中)" -#: ../../c-api/init.rst:335 ../../c-api/init.rst:576 ../../c-api/init.rst:1011 -#: ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:698 ../../c-api/init.rst:1133 +#: ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 msgid "module" msgstr "模組" -#: ../../c-api/init.rst:335 ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/init.rst:335 ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 msgid "__main__" msgstr "__main__" -#: ../../c-api/init.rst:335 ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 msgid "sys" msgstr "sys" -#: ../../c-api/init.rst:335 ../../c-api/init.rst:576 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:698 msgid "search" msgstr "search(搜尋)" -#: ../../c-api/init.rst:335 ../../c-api/init.rst:576 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:698 msgid "path" msgstr "path(路徑)" -#: ../../c-api/init.rst:335 ../../c-api/init.rst:1570 ../../c-api/init.rst:1623 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1692 ../../c-api/init.rst:1745 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" -#: ../../c-api/init.rst:445 +#: ../../c-api/init.rst:567 msgid "Py_Initialize()" msgstr "Py_Initialize()" -#: ../../c-api/init.rst:445 ../../c-api/init.rst:674 +#: ../../c-api/init.rst:567 ../../c-api/init.rst:796 msgid "main()" msgstr "main()" -#: ../../c-api/init.rst:445 +#: ../../c-api/init.rst:567 msgid "Py_GetPath()" msgstr "Py_GetPath()" -#: ../../c-api/init.rst:555 +#: ../../c-api/init.rst:677 msgid "executable (in module sys)" msgstr "executable(sys 模組中)" -#: ../../c-api/init.rst:609 ../../c-api/init.rst:651 ../../c-api/init.rst:665 +#: ../../c-api/init.rst:731 ../../c-api/init.rst:773 ../../c-api/init.rst:787 msgid "version (in module sys)" msgstr "version(sys 模組中)" -#: ../../c-api/init.rst:621 +#: ../../c-api/init.rst:743 msgid "platform (in module sys)" msgstr "platform(sys 模組中)" -#: ../../c-api/init.rst:638 +#: ../../c-api/init.rst:760 msgid "copyright (in module sys)" msgstr "copyright(sys 模組中)" -#: ../../c-api/init.rst:674 +#: ../../c-api/init.rst:796 msgid "Py_FatalError()" msgstr "Py_FatalError()" -#: ../../c-api/init.rst:674 +#: ../../c-api/init.rst:796 msgid "argv (in module sys)" msgstr "argv(sys 模組中)" -#: ../../c-api/init.rst:794 +#: ../../c-api/init.rst:916 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../c-api/init.rst:794 +#: ../../c-api/init.rst:916 msgid "interpreter lock" msgstr "interpreter lock(直譯器鎖)" -#: ../../c-api/init.rst:794 +#: ../../c-api/init.rst:916 msgid "lock, interpreter" msgstr "lock, interpreter(鎖、直譯器)" -#: ../../c-api/init.rst:807 +#: ../../c-api/init.rst:929 msgid "setswitchinterval (in module sys)" msgstr "setswitchinterval (sys 模組中)" -#: ../../c-api/init.rst:816 +#: ../../c-api/init.rst:938 msgid "PyThreadState (C type)" msgstr "PyThreadState(C 型別)" -#: ../../c-api/init.rst:842 +#: ../../c-api/init.rst:964 msgid "Py_BEGIN_ALLOW_THREADS (C macro)" msgstr "Py_BEGIN_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:842 +#: ../../c-api/init.rst:964 msgid "Py_END_ALLOW_THREADS (C macro)" msgstr "Py_END_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:858 +#: ../../c-api/init.rst:980 msgid "PyEval_RestoreThread (C function)" msgstr "PyEval_RestoreThread(C 函式)" -#: ../../c-api/init.rst:858 +#: ../../c-api/init.rst:980 msgid "PyEval_SaveThread (C function)" msgstr "PyEval_SaveThread(C 函式)" -#: ../../c-api/init.rst:989 +#: ../../c-api/init.rst:1111 msgid "PyEval_AcquireThread()" msgstr "PyEval_AcquireThread()" -#: ../../c-api/init.rst:989 +#: ../../c-api/init.rst:1111 msgid "PyEval_ReleaseThread()" msgstr "PyEval_ReleaseThread()" -#: ../../c-api/init.rst:989 +#: ../../c-api/init.rst:1111 msgid "PyEval_SaveThread()" msgstr "PyEval_SaveThread()" -#: ../../c-api/init.rst:989 +#: ../../c-api/init.rst:1111 msgid "PyEval_RestoreThread()" msgstr "PyEval_RestoreThread()" -#: ../../c-api/init.rst:1011 +#: ../../c-api/init.rst:1133 msgid "_thread" msgstr "_thread" -#: ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 +#: ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 msgid "stdout (in module sys)" msgstr "stdout(sys 模組中)" -#: ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 +#: ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 msgid "stderr (in module sys)" msgstr "stderr(sys 模組中)" -#: ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 +#: ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 msgid "stdin (in module sys)" msgstr "stdin(sys 模組中)" -#: ../../c-api/init.rst:1570 +#: ../../c-api/init.rst:1692 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/init.rst:1600 +#: ../../c-api/init.rst:1722 msgid "close (in module os)" msgstr "close(os 模組中)" - -#~ msgid ":c:func:`Py_SetPath`" -#~ msgstr ":c:func:`Py_SetPath`" - -#~ msgid ":c:func:`Py_SetStandardStreamEncoding`" -#~ msgstr ":c:func:`Py_SetStandardStreamEncoding`" - -#~ msgid ":c:func:`PySys_AddWarnOption`" -#~ msgstr ":c:func:`PySys_AddWarnOption`" - -#~ msgid ":c:func:`PySys_AddXOption`" -#~ msgstr ":c:func:`PySys_AddXOption`" - -#~ msgid "Py_SetProgramName()" -#~ msgstr "Py_SetProgramName()" - -#~ msgid "PySys_SetArgv (C function)" -#~ msgstr "PySys_SetArgv(C 函式)" - -#~ msgid "PySys_SetArgvEx (C function)" -#~ msgstr "PySys_SetArgvEx(C 函式)" - -#~ msgid "stdin" -#~ msgstr "stdin" - -#~ msgid "stdout" -#~ msgstr "stdout" - -#~ msgid "sdterr" -#~ msgstr "sdterr" - -#~ msgid "Py_SetPath()" -#~ msgstr "Py_SetPath()" diff --git a/c-api/init_config.po b/c-api/init_config.po index a51f220060..92b1a1a024 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-09 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -573,7 +573,7 @@ msgid "" "`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -#: ../../c-api/init_config.rst:401 ../../c-api/init_config.rst:1360 +#: ../../c-api/init_config.rst:401 ../../c-api/init_config.rst:1359 msgid "" "The caller is responsible to handle exceptions (error or exit) using :c:func:" "`PyStatus_Exception` and :c:func:`Py_ExitStatusException`." @@ -1839,19 +1839,17 @@ msgstr "" msgid "The ``show_alloc_count`` field has been removed." msgstr "" -#: ../../c-api/init_config.rst:1352 -msgid "Initialization with PyConfig" -msgstr "" - #: ../../c-api/init_config.rst:1354 -msgid "Function to initialize Python:" +msgid "Initialization with PyConfig" msgstr "" -#: ../../c-api/init_config.rst:1358 -msgid "Initialize Python from *config* configuration." +#: ../../c-api/init_config.rst:1356 +msgid "" +"Initializing the interpreter from a populated configuration struct is " +"handled by calling :c:func:`Py_InitializeFromConfig`." msgstr "" -#: ../../c-api/init_config.rst:1363 +#: ../../c-api/init_config.rst:1362 msgid "" "If :c:func:`PyImport_FrozenModules`, :c:func:`PyImport_AppendInittab` or :c:" "func:`PyImport_ExtendInittab` are used, they must be set or called after " @@ -1860,17 +1858,17 @@ msgid "" "`PyImport_ExtendInittab` must be called before each Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1370 +#: ../../c-api/init_config.rst:1369 msgid "" "The current configuration (``PyConfig`` type) is stored in " "``PyInterpreterState.config``." msgstr "" -#: ../../c-api/init_config.rst:1373 +#: ../../c-api/init_config.rst:1372 msgid "Example setting the program name::" msgstr "" -#: ../../c-api/init_config.rst:1375 +#: ../../c-api/init_config.rst:1374 msgid "" "void init_python(void)\n" "{\n" @@ -1924,7 +1922,7 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init_config.rst:1401 +#: ../../c-api/init_config.rst:1400 msgid "" "More complete example modifying the default configuration, read the " "configuration, and then override some parameters. Note that since 3.11, many " @@ -1933,7 +1931,7 @@ msgid "" "called will be left unchanged by initialization::" msgstr "" -#: ../../c-api/init_config.rst:1408 +#: ../../c-api/init_config.rst:1407 msgid "" "PyStatus init_python(const char *program_name)\n" "{\n" @@ -1988,18 +1986,18 @@ msgid "" "}" msgstr "" -#: ../../c-api/init_config.rst:1464 +#: ../../c-api/init_config.rst:1463 msgid "Isolated Configuration" msgstr "" -#: ../../c-api/init_config.rst:1466 +#: ../../c-api/init_config.rst:1465 msgid "" ":c:func:`PyPreConfig_InitIsolatedConfig` and :c:func:" "`PyConfig_InitIsolatedConfig` functions create a configuration to isolate " "Python from the system. For example, to embed Python into an application." msgstr "" -#: ../../c-api/init_config.rst:1471 +#: ../../c-api/init_config.rst:1470 msgid "" "This configuration ignores global configuration variables, environment " "variables, command line arguments (:c:member:`PyConfig.argv` is not parsed) " @@ -2007,115 +2005,115 @@ msgid "" "LC_CTYPE locale are left unchanged. Signal handlers are not installed." msgstr "" -#: ../../c-api/init_config.rst:1476 +#: ../../c-api/init_config.rst:1475 msgid "" "Configuration files are still used with this configuration to determine " "paths that are unspecified. Ensure :c:member:`PyConfig.home` is specified to " "avoid computing the default path configuration." msgstr "" -#: ../../c-api/init_config.rst:1484 +#: ../../c-api/init_config.rst:1483 msgid "Python Configuration" msgstr "" -#: ../../c-api/init_config.rst:1486 +#: ../../c-api/init_config.rst:1485 msgid "" ":c:func:`PyPreConfig_InitPythonConfig` and :c:func:" "`PyConfig_InitPythonConfig` functions create a configuration to build a " "customized Python which behaves as the regular Python." msgstr "" -#: ../../c-api/init_config.rst:1490 +#: ../../c-api/init_config.rst:1489 msgid "" "Environments variables and command line arguments are used to configure " "Python, whereas global configuration variables are ignored." msgstr "" -#: ../../c-api/init_config.rst:1493 +#: ../../c-api/init_config.rst:1492 msgid "" "This function enables C locale coercion (:pep:`538`) and :ref:`Python UTF-8 " "Mode ` (:pep:`540`) depending on the LC_CTYPE locale, :envvar:" "`PYTHONUTF8` and :envvar:`PYTHONCOERCECLOCALE` environment variables." msgstr "" -#: ../../c-api/init_config.rst:1502 +#: ../../c-api/init_config.rst:1501 msgid "Python Path Configuration" msgstr "" -#: ../../c-api/init_config.rst:1504 +#: ../../c-api/init_config.rst:1503 msgid ":c:type:`PyConfig` contains multiple fields for the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1506 +#: ../../c-api/init_config.rst:1505 msgid "Path configuration inputs:" msgstr "" -#: ../../c-api/init_config.rst:1508 +#: ../../c-api/init_config.rst:1507 msgid ":c:member:`PyConfig.home`" msgstr ":c:member:`PyConfig.home`" -#: ../../c-api/init_config.rst:1509 +#: ../../c-api/init_config.rst:1508 msgid ":c:member:`PyConfig.platlibdir`" msgstr ":c:member:`PyConfig.platlibdir`" -#: ../../c-api/init_config.rst:1510 +#: ../../c-api/init_config.rst:1509 msgid ":c:member:`PyConfig.pathconfig_warnings`" msgstr ":c:member:`PyConfig.pathconfig_warnings`" -#: ../../c-api/init_config.rst:1511 +#: ../../c-api/init_config.rst:1510 msgid ":c:member:`PyConfig.program_name`" msgstr ":c:member:`PyConfig.program_name`" -#: ../../c-api/init_config.rst:1512 +#: ../../c-api/init_config.rst:1511 msgid ":c:member:`PyConfig.pythonpath_env`" msgstr ":c:member:`PyConfig.pythonpath_env`" -#: ../../c-api/init_config.rst:1513 +#: ../../c-api/init_config.rst:1512 msgid "current working directory: to get absolute paths" msgstr "" -#: ../../c-api/init_config.rst:1514 +#: ../../c-api/init_config.rst:1513 msgid "" "``PATH`` environment variable to get the program full path (from :c:member:" "`PyConfig.program_name`)" msgstr "" -#: ../../c-api/init_config.rst:1516 +#: ../../c-api/init_config.rst:1515 msgid "``__PYVENV_LAUNCHER__`` environment variable" msgstr "``__PYVENV_LAUNCHER__`` 環境變數" -#: ../../c-api/init_config.rst:1517 +#: ../../c-api/init_config.rst:1516 msgid "" "(Windows only) Application paths in the registry under " "\"Software\\Python\\PythonCore\\X.Y\\PythonPath\" of HKEY_CURRENT_USER and " "HKEY_LOCAL_MACHINE (where X.Y is the Python version)." msgstr "" -#: ../../c-api/init_config.rst:1521 +#: ../../c-api/init_config.rst:1520 msgid "Path configuration output fields:" msgstr "" -#: ../../c-api/init_config.rst:1523 +#: ../../c-api/init_config.rst:1522 msgid ":c:member:`PyConfig.base_exec_prefix`" msgstr ":c:member:`PyConfig.base_exec_prefix`" -#: ../../c-api/init_config.rst:1524 +#: ../../c-api/init_config.rst:1523 msgid ":c:member:`PyConfig.base_executable`" msgstr ":c:member:`PyConfig.base_executable`" -#: ../../c-api/init_config.rst:1525 +#: ../../c-api/init_config.rst:1524 msgid ":c:member:`PyConfig.base_prefix`" msgstr ":c:member:`PyConfig.base_prefix`" -#: ../../c-api/init_config.rst:1526 +#: ../../c-api/init_config.rst:1525 msgid ":c:member:`PyConfig.exec_prefix`" msgstr ":c:member:`PyConfig.exec_prefix`" -#: ../../c-api/init_config.rst:1527 +#: ../../c-api/init_config.rst:1526 msgid ":c:member:`PyConfig.executable`" msgstr ":c:member:`PyConfig.executable`" -#: ../../c-api/init_config.rst:1528 +#: ../../c-api/init_config.rst:1527 msgid "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" @@ -2123,11 +2121,11 @@ msgstr "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" -#: ../../c-api/init_config.rst:1530 +#: ../../c-api/init_config.rst:1529 msgid ":c:member:`PyConfig.prefix`" msgstr ":c:member:`PyConfig.prefix`" -#: ../../c-api/init_config.rst:1532 +#: ../../c-api/init_config.rst:1531 msgid "" "If at least one \"output field\" is not set, Python calculates the path " "configuration to fill unset fields. If :c:member:`~PyConfig." @@ -2136,7 +2134,7 @@ msgid "" "module_search_paths_set` is set to ``1``." msgstr "" -#: ../../c-api/init_config.rst:1538 +#: ../../c-api/init_config.rst:1537 msgid "" "It is possible to completely ignore the function calculating the default " "path configuration by setting explicitly all path configuration output " @@ -2146,52 +2144,52 @@ msgid "" "modification." msgstr "" -#: ../../c-api/init_config.rst:1545 +#: ../../c-api/init_config.rst:1544 msgid "" "Set :c:member:`~PyConfig.pathconfig_warnings` to ``0`` to suppress warnings " "when calculating the path configuration (Unix only, Windows does not log any " "warning)." msgstr "" -#: ../../c-api/init_config.rst:1548 +#: ../../c-api/init_config.rst:1547 msgid "" "If :c:member:`~PyConfig.base_prefix` or :c:member:`~PyConfig." "base_exec_prefix` fields are not set, they inherit their value from :c:" "member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` respectively." msgstr "" -#: ../../c-api/init_config.rst:1552 +#: ../../c-api/init_config.rst:1551 msgid ":c:func:`Py_RunMain` and :c:func:`Py_Main` modify :data:`sys.path`:" msgstr "" -#: ../../c-api/init_config.rst:1554 +#: ../../c-api/init_config.rst:1553 msgid "" "If :c:member:`~PyConfig.run_filename` is set and is a directory which " "contains a ``__main__.py`` script, prepend :c:member:`~PyConfig." "run_filename` to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1557 +#: ../../c-api/init_config.rst:1556 msgid "If :c:member:`~PyConfig.isolated` is zero:" msgstr "" -#: ../../c-api/init_config.rst:1559 +#: ../../c-api/init_config.rst:1558 msgid "" "If :c:member:`~PyConfig.run_module` is set, prepend the current directory " "to :data:`sys.path`. Do nothing if the current directory cannot be read." msgstr "" -#: ../../c-api/init_config.rst:1561 +#: ../../c-api/init_config.rst:1560 msgid "" "If :c:member:`~PyConfig.run_filename` is set, prepend the directory of the " "filename to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1563 +#: ../../c-api/init_config.rst:1562 msgid "Otherwise, prepend an empty string to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1565 +#: ../../c-api/init_config.rst:1564 msgid "" "If :c:member:`~PyConfig.site_import` is non-zero, :data:`sys.path` can be " "modified by the :mod:`site` module. If :c:member:`~PyConfig." @@ -2200,170 +2198,143 @@ msgid "" "data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1571 +#: ../../c-api/init_config.rst:1570 msgid "The following configuration files are used by the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1573 +#: ../../c-api/init_config.rst:1572 msgid "``pyvenv.cfg``" msgstr "``pyvenv.cfg``" -#: ../../c-api/init_config.rst:1574 +#: ../../c-api/init_config.rst:1573 msgid "``._pth`` file (ex: ``python._pth``)" msgstr "" -#: ../../c-api/init_config.rst:1575 +#: ../../c-api/init_config.rst:1574 msgid "``pybuilddir.txt`` (Unix only)" msgstr "" -#: ../../c-api/init_config.rst:1577 +#: ../../c-api/init_config.rst:1576 msgid "If a ``._pth`` file is present:" msgstr "" -#: ../../c-api/init_config.rst:1579 +#: ../../c-api/init_config.rst:1578 msgid "Set :c:member:`~PyConfig.isolated` to ``1``." msgstr "將 :c:member:`~PyConfig.isolated` 設定為 ``1``。" -#: ../../c-api/init_config.rst:1580 +#: ../../c-api/init_config.rst:1579 msgid "Set :c:member:`~PyConfig.use_environment` to ``0``." msgstr "將 :c:member:`~PyConfig.use_environment` 設定為 ``0``。" -#: ../../c-api/init_config.rst:1581 +#: ../../c-api/init_config.rst:1580 msgid "Set :c:member:`~PyConfig.site_import` to ``0``." msgstr "將 :c:member:`~PyConfig.site_import` 設定為 ``0``。" -#: ../../c-api/init_config.rst:1582 +#: ../../c-api/init_config.rst:1581 msgid "Set :c:member:`~PyConfig.safe_path` to ``1``." msgstr "將 :c:member:`~PyConfig.safe_path` 設定為 ``1``。" -#: ../../c-api/init_config.rst:1584 +#: ../../c-api/init_config.rst:1583 msgid "" "The ``__PYVENV_LAUNCHER__`` environment variable is used to set :c:member:" "`PyConfig.base_executable`." msgstr "" -#: ../../c-api/init_config.rst:1589 -msgid "Py_RunMain()" -msgstr "Py_RunMain()" - -#: ../../c-api/init_config.rst:1593 -msgid "" -"Execute the command (:c:member:`PyConfig.run_command`), the script (:c:" -"member:`PyConfig.run_filename`) or the module (:c:member:`PyConfig." -"run_module`) specified on the command line or in the configuration." -msgstr "" - -#: ../../c-api/init_config.rst:1598 -msgid "By default and when if :option:`-i` option is used, run the REPL." -msgstr "" - -#: ../../c-api/init_config.rst:1600 -msgid "" -"Finally, finalizes Python and returns an exit status that can be passed to " -"the ``exit()`` function." -msgstr "" - -#: ../../c-api/init_config.rst:1603 -msgid "" -"See :ref:`Python Configuration ` for an example of " -"customized Python always running in isolated mode using :c:func:`Py_RunMain`." -msgstr "" - -#: ../../c-api/init_config.rst:1609 +#: ../../c-api/init_config.rst:1588 msgid "Py_GetArgcArgv()" msgstr "Py_GetArgcArgv()" -#: ../../c-api/init_config.rst:1613 +#: ../../c-api/init_config.rst:1592 msgid "Get the original command line arguments, before Python modified them." msgstr "" -#: ../../c-api/init_config.rst:1615 +#: ../../c-api/init_config.rst:1594 msgid "See also :c:member:`PyConfig.orig_argv` member." msgstr "" -#: ../../c-api/init_config.rst:1619 +#: ../../c-api/init_config.rst:1598 msgid "Multi-Phase Initialization Private Provisional API" msgstr "" -#: ../../c-api/init_config.rst:1621 +#: ../../c-api/init_config.rst:1600 msgid "" "This section is a private provisional API introducing multi-phase " "initialization, the core feature of :pep:`432`:" msgstr "" -#: ../../c-api/init_config.rst:1624 +#: ../../c-api/init_config.rst:1603 msgid "\"Core\" initialization phase, \"bare minimum Python\":" msgstr "" -#: ../../c-api/init_config.rst:1626 +#: ../../c-api/init_config.rst:1605 msgid "Builtin types;" msgstr "內建型別;" -#: ../../c-api/init_config.rst:1627 +#: ../../c-api/init_config.rst:1606 msgid "Builtin exceptions;" msgstr "內建例外;" -#: ../../c-api/init_config.rst:1628 +#: ../../c-api/init_config.rst:1607 msgid "Builtin and frozen modules;" msgstr "" -#: ../../c-api/init_config.rst:1629 +#: ../../c-api/init_config.rst:1608 msgid "" "The :mod:`sys` module is only partially initialized (ex: :data:`sys.path` " "doesn't exist yet)." msgstr "" -#: ../../c-api/init_config.rst:1632 +#: ../../c-api/init_config.rst:1611 msgid "\"Main\" initialization phase, Python is fully initialized:" msgstr "" -#: ../../c-api/init_config.rst:1634 +#: ../../c-api/init_config.rst:1613 msgid "Install and configure :mod:`importlib`;" msgstr "" -#: ../../c-api/init_config.rst:1635 +#: ../../c-api/init_config.rst:1614 msgid "Apply the :ref:`Path Configuration `;" msgstr "" -#: ../../c-api/init_config.rst:1636 +#: ../../c-api/init_config.rst:1615 msgid "Install signal handlers;" msgstr "" -#: ../../c-api/init_config.rst:1637 +#: ../../c-api/init_config.rst:1616 msgid "" "Finish :mod:`sys` module initialization (ex: create :data:`sys.stdout` and :" "data:`sys.path`);" msgstr "" -#: ../../c-api/init_config.rst:1639 +#: ../../c-api/init_config.rst:1618 msgid "" "Enable optional features like :mod:`faulthandler` and :mod:`tracemalloc`;" msgstr "" -#: ../../c-api/init_config.rst:1640 +#: ../../c-api/init_config.rst:1619 msgid "Import the :mod:`site` module;" msgstr "引入 :mod:`site` 模組;" -#: ../../c-api/init_config.rst:1641 +#: ../../c-api/init_config.rst:1620 msgid "etc." msgstr "" -#: ../../c-api/init_config.rst:1643 +#: ../../c-api/init_config.rst:1622 msgid "Private provisional API:" msgstr "" -#: ../../c-api/init_config.rst:1645 +#: ../../c-api/init_config.rst:1624 msgid "" ":c:member:`PyConfig._init_main`: if set to ``0``, :c:func:" "`Py_InitializeFromConfig` stops at the \"Core\" initialization phase." msgstr "" -#: ../../c-api/init_config.rst:1650 +#: ../../c-api/init_config.rst:1629 msgid "" "Move to the \"Main\" initialization phase, finish the Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1652 +#: ../../c-api/init_config.rst:1631 msgid "" "No module is imported during the \"Core\" phase and the ``importlib`` module " "is not configured: the :ref:`Path Configuration ` is only " @@ -2372,14 +2343,14 @@ msgid "" "maybe install a custom :data:`sys.meta_path` importer or an import hook, etc." msgstr "" -#: ../../c-api/init_config.rst:1658 +#: ../../c-api/init_config.rst:1637 msgid "" "It may become possible to calculate the :ref:`Path Configuration ` in Python, after the Core phase and before the Main phase, which is " "one of the :pep:`432` motivation." msgstr "" -#: ../../c-api/init_config.rst:1662 +#: ../../c-api/init_config.rst:1641 msgid "" "The \"Core\" phase is not properly defined: what should be and what should " "not be available at this phase is not specified yet. The API is marked as " @@ -2387,13 +2358,13 @@ msgid "" "until a proper public API is designed." msgstr "" -#: ../../c-api/init_config.rst:1667 +#: ../../c-api/init_config.rst:1646 msgid "" "Example running Python code between \"Core\" and \"Main\" initialization " "phases::" msgstr "" -#: ../../c-api/init_config.rst:1670 +#: ../../c-api/init_config.rst:1649 msgid "" "void init_python(void)\n" "{\n" @@ -2438,5 +2409,8 @@ msgstr "" msgid "argv (in module sys)" msgstr "" +#~ msgid "Py_RunMain()" +#~ msgstr "Py_RunMain()" + #~ msgid "Command line arguments: :data:`sys.argv`." #~ msgstr "命令列引數::data:`sys.argv`。" diff --git a/c-api/long.po b/c-api/long.po index 8416a8fa8a..281c5ae8a4 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-30 09:19+0000\n" +"POT-Creation-Date: 2024-10-14 00:14+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-" @@ -624,13 +624,13 @@ msgid "" "is subject to change." msgstr "" -#: ../../c-api/long.rst:543 +#: ../../c-api/long.rst:546 msgid "" "If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`, " "return its value." msgstr "" -#: ../../c-api/long.rst:546 +#: ../../c-api/long.rst:549 msgid "Otherwise, the return value is undefined." msgstr "" diff --git a/c-api/module.po b/c-api/module.po index 13cc3dc95a..bfd8be22ed 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-10 00:13+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-" @@ -42,29 +42,33 @@ msgstr "" #: ../../c-api/module.rst:40 msgid "" -"Return a new module object with the :attr:`__name__` attribute set to " -"*name*. The module's :attr:`__name__`, :attr:`__doc__`, :attr:`__package__`, " -"and :attr:`__loader__` attributes are filled in (all but :attr:`__name__` " -"are set to ``None``); the caller is responsible for providing a :attr:" -"`__file__` attribute." +"Return a new module object with :attr:`module.__name__` set to *name*. The " +"module's :attr:`!__name__`, :attr:`~module.__doc__`, :attr:`~module." +"__package__` and :attr:`~module.__loader__` attributes are filled in (all " +"but :attr:`!__name__` are set to ``None``). The caller is responsible for " +"setting a :attr:`~module.__file__` attribute." msgstr "" -#: ../../c-api/module.rst:46 ../../c-api/module.rst:270 -#: ../../c-api/module.rst:472 +#: ../../c-api/module.rst:46 ../../c-api/module.rst:272 +#: ../../c-api/module.rst:474 msgid "Return ``NULL`` with an exception set on error." msgstr "在失敗時回傳 ``NULL`` 並設定例外。" #: ../../c-api/module.rst:50 -msgid ":attr:`__package__` and :attr:`__loader__` are set to ``None``." -msgstr ":attr:`__package__` 和 :attr:`__loader__` 被設為 ``None``。" +msgid "" +":attr:`~module.__package__` and :attr:`~module.__loader__` are now set to " +"``None``." +msgstr "" +":attr:`~module.__package__` 和 :attr:`~module.__loader__` 現在被設為 " +"``None``。" -#: ../../c-api/module.rst:56 +#: ../../c-api/module.rst:57 msgid "" "Similar to :c:func:`PyModule_NewObject`, but the name is a UTF-8 encoded " "string instead of a Unicode object." msgstr "" -#: ../../c-api/module.rst:64 +#: ../../c-api/module.rst:65 msgid "" "Return the dictionary object that implements *module*'s namespace; this " "object is the same as the :attr:`~object.__dict__` attribute of the module " @@ -72,64 +76,64 @@ msgid "" "object), :exc:`SystemError` is raised and ``NULL`` is returned." msgstr "" -#: ../../c-api/module.rst:69 +#: ../../c-api/module.rst:70 msgid "" "It is recommended extensions use other ``PyModule_*`` and ``PyObject_*`` " "functions rather than directly manipulate a module's :attr:`~object." "__dict__`." msgstr "" -#: ../../c-api/module.rst:80 +#: ../../c-api/module.rst:81 msgid "" -"Return *module*'s :attr:`__name__` value. If the module does not provide " -"one, or if it is not a string, :exc:`SystemError` is raised and ``NULL`` is " -"returned." +"Return *module*'s :attr:`~module.__name__` value. If the module does not " +"provide one, or if it is not a string, :exc:`SystemError` is raised and " +"``NULL`` is returned." msgstr "" -#: ../../c-api/module.rst:88 +#: ../../c-api/module.rst:90 msgid "" "Similar to :c:func:`PyModule_GetNameObject` but return the name encoded to " "``'utf-8'``." msgstr "" -#: ../../c-api/module.rst:93 +#: ../../c-api/module.rst:95 msgid "" "Return the \"state\" of the module, that is, a pointer to the block of " "memory allocated at module creation time, or ``NULL``. See :c:member:" "`PyModuleDef.m_size`." msgstr "" -#: ../../c-api/module.rst:100 +#: ../../c-api/module.rst:102 msgid "" "Return a pointer to the :c:type:`PyModuleDef` struct from which the module " "was created, or ``NULL`` if the module wasn't created from a definition." msgstr "" -#: ../../c-api/module.rst:110 +#: ../../c-api/module.rst:112 msgid "" "Return the name of the file from which *module* was loaded using *module*'s :" -"attr:`__file__` attribute. If this is not defined, or if it is not a " -"unicode string, raise :exc:`SystemError` and return ``NULL``; otherwise " -"return a reference to a Unicode object." +"attr:`~module.__file__` attribute. If this is not defined, or if it is not " +"a string, raise :exc:`SystemError` and return ``NULL``; otherwise return a " +"reference to a Unicode object." msgstr "" -#: ../../c-api/module.rst:120 +#: ../../c-api/module.rst:122 msgid "" "Similar to :c:func:`PyModule_GetFilenameObject` but return the filename " "encoded to 'utf-8'." msgstr "" -#: ../../c-api/module.rst:123 +#: ../../c-api/module.rst:125 msgid "" ":c:func:`PyModule_GetFilename` raises :exc:`UnicodeEncodeError` on " "unencodable filenames, use :c:func:`PyModule_GetFilenameObject` instead." msgstr "" -#: ../../c-api/module.rst:131 +#: ../../c-api/module.rst:133 msgid "Initializing C modules" msgstr "初始化 C 模組" -#: ../../c-api/module.rst:133 +#: ../../c-api/module.rst:135 msgid "" "Modules objects are usually created from extension modules (shared libraries " "which export an initialization function), or compiled-in modules (where the " @@ -137,55 +141,55 @@ msgid "" "See :ref:`building` or :ref:`extending-with-embedding` for details." msgstr "" -#: ../../c-api/module.rst:138 +#: ../../c-api/module.rst:140 msgid "" "The initialization function can either pass a module definition instance to :" "c:func:`PyModule_Create`, and return the resulting module object, or request " "\"multi-phase initialization\" by returning the definition struct itself." msgstr "" -#: ../../c-api/module.rst:144 +#: ../../c-api/module.rst:146 msgid "" "The module definition struct, which holds all information needed to create a " "module object. There is usually only one statically initialized variable of " "this type for each module." msgstr "" -#: ../../c-api/module.rst:150 +#: ../../c-api/module.rst:152 msgid "Always initialize this member to :c:macro:`PyModuleDef_HEAD_INIT`." msgstr "" -#: ../../c-api/module.rst:154 +#: ../../c-api/module.rst:156 msgid "Name for the new module." msgstr "" -#: ../../c-api/module.rst:158 +#: ../../c-api/module.rst:160 msgid "" "Docstring for the module; usually a docstring variable created with :c:macro:" "`PyDoc_STRVAR` is used." msgstr "" -#: ../../c-api/module.rst:163 +#: ../../c-api/module.rst:165 msgid "" "Module state may be kept in a per-module memory area that can be retrieved " "with :c:func:`PyModule_GetState`, rather than in static globals. This makes " "modules safe for use in multiple sub-interpreters." msgstr "" -#: ../../c-api/module.rst:167 +#: ../../c-api/module.rst:169 msgid "" "This memory area is allocated based on *m_size* on module creation, and " "freed when the module object is deallocated, after the :c:member:" "`~PyModuleDef.m_free` function has been called, if present." msgstr "" -#: ../../c-api/module.rst:171 +#: ../../c-api/module.rst:173 msgid "" "Setting ``m_size`` to ``-1`` means that the module does not support sub-" "interpreters, because it has global state." msgstr "" -#: ../../c-api/module.rst:174 +#: ../../c-api/module.rst:176 msgid "" "Setting it to a non-negative value means that the module can be re-" "initialized and specifies the additional amount of memory it requires for " @@ -193,37 +197,37 @@ msgid "" "initialization." msgstr "" -#: ../../c-api/module.rst:179 +#: ../../c-api/module.rst:181 msgid "See :PEP:`3121` for more details." msgstr "更多詳情請見 :pep:`3121`。" -#: ../../c-api/module.rst:183 +#: ../../c-api/module.rst:185 msgid "" "A pointer to a table of module-level functions, described by :c:type:" "`PyMethodDef` values. Can be ``NULL`` if no functions are present." msgstr "" -#: ../../c-api/module.rst:188 +#: ../../c-api/module.rst:190 msgid "" "An array of slot definitions for multi-phase initialization, terminated by a " "``{0, NULL}`` entry. When using single-phase initialization, *m_slots* must " "be ``NULL``." msgstr "" -#: ../../c-api/module.rst:194 +#: ../../c-api/module.rst:196 msgid "" "Prior to version 3.5, this member was always set to ``NULL``, and was " "defined as:" msgstr "" -#: ../../c-api/module.rst:201 +#: ../../c-api/module.rst:203 msgid "" "A traversal function to call during GC traversal of the module object, or " "``NULL`` if not needed." msgstr "" -#: ../../c-api/module.rst:204 ../../c-api/module.rst:219 -#: ../../c-api/module.rst:240 +#: ../../c-api/module.rst:206 ../../c-api/module.rst:221 +#: ../../c-api/module.rst:242 msgid "" "This function is not called if the module state was requested but is not " "allocated yet. This is the case immediately after the module is created and " @@ -233,18 +237,18 @@ msgid "" "`PyModule_GetState`) is ``NULL``." msgstr "" -#: ../../c-api/module.rst:211 ../../c-api/module.rst:232 -#: ../../c-api/module.rst:247 +#: ../../c-api/module.rst:213 ../../c-api/module.rst:234 +#: ../../c-api/module.rst:249 msgid "No longer called before the module state is allocated." msgstr "" -#: ../../c-api/module.rst:216 +#: ../../c-api/module.rst:218 msgid "" "A clear function to call during GC clearing of the module object, or " "``NULL`` if not needed." msgstr "" -#: ../../c-api/module.rst:226 +#: ../../c-api/module.rst:228 msgid "" "Like :c:member:`PyTypeObject.tp_clear`, this function is not *always* called " "before a module is deallocated. For example, when reference counting is " @@ -253,55 +257,55 @@ msgid "" "directly." msgstr "" -#: ../../c-api/module.rst:237 +#: ../../c-api/module.rst:239 msgid "" "A function to call during deallocation of the module object, or ``NULL`` if " "not needed." msgstr "" -#: ../../c-api/module.rst:251 +#: ../../c-api/module.rst:253 msgid "Single-phase initialization" msgstr "" -#: ../../c-api/module.rst:253 +#: ../../c-api/module.rst:255 msgid "" "The module initialization function may create and return the module object " "directly. This is referred to as \"single-phase initialization\", and uses " "one of the following two module creation functions:" msgstr "" -#: ../../c-api/module.rst:259 +#: ../../c-api/module.rst:261 msgid "" "Create a new module object, given the definition in *def*. This behaves " "like :c:func:`PyModule_Create2` with *module_api_version* set to :c:macro:" "`PYTHON_API_VERSION`." msgstr "" -#: ../../c-api/module.rst:266 +#: ../../c-api/module.rst:268 msgid "" "Create a new module object, given the definition in *def*, assuming the API " "version *module_api_version*. If that version does not match the version of " "the running interpreter, a :exc:`RuntimeWarning` is emitted." msgstr "" -#: ../../c-api/module.rst:274 +#: ../../c-api/module.rst:276 msgid "" "Most uses of this function should be using :c:func:`PyModule_Create` " "instead; only use this if you are sure you need it." msgstr "" -#: ../../c-api/module.rst:277 +#: ../../c-api/module.rst:279 msgid "" "Before it is returned from in the initialization function, the resulting " "module object is typically populated using functions like :c:func:" "`PyModule_AddObjectRef`." msgstr "" -#: ../../c-api/module.rst:283 +#: ../../c-api/module.rst:285 msgid "Multi-phase initialization" msgstr "" -#: ../../c-api/module.rst:285 +#: ../../c-api/module.rst:287 msgid "" "An alternate way to specify extensions is to request \"multi-phase " "initialization\". Extension modules created this way behave more like Python " @@ -311,7 +315,7 @@ msgid "" "__init__` methods of classes." msgstr "" -#: ../../c-api/module.rst:292 +#: ../../c-api/module.rst:294 msgid "" "Unlike modules created using single-phase initialization, these modules are " "not singletons: if the *sys.modules* entry is removed and the module is re-" @@ -324,14 +328,14 @@ msgid "" "__dict__` or individual classes created with :c:func:`PyType_FromSpec`)." msgstr "" -#: ../../c-api/module.rst:302 +#: ../../c-api/module.rst:304 msgid "" "All modules created using multi-phase initialization are expected to " "support :ref:`sub-interpreters `. Making sure " "multiple modules are independent is typically enough to achieve this." msgstr "" -#: ../../c-api/module.rst:306 +#: ../../c-api/module.rst:308 msgid "" "To request multi-phase initialization, the initialization function " "(PyInit_modulename) returns a :c:type:`PyModuleDef` instance with non-empty :" @@ -339,65 +343,65 @@ msgid "" "instance must be initialized with the following function:" msgstr "" -#: ../../c-api/module.rst:313 +#: ../../c-api/module.rst:315 msgid "" "Ensures a module definition is a properly initialized Python object that " "correctly reports its type and reference count." msgstr "" -#: ../../c-api/module.rst:316 +#: ../../c-api/module.rst:318 msgid "Returns *def* cast to ``PyObject*``, or ``NULL`` if an error occurred." msgstr "" -#: ../../c-api/module.rst:320 +#: ../../c-api/module.rst:322 msgid "" "The *m_slots* member of the module definition must point to an array of " "``PyModuleDef_Slot`` structures:" msgstr "" -#: ../../c-api/module.rst:327 +#: ../../c-api/module.rst:329 msgid "A slot ID, chosen from the available values explained below." msgstr "" -#: ../../c-api/module.rst:331 +#: ../../c-api/module.rst:333 msgid "Value of the slot, whose meaning depends on the slot ID." msgstr "" -#: ../../c-api/module.rst:335 +#: ../../c-api/module.rst:337 msgid "The *m_slots* array must be terminated by a slot with id 0." msgstr "" -#: ../../c-api/module.rst:337 +#: ../../c-api/module.rst:339 msgid "The available slot types are:" msgstr "" -#: ../../c-api/module.rst:341 +#: ../../c-api/module.rst:343 msgid "" "Specifies a function that is called to create the module object itself. The " "*value* pointer of this slot must point to a function of the signature:" msgstr "" -#: ../../c-api/module.rst:348 +#: ../../c-api/module.rst:350 msgid "" "The function receives a :py:class:`~importlib.machinery.ModuleSpec` " "instance, as defined in :PEP:`451`, and the module definition. It should " "return a new module object, or set an error and return ``NULL``." msgstr "" -#: ../../c-api/module.rst:353 +#: ../../c-api/module.rst:355 msgid "" "This function should be kept minimal. In particular, it should not call " "arbitrary Python code, as trying to import the same module again may result " "in an infinite loop." msgstr "" -#: ../../c-api/module.rst:357 +#: ../../c-api/module.rst:359 msgid "" "Multiple ``Py_mod_create`` slots may not be specified in one module " "definition." msgstr "" -#: ../../c-api/module.rst:360 +#: ../../c-api/module.rst:362 msgid "" "If ``Py_mod_create`` is not specified, the import machinery will create a " "normal module object using :c:func:`PyModule_New`. The name is taken from " @@ -406,7 +410,7 @@ msgid "" "through symlinks, all while sharing a single module definition." msgstr "" -#: ../../c-api/module.rst:366 +#: ../../c-api/module.rst:368 msgid "" "There is no requirement for the returned object to be an instance of :c:type:" "`PyModule_Type`. Any type can be used, as long as it supports setting and " @@ -416,7 +420,7 @@ msgid "" "``Py_mod_create``." msgstr "" -#: ../../c-api/module.rst:375 +#: ../../c-api/module.rst:377 msgid "" "Specifies a function that is called to *execute* the module. This is " "equivalent to executing the code of a Python module: typically, this " @@ -424,61 +428,61 @@ msgid "" "function is:" msgstr "" -#: ../../c-api/module.rst:384 +#: ../../c-api/module.rst:386 msgid "" "If multiple ``Py_mod_exec`` slots are specified, they are processed in the " "order they appear in the *m_slots* array." msgstr "" -#: ../../c-api/module.rst:389 ../../c-api/module.rst:422 +#: ../../c-api/module.rst:391 ../../c-api/module.rst:424 msgid "Specifies one of the following values:" msgstr "" -#: ../../c-api/module.rst:395 +#: ../../c-api/module.rst:397 msgid "The module does not support being imported in subinterpreters." msgstr "" -#: ../../c-api/module.rst:399 +#: ../../c-api/module.rst:401 msgid "" "The module supports being imported in subinterpreters, but only when they " "share the main interpreter's GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" -#: ../../c-api/module.rst:405 +#: ../../c-api/module.rst:407 msgid "" "The module supports being imported in subinterpreters, even when they have " "their own GIL. (See :ref:`isolating-extensions-howto`.)" msgstr "" -#: ../../c-api/module.rst:409 +#: ../../c-api/module.rst:411 msgid "" "This slot determines whether or not importing this module in a " "subinterpreter will fail." msgstr "" -#: ../../c-api/module.rst:412 +#: ../../c-api/module.rst:414 msgid "" "Multiple ``Py_mod_multiple_interpreters`` slots may not be specified in one " "module definition." msgstr "" -#: ../../c-api/module.rst:415 +#: ../../c-api/module.rst:417 msgid "" "If ``Py_mod_multiple_interpreters`` is not specified, the import machinery " "defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED``." msgstr "" -#: ../../c-api/module.rst:428 +#: ../../c-api/module.rst:430 msgid "" "The module depends on the presence of the global interpreter lock (GIL), and " "may access global state without synchronization." msgstr "" -#: ../../c-api/module.rst:433 +#: ../../c-api/module.rst:435 msgid "The module is safe to run without an active GIL." msgstr "" -#: ../../c-api/module.rst:435 +#: ../../c-api/module.rst:437 msgid "" "This slot is ignored by Python builds not configured with :option:`--disable-" "gil`. Otherwise, it determines whether or not importing this module will " @@ -486,26 +490,26 @@ msgid "" "threaded-cpython` for more detail." msgstr "" -#: ../../c-api/module.rst:440 +#: ../../c-api/module.rst:442 msgid "" "Multiple ``Py_mod_gil`` slots may not be specified in one module definition." msgstr "" -#: ../../c-api/module.rst:442 +#: ../../c-api/module.rst:444 msgid "" "If ``Py_mod_gil`` is not specified, the import machinery defaults to " "``Py_MOD_GIL_USED``." msgstr "" -#: ../../c-api/module.rst:447 +#: ../../c-api/module.rst:449 msgid "See :PEP:`489` for more details on multi-phase initialization." msgstr "" -#: ../../c-api/module.rst:450 +#: ../../c-api/module.rst:452 msgid "Low-level module creation functions" msgstr "" -#: ../../c-api/module.rst:452 +#: ../../c-api/module.rst:454 msgid "" "The following functions are called under the hood when using multi-phase " "initialization. They can be used directly, for example when creating module " @@ -513,14 +517,14 @@ msgid "" "``PyModule_ExecDef`` must be called to fully initialize a module." msgstr "" -#: ../../c-api/module.rst:459 +#: ../../c-api/module.rst:461 msgid "" "Create a new module object, given the definition in *def* and the ModuleSpec " "*spec*. This behaves like :c:func:`PyModule_FromDefAndSpec2` with " "*module_api_version* set to :c:macro:`PYTHON_API_VERSION`." msgstr "" -#: ../../c-api/module.rst:467 +#: ../../c-api/module.rst:469 msgid "" "Create a new module object, given the definition in *def* and the ModuleSpec " "*spec*, assuming the API version *module_api_version*. If that version does " @@ -528,24 +532,24 @@ msgid "" "emitted." msgstr "" -#: ../../c-api/module.rst:476 +#: ../../c-api/module.rst:478 msgid "" "Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec` " "instead; only use this if you are sure you need it." msgstr "" -#: ../../c-api/module.rst:483 +#: ../../c-api/module.rst:485 msgid "Process any execution slots (:c:data:`Py_mod_exec`) given in *def*." msgstr "" -#: ../../c-api/module.rst:489 +#: ../../c-api/module.rst:491 msgid "" "Set the docstring for *module* to *docstring*. This function is called " "automatically when creating a module from ``PyModuleDef``, using either " "``PyModule_Create`` or ``PyModule_FromDefAndSpec``." msgstr "" -#: ../../c-api/module.rst:498 +#: ../../c-api/module.rst:500 msgid "" "Add the functions from the ``NULL`` terminated *functions* array to " "*module*. Refer to the :c:type:`PyMethodDef` documentation for details on " @@ -557,11 +561,11 @@ msgid "" "``PyModule_FromDefAndSpec``." msgstr "" -#: ../../c-api/module.rst:510 +#: ../../c-api/module.rst:512 msgid "Support functions" msgstr "支援的函式" -#: ../../c-api/module.rst:512 +#: ../../c-api/module.rst:514 msgid "" "The module initialization function (if using single phase initialization) or " "a function called from a module execution slot (if using multi-phase " @@ -569,29 +573,29 @@ msgid "" "module state:" msgstr "" -#: ../../c-api/module.rst:519 +#: ../../c-api/module.rst:521 msgid "" "Add an object to *module* as *name*. This is a convenience function which " "can be used from the module's initialization function." msgstr "" -#: ../../c-api/module.rst:522 +#: ../../c-api/module.rst:524 msgid "" "On success, return ``0``. On error, raise an exception and return ``-1``." msgstr "" -#: ../../c-api/module.rst:524 +#: ../../c-api/module.rst:526 msgid "" "Return ``-1`` if *value* is ``NULL``. It must be called with an exception " "raised in this case." msgstr "" -#: ../../c-api/module.rst:527 ../../c-api/module.rst:574 -#: ../../c-api/module.rst:601 +#: ../../c-api/module.rst:529 ../../c-api/module.rst:576 +#: ../../c-api/module.rst:603 msgid "Example usage::" msgstr "用法範例: ::" -#: ../../c-api/module.rst:529 +#: ../../c-api/module.rst:531 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -617,13 +621,13 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:541 +#: ../../c-api/module.rst:543 msgid "" "The example can also be written without checking explicitly if *obj* is " "``NULL``::" msgstr "" -#: ../../c-api/module.rst:544 +#: ../../c-api/module.rst:546 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -643,13 +647,13 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:553 +#: ../../c-api/module.rst:555 msgid "" "Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this " "case, since *obj* can be ``NULL``." msgstr "" -#: ../../c-api/module.rst:556 +#: ../../c-api/module.rst:558 msgid "" "The number of different *name* strings passed to this function should be " "kept small, usually by only using statically allocated strings as *name*. " @@ -659,7 +663,7 @@ msgid "" "internally to create a key object." msgstr "" -#: ../../c-api/module.rst:569 +#: ../../c-api/module.rst:571 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but \"steals\" a reference to " "*value*. It can be called with a result of function that returns a new " @@ -667,39 +671,39 @@ msgid "" "variable." msgstr "" -#: ../../c-api/module.rst:576 +#: ../../c-api/module.rst:578 msgid "" "if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n" " goto error;\n" "}" msgstr "" -#: ../../c-api/module.rst:585 +#: ../../c-api/module.rst:587 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to " "*value* on success (if it returns ``0``)." msgstr "" -#: ../../c-api/module.rst:588 +#: ../../c-api/module.rst:590 msgid "" "The new :c:func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions " "are recommended, since it is easy to introduce reference leaks by misusing " "the :c:func:`PyModule_AddObject` function." msgstr "" -#: ../../c-api/module.rst:595 +#: ../../c-api/module.rst:597 msgid "" "Unlike other functions that steal references, ``PyModule_AddObject()`` only " "releases the reference to *value* **on success**." msgstr "" -#: ../../c-api/module.rst:598 +#: ../../c-api/module.rst:600 msgid "" "This means that its return value must be checked, and calling code must :c:" "func:`Py_XDECREF` *value* manually on error." msgstr "" -#: ../../c-api/module.rst:603 +#: ../../c-api/module.rst:605 msgid "" "PyObject *obj = PyBytes_FromString(value);\n" "if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" @@ -713,24 +717,24 @@ msgid "" "// Py_XDECREF(obj) is not needed here." msgstr "" -#: ../../c-api/module.rst:616 +#: ../../c-api/module.rst:618 msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`." msgstr "" -#: ../../c-api/module.rst:621 +#: ../../c-api/module.rst:623 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:625 +#: ../../c-api/module.rst:627 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:631 +#: ../../c-api/module.rst:633 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 " @@ -738,14 +742,14 @@ msgid "" "on success." msgstr "" -#: ../../c-api/module.rst:636 +#: ../../c-api/module.rst:638 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:643 +#: ../../c-api/module.rst:645 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 " @@ -753,11 +757,11 @@ msgid "" "with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:651 +#: ../../c-api/module.rst:653 msgid "Add a string constant to *module*." msgstr "" -#: ../../c-api/module.rst:655 +#: ../../c-api/module.rst:657 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 " @@ -765,7 +769,7 @@ msgid "" "``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:665 +#: ../../c-api/module.rst:667 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`. " @@ -776,25 +780,25 @@ msgid "" "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:678 +#: ../../c-api/module.rst:680 msgid "Module lookup" msgstr "模組查找" -#: ../../c-api/module.rst:680 +#: ../../c-api/module.rst:682 msgid "" "Single-phase initialization creates singleton modules that can be looked up " "in the context of the current interpreter. This allows the module object to " "be retrieved later with only a reference to the module definition." msgstr "" -#: ../../c-api/module.rst:684 +#: ../../c-api/module.rst:686 msgid "" "These functions will not work on modules created using multi-phase " "initialization, since multiple such modules can be created from a single " "definition." msgstr "" -#: ../../c-api/module.rst:689 +#: ../../c-api/module.rst:691 msgid "" "Returns the module object that was created from *def* for the current " "interpreter. This method requires that the module object has been attached " @@ -803,18 +807,18 @@ msgid "" "to the interpreter state yet, it returns ``NULL``." msgstr "" -#: ../../c-api/module.rst:696 +#: ../../c-api/module.rst:698 msgid "" "Attaches the module object passed to the function to the interpreter state. " "This allows the module object to be accessible via :c:func:" "`PyState_FindModule`." msgstr "" -#: ../../c-api/module.rst:699 +#: ../../c-api/module.rst:701 msgid "Only effective on modules created using single-phase initialization." msgstr "" -#: ../../c-api/module.rst:701 +#: ../../c-api/module.rst:703 msgid "" "Python calls ``PyState_AddModule`` automatically after importing a module, " "so it is unnecessary (but harmless) to call it from module initialization " @@ -825,15 +829,15 @@ msgid "" "state updates)." msgstr "" -#: ../../c-api/module.rst:709 ../../c-api/module.rst:720 +#: ../../c-api/module.rst:711 ../../c-api/module.rst:722 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/module.rst:711 +#: ../../c-api/module.rst:713 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "成功時回傳 ``0``,在失敗時回傳 ``-1`` 並設定例外。" -#: ../../c-api/module.rst:717 +#: ../../c-api/module.rst:719 msgid "" "Removes the module object created from *def* from the interpreter state. " "Return ``-1`` with an exception set on error, ``0`` on success." @@ -851,7 +855,7 @@ msgstr "module(模組)" msgid "ModuleType (in module types)" msgstr "MethodType(types 模組中)" -#: ../../c-api/module.rst:33 ../../c-api/module.rst:76 +#: ../../c-api/module.rst:33 ../../c-api/module.rst:77 msgid "__name__ (module attribute)" msgstr "__name__(模組屬性)" @@ -859,7 +863,7 @@ msgstr "__name__(模組屬性)" msgid "__doc__ (module attribute)" msgstr "__doc__(模組屬性)" -#: ../../c-api/module.rst:33 ../../c-api/module.rst:106 +#: ../../c-api/module.rst:33 ../../c-api/module.rst:108 msgid "__file__ (module attribute)" msgstr "__file__(模組屬性)" @@ -871,10 +875,10 @@ msgstr "__package__(模組屬性)" msgid "__loader__ (module attribute)" msgstr "__loader__(模組屬性)" -#: ../../c-api/module.rst:62 +#: ../../c-api/module.rst:63 msgid "__dict__ (module attribute)" msgstr "__dict__(模組屬性)" -#: ../../c-api/module.rst:76 ../../c-api/module.rst:106 +#: ../../c-api/module.rst:77 ../../c-api/module.rst:108 msgid "SystemError (built-in exception)" msgstr "SystemError(內建例外)" diff --git a/c-api/tuple.po b/c-api/tuple.po index 3e5dbda024..0392e13819 100644 --- a/c-api/tuple.po +++ b/c-api/tuple.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-08 00:13+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -119,8 +119,8 @@ msgid "" "*only* be used to fill in brand new tuples." msgstr "" -#: ../../c-api/tuple.rst:102 ../../c-api/tuple.rst:217 -#: ../../c-api/tuple.rst:235 +#: ../../c-api/tuple.rst:102 ../../c-api/tuple.rst:218 +#: ../../c-api/tuple.rst:236 msgid "" "Bounds checking is performed as an assertion if Python is built in :ref:" "`debug mode ` or :option:`with assertions <--with-assertions>`." @@ -167,7 +167,7 @@ msgid "" "`PyStructSequence_New`." msgstr "" -#: ../../c-api/tuple.rst:142 ../../c-api/tuple.rst:210 +#: ../../c-api/tuple.rst:142 ../../c-api/tuple.rst:211 msgid "Return ``NULL`` with an exception set on failure." msgstr "" @@ -186,22 +186,24 @@ msgid "Contains the meta information of a struct sequence type to create." msgstr "" #: ../../c-api/tuple.rst:164 -msgid "Name of the struct sequence type." +msgid "" +"Fully qualified name of the type; null-terminated UTF-8 encoded. The name " +"must contain the module name." msgstr "" -#: ../../c-api/tuple.rst:168 +#: ../../c-api/tuple.rst:169 msgid "Pointer to docstring for the type or ``NULL`` to omit." msgstr "" -#: ../../c-api/tuple.rst:172 +#: ../../c-api/tuple.rst:173 msgid "Pointer to ``NULL``-terminated array with field names of the new type." msgstr "" -#: ../../c-api/tuple.rst:176 +#: ../../c-api/tuple.rst:177 msgid "Number of fields visible to the Python side (if used as tuple)." msgstr "" -#: ../../c-api/tuple.rst:181 +#: ../../c-api/tuple.rst:182 msgid "" "Describes a field of a struct sequence. As a struct sequence is modeled as a " "tuple, all fields are typed as :c:expr:`PyObject*`. The index in the :c:" @@ -210,59 +212,59 @@ msgid "" "described." msgstr "" -#: ../../c-api/tuple.rst:189 +#: ../../c-api/tuple.rst:190 msgid "" "Name for the field or ``NULL`` to end the list of named fields, set to :c:" "data:`PyStructSequence_UnnamedField` to leave unnamed." msgstr "" -#: ../../c-api/tuple.rst:194 +#: ../../c-api/tuple.rst:195 msgid "Field docstring or ``NULL`` to omit." msgstr "" -#: ../../c-api/tuple.rst:199 +#: ../../c-api/tuple.rst:200 msgid "Special value for a field name to leave it unnamed." msgstr "" -#: ../../c-api/tuple.rst:201 +#: ../../c-api/tuple.rst:202 msgid "The type was changed from ``char *``." msgstr "" -#: ../../c-api/tuple.rst:207 +#: ../../c-api/tuple.rst:208 msgid "" "Creates an instance of *type*, which must have been created with :c:func:" "`PyStructSequence_NewType`." msgstr "" -#: ../../c-api/tuple.rst:215 +#: ../../c-api/tuple.rst:216 msgid "" "Return the object at position *pos* in the struct sequence pointed to by *p*." msgstr "" -#: ../../c-api/tuple.rst:223 +#: ../../c-api/tuple.rst:224 msgid "Alias to :c:func:`PyStructSequence_GetItem`." msgstr "" -#: ../../c-api/tuple.rst:225 +#: ../../c-api/tuple.rst:226 msgid "Now implemented as an alias to :c:func:`PyStructSequence_GetItem`." msgstr "" -#: ../../c-api/tuple.rst:231 +#: ../../c-api/tuple.rst:232 msgid "" "Sets the field at index *pos* of the struct sequence *p* to value *o*. " "Like :c:func:`PyTuple_SET_ITEM`, this should only be used to fill in brand " "new instances." msgstr "" -#: ../../c-api/tuple.rst:240 +#: ../../c-api/tuple.rst:241 msgid "This function \"steals\" a reference to *o*." msgstr "" -#: ../../c-api/tuple.rst:245 +#: ../../c-api/tuple.rst:246 msgid "Alias to :c:func:`PyStructSequence_SetItem`." msgstr "" -#: ../../c-api/tuple.rst:247 +#: ../../c-api/tuple.rst:248 msgid "Now implemented as an alias to :c:func:`PyStructSequence_SetItem`." msgstr "" diff --git a/c-api/veryhigh.po b/c-api/veryhigh.po index 7f42392eaf..468bb4f7bf 100644 --- a/c-api/veryhigh.po +++ b/c-api/veryhigh.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-02-12 00:03+0000\n" +"POT-Creation-Date: 2024-10-09 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,47 +51,23 @@ msgstr "" #: ../../c-api/veryhigh.rst:30 msgid "" -"The main program for the standard interpreter. This is made available for " -"programs which embed Python. The *argc* and *argv* parameters should be " -"prepared exactly as those which are passed to a C program's :c:func:`main` " -"function (converted to wchar_t according to the user's locale). It is " -"important to note that the argument list may be modified (but the contents " -"of the strings pointed to by the argument list are not). The return value " -"will be ``0`` if the interpreter exits normally (i.e., without an " -"exception), ``1`` if the interpreter exits due to an exception, or ``2`` if " -"the parameter list does not represent a valid Python command line." -msgstr "" - -#: ../../c-api/veryhigh.rst:40 -msgid "" -"Note that if an otherwise unhandled :exc:`SystemExit` is raised, this " -"function will not return ``1``, but exit the process, as long as :c:member:" -"`PyConfig.inspect` is zero." -msgstr "" - -#: ../../c-api/veryhigh.rst:47 -msgid "Similar to :c:func:`Py_Main` but *argv* is an array of bytes strings." -msgstr "" - -#: ../../c-api/veryhigh.rst:54 -msgid "" "This is a simplified interface to :c:func:`PyRun_AnyFileExFlags` below, " "leaving *closeit* set to ``0`` and *flags* set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:60 +#: ../../c-api/veryhigh.rst:36 msgid "" "This is a simplified interface to :c:func:`PyRun_AnyFileExFlags` below, " "leaving the *closeit* argument set to ``0``." msgstr "" -#: ../../c-api/veryhigh.rst:66 +#: ../../c-api/veryhigh.rst:42 msgid "" "This is a simplified interface to :c:func:`PyRun_AnyFileExFlags` below, " "leaving the *flags* argument set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:72 +#: ../../c-api/veryhigh.rst:48 msgid "" "If *fp* refers to a file associated with an interactive device (console or " "terminal input or Unix pseudo-terminal), return the value of :c:func:" @@ -102,13 +78,13 @@ msgid "" "before ``PyRun_SimpleFileExFlags()`` returns." msgstr "" -#: ../../c-api/veryhigh.rst:84 +#: ../../c-api/veryhigh.rst:60 msgid "" "This is a simplified interface to :c:func:`PyRun_SimpleStringFlags` below, " "leaving the :c:struct:`PyCompilerFlags`\\* argument set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:90 +#: ../../c-api/veryhigh.rst:66 msgid "" "Executes the Python source code from *command* in the :mod:`__main__` module " "according to the *flags* argument. If :mod:`__main__` does not already " @@ -117,26 +93,26 @@ msgid "" "information. For the meaning of *flags*, see below." msgstr "" -#: ../../c-api/veryhigh.rst:96 +#: ../../c-api/veryhigh.rst:72 msgid "" "Note that if an otherwise unhandled :exc:`SystemExit` is raised, this " "function will not return ``-1``, but exit the process, as long as :c:member:" "`PyConfig.inspect` is zero." msgstr "" -#: ../../c-api/veryhigh.rst:103 +#: ../../c-api/veryhigh.rst:79 msgid "" "This is a simplified interface to :c:func:`PyRun_SimpleFileExFlags` below, " "leaving *closeit* set to ``0`` and *flags* set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:109 +#: ../../c-api/veryhigh.rst:85 msgid "" "This is a simplified interface to :c:func:`PyRun_SimpleFileExFlags` below, " "leaving *flags* set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:115 +#: ../../c-api/veryhigh.rst:91 msgid "" "Similar to :c:func:`PyRun_SimpleStringFlags`, but the Python source code is " "read from *fp* instead of an in-memory string. *filename* should be the name " @@ -145,20 +121,20 @@ msgid "" "``PyRun_SimpleFileExFlags()`` returns." msgstr "" -#: ../../c-api/veryhigh.rst:122 +#: ../../c-api/veryhigh.rst:98 msgid "" "On Windows, *fp* should be opened as binary mode (e.g. ``fopen(filename, " "\"rb\")``). Otherwise, Python may not handle script file with LF line ending " "correctly." msgstr "" -#: ../../c-api/veryhigh.rst:128 +#: ../../c-api/veryhigh.rst:104 msgid "" "This is a simplified interface to :c:func:`PyRun_InteractiveOneFlags` below, " "leaving *flags* set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:134 +#: ../../c-api/veryhigh.rst:110 msgid "" "Read and execute a single statement from a file associated with an " "interactive device according to the *flags* argument. The user will be " @@ -166,7 +142,7 @@ msgid "" "term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/veryhigh.rst:139 +#: ../../c-api/veryhigh.rst:115 msgid "" "Returns ``0`` when the input was executed successfully, ``-1`` if there was " "an exception, or an error code from the :file:`errcode.h` include file " @@ -175,13 +151,13 @@ msgid "" "specifically if needed.)" msgstr "" -#: ../../c-api/veryhigh.rst:148 +#: ../../c-api/veryhigh.rst:124 msgid "" "This is a simplified interface to :c:func:`PyRun_InteractiveLoopFlags` " "below, leaving *flags* set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:154 +#: ../../c-api/veryhigh.rst:130 msgid "" "Read and execute statements from a file associated with an interactive " "device until EOF is reached. The user will be prompted using ``sys.ps1`` " @@ -189,7 +165,7 @@ msgid "" "and error handler`. Returns ``0`` at EOF or a negative number upon failure." msgstr "" -#: ../../c-api/veryhigh.rst:162 +#: ../../c-api/veryhigh.rst:138 msgid "" "Can be set to point to a function with the prototype ``int func(void)``. " "The function will be called when Python's interpreter prompt is about to " @@ -199,13 +175,13 @@ msgid "" "the Python source code." msgstr "" -#: ../../c-api/veryhigh.rst:170 ../../c-api/veryhigh.rst:194 +#: ../../c-api/veryhigh.rst:146 ../../c-api/veryhigh.rst:170 msgid "" "This function is only called from the :ref:`main interpreter `." msgstr "" -#: ../../c-api/veryhigh.rst:177 +#: ../../c-api/veryhigh.rst:153 msgid "" "Can be set to point to a function with the prototype ``char *func(FILE " "*stdin, FILE *stdout, char *prompt)``, overriding the default function used " @@ -216,26 +192,26 @@ msgid "" "line-editing and tab-completion features." msgstr "" -#: ../../c-api/veryhigh.rst:186 +#: ../../c-api/veryhigh.rst:162 msgid "" "The result must be a string allocated by :c:func:`PyMem_RawMalloc` or :c:" "func:`PyMem_RawRealloc`, or ``NULL`` if an error occurred." msgstr "" -#: ../../c-api/veryhigh.rst:189 +#: ../../c-api/veryhigh.rst:165 msgid "" "The result must be allocated by :c:func:`PyMem_RawMalloc` or :c:func:" "`PyMem_RawRealloc`, instead of being allocated by :c:func:`PyMem_Malloc` or :" "c:func:`PyMem_Realloc`." msgstr "" -#: ../../c-api/veryhigh.rst:200 +#: ../../c-api/veryhigh.rst:176 msgid "" "This is a simplified interface to :c:func:`PyRun_StringFlags` below, leaving " "*flags* set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:206 +#: ../../c-api/veryhigh.rst:182 msgid "" "Execute Python source code from *str* in the context specified by the " "objects *globals* and *locals* with the compiler flags specified by " @@ -244,31 +220,31 @@ msgid "" "token that should be used to parse the source code." msgstr "" -#: ../../c-api/veryhigh.rst:212 +#: ../../c-api/veryhigh.rst:188 msgid "" "Returns the result of executing the code as a Python object, or ``NULL`` if " "an exception was raised." msgstr "" -#: ../../c-api/veryhigh.rst:218 +#: ../../c-api/veryhigh.rst:194 msgid "" "This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving " "*closeit* set to ``0`` and *flags* set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:224 +#: ../../c-api/veryhigh.rst:200 msgid "" "This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving " "*flags* set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:230 +#: ../../c-api/veryhigh.rst:206 msgid "" "This is a simplified interface to :c:func:`PyRun_FileExFlags` below, leaving " "*closeit* set to ``0``." msgstr "" -#: ../../c-api/veryhigh.rst:236 +#: ../../c-api/veryhigh.rst:212 msgid "" "Similar to :c:func:`PyRun_StringFlags`, but the Python source code is read " "from *fp* instead of an in-memory string. *filename* should be the name of " @@ -277,19 +253,19 @@ msgid "" "`PyRun_FileExFlags` returns." msgstr "" -#: ../../c-api/veryhigh.rst:245 +#: ../../c-api/veryhigh.rst:221 msgid "" "This is a simplified interface to :c:func:`Py_CompileStringFlags` below, " "leaving *flags* set to ``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:251 +#: ../../c-api/veryhigh.rst:227 msgid "" "This is a simplified interface to :c:func:`Py_CompileStringExFlags` below, " "with *optimize* set to ``-1``." msgstr "" -#: ../../c-api/veryhigh.rst:257 +#: ../../c-api/veryhigh.rst:233 msgid "" "Parse and compile the Python source code in *str*, returning the resulting " "code object. The start token is given by *start*; this can be used to " @@ -300,7 +276,7 @@ msgid "" "returns ``NULL`` if the code cannot be parsed or compiled." msgstr "" -#: ../../c-api/veryhigh.rst:265 +#: ../../c-api/veryhigh.rst:241 msgid "" "The integer *optimize* specifies the optimization level of the compiler; a " "value of ``-1`` selects the optimization level of the interpreter as given " @@ -309,20 +285,20 @@ msgid "" "or ``2`` (docstrings are removed too)." msgstr "" -#: ../../c-api/veryhigh.rst:276 +#: ../../c-api/veryhigh.rst:252 msgid "" "Like :c:func:`Py_CompileStringObject`, but *filename* is a byte string " "decoded from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/veryhigh.rst:283 +#: ../../c-api/veryhigh.rst:259 msgid "" "This is a simplified interface to :c:func:`PyEval_EvalCodeEx`, with just the " "code object, and global and local variables. The other arguments are set to " "``NULL``." msgstr "" -#: ../../c-api/veryhigh.rst:290 +#: ../../c-api/veryhigh.rst:266 msgid "" "Evaluate a precompiled code object, given a particular environment for its " "evaluation. This environment consists of a dictionary of global variables, " @@ -331,13 +307,13 @@ msgid "" "only_parameter>` arguments and a closure tuple of cells." msgstr "" -#: ../../c-api/veryhigh.rst:299 +#: ../../c-api/veryhigh.rst:275 msgid "" "Evaluate an execution frame. This is a simplified interface to :c:func:" "`PyEval_EvalFrameEx`, for backward compatibility." msgstr "" -#: ../../c-api/veryhigh.rst:305 +#: ../../c-api/veryhigh.rst:281 msgid "" "This is the main, unvarnished function of Python interpretation. The code " "object associated with the execution frame *f* is executed, interpreting " @@ -347,39 +323,39 @@ msgid "" "of generator objects." msgstr "" -#: ../../c-api/veryhigh.rst:312 +#: ../../c-api/veryhigh.rst:288 msgid "" "This function now includes a debug assertion to help ensure that it does not " "silently discard an active exception." msgstr "" -#: ../../c-api/veryhigh.rst:319 +#: ../../c-api/veryhigh.rst:295 msgid "" "This function changes the flags of the current evaluation frame, and returns " "true on success, false on failure." msgstr "" -#: ../../c-api/veryhigh.rst:327 +#: ../../c-api/veryhigh.rst:303 msgid "" "The start symbol from the Python grammar for isolated expressions; for use " "with :c:func:`Py_CompileString`." msgstr "" -#: ../../c-api/veryhigh.rst:335 +#: ../../c-api/veryhigh.rst:311 msgid "" "The start symbol from the Python grammar for sequences of statements as read " "from a file or other source; for use with :c:func:`Py_CompileString`. This " "is the symbol to use when compiling arbitrarily long Python source code." msgstr "" -#: ../../c-api/veryhigh.rst:344 +#: ../../c-api/veryhigh.rst:320 msgid "" "The start symbol from the Python grammar for a single statement; for use " "with :c:func:`Py_CompileString`. This is the symbol used for the interactive " "interpreter loop." msgstr "" -#: ../../c-api/veryhigh.rst:351 +#: ../../c-api/veryhigh.rst:327 msgid "" "This is the structure used to hold compiler flags. In cases where code is " "only being compiled, it is passed as ``int flags``, and in cases where code " @@ -387,40 +363,40 @@ msgid "" "case, ``from __future__ import`` can modify *flags*." msgstr "" -#: ../../c-api/veryhigh.rst:356 +#: ../../c-api/veryhigh.rst:332 msgid "" "Whenever ``PyCompilerFlags *flags`` is ``NULL``, :c:member:`~PyCompilerFlags." "cf_flags` is treated as equal to ``0``, and any modification due to ``from " "__future__ import`` is discarded." msgstr "" -#: ../../c-api/veryhigh.rst:362 +#: ../../c-api/veryhigh.rst:338 msgid "Compiler flags." msgstr "" -#: ../../c-api/veryhigh.rst:366 +#: ../../c-api/veryhigh.rst:342 msgid "" "*cf_feature_version* is the minor Python version. It should be initialized " "to ``PY_MINOR_VERSION``." msgstr "" -#: ../../c-api/veryhigh.rst:369 +#: ../../c-api/veryhigh.rst:345 msgid "" "The field is ignored by default, it is used if and only if ``PyCF_ONLY_AST`` " "flag is set in :c:member:`~PyCompilerFlags.cf_flags`." msgstr "" -#: ../../c-api/veryhigh.rst:372 +#: ../../c-api/veryhigh.rst:348 msgid "Added *cf_feature_version* field." msgstr "新增 *cf_feature_version* 欄位。" -#: ../../c-api/veryhigh.rst:378 +#: ../../c-api/veryhigh.rst:354 msgid "" "This bit can be set in *flags* to cause division operator ``/`` to be " "interpreted as \"true division\" according to :pep:`238`." msgstr "" -#: ../../c-api/veryhigh.rst:325 ../../c-api/veryhigh.rst:333 -#: ../../c-api/veryhigh.rst:342 +#: ../../c-api/veryhigh.rst:301 ../../c-api/veryhigh.rst:309 +#: ../../c-api/veryhigh.rst:318 msgid "Py_CompileString (C function)" msgstr "Py_CompileString(C 函式)" diff --git a/deprecations/index.po b/deprecations/index.po index 7634be6157..24c3129544 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-28 00:13+0000\n" +"POT-Creation-Date: 2024-10-10 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,6 +25,22 @@ msgid "Pending Removal in Python 3.14" msgstr "Python 3.14 中待移除的項目" #: ../../deprecations/pending-removal-in-3.14.rst:4 +#: ../../deprecations/pending-removal-in-3.15.rst:4 +msgid "The import system:" +msgstr "引入系統 (import system):" + +#: ../../deprecations/pending-removal-in-3.14.rst:6 +msgid "" +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.14, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." +msgstr "" +"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " +"` 的做法已被棄用。在 Python 3.14 中," +"引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__` 。" + +#: ../../deprecations/pending-removal-in-3.14.rst:11 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" "argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " @@ -34,7 +50,7 @@ msgstr "" "*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " "於 :gh:`92248` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:9 +#: ../../deprecations/pending-removal-in-3.14.rst:16 msgid "" ":mod:`ast`: The following features have been deprecated in documentation " "since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " @@ -43,38 +59,38 @@ msgstr "" ":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時會" "於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" -#: ../../deprecations/pending-removal-in-3.14.rst:13 +#: ../../deprecations/pending-removal-in-3.14.rst:20 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" -#: ../../deprecations/pending-removal-in-3.14.rst:14 +#: ../../deprecations/pending-removal-in-3.14.rst:21 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" -#: ../../deprecations/pending-removal-in-3.14.rst:15 +#: ../../deprecations/pending-removal-in-3.14.rst:22 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" -#: ../../deprecations/pending-removal-in-3.14.rst:16 +#: ../../deprecations/pending-removal-in-3.14.rst:23 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" -#: ../../deprecations/pending-removal-in-3.14.rst:17 +#: ../../deprecations/pending-removal-in-3.14.rst:24 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" -#: ../../deprecations/pending-removal-in-3.14.rst:19 +#: ../../deprecations/pending-removal-in-3.14.rst:26 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" "`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.14.rst:29 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" -#: ../../deprecations/pending-removal-in-3.14.rst:24 +#: ../../deprecations/pending-removal-in-3.14.rst:31 msgid "" "The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" "`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" @@ -86,7 +102,7 @@ msgstr "" "AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " "Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:30 +#: ../../deprecations/pending-removal-in-3.14.rst:37 msgid "" ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" "`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." @@ -98,7 +114,7 @@ msgstr "" "AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" "除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:36 +#: ../../deprecations/pending-removal-in-3.14.rst:43 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " "now emits a :exc:`DeprecationWarning` if there is no current event loop set " @@ -109,7 +125,7 @@ msgstr "" "件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:41 +#: ../../deprecations/pending-removal-in-3.14.rst:48 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " @@ -121,7 +137,7 @@ msgstr "" "改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " "Shantanu Jain 於 :gh:`91896` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:47 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid "" ":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" @@ -129,39 +145,39 @@ msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:50 +#: ../../deprecations/pending-removal-in-3.14.rst:57 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:52 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:53 +#: ../../deprecations/pending-removal-in-3.14.rst:60 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:54 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:58 +#: ../../deprecations/pending-removal-in-3.14.rst:65 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:66 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:68 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:63 +#: ../../deprecations/pending-removal-in-3.14.rst:70 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -172,7 +188,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:69 +#: ../../deprecations/pending-removal-in-3.14.rst:76 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -189,7 +205,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:77 +#: ../../deprecations/pending-removal-in-3.14.rst:84 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -197,7 +213,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:81 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -207,27 +223,27 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:86 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:88 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:96 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:98 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../deprecations/pending-removal-in-3.14.rst:93 +#: ../../deprecations/pending-removal-in-3.14.rst:100 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:95 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -237,7 +253,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:99 +#: ../../deprecations/pending-removal-in-3.14.rst:106 msgid "" "date and datetime adapter, date and timestamp converter: see the :mod:" "`sqlite3` documentation for suggested replacement recipes." @@ -245,7 +261,7 @@ msgstr "" "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" "參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:109 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -257,7 +273,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:109 +#: ../../deprecations/pending-removal-in-3.14.rst:116 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -265,7 +281,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:112 +#: ../../deprecations/pending-removal-in-3.14.rst:119 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -279,22 +295,44 @@ msgstr "" msgid "Pending Removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" -#: ../../deprecations/pending-removal-in-3.15.rst:4 +#: ../../deprecations/pending-removal-in-3.15.rst:6 +msgid "" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" +msgstr "" +"在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " +"` 的做法已被棄用。在 Python 3.15 中," +"引入系統或標準函式庫將不再設定或考慮 :attr:`!__cached__`。(:gh:`97879`)" + +#: ../../deprecations/pending-removal-in-3.15.rst:11 +msgid "" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" +msgstr "" +"在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " +"` 的做法已被棄用。在 Python 3.15 中," +"引入系統或標準函式庫將不再設定或考慮 :attr:`!__package__`。(:gh:`97879`)" + +#: ../../deprecations/pending-removal-in-3.15.rst:16 msgid ":mod:`ctypes`:" msgstr ":mod:`ctypes`:" -#: ../../deprecations/pending-removal-in-3.15.rst:6 +#: ../../deprecations/pending-removal-in-3.15.rst:18 msgid "" "The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " "since Python 3.13." msgstr "" "自 Python 3.13 起,未記錄的 :func:`!ctypes.SetPointerType` 函式已被棄用。" -#: ../../deprecations/pending-removal-in-3.15.rst:9 +#: ../../deprecations/pending-removal-in-3.15.rst:21 msgid ":mod:`http.server`:" msgstr ":mod:`http.server`:" -#: ../../deprecations/pending-removal-in-3.15.rst:11 +#: ../../deprecations/pending-removal-in-3.15.rst:23 msgid "" "The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " "been deprecated since Python 3.13. No direct replacement exists. *Anything* " @@ -304,7 +342,7 @@ msgstr "" "起已被棄用。不存在直接的替代。*任何東西*\\ 都比 CGI 更好地將 Web 伺服器與請求" "處理程序介接起來。" -#: ../../deprecations/pending-removal-in-3.15.rst:17 +#: ../../deprecations/pending-removal-in-3.15.rst:29 msgid "" "The :option:`!--cgi` flag to the :program:`python -m http.server` command-" "line interface has been deprecated since Python 3.13." @@ -312,19 +350,11 @@ msgstr "" "自 Python 3.13 起,:program:`python -m http.server` 命令列介面的 :option:`!--" "cgi` 旗標已被棄用。" -#: ../../deprecations/pending-removal-in-3.15.rst:20 -msgid "" -":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " -"taken into consideration by the import system (:gh:`97879`)." -msgstr "" -":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " -"系統考慮。 (:gh:`97879`)" - -#: ../../deprecations/pending-removal-in-3.15.rst:23 +#: ../../deprecations/pending-removal-in-3.15.rst:32 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:25 +#: ../../deprecations/pending-removal-in-3.15.rst:34 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" @@ -337,11 +367,11 @@ msgstr "" "`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." "getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:33 +#: ../../deprecations/pending-removal-in-3.15.rst:42 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:35 +#: ../../deprecations/pending-removal-in-3.15.rst:44 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows." @@ -349,11 +379,11 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." "isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:39 +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:41 +#: ../../deprecations/pending-removal-in-3.15.rst:50 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -362,11 +392,11 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:45 +#: ../../deprecations/pending-removal-in-3.15.rst:54 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:47 +#: ../../deprecations/pending-removal-in-3.15.rst:56 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -377,11 +407,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:53 +#: ../../deprecations/pending-removal-in-3.15.rst:62 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.15.rst:55 +#: ../../deprecations/pending-removal-in-3.15.rst:64 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -392,7 +422,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:61 +#: ../../deprecations/pending-removal-in-3.15.rst:70 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -402,11 +432,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:66 +#: ../../deprecations/pending-removal-in-3.15.rst:75 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:68 +#: ../../deprecations/pending-removal-in-3.15.rst:77 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -669,6 +699,8 @@ msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" +"`~logging.warning`。" #: ../../deprecations/pending-removal-in-future.rst:72 msgid "" diff --git a/deprecations/pending-removal-in-3.14.po b/deprecations/pending-removal-in-3.14.po index 615e97ede1..a552eb8e16 100644 --- a/deprecations/pending-removal-in-3.14.po +++ b/deprecations/pending-removal-in-3.14.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-28 00:13+0000\n" +"POT-Creation-Date: 2024-10-15 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -21,6 +20,21 @@ msgid "Pending Removal in Python 3.14" msgstr "Python 3.14 中待移除的項目" #: ../../deprecations/pending-removal-in-3.14.rst:4 +msgid "The import system:" +msgstr "引入系統 (import system):" + +#: ../../deprecations/pending-removal-in-3.14.rst:6 +msgid "" +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.14, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." +msgstr "" +"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " +"` 的做法已被棄用。在 Python 3.14 中," +"引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__` 。" + +#: ../../deprecations/pending-removal-in-3.14.rst:11 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" "argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " @@ -30,7 +44,7 @@ msgstr "" "*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " "於 :gh:`92248` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:9 +#: ../../deprecations/pending-removal-in-3.14.rst:16 msgid "" ":mod:`ast`: The following features have been deprecated in documentation " "since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " @@ -39,38 +53,38 @@ msgstr "" ":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時會" "於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" -#: ../../deprecations/pending-removal-in-3.14.rst:13 +#: ../../deprecations/pending-removal-in-3.14.rst:20 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" -#: ../../deprecations/pending-removal-in-3.14.rst:14 +#: ../../deprecations/pending-removal-in-3.14.rst:21 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" -#: ../../deprecations/pending-removal-in-3.14.rst:15 +#: ../../deprecations/pending-removal-in-3.14.rst:22 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" -#: ../../deprecations/pending-removal-in-3.14.rst:16 +#: ../../deprecations/pending-removal-in-3.14.rst:23 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" -#: ../../deprecations/pending-removal-in-3.14.rst:17 +#: ../../deprecations/pending-removal-in-3.14.rst:24 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" -#: ../../deprecations/pending-removal-in-3.14.rst:19 +#: ../../deprecations/pending-removal-in-3.14.rst:26 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" "`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.14.rst:29 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" -#: ../../deprecations/pending-removal-in-3.14.rst:24 +#: ../../deprecations/pending-removal-in-3.14.rst:31 msgid "" "The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" "`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" @@ -82,7 +96,7 @@ msgstr "" "AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " "Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:30 +#: ../../deprecations/pending-removal-in-3.14.rst:37 msgid "" ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" "`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." @@ -94,7 +108,7 @@ msgstr "" "AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" "除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:36 +#: ../../deprecations/pending-removal-in-3.14.rst:43 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " "now emits a :exc:`DeprecationWarning` if there is no current event loop set " @@ -105,7 +119,7 @@ msgstr "" "件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:41 +#: ../../deprecations/pending-removal-in-3.14.rst:48 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " @@ -117,7 +131,7 @@ msgstr "" "改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " "Shantanu Jain 於 :gh:`91896` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:47 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid "" ":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" @@ -125,39 +139,39 @@ msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:50 +#: ../../deprecations/pending-removal-in-3.14.rst:57 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:52 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:53 +#: ../../deprecations/pending-removal-in-3.14.rst:60 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:54 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:58 +#: ../../deprecations/pending-removal-in-3.14.rst:65 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:66 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:68 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:63 +#: ../../deprecations/pending-removal-in-3.14.rst:70 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -168,7 +182,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:69 +#: ../../deprecations/pending-removal-in-3.14.rst:76 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -185,7 +199,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:77 +#: ../../deprecations/pending-removal-in-3.14.rst:84 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -193,7 +207,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:81 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -203,27 +217,27 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:86 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:88 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:96 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:98 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../deprecations/pending-removal-in-3.14.rst:93 +#: ../../deprecations/pending-removal-in-3.14.rst:100 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:95 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -233,7 +247,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:99 +#: ../../deprecations/pending-removal-in-3.14.rst:106 msgid "" "date and datetime adapter, date and timestamp converter: see the :mod:" "`sqlite3` documentation for suggested replacement recipes." @@ -241,7 +255,7 @@ msgstr "" "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" "參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:109 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -253,7 +267,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:109 +#: ../../deprecations/pending-removal-in-3.14.rst:116 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -261,7 +275,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:112 +#: ../../deprecations/pending-removal-in-3.14.rst:119 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index d160dbfc7a..1fc15168f5 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-28 00:13+0000\n" +"POT-Creation-Date: 2024-10-15 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -21,21 +20,47 @@ msgid "Pending Removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" #: ../../deprecations/pending-removal-in-3.15.rst:4 +msgid "The import system:" +msgstr "引入系統 (import system):" + +#: ../../deprecations/pending-removal-in-3.15.rst:6 +msgid "" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" +msgstr "" +"在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " +"` 的做法已被棄用。在 Python 3.15 中," +"引入系統或標準函式庫將不再設定或考慮 :attr:`!__cached__`。(:gh:`97879`)" + +#: ../../deprecations/pending-removal-in-3.15.rst:11 +msgid "" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" +msgstr "" +"在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " +"` 的做法已被棄用。在 Python 3.15 中," +"引入系統或標準函式庫將不再設定或考慮 :attr:`!__package__`。(:gh:`97879`)" + +#: ../../deprecations/pending-removal-in-3.15.rst:16 msgid ":mod:`ctypes`:" msgstr ":mod:`ctypes`:" -#: ../../deprecations/pending-removal-in-3.15.rst:6 +#: ../../deprecations/pending-removal-in-3.15.rst:18 msgid "" "The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " "since Python 3.13." msgstr "" "自 Python 3.13 起,未記錄的 :func:`!ctypes.SetPointerType` 函式已被棄用。" -#: ../../deprecations/pending-removal-in-3.15.rst:9 +#: ../../deprecations/pending-removal-in-3.15.rst:21 msgid ":mod:`http.server`:" msgstr ":mod:`http.server`:" -#: ../../deprecations/pending-removal-in-3.15.rst:11 +#: ../../deprecations/pending-removal-in-3.15.rst:23 msgid "" "The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " "been deprecated since Python 3.13. No direct replacement exists. *Anything* " @@ -45,7 +70,7 @@ msgstr "" "起已被棄用。不存在直接的替代。*任何東西*\\ 都比 CGI 更好地將 Web 伺服器與請求" "處理程序介接起來。" -#: ../../deprecations/pending-removal-in-3.15.rst:17 +#: ../../deprecations/pending-removal-in-3.15.rst:29 msgid "" "The :option:`!--cgi` flag to the :program:`python -m http.server` command-" "line interface has been deprecated since Python 3.13." @@ -53,19 +78,11 @@ msgstr "" "自 Python 3.13 起,:program:`python -m http.server` 命令列介面的 :option:`!--" "cgi` 旗標已被棄用。" -#: ../../deprecations/pending-removal-in-3.15.rst:20 -msgid "" -":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " -"taken into consideration by the import system (:gh:`97879`)." -msgstr "" -":mod:`importlib`:引入系統將不再設定或考慮 ``__package__`` 和 ``__cached__`` " -"(:gh:`97879`)。" - -#: ../../deprecations/pending-removal-in-3.15.rst:23 +#: ../../deprecations/pending-removal-in-3.15.rst:32 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:25 +#: ../../deprecations/pending-removal-in-3.15.rst:34 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" @@ -78,11 +95,11 @@ msgstr "" "`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." "getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:33 +#: ../../deprecations/pending-removal-in-3.15.rst:42 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:35 +#: ../../deprecations/pending-removal-in-3.15.rst:44 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows." @@ -90,11 +107,11 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." "isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:39 +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:41 +#: ../../deprecations/pending-removal-in-3.15.rst:50 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -103,11 +120,11 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:45 +#: ../../deprecations/pending-removal-in-3.15.rst:54 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:47 +#: ../../deprecations/pending-removal-in-3.15.rst:56 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -118,11 +135,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:53 +#: ../../deprecations/pending-removal-in-3.15.rst:62 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.15.rst:55 +#: ../../deprecations/pending-removal-in-3.15.rst:64 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -133,7 +150,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:61 +#: ../../deprecations/pending-removal-in-3.15.rst:70 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -143,11 +160,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:66 +#: ../../deprecations/pending-removal-in-3.15.rst:75 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:68 +#: ../../deprecations/pending-removal-in-3.15.rst:77 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" diff --git a/deprecations/pending-removal-in-future.po b/deprecations/pending-removal-in-future.po index c46ed6f7d3..80f5e1023a 100644 --- a/deprecations/pending-removal-in-future.po +++ b/deprecations/pending-removal-in-future.po @@ -185,6 +185,8 @@ msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" +"`~logging.warning`。" #: ../../deprecations/pending-removal-in-future.rst:72 msgid "" diff --git a/glossary.po b/glossary.po index a882706b5e..92507365c3 100644 --- a/glossary.po +++ b/glossary.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-10-14 00:14+0000\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -534,10 +534,66 @@ msgstr "" "修改的變數。" #: ../../glossary.rst:228 +msgid "closure variable" +msgstr "closure variable(閉包變數)" + +#: ../../glossary.rst:230 +msgid "" +"A :term:`free variable` referenced from a :term:`nested scope` that is " +"defined in an outer scope rather than being resolved at runtime from the " +"globals or builtin namespaces. May be explicitly defined with the :keyword:" +"`nonlocal` keyword to allow write access, or implicitly defined if the " +"variable is only being read." +msgstr "" +"從外部作用域中定義且從\\ :term:`巢狀作用域 `\\ 參照的\\ :term:`" +"自由變數 `,不是於 runtime 從全域或內建命名空間解析。可以使" +"用 :keyword:`nonlocal` 關鍵字明確定義以允許寫入存取,或者如果僅需讀取變數則隱" +"式定義即可。" + +#: ../../glossary.rst:235 +msgid "" +"For example, in the ``inner`` function in the following code, both ``x`` and " +"``print`` are :term:`free variables `, but only ``x`` is a " +"*closure variable*::" +msgstr "" +"例如在下面程式碼中的 ``inner`` 函式中,``x`` 和 ``print`` 都是\\ :term:`自由" +"變數 `,但只有 ``x`` 是\\ *閉包變數*: ::" + +#: ../../glossary.rst:238 +msgid "" +"def outer():\n" +" x = 0\n" +" def inner():\n" +" nonlocal x\n" +" x += 1\n" +" print(x)\n" +" return inner" +msgstr "" +"def outer():\n" +" x = 0\n" +" def inner():\n" +" nonlocal x\n" +" x += 1\n" +" print(x)\n" +" return inner" + +#: ../../glossary.rst:246 +msgid "" +"Due to the :attr:`codeobject.co_freevars` attribute (which, despite its " +"name, only includes the names of closure variables rather than listing all " +"referenced free variables), the more general :term:`free variable` term is " +"sometimes used even when the intended meaning is to refer specifically to " +"closure variables." +msgstr "" +"由於 :attr:`codeobject.co_freevars` 屬性(儘管名稱如此,但它僅包含閉包變數的" +"名稱,而不是列出所有參照的自由變數),當預期含義是特指閉包變數時,有時候甚至" +"也會使用更通用的\\ :term:`自由變數 `\\ 一詞。" + +#: ../../glossary.rst:250 msgid "complex number" msgstr "complex number(複數)" -#: ../../glossary.rst:230 +#: ../../glossary.rst:252 msgid "" "An extension of the familiar real number system in which all numbers are " "expressed as a sum of a real part and an imaginary part. Imaginary numbers " @@ -557,11 +613,11 @@ msgstr "" "相當進階的數學功能。如果你沒有察覺到對它們的需求,那麼幾乎能確定你可以安全地" "忽略它們。" -#: ../../glossary.rst:240 +#: ../../glossary.rst:262 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../glossary.rst:242 +#: ../../glossary.rst:264 msgid "" "An object which controls the environment seen in a :keyword:`with` statement " "by defining :meth:`~object.__enter__` and :meth:`~object.__exit__` methods. " @@ -571,11 +627,11 @@ msgstr "" "`~object.__enter__` 和 :meth:`~object.__exit__` method 來控制的。請參閱 :pep:" "`343`。" -#: ../../glossary.rst:245 +#: ../../glossary.rst:267 msgid "context variable" msgstr "context variable(情境變數)" -#: ../../glossary.rst:247 +#: ../../glossary.rst:269 msgid "" "A variable which can have different values depending on its context. This is " "similar to Thread-Local Storage in which each execution thread may have a " @@ -590,11 +646,11 @@ msgstr "" "任務 (concurrent asynchronous task) 中,對於變數狀態的追蹤。請參閱 :mod:" "`contextvars`。" -#: ../../glossary.rst:254 +#: ../../glossary.rst:276 msgid "contiguous" msgstr "contiguous(連續的)" -#: ../../glossary.rst:258 +#: ../../glossary.rst:280 msgid "" "A buffer is considered contiguous exactly if it is either *C-contiguous* or " "*Fortran contiguous*. Zero-dimensional buffers are C and Fortran " @@ -611,11 +667,11 @@ msgstr "" "的順序訪問各個項目時,最後一個索引的變化最快。然而,在 Fortran contiguous 陣" "列中,第一個索引的變化最快。" -#: ../../glossary.rst:266 +#: ../../glossary.rst:288 msgid "coroutine" msgstr "coroutine(協程)" -#: ../../glossary.rst:268 +#: ../../glossary.rst:290 msgid "" "Coroutines are a more generalized form of subroutines. Subroutines are " "entered at one point and exited at another point. Coroutines can be " @@ -626,11 +682,11 @@ msgstr "" "在另一個時間點被退出。協程可以在許多不同的時間點被進入、退出和回復。它們能夠" "以 :keyword:`async def` 陳述式被實作。另請參閱 :pep:`492`。" -#: ../../glossary.rst:273 +#: ../../glossary.rst:295 msgid "coroutine function" msgstr "coroutine function(協程函式)" -#: ../../glossary.rst:275 +#: ../../glossary.rst:297 msgid "" "A function which returns a :term:`coroutine` object. A coroutine function " "may be defined with the :keyword:`async def` statement, and may contain :" @@ -641,11 +697,11 @@ msgstr "" "`async def` 陳述式被定義,並可能會包含 :keyword:`await`、:keyword:`async " "for` 和 :keyword:`async with` 關鍵字。這些關鍵字由 :pep:`492` 引入。" -#: ../../glossary.rst:280 +#: ../../glossary.rst:302 msgid "CPython" msgstr "CPython" -#: ../../glossary.rst:282 +#: ../../glossary.rst:304 msgid "" "The canonical implementation of the Python programming language, as " "distributed on `python.org `_. The term \"CPython\" " @@ -656,11 +712,11 @@ msgstr "" "`_ 上。「CPython」這個術語在必要時被使用,以區分此實" "作與其它語言的實作,例如 Jython 或 IronPython。" -#: ../../glossary.rst:286 +#: ../../glossary.rst:308 msgid "decorator" msgstr "decorator(裝飾器)" -#: ../../glossary.rst:288 +#: ../../glossary.rst:310 msgid "" "A function returning another function, usually applied as a function " "transformation using the ``@wrapper`` syntax. Common examples for " @@ -670,13 +726,13 @@ msgstr "" "式的變換 (function transformation)。裝飾器的常見範例是 :func:`classmethod` " "和 :func:`staticmethod`。" -#: ../../glossary.rst:292 +#: ../../glossary.rst:314 msgid "" "The decorator syntax is merely syntactic sugar, the following two function " "definitions are semantically equivalent::" msgstr "裝飾器語法只是語法糖。以下兩個函式定義在語義上是等效的: ::" -#: ../../glossary.rst:295 +#: ../../glossary.rst:317 msgid "" "def f(arg):\n" " ...\n" @@ -694,7 +750,7 @@ msgstr "" "def f(arg):\n" " ..." -#: ../../glossary.rst:303 +#: ../../glossary.rst:325 msgid "" "The same concept exists for classes, but is less commonly used there. See " "the documentation for :ref:`function definitions ` and :ref:`class " @@ -703,11 +759,11 @@ msgstr "" "Class 也存在相同的概念,但在那裡比較不常用。關於裝飾器的更多內容,請參閱\\ :" "ref:`函式定義 `\\ 和 :ref:`class 定義 `\\ 的說明文件。" -#: ../../glossary.rst:306 +#: ../../glossary.rst:328 msgid "descriptor" msgstr "descriptor(描述器)" -#: ../../glossary.rst:308 +#: ../../glossary.rst:330 msgid "" "Any object which defines the methods :meth:`~object.__get__`, :meth:`~object." "__set__`, or :meth:`~object.__delete__`. When a class attribute is a " @@ -727,7 +783,7 @@ msgstr "" "們是許多功能的基礎,這些功能包括函式、method、屬性 (property)、class method、" "靜態 method,以及對 super class(父類別)的參照。" -#: ../../glossary.rst:319 +#: ../../glossary.rst:341 msgid "" "For more information about descriptors' methods, see :ref:`descriptors` or " "the :ref:`Descriptor How To Guide `." @@ -735,11 +791,11 @@ msgstr "" "關於描述器 method 的更多資訊,請參閱\\ :ref:`descriptors`\\ 或\\ :ref:`描述器" "使用指南 `。" -#: ../../glossary.rst:321 +#: ../../glossary.rst:343 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../glossary.rst:323 +#: ../../glossary.rst:345 msgid "" "An associative array, where arbitrary keys are mapped to values. The keys " "can be any object with :meth:`~object.__hash__` and :meth:`~object.__eq__` " @@ -749,11 +805,11 @@ msgstr "" "有 :meth:`~object.__hash__` 和 :meth:`~object.__eq__` method 的物件。在 Perl " "中被稱為雜湊 (hash)。" -#: ../../glossary.rst:327 +#: ../../glossary.rst:349 msgid "dictionary comprehension" msgstr "dictionary comprehension(字典綜合運算)" -#: ../../glossary.rst:329 +#: ../../glossary.rst:351 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a dictionary with the results. ``results = {n: n ** 2 for n in " @@ -764,11 +820,11 @@ msgstr "" "字典回傳。``results = {n: n ** 2 for n in range(10)}`` 會產生一個字典,它包含" "了鍵 ``n`` 對映到值 ``n ** 2``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:333 +#: ../../glossary.rst:355 msgid "dictionary view" msgstr "dictionary view(字典檢視)" -#: ../../glossary.rst:335 +#: ../../glossary.rst:357 msgid "" "The objects returned from :meth:`dict.keys`, :meth:`dict.values`, and :meth:" "`dict.items` are called dictionary views. They provide a dynamic view on the " @@ -781,11 +837,11 @@ msgstr "" "反映這些變動。若要強制將字典檢視轉為完整的 list(串列),須使用 " "``list(dictview)``。請參閱\\ :ref:`dict-views`。" -#: ../../glossary.rst:341 +#: ../../glossary.rst:363 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../glossary.rst:343 +#: ../../glossary.rst:365 msgid "" "A string literal which appears as the first expression in a class, function " "or module. While ignored when the suite is executed, it is recognized by " @@ -798,11 +854,11 @@ msgstr "" "`~definition.__doc__` 屬性中。由於說明字串可以透過內省 (introspection) 來瀏" "覽,因此它是物件的說明文件存放的標準位置。" -#: ../../glossary.rst:349 +#: ../../glossary.rst:371 msgid "duck-typing" msgstr "duck-typing(鴨子型別)" -#: ../../glossary.rst:351 +#: ../../glossary.rst:373 msgid "" "A programming style which does not look at an object's type to determine if " "it has the right interface; instead, the method or attribute is simply " @@ -823,11 +879,11 @@ msgstr "" "來補充。)然而,它通常會採用 :func:`hasattr` 測試,或是 :term:`EAFP` 程式設計" "風格。" -#: ../../glossary.rst:360 +#: ../../glossary.rst:382 msgid "EAFP" msgstr "EAFP" -#: ../../glossary.rst:362 +#: ../../glossary.rst:384 msgid "" "Easier to ask for forgiveness than permission. This common Python coding " "style assumes the existence of valid keys or attributes and catches " @@ -842,11 +898,11 @@ msgstr "" "keyword:`except` 陳述式。該技術與許多其他語言(例如 C)常見的 :term:`LBYL` 風" "格形成了對比。" -#: ../../glossary.rst:368 +#: ../../glossary.rst:390 msgid "expression" msgstr "expression(運算式)" -#: ../../glossary.rst:370 +#: ../../glossary.rst:392 msgid "" "A piece of syntax which can be evaluated to some value. In other words, an " "expression is an accumulation of expression elements like literals, names, " @@ -862,11 +918,11 @@ msgstr "" "(陳述式)不能被用作運算式,例如 :keyword:`while`。賦值 (assignment) 也是陳述" "式,而不是運算式。" -#: ../../glossary.rst:377 +#: ../../glossary.rst:399 msgid "extension module" msgstr "extension module(擴充模組)" -#: ../../glossary.rst:379 +#: ../../glossary.rst:401 msgid "" "A module written in C or C++, using Python's C API to interact with the core " "and with user code." @@ -874,11 +930,11 @@ msgstr "" "一個以 C 或 C++ 編寫的模組,它使用 Python 的 C API 來與核心及使用者程式碼進行" "互動。" -#: ../../glossary.rst:381 +#: ../../glossary.rst:403 msgid "f-string" msgstr "f-string(f 字串)" -#: ../../glossary.rst:383 +#: ../../glossary.rst:405 msgid "" "String literals prefixed with ``'f'`` or ``'F'`` are commonly called \"f-" "strings\" which is short for :ref:`formatted string literals `. " @@ -887,11 +943,11 @@ msgstr "" "以 ``'f'`` 或 ``'F'`` 為前綴的字串文本通常被稱為「f 字串」,它是\\ :ref:`格式" "化的字串文本 `\\ 的縮寫。另請參閱 :pep:`498`。" -#: ../../glossary.rst:386 +#: ../../glossary.rst:408 msgid "file object" msgstr "file object(檔案物件)" -#: ../../glossary.rst:388 +#: ../../glossary.rst:410 msgid "" "An object exposing a file-oriented API (with methods such as :meth:`!read` " "or :meth:`!write`) to an underlying resource. Depending on the way it was " @@ -906,7 +962,7 @@ msgstr "" "衝區、socket(插座)、管線 (pipe) 等)的存取。檔案物件也被稱為\\ :dfn:`類檔案" "物件 (file-like object)` 或\\ :dfn:`串流 (stream)`。" -#: ../../glossary.rst:396 +#: ../../glossary.rst:418 msgid "" "There are actually three categories of file objects: raw :term:`binary files " "`, buffered :term:`binary files ` and :term:`text " @@ -918,19 +974,19 @@ msgstr "" "term:`二進位檔案 `\\ 和\\ :term:`文字檔案 `。它們的介" "面在 :mod:`io` 模組中被定義。建立檔案物件的標準方法是使用 :func:`open` 函式。" -#: ../../glossary.rst:401 +#: ../../glossary.rst:423 msgid "file-like object" msgstr "file-like object(類檔案物件)" -#: ../../glossary.rst:403 +#: ../../glossary.rst:425 msgid "A synonym for :term:`file object`." msgstr ":term:`file object`\\ (檔案物件)的同義字。" -#: ../../glossary.rst:404 +#: ../../glossary.rst:426 msgid "filesystem encoding and error handler" msgstr "filesystem encoding and error handler(檔案系統編碼和錯誤處理函式)" -#: ../../glossary.rst:406 +#: ../../glossary.rst:428 msgid "" "Encoding and error handler used by Python to decode bytes from the operating " "system and encode Unicode to the operating system." @@ -938,7 +994,7 @@ msgstr "" "Python 所使用的一種編碼和錯誤處理函式,用來解碼來自作業系統的位元組,以及將 " "Unicode 編碼到作業系統。" -#: ../../glossary.rst:409 +#: ../../glossary.rst:431 msgid "" "The filesystem encoding must guarantee to successfully decode all bytes " "below 128. If the file system encoding fails to provide this guarantee, API " @@ -947,7 +1003,7 @@ msgstr "" "檔案系統編碼必須保證能成功解碼所有小於 128 的位元組。如果檔案系統編碼無法提供" "此保證,則 API 函式會引發 :exc:`UnicodeError`。" -#: ../../glossary.rst:413 +#: ../../glossary.rst:435 msgid "" "The :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors` functions can be used to get the filesystem " @@ -956,7 +1012,7 @@ msgstr "" ":func:`sys.getfilesystemencoding` 和 :func:`sys.getfilesystemencodeerrors` 函" "式可用於取得檔案系統編碼和錯誤處理函式。" -#: ../../glossary.rst:417 +#: ../../glossary.rst:439 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " "startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." @@ -968,22 +1024,22 @@ msgstr "" "member:`~PyConfig.filesystem_encoding`,以及 :c:type:`PyConfig` 的成員 :c:" "member:`~PyConfig.filesystem_errors`。" -#: ../../glossary.rst:422 +#: ../../glossary.rst:444 msgid "See also the :term:`locale encoding`." msgstr "另請參閱 :term:`locale encoding`\\ (區域編碼)。" -#: ../../glossary.rst:423 +#: ../../glossary.rst:445 msgid "finder" msgstr "finder(尋檢器)" -#: ../../glossary.rst:425 +#: ../../glossary.rst:447 msgid "" "An object that tries to find the :term:`loader` for a module that is being " "imported." msgstr "" "一個物件,它會嘗試為正在被 import 的模組尋找 :term:`loader`\\ (載入器)。" -#: ../../glossary.rst:428 +#: ../../glossary.rst:450 msgid "" "There are two types of finder: :term:`meta path finders ` " "for use with :data:`sys.meta_path`, and :term:`path entry finders ` 會使用 :data:`sys.meta_path`,而\\ :term:`路徑項目尋檢器 (path " "entry finder) ` 會使用 :data:`sys.path_hooks`。" -#: ../../glossary.rst:432 -msgid "See :ref:`importsystem` and :mod:`importlib` for much more detail." -msgstr "請參閱 :ref:`importsystem` 和 :mod:`importlib` 以了解更多細節。" +#: ../../glossary.rst:454 +msgid "" +"See :ref:`finders-and-loaders` and :mod:`importlib` for much more detail." +msgstr "請參閱 :ref:`finders-and-loaders` 和 :mod:`importlib` 以了解更多細節。" -#: ../../glossary.rst:433 +#: ../../glossary.rst:455 msgid "floor division" msgstr "floor division(向下取整除法)" -#: ../../glossary.rst:435 +#: ../../glossary.rst:457 msgid "" "Mathematical division that rounds down to nearest integer. The floor " "division operator is ``//``. For example, the expression ``11 // 4`` " @@ -1014,11 +1071,11 @@ msgstr "" "``2.75`` 不同。請注意,``(-11) // 4`` 的結果是 ``-3``,因為是 ``-2.75`` 被\\ " "*向下*\\ 無條件捨去。請參閱 :pep:`238`。" -#: ../../glossary.rst:440 +#: ../../glossary.rst:462 msgid "free threading" msgstr "free threading(自由執行緒)" -#: ../../glossary.rst:442 +#: ../../glossary.rst:464 msgid "" "A threading model where multiple threads can run Python bytecode " "simultaneously within the same interpreter. This is in contrast to the :" @@ -1029,11 +1086,25 @@ msgstr "" "\\ :term:`全域直譯器鎖 `\\ 形成對比,後者一次只允許" "一個執行緒執行 Python 位元組碼。請參閱 :pep:`703`。" -#: ../../glossary.rst:446 +#: ../../glossary.rst:468 +msgid "free variable" +msgstr "free variable(自由變數)" + +#: ../../glossary.rst:470 +msgid "" +"Formally, as defined in the :ref:`language execution model `, a " +"free variable is any variable used in a namespace which is not a local " +"variable in that namespace. See :term:`closure variable` for an example. " +"Pragmatically, due to the name of the :attr:`codeobject.co_freevars` " +"attribute, the term is also sometimes used as a synonym for :term:`closure " +"variable`." +msgstr "" + +#: ../../glossary.rst:475 msgid "function" msgstr "function(函式)" -#: ../../glossary.rst:448 +#: ../../glossary.rst:477 msgid "" "A series of statements which returns some value to a caller. It can also be " "passed zero or more :term:`arguments ` which may be used in the " @@ -1045,15 +1116,15 @@ msgstr "" "`parameter`\\ (參數)、:term:`method`\\ (方法),以及\\ :ref:`function`\\ " "章節。" -#: ../../glossary.rst:452 +#: ../../glossary.rst:481 msgid "function annotation" msgstr "function annotation(函式註釋)" -#: ../../glossary.rst:454 +#: ../../glossary.rst:483 msgid "An :term:`annotation` of a function parameter or return value." msgstr "函式參數或回傳值的一個 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:456 +#: ../../glossary.rst:485 msgid "" "Function annotations are usually used for :term:`type hints `: " "for example, this function is expected to take two :class:`int` arguments " @@ -1062,7 +1133,7 @@ msgstr "" "函式註釋通常被使用於\\ :term:`型別提示 `:例如,這個函式預期會得到" "兩個 :class:`int` 引數,並會有一個 :class:`int` 回傳值: ::" -#: ../../glossary.rst:461 +#: ../../glossary.rst:490 msgid "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" @@ -1070,11 +1141,11 @@ msgstr "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" -#: ../../glossary.rst:464 +#: ../../glossary.rst:493 msgid "Function annotation syntax is explained in section :ref:`function`." msgstr "函式註釋的語法在\\ :ref:`function`\\ 章節有詳細解釋。" -#: ../../glossary.rst:466 +#: ../../glossary.rst:495 msgid "" "See :term:`variable annotation` and :pep:`484`, which describe this " "functionality. Also see :ref:`annotations-howto` for best practices on " @@ -1083,11 +1154,11 @@ msgstr "" "請參閱 :term:`variable annotation` 和 :pep:`484`,皆有此功能的描述。關於註釋" "的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:470 +#: ../../glossary.rst:499 msgid "__future__" msgstr "__future__" -#: ../../glossary.rst:472 +#: ../../glossary.rst:501 msgid "" "A :ref:`future statement `, ``from __future__ import ``, " "directs the compiler to compile the current module using syntax or semantics " @@ -1103,7 +1174,7 @@ msgstr "" "import 此模組並對其變數求值,你可以看見一個新的功能是何時首次被新增到此語言" "中,以及它何時將會(或已經)成為預設的功能: ::" -#: ../../glossary.rst:480 +#: ../../glossary.rst:509 msgid "" ">>> import __future__\n" ">>> __future__.division\n" @@ -1113,11 +1184,11 @@ msgstr "" ">>> __future__.division\n" "_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)" -#: ../../glossary.rst:483 +#: ../../glossary.rst:512 msgid "garbage collection" msgstr "garbage collection(垃圾回收)" -#: ../../glossary.rst:485 +#: ../../glossary.rst:514 msgid "" "The process of freeing memory when it is not used anymore. Python performs " "garbage collection via reference counting and a cyclic garbage collector " @@ -1129,11 +1200,11 @@ msgstr "" "垃圾回收器 (cyclic garbage collector) 來完成。垃圾回收器可以使用 :mod:`gc` 模" "組對其進行控制。" -#: ../../glossary.rst:490 ../../glossary.rst:491 +#: ../../glossary.rst:519 ../../glossary.rst:520 msgid "generator" msgstr "generator(產生器)" -#: ../../glossary.rst:493 +#: ../../glossary.rst:522 msgid "" "A function which returns a :term:`generator iterator`. It looks like a " "normal function except that it contains :keyword:`yield` expressions for " @@ -1144,7 +1215,7 @@ msgstr "" "個正常的函式,但不同的是它包含了 :keyword:`yield` 運算式,能產生一系列的值," "這些值可用於 for 迴圈,或是以 :func:`next` 函式,每次檢索其中的一個值。" -#: ../../glossary.rst:498 +#: ../../glossary.rst:527 msgid "" "Usually refers to a generator function, but may refer to a *generator " "iterator* in some contexts. In cases where the intended meaning isn't " @@ -1153,15 +1224,15 @@ msgstr "" "這個術語通常用來表示一個產生器函式,但在某些情境中,也可能是表示\\ *產生器疊" "代器*。萬一想表達的意思不夠清楚,那就使用完整的術語,以避免歧義。" -#: ../../glossary.rst:501 +#: ../../glossary.rst:530 msgid "generator iterator" msgstr "generator iterator(產生器疊代器)" -#: ../../glossary.rst:503 +#: ../../glossary.rst:532 msgid "An object created by a :term:`generator` function." msgstr "一個由 :term:`generator`\\ (產生器)函式所建立的物件。" -#: ../../glossary.rst:505 +#: ../../glossary.rst:534 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " "location execution state (including local variables and pending try-" @@ -1172,11 +1243,11 @@ msgstr "" "中的 try 陳述式)。當\\ *產生器疊代器*\\ 回復時,它會從停止的地方繼續執行(與" "那些每次調用時都要重新開始的函式有所不同)。" -#: ../../glossary.rst:511 ../../glossary.rst:512 +#: ../../glossary.rst:540 ../../glossary.rst:541 msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../glossary.rst:514 +#: ../../glossary.rst:543 msgid "" "An :term:`expression` that returns an :term:`iterator`. It looks like a " "normal expression followed by a :keyword:`!for` clause defining a loop " @@ -1188,7 +1259,7 @@ msgstr "" "變數、範圍以及一個選擇性的 :keyword:`!if` 子句。該組合運算式會為外層函式產生" "多個值: ::" -#: ../../glossary.rst:519 +#: ../../glossary.rst:548 msgid "" ">>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81\n" "285" @@ -1196,11 +1267,11 @@ msgstr "" ">>> sum(i*i for i in range(10)) # 平方之和 0, 1, 4, ... 81\n" "285" -#: ../../glossary.rst:521 +#: ../../glossary.rst:550 msgid "generic function" msgstr "generic function(泛型函式)" -#: ../../glossary.rst:523 +#: ../../glossary.rst:552 msgid "" "A function composed of multiple functions implementing the same operation " "for different types. Which implementation should be used during a call is " @@ -1209,7 +1280,7 @@ msgstr "" "一個由多個函式組成的函式,該函式會對不同的型別實作相同的運算。呼叫期間應該使" "用哪種實作,是由調度演算法 (dispatch algorithm) 來決定。" -#: ../../glossary.rst:527 +#: ../../glossary.rst:556 msgid "" "See also the :term:`single dispatch` glossary entry, the :func:`functools." "singledispatch` decorator, and :pep:`443`." @@ -1217,11 +1288,11 @@ msgstr "" "另請參閱 :term:`single dispatch`\\ (單一調度)術語表條目、:func:`functools." "singledispatch` 裝飾器和 :pep:`443`。" -#: ../../glossary.rst:529 +#: ../../glossary.rst:558 msgid "generic type" msgstr "generic type(泛型型別)" -#: ../../glossary.rst:531 +#: ../../glossary.rst:560 msgid "" "A :term:`type` that can be parameterized; typically a :ref:`container " "class` such as :class:`list` or :class:`dict`. Used for :" @@ -1231,7 +1302,7 @@ msgstr "" "`容器型別 `,像是 :class:`list` 和 :class:`dict`。它被用於" "\\ :term:`型別提示 `\\ 和\\ :term:`註釋 `。" -#: ../../glossary.rst:536 +#: ../../glossary.rst:565 msgid "" "For more details, see :ref:`generic alias types`, :pep:" "`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` module." @@ -1239,19 +1310,19 @@ msgstr "" "詳情請參閱\\ :ref:`泛型別名型別 `、:pep:`483`、:pep:" "`484`、:pep:`585` 和 :mod:`typing` 模組。" -#: ../../glossary.rst:538 +#: ../../glossary.rst:567 msgid "GIL" msgstr "GIL" -#: ../../glossary.rst:540 +#: ../../glossary.rst:569 msgid "See :term:`global interpreter lock`." msgstr "請參閱 :term:`global interpreter lock`\\ (全域直譯器鎖)。" -#: ../../glossary.rst:541 +#: ../../glossary.rst:570 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../glossary.rst:543 +#: ../../glossary.rst:572 msgid "" "The mechanism used by the :term:`CPython` interpreter to assure that only " "one thread executes Python :term:`bytecode` at a time. This simplifies the " @@ -1268,7 +1339,7 @@ msgstr "" "(multi-threaded),但代價是會犧牲掉多處理器的機器能夠提供的一大部分平行性 " "(parallelism)。" -#: ../../glossary.rst:552 +#: ../../glossary.rst:581 msgid "" "However, some extension modules, either standard or third-party, are " "designed so as to release the GIL when doing computationally intensive tasks " @@ -1279,26 +1350,26 @@ msgstr "" "計算密集 (computationally intensive) 的任務時,可以解除 GIL。另外,在執行 I/" "O 時,GIL 總是會被解除。" -#: ../../glossary.rst:557 +#: ../../glossary.rst:586 msgid "" "As of Python 3.13, the GIL can be disabled using the :option:`--disable-gil` " "build configuration. After building Python with this option, code must be " -"run with :option:`-X gil 0 <-X>` or after setting the :envvar:`PYTHON_GIL=0 " +"run with :option:`-X gil=0 <-X>` or after setting the :envvar:`PYTHON_GIL=0 " "` environment variable. This feature enables improved " "performance for multi-threaded applications and makes it easier to use multi-" "core CPUs efficiently. For more details, see :pep:`703`." msgstr "" "從 Python 3.13 開始可以使用 :option:`--disable-gil` 建置設定來停用 GIL。使用" -"此選項建立 Python 後,必須使用 :option:`-X gil 0 <-X>` 來執行程式碼,或者設" +"此選項建立 Python 後,必須使用 :option:`-X gil=0 <-X>` 來執行程式碼,或者設" "定 :envvar:`PYTHON_GIL=0 ` 環境變數後再執行程式碼。此功能可以提高" "多執行緒應用程式的效能,並使多核心 CPU 的高效使用變得更加容易。有關更多詳細資" "訊,請參閱 :pep:`703`。" -#: ../../glossary.rst:563 +#: ../../glossary.rst:592 msgid "hash-based pyc" msgstr "hash-based pyc(雜湊架構的 pyc)" -#: ../../glossary.rst:565 +#: ../../glossary.rst:594 msgid "" "A bytecode cache file that uses the hash rather than the last-modified time " "of the corresponding source file to determine its validity. See :ref:`pyc-" @@ -1307,11 +1378,11 @@ msgstr "" "一個位元組碼 (bytecode) 暫存檔,它使用雜湊值而不是對應原始檔案的最後修改時" "間,來確定其有效性。請參閱\\ :ref:`pyc-invalidation`。" -#: ../../glossary.rst:568 +#: ../../glossary.rst:597 msgid "hashable" msgstr "hashable(可雜湊的)" -#: ../../glossary.rst:570 +#: ../../glossary.rst:599 msgid "" "An object is *hashable* if it has a hash value which never changes during " "its lifetime (it needs a :meth:`~object.__hash__` method), and can be " @@ -1323,7 +1394,7 @@ msgstr "" "`~object.__eq__` method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結果為相等的" "多個可雜湊物件,它們必須擁有相同的雜湊值。" -#: ../../glossary.rst:576 +#: ../../glossary.rst:605 msgid "" "Hashability makes an object usable as a dictionary key and a set member, " "because these data structures use the hash value internally." @@ -1331,7 +1402,7 @@ msgstr "" "可雜湊性 (hashability) 使一個物件可用作 dictionary(字典)的鍵和 set(集合)" "的成員,因為這些資料結構都在其內部使用了雜湊值。" -#: ../../glossary.rst:579 +#: ../../glossary.rst:608 msgid "" "Most of Python's immutable built-in objects are hashable; mutable containers " "(such as lists or dictionaries) are not; immutable containers (such as " @@ -1346,11 +1417,11 @@ msgstr "" "則這些物件會被預設為可雜湊的。它們在互相比較時都是不相等的(除非它們與自己比" "較),而它們的雜湊值則是衍生自它們的 :func:`id`。" -#: ../../glossary.rst:586 +#: ../../glossary.rst:615 msgid "IDLE" msgstr "IDLE" -#: ../../glossary.rst:588 +#: ../../glossary.rst:617 msgid "" "An Integrated Development and Learning Environment for Python. :ref:`idle` " "is a basic editor and interpreter environment which ships with the standard " @@ -1360,17 +1431,17 @@ msgstr "" "境)。:ref:`idle` 是一個基本的編輯器和直譯器環境,它和 Python 的標準發行版本" "一起被提供。" -#: ../../glossary.rst:591 +#: ../../glossary.rst:620 msgid "immortal" msgstr "immportal(不滅)" -#: ../../glossary.rst:593 +#: ../../glossary.rst:622 msgid "" "*Immortal objects* are a CPython implementation detail introduced in :pep:" "`683`." msgstr "*不滅物件 (Immortal objects)* 是 :pep:`683` 引入的 CPython 實作細節。" -#: ../../glossary.rst:596 +#: ../../glossary.rst:625 msgid "" "If an object is immortal, its :term:`reference count` is never modified, and " "therefore it is never deallocated while the interpreter is running. For " @@ -1380,11 +1451,11 @@ msgstr "" "修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` 和 :const:" "`None` 在 CPython 中是不滅的。" -#: ../../glossary.rst:599 +#: ../../glossary.rst:628 msgid "immutable" msgstr "immutable(不可變物件)" -#: ../../glossary.rst:601 +#: ../../glossary.rst:630 msgid "" "An object with a fixed value. Immutable objects include numbers, strings " "and tuples. Such an object cannot be altered. A new object has to be " @@ -1396,11 +1467,11 @@ msgstr "" "能被改變的。如果一個不同的值必須被儲存,則必須建立一個新的物件。它們在需要恆" "定雜湊值的地方,扮演重要的角色,例如 dictionary(字典)中的一個鍵。" -#: ../../glossary.rst:606 +#: ../../glossary.rst:635 msgid "import path" msgstr "import path(引入路徑)" -#: ../../glossary.rst:608 +#: ../../glossary.rst:637 msgid "" "A list of locations (or :term:`path entries `) that are searched " "by the :term:`path based finder` for modules to import. During import, this " @@ -1412,11 +1483,11 @@ msgstr "" "的位置。在 import 期間,此位置列表通常是來自 :data:`sys.path`,但對於子套件 " "(subpackage) 而言,它也可能是來自父套件的 ``__path__`` 屬性。" -#: ../../glossary.rst:613 +#: ../../glossary.rst:642 msgid "importing" msgstr "importing(引入)" -#: ../../glossary.rst:615 +#: ../../glossary.rst:644 msgid "" "The process by which Python code in one module is made available to Python " "code in another module." @@ -1424,11 +1495,11 @@ msgstr "" "一個過程。一個模組中的 Python 程式碼可以透過此過程,被另一個模組中的 Python " "程式碼使用。" -#: ../../glossary.rst:617 +#: ../../glossary.rst:646 msgid "importer" msgstr "importer(引入器)" -#: ../../glossary.rst:619 +#: ../../glossary.rst:648 msgid "" "An object that both finds and loads a module; both a :term:`finder` and :" "term:`loader` object." @@ -1436,11 +1507,11 @@ msgstr "" "一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也是 :term:" "`loader`\\ (載入器)物件。" -#: ../../glossary.rst:621 +#: ../../glossary.rst:650 msgid "interactive" msgstr "interactive(互動的)" -#: ../../glossary.rst:623 +#: ../../glossary.rst:652 msgid "" "Python has an interactive interpreter which means you can enter statements " "and expressions at the interpreter prompt, immediately execute them and see " @@ -1454,11 +1525,11 @@ msgstr "" "從你的電腦的主選單選擇它)。這是測試新想法或檢查模塊和包的非常強大的方法(請" "記住help(x))。更多互動式模式相關資訊請見 :ref:`tut-interac`。" -#: ../../glossary.rst:630 +#: ../../glossary.rst:659 msgid "interpreted" msgstr "interpreted(直譯的)" -#: ../../glossary.rst:632 +#: ../../glossary.rst:661 msgid "" "Python is an interpreted language, as opposed to a compiled one, though the " "distinction can be blurry because of the presence of the bytecode compiler. " @@ -1472,11 +1543,11 @@ msgstr "" "一個執行檔,然後再執行它。直譯語言通常比編譯語言有更短的開發/除錯週期,不過" "它們的程式通常也運行得較慢。另請參閱 :term:`interactive`\\ (互動的)。" -#: ../../glossary.rst:639 +#: ../../glossary.rst:668 msgid "interpreter shutdown" msgstr "interpreter shutdown(直譯器關閉)" -#: ../../glossary.rst:641 +#: ../../glossary.rst:670 msgid "" "When asked to shut down, the Python interpreter enters a special phase where " "it gradually releases all allocated resources, such as modules and various " @@ -1494,18 +1565,18 @@ msgstr "" "段被執行的程式碼會遇到各種例外,因為它所依賴的資源可能不再有作用了(常見的例" "子是函式庫模組或是警告機制)。" -#: ../../glossary.rst:650 +#: ../../glossary.rst:679 msgid "" "The main reason for interpreter shutdown is that the ``__main__`` module or " "the script being run has finished executing." msgstr "" "直譯器關閉的主要原因,是 ``__main__`` 模組或正被運行的腳本已經執行完成。" -#: ../../glossary.rst:652 +#: ../../glossary.rst:681 msgid "iterable" msgstr "iterable(可疊代物件)" -#: ../../glossary.rst:654 +#: ../../glossary.rst:683 msgid "" "An object capable of returning its members one at a time. Examples of " "iterables include all sequence types (such as :class:`list`, :class:`str`, " @@ -1521,7 +1592,7 @@ msgstr "" "`sequence`\\ (序列)語意的 :meth:`~object.__getitem__` method,該物件就是可" "疊代物件。" -#: ../../glossary.rst:662 +#: ../../glossary.rst:691 msgid "" "Iterables can be used in a :keyword:`for` loop and in many other places " "where a sequence is needed (:func:`zip`, :func:`map`, ...). When an " @@ -1541,11 +1612,11 @@ msgstr "" "數,用於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代器)、:" "term:`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" -#: ../../glossary.rst:672 +#: ../../glossary.rst:701 msgid "iterator" msgstr "iterator(疊代器)" -#: ../../glossary.rst:674 +#: ../../glossary.rst:703 msgid "" "An object representing a stream of data. Repeated calls to the iterator's :" "meth:`~iterator.__next__` method (or passing it to the built-in function :" @@ -1574,11 +1645,11 @@ msgstr "" "此事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一個已被用盡的疊代器物" "件,使其看起來就像一個空的容器。" -#: ../../glossary.rst:689 +#: ../../glossary.rst:718 msgid "More information can be found in :ref:`typeiter`." msgstr "在\\ :ref:`typeiter`\\ 文中可以找到更多資訊。" -#: ../../glossary.rst:693 +#: ../../glossary.rst:722 msgid "" "CPython does not consistently apply the requirement that an iterator define :" "meth:`~iterator.__iter__`. And also please note that the free-threading " @@ -1588,11 +1659,11 @@ msgstr "" "__iter__`\\ 」這個規定。另請注意,free-threading(自由執行緒)CPython 不保證" "疊代器操作的執行緒安全。" -#: ../../glossary.rst:698 +#: ../../glossary.rst:727 msgid "key function" msgstr "key function(鍵函式)" -#: ../../glossary.rst:700 +#: ../../glossary.rst:729 msgid "" "A key function or collation function is a callable that returns a value used " "for sorting or ordering. For example, :func:`locale.strxfrm` is used to " @@ -1602,7 +1673,7 @@ msgstr "" "一個用於排序 (sorting) 或定序 (ordering) 的值。例如,:func:`locale.strxfrm` " "被用來產生一個了解區域特定排序慣例的排序鍵。" -#: ../../glossary.rst:705 +#: ../../glossary.rst:734 msgid "" "A number of tools in Python accept key functions to control how elements are " "ordered or grouped. They include :func:`min`, :func:`max`, :func:`sorted`, :" @@ -1614,7 +1685,7 @@ msgstr "" "merge`、:func:`heapq.nsmallest`、:func:`heapq.nlargest` 和 :func:`itertools." "groupby`。" -#: ../../glossary.rst:711 +#: ../../glossary.rst:740 msgid "" "There are several ways to create a key function. For example. the :meth:" "`str.lower` method can serve as a key function for case insensitive sorts. " @@ -1631,19 +1702,19 @@ msgstr "" "式 (constructor)。關於如何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排序 " "`。" -#: ../../glossary.rst:718 +#: ../../glossary.rst:747 msgid "keyword argument" msgstr "keyword argument(關鍵字引數)" -#: ../../glossary.rst:720 ../../glossary.rst:1019 +#: ../../glossary.rst:749 ../../glossary.rst:1053 msgid "See :term:`argument`." msgstr "請參閱 :term:`argument`\\ (引數)。" -#: ../../glossary.rst:721 +#: ../../glossary.rst:750 msgid "lambda" msgstr "lambda" -#: ../../glossary.rst:723 +#: ../../glossary.rst:752 msgid "" "An anonymous inline function consisting of a single :term:`expression` which " "is evaluated when the function is called. The syntax to create a lambda " @@ -1653,11 +1724,11 @@ msgstr "" "function),於該函式被呼叫時求值。建立 lambda 函式的語法是 ``lambda " "[parameters]: expression``" -#: ../../glossary.rst:726 +#: ../../glossary.rst:755 msgid "LBYL" msgstr "LBYL" -#: ../../glossary.rst:728 +#: ../../glossary.rst:757 msgid "" "Look before you leap. This coding style explicitly tests for pre-conditions " "before making calls or lookups. This style contrasts with the :term:`EAFP` " @@ -1668,7 +1739,7 @@ msgstr "" "地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許多 :" "keyword:`if` 陳述式的存在。" -#: ../../glossary.rst:733 +#: ../../glossary.rst:762 msgid "" "In a multi-threaded environment, the LBYL approach can risk introducing a " "race condition between \"the looking\" and \"the leaping\". For example, " @@ -1682,11 +1753,11 @@ msgstr "" "了 *key*,則該程式碼就會失效。這個問題可以用鎖 (lock) 或使用 EAFP 編碼方式來" "解決。" -#: ../../glossary.rst:738 +#: ../../glossary.rst:767 msgid "list" msgstr "list(串列)" -#: ../../glossary.rst:740 +#: ../../glossary.rst:769 msgid "" "A built-in Python :term:`sequence`. Despite its name it is more akin to an " "array in other languages than to a linked list since access to elements is " @@ -1696,11 +1767,11 @@ msgstr "" "似其他語言中的一個陣列 (array) 而較不像一個鏈結串列 (linked list),因為存取元" "素的時間複雜度是 *O*\\ (1)。" -#: ../../glossary.rst:743 +#: ../../glossary.rst:772 msgid "list comprehension" msgstr "list comprehension(串列綜合運算)" -#: ../../glossary.rst:745 +#: ../../glossary.rst:774 msgid "" "A compact way to process all or part of the elements in a sequence and " "return a list with the results. ``result = ['{:#04x}'.format(x) for x in " @@ -1714,27 +1785,35 @@ msgstr "" "keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有元素都會被" "處理。" -#: ../../glossary.rst:751 +#: ../../glossary.rst:780 msgid "loader" msgstr "loader(載入器)" -#: ../../glossary.rst:753 +#: ../../glossary.rst:782 msgid "" "An object that loads a module. It must define a method named :meth:" -"`load_module`. A loader is typically returned by a :term:`finder`. See :pep:" -"`302` for details and :class:`importlib.abc.Loader` for an :term:`abstract " -"base class`." +"`load_module`. A loader is typically returned by a :term:`finder`. See also:" msgstr "" "一個能夠載入模組的物件。它必須定義一個名為 :meth:`load_module` 的 method(方" -"法)。載入器通常是被 :term:`finder`\\ (尋檢器)回傳。更多細節請參閱 :pep:" -"`302`,關於 :term:`abstract base class`\\ (抽象基底類別),請參閱 :class:" -"`importlib.abc.Loader`。" +"法)。載入器通常是被 :term:`finder`\\ (尋檢器)回傳。更多細節請參閱:" -#: ../../glossary.rst:757 +#: ../../glossary.rst:786 +msgid ":ref:`finders-and-loaders`" +msgstr ":ref:`finders-and-loaders`" + +#: ../../glossary.rst:787 +msgid ":class:`importlib.abc.Loader`" +msgstr ":class:`importlib.abc.Loader`" + +#: ../../glossary.rst:788 +msgid ":pep:`302`" +msgstr ":pep:`302`" + +#: ../../glossary.rst:789 msgid "locale encoding" msgstr "locale encoding(區域編碼)" -#: ../../glossary.rst:759 +#: ../../glossary.rst:791 msgid "" "On Unix, it is the encoding of the LC_CTYPE locale. It can be set with :func:" "`locale.setlocale(locale.LC_CTYPE, new_locale) `." @@ -1742,36 +1821,36 @@ msgstr "" "在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以用 :func:`locale." "setlocale(locale.LC_CTYPE, new_locale) ` 來設定。" -#: ../../glossary.rst:762 +#: ../../glossary.rst:794 msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." msgstr "在 Windows 上,它是 ANSI 代碼頁(code page,例如 ``\"cp1252\"``\\ )。" -#: ../../glossary.rst:764 +#: ../../glossary.rst:796 msgid "" "On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." msgstr "在 Android 和 VxWorks 上,Python 使用 ``\"utf-8\"`` 作為區域編碼。" -#: ../../glossary.rst:766 +#: ../../glossary.rst:798 msgid ":func:`locale.getencoding` can be used to get the locale encoding." msgstr ":func:`locale.getencoding` 可以用來取得區域編碼。" -#: ../../glossary.rst:768 +#: ../../glossary.rst:800 msgid "See also the :term:`filesystem encoding and error handler`." msgstr "也請參考 :term:`filesystem encoding and error handler`。" -#: ../../glossary.rst:769 +#: ../../glossary.rst:801 msgid "magic method" msgstr "magic method(魔術方法)" -#: ../../glossary.rst:773 +#: ../../glossary.rst:805 msgid "An informal synonym for :term:`special method`." msgstr ":term:`special method`\\ (特殊方法)的一個非正式同義詞。" -#: ../../glossary.rst:774 +#: ../../glossary.rst:806 msgid "mapping" msgstr "mapping(對映)" -#: ../../glossary.rst:776 +#: ../../glossary.rst:808 msgid "" "A container object that supports arbitrary key lookups and implements the " "methods specified in the :class:`collections.abc.Mapping` or :class:" @@ -1786,11 +1865,11 @@ msgstr "" "包括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections." "OrderedDict` 和 :class:`collections.Counter`。" -#: ../../glossary.rst:782 +#: ../../glossary.rst:814 msgid "meta path finder" msgstr "meta path finder(元路徑尋檢器)" -#: ../../glossary.rst:784 +#: ../../glossary.rst:816 msgid "" "A :term:`finder` returned by a search of :data:`sys.meta_path`. Meta path " "finders are related to, but different from :term:`path entry finders ` " "相關但是不同。" -#: ../../glossary.rst:788 +#: ../../glossary.rst:820 msgid "" "See :class:`importlib.abc.MetaPathFinder` for the methods that meta path " "finders implement." msgstr "" "關於元路徑尋檢器實作的 method,請參閱 :class:`importlib.abc.MetaPathFinder`。" -#: ../../glossary.rst:790 +#: ../../glossary.rst:822 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../glossary.rst:792 +#: ../../glossary.rst:824 msgid "" "The class of a class. Class definitions create a class name, a class " "dictionary, and a list of base classes. The metaclass is responsible for " @@ -1831,15 +1910,15 @@ msgstr "" "性存取、增加執行緒安全性、追蹤物件建立、實作單例模式 (singleton),以及許多其" "他的任務。" -#: ../../glossary.rst:802 +#: ../../glossary.rst:834 msgid "More information can be found in :ref:`metaclasses`." msgstr "更多資訊可以在\\ :ref:`metaclasses`\\ 章節中找到。" -#: ../../glossary.rst:771 ../../glossary.rst:803 ../../glossary.rst:1168 +#: ../../glossary.rst:803 ../../glossary.rst:835 ../../glossary.rst:1198 msgid "method" msgstr "method(方法)" -#: ../../glossary.rst:805 +#: ../../glossary.rst:837 msgid "" "A function which is defined inside a class body. If called as an attribute " "of an instance of that class, the method will get the instance object as its " @@ -1851,11 +1930,11 @@ msgstr "" "通常被稱為 ``self``)。請參閱 :term:`function`\\ (函式)和 :term:`nested " "scope`\\ (巢狀作用域)。" -#: ../../glossary.rst:809 +#: ../../glossary.rst:841 msgid "method resolution order" msgstr "method resolution order(方法解析順序)" -#: ../../glossary.rst:811 +#: ../../glossary.rst:843 msgid "" "Method Resolution Order is the order in which base classes are searched for " "a member during lookup. See :ref:`python_2.3_mro` for details of the " @@ -1864,11 +1943,11 @@ msgstr "" "方法解析順序是在查找某個成員的過程中,base class(基底類別)被搜尋的順序。關" "於 Python 自 2.3 版直譯器所使用的演算法細節,請參閱 :ref:`python_2.3_mro`。" -#: ../../glossary.rst:814 +#: ../../glossary.rst:846 msgid "module" msgstr "module(模組)" -#: ../../glossary.rst:816 +#: ../../glossary.rst:848 msgid "" "An object that serves as an organizational unit of Python code. Modules " "have a namespace containing arbitrary Python objects. Modules are loaded " @@ -1878,15 +1957,15 @@ msgstr "" "空間,它包含任意的 Python 物件。模組是藉由 :term:`importing` 的過程,被載入" "至 Python。" -#: ../../glossary.rst:820 +#: ../../glossary.rst:852 msgid "See also :term:`package`." msgstr "另請參閱 :term:`package`\\ (套件)。" -#: ../../glossary.rst:821 +#: ../../glossary.rst:853 msgid "module spec" msgstr "module spec(模組規格)" -#: ../../glossary.rst:823 +#: ../../glossary.rst:855 msgid "" "A namespace containing the import-related information used to load a module. " "An instance of :class:`importlib.machinery.ModuleSpec`." @@ -1894,19 +1973,23 @@ msgstr "" "一個命名空間,它包含用於載入模組的 import 相關資訊。它是 :class:`importlib." "machinery.ModuleSpec` 的一個實例。" -#: ../../glossary.rst:825 +#: ../../glossary.rst:858 +msgid "See also :ref:`module-specs`." +msgstr "另請參閱 :ref:`module-specs`。" + +#: ../../glossary.rst:859 msgid "MRO" msgstr "MRO" -#: ../../glossary.rst:827 +#: ../../glossary.rst:861 msgid "See :term:`method resolution order`." msgstr "請參閱 :term:`method resolution order`\\ (方法解析順序)。" -#: ../../glossary.rst:828 +#: ../../glossary.rst:862 msgid "mutable" msgstr "mutable(可變物件)" -#: ../../glossary.rst:830 +#: ../../glossary.rst:864 msgid "" "Mutable objects can change their value but keep their :func:`id`. See also :" "term:`immutable`." @@ -1914,11 +1997,11 @@ msgstr "" "可變物件可以改變它們的值,但維持它們的 :func:`id`。另請參閱 :term:" "`immutable`\\ (不可變物件)。" -#: ../../glossary.rst:832 +#: ../../glossary.rst:866 msgid "named tuple" msgstr "named tuple(附名元組)" -#: ../../glossary.rst:834 +#: ../../glossary.rst:868 msgid "" "The term \"named tuple\" applies to any type or class that inherits from " "tuple and whose indexable elements are also accessible using named " @@ -1928,7 +2011,7 @@ msgstr "" "索引 (indexable) 元素也可以用附名屬性來存取。這些型別或 class 也可以具有其他" "的特性。" -#: ../../glossary.rst:838 +#: ../../glossary.rst:872 msgid "" "Several built-in types are named tuples, including the values returned by :" "func:`time.localtime` and :func:`os.stat`. Another example is :data:`sys." @@ -1937,7 +2020,7 @@ msgstr "" "有些內建型別是 named tuple,包括由 :func:`time.localtime` 和 :func:`os.stat` " "回傳的值。另一個例子是 :data:`sys.float_info`: ::" -#: ../../glossary.rst:842 +#: ../../glossary.rst:876 msgid "" ">>> sys.float_info[1] # indexed access\n" "1024\n" @@ -1947,7 +2030,7 @@ msgid "" "True" msgstr "" -#: ../../glossary.rst:849 +#: ../../glossary.rst:883 msgid "" "Some named tuples are built-in types (such as the above examples). " "Alternatively, a named tuple can be created from a regular class definition " @@ -1964,11 +2047,11 @@ msgstr "" "namedtuple` 來建立。後者技術也增加了一些額外的 method,這些 method 可能是在手" "寫或內建的 named tuple 中,無法找到的。" -#: ../../glossary.rst:857 +#: ../../glossary.rst:891 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../glossary.rst:859 +#: ../../glossary.rst:893 msgid "" "The place where a variable is stored. Namespaces are implemented as " "dictionaries. There are the local, global and built-in namespaces as well " @@ -1988,11 +2071,11 @@ msgstr "" "func:`itertools.islice` 明確地表示,這些函式分別是由 :mod:`random` 和 :mod:" "`itertools` 模組在實作。" -#: ../../glossary.rst:869 +#: ../../glossary.rst:903 msgid "namespace package" msgstr "namespace package(命名空間套件)" -#: ../../glossary.rst:871 +#: ../../glossary.rst:905 msgid "" "A :pep:`420` :term:`package` which serves only as a container for " "subpackages. Namespace packages may have no physical representation, and " @@ -2003,15 +2086,15 @@ msgstr "" "一個容器。命名空間套件可能沒有實體的表示法,而且具體來說它們不像是一個 :term:" "`regular package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這個檔案。" -#: ../../glossary.rst:876 +#: ../../glossary.rst:910 msgid "See also :term:`module`." msgstr "另請參閱 :term:`module`\\ (模組)。" -#: ../../glossary.rst:877 +#: ../../glossary.rst:911 msgid "nested scope" msgstr "nested scope(巢狀作用域)" -#: ../../glossary.rst:879 +#: ../../glossary.rst:913 msgid "" "The ability to refer to a variable in an enclosing definition. For " "instance, a function defined inside another function can refer to variables " @@ -2026,11 +2109,11 @@ msgstr "" "寫入。同樣地,全域變數是在全域命名空間中讀取及寫入。:keyword:`nonlocal` 容許" "對外層作用域進行寫入。" -#: ../../glossary.rst:886 +#: ../../glossary.rst:920 msgid "new-style class" msgstr "new-style class(新式類別)" -#: ../../glossary.rst:888 +#: ../../glossary.rst:922 msgid "" "Old name for the flavor of classes now used for all class objects. In " "earlier Python versions, only new-style classes could use Python's newer, " @@ -2042,11 +2125,11 @@ msgstr "" "__slots__`、描述器 (descriptor)、屬性 (property)、:meth:`~object." "__getattribute__`、class method(類別方法)和 static method(靜態方法)。" -#: ../../glossary.rst:893 +#: ../../glossary.rst:927 msgid "object" msgstr "object(物件)" -#: ../../glossary.rst:895 +#: ../../glossary.rst:929 msgid "" "Any data with state (attributes or value) and defined behavior (methods). " "Also the ultimate base class of any :term:`new-style class`." @@ -2054,11 +2137,11 @@ msgstr "" "具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任何 :term:" "`new-style class`\\ (新式類別)的最終 base class(基底類別)。" -#: ../../glossary.rst:898 +#: ../../glossary.rst:932 msgid "optimized scope" msgstr "optimized scope(最佳化作用域)" -#: ../../glossary.rst:900 +#: ../../glossary.rst:934 msgid "" "A scope where target local variable names are reliably known to the compiler " "when the code is compiled, allowing optimization of read and write access to " @@ -2069,11 +2152,11 @@ msgid "" "to optimized scopes." msgstr "" -#: ../../glossary.rst:907 +#: ../../glossary.rst:941 msgid "package" msgstr "package(套件)" -#: ../../glossary.rst:909 +#: ../../glossary.rst:943 msgid "" "A Python :term:`module` which can contain submodules or recursively, " "subpackages. Technically, a package is a Python module with a ``__path__`` " @@ -2083,17 +2166,17 @@ msgstr "" "迴的子套件 (subpackage)。技術上而言,套件就是具有 ``__path__`` 屬性的一個 " "Python 模組。" -#: ../../glossary.rst:913 +#: ../../glossary.rst:947 msgid "See also :term:`regular package` and :term:`namespace package`." msgstr "" "另請參閱 :term:`regular package`\\ (正規套件)和 :term:`namespace " "package`\\ (命名空間套件)。" -#: ../../glossary.rst:914 +#: ../../glossary.rst:948 msgid "parameter" msgstr "parameter(參數)" -#: ../../glossary.rst:916 +#: ../../glossary.rst:950 msgid "" "A named entity in a :term:`function` (or method) definition that specifies " "an :term:`argument` (or in some cases, arguments) that the function can " @@ -2103,7 +2186,7 @@ msgstr "" "它指明該函式能夠接受的一個 :term:`argument`\\ (引數),或在某些情況下指示多" "個引數。共有有五種不同的參數類型:" -#: ../../glossary.rst:920 +#: ../../glossary.rst:954 msgid "" ":dfn:`positional-or-keyword`: specifies an argument that can be passed " "either :term:`positionally ` or as a :term:`keyword argument " @@ -2114,11 +2197,11 @@ msgstr "" "置 `\\ 或是作為\\ :term:`關鍵字引數 `\\ 被傳遞的引數。這" "是參數的預設類型,例如以下的 *foo* 和 *bar*: ::" -#: ../../glossary.rst:925 +#: ../../glossary.rst:959 msgid "def func(foo, bar=None): ..." msgstr "def func(foo, bar=None): ..." -#: ../../glossary.rst:929 +#: ../../glossary.rst:963 msgid "" ":dfn:`positional-only`: specifies an argument that can be supplied only by " "position. Positional-only parameters can be defined by including a ``/`` " @@ -2129,11 +2212,11 @@ msgstr "" "式定義的參數列表中包含一個 ``/`` 字元,就可以在該字元前面定義僅限位置參數,例" "如以下的 *posonly1* 和 *posonly2*: ::" -#: ../../glossary.rst:934 +#: ../../glossary.rst:968 msgid "def func(posonly1, posonly2, /, positional_or_keyword): ..." msgstr "def func(posonly1, posonly2, /, positional_or_keyword): ..." -#: ../../glossary.rst:938 +#: ../../glossary.rst:972 msgid "" ":dfn:`keyword-only`: specifies an argument that can be supplied only by " "keyword. Keyword-only parameters can be defined by including a single var-" @@ -2146,11 +2229,11 @@ msgstr "" "單純的 ``*`` 字元,就可以在其後方定義僅限關鍵字參數,例如以下的 *kw_only1* " "和 *kw_only2*: ::" -#: ../../glossary.rst:944 +#: ../../glossary.rst:978 msgid "def func(arg, *, kw_only1, kw_only2): ..." msgstr "def func(arg, *, kw_only1, kw_only2): ..." -#: ../../glossary.rst:946 +#: ../../glossary.rst:980 msgid "" ":dfn:`var-positional`: specifies that an arbitrary sequence of positional " "arguments can be provided (in addition to any positional arguments already " @@ -2162,11 +2245,11 @@ msgstr "" "數(在已被其他參數接受的任何位置引數之外)。這類參數是透過在其參數名稱字首加" "上 ``*`` 來定義的,例如以下的 *args*: ::" -#: ../../glossary.rst:952 +#: ../../glossary.rst:986 msgid "def func(*args, **kwargs): ..." msgstr "def func(*args, **kwargs): ..." -#: ../../glossary.rst:954 +#: ../../glossary.rst:988 msgid "" ":dfn:`var-keyword`: specifies that arbitrarily many keyword arguments can be " "provided (in addition to any keyword arguments already accepted by other " @@ -2177,14 +2260,14 @@ msgstr "" "已被其他參數接受的任何關鍵字引數之外)。這類參數是透過在其參數名稱字首加上 " "``**`` 來定義的,例如上面範例中的 *kwargs*。" -#: ../../glossary.rst:960 +#: ../../glossary.rst:994 msgid "" "Parameters can specify both optional and required arguments, as well as " "default values for some optional arguments." msgstr "" "參數可以指明引數是選擇性的或必需的,也可以為一些選擇性的引數指定預設值。" -#: ../../glossary.rst:963 +#: ../../glossary.rst:997 msgid "" "See also the :term:`argument` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " @@ -2195,11 +2278,11 @@ msgstr "" "參數之間的差異 `、:class:`inspect.Parameter` " "class、:ref:`function`\\ 章節,以及 :pep:`362`。" -#: ../../glossary.rst:967 +#: ../../glossary.rst:1001 msgid "path entry" msgstr "path entry(路徑項目)" -#: ../../glossary.rst:969 +#: ../../glossary.rst:1003 msgid "" "A single location on the :term:`import path` which the :term:`path based " "finder` consults to find modules for importing." @@ -2207,11 +2290,11 @@ msgstr "" "在 :term:`import path`\\ (引入路徑)中的一個位置,而 :term:`path based " "finder` (基於路徑的尋檢器)會參考該位置來尋找要 import 的模組。" -#: ../../glossary.rst:971 +#: ../../glossary.rst:1005 msgid "path entry finder" msgstr "path entry finder(路徑項目尋檢器)" -#: ../../glossary.rst:973 +#: ../../glossary.rst:1007 msgid "" "A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. a :" "term:`path entry hook`) which knows how to locate modules given a :term:" @@ -2221,7 +2304,7 @@ msgstr "" "`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一個 :term:" "`path entry`\\ 定位模組。" -#: ../../glossary.rst:977 +#: ../../glossary.rst:1011 msgid "" "See :class:`importlib.abc.PathEntryFinder` for the methods that path entry " "finders implement." @@ -2229,11 +2312,11 @@ msgstr "" "關於路徑項目尋檢器實作的 method,請參閱 :class:`importlib.abc." "PathEntryFinder`。" -#: ../../glossary.rst:979 +#: ../../glossary.rst:1013 msgid "path entry hook" msgstr "path entry hook(路徑項目鉤)" -#: ../../glossary.rst:981 +#: ../../glossary.rst:1015 msgid "" "A callable on the :data:`sys.path_hooks` list which returns a :term:`path " "entry finder` if it knows how to find modules on a specific :term:`path " @@ -2243,11 +2326,11 @@ msgstr "" "個特定的 :term:`path entry` 中尋找模組,則會回傳一個 :term:`path entry " "finder`\\ (路徑項目尋檢器)。" -#: ../../glossary.rst:984 +#: ../../glossary.rst:1018 msgid "path based finder" msgstr "path based finder(基於路徑的尋檢器)" -#: ../../glossary.rst:986 +#: ../../glossary.rst:1020 msgid "" "One of the default :term:`meta path finders ` which " "searches an :term:`import path` for modules." @@ -2255,11 +2338,11 @@ msgstr "" "預設的\\ :term:`元路徑尋檢器 (meta path finder) ` 之一,它" "會在一個 :term:`import path` 中搜尋模組。" -#: ../../glossary.rst:988 +#: ../../glossary.rst:1022 msgid "path-like object" msgstr "path-like object(類路徑物件)" -#: ../../glossary.rst:990 +#: ../../glossary.rst:1024 msgid "" "An object representing a file system path. A path-like object is either a :" "class:`str` or :class:`bytes` object representing a path, or an object " @@ -2277,11 +2360,11 @@ msgstr "" "`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結果。由 :" "pep:`519` 引入。" -#: ../../glossary.rst:998 +#: ../../glossary.rst:1032 msgid "PEP" msgstr "PEP" -#: ../../glossary.rst:1000 +#: ../../glossary.rst:1034 msgid "" "Python Enhancement Proposal. A PEP is a design document providing " "information to the Python community, or describing a new feature for Python " @@ -2292,7 +2375,7 @@ msgstr "" "為 Python 社群提供資訊,或是描述 Python 的一個新功能或該功能的程序和環境。" "PEP 應該要提供簡潔的技術規範以及被提案功能的運作原理。" -#: ../../glossary.rst:1006 +#: ../../glossary.rst:1040 msgid "" "PEPs are intended to be the primary mechanisms for proposing major new " "features, for collecting community input on an issue, and for documenting " @@ -2304,15 +2387,15 @@ msgstr "" "已納入 Python 的設計決策的記錄,這些過程的主要機制。PEP 的作者要負責在社群內" "建立共識並記錄反對意見。" -#: ../../glossary.rst:1012 +#: ../../glossary.rst:1046 msgid "See :pep:`1`." msgstr "請參閱 :pep:`1`。" -#: ../../glossary.rst:1013 +#: ../../glossary.rst:1047 msgid "portion" msgstr "portion(部分)" -#: ../../glossary.rst:1015 +#: ../../glossary.rst:1049 msgid "" "A set of files in a single directory (possibly stored in a zip file) that " "contribute to a namespace package, as defined in :pep:`420`." @@ -2320,15 +2403,15 @@ msgstr "" "在單一目錄中的一組檔案(也可能儲存在一個 zip 檔中),這些檔案能對一個命名空間" "套件 (namespace package) 有所貢獻,如同 :pep:`420` 中的定義。" -#: ../../glossary.rst:1017 +#: ../../glossary.rst:1051 msgid "positional argument" msgstr "positional argument(位置引數)" -#: ../../glossary.rst:1020 +#: ../../glossary.rst:1054 msgid "provisional API" msgstr "provisional API(暫行 API)" -#: ../../glossary.rst:1022 +#: ../../glossary.rst:1056 msgid "" "A provisional API is one which has been deliberately excluded from the " "standard library's backwards compatibility guarantees. While major changes " @@ -2344,7 +2427,7 @@ msgstr "" "該介面)。這種變更並不會無端地產生——只有 API 被納入之前未察覺的嚴重基本缺陷被" "揭露時,它們才會發生。" -#: ../../glossary.rst:1031 +#: ../../glossary.rst:1065 msgid "" "Even for provisional APIs, backwards incompatible changes are seen as a " "\"solution of last resort\" - every attempt will still be made to find a " @@ -2353,7 +2436,7 @@ msgstr "" "即使對於暫行 API,向後不相容的變更也會被視為「最後的解決方案」——對於任何被發" "現的問題,仍然會盡可能找出一個向後相容的解決方案。" -#: ../../glossary.rst:1035 +#: ../../glossary.rst:1069 msgid "" "This process allows the standard library to continue to evolve over time, " "without locking in problematic design errors for extended periods of time. " @@ -2362,19 +2445,19 @@ msgstr "" "這個過程使得標準函式庫能隨著時間不斷進化,而避免耗費過長的時間去鎖定有問題的" "設計錯誤。請參閱 :pep:`411` 了解更多細節。" -#: ../../glossary.rst:1038 +#: ../../glossary.rst:1072 msgid "provisional package" msgstr "provisional package(暫行套件)" -#: ../../glossary.rst:1040 +#: ../../glossary.rst:1074 msgid "See :term:`provisional API`." msgstr "請參閱 :term:`provisional API`\\ (暫行 API)。" -#: ../../glossary.rst:1041 +#: ../../glossary.rst:1075 msgid "Python 3000" msgstr "Python 3000" -#: ../../glossary.rst:1043 +#: ../../glossary.rst:1077 msgid "" "Nickname for the Python 3.x release line (coined long ago when the release " "of version 3 was something in the distant future.) This is also abbreviated " @@ -2383,11 +2466,11 @@ msgstr "" "Python 3.x 系列版本的暱稱(很久以前創造的,當時第 3 版的發布是在遙遠的未" "來。)也可以縮寫為「Py3k」。" -#: ../../glossary.rst:1046 +#: ../../glossary.rst:1080 msgid "Pythonic" msgstr "Pythonic(Python 風格的)" -#: ../../glossary.rst:1048 +#: ../../glossary.rst:1082 msgid "" "An idea or piece of code which closely follows the most common idioms of the " "Python language, rather than implementing code using concepts common to " @@ -2401,7 +2484,7 @@ msgstr "" "keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並沒有" "這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" -#: ../../glossary.rst:1055 +#: ../../glossary.rst:1089 msgid "" "for i in range(len(food)):\n" " print(food[i])" @@ -2409,11 +2492,11 @@ msgstr "" "for i in range(len(food)):\n" " print(food[i])" -#: ../../glossary.rst:1058 +#: ../../glossary.rst:1092 msgid "As opposed to the cleaner, Pythonic method::" msgstr "相較之下,以下方法更簡潔、更具有 Python 風格: ::" -#: ../../glossary.rst:1060 +#: ../../glossary.rst:1094 msgid "" "for piece in food:\n" " print(piece)" @@ -2421,11 +2504,11 @@ msgstr "" "for piece in food:\n" " print(piece)" -#: ../../glossary.rst:1062 +#: ../../glossary.rst:1096 msgid "qualified name" msgstr "qualified name(限定名稱)" -#: ../../glossary.rst:1064 +#: ../../glossary.rst:1098 msgid "" "A dotted name showing the \"path\" from a module's global scope to a class, " "function or method defined in that module, as defined in :pep:`3155`. For " @@ -2436,7 +2519,7 @@ msgstr "" "或 method 的「路徑」,如 :pep:`3155` 中的定義。對於頂層的函式和 class 而言," "限定名稱與其物件名稱相同: ::" -#: ../../glossary.rst:1069 +#: ../../glossary.rst:1103 msgid "" ">>> class C:\n" "... class D:\n" @@ -2462,7 +2545,7 @@ msgstr "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" -#: ../../glossary.rst:1081 +#: ../../glossary.rst:1115 msgid "" "When used to refer to modules, the *fully qualified name* means the entire " "dotted path to the module, including any parent packages, e.g. ``email.mime." @@ -2471,7 +2554,7 @@ msgstr "" "當用於引用模組時,*完全限定名稱 (fully qualified name)* 是表示該模組的完整點" "分隔路徑,包括任何的父套件,例如 ``email.mime.text``: ::" -#: ../../glossary.rst:1085 +#: ../../glossary.rst:1119 msgid "" ">>> import email.mime.text\n" ">>> email.mime.text.__name__\n" @@ -2481,11 +2564,11 @@ msgstr "" ">>> email.mime.text.__name__\n" "'email.mime.text'" -#: ../../glossary.rst:1088 +#: ../../glossary.rst:1122 msgid "reference count" msgstr "reference count(參照計數)" -#: ../../glossary.rst:1090 +#: ../../glossary.rst:1124 msgid "" "The number of references to an object. When the reference count of an " "object drops to zero, it is deallocated. Some objects are :term:`immortal` " @@ -2501,11 +2584,11 @@ msgstr "" "看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :" "func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" -#: ../../glossary.rst:1098 +#: ../../glossary.rst:1132 msgid "regular package" msgstr "regular package(正規套件)" -#: ../../glossary.rst:1100 +#: ../../glossary.rst:1134 msgid "" "A traditional :term:`package`, such as a directory containing an ``__init__." "py`` file." @@ -2513,15 +2596,15 @@ msgstr "" "一個傳統的 :term:`package`\\ (套件),例如一個包含 ``__init__.py`` 檔案的目" "錄。" -#: ../../glossary.rst:1103 +#: ../../glossary.rst:1137 msgid "See also :term:`namespace package`." msgstr "另請參閱 :term:`namespace package`\\ (命名空間套件)。" -#: ../../glossary.rst:1104 +#: ../../glossary.rst:1138 msgid "REPL" msgstr "REPL" -#: ../../glossary.rst:1106 +#: ../../glossary.rst:1140 msgid "" "An acronym for the \"read–eval–print loop\", another name for the :term:" "`interactive` interpreter shell." @@ -2529,11 +2612,11 @@ msgstr "" "「read-eval-print 迴圈 (read–eval–print loop)」的縮寫,是\\ :term:`互動式 " "`\\ 直譯器 shell 的另一個名稱。" -#: ../../glossary.rst:1108 +#: ../../glossary.rst:1142 msgid "__slots__" msgstr "__slots__" -#: ../../glossary.rst:1110 +#: ../../glossary.rst:1144 msgid "" "A declaration inside a class that saves memory by pre-declaring space for " "instance attributes and eliminating instance dictionaries. Though popular, " @@ -2546,11 +2629,11 @@ msgstr "" "最好保留給那種在一個記憶體關鍵 (memory-critical) 的應用程式中存在大量實例的罕" "見情況。" -#: ../../glossary.rst:1115 +#: ../../glossary.rst:1149 msgid "sequence" msgstr "sequence(序列)" -#: ../../glossary.rst:1117 +#: ../../glossary.rst:1151 msgid "" "An :term:`iterable` which supports efficient element access using integer " "indices via the :meth:`~object.__getitem__` special method and defines a :" @@ -2569,7 +2652,7 @@ msgstr "" "為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` 鍵," "而不是整數。" -#: ../../glossary.rst:1126 +#: ../../glossary.rst:1160 msgid "" "The :class:`collections.abc.Sequence` abstract base class defines a much " "richer interface that goes beyond just :meth:`~object.__getitem__` and :meth:" @@ -2586,11 +2669,11 @@ msgstr "" "用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於序列方法的文件,請見" "\\ :ref:`常見序列操作 `。" -#: ../../glossary.rst:1135 +#: ../../glossary.rst:1169 msgid "set comprehension" msgstr "set comprehension(集合綜合運算)" -#: ../../glossary.rst:1137 +#: ../../glossary.rst:1171 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a set with the results. ``results = {c for c in 'abracadabra' if c " @@ -2601,11 +2684,11 @@ msgstr "" "set 回傳。``results = {c for c in 'abracadabra' if c not in 'abc'}`` 會產生一" "個字串 set:``{'r', 'd'}``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:1141 +#: ../../glossary.rst:1175 msgid "single dispatch" msgstr "single dispatch(單一調度)" -#: ../../glossary.rst:1143 +#: ../../glossary.rst:1177 msgid "" "A form of :term:`generic function` dispatch where the implementation is " "chosen based on the type of a single argument." @@ -2613,11 +2696,11 @@ msgstr "" ":term:`generic function`\\ (泛型函式)調度的一種形式,在此,實作的選擇是基於" "單一引數的型別。" -#: ../../glossary.rst:1145 +#: ../../glossary.rst:1179 msgid "slice" msgstr "slice(切片)" -#: ../../glossary.rst:1147 +#: ../../glossary.rst:1181 msgid "" "An object usually containing a portion of a :term:`sequence`. A slice is " "created using the subscript notation, ``[]`` with colons between numbers " @@ -2629,34 +2712,26 @@ msgstr "" "之間使用冒號,例如 ``variable_name[1:3:5]``。在括號(下標)符號的內部,會使" "用 :class:`slice` 物件。" -#: ../../glossary.rst:1151 +#: ../../glossary.rst:1185 msgid "soft deprecated" msgstr "soft deprecated(軟性棄用)" -#: ../../glossary.rst:1153 +#: ../../glossary.rst:1187 msgid "" -"A soft deprecation can be used when using an API which should no longer be " -"used to write new code, but it remains safe to continue using it in existing " -"code. The API remains documented and tested, but will not be developed " -"further (no enhancement)." +"A soft deprecated API should not be used in new code, but it is safe for " +"already existing code to use it. The API remains documented and tested, but " +"will not be enhanced further." msgstr "" -"軟性棄用代表 API 不應再用來編寫新程式碼,但在現有程式碼中繼續使用它仍然是安全" -"的。API 仍會以文件記錄並會被測試,但不會進一步開發(不會繼續改進)。" +"被軟性棄用的 API 代表不應再用於新程式碼中,但在現有程式碼中繼續使用它仍會是安" +"全的。API 仍會以文件記錄並會被測試,但不會被繼續改進。" -#: ../../glossary.rst:1158 +#: ../../glossary.rst:1191 msgid "" -"The main difference between a \"soft\" and a (regular) \"hard\" deprecation " -"is that the soft deprecation does not imply scheduling the removal of the " -"deprecated API." -msgstr "" -"「軟性」棄用和(常規的)「硬性」棄用之間的主要區別在於,軟性棄用並不代表已經" -"確定要什麼時候刪除已棄用的 API。" - -#: ../../glossary.rst:1162 -msgid "Another difference is that a soft deprecation does not issue a warning." -msgstr "另一個區別是軟性棄用不會發出警告。" +"Soft deprecation, unlike normal deprecation, does not plan on removing the " +"API and will not emit warnings." +msgstr "與正常棄用不同,軟性棄用沒有刪除 API 的規劃,也不會發出警告。" -#: ../../glossary.rst:1164 +#: ../../glossary.rst:1194 msgid "" "See `PEP 387: Soft Deprecation `_." @@ -2664,11 +2739,11 @@ msgstr "" "請參閱 `PEP 387:軟性棄用 `_。" -#: ../../glossary.rst:1166 +#: ../../glossary.rst:1196 msgid "special method" msgstr "special method(特殊方法)" -#: ../../glossary.rst:1170 +#: ../../glossary.rst:1200 msgid "" "A method that is called implicitly by Python to execute a certain operation " "on a type, such as addition. Such methods have names starting and ending " @@ -2679,11 +2754,11 @@ msgstr "" "種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在\\ :ref:" "`specialnames`\\ 中有詳細說明。" -#: ../../glossary.rst:1174 +#: ../../glossary.rst:1204 msgid "statement" msgstr "statement(陳述式)" -#: ../../glossary.rst:1176 +#: ../../glossary.rst:1206 msgid "" "A statement is part of a suite (a \"block\" of code). A statement is either " "an :term:`expression` or one of several constructs with a keyword, such as :" @@ -2693,11 +2768,11 @@ msgstr "" "term:`expression`\\ (運算式),或是含有關鍵字(例如 :keyword:`if`、:keyword:" "`while` 或 :keyword:`for`\\ )的多種結構之一。" -#: ../../glossary.rst:1179 +#: ../../glossary.rst:1209 msgid "static type checker" msgstr "static type checker(靜態型別檢查器)" -#: ../../glossary.rst:1181 +#: ../../glossary.rst:1211 msgid "" "An external tool that reads Python code and analyzes it, looking for issues " "such as incorrect types. See also :term:`type hints ` and the :" @@ -2707,11 +2782,11 @@ msgstr "" "另請參閱\\ :term:`型別提示 (type hints) ` 以及 :mod:`typing` 模" "組。" -#: ../../glossary.rst:1184 +#: ../../glossary.rst:1214 msgid "strong reference" msgstr "strong reference(強參照)" -#: ../../glossary.rst:1186 +#: ../../glossary.rst:1216 msgid "" "In Python's C API, a strong reference is a reference to an object which is " "owned by the code holding the reference. The strong reference is taken by " @@ -2722,7 +2797,7 @@ msgstr "" "有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透過 :c:" "func:`Py_DECREF` 釋放強參照。" -#: ../../glossary.rst:1192 +#: ../../glossary.rst:1222 msgid "" "The :c:func:`Py_NewRef` function can be used to create a strong reference to " "an object. Usually, the :c:func:`Py_DECREF` function must be called on the " @@ -2732,15 +2807,15 @@ msgstr "" ":c:func:`Py_NewRef` 函式可用於建立一個對物件的強參照。通常,在退出強參照的作" "用域之前,必須在該強參照上呼叫 :c:func:`Py_DECREF` 函式,以避免洩漏一個參照。" -#: ../../glossary.rst:1197 +#: ../../glossary.rst:1227 msgid "See also :term:`borrowed reference`." msgstr "另請參閱 :term:`borrowed reference`\\ (借用參照)。" -#: ../../glossary.rst:1198 +#: ../../glossary.rst:1228 msgid "text encoding" msgstr "text encoding(文字編碼)" -#: ../../glossary.rst:1200 +#: ../../glossary.rst:1230 msgid "" "A string in Python is a sequence of Unicode code points (in range " "``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be " @@ -2749,7 +2824,7 @@ msgstr "" "Python 中的字串是一個 Unicode 碼點 (code point) 的序列(範圍在 ``U+0000`` -- " "``U+10FFFF`` 之間)。若要儲存或傳送一個字串,它必須被序列化為一個位元組序列。" -#: ../../glossary.rst:1204 +#: ../../glossary.rst:1234 msgid "" "Serializing a string into a sequence of bytes is known as \"encoding\", and " "recreating the string from the sequence of bytes is known as \"decoding\"." @@ -2757,7 +2832,7 @@ msgstr "" "將一個字串序列化為位元組序列,稱為「編碼」,而從位元組序列重新建立該字串則稱" "為「解碼 (decoding)」。" -#: ../../glossary.rst:1207 +#: ../../glossary.rst:1237 msgid "" "There are a variety of different text serialization :ref:`codecs `, which are collectively referred to as \"text encodings\"." @@ -2765,11 +2840,11 @@ msgstr "" "有多種不同的文字序列化編解碼器 (:ref:`codecs `),它們被統" "稱為「文字編碼」。" -#: ../../glossary.rst:1210 +#: ../../glossary.rst:1240 msgid "text file" msgstr "text file(文字檔案)" -#: ../../glossary.rst:1212 +#: ../../glossary.rst:1242 msgid "" "A :term:`file object` able to read and write :class:`str` objects. Often, a " "text file actually accesses a byte-oriented datastream and handles the :term:" @@ -2783,7 +2858,7 @@ msgstr "" "有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔案、:data:`sys.stdin`、:data:" "`sys.stdout` 以及 :class:`io.StringIO` 的實例。" -#: ../../glossary.rst:1219 +#: ../../glossary.rst:1249 msgid "" "See also :term:`binary file` for a file object able to read and write :term:" "`bytes-like objects `." @@ -2791,11 +2866,11 @@ msgstr "" "另請參閱 :term:`binary file`\\ (二進位檔案),它是一個能夠讀取和寫入\\ :" "term:`類位元組串物件 (bytes-like object) ` 的檔案物件。" -#: ../../glossary.rst:1221 +#: ../../glossary.rst:1251 msgid "triple-quoted string" msgstr "triple-quoted string(三引號內字串)" -#: ../../glossary.rst:1223 +#: ../../glossary.rst:1253 msgid "" "A string which is bound by three instances of either a quotation mark (\") " "or an apostrophe ('). While they don't provide any functionality not " @@ -2810,11 +2885,11 @@ msgstr "" "中包含未跳脫 (unescaped) 的單引號和雙引號,而且它們不需使用連續字元 " "(continuation character) 就可以跨越多行,這使得它們在編寫說明字串時特別有用。" -#: ../../glossary.rst:1230 +#: ../../glossary.rst:1260 msgid "type" msgstr "type(型別)" -#: ../../glossary.rst:1232 +#: ../../glossary.rst:1262 msgid "" "The type of a Python object determines what kind of object it is; every " "object has a type. An object's type is accessible as its :attr:`~object." @@ -2824,22 +2899,22 @@ msgstr "" "件的型別可以用它的 :attr:`~object.__class__` 屬性來存取,或以 ``type(obj)`` " "來檢索。" -#: ../../glossary.rst:1236 +#: ../../glossary.rst:1266 msgid "type alias" msgstr "type alias(型別別名)" -#: ../../glossary.rst:1238 +#: ../../glossary.rst:1268 msgid "A synonym for a type, created by assigning the type to an identifier." msgstr "一個型別的同義詞,透過將型別指定給一個識別符 (identifier) 來建立。" -#: ../../glossary.rst:1240 +#: ../../glossary.rst:1270 msgid "" "Type aliases are useful for simplifying :term:`type hints `. For " "example::" msgstr "" "型別別名對於簡化\\ :term:`型別提示 (type hint) ` 很有用。例如: ::" -#: ../../glossary.rst:1243 +#: ../../glossary.rst:1273 msgid "" "def remove_gray_shades(\n" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" @@ -2849,11 +2924,11 @@ msgstr "" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" " pass" -#: ../../glossary.rst:1247 +#: ../../glossary.rst:1277 msgid "could be made more readable like this::" msgstr "可以寫成這樣,更具有可讀性: ::" -#: ../../glossary.rst:1249 +#: ../../glossary.rst:1279 msgid "" "Color = tuple[int, int, int]\n" "\n" @@ -2865,15 +2940,15 @@ msgstr "" "def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" " pass" -#: ../../glossary.rst:1254 ../../glossary.rst:1268 +#: ../../glossary.rst:1284 ../../glossary.rst:1298 msgid "See :mod:`typing` and :pep:`484`, which describe this functionality." msgstr "請參閱 :mod:`typing` 和 :pep:`484`,有此功能的描述。" -#: ../../glossary.rst:1255 +#: ../../glossary.rst:1285 msgid "type hint" msgstr "type hint(型別提示)" -#: ../../glossary.rst:1257 +#: ../../glossary.rst:1287 msgid "" "An :term:`annotation` that specifies the expected type for a variable, a " "class attribute, or a function parameter or return value." @@ -2881,7 +2956,7 @@ msgstr "" "一種 :term:`annotation`\\ (註釋),它指定一個變數、一個 class 屬性或一個函式" "的參數或回傳值的預期型別。" -#: ../../glossary.rst:1260 +#: ../../glossary.rst:1290 msgid "" "Type hints are optional and are not enforced by Python but they are useful " "to :term:`static type checkers `. They can also aid " @@ -2891,7 +2966,7 @@ msgstr "" "(static type checkers) `\\ 很有用,並能協助 IDE 完成程式" "碼的補全 (completion) 和重構 (refactoring)。" -#: ../../glossary.rst:1264 +#: ../../glossary.rst:1294 msgid "" "Type hints of global variables, class attributes, and functions, but not " "local variables, can be accessed using :func:`typing.get_type_hints`." @@ -2899,11 +2974,11 @@ msgstr "" "全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使用 :func:" "`typing.get_type_hints` 來存取。" -#: ../../glossary.rst:1269 +#: ../../glossary.rst:1299 msgid "universal newlines" msgstr "universal newlines(通用換行字元)" -#: ../../glossary.rst:1271 +#: ../../glossary.rst:1301 msgid "" "A manner of interpreting text streams in which all of the following are " "recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the " @@ -2916,20 +2991,20 @@ msgstr "" "``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用於 :func:`bytes." "splitlines` 的附加用途。" -#: ../../glossary.rst:1276 +#: ../../glossary.rst:1306 msgid "variable annotation" msgstr "variable annotation(變數註釋)" -#: ../../glossary.rst:1278 +#: ../../glossary.rst:1308 msgid "An :term:`annotation` of a variable or a class attribute." msgstr "一個變數或 class 屬性的 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:1280 +#: ../../glossary.rst:1310 msgid "" "When annotating a variable or a class attribute, assignment is optional::" msgstr "註釋變數或 class 屬性時,賦值是選擇性的: ::" -#: ../../glossary.rst:1282 +#: ../../glossary.rst:1312 msgid "" "class C:\n" " field: 'annotation'" @@ -2937,7 +3012,7 @@ msgstr "" "class C:\n" " field: 'annotation'" -#: ../../glossary.rst:1285 +#: ../../glossary.rst:1315 msgid "" "Variable annotations are usually used for :term:`type hints `: " "for example this variable is expected to take :class:`int` values::" @@ -2945,15 +3020,15 @@ msgstr "" "變數註釋通常用於\\ :term:`型別提示 (type hint) `:例如,這個變數預" "期會取得 :class:`int`\\ (整數)值: ::" -#: ../../glossary.rst:1289 +#: ../../glossary.rst:1319 msgid "count: int = 0" msgstr "count: int = 0" -#: ../../glossary.rst:1291 +#: ../../glossary.rst:1321 msgid "Variable annotation syntax is explained in section :ref:`annassign`." msgstr "變數註釋的語法在\\ :ref:`annassign`\\ 章節有詳細的解釋。" -#: ../../glossary.rst:1293 +#: ../../glossary.rst:1323 msgid "" "See :term:`function annotation`, :pep:`484` and :pep:`526`, which describe " "this functionality. Also see :ref:`annotations-howto` for best practices on " @@ -2962,11 +3037,11 @@ msgstr "" "請參閱 :term:`function annotation`\\ (函式註釋)、:pep:`484` 和 :pep:`526`," "皆有此功能的描述。關於註釋的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:1297 +#: ../../glossary.rst:1327 msgid "virtual environment" msgstr "virtual environment(虛擬環境)" -#: ../../glossary.rst:1299 +#: ../../glossary.rst:1329 msgid "" "A cooperatively isolated runtime environment that allows Python users and " "applications to install and upgrade Python distribution packages without " @@ -2977,15 +3052,15 @@ msgstr "" "程式得以安裝和升級 Python 發佈套件,而不會對同一個系統上運行的其他 Python 應" "用程式的行為產生干擾。" -#: ../../glossary.rst:1304 +#: ../../glossary.rst:1334 msgid "See also :mod:`venv`." msgstr "另請參閱 :mod:`venv`。" -#: ../../glossary.rst:1305 +#: ../../glossary.rst:1335 msgid "virtual machine" msgstr "virtual machine(虛擬機器)" -#: ../../glossary.rst:1307 +#: ../../glossary.rst:1337 msgid "" "A computer defined entirely in software. Python's virtual machine executes " "the :term:`bytecode` emitted by the bytecode compiler." @@ -2993,11 +3068,11 @@ msgstr "" "一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行由 :term:" "`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" -#: ../../glossary.rst:1309 +#: ../../glossary.rst:1339 msgid "Zen of Python" msgstr "Zen of Python(Python 之禪)" -#: ../../glossary.rst:1311 +#: ../../glossary.rst:1341 msgid "" "Listing of Python design principles and philosophies that are helpful in " "understanding and using the language. The listing can be found by typing " @@ -3006,22 +3081,34 @@ msgstr "" "Python 設計原則與哲學的列表,其內容有助於理解和使用此語言。此列表可以透過在互" "動式提式字元後輸入「``import this``」來找到它。" -#: ../../glossary.rst:256 +#: ../../glossary.rst:278 msgid "C-contiguous" msgstr "C-contiguous(C 連續的)" -#: ../../glossary.rst:256 +#: ../../glossary.rst:278 msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" -#: ../../glossary.rst:771 +#: ../../glossary.rst:803 msgid "magic" msgstr "magic" -#: ../../glossary.rst:1168 +#: ../../glossary.rst:1198 msgid "special" msgstr "special" +#~ msgid "" +#~ "The main difference between a \"soft\" and a (regular) \"hard\" " +#~ "deprecation is that the soft deprecation does not imply scheduling the " +#~ "removal of the deprecated API." +#~ msgstr "" +#~ "「軟性」棄用和(常規的)「硬性」棄用之間的主要區別在於,軟性棄用並不代表已" +#~ "經確定要什麼時候刪除已棄用的 API。" + +#~ msgid "" +#~ "Another difference is that a soft deprecation does not issue a warning." +#~ msgstr "另一個區別是軟性棄用不會發出警告。" + #~ msgid "2to3" #~ msgstr "2to3" diff --git a/howto/argparse-optparse.po b/howto/argparse-optparse.po new file mode 100644 index 0000000000..d54b85eb9c --- /dev/null +++ b/howto/argparse-optparse.po @@ -0,0 +1,119 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-09 00:13+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../howto/argparse-optparse.rst:7 +msgid "Upgrading optparse code" +msgstr "" + +#: ../../howto/argparse-optparse.rst:9 +msgid "" +"Originally, the :mod:`argparse` module had attempted to maintain " +"compatibility with :mod:`optparse`. However, :mod:`optparse` was difficult " +"to extend transparently, particularly with the changes required to support " +"``nargs=`` specifiers and better usage messages. When most everything in :" +"mod:`optparse` had either been copy-pasted over or monkey-patched, it no " +"longer seemed practical to try to maintain the backwards compatibility." +msgstr "" + +#: ../../howto/argparse-optparse.rst:16 +msgid "" +"The :mod:`argparse` module improves on the :mod:`optparse` module in a " +"number of ways including:" +msgstr "" + +#: ../../howto/argparse-optparse.rst:19 +msgid "Handling positional arguments." +msgstr "" + +#: ../../howto/argparse-optparse.rst:20 +msgid "Supporting subcommands." +msgstr "" + +#: ../../howto/argparse-optparse.rst:21 +msgid "Allowing alternative option prefixes like ``+`` and ``/``." +msgstr "" + +#: ../../howto/argparse-optparse.rst:22 +msgid "Handling zero-or-more and one-or-more style arguments." +msgstr "" + +#: ../../howto/argparse-optparse.rst:23 +msgid "Producing more informative usage messages." +msgstr "" + +#: ../../howto/argparse-optparse.rst:24 +msgid "Providing a much simpler interface for custom ``type`` and ``action``." +msgstr "" + +#: ../../howto/argparse-optparse.rst:26 +msgid "A partial upgrade path from :mod:`optparse` to :mod:`argparse`:" +msgstr "" + +#: ../../howto/argparse-optparse.rst:28 +msgid "" +"Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:" +"`ArgumentParser.add_argument` calls." +msgstr "" + +#: ../../howto/argparse-optparse.rst:31 +msgid "" +"Replace ``(options, args) = parser.parse_args()`` with ``args = parser." +"parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls " +"for the positional arguments. Keep in mind that what was previously called " +"``options``, now in the :mod:`argparse` context is called ``args``." +msgstr "" + +#: ../../howto/argparse-optparse.rst:36 +msgid "" +"Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using :" +"meth:`~ArgumentParser.parse_intermixed_args` instead of :meth:" +"`~ArgumentParser.parse_args`." +msgstr "" + +#: ../../howto/argparse-optparse.rst:40 +msgid "" +"Replace callback actions and the ``callback_*`` keyword arguments with " +"``type`` or ``action`` arguments." +msgstr "" + +#: ../../howto/argparse-optparse.rst:43 +msgid "" +"Replace string names for ``type`` keyword arguments with the corresponding " +"type objects (e.g. int, float, complex, etc)." +msgstr "" + +#: ../../howto/argparse-optparse.rst:46 +msgid "" +"Replace :class:`optparse.Values` with :class:`Namespace` and :exc:`optparse." +"OptionError` and :exc:`optparse.OptionValueError` with :exc:`ArgumentError`." +msgstr "" + +#: ../../howto/argparse-optparse.rst:50 +msgid "" +"Replace strings with implicit arguments such as ``%default`` or ``%prog`` " +"with the standard Python syntax to use dictionaries to format strings, that " +"is, ``%(default)s`` and ``%(prog)s``." +msgstr "" + +#: ../../howto/argparse-optparse.rst:54 +msgid "" +"Replace the OptionParser constructor ``version`` argument with a call to " +"``parser.add_argument('--version', action='http://github.com/version', version='')``." +msgstr "" diff --git a/howto/argparse.po b/howto/argparse.po index aeb863ddff..c71d110388 100644 --- a/howto/argparse.po +++ b/howto/argparse.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-18 00:14+0000\n" "PO-Revision-Date: 2023-12-11 17:33+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1222,6 +1222,7 @@ msgstr "" " print(answer)" #: ../../howto/argparse.rst:618 ../../howto/argparse.rst:656 +#: ../../howto/argparse.rst:872 msgid "Output:" msgstr "結果:" @@ -1633,10 +1634,95 @@ msgid "" msgstr "若要在 :mod:`argparse` 輸出中翻譯你自己的字串,請使用 :mod:`gettext`。" #: ../../howto/argparse.rst:845 +msgid "Custom type converters" +msgstr "" + +#: ../../howto/argparse.rst:847 +msgid "" +"The :mod:`argparse` module allows you to specify custom type converters for " +"your command-line arguments. This allows you to modify user input before " +"it's stored in the :class:`argparse.Namespace`. This can be useful when you " +"need to pre-process the input before it is used in your program." +msgstr "" + +#: ../../howto/argparse.rst:852 +msgid "" +"When using a custom type converter, you can use any callable that takes a " +"single string argument (the argument value) and returns the converted value. " +"However, if you need to handle more complex scenarios, you can use a custom " +"action class with the **action** parameter instead." +msgstr "" + +#: ../../howto/argparse.rst:857 +msgid "" +"For example, let's say you want to handle arguments with different prefixes " +"and process them accordingly::" +msgstr "" + +#: ../../howto/argparse.rst:860 +msgid "" +"import argparse\n" +"\n" +"parser = argparse.ArgumentParser(prefix_chars='-+')\n" +"\n" +"parser.add_argument('-a', metavar='', action='http://github.com/append',\n" +" type=lambda x: ('-', x))\n" +"parser.add_argument('+a', metavar='', action='http://github.com/append',\n" +" type=lambda x: ('+', x))\n" +"\n" +"args = parser.parse_args()\n" +"print(args)" +msgstr "" +"import argparse\n" +"\n" +"parser = argparse.ArgumentParser(prefix_chars='-+')\n" +"\n" +"parser.add_argument('-a', metavar='', action='http://github.com/append',\n" +" type=lambda x: ('-', x))\n" +"parser.add_argument('+a', metavar='', action='http://github.com/append',\n" +" type=lambda x: ('+', x))\n" +"\n" +"args = parser.parse_args()\n" +"print(args)" + +#: ../../howto/argparse.rst:874 +msgid "" +"$ python prog.py -a value1 +a value2\n" +"Namespace(a=[('-', 'value1'), ('+', 'value2')])" +msgstr "" +"$ python prog.py -a value1 +a value2\n" +"Namespace(a=[('-', 'value1'), ('+', 'value2')])" + +#: ../../howto/argparse.rst:879 +msgid "In this example, we:" +msgstr "在這個範例當中,我們:" + +#: ../../howto/argparse.rst:881 +msgid "" +"Created a parser with custom prefix characters using the ``prefix_chars`` " +"parameter." +msgstr "" + +#: ../../howto/argparse.rst:884 +msgid "" +"Defined two arguments, ``-a`` and ``+a``, which used the ``type`` parameter " +"to create custom type converters to store the value in a tuple with the " +"prefix." +msgstr "" + +#: ../../howto/argparse.rst:887 +msgid "" +"Without the custom type converters, the arguments would have treated the ``-" +"a`` and ``+a`` as the same argument, which would have been undesirable. By " +"using custom type converters, we were able to differentiate between the two " +"arguments." +msgstr "" + +#: ../../howto/argparse.rst:892 msgid "Conclusion" msgstr "結論" -#: ../../howto/argparse.rst:847 +#: ../../howto/argparse.rst:894 msgid "" "The :mod:`argparse` module offers a lot more than shown here. Its docs are " "quite detailed and thorough, and full of examples. Having gone through this " diff --git a/includes/wasm-notavail.po b/includes/wasm-notavail.po deleted file mode 100644 index 0dad50cab5..0000000000 --- a/includes/wasm-notavail.po +++ /dev/null @@ -1,29 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. -# -msgid "" -msgstr "" -"Project-Id-Version: Python 3.13\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-02-13 00:17+0000\n" -"PO-Revision-Date: 2022-10-16 07:40+0800\n" -"Last-Translator: \n" -"Language-Team: \n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 3.1.1\n" - -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: ../../includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" diff --git a/library/_thread.po b/library/_thread.po index c36a47a237..91130e2cc2 100644 --- a/library/_thread.po +++ b/library/_thread.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-12 00:13+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -172,18 +171,13 @@ msgstr "" "的值可用於在整個系統中唯一標識此特定執行緒(直到執行緒終止後,該值可能被操作" "系統重新使用)。" -#: ../../library/_thread.rst:123 -#, fuzzy -msgid "" -":ref:`Availability `: Windows, FreeBSD, Linux, macOS, OpenBSD, " -"NetBSD, AIX, DragonFlyBSD, GNU/kFreeBSD." +#: ../../library/_thread.rst:123 ../../library/_thread.rst:148 +msgid "Availability" msgstr "" -":ref:`適用 `:Windows、FreeBSD、Linux、macOS、OpenBSD、NetBSD、" -"AIX、DragonFlyBSD。" #: ../../library/_thread.rst:127 msgid "Added support for GNU/kFreeBSD." -msgstr "" +msgstr "新增了對 GNU/kFreeBSD 的支援。" #: ../../library/_thread.rst:133 msgid "" @@ -213,10 +207,6 @@ msgstr "" "分配。應參考平台文檔以獲取更多訊息(4 KiB 頁面是比較普遍的;在缺乏更具體訊息" "的情況下,建議使用 4096 的倍數作為堆疊大小)。" -#: ../../library/_thread.rst:148 -msgid ":ref:`Availability `: Windows, pthreads." -msgstr ":ref:`適用 `:Windows、pthreads。" - #: ../../library/_thread.rst:150 msgid "Unix platforms with POSIX threads support." msgstr "Unix 平台上支援 POSIX 執行緒。" @@ -307,6 +297,12 @@ msgid "" "with a_lock:\n" " print(\"a_lock is locked while this executes\")" msgstr "" +"import _thread\n" +"\n" +"a_lock = _thread.allocate_lock()\n" +"\n" +"with a_lock:\n" +" print(\"a_lock 在執行這裡時被鎖定\")" #: ../../library/_thread.rst:212 msgid "**Caveats:**" @@ -314,15 +310,11 @@ msgstr "**注意事項:**" #: ../../library/_thread.rst:216 msgid "" -"Threads interact strangely with interrupts: the :exc:`KeyboardInterrupt` " -"exception will be received by an arbitrary thread. (When the :mod:`signal` " -"module is available, interrupts always go to the main thread.)" -msgstr "" -"執行緒與中斷的互動可能會有奇怪的情況:任何一個執行緒都有可能收到 :exc:" -"`KeyboardInterrupt` 例外。(當 :mod:`signal` 模組可用時,中斷總是會進入主執行" -"緒。)" +"Interrupts always go to the main thread (the :exc:`KeyboardInterrupt` " +"exception will be received by that thread.)" +msgstr "中斷總會跳到主執行緒(該執行緒將接收 :exc:`KeyboardInterrupt` 例外。)" -#: ../../library/_thread.rst:220 +#: ../../library/_thread.rst:219 msgid "" "Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is " "equivalent to calling :func:`_thread.exit`." @@ -330,16 +322,19 @@ msgstr "" "呼叫 :func:`sys.exit` 函數或引發 :exc:`SystemExit` 例外等同於呼叫 :func:" "`_thread.exit` 函式。" -#: ../../library/_thread.rst:223 +#: ../../library/_thread.rst:222 msgid "" -"It is not possible to interrupt the :meth:`~threading.Lock.acquire` method " -"on a lock --- the :exc:`KeyboardInterrupt` exception will happen after the " -"lock has been acquired." +"It is platform-dependent whether the :meth:`~threading.Lock.acquire` method " +"on a lock can be interrupted (so that the :exc:`KeyboardInterrupt` exception " +"will happen immediately, rather than only after the lock has been acquired " +"or the operation has timed out). It can be interrupted on POSIX, but not on " +"Windows." msgstr "" -"無法在鎖的 :meth:`~threading.Lock.acquire` 方法上中斷執行, :exc:" -"`KeyboardInterrupt` 例外會在鎖被獲取後發生。" +"鎖的 :meth:`~threading.Lock.acquire` 方法是否可以中斷(如此一來 :exc:" +"`KeyboardInterrupt` 例外會立即發生,而不是僅在取得鎖或操作逾時後)是取決於平" +"台的。在 POSIX 上可以中斷,但在 Windows 上則不行。" -#: ../../library/_thread.rst:227 +#: ../../library/_thread.rst:228 msgid "" "When the main thread exits, it is system defined whether the other threads " "survive. On most systems, they are killed without executing :keyword:" @@ -349,15 +344,6 @@ msgstr "" "終止,而不會執行 :keyword:`try` ... :keyword:`finally` 子句或執行物件的解構函" "式。" -#: ../../library/_thread.rst:232 -msgid "" -"When the main thread exits, it does not do any of its usual cleanup (except " -"that :keyword:`try` ... :keyword:`finally` clauses are honored), and the " -"standard I/O files are not flushed." -msgstr "" -"當主執行緒退出時,它不會執行任何通常的清理操作(除非有 :keyword:`try` ... :" -"keyword:`finally` 子句),並且標準 I/O 檔案不會被刷新。" - #: ../../library/_thread.rst:7 msgid "light-weight processes" msgstr "light-weight processes(輕量級行程)" diff --git a/library/argparse.po b/library/argparse.po index 958fbaa23f..9c267fb807 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 23:08+0000\n" +"POT-Creation-Date: 2024-10-16 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -20,8 +20,8 @@ msgstr "" #: ../../library/argparse.rst:2 msgid "" -":mod:`!argparse` --- Parser for command-line options, arguments and sub-" -"commands" +":mod:`!argparse` --- Parser for command-line options, arguments and " +"subcommands" msgstr "" #: ../../library/argparse.rst:12 @@ -41,27 +41,23 @@ msgstr "" #: ../../library/argparse.rst:22 msgid "" -"The :mod:`argparse` module makes it easy to write user-friendly command-line " -"interfaces. The program defines what arguments it requires, and :mod:" -"`argparse` will figure out how to parse those out of :data:`sys.argv`. The :" -"mod:`argparse` module also automatically generates help and usage messages. " -"The module will also issue errors when users give the program invalid " -"arguments." +"The :mod:`!argparse` module makes it easy to write user-friendly command-" +"line interfaces. The program defines what arguments it requires, and :mod:`!" +"argparse` will figure out how to parse those out of :data:`sys.argv`. The :" +"mod:`!argparse` module also automatically generates help and usage " +"messages. The module will also issue errors when users give the program " +"invalid arguments." msgstr "" -#: ../../library/argparse.rst:30 -msgid "Core Functionality" -msgstr "" - -#: ../../library/argparse.rst:32 +#: ../../library/argparse.rst:28 msgid "" -"The :mod:`argparse` module's support for command-line interfaces is built " +"The :mod:`!argparse` module's support for command-line interfaces is built " "around an instance of :class:`argparse.ArgumentParser`. It is a container " "for argument specifications and has options that apply to the parser as " "whole::" msgstr "" -#: ../../library/argparse.rst:36 +#: ../../library/argparse.rst:32 msgid "" "parser = argparse.ArgumentParser(\n" " prog='ProgramName',\n" @@ -69,14 +65,14 @@ msgid "" " epilog='Text at the bottom of help')" msgstr "" -#: ../../library/argparse.rst:41 +#: ../../library/argparse.rst:37 msgid "" "The :meth:`ArgumentParser.add_argument` method attaches individual argument " "specifications to the parser. It supports positional arguments, options " "that accept values, and on/off flags::" msgstr "" -#: ../../library/argparse.rst:45 +#: ../../library/argparse.rst:41 msgid "" "parser.add_argument('filename') # positional argument\n" "parser.add_argument('-c', '--count') # option that takes a value\n" @@ -84,509 +80,161 @@ msgid "" " action='http://github.com/store_true') # on/off flag" msgstr "" -#: ../../library/argparse.rst:50 +#: ../../library/argparse.rst:46 msgid "" "The :meth:`ArgumentParser.parse_args` method runs the parser and places the " "extracted data in a :class:`argparse.Namespace` object::" msgstr "" -#: ../../library/argparse.rst:53 +#: ../../library/argparse.rst:49 msgid "" "args = parser.parse_args()\n" "print(args.filename, args.count, args.verbose)" msgstr "" -#: ../../library/argparse.rst:58 -msgid "Quick Links for add_argument()" -msgstr "" - -#: ../../library/argparse.rst:61 -msgid "Name" -msgstr "名稱" - -#: ../../library/argparse.rst:61 -msgid "Description" -msgstr "描述" - -#: ../../library/argparse.rst:61 -msgid "Values" -msgstr "數值" - -#: ../../library/argparse.rst:63 -msgid "action_" -msgstr "action_" - -#: ../../library/argparse.rst:63 -msgid "Specify how an argument should be handled" -msgstr "" - -#: ../../library/argparse.rst:63 -msgid "" -"``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, " -"``'append_const'``, ``'count'``, ``'help'``, ``'version'``" -msgstr "" -"``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, " -"``'append_const'``, ``'count'``, ``'help'``, ``'version'``" - -#: ../../library/argparse.rst:64 -msgid "choices_" -msgstr "choices_" - -#: ../../library/argparse.rst:64 -msgid "Limit values to a specific set of choices" -msgstr "" - -#: ../../library/argparse.rst:64 -msgid "" -"``['foo', 'bar']``, ``range(1, 10)``, or :class:`~collections.abc.Container` " -"instance" -msgstr "" - -#: ../../library/argparse.rst:65 -msgid "const_" -msgstr "const_" - -#: ../../library/argparse.rst:65 -msgid "Store a constant value" -msgstr "" - -#: ../../library/argparse.rst:66 -msgid "default_" -msgstr "default_" - -#: ../../library/argparse.rst:66 -msgid "Default value used when an argument is not provided" -msgstr "" - -#: ../../library/argparse.rst:66 -msgid "Defaults to ``None``" -msgstr "" - -#: ../../library/argparse.rst:67 -msgid "dest_" -msgstr "dest_" - -#: ../../library/argparse.rst:67 -msgid "Specify the attribute name used in the result namespace" -msgstr "" - -#: ../../library/argparse.rst:68 -msgid "help_" -msgstr "help_" - -#: ../../library/argparse.rst:68 -msgid "Help message for an argument" -msgstr "" - -#: ../../library/argparse.rst:69 -msgid "metavar_" -msgstr "metavar_" - -#: ../../library/argparse.rst:69 -msgid "Alternate display name for the argument as shown in help" -msgstr "" - -#: ../../library/argparse.rst:70 -msgid "nargs_" -msgstr "nargs_" - -#: ../../library/argparse.rst:70 -msgid "Number of times the argument can be used" -msgstr "" - -#: ../../library/argparse.rst:70 -msgid ":class:`int`, ``'?'``, ``'*'``, or ``'+'``" -msgstr ":class:`int`, ``'?'``, ``'*'``, or ``'+'``" - -#: ../../library/argparse.rst:71 -msgid "required_" -msgstr "required_" - -#: ../../library/argparse.rst:71 -msgid "Indicate whether an argument is required or optional" -msgstr "" - -#: ../../library/argparse.rst:71 -msgid "``True`` or ``False``" -msgstr "``True`` 或 ``False``" - -#: ../../library/argparse.rst:72 -msgid ":ref:`type `" -msgstr "" - -#: ../../library/argparse.rst:72 -msgid "Automatically convert an argument to the given type" -msgstr "" - -#: ../../library/argparse.rst:72 -msgid "" -":class:`int`, :class:`float`, ``argparse.FileType('w')``, or callable " -"function" -msgstr "" -":class:`int`、:class:`float`、``argparse.FileType('w')`` 或可呼叫的函式" - -#: ../../library/argparse.rst:77 -msgid "Example" -msgstr "範例" - -#: ../../library/argparse.rst:79 -msgid "" -"The following code is a Python program that takes a list of integers and " -"produces either the sum or the max::" -msgstr "" - -#: ../../library/argparse.rst:82 -msgid "" -"import argparse\n" -"\n" -"parser = argparse.ArgumentParser(description='Process some integers.')\n" -"parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" -" help='an integer for the accumulator')\n" -"parser.add_argument('--sum', dest='accumulate', action='http://github.com/store_const',\n" -" const=sum, default=max,\n" -" help='sum the integers (default: find the max)')\n" -"\n" -"args = parser.parse_args()\n" -"print(args.accumulate(args.integers))" -msgstr "" -"import argparse\n" -"\n" -"parser = argparse.ArgumentParser(description='Process some integers.')\n" -"parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" -" help='an integer for the accumulator')\n" -"parser.add_argument('--sum', dest='accumulate', action='http://github.com/store_const',\n" -" const=sum, default=max,\n" -" help='sum the integers (default: find the max)')\n" -"\n" -"args = parser.parse_args()\n" -"print(args.accumulate(args.integers))" - -#: ../../library/argparse.rst:94 -msgid "" -"Assuming the above Python code is saved into a file called ``prog.py``, it " -"can be run at the command line and it provides useful help messages:" -msgstr "" - -#: ../../library/argparse.rst:97 -msgid "" -"$ python prog.py -h\n" -"usage: prog.py [-h] [--sum] N [N ...]\n" -"\n" -"Process some integers.\n" -"\n" -"positional arguments:\n" -" N an integer for the accumulator\n" -"\n" -"options:\n" -" -h, --help show this help message and exit\n" -" --sum sum the integers (default: find the max)" -msgstr "" -"$ python prog.py -h\n" -"usage: prog.py [-h] [--sum] N [N ...]\n" -"\n" -"Process some integers.\n" -"\n" -"positional arguments:\n" -" N an integer for the accumulator\n" -"\n" -"options:\n" -" -h, --help show this help message and exit\n" -" --sum sum the integers (default: find the max)" - -#: ../../library/argparse.rst:111 -msgid "" -"When run with the appropriate arguments, it prints either the sum or the max " -"of the command-line integers:" -msgstr "" - -#: ../../library/argparse.rst:114 -msgid "" -"$ python prog.py 1 2 3 4\n" -"4\n" -"\n" -"$ python prog.py 1 2 3 4 --sum\n" -"10" -msgstr "" -"$ python prog.py 1 2 3 4\n" -"4\n" -"\n" -"$ python prog.py 1 2 3 4 --sum\n" -"10" - -#: ../../library/argparse.rst:122 -msgid "If invalid arguments are passed in, an error will be displayed:" -msgstr "" - -#: ../../library/argparse.rst:124 -msgid "" -"$ python prog.py a b c\n" -"usage: prog.py [-h] [--sum] N [N ...]\n" -"prog.py: error: argument N: invalid int value: 'a'" -msgstr "" -"$ python prog.py a b c\n" -"usage: prog.py [-h] [--sum] N [N ...]\n" -"prog.py: error: argument N: invalid int value: 'a'" - -#: ../../library/argparse.rst:130 -msgid "The following sections walk you through this example." -msgstr "" - -#: ../../library/argparse.rst:134 -msgid "Creating a parser" -msgstr "建立一個剖析器" - -#: ../../library/argparse.rst:136 -msgid "" -"The first step in using the :mod:`argparse` is creating an :class:" -"`ArgumentParser` object::" -msgstr "" - -#: ../../library/argparse.rst:139 -msgid "" -">>> parser = argparse.ArgumentParser(description='Process some integers.')" -msgstr "" -">>> parser = argparse.ArgumentParser(description='Process some integers.')" - -#: ../../library/argparse.rst:141 -msgid "" -"The :class:`ArgumentParser` object will hold all the information necessary " -"to parse the command line into Python data types." -msgstr "" - -#: ../../library/argparse.rst:146 -msgid "Adding arguments" -msgstr "增加引數" - -#: ../../library/argparse.rst:148 -msgid "" -"Filling an :class:`ArgumentParser` with information about program arguments " -"is done by making calls to the :meth:`~ArgumentParser.add_argument` method. " -"Generally, these calls tell the :class:`ArgumentParser` how to take the " -"strings on the command line and turn them into objects. This information is " -"stored and used when :meth:`~ArgumentParser.parse_args` is called. For " -"example::" -msgstr "" - -#: ../../library/argparse.rst:154 -msgid "" -">>> parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" -"... help='an integer for the accumulator')\n" -">>> parser.add_argument('--sum', dest='accumulate', action='http://github.com/store_const',\n" -"... const=sum, default=max,\n" -"... help='sum the integers (default: find the max)')" -msgstr "" -">>> parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" -"... help='an integer for the accumulator')\n" -">>> parser.add_argument('--sum', dest='accumulate', action='http://github.com/store_const',\n" -"... const=sum, default=max,\n" -"... help='sum the integers (default: find the max)')" - -#: ../../library/argparse.rst:160 -msgid "" -"Later, calling :meth:`~ArgumentParser.parse_args` will return an object with " -"two attributes, ``integers`` and ``accumulate``. The ``integers`` attribute " -"will be a list of one or more integers, and the ``accumulate`` attribute " -"will be either the :func:`sum` function, if ``--sum`` was specified at the " -"command line, or the :func:`max` function if it was not." -msgstr "" - -#: ../../library/argparse.rst:168 -msgid "Parsing arguments" -msgstr "剖析引數" - -#: ../../library/argparse.rst:170 -msgid "" -":class:`ArgumentParser` parses arguments through the :meth:`~ArgumentParser." -"parse_args` method. This will inspect the command line, convert each " -"argument to the appropriate type and then invoke the appropriate action. In " -"most cases, this means a simple :class:`Namespace` object will be built up " -"from attributes parsed out of the command line::" -msgstr "" - -#: ../../library/argparse.rst:176 -msgid "" -">>> parser.parse_args(['--sum', '7', '-1', '42'])\n" -"Namespace(accumulate=, integers=[7, -1, 42])" -msgstr "" -">>> parser.parse_args(['--sum', '7', '-1', '42'])\n" -"Namespace(accumulate=, integers=[7, -1, 42])" - -#: ../../library/argparse.rst:179 +#: ../../library/argparse.rst:53 msgid "" -"In a script, :meth:`~ArgumentParser.parse_args` will typically be called " -"with no arguments, and the :class:`ArgumentParser` will automatically " -"determine the command-line arguments from :data:`sys.argv`." +"If you're looking a guide about how to upgrade optparse code to argparse, " +"see :ref:`Upgrading Optparse Code `." msgstr "" -#: ../../library/argparse.rst:185 +#: ../../library/argparse.rst:57 msgid "ArgumentParser objects" msgstr "ArgumentParser 物件" -#: ../../library/argparse.rst:194 +#: ../../library/argparse.rst:66 msgid "" "Create a new :class:`ArgumentParser` object. All parameters should be passed " "as keyword arguments. Each parameter has its own more detailed description " "below, but in short they are:" msgstr "" -#: ../../library/argparse.rst:198 +#: ../../library/argparse.rst:70 msgid "" "prog_ - The name of the program (default: ``os.path.basename(sys.argv[0])``)" msgstr "" -#: ../../library/argparse.rst:201 +#: ../../library/argparse.rst:73 msgid "" "usage_ - The string describing the program usage (default: generated from " "arguments added to parser)" msgstr "" -#: ../../library/argparse.rst:204 +#: ../../library/argparse.rst:76 msgid "" "description_ - Text to display before the argument help (by default, no text)" msgstr "" -#: ../../library/argparse.rst:207 +#: ../../library/argparse.rst:79 msgid "epilog_ - Text to display after the argument help (by default, no text)" msgstr "" -#: ../../library/argparse.rst:209 +#: ../../library/argparse.rst:81 msgid "" "parents_ - A list of :class:`ArgumentParser` objects whose arguments should " "also be included" msgstr "" -#: ../../library/argparse.rst:212 +#: ../../library/argparse.rst:84 msgid "formatter_class_ - A class for customizing the help output" msgstr "" -#: ../../library/argparse.rst:214 +#: ../../library/argparse.rst:86 msgid "" "prefix_chars_ - The set of characters that prefix optional arguments " "(default: '-')" msgstr "" -#: ../../library/argparse.rst:217 +#: ../../library/argparse.rst:89 msgid "" "fromfile_prefix_chars_ - The set of characters that prefix files from which " "additional arguments should be read (default: ``None``)" msgstr "" -#: ../../library/argparse.rst:220 +#: ../../library/argparse.rst:92 msgid "" "argument_default_ - The global default value for arguments (default: " "``None``)" msgstr "" -#: ../../library/argparse.rst:223 +#: ../../library/argparse.rst:95 msgid "" "conflict_handler_ - The strategy for resolving conflicting optionals " "(usually unnecessary)" msgstr "" -#: ../../library/argparse.rst:226 +#: ../../library/argparse.rst:98 msgid "" "add_help_ - Add a ``-h/--help`` option to the parser (default: ``True``)" msgstr "" -#: ../../library/argparse.rst:228 +#: ../../library/argparse.rst:100 msgid "" "allow_abbrev_ - Allows long options to be abbreviated if the abbreviation is " "unambiguous. (default: ``True``)" msgstr "" -#: ../../library/argparse.rst:231 +#: ../../library/argparse.rst:103 msgid "" "exit_on_error_ - Determines whether or not ArgumentParser exits with error " "info when an error occurs. (default: ``True``)" msgstr "" -#: ../../library/argparse.rst:234 +#: ../../library/argparse.rst:106 msgid "*allow_abbrev* parameter was added." msgstr "新增 *allow_abbrev* 參數。" -#: ../../library/argparse.rst:237 +#: ../../library/argparse.rst:109 msgid "" "In previous versions, *allow_abbrev* also disabled grouping of short flags " "such as ``-vv`` to mean ``-v -v``." msgstr "" -#: ../../library/argparse.rst:241 +#: ../../library/argparse.rst:113 msgid "*exit_on_error* parameter was added." msgstr "新增 *exit_on_error* 參數。" -#: ../../library/argparse.rst:244 ../../library/argparse.rst:783 +#: ../../library/argparse.rst:116 ../../library/argparse.rst:598 msgid "The following sections describe how each of these are used." msgstr "" -#: ../../library/argparse.rst:250 +#: ../../library/argparse.rst:122 msgid "prog" msgstr "" -#: ../../library/argparse.rst:252 +#: ../../library/argparse.rst:125 msgid "" -"By default, :class:`ArgumentParser` objects use the base name (see :func:`os." -"path.basename`) of ``sys.argv[0]`` to determine how to display the name of " -"the program in help messages. This default is almost always desirable " -"because it will make the help messages match the name that was used to " -"invoke the program on the command line. For example, consider a file named " -"``myprogram.py`` with the following code::" +"By default, :class:`ArgumentParser` calculates the name of the program to " +"display in help messages depending on the way the Python interpreter was run:" msgstr "" -#: ../../library/argparse.rst:259 ../../library/argparse.rst:679 +#: ../../library/argparse.rst:128 msgid "" -"import argparse\n" -"parser = argparse.ArgumentParser()\n" -"parser.add_argument('--foo', help='foo help')\n" -"args = parser.parse_args()" +"The :func:`base name ` of ``sys.argv[0]`` if a file was " +"passed as argument." msgstr "" -"import argparse\n" -"parser = argparse.ArgumentParser()\n" -"parser.add_argument('--foo', help='foo help')\n" -"args = parser.parse_args()" -#: ../../library/argparse.rst:264 +#: ../../library/argparse.rst:130 msgid "" -"The help for this program will display ``myprogram.py`` as the program name " -"(regardless of where the program was invoked from):" +"The Python interpreter name followed by ``sys.argv[0]`` if a directory or a " +"zipfile was passed as argument." msgstr "" -#: ../../library/argparse.rst:267 +#: ../../library/argparse.rst:132 msgid "" -"$ python myprogram.py --help\n" -"usage: myprogram.py [-h] [--foo FOO]\n" -"\n" -"options:\n" -" -h, --help show this help message and exit\n" -" --foo FOO foo help\n" -"$ cd ..\n" -"$ python subdir/myprogram.py --help\n" -"usage: myprogram.py [-h] [--foo FOO]\n" -"\n" -"options:\n" -" -h, --help show this help message and exit\n" -" --foo FOO foo help" +"The Python interpreter name followed by ``-m`` followed by the module or " +"package name if the :option:`-m` option was used." msgstr "" -"$ python myprogram.py --help\n" -"usage: myprogram.py [-h] [--foo FOO]\n" -"\n" -"options:\n" -" -h, --help show this help message and exit\n" -" --foo FOO foo help\n" -"$ cd ..\n" -"$ python subdir/myprogram.py --help\n" -"usage: myprogram.py [-h] [--foo FOO]\n" -"\n" -"options:\n" -" -h, --help show this help message and exit\n" -" --foo FOO foo help" -#: ../../library/argparse.rst:283 +#: ../../library/argparse.rst:135 msgid "" -"To change this default behavior, another value can be supplied using the " -"``prog=`` argument to :class:`ArgumentParser`::" +"This default is almost always desirable because it will make the help " +"messages match the string that was used to invoke the program on the command " +"line. However, to change this default behavior, another value can be " +"supplied using the ``prog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:286 +#: ../../library/argparse.rst:140 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.print_help()\n" @@ -602,14 +250,14 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:293 +#: ../../library/argparse.rst:147 msgid "" "Note that the program name, whether determined from ``sys.argv[0]`` or from " "the ``prog=`` argument, is available to help messages using the ``%(prog)s`` " "format specifier." msgstr "" -#: ../../library/argparse.rst:299 +#: ../../library/argparse.rst:153 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.add_argument('--foo', help='foo of the %(prog)s program')\n" @@ -629,50 +277,18 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO foo of the myprogram program" -#: ../../library/argparse.rst:310 +#: ../../library/argparse.rst:164 msgid "usage" msgstr "" -#: ../../library/argparse.rst:312 +#: ../../library/argparse.rst:166 msgid "" "By default, :class:`ArgumentParser` calculates the usage message from the " -"arguments it contains::" +"arguments it contains. The default message can be overridden with the " +"``usage=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:315 -msgid "" -">>> parser = argparse.ArgumentParser(prog='PROG')\n" -">>> parser.add_argument('--foo', nargs='?', help='foo help')\n" -">>> parser.add_argument('bar', nargs='+', help='bar help')\n" -">>> parser.print_help()\n" -"usage: PROG [-h] [--foo [FOO]] bar [bar ...]\n" -"\n" -"positional arguments:\n" -" bar bar help\n" -"\n" -"options:\n" -" -h, --help show this help message and exit\n" -" --foo [FOO] foo help" -msgstr "" -">>> parser = argparse.ArgumentParser(prog='PROG')\n" -">>> parser.add_argument('--foo', nargs='?', help='foo help')\n" -">>> parser.add_argument('bar', nargs='+', help='bar help')\n" -">>> parser.print_help()\n" -"usage: PROG [-h] [--foo [FOO]] bar [bar ...]\n" -"\n" -"positional arguments:\n" -" bar bar help\n" -"\n" -"options:\n" -" -h, --help show this help message and exit\n" -" --foo [FOO] foo help" - -#: ../../library/argparse.rst:328 -msgid "" -"The default message can be overridden with the ``usage=`` keyword argument::" -msgstr "" - -#: ../../library/argparse.rst:330 +#: ../../library/argparse.rst:170 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s " "[options]')\n" @@ -702,63 +318,43 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo [FOO] foo help" -#: ../../library/argparse.rst:343 +#: ../../library/argparse.rst:183 msgid "" "The ``%(prog)s`` format specifier is available to fill in the program name " "in your usage messages." msgstr "" -#: ../../library/argparse.rst:350 +#: ../../library/argparse.rst:190 msgid "description" msgstr "描述" -#: ../../library/argparse.rst:352 +#: ../../library/argparse.rst:192 msgid "" "Most calls to the :class:`ArgumentParser` constructor will use the " "``description=`` keyword argument. This argument gives a brief description " "of what the program does and how it works. In help messages, the " "description is displayed between the command-line usage string and the help " -"messages for the various arguments::" +"messages for the various arguments." msgstr "" -#: ../../library/argparse.rst:358 -msgid "" -">>> parser = argparse.ArgumentParser(description='A foo that bars')\n" -">>> parser.print_help()\n" -"usage: argparse.py [-h]\n" -"\n" -"A foo that bars\n" -"\n" -"options:\n" -" -h, --help show this help message and exit" -msgstr "" -">>> parser = argparse.ArgumentParser(description='A foo that bars')\n" -">>> parser.print_help()\n" -"usage: argparse.py [-h]\n" -"\n" -"A foo that bars\n" -"\n" -"options:\n" -" -h, --help show this help message and exit" - -#: ../../library/argparse.rst:367 +#: ../../library/argparse.rst:198 msgid "" "By default, the description will be line-wrapped so that it fits within the " "given space. To change this behavior, see the formatter_class_ argument." msgstr "" -#: ../../library/argparse.rst:372 +#: ../../library/argparse.rst:203 msgid "epilog" msgstr "" -#: ../../library/argparse.rst:374 +#: ../../library/argparse.rst:205 msgid "" "Some programs like to display additional description of the program after " "the description of the arguments. Such text can be specified using the " "``epilog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:378 +#: ../../library/argparse.rst:209 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... description='A foo that bars',\n" @@ -786,18 +382,18 @@ msgstr "" "\n" "And that's how you'd foo a bar" -#: ../../library/argparse.rst:391 +#: ../../library/argparse.rst:222 msgid "" "As with the description_ argument, the ``epilog=`` text is by default line-" "wrapped, but this behavior can be adjusted with the formatter_class_ " "argument to :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:397 +#: ../../library/argparse.rst:228 msgid "parents" msgstr "" -#: ../../library/argparse.rst:399 +#: ../../library/argparse.rst:230 msgid "" "Sometimes, several parsers share a common set of arguments. Rather than " "repeating the definitions of these arguments, a single parser with all the " @@ -808,7 +404,7 @@ msgid "" "object being constructed::" msgstr "" -#: ../../library/argparse.rst:406 +#: ../../library/argparse.rst:237 msgid "" ">>> parent_parser = argparse.ArgumentParser(add_help=False)\n" ">>> parent_parser.add_argument('--parent', type=int)\n" @@ -836,32 +432,32 @@ msgstr "" ">>> bar_parser.parse_args(['--bar', 'YYY'])\n" "Namespace(bar='YYY', parent=None)" -#: ../../library/argparse.rst:419 +#: ../../library/argparse.rst:250 msgid "" "Note that most parent parsers will specify ``add_help=False``. Otherwise, " "the :class:`ArgumentParser` will see two ``-h/--help`` options (one in the " "parent and one in the child) and raise an error." msgstr "" -#: ../../library/argparse.rst:424 +#: ../../library/argparse.rst:255 msgid "" "You must fully initialize the parsers before passing them via ``parents=``. " "If you change the parent parsers after the child parser, those changes will " "not be reflected in the child." msgstr "" -#: ../../library/argparse.rst:432 +#: ../../library/argparse.rst:263 msgid "formatter_class" msgstr "formatter_class" -#: ../../library/argparse.rst:434 +#: ../../library/argparse.rst:265 msgid "" ":class:`ArgumentParser` objects allow the help formatting to be customized " "by specifying an alternate formatting class. Currently, there are four such " "classes:" msgstr "" -#: ../../library/argparse.rst:443 +#: ../../library/argparse.rst:274 msgid "" ":class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give " "more control over how textual descriptions are displayed. By default, :class:" @@ -869,7 +465,7 @@ msgid "" "command-line help messages::" msgstr "" -#: ../../library/argparse.rst:448 +#: ../../library/argparse.rst:279 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -893,14 +489,14 @@ msgid "" "will be wrapped across a couple lines" msgstr "" -#: ../../library/argparse.rst:468 +#: ../../library/argparse.rst:299 msgid "" "Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` " "indicates that description_ and epilog_ are already correctly formatted and " "should not be line-wrapped::" msgstr "" -#: ../../library/argparse.rst:472 +#: ../../library/argparse.rst:303 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -925,21 +521,21 @@ msgid "" " -h, --help show this help message and exit" msgstr "" -#: ../../library/argparse.rst:494 +#: ../../library/argparse.rst:325 msgid "" ":class:`RawTextHelpFormatter` maintains whitespace for all sorts of help " -"text, including argument descriptions. However, multiple new lines are " +"text, including argument descriptions. However, multiple newlines are " "replaced with one. If you wish to preserve multiple blank lines, add spaces " "between the newlines." msgstr "" -#: ../../library/argparse.rst:499 +#: ../../library/argparse.rst:330 msgid "" ":class:`ArgumentDefaultsHelpFormatter` automatically adds information about " "default values to each of the argument help messages::" msgstr "" -#: ../../library/argparse.rst:502 +#: ../../library/argparse.rst:333 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -971,14 +567,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO FOO! (default: 42)" -#: ../../library/argparse.rst:517 +#: ../../library/argparse.rst:348 msgid "" ":class:`MetavarTypeHelpFormatter` uses the name of the type_ argument for " "each argument as the display name for its values (rather than using the " "dest_ as the regular formatter does)::" msgstr "" -#: ../../library/argparse.rst:521 +#: ../../library/argparse.rst:352 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -1010,11 +606,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo int" -#: ../../library/argparse.rst:538 +#: ../../library/argparse.rst:369 msgid "prefix_chars" msgstr "prefix_chars" -#: ../../library/argparse.rst:540 +#: ../../library/argparse.rst:371 msgid "" "Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. " "Parsers that need to support different or additional prefix characters, e.g. " @@ -1022,7 +618,7 @@ msgid "" "``prefix_chars=`` argument to the ArgumentParser constructor::" msgstr "" -#: ../../library/argparse.rst:546 +#: ../../library/argparse.rst:377 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')\n" ">>> parser.add_argument('+f')\n" @@ -1036,18 +632,18 @@ msgstr "" ">>> parser.parse_args('+f X ++bar Y'.split())\n" "Namespace(bar='Y', f='X')" -#: ../../library/argparse.rst:552 +#: ../../library/argparse.rst:383 msgid "" "The ``prefix_chars=`` argument defaults to ``'-'``. Supplying a set of " "characters that does not include ``-`` will cause ``-f/--foo`` options to be " "disallowed." msgstr "" -#: ../../library/argparse.rst:558 +#: ../../library/argparse.rst:389 msgid "fromfile_prefix_chars" msgstr "fromfile_prefix_chars" -#: ../../library/argparse.rst:560 +#: ../../library/argparse.rst:391 msgid "" "Sometimes, when dealing with a particularly long argument list, it may make " "sense to keep the list of arguments in a file rather than typing it out at " @@ -1057,7 +653,7 @@ msgid "" "by the arguments they contain. For example::" msgstr "" -#: ../../library/argparse.rst:567 +#: ../../library/argparse.rst:398 msgid "" ">>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:\n" "... fp.write('-f\\nbar')\n" @@ -1075,7 +671,7 @@ msgstr "" ">>> parser.parse_args(['-f', 'foo', '@args.txt'])\n" "Namespace(f='bar')" -#: ../../library/argparse.rst:575 +#: ../../library/argparse.rst:406 msgid "" "Arguments read from a file must by default be one per line (but see also :" "meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they " @@ -1085,32 +681,32 @@ msgid "" "f', 'bar']``." msgstr "" -#: ../../library/argparse.rst:581 +#: ../../library/argparse.rst:412 msgid "" ":class:`ArgumentParser` uses :term:`filesystem encoding and error handler` " "to read the file containing arguments." msgstr "" -#: ../../library/argparse.rst:584 +#: ../../library/argparse.rst:415 msgid "" "The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that " "arguments will never be treated as file references." msgstr "" -#: ../../library/argparse.rst:587 +#: ../../library/argparse.rst:418 msgid "" ":class:`ArgumentParser` changed encoding and errors to read arguments files " "from default (e.g. :func:`locale.getpreferredencoding(False) ` and ``\"strict\"``) to :term:`filesystem encoding and " -"error handler`. Arguments file should be encoded in UTF-8 instead of ANSI " -"Codepage on Windows." +"getpreferredencoding>` and ``\"strict\"``) to the :term:`filesystem encoding " +"and error handler`. Arguments file should be encoded in UTF-8 instead of " +"ANSI Codepage on Windows." msgstr "" -#: ../../library/argparse.rst:595 +#: ../../library/argparse.rst:426 msgid "argument_default" msgstr "argument_default" -#: ../../library/argparse.rst:597 +#: ../../library/argparse.rst:428 msgid "" "Generally, argument defaults are specified either by passing a default to :" "meth:`~ArgumentParser.add_argument` or by calling the :meth:`~ArgumentParser." @@ -1122,7 +718,7 @@ msgid "" "supply ``argument_default=SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:606 +#: ../../library/argparse.rst:437 msgid "" ">>> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)\n" ">>> parser.add_argument('--foo')\n" @@ -1140,22 +736,22 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace()" -#: ../../library/argparse.rst:617 +#: ../../library/argparse.rst:448 msgid "allow_abbrev" msgstr "allow_abbrev" -#: ../../library/argparse.rst:619 +#: ../../library/argparse.rst:450 msgid "" "Normally, when you pass an argument list to the :meth:`~ArgumentParser." "parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes " "abbreviations ` of long options." msgstr "" -#: ../../library/argparse.rst:623 +#: ../../library/argparse.rst:454 msgid "This feature can be disabled by setting ``allow_abbrev`` to ``False``::" msgstr "" -#: ../../library/argparse.rst:625 +#: ../../library/argparse.rst:456 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False)\n" ">>> parser.add_argument('--foobar', action='http://github.com/store_true')\n" @@ -1171,11 +767,11 @@ msgstr "" "usage: PROG [-h] [--foobar] [--foonley]\n" "PROG: error: unrecognized arguments: --foon" -#: ../../library/argparse.rst:636 +#: ../../library/argparse.rst:467 msgid "conflict_handler" msgstr "conflict_handler" -#: ../../library/argparse.rst:638 +#: ../../library/argparse.rst:469 msgid "" ":class:`ArgumentParser` objects do not allow two actions with the same " "option string. By default, :class:`ArgumentParser` objects raise an " @@ -1183,7 +779,7 @@ msgid "" "that is already in use::" msgstr "" -#: ../../library/argparse.rst:643 +#: ../../library/argparse.rst:474 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo', help='old foo help')\n" @@ -1199,7 +795,7 @@ msgstr "" " ..\n" "ArgumentError: argument --foo: conflicting option string(s): --foo" -#: ../../library/argparse.rst:650 +#: ../../library/argparse.rst:481 msgid "" "Sometimes (e.g. when using parents_) it may be useful to simply override any " "older arguments with the same option string. To get this behavior, the " @@ -1207,7 +803,7 @@ msgid "" "of :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:655 +#: ../../library/argparse.rst:486 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', " "conflict_handler='resolve')\n" @@ -1233,7 +829,7 @@ msgstr "" " -f FOO old foo help\n" " --foo FOO new foo help" -#: ../../library/argparse.rst:666 +#: ../../library/argparse.rst:497 msgid "" "Note that :class:`ArgumentParser` objects only remove an action if all of " "its option strings are overridden. So, in the example above, the old ``-f/--" @@ -1241,47 +837,25 @@ msgid "" "option string was overridden." msgstr "" -#: ../../library/argparse.rst:673 +#: ../../library/argparse.rst:504 msgid "add_help" msgstr "add_help" -#: ../../library/argparse.rst:675 +#: ../../library/argparse.rst:506 msgid "" "By default, ArgumentParser objects add an option which simply displays the " -"parser's help message. For example, consider a file named ``myprogram.py`` " -"containing the following code::" -msgstr "" - -#: ../../library/argparse.rst:684 -msgid "" -"If ``-h`` or ``--help`` is supplied at the command line, the ArgumentParser " -"help will be printed:" +"parser's help message. If ``-h`` or ``--help`` is supplied at the command " +"line, the ArgumentParser help will be printed." msgstr "" -#: ../../library/argparse.rst:687 -msgid "" -"$ python myprogram.py --help\n" -"usage: myprogram.py [-h] [--foo FOO]\n" -"\n" -"options:\n" -" -h, --help show this help message and exit\n" -" --foo FOO foo help" -msgstr "" -"$ python myprogram.py --help\n" -"usage: myprogram.py [-h] [--foo FOO]\n" -"\n" -"options:\n" -" -h, --help show this help message and exit\n" -" --foo FOO foo help" - -#: ../../library/argparse.rst:696 +#: ../../library/argparse.rst:510 msgid "" "Occasionally, it may be useful to disable the addition of this help option. " "This can be achieved by passing ``False`` as the ``add_help=`` argument to :" "class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:700 +#: ../../library/argparse.rst:514 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> parser.add_argument('--foo', help='foo help')\n" @@ -1299,7 +873,7 @@ msgstr "" "options:\n" " --foo FOO foo help" -#: ../../library/argparse.rst:708 +#: ../../library/argparse.rst:522 msgid "" "The help option is typically ``-h/--help``. The exception to this is if the " "``prefix_chars=`` is specified and does not include ``-``, in which case ``-" @@ -1307,7 +881,7 @@ msgid "" "in ``prefix_chars`` is used to prefix the help options::" msgstr "" -#: ../../library/argparse.rst:714 +#: ../../library/argparse.rst:528 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')\n" ">>> parser.print_help()\n" @@ -1323,24 +897,24 @@ msgstr "" "options:\n" " +h, ++help show this help message and exit" -#: ../../library/argparse.rst:723 +#: ../../library/argparse.rst:537 msgid "exit_on_error" msgstr "exit_on_error" -#: ../../library/argparse.rst:725 +#: ../../library/argparse.rst:539 msgid "" "Normally, when you pass an invalid argument list to the :meth:" "`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will " -"exit with error info." +"print a *message* to :data:`sys.stderr` and exit with a status code of 2." msgstr "" -#: ../../library/argparse.rst:728 +#: ../../library/argparse.rst:543 msgid "" "If the user would like to catch errors manually, the feature can be enabled " "by setting ``exit_on_error`` to ``False``::" msgstr "" -#: ../../library/argparse.rst:731 +#: ../../library/argparse.rst:546 msgid "" ">>> parser = argparse.ArgumentParser(exit_on_error=False)\n" ">>> parser.add_argument('--integers', type=int)\n" @@ -1366,81 +940,81 @@ msgstr "" "...\n" "Catching an argumentError" -#: ../../library/argparse.rst:745 +#: ../../library/argparse.rst:560 msgid "The add_argument() method" msgstr "" -#: ../../library/argparse.rst:751 +#: ../../library/argparse.rst:566 msgid "" "Define how a single command-line argument should be parsed. Each parameter " "has its own more detailed description below, but in short they are:" msgstr "" -#: ../../library/argparse.rst:754 +#: ../../library/argparse.rst:569 msgid "" "`name or flags`_ - Either a name or a list of option strings, e.g. ``foo`` " "or ``-f, --foo``." msgstr "" -#: ../../library/argparse.rst:757 +#: ../../library/argparse.rst:572 msgid "" "action_ - The basic type of action to be taken when this argument is " "encountered at the command line." msgstr "" -#: ../../library/argparse.rst:760 +#: ../../library/argparse.rst:575 msgid "nargs_ - The number of command-line arguments that should be consumed." msgstr "" -#: ../../library/argparse.rst:762 +#: ../../library/argparse.rst:577 msgid "" "const_ - A constant value required by some action_ and nargs_ selections." msgstr "" -#: ../../library/argparse.rst:764 +#: ../../library/argparse.rst:579 msgid "" "default_ - The value produced if the argument is absent from the command " "line and if it is absent from the namespace object." msgstr "" -#: ../../library/argparse.rst:767 +#: ../../library/argparse.rst:582 msgid "" "type_ - The type to which the command-line argument should be converted." msgstr "" -#: ../../library/argparse.rst:769 +#: ../../library/argparse.rst:584 msgid "choices_ - A sequence of the allowable values for the argument." msgstr "" -#: ../../library/argparse.rst:771 +#: ../../library/argparse.rst:586 msgid "" "required_ - Whether or not the command-line option may be omitted (optionals " "only)." msgstr "" -#: ../../library/argparse.rst:774 +#: ../../library/argparse.rst:589 msgid "help_ - A brief description of what the argument does." msgstr "" -#: ../../library/argparse.rst:776 +#: ../../library/argparse.rst:591 msgid "metavar_ - A name for the argument in usage messages." msgstr "" -#: ../../library/argparse.rst:778 +#: ../../library/argparse.rst:593 msgid "" "dest_ - The name of the attribute to be added to the object returned by :" "meth:`parse_args`." msgstr "" -#: ../../library/argparse.rst:781 +#: ../../library/argparse.rst:596 msgid "deprecated_ - Whether or not use of the argument is deprecated." msgstr "" -#: ../../library/argparse.rst:789 +#: ../../library/argparse.rst:604 msgid "name or flags" msgstr "" -#: ../../library/argparse.rst:791 +#: ../../library/argparse.rst:606 msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " @@ -1449,30 +1023,30 @@ msgid "" "or a simple argument name." msgstr "" -#: ../../library/argparse.rst:797 +#: ../../library/argparse.rst:612 msgid "For example, an optional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:799 +#: ../../library/argparse.rst:614 msgid ">>> parser.add_argument('-f', '--foo')" msgstr ">>> parser.add_argument('-f', '--foo')" -#: ../../library/argparse.rst:801 +#: ../../library/argparse.rst:616 msgid "while a positional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:803 +#: ../../library/argparse.rst:618 msgid ">>> parser.add_argument('bar')" msgstr ">>> parser.add_argument('bar')" -#: ../../library/argparse.rst:805 +#: ../../library/argparse.rst:620 msgid "" "When :meth:`~ArgumentParser.parse_args` is called, optional arguments will " "be identified by the ``-`` prefix, and the remaining arguments will be " "assumed to be positional::" msgstr "" -#: ../../library/argparse.rst:809 +#: ../../library/argparse.rst:624 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo')\n" @@ -1496,11 +1070,11 @@ msgstr "" "usage: PROG [-h] [-f FOO] bar\n" "PROG: error: the following arguments are required: bar" -#: ../../library/argparse.rst:824 +#: ../../library/argparse.rst:639 msgid "action" msgstr "" -#: ../../library/argparse.rst:826 +#: ../../library/argparse.rst:641 msgid "" ":class:`ArgumentParser` objects associate command-line arguments with " "actions. These actions can do just about anything with the command-line " @@ -1510,25 +1084,13 @@ msgid "" "be handled. The supplied actions are:" msgstr "" -#: ../../library/argparse.rst:832 +#: ../../library/argparse.rst:647 msgid "" "``'store'`` - This just stores the argument's value. This is the default " -"action. For example::" +"action." msgstr "" -#: ../../library/argparse.rst:835 -msgid "" -">>> parser = argparse.ArgumentParser()\n" -">>> parser.add_argument('--foo')\n" -">>> parser.parse_args('--foo 1'.split())\n" -"Namespace(foo='1')" -msgstr "" -">>> parser = argparse.ArgumentParser()\n" -">>> parser.add_argument('--foo')\n" -">>> parser.parse_args('--foo 1'.split())\n" -"Namespace(foo='1')" - -#: ../../library/argparse.rst:840 +#: ../../library/argparse.rst:650 msgid "" "``'store_const'`` - This stores the value specified by the const_ keyword " "argument; note that the const_ keyword argument defaults to ``None``. The " @@ -1536,7 +1098,7 @@ msgid "" "specify some sort of flag. For example::" msgstr "" -#: ../../library/argparse.rst:845 +#: ../../library/argparse.rst:655 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/store_const', const=42)\n" @@ -1548,15 +1110,15 @@ msgstr "" ">>> parser.parse_args(['--foo'])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:850 +#: ../../library/argparse.rst:660 msgid "" "``'store_true'`` and ``'store_false'`` - These are special cases of " "``'store_const'`` used for storing the values ``True`` and ``False`` " "respectively. In addition, they create default values of ``False`` and " -"``True`` respectively. For example::" +"``True`` respectively::" msgstr "" -#: ../../library/argparse.rst:855 +#: ../../library/argparse.rst:665 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/store_true')\n" @@ -1572,7 +1134,7 @@ msgstr "" ">>> parser.parse_args('--foo --bar'.split())\n" "Namespace(foo=True, bar=False, baz=True)" -#: ../../library/argparse.rst:862 +#: ../../library/argparse.rst:672 msgid "" "``'append'`` - This stores a list, and appends each argument value to the " "list. It is useful to allow an option to be specified multiple times. If the " @@ -1581,7 +1143,7 @@ msgid "" "after those default values. Example usage::" msgstr "" -#: ../../library/argparse.rst:868 +#: ../../library/argparse.rst:678 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/append')\n" @@ -1593,7 +1155,7 @@ msgstr "" ">>> parser.parse_args('--foo 1 --foo 2'.split())\n" "Namespace(foo=['1', '2'])" -#: ../../library/argparse.rst:873 +#: ../../library/argparse.rst:683 msgid "" "``'append_const'`` - This stores a list, and appends the value specified by " "the const_ keyword argument to the list; note that the const_ keyword " @@ -1602,7 +1164,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:879 +#: ../../library/argparse.rst:689 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--str', dest='types', action='http://github.com/append_const', " @@ -1620,13 +1182,13 @@ msgstr "" ">>> parser.parse_args('--str --int'.split())\n" "Namespace(types=[, ])" -#: ../../library/argparse.rst:885 +#: ../../library/argparse.rst:695 msgid "" "``'count'`` - This counts the number of times a keyword argument occurs. For " "example, this is useful for increasing verbosity levels::" msgstr "" -#: ../../library/argparse.rst:888 +#: ../../library/argparse.rst:698 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--verbose', '-v', action='http://github.com/count', default=0)\n" @@ -1634,11 +1196,11 @@ msgid "" "Namespace(verbose=3)" msgstr "" -#: ../../library/argparse.rst:893 +#: ../../library/argparse.rst:703 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." msgstr "" -#: ../../library/argparse.rst:895 +#: ../../library/argparse.rst:705 msgid "" "``'help'`` - This prints a complete help message for all the options in the " "current parser and then exits. By default a help action is automatically " @@ -1646,14 +1208,14 @@ msgid "" "output is created." msgstr "" -#: ../../library/argparse.rst:900 +#: ../../library/argparse.rst:710 msgid "" "``'version'`` - This expects a ``version=`` keyword argument in the :meth:" "`~ArgumentParser.add_argument` call, and prints version information and " "exits when invoked::" msgstr "" -#: ../../library/argparse.rst:904 +#: ../../library/argparse.rst:714 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -1669,13 +1231,13 @@ msgstr "" ">>> parser.parse_args(['--version'])\n" "PROG 2.0" -#: ../../library/argparse.rst:910 +#: ../../library/argparse.rst:720 msgid "" "``'extend'`` - This stores a list, and extends each argument value to the " "list. Example usage::" msgstr "" -#: ../../library/argparse.rst:914 +#: ../../library/argparse.rst:724 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " @@ -1691,7 +1253,13 @@ msgstr "" "\"f4\"])\n" "Namespace(foo=['f1', 'f2', 'f3', 'f4'])" -#: ../../library/argparse.rst:921 +#: ../../library/argparse.rst:731 +msgid "" +"Only actions that consume command-line arguments (e.g. ``'store'``, " +"``'append'`` or ``'extend'``) can be used with positional arguments." +msgstr "" + +#: ../../library/argparse.rst:734 msgid "" "You may also specify an arbitrary action by passing an Action subclass or " "other object that implements the same interface. The " @@ -1699,7 +1267,7 @@ msgid "" "boolean actions such as ``--foo`` and ``--no-foo``::" msgstr "" -#: ../../library/argparse.rst:926 +#: ../../library/argparse.rst:739 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -1713,18 +1281,18 @@ msgstr "" ">>> parser.parse_args(['--no-foo'])\n" "Namespace(foo=False)" -#: ../../library/argparse.rst:934 +#: ../../library/argparse.rst:747 msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " "overriding the ``__call__`` method and optionally the ``__init__`` and " "``format_usage`` methods." msgstr "" -#: ../../library/argparse.rst:938 +#: ../../library/argparse.rst:751 msgid "An example of a custom action::" msgstr "" -#: ../../library/argparse.rst:940 +#: ../../library/argparse.rst:753 msgid "" ">>> class FooAction(argparse.Action):\n" "... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" @@ -1745,15 +1313,15 @@ msgid "" "Namespace(bar='1', foo='2')" msgstr "" -#: ../../library/argparse.rst:958 +#: ../../library/argparse.rst:771 msgid "For more details, see :class:`Action`." msgstr "" -#: ../../library/argparse.rst:964 +#: ../../library/argparse.rst:777 msgid "nargs" msgstr "" -#: ../../library/argparse.rst:966 +#: ../../library/argparse.rst:779 msgid "" "ArgumentParser objects usually associate a single command-line argument with " "a single action to be taken. The ``nargs`` keyword argument associates a " @@ -1761,13 +1329,13 @@ msgid "" "ref:`specifying-ambiguous-arguments`. The supported values are:" msgstr "" -#: ../../library/argparse.rst:971 +#: ../../library/argparse.rst:784 msgid "" "``N`` (an integer). ``N`` arguments from the command line will be gathered " "together into a list. For example::" msgstr "" -#: ../../library/argparse.rst:974 +#: ../../library/argparse.rst:787 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs=2)\n" @@ -1781,13 +1349,13 @@ msgstr "" ">>> parser.parse_args('c --foo a b'.split())\n" "Namespace(bar=['c'], foo=['a', 'b'])" -#: ../../library/argparse.rst:980 +#: ../../library/argparse.rst:793 msgid "" "Note that ``nargs=1`` produces a list of one item. This is different from " "the default, in which the item is produced by itself." msgstr "" -#: ../../library/argparse.rst:985 +#: ../../library/argparse.rst:798 msgid "" "``'?'``. One argument will be consumed from the command line if possible, " "and produced as a single item. If no command-line argument is present, the " @@ -1797,7 +1365,7 @@ msgid "" "produced. Some examples to illustrate this::" msgstr "" -#: ../../library/argparse.rst:992 +#: ../../library/argparse.rst:805 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" @@ -1819,13 +1387,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(bar='d', foo='d')" -#: ../../library/argparse.rst:1002 +#: ../../library/argparse.rst:815 msgid "" "One of the more common uses of ``nargs='?'`` is to allow optional input and " "output files::" msgstr "" -#: ../../library/argparse.rst:1005 +#: ../../library/argparse.rst:818 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', nargs='?', type=argparse.FileType('r'),\n" @@ -1851,7 +1419,7 @@ msgstr "" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>,\n" " outfile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1019 +#: ../../library/argparse.rst:832 msgid "" "``'*'``. All command-line arguments present are gathered into a list. Note " "that it generally doesn't make much sense to have more than one positional " @@ -1859,7 +1427,7 @@ msgid "" "``nargs='*'`` is possible. For example::" msgstr "" -#: ../../library/argparse.rst:1024 +#: ../../library/argparse.rst:837 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='*')\n" @@ -1875,14 +1443,14 @@ msgstr "" ">>> parser.parse_args('a b --foo x y --bar 1 2'.split())\n" "Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])" -#: ../../library/argparse.rst:1033 +#: ../../library/argparse.rst:846 msgid "" "``'+'``. Just like ``'*'``, all command-line args present are gathered into " "a list. Additionally, an error message will be generated if there wasn't at " "least one command-line argument present. For example::" msgstr "" -#: ../../library/argparse.rst:1037 +#: ../../library/argparse.rst:850 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('foo', nargs='+')\n" @@ -1900,19 +1468,20 @@ msgstr "" "usage: PROG [-h] foo [foo ...]\n" "PROG: error: the following arguments are required: foo" -#: ../../library/argparse.rst:1045 +#: ../../library/argparse.rst:858 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " "command-line argument will be consumed and a single item (not a list) will " -"be produced." +"be produced. Actions that do not consume command-line arguments (e.g. " +"``'store_const'``) set ``nargs=0``." msgstr "" -#: ../../library/argparse.rst:1053 +#: ../../library/argparse.rst:868 msgid "const" msgstr "" -#: ../../library/argparse.rst:1055 +#: ../../library/argparse.rst:870 msgid "" "The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to " "hold constant values that are not read from the command line but are " @@ -1920,7 +1489,7 @@ msgid "" "common uses of it are:" msgstr "" -#: ../../library/argparse.rst:1059 +#: ../../library/argparse.rst:874 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='http://github.com/store_const'`` or ``action='http://github.com/append_const'``. These actions add " @@ -1930,7 +1499,7 @@ msgid "" "receive a default value of ``None``." msgstr "" -#: ../../library/argparse.rst:1067 +#: ../../library/argparse.rst:882 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with option strings " "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " @@ -1940,17 +1509,17 @@ msgid "" "to be ``None`` instead. See the nargs_ description for examples." msgstr "" -#: ../../library/argparse.rst:1074 +#: ../../library/argparse.rst:889 msgid "" "``const=None`` by default, including when ``action='http://github.com/append_const'`` or " "``action='http://github.com/store_const'``." msgstr "" -#: ../../library/argparse.rst:1081 +#: ../../library/argparse.rst:896 msgid "default" msgstr "" -#: ../../library/argparse.rst:1083 +#: ../../library/argparse.rst:898 msgid "" "All optional arguments and some positional arguments may be omitted at the " "command line. The ``default`` keyword argument of :meth:`~ArgumentParser." @@ -1960,7 +1529,7 @@ msgid "" "command line::" msgstr "" -#: ../../library/argparse.rst:1090 +#: ../../library/argparse.rst:905 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1976,13 +1545,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:1097 +#: ../../library/argparse.rst:912 msgid "" "If the target namespace already has an attribute set, the action *default* " -"will not over write it::" +"will not overwrite it::" msgstr "" -#: ../../library/argparse.rst:1100 +#: ../../library/argparse.rst:915 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1994,7 +1563,7 @@ msgstr "" ">>> parser.parse_args([], namespace=argparse.Namespace(foo=101))\n" "Namespace(foo=101)" -#: ../../library/argparse.rst:1105 +#: ../../library/argparse.rst:920 msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " @@ -2002,7 +1571,7 @@ msgid "" "`Namespace` return value. Otherwise, the parser uses the value as is::" msgstr "" -#: ../../library/argparse.rst:1110 +#: ../../library/argparse.rst:925 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--length', default='10', type=int)\n" @@ -2016,13 +1585,13 @@ msgstr "" ">>> parser.parse_args()\n" "Namespace(length=10, width=10.5)" -#: ../../library/argparse.rst:1116 +#: ../../library/argparse.rst:931 msgid "" "For positional arguments with nargs_ equal to ``?`` or ``*``, the " "``default`` value is used when no command-line argument was present::" msgstr "" -#: ../../library/argparse.rst:1119 +#: ../../library/argparse.rst:934 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', nargs='?', default=42)\n" @@ -2038,20 +1607,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:1126 +#: ../../library/argparse.rst:941 msgid "" "For required_ arguments, the ``default`` value is ignored. For example, this " "applies to positional arguments with nargs_ values other than ``?`` or " "``*``, or optional arguments marked as ``required=True``." msgstr "" -#: ../../library/argparse.rst:1130 +#: ../../library/argparse.rst:945 msgid "" "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " "the command-line argument was not present::" msgstr "" -#: ../../library/argparse.rst:1133 +#: ../../library/argparse.rst:948 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" @@ -2067,11 +1636,11 @@ msgstr "" ">>> parser.parse_args(['--foo', '1'])\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:1144 +#: ../../library/argparse.rst:959 msgid "type" msgstr "" -#: ../../library/argparse.rst:1146 +#: ../../library/argparse.rst:961 msgid "" "By default, the parser reads command-line arguments in as simple strings. " "However, quite often the command-line string should instead be interpreted " @@ -2080,13 +1649,13 @@ msgid "" "checking and type conversions to be performed." msgstr "" -#: ../../library/argparse.rst:1152 +#: ../../library/argparse.rst:967 msgid "" "If the type_ keyword is used with the default_ keyword, the type converter " "is only applied if the default is a string." msgstr "" -#: ../../library/argparse.rst:1155 +#: ../../library/argparse.rst:970 msgid "" "The argument to ``type`` can be any callable that accepts a single string. " "If the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" @@ -2094,11 +1663,11 @@ msgid "" "is displayed. No other exception types are handled." msgstr "" -#: ../../library/argparse.rst:1160 +#: ../../library/argparse.rst:975 msgid "Common built-in types and functions can be used as type converters:" msgstr "" -#: ../../library/argparse.rst:1162 +#: ../../library/argparse.rst:977 msgid "" "import argparse\n" "import pathlib\n" @@ -2108,7 +1677,6 @@ msgid "" "parser.add_argument('distance', type=float)\n" "parser.add_argument('street', type=ascii)\n" "parser.add_argument('code_point', type=ord)\n" -"parser.add_argument('source_file', type=open)\n" "parser.add_argument('dest_file', type=argparse.FileType('w', " "encoding='latin-1'))\n" "parser.add_argument('datapath', type=pathlib.Path)" @@ -2121,16 +1689,15 @@ msgstr "" "parser.add_argument('distance', type=float)\n" "parser.add_argument('street', type=ascii)\n" "parser.add_argument('code_point', type=ord)\n" -"parser.add_argument('source_file', type=open)\n" "parser.add_argument('dest_file', type=argparse.FileType('w', " "encoding='latin-1'))\n" "parser.add_argument('datapath', type=pathlib.Path)" -#: ../../library/argparse.rst:1176 +#: ../../library/argparse.rst:990 msgid "User defined functions can be used as well:" msgstr "" -#: ../../library/argparse.rst:1178 +#: ../../library/argparse.rst:992 msgid "" ">>> def hyphenated(string):\n" "... return '-'.join([word[:4] for word in string.casefold().split()])\n" @@ -2148,14 +1715,14 @@ msgstr "" ">>> parser.parse_args(['\"The Tale of Two Cities\"'])\n" "Namespace(short_title='\"the-tale-of-two-citi')" -#: ../../library/argparse.rst:1188 +#: ../../library/argparse.rst:1002 msgid "" "The :func:`bool` function is not recommended as a type converter. All it " "does is convert empty strings to ``False`` and non-empty strings to " "``True``. This is usually not what is desired." msgstr "" -#: ../../library/argparse.rst:1192 +#: ../../library/argparse.rst:1006 msgid "" "In general, the ``type`` keyword is a convenience that should only be used " "for simple conversions that can only raise one of the three supported " @@ -2163,7 +1730,7 @@ msgid "" "management should be done downstream after the arguments are parsed." msgstr "" -#: ../../library/argparse.rst:1197 +#: ../../library/argparse.rst:1011 msgid "" "For example, JSON or YAML conversions have complex error cases that require " "better reporting than can be given by the ``type`` keyword. A :exc:`~json." @@ -2171,26 +1738,27 @@ msgid "" "exception would not be handled at all." msgstr "" -#: ../../library/argparse.rst:1202 +#: ../../library/argparse.rst:1016 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " -"``type`` keyword. If one argument uses *FileType* and then a subsequent " -"argument fails, an error is reported but the file is not automatically " -"closed. In this case, it would be better to wait until after the parser has " -"run and then use the :keyword:`with`-statement to manage the files." +"``type`` keyword. If one argument uses :class:`~argparse.FileType` and then " +"a subsequent argument fails, an error is reported but the file is not " +"automatically closed. In this case, it would be better to wait until after " +"the parser has run and then use the :keyword:`with`-statement to manage the " +"files." msgstr "" -#: ../../library/argparse.rst:1208 +#: ../../library/argparse.rst:1023 msgid "" "For type checkers that simply check against a fixed set of values, consider " "using the choices_ keyword instead." msgstr "" -#: ../../library/argparse.rst:1215 +#: ../../library/argparse.rst:1030 msgid "choices" msgstr "" -#: ../../library/argparse.rst:1217 +#: ../../library/argparse.rst:1032 msgid "" "Some command-line arguments should be selected from a restricted set of " "values. These can be handled by passing a sequence object as the *choices* " @@ -2199,7 +1767,7 @@ msgid "" "be displayed if the argument was not one of the acceptable values::" msgstr "" -#: ../../library/argparse.rst:1223 +#: ../../library/argparse.rst:1038 msgid "" ">>> parser = argparse.ArgumentParser(prog='game.py')\n" ">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" @@ -2219,44 +1787,26 @@ msgstr "" "game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n" "'paper', 'scissors')" -#: ../../library/argparse.rst:1232 +#: ../../library/argparse.rst:1047 msgid "" "Note that inclusion in the *choices* sequence is checked after any type_ " "conversions have been performed, so the type of the objects in the *choices* " -"sequence should match the type_ specified::" +"sequence should match the type_ specified." msgstr "" -#: ../../library/argparse.rst:1236 -msgid "" -">>> parser = argparse.ArgumentParser(prog='doors.py')\n" -">>> parser.add_argument('door', type=int, choices=range(1, 4))\n" -">>> print(parser.parse_args(['3']))\n" -"Namespace(door=3)\n" -">>> parser.parse_args(['4'])\n" -"usage: doors.py [-h] {1,2,3}\n" -"doors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3)" -msgstr "" -">>> parser = argparse.ArgumentParser(prog='doors.py')\n" -">>> parser.add_argument('door', type=int, choices=range(1, 4))\n" -">>> print(parser.parse_args(['3']))\n" -"Namespace(door=3)\n" -">>> parser.parse_args(['4'])\n" -"usage: doors.py [-h] {1,2,3}\n" -"doors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3)" - -#: ../../library/argparse.rst:1244 +#: ../../library/argparse.rst:1051 msgid "" "Any sequence can be passed as the *choices* value, so :class:`list` " "objects, :class:`tuple` objects, and custom sequences are all supported." msgstr "" -#: ../../library/argparse.rst:1247 +#: ../../library/argparse.rst:1054 msgid "" "Use of :class:`enum.Enum` is not recommended because it is difficult to " "control its appearance in usage, help, and error messages." msgstr "" -#: ../../library/argparse.rst:1250 +#: ../../library/argparse.rst:1057 msgid "" "Formatted choices override the default *metavar* which is normally derived " "from *dest*. This is usually what you want because the user never sees the " @@ -2264,11 +1814,11 @@ msgid "" "are many choices), just specify an explicit metavar_." msgstr "" -#: ../../library/argparse.rst:1259 +#: ../../library/argparse.rst:1066 msgid "required" msgstr "" -#: ../../library/argparse.rst:1261 +#: ../../library/argparse.rst:1068 msgid "" "In general, the :mod:`argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " @@ -2276,7 +1826,7 @@ msgid "" "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: ../../library/argparse.rst:1266 +#: ../../library/argparse.rst:1073 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', required=True)\n" @@ -2294,64 +1844,32 @@ msgstr "" "usage: [-h] --foo FOO\n" ": error: the following arguments are required: --foo" -#: ../../library/argparse.rst:1274 +#: ../../library/argparse.rst:1081 msgid "" "As the example shows, if an option is marked as ``required``, :meth:" "`~ArgumentParser.parse_args` will report an error if that option is not " "present at the command line." msgstr "" -#: ../../library/argparse.rst:1280 +#: ../../library/argparse.rst:1087 msgid "" "Required options are generally considered bad form because users expect " "*options* to be *optional*, and thus they should be avoided when possible." msgstr "" -#: ../../library/argparse.rst:1287 +#: ../../library/argparse.rst:1094 msgid "help" msgstr "幫助" -#: ../../library/argparse.rst:1289 +#: ../../library/argparse.rst:1096 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " "at the command line), these ``help`` descriptions will be displayed with " -"each argument::" +"each argument." msgstr "" -#: ../../library/argparse.rst:1294 -msgid "" -">>> parser = argparse.ArgumentParser(prog='frobble')\n" -">>> parser.add_argument('--foo', action='http://github.com/store_true',\n" -"... help='foo the bars before frobbling')\n" -">>> parser.add_argument('bar', nargs='+',\n" -"... help='one of the bars to be frobbled')\n" -">>> parser.parse_args(['-h'])\n" -"usage: frobble [-h] [--foo] bar [bar ...]\n" -"\n" -"positional arguments:\n" -" bar one of the bars to be frobbled\n" -"\n" -"options:\n" -" -h, --help show this help message and exit\n" -" --foo foo the bars before frobbling" -msgstr "" -">>> parser = argparse.ArgumentParser(prog='frobble')\n" -">>> parser.add_argument('--foo', action='http://github.com/store_true',\n" -"... help='foo the bars before frobbling')\n" -">>> parser.add_argument('bar', nargs='+',\n" -"... help='one of the bars to be frobbled')\n" -">>> parser.parse_args(['-h'])\n" -"usage: frobble [-h] [--foo] bar [bar ...]\n" -"\n" -"positional arguments:\n" -" bar one of the bars to be frobbled\n" -"\n" -"options:\n" -" -h, --help show this help message and exit\n" -" --foo foo the bars before frobbling" - -#: ../../library/argparse.rst:1309 +#: ../../library/argparse.rst:1101 msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " @@ -2360,7 +1878,7 @@ msgid "" "``%(type)s``, etc.::" msgstr "" -#: ../../library/argparse.rst:1314 +#: ../../library/argparse.rst:1106 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" @@ -2386,19 +1904,19 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1326 +#: ../../library/argparse.rst:1118 msgid "" "As the help string supports %-formatting, if you want a literal ``%`` to " "appear in the help string, you must escape it as ``%%``." msgstr "" -#: ../../library/argparse.rst:1329 +#: ../../library/argparse.rst:1121 msgid "" ":mod:`argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:1332 +#: ../../library/argparse.rst:1124 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" @@ -2416,11 +1934,11 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1344 +#: ../../library/argparse.rst:1136 msgid "metavar" msgstr "" -#: ../../library/argparse.rst:1346 +#: ../../library/argparse.rst:1138 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " "refer to each expected argument. By default, ArgumentParser objects use the " @@ -2432,7 +1950,7 @@ msgid "" "argument will be referred to as ``FOO``. An example::" msgstr "" -#: ../../library/argparse.rst:1355 +#: ../../library/argparse.rst:1147 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2464,11 +1982,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO" -#: ../../library/argparse.rst:1370 +#: ../../library/argparse.rst:1162 msgid "An alternative name can be specified with ``metavar``::" msgstr "" -#: ../../library/argparse.rst:1372 +#: ../../library/argparse.rst:1164 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', metavar='YYY')\n" @@ -2500,21 +2018,21 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo YYY" -#: ../../library/argparse.rst:1387 +#: ../../library/argparse.rst:1179 msgid "" "Note that ``metavar`` only changes the *displayed* name - the name of the " "attribute on the :meth:`~ArgumentParser.parse_args` object is still " "determined by the dest_ value." msgstr "" -#: ../../library/argparse.rst:1391 +#: ../../library/argparse.rst:1183 msgid "" "Different values of ``nargs`` may cause the metavar to be used multiple " "times. Providing a tuple to ``metavar`` specifies a different display for " "each of the arguments::" msgstr "" -#: ../../library/argparse.rst:1395 +#: ../../library/argparse.rst:1187 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', nargs=2)\n" @@ -2538,11 +2056,11 @@ msgstr "" " -x X X\n" " --foo bar baz" -#: ../../library/argparse.rst:1410 +#: ../../library/argparse.rst:1202 msgid "dest" msgstr "" -#: ../../library/argparse.rst:1412 +#: ../../library/argparse.rst:1204 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " @@ -2552,7 +2070,7 @@ msgid "" "add_argument`::" msgstr "" -#: ../../library/argparse.rst:1419 +#: ../../library/argparse.rst:1211 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('bar')\n" @@ -2564,7 +2082,7 @@ msgstr "" ">>> parser.parse_args(['XXX'])\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1424 +#: ../../library/argparse.rst:1216 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " @@ -2576,7 +2094,7 @@ msgid "" "below illustrate this behavior::" msgstr "" -#: ../../library/argparse.rst:1433 +#: ../../library/argparse.rst:1225 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('-f', '--foo-bar', '--foo')\n" @@ -2594,11 +2112,11 @@ msgstr "" ">>> parser.parse_args('--foo 1 -y 2'.split())\n" "Namespace(foo_bar='1', x='2')" -#: ../../library/argparse.rst:1441 +#: ../../library/argparse.rst:1233 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" -#: ../../library/argparse.rst:1443 +#: ../../library/argparse.rst:1235 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', dest='bar')\n" @@ -2610,11 +2128,11 @@ msgstr "" ">>> parser.parse_args('--foo XXX'.split())\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1452 +#: ../../library/argparse.rst:1244 msgid "deprecated" msgstr "" -#: ../../library/argparse.rst:1454 +#: ../../library/argparse.rst:1246 msgid "" "During a project's lifetime, some arguments may need to be removed from the " "command line. Before removing them, you should inform your users that the " @@ -2625,8 +2143,7 @@ msgid "" "will be printed to :data:`sys.stderr` when the argument is used::" msgstr "" -#: ../../library/argparse.rst:1464 -#, fuzzy +#: ../../library/argparse.rst:1256 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='snake.py')\n" @@ -2637,18 +2154,20 @@ msgid "" "snake.py: warning: option '--legs' is deprecated\n" "Namespace(legs=4)" msgstr "" -">>> parser = argparse.ArgumentParser()\n" -">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" +">>> import argparse\n" +">>> parser = argparse.ArgumentParser(prog='snake.py')\n" +">>> parser.add_argument('--legs', default=0, type=int, deprecated=True)\n" ">>> parser.parse_args([])\n" -"Namespace()\n" -">>> parser.parse_args(['--foo', '1'])\n" -"Namespace(foo='1')" +"Namespace(legs=0)\n" +">>> parser.parse_args(['--legs', '4']) \n" +"snake.py: warning: option '--legs' is deprecated\n" +"Namespace(legs=4)" -#: ../../library/argparse.rst:1477 +#: ../../library/argparse.rst:1269 msgid "Action classes" msgstr "" -#: ../../library/argparse.rst:1479 +#: ../../library/argparse.rst:1271 msgid "" "Action classes implement the Action API, a callable which returns a callable " "which processes arguments from the command-line. Any object which follows " @@ -2656,7 +2175,7 @@ msgid "" "add_argument`." msgstr "" -#: ../../library/argparse.rst:1488 +#: ../../library/argparse.rst:1280 msgid "" "Action objects are used by an ArgumentParser to represent the information " "needed to parse a single argument from one or more strings from the command " @@ -2665,7 +2184,7 @@ msgid "" "the ``action`` itself." msgstr "" -#: ../../library/argparse.rst:1494 +#: ../../library/argparse.rst:1286 msgid "" "Instances of Action (or return value of any callable to the ``action`` " "parameter) should have attributes \"dest\", \"option_strings\", \"default\", " @@ -2673,91 +2192,102 @@ msgid "" "these attributes are defined is to call ``Action.__init__``." msgstr "" -#: ../../library/argparse.rst:1499 +#: ../../library/argparse.rst:1291 msgid "" "Action instances should be callable, so subclasses must override the " "``__call__`` method, which should accept four parameters:" msgstr "" -#: ../../library/argparse.rst:1502 -msgid "``parser`` - The ArgumentParser object which contains this action." +#: ../../library/argparse.rst:1294 +msgid "*parser* - The ArgumentParser object which contains this action." +msgstr "" + +#: ../../library/argparse.rst:1296 +msgid "*namespace* - The :class:`Namespace` object that will be returned by" +msgstr "" + +#: ../../library/argparse.rst:1297 +msgid "" +":meth:`~ArgumentParser.parse_args`. Most actions add an attribute to this " +"object using :func:`setattr`." msgstr "" -#: ../../library/argparse.rst:1504 +#: ../../library/argparse.rst:1300 msgid "" -"``namespace`` - The :class:`Namespace` object that will be returned by :meth:" -"`~ArgumentParser.parse_args`. Most actions add an attribute to this object " -"using :func:`setattr`." +"*values* - The associated command-line arguments, with any type conversions" msgstr "" -#: ../../library/argparse.rst:1508 +#: ../../library/argparse.rst:1301 msgid "" -"``values`` - The associated command-line arguments, with any type " -"conversions applied. Type conversions are specified with the type_ keyword " -"argument to :meth:`~ArgumentParser.add_argument`." +"applied. Type conversions are specified with the type_ keyword argument to :" +"meth:`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1512 +#: ../../library/argparse.rst:1304 +msgid "" +"*option_string* - The option string that was used to invoke this action." +msgstr "" + +#: ../../library/argparse.rst:1305 msgid "" -"``option_string`` - The option string that was used to invoke this action. " "The ``option_string`` argument is optional, and will be absent if the action " "is associated with a positional argument." msgstr "" -#: ../../library/argparse.rst:1516 +#: ../../library/argparse.rst:1308 msgid "" "The ``__call__`` method may perform arbitrary actions, but will typically " "set attributes on the ``namespace`` based on ``dest`` and ``values``." msgstr "" -#: ../../library/argparse.rst:1519 +#: ../../library/argparse.rst:1311 msgid "" "Action subclasses can define a ``format_usage`` method that takes no " "argument and return a string which will be used when printing the usage of " "the program. If such method is not provided, a sensible default will be used." msgstr "" -#: ../../library/argparse.rst:1524 +#: ../../library/argparse.rst:1317 msgid "The parse_args() method" msgstr "" -#: ../../library/argparse.rst:1528 +#: ../../library/argparse.rst:1321 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" -#: ../../library/argparse.rst:1531 +#: ../../library/argparse.rst:1324 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " "created and how they are assigned. See the documentation for :meth:" "`add_argument` for details." msgstr "" -#: ../../library/argparse.rst:1535 +#: ../../library/argparse.rst:1328 msgid "" "args_ - List of strings to parse. The default is taken from :data:`sys." "argv`." msgstr "" -#: ../../library/argparse.rst:1538 +#: ../../library/argparse.rst:1331 msgid "" "namespace_ - An object to take the attributes. The default is a new empty :" "class:`Namespace` object." msgstr "" -#: ../../library/argparse.rst:1543 +#: ../../library/argparse.rst:1336 msgid "Option value syntax" msgstr "" -#: ../../library/argparse.rst:1545 +#: ../../library/argparse.rst:1338 msgid "" "The :meth:`~ArgumentParser.parse_args` method supports several ways of " "specifying the value of an option (if it takes one). In the simplest case, " "the option and its value are passed as two separate arguments::" msgstr "" -#: ../../library/argparse.rst:1549 +#: ../../library/argparse.rst:1342 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2775,14 +2305,14 @@ msgstr "" ">>> parser.parse_args(['--foo', 'FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1557 +#: ../../library/argparse.rst:1350 msgid "" "For long options (options with names longer than a single character), the " "option and value can also be passed as a single command-line argument, using " "``=`` to separate them::" msgstr "" -#: ../../library/argparse.rst:1561 +#: ../../library/argparse.rst:1354 msgid "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" @@ -2790,13 +2320,13 @@ msgstr "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1564 +#: ../../library/argparse.rst:1357 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "" -#: ../../library/argparse.rst:1567 +#: ../../library/argparse.rst:1360 msgid "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" @@ -2804,13 +2334,13 @@ msgstr "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" -#: ../../library/argparse.rst:1570 +#: ../../library/argparse.rst:1363 msgid "" "Several short options can be joined together, using only a single ``-`` " "prefix, as long as only the last option (or none of them) requires a value::" msgstr "" -#: ../../library/argparse.rst:1573 +#: ../../library/argparse.rst:1366 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='http://github.com/store_true')\n" @@ -2826,11 +2356,11 @@ msgstr "" ">>> parser.parse_args(['-xyzZ'])\n" "Namespace(x=True, y=True, z='Z')" -#: ../../library/argparse.rst:1582 +#: ../../library/argparse.rst:1375 msgid "Invalid arguments" msgstr "" -#: ../../library/argparse.rst:1584 +#: ../../library/argparse.rst:1377 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " @@ -2838,7 +2368,7 @@ msgid "" "an error, it exits and prints the error along with a usage message::" msgstr "" -#: ../../library/argparse.rst:1589 +#: ../../library/argparse.rst:1382 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', type=int)\n" @@ -2860,11 +2390,11 @@ msgid "" "PROG: error: extra arguments found: badger" msgstr "" -#: ../../library/argparse.rst:1610 +#: ../../library/argparse.rst:1403 msgid "Arguments containing ``-``" msgstr "" -#: ../../library/argparse.rst:1612 +#: ../../library/argparse.rst:1405 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " @@ -2876,7 +2406,7 @@ msgid "" "negative numbers::" msgstr "" -#: ../../library/argparse.rst:1620 +#: ../../library/argparse.rst:1413 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2909,7 +2439,7 @@ msgid "" "PROG: error: argument -1: expected one argument" msgstr "" -#: ../../library/argparse.rst:1650 +#: ../../library/argparse.rst:1443 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " @@ -2917,7 +2447,7 @@ msgid "" "positional argument::" msgstr "" -#: ../../library/argparse.rst:1655 +#: ../../library/argparse.rst:1448 msgid "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" @@ -2925,24 +2455,24 @@ msgstr "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" -#: ../../library/argparse.rst:1658 +#: ../../library/argparse.rst:1451 msgid "" "See also :ref:`the argparse howto on ambiguous arguments ` for more details." msgstr "" -#: ../../library/argparse.rst:1664 +#: ../../library/argparse.rst:1457 msgid "Argument abbreviations (prefix matching)" msgstr "" -#: ../../library/argparse.rst:1666 +#: ../../library/argparse.rst:1459 msgid "" "The :meth:`~ArgumentParser.parse_args` method :ref:`by default " "` allows long options to be abbreviated to a prefix, if the " "abbreviation is unambiguous (the prefix matches a unique option)::" msgstr "" -#: ../../library/argparse.rst:1670 +#: ../../library/argparse.rst:1463 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -2966,17 +2496,17 @@ msgstr "" "usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" "PROG: error: ambiguous option: -ba could match -badger, -bacon" -#: ../../library/argparse.rst:1681 +#: ../../library/argparse.rst:1474 msgid "" "An error is produced for arguments that could produce more than one options. " "This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." msgstr "" -#: ../../library/argparse.rst:1687 +#: ../../library/argparse.rst:1480 msgid "Beyond ``sys.argv``" msgstr "" -#: ../../library/argparse.rst:1689 +#: ../../library/argparse.rst:1482 msgid "" "Sometimes it may be useful to have an ArgumentParser parse arguments other " "than those of :data:`sys.argv`. This can be accomplished by passing a list " @@ -2984,7 +2514,7 @@ msgid "" "testing at the interactive prompt::" msgstr "" -#: ../../library/argparse.rst:1694 +#: ../../library/argparse.rst:1487 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\n" @@ -3010,24 +2540,24 @@ msgstr "" ">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" "Namespace(accumulate=, integers=[1, 2, 3, 4])" -#: ../../library/argparse.rst:1709 +#: ../../library/argparse.rst:1502 msgid "The Namespace object" msgstr "" -#: ../../library/argparse.rst:1713 +#: ../../library/argparse.rst:1506 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." msgstr "" -#: ../../library/argparse.rst:1716 +#: ../../library/argparse.rst:1509 msgid "" "This class is deliberately simple, just an :class:`object` subclass with a " "readable string representation. If you prefer to have dict-like view of the " "attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" -#: ../../library/argparse.rst:1720 +#: ../../library/argparse.rst:1513 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3041,14 +2571,14 @@ msgstr "" ">>> vars(args)\n" "{'foo': 'BAR'}" -#: ../../library/argparse.rst:1726 +#: ../../library/argparse.rst:1519 msgid "" "It may also be useful to have an :class:`ArgumentParser` assign attributes " "to an already existing object, rather than a new :class:`Namespace` object. " "This can be achieved by specifying the ``namespace=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:1730 +#: ../../library/argparse.rst:1523 msgid "" ">>> class C:\n" "... pass\n" @@ -3070,98 +2600,97 @@ msgstr "" ">>> c.foo\n" "'BAR'" -#: ../../library/argparse.rst:1742 +#: ../../library/argparse.rst:1535 msgid "Other utilities" msgstr "" -#: ../../library/argparse.rst:1745 +#: ../../library/argparse.rst:1538 msgid "Sub-commands" msgstr "" -#: ../../library/argparse.rst:1752 +#: ../../library/argparse.rst:1545 msgid "" -"Many programs split up their functionality into a number of sub-commands, " -"for example, the ``svn`` program can invoke sub-commands like ``svn " -"checkout``, ``svn update``, and ``svn commit``. Splitting up functionality " -"this way can be a particularly good idea when a program performs several " -"different functions which require different kinds of command-line " -"arguments. :class:`ArgumentParser` supports the creation of such sub-" -"commands with the :meth:`add_subparsers` method. The :meth:`add_subparsers` " -"method is normally called with no arguments and returns a special action " -"object. This object has a single method, :meth:`~_SubParsersAction." -"add_parser`, which takes a command name and any :class:`ArgumentParser` " -"constructor arguments, and returns an :class:`ArgumentParser` object that " -"can be modified as usual." +"Many programs split up their functionality into a number of subcommands, for " +"example, the ``svn`` program can invoke subcommands like ``svn checkout``, " +"``svn update``, and ``svn commit``. Splitting up functionality this way can " +"be a particularly good idea when a program performs several different " +"functions which require different kinds of command-line arguments. :class:" +"`ArgumentParser` supports the creation of such subcommands with the :meth:" +"`add_subparsers` method. The :meth:`add_subparsers` method is normally " +"called with no arguments and returns a special action object. This object " +"has a single method, :meth:`~_SubParsersAction.add_parser`, which takes a " +"command name and any :class:`ArgumentParser` constructor arguments, and " +"returns an :class:`ArgumentParser` object that can be modified as usual." msgstr "" -#: ../../library/argparse.rst:1764 +#: ../../library/argparse.rst:1557 msgid "Description of parameters:" msgstr "" -#: ../../library/argparse.rst:1766 +#: ../../library/argparse.rst:1559 msgid "" -"title - title for the sub-parser group in help output; by default " +"*title* - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " "positional arguments" msgstr "" -#: ../../library/argparse.rst:1770 +#: ../../library/argparse.rst:1563 msgid "" -"description - description for the sub-parser group in help output, by " +"*description* - description for the sub-parser group in help output, by " "default ``None``" msgstr "" -#: ../../library/argparse.rst:1773 +#: ../../library/argparse.rst:1566 msgid "" -"prog - usage information that will be displayed with sub-command help, by " +"*prog* - usage information that will be displayed with sub-command help, by " "default the name of the program and any positional arguments before the " "subparser argument" msgstr "" -#: ../../library/argparse.rst:1777 +#: ../../library/argparse.rst:1570 msgid "" -"parser_class - class which will be used to create sub-parser instances, by " +"*parser_class* - class which will be used to create sub-parser instances, by " "default the class of the current parser (e.g. ArgumentParser)" msgstr "" -#: ../../library/argparse.rst:1780 +#: ../../library/argparse.rst:1573 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "" -#: ../../library/argparse.rst:1783 +#: ../../library/argparse.rst:1576 msgid "" "dest_ - name of the attribute under which sub-command name will be stored; " "by default ``None`` and no value is stored" msgstr "" -#: ../../library/argparse.rst:1786 +#: ../../library/argparse.rst:1579 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "" -#: ../../library/argparse.rst:1789 +#: ../../library/argparse.rst:1582 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" -#: ../../library/argparse.rst:1791 +#: ../../library/argparse.rst:1584 msgid "" -"metavar_ - string presenting available sub-commands in help; by default it " -"is ``None`` and presents sub-commands in form {cmd1, cmd2, ..}" +"metavar_ - string presenting available subcommands in help; by default it is " +"``None`` and presents subcommands in form {cmd1, cmd2, ..}" msgstr "" -#: ../../library/argparse.rst:1794 +#: ../../library/argparse.rst:1587 msgid "Some example usage::" msgstr "一些使用範例: ::" -#: ../../library/argparse.rst:1796 +#: ../../library/argparse.rst:1589 msgid "" ">>> # create the top-level parser\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', action='http://github.com/store_true', help='foo help')\n" -">>> subparsers = parser.add_subparsers(help='sub-command help')\n" +">>> subparsers = parser.add_subparsers(help='subcommand help')\n" ">>>\n" ">>> # create the parser for the \"a\" command\n" ">>> parser_a = subparsers.add_parser('a', help='a help')\n" @@ -3169,7 +2698,8 @@ msgid "" ">>>\n" ">>> # create the parser for the \"b\" command\n" ">>> parser_b = subparsers.add_parser('b', help='b help')\n" -">>> parser_b.add_argument('--baz', choices='XYZ', help='baz help')\n" +">>> parser_b.add_argument('--baz', choices=('X', 'Y', 'Z'), help='baz " +"help')\n" ">>>\n" ">>> # parse some argument lists\n" ">>> parser.parse_args(['a', '12'])\n" @@ -3178,7 +2708,7 @@ msgid "" "Namespace(baz='Z', foo=True)" msgstr "" -#: ../../library/argparse.rst:1815 +#: ../../library/argparse.rst:1608 msgid "" "Note that the object returned by :meth:`parse_args` will only contain " "attributes for the main parser and the subparser that was selected by the " @@ -3188,7 +2718,7 @@ msgid "" "``baz`` attributes are present." msgstr "" -#: ../../library/argparse.rst:1822 +#: ../../library/argparse.rst:1615 msgid "" "Similarly, when a help message is requested from a subparser, only the help " "for that particular parser will be printed. The help message will not " @@ -3197,13 +2727,13 @@ msgid "" "to :meth:`~_SubParsersAction.add_parser` as above.)" msgstr "" -#: ../../library/argparse.rst:1830 +#: ../../library/argparse.rst:1623 msgid "" ">>> parser.parse_args(['--help'])\n" "usage: PROG [-h] [--foo] {a,b} ...\n" "\n" "positional arguments:\n" -" {a,b} sub-command help\n" +" {a,b} subcommand help\n" " a a help\n" " b b help\n" "\n" @@ -3231,7 +2761,7 @@ msgstr "" "usage: PROG [-h] [--foo] {a,b} ...\n" "\n" "positional arguments:\n" -" {a,b} sub-command help\n" +" {a,b} subcommand help\n" " a a help\n" " b b help\n" "\n" @@ -3255,14 +2785,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --baz {X,Y,Z} baz help" -#: ../../library/argparse.rst:1858 +#: ../../library/argparse.rst:1651 msgid "" "The :meth:`add_subparsers` method also supports ``title`` and " "``description`` keyword arguments. When either is present, the subparser's " "commands will appear in their own group in the help output. For example::" msgstr "" -#: ../../library/argparse.rst:1862 +#: ../../library/argparse.rst:1655 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -3298,7 +2828,7 @@ msgstr "" "\n" " {foo,bar} additional help" -#: ../../library/argparse.rst:1879 +#: ../../library/argparse.rst:1672 msgid "" "Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional " "*aliases* argument, which allows multiple strings to refer to the same " @@ -3306,7 +2836,7 @@ msgid "" "``checkout``::" msgstr "" -#: ../../library/argparse.rst:1884 +#: ../../library/argparse.rst:1677 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -3322,23 +2852,23 @@ msgstr "" ">>> parser.parse_args(['co', 'bar'])\n" "Namespace(foo='bar')" -#: ../../library/argparse.rst:1891 +#: ../../library/argparse.rst:1684 msgid "" ":meth:`~_SubParsersAction.add_parser` supports also an additional " "*deprecated* argument, which allows to deprecate the subparser." msgstr "" -#: ../../library/argparse.rst:1905 +#: ../../library/argparse.rst:1698 msgid "" -"One particularly effective way of handling sub-commands is to combine the " -"use of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` " -"so that each subparser knows which Python function it should execute. For " +"One particularly effective way of handling subcommands is to combine the use " +"of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so " +"that each subparser knows which Python function it should execute. For " "example::" msgstr "" -#: ../../library/argparse.rst:1910 +#: ../../library/argparse.rst:1703 msgid "" -">>> # sub-command functions\n" +">>> # subcommand functions\n" ">>> def foo(args):\n" "... print(args.x * args.y)\n" "...\n" @@ -3371,7 +2901,7 @@ msgid "" "((XYZYX))" msgstr "" -#: ../../library/argparse.rst:1942 +#: ../../library/argparse.rst:1735 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " @@ -3381,7 +2911,7 @@ msgid "" "argument to the :meth:`add_subparsers` call will work::" msgstr "" -#: ../../library/argparse.rst:1949 +#: ../../library/argparse.rst:1742 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" @@ -3401,15 +2931,15 @@ msgstr "" ">>> parser.parse_args(['2', 'frobble'])\n" "Namespace(subparser_name='2', y='frobble')" -#: ../../library/argparse.rst:1958 +#: ../../library/argparse.rst:1751 msgid "New *required* keyword argument." msgstr "" -#: ../../library/argparse.rst:1963 +#: ../../library/argparse.rst:1756 msgid "FileType objects" msgstr "FileType 物件" -#: ../../library/argparse.rst:1967 +#: ../../library/argparse.rst:1760 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " "argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" @@ -3418,7 +2948,7 @@ msgid "" "the :func:`open` function for more details)::" msgstr "" -#: ../../library/argparse.rst:1973 +#: ../../library/argparse.rst:1766 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" @@ -3436,14 +2966,14 @@ msgstr "" "Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " "raw=<_io.FileIO name='raw.dat' mode='wb'>)" -#: ../../library/argparse.rst:1979 +#: ../../library/argparse.rst:1772 msgid "" "FileType objects understand the pseudo-argument ``'-'`` and automatically " "convert this into :data:`sys.stdin` for readable :class:`FileType` objects " "and :data:`sys.stdout` for writable :class:`FileType` objects::" msgstr "" -#: ../../library/argparse.rst:1983 +#: ../../library/argparse.rst:1776 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" @@ -3455,15 +2985,15 @@ msgstr "" ">>> parser.parse_args(['-'])\n" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1988 +#: ../../library/argparse.rst:1781 msgid "Added the *encodings* and *errors* parameters." msgstr "" -#: ../../library/argparse.rst:1993 +#: ../../library/argparse.rst:1786 msgid "Argument groups" msgstr "" -#: ../../library/argparse.rst:1997 +#: ../../library/argparse.rst:1791 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"options\" when displaying help messages. When " @@ -3472,7 +3002,7 @@ msgid "" "method::" msgstr "" -#: ../../library/argparse.rst:2003 +#: ../../library/argparse.rst:1797 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group = parser.add_argument_group('group')\n" @@ -3496,7 +3026,7 @@ msgstr "" " bar bar help\n" " --foo FOO foo help" -#: ../../library/argparse.rst:2014 +#: ../../library/argparse.rst:1808 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " "has an :meth:`~ArgumentParser.add_argument` method just like a regular :" @@ -3507,7 +3037,7 @@ msgid "" "this display::" msgstr "" -#: ../../library/argparse.rst:2022 +#: ../../library/argparse.rst:1816 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" @@ -3545,13 +3075,22 @@ msgstr "" "\n" " --bar BAR bar help" -#: ../../library/argparse.rst:2040 +#: ../../library/argparse.rst:1834 +msgid "" +"The optional, keyword-only parameters argument_default_ and " +"conflict_handler_ allow for finer-grained control of the behavior of the " +"argument group. These parameters have the same meaning as in the :class:" +"`ArgumentParser` constructor, but apply specifically to the argument group " +"rather than the entire parser." +msgstr "" + +#: ../../library/argparse.rst:1839 msgid "" "Note that any arguments not in your user-defined groups will end up back in " "the usual \"positional arguments\" and \"optional arguments\" sections." msgstr "" -#: ../../library/argparse.rst:2043 +#: ../../library/argparse.rst:1842 msgid "" "Calling :meth:`add_argument_group` on an argument group is deprecated. This " "feature was never supported and does not always work correctly. The function " @@ -3559,18 +3098,18 @@ msgid "" "future." msgstr "" -#: ../../library/argparse.rst:2051 +#: ../../library/argparse.rst:1850 msgid "Mutual exclusion" msgstr "" -#: ../../library/argparse.rst:2055 +#: ../../library/argparse.rst:1854 msgid "" "Create a mutually exclusive group. :mod:`argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " "command line::" msgstr "" -#: ../../library/argparse.rst:2059 +#: ../../library/argparse.rst:1858 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -3596,14 +3135,14 @@ msgstr "" "usage: PROG [-h] [--foo | --bar]\n" "PROG: error: argument --bar: not allowed with argument --foo" -#: ../../library/argparse.rst:2071 +#: ../../library/argparse.rst:1870 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " "is required::" msgstr "" -#: ../../library/argparse.rst:2075 +#: ../../library/argparse.rst:1874 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -3621,7 +3160,7 @@ msgstr "" "usage: PROG [-h] (--foo | --bar)\n" "PROG: error: one of the arguments --foo --bar is required" -#: ../../library/argparse.rst:2083 +#: ../../library/argparse.rst:1882 msgid "" "Note that currently mutually exclusive argument groups do not support the " "*title* and *description* arguments of :meth:`~ArgumentParser." @@ -3629,7 +3168,7 @@ msgid "" "argument group that has a title and description. For example::" msgstr "" -#: ../../library/argparse.rst:2089 +#: ../../library/argparse.rst:1888 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -3665,7 +3204,7 @@ msgstr "" " --foo FOO foo help\n" " --bar BAR bar help" -#: ../../library/argparse.rst:2106 +#: ../../library/argparse.rst:1905 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " "on a mutually exclusive group is deprecated. These features were never " @@ -3673,11 +3212,11 @@ msgid "" "by accident through inheritance and will be removed in the future." msgstr "" -#: ../../library/argparse.rst:2114 +#: ../../library/argparse.rst:1913 msgid "Parser defaults" msgstr "" -#: ../../library/argparse.rst:2118 +#: ../../library/argparse.rst:1917 msgid "" "Most of the time, the attributes of the object returned by :meth:" "`parse_args` will be fully determined by inspecting the command-line " @@ -3686,7 +3225,7 @@ msgid "" "command line to be added::" msgstr "" -#: ../../library/argparse.rst:2124 +#: ../../library/argparse.rst:1923 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -3700,12 +3239,12 @@ msgstr "" ">>> parser.parse_args(['736'])\n" "Namespace(bar=42, baz='badger', foo=736)" -#: ../../library/argparse.rst:2130 +#: ../../library/argparse.rst:1929 msgid "" "Note that parser-level defaults always override argument-level defaults::" msgstr "" -#: ../../library/argparse.rst:2132 +#: ../../library/argparse.rst:1931 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -3719,20 +3258,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo='spam')" -#: ../../library/argparse.rst:2138 +#: ../../library/argparse.rst:1937 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " "example of this type." msgstr "" -#: ../../library/argparse.rst:2144 +#: ../../library/argparse.rst:1943 msgid "" "Get the default value for a namespace attribute, as set by either :meth:" "`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" msgstr "" -#: ../../library/argparse.rst:2148 +#: ../../library/argparse.rst:1947 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" @@ -3744,54 +3283,54 @@ msgstr "" ">>> parser.get_default('foo')\n" "'badger'" -#: ../../library/argparse.rst:2155 +#: ../../library/argparse.rst:1954 msgid "Printing help" msgstr "" -#: ../../library/argparse.rst:2157 +#: ../../library/argparse.rst:1956 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " "several formatting methods are available:" msgstr "" -#: ../../library/argparse.rst:2163 +#: ../../library/argparse.rst:1962 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " "assumed." msgstr "" -#: ../../library/argparse.rst:2169 +#: ../../library/argparse.rst:1968 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " "``None``, :data:`sys.stdout` is assumed." msgstr "" -#: ../../library/argparse.rst:2173 +#: ../../library/argparse.rst:1972 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "" -#: ../../library/argparse.rst:2178 +#: ../../library/argparse.rst:1977 msgid "" "Return a string containing a brief description of how the :class:" "`ArgumentParser` should be invoked on the command line." msgstr "" -#: ../../library/argparse.rst:2183 +#: ../../library/argparse.rst:1982 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:2188 +#: ../../library/argparse.rst:1987 msgid "Partial parsing" msgstr "" -#: ../../library/argparse.rst:2192 +#: ../../library/argparse.rst:1991 msgid "" "Sometimes a script may only parse a few of the command-line arguments, " "passing the remaining arguments on to another script or program. In these " @@ -3802,7 +3341,7 @@ msgid "" "remaining argument strings." msgstr "" -#: ../../library/argparse.rst:2201 +#: ../../library/argparse.rst:2000 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/store_true')\n" @@ -3816,7 +3355,7 @@ msgstr "" ">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" -#: ../../library/argparse.rst:2208 +#: ../../library/argparse.rst:2007 msgid "" ":ref:`Prefix matching ` rules apply to :meth:" "`~ArgumentParser.parse_known_args`. The parser may consume an option even if " @@ -3824,11 +3363,11 @@ msgid "" "remaining arguments list." msgstr "" -#: ../../library/argparse.rst:2215 +#: ../../library/argparse.rst:2014 msgid "Customizing file parsing" msgstr "" -#: ../../library/argparse.rst:2219 +#: ../../library/argparse.rst:2018 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -3836,20 +3375,20 @@ msgid "" "reading." msgstr "" -#: ../../library/argparse.rst:2224 +#: ../../library/argparse.rst:2023 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " "The method is called once per line read from the argument file, in order." msgstr "" -#: ../../library/argparse.rst:2228 +#: ../../library/argparse.rst:2027 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" msgstr "" -#: ../../library/argparse.rst:2231 +#: ../../library/argparse.rst:2030 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" @@ -3859,18 +3398,18 @@ msgstr "" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" -#: ../../library/argparse.rst:2237 +#: ../../library/argparse.rst:2036 msgid "Exiting methods" msgstr "" -#: ../../library/argparse.rst:2241 +#: ../../library/argparse.rst:2040 msgid "" "This method terminates the program, exiting with the specified *status* and, " "if given, it prints a *message* to :data:`sys.stderr` before that. The user " "can override this method to handle these steps differently::" msgstr "" -#: ../../library/argparse.rst:2245 +#: ../../library/argparse.rst:2044 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -3884,17 +3423,17 @@ msgstr "" " raise Exception(f'Exiting because of an error: {message}')\n" " exit(status)" -#: ../../library/argparse.rst:2253 +#: ../../library/argparse.rst:2052 msgid "" "This method prints a usage message, including the *message*, to :data:`sys." "stderr` and terminates the program with a status code of 2." msgstr "" -#: ../../library/argparse.rst:2258 +#: ../../library/argparse.rst:2057 msgid "Intermixed parsing" msgstr "" -#: ../../library/argparse.rst:2263 +#: ../../library/argparse.rst:2062 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -3902,7 +3441,7 @@ msgid "" "parsing style." msgstr "" -#: ../../library/argparse.rst:2268 +#: ../../library/argparse.rst:2067 msgid "" "These parsers do not support all the argparse features, and will raise " "exceptions if unsupported features are used. In particular, subparsers, and " @@ -3910,7 +3449,7 @@ msgid "" "not supported." msgstr "" -#: ../../library/argparse.rst:2273 +#: ../../library/argparse.rst:2072 msgid "" "The following example shows the difference between :meth:`~ArgumentParser." "parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " @@ -3918,7 +3457,7 @@ msgid "" "collects all the positionals into ``rest``. ::" msgstr "" -#: ../../library/argparse.rst:2279 +#: ../../library/argparse.rst:2078 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3938,7 +3477,7 @@ msgstr "" ">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" "Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" -#: ../../library/argparse.rst:2288 +#: ../../library/argparse.rst:2087 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -3946,143 +3485,371 @@ msgid "" "there are any remaining unparsed argument strings." msgstr "" -#: ../../library/argparse.rst:2298 -msgid "Upgrading optparse code" -msgstr "" - -#: ../../library/argparse.rst:2300 -msgid "" -"Originally, the :mod:`argparse` module had attempted to maintain " -"compatibility with :mod:`optparse`. However, :mod:`optparse` was difficult " -"to extend transparently, particularly with the changes required to support " -"the new ``nargs=`` specifiers and better usage messages. When most " -"everything in :mod:`optparse` had either been copy-pasted over or monkey-" -"patched, it no longer seemed practical to try to maintain the backwards " -"compatibility." -msgstr "" - -#: ../../library/argparse.rst:2307 -msgid "" -"The :mod:`argparse` module improves on the standard library :mod:`optparse` " -"module in a number of ways including:" -msgstr "" - -#: ../../library/argparse.rst:2310 -msgid "Handling positional arguments." -msgstr "" - -#: ../../library/argparse.rst:2311 -msgid "Supporting sub-commands." -msgstr "" - -#: ../../library/argparse.rst:2312 -msgid "Allowing alternative option prefixes like ``+`` and ``/``." -msgstr "" - -#: ../../library/argparse.rst:2313 -msgid "Handling zero-or-more and one-or-more style arguments." -msgstr "" - -#: ../../library/argparse.rst:2314 -msgid "Producing more informative usage messages." -msgstr "" - -#: ../../library/argparse.rst:2315 -msgid "Providing a much simpler interface for custom ``type`` and ``action``." -msgstr "" - -#: ../../library/argparse.rst:2317 -msgid "A partial upgrade path from :mod:`optparse` to :mod:`argparse`:" -msgstr "" - -#: ../../library/argparse.rst:2319 -msgid "" -"Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:" -"`ArgumentParser.add_argument` calls." -msgstr "" - -#: ../../library/argparse.rst:2322 -msgid "" -"Replace ``(options, args) = parser.parse_args()`` with ``args = parser." -"parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls " -"for the positional arguments. Keep in mind that what was previously called " -"``options``, now in the :mod:`argparse` context is called ``args``." -msgstr "" - -#: ../../library/argparse.rst:2327 -msgid "" -"Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using :" -"meth:`~ArgumentParser.parse_intermixed_args` instead of :meth:" -"`~ArgumentParser.parse_args`." -msgstr "" - -#: ../../library/argparse.rst:2331 -msgid "" -"Replace callback actions and the ``callback_*`` keyword arguments with " -"``type`` or ``action`` arguments." -msgstr "" - -#: ../../library/argparse.rst:2334 -msgid "" -"Replace string names for ``type`` keyword arguments with the corresponding " -"type objects (e.g. int, float, complex, etc)." -msgstr "" - -#: ../../library/argparse.rst:2337 -msgid "" -"Replace :class:`optparse.Values` with :class:`Namespace` and :exc:`optparse." -"OptionError` and :exc:`optparse.OptionValueError` with :exc:`ArgumentError`." -msgstr "" - -#: ../../library/argparse.rst:2341 -msgid "" -"Replace strings with implicit arguments such as ``%default`` or ``%prog`` " -"with the standard Python syntax to use dictionaries to format strings, that " -"is, ``%(default)s`` and ``%(prog)s``." -msgstr "" - -#: ../../library/argparse.rst:2345 -msgid "" -"Replace the OptionParser constructor ``version`` argument with a call to " -"``parser.add_argument('--version', action='http://github.com/version', version='')``." -msgstr "" - -#: ../../library/argparse.rst:2349 +#: ../../library/argparse.rst:2096 msgid "Exceptions" msgstr "" -#: ../../library/argparse.rst:2353 +#: ../../library/argparse.rst:2100 msgid "An error from creating or using an argument (optional or positional)." msgstr "" -#: ../../library/argparse.rst:2355 +#: ../../library/argparse.rst:2102 msgid "" "The string value of this exception is the message, augmented with " "information about the argument that caused it." msgstr "" -#: ../../library/argparse.rst:2360 +#: ../../library/argparse.rst:2107 msgid "" "Raised when something goes wrong converting a command line string to a type." msgstr "" -#: ../../library/argparse.rst:983 +#: ../../library/argparse.rst:2111 +msgid "Guides and Tutorials" +msgstr "" + +#: ../../library/argparse.rst:796 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/argparse.rst:983 ../../library/argparse.rst:1017 -#: ../../library/argparse.rst:1031 +#: ../../library/argparse.rst:796 ../../library/argparse.rst:830 +#: ../../library/argparse.rst:844 msgid "in argparse module" msgstr "於 argparse 模組中" -#: ../../library/argparse.rst:1017 +#: ../../library/argparse.rst:830 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/argparse.rst:1031 +#: ../../library/argparse.rst:844 msgid "+ (plus)" msgstr "+ (加號)" +#~ msgid "Name" +#~ msgstr "名稱" + +#~ msgid "Description" +#~ msgstr "描述" + +#~ msgid "Values" +#~ msgstr "數值" + +#~ msgid "action_" +#~ msgstr "action_" + +#~ msgid "" +#~ "``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, " +#~ "``'append_const'``, ``'count'``, ``'help'``, ``'version'``" +#~ msgstr "" +#~ "``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, " +#~ "``'append_const'``, ``'count'``, ``'help'``, ``'version'``" + +#~ msgid "choices_" +#~ msgstr "choices_" + +#~ msgid "const_" +#~ msgstr "const_" + +#~ msgid "default_" +#~ msgstr "default_" + +#~ msgid "dest_" +#~ msgstr "dest_" + +#~ msgid "help_" +#~ msgstr "help_" + +#~ msgid "metavar_" +#~ msgstr "metavar_" + +#~ msgid "nargs_" +#~ msgstr "nargs_" + +#~ msgid ":class:`int`, ``'?'``, ``'*'``, or ``'+'``" +#~ msgstr ":class:`int`, ``'?'``, ``'*'``, or ``'+'``" + +#~ msgid "required_" +#~ msgstr "required_" + +#~ msgid "``True`` or ``False``" +#~ msgstr "``True`` 或 ``False``" + +#~ msgid "" +#~ ":class:`int`, :class:`float`, ``argparse.FileType('w')``, or callable " +#~ "function" +#~ msgstr "" +#~ ":class:`int`、:class:`float`、``argparse.FileType('w')`` 或可呼叫的函式" + +#~ msgid "Example" +#~ msgstr "範例" + +#~ msgid "" +#~ "import argparse\n" +#~ "\n" +#~ "parser = argparse.ArgumentParser(description='Process some integers.')\n" +#~ "parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" +#~ " help='an integer for the accumulator')\n" +#~ "parser.add_argument('--sum', dest='accumulate', action='http://github.com/store_const',\n" +#~ " const=sum, default=max,\n" +#~ " help='sum the integers (default: find the max)')\n" +#~ "\n" +#~ "args = parser.parse_args()\n" +#~ "print(args.accumulate(args.integers))" +#~ msgstr "" +#~ "import argparse\n" +#~ "\n" +#~ "parser = argparse.ArgumentParser(description='Process some integers.')\n" +#~ "parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" +#~ " help='an integer for the accumulator')\n" +#~ "parser.add_argument('--sum', dest='accumulate', action='http://github.com/store_const',\n" +#~ " const=sum, default=max,\n" +#~ " help='sum the integers (default: find the max)')\n" +#~ "\n" +#~ "args = parser.parse_args()\n" +#~ "print(args.accumulate(args.integers))" + +#~ msgid "" +#~ "$ python prog.py -h\n" +#~ "usage: prog.py [-h] [--sum] N [N ...]\n" +#~ "\n" +#~ "Process some integers.\n" +#~ "\n" +#~ "positional arguments:\n" +#~ " N an integer for the accumulator\n" +#~ "\n" +#~ "options:\n" +#~ " -h, --help show this help message and exit\n" +#~ " --sum sum the integers (default: find the max)" +#~ msgstr "" +#~ "$ python prog.py -h\n" +#~ "usage: prog.py [-h] [--sum] N [N ...]\n" +#~ "\n" +#~ "Process some integers.\n" +#~ "\n" +#~ "positional arguments:\n" +#~ " N an integer for the accumulator\n" +#~ "\n" +#~ "options:\n" +#~ " -h, --help show this help message and exit\n" +#~ " --sum sum the integers (default: find the max)" + +#~ msgid "" +#~ "$ python prog.py 1 2 3 4\n" +#~ "4\n" +#~ "\n" +#~ "$ python prog.py 1 2 3 4 --sum\n" +#~ "10" +#~ msgstr "" +#~ "$ python prog.py 1 2 3 4\n" +#~ "4\n" +#~ "\n" +#~ "$ python prog.py 1 2 3 4 --sum\n" +#~ "10" + +#~ msgid "" +#~ "$ python prog.py a b c\n" +#~ "usage: prog.py [-h] [--sum] N [N ...]\n" +#~ "prog.py: error: argument N: invalid int value: 'a'" +#~ msgstr "" +#~ "$ python prog.py a b c\n" +#~ "usage: prog.py [-h] [--sum] N [N ...]\n" +#~ "prog.py: error: argument N: invalid int value: 'a'" + +#~ msgid "Creating a parser" +#~ msgstr "建立一個剖析器" + +#~ msgid "" +#~ ">>> parser = argparse.ArgumentParser(description='Process some integers.')" +#~ msgstr "" +#~ ">>> parser = argparse.ArgumentParser(description='Process some integers.')" + +#~ msgid "Adding arguments" +#~ msgstr "增加引數" + +#~ msgid "" +#~ ">>> parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" +#~ "... help='an integer for the accumulator')\n" +#~ ">>> parser.add_argument('--sum', dest='accumulate', " +#~ "action='http://github.com/store_const',\n" +#~ "... const=sum, default=max,\n" +#~ "... help='sum the integers (default: find the max)')" +#~ msgstr "" +#~ ">>> parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" +#~ "... help='an integer for the accumulator')\n" +#~ ">>> parser.add_argument('--sum', dest='accumulate', " +#~ "action='http://github.com/store_const',\n" +#~ "... const=sum, default=max,\n" +#~ "... help='sum the integers (default: find the max)')" + +#~ msgid "Parsing arguments" +#~ msgstr "剖析引數" + +#~ msgid "" +#~ ">>> parser.parse_args(['--sum', '7', '-1', '42'])\n" +#~ "Namespace(accumulate=, integers=[7, -1, 42])" +#~ msgstr "" +#~ ">>> parser.parse_args(['--sum', '7', '-1', '42'])\n" +#~ "Namespace(accumulate=, integers=[7, -1, 42])" + +#~ msgid "" +#~ "import argparse\n" +#~ "parser = argparse.ArgumentParser()\n" +#~ "parser.add_argument('--foo', help='foo help')\n" +#~ "args = parser.parse_args()" +#~ msgstr "" +#~ "import argparse\n" +#~ "parser = argparse.ArgumentParser()\n" +#~ "parser.add_argument('--foo', help='foo help')\n" +#~ "args = parser.parse_args()" + +#~ msgid "" +#~ "$ python myprogram.py --help\n" +#~ "usage: myprogram.py [-h] [--foo FOO]\n" +#~ "\n" +#~ "options:\n" +#~ " -h, --help show this help message and exit\n" +#~ " --foo FOO foo help\n" +#~ "$ cd ..\n" +#~ "$ python subdir/myprogram.py --help\n" +#~ "usage: myprogram.py [-h] [--foo FOO]\n" +#~ "\n" +#~ "options:\n" +#~ " -h, --help show this help message and exit\n" +#~ " --foo FOO foo help" +#~ msgstr "" +#~ "$ python myprogram.py --help\n" +#~ "usage: myprogram.py [-h] [--foo FOO]\n" +#~ "\n" +#~ "options:\n" +#~ " -h, --help show this help message and exit\n" +#~ " --foo FOO foo help\n" +#~ "$ cd ..\n" +#~ "$ python subdir/myprogram.py --help\n" +#~ "usage: myprogram.py [-h] [--foo FOO]\n" +#~ "\n" +#~ "options:\n" +#~ " -h, --help show this help message and exit\n" +#~ " --foo FOO foo help" + +#~ msgid "" +#~ ">>> parser = argparse.ArgumentParser(prog='PROG')\n" +#~ ">>> parser.add_argument('--foo', nargs='?', help='foo help')\n" +#~ ">>> parser.add_argument('bar', nargs='+', help='bar help')\n" +#~ ">>> parser.print_help()\n" +#~ "usage: PROG [-h] [--foo [FOO]] bar [bar ...]\n" +#~ "\n" +#~ "positional arguments:\n" +#~ " bar bar help\n" +#~ "\n" +#~ "options:\n" +#~ " -h, --help show this help message and exit\n" +#~ " --foo [FOO] foo help" +#~ msgstr "" +#~ ">>> parser = argparse.ArgumentParser(prog='PROG')\n" +#~ ">>> parser.add_argument('--foo', nargs='?', help='foo help')\n" +#~ ">>> parser.add_argument('bar', nargs='+', help='bar help')\n" +#~ ">>> parser.print_help()\n" +#~ "usage: PROG [-h] [--foo [FOO]] bar [bar ...]\n" +#~ "\n" +#~ "positional arguments:\n" +#~ " bar bar help\n" +#~ "\n" +#~ "options:\n" +#~ " -h, --help show this help message and exit\n" +#~ " --foo [FOO] foo help" + +#~ msgid "" +#~ ">>> parser = argparse.ArgumentParser(description='A foo that bars')\n" +#~ ">>> parser.print_help()\n" +#~ "usage: argparse.py [-h]\n" +#~ "\n" +#~ "A foo that bars\n" +#~ "\n" +#~ "options:\n" +#~ " -h, --help show this help message and exit" +#~ msgstr "" +#~ ">>> parser = argparse.ArgumentParser(description='A foo that bars')\n" +#~ ">>> parser.print_help()\n" +#~ "usage: argparse.py [-h]\n" +#~ "\n" +#~ "A foo that bars\n" +#~ "\n" +#~ "options:\n" +#~ " -h, --help show this help message and exit" + +#~ msgid "" +#~ "$ python myprogram.py --help\n" +#~ "usage: myprogram.py [-h] [--foo FOO]\n" +#~ "\n" +#~ "options:\n" +#~ " -h, --help show this help message and exit\n" +#~ " --foo FOO foo help" +#~ msgstr "" +#~ "$ python myprogram.py --help\n" +#~ "usage: myprogram.py [-h] [--foo FOO]\n" +#~ "\n" +#~ "options:\n" +#~ " -h, --help show this help message and exit\n" +#~ " --foo FOO foo help" + +#~ msgid "" +#~ ">>> parser = argparse.ArgumentParser()\n" +#~ ">>> parser.add_argument('--foo')\n" +#~ ">>> parser.parse_args('--foo 1'.split())\n" +#~ "Namespace(foo='1')" +#~ msgstr "" +#~ ">>> parser = argparse.ArgumentParser()\n" +#~ ">>> parser.add_argument('--foo')\n" +#~ ">>> parser.parse_args('--foo 1'.split())\n" +#~ "Namespace(foo='1')" + +#~ msgid "" +#~ ">>> parser = argparse.ArgumentParser(prog='doors.py')\n" +#~ ">>> parser.add_argument('door', type=int, choices=range(1, 4))\n" +#~ ">>> print(parser.parse_args(['3']))\n" +#~ "Namespace(door=3)\n" +#~ ">>> parser.parse_args(['4'])\n" +#~ "usage: doors.py [-h] {1,2,3}\n" +#~ "doors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3)" +#~ msgstr "" +#~ ">>> parser = argparse.ArgumentParser(prog='doors.py')\n" +#~ ">>> parser.add_argument('door', type=int, choices=range(1, 4))\n" +#~ ">>> print(parser.parse_args(['3']))\n" +#~ "Namespace(door=3)\n" +#~ ">>> parser.parse_args(['4'])\n" +#~ "usage: doors.py [-h] {1,2,3}\n" +#~ "doors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3)" + +#~ msgid "" +#~ ">>> parser = argparse.ArgumentParser(prog='frobble')\n" +#~ ">>> parser.add_argument('--foo', action='http://github.com/store_true',\n" +#~ "... help='foo the bars before frobbling')\n" +#~ ">>> parser.add_argument('bar', nargs='+',\n" +#~ "... help='one of the bars to be frobbled')\n" +#~ ">>> parser.parse_args(['-h'])\n" +#~ "usage: frobble [-h] [--foo] bar [bar ...]\n" +#~ "\n" +#~ "positional arguments:\n" +#~ " bar one of the bars to be frobbled\n" +#~ "\n" +#~ "options:\n" +#~ " -h, --help show this help message and exit\n" +#~ " --foo foo the bars before frobbling" +#~ msgstr "" +#~ ">>> parser = argparse.ArgumentParser(prog='frobble')\n" +#~ ">>> parser.add_argument('--foo', action='http://github.com/store_true',\n" +#~ "... help='foo the bars before frobbling')\n" +#~ ">>> parser.add_argument('bar', nargs='+',\n" +#~ "... help='one of the bars to be frobbled')\n" +#~ ">>> parser.parse_args(['-h'])\n" +#~ "usage: frobble [-h] [--foo] bar [bar ...]\n" +#~ "\n" +#~ "positional arguments:\n" +#~ " bar one of the bars to be frobbled\n" +#~ "\n" +#~ "options:\n" +#~ " -h, --help show this help message and exit\n" +#~ " --foo foo the bars before frobbling" + #~ msgid "type_" #~ msgstr "type_" diff --git a/library/ast.po b/library/ast.po index bf6a46b3ed..2bfa5f5ae3 100644 --- a/library/ast.po +++ b/library/ast.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-10-10 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1630,12 +1630,12 @@ msgid "" "(indicating a \"simple\" target). A \"simple\" target consists solely of a :" "class:`Name` node that does not appear between parentheses; all other " "targets are considered complex. Only simple targets appear in the :attr:" -"`__annotations__` dictionary of modules and classes." +"`~object.__annotations__` dictionary of modules and classes." msgstr "" "``simple`` 總會是 0(表示一個「複雜」目標)或 1(表示一個「簡單」目標)。一個" "「簡單」目標僅包含一個 :class:`Name` 節點,且不出現在括號之間;所有其他目標都" -"被視為是複雜的。只有簡單目標會出現在模組和類別的 :attr:`__annotations__` 字典" -"中。" +"被視為是複雜的。只有簡單目標會出現在模組和類別的 :attr:`~object." +"__annotations__` 字典中。" #: ../../library/ast.rst:902 msgid "" diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index 3e07964e9d..8cb8efab1e 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2022-02-20 12:36+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1087,8 +1087,10 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:652 #: ../../library/asyncio-eventloop.rst:806 #: ../../library/asyncio-eventloop.rst:1249 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" +#: ../../library/asyncio-eventloop.rst:1782 +#: ../../library/asyncio-eventloop.rst:1789 +msgid "Availability" +msgstr "" #: ../../library/asyncio-eventloop.rst:654 msgid "" @@ -2675,10 +2677,6 @@ msgstr "" "\n" "asyncio.set_event_loop_policy(MyPolicy())" -#: ../../library/asyncio-eventloop.rst:1782 -msgid ":ref:`Availability `: Unix, Windows." -msgstr ":ref:`適用 `:Unix、Windows。" - #: ../../library/asyncio-eventloop.rst:1787 #, fuzzy msgid "" @@ -2686,10 +2684,6 @@ msgid "" "Completion Ports\" (IOCP)." msgstr "用於 Windows 的事件迴圈,使用\"I/O 完成埠\"(IOCP)。" -#: ../../library/asyncio-eventloop.rst:1789 -msgid ":ref:`Availability `: Windows." -msgstr ":ref:`適用 `:Windows。" - #: ../../library/asyncio-eventloop.rst:1793 msgid "" "`MSDN documentation on I/O Completion Ports \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -160,8 +160,8 @@ msgid "" msgstr "" #: ../../library/asyncio-policy.rst:131 ../../library/asyncio-policy.rst:139 -msgid ":ref:`Availability `: Windows." -msgstr ":ref:`適用 `:Windows。" +msgid "Availability" +msgstr "" #: ../../library/asyncio-policy.rst:136 msgid "" diff --git a/library/asyncio-stream.po b/library/asyncio-stream.po index a89301bcf9..667acc44fd 100644 --- a/library/asyncio-stream.po +++ b/library/asyncio-stream.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2022-10-31 16:28+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -208,8 +208,8 @@ msgid "See also the documentation of :meth:`loop.create_unix_connection`." msgstr "另請參閱 :meth:`loop.create_unix_connection` 文件。" #: ../../library/asyncio-stream.rst:151 ../../library/asyncio-stream.rst:181 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" +msgid "Availability" +msgstr "" #: ../../library/asyncio-stream.rst:153 msgid "" diff --git a/library/asyncio-task.po b/library/asyncio-task.po index b4dd13ea2f..61341b2013 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 23:08+0000\n" +"POT-Creation-Date: 2024-10-13 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -262,7 +262,7 @@ msgid "" " # Nothing happens if we just call \"nested()\".\n" " # A coroutine object is created but not awaited,\n" " # so it *won't run at all*.\n" -" nested()\n" +" nested() # will raise a \"RuntimeWarning\".\n" "\n" " # Let's do it differently now and await it:\n" " print(await nested()) # will print \"42\".\n" diff --git a/library/asyncio.po b/library/asyncio.po index 56727e33e5..3d069c4f74 100644 --- a/library/asyncio.po +++ b/library/asyncio.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2021-11-23 12:40+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -148,8 +148,8 @@ msgstr "" "based) 的函式庫與程式碼。" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" diff --git a/library/codecs.po b/library/codecs.po index aa60cd8b84..5ccfe0b8b7 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+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-" @@ -2652,8 +2652,8 @@ msgid "This module implements the ANSI codepage (CP_ACP)." msgstr "" #: ../../library/codecs.rst:1542 -msgid ":ref:`Availability `: Windows." -msgstr ":ref:`適用 `:Windows。" +msgid "Availability" +msgstr "" #: ../../library/codecs.rst:1544 msgid "" @@ -2766,8 +2766,3 @@ msgstr "\\N" #: ../../library/codecs.rst:387 msgid "surrogatepass" msgstr "surrogatepass" - -#, fuzzy -#~ msgid "" -#~ ":meth:`!uu.encode` / :meth:`!uu.decode` (Note: :mod:`uu` is deprecated.)" -#~ msgstr ":meth:`uu.encode` / :meth:`uu.decode`" diff --git a/library/compileall.po b/library/compileall.po index 78cbc5fb98..da2c078c4b 100644 --- a/library/compileall.po +++ b/library/compileall.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,8 +36,8 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index 1a8ea4d243..682bcbacad 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2023-01-24 03:33+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,8 +51,8 @@ msgstr "" "相同的介面,該介面由抽象的 :class:`Executor` 類別定義。" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" diff --git a/library/configparser.po b/library/configparser.po index 0943f36e02..3bc3843a4c 100644 --- a/library/configparser.po +++ b/library/configparser.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-12 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -69,15 +69,15 @@ msgid "" "sometimes used for configuration, but does not support comments." msgstr "" -#: ../../library/configparser.rst:60 +#: ../../library/configparser.rst:61 msgid "Quick Start" msgstr "" -#: ../../library/configparser.rst:62 +#: ../../library/configparser.rst:63 msgid "Let's take a very basic configuration file that looks like this:" msgstr "" -#: ../../library/configparser.rst:64 +#: ../../library/configparser.rst:65 msgid "" "[DEFAULT]\n" "ServerAliveInterval = 45\n" @@ -105,7 +105,7 @@ msgstr "" "Port = 50022\n" "ForwardX11 = no" -#: ../../library/configparser.rst:79 +#: ../../library/configparser.rst:80 msgid "" "The structure of INI files is described `in the following section " "<#supported-ini-file-structure>`_. Essentially, the file consists of " @@ -114,7 +114,7 @@ msgid "" "configuration file programmatically." msgstr "" -#: ../../library/configparser.rst:85 +#: ../../library/configparser.rst:86 msgid "" ">>> import configparser\n" ">>> config = configparser.ConfigParser()\n" @@ -133,20 +133,20 @@ msgid "" "..." msgstr "" -#: ../../library/configparser.rst:103 +#: ../../library/configparser.rst:104 msgid "" "As you can see, we can treat a config parser much like a dictionary. There " "are differences, `outlined later <#mapping-protocol-access>`_, but the " "behavior is very close to what you would expect from a dictionary." msgstr "" -#: ../../library/configparser.rst:107 +#: ../../library/configparser.rst:108 msgid "" "Now that we have created and saved a configuration file, let's read it back " "and explore the data it holds." msgstr "" -#: ../../library/configparser.rst:110 +#: ../../library/configparser.rst:111 msgid "" ">>> config = configparser.ConfigParser()\n" ">>> config.sections()\n" @@ -179,7 +179,7 @@ msgid "" "'yes'" msgstr "" -#: ../../library/configparser.rst:142 +#: ../../library/configparser.rst:143 msgid "" "As we can see above, the API is pretty straightforward. The only bit of " "magic involves the ``DEFAULT`` section which provides default values for all " @@ -187,7 +187,7 @@ msgid "" "and stored in lowercase [1]_." msgstr "" -#: ../../library/configparser.rst:147 ../../library/configparser.rst:992 +#: ../../library/configparser.rst:148 ../../library/configparser.rst:993 msgid "" "It is possible to read several configurations into a single :class:" "`ConfigParser`, where the most recently added configuration has the highest " @@ -197,7 +197,7 @@ msgid "" "``example.ini`` file." msgstr "" -#: ../../library/configparser.rst:154 ../../library/configparser.rst:999 +#: ../../library/configparser.rst:155 ../../library/configparser.rst:1000 msgid "" "[DEFAULT]\n" "ServerAliveInterval = -1" @@ -205,7 +205,7 @@ msgstr "" "[DEFAULT]\n" "ServerAliveInterval = -1" -#: ../../library/configparser.rst:159 ../../library/configparser.rst:1004 +#: ../../library/configparser.rst:160 ../../library/configparser.rst:1005 msgid "" ">>> config_override = configparser.ConfigParser()\n" ">>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}\n" @@ -229,24 +229,24 @@ msgstr "" ">>> print(config_override.get('DEFAULT', 'ServerAliveInterval'))\n" "-1" -#: ../../library/configparser.rst:173 +#: ../../library/configparser.rst:174 msgid "" "This behaviour is equivalent to a :meth:`ConfigParser.read` call with " "several files passed to the *filenames* parameter." msgstr "" -#: ../../library/configparser.rst:178 +#: ../../library/configparser.rst:179 msgid "Supported Datatypes" msgstr "" -#: ../../library/configparser.rst:180 +#: ../../library/configparser.rst:181 msgid "" "Config parsers do not guess datatypes of values in configuration files, " "always storing them internally as strings. This means that if you need " "other datatypes, you should convert on your own:" msgstr "" -#: ../../library/configparser.rst:184 +#: ../../library/configparser.rst:185 msgid "" ">>> int(topsecret['Port'])\n" "50022\n" @@ -258,7 +258,7 @@ msgstr "" ">>> float(topsecret['CompressionLevel'])\n" "9.0" -#: ../../library/configparser.rst:191 +#: ../../library/configparser.rst:192 msgid "" "Since this task is so common, config parsers provide a range of handy getter " "methods to handle integers, floats and booleans. The last one is the most " @@ -269,7 +269,7 @@ msgid "" "``'true'``/``'false'`` and ``'1'``/``'0'`` [1]_. For example:" msgstr "" -#: ../../library/configparser.rst:199 +#: ../../library/configparser.rst:200 msgid "" ">>> topsecret.getboolean('ForwardX11')\n" "False\n" @@ -285,7 +285,7 @@ msgstr "" ">>> config.getboolean('forge.example', 'Compression')\n" "True" -#: ../../library/configparser.rst:208 +#: ../../library/configparser.rst:209 msgid "" "Apart from :meth:`~ConfigParser.getboolean`, config parsers also provide " "equivalent :meth:`~ConfigParser.getint` and :meth:`~ConfigParser.getfloat` " @@ -293,17 +293,17 @@ msgid "" "ones. [1]_" msgstr "" -#: ../../library/configparser.rst:214 +#: ../../library/configparser.rst:215 msgid "Fallback Values" msgstr "" -#: ../../library/configparser.rst:216 +#: ../../library/configparser.rst:217 msgid "" "As with a dictionary, you can use a section's :meth:`~ConfigParser.get` " "method to provide fallback values:" msgstr "" -#: ../../library/configparser.rst:219 +#: ../../library/configparser.rst:220 msgid "" ">>> topsecret.get('Port')\n" "'50022'\n" @@ -321,7 +321,7 @@ msgstr "" ">>> topsecret.get('Cipher', '3des-cbc')\n" "'3des-cbc'" -#: ../../library/configparser.rst:229 +#: ../../library/configparser.rst:230 msgid "" "Please note that default values have precedence over fallback values. For " "instance, in our example the ``'CompressionLevel'`` key was specified only " @@ -330,7 +330,7 @@ msgid "" "specify a fallback:" msgstr "" -#: ../../library/configparser.rst:235 +#: ../../library/configparser.rst:236 msgid "" ">>> topsecret.get('CompressionLevel', '3')\n" "'9'" @@ -338,7 +338,7 @@ msgstr "" ">>> topsecret.get('CompressionLevel', '3')\n" "'9'" -#: ../../library/configparser.rst:240 +#: ../../library/configparser.rst:241 msgid "" "One more thing to be aware of is that the parser-level :meth:`~ConfigParser." "get` method provides a custom, more complex interface, maintained for " @@ -346,21 +346,21 @@ msgid "" "provided via the ``fallback`` keyword-only argument:" msgstr "" -#: ../../library/configparser.rst:245 +#: ../../library/configparser.rst:246 msgid "" ">>> config.get('forge.example', 'monster',\n" "... fallback='No such things as monsters')\n" "'No such things as monsters'" msgstr "" -#: ../../library/configparser.rst:251 +#: ../../library/configparser.rst:252 msgid "" "The same ``fallback`` argument can be used with the :meth:`~ConfigParser." "getint`, :meth:`~ConfigParser.getfloat` and :meth:`~ConfigParser.getboolean` " "methods, for example:" msgstr "" -#: ../../library/configparser.rst:255 +#: ../../library/configparser.rst:256 msgid "" ">>> 'BatchMode' in topsecret\n" "False\n" @@ -378,11 +378,11 @@ msgstr "" ">>> topsecret.getboolean('BatchMode', fallback=True)\n" "False" -#: ../../library/configparser.rst:267 +#: ../../library/configparser.rst:268 msgid "Supported INI File Structure" msgstr "" -#: ../../library/configparser.rst:269 +#: ../../library/configparser.rst:270 msgid "" "A configuration file consists of sections, each led by a ``[section]`` " "header, followed by key/value entries separated by a specific string (``=`` " @@ -395,13 +395,13 @@ msgid "" "parts of multiline values or ignored." msgstr "" -#: ../../library/configparser.rst:279 +#: ../../library/configparser.rst:280 msgid "" "By default, a valid section name can be any string that does not contain '\\" "\\n'. To change this, see :attr:`ConfigParser.SECTCRE`." msgstr "" -#: ../../library/configparser.rst:282 +#: ../../library/configparser.rst:283 msgid "" "The first section name may be omitted if the parser is configured to allow " "an unnamed top level section with ``allow_unnamed_section=True``. In this " @@ -409,18 +409,18 @@ msgid "" "``config[UNNAMED_SECTION]``." msgstr "" -#: ../../library/configparser.rst:287 +#: ../../library/configparser.rst:288 msgid "" "Configuration files may include comments, prefixed by specific characters " "(``#`` and ``;`` by default [1]_). Comments may appear on their own on an " "otherwise empty line, possibly indented. [1]_" msgstr "" -#: ../../library/configparser.rst:291 ../../library/configparser.rst:375 +#: ../../library/configparser.rst:292 ../../library/configparser.rst:376 msgid "For example:" msgstr "舉例來說:" -#: ../../library/configparser.rst:293 +#: ../../library/configparser.rst:294 msgid "" "[Simple Values]\n" "key=value\n" @@ -465,17 +465,17 @@ msgid "" " # Did I mention we can indent comments, too?" msgstr "" -#: ../../library/configparser.rst:341 +#: ../../library/configparser.rst:342 msgid "Unnamed Sections" msgstr "" -#: ../../library/configparser.rst:343 +#: ../../library/configparser.rst:344 msgid "" "The name of the first section (or unique) may be omitted and values " "retrieved by the :const:`UNNAMED_SECTION` attribute." msgstr "" -#: ../../library/configparser.rst:346 +#: ../../library/configparser.rst:347 msgid "" ">>> config = \"\"\"\n" "... option = value\n" @@ -489,18 +489,18 @@ msgid "" "'value'" msgstr "" -#: ../../library/configparser.rst:360 +#: ../../library/configparser.rst:361 msgid "Interpolation of values" msgstr "" -#: ../../library/configparser.rst:362 +#: ../../library/configparser.rst:363 msgid "" "On top of the core functionality, :class:`ConfigParser` supports " "interpolation. This means values can be preprocessed before returning them " "from ``get()`` calls." msgstr "" -#: ../../library/configparser.rst:370 +#: ../../library/configparser.rst:371 msgid "" "The default implementation used by :class:`ConfigParser`. It enables values " "to contain format strings which refer to other values in the same section, " @@ -508,7 +508,7 @@ msgid "" "can be provided on initialization." msgstr "" -#: ../../library/configparser.rst:377 +#: ../../library/configparser.rst:378 msgid "" "[Paths]\n" "home_dir: /Users\n" @@ -521,7 +521,7 @@ msgid "" "gain: 80%%" msgstr "" -#: ../../library/configparser.rst:388 +#: ../../library/configparser.rst:389 msgid "" "In the example above, :class:`ConfigParser` with *interpolation* set to " "``BasicInterpolation()`` would resolve ``%(home_dir)s`` to the value of " @@ -531,14 +531,14 @@ msgid "" "specific order in the configuration file." msgstr "" -#: ../../library/configparser.rst:395 +#: ../../library/configparser.rst:396 msgid "" "With ``interpolation`` set to ``None``, the parser would simply return " "``%(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/" "lumberjack`` as the value of ``my_dir``." msgstr "" -#: ../../library/configparser.rst:403 +#: ../../library/configparser.rst:404 msgid "" "An alternative handler for interpolation which implements a more advanced " "syntax, used for instance in ``zc.buildout``. Extended interpolation is " @@ -548,13 +548,13 @@ msgid "" "possibly the default values from the special section)." msgstr "" -#: ../../library/configparser.rst:410 +#: ../../library/configparser.rst:411 msgid "" "For example, the configuration specified above with basic interpolation, " "would look like this with extended interpolation:" msgstr "" -#: ../../library/configparser.rst:413 +#: ../../library/configparser.rst:414 msgid "" "[Paths]\n" "home_dir: /Users\n" @@ -567,11 +567,11 @@ msgid "" "cost: $$80" msgstr "" -#: ../../library/configparser.rst:424 +#: ../../library/configparser.rst:425 msgid "Values from other sections can be fetched as well:" msgstr "" -#: ../../library/configparser.rst:426 +#: ../../library/configparser.rst:427 msgid "" "[Common]\n" "home_dir: /Users\n" @@ -607,11 +607,11 @@ msgstr "" "my_pictures: ${my_dir}/Pictures\n" "python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python}" -#: ../../library/configparser.rst:446 +#: ../../library/configparser.rst:447 msgid "Mapping Protocol Access" msgstr "" -#: ../../library/configparser.rst:450 +#: ../../library/configparser.rst:451 msgid "" "Mapping protocol access is a generic name for functionality that enables " "using custom objects as if they were dictionaries. In case of :mod:" @@ -619,7 +619,7 @@ msgid "" "``parser['section']['option']`` notation." msgstr "" -#: ../../library/configparser.rst:455 +#: ../../library/configparser.rst:456 msgid "" "``parser['section']`` in particular returns a proxy for the section's data " "in the parser. This means that the values are not copied but they are taken " @@ -628,7 +628,7 @@ msgid "" "original parser." msgstr "" -#: ../../library/configparser.rst:461 +#: ../../library/configparser.rst:462 msgid "" ":mod:`configparser` objects behave as close to actual dictionaries as " "possible. The mapping interface is complete and adheres to the :class:" @@ -636,7 +636,7 @@ msgid "" "that should be taken into account:" msgstr "" -#: ../../library/configparser.rst:466 +#: ../../library/configparser.rst:467 msgid "" "By default, all keys in sections are accessible in a case-insensitive manner " "[1]_. E.g. ``for option in parser[\"section\"]`` yields only " @@ -645,7 +645,7 @@ msgid "" "expressions return ``True``::" msgstr "" -#: ../../library/configparser.rst:471 +#: ../../library/configparser.rst:472 msgid "" "\"a\" in parser[\"section\"]\n" "\"A\" in parser[\"section\"]" @@ -653,7 +653,7 @@ msgstr "" "\"a\" in parser[\"section\"]\n" "\"A\" in parser[\"section\"]" -#: ../../library/configparser.rst:474 +#: ../../library/configparser.rst:475 msgid "" "All sections include ``DEFAULTSECT`` values as well which means that ``." "clear()`` on a section may not leave the section visibly empty. This is " @@ -663,30 +663,30 @@ msgid "" "default value causes a :exc:`KeyError`." msgstr "" -#: ../../library/configparser.rst:481 +#: ../../library/configparser.rst:482 msgid "``DEFAULTSECT`` cannot be removed from the parser:" msgstr "" -#: ../../library/configparser.rst:483 +#: ../../library/configparser.rst:484 msgid "trying to delete it raises :exc:`ValueError`," msgstr "" -#: ../../library/configparser.rst:485 +#: ../../library/configparser.rst:486 msgid "``parser.clear()`` leaves it intact," msgstr "" -#: ../../library/configparser.rst:487 +#: ../../library/configparser.rst:488 msgid "``parser.popitem()`` never returns it." msgstr "" -#: ../../library/configparser.rst:489 +#: ../../library/configparser.rst:490 msgid "" "``parser.get(section, option, **kwargs)`` - the second argument is **not** a " "fallback value. Note however that the section-level ``get()`` methods are " "compatible both with the mapping protocol and the classic configparser API." msgstr "" -#: ../../library/configparser.rst:493 +#: ../../library/configparser.rst:494 msgid "" "``parser.items()`` is compatible with the mapping protocol (returns a list " "of *section_name*, *section_proxy* pairs including the DEFAULTSECT). " @@ -696,18 +696,18 @@ msgid "" "(unless ``raw=True`` is provided)." msgstr "" -#: ../../library/configparser.rst:500 +#: ../../library/configparser.rst:501 msgid "" "The mapping protocol is implemented on top of the existing legacy API so " "that subclasses overriding the original interface still should have mappings " "working as expected." msgstr "" -#: ../../library/configparser.rst:506 +#: ../../library/configparser.rst:507 msgid "Customizing Parser Behaviour" msgstr "" -#: ../../library/configparser.rst:508 +#: ../../library/configparser.rst:509 msgid "" "There are nearly as many INI format variants as there are applications using " "it. :mod:`configparser` goes a long way to provide support for the largest " @@ -716,17 +716,17 @@ msgid "" "customize some of the features." msgstr "" -#: ../../library/configparser.rst:514 +#: ../../library/configparser.rst:515 msgid "" "The most common way to change the way a specific config parser works is to " "use the :meth:`!__init__` options:" msgstr "" -#: ../../library/configparser.rst:517 +#: ../../library/configparser.rst:518 msgid "*defaults*, default value: ``None``" msgstr "" -#: ../../library/configparser.rst:519 +#: ../../library/configparser.rst:520 msgid "" "This option accepts a dictionary of key-value pairs which will be initially " "put in the ``DEFAULT`` section. This makes for an elegant way to support " @@ -734,17 +734,17 @@ msgid "" "the documented default." msgstr "" -#: ../../library/configparser.rst:524 +#: ../../library/configparser.rst:525 msgid "" "Hint: if you want to specify default values for a specific section, use :" "meth:`~ConfigParser.read_dict` before you read the actual file." msgstr "" -#: ../../library/configparser.rst:527 +#: ../../library/configparser.rst:528 msgid "*dict_type*, default value: :class:`dict`" msgstr "" -#: ../../library/configparser.rst:529 +#: ../../library/configparser.rst:530 msgid "" "This option has a major impact on how the mapping protocol will behave and " "how the written configuration files look. With the standard dictionary, " @@ -752,20 +752,20 @@ msgid "" "goes for options within sections." msgstr "" -#: ../../library/configparser.rst:534 +#: ../../library/configparser.rst:535 msgid "" "An alternative dictionary type can be used for example to sort sections and " "options on write-back." msgstr "" -#: ../../library/configparser.rst:537 +#: ../../library/configparser.rst:538 msgid "" "Please note: there are ways to add a set of key-value pairs in a single " "operation. When you use a regular dictionary in those operations, the order " "of the keys will be ordered. For example:" msgstr "" -#: ../../library/configparser.rst:541 +#: ../../library/configparser.rst:542 msgid "" ">>> parser = configparser.ConfigParser()\n" ">>> parser.read_dict({'section1': {'key1': 'value1',\n" @@ -799,11 +799,11 @@ msgstr "" ">>> [option for option in parser['section3']]\n" "['foo', 'bar', 'baz']" -#: ../../library/configparser.rst:559 +#: ../../library/configparser.rst:560 msgid "*allow_no_value*, default value: ``False``" msgstr "" -#: ../../library/configparser.rst:561 +#: ../../library/configparser.rst:562 msgid "" "Some configuration files are known to include settings without values, but " "which otherwise conform to the syntax supported by :mod:`configparser`. The " @@ -811,7 +811,7 @@ msgid "" "such values should be accepted:" msgstr "" -#: ../../library/configparser.rst:566 +#: ../../library/configparser.rst:567 msgid "" ">>> import configparser\n" "\n" @@ -842,32 +842,32 @@ msgid "" "KeyError: 'does-not-exist'" msgstr "" -#: ../../library/configparser.rst:596 +#: ../../library/configparser.rst:597 msgid "*delimiters*, default value: ``('=', ':')``" msgstr "" -#: ../../library/configparser.rst:598 +#: ../../library/configparser.rst:599 msgid "" "Delimiters are substrings that delimit keys from values within a section. " "The first occurrence of a delimiting substring on a line is considered a " "delimiter. This means values (but not keys) can contain the delimiters." msgstr "" -#: ../../library/configparser.rst:602 +#: ../../library/configparser.rst:603 msgid "" "See also the *space_around_delimiters* argument to :meth:`ConfigParser." "write`." msgstr "" -#: ../../library/configparser.rst:605 +#: ../../library/configparser.rst:606 msgid "*comment_prefixes*, default value: ``('#', ';')``" msgstr "" -#: ../../library/configparser.rst:607 +#: ../../library/configparser.rst:608 msgid "*inline_comment_prefixes*, default value: ``None``" msgstr "" -#: ../../library/configparser.rst:609 +#: ../../library/configparser.rst:610 msgid "" "Comment prefixes are strings that indicate the start of a valid comment " "within a config file. *comment_prefixes* are used only on otherwise empty " @@ -877,13 +877,13 @@ msgid "" "used as prefixes for whole line comments." msgstr "" -#: ../../library/configparser.rst:616 +#: ../../library/configparser.rst:617 msgid "" "In previous versions of :mod:`configparser` behaviour matched " "``comment_prefixes=('#',';')`` and ``inline_comment_prefixes=(';',)``." msgstr "" -#: ../../library/configparser.rst:620 +#: ../../library/configparser.rst:621 msgid "" "Please note that config parsers don't support escaping of comment prefixes " "so using *inline_comment_prefixes* may prevent users from specifying option " @@ -893,7 +893,7 @@ msgid "" "values is to interpolate the prefix, for example::" msgstr "" -#: ../../library/configparser.rst:627 +#: ../../library/configparser.rst:628 msgid "" ">>> from configparser import ConfigParser, ExtendedInterpolation\n" ">>> parser = ConfigParser(interpolation=ExtendedInterpolation())\n" @@ -935,11 +935,11 @@ msgid "" "line #3" msgstr "" -#: ../../library/configparser.rst:666 +#: ../../library/configparser.rst:667 msgid "*strict*, default value: ``True``" msgstr "" -#: ../../library/configparser.rst:668 +#: ../../library/configparser.rst:669 msgid "" "When set to ``True``, the parser will not allow for any section or option " "duplicates while reading from a single source (using :meth:`~ConfigParser." @@ -947,17 +947,17 @@ msgid "" "read_dict`). It is recommended to use strict parsers in new applications." msgstr "" -#: ../../library/configparser.rst:673 +#: ../../library/configparser.rst:674 msgid "" "In previous versions of :mod:`configparser` behaviour matched " "``strict=False``." msgstr "" -#: ../../library/configparser.rst:677 +#: ../../library/configparser.rst:678 msgid "*empty_lines_in_values*, default value: ``True``" msgstr "" -#: ../../library/configparser.rst:679 +#: ../../library/configparser.rst:680 msgid "" "In config parsers, values can span multiple lines as long as they are " "indented more than the key that holds them. By default parsers also let " @@ -967,7 +967,7 @@ msgid "" "lose track of the file structure. Take for instance:" msgstr "" -#: ../../library/configparser.rst:686 +#: ../../library/configparser.rst:687 msgid "" "[Section]\n" "key = multiline\n" @@ -976,7 +976,7 @@ msgid "" " this = is still a part of the multiline value of 'key'" msgstr "" -#: ../../library/configparser.rst:694 +#: ../../library/configparser.rst:695 msgid "" "This can be especially problematic for the user to see if she's using a " "proportional font to edit the file. That is why when your application does " @@ -985,13 +985,13 @@ msgid "" "would produce two keys, ``key`` and ``this``." msgstr "" -#: ../../library/configparser.rst:700 +#: ../../library/configparser.rst:701 msgid "" "*default_section*, default value: ``configparser.DEFAULTSECT`` (that is: " "``\"DEFAULT\"``)" msgstr "" -#: ../../library/configparser.rst:703 +#: ../../library/configparser.rst:704 msgid "" "The convention of allowing a special section of default values for other " "sections or interpolation purposes is a powerful concept of this library, " @@ -1005,11 +1005,11 @@ msgid "" "files from one format to another)." msgstr "" -#: ../../library/configparser.rst:714 +#: ../../library/configparser.rst:715 msgid "*interpolation*, default value: ``configparser.BasicInterpolation``" msgstr "" -#: ../../library/configparser.rst:716 +#: ../../library/configparser.rst:717 msgid "" "Interpolation behaviour may be customized by providing a custom handler " "through the *interpolation* argument. ``None`` can be used to turn off " @@ -1019,11 +1019,11 @@ msgid "" "`RawConfigParser` has a default value of ``None``." msgstr "" -#: ../../library/configparser.rst:723 +#: ../../library/configparser.rst:724 msgid "*converters*, default value: not set" msgstr "" -#: ../../library/configparser.rst:725 +#: ../../library/configparser.rst:726 msgid "" "Config parsers provide option value getters that perform type conversion. " "By default :meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat`, " @@ -1037,7 +1037,7 @@ msgid "" "``parser_instance['section'].getdecimal('key', 0)``." msgstr "" -#: ../../library/configparser.rst:736 +#: ../../library/configparser.rst:737 msgid "" "If the converter needs to access the state of the parser, it can be " "implemented as a method on a config parser subclass. If the name of this " @@ -1045,14 +1045,14 @@ msgid "" "the dict-compatible form (see the ``getdecimal()`` example above)." msgstr "" -#: ../../library/configparser.rst:741 +#: ../../library/configparser.rst:742 msgid "" "More advanced customization may be achieved by overriding default values of " "these parser attributes. The defaults are defined on the classes, so they " "may be overridden by subclasses or by attribute assignment." msgstr "" -#: ../../library/configparser.rst:747 +#: ../../library/configparser.rst:748 msgid "" "By default when using :meth:`~ConfigParser.getboolean`, config parsers " "consider the following values ``True``: ``'1'``, ``'yes'``, ``'true'``, " @@ -1061,7 +1061,7 @@ msgid "" "strings and their Boolean outcomes. For example:" msgstr "" -#: ../../library/configparser.rst:753 +#: ../../library/configparser.rst:754 msgid "" ">>> custom = configparser.ConfigParser()\n" ">>> custom['section1'] = {'funky': 'nope'}\n" @@ -1083,13 +1083,13 @@ msgstr "" ">>> custom['section1'].getboolean('funky')\n" "False" -#: ../../library/configparser.rst:765 +#: ../../library/configparser.rst:766 msgid "" "Other typical Boolean pairs include ``accept``/``reject`` or ``enabled``/" "``disabled``." msgstr "" -#: ../../library/configparser.rst:771 +#: ../../library/configparser.rst:772 msgid "" "This method transforms option names on every read, get, or set operation. " "The default converts the name to lowercase. This also means that when a " @@ -1097,7 +1097,7 @@ msgid "" "method if that's unsuitable. For example:" msgstr "" -#: ../../library/configparser.rst:777 +#: ../../library/configparser.rst:778 msgid "" ">>> config = \"\"\"\n" "... [Section1]\n" @@ -1141,14 +1141,14 @@ msgstr "" ">>> list(custom['Section2'].keys())\n" "['AnotherKey']" -#: ../../library/configparser.rst:801 +#: ../../library/configparser.rst:802 msgid "" "The optionxform function transforms option names to a canonical form. This " "should be an idempotent function: if the name is already in canonical form, " "it should be returned unchanged." msgstr "" -#: ../../library/configparser.rst:808 +#: ../../library/configparser.rst:809 msgid "" "A compiled regular expression used to parse section headers. The default " "matches ``[section]`` to the name ``\"section\"``. Whitespace is considered " @@ -1157,7 +1157,7 @@ msgid "" "example:" msgstr "" -#: ../../library/configparser.rst:814 +#: ../../library/configparser.rst:815 msgid "" ">>> import re\n" ">>> config = \"\"\"\n" @@ -1195,18 +1195,18 @@ msgstr "" ">>> custom.sections()\n" "['Section 1', 'Section 2']" -#: ../../library/configparser.rst:836 +#: ../../library/configparser.rst:837 msgid "" "While ConfigParser objects also use an ``OPTCRE`` attribute for recognizing " "option lines, it's not recommended to override it because that would " "interfere with constructor options *allow_no_value* and *delimiters*." msgstr "" -#: ../../library/configparser.rst:842 +#: ../../library/configparser.rst:843 msgid "Legacy API Examples" msgstr "" -#: ../../library/configparser.rst:844 +#: ../../library/configparser.rst:845 msgid "" "Mainly because of backwards compatibility concerns, :mod:`configparser` " "provides also a legacy API with explicit ``get``/``set`` methods. While " @@ -1215,11 +1215,11 @@ msgid "" "advanced, low-level and downright counterintuitive." msgstr "" -#: ../../library/configparser.rst:850 +#: ../../library/configparser.rst:851 msgid "An example of writing to a configuration file::" msgstr "" -#: ../../library/configparser.rst:852 +#: ../../library/configparser.rst:853 msgid "" "import configparser\n" "\n" @@ -1243,11 +1243,11 @@ msgid "" " config.write(configfile)" msgstr "" -#: ../../library/configparser.rst:873 +#: ../../library/configparser.rst:874 msgid "An example of reading the configuration file again::" msgstr "" -#: ../../library/configparser.rst:875 +#: ../../library/configparser.rst:876 msgid "" "import configparser\n" "\n" @@ -1266,11 +1266,11 @@ msgid "" " print(config.get('Section1', 'foo'))" msgstr "" -#: ../../library/configparser.rst:891 +#: ../../library/configparser.rst:892 msgid "To get interpolation, use :class:`ConfigParser`::" msgstr "" -#: ../../library/configparser.rst:893 +#: ../../library/configparser.rst:894 msgid "" "import configparser\n" "\n" @@ -1305,13 +1305,13 @@ msgid "" " # -> None" msgstr "" -#: ../../library/configparser.rst:924 +#: ../../library/configparser.rst:925 msgid "" "Default values are available in both types of ConfigParsers. They are used " "in interpolation if an option used is not defined elsewhere. ::" msgstr "" -#: ../../library/configparser.rst:927 +#: ../../library/configparser.rst:928 msgid "" "import configparser\n" "\n" @@ -1325,11 +1325,11 @@ msgid "" "print(config.get('Section1', 'foo')) # -> \"Life is hard!\"" msgstr "" -#: ../../library/configparser.rst:942 +#: ../../library/configparser.rst:943 msgid "ConfigParser Objects" msgstr "ConfigParser 物件" -#: ../../library/configparser.rst:946 +#: ../../library/configparser.rst:947 msgid "" "The main configuration parser. When *defaults* is given, it is initialized " "into the dictionary of intrinsic defaults. When *dict_type* is given, it " @@ -1337,7 +1337,7 @@ msgid "" "the options within a section, and for the default values." msgstr "" -#: ../../library/configparser.rst:951 +#: ../../library/configparser.rst:952 msgid "" "When *delimiters* is given, it is used as the set of substrings that divide " "keys from values. When *comment_prefixes* is given, it will be used as the " @@ -1346,7 +1346,7 @@ msgid "" "as the set of substrings that prefix comments in non-empty lines." msgstr "" -#: ../../library/configparser.rst:957 +#: ../../library/configparser.rst:958 msgid "" "When *strict* is ``True`` (the default), the parser won't allow for any " "section or option duplicates while reading from a single source (file, " @@ -1359,7 +1359,7 @@ msgid "" "without the trailing delimiter." msgstr "" -#: ../../library/configparser.rst:967 +#: ../../library/configparser.rst:968 msgid "" "When *default_section* is given, it specifies the name for the special " "section holding default values for other sections and interpolation purposes " @@ -1369,7 +1369,7 @@ msgid "" "settings to a new config file." msgstr "" -#: ../../library/configparser.rst:974 +#: ../../library/configparser.rst:975 msgid "" "Interpolation behaviour may be customized by providing a custom handler " "through the *interpolation* argument. ``None`` can be used to turn off " @@ -1378,7 +1378,7 @@ msgid "" "`dedicated documentation section <#interpolation-of-values>`_." msgstr "" -#: ../../library/configparser.rst:980 +#: ../../library/configparser.rst:981 msgid "" "All option names used in interpolation will be passed through the :meth:" "`optionxform` method just like any other option name reference. For " @@ -1387,7 +1387,7 @@ msgid "" "%(BAR)s`` are equivalent." msgstr "" -#: ../../library/configparser.rst:986 +#: ../../library/configparser.rst:987 msgid "" "When *converters* is given, it should be a dictionary where each key " "represents the name of a type converter and each value is a callable " @@ -1396,50 +1396,50 @@ msgid "" "object and section proxies." msgstr "" -#: ../../library/configparser.rst:1017 +#: ../../library/configparser.rst:1018 msgid "The default *dict_type* is :class:`collections.OrderedDict`." msgstr "" -#: ../../library/configparser.rst:1020 +#: ../../library/configparser.rst:1021 msgid "" "*allow_no_value*, *delimiters*, *comment_prefixes*, *strict*, " "*empty_lines_in_values*, *default_section* and *interpolation* were added." msgstr "" -#: ../../library/configparser.rst:1025 +#: ../../library/configparser.rst:1026 msgid "The *converters* argument was added." msgstr "新增 *converters* 引數。" -#: ../../library/configparser.rst:1028 +#: ../../library/configparser.rst:1029 msgid "" "The *defaults* argument is read with :meth:`read_dict`, providing consistent " "behavior across the parser: non-string keys and values are implicitly " "converted to strings." msgstr "" -#: ../../library/configparser.rst:1033 ../../library/configparser.rst:1305 +#: ../../library/configparser.rst:1034 ../../library/configparser.rst:1306 msgid "" "The default *dict_type* is :class:`dict`, since it now preserves insertion " "order." msgstr "" -#: ../../library/configparser.rst:1037 +#: ../../library/configparser.rst:1038 msgid "" "Raise a :exc:`MultilineContinuationError` when *allow_no_value* is ``True``, " "and a key without a value is continued with an indented line." msgstr "" -#: ../../library/configparser.rst:1043 +#: ../../library/configparser.rst:1044 msgid "Return a dictionary containing the instance-wide defaults." msgstr "" -#: ../../library/configparser.rst:1048 +#: ../../library/configparser.rst:1049 msgid "" "Return a list of the sections available; the *default section* is not " "included in the list." msgstr "" -#: ../../library/configparser.rst:1054 +#: ../../library/configparser.rst:1055 msgid "" "Add a section named *section* to the instance. If a section by the given " "name already exists, :exc:`DuplicateSectionError` is raised. If the " @@ -1447,34 +1447,34 @@ msgid "" "the section must be a string; if not, :exc:`TypeError` is raised." msgstr "" -#: ../../library/configparser.rst:1059 +#: ../../library/configparser.rst:1060 msgid "Non-string section names raise :exc:`TypeError`." msgstr "" -#: ../../library/configparser.rst:1065 +#: ../../library/configparser.rst:1066 msgid "" "Indicates whether the named *section* is present in the configuration. The " "*default section* is not acknowledged." msgstr "" -#: ../../library/configparser.rst:1071 +#: ../../library/configparser.rst:1072 msgid "Return a list of options available in the specified *section*." msgstr "" -#: ../../library/configparser.rst:1076 +#: ../../library/configparser.rst:1077 msgid "" "If the given *section* exists, and contains the given *option*, return :" "const:`True`; otherwise return :const:`False`. If the specified *section* " "is :const:`None` or an empty string, DEFAULT is assumed." msgstr "" -#: ../../library/configparser.rst:1083 +#: ../../library/configparser.rst:1084 msgid "" "Attempt to read and parse an iterable of filenames, returning a list of " "filenames which were successfully parsed." msgstr "" -#: ../../library/configparser.rst:1086 +#: ../../library/configparser.rst:1087 msgid "" "If *filenames* is a string, a :class:`bytes` object or a :term:`path-like " "object`, it is treated as a single filename. If a file named in *filenames* " @@ -1485,7 +1485,7 @@ msgid "" "be read." msgstr "" -#: ../../library/configparser.rst:1095 +#: ../../library/configparser.rst:1096 msgid "" "If none of the named files exist, the :class:`ConfigParser` instance will " "contain an empty dataset. An application which requires initial values to " @@ -1493,7 +1493,7 @@ msgid "" "`read_file` before calling :meth:`read` for any optional files::" msgstr "" -#: ../../library/configparser.rst:1101 +#: ../../library/configparser.rst:1102 msgid "" "import configparser, os\n" "\n" @@ -1509,49 +1509,49 @@ msgstr "" "config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')],\n" " encoding='cp1250')" -#: ../../library/configparser.rst:1108 +#: ../../library/configparser.rst:1109 msgid "" "Added the *encoding* parameter. Previously, all files were read using the " "default encoding for :func:`open`." msgstr "" -#: ../../library/configparser.rst:1112 +#: ../../library/configparser.rst:1113 msgid "The *filenames* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/configparser.rst:1115 +#: ../../library/configparser.rst:1116 msgid "The *filenames* parameter accepts a :class:`bytes` object." msgstr "" -#: ../../library/configparser.rst:1121 +#: ../../library/configparser.rst:1122 msgid "" "Read and parse configuration data from *f* which must be an iterable " "yielding Unicode strings (for example files opened in text mode)." msgstr "" -#: ../../library/configparser.rst:1124 +#: ../../library/configparser.rst:1125 msgid "" "Optional argument *source* specifies the name of the file being read. If " "not given and *f* has a :attr:`!name` attribute, that is used for *source*; " "the default is ``''``." msgstr "" -#: ../../library/configparser.rst:1128 +#: ../../library/configparser.rst:1129 msgid "Replaces :meth:`!readfp`." msgstr "取代 :meth:`!readfp`。" -#: ../../library/configparser.rst:1133 +#: ../../library/configparser.rst:1134 msgid "Parse configuration data from a string." msgstr "" -#: ../../library/configparser.rst:1135 +#: ../../library/configparser.rst:1136 msgid "" "Optional argument *source* specifies a context-specific name of the string " "passed. If not given, ``''`` is used. This should commonly be a " "filesystem path or a URL." msgstr "" -#: ../../library/configparser.rst:1144 +#: ../../library/configparser.rst:1145 msgid "" "Load configuration from any object that provides a dict-like ``items()`` " "method. Keys are section names, values are dictionaries with keys and " @@ -1560,17 +1560,17 @@ msgid "" "automatically converted to strings." msgstr "" -#: ../../library/configparser.rst:1150 +#: ../../library/configparser.rst:1151 msgid "" "Optional argument *source* specifies a context-specific name of the " "dictionary passed. If not given, ```` is used." msgstr "" -#: ../../library/configparser.rst:1153 +#: ../../library/configparser.rst:1154 msgid "This method can be used to copy state between parsers." msgstr "" -#: ../../library/configparser.rst:1160 +#: ../../library/configparser.rst:1161 msgid "" "Get an *option* value for the named *section*. If *vars* is provided, it " "must be a dictionary. The *option* is looked up in *vars* (if provided), " @@ -1579,35 +1579,35 @@ msgid "" "provided as a *fallback* value." msgstr "" -#: ../../library/configparser.rst:1166 +#: ../../library/configparser.rst:1167 msgid "" "All the ``'%'`` interpolations are expanded in the return values, unless the " "*raw* argument is true. Values for interpolation keys are looked up in the " "same manner as the option." msgstr "" -#: ../../library/configparser.rst:1170 +#: ../../library/configparser.rst:1171 msgid "" "Arguments *raw*, *vars* and *fallback* are keyword only to protect users " "from trying to use the third argument as the *fallback* fallback (especially " "when using the mapping protocol)." msgstr "" -#: ../../library/configparser.rst:1178 +#: ../../library/configparser.rst:1179 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to an integer. See :meth:`get` for explanation of *raw*, *vars* and " "*fallback*." msgstr "" -#: ../../library/configparser.rst:1185 +#: ../../library/configparser.rst:1186 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a floating-point number. See :meth:`get` for explanation of *raw*, " "*vars* and *fallback*." msgstr "" -#: ../../library/configparser.rst:1192 +#: ../../library/configparser.rst:1193 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a Boolean value. Note that the accepted values for the option are " @@ -1619,34 +1619,34 @@ msgid "" "*fallback*." msgstr "" -#: ../../library/configparser.rst:1205 +#: ../../library/configparser.rst:1206 msgid "" "When *section* is not given, return a list of *section_name*, " "*section_proxy* pairs, including DEFAULTSECT." msgstr "" -#: ../../library/configparser.rst:1208 +#: ../../library/configparser.rst:1209 msgid "" "Otherwise, return a list of *name*, *value* pairs for the options in the " "given *section*. Optional arguments have the same meaning as for the :meth:" "`get` method." msgstr "" -#: ../../library/configparser.rst:1212 +#: ../../library/configparser.rst:1213 msgid "" "Items present in *vars* no longer appear in the result. The previous " "behaviour mixed actual parser options with variables provided for " "interpolation." msgstr "" -#: ../../library/configparser.rst:1220 +#: ../../library/configparser.rst:1221 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. *option* and *value* must be " "strings; if not, :exc:`TypeError` is raised." msgstr "" -#: ../../library/configparser.rst:1227 +#: ../../library/configparser.rst:1228 msgid "" "Write a representation of the configuration to the specified :term:`file " "object`, which must be opened in text mode (accepting strings). This " @@ -1655,27 +1655,27 @@ msgid "" "surrounded by spaces." msgstr "" -#: ../../library/configparser.rst:1235 +#: ../../library/configparser.rst:1236 msgid "" "Comments in the original configuration file are not preserved when writing " "the configuration back. What is considered a comment, depends on the given " "values for *comment_prefix* and *inline_comment_prefix*." msgstr "" -#: ../../library/configparser.rst:1243 +#: ../../library/configparser.rst:1244 msgid "" "Remove the specified *option* from the specified *section*. If the section " "does not exist, raise :exc:`NoSectionError`. If the option existed to be " "removed, return :const:`True`; otherwise return :const:`False`." msgstr "" -#: ../../library/configparser.rst:1251 +#: ../../library/configparser.rst:1252 msgid "" "Remove the specified *section* from the configuration. If the section in " "fact existed, return ``True``. Otherwise return ``False``." msgstr "" -#: ../../library/configparser.rst:1257 +#: ../../library/configparser.rst:1258 msgid "" "Transforms the option name *option* as found in an input file or as passed " "in by client code to the form that should be used in the internal " @@ -1684,7 +1684,7 @@ msgid "" "of this name on instances to affect this behavior." msgstr "" -#: ../../library/configparser.rst:1263 +#: ../../library/configparser.rst:1264 msgid "" "You don't need to subclass the parser to use this method, you can also set " "it on an instance, to a function that takes a string argument and returns a " @@ -1692,7 +1692,7 @@ msgid "" "sensitive::" msgstr "" -#: ../../library/configparser.rst:1268 +#: ../../library/configparser.rst:1269 msgid "" "cfgparser = ConfigParser()\n" "cfgparser.optionxform = str" @@ -1700,30 +1700,30 @@ msgstr "" "cfgparser = ConfigParser()\n" "cfgparser.optionxform = str" -#: ../../library/configparser.rst:1271 +#: ../../library/configparser.rst:1272 msgid "" "Note that when reading configuration files, whitespace around the option " "names is stripped before :meth:`optionxform` is called." msgstr "" -#: ../../library/configparser.rst:1277 +#: ../../library/configparser.rst:1278 msgid "" "A special object representing a section name used to reference the unnamed " "section (see :ref:`unnamed-sections`)." msgstr "" -#: ../../library/configparser.rst:1282 +#: ../../library/configparser.rst:1283 msgid "" "The maximum depth for recursive interpolation for :meth:`~configparser." "ConfigParser.get` when the *raw* parameter is false. This is relevant only " "when the default *interpolation* is used." msgstr "" -#: ../../library/configparser.rst:1290 +#: ../../library/configparser.rst:1291 msgid "RawConfigParser Objects" msgstr "RawConfigParser 物件" -#: ../../library/configparser.rst:1300 +#: ../../library/configparser.rst:1301 msgid "" "Legacy variant of the :class:`ConfigParser`. It has interpolation disabled " "by default and allows for non-string section names, option names, and values " @@ -1731,27 +1731,27 @@ msgid "" "``defaults=`` keyword argument handling." msgstr "" -#: ../../library/configparser.rst:1310 +#: ../../library/configparser.rst:1311 msgid "" "Consider using :class:`ConfigParser` instead which checks types of the " "values to be stored internally. If you don't want interpolation, you can " "use ``ConfigParser(interpolation=None)``." msgstr "" -#: ../../library/configparser.rst:1317 +#: ../../library/configparser.rst:1318 msgid "" "Add a section named *section* to the instance. If a section by the given " "name already exists, :exc:`DuplicateSectionError` is raised. If the " "*default section* name is passed, :exc:`ValueError` is raised." msgstr "" -#: ../../library/configparser.rst:1321 +#: ../../library/configparser.rst:1322 msgid "" "Type of *section* is not checked which lets users create non-string named " "sections. This behaviour is unsupported and may cause internal errors." msgstr "" -#: ../../library/configparser.rst:1327 +#: ../../library/configparser.rst:1328 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. While it is possible to use :class:" @@ -1761,7 +1761,7 @@ msgid "" "string values." msgstr "" -#: ../../library/configparser.rst:1334 +#: ../../library/configparser.rst:1335 msgid "" "This method lets users assign non-string values to keys internally. This " "behaviour is unsupported and will cause errors when attempting to write to a " @@ -1769,32 +1769,32 @@ msgid "" "not allow such assignments to take place." msgstr "" -#: ../../library/configparser.rst:1341 +#: ../../library/configparser.rst:1342 msgid "Exceptions" msgstr "例外" -#: ../../library/configparser.rst:1345 +#: ../../library/configparser.rst:1346 msgid "Base class for all other :mod:`configparser` exceptions." msgstr "" -#: ../../library/configparser.rst:1350 +#: ../../library/configparser.rst:1351 msgid "Exception raised when a specified section is not found." msgstr "" -#: ../../library/configparser.rst:1355 +#: ../../library/configparser.rst:1356 msgid "" "Exception raised if :meth:`~ConfigParser.add_section` is called with the " "name of a section that is already present or in strict parsers when a " "section if found more than once in a single input file, string or dictionary." msgstr "" -#: ../../library/configparser.rst:1359 +#: ../../library/configparser.rst:1360 msgid "" "Added the optional *source* and *lineno* attributes and parameters to :meth:" "`!__init__`." msgstr "" -#: ../../library/configparser.rst:1366 +#: ../../library/configparser.rst:1367 msgid "" "Exception raised by strict parsers if a single option appears twice during " "reading from a single file, string or dictionary. This catches misspellings " @@ -1802,64 +1802,64 @@ msgid "" "representing the same case-insensitive configuration key." msgstr "" -#: ../../library/configparser.rst:1374 +#: ../../library/configparser.rst:1375 msgid "" "Exception raised when a specified option is not found in the specified " "section." msgstr "" -#: ../../library/configparser.rst:1380 +#: ../../library/configparser.rst:1381 msgid "" "Base class for exceptions raised when problems occur performing string " "interpolation." msgstr "" -#: ../../library/configparser.rst:1386 +#: ../../library/configparser.rst:1387 msgid "" "Exception raised when string interpolation cannot be completed because the " "number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass of :" "exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1393 +#: ../../library/configparser.rst:1394 msgid "" "Exception raised when an option referenced from a value does not exist. " "Subclass of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1399 +#: ../../library/configparser.rst:1400 msgid "" "Exception raised when the source text into which substitutions are made does " "not conform to the required syntax. Subclass of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1405 +#: ../../library/configparser.rst:1406 msgid "" "Exception raised when attempting to parse a file which has no section " "headers." msgstr "" -#: ../../library/configparser.rst:1411 +#: ../../library/configparser.rst:1412 msgid "Exception raised when errors occur attempting to parse a file." msgstr "" -#: ../../library/configparser.rst:1413 +#: ../../library/configparser.rst:1414 msgid "" "The ``filename`` attribute and :meth:`!__init__` constructor argument were " "removed. They have been available using the name ``source`` since 3.2." msgstr "" -#: ../../library/configparser.rst:1419 +#: ../../library/configparser.rst:1420 msgid "" "Exception raised when a key without a corresponding value is continued with " "an indented line." msgstr "" -#: ../../library/configparser.rst:1425 +#: ../../library/configparser.rst:1426 msgid "Footnotes" msgstr "註解" -#: ../../library/configparser.rst:1426 +#: ../../library/configparser.rst:1427 msgid "" "Config parsers allow for heavy customization. If you are interested in " "changing the behaviour outlined by the footnote reference, consult the " @@ -1886,14 +1886,14 @@ msgstr "ini file(ini 檔案)" msgid "Windows ini file" msgstr "Windows ini file(Windows ini 檔案)" -#: ../../library/configparser.rst:366 +#: ../../library/configparser.rst:367 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/configparser.rst:366 ../../library/configparser.rst:399 +#: ../../library/configparser.rst:367 ../../library/configparser.rst:400 msgid "interpolation in configuration files" msgstr "interpolation in configuration files(設定檔中的插值)" -#: ../../library/configparser.rst:399 +#: ../../library/configparser.rst:400 msgid "$ (dollar)" msgstr "$ (金錢符號)" diff --git a/library/ctypes.po b/library/ctypes.po index 4d41b963bb..0fb1ee514b 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-09 00:13+0000\n" "PO-Revision-Date: 2023-04-26 02:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -4065,14 +4065,14 @@ msgid "" "attribute to 0 is the same as not setting it at all." msgstr "" -#: ../../library/ctypes.rst:2545 +#: ../../library/ctypes.rst:2547 msgid "" "An optional sequence that lists the names of unnamed (anonymous) fields. :" "attr:`_anonymous_` must be already defined when :attr:`_fields_` is " "assigned, otherwise it will have no effect." msgstr "" -#: ../../library/ctypes.rst:2549 +#: ../../library/ctypes.rst:2551 msgid "" "The fields listed in this variable must be structure or union type fields. :" "mod:`ctypes` will create descriptors in the structure type that allows " @@ -4080,11 +4080,11 @@ msgid "" "structure or union field." msgstr "" -#: ../../library/ctypes.rst:2554 +#: ../../library/ctypes.rst:2556 msgid "Here is an example type (Windows)::" msgstr "" -#: ../../library/ctypes.rst:2556 +#: ../../library/ctypes.rst:2558 msgid "" "class _U(Union):\n" " _fields_ = [(\"lptdesc\", POINTER(TYPEDESC)),\n" @@ -4106,7 +4106,7 @@ msgstr "" " _fields_ = [(\"u\", _U),\n" " (\"vt\", VARTYPE)]" -#: ../../library/ctypes.rst:2567 +#: ../../library/ctypes.rst:2569 msgid "" "The ``TYPEDESC`` structure describes a COM data type, the ``vt`` field " "specifies which one of the union fields is valid. Since the ``u`` field is " @@ -4116,7 +4116,7 @@ msgid "" "temporary union instance::" msgstr "" -#: ../../library/ctypes.rst:2574 +#: ../../library/ctypes.rst:2576 msgid "" "td = TYPEDESC()\n" "td.vt = VT_PTR\n" @@ -4128,7 +4128,7 @@ msgstr "" "td.lptdesc = POINTER(some_type)\n" "td.u.lptdesc = POINTER(some_type)" -#: ../../library/ctypes.rst:2579 +#: ../../library/ctypes.rst:2581 msgid "" "It is possible to define sub-subclasses of structures, they inherit the " "fields of the base class. If the subclass definition has a separate :attr:" @@ -4136,7 +4136,7 @@ msgid "" "of the base class." msgstr "" -#: ../../library/ctypes.rst:2584 +#: ../../library/ctypes.rst:2586 msgid "" "Structure and union constructors accept both positional and keyword " "arguments. Positional arguments are used to initialize member fields in the " @@ -4146,15 +4146,15 @@ msgid "" "names not present in :attr:`_fields_`." msgstr "" -#: ../../library/ctypes.rst:2595 +#: ../../library/ctypes.rst:2597 msgid "Arrays and pointers" msgstr "" -#: ../../library/ctypes.rst:2599 +#: ../../library/ctypes.rst:2601 msgid "Abstract base class for arrays." msgstr "" -#: ../../library/ctypes.rst:2601 +#: ../../library/ctypes.rst:2603 msgid "" "The recommended way to create concrete array types is by multiplying any :" "mod:`ctypes` data type with a non-negative integer. Alternatively, you can " @@ -4164,46 +4164,46 @@ msgid "" "an :class:`Array`." msgstr "" -#: ../../library/ctypes.rst:2611 +#: ../../library/ctypes.rst:2613 msgid "" "A positive integer specifying the number of elements in the array. Out-of-" "range subscripts result in an :exc:`IndexError`. Will be returned by :func:" "`len`." msgstr "" -#: ../../library/ctypes.rst:2618 +#: ../../library/ctypes.rst:2620 msgid "Specifies the type of each element in the array." msgstr "" -#: ../../library/ctypes.rst:2621 +#: ../../library/ctypes.rst:2623 msgid "" "Array subclass constructors accept positional arguments, used to initialize " "the elements in order." msgstr "" -#: ../../library/ctypes.rst:2626 +#: ../../library/ctypes.rst:2628 msgid "" "Create an array. Equivalent to ``type * length``, where *type* is a :mod:" "`ctypes` data type and *length* an integer." msgstr "" -#: ../../library/ctypes.rst:2630 +#: ../../library/ctypes.rst:2632 msgid "" "This function is :term:`soft deprecated` in favor of multiplication. There " "are no plans to remove it." msgstr "" -#: ../../library/ctypes.rst:2636 +#: ../../library/ctypes.rst:2638 msgid "Private, abstract base class for pointers." msgstr "" -#: ../../library/ctypes.rst:2638 +#: ../../library/ctypes.rst:2640 msgid "" "Concrete pointer types are created by calling :func:`POINTER` with the type " "that will be pointed to; this is done automatically by :func:`pointer`." msgstr "" -#: ../../library/ctypes.rst:2642 +#: ../../library/ctypes.rst:2644 msgid "" "If a pointer points to an array, its elements can be read and written using " "standard subscript and slice accesses. Pointer objects have no size, so :" @@ -4212,11 +4212,11 @@ msgid "" "probably crash with an access violation (if you're lucky)." msgstr "" -#: ../../library/ctypes.rst:2652 +#: ../../library/ctypes.rst:2654 msgid "Specifies the type pointed to." msgstr "" -#: ../../library/ctypes.rst:2656 +#: ../../library/ctypes.rst:2658 msgid "" "Returns the object to which to pointer points. Assigning to this attribute " "changes the pointer to point to the assigned object." diff --git a/library/curses.po b/library/curses.po index 0640ee51c5..669c6cc5dc 100644 --- a/library/curses.po +++ b/library/curses.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,8 +41,8 @@ msgid "" msgstr "" #: ../../includes/wasm-mobile-notavail.rst:3 -msgid ":ref:`Availability `: not Android, not iOS, not WASI." -msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-mobile-notavail.rst:5 msgid "" diff --git a/library/datetime.po b/library/datetime.po index 21b3d8a2d7..5fcda8bc81 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-04 00:13+0000\n" +"POT-Creation-Date: 2024-10-15 00:14+0000\n" "PO-Revision-Date: 2023-08-07 10:20+0800\n" "Last-Translator: Griiid \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -270,7 +270,8 @@ msgid "" msgstr "" #: ../../library/datetime.rst:183 -msgid "A :class:`.datetime` object *d* is aware if both of the following hold:" +msgid "" +"A :class:`.datetime` object ``d`` is aware if both of the following hold:" msgstr "" #: ../../library/datetime.rst:185 @@ -282,11 +283,11 @@ msgid "``d.tzinfo.utcoffset(d)`` does not return ``None``" msgstr "``d.tzinfo.utcoffset(d)`` 不會回傳 ``None``" #: ../../library/datetime.rst:188 -msgid "Otherwise, *d* is naive." -msgstr "否則 *d* 會是 naive 的。" +msgid "Otherwise, ``d`` is naive." +msgstr "否則 ``d`` 會是 naive 的。" #: ../../library/datetime.rst:190 -msgid "A :class:`.time` object *t* is aware if both of the following hold:" +msgid "A :class:`.time` object ``t`` is aware if both of the following hold:" msgstr "" #: ../../library/datetime.rst:192 @@ -298,8 +299,8 @@ msgid "``t.tzinfo.utcoffset(None)`` does not return ``None``." msgstr "``t.tzinfo.utcoffset(None)`` 沒有回傳 ``None``。" #: ../../library/datetime.rst:195 -msgid "Otherwise, *t* is naive." -msgstr "" +msgid "Otherwise, ``t`` is naive." +msgstr "否則 ``t`` 會是 naive 的。" #: ../../library/datetime.rst:197 msgid "" @@ -423,8 +424,8 @@ msgstr "" "(-1, 86399, 999999)" #: ../../library/datetime.rst:265 ../../library/datetime.rst:566 -#: ../../library/datetime.rst:1122 ../../library/datetime.rst:1760 -#: ../../library/datetime.rst:2365 +#: ../../library/datetime.rst:1126 ../../library/datetime.rst:1764 +#: ../../library/datetime.rst:2369 msgid "Class attributes:" msgstr "類別屬性:" @@ -452,7 +453,7 @@ msgid "" msgstr "" #: ../../library/datetime.rst:287 ../../library/datetime.rst:584 -#: ../../library/datetime.rst:1142 ../../library/datetime.rst:1780 +#: ../../library/datetime.rst:1146 ../../library/datetime.rst:1784 msgid "Instance attributes (read-only):" msgstr "" @@ -492,17 +493,17 @@ msgid "Between 0 and 999,999 inclusive." msgstr "在 0 到 999,999 (含)之間" #: ../../library/datetime.rst:318 ../../library/datetime.rst:601 -#: ../../library/datetime.rst:1195 +#: ../../library/datetime.rst:1199 msgid "Supported operations:" msgstr "" #: ../../library/datetime.rst:323 ../../library/datetime.rst:604 -#: ../../library/datetime.rst:1198 +#: ../../library/datetime.rst:1202 msgid "Operation" msgstr "" #: ../../library/datetime.rst:323 ../../library/datetime.rst:604 -#: ../../library/datetime.rst:1198 +#: ../../library/datetime.rst:1202 msgid "Result" msgstr "" @@ -595,7 +596,7 @@ msgstr "``q, r = divmod(t1, t2)``" #: ../../library/datetime.rst:359 msgid "" "Computes the quotient and the remainder: ``q = t1 // t2`` (3) and ``r = t1 % " -"t2``. q is an integer and r is a :class:`timedelta` object." +"t2``. ``q`` is an integer and ``r`` is a :class:`timedelta` object." msgstr "" #: ../../library/datetime.rst:364 @@ -615,6 +616,8 @@ msgid "" "Equivalent to ``timedelta(-t1.days, -t1.seconds, -t1.microseconds)``, and to " "``t1 * -1``. (1)(4)" msgstr "" +"等價於 ``timedelta(-t1.days, -t1.seconds, -t1.microseconds)``,也等價於 ``t1 " +"* -1``。 (1)(4)" #: ../../library/datetime.rst:371 msgid "``abs(t)``" @@ -647,7 +650,7 @@ msgid "" msgstr "" #: ../../library/datetime.rst:384 ../../library/datetime.rst:623 -#: ../../library/datetime.rst:2596 +#: ../../library/datetime.rst:2600 msgid "Notes:" msgstr "註解:" @@ -719,7 +722,7 @@ msgid "" msgstr "" #: ../../library/datetime.rst:428 ../../library/datetime.rst:665 -#: ../../library/datetime.rst:1285 ../../library/datetime.rst:1887 +#: ../../library/datetime.rst:1289 ../../library/datetime.rst:1891 msgid "Instance methods:" msgstr "實例方法:" @@ -876,7 +879,7 @@ msgstr "" #: ../../library/datetime.rst:528 msgid "" ":exc:`ValueError` is raised unless ``1 <= ordinal <= date.max.toordinal()``. " -"For any date *d*, ``date.fromordinal(d.toordinal()) == d``." +"For any date ``d``, ``date.fromordinal(d.toordinal()) == d``." msgstr "" #: ../../library/datetime.rst:535 @@ -885,23 +888,23 @@ msgid "" "ISO 8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:538 ../../library/datetime.rst:1044 +#: ../../library/datetime.rst:538 ../../library/datetime.rst:1048 msgid "" "Reduced precision dates are not currently supported (``YYYY-MM``, ``YYYY``)." msgstr "" -#: ../../library/datetime.rst:540 ../../library/datetime.rst:1046 +#: ../../library/datetime.rst:540 ../../library/datetime.rst:1050 msgid "" "Extended date representations are not currently supported (``±YYYYYY-MM-" "DD``)." msgstr "" -#: ../../library/datetime.rst:542 ../../library/datetime.rst:1048 +#: ../../library/datetime.rst:542 ../../library/datetime.rst:1052 msgid "Ordinal dates are not currently supported (``YYYY-OOO``)." msgstr "" -#: ../../library/datetime.rst:544 ../../library/datetime.rst:1050 -#: ../../library/datetime.rst:1516 +#: ../../library/datetime.rst:544 ../../library/datetime.rst:1054 +#: ../../library/datetime.rst:1520 msgid "Examples::" msgstr "範例: ::" @@ -948,15 +951,15 @@ msgid "" "``timedelta(days=1)``." msgstr "" -#: ../../library/datetime.rst:588 ../../library/datetime.rst:1146 +#: ../../library/datetime.rst:588 ../../library/datetime.rst:1150 msgid "Between :const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -#: ../../library/datetime.rst:593 ../../library/datetime.rst:1151 +#: ../../library/datetime.rst:593 ../../library/datetime.rst:1155 msgid "Between 1 and 12 inclusive." msgstr "在 1 到 12 (含)之間。" -#: ../../library/datetime.rst:598 ../../library/datetime.rst:1156 +#: ../../library/datetime.rst:598 ../../library/datetime.rst:1160 msgid "Between 1 and the number of days in the given month of the given year." msgstr "" @@ -980,7 +983,7 @@ msgstr "" msgid "``timedelta = date1 - date2``" msgstr "``timedelta = date1 - date2``" -#: ../../library/datetime.rst:612 ../../library/datetime.rst:1204 +#: ../../library/datetime.rst:612 ../../library/datetime.rst:1208 msgid "\\(3)" msgstr "\\(3)" @@ -992,7 +995,7 @@ msgstr "``date1 == date2``" msgid "``date1 != date2``" msgstr "``date1 != date2``" -#: ../../library/datetime.rst:614 ../../library/datetime.rst:1206 +#: ../../library/datetime.rst:614 ../../library/datetime.rst:1210 msgid "Equality comparison. (4)" msgstr "" @@ -1012,7 +1015,7 @@ msgstr "``date1 <= date2``" msgid "``date1 >= date2``" msgstr "``date1 >= date2``" -#: ../../library/datetime.rst:617 ../../library/datetime.rst:1209 +#: ../../library/datetime.rst:617 ../../library/datetime.rst:1213 msgid "Order comparison. (5)" msgstr "" @@ -1059,7 +1062,7 @@ msgid "" "datetime` instance and a :class:`!datetime` object raises :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:655 ../../library/datetime.rst:1277 +#: ../../library/datetime.rst:655 ../../library/datetime.rst:1281 msgid "" "Comparison between :class:`.datetime` object and an instance of the :class:" "`date` subclass that is not a :class:`!datetime` subclass no longer converts " @@ -1079,7 +1082,7 @@ msgid "" "values by whichever keyword arguments are specified." msgstr "" -#: ../../library/datetime.rst:672 ../../library/datetime.rst:1933 +#: ../../library/datetime.rst:672 ../../library/datetime.rst:1937 msgid "Example::" msgstr "範例: ::" @@ -1101,7 +1104,7 @@ msgid "" "replace`." msgstr "" -#: ../../library/datetime.rst:685 ../../library/datetime.rst:1401 +#: ../../library/datetime.rst:685 ../../library/datetime.rst:1405 msgid "" "Return a :class:`time.struct_time` such as returned by :func:`time." "localtime`." @@ -1112,7 +1115,7 @@ msgstr "" msgid "The hours, minutes and seconds are 0, and the DST flag is -1." msgstr "" -#: ../../library/datetime.rst:689 ../../library/datetime.rst:1403 +#: ../../library/datetime.rst:689 ../../library/datetime.rst:1407 msgid "``d.timetuple()`` is equivalent to::" msgstr "``d.timetuple()`` 等價於: ::" @@ -1131,7 +1134,7 @@ msgstr "" #: ../../library/datetime.rst:699 msgid "" "Return the proleptic Gregorian ordinal of the date, where January 1 of year " -"1 has ordinal 1. For any :class:`date` object *d*, ``date.fromordinal(d." +"1 has ordinal 1. For any :class:`date` object ``d``, ``date.fromordinal(d." "toordinal()) == d``." msgstr "" @@ -1211,7 +1214,7 @@ msgstr "" "'2002-12-04'" #: ../../library/datetime.rst:752 -msgid "For a date *d*, ``str(d)`` is equivalent to ``d.isoformat()``." +msgid "For a date ``d``, ``str(d)`` is equivalent to ``d.isoformat()``." msgstr "" #: ../../library/datetime.rst:757 @@ -1228,11 +1231,11 @@ msgstr "" ">>> date(2002, 12, 4).ctime()\n" "'Wed Dec 4 00:00:00 2002'" -#: ../../library/datetime.rst:763 ../../library/datetime.rst:1587 +#: ../../library/datetime.rst:763 ../../library/datetime.rst:1591 msgid "``d.ctime()`` is equivalent to::" msgstr "``d.ctime()`` 等價於: ::" -#: ../../library/datetime.rst:765 ../../library/datetime.rst:1589 +#: ../../library/datetime.rst:765 ../../library/datetime.rst:1593 msgid "time.ctime(time.mktime(d.timetuple()))" msgstr "time.ctime(time.mktime(d.timetuple()))" @@ -1392,28 +1395,28 @@ msgstr "``1 <= month <= 12``," msgid "``1 <= day <= number of days in the given month and year``," msgstr "" -#: ../../library/datetime.rst:877 ../../library/datetime.rst:1751 +#: ../../library/datetime.rst:877 ../../library/datetime.rst:1755 msgid "``0 <= hour < 24``," msgstr "``0 <= hour < 24``," -#: ../../library/datetime.rst:878 ../../library/datetime.rst:1752 +#: ../../library/datetime.rst:878 ../../library/datetime.rst:1756 msgid "``0 <= minute < 60``," msgstr "``0 <= minute < 60``," -#: ../../library/datetime.rst:879 ../../library/datetime.rst:1753 +#: ../../library/datetime.rst:879 ../../library/datetime.rst:1757 msgid "``0 <= second < 60``," msgstr "``0 <= second < 60``," -#: ../../library/datetime.rst:880 ../../library/datetime.rst:1754 +#: ../../library/datetime.rst:880 ../../library/datetime.rst:1758 msgid "``0 <= microsecond < 1000000``," msgstr "``0 <= microsecond < 1000000``," -#: ../../library/datetime.rst:881 ../../library/datetime.rst:1755 +#: ../../library/datetime.rst:881 ../../library/datetime.rst:1759 msgid "``fold in [0, 1]``." msgstr "" -#: ../../library/datetime.rst:885 ../../library/datetime.rst:1322 -#: ../../library/datetime.rst:1900 +#: ../../library/datetime.rst:885 ../../library/datetime.rst:1326 +#: ../../library/datetime.rst:1904 msgid "Added the *fold* parameter." msgstr "新增 *fold* 參數。" @@ -1464,18 +1467,24 @@ msgstr "" msgid "This function is preferred over :meth:`today` and :meth:`utcnow`." msgstr "" -#: ../../library/datetime.rst:921 +#: ../../library/datetime.rst:920 +msgid "" +"Subsequent calls to :meth:`!datetime.now` may return the same instant " +"depending on the precision of the underlying clock." +msgstr "" + +#: ../../library/datetime.rst:925 msgid "Return the current UTC date and time, with :attr:`.tzinfo` ``None``." msgstr "" -#: ../../library/datetime.rst:923 +#: ../../library/datetime.rst:927 msgid "" "This is like :meth:`now`, but returns the current UTC date and time, as a " "naive :class:`.datetime` object. An aware current UTC datetime can be " "obtained by calling ``datetime.now(timezone.utc)``. See also :meth:`now`." msgstr "" -#: ../../library/datetime.rst:929 +#: ../../library/datetime.rst:933 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -1483,11 +1492,11 @@ msgid "" "current time in UTC is by calling ``datetime.now(timezone.utc)``." msgstr "" -#: ../../library/datetime.rst:936 +#: ../../library/datetime.rst:940 msgid "Use :meth:`datetime.now` with :attr:`UTC` instead." msgstr "" -#: ../../library/datetime.rst:941 +#: ../../library/datetime.rst:945 msgid "" "Return the local date and time corresponding to the POSIX timestamp, such as " "is returned by :func:`time.time`. If optional argument *tz* is ``None`` or " @@ -1495,13 +1504,13 @@ msgid "" "time, and the returned :class:`.datetime` object is naive." msgstr "" -#: ../../library/datetime.rst:946 +#: ../../library/datetime.rst:950 msgid "" "If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` " "subclass, and the timestamp is converted to *tz*’s time zone." msgstr "" -#: ../../library/datetime.rst:949 +#: ../../library/datetime.rst:953 msgid "" ":meth:`fromtimestamp` may raise :exc:`OverflowError`, if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -1514,7 +1523,7 @@ msgid "" "preferred over :meth:`utcfromtimestamp`." msgstr "" -#: ../../library/datetime.rst:960 +#: ../../library/datetime.rst:964 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -1522,17 +1531,17 @@ msgid "" "`ValueError` on :c:func:`localtime` or :c:func:`gmtime` failure." msgstr "" -#: ../../library/datetime.rst:967 +#: ../../library/datetime.rst:971 msgid ":meth:`fromtimestamp` may return instances with :attr:`.fold` set to 1." msgstr "" -#: ../../library/datetime.rst:972 +#: ../../library/datetime.rst:976 msgid "" "Return the UTC :class:`.datetime` corresponding to the POSIX timestamp, " "with :attr:`.tzinfo` ``None``. (The resulting object is naive.)" msgstr "" -#: ../../library/datetime.rst:975 +#: ../../library/datetime.rst:979 msgid "" "This may raise :exc:`OverflowError`, if the timestamp is out of the range of " "values supported by the platform C :c:func:`gmtime` function, and :exc:" @@ -1540,33 +1549,33 @@ msgid "" "to years in 1970 through 2038." msgstr "" -#: ../../library/datetime.rst:980 +#: ../../library/datetime.rst:984 msgid "To get an aware :class:`.datetime` object, call :meth:`fromtimestamp`::" msgstr "" -#: ../../library/datetime.rst:982 +#: ../../library/datetime.rst:986 msgid "datetime.fromtimestamp(timestamp, timezone.utc)" msgstr "datetime.fromtimestamp(timestamp, timezone.utc)" -#: ../../library/datetime.rst:984 +#: ../../library/datetime.rst:988 msgid "" "On the POSIX compliant platforms, it is equivalent to the following " "expression::" msgstr "" -#: ../../library/datetime.rst:987 +#: ../../library/datetime.rst:991 msgid "" "datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" msgstr "" "datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" -#: ../../library/datetime.rst:989 +#: ../../library/datetime.rst:993 msgid "" "except the latter formula always supports the full years range: between :" "const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -#: ../../library/datetime.rst:994 +#: ../../library/datetime.rst:998 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -1575,7 +1584,7 @@ msgid "" "tz=timezone.utc)``." msgstr "" -#: ../../library/datetime.rst:1000 +#: ../../library/datetime.rst:1004 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`gmtime` " @@ -1583,11 +1592,11 @@ msgid "" "`gmtime` failure." msgstr "" -#: ../../library/datetime.rst:1008 +#: ../../library/datetime.rst:1012 msgid "Use :meth:`datetime.fromtimestamp` with :attr:`UTC` instead." msgstr "" -#: ../../library/datetime.rst:1013 +#: ../../library/datetime.rst:1017 msgid "" "Return the :class:`.datetime` corresponding to the proleptic Gregorian " "ordinal, where January 1 of year 1 has ordinal 1. :exc:`ValueError` is " @@ -1596,7 +1605,7 @@ msgid "" "is ``None``." msgstr "" -#: ../../library/datetime.rst:1021 +#: ../../library/datetime.rst:1025 msgid "" "Return a new :class:`.datetime` object whose date components are equal to " "the given :class:`date` object's, and whose time components are equal to the " @@ -1607,35 +1616,35 @@ msgid "" "attr:`.tzinfo` attributes are ignored." msgstr "" -#: ../../library/datetime.rst:1029 +#: ../../library/datetime.rst:1033 msgid "" -"For any :class:`.datetime` object *d*, ``d == datetime.combine(d.date(), d." +"For any :class:`.datetime` object ``d``, ``d == datetime.combine(d.date(), d." "time(), d.tzinfo)``." msgstr "" -#: ../../library/datetime.rst:1032 +#: ../../library/datetime.rst:1036 msgid "Added the *tzinfo* argument." msgstr "新增 *tzinfo* 引數。" -#: ../../library/datetime.rst:1038 +#: ../../library/datetime.rst:1042 msgid "" "Return a :class:`.datetime` corresponding to a *date_string* in any valid " "ISO 8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:1041 ../../library/datetime.rst:1851 +#: ../../library/datetime.rst:1045 ../../library/datetime.rst:1855 msgid "Time zone offsets may have fractional seconds." msgstr "" -#: ../../library/datetime.rst:1042 +#: ../../library/datetime.rst:1046 msgid "The ``T`` separator may be replaced by any single unicode character." msgstr "" -#: ../../library/datetime.rst:1043 ../../library/datetime.rst:1856 +#: ../../library/datetime.rst:1047 ../../library/datetime.rst:1860 msgid "Fractional hours and minutes are not supported." msgstr "" -#: ../../library/datetime.rst:1052 +#: ../../library/datetime.rst:1056 msgid "" ">>> from datetime import datetime\n" ">>> datetime.fromisoformat('2011-11-04')\n" @@ -1681,13 +1690,13 @@ msgstr "" "datetime.datetime(2011, 11, 4, 0, 5, 23,\n" " tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))" -#: ../../library/datetime.rst:1074 +#: ../../library/datetime.rst:1078 msgid "" "Previously, this method only supported formats that could be emitted by :" "meth:`date.isoformat` or :meth:`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1081 +#: ../../library/datetime.rst:1085 msgid "" "Return a :class:`.datetime` corresponding to the ISO calendar date specified " "by year, week and day. The non-date components of the datetime are populated " @@ -1695,23 +1704,23 @@ msgid "" "`datetime.isocalendar`." msgstr "" -#: ../../library/datetime.rst:1090 +#: ../../library/datetime.rst:1094 msgid "" "Return a :class:`.datetime` corresponding to *date_string*, parsed according " "to *format*." msgstr "" -#: ../../library/datetime.rst:1093 +#: ../../library/datetime.rst:1097 msgid "" "If *format* does not contain microseconds or time zone information, this is " "equivalent to::" msgstr "" -#: ../../library/datetime.rst:1095 ../../library/datetime.rst:2576 +#: ../../library/datetime.rst:1099 ../../library/datetime.rst:2580 msgid "datetime(*(time.strptime(date_string, format)[0:6]))" msgstr "datetime(*(time.strptime(date_string, format)[0:6]))" -#: ../../library/datetime.rst:1097 +#: ../../library/datetime.rst:1101 msgid "" ":exc:`ValueError` is raised if the date_string and format can't be parsed " "by :func:`time.strptime` or if it returns a value which isn't a time tuple. " @@ -1719,7 +1728,7 @@ msgid "" "fromisoformat`." msgstr "" -#: ../../library/datetime.rst:1104 +#: ../../library/datetime.rst:1108 msgid "" "If *format* specifies a day of month without a year a :exc:" "`DeprecationWarning` is now emitted. This is to avoid a quadrennial leap " @@ -1730,7 +1739,7 @@ msgid "" "not have a year, explicitly add a year that is a leap year before parsing:" msgstr "" -#: ../../library/datetime.rst:1113 +#: ../../library/datetime.rst:1117 msgid "" ">>> from datetime import datetime\n" ">>> date_string = \"02/29\"\n" @@ -1740,44 +1749,44 @@ msgid "" "'February 29'" msgstr "" -#: ../../library/datetime.rst:1126 +#: ../../library/datetime.rst:1130 msgid "" "The earliest representable :class:`.datetime`, ``datetime(MINYEAR, 1, 1, " "tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1132 +#: ../../library/datetime.rst:1136 msgid "" "The latest representable :class:`.datetime`, ``datetime(MAXYEAR, 12, 31, 23, " "59, 59, 999999, tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1138 +#: ../../library/datetime.rst:1142 msgid "" "The smallest possible difference between non-equal :class:`.datetime` " "objects, ``timedelta(microseconds=1)``." msgstr "" -#: ../../library/datetime.rst:1161 ../../library/datetime.rst:1784 +#: ../../library/datetime.rst:1165 ../../library/datetime.rst:1788 msgid "In ``range(24)``." msgstr "" -#: ../../library/datetime.rst:1166 ../../library/datetime.rst:1171 -#: ../../library/datetime.rst:1789 ../../library/datetime.rst:1794 +#: ../../library/datetime.rst:1170 ../../library/datetime.rst:1175 +#: ../../library/datetime.rst:1793 ../../library/datetime.rst:1798 msgid "In ``range(60)``." msgstr "" -#: ../../library/datetime.rst:1176 ../../library/datetime.rst:1799 +#: ../../library/datetime.rst:1180 ../../library/datetime.rst:1803 msgid "In ``range(1000000)``." msgstr "" -#: ../../library/datetime.rst:1181 +#: ../../library/datetime.rst:1185 msgid "" "The object passed as the *tzinfo* argument to the :class:`.datetime` " "constructor, or ``None`` if none was passed." msgstr "" -#: ../../library/datetime.rst:1187 ../../library/datetime.rst:1810 +#: ../../library/datetime.rst:1191 ../../library/datetime.rst:1814 msgid "" "In ``[0, 1]``. Used to disambiguate wall times during a repeated interval. " "(A repeated interval occurs when clocks are rolled back at the end of " @@ -1787,26 +1796,26 @@ msgid "" "time representation." msgstr "" -#: ../../library/datetime.rst:1200 +#: ../../library/datetime.rst:1204 msgid "``datetime2 = datetime1 + timedelta``" msgstr "``datetime2 = datetime1 + timedelta``" -#: ../../library/datetime.rst:1200 ../../library/datetime.rst:2423 -#: ../../library/datetime.rst:2428 ../../library/datetime.rst:2440 -#: ../../library/datetime.rst:2445 ../../library/datetime.rst:2505 -#: ../../library/datetime.rst:2510 ../../library/datetime.rst:2514 +#: ../../library/datetime.rst:1204 ../../library/datetime.rst:2427 +#: ../../library/datetime.rst:2432 ../../library/datetime.rst:2444 +#: ../../library/datetime.rst:2449 ../../library/datetime.rst:2509 +#: ../../library/datetime.rst:2514 ../../library/datetime.rst:2518 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/datetime.rst:1202 +#: ../../library/datetime.rst:1206 msgid "``datetime2 = datetime1 - timedelta``" msgstr "``datetime2 = datetime1 - timedelta``" -#: ../../library/datetime.rst:1202 ../../library/datetime.rst:2456 +#: ../../library/datetime.rst:1206 ../../library/datetime.rst:2460 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/datetime.rst:1204 +#: ../../library/datetime.rst:1208 msgid "``timedelta = datetime1 - datetime2``" msgstr "``timedelta = datetime1 - datetime2``" @@ -1834,7 +1843,7 @@ msgstr "``datetime1 <= datetime2``" msgid "``datetime1 >= datetime2``" msgstr "``datetime1 >= datetime2``" -#: ../../library/datetime.rst:1216 +#: ../../library/datetime.rst:1220 msgid "" "``datetime2`` is a duration of ``timedelta`` removed from ``datetime1``, " "moving forward in time if ``timedelta.days > 0``, or backward if ``timedelta." @@ -1845,7 +1854,7 @@ msgid "" "adjustments are done even if the input is an aware object." msgstr "" -#: ../../library/datetime.rst:1225 +#: ../../library/datetime.rst:1229 msgid "" "Computes the ``datetime2`` such that ``datetime2 + timedelta == datetime1``. " "As for addition, the result has the same :attr:`~.datetime.tzinfo` attribute " @@ -1853,41 +1862,41 @@ msgid "" "input is aware." msgstr "" -#: ../../library/datetime.rst:1230 +#: ../../library/datetime.rst:1234 msgid "" "Subtraction of a :class:`.datetime` from a :class:`.datetime` is defined " "only if both operands are naive, or if both are aware. If one is aware and " "the other is naive, :exc:`TypeError` is raised." msgstr "" -#: ../../library/datetime.rst:1234 +#: ../../library/datetime.rst:1238 msgid "" "If both are naive, or both are aware and have the same :attr:`~.datetime." "tzinfo` attribute, the :attr:`~.datetime.tzinfo` attributes are ignored, and " -"the result is a :class:`timedelta` object *t* such that ``datetime2 + t == " +"the result is a :class:`timedelta` object ``t`` such that ``datetime2 + t == " "datetime1``. No time zone adjustments are done in this case." msgstr "" -#: ../../library/datetime.rst:1239 +#: ../../library/datetime.rst:1243 msgid "" "If both are aware and have different :attr:`~.datetime.tzinfo` attributes, " -"``a-b`` acts as if *a* and *b* were first converted to naive UTC datetimes. " -"The result is ``(a.replace(tzinfo=None) - a.utcoffset()) - (b." +"``a-b`` acts as if ``a`` and ``b`` were first converted to naive UTC " +"datetimes. The result is ``(a.replace(tzinfo=None) - a.utcoffset()) - (b." "replace(tzinfo=None) - b.utcoffset())`` except that the implementation never " "overflows." msgstr "" -#: ../../library/datetime.rst:1245 +#: ../../library/datetime.rst:1249 msgid "" ":class:`.datetime` objects are equal if they represent the same date and " "time, taking into account the time zone." msgstr "" -#: ../../library/datetime.rst:1248 +#: ../../library/datetime.rst:1252 msgid "Naive and aware :class:`!datetime` objects are never equal." msgstr "" -#: ../../library/datetime.rst:1250 +#: ../../library/datetime.rst:1254 msgid "" "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " "the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " @@ -1898,19 +1907,19 @@ msgid "" "interval are never equal to :class:`!datetime` instances in other time zone." msgstr "" -#: ../../library/datetime.rst:1260 +#: ../../library/datetime.rst:1264 msgid "" "*datetime1* is considered less than *datetime2* when *datetime1* precedes " "*datetime2* in time, taking into account the time zone." msgstr "" -#: ../../library/datetime.rst:1263 +#: ../../library/datetime.rst:1267 msgid "" "Order comparison between naive and aware :class:`.datetime` objects raises :" "exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1266 +#: ../../library/datetime.rst:1270 msgid "" "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " "the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " @@ -1920,33 +1929,33 @@ msgid "" "implementation never overflows." msgstr "" -#: ../../library/datetime.rst:1273 +#: ../../library/datetime.rst:1277 msgid "" "Equality comparisons between aware and naive :class:`.datetime` instances " "don't raise :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1289 +#: ../../library/datetime.rst:1293 msgid "Return :class:`date` object with same year, month and day." msgstr "" -#: ../../library/datetime.rst:1294 +#: ../../library/datetime.rst:1298 msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond and " "fold. :attr:`.tzinfo` is ``None``. See also method :meth:`timetz`." msgstr "" -#: ../../library/datetime.rst:1297 ../../library/datetime.rst:1306 +#: ../../library/datetime.rst:1301 ../../library/datetime.rst:1310 msgid "The fold value is copied to the returned :class:`.time` object." msgstr "" -#: ../../library/datetime.rst:1303 +#: ../../library/datetime.rst:1307 msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond, " "fold, and tzinfo attributes. See also method :meth:`time`." msgstr "" -#: ../../library/datetime.rst:1314 +#: ../../library/datetime.rst:1318 msgid "" "Return a datetime with the same attributes, except for those attributes " "given new values by whichever keyword arguments are specified. Note that " @@ -1954,27 +1963,27 @@ msgid "" "datetime with no conversion of date and time data." msgstr "" -#: ../../library/datetime.rst:1319 +#: ../../library/datetime.rst:1323 msgid "" ":class:`.datetime` objects are also supported by generic function :func:" "`copy.replace`." msgstr "" -#: ../../library/datetime.rst:1328 +#: ../../library/datetime.rst:1332 msgid "" "Return a :class:`.datetime` object with new :attr:`.tzinfo` attribute *tz*, " "adjusting the date and time data so the result is the same UTC time as " "*self*, but in *tz*'s local time." msgstr "" -#: ../../library/datetime.rst:1332 +#: ../../library/datetime.rst:1336 msgid "" "If provided, *tz* must be an instance of a :class:`tzinfo` subclass, and " "its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. If " "*self* is naive, it is presumed to represent time in the system time zone." msgstr "" -#: ../../library/datetime.rst:1336 +#: ../../library/datetime.rst:1340 msgid "" "If called without arguments (or with ``tz=None``) the system local time zone " "is assumed for the target time zone. The ``.tzinfo`` attribute of the " @@ -1982,7 +1991,7 @@ msgid "" "with the zone name and offset obtained from the OS." msgstr "" -#: ../../library/datetime.rst:1341 +#: ../../library/datetime.rst:1345 msgid "" "If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no " "adjustment of date or time data is performed. Else the result is local time " @@ -1991,7 +2000,7 @@ msgid "" "date and time data as ``dt - dt.utcoffset()``." msgstr "" -#: ../../library/datetime.rst:1347 +#: ../../library/datetime.rst:1351 msgid "" "If you merely want to attach a :class:`timezone` object *tz* to a datetime " "*dt* without adjustment of date and time data, use ``dt." @@ -2000,14 +2009,14 @@ msgid "" "use ``dt.replace(tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1352 +#: ../../library/datetime.rst:1356 msgid "" "Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :" "class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. " "Ignoring error cases, :meth:`astimezone` acts like::" msgstr "" -#: ../../library/datetime.rst:1356 +#: ../../library/datetime.rst:1360 msgid "" "def astimezone(self, tz):\n" " if self.tzinfo is tz:\n" @@ -2018,49 +2027,49 @@ msgid "" " return tz.fromutc(utc)" msgstr "" -#: ../../library/datetime.rst:1364 +#: ../../library/datetime.rst:1368 msgid "*tz* now can be omitted." msgstr "" -#: ../../library/datetime.rst:1367 +#: ../../library/datetime.rst:1371 msgid "" "The :meth:`astimezone` method can now be called on naive instances that are " "presumed to represent system local time." msgstr "" -#: ../../library/datetime.rst:1374 +#: ../../library/datetime.rst:1378 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "utcoffset(self)``, and raises an exception if the latter doesn't return " "``None`` or a :class:`timedelta` object with magnitude less than one day." msgstr "" -#: ../../library/datetime.rst:1378 ../../library/datetime.rst:1973 -#: ../../library/datetime.rst:2080 ../../library/datetime.rst:2325 -#: ../../library/datetime.rst:2337 ../../library/datetime.rst:2649 +#: ../../library/datetime.rst:1382 ../../library/datetime.rst:1977 +#: ../../library/datetime.rst:2084 ../../library/datetime.rst:2329 +#: ../../library/datetime.rst:2341 ../../library/datetime.rst:2653 msgid "The UTC offset is not restricted to a whole number of minutes." msgstr "" -#: ../../library/datetime.rst:1384 +#: ../../library/datetime.rst:1388 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "dst(self)``, and raises an exception if the latter doesn't return ``None`` " "or a :class:`timedelta` object with magnitude less than one day." msgstr "" -#: ../../library/datetime.rst:1388 ../../library/datetime.rst:1983 -#: ../../library/datetime.rst:2134 +#: ../../library/datetime.rst:1392 ../../library/datetime.rst:1987 +#: ../../library/datetime.rst:2138 msgid "The DST offset is not restricted to a whole number of minutes." msgstr "" -#: ../../library/datetime.rst:1394 +#: ../../library/datetime.rst:1398 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "tzname(self)``, raises an exception if the latter doesn't return ``None`` or " "a string object," msgstr "" -#: ../../library/datetime.rst:1405 +#: ../../library/datetime.rst:1409 msgid "" "time.struct_time((d.year, d.month, d.day,\n" " d.hour, d.minute, d.second,\n" @@ -2070,7 +2079,7 @@ msgstr "" " d.hour, d.minute, d.second,\n" " d.weekday(), yday, dst))" -#: ../../library/datetime.rst:1409 +#: ../../library/datetime.rst:1413 msgid "" "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " "day number within the current year starting with 1 for January 1st. The :" @@ -2081,24 +2090,24 @@ msgid "" "to 0." msgstr "" -#: ../../library/datetime.rst:1420 +#: ../../library/datetime.rst:1424 msgid "" -"If :class:`.datetime` instance *d* is naive, this is the same as ``d." +"If :class:`.datetime` instance ``d`` is naive, this is the same as ``d." "timetuple()`` except that :attr:`~.time.struct_time.tm_isdst` is forced to 0 " "regardless of what ``d.dst()`` returns. DST is never in effect for a UTC " "time." msgstr "" -#: ../../library/datetime.rst:1424 +#: ../../library/datetime.rst:1428 msgid "" -"If *d* is aware, *d* is normalized to UTC time, by subtracting ``d." +"If ``d`` is aware, ``d`` is normalized to UTC time, by subtracting ``d." "utcoffset()``, and a :class:`time.struct_time` for the normalized time is " "returned. :attr:`!tm_isdst` is forced to 0. Note that an :exc:" "`OverflowError` may be raised if ``d.year`` was ``MINYEAR`` or ``MAXYEAR`` " "and UTC adjustment spills over a year boundary." msgstr "" -#: ../../library/datetime.rst:1433 +#: ../../library/datetime.rst:1437 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -2108,20 +2117,20 @@ msgid "" "meth:`.datetime.timetuple`." msgstr "" -#: ../../library/datetime.rst:1442 +#: ../../library/datetime.rst:1446 msgid "" "Return the proleptic Gregorian ordinal of the date. The same as ``self." "date().toordinal()``." msgstr "" -#: ../../library/datetime.rst:1447 +#: ../../library/datetime.rst:1451 msgid "" "Return POSIX timestamp corresponding to the :class:`.datetime` instance. The " "return value is a :class:`float` similar to that returned by :func:`time." "time`." msgstr "" -#: ../../library/datetime.rst:1451 +#: ../../library/datetime.rst:1455 msgid "" "Naive :class:`.datetime` instances are assumed to represent local time and " "this method relies on the platform C :c:func:`mktime` function to perform " @@ -2131,22 +2140,22 @@ msgid "" "future." msgstr "" -#: ../../library/datetime.rst:1458 +#: ../../library/datetime.rst:1462 msgid "" "For aware :class:`.datetime` instances, the return value is computed as::" msgstr "" -#: ../../library/datetime.rst:1461 +#: ../../library/datetime.rst:1465 msgid "(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()" msgstr "(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()" -#: ../../library/datetime.rst:1465 +#: ../../library/datetime.rst:1469 msgid "" "The :meth:`timestamp` method uses the :attr:`.fold` attribute to " "disambiguate the times during a repeated interval." msgstr "" -#: ../../library/datetime.rst:1471 +#: ../../library/datetime.rst:1475 msgid "" "There is no method to obtain the POSIX timestamp directly from a naive :" "class:`.datetime` instance representing UTC time. If your application uses " @@ -2154,57 +2163,57 @@ msgid "" "the POSIX timestamp by supplying ``tzinfo=timezone.utc``::" msgstr "" -#: ../../library/datetime.rst:1477 +#: ../../library/datetime.rst:1481 msgid "timestamp = dt.replace(tzinfo=timezone.utc).timestamp()" msgstr "timestamp = dt.replace(tzinfo=timezone.utc).timestamp()" -#: ../../library/datetime.rst:1479 +#: ../../library/datetime.rst:1483 msgid "or by calculating the timestamp directly::" msgstr "" -#: ../../library/datetime.rst:1481 +#: ../../library/datetime.rst:1485 msgid "timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)" msgstr "timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)" -#: ../../library/datetime.rst:1485 +#: ../../library/datetime.rst:1489 msgid "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " "The same as ``self.date().weekday()``. See also :meth:`isoweekday`." msgstr "" -#: ../../library/datetime.rst:1491 +#: ../../library/datetime.rst:1495 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " "The same as ``self.date().isoweekday()``. See also :meth:`weekday`, :meth:" "`isocalendar`." msgstr "" -#: ../../library/datetime.rst:1498 +#: ../../library/datetime.rst:1502 msgid "" "Return a :term:`named tuple` with three components: ``year``, ``week`` and " "``weekday``. The same as ``self.date().isocalendar()``." msgstr "" -#: ../../library/datetime.rst:1504 +#: ../../library/datetime.rst:1508 msgid "Return a string representing the date and time in ISO 8601 format:" msgstr "" -#: ../../library/datetime.rst:1506 +#: ../../library/datetime.rst:1510 msgid "``YYYY-MM-DDTHH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "``YYYY-MM-DDTHH:MM:SS.ffffff``,如果 :attr:`microsecond` 不是 0" -#: ../../library/datetime.rst:1507 +#: ../../library/datetime.rst:1511 msgid "``YYYY-MM-DDTHH:MM:SS``, if :attr:`microsecond` is 0" msgstr "``YYYY-MM-DDTHH:MM:SS``,如果 :attr:`microsecond` 是 0" -#: ../../library/datetime.rst:1509 +#: ../../library/datetime.rst:1513 msgid "" "If :meth:`utcoffset` does not return ``None``, a string is appended, giving " "the UTC offset:" msgstr "" "如果 :meth:`utcoffset` 没有回傳 ``None``,則會附加一个字串,給出 UTC 偏移:" -#: ../../library/datetime.rst:1512 +#: ../../library/datetime.rst:1516 msgid "" "``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` " "is not 0" @@ -2212,13 +2221,13 @@ msgstr "" "``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``,如果 :attr:`microsecond` " "不是 0" -#: ../../library/datetime.rst:1514 +#: ../../library/datetime.rst:1518 msgid "" "``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0" msgstr "" "``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``,如果 :attr:`microsecond` 是 0" -#: ../../library/datetime.rst:1518 +#: ../../library/datetime.rst:1522 msgid "" ">>> from datetime import datetime, timezone\n" ">>> datetime(2019, 5, 18, 15, 17, 8, 132263).isoformat()\n" @@ -2232,13 +2241,13 @@ msgstr "" ">>> datetime(2019, 5, 18, 15, 17, tzinfo=timezone.utc).isoformat()\n" "'2019-05-18T15:17:00+00:00'" -#: ../../library/datetime.rst:1524 +#: ../../library/datetime.rst:1528 msgid "" "The optional argument *sep* (default ``'T'``) is a one-character separator, " "placed between the date and time portions of the result. For example::" msgstr "" -#: ../../library/datetime.rst:1527 +#: ../../library/datetime.rst:1531 msgid "" ">>> from datetime import tzinfo, timedelta, datetime\n" ">>> class TZ(tzinfo):\n" @@ -2252,53 +2261,53 @@ msgid "" "'2009-11-27T00:00:00.000100-06:39'" msgstr "" -#: ../../library/datetime.rst:1538 ../../library/datetime.rst:1913 +#: ../../library/datetime.rst:1542 ../../library/datetime.rst:1917 msgid "" "The optional argument *timespec* specifies the number of additional " "components of the time to include (the default is ``'auto'``). It can be one " "of the following:" msgstr "" -#: ../../library/datetime.rst:1542 ../../library/datetime.rst:1917 +#: ../../library/datetime.rst:1546 ../../library/datetime.rst:1921 msgid "" "``'auto'``: Same as ``'seconds'`` if :attr:`microsecond` is 0, same as " "``'microseconds'`` otherwise." msgstr "" -#: ../../library/datetime.rst:1544 ../../library/datetime.rst:1919 +#: ../../library/datetime.rst:1548 ../../library/datetime.rst:1923 msgid "``'hours'``: Include the :attr:`hour` in the two-digit ``HH`` format." msgstr "" -#: ../../library/datetime.rst:1545 ../../library/datetime.rst:1920 +#: ../../library/datetime.rst:1549 ../../library/datetime.rst:1924 msgid "" "``'minutes'``: Include :attr:`hour` and :attr:`minute` in ``HH:MM`` format." msgstr "" -#: ../../library/datetime.rst:1546 ../../library/datetime.rst:1921 +#: ../../library/datetime.rst:1550 ../../library/datetime.rst:1925 msgid "" "``'seconds'``: Include :attr:`hour`, :attr:`minute`, and :attr:`second` in " "``HH:MM:SS`` format." msgstr "" -#: ../../library/datetime.rst:1548 ../../library/datetime.rst:1923 +#: ../../library/datetime.rst:1552 ../../library/datetime.rst:1927 msgid "" "``'milliseconds'``: Include full time, but truncate fractional second part " "to milliseconds. ``HH:MM:SS.sss`` format." msgstr "" -#: ../../library/datetime.rst:1550 ../../library/datetime.rst:1925 +#: ../../library/datetime.rst:1554 ../../library/datetime.rst:1929 msgid "``'microseconds'``: Include full time in ``HH:MM:SS.ffffff`` format." msgstr "" -#: ../../library/datetime.rst:1554 ../../library/datetime.rst:1929 +#: ../../library/datetime.rst:1558 ../../library/datetime.rst:1933 msgid "Excluded time components are truncated, not rounded." msgstr "" -#: ../../library/datetime.rst:1556 +#: ../../library/datetime.rst:1560 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument::" msgstr "" -#: ../../library/datetime.rst:1559 +#: ../../library/datetime.rst:1563 msgid "" ">>> from datetime import datetime\n" ">>> datetime.now().isoformat(timespec='minutes') \n" @@ -2314,21 +2323,21 @@ msgstr "" ">>> dt.isoformat(timespec='microseconds')\n" "'2015-01-01T12:30:59.000000'" -#: ../../library/datetime.rst:1566 ../../library/datetime.rst:1944 +#: ../../library/datetime.rst:1570 ../../library/datetime.rst:1948 msgid "Added the *timespec* parameter." msgstr "新增 *timespec* 參數。" -#: ../../library/datetime.rst:1572 +#: ../../library/datetime.rst:1576 msgid "" -"For a :class:`.datetime` instance *d*, ``str(d)`` is equivalent to ``d." +"For a :class:`.datetime` instance ``d``, ``str(d)`` is equivalent to ``d." "isoformat(' ')``." msgstr "" -#: ../../library/datetime.rst:1578 +#: ../../library/datetime.rst:1582 msgid "Return a string representing the date and time::" msgstr "" -#: ../../library/datetime.rst:1580 +#: ../../library/datetime.rst:1584 msgid "" ">>> from datetime import datetime\n" ">>> datetime(2002, 12, 4, 20, 30, 40).ctime()\n" @@ -2338,27 +2347,27 @@ msgstr "" ">>> datetime(2002, 12, 4, 20, 30, 40).ctime()\n" "'Wed Dec 4 20:30:40 2002'" -#: ../../library/datetime.rst:1584 +#: ../../library/datetime.rst:1588 msgid "" "The output string will *not* include time zone information, regardless of " "whether the input is aware or naive." msgstr "" -#: ../../library/datetime.rst:1591 +#: ../../library/datetime.rst:1595 msgid "" "on platforms where the native C :c:func:`ctime` function (which :func:`time." "ctime` invokes, but which :meth:`datetime.ctime` does not invoke) conforms " "to the C standard." msgstr "" -#: ../../library/datetime.rst:1598 +#: ../../library/datetime.rst:1602 msgid "" "Return a string representing the date and time, controlled by an explicit " "format string. See also :ref:`strftime-strptime-behavior` and :meth:" "`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1605 +#: ../../library/datetime.rst:1609 msgid "" "Same as :meth:`.datetime.strftime`. This makes it possible to specify a " "format string for a :class:`.datetime` object in :ref:`formatted string " @@ -2366,15 +2375,15 @@ msgid "" "`strftime-strptime-behavior` and :meth:`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1612 +#: ../../library/datetime.rst:1616 msgid "Examples of Usage: :class:`.datetime`" msgstr "用法範例::class:`.datetime`" -#: ../../library/datetime.rst:1614 +#: ../../library/datetime.rst:1618 msgid "Examples of working with :class:`.datetime` objects:" msgstr "更多 :class:`.datetime` 的用法範例:" -#: ../../library/datetime.rst:1616 +#: ../../library/datetime.rst:1620 msgid "" ">>> from datetime import datetime, date, time, timezone\n" "\n" @@ -2428,14 +2437,14 @@ msgid "" "'The day is 21, the month is November, the time is 04:30PM.'" msgstr "" -#: ../../library/datetime.rst:1667 +#: ../../library/datetime.rst:1671 msgid "" "The example below defines a :class:`tzinfo` subclass capturing time zone " "information for Kabul, Afghanistan, which used +4 UTC until 1945 and then " "+4:30 UTC thereafter::" msgstr "" -#: ../../library/datetime.rst:1671 +#: ../../library/datetime.rst:1675 msgid "" "from datetime import timedelta, datetime, tzinfo, timezone\n" "\n" @@ -2482,11 +2491,11 @@ msgid "" " return \"+04\"" msgstr "" -#: ../../library/datetime.rst:1714 +#: ../../library/datetime.rst:1718 msgid "Usage of ``KabulTz`` from above::" msgstr "" -#: ../../library/datetime.rst:1716 +#: ../../library/datetime.rst:1720 msgid "" ">>> tz1 = KabulTz()\n" "\n" @@ -2510,63 +2519,63 @@ msgid "" "True" msgstr "" -#: ../../library/datetime.rst:1740 +#: ../../library/datetime.rst:1744 msgid ":class:`.time` Objects" msgstr ":class:`.time` 物件" -#: ../../library/datetime.rst:1742 +#: ../../library/datetime.rst:1746 msgid "" "A :class:`.time` object represents a (local) time of day, independent of any " "particular day, and subject to adjustment via a :class:`tzinfo` object." msgstr "" -#: ../../library/datetime.rst:1747 +#: ../../library/datetime.rst:1751 msgid "" "All arguments are optional. *tzinfo* may be ``None``, or an instance of a :" "class:`tzinfo` subclass. The remaining arguments must be integers in the " "following ranges:" msgstr "" -#: ../../library/datetime.rst:1757 +#: ../../library/datetime.rst:1761 msgid "" "If an argument outside those ranges is given, :exc:`ValueError` is raised. " "All default to 0 except *tzinfo*, which defaults to ``None``." msgstr "" -#: ../../library/datetime.rst:1765 +#: ../../library/datetime.rst:1769 msgid "The earliest representable :class:`.time`, ``time(0, 0, 0, 0)``." msgstr "" -#: ../../library/datetime.rst:1770 +#: ../../library/datetime.rst:1774 msgid "The latest representable :class:`.time`, ``time(23, 59, 59, 999999)``." msgstr "" -#: ../../library/datetime.rst:1775 +#: ../../library/datetime.rst:1779 msgid "" "The smallest possible difference between non-equal :class:`.time` objects, " "``timedelta(microseconds=1)``, although note that arithmetic on :class:`." "time` objects is not supported." msgstr "" -#: ../../library/datetime.rst:1804 +#: ../../library/datetime.rst:1808 msgid "" "The object passed as the tzinfo argument to the :class:`.time` constructor, " "or ``None`` if none was passed." msgstr "" -#: ../../library/datetime.rst:1818 +#: ../../library/datetime.rst:1822 msgid "" -":class:`.time` objects support equality and order comparisons, where *a* is " -"considered less than *b* when *a* precedes *b* in time." +":class:`.time` objects support equality and order comparisons, where ``a`` " +"is considered less than ``b`` when ``a`` precedes ``b`` in time." msgstr "" -#: ../../library/datetime.rst:1821 +#: ../../library/datetime.rst:1825 msgid "" "Naive and aware :class:`!time` objects are never equal. Order comparison " "between naive and aware :class:`!time` objects raises :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1825 +#: ../../library/datetime.rst:1829 msgid "" "If both comparands are aware, and have the same :attr:`~.time.tzinfo` " "attribute, the :attr:`!tzinfo` and :attr:`!fold` attributes are ignored and " @@ -2575,18 +2584,18 @@ msgid "" "subtracting their UTC offsets (obtained from ``self.utcoffset()``)." msgstr "" -#: ../../library/datetime.rst:1831 +#: ../../library/datetime.rst:1835 msgid "" "Equality comparisons between aware and naive :class:`.time` instances don't " "raise :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1835 +#: ../../library/datetime.rst:1839 msgid "" "In Boolean contexts, a :class:`.time` object is always considered to be true." msgstr "" -#: ../../library/datetime.rst:1837 +#: ../../library/datetime.rst:1841 msgid "" "Before Python 3.5, a :class:`.time` object was considered to be false if it " "represented midnight in UTC. This behavior was considered obscure and error-" @@ -2594,33 +2603,33 @@ msgid "" "details." msgstr "" -#: ../../library/datetime.rst:1844 +#: ../../library/datetime.rst:1848 msgid "Other constructor:" msgstr "" -#: ../../library/datetime.rst:1848 +#: ../../library/datetime.rst:1852 msgid "" "Return a :class:`.time` corresponding to a *time_string* in any valid ISO " "8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:1852 +#: ../../library/datetime.rst:1856 msgid "" "The leading ``T``, normally required in cases where there may be ambiguity " "between a date and a time, is not required." msgstr "" -#: ../../library/datetime.rst:1854 +#: ../../library/datetime.rst:1858 msgid "" "Fractional seconds may have any number of digits (anything beyond 6 will be " "truncated)." msgstr "" -#: ../../library/datetime.rst:1858 +#: ../../library/datetime.rst:1862 msgid "Examples:" msgstr "範例: ::" -#: ../../library/datetime.rst:1860 +#: ../../library/datetime.rst:1864 msgid "" ">>> from datetime import time\n" ">>> time.fromisoformat('04:23:01')\n" @@ -2660,13 +2669,13 @@ msgstr "" ">>> time.fromisoformat('04:23:01+00:00')\n" "datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)" -#: ../../library/datetime.rst:1882 +#: ../../library/datetime.rst:1886 msgid "" "Previously, this method only supported formats that could be emitted by :" "meth:`time.isoformat`." msgstr "" -#: ../../library/datetime.rst:1892 +#: ../../library/datetime.rst:1896 msgid "" "Return a :class:`.time` with the same value, except for those attributes " "given new values by whichever keyword arguments are specified. Note that " @@ -2674,41 +2683,41 @@ msgid "" "aware :class:`.time`, without conversion of the time data." msgstr "" -#: ../../library/datetime.rst:1897 +#: ../../library/datetime.rst:1901 msgid "" ":class:`.time` objects are also supported by generic function :func:`copy." "replace`." msgstr "" -#: ../../library/datetime.rst:1906 +#: ../../library/datetime.rst:1910 msgid "Return a string representing the time in ISO 8601 format, one of:" msgstr "" -#: ../../library/datetime.rst:1908 +#: ../../library/datetime.rst:1912 msgid "``HH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "" -#: ../../library/datetime.rst:1909 +#: ../../library/datetime.rst:1913 msgid "``HH:MM:SS``, if :attr:`microsecond` is 0" msgstr "" -#: ../../library/datetime.rst:1910 +#: ../../library/datetime.rst:1914 msgid "" "``HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :meth:`utcoffset` does not " "return ``None``" msgstr "" -#: ../../library/datetime.rst:1911 +#: ../../library/datetime.rst:1915 msgid "" "``HH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0 and :meth:" "`utcoffset` does not return ``None``" msgstr "" -#: ../../library/datetime.rst:1931 +#: ../../library/datetime.rst:1935 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument." msgstr "" -#: ../../library/datetime.rst:1935 +#: ../../library/datetime.rst:1939 msgid "" ">>> from datetime import time\n" ">>> time(hour=12, minute=34, second=56, microsecond=123456)." @@ -2730,18 +2739,18 @@ msgstr "" ">>> dt.isoformat(timespec='auto')\n" "'12:34:56'" -#: ../../library/datetime.rst:1950 -msgid "For a time *t*, ``str(t)`` is equivalent to ``t.isoformat()``." +#: ../../library/datetime.rst:1954 +msgid "For a time ``t``, ``str(t)`` is equivalent to ``t.isoformat()``." msgstr "" -#: ../../library/datetime.rst:1955 +#: ../../library/datetime.rst:1959 msgid "" "Return a string representing the time, controlled by an explicit format " "string. See also :ref:`strftime-strptime-behavior` and :meth:`time." "isoformat`." msgstr "" -#: ../../library/datetime.rst:1961 +#: ../../library/datetime.rst:1965 msgid "" "Same as :meth:`.time.strftime`. This makes it possible to specify a format " "string for a :class:`.time` object in :ref:`formatted string literals >> from datetime import time, tzinfo, timedelta\n" ">>> class TZ1(tzinfo):\n" @@ -2830,18 +2839,18 @@ msgstr "" ">>> 'The {} is {:%H:%M}.'.format(\"time\", t)\n" "'The time is 12:10.'" -#: ../../library/datetime.rst:2026 +#: ../../library/datetime.rst:2030 msgid ":class:`tzinfo` Objects" msgstr ":class:`tzinfo` 物件" -#: ../../library/datetime.rst:2030 +#: ../../library/datetime.rst:2034 msgid "" "This is an abstract base class, meaning that this class should not be " "instantiated directly. Define a subclass of :class:`tzinfo` to capture " "information about a particular time zone." msgstr "" -#: ../../library/datetime.rst:2034 +#: ../../library/datetime.rst:2038 msgid "" "An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the " "constructors for :class:`.datetime` and :class:`.time` objects. The latter " @@ -2851,7 +2860,7 @@ msgid "" "object passed to them." msgstr "" -#: ../../library/datetime.rst:2040 +#: ../../library/datetime.rst:2044 msgid "" "You need to derive a concrete subclass, and (at least) supply " "implementations of the standard :class:`tzinfo` methods needed by the :class:" @@ -2861,7 +2870,7 @@ msgid "" "American EST and EDT." msgstr "" -#: ../../library/datetime.rst:2047 +#: ../../library/datetime.rst:2051 msgid "" "Special requirement for pickling: A :class:`tzinfo` subclass must have an :" "meth:`~object.__init__` method that can be called with no arguments, " @@ -2869,20 +2878,20 @@ msgid "" "technical requirement that may be relaxed in the future." msgstr "" -#: ../../library/datetime.rst:2053 +#: ../../library/datetime.rst:2057 msgid "" "A concrete subclass of :class:`tzinfo` may need to implement the following " "methods. Exactly which methods are needed depends on the uses made of aware :" "mod:`!datetime` objects. If in doubt, simply implement all of them." msgstr "" -#: ../../library/datetime.rst:2060 +#: ../../library/datetime.rst:2064 msgid "" "Return offset of local time from UTC, as a :class:`timedelta` object that is " "positive east of UTC. If local time is west of UTC, this should be negative." msgstr "" -#: ../../library/datetime.rst:2063 +#: ../../library/datetime.rst:2067 msgid "" "This represents the *total* offset from UTC; for example, if a :class:" "`tzinfo` object represents both time zone and DST adjustments, :meth:" @@ -2893,31 +2902,31 @@ msgid "" "meth:`utcoffset` will probably look like one of these two::" msgstr "" -#: ../../library/datetime.rst:2071 +#: ../../library/datetime.rst:2075 msgid "" "return CONSTANT # fixed-offset class\n" "return CONSTANT + self.dst(dt) # daylight-aware class" msgstr "" -#: ../../library/datetime.rst:2074 +#: ../../library/datetime.rst:2078 msgid "" "If :meth:`utcoffset` does not return ``None``, :meth:`dst` should not return " "``None`` either." msgstr "" -#: ../../library/datetime.rst:2077 +#: ../../library/datetime.rst:2081 msgid "" "The default implementation of :meth:`utcoffset` raises :exc:" "`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2086 +#: ../../library/datetime.rst:2090 msgid "" "Return the daylight saving time (DST) adjustment, as a :class:`timedelta` " "object or ``None`` if DST information isn't known." msgstr "" -#: ../../library/datetime.rst:2090 +#: ../../library/datetime.rst:2094 msgid "" "Return ``timedelta(0)`` if DST is not in effect. If DST is in effect, return " "the offset as a :class:`timedelta` object (see :meth:`utcoffset` for " @@ -2930,17 +2939,17 @@ msgid "" "to account for DST changes when crossing time zones." msgstr "" -#: ../../library/datetime.rst:2100 +#: ../../library/datetime.rst:2104 msgid "" "An instance *tz* of a :class:`tzinfo` subclass that models both standard and " "daylight times must be consistent in this sense:" msgstr "" -#: ../../library/datetime.rst:2103 +#: ../../library/datetime.rst:2107 msgid "``tz.utcoffset(dt) - tz.dst(dt)``" msgstr "``tz.utcoffset(dt) - tz.dst(dt)``" -#: ../../library/datetime.rst:2105 +#: ../../library/datetime.rst:2109 msgid "" "must return the same result for every :class:`.datetime` *dt* with ``dt." "tzinfo == tz``. For sane :class:`tzinfo` subclasses, this expression yields " @@ -2953,24 +2962,24 @@ msgid "" "astimezone` regardless." msgstr "" -#: ../../library/datetime.rst:2114 +#: ../../library/datetime.rst:2118 msgid "" "Most implementations of :meth:`dst` will probably look like one of these " "two::" msgstr "" -#: ../../library/datetime.rst:2116 +#: ../../library/datetime.rst:2120 msgid "" "def dst(self, dt):\n" " # a fixed-offset class: doesn't account for DST\n" " return timedelta(0)" msgstr "" -#: ../../library/datetime.rst:2120 +#: ../../library/datetime.rst:2124 msgid "or::" msgstr "或是: ::" -#: ../../library/datetime.rst:2122 +#: ../../library/datetime.rst:2126 msgid "" "def dst(self, dt):\n" " # Code to set dston and dstoff to the time zone's DST\n" @@ -2983,12 +2992,12 @@ msgid "" " return timedelta(0)" msgstr "" -#: ../../library/datetime.rst:2132 +#: ../../library/datetime.rst:2136 msgid "" "The default implementation of :meth:`dst` raises :exc:`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2140 +#: ../../library/datetime.rst:2144 msgid "" "Return the time zone name corresponding to the :class:`.datetime` object " "*dt*, as a string. Nothing about string names is defined by the :mod:`!" @@ -3002,13 +3011,13 @@ msgid "" "accounting for daylight time." msgstr "" -#: ../../library/datetime.rst:2150 +#: ../../library/datetime.rst:2154 msgid "" "The default implementation of :meth:`tzname` raises :exc:" "`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2153 +#: ../../library/datetime.rst:2157 msgid "" "These methods are called by a :class:`.datetime` or :class:`.time` object, " "in response to their methods of the same names. A :class:`.datetime` object " @@ -3018,7 +3027,7 @@ msgid "" "datetime`." msgstr "" -#: ../../library/datetime.rst:2159 +#: ../../library/datetime.rst:2163 msgid "" "When ``None`` is passed, it's up to the class designer to decide the best " "response. For example, returning ``None`` is appropriate if the class wishes " @@ -3027,7 +3036,7 @@ msgid "" "offset, as there is no other convention for discovering the standard offset." msgstr "" -#: ../../library/datetime.rst:2165 +#: ../../library/datetime.rst:2169 msgid "" "When a :class:`.datetime` object is passed in response to a :class:`." "datetime` method, ``dt.tzinfo`` is the same object as *self*. :class:" @@ -3037,13 +3046,13 @@ msgid "" "zones." msgstr "" -#: ../../library/datetime.rst:2171 +#: ../../library/datetime.rst:2175 msgid "" "There is one more :class:`tzinfo` method that a subclass may wish to " "override:" msgstr "" -#: ../../library/datetime.rst:2176 +#: ../../library/datetime.rst:2180 msgid "" "This is called from the default :meth:`datetime.astimezone` implementation. " "When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time " @@ -3052,7 +3061,7 @@ msgid "" "datetime in *self*'s local time." msgstr "" -#: ../../library/datetime.rst:2182 +#: ../../library/datetime.rst:2186 msgid "" "Most :class:`tzinfo` subclasses should be able to inherit the default :meth:" "`fromutc` implementation without problems. It's strong enough to handle " @@ -3067,13 +3076,13 @@ msgid "" "offset changes." msgstr "" -#: ../../library/datetime.rst:2193 +#: ../../library/datetime.rst:2197 msgid "" "Skipping code for error cases, the default :meth:`fromutc` implementation " "acts like::" msgstr "" -#: ../../library/datetime.rst:2196 +#: ../../library/datetime.rst:2200 msgid "" "def fromutc(self, dt):\n" " # raise ValueError error if dt.tzinfo is not self\n" @@ -3091,13 +3100,13 @@ msgid "" " return dt" msgstr "" -#: ../../library/datetime.rst:2211 +#: ../../library/datetime.rst:2215 msgid "" "In the following :download:`tzinfo_examples.py <../includes/tzinfo_examples." "py>` file there are some examples of :class:`tzinfo` classes:" msgstr "" -#: ../../library/datetime.rst:2215 +#: ../../library/datetime.rst:2219 msgid "" "from datetime import tzinfo, timedelta, datetime\n" "\n" @@ -3277,7 +3286,7 @@ msgid "" "Pacific = USTimeZone(-8, \"Pacific\", \"PST\", \"PDT\")\n" msgstr "" -#: ../../library/datetime.rst:2217 +#: ../../library/datetime.rst:2221 msgid "" "Note that there are unavoidable subtleties twice per year in a :class:" "`tzinfo` subclass accounting for both standard and daylight time, at the DST " @@ -3286,7 +3295,7 @@ msgid "" "ends the minute after 1:59 (EDT) on the first Sunday in November::" msgstr "" -#: ../../library/datetime.rst:2223 +#: ../../library/datetime.rst:2227 msgid "" " UTC 3:MM 4:MM 5:MM 6:MM 7:MM 8:MM\n" " EST 22:MM 23:MM 0:MM 1:MM 2:MM 3:MM\n" @@ -3304,7 +3313,7 @@ msgstr "" "\n" " end 23:MM 0:MM 1:MM 1:MM 2:MM 3:MM" -#: ../../library/datetime.rst:2231 +#: ../../library/datetime.rst:2235 msgid "" "When DST starts (the \"start\" line), the local wall clock leaps from 1:59 " "to 3:00. A wall time of the form 2:MM doesn't really make sense on that day, " @@ -3313,7 +3322,7 @@ msgid "" "get::" msgstr "" -#: ../../library/datetime.rst:2236 +#: ../../library/datetime.rst:2240 msgid "" ">>> from datetime import datetime, timezone\n" ">>> from tzinfo_examples import HOUR, Eastern\n" @@ -3341,7 +3350,7 @@ msgstr "" "07:00:00 UTC = 03:00:00 EDT\n" "08:00:00 UTC = 04:00:00 EDT" -#: ../../library/datetime.rst:2250 +#: ../../library/datetime.rst:2254 msgid "" "When DST ends (the \"end\" line), there's a potentially worse problem: " "there's an hour that can't be spelled unambiguously in local wall time: the " @@ -3356,7 +3365,7 @@ msgid "" "Fall back transition of 2016, we get::" msgstr "" -#: ../../library/datetime.rst:2261 +#: ../../library/datetime.rst:2265 msgid "" ">>> u0 = datetime(2016, 11, 6, 4, tzinfo=timezone.utc)\n" ">>> for i in range(4):\n" @@ -3380,13 +3389,13 @@ msgstr "" "06:00:00 UTC = 01:00:00 EST 1\n" "07:00:00 UTC = 02:00:00 EST 0" -#: ../../library/datetime.rst:2272 +#: ../../library/datetime.rst:2276 msgid "" "Note that the :class:`.datetime` instances that differ only by the value of " "the :attr:`~.datetime.fold` attribute are considered equal in comparisons." msgstr "" -#: ../../library/datetime.rst:2275 +#: ../../library/datetime.rst:2279 msgid "" "Applications that can't bear wall-time ambiguities should explicitly check " "the value of the :attr:`~.datetime.fold` attribute or avoid using hybrid :" @@ -3396,28 +3405,28 @@ msgid "" "offset -4 hours))." msgstr "" -#: ../../library/datetime.rst:2283 +#: ../../library/datetime.rst:2287 msgid ":mod:`zoneinfo`" msgstr ":mod:`zoneinfo`" -#: ../../library/datetime.rst:2284 +#: ../../library/datetime.rst:2288 msgid "" "The :mod:`!datetime` module has a basic :class:`timezone` class (for " "handling arbitrary fixed offsets from UTC) and its :attr:`timezone.utc` " "attribute (a UTC :class:`!timezone` instance)." msgstr "" -#: ../../library/datetime.rst:2288 +#: ../../library/datetime.rst:2292 msgid "" "``zoneinfo`` brings the *IANA time zone database* (also known as the Olson " "database) to Python, and its usage is recommended." msgstr "" -#: ../../library/datetime.rst:2291 +#: ../../library/datetime.rst:2295 msgid "`IANA time zone database `_" msgstr "`IANA 時區資料庫 `_" -#: ../../library/datetime.rst:2292 +#: ../../library/datetime.rst:2296 msgid "" "The Time Zone Database (often called tz, tzdata or zoneinfo) contains code " "and data that represent the history of local time for many representative " @@ -3426,24 +3435,24 @@ msgid "" "saving rules." msgstr "" -#: ../../library/datetime.rst:2302 +#: ../../library/datetime.rst:2306 msgid ":class:`timezone` Objects" msgstr ":class:`timezone` 物件" -#: ../../library/datetime.rst:2304 +#: ../../library/datetime.rst:2308 msgid "" "The :class:`timezone` class is a subclass of :class:`tzinfo`, each instance " "of which represents a time zone defined by a fixed offset from UTC." msgstr "" -#: ../../library/datetime.rst:2308 +#: ../../library/datetime.rst:2312 msgid "" "Objects of this class cannot be used to represent time zone information in " "the locations where different offsets are used in different days of the year " "or where historical changes have been made to civil time." msgstr "" -#: ../../library/datetime.rst:2315 +#: ../../library/datetime.rst:2319 msgid "" "The *offset* argument must be specified as a :class:`timedelta` object " "representing the difference between the local time and UTC. It must be " @@ -3451,25 +3460,25 @@ msgid "" "otherwise :exc:`ValueError` is raised." msgstr "" -#: ../../library/datetime.rst:2320 +#: ../../library/datetime.rst:2324 msgid "" "The *name* argument is optional. If specified it must be a string that will " "be used as the value returned by the :meth:`datetime.tzname` method." msgstr "" -#: ../../library/datetime.rst:2331 ../../library/datetime.rst:2342 +#: ../../library/datetime.rst:2335 ../../library/datetime.rst:2346 msgid "" "Return the fixed value specified when the :class:`timezone` instance is " "constructed." msgstr "" -#: ../../library/datetime.rst:2334 +#: ../../library/datetime.rst:2338 msgid "" "The *dt* argument is ignored. The return value is a :class:`timedelta` " "instance equal to the difference between the local time and UTC." msgstr "" -#: ../../library/datetime.rst:2345 +#: ../../library/datetime.rst:2349 msgid "" "If *name* is not provided in the constructor, the name returned by " "``tzname(dt)`` is generated from the value of the ``offset`` as follows. If " @@ -3478,119 +3487,119 @@ msgid "" "are two digits of ``offset.hours`` and ``offset.minutes`` respectively." msgstr "" -#: ../../library/datetime.rst:2351 +#: ../../library/datetime.rst:2355 msgid "" "Name generated from ``offset=timedelta(0)`` is now plain ``'UTC'``, not " "``'UTC+00:00'``." msgstr "" -#: ../../library/datetime.rst:2358 +#: ../../library/datetime.rst:2362 msgid "Always returns ``None``." msgstr "總是回傳 ``None``。" -#: ../../library/datetime.rst:2362 +#: ../../library/datetime.rst:2366 msgid "" "Return ``dt + offset``. The *dt* argument must be an aware :class:`." "datetime` instance, with ``tzinfo`` set to ``self``." msgstr "" -#: ../../library/datetime.rst:2369 +#: ../../library/datetime.rst:2373 msgid "The UTC time zone, ``timezone(timedelta(0))``." msgstr "UTC 時區,``timezone(timedelta(0))``。" -#: ../../library/datetime.rst:2378 +#: ../../library/datetime.rst:2382 msgid ":meth:`~.datetime.strftime` and :meth:`~.datetime.strptime` Behavior" msgstr ":meth:`~.datetime.strftime` 與 :meth:`~.datetime.strptime` 的行為" -#: ../../library/datetime.rst:2380 +#: ../../library/datetime.rst:2384 msgid "" ":class:`date`, :class:`.datetime`, and :class:`.time` objects all support a " "``strftime(format)`` method, to create a string representing the time under " "the control of an explicit format string." msgstr "" -#: ../../library/datetime.rst:2384 +#: ../../library/datetime.rst:2388 msgid "" "Conversely, the :meth:`datetime.strptime` class method creates a :class:`." "datetime` object from a string representing a date and time and a " "corresponding format string." msgstr "" -#: ../../library/datetime.rst:2388 +#: ../../library/datetime.rst:2392 msgid "" "The table below provides a high-level comparison of :meth:`~.datetime." "strftime` versus :meth:`~.datetime.strptime`:" msgstr "" -#: ../../library/datetime.rst:2392 +#: ../../library/datetime.rst:2396 msgid "``strftime``" msgstr "``strftime``" -#: ../../library/datetime.rst:2392 +#: ../../library/datetime.rst:2396 msgid "``strptime``" msgstr "``strptime``" -#: ../../library/datetime.rst:2394 +#: ../../library/datetime.rst:2398 msgid "Usage" msgstr "用法" -#: ../../library/datetime.rst:2394 +#: ../../library/datetime.rst:2398 msgid "Convert object to a string according to a given format" msgstr "" -#: ../../library/datetime.rst:2394 +#: ../../library/datetime.rst:2398 msgid "" "Parse a string into a :class:`.datetime` object given a corresponding format" msgstr "" -#: ../../library/datetime.rst:2396 +#: ../../library/datetime.rst:2400 msgid "Type of method" msgstr "" -#: ../../library/datetime.rst:2396 +#: ../../library/datetime.rst:2400 msgid "Instance method" msgstr "實例方法" -#: ../../library/datetime.rst:2396 +#: ../../library/datetime.rst:2400 msgid "Class method" msgstr "類別方法" -#: ../../library/datetime.rst:2398 +#: ../../library/datetime.rst:2402 msgid "Method of" msgstr "" -#: ../../library/datetime.rst:2398 +#: ../../library/datetime.rst:2402 msgid ":class:`date`; :class:`.datetime`; :class:`.time`" msgstr ":class:`date`; :class:`.datetime`; :class:`.time`" -#: ../../library/datetime.rst:2398 +#: ../../library/datetime.rst:2402 msgid ":class:`.datetime`" msgstr ":class:`.datetime`" -#: ../../library/datetime.rst:2400 +#: ../../library/datetime.rst:2404 msgid "Signature" msgstr "" -#: ../../library/datetime.rst:2400 +#: ../../library/datetime.rst:2404 msgid "``strftime(format)``" msgstr "``strftime(format)``" -#: ../../library/datetime.rst:2400 +#: ../../library/datetime.rst:2404 msgid "``strptime(date_string, format)``" msgstr "``strptime(date_string, format)``" -#: ../../library/datetime.rst:2407 +#: ../../library/datetime.rst:2411 msgid "" ":meth:`~.datetime.strftime` and :meth:`~.datetime.strptime` Format Codes" msgstr ":meth:`~.datetime.strftime` 與 :meth:`~.datetime.strptime` 格式碼" -#: ../../library/datetime.rst:2409 +#: ../../library/datetime.rst:2413 msgid "" "These methods accept format codes that can be used to parse and format " "dates::" msgstr "" -#: ../../library/datetime.rst:2411 +#: ../../library/datetime.rst:2415 msgid "" ">>> datetime.strptime('31/01/22 23:59:59.999999',\n" "... '%d/%m/%y %H:%M:%S.%f')\n" @@ -3604,33 +3613,33 @@ msgstr "" ">>> _.strftime('%a %d %b %Y, %I:%M%p')\n" "'Mon 31 Jan 2022, 11:59PM'" -#: ../../library/datetime.rst:2417 +#: ../../library/datetime.rst:2421 msgid "" "The following is a list of all the format codes that the 1989 C standard " "requires, and these work on all platforms with a standard C implementation." msgstr "" -#: ../../library/datetime.rst:2421 ../../library/datetime.rst:2524 +#: ../../library/datetime.rst:2425 ../../library/datetime.rst:2528 msgid "Directive" msgstr "" -#: ../../library/datetime.rst:2421 ../../library/datetime.rst:2524 +#: ../../library/datetime.rst:2425 ../../library/datetime.rst:2528 msgid "Meaning" msgstr "含義" -#: ../../library/datetime.rst:2421 ../../library/datetime.rst:2524 +#: ../../library/datetime.rst:2425 ../../library/datetime.rst:2528 msgid "Example" msgstr "範例" -#: ../../library/datetime.rst:2421 ../../library/datetime.rst:2524 +#: ../../library/datetime.rst:2425 ../../library/datetime.rst:2528 msgid "Notes" msgstr "註解" -#: ../../library/datetime.rst:2423 +#: ../../library/datetime.rst:2427 msgid "``%a``" msgstr "``%a``" -#: ../../library/datetime.rst:2423 +#: ../../library/datetime.rst:2427 msgid "Weekday as locale's abbreviated name." msgstr "" @@ -3642,11 +3651,11 @@ msgstr "" msgid "So, Mo, ..., Sa (de_DE)" msgstr "" -#: ../../library/datetime.rst:2428 +#: ../../library/datetime.rst:2432 msgid "``%A``" msgstr "``%A``" -#: ../../library/datetime.rst:2428 +#: ../../library/datetime.rst:2432 msgid "Weekday as locale's full name." msgstr "" @@ -3658,42 +3667,42 @@ msgstr "" msgid "Sonntag, Montag, ..., Samstag (de_DE)" msgstr "" -#: ../../library/datetime.rst:2433 +#: ../../library/datetime.rst:2437 msgid "``%w``" msgstr "``%w``" -#: ../../library/datetime.rst:2433 +#: ../../library/datetime.rst:2437 msgid "Weekday as a decimal number, where 0 is Sunday and 6 is Saturday." msgstr "" -#: ../../library/datetime.rst:2433 +#: ../../library/datetime.rst:2437 msgid "0, 1, ..., 6" msgstr "0, 1, ..., 6" -#: ../../library/datetime.rst:2437 +#: ../../library/datetime.rst:2441 msgid "``%d``" msgstr "``%d``" -#: ../../library/datetime.rst:2437 +#: ../../library/datetime.rst:2441 msgid "Day of the month as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2437 +#: ../../library/datetime.rst:2441 msgid "01, 02, ..., 31" msgstr "01, 02, ..., 31" -#: ../../library/datetime.rst:2437 ../../library/datetime.rst:2450 -#: ../../library/datetime.rst:2453 ../../library/datetime.rst:2459 -#: ../../library/datetime.rst:2462 ../../library/datetime.rst:2468 -#: ../../library/datetime.rst:2486 +#: ../../library/datetime.rst:2441 ../../library/datetime.rst:2454 +#: ../../library/datetime.rst:2457 ../../library/datetime.rst:2463 +#: ../../library/datetime.rst:2466 ../../library/datetime.rst:2472 +#: ../../library/datetime.rst:2490 msgid "\\(9)" msgstr "\\(9)" -#: ../../library/datetime.rst:2440 +#: ../../library/datetime.rst:2444 msgid "``%b``" msgstr "``%b``" -#: ../../library/datetime.rst:2440 +#: ../../library/datetime.rst:2444 msgid "Month as locale's abbreviated name." msgstr "" @@ -3705,11 +3714,11 @@ msgstr "" msgid "Jan, Feb, ..., Dez (de_DE)" msgstr "" -#: ../../library/datetime.rst:2445 +#: ../../library/datetime.rst:2449 msgid "``%B``" msgstr "``%B``" -#: ../../library/datetime.rst:2445 +#: ../../library/datetime.rst:2449 msgid "Month as locale's full name." msgstr "" @@ -3721,67 +3730,67 @@ msgstr "" msgid "Januar, Februar, ..., Dezember (de_DE)" msgstr "" -#: ../../library/datetime.rst:2450 +#: ../../library/datetime.rst:2454 msgid "``%m``" msgstr "``%m``" -#: ../../library/datetime.rst:2450 +#: ../../library/datetime.rst:2454 msgid "Month as a zero-padded decimal number." msgstr "以零填充的並以十進位數字表示的月份。" -#: ../../library/datetime.rst:2450 ../../library/datetime.rst:2462 +#: ../../library/datetime.rst:2454 ../../library/datetime.rst:2466 msgid "01, 02, ..., 12" msgstr "01, 02, ..., 12" -#: ../../library/datetime.rst:2453 +#: ../../library/datetime.rst:2457 msgid "``%y``" msgstr "``%y``" -#: ../../library/datetime.rst:2453 +#: ../../library/datetime.rst:2457 msgid "Year without century as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2453 +#: ../../library/datetime.rst:2457 msgid "00, 01, ..., 99" msgstr "00, 01, ..., 99" -#: ../../library/datetime.rst:2456 +#: ../../library/datetime.rst:2460 msgid "``%Y``" msgstr "``%Y``" -#: ../../library/datetime.rst:2456 +#: ../../library/datetime.rst:2460 msgid "Year with century as a decimal number." msgstr "" -#: ../../library/datetime.rst:2456 ../../library/datetime.rst:2526 +#: ../../library/datetime.rst:2460 ../../library/datetime.rst:2530 msgid "0001, 0002, ..., 2013, 2014, ..., 9998, 9999" msgstr "0001, 0002, ..., 2013, 2014, ..., 9998, 9999" -#: ../../library/datetime.rst:2459 +#: ../../library/datetime.rst:2463 msgid "``%H``" msgstr "``%H``" -#: ../../library/datetime.rst:2459 +#: ../../library/datetime.rst:2463 msgid "Hour (24-hour clock) as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2459 +#: ../../library/datetime.rst:2463 msgid "00, 01, ..., 23" msgstr "00, 01, ..., 23" -#: ../../library/datetime.rst:2462 +#: ../../library/datetime.rst:2466 msgid "``%I``" msgstr "``%I``" -#: ../../library/datetime.rst:2462 +#: ../../library/datetime.rst:2466 msgid "Hour (12-hour clock) as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2465 +#: ../../library/datetime.rst:2469 msgid "``%p``" msgstr "``%p``" -#: ../../library/datetime.rst:2465 +#: ../../library/datetime.rst:2469 msgid "Locale's equivalent of either AM or PM." msgstr "" @@ -3793,128 +3802,128 @@ msgstr "AM, PM (en_US);" msgid "am, pm (de_DE)" msgstr "am, pm (de_DE)" -#: ../../library/datetime.rst:2465 +#: ../../library/datetime.rst:2469 msgid "\\(1), \\(3)" msgstr "\\(1), \\(3)" -#: ../../library/datetime.rst:2468 +#: ../../library/datetime.rst:2472 msgid "``%M``" msgstr "``%M``" -#: ../../library/datetime.rst:2468 +#: ../../library/datetime.rst:2472 msgid "Minute as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2468 ../../library/datetime.rst:2471 +#: ../../library/datetime.rst:2472 ../../library/datetime.rst:2475 msgid "00, 01, ..., 59" msgstr "00, 01, ..., 59" -#: ../../library/datetime.rst:2471 +#: ../../library/datetime.rst:2475 msgid "``%S``" msgstr "``%S``" -#: ../../library/datetime.rst:2471 +#: ../../library/datetime.rst:2475 msgid "Second as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2471 +#: ../../library/datetime.rst:2475 msgid "\\(4), \\(9)" msgstr "\\(4), \\(9)" -#: ../../library/datetime.rst:2474 +#: ../../library/datetime.rst:2478 msgid "``%f``" msgstr "``%f``" -#: ../../library/datetime.rst:2474 +#: ../../library/datetime.rst:2478 msgid "Microsecond as a decimal number, zero-padded to 6 digits." msgstr "" -#: ../../library/datetime.rst:2474 +#: ../../library/datetime.rst:2478 msgid "000000, 000001, ..., 999999" msgstr "000000, 000001, ..., 999999" -#: ../../library/datetime.rst:2474 +#: ../../library/datetime.rst:2478 msgid "\\(5)" msgstr "\\(5)" -#: ../../library/datetime.rst:2478 ../../library/datetime.rst:2637 +#: ../../library/datetime.rst:2482 ../../library/datetime.rst:2641 msgid "``%z``" msgstr "``%z``" -#: ../../library/datetime.rst:2478 +#: ../../library/datetime.rst:2482 msgid "" "UTC offset in the form ``±HHMM[SS[.ffffff]]`` (empty string if the object is " "naive)." msgstr "" -#: ../../library/datetime.rst:2478 +#: ../../library/datetime.rst:2482 msgid "(empty), +0000, -0400, +1030, +063415, -030712.345216" msgstr "" -#: ../../library/datetime.rst:2478 ../../library/datetime.rst:2483 -#: ../../library/datetime.rst:2540 +#: ../../library/datetime.rst:2482 ../../library/datetime.rst:2487 +#: ../../library/datetime.rst:2544 msgid "\\(6)" msgstr "\\(6)" -#: ../../library/datetime.rst:2483 ../../library/datetime.rst:2663 +#: ../../library/datetime.rst:2487 ../../library/datetime.rst:2667 msgid "``%Z``" msgstr "``%Z``" -#: ../../library/datetime.rst:2483 +#: ../../library/datetime.rst:2487 msgid "Time zone name (empty string if the object is naive)." msgstr "" -#: ../../library/datetime.rst:2483 +#: ../../library/datetime.rst:2487 msgid "(empty), UTC, GMT" msgstr "" -#: ../../library/datetime.rst:2486 +#: ../../library/datetime.rst:2490 msgid "``%j``" msgstr "``%j``" -#: ../../library/datetime.rst:2486 +#: ../../library/datetime.rst:2490 msgid "Day of the year as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2486 +#: ../../library/datetime.rst:2490 msgid "001, 002, ..., 366" msgstr "001, 002, ..., 366" -#: ../../library/datetime.rst:2489 +#: ../../library/datetime.rst:2493 msgid "``%U``" msgstr "``%U``" -#: ../../library/datetime.rst:2489 +#: ../../library/datetime.rst:2493 msgid "" "Week number of the year (Sunday as the first day of the week) as a zero-" "padded decimal number. All days in a new year preceding the first Sunday are " "considered to be in week 0." msgstr "" -#: ../../library/datetime.rst:2489 ../../library/datetime.rst:2497 +#: ../../library/datetime.rst:2493 ../../library/datetime.rst:2501 msgid "00, 01, ..., 53" msgstr "00, 01, ..., 53" -#: ../../library/datetime.rst:2489 ../../library/datetime.rst:2497 +#: ../../library/datetime.rst:2493 ../../library/datetime.rst:2501 msgid "\\(7), \\(9)" msgstr "\\(7), \\(9)" -#: ../../library/datetime.rst:2497 +#: ../../library/datetime.rst:2501 msgid "``%W``" msgstr "``%W``" -#: ../../library/datetime.rst:2497 +#: ../../library/datetime.rst:2501 msgid "" "Week number of the year (Monday as the first day of the week) as a zero-" "padded decimal number. All days in a new year preceding the first Monday are " "considered to be in week 0." msgstr "" -#: ../../library/datetime.rst:2505 +#: ../../library/datetime.rst:2509 msgid "``%c``" msgstr "``%c``" -#: ../../library/datetime.rst:2505 +#: ../../library/datetime.rst:2509 msgid "Locale's appropriate date and time representation." msgstr "" @@ -3926,11 +3935,11 @@ msgstr "" msgid "Di 16 Aug 21:30:00 1988 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2510 +#: ../../library/datetime.rst:2514 msgid "``%x``" msgstr "``%x``" -#: ../../library/datetime.rst:2510 +#: ../../library/datetime.rst:2514 msgid "Locale's appropriate date representation." msgstr "" @@ -3946,11 +3955,11 @@ msgstr "" msgid "16.08.1988 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2514 +#: ../../library/datetime.rst:2518 msgid "``%X``" msgstr "``%X``" -#: ../../library/datetime.rst:2514 +#: ../../library/datetime.rst:2518 msgid "Locale's appropriate time representation." msgstr "" @@ -3962,83 +3971,83 @@ msgstr "" msgid "21:30:00 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2521 msgid "``%%``" msgstr "``%%``" -#: ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2521 msgid "A literal ``'%'`` character." msgstr "" -#: ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2521 msgid "%" msgstr "%" -#: ../../library/datetime.rst:2520 +#: ../../library/datetime.rst:2524 msgid "" "Several additional directives not required by the C89 standard are included " "for convenience. These parameters all correspond to ISO 8601 date values." msgstr "" -#: ../../library/datetime.rst:2526 +#: ../../library/datetime.rst:2530 msgid "``%G``" msgstr "``%G``" -#: ../../library/datetime.rst:2526 +#: ../../library/datetime.rst:2530 msgid "" "ISO 8601 year with century representing the year that contains the greater " "part of the ISO week (``%V``)." msgstr "" -#: ../../library/datetime.rst:2526 +#: ../../library/datetime.rst:2530 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/datetime.rst:2531 +#: ../../library/datetime.rst:2535 msgid "``%u``" msgstr "``%u``" -#: ../../library/datetime.rst:2531 +#: ../../library/datetime.rst:2535 msgid "ISO 8601 weekday as a decimal number where 1 is Monday." msgstr "" -#: ../../library/datetime.rst:2531 +#: ../../library/datetime.rst:2535 msgid "1, 2, ..., 7" msgstr "1, 2, ..., 7" -#: ../../library/datetime.rst:2534 +#: ../../library/datetime.rst:2538 msgid "``%V``" msgstr "``%V``" -#: ../../library/datetime.rst:2534 +#: ../../library/datetime.rst:2538 msgid "" "ISO 8601 week as a decimal number with Monday as the first day of the week. " "Week 01 is the week containing Jan 4." msgstr "" -#: ../../library/datetime.rst:2534 +#: ../../library/datetime.rst:2538 msgid "01, 02, ..., 53" msgstr "01, 02, ..., 53" -#: ../../library/datetime.rst:2534 +#: ../../library/datetime.rst:2538 msgid "\\(8), \\(9)" msgstr "\\(8), \\(9)" -#: ../../library/datetime.rst:2540 ../../library/datetime.rst:2659 +#: ../../library/datetime.rst:2544 ../../library/datetime.rst:2663 msgid "``%:z``" msgstr "``%:z``" -#: ../../library/datetime.rst:2540 +#: ../../library/datetime.rst:2544 msgid "" "UTC offset in the form ``±HH:MM[:SS[.ffffff]]`` (empty string if the object " "is naive)." msgstr "" -#: ../../library/datetime.rst:2540 +#: ../../library/datetime.rst:2544 msgid "(empty), +00:00, -04:00, +10:30, +06:34:15, -03:07:12.345216" msgstr "" -#: ../../library/datetime.rst:2546 +#: ../../library/datetime.rst:2550 msgid "" "These may not be available on all platforms when used with the :meth:`~." "datetime.strftime` method. The ISO 8601 year and ISO 8601 week directives " @@ -4047,7 +4056,7 @@ msgid "" "directives will raise a :exc:`ValueError`." msgstr "" -#: ../../library/datetime.rst:2551 +#: ../../library/datetime.rst:2555 msgid "" "The full set of format codes supported varies across platforms, because " "Python calls the platform C library's :c:func:`strftime` function, and " @@ -4057,44 +4066,44 @@ msgid "" "unsupported format specifiers." msgstr "" -#: ../../library/datetime.rst:2557 +#: ../../library/datetime.rst:2561 msgid "``%G``, ``%u`` and ``%V`` were added." msgstr "新增 ``%G``、``%u`` 與 ``%V``。" -#: ../../library/datetime.rst:2560 +#: ../../library/datetime.rst:2564 msgid "``%:z`` was added." msgstr "新增 ``%:z``。" -#: ../../library/datetime.rst:2564 +#: ../../library/datetime.rst:2568 msgid "Technical Detail" msgstr "技術細節" -#: ../../library/datetime.rst:2566 +#: ../../library/datetime.rst:2570 msgid "" "Broadly speaking, ``d.strftime(fmt)`` acts like the :mod:`time` module's " "``time.strftime(fmt, d.timetuple())`` although not all objects support a :" "meth:`~date.timetuple` method." msgstr "" -#: ../../library/datetime.rst:2570 +#: ../../library/datetime.rst:2574 msgid "" "For the :meth:`.datetime.strptime` class method, the default value is " "``1900-01-01T00:00:00.000``: any components not specified in the format " "string will be pulled from the default value. [#]_" msgstr "" -#: ../../library/datetime.rst:2574 +#: ../../library/datetime.rst:2578 msgid "Using ``datetime.strptime(date_string, format)`` is equivalent to::" msgstr "" -#: ../../library/datetime.rst:2578 +#: ../../library/datetime.rst:2582 msgid "" "except when the format includes sub-second components or time zone offset " "information, which are supported in ``datetime.strptime`` but are discarded " "by ``time.strptime``." msgstr "" -#: ../../library/datetime.rst:2582 +#: ../../library/datetime.rst:2586 msgid "" "For :class:`.time` objects, the format codes for year, month, and day should " "not be used, as :class:`!time` objects have no such values. If they're used " @@ -4104,7 +4113,7 @@ msgstr "" "time` 物件並沒有這些值。如果使用這些格式碼,年份會以 1900 代替、月及日會以 1 " "代替。" -#: ../../library/datetime.rst:2586 +#: ../../library/datetime.rst:2590 msgid "" "For :class:`date` objects, the format codes for hours, minutes, seconds, and " "microseconds should not be used, as :class:`date` objects have no such " @@ -4113,7 +4122,7 @@ msgstr "" "對 :class:`.date` 物件來說,不應該使用時、分、秒、微秒的格式碼,因為 :class:" "`date` 物件並沒有這些值。如果使用這些格式碼,這些值都會以 0 代替。" -#: ../../library/datetime.rst:2590 +#: ../../library/datetime.rst:2594 msgid "" "For the same reason, handling of format strings containing Unicode code " "points that can't be represented in the charset of the current locale is " @@ -4122,7 +4131,7 @@ msgid "" "`UnicodeError` or return an empty string instead." msgstr "" -#: ../../library/datetime.rst:2599 +#: ../../library/datetime.rst:2603 msgid "" "Because the format depends on the current locale, care should be taken when " "making assumptions about the output value. Field orderings will vary (for " @@ -4130,38 +4139,38 @@ msgid "" "contain non-ASCII characters." msgstr "" -#: ../../library/datetime.rst:2605 +#: ../../library/datetime.rst:2609 msgid "" "The :meth:`~.datetime.strptime` method can parse years in the full [1, 9999] " "range, but years < 1000 must be zero-filled to 4-digit width." msgstr "" -#: ../../library/datetime.rst:2608 +#: ../../library/datetime.rst:2612 msgid "" "In previous versions, :meth:`~.datetime.strftime` method was restricted to " "years >= 1900." msgstr "" -#: ../../library/datetime.rst:2612 +#: ../../library/datetime.rst:2616 msgid "" "In version 3.2, :meth:`~.datetime.strftime` method was restricted to years " ">= 1000." msgstr "" -#: ../../library/datetime.rst:2617 +#: ../../library/datetime.rst:2621 msgid "" "When used with the :meth:`~.datetime.strptime` method, the ``%p`` directive " "only affects the output hour field if the ``%I`` directive is used to parse " "the hour." msgstr "" -#: ../../library/datetime.rst:2621 +#: ../../library/datetime.rst:2625 msgid "" "Unlike the :mod:`time` module, the :mod:`!datetime` module does not support " "leap seconds." msgstr "" -#: ../../library/datetime.rst:2625 +#: ../../library/datetime.rst:2629 msgid "" "When used with the :meth:`~.datetime.strptime` method, the ``%f`` directive " "accepts from one to six digits and zero pads on the right. ``%f`` is an " @@ -4169,17 +4178,17 @@ msgid "" "separately in datetime objects, and therefore always available)." msgstr "" -#: ../../library/datetime.rst:2632 +#: ../../library/datetime.rst:2636 msgid "" "For a naive object, the ``%z``, ``%:z`` and ``%Z`` format codes are replaced " "by empty strings." msgstr "" -#: ../../library/datetime.rst:2635 +#: ../../library/datetime.rst:2639 msgid "For an aware object:" msgstr "" -#: ../../library/datetime.rst:2638 +#: ../../library/datetime.rst:2642 msgid "" ":meth:`~.datetime.utcoffset` is transformed into a string of the form " "``±HHMM[SS[.ffffff]]``, where ``HH`` is a 2-digit string giving the number " @@ -4193,7 +4202,7 @@ msgid "" "replaced with the string ``'-0330'``." msgstr "" -#: ../../library/datetime.rst:2652 +#: ../../library/datetime.rst:2656 msgid "" "When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` " "method, the UTC offsets can have a colon as a separator between hours, " @@ -4202,53 +4211,53 @@ msgid "" "``'+00:00'``." msgstr "" -#: ../../library/datetime.rst:2660 +#: ../../library/datetime.rst:2664 msgid "" "Behaves exactly as ``%z``, but has a colon separator added between hours, " "minutes and seconds." msgstr "" -#: ../../library/datetime.rst:2664 +#: ../../library/datetime.rst:2668 msgid "" "In :meth:`~.datetime.strftime`, ``%Z`` is replaced by an empty string if :" "meth:`~.datetime.tzname` returns ``None``; otherwise ``%Z`` is replaced by " "the returned value, which must be a string." msgstr "" -#: ../../library/datetime.rst:2668 +#: ../../library/datetime.rst:2672 msgid ":meth:`~.datetime.strptime` only accepts certain values for ``%Z``:" msgstr "" -#: ../../library/datetime.rst:2670 +#: ../../library/datetime.rst:2674 msgid "any value in ``time.tzname`` for your machine's locale" msgstr "" -#: ../../library/datetime.rst:2671 +#: ../../library/datetime.rst:2675 msgid "the hard-coded values ``UTC`` and ``GMT``" msgstr "" -#: ../../library/datetime.rst:2673 +#: ../../library/datetime.rst:2677 msgid "" "So someone living in Japan may have ``JST``, ``UTC``, and ``GMT`` as valid " "values, but probably not ``EST``. It will raise ``ValueError`` for invalid " "values." msgstr "" -#: ../../library/datetime.rst:2677 +#: ../../library/datetime.rst:2681 msgid "" "When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` " "method, an aware :class:`.datetime` object will be produced. The ``tzinfo`` " "of the result will be set to a :class:`timezone` instance." msgstr "" -#: ../../library/datetime.rst:2683 +#: ../../library/datetime.rst:2687 msgid "" "When used with the :meth:`~.datetime.strptime` method, ``%U`` and ``%W`` are " "only used in calculations when the day of the week and the calendar year " "(``%Y``) are specified." msgstr "" -#: ../../library/datetime.rst:2688 +#: ../../library/datetime.rst:2692 msgid "" "Similar to ``%U`` and ``%W``, ``%V`` is only used in calculations when the " "day of the week and the ISO year (``%G``) are specified in a :meth:`~." @@ -4256,7 +4265,7 @@ msgid "" "interchangeable." msgstr "" -#: ../../library/datetime.rst:2694 +#: ../../library/datetime.rst:2698 msgid "" "When used with the :meth:`~.datetime.strptime` method, the leading zero is " "optional for formats ``%d``, ``%m``, ``%H``, ``%I``, ``%M``, ``%S``, " @@ -4264,7 +4273,7 @@ msgid "" "zero." msgstr "" -#: ../../library/datetime.rst:2699 +#: ../../library/datetime.rst:2703 msgid "" "When parsing a month and day using :meth:`~.datetime.strptime`, always " "include a year in the format. If the value you need to parse lacks a year, " @@ -4273,7 +4282,7 @@ msgid "" "parser is not a leap year. Users run into this bug every four years..." msgstr "" -#: ../../library/datetime.rst:2705 +#: ../../library/datetime.rst:2709 msgid "" ">>> month_day = \"02/29\"\n" ">>> datetime.strptime(f\"{month_day};1984\", \"%m/%d;%Y\") # No leap year " @@ -4281,7 +4290,7 @@ msgid "" "datetime.datetime(1984, 2, 29, 0, 0)" msgstr "" -#: ../../library/datetime.rst:2711 +#: ../../library/datetime.rst:2715 msgid "" ":meth:`~.datetime.strptime` calls using a format string containing a day of " "month without a year now emit a :exc:`DeprecationWarning`. In 3.15 or later " @@ -4289,15 +4298,15 @@ msgid "" "See :gh:`70647`." msgstr "" -#: ../../library/datetime.rst:2718 +#: ../../library/datetime.rst:2722 msgid "Footnotes" msgstr "註解" -#: ../../library/datetime.rst:2719 +#: ../../library/datetime.rst:2723 msgid "If, that is, we ignore the effects of Relativity" msgstr "也就是說,我們會忽略相對論的效應" -#: ../../library/datetime.rst:2721 +#: ../../library/datetime.rst:2725 msgid "" "This matches the definition of the \"proleptic Gregorian\" calendar in " "Dershowitz and Reingold's book *Calendrical Calculations*, where it's the " @@ -4306,23 +4315,23 @@ msgid "" "systems." msgstr "" -#: ../../library/datetime.rst:2727 +#: ../../library/datetime.rst:2731 msgid "" "See R. H. van Gent's `guide to the mathematics of the ISO 8601 calendar " "`_ for a good explanation." msgstr "" -#: ../../library/datetime.rst:2731 +#: ../../library/datetime.rst:2735 msgid "" "Passing ``datetime.strptime('Feb 29', '%b %d')`` will fail since 1900 is not " "a leap year." msgstr "" -#: ../../library/datetime.rst:2372 +#: ../../library/datetime.rst:2376 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/datetime.rst:2372 +#: ../../library/datetime.rst:2376 msgid "datetime format" msgstr "datetime format(日期時間格式)" diff --git a/library/dbm.po b/library/dbm.po index d8cdda7b2e..a3a5e9c26d 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -251,9 +251,9 @@ msgid "" "including the SQLite CLI." msgstr "" -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +#: ../../includes/wasm-mobile-notavail.rst:3 ../../includes/wasm-notavail.rst:3 +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -301,10 +301,6 @@ msgid "" "incompatible and can not be used interchangeably." msgstr "" -#: ../../includes/wasm-mobile-notavail.rst:3 -msgid ":ref:`Availability `: not Android, not iOS, not WASI." -msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" - #: ../../includes/wasm-mobile-notavail.rst:5 msgid "" "This module is not supported on :ref:`mobile platforms \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -721,8 +721,8 @@ msgstr "" msgid "Implements ``STACK[-1] = not STACK[-1]``." msgstr "" -#: ../../library/dis.rst:618 ../../library/dis.rst:1313 -#: ../../library/dis.rst:1329 +#: ../../library/dis.rst:618 ../../library/dis.rst:1314 +#: ../../library/dis.rst:1330 msgid "This instruction now requires an exact :class:`bool` operand." msgstr "" @@ -782,9 +782,9 @@ msgstr "" #: ../../library/dis.rst:690 ../../library/dis.rst:698 #: ../../library/dis.rst:710 ../../library/dis.rst:798 #: ../../library/dis.rst:808 ../../library/dis.rst:818 -#: ../../library/dis.rst:1041 ../../library/dis.rst:1052 -#: ../../library/dis.rst:1156 ../../library/dis.rst:1168 -#: ../../library/dis.rst:1180 +#: ../../library/dis.rst:1042 ../../library/dis.rst:1053 +#: ../../library/dis.rst:1157 ../../library/dis.rst:1169 +#: ../../library/dis.rst:1181 msgid "Implements::" msgstr "" @@ -1090,10 +1090,12 @@ msgid "" msgstr "" #: ../../library/dis.rst:960 -msgid "Perform ``STACK.append(len(STACK[-1]))``." +msgid "" +"Perform ``STACK.append(len(STACK[-1]))``. Used in :keyword:`match` " +"statements where comparison with structure of pattern is needed." msgstr "" -#: ../../library/dis.rst:967 +#: ../../library/dis.rst:968 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Mapping` (or, " "more technically: if it has the :c:macro:`Py_TPFLAGS_MAPPING` flag set in " @@ -1101,7 +1103,7 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:977 +#: ../../library/dis.rst:978 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Sequence` and is " "*not* an instance of :class:`str`/:class:`bytes`/:class:`bytearray` (or, " @@ -1110,20 +1112,20 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:987 +#: ../../library/dis.rst:988 msgid "" "``STACK[-1]`` is a tuple of mapping keys, and ``STACK[-2]`` is the match " "subject. If ``STACK[-2]`` contains all of the keys in ``STACK[-1]``, push a :" "class:`tuple` containing the corresponding values. Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:993 ../../library/dis.rst:1664 +#: ../../library/dis.rst:994 ../../library/dis.rst:1665 msgid "" "Previously, this instruction also pushed a boolean value indicating success " "(``True``) or failure (``False``)." msgstr "" -#: ../../library/dis.rst:1000 +#: ../../library/dis.rst:1001 msgid "" "Implements ``name = STACK.pop()``. *namei* is the index of *name* in the " "attribute :attr:`~codeobject.co_names` of the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:1013 +#: ../../library/dis.rst:1014 msgid "" "Unpacks ``STACK[-1]`` into *count* individual values, which are put onto the " "stack right-to-left. Require there to be exactly *count* values.::" msgstr "" -#: ../../library/dis.rst:1016 +#: ../../library/dis.rst:1017 msgid "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" @@ -1151,7 +1153,7 @@ msgstr "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" -#: ../../library/dis.rst:1022 +#: ../../library/dis.rst:1023 msgid "" "Implements assignment with a starred target: Unpacks an iterable in " "``STACK[-1]`` into individual values, where the total number of values can " @@ -1159,11 +1161,11 @@ msgid "" "will be a list of all leftover items." msgstr "" -#: ../../library/dis.rst:1027 +#: ../../library/dis.rst:1028 msgid "The number of values before and after the list value is limited to 255." msgstr "" -#: ../../library/dis.rst:1029 +#: ../../library/dis.rst:1030 msgid "" "The number of values before the list value is encoded in the argument of the " "opcode. The number of values after the list if any is encoded using an " @@ -1172,13 +1174,13 @@ msgid "" "list value, the high byte of *counts* the number of values after it." msgstr "" -#: ../../library/dis.rst:1035 +#: ../../library/dis.rst:1036 msgid "" "The extracted values are put onto the stack right-to-left, i.e. ``a, *b, c = " "d`` will be stored after execution as ``STACK.extend((a, b, c))``." msgstr "" -#: ../../library/dis.rst:1043 +#: ../../library/dis.rst:1044 msgid "" "obj = STACK.pop()\n" "value = STACK.pop()\n" @@ -1188,13 +1190,13 @@ msgstr "" "value = STACK.pop()\n" "obj.name = value" -#: ../../library/dis.rst:1047 +#: ../../library/dis.rst:1048 msgid "" "where *namei* is the index of name in :attr:`~codeobject.co_names` of the :" "ref:`code object `." msgstr "" -#: ../../library/dis.rst:1054 +#: ../../library/dis.rst:1055 msgid "" "obj = STACK.pop()\n" "del obj.name" @@ -1202,38 +1204,38 @@ msgstr "" "obj = STACK.pop()\n" "del obj.name" -#: ../../library/dis.rst:1057 +#: ../../library/dis.rst:1058 msgid "" "where *namei* is the index of name into :attr:`~codeobject.co_names` of the :" "ref:`code object `." msgstr "" -#: ../../library/dis.rst:1063 +#: ../../library/dis.rst:1064 msgid "Works as :opcode:`STORE_NAME`, but stores the name as a global." msgstr "" -#: ../../library/dis.rst:1068 +#: ../../library/dis.rst:1069 msgid "Works as :opcode:`DELETE_NAME`, but deletes a global name." msgstr "" -#: ../../library/dis.rst:1073 +#: ../../library/dis.rst:1074 msgid "Pushes ``co_consts[consti]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1078 +#: ../../library/dis.rst:1079 msgid "" "Pushes the value associated with ``co_names[namei]`` onto the stack. The " "name is looked up within the locals, then the globals, then the builtins." msgstr "" -#: ../../library/dis.rst:1084 +#: ../../library/dis.rst:1085 msgid "" "Pushes a reference to the locals dictionary onto the stack. This is used to " "prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` and :" "opcode:`LOAD_FROM_DICT_OR_GLOBALS`." msgstr "" -#: ../../library/dis.rst:1093 +#: ../../library/dis.rst:1094 msgid "" "Pops a mapping off the stack and looks up the value for ``co_names[namei]``. " "If the name is not found there, looks it up in the globals and then the " @@ -1242,13 +1244,13 @@ msgid "" "bodies." msgstr "" -#: ../../library/dis.rst:1104 +#: ../../library/dis.rst:1105 msgid "" "Creates a tuple consuming *count* items from the stack, and pushes the " "resulting tuple onto the stack::" msgstr "" -#: ../../library/dis.rst:1107 +#: ../../library/dis.rst:1108 msgid "" "if count == 0:\n" " value = ()\n" @@ -1266,41 +1268,41 @@ msgstr "" "\n" "STACK.append(value)" -#: ../../library/dis.rst:1118 +#: ../../library/dis.rst:1119 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a list." msgstr "" -#: ../../library/dis.rst:1123 +#: ../../library/dis.rst:1124 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a set." msgstr "" -#: ../../library/dis.rst:1128 +#: ../../library/dis.rst:1129 msgid "" "Pushes a new dictionary object onto the stack. Pops ``2 * count`` items so " "that the dictionary holds *count* entries: ``{..., STACK[-4]: STACK[-3], " "STACK[-2]: STACK[-1]}``." msgstr "" -#: ../../library/dis.rst:1132 +#: ../../library/dis.rst:1133 msgid "" "The dictionary is created from stack items instead of creating an empty " "dictionary pre-sized to hold *count* items." msgstr "" -#: ../../library/dis.rst:1139 +#: ../../library/dis.rst:1140 msgid "" "The version of :opcode:`BUILD_MAP` specialized for constant keys. Pops the " "top element on the stack which contains a tuple of keys, then starting from " "``STACK[-2]``, pops *count* values to form values in the built dictionary." msgstr "" -#: ../../library/dis.rst:1148 +#: ../../library/dis.rst:1149 msgid "" "Concatenates *count* strings from the stack and pushes the resulting string " "onto the stack." msgstr "" -#: ../../library/dis.rst:1158 +#: ../../library/dis.rst:1159 msgid "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" @@ -1308,11 +1310,11 @@ msgstr "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" -#: ../../library/dis.rst:1161 +#: ../../library/dis.rst:1162 msgid "Used to build lists." msgstr "" -#: ../../library/dis.rst:1170 +#: ../../library/dis.rst:1171 msgid "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" @@ -1320,11 +1322,11 @@ msgstr "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" -#: ../../library/dis.rst:1173 +#: ../../library/dis.rst:1174 msgid "Used to build sets." msgstr "" -#: ../../library/dis.rst:1182 +#: ../../library/dis.rst:1183 msgid "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" @@ -1332,21 +1334,21 @@ msgstr "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" -#: ../../library/dis.rst:1185 +#: ../../library/dis.rst:1186 msgid "Used to build dicts." msgstr "" -#: ../../library/dis.rst:1192 +#: ../../library/dis.rst:1193 msgid "Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys." msgstr "" -#: ../../library/dis.rst:1199 +#: ../../library/dis.rst:1200 msgid "" "If the low bit of ``namei`` is not set, this replaces ``STACK[-1]`` with " "``getattr(STACK[-1], co_names[namei>>1])``." msgstr "" -#: ../../library/dis.rst:1202 +#: ../../library/dis.rst:1203 msgid "" "If the low bit of ``namei`` is set, this will attempt to load a method named " "``co_names[namei>>1]`` from the ``STACK[-1]`` object. ``STACK[-1]`` is " @@ -1358,76 +1360,76 @@ msgid "" "pushed." msgstr "" -#: ../../library/dis.rst:1211 +#: ../../library/dis.rst:1212 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is pushed to " "the stack before the attribute or unbound method respectively." msgstr "" -#: ../../library/dis.rst:1218 +#: ../../library/dis.rst:1219 msgid "" "This opcode implements :func:`super`, both in its zero-argument and two-" "argument forms (e.g. ``super().method()``, ``super().attr`` and ``super(cls, " "self).method()``, ``super(cls, self).attr``)." msgstr "" -#: ../../library/dis.rst:1222 +#: ../../library/dis.rst:1223 msgid "It pops three values from the stack (from top of stack down):" msgstr "" -#: ../../library/dis.rst:1224 +#: ../../library/dis.rst:1225 msgid "``self``: the first argument to the current method" msgstr "" -#: ../../library/dis.rst:1225 +#: ../../library/dis.rst:1226 msgid "``cls``: the class within which the current method was defined" msgstr "" -#: ../../library/dis.rst:1226 +#: ../../library/dis.rst:1227 msgid "the global ``super``" msgstr "" -#: ../../library/dis.rst:1228 +#: ../../library/dis.rst:1229 msgid "" "With respect to its argument, it works similarly to :opcode:`LOAD_ATTR`, " "except that ``namei`` is shifted left by 2 bits instead of 1." msgstr "" -#: ../../library/dis.rst:1231 +#: ../../library/dis.rst:1232 msgid "" "The low bit of ``namei`` signals to attempt a method load, as with :opcode:" "`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded method. When " "it is unset a single value is pushed to the stack." msgstr "" -#: ../../library/dis.rst:1235 +#: ../../library/dis.rst:1236 msgid "" "The second-low bit of ``namei``, if set, means that this was a two-argument " "call to :func:`super` (unset means zero-argument)." msgstr "" -#: ../../library/dis.rst:1243 +#: ../../library/dis.rst:1244 msgid "" "Performs a Boolean operation. The operation name can be found in " "``cmp_op[opname >> 5]``. If the fifth-lowest bit of ``opname`` is set " "(``opname & 16``), the result should be coerced to ``bool``." msgstr "" -#: ../../library/dis.rst:1247 +#: ../../library/dis.rst:1248 msgid "" "The fifth-lowest bit of the oparg now indicates a forced conversion to :" "class:`bool`." msgstr "" -#: ../../library/dis.rst:1254 +#: ../../library/dis.rst:1255 msgid "Performs ``is`` comparison, or ``is not`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1261 +#: ../../library/dis.rst:1262 msgid "Performs ``in`` comparison, or ``not in`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1268 +#: ../../library/dis.rst:1269 msgid "" "Imports the module ``co_names[namei]``. ``STACK[-1]`` and ``STACK[-2]`` are " "popped and provide the *fromlist* and *level* arguments of :func:" @@ -1436,68 +1438,68 @@ msgid "" "opcode:`STORE_FAST` instruction modifies the namespace." msgstr "" -#: ../../library/dis.rst:1276 +#: ../../library/dis.rst:1277 msgid "" "Loads the attribute ``co_names[namei]`` from the module found in " "``STACK[-1]``. The resulting object is pushed onto the stack, to be " "subsequently stored by a :opcode:`STORE_FAST` instruction." msgstr "" -#: ../../library/dis.rst:1283 +#: ../../library/dis.rst:1284 msgid "Increments bytecode counter by *delta*." msgstr "" -#: ../../library/dis.rst:1288 +#: ../../library/dis.rst:1289 msgid "Decrements bytecode counter by *delta*. Checks for interrupts." msgstr "" -#: ../../library/dis.rst:1295 +#: ../../library/dis.rst:1296 msgid "Decrements bytecode counter by *delta*. Does not check for interrupts." msgstr "" -#: ../../library/dis.rst:1302 +#: ../../library/dis.rst:1303 msgid "" "If ``STACK[-1]`` is true, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1305 ../../library/dis.rst:1321 +#: ../../library/dis.rst:1306 ../../library/dis.rst:1322 msgid "" "The oparg is now a relative delta rather than an absolute target. This " "opcode is a pseudo-instruction, replaced in final bytecode by the directed " "versions (forward/backward)." msgstr "" -#: ../../library/dis.rst:1310 ../../library/dis.rst:1326 -#: ../../library/dis.rst:1342 ../../library/dis.rst:1356 +#: ../../library/dis.rst:1311 ../../library/dis.rst:1327 +#: ../../library/dis.rst:1343 ../../library/dis.rst:1357 msgid "This is no longer a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1318 +#: ../../library/dis.rst:1319 msgid "" "If ``STACK[-1]`` is false, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1334 +#: ../../library/dis.rst:1335 msgid "" "If ``STACK[-1]`` is not ``None``, increments the bytecode counter by " "*delta*. ``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1337 ../../library/dis.rst:1351 +#: ../../library/dis.rst:1338 ../../library/dis.rst:1352 msgid "" "This opcode is a pseudo-instruction, replaced in final bytecode by the " "directed versions (forward/backward)." msgstr "" -#: ../../library/dis.rst:1348 +#: ../../library/dis.rst:1349 msgid "" "If ``STACK[-1]`` is ``None``, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1361 +#: ../../library/dis.rst:1362 msgid "" "``STACK[-1]`` is an :term:`iterator`. Call its :meth:`~iterator.__next__` " "method. If this yields a new value, push it on the stack (leaving the " @@ -1505,186 +1507,188 @@ msgid "" "code counter is incremented by *delta*." msgstr "" -#: ../../library/dis.rst:1366 +#: ../../library/dis.rst:1367 msgid "Up until 3.11 the iterator was popped when it was exhausted." msgstr "" -#: ../../library/dis.rst:1371 +#: ../../library/dis.rst:1372 msgid "Loads the global named ``co_names[namei>>1]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1373 +#: ../../library/dis.rst:1374 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` is pushed to the stack " "before the global variable." msgstr "" -#: ../../library/dis.rst:1379 +#: ../../library/dis.rst:1380 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1381 +#: ../../library/dis.rst:1382 msgid "" "This opcode is now only used in situations where the local variable is " "guaranteed to be initialized. It cannot raise :exc:`UnboundLocalError`." msgstr "" -#: ../../library/dis.rst:1387 +#: ../../library/dis.rst:1388 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack, " "raising an :exc:`UnboundLocalError` if the local variable has not been " "initialized." msgstr "" -#: ../../library/dis.rst:1395 +#: ../../library/dis.rst:1396 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack (or " "pushes ``NULL`` onto the stack if the local variable has not been " "initialized) and sets ``co_varnames[var_num]`` to ``NULL``." msgstr "" -#: ../../library/dis.rst:1403 +#: ../../library/dis.rst:1404 msgid "Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1408 +#: ../../library/dis.rst:1409 msgid "Deletes local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1413 +#: ../../library/dis.rst:1414 msgid "" "Creates a new cell in slot ``i``. If that slot is nonempty then that value " "is stored into the new cell." msgstr "" -#: ../../library/dis.rst:1421 +#: ../../library/dis.rst:1422 msgid "" "Loads the cell contained in slot ``i`` of the \"fast locals\" storage. " "Pushes a reference to the object the cell contains on the stack." msgstr "" -#: ../../library/dis.rst:1424 ../../library/dis.rst:1446 -#: ../../library/dis.rst:1457 +#: ../../library/dis.rst:1425 ../../library/dis.rst:1447 +#: ../../library/dis.rst:1458 msgid "" "``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`." msgstr "" -#: ../../library/dis.rst:1430 +#: ../../library/dis.rst:1431 msgid "" "Pops a mapping off the stack and looks up the name associated with slot " "``i`` of the \"fast locals\" storage in this mapping. If the name is not " "found there, loads it from the cell contained in slot ``i``, similar to :" -"opcode:`LOAD_DEREF`. This is used for loading free variables in class bodies " -"(which previously used :opcode:`!LOAD_CLASSDEREF`) and in :ref:`annotation " -"scopes ` within class bodies." +"opcode:`LOAD_DEREF`. This is used for loading :term:`closure variables " +"` in class bodies (which previously used :opcode:`!" +"LOAD_CLASSDEREF`) and in :ref:`annotation scopes ` within " +"class bodies." msgstr "" -#: ../../library/dis.rst:1443 +#: ../../library/dis.rst:1444 msgid "" "Stores ``STACK.pop()`` into the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1452 +#: ../../library/dis.rst:1453 msgid "" "Empties the cell contained in slot ``i`` of the \"fast locals\" storage. " "Used by the :keyword:`del` statement." msgstr "" -#: ../../library/dis.rst:1463 +#: ../../library/dis.rst:1464 msgid "" -"Copies the ``n`` free variables from the closure into the frame. Removes the " -"need for special code on the caller's side when calling closures." +"Copies the ``n`` :term:`free (closure) variables ` from " +"the closure into the frame. Removes the need for special code on the " +"caller's side when calling closures." msgstr "" -#: ../../library/dis.rst:1472 +#: ../../library/dis.rst:1473 msgid "" "Raises an exception using one of the 3 forms of the ``raise`` statement, " "depending on the value of *argc*:" msgstr "" -#: ../../library/dis.rst:1475 +#: ../../library/dis.rst:1476 msgid "0: ``raise`` (re-raise previous exception)" msgstr "" -#: ../../library/dis.rst:1476 +#: ../../library/dis.rst:1477 msgid "" "1: ``raise STACK[-1]`` (raise exception instance or type at ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1477 +#: ../../library/dis.rst:1478 msgid "" "2: ``raise STACK[-2] from STACK[-1]`` (raise exception instance or type at " "``STACK[-2]`` with ``__cause__`` set to ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1483 +#: ../../library/dis.rst:1484 msgid "" "Calls a callable object with the number of arguments specified by ``argc``. " "On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1486 ../../library/dis.rst:1510 +#: ../../library/dis.rst:1487 ../../library/dis.rst:1511 msgid "The callable" msgstr "" -#: ../../library/dis.rst:1487 ../../library/dis.rst:1511 +#: ../../library/dis.rst:1488 ../../library/dis.rst:1512 msgid "``self`` or ``NULL``" msgstr "" -#: ../../library/dis.rst:1488 ../../library/dis.rst:1512 +#: ../../library/dis.rst:1489 ../../library/dis.rst:1513 msgid "The remaining positional arguments" msgstr "" -#: ../../library/dis.rst:1490 +#: ../../library/dis.rst:1491 msgid "``argc`` is the total of the positional arguments, excluding ``self``." msgstr "" -#: ../../library/dis.rst:1492 +#: ../../library/dis.rst:1493 msgid "" "``CALL`` pops all arguments and the callable object off the stack, calls the " "callable object with those arguments, and pushes the return value returned " "by the callable object." msgstr "" -#: ../../library/dis.rst:1498 +#: ../../library/dis.rst:1499 msgid "The callable now always appears at the same position on the stack." msgstr "" -#: ../../library/dis.rst:1501 +#: ../../library/dis.rst:1502 msgid "Calls with keyword arguments are now handled by :opcode:`CALL_KW`." msgstr "" -#: ../../library/dis.rst:1507 +#: ../../library/dis.rst:1508 msgid "" "Calls a callable object with the number of arguments specified by ``argc``, " "including one or more named arguments. On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1513 +#: ../../library/dis.rst:1514 msgid "The named arguments" msgstr "" -#: ../../library/dis.rst:1514 +#: ../../library/dis.rst:1515 msgid "A :class:`tuple` of keyword argument names" msgstr "" -#: ../../library/dis.rst:1516 +#: ../../library/dis.rst:1517 msgid "" "``argc`` is the total of the positional and named arguments, excluding " "``self``. The length of the tuple of keyword argument names is the number of " "named arguments." msgstr "" -#: ../../library/dis.rst:1519 +#: ../../library/dis.rst:1520 msgid "" "``CALL_KW`` pops all arguments, the keyword names, and the callable object " "off the stack, calls the callable object with those arguments, and pushes " "the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1528 +#: ../../library/dis.rst:1529 msgid "" "Calls a callable object with variable set of positional and keyword " "arguments. If the lowest bit of *flags* is set, the top of the stack " @@ -1696,33 +1700,33 @@ msgid "" "arguments, and pushes the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1543 +#: ../../library/dis.rst:1544 msgid "" "Pushes a ``NULL`` to the stack. Used in the call sequence to match the " "``NULL`` pushed by :opcode:`LOAD_METHOD` for non-method calls." msgstr "" -#: ../../library/dis.rst:1552 +#: ../../library/dis.rst:1553 msgid "" "Pushes a new function object on the stack built from the code object at " "``STACK[1]``." msgstr "" -#: ../../library/dis.rst:1554 +#: ../../library/dis.rst:1555 msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" msgstr "" -#: ../../library/dis.rst:1557 +#: ../../library/dis.rst:1558 msgid "Qualified name at ``STACK[-1]`` was removed." msgstr "" -#: ../../library/dis.rst:1560 +#: ../../library/dis.rst:1561 msgid "" "Extra function attributes on the stack, signaled by oparg flags, were " "removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`." msgstr "" -#: ../../library/dis.rst:1567 +#: ../../library/dis.rst:1568 msgid "" "Sets an attribute on a function object. Expects the function at " "``STACK[-1]`` and the attribute value to set at ``STACK[-2]``; consumes both " @@ -1730,42 +1734,42 @@ msgid "" "attribute to set:" msgstr "" -#: ../../library/dis.rst:1571 +#: ../../library/dis.rst:1572 msgid "" "``0x01`` a tuple of default values for positional-only and positional-or-" "keyword parameters in positional order" msgstr "" -#: ../../library/dis.rst:1573 +#: ../../library/dis.rst:1574 msgid "``0x02`` a dictionary of keyword-only parameters' default values" msgstr "" -#: ../../library/dis.rst:1574 +#: ../../library/dis.rst:1575 msgid "``0x04`` a tuple of strings containing parameters' annotations" msgstr "" -#: ../../library/dis.rst:1575 +#: ../../library/dis.rst:1576 msgid "``0x08`` a tuple containing cells for free variables, making a closure" msgstr "" -#: ../../library/dis.rst:1584 +#: ../../library/dis.rst:1585 msgid "" "Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, " "implements::" msgstr "" -#: ../../library/dis.rst:1586 +#: ../../library/dis.rst:1587 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" "STACK.append(slice(start, end))" msgstr "" -#: ../../library/dis.rst:1590 +#: ../../library/dis.rst:1591 msgid "if it is 3, implements::" msgstr "" -#: ../../library/dis.rst:1592 +#: ../../library/dis.rst:1593 msgid "" "step = STACK.pop()\n" "end = STACK.pop()\n" @@ -1777,11 +1781,11 @@ msgstr "" "start = STACK.pop()\n" "STACK.append(slice(start, end, step))" -#: ../../library/dis.rst:1597 +#: ../../library/dis.rst:1598 msgid "See the :func:`slice` built-in function for more information." msgstr "" -#: ../../library/dis.rst:1602 +#: ../../library/dis.rst:1603 msgid "" "Prefixes any opcode which has an argument too big to fit into the default " "one byte. *ext* holds an additional byte which act as higher bits in the " @@ -1789,11 +1793,11 @@ msgid "" "allowed, forming an argument from two-byte to four-byte." msgstr "" -#: ../../library/dis.rst:1610 +#: ../../library/dis.rst:1611 msgid "Convert value to a string, depending on ``oparg``::" msgstr "" -#: ../../library/dis.rst:1612 +#: ../../library/dis.rst:1613 msgid "" "value = STACK.pop()\n" "result = func(value)\n" @@ -1803,28 +1807,28 @@ msgstr "" "result = func(value)\n" "STACK.append(result)" -#: ../../library/dis.rst:1616 +#: ../../library/dis.rst:1617 msgid "``oparg == 1``: call :func:`str` on *value*" msgstr "" -#: ../../library/dis.rst:1617 +#: ../../library/dis.rst:1618 msgid "``oparg == 2``: call :func:`repr` on *value*" msgstr "" -#: ../../library/dis.rst:1618 +#: ../../library/dis.rst:1619 msgid "``oparg == 3``: call :func:`ascii` on *value*" msgstr "" -#: ../../library/dis.rst:1620 ../../library/dis.rst:1633 -#: ../../library/dis.rst:1646 +#: ../../library/dis.rst:1621 ../../library/dis.rst:1634 +#: ../../library/dis.rst:1647 msgid "Used for implementing formatted literal strings (f-strings)." msgstr "" -#: ../../library/dis.rst:1627 +#: ../../library/dis.rst:1628 msgid "Formats the value on top of stack::" msgstr "" -#: ../../library/dis.rst:1629 +#: ../../library/dis.rst:1630 msgid "" "value = STACK.pop()\n" "result = value.__format__(\"\")\n" @@ -1834,11 +1838,11 @@ msgstr "" "result = value.__format__(\"\")\n" "STACK.append(result)" -#: ../../library/dis.rst:1639 +#: ../../library/dis.rst:1640 msgid "Formats the given value with the given format spec::" msgstr "" -#: ../../library/dis.rst:1641 +#: ../../library/dis.rst:1642 msgid "" "spec = STACK.pop()\n" "value = STACK.pop()\n" @@ -1850,14 +1854,14 @@ msgstr "" "result = value.__format__(spec)\n" "STACK.append(result)" -#: ../../library/dis.rst:1653 +#: ../../library/dis.rst:1654 msgid "" "``STACK[-1]`` is a tuple of keyword attribute names, ``STACK[-2]`` is the " "class being matched against, and ``STACK[-3]`` is the match subject. " "*count* is the number of positional sub-patterns." msgstr "" -#: ../../library/dis.rst:1657 +#: ../../library/dis.rst:1658 msgid "" "Pop ``STACK[-1]``, ``STACK[-2]``, and ``STACK[-3]``. If ``STACK[-3]`` is an " "instance of ``STACK[-2]`` and has the positional and keyword attributes " @@ -1865,219 +1869,219 @@ msgid "" "Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:1671 +#: ../../library/dis.rst:1672 msgid "A no-op. Performs internal tracing, debugging and optimization checks." msgstr "" -#: ../../library/dis.rst:1673 +#: ../../library/dis.rst:1674 msgid "" "The ``context`` oparand consists of two parts. The lowest two bits indicate " "where the ``RESUME`` occurs:" msgstr "" -#: ../../library/dis.rst:1676 +#: ../../library/dis.rst:1677 msgid "" "``0`` The start of a function, which is neither a generator, coroutine nor " "an async generator" msgstr "" -#: ../../library/dis.rst:1678 +#: ../../library/dis.rst:1679 msgid "``1`` After a ``yield`` expression" msgstr "" -#: ../../library/dis.rst:1679 +#: ../../library/dis.rst:1680 msgid "``2`` After a ``yield from`` expression" msgstr "" -#: ../../library/dis.rst:1680 +#: ../../library/dis.rst:1681 msgid "``3`` After an ``await`` expression" msgstr "" -#: ../../library/dis.rst:1682 +#: ../../library/dis.rst:1683 msgid "" "The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` " "otherwise." msgstr "" -#: ../../library/dis.rst:1687 +#: ../../library/dis.rst:1688 msgid "The oparg value changed to include information about except-depth" msgstr "" -#: ../../library/dis.rst:1693 +#: ../../library/dis.rst:1694 msgid "" "Create a generator, coroutine, or async generator from the current frame. " "Used as first opcode of in code object for the above mentioned callables. " "Clear the current frame and return the newly created generator." msgstr "" -#: ../../library/dis.rst:1702 +#: ../../library/dis.rst:1703 msgid "" "Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])``. Used in ``yield " "from`` and ``await`` statements." msgstr "" -#: ../../library/dis.rst:1705 +#: ../../library/dis.rst:1706 msgid "" "If the call raises :exc:`StopIteration`, pop the top value from the stack, " "push the exception's ``value`` attribute, and increment the bytecode counter " "by *delta*." msgstr "" -#: ../../library/dis.rst:1714 +#: ../../library/dis.rst:1715 msgid "" "This is not really an opcode. It identifies the dividing line between " "opcodes in the range [0,255] which don't use their argument and those that " "do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively)." msgstr "" -#: ../../library/dis.rst:1718 +#: ../../library/dis.rst:1719 msgid "" "If your application uses pseudo instructions or specialized instructions, " "use the :data:`hasarg` collection instead." msgstr "" -#: ../../library/dis.rst:1721 +#: ../../library/dis.rst:1722 msgid "" "Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT`` " "ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument." msgstr "" -#: ../../library/dis.rst:1725 +#: ../../library/dis.rst:1726 msgid "" "Pseudo instructions were added to the :mod:`dis` module, and for them it is " "not true that comparison with ``HAVE_ARGUMENT`` indicates whether they use " "their arg." msgstr "" -#: ../../library/dis.rst:1730 +#: ../../library/dis.rst:1731 msgid "Use :data:`hasarg` instead." msgstr "" -#: ../../library/dis.rst:1735 +#: ../../library/dis.rst:1736 msgid "" "Calls an intrinsic function with one argument. Passes ``STACK[-1]`` as the " "argument and sets ``STACK[-1]`` to the result. Used to implement " "functionality that is not performance critical." msgstr "" -#: ../../library/dis.rst:1739 ../../library/dis.rst:1793 +#: ../../library/dis.rst:1740 ../../library/dis.rst:1794 msgid "The operand determines which intrinsic function is called:" msgstr "" -#: ../../library/dis.rst:1742 ../../library/dis.rst:1796 +#: ../../library/dis.rst:1743 ../../library/dis.rst:1797 msgid "Operand" msgstr "" -#: ../../library/dis.rst:1742 ../../library/dis.rst:1796 +#: ../../library/dis.rst:1743 ../../library/dis.rst:1797 msgid "Description" msgstr "" -#: ../../library/dis.rst:1744 +#: ../../library/dis.rst:1745 msgid "``INTRINSIC_1_INVALID``" msgstr "``INTRINSIC_1_INVALID``" -#: ../../library/dis.rst:1744 ../../library/dis.rst:1798 +#: ../../library/dis.rst:1745 ../../library/dis.rst:1799 msgid "Not valid" msgstr "" -#: ../../library/dis.rst:1746 +#: ../../library/dis.rst:1747 msgid "``INTRINSIC_PRINT``" msgstr "``INTRINSIC_PRINT``" -#: ../../library/dis.rst:1746 +#: ../../library/dis.rst:1747 msgid "Prints the argument to standard out. Used in the REPL." msgstr "" -#: ../../library/dis.rst:1749 +#: ../../library/dis.rst:1750 msgid "``INTRINSIC_IMPORT_STAR``" msgstr "``INTRINSIC_IMPORT_STAR``" -#: ../../library/dis.rst:1749 +#: ../../library/dis.rst:1750 msgid "Performs ``import *`` for the named module." msgstr "" -#: ../../library/dis.rst:1752 +#: ../../library/dis.rst:1753 msgid "``INTRINSIC_STOPITERATION_ERROR``" msgstr "``INTRINSIC_STOPITERATION_ERROR``" -#: ../../library/dis.rst:1752 +#: ../../library/dis.rst:1753 msgid "Extracts the return value from a ``StopIteration`` exception." msgstr "" -#: ../../library/dis.rst:1755 +#: ../../library/dis.rst:1756 msgid "``INTRINSIC_ASYNC_GEN_WRAP``" msgstr "``INTRINSIC_ASYNC_GEN_WRAP``" -#: ../../library/dis.rst:1755 +#: ../../library/dis.rst:1756 msgid "Wraps an async generator value" msgstr "" -#: ../../library/dis.rst:1757 +#: ../../library/dis.rst:1758 msgid "``INTRINSIC_UNARY_POSITIVE``" msgstr "``INTRINSIC_UNARY_POSITIVE``" -#: ../../library/dis.rst:1757 +#: ../../library/dis.rst:1758 msgid "Performs the unary ``+`` operation" msgstr "" -#: ../../library/dis.rst:1760 +#: ../../library/dis.rst:1761 msgid "``INTRINSIC_LIST_TO_TUPLE``" msgstr "``INTRINSIC_LIST_TO_TUPLE``" -#: ../../library/dis.rst:1760 +#: ../../library/dis.rst:1761 msgid "Converts a list to a tuple" msgstr "" -#: ../../library/dis.rst:1762 +#: ../../library/dis.rst:1763 msgid "``INTRINSIC_TYPEVAR``" msgstr "``INTRINSIC_TYPEVAR``" -#: ../../library/dis.rst:1762 +#: ../../library/dis.rst:1763 msgid "Creates a :class:`typing.TypeVar`" msgstr "" -#: ../../library/dis.rst:1764 +#: ../../library/dis.rst:1765 msgid "``INTRINSIC_PARAMSPEC``" msgstr "``INTRINSIC_PARAMSPEC``" -#: ../../library/dis.rst:1764 +#: ../../library/dis.rst:1765 msgid "Creates a :class:`typing.ParamSpec`" msgstr "" -#: ../../library/dis.rst:1767 +#: ../../library/dis.rst:1768 msgid "``INTRINSIC_TYPEVARTUPLE``" msgstr "``INTRINSIC_TYPEVARTUPLE``" -#: ../../library/dis.rst:1767 +#: ../../library/dis.rst:1768 msgid "Creates a :class:`typing.TypeVarTuple`" msgstr "" -#: ../../library/dis.rst:1770 +#: ../../library/dis.rst:1771 msgid "``INTRINSIC_SUBSCRIPT_GENERIC``" msgstr "``INTRINSIC_SUBSCRIPT_GENERIC``" -#: ../../library/dis.rst:1770 +#: ../../library/dis.rst:1771 msgid "Returns :class:`typing.Generic` subscripted with the argument" msgstr "" -#: ../../library/dis.rst:1773 +#: ../../library/dis.rst:1774 msgid "``INTRINSIC_TYPEALIAS``" msgstr "``INTRINSIC_TYPEALIAS``" -#: ../../library/dis.rst:1773 +#: ../../library/dis.rst:1774 msgid "" "Creates a :class:`typing.TypeAliasType`; used in the :keyword:`type` " "statement. The argument is a tuple of the type alias's name, type " "parameters, and value." msgstr "" -#: ../../library/dis.rst:1785 +#: ../../library/dis.rst:1786 msgid "" "Calls an intrinsic function with two arguments. Used to implement " "functionality that is not performance critical::" msgstr "" -#: ../../library/dis.rst:1788 +#: ../../library/dis.rst:1789 msgid "" "arg2 = STACK.pop()\n" "arg1 = STACK.pop()\n" @@ -2089,61 +2093,61 @@ msgstr "" "result = intrinsic2(arg1, arg2)\n" "STACK.append(result)" -#: ../../library/dis.rst:1798 +#: ../../library/dis.rst:1799 msgid "``INTRINSIC_2_INVALID``" msgstr "``INTRINSIC_2_INVALID``" -#: ../../library/dis.rst:1800 +#: ../../library/dis.rst:1801 msgid "``INTRINSIC_PREP_RERAISE_STAR``" msgstr "``INTRINSIC_PREP_RERAISE_STAR``" -#: ../../library/dis.rst:1800 +#: ../../library/dis.rst:1801 msgid "Calculates the :exc:`ExceptionGroup` to raise from a ``try-except*``." msgstr "" -#: ../../library/dis.rst:1804 +#: ../../library/dis.rst:1805 msgid "``INTRINSIC_TYPEVAR_WITH_BOUND``" msgstr "``INTRINSIC_TYPEVAR_WITH_BOUND``" -#: ../../library/dis.rst:1804 +#: ../../library/dis.rst:1805 msgid "Creates a :class:`typing.TypeVar` with a bound." msgstr "" -#: ../../library/dis.rst:1807 +#: ../../library/dis.rst:1808 msgid "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" msgstr "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" -#: ../../library/dis.rst:1807 +#: ../../library/dis.rst:1808 msgid "Creates a :class:`typing.TypeVar` with constraints." msgstr "" -#: ../../library/dis.rst:1811 +#: ../../library/dis.rst:1812 msgid "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" msgstr "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" -#: ../../library/dis.rst:1811 +#: ../../library/dis.rst:1812 msgid "Sets the ``__type_params__`` attribute of a function." msgstr "" -#: ../../library/dis.rst:1818 +#: ../../library/dis.rst:1819 msgid "**Pseudo-instructions**" msgstr "" -#: ../../library/dis.rst:1820 +#: ../../library/dis.rst:1821 msgid "" "These opcodes do not appear in Python bytecode. They are used by the " "compiler but are replaced by real opcodes or removed before bytecode is " "generated." msgstr "" -#: ../../library/dis.rst:1825 +#: ../../library/dis.rst:1826 msgid "" "Set up an exception handler for the following code block. If an exception " "occurs, the value stack level is restored to its current state and control " "is transferred to the exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1832 +#: ../../library/dis.rst:1833 msgid "" "Like ``SETUP_FINALLY``, but in case of an exception also pushes the last " "instruction (``lasti``) to the stack so that ``RERAISE`` can restore it. If " @@ -2152,139 +2156,140 @@ msgid "" "exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1841 +#: ../../library/dis.rst:1842 msgid "" "Like ``SETUP_CLEANUP``, but in case of an exception one more item is popped " "from the stack before control is transferred to the exception handler at " "``target``." msgstr "" -#: ../../library/dis.rst:1845 +#: ../../library/dis.rst:1846 msgid "" "This variant is used in :keyword:`with` and :keyword:`async with` " "constructs, which push the return value of the context manager's :meth:" "`~object.__enter__` or :meth:`~object.__aenter__` to the stack." msgstr "" -#: ../../library/dis.rst:1852 +#: ../../library/dis.rst:1853 msgid "" "Marks the end of the code block associated with the last ``SETUP_FINALLY``, " "``SETUP_CLEANUP`` or ``SETUP_WITH``." msgstr "" -#: ../../library/dis.rst:1858 +#: ../../library/dis.rst:1859 msgid "" "Undirected relative jump instructions which are replaced by their directed " "(forward/backward) counterparts by the assembler." msgstr "" -#: ../../library/dis.rst:1863 +#: ../../library/dis.rst:1864 msgid "" "Pushes a reference to the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1866 +#: ../../library/dis.rst:1867 msgid "" "Note that ``LOAD_CLOSURE`` is replaced with ``LOAD_FAST`` in the assembler." msgstr "" -#: ../../library/dis.rst:1868 +#: ../../library/dis.rst:1869 msgid "This opcode is now a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1874 +#: ../../library/dis.rst:1875 msgid "" "Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode with a " "flag set in the arg." msgstr "" -#: ../../library/dis.rst:1881 +#: ../../library/dis.rst:1882 msgid "Opcode collections" msgstr "" -#: ../../library/dis.rst:1883 +#: ../../library/dis.rst:1884 msgid "" "These collections are provided for automatic introspection of bytecode " "instructions:" msgstr "" -#: ../../library/dis.rst:1886 +#: ../../library/dis.rst:1887 msgid "" "The collections now contain pseudo instructions and instrumented " "instructions as well. These are opcodes with values ``>= MIN_PSEUDO_OPCODE`` " "and ``>= MIN_INSTRUMENTED_OPCODE``." msgstr "" -#: ../../library/dis.rst:1893 +#: ../../library/dis.rst:1894 msgid "Sequence of operation names, indexable using the bytecode." msgstr "" -#: ../../library/dis.rst:1898 +#: ../../library/dis.rst:1899 msgid "Dictionary mapping operation names to bytecodes." msgstr "" -#: ../../library/dis.rst:1903 +#: ../../library/dis.rst:1904 msgid "Sequence of all compare operation names." msgstr "" -#: ../../library/dis.rst:1908 +#: ../../library/dis.rst:1909 msgid "Sequence of bytecodes that use their argument." msgstr "" -#: ../../library/dis.rst:1915 +#: ../../library/dis.rst:1916 msgid "Sequence of bytecodes that access a constant." msgstr "" -#: ../../library/dis.rst:1920 +#: ../../library/dis.rst:1921 msgid "" -"Sequence of bytecodes that access a free variable. 'free' in this context " -"refers to names in the current scope that are referenced by inner scopes or " -"names in outer scopes that are referenced from this scope. It does *not* " -"include references to global or builtin scopes." +"Sequence of bytecodes that access a :term:`free (closure) variable `. 'free' in this context refers to names in the current scope that " +"are referenced by inner scopes or names in outer scopes that are referenced " +"from this scope. It does *not* include references to global or builtin " +"scopes." msgstr "" -#: ../../library/dis.rst:1928 +#: ../../library/dis.rst:1929 msgid "Sequence of bytecodes that access an attribute by name." msgstr "" -#: ../../library/dis.rst:1933 +#: ../../library/dis.rst:1934 msgid "Sequence of bytecodes that have a jump target. All jumps are relative." msgstr "" -#: ../../library/dis.rst:1940 +#: ../../library/dis.rst:1941 msgid "Sequence of bytecodes that access a local variable." msgstr "" -#: ../../library/dis.rst:1945 +#: ../../library/dis.rst:1946 msgid "Sequence of bytecodes of Boolean operations." msgstr "" -#: ../../library/dis.rst:1949 +#: ../../library/dis.rst:1950 msgid "Sequence of bytecodes that set an exception handler." msgstr "" -#: ../../library/dis.rst:1956 +#: ../../library/dis.rst:1957 msgid "Sequence of bytecodes that have a relative jump target." msgstr "" -#: ../../library/dis.rst:1958 +#: ../../library/dis.rst:1959 msgid "All jumps are now relative. Use :data:`hasjump`." msgstr "" -#: ../../library/dis.rst:1964 +#: ../../library/dis.rst:1965 msgid "Sequence of bytecodes that have an absolute jump target." msgstr "" -#: ../../library/dis.rst:1966 +#: ../../library/dis.rst:1967 msgid "All jumps are now relative. This list is empty." msgstr "" -#: ../../library/dis.rst:1582 +#: ../../library/dis.rst:1583 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/dis.rst:1582 +#: ../../library/dis.rst:1583 msgid "slice" msgstr "slice(切片)" diff --git a/library/ensurepip.po b/library/ensurepip.po index 0c3867c9a3..ada8cd86dc 100644 --- a/library/ensurepip.po +++ b/library/ensurepip.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -76,8 +76,8 @@ msgid "The original rationale and specification for this module." msgstr "此模組的最初設計理念與規範。" #: ../../includes/wasm-mobile-notavail.rst:3 -msgid ":ref:`Availability `: not Android, not iOS, not WASI." -msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-mobile-notavail.rst:5 msgid "" @@ -270,13 +270,3 @@ msgstr "" "初始建置的過程也許會安裝 ``pip`` 所需要的額外的模組,但其他軟體不應該假設這些" "相依 (dependency) 總是預設存在(因為這些相依很可能會在未來版本的 ``pip`` 中被" "移除)。" - -#, fuzzy -#~ msgid "" -#~ "This module does not work or is not available on WebAssembly platforms, " -#~ "or on iOS. See :ref:`wasm-availability` for more information on WASM " -#~ "availability; see :ref:`iOS-availability` for more information on iOS " -#~ "availability." -#~ msgstr "" -#~ "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法" -#~ "作用或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/errno.po b/library/errno.po index 8a2c10f4e4..0d41f0a9c6 100644 --- a/library/errno.po +++ b/library/errno.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -588,8 +588,8 @@ msgid "" msgstr "" #: ../../library/errno.rst:673 -msgid ":ref:`Availability `: WASI, FreeBSD" -msgstr ":ref:`適用 `:WASI, FreeBSD" +msgid "Availability" +msgstr "" #: ../../library/errno.rst:680 msgid "Operation canceled" diff --git a/library/fcntl.po b/library/fcntl.po index 4a43c0463f..a806871acf 100644 --- a/library/fcntl.po +++ b/library/fcntl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,9 +31,8 @@ msgid "" msgstr "" #: ../../library/fcntl.rst:21 -#, fuzzy -msgid ":ref:`Availability `: Unix, not WASI." -msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" +msgid "Availability" +msgstr "" #: ../../library/fcntl.rst:23 msgid "" @@ -380,11 +379,3 @@ msgstr "file control(檔案控制)" #: ../../library/fcntl.rst:10 msgid "I/O control" msgstr "I/O control(I/O 控制)" - -#~ msgid "" -#~ "This module does not work or is not available on WebAssembly platforms " -#~ "``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` " -#~ "for more information." -#~ msgstr "" -#~ "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法" -#~ "作用或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/ftplib.po b/library/ftplib.po index 5f1ac72eb1..15641cfa55 100644 --- a/library/ftplib.po +++ b/library/ftplib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2023-04-26 19:44+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -46,8 +46,8 @@ msgid "The default encoding is UTF-8, following :rfc:`2640`." msgstr "預設編碼是 UTF-8,遵循 :rfc:`2640`。" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`Availability `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" diff --git a/library/functions.po b/library/functions.po index 0703f10a5b..59b35e4bb2 100644 --- a/library/functions.po +++ b/library/functions.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-10-12 00:13+0000\n" "PO-Revision-Date: 2024-05-06 17:06+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -514,8 +514,8 @@ msgid "" "ways." msgstr "如果不一定需要 \"0b\" 前綴,還可以使用如下的方法。" -#: ../../library/functions.rst:141 ../../library/functions.rst:931 -#: ../../library/functions.rst:1311 +#: ../../library/functions.rst:141 ../../library/functions.rst:932 +#: ../../library/functions.rst:1312 msgid "See also :func:`format` for more information." msgstr "可參考 :func:`format` 獲取更多資訊。" @@ -534,7 +534,7 @@ msgstr "" "(參見 :ref:`typesnumeric`),其他 class 不能繼承自它。它只有 ``False`` 和 " "``True`` 兩個實例(參見 :ref:`typebool`)。" -#: ../../library/functions.rst:156 ../../library/functions.rst:796 +#: ../../library/functions.rst:156 ../../library/functions.rst:797 msgid "The parameter is now positional-only." msgstr "現在為僅限位置參數。" @@ -932,8 +932,8 @@ msgid "" "number from real and imaginary parts." msgstr "" -#: ../../library/functions.rst:384 ../../library/functions.rst:741 -#: ../../library/functions.rst:987 +#: ../../library/functions.rst:384 ../../library/functions.rst:742 +#: ../../library/functions.rst:988 msgid "Examples:" msgstr "例如: ::" @@ -1022,8 +1022,8 @@ msgstr "" msgid "The complex type is described in :ref:`typesnumeric`." msgstr "複數型別在 :ref:`typesnumeric` 中有相關描述。" -#: ../../library/functions.rst:447 ../../library/functions.rst:793 -#: ../../library/functions.rst:1036 +#: ../../library/functions.rst:447 ../../library/functions.rst:794 +#: ../../library/functions.rst:1037 msgid "Grouping digits with underscores as in code literals is allowed." msgstr "可以使用底線將程式碼文字中的數字進行分組。" @@ -1299,7 +1299,7 @@ msgstr "" "串。" #: ../../library/functions.rst:629 ../../library/functions.rst:631 -#: ../../library/functions.rst:685 ../../library/functions.rst:687 +#: ../../library/functions.rst:686 ../../library/functions.rst:688 msgid "" "Raises an :ref:`auditing event ` ``exec`` with the code object as " "the argument. Code compilation events may also be raised." @@ -1307,11 +1307,11 @@ msgstr "" "引發一個附帶程式碼物件為引數的\\ :ref:`稽核事件 ` ``exec``。也可能" "會引發程式碼編譯事件。" -#: ../../library/functions.rst:636 ../../library/functions.rst:707 +#: ../../library/functions.rst:636 ../../library/functions.rst:708 msgid "The *globals* and *locals* arguments can now be passed as keywords." msgstr "" -#: ../../library/functions.rst:640 ../../library/functions.rst:711 +#: ../../library/functions.rst:640 ../../library/functions.rst:712 msgid "" "The semantics of the default *locals* namespace have been adjusted as " "described for the :func:`locals` builtin." @@ -1378,15 +1378,16 @@ msgstr "" #: ../../library/functions.rst:680 msgid "" "The *closure* argument specifies a closure--a tuple of cellvars. It's only " -"valid when the *object* is a code object containing free variables. The " -"length of the tuple must exactly match the number of free variables " -"referenced by the code object." +"valid when the *object* is a code object containing :term:`free (closure) " +"variables `. The length of the tuple must exactly match " +"the length of the code object's :attr:`~codeobject.co_freevars` attribute." msgstr "" "*closure* 引數會指定一個閉包 (closure) — 它是一個 cellvar(格變數)的 tuple。" -"只有在 *object* 是一個含有自由變數 (free variable) 的程式碼物件時,它才有效。" -"Tuple 的長度必須與程式碼物件所引用的自由變數數量完全匹配。" +"只有在 *object* 是一個含有\\ :term:`自由(閉包)變數 (free (closure) " +"variables) ` 的程式碼物件時,它才有效。Tuple 的長度必須與程" +"式碼物件的 :attr:`~codeobject.co_freevars` 屬性完全匹配。" -#: ../../library/functions.rst:692 +#: ../../library/functions.rst:693 msgid "" "The built-in functions :func:`globals` and :func:`locals` return the current " "global and local namespace, respectively, which may be useful to pass around " @@ -1395,7 +1396,7 @@ msgstr "" "內建 :func:`globals` 和 :func:`locals` 函式各自回傳當前的全域和區域命名空間," "因此可以將它們傳遞給 :func:`exec` 的第二個和第三個引數以供後續使用。" -#: ../../library/functions.rst:698 +#: ../../library/functions.rst:699 msgid "" "The default *locals* act as described for function :func:`locals` below. " "Pass an explicit *locals* dictionary if you need to see effects of the code " @@ -1405,11 +1406,11 @@ msgstr "" "func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 *locals* " "dictionary 。" -#: ../../library/functions.rst:702 +#: ../../library/functions.rst:703 msgid "Added the *closure* parameter." msgstr "增加了 *closure* 參數。" -#: ../../library/functions.rst:717 +#: ../../library/functions.rst:718 msgid "" "Construct an iterator from those elements of *iterable* for which *function* " "is true. *iterable* may be either a sequence, a container which supports " @@ -1421,7 +1422,7 @@ msgstr "" "*function* 是 ``None``,則會假設它是一個識別性函式,即 *iterable* 中所有假值" "元素會被移除。" -#: ../../library/functions.rst:723 +#: ../../library/functions.rst:724 msgid "" "Note that ``filter(function, iterable)`` is equivalent to the generator " "expression ``(item for item in iterable if function(item))`` if function is " @@ -1432,7 +1433,7 @@ msgstr "" "是 ``None`` 的時候為 ``(item for item in iterable if function(item))``;" "function 是 ``None`` 的時候為 ``(item for item in iterable if item)``。" -#: ../../library/functions.rst:728 +#: ../../library/functions.rst:729 msgid "" "See :func:`itertools.filterfalse` for the complementary function that " "returns elements of *iterable* for which *function* is false." @@ -1440,11 +1441,11 @@ msgstr "" "請參閱 :func:`itertools.filterfalse`,只有 *function* 為 false 時才選取 " "*iterable* 中元素的互補函式。" -#: ../../library/functions.rst:739 +#: ../../library/functions.rst:740 msgid "Return a floating-point number constructed from a number or a string." msgstr "回傳從數字或字串生成的浮點數。" -#: ../../library/functions.rst:743 +#: ../../library/functions.rst:744 msgid "" ">>> float('+1.23')\n" "1.23\n" @@ -1468,7 +1469,7 @@ msgstr "" ">>> float('-Infinity')\n" "-inf" -#: ../../library/functions.rst:756 +#: ../../library/functions.rst:757 msgid "" "If the argument is a string, it should contain a decimal number, optionally " "preceded by a sign, and optionally embedded in whitespace. The optional " @@ -1483,7 +1484,7 @@ msgstr "" "數也可以是 NaN(非數字)或正負無窮大的字串。確切地說,除去首尾的空格後,輸入" "必須遵循以下語法中 :token:`~float:floatvalue` 的生成規則:" -#: ../../library/functions.rst:777 +#: ../../library/functions.rst:778 msgid "" "Case is not significant, so, for example, \"inf\", \"Inf\", \"INFINITY\", " "and \"iNfINity\" are all acceptable spellings for positive infinity." @@ -1491,7 +1492,7 @@ msgstr "" "字母大小寫不影響,例如,\"inf\"、\"Inf\"、\"INFINITY\"、\"iNfINity\" 都可以表" "示正無窮大。" -#: ../../library/functions.rst:780 +#: ../../library/functions.rst:781 msgid "" "Otherwise, if the argument is an integer or a floating-point number, a " "floating-point number with the same value (within Python's floating-point " @@ -1501,7 +1502,7 @@ msgstr "" "否則,如果引數是整數或浮點數,則回傳具有相同值(在 Python 浮點精度範圍內)的" "浮點數。如果引數在 Python 浮點精度範圍外,則會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:785 +#: ../../library/functions.rst:786 msgid "" "For a general Python object ``x``, ``float(x)`` delegates to ``x." "__float__()``. If :meth:`~object.__float__` is not defined then it falls " @@ -1510,22 +1511,22 @@ msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 會委派給 ``x.__float__()``。如果未" "定義 :meth:`~object.__float__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:789 +#: ../../library/functions.rst:790 msgid "If no argument is given, ``0.0`` is returned." msgstr "如果沒有引數,則回傳 ``0.0``。" -#: ../../library/functions.rst:791 +#: ../../library/functions.rst:792 msgid "The float type is described in :ref:`typesnumeric`." msgstr ":ref:`typesnumeric` 描述了浮點數型別。" -#: ../../library/functions.rst:799 +#: ../../library/functions.rst:800 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not " "defined." msgstr "" "如果 :meth:`~object.__float__` 未定義,則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:809 +#: ../../library/functions.rst:810 msgid "" "Convert a *value* to a \"formatted\" representation, as controlled by " "*format_spec*. The interpretation of *format_spec* will depend on the type " @@ -1536,7 +1537,7 @@ msgstr "" "取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語法::ref:" "`formatspec`。" -#: ../../library/functions.rst:814 +#: ../../library/functions.rst:815 msgid "" "The default *format_spec* is an empty string which usually gives the same " "effect as calling :func:`str(value) `." @@ -1544,7 +1545,7 @@ msgstr "" "預設的 *format_spec* 是一個空字串,它通常和呼叫 :func:`str(value) ` 的效" "果相同。" -#: ../../library/functions.rst:817 +#: ../../library/functions.rst:818 msgid "" "A call to ``format(value, format_spec)`` is translated to ``type(value)." "__format__(value, format_spec)`` which bypasses the instance dictionary when " @@ -1558,7 +1559,7 @@ msgstr "" "實例中的字典。如果搜尋到 :mod:`object` 這個 method 但 *format_spec* 不為空," "或是 *format_spec* 或回傳值不是字串,則會引發 :exc:`TypeError`。" -#: ../../library/functions.rst:824 +#: ../../library/functions.rst:825 msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." @@ -1566,7 +1567,7 @@ msgstr "" "當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:833 +#: ../../library/functions.rst:834 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " "*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" @@ -1576,7 +1577,7 @@ msgstr "" "``frozenset`` 是一個內建的 class。有關此 class 的文件,請參閱 :class:" "`frozenset` 和 :ref:`types-set`。" -#: ../../library/functions.rst:837 +#: ../../library/functions.rst:838 msgid "" "For other containers see the built-in :class:`set`, :class:`list`, :class:" "`tuple`, and :class:`dict` classes, as well as the :mod:`collections` module." @@ -1584,7 +1585,7 @@ msgstr "" "請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` " "class,以及 :mod:`collections` module 來了解其它的容器。" -#: ../../library/functions.rst:845 +#: ../../library/functions.rst:846 msgid "" "Return the value of the named attribute of *object*. *name* must be a " "string. If the string is the name of one of the object's attributes, the " @@ -1599,7 +1600,7 @@ msgstr "" "`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:" "`setattr`)。" -#: ../../library/functions.rst:854 +#: ../../library/functions.rst:855 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " @@ -1610,7 +1611,7 @@ msgstr "" "發生在編譯期,因此你必須手動改編私有屬性(有兩個前導底線的屬性)的名稱,才能" "使用 :func:`getattr` 來取得它。" -#: ../../library/functions.rst:862 +#: ../../library/functions.rst:863 msgid "" "Return the dictionary implementing the current module namespace. For code " "within functions, this is set when the function is defined and remains the " @@ -1619,7 +1620,7 @@ msgstr "" "回傳代表當前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義" "函式時設定且不論該函式是在何處呼叫都會保持相同。" -#: ../../library/functions.rst:869 +#: ../../library/functions.rst:870 msgid "" "The arguments are an object and a string. The result is ``True`` if the " "string is the name of one of the object's attributes, ``False`` if not. " @@ -1630,7 +1631,7 @@ msgstr "" "則回傳 ``False``。(此功能是透過呼叫 ``getattr(object, name)`` 並檢查是否引" "發 :exc:`AttributeError` 來實作的。)" -#: ../../library/functions.rst:877 +#: ../../library/functions.rst:878 msgid "" "Return the hash value of the object (if it has one). Hash values are " "integers. They are used to quickly compare dictionary keys during a " @@ -1641,7 +1642,7 @@ msgstr "" "時用來快速比較 dictionary 的鍵。相同大小的數字數值有相同的雜湊值(即使它們型" "別不同,如 1 和 1.0)。" -#: ../../library/functions.rst:884 +#: ../../library/functions.rst:885 msgid "" "For objects with custom :meth:`~object.__hash__` methods, note that :func:" "`hash` truncates the return value based on the bit width of the host machine." @@ -1649,7 +1650,7 @@ msgstr "" "請注意,如果物件帶有自訂的 :meth:`~object.__hash__` 方法,:func:`hash` 將根據" "運行機器的位元長度來截斷回傳值。" -#: ../../library/functions.rst:891 +#: ../../library/functions.rst:892 msgid "" "Invoke the built-in help system. (This function is intended for interactive " "use.) If no argument is given, the interactive help system starts on the " @@ -1663,7 +1664,7 @@ msgstr "" "關鍵字或說明文件主題中搜索該字串,並在控制台上列印幫助資訊。如果引數是其他任" "意物件,則會生成該物件的幫助頁。" -#: ../../library/functions.rst:898 +#: ../../library/functions.rst:899 msgid "" "Note that if a slash(/) appears in the parameter list of a function when " "invoking :func:`help`, it means that the parameters prior to the slash are " @@ -1674,12 +1675,12 @@ msgstr "" "前面的參數是僅限位置 (positional-only) 參數。有關更多資訊,請參閱\\ :ref:`常" "見問答集中的僅限位置參數條目 `。" -#: ../../library/functions.rst:903 +#: ../../library/functions.rst:904 msgid "" "This function is added to the built-in namespace by the :mod:`site` module." msgstr "此函式會被 :mod:`site` module 加入到內建命名空間。" -#: ../../library/functions.rst:905 +#: ../../library/functions.rst:906 msgid "" "Changes to :mod:`pydoc` and :mod:`inspect` mean that the reported signatures " "for callables are now more comprehensive and consistent." @@ -1687,7 +1688,7 @@ msgstr "" "對於 :mod:`pydoc` 和 :mod:`inspect` 的變更,使得可呼叫物件回報的的簽名 " "(signature) 更加全面和一致。" -#: ../../library/functions.rst:912 +#: ../../library/functions.rst:913 msgid "" "Convert an integer number to a lowercase hexadecimal string prefixed with " "\"0x\". If *x* is not a Python :class:`int` object, it has to define an :" @@ -1697,7 +1698,7 @@ msgstr "" "class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並且回傳一" "個整數。舉例來說:" -#: ../../library/functions.rst:921 +#: ../../library/functions.rst:922 msgid "" "If you want to convert an integer number to an uppercase or lower " "hexadecimal string with prefix or not, you can use either of the following " @@ -1706,20 +1707,20 @@ msgstr "" "如果要將整數轉換為大寫或小寫的十六進位制字串,並可選擇有無 \"0x\" 前綴,則可" "以使用如下方法:" -#: ../../library/functions.rst:933 +#: ../../library/functions.rst:934 msgid "" "See also :func:`int` for converting a hexadecimal string to an integer using " "a base of 16." msgstr "另請參閱 :func:`int` 將十六進位制字串轉換為以 16 為基數的整數。" -#: ../../library/functions.rst:938 +#: ../../library/functions.rst:939 msgid "" "To obtain a hexadecimal string representation for a float, use the :meth:" "`float.hex` method." msgstr "" "如果要獲取浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" -#: ../../library/functions.rst:944 +#: ../../library/functions.rst:945 msgid "" "Return the \"identity\" of an object. This is an integer which is " "guaranteed to be unique and constant for this object during its lifetime. " @@ -1729,18 +1730,18 @@ msgstr "" "回傳物件的 \"識別性\" 。該值是一個整數,在此物件的生命週期中保證是唯一且恆定" "的。兩個生命期不重疊的物件可能具有相同的 :func:`id` 值。" -#: ../../library/functions.rst:949 +#: ../../library/functions.rst:950 msgid "This is the address of the object in memory." msgstr "這是該物件在記憶體中的位址。" -#: ../../library/functions.rst:951 +#: ../../library/functions.rst:952 msgid "" "Raises an :ref:`auditing event ` ``builtins.id`` with argument " "``id``." msgstr "" "引發一個附帶引數 ``id`` 的\\ :ref:`稽核事件 ` ``builtins.id``。" -#: ../../library/functions.rst:957 +#: ../../library/functions.rst:958 msgid "" "If the *prompt* argument is present, it is written to standard output " "without a trailing newline. The function then reads a line from input, " @@ -1751,7 +1752,7 @@ msgstr "" "從輸入中讀取一行,將其轉換為字串(去除末尾的換行符)並回傳。當讀取到 EOF 時," "則引發 :exc:`EOFError`。例如: ::" -#: ../../library/functions.rst:962 +#: ../../library/functions.rst:963 msgid "" ">>> s = input('--> ') \n" "--> Monty Python's Flying Circus\n" @@ -1763,7 +1764,7 @@ msgstr "" ">>> s \n" "\"Monty Python's Flying Circus\"" -#: ../../library/functions.rst:967 +#: ../../library/functions.rst:968 msgid "" "If the :mod:`readline` module was loaded, then :func:`input` will use it to " "provide elaborate line editing and history features." @@ -1771,7 +1772,7 @@ msgstr "" "如果載入了 :mod:`readline` module,:func:`input` 將使用它來提供複雜的行編輯和" "歷史記錄功能。" -#: ../../library/functions.rst:970 ../../library/functions.rst:972 +#: ../../library/functions.rst:971 ../../library/functions.rst:973 msgid "" "Raises an :ref:`auditing event ` ``builtins.input`` with argument " "``prompt`` before reading input" @@ -1779,7 +1780,7 @@ msgstr "" "引發一個附帶讀取輸入前的引數 ``prompt`` 的\\ :ref:`稽核事件 ` " "``builtins.input``。" -#: ../../library/functions.rst:975 ../../library/functions.rst:977 +#: ../../library/functions.rst:976 ../../library/functions.rst:978 msgid "" "Raises an :ref:`auditing event ` ``builtins.input/result`` with " "the result after successfully reading input." @@ -1787,13 +1788,13 @@ msgstr "" "引發一個附帶成功讀取結果的\\ :ref:`稽核事件 ` ``builtins.input/" "result``。" -#: ../../library/functions.rst:984 +#: ../../library/functions.rst:985 msgid "" "Return an integer object constructed from a number or a string, or return " "``0`` if no arguments are given." msgstr "" -#: ../../library/functions.rst:989 +#: ../../library/functions.rst:990 msgid "" ">>> int(123.45)\n" "123\n" @@ -1821,7 +1822,7 @@ msgstr "" ">>> int('01110011', base=2)\n" "115" -#: ../../library/functions.rst:1004 +#: ../../library/functions.rst:1005 msgid "" "If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x." "__int__()``. If the argument defines :meth:`~object.__index__`, it returns " @@ -1834,7 +1835,7 @@ msgstr "" "義了 :meth:`~object.__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數,則會向零" "的方向無條件捨去。" -#: ../../library/functions.rst:1010 +#: ../../library/functions.rst:1011 msgid "" "If the argument is not a number or if *base* is given, then it must be a " "string, :class:`bytes`, or :class:`bytearray` instance representing an " @@ -1847,7 +1848,7 @@ msgstr "" "以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、或在" "數字間有單一底線。" -#: ../../library/functions.rst:1016 +#: ../../library/functions.rst:1017 msgid "" "A base-n integer string contains digits, each representing a value from 0 to " "n-1. The values 0--9 can be represented by any Unicode decimal digit. The " @@ -1869,11 +1870,11 @@ msgstr "" "進制中的一個,所以 ``int('010', 0)`` 是非法的,但 ``int('010')`` 和 " "``int('010', 8)`` 是有效的。" -#: ../../library/functions.rst:1027 +#: ../../library/functions.rst:1028 msgid "The integer type is described in :ref:`typesnumeric`." msgstr "整數型別定義請參閱\\ :ref:`typesnumeric`。" -#: ../../library/functions.rst:1029 +#: ../../library/functions.rst:1030 msgid "" "If *base* is not an instance of :class:`int` and the *base* object has a :" "meth:`base.__index__ ` method, that method is called to " @@ -1885,22 +1886,22 @@ msgstr "" "的版本使用 :meth:`base.__int__ ` 而不是 :meth:`base." "__index__ `。" -#: ../../library/functions.rst:1039 +#: ../../library/functions.rst:1040 msgid "The first parameter is now positional-only." msgstr "第一個參數為僅限位置參數。" -#: ../../library/functions.rst:1042 +#: ../../library/functions.rst:1043 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not " "defined." msgstr "" "如果未定義 :meth:`~object.__int__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:1045 +#: ../../library/functions.rst:1046 msgid "The delegation to :meth:`~object.__trunc__` is deprecated." msgstr "對 :meth:`~object.__trunc__` 的委派已棄用。" -#: ../../library/functions.rst:1048 +#: ../../library/functions.rst:1049 msgid "" ":class:`int` string inputs and string representations can be limited to help " "avoid denial of service attacks. A :exc:`ValueError` is raised when the " @@ -1914,7 +1915,7 @@ msgstr "" "`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱\\ :ref:`整" "數字串轉換的長度限制 `\\ 說明文件。" -#: ../../library/functions.rst:1058 +#: ../../library/functions.rst:1059 msgid "" "Return ``True`` if the *object* argument is an instance of the *classinfo* " "argument, or of a (direct, indirect, or :term:`virtual `) of *classinfo*. A class is considered a " @@ -1954,7 +1955,7 @@ msgstr "" "是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:1090 +#: ../../library/functions.rst:1091 msgid "" "Return an :term:`iterator` object. The first argument is interpreted very " "differently depending on the presence of the second argument. Without a " @@ -1978,11 +1979,11 @@ msgstr "" "__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 *sentinel* 則引發 :" "exc:`StopIteration`,否則回傳呼叫結果。" -#: ../../library/functions.rst:1104 +#: ../../library/functions.rst:1105 msgid "See also :ref:`typeiter`." msgstr "另請參閱 :ref:`typeiter`。" -#: ../../library/functions.rst:1106 +#: ../../library/functions.rst:1107 msgid "" "One useful application of the second form of :func:`iter` is to build a " "block-reader. For example, reading fixed-width blocks from a binary database " @@ -1991,7 +1992,7 @@ msgstr "" ":func:`iter` 的第二種形式有一個好用的應用,是能夠建立一個區塊閱讀器 (block-" "reader)。例如,從二進位資料庫檔案中讀取固定寬度的區塊,直到檔案的結尾: ::" -#: ../../library/functions.rst:1110 +#: ../../library/functions.rst:1111 msgid "" "from functools import partial\n" "with open('mydata.db', 'rb') as f:\n" @@ -2003,7 +2004,7 @@ msgstr "" " for block in iter(partial(f.read, 64), b''):\n" " process_block(block)" -#: ../../library/functions.rst:1118 +#: ../../library/functions.rst:1119 msgid "" "Return the length (the number of items) of an object. The argument may be a " "sequence (such as a string, bytes, tuple, list, or range) or a collection " @@ -2012,7 +2013,7 @@ msgstr "" "回傳物件的長度(元素個數)。引數可以是序列(如 string、bytes、tuple、list 或 " "range)或集合(如 dictionary、set 或 frozen set)。" -#: ../../library/functions.rst:1124 +#: ../../library/functions.rst:1125 msgid "" "``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." "maxsize`, such as :class:`range(2 ** 100) `." @@ -2020,7 +2021,7 @@ msgstr "" "如果物件長度大於 :data:`sys.maxsize`,像是 :class:`range(2 ** 100) `," "則 ``len`` 會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:1133 +#: ../../library/functions.rst:1134 msgid "" "Rather than being a function, :class:`list` is actually a mutable sequence " "type, as documented in :ref:`typesseq-list` and :ref:`typesseq`." @@ -2028,33 +2029,33 @@ msgstr "" "除了是函式,:class:`list` 也是可變序列型別,詳情請參閱 :ref:`typesseq-list` " "和 :ref:`typesseq`。" -#: ../../library/functions.rst:1139 +#: ../../library/functions.rst:1140 msgid "" "Return a mapping object representing the current local symbol table, with " "variable names as the keys, and their currently bound references as the " "values." msgstr "" -#: ../../library/functions.rst:1143 +#: ../../library/functions.rst:1144 msgid "" "At module scope, as well as when using :func:`exec` or :func:`eval` with a " "single namespace, this function returns the same namespace as :func:" "`globals`." msgstr "" -#: ../../library/functions.rst:1147 +#: ../../library/functions.rst:1148 msgid "" "At class scope, it returns the namespace that will be passed to the " "metaclass constructor." msgstr "" -#: ../../library/functions.rst:1150 +#: ../../library/functions.rst:1151 msgid "" "When using ``exec()`` or ``eval()`` with separate local and global " "arguments, it returns the local namespace passed in to the function call." msgstr "" -#: ../../library/functions.rst:1153 +#: ../../library/functions.rst:1154 msgid "" "In all of the above cases, each call to ``locals()`` in a given frame of " "execution will return the *same* mapping object. Changes made through the " @@ -2064,7 +2065,7 @@ msgid "" "returned mapping object." msgstr "" -#: ../../library/functions.rst:1160 +#: ../../library/functions.rst:1161 msgid "" "In an :term:`optimized scope` (including functions, generators, and " "coroutines), each call to ``locals()`` instead returns a fresh dictionary " @@ -2076,7 +2077,7 @@ msgid "" "previously returned dictionaries." msgstr "" -#: ../../library/functions.rst:1169 +#: ../../library/functions.rst:1170 msgid "" "Calling ``locals()`` as part of a comprehension in a function, generator, or " "coroutine is equivalent to calling it in the containing scope, except that " @@ -2085,19 +2086,19 @@ msgid "" "function." msgstr "" -#: ../../library/functions.rst:1175 +#: ../../library/functions.rst:1176 msgid "" "Calling ``locals()`` as part of a generator expression is equivalent to " "calling it in a nested generator function." msgstr "" -#: ../../library/functions.rst:1178 +#: ../../library/functions.rst:1179 msgid "" "The behaviour of ``locals()`` in a comprehension has been updated as " "described in :pep:`709`." msgstr "" -#: ../../library/functions.rst:1182 +#: ../../library/functions.rst:1183 msgid "" "As part of :pep:`667`, the semantics of mutating the mapping objects " "returned from this function are now defined. The behavior in :term:" @@ -2106,7 +2107,7 @@ msgid "" "versions." msgstr "" -#: ../../library/functions.rst:1192 +#: ../../library/functions.rst:1193 msgid "" "Return an iterator that applies *function* to every item of *iterable*, " "yielding the results. If additional *iterables* arguments are passed, " @@ -2121,13 +2122,13 @@ msgstr "" "iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經被編排為引數的 tuple," "請參閱 :func:`itertools.starmap`。" -#: ../../library/functions.rst:1204 +#: ../../library/functions.rst:1205 msgid "" "Return the largest item in an iterable or the largest of two or more " "arguments." msgstr "回傳 iterable 中最大的元素,或者回傳兩個以上的引數中最大的。" -#: ../../library/functions.rst:1207 +#: ../../library/functions.rst:1208 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The largest item in the iterable is returned. If two or more positional " @@ -2136,7 +2137,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是個 :term:`iterable`,iterable 中最大的元素" "會被回傳。如果提供了兩個或以上的位置引數,則回傳最大的位置引數。" -#: ../../library/functions.rst:1212 ../../library/functions.rst:1250 +#: ../../library/functions.rst:1213 ../../library/functions.rst:1251 msgid "" "There are two optional keyword-only arguments. The *key* argument specifies " "a one-argument ordering function like that used for :meth:`list.sort`. The " @@ -2149,7 +2150,7 @@ msgstr "" "的物件。如果 iterable 為空,並且沒有提供 *default*,則會引發 :exc:" "`ValueError`。" -#: ../../library/functions.rst:1218 +#: ../../library/functions.rst:1219 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2160,15 +2161,15 @@ msgstr "" "``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " "iterable, key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1223 ../../library/functions.rst:1261 +#: ../../library/functions.rst:1224 ../../library/functions.rst:1262 msgid "Added the *default* keyword-only parameter." msgstr "新增 *default* 僅限關鍵字參數。" -#: ../../library/functions.rst:1226 ../../library/functions.rst:1264 +#: ../../library/functions.rst:1227 ../../library/functions.rst:1265 msgid "The *key* can be ``None``." msgstr "*key* 可以為 ``None``。" -#: ../../library/functions.rst:1234 +#: ../../library/functions.rst:1235 msgid "" "Return a \"memory view\" object created from the given argument. See :ref:" "`typememoryview` for more information." @@ -2176,13 +2177,13 @@ msgstr "" "回傳由給定的引數所建立之「memory view(記憶體檢視)」物件。有關詳細資訊,請參" "閱\\ :ref:`typememoryview`。" -#: ../../library/functions.rst:1242 +#: ../../library/functions.rst:1243 msgid "" "Return the smallest item in an iterable or the smallest of two or more " "arguments." msgstr "回傳 iterable 中最小的元素,或者回傳兩個以上的引數中最小的。" -#: ../../library/functions.rst:1245 +#: ../../library/functions.rst:1246 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The smallest item in the iterable is returned. If two or more positional " @@ -2191,7 +2192,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是 :term:`iterable`,iterable 中最小的元素會" "被回傳。如果提供了兩個以上的位置引數,則回傳最小的位置引數。" -#: ../../library/functions.rst:1256 +#: ../../library/functions.rst:1257 msgid "" "If multiple items are minimal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2202,7 +2203,7 @@ msgstr "" "``sorted(iterable, key=keyfunc)[0]`` 和 ``heapq.nsmallest(1, iterable, " "key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1271 +#: ../../library/functions.rst:1272 msgid "" "Retrieve the next item from the :term:`iterator` by calling its :meth:" "`~iterator.__next__` method. If *default* is given, it is returned if the " @@ -2212,7 +2213,7 @@ msgstr "" "素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引發 :" "exc:`StopIteration`。" -#: ../../library/functions.rst:1278 +#: ../../library/functions.rst:1279 msgid "" "Return a new featureless object. :class:`object` is a base for all classes. " "It has methods that are common to all instances of Python classes. This " @@ -2221,7 +2222,7 @@ msgstr "" "回傳一個沒有特徵的新物件。:class:`object` 是所有 class 的基礎,它具有所有 " "Python class 實例的通用 method。這個函式不接受任何引數。" -#: ../../library/functions.rst:1284 +#: ../../library/functions.rst:1285 msgid "" ":class:`object` instances do *not* have :attr:`~object.__dict__` attributes, " "so you can't assign arbitrary attributes to an instance of :class:`object`." @@ -2229,7 +2230,7 @@ msgstr "" "由於 :class:`object` 實例\\ *沒有* :attr:`~object.__dict__` 屬性,因此無法將" "任意屬性賦給 :class:`object` 的實例。" -#: ../../library/functions.rst:1291 +#: ../../library/functions.rst:1292 msgid "" "Convert an integer number to an octal string prefixed with \"0o\". The " "result is a valid Python expression. If *x* is not a Python :class:`int` " @@ -2240,7 +2241,7 @@ msgstr "" "Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" "`~object.__index__` method 回傳一個整數。舉例來說:" -#: ../../library/functions.rst:1301 +#: ../../library/functions.rst:1302 msgid "" "If you want to convert an integer number to an octal string either with the " "prefix \"0o\" or not, you can use either of the following ways." @@ -2248,7 +2249,7 @@ msgstr "" "如果要將整數轉換為八進位制字串,不論是否具備 \"0o\" 前綴,都可以使用下面的方" "法。" -#: ../../library/functions.rst:1318 +#: ../../library/functions.rst:1319 msgid "" "Open *file* and return a corresponding :term:`file object`. If the file " "cannot be opened, an :exc:`OSError` is raised. See :ref:`tut-files` for more " @@ -2258,7 +2259,7 @@ msgstr "" "啟,則引發 :exc:`OSError`。關於使用此函式的更多方法,請參閱\\ :ref:`tut-" "files`。" -#: ../../library/functions.rst:1322 +#: ../../library/functions.rst:1323 msgid "" "*file* is a :term:`path-like object` giving the pathname (absolute or " "relative to the current working directory) of the file to be opened or an " @@ -2271,7 +2272,7 @@ msgstr "" "器 (file descriptor)。(如果有給定檔案描述器,它會隨著回傳的 I/O 物件關閉而關" "閉,除非 *closefd* 被設為 ``False``。)" -#: ../../library/functions.rst:1328 +#: ../../library/functions.rst:1329 msgid "" "*mode* is an optional string that specifies the mode in which the file is " "opened. It defaults to ``'r'`` which means open for reading in text mode. " @@ -2292,71 +2293,71 @@ msgstr "" "getencoding` 來獲取當前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制模" "式且不要指定 *encoding*。)可用的模式有:" -#: ../../library/functions.rst:1345 +#: ../../library/functions.rst:1346 msgid "Character" msgstr "字元" -#: ../../library/functions.rst:1345 +#: ../../library/functions.rst:1346 msgid "Meaning" msgstr "意義" -#: ../../library/functions.rst:1347 +#: ../../library/functions.rst:1348 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/functions.rst:1347 +#: ../../library/functions.rst:1348 msgid "open for reading (default)" msgstr "讀取(預設)" -#: ../../library/functions.rst:1348 +#: ../../library/functions.rst:1349 msgid "``'w'``" msgstr "``'w'``" -#: ../../library/functions.rst:1348 +#: ../../library/functions.rst:1349 msgid "open for writing, truncating the file first" msgstr "寫入,會先清除檔案內容" -#: ../../library/functions.rst:1349 +#: ../../library/functions.rst:1350 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/functions.rst:1349 +#: ../../library/functions.rst:1350 msgid "open for exclusive creation, failing if the file already exists" msgstr "唯一性建立,如果文件已存在則會失敗" -#: ../../library/functions.rst:1350 +#: ../../library/functions.rst:1351 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/functions.rst:1350 +#: ../../library/functions.rst:1351 msgid "open for writing, appending to the end of file if it exists" msgstr "寫入,如果檔案存在則在其末端附加內容" -#: ../../library/functions.rst:1351 +#: ../../library/functions.rst:1352 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/functions.rst:1351 ../../library/functions.rst:1495 +#: ../../library/functions.rst:1352 ../../library/functions.rst:1496 msgid "binary mode" msgstr "二進制模式" -#: ../../library/functions.rst:1352 +#: ../../library/functions.rst:1353 msgid "``'t'``" msgstr "``'t'``" -#: ../../library/functions.rst:1352 +#: ../../library/functions.rst:1353 msgid "text mode (default)" msgstr "文字模式(預設)" -#: ../../library/functions.rst:1353 +#: ../../library/functions.rst:1354 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/functions.rst:1353 +#: ../../library/functions.rst:1354 msgid "open for updating (reading and writing)" msgstr "更新(讀取並寫入)" -#: ../../library/functions.rst:1356 +#: ../../library/functions.rst:1357 msgid "" "The default mode is ``'r'`` (open for reading text, a synonym of ``'rt'``). " "Modes ``'w+'`` and ``'w+b'`` open and truncate the file. Modes ``'r+'`` and " @@ -2366,7 +2367,7 @@ msgstr "" "``'w+b'`` 模式會開啟並清除檔案。``'r+'`` 和 ``'r+b'`` 模式會開啟且保留檔案內" "容。" -#: ../../library/functions.rst:1360 +#: ../../library/functions.rst:1361 msgid "" "As mentioned in the :ref:`io-overview`, Python distinguishes between binary " "and text I/O. Files opened in binary mode (including ``'b'`` in the *mode* " @@ -2382,7 +2383,7 @@ msgstr "" "``'t'``),檔案的內容會以 :class:`str` 回傳,其位元組已經先被解碼,使用的是取" "決於平台的編碼系統或是給定的 *encoding*。" -#: ../../library/functions.rst:1370 +#: ../../library/functions.rst:1371 msgid "" "Python doesn't depend on the underlying operating system's notion of text " "files; all the processing is done by Python itself, and is therefore " @@ -2391,7 +2392,7 @@ msgstr "" "Python 不會使用底層作業系統對於文字檔案的操作概念;所有的處理都是由 Python 獨" "自完成的,因此能獨立於不同平台。" -#: ../../library/functions.rst:1374 +#: ../../library/functions.rst:1375 msgid "" "*buffering* is an optional integer used to set the buffering policy. Pass 0 " "to switch buffering off (only allowed in binary mode), 1 to select line " @@ -2412,7 +2413,7 @@ msgstr "" "``write_through`` 旗標。若未給定 *buffering* 引數,則預設的緩衝策略會運作如" "下:" -#: ../../library/functions.rst:1384 +#: ../../library/functions.rst:1385 msgid "" "Binary files are buffered in fixed-size chunks; the size of the buffer is " "chosen using a heuristic trying to determine the underlying device's \"block " @@ -2424,7 +2425,7 @@ msgstr "" "DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 8192 個位元" "組。" -#: ../../library/functions.rst:1389 +#: ../../library/functions.rst:1390 msgid "" "\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` " "returns ``True``) use line buffering. Other text files use the policy " @@ -2433,7 +2434,7 @@ msgstr "" "「互動式」文字檔(:meth:`~io.IOBase.isatty` 回傳 ``True`` 的檔案)會使用列緩" "衝。其他文字檔則使用上述的二進制檔案緩衝策略。" -#: ../../library/functions.rst:1393 +#: ../../library/functions.rst:1394 msgid "" "*encoding* is the name of the encoding used to decode or encode the file. " "This should only be used in text mode. The default encoding is platform " @@ -2446,7 +2447,7 @@ msgstr "" "Python 支援的任何 :term:`text encoding`\\ (文字編碼)都是可以使用的。關於支" "援的編碼系統清單,請參閱 :mod:`codecs` module。" -#: ../../library/functions.rst:1399 +#: ../../library/functions.rst:1400 msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled—this cannot be used in binary mode. A variety of " @@ -2459,7 +2460,7 @@ msgstr "" "handlers`\\ 有列出清單),不過任何已註冊到 :func:`codecs.register_error` 的錯" "誤處理程式名稱也都是有效的。標準的名稱包括:" -#: ../../library/functions.rst:1407 +#: ../../library/functions.rst:1408 msgid "" "``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding " "error. The default value of ``None`` has the same effect." @@ -2467,20 +2468,20 @@ msgstr "" "``'strict'`` 如果發生編碼錯誤,則引發 :exc:`ValueError` 例外。預設值 " "``None`` 也有相同的效果。" -#: ../../library/functions.rst:1411 +#: ../../library/functions.rst:1412 msgid "" "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to " "data loss." msgstr "``'ignore'`` 忽略錯誤。請注意,忽略編碼錯誤可能導致資料遺失。" -#: ../../library/functions.rst:1414 +#: ../../library/functions.rst:1415 msgid "" "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted " "where there is malformed data." msgstr "" "``'replace'`` 會在格式不正確的資料位置插入一個替換標誌(像是 ``'?'``)。" -#: ../../library/functions.rst:1417 +#: ../../library/functions.rst:1418 msgid "" "``'surrogateescape'`` will represent any incorrect bytes as low surrogate " "code units ranging from U+DC80 to U+DCFF. These surrogate code units will " @@ -2493,7 +2494,7 @@ msgstr "" "被還原回 ``surrogateescape`` 錯誤處理程式當時所處理的那些相同位元組。這對於處" "理未知編碼方式的檔案會很好用。" -#: ../../library/functions.rst:1424 +#: ../../library/functions.rst:1425 msgid "" "``'xmlcharrefreplace'`` is only supported when writing to a file. Characters " "not supported by the encoding are replaced with the appropriate XML " @@ -2502,7 +2503,7 @@ msgstr "" "``'xmlcharrefreplace'`` 僅在寫入檔案時可支援。編碼系統不支援的字元會被替換為" "適當的 XML 字元參考 (character reference) ``&#nnn;``。" -#: ../../library/functions.rst:1428 +#: ../../library/functions.rst:1429 msgid "" "``'backslashreplace'`` replaces malformed data by Python's backslashed " "escape sequences." @@ -2510,7 +2511,7 @@ msgstr "" "``'backslashreplace'`` 會用 Python 的反斜線跳脫序列 (backslashed escape " "sequence) 替換格式不正確的資料。" -#: ../../library/functions.rst:1431 +#: ../../library/functions.rst:1432 msgid "" "``'namereplace'`` (also only supported when writing) replaces unsupported " "characters with ``\\N{...}`` escape sequences." @@ -2518,7 +2519,7 @@ msgstr "" "``'namereplace'``\\ (也僅在寫入時支援)會將不支援的字元替換為 ``\\N{...}`` " "跳脫序列。" -#: ../../library/functions.rst:1439 +#: ../../library/functions.rst:1440 msgid "" "*newline* determines how to parse newline characters from the stream. It can " "be ``None``, ``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as " @@ -2527,7 +2528,7 @@ msgstr "" "*newline* 會決定如何剖析資料串流 (stream) 中的換行字元。它可以是 ``None``、" "``''``、``'\\n'``、``'\\r'`` 或 ``'\\r\\n'``。它的運作規則如下:" -#: ../../library/functions.rst:1443 +#: ../../library/functions.rst:1444 msgid "" "When reading input from the stream, if *newline* is ``None``, universal " "newlines mode is enabled. Lines in the input can end in ``'\\n'``, " @@ -2543,7 +2544,7 @@ msgstr "" "傳給呼叫方時,行尾符號不會被轉換。如果它是任何其他有效的值,則輸入資料的行只" "會由給定的字串做結尾,且在回傳給呼叫方時,行尾符號不會被轉換。" -#: ../../library/functions.rst:1451 +#: ../../library/functions.rst:1452 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -2556,7 +2557,7 @@ msgstr "" "``''`` 或 ``'\\n'``,則不做任何轉換。如果 *newline* 是任何其他有效的值,則寫" "入的任何 ``'\\n'`` 字元都將轉換為給定的字串。" -#: ../../library/functions.rst:1457 +#: ../../library/functions.rst:1458 msgid "" "If *closefd* is ``False`` and a file descriptor rather than a filename was " "given, the underlying file descriptor will be kept open when the file is " @@ -2567,7 +2568,7 @@ msgstr "" "則當檔案關閉時,底層的檔案描述器會保持開啟狀態。如果有給定一個檔名,則 " "*closefd* 必須是 ``True``\\ (預設值);否則將引發錯誤。" -#: ../../library/functions.rst:1462 +#: ../../library/functions.rst:1463 msgid "" "A custom opener can be used by passing a callable as *opener*. The " "underlying file descriptor for the file object is then obtained by calling " @@ -2580,11 +2581,11 @@ msgstr "" "必須回傳一個開啟的檔案描述器(將 :mod:`os.open` 作為 *opener* 傳入,在功能上" "的結果會相當於傳入 ``None``)。" -#: ../../library/functions.rst:1468 +#: ../../library/functions.rst:1469 msgid "The newly created file is :ref:`non-inheritable `." msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" -#: ../../library/functions.rst:1470 +#: ../../library/functions.rst:1471 msgid "" "The following example uses the :ref:`dir_fd ` parameter of the :func:" "`os.open` function to open a file relative to a given directory::" @@ -2592,7 +2593,7 @@ msgstr "" "下面的範例使用 :func:`os.open` 函式回傳值當作 :ref:`dir_fd ` 的參數," "從給定的目錄中用相對路徑開啟檔案: ::" -#: ../../library/functions.rst:1473 +#: ../../library/functions.rst:1474 msgid "" ">>> import os\n" ">>> dir_fd = os.open('somedir', os.O_RDONLY)\n" @@ -2605,7 +2606,7 @@ msgid "" ">>> os.close(dir_fd) # don't leak a file descriptor" msgstr "" -#: ../../library/functions.rst:1483 +#: ../../library/functions.rst:1484 msgid "" "The type of :term:`file object` returned by the :func:`open` function " "depends on the mode. When :func:`open` is used to open a file in a text " @@ -2629,7 +2630,7 @@ msgstr "" "BufferedRandom`。當緩衝被停用時,會回傳原始資料串流 :class:`io.FileIO`,它" "是 :class:`io.RawIOBase` 的一個 subclass。" -#: ../../library/functions.rst:1504 +#: ../../library/functions.rst:1505 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " "(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" @@ -2639,7 +2640,7 @@ msgstr "" "`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以及 :mod:" "`shutil`。" -#: ../../library/functions.rst:1508 +#: ../../library/functions.rst:1509 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." @@ -2647,25 +2648,25 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " "` ``open``。" -#: ../../library/functions.rst:1510 +#: ../../library/functions.rst:1511 msgid "" "The ``mode`` and ``flags`` arguments may have been modified or inferred from " "the original call." msgstr "``mode`` 和 ``flags`` 引數可能會被原始的呼叫所修改或推論 (infer)。" -#: ../../library/functions.rst:1515 +#: ../../library/functions.rst:1516 msgid "The *opener* parameter was added." msgstr "增加了 *opener* 參數。" -#: ../../library/functions.rst:1516 +#: ../../library/functions.rst:1517 msgid "The ``'x'`` mode was added." msgstr "增加了 ``'x'`` 模式。" -#: ../../library/functions.rst:1517 +#: ../../library/functions.rst:1518 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "過去引發的 :exc:`IOError`,現在是 :exc:`OSError` 的別名。" -#: ../../library/functions.rst:1518 +#: ../../library/functions.rst:1519 msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." @@ -2673,11 +2674,11 @@ msgstr "" "如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引發 :exc:" "`FileExistsError`。" -#: ../../library/functions.rst:1523 +#: ../../library/functions.rst:1524 msgid "The file is now non-inheritable." msgstr "檔案在此版本開始是不可繼承的。" -#: ../../library/functions.rst:1527 +#: ../../library/functions.rst:1528 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 :" @@ -2686,15 +2687,15 @@ msgstr "" "如果系統呼叫被中斷,但訊號處理程式沒有引發例外,此函式現在會重試系統呼叫,而" "不是引發 :exc:`InterruptedError` 例外(原因詳見 :pep:`475`)。" -#: ../../library/functions.rst:1530 +#: ../../library/functions.rst:1531 msgid "The ``'namereplace'`` error handler was added." msgstr "增加了 ``'namereplace'`` 錯誤處理程式。" -#: ../../library/functions.rst:1534 +#: ../../library/functions.rst:1535 msgid "Support added to accept objects implementing :class:`os.PathLike`." msgstr "增加對於實作 :class:`os.PathLike` 物件的支援。" -#: ../../library/functions.rst:1535 +#: ../../library/functions.rst:1536 msgid "" "On Windows, opening a console buffer may return a subclass of :class:`io." "RawIOBase` other than :class:`io.FileIO`." @@ -2702,11 +2703,11 @@ msgstr "" "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " "subclass,而不是 :class:`io.FileIO`。" -#: ../../library/functions.rst:1538 +#: ../../library/functions.rst:1539 msgid "The ``'U'`` mode has been removed." msgstr "``'U'`` 模式被移除。" -#: ../../library/functions.rst:1543 +#: ../../library/functions.rst:1544 msgid "" "Given a string representing one Unicode character, return an integer " "representing the Unicode code point of that character. For example, " @@ -2717,7 +2718,7 @@ msgstr "" "``ord('a')`` 回傳整數 ``97``、``ord('€')``\\ (歐元符號)回傳 ``8364``。這" "是 :func:`chr` 的逆函式。" -#: ../../library/functions.rst:1551 +#: ../../library/functions.rst:1552 msgid "" "Return *base* to the power *exp*; if *mod* is present, return *base* to the " "power *exp*, modulo *mod* (computed more efficiently than ``pow(base, exp) % " @@ -2728,7 +2729,7 @@ msgstr "" "*mod* 取餘數(比直接呼叫 ``pow(base, exp) % mod`` 計算更高效)。兩個引數形式" "的 ``pow(exp, exp)`` 等價於次方運算子:``base**exp``。" -#: ../../library/functions.rst:1556 +#: ../../library/functions.rst:1557 msgid "" "The arguments must have numeric types. With mixed operand types, the " "coercion rules for binary arithmetic operators apply. For :class:`int` " @@ -2752,7 +2753,7 @@ msgstr "" "`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 ``pow(-9, 2.0)`` " "會回傳 ``81.0``。" -#: ../../library/functions.rst:1568 +#: ../../library/functions.rst:1569 msgid "" "For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must " "also be of integer type and *mod* must be nonzero. If *mod* is present and " @@ -2765,11 +2766,11 @@ msgstr "" "與 *mod* 互質。在這種情況下,會回傳 ``pow(inv_base, -exp, mod)``,其中 " "*inv_base* 是 *base* 對 *mod* 的模倒數 (inverse modulo)。" -#: ../../library/functions.rst:1574 +#: ../../library/functions.rst:1575 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" msgstr "以下是一個計算 ``38`` 對 ``97`` 取模倒數的範例: ::" -#: ../../library/functions.rst:1576 +#: ../../library/functions.rst:1577 msgid "" ">>> pow(38, -1, mod=97)\n" "23\n" @@ -2781,7 +2782,7 @@ msgstr "" ">>> 23 * 38 % 97 == 1\n" "True" -#: ../../library/functions.rst:1581 +#: ../../library/functions.rst:1582 msgid "" "For :class:`int` operands, the three-argument form of ``pow`` now allows the " "second argument to be negative, permitting computation of modular inverses." @@ -2789,12 +2790,12 @@ msgstr "" "對於 :class:`int` 運算元,現在 ``pow`` 的三引數形式允許第二個引數為負數,也容" "許模倒數的計算。" -#: ../../library/functions.rst:1586 +#: ../../library/functions.rst:1587 msgid "" "Allow keyword arguments. Formerly, only positional arguments were supported." msgstr "允許關鍵字引數。在此之前只支援位置引數。" -#: ../../library/functions.rst:1593 +#: ../../library/functions.rst:1594 msgid "" "Print *objects* to the text stream *file*, separated by *sep* and followed " "by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as " @@ -2803,7 +2804,7 @@ msgstr "" "將 *objects* 列印到文字資料串流 *file*,用 *sep* 分隔並以 *end* 結尾。如果有" "給定 *sep*、*end*、*file* 和 *flush*,那麼它們必須是關鍵字引數的形式。" -#: ../../library/functions.rst:1597 +#: ../../library/functions.rst:1598 msgid "" "All non-keyword arguments are converted to strings like :func:`str` does and " "written to the stream, separated by *sep* and followed by *end*. Both *sep* " @@ -2816,7 +2817,7 @@ msgstr "" "以是 ``None``,這表示使用預設值。如果沒有給定 *objects*,:func:`print` 就只會" "寫入 *end*。" -#: ../../library/functions.rst:1603 +#: ../../library/functions.rst:1604 msgid "" "The *file* argument must be an object with a ``write(string)`` method; if it " "is not present or ``None``, :data:`sys.stdout` will be used. Since printed " @@ -2828,7 +2829,7 @@ msgstr "" "串,所以 :func:`print` 不能用於二進位模式的檔案物件。對於此類物件,請改用 " "``file.write(...)``。" -#: ../../library/functions.rst:1608 +#: ../../library/functions.rst:1609 msgid "" "Output buffering is usually determined by *file*. However, if *flush* is " "true, the stream is forcibly flushed." @@ -2836,15 +2837,15 @@ msgstr "" "輸出緩衝通常會由 *file* 決定。但是如果 *flush* 為 true,則資料串流會被強制清" "除。" -#: ../../library/functions.rst:1612 +#: ../../library/functions.rst:1613 msgid "Added the *flush* keyword argument." msgstr "增加了 *flush* 關鍵字引數。" -#: ../../library/functions.rst:1618 +#: ../../library/functions.rst:1619 msgid "Return a property attribute." msgstr "回傳 property 屬性。" -#: ../../library/functions.rst:1620 +#: ../../library/functions.rst:1621 msgid "" "*fget* is a function for getting an attribute value. *fset* is a function " "for setting an attribute value. *fdel* is a function for deleting an " @@ -2853,11 +2854,11 @@ msgstr "" "*fget* 是一個用於取得屬性值的函式,*fset* 是一個用於設定屬性值的函式,*fdel* " "是一個用於刪除屬性值的函式,而 *doc* 會為該屬性建立一個說明字串。" -#: ../../library/functions.rst:1624 +#: ../../library/functions.rst:1625 msgid "A typical use is to define a managed attribute ``x``::" msgstr "一個典型的用途是定義一個受管理的屬性 ``x``: ::" -#: ../../library/functions.rst:1626 +#: ../../library/functions.rst:1627 msgid "" "class C:\n" " def __init__(self):\n" @@ -2889,7 +2890,7 @@ msgstr "" "\n" " x = property(getx, setx, delx, \"I'm the 'x' property.\")" -#: ../../library/functions.rst:1641 +#: ../../library/functions.rst:1642 msgid "" "If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = " "value`` will invoke the setter, and ``del c.x`` the deleter." @@ -2897,7 +2898,7 @@ msgstr "" "如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會呼叫取得器 (getter),``c.x = " "value`` 會呼叫設定器 (setter),而 ``del c.x`` 會呼叫刪除器 (deleter)。" -#: ../../library/functions.rst:1644 +#: ../../library/functions.rst:1645 msgid "" "If given, *doc* will be the docstring of the property attribute. Otherwise, " "the property will copy *fget*'s docstring (if it exists). This makes it " @@ -2908,7 +2909,7 @@ msgstr "" "*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使用 :func:" "`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" -#: ../../library/functions.rst:1648 +#: ../../library/functions.rst:1649 msgid "" "class Parrot:\n" " def __init__(self):\n" @@ -2920,14 +2921,14 @@ msgid "" " return self._voltage" msgstr "" -#: ../../library/functions.rst:1657 +#: ../../library/functions.rst:1658 msgid "" "The ``@property`` decorator turns the :meth:`!voltage` method into a " "\"getter\" for a read-only attribute with the same name, and it sets the " "docstring for *voltage* to \"Get the current voltage.\"" msgstr "" -#: ../../library/functions.rst:1665 +#: ../../library/functions.rst:1666 msgid "" "A property object has ``getter``, ``setter``, and ``deleter`` methods usable " "as decorators that create a copy of the property with the corresponding " @@ -2935,7 +2936,7 @@ msgid "" "with an example:" msgstr "" -#: ../../library/functions.rst:1670 +#: ../../library/functions.rst:1671 msgid "" "class C:\n" " def __init__(self):\n" @@ -2971,36 +2972,36 @@ msgstr "" " def x(self):\n" " del self._x" -#: ../../library/functions.rst:1689 +#: ../../library/functions.rst:1690 msgid "" "This code is exactly equivalent to the first example. Be sure to give the " "additional functions the same name as the original property (``x`` in this " "case.)" msgstr "" -#: ../../library/functions.rst:1693 +#: ../../library/functions.rst:1694 msgid "" "The returned property object also has the attributes ``fget``, ``fset``, and " "``fdel`` corresponding to the constructor arguments." msgstr "" -#: ../../library/functions.rst:1696 +#: ../../library/functions.rst:1697 msgid "The docstrings of property objects are now writeable." msgstr "" -#: ../../library/functions.rst:1701 +#: ../../library/functions.rst:1702 msgid "" "Attribute holding the name of the property. The name of the property can be " "changed at runtime." msgstr "" -#: ../../library/functions.rst:1712 +#: ../../library/functions.rst:1713 msgid "" "Rather than being a function, :class:`range` is actually an immutable " "sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:1718 +#: ../../library/functions.rst:1719 msgid "" "Return a string containing a printable representation of an object. For " "many types, this function makes an attempt to return a string that would " @@ -3013,11 +3014,11 @@ msgid "" "raise :exc:`RuntimeError`." msgstr "" -#: ../../library/functions.rst:1729 +#: ../../library/functions.rst:1730 msgid "This class has a custom representation that can be evaluated::" msgstr "" -#: ../../library/functions.rst:1731 +#: ../../library/functions.rst:1732 msgid "" "class Person:\n" " def __init__(self, name, age):\n" @@ -3035,7 +3036,7 @@ msgstr "" " def __repr__(self):\n" " return f\"Person('{self.name}', {self.age})\"" -#: ../../library/functions.rst:1742 +#: ../../library/functions.rst:1743 msgid "" "Return a reverse :term:`iterator`. *seq* must be an object which has a :" "meth:`~object.__reversed__` method or supports the sequence protocol (the :" @@ -3043,14 +3044,14 @@ msgid "" "with integer arguments starting at ``0``)." msgstr "" -#: ../../library/functions.rst:1750 +#: ../../library/functions.rst:1751 msgid "" "Return *number* rounded to *ndigits* precision after the decimal point. If " "*ndigits* is omitted or is ``None``, it returns the nearest integer to its " "input." msgstr "" -#: ../../library/functions.rst:1754 +#: ../../library/functions.rst:1755 msgid "" "For the built-in types supporting :func:`round`, values are rounded to the " "closest multiple of 10 to the power minus *ndigits*; if two multiples are " @@ -3061,13 +3062,13 @@ msgid "" "``None``. Otherwise, the return value has the same type as *number*." msgstr "" -#: ../../library/functions.rst:1763 +#: ../../library/functions.rst:1764 msgid "" "For a general Python object ``number``, ``round`` delegates to ``number." "__round__``." msgstr "" -#: ../../library/functions.rst:1768 +#: ../../library/functions.rst:1769 msgid "" "The behavior of :func:`round` for floats can be surprising: for example, " "``round(2.675, 2)`` gives ``2.67`` instead of the expected ``2.68``. This is " @@ -3076,21 +3077,21 @@ msgid "" "information." msgstr "" -#: ../../library/functions.rst:1780 +#: ../../library/functions.rst:1781 msgid "" "Return a new :class:`set` object, optionally with elements taken from " "*iterable*. ``set`` is a built-in class. See :class:`set` and :ref:`types-" "set` for documentation about this class." msgstr "" -#: ../../library/functions.rst:1784 +#: ../../library/functions.rst:1785 msgid "" "For other containers see the built-in :class:`frozenset`, :class:`list`, :" "class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` " "module." msgstr "" -#: ../../library/functions.rst:1791 +#: ../../library/functions.rst:1792 msgid "" "This is the counterpart of :func:`getattr`. The arguments are an object, a " "string, and an arbitrary value. The string may name an existing attribute " @@ -3099,7 +3100,7 @@ msgid "" "is equivalent to ``x.foobar = 123``." msgstr "" -#: ../../library/functions.rst:1797 +#: ../../library/functions.rst:1798 msgid "" "*name* need not be a Python identifier as defined in :ref:`identifiers` " "unless the object chooses to enforce that, for example in a custom :meth:" @@ -3108,21 +3109,21 @@ msgid "" "notation, but is accessible through :func:`getattr` etc.." msgstr "" -#: ../../library/functions.rst:1805 +#: ../../library/functions.rst:1806 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " "with two leading underscores) name in order to set it with :func:`setattr`." msgstr "" -#: ../../library/functions.rst:1814 +#: ../../library/functions.rst:1815 msgid "" "Return a :term:`slice` object representing the set of indices specified by " "``range(start, stop, step)``. The *start* and *step* arguments default to " "``None``." msgstr "" -#: ../../library/functions.rst:1822 +#: ../../library/functions.rst:1823 msgid "" "Slice objects have read-only data attributes :attr:`!start`, :attr:`!stop`, " "and :attr:`!step` which merely return the argument values (or their " @@ -3130,48 +3131,48 @@ msgid "" "by NumPy and other third-party packages." msgstr "" -#: ../../library/functions.rst:1827 +#: ../../library/functions.rst:1828 msgid "" "Slice objects are also generated when extended indexing syntax is used. For " "example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See :func:" "`itertools.islice` for an alternate version that returns an :term:`iterator`." msgstr "" -#: ../../library/functions.rst:1832 +#: ../../library/functions.rst:1833 msgid "" "Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:" "`~slice.stop`, and :attr:`~slice.step` are hashable)." msgstr "" -#: ../../library/functions.rst:1838 +#: ../../library/functions.rst:1839 msgid "Return a new sorted list from the items in *iterable*." msgstr "" -#: ../../library/functions.rst:1840 +#: ../../library/functions.rst:1841 msgid "" "Has two optional arguments which must be specified as keyword arguments." msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" -#: ../../library/functions.rst:1842 +#: ../../library/functions.rst:1843 msgid "" "*key* specifies a function of one argument that is used to extract a " "comparison key from each element in *iterable* (for example, ``key=str." "lower``). The default value is ``None`` (compare the elements directly)." msgstr "" -#: ../../library/functions.rst:1846 +#: ../../library/functions.rst:1847 msgid "" "*reverse* is a boolean value. If set to ``True``, then the list elements " "are sorted as if each comparison were reversed." msgstr "" -#: ../../library/functions.rst:1849 +#: ../../library/functions.rst:1850 msgid "" "Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a " "*key* function." msgstr "" -#: ../../library/functions.rst:1852 +#: ../../library/functions.rst:1853 msgid "" "The built-in :func:`sorted` function is guaranteed to be stable. A sort is " "stable if it guarantees not to change the relative order of elements that " @@ -3179,7 +3180,7 @@ msgid "" "example, sort by department, then by salary grade)." msgstr "" -#: ../../library/functions.rst:1857 +#: ../../library/functions.rst:1858 msgid "" "The sort algorithm uses only ``<`` comparisons between items. While " "defining an :meth:`~object.__lt__` method will suffice for sorting, :PEP:`8` " @@ -3191,22 +3192,22 @@ msgid "" "method." msgstr "" -#: ../../library/functions.rst:1866 +#: ../../library/functions.rst:1867 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -#: ../../library/functions.rst:1870 +#: ../../library/functions.rst:1871 msgid "Transform a method into a static method." msgstr "" -#: ../../library/functions.rst:1872 +#: ../../library/functions.rst:1873 msgid "" "A static method does not receive an implicit first argument. To declare a " "static method, use this idiom::" msgstr "" -#: ../../library/functions.rst:1875 +#: ../../library/functions.rst:1876 msgid "" "class C:\n" " @staticmethod\n" @@ -3216,7 +3217,7 @@ msgstr "" " @staticmethod\n" " def f(arg1, arg2, argN): ..." -#: ../../library/functions.rst:1879 +#: ../../library/functions.rst:1880 msgid "" "The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" "`function` for details." @@ -3224,7 +3225,7 @@ msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" -#: ../../library/functions.rst:1882 +#: ../../library/functions.rst:1883 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " "an instance (such as ``C().f()``). Moreover, the static method :term:" @@ -3232,14 +3233,14 @@ msgid "" "(such as ``f()``)." msgstr "" -#: ../../library/functions.rst:1887 +#: ../../library/functions.rst:1888 msgid "" "Static methods in Python are similar to those found in Java or C++. Also, " "see :func:`classmethod` for a variant that is useful for creating alternate " "class constructors." msgstr "" -#: ../../library/functions.rst:1891 +#: ../../library/functions.rst:1892 msgid "" "Like all decorators, it is also possible to call ``staticmethod`` as a " "regular function and do something with its result. This is needed in some " @@ -3248,7 +3249,7 @@ msgid "" "cases, use this idiom::" msgstr "" -#: ../../library/functions.rst:1897 +#: ../../library/functions.rst:1898 msgid "" "def regular_function():\n" " ...\n" @@ -3262,11 +3263,11 @@ msgstr "" "class C:\n" " method = staticmethod(regular_function)" -#: ../../library/functions.rst:1903 +#: ../../library/functions.rst:1904 msgid "For more information on static methods, see :ref:`types`." msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" -#: ../../library/functions.rst:1905 +#: ../../library/functions.rst:1906 msgid "" "Static methods now inherit the method attributes (:attr:`~function." "__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" @@ -3278,25 +3279,25 @@ msgstr "" "__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " "``__wrapped__`` 屬性,且為如一般函式的可呼叫物件。" -#: ../../library/functions.rst:1921 +#: ../../library/functions.rst:1922 msgid "" "Return a :class:`str` version of *object*. See :func:`str` for details." msgstr "" -#: ../../library/functions.rst:1923 +#: ../../library/functions.rst:1924 msgid "" "``str`` is the built-in string :term:`class`. For general information about " "strings, see :ref:`textseq`." msgstr "" -#: ../../library/functions.rst:1929 +#: ../../library/functions.rst:1930 msgid "" "Sums *start* and the items of an *iterable* from left to right and returns " "the total. The *iterable*'s items are normally numbers, and the start value " "is not allowed to be a string." msgstr "" -#: ../../library/functions.rst:1933 +#: ../../library/functions.rst:1934 msgid "" "For some use cases, there are good alternatives to :func:`sum`. The " "preferred, fast way to concatenate a sequence of strings is by calling ``''." @@ -3305,37 +3306,37 @@ msgid "" "using :func:`itertools.chain`." msgstr "" -#: ../../library/functions.rst:1939 +#: ../../library/functions.rst:1940 msgid "The *start* parameter can be specified as a keyword argument." msgstr "*start* 參數可被指定為關鍵字引數。" -#: ../../library/functions.rst:1942 +#: ../../library/functions.rst:1943 msgid "" "Summation of floats switched to an algorithm that gives higher accuracy and " "better commutativity on most builds." msgstr "" -#: ../../library/functions.rst:1949 +#: ../../library/functions.rst:1950 msgid "" "Return a proxy object that delegates method calls to a parent or sibling " "class of *type*. This is useful for accessing inherited methods that have " "been overridden in a class." msgstr "" -#: ../../library/functions.rst:1953 +#: ../../library/functions.rst:1954 msgid "" "The *object_or_type* determines the :term:`method resolution order` to be " "searched. The search starts from the class right after the *type*." msgstr "" -#: ../../library/functions.rst:1957 +#: ../../library/functions.rst:1958 msgid "" "For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C -" "> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" -#: ../../library/functions.rst:1961 +#: ../../library/functions.rst:1962 msgid "" "The :attr:`~type.__mro__` attribute of the class corresponding to " "*object_or_type* lists the method resolution search order used by both :func:" @@ -3343,7 +3344,7 @@ msgid "" "whenever the inheritance hierarchy is updated." msgstr "" -#: ../../library/functions.rst:1966 +#: ../../library/functions.rst:1967 msgid "" "If the second argument is omitted, the super object returned is unbound. If " "the second argument is an object, ``isinstance(obj, type)`` must be true. " @@ -3351,7 +3352,7 @@ msgid "" "(this is useful for classmethods)." msgstr "" -#: ../../library/functions.rst:1971 +#: ../../library/functions.rst:1972 msgid "" "When called directly within an ordinary method of a class, both arguments " "may be omitted (\"zero-argument :func:`!super`\"). In this case, *type* will " @@ -3361,7 +3362,7 @@ msgid "" "including generator expressions, which implicitly create nested functions.)" msgstr "" -#: ../../library/functions.rst:1978 +#: ../../library/functions.rst:1979 msgid "" "There are two typical use cases for *super*. In a class hierarchy with " "single inheritance, *super* can be used to refer to parent classes without " @@ -3369,7 +3370,7 @@ msgid "" "closely parallels the use of *super* in other programming languages." msgstr "" -#: ../../library/functions.rst:1983 +#: ../../library/functions.rst:1984 msgid "" "The second use case is to support cooperative multiple inheritance in a " "dynamic execution environment. This use case is unique to Python and is not " @@ -3382,11 +3383,11 @@ msgid "" "classes that are unknown prior to runtime)." msgstr "" -#: ../../library/functions.rst:1993 +#: ../../library/functions.rst:1994 msgid "For both use cases, a typical superclass call looks like this::" msgstr "" -#: ../../library/functions.rst:1995 +#: ../../library/functions.rst:1996 msgid "" "class C(B):\n" " def method(self, arg):\n" @@ -3394,14 +3395,14 @@ msgid "" " # super(C, self).method(arg)" msgstr "" -#: ../../library/functions.rst:2000 +#: ../../library/functions.rst:2001 msgid "" "In addition to method lookups, :func:`super` also works for attribute " "lookups. One possible use case for this is calling :term:`descriptors " "` in a parent or sibling class." msgstr "" -#: ../../library/functions.rst:2004 +#: ../../library/functions.rst:2005 msgid "" "Note that :func:`super` is implemented as part of the binding process for " "explicit dotted attribute lookups such as ``super().__getitem__(name)``. It " @@ -3411,7 +3412,7 @@ msgid "" "using statements or operators such as ``super()[name]``." msgstr "" -#: ../../library/functions.rst:2012 +#: ../../library/functions.rst:2013 msgid "" "Also note that, aside from the zero argument form, :func:`super` is not " "limited to use inside methods. The two argument form specifies the " @@ -3421,33 +3422,33 @@ msgid "" "accessing the current instance for ordinary methods." msgstr "" -#: ../../library/functions.rst:2019 +#: ../../library/functions.rst:2020 msgid "" "For practical suggestions on how to design cooperative classes using :func:" "`super`, see `guide to using super() `_." msgstr "" -#: ../../library/functions.rst:2029 +#: ../../library/functions.rst:2030 msgid "" "Rather than being a function, :class:`tuple` is actually an immutable " "sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:2038 +#: ../../library/functions.rst:2039 msgid "" "With one argument, return the type of an *object*. The return value is a " "type object and generally the same object as returned by :attr:`object." "__class__`." msgstr "" -#: ../../library/functions.rst:2042 +#: ../../library/functions.rst:2043 msgid "" "The :func:`isinstance` built-in function is recommended for testing the type " "of an object, because it takes subclasses into account." msgstr "" -#: ../../library/functions.rst:2045 +#: ../../library/functions.rst:2046 msgid "" "With three arguments, return a new type object. This is essentially a " "dynamic form of the :keyword:`class` statement. The *name* string is the " @@ -3460,21 +3461,21 @@ msgid "" "type` objects:" msgstr "" -#: ../../library/functions.rst:2060 +#: ../../library/functions.rst:2061 msgid "See also:" msgstr "" -#: ../../library/functions.rst:2062 +#: ../../library/functions.rst:2063 msgid "" ":ref:`Documentation on attributes and methods on classes `." msgstr "" -#: ../../library/functions.rst:2063 +#: ../../library/functions.rst:2064 msgid ":ref:`bltin-type-objects`" msgstr ":ref:`bltin-type-objects`" -#: ../../library/functions.rst:2065 +#: ../../library/functions.rst:2066 msgid "" "Keyword arguments provided to the three argument form are passed to the " "appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`) " @@ -3482,23 +3483,23 @@ msgid "" "would." msgstr "" -#: ../../library/functions.rst:2070 +#: ../../library/functions.rst:2071 msgid "See also :ref:`class-customization`." msgstr "另請參閱 :ref:`class-customization`。" -#: ../../library/functions.rst:2072 +#: ../../library/functions.rst:2073 msgid "" "Subclasses of :class:`!type` which don't override ``type.__new__`` may no " "longer use the one-argument form to get the type of an object." msgstr "" -#: ../../library/functions.rst:2079 +#: ../../library/functions.rst:2080 msgid "" "Return the :attr:`~object.__dict__` attribute for a module, class, instance, " "or any other object with a :attr:`!__dict__` attribute." msgstr "" -#: ../../library/functions.rst:2082 +#: ../../library/functions.rst:2083 msgid "" "Objects such as modules and instances have an updateable :attr:`~object." "__dict__` attribute; however, other objects may have write restrictions on " @@ -3506,34 +3507,34 @@ msgid "" "MappingProxyType` to prevent direct dictionary updates)." msgstr "" -#: ../../library/functions.rst:2087 +#: ../../library/functions.rst:2088 msgid "Without an argument, :func:`vars` acts like :func:`locals`." msgstr "" -#: ../../library/functions.rst:2089 +#: ../../library/functions.rst:2090 msgid "" "A :exc:`TypeError` exception is raised if an object is specified but it " "doesn't have a :attr:`~object.__dict__` attribute (for example, if its class " "defines the :attr:`~object.__slots__` attribute)." msgstr "" -#: ../../library/functions.rst:2095 +#: ../../library/functions.rst:2096 msgid "" "The result of calling this function without an argument has been updated as " "described for the :func:`locals` builtin." msgstr "" -#: ../../library/functions.rst:2101 +#: ../../library/functions.rst:2102 msgid "" "Iterate over several iterables in parallel, producing tuples with an item " "from each one." msgstr "" -#: ../../library/functions.rst:2104 +#: ../../library/functions.rst:2105 msgid "Example::" msgstr "例如: ::" -#: ../../library/functions.rst:2106 +#: ../../library/functions.rst:2107 msgid "" ">>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):\n" "... print(item)\n" @@ -3549,27 +3550,27 @@ msgstr "" "(2, 'spice')\n" "(3, 'everything nice')" -#: ../../library/functions.rst:2113 +#: ../../library/functions.rst:2114 msgid "" "More formally: :func:`zip` returns an iterator of tuples, where the *i*-th " "tuple contains the *i*-th element from each of the argument iterables." msgstr "" -#: ../../library/functions.rst:2116 +#: ../../library/functions.rst:2117 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " "columns into rows. This is similar to `transposing a matrix `_." msgstr "" -#: ../../library/functions.rst:2120 +#: ../../library/functions.rst:2121 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " "iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" "`list`." msgstr "" -#: ../../library/functions.rst:2124 +#: ../../library/functions.rst:2125 msgid "" "One thing to consider is that the iterables passed to :func:`zip` could have " "different lengths; sometimes by design, and sometimes because of a bug in " @@ -3577,14 +3578,14 @@ msgid "" "approaches to dealing with this issue:" msgstr "" -#: ../../library/functions.rst:2129 +#: ../../library/functions.rst:2130 msgid "" "By default, :func:`zip` stops when the shortest iterable is exhausted. It " "will ignore the remaining items in the longer iterables, cutting off the " "result to the length of the shortest iterable::" msgstr "" -#: ../../library/functions.rst:2133 +#: ../../library/functions.rst:2134 msgid "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" @@ -3592,14 +3593,14 @@ msgstr "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" -#: ../../library/functions.rst:2136 +#: ../../library/functions.rst:2137 msgid "" ":func:`zip` is often used in cases where the iterables are assumed to be of " "equal length. In such cases, it's recommended to use the ``strict=True`` " "option. Its output is the same as regular :func:`zip`::" msgstr "" -#: ../../library/functions.rst:2140 +#: ../../library/functions.rst:2141 msgid "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" @@ -3607,37 +3608,37 @@ msgstr "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" -#: ../../library/functions.rst:2143 +#: ../../library/functions.rst:2144 msgid "" "Unlike the default behavior, it raises a :exc:`ValueError` if one iterable " "is exhausted before the others:" msgstr "" -#: ../../library/functions.rst:2161 +#: ../../library/functions.rst:2162 msgid "" "Without the ``strict=True`` argument, any bug that results in iterables of " "different lengths will be silenced, possibly manifesting as a hard-to-find " "bug in another part of the program." msgstr "" -#: ../../library/functions.rst:2165 +#: ../../library/functions.rst:2166 msgid "" "Shorter iterables can be padded with a constant value to make all the " "iterables have the same length. This is done by :func:`itertools." "zip_longest`." msgstr "" -#: ../../library/functions.rst:2169 +#: ../../library/functions.rst:2170 msgid "" "Edge cases: With a single iterable argument, :func:`zip` returns an iterator " "of 1-tuples. With no arguments, it returns an empty iterator." msgstr "" -#: ../../library/functions.rst:2172 +#: ../../library/functions.rst:2173 msgid "Tips and tricks:" msgstr "" -#: ../../library/functions.rst:2174 +#: ../../library/functions.rst:2175 msgid "" "The left-to-right evaluation order of the iterables is guaranteed. This " "makes possible an idiom for clustering a data series into n-length groups " @@ -3646,13 +3647,13 @@ msgid "" "iterator. This has the effect of dividing the input into n-length chunks." msgstr "" -#: ../../library/functions.rst:2180 +#: ../../library/functions.rst:2181 msgid "" ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " "list::" msgstr "" -#: ../../library/functions.rst:2183 +#: ../../library/functions.rst:2184 msgid "" ">>> x = [1, 2, 3]\n" ">>> y = [4, 5, 6]\n" @@ -3670,17 +3671,17 @@ msgstr "" ">>> x == list(x2) and y == list(y2)\n" "True" -#: ../../library/functions.rst:2191 +#: ../../library/functions.rst:2192 msgid "Added the ``strict`` argument." msgstr "增加了 ``strict`` 引數。" -#: ../../library/functions.rst:2203 +#: ../../library/functions.rst:2204 msgid "" "This is an advanced function that is not needed in everyday Python " "programming, unlike :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2206 +#: ../../library/functions.rst:2207 msgid "" "This function is invoked by the :keyword:`import` statement. It can be " "replaced (by importing the :mod:`builtins` module and assigning to " @@ -3692,7 +3693,7 @@ msgid "" "discouraged in favor of :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2215 +#: ../../library/functions.rst:2216 msgid "" "The function imports the module *name*, potentially using the given " "*globals* and *locals* to determine how to interpret the name in a package " @@ -3702,7 +3703,7 @@ msgid "" "determine the package context of the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2222 +#: ../../library/functions.rst:2223 msgid "" "*level* specifies whether to use absolute or relative imports. ``0`` (the " "default) means only perform absolute imports. Positive values for *level* " @@ -3711,7 +3712,7 @@ msgid "" "details)." msgstr "" -#: ../../library/functions.rst:2228 +#: ../../library/functions.rst:2229 msgid "" "When the *name* variable is of the form ``package.module``, normally, the " "top-level package (the name up till the first dot) is returned, *not* the " @@ -3719,37 +3720,37 @@ msgid "" "given, the module named by *name* is returned." msgstr "" -#: ../../library/functions.rst:2233 +#: ../../library/functions.rst:2234 msgid "" "For example, the statement ``import spam`` results in bytecode resembling " "the following code::" msgstr "" -#: ../../library/functions.rst:2236 +#: ../../library/functions.rst:2237 msgid "spam = __import__('spam', globals(), locals(), [], 0)" msgstr "spam = __import__('spam', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2238 +#: ../../library/functions.rst:2239 msgid "The statement ``import spam.ham`` results in this call::" msgstr "" -#: ../../library/functions.rst:2240 +#: ../../library/functions.rst:2241 msgid "spam = __import__('spam.ham', globals(), locals(), [], 0)" msgstr "spam = __import__('spam.ham', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2242 +#: ../../library/functions.rst:2243 msgid "" "Note how :func:`__import__` returns the toplevel module here because this is " "the object that is bound to a name by the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2245 +#: ../../library/functions.rst:2246 msgid "" "On the other hand, the statement ``from spam.ham import eggs, sausage as " "saus`` results in ::" msgstr "" -#: ../../library/functions.rst:2248 +#: ../../library/functions.rst:2249 msgid "" "_temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)\n" "eggs = _temp.eggs\n" @@ -3759,36 +3760,36 @@ msgstr "" "eggs = _temp.eggs\n" "saus = _temp.sausage" -#: ../../library/functions.rst:2252 +#: ../../library/functions.rst:2253 msgid "" "Here, the ``spam.ham`` module is returned from :func:`__import__`. From " "this object, the names to import are retrieved and assigned to their " "respective names." msgstr "" -#: ../../library/functions.rst:2256 +#: ../../library/functions.rst:2257 msgid "" "If you simply want to import a module (potentially within a package) by " "name, use :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2259 +#: ../../library/functions.rst:2260 msgid "" "Negative values for *level* are no longer supported (which also changes the " "default value to 0)." msgstr "" -#: ../../library/functions.rst:2263 +#: ../../library/functions.rst:2264 msgid "" "When the command line options :option:`-E` or :option:`-I` are being used, " "the environment variable :envvar:`PYTHONCASEOK` is now ignored." msgstr "" -#: ../../library/functions.rst:2268 +#: ../../library/functions.rst:2269 msgid "Footnotes" msgstr "註解" -#: ../../library/functions.rst:2269 +#: ../../library/functions.rst:2270 msgid "" "Note that the parser only accepts the Unix-style end of line convention. If " "you are reading the code from a file, make sure to use newline conversion " @@ -3801,7 +3802,7 @@ msgstr "" msgid "Boolean" msgstr "Boolean(布林值)" -#: ../../library/functions.rst:154 ../../library/functions.rst:2036 +#: ../../library/functions.rst:154 ../../library/functions.rst:2037 msgid "type" msgstr "type(型別)" @@ -3813,95 +3814,95 @@ msgstr "built-in function(內建函式)" msgid "exec" msgstr "exec" -#: ../../library/functions.rst:735 +#: ../../library/functions.rst:736 msgid "NaN" msgstr "NaN" -#: ../../library/functions.rst:735 +#: ../../library/functions.rst:736 msgid "Infinity" msgstr "Infinity(無窮)" -#: ../../library/functions.rst:803 +#: ../../library/functions.rst:804 msgid "__format__" msgstr "__format__" -#: ../../library/functions.rst:803 ../../library/functions.rst:1913 +#: ../../library/functions.rst:804 ../../library/functions.rst:1914 msgid "string" msgstr "string(字串)" -#: ../../library/functions.rst:803 +#: ../../library/functions.rst:804 msgid "format() (built-in function)" msgstr "format()(內建函式)" -#: ../../library/functions.rst:1313 +#: ../../library/functions.rst:1314 msgid "file object" msgstr "file object(檔案物件)" -#: ../../library/functions.rst:1313 ../../library/functions.rst:1434 +#: ../../library/functions.rst:1314 ../../library/functions.rst:1435 msgid "open() built-in function" msgstr "open() 內建函式" -#: ../../library/functions.rst:1341 +#: ../../library/functions.rst:1342 msgid "file" msgstr "file(檔案)" -#: ../../library/functions.rst:1341 +#: ../../library/functions.rst:1342 msgid "modes" msgstr "modes(模式)" -#: ../../library/functions.rst:1434 +#: ../../library/functions.rst:1435 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/functions.rst:1495 +#: ../../library/functions.rst:1496 msgid "line-buffered I/O" msgstr "line-buffered I/O(行緩衝 I/O)" -#: ../../library/functions.rst:1495 +#: ../../library/functions.rst:1496 msgid "unbuffered I/O" msgstr "unbuffered I/O(非緩衝 I/O)" -#: ../../library/functions.rst:1495 +#: ../../library/functions.rst:1496 msgid "buffer size, I/O" msgstr "buffer size, I/O(緩衝區大小、I/O)" -#: ../../library/functions.rst:1495 +#: ../../library/functions.rst:1496 msgid "I/O control" msgstr "I/O control(I/O 控制)" -#: ../../library/functions.rst:1495 +#: ../../library/functions.rst:1496 msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/functions.rst:1495 +#: ../../library/functions.rst:1496 msgid "text mode" msgstr "text mode(文字模式)" -#: ../../library/functions.rst:1495 ../../library/functions.rst:2197 +#: ../../library/functions.rst:1496 ../../library/functions.rst:2198 msgid "module" msgstr "module(模組)" -#: ../../library/functions.rst:1495 +#: ../../library/functions.rst:1496 msgid "sys" msgstr "sys" -#: ../../library/functions.rst:1913 +#: ../../library/functions.rst:1914 msgid "str() (built-in function)" msgstr "str() (內建函式)" -#: ../../library/functions.rst:2036 +#: ../../library/functions.rst:2037 msgid "object" msgstr "object(物件)" -#: ../../library/functions.rst:2197 +#: ../../library/functions.rst:2198 msgid "statement" msgstr "statement(陳述式)" -#: ../../library/functions.rst:2197 +#: ../../library/functions.rst:2198 msgid "import" msgstr "import(引入)" -#: ../../library/functions.rst:2197 +#: ../../library/functions.rst:2198 msgid "builtins" msgstr "builtins(內建)" diff --git a/library/getpass.po b/library/getpass.po index c1301e9377..afd4253883 100644 --- a/library/getpass.po +++ b/library/getpass.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2022-02-11 12:04+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,8 +28,8 @@ msgid "**Source code:** :source:`Lib/getpass.py`" msgstr "**原始碼:**\\ :source:`Lib/getpass.py`" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`Availability `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" diff --git a/library/grp.po b/library/grp.po index 15b9d95405..77bef2e980 100644 --- a/library/grp.po +++ b/library/grp.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,9 +29,8 @@ msgid "" msgstr "" #: ../../library/grp.rst:13 -msgid "" -":ref:`Availability `: Unix, not WASI, not Android, not iOS." -msgstr ":ref:`適用 `:Unix、非 WASI、非 Android、非 iOS。" +msgid "Availability" +msgstr "" #: ../../library/grp.rst:15 msgid "" @@ -143,14 +142,3 @@ msgstr ":mod:`pwd` 模組" #: ../../library/grp.rst:65 msgid "An interface to the user database, similar to this." msgstr "" - -#~ msgid "Module :mod:`spwd`" -#~ msgstr ":mod:`spwd` 模組" - -#~ msgid "" -#~ "This module does not work or is not available on WebAssembly platforms " -#~ "``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` " -#~ "for more information." -#~ msgstr "" -#~ "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法" -#~ "作用或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/http.client.po b/library/http.client.po index e9a367037e..e8becdcaee 100644 --- a/library/http.client.po +++ b/library/http.client.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,8 +45,8 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`Availability `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" diff --git a/library/http.server.po b/library/http.server.po index 16bc06d5f9..e9346abbd1 100644 --- a/library/http.server.po +++ b/library/http.server.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,8 +36,8 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" diff --git a/library/imaplib.po b/library/imaplib.po index e78b7739b0..353026d0e6 100644 --- a/library/imaplib.po +++ b/library/imaplib.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,8 +35,8 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" diff --git a/library/importlib.metadata.po b/library/importlib.metadata.po index 02d7d7e1c8..c84bdc92dd 100644 --- a/library/importlib.metadata.po +++ b/library/importlib.metadata.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-08 03:35+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-" @@ -161,43 +161,81 @@ msgid "" "`requirements`." msgstr "" -#: ../../library/importlib.metadata.rst:104 +#: ../../library/importlib.metadata.rst:105 +msgid "" +"Subclass of :class:`ModuleNotFoundError` raised by several functions in this " +"module when queried for a distribution package which is not installed in the " +"current Python environment." +msgstr "" + +#: ../../library/importlib.metadata.rst:111 msgid "Functional API" msgstr "" -#: ../../library/importlib.metadata.rst:106 +#: ../../library/importlib.metadata.rst:113 msgid "This package provides the following functionality via its public API." msgstr "" -#: ../../library/importlib.metadata.rst:112 +#: ../../library/importlib.metadata.rst:119 msgid "Entry points" msgstr "" -#: ../../library/importlib.metadata.rst:114 +#: ../../library/importlib.metadata.rst:123 +msgid "" +"Returns a :class:`EntryPoints` instance describing entry points for the " +"current environment. Any given keyword parameters are passed to the :meth:`!" +"select` method for comparison to the attributes of the individual entry " +"point definitions." +msgstr "" + +#: ../../library/importlib.metadata.rst:128 +msgid "" +"Note: it is not currently possible to query for entry points based on their :" +"attr:`!EntryPoint.dist` attribute (as different :class:`!Distribution` " +"instances do not currently compare equal, even if they have the same " +"attributes)" +msgstr "" + +#: ../../library/importlib.metadata.rst:134 +msgid "Details of a collection of installed entry points." +msgstr "" + +#: ../../library/importlib.metadata.rst:136 +msgid "" +"Also provides a ``.groups`` attribute that reports all identifed entry point " +"groups, and a ``.names`` attribute that reports all identified entry point " +"names." +msgstr "" + +#: ../../library/importlib.metadata.rst:142 +msgid "Details of an installed entry point." +msgstr "" + +#: ../../library/importlib.metadata.rst:144 msgid "" -"The ``entry_points()`` function returns a collection of entry points. Entry " -"points are represented by ``EntryPoint`` instances; each ``EntryPoint`` has " -"a ``.name``, ``.group``, and ``.value`` attributes and a ``.load()`` method " -"to resolve the value. There are also ``.module``, ``.attr``, and ``." -"extras`` attributes for getting the components of the ``.value`` attribute." +"Each :class:`!EntryPoint` instance has ``.name``, ``.group``, and ``.value`` " +"attributes and a ``.load()`` method to resolve the value. There are also ``." +"module``, ``.attr``, and ``.extras`` attributes for getting the components " +"of the ``.value`` attribute, and ``.dist`` for obtaining information " +"regarding the distribution package that provides the entry point." msgstr "" -#: ../../library/importlib.metadata.rst:121 +#: ../../library/importlib.metadata.rst:150 msgid "Query all entry points::" msgstr "" -#: ../../library/importlib.metadata.rst:123 +#: ../../library/importlib.metadata.rst:152 msgid ">>> eps = entry_points() " msgstr ">>> eps = entry_points() " -#: ../../library/importlib.metadata.rst:125 +#: ../../library/importlib.metadata.rst:154 msgid "" -"The ``entry_points()`` function returns an ``EntryPoints`` object, a " -"collection of all ``EntryPoint`` objects with ``names`` and ``groups`` " +"The :func:`!entry_points` function returns a :class:`!EntryPoints` object, a " +"collection of all :class:`!EntryPoint` objects with ``names`` and ``groups`` " "attributes for convenience::" msgstr "" -#: ../../library/importlib.metadata.rst:129 +#: ../../library/importlib.metadata.rst:158 msgid "" ">>> sorted(eps.groups) \n" "['console_scripts', 'distutils.commands', 'distutils.setup_keywords', " @@ -207,32 +245,33 @@ msgstr "" "['console_scripts', 'distutils.commands', 'distutils.setup_keywords', " "'egg_info.writers', 'setuptools.installation']" -#: ../../library/importlib.metadata.rst:132 +#: ../../library/importlib.metadata.rst:161 msgid "" -"``EntryPoints`` has a ``select`` method to select entry points matching " -"specific properties. Select entry points in the ``console_scripts`` group::" +":class:`!EntryPoints` has a :meth:`!select` method to select entry points " +"matching specific properties. Select entry points in the ``console_scripts`` " +"group::" msgstr "" -#: ../../library/importlib.metadata.rst:136 +#: ../../library/importlib.metadata.rst:165 msgid ">>> scripts = eps.select(group='console_scripts') " msgstr ">>> scripts = eps.select(group='console_scripts') " -#: ../../library/importlib.metadata.rst:138 +#: ../../library/importlib.metadata.rst:167 msgid "" -"Equivalently, since ``entry_points`` passes keyword arguments through to " -"select::" +"Equivalently, since :func:`!entry_points` passes keyword arguments through " +"to select::" msgstr "" -#: ../../library/importlib.metadata.rst:141 +#: ../../library/importlib.metadata.rst:170 msgid ">>> scripts = entry_points(group='console_scripts') " msgstr ">>> scripts = entry_points(group='console_scripts') " -#: ../../library/importlib.metadata.rst:143 +#: ../../library/importlib.metadata.rst:172 msgid "" "Pick out a specific script named \"wheel\" (found in the wheel project)::" msgstr "" -#: ../../library/importlib.metadata.rst:145 +#: ../../library/importlib.metadata.rst:174 msgid "" ">>> 'wheel' in scripts.names \n" "True\n" @@ -242,11 +281,11 @@ msgstr "" "True\n" ">>> wheel = scripts['wheel'] " -#: ../../library/importlib.metadata.rst:149 +#: ../../library/importlib.metadata.rst:178 msgid "Equivalently, query for that entry point during selection::" msgstr "" -#: ../../library/importlib.metadata.rst:151 +#: ../../library/importlib.metadata.rst:180 msgid "" ">>> (wheel,) = entry_points(group='console_scripts', name='wheel') \n" ">>> (wheel,) = entry_points().select(group='console_scripts', name='wheel') " @@ -254,11 +293,11 @@ msgstr "" ">>> (wheel,) = entry_points(group='console_scripts', name='wheel') \n" ">>> (wheel,) = entry_points().select(group='console_scripts', name='wheel') " -#: ../../library/importlib.metadata.rst:154 +#: ../../library/importlib.metadata.rst:183 msgid "Inspect the resolved entry point::" msgstr "" -#: ../../library/importlib.metadata.rst:156 +#: ../../library/importlib.metadata.rst:185 msgid "" ">>> wheel \n" "EntryPoint(name='wheel', value='wheel.cli:main', group='console_scripts')\n" @@ -284,7 +323,7 @@ msgstr "" ">>> main \n" "" -#: ../../library/importlib.metadata.rst:168 +#: ../../library/importlib.metadata.rst:197 msgid "" "The ``group`` and ``name`` are arbitrary values defined by the package " "author and usually a client will wish to resolve all entry points for a " @@ -293,7 +332,7 @@ msgid "" "their definition, and usage." msgstr "" -#: ../../library/importlib.metadata.rst:174 +#: ../../library/importlib.metadata.rst:203 msgid "" "The \"selectable\" entry points were introduced in ``importlib_metadata`` " "3.6 and Python 3.10. Prior to those changes, ``entry_points`` accepted no " @@ -303,35 +342,66 @@ msgid "" "entry_points_selectable` for compatibility options." msgstr "" -#: ../../library/importlib.metadata.rst:183 +#: ../../library/importlib.metadata.rst:212 msgid "" "``EntryPoint`` objects no longer present a tuple-like interface (:meth:" "`~object.__getitem__`)." msgstr "" -#: ../../library/importlib.metadata.rst:190 +#: ../../library/importlib.metadata.rst:219 msgid "Distribution metadata" msgstr "" -#: ../../library/importlib.metadata.rst:192 +#: ../../library/importlib.metadata.rst:223 +msgid "" +"Return the distribution metadata corresponding to the named distribution " +"package as a :class:`PackageMetadata` instance." +msgstr "" + +#: ../../library/importlib.metadata.rst:226 +#: ../../library/importlib.metadata.rst:274 +#: ../../library/importlib.metadata.rst:295 +#: ../../library/importlib.metadata.rst:358 +#: ../../library/importlib.metadata.rst:409 +msgid "" +"Raises :exc:`PackageNotFoundError` if the named distribution package is not " +"installed in the current Python environment." +msgstr "" + +#: ../../library/importlib.metadata.rst:231 +msgid "A concrete implementation of the" +msgstr "" + +#: ../../library/importlib.metadata.rst:232 +msgid "" +"`PackageMetadata protocol `_." +msgstr "" + +#: ../../library/importlib.metadata.rst:234 +msgid "" +"In addition to providing the defined protocol methods and attributes, " +"subscripting the instance is equivalent to calling the :meth:`!get` method." +msgstr "" + +#: ../../library/importlib.metadata.rst:237 msgid "" "Every `Distribution Package `_ includes some metadata, which you can extract " -"using the ``metadata()`` function::" +"using the :func:`!metadata` function::" msgstr "" -#: ../../library/importlib.metadata.rst:196 +#: ../../library/importlib.metadata.rst:240 msgid ">>> wheel_metadata = metadata('wheel') " msgstr ">>> wheel_metadata = metadata('wheel') " -#: ../../library/importlib.metadata.rst:198 +#: ../../library/importlib.metadata.rst:242 msgid "" -"The keys of the returned data structure, a ``PackageMetadata``, name the " -"metadata keywords, and the values are returned unparsed from the " -"distribution metadata::" +"The keys of the returned data structure name the metadata keywords, and the " +"values are returned unparsed from the distribution metadata::" msgstr "" -#: ../../library/importlib.metadata.rst:202 +#: ../../library/importlib.metadata.rst:245 msgid "" ">>> wheel_metadata['Requires-Python'] \n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" @@ -339,13 +409,13 @@ msgstr "" ">>> wheel_metadata['Requires-Python'] \n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" -#: ../../library/importlib.metadata.rst:205 +#: ../../library/importlib.metadata.rst:248 msgid "" -"``PackageMetadata`` also presents a ``json`` attribute that returns all the " -"metadata in a JSON-compatible form per :PEP:`566`::" +":class:`PackageMetadata` also presents a :attr:`!json` attribute that " +"returns all the metadata in a JSON-compatible form per :PEP:`566`::" msgstr "" -#: ../../library/importlib.metadata.rst:208 +#: ../../library/importlib.metadata.rst:251 msgid "" ">>> wheel_metadata.json['requires_python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" @@ -353,36 +423,42 @@ msgstr "" ">>> wheel_metadata.json['requires_python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" -#: ../../library/importlib.metadata.rst:213 +#: ../../library/importlib.metadata.rst:254 +#: ../../library/importlib.metadata.rst:452 msgid "" -"The actual type of the object returned by ``metadata()`` is an " -"implementation detail and should be accessed only through the interface " -"described by the `PackageMetadata protocol `_." +"The full set of available metadata is not described here. See the PyPA `Core " +"metadata specification `_ for additional details." msgstr "" -#: ../../library/importlib.metadata.rst:218 +#: ../../library/importlib.metadata.rst:257 msgid "" "The ``Description`` is now included in the metadata when presented through " "the payload. Line continuation characters have been removed." msgstr "" -#: ../../library/importlib.metadata.rst:222 +#: ../../library/importlib.metadata.rst:261 msgid "The ``json`` attribute was added." msgstr "新增 ``json`` 屬性。" -#: ../../library/importlib.metadata.rst:228 +#: ../../library/importlib.metadata.rst:267 msgid "Distribution versions" msgstr "" -#: ../../library/importlib.metadata.rst:230 +#: ../../library/importlib.metadata.rst:271 msgid "" -"The ``version()`` function is the quickest way to get a `Distribution " +"Return the installed distribution package version for the named distribution " +"package." +msgstr "" + +#: ../../library/importlib.metadata.rst:277 +msgid "" +"The :func:`!version` function is the quickest way to get a `Distribution " "Package `_'s version number, as a string::" msgstr "" -#: ../../library/importlib.metadata.rst:234 +#: ../../library/importlib.metadata.rst:281 msgid "" ">>> version('wheel') \n" "'0.32.3'" @@ -390,22 +466,38 @@ msgstr "" ">>> version('wheel') \n" "'0.32.3'" -#: ../../library/importlib.metadata.rst:241 +#: ../../library/importlib.metadata.rst:288 msgid "Distribution files" msgstr "" -#: ../../library/importlib.metadata.rst:243 +#: ../../library/importlib.metadata.rst:292 msgid "" -"You can also get the full set of files contained within a distribution. The " -"``files()`` function takes a `Distribution Package `_ name and returns all of " -"the files installed by this distribution. Each file object returned is a " -"``PackagePath``, a :class:`pathlib.PurePath` derived object with additional " -"``dist``, ``size``, and ``hash`` properties as indicated by the metadata. " -"For example::" +"Return the full set of files contained within the named distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:250 +#: ../../library/importlib.metadata.rst:298 +msgid "" +"Returns :const:`None` if the distribution is found but the installation " +"database records reporting the files associated with the distribuion package " +"are missing." +msgstr "" + +#: ../../library/importlib.metadata.rst:304 +msgid "" +"A :class:`pathlib.PurePath` derived object with additional ``dist``, " +"``size``, and ``hash`` properties corresponding to the distribution " +"package's installation metadata for that file." +msgstr "" + +#: ../../library/importlib.metadata.rst:308 +msgid "" +"The :func:`!files` function takes a `Distribution Package `_ name and returns " +"all of the files installed by this distribution. Each file is reported as a :" +"class:`PackagePath` instance. For example::" +msgstr "" + +#: ../../library/importlib.metadata.rst:313 msgid "" ">>> util = [p for p in files('wheel') if 'util.py' in str(p)][0] \n" ">>> util \n" @@ -427,11 +519,11 @@ msgstr "" ">>> util.hash \n" "" -#: ../../library/importlib.metadata.rst:260 +#: ../../library/importlib.metadata.rst:323 msgid "Once you have the file, you can also read its contents::" msgstr "" -#: ../../library/importlib.metadata.rst:262 +#: ../../library/importlib.metadata.rst:325 msgid "" ">>> print(util.read_text()) \n" "import base64\n" @@ -451,13 +543,13 @@ msgstr "" " return s.encode('utf-8')\n" " return s" -#: ../../library/importlib.metadata.rst:271 +#: ../../library/importlib.metadata.rst:334 msgid "" -"You can also use the ``locate`` method to get a the absolute path to the " +"You can also use the :meth:`!locate` method to get the absolute path to the " "file::" msgstr "" -#: ../../library/importlib.metadata.rst:274 +#: ../../library/importlib.metadata.rst:337 msgid "" ">>> util.locate() \n" "PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')" @@ -465,28 +557,33 @@ msgstr "" ">>> util.locate() \n" "PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')" -#: ../../library/importlib.metadata.rst:277 +#: ../../library/importlib.metadata.rst:340 msgid "" -"In the case where the metadata file listing files (RECORD or SOURCES.txt) is " -"missing, ``files()`` will return ``None``. The caller may wish to wrap calls " -"to ``files()`` in `always_iterable `_ or otherwise guard against " -"this condition if the target distribution is not known to have the metadata " -"present." +"In the case where the metadata file listing files (``RECORD`` or ``SOURCES." +"txt``) is missing, :func:`!files` will return :const:`None`. The caller may " +"wish to wrap calls to :func:`!files` in `always_iterable `_ or otherwise guard against this condition if the target " +"distribution is not known to have the metadata present." msgstr "" -#: ../../library/importlib.metadata.rst:288 +#: ../../library/importlib.metadata.rst:351 msgid "Distribution requirements" msgstr "" -#: ../../library/importlib.metadata.rst:290 +#: ../../library/importlib.metadata.rst:355 +msgid "" +"Return the declared dependency specifiers for the named distribution package." +msgstr "" + +#: ../../library/importlib.metadata.rst:361 msgid "" "To get the full set of requirements for a `Distribution Package `_, use " -"the ``requires()`` function::" +"the :func:`!requires` function::" msgstr "" -#: ../../library/importlib.metadata.rst:294 +#: ../../library/importlib.metadata.rst:365 msgid "" ">>> requires('wheel') \n" "[\"pytest (>=3.0.0) ; extra == 'test'\", \"pytest-cov ; extra == 'test'\"]" @@ -494,11 +591,25 @@ msgstr "" ">>> requires('wheel') \n" "[\"pytest (>=3.0.0) ; extra == 'test'\", \"pytest-cov ; extra == 'test'\"]" -#: ../../library/importlib.metadata.rst:302 +#: ../../library/importlib.metadata.rst:373 msgid "Mapping import to distribution packages" msgstr "" -#: ../../library/importlib.metadata.rst:304 +#: ../../library/importlib.metadata.rst:377 +msgid "" +"Return a mapping from the top level module and import package names found " +"via :attr:`sys.meta_path` to the names of the distribution packages (if any) " +"that provide the corresponding files." +msgstr "" + +#: ../../library/importlib.metadata.rst:381 +msgid "" +"To allow for namespace packages (which may have members provided by multiple " +"distribution packages), each top level import name maps to a list of " +"distribution names rather than mapping directly to a single name." +msgstr "" + +#: ../../library/importlib.metadata.rst:385 msgid "" "A convenience method to resolve the `Distribution Package `_ name (or names, " @@ -507,7 +618,7 @@ msgid "" "glossary/#term-Import-Package>`_::" msgstr "" -#: ../../library/importlib.metadata.rst:309 +#: ../../library/importlib.metadata.rst:390 msgid "" ">>> packages_distributions()\n" "{'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': " @@ -517,41 +628,64 @@ msgstr "" "{'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': " "['jaraco.classes', 'jaraco.functools'], ...}" -#: ../../library/importlib.metadata.rst:312 +#: ../../library/importlib.metadata.rst:393 msgid "" "Some editable installs, `do not supply top-level names `_, and thus this function is not " "reliable with such installs." msgstr "" -#: ../../library/importlib.metadata.rst:321 +#: ../../library/importlib.metadata.rst:402 msgid "Distributions" msgstr "" -#: ../../library/importlib.metadata.rst:323 +#: ../../library/importlib.metadata.rst:406 msgid "" -"While the above API is the most common and convenient usage, you can get all " -"of that information from the ``Distribution`` class. A ``Distribution`` is " -"an abstract object that represents the metadata for a Python `Distribution " -"Package `_. You can get the ``Distribution`` instance::" +"Return a :class:`Distribution` instance describing the named distribution " +"package." msgstr "" -#: ../../library/importlib.metadata.rst:329 +#: ../../library/importlib.metadata.rst:414 +msgid "Details of an installed distribution package." +msgstr "" + +#: ../../library/importlib.metadata.rst:416 +msgid "" +"Note: different :class:`!Distribution` instances do not currently compare " +"equal, even if they relate to the same installed distribution and " +"accordingly have the same attributes." +msgstr "" + +#: ../../library/importlib.metadata.rst:420 +msgid "" +"While the module level API described above is the most common and convenient " +"usage, you can get all of that information from the :class:`!Distribution` " +"class. :class:`!Distribution` is an abstract object that represents the " +"metadata for a Python `Distribution Package `_. You can get the concreate :" +"class:`!Distribution` subclass instance for an installed distribution " +"package by calling the :func:`distribution` function::" +msgstr "" + +#: ../../library/importlib.metadata.rst:427 msgid "" ">>> from importlib.metadata import distribution \n" -">>> dist = distribution('wheel') " +">>> dist = distribution('wheel') \n" +">>> type(dist) \n" +"" msgstr "" ">>> from importlib.metadata import distribution \n" -">>> dist = distribution('wheel') " +">>> dist = distribution('wheel') \n" +">>> type(dist) \n" +"" -#: ../../library/importlib.metadata.rst:332 +#: ../../library/importlib.metadata.rst:432 msgid "" -"Thus, an alternative way to get the version number is through the " -"``Distribution`` instance::" +"Thus, an alternative way to get the version number is through the :class:`!" +"Distribution` instance::" msgstr "" -#: ../../library/importlib.metadata.rst:335 +#: ../../library/importlib.metadata.rst:435 msgid "" ">>> dist.version \n" "'0.32.3'" @@ -559,13 +693,13 @@ msgstr "" ">>> dist.version \n" "'0.32.3'" -#: ../../library/importlib.metadata.rst:338 +#: ../../library/importlib.metadata.rst:438 msgid "" -"There are all kinds of additional metadata available on the ``Distribution`` " -"instance::" +"There are all kinds of additional metadata available on :class:`!" +"Distribution` instances::" msgstr "" -#: ../../library/importlib.metadata.rst:341 +#: ../../library/importlib.metadata.rst:441 msgid "" ">>> dist.metadata['Requires-Python'] \n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'\n" @@ -577,35 +711,27 @@ msgstr "" ">>> dist.metadata['License'] \n" "'MIT'" -#: ../../library/importlib.metadata.rst:346 +#: ../../library/importlib.metadata.rst:446 msgid "" "For editable packages, an ``origin`` property may present :pep:`610` " "metadata::" msgstr "" -#: ../../library/importlib.metadata.rst:349 +#: ../../library/importlib.metadata.rst:449 msgid "" ">>> dist.origin.url\n" "'file:///path/to/wheel-0.32.3.editable-py3-none-any.whl'" msgstr "" -#: ../../library/importlib.metadata.rst:352 -msgid "" -"The full set of available metadata is not described here. See the `Core " -"metadata specifications `_ for additional details." -msgstr "" - -#: ../../library/importlib.metadata.rst:355 -#, fuzzy +#: ../../library/importlib.metadata.rst:455 msgid "The ``.origin`` property was added." -msgstr "新增 ``json`` 屬性。" +msgstr "新增 ``.origin`` 屬性 (property)。" -#: ../../library/importlib.metadata.rst:359 +#: ../../library/importlib.metadata.rst:459 msgid "Distribution Discovery" msgstr "" -#: ../../library/importlib.metadata.rst:361 +#: ../../library/importlib.metadata.rst:461 msgid "" "By default, this package provides built-in support for discovery of metadata " "for file system and zip file `Distribution Package `_ metadata is not available through :" @@ -640,14 +766,14 @@ msgid "" "on :data:`sys.meta_path`." msgstr "" -#: ../../library/importlib.metadata.rst:380 +#: ../../library/importlib.metadata.rst:480 msgid "" "By default ``importlib.metadata`` installs a finder for distribution " "packages found on the file system. This finder doesn't actually find any " "*distributions*, but it can find their metadata." msgstr "" -#: ../../library/importlib.metadata.rst:385 +#: ../../library/importlib.metadata.rst:485 msgid "" "The abstract class :py:class:`importlib.abc.MetaPathFinder` defines the " "interface expected of finders by Python's import system. ``importlib." @@ -657,7 +783,7 @@ msgid "" "base class, which defines this abstract method::" msgstr "" -#: ../../library/importlib.metadata.rst:393 +#: ../../library/importlib.metadata.rst:493 msgid "" "@abc.abstractmethod\n" "def find_distributions(context=DistributionFinder.Context()):\n" @@ -666,14 +792,14 @@ msgid "" " \"\"\"" msgstr "" -#: ../../library/importlib.metadata.rst:399 +#: ../../library/importlib.metadata.rst:499 msgid "" "The ``DistributionFinder.Context`` object provides ``.path`` and ``.name`` " "properties indicating the path to search and name to match and may supply " "other relevant context." msgstr "" -#: ../../library/importlib.metadata.rst:403 +#: ../../library/importlib.metadata.rst:503 msgid "" "What this means in practice is that to support finding distribution package " "metadata in locations other than the file system, subclass ``Distribution`` " @@ -682,17 +808,17 @@ msgid "" "method." msgstr "" -#: ../../library/importlib.metadata.rst:410 +#: ../../library/importlib.metadata.rst:510 msgid "Example" msgstr "" -#: ../../library/importlib.metadata.rst:412 +#: ../../library/importlib.metadata.rst:512 msgid "" "Consider for example a custom finder that loads Python modules from a " "database::" msgstr "" -#: ../../library/importlib.metadata.rst:415 +#: ../../library/importlib.metadata.rst:515 msgid "" "class DatabaseImporter(importlib.abc.MetaPathFinder):\n" " def __init__(self, db):\n" @@ -704,14 +830,14 @@ msgid "" "sys.meta_path.append(DatabaseImporter(connect_db(...)))" msgstr "" -#: ../../library/importlib.metadata.rst:424 +#: ../../library/importlib.metadata.rst:524 msgid "" "That importer now presumably provides importable modules from a database, " "but it provides no metadata or entry points. For this custom importer to " "provide metadata, it would also need to implement ``DistributionFinder``::" msgstr "" -#: ../../library/importlib.metadata.rst:429 +#: ../../library/importlib.metadata.rst:529 msgid "" "from importlib.metadata import DistributionFinder\n" "\n" @@ -724,7 +850,7 @@ msgid "" " yield DatabaseDistribution(dist_record)" msgstr "" -#: ../../library/importlib.metadata.rst:439 +#: ../../library/importlib.metadata.rst:539 msgid "" "In this way, ``query_distributions`` would return records for each " "distribution served by the database matching the query. For example, if " @@ -733,7 +859,7 @@ msgid "" "``Context(name=None)``." msgstr "" -#: ../../library/importlib.metadata.rst:445 +#: ../../library/importlib.metadata.rst:545 msgid "" "For the sake of simplicity, this example ignores ``context.path``\\. The " "``path`` attribute defaults to ``sys.path`` and is the set of import paths " @@ -746,11 +872,11 @@ msgid "" "``context.path`` and only yield ``Distribution``\\ s pertinent to that path." msgstr "" -#: ../../library/importlib.metadata.rst:456 +#: ../../library/importlib.metadata.rst:556 msgid "``DatabaseDistribution``, then, would look something like::" msgstr "" -#: ../../library/importlib.metadata.rst:458 +#: ../../library/importlib.metadata.rst:558 msgid "" "class DatabaseDistribution(importlib.metadata.Distributon):\n" " def __init__(self, record):\n" @@ -773,14 +899,14 @@ msgid "" " raise RuntimeError(\"This distribution has no file system\")" msgstr "" -#: ../../library/importlib.metadata.rst:478 +#: ../../library/importlib.metadata.rst:578 msgid "" "This basic implementation should provide metadata and entry points for " "packages served by the ``DatabaseImporter``, assuming that the ``record`` " "supplies suitable ``.name``, ``.version``, and ``.entry_points`` attributes." msgstr "" -#: ../../library/importlib.metadata.rst:483 +#: ../../library/importlib.metadata.rst:583 msgid "" "The ``DatabaseDistribution`` may also provide other metadata files, like " "``RECORD`` (required for ``Distribution.files``) or override the " diff --git a/library/importlib.po b/library/importlib.po index 9946fd1bea..abe935981e 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-28 00:13+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -422,11 +422,11 @@ msgid "" "An abstract method for finding a :term:`spec ` for the " "specified module. If this is a top-level import, *path* will be ``None``. " "Otherwise, this is a search for a subpackage or module and *path* will be " -"the value of :attr:`__path__` from the parent package. If a spec cannot be " -"found, ``None`` is returned. When passed in, ``target`` is a module object " -"that the finder may use to make a more educated guess about what spec to " -"return. :func:`importlib.util.spec_from_loader` may be useful for " -"implementing concrete ``MetaPathFinders``." +"the value of :attr:`~module.__path__` from the parent package. If a spec " +"cannot be found, ``None`` is returned. When passed in, ``target`` is a " +"module object that the finder may use to make a more educated guess about " +"what spec to return. :func:`importlib.util.spec_from_loader` may be useful " +"for implementing concrete ``MetaPathFinders``." msgstr "" #: ../../library/importlib.rst:263 @@ -530,81 +530,42 @@ msgid "" msgstr "" #: ../../library/importlib.rst:358 -msgid ":attr:`__name__`" -msgstr ":attr:`__name__`" +msgid ":attr:`module.__name__`" +msgstr ":attr:`module.__name__`" #: ../../library/importlib.rst:359 -msgid "" -"The module's fully qualified name. It is ``'__main__'`` for an executed " -"module." -msgstr "" - -#: ../../library/importlib.rst:362 -msgid ":attr:`__file__`" -msgstr ":attr:`__file__`" - -#: ../../library/importlib.rst:363 -msgid "" -"The location the :term:`loader` used to load the module. For example, for " -"modules loaded from a .py file this is the filename. It is not set on all " -"modules (e.g. built-in modules)." -msgstr "" +msgid ":attr:`module.__file__`" +msgstr ":attr:`module.__file__`" -#: ../../library/importlib.rst:367 -msgid ":attr:`__cached__`" -msgstr ":attr:`__cached__`" +#: ../../library/importlib.rst:360 +msgid ":attr:`module.__cached__` *(deprecated)*" +msgstr ":attr:`module.__cached__` *(已棄用)*" -#: ../../library/importlib.rst:368 -msgid "" -"The filename of a compiled version of the module's code. It is not set on " -"all modules (e.g. built-in modules)." -msgstr "" +#: ../../library/importlib.rst:361 +msgid ":attr:`module.__path__`" +msgstr ":attr:`module.__path__`" -#: ../../library/importlib.rst:371 -msgid ":attr:`__path__`" -msgstr ":attr:`__path__`" - -#: ../../library/importlib.rst:372 -msgid "" -"The list of locations where the package's submodules will be found. Most of " -"the time this is a single directory. The import system passes this attribute " -"to ``__import__()`` and to finders in the same way as :data:`sys.path` but " -"just for the package. It is not set on non-package modules so it can be used " -"as an indicator that the module is a package." -msgstr "" - -#: ../../library/importlib.rst:379 -msgid ":attr:`__package__`" -msgstr ":attr:`__package__`" - -#: ../../library/importlib.rst:380 -msgid "" -"The fully qualified name of the package the module is in (or the empty " -"string for a top-level module). If the module is a package then this is the " -"same as :attr:`__name__`." -msgstr "" - -#: ../../library/importlib.rst:384 -msgid ":attr:`__loader__`" -msgstr ":attr:`__loader__`" +#: ../../library/importlib.rst:362 +msgid ":attr:`module.__package__` *(deprecated)*" +msgstr ":attr:`module.__package__` *(已棄用)*" -#: ../../library/importlib.rst:385 -msgid "The :term:`loader` used to load the module." -msgstr "" +#: ../../library/importlib.rst:363 +msgid ":attr:`module.__loader__` *(deprecated)*" +msgstr ":attr:`module.__loader__` *(已棄用)*" -#: ../../library/importlib.rst:387 +#: ../../library/importlib.rst:365 msgid "" "When :meth:`exec_module` is available then backwards-compatible " "functionality is provided." msgstr "" -#: ../../library/importlib.rst:390 +#: ../../library/importlib.rst:368 msgid "" "Raise :exc:`ImportError` when called instead of :exc:`NotImplementedError`. " "Functionality provided when :meth:`exec_module` is available." msgstr "" -#: ../../library/importlib.rst:395 +#: ../../library/importlib.rst:373 msgid "" "The recommended API for loading a module is :meth:`exec_module` (and :meth:" "`create_module`). Loaders should implement it instead of :meth:" @@ -613,56 +574,56 @@ msgid "" "implemented." msgstr "" -#: ../../library/importlib.rst:405 +#: ../../library/importlib.rst:383 msgid "" "An abstract base class for a :term:`loader` which implements the optional :" "pep:`302` protocol for loading arbitrary resources from the storage back-end." msgstr "" -#: ../../library/importlib.rst:409 +#: ../../library/importlib.rst:387 msgid "" "This ABC is deprecated in favour of supporting resource loading through :" "class:`importlib.resources.abc.ResourceReader`." msgstr "" -#: ../../library/importlib.rst:415 +#: ../../library/importlib.rst:393 msgid "" "An abstract method to return the bytes for the data located at *path*. " "Loaders that have a file-like storage back-end that allows storing arbitrary " "data can implement this abstract method to give direct access to the data " "stored. :exc:`OSError` is to be raised if the *path* cannot be found. The " -"*path* is expected to be constructed using a module's :attr:`__file__` " -"attribute or an item from a package's :attr:`__path__`." +"*path* is expected to be constructed using a module's :attr:`~module." +"__file__` attribute or an item from a package's :attr:`~module.__path__`." msgstr "" -#: ../../library/importlib.rst:423 +#: ../../library/importlib.rst:402 msgid "Raises :exc:`OSError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:429 +#: ../../library/importlib.rst:408 msgid "" "An abstract base class for a :term:`loader` which implements the optional :" "pep:`302` protocol for loaders that inspect modules." msgstr "" -#: ../../library/importlib.rst:434 +#: ../../library/importlib.rst:413 msgid "" "Return the code object for a module, or ``None`` if the module does not have " "a code object (as would be the case, for example, for a built-in module). " "Raise an :exc:`ImportError` if loader cannot find the requested module." msgstr "" -#: ../../library/importlib.rst:440 +#: ../../library/importlib.rst:419 msgid "" "While the method has a default implementation, it is suggested that it be " "overridden if possible for performance." msgstr "" -#: ../../library/importlib.rst:446 +#: ../../library/importlib.rst:425 msgid "No longer abstract and a concrete implementation is provided." msgstr "" -#: ../../library/importlib.rst:451 +#: ../../library/importlib.rst:430 msgid "" "An abstract method to return the source of a module. It is returned as a " "text string using :term:`universal newlines`, translating all recognized " @@ -671,23 +632,23 @@ msgid "" "cannot find the module specified." msgstr "" -#: ../../library/importlib.rst:457 ../../library/importlib.rst:466 -#: ../../library/importlib.rst:516 +#: ../../library/importlib.rst:436 ../../library/importlib.rst:445 +#: ../../library/importlib.rst:495 msgid "Raises :exc:`ImportError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:462 +#: ../../library/importlib.rst:441 msgid "" "An optional method to return a true value if the module is a package, a " "false value otherwise. :exc:`ImportError` is raised if the :term:`loader` " "cannot find the module." msgstr "" -#: ../../library/importlib.rst:471 +#: ../../library/importlib.rst:450 msgid "Create a code object from Python source." msgstr "" -#: ../../library/importlib.rst:473 +#: ../../library/importlib.rst:452 msgid "" "The *data* argument can be whatever the :func:`compile` function supports (i." "e. string or bytes). The *path* argument should be the \"path\" to where the " @@ -695,106 +656,107 @@ msgid "" "in a zip file)." msgstr "" -#: ../../library/importlib.rst:478 +#: ../../library/importlib.rst:457 msgid "" "With the subsequent code object one can execute it in a module by running " "``exec(code, module.__dict__)``." msgstr "" -#: ../../library/importlib.rst:483 +#: ../../library/importlib.rst:462 msgid "Made the method static." msgstr "" -#: ../../library/importlib.rst:488 +#: ../../library/importlib.rst:467 msgid "Implementation of :meth:`Loader.exec_module`." msgstr ":meth:`Loader.exec_module` 的實作。" -#: ../../library/importlib.rst:494 +#: ../../library/importlib.rst:473 msgid "Implementation of :meth:`Loader.load_module`." msgstr ":meth:`Loader.load_module` 的實作。" -#: ../../library/importlib.rst:496 +#: ../../library/importlib.rst:475 msgid "use :meth:`exec_module` instead." msgstr "請改用 :meth:`exec_module`。" -#: ../../library/importlib.rst:502 +#: ../../library/importlib.rst:481 msgid "" "An abstract base class which inherits from :class:`InspectLoader` that, when " "implemented, helps a module to be executed as a script. The ABC represents " "an optional :pep:`302` protocol." msgstr "" -#: ../../library/importlib.rst:508 +#: ../../library/importlib.rst:487 msgid "" -"An abstract method that is to return the value of :attr:`__file__` for the " -"specified module. If no path is available, :exc:`ImportError` is raised." +"An abstract method that is to return the value of :attr:`~module.__file__` " +"for the specified module. If no path is available, :exc:`ImportError` is " +"raised." msgstr "" -#: ../../library/importlib.rst:512 +#: ../../library/importlib.rst:491 msgid "" "If source code is available, then the method should return the path to the " "source file, regardless of whether a bytecode was used to load the module." msgstr "" -#: ../../library/importlib.rst:522 +#: ../../library/importlib.rst:501 msgid "" "An abstract base class which inherits from :class:`ResourceLoader` and :" "class:`ExecutionLoader`, providing concrete implementations of :meth:" "`ResourceLoader.get_data` and :meth:`ExecutionLoader.get_filename`." msgstr "" -#: ../../library/importlib.rst:526 +#: ../../library/importlib.rst:505 msgid "" "The *fullname* argument is a fully resolved name of the module the loader is " "to handle. The *path* argument is the path to the file for the module." msgstr "" -#: ../../library/importlib.rst:533 +#: ../../library/importlib.rst:512 msgid "The name of the module the loader can handle." msgstr "" -#: ../../library/importlib.rst:537 +#: ../../library/importlib.rst:516 msgid "Path to the file of the module." msgstr "" -#: ../../library/importlib.rst:541 +#: ../../library/importlib.rst:520 msgid "Calls super's ``load_module()``." msgstr "" -#: ../../library/importlib.rst:543 +#: ../../library/importlib.rst:522 msgid "Use :meth:`Loader.exec_module` instead." msgstr "" -#: ../../library/importlib.rst:548 ../../library/importlib.rst:1143 +#: ../../library/importlib.rst:527 ../../library/importlib.rst:1122 msgid "Returns :attr:`path`." msgstr "" -#: ../../library/importlib.rst:552 +#: ../../library/importlib.rst:531 msgid "Reads *path* as a binary file and returns the bytes from it." msgstr "" -#: ../../library/importlib.rst:557 +#: ../../library/importlib.rst:536 msgid "" "An abstract base class for implementing source (and optionally bytecode) " "file loading. The class inherits from both :class:`ResourceLoader` and :" "class:`ExecutionLoader`, requiring the implementation of:" msgstr "" -#: ../../library/importlib.rst:561 +#: ../../library/importlib.rst:540 msgid ":meth:`ResourceLoader.get_data`" msgstr ":meth:`ResourceLoader.get_data`" -#: ../../library/importlib.rst:562 +#: ../../library/importlib.rst:541 msgid ":meth:`ExecutionLoader.get_filename`" msgstr ":meth:`ExecutionLoader.get_filename`" -#: ../../library/importlib.rst:563 +#: ../../library/importlib.rst:542 msgid "" "Should only return the path to the source file; sourceless loading is not " "supported." msgstr "" -#: ../../library/importlib.rst:566 +#: ../../library/importlib.rst:545 msgid "" "The abstract methods defined by this class are to add optional bytecode file " "support. Not implementing these optional methods (or causing them to raise :" @@ -806,83 +768,83 @@ msgid "" "bytecode-specific API is exposed." msgstr "" -#: ../../library/importlib.rst:577 +#: ../../library/importlib.rst:556 msgid "" "Optional abstract method which returns a :class:`dict` containing metadata " "about the specified path. Supported dictionary keys are:" msgstr "" -#: ../../library/importlib.rst:580 +#: ../../library/importlib.rst:559 msgid "" "``'mtime'`` (mandatory): an integer or floating-point number representing " "the modification time of the source code;" msgstr "" -#: ../../library/importlib.rst:582 +#: ../../library/importlib.rst:561 msgid "``'size'`` (optional): the size in bytes of the source code." msgstr "" -#: ../../library/importlib.rst:584 +#: ../../library/importlib.rst:563 msgid "" "Any other keys in the dictionary are ignored, to allow for future " "extensions. If the path cannot be handled, :exc:`OSError` is raised." msgstr "" -#: ../../library/importlib.rst:589 ../../library/importlib.rst:602 +#: ../../library/importlib.rst:568 ../../library/importlib.rst:581 msgid "Raise :exc:`OSError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:594 +#: ../../library/importlib.rst:573 msgid "" "Optional abstract method which returns the modification time for the " "specified path." msgstr "" -#: ../../library/importlib.rst:597 +#: ../../library/importlib.rst:576 msgid "" "This method is deprecated in favour of :meth:`path_stats`. You don't have " "to implement it, but it is still available for compatibility purposes. " "Raise :exc:`OSError` if the path cannot be handled." msgstr "" -#: ../../library/importlib.rst:607 +#: ../../library/importlib.rst:586 msgid "" "Optional abstract method which writes the specified bytes to a file path. " "Any intermediate directories which do not exist are to be created " "automatically." msgstr "" -#: ../../library/importlib.rst:611 +#: ../../library/importlib.rst:590 msgid "" "When writing to the path fails because the path is read-only (:const:`errno." "EACCES`/:exc:`PermissionError`), do not propagate the exception." msgstr "" -#: ../../library/importlib.rst:615 +#: ../../library/importlib.rst:594 msgid "No longer raises :exc:`NotImplementedError` when called." msgstr "" -#: ../../library/importlib.rst:620 +#: ../../library/importlib.rst:599 msgid "Concrete implementation of :meth:`InspectLoader.get_code`." msgstr "" -#: ../../library/importlib.rst:624 +#: ../../library/importlib.rst:603 msgid "Concrete implementation of :meth:`Loader.exec_module`." msgstr "" -#: ../../library/importlib.rst:630 +#: ../../library/importlib.rst:609 msgid "Concrete implementation of :meth:`Loader.load_module`." msgstr "" -#: ../../library/importlib.rst:632 +#: ../../library/importlib.rst:611 msgid "Use :meth:`exec_module` instead." msgstr "" -#: ../../library/importlib.rst:637 +#: ../../library/importlib.rst:616 msgid "Concrete implementation of :meth:`InspectLoader.get_source`." msgstr "" -#: ../../library/importlib.rst:641 +#: ../../library/importlib.rst:620 msgid "" "Concrete implementation of :meth:`InspectLoader.is_package`. A module is " "determined to be a package if its file path (as provided by :meth:" @@ -891,16 +853,16 @@ msgid "" "``__init__``." msgstr "" -#: ../../library/importlib.rst:650 +#: ../../library/importlib.rst:629 msgid "*Superseded by TraversableResources*" msgstr "" -#: ../../library/importlib.rst:652 +#: ../../library/importlib.rst:631 msgid "" "An :term:`abstract base class` to provide the ability to read *resources*." msgstr "" -#: ../../library/importlib.rst:655 +#: ../../library/importlib.rst:634 msgid "" "From the perspective of this ABC, a *resource* is a binary artifact that is " "shipped within a package. Typically this is something like a data file that " @@ -910,7 +872,7 @@ msgid "" "file versus on the file system." msgstr "" -#: ../../library/importlib.rst:663 +#: ../../library/importlib.rst:642 msgid "" "For any of methods of this class, a *resource* argument is expected to be a :" "term:`path-like object` which represents conceptually just a file name. This " @@ -922,7 +884,7 @@ msgid "" "potentially representing multiple packages or a module)." msgstr "" -#: ../../library/importlib.rst:674 +#: ../../library/importlib.rst:653 msgid "" "Loaders that wish to support resource reading are expected to provide a " "method called ``get_resource_reader(fullname)`` which returns an object " @@ -931,37 +893,37 @@ msgid "" "with this ABC should only be returned when the specified module is a package." msgstr "" -#: ../../library/importlib.rst:683 ../../library/importlib.rst:793 +#: ../../library/importlib.rst:662 ../../library/importlib.rst:772 msgid "Use :class:`importlib.resources.abc.TraversableResources` instead." msgstr "" -#: ../../library/importlib.rst:688 +#: ../../library/importlib.rst:667 msgid "" "Returns an opened, :term:`file-like object` for binary reading of the " "*resource*." msgstr "" -#: ../../library/importlib.rst:691 +#: ../../library/importlib.rst:670 msgid "If the resource cannot be found, :exc:`FileNotFoundError` is raised." msgstr "" -#: ../../library/importlib.rst:696 +#: ../../library/importlib.rst:675 msgid "Returns the file system path to the *resource*." msgstr "" -#: ../../library/importlib.rst:698 +#: ../../library/importlib.rst:677 msgid "" "If the resource does not concretely exist on the file system, raise :exc:" "`FileNotFoundError`." msgstr "" -#: ../../library/importlib.rst:703 +#: ../../library/importlib.rst:682 msgid "" "Returns ``True`` if the named *name* is considered a resource. :exc:" "`FileNotFoundError` is raised if *name* does not exist." msgstr "" -#: ../../library/importlib.rst:708 +#: ../../library/importlib.rst:687 msgid "" "Returns an :term:`iterable` of strings over the contents of the package. Do " "note that it is not required that all names returned by the iterator be " @@ -969,7 +931,7 @@ msgid "" "`is_resource` would be false." msgstr "" -#: ../../library/importlib.rst:714 +#: ../../library/importlib.rst:693 msgid "" "Allowing non-resource names to be returned is to allow for situations where " "how a package and its resources are stored are known a priori and the non-" @@ -978,71 +940,71 @@ msgid "" "stored on the file system then those subdirectory names can be used directly." msgstr "" -#: ../../library/importlib.rst:722 +#: ../../library/importlib.rst:701 msgid "The abstract method returns an iterable of no items." msgstr "" -#: ../../library/importlib.rst:727 +#: ../../library/importlib.rst:706 msgid "" "An object with a subset of :class:`pathlib.Path` methods suitable for " "traversing directories and opening files." msgstr "" -#: ../../library/importlib.rst:730 +#: ../../library/importlib.rst:709 msgid "" "For a representation of the object on the file-system, use :meth:`importlib." "resources.as_file`." msgstr "" -#: ../../library/importlib.rst:735 +#: ../../library/importlib.rst:714 msgid "Use :class:`importlib.resources.abc.Traversable` instead." msgstr "" -#: ../../library/importlib.rst:740 +#: ../../library/importlib.rst:719 msgid "Abstract. The base name of this object without any parent references." msgstr "" -#: ../../library/importlib.rst:744 +#: ../../library/importlib.rst:723 msgid "Yield ``Traversable`` objects in ``self``." msgstr "" -#: ../../library/importlib.rst:748 +#: ../../library/importlib.rst:727 msgid "Return ``True`` if ``self`` is a directory." msgstr "" -#: ../../library/importlib.rst:752 +#: ../../library/importlib.rst:731 msgid "Return ``True`` if ``self`` is a file." msgstr "" -#: ../../library/importlib.rst:756 +#: ../../library/importlib.rst:735 msgid "Return Traversable child in ``self``." msgstr "" -#: ../../library/importlib.rst:760 +#: ../../library/importlib.rst:739 msgid "Return ``Traversable`` child in ``self``." msgstr "" -#: ../../library/importlib.rst:764 +#: ../../library/importlib.rst:743 msgid "" "*mode* may be 'r' or 'rb' to open as text or binary. Return a handle " "suitable for reading (same as :attr:`pathlib.Path.open`)." msgstr "" -#: ../../library/importlib.rst:767 +#: ../../library/importlib.rst:746 msgid "" "When opening as text, accepts encoding parameters such as those accepted by :" "attr:`io.TextIOWrapper`." msgstr "" -#: ../../library/importlib.rst:772 +#: ../../library/importlib.rst:751 msgid "Read contents of ``self`` as bytes." msgstr "" -#: ../../library/importlib.rst:776 +#: ../../library/importlib.rst:755 msgid "Read contents of ``self`` as text." msgstr "" -#: ../../library/importlib.rst:781 +#: ../../library/importlib.rst:760 msgid "" "An abstract base class for resource readers capable of serving the :meth:" "`importlib.resources.files` interface. Subclasses :class:`importlib." @@ -1052,71 +1014,71 @@ msgid "" "also supplies ResourceReader." msgstr "" -#: ../../library/importlib.rst:788 +#: ../../library/importlib.rst:767 msgid "" "Loaders that wish to support resource reading are expected to implement this " "interface." msgstr "" -#: ../../library/importlib.rst:798 +#: ../../library/importlib.rst:777 msgid "" "Returns a :class:`importlib.resources.abc.Traversable` object for the loaded " "package." msgstr "" -#: ../../library/importlib.rst:804 +#: ../../library/importlib.rst:783 msgid ":mod:`importlib.machinery` -- Importers and path hooks" msgstr "" -#: ../../library/importlib.rst:809 +#: ../../library/importlib.rst:788 msgid "**Source code:** :source:`Lib/importlib/machinery.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/machinery.py`" -#: ../../library/importlib.rst:813 +#: ../../library/importlib.rst:792 msgid "" "This module contains the various objects that help :keyword:`import` find " "and load modules." msgstr "" -#: ../../library/importlib.rst:818 +#: ../../library/importlib.rst:797 msgid "" "A list of strings representing the recognized file suffixes for source " "modules." msgstr "" -#: ../../library/importlib.rst:825 +#: ../../library/importlib.rst:804 msgid "" "A list of strings representing the file suffixes for non-optimized bytecode " "modules." msgstr "" -#: ../../library/importlib.rst:830 ../../library/importlib.rst:840 +#: ../../library/importlib.rst:809 ../../library/importlib.rst:819 msgid "Use :attr:`BYTECODE_SUFFIXES` instead." msgstr "" -#: ../../library/importlib.rst:835 +#: ../../library/importlib.rst:814 msgid "" "A list of strings representing the file suffixes for optimized bytecode " "modules." msgstr "" -#: ../../library/importlib.rst:845 +#: ../../library/importlib.rst:824 msgid "" "A list of strings representing the recognized file suffixes for bytecode " "modules (including the leading dot)." msgstr "" -#: ../../library/importlib.rst:850 +#: ../../library/importlib.rst:829 msgid "The value is no longer dependent on ``__debug__``." msgstr "" -#: ../../library/importlib.rst:855 +#: ../../library/importlib.rst:834 msgid "" "A list of strings representing the recognized file suffixes for extension " "modules." msgstr "" -#: ../../library/importlib.rst:862 +#: ../../library/importlib.rst:841 msgid "" "Returns a combined list of strings representing all file suffixes for " "modules recognized by the standard import machinery. This is a helper for " @@ -1125,57 +1087,57 @@ msgid "" "`inspect.getmodulename`)." msgstr "" -#: ../../library/importlib.rst:873 +#: ../../library/importlib.rst:852 msgid "" "An :term:`importer` for built-in modules. All known built-in modules are " "listed in :data:`sys.builtin_module_names`. This class implements the :class:" "`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" -#: ../../library/importlib.rst:878 ../../library/importlib.rst:892 -#: ../../library/importlib.rst:905 ../../library/importlib.rst:920 +#: ../../library/importlib.rst:857 ../../library/importlib.rst:871 +#: ../../library/importlib.rst:884 ../../library/importlib.rst:899 msgid "" "Only class methods are defined by this class to alleviate the need for " "instantiation." msgstr "" -#: ../../library/importlib.rst:881 +#: ../../library/importlib.rst:860 msgid "" "As part of :pep:`489`, the builtin importer now implements :meth:`Loader." "create_module` and :meth:`Loader.exec_module`" msgstr "" -#: ../../library/importlib.rst:888 +#: ../../library/importlib.rst:867 msgid "" "An :term:`importer` for frozen modules. This class implements the :class:" "`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" -#: ../../library/importlib.rst:895 +#: ../../library/importlib.rst:874 msgid "" "Gained :meth:`~Loader.create_module` and :meth:`~Loader.exec_module` methods." msgstr "" -#: ../../library/importlib.rst:902 +#: ../../library/importlib.rst:881 msgid "" ":term:`Finder ` for modules declared in the Windows registry. This " "class implements the :class:`importlib.abc.MetaPathFinder` ABC." msgstr "" -#: ../../library/importlib.rst:910 +#: ../../library/importlib.rst:889 msgid "" "Use :mod:`site` configuration instead. Future versions of Python may not " "enable this finder by default." msgstr "" -#: ../../library/importlib.rst:917 +#: ../../library/importlib.rst:896 msgid "" "A :term:`Finder ` for :data:`sys.path` and package ``__path__`` " "attributes. This class implements the :class:`importlib.abc.MetaPathFinder` " "ABC." msgstr "" -#: ../../library/importlib.rst:925 +#: ../../library/importlib.rst:904 msgid "" "Class method that attempts to find a :term:`spec ` for the " "module specified by *fullname* on :data:`sys.path` or, if defined, on " @@ -1189,43 +1151,43 @@ msgid "" "cache and returned." msgstr "" -#: ../../library/importlib.rst:939 +#: ../../library/importlib.rst:918 msgid "" "If the current working directory -- represented by an empty string -- is no " "longer valid then ``None`` is returned but no value is cached in :data:`sys." "path_importer_cache`." msgstr "" -#: ../../library/importlib.rst:946 +#: ../../library/importlib.rst:925 msgid "" "Calls :meth:`importlib.abc.PathEntryFinder.invalidate_caches` on all finders " "stored in :data:`sys.path_importer_cache` that define the method. Otherwise " "entries in :data:`sys.path_importer_cache` set to ``None`` are deleted." msgstr "" -#: ../../library/importlib.rst:951 +#: ../../library/importlib.rst:930 msgid "Entries of ``None`` in :data:`sys.path_importer_cache` are deleted." msgstr "" -#: ../../library/importlib.rst:954 +#: ../../library/importlib.rst:933 msgid "" "Calls objects in :data:`sys.path_hooks` with the current working directory " "for ``''`` (i.e. the empty string)." msgstr "" -#: ../../library/importlib.rst:961 +#: ../../library/importlib.rst:940 msgid "" "A concrete implementation of :class:`importlib.abc.PathEntryFinder` which " "caches results from the file system." msgstr "" -#: ../../library/importlib.rst:964 +#: ../../library/importlib.rst:943 msgid "" "The *path* argument is the directory for which the finder is in charge of " "searching." msgstr "" -#: ../../library/importlib.rst:967 +#: ../../library/importlib.rst:946 msgid "" "The *loader_details* argument is a variable number of 2-item tuples each " "containing a loader and a sequence of file suffixes the loader recognizes. " @@ -1233,7 +1195,7 @@ msgid "" "module's name and the path to the file found." msgstr "" -#: ../../library/importlib.rst:972 +#: ../../library/importlib.rst:951 msgid "" "The finder will cache the directory contents as necessary, making stat calls " "for each module search to verify the cache is not outdated. Because cache " @@ -1246,166 +1208,166 @@ msgid "" "to call :func:`importlib.invalidate_caches`." msgstr "" -#: ../../library/importlib.rst:986 +#: ../../library/importlib.rst:965 msgid "The path the finder will search in." msgstr "" -#: ../../library/importlib.rst:990 +#: ../../library/importlib.rst:969 msgid "Attempt to find the spec to handle *fullname* within :attr:`path`." msgstr "" -#: ../../library/importlib.rst:996 +#: ../../library/importlib.rst:975 msgid "Clear out the internal cache." msgstr "" -#: ../../library/importlib.rst:1000 +#: ../../library/importlib.rst:979 msgid "" "A class method which returns a closure for use on :data:`sys.path_hooks`. An " "instance of :class:`FileFinder` is returned by the closure using the path " "argument given to the closure directly and *loader_details* indirectly." msgstr "" -#: ../../library/importlib.rst:1005 +#: ../../library/importlib.rst:984 msgid "" "If the argument to the closure is not an existing directory, :exc:" "`ImportError` is raised." msgstr "" -#: ../../library/importlib.rst:1011 +#: ../../library/importlib.rst:990 msgid "" "A concrete implementation of :class:`importlib.abc.SourceLoader` by " "subclassing :class:`importlib.abc.FileLoader` and providing some concrete " "implementations of other methods." msgstr "" -#: ../../library/importlib.rst:1019 +#: ../../library/importlib.rst:998 msgid "The name of the module that this loader will handle." msgstr "" -#: ../../library/importlib.rst:1023 +#: ../../library/importlib.rst:1002 msgid "The path to the source file." msgstr "" -#: ../../library/importlib.rst:1027 +#: ../../library/importlib.rst:1006 msgid "Return ``True`` if :attr:`path` appears to be for a package." msgstr "" -#: ../../library/importlib.rst:1031 +#: ../../library/importlib.rst:1010 msgid "" "Concrete implementation of :meth:`importlib.abc.SourceLoader.path_stats`." msgstr "" -#: ../../library/importlib.rst:1035 +#: ../../library/importlib.rst:1014 msgid "Concrete implementation of :meth:`importlib.abc.SourceLoader.set_data`." msgstr "" -#: ../../library/importlib.rst:1039 ../../library/importlib.rst:1082 +#: ../../library/importlib.rst:1018 ../../library/importlib.rst:1061 msgid "" "Concrete implementation of :meth:`importlib.abc.Loader.load_module` where " "specifying the name of the module to load is optional." msgstr "" -#: ../../library/importlib.rst:1044 ../../library/importlib.rst:1087 +#: ../../library/importlib.rst:1023 ../../library/importlib.rst:1066 msgid "Use :meth:`importlib.abc.Loader.exec_module` instead." msgstr "" -#: ../../library/importlib.rst:1049 +#: ../../library/importlib.rst:1028 msgid "" "A concrete implementation of :class:`importlib.abc.FileLoader` which can " "import bytecode files (i.e. no source code files exist)." msgstr "" -#: ../../library/importlib.rst:1052 +#: ../../library/importlib.rst:1031 msgid "" "Please note that direct use of bytecode files (and thus not source code " "files) inhibits your modules from being usable by all Python implementations " "or new versions of Python which change the bytecode format." msgstr "" -#: ../../library/importlib.rst:1061 +#: ../../library/importlib.rst:1040 msgid "The name of the module the loader will handle." msgstr "" -#: ../../library/importlib.rst:1065 +#: ../../library/importlib.rst:1044 msgid "The path to the bytecode file." msgstr "" -#: ../../library/importlib.rst:1069 +#: ../../library/importlib.rst:1048 msgid "Determines if the module is a package based on :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1073 +#: ../../library/importlib.rst:1052 msgid "Returns the code object for :attr:`name` created from :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1077 +#: ../../library/importlib.rst:1056 msgid "" "Returns ``None`` as bytecode files have no source when this loader is used." msgstr "" -#: ../../library/importlib.rst:1092 +#: ../../library/importlib.rst:1071 msgid "" "A concrete implementation of :class:`importlib.abc.ExecutionLoader` for " "extension modules." msgstr "" -#: ../../library/importlib.rst:1095 +#: ../../library/importlib.rst:1074 msgid "" "The *fullname* argument specifies the name of the module the loader is to " "support. The *path* argument is the path to the extension module's file." msgstr "" -#: ../../library/importlib.rst:1098 +#: ../../library/importlib.rst:1077 msgid "" "Note that, by default, importing an extension module will fail in " "subinterpreters if it doesn't implement multi-phase init (see :pep:`489`), " "even if it would otherwise import successfully." msgstr "" -#: ../../library/importlib.rst:1104 +#: ../../library/importlib.rst:1083 msgid "Multi-phase init is now required for use in subinterpreters." msgstr "" -#: ../../library/importlib.rst:1109 ../../library/importlib.rst:1293 +#: ../../library/importlib.rst:1088 ../../library/importlib.rst:1274 msgid "Name of the module the loader supports." msgstr "" -#: ../../library/importlib.rst:1113 +#: ../../library/importlib.rst:1092 msgid "Path to the extension module." msgstr "" -#: ../../library/importlib.rst:1117 +#: ../../library/importlib.rst:1096 msgid "" "Creates the module object from the given specification in accordance with :" "pep:`489`." msgstr "" -#: ../../library/importlib.rst:1124 +#: ../../library/importlib.rst:1103 msgid "Initializes the given module object in accordance with :pep:`489`." msgstr "" -#: ../../library/importlib.rst:1130 +#: ../../library/importlib.rst:1109 msgid "" "Returns ``True`` if the file path points to a package's ``__init__`` module " "based on :attr:`EXTENSION_SUFFIXES`." msgstr "" -#: ../../library/importlib.rst:1135 +#: ../../library/importlib.rst:1114 msgid "Returns ``None`` as extension modules lack a code object." msgstr "" -#: ../../library/importlib.rst:1139 +#: ../../library/importlib.rst:1118 msgid "Returns ``None`` as extension modules do not have source code." msgstr "" -#: ../../library/importlib.rst:1150 +#: ../../library/importlib.rst:1129 msgid "" "A concrete implementation of :class:`importlib.abc.InspectLoader` for " "namespace packages. This is an alias for a private class and is only made " "public for introspecting the ``__loader__`` attribute on namespace packages::" msgstr "" -#: ../../library/importlib.rst:1155 +#: ../../library/importlib.rst:1134 msgid "" ">>> from importlib.machinery import NamespaceLoader\n" ">>> import my_namespace\n" @@ -1423,88 +1385,90 @@ msgstr "" ">>> isinstance(my_namespace.__loader__, importlib.abc.Loader)\n" "True" -#: ../../library/importlib.rst:1168 +#: ../../library/importlib.rst:1147 msgid "" "A specification for a module's import-system-related state. This is " -"typically exposed as the module's :attr:`__spec__` attribute. Many of these " -"attributes are also available directly on a module: for example, ``module." -"__spec__.origin == module.__file__``. Note, however, that while the " -"*values* are usually equivalent, they can differ since there is no " +"typically exposed as the module's :attr:`~module.__spec__` attribute. Many " +"of these attributes are also available directly on a module: for example, " +"``module.__spec__.origin == module.__file__``. Note, however, that while " +"the *values* are usually equivalent, they can differ since there is no " "synchronization between the two objects. For example, it is possible to " -"update the module's :attr:`__file__` at runtime and this will not be " -"automatically reflected in the module's :attr:`__spec__.origin`, and vice " -"versa." +"update the module's :attr:`~module.__file__` at runtime and this will not be " +"automatically reflected in the module's :attr:`__spec__.origin `, and vice versa." msgstr "" -#: ../../library/importlib.rst:1181 +#: ../../library/importlib.rst:1161 msgid "" -"The module's fully qualified name (see :attr:`__name__` attributes on " -"modules). The :term:`finder` should always set this attribute to a non-empty " -"string." +"The module's fully qualified name (see :attr:`module.__name__`). The :term:" +"`finder` should always set this attribute to a non-empty string." msgstr "" -#: ../../library/importlib.rst:1187 +#: ../../library/importlib.rst:1166 msgid "" -"The :term:`loader` used to load the module (see :attr:`__loader__` " -"attributes on modules). The :term:`finder` should always set this attribute." +"The :term:`loader` used to load the module (see :attr:`module.__loader__`). " +"The :term:`finder` should always set this attribute." msgstr "" -#: ../../library/importlib.rst:1193 +#: ../../library/importlib.rst:1171 msgid "" "The location the :term:`loader` should use to load the module (see :attr:" -"`__file__` attributes on modules). For example, for modules loaded from a ." -"py file this is the filename. The :term:`finder` should always set this " -"attribute to a meaningful value for the :term:`loader` to use. In the " -"uncommon case that there is not one (like for namespace packages), it should " -"be set to ``None``." +"`module.__file__`). For example, for modules loaded from a ``.py`` file this " +"is the filename. The :term:`finder` should always set this attribute to a " +"meaningful value for the :term:`loader` to use. In the uncommon case that " +"there is not one (like for namespace packages), it should be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1202 +#: ../../library/importlib.rst:1180 msgid "" -"The list of locations where the package's submodules will be found (see :" -"attr:`__path__` attributes on modules). Most of the time this is a single " -"directory. The :term:`finder` should set this attribute to a list, even an " -"empty one, to indicate to the import system that the module is a package. " -"It should be set to ``None`` for non-package modules. It is set " -"automatically later to a special object for namespace packages." +"A (possibly empty) :term:`sequence` of strings enumerating the locations in " +"which a package's submodules will be found (see :attr:`module.__path__`). " +"Most of the time there will only be a single directory in this list." msgstr "" -#: ../../library/importlib.rst:1212 +#: ../../library/importlib.rst:1185 +msgid "" +"The :term:`finder` should set this attribute to a sequence, even an empty " +"one, to indicate to the import system that the module is a package. It " +"should be set to ``None`` for non-package modules. It is set automatically " +"later to a special object for namespace packages." +msgstr "" + +#: ../../library/importlib.rst:1193 msgid "" "The :term:`finder` may set this attribute to an object containing " "additional, module-specific data to use when loading the module. Otherwise " "it should be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1218 +#: ../../library/importlib.rst:1199 msgid "" -"The filename of a compiled version of the module's code (see :attr:" -"`__cached__` attributes on modules). The :term:`finder` should always set " -"this attribute but it may be ``None`` for modules that do not need compiled " -"code stored." +"The filename of a compiled version of the module's code (see :attr:`module." +"__cached__`). The :term:`finder` should always set this attribute but it may " +"be ``None`` for modules that do not need compiled code stored." msgstr "" -#: ../../library/importlib.rst:1225 +#: ../../library/importlib.rst:1206 msgid "" "(Read-only) The fully qualified name of the package the module is in (or the " -"empty string for a top-level module). See :attr:`__package__` attributes on " -"modules. If the module is a package then this is the same as :attr:`name`." +"empty string for a top-level module). See :attr:`module.__package__`. If the " +"module is a package then this is the same as :attr:`name`." msgstr "" -#: ../../library/importlib.rst:1232 +#: ../../library/importlib.rst:1213 msgid "" "``True`` if the spec's :attr:`origin` refers to a loadable location, " -"``False`` otherwise. This value impacts how :attr:`origin` is interpreted " -"and how the module's :attr:`__file__` is populated." +"``False`` otherwise. This value impacts how :attr:`!origin` is interpreted " +"and how the module's :attr:`~module.__file__` is populated." msgstr "" -#: ../../library/importlib.rst:1239 +#: ../../library/importlib.rst:1220 msgid "" "A specialization of :class:`importlib.machinery.ExtensionFileLoader` that is " "able to load extension modules in Framework format." msgstr "" -#: ../../library/importlib.rst:1242 +#: ../../library/importlib.rst:1223 msgid "" "For compatibility with the iOS App Store, *all* binary modules in an iOS app " "must be dynamic libraries, contained in a framework with appropriate " @@ -1513,7 +1477,7 @@ msgid "" "material outside the Frameworks folder." msgstr "" -#: ../../library/importlib.rst:1248 +#: ../../library/importlib.rst:1229 msgid "" "To accommodate this requirement, when running on iOS, extension module " "binaries are *not* packaged as ``.so`` files on ``sys.path``, but as " @@ -1527,7 +1491,7 @@ msgid "" "fwork`` file, relative to the app bundle." msgstr "" -#: ../../library/importlib.rst:1259 +#: ../../library/importlib.rst:1240 msgid "" "For example, consider the case of an import ``from foo.bar import _whiz``, " "where ``_whiz`` is implemented with the binary module ``sources/foo/bar/" @@ -1543,7 +1507,7 @@ msgid "" "_whiz.origin``, containing the path to the ``.fwork`` file." msgstr "" -#: ../../library/importlib.rst:1273 +#: ../../library/importlib.rst:1254 msgid "" "When a module is loaded with this loader, the ``__file__`` for the module " "will report as the location of the ``.fwork`` file. This allows code to use " @@ -1552,7 +1516,7 @@ msgid "" "in the ``.framework`` folder." msgstr "" -#: ../../library/importlib.rst:1279 +#: ../../library/importlib.rst:1260 msgid "" "The Xcode project building the app is responsible for converting any ``.so`` " "files from wherever they exist in the ``PYTHONPATH`` into frameworks in the " @@ -1563,35 +1527,35 @@ msgid "" "details on how to construct this build step." msgstr "" -#: ../../library/importlib.rst:1289 -msgid ":ref:`Availability `: iOS." +#: ../../library/importlib.rst:1270 +msgid "Availability" msgstr "" -#: ../../library/importlib.rst:1297 +#: ../../library/importlib.rst:1278 msgid "Path to the ``.fwork`` file for the extension module." msgstr "" -#: ../../library/importlib.rst:1301 +#: ../../library/importlib.rst:1282 msgid ":mod:`importlib.util` -- Utility code for importers" msgstr "" -#: ../../library/importlib.rst:1307 +#: ../../library/importlib.rst:1288 msgid "**Source code:** :source:`Lib/importlib/util.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/util.py`" -#: ../../library/importlib.rst:1311 +#: ../../library/importlib.rst:1292 msgid "" "This module contains the various objects that help in the construction of " "an :term:`importer`." msgstr "" -#: ../../library/importlib.rst:1316 +#: ../../library/importlib.rst:1297 msgid "" "The bytes which represent the bytecode version number. If you need help with " "loading/writing bytecode then consider :class:`importlib.abc.SourceLoader`." msgstr "" -#: ../../library/importlib.rst:1323 +#: ../../library/importlib.rst:1304 msgid "" "Return the :pep:`3147`/:pep:`488` path to the byte-compiled file associated " "with the source *path*. For example, if *path* is ``/foo/bar/baz.py`` the " @@ -1601,7 +1565,7 @@ msgid "" "`NotImplementedError` will be raised)." msgstr "" -#: ../../library/importlib.rst:1330 +#: ../../library/importlib.rst:1311 msgid "" "The *optimization* parameter is used to specify the optimization level of " "the bytecode file. An empty string represents no optimization, so ``/foo/bar/" @@ -1614,7 +1578,7 @@ msgid "" "be alphanumeric, else :exc:`ValueError` is raised." msgstr "" -#: ../../library/importlib.rst:1340 +#: ../../library/importlib.rst:1321 msgid "" "The *debug_override* parameter is deprecated and can be used to override the " "system's value for ``__debug__``. A ``True`` value is the equivalent of " @@ -1623,18 +1587,18 @@ msgid "" "are not ``None`` then :exc:`TypeError` is raised." msgstr "" -#: ../../library/importlib.rst:1348 +#: ../../library/importlib.rst:1329 msgid "" "The *optimization* parameter was added and the *debug_override* parameter " "was deprecated." msgstr "" -#: ../../library/importlib.rst:1352 ../../library/importlib.rst:1368 -#: ../../library/importlib.rst:1457 +#: ../../library/importlib.rst:1333 ../../library/importlib.rst:1349 +#: ../../library/importlib.rst:1438 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/importlib.rst:1358 +#: ../../library/importlib.rst:1339 msgid "" "Given the *path* to a :pep:`3147` file name, return the associated source " "code file path. For example, if *path* is ``/foo/bar/__pycache__/baz." @@ -1644,25 +1608,25 @@ msgid "" "cache_tag` is not defined, :exc:`NotImplementedError` is raised." msgstr "" -#: ../../library/importlib.rst:1373 +#: ../../library/importlib.rst:1354 msgid "" "Decode the given bytes representing source code and return it as a string " "with universal newlines (as required by :meth:`importlib.abc.InspectLoader." "get_source`)." msgstr "" -#: ../../library/importlib.rst:1381 +#: ../../library/importlib.rst:1362 msgid "Resolve a relative module name to an absolute one." msgstr "" -#: ../../library/importlib.rst:1383 +#: ../../library/importlib.rst:1364 msgid "" "If **name** has no leading dots, then **name** is simply returned. This " "allows for usage such as ``importlib.util.resolve_name('sys', __spec__." "parent)`` without doing a check to see if the **package** argument is needed." msgstr "" -#: ../../library/importlib.rst:1388 +#: ../../library/importlib.rst:1369 msgid "" ":exc:`ImportError` is raised if **name** is a relative module name but " "**package** is a false value (e.g. ``None`` or the empty string). :exc:" @@ -1670,13 +1634,13 @@ msgid "" "package (e.g. requesting ``..bacon`` from within the ``spam`` package)." msgstr "" -#: ../../library/importlib.rst:1396 +#: ../../library/importlib.rst:1377 msgid "" "To improve consistency with import statements, raise :exc:`ImportError` " "instead of :exc:`ValueError` for invalid relative import attempts." msgstr "" -#: ../../library/importlib.rst:1403 +#: ../../library/importlib.rst:1384 msgid "" "Find the :term:`spec ` for a module, optionally relative to the " "specified **package** name. If the module is in :data:`sys.modules`, then " @@ -1686,30 +1650,30 @@ msgid "" "if no spec is found." msgstr "" -#: ../../library/importlib.rst:1410 +#: ../../library/importlib.rst:1391 msgid "" "If **name** is for a submodule (contains a dot), the parent module is " "automatically imported." msgstr "" -#: ../../library/importlib.rst:1413 +#: ../../library/importlib.rst:1394 msgid "**name** and **package** work the same as for :func:`import_module`." msgstr "" -#: ../../library/importlib.rst:1417 +#: ../../library/importlib.rst:1398 msgid "" "Raises :exc:`ModuleNotFoundError` instead of :exc:`AttributeError` if " -"**package** is in fact not a package (i.e. lacks a :attr:`__path__` " +"**package** is in fact not a package (i.e. lacks a :attr:`~module.__path__` " "attribute)." msgstr "" -#: ../../library/importlib.rst:1424 +#: ../../library/importlib.rst:1405 msgid "" "Create a new module based on **spec** and :meth:`spec.loader.create_module " "`." msgstr "" -#: ../../library/importlib.rst:1427 +#: ../../library/importlib.rst:1408 msgid "" "If :meth:`spec.loader.create_module ` " "does not return ``None``, then any pre-existing attributes will not be " @@ -1717,14 +1681,14 @@ msgid "" "accessing **spec** or setting an attribute on the module." msgstr "" -#: ../../library/importlib.rst:1432 +#: ../../library/importlib.rst:1413 msgid "" "This function is preferred over using :class:`types.ModuleType` to create a " "new module as **spec** is used to set as many import-controlled attributes " "on the module as possible." msgstr "" -#: ../../library/importlib.rst:1440 +#: ../../library/importlib.rst:1421 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on a loader. The parameters have the same meaning as they do " @@ -1733,7 +1697,7 @@ msgid "" "spec." msgstr "" -#: ../../library/importlib.rst:1450 +#: ../../library/importlib.rst:1431 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on the path to a file. Missing information will be filled in " @@ -1741,14 +1705,14 @@ msgid "" "module will be file-based." msgstr "" -#: ../../library/importlib.rst:1462 +#: ../../library/importlib.rst:1443 msgid "" "Return the hash of *source_bytes* as bytes. A hash-based ``.pyc`` file " "embeds the :func:`source_hash` of the corresponding source file's contents " "in its header." msgstr "" -#: ../../library/importlib.rst:1470 +#: ../../library/importlib.rst:1451 msgid "" "A context manager that can temporarily skip the compatibility check for " "extension modules. By default the check is enabled and will fail when a " @@ -1757,33 +1721,33 @@ msgid "" "interpreter GIL, when imported in an interpreter with its own GIL." msgstr "" -#: ../../library/importlib.rst:1477 +#: ../../library/importlib.rst:1458 msgid "" "Note that this function is meant to accommodate an unusual case; one which " "is likely to eventually go away. There's is a pretty good chance this is " "not what you were looking for." msgstr "" -#: ../../library/importlib.rst:1481 +#: ../../library/importlib.rst:1462 msgid "" "You can get the same effect as this function by implementing the basic " "interface of multi-phase init (:pep:`489`) and lying about support for " "multiple interpreters (or per-interpreter GIL)." msgstr "" -#: ../../library/importlib.rst:1486 +#: ../../library/importlib.rst:1467 msgid "" "Using this function to disable the check can lead to unexpected behavior and " "even crashes. It should only be used during extension module development." msgstr "" -#: ../../library/importlib.rst:1494 +#: ../../library/importlib.rst:1475 msgid "" "A class which postpones the execution of the loader of a module until the " "module has an attribute accessed." msgstr "" -#: ../../library/importlib.rst:1497 +#: ../../library/importlib.rst:1478 msgid "" "This class **only** works with loaders that define :meth:`~importlib.abc." "Loader.exec_module` as control over what module type is used for the module " @@ -1796,7 +1760,7 @@ msgid "" "raised if such a substitution is detected." msgstr "" -#: ../../library/importlib.rst:1508 +#: ../../library/importlib.rst:1489 msgid "" "For projects where startup time is critical, this class allows for " "potentially minimizing the cost of loading a module if it is never used. For " @@ -1805,21 +1769,21 @@ msgid "" "postponed and thus occurring out of context." msgstr "" -#: ../../library/importlib.rst:1516 +#: ../../library/importlib.rst:1497 msgid "" "Began calling :meth:`~importlib.abc.Loader.create_module`, removing the " "compatibility warning for :class:`importlib.machinery.BuiltinImporter` and :" "class:`importlib.machinery.ExtensionFileLoader`." msgstr "" -#: ../../library/importlib.rst:1523 +#: ../../library/importlib.rst:1504 msgid "" "A class method which returns a callable that creates a lazy loader. This is " "meant to be used in situations where the loader is passed by class instead " "of by instance. ::" msgstr "" -#: ../../library/importlib.rst:1528 +#: ../../library/importlib.rst:1509 msgid "" "suffixes = importlib.machinery.SOURCE_SUFFIXES\n" "loader = importlib.machinery.SourceFileLoader\n" @@ -1831,20 +1795,20 @@ msgstr "" "lazy_loader = importlib.util.LazyLoader.factory(loader)\n" "finder = importlib.machinery.FileFinder(path, (lazy_loader, suffixes))" -#: ../../library/importlib.rst:1536 +#: ../../library/importlib.rst:1517 msgid "Examples" msgstr "範例" -#: ../../library/importlib.rst:1539 +#: ../../library/importlib.rst:1520 msgid "Importing programmatically" msgstr "" -#: ../../library/importlib.rst:1541 +#: ../../library/importlib.rst:1522 msgid "" "To programmatically import a module, use :func:`importlib.import_module`. ::" msgstr "" -#: ../../library/importlib.rst:1544 +#: ../../library/importlib.rst:1525 msgid "" "import importlib\n" "\n" @@ -1854,23 +1818,23 @@ msgstr "" "\n" "itertools = importlib.import_module('itertools')" -#: ../../library/importlib.rst:1550 +#: ../../library/importlib.rst:1531 msgid "Checking if a module can be imported" msgstr "" -#: ../../library/importlib.rst:1552 +#: ../../library/importlib.rst:1533 msgid "" "If you need to find out if a module can be imported without actually doing " "the import, then you should use :func:`importlib.util.find_spec`." msgstr "" -#: ../../library/importlib.rst:1555 +#: ../../library/importlib.rst:1536 msgid "" "Note that if ``name`` is a submodule (contains a dot), :func:`importlib.util." "find_spec` will import the parent module. ::" msgstr "" -#: ../../library/importlib.rst:1559 +#: ../../library/importlib.rst:1540 msgid "" "import importlib.util\n" "import sys\n" @@ -1890,11 +1854,11 @@ msgid "" " print(f\"can't find the {name!r} module\")" msgstr "" -#: ../../library/importlib.rst:1578 +#: ../../library/importlib.rst:1559 msgid "Importing a source file directly" msgstr "" -#: ../../library/importlib.rst:1580 +#: ../../library/importlib.rst:1561 msgid "" "This recipe should be used with caution: it is an approximation of an import " "statement where the file path is specified directly, rather than :data:`sys." @@ -1904,13 +1868,13 @@ msgid "" "file is appropriate." msgstr "" -#: ../../library/importlib.rst:1587 +#: ../../library/importlib.rst:1568 msgid "" "To import a Python source file directly from a path, use the following " "recipe::" msgstr "" -#: ../../library/importlib.rst:1589 +#: ../../library/importlib.rst:1570 msgid "" "import importlib.util\n" "import sys\n" @@ -1933,15 +1897,15 @@ msgid "" "json = import_from_path(module_name, file_path)" msgstr "" -#: ../../library/importlib.rst:1611 +#: ../../library/importlib.rst:1592 msgid "Implementing lazy imports" msgstr "" -#: ../../library/importlib.rst:1613 +#: ../../library/importlib.rst:1594 msgid "The example below shows how to implement lazy imports::" msgstr "" -#: ../../library/importlib.rst:1615 +#: ../../library/importlib.rst:1596 msgid "" ">>> import importlib.util\n" ">>> import sys\n" @@ -1961,11 +1925,11 @@ msgid "" "False" msgstr "" -#: ../../library/importlib.rst:1634 +#: ../../library/importlib.rst:1615 msgid "Setting up an importer" msgstr "" -#: ../../library/importlib.rst:1636 +#: ../../library/importlib.rst:1617 msgid "" "For deep customizations of import, you typically want to implement an :term:" "`importer`. This means managing both the :term:`finder` and :term:`loader` " @@ -1979,7 +1943,7 @@ msgid "" "for the appropriate classes defined within this package)::" msgstr "" -#: ../../library/importlib.rst:1647 +#: ../../library/importlib.rst:1628 msgid "" "import importlib.machinery\n" "import sys\n" @@ -2003,11 +1967,11 @@ msgid "" "sys.path_hooks.append(SpamPathEntryFinder.path_hook(loader_details))" msgstr "" -#: ../../library/importlib.rst:1668 +#: ../../library/importlib.rst:1649 msgid "Approximating :func:`importlib.import_module`" msgstr "" -#: ../../library/importlib.rst:1670 +#: ../../library/importlib.rst:1651 msgid "" "Import itself is implemented in Python code, making it possible to expose " "most of the import machinery through importlib. The following helps " @@ -2015,7 +1979,7 @@ msgid "" "approximate implementation of :func:`importlib.import_module`::" msgstr "" -#: ../../library/importlib.rst:1676 +#: ../../library/importlib.rst:1657 msgid "" "import importlib.util\n" "import sys\n" @@ -2048,28 +2012,28 @@ msgid "" " return module" msgstr "" -#: ../../library/importlib.rst:443 +#: ../../library/importlib.rst:422 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/importlib.rst:443 +#: ../../library/importlib.rst:422 msgid "importlib.abc.InspectLoader.get_source method" msgstr "importlib.abc.InspectLoader.get_source 方法" +#~ msgid ":attr:`__cached__`" +#~ msgstr ":attr:`__cached__`" + +#~ msgid ":attr:`__package__`" +#~ msgstr ":attr:`__package__`" + +#~ msgid ":attr:`__loader__`" +#~ msgstr ":attr:`__loader__`" + #~ msgid "(:attr:`__name__`)" #~ msgstr "(:attr:`__name__`)" -#~ msgid "(:attr:`__loader__`)" -#~ msgstr "(:attr:`__loader__`)" - #~ msgid "(:attr:`__file__`)" #~ msgstr "(:attr:`__file__`)" #~ msgid "(:attr:`__path__`)" #~ msgstr "(:attr:`__path__`)" - -#~ msgid "(:attr:`__cached__`)" -#~ msgstr "(:attr:`__cached__`)" - -#~ msgid "(:attr:`__package__`)" -#~ msgstr "(:attr:`__package__`)" diff --git a/library/itertools.po b/library/itertools.po index cd3e78c8ca..b02809e1e2 100644 --- a/library/itertools.po +++ b/library/itertools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-09 00:13+0000\n" "PO-Revision-Date: 2024-08-16 15:01+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -259,6 +259,10 @@ msgstr "iterable[, key]" msgid "sub-iterators grouped by value of key(v)" msgstr "根據 key(v) 的值分組的子疊代器" +#: ../../library/itertools.rst:61 +msgid "``groupby(['A','B','DEF'], len) → (1, A B) (3, DEF)``" +msgstr "``groupby(['A','B','DEF'], len) → (1, A B) (3, DEF)``" + #: ../../library/itertools.rst:62 msgid ":func:`islice`" msgstr ":func:`islice`" @@ -429,12 +433,12 @@ msgstr "Itertool 函式" #: ../../library/itertools.rst:96 msgid "" -"The following module functions all construct and return iterators. Some " -"provide streams of infinite length, so they should only be accessed by " -"functions or loops that truncate the stream." +"The following functions all construct and return iterators. Some provide " +"streams of infinite length, so they should only be accessed by functions or " +"loops that truncate the stream." msgstr "" -"以下的模組函式都會建構並回傳疊代器。一些函式提供無限長度的串流 (stream),因此" -"應僅由截斷串流的函式或迴圈來存取它們。" +"以下的函式都會建構並回傳疊代器。一些函式提供無限長度的串流 (stream),因此應僅" +"由截斷串流的函式或迴圈來存取它們。" #: ../../library/itertools.rst:103 msgid "" @@ -458,11 +462,11 @@ msgstr "" "如果提供了 *initial* 值,則累積將從該值開始,並且輸出的元素數將比輸入的可疊代" "物件多一個。" -#: ../../library/itertools.rst:113 ../../library/itertools.rst:185 -#: ../../library/itertools.rst:244 ../../library/itertools.rst:287 -#: ../../library/itertools.rst:484 ../../library/itertools.rst:515 -#: ../../library/itertools.rst:550 ../../library/itertools.rst:623 -#: ../../library/itertools.rst:684 ../../library/itertools.rst:726 +#: ../../library/itertools.rst:113 ../../library/itertools.rst:186 +#: ../../library/itertools.rst:245 ../../library/itertools.rst:288 +#: ../../library/itertools.rst:489 ../../library/itertools.rst:524 +#: ../../library/itertools.rst:561 ../../library/itertools.rst:637 +#: ../../library/itertools.rst:698 ../../library/itertools.rst:779 msgid "Roughly equivalent to::" msgstr "大致等價於: ::" @@ -490,18 +494,18 @@ msgstr "" #: ../../library/itertools.rst:134 msgid "" -"The *function* argument can be set to :func:`min` for a running minimum, :" -"func:`max` for a running maximum, or :func:`operator.mul` for a running " -"product. `Amortization tables `_ can be built by accumulating interest and applying " -"payments:" +"To compute a running minimum, set *function* to :func:`min`. For a running " +"maximum, set *function* to :func:`max`. Or for a running product, set " +"*function* to :func:`operator.mul`. To build an `amortization table `_, accumulate the " +"interest and apply payments:" msgstr "" "*function* 引數可以被設定為 :func:`min` 以得到連續的最小值,設定為 :func:" "`max` 以得到連續的最大值,或者設定為 :func:`operator.mul` 以得到連續的乘積。" "也可以透過累積利息和付款來建立\\ `攤銷表 (Amortization tables) `_ :" -#: ../../library/itertools.rst:140 +#: ../../library/itertools.rst:141 msgid "" ">>> data = [3, 4, 6, 2, 1, 9, 0, 7, 5, 8]\n" ">>> list(accumulate(data, max)) # running maximum\n" @@ -515,35 +519,35 @@ msgid "" "[1000, 960, 918, 874, 828, 779, 728, 674, 618, 559, 497]" msgstr "" -#: ../../library/itertools.rst:153 +#: ../../library/itertools.rst:154 msgid "" "See :func:`functools.reduce` for a similar function that returns only the " "final accumulated value." msgstr "" "可參見 :func:`functools.reduce`,其是個類似的函式,但僅回傳最終的累積值。" -#: ../../library/itertools.rst:158 +#: ../../library/itertools.rst:159 msgid "Added the optional *function* parameter." msgstr "新增可選的 *function* 參數。" -#: ../../library/itertools.rst:161 +#: ../../library/itertools.rst:162 msgid "Added the optional *initial* parameter." msgstr "新增可選的 *initial* 參數。" -#: ../../library/itertools.rst:167 +#: ../../library/itertools.rst:168 msgid "" "Batch data from the *iterable* into tuples of length *n*. The last batch may " "be shorter than *n*." msgstr "" "將來自 *iterable* 的資料分批為長度為 *n* 的元組。最後一個批次可能比 *n* 短。" -#: ../../library/itertools.rst:170 +#: ../../library/itertools.rst:171 msgid "" "If *strict* is true, will raise a :exc:`ValueError` if the final batch is " "shorter than *n*." msgstr "" -#: ../../library/itertools.rst:173 +#: ../../library/itertools.rst:174 msgid "" "Loops over the input iterable and accumulates data into tuples up to size " "*n*. The input is consumed lazily, just enough to fill a batch. The result " @@ -554,7 +558,7 @@ msgstr "" "消耗 (consumed lazily) 的,會剛好足夠填充一批的資料。一旦批次填滿或輸入的可疊" "代物件耗盡,就會 yield 出結果:" -#: ../../library/itertools.rst:178 +#: ../../library/itertools.rst:179 msgid "" ">>> flattened_data = ['roses', 'red', 'violets', 'blue', 'sugar', 'sweet']\n" ">>> unflattened = list(batched(flattened_data, 2))\n" @@ -566,8 +570,7 @@ msgstr "" ">>> unflattened\n" "[('roses', 'red'), ('violets', 'blue'), ('sugar', 'sweet')]" -#: ../../library/itertools.rst:187 -#, fuzzy +#: ../../library/itertools.rst:188 msgid "" "def batched(iterable, n, *, strict=False):\n" " # batched('ABCDEFG', 3) → ABC DEF G\n" @@ -579,30 +582,32 @@ msgid "" " raise ValueError('batched(): incomplete batch')\n" " yield batch" msgstr "" -"def batched(iterable, n):\n" +"def batched(iterable, n, *, strict=False):\n" " # batched('ABCDEFG', 3) → ABC DEF G\n" " if n < 1:\n" " raise ValueError('n must be at least one')\n" " iterator = iter(iterable)\n" " while batch := tuple(islice(iterator, n)):\n" +" if strict and len(batch) != n:\n" +" raise ValueError('batched(): incomplete batch')\n" " yield batch" -#: ../../library/itertools.rst:199 +#: ../../library/itertools.rst:200 msgid "Added the *strict* option." -msgstr "" +msgstr "新增 *strict* 選項。" -#: ../../library/itertools.rst:205 +#: ../../library/itertools.rst:206 msgid "" "Make an iterator that returns elements from the first iterable until it is " "exhausted, then proceeds to the next iterable, until all of the iterables " -"are exhausted. Used for treating consecutive sequences as a single " -"sequence. Roughly equivalent to::" +"are exhausted. This combines multiple data sources into a single iterator. " +"Roughly equivalent to::" msgstr "" "建立一個疊代器,從第一個可疊代物件回傳元素直到其耗盡,然後繼續處理下一個可疊" -"代物件,直到所有可疊代物件都耗盡。用於將連續的序列做為單一序列處理。大致等價" -"於: ::" +"代物件,直到所有可疊代物件都耗盡。這將多個資料來源結合為單一個疊代器。大致等" +"價於: ::" -#: ../../library/itertools.rst:210 +#: ../../library/itertools.rst:211 msgid "" "def chain(*iterables):\n" " # chain('ABC', 'DEF') → A B C D E F\n" @@ -610,7 +615,7 @@ msgid "" " yield from iterable" msgstr "" -#: ../../library/itertools.rst:218 +#: ../../library/itertools.rst:219 msgid "" "Alternate constructor for :func:`chain`. Gets chained inputs from a single " "iterable argument that is evaluated lazily. Roughly equivalent to::" @@ -618,7 +623,7 @@ msgstr "" ":func:`chain` 的另一個建構函式。從單個可疊代的引數中得到鏈接的輸入,該引數是" "惰性計算的。大致等價於:" -#: ../../library/itertools.rst:221 +#: ../../library/itertools.rst:222 msgid "" "def from_iterable(iterables):\n" " # chain.from_iterable(['ABC', 'DEF']) → A B C D E F\n" @@ -630,11 +635,11 @@ msgstr "" " for iterable in iterables:\n" " yield from iterable" -#: ../../library/itertools.rst:229 +#: ../../library/itertools.rst:230 msgid "Return *r* length subsequences of elements from the input *iterable*." msgstr "從輸入 *iterable* 中回傳長度為 *r* 的元素的子序列。" -#: ../../library/itertools.rst:231 +#: ../../library/itertools.rst:232 msgid "" "The output is a subsequence of :func:`product` keeping only entries that are " "subsequences of the *iterable*. The length of the output is given by :func:" @@ -645,7 +650,7 @@ msgstr "" "度由 :func:`math.comb` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / r! / (n - r)!" "``,當 ``r > n`` 時為零。" -#: ../../library/itertools.rst:236 +#: ../../library/itertools.rst:237 msgid "" "The combination tuples are emitted in lexicographic order according to the " "order of the input *iterable*. If the input *iterable* is sorted, the output " @@ -654,7 +659,7 @@ msgstr "" "根據輸入值 *iterable* 的順序,組合的元組會按照字典順序輸出。如果輸入的 " "*iterable* 已經排序,則輸出的元組也將按排序的順序產生。" -#: ../../library/itertools.rst:240 +#: ../../library/itertools.rst:241 msgid "" "Elements are treated as unique based on their position, not on their value. " "If the input elements are unique, there will be no repeated values within " @@ -663,7 +668,7 @@ msgstr "" "元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,則每" "個組合內將不會有重複的值。" -#: ../../library/itertools.rst:246 +#: ../../library/itertools.rst:247 msgid "" "def combinations(iterable, r):\n" " # combinations('ABCD', 2) → AB AC AD BC BD CD\n" @@ -688,14 +693,14 @@ msgid "" " yield tuple(pool[i] for i in indices)" msgstr "" -#: ../../library/itertools.rst:271 +#: ../../library/itertools.rst:272 msgid "" "Return *r* length subsequences of elements from the input *iterable* " "allowing individual elements to be repeated more than once." msgstr "" "回傳來自輸入 *iterable* 的長度為 *r* 的子序列,且允許個別元素重複多次。" -#: ../../library/itertools.rst:274 +#: ../../library/itertools.rst:275 msgid "" "The output is a subsequence of :func:`product` that keeps only entries that " "are subsequences (with possible repeated elements) of the *iterable*. The " @@ -706,7 +711,7 @@ msgstr "" "複元素)的條目。當 ``n > 0`` 時,回傳的子序列數量為 ``(n + r - 1)! / r! / (n " "- 1)!``。" -#: ../../library/itertools.rst:279 +#: ../../library/itertools.rst:280 msgid "" "The combination tuples are emitted in lexicographic order according to the " "order of the input *iterable*. if the input *iterable* is sorted, the output " @@ -715,7 +720,7 @@ msgstr "" "根據輸入值 *iterable* 的順序,組合的元組會按照字典順序輸出。如果輸入的 " "*iterable* 已經排序,則輸出的元組也將按排序的順序產生。" -#: ../../library/itertools.rst:283 +#: ../../library/itertools.rst:284 msgid "" "Elements are treated as unique based on their position, not on their value. " "If the input elements are unique, the generated combinations will also be " @@ -724,7 +729,7 @@ msgstr "" "元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,生成" "的組合也將是獨特的。" -#: ../../library/itertools.rst:289 +#: ../../library/itertools.rst:290 msgid "" "def combinations_with_replacement(iterable, r):\n" " # combinations_with_replacement('ABC', 2) → AA AB AC BB BC CC\n" @@ -746,7 +751,7 @@ msgid "" " yield tuple(pool[i] for i in indices)" msgstr "" -#: ../../library/itertools.rst:313 +#: ../../library/itertools.rst:314 msgid "" "Make an iterator that returns elements from *data* where the corresponding " "element in *selectors* is true. Stops when either the *data* or *selectors* " @@ -755,14 +760,14 @@ msgstr "" "建立一個疊代器,回傳 *data* 中對應 *selectors* 的元素為 true 的元素。當 " "*data* 或 *selectors* 可疊代物件耗盡時停止。大致等價於: ::" -#: ../../library/itertools.rst:318 +#: ../../library/itertools.rst:319 msgid "" "def compress(data, selectors):\n" " # compress('ABCDEF', [1,0,1,0,1,1]) → A C E F\n" " return (datum for datum, selector in zip(data, selectors) if selector)" msgstr "" -#: ../../library/itertools.rst:327 +#: ../../library/itertools.rst:328 msgid "" "Make an iterator that returns evenly spaced values beginning with *start*. " "Can be used with :func:`map` to generate consecutive data points or with :" @@ -771,7 +776,7 @@ msgstr "" "建立一個疊代器,回傳從 *start* 開始的等差的值。可以與 :func:`map` 一起使用來" "產生連續的資料點,或與 :func:`zip` 一起使用來增加序列號。大致等價於: ::" -#: ../../library/itertools.rst:332 +#: ../../library/itertools.rst:333 msgid "" "def count(start=0, step=1):\n" " # count(10) → 10 11 12 13 14 ...\n" @@ -789,7 +794,7 @@ msgstr "" " yield n\n" " n += step" -#: ../../library/itertools.rst:340 +#: ../../library/itertools.rst:341 msgid "" "When counting with floating-point numbers, better accuracy can sometimes be " "achieved by substituting multiplicative code such as: ``(start + step * i " @@ -798,11 +803,11 @@ msgstr "" "當用浮點數計數時,將上述程式碼替換為乘法有時可以獲得更好的精確度,例如:" "``(start + step * i for i in count())``。" -#: ../../library/itertools.rst:344 +#: ../../library/itertools.rst:345 msgid "Added *step* argument and allowed non-integer arguments." msgstr "新增 *step* 引數並允許非整數引數。" -#: ../../library/itertools.rst:350 +#: ../../library/itertools.rst:351 msgid "" "Make an iterator returning elements from the *iterable* and saving a copy of " "each. When the iterable is exhausted, return elements from the saved copy. " @@ -811,35 +816,39 @@ msgstr "" "建立一個疊代器,回傳 *iterable* 中的元素並保存每個元素的副本。當可疊代物件耗" "盡時,從保存的副本中回傳元素。會無限次的重複。大致等價於: ::" -#: ../../library/itertools.rst:354 +#: ../../library/itertools.rst:355 msgid "" "def cycle(iterable):\n" " # cycle('ABCD') → A B C D A B C D A B C D ...\n" +"\n" " saved = []\n" " for element in iterable:\n" " yield element\n" " saved.append(element)\n" +"\n" " while saved:\n" " for element in saved:\n" " yield element" msgstr "" "def cycle(iterable):\n" " # cycle('ABCD') → A B C D A B C D A B C D ...\n" +"\n" " saved = []\n" " for element in iterable:\n" " yield element\n" " saved.append(element)\n" +"\n" " while saved:\n" " for element in saved:\n" " yield element" -#: ../../library/itertools.rst:364 +#: ../../library/itertools.rst:367 msgid "" "This itertool may require significant auxiliary storage (depending on the " "length of the iterable)." msgstr "此 itertool 可能需要大量的輔助儲存空間(取決於可疊代物件的長度)。" -#: ../../library/itertools.rst:370 +#: ../../library/itertools.rst:373 msgid "" "Make an iterator that drops elements from the *iterable* while the " "*predicate* is true and afterwards returns every element. Roughly " @@ -848,7 +857,7 @@ msgstr "" "建立一個疊代器,在 *predicate* 為 true 時丟棄 *iterable* 中的元素,之後回傳每" "個元素。大致等價於:" -#: ../../library/itertools.rst:374 +#: ../../library/itertools.rst:377 msgid "" "def dropwhile(predicate, iterable):\n" " # dropwhile(lambda x: x<5, [1,4,6,3,8]) → 6 3 8\n" @@ -874,7 +883,7 @@ msgstr "" " for x in iterator:\n" " yield x" -#: ../../library/itertools.rst:386 +#: ../../library/itertools.rst:389 msgid "" "Note this does not produce *any* output until the predicate first becomes " "false, so this itertool may have a lengthy start-up time." @@ -882,7 +891,7 @@ msgstr "" "注意,在 predicate 首次變為 False 之前,這不會產生\\ *任何*\\ 輸出,所以此 " "itertool 可能會有較長的啟動時間。" -#: ../../library/itertools.rst:392 +#: ../../library/itertools.rst:395 msgid "" "Make an iterator that filters elements from the *iterable* returning only " "those for which the *predicate* returns a false value. If *predicate* is " @@ -891,25 +900,29 @@ msgstr "" "建立一個疊代器,過濾 *iterable* 中的元素,僅回傳 *predicate* 為 False 值的元" "素。如果 *predicate* 是 ``None``,則回傳為 False 的項目。大致等價於: ::" -#: ../../library/itertools.rst:397 +#: ../../library/itertools.rst:400 msgid "" "def filterfalse(predicate, iterable):\n" " # filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8\n" +"\n" " if predicate is None:\n" " predicate = bool\n" +"\n" " for x in iterable:\n" " if not predicate(x):\n" " yield x" msgstr "" "def filterfalse(predicate, iterable):\n" " # filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8\n" +"\n" " if predicate is None:\n" " predicate = bool\n" +"\n" " for x in iterable:\n" " if not predicate(x):\n" " yield x" -#: ../../library/itertools.rst:408 +#: ../../library/itertools.rst:413 msgid "" "Make an iterator that returns consecutive keys and groups from the " "*iterable*. The *key* is a function computing a key value for each element. " @@ -922,7 +935,7 @@ msgstr "" "(identity function),並回傳未被更改的元素。一般來說,可疊代物件需要已經用相同" "的鍵函式進行排序。" -#: ../../library/itertools.rst:414 +#: ../../library/itertools.rst:419 msgid "" "The operation of :func:`groupby` is similar to the ``uniq`` filter in Unix. " "It generates a break or new group every time the value of the key function " @@ -935,7 +948,7 @@ msgstr "" "料進行排序)。這種行為不同於 SQL 的 GROUP BY,其無論輸入順序如何都會聚合相同" "的元素。" -#: ../../library/itertools.rst:420 +#: ../../library/itertools.rst:425 msgid "" "The returned group is itself an iterator that shares the underlying iterable " "with :func:`groupby`. Because the source is shared, when the :func:" @@ -946,7 +959,7 @@ msgstr "" "共享的,當 :func:`groupby` 物件前進時,前一個群組將不再可見。因此,如果之後需" "要該資料,應將其儲存為串列: ::" -#: ../../library/itertools.rst:425 +#: ../../library/itertools.rst:430 msgid "" "groups = []\n" "uniquekeys = []\n" @@ -956,11 +969,11 @@ msgid "" " uniquekeys.append(k)" msgstr "" -#: ../../library/itertools.rst:432 +#: ../../library/itertools.rst:437 msgid ":func:`groupby` is roughly equivalent to::" msgstr ":func:`groupby` 大致等價於: ::" -#: ../../library/itertools.rst:434 +#: ../../library/itertools.rst:439 msgid "" "def groupby(iterable, key=None):\n" " # [k for k, g in groupby('AAAABBBCCDAABBB')] → A B C D A B\n" @@ -1026,7 +1039,7 @@ msgstr "" " for _ in curr_group:\n" " pass" -#: ../../library/itertools.rst:470 +#: ../../library/itertools.rst:475 msgid "" "Make an iterator that returns selected elements from the iterable. Works " "like sequence slicing but does not support negative values for *start*, " @@ -1035,7 +1048,7 @@ msgstr "" "建立一個疊代器,回傳從 iterable 中選取的元素。其作用類似於序列切片 (sequence " "slicing),但不支援負數的 *start*、*stop* 或 *step* 的值。" -#: ../../library/itertools.rst:474 +#: ../../library/itertools.rst:479 msgid "" "If *start* is zero or ``None``, iteration starts at zero. Otherwise, " "elements from the iterable are skipped until *start* is reached." @@ -1043,15 +1056,15 @@ msgstr "" "如果 *start* 為零或 ``None``,則從零開始疊代。否則在達到 *start* 之前,會跳" "過 iterable 中的元素。" -#: ../../library/itertools.rst:477 +#: ../../library/itertools.rst:482 msgid "" -"If *stop* is ``None``, iteration continues until the iterator is exhausted, " -"if at all. Otherwise, it stops at the specified position." +"If *stop* is ``None``, iteration continues until the input is exhausted, if " +"at all. Otherwise, it stops at the specified position." msgstr "" -"如果 *stop* 為 ``None``,則疊代將繼續前進直到疊代器耗盡。如果指定了 *stop*," -"則在達到指定位置時停止。" +"如果 *stop* 為 ``None``,則疊代將繼續前進直到輸入耗盡。如果指定了 *stop*,則" +"在達到指定位置時停止。" -#: ../../library/itertools.rst:480 +#: ../../library/itertools.rst:485 msgid "" "If *step* is ``None``, the step defaults to one. Elements are returned " "consecutively unless *step* is set higher than one which results in items " @@ -1060,7 +1073,7 @@ msgstr "" "如果 *step* 為 ``None``,則步長 (step) 預設為一。元素會連續回傳,除非將 " "*step* 設定為大於一,這會導致一些項目被跳過。" -#: ../../library/itertools.rst:486 +#: ../../library/itertools.rst:491 msgid "" "def islice(iterable, *args):\n" " # islice('ABCDEFG', 2) → A B\n" @@ -1102,11 +1115,17 @@ msgstr "" " yield element\n" " next_i += step" -#: ../../library/itertools.rst:509 +#: ../../library/itertools.rst:511 +msgid "" +"If the input is an iterator, then fully consuming the *islice* advances the " +"input iterator by ``max(start, stop)`` steps regardless of the *step* value." +msgstr "" + +#: ../../library/itertools.rst:518 msgid "Return successive overlapping pairs taken from the input *iterable*." msgstr "回傳從輸入的 *iterable* 中提取的連續重疊對。" -#: ../../library/itertools.rst:511 +#: ../../library/itertools.rst:520 msgid "" "The number of 2-tuples in the output iterator will be one fewer than the " "number of inputs. It will be empty if the input iterable has fewer than two " @@ -1115,25 +1134,29 @@ msgstr "" "輸出疊代器中的 2 元組數量將比輸入少一個。如果輸入的可疊代物件中的值少於兩個," "則輸出將為空值。" -#: ../../library/itertools.rst:517 +#: ../../library/itertools.rst:526 msgid "" "def pairwise(iterable):\n" " # pairwise('ABCDEFG') → AB BC CD DE EF FG\n" +"\n" " iterator = iter(iterable)\n" " a = next(iterator, None)\n" +"\n" " for b in iterator:\n" " yield a, b\n" " a = b" msgstr "" "def pairwise(iterable):\n" " # pairwise('ABCDEFG') → AB BC CD DE EF FG\n" +"\n" " iterator = iter(iterable)\n" " a = next(iterator, None)\n" +"\n" " for b in iterator:\n" " yield a, b\n" " a = b" -#: ../../library/itertools.rst:530 +#: ../../library/itertools.rst:541 msgid "" "Return successive *r* length `permutations of elements `_ from the *iterable*." @@ -1141,7 +1164,7 @@ msgstr "" "回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 `_ 。" -#: ../../library/itertools.rst:533 +#: ../../library/itertools.rst:544 msgid "" "If *r* is not specified or is ``None``, then *r* defaults to the length of " "the *iterable* and all possible full-length permutations are generated." @@ -1149,7 +1172,7 @@ msgstr "" "如果未指定 *r* 或其值為 ``None``,則 *r* 預設為 *iterable* 的長度,並產生所有" "可能的完整長度的排列。" -#: ../../library/itertools.rst:537 +#: ../../library/itertools.rst:548 msgid "" "The output is a subsequence of :func:`product` where entries with repeated " "elements have been filtered out. The length of the output is given by :func:" @@ -1160,7 +1183,7 @@ msgstr "" "func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 ``r " "> n`` 時為零。" -#: ../../library/itertools.rst:542 +#: ../../library/itertools.rst:553 msgid "" "The permutation tuples are emitted in lexicographic order according to the " "order of the input *iterable*. If the input *iterable* is sorted, the " @@ -1169,7 +1192,7 @@ msgstr "" "根據輸入值 *iterable* 的順序,排列的元組會按照字典順序輸出。如果輸入的 " "*iterable* 已排序,則輸出的元組也將按排序的順序產生。" -#: ../../library/itertools.rst:546 +#: ../../library/itertools.rst:557 msgid "" "Elements are treated as unique based on their position, not on their value. " "If the input elements are unique, there will be no repeated values within a " @@ -1178,7 +1201,7 @@ msgstr "" "元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,則排" "列中將不會有重複的值。" -#: ../../library/itertools.rst:552 +#: ../../library/itertools.rst:563 msgid "" "def permutations(iterable, r=None):\n" " # permutations('ABCD', 2) → AB AC AD BA BC BD CA CB CD DA DB DC\n" @@ -1236,11 +1259,13 @@ msgstr "" " else:\n" " return" -#: ../../library/itertools.rst:583 -msgid "Cartesian product of input iterables." -msgstr "輸入的 iterables 的笛卡爾乘積。" +#: ../../library/itertools.rst:594 +msgid "" +"`Cartesian product `_ of " +"the input iterables." +msgstr "" -#: ../../library/itertools.rst:585 +#: ../../library/itertools.rst:597 msgid "" "Roughly equivalent to nested for-loops in a generator expression. For " "example, ``product(A, B)`` returns the same as ``((x,y) for x in A for y in " @@ -1249,7 +1274,7 @@ msgstr "" "大致等價於產生器運算式中的巢狀 for 迴圈。例如,``product(A, B)`` 的回傳結果" "與 ``((x,y) for x in A for y in B)`` 相同。" -#: ../../library/itertools.rst:588 +#: ../../library/itertools.rst:600 msgid "" "The nested loops cycle like an odometer with the rightmost element advancing " "on every iteration. This pattern creates a lexicographic ordering so that " @@ -1259,7 +1284,7 @@ msgstr "" "巢狀迴圈的循環類似於里程表,最右邊的元素在每次疊代時前進。這種模式會建立字典" "順序,因此如果輸入的 iterables 已排序,則輸出的乘積元組也將按排序的順序產生。" -#: ../../library/itertools.rst:593 +#: ../../library/itertools.rst:605 msgid "" "To compute the product of an iterable with itself, specify the number of " "repetitions with the optional *repeat* keyword argument. For example, " @@ -1268,7 +1293,7 @@ msgstr "" "要計算可疊代物件自身的乘積,可以使用可選的 *repeat* 關鍵字引數來指定重複次" "數。例如,``product(A, repeat=4)`` 與 ``product(A, A, A, A)`` 相同。" -#: ../../library/itertools.rst:597 +#: ../../library/itertools.rst:609 msgid "" "This function is roughly equivalent to the following code, except that the " "actual implementation does not build up intermediate results in memory::" @@ -1276,12 +1301,14 @@ msgstr "" "此函式大致等價於以下的程式碼,不同之處在於真正的實作不會在記憶體中建立中間結" "果: ::" -#: ../../library/itertools.rst:600 +#: ../../library/itertools.rst:612 msgid "" "def product(*iterables, repeat=1):\n" " # product('ABCD', 'xy') → Ax Ay Bx By Cx Cy Dx Dy\n" " # product(range(2), repeat=3) → 000 001 010 011 100 101 110 111\n" "\n" +" if repeat < 0:\n" +" raise ValueError('repeat argument cannot be negative')\n" " pools = [tuple(pool) for pool in iterables] * repeat\n" "\n" " result = [[]]\n" @@ -1295,6 +1322,8 @@ msgstr "" " # product('ABCD', 'xy') → Ax Ay Bx By Cx Cy Dx Dy\n" " # product(range(2), repeat=3) → 000 001 010 011 100 101 110 111\n" "\n" +" if repeat < 0:\n" +" raise ValueError('repeat argument cannot be negative')\n" " pools = [tuple(pool) for pool in iterables] * repeat\n" "\n" " result = [[]]\n" @@ -1304,7 +1333,7 @@ msgstr "" " for prod in result:\n" " yield tuple(prod)" -#: ../../library/itertools.rst:613 +#: ../../library/itertools.rst:627 msgid "" "Before :func:`product` runs, it completely consumes the input iterables, " "keeping pools of values in memory to generate the products. Accordingly, it " @@ -1313,7 +1342,7 @@ msgstr "" "在 :func:`product` 執行之前,它會完全消耗輸入的 iterables,並將值的池 (pools " "of values) 保存在記憶體中以產生乘積。因此,它僅對有限的輸入有用。" -#: ../../library/itertools.rst:620 +#: ../../library/itertools.rst:634 msgid "" "Make an iterator that returns *object* over and over again. Runs " "indefinitely unless the *times* argument is specified." @@ -1321,7 +1350,7 @@ msgstr "" "建立一個疊代器,反覆回傳 *object*。除非指定了 *times* 引數,否則會執行無限" "次。" -#: ../../library/itertools.rst:625 +#: ../../library/itertools.rst:639 msgid "" "def repeat(object, times=None):\n" " # repeat(10, 3) → 10 10 10\n" @@ -1341,13 +1370,13 @@ msgstr "" " for i in range(times):\n" " yield object" -#: ../../library/itertools.rst:634 +#: ../../library/itertools.rst:648 msgid "" "A common use for *repeat* is to supply a stream of constant values to *map* " "or *zip*:" msgstr "*repeat* 的常見用途是為 *map* 或 *zip* 提供定值的串流:" -#: ../../library/itertools.rst:637 +#: ../../library/itertools.rst:651 msgid "" ">>> list(map(pow, range(10), repeat(2)))\n" "[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]" @@ -1355,7 +1384,7 @@ msgstr "" ">>> list(map(pow, range(10), repeat(2)))\n" "[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]" -#: ../../library/itertools.rst:645 +#: ../../library/itertools.rst:659 msgid "" "Make an iterator that computes the *function* using arguments obtained from " "the *iterable*. Used instead of :func:`map` when argument parameters have " @@ -1364,7 +1393,7 @@ msgstr "" "建立一個疊代器,使用從 *iterable* 獲取的引數計算 *function* 。當引數參數已經" "被「預先壓縮 (pre-zipped)」成元組時,使用此方法代替 :func:`map`。" -#: ../../library/itertools.rst:649 +#: ../../library/itertools.rst:663 msgid "" "The difference between :func:`map` and :func:`starmap` parallels the " "distinction between ``function(a,b)`` and ``function(*c)``. Roughly " @@ -1373,7 +1402,7 @@ msgstr "" ":func:`map` 和 :func:`starmap` 之間的區別類似於 ``function(a,b)`` 和 " "``function(*c)`` 之間的區別。大致等價於:" -#: ../../library/itertools.rst:653 +#: ../../library/itertools.rst:667 msgid "" "def starmap(function, iterable):\n" " # starmap(pow, [(2,5), (3,2), (10,3)]) → 32 9 1000\n" @@ -1385,7 +1414,7 @@ msgstr "" " for args in iterable:\n" " yield function(*args)" -#: ../../library/itertools.rst:661 +#: ../../library/itertools.rst:675 msgid "" "Make an iterator that returns elements from the *iterable* as long as the " "*predicate* is true. Roughly equivalent to::" @@ -1393,7 +1422,7 @@ msgstr "" "建立一個疊代器,只在 *predicate* 為 true 時回傳 *iterable* 中的元素。大致等價" "於:" -#: ../../library/itertools.rst:664 +#: ../../library/itertools.rst:678 msgid "" "def takewhile(predicate, iterable):\n" " # takewhile(lambda x: x<5, [1,4,6,3,8]) → 1 4\n" @@ -1409,7 +1438,7 @@ msgstr "" " break\n" " yield x" -#: ../../library/itertools.rst:671 +#: ../../library/itertools.rst:685 msgid "" "Note, the element that first fails the predicate condition is consumed from " "the input iterator and there is no way to access it. This could be an issue " @@ -1424,54 +1453,80 @@ msgstr "" "more-itertools.readthedocs.io/en/stable/api.html#more_itertools." "before_and_after>`_ 作為替代。" -#: ../../library/itertools.rst:682 +#: ../../library/itertools.rst:696 msgid "Return *n* independent iterators from a single iterable." msgstr "從一個 iterable 中回傳 *n* 個獨立的疊代器。" -#: ../../library/itertools.rst:686 +#: ../../library/itertools.rst:700 msgid "" "def tee(iterable, n=2):\n" -" iterator = iter(iterable)\n" -" shared_link = [None, None]\n" -" return tuple(_tee(iterator, shared_link) for _ in range(n))\n" +" if n < 0:\n" +" raise ValueError\n" +" if n == 0:\n" +" return ()\n" +" iterator = _tee(iterable)\n" +" result = [iterator]\n" +" for _ in range(n - 1):\n" +" result.append(_tee(iterator))\n" +" return tuple(result)\n" +"\n" +"class _tee:\n" +"\n" +" def __init__(self, iterable):\n" +" it = iter(iterable)\n" +" if isinstance(it, _tee):\n" +" self.iterator = it.iterator\n" +" self.link = it.link\n" +" else:\n" +" self.iterator = it\n" +" self.link = [None, None]\n" "\n" -"def _tee(iterator, link):\n" -" try:\n" -" while True:\n" -" if link[1] is None:\n" -" link[0] = next(iterator)\n" -" link[1] = [None, None]\n" -" value, link = link\n" -" yield value\n" -" except StopIteration:\n" -" return" -msgstr "" -"def tee(iterable, n=2):\n" -" iterator = iter(iterable)\n" -" shared_link = [None, None]\n" -" return tuple(_tee(iterator, shared_link) for _ in range(n))\n" +" def __iter__(self):\n" +" return self\n" "\n" -"def _tee(iterator, link):\n" -" try:\n" -" while True:\n" -" if link[1] is None:\n" -" link[0] = next(iterator)\n" -" link[1] = [None, None]\n" -" value, link = link\n" -" yield value\n" -" except StopIteration:\n" -" return" +" def __next__(self):\n" +" link = self.link\n" +" if link[1] is None:\n" +" link[0] = next(self.iterator)\n" +" link[1] = [None, None]\n" +" value, self.link = link\n" +" return value" +msgstr "" -#: ../../library/itertools.rst:702 +#: ../../library/itertools.rst:733 msgid "" -"Once a :func:`tee` has been created, the original *iterable* should not be " -"used anywhere else; otherwise, the *iterable* could get advanced without the " -"tee objects being informed." +"When the input *iterable* is already a tee iterator object, all members of " +"the return tuple are constructed as if they had been produced by the " +"upstream :func:`tee` call. This \"flattening step\" allows nested :func:" +"`tee` calls to share the same underlying data chain and to have a single " +"update step rather than a chain of calls." +msgstr "" + +#: ../../library/itertools.rst:739 +msgid "The flattening property makes tee iterators efficiently peekable:" msgstr "" -"一旦建立了 :func:`tee`,原始的 *iterable* 不應在其他地方使用;否則," -"*iterable* 可能會在 tee 物件未被通知的情況下前進。" -#: ../../library/itertools.rst:706 +#: ../../library/itertools.rst:741 +msgid "" +"def lookahead(tee_iterator):\n" +" \"Return the next value without moving the input forward\"\n" +" [forked_iterator] = tee(tee_iterator, 1)\n" +" return next(forked_iterator)" +msgstr "" + +#: ../../library/itertools.rst:748 +msgid "" +">>> iterator = iter('abcdef')\n" +">>> [iterator] = tee(iterator, 1) # Make the input peekable\n" +">>> next(iterator) # Move the iterator forward\n" +"'a'\n" +">>> lookahead(iterator) # Check next value\n" +"'b'\n" +">>> next(iterator) # Continue moving forward\n" +"'b'" +msgstr "" + +#: ../../library/itertools.rst:759 msgid "" "``tee`` iterators are not threadsafe. A :exc:`RuntimeError` may be raised " "when simultaneously using iterators returned by the same :func:`tee` call, " @@ -1481,7 +1536,7 @@ msgstr "" "呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引發 :exc:" "`RuntimeError`。" -#: ../../library/itertools.rst:710 +#: ../../library/itertools.rst:763 msgid "" "This itertool may require significant auxiliary storage (depending on how " "much temporary data needs to be stored). In general, if one iterator uses " @@ -1492,11 +1547,11 @@ msgstr "" "果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使用 :func:" "`list` 會比 :func:`tee` 更快。" -#: ../../library/itertools.rst:718 +#: ../../library/itertools.rst:771 msgid "Make an iterator that aggregates elements from each of the *iterables*." msgstr "建立一個疊代器,聚合來自每個 *iterables* 中的元素。" -#: ../../library/itertools.rst:721 +#: ../../library/itertools.rst:774 msgid "" "If the iterables are of uneven length, missing values are filled-in with " "*fillvalue*. If not specified, *fillvalue* defaults to ``None``." @@ -1504,11 +1559,11 @@ msgstr "" "如果 iterables 的長度不一,則使用 *fillvalue* 填充缺少的值。如果未指定," "*fillvalue* 會預設為 ``None``。" -#: ../../library/itertools.rst:724 +#: ../../library/itertools.rst:777 msgid "Iteration continues until the longest iterable is exhausted." msgstr "疊代將持續直到最長的可疊代物件耗盡為止。" -#: ../../library/itertools.rst:728 +#: ../../library/itertools.rst:781 msgid "" "def zip_longest(*iterables, fillvalue=None):\n" " # zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-\n" @@ -1554,7 +1609,7 @@ msgstr "" " values.append(value)\n" " yield tuple(values)" -#: ../../library/itertools.rst:750 +#: ../../library/itertools.rst:803 msgid "" "If one of the iterables is potentially infinite, then the :func:" "`zip_longest` function should be wrapped with something that limits the " @@ -1563,18 +1618,18 @@ msgstr "" "如果其中一個 iterables 可能是無限的,那麼應該用別的可以限制呼叫次數的方法來包" "裝 :func:`zip_longest` 函式(例如 :func:`islice` 或 :func:`takewhile`)。" -#: ../../library/itertools.rst:758 +#: ../../library/itertools.rst:811 msgid "Itertools Recipes" msgstr "Itertools 應用技巧" -#: ../../library/itertools.rst:760 +#: ../../library/itertools.rst:813 msgid "" "This section shows recipes for creating an extended toolset using the " "existing itertools as building blocks." msgstr "" "此段落展示了使用現有的 itertools 作為構建塊來建立擴展工具集的應用技巧。" -#: ../../library/itertools.rst:763 +#: ../../library/itertools.rst:816 msgid "" "The primary purpose of the itertools recipes is educational. The recipes " "show various ways of thinking about individual tools — for example, that " @@ -1592,7 +1647,7 @@ msgstr "" "`collections` 模組一同使用以及與內建 itertools(如 ``map()``、``filter()``、" "``reversed()`` 和 ``enumerate()``)一同使用的模式。" -#: ../../library/itertools.rst:772 +#: ../../library/itertools.rst:825 msgid "" "A secondary purpose of the recipes is to serve as an incubator. The " "``accumulate()``, ``compress()``, and ``pairwise()`` itertools started out " @@ -1604,7 +1659,7 @@ msgstr "" "``sliding_window()``、``iter_index()`` 和 ``sieve()`` 的應用技巧正在被測試," "以確定它們是否有價值被收錄到內建的 itertools 中。" -#: ../../library/itertools.rst:777 +#: ../../library/itertools.rst:830 msgid "" "Substantially all of these recipes and many, many others can be installed " "from the :pypi:`more-itertools` project found on the Python Package Index::" @@ -1612,11 +1667,11 @@ msgstr "" "幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上的 :" "pypi:`more-itertools` 專案中安裝: ::" -#: ../../library/itertools.rst:781 +#: ../../library/itertools.rst:834 msgid "python -m pip install more-itertools" msgstr "python -m pip install more-itertools" -#: ../../library/itertools.rst:783 +#: ../../library/itertools.rst:836 msgid "" "Many of the recipes offer the same high performance as the underlying " "toolset. Superior memory performance is kept by processing elements one at a " @@ -1634,7 +1689,7 @@ msgstr "" "用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和\\ :" "term:`產生器 `,則能保持高速度。" -#: ../../library/itertools.rst:791 +#: ../../library/itertools.rst:844 msgid "" "import collections\n" "import contextlib\n" @@ -1770,16 +1825,6 @@ msgid "" " iterators = cycle(islice(iterators, num_active))\n" " yield from map(next, iterators)\n" "\n" -"def partition(predicate, iterable):\n" -" \"\"\"Partition entries into false entries and true entries.\n" -"\n" -" If *predicate* is slow, consider wrapping it with functools." -"lru_cache().\n" -" \"\"\"\n" -" # partition(is_odd, range(10)) → 0 2 4 6 8 and 1 3 5 7 9\n" -" t1, t2 = tee(iterable)\n" -" return filterfalse(predicate, t1), filter(predicate, t2)\n" -"\n" "def subslices(seq):\n" " \"Return all contiguous non-empty subslices of a sequence.\"\n" " # subslices('ABCD') → A AB ABC ABCD B BC BCD C CD D\n" @@ -1813,11 +1858,11 @@ msgid "" " yield func()" msgstr "" -#: ../../library/itertools.rst:964 +#: ../../library/itertools.rst:1008 msgid "The following recipes have a more mathematical flavor:" msgstr "以下的應用技巧具有更多的數學風格:" -#: ../../library/itertools.rst:966 +#: ../../library/itertools.rst:1010 msgid "" "def powerset(iterable):\n" " \"powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)\"\n" diff --git a/library/locale.po b/library/locale.po index 2cb4e18ddf..c36cbfaff7 100644 --- a/library/locale.po +++ b/library/locale.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -331,110 +331,111 @@ msgstr "" #: ../../library/locale.rst:161 msgid "" -"Return some locale-specific information as a string. This function is not " -"available on all systems, and the set of possible options might also vary " -"across platforms. The possible argument values are numbers, for which " -"symbolic constants are available in the locale module." +"Return some locale-specific information as a string (or a tuple for " +"``ALT_DIGITS``). This function is not available on all systems, and the set " +"of possible options might also vary across platforms. The possible argument " +"values are numbers, for which symbolic constants are available in the locale " +"module." msgstr "" -#: ../../library/locale.rst:166 +#: ../../library/locale.rst:167 msgid "" "The :func:`nl_langinfo` function accepts one of the following keys. Most " "descriptions are taken from the corresponding description in the GNU C " "library." msgstr "" -#: ../../library/locale.rst:172 +#: ../../library/locale.rst:173 msgid "" "Get a string with the name of the character encoding used in the selected " "locale." msgstr "" -#: ../../library/locale.rst:177 +#: ../../library/locale.rst:178 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent date and time in a locale-specific way." msgstr "" -#: ../../library/locale.rst:182 +#: ../../library/locale.rst:183 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent a date in a locale-specific way." msgstr "" -#: ../../library/locale.rst:187 +#: ../../library/locale.rst:188 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent a time in a locale-specific way." msgstr "" -#: ../../library/locale.rst:192 +#: ../../library/locale.rst:193 msgid "" "Get a format string for :func:`time.strftime` to represent time in the am/pm " "format." msgstr "" -#: ../../library/locale.rst:203 +#: ../../library/locale.rst:204 msgid "Get the name of the n-th day of the week." msgstr "" -#: ../../library/locale.rst:207 +#: ../../library/locale.rst:208 msgid "" "This follows the US convention of :const:`DAY_1` being Sunday, not the " "international convention (ISO 8601) that Monday is the first day of the week." msgstr "" -#: ../../library/locale.rst:219 +#: ../../library/locale.rst:220 msgid "Get the abbreviated name of the n-th day of the week." msgstr "" -#: ../../library/locale.rst:234 +#: ../../library/locale.rst:235 msgid "Get the name of the n-th month." msgstr "" -#: ../../library/locale.rst:249 +#: ../../library/locale.rst:250 msgid "Get the abbreviated name of the n-th month." msgstr "" -#: ../../library/locale.rst:253 +#: ../../library/locale.rst:254 msgid "Get the radix character (decimal dot, decimal comma, etc.)." msgstr "" -#: ../../library/locale.rst:257 +#: ../../library/locale.rst:258 msgid "Get the separator character for thousands (groups of three digits)." msgstr "" -#: ../../library/locale.rst:261 +#: ../../library/locale.rst:262 msgid "" "Get a regular expression that can be used with the regex function to " "recognize a positive response to a yes/no question." msgstr "" -#: ../../library/locale.rst:266 +#: ../../library/locale.rst:267 msgid "" "Get a regular expression that can be used with the ``regex(3)`` function to " "recognize a negative response to a yes/no question." msgstr "" -#: ../../library/locale.rst:271 +#: ../../library/locale.rst:272 msgid "" "The regular expressions for :const:`YESEXPR` and :const:`NOEXPR` use syntax " "suitable for the ``regex`` function from the C library, which might differ " "from the syntax used in :mod:`re`." msgstr "" -#: ../../library/locale.rst:278 +#: ../../library/locale.rst:279 msgid "" "Get the currency symbol, preceded by \"-\" if the symbol should appear " "before the value, \"+\" if the symbol should appear after the value, or \"." "\" if the symbol should replace the radix character." msgstr "" -#: ../../library/locale.rst:284 +#: ../../library/locale.rst:285 msgid "Get a string that represents the era used in the current locale." msgstr "" -#: ../../library/locale.rst:286 +#: ../../library/locale.rst:287 msgid "" "Most locales do not define this value. An example of a locale which does " "define this value is the Japanese one. In Japan, the traditional " @@ -442,7 +443,7 @@ msgid "" "then-emperor's reign." msgstr "" -#: ../../library/locale.rst:291 +#: ../../library/locale.rst:292 msgid "" "Normally it should not be necessary to use this value directly. Specifying " "the ``E`` modifier in their format strings causes the :func:`time.strftime` " @@ -451,28 +452,26 @@ msgid "" "systems." msgstr "" -#: ../../library/locale.rst:299 +#: ../../library/locale.rst:300 msgid "" "Get a format string for :func:`time.strftime` to represent date and time in " "a locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:304 +#: ../../library/locale.rst:305 msgid "" "Get a format string for :func:`time.strftime` to represent a date in a " "locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:309 +#: ../../library/locale.rst:310 msgid "" "Get a format string for :func:`time.strftime` to represent a time in a " "locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:314 -msgid "" -"Get a representation of up to 100 values used to represent the values 0 to " -"99." +#: ../../library/locale.rst:315 +msgid "Get a tuple of up to 100 strings used to represent the values 0 to 99." msgstr "" #: ../../library/locale.rst:320 diff --git a/library/logging.config.po b/library/logging.config.po index 018f87b9aa..bac0b9d580 100644 --- a/library/logging.config.po +++ b/library/logging.config.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-09 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1085,59 +1085,59 @@ msgstr "" #: ../../library/logging.config.rst:756 msgid "" -"An object implementing the :class:`queue.Queue` public API. For instance, " -"this may be an actual instance of :class:`queue.Queue` or a subclass " -"thereof, or a proxy obtained by :meth:`multiprocessing.managers.SyncManager." -"Queue`." +"An object implementing the :meth:`Queue.put_nowait ` " +"and :meth:`Queue.get ` public API. For instance, this may " +"be an actual instance of :class:`queue.Queue` or a subclass thereof, or a " +"proxy obtained by :meth:`multiprocessing.managers.SyncManager.Queue`." msgstr "" -#: ../../library/logging.config.rst:760 +#: ../../library/logging.config.rst:761 msgid "" "This is of course only possible if you are constructing or modifying the " "configuration dictionary in code." msgstr "" -#: ../../library/logging.config.rst:763 +#: ../../library/logging.config.rst:764 msgid "" "A string that resolves to a callable which, when called with no arguments, " -"returns the :class:`queue.Queue` instance to use. That callable could be a :" -"class:`queue.Queue` subclass or a function which returns a suitable queue " -"instance, such as ``my.module.queue_factory()``." +"returns the queue instance to use. That callable could be a :class:`queue." +"Queue` subclass or a function which returns a suitable queue instance, such " +"as ``my.module.queue_factory()``." msgstr "" -#: ../../library/logging.config.rst:768 +#: ../../library/logging.config.rst:769 msgid "" "A dict with a ``'()'`` key which is constructed in the usual way as " "discussed in :ref:`logging-config-dict-userdef`. The result of this " "construction should be a :class:`queue.Queue` instance." msgstr "" -#: ../../library/logging.config.rst:772 +#: ../../library/logging.config.rst:773 msgid "" "If the ``queue`` key is absent, a standard unbounded :class:`queue.Queue` " "instance is created and used." msgstr "" -#: ../../library/logging.config.rst:775 +#: ../../library/logging.config.rst:776 msgid "" "If the ``listener`` key is present, the corresponding value can be one of " "the following:" msgstr "" -#: ../../library/logging.config.rst:777 +#: ../../library/logging.config.rst:778 msgid "" "A subclass of :class:`logging.handlers.QueueListener`. This is of course " "only possible if you are constructing or modifying the configuration " "dictionary in code." msgstr "" -#: ../../library/logging.config.rst:781 +#: ../../library/logging.config.rst:782 msgid "" "A string which resolves to a class which is a subclass of ``QueueListener``, " "such as ``'my.package.CustomListener'``." msgstr "" -#: ../../library/logging.config.rst:784 +#: ../../library/logging.config.rst:785 msgid "" "A dict with a ``'()'`` key which is constructed in the usual way as " "discussed in :ref:`logging-config-dict-userdef`. The result of this " @@ -1145,31 +1145,31 @@ msgid "" "``QueueListener`` initializer." msgstr "" -#: ../../library/logging.config.rst:788 +#: ../../library/logging.config.rst:789 msgid "" "If the ``listener`` key is absent, :class:`logging.handlers.QueueListener` " "is used." msgstr "" -#: ../../library/logging.config.rst:790 +#: ../../library/logging.config.rst:791 msgid "" "The values under the ``handlers`` key are the names of other handlers in the " "configuration (not shown in the above snippet) which will be passed to the " "queue listener." msgstr "" -#: ../../library/logging.config.rst:794 +#: ../../library/logging.config.rst:795 msgid "" "Any custom queue handler and listener classes will need to be defined with " "the same initialization signatures as :class:`~logging.handlers." "QueueHandler` and :class:`~logging.handlers.QueueListener`." msgstr "" -#: ../../library/logging.config.rst:803 +#: ../../library/logging.config.rst:804 msgid "Configuration file format" msgstr "" -#: ../../library/logging.config.rst:805 +#: ../../library/logging.config.rst:806 msgid "" "The configuration file format understood by :func:`fileConfig` is based on :" "mod:`configparser` functionality. The file must contain sections called " @@ -1186,7 +1186,7 @@ msgid "" "specified in a section called ``[logger_root]``." msgstr "" -#: ../../library/logging.config.rst:820 +#: ../../library/logging.config.rst:821 msgid "" "The :func:`fileConfig` API is older than the :func:`dictConfig` API and does " "not provide functionality to cover certain aspects of logging. For example, " @@ -1199,11 +1199,11 @@ msgid "" "when it's convenient to do so." msgstr "" -#: ../../library/logging.config.rst:830 +#: ../../library/logging.config.rst:831 msgid "Examples of these sections in the file are given below." msgstr "" -#: ../../library/logging.config.rst:832 +#: ../../library/logging.config.rst:833 msgid "" "[loggers]\n" "keys=root,log02,log03,log04,log05,log06,log07\n" @@ -1223,13 +1223,13 @@ msgstr "" "[formatters]\n" "keys=form01,form02,form03,form04,form05,form06,form07,form08,form09" -#: ../../library/logging.config.rst:843 +#: ../../library/logging.config.rst:844 msgid "" "The root logger must specify a level and a list of handlers. An example of a " "root logger section is given below." msgstr "" -#: ../../library/logging.config.rst:846 +#: ../../library/logging.config.rst:847 msgid "" "[logger_root]\n" "level=NOTSET\n" @@ -1239,7 +1239,7 @@ msgstr "" "level=NOTSET\n" "handlers=hand01" -#: ../../library/logging.config.rst:852 +#: ../../library/logging.config.rst:853 msgid "" "The ``level`` entry can be one of ``DEBUG, INFO, WARNING, ERROR, CRITICAL`` " "or ``NOTSET``. For the root logger only, ``NOTSET`` means that all messages " @@ -1247,7 +1247,7 @@ msgid "" "of the ``logging`` package's namespace." msgstr "" -#: ../../library/logging.config.rst:857 +#: ../../library/logging.config.rst:858 msgid "" "The ``handlers`` entry is a comma-separated list of handler names, which " "must appear in the ``[handlers]`` section. These names must appear in the " @@ -1255,13 +1255,13 @@ msgid "" "file." msgstr "" -#: ../../library/logging.config.rst:862 +#: ../../library/logging.config.rst:863 msgid "" "For loggers other than the root logger, some additional information is " "required. This is illustrated by the following example." msgstr "" -#: ../../library/logging.config.rst:865 +#: ../../library/logging.config.rst:866 msgid "" "[logger_parser]\n" "level=DEBUG\n" @@ -1275,7 +1275,7 @@ msgstr "" "propagate=1\n" "qualname=compiler.parser" -#: ../../library/logging.config.rst:873 +#: ../../library/logging.config.rst:874 msgid "" "The ``level`` and ``handlers`` entries are interpreted as for the root " "logger, except that if a non-root logger's level is specified as ``NOTSET``, " @@ -1288,13 +1288,13 @@ msgid "" "application to get the logger." msgstr "" -#: ../../library/logging.config.rst:882 +#: ../../library/logging.config.rst:883 msgid "" "Sections which specify handler configuration are exemplified by the " "following." msgstr "" -#: ../../library/logging.config.rst:884 +#: ../../library/logging.config.rst:885 msgid "" "[handler_hand01]\n" "class=StreamHandler\n" @@ -1308,14 +1308,14 @@ msgstr "" "formatter=form01\n" "args=(sys.stdout,)" -#: ../../library/logging.config.rst:892 +#: ../../library/logging.config.rst:893 msgid "" "The ``class`` entry indicates the handler's class (as determined by :func:" "`eval` in the ``logging`` package's namespace). The ``level`` is interpreted " "as for loggers, and ``NOTSET`` is taken to mean 'log everything'." msgstr "" -#: ../../library/logging.config.rst:896 +#: ../../library/logging.config.rst:897 msgid "" "The ``formatter`` entry indicates the key name of the formatter for this " "handler. If blank, a default formatter (``logging._defaultFormatter``) is " @@ -1323,7 +1323,7 @@ msgid "" "and have a corresponding section in the configuration file." msgstr "" -#: ../../library/logging.config.rst:901 +#: ../../library/logging.config.rst:902 msgid "" "The ``args`` entry, when :ref:`evaluated ` in the context of the " "``logging`` package's namespace, is the list of arguments to the constructor " @@ -1332,7 +1332,7 @@ msgid "" "provided, it defaults to ``()``." msgstr "" -#: ../../library/logging.config.rst:907 +#: ../../library/logging.config.rst:908 msgid "" "The optional ``kwargs`` entry, when :ref:`evaluated ` in the " "context of the ``logging`` package's namespace, is the keyword argument dict " @@ -1340,7 +1340,7 @@ msgid "" "``{}``." msgstr "" -#: ../../library/logging.config.rst:911 +#: ../../library/logging.config.rst:912 msgid "" "[handler_hand02]\n" "class=FileHandler\n" @@ -1448,12 +1448,12 @@ msgstr "" "args=('localhost:9022', '/log', 'GET')\n" "kwargs={'secure': True}" -#: ../../library/logging.config.rst:964 +#: ../../library/logging.config.rst:965 msgid "" "Sections which specify formatter configuration are typified by the following." msgstr "" -#: ../../library/logging.config.rst:966 +#: ../../library/logging.config.rst:967 msgid "" "[formatter_form01]\n" "format=F1 %(asctime)s %(levelname)s %(message)s %(customfield)s\n" @@ -1471,21 +1471,21 @@ msgstr "" "defaults={'customfield': 'defaultvalue'}\n" "class=logging.Formatter" -#: ../../library/logging.config.rst:976 +#: ../../library/logging.config.rst:977 msgid "" "The arguments for the formatter configuration are the same as the keys in " "the dictionary schema :ref:`formatters section `." msgstr "" -#: ../../library/logging.config.rst:980 +#: ../../library/logging.config.rst:981 msgid "" "The ``defaults`` entry, when :ref:`evaluated ` in the context of " "the ``logging`` package's namespace, is a dictionary of default values for " "custom formatting fields. If not provided, it defaults to ``None``." msgstr "" -#: ../../library/logging.config.rst:987 +#: ../../library/logging.config.rst:988 msgid "" "Due to the use of :func:`eval` as described above, there are potential " "security risks which result from using the :func:`listen` to send and " @@ -1494,18 +1494,18 @@ msgid "" "`listen` documentation for more information." msgstr "" -#: ../../library/logging.config.rst:995 +#: ../../library/logging.config.rst:996 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../library/logging.config.rst:996 +#: ../../library/logging.config.rst:997 msgid "API reference for the logging module." msgstr "" -#: ../../library/logging.config.rst:998 +#: ../../library/logging.config.rst:999 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../library/logging.config.rst:999 +#: ../../library/logging.config.rst:1000 msgid "Useful handlers included with the logging module." msgstr "" diff --git a/library/mimetypes.po b/library/mimetypes.po index 9b5715f5c0..fe246b5824 100644 --- a/library/mimetypes.po +++ b/library/mimetypes.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2016-11-19 00:32+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -353,8 +353,8 @@ msgid "Load MIME type information from the Windows registry." msgstr "" #: ../../library/mimetypes.rst:292 -msgid ":ref:`Availability `: Windows." -msgstr ":ref:`適用 `:Windows。" +msgid "Availability" +msgstr "" #: ../../library/mimetypes.rst:11 ../../library/mimetypes.rst:31 #: ../../library/mimetypes.rst:64 diff --git a/library/mmap.po b/library/mmap.po index 2d33ddb42b..91eea5513a 100644 --- a/library/mmap.po +++ b/library/mmap.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+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-" @@ -22,8 +22,8 @@ msgid ":mod:`!mmap` --- Memory-mapped file support" msgstr ":mod:`!mmap` --- 記憶體對映檔案的支援" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -458,7 +458,7 @@ msgstr "" #: ../../library/mmap.rst:348 msgid "MADV_* Constants" -msgstr "" +msgstr "MADV_* 常數" #: ../../library/mmap.rst:375 msgid "" @@ -491,9 +491,8 @@ msgid "Added :data:`MAP_STACK` constant." msgstr "新增 :data:`MAP_STACK` 常數。" #: ../../library/mmap.rst:419 -#, fuzzy msgid "Added :data:`MAP_ALIGNED_SUPER` and :data:`MAP_CONCEAL` constants." -msgstr "新增 :data:`MAP_ALIGNED_SUPER` 常數。新增 :data:`MAP_CONCEAL` 常數。" +msgstr "新增 :data:`MAP_ALIGNED_SUPER` 和 :data:`MAP_CONCEAL` 常數。" #: ../../library/mmap.rst:422 msgid "" diff --git a/library/multiprocessing.po b/library/multiprocessing.po index c428df62b4..da2a98eeaa 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+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-" @@ -26,8 +26,8 @@ msgid "**Source code:** :source:`Lib/multiprocessing/`" msgstr "**原始碼:**\\ :source:`Lib/multiprocessing/`" #: ../../includes/wasm-mobile-notavail.rst:3 -msgid ":ref:`Availability `: not Android, not iOS, not WASI." -msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-mobile-notavail.rst:5 msgid "" @@ -1577,7 +1577,7 @@ msgstr "" #: ../../library/multiprocessing.rst:1019 msgid ":func:`os.cpu_count` :func:`os.process_cpu_count`" -msgstr "" +msgstr ":func:`os.cpu_count` :func:`os.process_cpu_count`" #: ../../library/multiprocessing.rst:1024 msgid "" @@ -4879,16 +4879,3 @@ msgid "" " freeze_support()\n" " test()\n" msgstr "" - -#, fuzzy -#~ msgid "" -#~ "This module does not work or is not available on WebAssembly platforms, " -#~ "or on iOS. See :ref:`wasm-availability` for more information on WASM " -#~ "availability; see :ref:`iOS-availability` for more information on iOS " -#~ "availability." -#~ msgstr "" -#~ "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法" -#~ "作用或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" - -#~ msgid ":func:`os.cpu_count`" -#~ msgstr ":func:`os.cpu_count`" diff --git a/library/os.path.po b/library/os.path.po index 7480d8c542..2019487b8c 100644 --- a/library/os.path.po +++ b/library/os.path.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2023-07-13 14:06+0800\n" "Last-Translator: Po-Chuan Chen \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -456,8 +456,8 @@ msgid "" msgstr "" #: ../../library/os.path.rst:348 -msgid ":ref:`Availability `: Windows." -msgstr ":ref:`適用 `:Windows。" +msgid "Availability" +msgstr "" #: ../../library/os.path.rst:355 msgid "" diff --git a/library/os.po b/library/os.po index e840cd0740..08a42cda4c 100644 --- a/library/os.po +++ b/library/os.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+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-" @@ -305,20 +305,62 @@ msgid "" "Return the filename corresponding to the controlling terminal of the process." msgstr "" -#: ../../library/os.rst:181 ../../library/os.rst:358 ../../library/os.rst:367 -#: ../../library/os.rst:389 ../../library/os.rst:398 ../../library/os.rst:434 -#: ../../library/os.rst:442 ../../library/os.rst:480 ../../library/os.rst:491 -#: ../../library/os.rst:512 ../../library/os.rst:522 ../../library/os.rst:602 +#: ../../library/os.rst:181 ../../library/os.rst:322 ../../library/os.rst:337 +#: ../../library/os.rst:358 ../../library/os.rst:367 ../../library/os.rst:376 +#: ../../library/os.rst:389 ../../library/os.rst:398 ../../library/os.rst:426 +#: ../../library/os.rst:434 ../../library/os.rst:442 ../../library/os.rst:462 +#: ../../library/os.rst:480 ../../library/os.rst:491 ../../library/os.rst:503 +#: ../../library/os.rst:512 ../../library/os.rst:522 ../../library/os.rst:533 +#: ../../library/os.rst:545 ../../library/os.rst:579 ../../library/os.rst:586 +#: ../../library/os.rst:593 ../../library/os.rst:602 ../../library/os.rst:639 #: ../../library/os.rst:652 ../../library/os.rst:661 ../../library/os.rst:678 -#: ../../library/os.rst:719 ../../library/os.rst:726 ../../library/os.rst:1139 -#: ../../library/os.rst:1183 ../../library/os.rst:1367 -#: ../../library/os.rst:1393 ../../library/os.rst:1463 -#: ../../library/os.rst:1535 ../../library/os.rst:1662 -#: ../../library/os.rst:1682 ../../library/os.rst:1691 +#: ../../library/os.rst:687 ../../library/os.rst:694 ../../library/os.rst:703 +#: ../../library/os.rst:712 ../../library/os.rst:719 ../../library/os.rst:726 +#: ../../library/os.rst:735 ../../library/os.rst:792 ../../library/os.rst:831 +#: ../../library/os.rst:953 ../../library/os.rst:979 ../../library/os.rst:992 +#: ../../library/os.rst:1009 ../../library/os.rst:1027 +#: ../../library/os.rst:1038 ../../library/os.rst:1061 +#: ../../library/os.rst:1082 ../../library/os.rst:1094 +#: ../../library/os.rst:1105 ../../library/os.rst:1118 +#: ../../library/os.rst:1139 ../../library/os.rst:1160 +#: ../../library/os.rst:1172 ../../library/os.rst:1183 +#: ../../library/os.rst:1244 ../../library/os.rst:1367 +#: ../../library/os.rst:1379 ../../library/os.rst:1393 +#: ../../library/os.rst:1403 ../../library/os.rst:1418 +#: ../../library/os.rst:1433 ../../library/os.rst:1446 +#: ../../library/os.rst:1463 ../../library/os.rst:1489 +#: ../../library/os.rst:1506 ../../library/os.rst:1520 +#: ../../library/os.rst:1535 ../../library/os.rst:1547 +#: ../../library/os.rst:1574 ../../library/os.rst:1586 +#: ../../library/os.rst:1596 ../../library/os.rst:1610 +#: ../../library/os.rst:1662 ../../library/os.rst:1682 +#: ../../library/os.rst:1691 ../../library/os.rst:1703 +#: ../../library/os.rst:1738 ../../library/os.rst:1762 #: ../../library/os.rst:1772 ../../library/os.rst:1780 -#: ../../library/os.rst:1800 ../../library/os.rst:2087 -#: ../../library/os.rst:2221 ../../library/os.rst:2514 -#: ../../library/os.rst:2536 ../../library/os.rst:4330 +#: ../../library/os.rst:1789 ../../library/os.rst:1800 +#: ../../library/os.rst:1837 ../../library/os.rst:1864 +#: ../../library/os.rst:1915 ../../library/os.rst:1921 +#: ../../library/os.rst:2087 ../../library/os.rst:2164 +#: ../../library/os.rst:2181 ../../library/os.rst:2195 +#: ../../library/os.rst:2221 ../../library/os.rst:2239 +#: ../../library/os.rst:2255 ../../library/os.rst:2271 +#: ../../library/os.rst:2334 ../../library/os.rst:2358 +#: ../../library/os.rst:2378 ../../library/os.rst:2514 +#: ../../library/os.rst:2536 ../../library/os.rst:2580 +#: ../../library/os.rst:2592 ../../library/os.rst:2614 +#: ../../library/os.rst:3322 ../../library/os.rst:3456 +#: ../../library/os.rst:3479 ../../library/os.rst:3493 +#: ../../library/os.rst:3712 ../../library/os.rst:3737 +#: ../../library/os.rst:3762 ../../library/os.rst:3816 +#: ../../library/os.rst:3825 ../../library/os.rst:3834 +#: ../../library/os.rst:3842 ../../library/os.rst:3851 +#: ../../library/os.rst:3860 ../../library/os.rst:3932 +#: ../../library/os.rst:3995 ../../library/os.rst:4005 +#: ../../library/os.rst:4023 ../../library/os.rst:4032 +#: ../../library/os.rst:4042 ../../library/os.rst:4052 +#: ../../library/os.rst:4062 ../../library/os.rst:4073 +#: ../../library/os.rst:4218 ../../library/os.rst:4287 +#: ../../library/os.rst:4322 ../../library/os.rst:4330 #: ../../library/os.rst:4337 ../../library/os.rst:4344 #: ../../library/os.rst:4351 ../../library/os.rst:4358 #: ../../library/os.rst:4365 ../../library/os.rst:4372 @@ -326,9 +368,32 @@ msgstr "" #: ../../library/os.rst:4395 ../../library/os.rst:4402 #: ../../library/os.rst:4411 ../../library/os.rst:4419 #: ../../library/os.rst:4427 ../../library/os.rst:4434 -#: ../../library/os.rst:4441 ../../library/os.rst:4564 -msgid ":ref:`Availability `: Unix, not WASI." -msgstr ":ref:`適用 `:Unix、非 WASI。" +#: ../../library/os.rst:4441 ../../library/os.rst:4490 +#: ../../library/os.rst:4517 ../../library/os.rst:4541 +#: ../../library/os.rst:4557 ../../library/os.rst:4564 +#: ../../library/os.rst:4575 ../../library/os.rst:4585 +#: ../../library/os.rst:4594 ../../library/os.rst:4626 +#: ../../library/os.rst:4734 ../../library/os.rst:4750 +#: ../../library/os.rst:4783 ../../library/os.rst:4852 +#: ../../library/os.rst:4871 ../../library/os.rst:4882 +#: ../../library/os.rst:4894 ../../library/os.rst:4939 +#: ../../library/os.rst:4976 ../../library/os.rst:4999 +#: ../../library/os.rst:5020 ../../library/os.rst:5054 +#: ../../library/os.rst:5095 ../../library/os.rst:5115 +#: ../../library/os.rst:5129 ../../library/os.rst:5146 +#: ../../library/os.rst:5161 ../../library/os.rst:5172 +#: ../../library/os.rst:5184 ../../library/os.rst:5197 +#: ../../library/os.rst:5206 ../../library/os.rst:5216 +#: ../../library/os.rst:5229 ../../library/os.rst:5264 +#: ../../library/os.rst:5280 ../../library/os.rst:5291 +#: ../../library/os.rst:5303 ../../library/os.rst:5310 +#: ../../library/os.rst:5319 ../../library/os.rst:5328 +#: ../../library/os.rst:5337 ../../library/os.rst:5346 +#: ../../library/os.rst:5496 ../../library/os.rst:5505 +#: ../../library/os.rst:5529 ../../library/os.rst:5556 +#: ../../library/os.rst:5565 ../../library/os.rst:5688 +msgid "Availability" +msgstr "" #: ../../library/os.rst:186 msgid "" @@ -481,17 +546,6 @@ msgid "" "like to use a different encoding." msgstr "" -#: ../../library/os.rst:322 ../../library/os.rst:1009 ../../library/os.rst:1094 -#: ../../library/os.rst:1105 ../../library/os.rst:1118 -#: ../../library/os.rst:1379 ../../library/os.rst:1703 -#: ../../library/os.rst:1864 ../../library/os.rst:2271 -#: ../../library/os.rst:2614 ../../library/os.rst:3456 -#: ../../library/os.rst:3493 ../../library/os.rst:4322 -#: ../../library/os.rst:4871 ../../library/os.rst:4882 -#: ../../library/os.rst:4999 -msgid ":ref:`Availability `: Unix, Windows." -msgstr ":ref:`適用 `:Unix、Windows。" - #: ../../library/os.rst:327 msgid "" "Return the value of the environment variable *key* as bytes if it exists, or " @@ -507,24 +561,6 @@ msgid "" "``True``." msgstr "" -#: ../../library/os.rst:337 ../../library/os.rst:376 ../../library/os.rst:533 -#: ../../library/os.rst:792 ../../library/os.rst:1027 ../../library/os.rst:1038 -#: ../../library/os.rst:1061 ../../library/os.rst:1082 -#: ../../library/os.rst:1160 ../../library/os.rst:1172 -#: ../../library/os.rst:1403 ../../library/os.rst:1418 -#: ../../library/os.rst:1433 ../../library/os.rst:1446 -#: ../../library/os.rst:1547 ../../library/os.rst:1762 -#: ../../library/os.rst:1789 ../../library/os.rst:1837 -#: ../../library/os.rst:2164 ../../library/os.rst:2195 -#: ../../library/os.rst:2255 ../../library/os.rst:2580 -#: ../../library/os.rst:2592 ../../library/os.rst:3322 -#: ../../library/os.rst:3479 ../../library/os.rst:3712 -#: ../../library/os.rst:5496 ../../library/os.rst:5505 -#: ../../library/os.rst:5529 ../../library/os.rst:5556 -#: ../../library/os.rst:5565 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" - #: ../../library/os.rst:344 msgid "" "Returns the list of directories that will be searched for a named " @@ -593,10 +629,6 @@ msgid "" "getpwuid(os.getuid())[0]`` to get the login name of the current real user id." msgstr "" -#: ../../library/os.rst:426 ../../library/os.rst:462 -msgid ":ref:`Availability `: Unix, Windows, not WASI." -msgstr ":ref:`適用 `:Unix、Windows、非 WASI。" - #: ../../library/os.rst:431 msgid "" "Return the process group id of the process with process id *pid*. If *pid* " @@ -638,10 +670,6 @@ msgid "" "Parameters for the :func:`getpriority` and :func:`setpriority` functions." msgstr "" -#: ../../library/os.rst:503 -msgid ":ref:`Availability `: macOS" -msgstr ":ref:`適用 `:macOS" - #: ../../library/os.rst:509 msgid "" "Return a tuple (ruid, euid, suid) denoting the current process's real, " @@ -665,13 +693,6 @@ msgid "" "group id." msgstr "" -#: ../../library/os.rst:545 ../../library/os.rst:579 ../../library/os.rst:586 -#: ../../library/os.rst:593 ../../library/os.rst:687 ../../library/os.rst:694 -#: ../../library/os.rst:703 ../../library/os.rst:712 ../../library/os.rst:735 -#: ../../library/os.rst:2181 -msgid ":ref:`Availability `: Unix, not WASI, not Android." -msgstr ":ref:`適用 `:Unix、非 WASI、非 Android。" - #: ../../library/os.rst:554 msgid "" "Set the environment variable named *key* to the string *value*. Such " @@ -783,10 +804,6 @@ msgstr "" "os.setns(fd, os.CLONE_NEWNET)\n" "os.close(fd)" -#: ../../library/os.rst:639 -msgid ":ref:`Availability `: Linux >= 3.0 with glibc >= 2.14." -msgstr ":ref:`適用 `:Linux 3.0 以上且具有 glibc 2.14 以上。" - #: ../../library/os.rst:645 msgid "The :func:`~os.unshare` function." msgstr ":func:`~os.unshare` 函式。" @@ -958,10 +975,6 @@ msgid "" "are made to the calling process's execution context." msgstr "" -#: ../../library/os.rst:831 -msgid ":ref:`Availability `: Linux >= 2.6.16." -msgstr ":ref:`適用 `:Linux 2.6.16 以上。" - #: ../../library/os.rst:837 msgid "The :func:`~os.setns` function." msgstr ":func:`~os.setns` 函式。" @@ -1095,10 +1108,6 @@ msgid "" "known Linux kernel issue." msgstr "" -#: ../../library/os.rst:953 -msgid ":ref:`Availability `: Linux >= 4.5 with glibc >= 2.27." -msgstr ":ref:`適用 `:Linux 4.5 以上且具有 glibc 2.27 以上。" - #: ../../library/os.rst:960 msgid "" "Return a string describing the encoding of the device associated with *fd* " @@ -1127,10 +1136,6 @@ msgid "" "stderr), the new file descriptor is :ref:`inheritable `." msgstr "" -#: ../../library/os.rst:979 ../../library/os.rst:992 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" - #: ../../library/os.rst:981 ../../library/os.rst:1266 msgid "The new file descriptor is now non-inheritable." msgstr "" @@ -1446,10 +1451,6 @@ msgstr "" msgid "These operations only make sense for filesystems that support them." msgstr "" -#: ../../library/os.rst:1244 -msgid ":ref:`Availability `: Linux >= 3.1, macOS, Unix" -msgstr ":ref:`適用 `:Linux 3.1 以上、macOS、Unix。" - #: ../../library/os.rst:1251 msgid "" "Open the file *path* and set various flags according to *flags* and possibly " @@ -1689,14 +1690,6 @@ msgstr "" msgid "Combine the functionality of :func:`os.readv` and :func:`os.pread`." msgstr "" -#: ../../library/os.rst:1489 ../../library/os.rst:1574 -msgid "" -":ref:`Availability `: Linux >= 2.6.30, FreeBSD >= 6.0, OpenBSD " -">= 2.7, AIX >= 7.1." -msgstr "" -":ref:`適用 `:Linux 2.6.30 以上、FreeBSD 6.0 以上、OpenBSD 2.7 " -"以上、AIX 7.1 以上。" - #: ../../library/os.rst:1491 ../../library/os.rst:1576 msgid "Using flags requires Linux >= 4.6." msgstr "" @@ -1715,10 +1708,6 @@ msgid "" "EAGAIN`." msgstr "" -#: ../../library/os.rst:1506 -msgid ":ref:`Availability `: Linux >= 4.14." -msgstr ":ref:`適用 `:Linux 4.14 以上。" - #: ../../library/os.rst:1513 msgid "" "High priority read/write. Allows block-based filesystems to use polling of " @@ -1731,10 +1720,6 @@ msgid "" "using the :data:`O_DIRECT` flag." msgstr "" -#: ../../library/os.rst:1520 -msgid ":ref:`Availability `: Linux >= 4.6." -msgstr ":ref:`適用 `:Linux 4.6 以上。" - #: ../../library/os.rst:1527 msgid "" "Return the name of the slave pseudo-terminal device associated with the " @@ -1794,10 +1779,6 @@ msgid "" "This flag effect applies only to the data range written by the system call." msgstr "" -#: ../../library/os.rst:1586 ../../library/os.rst:1596 -msgid ":ref:`Availability `: Linux >= 4.7." -msgstr ":ref:`適用 `:Linux 4.7 以上。" - #: ../../library/os.rst:1593 msgid "" "Provide a per-write equivalent of the :data:`O_SYNC` :func:`os.open` flag. " @@ -1814,10 +1795,6 @@ msgid "" "*offset* is updated." msgstr "" -#: ../../library/os.rst:1610 -msgid ":ref:`Availability `: Linux >= 4.16." -msgstr ":ref:`適用 `:Linux 4.16 以上。" - #: ../../library/os.rst:1617 msgid "Read at most *n* bytes from file descriptor *fd*." msgstr "" @@ -1938,10 +1915,6 @@ msgid "" "the pipe." msgstr "" -#: ../../library/os.rst:1738 -msgid ":ref:`Availability `: Linux >= 2.6.17 with glibc >= 2.5" -msgstr ":ref:`適用 `:Linux 2.6.17 以上且具有 glibc 2.5 以上" - #: ../../library/os.rst:1751 msgid "" "Read from a file descriptor *fd* into a number of mutable :term:`bytes-like " @@ -2092,12 +2065,6 @@ msgstr "" msgid "Get the \"inheritable\" flag of the specified handle (a boolean)." msgstr "" -#: ../../library/os.rst:1915 ../../library/os.rst:1921 -#: ../../library/os.rst:4218 ../../library/os.rst:4894 -#: ../../library/os.rst:4939 -msgid ":ref:`Availability `: Windows." -msgstr ":ref:`適用 `:Windows。" - #: ../../library/os.rst:1919 msgid "Set the \"inheritable\" flag of the specified handle." msgstr "" @@ -2533,14 +2500,6 @@ msgid "" "changing the mode of symbolic links is supported." msgstr "" -#: ../../library/os.rst:2239 -msgid "" -":ref:`Availability `: Unix, Windows, not Linux, FreeBSD >= " -"1.3, NetBSD >= 1.3, not OpenBSD" -msgstr "" -":ref:`適用 `:Unix、Windows、非 Linux、FreeBSD 1.3 以上、" -"NetBSD 1.3 以上、非 OpenBSD。" - #: ../../library/os.rst:2249 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. " @@ -2650,11 +2609,6 @@ msgid "" "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.listdrives``。" -#: ../../library/os.rst:2334 ../../library/os.rst:2358 -#: ../../library/os.rst:2378 -msgid ":ref:`Availability `: Windows" -msgstr ":ref:`適用 `:Windows。" - #: ../../library/os.rst:2341 msgid "" "Return a list containing the mount points for a volume on a Windows system." @@ -4276,18 +4230,10 @@ msgid "" "side effects." msgstr "" -#: ../../library/os.rst:3737 -msgid ":ref:`Availability `: Linux >= 3.17 with glibc >= 2.27." -msgstr ":ref:`適用 `:Linux 3.17 以上且具有 glibc 2.27 以上。" - #: ../../library/os.rst:3760 msgid "These flags can be passed to :func:`memfd_create`." msgstr "這些旗標可以傳給 :func:`memfd_create`。" -#: ../../library/os.rst:3762 -msgid ":ref:`Availability `: Linux >= 3.17 with glibc >= 2.27" -msgstr ":ref:`適用 `:Linux 3.17 以上且具有 glibc 2.27 以上" - #: ../../library/os.rst:3764 msgid "The ``MFD_HUGE*`` flags are only available since Linux 4.14." msgstr "``MFD_HUGE*`` 旗標僅在 Linux 4.14 以上可用。" @@ -4359,25 +4305,12 @@ msgid "" " os.close(fd)" msgstr "" -#: ../../library/os.rst:3816 ../../library/os.rst:3932 -#: ../../library/os.rst:3995 ../../library/os.rst:4005 -#: ../../library/os.rst:4023 ../../library/os.rst:4032 -#: ../../library/os.rst:4042 ../../library/os.rst:4052 -#: ../../library/os.rst:4062 ../../library/os.rst:4073 -msgid ":ref:`Availability `: Linux >= 2.6.27 with glibc >= 2.8" -msgstr ":ref:`適用 `:Linux 2.6.27 以上且具有 glibc 2.8 以上" - #: ../../library/os.rst:3822 msgid "" "Read value from an :func:`eventfd` file descriptor and return a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3825 ../../library/os.rst:3834 -#: ../../library/os.rst:3842 ../../library/os.rst:3851 -msgid ":ref:`Availability `: Linux >= 2.6.27" -msgstr ":ref:`適用 `:Linux 2.6.27 以上" - #: ../../library/os.rst:3831 msgid "" "Add value to an :func:`eventfd` file descriptor. *value* must be a 64 bit " @@ -4399,10 +4332,6 @@ msgid "" "descriptor. On read the internal counter is decremented by one." msgstr "" -#: ../../library/os.rst:3860 -msgid ":ref:`Availability `: Linux >= 2.6.30" -msgstr ":ref:`適用 `:Linux 2.6.30 以上" - #: ../../library/os.rst:3868 msgid "Timer File Descriptors" msgstr "" @@ -4649,7 +4578,7 @@ msgstr "" #: ../../library/os.rst:4021 msgid ":manpage:`timerfd_gettime(2)`" -msgstr "" +msgstr ":manpage:`timerfd_gettime(2)`" #: ../../library/os.rst:4030 msgid "Similar to :func:`timerfd_gettime`, but return time as nanoseconds." @@ -4932,15 +4861,6 @@ msgstr "" "引發一個附帶引數 ``path``、``args``、``env`` 的\\ :ref:`稽核事件 ` " "``os.exec``。" -#: ../../library/os.rst:4287 ../../library/os.rst:4852 -#: ../../library/os.rst:4976 ../../library/os.rst:5095 -#: ../../library/os.rst:5264 -msgid "" -":ref:`Availability `: Unix, Windows, not WASI, not Android, " -"not iOS." -msgstr "" -":ref:`適用 `:Unix、Windows、非 WASI、非 Android、非 iOS。" - #: ../../library/os.rst:4289 msgid "" "Added support for specifying *path* as an open file descriptor for :func:" @@ -5124,11 +5044,6 @@ msgid "" "this longstanding platform compatibility problem to developers." msgstr "" -#: ../../library/os.rst:4490 ../../library/os.rst:4750 -msgid "" -":ref:`Availability `: POSIX, not WASI, not Android, not iOS." -msgstr ":ref:`適用 `:POSIX、非 WASI、非 Android、非 iOS。" - #: ../../library/os.rst:4495 msgid "" "Fork a child process, using a new pseudo-terminal as the child's controlling " @@ -5156,22 +5071,6 @@ msgid "" "fork`." msgstr "" -#: ../../library/os.rst:4517 ../../library/os.rst:4734 -#: ../../library/os.rst:4783 ../../library/os.rst:5020 -#: ../../library/os.rst:5054 ../../library/os.rst:5115 -#: ../../library/os.rst:5129 ../../library/os.rst:5146 -#: ../../library/os.rst:5161 ../../library/os.rst:5172 -#: ../../library/os.rst:5184 ../../library/os.rst:5197 -#: ../../library/os.rst:5206 ../../library/os.rst:5216 -#: ../../library/os.rst:5229 ../../library/os.rst:5280 -#: ../../library/os.rst:5291 ../../library/os.rst:5303 -#: ../../library/os.rst:5310 ../../library/os.rst:5319 -#: ../../library/os.rst:5328 ../../library/os.rst:5337 -#: ../../library/os.rst:5346 -msgid "" -":ref:`Availability `: Unix, not WASI, not Android, not iOS." -msgstr ":ref:`適用 `:Unix、非 WASI、非 Android、非 iOS。" - #: ../../library/os.rst:4526 msgid "" "Send signal *sig* to the process *pid*. Constants for the specific signals " @@ -5201,10 +5100,6 @@ msgstr "" "引發一個附帶引數 ``pid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." "kill``。" -#: ../../library/os.rst:4541 -msgid ":ref:`Availability `: Unix, Windows, not WASI, not iOS." -msgstr ":ref:`適用 `:Unix、Windows、非 WASI、非 iOS" - #: ../../library/os.rst:4553 msgid "Send the signal *sig* to the process group *pgid*." msgstr "" @@ -5217,10 +5112,6 @@ msgstr "" "引發一個附帶引數 ``pgid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." "killpg``。" -#: ../../library/os.rst:4557 ../../library/os.rst:4594 -msgid ":ref:`Availability `: Unix, not WASI, not iOS." -msgstr ":ref:`適用 `:Unix、非 WASI、非 iOS。" - #: ../../library/os.rst:4562 msgid "" "Add *increment* to the process's \"niceness\". Return the new niceness." @@ -5237,14 +5128,6 @@ msgstr "" msgid "See the :manpage:`pidfd_open(2)` man page for more details." msgstr "更多細節請見 :manpage:`pidfd_open(2)` 手冊頁。" -#: ../../library/os.rst:4575 -msgid "" -":ref:`Availability `: Linux >= 5.3, Android >= :func:`build-" -"time ` API level 31" -msgstr "" -":ref:`適用 `:Linux 5.3 Android 6.0 以上、Android :func:`build-" -"time ` API level 31 以上" - #: ../../library/os.rst:4580 msgid "" "This flag indicates that the file descriptor will be non-blocking. If the " @@ -5253,10 +5136,6 @@ msgid "" "immediately return the error :const:`~errno.EAGAIN` rather than blocking." msgstr "" -#: ../../library/os.rst:4585 -msgid ":ref:`Availability `: Linux >= 5.10" -msgstr ":ref:`適用 `:Linux 5.10 以上" - #: ../../library/os.rst:4591 msgid "" "Lock program segments into memory. The value of *op* (defined in ```: not WASI, not Android, not iOS." -msgstr ":ref:`適用 `:非 WASI、非 Android、非 iOS。" - #: ../../library/os.rst:4629 msgid "" "The :ref:`Python UTF-8 Mode ` affects encodings used for *cmd* " @@ -6546,10 +6421,6 @@ msgid "" "pages/man2/getrandom.2.html>`_." msgstr "" -#: ../../library/os.rst:5688 -msgid ":ref:`Availability `: Linux >= 3.17." -msgstr ":ref:`適用 `:Linux 3.17 以上。" - #: ../../library/os.rst:5694 msgid "" "Return a bytestring of *size* random bytes suitable for cryptographic use." @@ -6775,18 +6646,3 @@ msgstr "path separator (POSIX)(路徑分隔器 (POSIX))" #: ../../library/os.rst:5619 msgid "; (semicolon)" msgstr "; (分號)" - -#~ msgid ":ref:`Availability `: Linux >= 5.3" -#~ msgstr ":ref:`適用 `:Linux 5.3 以上" - -#~ msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." -#~ msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" - -#~ msgid ":ref:`Availability `: Unix, not Emscripten." -#~ msgstr ":ref:`適用 `:Unix、非 Emscripten。" - -#~ msgid ":ref:`Availability `: Unix, Windows, not Emscripten." -#~ msgstr ":ref:`適用 `:Unix、Windows、非 Emscripten。" - -#~ msgid ":ref:`Availability `: not Emscripten, not WASI." -#~ msgstr ":ref:`適用 `:非 Emscripten、非 WASI。" diff --git a/library/pkgutil.po b/library/pkgutil.po index c8a23bee35..31147bebcb 100644 --- a/library/pkgutil.po +++ b/library/pkgutil.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-10-10 00:13+0000\n" "PO-Revision-Date: 2024-03-08 16:07+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -55,15 +55,15 @@ msgstr "" #: ../../library/pkgutil.rst:28 msgid "" "For each directory on :data:`sys.path` that has a subdirectory that matches " -"the package name, add the subdirectory to the package's :attr:`__path__`. " -"This is useful if one wants to distribute different parts of a single " -"logical package as multiple directories." +"the package name, add the subdirectory to the package's :attr:`~module." +"__path__`. This is useful if one wants to distribute different parts of a " +"single logical package as multiple directories." msgstr "" "對於 :data:`sys.path` 上具有與套件名稱相符的子目錄的每個目錄,將該子目錄新增" -"至套件的 :attr:`__path__` 中。如果想要將單一邏輯套件的不同部分給分配到多個目" -"錄時,這會非常有用。" +"至套件的 :attr:`~module.__path__` 中。如果想要將單一邏輯套件的不同部分給分配" +"到多個目錄時,這會非常有用。" -#: ../../library/pkgutil.rst:33 +#: ../../library/pkgutil.rst:34 msgid "" "It also looks for :file:`\\*.pkg` files beginning where ``*`` matches the " "*name* argument. This feature is similar to :file:`\\*.pth` files (see the :" @@ -79,7 +79,7 @@ msgstr "" "過空行和備註之外,在 :file:`\\*.pkg` 檔案中找到的所有條目都將新增到路徑中,無" "論它們是否存在於檔案系統。(這是一個功能。)" -#: ../../library/pkgutil.rst:41 +#: ../../library/pkgutil.rst:42 msgid "" "If the input path is not a list (as is the case for frozen packages) it is " "returned unchanged. The input path is not modified; an extended copy is " @@ -88,7 +88,7 @@ msgstr "" "如果輸入路徑不是串列(像是凍結套件 (frozen package) 的情況),它將原封不動地" "被回傳。輸入路徑不會被修改;而是回傳擴充後的副本。僅將項目附加到副本的尾端。" -#: ../../library/pkgutil.rst:45 +#: ../../library/pkgutil.rst:46 msgid "" "It is assumed that :data:`sys.path` is a sequence. Items of :data:`sys." "path` that are not strings referring to existing directories are ignored. " @@ -100,11 +100,11 @@ msgstr "" "存目錄的字串則將被忽略。:data:`sys.path` 上用作檔案名稱時導致錯誤的 Unicode " "項目可能會導致此函式引發例外(與 :func:`os.path.isdir` 行為一致)。" -#: ../../library/pkgutil.rst:53 +#: ../../library/pkgutil.rst:54 msgid "Retrieve a module :term:`loader` for the given *fullname*." msgstr "取得給定之 *fullname* 的模組 :term:`loader`。" -#: ../../library/pkgutil.rst:55 +#: ../../library/pkgutil.rst:56 msgid "" "This is a backwards compatibility wrapper around :func:`importlib.util." "find_spec` that converts most failures to :exc:`ImportError` and only " @@ -115,9 +115,9 @@ msgstr "" "轉換為 :exc:`ImportError` 並且僅回傳載入器而不是完整的 :class:`importlib." "machinery.ModuleSpec`。" -#: ../../library/pkgutil.rst:60 ../../library/pkgutil.rst:81 -#: ../../library/pkgutil.rst:96 ../../library/pkgutil.rst:120 -#: ../../library/pkgutil.rst:141 ../../library/pkgutil.rst:180 +#: ../../library/pkgutil.rst:61 ../../library/pkgutil.rst:82 +#: ../../library/pkgutil.rst:97 ../../library/pkgutil.rst:121 +#: ../../library/pkgutil.rst:142 ../../library/pkgutil.rst:181 msgid "" "Updated to be based directly on :mod:`importlib` rather than relying on the " "package internal :pep:`302` import emulation." @@ -125,19 +125,19 @@ msgstr "" "更新為直接基於 :mod:`importlib`,而不是依賴套件內部 :pep:`302` 的引入模擬 " "(import emulation)。" -#: ../../library/pkgutil.rst:64 ../../library/pkgutil.rst:100 +#: ../../library/pkgutil.rst:65 ../../library/pkgutil.rst:101 msgid "Updated to be based on :pep:`451`" msgstr "基於 :pep:`451` 來更新" -#: ../../library/pkgutil.rst:67 ../../library/pkgutil.rst:103 +#: ../../library/pkgutil.rst:68 ../../library/pkgutil.rst:104 msgid "Use :func:`importlib.util.find_spec` instead." msgstr "改用 :func:`importlib.util.find_spec`。" -#: ../../library/pkgutil.rst:73 +#: ../../library/pkgutil.rst:74 msgid "Retrieve a :term:`finder` for the given *path_item*." msgstr "取得給定之 *path_item* 的 :term:`finder`。" -#: ../../library/pkgutil.rst:75 +#: ../../library/pkgutil.rst:76 msgid "" "The returned finder is cached in :data:`sys.path_importer_cache` if it was " "newly created by a path hook." @@ -145,18 +145,18 @@ msgstr "" "如果回傳的尋檢器 (finder) 是由路徑勾點 (path hook) 所新建立的,則它會被快取" "在 :data:`sys.path_importer_cache` 中。" -#: ../../library/pkgutil.rst:78 +#: ../../library/pkgutil.rst:79 msgid "" "The cache (or part of it) can be cleared manually if a rescan of :data:`sys." "path_hooks` is necessary." msgstr "" "如果需要重新掃描 :data:`sys.path_hooks`,可以手動清除快取(或部分快取)。" -#: ../../library/pkgutil.rst:88 +#: ../../library/pkgutil.rst:89 msgid "Get a :term:`loader` object for *module_or_name*." msgstr "取得 *module_or_name* 的 :term:`loader` 物件。" -#: ../../library/pkgutil.rst:90 +#: ../../library/pkgutil.rst:91 msgid "" "If the module or package is accessible via the normal import mechanism, a " "wrapper around the relevant part of that machinery is returned. Returns " @@ -168,11 +168,11 @@ msgstr "" "不到或無法引入模組,則回傳 ``None``。如果指定的模組尚未被引入,則引入其包含的" "套件(如有存在)以建立套件 ``__path__``。" -#: ../../library/pkgutil.rst:109 +#: ../../library/pkgutil.rst:110 msgid "Yield :term:`finder` objects for the given module name." msgstr "yield 給定模組名稱的 :term:`finder` 物件。" -#: ../../library/pkgutil.rst:111 +#: ../../library/pkgutil.rst:112 msgid "" "If fullname contains a ``'.'``, the finders will be for the package " "containing fullname, otherwise they will be all registered top level finders " @@ -182,7 +182,7 @@ msgstr "" "會是在頂層被註冊的尋檢器(即 :data:`sys.meta_path` 和 :data:`sys.path_hooks` " "上的尋檢器)。" -#: ../../library/pkgutil.rst:115 +#: ../../library/pkgutil.rst:116 msgid "" "If the named module is in a package, that package is imported as a side " "effect of invoking this function." @@ -190,11 +190,11 @@ msgstr "" "如果指定的模組位於套件中,則作為呼叫此函式的副作用 (side effect) ,該套件會被" "引入。" -#: ../../library/pkgutil.rst:118 +#: ../../library/pkgutil.rst:119 msgid "If no module name is specified, all top level finders are produced." msgstr "如果未指定模組名稱,則會產生所有頂層尋檢器。" -#: ../../library/pkgutil.rst:127 +#: ../../library/pkgutil.rst:128 msgid "" "Yields :class:`ModuleInfo` for all submodules on *path*, or, if *path* is " "``None``, all top-level modules on :data:`sys.path`." @@ -202,17 +202,17 @@ msgstr "" "yield *path* 上所有子模組的 :class:`ModuleInfo`,或者如果 *path* 為 " "``None``,則產生 :data:`sys.path` 上的所有頂層模組。" -#: ../../library/pkgutil.rst:130 ../../library/pkgutil.rst:151 +#: ../../library/pkgutil.rst:131 ../../library/pkgutil.rst:152 msgid "" "*path* should be either ``None`` or a list of paths to look for modules in." msgstr "*path* 應該是 ``None`` 或用來尋找模組的路徑串列。" -#: ../../library/pkgutil.rst:132 ../../library/pkgutil.rst:153 +#: ../../library/pkgutil.rst:133 ../../library/pkgutil.rst:154 msgid "" "*prefix* is a string to output on the front of every module name on output." msgstr "*prefix* 是在輸出的每個模組名稱前面的輸出字串。" -#: ../../library/pkgutil.rst:136 ../../library/pkgutil.rst:175 +#: ../../library/pkgutil.rst:137 ../../library/pkgutil.rst:176 msgid "" "Only works for a :term:`finder` which defines an ``iter_modules()`` method. " "This interface is non-standard, so the module also provides implementations " @@ -223,7 +223,7 @@ msgstr "" "因此該模組還提供了 :class:`importlib.machinery.FileFinder` 和 :class:" "`zipimport.zipimporter` 的實作。" -#: ../../library/pkgutil.rst:148 +#: ../../library/pkgutil.rst:149 msgid "" "Yields :class:`ModuleInfo` for all modules recursively on *path*, or, if " "*path* is ``None``, all accessible modules." @@ -231,7 +231,7 @@ msgstr "" "為 *path* 上的所有模組遞迴 yield 出 :class:`ModuleInfo`,或如果 *path* 為 " "``None`` 則 yield 所有可存取的模組。" -#: ../../library/pkgutil.rst:155 +#: ../../library/pkgutil.rst:156 msgid "" "Note that this function must import all *packages* (*not* all modules!) on " "the given *path*, in order to access the ``__path__`` attribute to find " @@ -240,7 +240,7 @@ msgstr "" "請注意,此函式必須引入給定之 *path* 上的所有\\ *套件*\\ (*不是*\\ 所有模" "組!),以便存取 ``__path__`` 屬性來尋找子模組。" -#: ../../library/pkgutil.rst:159 +#: ../../library/pkgutil.rst:160 msgid "" "*onerror* is a function which gets called with one argument (the name of the " "package which was being imported) if any exception occurs while trying to " @@ -252,11 +252,11 @@ msgstr "" "引入之套件的名稱)來呼叫函式。如果未提供 *onerror* 函式,則會捕獲並忽略 :exc:" "`ImportError`,同時傳播所有其他例外並終止搜尋。" -#: ../../library/pkgutil.rst:165 +#: ../../library/pkgutil.rst:166 msgid "Examples::" msgstr "範例: ::" -#: ../../library/pkgutil.rst:167 +#: ../../library/pkgutil.rst:168 msgid "" "# list all modules python can access\n" "walk_packages()\n" @@ -265,11 +265,11 @@ msgid "" "walk_packages(ctypes.__path__, ctypes.__name__ + '.')" msgstr "" -#: ../../library/pkgutil.rst:187 +#: ../../library/pkgutil.rst:188 msgid "Get a resource from a package." msgstr "從套件中取得資源。" -#: ../../library/pkgutil.rst:189 +#: ../../library/pkgutil.rst:190 msgid "" "This is a wrapper for the :term:`loader` :meth:`get_data ` API. The *package* argument should be the name of " @@ -283,19 +283,19 @@ msgstr "" "*resource* 引數應為相對檔案名稱的形式,並使用 ``/`` 作為路徑分隔符號。不允許" "使用父目錄名稱 ``..``,也不允許使用根目錄名稱(以 ``/`` 開頭)。" -#: ../../library/pkgutil.rst:196 +#: ../../library/pkgutil.rst:197 msgid "" "The function returns a binary string that is the contents of the specified " "resource." msgstr "該函式回傳一個二進位字串,它是指定資源的內容。" -#: ../../library/pkgutil.rst:199 +#: ../../library/pkgutil.rst:200 msgid "" "For packages located in the filesystem, which have already been imported, " "this is the rough equivalent of::" msgstr "對於位於檔案系統中且已被引入過的套件,這大致相當於: ::" -#: ../../library/pkgutil.rst:202 +#: ../../library/pkgutil.rst:203 msgid "" "d = os.path.dirname(sys.modules[package].__file__)\n" "data = open(os.path.join(d, resource), 'rb').read()" @@ -303,7 +303,7 @@ msgstr "" "d = os.path.dirname(sys.modules[package].__file__)\n" "data = open(os.path.join(d, resource), 'rb').read()" -#: ../../library/pkgutil.rst:205 +#: ../../library/pkgutil.rst:206 msgid "" "If the package cannot be located or loaded, or it uses a :term:`loader` " "which does not support :meth:`get_data `\\ 的 :term:`loader` 不支援 :meth:`get_data " "`。" -#: ../../library/pkgutil.rst:214 +#: ../../library/pkgutil.rst:215 msgid "Resolve a name to an object." msgstr "將名稱解析為物件。" -#: ../../library/pkgutil.rst:216 +#: ../../library/pkgutil.rst:217 msgid "" "This functionality is used in numerous places in the standard library (see :" "issue:`12915`) - and equivalent functionality is also in widely used third-" @@ -329,7 +329,7 @@ msgstr "" "標準函式庫中的許多地方都使用了此功能(請參閱 :issue:`12915`),且相同功能也被" "用於擁有廣大使用者的第三方套件,如 setuptools、Django 和 Pyramid。" -#: ../../library/pkgutil.rst:220 +#: ../../library/pkgutil.rst:221 msgid "" "It is expected that *name* will be a string in one of the following formats, " "where W is shorthand for a valid Python identifier and dot stands for a " @@ -338,15 +338,15 @@ msgstr "" "*name* 預期要是以下格式之一的字串,其中 W 是有效 Python 識別字的簡寫,而點 " "(dot) 代表這些偽正規表示式 (pseudo-regex) 中的字面句點 (literal period):" -#: ../../library/pkgutil.rst:224 +#: ../../library/pkgutil.rst:225 msgid "``W(.W)*``" msgstr "``W(.W)*``" -#: ../../library/pkgutil.rst:225 +#: ../../library/pkgutil.rst:226 msgid "``W(.W)*:(W(.W)*)?``" msgstr "``W(.W)*:(W(.W)*)?``" -#: ../../library/pkgutil.rst:227 +#: ../../library/pkgutil.rst:228 msgid "" "The first form is intended for backward compatibility only. It assumes that " "some part of the dotted name is a package, and the rest is an object " @@ -360,7 +360,7 @@ msgstr "" "於無法透過檢查 (inspection) 來推斷出套件停止的位置和物件層次結構的開始位置," "因此必須使用此形式來重複嘗試引入。" -#: ../../library/pkgutil.rst:234 +#: ../../library/pkgutil.rst:235 msgid "" "In the second form, the caller makes the division point clear through the " "provision of a single colon: the dotted name to the left of the colon is a " @@ -372,21 +372,21 @@ msgstr "" "引入的套件,右側的點名稱是該套件內的物件層次結構。這種形式只需要一次引入。如" "果它以冒號結尾,則回傳一個模組物件。" -#: ../../library/pkgutil.rst:240 +#: ../../library/pkgutil.rst:241 msgid "" "The function will return an object (which might be a module), or raise one " "of the following exceptions:" msgstr "此函式會回傳一個物件(可能是一個模組),或引發以下其中一個例外:" -#: ../../library/pkgutil.rst:243 +#: ../../library/pkgutil.rst:244 msgid ":exc:`ValueError` -- if *name* isn't in a recognised format." msgstr ":exc:`ValueError` -- 如果 *name* 不是可辨識的格式。" -#: ../../library/pkgutil.rst:245 +#: ../../library/pkgutil.rst:246 msgid ":exc:`ImportError` -- if an import failed when it shouldn't have." msgstr ":exc:`ImportError` -- 如果在不應該失敗的情況下引入失敗。" -#: ../../library/pkgutil.rst:247 +#: ../../library/pkgutil.rst:248 msgid "" ":exc:`AttributeError` -- If a failure occurred when traversing the object " "hierarchy within the imported package to get to the desired object." diff --git a/library/poplib.po b/library/poplib.po index 05056d6a9f..8777e9766c 100644 --- a/library/poplib.po +++ b/library/poplib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -52,8 +52,8 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -349,19 +349,3 @@ msgstr "POP3" #: ../../library/poplib.rst:12 msgid "protocol" msgstr "protocol(協定)" - -#, fuzzy -#~ msgid "" -#~ "Raises an auditing event poplib.connect with arguments self, host, port." -#~ msgstr "" -#~ "引發一個附帶引數 ``self``、``host``、``port`` 的\\ :ref:`稽核事件 " -#~ "` ``poplib.connect``。" - -#, fuzzy -#~ msgid "" -#~ "All commands will raise an auditing event poplib.putline with arguments " -#~ "self and line, where line is the bytes about to be sent to the remote " -#~ "host." -#~ msgstr "" -#~ "引發一個附帶引數 ``self``、``line`` 的\\ :ref:`稽核事件 ` " -#~ "``poplib.putline``。其中 ``line`` 為即將傳送給遠端的位元組。" diff --git a/library/posix.po b/library/posix.po index 394ad55dc8..b80eda94d9 100644 --- a/library/posix.po +++ b/library/posix.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2023-01-24 00:05+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,8 +33,8 @@ msgstr "" "功能的存取。" #: ../../library/posix.rst:14 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" +msgid "Availability" +msgstr "" #: ../../library/posix.rst:18 msgid "" diff --git a/library/pty.po b/library/pty.po index f609bfc794..e6e9a6bb7f 100644 --- a/library/pty.po +++ b/library/pty.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2016-11-19 00:33+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,8 +33,8 @@ msgid "" msgstr "" #: ../../library/pty.rst:19 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" +msgid "Availability" +msgstr "" #: ../../library/pty.rst:21 msgid "" diff --git a/library/pwd.po b/library/pwd.po index 29507dc008..aac5275e62 100644 --- a/library/pwd.po +++ b/library/pwd.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2023-05-20 16:08+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,9 +31,8 @@ msgstr "" "此模組提供對 Unix 使用者帳戶和密碼資料庫的存取介面。它適用於所有 Unix 版本。" #: ../../library/pwd.rst:13 -#, fuzzy -msgid ":ref:`Availability `: Unix, not WASI, not iOS." -msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" +msgid "Availability" +msgstr "" #: ../../library/pwd.rst:15 msgid "" @@ -190,23 +189,3 @@ msgstr ":mod:`grp` 模組" #: ../../library/pwd.rst:71 msgid "An interface to the group database, similar to this." msgstr "群組資料庫的介面,與此模組類似。" - -#~ msgid "Module :mod:`spwd`" -#~ msgstr ":mod:`spwd` 模組" - -#~ msgid "An interface to the shadow password database, similar to this." -#~ msgstr "Shadow 密碼資料庫的介面,與此模組類似。" - -#~ msgid "module" -#~ msgstr "module(模組)" - -#~ msgid "crypt" -#~ msgstr "crypt" - -#~ msgid "" -#~ "This module does not work or is not available on WebAssembly platforms " -#~ "``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` " -#~ "for more information." -#~ msgstr "" -#~ "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上不起" -#~ "作用或無法使用。更多資訊請參閱 :ref:`wasm-availability`。" diff --git a/library/readline.po b/library/readline.po index 40b729b026..a9c7721341 100644 --- a/library/readline.po +++ b/library/readline.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -44,8 +44,8 @@ msgid "" msgstr "" #: ../../includes/wasm-mobile-notavail.rst:3 -msgid ":ref:`Availability `: not Android, not iOS, not WASI." -msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-mobile-notavail.rst:5 msgid "" diff --git a/library/resource.po b/library/resource.po index f1f4e4a90c..52adbd9db0 100644 --- a/library/resource.po +++ b/library/resource.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,10 +27,14 @@ msgid "" "resources utilized by a program." msgstr "" -#: ../../library/resource.rst:16 -#, fuzzy -msgid ":ref:`Availability `: Unix, not WASI." -msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" +#: ../../library/resource.rst:16 ../../library/resource.rst:104 +#: ../../library/resource.rst:180 ../../library/resource.rst:192 +#: ../../library/resource.rst:201 ../../library/resource.rst:210 +#: ../../library/resource.rst:220 ../../library/resource.rst:229 +#: ../../library/resource.rst:239 ../../library/resource.rst:252 +#: ../../library/resource.rst:260 ../../library/resource.rst:268 +msgid "Availability" +msgstr "" #: ../../library/resource.rst:18 msgid "" @@ -153,10 +157,6 @@ msgstr "" "引發一個附帶引數 ``pid``、``resource``、``limits`` 的\\ :ref:`稽核事件 " "` ``resource.prlimit``。" -#: ../../library/resource.rst:104 -msgid ":ref:`Availability `: Linux >= 2.6.36 with glibc >= 2.13." -msgstr ":ref:`適用 `:Linux 2.6.36 以上且具有 glibc 2.13 以上。" - #: ../../library/resource.rst:109 msgid "" "These symbols define resources whose consumption can be controlled using " @@ -227,10 +227,6 @@ msgstr "" msgid "The largest area of mapped memory which the process may occupy." msgstr "" -#: ../../library/resource.rst:180 ../../library/resource.rst:268 -msgid ":ref:`Availability `: FreeBSD >= 11." -msgstr ":ref:`適用 `:FreeBSD 11 以上。" - #: ../../library/resource.rst:185 msgid "" "The maximum area (in bytes) of address space which may be taken by the " @@ -241,18 +237,10 @@ msgstr "" msgid "The number of bytes that can be allocated for POSIX message queues." msgstr "" -#: ../../library/resource.rst:192 ../../library/resource.rst:229 -msgid ":ref:`Availability `: Linux >= 2.6.8." -msgstr ":ref:`適用 `:Linux 2.6.8 以上。" - #: ../../library/resource.rst:199 msgid "The ceiling for the process's nice level (calculated as 20 - rlim_cur)." msgstr "" -#: ../../library/resource.rst:201 ../../library/resource.rst:210 -msgid ":ref:`Availability `: Linux >= 2.6.12." -msgstr ":ref:`適用 `:Linux 2.6.12 以上。" - #: ../../library/resource.rst:208 msgid "The ceiling of the real-time priority." msgstr "" @@ -263,10 +251,6 @@ msgid "" "real-time scheduling without making a blocking syscall." msgstr "" -#: ../../library/resource.rst:220 -msgid ":ref:`Availability `: Linux >= 2.6.25." -msgstr ":ref:`適用 `:Linux 2.6.25 以上。" - #: ../../library/resource.rst:227 msgid "The number of signals which the process may queue." msgstr "" @@ -278,11 +262,6 @@ msgid "" "this user may hold at any time." msgstr "" -#: ../../library/resource.rst:239 ../../library/resource.rst:252 -#: ../../library/resource.rst:260 -msgid ":ref:`Availability `: FreeBSD." -msgstr ":ref:`適用 `:FreeBSD。" - #: ../../library/resource.rst:245 msgid "" "The maximum size (in bytes) of the swap space that may be reserved or used " @@ -607,11 +586,3 @@ msgid "" "Pass to :func:`getrusage` to request resources consumed by the current " "thread. May not be available on all systems." msgstr "" - -#~ msgid "" -#~ "This module does not work or is not available on WebAssembly platforms " -#~ "``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` " -#~ "for more information." -#~ msgstr "" -#~ "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法" -#~ "作用或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/select.po b/library/select.po index 17c60cfe83..e5c6383d40 100644 --- a/library/select.po +++ b/library/select.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,9 +41,9 @@ msgid "" "precise control over the OS-level primitives used." msgstr "" -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +#: ../../library/select.rst:177 ../../includes/wasm-notavail.rst:3 +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -237,10 +237,6 @@ msgstr "" msgid "This value is guaranteed by POSIX to be at least 512." msgstr "" -#: ../../library/select.rst:177 -msgid ":ref:`Availability `: Unix" -msgstr ":ref:`適用 `:Unix。" - #: ../../library/select.rst:185 msgid "``/dev/poll`` Polling Objects" msgstr "" diff --git a/library/selectors.po b/library/selectors.po index bf3bb5b888..8ba4c1202d 100644 --- a/library/selectors.po +++ b/library/selectors.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -70,8 +70,8 @@ msgid "Low-level I/O multiplexing module." msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" diff --git a/library/shutil.po b/library/shutil.po index 6eab863585..496e83ef0e 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-26 00:13+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -541,9 +541,9 @@ msgstr "" msgid "On Windows, *path* can now be a file or directory." msgstr "" -#: ../../library/shutil.rst:422 -msgid ":ref:`Availability `: Unix, Windows." -msgstr ":ref:`適用 `:Unix、Windows。" +#: ../../library/shutil.rst:422 ../../library/shutil.rst:436 +msgid "Availability" +msgstr "" #: ../../library/shutil.rst:427 msgid "Change owner *user* and/or *group* of the given *path*." @@ -567,10 +567,6 @@ msgstr "" "引發一個附帶引數 ``path``、``user``、``group`` 的\\ :ref:`稽核事件 " "` ``shutil.chown``。" -#: ../../library/shutil.rst:436 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" - #: ../../library/shutil.rst:440 #, fuzzy msgid "Added *dir_fd* and *follow_symlinks* parameters." diff --git a/library/signal.po b/library/signal.po index f177d710de..ca7802204d 100644 --- a/library/signal.po +++ b/library/signal.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -152,18 +152,21 @@ msgid "" msgstr "" #: ../../library/signal.rst:103 ../../library/signal.rst:136 -#: ../../library/signal.rst:148 ../../library/signal.rst:154 +#: ../../library/signal.rst:142 ../../library/signal.rst:148 +#: ../../library/signal.rst:154 ../../library/signal.rst:160 #: ../../library/signal.rst:166 ../../library/signal.rst:180 #: ../../library/signal.rst:198 ../../library/signal.rst:206 -#: ../../library/signal.rst:232 ../../library/signal.rst:238 -#: ../../library/signal.rst:244 ../../library/signal.rst:351 -#: ../../library/signal.rst:390 ../../library/signal.rst:437 +#: ../../library/signal.rst:217 ../../library/signal.rst:232 +#: ../../library/signal.rst:238 ../../library/signal.rst:244 +#: ../../library/signal.rst:262 ../../library/signal.rst:272 +#: ../../library/signal.rst:351 ../../library/signal.rst:390 +#: ../../library/signal.rst:414 ../../library/signal.rst:437 #: ../../library/signal.rst:471 ../../library/signal.rst:501 #: ../../library/signal.rst:508 ../../library/signal.rst:561 #: ../../library/signal.rst:603 ../../library/signal.rst:618 #: ../../library/signal.rst:644 ../../library/signal.rst:664 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" +msgid "Availability" +msgstr "" #: ../../library/signal.rst:105 ../../library/signal.rst:473 msgid "" @@ -203,11 +206,6 @@ msgstr "" msgid "Interrupt from keyboard (CTRL + BREAK)." msgstr "" -#: ../../library/signal.rst:142 ../../library/signal.rst:262 -#: ../../library/signal.rst:272 -msgid ":ref:`Availability `: Windows." -msgstr ":ref:`適用 `:Windows。" - #: ../../library/signal.rst:146 msgid "Bus error (bad memory access)." msgstr "" @@ -220,10 +218,6 @@ msgstr "" msgid "Alias to :data:`SIGCHLD`." msgstr ":data:`SIGCHLD` 的別名。" -#: ../../library/signal.rst:160 -msgid ":ref:`Availability `: not macOS." -msgstr ":ref:`適用 `:非 macOS。" - #: ../../library/signal.rst:164 msgid "Continue the process if it is currently stopped" msgstr "" @@ -281,10 +275,6 @@ msgid "" "can only be raised in user space." msgstr "" -#: ../../library/signal.rst:217 -msgid ":ref:`Availability `: Linux." -msgstr ":ref:`適用 `:Linux。" - #: ../../library/signal.rst:219 msgid "" "On architectures where the signal is available. See the man page :manpage:" @@ -468,12 +458,6 @@ msgstr "" msgid "See the :manpage:`pidfd_send_signal(2)` man page for more information." msgstr "更多資訊請見 :manpage:`pidfd_send_signal(2)` 手冊頁。" -#: ../../library/signal.rst:414 -msgid "" -":ref:`Availability `: Linux >= 5.1, Android >= :func:`build-" -"time ` API level 31" -msgstr "" - #: ../../library/signal.rst:420 msgid "" "Send the signal *signalnum* to the thread *thread_id*, another thread in the " @@ -952,6 +936,3 @@ msgid "" "serve_forever(httpd)\n" "print(\"Shutdown...\")" msgstr "" - -#~ msgid ":ref:`Availability `: Linux >= 5.1" -#~ msgstr ":ref:`適用 `:Linux 5.1 以上" diff --git a/library/smtplib.po b/library/smtplib.po index b3e25996f0..5e46fd820e 100644 --- a/library/smtplib.po +++ b/library/smtplib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,8 +35,8 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" diff --git a/library/socket.po b/library/socket.po index 9d99c82d2a..16a36ca0b5 100644 --- a/library/socket.po +++ b/library/socket.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -38,17 +38,37 @@ msgid "" "operating system socket APIs." msgstr "" -#: ../../library/socket.rst:709 ../../library/socket.rst:994 -#: ../../library/socket.rst:1010 ../../library/socket.rst:1023 -#: ../../library/socket.rst:1038 ../../library/socket.rst:1055 -#: ../../library/socket.rst:1066 ../../library/socket.rst:1077 -#: ../../library/socket.rst:1088 ../../library/socket.rst:1412 -#: ../../library/socket.rst:1459 ../../library/socket.rst:1473 -#: ../../library/socket.rst:1493 ../../library/socket.rst:1540 -#: ../../library/socket.rst:1585 ../../library/socket.rst:1969 -#: ../../library/socket.rst:1979 ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +#: ../../library/socket.rst:171 ../../library/socket.rst:181 +#: ../../library/socket.rst:209 ../../library/socket.rst:216 +#: ../../library/socket.rst:233 ../../library/socket.rst:383 +#: ../../library/socket.rst:461 ../../library/socket.rst:475 +#: ../../library/socket.rst:490 ../../library/socket.rst:501 +#: ../../library/socket.rst:510 ../../library/socket.rst:519 +#: ../../library/socket.rst:530 ../../library/socket.rst:542 +#: ../../library/socket.rst:553 ../../library/socket.rst:566 +#: ../../library/socket.rst:594 ../../library/socket.rst:606 +#: ../../library/socket.rst:612 ../../library/socket.rst:643 +#: ../../library/socket.rst:658 ../../library/socket.rst:667 +#: ../../library/socket.rst:684 ../../library/socket.rst:699 +#: ../../library/socket.rst:709 ../../library/socket.rst:898 +#: ../../library/socket.rst:994 ../../library/socket.rst:1010 +#: ../../library/socket.rst:1023 ../../library/socket.rst:1038 +#: ../../library/socket.rst:1055 ../../library/socket.rst:1066 +#: ../../library/socket.rst:1077 ../../library/socket.rst:1088 +#: ../../library/socket.rst:1177 ../../library/socket.rst:1197 +#: ../../library/socket.rst:1223 ../../library/socket.rst:1246 +#: ../../library/socket.rst:1275 ../../library/socket.rst:1286 +#: ../../library/socket.rst:1313 ../../library/socket.rst:1330 +#: ../../library/socket.rst:1347 ../../library/socket.rst:1361 +#: ../../library/socket.rst:1412 ../../library/socket.rst:1459 +#: ../../library/socket.rst:1473 ../../library/socket.rst:1493 +#: ../../library/socket.rst:1540 ../../library/socket.rst:1585 +#: ../../library/socket.rst:1715 ../../library/socket.rst:1759 +#: ../../library/socket.rst:1867 ../../library/socket.rst:1885 +#: ../../library/socket.rst:1969 ../../library/socket.rst:1979 +#: ../../library/socket.rst:1991 ../../includes/wasm-notavail.rst:3 +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -294,11 +314,6 @@ msgstr "" msgid "*feat* and *mask* are unsigned 32bit integers." msgstr "" -#: ../../library/socket.rst:171 ../../library/socket.rst:594 -#: ../../library/socket.rst:1885 -msgid ":ref:`Availability `: Linux >= 2.6.38." -msgstr ":ref:`適用 `:Linux >= 2.6.38。" - #: ../../library/socket.rst:173 msgid "Some algorithm types require more recent Kernels." msgstr "" @@ -310,10 +325,6 @@ msgid "" "context ID or CID and port are integers." msgstr "" -#: ../../library/socket.rst:181 ../../library/socket.rst:667 -msgid ":ref:`Availability `: Linux >= 3.9" -msgstr ":ref:`適用 `:Linux 3.9 以上。" - #: ../../library/socket.rst:183 msgid "See :manpage:`vsock(7)`" msgstr "請見 :manpage:`vsock(7)`" @@ -375,10 +386,6 @@ msgid "" "address, whose interpretation depends on the device." msgstr "" -#: ../../library/socket.rst:209 ../../library/socket.rst:542 -msgid ":ref:`Availability `: Linux >= 2.2." -msgstr ":ref:`適用 `:Linux >= 2.2。" - #: ../../library/socket.rst:211 msgid "" ":const:`AF_QIPCRTR` is a Linux-only socket based interface for communicating " @@ -387,10 +394,6 @@ msgid "" "*port* are non-negative integers." msgstr "" -#: ../../library/socket.rst:216 ../../library/socket.rst:643 -msgid ":ref:`Availability `: Linux >= 4.7." -msgstr ":ref:`適用 `:Linux >= 4.7。" - #: ../../library/socket.rst:220 msgid "" ":const:`IPPROTO_UDPLITE` is a variant of UDP which allows you to specify " @@ -409,10 +412,6 @@ msgid "" "IPPROTO_UDPLITE)`` for IPv6." msgstr "" -#: ../../library/socket.rst:233 -msgid ":ref:`Availability `: Linux >= 2.6.20, FreeBSD >= 10.1" -msgstr ":ref:`適用 `:Linux 2.6.20 以上、FreeBSD 10.1 以上。" - #: ../../library/socket.rst:237 msgid "" ":const:`AF_HYPERV` is a Windows-only socket based interface for " @@ -595,10 +594,6 @@ msgid "" "html>`_ for a more thorough explanation." msgstr "" -#: ../../library/socket.rst:383 -msgid ":ref:`Availability `: Linux >= 2.6.27." -msgstr ":ref:`適用 `:Linux >= 2.6.27。" - #: ../../library/socket.rst:404 msgid "" "Many constants of these forms, documented in the Unix documentation on " @@ -673,10 +668,6 @@ msgid "" "also defined in the socket module." msgstr "" -#: ../../library/socket.rst:461 -msgid ":ref:`Availability `: Linux >= 2.6.25, NetBSD >= 8." -msgstr ":ref:`適用 `:Linux 2.6.25 以上、NetBSD 8 以上。" - #: ../../library/socket.rst:465 msgid "NetBSD support was added." msgstr "" @@ -688,10 +679,6 @@ msgid "" "documentation, are also defined in the socket module." msgstr "" -#: ../../library/socket.rst:475 ../../library/socket.rst:510 -msgid ":ref:`Availability `: Linux >= 2.6.25." -msgstr ":ref:`適用 `:Linux >= 2.6.25。" - #: ../../library/socket.rst:478 msgid "" "The :data:`CAN_BCM_CAN_FD_FRAME` flag is only available on Linux >= 4.8." @@ -708,20 +695,12 @@ msgstr "" msgid "This constant is documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:490 -msgid ":ref:`Availability `: Linux >= 3.6." -msgstr ":ref:`適用 `:Linux >= 3.6。" - #: ../../library/socket.rst:496 msgid "" "Joins the applied CAN filters such that only CAN frames that match all given " "CAN filters are passed to user space." msgstr "" -#: ../../library/socket.rst:501 -msgid ":ref:`Availability `: Linux >= 4.1." -msgstr ":ref:`適用 `:Linux >= 4.1。" - #: ../../library/socket.rst:507 msgid "" "CAN_ISOTP, in the CAN protocol family, is the ISO-TP (ISO 15765-2) protocol. " @@ -734,20 +713,12 @@ msgid "" "constants, documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:519 -msgid ":ref:`Availability `: Linux >= 5.4." -msgstr ":ref:`適用 `:Linux >= 5.4。" - #: ../../library/socket.rst:527 msgid "" "These two constants, documented in the FreeBSD divert(4) manual page, are " "also defined in the socket module." msgstr "" -#: ../../library/socket.rst:530 -msgid ":ref:`Availability `: FreeBSD >= 14.0." -msgstr ":ref:`適用 `:FreeBSD >= 14.0。" - #: ../../library/socket.rst:547 msgid "" ":data:`!ETH_P_ALL` can be used in the :class:`~socket.socket` constructor as " @@ -759,14 +730,6 @@ msgstr "" msgid "For more information, see the :manpage:`packet(7)` manpage." msgstr "" -#: ../../library/socket.rst:553 -msgid ":ref:`Availability `: Linux." -msgstr ":ref:`適用 `:Linux。" - -#: ../../library/socket.rst:566 -msgid ":ref:`Availability `: Linux >= 2.6.30." -msgstr ":ref:`適用 `:Linux >= 2.6.30。" - #: ../../library/socket.rst:576 msgid "" "Constants for Windows' WSAIoctl(). The constants are used as arguments to " @@ -791,14 +754,6 @@ msgstr "" msgid "Constants for Linux host/guest communication." msgstr "" -#: ../../library/socket.rst:606 -msgid ":ref:`Availability `: Linux >= 4.8." -msgstr ":ref:`適用 `:Linux >= 4.8。" - -#: ../../library/socket.rst:612 -msgid ":ref:`Availability `: BSD, macOS." -msgstr ":ref:`適用 `:BSD、macOS。" - #: ../../library/socket.rst:618 msgid "" "This constant contains a boolean value which indicates if IPv6 is supported " @@ -834,10 +789,6 @@ msgid "" "message type." msgstr "" -#: ../../library/socket.rst:658 -msgid ":ref:`Availability `: FreeBSD." -msgstr ":ref:`適用 `:FreeBSD。" - #: ../../library/socket.rst:662 msgid "" "Constant to optimize CPU locality, to be used in conjunction with :data:" @@ -848,21 +799,12 @@ msgstr "" msgid "Constants for Windows Hyper-V sockets for host/guest communications." msgstr "" -#: ../../library/socket.rst:684 ../../library/socket.rst:898 -#: ../../library/socket.rst:1991 -msgid ":ref:`Availability `: Windows." -msgstr ":ref:`適用 `:Windows。" - #: ../../library/socket.rst:695 msgid "" "`IEEE 802.3 protocol number `_. constants." msgstr "" -#: ../../library/socket.rst:699 -msgid ":ref:`Availability `: Linux, FreeBSD, macOS." -msgstr ":ref:`適用 `:Linux、FreeBSD、macOS。" - #: ../../library/socket.rst:707 msgid "" "These constants are used by the :meth:`~socket.socket.shutdown` method of " @@ -1455,10 +1397,6 @@ msgid "" "`inet_pton`." msgstr "" -#: ../../library/socket.rst:1177 ../../library/socket.rst:1197 -msgid ":ref:`Availability `: Unix, Windows." -msgstr ":ref:`適用 `:Unix、Windows。" - #: ../../library/socket.rst:1179 ../../library/socket.rst:1199 msgid "Windows support added" msgstr "" @@ -1491,11 +1429,6 @@ msgid "" "the permissible range of values." msgstr "" -#: ../../library/socket.rst:1223 ../../library/socket.rst:1246 -#: ../../library/socket.rst:1867 -msgid ":ref:`Availability `: Unix, not WASI." -msgstr ":ref:`適用 `:Unix、非 WASI。" - #: ../../library/socket.rst:1225 ../../library/socket.rst:1717 #: ../../library/socket.rst:1761 ../../library/socket.rst:1869 msgid "Most Unix platforms." @@ -1551,24 +1484,12 @@ msgstr "" "引發一個附帶引數 ``name`` 的\\ :ref:`稽核事件 ` ``socket." "sethostname``。" -#: ../../library/socket.rst:1275 -#, fuzzy -msgid ":ref:`Availability `: Unix, not Android." -msgstr ":ref:`適用 `:Unix、非 WASI。" - #: ../../library/socket.rst:1282 msgid "" "Return a list of network interface information (index int, name string) " "tuples. :exc:`OSError` if the system call fails." msgstr "" -#: ../../library/socket.rst:1286 ../../library/socket.rst:1313 -#: ../../library/socket.rst:1330 ../../library/socket.rst:1347 -#: ../../library/socket.rst:1361 -#, fuzzy -msgid ":ref:`Availability `: Unix, Windows, not WASI." -msgstr ":ref:`適用 `:Unix、非 WASI。" - #: ../../library/socket.rst:1290 ../../library/socket.rst:1317 #: ../../library/socket.rst:1334 msgid "Windows support was added." @@ -2017,10 +1938,6 @@ msgid "" " return msg, list(fds)" msgstr "" -#: ../../library/socket.rst:1715 ../../library/socket.rst:1759 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" - #: ../../library/socket.rst:1729 msgid "" "Receive normal data and ancillary data from the socket, behaving as :meth:" @@ -2715,14 +2632,3 @@ msgstr "module(模組)" #: ../../library/socket.rst:1951 msgid "struct" msgstr "struct" - -#~ msgid ":ref:`Availability `: not Emscripten, not WASI." -#~ msgstr ":ref:`適用 `:非 Emscripten、非 WASI。" - -#~ msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." -#~ msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" - -#~ msgid "" -#~ ":ref:`Availability `: Unix, Windows, not Emscripten, not " -#~ "WASI." -#~ msgstr ":ref:`適用 `:Unix、Windows、非 Emscripten、非 WASI。" diff --git a/library/socketserver.po b/library/socketserver.po index ac01c1ed20..4373fe8002 100644 --- a/library/socketserver.po +++ b/library/socketserver.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,8 +32,8 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" diff --git a/library/ssl.po b/library/ssl.po index 342879d494..a00c5acbd3 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2024-08-28 00:43+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -59,9 +59,10 @@ msgstr "" "在使用此模組之前,請閱讀 :ref:`ssl-security`。如果不這樣做,可能會產生錯誤的" "安全性認知,因為 ssl 模組的預設設定未必適合你的應用程式。" +#: ../../library/ssl.rst:454 ../../library/ssl.rst:469 #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -721,10 +722,6 @@ msgstr "" "[(b'data...', 'x509_asn', {'1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2'}),\n" " (b'data...', 'x509_asn', True)]" -#: ../../library/ssl.rst:454 ../../library/ssl.rst:469 -msgid ":ref:`Availability `: Windows." -msgstr ":ref:`適用 `:只有 Windows。" - #: ../../library/ssl.rst:460 msgid "" "Retrieve CRLs from Windows' system cert store. *store_name* may be one of " @@ -4145,6 +4142,3 @@ msgstr "certificates(憑證)" #: ../../library/ssl.rst:2147 msgid "X509 certificate" msgstr "X509 certificate(X509 憑證)" - -#~ msgid ":ref:`Availability `: not Emscripten, not WASI." -#~ msgstr ":ref:`適用 `: 非 Emscripten、非 WASI。" diff --git a/library/stat.po b/library/stat.po index 83b937fed9..d919c8307e 100644 --- a/library/stat.po +++ b/library/stat.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2016-11-19 00:34+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -429,7 +429,7 @@ msgid "All super-user supported flags" msgstr "" #: ../../library/stat.rst:409 ../../library/stat.rst:417 -msgid ":ref:`Availability `: macOS" +msgid "Availability" msgstr "" #: ../../library/stat.rst:415 diff --git a/library/stdtypes.po b/library/stdtypes.po index 6ba75aed17..e25ed787d8 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-10-12 00:13+0000\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -3018,9 +3018,8 @@ msgid "" msgstr "" #: ../../library/stdtypes.rst:2027 -#, fuzzy msgid "*count* is now supported as a keyword argument." -msgstr "新增關鍵字引數的支援。" +msgstr "*count* 現在作為關鍵字引數被支援。" #: ../../library/stdtypes.rst:2033 msgid "" @@ -6223,13 +6222,14 @@ msgstr "" #: ../../library/stdtypes.rst:4471 msgid "" "If no positional argument is given, an empty dictionary is created. If a " -"positional argument is given and it is a mapping object, a dictionary is " -"created with the same key-value pairs as the mapping object. Otherwise, the " -"positional argument must be an :term:`iterable` object. Each item in the " -"iterable must itself be an iterable with exactly two objects. The first " -"object of each item becomes a key in the new dictionary, and the second " -"object the corresponding value. If a key occurs more than once, the last " -"value for that key becomes the corresponding value in the new dictionary." +"positional argument is given and it defines a ``keys()`` method, a " +"dictionary is created by calling :meth:`~object.__getitem__` on the argument " +"with each returned key from the method. Otherwise, the positional argument " +"must be an :term:`iterable` object. Each item in the iterable must itself " +"be an iterable with exactly two elements. The first element of each item " +"becomes a key in the new dictionary, and the second element the " +"corresponding value. If a key occurs more than once, the last value for " +"that key becomes the corresponding value in the new dictionary." msgstr "" #: ../../library/stdtypes.rst:4481 @@ -6445,26 +6445,27 @@ msgstr "" #: ../../library/stdtypes.rst:4636 msgid "" -":meth:`update` accepts either another dictionary object or an iterable of " -"key/value pairs (as tuples or other iterables of length two). If keyword " -"arguments are specified, the dictionary is then updated with those key/value " -"pairs: ``d.update(red=1, blue=2)``." +":meth:`update` accepts either another object with a ``keys()`` method (in " +"which case :meth:`~object.__getitem__` is called with every key returned " +"from the method). or an iterable of key/value pairs (as tuples or other " +"iterables of length two). If keyword arguments are specified, the dictionary " +"is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:4643 +#: ../../library/stdtypes.rst:4644 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4646 +#: ../../library/stdtypes.rst:4647 msgid "" "An equality comparison between one ``dict.values()`` view and another will " "always return ``False``. This also applies when comparing ``dict.values()`` " "to itself::" msgstr "" -#: ../../library/stdtypes.rst:4650 +#: ../../library/stdtypes.rst:4651 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -6474,34 +6475,34 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:4656 +#: ../../library/stdtypes.rst:4657 msgid "" "Create a new dictionary with the merged keys and values of *d* and *other*, " "which must both be dictionaries. The values of *other* take priority when " "*d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4664 +#: ../../library/stdtypes.rst:4665 msgid "" "Update the dictionary *d* with keys and values from *other*, which may be " "either a :term:`mapping` or an :term:`iterable` of key/value pairs. The " "values of *other* take priority when *d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4670 +#: ../../library/stdtypes.rst:4671 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " "'>') raise :exc:`TypeError`." msgstr "" -#: ../../library/stdtypes.rst:4674 +#: ../../library/stdtypes.rst:4675 msgid "" "Dictionaries preserve insertion order. Note that updating a key does not " "affect the order. Keys added after deletion are inserted at the end. ::" msgstr "" -#: ../../library/stdtypes.rst:4677 +#: ../../library/stdtypes.rst:4678 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6533,17 +6534,17 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:4692 +#: ../../library/stdtypes.rst:4693 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:4696 +#: ../../library/stdtypes.rst:4697 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:4698 +#: ../../library/stdtypes.rst:4699 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6565,21 +6566,21 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:4708 +#: ../../library/stdtypes.rst:4709 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4713 +#: ../../library/stdtypes.rst:4714 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:4720 +#: ../../library/stdtypes.rst:4721 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:4722 +#: ../../library/stdtypes.rst:4723 msgid "" "The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" "`dict.items` are *view objects*. They provide a dynamic view on the " @@ -6587,23 +6588,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:4727 +#: ../../library/stdtypes.rst:4728 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:4732 +#: ../../library/stdtypes.rst:4733 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4736 +#: ../../library/stdtypes.rst:4737 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4739 +#: ../../library/stdtypes.rst:4740 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -6611,39 +6612,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:4744 +#: ../../library/stdtypes.rst:4745 msgid "" "Iterating views while adding or deleting entries in the dictionary may raise " "a :exc:`RuntimeError` or fail to iterate over all entries." msgstr "" -#: ../../library/stdtypes.rst:4747 +#: ../../library/stdtypes.rst:4748 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:4752 +#: ../../library/stdtypes.rst:4753 msgid "" "Return ``True`` if *x* is in the underlying dictionary's keys, values or " "items (in the latter case, *x* should be a ``(key, value)`` tuple)." msgstr "" -#: ../../library/stdtypes.rst:4757 +#: ../../library/stdtypes.rst:4758 msgid "" "Return a reverse iterator over the keys, values or items of the dictionary. " "The view will be iterated in reverse order of the insertion." msgstr "" -#: ../../library/stdtypes.rst:4760 +#: ../../library/stdtypes.rst:4761 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4765 +#: ../../library/stdtypes.rst:4766 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:4770 +#: ../../library/stdtypes.rst:4771 msgid "" "Keys views are set-like since their entries are unique and :term:`hashable`. " "Items views also have set-like operations since the (key, value) pairs are " @@ -6657,11 +6658,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:4782 +#: ../../library/stdtypes.rst:4783 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:4784 +#: ../../library/stdtypes.rst:4785 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -6702,11 +6703,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:4826 +#: ../../library/stdtypes.rst:4827 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:4833 +#: ../../library/stdtypes.rst:4834 msgid "" "Python's :keyword:`with` statement supports the concept of a runtime context " "defined by a context manager. This is implemented using a pair of methods " @@ -6717,7 +6718,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:4841 +#: ../../library/stdtypes.rst:4842 msgid "" "Enter the runtime context and return either this object or another object " "related to the runtime context. The value returned by this method is bound " @@ -6728,7 +6729,7 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:4846 +#: ../../library/stdtypes.rst:4847 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to allow :func:" @@ -6737,7 +6738,7 @@ msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:4850 +#: ../../library/stdtypes.rst:4851 msgid "" "An example of a context manager that returns a related object is the one " "returned by :func:`decimal.localcontext`. These managers set the active " @@ -6751,7 +6752,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的當前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:4860 +#: ../../library/stdtypes.rst:4861 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -6763,7 +6764,7 @@ msgstr "" "keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:4865 +#: ../../library/stdtypes.rst:4866 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -6778,7 +6779,7 @@ msgstr "" "(propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體中發生" "的任何例外。" -#: ../../library/stdtypes.rst:4872 +#: ../../library/stdtypes.rst:4873 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -6790,7 +6791,7 @@ msgstr "" "已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" "`__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:4878 +#: ../../library/stdtypes.rst:4879 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -6802,7 +6803,7 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:4884 +#: ../../library/stdtypes.rst:4885 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -6817,7 +6818,7 @@ msgstr "" "`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" "理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:4891 +#: ../../library/stdtypes.rst:4892 msgid "" "Note that there is no specific slot for any of these methods in the type " "structure for Python objects in the Python/C API. Extension types wanting to " @@ -6829,7 +6830,7 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:4899 +#: ../../library/stdtypes.rst:4900 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" @@ -6837,7 +6838,7 @@ msgstr "" "型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" "ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:4904 +#: ../../library/stdtypes.rst:4905 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." @@ -6845,11 +6846,11 @@ msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:4911 +#: ../../library/stdtypes.rst:4912 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:4917 +#: ../../library/stdtypes.rst:4918 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -6864,7 +6865,7 @@ msgstr "" "物件,它是透過使用引數 :class:`int` 來下標 ``list`` 類別而建立的。" "``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使用。" -#: ../../library/stdtypes.rst:4927 +#: ../../library/stdtypes.rst:4928 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -6872,7 +6873,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:4930 +#: ../../library/stdtypes.rst:4931 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -6880,7 +6881,7 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:4933 +#: ../../library/stdtypes.rst:4934 msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " @@ -6892,7 +6893,7 @@ msgstr "" "物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" "`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:4939 +#: ../../library/stdtypes.rst:4940 msgid "" "For a class which defines :meth:`~object.__class_getitem__` but is not a " "container, the argument(s) supplied to a subscription of the class will " @@ -6904,7 +6905,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:4945 +#: ../../library/stdtypes.rst:4946 msgid "" "If ``x = re.search('foo', 'foo')``, ``x`` will be a :ref:`re.Match ` object where the return values of ``x.group(0)`` and ``x[0]`` will " @@ -6916,7 +6917,7 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:4951 +#: ../../library/stdtypes.rst:4952 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " "``y`` will also be an instance of ``re.Match``, but the return values of ``y." @@ -6929,7 +6930,7 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:4957 +#: ../../library/stdtypes.rst:4958 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " @@ -6938,7 +6939,7 @@ msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:4963 +#: ../../library/stdtypes.rst:4964 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " @@ -6948,7 +6949,7 @@ msgstr "" "所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" "class:`list`: ::" -#: ../../library/stdtypes.rst:4968 +#: ../../library/stdtypes.rst:4969 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -6956,7 +6957,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:4971 +#: ../../library/stdtypes.rst:4972 msgid "" "Another example for :term:`mapping` objects, using a :class:`dict`, which is " "a generic type expecting two type parameters representing the key type and " @@ -6967,7 +6968,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:4976 +#: ../../library/stdtypes.rst:4977 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -6975,7 +6976,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:4979 +#: ../../library/stdtypes.rst:4980 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -6983,7 +6984,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:4982 +#: ../../library/stdtypes.rst:4983 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -6995,7 +6996,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:4987 +#: ../../library/stdtypes.rst:4988 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -7007,7 +7008,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:4993 +#: ../../library/stdtypes.rst:4994 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -7017,13 +7018,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:4997 +#: ../../library/stdtypes.rst:4998 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5000 +#: ../../library/stdtypes.rst:5001 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -7041,13 +7042,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5008 +#: ../../library/stdtypes.rst:5009 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5010 +#: ../../library/stdtypes.rst:5011 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -7061,7 +7062,7 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5016 +#: ../../library/stdtypes.rst:5017 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" @@ -7069,7 +7070,7 @@ msgstr "" "為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." "__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5019 +#: ../../library/stdtypes.rst:5020 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -7081,7 +7082,7 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5024 +#: ../../library/stdtypes.rst:5025 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " @@ -7091,7 +7092,7 @@ msgstr "" "的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." "__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5028 +#: ../../library/stdtypes.rst:5029 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -7103,245 +7104,245 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5035 +#: ../../library/stdtypes.rst:5036 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5037 +#: ../../library/stdtypes.rst:5038 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5040 +#: ../../library/stdtypes.rst:5041 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5041 +#: ../../library/stdtypes.rst:5042 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5042 +#: ../../library/stdtypes.rst:5043 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5043 +#: ../../library/stdtypes.rst:5044 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5044 +#: ../../library/stdtypes.rst:5045 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5045 +#: ../../library/stdtypes.rst:5046 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5046 +#: ../../library/stdtypes.rst:5047 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5047 +#: ../../library/stdtypes.rst:5048 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5048 +#: ../../library/stdtypes.rst:5049 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5049 +#: ../../library/stdtypes.rst:5050 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5050 +#: ../../library/stdtypes.rst:5051 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5051 +#: ../../library/stdtypes.rst:5052 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5052 +#: ../../library/stdtypes.rst:5053 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5053 +#: ../../library/stdtypes.rst:5054 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5054 +#: ../../library/stdtypes.rst:5055 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5055 +#: ../../library/stdtypes.rst:5056 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5056 +#: ../../library/stdtypes.rst:5057 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5057 +#: ../../library/stdtypes.rst:5058 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5058 +#: ../../library/stdtypes.rst:5059 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5059 +#: ../../library/stdtypes.rst:5060 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5060 +#: ../../library/stdtypes.rst:5061 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5061 +#: ../../library/stdtypes.rst:5062 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5062 +#: ../../library/stdtypes.rst:5063 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5063 +#: ../../library/stdtypes.rst:5064 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5064 +#: ../../library/stdtypes.rst:5065 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5065 +#: ../../library/stdtypes.rst:5066 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5066 +#: ../../library/stdtypes.rst:5067 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5067 +#: ../../library/stdtypes.rst:5068 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5068 +#: ../../library/stdtypes.rst:5069 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5069 +#: ../../library/stdtypes.rst:5070 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5070 +#: ../../library/stdtypes.rst:5071 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5071 +#: ../../library/stdtypes.rst:5072 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5072 +#: ../../library/stdtypes.rst:5073 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5073 +#: ../../library/stdtypes.rst:5074 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5074 +#: ../../library/stdtypes.rst:5075 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5075 +#: ../../library/stdtypes.rst:5076 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5076 +#: ../../library/stdtypes.rst:5077 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5077 +#: ../../library/stdtypes.rst:5078 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5078 +#: ../../library/stdtypes.rst:5079 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5079 +#: ../../library/stdtypes.rst:5080 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5080 +#: ../../library/stdtypes.rst:5081 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5081 +#: ../../library/stdtypes.rst:5082 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5082 +#: ../../library/stdtypes.rst:5083 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5083 +#: ../../library/stdtypes.rst:5084 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5084 +#: ../../library/stdtypes.rst:5085 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5085 +#: ../../library/stdtypes.rst:5086 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5086 +#: ../../library/stdtypes.rst:5087 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5087 +#: ../../library/stdtypes.rst:5088 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5088 +#: ../../library/stdtypes.rst:5089 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5089 +#: ../../library/stdtypes.rst:5090 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5090 +#: ../../library/stdtypes.rst:5091 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5091 +#: ../../library/stdtypes.rst:5092 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5092 +#: ../../library/stdtypes.rst:5093 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5093 +#: ../../library/stdtypes.rst:5094 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5098 +#: ../../library/stdtypes.rst:5099 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5100 +#: ../../library/stdtypes.rst:5101 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5104 +#: ../../library/stdtypes.rst:5105 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5106 +#: ../../library/stdtypes.rst:5107 msgid "" ">>> list[int].__origin__\n" "" @@ -7349,7 +7350,7 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5112 +#: ../../library/stdtypes.rst:5113 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " @@ -7358,7 +7359,7 @@ msgstr "" "此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" "class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5116 +#: ../../library/stdtypes.rst:5117 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -7366,7 +7367,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5122 +#: ../../library/stdtypes.rst:5123 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -7374,7 +7375,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5125 +#: ../../library/stdtypes.rst:5126 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -7388,7 +7389,7 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5133 +#: ../../library/stdtypes.rst:5134 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." @@ -7398,7 +7399,7 @@ msgstr "" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5140 +#: ../../library/stdtypes.rst:5141 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." @@ -7406,19 +7407,19 @@ msgstr "" "如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" "`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5148 +#: ../../library/stdtypes.rst:5149 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5149 +#: ../../library/stdtypes.rst:5150 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5151 +#: ../../library/stdtypes.rst:5152 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5152 +#: ../../library/stdtypes.rst:5153 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." @@ -7427,7 +7428,7 @@ msgstr "" "引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" "`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5156 +#: ../../library/stdtypes.rst:5157 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" @@ -7435,18 +7436,18 @@ msgstr "" ":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" "`typing.Generic`" -#: ../../library/stdtypes.rst:5157 +#: ../../library/stdtypes.rst:5158 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" "有關如何實作可以在 runtime 參數化並能被靜態型別檢查器理解的泛型類別的文件。" -#: ../../library/stdtypes.rst:5166 +#: ../../library/stdtypes.rst:5167 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5172 +#: ../../library/stdtypes.rst:5173 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -7459,7 +7460,7 @@ msgstr "" "釋 (type annotation) `。與 :data:`typing.Union` 相比,聯合型別運" "算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5179 +#: ../../library/stdtypes.rst:5180 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " @@ -7470,7 +7471,7 @@ msgstr "" "``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" "class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5184 +#: ../../library/stdtypes.rst:5185 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -7478,7 +7479,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5189 +#: ../../library/stdtypes.rst:5190 msgid "" "The ``|`` operand cannot be used at runtime to define unions where one or " "more members is a forward reference. For example, ``int | \"Foo\"``, where " @@ -7491,58 +7492,58 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5197 +#: ../../library/stdtypes.rst:5198 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5199 +#: ../../library/stdtypes.rst:5200 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5201 +#: ../../library/stdtypes.rst:5202 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5203 +#: ../../library/stdtypes.rst:5204 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5205 +#: ../../library/stdtypes.rst:5206 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5207 +#: ../../library/stdtypes.rst:5208 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5209 +#: ../../library/stdtypes.rst:5210 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5211 +#: ../../library/stdtypes.rst:5212 msgid "It is compatible with :data:`typing.Union`::" msgstr "它與 :data:`typing.Union` 相容: ::" -#: ../../library/stdtypes.rst:5213 +#: ../../library/stdtypes.rst:5214 msgid "int | str == typing.Union[int, str]" msgstr "int | str == typing.Union[int, str]" -#: ../../library/stdtypes.rst:5215 +#: ../../library/stdtypes.rst:5216 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5217 +#: ../../library/stdtypes.rst:5218 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5222 +#: ../../library/stdtypes.rst:5223 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5225 +#: ../../library/stdtypes.rst:5226 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -7550,14 +7551,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5228 +#: ../../library/stdtypes.rst:5229 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5231 +#: ../../library/stdtypes.rst:5232 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -7567,7 +7568,7 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5238 +#: ../../library/stdtypes.rst:5239 msgid "" "The user-exposed type for the union object can be accessed from :data:`types." "UnionType` and used for :func:`isinstance` checks. An object cannot be " @@ -7576,7 +7577,7 @@ msgstr "" "構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`types." "UnionType` 存取並用於 :func:`isinstance` 檢查。物件不能以型別來實例化: ::" -#: ../../library/stdtypes.rst:5242 +#: ../../library/stdtypes.rst:5243 msgid "" ">>> import types\n" ">>> isinstance(int | str, types.UnionType)\n" @@ -7594,7 +7595,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'types.UnionType' instances" -#: ../../library/stdtypes.rst:5251 +#: ../../library/stdtypes.rst:5252 msgid "" "The :meth:`!__or__` method for type objects was added to support the syntax " "``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may " @@ -7603,7 +7604,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5255 +#: ../../library/stdtypes.rst:5256 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -7629,25 +7630,25 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5271 +#: ../../library/stdtypes.rst:5272 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5279 +#: ../../library/stdtypes.rst:5280 msgid "Other Built-in Types" msgstr "" -#: ../../library/stdtypes.rst:5281 +#: ../../library/stdtypes.rst:5282 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5288 +#: ../../library/stdtypes.rst:5289 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5290 +#: ../../library/stdtypes.rst:5291 msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " @@ -7658,7 +7659,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5297 +#: ../../library/stdtypes.rst:5298 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -7669,32 +7670,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:5305 +#: ../../library/stdtypes.rst:5306 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5313 +#: ../../library/stdtypes.rst:5314 msgid "Classes and Class Instances" msgstr "" -#: ../../library/stdtypes.rst:5315 +#: ../../library/stdtypes.rst:5316 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "" -#: ../../library/stdtypes.rst:5321 +#: ../../library/stdtypes.rst:5322 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5323 +#: ../../library/stdtypes.rst:5324 msgid "" "Function objects are created by function definitions. The only operation on " "a function object is to call it: ``func(argument-list)``." msgstr "" -#: ../../library/stdtypes.rst:5326 +#: ../../library/stdtypes.rst:5327 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -7702,15 +7703,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5330 +#: ../../library/stdtypes.rst:5331 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5336 +#: ../../library/stdtypes.rst:5337 msgid "Methods" msgstr "" -#: ../../library/stdtypes.rst:5340 +#: ../../library/stdtypes.rst:5341 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such as :meth:" @@ -7718,7 +7719,7 @@ msgid "" "Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5345 +#: ../../library/stdtypes.rst:5346 msgid "" "If you access a method (a function defined in a class namespace) through an " "instance, you get a special object: a :dfn:`bound method` (also called :ref:" @@ -7731,7 +7732,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5356 +#: ../../library/stdtypes.rst:5357 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -7742,7 +7743,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5364 +#: ../../library/stdtypes.rst:5365 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -7770,15 +7771,15 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5379 +#: ../../library/stdtypes.rst:5380 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5387 +#: ../../library/stdtypes.rst:5388 msgid "Code Objects" msgstr "" -#: ../../library/stdtypes.rst:5393 +#: ../../library/stdtypes.rst:5394 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -7788,7 +7789,7 @@ msgid "" "`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5400 +#: ../../library/stdtypes.rst:5401 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -7797,21 +7798,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5407 +#: ../../library/stdtypes.rst:5408 msgid "" "A code object can be executed or evaluated by passing it (instead of a " "source string) to the :func:`exec` or :func:`eval` built-in functions." msgstr "" -#: ../../library/stdtypes.rst:5410 +#: ../../library/stdtypes.rst:5411 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5416 +#: ../../library/stdtypes.rst:5417 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5422 +#: ../../library/stdtypes.rst:5423 msgid "" "Type objects represent the various object types. An object's type is " "accessed by the built-in function :func:`type`. There are no special " @@ -7819,30 +7820,30 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5427 +#: ../../library/stdtypes.rst:5428 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5433 +#: ../../library/stdtypes.rst:5434 msgid "The Null Object" msgstr "" -#: ../../library/stdtypes.rst:5435 +#: ../../library/stdtypes.rst:5436 msgid "" "This object is returned by functions that don't explicitly return a value. " "It supports no special operations. There is exactly one null object, named " "``None`` (a built-in name). ``type(None)()`` produces the same singleton." msgstr "" -#: ../../library/stdtypes.rst:5439 +#: ../../library/stdtypes.rst:5440 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5446 +#: ../../library/stdtypes.rst:5447 msgid "The Ellipsis Object" msgstr "" -#: ../../library/stdtypes.rst:5448 +#: ../../library/stdtypes.rst:5449 msgid "" "This object is commonly used by slicing (see :ref:`slicings`). It supports " "no special operations. There is exactly one ellipsis object, named :const:" @@ -7850,15 +7851,15 @@ msgid "" "`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5453 +#: ../../library/stdtypes.rst:5454 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:5459 +#: ../../library/stdtypes.rst:5460 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:5461 +#: ../../library/stdtypes.rst:5462 msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " @@ -7866,64 +7867,64 @@ msgid "" "`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5466 +#: ../../library/stdtypes.rst:5467 msgid "It is written as :code:`NotImplemented`." msgstr "" -#: ../../library/stdtypes.rst:5472 +#: ../../library/stdtypes.rst:5473 msgid "Internal Objects" msgstr "" -#: ../../library/stdtypes.rst:5474 +#: ../../library/stdtypes.rst:5475 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:5482 +#: ../../library/stdtypes.rst:5483 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:5484 +#: ../../library/stdtypes.rst:5485 msgid "" "The implementation adds a few special read-only attributes to several object " "types, where they are relevant. Some of these are not reported by the :func:" "`dir` built-in function." msgstr "" -#: ../../library/stdtypes.rst:5491 +#: ../../library/stdtypes.rst:5492 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5497 +#: ../../library/stdtypes.rst:5498 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5505 +#: ../../library/stdtypes.rst:5506 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:5510 +#: ../../library/stdtypes.rst:5511 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:5515 +#: ../../library/stdtypes.rst:5516 msgid "" "The :ref:`type parameters ` of generic classes, functions, and :" "ref:`type aliases `. For classes and functions that are not " "generic, this will be an empty tuple." msgstr "" -#: ../../library/stdtypes.rst:5525 +#: ../../library/stdtypes.rst:5526 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:5527 +#: ../../library/stdtypes.rst:5528 msgid "" "CPython has a global limit for converting between :class:`int` and :class:" "`str` to mitigate denial of service attacks. This limit *only* applies to " @@ -7931,7 +7932,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:5532 +#: ../../library/stdtypes.rst:5533 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -7941,24 +7942,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:5539 +#: ../../library/stdtypes.rst:5540 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:5541 +#: ../../library/stdtypes.rst:5542 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" -#: ../../library/stdtypes.rst:5545 +#: ../../library/stdtypes.rst:5546 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:5547 +#: ../../library/stdtypes.rst:5548 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -7982,7 +7983,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:5567 +#: ../../library/stdtypes.rst:5568 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -7990,11 +7991,11 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:5572 +#: ../../library/stdtypes.rst:5573 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:5574 +#: ../../library/stdtypes.rst:5575 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8005,84 +8006,84 @@ msgid "" "..." msgstr "" -#: ../../library/stdtypes.rst:5587 +#: ../../library/stdtypes.rst:5588 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:5589 +#: ../../library/stdtypes.rst:5590 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:5592 +#: ../../library/stdtypes.rst:5593 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:5593 +#: ../../library/stdtypes.rst:5594 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:5594 +#: ../../library/stdtypes.rst:5595 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:5595 +#: ../../library/stdtypes.rst:5596 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:5596 +#: ../../library/stdtypes.rst:5597 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:5599 +#: ../../library/stdtypes.rst:5600 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:5601 +#: ../../library/stdtypes.rst:5602 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:5602 +#: ../../library/stdtypes.rst:5603 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:5603 +#: ../../library/stdtypes.rst:5604 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:5604 +#: ../../library/stdtypes.rst:5605 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:5605 +#: ../../library/stdtypes.rst:5606 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:5606 +#: ../../library/stdtypes.rst:5607 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:5609 +#: ../../library/stdtypes.rst:5610 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:5611 +#: ../../library/stdtypes.rst:5612 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" -#: ../../library/stdtypes.rst:5614 +#: ../../library/stdtypes.rst:5615 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" -#: ../../library/stdtypes.rst:5617 +#: ../../library/stdtypes.rst:5618 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -8090,7 +8091,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:5619 +#: ../../library/stdtypes.rst:5620 msgid "" ":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" "`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " @@ -8099,38 +8100,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:5625 +#: ../../library/stdtypes.rst:5626 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:5628 +#: ../../library/stdtypes.rst:5629 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" -#: ../../library/stdtypes.rst:5632 +#: ../../library/stdtypes.rst:5633 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:5634 +#: ../../library/stdtypes.rst:5635 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:5636 +#: ../../library/stdtypes.rst:5637 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" -#: ../../library/stdtypes.rst:5643 +#: ../../library/stdtypes.rst:5644 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -8142,7 +8143,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:5652 +#: ../../library/stdtypes.rst:5653 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " @@ -8150,11 +8151,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:5658 +#: ../../library/stdtypes.rst:5659 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:5660 +#: ../../library/stdtypes.rst:5661 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " @@ -8162,11 +8163,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:5665 +#: ../../library/stdtypes.rst:5666 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:5667 +#: ../../library/stdtypes.rst:5668 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -8179,38 +8180,38 @@ msgid "" "... sys.set_int_max_str_digits(lower_bound)" msgstr "" -#: ../../library/stdtypes.rst:5677 +#: ../../library/stdtypes.rst:5678 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:5681 +#: ../../library/stdtypes.rst:5682 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:5682 +#: ../../library/stdtypes.rst:5683 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5685 +#: ../../library/stdtypes.rst:5686 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5688 +#: ../../library/stdtypes.rst:5689 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5690 +#: ../../library/stdtypes.rst:5691 msgid "" "Cased characters are those with general category property being one of " "\"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:5693 +#: ../../library/stdtypes.rst:5694 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -8224,7 +8225,7 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:393 ../../library/stdtypes.rst:950 #: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:1139 #: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 -#: ../../library/stdtypes.rst:5418 +#: ../../library/stdtypes.rst:5419 msgid "types" msgstr "type(型別)" @@ -8353,9 +8354,9 @@ msgstr "is not" #: ../../library/stdtypes.rst:1504 ../../library/stdtypes.rst:1540 #: ../../library/stdtypes.rst:2526 ../../library/stdtypes.rst:2545 #: ../../library/stdtypes.rst:2652 ../../library/stdtypes.rst:4233 -#: ../../library/stdtypes.rst:4435 ../../library/stdtypes.rst:4913 -#: ../../library/stdtypes.rst:5168 ../../library/stdtypes.rst:5338 -#: ../../library/stdtypes.rst:5382 +#: ../../library/stdtypes.rst:4435 ../../library/stdtypes.rst:4914 +#: ../../library/stdtypes.rst:5169 ../../library/stdtypes.rst:5339 +#: ../../library/stdtypes.rst:5383 msgid "object" msgstr "object(物件)" @@ -8448,8 +8449,8 @@ msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:950 #: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4435 -#: ../../library/stdtypes.rst:5389 ../../library/stdtypes.rst:5403 -#: ../../library/stdtypes.rst:5418 +#: ../../library/stdtypes.rst:5390 ../../library/stdtypes.rst:5404 +#: ../../library/stdtypes.rst:5419 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -8516,7 +8517,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:335 ../../library/stdtypes.rst:1606 -#: ../../library/stdtypes.rst:2526 ../../library/stdtypes.rst:5418 +#: ../../library/stdtypes.rst:2526 ../../library/stdtypes.rst:5419 msgid "module" msgstr "模組" @@ -8584,7 +8585,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4828 +#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4829 msgid "protocol" msgstr "protocol(協定)" @@ -8694,7 +8695,7 @@ msgid "bytearray" msgstr "bytearray(位元組陣列)" #: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 -#: ../../library/stdtypes.rst:5168 ../../library/stdtypes.rst:5418 +#: ../../library/stdtypes.rst:5169 ../../library/stdtypes.rst:5419 msgid "type" msgstr "type(型別)" @@ -8887,79 +8888,79 @@ msgstr "dictionary(字典)" msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:4828 +#: ../../library/stdtypes.rst:4829 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:4828 +#: ../../library/stdtypes.rst:4829 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:4828 +#: ../../library/stdtypes.rst:4829 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:4901 +#: ../../library/stdtypes.rst:4902 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:4901 +#: ../../library/stdtypes.rst:4902 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:4913 +#: ../../library/stdtypes.rst:4914 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:4913 +#: ../../library/stdtypes.rst:4914 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:4913 +#: ../../library/stdtypes.rst:4914 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5168 +#: ../../library/stdtypes.rst:5169 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5168 +#: ../../library/stdtypes.rst:5169 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5338 +#: ../../library/stdtypes.rst:5339 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5382 +#: ../../library/stdtypes.rst:5383 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5382 +#: ../../library/stdtypes.rst:5383 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5389 +#: ../../library/stdtypes.rst:5390 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5389 +#: ../../library/stdtypes.rst:5390 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5403 +#: ../../library/stdtypes.rst:5404 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5403 +#: ../../library/stdtypes.rst:5404 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5442 +#: ../../library/stdtypes.rst:5443 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5442 +#: ../../library/stdtypes.rst:5443 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" diff --git a/library/string.po b/library/string.po index f35d8e3922..e780be5352 100644 --- a/library/string.po +++ b/library/string.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-10-15 00:14+0000\n" "PO-Revision-Date: 2024-03-10 15:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -666,7 +666,7 @@ msgid "String format. This is the default type for strings and may be omitted." msgstr "" #: ../../library/string.rst:461 ../../library/string.rst:490 -#: ../../library/string.rst:577 +#: ../../library/string.rst:575 msgid "None" msgstr "None" @@ -735,7 +735,7 @@ msgstr "" "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用大寫字母。如果指定了 " "``'#'``,則前綴 ``'0x'`` 也會被轉成大寫的 ``'0X'``。" -#: ../../library/string.rst:486 ../../library/string.rst:570 +#: ../../library/string.rst:486 ../../library/string.rst:568 msgid "``'n'``" msgstr "``'n'``" @@ -775,50 +775,49 @@ msgid "" "decimal point, for a total of ``p + 1`` significant digits. With no " "precision given, uses a precision of ``6`` digits after the decimal point " "for :class:`float`, and shows all coefficient digits for :class:`~decimal." -"Decimal`. If no digits follow the decimal point, the decimal point is also " -"removed unless the ``#`` option is used." +"Decimal`. If ``p=0``, the decimal point is omitted unless the ``#`` option " +"is used." msgstr "" -#: ../../library/string.rst:516 +#: ../../library/string.rst:515 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/string.rst:516 +#: ../../library/string.rst:515 msgid "" "Scientific notation. Same as ``'e'`` except it uses an upper case 'E' as the " "separator character." msgstr "" -#: ../../library/string.rst:519 +#: ../../library/string.rst:518 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/string.rst:519 +#: ../../library/string.rst:518 msgid "" "Fixed-point notation. For a given precision ``p``, formats the number as a " "decimal number with exactly ``p`` digits following the decimal point. With " "no precision given, uses a precision of ``6`` digits after the decimal point " "for :class:`float`, and uses a precision large enough to show all " -"coefficient digits for :class:`~decimal.Decimal`. If no digits follow the " -"decimal point, the decimal point is also removed unless the ``#`` option is " -"used." +"coefficient digits for :class:`~decimal.Decimal`. If ``p=0``, the decimal " +"point is omitted unless the ``#`` option is used." msgstr "" -#: ../../library/string.rst:529 +#: ../../library/string.rst:527 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/string.rst:529 +#: ../../library/string.rst:527 msgid "" "Fixed-point notation. Same as ``'f'``, but converts ``nan`` to ``NAN`` and " "``inf`` to ``INF``." msgstr "" -#: ../../library/string.rst:532 +#: ../../library/string.rst:530 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/string.rst:532 +#: ../../library/string.rst:530 msgid "" "General format. For a given precision ``p >= 1``, this rounds the number to " "``p`` significant digits and then formats the result in either fixed-point " @@ -826,7 +825,7 @@ msgid "" "``0`` is treated as equivalent to a precision of ``1``." msgstr "" -#: ../../library/string.rst:539 +#: ../../library/string.rst:537 msgid "" "The precise rules are as follows: suppose that the result formatted with " "presentation type ``'e'`` and precision ``p-1`` would have exponent " @@ -839,7 +838,7 @@ msgid "" "unless the ``'#'`` option is used." msgstr "" -#: ../../library/string.rst:552 +#: ../../library/string.rst:550 msgid "" "With no precision given, uses a precision of ``6`` significant digits for :" "class:`float`. For :class:`~decimal.Decimal`, the coefficient of the result " @@ -849,40 +848,40 @@ msgid "" "notation is used otherwise." msgstr "" -#: ../../library/string.rst:561 +#: ../../library/string.rst:559 msgid "" "Positive and negative infinity, positive and negative zero, and nans, are " "formatted as ``inf``, ``-inf``, ``0``, ``-0`` and ``nan`` respectively, " "regardless of the precision." msgstr "" -#: ../../library/string.rst:566 +#: ../../library/string.rst:564 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/string.rst:566 +#: ../../library/string.rst:564 msgid "" "General format. Same as ``'g'`` except switches to ``'E'`` if the number " "gets too large. The representations of infinity and NaN are uppercased, too." msgstr "" -#: ../../library/string.rst:570 +#: ../../library/string.rst:568 msgid "" "Number. This is the same as ``'g'``, except that it uses the current locale " "setting to insert the appropriate number separator characters." msgstr "" -#: ../../library/string.rst:574 +#: ../../library/string.rst:572 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/string.rst:574 +#: ../../library/string.rst:572 msgid "" "Percentage. Multiplies the number by 100 and displays in fixed (``'f'``) " "format, followed by a percent sign." msgstr "" -#: ../../library/string.rst:577 +#: ../../library/string.rst:575 msgid "" "For :class:`float` this is like the ``'g'`` type, except that when fixed-" "point notation is used to format the result, it always includes at least one " @@ -891,30 +890,30 @@ msgid "" "as large as needed to represent the given value faithfully." msgstr "" -#: ../../library/string.rst:585 +#: ../../library/string.rst:583 msgid "" "For :class:`~decimal.Decimal`, this is the same as either ``'g'`` or ``'G'`` " "depending on the value of ``context.capitals`` for the current decimal " "context." msgstr "" -#: ../../library/string.rst:589 +#: ../../library/string.rst:587 msgid "" "The overall effect is to match the output of :func:`str` as altered by the " "other format modifiers." msgstr "" -#: ../../library/string.rst:597 +#: ../../library/string.rst:595 msgid "Format examples" msgstr "格式範例" -#: ../../library/string.rst:599 +#: ../../library/string.rst:597 msgid "" "This section contains examples of the :meth:`str.format` syntax and " "comparison with the old ``%``-formatting." msgstr "本節包含 :meth:`str.format` 語法以及與舊式 ``%`` 格式的比較。" -#: ../../library/string.rst:602 +#: ../../library/string.rst:600 msgid "" "In most of the cases the syntax is similar to the old ``%``-formatting, with " "the addition of the ``{}`` and with ``:`` used instead of ``%``. For " @@ -923,17 +922,17 @@ msgstr "" "此語法在大多情況下與舊式的 ``%`` 格式類似,只是增加了 ``{}`` 和 ``:`` 來取代 " "``%``。例如,``'%03.2f'`` 可以改寫為 ``'{:03.2f}'``。" -#: ../../library/string.rst:606 +#: ../../library/string.rst:604 msgid "" "The new format syntax also supports new and different options, shown in the " "following examples." msgstr "新的語法還支援新的選項,將在以下的範例中說明。" -#: ../../library/string.rst:609 +#: ../../library/string.rst:607 msgid "Accessing arguments by position::" msgstr "按位置存取引數: ::" -#: ../../library/string.rst:611 +#: ../../library/string.rst:609 msgid "" ">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" "'a, b, c'\n" @@ -948,11 +947,11 @@ msgid "" "'abracadabra'" msgstr "" -#: ../../library/string.rst:622 +#: ../../library/string.rst:620 msgid "Accessing arguments by name::" msgstr "按名稱存取引數: ::" -#: ../../library/string.rst:624 +#: ../../library/string.rst:622 msgid "" ">>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', " "longitude='-115.81W')\n" @@ -962,11 +961,11 @@ msgid "" "'Coordinates: 37.24N, -115.81W'" msgstr "" -#: ../../library/string.rst:630 +#: ../../library/string.rst:628 msgid "Accessing arguments' attributes::" msgstr "存取引數的屬性: ::" -#: ../../library/string.rst:632 +#: ../../library/string.rst:630 msgid "" ">>> c = 3-5j\n" ">>> ('The complex number {0} is formed from the real part {0.real} '\n" @@ -983,22 +982,22 @@ msgid "" "'Point(4, 2)'" msgstr "" -#: ../../library/string.rst:645 +#: ../../library/string.rst:643 msgid "Accessing arguments' items::" msgstr "存取引數的內容: ::" -#: ../../library/string.rst:647 +#: ../../library/string.rst:645 msgid "" ">>> coord = (3, 5)\n" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" "'X: 3; Y: 5'" msgstr "" -#: ../../library/string.rst:651 +#: ../../library/string.rst:649 msgid "Replacing ``%s`` and ``%r``::" msgstr "替換 ``%s`` 和 ``%r``: ::" -#: ../../library/string.rst:653 +#: ../../library/string.rst:651 msgid "" ">>> \"repr() shows quotes: {!r}; str() doesn't: {!s}\".format('test1', " "'test2')\n" @@ -1008,11 +1007,11 @@ msgstr "" "'test2')\n" "\"repr() shows quotes: 'test1'; str() doesn't: test2\"" -#: ../../library/string.rst:656 +#: ../../library/string.rst:654 msgid "Aligning the text and specifying a width::" msgstr "對齊文字以及指定寬度: ::" -#: ../../library/string.rst:658 +#: ../../library/string.rst:656 msgid "" ">>> '{:<30}'.format('left aligned')\n" "'left aligned '\n" @@ -1024,11 +1023,11 @@ msgid "" "'***********centered***********'" msgstr "" -#: ../../library/string.rst:667 +#: ../../library/string.rst:665 msgid "Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::" msgstr "替換 ``%+f``、``%-f`` 和 ``% f`` 以及指定正負號: ::" -#: ../../library/string.rst:669 +#: ../../library/string.rst:667 msgid "" ">>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always\n" "'+3.140000; -3.140000'\n" @@ -1039,12 +1038,12 @@ msgid "" "'3.140000; -3.140000'" msgstr "" -#: ../../library/string.rst:676 +#: ../../library/string.rst:674 msgid "" "Replacing ``%x`` and ``%o`` and converting the value to different bases::" msgstr "替換 ``%x`` 和 ``%o`` 並將其值轉換為不同的進位制: ::" -#: ../../library/string.rst:678 +#: ../../library/string.rst:676 msgid "" ">>> # format also supports binary numbers\n" ">>> \"int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}\".format(42)\n" @@ -1054,11 +1053,11 @@ msgid "" "'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'" msgstr "" -#: ../../library/string.rst:685 +#: ../../library/string.rst:683 msgid "Using the comma as a thousands separator::" msgstr "使用逗號作為千位分隔符: ::" -#: ../../library/string.rst:687 +#: ../../library/string.rst:685 msgid "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" @@ -1066,11 +1065,11 @@ msgstr "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" -#: ../../library/string.rst:690 +#: ../../library/string.rst:688 msgid "Expressing a percentage::" msgstr "表示為百分比: ::" -#: ../../library/string.rst:692 +#: ../../library/string.rst:690 msgid "" ">>> points = 19\n" ">>> total = 22\n" @@ -1082,11 +1081,11 @@ msgstr "" ">>> 'Correct answers: {:.2%}'.format(points/total)\n" "'Correct answers: 86.36%'" -#: ../../library/string.rst:697 +#: ../../library/string.rst:695 msgid "Using type-specific formatting::" msgstr "作為特定型別格式: ::" -#: ../../library/string.rst:699 +#: ../../library/string.rst:697 msgid "" ">>> import datetime\n" ">>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n" @@ -1098,11 +1097,11 @@ msgstr "" ">>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" "'2010-07-04 12:15:58'" -#: ../../library/string.rst:704 +#: ../../library/string.rst:702 msgid "Nesting arguments and more complex examples::" msgstr "巢狀引數及更多複雜範例: ::" -#: ../../library/string.rst:706 +#: ../../library/string.rst:704 msgid "" ">>> for align, text in zip('<^>', ['left', 'center', 'right']):\n" "... '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n" @@ -1160,11 +1159,11 @@ msgstr "" " 10 A 12 1010\n" " 11 B 13 1011" -#: ../../library/string.rst:738 +#: ../../library/string.rst:736 msgid "Template strings" msgstr "模板字串" -#: ../../library/string.rst:740 +#: ../../library/string.rst:738 msgid "" "Template strings provide simpler string substitutions as described in :pep:" "`292`. A primary use case for template strings is for internationalization " @@ -1178,17 +1177,17 @@ msgstr "" "化工具更容易翻譯。基於模板字串建構的 i18n 函式庫範例,請參閱 `flufl.i18n " "`_ 套件。" -#: ../../library/string.rst:750 +#: ../../library/string.rst:748 msgid "" "Template strings support ``$``-based substitutions, using the following " "rules:" msgstr "" -#: ../../library/string.rst:752 +#: ../../library/string.rst:750 msgid "``$$`` is an escape; it is replaced with a single ``$``." msgstr "" -#: ../../library/string.rst:754 +#: ../../library/string.rst:752 msgid "" "``$identifier`` names a substitution placeholder matching a mapping key of " "``\"identifier\"``. By default, ``\"identifier\"`` is restricted to any " @@ -1198,30 +1197,30 @@ msgid "" "specification." msgstr "" -#: ../../library/string.rst:761 +#: ../../library/string.rst:759 msgid "" "``${identifier}`` is equivalent to ``$identifier``. It is required when " "valid identifier characters follow the placeholder but are not part of the " "placeholder, such as ``\"${noun}ification\"``." msgstr "" -#: ../../library/string.rst:765 +#: ../../library/string.rst:763 msgid "" "Any other appearance of ``$`` in the string will result in a :exc:" "`ValueError` being raised." msgstr "" -#: ../../library/string.rst:768 +#: ../../library/string.rst:766 msgid "" "The :mod:`string` module provides a :class:`Template` class that implements " "these rules. The methods of :class:`Template` are:" msgstr "" -#: ../../library/string.rst:774 +#: ../../library/string.rst:772 msgid "The constructor takes a single argument which is the template string." msgstr "" -#: ../../library/string.rst:779 +#: ../../library/string.rst:777 msgid "" "Performs the template substitution, returning a new string. *mapping* is " "any dictionary-like object with keys that match the placeholders in the " @@ -1233,7 +1232,7 @@ msgstr "" "的字典型物件。或者如果關鍵字就是佔位符號時,你也可以改提供關鍵字引數。當 " "*mapping* 跟 *kwds* 同時給定並存在重複時,*kwds* 的佔位符號會被優先使用。" -#: ../../library/string.rst:788 +#: ../../library/string.rst:786 msgid "" "Like :meth:`substitute`, except that if placeholders are missing from " "*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the " @@ -1246,7 +1245,7 @@ msgstr "" "與 :meth:`substitute` 不同的是,任何包含 ``$`` 的字句會直接回傳 ``$`` 而非引" "發 :exc:`ValueError`。" -#: ../../library/string.rst:794 +#: ../../library/string.rst:792 msgid "" "While other exceptions may still occur, this method is called \"safe\" " "because it always tries to return a usable string instead of raising an " @@ -1260,7 +1259,7 @@ msgstr "" "完全安全,因為它會默默忽略格式錯誤的模板,這些模板包含了多餘的左右定界符、不" "匹配的括號,或者不是有效的 Python 識別字的佔位符號。" -#: ../../library/string.rst:804 +#: ../../library/string.rst:802 msgid "" "Returns false if the template has invalid placeholders that will cause :meth:" "`substitute` to raise :exc:`ValueError`." @@ -1268,18 +1267,18 @@ msgstr "" "如果模板有將導致 :meth:`substitute` 引發 :exc:`ValueError` 的無效佔位符號,就" "會回傳 false。" -#: ../../library/string.rst:812 +#: ../../library/string.rst:810 msgid "" "Returns a list of the valid identifiers in the template, in the order they " "first appear, ignoring any invalid identifiers." msgstr "" "回傳模板中有效識別字的串列,按照它們首次出現的順序,並忽略任何無效的識別字。" -#: ../../library/string.rst:817 +#: ../../library/string.rst:815 msgid ":class:`Template` instances also provide one public data attribute:" msgstr ":class:`Template` 實例也提供一個公開的資料屬性:" -#: ../../library/string.rst:821 +#: ../../library/string.rst:819 msgid "" "This is the object passed to the constructor's *template* argument. In " "general, you shouldn't change it, but read-only access is not enforced." @@ -1287,11 +1286,11 @@ msgstr "" "這是傳遞給建構函式 *template* 引數的物件。一般來說,你不應該改變它,但並沒有" "強制設定成唯讀。" -#: ../../library/string.rst:824 +#: ../../library/string.rst:822 msgid "Here is an example of how to use a Template::" msgstr "以下是如何使用 Template 的一個範例: ::" -#: ../../library/string.rst:826 +#: ../../library/string.rst:824 msgid "" ">>> from string import Template\n" ">>> s = Template('$who likes $what')\n" @@ -1325,7 +1324,7 @@ msgstr "" ">>> Template('$who likes $what').safe_substitute(d)\n" "'tim likes $what'" -#: ../../library/string.rst:842 +#: ../../library/string.rst:840 msgid "" "Advanced usage: you can derive subclasses of :class:`Template` to customize " "the placeholder syntax, delimiter character, or the entire regular " @@ -1335,7 +1334,7 @@ msgstr "" "進階用法:你可以衍生 :class:`Template` 類別來自定義佔位符號語法、左右定界符字" "元,或者用於剖析模板字串的正規表示式。你可以透過覆寫這些類別屬性來達成:" -#: ../../library/string.rst:847 +#: ../../library/string.rst:845 msgid "" "*delimiter* -- This is the literal string describing a placeholder " "introducing delimiter. The default value is ``$``. Note that this should " @@ -1349,7 +1348,7 @@ msgstr "" "注意你不能在建立類別後修改左右定界符。(意即在子類別的命名空間中必須設置不同" "的左右定界符)" -#: ../../library/string.rst:854 +#: ../../library/string.rst:852 msgid "" "*idpattern* -- This is the regular expression describing the pattern for non-" "braced placeholders. The default value is the regular expression ``(?a:[_a-" @@ -1357,19 +1356,19 @@ msgid "" "pattern will also apply to braced placeholders." msgstr "" -#: ../../library/string.rst:861 +#: ../../library/string.rst:859 msgid "" "Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with " "some non-ASCII characters. That's why we use the local ``a`` flag here." msgstr "" -#: ../../library/string.rst:865 +#: ../../library/string.rst:863 msgid "" "*braceidpattern* can be used to define separate patterns used inside and " "outside the braces." msgstr "" -#: ../../library/string.rst:869 +#: ../../library/string.rst:867 msgid "" "*braceidpattern* -- This is like *idpattern* but describes the pattern for " "braced placeholders. Defaults to ``None`` which means to fall back to " @@ -1378,7 +1377,7 @@ msgid "" "unbraced placeholders." msgstr "" -#: ../../library/string.rst:877 +#: ../../library/string.rst:875 msgid "" "*flags* -- The regular expression flags that will be applied when compiling " "the regular expression used for recognizing substitutions. The default " @@ -1387,7 +1386,7 @@ msgid "" "regular expressions." msgstr "" -#: ../../library/string.rst:885 +#: ../../library/string.rst:883 msgid "" "Alternatively, you can provide the entire regular expression pattern by " "overriding the class attribute *pattern*. If you do this, the value must be " @@ -1396,13 +1395,13 @@ msgid "" "placeholder rule:" msgstr "" -#: ../../library/string.rst:891 +#: ../../library/string.rst:889 msgid "" "*escaped* -- This group matches the escape sequence, e.g. ``$$``, in the " "default pattern." msgstr "*escaped* -- 此群組與跳脫序列匹配,例如在預設模式下為 ``$$``。" -#: ../../library/string.rst:894 +#: ../../library/string.rst:892 msgid "" "*named* -- This group matches the unbraced placeholder name; it should not " "include the delimiter in capturing group." @@ -1410,7 +1409,7 @@ msgstr "" "*named* -- 此群組與不帶大括號的佔位符號名稱匹配;它不應包含擷取群組中的左右定" "界符號。" -#: ../../library/string.rst:897 +#: ../../library/string.rst:895 msgid "" "*braced* -- This group matches the brace enclosed placeholder name; it " "should not include either the delimiter or braces in the capturing group." @@ -1418,7 +1417,7 @@ msgstr "" "*braced* -- 此群組與大括號括起來的佔位符號名稱匹配;它不應在擷取群組中包含左" "右定界符或大括號。" -#: ../../library/string.rst:900 +#: ../../library/string.rst:898 msgid "" "*invalid* -- This group matches any other delimiter pattern (usually a " "single delimiter), and it should appear last in the regular expression." @@ -1426,7 +1425,7 @@ msgstr "" "*invalid* -- 此群組與任何其他左右定界符模式(通常是單一左右定界符)匹配,且它" "應該出現在正規表示式的最後。" -#: ../../library/string.rst:903 +#: ../../library/string.rst:901 msgid "" "The methods on this class will raise :exc:`ValueError` if the pattern " "matches the template without one of these named groups matching." @@ -1434,11 +1433,11 @@ msgstr "" "當此模式有匹配於模板但這些命名組中卻有任一個不匹配,此類別的方法將引發 :exc:" "`ValueError`。" -#: ../../library/string.rst:908 +#: ../../library/string.rst:906 msgid "Helper functions" msgstr "輔助函式" -#: ../../library/string.rst:912 +#: ../../library/string.rst:910 msgid "" "Split the argument into words using :meth:`str.split`, capitalize each word " "using :meth:`str.capitalize`, and join the capitalized words using :meth:" @@ -1519,10 +1518,10 @@ msgstr ", (逗號)" msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../library/string.rst:748 +#: ../../library/string.rst:746 msgid "$ (dollar)" msgstr "$ (金錢符號)" -#: ../../library/string.rst:748 +#: ../../library/string.rst:746 msgid "in template strings" msgstr "於 template strings(模板字串)" diff --git a/library/subprocess.po b/library/subprocess.po index d6d98f3bfc..a5a9086c53 100644 --- a/library/subprocess.po +++ b/library/subprocess.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -50,9 +50,13 @@ msgstr "" msgid ":pep:`324` -- PEP proposing the subprocess module" msgstr ":pep:`324` -- 提議 subprocess 模組的 PEP" +#: ../../library/subprocess.rst:598 ../../library/subprocess.rst:605 +#: ../../library/subprocess.rst:615 ../../library/subprocess.rst:624 +#: ../../library/subprocess.rst:633 ../../library/subprocess.rst:639 +#: ../../library/subprocess.rst:1560 ../../library/subprocess.rst:1582 #: ../../includes/wasm-mobile-notavail.rst:3 -msgid ":ref:`Availability `: not Android, not iOS, not WASI." -msgstr ":ref:`適用 `:、非 Android、非 iOS、非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-mobile-notavail.rst:5 msgid "" @@ -778,12 +782,6 @@ msgid "" "the child process prior to the execution of the subprocess." msgstr "" -#: ../../library/subprocess.rst:598 ../../library/subprocess.rst:605 -#: ../../library/subprocess.rst:615 ../../library/subprocess.rst:624 -#: ../../library/subprocess.rst:633 ../../library/subprocess.rst:639 -msgid ":ref:`Availability `: POSIX" -msgstr ":ref:`適用 `:POSIX" - #: ../../library/subprocess.rst:599 msgid "*start_new_session* was added." msgstr "新增 *start_new_session*。" @@ -2046,10 +2044,6 @@ msgstr "" ">>> subprocess.getstatusoutput('/bin/kill $$')\n" "(-15, '')" -#: ../../library/subprocess.rst:1560 ../../library/subprocess.rst:1582 -msgid ":ref:`Availability `: Unix, Windows." -msgstr ":ref:`適用 `:Unix 和 Windows。" - #: ../../library/subprocess.rst:1562 msgid "Windows support was added." msgstr "新增對 Windows 的支援。" @@ -2214,13 +2208,3 @@ msgstr "universal newlines" #: ../../library/subprocess.rst:296 msgid "subprocess module" msgstr "subprocess 模組" - -#, fuzzy -#~ msgid "" -#~ "This module does not work or is not available on WebAssembly platforms, " -#~ "or on iOS. See :ref:`wasm-availability` for more information on WASM " -#~ "availability; see :ref:`iOS-availability` for more information on iOS " -#~ "availability." -#~ msgstr "" -#~ "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法" -#~ "作用或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/symtable.po b/library/symtable.po index 48c873ff47..86a561a35b 100644 --- a/library/symtable.po +++ b/library/symtable.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-09 00:13+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,8 +34,8 @@ msgid "" "examine these tables." msgstr "" "符號表 (symbol table) 是在生成位元組碼 (bytecode) 之前由編譯器從 AST 生成的。" -"符號表負責計算程式碼中每個識別器 (identifier) 的範圍。:mod:`symtable` 提供了" -"一個介面來檢查這些表。" +"符號表負責計算程式碼中每個識別器 (identifier) 的作用域。:mod:`symtable` 提供" +"了一個介面來檢查這些表。" #: ../../library/symtable.rst:22 msgid "Generating Symbol Tables" @@ -56,40 +56,42 @@ msgstr "檢查符號表" #: ../../library/symtable.rst:36 msgid "An enumeration indicating the type of a :class:`SymbolTable` object." -msgstr "" +msgstr "表明 :class:`SymbolTable` 物件型別的列舉。" #: ../../library/symtable.rst:41 msgid "Used for the symbol table of a module." -msgstr "" +msgstr "用於模組的符號表。" #: ../../library/symtable.rst:46 msgid "Used for the symbol table of a function." -msgstr "" +msgstr "用於函式的符號表。" #: ../../library/symtable.rst:51 msgid "Used for the symbol table of a class." -msgstr "" +msgstr "用於類別的符號表。" #: ../../library/symtable.rst:53 msgid "" "The following members refer to different flavors of :ref:`annotation scopes " "`." -msgstr "" +msgstr "以下成員代表不同風格的\\ :ref:`註釋作用域 `。" #: ../../library/symtable.rst:59 msgid "" "Used for annotations if ``from __future__ import annotations`` is active." -msgstr "" +msgstr "如果 ``from __future__ import annotations`` 處於活動狀態,則用於註解。" #: ../../library/symtable.rst:64 msgid "Used for the symbol table of :keyword:`type` constructions." -msgstr "" +msgstr "用於 :keyword:`type` 結構的符號表。" #: ../../library/symtable.rst:69 msgid "" "Used for the symbol table of :ref:`generic functions ` " "or :ref:`generic classes `." msgstr "" +"用於\\ :ref:`泛型函式 (generic functions) `\\ 或\\ :ref:`" +"泛型類別 (generic classes) `\\ 的符號表。" #: ../../library/symtable.rst:75 msgid "" @@ -98,6 +100,9 @@ msgid "" "TypeVarTuple or a ParamSpec object (the latter two do not support a bound or " "a constraint tuple)." msgstr "" +"用於形式意義上 (formal sense) 的繫結、約束元組 (constraint tuple) 或單一型別" +"變數的預設值的符號表,即 TypeVar、TypeVarTuple 或 ParamSpec 物件(後兩者不支" +"援繫結或約束元組)。" #: ../../library/symtable.rst:84 msgid "A namespace table for a block. The constructor is not public." @@ -109,7 +114,7 @@ msgstr "" msgid "" "Return the type of the symbol table. Possible values are members of the :" "class:`SymbolTableType` enumeration." -msgstr "" +msgstr "回傳符號表的類型。可能的值為 :class:`SymbolTableType` 列舉的成員。" #: ../../library/symtable.rst:91 msgid "" @@ -121,7 +126,7 @@ msgstr "" #: ../../library/symtable.rst:95 msgid "Return values are members of the :class:`SymbolTableType` enumeration." -msgstr "" +msgstr "回傳值是 :class:`SymbolTableType` 列舉的成員。" #: ../../library/symtable.rst:98 msgid "" @@ -129,6 +134,8 @@ msgid "" "it is recommended to use :class:`SymbolTableType` members instead of hard-" "coded strings." msgstr "" +"回傳字串的確切值在未來可能會發生變化,因此建議使用 :class:`SymbolTableType` " +"成員而不是寫死 (hard-coded) 字串。" #: ../../library/symtable.rst:104 msgid "Return the table's identifier." @@ -148,7 +155,7 @@ msgstr "" "名稱;如果表是全域的,則為 ``'top'`` (:meth:`get_type` 會回傳 " "``'module'``)。對於型別參數作用域(用於泛型類別、函式和型別別名),它是底層" "類別、函式或型別別名的名稱。對於型別別名作用域,它是型別別名的名稱。對於 :" -"class:`~typing.TypeVar` 綁定範圍,它會是 ``TypeVar`` 的名稱。" +"class:`~typing.TypeVar` 綁定作用域,它會是 ``TypeVar`` 的名稱。" #: ../../library/symtable.rst:118 msgid "Return the number of the first line in the block this table represents." @@ -167,7 +174,7 @@ msgid "" "Return ``True`` if the block has nested namespaces within it. These can be " "obtained with :meth:`get_children`." msgstr "" -"如果區塊內有巢狀命名空間,則回傳 ``True``。這些可以通過 :meth:`get_children` " +"如果區塊內有巢狀命名空間,則回傳 ``True``。這些可以透過 :meth:`get_children` " "獲得。" #: ../../library/symtable.rst:135 @@ -209,90 +216,101 @@ msgid "Return a tuple containing names of globals in this function." msgstr "回傳一個包含此函式中全域變數 (globals) 名稱的元組。" #: ../../library/symtable.rst:170 -msgid "Return a tuple containing names of nonlocals in this function." -msgstr "回傳一個包含此函式中非區域變數 (nonlocals) 名稱的元組。" +msgid "" +"Return a tuple containing names of explicitly declared nonlocals in this " +"function." +msgstr "回傳一個包含此函式中明確宣告的非區域變數 (nonlocals) 名稱的元組。" #: ../../library/symtable.rst:174 -msgid "Return a tuple containing names of free variables in this function." -msgstr "回傳一個包含此函式中自由變數 (free variables) 名稱的元組。" +msgid "" +"Return a tuple containing names of :term:`free (closure) variables ` in this function." +msgstr "" +"回傳一個包含此函式中的\\ :term:`自由(閉包)變數 (free (closure) variables) " +"` 名稱的元組。" -#: ../../library/symtable.rst:179 +#: ../../library/symtable.rst:180 msgid "A namespace of a class. This class inherits from :class:`SymbolTable`." msgstr "一個類別的命名空間。該類別繼承自 :class:`SymbolTable`。" -#: ../../library/symtable.rst:183 +#: ../../library/symtable.rst:184 msgid "" "Return a tuple containing the names of method-like functions declared in the " "class." msgstr "回傳一個包含類別中聲明的類似方法之函式名稱的元組。" -#: ../../library/symtable.rst:186 +#: ../../library/symtable.rst:187 msgid "" "Here, the term 'method' designates *any* function defined in the class body " "via :keyword:`def` or :keyword:`async def`." msgstr "" +"在這裡,術語「方法 (method)」表示透過 :keyword:`def` 或 :keyword:`async def` " +"在類別主體中定義的\\ *任何*\\ 函式。" -#: ../../library/symtable.rst:189 +#: ../../library/symtable.rst:190 msgid "" "Functions defined in a deeper scope (e.g., in an inner class) are not picked " "up by :meth:`get_methods`." msgstr "" +":meth:`get_methods` 不會取得更深作用域內定義的函式(例如在內部類別中)。" -#: ../../library/symtable.rst:192 +#: ../../library/symtable.rst:193 msgid "For example:" msgstr "舉例來說:" -#: ../../library/symtable.rst:214 +#: ../../library/symtable.rst:215 msgid "" "Although ``A().f()`` raises :exc:`TypeError` at runtime, ``A.f`` is still " "considered as a method-like function." msgstr "" +"儘管 ``A().f()`` 會在 runtime 引發 :exc:`TypeError`,但 ``A.f`` 仍然被視為類" +"似方法的函式。" -#: ../../library/symtable.rst:219 +#: ../../library/symtable.rst:220 msgid "" "An entry in a :class:`SymbolTable` corresponding to an identifier in the " "source. The constructor is not public." msgstr "" ":class:`SymbolTable` 中的條目對應於來源中的識別器。建構函式不是公開的。" -#: ../../library/symtable.rst:224 +#: ../../library/symtable.rst:225 msgid "Return the symbol's name." msgstr "回傳符號的名稱。" -#: ../../library/symtable.rst:228 +#: ../../library/symtable.rst:229 msgid "Return ``True`` if the symbol is used in its block." msgstr "如果該符號在其區塊中使用,則回傳 ``True``。" -#: ../../library/symtable.rst:232 +#: ../../library/symtable.rst:233 msgid "Return ``True`` if the symbol is created from an import statement." msgstr "如果符號是從 import 陳述式建立的,則回傳 ``True``。" -#: ../../library/symtable.rst:236 +#: ../../library/symtable.rst:237 msgid "Return ``True`` if the symbol is a parameter." msgstr "如果符號是一個參數,則回傳 ``True``。" -#: ../../library/symtable.rst:240 +#: ../../library/symtable.rst:241 msgid "Return ``True`` if the symbol is global." msgstr "如果符號是全域的,則回傳 ``True``。" -#: ../../library/symtable.rst:244 +#: ../../library/symtable.rst:245 msgid "Return ``True`` if the symbol is nonlocal." msgstr "如果符號是非區域的,則回傳 ``True``。" -#: ../../library/symtable.rst:248 +#: ../../library/symtable.rst:249 msgid "" "Return ``True`` if the symbol is declared global with a global statement." msgstr "如果使用全域陳述式將符號聲明為全域的,則回傳 ``True``。" -#: ../../library/symtable.rst:252 +#: ../../library/symtable.rst:253 msgid "Return ``True`` if the symbol is local to its block." msgstr "如果符號是其區塊的區域符號,則回傳 ``True``。" -#: ../../library/symtable.rst:256 +#: ../../library/symtable.rst:257 msgid "Return ``True`` if the symbol is annotated." msgstr "如果符號有被註釋,則回傳 ``True``。" -#: ../../library/symtable.rst:262 +#: ../../library/symtable.rst:263 msgid "" "Return ``True`` if the symbol is referenced in its block, but not assigned " "to." @@ -300,25 +318,25 @@ msgstr "" "如果該符號在其區塊中被參照 (referenced) 但未被賦值 (assigned),則回傳 " "``True``。" -#: ../../library/symtable.rst:267 +#: ../../library/symtable.rst:268 msgid "Return ``True`` if the symbol is assigned to in its block." msgstr "如果該符號被賦值到其區塊中,則回傳 ``True``。" -#: ../../library/symtable.rst:271 +#: ../../library/symtable.rst:272 msgid "Return ``True`` if name binding introduces new namespace." msgstr "如果名稱綁定引入 (introduce) 新的命名空間,則回傳 ``True``。" -#: ../../library/symtable.rst:273 +#: ../../library/symtable.rst:274 msgid "" "If the name is used as the target of a function or class statement, this " "will be true." msgstr "如果名稱用作函式或類別陳述式的目標,則這將會是 true。" -#: ../../library/symtable.rst:276 +#: ../../library/symtable.rst:277 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/symtable.rst:278 +#: ../../library/symtable.rst:279 msgid "" ">>> table = symtable.symtable(\"def some_func(): pass\", \"string\", " "\"exec\")\n" @@ -330,7 +348,7 @@ msgstr "" ">>> table.lookup(\"some_func\").is_namespace()\n" "True" -#: ../../library/symtable.rst:282 +#: ../../library/symtable.rst:283 msgid "" "Note that a single name can be bound to multiple objects. If the result is " "``True``, the name may also be bound to other objects, like an int or list, " @@ -339,11 +357,11 @@ msgstr "" "請注意,單個名稱可以綁定到多個物件。如果結果為 ``True``,則該名稱也可能被綁定" "到其他物件,例如 int 或 list,而不會引入新的命名空間。" -#: ../../library/symtable.rst:288 +#: ../../library/symtable.rst:289 msgid "Return a list of namespaces bound to this name." msgstr "回傳綁定到該名稱的命名空間的串列。" -#: ../../library/symtable.rst:292 +#: ../../library/symtable.rst:293 msgid "" "Return the namespace bound to this name. If more than one or no namespace is " "bound to this name, a :exc:`ValueError` is raised." @@ -351,32 +369,23 @@ msgstr "" "回傳綁定到該名稱的命名空間。如果該名稱綁定了多個命名空間或沒有命名空間,則會" "引發 :exc:`ValueError`。" -#: ../../library/symtable.rst:299 +#: ../../library/symtable.rst:300 msgid "Command-Line Usage" -msgstr "" +msgstr "命令列用法" -#: ../../library/symtable.rst:303 +#: ../../library/symtable.rst:304 msgid "" "The :mod:`symtable` module can be executed as a script from the command line." -msgstr "" +msgstr ":mod:`symtable` 模組可以從命令列作為腳本執行。" -#: ../../library/symtable.rst:305 +#: ../../library/symtable.rst:306 msgid "python -m symtable [infile...]" -msgstr "" +msgstr "python -m symtable [infile...]" -#: ../../library/symtable.rst:309 +#: ../../library/symtable.rst:310 msgid "" "Symbol tables are generated for the specified Python source files and dumped " "to stdout. If no input file is specified, the content is read from stdin." msgstr "" - -#~ msgid "" -#~ "Return the type of the symbol table. Possible values are ``'class'``, " -#~ "``'module'``, ``'function'``, ``'annotation'``, ``'TypeVar bound'``, " -#~ "``'type alias'``, and ``'type parameter'``. The latter four refer to " -#~ "different flavors of :ref:`annotation scopes `." -#~ msgstr "" -#~ "回傳符號表的種類。可能的值為 ``'class'``、``'module'``、``'function'``、" -#~ "``'annotation'``、``'TypeVar bound'``、``'type alias'`` 和 ``'type " -#~ "parameter'``。後四個是指不同的\\ :ref:`註釋範圍 (annotation scopes) " -#~ "`。" +"為指定的 Python 原始檔產生符號表並轉儲 (dump) 到 stdout。如果未指定輸入檔案," +"則從 stdin 讀取內容。" diff --git a/library/sys.po b/library/sys.po index 32c11aa68d..096b946f75 100644 --- a/library/sys.po +++ b/library/sys.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2023-04-26 02:54+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,10 +42,14 @@ msgid "" "removed)." msgstr "" -#: ../../library/sys.rst:25 ../../library/sys.rst:778 -#: ../../library/sys.rst:1489 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" +#: ../../library/sys.rst:25 ../../library/sys.rst:299 ../../library/sys.rst:369 +#: ../../library/sys.rst:760 ../../library/sys.rst:778 +#: ../../library/sys.rst:991 ../../library/sys.rst:1490 +#: ../../library/sys.rst:1731 ../../library/sys.rst:1746 +#: ../../library/sys.rst:1754 ../../library/sys.rst:1770 +#: ../../library/sys.rst:2014 +msgid "Availability" +msgstr "" #: ../../library/sys.rst:30 msgid "" @@ -381,11 +385,6 @@ msgstr "" msgid "Integer specifying the handle of the Python DLL." msgstr "" -#: ../../library/sys.rst:299 ../../library/sys.rst:991 -#: ../../library/sys.rst:1769 ../../library/sys.rst:2013 -msgid ":ref:`Availability `: Windows." -msgstr ":ref:`適用 `:Windows。" - #: ../../library/sys.rst:304 msgid "" "If *value* is not ``None``, this function prints ``repr(value)`` to ``sys." @@ -470,10 +469,6 @@ msgstr "" msgid "``True`` if Python is compiled with shared memory support." msgstr "" -#: ../../library/sys.rst:369 -msgid ":ref:`Availability `: Emscripten." -msgstr ":ref:`適用 `:Emscripten。" - #: ../../library/sys.rst:376 msgid "" "If this is set (not ``None``), Python will write bytecode-cache ``.pyc`` " @@ -998,10 +993,6 @@ msgid "" "version information, see :func:`platform.android_ver`." msgstr "" -#: ../../library/sys.rst:760 -msgid ":ref:`Availability `: Android." -msgstr ":ref:`適用 `:Android。" - #: ../../library/sys.rst:767 msgid "" "Return the name of the current default string encoding used by the Unicode " @@ -1300,7 +1291,7 @@ msgstr "" msgid "See :pep:`525` for more details." msgstr "更多細節請見 :pep:`525`。" -#: ../../library/sys.rst:1014 ../../library/sys.rst:1701 +#: ../../library/sys.rst:1014 ../../library/sys.rst:1702 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.)" @@ -1312,7 +1303,7 @@ msgid "" "`set_coroutine_origin_tracking_depth`." msgstr "" -#: ../../library/sys.rst:1026 ../../library/sys.rst:1722 +#: ../../library/sys.rst:1026 ../../library/sys.rst:1723 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.) Use it only for debugging purposes." @@ -1588,45 +1579,45 @@ msgid "" "implement Python's default import semantics. The :meth:`~importlib.abc." "MetaPathFinder.find_spec` method is called with at least the absolute name " "of the module being imported. If the module to be imported is contained in a " -"package, then the parent package's :attr:`__path__` attribute is passed in " -"as a second argument. The method returns a :term:`module spec`, or ``None`` " -"if the module cannot be found." +"package, then the parent package's :attr:`~module.__path__` attribute is " +"passed in as a second argument. The method returns a :term:`module spec`, or " +"``None`` if the module cannot be found." msgstr "" -#: ../../library/sys.rst:1283 +#: ../../library/sys.rst:1284 msgid ":class:`importlib.abc.MetaPathFinder`" msgstr ":class:`importlib.abc.MetaPathFinder`" -#: ../../library/sys.rst:1284 +#: ../../library/sys.rst:1285 msgid "" "The abstract base class defining the interface of finder objects on :data:" "`meta_path`." msgstr "" -#: ../../library/sys.rst:1286 +#: ../../library/sys.rst:1287 msgid ":class:`importlib.machinery.ModuleSpec`" msgstr ":class:`importlib.machinery.ModuleSpec`" -#: ../../library/sys.rst:1287 +#: ../../library/sys.rst:1288 msgid "" "The concrete class which :meth:`~importlib.abc.MetaPathFinder.find_spec` " "should return instances of." msgstr "" -#: ../../library/sys.rst:1293 +#: ../../library/sys.rst:1294 msgid "" ":term:`Module specs ` were introduced in Python 3.4, by :pep:" "`451`." msgstr "" -#: ../../library/sys.rst:1298 +#: ../../library/sys.rst:1299 msgid "" "Removed the fallback that looked for a :meth:`!find_module` method if a :" "data:`meta_path` entry didn't have a :meth:`~importlib.abc.MetaPathFinder." "find_spec` method." msgstr "" -#: ../../library/sys.rst:1304 +#: ../../library/sys.rst:1305 msgid "" "This is a dictionary that maps module names to modules which have already " "been loaded. This can be manipulated to force reloading of modules and " @@ -1638,13 +1629,13 @@ msgid "" "other threads." msgstr "" -#: ../../library/sys.rst:1316 +#: ../../library/sys.rst:1317 msgid "" "The list of the original command line arguments passed to the Python " "executable." msgstr "" -#: ../../library/sys.rst:1319 +#: ../../library/sys.rst:1320 msgid "" "The elements of :data:`sys.orig_argv` are the arguments to the Python " "interpreter, while the elements of :data:`sys.argv` are the arguments to the " @@ -1652,68 +1643,68 @@ msgid "" "in :data:`sys.orig_argv` and missing from :data:`sys.argv`." msgstr "" -#: ../../library/sys.rst:1331 +#: ../../library/sys.rst:1332 msgid "" "A list of strings that specifies the search path for modules. Initialized " "from the environment variable :envvar:`PYTHONPATH`, plus an installation-" "dependent default." msgstr "" -#: ../../library/sys.rst:1335 +#: ../../library/sys.rst:1336 msgid "" "By default, as initialized upon program startup, a potentially unsafe path " "is prepended to :data:`sys.path` (*before* the entries inserted as a result " "of :envvar:`PYTHONPATH`):" msgstr "" -#: ../../library/sys.rst:1339 +#: ../../library/sys.rst:1340 msgid "" "``python -m module`` command line: prepend the current working directory." msgstr "" -#: ../../library/sys.rst:1341 +#: ../../library/sys.rst:1342 msgid "" "``python script.py`` command line: prepend the script's directory. If it's a " "symbolic link, resolve symbolic links." msgstr "" -#: ../../library/sys.rst:1343 +#: ../../library/sys.rst:1344 msgid "" "``python -c code`` and ``python`` (REPL) command lines: prepend an empty " "string, which means the current working directory." msgstr "" -#: ../../library/sys.rst:1346 +#: ../../library/sys.rst:1347 msgid "" "To not prepend this potentially unsafe path, use the :option:`-P` command " "line option or the :envvar:`PYTHONSAFEPATH` environment variable." msgstr "" -#: ../../library/sys.rst:1349 +#: ../../library/sys.rst:1350 msgid "" "A program is free to modify this list for its own purposes. Only strings " "should be added to :data:`sys.path`; all other data types are ignored during " "import." msgstr "" -#: ../../library/sys.rst:1355 +#: ../../library/sys.rst:1356 msgid "" "Module :mod:`site` This describes how to use .pth files to extend :data:`sys." "path`." msgstr "" -#: ../../library/sys.rst:1360 +#: ../../library/sys.rst:1361 msgid "" "A list of callables that take a path argument to try to create a :term:" "`finder` for the path. If a finder can be created, it is to be returned by " "the callable, else raise :exc:`ImportError`." msgstr "" -#: ../../library/sys.rst:1364 ../../library/sys.rst:1375 +#: ../../library/sys.rst:1365 ../../library/sys.rst:1376 msgid "Originally specified in :pep:`302`." msgstr "" -#: ../../library/sys.rst:1369 +#: ../../library/sys.rst:1370 msgid "" "A dictionary acting as a cache for :term:`finder` objects. The keys are " "paths that have been passed to :data:`sys.path_hooks` and the values are the " @@ -1721,92 +1712,91 @@ msgid "" "is found on :data:`sys.path_hooks` then ``None`` is stored." msgstr "" -#: ../../library/sys.rst:1380 +#: ../../library/sys.rst:1381 msgid "A string containing a platform identifier. Known values are:" msgstr "" -#: ../../library/sys.rst:1383 +#: ../../library/sys.rst:1384 msgid "System" msgstr "" -#: ../../library/sys.rst:1383 +#: ../../library/sys.rst:1384 msgid "``platform`` value" msgstr "" -#: ../../library/sys.rst:1385 +#: ../../library/sys.rst:1386 msgid "AIX" msgstr "AIX" -#: ../../library/sys.rst:1385 +#: ../../library/sys.rst:1386 msgid "``'aix'``" msgstr "``'aix'``" -#: ../../library/sys.rst:1386 +#: ../../library/sys.rst:1387 msgid "Android" -msgstr "" +msgstr "Android" -#: ../../library/sys.rst:1386 -#, fuzzy +#: ../../library/sys.rst:1387 msgid "``'android'``" -msgstr "``'aix'``" +msgstr "``'android'``" -#: ../../library/sys.rst:1387 +#: ../../library/sys.rst:1388 msgid "Emscripten" msgstr "Emscripten" -#: ../../library/sys.rst:1387 +#: ../../library/sys.rst:1388 msgid "``'emscripten'``" msgstr "``'emscripten'``" -#: ../../library/sys.rst:1388 +#: ../../library/sys.rst:1389 msgid "iOS" -msgstr "" +msgstr "iOS" -#: ../../library/sys.rst:1388 +#: ../../library/sys.rst:1389 msgid "``'ios'``" msgstr "``'ios'``" -#: ../../library/sys.rst:1389 +#: ../../library/sys.rst:1390 msgid "Linux" msgstr "Linux" -#: ../../library/sys.rst:1389 +#: ../../library/sys.rst:1390 msgid "``'linux'``" msgstr "``'linux'``" -#: ../../library/sys.rst:1390 +#: ../../library/sys.rst:1391 msgid "macOS" msgstr "macOS" -#: ../../library/sys.rst:1390 +#: ../../library/sys.rst:1391 msgid "``'darwin'``" msgstr "``'darwin'``" -#: ../../library/sys.rst:1391 +#: ../../library/sys.rst:1392 msgid "Windows" msgstr "Windows" -#: ../../library/sys.rst:1391 +#: ../../library/sys.rst:1392 msgid "``'win32'``" msgstr "``'win32'``" -#: ../../library/sys.rst:1392 +#: ../../library/sys.rst:1393 msgid "Windows/Cygwin" msgstr "Windows/Cygwin" -#: ../../library/sys.rst:1392 +#: ../../library/sys.rst:1393 msgid "``'cygwin'``" msgstr "``'cygwin'``" -#: ../../library/sys.rst:1393 +#: ../../library/sys.rst:1394 msgid "WASI" msgstr "WASI" -#: ../../library/sys.rst:1393 +#: ../../library/sys.rst:1394 msgid "``'wasi'``" msgstr "``'wasi'``" -#: ../../library/sys.rst:1396 +#: ../../library/sys.rst:1397 msgid "" "On Unix systems not listed in the table, the value is the lowercased OS name " "as returned by ``uname -s``, with the first part of the version as returned " @@ -1815,81 +1805,81 @@ msgid "" "version, it is therefore recommended to use the following idiom::" msgstr "" -#: ../../library/sys.rst:1402 +#: ../../library/sys.rst:1403 msgid "" "if sys.platform.startswith('freebsd'):\n" " # FreeBSD-specific code here..." msgstr "" -#: ../../library/sys.rst:1405 +#: ../../library/sys.rst:1406 msgid "" "On Linux, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``." msgstr "" -#: ../../library/sys.rst:1409 +#: ../../library/sys.rst:1410 msgid "" "On AIX, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``." msgstr "" -#: ../../library/sys.rst:1413 +#: ../../library/sys.rst:1414 msgid "" "On Android, :data:`sys.platform` now returns ``'android'`` rather than " "``'linux'``." msgstr "" -#: ../../library/sys.rst:1419 +#: ../../library/sys.rst:1420 msgid "" ":data:`os.name` has a coarser granularity. :func:`os.uname` gives system-" "dependent version information." msgstr "" -#: ../../library/sys.rst:1422 +#: ../../library/sys.rst:1423 msgid "" "The :mod:`platform` module provides detailed checks for the system's " "identity." msgstr "" -#: ../../library/sys.rst:1428 +#: ../../library/sys.rst:1429 msgid "" "Name of the platform-specific library directory. It is used to build the " "path of standard library and the paths of installed extension modules." msgstr "" -#: ../../library/sys.rst:1431 +#: ../../library/sys.rst:1432 msgid "" "It is equal to ``\"lib\"`` on most platforms. On Fedora and SuSE, it is " "equal to ``\"lib64\"`` on 64-bit platforms which gives the following ``sys." "path`` paths (where ``X.Y`` is the Python ``major.minor`` version):" msgstr "" -#: ../../library/sys.rst:1435 +#: ../../library/sys.rst:1436 msgid "" "``/usr/lib64/pythonX.Y/``: Standard library (like ``os.py`` of the :mod:`os` " "module)" msgstr "" -#: ../../library/sys.rst:1437 +#: ../../library/sys.rst:1438 msgid "" "``/usr/lib64/pythonX.Y/lib-dynload/``: C extension modules of the standard " "library (like the :mod:`errno` module, the exact filename is platform " "specific)" msgstr "" -#: ../../library/sys.rst:1440 +#: ../../library/sys.rst:1441 msgid "" "``/usr/lib/pythonX.Y/site-packages/`` (always use ``lib``, not :data:`sys." "platlibdir`): Third-party modules" msgstr "" -#: ../../library/sys.rst:1442 +#: ../../library/sys.rst:1443 msgid "" "``/usr/lib64/pythonX.Y/site-packages/``: C extension modules of third-party " "packages" msgstr "" -#: ../../library/sys.rst:1450 +#: ../../library/sys.rst:1451 msgid "" "A string giving the site-specific directory prefix where the platform " "independent Python files are installed; on Unix, the default is :file:`/usr/" @@ -1898,14 +1888,14 @@ msgid "" "derived paths." msgstr "" -#: ../../library/sys.rst:1456 +#: ../../library/sys.rst:1457 msgid "" "If a :ref:`virtual environment ` is in effect, this value will be " "changed in ``site.py`` to point to the virtual environment. The value for " "the Python installation will still be available, via :data:`base_prefix`." msgstr "" -#: ../../library/sys.rst:1471 +#: ../../library/sys.rst:1472 msgid "" "Strings specifying the primary and secondary prompt of the interpreter. " "These are only defined if the interpreter is in interactive mode. Their " @@ -1915,7 +1905,7 @@ msgid "" "used to implement a dynamic prompt." msgstr "" -#: ../../library/sys.rst:1481 +#: ../../library/sys.rst:1482 msgid "" "Set the flags used by the interpreter for :c:func:`dlopen` calls, such as " "when the interpreter loads extension modules. Among other things, this will " @@ -1926,14 +1916,14 @@ msgid "" "g. :const:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:1493 +#: ../../library/sys.rst:1494 msgid "" "Set the :ref:`integer string conversion length limitation " "` used by this interpreter. See also :func:" "`get_int_max_str_digits`." msgstr "" -#: ../../library/sys.rst:1505 +#: ../../library/sys.rst:1506 msgid "" "Set the system's profile function, which allows you to implement a Python " "source code profiler in Python. See chapter :ref:`profile` for more " @@ -1948,14 +1938,14 @@ msgid "" "in the profile function will cause itself unset." msgstr "" -#: ../../library/sys.rst:1517 +#: ../../library/sys.rst:1518 msgid "" "The same tracing mechanism is used for :func:`!setprofile` as :func:" "`settrace`. To trace calls with :func:`!setprofile` inside a tracing " "function (e.g. in a debugger breakpoint), see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1521 +#: ../../library/sys.rst:1522 msgid "" "Profile functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -1963,71 +1953,71 @@ msgid "" "depends on the event type." msgstr "" -#: ../../library/sys.rst:1526 ../../library/sys.rst:1613 +#: ../../library/sys.rst:1527 ../../library/sys.rst:1614 msgid "The events have the following meaning:" msgstr "" -#: ../../library/sys.rst:1528 ../../library/sys.rst:1615 +#: ../../library/sys.rst:1529 ../../library/sys.rst:1616 msgid "``'call'``" msgstr "``'call'``" -#: ../../library/sys.rst:1529 +#: ../../library/sys.rst:1530 msgid "" "A function is called (or some other code block entered). The profile " "function is called; *arg* is ``None``." msgstr "" -#: ../../library/sys.rst:1532 ../../library/sys.rst:1630 +#: ../../library/sys.rst:1533 ../../library/sys.rst:1631 msgid "``'return'``" msgstr "``'return'``" -#: ../../library/sys.rst:1533 +#: ../../library/sys.rst:1534 msgid "" "A function (or other code block) is about to return. The profile function " "is called; *arg* is the value that will be returned, or ``None`` if the " "event is caused by an exception being raised." msgstr "" -#: ../../library/sys.rst:1537 +#: ../../library/sys.rst:1538 msgid "``'c_call'``" msgstr "``'c_call'``" -#: ../../library/sys.rst:1538 +#: ../../library/sys.rst:1539 msgid "" "A C function is about to be called. This may be an extension function or a " "built-in. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1541 +#: ../../library/sys.rst:1542 msgid "``'c_return'``" msgstr "``'c_return'``" -#: ../../library/sys.rst:1542 +#: ../../library/sys.rst:1543 msgid "A C function has returned. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1544 +#: ../../library/sys.rst:1545 msgid "``'c_exception'``" msgstr "``'c_exception'``" -#: ../../library/sys.rst:1545 +#: ../../library/sys.rst:1546 msgid "A C function has raised an exception. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1547 +#: ../../library/sys.rst:1548 msgid "" "Raises an :ref:`auditing event ` ``sys.setprofile`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.setprofile``。" -#: ../../library/sys.rst:1552 +#: ../../library/sys.rst:1553 msgid "" "Set the maximum depth of the Python interpreter stack to *limit*. This " "limit prevents infinite recursion from causing an overflow of the C stack " "and crashing Python." msgstr "" -#: ../../library/sys.rst:1556 +#: ../../library/sys.rst:1557 msgid "" "The highest possible limit is platform-dependent. A user may need to set " "the limit higher when they have a program that requires deep recursion and a " @@ -2035,19 +2025,19 @@ msgid "" "because a too-high limit can lead to a crash." msgstr "" -#: ../../library/sys.rst:1561 +#: ../../library/sys.rst:1562 msgid "" "If the new limit is too low at the current recursion depth, a :exc:" "`RecursionError` exception is raised." msgstr "" -#: ../../library/sys.rst:1564 +#: ../../library/sys.rst:1565 msgid "" "A :exc:`RecursionError` exception is now raised if the new limit is too low " "at the current recursion depth." msgstr "" -#: ../../library/sys.rst:1571 +#: ../../library/sys.rst:1572 msgid "" "Set the interpreter's thread switch interval (in seconds). This floating-" "point value determines the ideal duration of the \"timeslices\" allocated to " @@ -2058,7 +2048,7 @@ msgid "" "scheduler." msgstr "" -#: ../../library/sys.rst:1588 +#: ../../library/sys.rst:1589 msgid "" "Set the system's trace function, which allows you to implement a Python " "source code debugger in Python. The function is thread-specific; for a " @@ -2067,7 +2057,7 @@ msgid "" "`threading.settrace`." msgstr "" -#: ../../library/sys.rst:1593 +#: ../../library/sys.rst:1594 msgid "" "Trace functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -2075,7 +2065,7 @@ msgid "" "the event type." msgstr "" -#: ../../library/sys.rst:1598 +#: ../../library/sys.rst:1599 msgid "" "The trace function is invoked (with *event* set to ``'call'``) whenever a " "new local scope is entered; it should return a reference to a local trace " @@ -2083,36 +2073,36 @@ msgid "" "traced." msgstr "" -#: ../../library/sys.rst:1603 +#: ../../library/sys.rst:1604 msgid "" "The local trace function should return a reference to itself, or to another " "function which would then be used as the local trace function for the scope." msgstr "" -#: ../../library/sys.rst:1606 +#: ../../library/sys.rst:1607 msgid "" "If there is any error occurred in the trace function, it will be unset, just " "like ``settrace(None)`` is called." msgstr "" -#: ../../library/sys.rst:1610 +#: ../../library/sys.rst:1611 msgid "" "Tracing is disabled while calling the trace function (e.g. a function set " "by :func:`!settrace`). For recursive tracing see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1616 +#: ../../library/sys.rst:1617 msgid "" "A function is called (or some other code block entered). The global trace " "function is called; *arg* is ``None``; the return value specifies the local " "trace function." msgstr "" -#: ../../library/sys.rst:1620 +#: ../../library/sys.rst:1621 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/sys.rst:1621 +#: ../../library/sys.rst:1622 msgid "" "The interpreter is about to execute a new line of code or re-execute the " "condition of a loop. The local trace function is called; *arg* is ``None``; " @@ -2122,7 +2112,7 @@ msgid "" "to :const:`False` on that :ref:`frame `." msgstr "" -#: ../../library/sys.rst:1631 +#: ../../library/sys.rst:1632 msgid "" "A function (or other code block) is about to return. The local trace " "function is called; *arg* is the value that will be returned, or ``None`` if " @@ -2130,22 +2120,22 @@ msgid "" "return value is ignored." msgstr "" -#: ../../library/sys.rst:1636 +#: ../../library/sys.rst:1637 msgid "``'exception'``" msgstr "``'exception'``" -#: ../../library/sys.rst:1637 +#: ../../library/sys.rst:1638 msgid "" "An exception has occurred. The local trace function is called; *arg* is a " "tuple ``(exception, value, traceback)``; the return value specifies the new " "local trace function." msgstr "" -#: ../../library/sys.rst:1641 +#: ../../library/sys.rst:1642 msgid "``'opcode'``" msgstr "``'opcode'``" -#: ../../library/sys.rst:1642 +#: ../../library/sys.rst:1643 msgid "" "The interpreter is about to execute a new opcode (see :mod:`dis` for opcode " "details). The local trace function is called; *arg* is ``None``; the return " @@ -2155,13 +2145,13 @@ msgid "" "objects>`." msgstr "" -#: ../../library/sys.rst:1649 +#: ../../library/sys.rst:1650 msgid "" "Note that as an exception is propagated down the chain of callers, an " "``'exception'`` event is generated at each level." msgstr "" -#: ../../library/sys.rst:1652 +#: ../../library/sys.rst:1653 msgid "" "For more fine-grained usage, it's possible to set a trace function by " "assigning ``frame.f_trace = tracefunc`` explicitly, rather than relying on " @@ -2175,17 +2165,17 @@ msgid "" "on each frame)." msgstr "" -#: ../../library/sys.rst:1663 +#: ../../library/sys.rst:1664 msgid "For more information on code and frame objects, refer to :ref:`types`." msgstr "" -#: ../../library/sys.rst:1665 +#: ../../library/sys.rst:1666 msgid "" "Raises an :ref:`auditing event ` ``sys.settrace`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.settrace``。" -#: ../../library/sys.rst:1669 +#: ../../library/sys.rst:1670 msgid "" "The :func:`settrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -2193,13 +2183,13 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:1676 +#: ../../library/sys.rst:1677 msgid "" "``'opcode'`` event type added; :attr:`~frame.f_trace_lines` and :attr:" "`~frame.f_trace_opcodes` attributes added to frames" msgstr "" -#: ../../library/sys.rst:1681 +#: ../../library/sys.rst:1682 msgid "" "Accepts two optional keyword arguments which are callables that accept an :" "term:`asynchronous generator iterator` as an argument. The *firstiter* " @@ -2208,7 +2198,7 @@ msgid "" "about to be garbage collected." msgstr "" -#: ../../library/sys.rst:1687 +#: ../../library/sys.rst:1688 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_firstiter`` with no arguments." @@ -2216,7 +2206,7 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." "set_asyncgen_hooks_firstiter``。" -#: ../../library/sys.rst:1689 +#: ../../library/sys.rst:1690 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_finalizer`` with no arguments." @@ -2224,20 +2214,20 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." "set_asyncgen_hooks_finalizer``。" -#: ../../library/sys.rst:1691 +#: ../../library/sys.rst:1692 msgid "" "Two auditing events are raised because the underlying API consists of two " "calls, each of which must raise its own event." msgstr "" -#: ../../library/sys.rst:1694 +#: ../../library/sys.rst:1695 msgid "" "See :pep:`525` for more details, and for a reference example of a " "*finalizer* method see the implementation of ``asyncio.Loop." "shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`" msgstr "" -#: ../../library/sys.rst:1706 +#: ../../library/sys.rst:1707 msgid "" "Allows enabling or disabling coroutine origin tracking. When enabled, the " "``cr_origin`` attribute on coroutine objects will contain a tuple of " @@ -2246,116 +2236,111 @@ msgid "" "disabled, ``cr_origin`` will be ``None``." msgstr "" -#: ../../library/sys.rst:1713 +#: ../../library/sys.rst:1714 msgid "" "To enable, pass a *depth* value greater than zero; this sets the number of " "frames whose information will be captured. To disable, pass set *depth* to " "zero." msgstr "" -#: ../../library/sys.rst:1717 +#: ../../library/sys.rst:1718 msgid "This setting is thread-specific." msgstr "" -#: ../../library/sys.rst:1727 +#: ../../library/sys.rst:1728 msgid "" "Activate the stack profiler trampoline *backend*. The only supported backend " "is ``\"perf\"``." msgstr "" -#: ../../library/sys.rst:1730 ../../library/sys.rst:1745 -#: ../../library/sys.rst:1753 -msgid ":ref:`Availability `: Linux." -msgstr ":ref:`適用 `:Linux。" - -#: ../../library/sys.rst:1736 +#: ../../library/sys.rst:1737 msgid ":ref:`perf_profiling`" msgstr ":ref:`perf_profiling`" -#: ../../library/sys.rst:1737 +#: ../../library/sys.rst:1738 msgid "https://perf.wiki.kernel.org/" msgstr "https://perf.wiki.kernel.org/" -#: ../../library/sys.rst:1741 +#: ../../library/sys.rst:1742 msgid "Deactivate the current stack profiler trampoline backend." msgstr "" -#: ../../library/sys.rst:1743 +#: ../../library/sys.rst:1744 msgid "If no stack profiler is activated, this function has no effect." msgstr "" -#: ../../library/sys.rst:1751 +#: ../../library/sys.rst:1752 msgid "Return ``True`` if a stack profiler trampoline is active." msgstr "" -#: ../../library/sys.rst:1759 +#: ../../library/sys.rst:1760 msgid "" "Changes the :term:`filesystem encoding and error handler` to 'mbcs' and " "'replace' respectively, for consistency with versions of Python prior to 3.6." msgstr "" -#: ../../library/sys.rst:1763 +#: ../../library/sys.rst:1764 msgid "" "This is equivalent to defining the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable before launching Python." msgstr "" -#: ../../library/sys.rst:1766 +#: ../../library/sys.rst:1767 msgid "" "See also :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors`." msgstr "" -#: ../../library/sys.rst:1772 +#: ../../library/sys.rst:1773 msgid "" "Changing the filesystem encoding after Python startup is risky because the " "old fsencoding or paths encoded by the old fsencoding may be cached " "somewhere. Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." msgstr "" -#: ../../library/sys.rst:1776 +#: ../../library/sys.rst:1777 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`。" -#: ../../library/sys.rst:1779 +#: ../../library/sys.rst:1780 msgid "Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." msgstr "" -#: ../../library/sys.rst:1786 +#: ../../library/sys.rst:1787 msgid "" ":term:`File objects ` used by the interpreter for standard " "input, output and errors:" msgstr "" -#: ../../library/sys.rst:1789 +#: ../../library/sys.rst:1790 msgid "" "``stdin`` is used for all interactive input (including calls to :func:" "`input`);" msgstr "" -#: ../../library/sys.rst:1791 +#: ../../library/sys.rst:1792 msgid "" "``stdout`` is used for the output of :func:`print` and :term:`expression` " "statements and for the prompts of :func:`input`;" msgstr "" -#: ../../library/sys.rst:1793 +#: ../../library/sys.rst:1794 msgid "The interpreter's own prompts and its error messages go to ``stderr``." msgstr "" -#: ../../library/sys.rst:1795 +#: ../../library/sys.rst:1796 msgid "" "These streams are regular :term:`text files ` like those returned " "by the :func:`open` function. Their parameters are chosen as follows:" msgstr "" -#: ../../library/sys.rst:1799 +#: ../../library/sys.rst:1800 msgid "" "The encoding and error handling are is initialized from :c:member:`PyConfig." "stdio_encoding` and :c:member:`PyConfig.stdio_errors`." msgstr "" -#: ../../library/sys.rst:1802 +#: ../../library/sys.rst:1803 msgid "" "On Windows, UTF-8 is used for the console device. Non-character devices " "such as disk files and pipes use the system locale encoding (i.e. the ANSI " @@ -2366,14 +2351,14 @@ msgid "" "initially attached to a console." msgstr "" -#: ../../library/sys.rst:1811 +#: ../../library/sys.rst:1812 msgid "" "The special behaviour of the console can be overridden by setting the " "environment variable PYTHONLEGACYWINDOWSSTDIO before starting Python. In " "that case, the console codepages are used as for any other character device." msgstr "" -#: ../../library/sys.rst:1816 +#: ../../library/sys.rst:1817 msgid "" "Under all platforms, you can override the character encoding by setting the :" "envvar:`PYTHONIOENCODING` environment variable before starting Python or by " @@ -2382,7 +2367,7 @@ msgid "" "only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set." msgstr "" -#: ../../library/sys.rst:1823 +#: ../../library/sys.rst:1824 msgid "" "When interactive, the ``stdout`` stream is line-buffered. Otherwise, it is " "block-buffered like regular text files. The ``stderr`` stream is line-" @@ -2391,19 +2376,19 @@ msgid "" "`PYTHONUNBUFFERED` environment variable." msgstr "" -#: ../../library/sys.rst:1829 +#: ../../library/sys.rst:1830 msgid "" "Non-interactive ``stderr`` is now line-buffered instead of fully buffered." msgstr "" -#: ../../library/sys.rst:1835 +#: ../../library/sys.rst:1836 msgid "" "To write or read binary data from/to the standard streams, use the " "underlying binary :data:`~io.TextIOBase.buffer` object. For example, to " "write bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``." msgstr "" -#: ../../library/sys.rst:1839 +#: ../../library/sys.rst:1840 msgid "" "However, if you are writing a library (and do not control in which context " "its code will be executed), be aware that the standard streams may be " @@ -2411,7 +2396,7 @@ msgid "" "support the :attr:`!buffer` attribute." msgstr "" -#: ../../library/sys.rst:1849 +#: ../../library/sys.rst:1850 msgid "" "These objects contain the original values of ``stdin``, ``stderr`` and " "``stdout`` at the start of the program. They are used during finalization, " @@ -2419,7 +2404,7 @@ msgid "" "``sys.std*`` object has been redirected." msgstr "" -#: ../../library/sys.rst:1854 +#: ../../library/sys.rst:1855 msgid "" "It can also be used to restore the actual files to known working file " "objects in case they have been overwritten with a broken object. However, " @@ -2427,7 +2412,7 @@ msgid "" "before replacing it, and restore the saved object." msgstr "" -#: ../../library/sys.rst:1860 +#: ../../library/sys.rst:1861 msgid "" "Under some conditions ``stdin``, ``stdout`` and ``stderr`` as well as the " "original values ``__stdin__``, ``__stdout__`` and ``__stderr__`` can be " @@ -2435,12 +2420,12 @@ msgid "" "to a console and Python apps started with :program:`pythonw`." msgstr "" -#: ../../library/sys.rst:1868 +#: ../../library/sys.rst:1869 msgid "" "A frozenset of strings containing the names of standard library modules." msgstr "" -#: ../../library/sys.rst:1870 +#: ../../library/sys.rst:1871 msgid "" "It is the same on all platforms. Modules which are not available on some " "platforms and modules disabled at Python build are also listed. All module " @@ -2448,7 +2433,7 @@ msgid "" "modules are excluded." msgstr "" -#: ../../library/sys.rst:1875 +#: ../../library/sys.rst:1876 msgid "" "For packages, only the main package is listed: sub-packages and sub-modules " "are not listed. For example, the ``email`` package is listed, but the " @@ -2456,60 +2441,60 @@ msgid "" "listed." msgstr "" -#: ../../library/sys.rst:1880 +#: ../../library/sys.rst:1881 msgid "See also the :data:`sys.builtin_module_names` list." msgstr "另請參閱 :attr:`sys.builtin_module_names` 清單。" -#: ../../library/sys.rst:1887 +#: ../../library/sys.rst:1888 msgid "" "A :term:`named tuple` holding information about the thread implementation." msgstr "" -#: ../../library/sys.rst:1892 +#: ../../library/sys.rst:1893 msgid "The name of the thread implementation:" msgstr "" -#: ../../library/sys.rst:1894 +#: ../../library/sys.rst:1895 msgid "``\"nt\"``: Windows threads" msgstr "``\"nt\"``: Windows 執行緒" -#: ../../library/sys.rst:1895 +#: ../../library/sys.rst:1896 msgid "``\"pthread\"``: POSIX threads" msgstr "``\"pthread\"``: POSIX 執行緒" -#: ../../library/sys.rst:1896 +#: ../../library/sys.rst:1897 msgid "" "``\"pthread-stubs\"``: stub POSIX threads (on WebAssembly platforms without " "threading support)" msgstr "" -#: ../../library/sys.rst:1898 +#: ../../library/sys.rst:1899 msgid "``\"solaris\"``: Solaris threads" msgstr "" -#: ../../library/sys.rst:1902 +#: ../../library/sys.rst:1903 msgid "The name of the lock implementation:" msgstr "" -#: ../../library/sys.rst:1904 +#: ../../library/sys.rst:1905 msgid "``\"semaphore\"``: a lock uses a semaphore" msgstr "" -#: ../../library/sys.rst:1905 +#: ../../library/sys.rst:1906 msgid "``\"mutex+cond\"``: a lock uses a mutex and a condition variable" msgstr "" -#: ../../library/sys.rst:1906 +#: ../../library/sys.rst:1907 msgid "``None`` if this information is unknown" msgstr "為 ``None`` 表示此資訊未知" -#: ../../library/sys.rst:1910 +#: ../../library/sys.rst:1911 msgid "" "The name and version of the thread library. It is a string, or ``None`` if " "this information is unknown." msgstr "" -#: ../../library/sys.rst:1918 +#: ../../library/sys.rst:1919 msgid "" "When this variable is set to an integer value, it determines the maximum " "number of levels of traceback information printed when an unhandled " @@ -2518,73 +2503,73 @@ msgid "" "are printed." msgstr "" -#: ../../library/sys.rst:1926 +#: ../../library/sys.rst:1927 msgid "Handle an unraisable exception." msgstr "處理一個不可被引發的例外。" -#: ../../library/sys.rst:1928 +#: ../../library/sys.rst:1929 msgid "" "Called when an exception has occurred but there is no way for Python to " "handle it. For example, when a destructor raises an exception or during " "garbage collection (:func:`gc.collect`)." msgstr "" -#: ../../library/sys.rst:1932 +#: ../../library/sys.rst:1933 msgid "The *unraisable* argument has the following attributes:" msgstr "" -#: ../../library/sys.rst:1934 +#: ../../library/sys.rst:1935 msgid ":attr:`!exc_type`: Exception type." msgstr ":attr:`!exc_type`: 例外型別。" -#: ../../library/sys.rst:1935 +#: ../../library/sys.rst:1936 msgid ":attr:`!exc_value`: Exception value, can be ``None``." msgstr ":attr:`!exc_value`: 例外值,可以為 ``None``。" -#: ../../library/sys.rst:1936 +#: ../../library/sys.rst:1937 msgid ":attr:`!exc_traceback`: Exception traceback, can be ``None``." msgstr ":attr:`!exc_traceback`: 例外追蹤,可以為 ``None``。" -#: ../../library/sys.rst:1937 +#: ../../library/sys.rst:1938 msgid ":attr:`!err_msg`: Error message, can be ``None``." msgstr ":attr:`!err_msg`: 錯誤訊息,可以為 ``None``。" -#: ../../library/sys.rst:1938 +#: ../../library/sys.rst:1939 msgid ":attr:`!object`: Object causing the exception, can be ``None``." msgstr ":attr:`!object`: 導致例外的物件,可以為 ``None``。" -#: ../../library/sys.rst:1940 +#: ../../library/sys.rst:1941 msgid "" "The default hook formats :attr:`!err_msg` and :attr:`!object` as: " "``f'{err_msg}: {object!r}'``; use \"Exception ignored in\" error message if :" "attr:`!err_msg` is ``None``." msgstr "" -#: ../../library/sys.rst:1944 +#: ../../library/sys.rst:1945 msgid "" ":func:`sys.unraisablehook` can be overridden to control how unraisable " "exceptions are handled." msgstr "" -#: ../../library/sys.rst:1949 +#: ../../library/sys.rst:1950 msgid ":func:`excepthook` which handles uncaught exceptions." msgstr "處理未被捕捉到例外的 :func:`excepthook`。" -#: ../../library/sys.rst:1953 +#: ../../library/sys.rst:1954 msgid "" "Storing :attr:`!exc_value` using a custom hook can create a reference cycle. " "It should be cleared explicitly to break the reference cycle when the " "exception is no longer needed." msgstr "" -#: ../../library/sys.rst:1957 +#: ../../library/sys.rst:1958 msgid "" "Storing :attr:`!object` using a custom hook can resurrect it if it is set to " "an object which is being finalized. Avoid storing :attr:`!object` after the " "custom hook completes to avoid resurrecting objects." msgstr "" -#: ../../library/sys.rst:1961 ../../library/sys.rst:1963 +#: ../../library/sys.rst:1962 ../../library/sys.rst:1964 msgid "" "Raise an auditing event ``sys.unraisablehook`` with arguments *hook*, " "*unraisable* when an exception that cannot be handled occurs. The " @@ -2592,7 +2577,7 @@ msgid "" "hook has been set, *hook* may be ``None``." msgstr "" -#: ../../library/sys.rst:1972 +#: ../../library/sys.rst:1973 msgid "" "A string containing the version number of the Python interpreter plus " "additional information on the build number and compiler used. This string " @@ -2601,13 +2586,13 @@ msgid "" "functions provided by the :mod:`platform` module." msgstr "" -#: ../../library/sys.rst:1981 +#: ../../library/sys.rst:1982 msgid "" "The C API version for this interpreter. Programmers may find this useful " "when debugging version conflicts between Python and extension modules." msgstr "" -#: ../../library/sys.rst:1987 +#: ../../library/sys.rst:1988 msgid "" "A tuple containing the five components of the version number: *major*, " "*minor*, *micro*, *releaselevel*, and *serial*. All values except " @@ -2618,18 +2603,18 @@ msgid "" "version_info.major`` and so on." msgstr "" -#: ../../library/sys.rst:1995 +#: ../../library/sys.rst:1996 msgid "Added named component attributes." msgstr "新增了附名的元件屬性。" -#: ../../library/sys.rst:2000 +#: ../../library/sys.rst:2001 msgid "" "This is an implementation detail of the warnings framework; do not modify " "this value. Refer to the :mod:`warnings` module for more information on the " "warnings framework." msgstr "" -#: ../../library/sys.rst:2007 +#: ../../library/sys.rst:2008 msgid "" "The version number used to form registry keys on Windows platforms. This is " "stored as string resource 1000 in the Python DLL. The value is normally the " @@ -2638,20 +2623,20 @@ msgid "" "has no effect on the registry keys used by Python." msgstr "" -#: ../../library/sys.rst:2019 +#: ../../library/sys.rst:2020 msgid "" "Namespace containing functions and constants for register callbacks and " "controlling monitoring events. See :mod:`sys.monitoring` for details." msgstr "" -#: ../../library/sys.rst:2025 +#: ../../library/sys.rst:2026 msgid "" "A dictionary of the various implementation-specific flags passed through " "the :option:`-X` command-line option. Option names are either mapped to " "their values, if given explicitly, or to :const:`True`. Example:" msgstr "" -#: ../../library/sys.rst:2029 +#: ../../library/sys.rst:2030 msgid "" "$ ./python -Xa=b -Xc\n" "Python 3.2a3+ (py3k, Oct 16 2010, 20:14:50)\n" @@ -2671,18 +2656,18 @@ msgstr "" ">>> sys._xoptions\n" "{'a': 'b', 'c': True}" -#: ../../library/sys.rst:2041 +#: ../../library/sys.rst:2042 msgid "" "This is a CPython-specific way of accessing options passed through :option:`-" "X`. Other implementations may export them through other means, or not at " "all." msgstr "" -#: ../../library/sys.rst:2049 +#: ../../library/sys.rst:2050 msgid "Citations" msgstr "引用" -#: ../../library/sys.rst:2050 +#: ../../library/sys.rst:2051 msgid "" "ISO/IEC 9899:1999. \"Programming languages -- C.\" A public draft of this " "standard is available at https://www.open-std.org/jtc1/sc22/wg14/www/docs/" @@ -2703,50 +2688,50 @@ msgstr "object(物件)" msgid "traceback" msgstr "traceback" -#: ../../library/sys.rst:925 ../../library/sys.rst:1501 +#: ../../library/sys.rst:925 ../../library/sys.rst:1502 msgid "profile function" msgstr "" -#: ../../library/sys.rst:925 ../../library/sys.rst:1501 +#: ../../library/sys.rst:925 ../../library/sys.rst:1502 msgid "profiler" msgstr "" -#: ../../library/sys.rst:934 ../../library/sys.rst:1584 +#: ../../library/sys.rst:934 ../../library/sys.rst:1585 msgid "trace function" msgstr "" -#: ../../library/sys.rst:934 ../../library/sys.rst:1584 +#: ../../library/sys.rst:934 ../../library/sys.rst:1585 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/sys.rst:1329 +#: ../../library/sys.rst:1330 msgid "module" msgstr "module(模組)" -#: ../../library/sys.rst:1329 +#: ../../library/sys.rst:1330 msgid "search" msgstr "search(搜尋)" -#: ../../library/sys.rst:1329 +#: ../../library/sys.rst:1330 msgid "path" msgstr "path(路徑)" -#: ../../library/sys.rst:1465 +#: ../../library/sys.rst:1466 msgid "interpreter prompts" msgstr "interpreter prompts(直譯器提示)" -#: ../../library/sys.rst:1465 +#: ../../library/sys.rst:1466 msgid "prompts, interpreter" msgstr "prompts, interpreter(提示、直譯器)" -#: ../../library/sys.rst:1465 +#: ../../library/sys.rst:1466 msgid ">>>" msgstr ">>>" -#: ../../library/sys.rst:1465 +#: ../../library/sys.rst:1466 msgid "interpreter prompt" msgstr "interpreter prompt(直譯器提示)" -#: ../../library/sys.rst:1465 +#: ../../library/sys.rst:1466 msgid "..." msgstr "..." diff --git a/library/syslog.po b/library/syslog.po index 9fb0489e10..80f33bd74f 100644 --- a/library/syslog.po +++ b/library/syslog.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,9 +30,8 @@ msgid "" msgstr "" #: ../../library/syslog.rst:14 -#, fuzzy -msgid ":ref:`Availability `: Unix, not WASI, not iOS." -msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" +msgid "Availability" +msgstr "" #: ../../library/syslog.rst:16 msgid "" diff --git a/library/termios.po b/library/termios.po index d801678336..20ce680561 100644 --- a/library/termios.po +++ b/library/termios.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,8 +31,8 @@ msgid "" msgstr "" #: ../../library/termios.rst:19 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" +msgid "Availability" +msgstr "" #: ../../library/termios.rst:21 msgid "" diff --git a/library/threading.po b/library/threading.po index 35adbe0595..4fc83a7965 100644 --- a/library/threading.po +++ b/library/threading.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -73,9 +73,10 @@ msgid "" "appropriate model if you want to run multiple I/O-bound tasks simultaneously." msgstr "" -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +#: ../../library/threading.rst:130 ../../library/threading.rst:229 +#: ../../library/threading.rst:468 ../../includes/wasm-notavail.rst:3 +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -195,12 +196,6 @@ msgid "" "after which the value may be recycled by the OS)." msgstr "" -#: ../../library/threading.rst:130 -msgid "" -":ref:`Availability `: Windows, FreeBSD, Linux, macOS, OpenBSD, " -"NetBSD, AIX, DragonFlyBSD, GNU/kFreeBSD." -msgstr "" - #: ../../library/threading.rst:134 msgid "Added support for GNU/kFreeBSD." msgstr "" @@ -285,10 +280,6 @@ msgid "" "information)." msgstr "" -#: ../../library/threading.rst:229 -msgid ":ref:`Availability `: Windows, pthreads." -msgstr ":ref:`適用 `:Windows, pthreads。" - #: ../../library/threading.rst:231 msgid "Unix platforms with POSIX threads support." msgstr "" @@ -633,12 +624,6 @@ msgid "" "terminated." msgstr "" -#: ../../library/threading.rst:468 -msgid "" -":ref:`Availability `: Windows, FreeBSD, Linux, macOS, OpenBSD, " -"NetBSD, AIX, DragonFlyBSD." -msgstr "" - #: ../../library/threading.rst:474 msgid "Return whether the thread is alive." msgstr "" diff --git a/library/time.po b/library/time.po index a31807549b..c3f7ef4998 100644 --- a/library/time.po +++ b/library/time.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2024-08-14 16:05+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -263,9 +263,19 @@ msgstr "" "傳遞無效或過期的 *thread_id* 可能會導致未定義的行為,例如分段錯誤 " "(segmentation fault)。" -#: ../../library/time.rst:149 -msgid ":ref:`Availability `: Unix" -msgstr ":ref:`適用 `:Unix" +#: ../../library/time.rst:149 ../../library/time.rst:161 +#: ../../library/time.rst:174 ../../library/time.rst:183 +#: ../../library/time.rst:196 ../../library/time.rst:205 +#: ../../library/time.rst:721 ../../library/time.rst:745 +#: ../../library/time.rst:841 ../../library/time.rst:852 +#: ../../library/time.rst:862 ../../library/time.rst:872 +#: ../../library/time.rst:881 ../../library/time.rst:890 +#: ../../library/time.rst:899 ../../library/time.rst:910 +#: ../../library/time.rst:918 ../../library/time.rst:929 +#: ../../library/time.rst:940 ../../library/time.rst:949 +#: ../../library/time.rst:962 +msgid "Availability" +msgstr "" #: ../../library/time.rst:151 msgid "" @@ -281,13 +291,6 @@ msgstr "" "回傳指定時鐘 *clk_id* 的解析度(精確度)。有關 *clk_id* 可接受的值的串列,請" "參閱 :ref:`time-clock-id-constants`。" -#: ../../library/time.rst:161 ../../library/time.rst:174 -#: ../../library/time.rst:183 ../../library/time.rst:745 -#: ../../library/time.rst:862 ../../library/time.rst:890 -#: ../../library/time.rst:918 ../../library/time.rst:962 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" - #: ../../library/time.rst:168 msgid "" "Return the time of the specified clock *clk_id*. Refer to :ref:`time-clock-" @@ -323,10 +326,6 @@ msgid "" msgstr "" "使用 :func:`clock_settime_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:196 ../../library/time.rst:205 -msgid ":ref:`Availability `: Unix, not Android, not iOS." -msgstr ":ref:`適用 `:Unix、非 Android、非 iOS。" - #: ../../library/time.rst:203 msgid "Similar to :func:`clock_settime` but set time with nanoseconds." msgstr "類似於 :func:`clock_settime`,但設定以奈秒為單位的時間。" @@ -1273,10 +1272,6 @@ msgid "" "`float` type." msgstr "" -#: ../../library/time.rst:721 -msgid ":ref:`Availability `: Linux, Unix, Windows." -msgstr ":ref:`適用 `:Linux、Unix、Windows。" - #: ../../library/time.rst:723 msgid "Unix systems supporting ``CLOCK_THREAD_CPUTIME_ID``." msgstr "" @@ -1458,10 +1453,6 @@ msgid "" "similar." msgstr "" -#: ../../library/time.rst:841 -msgid ":ref:`Availability `: Linux >= 2.6.39." -msgstr ":ref:`適用 `:Linux 2.6.39 以上。" - #: ../../library/time.rst:848 msgid "" "The Solaris OS has a ``CLOCK_HIGHRES`` timer that attempts to use an optimal " @@ -1469,10 +1460,6 @@ msgid "" "``CLOCK_HIGHRES`` is the nonadjustable, high-resolution clock." msgstr "" -#: ../../library/time.rst:852 -msgid ":ref:`Availability `: Solaris." -msgstr ":ref:`適用 `:Solaris。" - #: ../../library/time.rst:859 msgid "" "Clock that cannot be set and represents monotonic time since some " @@ -1485,29 +1472,16 @@ msgid "" "based time that is not subject to NTP adjustments." msgstr "" -#: ../../library/time.rst:872 -msgid ":ref:`Availability `: Linux >= 2.6.28, macOS >= 10.12." -msgstr ":ref:`適用 `:Linux 2.6.28 以上、macOS 10.12 以上。" - #: ../../library/time.rst:878 msgid "" "Similar to :data:`CLOCK_MONOTONIC_RAW`, but reads a value cached by the " "system at context switch and hence has less accuracy." msgstr "" -#: ../../library/time.rst:881 ../../library/time.rst:940 -#: ../../library/time.rst:949 -msgid ":ref:`Availability `: macOS >= 10.12." -msgstr ":ref:`適用 `:macOS 10.12 以上。" - #: ../../library/time.rst:888 ../../library/time.rst:897 msgid "High-resolution per-process timer from the CPU." msgstr "" -#: ../../library/time.rst:899 -msgid ":ref:`Availability `: FreeBSD, NetBSD >= 7, OpenBSD." -msgstr ":ref:`適用 `:FreeBSD、NetBSD 7 以上、OpenBSD。" - #: ../../library/time.rst:905 msgid "" "`International Atomic Time `: Linux." -msgstr ":ref:`適用 `:Linux。" - #: ../../library/time.rst:916 msgid "Thread-specific CPU-time clock." msgstr "" @@ -1534,10 +1504,6 @@ msgid "" "suspended, providing accurate uptime measurement, both absolute and interval." msgstr "" -#: ../../library/time.rst:929 -msgid ":ref:`Availability `: FreeBSD, OpenBSD >= 5.5." -msgstr ":ref:`適用 `:FreeBSD、OpenBSD 5.5 以上。" - #: ../../library/time.rst:936 msgid "" "Clock that increments monotonically, tracking the time since an arbitrary " @@ -1695,36 +1661,3 @@ msgstr "% (百分號)" #: ../../library/time.rst:416 ../../library/time.rst:562 msgid "datetime format" msgstr "datetime format(日期時間格式)" - -#~ msgid ":attr:`tm_year`" -#~ msgstr ":attr:`tm_year`" - -#~ msgid ":attr:`tm_mon`" -#~ msgstr ":attr:`tm_mon`" - -#~ msgid ":attr:`tm_mday`" -#~ msgstr ":attr:`tm_mday`" - -#~ msgid ":attr:`tm_hour`" -#~ msgstr ":attr:`tm_hour`" - -#~ msgid ":attr:`tm_min`" -#~ msgstr ":attr:`tm_min`" - -#~ msgid ":attr:`tm_sec`" -#~ msgstr ":attr:`tm_sec`" - -#~ msgid ":attr:`tm_wday`" -#~ msgstr ":attr:`tm_wday`" - -#~ msgid ":attr:`tm_yday`" -#~ msgstr ":attr:`tm_yday`" - -#~ msgid ":attr:`tm_isdst`" -#~ msgstr ":attr:`tm_isdst`" - -#~ msgid ":attr:`tm_zone`" -#~ msgstr ":attr:`tm_zone`" - -#~ msgid ":attr:`tm_gmtoff`" -#~ msgstr ":attr:`tm_gmtoff`" diff --git a/library/traceback.po b/library/traceback.po index 5d2a56c436..b2fbc3ea87 100644 --- a/library/traceback.po +++ b/library/traceback.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,13 +29,16 @@ msgstr "**原始碼:**\\ :source:`Lib/traceback.py`" #: ../../library/traceback.rst:11 msgid "" "This module provides a standard interface to extract, format and print stack " -"traces of Python programs. It exactly mimics the behavior of the Python " -"interpreter when it prints a stack trace. This is useful when you want to " -"print stack traces under program control, such as in a \"wrapper\" around " -"the interpreter." +"traces of Python programs. It is more flexible than the interpreter's " +"default traceback display, and therefore makes it possible to configure " +"certain aspects of the output. Finally, it contains a utility for capturing " +"enough information about an exception to print it later, without the need to " +"save a reference to the actual exception. Since exceptions can be the roots " +"of large objects graph, this utility can significantly improve memory " +"management." msgstr "" -#: ../../library/traceback.rst:19 +#: ../../library/traceback.rst:23 msgid "" "The module uses :ref:`traceback objects ` --- these are " "objects of type :class:`types.TracebackType`, which are assigned to the :" @@ -43,29 +46,48 @@ msgid "" "instances." msgstr "" -#: ../../library/traceback.rst:26 +#: ../../library/traceback.rst:30 msgid "Module :mod:`faulthandler`" msgstr ":mod:`faulthandler` 模組" -#: ../../library/traceback.rst:27 +#: ../../library/traceback.rst:31 msgid "" "Used to dump Python tracebacks explicitly, on a fault, after a timeout, or " "on a user signal." msgstr "" -#: ../../library/traceback.rst:29 +#: ../../library/traceback.rst:33 msgid "Module :mod:`pdb`" msgstr ":mod:`pdb` 模組" -#: ../../library/traceback.rst:30 +#: ../../library/traceback.rst:34 msgid "Interactive source code debugger for Python programs." msgstr "" -#: ../../library/traceback.rst:32 -msgid "The module defines the following functions:" -msgstr "此模組定義了以下函式:" - #: ../../library/traceback.rst:36 +msgid "The module's API can be divided into two parts:" +msgstr "" + +#: ../../library/traceback.rst:38 +msgid "" +"Module-level functions offering basic functionality, which are useful for " +"interactive inspection of exceptions and tracebacks." +msgstr "" + +#: ../../library/traceback.rst:41 +msgid "" +":class:`TracebackException` class and its helper classes :class:" +"`StackSummary` and :class:`FrameSummary`. These offer both more flexibility " +"in the output generated and the ability to store the information necessary " +"for later formatting without holding references to actual exception and " +"traceback objects." +msgstr "" + +#: ../../library/traceback.rst:49 +msgid "Module-Level Functions" +msgstr "" + +#: ../../library/traceback.rst:53 msgid "" "Print up to *limit* stack trace entries from :ref:`traceback object " "` *tb* (starting from the caller's frame) if *limit* is " @@ -76,7 +98,7 @@ msgid "" "output." msgstr "" -#: ../../library/traceback.rst:47 +#: ../../library/traceback.rst:64 msgid "" "The meaning of the *limit* parameter is different than the meaning of :const:" "`sys.tracebacklimit`. A negative *limit* value corresponds to a positive " @@ -84,42 +106,42 @@ msgid "" "*limit* value cannot be achieved with :const:`!sys.tracebacklimit`." msgstr "" -#: ../../library/traceback.rst:53 ../../library/traceback.rst:118 +#: ../../library/traceback.rst:70 ../../library/traceback.rst:135 msgid "Added negative *limit* support." msgstr "新增負數 *limit* 的支援。" -#: ../../library/traceback.rst:60 +#: ../../library/traceback.rst:77 msgid "" "Print exception information and stack trace entries from :ref:`traceback " "object ` *tb* to *file*. This differs from :func:" "`print_tb` in the following ways:" msgstr "" -#: ../../library/traceback.rst:65 +#: ../../library/traceback.rst:82 msgid "" "if *tb* is not ``None``, it prints a header ``Traceback (most recent call " "last):``" msgstr "" -#: ../../library/traceback.rst:68 +#: ../../library/traceback.rst:85 msgid "it prints the exception type and *value* after the stack trace" msgstr "" -#: ../../library/traceback.rst:72 +#: ../../library/traceback.rst:89 msgid "" "if *type(value)* is :exc:`SyntaxError` and *value* has the appropriate " "format, it prints the line where the syntax error occurred with a caret " "indicating the approximate position of the error." msgstr "" -#: ../../library/traceback.rst:76 +#: ../../library/traceback.rst:93 msgid "" "Since Python 3.10, instead of passing *value* and *tb*, an exception object " "can be passed as the first argument. If *value* and *tb* are provided, the " "first argument is ignored in order to provide backwards compatibility." msgstr "" -#: ../../library/traceback.rst:80 +#: ../../library/traceback.rst:97 msgid "" "The optional *limit* argument has the same meaning as for :func:`print_tb`. " "If *chain* is true (the default), then chained exceptions (the :attr:" @@ -128,29 +150,29 @@ msgid "" "when printing an unhandled exception." msgstr "" -#: ../../library/traceback.rst:87 ../../library/traceback.rst:191 +#: ../../library/traceback.rst:104 ../../library/traceback.rst:208 msgid "The *etype* argument is ignored and inferred from the type of *value*." msgstr "" -#: ../../library/traceback.rst:90 ../../library/traceback.rst:171 +#: ../../library/traceback.rst:107 ../../library/traceback.rst:188 msgid "" "The *etype* parameter has been renamed to *exc* and is now positional-only." msgstr "" -#: ../../library/traceback.rst:97 +#: ../../library/traceback.rst:114 msgid "" "This is a shorthand for ``print_exception(sys.exception(), limit, file, " "chain)``." msgstr "" -#: ../../library/traceback.rst:103 +#: ../../library/traceback.rst:120 msgid "" "This is a shorthand for ``print_exception(sys.last_exc, limit, file, " "chain)``. In general it will work only after an exception has reached an " "interactive prompt (see :data:`sys.last_exc`)." msgstr "" -#: ../../library/traceback.rst:110 +#: ../../library/traceback.rst:127 msgid "" "Print up to *limit* stack trace entries (starting from the invocation point) " "if *limit* is positive. Otherwise, print the last ``abs(limit)`` entries. " @@ -160,7 +182,7 @@ msgid "" "for :func:`print_tb`." msgstr "" -#: ../../library/traceback.rst:124 +#: ../../library/traceback.rst:141 msgid "" "Return a :class:`StackSummary` object representing a list of \"pre-" "processed\" stack trace entries extracted from the :ref:`traceback object " @@ -173,7 +195,7 @@ msgid "" "for a stack trace." msgstr "" -#: ../../library/traceback.rst:137 +#: ../../library/traceback.rst:154 msgid "" "Extract the raw traceback from the current :ref:`stack frame `. The return value has the same format as for :func:`extract_tb`. " @@ -181,7 +203,7 @@ msgid "" "`print_stack`." msgstr "" -#: ../../library/traceback.rst:145 +#: ../../library/traceback.rst:162 msgid "" "Given a list of tuples or :class:`FrameSummary` objects as returned by :func:" "`extract_tb` or :func:`extract_stack`, return a list of strings ready for " @@ -191,7 +213,7 @@ msgid "" "text line is not ``None``." msgstr "" -#: ../../library/traceback.rst:155 +#: ../../library/traceback.rst:172 msgid "" "Format the exception part of a traceback using an exception value such as " "given by :data:`sys.last_value`. The return value is a list of strings, " @@ -202,31 +224,31 @@ msgid "" "contains the exception's :attr:`notes `." msgstr "" -#: ../../library/traceback.rst:163 +#: ../../library/traceback.rst:180 msgid "" "Since Python 3.10, instead of passing *value*, an exception object can be " "passed as the first argument. If *value* is provided, the first argument is " "ignored in order to provide backwards compatibility." msgstr "" -#: ../../library/traceback.rst:167 ../../library/traceback.rst:394 +#: ../../library/traceback.rst:184 ../../library/traceback.rst:415 msgid "" "When *show_group* is ``True``, and the exception is an instance of :exc:" "`BaseExceptionGroup`, the nested exceptions are included as well, " "recursively, with indentation relative to their nesting depth." msgstr "" -#: ../../library/traceback.rst:175 +#: ../../library/traceback.rst:192 msgid "" "The returned list now includes any :attr:`notes ` " "attached to the exception." msgstr "" -#: ../../library/traceback.rst:179 +#: ../../library/traceback.rst:196 msgid "*show_group* parameter was added." msgstr "" -#: ../../library/traceback.rst:185 +#: ../../library/traceback.rst:202 msgid "" "Format a stack trace and the exception information. The arguments have the " "same meaning as the corresponding arguments to :func:`print_exception`. The " @@ -235,68 +257,69 @@ msgid "" "printed, exactly the same text is printed as does :func:`print_exception`." msgstr "" -#: ../../library/traceback.rst:194 +#: ../../library/traceback.rst:211 msgid "" "This function's behavior and signature were modified to match :func:" "`print_exception`." msgstr "" -#: ../../library/traceback.rst:201 +#: ../../library/traceback.rst:218 msgid "" "This is like ``print_exc(limit)`` but returns a string instead of printing " "to a file." msgstr "" -#: ../../library/traceback.rst:207 +#: ../../library/traceback.rst:224 msgid "A shorthand for ``format_list(extract_tb(tb, limit))``." msgstr "``format_list(extract_tb(tb, limit))`` 的簡寫。" -#: ../../library/traceback.rst:212 +#: ../../library/traceback.rst:229 msgid "A shorthand for ``format_list(extract_stack(f, limit))``." msgstr "``format_list(extract_stack(f, limit))`` 的簡寫。" -#: ../../library/traceback.rst:216 +#: ../../library/traceback.rst:233 msgid "" "Clears the local variables of all the stack frames in a :ref:`traceback " "` *tb* by calling the :meth:`~frame.clear` method of " "each :ref:`frame object `." msgstr "" -#: ../../library/traceback.rst:225 +#: ../../library/traceback.rst:242 msgid "" "Walk a stack following :attr:`f.f_back ` from the given frame, " "yielding the frame and line number for each frame. If *f* is ``None``, the " "current stack is used. This helper is used with :meth:`StackSummary.extract`." msgstr "" -#: ../../library/traceback.rst:234 +#: ../../library/traceback.rst:251 msgid "" "Walk a traceback following :attr:`~traceback.tb_next` yielding the frame and " "line number for each frame. This helper is used with :meth:`StackSummary." "extract`." msgstr "" -#: ../../library/traceback.rst:240 -msgid "The module also defines the following classes:" -msgstr "" - -#: ../../library/traceback.rst:243 +#: ../../library/traceback.rst:259 msgid ":class:`!TracebackException` Objects" msgstr ":class:`!TracebackException` 物件" -#: ../../library/traceback.rst:247 +#: ../../library/traceback.rst:263 msgid "" ":class:`!TracebackException` objects are created from actual exceptions to " -"capture data for later printing in a lightweight fashion." +"capture data for later printing. They offer a more lightweight method of " +"storing this information by avoiding holding references to :ref:" +"`traceback` and :ref:`frame` objects In " +"addition, they expose more options to configure the output compared to the " +"module-level functions described above." msgstr "" -#: ../../library/traceback.rst:252 ../../library/traceback.rst:359 +#: ../../library/traceback.rst:272 msgid "" -"Capture an exception for later rendering. *limit*, *lookup_lines* and " -"*capture_locals* are as for the :class:`StackSummary` class." +"Capture an exception for later rendering. The meaning of *limit*, " +"*lookup_lines* and *capture_locals* are as for the :class:`StackSummary` " +"class." msgstr "" -#: ../../library/traceback.rst:255 +#: ../../library/traceback.rst:276 msgid "" "If *compact* is true, only data that is required by :class:`!" "TracebackException`'s :meth:`format` method is saved in the class " @@ -304,12 +327,12 @@ msgid "" "if :attr:`__cause__` is ``None`` and :attr:`__suppress_context__` is false." msgstr "" -#: ../../library/traceback.rst:261 ../../library/traceback.rst:362 +#: ../../library/traceback.rst:282 ../../library/traceback.rst:383 msgid "" "Note that when locals are captured, they are also shown in the traceback." msgstr "" -#: ../../library/traceback.rst:263 +#: ../../library/traceback.rst:284 msgid "" "*max_group_width* and *max_group_depth* control the formatting of exception " "groups (see :exc:`BaseExceptionGroup`). The depth refers to the nesting " @@ -318,122 +341,128 @@ msgid "" "limit is exceeded." msgstr "" -#: ../../library/traceback.rst:269 +#: ../../library/traceback.rst:290 msgid "Added the *compact* parameter." msgstr "新增 *compact* 參數。" -#: ../../library/traceback.rst:272 +#: ../../library/traceback.rst:293 msgid "Added the *max_group_width* and *max_group_depth* parameters." msgstr "新增 *max_group_width* 和 *max_group_depth* 參數。" -#: ../../library/traceback.rst:277 +#: ../../library/traceback.rst:298 msgid "" "A :class:`!TracebackException` of the original :attr:`~BaseException." "__cause__`." msgstr "" -#: ../../library/traceback.rst:282 +#: ../../library/traceback.rst:303 msgid "" "A :class:`!TracebackException` of the original :attr:`~BaseException." "__context__`." msgstr "" -#: ../../library/traceback.rst:287 +#: ../../library/traceback.rst:308 msgid "" "If ``self`` represents an :exc:`ExceptionGroup`, this field holds a list of :" "class:`!TracebackException` instances representing the nested exceptions. " "Otherwise it is ``None``." msgstr "" -#: ../../library/traceback.rst:295 +#: ../../library/traceback.rst:316 msgid "" "The :attr:`~BaseException.__suppress_context__` value from the original " "exception." msgstr "" -#: ../../library/traceback.rst:300 +#: ../../library/traceback.rst:321 msgid "" "The :attr:`~BaseException.__notes__` value from the original exception, or " "``None`` if the exception does not have any notes. If it is not ``None`` is " "it formatted in the traceback after the exception string." msgstr "" -#: ../../library/traceback.rst:309 +#: ../../library/traceback.rst:330 msgid "A :class:`StackSummary` representing the traceback." msgstr "" -#: ../../library/traceback.rst:313 +#: ../../library/traceback.rst:334 msgid "The class of the original traceback." msgstr "" -#: ../../library/traceback.rst:319 +#: ../../library/traceback.rst:340 msgid "String display of the class of the original exception." msgstr "" -#: ../../library/traceback.rst:325 +#: ../../library/traceback.rst:346 msgid "For syntax errors - the file name where the error occurred." msgstr "" -#: ../../library/traceback.rst:329 +#: ../../library/traceback.rst:350 msgid "For syntax errors - the line number where the error occurred." msgstr "" -#: ../../library/traceback.rst:333 +#: ../../library/traceback.rst:354 msgid "" "For syntax errors - the end line number where the error occurred. Can be " "``None`` if not present." msgstr "" -#: ../../library/traceback.rst:340 +#: ../../library/traceback.rst:361 msgid "For syntax errors - the text where the error occurred." msgstr "" -#: ../../library/traceback.rst:344 +#: ../../library/traceback.rst:365 msgid "For syntax errors - the offset into the text where the error occurred." msgstr "" -#: ../../library/traceback.rst:348 +#: ../../library/traceback.rst:369 msgid "" "For syntax errors - the end offset into the text where the error occurred. " "Can be ``None`` if not present." msgstr "" -#: ../../library/traceback.rst:355 +#: ../../library/traceback.rst:376 msgid "For syntax errors - the compiler error message." msgstr "" -#: ../../library/traceback.rst:366 +#: ../../library/traceback.rst:380 +msgid "" +"Capture an exception for later rendering. *limit*, *lookup_lines* and " +"*capture_locals* are as for the :class:`StackSummary` class." +msgstr "" + +#: ../../library/traceback.rst:387 msgid "" "Print to *file* (default ``sys.stderr``) the exception information returned " "by :meth:`format`." msgstr "" -#: ../../library/traceback.rst:373 +#: ../../library/traceback.rst:394 msgid "Format the exception." msgstr "" -#: ../../library/traceback.rst:375 +#: ../../library/traceback.rst:396 msgid "" "If *chain* is not ``True``, :attr:`__cause__` and :attr:`__context__` will " "not be formatted." msgstr "" -#: ../../library/traceback.rst:378 +#: ../../library/traceback.rst:399 msgid "" "The return value is a generator of strings, each ending in a newline and " "some containing internal newlines. :func:`~traceback.print_exception` is a " "wrapper around this method which just prints the lines to a file." msgstr "" -#: ../../library/traceback.rst:384 +#: ../../library/traceback.rst:405 msgid "Format the exception part of the traceback." msgstr "" -#: ../../library/traceback.rst:386 +#: ../../library/traceback.rst:407 msgid "The return value is a generator of strings, each ending in a newline." msgstr "" -#: ../../library/traceback.rst:388 +#: ../../library/traceback.rst:409 msgid "" "When *show_group* is ``False``, the generator emits the exception's message " "followed by its notes (if it has any). The exception message is normally a " @@ -442,33 +471,32 @@ msgid "" "the syntax error occurred." msgstr "" -#: ../../library/traceback.rst:398 +#: ../../library/traceback.rst:419 msgid "" "The exception's :attr:`notes ` are now included in " "the output." msgstr "" -#: ../../library/traceback.rst:402 -#, fuzzy +#: ../../library/traceback.rst:423 msgid "Added the *show_group* parameter." -msgstr "新增 *compact* 參數。" +msgstr "新增 *show_group* 參數。" -#: ../../library/traceback.rst:407 +#: ../../library/traceback.rst:428 msgid ":class:`!StackSummary` Objects" msgstr ":class:`!StackSummary` 物件" -#: ../../library/traceback.rst:411 +#: ../../library/traceback.rst:432 msgid "" ":class:`!StackSummary` objects represent a call stack ready for formatting." msgstr "" -#: ../../library/traceback.rst:417 +#: ../../library/traceback.rst:438 msgid "" "Construct a :class:`!StackSummary` object from a frame generator (such as is " "returned by :func:`~traceback.walk_stack` or :func:`~traceback.walk_tb`)." msgstr "" -#: ../../library/traceback.rst:421 +#: ../../library/traceback.rst:442 msgid "" "If *limit* is supplied, only this many frames are taken from *frame_gen*. If " "*lookup_lines* is ``False``, the returned :class:`FrameSummary` objects will " @@ -478,20 +506,20 @@ msgid "" "class:`!FrameSummary` are captured as object representations." msgstr "" -#: ../../library/traceback.rst:429 +#: ../../library/traceback.rst:450 msgid "" "Exceptions raised from :func:`repr` on a local variable (when " "*capture_locals* is ``True``) are no longer propagated to the caller." msgstr "" -#: ../../library/traceback.rst:435 +#: ../../library/traceback.rst:456 msgid "" "Construct a :class:`!StackSummary` object from a supplied list of :class:" "`FrameSummary` objects or old-style list of tuples. Each tuple should be a " "4-tuple with *filename*, *lineno*, *name*, *line* as the elements." msgstr "" -#: ../../library/traceback.rst:442 +#: ../../library/traceback.rst:463 msgid "" "Returns a list of strings ready for printing. Each string in the resulting " "list corresponds to a single :ref:`frame ` from the stack. " @@ -499,18 +527,18 @@ msgid "" "well, for those items with source text lines." msgstr "" -#: ../../library/traceback.rst:448 +#: ../../library/traceback.rst:469 msgid "" "For long sequences of the same frame and line, the first few repetitions are " "shown, followed by a summary line stating the exact number of further " "repetitions." msgstr "" -#: ../../library/traceback.rst:452 +#: ../../library/traceback.rst:473 msgid "Long sequences of repeated frames are now abbreviated." msgstr "" -#: ../../library/traceback.rst:457 +#: ../../library/traceback.rst:478 msgid "" "Returns a string for printing one of the :ref:`frames ` " "involved in the stack. This method is called for each :class:`FrameSummary` " @@ -518,17 +546,17 @@ msgid "" "the frame is omitted from the output." msgstr "" -#: ../../library/traceback.rst:467 +#: ../../library/traceback.rst:488 msgid ":class:`!FrameSummary` Objects" msgstr ":class:`!FrameSummary` 物件" -#: ../../library/traceback.rst:471 +#: ../../library/traceback.rst:492 msgid "" "A :class:`!FrameSummary` object represents a single :ref:`frame ` in a :ref:`traceback `." msgstr "" -#: ../../library/traceback.rst:476 +#: ../../library/traceback.rst:497 msgid "" "Represents a single :ref:`frame ` in the :ref:`traceback " "` or stack that is being formatted or printed. It may " @@ -542,38 +570,38 @@ msgid "" "display." msgstr "" -#: ../../library/traceback.rst:487 +#: ../../library/traceback.rst:508 msgid ":class:`!FrameSummary` instances have the following attributes:" msgstr "" -#: ../../library/traceback.rst:491 +#: ../../library/traceback.rst:512 msgid "" "The filename of the source code for this frame. Equivalent to accessing :" "attr:`f.f_code.co_filename ` on a :ref:`frame object " "` *f*." msgstr "" -#: ../../library/traceback.rst:497 +#: ../../library/traceback.rst:518 msgid "The line number of the source code for this frame." msgstr "" -#: ../../library/traceback.rst:501 +#: ../../library/traceback.rst:522 msgid "" "Equivalent to accessing :attr:`f.f_code.co_name ` on a :" "ref:`frame object ` *f*." msgstr "" -#: ../../library/traceback.rst:506 +#: ../../library/traceback.rst:527 msgid "" "A string representing the source code for this frame, with leading and " "trailing whitespace stripped. If the source is not available, it is ``None``." msgstr "" -#: ../../library/traceback.rst:513 -msgid "Traceback Examples" +#: ../../library/traceback.rst:534 +msgid "Examples of Using the Module-Level Functions" msgstr "" -#: ../../library/traceback.rst:515 +#: ../../library/traceback.rst:536 msgid "" "This simple example implements a basic read-eval-print loop, similar to (but " "less useful than) the standard Python interactive interpreter loop. For a " @@ -581,7 +609,7 @@ msgid "" "`code` module. ::" msgstr "" -#: ../../library/traceback.rst:520 +#: ../../library/traceback.rst:541 msgid "" "import sys, traceback\n" "\n" @@ -600,13 +628,13 @@ msgid "" " run_user_code(envdir)" msgstr "" -#: ../../library/traceback.rst:537 +#: ../../library/traceback.rst:558 msgid "" "The following example demonstrates the different ways to print and format " "the exception and traceback:" msgstr "" -#: ../../library/traceback.rst:540 +#: ../../library/traceback.rst:561 msgid "" "import sys, traceback\n" "\n" @@ -618,8 +646,7 @@ msgid "" "\n" "try:\n" " lumberjack()\n" -"except IndexError:\n" -" exc = sys.exception()\n" +"except IndexError as exc:\n" " print(\"*** print_tb:\")\n" " traceback.print_tb(exc.__traceback__, limit=1, file=sys.stdout)\n" " print(\"*** print_exception:\")\n" @@ -639,11 +666,11 @@ msgid "" " print(\"*** tb_lineno:\", exc.__traceback__.tb_lineno)" msgstr "" -#: ../../library/traceback.rst:572 +#: ../../library/traceback.rst:592 msgid "The output for the example would look similar to this:" msgstr "" -#: ../../library/traceback.rst:574 +#: ../../library/traceback.rst:594 msgid "" "*** print_tb:\n" " File \"\", line 10, in \n" @@ -693,13 +720,13 @@ msgid "" "*** tb_lineno: 10" msgstr "" -#: ../../library/traceback.rst:619 +#: ../../library/traceback.rst:639 msgid "" "The following example shows the different ways to print and format the " "stack::" msgstr "" -#: ../../library/traceback.rst:621 +#: ../../library/traceback.rst:641 msgid "" ">>> import traceback\n" ">>> def another_function():\n" @@ -751,11 +778,11 @@ msgstr "" " ' File \"\", line 8, in lumberstack\\n print(repr(traceback." "format_stack()))\\n']" -#: ../../library/traceback.rst:645 +#: ../../library/traceback.rst:665 msgid "This last example demonstrates the final few formatting functions:" msgstr "" -#: ../../library/traceback.rst:647 +#: ../../library/traceback.rst:667 msgid "" ">>> import traceback\n" ">>> traceback.format_list([('spam.py', 3, '', 'spam.eggs()'),\n" @@ -763,22 +790,113 @@ msgid "" "[' File \"spam.py\", line 3, in \\n spam.eggs()\\n',\n" " ' File \"eggs.py\", line 42, in eggs\\n return \"bacon\"\\n']\n" ">>> an_error = IndexError('tuple index out of range')\n" -">>> traceback.format_exception_only(type(an_error), an_error)\n" +">>> traceback.format_exception_only(an_error)\n" "['IndexError: tuple index out of range\\n']" msgstr "" -#: ../../library/traceback.rst:17 +#: ../../library/traceback.rst:681 +msgid "Examples of Using :class:`TracebackException`" +msgstr ":class:`TracebackException` 的使用範例" + +#: ../../library/traceback.rst:683 +msgid "With the helper class, we have more options::" +msgstr "" + +#: ../../library/traceback.rst:685 +msgid "" +">>> import sys\n" +">>> from traceback import TracebackException\n" +">>>\n" +">>> def lumberjack():\n" +"... bright_side_of_life()\n" +"...\n" +">>> def bright_side_of_life():\n" +"... t = \"bright\", \"side\", \"of\", \"life\"\n" +"... return t[5]\n" +"...\n" +">>> try:\n" +"... lumberjack()\n" +"... except IndexError as e:\n" +"... exc = e\n" +"...\n" +">>> try:\n" +"... try:\n" +"... lumberjack()\n" +"... except:\n" +"... 1/0\n" +"... except Exception as e:\n" +"... chained_exc = e\n" +"...\n" +">>> # limit works as with the module-level functions\n" +">>> TracebackException.from_exception(exc, limit=-2).print()\n" +"Traceback (most recent call last):\n" +" File \"\", line 6, in lumberjack\n" +" bright_side_of_life()\n" +" ~~~~~~~~~~~~~~~~~~~^^\n" +" File \"\", line 10, in bright_side_of_life\n" +" return t[5]\n" +" ~^^^\n" +"IndexError: tuple index out of range\n" +"\n" +">>> # capture_locals adds local variables in frames\n" +">>> TracebackException.from_exception(exc, limit=-2, capture_locals=True)." +"print()\n" +"Traceback (most recent call last):\n" +" File \"\", line 6, in lumberjack\n" +" bright_side_of_life()\n" +" ~~~~~~~~~~~~~~~~~~~^^\n" +" File \"\", line 10, in bright_side_of_life\n" +" return t[5]\n" +" ~^^^\n" +" t = (\"bright\", \"side\", \"of\", \"life\")\n" +"IndexError: tuple index out of range\n" +"\n" +">>> # The *chain* kwarg to print() controls whether chained\n" +">>> # exceptions are displayed\n" +">>> TracebackException.from_exception(chained_exc).print()\n" +"Traceback (most recent call last):\n" +" File \"\", line 4, in \n" +" lumberjack()\n" +" ~~~~~~~~~~^^\n" +" File \"\", line 7, in lumberjack\n" +" bright_side_of_life()\n" +" ~~~~~~~~~~~~~~~~~~~^^\n" +" File \"\", line 11, in bright_side_of_life\n" +" return t[5]\n" +" ~^^^\n" +"IndexError: tuple index out of range\n" +"\n" +"During handling of the above exception, another exception occurred:\n" +"\n" +"Traceback (most recent call last):\n" +" File \"\", line 6, in \n" +" 1/0\n" +" ~^~\n" +"ZeroDivisionError: division by zero\n" +"\n" +">>> TracebackException.from_exception(chained_exc).print(chain=False)\n" +"Traceback (most recent call last):\n" +" File \"\", line 6, in \n" +" 1/0\n" +" ~^~\n" +"ZeroDivisionError: division by zero" +msgstr "" + +#: ../../library/traceback.rst:21 msgid "object" msgstr "object(物件)" -#: ../../library/traceback.rst:17 +#: ../../library/traceback.rst:21 msgid "traceback" msgstr "traceback" -#: ../../library/traceback.rst:70 +#: ../../library/traceback.rst:87 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../library/traceback.rst:70 +#: ../../library/traceback.rst:87 msgid "marker" msgstr "marker(標記)" + +#~ msgid "The module defines the following functions:" +#~ msgstr "此模組定義了以下函式:" diff --git a/library/tty.po b/library/tty.po index 56c833a6f6..86b6a46e29 100644 --- a/library/tty.po +++ b/library/tty.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2021-12-17 17:00+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,8 +36,8 @@ msgid "" msgstr ":mod:`tty` 模組定義了將 tty 放入 cbreak 和 raw 模式的函式。" #: ../../library/tty.rst:18 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" +msgid "Availability" +msgstr "" #: ../../library/tty.rst:20 msgid "" diff --git a/library/types.po b/library/types.po index cd7e8ca1ba..7d9a6f6bb4 100644 --- a/library/types.po +++ b/library/types.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-10-10 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -299,7 +299,7 @@ msgstr "" #: ../../library/types.rst:201 msgid "" "The type for cell objects: such objects are used as containers for a " -"function's free variables." +"function's :term:`closure variables `." msgstr "" #: ../../library/types.rst:209 @@ -346,90 +346,47 @@ msgid "" "module to be created and optionally its :term:`docstring`." msgstr "" -#: ../../library/types.rst:264 -msgid "" -"Use :func:`importlib.util.module_from_spec` to create a new module if you " -"wish to set the various import-controlled attributes." -msgstr "" - -#: ../../library/types.rst:269 -msgid "The :term:`docstring` of the module. Defaults to ``None``." -msgstr "" - -#: ../../library/types.rst:273 -msgid "The :term:`loader` which loaded the module. Defaults to ``None``." -msgstr "" - -#: ../../library/types.rst:275 -msgid "" -"This attribute is to match :attr:`importlib.machinery.ModuleSpec.loader` as " -"stored in the :attr:`__spec__` object." -msgstr "" - -#: ../../library/types.rst:279 -msgid "" -"A future version of Python may stop setting this attribute by default. To " -"guard against this potential change, preferably read from the :attr:" -"`__spec__` attribute instead or use ``getattr(module, \"__loader__\", " -"None)`` if you explicitly need to use this attribute." -msgstr "" - -#: ../../library/types.rst:285 ../../library/types.rst:310 -msgid "Defaults to ``None``. Previously the attribute was optional." -msgstr "" - -#: ../../library/types.rst:290 -msgid "" -"The name of the module. Expected to match :attr:`importlib.machinery." -"ModuleSpec.name`." +#: ../../library/types.rst:265 +msgid ":ref:`Documentation on module objects `" msgstr "" -#: ../../library/types.rst:295 +#: ../../library/types.rst:266 msgid "" -"Which :term:`package` a module belongs to. If the module is top-level (i.e. " -"not a part of any specific package) then the attribute should be set to " -"``''``, else it should be set to the name of the package (which can be :attr:" -"`__name__` if the module is a package itself). Defaults to ``None``." +"Provides details on the special attributes that can be found on instances " +"of :class:`!ModuleType`." msgstr "" -#: ../../library/types.rst:300 -msgid "" -"This attribute is to match :attr:`importlib.machinery.ModuleSpec.parent` as " -"stored in the :attr:`__spec__` object." -msgstr "" - -#: ../../library/types.rst:304 -msgid "" -"A future version of Python may stop setting this attribute by default. To " -"guard against this potential change, preferably read from the :attr:" -"`__spec__` attribute instead or use ``getattr(module, \"__package__\", " -"None)`` if you explicitly need to use this attribute." -msgstr "" +#: ../../library/types.rst:269 +msgid ":func:`importlib.util.module_from_spec`" +msgstr ":func:`importlib.util.module_from_spec`" -#: ../../library/types.rst:315 +#: ../../library/types.rst:270 msgid "" -"A record of the module's import-system-related state. Expected to be an " -"instance of :class:`importlib.machinery.ModuleSpec`." +"Modules created using the :class:`!ModuleType` constructor are created with " +"many of their special attributes unset or set to default values. :func:`!" +"module_from_spec` provides a more robust way of creating :class:`!" +"ModuleType` instances which ensures the various attributes are set " +"appropriately." msgstr "" -#: ../../library/types.rst:323 +#: ../../library/types.rst:278 msgid "The type of :data:`Ellipsis`." msgstr "" -#: ../../library/types.rst:329 +#: ../../library/types.rst:284 msgid "" "The type of :ref:`parameterized generics ` such as " "``list[int]``." msgstr "" -#: ../../library/types.rst:332 +#: ../../library/types.rst:287 msgid "" "``t_origin`` should be a non-parameterized generic class, such as ``list``, " "``tuple`` or ``dict``. ``t_args`` should be a :class:`tuple` (possibly of " "length 1) of types which parameterize ``t_origin``::" msgstr "" -#: ../../library/types.rst:336 +#: ../../library/types.rst:291 msgid "" ">>> from types import GenericAlias\n" "\n" @@ -445,50 +402,50 @@ msgstr "" ">>> dict[str, int] == GenericAlias(dict, (str, int))\n" "True" -#: ../../library/types.rst:345 +#: ../../library/types.rst:300 msgid "This type can now be subclassed." msgstr "" -#: ../../library/types.rst:350 +#: ../../library/types.rst:305 msgid ":ref:`Generic Alias Types`" msgstr "" -#: ../../library/types.rst:351 +#: ../../library/types.rst:306 msgid "In-depth documentation on instances of :class:`!types.GenericAlias`" msgstr "" -#: ../../library/types.rst:353 +#: ../../library/types.rst:308 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr "" -#: ../../library/types.rst:354 +#: ../../library/types.rst:309 msgid "Introducing the :class:`!types.GenericAlias` class" msgstr "" -#: ../../library/types.rst:358 +#: ../../library/types.rst:313 msgid "The type of :ref:`union type expressions`." msgstr "" -#: ../../library/types.rst:364 +#: ../../library/types.rst:319 msgid "" "The type of traceback objects such as found in ``sys.exception()." "__traceback__``." msgstr "" -#: ../../library/types.rst:366 +#: ../../library/types.rst:321 msgid "" "See :ref:`the language reference ` for details of the " "available attributes and operations, and guidance on creating tracebacks " "dynamically." msgstr "" -#: ../../library/types.rst:373 +#: ../../library/types.rst:328 msgid "" "The type of :ref:`frame objects ` such as found in :attr:`tb." "tb_frame ` if ``tb`` is a traceback object." msgstr "" -#: ../../library/types.rst:379 +#: ../../library/types.rst:334 msgid "" "The type of objects defined in extension modules with ``PyGetSetDef``, such " "as :attr:`FrameType.f_locals ` or ``array.array.typecode``. " @@ -497,7 +454,7 @@ msgid "" "modules." msgstr "" -#: ../../library/types.rst:388 +#: ../../library/types.rst:343 msgid "" "The type of objects defined in extension modules with ``PyMemberDef``, such " "as ``datetime.timedelta.days``. This type is used as descriptor for simple " @@ -506,7 +463,7 @@ msgid "" "modules." msgstr "" -#: ../../library/types.rst:393 +#: ../../library/types.rst:348 msgid "" "In addition, when a class is defined with a :attr:`~object.__slots__` " "attribute, then for each slot, an instance of :class:`!MemberDescriptorType` " @@ -514,99 +471,99 @@ msgid "" "in the class's :attr:`~type.__dict__`." msgstr "" -#: ../../library/types.rst:399 +#: ../../library/types.rst:354 msgid "" "In other implementations of Python, this type may be identical to " "``GetSetDescriptorType``." msgstr "" -#: ../../library/types.rst:404 +#: ../../library/types.rst:359 msgid "" "Read-only proxy of a mapping. It provides a dynamic view on the mapping's " "entries, which means that when the mapping changes, the view reflects these " "changes." msgstr "" -#: ../../library/types.rst:412 +#: ../../library/types.rst:367 msgid "" "Updated to support the new union (``|``) operator from :pep:`584`, which " "simply delegates to the underlying mapping." msgstr "" -#: ../../library/types.rst:417 +#: ../../library/types.rst:372 msgid "" "Return ``True`` if the underlying mapping has a key *key*, else ``False``." msgstr "" -#: ../../library/types.rst:422 +#: ../../library/types.rst:377 msgid "" "Return the item of the underlying mapping with key *key*. Raises a :exc:" "`KeyError` if *key* is not in the underlying mapping." msgstr "" -#: ../../library/types.rst:427 +#: ../../library/types.rst:382 msgid "" "Return an iterator over the keys of the underlying mapping. This is a " "shortcut for ``iter(proxy.keys())``." msgstr "" -#: ../../library/types.rst:432 +#: ../../library/types.rst:387 msgid "Return the number of items in the underlying mapping." msgstr "" -#: ../../library/types.rst:436 +#: ../../library/types.rst:391 msgid "Return a shallow copy of the underlying mapping." msgstr "" -#: ../../library/types.rst:440 +#: ../../library/types.rst:395 msgid "" "Return the value for *key* if *key* is in the underlying mapping, else " "*default*. If *default* is not given, it defaults to ``None``, so that this " "method never raises a :exc:`KeyError`." msgstr "" -#: ../../library/types.rst:446 +#: ../../library/types.rst:401 msgid "" "Return a new view of the underlying mapping's items (``(key, value)`` pairs)." msgstr "" -#: ../../library/types.rst:451 +#: ../../library/types.rst:406 msgid "Return a new view of the underlying mapping's keys." msgstr "" -#: ../../library/types.rst:455 +#: ../../library/types.rst:410 msgid "Return a new view of the underlying mapping's values." msgstr "" -#: ../../library/types.rst:459 +#: ../../library/types.rst:414 msgid "Return a reverse iterator over the keys of the underlying mapping." msgstr "" -#: ../../library/types.rst:465 +#: ../../library/types.rst:420 msgid "Return a hash of the underlying mapping." msgstr "" -#: ../../library/types.rst:471 +#: ../../library/types.rst:426 msgid "The type of :ref:`capsule objects `." msgstr "" -#: ../../library/types.rst:477 +#: ../../library/types.rst:432 msgid "Additional Utility Classes and Functions" msgstr "" -#: ../../library/types.rst:481 +#: ../../library/types.rst:436 msgid "" "A simple :class:`object` subclass that provides attribute access to its " "namespace, as well as a meaningful repr." msgstr "" -#: ../../library/types.rst:484 +#: ../../library/types.rst:439 msgid "" "Unlike :class:`object`, with :class:`!SimpleNamespace` you can add and " "remove attributes." msgstr "" -#: ../../library/types.rst:487 +#: ../../library/types.rst:442 msgid "" ":py:class:`SimpleNamespace` objects may be initialized in the same way as :" "class:`dict`: either with keyword arguments, with a single positional " @@ -617,11 +574,11 @@ msgid "" "`iterable` object producing key-value pairs). All such keys must be strings." msgstr "" -#: ../../library/types.rst:498 +#: ../../library/types.rst:453 msgid "The type is roughly equivalent to the following code::" msgstr "" -#: ../../library/types.rst:500 +#: ../../library/types.rst:455 msgid "" "class SimpleNamespace:\n" " def __init__(self, mapping_or_iterable=(), /, **kwargs):\n" @@ -653,33 +610,33 @@ msgstr "" " return self.__dict__ == other.__dict__\n" " return NotImplemented" -#: ../../library/types.rst:514 +#: ../../library/types.rst:469 msgid "" "``SimpleNamespace`` may be useful as a replacement for ``class NS: pass``. " "However, for a structured record type use :func:`~collections.namedtuple` " "instead." msgstr "" -#: ../../library/types.rst:518 +#: ../../library/types.rst:473 msgid "" ":class:`!SimpleNamespace` objects are supported by :func:`copy.replace`." msgstr "" -#: ../../library/types.rst:522 +#: ../../library/types.rst:477 msgid "" "Attribute order in the repr changed from alphabetical to insertion (like " "``dict``)." msgstr "" -#: ../../library/types.rst:526 +#: ../../library/types.rst:481 msgid "Added support for an optional positional argument." msgstr "" -#: ../../library/types.rst:531 +#: ../../library/types.rst:486 msgid "Route attribute access on a class to __getattr__." msgstr "" -#: ../../library/types.rst:533 +#: ../../library/types.rst:488 msgid "" "This is a descriptor, used to define attributes that act differently when " "accessed through an instance and through a class. Instance access remains " @@ -687,18 +644,18 @@ msgid "" "class's __getattr__ method; this is done by raising AttributeError." msgstr "" -#: ../../library/types.rst:538 +#: ../../library/types.rst:493 msgid "" "This allows one to have properties active on an instance, and have virtual " "attributes on the class with the same name (see :class:`enum.Enum` for an " "example)." msgstr "" -#: ../../library/types.rst:545 +#: ../../library/types.rst:500 msgid "Coroutine Utility Functions" msgstr "" -#: ../../library/types.rst:549 +#: ../../library/types.rst:504 msgid "" "This function transforms a :term:`generator` function into a :term:" "`coroutine function` which returns a generator-based coroutine. The " @@ -708,11 +665,11 @@ msgid "" "method." msgstr "" -#: ../../library/types.rst:556 +#: ../../library/types.rst:511 msgid "If *gen_func* is a generator function, it will be modified in-place." msgstr "" -#: ../../library/types.rst:558 +#: ../../library/types.rst:513 msgid "" "If *gen_func* is not a generator function, it will be wrapped. If it returns " "an instance of :class:`collections.abc.Generator`, the instance will be " diff --git a/library/typing.po b/library/typing.po index f9b1cfb9a4..2c5d63c990 100644 --- a/library/typing.po +++ b/library/typing.po @@ -5800,7 +5800,7 @@ msgstr ":pep:`695`" #: ../../library/typing.rst:3916 msgid ":func:`@typing.no_type_check_decorator `" -msgstr "" +msgstr ":func:`@typing.no_type_check_decorator `" #: ../../library/typing.rst:3917 ../../library/typing.rst:3921 msgid "3.13" diff --git a/library/unittest.mock.po b/library/unittest.mock.po index c4159ff0b8..720ca6deba 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-10-10 00:13+0000\n" "PO-Revision-Date: 2024-02-19 21:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -95,10 +95,11 @@ msgstr "" #: ../../library/unittest.mock.rst:71 msgid "" -":attr:`side_effect` allows you to perform side effects, including raising an " -"exception when a mock is called:" +":attr:`~Mock.side_effect` allows you to perform side effects, including " +"raising an exception when a mock is called:" msgstr "" -":attr:`side_effect` 允許你執行 side effects,包含在 mock 被呼叫時引發例外:" +":attr:`~Mock.side_effect` 允許你執行 side effects,包含在 mock 被呼叫時引發例" +"外:" #: ../../library/unittest.mock.rst:92 msgid "" @@ -755,21 +756,21 @@ msgstr "" #: ../../library/unittest.mock.rst:740 msgid "" -"Normally the :attr:`__class__` attribute of an object will return its type. " -"For a mock object with a :attr:`spec`, ``__class__`` returns the spec class " -"instead. This allows mock objects to pass :func:`isinstance` tests for the " -"object they are replacing / masquerading as:" +"Normally the :attr:`!__class__` attribute of an object will return its type. " +"For a mock object with a :attr:`!spec`, :attr:`!__class__` returns the spec " +"class instead. This allows mock objects to pass :func:`isinstance` tests for " +"the object they are replacing / masquerading as:" msgstr "" -"通常,物件的 :attr:`__class__` 屬性會回傳它的型別。但對於擁有 :attr:`spec` " -"的 mock 物件,``__class__`` 會回傳 spec 的類別。這允許 mock 物件通過對它們所" -"替代或偽裝的物件進行的 :func:`isinstance` 測試:" +"通常,物件的 :attr:`!__class__` 屬性會回傳它的型別。但對於擁有 :attr:`!spec` " +"的 mock 物件,:attr:`!__class__` 會回傳 spec 的類別。這允許 mock 物件通過對它" +"們所替代或偽裝的物件進行的 :func:`isinstance` 測試:" #: ../../library/unittest.mock.rst:749 msgid "" -":attr:`__class__` is assignable to, this allows a mock to pass an :func:" +":attr:`!__class__` is assignable to, this allows a mock to pass an :func:" "`isinstance` check without forcing you to use a spec:" msgstr "" -":attr:`__class__` 可以被指定,這允許 mock 通過 :func:`isinstance` 檢查,而不" +":attr:`!__class__` 可以被指定,這允許 mock 通過 :func:`isinstance` 檢查,而不" "需要強制使用 spec:" #: ../../library/unittest.mock.rst:759 @@ -783,10 +784,10 @@ msgstr "" #: ../../library/unittest.mock.rst:763 msgid "" -"Mock objects that use a class or an instance as a :attr:`spec` or :attr:" -"`spec_set` are able to pass :func:`isinstance` tests:" +"Mock objects that use a class or an instance as a :attr:`!spec` or :attr:`!" +"spec_set` are able to pass :func:`isinstance` tests:" msgstr "" -"使用類別或實例作為 :attr:`spec` 或 :attr:`spec_set` 的 mock 物件能夠通過 :" +"使用類別或實例作為 :attr:`!spec` 或 :attr:`!spec_set` 的 mock 物件能夠通過 :" "func:`isinstance` 測試:" #: ../../library/unittest.mock.rst:773 @@ -1200,11 +1201,11 @@ msgstr "" #: ../../library/unittest.mock.rst:1177 msgid "" "If :attr:`~Mock.side_effect` is set then it will be called after the call " -"has been recorded, so if :attr:`side_effect` raises an exception the call is " -"still recorded." +"has been recorded, so if :attr:`!side_effect` raises an exception the call " +"is still recorded." msgstr "" "如果 :attr:`~Mock.side_effect` 被設定,那麼在呼叫被記錄後它才會被呼叫,所以如" -"果 :attr:`side_effect` 引發例外,呼叫仍然會被記錄。" +"果 :attr:`!side_effect` 引發例外,呼叫仍然會被記錄。" #: ../../library/unittest.mock.rst:1181 msgid "" @@ -1216,42 +1217,42 @@ msgstr "" #: ../../library/unittest.mock.rst:1199 msgid "" -"If :attr:`side_effect` is a function then whatever that function returns is " -"what calls to the mock return. The :attr:`side_effect` function is called " -"with the same arguments as the mock. This allows you to vary the return " -"value of the call dynamically, based on the input:" +"If :attr:`~Mock.side_effect` is a function then whatever that function " +"returns is what calls to the mock return. The :attr:`!side_effect` function " +"is called with the same arguments as the mock. This allows you to vary the " +"return value of the call dynamically, based on the input:" msgstr "" -"如果 :attr:`side_effect` 是一個函式,則該函式回傳的東西就是對 mock 的呼叫所回" -"傳的值。:attr:`side_effect` 函式會使用與 mock 相同的引數被呼叫。這讓你可以根" -"據輸入動態地變更呼叫的回傳值:" +"如果 :attr:`~Mock.side_effect` 是一個函式,則該函式回傳的東西就是對 mock 的呼" +"叫所回傳的值。:attr:`!side_effect` 函式會使用與 mock 相同的引數被呼叫。這讓你" +"可以根據輸入動態地變更呼叫的回傳值:" #: ../../library/unittest.mock.rst:1215 msgid "" "If you want the mock to still return the default return value (a new mock), " "or any set return value, then there are two ways of doing this. Either " -"return :attr:`mock.return_value` from inside :attr:`side_effect`, or return :" -"data:`DEFAULT`:" +"return :attr:`~Mock.return_value` from inside :attr:`~Mock.side_effect`, or " +"return :data:`DEFAULT`:" msgstr "" "如果你希望 mock 仍然回傳預設的回傳值(一個新的 mock),或者是任何已設定的回傳" -"值,有兩種方法可以實現。從 :attr:`side_effect` 內部回傳 :attr:`mock." +"值,有兩種方法可以實現。從 :attr:`~Mock.side_effect` 內部回傳 :attr:`~Mock." "return_value`,或回傳 :data:`DEFAULT`:" #: ../../library/unittest.mock.rst:1234 msgid "" -"To remove a :attr:`side_effect`, and return to the default behaviour, set " -"the :attr:`side_effect` to ``None``:" +"To remove a :attr:`~Mock.side_effect`, and return to the default behaviour, " +"set the :attr:`!side_effect` to ``None``:" msgstr "" -"要刪除 :attr:`side_effect`,並恢復預設行為,將 :attr:`side_effect` 設為 " -"``None``:" +"要刪除 :attr:`~Mock.side_effect`,並恢復預設行為,將 :attr:`!side_effect` 設" +"為 ``None``:" #: ../../library/unittest.mock.rst:1248 msgid "" -"The :attr:`side_effect` can also be any iterable object. Repeated calls to " -"the mock will return values from the iterable (until the iterable is " -"exhausted and a :exc:`StopIteration` is raised):" +"The :attr:`~Mock.side_effect` can also be any iterable object. Repeated " +"calls to the mock will return values from the iterable (until the iterable " +"is exhausted and a :exc:`StopIteration` is raised):" msgstr "" -":attr:`side_effect` 也可以是任何可疊代的物件。對 mock 的重複呼叫將從可疊代物" -"件中回傳值(直到疊代物件耗盡並引發 :exc:`StopIteration` 為止):" +":attr:`~Mock.side_effect` 也可以是任何可疊代的物件。對 mock 的重複呼叫將從可" +"疊代物件中回傳值(直到疊代物件耗盡並引發 :exc:`StopIteration` 為止):" #: ../../library/unittest.mock.rst:1264 msgid "" @@ -1297,12 +1298,12 @@ msgstr "Mock 物件會在需要時建立屬性。這使得它們可以假裝成 msgid "" "You may want a mock object to return ``False`` to a :func:`hasattr` call, or " "raise an :exc:`AttributeError` when an attribute is fetched. You can do this " -"by providing an object as a :attr:`spec` for a mock, but that isn't always " +"by providing an object as a :attr:`!spec` for a mock, but that isn't always " "convenient." msgstr "" "你可能希望一個 mock 物件在 :func:`hasattr` 呼叫時回傳 ``False``,或者在屬性被" -"提取時引發 :exc:`AttributeError`。你可以通過將物件提供為 mock 的 :attr:" -"`spec` 來實現這一點,但這並不總是那麼好用。" +"提取時引發 :exc:`AttributeError`。你可以通過將物件提供為 mock 的 :attr:`!" +"spec` 來實現這一點,但這並不總是那麼好用。" #: ../../library/unittest.mock.rst:1291 msgid "" @@ -1573,19 +1574,19 @@ msgstr "" #: ../../library/unittest.mock.rst:1458 msgid "" -"Patch can be used as a :class:`TestCase` class decorator. It works by " -"decorating each test method in the class. This reduces the boilerplate code " -"when your test methods share a common patchings set. :func:`patch` finds " -"tests by looking for method names that start with ``patch.TEST_PREFIX``. By " -"default this is ``'test'``, which matches the way :mod:`unittest` finds " -"tests. You can specify an alternative prefix by setting ``patch." -"TEST_PREFIX``." +"Patch can be used as a :class:`~unittest.TestCase` class decorator. It works " +"by decorating each test method in the class. This reduces the boilerplate " +"code when your test methods share a common patchings set. :func:`patch` " +"finds tests by looking for method names that start with ``patch." +"TEST_PREFIX``. By default this is ``'test'``, which matches the way :mod:" +"`unittest` finds tests. You can specify an alternative prefix by setting " +"``patch.TEST_PREFIX``." msgstr "" -"patch 可以做為 :class:`TestCase` 類別的裝飾器使用。它透過裝飾類別中的每個測試" -"方法來運作。當你的測試方法共享一組常見的 patch 時,這會減少繁冗的代碼。:func:" -"`patch` 通過搜尋以 ``patch.TEST_PREFIX`` 開頭的方法名來尋找測試。預設情況下會" -"是 ``'test'``,這與 :mod:`unittest` 尋找測試的方式相匹配。你可以通過設定 " -"``patch.TEST_PREFIX`` 來指定別的前綴。" +"patch 可以做為 :class:`~unittest.TestCase` 類別的裝飾器使用。它透過裝飾類別中" +"的每個測試方法來運作。當你的測試方法共享一組常見的 patch 時,這會減少繁冗的代" +"碼。:func:`patch` 通過搜尋以 ``patch.TEST_PREFIX`` 開頭的方法名來尋找測試。預" +"設情況下會是 ``'test'``,這與 :mod:`unittest` 尋找測試的方式相匹配。你可以通" +"過設定 ``patch.TEST_PREFIX`` 來指定別的前綴。" #: ../../library/unittest.mock.rst:1465 msgid "" @@ -1661,10 +1662,10 @@ msgstr "" #: ../../library/unittest.mock.rst:1495 msgid "" "To configure return values on methods of *instances* on the patched class " -"you must do this on the :attr:`return_value`. For example::" +"you must do this on the :attr:`~Mock.return_value`. For example::" msgstr "" -"若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須在 :attr:" -"`return_value` 上進行配置。 例如: ::" +"若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須在 :attr:`~Mock." +"return_value` 上進行配置。例如: ::" #: ../../library/unittest.mock.rst:1498 msgid "" @@ -2209,24 +2210,24 @@ msgstr "patch 方法:啟動與停止" #: ../../library/unittest.mock.rst:1817 msgid "" -"All the patchers have :meth:`start` and :meth:`stop` methods. These make it " -"simpler to do patching in ``setUp`` methods or where you want to do multiple " -"patches without nesting decorators or with statements." +"All the patchers have :meth:`!start` and :meth:`!stop` methods. These make " +"it simpler to do patching in ``setUp`` methods or where you want to do " +"multiple patches without nesting decorators or with statements." msgstr "" -"所有的 patcher 都有 :meth:`start` 與 :meth:`stop` 方法。這使得在 ``setUp`` 方" -"法中進行 patch 或在你想要在沒有巢狀使用裝飾器或 with 陳述式的情況下進行多個 " -"patch 時變得更簡單。" +"所有的 patcher 都有 :meth:`!start` 與 :meth:`!stop` 方法。這使得在 ``setUp`` " +"方法中進行 patch 或在你想要在沒有巢狀使用裝飾器或 with 陳述式的情況下進行多" +"個 patch 時變得更簡單。" #: ../../library/unittest.mock.rst:1821 msgid "" "To use them call :func:`patch`, :func:`patch.object` or :func:`patch.dict` " "as normal and keep a reference to the returned ``patcher`` object. You can " -"then call :meth:`start` to put the patch in place and :meth:`stop` to undo " +"then call :meth:`!start` to put the patch in place and :meth:`!stop` to undo " "it." msgstr "" "要使用它們,請像平常一樣呼叫 :func:`patch`、:func:`patch.object` 或 :func:" "`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼叫 :meth:" -"`start` 將 patch 準備就緒,並呼叫 :meth:`stop` 來取消 patch。" +"`!start` 將 patch 準備就緒,並呼叫 :meth:`!stop` 來取消 patch。" #: ../../library/unittest.mock.rst:1825 msgid "" @@ -2261,10 +2262,10 @@ msgstr "" #: ../../library/unittest.mock.rst:1839 msgid "" "A typical use case for this might be for doing multiple patches in the " -"``setUp`` method of a :class:`TestCase`::" +"``setUp`` method of a :class:`~unittest.TestCase`::" msgstr "" -"一個典型的用法是在一個 :class:`TestCase` 的 ``setUp`` 方法中執行多個 " -"patch: ::" +"一個典型的用法是在一個 :class:`~unittest.TestCase` 的 ``setUp`` 方法中執行多" +"個 patch: ::" #: ../../library/unittest.mock.rst:1842 msgid "" @@ -3355,11 +3356,11 @@ msgstr "" msgid "" "Alternatively you can just use ``vars(my_mock)`` (instance members) and " "``dir(type(my_mock))`` (type members) to bypass the filtering irrespective " -"of :const:`mock.FILTER_DIR`." +"of :const:`FILTER_DIR`." msgstr "" "或者,你可以只使用 ``vars(my_mock)``\\ (實例成員)和 " -"``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考慮 :const:`mock." -"FILTER_DIR`。" +"``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考慮 :const:" +"`FILTER_DIR`。" #: ../../library/unittest.mock.rst:2517 msgid "mock_open" @@ -3384,17 +3385,17 @@ msgstr "" #: ../../library/unittest.mock.rst:2528 msgid "" -"*read_data* is a string for the :meth:`~io.IOBase.read`, :meth:`~io.IOBase." -"readline`, and :meth:`~io.IOBase.readlines` methods of the file handle to " -"return. Calls to those methods will take data from *read_data* until it is " -"depleted. The mock of these methods is pretty simplistic: every time the " -"*mock* is called, the *read_data* is rewound to the start. If you need more " -"control over the data that you are feeding to the tested code you will need " -"to customize this mock for yourself. When that is insufficient, one of the " -"in-memory filesystem packages on `PyPI `_ can offer a " -"realistic filesystem for testing." -msgstr "" -"*read_data* 是檔案處理方法 :meth:`~io.IOBase.read`、:meth:`~io.IOBase." +"*read_data* is a string for the :meth:`~io.RawIOBase.read`, :meth:`~io." +"IOBase.readline`, and :meth:`~io.IOBase.readlines` methods of the file " +"handle to return. Calls to those methods will take data from *read_data* " +"until it is depleted. The mock of these methods is pretty simplistic: every " +"time the *mock* is called, the *read_data* is rewound to the start. If you " +"need more control over the data that you are feeding to the tested code you " +"will need to customize this mock for yourself. When that is insufficient, " +"one of the in-memory filesystem packages on `PyPI `_ can " +"offer a realistic filesystem for testing." +msgstr "" +"*read_data* 是檔案處理方法 :meth:`~io.RawIOBase.read`、:meth:`~io.IOBase." "readline` 和 :meth:`~io.IOBase.readlines` 的回傳字串。對這些方法的呼叫將從 " "*read_data* 取得資料,直到資料耗盡。對這些方法的 mock 非常單純:每次呼叫 " "*mock* 時,*read_data* 都會倒回到起點。如果你需要對提供給測試程式碼的資料進行" @@ -3405,12 +3406,12 @@ msgstr "" #: ../../library/unittest.mock.rst:2538 msgid "" "Added :meth:`~io.IOBase.readline` and :meth:`~io.IOBase.readlines` support. " -"The mock of :meth:`~io.IOBase.read` changed to consume *read_data* rather " +"The mock of :meth:`~io.RawIOBase.read` changed to consume *read_data* rather " "than returning it on each call." msgstr "" "新增對 :meth:`~io.IOBase.readline` 和 :meth:`~io.IOBase.readlines` 的支援。:" -"meth:`~io.IOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼叫時回傳" -"它。" +"meth:`~io.RawIOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼叫時回" +"傳它。" #: ../../library/unittest.mock.rst:2543 msgid "*read_data* is now reset on each call to the *mock*." @@ -3514,17 +3515,17 @@ msgstr "Autospeccing(自動規格)" #: ../../library/unittest.mock.rst:2592 msgid "" -"Autospeccing is based on the existing :attr:`spec` feature of mock. It " +"Autospeccing is based on the existing :attr:`!spec` feature of mock. It " "limits the api of mocks to the api of an original object (the spec), but it " "is recursive (implemented lazily) so that attributes of mocks only have the " "same api as the attributes of the spec. In addition mocked functions / " "methods have the same call signature as the original so they raise a :exc:" "`TypeError` if they are called incorrectly." msgstr "" -"自動規格以 mock 現有的 :attr:`spec` 功能作為基礎。它將 mock 的 api 限制為原始" -"物件(規格)的 api,但它是遞迴的(惰性 (lazily) 實現),因此 mock 的屬性僅具" -"有與規格的屬性相同的 api。此外,被 mock 的函式/方法具有與原始的函式/方法相同" -"的呼叫簽名,因此如果它們被不正確地呼叫,就會引發 :exc:`TypeError`。" +"自動規格以 mock 現有的 :attr:`!spec` 功能作為基礎。它將 mock 的 api 限制為原" +"始物件(規格)的 api,但它是遞迴的(惰性 (lazily) 實現),因此 mock 的屬性僅" +"具有與規格的屬性相同的 api。此外,被 mock 的函式/方法具有與原始的函式/方法相" +"同的呼叫簽名,因此如果它們被不正確地呼叫,就會引發 :exc:`TypeError`。" #: ../../library/unittest.mock.rst:2599 msgid "Before I explain how auto-speccing works, here's why it is needed." @@ -3564,13 +3565,13 @@ msgstr "" #: ../../library/unittest.mock.rst:2617 msgid "" -":mod:`mock` already provides a feature to help with this, called speccing. " -"If you use a class or instance as the :attr:`spec` for a mock then you can " -"only access attributes on the mock that exist on the real class:" +":mod:`unittest.mock` already provides a feature to help with this, called " +"speccing. If you use a class or instance as the :attr:`!spec` for a mock " +"then you can only access attributes on the mock that exist on the real class:" msgstr "" -":mod:`mock` 已經提供了一個功能來幫助解決這個問題,其稱為 speccing。如果你使用" -"類別或實例作為 mock 的 :attr:`spec`,那麼你在 mock 上只能存取真實類別中存在的" -"屬性:" +":mod:`unittest.mock` 已經提供了一個功能來幫助解決這個問題,其稱為 speccing。" +"如果你使用類別或實例作為 mock 的 :attr:`!spec`,那麼你在 mock 上只能存取真實" +"類別中存在的屬性:" #: ../../library/unittest.mock.rst:2628 msgid "" @@ -3630,13 +3631,13 @@ msgstr "" #: ../../library/unittest.mock.rst:2656 msgid "" -"You can see that :class:`request.Request` has a spec. :class:`request." +"You can see that :class:`!request.Request` has a spec. :class:`!request." "Request` takes two arguments in the constructor (one of which is *self*). " "Here's what happens if we try to call it incorrectly::" msgstr "" -"你可以看到 :class:`request.Request` 有一個規格。:class:`request.Request` 在建" -"構函式中接受兩個引數(其中之一是 *self*\\ )。如果我們錯誤地呼叫它,會發生以" -"下情況: ::" +"你可以看到 :class:`!request.Request` 有一個規格。:class:`!request.Request` 在" +"建構函式中接受兩個引數(其中之一是 *self*\\ )。如果我們錯誤地呼叫它,會發生" +"以下情況: ::" #: ../../library/unittest.mock.rst:2660 msgid "" @@ -3668,13 +3669,13 @@ msgstr "" #: ../../library/unittest.mock.rst:2672 msgid "" -":class:`Request` objects are not callable, so the return value of " -"instantiating our mocked out :class:`request.Request` is a non-callable " +":class:`!Request` objects are not callable, so the return value of " +"instantiating our mocked out :class:`!request.Request` is a non-callable " "mock. With the spec in place any typos in our asserts will raise the correct " "error::" msgstr "" -":class:`Request` 物件不是可呼叫物件,因此實例化我們 mock out 的 :class:" -"`request.Request` 的回傳值是不可呼叫的 mock。規格到位後,斷言中的任何拼字錯誤" +":class:`!Request` 物件不是可呼叫物件,因此實例化我們 mock out 的 :class:`!" +"request.Request` 的回傳值是不可呼叫的 mock。規格到位後,斷言中的任何拼字錯誤" "都會引發正確的錯誤: ::" #: ../../library/unittest.mock.rst:2676 @@ -3930,8 +3931,9 @@ msgstr "" #: ../../library/unittest.mock.rst:2826 msgid "" -"Order of precedence of :attr:`side_effect`, :attr:`return_value` and *wraps*" -msgstr ":attr:`side_effect`、:attr:`return_value` 和 *wraps* 的優先順序" +"Order of precedence of :attr:`!side_effect`, :attr:`!return_value` and " +"*wraps*" +msgstr ":attr:`!side_effect`、:attr:`!return_value` 和 *wraps* 的優先順序" #: ../../library/unittest.mock.rst:2828 msgid "The order of their precedence is:" diff --git a/library/urllib.request.po b/library/urllib.request.po index 5720f797b8..aa86249d18 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2022-04-21 17:59+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -54,8 +54,8 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" @@ -2161,44 +2161,3 @@ msgstr "FTP" #: ../../library/urllib.request.rst:1557 msgid "HTML" msgstr "HTML" - -#~ msgid "" -#~ "The optional *cafile* and *capath* parameters specify a set of trusted CA " -#~ "certificates for HTTPS requests. *cafile* should point to a single file " -#~ "containing a bundle of CA certificates, whereas *capath* should point to " -#~ "a directory of hashed certificate files. More information can be found " -#~ "in :meth:`ssl.SSLContext.load_verify_locations`." -#~ msgstr "" -#~ "選擇性參數 *cafile* 與 *capath* 用來指定一組 HTTPS 請求中所需之受信任 CA " -#~ "憑證。*cafile* 的值應該指向內容包含一堆 CA 憑證的單一檔案,而 *capath* 則" -#~ "指向存放一堆雜湊後的憑證檔案的目錄。欲瞭解更多的資訊請參見 :meth:`ssl." -#~ "SSLContext.load_verify_locations`。" - -#~ msgid "The *cadefault* parameter is ignored." -#~ msgstr "參數 *cadefault* 已被忽略。" - -#~ msgid "" -#~ "*cafile*, *capath* and *cadefault* are deprecated in favor of *context*. " -#~ "Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let :func:" -#~ "`ssl.create_default_context` select the system's trusted CA certificates " -#~ "for you." -#~ msgstr "" -#~ "*cafile*、*capath*、*cadefault* 已經被棄用並應改為使用 *context*。請改用 :" -#~ "meth:`ssl.SSLContext.load_cert_chain`,或是讓 :func:`ssl." -#~ "create_default_context` 選取系統中受信任的 CA 憑證。" - -#, fuzzy -#~ msgid "" -#~ "The default opener raises an auditing event urllib.Request with arguments " -#~ "fullurl, data, headers, method taken from the request object." -#~ msgstr "" -#~ "預設的 opener 會觸發一個 :ref:`auditing event ` ``urllib." -#~ "Request`` 與其從請求物件中所獲得的引數 ``fullurl``、``data``、" -#~ "``headers``、``method``。" - -#~ msgid "" -#~ "Raises an :ref:`auditing event ` ``urllib.Request`` with " -#~ "arguments ``fullurl``, ``data``, ``headers``, ``method``." -#~ msgstr "" -#~ "觸發一個 :ref:`auditing event ` ``urllib.Request`` 及其引數 " -#~ "``fullurl``、``data``、``headers``、``method``。" diff --git a/library/venv.po b/library/venv.po index ab4f0f4050..0ed5da76cd 100644 --- a/library/venv.po +++ b/library/venv.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-30 09:19+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2023-07-09 15:09+0800\n" "Last-Translator: Po-Chuan Chen \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -92,8 +91,8 @@ msgid "" msgstr "" #: ../../includes/wasm-mobile-notavail.rst:3 -msgid ":ref:`Availability `: not Android, not iOS, not WASI." -msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-mobile-notavail.rst:5 msgid "" @@ -403,9 +402,9 @@ msgstr "csh/tcsh" msgid ":samp:`$ source {}/bin/activate.csh`" msgstr ":samp:`$ source {}/bin/activate.csh`" -#: ../../library/venv.rst:218 ../../library/venv.rst:222 -msgid "PowerShell" -msgstr "PowerShell" +#: ../../library/venv.rst:218 +msgid "pwsh" +msgstr "pwsh" #: ../../library/venv.rst:218 msgid ":samp:`$ {}/bin/Activate.ps1`" @@ -423,6 +422,10 @@ msgstr "cmd.exe" msgid ":samp:`C:\\\\> {}\\\\Scripts\\\\activate.bat`" msgstr ":samp:`C:\\\\> {}\\\\Scripts\\\\activate.bat`" +#: ../../library/venv.rst:222 +msgid "PowerShell" +msgstr "PowerShell" + #: ../../library/venv.rst:222 msgid ":samp:`PS C:\\\\> {}\\\\Scripts\\\\Activate.ps1`" msgstr ":samp:`PS C:\\\\> {}\\\\Scripts\\\\Activate.ps1`" @@ -613,7 +616,7 @@ msgstr "新增 ``scm_ignore_files`` 參數" #: ../../library/venv.rst:333 msgid ":class:`EnvBuilder` may be used as a base class." -msgstr "" +msgstr ":class:`EnvBuilder` 可以被用作為基底類別。" #: ../../library/venv.rst:337 msgid "" diff --git a/library/webbrowser.po b/library/webbrowser.po index 0bed38a963..d65090b5fb 100644 --- a/library/webbrowser.po +++ b/library/webbrowser.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2024-09-24 18:27+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -56,10 +56,10 @@ msgid "" "with the argument URL substituted for ``%s``; if the part does not contain " "``%s``, it is simply interpreted as the name of the browser to launch. [1]_" msgstr "" -"如果環境變數 :envvar:`BROWSER` 存在,它會被直譯為以 :data:`os.pathsep` 分隔的瀏" -"覽器串列,以在平台預設值之前嘗試。當串列部分的值包含字串 ``%s`` 時,它會被直" -"譯為字面瀏覽器命令列,並使用引數 URL 替換 ``%s``;如果該部分不包含 ``%s``,則" -"它僅被直譯為要啟動的瀏覽器的名稱。 [1]_" +"如果環境變數 :envvar:`BROWSER` 存在,它會被直譯為以 :data:`os.pathsep` 分隔的" +"瀏覽器串列,以在平台預設值之前嘗試。當串列部分的值包含字串 ``%s`` 時,它會被" +"直譯為字面瀏覽器命令列,並使用引數 URL 替換 ``%s``;如果該部分不包含 ``%s``," +"則它僅被直譯為要啟動的瀏覽器的名稱。 [1]_" #: ../../library/webbrowser.rst:30 msgid "" @@ -115,8 +115,8 @@ msgid "python -m webbrowser -t \"https://www.python.org/"" msgstr "python -m webbrowser -t \"https://www.python.org/"" #: ../../library/webbrowser.rst:54 -msgid ":ref:`Availability `: not WASI, not Android." -msgstr ":ref:`可用性 `:非 WASI、非 Android。" +msgid "Availability" +msgstr "" #: ../../library/webbrowser.rst:56 msgid "The following exception is defined:" @@ -188,8 +188,8 @@ msgid "" "``None``, return a controller for a default browser appropriate to the " "caller's environment." msgstr "" -"回傳瀏覽器類型\\ *使用*(以引數 *using* 給定)的控制器物件。如果 *using* 為 ``None``,則回傳適合" -"呼叫者環境的預設瀏覽器控制器。" +"回傳瀏覽器類型\\ *使用*(以引數 *using* 給定)的控制器物件。如果 *using* 為 " +"``None``,則回傳適合呼叫者環境的預設瀏覽器控制器。" #: ../../library/webbrowser.rst:109 msgid "" @@ -199,10 +199,10 @@ msgid "" "without parameters to create an instance when needed. If *instance* is " "provided, *constructor* will never be called, and may be ``None``." msgstr "" -"註冊瀏覽器類型\\ *名稱*(以引數 *name* 給定)。一旦註冊了瀏覽器類型,:func:`get` 函式就可以回傳該瀏" -"覽器類型的控制器。如果沒有提供 *instance* 或為 ``None``,則會在需要時不帶參數" -"地呼叫 *constructor* 來建立實例。如果提供了 *instance*,*constructor* 將永遠" -"不會被呼叫,並且可能為 ``None``。" +"註冊瀏覽器類型\\ *名稱*(以引數 *name* 給定)。一旦註冊了瀏覽器類型,:func:" +"`get` 函式就可以回傳該瀏覽器類型的控制器。如果沒有提供 *instance* 或為 " +"``None``,則會在需要時不帶參數地呼叫 *constructor* 來建立實例。如果提供了 " +"*instance*,*constructor* 將永遠不會被呼叫,並且可能為 ``None``。" #: ../../library/webbrowser.rst:115 msgid "" diff --git a/library/xmlrpc.client.po b/library/xmlrpc.client.po index 927aeeba24..4ea29b3a93 100644 --- a/library/xmlrpc.client.po +++ b/library/xmlrpc.client.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -48,8 +48,8 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" diff --git a/library/xmlrpc.server.po b/library/xmlrpc.server.po index 7e1eba8c5a..7a0eb729b9 100644 --- a/library/xmlrpc.server.po +++ b/library/xmlrpc.server.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,8 +42,8 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" diff --git a/library/zoneinfo.po b/library/zoneinfo.po index 0859e10f69..c86aa43ca4 100644 --- a/library/zoneinfo.po +++ b/library/zoneinfo.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -46,7 +46,7 @@ msgstr "" #: ../../library/zoneinfo.rst:28 msgid "Package :pypi:`tzdata`" -msgstr "" +msgstr ":pypi:`tzdata` 套件" #: ../../library/zoneinfo.rst:29 msgid "" @@ -55,8 +55,8 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" +msgid "Availability" +msgstr "" #: ../../includes/wasm-notavail.rst:5 msgid "" diff --git a/reference/datamodel.po b/reference/datamodel.po index 4a7709654d..abda8ae6ec 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-04 00:13+0000\n" +"POT-Creation-Date: 2024-10-10 00:13+0000\n" "PO-Revision-Date: 2024-09-24 19:03+0900\n" "Last-Translator: Kisaragi Hiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -668,18 +668,18 @@ msgid "" "containing the same number of items as the function's formal parameter list." msgstr "" -#: ../../reference/datamodel.rst:545 ../../reference/datamodel.rst:1206 -#: ../../reference/datamodel.rst:1403 +#: ../../reference/datamodel.rst:545 ../../reference/datamodel.rst:1395 +#: ../../reference/datamodel.rst:1596 msgid "Special read-only attributes" msgstr "特殊唯讀屬性" -#: ../../reference/datamodel.rst:555 ../../reference/datamodel.rst:589 -#: ../../reference/datamodel.rst:981 +#: ../../reference/datamodel.rst:555 ../../reference/datamodel.rst:590 +#: ../../reference/datamodel.rst:1170 msgid "Attribute" msgstr "屬性" -#: ../../reference/datamodel.rst:556 ../../reference/datamodel.rst:590 -#: ../../reference/datamodel.rst:982 +#: ../../reference/datamodel.rst:556 ../../reference/datamodel.rst:591 +#: ../../reference/datamodel.rst:1171 msgid "Meaning" msgstr "含義" @@ -692,66 +692,67 @@ msgstr "" #: ../../reference/datamodel.rst:564 msgid "" -"``None`` or a :class:`tuple` of cells that contain bindings for the " -"function's free variables." +"``None`` or a :class:`tuple` of cells that contain bindings for the names " +"specified in the :attr:`~codeobject.co_freevars` attribute of the " +"function's :attr:`code object `." msgstr "" -#: ../../reference/datamodel.rst:567 +#: ../../reference/datamodel.rst:568 msgid "" "A cell object has the attribute ``cell_contents``. This can be used to get " "the value of the cell, as well as set the value." msgstr "" -#: ../../reference/datamodel.rst:571 ../../reference/datamodel.rst:1445 +#: ../../reference/datamodel.rst:572 ../../reference/datamodel.rst:1638 msgid "Special writable attributes" msgstr "特殊可寫屬性" -#: ../../reference/datamodel.rst:584 +#: ../../reference/datamodel.rst:585 msgid "Most of these attributes check the type of the assigned value:" msgstr "" -#: ../../reference/datamodel.rst:593 +#: ../../reference/datamodel.rst:594 msgid "The function's documentation string, or ``None`` if unavailable." msgstr "函式的文件字串,若不可用則為 ``None``。" -#: ../../reference/datamodel.rst:596 +#: ../../reference/datamodel.rst:597 msgid "" "The function's name. See also: :attr:`__name__ attributes `." msgstr "" -#: ../../reference/datamodel.rst:600 +#: ../../reference/datamodel.rst:601 msgid "" "The function's :term:`qualified name`. See also: :attr:`__qualname__ " "attributes `." msgstr "" -#: ../../reference/datamodel.rst:606 +#: ../../reference/datamodel.rst:607 msgid "" "The name of the module the function was defined in, or ``None`` if " "unavailable." msgstr "" -#: ../../reference/datamodel.rst:610 +#: ../../reference/datamodel.rst:611 msgid "" "A :class:`tuple` containing default :term:`parameter` values for those " "parameters that have defaults, or ``None`` if no parameters have a default " "value." msgstr "" -#: ../../reference/datamodel.rst:615 +#: ../../reference/datamodel.rst:616 msgid "" "The :ref:`code object ` representing the compiled function " "body." msgstr "代表編譯函式主體的\\ :ref:`程式碼物件 `。" -#: ../../reference/datamodel.rst:619 +#: ../../reference/datamodel.rst:620 msgid "" "The namespace supporting arbitrary function attributes. See also: :attr:" "`__dict__ attributes `." msgstr "" -#: ../../reference/datamodel.rst:623 +#: ../../reference/datamodel.rst:624 msgid "" "A :class:`dictionary ` containing annotations of :term:`parameters " "`. The keys of the dictionary are the parameter names, and " @@ -759,88 +760,88 @@ msgid "" "`annotations-howto`." msgstr "" -#: ../../reference/datamodel.rst:630 +#: ../../reference/datamodel.rst:631 msgid "" "A :class:`dictionary ` containing defaults for keyword-only :term:" "`parameters `." msgstr "" -#: ../../reference/datamodel.rst:634 +#: ../../reference/datamodel.rst:635 msgid "" "A :class:`tuple` containing the :ref:`type parameters ` of a :" "ref:`generic function `." msgstr "" -#: ../../reference/datamodel.rst:639 +#: ../../reference/datamodel.rst:640 msgid "" "Function objects also support getting and setting arbitrary attributes, " "which can be used, for example, to attach metadata to functions. Regular " "attribute dot-notation is used to get and set such attributes." msgstr "" -#: ../../reference/datamodel.rst:645 +#: ../../reference/datamodel.rst:646 msgid "" "CPython's current implementation only supports function attributes on user-" "defined functions. Function attributes on :ref:`built-in functions ` may be supported in the future." msgstr "" -#: ../../reference/datamodel.rst:650 +#: ../../reference/datamodel.rst:651 msgid "" "Additional information about a function's definition can be retrieved from " "its :ref:`code object ` (accessible via the :attr:`~function." "__code__` attribute)." msgstr "" -#: ../../reference/datamodel.rst:658 +#: ../../reference/datamodel.rst:659 msgid "Instance methods" msgstr "" -#: ../../reference/datamodel.rst:665 +#: ../../reference/datamodel.rst:666 msgid "" "An instance method object combines a class, a class instance and any " "callable object (normally a user-defined function)." msgstr "" -#: ../../reference/datamodel.rst:675 ../../reference/datamodel.rst:1541 +#: ../../reference/datamodel.rst:676 ../../reference/datamodel.rst:1734 msgid "Special read-only attributes:" msgstr "特殊唯讀屬性:" -#: ../../reference/datamodel.rst:680 +#: ../../reference/datamodel.rst:681 msgid "" "Refers to the class instance object to which the method is :ref:`bound " "`" msgstr "" -#: ../../reference/datamodel.rst:684 +#: ../../reference/datamodel.rst:685 msgid "Refers to the original :ref:`function object `" msgstr "" -#: ../../reference/datamodel.rst:687 +#: ../../reference/datamodel.rst:688 msgid "" "The method's documentation (same as :attr:`method.__func__.__doc__ `). A :class:`string ` if the original function had a " "docstring, else ``None``." msgstr "" -#: ../../reference/datamodel.rst:693 +#: ../../reference/datamodel.rst:694 msgid "" "The name of the method (same as :attr:`method.__func__.__name__ `)" msgstr "" -#: ../../reference/datamodel.rst:697 +#: ../../reference/datamodel.rst:698 msgid "" "The name of the module the method was defined in, or ``None`` if unavailable." msgstr "" -#: ../../reference/datamodel.rst:700 +#: ../../reference/datamodel.rst:701 msgid "" "Methods also support accessing (but not setting) the arbitrary function " "attributes on the underlying :ref:`function object `." msgstr "" -#: ../../reference/datamodel.rst:703 +#: ../../reference/datamodel.rst:704 msgid "" "User-defined method objects may be created when getting an attribute of a " "class (perhaps via an instance of that class), if that attribute is a user-" @@ -848,7 +849,7 @@ msgid "" "`classmethod` object." msgstr "" -#: ../../reference/datamodel.rst:710 +#: ../../reference/datamodel.rst:711 msgid "" "When an instance method object is created by retrieving a user-defined :ref:" "`function object ` from a class via one of its " @@ -857,7 +858,7 @@ msgid "" "__func__` attribute is the original function object." msgstr "" -#: ../../reference/datamodel.rst:716 +#: ../../reference/datamodel.rst:717 msgid "" "When an instance method object is created by retrieving a :class:" "`classmethod` object from a class or instance, its :attr:`~method.__self__` " @@ -865,7 +866,7 @@ msgid "" "the function object underlying the class method." msgstr "" -#: ../../reference/datamodel.rst:721 +#: ../../reference/datamodel.rst:722 msgid "" "When an instance method object is called, the underlying function (:attr:" "`~method.__func__`) is called, inserting the class instance (:attr:`~method." @@ -875,7 +876,7 @@ msgid "" "f(x, 1)``." msgstr "" -#: ../../reference/datamodel.rst:728 +#: ../../reference/datamodel.rst:729 msgid "" "When an instance method object is derived from a :class:`classmethod` " "object, the \"class instance\" stored in :attr:`~method.__self__` will " @@ -884,18 +885,18 @@ msgid "" "function." msgstr "" -#: ../../reference/datamodel.rst:733 +#: ../../reference/datamodel.rst:734 msgid "" "It is important to note that user-defined functions which are attributes of " "a class instance are not converted to bound methods; this *only* happens " "when the function is an attribute of the class." msgstr "" -#: ../../reference/datamodel.rst:740 +#: ../../reference/datamodel.rst:741 msgid "Generator functions" msgstr "Generator(產生器)函式" -#: ../../reference/datamodel.rst:746 +#: ../../reference/datamodel.rst:747 msgid "" "A function or method which uses the :keyword:`yield` statement (see section :" "ref:`yield`) is called a :dfn:`generator function`. Such a function, when " @@ -908,11 +909,11 @@ msgid "" "values to be returned." msgstr "" -#: ../../reference/datamodel.rst:758 +#: ../../reference/datamodel.rst:759 msgid "Coroutine functions" msgstr "Coroutine(協程)函式" -#: ../../reference/datamodel.rst:763 +#: ../../reference/datamodel.rst:764 msgid "" "A function or method which is defined using :keyword:`async def` is called " "a :dfn:`coroutine function`. Such a function, when called, returns a :term:" @@ -921,11 +922,11 @@ msgid "" "ref:`coroutine-objects` section." msgstr "" -#: ../../reference/datamodel.rst:771 +#: ../../reference/datamodel.rst:772 msgid "Asynchronous generator functions" msgstr "" -#: ../../reference/datamodel.rst:777 +#: ../../reference/datamodel.rst:778 msgid "" "A function or method which is defined using :keyword:`async def` and which " "uses the :keyword:`yield` statement is called a :dfn:`asynchronous generator " @@ -934,7 +935,7 @@ msgid "" "execute the body of the function." msgstr "" -#: ../../reference/datamodel.rst:783 +#: ../../reference/datamodel.rst:784 msgid "" "Calling the asynchronous iterator's :meth:`aiterator.__anext__ ` method will return an :term:`awaitable` which when awaited will " @@ -945,11 +946,11 @@ msgid "" "yielded." msgstr "" -#: ../../reference/datamodel.rst:796 +#: ../../reference/datamodel.rst:797 msgid "Built-in functions" msgstr "內建函式" -#: ../../reference/datamodel.rst:803 +#: ../../reference/datamodel.rst:804 msgid "" "A built-in function object is a wrapper around a C function. Examples of " "built-in functions are :func:`len` and :func:`math.sin` (:mod:`math` is a " @@ -960,7 +961,7 @@ msgstr "" "func:`math.sin`\\ (\\ :mod:`math` 是一個標準的內建模組)。內建函式的引數數量" "與其型別由其包裝的 C 函式所決定。特殊唯讀屬性:" -#: ../../reference/datamodel.rst:808 +#: ../../reference/datamodel.rst:809 msgid "" ":attr:`!__doc__` is the function's documentation string, or ``None`` if " "unavailable. See :attr:`function.__doc__`." @@ -968,26 +969,26 @@ msgstr "" ":attr:`!__doc__` 是函式的文件字串,若不可用則為 ``None``。請見 :attr:" "`function.__doc__`。" -#: ../../reference/datamodel.rst:810 +#: ../../reference/datamodel.rst:811 msgid "" ":attr:`!__name__` is the function's name. See :attr:`function.__name__`." msgstr ":attr:`!__name__` 是函式的名稱。請見 :attr:`function.__name__`。" -#: ../../reference/datamodel.rst:811 +#: ../../reference/datamodel.rst:812 msgid ":attr:`!__self__` is set to ``None`` (but see the next item)." msgstr "" -#: ../../reference/datamodel.rst:812 +#: ../../reference/datamodel.rst:813 msgid "" ":attr:`!__module__` is the name of the module the function was defined in or " "``None`` if unavailable. See :attr:`function.__module__`." msgstr "" -#: ../../reference/datamodel.rst:820 +#: ../../reference/datamodel.rst:821 msgid "Built-in methods" msgstr "" -#: ../../reference/datamodel.rst:827 +#: ../../reference/datamodel.rst:828 msgid "" "This is really a different disguise of a built-in function, this time " "containing an object passed to the C function as an implicit extra " @@ -998,11 +999,11 @@ msgid "" "__self__>`.)" msgstr "" -#: ../../reference/datamodel.rst:837 +#: ../../reference/datamodel.rst:838 msgid "Classes" msgstr "" -#: ../../reference/datamodel.rst:839 +#: ../../reference/datamodel.rst:840 msgid "" "Classes are callable. These objects normally act as factories for new " "instances of themselves, but variations are possible for class types that " @@ -1011,21 +1012,21 @@ msgid "" "initialize the new instance." msgstr "" -#: ../../reference/datamodel.rst:847 +#: ../../reference/datamodel.rst:848 msgid "Class Instances" msgstr "" -#: ../../reference/datamodel.rst:849 +#: ../../reference/datamodel.rst:850 msgid "" "Instances of arbitrary classes can be made callable by defining a :meth:" "`~object.__call__` method in their class." msgstr "" -#: ../../reference/datamodel.rst:854 +#: ../../reference/datamodel.rst:857 msgid "Modules" msgstr "模組" -#: ../../reference/datamodel.rst:860 +#: ../../reference/datamodel.rst:863 msgid "" "Modules are a basic organizational unit of Python code, and are created by " "the :ref:`import system ` as invoked either by the :keyword:" @@ -1040,63 +1041,288 @@ msgid "" "done)." msgstr "" -#: ../../reference/datamodel.rst:873 +#: ../../reference/datamodel.rst:876 msgid "" "Attribute assignment updates the module's namespace dictionary, e.g., ``m.x " "= 1`` is equivalent to ``m.__dict__[\"x\"] = 1``." msgstr "" -#: ../../reference/datamodel.rst:883 -msgid "Predefined (writable) attributes:" +#: ../../reference/datamodel.rst:894 +msgid "Import-related attributes on module objects" msgstr "" -#: ../../reference/datamodel.rst:885 -msgid ":attr:`__name__`" -msgstr ":attr:`__name__`" +#: ../../reference/datamodel.rst:896 +msgid "" +"Module objects have the following attributes that relate to the :ref:`import " +"system `. When a module is created using the machinery " +"associated with the import system, these attributes are filled in based on " +"the module's :term:`spec `, before the :term:`loader` executes " +"and loads the module." +msgstr "" -#: ../../reference/datamodel.rst:886 -msgid "The module's name." +#: ../../reference/datamodel.rst:902 +msgid "" +"To create a module dynamically rather than using the import system, it's " +"recommended to use :func:`importlib.util.module_from_spec`, which will set " +"the various import-controlled attributes to appropriate values. It's also " +"possible to use the :class:`types.ModuleType` constructor to create modules " +"directly, but this technique is more error-prone, as most attributes must be " +"manually set on the module object after it has been created when using this " +"approach." msgstr "" -#: ../../reference/datamodel.rst:888 -msgid ":attr:`__doc__`" -msgstr ":attr:`__doc__`" +#: ../../reference/datamodel.rst:912 +msgid "" +"With the exception of :attr:`~module.__name__`, it is **strongly** " +"recommended that you rely on :attr:`~module.__spec__` and its attributes " +"instead of any of the other individual attributes listed in this subsection. " +"Note that updating an attribute on :attr:`!__spec__` will not update the " +"corresponding attribute on the module itself:" +msgstr "" -#: ../../reference/datamodel.rst:889 -msgid "The module's documentation string, or ``None`` if unavailable." +#: ../../reference/datamodel.rst:918 +msgid "" +">>> import typing\n" +">>> typing.__name__, typing.__spec__.name\n" +"('typing', 'typing')\n" +">>> typing.__spec__.name = 'spelling'\n" +">>> typing.__name__, typing.__spec__.name\n" +"('typing', 'spelling')\n" +">>> typing.__name__ = 'keyboard_smashing'\n" +">>> typing.__name__, typing.__spec__.name\n" +"('keyboard_smashing', 'spelling')" msgstr "" -#: ../../reference/datamodel.rst:892 -msgid ":attr:`__file__`" -msgstr ":attr:`__file__`" +#: ../../reference/datamodel.rst:932 +msgid "" +"The name used to uniquely identify the module in the import system. For a " +"directly executed module, this will be set to ``\"__main__\"``." +msgstr "" -#: ../../reference/datamodel.rst:893 +#: ../../reference/datamodel.rst:935 msgid "" -"The pathname of the file from which the module was loaded, if it was loaded " -"from a file. The :attr:`__file__` attribute may be missing for certain types " -"of modules, such as C modules that are statically linked into the " -"interpreter. For extension modules loaded dynamically from a shared " -"library, it's the pathname of the shared library file." +"This attribute must be set to the fully qualified name of the module. It is " +"expected to match the value of :attr:`module.__spec__.name `." msgstr "" -#: ../../reference/datamodel.rst:901 -msgid ":attr:`__annotations__`" -msgstr ":attr:`__annotations__`" +#: ../../reference/datamodel.rst:941 +msgid "A record of the module's import-system-related state." +msgstr "" -#: ../../reference/datamodel.rst:902 +#: ../../reference/datamodel.rst:943 +msgid "" +"Set to the :class:`module spec ` that was " +"used when importing the module. See :ref:`module-specs` for more details." +msgstr "" + +#: ../../reference/datamodel.rst:950 +msgid "The :term:`package` a module belongs to." +msgstr "" + +#: ../../reference/datamodel.rst:952 +msgid "" +"If the module is top-level (that is, not a part of any specific package) " +"then the attribute should be set to ``''`` (the empty string). Otherwise, it " +"should be set to the name of the module's package (which can be equal to :" +"attr:`module.__name__` if the module itself is a package). See :pep:`366` " +"for further details." +msgstr "" + +#: ../../reference/datamodel.rst:958 +msgid "" +"This attribute is used instead of :attr:`~module.__name__` to calculate " +"explicit relative imports for main modules. It defaults to ``None`` for " +"modules created dynamically using the :class:`types.ModuleType` constructor; " +"use :func:`importlib.util.module_from_spec` instead to ensure the attribute " +"is set to a :class:`str`." +msgstr "" + +#: ../../reference/datamodel.rst:964 +msgid "" +"It is **strongly** recommended that you use :attr:`module.__spec__.parent " +"` instead of :attr:`!module." +"__package__`. :attr:`__package__` is now only used as a fallback if :attr:`!" +"__spec__.parent` is not set, and this fallback path is deprecated." +msgstr "" + +#: ../../reference/datamodel.rst:970 ../../reference/datamodel.rst:1011 +msgid "" +"This attribute now defaults to ``None`` for modules created dynamically " +"using the :class:`types.ModuleType` constructor. Previously the attribute " +"was optional." +msgstr "" + +#: ../../reference/datamodel.rst:975 +msgid "" +"The value of :attr:`!__package__` is expected to be the same as :attr:" +"`__spec__.parent `. :attr:" +"`__package__` is now only used as a fallback during import resolution if :" +"attr:`!__spec__.parent` is not defined." +msgstr "" + +#: ../../reference/datamodel.rst:981 +msgid "" +":exc:`ImportWarning` is raised if an import resolution falls back to :attr:`!" +"__package__` instead of :attr:`__spec__.parent `." +msgstr "" + +#: ../../reference/datamodel.rst:986 +msgid "" +"Raise :exc:`DeprecationWarning` instead of :exc:`ImportWarning` when falling " +"back to :attr:`!__package__` during import resolution." +msgstr "" + +#: ../../reference/datamodel.rst:990 +msgid "" +":attr:`!__package__` will cease to be set or taken into consideration by the " +"import system or standard library." +msgstr "" + +#: ../../reference/datamodel.rst:996 +msgid "" +"The :term:`loader` object that the import machinery used to load the module." +msgstr "" + +#: ../../reference/datamodel.rst:998 +msgid "" +"This attribute is mostly useful for introspection, but can be used for " +"additional loader-specific functionality, for example getting data " +"associated with a loader." +msgstr "" + +#: ../../reference/datamodel.rst:1002 +msgid "" +":attr:`!__loader__` defaults to ``None`` for modules created dynamically " +"using the :class:`types.ModuleType` constructor; use :func:`importlib.util." +"module_from_spec` instead to ensure the attribute is set to a :term:`loader` " +"object." +msgstr "" + +#: ../../reference/datamodel.rst:1007 +msgid "" +"It is **strongly** recommended that you use :attr:`module.__spec__.loader " +"` instead of :attr:`!module." +"__loader__`." +msgstr "" + +#: ../../reference/datamodel.rst:1016 +msgid "" +"Setting :attr:`!__loader__` on a module while failing to set :attr:`!" +"__spec__.loader` is deprecated. In Python 3.14, :attr:`!__loader__` will " +"cease to be set or taken into consideration by the import system or the " +"standard library." +msgstr "" + +#: ../../reference/datamodel.rst:1024 +msgid "" +"A (possibly empty) :term:`sequence` of strings enumerating the locations " +"where the package's submodules will be found. Non-package modules should not " +"have a :attr:`!__path__` attribute. See :ref:`package-path-rules` for more " +"details." +msgstr "" + +#: ../../reference/datamodel.rst:1029 +msgid "" +"It is **strongly** recommended that you use :attr:`module.__spec__." +"submodule_search_locations ` instead of :attr:`!module.__path__`." +msgstr "" + +#: ../../reference/datamodel.rst:1036 +msgid "" +":attr:`!__file__` and :attr:`!__cached__` are both optional attributes that " +"may or may not be set. Both attributes should be a :class:`str` when they " +"are available." +msgstr "" + +#: ../../reference/datamodel.rst:1040 +msgid "" +":attr:`!__file__` indicates the pathname of the file from which the module " +"was loaded (if loaded from a file), or the pathname of the shared library " +"file for extension modules loaded dynamically from a shared library. It " +"might be missing for certain types of modules, such as C modules that are " +"statically linked into the interpreter, and the :ref:`import system " +"` may opt to leave it unset if it has no semantic meaning (for " +"example, a module loaded from a database)." +msgstr "" + +#: ../../reference/datamodel.rst:1048 +msgid "" +"If :attr:`!__file__` is set then the :attr:`!__cached__` attribute might " +"also be set, which is the path to any compiled version of the code (for " +"example, a byte-compiled file). The file does not need to exist to set this " +"attribute; the path can simply point to where the compiled file *would* " +"exist (see :pep:`3147`)." +msgstr "" + +#: ../../reference/datamodel.rst:1054 +msgid "" +"Note that :attr:`!__cached__` may be set even if :attr:`!__file__` is not " +"set. However, that scenario is quite atypical. Ultimately, the :term:" +"`loader` is what makes use of the module spec provided by the :term:`finder` " +"(from which :attr:`!__file__` and :attr:`!__cached__` are derived). So if a " +"loader can load from a cached module but otherwise does not load from a " +"file, that atypical scenario may be appropriate." +msgstr "" + +#: ../../reference/datamodel.rst:1061 +msgid "" +"It is **strongly** recommended that you use :attr:`module.__spec__.cached " +"` instead of :attr:`!module." +"__cached__`." +msgstr "" + +#: ../../reference/datamodel.rst:1065 +msgid "" +"Setting :attr:`!__cached__` on a module while failing to set :attr:`!" +"__spec__.cached` is deprecated. In Python 3.15, :attr:`!__cached__` will " +"cease to be set or taken into consideration by the import system or standard " +"library." +msgstr "" + +#: ../../reference/datamodel.rst:1072 +msgid "Other writable attributes on module objects" +msgstr "模組物件的其他可寫入屬性" + +#: ../../reference/datamodel.rst:1074 +msgid "" +"As well as the import-related attributes listed above, module objects also " +"have the following writable attributes:" +msgstr "" + +#: ../../reference/datamodel.rst:1079 +msgid "" +"The module's documentation string, or ``None`` if unavailable. See also: :" +"attr:`__doc__ attributes `." +msgstr "" +"模組的文件字串,若不可用則為 ``None``。請見 :attr:`__doc__ attributes " +"`。" + +#: ../../reference/datamodel.rst:1084 msgid "" "A dictionary containing :term:`variable annotations ` " "collected during module body execution. For best practices on working with :" "attr:`__annotations__`, please see :ref:`annotations-howto`." msgstr "" -#: ../../reference/datamodel.rst:909 +#: ../../reference/datamodel.rst:1090 +msgid "Module dictionaries" +msgstr "模組字典" + +#: ../../reference/datamodel.rst:1092 +msgid "Module objects also have the following special read-only attribute:" +msgstr "" + +#: ../../reference/datamodel.rst:1097 msgid "" -"Special read-only attribute: :attr:`~object.__dict__` is the module's " -"namespace as a dictionary object." +"The module's namespace as a dictionary object. Uniquely among the attributes " +"listed here, :attr:`!__dict__` cannot be accessed as a global variable from " +"within a module; it can only be accessed as an attribute on module objects." msgstr "" -#: ../../reference/datamodel.rst:914 +#: ../../reference/datamodel.rst:1103 msgid "" "Because of the way CPython clears module dictionaries, the module dictionary " "will be cleared when the module falls out of scope even if the dictionary " @@ -1104,11 +1330,11 @@ msgid "" "module around while using its dictionary directly." msgstr "" -#: ../../reference/datamodel.rst:923 +#: ../../reference/datamodel.rst:1112 msgid "Custom classes" msgstr "" -#: ../../reference/datamodel.rst:925 +#: ../../reference/datamodel.rst:1114 msgid "" "Custom class types are typically created by class definitions (see section :" "ref:`class`). A class has a namespace implemented by a dictionary object. " @@ -1123,7 +1349,7 @@ msgid "" "found at :ref:`python_2.3_mro`." msgstr "" -#: ../../reference/datamodel.rst:946 +#: ../../reference/datamodel.rst:1135 msgid "" "When a class attribute reference (for class :class:`!C`, say) would yield a " "class method object, it is transformed into an instance method object whose :" @@ -1134,66 +1360,66 @@ msgid "" "contained in its :attr:`~object.__dict__`." msgstr "" -#: ../../reference/datamodel.rst:957 +#: ../../reference/datamodel.rst:1146 msgid "" "Class attribute assignments update the class's dictionary, never the " "dictionary of a base class." msgstr "" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:1151 msgid "" "A class object can be called (see above) to yield a class instance (see " "below)." msgstr "" -#: ../../reference/datamodel.rst:965 ../../reference/datamodel.rst:1112 +#: ../../reference/datamodel.rst:1154 ../../reference/datamodel.rst:1301 msgid "Special attributes" msgstr "特殊屬性" -#: ../../reference/datamodel.rst:985 +#: ../../reference/datamodel.rst:1174 msgid "" "The class's name. See also: :attr:`__name__ attributes `." msgstr "" -#: ../../reference/datamodel.rst:989 +#: ../../reference/datamodel.rst:1178 msgid "" "The class's :term:`qualified name`. See also: :attr:`__qualname__ attributes " "`." msgstr "" -#: ../../reference/datamodel.rst:993 +#: ../../reference/datamodel.rst:1182 msgid "The name of the module in which the class was defined." msgstr "" -#: ../../reference/datamodel.rst:996 +#: ../../reference/datamodel.rst:1185 msgid "" "A :class:`mapping proxy ` providing a read-only view " "of the class's namespace. See also: :attr:`__dict__ attributes `." msgstr "" -#: ../../reference/datamodel.rst:1001 +#: ../../reference/datamodel.rst:1190 msgid "" "A :class:`tuple` containing the class's bases. In most cases, for a class " "defined as ``class X(A, B, C)``, ``X.__bases__`` will be exactly equal to " "``(A, B, C)``." msgstr "" -#: ../../reference/datamodel.rst:1006 +#: ../../reference/datamodel.rst:1195 msgid "" "The class's documentation string, or ``None`` if undefined. Not inherited by " "subclasses." msgstr "" -#: ../../reference/datamodel.rst:1010 +#: ../../reference/datamodel.rst:1199 msgid "" "A dictionary containing :term:`variable annotations ` " "collected during class body execution. For best practices on working with :" "attr:`!__annotations__`, please see :ref:`annotations-howto`." msgstr "" -#: ../../reference/datamodel.rst:1017 +#: ../../reference/datamodel.rst:1206 msgid "" "Accessing the :attr:`!__annotations__` attribute of a class object directly " "may yield incorrect results in the presence of metaclasses. In addition, the " @@ -1201,56 +1427,56 @@ msgid "" "get_annotations` to retrieve class annotations safely." msgstr "" -#: ../../reference/datamodel.rst:1024 +#: ../../reference/datamodel.rst:1213 msgid "" "A :class:`tuple` containing the :ref:`type parameters ` of a :" "ref:`generic class `." msgstr "" -#: ../../reference/datamodel.rst:1030 +#: ../../reference/datamodel.rst:1219 msgid "" "A :class:`tuple` containing names of attributes of this class which are " "assigned through ``self.X`` from any function in its body." msgstr "" -#: ../../reference/datamodel.rst:1036 +#: ../../reference/datamodel.rst:1225 msgid "" "The line number of the first line of the class definition, including " "decorators. Setting the :attr:`__module__` attribute removes the :attr:`!" "__firstlineno__` item from the type's dictionary." msgstr "" -#: ../../reference/datamodel.rst:1044 +#: ../../reference/datamodel.rst:1233 msgid "" "The :class:`tuple` of classes that are considered when looking for base " "classes during method resolution." msgstr "" -#: ../../reference/datamodel.rst:1049 +#: ../../reference/datamodel.rst:1238 msgid "Special methods" msgstr "特殊方法" -#: ../../reference/datamodel.rst:1051 +#: ../../reference/datamodel.rst:1240 msgid "" "In addition to the special attributes described above, all Python classes " "also have the following two methods available:" msgstr "" -#: ../../reference/datamodel.rst:1056 +#: ../../reference/datamodel.rst:1245 msgid "" "This method can be overridden by a metaclass to customize the method " "resolution order for its instances. It is called at class instantiation, " "and its result is stored in :attr:`~type.__mro__`." msgstr "" -#: ../../reference/datamodel.rst:1062 +#: ../../reference/datamodel.rst:1251 msgid "" "Each class keeps a list of weak references to its immediate subclasses. This " "method returns a list of all those references still alive. The list is in " "definition order. Example:" msgstr "" -#: ../../reference/datamodel.rst:1066 +#: ../../reference/datamodel.rst:1255 msgid "" ">>> class A: pass\n" ">>> class B(A): pass\n" @@ -1258,11 +1484,11 @@ msgid "" "[]" msgstr "" -#: ../../reference/datamodel.rst:1074 +#: ../../reference/datamodel.rst:1263 msgid "Class instances" msgstr "" -#: ../../reference/datamodel.rst:1082 +#: ../../reference/datamodel.rst:1271 msgid "" "A class instance is created by calling a class object (see above). A class " "instance has a namespace implemented as a dictionary which is the first " @@ -1279,7 +1505,7 @@ msgid "" "__getattr__` method, that is called to satisfy the lookup." msgstr "" -#: ../../reference/datamodel.rst:1098 +#: ../../reference/datamodel.rst:1287 msgid "" "Attribute assignments and deletions update the instance's dictionary, never " "a class's dictionary. If the class has a :meth:`~object.__setattr__` or :" @@ -1287,28 +1513,28 @@ msgid "" "instance dictionary directly." msgstr "" -#: ../../reference/datamodel.rst:1108 +#: ../../reference/datamodel.rst:1297 msgid "" "Class instances can pretend to be numbers, sequences, or mappings if they " "have methods with certain special names. See section :ref:`specialnames`." msgstr "" -#: ../../reference/datamodel.rst:1120 +#: ../../reference/datamodel.rst:1309 msgid "The class to which a class instance belongs." msgstr "" -#: ../../reference/datamodel.rst:1124 +#: ../../reference/datamodel.rst:1313 msgid "" "A dictionary or other mapping object used to store an object's (writable) " "attributes. Not all instances have a :attr:`!__dict__` attribute; see the " "section on :ref:`slots` for more details." msgstr "" -#: ../../reference/datamodel.rst:1130 +#: ../../reference/datamodel.rst:1319 msgid "I/O objects (also known as file objects)" msgstr "" -#: ../../reference/datamodel.rst:1145 +#: ../../reference/datamodel.rst:1334 msgid "" "A :term:`file object` represents an open file. Various shortcuts are " "available to create file objects: the :func:`open` built-in function, and " @@ -1317,7 +1543,7 @@ msgid "" "methods provided by extension modules)." msgstr "" -#: ../../reference/datamodel.rst:1151 +#: ../../reference/datamodel.rst:1340 msgid "" "The objects ``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` are initialized " "to file objects corresponding to the interpreter's standard input, output " @@ -1325,22 +1551,22 @@ msgid "" "interface defined by the :class:`io.TextIOBase` abstract class." msgstr "" -#: ../../reference/datamodel.rst:1159 +#: ../../reference/datamodel.rst:1348 msgid "Internal types" msgstr "" -#: ../../reference/datamodel.rst:1165 +#: ../../reference/datamodel.rst:1354 msgid "" "A few types used internally by the interpreter are exposed to the user. " "Their definitions may change with future versions of the interpreter, but " "they are mentioned here for completeness." msgstr "" -#: ../../reference/datamodel.rst:1173 +#: ../../reference/datamodel.rst:1362 msgid "Code objects" msgstr "" -#: ../../reference/datamodel.rst:1177 +#: ../../reference/datamodel.rst:1366 msgid "" "Code objects represent *byte-compiled* executable Python code, or :term:" "`bytecode`. The difference between a code object and a function object is " @@ -1352,103 +1578,111 @@ msgid "" "no references (directly or indirectly) to mutable objects." msgstr "" -#: ../../reference/datamodel.rst:1211 +#: ../../reference/datamodel.rst:1400 msgid "The function name" msgstr "函式名稱" -#: ../../reference/datamodel.rst:1214 +#: ../../reference/datamodel.rst:1403 msgid "The fully qualified function name" msgstr "" -#: ../../reference/datamodel.rst:1219 +#: ../../reference/datamodel.rst:1408 msgid "" "The total number of positional :term:`parameters ` (including " "positional-only parameters and parameters with default values) that the " "function has" msgstr "" -#: ../../reference/datamodel.rst:1224 +#: ../../reference/datamodel.rst:1413 msgid "" "The number of positional-only :term:`parameters ` (including " "arguments with default values) that the function has" msgstr "" -#: ../../reference/datamodel.rst:1228 +#: ../../reference/datamodel.rst:1417 msgid "" "The number of keyword-only :term:`parameters ` (including " "arguments with default values) that the function has" msgstr "" -#: ../../reference/datamodel.rst:1232 +#: ../../reference/datamodel.rst:1421 msgid "" "The number of :ref:`local variables ` used by the function " "(including parameters)" msgstr "" -#: ../../reference/datamodel.rst:1236 +#: ../../reference/datamodel.rst:1425 msgid "" "A :class:`tuple` containing the names of the local variables in the function " "(starting with the parameter names)" msgstr "" -#: ../../reference/datamodel.rst:1240 +#: ../../reference/datamodel.rst:1429 msgid "" "A :class:`tuple` containing the names of :ref:`local variables ` " -"that are referenced by nested functions inside the function" +"that are referenced from at least one :term:`nested scope` inside the " +"function" msgstr "" -#: ../../reference/datamodel.rst:1244 -msgid "A :class:`tuple` containing the names of free variables in the function" +#: ../../reference/datamodel.rst:1433 +msgid "" +"A :class:`tuple` containing the names of :term:`free (closure) variables " +"` that a :term:`nested scope` references in an outer " +"scope. See also :attr:`function.__closure__`." msgstr "" -#: ../../reference/datamodel.rst:1247 +#: ../../reference/datamodel.rst:1437 +msgid "Note: references to global and builtin names are *not* included." +msgstr "" + +#: ../../reference/datamodel.rst:1440 msgid "" "A string representing the sequence of :term:`bytecode` instructions in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1251 +#: ../../reference/datamodel.rst:1444 msgid "" "A :class:`tuple` containing the literals used by the :term:`bytecode` in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1255 +#: ../../reference/datamodel.rst:1448 msgid "" "A :class:`tuple` containing the names used by the :term:`bytecode` in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1259 +#: ../../reference/datamodel.rst:1452 msgid "The name of the file from which the code was compiled" msgstr "" -#: ../../reference/datamodel.rst:1262 +#: ../../reference/datamodel.rst:1455 msgid "The line number of the first line of the function" msgstr "" -#: ../../reference/datamodel.rst:1265 +#: ../../reference/datamodel.rst:1458 msgid "" "A string encoding the mapping from :term:`bytecode` offsets to line numbers. " "For details, see the source code of the interpreter." msgstr "" -#: ../../reference/datamodel.rst:1268 +#: ../../reference/datamodel.rst:1461 msgid "" "This attribute of code objects is deprecated, and may be removed in Python " "3.14." msgstr "" -#: ../../reference/datamodel.rst:1273 +#: ../../reference/datamodel.rst:1466 msgid "The required stack size of the code object" msgstr "" -#: ../../reference/datamodel.rst:1276 +#: ../../reference/datamodel.rst:1469 msgid "" "An :class:`integer ` encoding a number of flags for the interpreter." msgstr "" -#: ../../reference/datamodel.rst:1281 +#: ../../reference/datamodel.rst:1474 msgid "" "The following flag bits are defined for :attr:`~codeobject.co_flags`: bit " "``0x04`` is set if the function uses the ``*arguments`` syntax to accept an " @@ -1459,7 +1693,7 @@ msgid "" "might be present." msgstr "" -#: ../../reference/datamodel.rst:1289 +#: ../../reference/datamodel.rst:1482 msgid "" "Future feature declarations (``from __future__ import division``) also use " "bits in :attr:`~codeobject.co_flags` to indicate whether a code object was " @@ -1468,29 +1702,29 @@ msgid "" "``0x1000`` were used in earlier versions of Python." msgstr "" -#: ../../reference/datamodel.rst:1295 +#: ../../reference/datamodel.rst:1488 msgid "" "Other bits in :attr:`~codeobject.co_flags` are reserved for internal use." msgstr "" -#: ../../reference/datamodel.rst:1299 +#: ../../reference/datamodel.rst:1492 msgid "" "If a code object represents a function, the first item in :attr:`~codeobject." "co_consts` is the documentation string of the function, or ``None`` if " "undefined." msgstr "" -#: ../../reference/datamodel.rst:1304 +#: ../../reference/datamodel.rst:1497 msgid "Methods on code objects" msgstr "用於程式碼物件的方法" -#: ../../reference/datamodel.rst:1308 +#: ../../reference/datamodel.rst:1501 msgid "" "Returns an iterable over the source code positions of each :term:`bytecode` " "instruction in the code object." msgstr "" -#: ../../reference/datamodel.rst:1311 +#: ../../reference/datamodel.rst:1504 msgid "" "The iterator returns :class:`tuple`\\s containing the ``(start_line, " "end_line, start_column, end_column)``. The *i-th* tuple corresponds to the " @@ -1498,37 +1732,37 @@ msgid "" "information is 0-indexed utf-8 byte offsets on the given source line." msgstr "" -#: ../../reference/datamodel.rst:1317 +#: ../../reference/datamodel.rst:1510 msgid "" "This positional information can be missing. A non-exhaustive lists of cases " "where this may happen:" msgstr "" -#: ../../reference/datamodel.rst:1320 +#: ../../reference/datamodel.rst:1513 msgid "Running the interpreter with :option:`-X` ``no_debug_ranges``." msgstr "" -#: ../../reference/datamodel.rst:1321 +#: ../../reference/datamodel.rst:1514 msgid "" "Loading a pyc file compiled while using :option:`-X` ``no_debug_ranges``." msgstr "" -#: ../../reference/datamodel.rst:1322 +#: ../../reference/datamodel.rst:1515 msgid "Position tuples corresponding to artificial instructions." msgstr "" -#: ../../reference/datamodel.rst:1323 +#: ../../reference/datamodel.rst:1516 msgid "" "Line and column numbers that can't be represented due to implementation " "specific limitations." msgstr "" -#: ../../reference/datamodel.rst:1326 +#: ../../reference/datamodel.rst:1519 msgid "" "When this occurs, some or all of the tuple elements can be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:1332 +#: ../../reference/datamodel.rst:1525 msgid "" "This feature requires storing column positions in code objects which may " "result in a small increase of disk usage of compiled Python files or " @@ -1538,100 +1772,100 @@ msgid "" "environment variable can be used." msgstr "" -#: ../../reference/datamodel.rst:1341 +#: ../../reference/datamodel.rst:1534 msgid "" "Returns an iterator that yields information about successive ranges of :term:" "`bytecode`\\s. Each item yielded is a ``(start, end, lineno)`` :class:" "`tuple`:" msgstr "" -#: ../../reference/datamodel.rst:1345 +#: ../../reference/datamodel.rst:1538 msgid "" "``start`` (an :class:`int`) represents the offset (inclusive) of the start " "of the :term:`bytecode` range" msgstr "" -#: ../../reference/datamodel.rst:1347 +#: ../../reference/datamodel.rst:1540 msgid "" "``end`` (an :class:`int`) represents the offset (exclusive) of the end of " "the :term:`bytecode` range" msgstr "" -#: ../../reference/datamodel.rst:1349 +#: ../../reference/datamodel.rst:1542 msgid "" "``lineno`` is an :class:`int` representing the line number of the :term:" "`bytecode` range, or ``None`` if the bytecodes in the given range have no " "line number" msgstr "" -#: ../../reference/datamodel.rst:1353 +#: ../../reference/datamodel.rst:1546 msgid "The items yielded will have the following properties:" msgstr "" -#: ../../reference/datamodel.rst:1355 +#: ../../reference/datamodel.rst:1548 msgid "The first range yielded will have a ``start`` of 0." msgstr "" -#: ../../reference/datamodel.rst:1356 +#: ../../reference/datamodel.rst:1549 msgid "" "The ``(start, end)`` ranges will be non-decreasing and consecutive. That is, " "for any pair of :class:`tuple`\\s, the ``start`` of the second will be equal " "to the ``end`` of the first." msgstr "" -#: ../../reference/datamodel.rst:1359 +#: ../../reference/datamodel.rst:1552 msgid "No range will be backwards: ``end >= start`` for all triples." msgstr "" -#: ../../reference/datamodel.rst:1360 +#: ../../reference/datamodel.rst:1553 msgid "" "The last :class:`tuple` yielded will have ``end`` equal to the size of the :" "term:`bytecode`." msgstr "" -#: ../../reference/datamodel.rst:1363 +#: ../../reference/datamodel.rst:1556 msgid "" "Zero-width ranges, where ``start == end``, are allowed. Zero-width ranges " "are used for lines that are present in the source code, but have been " "eliminated by the :term:`bytecode` compiler." msgstr "" -#: ../../reference/datamodel.rst:1371 +#: ../../reference/datamodel.rst:1564 msgid ":pep:`626` - Precise line numbers for debugging and other tools." msgstr "" -#: ../../reference/datamodel.rst:1372 +#: ../../reference/datamodel.rst:1565 msgid "The PEP that introduced the :meth:`!co_lines` method." msgstr "" -#: ../../reference/datamodel.rst:1376 +#: ../../reference/datamodel.rst:1569 msgid "" "Return a copy of the code object with new values for the specified fields." msgstr "" -#: ../../reference/datamodel.rst:1378 +#: ../../reference/datamodel.rst:1571 msgid "" "Code objects are also supported by the generic function :func:`copy.replace`." msgstr "" -#: ../../reference/datamodel.rst:1386 +#: ../../reference/datamodel.rst:1579 msgid "Frame objects" msgstr "" -#: ../../reference/datamodel.rst:1390 +#: ../../reference/datamodel.rst:1583 msgid "" "Frame objects represent execution frames. They may occur in :ref:`traceback " "objects `, and are also passed to registered trace " "functions." msgstr "" -#: ../../reference/datamodel.rst:1408 +#: ../../reference/datamodel.rst:1601 msgid "" "Points to the previous stack frame (towards the caller), or ``None`` if this " "is the bottom stack frame" msgstr "" -#: ../../reference/datamodel.rst:1412 +#: ../../reference/datamodel.rst:1605 msgid "" "The :ref:`code object ` being executed in this frame. " "Accessing this attribute raises an :ref:`auditing event ` ``object." @@ -1641,55 +1875,55 @@ msgstr "" "這個屬性會引發一個附帶引數 ``obj`` 與 ``\"f_code\"`` 的\\ :ref:`稽核事件 " "` ``object.__getattr__``。" -#: ../../reference/datamodel.rst:1417 +#: ../../reference/datamodel.rst:1610 msgid "" "The mapping used by the frame to look up :ref:`local variables `. If " "the frame refers to an :term:`optimized scope`, this may return a write-" "through proxy object." msgstr "" -#: ../../reference/datamodel.rst:1422 +#: ../../reference/datamodel.rst:1615 msgid "Return a proxy for optimized scopes." msgstr "" -#: ../../reference/datamodel.rst:1426 +#: ../../reference/datamodel.rst:1619 msgid "" "The dictionary used by the frame to look up :ref:`global variables `" msgstr "" -#: ../../reference/datamodel.rst:1430 +#: ../../reference/datamodel.rst:1623 msgid "" "The dictionary used by the frame to look up :ref:`built-in (intrinsic) names " "`" msgstr "" -#: ../../reference/datamodel.rst:1434 +#: ../../reference/datamodel.rst:1627 msgid "" "The \"precise instruction\" of the frame object (this is an index into the :" "term:`bytecode` string of the :ref:`code object `)" msgstr "" -#: ../../reference/datamodel.rst:1450 +#: ../../reference/datamodel.rst:1643 msgid "" "If not ``None``, this is a function called for various events during code " "execution (this is used by debuggers). Normally an event is triggered for " "each new source line (see :attr:`~frame.f_trace_lines`)." msgstr "" -#: ../../reference/datamodel.rst:1455 +#: ../../reference/datamodel.rst:1648 msgid "" "Set this attribute to :const:`False` to disable triggering a tracing event " "for each source line." msgstr "" -#: ../../reference/datamodel.rst:1459 +#: ../../reference/datamodel.rst:1652 msgid "" "Set this attribute to :const:`True` to allow per-opcode events to be " "requested. Note that this may lead to undefined interpreter behaviour if " "exceptions raised by the trace function escape to the function being traced." msgstr "" -#: ../../reference/datamodel.rst:1465 +#: ../../reference/datamodel.rst:1658 msgid "" "The current line number of the frame -- writing to this from within a trace " "function jumps to the given line (only for the bottom-most frame). A " @@ -1697,15 +1931,15 @@ msgid "" "this attribute." msgstr "" -#: ../../reference/datamodel.rst:1471 +#: ../../reference/datamodel.rst:1664 msgid "Frame object methods" msgstr "" -#: ../../reference/datamodel.rst:1473 +#: ../../reference/datamodel.rst:1666 msgid "Frame objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1477 +#: ../../reference/datamodel.rst:1670 msgid "" "This method clears all references to :ref:`local variables ` held by " "the frame. Also, if the frame belonged to a :term:`generator`, the " @@ -1714,34 +1948,34 @@ msgid "" "and storing its :ref:`traceback ` for later use)." msgstr "" -#: ../../reference/datamodel.rst:1483 +#: ../../reference/datamodel.rst:1676 msgid "" ":exc:`RuntimeError` is raised if the frame is currently executing or " "suspended." msgstr "" -#: ../../reference/datamodel.rst:1488 +#: ../../reference/datamodel.rst:1681 msgid "" "Attempting to clear a suspended frame raises :exc:`RuntimeError` (as has " "always been the case for executing frames)." msgstr "" -#: ../../reference/datamodel.rst:1496 +#: ../../reference/datamodel.rst:1689 msgid "Traceback objects" msgstr "" -#: ../../reference/datamodel.rst:1509 +#: ../../reference/datamodel.rst:1702 msgid "" "Traceback objects represent the stack trace of an :ref:`exception `. A traceback object is implicitly created when an exception occurs, " "and may also be explicitly created by calling :class:`types.TracebackType`." msgstr "" -#: ../../reference/datamodel.rst:1514 +#: ../../reference/datamodel.rst:1707 msgid "Traceback objects can now be explicitly instantiated from Python code." msgstr "" -#: ../../reference/datamodel.rst:1517 +#: ../../reference/datamodel.rst:1710 msgid "" "For implicitly created tracebacks, when the search for an exception handler " "unwinds the execution stack, at each unwound level a traceback object is " @@ -1752,7 +1986,7 @@ msgid "" "the caught exception." msgstr "" -#: ../../reference/datamodel.rst:1526 +#: ../../reference/datamodel.rst:1719 msgid "" "When the program contains no suitable handler, the stack trace is written " "(nicely formatted) to the standard error stream; if the interpreter is " @@ -1760,19 +1994,19 @@ msgid "" "last_traceback`." msgstr "" -#: ../../reference/datamodel.rst:1531 +#: ../../reference/datamodel.rst:1724 msgid "" "For explicitly created tracebacks, it is up to the creator of the traceback " "to determine how the :attr:`~traceback.tb_next` attributes should be linked " "to form a full stack trace." msgstr "" -#: ../../reference/datamodel.rst:1546 +#: ../../reference/datamodel.rst:1739 msgid "" "Points to the execution :ref:`frame ` of the current level." msgstr "" -#: ../../reference/datamodel.rst:1549 +#: ../../reference/datamodel.rst:1742 msgid "" "Accessing this attribute raises an :ref:`auditing event ` ``object." "__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." @@ -1780,15 +2014,15 @@ msgstr "" "存取此屬性會引發一個附帶引數 ``obj`` 與 ``\"tb_frame\"`` 的\\ :ref:`稽核事件 " "` ``object.__getattr__``。" -#: ../../reference/datamodel.rst:1554 +#: ../../reference/datamodel.rst:1747 msgid "Gives the line number where the exception occurred" msgstr "" -#: ../../reference/datamodel.rst:1557 +#: ../../reference/datamodel.rst:1750 msgid "Indicates the \"precise instruction\"." msgstr "" -#: ../../reference/datamodel.rst:1559 +#: ../../reference/datamodel.rst:1752 msgid "" "The line number and last instruction in the traceback may differ from the " "line number of its :ref:`frame object ` if the exception " @@ -1796,39 +2030,39 @@ msgid "" "with a :keyword:`finally` clause." msgstr "" -#: ../../reference/datamodel.rst:1570 +#: ../../reference/datamodel.rst:1763 msgid "" "The special writable attribute :attr:`!tb_next` is the next level in the " "stack trace (towards the frame where the exception occurred), or ``None`` if " "there is no next level." msgstr "" -#: ../../reference/datamodel.rst:1574 +#: ../../reference/datamodel.rst:1767 msgid "This attribute is now writable" msgstr "" -#: ../../reference/datamodel.rst:1579 +#: ../../reference/datamodel.rst:1772 msgid "Slice objects" msgstr "" -#: ../../reference/datamodel.rst:1583 +#: ../../reference/datamodel.rst:1776 msgid "" "Slice objects are used to represent slices for :meth:`~object.__getitem__` " "methods. They are also created by the built-in :func:`slice` function." msgstr "" -#: ../../reference/datamodel.rst:1592 +#: ../../reference/datamodel.rst:1785 msgid "" "Special read-only attributes: :attr:`~slice.start` is the lower bound; :attr:" "`~slice.stop` is the upper bound; :attr:`~slice.step` is the step value; " "each is ``None`` if omitted. These attributes can have any type." msgstr "" -#: ../../reference/datamodel.rst:1596 +#: ../../reference/datamodel.rst:1789 msgid "Slice objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1600 +#: ../../reference/datamodel.rst:1793 msgid "" "This method takes a single integer argument *length* and computes " "information about the slice that the slice object would describe if applied " @@ -1838,11 +2072,11 @@ msgid "" "a manner consistent with regular slices." msgstr "" -#: ../../reference/datamodel.rst:1609 +#: ../../reference/datamodel.rst:1802 msgid "Static method objects" msgstr "" -#: ../../reference/datamodel.rst:1611 +#: ../../reference/datamodel.rst:1804 msgid "" "Static method objects provide a way of defeating the transformation of " "function objects to method objects described above. A static method object " @@ -1853,11 +2087,11 @@ msgid "" "method objects are created by the built-in :func:`staticmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1621 +#: ../../reference/datamodel.rst:1814 msgid "Class method objects" msgstr "" -#: ../../reference/datamodel.rst:1623 +#: ../../reference/datamodel.rst:1816 msgid "" "A class method object, like a static method object, is a wrapper around " "another object that alters the way in which that object is retrieved from " @@ -1867,11 +2101,11 @@ msgid "" "`classmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1633 +#: ../../reference/datamodel.rst:1826 msgid "Special method names" msgstr "" -#: ../../reference/datamodel.rst:1639 +#: ../../reference/datamodel.rst:1832 msgid "" "A class can implement certain operations that are invoked by special syntax " "(such as arithmetic operations or subscripting and slicing) by defining " @@ -1885,7 +2119,7 @@ msgid "" "`TypeError`)." msgstr "" -#: ../../reference/datamodel.rst:1650 +#: ../../reference/datamodel.rst:1843 msgid "" "Setting a special method to ``None`` indicates that the corresponding " "operation is not available. For example, if a class sets :meth:`~object." @@ -1894,7 +2128,7 @@ msgid "" "`~object.__getitem__`). [#]_" msgstr "" -#: ../../reference/datamodel.rst:1656 +#: ../../reference/datamodel.rst:1849 msgid "" "When implementing a class that emulates any built-in type, it is important " "that the emulation only be implemented to the degree that it makes sense for " @@ -1904,11 +2138,11 @@ msgid "" "the W3C's Document Object Model.)" msgstr "" -#: ../../reference/datamodel.rst:1667 +#: ../../reference/datamodel.rst:1860 msgid "Basic customization" msgstr "" -#: ../../reference/datamodel.rst:1673 +#: ../../reference/datamodel.rst:1866 msgid "" "Called to create a new instance of class *cls*. :meth:`__new__` is a static " "method (special-cased so you need not declare it as such) that takes the " @@ -1918,7 +2152,7 @@ msgid "" "new object instance (usually an instance of *cls*)." msgstr "" -#: ../../reference/datamodel.rst:1680 +#: ../../reference/datamodel.rst:1873 msgid "" "Typical implementations create a new instance of the class by invoking the " "superclass's :meth:`__new__` method using ``super().__new__(cls[, ...])`` " @@ -1926,7 +2160,7 @@ msgid "" "necessary before returning it." msgstr "" -#: ../../reference/datamodel.rst:1685 +#: ../../reference/datamodel.rst:1878 msgid "" "If :meth:`__new__` is invoked during object construction and it returns an " "instance of *cls*, then the new instance’s :meth:`__init__` method will be " @@ -1935,13 +2169,13 @@ msgid "" "constructor." msgstr "" -#: ../../reference/datamodel.rst:1690 +#: ../../reference/datamodel.rst:1883 msgid "" "If :meth:`__new__` does not return an instance of *cls*, then the new " "instance's :meth:`__init__` method will not be invoked." msgstr "" -#: ../../reference/datamodel.rst:1693 +#: ../../reference/datamodel.rst:1886 msgid "" ":meth:`__new__` is intended mainly to allow subclasses of immutable types " "(like int, str, or tuple) to customize instance creation. It is also " @@ -1949,7 +2183,7 @@ msgid "" "creation." msgstr "" -#: ../../reference/datamodel.rst:1702 +#: ../../reference/datamodel.rst:1895 msgid "" "Called after the instance has been created (by :meth:`__new__`), but before " "it is returned to the caller. The arguments are those passed to the class " @@ -1959,7 +2193,7 @@ msgid "" "example: ``super().__init__([args...])``." msgstr "" -#: ../../reference/datamodel.rst:1709 +#: ../../reference/datamodel.rst:1902 msgid "" "Because :meth:`__new__` and :meth:`__init__` work together in constructing " "objects (:meth:`__new__` to create it, and :meth:`__init__` to customize " @@ -1967,7 +2201,7 @@ msgid "" "will cause a :exc:`TypeError` to be raised at runtime." msgstr "" -#: ../../reference/datamodel.rst:1722 +#: ../../reference/datamodel.rst:1915 msgid "" "Called when the instance is about to be destroyed. This is also called a " "finalizer or (improperly) a destructor. If a base class has a :meth:" @@ -1976,7 +2210,7 @@ msgid "" "instance." msgstr "" -#: ../../reference/datamodel.rst:1728 +#: ../../reference/datamodel.rst:1921 msgid "" "It is possible (though not recommended!) for the :meth:`__del__` method to " "postpone destruction of the instance by creating a new reference to it. " @@ -1986,7 +2220,7 @@ msgid "" "it once." msgstr "" -#: ../../reference/datamodel.rst:1735 +#: ../../reference/datamodel.rst:1928 msgid "" "It is not guaranteed that :meth:`__del__` methods are called for objects " "that still exist when the interpreter exits. :class:`weakref.finalize` " @@ -1994,14 +2228,14 @@ msgid "" "when an object is garbage collected." msgstr "" -#: ../../reference/datamodel.rst:1742 +#: ../../reference/datamodel.rst:1935 msgid "" "``del x`` doesn't directly call ``x.__del__()`` --- the former decrements " "the reference count for ``x`` by one, and the latter is only called when " "``x``'s reference count reaches zero." msgstr "" -#: ../../reference/datamodel.rst:1747 +#: ../../reference/datamodel.rst:1940 msgid "" "It is possible for a reference cycle to prevent the reference count of an " "object from going to zero. In this case, the cycle will be later detected " @@ -2012,18 +2246,18 @@ msgid "" "caught in the traceback." msgstr "" -#: ../../reference/datamodel.rst:1757 +#: ../../reference/datamodel.rst:1950 msgid "Documentation for the :mod:`gc` module." msgstr "" -#: ../../reference/datamodel.rst:1761 +#: ../../reference/datamodel.rst:1954 msgid "" "Due to the precarious circumstances under which :meth:`__del__` methods are " "invoked, exceptions that occur during their execution are ignored, and a " "warning is printed to ``sys.stderr`` instead. In particular:" msgstr "" -#: ../../reference/datamodel.rst:1765 +#: ../../reference/datamodel.rst:1958 msgid "" ":meth:`__del__` can be invoked when arbitrary code is being executed, " "including from any arbitrary thread. If :meth:`__del__` needs to take a " @@ -2032,7 +2266,7 @@ msgid "" "`__del__`." msgstr "" -#: ../../reference/datamodel.rst:1771 +#: ../../reference/datamodel.rst:1964 msgid "" ":meth:`__del__` can be executed during interpreter shutdown. As a " "consequence, the global variables it needs to access (including other " @@ -2043,7 +2277,7 @@ msgid "" "still available at the time when the :meth:`__del__` method is called." msgstr "" -#: ../../reference/datamodel.rst:1786 +#: ../../reference/datamodel.rst:1979 msgid "" "Called by the :func:`repr` built-in function to compute the \"official\" " "string representation of an object. If at all possible, this should look " @@ -2055,13 +2289,13 @@ msgid "" "an \"informal\" string representation of instances of that class is required." msgstr "" -#: ../../reference/datamodel.rst:1795 +#: ../../reference/datamodel.rst:1988 msgid "" "This is typically used for debugging, so it is important that the " "representation is information-rich and unambiguous." msgstr "" -#: ../../reference/datamodel.rst:1806 +#: ../../reference/datamodel.rst:1999 msgid "" "Called by :func:`str(object) ` and the built-in functions :func:" "`format` and :func:`print` to compute the \"informal\" or nicely printable " @@ -2069,26 +2303,26 @@ msgid "" "` object." msgstr "" -#: ../../reference/datamodel.rst:1811 +#: ../../reference/datamodel.rst:2004 msgid "" "This method differs from :meth:`object.__repr__` in that there is no " "expectation that :meth:`__str__` return a valid Python expression: a more " "convenient or concise representation can be used." msgstr "" -#: ../../reference/datamodel.rst:1815 +#: ../../reference/datamodel.rst:2008 msgid "" "The default implementation defined by the built-in type :class:`object` " "calls :meth:`object.__repr__`." msgstr "" -#: ../../reference/datamodel.rst:1825 +#: ../../reference/datamodel.rst:2018 msgid "" "Called by :ref:`bytes ` to compute a byte-string representation " "of an object. This should return a :class:`bytes` object." msgstr "" -#: ../../reference/datamodel.rst:1836 +#: ../../reference/datamodel.rst:2029 msgid "" "Called by the :func:`format` built-in function, and by extension, evaluation " "of :ref:`formatted string literals ` and the :meth:`str.format` " @@ -2100,28 +2334,28 @@ msgid "" "formatting option syntax." msgstr "" -#: ../../reference/datamodel.rst:1846 +#: ../../reference/datamodel.rst:2039 msgid "" "See :ref:`formatspec` for a description of the standard formatting syntax." msgstr "" -#: ../../reference/datamodel.rst:1848 +#: ../../reference/datamodel.rst:2041 msgid "The return value must be a string object." msgstr "" -#: ../../reference/datamodel.rst:1850 +#: ../../reference/datamodel.rst:2043 msgid "" "The __format__ method of ``object`` itself raises a :exc:`TypeError` if " "passed any non-empty string." msgstr "" -#: ../../reference/datamodel.rst:1854 +#: ../../reference/datamodel.rst:2047 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " "``format(str(x), '')``." msgstr "" -#: ../../reference/datamodel.rst:1870 +#: ../../reference/datamodel.rst:2063 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " "between operator symbols and method names is as follows: ``x.__hash__``." msgstr "" -#: ../../reference/datamodel.rst:1962 +#: ../../reference/datamodel.rst:2155 msgid "" "If a class that does not override :meth:`__eq__` wishes to suppress hash " "support, it should include ``__hash__ = None`` in the class definition. A " @@ -2255,7 +2489,7 @@ msgid "" "``isinstance(obj, collections.abc.Hashable)`` call." msgstr "" -#: ../../reference/datamodel.rst:1971 +#: ../../reference/datamodel.rst:2164 msgid "" "By default, the :meth:`__hash__` values of str and bytes objects are " "\"salted\" with an unpredictable random value. Although they remain " @@ -2263,7 +2497,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: ../../reference/datamodel.rst:1976 +#: ../../reference/datamodel.rst:2169 msgid "" "This is intended to provide protection against a denial-of-service caused by " "carefully chosen inputs that exploit the worst case performance of a dict " @@ -2271,22 +2505,22 @@ msgid "" "advisories/ocert-2011-003.html for details." msgstr "" -#: ../../reference/datamodel.rst:1981 +#: ../../reference/datamodel.rst:2174 msgid "" "Changing hash values affects the iteration order of sets. Python has never " "made guarantees about this ordering (and it typically varies between 32-bit " "and 64-bit builds)." msgstr "" -#: ../../reference/datamodel.rst:1985 +#: ../../reference/datamodel.rst:2178 msgid "See also :envvar:`PYTHONHASHSEED`." msgstr "另請參閱 :envvar:`PYTHONHASHSEED`。" -#: ../../reference/datamodel.rst:1987 +#: ../../reference/datamodel.rst:2180 msgid "Hash randomization is enabled by default." msgstr "" -#: ../../reference/datamodel.rst:1995 +#: ../../reference/datamodel.rst:2188 msgid "" "Called to implement truth value testing and the built-in operation " "``bool()``; should return ``False`` or ``True``. When this method is not " @@ -2295,18 +2529,18 @@ msgid "" "meth:`!__len__` nor :meth:`!__bool__`, all its instances are considered true." msgstr "" -#: ../../reference/datamodel.rst:2006 +#: ../../reference/datamodel.rst:2199 msgid "Customizing attribute access" msgstr "" -#: ../../reference/datamodel.rst:2008 +#: ../../reference/datamodel.rst:2201 msgid "" "The following methods can be defined to customize the meaning of attribute " "access (use of, assignment to, or deletion of ``x.name``) for class " "instances." msgstr "" -#: ../../reference/datamodel.rst:2016 +#: ../../reference/datamodel.rst:2209 msgid "" "Called when the default attribute access fails with an :exc:`AttributeError` " "(either :meth:`__getattribute__` raises an :exc:`AttributeError` because " @@ -2316,7 +2550,7 @@ msgid "" "attribute value or raise an :exc:`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:2023 +#: ../../reference/datamodel.rst:2216 msgid "" "Note that if the attribute is found through the normal mechanism, :meth:" "`__getattr__` is not called. (This is an intentional asymmetry between :" @@ -2329,7 +2563,7 @@ msgid "" "actually get total control over attribute access." msgstr "" -#: ../../reference/datamodel.rst:2036 +#: ../../reference/datamodel.rst:2229 msgid "" "Called unconditionally to implement attribute accesses for instances of the " "class. If the class also defines :meth:`__getattr__`, the latter will not be " @@ -2341,64 +2575,64 @@ msgid "" "example, ``object.__getattribute__(self, name)``." msgstr "" -#: ../../reference/datamodel.rst:2047 +#: ../../reference/datamodel.rst:2240 msgid "" "This method may still be bypassed when looking up special methods as the " "result of implicit invocation via language syntax or :ref:`built-in " "functions `. See :ref:`special-lookup`." msgstr "" -#: ../../reference/datamodel.rst:2052 ../../reference/datamodel.rst:2054 +#: ../../reference/datamodel.rst:2245 ../../reference/datamodel.rst:2247 msgid "" "For certain sensitive attribute accesses, raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:2061 +#: ../../reference/datamodel.rst:2254 msgid "" "Called when an attribute assignment is attempted. This is called instead of " "the normal mechanism (i.e. store the value in the instance dictionary). " "*name* is the attribute name, *value* is the value to be assigned to it." msgstr "" -#: ../../reference/datamodel.rst:2065 +#: ../../reference/datamodel.rst:2258 msgid "" "If :meth:`__setattr__` wants to assign to an instance attribute, it should " "call the base class method with the same name, for example, ``object." "__setattr__(self, name, value)``." msgstr "" -#: ../../reference/datamodel.rst:2069 ../../reference/datamodel.rst:2071 +#: ../../reference/datamodel.rst:2262 ../../reference/datamodel.rst:2264 msgid "" "For certain sensitive attribute assignments, raises an :ref:`auditing event " "` ``object.__setattr__`` with arguments ``obj``, ``name``, " "``value``." msgstr "" -#: ../../reference/datamodel.rst:2078 +#: ../../reference/datamodel.rst:2271 msgid "" "Like :meth:`__setattr__` but for attribute deletion instead of assignment. " "This should only be implemented if ``del obj.name`` is meaningful for the " "object." msgstr "" -#: ../../reference/datamodel.rst:2081 ../../reference/datamodel.rst:2083 +#: ../../reference/datamodel.rst:2274 ../../reference/datamodel.rst:2276 msgid "" "For certain sensitive attribute deletions, raises an :ref:`auditing event " "` ``object.__delattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:2090 +#: ../../reference/datamodel.rst:2283 msgid "" "Called when :func:`dir` is called on the object. An iterable must be " "returned. :func:`dir` converts the returned iterable to a list and sorts it." msgstr "" -#: ../../reference/datamodel.rst:2095 +#: ../../reference/datamodel.rst:2288 msgid "Customizing module attribute access" msgstr "" -#: ../../reference/datamodel.rst:2102 +#: ../../reference/datamodel.rst:2295 msgid "" "Special names ``__getattr__`` and ``__dir__`` can be also used to customize " "access to module attributes. The ``__getattr__`` function at the module " @@ -2410,21 +2644,21 @@ msgid "" "with the attribute name and the result is returned." msgstr "" -#: ../../reference/datamodel.rst:2111 +#: ../../reference/datamodel.rst:2304 msgid "" "The ``__dir__`` function should accept no arguments, and return an iterable " "of strings that represents the names accessible on module. If present, this " "function overrides the standard :func:`dir` search on a module." msgstr "" -#: ../../reference/datamodel.rst:2115 +#: ../../reference/datamodel.rst:2308 msgid "" "For a more fine grained customization of the module behavior (setting " "attributes, properties, etc.), one can set the ``__class__`` attribute of a " "module object to a subclass of :class:`types.ModuleType`. For example::" msgstr "" -#: ../../reference/datamodel.rst:2119 +#: ../../reference/datamodel.rst:2312 msgid "" "import sys\n" "from types import ModuleType\n" @@ -2452,7 +2686,7 @@ msgstr "" "\n" "sys.modules[__name__].__class__ = VerboseModule" -#: ../../reference/datamodel.rst:2133 +#: ../../reference/datamodel.rst:2326 msgid "" "Defining module ``__getattr__`` and setting module ``__class__`` only affect " "lookups made using the attribute access syntax -- directly accessing the " @@ -2460,27 +2694,27 @@ msgid "" "module's globals dictionary) is unaffected." msgstr "" -#: ../../reference/datamodel.rst:2138 +#: ../../reference/datamodel.rst:2331 msgid "``__class__`` module attribute is now writable." msgstr "" -#: ../../reference/datamodel.rst:2141 +#: ../../reference/datamodel.rst:2334 msgid "``__getattr__`` and ``__dir__`` module attributes." msgstr "" -#: ../../reference/datamodel.rst:2146 +#: ../../reference/datamodel.rst:2339 msgid ":pep:`562` - Module __getattr__ and __dir__" msgstr ":pep:`562` - 模組 __getattr__ 和 __dir__" -#: ../../reference/datamodel.rst:2147 +#: ../../reference/datamodel.rst:2340 msgid "Describes the ``__getattr__`` and ``__dir__`` functions on modules." msgstr "" -#: ../../reference/datamodel.rst:2153 +#: ../../reference/datamodel.rst:2346 msgid "Implementing Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2155 +#: ../../reference/datamodel.rst:2348 msgid "" "The following methods only apply when an instance of the class containing " "the method (a so-called *descriptor* class) appears in an *owner* class (the " @@ -2490,7 +2724,7 @@ msgid "" "the owner class' :attr:`~object.__dict__`." msgstr "" -#: ../../reference/datamodel.rst:2165 +#: ../../reference/datamodel.rst:2358 msgid "" "Called to get the attribute of the owner class (class attribute access) or " "of an instance of that class (instance attribute access). The optional " @@ -2499,13 +2733,13 @@ msgid "" "accessed through the *owner*." msgstr "" -#: ../../reference/datamodel.rst:2171 +#: ../../reference/datamodel.rst:2364 msgid "" "This method should return the computed attribute value or raise an :exc:" "`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:2174 +#: ../../reference/datamodel.rst:2367 msgid "" ":PEP:`252` specifies that :meth:`__get__` is callable with one or two " "arguments. Python's own built-in descriptors support this specification; " @@ -2515,31 +2749,31 @@ msgid "" "not." msgstr "" -#: ../../reference/datamodel.rst:2183 +#: ../../reference/datamodel.rst:2376 msgid "" "Called to set the attribute on an instance *instance* of the owner class to " "a new value, *value*." msgstr "" -#: ../../reference/datamodel.rst:2186 +#: ../../reference/datamodel.rst:2379 msgid "" "Note, adding :meth:`__set__` or :meth:`__delete__` changes the kind of " "descriptor to a \"data descriptor\". See :ref:`descriptor-invocation` for " "more details." msgstr "" -#: ../../reference/datamodel.rst:2192 +#: ../../reference/datamodel.rst:2385 msgid "" "Called to delete the attribute on an instance *instance* of the owner class." msgstr "" -#: ../../reference/datamodel.rst:2194 +#: ../../reference/datamodel.rst:2387 msgid "" "Instances of descriptors may also have the :attr:`!__objclass__` attribute " "present:" msgstr "" -#: ../../reference/datamodel.rst:2199 +#: ../../reference/datamodel.rst:2392 msgid "" "The attribute :attr:`!__objclass__` is interpreted by the :mod:`inspect` " "module as specifying the class where this object was defined (setting this " @@ -2550,11 +2784,11 @@ msgid "" "are implemented in C)." msgstr "" -#: ../../reference/datamodel.rst:2210 +#: ../../reference/datamodel.rst:2403 msgid "Invoking Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2212 +#: ../../reference/datamodel.rst:2405 msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " @@ -2563,7 +2797,7 @@ msgid "" "is said to be a descriptor." msgstr "" -#: ../../reference/datamodel.rst:2218 +#: ../../reference/datamodel.rst:2411 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " @@ -2571,7 +2805,7 @@ msgid "" "continuing through the base classes of ``type(a)`` excluding metaclasses." msgstr "" -#: ../../reference/datamodel.rst:2223 +#: ../../reference/datamodel.rst:2416 msgid "" "However, if the looked-up value is an object defining one of the descriptor " "methods, then Python may override the default behavior and invoke the " @@ -2579,54 +2813,54 @@ msgid "" "depends on which descriptor methods were defined and how they were called." msgstr "" -#: ../../reference/datamodel.rst:2228 +#: ../../reference/datamodel.rst:2421 msgid "" "The starting point for descriptor invocation is a binding, ``a.x``. How the " "arguments are assembled depends on ``a``:" msgstr "" -#: ../../reference/datamodel.rst:2231 +#: ../../reference/datamodel.rst:2424 msgid "Direct Call" msgstr "" -#: ../../reference/datamodel.rst:2232 +#: ../../reference/datamodel.rst:2425 msgid "" "The simplest and least common call is when user code directly invokes a " "descriptor method: ``x.__get__(a)``." msgstr "" -#: ../../reference/datamodel.rst:2235 +#: ../../reference/datamodel.rst:2428 msgid "Instance Binding" msgstr "" -#: ../../reference/datamodel.rst:2236 +#: ../../reference/datamodel.rst:2429 msgid "" "If binding to an object instance, ``a.x`` is transformed into the call: " "``type(a).__dict__['x'].__get__(a, type(a))``." msgstr "" -#: ../../reference/datamodel.rst:2239 +#: ../../reference/datamodel.rst:2432 msgid "Class Binding" msgstr "" -#: ../../reference/datamodel.rst:2240 +#: ../../reference/datamodel.rst:2433 msgid "" "If binding to a class, ``A.x`` is transformed into the call: ``A." "__dict__['x'].__get__(None, A)``." msgstr "" -#: ../../reference/datamodel.rst:2243 +#: ../../reference/datamodel.rst:2436 msgid "Super Binding" msgstr "" -#: ../../reference/datamodel.rst:2244 +#: ../../reference/datamodel.rst:2437 msgid "" "A dotted lookup such as ``super(A, a).x`` searches ``a.__class__.__mro__`` " "for a base class ``B`` following ``A`` and then returns ``B.__dict__['x']." "__get__(a, A)``. If not a descriptor, ``x`` is returned unchanged." msgstr "" -#: ../../reference/datamodel.rst:2281 +#: ../../reference/datamodel.rst:2474 msgid "" "For instance bindings, the precedence of descriptor invocation depends on " "which descriptor methods are defined. A descriptor can define any " @@ -2644,7 +2878,7 @@ msgid "" "instances." msgstr "" -#: ../../reference/datamodel.rst:2296 +#: ../../reference/datamodel.rst:2489 msgid "" "Python methods (including those decorated with :func:`@staticmethod " "` and :func:`@classmethod `) are implemented as " @@ -2653,30 +2887,30 @@ msgid "" "from other instances of the same class." msgstr "" -#: ../../reference/datamodel.rst:2302 +#: ../../reference/datamodel.rst:2495 msgid "" "The :func:`property` function is implemented as a data descriptor. " "Accordingly, instances cannot override the behavior of a property." msgstr "" -#: ../../reference/datamodel.rst:2309 +#: ../../reference/datamodel.rst:2502 msgid "__slots__" msgstr "__slots__" -#: ../../reference/datamodel.rst:2311 +#: ../../reference/datamodel.rst:2504 msgid "" "*__slots__* allow us to explicitly declare data members (like properties) " "and deny the creation of :attr:`~object.__dict__` and *__weakref__* (unless " "explicitly declared in *__slots__* or available in a parent.)" msgstr "" -#: ../../reference/datamodel.rst:2315 +#: ../../reference/datamodel.rst:2508 msgid "" "The space saved over using :attr:`~object.__dict__` can be significant. " "Attribute lookup speed can be significantly improved as well." msgstr "" -#: ../../reference/datamodel.rst:2320 +#: ../../reference/datamodel.rst:2513 msgid "" "This class variable can be assigned a string, iterable, or sequence of " "strings with variable names used by instances. *__slots__* reserves space " @@ -2684,18 +2918,18 @@ msgid "" "`~object.__dict__` and *__weakref__* for each instance." msgstr "" -#: ../../reference/datamodel.rst:2329 +#: ../../reference/datamodel.rst:2522 msgid "Notes on using *__slots__*:" msgstr "" -#: ../../reference/datamodel.rst:2331 +#: ../../reference/datamodel.rst:2524 msgid "" "When inheriting from a class without *__slots__*, the :attr:`~object." "__dict__` and *__weakref__* attribute of the instances will always be " "accessible." msgstr "" -#: ../../reference/datamodel.rst:2335 +#: ../../reference/datamodel.rst:2528 msgid "" "Without a :attr:`~object.__dict__` variable, instances cannot be assigned " "new variables not listed in the *__slots__* definition. Attempts to assign " @@ -2704,7 +2938,7 @@ msgid "" "sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2342 +#: ../../reference/datamodel.rst:2535 msgid "" "Without a *__weakref__* variable for each instance, classes defining " "*__slots__* do not support :mod:`weak references ` to its " @@ -2712,7 +2946,7 @@ msgid "" "to the sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2348 +#: ../../reference/datamodel.rst:2541 msgid "" "*__slots__* are implemented at the class level by creating :ref:`descriptors " "` for each variable name. As a result, class attributes cannot " @@ -2720,7 +2954,7 @@ msgid "" "otherwise, the class attribute would overwrite the descriptor assignment." msgstr "" -#: ../../reference/datamodel.rst:2354 +#: ../../reference/datamodel.rst:2547 msgid "" "The action of a *__slots__* declaration is not limited to the class where it " "is defined. *__slots__* declared in parents are available in child classes. " @@ -2729,7 +2963,7 @@ msgid "" "only contain names of any *additional* slots)." msgstr "" -#: ../../reference/datamodel.rst:2360 +#: ../../reference/datamodel.rst:2553 msgid "" "If a class defines a slot also defined in a base class, the instance " "variable defined by the base class slot is inaccessible (except by " @@ -2738,7 +2972,7 @@ msgid "" "prevent this." msgstr "" -#: ../../reference/datamodel.rst:2365 +#: ../../reference/datamodel.rst:2558 msgid "" ":exc:`TypeError` will be raised if nonempty *__slots__* are defined for a " "class derived from a :c:member:`\"variable-length\" built-in type " @@ -2746,11 +2980,11 @@ msgid "" "`tuple`." msgstr "" -#: ../../reference/datamodel.rst:2370 +#: ../../reference/datamodel.rst:2563 msgid "Any non-string :term:`iterable` may be assigned to *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2372 +#: ../../reference/datamodel.rst:2565 msgid "" "If a :class:`dictionary ` is used to assign *__slots__*, the " "dictionary keys will be used as the slot names. The values of the dictionary " @@ -2758,13 +2992,13 @@ msgid "" "func:`inspect.getdoc` and displayed in the output of :func:`help`." msgstr "" -#: ../../reference/datamodel.rst:2377 +#: ../../reference/datamodel.rst:2570 msgid "" ":attr:`~object.__class__` assignment works only if both classes have the " "same *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2380 +#: ../../reference/datamodel.rst:2573 msgid "" ":ref:`Multiple inheritance ` with multiple slotted parent " "classes can be used, but only one parent is allowed to have attributes " @@ -2772,18 +3006,18 @@ msgid "" "raise :exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:2386 +#: ../../reference/datamodel.rst:2579 msgid "" "If an :term:`iterator` is used for *__slots__* then a :term:`descriptor` is " "created for each of the iterator's values. However, the *__slots__* " "attribute will be an empty iterator." msgstr "" -#: ../../reference/datamodel.rst:2394 +#: ../../reference/datamodel.rst:2587 msgid "Customizing class creation" msgstr "" -#: ../../reference/datamodel.rst:2396 +#: ../../reference/datamodel.rst:2589 msgid "" "Whenever a class inherits from another class, :meth:`~object." "__init_subclass__` is called on the parent class. This way, it is possible " @@ -2793,14 +3027,14 @@ msgid "" "future subclasses of the class defining the method." msgstr "" -#: ../../reference/datamodel.rst:2405 +#: ../../reference/datamodel.rst:2598 msgid "" "This method is called whenever the containing class is subclassed. *cls* is " "then the new subclass. If defined as a normal instance method, this method " "is implicitly converted to a class method." msgstr "" -#: ../../reference/datamodel.rst:2409 +#: ../../reference/datamodel.rst:2602 msgid "" "Keyword arguments which are given to a new class are passed to the parent " "class's ``__init_subclass__``. For compatibility with other classes using " @@ -2808,7 +3042,7 @@ msgid "" "pass the others over to the base class, as in::" msgstr "" -#: ../../reference/datamodel.rst:2415 +#: ../../reference/datamodel.rst:2608 msgid "" "class Philosopher:\n" " def __init_subclass__(cls, /, default_name, **kwargs):\n" @@ -2826,13 +3060,13 @@ msgstr "" "class AustralianPhilosopher(Philosopher, default_name=\"Bruce\"):\n" " pass" -#: ../../reference/datamodel.rst:2423 +#: ../../reference/datamodel.rst:2616 msgid "" "The default implementation ``object.__init_subclass__`` does nothing, but " "raises an error if it is called with any arguments." msgstr "" -#: ../../reference/datamodel.rst:2428 +#: ../../reference/datamodel.rst:2621 msgid "" "The metaclass hint ``metaclass`` is consumed by the rest of the type " "machinery, and is never passed to ``__init_subclass__`` implementations. The " @@ -2840,19 +3074,19 @@ msgid "" "``type(cls)``." msgstr "" -#: ../../reference/datamodel.rst:2436 +#: ../../reference/datamodel.rst:2629 msgid "" "When a class is created, :meth:`type.__new__` scans the class variables and " "makes callbacks to those with a :meth:`~object.__set_name__` hook." msgstr "" -#: ../../reference/datamodel.rst:2441 +#: ../../reference/datamodel.rst:2634 msgid "" "Automatically called at the time the owning class *owner* is created. The " "object has been assigned to *name* in that class::" msgstr "" -#: ../../reference/datamodel.rst:2444 +#: ../../reference/datamodel.rst:2637 msgid "" "class A:\n" " x = C() # Automatically calls: x.__set_name__(A, 'x')" @@ -2860,14 +3094,14 @@ msgstr "" "class A:\n" " x = C() # 自動呼叫:x.__set_name__(A, 'x')" -#: ../../reference/datamodel.rst:2447 +#: ../../reference/datamodel.rst:2640 msgid "" "If the class variable is assigned after the class is created, :meth:" "`__set_name__` will not be called automatically. If needed, :meth:" "`__set_name__` can be called directly::" msgstr "" -#: ../../reference/datamodel.rst:2451 +#: ../../reference/datamodel.rst:2644 msgid "" "class A:\n" " pass\n" @@ -2877,22 +3111,22 @@ msgid "" "c.__set_name__(A, 'x') # Manually invoke the hook" msgstr "" -#: ../../reference/datamodel.rst:2458 +#: ../../reference/datamodel.rst:2651 msgid "See :ref:`class-object-creation` for more details." msgstr "更多細節請見 :ref:`class-object-creation`。" -#: ../../reference/datamodel.rst:2466 +#: ../../reference/datamodel.rst:2659 msgid "Metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2473 +#: ../../reference/datamodel.rst:2666 msgid "" "By default, classes are constructed using :func:`type`. The class body is " "executed in a new namespace and the class name is bound locally to the " "result of ``type(name, bases, namespace)``." msgstr "" -#: ../../reference/datamodel.rst:2477 +#: ../../reference/datamodel.rst:2670 msgid "" "The class creation process can be customized by passing the ``metaclass`` " "keyword argument in the class definition line, or by inheriting from an " @@ -2900,7 +3134,7 @@ msgid "" "both ``MyClass`` and ``MySubclass`` are instances of ``Meta``::" msgstr "" -#: ../../reference/datamodel.rst:2482 +#: ../../reference/datamodel.rst:2675 msgid "" "class Meta(type):\n" " pass\n" @@ -2920,41 +3154,41 @@ msgstr "" "class MySubclass(MyClass):\n" " pass" -#: ../../reference/datamodel.rst:2491 +#: ../../reference/datamodel.rst:2684 msgid "" "Any other keyword arguments that are specified in the class definition are " "passed through to all metaclass operations described below." msgstr "" -#: ../../reference/datamodel.rst:2494 +#: ../../reference/datamodel.rst:2687 msgid "When a class definition is executed, the following steps occur:" msgstr "" -#: ../../reference/datamodel.rst:2496 +#: ../../reference/datamodel.rst:2689 msgid "MRO entries are resolved;" msgstr "" -#: ../../reference/datamodel.rst:2497 +#: ../../reference/datamodel.rst:2690 msgid "the appropriate metaclass is determined;" msgstr "" -#: ../../reference/datamodel.rst:2498 +#: ../../reference/datamodel.rst:2691 msgid "the class namespace is prepared;" msgstr "" -#: ../../reference/datamodel.rst:2499 +#: ../../reference/datamodel.rst:2692 msgid "the class body is executed;" msgstr "" -#: ../../reference/datamodel.rst:2500 +#: ../../reference/datamodel.rst:2693 msgid "the class object is created." msgstr "" -#: ../../reference/datamodel.rst:2504 +#: ../../reference/datamodel.rst:2697 msgid "Resolving MRO entries" msgstr "" -#: ../../reference/datamodel.rst:2508 +#: ../../reference/datamodel.rst:2701 msgid "" "If a base that appears in a class definition is not an instance of :class:" "`type`, then an :meth:`!__mro_entries__` method is searched on the base. If " @@ -2966,59 +3200,59 @@ msgid "" "is ignored." msgstr "" -#: ../../reference/datamodel.rst:2519 +#: ../../reference/datamodel.rst:2712 msgid ":func:`types.resolve_bases`" msgstr ":func:`types.resolve_bases`" -#: ../../reference/datamodel.rst:2520 +#: ../../reference/datamodel.rst:2713 msgid "Dynamically resolve bases that are not instances of :class:`type`." msgstr "" -#: ../../reference/datamodel.rst:2522 +#: ../../reference/datamodel.rst:2715 msgid ":func:`types.get_original_bases`" msgstr ":func:`types.get_original_bases`" -#: ../../reference/datamodel.rst:2523 +#: ../../reference/datamodel.rst:2716 msgid "" "Retrieve a class's \"original bases\" prior to modifications by :meth:" "`~object.__mro_entries__`." msgstr "" -#: ../../reference/datamodel.rst:2526 +#: ../../reference/datamodel.rst:2719 msgid ":pep:`560`" msgstr ":pep:`560`" -#: ../../reference/datamodel.rst:2527 +#: ../../reference/datamodel.rst:2720 msgid "Core support for typing module and generic types." msgstr "" -#: ../../reference/datamodel.rst:2531 +#: ../../reference/datamodel.rst:2724 msgid "Determining the appropriate metaclass" msgstr "" -#: ../../reference/datamodel.rst:2535 +#: ../../reference/datamodel.rst:2728 msgid "" "The appropriate metaclass for a class definition is determined as follows:" msgstr "" -#: ../../reference/datamodel.rst:2537 +#: ../../reference/datamodel.rst:2730 msgid "" "if no bases and no explicit metaclass are given, then :func:`type` is used;" msgstr "" -#: ../../reference/datamodel.rst:2538 +#: ../../reference/datamodel.rst:2731 msgid "" "if an explicit metaclass is given and it is *not* an instance of :func:" "`type`, then it is used directly as the metaclass;" msgstr "" -#: ../../reference/datamodel.rst:2540 +#: ../../reference/datamodel.rst:2733 msgid "" "if an instance of :func:`type` is given as the explicit metaclass, or bases " "are defined, then the most derived metaclass is used." msgstr "" -#: ../../reference/datamodel.rst:2543 +#: ../../reference/datamodel.rst:2736 msgid "" "The most derived metaclass is selected from the explicitly specified " "metaclass (if any) and the metaclasses (i.e. ``type(cls)``) of all specified " @@ -3027,11 +3261,11 @@ msgid "" "that criterion, then the class definition will fail with ``TypeError``." msgstr "" -#: ../../reference/datamodel.rst:2553 +#: ../../reference/datamodel.rst:2746 msgid "Preparing the class namespace" msgstr "" -#: ../../reference/datamodel.rst:2558 +#: ../../reference/datamodel.rst:2751 msgid "" "Once the appropriate metaclass has been identified, then the class namespace " "is prepared. If the metaclass has a ``__prepare__`` attribute, it is called " @@ -3043,25 +3277,25 @@ msgid "" "copied into a new ``dict``." msgstr "" -#: ../../reference/datamodel.rst:2567 +#: ../../reference/datamodel.rst:2760 msgid "" "If the metaclass has no ``__prepare__`` attribute, then the class namespace " "is initialised as an empty ordered mapping." msgstr "" -#: ../../reference/datamodel.rst:2572 +#: ../../reference/datamodel.rst:2765 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/datamodel.rst:2573 +#: ../../reference/datamodel.rst:2766 msgid "Introduced the ``__prepare__`` namespace hook" msgstr "" -#: ../../reference/datamodel.rst:2577 +#: ../../reference/datamodel.rst:2770 msgid "Executing the class body" msgstr "" -#: ../../reference/datamodel.rst:2582 +#: ../../reference/datamodel.rst:2775 msgid "" "The class body is executed (approximately) as ``exec(body, globals(), " "namespace)``. The key difference from a normal call to :func:`exec` is that " @@ -3070,7 +3304,7 @@ msgid "" "inside a function." msgstr "" -#: ../../reference/datamodel.rst:2588 +#: ../../reference/datamodel.rst:2781 msgid "" "However, even when the class definition occurs inside the function, methods " "defined inside the class still cannot see names defined at the class scope. " @@ -3079,11 +3313,11 @@ msgid "" "reference described in the next section." msgstr "" -#: ../../reference/datamodel.rst:2597 +#: ../../reference/datamodel.rst:2790 msgid "Creating the class object" msgstr "" -#: ../../reference/datamodel.rst:2604 +#: ../../reference/datamodel.rst:2797 msgid "" "Once the class namespace has been populated by executing the class body, the " "class object is created by calling ``metaclass(name, bases, namespace, " @@ -3091,7 +3325,7 @@ msgid "" "to ``__prepare__``)." msgstr "" -#: ../../reference/datamodel.rst:2609 +#: ../../reference/datamodel.rst:2802 msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " @@ -3102,7 +3336,7 @@ msgid "" "is identified based on the first argument passed to the method." msgstr "" -#: ../../reference/datamodel.rst:2619 +#: ../../reference/datamodel.rst:2812 msgid "" "In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass " "as a ``__classcell__`` entry in the class namespace. If present, this must " @@ -3111,39 +3345,39 @@ msgid "" "in Python 3.8." msgstr "" -#: ../../reference/datamodel.rst:2625 +#: ../../reference/datamodel.rst:2818 msgid "" "When using the default metaclass :class:`type`, or any metaclass that " "ultimately calls ``type.__new__``, the following additional customization " "steps are invoked after creating the class object:" msgstr "" -#: ../../reference/datamodel.rst:2629 +#: ../../reference/datamodel.rst:2822 msgid "" "The ``type.__new__`` method collects all of the attributes in the class " "namespace that define a :meth:`~object.__set_name__` method;" msgstr "" -#: ../../reference/datamodel.rst:2631 +#: ../../reference/datamodel.rst:2824 msgid "" "Those ``__set_name__`` methods are called with the class being defined and " "the assigned name of that particular attribute;" msgstr "" -#: ../../reference/datamodel.rst:2633 +#: ../../reference/datamodel.rst:2826 msgid "" "The :meth:`~object.__init_subclass__` hook is called on the immediate parent " "of the new class in its method resolution order." msgstr "" -#: ../../reference/datamodel.rst:2636 +#: ../../reference/datamodel.rst:2829 msgid "" "After the class object is created, it is passed to the class decorators " "included in the class definition (if any) and the resulting object is bound " "in the local namespace as the defined class." msgstr "" -#: ../../reference/datamodel.rst:2640 +#: ../../reference/datamodel.rst:2833 msgid "" "When a new class is created by ``type.__new__``, the object provided as the " "namespace parameter is copied to a new ordered mapping and the original " @@ -3151,19 +3385,19 @@ msgid "" "becomes the :attr:`~type.__dict__` attribute of the class object." msgstr "" -#: ../../reference/datamodel.rst:2647 +#: ../../reference/datamodel.rst:2840 msgid ":pep:`3135` - New super" msgstr "" -#: ../../reference/datamodel.rst:2648 +#: ../../reference/datamodel.rst:2841 msgid "Describes the implicit ``__class__`` closure reference" msgstr "" -#: ../../reference/datamodel.rst:2652 +#: ../../reference/datamodel.rst:2845 msgid "Uses for metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2654 +#: ../../reference/datamodel.rst:2847 msgid "" "The potential uses for metaclasses are boundless. Some ideas that have been " "explored include enum, logging, interface checking, automatic delegation, " @@ -3171,17 +3405,17 @@ msgid "" "locking/synchronization." msgstr "" -#: ../../reference/datamodel.rst:2661 +#: ../../reference/datamodel.rst:2854 msgid "Customizing instance and subclass checks" msgstr "" -#: ../../reference/datamodel.rst:2663 +#: ../../reference/datamodel.rst:2856 msgid "" "The following methods are used to override the default behavior of the :func:" "`isinstance` and :func:`issubclass` built-in functions." msgstr "" -#: ../../reference/datamodel.rst:2666 +#: ../../reference/datamodel.rst:2859 msgid "" "In particular, the metaclass :class:`abc.ABCMeta` implements these methods " "in order to allow the addition of Abstract Base Classes (ABCs) as \"virtual " @@ -3189,21 +3423,21 @@ msgid "" "other ABCs." msgstr "" -#: ../../reference/datamodel.rst:2673 +#: ../../reference/datamodel.rst:2866 msgid "" "Return true if *instance* should be considered a (direct or indirect) " "instance of *class*. If defined, called to implement ``isinstance(instance, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2680 +#: ../../reference/datamodel.rst:2873 msgid "" "Return true if *subclass* should be considered a (direct or indirect) " "subclass of *class*. If defined, called to implement ``issubclass(subclass, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2685 +#: ../../reference/datamodel.rst:2878 msgid "" "Note that these methods are looked up on the type (metaclass) of a class. " "They cannot be defined as class methods in the actual class. This is " @@ -3211,11 +3445,11 @@ msgid "" "only in this case the instance is itself a class." msgstr "" -#: ../../reference/datamodel.rst:2692 +#: ../../reference/datamodel.rst:2885 msgid ":pep:`3119` - Introducing Abstract Base Classes" msgstr "" -#: ../../reference/datamodel.rst:2693 +#: ../../reference/datamodel.rst:2886 msgid "" "Includes the specification for customizing :func:`isinstance` and :func:" "`issubclass` behavior through :meth:`~type.__instancecheck__` and :meth:" @@ -3224,11 +3458,11 @@ msgid "" "language." msgstr "" -#: ../../reference/datamodel.rst:2701 +#: ../../reference/datamodel.rst:2894 msgid "Emulating generic types" msgstr "" -#: ../../reference/datamodel.rst:2703 +#: ../../reference/datamodel.rst:2896 msgid "" "When using :term:`type annotations`, it is often useful to " "*parameterize* a :term:`generic type` using Python's square-brackets " @@ -3236,65 +3470,65 @@ msgid "" "a :class:`list` in which all the elements are of type :class:`int`." msgstr "" -#: ../../reference/datamodel.rst:2710 +#: ../../reference/datamodel.rst:2903 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/datamodel.rst:2711 +#: ../../reference/datamodel.rst:2904 msgid "Introducing Python's framework for type annotations" msgstr "" -#: ../../reference/datamodel.rst:2713 +#: ../../reference/datamodel.rst:2906 msgid ":ref:`Generic Alias Types`" msgstr ":ref:`泛型別名型別 `" -#: ../../reference/datamodel.rst:2714 +#: ../../reference/datamodel.rst:2907 msgid "Documentation for objects representing parameterized generic classes" msgstr "" -#: ../../reference/datamodel.rst:2716 +#: ../../reference/datamodel.rst:2909 msgid "" ":ref:`Generics`, :ref:`user-defined generics` and :" "class:`typing.Generic`" msgstr "" -#: ../../reference/datamodel.rst:2717 +#: ../../reference/datamodel.rst:2910 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" -#: ../../reference/datamodel.rst:2720 +#: ../../reference/datamodel.rst:2913 msgid "" "A class can *generally* only be parameterized if it defines the special " "class method ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2725 +#: ../../reference/datamodel.rst:2918 msgid "" "Return an object representing the specialization of a generic class by type " "arguments found in *key*." msgstr "" -#: ../../reference/datamodel.rst:2728 +#: ../../reference/datamodel.rst:2921 msgid "" "When defined on a class, ``__class_getitem__()`` is automatically a class " "method. As such, there is no need for it to be decorated with :func:" "`@classmethod` when it is defined." msgstr "" -#: ../../reference/datamodel.rst:2734 +#: ../../reference/datamodel.rst:2927 msgid "The purpose of *__class_getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2736 +#: ../../reference/datamodel.rst:2929 msgid "" "The purpose of :meth:`~object.__class_getitem__` is to allow runtime " "parameterization of standard-library generic classes in order to more easily " "apply :term:`type hints` to these classes." msgstr "" -#: ../../reference/datamodel.rst:2740 +#: ../../reference/datamodel.rst:2933 msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " @@ -3303,7 +3537,7 @@ msgid "" "own implementation of ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2746 +#: ../../reference/datamodel.rst:2939 msgid "" "Custom implementations of :meth:`~object.__class_getitem__` on classes " "defined outside of the standard library may not be understood by third-party " @@ -3311,11 +3545,11 @@ msgid "" "purposes other than type hinting is discouraged." msgstr "" -#: ../../reference/datamodel.rst:2756 +#: ../../reference/datamodel.rst:2949 msgid "*__class_getitem__* versus *__getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2758 +#: ../../reference/datamodel.rst:2951 msgid "" "Usually, the :ref:`subscription` of an object using square " "brackets will call the :meth:`~object.__getitem__` instance method defined " @@ -3325,14 +3559,14 @@ msgid "" "genericalias>` object if it is properly defined." msgstr "" -#: ../../reference/datamodel.rst:2765 +#: ../../reference/datamodel.rst:2958 msgid "" "Presented with the :term:`expression` ``obj[x]``, the Python interpreter " "follows something like the following process to decide whether :meth:" "`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" msgstr "" -#: ../../reference/datamodel.rst:2770 +#: ../../reference/datamodel.rst:2963 msgid "" "from inspect import isclass\n" "\n" @@ -3358,7 +3592,7 @@ msgid "" " )" msgstr "" -#: ../../reference/datamodel.rst:2793 +#: ../../reference/datamodel.rst:2986 msgid "" "In Python, all classes are themselves instances of other classes. The class " "of a class is known as that class's :term:`metaclass`, and most classes have " @@ -3368,7 +3602,7 @@ msgid "" "__class_getitem__` being called::" msgstr "" -#: ../../reference/datamodel.rst:2800 +#: ../../reference/datamodel.rst:2993 msgid "" ">>> # list has class \"type\" as its metaclass, like most classes:\n" ">>> type(list)\n" @@ -3383,14 +3617,14 @@ msgid "" "" msgstr "" -#: ../../reference/datamodel.rst:2812 +#: ../../reference/datamodel.rst:3005 msgid "" "However, if a class has a custom metaclass that defines :meth:`~object." "__getitem__`, subscribing the class may result in different behaviour. An " "example of this can be found in the :mod:`enum` module::" msgstr "" -#: ../../reference/datamodel.rst:2816 +#: ../../reference/datamodel.rst:3009 msgid "" ">>> from enum import Enum\n" ">>> class Menu(Enum):\n" @@ -3410,33 +3644,33 @@ msgid "" "" msgstr "" -#: ../../reference/datamodel.rst:2835 +#: ../../reference/datamodel.rst:3028 msgid ":pep:`560` - Core Support for typing module and generic types" msgstr "" -#: ../../reference/datamodel.rst:2836 +#: ../../reference/datamodel.rst:3029 msgid "" "Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" "`subscription` results in ``__class_getitem__()`` being " "called instead of :meth:`~object.__getitem__`" msgstr "" -#: ../../reference/datamodel.rst:2844 +#: ../../reference/datamodel.rst:3037 msgid "Emulating callable objects" msgstr "" -#: ../../reference/datamodel.rst:2851 +#: ../../reference/datamodel.rst:3044 msgid "" "Called when the instance is \"called\" as a function; if this method is " "defined, ``x(arg1, arg2, ...)`` roughly translates to ``type(x).__call__(x, " "arg1, ...)``." msgstr "" -#: ../../reference/datamodel.rst:2858 +#: ../../reference/datamodel.rst:3051 msgid "Emulating container types" msgstr "" -#: ../../reference/datamodel.rst:2860 +#: ../../reference/datamodel.rst:3053 msgid "" "The following methods can be defined to implement container objects. " "Containers usually are :term:`sequences ` (such as :class:`lists " @@ -3472,7 +3706,7 @@ msgid "" "should iterate through the values." msgstr "" -#: ../../reference/datamodel.rst:2901 +#: ../../reference/datamodel.rst:3094 msgid "" "Called to implement the built-in function :func:`len`. Should return the " "length of the object, an integer ``>=`` 0. Also, an object that doesn't " @@ -3480,7 +3714,7 @@ msgid "" "returns zero is considered to be false in a Boolean context." msgstr "" -#: ../../reference/datamodel.rst:2908 +#: ../../reference/datamodel.rst:3101 msgid "" "In CPython, the length is required to be at most :data:`sys.maxsize`. If the " "length is larger than :data:`!sys.maxsize` some features (such as :func:" @@ -3489,7 +3723,7 @@ msgid "" "`~object.__bool__` method." msgstr "" -#: ../../reference/datamodel.rst:2917 +#: ../../reference/datamodel.rst:3110 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " @@ -3499,28 +3733,28 @@ msgid "" "never required for correctness." msgstr "" -#: ../../reference/datamodel.rst:2931 +#: ../../reference/datamodel.rst:3124 msgid "" "Slicing is done exclusively with the following three methods. A call like ::" msgstr "" -#: ../../reference/datamodel.rst:2933 +#: ../../reference/datamodel.rst:3126 msgid "a[1:2] = b" msgstr "a[1:2] = b" -#: ../../reference/datamodel.rst:2935 +#: ../../reference/datamodel.rst:3128 msgid "is translated to ::" msgstr "" -#: ../../reference/datamodel.rst:2937 +#: ../../reference/datamodel.rst:3130 msgid "a[slice(1, 2, None)] = b" msgstr "a[slice(1, 2, None)] = b" -#: ../../reference/datamodel.rst:2939 +#: ../../reference/datamodel.rst:3132 msgid "and so forth. Missing slice items are always filled in with ``None``." msgstr "" -#: ../../reference/datamodel.rst:2944 +#: ../../reference/datamodel.rst:3137 msgid "" "Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " "the accepted keys should be integers. Optionally, they may support :class:" @@ -3532,20 +3766,20 @@ msgid "" "`KeyError` should be raised." msgstr "" -#: ../../reference/datamodel.rst:2956 +#: ../../reference/datamodel.rst:3149 msgid "" ":keyword:`for` loops expect that an :exc:`IndexError` will be raised for " "illegal indexes to allow proper detection of the end of the sequence." msgstr "" -#: ../../reference/datamodel.rst:2961 +#: ../../reference/datamodel.rst:3154 msgid "" "When :ref:`subscripting` a *class*, the special class method :" "meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " "See :ref:`classgetitem-versus-getitem` for more details." msgstr "" -#: ../../reference/datamodel.rst:2969 +#: ../../reference/datamodel.rst:3162 msgid "" "Called to implement assignment to ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3554,7 +3788,7 @@ msgid "" "for improper *key* values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2978 +#: ../../reference/datamodel.rst:3171 msgid "" "Called to implement deletion of ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3563,13 +3797,13 @@ msgid "" "values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2987 +#: ../../reference/datamodel.rst:3180 msgid "" "Called by :class:`dict`\\ .\\ :meth:`__getitem__` to implement ``self[key]`` " "for dict subclasses when key is not in the dictionary." msgstr "" -#: ../../reference/datamodel.rst:2993 +#: ../../reference/datamodel.rst:3186 msgid "" "This method is called when an :term:`iterator` is required for a container. " "This method should return a new iterator object that can iterate over all " @@ -3577,14 +3811,14 @@ msgid "" "of the container." msgstr "" -#: ../../reference/datamodel.rst:3001 +#: ../../reference/datamodel.rst:3194 msgid "" "Called (if present) by the :func:`reversed` built-in to implement reverse " "iteration. It should return a new iterator object that iterates over all " "the objects in the container in reverse order." msgstr "" -#: ../../reference/datamodel.rst:3005 +#: ../../reference/datamodel.rst:3198 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " "built-in will fall back to using the sequence protocol (:meth:`__len__` and :" @@ -3593,7 +3827,7 @@ msgid "" "more efficient than the one provided by :func:`reversed`." msgstr "" -#: ../../reference/datamodel.rst:3012 +#: ../../reference/datamodel.rst:3205 msgid "" "The membership test operators (:keyword:`in` and :keyword:`not in`) are " "normally implemented as an iteration through a container. However, container " @@ -3601,14 +3835,14 @@ msgid "" "implementation, which also does not require the object be iterable." msgstr "" -#: ../../reference/datamodel.rst:3019 +#: ../../reference/datamodel.rst:3212 msgid "" "Called to implement membership test operators. Should return true if *item* " "is in *self*, false otherwise. For mapping objects, this should consider " "the keys of the mapping rather than the values or the key-item pairs." msgstr "" -#: ../../reference/datamodel.rst:3023 +#: ../../reference/datamodel.rst:3216 msgid "" "For objects that don't define :meth:`__contains__`, the membership test " "first tries iteration via :meth:`__iter__`, then the old sequence iteration " @@ -3616,11 +3850,11 @@ msgid "" "reference `." msgstr "" -#: ../../reference/datamodel.rst:3032 +#: ../../reference/datamodel.rst:3225 msgid "Emulating numeric types" msgstr "" -#: ../../reference/datamodel.rst:3034 +#: ../../reference/datamodel.rst:3227 msgid "" "The following methods can be defined to emulate numeric objects. Methods " "corresponding to operations that are not supported by the particular kind of " @@ -3628,7 +3862,7 @@ msgid "" "should be left undefined." msgstr "" -#: ../../reference/datamodel.rst:3060 +#: ../../reference/datamodel.rst:3253 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3642,13 +3876,13 @@ msgid "" "function is to be supported." msgstr "" -#: ../../reference/datamodel.rst:3071 +#: ../../reference/datamodel.rst:3264 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return :data:`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3094 +#: ../../reference/datamodel.rst:3287 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3661,13 +3895,13 @@ msgid "" "`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3106 +#: ../../reference/datamodel.rst:3299 msgid "" "Note that ternary :func:`pow` will not try calling :meth:`__rpow__` (the " "coercion rules would become too complicated)." msgstr "" -#: ../../reference/datamodel.rst:3111 +#: ../../reference/datamodel.rst:3304 msgid "" "If the right operand's type is a subclass of the left operand's type and " "that subclass provides a different implementation of the reflected method " @@ -3676,7 +3910,7 @@ msgid "" "ancestors' operations." msgstr "" -#: ../../reference/datamodel.rst:3132 +#: ../../reference/datamodel.rst:3325 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -3694,19 +3928,19 @@ msgid "" "data model." msgstr "" -#: ../../reference/datamodel.rst:3155 +#: ../../reference/datamodel.rst:3348 msgid "" "Called to implement the unary arithmetic operations (``-``, ``+``, :func:" "`abs` and ``~``)." msgstr "" -#: ../../reference/datamodel.rst:3168 +#: ../../reference/datamodel.rst:3361 msgid "" "Called to implement the built-in functions :func:`complex`, :func:`int` and :" "func:`float`. Should return a value of the appropriate type." msgstr "" -#: ../../reference/datamodel.rst:3175 +#: ../../reference/datamodel.rst:3368 msgid "" "Called to implement :func:`operator.index`, and whenever Python needs to " "losslessly convert the numeric object to an integer object (such as in " @@ -3715,14 +3949,14 @@ msgid "" "integer type. Must return an integer." msgstr "" -#: ../../reference/datamodel.rst:3181 +#: ../../reference/datamodel.rst:3374 msgid "" "If :meth:`__int__`, :meth:`__float__` and :meth:`__complex__` are not " "defined then corresponding built-in functions :func:`int`, :func:`float` " "and :func:`complex` fall back to :meth:`__index__`." msgstr "" -#: ../../reference/datamodel.rst:3193 +#: ../../reference/datamodel.rst:3386 msgid "" "Called to implement the built-in function :func:`round` and :mod:`math` " "functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`. " @@ -3731,21 +3965,21 @@ msgid "" "(typically an :class:`int`)." msgstr "" -#: ../../reference/datamodel.rst:3199 +#: ../../reference/datamodel.rst:3392 msgid "" "The built-in function :func:`int` falls back to :meth:`__trunc__` if " "neither :meth:`__int__` nor :meth:`__index__` is defined." msgstr "" -#: ../../reference/datamodel.rst:3202 +#: ../../reference/datamodel.rst:3395 msgid "The delegation of :func:`int` to :meth:`__trunc__` is deprecated." msgstr "" -#: ../../reference/datamodel.rst:3209 +#: ../../reference/datamodel.rst:3402 msgid "With Statement Context Managers" msgstr "With 陳述式的情境管理器" -#: ../../reference/datamodel.rst:3211 +#: ../../reference/datamodel.rst:3404 msgid "" "A :dfn:`context manager` is an object that defines the runtime context to be " "established when executing a :keyword:`with` statement. The context manager " @@ -3755,32 +3989,32 @@ msgid "" "can also be used by directly invoking their methods." msgstr "" -#: ../../reference/datamodel.rst:3222 +#: ../../reference/datamodel.rst:3415 msgid "" "Typical uses of context managers include saving and restoring various kinds " "of global state, locking and unlocking resources, closing opened files, etc." msgstr "" -#: ../../reference/datamodel.rst:3225 +#: ../../reference/datamodel.rst:3418 msgid "" "For more information on context managers, see :ref:`typecontextmanager`." msgstr "" -#: ../../reference/datamodel.rst:3230 +#: ../../reference/datamodel.rst:3423 msgid "" "Enter the runtime context related to this object. The :keyword:`with` " "statement will bind this method's return value to the target(s) specified in " "the :keyword:`!as` clause of the statement, if any." msgstr "" -#: ../../reference/datamodel.rst:3237 +#: ../../reference/datamodel.rst:3430 msgid "" "Exit the runtime context related to this object. The parameters describe the " "exception that caused the context to be exited. If the context was exited " "without an exception, all three arguments will be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:3241 +#: ../../reference/datamodel.rst:3434 msgid "" "If an exception is supplied, and the method wishes to suppress the exception " "(i.e., prevent it from being propagated), it should return a true value. " @@ -3788,27 +4022,27 @@ msgid "" "method." msgstr "" -#: ../../reference/datamodel.rst:3245 +#: ../../reference/datamodel.rst:3438 msgid "" "Note that :meth:`~object.__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" -#: ../../reference/datamodel.rst:3251 +#: ../../reference/datamodel.rst:3444 msgid ":pep:`343` - The \"with\" statement" msgstr ":pep:`343` - \"with\" 陳述式" -#: ../../reference/datamodel.rst:3252 +#: ../../reference/datamodel.rst:3445 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3259 +#: ../../reference/datamodel.rst:3452 msgid "Customizing positional arguments in class pattern matching" msgstr "" -#: ../../reference/datamodel.rst:3261 +#: ../../reference/datamodel.rst:3454 msgid "" "When using a class name in a pattern, positional arguments in the pattern " "are not allowed by default, i.e. ``case MyClass(x, y)`` is typically invalid " @@ -3816,7 +4050,7 @@ msgid "" "pattern, the class needs to define a *__match_args__* attribute." msgstr "" -#: ../../reference/datamodel.rst:3268 +#: ../../reference/datamodel.rst:3461 msgid "" "This class variable can be assigned a tuple of strings. When this class is " "used in a class pattern with positional arguments, each positional argument " @@ -3825,7 +4059,7 @@ msgid "" "to setting it to ``()``." msgstr "" -#: ../../reference/datamodel.rst:3274 +#: ../../reference/datamodel.rst:3467 msgid "" "For example, if ``MyClass.__match_args__`` is ``(\"left\", \"center\", " "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " @@ -3835,19 +4069,19 @@ msgid "" "exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:3284 +#: ../../reference/datamodel.rst:3477 msgid ":pep:`634` - Structural Pattern Matching" msgstr "" -#: ../../reference/datamodel.rst:3285 +#: ../../reference/datamodel.rst:3478 msgid "The specification for the Python ``match`` statement." msgstr "" -#: ../../reference/datamodel.rst:3291 +#: ../../reference/datamodel.rst:3484 msgid "Emulating buffer types" msgstr "" -#: ../../reference/datamodel.rst:3293 +#: ../../reference/datamodel.rst:3486 msgid "" "The :ref:`buffer protocol ` provides a way for Python objects " "to expose efficient access to a low-level memory array. This protocol is " @@ -3855,13 +4089,13 @@ msgid "" "and third-party libraries may define additional buffer types." msgstr "" -#: ../../reference/datamodel.rst:3298 +#: ../../reference/datamodel.rst:3491 msgid "" "While buffer types are usually implemented in C, it is also possible to " "implement the protocol in Python." msgstr "" -#: ../../reference/datamodel.rst:3303 +#: ../../reference/datamodel.rst:3496 msgid "" "Called when a buffer is requested from *self* (for example, by the :class:" "`memoryview` constructor). The *flags* argument is an integer representing " @@ -3871,7 +4105,7 @@ msgid "" "`memoryview` object." msgstr "" -#: ../../reference/datamodel.rst:3312 +#: ../../reference/datamodel.rst:3505 msgid "" "Called when a buffer is no longer needed. The *buffer* argument is a :class:" "`memoryview` object that was previously returned by :meth:`~object." @@ -3880,28 +4114,28 @@ msgid "" "to perform any cleanup are not required to implement this method." msgstr "" -#: ../../reference/datamodel.rst:3323 +#: ../../reference/datamodel.rst:3516 msgid ":pep:`688` - Making the buffer protocol accessible in Python" msgstr "" -#: ../../reference/datamodel.rst:3324 +#: ../../reference/datamodel.rst:3517 msgid "" "Introduces the Python ``__buffer__`` and ``__release_buffer__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3326 +#: ../../reference/datamodel.rst:3519 msgid ":class:`collections.abc.Buffer`" msgstr ":class:`collections.abc.Buffer`" -#: ../../reference/datamodel.rst:3327 +#: ../../reference/datamodel.rst:3520 msgid "ABC for buffer types." msgstr "" -#: ../../reference/datamodel.rst:3332 +#: ../../reference/datamodel.rst:3525 msgid "Special method lookup" msgstr "" -#: ../../reference/datamodel.rst:3334 +#: ../../reference/datamodel.rst:3527 msgid "" "For custom classes, implicit invocations of special methods are only " "guaranteed to work correctly if defined on an object's type, not in the " @@ -3909,7 +4143,7 @@ msgid "" "following code raises an exception::" msgstr "" -#: ../../reference/datamodel.rst:3339 +#: ../../reference/datamodel.rst:3532 msgid "" ">>> class C:\n" "... pass\n" @@ -3931,7 +4165,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: object of type 'C' has no len()" -#: ../../reference/datamodel.rst:3349 +#: ../../reference/datamodel.rst:3542 msgid "" "The rationale behind this behaviour lies with a number of special methods " "such as :meth:`~object.__hash__` and :meth:`~object.__repr__` that are " @@ -3940,7 +4174,7 @@ msgid "" "invoked on the type object itself::" msgstr "" -#: ../../reference/datamodel.rst:3356 +#: ../../reference/datamodel.rst:3549 msgid "" ">>> 1 .__hash__() == hash(1)\n" "True\n" @@ -3956,14 +4190,14 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: descriptor '__hash__' of 'int' object needs an argument" -#: ../../reference/datamodel.rst:3363 +#: ../../reference/datamodel.rst:3556 msgid "" "Incorrectly attempting to invoke an unbound method of a class in this way is " "sometimes referred to as 'metaclass confusion', and is avoided by bypassing " "the instance when looking up special methods::" msgstr "" -#: ../../reference/datamodel.rst:3367 +#: ../../reference/datamodel.rst:3560 msgid "" ">>> type(1).__hash__(1) == hash(1)\n" "True\n" @@ -3975,14 +4209,14 @@ msgstr "" ">>> type(int).__hash__(int) == hash(int)\n" "True" -#: ../../reference/datamodel.rst:3372 +#: ../../reference/datamodel.rst:3565 msgid "" "In addition to bypassing any instance attributes in the interest of " "correctness, implicit special method lookup generally also bypasses the :" "meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" -#: ../../reference/datamodel.rst:3376 +#: ../../reference/datamodel.rst:3569 msgid "" ">>> class Meta(type):\n" "... def __getattribute__(*args):\n" @@ -4007,7 +4241,7 @@ msgid "" "10" msgstr "" -#: ../../reference/datamodel.rst:3398 +#: ../../reference/datamodel.rst:3591 msgid "" "Bypassing the :meth:`~object.__getattribute__` machinery in this fashion " "provides significant scope for speed optimisations within the interpreter, " @@ -4016,36 +4250,36 @@ msgid "" "consistently invoked by the interpreter)." msgstr "" -#: ../../reference/datamodel.rst:3409 +#: ../../reference/datamodel.rst:3602 msgid "Coroutines" msgstr "協程" -#: ../../reference/datamodel.rst:3413 +#: ../../reference/datamodel.rst:3606 msgid "Awaitable Objects" msgstr "" -#: ../../reference/datamodel.rst:3415 +#: ../../reference/datamodel.rst:3608 msgid "" "An :term:`awaitable` object generally implements an :meth:`~object." "__await__` method. :term:`Coroutine objects ` returned from :" "keyword:`async def` functions are awaitable." msgstr "" -#: ../../reference/datamodel.rst:3421 +#: ../../reference/datamodel.rst:3614 msgid "" "The :term:`generator iterator` objects returned from generators decorated " "with :func:`types.coroutine` are also awaitable, but they do not implement :" "meth:`~object.__await__`." msgstr "" -#: ../../reference/datamodel.rst:3427 +#: ../../reference/datamodel.rst:3620 msgid "" "Must return an :term:`iterator`. Should be used to implement :term:" "`awaitable` objects. For instance, :class:`asyncio.Future` implements this " "method to be compatible with the :keyword:`await` expression." msgstr "" -#: ../../reference/datamodel.rst:3433 +#: ../../reference/datamodel.rst:3626 msgid "" "The language doesn't place any restriction on the type or value of the " "objects yielded by the iterator returned by ``__await__``, as this is " @@ -4053,15 +4287,15 @@ msgid "" "g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." msgstr "" -#: ../../reference/datamodel.rst:3441 +#: ../../reference/datamodel.rst:3634 msgid ":pep:`492` for additional information about awaitable objects." msgstr "" -#: ../../reference/datamodel.rst:3447 +#: ../../reference/datamodel.rst:3640 msgid "Coroutine Objects" msgstr "" -#: ../../reference/datamodel.rst:3449 +#: ../../reference/datamodel.rst:3642 msgid "" ":term:`Coroutine objects ` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`~object.__await__` " @@ -4072,18 +4306,18 @@ msgid "" "should not directly raise unhandled :exc:`StopIteration` exceptions." msgstr "" -#: ../../reference/datamodel.rst:3457 +#: ../../reference/datamodel.rst:3650 msgid "" "Coroutines also have the methods listed below, which are analogous to those " "of generators (see :ref:`generator-methods`). However, unlike generators, " "coroutines do not directly support iteration." msgstr "" -#: ../../reference/datamodel.rst:3461 +#: ../../reference/datamodel.rst:3654 msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" -#: ../../reference/datamodel.rst:3467 +#: ../../reference/datamodel.rst:3660 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " "is equivalent to advancing the iterator returned by :meth:`~object." @@ -4094,7 +4328,7 @@ msgid "" "value, described above." msgstr "" -#: ../../reference/datamodel.rst:3478 +#: ../../reference/datamodel.rst:3671 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " @@ -4105,13 +4339,13 @@ msgid "" "not caught in the coroutine, it propagates back to the caller." msgstr "" -#: ../../reference/datamodel.rst:3489 +#: ../../reference/datamodel.rst:3682 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" -#: ../../reference/datamodel.rst:3494 +#: ../../reference/datamodel.rst:3687 msgid "" "Causes the coroutine to clean itself up and exit. If the coroutine is " "suspended, this method first delegates to the :meth:`~generator.close` " @@ -4121,42 +4355,42 @@ msgid "" "is marked as having finished executing, even if it was never started." msgstr "" -#: ../../reference/datamodel.rst:3502 +#: ../../reference/datamodel.rst:3695 msgid "" "Coroutine objects are automatically closed using the above process when they " "are about to be destroyed." msgstr "" -#: ../../reference/datamodel.rst:3508 +#: ../../reference/datamodel.rst:3701 msgid "Asynchronous Iterators" msgstr "" -#: ../../reference/datamodel.rst:3510 +#: ../../reference/datamodel.rst:3703 msgid "" "An *asynchronous iterator* can call asynchronous code in its ``__anext__`` " "method." msgstr "" -#: ../../reference/datamodel.rst:3513 +#: ../../reference/datamodel.rst:3706 msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "" -#: ../../reference/datamodel.rst:3517 +#: ../../reference/datamodel.rst:3710 msgid "Must return an *asynchronous iterator* object." msgstr "" -#: ../../reference/datamodel.rst:3521 +#: ../../reference/datamodel.rst:3714 msgid "" "Must return an *awaitable* resulting in a next value of the iterator. " "Should raise a :exc:`StopAsyncIteration` error when the iteration is over." msgstr "" -#: ../../reference/datamodel.rst:3524 +#: ../../reference/datamodel.rst:3717 msgid "An example of an asynchronous iterable object::" msgstr "" -#: ../../reference/datamodel.rst:3526 +#: ../../reference/datamodel.rst:3719 msgid "" "class Reader:\n" " async def readline(self):\n" @@ -4184,53 +4418,53 @@ msgstr "" " raise StopAsyncIteration\n" " return val" -#: ../../reference/datamodel.rst:3541 +#: ../../reference/datamodel.rst:3734 msgid "" "Prior to Python 3.7, :meth:`~object.__aiter__` could return an *awaitable* " "that would resolve to an :term:`asynchronous iterator `." msgstr "" -#: ../../reference/datamodel.rst:3546 +#: ../../reference/datamodel.rst:3739 msgid "" "Starting with Python 3.7, :meth:`~object.__aiter__` must return an " "asynchronous iterator object. Returning anything else will result in a :exc:" "`TypeError` error." msgstr "" -#: ../../reference/datamodel.rst:3554 +#: ../../reference/datamodel.rst:3747 msgid "Asynchronous Context Managers" msgstr "" -#: ../../reference/datamodel.rst:3556 +#: ../../reference/datamodel.rst:3749 msgid "" "An *asynchronous context manager* is a *context manager* that is able to " "suspend execution in its ``__aenter__`` and ``__aexit__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3559 +#: ../../reference/datamodel.rst:3752 msgid "" "Asynchronous context managers can be used in an :keyword:`async with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3563 +#: ../../reference/datamodel.rst:3756 msgid "" "Semantically similar to :meth:`~object.__enter__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3568 +#: ../../reference/datamodel.rst:3761 msgid "" "Semantically similar to :meth:`~object.__exit__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3571 +#: ../../reference/datamodel.rst:3764 msgid "An example of an asynchronous context manager class::" msgstr "" -#: ../../reference/datamodel.rst:3573 +#: ../../reference/datamodel.rst:3766 msgid "" "class AsyncContextManager:\n" " async def __aenter__(self):\n" @@ -4246,18 +4480,18 @@ msgstr "" " async def __aexit__(self, exc_type, exc, tb):\n" " await log('exiting context')" -#: ../../reference/datamodel.rst:3584 +#: ../../reference/datamodel.rst:3777 msgid "Footnotes" msgstr "註解" -#: ../../reference/datamodel.rst:3585 +#: ../../reference/datamodel.rst:3778 msgid "" "It *is* possible in some cases to change an object's type, under certain " "controlled conditions. It generally isn't a good idea though, since it can " "lead to some very strange behaviour if it is handled incorrectly." msgstr "" -#: ../../reference/datamodel.rst:3589 +#: ../../reference/datamodel.rst:3782 msgid "" "The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." "__reversed__`, :meth:`~object.__contains__`, :meth:`~object." @@ -4266,7 +4500,7 @@ msgid "" "by relying on the behavior that ``None`` is not callable." msgstr "" -#: ../../reference/datamodel.rst:3596 +#: ../../reference/datamodel.rst:3789 msgid "" "\"Does not support\" here means that the class has no such method, or the " "method returns :data:`NotImplemented`. Do not set the method to ``None`` if " @@ -4274,7 +4508,7 @@ msgid "" "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" -#: ../../reference/datamodel.rst:3602 +#: ../../reference/datamodel.rst:3795 msgid "" "For operands of the same type, it is assumed that if the non-reflected " "method -- such as :meth:`~object.__add__` -- fails then the overall " @@ -4291,13 +4525,13 @@ msgstr "" #: ../../reference/datamodel.rst:427 ../../reference/datamodel.rst:447 #: ../../reference/datamodel.rst:455 ../../reference/datamodel.rst:466 #: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:519 -#: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:660 -#: ../../reference/datamodel.rst:798 ../../reference/datamodel.rst:822 -#: ../../reference/datamodel.rst:856 ../../reference/datamodel.rst:937 -#: ../../reference/datamodel.rst:1076 ../../reference/datamodel.rst:1103 -#: ../../reference/datamodel.rst:1175 ../../reference/datamodel.rst:1279 -#: ../../reference/datamodel.rst:1388 ../../reference/datamodel.rst:1498 -#: ../../reference/datamodel.rst:1912 ../../reference/datamodel.rst:2927 +#: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:661 +#: ../../reference/datamodel.rst:799 ../../reference/datamodel.rst:823 +#: ../../reference/datamodel.rst:859 ../../reference/datamodel.rst:1126 +#: ../../reference/datamodel.rst:1265 ../../reference/datamodel.rst:1292 +#: ../../reference/datamodel.rst:1364 ../../reference/datamodel.rst:1472 +#: ../../reference/datamodel.rst:1581 ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:2105 ../../reference/datamodel.rst:3120 msgid "object" msgstr "object(物件)" @@ -4307,14 +4541,14 @@ msgstr "data(資料)" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:296 #: ../../reference/datamodel.rst:343 ../../reference/datamodel.rst:427 -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:798 -#: ../../reference/datamodel.rst:1132 ../../reference/datamodel.rst:1581 -#: ../../reference/datamodel.rst:1823 ../../reference/datamodel.rst:1828 -#: ../../reference/datamodel.rst:1912 ../../reference/datamodel.rst:2468 -#: ../../reference/datamodel.rst:2897 ../../reference/datamodel.rst:3055 -#: ../../reference/datamodel.rst:3090 ../../reference/datamodel.rst:3104 -#: ../../reference/datamodel.rst:3153 ../../reference/datamodel.rst:3163 -#: ../../reference/datamodel.rst:3191 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:799 +#: ../../reference/datamodel.rst:1321 ../../reference/datamodel.rst:1774 +#: ../../reference/datamodel.rst:2016 ../../reference/datamodel.rst:2021 +#: ../../reference/datamodel.rst:2105 ../../reference/datamodel.rst:2661 +#: ../../reference/datamodel.rst:3090 ../../reference/datamodel.rst:3248 +#: ../../reference/datamodel.rst:3283 ../../reference/datamodel.rst:3297 +#: ../../reference/datamodel.rst:3346 ../../reference/datamodel.rst:3356 +#: ../../reference/datamodel.rst:3384 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -4323,7 +4557,7 @@ msgid "id" msgstr "id" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:126 -#: ../../reference/datamodel.rst:2468 +#: ../../reference/datamodel.rst:2661 msgid "type" msgstr "type(型別)" @@ -4359,7 +4593,7 @@ msgstr "reference counting(參照計數)" msgid "unreachable object" msgstr "unreachable object(不可達物件)" -#: ../../reference/datamodel.rst:95 ../../reference/datamodel.rst:937 +#: ../../reference/datamodel.rst:95 ../../reference/datamodel.rst:1126 msgid "container" msgstr "container(容器)" @@ -4373,24 +4607,24 @@ msgstr "extension(擴充)" #: ../../reference/datamodel.rst:126 ../../reference/datamodel.rst:400 #: ../../reference/datamodel.rst:401 ../../reference/datamodel.rst:502 -#: ../../reference/datamodel.rst:856 ../../reference/datamodel.rst:876 -#: ../../reference/datamodel.rst:1132 +#: ../../reference/datamodel.rst:859 ../../reference/datamodel.rst:879 +#: ../../reference/datamodel.rst:1321 msgid "module" msgstr "module(模組)" #: ../../reference/datamodel.rst:126 ../../reference/datamodel.rst:265 -#: ../../reference/datamodel.rst:798 +#: ../../reference/datamodel.rst:799 msgid "C" msgstr "C" #: ../../reference/datamodel.rst:126 ../../reference/datamodel.rst:265 -#: ../../reference/datamodel.rst:798 +#: ../../reference/datamodel.rst:799 msgid "language" msgstr "language(語言)" -#: ../../reference/datamodel.rst:139 ../../reference/datamodel.rst:937 -#: ../../reference/datamodel.rst:955 ../../reference/datamodel.rst:1076 -#: ../../reference/datamodel.rst:1096 +#: ../../reference/datamodel.rst:139 ../../reference/datamodel.rst:1126 +#: ../../reference/datamodel.rst:1144 ../../reference/datamodel.rst:1265 +#: ../../reference/datamodel.rst:1285 msgid "attribute" msgstr "attribute(屬性)" @@ -4410,7 +4644,7 @@ msgstr "..." msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" -#: ../../reference/datamodel.rst:196 ../../reference/datamodel.rst:1103 +#: ../../reference/datamodel.rst:196 ../../reference/datamodel.rst:1292 msgid "numeric" msgstr "numeric(數值)" @@ -4447,16 +4681,16 @@ msgstr "number(數字)" msgid "Java" msgstr "Java" -#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3163 +#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3356 msgid "complex" msgstr "complex(複數)" #: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:427 -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:2897 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:3090 msgid "len" msgstr "len" -#: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:1103 +#: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:1292 msgid "sequence" msgstr "sequence(序列)" @@ -4485,8 +4719,8 @@ msgstr "immutable sequence(不可變序列)" msgid "immutable" msgstr "immutable(不可變)" -#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1798 -#: ../../reference/datamodel.rst:1828 +#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1991 +#: ../../reference/datamodel.rst:2021 msgid "string" msgstr "string(字串)" @@ -4522,7 +4756,7 @@ msgstr "singleton(單例)" msgid "empty" msgstr "empty(空的)" -#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:1823 +#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:2016 msgid "bytes" msgstr "bytes(位元組)" @@ -4538,14 +4772,14 @@ msgstr "mutable sequence(可變序列)" msgid "mutable" msgstr "mutable(可變的)" -#: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:955 -#: ../../reference/datamodel.rst:1096 +#: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:1144 +#: ../../reference/datamodel.rst:1285 msgid "assignment" msgstr "assignment(賦值)" -#: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:856 -#: ../../reference/datamodel.rst:1535 ../../reference/datamodel.rst:1717 -#: ../../reference/datamodel.rst:3218 +#: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:859 +#: ../../reference/datamodel.rst:1728 ../../reference/datamodel.rst:1910 +#: ../../reference/datamodel.rst:3411 msgid "statement" msgstr "statement(陳述式)" @@ -4577,12 +4811,12 @@ msgstr "set(集合)" msgid "frozenset" msgstr "frozenset(凍結集合)" -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:1103 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:1292 msgid "mapping" msgstr "mapping(對映)" -#: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:937 -#: ../../reference/datamodel.rst:1912 +#: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:1126 +#: ../../reference/datamodel.rst:2105 msgid "dictionary" msgstr "dictionary(字典)" @@ -4599,13 +4833,13 @@ msgid "callable" msgstr "callable(可呼叫物件)" #: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:534 -#: ../../reference/datamodel.rst:742 ../../reference/datamodel.rst:760 -#: ../../reference/datamodel.rst:773 ../../reference/datamodel.rst:798 +#: ../../reference/datamodel.rst:743 ../../reference/datamodel.rst:761 +#: ../../reference/datamodel.rst:774 ../../reference/datamodel.rst:799 msgid "function" msgstr "function (函式)" -#: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:937 -#: ../../reference/datamodel.rst:960 ../../reference/datamodel.rst:2849 +#: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:1126 +#: ../../reference/datamodel.rst:1149 ../../reference/datamodel.rst:3042 msgid "call" msgstr "call(呼叫)" @@ -4617,7 +4851,7 @@ msgstr "invocation(調用)" msgid "argument" msgstr "argument(引數)" -#: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:660 +#: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:661 msgid "user-defined" msgstr "user-defined(使用者定義)" @@ -4637,611 +4871,643 @@ msgstr "__globals__ (函式屬性)" msgid "global" msgstr "global(全域)" -#: ../../reference/datamodel.rst:547 ../../reference/datamodel.rst:876 +#: ../../reference/datamodel.rst:547 ../../reference/datamodel.rst:879 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../reference/datamodel.rst:573 +#: ../../reference/datamodel.rst:574 msgid "__doc__ (function attribute)" msgstr "__doc__ (函式屬性)" -#: ../../reference/datamodel.rst:573 +#: ../../reference/datamodel.rst:574 msgid "__name__ (function attribute)" msgstr "__name__ (函式屬性)" -#: ../../reference/datamodel.rst:573 +#: ../../reference/datamodel.rst:574 msgid "__module__ (function attribute)" msgstr "__module__ (函式屬性)" -#: ../../reference/datamodel.rst:573 +#: ../../reference/datamodel.rst:574 msgid "__dict__ (function attribute)" msgstr "__dict__ (函式屬性)" -#: ../../reference/datamodel.rst:573 +#: ../../reference/datamodel.rst:574 msgid "__defaults__ (function attribute)" msgstr "__defaults__ (函式屬性)" -#: ../../reference/datamodel.rst:573 +#: ../../reference/datamodel.rst:574 msgid "__code__ (function attribute)" msgstr "__code__ (函式屬性)" -#: ../../reference/datamodel.rst:573 +#: ../../reference/datamodel.rst:574 msgid "__annotations__ (function attribute)" msgstr "__annotations__ (函式屬性)" -#: ../../reference/datamodel.rst:573 +#: ../../reference/datamodel.rst:574 msgid "__kwdefaults__ (function attribute)" msgstr "__kwdefaults__ (函式屬性)" -#: ../../reference/datamodel.rst:573 +#: ../../reference/datamodel.rst:574 msgid "__type_params__ (function attribute)" msgstr "__type_params__ (函式屬性)" -#: ../../reference/datamodel.rst:660 ../../reference/datamodel.rst:822 +#: ../../reference/datamodel.rst:661 ../../reference/datamodel.rst:823 msgid "method" msgstr "method(方法)" -#: ../../reference/datamodel.rst:660 +#: ../../reference/datamodel.rst:661 msgid "user-defined method" msgstr "user-defined method(使用者定義方法)" -#: ../../reference/datamodel.rst:668 +#: ../../reference/datamodel.rst:669 msgid "__func__ (method attribute)" msgstr "__func__ (方法屬性)" -#: ../../reference/datamodel.rst:668 +#: ../../reference/datamodel.rst:669 msgid "__self__ (method attribute)" msgstr "__self__ (方法屬性)" -#: ../../reference/datamodel.rst:668 +#: ../../reference/datamodel.rst:669 msgid "__doc__ (method attribute)" msgstr "__doc__ (方法屬性)" -#: ../../reference/datamodel.rst:668 +#: ../../reference/datamodel.rst:669 msgid "__name__ (method attribute)" msgstr "__name__ (方法屬性)" -#: ../../reference/datamodel.rst:668 +#: ../../reference/datamodel.rst:669 msgid "__module__ (method attribute)" msgstr "__module__ (方法屬性)" -#: ../../reference/datamodel.rst:742 ../../reference/datamodel.rst:1279 +#: ../../reference/datamodel.rst:743 ../../reference/datamodel.rst:1472 msgid "generator" msgstr "generator(產生器)" -#: ../../reference/datamodel.rst:742 +#: ../../reference/datamodel.rst:743 msgid "iterator" msgstr "itorator(疊代器)" -#: ../../reference/datamodel.rst:760 ../../reference/datamodel.rst:3405 +#: ../../reference/datamodel.rst:761 ../../reference/datamodel.rst:3598 msgid "coroutine" msgstr "coroutine(協程)" -#: ../../reference/datamodel.rst:773 +#: ../../reference/datamodel.rst:774 msgid "asynchronous generator" msgstr "asynchronous generator(非同步產生器)" -#: ../../reference/datamodel.rst:773 +#: ../../reference/datamodel.rst:774 msgid "asynchronous iterator" msgstr "asynchronous iterator(非同步疊代器)" -#: ../../reference/datamodel.rst:822 +#: ../../reference/datamodel.rst:823 msgid "built-in method" msgstr "built-in method(內建方法)" -#: ../../reference/datamodel.rst:822 +#: ../../reference/datamodel.rst:823 msgid "built-in" msgstr "built-in(內建)" -#: ../../reference/datamodel.rst:856 +#: ../../reference/datamodel.rst:859 msgid "import" msgstr "import(引入)" -#: ../../reference/datamodel.rst:876 +#: ../../reference/datamodel.rst:879 msgid "__name__ (module attribute)" msgstr "__name__ (模組屬性)" -#: ../../reference/datamodel.rst:876 -msgid "__doc__ (module attribute)" -msgstr "__doc__ (模組屬性)" +#: ../../reference/datamodel.rst:879 +msgid "__spec__ (module attribute)" +msgstr "__spec__ (模組屬性)" -#: ../../reference/datamodel.rst:876 +#: ../../reference/datamodel.rst:879 +msgid "__package__ (module attribute)" +msgstr "__package__ (模組屬性)" + +#: ../../reference/datamodel.rst:879 +msgid "__loader__ (module attribute)" +msgstr "__loader__ (模組屬性)" + +#: ../../reference/datamodel.rst:879 +msgid "__path__ (module attribute)" +msgstr "__path__ (模組屬性)" + +#: ../../reference/datamodel.rst:879 msgid "__file__ (module attribute)" msgstr "__file__ (模組屬性)" -#: ../../reference/datamodel.rst:876 +#: ../../reference/datamodel.rst:879 +msgid "__cached__ (module attribute)" +msgstr "__cached__ (模組屬性)" + +#: ../../reference/datamodel.rst:879 +msgid "__doc__ (module attribute)" +msgstr "__doc__ (模組屬性)" + +#: ../../reference/datamodel.rst:879 msgid "__annotations__ (module attribute)" msgstr "__annotations__ (模組屬性)" -#: ../../reference/datamodel.rst:907 +#: ../../reference/datamodel.rst:1094 msgid "__dict__ (module attribute)" msgstr "__dict__ (模組屬性)" -#: ../../reference/datamodel.rst:937 ../../reference/datamodel.rst:955 -#: ../../reference/datamodel.rst:1076 ../../reference/datamodel.rst:1700 -#: ../../reference/datamodel.rst:2579 +#: ../../reference/datamodel.rst:1126 ../../reference/datamodel.rst:1144 +#: ../../reference/datamodel.rst:1265 ../../reference/datamodel.rst:1893 +#: ../../reference/datamodel.rst:2772 msgid "class" msgstr "class(類別)" -#: ../../reference/datamodel.rst:937 ../../reference/datamodel.rst:1076 -#: ../../reference/datamodel.rst:1096 +#: ../../reference/datamodel.rst:1126 ../../reference/datamodel.rst:1265 +#: ../../reference/datamodel.rst:1285 msgid "class instance" msgstr "class instance(類別實例)" -#: ../../reference/datamodel.rst:937 ../../reference/datamodel.rst:1076 -#: ../../reference/datamodel.rst:2849 +#: ../../reference/datamodel.rst:1126 ../../reference/datamodel.rst:1265 +#: ../../reference/datamodel.rst:3042 msgid "instance" msgstr "instance(實例)" -#: ../../reference/datamodel.rst:937 ../../reference/datamodel.rst:960 +#: ../../reference/datamodel.rst:1126 ../../reference/datamodel.rst:1149 msgid "class object" msgstr "class object(類別物件)" -#: ../../reference/datamodel.rst:967 +#: ../../reference/datamodel.rst:1156 msgid "__name__ (class attribute)" msgstr "__name__ (類別屬性)" -#: ../../reference/datamodel.rst:967 +#: ../../reference/datamodel.rst:1156 msgid "__module__ (class attribute)" msgstr "__module__ (類別屬性)" -#: ../../reference/datamodel.rst:967 +#: ../../reference/datamodel.rst:1156 msgid "__dict__ (class attribute)" msgstr "__dict__ (類別屬性)" -#: ../../reference/datamodel.rst:967 +#: ../../reference/datamodel.rst:1156 msgid "__bases__ (class attribute)" msgstr "__bases__ (類別屬性)" -#: ../../reference/datamodel.rst:967 +#: ../../reference/datamodel.rst:1156 msgid "__doc__ (class attribute)" msgstr "__doc__ (類別屬性)" -#: ../../reference/datamodel.rst:967 +#: ../../reference/datamodel.rst:1156 msgid "__annotations__ (class attribute)" msgstr "__annotations__ (類別屬性)" -#: ../../reference/datamodel.rst:967 +#: ../../reference/datamodel.rst:1156 msgid "__type_params__ (class attribute)" msgstr "__type_params__ (類別屬性)" -#: ../../reference/datamodel.rst:967 +#: ../../reference/datamodel.rst:1156 msgid "__static_attributes__ (class attribute)" msgstr "__static_attributes__ (類別屬性)" -#: ../../reference/datamodel.rst:967 +#: ../../reference/datamodel.rst:1156 msgid "__firstlineno__ (class attribute)" msgstr "__firstlineno__ (類別屬性)" -#: ../../reference/datamodel.rst:1114 +#: ../../reference/datamodel.rst:1303 msgid "__dict__ (instance attribute)" msgstr "__dict__ (實例屬性)" -#: ../../reference/datamodel.rst:1114 +#: ../../reference/datamodel.rst:1303 msgid "__class__ (instance attribute)" msgstr "__class__ (實例屬性)" -#: ../../reference/datamodel.rst:1132 +#: ../../reference/datamodel.rst:1321 msgid "open" msgstr "open" -#: ../../reference/datamodel.rst:1132 +#: ../../reference/datamodel.rst:1321 msgid "io" msgstr "io" -#: ../../reference/datamodel.rst:1132 +#: ../../reference/datamodel.rst:1321 msgid "popen() (in module os)" msgstr "popen() (於 os 模組中)" -#: ../../reference/datamodel.rst:1132 +#: ../../reference/datamodel.rst:1321 msgid "makefile() (socket method)" msgstr "makefile() (socket 方法)" -#: ../../reference/datamodel.rst:1132 +#: ../../reference/datamodel.rst:1321 msgid "sys.stdin" msgstr "sys.stdin" -#: ../../reference/datamodel.rst:1132 +#: ../../reference/datamodel.rst:1321 msgid "sys.stdout" msgstr "sys.stdout" -#: ../../reference/datamodel.rst:1132 +#: ../../reference/datamodel.rst:1321 msgid "sys.stderr" msgstr "sys.stderr" -#: ../../reference/datamodel.rst:1132 +#: ../../reference/datamodel.rst:1321 msgid "stdio" msgstr "stdio" -#: ../../reference/datamodel.rst:1132 +#: ../../reference/datamodel.rst:1321 msgid "stdin (in module sys)" msgstr "stdin (sys 模組中)" -#: ../../reference/datamodel.rst:1132 +#: ../../reference/datamodel.rst:1321 msgid "stdout (in module sys)" msgstr "stdout (sys 模組中)" -#: ../../reference/datamodel.rst:1132 +#: ../../reference/datamodel.rst:1321 msgid "stderr (in module sys)" msgstr "stderr (sys 模組中)" -#: ../../reference/datamodel.rst:1161 +#: ../../reference/datamodel.rst:1350 msgid "internal type" msgstr "internal type(內部型別)" -#: ../../reference/datamodel.rst:1161 +#: ../../reference/datamodel.rst:1350 msgid "types, internal" msgstr "types(型別), internal(內部)" -#: ../../reference/datamodel.rst:1175 +#: ../../reference/datamodel.rst:1364 msgid "bytecode" msgstr "bytecode(位元組碼)" -#: ../../reference/datamodel.rst:1175 +#: ../../reference/datamodel.rst:1364 msgid "code" msgstr "code(程式碼)" -#: ../../reference/datamodel.rst:1175 +#: ../../reference/datamodel.rst:1364 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_argcount (code object attribute)" msgstr "co_argcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_posonlyargcount (code object attribute)" msgstr "co_posonlyargcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_kwonlyargcount (code object attribute)" msgstr "co_kwonlyargcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_code (code object attribute)" msgstr "co_code (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_consts (code object attribute)" msgstr "co_consts (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_filename (code object attribute)" msgstr "co_filename (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_firstlineno (code object attribute)" msgstr "co_firstlineno (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_flags (code object attribute)" msgstr "co_flags (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_lnotab (code object attribute)" msgstr "co_lnotab (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_name (code object attribute)" msgstr "co_name (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_names (code object attribute)" msgstr "co_names (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_nlocals (code object attribute)" msgstr "co_nlocals (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_stacksize (code object attribute)" msgstr "co_stacksize (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_varnames (code object attribute)" msgstr "co_varnames (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_cellvars (code object attribute)" msgstr "co_cellvars (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_freevars (code object attribute)" msgstr "co_freevars (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1375 msgid "co_qualname (code object attribute)" msgstr "co_qualname (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1297 +#: ../../reference/datamodel.rst:1490 msgid "documentation string" msgstr "documentation string(文件字串)" -#: ../../reference/datamodel.rst:1388 +#: ../../reference/datamodel.rst:1581 msgid "frame" msgstr "frame" -#: ../../reference/datamodel.rst:1394 +#: ../../reference/datamodel.rst:1587 msgid "f_back (frame attribute)" msgstr "f_back (frame 屬性)" -#: ../../reference/datamodel.rst:1394 +#: ../../reference/datamodel.rst:1587 msgid "f_code (frame attribute)" msgstr "f_code (frame 屬性)" -#: ../../reference/datamodel.rst:1394 +#: ../../reference/datamodel.rst:1587 msgid "f_globals (frame attribute)" msgstr "f_globals (frame 屬性)" -#: ../../reference/datamodel.rst:1394 +#: ../../reference/datamodel.rst:1587 msgid "f_locals (frame attribute)" msgstr "f_locals (frame 屬性)" -#: ../../reference/datamodel.rst:1394 +#: ../../reference/datamodel.rst:1587 msgid "f_lasti (frame attribute)" msgstr "f_lasti (frame 屬性)" -#: ../../reference/datamodel.rst:1394 +#: ../../reference/datamodel.rst:1587 msgid "f_builtins (frame attribute)" msgstr "f_builtins (frame 屬性)" -#: ../../reference/datamodel.rst:1438 +#: ../../reference/datamodel.rst:1631 msgid "f_trace (frame attribute)" msgstr "f_trace (frame 屬性)" -#: ../../reference/datamodel.rst:1438 +#: ../../reference/datamodel.rst:1631 msgid "f_trace_lines (frame attribute)" msgstr "f_trace_lines (frame 屬性)" -#: ../../reference/datamodel.rst:1438 +#: ../../reference/datamodel.rst:1631 msgid "f_trace_opcodes (frame attribute)" msgstr "f_trace_opcodes (frame 屬性)" -#: ../../reference/datamodel.rst:1438 +#: ../../reference/datamodel.rst:1631 msgid "f_lineno (frame attribute)" msgstr "f_lineno (frame 屬性)" -#: ../../reference/datamodel.rst:1498 +#: ../../reference/datamodel.rst:1691 msgid "traceback" msgstr "traceback" -#: ../../reference/datamodel.rst:1498 +#: ../../reference/datamodel.rst:1691 msgid "stack" msgstr "stack(堆疊)" -#: ../../reference/datamodel.rst:1498 +#: ../../reference/datamodel.rst:1691 msgid "trace" msgstr "trace(追蹤)" -#: ../../reference/datamodel.rst:1498 +#: ../../reference/datamodel.rst:1691 msgid "exception" msgstr "exception(例外)" -#: ../../reference/datamodel.rst:1498 +#: ../../reference/datamodel.rst:1691 msgid "handler" msgstr "handler(處理器)" -#: ../../reference/datamodel.rst:1498 +#: ../../reference/datamodel.rst:1691 msgid "execution" msgstr "execution(執行)" -#: ../../reference/datamodel.rst:1498 +#: ../../reference/datamodel.rst:1691 msgid "exc_info (in module sys)" msgstr "exc_info (sys 模組中)" -#: ../../reference/datamodel.rst:1498 +#: ../../reference/datamodel.rst:1691 msgid "last_traceback (in module sys)" msgstr "last_traceback (sys 模組中)" -#: ../../reference/datamodel.rst:1498 +#: ../../reference/datamodel.rst:1691 msgid "sys.exc_info" msgstr "sys.exc_info" -#: ../../reference/datamodel.rst:1498 +#: ../../reference/datamodel.rst:1691 msgid "sys.exception" msgstr "sys.exception" -#: ../../reference/datamodel.rst:1498 +#: ../../reference/datamodel.rst:1691 msgid "sys.last_traceback" msgstr "sys.last_traceback" -#: ../../reference/datamodel.rst:1535 +#: ../../reference/datamodel.rst:1728 msgid "tb_frame (traceback attribute)" msgstr "tb_frame (traceback 屬性)" -#: ../../reference/datamodel.rst:1535 +#: ../../reference/datamodel.rst:1728 msgid "tb_lineno (traceback attribute)" msgstr "tb_lineno (traceback 屬性)" -#: ../../reference/datamodel.rst:1535 +#: ../../reference/datamodel.rst:1728 msgid "tb_lasti (traceback attribute)" msgstr "tb_lasti (traceback 屬性)" -#: ../../reference/datamodel.rst:1535 +#: ../../reference/datamodel.rst:1728 msgid "try" msgstr "try" -#: ../../reference/datamodel.rst:1565 +#: ../../reference/datamodel.rst:1758 msgid "tb_next (traceback attribute)" msgstr "tb_next (traceback 屬性)" -#: ../../reference/datamodel.rst:1581 ../../reference/datamodel.rst:2927 +#: ../../reference/datamodel.rst:1774 ../../reference/datamodel.rst:3120 msgid "slice" msgstr "slice(切片)" -#: ../../reference/datamodel.rst:1587 +#: ../../reference/datamodel.rst:1780 msgid "start (slice object attribute)" msgstr "start (slice 物件屬性)" -#: ../../reference/datamodel.rst:1587 +#: ../../reference/datamodel.rst:1780 msgid "stop (slice object attribute)" msgstr "stop (slice 物件屬性)" -#: ../../reference/datamodel.rst:1587 +#: ../../reference/datamodel.rst:1780 msgid "step (slice object attribute)" msgstr "step (slice 物件屬性)" -#: ../../reference/datamodel.rst:1635 +#: ../../reference/datamodel.rst:1828 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/datamodel.rst:1635 +#: ../../reference/datamodel.rst:1828 msgid "overloading" msgstr "overloading(多載)" -#: ../../reference/datamodel.rst:1635 +#: ../../reference/datamodel.rst:1828 msgid "__getitem__() (mapping object method)" msgstr "__getitem__() (對映物件方法)" -#: ../../reference/datamodel.rst:1671 +#: ../../reference/datamodel.rst:1864 msgid "subclassing" msgstr "subclassing(子類別化)" -#: ../../reference/datamodel.rst:1671 +#: ../../reference/datamodel.rst:1864 msgid "immutable types" msgstr "immutable types(不可變型別)" -#: ../../reference/datamodel.rst:1700 +#: ../../reference/datamodel.rst:1893 msgid "constructor" msgstr "constructor(建構函式)" -#: ../../reference/datamodel.rst:1717 +#: ../../reference/datamodel.rst:1910 msgid "destructor" msgstr "destructor(解構函式)" -#: ../../reference/datamodel.rst:1717 +#: ../../reference/datamodel.rst:1910 msgid "finalizer" msgstr "finalizer(終結函式)" -#: ../../reference/datamodel.rst:1717 +#: ../../reference/datamodel.rst:1910 msgid "del" msgstr "del" -#: ../../reference/datamodel.rst:1781 +#: ../../reference/datamodel.rst:1974 msgid "repr() (built-in function)" msgstr "repr() (內建函式)" -#: ../../reference/datamodel.rst:1781 +#: ../../reference/datamodel.rst:1974 msgid "__repr__() (object method)" msgstr "__repr__() (物件方法)" -#: ../../reference/datamodel.rst:1798 +#: ../../reference/datamodel.rst:1991 msgid "__str__() (object method)" msgstr "__str__() (物件方法)" -#: ../../reference/datamodel.rst:1798 +#: ../../reference/datamodel.rst:1991 msgid "format() (built-in function)" msgstr "format() (內建函式)" -#: ../../reference/datamodel.rst:1798 +#: ../../reference/datamodel.rst:1991 msgid "print() (built-in function)" msgstr "print() (內建函式)" -#: ../../reference/datamodel.rst:1828 +#: ../../reference/datamodel.rst:2021 msgid "__format__() (object method)" msgstr "__format__() (物件方法)" -#: ../../reference/datamodel.rst:1828 +#: ../../reference/datamodel.rst:2021 msgid "conversion" msgstr "conversion" -#: ../../reference/datamodel.rst:1828 +#: ../../reference/datamodel.rst:2021 msgid "print" msgstr "print" -#: ../../reference/datamodel.rst:1867 +#: ../../reference/datamodel.rst:2060 msgid "comparisons" msgstr "comparison(比較)" -#: ../../reference/datamodel.rst:1912 +#: ../../reference/datamodel.rst:2105 msgid "hash" msgstr "hash(雜湊)" -#: ../../reference/datamodel.rst:1993 +#: ../../reference/datamodel.rst:2186 msgid "__len__() (mapping object method)" msgstr "__len__() (對映物件方法)" -#: ../../reference/datamodel.rst:2097 +#: ../../reference/datamodel.rst:2290 msgid "__getattr__ (module attribute)" msgstr "__getattr__ (模組屬性)" -#: ../../reference/datamodel.rst:2097 +#: ../../reference/datamodel.rst:2290 msgid "__dir__ (module attribute)" msgstr "__dir__ (模組屬性)" -#: ../../reference/datamodel.rst:2097 +#: ../../reference/datamodel.rst:2290 msgid "__class__ (module attribute)" msgstr "__class__ (模組屬性)" -#: ../../reference/datamodel.rst:2468 +#: ../../reference/datamodel.rst:2661 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../reference/datamodel.rst:2468 +#: ../../reference/datamodel.rst:2661 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/datamodel.rst:2468 +#: ../../reference/datamodel.rst:2661 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/datamodel.rst:2532 +#: ../../reference/datamodel.rst:2725 msgid "metaclass hint" msgstr "metaclass hint(元類別提示)" -#: ../../reference/datamodel.rst:2555 +#: ../../reference/datamodel.rst:2748 msgid "__prepare__ (metaclass method)" msgstr "__prepare__ (元類別方法)" -#: ../../reference/datamodel.rst:2579 +#: ../../reference/datamodel.rst:2772 msgid "body" msgstr "body" -#: ../../reference/datamodel.rst:2599 +#: ../../reference/datamodel.rst:2792 msgid "__class__ (method cell)" msgstr "__class__ (方法 cell)" -#: ../../reference/datamodel.rst:2599 +#: ../../reference/datamodel.rst:2792 msgid "__classcell__ (class namespace entry)" msgstr "__classcell__ (類別命名空間項目)" -#: ../../reference/datamodel.rst:2897 +#: ../../reference/datamodel.rst:3090 msgid "__bool__() (object method)" msgstr "__bool__() (物件方法)" -#: ../../reference/datamodel.rst:3055 ../../reference/datamodel.rst:3090 +#: ../../reference/datamodel.rst:3248 ../../reference/datamodel.rst:3283 msgid "divmod" msgstr "divmod" -#: ../../reference/datamodel.rst:3055 ../../reference/datamodel.rst:3090 -#: ../../reference/datamodel.rst:3104 +#: ../../reference/datamodel.rst:3248 ../../reference/datamodel.rst:3283 +#: ../../reference/datamodel.rst:3297 msgid "pow" msgstr "pow" -#: ../../reference/datamodel.rst:3153 +#: ../../reference/datamodel.rst:3346 msgid "abs" msgstr "abs" -#: ../../reference/datamodel.rst:3163 +#: ../../reference/datamodel.rst:3356 msgid "int" msgstr "int" -#: ../../reference/datamodel.rst:3163 +#: ../../reference/datamodel.rst:3356 msgid "float" msgstr "float" -#: ../../reference/datamodel.rst:3191 +#: ../../reference/datamodel.rst:3384 msgid "round" msgstr "round" -#: ../../reference/datamodel.rst:3218 +#: ../../reference/datamodel.rst:3411 msgid "with" msgstr "with" -#: ../../reference/datamodel.rst:3218 +#: ../../reference/datamodel.rst:3411 msgid "context manager" msgstr "context manager(情境管理器)" +#~ msgid ":attr:`__name__`" +#~ msgstr ":attr:`__name__`" + +#~ msgid ":attr:`__doc__`" +#~ msgstr ":attr:`__doc__`" + +#~ msgid ":attr:`__file__`" +#~ msgstr ":attr:`__file__`" + +#~ msgid ":attr:`__annotations__`" +#~ msgstr ":attr:`__annotations__`" + #~ msgid ":attr:`~definition.__name__`" #~ msgstr ":attr:`~definition.__name__`" diff --git a/reference/executionmodel.po b/reference/executionmodel.po index 4dabdcd7f3..b2d942dbdd 100644 --- a/reference/executionmodel.po +++ b/reference/executionmodel.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-10-09 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -138,7 +138,7 @@ msgid "" "declared as :keyword:`nonlocal` or :keyword:`global`. If a name is bound at " "the module level, it is a global variable. (The variables of the module " "code block are local and global.) If a variable is used in a code block but " -"not defined there, it is a :dfn:`free variable`." +"not defined there, it is a :term:`free variable`." msgstr "" #: ../../reference/executionmodel.rst:95 @@ -269,7 +269,7 @@ msgstr "" #: ../../reference/executionmodel.rst:191 msgid "Annotation scopes" -msgstr "" +msgstr "註釋作用域 (annotation scopes)" #: ../../reference/executionmodel.rst:193 msgid "" @@ -498,11 +498,11 @@ msgid "" "for both." msgstr "" -#: ../../reference/executionmodel.rst:337 +#: ../../reference/executionmodel.rst:340 msgid "Exceptions" msgstr "例外" -#: ../../reference/executionmodel.rst:348 +#: ../../reference/executionmodel.rst:351 msgid "" "Exceptions are a means of breaking out of the normal flow of control of a " "code block in order to handle errors or other exceptional conditions. An " @@ -511,7 +511,7 @@ msgid "" "or indirectly invoked the code block where the error occurred." msgstr "" -#: ../../reference/executionmodel.rst:354 +#: ../../reference/executionmodel.rst:357 msgid "" "The Python interpreter raises an exception when it detects a run-time error " "(such as division by zero). A Python program can also explicitly raise an " @@ -522,7 +522,7 @@ msgid "" "exception occurred or not in the preceding code." msgstr "" -#: ../../reference/executionmodel.rst:364 +#: ../../reference/executionmodel.rst:367 msgid "" "Python uses the \"termination\" model of error handling: an exception " "handler can find out what happened and continue execution at an outer level, " @@ -530,7 +530,7 @@ msgid "" "(except by re-entering the offending piece of code from the top)." msgstr "" -#: ../../reference/executionmodel.rst:371 +#: ../../reference/executionmodel.rst:374 msgid "" "When an exception is not handled at all, the interpreter terminates " "execution of the program, or returns to its interactive main loop. In " @@ -538,7 +538,7 @@ msgid "" "`SystemExit`." msgstr "" -#: ../../reference/executionmodel.rst:375 +#: ../../reference/executionmodel.rst:378 msgid "" "Exceptions are identified by class instances. The :keyword:`except` clause " "is selected depending on the class of the instance: it must reference the " @@ -547,7 +547,7 @@ msgid "" "additional information about the exceptional condition." msgstr "" -#: ../../reference/executionmodel.rst:383 +#: ../../reference/executionmodel.rst:386 msgid "" "Exception messages are not part of the Python API. Their contents may " "change from one version of Python to the next without warning and should not " @@ -555,17 +555,17 @@ msgid "" "interpreter." msgstr "" -#: ../../reference/executionmodel.rst:387 +#: ../../reference/executionmodel.rst:390 msgid "" "See also the description of the :keyword:`try` statement in section :ref:" "`try` and :keyword:`raise` statement in section :ref:`raise`." msgstr "" -#: ../../reference/executionmodel.rst:392 +#: ../../reference/executionmodel.rst:395 msgid "Footnotes" msgstr "註解" -#: ../../reference/executionmodel.rst:393 +#: ../../reference/executionmodel.rst:396 msgid "" "This limitation occurs because the code that is executed by these operations " "is not available at the time the module is compiled." @@ -647,34 +647,34 @@ msgstr "__main__" msgid "restricted" msgstr "restricted(受限)" -#: ../../reference/executionmodel.rst:339 +#: ../../reference/executionmodel.rst:342 msgid "exception" msgstr "exception(例外)" -#: ../../reference/executionmodel.rst:341 +#: ../../reference/executionmodel.rst:344 msgid "raise an exception" msgstr "raise an exception(引發例外)" -#: ../../reference/executionmodel.rst:341 +#: ../../reference/executionmodel.rst:344 msgid "handle an exception" msgstr "handle an exception(處理例外)" -#: ../../reference/executionmodel.rst:341 +#: ../../reference/executionmodel.rst:344 msgid "exception handler" msgstr "exception handler(例外處理器)" -#: ../../reference/executionmodel.rst:341 +#: ../../reference/executionmodel.rst:344 msgid "errors" msgstr "errors(錯誤)" -#: ../../reference/executionmodel.rst:341 +#: ../../reference/executionmodel.rst:344 msgid "error handling" msgstr "error handling(錯誤處理)" -#: ../../reference/executionmodel.rst:362 +#: ../../reference/executionmodel.rst:365 msgid "termination model" msgstr "termination model(終止模型)" -#: ../../reference/executionmodel.rst:369 +#: ../../reference/executionmodel.rst:372 msgid "SystemExit (built-in exception)" msgstr "SystemExit(內建例外)" diff --git a/reference/expressions.po b/reference/expressions.po index 959ecdaa17..48e8693491 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-28 00:13+0000\n" +"POT-Creation-Date: 2024-10-08 03:35+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1322,7 +1322,7 @@ msgid "" "the same as if that method was called." msgstr "" -#: ../../reference/expressions.rst:1205 ../../reference/expressions.rst:2004 +#: ../../reference/expressions.rst:1205 ../../reference/expressions.rst:2006 msgid "Await expression" msgstr "" @@ -2022,11 +2022,11 @@ msgid "" "argument (for example, ``not 'foo'`` produces ``False`` rather than ``''``.)" msgstr "" -#: ../../reference/expressions.rst:1813 +#: ../../reference/expressions.rst:1815 msgid "Assignment expressions" msgstr "" -#: ../../reference/expressions.rst:1818 +#: ../../reference/expressions.rst:1820 msgid "" "An assignment expression (sometimes also called a \"named expression\" or " "\"walrus\") assigns an :token:`~python-grammar:expression` to an :token:" @@ -2034,11 +2034,11 @@ msgid "" "`~python-grammar:expression`." msgstr "" -#: ../../reference/expressions.rst:1823 +#: ../../reference/expressions.rst:1825 msgid "One common use case is when handling matched regular expressions:" msgstr "" -#: ../../reference/expressions.rst:1825 +#: ../../reference/expressions.rst:1827 msgid "" "if matching := pattern.search(data):\n" " do_something(matching)" @@ -2046,11 +2046,11 @@ msgstr "" "if matching := pattern.search(data):\n" " do_something(matching)" -#: ../../reference/expressions.rst:1830 +#: ../../reference/expressions.rst:1832 msgid "Or, when processing a file stream in chunks:" msgstr "" -#: ../../reference/expressions.rst:1832 +#: ../../reference/expressions.rst:1834 msgid "" "while chunk := file.read(9000):\n" " process(chunk)" @@ -2058,7 +2058,7 @@ msgstr "" "while chunk := file.read(9000):\n" " process(chunk)" -#: ../../reference/expressions.rst:1837 +#: ../../reference/expressions.rst:1839 msgid "" "Assignment expressions must be surrounded by parentheses when used as " "expression statements and when used as sub-expressions in slicing, " @@ -2068,36 +2068,36 @@ msgid "" "and ``while`` statements." msgstr "" -#: ../../reference/expressions.rst:1845 +#: ../../reference/expressions.rst:1847 msgid "See :pep:`572` for more details about assignment expressions." msgstr "" -#: ../../reference/expressions.rst:1852 +#: ../../reference/expressions.rst:1854 msgid "Conditional expressions" msgstr "" -#: ../../reference/expressions.rst:1864 +#: ../../reference/expressions.rst:1866 msgid "" "Conditional expressions (sometimes called a \"ternary operator\") have the " "lowest priority of all Python operations." msgstr "" -#: ../../reference/expressions.rst:1867 +#: ../../reference/expressions.rst:1869 msgid "" "The expression ``x if C else y`` first evaluates the condition, *C* rather " "than *x*. If *C* is true, *x* is evaluated and its value is returned; " "otherwise, *y* is evaluated and its value is returned." msgstr "" -#: ../../reference/expressions.rst:1871 +#: ../../reference/expressions.rst:1873 msgid "See :pep:`308` for more details about conditional expressions." msgstr "" -#: ../../reference/expressions.rst:1878 +#: ../../reference/expressions.rst:1880 msgid "Lambdas" msgstr "" -#: ../../reference/expressions.rst:1889 +#: ../../reference/expressions.rst:1891 msgid "" "Lambda expressions (sometimes called lambda forms) are used to create " "anonymous functions. The expression ``lambda parameters: expression`` yields " @@ -2105,7 +2105,7 @@ msgid "" "defined with:" msgstr "" -#: ../../reference/expressions.rst:1893 +#: ../../reference/expressions.rst:1895 msgid "" "def (parameters):\n" " return expression" @@ -2113,25 +2113,25 @@ msgstr "" "def (parameters):\n" " return expression" -#: ../../reference/expressions.rst:1898 +#: ../../reference/expressions.rst:1900 msgid "" "See section :ref:`function` for the syntax of parameter lists. Note that " "functions created with lambda expressions cannot contain statements or " "annotations." msgstr "" -#: ../../reference/expressions.rst:1906 +#: ../../reference/expressions.rst:1908 msgid "Expression lists" msgstr "" -#: ../../reference/expressions.rst:1922 +#: ../../reference/expressions.rst:1924 msgid "" "Except when part of a list or set display, an expression list containing at " "least one comma yields a tuple. The length of the tuple is the number of " "expressions in the list. The expressions are evaluated from left to right." msgstr "" -#: ../../reference/expressions.rst:1931 +#: ../../reference/expressions.rst:1933 msgid "" "An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be " "an :term:`iterable`. The iterable is expanded into a sequence of items, " @@ -2139,16 +2139,16 @@ msgid "" "unpacking." msgstr "" -#: ../../reference/expressions.rst:1936 +#: ../../reference/expressions.rst:1938 msgid "" "Iterable unpacking in expression lists, originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1939 +#: ../../reference/expressions.rst:1941 msgid "Any item in an expression list may be starred. See :pep:`646`." msgstr "" -#: ../../reference/expressions.rst:1944 +#: ../../reference/expressions.rst:1946 msgid "" "A trailing comma is required only to create a one-item tuple, such as ``1," "``; it is optional in all other cases. A single expression without a " @@ -2157,24 +2157,24 @@ msgid "" "``()``.)" msgstr "" -#: ../../reference/expressions.rst:1955 +#: ../../reference/expressions.rst:1957 msgid "Evaluation order" msgstr "" -#: ../../reference/expressions.rst:1959 +#: ../../reference/expressions.rst:1961 msgid "" "Python evaluates expressions from left to right. Notice that while " "evaluating an assignment, the right-hand side is evaluated before the left-" "hand side." msgstr "" -#: ../../reference/expressions.rst:1962 +#: ../../reference/expressions.rst:1964 msgid "" "In the following lines, expressions will be evaluated in the arithmetic " "order of their suffixes::" msgstr "" -#: ../../reference/expressions.rst:1965 +#: ../../reference/expressions.rst:1967 msgid "" "expr1, expr2, expr3, expr4\n" "(expr1, expr2, expr3, expr4)\n" @@ -2190,11 +2190,11 @@ msgstr "" "expr1(expr2, expr3, *expr4, **expr5)\n" "expr3, expr4 = expr1, expr2" -#: ../../reference/expressions.rst:1976 +#: ../../reference/expressions.rst:1978 msgid "Operator precedence" msgstr "" -#: ../../reference/expressions.rst:1981 +#: ../../reference/expressions.rst:1983 msgid "" "The following table summarizes the operator precedence in Python, from " "highest precedence (most binding) to lowest precedence (least binding). " @@ -2204,176 +2204,176 @@ msgid "" "group from right to left)." msgstr "" -#: ../../reference/expressions.rst:1987 +#: ../../reference/expressions.rst:1989 msgid "" "Note that comparisons, membership tests, and identity tests, all have the " "same precedence and have a left-to-right chaining feature as described in " "the :ref:`comparisons` section." msgstr "" -#: ../../reference/expressions.rst:1993 +#: ../../reference/expressions.rst:1995 msgid "Operator" msgstr "" -#: ../../reference/expressions.rst:1993 +#: ../../reference/expressions.rst:1995 msgid "Description" msgstr "描述" -#: ../../reference/expressions.rst:1995 +#: ../../reference/expressions.rst:1997 msgid "``(expressions...)``," msgstr "``(expressions...)``," -#: ../../reference/expressions.rst:1997 +#: ../../reference/expressions.rst:1999 msgid "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" msgstr "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" -#: ../../reference/expressions.rst:1995 +#: ../../reference/expressions.rst:1997 msgid "" "Binding or parenthesized expression, list display, dictionary display, set " "display" msgstr "" -#: ../../reference/expressions.rst:2001 +#: ../../reference/expressions.rst:2003 msgid "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" msgstr "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" -#: ../../reference/expressions.rst:2001 +#: ../../reference/expressions.rst:2003 msgid "Subscription, slicing, call, attribute reference" msgstr "" -#: ../../reference/expressions.rst:2004 +#: ../../reference/expressions.rst:2006 msgid ":keyword:`await x `" msgstr ":keyword:`await x `" -#: ../../reference/expressions.rst:2006 +#: ../../reference/expressions.rst:2008 msgid "``**``" msgstr "``**``" -#: ../../reference/expressions.rst:2006 +#: ../../reference/expressions.rst:2008 msgid "Exponentiation [#]_" msgstr "" -#: ../../reference/expressions.rst:2008 +#: ../../reference/expressions.rst:2010 msgid "``+x``, ``-x``, ``~x``" msgstr "``+x``, ``-x``, ``~x``" -#: ../../reference/expressions.rst:2008 +#: ../../reference/expressions.rst:2010 msgid "Positive, negative, bitwise NOT" msgstr "" -#: ../../reference/expressions.rst:2010 +#: ../../reference/expressions.rst:2012 msgid "``*``, ``@``, ``/``, ``//``, ``%``" msgstr "``*``, ``@``, ``/``, ``//``, ``%``" -#: ../../reference/expressions.rst:2010 +#: ../../reference/expressions.rst:2012 msgid "" "Multiplication, matrix multiplication, division, floor division, remainder " "[#]_" msgstr "" -#: ../../reference/expressions.rst:2014 +#: ../../reference/expressions.rst:2016 msgid "``+``, ``-``" msgstr "``+``, ``-``" -#: ../../reference/expressions.rst:2014 +#: ../../reference/expressions.rst:2016 msgid "Addition and subtraction" msgstr "" -#: ../../reference/expressions.rst:2016 +#: ../../reference/expressions.rst:2018 msgid "``<<``, ``>>``" msgstr "``<<``, ``>>``" -#: ../../reference/expressions.rst:2016 +#: ../../reference/expressions.rst:2018 msgid "Shifts" msgstr "" -#: ../../reference/expressions.rst:2018 +#: ../../reference/expressions.rst:2020 msgid "``&``" msgstr "``&``" -#: ../../reference/expressions.rst:2018 +#: ../../reference/expressions.rst:2020 msgid "Bitwise AND" msgstr "" -#: ../../reference/expressions.rst:2020 +#: ../../reference/expressions.rst:2022 msgid "``^``" msgstr "``^``" -#: ../../reference/expressions.rst:2020 +#: ../../reference/expressions.rst:2022 msgid "Bitwise XOR" msgstr "" -#: ../../reference/expressions.rst:2022 +#: ../../reference/expressions.rst:2024 msgid "``|``" msgstr "``|``" -#: ../../reference/expressions.rst:2022 +#: ../../reference/expressions.rst:2024 msgid "Bitwise OR" msgstr "" -#: ../../reference/expressions.rst:2024 +#: ../../reference/expressions.rst:2026 msgid "" ":keyword:`in`, :keyword:`not in`, :keyword:`is`, :keyword:`is not`, ``<``, " "``<=``, ``>``, ``>=``, ``!=``, ``==``" msgstr "" -#: ../../reference/expressions.rst:2024 +#: ../../reference/expressions.rst:2026 msgid "Comparisons, including membership tests and identity tests" msgstr "" -#: ../../reference/expressions.rst:2028 +#: ../../reference/expressions.rst:2030 msgid ":keyword:`not x `" msgstr ":keyword:`not x `" -#: ../../reference/expressions.rst:2028 +#: ../../reference/expressions.rst:2030 msgid "Boolean NOT" msgstr "" -#: ../../reference/expressions.rst:2030 +#: ../../reference/expressions.rst:2032 msgid ":keyword:`and`" msgstr ":keyword:`and`" -#: ../../reference/expressions.rst:2030 +#: ../../reference/expressions.rst:2032 msgid "Boolean AND" msgstr "" -#: ../../reference/expressions.rst:2032 +#: ../../reference/expressions.rst:2034 msgid ":keyword:`or`" msgstr ":keyword:`or`" -#: ../../reference/expressions.rst:2032 +#: ../../reference/expressions.rst:2034 msgid "Boolean OR" msgstr "" -#: ../../reference/expressions.rst:2034 +#: ../../reference/expressions.rst:2036 msgid ":keyword:`if ` -- :keyword:`!else`" msgstr ":keyword:`if ` -- :keyword:`!else`" -#: ../../reference/expressions.rst:2034 +#: ../../reference/expressions.rst:2036 msgid "Conditional expression" msgstr "" -#: ../../reference/expressions.rst:2036 +#: ../../reference/expressions.rst:2038 msgid ":keyword:`lambda`" msgstr ":keyword:`lambda`" -#: ../../reference/expressions.rst:2036 +#: ../../reference/expressions.rst:2038 msgid "Lambda expression" msgstr "" -#: ../../reference/expressions.rst:2038 +#: ../../reference/expressions.rst:2040 msgid "``:=``" msgstr "``:=``" -#: ../../reference/expressions.rst:2038 +#: ../../reference/expressions.rst:2040 msgid "Assignment expression" msgstr "" -#: ../../reference/expressions.rst:2043 +#: ../../reference/expressions.rst:2045 msgid "Footnotes" msgstr "註解" -#: ../../reference/expressions.rst:2044 +#: ../../reference/expressions.rst:2046 msgid "" "While ``abs(x%y) < abs(y)`` is true mathematically, for floats it may not be " "true numerically due to roundoff. For example, and assuming a platform on " @@ -2385,7 +2385,7 @@ msgid "" "approach is more appropriate depends on the application." msgstr "" -#: ../../reference/expressions.rst:2053 +#: ../../reference/expressions.rst:2055 msgid "" "If x is very close to an exact integer multiple of y, it's possible for ``x//" "y`` to be one larger than ``(x-x%y)//y`` due to rounding. In such cases, " @@ -2393,7 +2393,7 @@ msgid "" "* y + x % y`` be very close to ``x``." msgstr "" -#: ../../reference/expressions.rst:2058 +#: ../../reference/expressions.rst:2060 msgid "" "The Unicode standard distinguishes between :dfn:`code points` (e.g. U+0041) " "and :dfn:`abstract characters` (e.g. \"LATIN CAPITAL LETTER A\"). While most " @@ -2407,7 +2407,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: ../../reference/expressions.rst:2069 +#: ../../reference/expressions.rst:2071 msgid "" "The comparison operators on strings compare at the level of Unicode code " "points. This may be counter-intuitive to humans. For example, ``\"\\u00C7\" " @@ -2415,13 +2415,13 @@ msgid "" "same abstract character \"LATIN CAPITAL LETTER C WITH CEDILLA\"." msgstr "" -#: ../../reference/expressions.rst:2074 +#: ../../reference/expressions.rst:2076 msgid "" "To compare strings at the level of abstract characters (that is, in a way " "intuitive to humans), use :func:`unicodedata.normalize`." msgstr "" -#: ../../reference/expressions.rst:2077 +#: ../../reference/expressions.rst:2079 msgid "" "Due to automatic garbage-collection, free lists, and the dynamic nature of " "descriptors, you may notice seemingly unusual behaviour in certain uses of " @@ -2429,13 +2429,13 @@ msgid "" "instance methods, or constants. Check their documentation for more info." msgstr "" -#: ../../reference/expressions.rst:2082 +#: ../../reference/expressions.rst:2084 msgid "" "The power operator ``**`` binds less tightly than an arithmetic or bitwise " "unary operator on its right, that is, ``2**-1`` is ``0.5``." msgstr "" -#: ../../reference/expressions.rst:2085 +#: ../../reference/expressions.rst:2087 msgid "" "The ``%`` operator is also used for string formatting; the same precedence " "applies." @@ -2443,8 +2443,8 @@ msgstr "" #: ../../reference/expressions.rst:8 ../../reference/expressions.rst:393 #: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1765 -#: ../../reference/expressions.rst:1805 ../../reference/expressions.rst:1854 -#: ../../reference/expressions.rst:1880 ../../reference/expressions.rst:1908 +#: ../../reference/expressions.rst:1805 ../../reference/expressions.rst:1856 +#: ../../reference/expressions.rst:1882 ../../reference/expressions.rst:1910 msgid "expression" msgstr "" @@ -2521,7 +2521,7 @@ msgstr "type(型別)" #: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1001 #: ../../reference/expressions.rst:1149 ../../reference/expressions.rst:1162 #: ../../reference/expressions.rst:1176 ../../reference/expressions.rst:1183 -#: ../../reference/expressions.rst:1730 ../../reference/expressions.rst:1920 +#: ../../reference/expressions.rst:1730 ../../reference/expressions.rst:1922 msgid "object" msgstr "object(物件)" @@ -2543,18 +2543,18 @@ msgid "empty" msgstr "" #: ../../reference/expressions.rst:175 ../../reference/expressions.rst:880 -#: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1920 +#: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1922 msgid "tuple" msgstr "" -#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1942 +#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1944 msgid "comma" msgstr "" #: ../../reference/expressions.rst:181 ../../reference/expressions.rst:275 #: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 #: ../../reference/expressions.rst:951 ../../reference/expressions.rst:1001 -#: ../../reference/expressions.rst:1908 +#: ../../reference/expressions.rst:1910 msgid ", (comma)" msgstr ", (逗號)" @@ -2571,7 +2571,7 @@ msgstr "for" msgid "in comprehensions" msgstr "於 comprehensions(綜合運算)" -#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1854 +#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1856 msgid "if" msgstr "if" @@ -2585,7 +2585,7 @@ msgstr "await" #: ../../reference/expressions.rst:275 ../../reference/expressions.rst:851 #: ../../reference/expressions.rst:880 ../../reference/expressions.rst:957 -#: ../../reference/expressions.rst:1908 +#: ../../reference/expressions.rst:1910 msgid "list" msgstr "list(串列)" @@ -2603,7 +2603,7 @@ msgid "list expression" msgstr "list expression(串列運算式)" #: ../../reference/expressions.rst:275 ../../reference/expressions.rst:301 -#: ../../reference/expressions.rst:1908 +#: ../../reference/expressions.rst:1910 msgid "expression list" msgstr "expression list(運算式串列)" @@ -2641,7 +2641,7 @@ msgid "dictionary expression" msgstr "dictionary expression(字典運算式)" #: ../../reference/expressions.rst:329 ../../reference/expressions.rst:951 -#: ../../reference/expressions.rst:1880 +#: ../../reference/expressions.rst:1882 msgid ": (colon)" msgstr ": (冒號)" @@ -2654,7 +2654,7 @@ msgid "in dictionary displays" msgstr "於字典顯示" #: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1084 -#: ../../reference/expressions.rst:1927 +#: ../../reference/expressions.rst:1929 msgid "unpacking" msgstr "unpacking(解包)" @@ -2689,7 +2689,7 @@ msgid "from" msgstr "from" #: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1149 -#: ../../reference/expressions.rst:1162 ../../reference/expressions.rst:1880 +#: ../../reference/expressions.rst:1162 ../../reference/expressions.rst:1882 msgid "function" msgstr "function (函式)" @@ -2831,7 +2831,7 @@ msgid "parameter" msgstr "parameter(參數)" #: ../../reference/expressions.rst:1084 ../../reference/expressions.rst:1318 -#: ../../reference/expressions.rst:1927 +#: ../../reference/expressions.rst:1929 msgid "* (asterisk)" msgstr "* (星號)" @@ -2895,7 +2895,7 @@ msgstr "operation(操作)" #: ../../reference/expressions.rst:1491 ../../reference/expressions.rst:1730 #: ../../reference/expressions.rst:1739 ../../reference/expressions.rst:1781 #: ../../reference/expressions.rst:1786 ../../reference/expressions.rst:1791 -#: ../../reference/expressions.rst:1854 ../../reference/expressions.rst:1978 +#: ../../reference/expressions.rst:1856 ../../reference/expressions.rst:1980 msgid "operator" msgstr "operator(運算子)" @@ -3150,59 +3150,59 @@ msgstr "named expression(附名運算式)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../reference/expressions.rst:1854 +#: ../../reference/expressions.rst:1856 msgid "conditional" msgstr "conditional(條件式)" -#: ../../reference/expressions.rst:1854 +#: ../../reference/expressions.rst:1856 msgid "ternary" msgstr "ternary(三元)" -#: ../../reference/expressions.rst:1854 +#: ../../reference/expressions.rst:1856 msgid "conditional expression" msgstr "conditional expression(條件運算式)" -#: ../../reference/expressions.rst:1854 +#: ../../reference/expressions.rst:1856 msgid "else" msgstr "else" -#: ../../reference/expressions.rst:1880 +#: ../../reference/expressions.rst:1882 msgid "lambda" msgstr "lambda" -#: ../../reference/expressions.rst:1880 +#: ../../reference/expressions.rst:1882 msgid "form" msgstr "form" -#: ../../reference/expressions.rst:1880 +#: ../../reference/expressions.rst:1882 msgid "anonymous" msgstr "anonymous(匿名)" -#: ../../reference/expressions.rst:1880 +#: ../../reference/expressions.rst:1882 msgid "lambda expression" msgstr "lambda expression(lambda 運算式)" -#: ../../reference/expressions.rst:1927 +#: ../../reference/expressions.rst:1929 msgid "iterable" msgstr "iterable(可疊代)" -#: ../../reference/expressions.rst:1927 +#: ../../reference/expressions.rst:1929 msgid "in expression lists" msgstr "於 expression list(運算式串列)" -#: ../../reference/expressions.rst:1942 +#: ../../reference/expressions.rst:1944 msgid "trailing" msgstr "trailing" -#: ../../reference/expressions.rst:1957 +#: ../../reference/expressions.rst:1959 msgid "evaluation" msgstr "evaluation" -#: ../../reference/expressions.rst:1957 +#: ../../reference/expressions.rst:1959 msgid "order" msgstr "order(順序)" -#: ../../reference/expressions.rst:1978 +#: ../../reference/expressions.rst:1980 msgid "precedence" msgstr "precedence(優先順序)" diff --git a/reference/import.po b/reference/import.po index 5dd27d0187..9e13d37747 100644 --- a/reference/import.po +++ b/reference/import.po @@ -868,11 +868,11 @@ msgid "" "``foo`` attribute of the former." msgstr "" -#: ../../reference/import.rst:517 -msgid "Module spec" +#: ../../reference/import.rst:519 +msgid "Module specs" msgstr "" -#: ../../reference/import.rst:519 +#: ../../reference/import.rst:521 msgid "" "The import machinery uses a variety of information about each module during " "import, especially before loading. Most of the information is common to all " @@ -880,7 +880,7 @@ msgid "" "related information on a per-module basis." msgstr "" -#: ../../reference/import.rst:524 +#: ../../reference/import.rst:526 msgid "" "Using a spec during import allows state to be transferred between import " "system components, e.g. between the finder that creates the module spec and " @@ -889,220 +889,70 @@ msgid "" "a module spec the loader had that responsibility." msgstr "" -#: ../../reference/import.rst:530 -msgid "" -"The module's spec is exposed as the ``__spec__`` attribute on a module " -"object. See :class:`~importlib.machinery.ModuleSpec` for details on the " -"contents of the module spec." -msgstr "" - -#: ../../reference/import.rst:539 -msgid "Import-related module attributes" -msgstr "" - -#: ../../reference/import.rst:541 -msgid "" -"The import machinery fills in these attributes on each module object during " -"loading, based on the module's spec, before the loader executes the module." -msgstr "" - -#: ../../reference/import.rst:545 -msgid "" -"It is **strongly** recommended that you rely on :attr:`__spec__` and its " -"attributes instead of any of the other individual attributes listed below." -msgstr "" - -#: ../../reference/import.rst:551 -msgid "" -"The ``__name__`` attribute must be set to the fully qualified name of the " -"module. This name is used to uniquely identify the module in the import " -"system." -msgstr "" - -#: ../../reference/import.rst:557 -msgid "" -"The ``__loader__`` attribute must be set to the loader object that the " -"import machinery used when loading the module. This is mostly for " -"introspection, but can be used for additional loader-specific functionality, " -"for example getting data associated with a loader." -msgstr "" - -#: ../../reference/import.rst:562 ../../reference/import.rst:583 -msgid "" -"It is **strongly** recommended that you rely on :attr:`__spec__` instead of " -"this attribute." -msgstr "" - -#: ../../reference/import.rst:565 -msgid "" -"The value of ``__loader__`` is expected to be the same as ``__spec__." -"loader``. The use of ``__loader__`` is deprecated and slated for removal in " -"Python 3.14." -msgstr "" - -#: ../../reference/import.rst:572 -msgid "" -"The module's ``__package__`` attribute may be set. Its value must be a " -"string, but it can be the same value as its ``__name__``. When the module " -"is a package, its ``__package__`` value should be set to its ``__name__``. " -"When the module is not a package, ``__package__`` should be set to the empty " -"string for top-level modules, or for submodules, to the parent package's " -"name. See :pep:`366` for further details." -msgstr "" - -#: ../../reference/import.rst:580 -msgid "" -"This attribute is used instead of ``__name__`` to calculate explicit " -"relative imports for main modules, as defined in :pep:`366`." -msgstr "" - -#: ../../reference/import.rst:586 -msgid "" -"The value of ``__package__`` is expected to be the same as ``__spec__." -"parent``." -msgstr "" - -#: ../../reference/import.rst:590 -msgid "" -":exc:`ImportWarning` is raised if import falls back to ``__package__`` " -"instead of :attr:`~importlib.machinery.ModuleSpec.parent`." -msgstr "" - -#: ../../reference/import.rst:595 -msgid "" -"Raise :exc:`DeprecationWarning` instead of :exc:`ImportWarning` when falling " -"back to ``__package__``." -msgstr "" - -#: ../../reference/import.rst:599 -msgid "" -"``__package__`` will cease to be set or taken into consideration by the " -"import system or standard library." -msgstr "" - -#: ../../reference/import.rst:606 -msgid "" -"The ``__spec__`` attribute must be set to the module spec that was used when " -"importing the module. Setting ``__spec__`` appropriately applies equally to :" -"ref:`modules initialized during interpreter startup `. The one " -"exception is ``__main__``, where ``__spec__`` is :ref:`set to None in some " -"cases `." -msgstr "" - -#: ../../reference/import.rst:612 -msgid "" -"When ``__spec__.parent`` is not set, ``__package__`` is used as a fallback." -msgstr "" - -#: ../../reference/import.rst:617 -msgid "" -"``__spec__.parent`` is used as a fallback when ``__package__`` is not " -"defined." -msgstr "" - -#: ../../reference/import.rst:623 -msgid "" -"If the module is a package (either regular or namespace), the module " -"object's ``__path__`` attribute must be set. The value must be iterable, " -"but may be empty if ``__path__`` has no further significance. If " -"``__path__`` is not empty, it must produce strings when iterated over. More " -"details on the semantics of ``__path__`` are given :ref:`below `." -msgstr "" - -#: ../../reference/import.rst:630 -msgid "Non-package modules should not have a ``__path__`` attribute." -msgstr "" - -#: ../../reference/import.rst:635 -msgid "" -"``__file__`` is optional (if set, value must be a string). It indicates the " -"pathname of the file from which the module was loaded (if loaded from a " -"file), or the pathname of the shared library file for extension modules " -"loaded dynamically from a shared library. It might be missing for certain " -"types of modules, such as C modules that are statically linked into the " -"interpreter, and the import system may opt to leave it unset if it has no " -"semantic meaning (e.g. a module loaded from a database)." -msgstr "" - -#: ../../reference/import.rst:644 -msgid "" -"If ``__file__`` is set then the ``__cached__`` attribute might also be set, " -"which is the path to any compiled version of the code (e.g. byte-compiled " -"file). The file does not need to exist to set this attribute; the path can " -"simply point to where the compiled file would exist (see :pep:`3147`)." -msgstr "" - -#: ../../reference/import.rst:650 +#: ../../reference/import.rst:532 msgid "" -"Note that ``__cached__`` may be set even if ``__file__`` is not set. " -"However, that scenario is quite atypical. Ultimately, the loader is what " -"makes use of the module spec provided by the finder (from which ``__file__`` " -"and ``__cached__`` are derived). So if a loader can load from a cached " -"module but otherwise does not load from a file, that atypical scenario may " -"be appropriate." +"The module's spec is exposed as :attr:`module.__spec__`. Setting :attr:`!" +"__spec__` appropriately applies equally to :ref:`modules initialized during " +"interpreter startup `. The one exception is ``__main__``, where :" +"attr:`!__spec__` is :ref:`set to None in some cases `." msgstr "" -#: ../../reference/import.rst:657 +#: ../../reference/import.rst:538 msgid "" -"It is **strongly** recommended that you rely on :attr:`__spec__` instead of " -"``__cached__``." +"See :class:`~importlib.machinery.ModuleSpec` for details on the contents of " +"the module spec." msgstr "" -#: ../../reference/import.rst:660 -msgid "" -"``__cached__`` will cease to be set or taken into consideration by the " -"import system or standard library." +#: ../../reference/import.rst:546 +msgid "__path__ attributes on modules" msgstr "" -#: ../../reference/import.rst:667 -msgid "module.__path__" -msgstr "module.__path__" - -#: ../../reference/import.rst:669 +#: ../../reference/import.rst:548 msgid "" -"By definition, if a module has a ``__path__`` attribute, it is a package." +"The :attr:`~module.__path__` attribute should be a (possibly empty) :term:" +"`sequence` of strings enumerating the locations where the package's " +"submodules will be found. By definition, if a module has a :attr:`!__path__` " +"attribute, it is a :term:`package`." msgstr "" -#: ../../reference/import.rst:671 +#: ../../reference/import.rst:553 msgid "" -"A package's ``__path__`` attribute is used during imports of its " +"A package's :attr:`~module.__path__` attribute is used during imports of its " "subpackages. Within the import machinery, it functions much the same as :" "data:`sys.path`, i.e. providing a list of locations to search for modules " -"during import. However, ``__path__`` is typically much more constrained " -"than :data:`sys.path`." +"during import. However, :attr:`!__path__` is typically much more constrained " +"than :data:`!sys.path`." msgstr "" -#: ../../reference/import.rst:677 +#: ../../reference/import.rst:560 msgid "" -"``__path__`` must be an iterable of strings, but it may be empty. The same " -"rules used for :data:`sys.path` also apply to a package's ``__path__``, and :" -"data:`sys.path_hooks` (described below) are consulted when traversing a " -"package's ``__path__``." +"The same rules used for :data:`sys.path` also apply to a package's :attr:`!" +"__path__`. :data:`sys.path_hooks` (described below) are consulted when " +"traversing a package's :attr:`!__path__`." msgstr "" -#: ../../reference/import.rst:682 +#: ../../reference/import.rst:564 msgid "" -"A package's ``__init__.py`` file may set or alter the package's ``__path__`` " -"attribute, and this was typically the way namespace packages were " -"implemented prior to :pep:`420`. With the adoption of :pep:`420`, namespace " -"packages no longer need to supply ``__init__.py`` files containing only " -"``__path__`` manipulation code; the import machinery automatically sets " -"``__path__`` correctly for the namespace package." +"A package's ``__init__.py`` file may set or alter the package's :attr:" +"`~module.__path__` attribute, and this was typically the way namespace " +"packages were implemented prior to :pep:`420`. With the adoption of :pep:" +"`420`, namespace packages no longer need to supply ``__init__.py`` files " +"containing only :attr:`!__path__` manipulation code; the import machinery " +"automatically sets :attr:`!__path__` correctly for the namespace package." msgstr "" -#: ../../reference/import.rst:690 +#: ../../reference/import.rst:573 msgid "Module reprs" msgstr "" -#: ../../reference/import.rst:692 +#: ../../reference/import.rst:575 msgid "" "By default, all modules have a usable repr, however depending on the " "attributes set above, and in the module's spec, you can more explicitly " "control the repr of module objects." msgstr "" -#: ../../reference/import.rst:696 +#: ../../reference/import.rst:579 msgid "" "If the module has a spec (``__spec__``), the import machinery will try to " "generate a repr from it. If that fails or there is no spec, the import " @@ -1112,45 +962,45 @@ msgid "" "for whatever information is missing." msgstr "" -#: ../../reference/import.rst:703 +#: ../../reference/import.rst:586 msgid "Here are the exact rules used:" msgstr "" -#: ../../reference/import.rst:705 +#: ../../reference/import.rst:588 msgid "" "If the module has a ``__spec__`` attribute, the information in the spec is " "used to generate the repr. The \"name\", \"loader\", \"origin\", and " "\"has_location\" attributes are consulted." msgstr "" -#: ../../reference/import.rst:709 +#: ../../reference/import.rst:592 msgid "" "If the module has a ``__file__`` attribute, this is used as part of the " "module's repr." msgstr "" -#: ../../reference/import.rst:712 +#: ../../reference/import.rst:595 msgid "" "If the module has no ``__file__`` but does have a ``__loader__`` that is not " "``None``, then the loader's repr is used as part of the module's repr." msgstr "" -#: ../../reference/import.rst:715 +#: ../../reference/import.rst:598 msgid "Otherwise, just use the module's ``__name__`` in the repr." msgstr "" -#: ../../reference/import.rst:717 +#: ../../reference/import.rst:600 msgid "" "Use of :meth:`!module_repr`, having been deprecated since Python 3.4, was " "removed in Python 3.12 and is no longer called during the resolution of a " "module's repr." msgstr "" -#: ../../reference/import.rst:725 +#: ../../reference/import.rst:608 msgid "Cached bytecode invalidation" msgstr "" -#: ../../reference/import.rst:727 +#: ../../reference/import.rst:610 msgid "" "Before Python loads cached bytecode from a ``.pyc`` file, it checks whether " "the cache is up-to-date with the source ``.py`` file. By default, Python " @@ -1160,7 +1010,7 @@ msgid "" "source's metadata." msgstr "" -#: ../../reference/import.rst:734 +#: ../../reference/import.rst:617 msgid "" "Python also supports \"hash-based\" cache files, which store a hash of the " "source file's contents rather than its metadata. There are two variants of " @@ -1174,17 +1024,17 @@ msgid "" "option:`--check-hash-based-pycs` flag." msgstr "" -#: ../../reference/import.rst:745 +#: ../../reference/import.rst:628 msgid "" "Added hash-based ``.pyc`` files. Previously, Python only supported timestamp-" "based invalidation of bytecode caches." msgstr "" -#: ../../reference/import.rst:751 +#: ../../reference/import.rst:634 msgid "The Path Based Finder" msgstr "" -#: ../../reference/import.rst:756 +#: ../../reference/import.rst:639 msgid "" "As mentioned previously, Python comes with several default meta path " "finders. One of these, called the :term:`path based finder` (:class:" @@ -1193,14 +1043,14 @@ msgid "" "a location to search for modules." msgstr "" -#: ../../reference/import.rst:762 +#: ../../reference/import.rst:645 msgid "" "The path based finder itself doesn't know how to import anything. Instead, " "it traverses the individual path entries, associating each of them with a " "path entry finder that knows how to handle that particular kind of path." msgstr "" -#: ../../reference/import.rst:766 +#: ../../reference/import.rst:649 msgid "" "The default set of path entry finders implement all the semantics for " "finding modules on the file system, handling special file types such as " @@ -1211,14 +1061,14 @@ msgid "" "from zipfiles." msgstr "" -#: ../../reference/import.rst:773 +#: ../../reference/import.rst:656 msgid "" "Path entries need not be limited to file system locations. They can refer " "to URLs, database queries, or any other location that can be specified as a " "string." msgstr "" -#: ../../reference/import.rst:777 +#: ../../reference/import.rst:660 msgid "" "The path based finder provides additional hooks and protocols so that you " "can extend and customize the types of searchable path entries. For example, " @@ -1229,7 +1079,7 @@ msgid "" "from the web." msgstr "" -#: ../../reference/import.rst:785 +#: ../../reference/import.rst:668 msgid "" "A word of warning: this section and the previous both use the term *finder*, " "distinguishing between them by using the terms :term:`meta path finder` and :" @@ -1240,7 +1090,7 @@ msgid "" "process, as keyed off the :data:`sys.meta_path` traversal." msgstr "" -#: ../../reference/import.rst:793 +#: ../../reference/import.rst:676 msgid "" "By contrast, path entry finders are in a sense an implementation detail of " "the path based finder, and in fact, if the path based finder were to be " @@ -1248,11 +1098,11 @@ msgid "" "would be invoked." msgstr "" -#: ../../reference/import.rst:800 +#: ../../reference/import.rst:683 msgid "Path entry finders" msgstr "" -#: ../../reference/import.rst:808 +#: ../../reference/import.rst:691 msgid "" "The :term:`path based finder` is responsible for finding and loading Python " "modules and packages whose location is specified with a string :term:`path " @@ -1260,7 +1110,7 @@ msgid "" "not be limited to this." msgstr "" -#: ../../reference/import.rst:813 +#: ../../reference/import.rst:696 msgid "" "As a meta path finder, the :term:`path based finder` implements the :meth:" "`~importlib.abc.MetaPathFinder.find_spec` protocol previously described, " @@ -1268,7 +1118,7 @@ msgid "" "modules are found and loaded from the :term:`import path`." msgstr "" -#: ../../reference/import.rst:818 +#: ../../reference/import.rst:701 msgid "" "Three variables are used by the :term:`path based finder`, :data:`sys." "path`, :data:`sys.path_hooks` and :data:`sys.path_importer_cache`. The " @@ -1276,7 +1126,7 @@ msgid "" "additional ways that the import machinery can be customized." msgstr "" -#: ../../reference/import.rst:823 +#: ../../reference/import.rst:706 msgid "" ":data:`sys.path` contains a list of strings providing search locations for " "modules and packages. It is initialized from the :envvar:`PYTHONPATH` " @@ -1288,7 +1138,7 @@ msgid "" "other data types are ignored." msgstr "" -#: ../../reference/import.rst:832 +#: ../../reference/import.rst:715 msgid "" "The :term:`path based finder` is a :term:`meta path finder`, so the import " "machinery begins the :term:`import path` search by calling the path based " @@ -1300,7 +1150,7 @@ msgid "" "top level import and :data:`sys.path` is used." msgstr "" -#: ../../reference/import.rst:841 +#: ../../reference/import.rst:724 msgid "" "The path based finder iterates over every entry in the search path, and for " "each of these, looks for an appropriate :term:`path entry finder` (:class:" @@ -1316,7 +1166,7 @@ msgid "" "finder to perform the path entry search again." msgstr "" -#: ../../reference/import.rst:854 +#: ../../reference/import.rst:737 msgid "" "If the path entry is not present in the cache, the path based finder " "iterates over every callable in :data:`sys.path_hooks`. Each of the :term:" @@ -1332,7 +1182,7 @@ msgid "" "decode the argument, it should raise :exc:`ImportError`." msgstr "" -#: ../../reference/import.rst:868 +#: ../../reference/import.rst:751 msgid "" "If :data:`sys.path_hooks` iteration ends with no :term:`path entry finder` " "being returned, then the path based finder's :meth:`~importlib.machinery." @@ -1342,7 +1192,7 @@ msgid "" "could not find the module." msgstr "" -#: ../../reference/import.rst:875 +#: ../../reference/import.rst:758 msgid "" "If a :term:`path entry finder` *is* returned by one of the :term:`path entry " "hook` callables on :data:`sys.path_hooks`, then the following protocol is " @@ -1350,7 +1200,7 @@ msgid "" "the module." msgstr "" -#: ../../reference/import.rst:880 +#: ../../reference/import.rst:763 msgid "" "The current working directory -- denoted by an empty string -- is handled " "slightly differently from other entries on :data:`sys.path`. First, if the " @@ -1362,18 +1212,18 @@ msgid "" "and not the empty string." msgstr "" -#: ../../reference/import.rst:890 +#: ../../reference/import.rst:773 msgid "Path entry finder protocol" msgstr "" -#: ../../reference/import.rst:892 +#: ../../reference/import.rst:775 msgid "" "In order to support imports of modules and initialized packages and also to " "contribute portions to namespace packages, path entry finders must implement " "the :meth:`~importlib.abc.PathEntryFinder.find_spec` method." msgstr "" -#: ../../reference/import.rst:896 +#: ../../reference/import.rst:779 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` takes two arguments: the " "fully qualified name of the module being imported, and the (optional) target " @@ -1381,21 +1231,21 @@ msgid "" "spec will always have \"loader\" set (with one exception)." msgstr "" -#: ../../reference/import.rst:901 +#: ../../reference/import.rst:784 msgid "" "To indicate to the import machinery that the spec represents a namespace :" "term:`portion`, the path entry finder sets ``submodule_search_locations`` to " "a list containing the portion." msgstr "" -#: ../../reference/import.rst:905 +#: ../../reference/import.rst:788 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` replaced :meth:`!" "find_loader` and :meth:`!find_module`, both of which are now deprecated, but " "will be used if ``find_spec()`` is not defined." msgstr "" -#: ../../reference/import.rst:911 +#: ../../reference/import.rst:794 msgid "" "Older path entry finders may implement one of these two deprecated methods " "instead of ``find_spec()``. The methods are still respected for the sake of " @@ -1403,14 +1253,14 @@ msgid "" "path entry finder, the legacy methods are ignored." msgstr "" -#: ../../reference/import.rst:916 +#: ../../reference/import.rst:799 msgid "" ":meth:`!find_loader` takes one argument, the fully qualified name of the " "module being imported. ``find_loader()`` returns a 2-tuple where the first " "item is the loader and the second item is a namespace :term:`portion`." msgstr "" -#: ../../reference/import.rst:921 +#: ../../reference/import.rst:804 msgid "" "For backwards compatibility with other implementations of the import " "protocol, many path entry finders also support the same, traditional " @@ -1420,7 +1270,7 @@ msgid "" "initial call to the path hook)." msgstr "" -#: ../../reference/import.rst:928 +#: ../../reference/import.rst:811 msgid "" "The ``find_module()`` method on path entry finders is deprecated, as it does " "not allow the path entry finder to contribute portions to namespace " @@ -1429,28 +1279,28 @@ msgid "" "preference to ``find_module()``." msgstr "" -#: ../../reference/import.rst:934 +#: ../../reference/import.rst:817 msgid "" "Calls to :meth:`!find_module` and :meth:`!find_loader` by the import system " "will raise :exc:`ImportWarning`." msgstr "" -#: ../../reference/import.rst:939 +#: ../../reference/import.rst:822 msgid "``find_module()`` and ``find_loader()`` have been removed." msgstr "" -#: ../../reference/import.rst:944 +#: ../../reference/import.rst:827 msgid "Replacing the standard import system" msgstr "" -#: ../../reference/import.rst:946 +#: ../../reference/import.rst:829 msgid "" "The most reliable mechanism for replacing the entire import system is to " "delete the default contents of :data:`sys.meta_path`, replacing them " "entirely with a custom meta path hook." msgstr "" -#: ../../reference/import.rst:950 +#: ../../reference/import.rst:833 msgid "" "If it is acceptable to only alter the behaviour of import statements without " "affecting other APIs that access the import system, then replacing the " @@ -1459,7 +1309,7 @@ msgid "" "statements within that module." msgstr "" -#: ../../reference/import.rst:956 +#: ../../reference/import.rst:839 msgid "" "To selectively prevent the import of some modules from a hook early on the " "meta path (rather than disabling the standard import system entirely), it is " @@ -1469,11 +1319,11 @@ msgid "" "exception terminates it immediately." msgstr "" -#: ../../reference/import.rst:966 +#: ../../reference/import.rst:849 msgid "Package Relative Imports" msgstr "" -#: ../../reference/import.rst:968 +#: ../../reference/import.rst:851 msgid "" "Relative imports use leading dots. A single leading dot indicates a relative " "import, starting with the current package. Two or more leading dots indicate " @@ -1481,7 +1331,7 @@ msgid "" "after the first. For example, given the following package layout::" msgstr "" -#: ../../reference/import.rst:973 +#: ../../reference/import.rst:856 msgid "" "package/\n" " __init__.py\n" @@ -1505,13 +1355,13 @@ msgstr "" " moduleZ.py\n" " moduleA.py" -#: ../../reference/import.rst:984 +#: ../../reference/import.rst:867 msgid "" "In either ``subpackage1/moduleX.py`` or ``subpackage1/__init__.py``, the " "following are valid relative imports::" msgstr "" -#: ../../reference/import.rst:987 +#: ../../reference/import.rst:870 msgid "" "from .moduleY import spam\n" "from .moduleY import spam as ham\n" @@ -1527,28 +1377,28 @@ msgstr "" "from ..subpackage2.moduleZ import eggs\n" "from ..moduleA import foo" -#: ../../reference/import.rst:994 +#: ../../reference/import.rst:877 msgid "" "Absolute imports may use either the ``import <>`` or ``from <> import <>`` " "syntax, but relative imports may only use the second form; the reason for " "this is that::" msgstr "" -#: ../../reference/import.rst:998 +#: ../../reference/import.rst:881 msgid "import XXX.YYY.ZZZ" msgstr "import XXX.YYY.ZZZ" -#: ../../reference/import.rst:1000 +#: ../../reference/import.rst:883 msgid "" "should expose ``XXX.YYY.ZZZ`` as a usable expression, but .moduleY is not a " "valid expression." msgstr "" -#: ../../reference/import.rst:1007 +#: ../../reference/import.rst:890 msgid "Special considerations for __main__" msgstr "" -#: ../../reference/import.rst:1009 +#: ../../reference/import.rst:892 msgid "" "The :mod:`__main__` module is a special case relative to Python's import " "system. As noted :ref:`elsewhere `, the ``__main__`` module is " @@ -1559,17 +1409,17 @@ msgid "" "interpreter is invoked." msgstr "" -#: ../../reference/import.rst:1020 +#: ../../reference/import.rst:903 msgid "__main__.__spec__" msgstr "__main__.__spec__" -#: ../../reference/import.rst:1022 +#: ../../reference/import.rst:905 msgid "" "Depending on how :mod:`__main__` is initialized, ``__main__.__spec__`` gets " "set appropriately or to ``None``." msgstr "" -#: ../../reference/import.rst:1025 +#: ../../reference/import.rst:908 msgid "" "When Python is started with the :option:`-m` option, ``__spec__`` is set to " "the module spec of the corresponding module or package. ``__spec__`` is also " @@ -1577,30 +1427,30 @@ msgid "" "directory, zipfile or other :data:`sys.path` entry." msgstr "" -#: ../../reference/import.rst:1030 +#: ../../reference/import.rst:913 msgid "" "In :ref:`the remaining cases ` ``__main__." "__spec__`` is set to ``None``, as the code used to populate the :mod:" "`__main__` does not correspond directly with an importable module:" msgstr "" -#: ../../reference/import.rst:1034 +#: ../../reference/import.rst:917 msgid "interactive prompt" msgstr "" -#: ../../reference/import.rst:1035 +#: ../../reference/import.rst:918 msgid ":option:`-c` option" msgstr ":option:`-c` 選項" -#: ../../reference/import.rst:1036 +#: ../../reference/import.rst:919 msgid "running from stdin" msgstr "" -#: ../../reference/import.rst:1037 +#: ../../reference/import.rst:920 msgid "running directly from a source or bytecode file" msgstr "" -#: ../../reference/import.rst:1039 +#: ../../reference/import.rst:922 msgid "" "Note that ``__main__.__spec__`` is always ``None`` in the last case, *even " "if* the file could technically be imported directly as a module instead. Use " @@ -1608,7 +1458,7 @@ msgid "" "`__main__`." msgstr "" -#: ../../reference/import.rst:1044 +#: ../../reference/import.rst:927 msgid "" "Note also that even when ``__main__`` corresponds with an importable module " "and ``__main__.__spec__`` is set accordingly, they're still considered " @@ -1617,11 +1467,11 @@ msgid "" "populate the ``__main__`` namespace, and not during normal import." msgstr "" -#: ../../reference/import.rst:1052 +#: ../../reference/import.rst:935 msgid "References" msgstr "" -#: ../../reference/import.rst:1054 +#: ../../reference/import.rst:937 msgid "" "The import machinery has evolved considerably since Python's early days. " "The original `specification for packages ` for " "Python 3.3. :pep:`420` also introduced the :meth:`!find_loader` protocol as " "an alternative to :meth:`!find_module`." msgstr "" -#: ../../reference/import.rst:1066 +#: ../../reference/import.rst:949 msgid "" ":pep:`366` describes the addition of the ``__package__`` attribute for " "explicit relative imports in main modules." msgstr "" -#: ../../reference/import.rst:1069 +#: ../../reference/import.rst:952 msgid "" ":pep:`328` introduced absolute and explicit relative imports and initially " "proposed ``__name__`` for semantics :pep:`366` would eventually specify for " "``__package__``." msgstr "" -#: ../../reference/import.rst:1073 +#: ../../reference/import.rst:956 msgid ":pep:`338` defines executing modules as scripts." msgstr "" -#: ../../reference/import.rst:1075 +#: ../../reference/import.rst:958 msgid "" ":pep:`451` adds the encapsulation of per-module import state in spec " "objects. It also off-loads most of the boilerplate responsibilities of " @@ -1668,15 +1518,15 @@ msgid "" "finders and loaders." msgstr "" -#: ../../reference/import.rst:1082 +#: ../../reference/import.rst:965 msgid "Footnotes" msgstr "註解" -#: ../../reference/import.rst:1083 +#: ../../reference/import.rst:966 msgid "See :class:`types.ModuleType`." msgstr "參閱 :class:`types.ModuleType`。" -#: ../../reference/import.rst:1085 +#: ../../reference/import.rst:968 msgid "" "The importlib implementation avoids using the return value directly. " "Instead, it gets the module object by looking the module name up in :data:" @@ -1758,22 +1608,25 @@ msgstr "sys.meta_path" msgid "find_spec" msgstr "find_spec" -#: ../../reference/import.rst:753 +#: ../../reference/import.rst:636 msgid "path based finder" msgstr "path based finder(基於路徑的搜尋器)" -#: ../../reference/import.rst:802 +#: ../../reference/import.rst:685 msgid "sys.path" msgstr "sys.path" -#: ../../reference/import.rst:802 +#: ../../reference/import.rst:685 msgid "sys.path_hooks" msgstr "sys.path_hooks" -#: ../../reference/import.rst:802 +#: ../../reference/import.rst:685 msgid "sys.path_importer_cache" msgstr "sys.path_importer_cache" -#: ../../reference/import.rst:802 +#: ../../reference/import.rst:685 msgid "PYTHONPATH" msgstr "PYTHONPATH" + +#~ msgid "module.__path__" +#~ msgstr "module.__path__" diff --git a/reference/lexical_analysis.po b/reference/lexical_analysis.po index 00ed2f6f6f..fd5a4fbd89 100644 --- a/reference/lexical_analysis.po +++ b/reference/lexical_analysis.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-15 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -366,103 +366,98 @@ msgstr "" #: ../../reference/lexical_analysis.rst:286 msgid "" "Within the ASCII range (U+0001..U+007F), the valid characters for " -"identifiers are the same as in Python 2.x: the uppercase and lowercase " -"letters ``A`` through ``Z``, the underscore ``_`` and, except for the first " -"character, the digits ``0`` through ``9``." -msgstr "" - -#: ../../reference/lexical_analysis.rst:291 -msgid "" -"Python 3.0 introduces additional characters from outside the ASCII range " -"(see :pep:`3131`). For these characters, the classification uses the " -"version of the Unicode Character Database as included in the :mod:" +"identifiers include the uppercase and lowercase letters ``A`` through ``Z``, " +"the underscore ``_`` and, except for the first character, the digits ``0`` " +"through ``9``. Python 3.0 introduced additional characters from outside the " +"ASCII range (see :pep:`3131`). For these characters, the classification " +"uses the version of the Unicode Character Database as included in the :mod:" "`unicodedata` module." msgstr "" -#: ../../reference/lexical_analysis.rst:295 +#: ../../reference/lexical_analysis.rst:294 msgid "Identifiers are unlimited in length. Case is significant." msgstr "" -#: ../../reference/lexical_analysis.rst:304 +#: ../../reference/lexical_analysis.rst:303 msgid "The Unicode category codes mentioned above stand for:" msgstr "" -#: ../../reference/lexical_analysis.rst:306 +#: ../../reference/lexical_analysis.rst:305 msgid "*Lu* - uppercase letters" msgstr "*Lu* - 大寫字母" -#: ../../reference/lexical_analysis.rst:307 +#: ../../reference/lexical_analysis.rst:306 msgid "*Ll* - lowercase letters" msgstr "*Ll* - 小寫字母" -#: ../../reference/lexical_analysis.rst:308 +#: ../../reference/lexical_analysis.rst:307 msgid "*Lt* - titlecase letters" msgstr "" -#: ../../reference/lexical_analysis.rst:309 +#: ../../reference/lexical_analysis.rst:308 msgid "*Lm* - modifier letters" msgstr "" -#: ../../reference/lexical_analysis.rst:310 +#: ../../reference/lexical_analysis.rst:309 msgid "*Lo* - other letters" msgstr "*Lo* - 其他字母" -#: ../../reference/lexical_analysis.rst:311 +#: ../../reference/lexical_analysis.rst:310 msgid "*Nl* - letter numbers" msgstr "" -#: ../../reference/lexical_analysis.rst:312 +#: ../../reference/lexical_analysis.rst:311 msgid "*Mn* - nonspacing marks" msgstr "" -#: ../../reference/lexical_analysis.rst:313 +#: ../../reference/lexical_analysis.rst:312 msgid "*Mc* - spacing combining marks" msgstr "" -#: ../../reference/lexical_analysis.rst:314 +#: ../../reference/lexical_analysis.rst:313 msgid "*Nd* - decimal numbers" msgstr "*Nd* - 十進位數字" -#: ../../reference/lexical_analysis.rst:315 +#: ../../reference/lexical_analysis.rst:314 msgid "*Pc* - connector punctuations" msgstr "" -#: ../../reference/lexical_analysis.rst:316 +#: ../../reference/lexical_analysis.rst:315 msgid "" "*Other_ID_Start* - explicit list of characters in `PropList.txt `_ to support backwards " "compatibility" msgstr "" -#: ../../reference/lexical_analysis.rst:319 +#: ../../reference/lexical_analysis.rst:318 msgid "*Other_ID_Continue* - likewise" msgstr "" -#: ../../reference/lexical_analysis.rst:321 +#: ../../reference/lexical_analysis.rst:320 msgid "" "All identifiers are converted into the normal form NFKC while parsing; " "comparison of identifiers is based on NFKC." msgstr "" -#: ../../reference/lexical_analysis.rst:324 +#: ../../reference/lexical_analysis.rst:323 msgid "" "A non-normative HTML file listing all valid identifier characters for " "Unicode 15.1.0 can be found at https://www.unicode.org/Public/15.1.0/ucd/" "DerivedCoreProperties.txt" msgstr "" -#: ../../reference/lexical_analysis.rst:332 +#: ../../reference/lexical_analysis.rst:331 msgid "Keywords" msgstr "關鍵字" -#: ../../reference/lexical_analysis.rst:338 +#: ../../reference/lexical_analysis.rst:337 msgid "" "The following identifiers are used as reserved words, or *keywords* of the " "language, and cannot be used as ordinary identifiers. They must be spelled " "exactly as written here:" msgstr "" -#: ../../reference/lexical_analysis.rst:342 +#: ../../reference/lexical_analysis.rst:341 msgid "" "False await else import pass\n" "None break except in raise\n" @@ -480,11 +475,11 @@ msgstr "" "assert del global not with\n" "async elif if or yield" -#: ../../reference/lexical_analysis.rst:356 +#: ../../reference/lexical_analysis.rst:355 msgid "Soft Keywords" msgstr "軟關鍵字" -#: ../../reference/lexical_analysis.rst:362 +#: ../../reference/lexical_analysis.rst:361 msgid "" "Some identifiers are only reserved under specific contexts. These are known " "as *soft keywords*. The identifiers ``match``, ``case``, ``type`` and ``_`` " @@ -492,82 +487,82 @@ msgid "" "is done at the parser level, not when tokenizing." msgstr "" -#: ../../reference/lexical_analysis.rst:367 +#: ../../reference/lexical_analysis.rst:366 msgid "" "As soft keywords, their use in the grammar is possible while still " "preserving compatibility with existing code that uses these names as " "identifier names." msgstr "" -#: ../../reference/lexical_analysis.rst:371 +#: ../../reference/lexical_analysis.rst:370 msgid "" "``match``, ``case``, and ``_`` are used in the :keyword:`match` statement. " "``type`` is used in the :keyword:`type` statement." msgstr "" -#: ../../reference/lexical_analysis.rst:374 +#: ../../reference/lexical_analysis.rst:373 msgid "``type`` is now a soft keyword." msgstr "``type`` 現在是軟關鍵字。" -#: ../../reference/lexical_analysis.rst:383 +#: ../../reference/lexical_analysis.rst:382 msgid "Reserved classes of identifiers" msgstr "" -#: ../../reference/lexical_analysis.rst:385 +#: ../../reference/lexical_analysis.rst:384 msgid "" "Certain classes of identifiers (besides keywords) have special meanings. " "These classes are identified by the patterns of leading and trailing " "underscore characters:" msgstr "" -#: ../../reference/lexical_analysis.rst:389 +#: ../../reference/lexical_analysis.rst:388 msgid "``_*``" msgstr "``_*``" -#: ../../reference/lexical_analysis.rst:390 +#: ../../reference/lexical_analysis.rst:389 msgid "Not imported by ``from module import *``." msgstr "" -#: ../../reference/lexical_analysis.rst:392 +#: ../../reference/lexical_analysis.rst:391 msgid "``_``" msgstr "``_``" -#: ../../reference/lexical_analysis.rst:393 +#: ../../reference/lexical_analysis.rst:392 msgid "" "In a ``case`` pattern within a :keyword:`match` statement, ``_`` is a :ref:" "`soft keyword ` that denotes a :ref:`wildcard `." msgstr "" -#: ../../reference/lexical_analysis.rst:397 +#: ../../reference/lexical_analysis.rst:396 msgid "" "Separately, the interactive interpreter makes the result of the last " "evaluation available in the variable ``_``. (It is stored in the :mod:" "`builtins` module, alongside built-in functions like ``print``.)" msgstr "" -#: ../../reference/lexical_analysis.rst:402 +#: ../../reference/lexical_analysis.rst:401 msgid "" "Elsewhere, ``_`` is a regular identifier. It is often used to name " "\"special\" items, but it is not special to Python itself." msgstr "" -#: ../../reference/lexical_analysis.rst:407 +#: ../../reference/lexical_analysis.rst:406 msgid "" "The name ``_`` is often used in conjunction with internationalization; refer " "to the documentation for the :mod:`gettext` module for more information on " "this convention." msgstr "" -#: ../../reference/lexical_analysis.rst:411 +#: ../../reference/lexical_analysis.rst:410 msgid "It is also commonly used for unused variables." msgstr "" -#: ../../reference/lexical_analysis.rst:413 +#: ../../reference/lexical_analysis.rst:412 msgid "``__*__``" msgstr "``__*__``" -#: ../../reference/lexical_analysis.rst:414 +#: ../../reference/lexical_analysis.rst:413 msgid "" "System-defined names, informally known as \"dunder\" names. These names are " "defined by the interpreter and its implementation (including the standard " @@ -577,11 +572,11 @@ msgid "" "explicitly documented use, is subject to breakage without warning." msgstr "" -#: ../../reference/lexical_analysis.rst:421 +#: ../../reference/lexical_analysis.rst:420 msgid "``__*``" msgstr "``__*``" -#: ../../reference/lexical_analysis.rst:422 +#: ../../reference/lexical_analysis.rst:421 msgid "" "Class-private names. Names in this category, when used within the context " "of a class definition, are re-written to use a mangled form to help avoid " @@ -589,23 +584,23 @@ msgid "" "section :ref:`atom-identifiers`." msgstr "" -#: ../../reference/lexical_analysis.rst:431 +#: ../../reference/lexical_analysis.rst:430 msgid "Literals" msgstr "" -#: ../../reference/lexical_analysis.rst:435 +#: ../../reference/lexical_analysis.rst:434 msgid "Literals are notations for constant values of some built-in types." msgstr "" -#: ../../reference/lexical_analysis.rst:446 +#: ../../reference/lexical_analysis.rst:445 msgid "String and Bytes literals" msgstr "" -#: ../../reference/lexical_analysis.rst:448 +#: ../../reference/lexical_analysis.rst:447 msgid "String literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:473 +#: ../../reference/lexical_analysis.rst:472 msgid "" "One syntactic restriction not indicated by these productions is that " "whitespace is not allowed between the :token:`~python-grammar:stringprefix` " @@ -615,7 +610,7 @@ msgid "" "`encodings`." msgstr "" -#: ../../reference/lexical_analysis.rst:483 +#: ../../reference/lexical_analysis.rst:482 msgid "" "In plain English: Both types of literals can be enclosed in matching single " "quotes (``'``) or double quotes (``\"``). They can also be enclosed in " @@ -628,7 +623,7 @@ msgid "" "sequences>` below for examples." msgstr "" -#: ../../reference/lexical_analysis.rst:496 +#: ../../reference/lexical_analysis.rst:495 msgid "" "Bytes literals are always prefixed with ``'b'`` or ``'B'``; they produce an " "instance of the :class:`bytes` type instead of the :class:`str` type. They " @@ -636,7 +631,7 @@ msgid "" "greater must be expressed with escapes." msgstr "" -#: ../../reference/lexical_analysis.rst:505 +#: ../../reference/lexical_analysis.rst:504 msgid "" "Both string and bytes literals may optionally be prefixed with a letter " "``'r'`` or ``'R'``; such constructs are called :dfn:`raw string literals` " @@ -645,20 +640,20 @@ msgid "" "escapes are not treated specially." msgstr "" -#: ../../reference/lexical_analysis.rst:511 +#: ../../reference/lexical_analysis.rst:510 msgid "" "The ``'rb'`` prefix of raw bytes literals has been added as a synonym of " "``'br'``." msgstr "" -#: ../../reference/lexical_analysis.rst:515 +#: ../../reference/lexical_analysis.rst:514 msgid "" "Support for the unicode legacy literal (``u'value'``) was reintroduced to " "simplify the maintenance of dual Python 2.x and 3.x codebases. See :pep:" "`414` for more information." msgstr "" -#: ../../reference/lexical_analysis.rst:523 +#: ../../reference/lexical_analysis.rst:522 msgid "" "A string literal with ``'f'`` or ``'F'`` in its prefix is a :dfn:`formatted " "string literal`; see :ref:`f-strings`. The ``'f'`` may be combined with " @@ -666,7 +661,7 @@ msgid "" "are possible, but formatted bytes literals are not." msgstr "" -#: ../../reference/lexical_analysis.rst:528 +#: ../../reference/lexical_analysis.rst:527 msgid "" "In triple-quoted literals, unescaped newlines and quotes are allowed (and " "are retained), except that three unescaped quotes in a row terminate the " @@ -674,253 +669,253 @@ msgid "" "either ``'`` or ``\"``.)" msgstr "" -#: ../../reference/lexical_analysis.rst:551 +#: ../../reference/lexical_analysis.rst:550 msgid "Escape sequences" msgstr "跳脫序列" -#: ../../reference/lexical_analysis.rst:553 +#: ../../reference/lexical_analysis.rst:552 msgid "" "Unless an ``'r'`` or ``'R'`` prefix is present, escape sequences in string " "and bytes literals are interpreted according to rules similar to those used " "by Standard C. The recognized escape sequences are:" msgstr "" -#: ../../reference/lexical_analysis.rst:558 -#: ../../reference/lexical_analysis.rst:591 +#: ../../reference/lexical_analysis.rst:557 +#: ../../reference/lexical_analysis.rst:590 msgid "Escape Sequence" msgstr "" -#: ../../reference/lexical_analysis.rst:558 -#: ../../reference/lexical_analysis.rst:591 +#: ../../reference/lexical_analysis.rst:557 +#: ../../reference/lexical_analysis.rst:590 msgid "Meaning" msgstr "含義" -#: ../../reference/lexical_analysis.rst:558 -#: ../../reference/lexical_analysis.rst:591 +#: ../../reference/lexical_analysis.rst:557 +#: ../../reference/lexical_analysis.rst:590 msgid "Notes" msgstr "註解" -#: ../../reference/lexical_analysis.rst:560 +#: ../../reference/lexical_analysis.rst:559 msgid "``\\``\\ " msgstr "``\\``\\ " -#: ../../reference/lexical_analysis.rst:560 +#: ../../reference/lexical_analysis.rst:559 msgid "Backslash and newline ignored" msgstr "" -#: ../../reference/lexical_analysis.rst:560 +#: ../../reference/lexical_analysis.rst:559 msgid "\\(1)" msgstr "\\(1)" -#: ../../reference/lexical_analysis.rst:562 +#: ../../reference/lexical_analysis.rst:561 msgid "``\\\\``" msgstr "``\\\\``" -#: ../../reference/lexical_analysis.rst:562 +#: ../../reference/lexical_analysis.rst:561 msgid "Backslash (``\\``)" msgstr "" -#: ../../reference/lexical_analysis.rst:564 +#: ../../reference/lexical_analysis.rst:563 msgid "``\\'``" msgstr "``\\'``" -#: ../../reference/lexical_analysis.rst:564 +#: ../../reference/lexical_analysis.rst:563 msgid "Single quote (``'``)" msgstr "單引號 (``'``)" -#: ../../reference/lexical_analysis.rst:566 +#: ../../reference/lexical_analysis.rst:565 msgid "``\\\"``" msgstr "``\\\"``" -#: ../../reference/lexical_analysis.rst:566 +#: ../../reference/lexical_analysis.rst:565 msgid "Double quote (``\"``)" msgstr "雙引號 (``\"``)" -#: ../../reference/lexical_analysis.rst:568 +#: ../../reference/lexical_analysis.rst:567 msgid "``\\a``" msgstr "``\\a``" -#: ../../reference/lexical_analysis.rst:568 +#: ../../reference/lexical_analysis.rst:567 msgid "ASCII Bell (BEL)" msgstr "" -#: ../../reference/lexical_analysis.rst:570 +#: ../../reference/lexical_analysis.rst:569 msgid "``\\b``" msgstr "``\\b``" -#: ../../reference/lexical_analysis.rst:570 +#: ../../reference/lexical_analysis.rst:569 msgid "ASCII Backspace (BS)" msgstr "" -#: ../../reference/lexical_analysis.rst:572 +#: ../../reference/lexical_analysis.rst:571 msgid "``\\f``" msgstr "``\\f``" -#: ../../reference/lexical_analysis.rst:572 +#: ../../reference/lexical_analysis.rst:571 msgid "ASCII Formfeed (FF)" msgstr "" -#: ../../reference/lexical_analysis.rst:574 +#: ../../reference/lexical_analysis.rst:573 msgid "``\\n``" msgstr "``\\n``" -#: ../../reference/lexical_analysis.rst:574 +#: ../../reference/lexical_analysis.rst:573 msgid "ASCII Linefeed (LF)" msgstr "" -#: ../../reference/lexical_analysis.rst:576 +#: ../../reference/lexical_analysis.rst:575 msgid "``\\r``" msgstr "``\\r``" -#: ../../reference/lexical_analysis.rst:576 +#: ../../reference/lexical_analysis.rst:575 msgid "ASCII Carriage Return (CR)" msgstr "" -#: ../../reference/lexical_analysis.rst:578 +#: ../../reference/lexical_analysis.rst:577 msgid "``\\t``" msgstr "``\\t``" -#: ../../reference/lexical_analysis.rst:578 +#: ../../reference/lexical_analysis.rst:577 msgid "ASCII Horizontal Tab (TAB)" msgstr "" -#: ../../reference/lexical_analysis.rst:580 +#: ../../reference/lexical_analysis.rst:579 msgid "``\\v``" msgstr "``\\v``" -#: ../../reference/lexical_analysis.rst:580 +#: ../../reference/lexical_analysis.rst:579 msgid "ASCII Vertical Tab (VT)" msgstr "" -#: ../../reference/lexical_analysis.rst:582 +#: ../../reference/lexical_analysis.rst:581 msgid ":samp:`\\\\\\\\{ooo}`" msgstr ":samp:`\\\\\\\\{ooo}`" -#: ../../reference/lexical_analysis.rst:582 +#: ../../reference/lexical_analysis.rst:581 msgid "Character with octal value *ooo*" msgstr "" -#: ../../reference/lexical_analysis.rst:582 +#: ../../reference/lexical_analysis.rst:581 msgid "(2,4)" msgstr "(2,4)" -#: ../../reference/lexical_analysis.rst:585 +#: ../../reference/lexical_analysis.rst:584 msgid ":samp:`\\\\x{hh}`" msgstr ":samp:`\\\\x{hh}`" -#: ../../reference/lexical_analysis.rst:585 +#: ../../reference/lexical_analysis.rst:584 msgid "Character with hex value *hh*" msgstr "" -#: ../../reference/lexical_analysis.rst:585 +#: ../../reference/lexical_analysis.rst:584 msgid "(3,4)" msgstr "(3,4)" -#: ../../reference/lexical_analysis.rst:588 +#: ../../reference/lexical_analysis.rst:587 msgid "Escape sequences only recognized in string literals are:" msgstr "" -#: ../../reference/lexical_analysis.rst:593 +#: ../../reference/lexical_analysis.rst:592 msgid ":samp:`\\\\N\\\\{{name}\\\\}`" msgstr ":samp:`\\\\N\\\\{{name}\\\\}`" -#: ../../reference/lexical_analysis.rst:593 +#: ../../reference/lexical_analysis.rst:592 msgid "Character named *name* in the Unicode database" msgstr "" -#: ../../reference/lexical_analysis.rst:593 +#: ../../reference/lexical_analysis.rst:592 msgid "\\(5)" msgstr "\\(5)" -#: ../../reference/lexical_analysis.rst:596 +#: ../../reference/lexical_analysis.rst:595 msgid ":samp:`\\\\u{xxxx}`" msgstr ":samp:`\\\\u{xxxx}`" -#: ../../reference/lexical_analysis.rst:596 +#: ../../reference/lexical_analysis.rst:595 msgid "Character with 16-bit hex value *xxxx*" msgstr "" -#: ../../reference/lexical_analysis.rst:596 +#: ../../reference/lexical_analysis.rst:595 msgid "\\(6)" msgstr "\\(6)" -#: ../../reference/lexical_analysis.rst:599 +#: ../../reference/lexical_analysis.rst:598 msgid ":samp:`\\\\U{xxxxxxxx}`" msgstr ":samp:`\\\\U{xxxxxxxx}`" -#: ../../reference/lexical_analysis.rst:599 +#: ../../reference/lexical_analysis.rst:598 msgid "Character with 32-bit hex value *xxxxxxxx*" msgstr "" -#: ../../reference/lexical_analysis.rst:599 +#: ../../reference/lexical_analysis.rst:598 msgid "\\(7)" msgstr "\\(7)" -#: ../../reference/lexical_analysis.rst:603 +#: ../../reference/lexical_analysis.rst:602 msgid "Notes:" msgstr "註解:" -#: ../../reference/lexical_analysis.rst:606 +#: ../../reference/lexical_analysis.rst:605 msgid "A backslash can be added at the end of a line to ignore the newline::" msgstr "" -#: ../../reference/lexical_analysis.rst:608 +#: ../../reference/lexical_analysis.rst:607 msgid "" ">>> 'This string will not include \\\n" "... backslashes or newline characters.'\n" "'This string will not include backslashes or newline characters.'" msgstr "" -#: ../../reference/lexical_analysis.rst:612 +#: ../../reference/lexical_analysis.rst:611 msgid "" "The same result can be achieved using :ref:`triple-quoted strings " "`, or parentheses and :ref:`string literal concatenation `." msgstr "" -#: ../../reference/lexical_analysis.rst:617 +#: ../../reference/lexical_analysis.rst:616 msgid "As in Standard C, up to three octal digits are accepted." msgstr "" -#: ../../reference/lexical_analysis.rst:619 +#: ../../reference/lexical_analysis.rst:618 msgid "" "Octal escapes with value larger than ``0o377`` produce a :exc:" "`DeprecationWarning`." msgstr "" -#: ../../reference/lexical_analysis.rst:623 +#: ../../reference/lexical_analysis.rst:622 msgid "" "Octal escapes with value larger than ``0o377`` produce a :exc:" "`SyntaxWarning`. In a future Python version they will be eventually a :exc:" "`SyntaxError`." msgstr "" -#: ../../reference/lexical_analysis.rst:629 +#: ../../reference/lexical_analysis.rst:628 msgid "Unlike in Standard C, exactly two hex digits are required." msgstr "" -#: ../../reference/lexical_analysis.rst:632 +#: ../../reference/lexical_analysis.rst:631 msgid "" "In a bytes literal, hexadecimal and octal escapes denote the byte with the " "given value. In a string literal, these escapes denote a Unicode character " "with the given value." msgstr "" -#: ../../reference/lexical_analysis.rst:637 +#: ../../reference/lexical_analysis.rst:636 msgid "Support for name aliases [#]_ has been added." msgstr "" -#: ../../reference/lexical_analysis.rst:641 +#: ../../reference/lexical_analysis.rst:640 msgid "Exactly four hex digits are required." msgstr "" -#: ../../reference/lexical_analysis.rst:644 +#: ../../reference/lexical_analysis.rst:643 msgid "" "Any Unicode character can be encoded this way. Exactly eight hex digits are " "required." msgstr "" -#: ../../reference/lexical_analysis.rst:650 +#: ../../reference/lexical_analysis.rst:649 msgid "" "Unlike Standard C, all unrecognized escape sequences are left in the string " "unchanged, i.e., *the backslash is left in the result*. (This behavior is " @@ -930,17 +925,17 @@ msgid "" "category of unrecognized escapes for bytes literals." msgstr "" -#: ../../reference/lexical_analysis.rst:657 +#: ../../reference/lexical_analysis.rst:656 msgid "Unrecognized escape sequences produce a :exc:`DeprecationWarning`." msgstr "" -#: ../../reference/lexical_analysis.rst:660 +#: ../../reference/lexical_analysis.rst:659 msgid "" "Unrecognized escape sequences produce a :exc:`SyntaxWarning`. In a future " "Python version they will be eventually a :exc:`SyntaxError`." msgstr "" -#: ../../reference/lexical_analysis.rst:664 +#: ../../reference/lexical_analysis.rst:663 msgid "" "Even in a raw literal, quotes can be escaped with a backslash, but the " "backslash remains in the result; for example, ``r\"\\\"\"`` is a valid " @@ -953,11 +948,11 @@ msgid "" "continuation." msgstr "" -#: ../../reference/lexical_analysis.rst:677 +#: ../../reference/lexical_analysis.rst:676 msgid "String literal concatenation" msgstr "" -#: ../../reference/lexical_analysis.rst:679 +#: ../../reference/lexical_analysis.rst:678 msgid "" "Multiple adjacent string or bytes literals (delimited by whitespace), " "possibly using different quoting conventions, are allowed, and their meaning " @@ -967,14 +962,14 @@ msgid "" "lines, or even to add comments to parts of strings, for example::" msgstr "" -#: ../../reference/lexical_analysis.rst:686 +#: ../../reference/lexical_analysis.rst:685 msgid "" "re.compile(\"[A-Za-z_]\" # letter or underscore\n" " \"[A-Za-z0-9_]*\" # letter, digit or underscore\n" " )" msgstr "" -#: ../../reference/lexical_analysis.rst:690 +#: ../../reference/lexical_analysis.rst:689 msgid "" "Note that this feature is defined at the syntactical level, but implemented " "at compile time. The '+' operator must be used to concatenate string " @@ -984,11 +979,11 @@ msgid "" "with plain string literals." msgstr "" -#: ../../reference/lexical_analysis.rst:713 +#: ../../reference/lexical_analysis.rst:712 msgid "f-strings" msgstr "f-string(f 字串)" -#: ../../reference/lexical_analysis.rst:717 +#: ../../reference/lexical_analysis.rst:716 msgid "" "A :dfn:`formatted string literal` or :dfn:`f-string` is a string literal " "that is prefixed with ``'f'`` or ``'F'``. These strings may contain " @@ -997,14 +992,14 @@ msgid "" "are really expressions evaluated at run time." msgstr "" -#: ../../reference/lexical_analysis.rst:723 +#: ../../reference/lexical_analysis.rst:722 msgid "" "Escape sequences are decoded like in ordinary string literals (except when a " "literal is also marked as a raw string). After decoding, the grammar for " "the contents of the string is:" msgstr "" -#: ../../reference/lexical_analysis.rst:737 +#: ../../reference/lexical_analysis.rst:736 msgid "" "The parts of the string outside curly braces are treated literally, except " "that any doubled curly braces ``'{{'`` or ``'}}'`` are replaced with the " @@ -1017,7 +1012,7 @@ msgid "" "replacement field ends with a closing curly bracket ``'}'``." msgstr "" -#: ../../reference/lexical_analysis.rst:747 +#: ../../reference/lexical_analysis.rst:746 msgid "" "Expressions in formatted string literals are treated like regular Python " "expressions surrounded by parentheses, with a few exceptions. An empty " @@ -1031,27 +1026,27 @@ msgid "" "replacement fields must be closed in a different line." msgstr "" -#: ../../reference/lexical_analysis.rst:758 +#: ../../reference/lexical_analysis.rst:757 msgid "" ">>> f\"abc{a # This is a comment }\"\n" "... + 3}\"\n" "'abc5'" msgstr "" -#: ../../reference/lexical_analysis.rst:764 +#: ../../reference/lexical_analysis.rst:763 msgid "" "Prior to Python 3.7, an :keyword:`await` expression and comprehensions " "containing an :keyword:`async for` clause were illegal in the expressions in " "formatted string literals due to a problem with the implementation." msgstr "" -#: ../../reference/lexical_analysis.rst:769 +#: ../../reference/lexical_analysis.rst:768 msgid "" "Prior to Python 3.12, comments were not allowed inside f-string replacement " "fields." msgstr "" -#: ../../reference/lexical_analysis.rst:773 +#: ../../reference/lexical_analysis.rst:772 msgid "" "When the equal sign ``'='`` is provided, the output will have the expression " "text, the ``'='`` and the evaluated value. Spaces after the opening brace " @@ -1062,18 +1057,18 @@ msgid "" "r'`` is declared." msgstr "" -#: ../../reference/lexical_analysis.rst:781 +#: ../../reference/lexical_analysis.rst:780 msgid "The equal sign ``'='``." msgstr "等號 ``'='``。" -#: ../../reference/lexical_analysis.rst:784 +#: ../../reference/lexical_analysis.rst:783 msgid "" "If a conversion is specified, the result of evaluating the expression is " "converted before formatting. Conversion ``'!s'`` calls :func:`str` on the " "result, ``'!r'`` calls :func:`repr`, and ``'!a'`` calls :func:`ascii`." msgstr "" -#: ../../reference/lexical_analysis.rst:788 +#: ../../reference/lexical_analysis.rst:787 msgid "" "The result is then formatted using the :func:`format` protocol. The format " "specifier is passed to the :meth:`~object.__format__` method of the " @@ -1082,7 +1077,7 @@ msgid "" "value of the whole string." msgstr "" -#: ../../reference/lexical_analysis.rst:794 +#: ../../reference/lexical_analysis.rst:793 msgid "" "Top-level format specifiers may include nested replacement fields. These " "nested fields may include their own conversion fields and :ref:`format " @@ -1091,17 +1086,17 @@ msgid "" "as that used by the :meth:`str.format` method." msgstr "" -#: ../../reference/lexical_analysis.rst:800 +#: ../../reference/lexical_analysis.rst:799 msgid "" "Formatted string literals may be concatenated, but replacement fields cannot " "be split across literals." msgstr "" -#: ../../reference/lexical_analysis.rst:803 +#: ../../reference/lexical_analysis.rst:802 msgid "Some examples of formatted string literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:805 +#: ../../reference/lexical_analysis.rst:804 msgid "" ">>> name = \"Fred\"\n" ">>> f\"He said his name is {name!r}.\"\n" @@ -1133,13 +1128,13 @@ msgid "" "'line = \"The mill\\'s closed\" '" msgstr "" -#: ../../reference/lexical_analysis.rst:835 +#: ../../reference/lexical_analysis.rst:834 msgid "" "Reusing the outer f-string quoting type inside a replacement field is " "permitted::" msgstr "" -#: ../../reference/lexical_analysis.rst:838 +#: ../../reference/lexical_analysis.rst:837 msgid "" ">>> a = dict(x=2)\n" ">>> f\"abc {a[\"x\"]} def\"\n" @@ -1149,19 +1144,19 @@ msgstr "" ">>> f\"abc {a[\"x\"]} def\"\n" "'abc 2 def'" -#: ../../reference/lexical_analysis.rst:842 +#: ../../reference/lexical_analysis.rst:841 msgid "" "Prior to Python 3.12, reuse of the same quoting type of the outer f-string " "inside a replacement field was not possible." msgstr "" -#: ../../reference/lexical_analysis.rst:846 +#: ../../reference/lexical_analysis.rst:845 msgid "" "Backslashes are also allowed in replacement fields and are evaluated the " "same way as in any other context::" msgstr "" -#: ../../reference/lexical_analysis.rst:849 +#: ../../reference/lexical_analysis.rst:848 msgid "" ">>> a = [\"a\", \"b\", \"c\"]\n" ">>> print(f\"List a contains:\\n{\"\\n\".join(a)}\")\n" @@ -1177,19 +1172,19 @@ msgstr "" "b\n" "c" -#: ../../reference/lexical_analysis.rst:856 +#: ../../reference/lexical_analysis.rst:855 msgid "" "Prior to Python 3.12, backslashes were not permitted inside an f-string " "replacement field." msgstr "" -#: ../../reference/lexical_analysis.rst:860 +#: ../../reference/lexical_analysis.rst:859 msgid "" "Formatted string literals cannot be used as docstrings, even if they do not " "include expressions." msgstr "" -#: ../../reference/lexical_analysis.rst:865 +#: ../../reference/lexical_analysis.rst:864 msgid "" ">>> def foo():\n" "... f\"Not a docstring\"\n" @@ -1198,63 +1193,63 @@ msgid "" "True" msgstr "" -#: ../../reference/lexical_analysis.rst:871 +#: ../../reference/lexical_analysis.rst:870 msgid "" "See also :pep:`498` for the proposal that added formatted string literals, " "and :meth:`str.format`, which uses a related format string mechanism." msgstr "" -#: ../../reference/lexical_analysis.rst:878 +#: ../../reference/lexical_analysis.rst:877 msgid "Numeric literals" msgstr "" -#: ../../reference/lexical_analysis.rst:884 +#: ../../reference/lexical_analysis.rst:883 msgid "" "There are three types of numeric literals: integers, floating-point numbers, " "and imaginary numbers. There are no complex literals (complex numbers can " "be formed by adding a real number and an imaginary number)." msgstr "" -#: ../../reference/lexical_analysis.rst:888 +#: ../../reference/lexical_analysis.rst:887 msgid "" "Note that numeric literals do not include a sign; a phrase like ``-1`` is " "actually an expression composed of the unary operator '``-``' and the " "literal ``1``." msgstr "" -#: ../../reference/lexical_analysis.rst:902 +#: ../../reference/lexical_analysis.rst:901 msgid "Integer literals" msgstr "" -#: ../../reference/lexical_analysis.rst:904 +#: ../../reference/lexical_analysis.rst:903 msgid "Integer literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:918 +#: ../../reference/lexical_analysis.rst:917 msgid "" "There is no limit for the length of integer literals apart from what can be " "stored in available memory." msgstr "" -#: ../../reference/lexical_analysis.rst:921 +#: ../../reference/lexical_analysis.rst:920 msgid "" "Underscores are ignored for determining the numeric value of the literal. " "They can be used to group digits for enhanced readability. One underscore " "can occur between digits, and after base specifiers like ``0x``." msgstr "" -#: ../../reference/lexical_analysis.rst:925 +#: ../../reference/lexical_analysis.rst:924 msgid "" "Note that leading zeros in a non-zero decimal number are not allowed. This " "is for disambiguation with C-style octal literals, which Python used before " "version 3.0." msgstr "" -#: ../../reference/lexical_analysis.rst:929 +#: ../../reference/lexical_analysis.rst:928 msgid "Some examples of integer literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:931 +#: ../../reference/lexical_analysis.rst:930 msgid "" "7 2147483647 0o177 0b100110111\n" "3 79228162514264337593543950336 0o377 0xdeadbeef\n" @@ -1264,21 +1259,21 @@ msgstr "" "3 79228162514264337593543950336 0o377 0xdeadbeef\n" " 100_000_000_000 0b_1110_0101" -#: ../../reference/lexical_analysis.rst:935 -#: ../../reference/lexical_analysis.rst:967 +#: ../../reference/lexical_analysis.rst:934 +#: ../../reference/lexical_analysis.rst:966 msgid "Underscores are now allowed for grouping purposes in literals." msgstr "" -#: ../../reference/lexical_analysis.rst:946 +#: ../../reference/lexical_analysis.rst:945 msgid "Floating-point literals" msgstr "浮點數常數 (Floating-point literals)" -#: ../../reference/lexical_analysis.rst:948 +#: ../../reference/lexical_analysis.rst:947 msgid "" "Floating-point literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:958 +#: ../../reference/lexical_analysis.rst:957 msgid "" "Note that the integer and exponent parts are always interpreted using radix " "10. For example, ``077e010`` is legal, and denotes the same number as " @@ -1287,23 +1282,23 @@ msgid "" "grouping." msgstr "" -#: ../../reference/lexical_analysis.rst:963 +#: ../../reference/lexical_analysis.rst:962 msgid "Some examples of floating-point literals::" msgstr "一些浮點數常數的範例: ::" -#: ../../reference/lexical_analysis.rst:965 +#: ../../reference/lexical_analysis.rst:964 msgid "3.14 10. .001 1e100 3.14e-10 0e0 3.14_15_93" msgstr "3.14 10. .001 1e100 3.14e-10 0e0 3.14_15_93" -#: ../../reference/lexical_analysis.rst:976 +#: ../../reference/lexical_analysis.rst:975 msgid "Imaginary literals" msgstr "" -#: ../../reference/lexical_analysis.rst:978 +#: ../../reference/lexical_analysis.rst:977 msgid "Imaginary literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:983 +#: ../../reference/lexical_analysis.rst:982 msgid "" "An imaginary literal yields a complex number with a real part of 0.0. " "Complex numbers are represented as a pair of floating-point numbers and have " @@ -1312,19 +1307,19 @@ msgid "" "Some examples of imaginary literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:989 +#: ../../reference/lexical_analysis.rst:988 msgid "3.14j 10.j 10j .001j 1e100j 3.14e-10j 3.14_15_93j" msgstr "3.14j 10.j 10j .001j 1e100j 3.14e-10j 3.14_15_93j" -#: ../../reference/lexical_analysis.rst:995 +#: ../../reference/lexical_analysis.rst:994 msgid "Operators" msgstr "" -#: ../../reference/lexical_analysis.rst:999 +#: ../../reference/lexical_analysis.rst:998 msgid "The following tokens are operators:" msgstr "" -#: ../../reference/lexical_analysis.rst:1001 +#: ../../reference/lexical_analysis.rst:1000 msgid "" "+ - * ** / // % @\n" "<< >> & | ^ ~ :=\n" @@ -1334,15 +1329,15 @@ msgstr "" "<< >> & | ^ ~ :=\n" "< > <= >= == !=" -#: ../../reference/lexical_analysis.rst:1012 +#: ../../reference/lexical_analysis.rst:1011 msgid "Delimiters" msgstr "" -#: ../../reference/lexical_analysis.rst:1016 +#: ../../reference/lexical_analysis.rst:1015 msgid "The following tokens serve as delimiters in the grammar:" msgstr "" -#: ../../reference/lexical_analysis.rst:1018 +#: ../../reference/lexical_analysis.rst:1017 msgid "" "( ) [ ] { }\n" ", : ! . ; @ =\n" @@ -1354,7 +1349,7 @@ msgstr "" "-> += -= *= /= //= %=\n" "@= &= |= ^= >>= <<= **=" -#: ../../reference/lexical_analysis.rst:1025 +#: ../../reference/lexical_analysis.rst:1024 msgid "" "The period can also occur in floating-point and imaginary literals. A " "sequence of three periods has a special meaning as an ellipsis literal. The " @@ -1362,34 +1357,33 @@ msgid "" "as delimiters, but also perform an operation." msgstr "" -#: ../../reference/lexical_analysis.rst:1030 +#: ../../reference/lexical_analysis.rst:1029 msgid "" "The following printing ASCII characters have special meaning as part of " "other tokens or are otherwise significant to the lexical analyzer:" msgstr "" -#: ../../reference/lexical_analysis.rst:1033 +#: ../../reference/lexical_analysis.rst:1032 msgid "' \" # \\" msgstr "' \" # \\" -#: ../../reference/lexical_analysis.rst:1037 +#: ../../reference/lexical_analysis.rst:1036 msgid "" "The following printing ASCII characters are not used in Python. Their " "occurrence outside string literals and comments is an unconditional error:" msgstr "" -#: ../../reference/lexical_analysis.rst:1040 +#: ../../reference/lexical_analysis.rst:1039 msgid "$ ? `" msgstr "$ ? `" -#: ../../reference/lexical_analysis.rst:1046 +#: ../../reference/lexical_analysis.rst:1045 msgid "Footnotes" msgstr "註解" -#: ../../reference/lexical_analysis.rst:1047 -#, fuzzy +#: ../../reference/lexical_analysis.rst:1046 msgid "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" -msgstr "https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt" +msgstr "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" #: ../../reference/lexical_analysis.rst:8 msgid "lexical analysis" @@ -1413,7 +1407,7 @@ msgstr "logical line(邏輯列)" #: ../../reference/lexical_analysis.rst:35 #: ../../reference/lexical_analysis.rst:114 -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "physical line" msgstr "physical line(物理列)" @@ -1503,315 +1497,315 @@ msgstr "identifier(識別器)" msgid "name" msgstr "name(名稱)" -#: ../../reference/lexical_analysis.rst:334 -#: ../../reference/lexical_analysis.rst:358 +#: ../../reference/lexical_analysis.rst:333 +#: ../../reference/lexical_analysis.rst:357 msgid "keyword" msgstr "keyword(關鍵字)" -#: ../../reference/lexical_analysis.rst:334 +#: ../../reference/lexical_analysis.rst:333 msgid "reserved word" msgstr "reserved word(保留字)" -#: ../../reference/lexical_analysis.rst:358 +#: ../../reference/lexical_analysis.rst:357 msgid "soft keyword" msgstr "soft keyword(軟關鍵字)" -#: ../../reference/lexical_analysis.rst:377 +#: ../../reference/lexical_analysis.rst:376 msgid "_, identifiers" msgstr "_, identifiers(識別器)" -#: ../../reference/lexical_analysis.rst:377 +#: ../../reference/lexical_analysis.rst:376 msgid "__, identifiers" msgstr "__, identifiers(識別器)" -#: ../../reference/lexical_analysis.rst:433 +#: ../../reference/lexical_analysis.rst:432 msgid "literal" msgstr "literal(常數)" -#: ../../reference/lexical_analysis.rst:433 +#: ../../reference/lexical_analysis.rst:432 msgid "constant" msgstr "constant(常數)" -#: ../../reference/lexical_analysis.rst:438 -#: ../../reference/lexical_analysis.rst:479 +#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:478 msgid "string literal" msgstr "string literal(字串常數)" -#: ../../reference/lexical_analysis.rst:438 -#: ../../reference/lexical_analysis.rst:492 +#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:491 msgid "bytes literal" msgstr "bytes literal(位元組常數)" -#: ../../reference/lexical_analysis.rst:438 +#: ../../reference/lexical_analysis.rst:437 msgid "ASCII" msgstr "ASCII" -#: ../../reference/lexical_analysis.rst:438 +#: ../../reference/lexical_analysis.rst:437 msgid "' (single quote)" msgstr "' (單引號)" -#: ../../reference/lexical_analysis.rst:438 +#: ../../reference/lexical_analysis.rst:437 msgid "\" (double quote)" msgstr "\" (雙引號)" -#: ../../reference/lexical_analysis.rst:438 +#: ../../reference/lexical_analysis.rst:437 msgid "u'" msgstr "u'" -#: ../../reference/lexical_analysis.rst:438 +#: ../../reference/lexical_analysis.rst:437 msgid "u\"" msgstr "u\"" -#: ../../reference/lexical_analysis.rst:479 +#: ../../reference/lexical_analysis.rst:478 msgid "triple-quoted string" msgstr "triple-quoted string(三引號字串)" -#: ../../reference/lexical_analysis.rst:479 +#: ../../reference/lexical_analysis.rst:478 msgid "Unicode Consortium" msgstr "Unicode Consortium" -#: ../../reference/lexical_analysis.rst:479 +#: ../../reference/lexical_analysis.rst:478 msgid "raw string" msgstr "raw string(原始字串)" -#: ../../reference/lexical_analysis.rst:479 +#: ../../reference/lexical_analysis.rst:478 msgid "\"\"\"" msgstr "\"\"\"" -#: ../../reference/lexical_analysis.rst:479 +#: ../../reference/lexical_analysis.rst:478 msgid "'''" msgstr "'''" -#: ../../reference/lexical_analysis.rst:492 +#: ../../reference/lexical_analysis.rst:491 msgid "b'" msgstr "b'" -#: ../../reference/lexical_analysis.rst:492 +#: ../../reference/lexical_analysis.rst:491 msgid "b\"" msgstr "b\"" -#: ../../reference/lexical_analysis.rst:501 +#: ../../reference/lexical_analysis.rst:500 msgid "r'" msgstr "r'" -#: ../../reference/lexical_analysis.rst:501 +#: ../../reference/lexical_analysis.rst:500 msgid "raw string literal" msgstr "raw string literal(原始字串常數)" -#: ../../reference/lexical_analysis.rst:501 +#: ../../reference/lexical_analysis.rst:500 msgid "r\"" msgstr "r\"" -#: ../../reference/lexical_analysis.rst:519 +#: ../../reference/lexical_analysis.rst:518 msgid "f'" msgstr "f'" -#: ../../reference/lexical_analysis.rst:519 -#: ../../reference/lexical_analysis.rst:697 +#: ../../reference/lexical_analysis.rst:518 +#: ../../reference/lexical_analysis.rst:696 msgid "formatted string literal" msgstr "formatted string literal(格式化字串常數)" -#: ../../reference/lexical_analysis.rst:519 +#: ../../reference/lexical_analysis.rst:518 msgid "f\"" msgstr "f\"" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "escape sequence" msgstr "escape sequence(跳脫序列)" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "Standard C" msgstr "Standard C(標準 C)" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "C" msgstr "C" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "\\ (backslash)" msgstr "\\ (反斜線)" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "\\\\" msgstr "\\\\" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "\\a" msgstr "\\a" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "\\b" msgstr "\\b" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "\\f" msgstr "\\f" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "\\n" msgstr "\\n" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "\\r" msgstr "\\r" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "\\t" msgstr "\\t" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "\\v" msgstr "\\v" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "\\x" msgstr "\\x" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "\\N" msgstr "\\N" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "\\u" msgstr "\\u" -#: ../../reference/lexical_analysis.rst:532 +#: ../../reference/lexical_analysis.rst:531 msgid "\\U" msgstr "\\U" -#: ../../reference/lexical_analysis.rst:648 +#: ../../reference/lexical_analysis.rst:647 msgid "unrecognized escape sequence" msgstr "unrecognized escape sequence(無法辨識的跳脫序列)" -#: ../../reference/lexical_analysis.rst:697 +#: ../../reference/lexical_analysis.rst:696 msgid "interpolated string literal" msgstr "interpolated string literal(插值字串常數)" -#: ../../reference/lexical_analysis.rst:697 +#: ../../reference/lexical_analysis.rst:696 msgid "string" msgstr "string(字串)" -#: ../../reference/lexical_analysis.rst:697 +#: ../../reference/lexical_analysis.rst:696 msgid "formatted literal" msgstr "formatted literal(格式化常數)" -#: ../../reference/lexical_analysis.rst:697 +#: ../../reference/lexical_analysis.rst:696 msgid "interpolated literal" msgstr "interpolated literal(插值常數)" -#: ../../reference/lexical_analysis.rst:697 +#: ../../reference/lexical_analysis.rst:696 msgid "f-string" msgstr "f-string(f 字串)" -#: ../../reference/lexical_analysis.rst:697 +#: ../../reference/lexical_analysis.rst:696 msgid "fstring" msgstr "fstring(f 字串)" -#: ../../reference/lexical_analysis.rst:697 +#: ../../reference/lexical_analysis.rst:696 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../reference/lexical_analysis.rst:697 +#: ../../reference/lexical_analysis.rst:696 msgid "in formatted string literal" msgstr "於格式化字串常數中" -#: ../../reference/lexical_analysis.rst:697 +#: ../../reference/lexical_analysis.rst:696 msgid "! (exclamation)" msgstr "! (驚嘆號)" -#: ../../reference/lexical_analysis.rst:697 +#: ../../reference/lexical_analysis.rst:696 msgid ": (colon)" msgstr ": (冒號)" -#: ../../reference/lexical_analysis.rst:697 +#: ../../reference/lexical_analysis.rst:696 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/lexical_analysis.rst:697 +#: ../../reference/lexical_analysis.rst:696 msgid "for help in debugging using string literals" msgstr "for help in debugging using string literals(使用字串常數進行除錯)" -#: ../../reference/lexical_analysis.rst:880 +#: ../../reference/lexical_analysis.rst:879 msgid "number" msgstr "number(數字)" -#: ../../reference/lexical_analysis.rst:880 +#: ../../reference/lexical_analysis.rst:879 msgid "numeric literal" msgstr "numeric literal(數值常數)" -#: ../../reference/lexical_analysis.rst:880 -#: ../../reference/lexical_analysis.rst:893 +#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:892 msgid "integer literal" msgstr "integer literal(整數常數)" -#: ../../reference/lexical_analysis.rst:880 +#: ../../reference/lexical_analysis.rst:879 msgid "floating-point literal" msgstr "floating-point literal(浮點數常數)" -#: ../../reference/lexical_analysis.rst:880 +#: ../../reference/lexical_analysis.rst:879 msgid "hexadecimal literal" msgstr "hexadecimal literal(十六進位常數)" -#: ../../reference/lexical_analysis.rst:880 +#: ../../reference/lexical_analysis.rst:879 msgid "octal literal" msgstr "octal literal(八進位常數)" -#: ../../reference/lexical_analysis.rst:880 +#: ../../reference/lexical_analysis.rst:879 msgid "binary literal" msgstr "binary literal(二進位常數)" -#: ../../reference/lexical_analysis.rst:880 +#: ../../reference/lexical_analysis.rst:879 msgid "decimal literal" msgstr "decimal literal(十進位常數)" -#: ../../reference/lexical_analysis.rst:880 +#: ../../reference/lexical_analysis.rst:879 msgid "imaginary literal" msgstr "imaginary literal(虛數常數)" -#: ../../reference/lexical_analysis.rst:880 +#: ../../reference/lexical_analysis.rst:879 msgid "complex literal" msgstr "complex literal(複數常數)" -#: ../../reference/lexical_analysis.rst:893 +#: ../../reference/lexical_analysis.rst:892 msgid "0b" msgstr "0b" -#: ../../reference/lexical_analysis.rst:893 +#: ../../reference/lexical_analysis.rst:892 msgid "0o" msgstr "0o" -#: ../../reference/lexical_analysis.rst:893 +#: ../../reference/lexical_analysis.rst:892 msgid "0x" msgstr "0x" -#: ../../reference/lexical_analysis.rst:893 -#: ../../reference/lexical_analysis.rst:939 +#: ../../reference/lexical_analysis.rst:892 +#: ../../reference/lexical_analysis.rst:938 msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../reference/lexical_analysis.rst:893 -#: ../../reference/lexical_analysis.rst:939 -#: ../../reference/lexical_analysis.rst:971 +#: ../../reference/lexical_analysis.rst:892 +#: ../../reference/lexical_analysis.rst:938 +#: ../../reference/lexical_analysis.rst:970 msgid "in numeric literal" msgstr "於數值常數中" -#: ../../reference/lexical_analysis.rst:939 +#: ../../reference/lexical_analysis.rst:938 msgid ". (dot)" msgstr ". (點)" -#: ../../reference/lexical_analysis.rst:939 +#: ../../reference/lexical_analysis.rst:938 msgid "e" msgstr "e" -#: ../../reference/lexical_analysis.rst:971 +#: ../../reference/lexical_analysis.rst:970 msgid "j" msgstr "j" -#: ../../reference/lexical_analysis.rst:997 +#: ../../reference/lexical_analysis.rst:996 msgid "operators" msgstr "operators(運算子)" -#: ../../reference/lexical_analysis.rst:1014 +#: ../../reference/lexical_analysis.rst:1013 msgid "delimiters" msgstr "delimiters(分隔符號)" diff --git a/tutorial/appendix.po b/tutorial/appendix.po index 703dc079b8..e96743c902 100644 --- a/tutorial/appendix.po +++ b/tutorial/appendix.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-17 00:13+0000\n" "PO-Revision-Date: 2021-07-05 14:35+0800\n" "Last-Translator: meowmeowcat \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,8 +42,8 @@ msgid "" "editing, history browsing, and paste mode. To disable color, see :ref:" "`using-on-controlling-color` for details. Function keys provide some " "additional functionality. :kbd:`F1` enters the interactive help browser :mod:" -"`pydoc`. :kbd:`F2` allows for browsing command-line history without output " -"nor the :term:`>>>` and :term:`...` prompts. :kbd:`F3` enters \"paste " +"`pydoc`. :kbd:`F2` allows for browsing command-line history with neither " +"output nor the :term:`>>>` and :term:`...` prompts. :kbd:`F3` enters \"paste " "mode\", which makes pasting larger blocks of code easier. Press :kbd:`F3` to " "return to the regular prompt." msgstr "" diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index c0a2f46f22..13344d6ba7 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-28 00:13+0000\n" +"POT-Creation-Date: 2024-10-14 00:14+0000\n" "PO-Revision-Date: 2022-07-24 14:52+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -901,8 +901,8 @@ msgstr "我們可以建立一個函式來產生費式數列到任何一個上界 #: ../../tutorial/controlflow.rst:464 msgid "" -">>> def fib(n): # write Fibonacci series up to n\n" -"... \"\"\"Print a Fibonacci series up to n.\"\"\"\n" +">>> def fib(n): # write Fibonacci series less than n\n" +"... \"\"\"Print a Fibonacci series less than n.\"\"\"\n" "... a, b = 0, 1\n" "... while a < n:\n" "... print(a, end=' ')\n" @@ -1618,10 +1618,10 @@ msgstr "" #: ../../tutorial/controlflow.rst:835 msgid "" -"The third function ``kwd_only_args`` only allows keyword arguments as " +"The third function ``kwd_only_arg`` only allows keyword arguments as " "indicated by a ``*`` in the function definition::" msgstr "" -"第三個函式 ``kwd_only_args`` 的函式定義透過 ``*`` 表明僅限關鍵字引數: ::" +"第三個函式 ``kwd_only_arg`` 的函式定義透過 ``*`` 表明僅限關鍵字引數: ::" #: ../../tutorial/controlflow.rst:838 msgid "" diff --git a/tutorial/introduction.po b/tutorial/introduction.po index 436e18af6b..4db1924d3e 100644 --- a/tutorial/introduction.po +++ b/tutorial/introduction.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-10-08 03:35+0000\n" "PO-Revision-Date: 2022-10-16 03:20+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -359,49 +359,42 @@ msgid "" "String literals can span multiple lines. One way is using triple-quotes: " "``\"\"\"...\"\"\"`` or ``'''...'''``. End of lines are automatically " "included in the string, but it's possible to prevent this by adding a ``\\`` " -"at the end of the line. The following example::" +"at the end of the line. In the following example, the initial newline is " +"not included::" msgstr "" "字串文本可以跨越數行。其中一方式是使用三個重覆引號:``\"\"\"...\"\"\"`` 或 " "``'''...'''``。此時換行會被自動加入字串值中,但也可以在換行前加入 ``\\`` 來取" -"消這個行為。在以下的例子中: ::" +"消這個行為。在以下的例子中,最初的換行符不會被包含: ::" -#: ../../tutorial/introduction.rst:202 +#: ../../tutorial/introduction.rst:203 msgid "" -"print(\"\"\"\\\n" +">>> print(\"\"\"\\\n" +"... Usage: thingy [OPTIONS]\n" +"... -h Display this usage message\n" +"... -H hostname Hostname to connect to\n" +"... \"\"\")\n" "Usage: thingy [OPTIONS]\n" " -h Display this usage message\n" " -H hostname Hostname to connect to\n" -"\"\"\")" +"\n" +">>>" msgstr "" -#: ../../tutorial/introduction.rst:208 -msgid "" -"produces the following output (note that the initial newline is not " -"included):" -msgstr "會產生以下的輸出(注意第一個換行並沒有被包含進字串值中):" - -#: ../../tutorial/introduction.rst:210 -msgid "" -"Usage: thingy [OPTIONS]\n" -" -h Display this usage message\n" -" -H hostname Hostname to connect to" -msgstr "" - -#: ../../tutorial/introduction.rst:216 +#: ../../tutorial/introduction.rst:214 msgid "" "Strings can be concatenated (glued together) with the ``+`` operator, and " "repeated with ``*``::" msgstr "" "字串可以使用 ``+`` 運算子連接 (concatenate),並用 ``*`` 重覆該字串的內容: ::" -#: ../../tutorial/introduction.rst:219 +#: ../../tutorial/introduction.rst:217 msgid "" ">>> # 3 times 'un', followed by 'ium'\n" ">>> 3 * 'un' + 'ium'\n" "'unununium'" msgstr "" -#: ../../tutorial/introduction.rst:223 +#: ../../tutorial/introduction.rst:221 msgid "" "Two or more *string literals* (i.e. the ones enclosed between quotes) next " "to each other are automatically concatenated. ::" @@ -409,7 +402,7 @@ msgstr "" "兩個以上相鄰的字串文本(*string literal*,即被引號包圍的字串)會被自動連接起" "來: ::" -#: ../../tutorial/introduction.rst:226 +#: ../../tutorial/introduction.rst:224 msgid "" ">>> 'Py' 'thon'\n" "'Python'" @@ -417,13 +410,13 @@ msgstr "" ">>> 'Py' 'thon'\n" "'Python'" -#: ../../tutorial/introduction.rst:229 +#: ../../tutorial/introduction.rst:227 msgid "" "This feature is particularly useful when you want to break long strings::" msgstr "" "當你想要分段一個非常長的字串時,兩相鄰字串值自動連接的特性十分有用: ::" -#: ../../tutorial/introduction.rst:231 +#: ../../tutorial/introduction.rst:229 msgid "" ">>> text = ('Put several strings within parentheses '\n" "... 'to have them joined together.')\n" @@ -431,12 +424,12 @@ msgid "" "'Put several strings within parentheses to have them joined together.'" msgstr "" -#: ../../tutorial/introduction.rst:236 +#: ../../tutorial/introduction.rst:234 msgid "" "This only works with two literals though, not with variables or expressions::" msgstr "但這特性只限於兩相鄰的字串值間,而非兩相鄰變數或表達式: ::" -#: ../../tutorial/introduction.rst:238 +#: ../../tutorial/introduction.rst:236 msgid "" ">>> prefix = 'Py'\n" ">>> prefix 'thon' # can't concatenate a variable and a string literal\n" @@ -451,12 +444,12 @@ msgid "" "SyntaxError: invalid syntax" msgstr "" -#: ../../tutorial/introduction.rst:250 +#: ../../tutorial/introduction.rst:248 msgid "" "If you want to concatenate variables or a variable and a literal, use ``+``::" msgstr "如果要連接變數們或一個變數與一個字串值,使用 ``+``: ::" -#: ../../tutorial/introduction.rst:252 +#: ../../tutorial/introduction.rst:250 msgid "" ">>> prefix + 'thon'\n" "'Python'" @@ -464,7 +457,7 @@ msgstr "" ">>> prefix + 'thon'\n" "'Python'" -#: ../../tutorial/introduction.rst:255 +#: ../../tutorial/introduction.rst:253 msgid "" "Strings can be *indexed* (subscripted), with the first character having " "index 0. There is no separate character type; a character is simply a string " @@ -473,7 +466,7 @@ msgstr "" "字串可以被「索引 *indexed*」(下標,即 subscripted),第一個字元的索引值為 0。" "沒有獨立表示字元的型別;一個字元就是一個大小為 1 的字串: ::" -#: ../../tutorial/introduction.rst:259 +#: ../../tutorial/introduction.rst:257 msgid "" ">>> word = 'Python'\n" ">>> word[0] # character in position 0\n" @@ -482,12 +475,12 @@ msgid "" "'n'" msgstr "" -#: ../../tutorial/introduction.rst:265 +#: ../../tutorial/introduction.rst:263 msgid "" "Indices may also be negative numbers, to start counting from the right::" msgstr "索引值可以是負的,此時改成從右開始計數: ::" -#: ../../tutorial/introduction.rst:267 +#: ../../tutorial/introduction.rst:265 msgid "" ">>> word[-1] # last character\n" "'n'\n" @@ -497,11 +490,11 @@ msgid "" "'P'" msgstr "" -#: ../../tutorial/introduction.rst:274 +#: ../../tutorial/introduction.rst:272 msgid "Note that since -0 is the same as 0, negative indices start from -1." msgstr "注意到因為 -0 等同於 0,負的索引值由 -1 開始。" -#: ../../tutorial/introduction.rst:276 +#: ../../tutorial/introduction.rst:274 msgid "" "In addition to indexing, *slicing* is also supported. While indexing is " "used to obtain individual characters, *slicing* allows you to obtain a " @@ -510,7 +503,7 @@ msgstr "" "除了索引外,字串亦支援「切片 *slicing*」。索引用來拿到單獨的字元,而切片則可" "以讓你拿到一個子字串 (substring): ::" -#: ../../tutorial/introduction.rst:279 +#: ../../tutorial/introduction.rst:277 msgid "" ">>> word[0:2] # characters from position 0 (included) to 2 (excluded)\n" "'Py'\n" @@ -518,7 +511,7 @@ msgid "" "'tho'" msgstr "" -#: ../../tutorial/introduction.rst:284 +#: ../../tutorial/introduction.rst:282 msgid "" "Slice indices have useful defaults; an omitted first index defaults to zero, " "an omitted second index defaults to the size of the string being sliced. ::" @@ -526,7 +519,7 @@ msgstr "" "切片索引 (slice indices) 有很常用的預設值,省略起點索引值時預設為 0,而省略第" "二個索引值時預設整個字串被包含在 slice 中: ::" -#: ../../tutorial/introduction.rst:287 +#: ../../tutorial/introduction.rst:285 msgid "" ">>> word[:2] # character from the beginning to position 2 (excluded)\n" "'Py'\n" @@ -536,7 +529,7 @@ msgid "" "'on'" msgstr "" -#: ../../tutorial/introduction.rst:294 +#: ../../tutorial/introduction.rst:292 msgid "" "Note how the start is always included, and the end always excluded. This " "makes sure that ``s[:i] + s[i:]`` is always equal to ``s``::" @@ -544,7 +537,7 @@ msgstr "" "注意到起點永遠被包含,而結尾永遠不被包含。這確保了 ``s[:i] + s[i:]`` 永遠等" "於 ``s``: ::" -#: ../../tutorial/introduction.rst:297 +#: ../../tutorial/introduction.rst:295 msgid "" ">>> word[:2] + word[2:]\n" "'Python'\n" @@ -556,7 +549,7 @@ msgstr "" ">>> word[:4] + word[4:]\n" "'Python'" -#: ../../tutorial/introduction.rst:302 +#: ../../tutorial/introduction.rst:300 msgid "" "One way to remember how slices work is to think of the indices as pointing " "*between* characters, with the left edge of the first character numbered 0. " @@ -567,7 +560,7 @@ msgstr "" "其中第一個字元的左側邊緣由 0 計數。則 *n* 個字元的字串中最後一個字元的右側邊" "緣會有索引值 *n*,例如: ::" -#: ../../tutorial/introduction.rst:307 +#: ../../tutorial/introduction.rst:305 msgid "" " +---+---+---+---+---+---+\n" " | P | y | t | h | o | n |\n" @@ -581,7 +574,7 @@ msgstr "" " 0 1 2 3 4 5 6\n" "-6 -5 -4 -3 -2 -1" -#: ../../tutorial/introduction.rst:313 +#: ../../tutorial/introduction.rst:311 msgid "" "The first row of numbers gives the position of the indices 0...6 in the " "string; the second row gives the corresponding negative indices. The slice " @@ -591,7 +584,7 @@ msgstr "" "第一行數字給定字串索引值為 0...6 的位置;第二行則標示了負索引值的位置。由 " "*i* 至 *j* 的 slice 包含了標示 *i* 和 *j* 邊緣間的所有字元。" -#: ../../tutorial/introduction.rst:318 +#: ../../tutorial/introduction.rst:316 msgid "" "For non-negative indices, the length of a slice is the difference of the " "indices, if both are within bounds. For example, the length of " @@ -600,11 +593,11 @@ msgstr "" "對非負數的索引值而言,一個 slice 的長度等於其索引值之差,如果索引值落在字串邊" "界內。例如,``word[1:3]`` 的長度是 2。" -#: ../../tutorial/introduction.rst:322 +#: ../../tutorial/introduction.rst:320 msgid "Attempting to use an index that is too large will result in an error::" msgstr "嘗試使用一個過大的索引值會造成錯誤: ::" -#: ../../tutorial/introduction.rst:324 +#: ../../tutorial/introduction.rst:322 msgid "" ">>> word[42] # the word only has 6 characters\n" "Traceback (most recent call last):\n" @@ -612,13 +605,13 @@ msgid "" "IndexError: string index out of range" msgstr "" -#: ../../tutorial/introduction.rst:329 +#: ../../tutorial/introduction.rst:327 msgid "" "However, out of range slice indexes are handled gracefully when used for " "slicing::" msgstr "然而,超出範圍的索引值在 slice 中會被妥善的處理: ::" -#: ../../tutorial/introduction.rst:332 +#: ../../tutorial/introduction.rst:330 msgid "" ">>> word[4:42]\n" "'on'\n" @@ -630,7 +623,7 @@ msgstr "" ">>> word[42:]\n" "''" -#: ../../tutorial/introduction.rst:337 +#: ../../tutorial/introduction.rst:335 msgid "" "Python strings cannot be changed --- they are :term:`immutable`. Therefore, " "assigning to an indexed position in the string results in an error::" @@ -638,7 +631,7 @@ msgstr "" "Python 字串無法被改變 --- 它們是 :term:`immutable`。因此,嘗試對字串中某個索" "引位置賦值會產生錯誤: ::" -#: ../../tutorial/introduction.rst:340 +#: ../../tutorial/introduction.rst:338 msgid "" ">>> word[0] = 'J'\n" "Traceback (most recent call last):\n" @@ -650,11 +643,11 @@ msgid "" "TypeError: 'str' object does not support item assignment" msgstr "" -#: ../../tutorial/introduction.rst:349 +#: ../../tutorial/introduction.rst:347 msgid "If you need a different string, you should create a new one::" msgstr "如果你需要一個不一樣的字串,你必須建立一個新的: ::" -#: ../../tutorial/introduction.rst:351 +#: ../../tutorial/introduction.rst:349 msgid "" ">>> 'J' + word[1:]\n" "'Jython'\n" @@ -666,11 +659,11 @@ msgstr "" ">>> word[:2] + 'py'\n" "'Pypy'" -#: ../../tutorial/introduction.rst:356 +#: ../../tutorial/introduction.rst:354 msgid "The built-in function :func:`len` returns the length of a string::" msgstr "內建的函式 :func:`len` 回傳一個字串的長度: ::" -#: ../../tutorial/introduction.rst:358 +#: ../../tutorial/introduction.rst:356 msgid "" ">>> s = 'supercalifragilisticexpialidocious'\n" ">>> len(s)\n" @@ -680,47 +673,47 @@ msgstr "" ">>> len(s)\n" "34" -#: ../../tutorial/introduction.rst:365 +#: ../../tutorial/introduction.rst:363 msgid ":ref:`textseq`" msgstr ":ref:`textseq`" -#: ../../tutorial/introduction.rst:366 +#: ../../tutorial/introduction.rst:364 msgid "" "Strings are examples of *sequence types*, and support the common operations " "supported by such types." msgstr "字串是 *sequence 型別*\\ 的範例之一,並支援該型別常用的操作。" -#: ../../tutorial/introduction.rst:369 +#: ../../tutorial/introduction.rst:367 msgid ":ref:`string-methods`" msgstr ":ref:`string-methods`" -#: ../../tutorial/introduction.rst:370 +#: ../../tutorial/introduction.rst:368 msgid "" "Strings support a large number of methods for basic transformations and " "searching." msgstr "字串支援非常多種基本轉換和搜尋的 method(方法)。" -#: ../../tutorial/introduction.rst:373 +#: ../../tutorial/introduction.rst:371 msgid ":ref:`f-strings`" msgstr ":ref:`f-strings`" -#: ../../tutorial/introduction.rst:374 +#: ../../tutorial/introduction.rst:372 msgid "String literals that have embedded expressions." msgstr "包含有運算式的字串文本。" -#: ../../tutorial/introduction.rst:376 +#: ../../tutorial/introduction.rst:374 msgid ":ref:`formatstrings`" msgstr ":ref:`formatstrings`" -#: ../../tutorial/introduction.rst:377 +#: ../../tutorial/introduction.rst:375 msgid "Information about string formatting with :meth:`str.format`." msgstr "關於透過 :meth:`str.format` 字串格式化 (string formatting) 的資訊。" -#: ../../tutorial/introduction.rst:379 +#: ../../tutorial/introduction.rst:377 msgid ":ref:`old-string-formatting`" msgstr ":ref:`old-string-formatting`" -#: ../../tutorial/introduction.rst:380 +#: ../../tutorial/introduction.rst:378 msgid "" "The old formatting operations invoked when strings are the left operand of " "the ``%`` operator are described in more detail here." @@ -728,11 +721,11 @@ msgstr "" "在字串為 ``%`` 運算子的左運算元時,將觸發舊的字串格式化操作,更多的細節在本連" "結中介紹。" -#: ../../tutorial/introduction.rst:387 +#: ../../tutorial/introduction.rst:385 msgid "Lists" msgstr "List(串列)" -#: ../../tutorial/introduction.rst:389 +#: ../../tutorial/introduction.rst:387 msgid "" "Python knows a number of *compound* data types, used to group together other " "values. The most versatile is the *list*, which can be written as a list of " @@ -743,7 +736,7 @@ msgstr "" "*list*,可以寫成一系列以逗號分隔的數值(稱之元素,即 item),包含在方括號之" "中。List 可以包合不同型別的元素,但通常這些元素會有相同的型別: ::" -#: ../../tutorial/introduction.rst:394 +#: ../../tutorial/introduction.rst:392 msgid "" ">>> squares = [1, 4, 9, 16, 25]\n" ">>> squares\n" @@ -753,7 +746,7 @@ msgstr "" ">>> squares\n" "[1, 4, 9, 16, 25]" -#: ../../tutorial/introduction.rst:398 +#: ../../tutorial/introduction.rst:396 msgid "" "Like strings (and all other built-in :term:`sequence` types), lists can be " "indexed and sliced::" @@ -761,7 +754,7 @@ msgstr "" "如同字串(以及其他內建的 :term:`sequence` 型別),list 可以被索引和切片 " "(slice): ::" -#: ../../tutorial/introduction.rst:401 +#: ../../tutorial/introduction.rst:399 msgid "" ">>> squares[0] # indexing returns the item\n" "1\n" @@ -771,11 +764,11 @@ msgid "" "[9, 16, 25]" msgstr "" -#: ../../tutorial/introduction.rst:408 +#: ../../tutorial/introduction.rst:406 msgid "Lists also support operations like concatenation::" msgstr "List 對支援如接合 (concatenation) 等操作: ::" -#: ../../tutorial/introduction.rst:410 +#: ../../tutorial/introduction.rst:408 msgid "" ">>> squares + [36, 49, 64, 81, 100]\n" "[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]" @@ -783,7 +776,7 @@ msgstr "" ">>> squares + [36, 49, 64, 81, 100]\n" "[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]" -#: ../../tutorial/introduction.rst:413 +#: ../../tutorial/introduction.rst:411 msgid "" "Unlike strings, which are :term:`immutable`, lists are a :term:`mutable` " "type, i.e. it is possible to change their content::" @@ -791,7 +784,7 @@ msgstr "" "不同於字串是 :term:`immutable`,list 是 :term:`mutable` 型別,即改變 list 的" "內容是可能的: ::" -#: ../../tutorial/introduction.rst:416 +#: ../../tutorial/introduction.rst:414 msgid "" ">>> cubes = [1, 8, 27, 65, 125] # something's wrong here\n" ">>> 4 ** 3 # the cube of 4 is 64, not 65!\n" @@ -801,7 +794,7 @@ msgid "" "[1, 8, 27, 64, 125]" msgstr "" -#: ../../tutorial/introduction.rst:423 +#: ../../tutorial/introduction.rst:421 msgid "" "You can also add new items at the end of the list, by using the :meth:`!list." "append` *method* (we will see more about methods later)::" @@ -809,7 +802,7 @@ msgstr "" "你也可以在 list 的最後加入新元素,透過使用 :meth:`!list.append` *方法* " "(method)(我們稍後會看到更多方法的說明): ::" -#: ../../tutorial/introduction.rst:426 +#: ../../tutorial/introduction.rst:424 msgid "" ">>> cubes.append(216) # add the cube of 6\n" ">>> cubes.append(7 ** 3) # and the cube of 7\n" @@ -817,7 +810,7 @@ msgid "" "[1, 8, 27, 64, 125, 216, 343]" msgstr "" -#: ../../tutorial/introduction.rst:431 +#: ../../tutorial/introduction.rst:429 msgid "" "Simple assignment in Python never copies data. When you assign a list to a " "variable, the variable refers to the *existing list*. Any changes you make " @@ -828,7 +821,7 @@ msgstr "" "\\ *現有 list*。任何透過一個變數對 list 所做的更改都將能夠透過參照該變數的所" "有其他變數看到。 ::" -#: ../../tutorial/introduction.rst:436 +#: ../../tutorial/introduction.rst:434 msgid "" ">>> rgb = [\"Red\", \"Green\", \"Blue\"]\n" ">>> rgba = rgb\n" @@ -839,7 +832,7 @@ msgid "" "[\"Red\", \"Green\", \"Blue\", \"Alph\"]" msgstr "" -#: ../../tutorial/introduction.rst:444 +#: ../../tutorial/introduction.rst:442 msgid "" "All slice operations return a new list containing the requested elements. " "This means that the following slice returns a :ref:`shallow copy " @@ -848,7 +841,7 @@ msgstr "" "所有切片操作都會回傳一個新的 list ,包含要求的元素。這意謂著以下這個切片回傳" "了原本 list 的\\ :ref:`淺複製 `: ::" -#: ../../tutorial/introduction.rst:448 +#: ../../tutorial/introduction.rst:446 msgid "" ">>> correct_rgba = rgba[:]\n" ">>> correct_rgba[-1] = \"Alpha\"\n" @@ -864,13 +857,13 @@ msgstr "" ">>> rgba\n" "[\"Red\", \"Green\", \"Blue\", \"Alph\"]" -#: ../../tutorial/introduction.rst:455 +#: ../../tutorial/introduction.rst:453 msgid "" "Assignment to slices is also possible, and this can even change the size of " "the list or clear it entirely::" msgstr "也可以對 slice 賦值,這能改變 list 的大小,甚至是清空一個 list: ::" -#: ../../tutorial/introduction.rst:458 +#: ../../tutorial/introduction.rst:456 msgid "" ">>> letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g']\n" ">>> letters\n" @@ -889,11 +882,11 @@ msgid "" "[]" msgstr "" -#: ../../tutorial/introduction.rst:474 +#: ../../tutorial/introduction.rst:472 msgid "The built-in function :func:`len` also applies to lists::" msgstr "內建的函式 :func:`len` 亦可以作用在 list 上: ::" -#: ../../tutorial/introduction.rst:476 +#: ../../tutorial/introduction.rst:474 msgid "" ">>> letters = ['a', 'b', 'c', 'd']\n" ">>> len(letters)\n" @@ -903,13 +896,13 @@ msgstr "" ">>> len(letters)\n" "4" -#: ../../tutorial/introduction.rst:480 +#: ../../tutorial/introduction.rst:478 msgid "" "It is possible to nest lists (create lists containing other lists), for " "example::" msgstr "也可以嵌套多層 list (建立 list 包含其他 list),例如: ::" -#: ../../tutorial/introduction.rst:483 +#: ../../tutorial/introduction.rst:481 msgid "" ">>> a = ['a', 'b', 'c']\n" ">>> n = [1, 2, 3]\n" @@ -931,11 +924,11 @@ msgstr "" ">>> x[0][1]\n" "'b'" -#: ../../tutorial/introduction.rst:496 +#: ../../tutorial/introduction.rst:494 msgid "First Steps Towards Programming" msgstr "初探程式設計的前幾步" -#: ../../tutorial/introduction.rst:498 +#: ../../tutorial/introduction.rst:496 msgid "" "Of course, we can use Python for more complicated tasks than adding two and " "two together. For instance, we can write an initial sub-sequence of the " @@ -946,7 +939,7 @@ msgstr "" "費氏數列 `_\\ 的首幾項序列: ::" -#: ../../tutorial/introduction.rst:503 +#: ../../tutorial/introduction.rst:501 msgid "" ">>> # Fibonacci series:\n" ">>> # the sum of two elements defines the next\n" @@ -964,11 +957,11 @@ msgid "" "8" msgstr "" -#: ../../tutorial/introduction.rst:518 +#: ../../tutorial/introduction.rst:516 msgid "This example introduces several new features." msgstr "這例子引入了許多新的特性。" -#: ../../tutorial/introduction.rst:520 +#: ../../tutorial/introduction.rst:518 msgid "" "The first line contains a *multiple assignment*: the variables ``a`` and " "``b`` simultaneously get the new values 0 and 1. On the last line this is " @@ -980,7 +973,7 @@ msgstr "" "同樣的賦值再被使用了一次,示範了等號的右項運算 (expression) 會先被計算 " "(evaluate),賦值再發生。右項的運算式由左至右依序被計算。" -#: ../../tutorial/introduction.rst:526 +#: ../../tutorial/introduction.rst:524 msgid "" "The :keyword:`while` loop executes as long as the condition (here: ``a < " "10``) remains true. In Python, like in C, any non-zero integer value is " @@ -998,7 +991,7 @@ msgstr "" "使用如同 C 語言一樣的符號:``<``\\ (小於)、``>``\\ (大於)、``==``\\ (等" "於)、``<=``\\ (小於等於)、``>=``\\ (大於等於)以及 ``!=``\\ (不等於)。" -#: ../../tutorial/introduction.rst:535 +#: ../../tutorial/introduction.rst:533 msgid "" "The *body* of the loop is *indented*: indentation is Python's way of " "grouping statements. At the interactive prompt, you have to type a tab or " @@ -1016,7 +1009,7 @@ msgstr "" "析器無法判斷你何時輸入複合陳述的最後一行)。注意在一個縮排段落內的縮排方式與" "數量必須維持一致。" -#: ../../tutorial/introduction.rst:544 +#: ../../tutorial/introduction.rst:542 msgid "" "The :func:`print` function writes the value of the argument(s) it is given. " "It differs from just writing the expression you want to write (as we did " @@ -1030,7 +1023,7 @@ msgstr "" "將不帶有引號,並且不同項目間會插入一個空白,因此可以讓你容易格式化輸出,例" "如: ::" -#: ../../tutorial/introduction.rst:551 +#: ../../tutorial/introduction.rst:549 msgid "" ">>> i = 256*256\n" ">>> print('The value of i is', i)\n" @@ -1040,7 +1033,7 @@ msgstr "" ">>> print('The value of i is', i)\n" "The value of i is 65536" -#: ../../tutorial/introduction.rst:555 +#: ../../tutorial/introduction.rst:553 msgid "" "The keyword argument *end* can be used to avoid the newline after the " "output, or end the output with a different string::" @@ -1048,7 +1041,7 @@ msgstr "" "關鍵字引數 *end* 可以被用來避免額外的換行符加入到輸出中,或者以不同的字串結束" "輸出: ::" -#: ../../tutorial/introduction.rst:558 +#: ../../tutorial/introduction.rst:556 msgid "" ">>> a, b = 0, 1\n" ">>> while a < 1000:\n" @@ -1064,11 +1057,11 @@ msgstr "" "...\n" "0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987," -#: ../../tutorial/introduction.rst:567 +#: ../../tutorial/introduction.rst:565 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/introduction.rst:568 +#: ../../tutorial/introduction.rst:566 msgid "" "Since ``**`` has higher precedence than ``-``, ``-3**2`` will be interpreted " "as ``-(3**2)`` and thus result in ``-9``. To avoid this and get ``9``, you " @@ -1077,7 +1070,7 @@ msgstr "" "因為 ``**`` 擁有較 ``-`` 高的優先次序,``-3**2`` 會被解釋為 ``-(3**2)`` 並得" "到 ``-9``。如果要避免這樣的優先順序以得到 ``9``,你可以使用 ``(-3)**2``。" -#: ../../tutorial/introduction.rst:572 +#: ../../tutorial/introduction.rst:570 msgid "" "Unlike other languages, special characters such as ``\\n`` have the same " "meaning with both single (``'...'``) and double (``\"...\"``) quotes. The " diff --git a/tutorial/modules.po b/tutorial/modules.po index 02d752fd55..9a828e3f5e 100644 --- a/tutorial/modules.po +++ b/tutorial/modules.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-10-10 00:13+0000\n" "PO-Revision-Date: 2022-10-23 20:30+0800\n" "Last-Translator: Phil Lin \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1157,27 +1157,28 @@ msgstr "多目錄中的套件" #: ../../tutorial/modules.rst:588 msgid "" -"Packages support one more special attribute, :attr:`__path__`. This is " -"initialized to be a list containing the name of the directory holding the " -"package's :file:`__init__.py` before the code in that file is executed. " -"This variable can be modified; doing so affects future searches for modules " -"and subpackages contained in the package." +"Packages support one more special attribute, :attr:`~module.__path__`. This " +"is initialized to be a :term:`sequence` of strings containing the name of " +"the directory holding the package's :file:`__init__.py` before the code in " +"that file is executed. This variable can be modified; doing so affects " +"future searches for modules and subpackages contained in the package." msgstr "" -"套件也支援一個特殊屬性 :attr:`__path__`。它在初始化時是一個 list,包含該套件" -"的 :file:`__init__.py` 檔案所在的目錄名稱,初始化時機是在這個檔案的程式碼被執" -"行之前。這個變數可以被修改,但這樣做會影響將來對套件內的模組和子套件的搜尋。" +"套件也支援一個特殊屬性 :attr:`~module.__path__`。它在初始化時是一個字串的\\ :" +"term:`序列 `\\ 的 :file:`__init__.py` 檔案所在的目錄名稱,初始化時" +"機是在這個檔案的程式碼被執行之前。這個變數可以被修改,但這樣做會影響將來對套" +"件內的模組和子套件的搜尋。" -#: ../../tutorial/modules.rst:594 +#: ../../tutorial/modules.rst:595 msgid "" "While this feature is not often needed, it can be used to extend the set of " "modules found in a package." msgstr "雖然這個特色不太常被需要,但它可用於擴充套件中的模組集合。" -#: ../../tutorial/modules.rst:599 +#: ../../tutorial/modules.rst:600 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/modules.rst:600 +#: ../../tutorial/modules.rst:601 msgid "" "In fact function definitions are also 'statements' that are 'executed'; the " "execution of a module-level function definition adds the function name to " diff --git a/using/cmdline.po b/using/cmdline.po index fdee4c513d..83a4704e76 100644 --- a/using/cmdline.po +++ b/using/cmdline.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-11 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1293,8 +1293,9 @@ msgid "" msgstr "" #: ../../using/cmdline.rst:1030 ../../using/cmdline.rst:1044 -msgid ":ref:`Availability `: Windows." -msgstr ":ref:`適用 `:Windows。" +#: ../../using/cmdline.rst:1095 +msgid "Availability" +msgstr "" #: ../../using/cmdline.rst:1032 msgid "See :pep:`529` for more details." @@ -1383,10 +1384,6 @@ msgid "" "system interfaces." msgstr "" -#: ../../using/cmdline.rst:1095 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" - #: ../../using/cmdline.rst:1097 msgid "See :pep:`538` for more details." msgstr "更多細節請見 :pep:`538`。" diff --git a/using/configure.po b/using/configure.po index 1b0328f205..a3a919df74 100644 --- a/using/configure.po +++ b/using/configure.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-15 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -70,7 +70,7 @@ msgstr "" #: ../../using/configure.rst:32 msgid "" -"Autoconf 2.71 and aclocal 1.16.4 are required to regenerate the :file:" +"Autoconf 2.71 and aclocal 1.16.5 are required to regenerate the :file:" "`configure` script." msgstr "" @@ -109,7 +109,7 @@ msgid "" msgstr "" #: ../../using/configure.rst:58 -msgid "Autoconf 2.71, aclocal 1.16.4 and SQLite 3.15.2 are now required." +msgid "Autoconf 2.71, aclocal 1.16.5 and SQLite 3.15.2 are now required." msgstr "" #: ../../using/configure.rst:61 diff --git a/whatsnew/2.6.po b/whatsnew/2.6.po index de308f3fc6..c5606c2af5 100644 --- a/whatsnew/2.6.po +++ b/whatsnew/2.6.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-10 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -688,17 +688,17 @@ msgstr "" #: ../../whatsnew/2.6.rst:505 msgid "" -"The fix for Python 2.6 adds a :attr:`__package__` attribute to modules. " -"When this attribute is present, relative imports will be relative to the " -"value of this attribute instead of the :attr:`__name__` attribute." +"The fix for Python 2.6 adds a :attr:`module.__package__` attribute. When " +"this attribute is present, relative imports will be relative to the value of " +"this attribute instead of the :attr:`~module.__name__` attribute." msgstr "" #: ../../whatsnew/2.6.rst:510 msgid "" -"PEP 302-style importers can then set :attr:`__package__` as necessary. The :" -"mod:`runpy` module that implements the :option:`-m` switch now does this, so " -"relative imports will now work correctly in scripts running from inside a " -"package." +"PEP 302-style importers can then set :attr:`~module.__package__` as " +"necessary. The :mod:`runpy` module that implements the :option:`-m` switch " +"now does this, so relative imports will now work correctly in scripts " +"running from inside a package." msgstr "" #: ../../whatsnew/2.6.rst:520 diff --git a/whatsnew/3.0.po b/whatsnew/3.0.po index 3c93e678fd..029b569e43 100644 --- a/whatsnew/3.0.po +++ b/whatsnew/3.0.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-10-10 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -443,9 +443,9 @@ msgid "" ":pep:`3107`: Function argument and return value annotations. This provides " "a standardized way of annotating a function's parameters and return value. " "There are no semantics attached to such annotations except that they can be " -"introspected at runtime using the :attr:`__annotations__` attribute. The " -"intent is to encourage experimentation through metaclasses, decorators or " -"frameworks." +"introspected at runtime using the :attr:`~object.__annotations__` " +"attribute. The intent is to encourage experimentation through metaclasses, " +"decorators or frameworks." msgstr "" #: ../../whatsnew/3.0.rst:363 diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index 227841ae3a..829ac57ea5 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-28 00:13+0000\n" +"POT-Creation-Date: 2024-10-10 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,7 +35,7 @@ msgid "" "`changelog `." msgstr "" "本文介紹了 Python 3.12 與 3.11 相比多了哪些新功能。 Python 3.12 於 2023 年 " -"10 月 2 日發布。完整詳請請見 :ref:`changelog `。" +"10 月 2 日發布。完整詳情請見 :ref:`changelog `。" #: ../../whatsnew/3.12.rst:54 msgid ":pep:`693` -- Python 3.12 Release Schedule" @@ -47,12 +47,12 @@ msgstr "發布重點摘要" #: ../../whatsnew/3.12.rst:62 msgid "" -"Python 3.12 is the latest stable release of the Python programming language, " -"with a mix of changes to the language and the standard library. The library " -"changes focus on cleaning up deprecated APIs, usability, and correctness. Of " -"note, the :mod:`!distutils` package has been removed from the standard " -"library. Filesystem support in :mod:`os` and :mod:`pathlib` has seen a " -"number of improvements, and several modules have better performance." +"Python 3.12 is a stable release of the Python programming language, with a " +"mix of changes to the language and the standard library. The library changes " +"focus on cleaning up deprecated APIs, usability, and correctness. Of note, " +"the :mod:`!distutils` package has been removed from the standard library. " +"Filesystem support in :mod:`os` and :mod:`pathlib` has seen a number of " +"improvements, and several modules have better performance." msgstr "" #: ../../whatsnew/3.12.rst:69 @@ -265,7 +265,7 @@ msgstr "" "`unittest.TestCase` 的\\ `方法別名 `_\\ " "已被刪除。" -#: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1825 +#: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1826 msgid "New Features" msgstr "新增功能" @@ -1251,7 +1251,7 @@ msgid "" "Windows. (Contributed by Charles Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:861 ../../whatsnew/3.12.rst:1529 +#: ../../whatsnew/3.12.rst:861 ../../whatsnew/3.12.rst:1530 msgid "sqlite3" msgstr "sqlite3" @@ -1326,7 +1326,7 @@ msgid "" "Katriel in :gh:`102778`.)" msgstr "" -#: ../../whatsnew/3.12.rst:912 ../../whatsnew/3.12.rst:1724 +#: ../../whatsnew/3.12.rst:912 ../../whatsnew/3.12.rst:1725 msgid "" ":func:`sys._current_exceptions` now returns a mapping from thread-id to an " "exception instance, rather than to a ``(typ, exc, tb)`` tuple. (Contributed " @@ -1498,7 +1498,7 @@ msgid "" "Benjamin Peterson in :gh:`96734`)." msgstr "" -#: ../../whatsnew/3.12.rst:1026 ../../whatsnew/3.12.rst:1569 +#: ../../whatsnew/3.12.rst:1026 ../../whatsnew/3.12.rst:1570 msgid "unittest" msgstr "unittest" @@ -1706,12 +1706,12 @@ msgid "" "demos>`_. (Contributed by Victor Stinner in :gh:`97669`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1143 ../../whatsnew/3.12.rst:2127 +#: ../../whatsnew/3.12.rst:1143 ../../whatsnew/3.12.rst:2128 msgid "Deprecated" msgstr "已棄用" #: ../../whatsnew/3.12.rst:1145 -#: ../../deprecations/pending-removal-in-3.14.rst:4 +#: ../../deprecations/pending-removal-in-3.14.rst:11 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" "argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " @@ -1730,32 +1730,32 @@ msgid "" msgstr "" #: ../../whatsnew/3.12.rst:1154 -#: ../../deprecations/pending-removal-in-3.14.rst:13 +#: ../../deprecations/pending-removal-in-3.14.rst:20 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" #: ../../whatsnew/3.12.rst:1155 -#: ../../deprecations/pending-removal-in-3.14.rst:14 +#: ../../deprecations/pending-removal-in-3.14.rst:21 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" #: ../../whatsnew/3.12.rst:1156 -#: ../../deprecations/pending-removal-in-3.14.rst:15 +#: ../../deprecations/pending-removal-in-3.14.rst:22 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" #: ../../whatsnew/3.12.rst:1157 -#: ../../deprecations/pending-removal-in-3.14.rst:16 +#: ../../deprecations/pending-removal-in-3.14.rst:23 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" #: ../../whatsnew/3.12.rst:1158 -#: ../../deprecations/pending-removal-in-3.14.rst:17 +#: ../../deprecations/pending-removal-in-3.14.rst:24 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" #: ../../whatsnew/3.12.rst:1160 -#: ../../deprecations/pending-removal-in-3.14.rst:19 +#: ../../deprecations/pending-removal-in-3.14.rst:26 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" "`90953`.)" @@ -1763,7 +1763,7 @@ msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" #: ../../whatsnew/3.12.rst:1163 -#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.14.rst:29 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" @@ -1776,7 +1776,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.12.rst:1171 -#: ../../deprecations/pending-removal-in-3.14.rst:30 +#: ../../deprecations/pending-removal-in-3.14.rst:37 msgid "" ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" "`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." @@ -1789,7 +1789,7 @@ msgstr "" "除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../whatsnew/3.12.rst:1177 -#: ../../deprecations/pending-removal-in-3.14.rst:36 +#: ../../deprecations/pending-removal-in-3.14.rst:43 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " "now emits a :exc:`DeprecationWarning` if there is no current event loop set " @@ -1844,37 +1844,37 @@ msgid "" msgstr ":mod:`importlib.abc`:棄用下列類別,預定於 Python 3.14 中移除:" #: ../../whatsnew/3.12.rst:1205 -#: ../../deprecations/pending-removal-in-3.14.rst:52 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" #: ../../whatsnew/3.12.rst:1206 -#: ../../deprecations/pending-removal-in-3.14.rst:53 +#: ../../deprecations/pending-removal-in-3.14.rst:60 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" #: ../../whatsnew/3.12.rst:1207 -#: ../../deprecations/pending-removal-in-3.14.rst:54 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" #: ../../whatsnew/3.12.rst:1209 -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" #: ../../whatsnew/3.12.rst:1211 -#: ../../deprecations/pending-removal-in-3.14.rst:58 +#: ../../deprecations/pending-removal-in-3.14.rst:65 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" #: ../../whatsnew/3.12.rst:1212 -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:66 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" #: ../../whatsnew/3.12.rst:1214 -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:68 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" @@ -1958,7 +1958,7 @@ msgstr "" "*onexc*。(由 Irit Katriel 於 :gh:`102828` 中貢獻。)" #: ../../whatsnew/3.12.rst:1267 -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:98 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" @@ -1994,7 +1994,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.12.rst:1290 -#: ../../deprecations/pending-removal-in-3.15.rst:53 +#: ../../deprecations/pending-removal-in-3.15.rst:62 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" @@ -2031,19 +2031,21 @@ msgstr "" #: ../../whatsnew/3.12.rst:1312 msgid "" -":exc:`DeprecationWarning` is now raised when ``__package__`` on a module " -"differs from ``__spec__.parent`` (previously it was :exc:`ImportWarning`). " -"(Contributed by Brett Cannon in :gh:`65961`.)" +":exc:`DeprecationWarning` is now raised when :attr:`~module.__package__` on " +"a module differs from :attr:`__spec__.parent ` (previously it was :exc:`ImportWarning`). (Contributed by Brett " +"Cannon in :gh:`65961`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1317 +#: ../../whatsnew/3.12.rst:1318 msgid "" -"Setting ``__package__`` or ``__cached__`` on a module is deprecated, and " -"will cease to be set or taken into consideration by the import system in " -"Python 3.14. (Contributed by Brett Cannon in :gh:`65961`.)" +"Setting :attr:`~module.__package__` or :attr:`~module.__cached__` on a " +"module is deprecated, and will cease to be set or taken into consideration " +"by the import system in Python 3.14. (Contributed by Brett Cannon in :gh:" +"`65961`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1321 +#: ../../whatsnew/3.12.rst:1322 msgid "" "The bitwise inversion operator (``~``) on bool is deprecated. It will throw " "an error in Python 3.16. Use ``not`` for logical negation of bools instead. " @@ -2052,7 +2054,7 @@ msgid "" "Tim Hoffmann in :gh:`103487`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1327 +#: ../../whatsnew/3.12.rst:1328 msgid "" "Accessing :attr:`~codeobject.co_lnotab` on code objects was deprecated in " "Python 3.10 via :pep:`626`, but it only got a proper :exc:" @@ -2239,7 +2241,23 @@ msgstr "" msgid "Pending Removal in Python 3.14" msgstr "Python 3.14 中待移除的項目" -#: ../../deprecations/pending-removal-in-3.14.rst:9 +#: ../../deprecations/pending-removal-in-3.14.rst:4 +#: ../../deprecations/pending-removal-in-3.15.rst:4 +msgid "The import system:" +msgstr "引入系統 (import system):" + +#: ../../deprecations/pending-removal-in-3.14.rst:6 +msgid "" +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.14, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." +msgstr "" +"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " +"` 的做法已被棄用。在 Python 3.14 中," +"引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__` 。" + +#: ../../deprecations/pending-removal-in-3.14.rst:16 msgid "" ":mod:`ast`: The following features have been deprecated in documentation " "since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " @@ -2248,7 +2266,7 @@ msgstr "" ":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時會" "於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" -#: ../../deprecations/pending-removal-in-3.14.rst:24 +#: ../../deprecations/pending-removal-in-3.14.rst:31 msgid "" "The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" "`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" @@ -2260,7 +2278,7 @@ msgstr "" "AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " "Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:41 +#: ../../deprecations/pending-removal-in-3.14.rst:48 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " @@ -2272,7 +2290,7 @@ msgstr "" "改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " "Shantanu Jain 於 :gh:`91896` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:47 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid "" ":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" @@ -2280,11 +2298,11 @@ msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:50 +#: ../../deprecations/pending-removal-in-3.14.rst:57 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:63 +#: ../../deprecations/pending-removal-in-3.14.rst:70 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -2295,7 +2313,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:69 +#: ../../deprecations/pending-removal-in-3.14.rst:76 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -2312,7 +2330,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:77 +#: ../../deprecations/pending-removal-in-3.14.rst:84 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -2320,7 +2338,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:81 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -2330,23 +2348,23 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:86 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:88 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:96 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:93 +#: ../../deprecations/pending-removal-in-3.14.rst:100 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:95 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -2356,7 +2374,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:99 +#: ../../deprecations/pending-removal-in-3.14.rst:106 msgid "" "date and datetime adapter, date and timestamp converter: see the :mod:" "`sqlite3` documentation for suggested replacement recipes." @@ -2364,7 +2382,7 @@ msgstr "" "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" "參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:109 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -2376,7 +2394,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:109 +#: ../../deprecations/pending-removal-in-3.14.rst:116 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -2384,7 +2402,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:112 +#: ../../deprecations/pending-removal-in-3.14.rst:119 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -2398,22 +2416,44 @@ msgstr "" msgid "Pending Removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" -#: ../../deprecations/pending-removal-in-3.15.rst:4 +#: ../../deprecations/pending-removal-in-3.15.rst:6 +msgid "" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" +msgstr "" +"在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " +"` 的做法已被棄用。在 Python 3.15 中," +"引入系統或標準函式庫將不再設定或考慮 :attr:`!__cached__`。(:gh:`97879`)" + +#: ../../deprecations/pending-removal-in-3.15.rst:11 +msgid "" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" +msgstr "" +"在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " +"` 的做法已被棄用。在 Python 3.15 中," +"引入系統或標準函式庫將不再設定或考慮 :attr:`!__package__`。(:gh:`97879`)" + +#: ../../deprecations/pending-removal-in-3.15.rst:16 msgid ":mod:`ctypes`:" msgstr ":mod:`ctypes`:" -#: ../../deprecations/pending-removal-in-3.15.rst:6 +#: ../../deprecations/pending-removal-in-3.15.rst:18 msgid "" "The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " "since Python 3.13." msgstr "" "自 Python 3.13 起,未記錄的 :func:`!ctypes.SetPointerType` 函式已被棄用。" -#: ../../deprecations/pending-removal-in-3.15.rst:9 +#: ../../deprecations/pending-removal-in-3.15.rst:21 msgid ":mod:`http.server`:" msgstr ":mod:`http.server`:" -#: ../../deprecations/pending-removal-in-3.15.rst:11 +#: ../../deprecations/pending-removal-in-3.15.rst:23 msgid "" "The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " "been deprecated since Python 3.13. No direct replacement exists. *Anything* " @@ -2423,7 +2463,7 @@ msgstr "" "起已被棄用。不存在直接的替代。*任何東西*\\ 都比 CGI 更好地將 Web 伺服器與請求" "處理程序介接起來。" -#: ../../deprecations/pending-removal-in-3.15.rst:17 +#: ../../deprecations/pending-removal-in-3.15.rst:29 msgid "" "The :option:`!--cgi` flag to the :program:`python -m http.server` command-" "line interface has been deprecated since Python 3.13." @@ -2431,19 +2471,11 @@ msgstr "" "自 Python 3.13 起,:program:`python -m http.server` 命令列介面的 :option:`!--" "cgi` 旗標已被棄用。" -#: ../../deprecations/pending-removal-in-3.15.rst:20 -msgid "" -":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " -"taken into consideration by the import system (:gh:`97879`)." -msgstr "" -":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " -"系統考慮。 (:gh:`97879`)" - -#: ../../deprecations/pending-removal-in-3.15.rst:23 +#: ../../deprecations/pending-removal-in-3.15.rst:32 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:25 +#: ../../deprecations/pending-removal-in-3.15.rst:34 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" @@ -2456,11 +2488,11 @@ msgstr "" "`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." "getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:33 +#: ../../deprecations/pending-removal-in-3.15.rst:42 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:35 +#: ../../deprecations/pending-removal-in-3.15.rst:44 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows." @@ -2468,11 +2500,11 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." "isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:39 +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:41 +#: ../../deprecations/pending-removal-in-3.15.rst:50 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -2481,11 +2513,11 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:45 +#: ../../deprecations/pending-removal-in-3.15.rst:54 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:47 +#: ../../deprecations/pending-removal-in-3.15.rst:56 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -2496,7 +2528,7 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:55 +#: ../../deprecations/pending-removal-in-3.15.rst:64 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -2507,7 +2539,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:61 +#: ../../deprecations/pending-removal-in-3.15.rst:70 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -2517,11 +2549,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:66 +#: ../../deprecations/pending-removal-in-3.15.rst:75 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:68 +#: ../../deprecations/pending-removal-in-3.15.rst:77 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -2774,6 +2806,8 @@ msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" +"`~logging.warning`。" #: ../../deprecations/pending-removal-in-future.rst:72 msgid "" @@ -3022,32 +3056,32 @@ msgstr "" ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." "zipimporter.exec_module`。" -#: ../../whatsnew/3.12.rst:1344 ../../whatsnew/3.12.rst:2222 +#: ../../whatsnew/3.12.rst:1345 ../../whatsnew/3.12.rst:2223 msgid "Removed" msgstr "已移除" -#: ../../whatsnew/3.12.rst:1347 +#: ../../whatsnew/3.12.rst:1348 msgid "asynchat and asyncore" msgstr "asynchat 和 asyncore" -#: ../../whatsnew/3.12.rst:1349 +#: ../../whatsnew/3.12.rst:1350 msgid "" "These two modules have been removed according to the schedule in :pep:`594`, " "having been deprecated in Python 3.6. Use :mod:`asyncio` instead. " "(Contributed by Nikita Sobolev in :gh:`96580`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1356 +#: ../../whatsnew/3.12.rst:1357 msgid "configparser" msgstr "configparser" -#: ../../whatsnew/3.12.rst:1358 +#: ../../whatsnew/3.12.rst:1359 msgid "" "Several names deprecated in the :mod:`configparser` way back in 3.2 have " "been removed per :gh:`89336`:" msgstr "" -#: ../../whatsnew/3.12.rst:1361 +#: ../../whatsnew/3.12.rst:1362 msgid "" ":class:`configparser.ParsingError` no longer has a ``filename`` attribute or " "argument. Use the ``source`` attribute and argument instead." @@ -3055,23 +3089,23 @@ msgstr "" ":class:`configparser.ParsingError` 不再具有 ``filename`` 屬性或引數。請改用 " "``source`` 屬性和引數。" -#: ../../whatsnew/3.12.rst:1363 +#: ../../whatsnew/3.12.rst:1364 msgid "" ":mod:`configparser` no longer has a ``SafeConfigParser`` class. Use the " "shorter :class:`~configparser.ConfigParser` name instead." msgstr "" -#: ../../whatsnew/3.12.rst:1365 +#: ../../whatsnew/3.12.rst:1366 msgid "" ":class:`configparser.ConfigParser` no longer has a ``readfp`` method. Use :" "meth:`~configparser.ConfigParser.read_file` instead." msgstr "" -#: ../../whatsnew/3.12.rst:1369 +#: ../../whatsnew/3.12.rst:1370 msgid "distutils" msgstr "distutils" -#: ../../whatsnew/3.12.rst:1371 +#: ../../whatsnew/3.12.rst:1372 msgid "" "Remove the :py:mod:`!distutils` package. It was deprecated in Python 3.10 " "by :pep:`632` \"Deprecate distutils module\". For projects still using " @@ -3080,17 +3114,17 @@ msgid "" "Victor Stinner in :gh:`92584`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1378 +#: ../../whatsnew/3.12.rst:1379 msgid "ensurepip" msgstr "ensurepip" -#: ../../whatsnew/3.12.rst:1380 +#: ../../whatsnew/3.12.rst:1381 msgid "" "Remove the bundled setuptools wheel from :mod:`ensurepip`, and stop " "installing setuptools in environments created by :mod:`venv`." msgstr "" -#: ../../whatsnew/3.12.rst:1383 +#: ../../whatsnew/3.12.rst:1384 msgid "" "``pip (>= 22.1)`` does not require setuptools to be installed in the " "environment. ``setuptools``-based (and ``distutils``-based) packages can " @@ -3098,7 +3132,7 @@ msgid "" "the build environment it uses for building a package." msgstr "" -#: ../../whatsnew/3.12.rst:1389 +#: ../../whatsnew/3.12.rst:1390 msgid "" "``easy_install``, ``pkg_resources``, ``setuptools`` and ``distutils`` are no " "longer provided by default in environments created with ``venv`` or " @@ -3108,25 +3142,25 @@ msgid "" "(typically, using pip)." msgstr "" -#: ../../whatsnew/3.12.rst:1396 +#: ../../whatsnew/3.12.rst:1397 msgid "(Contributed by Pradyun Gedam in :gh:`95299`.)" msgstr "(由 Pradyun Gedam 於 :gh:`95299` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1399 +#: ../../whatsnew/3.12.rst:1400 msgid "enum" msgstr "enum" -#: ../../whatsnew/3.12.rst:1401 +#: ../../whatsnew/3.12.rst:1402 msgid "" "Remove :mod:`enum`'s ``EnumMeta.__getattr__``, which is no longer needed for " "enum attribute access. (Contributed by Ethan Furman in :gh:`95083`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1406 +#: ../../whatsnew/3.12.rst:1407 msgid "ftplib" msgstr "ftplib" -#: ../../whatsnew/3.12.rst:1408 +#: ../../whatsnew/3.12.rst:1409 msgid "" "Remove :mod:`ftplib`'s ``FTP_TLS.ssl_version`` class attribute: use the " "*context* parameter instead. (Contributed by Victor Stinner in :gh:`94172`.)" @@ -3134,11 +3168,11 @@ msgstr "" "移除 :mod:`ftplib` 的 ``FTP_TLS.ssl_version`` 類別屬性:請改用 *context* 參" "數。(由 Victor Stinner 於 :gh:`94172` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1413 +#: ../../whatsnew/3.12.rst:1414 msgid "gzip" msgstr "gzip" -#: ../../whatsnew/3.12.rst:1415 +#: ../../whatsnew/3.12.rst:1416 msgid "" "Remove the ``filename`` attribute of :mod:`gzip`'s :class:`gzip.GzipFile`, " "deprecated since Python 2.6, use the :attr:`~gzip.GzipFile.name` attribute " @@ -3147,11 +3181,11 @@ msgid "" "`94196`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1422 +#: ../../whatsnew/3.12.rst:1423 msgid "hashlib" msgstr "hashlib" -#: ../../whatsnew/3.12.rst:1424 +#: ../../whatsnew/3.12.rst:1425 msgid "" "Remove the pure Python implementation of :mod:`hashlib`'s :func:`hashlib." "pbkdf2_hmac`, deprecated in Python 3.10. Python 3.10 and newer requires " @@ -3160,17 +3194,17 @@ msgid "" "Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1431 ../../whatsnew/3.12.rst:1458 +#: ../../whatsnew/3.12.rst:1432 ../../whatsnew/3.12.rst:1459 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.12.rst:1433 +#: ../../whatsnew/3.12.rst:1434 msgid "" "Many previously deprecated cleanups in :mod:`importlib` have now been " "completed:" msgstr "現已完成清理 :mod:`importlib` 中許多過去已經棄用的東西:" -#: ../../whatsnew/3.12.rst:1436 +#: ../../whatsnew/3.12.rst:1437 msgid "" "References to, and support for :meth:`!module_repr` has been removed. " "(Contributed by Barry Warsaw in :gh:`97850`.)" @@ -3178,134 +3212,134 @@ msgstr "" "對 :meth:`!module_repr` 的參照和支援已刪除。(由 Barry Warsaw 在 :gh:`97850` " "中貢獻。)" -#: ../../whatsnew/3.12.rst:1439 +#: ../../whatsnew/3.12.rst:1440 msgid "" "``importlib.util.set_package``, ``importlib.util.set_loader`` and " "``importlib.util.module_for_loader`` have all been removed. (Contributed by " "Brett Cannon and Nikita Sobolev in :gh:`65961` and :gh:`97850`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1443 +#: ../../whatsnew/3.12.rst:1444 msgid "" "Support for ``find_loader()`` and ``find_module()`` APIs have been removed. " "(Contributed by Barry Warsaw in :gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1446 +#: ../../whatsnew/3.12.rst:1447 msgid "" "``importlib.abc.Finder``, ``pkgutil.ImpImporter``, and ``pkgutil.ImpLoader`` " "have been removed. (Contributed by Barry Warsaw in :gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1450 ../../whatsnew/3.12.rst:1458 +#: ../../whatsnew/3.12.rst:1451 ../../whatsnew/3.12.rst:1459 msgid "imp" msgstr "imp" -#: ../../whatsnew/3.12.rst:1452 +#: ../../whatsnew/3.12.rst:1453 msgid "" "The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in :" "gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1455 +#: ../../whatsnew/3.12.rst:1456 msgid "To migrate, consult the following correspondence table:" msgstr "" -#: ../../whatsnew/3.12.rst:1460 +#: ../../whatsnew/3.12.rst:1461 msgid "``imp.NullImporter``" msgstr "``imp.NullImporter``" -#: ../../whatsnew/3.12.rst:1460 +#: ../../whatsnew/3.12.rst:1461 msgid "Insert ``None`` into ``sys.path_importer_cache``" msgstr "將 ``None`` 插入 ``sys.path_importer_cache``" -#: ../../whatsnew/3.12.rst:1461 +#: ../../whatsnew/3.12.rst:1462 msgid "``imp.cache_from_source()``" msgstr "``imp.cache_from_source()``" -#: ../../whatsnew/3.12.rst:1461 +#: ../../whatsnew/3.12.rst:1462 msgid ":func:`importlib.util.cache_from_source`" msgstr ":func:`importlib.util.cache_from_source`" -#: ../../whatsnew/3.12.rst:1462 +#: ../../whatsnew/3.12.rst:1463 msgid "``imp.find_module()``" msgstr "``imp.find_module()``" -#: ../../whatsnew/3.12.rst:1462 +#: ../../whatsnew/3.12.rst:1463 msgid ":func:`importlib.util.find_spec`" msgstr ":func:`importlib.util.find_spec`" -#: ../../whatsnew/3.12.rst:1463 +#: ../../whatsnew/3.12.rst:1464 msgid "``imp.get_magic()``" msgstr "``imp.get_magic()``" -#: ../../whatsnew/3.12.rst:1463 +#: ../../whatsnew/3.12.rst:1464 msgid ":attr:`importlib.util.MAGIC_NUMBER`" msgstr ":attr:`importlib.util.MAGIC_NUMBER`" -#: ../../whatsnew/3.12.rst:1464 +#: ../../whatsnew/3.12.rst:1465 msgid "``imp.get_suffixes()``" msgstr "``imp.get_suffixes()``" -#: ../../whatsnew/3.12.rst:1464 +#: ../../whatsnew/3.12.rst:1465 msgid "" ":attr:`importlib.machinery.SOURCE_SUFFIXES`, :attr:`importlib.machinery." "EXTENSION_SUFFIXES`, and :attr:`importlib.machinery.BYTECODE_SUFFIXES`" msgstr "" -#: ../../whatsnew/3.12.rst:1465 +#: ../../whatsnew/3.12.rst:1466 msgid "``imp.get_tag()``" msgstr "``imp.get_tag()``" -#: ../../whatsnew/3.12.rst:1465 +#: ../../whatsnew/3.12.rst:1466 msgid ":attr:`sys.implementation.cache_tag `" msgstr ":attr:`sys.implementation.cache_tag `" -#: ../../whatsnew/3.12.rst:1466 +#: ../../whatsnew/3.12.rst:1467 msgid "``imp.load_module()``" msgstr "``imp.load_module()``" -#: ../../whatsnew/3.12.rst:1466 +#: ../../whatsnew/3.12.rst:1467 msgid ":func:`importlib.import_module`" msgstr ":func:`importlib.import_module`" -#: ../../whatsnew/3.12.rst:1467 +#: ../../whatsnew/3.12.rst:1468 msgid "``imp.new_module(name)``" msgstr "``imp.new_module(name)``" -#: ../../whatsnew/3.12.rst:1467 +#: ../../whatsnew/3.12.rst:1468 msgid "``types.ModuleType(name)``" msgstr "``types.ModuleType(name)``" -#: ../../whatsnew/3.12.rst:1468 +#: ../../whatsnew/3.12.rst:1469 msgid "``imp.reload()``" msgstr "``imp.reload()``" -#: ../../whatsnew/3.12.rst:1468 +#: ../../whatsnew/3.12.rst:1469 msgid ":func:`importlib.reload`" msgstr ":func:`importlib.reload`" -#: ../../whatsnew/3.12.rst:1469 +#: ../../whatsnew/3.12.rst:1470 msgid "``imp.source_from_cache()``" msgstr "``imp.source_from_cache()``" -#: ../../whatsnew/3.12.rst:1469 +#: ../../whatsnew/3.12.rst:1470 msgid ":func:`importlib.util.source_from_cache`" msgstr ":func:`importlib.util.source_from_cache`" -#: ../../whatsnew/3.12.rst:1470 +#: ../../whatsnew/3.12.rst:1471 msgid "``imp.load_source()``" msgstr "``imp.load_source()``" -#: ../../whatsnew/3.12.rst:1470 +#: ../../whatsnew/3.12.rst:1471 msgid "*See below*" msgstr "*見下文*" -#: ../../whatsnew/3.12.rst:1473 +#: ../../whatsnew/3.12.rst:1474 msgid "Replace ``imp.load_source()`` with::" msgstr "用以下取代 ``imp.load_source()``: ::" -#: ../../whatsnew/3.12.rst:1475 +#: ../../whatsnew/3.12.rst:1476 msgid "" "import importlib.util\n" "import importlib.machinery\n" @@ -3322,37 +3356,37 @@ msgid "" " return module" msgstr "" -#: ../../whatsnew/3.12.rst:1488 +#: ../../whatsnew/3.12.rst:1489 msgid "Remove :mod:`!imp` functions and attributes with no replacements:" msgstr "移除 :mod:`!imp` 函式和屬性、沒有替代方案:" -#: ../../whatsnew/3.12.rst:1490 +#: ../../whatsnew/3.12.rst:1491 msgid "Undocumented functions:" msgstr "未以文件記錄的函式:" -#: ../../whatsnew/3.12.rst:1492 +#: ../../whatsnew/3.12.rst:1493 msgid "``imp.init_builtin()``" msgstr "``imp.init_builtin()``" -#: ../../whatsnew/3.12.rst:1493 +#: ../../whatsnew/3.12.rst:1494 msgid "``imp.load_compiled()``" msgstr "``imp.load_compiled()``" -#: ../../whatsnew/3.12.rst:1494 +#: ../../whatsnew/3.12.rst:1495 msgid "``imp.load_dynamic()``" msgstr "``imp.load_dynamic()``" -#: ../../whatsnew/3.12.rst:1495 +#: ../../whatsnew/3.12.rst:1496 msgid "``imp.load_package()``" msgstr "``imp.load_package()``" -#: ../../whatsnew/3.12.rst:1497 +#: ../../whatsnew/3.12.rst:1498 msgid "" "``imp.lock_held()``, ``imp.acquire_lock()``, ``imp.release_lock()``: the " "locking scheme has changed in Python 3.3 to per-module locks." msgstr "" -#: ../../whatsnew/3.12.rst:1499 +#: ../../whatsnew/3.12.rst:1500 msgid "" "``imp.find_module()`` constants: ``SEARCH_ERROR``, ``PY_SOURCE``, " "``PY_COMPILED``, ``C_EXTENSION``, ``PY_RESOURCE``, ``PKG_DIRECTORY``, " @@ -3362,11 +3396,11 @@ msgstr "" "``PY_COMPILED``、``C_EXTENSION``、``PY_RESOURCE``、``PKG_DIRECTORY``、" "``C_BUILTIN``、``PY_FROZEN``、``PY_CODERESOURCE``、``IMP_HOOK``。" -#: ../../whatsnew/3.12.rst:1504 +#: ../../whatsnew/3.12.rst:1505 msgid "io" msgstr "io" -#: ../../whatsnew/3.12.rst:1506 +#: ../../whatsnew/3.12.rst:1507 msgid "" "Remove :mod:`io`'s ``io.OpenWrapper`` and ``_pyio.OpenWrapper``, deprecated " "in Python 3.10: just use :func:`open` instead. The :func:`open` (:func:`io." @@ -3375,22 +3409,22 @@ msgid "" "`94169`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1513 +#: ../../whatsnew/3.12.rst:1514 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.12.rst:1515 +#: ../../whatsnew/3.12.rst:1516 msgid "" "Remove :mod:`locale`'s :func:`!locale.format` function, deprecated in Python " "3.7: use :func:`locale.format_string` instead. (Contributed by Victor " "Stinner in :gh:`94226`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1520 +#: ../../whatsnew/3.12.rst:1521 msgid "smtpd" msgstr "smtpd" -#: ../../whatsnew/3.12.rst:1522 +#: ../../whatsnew/3.12.rst:1523 msgid "" "The ``smtpd`` module has been removed according to the schedule in :pep:" "`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use the :pypi:" @@ -3398,27 +3432,27 @@ msgid "" "(Contributed by Oleg Iarygin in :gh:`93243`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1531 +#: ../../whatsnew/3.12.rst:1532 msgid "" "The following undocumented :mod:`sqlite3` features, deprecated in Python " "3.10, are now removed:" msgstr "" -#: ../../whatsnew/3.12.rst:1534 +#: ../../whatsnew/3.12.rst:1535 msgid "``sqlite3.enable_shared_cache()``" msgstr "``sqlite3.enable_shared_cache()``" -#: ../../whatsnew/3.12.rst:1535 +#: ../../whatsnew/3.12.rst:1536 msgid "``sqlite3.OptimizedUnicode``" msgstr "``sqlite3.OptimizedUnicode``" -#: ../../whatsnew/3.12.rst:1537 +#: ../../whatsnew/3.12.rst:1538 msgid "" "If a shared cache must be used, open the database in URI mode using the " "``cache=shared`` query parameter." msgstr "" -#: ../../whatsnew/3.12.rst:1540 +#: ../../whatsnew/3.12.rst:1541 msgid "" "The ``sqlite3.OptimizedUnicode`` text factory has been an alias for :class:" "`str` since Python 3.3. Code that previously set the text factory to " @@ -3426,22 +3460,22 @@ msgid "" "default value which is also ``str``." msgstr "" -#: ../../whatsnew/3.12.rst:1545 +#: ../../whatsnew/3.12.rst:1546 msgid "(Contributed by Erlend E. Aasland in :gh:`92548`.)" msgstr "(由 Erlend E. Aasland 於 :gh:`92548` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1548 +#: ../../whatsnew/3.12.rst:1549 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.12.rst:1550 +#: ../../whatsnew/3.12.rst:1551 msgid "" "Remove :mod:`ssl`'s :func:`!ssl.RAND_pseudo_bytes` function, deprecated in " "Python 3.6: use :func:`os.urandom` or :func:`ssl.RAND_bytes` instead. " "(Contributed by Victor Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1554 +#: ../../whatsnew/3.12.rst:1555 msgid "" "Remove the :func:`!ssl.match_hostname` function. It was deprecated in Python " "3.7. OpenSSL performs hostname matching since Python 3.7, Python no longer " @@ -3449,7 +3483,7 @@ msgid "" "Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1560 +#: ../../whatsnew/3.12.rst:1561 msgid "" "Remove the :func:`!ssl.wrap_socket` function, deprecated in Python 3.7: " "instead, create a :class:`ssl.SSLContext` object and call its :class:`ssl." @@ -3460,189 +3494,189 @@ msgid "" "`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1571 +#: ../../whatsnew/3.12.rst:1572 msgid "Remove many long-deprecated :mod:`unittest` features:" msgstr "移除許多 :mod:`unittest` 中被棄用已久的功能:" -#: ../../whatsnew/3.12.rst:1575 +#: ../../whatsnew/3.12.rst:1576 msgid "A number of :class:`~unittest.TestCase` method aliases:" msgstr "許多 :class:`~unittest.TestCase` 方法別名:" -#: ../../whatsnew/3.12.rst:1578 +#: ../../whatsnew/3.12.rst:1579 msgid "Deprecated alias" msgstr "已棄用的別名" -#: ../../whatsnew/3.12.rst:1578 +#: ../../whatsnew/3.12.rst:1579 msgid "Method Name" msgstr "方法名稱" -#: ../../whatsnew/3.12.rst:1578 +#: ../../whatsnew/3.12.rst:1579 msgid "Deprecated in" msgstr "已棄用於" -#: ../../whatsnew/3.12.rst:1580 +#: ../../whatsnew/3.12.rst:1581 msgid "``failUnless``" msgstr "``failUnless``" -#: ../../whatsnew/3.12.rst:1580 ../../whatsnew/3.12.rst:1587 +#: ../../whatsnew/3.12.rst:1581 ../../whatsnew/3.12.rst:1588 msgid ":meth:`.assertTrue`" msgstr ":meth:`.assertTrue`" -#: ../../whatsnew/3.12.rst:1580 ../../whatsnew/3.12.rst:1581 -#: ../../whatsnew/3.12.rst:1582 ../../whatsnew/3.12.rst:1583 -#: ../../whatsnew/3.12.rst:1584 ../../whatsnew/3.12.rst:1585 -#: ../../whatsnew/3.12.rst:1586 +#: ../../whatsnew/3.12.rst:1581 ../../whatsnew/3.12.rst:1582 +#: ../../whatsnew/3.12.rst:1583 ../../whatsnew/3.12.rst:1584 +#: ../../whatsnew/3.12.rst:1585 ../../whatsnew/3.12.rst:1586 +#: ../../whatsnew/3.12.rst:1587 msgid "3.1" msgstr "3.1" -#: ../../whatsnew/3.12.rst:1581 +#: ../../whatsnew/3.12.rst:1582 msgid "``failIf``" msgstr "``failIf``" -#: ../../whatsnew/3.12.rst:1581 +#: ../../whatsnew/3.12.rst:1582 msgid ":meth:`.assertFalse`" msgstr ":meth:`.assertFalse`" -#: ../../whatsnew/3.12.rst:1582 +#: ../../whatsnew/3.12.rst:1583 msgid "``failUnlessEqual``" msgstr "``failUnlessEqual``" -#: ../../whatsnew/3.12.rst:1582 ../../whatsnew/3.12.rst:1588 +#: ../../whatsnew/3.12.rst:1583 ../../whatsnew/3.12.rst:1589 msgid ":meth:`.assertEqual`" msgstr ":meth:`.assertEqual`" -#: ../../whatsnew/3.12.rst:1583 +#: ../../whatsnew/3.12.rst:1584 msgid "``failIfEqual``" msgstr "``failIfEqual``" -#: ../../whatsnew/3.12.rst:1583 ../../whatsnew/3.12.rst:1589 +#: ../../whatsnew/3.12.rst:1584 ../../whatsnew/3.12.rst:1590 msgid ":meth:`.assertNotEqual`" msgstr ":meth:`.assertNotEqual`" -#: ../../whatsnew/3.12.rst:1584 +#: ../../whatsnew/3.12.rst:1585 msgid "``failUnlessAlmostEqual``" msgstr "``failUnlessAlmostEqual``" -#: ../../whatsnew/3.12.rst:1584 ../../whatsnew/3.12.rst:1590 +#: ../../whatsnew/3.12.rst:1585 ../../whatsnew/3.12.rst:1591 msgid ":meth:`.assertAlmostEqual`" msgstr ":meth:`.assertAlmostEqual`" -#: ../../whatsnew/3.12.rst:1585 +#: ../../whatsnew/3.12.rst:1586 msgid "``failIfAlmostEqual``" msgstr "``failIfAlmostEqual``" -#: ../../whatsnew/3.12.rst:1585 ../../whatsnew/3.12.rst:1591 +#: ../../whatsnew/3.12.rst:1586 ../../whatsnew/3.12.rst:1592 msgid ":meth:`.assertNotAlmostEqual`" msgstr ":meth:`.assertNotAlmostEqual`" -#: ../../whatsnew/3.12.rst:1586 +#: ../../whatsnew/3.12.rst:1587 msgid "``failUnlessRaises``" msgstr "``failUnlessRaises``" -#: ../../whatsnew/3.12.rst:1586 +#: ../../whatsnew/3.12.rst:1587 msgid ":meth:`.assertRaises`" msgstr ":meth:`.assertRaises`" -#: ../../whatsnew/3.12.rst:1587 +#: ../../whatsnew/3.12.rst:1588 msgid "``assert_``" msgstr "``assert_``" -#: ../../whatsnew/3.12.rst:1587 ../../whatsnew/3.12.rst:1588 -#: ../../whatsnew/3.12.rst:1589 ../../whatsnew/3.12.rst:1590 -#: ../../whatsnew/3.12.rst:1591 ../../whatsnew/3.12.rst:1592 -#: ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1588 ../../whatsnew/3.12.rst:1589 +#: ../../whatsnew/3.12.rst:1590 ../../whatsnew/3.12.rst:1591 +#: ../../whatsnew/3.12.rst:1592 ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1594 msgid "3.2" msgstr "3.2" -#: ../../whatsnew/3.12.rst:1588 +#: ../../whatsnew/3.12.rst:1589 msgid "``assertEquals``" msgstr "``assertEquals``" -#: ../../whatsnew/3.12.rst:1589 +#: ../../whatsnew/3.12.rst:1590 msgid "``assertNotEquals``" msgstr "``assertNotEquals``" -#: ../../whatsnew/3.12.rst:1590 +#: ../../whatsnew/3.12.rst:1591 msgid "``assertAlmostEquals``" msgstr "``assertAlmostEquals``" -#: ../../whatsnew/3.12.rst:1591 +#: ../../whatsnew/3.12.rst:1592 msgid "``assertNotAlmostEquals``" msgstr "``assertNotAlmostEquals``" -#: ../../whatsnew/3.12.rst:1592 +#: ../../whatsnew/3.12.rst:1593 msgid "``assertRegexpMatches``" msgstr "``assertRegexpMatches``" -#: ../../whatsnew/3.12.rst:1592 +#: ../../whatsnew/3.12.rst:1593 msgid ":meth:`.assertRegex`" msgstr ":meth:`.assertRegex`" -#: ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1594 msgid "``assertRaisesRegexp``" msgstr "``assertRaisesRegexp``" -#: ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1594 msgid ":meth:`.assertRaisesRegex`" msgstr ":meth:`.assertRaisesRegex`" -#: ../../whatsnew/3.12.rst:1594 +#: ../../whatsnew/3.12.rst:1595 msgid "``assertNotRegexpMatches``" msgstr "``assertNotRegexpMatches``" -#: ../../whatsnew/3.12.rst:1594 +#: ../../whatsnew/3.12.rst:1595 msgid ":meth:`.assertNotRegex`" msgstr ":meth:`.assertNotRegex`" -#: ../../whatsnew/3.12.rst:1594 +#: ../../whatsnew/3.12.rst:1595 msgid "3.5" msgstr "3.5" -#: ../../whatsnew/3.12.rst:1597 +#: ../../whatsnew/3.12.rst:1598 msgid "" "You can use https://github.com/isidentical/teyit to automatically modernise " "your unit tests." msgstr "" -#: ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1601 msgid "" "Undocumented and broken :class:`~unittest.TestCase` method " "``assertDictContainsSubset`` (deprecated in Python 3.2)." msgstr "" -#: ../../whatsnew/3.12.rst:1603 +#: ../../whatsnew/3.12.rst:1604 msgid "" "Undocumented :meth:`TestLoader.loadTestsFromModule ` parameter *use_load_tests* (deprecated and ignored " "since Python 3.5)." msgstr "" -#: ../../whatsnew/3.12.rst:1607 +#: ../../whatsnew/3.12.rst:1608 msgid "" "An alias of the :class:`~unittest.TextTestResult` class: ``_TextTestResult`` " "(deprecated in Python 3.2)." msgstr "" -#: ../../whatsnew/3.12.rst:1610 +#: ../../whatsnew/3.12.rst:1611 msgid "(Contributed by Serhiy Storchaka in :gh:`89325`.)" msgstr "(由 Serhiy Storchaka 於 :gh:`89325` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1613 +#: ../../whatsnew/3.12.rst:1614 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.12.rst:1615 +#: ../../whatsnew/3.12.rst:1616 msgid "" "Remove support for obsolete browsers from :mod:`webbrowser`. The removed " "browsers include: Grail, Mosaic, Netscape, Galeon, Skipstone, Iceape, " "Firebird, and Firefox versions 35 and below (:gh:`102871`)." msgstr "" -#: ../../whatsnew/3.12.rst:1620 +#: ../../whatsnew/3.12.rst:1621 msgid "xml.etree.ElementTree" msgstr "xml.etree.ElementTree" -#: ../../whatsnew/3.12.rst:1622 +#: ../../whatsnew/3.12.rst:1623 msgid "" "Remove the ``ElementTree.Element.copy()`` method of the pure Python " "implementation, deprecated in Python 3.10, use the :func:`copy.copy` " @@ -3651,22 +3685,22 @@ msgid "" "Stinner in :gh:`94383`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1629 +#: ../../whatsnew/3.12.rst:1630 msgid "zipimport" msgstr "zipimport" -#: ../../whatsnew/3.12.rst:1631 +#: ../../whatsnew/3.12.rst:1632 msgid "" "Remove :mod:`zipimport`'s ``find_loader()`` and ``find_module()`` methods, " "deprecated in Python 3.10: use the ``find_spec()`` method instead. See :pep:" "`451` for the rationale. (Contributed by Victor Stinner in :gh:`94379`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1637 +#: ../../whatsnew/3.12.rst:1638 msgid "Others" msgstr "其他" -#: ../../whatsnew/3.12.rst:1639 +#: ../../whatsnew/3.12.rst:1640 msgid "" "Remove the ``suspicious`` rule from the documentation :file:`Makefile` and :" "file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint `, " "intended for low-level tools like debuggers and JIT compilers. This API may " @@ -3966,15 +4000,15 @@ msgid "" "contents are marked by the ``PyUnstable_`` prefix in names." msgstr "" -#: ../../whatsnew/3.12.rst:1835 +#: ../../whatsnew/3.12.rst:1836 msgid "Code object constructors:" msgstr "程式碼物件建構函式:" -#: ../../whatsnew/3.12.rst:1837 +#: ../../whatsnew/3.12.rst:1838 msgid "``PyUnstable_Code_New()`` (renamed from ``PyCode_New``)" msgstr "``PyUnstable_Code_New()``\\ (自 ``PyCode_New`` 重新命名)" -#: ../../whatsnew/3.12.rst:1838 +#: ../../whatsnew/3.12.rst:1839 msgid "" "``PyUnstable_Code_NewWithPosOnlyArgs()`` (renamed from " "``PyCode_NewWithPosOnlyArgs``)" @@ -3982,11 +4016,11 @@ msgstr "" "``PyUnstable_Code_NewWithPosOnlyArgs()``\\ (自 " "``PyCode_NewWithPosOnlyArgs`` 重新命名)" -#: ../../whatsnew/3.12.rst:1840 +#: ../../whatsnew/3.12.rst:1841 msgid "Extra storage for code objects (:pep:`523`):" msgstr "程式碼物件的額外儲存 (:pep:`523`):" -#: ../../whatsnew/3.12.rst:1842 +#: ../../whatsnew/3.12.rst:1843 msgid "" "``PyUnstable_Eval_RequestCodeExtraIndex()`` (renamed from " "``_PyEval_RequestCodeExtraIndex``)" @@ -3994,31 +4028,31 @@ msgstr "" "``PyUnstable_Eval_RequestCodeExtraIndex()``\\ (自 " "``_PyEval_RequestCodeExtraIndex`` 重新命名)" -#: ../../whatsnew/3.12.rst:1843 +#: ../../whatsnew/3.12.rst:1844 msgid "``PyUnstable_Code_GetExtra()`` (renamed from ``_PyCode_GetExtra``)" msgstr "``PyUnstable_Code_GetExtra()``\\ (自 ``_PyCode_GetExtra`` 重新命名)" -#: ../../whatsnew/3.12.rst:1844 +#: ../../whatsnew/3.12.rst:1845 msgid "``PyUnstable_Code_SetExtra()`` (renamed from ``_PyCode_SetExtra``)" msgstr "``PyUnstable_Code_SetExtra()``\\ (自 ``_PyCode_SetExtra`` 重新命名)" -#: ../../whatsnew/3.12.rst:1846 +#: ../../whatsnew/3.12.rst:1847 msgid "" "The original names will continue to be available until the respective API " "changes." msgstr "原始名稱將可繼續使用,直到相應的 API 發生變更。" -#: ../../whatsnew/3.12.rst:1849 +#: ../../whatsnew/3.12.rst:1850 msgid "(Contributed by Petr Viktorin in :gh:`101101`.)" msgstr "(由 Petr Viktorin 於 :gh:`101101` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1851 +#: ../../whatsnew/3.12.rst:1852 msgid "" ":pep:`697`: Add an API for extending types whose instance memory layout is " "opaque:" msgstr "" -#: ../../whatsnew/3.12.rst:1854 +#: ../../whatsnew/3.12.rst:1855 msgid "" ":c:member:`PyType_Spec.basicsize` can be zero or negative to specify " "inheriting or extending the base class size." @@ -4026,30 +4060,30 @@ msgstr "" ":c:member:`PyType_Spec.basicsize` 可以為零或負數來指定繼承或擴充基底類別大" "小。" -#: ../../whatsnew/3.12.rst:1856 +#: ../../whatsnew/3.12.rst:1857 msgid "" ":c:func:`PyObject_GetTypeData` and :c:func:`PyType_GetTypeDataSize` added to " "allow access to subclass-specific instance data." msgstr "" -#: ../../whatsnew/3.12.rst:1858 +#: ../../whatsnew/3.12.rst:1859 msgid "" ":c:macro:`Py_TPFLAGS_ITEMS_AT_END` and :c:func:`PyObject_GetItemData` added " "to allow safely extending certain variable-sized types, including :c:var:" "`PyType_Type`." msgstr "" -#: ../../whatsnew/3.12.rst:1861 +#: ../../whatsnew/3.12.rst:1862 msgid "" ":c:macro:`Py_RELATIVE_OFFSET` added to allow defining :c:type:`members " "` in terms of a subclass-specific struct." msgstr "" -#: ../../whatsnew/3.12.rst:1864 +#: ../../whatsnew/3.12.rst:1865 msgid "(Contributed by Petr Viktorin in :gh:`103509`.)" msgstr "(由 Petr Viktorin 於 :gh:`103509` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1866 +#: ../../whatsnew/3.12.rst:1867 msgid "" "Add the new :ref:`limited C API ` function :c:func:" "`PyType_FromMetaclass`, which generalizes the existing :c:func:" @@ -4057,29 +4091,29 @@ msgid "" "(Contributed by Wenzel Jakob in :gh:`93012`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1871 +#: ../../whatsnew/3.12.rst:1872 msgid "" "API for creating objects that can be called using :ref:`the vectorcall " "protocol ` was added to the :ref:`Limited API `:" msgstr "" -#: ../../whatsnew/3.12.rst:1875 +#: ../../whatsnew/3.12.rst:1876 msgid ":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`" msgstr ":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`" -#: ../../whatsnew/3.12.rst:1876 +#: ../../whatsnew/3.12.rst:1877 msgid ":c:func:`PyVectorcall_NARGS`" msgstr ":c:func:`PyVectorcall_NARGS`" -#: ../../whatsnew/3.12.rst:1877 +#: ../../whatsnew/3.12.rst:1878 msgid ":c:func:`PyVectorcall_Call`" msgstr ":c:func:`PyVectorcall_Call`" -#: ../../whatsnew/3.12.rst:1878 +#: ../../whatsnew/3.12.rst:1879 msgid ":c:type:`vectorcallfunc`" msgstr ":c:type:`vectorcallfunc`" -#: ../../whatsnew/3.12.rst:1880 +#: ../../whatsnew/3.12.rst:1881 msgid "" "The :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class " "when the class's :py:meth:`~object.__call__` method is reassigned. This " @@ -4090,7 +4124,7 @@ msgid "" "`93274`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1888 +#: ../../whatsnew/3.12.rst:1889 msgid "" "The :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows extensions " @@ -4098,32 +4132,32 @@ msgid "" "bookkeeping, using less memory and with faster access." msgstr "" -#: ../../whatsnew/3.12.rst:1893 +#: ../../whatsnew/3.12.rst:1894 msgid "" "API for performing calls using :ref:`the vectorcall protocol ` " "was added to the :ref:`Limited API `:" msgstr "" -#: ../../whatsnew/3.12.rst:1897 +#: ../../whatsnew/3.12.rst:1898 msgid ":c:func:`PyObject_Vectorcall`" msgstr ":c:func:`PyObject_Vectorcall`" -#: ../../whatsnew/3.12.rst:1898 +#: ../../whatsnew/3.12.rst:1899 msgid ":c:func:`PyObject_VectorcallMethod`" msgstr ":c:func:`PyObject_VectorcallMethod`" -#: ../../whatsnew/3.12.rst:1899 +#: ../../whatsnew/3.12.rst:1900 msgid ":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`" msgstr ":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`" -#: ../../whatsnew/3.12.rst:1901 +#: ../../whatsnew/3.12.rst:1902 msgid "" "This means that both the incoming and outgoing ends of the vector call " "protocol are now available in the :ref:`Limited API `. (Contributed " "by Wenzel Jakob in :gh:`98586`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1905 +#: ../../whatsnew/3.12.rst:1906 msgid "" "Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` and :c:" "func:`PyEval_SetTraceAllThreads`, that allow to set tracing and profiling " @@ -4131,14 +4165,14 @@ msgid "" "(Contributed by Pablo Galindo in :gh:`93503`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1911 +#: ../../whatsnew/3.12.rst:1912 msgid "" "Add new function :c:func:`PyFunction_SetVectorcall` to the C API which sets " "the vectorcall field of a given :c:type:`PyFunctionObject`. (Contributed by " "Andrew Frost in :gh:`92257`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1915 +#: ../../whatsnew/3.12.rst:1916 msgid "" "The C API now permits registering callbacks via :c:func:" "`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to be called " @@ -4147,28 +4181,28 @@ msgid "" "`91052`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1921 +#: ../../whatsnew/3.12.rst:1922 msgid "" "Add :c:func:`PyType_AddWatcher` and :c:func:`PyType_Watch` API to register " "callbacks to receive notification on changes to a type. (Contributed by Carl " "Meyer in :gh:`91051`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1925 +#: ../../whatsnew/3.12.rst:1926 msgid "" "Add :c:func:`PyCode_AddWatcher` and :c:func:`PyCode_ClearWatcher` APIs to " "register callbacks to receive notification on creation and destruction of " "code objects. (Contributed by Itamar Oren in :gh:`91054`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1930 +#: ../../whatsnew/3.12.rst:1931 msgid "" "Add :c:func:`PyFrame_GetVar` and :c:func:`PyFrame_GetVarString` functions to " "get a frame variable by its name. (Contributed by Victor Stinner in :gh:" "`91248`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1934 +#: ../../whatsnew/3.12.rst:1935 msgid "" "Add :c:func:`PyErr_GetRaisedException` and :c:func:" "`PyErr_SetRaisedException` for saving and restoring the current exception. " @@ -4178,14 +4212,14 @@ msgid "" "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1942 +#: ../../whatsnew/3.12.rst:1943 msgid "" "Add ``_PyErr_ChainExceptions1``, which takes an exception instance, to " "replace the legacy-API ``_PyErr_ChainExceptions``, which is now deprecated. " "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1946 +#: ../../whatsnew/3.12.rst:1947 msgid "" "Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs` as " "convenience functions for retrieving and modifying the :attr:`~BaseException." @@ -4193,71 +4227,71 @@ msgid "" "in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1951 +#: ../../whatsnew/3.12.rst:1952 msgid "" "Add :c:func:`PyErr_DisplayException`, which takes an exception instance, to " "replace the legacy-api :c:func:`!PyErr_Display`. (Contributed by Irit " "Katriel in :gh:`102755`)." msgstr "" -#: ../../whatsnew/3.12.rst:1957 +#: ../../whatsnew/3.12.rst:1958 msgid "" ":pep:`683`: Introduce *Immortal Objects*, which allows objects to bypass " "reference counts, and related changes to the C-API:" msgstr "" -#: ../../whatsnew/3.12.rst:1960 +#: ../../whatsnew/3.12.rst:1961 msgid "``_Py_IMMORTAL_REFCNT``: The reference count that defines an object" msgstr "``_Py_IMMORTAL_REFCNT``:定義物件的參照計數" -#: ../../whatsnew/3.12.rst:1961 +#: ../../whatsnew/3.12.rst:1962 msgid "as immortal." msgstr "" -#: ../../whatsnew/3.12.rst:1962 +#: ../../whatsnew/3.12.rst:1963 msgid "" "``_Py_IsImmortal`` Checks if an object has the immortal reference count." msgstr "" -#: ../../whatsnew/3.12.rst:1963 +#: ../../whatsnew/3.12.rst:1964 msgid "``PyObject_HEAD_INIT`` This will now initialize reference count to" msgstr "``PyObject_HEAD_INIT`` 這現在將初始化參照計數" -#: ../../whatsnew/3.12.rst:1964 +#: ../../whatsnew/3.12.rst:1965 msgid "``_Py_IMMORTAL_REFCNT`` when used with ``Py_BUILD_CORE``." msgstr "``_Py_IMMORTAL_REFCNT``\\ (與 ``Py_BUILD_CORE`` 一起使用時)。" -#: ../../whatsnew/3.12.rst:1965 +#: ../../whatsnew/3.12.rst:1966 msgid "``SSTATE_INTERNED_IMMORTAL`` An identifier for interned unicode objects" msgstr "" -#: ../../whatsnew/3.12.rst:1966 +#: ../../whatsnew/3.12.rst:1967 msgid "that are immortal." msgstr "" -#: ../../whatsnew/3.12.rst:1967 +#: ../../whatsnew/3.12.rst:1968 msgid "``SSTATE_INTERNED_IMMORTAL_STATIC`` An identifier for interned unicode" msgstr "" -#: ../../whatsnew/3.12.rst:1968 +#: ../../whatsnew/3.12.rst:1969 msgid "objects that are immortal and static" msgstr "" -#: ../../whatsnew/3.12.rst:1969 +#: ../../whatsnew/3.12.rst:1970 msgid "``sys.getunicodeinternedsize`` This returns the total number of unicode" msgstr "" -#: ../../whatsnew/3.12.rst:1970 +#: ../../whatsnew/3.12.rst:1971 msgid "" "objects that have been interned. This is now needed for :file:`refleak.py` " "to correctly track reference counts and allocated blocks" msgstr "" -#: ../../whatsnew/3.12.rst:1973 +#: ../../whatsnew/3.12.rst:1974 msgid "(Contributed by Eddie Elizondo in :gh:`84436`.)" msgstr "(由 Eddie Elizondo 於 :gh:`84436` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1975 +#: ../../whatsnew/3.12.rst:1976 msgid "" ":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function and :" "c:type:`PyInterpreterConfig`, which may be used to create sub-interpreters " @@ -4265,27 +4299,27 @@ msgid "" "(Contributed by Eric Snow in :gh:`104110`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1981 +#: ../../whatsnew/3.12.rst:1982 msgid "" "In the limited C API version 3.12, :c:func:`Py_INCREF` and :c:func:" "`Py_DECREF` functions are now implemented as opaque function calls to hide " "implementation details. (Contributed by Victor Stinner in :gh:`105387`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1989 +#: ../../whatsnew/3.12.rst:1990 msgid "" "Legacy Unicode APIs based on ``Py_UNICODE*`` representation has been " "removed. Please migrate to APIs based on UTF-8 or ``wchar_t*``." msgstr "" -#: ../../whatsnew/3.12.rst:1992 +#: ../../whatsnew/3.12.rst:1993 msgid "" "Argument parsing functions like :c:func:`PyArg_ParseTuple` doesn't support " "``Py_UNICODE*`` based format (e.g. ``u``, ``Z``) anymore. Please migrate to " "other formats for Unicode like ``s``, ``z``, ``es``, and ``U``." msgstr "" -#: ../../whatsnew/3.12.rst:1996 +#: ../../whatsnew/3.12.rst:1997 msgid "" "``tp_weaklist`` for all static builtin types is always ``NULL``. This is an " "internal-only field on ``PyTypeObject`` but we're pointing out the change in " @@ -4294,7 +4328,7 @@ msgid "" "necessary, the (internal-only) ``_PyObject_GET_WEAKREFS_LISTPTR()`` macro." msgstr "" -#: ../../whatsnew/3.12.rst:2003 +#: ../../whatsnew/3.12.rst:2004 msgid "" "This internal-only :c:member:`PyTypeObject.tp_subclasses` may now not be a " "valid object pointer. Its type was changed to :c:expr:`void *` to reflect " @@ -4302,13 +4336,13 @@ msgid "" "only field directly." msgstr "" -#: ../../whatsnew/3.12.rst:2008 +#: ../../whatsnew/3.12.rst:2009 msgid "" "To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__` (using :c:func:`PyObject_CallMethod`, for example)." msgstr "" -#: ../../whatsnew/3.12.rst:2012 +#: ../../whatsnew/3.12.rst:2013 msgid "" "Add support of more formatting options (left aligning, octals, uppercase " "hexadecimals, :c:type:`intmax_t`, :c:type:`ptrdiff_t`, :c:type:`wchar_t` C " @@ -4317,7 +4351,7 @@ msgid "" "`98836`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2018 +#: ../../whatsnew/3.12.rst:2019 msgid "" "An unrecognized format character in :c:func:`PyUnicode_FromFormat` and :c:" "func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In previous " @@ -4326,13 +4360,13 @@ msgid "" "Storchaka in :gh:`95781`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2024 +#: ../../whatsnew/3.12.rst:2025 msgid "" "Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` and :c:func:" "`PyUnicode_FromFormatV`. (Contributed by Philip Georgi in :gh:`95504`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2028 +#: ../../whatsnew/3.12.rst:2029 msgid "" "Extension classes wanting to add a :attr:`~object.__dict__` or weak " "reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" @@ -4346,7 +4380,7 @@ msgid "" "func:`PyObject_ClearWeakRefs`, as before." msgstr "" -#: ../../whatsnew/3.12.rst:2040 +#: ../../whatsnew/3.12.rst:2041 msgid "" "The :c:func:`PyUnicode_FSDecoder` function no longer accepts bytes-like " "paths, like :class:`bytearray` and :class:`memoryview` types: only the " @@ -4354,7 +4388,7 @@ msgid "" "Victor Stinner in :gh:`98393`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2045 +#: ../../whatsnew/3.12.rst:2046 msgid "" "The :c:macro:`Py_CLEAR`, :c:macro:`Py_SETREF` and :c:macro:`Py_XSETREF` " "macros now only evaluate their arguments once. If an argument has side " @@ -4362,7 +4396,7 @@ msgid "" "Stinner in :gh:`98724`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2050 +#: ../../whatsnew/3.12.rst:2051 msgid "" "The interpreter's error indicator is now always normalized. This means that :" "c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other functions " @@ -4370,7 +4404,7 @@ msgid "" "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2055 +#: ../../whatsnew/3.12.rst:2056 msgid "" "``_Py_RefTotal`` is no longer authoritative and only kept around for ABI " "compatibility. Note that it is an internal global and only available on " @@ -4378,25 +4412,25 @@ msgid "" "``_Py_GetGlobalRefTotal()``." msgstr "" -#: ../../whatsnew/3.12.rst:2060 +#: ../../whatsnew/3.12.rst:2061 msgid "" "The following functions now select an appropriate metaclass for the newly " "created type:" msgstr "" -#: ../../whatsnew/3.12.rst:2063 +#: ../../whatsnew/3.12.rst:2064 msgid ":c:func:`PyType_FromSpec`" msgstr ":c:func:`PyType_FromSpec`" -#: ../../whatsnew/3.12.rst:2064 +#: ../../whatsnew/3.12.rst:2065 msgid ":c:func:`PyType_FromSpecWithBases`" msgstr ":c:func:`PyType_FromSpecWithBases`" -#: ../../whatsnew/3.12.rst:2065 +#: ../../whatsnew/3.12.rst:2066 msgid ":c:func:`PyType_FromModuleAndSpec`" msgstr ":c:func:`PyType_FromModuleAndSpec`" -#: ../../whatsnew/3.12.rst:2067 +#: ../../whatsnew/3.12.rst:2068 msgid "" "Creating classes whose metaclass overrides :c:member:`~PyTypeObject.tp_new` " "is deprecated, and in Python 3.14+ it will be disallowed. Note that these " @@ -4404,14 +4438,14 @@ msgid "" "initialization." msgstr "" -#: ../../whatsnew/3.12.rst:2072 +#: ../../whatsnew/3.12.rst:2073 msgid "" "Note that :c:func:`PyType_FromMetaclass` (added in Python 3.12) already " "disallows creating classes whose metaclass overrides ``tp_new`` (:meth:" "`~object.__new__` in Python)." msgstr "" -#: ../../whatsnew/3.12.rst:2076 +#: ../../whatsnew/3.12.rst:2077 msgid "" "Since ``tp_new`` overrides almost everything ``PyType_From*`` functions do, " "the two are incompatible with each other. The existing behavior -- ignoring " @@ -4420,17 +4454,17 @@ msgid "" "general workaround. One of the following may work for you:" msgstr "" -#: ../../whatsnew/3.12.rst:2083 +#: ../../whatsnew/3.12.rst:2084 msgid "If you control the metaclass, avoid using ``tp_new`` in it:" msgstr "" -#: ../../whatsnew/3.12.rst:2085 +#: ../../whatsnew/3.12.rst:2086 msgid "" "If initialization can be skipped, it can be done in :c:member:`~PyTypeObject." "tp_init` instead." msgstr "" -#: ../../whatsnew/3.12.rst:2087 +#: ../../whatsnew/3.12.rst:2088 msgid "" "If the metaclass doesn't need to be instantiated from Python, set its " "``tp_new`` to ``NULL`` using the :c:macro:" @@ -4438,20 +4472,20 @@ msgid "" "``PyType_From*`` functions." msgstr "" -#: ../../whatsnew/3.12.rst:2092 +#: ../../whatsnew/3.12.rst:2093 msgid "" "Avoid ``PyType_From*`` functions: if you don't need C-specific features " "(slots or setting the instance size), create types by :ref:`calling ` " "the metaclass." msgstr "" -#: ../../whatsnew/3.12.rst:2096 +#: ../../whatsnew/3.12.rst:2097 msgid "" "If you *know* the ``tp_new`` can be skipped safely, filter the deprecation " "warning out using :func:`warnings.catch_warnings` from Python." msgstr "" -#: ../../whatsnew/3.12.rst:2099 +#: ../../whatsnew/3.12.rst:2100 msgid "" ":c:var:`PyOS_InputHook` and :c:var:`PyOS_ReadlineFunctionPointer` are no " "longer called in :ref:`subinterpreters `. This is " @@ -4459,14 +4493,14 @@ msgid "" "callbacks have no way of recovering extension module state)." msgstr "" -#: ../../whatsnew/3.12.rst:2104 +#: ../../whatsnew/3.12.rst:2105 msgid "" "This also avoids situations where extensions may find themselves running in " "a subinterpreter that they don't support (or haven't yet been loaded in). " "See :gh:`104668` for more info." msgstr "" -#: ../../whatsnew/3.12.rst:2108 +#: ../../whatsnew/3.12.rst:2109 msgid "" ":c:struct:`PyLongObject` has had its internals changed for better " "performance. Although the internals of :c:struct:`PyLongObject` are private, " @@ -4477,15 +4511,15 @@ msgid "" "a single machine word:" msgstr "" -#: ../../whatsnew/3.12.rst:2116 +#: ../../whatsnew/3.12.rst:2117 msgid ":c:func:`PyUnstable_Long_IsCompact`" msgstr ":c:func:`PyUnstable_Long_IsCompact`" -#: ../../whatsnew/3.12.rst:2117 +#: ../../whatsnew/3.12.rst:2118 msgid ":c:func:`PyUnstable_Long_CompactValue`" msgstr ":c:func:`PyUnstable_Long_CompactValue`" -#: ../../whatsnew/3.12.rst:2119 +#: ../../whatsnew/3.12.rst:2120 msgid "" "Custom allocators, set via :c:func:`PyMem_SetAllocator`, are now required to " "be thread-safe, regardless of memory domain. Allocators that don't have " @@ -4494,7 +4528,7 @@ msgid "" "create a new GitHub issue and CC ``@ericsnowcurrently``." msgstr "" -#: ../../whatsnew/3.12.rst:2129 +#: ../../whatsnew/3.12.rst:2130 msgid "" "In accordance with :pep:`699`, the ``ma_version_tag`` field in :c:type:" "`PyDictObject` is deprecated for extension modules. Accessing this field " @@ -4503,76 +4537,76 @@ msgid "" "PEP by Ken Jin.)" msgstr "" -#: ../../whatsnew/3.12.rst:2134 +#: ../../whatsnew/3.12.rst:2135 msgid "Deprecate global configuration variable:" msgstr "棄用全域配置變數:" -#: ../../whatsnew/3.12.rst:2136 +#: ../../whatsnew/3.12.rst:2137 msgid ":c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug`" msgstr ":c:var:`Py_DebugFlag`: 請改用 :c:member:`PyConfig.parser_debug`" -#: ../../whatsnew/3.12.rst:2137 +#: ../../whatsnew/3.12.rst:2138 msgid ":c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose`" msgstr ":c:var:`Py_VerboseFlag`: 請改用 :c:member:`PyConfig.verbose`" -#: ../../whatsnew/3.12.rst:2138 +#: ../../whatsnew/3.12.rst:2139 msgid ":c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet`" msgstr ":c:var:`Py_QuietFlag`: 請改用 :c:member:`PyConfig.quiet`" -#: ../../whatsnew/3.12.rst:2139 +#: ../../whatsnew/3.12.rst:2140 msgid ":c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive`" msgstr ":c:var:`Py_InteractiveFlag`: 請改用 :c:member:`PyConfig.interactive`" -#: ../../whatsnew/3.12.rst:2140 +#: ../../whatsnew/3.12.rst:2141 msgid ":c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect`" msgstr ":c:var:`Py_InspectFlag`: 請改用 :c:member:`PyConfig.inspect`" -#: ../../whatsnew/3.12.rst:2141 +#: ../../whatsnew/3.12.rst:2142 msgid ":c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level`" msgstr "" ":c:var:`Py_OptimizeFlag`: 請改用 :c:member:`PyConfig.optimization_level`" -#: ../../whatsnew/3.12.rst:2142 +#: ../../whatsnew/3.12.rst:2143 msgid ":c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import`" msgstr ":c:var:`Py_NoSiteFlag`: 請改用 :c:member:`PyConfig.site_import`" -#: ../../whatsnew/3.12.rst:2143 +#: ../../whatsnew/3.12.rst:2144 msgid ":c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning`" msgstr "" ":c:var:`Py_BytesWarningFlag`: 請改用 :c:member:`PyConfig.bytes_warning`" -#: ../../whatsnew/3.12.rst:2144 +#: ../../whatsnew/3.12.rst:2145 msgid ":c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings`" msgstr "" ":c:var:`Py_FrozenFlag`: 請改用 :c:member:`PyConfig.pathconfig_warnings`" -#: ../../whatsnew/3.12.rst:2145 +#: ../../whatsnew/3.12.rst:2146 msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment`" msgstr "" ":c:var:`Py_IgnoreEnvironmentFlag`: 請改用 :c:member:`PyConfig." "use_environment`" -#: ../../whatsnew/3.12.rst:2146 +#: ../../whatsnew/3.12.rst:2147 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode`" msgstr "" ":c:var:`Py_DontWriteBytecodeFlag`: 請改用 :c:member:`PyConfig.write_bytecode`" -#: ../../whatsnew/3.12.rst:2147 +#: ../../whatsnew/3.12.rst:2148 msgid "" ":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig.user_site_directory`" msgstr "" ":c:var:`Py_NoUserSiteDirectory`: 請改用 :c:member:`PyConfig." "user_site_directory`" -#: ../../whatsnew/3.12.rst:2148 +#: ../../whatsnew/3.12.rst:2149 msgid "" ":c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio`" msgstr "" ":c:var:`Py_UnbufferedStdioFlag`: 請改用 :c:member:`PyConfig.buffered_stdio`" -#: ../../whatsnew/3.12.rst:2149 +#: ../../whatsnew/3.12.rst:2150 msgid "" ":c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed`" @@ -4580,11 +4614,11 @@ msgstr "" ":c:var:`Py_HashRandomizationFlag`: 請改用 :c:member:`PyConfig.use_hash_seed` " "和 :c:member:`PyConfig.hash_seed`" -#: ../../whatsnew/3.12.rst:2151 +#: ../../whatsnew/3.12.rst:2152 msgid ":c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated`" msgstr ":c:var:`Py_IsolatedFlag`: 請改用 :c:member:`PyConfig.isolated`" -#: ../../whatsnew/3.12.rst:2152 +#: ../../whatsnew/3.12.rst:2153 msgid "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." "legacy_windows_fs_encoding`" @@ -4592,7 +4626,7 @@ msgstr "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`: 請改用 :c:member:`PyPreConfig." "legacy_windows_fs_encoding`" -#: ../../whatsnew/3.12.rst:2153 +#: ../../whatsnew/3.12.rst:2154 msgid "" ":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." "legacy_windows_stdio`" @@ -4600,7 +4634,7 @@ msgstr "" ":c:var:`Py_LegacyWindowsStdioFlag`: 請改用 :c:member:`PyConfig." "legacy_windows_stdio`" -#: ../../whatsnew/3.12.rst:2154 +#: ../../whatsnew/3.12.rst:2155 msgid "" ":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." "filesystem_encoding`" @@ -4608,7 +4642,7 @@ msgstr "" ":c:var:`!Py_FileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." "filesystem_encoding`" -#: ../../whatsnew/3.12.rst:2155 +#: ../../whatsnew/3.12.rst:2156 msgid "" ":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." "filesystem_encoding`" @@ -4616,7 +4650,7 @@ msgstr "" ":c:var:`!Py_HasFileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." "filesystem_encoding`" -#: ../../whatsnew/3.12.rst:2156 +#: ../../whatsnew/3.12.rst:2157 msgid "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." "filesystem_errors`" @@ -4624,7 +4658,7 @@ msgstr "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`: 請改用 :c:member:`PyConfig." "filesystem_errors`" -#: ../../whatsnew/3.12.rst:2157 +#: ../../whatsnew/3.12.rst:2158 msgid "" ":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:" "`Py_PreInitialize`)" @@ -4632,7 +4666,7 @@ msgstr "" ":c:var:`!Py_UTF8Mode`: 請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參見 :c:" "func:`Py_PreInitialize`)" -#: ../../whatsnew/3.12.rst:2159 +#: ../../whatsnew/3.12.rst:2160 msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" "`PyConfig` instead. (Contributed by Victor Stinner in :gh:`77782`.)" @@ -4640,25 +4674,25 @@ msgstr "" ":c:func:`Py_InitializeFromConfig` API 應改為與 :c:type:`PyConfig` 一起使用。" "(由 Victor Stinner 於 :gh:`77782` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2163 +#: ../../whatsnew/3.12.rst:2164 msgid "" "Creating :c:data:`immutable types ` with mutable " "bases is deprecated and will be disabled in Python 3.14. (:gh:`95388`)" msgstr "" -#: ../../whatsnew/3.12.rst:2166 +#: ../../whatsnew/3.12.rst:2167 msgid "" "The :file:`structmember.h` header is deprecated, though it continues to be " "available and there are no plans to remove it." msgstr ":file:`structmember.h` 標頭已棄用,但仍可使用,且還沒有移除它的計畫。" -#: ../../whatsnew/3.12.rst:2169 +#: ../../whatsnew/3.12.rst:2170 msgid "" "Its contents are now available just by including :file:`Python.h`, with a " "``Py`` prefix added if it was missing:" msgstr "" -#: ../../whatsnew/3.12.rst:2172 +#: ../../whatsnew/3.12.rst:2173 msgid "" ":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` and :c:func:" "`PyMember_SetOne`" @@ -4666,13 +4700,13 @@ msgstr "" ":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` 和 :c:func:" "`PyMember_SetOne`" -#: ../../whatsnew/3.12.rst:2174 +#: ../../whatsnew/3.12.rst:2175 msgid "" "Type macros like :c:macro:`Py_T_INT`, :c:macro:`Py_T_DOUBLE`, etc. " "(previously ``T_INT``, ``T_DOUBLE``, etc.)" msgstr "" -#: ../../whatsnew/3.12.rst:2176 +#: ../../whatsnew/3.12.rst:2177 msgid "" "The flags :c:macro:`Py_READONLY` (previously ``READONLY``) and :c:macro:" "`Py_AUDIT_READ` (previously all uppercase)" @@ -4680,23 +4714,23 @@ msgstr "" ":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)和 :c:macro:" "`Py_AUDIT_READ`\\ (先前全大寫)旗標" -#: ../../whatsnew/3.12.rst:2179 +#: ../../whatsnew/3.12.rst:2180 msgid "Several items are not exposed from :file:`Python.h`:" msgstr "數個項目不再從 :file:`Python.h` 中公開:" -#: ../../whatsnew/3.12.rst:2181 +#: ../../whatsnew/3.12.rst:2182 msgid ":c:macro:`T_OBJECT` (use :c:macro:`Py_T_OBJECT_EX`)" msgstr ":c:macro:`T_OBJECT`\\ (請改用 :c:macro:`Py_T_OBJECT_EX`)" -#: ../../whatsnew/3.12.rst:2182 +#: ../../whatsnew/3.12.rst:2183 msgid ":c:macro:`T_NONE` (previously undocumented, and pretty quirky)" msgstr ":c:macro:`T_NONE`\\ (先前未記錄於文件上,且相當古怪)" -#: ../../whatsnew/3.12.rst:2183 +#: ../../whatsnew/3.12.rst:2184 msgid "The macro ``WRITE_RESTRICTED`` which does nothing." msgstr "不做任何事的巨集 ``WRITE_RESTRICTED``。" -#: ../../whatsnew/3.12.rst:2184 +#: ../../whatsnew/3.12.rst:2185 msgid "" "The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of :c:macro:" "`Py_AUDIT_READ`." @@ -4704,33 +4738,33 @@ msgstr "" "``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當於 :c:macro:" "`Py_AUDIT_READ`。" -#: ../../whatsnew/3.12.rst:2186 +#: ../../whatsnew/3.12.rst:2187 msgid "" "In some configurations, ```` is not included from :file:`Python." "h`. It should be included manually when using ``offsetof()``." msgstr "" -#: ../../whatsnew/3.12.rst:2189 +#: ../../whatsnew/3.12.rst:2190 msgid "" "The deprecated header continues to provide its original contents under the " "original names. Your old code can stay unchanged, unless the extra include " "and non-namespaced macros bother you greatly." msgstr "" -#: ../../whatsnew/3.12.rst:2194 +#: ../../whatsnew/3.12.rst:2195 msgid "" "(Contributed in :gh:`47146` by Petr Viktorin, based on earlier work by " "Alexander Belopolsky and Matthias Braun.)" msgstr "" -#: ../../whatsnew/3.12.rst:2197 +#: ../../whatsnew/3.12.rst:2198 msgid "" ":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. Use :c:" "func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException` " "instead. (Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2202 +#: ../../whatsnew/3.12.rst:2203 msgid "" ":c:func:`!PyErr_Display` is deprecated. Use :c:func:`PyErr_DisplayException` " "instead. (Contributed by Irit Katriel in :gh:`102755`)." @@ -4738,7 +4772,7 @@ msgstr "" ":c:func:`!PyErr_Display` 已棄用,請改用 :c:func:`PyErr_DisplayException`。" "(由 Irit Katriel 於 :gh:`102755` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2205 +#: ../../whatsnew/3.12.rst:2206 msgid "" "``_PyErr_ChainExceptions`` is deprecated. Use ``_PyErr_ChainExceptions1`` " "instead. (Contributed by Irit Katriel in :gh:`102192`.)" @@ -4746,7 +4780,7 @@ msgstr "" "``_PyErr_ChainExceptions`` 已棄用,請改用 ``_PyErr_ChainExceptions1``。(由 " "Irit Katriel 於 :gh:`102192` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2208 +#: ../../whatsnew/3.12.rst:2209 msgid "" "Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` or :c:" "func:`PyType_FromModuleAndSpec` to create a class whose metaclass overrides :" @@ -5140,54 +5174,54 @@ msgstr "" msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.12.rst:2224 +#: ../../whatsnew/3.12.rst:2225 msgid "" "Remove the :file:`token.h` header file. There was never any public tokenizer " "C API. The :file:`token.h` header file was only designed to be used by " "Python internals. (Contributed by Victor Stinner in :gh:`92651`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2229 +#: ../../whatsnew/3.12.rst:2230 msgid "Legacy Unicode APIs have been removed. See :pep:`623` for detail." msgstr "" -#: ../../whatsnew/3.12.rst:2231 +#: ../../whatsnew/3.12.rst:2232 msgid ":c:macro:`!PyUnicode_WCHAR_KIND`" msgstr ":c:macro:`!PyUnicode_WCHAR_KIND`" -#: ../../whatsnew/3.12.rst:2232 +#: ../../whatsnew/3.12.rst:2233 msgid ":c:func:`!PyUnicode_AS_UNICODE`" msgstr ":c:func:`!PyUnicode_AS_UNICODE`" -#: ../../whatsnew/3.12.rst:2233 +#: ../../whatsnew/3.12.rst:2234 msgid ":c:func:`!PyUnicode_AsUnicode`" msgstr ":c:func:`!PyUnicode_AsUnicode`" -#: ../../whatsnew/3.12.rst:2234 +#: ../../whatsnew/3.12.rst:2235 msgid ":c:func:`!PyUnicode_AsUnicodeAndSize`" msgstr ":c:func:`!PyUnicode_AsUnicodeAndSize`" -#: ../../whatsnew/3.12.rst:2235 +#: ../../whatsnew/3.12.rst:2236 msgid ":c:func:`!PyUnicode_AS_DATA`" msgstr ":c:func:`!PyUnicode_AS_DATA`" -#: ../../whatsnew/3.12.rst:2236 +#: ../../whatsnew/3.12.rst:2237 msgid ":c:func:`!PyUnicode_FromUnicode`" msgstr ":c:func:`!PyUnicode_FromUnicode`" -#: ../../whatsnew/3.12.rst:2237 +#: ../../whatsnew/3.12.rst:2238 msgid ":c:func:`!PyUnicode_GET_SIZE`" msgstr ":c:func:`!PyUnicode_GET_SIZE`" -#: ../../whatsnew/3.12.rst:2238 +#: ../../whatsnew/3.12.rst:2239 msgid ":c:func:`!PyUnicode_GetSize`" msgstr ":c:func:`!PyUnicode_GetSize`" -#: ../../whatsnew/3.12.rst:2239 +#: ../../whatsnew/3.12.rst:2240 msgid ":c:func:`!PyUnicode_GET_DATA_SIZE`" msgstr ":c:func:`!PyUnicode_GET_DATA_SIZE`" -#: ../../whatsnew/3.12.rst:2241 +#: ../../whatsnew/3.12.rst:2242 msgid "" "Remove the ``PyUnicode_InternImmortal()`` function macro. (Contributed by " "Victor Stinner in :gh:`85858`.)" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index 48215f745d..f41fa1d4c1 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-05 00:13+0000\n" +"POT-Creation-Date: 2024-10-15 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,11 +31,11 @@ msgstr "Adam Turner 和 Thomas Wouters" #: ../../whatsnew/3.13.rst:48 msgid "" "This article explains the new features in Python 3.13, compared to 3.12. " -"Python 3.13 will be released on October 7, 2024. For full details, see the :" -"ref:`changelog `." +"Python 3.13 was released on October 7, 2024. For full details, see the :ref:" +"`changelog `." msgstr "" -"本文介紹了 Python 3.13 與 3.12 相比多了哪些新功能。Python 3.13 將於 2024 年 " -"10 月 7 日發布。完整詳請請見 :ref:`changelog `。" +"本文介紹了 Python 3.13 與 3.12 相比多了哪些新功能。Python 3.13 已於 2024 年 " +"10 月 7 日發布。完整詳情請見 :ref:`changelog `。" #: ../../whatsnew/3.13.rst:54 msgid ":pep:`719` -- Python 3.13 Release Schedule" @@ -47,9 +47,9 @@ msgstr "發布重點摘要" #: ../../whatsnew/3.13.rst:63 msgid "" -"Python 3.13 will be the latest stable release of the Python programming " -"language, with a mix of changes to the language, the implementation and the " -"standard library. The biggest changes include a new `interactive interpreter " +"Python 3.13 is the latest stable release of the Python programming language, " +"with a mix of changes to the language, the implementation and the standard " +"library. The biggest changes include a new `interactive interpreter " "`_, experimental support for " "running in a `free-threaded mode `_ (:" "pep:`703`), and a `Just-In-Time compiler `_ (:pep:" @@ -294,7 +294,7 @@ msgid "" "mod:`!sunau`, :mod:`!telnetlib`, :mod:`!uu` and :mod:`!xdrlib`." msgstr "" ":ref:`PEP 594 `: 剩下的 19 個 \"dead batteries\" (遺留標" -"準函式庫模組)以字標準函式庫中移除::mod:`!aifc`、:mod:`!audioop`、:mod:`!" +"準函式庫模組)已自標準函式庫中移除::mod:`!aifc`、:mod:`!audioop`、:mod:`!" "cgi`、:mod:`!cgitb`、:mod:`!chunk`、:mod:`!crypt`、:mod:`!imghdr`、:mod:`!" "mailcap`、:mod:`!msilib`、:mod:`!nis`、:mod:`!nntplib`、:mod:`!" "ossaudiodev`、:mod:`!pipes`、:mod:`!sndhdr`、:mod:`!spwd`、:mod:`!sunau`、:" @@ -345,7 +345,7 @@ msgid "" "years of security fixes." msgstr "" -#: ../../whatsnew/3.13.rst:208 ../../whatsnew/3.13.rst:1964 +#: ../../whatsnew/3.13.rst:208 ../../whatsnew/3.13.rst:1968 msgid "New Features" msgstr "新增功能" @@ -1160,7 +1160,7 @@ msgid "compileall" msgstr "compileall" #: ../../whatsnew/3.13.rst:757 ../../whatsnew/3.13.rst:765 -#: ../../whatsnew/3.13.rst:1013 +#: ../../whatsnew/3.13.rst:1017 msgid "" "The default number of worker threads and processes is now selected using :" "func:`os.process_cpu_count` instead of :func:`os.cpu_count`. (Contributed by " @@ -1171,7 +1171,7 @@ msgstr "" msgid "concurrent.futures" msgstr "concurrent.futures" -#: ../../whatsnew/3.13.rst:771 ../../whatsnew/3.13.rst:1608 +#: ../../whatsnew/3.13.rst:771 ../../whatsnew/3.13.rst:1612 msgid "configparser" msgstr "configparser" @@ -1259,29 +1259,37 @@ msgid "" "projects." msgstr "" -#: ../../whatsnew/3.13.rst:819 +#: ../../whatsnew/3.13.rst:817 +msgid "" +":class:`ctypes.Structure` objects have a new :attr:`~ctypes.Structure." +"_align_` attribute which allows the alignment of the structure being packed " +"to/from memory to be specified explicitly. (Contributed by Matt Sanderson " +"in :gh:`112433`)" +msgstr "" + +#: ../../whatsnew/3.13.rst:823 msgid "dbm" msgstr "dbm" -#: ../../whatsnew/3.13.rst:821 +#: ../../whatsnew/3.13.rst:825 msgid "" "Add :mod:`dbm.sqlite3`, a new module which implements an SQLite backend, and " "make it the default :mod:`!dbm` backend. (Contributed by Raymond Hettinger " "and Erlend E. Aasland in :gh:`100414`.)" msgstr "" -#: ../../whatsnew/3.13.rst:825 +#: ../../whatsnew/3.13.rst:829 msgid "" "Allow removing all items from the database through the new :meth:`.gdbm." "clear` and :meth:`.ndbm.clear` methods. (Contributed by Donghee Na in :gh:" "`107122`.)" msgstr "" -#: ../../whatsnew/3.13.rst:831 +#: ../../whatsnew/3.13.rst:835 msgid "dis" msgstr "dis" -#: ../../whatsnew/3.13.rst:833 +#: ../../whatsnew/3.13.rst:837 msgid "" "Change the output of :mod:`dis` module functions to show logical labels for " "jump targets and exception handlers, rather than offsets. The offsets can be " @@ -1289,7 +1297,7 @@ msgid "" "the *show_offsets* argument. (Contributed by Irit Katriel in :gh:`112137`.)" msgstr "" -#: ../../whatsnew/3.13.rst:840 +#: ../../whatsnew/3.13.rst:844 msgid "" ":meth:`~dis.get_instructions` no longer represents cache entries as separate " "instructions. Instead, it returns them as part of the :class:`~dis." @@ -1298,11 +1306,11 @@ msgid "" "(Contributed by Irit Katriel in :gh:`112962`.)" msgstr "" -#: ../../whatsnew/3.13.rst:852 +#: ../../whatsnew/3.13.rst:856 msgid "doctest" msgstr "doctest" -#: ../../whatsnew/3.13.rst:854 +#: ../../whatsnew/3.13.rst:858 msgid "" ":mod:`doctest` output is now colored by default. This can be controlled via " "the new :envvar:`PYTHON_COLORS` environment variable as well as the " @@ -1311,18 +1319,18 @@ msgid "" "`117225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:861 +#: ../../whatsnew/3.13.rst:865 msgid "" "The :meth:`.DocTestRunner.run` method now counts the number of skipped " "tests. Add the :attr:`.DocTestRunner.skips` and :attr:`.TestResults.skipped` " "attributes. (Contributed by Victor Stinner in :gh:`108794`.)" msgstr "" -#: ../../whatsnew/3.13.rst:867 +#: ../../whatsnew/3.13.rst:871 msgid "email" msgstr "email" -#: ../../whatsnew/3.13.rst:869 +#: ../../whatsnew/3.13.rst:873 msgid "" "Headers with embedded newlines are now quoted on output. The :mod:`~email." "generator` will now refuse to serialize (write) headers that are improperly " @@ -1332,7 +1340,7 @@ msgid "" "Bloemsaat and Petr Viktorin in :gh:`121650`.)" msgstr "" -#: ../../whatsnew/3.13.rst:877 +#: ../../whatsnew/3.13.rst:881 msgid "" ":func:`~email.utils.getaddresses` and :func:`~email.utils.parseaddr` now " "return ``('', '')`` pairs in more situations where invalid email addresses " @@ -1344,11 +1352,11 @@ msgid "" "Stinner for :gh:`102988` to improve the :cve:`2023-27043` fix.)" msgstr "" -#: ../../whatsnew/3.13.rst:889 +#: ../../whatsnew/3.13.rst:893 msgid "fractions" msgstr "fractions" -#: ../../whatsnew/3.13.rst:891 +#: ../../whatsnew/3.13.rst:895 msgid "" ":class:`~fractions.Fraction` objects now support the standard :ref:`format " "specification mini-language ` rules for fill, alignment, sign " @@ -1356,22 +1364,22 @@ msgid "" "`111320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:898 +#: ../../whatsnew/3.13.rst:902 msgid "glob" msgstr "glob" -#: ../../whatsnew/3.13.rst:900 +#: ../../whatsnew/3.13.rst:904 msgid "" "Add :func:`~glob.translate`, a function to convert a path specification with " "shell-style wildcards to a regular expression. (Contributed by Barney Gale " "in :gh:`72904`.)" msgstr "" -#: ../../whatsnew/3.13.rst:906 +#: ../../whatsnew/3.13.rst:910 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.13.rst:908 +#: ../../whatsnew/3.13.rst:912 msgid "" "The following functions in :mod:`importlib.resources` now allow accessing a " "directory (or tree) of resources, using multiple positional arguments (the " @@ -1379,49 +1387,49 @@ msgid "" "keyword-only):" msgstr "" -#: ../../whatsnew/3.13.rst:913 +#: ../../whatsnew/3.13.rst:917 msgid ":func:`~importlib.resources.is_resource`" msgstr ":func:`~importlib.resources.is_resource`" -#: ../../whatsnew/3.13.rst:914 +#: ../../whatsnew/3.13.rst:918 msgid ":func:`~importlib.resources.open_binary`" msgstr ":func:`~importlib.resources.open_binary`" -#: ../../whatsnew/3.13.rst:915 +#: ../../whatsnew/3.13.rst:919 msgid ":func:`~importlib.resources.open_text`" msgstr ":func:`~importlib.resources.open_text`" -#: ../../whatsnew/3.13.rst:916 +#: ../../whatsnew/3.13.rst:920 msgid ":func:`~importlib.resources.path`" msgstr ":func:`~importlib.resources.path`" -#: ../../whatsnew/3.13.rst:917 +#: ../../whatsnew/3.13.rst:921 msgid ":func:`~importlib.resources.read_binary`" msgstr ":func:`~importlib.resources.read_binary`" -#: ../../whatsnew/3.13.rst:918 +#: ../../whatsnew/3.13.rst:922 msgid ":func:`~importlib.resources.read_text`" msgstr ":func:`~importlib.resources.read_text`" -#: ../../whatsnew/3.13.rst:920 +#: ../../whatsnew/3.13.rst:924 msgid "" "These functions are no longer deprecated and are not scheduled for removal. " -"(Contributed by Petr Viktorin in :gh:`106532`.)" +"(Contributed by Petr Viktorin in :gh:`116608`.)" msgstr "" -#: ../../whatsnew/3.13.rst:923 +#: ../../whatsnew/3.13.rst:927 msgid "" ":func:`~importlib.resources.contents` remains deprecated in favor of the " "fully-featured :class:`~importlib.resources.abc.Traversable` API. However, " "there is now no plan to remove it. (Contributed by Petr Viktorin in :gh:" -"`106532`.)" +"`116608`.)" msgstr "" -#: ../../whatsnew/3.13.rst:930 +#: ../../whatsnew/3.13.rst:934 msgid "io" msgstr "io" -#: ../../whatsnew/3.13.rst:932 +#: ../../whatsnew/3.13.rst:936 msgid "" "The :class:`~io.IOBase` finalizer now logs any errors raised by the :meth:" "`~io.IOBase.close` method with :data:`sys.unraisablehook`. Previously, " @@ -1430,17 +1438,17 @@ msgid "" "build>`. (Contributed by Victor Stinner in :gh:`62948`.)" msgstr "" -#: ../../whatsnew/3.13.rst:941 +#: ../../whatsnew/3.13.rst:945 msgid "ipaddress" msgstr "ipaddress" -#: ../../whatsnew/3.13.rst:943 +#: ../../whatsnew/3.13.rst:947 msgid "" "Add the :attr:`.IPv4Address.ipv6_mapped` property, which returns the IPv4-" "mapped IPv6 address. (Contributed by Charles Machalow in :gh:`109466`.)" msgstr "" -#: ../../whatsnew/3.13.rst:947 +#: ../../whatsnew/3.13.rst:951 msgid "" "Fix ``is_global`` and ``is_private`` behavior in :class:`~ipaddress." "IPv4Address`, :class:`~ipaddress.IPv6Address`, :class:`~ipaddress." @@ -1448,22 +1456,22 @@ msgid "" "Stasiak in :gh:`113171`.)" msgstr "" -#: ../../whatsnew/3.13.rst:954 +#: ../../whatsnew/3.13.rst:958 msgid "itertools" msgstr "itertools" -#: ../../whatsnew/3.13.rst:956 +#: ../../whatsnew/3.13.rst:960 msgid "" ":func:`~itertools.batched` has a new *strict* parameter, which raises a :exc:" "`ValueError` if the final batch is shorter than the specified batch size. " "(Contributed by Raymond Hettinger in :gh:`113202`.)" msgstr "" -#: ../../whatsnew/3.13.rst:963 +#: ../../whatsnew/3.13.rst:967 msgid "marshal" msgstr "marshal" -#: ../../whatsnew/3.13.rst:965 +#: ../../whatsnew/3.13.rst:969 msgid "" "Add the *allow_code* parameter in module functions. Passing " "``allow_code=False`` prevents serialization and de-serialization of code " @@ -1471,11 +1479,11 @@ msgid "" "Serhiy Storchaka in :gh:`113626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:972 +#: ../../whatsnew/3.13.rst:976 msgid "math" msgstr "math" -#: ../../whatsnew/3.13.rst:974 +#: ../../whatsnew/3.13.rst:978 msgid "" "The new function :func:`~math.fma` performs fused multiply-add operations. " "This computes ``x * y + z`` with only a single round, and so avoids any " @@ -1485,11 +1493,11 @@ msgid "" "Stinner in :gh:`73468`.)" msgstr "" -#: ../../whatsnew/3.13.rst:984 +#: ../../whatsnew/3.13.rst:988 msgid "mimetypes" msgstr "mimetypes" -#: ../../whatsnew/3.13.rst:986 +#: ../../whatsnew/3.13.rst:990 msgid "" "Add the :func:`~mimetypes.guess_file_type` function to guess a MIME type " "from a filesystem path. Using paths with :func:`~mimetypes.guess_type` is " @@ -1497,18 +1505,18 @@ msgid "" "`66543`.)" msgstr "" -#: ../../whatsnew/3.13.rst:993 +#: ../../whatsnew/3.13.rst:997 msgid "mmap" msgstr "mmap" -#: ../../whatsnew/3.13.rst:995 +#: ../../whatsnew/3.13.rst:999 msgid "" ":class:`~mmap.mmap` is now protected from crashing on Windows when the " "mapped memory is inaccessible due to file system errors or access " "violations. (Contributed by Jannis Weigend in :gh:`118209`.)" msgstr "" -#: ../../whatsnew/3.13.rst:999 +#: ../../whatsnew/3.13.rst:1003 msgid "" ":class:`~mmap.mmap` has a new :meth:`~mmap.mmap.seekable` method that can be " "used when a seekable file-like object is required. The :meth:`~mmap.mmap." @@ -1516,7 +1524,7 @@ msgid "" "Na and Sylvie Liberman in :gh:`111835`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1004 +#: ../../whatsnew/3.13.rst:1008 msgid "" "The new UNIX-only *trackfd* parameter for :class:`~mmap.mmap` controls file " "descriptor duplication; if false, the file descriptor specified by *fileno* " @@ -1524,22 +1532,22 @@ msgid "" "gh:`78502`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1011 +#: ../../whatsnew/3.13.rst:1015 msgid "multiprocessing" msgstr "multiprocessing" -#: ../../whatsnew/3.13.rst:1019 +#: ../../whatsnew/3.13.rst:1023 msgid "os" msgstr "os" -#: ../../whatsnew/3.13.rst:1021 +#: ../../whatsnew/3.13.rst:1025 msgid "" "Add :func:`~os.process_cpu_count` function to get the number of logical CPU " "cores usable by the calling thread of the current process. (Contributed by " "Victor Stinner in :gh:`109649`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1025 +#: ../../whatsnew/3.13.rst:1029 msgid "" ":func:`~os.cpu_count` and :func:`~os.process_cpu_count` can be overridden " "through the new environment variable :envvar:`PYTHON_CPU_COUNT` or the new " @@ -1549,7 +1557,7 @@ msgid "" "Na in :gh:`109595`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1033 +#: ../../whatsnew/3.13.rst:1037 msgid "" "Add a :ref:`low level interface ` to Linux's :manpage:`timer " "file descriptors ` via :func:`~os.timerfd_create`, :func:" @@ -1560,7 +1568,7 @@ msgid "" "in :gh:`108277`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1042 +#: ../../whatsnew/3.13.rst:1046 msgid "" ":func:`~os.lchmod` and the *follow_symlinks* argument of :func:`~os.chmod` " "are both now available on Windows. Note that the default value of " @@ -1568,14 +1576,14 @@ msgid "" "by Serhiy Storchaka in :gh:`59616`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1048 +#: ../../whatsnew/3.13.rst:1052 msgid "" ":func:`~os.fchmod` and support for file descriptors in :func:`~os.chmod` are " "both now available on Windows. (Contributed by Serhiy Storchaka in :gh:" "`113191`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1052 +#: ../../whatsnew/3.13.rst:1056 msgid "" "On Windows, :func:`~os.mkdir` and :func:`~os.makedirs` now support passing a " "*mode* value of ``0o700`` to apply access control to the new directory. This " @@ -1584,14 +1592,14 @@ msgid "" "Steve Dower in :gh:`118486`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1059 +#: ../../whatsnew/3.13.rst:1063 msgid "" ":func:`~os.posix_spawn` now accepts ``None`` for the *env* argument, which " "makes the newly spawned process use the current process environment. " "(Contributed by Jakub Kulik in :gh:`113119`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1063 +#: ../../whatsnew/3.13.rst:1067 msgid "" ":func:`~os.posix_spawn` can now use the :attr:`~os.POSIX_SPAWN_CLOSEFROM` " "attribute in the *file_actions* parameter on platforms that support :c:func:" @@ -1599,76 +1607,76 @@ msgid "" "gh:`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1070 +#: ../../whatsnew/3.13.rst:1074 msgid "os.path" msgstr "os.path" -#: ../../whatsnew/3.13.rst:1072 +#: ../../whatsnew/3.13.rst:1076 msgid "" "Add :func:`~os.path.isreserved` to check if a path is reserved on the " "current system. This function is only available on Windows. (Contributed by " "Barney Gale in :gh:`88569`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1077 +#: ../../whatsnew/3.13.rst:1081 msgid "" "On Windows, :func:`~os.path.isabs` no longer considers paths starting with " "exactly one slash (``\\`` or ``/``) to be absolute. (Contributed by Barney " "Gale and Jon Foster in :gh:`44626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1081 +#: ../../whatsnew/3.13.rst:1085 msgid "" ":func:`~os.path.realpath` now resolves MS-DOS style file names even if the " "file is not accessible. (Contributed by Moonsik Park in :gh:`82367`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1087 ../../whatsnew/3.13.rst:1648 +#: ../../whatsnew/3.13.rst:1091 ../../whatsnew/3.13.rst:1652 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.13.rst:1089 +#: ../../whatsnew/3.13.rst:1093 msgid "" "Add :exc:`~pathlib.UnsupportedOperation`, which is raised instead of :exc:" "`NotImplementedError` when a path operation isn't supported. (Contributed by " "Barney Gale in :gh:`89812`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1093 +#: ../../whatsnew/3.13.rst:1097 msgid "" "Add a new constructor for creating :class:`~pathlib.Path` objects from " "'file' URIs (``file:///``), :meth:`.Path.from_uri`. (Contributed by Barney " "Gale in :gh:`107465`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1097 +#: ../../whatsnew/3.13.rst:1101 msgid "" "Add :meth:`.PurePath.full_match` for matching paths with shell-style " "wildcards, including the recursive wildcard \"``**``\". (Contributed by " "Barney Gale in :gh:`73435`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1101 +#: ../../whatsnew/3.13.rst:1105 msgid "" "Add the :attr:`.PurePath.parser` class attribute to store the implementation " "of :mod:`os.path` used for low-level path parsing and joining. This will be " "either :mod:`!posixpath` or :mod:`!ntpath`." msgstr "" -#: ../../whatsnew/3.13.rst:1106 +#: ../../whatsnew/3.13.rst:1110 msgid "" "Add *recurse_symlinks* keyword-only argument to :meth:`.Path.glob` and :meth:" "`~pathlib.Path.rglob`. (Contributed by Barney Gale in :gh:`77609`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1110 +#: ../../whatsnew/3.13.rst:1114 msgid "" ":meth:`.Path.glob` and :meth:`~pathlib.Path.rglob` now return files and " "directories when given a pattern that ends with \"``**``\". Previously, only " "directories were returned. (Contributed by Barney Gale in :gh:`70303`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1115 +#: ../../whatsnew/3.13.rst:1119 msgid "" "Add the *follow_symlinks* keyword-only argument to :meth:`Path.is_file " "`, :meth:`Path.is_dir `, :meth:`." @@ -1676,11 +1684,11 @@ msgid "" "`105793` and Kamil Turek in :gh:`107962`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1123 +#: ../../whatsnew/3.13.rst:1127 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.13.rst:1125 +#: ../../whatsnew/3.13.rst:1129 msgid "" ":func:`breakpoint` and :func:`~pdb.set_trace` now enter the debugger " "immediately rather than on the next line of code to be executed. This change " @@ -1689,20 +1697,20 @@ msgid "" "Gao in :gh:`118579`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1131 +#: ../../whatsnew/3.13.rst:1135 msgid "" "``sys.path[0]`` is no longer replaced by the directory of the script being " "debugged when :attr:`sys.flags.safe_path` is set. (Contributed by Tian Gao " "and Christian Walther in :gh:`111762`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1135 +#: ../../whatsnew/3.13.rst:1139 msgid "" ":mod:`zipapp` is now supported as a debugging target. (Contributed by Tian " "Gao in :gh:`118501`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1138 +#: ../../whatsnew/3.13.rst:1142 msgid "" "Add ability to move between chained exceptions during post-mortem debugging " "in :func:`~pdb.pm` using the new :pdbcmd:`exceptions [exc_number] " @@ -1710,101 +1718,101 @@ msgid "" "`106676`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1143 +#: ../../whatsnew/3.13.rst:1147 msgid "" "Expressions and statements whose prefix is a pdb command are now correctly " "identified and executed. (Contributed by Tian Gao in :gh:`108464`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1149 +#: ../../whatsnew/3.13.rst:1153 msgid "queue" msgstr "queue" -#: ../../whatsnew/3.13.rst:1151 +#: ../../whatsnew/3.13.rst:1155 msgid "" "Add :meth:`Queue.shutdown ` and :exc:`~queue.ShutDown` " "to manage queue termination. (Contributed by Laurie Opperman and Yves Duprat " "in :gh:`104750`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1157 +#: ../../whatsnew/3.13.rst:1161 msgid "random" msgstr "random" -#: ../../whatsnew/3.13.rst:1159 +#: ../../whatsnew/3.13.rst:1163 msgid "" "Add a :ref:`command-line interface `. (Contributed by Hugo van " "Kemenade in :gh:`118131`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1164 ../../whatsnew/3.13.rst:1656 +#: ../../whatsnew/3.13.rst:1168 ../../whatsnew/3.13.rst:1660 msgid "re" msgstr "re" -#: ../../whatsnew/3.13.rst:1166 +#: ../../whatsnew/3.13.rst:1170 msgid "" "Rename :exc:`!re.error` to :exc:`~re.PatternError` for improved clarity. :" "exc:`!re.error` is kept for backward compatibility." msgstr "" -#: ../../whatsnew/3.13.rst:1171 +#: ../../whatsnew/3.13.rst:1175 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.13.rst:1173 +#: ../../whatsnew/3.13.rst:1177 msgid "" "Support the *dir_fd* and *follow_symlinks* keyword arguments in :func:" "`~shutil.chown`. (Contributed by Berker Peksag and Tahia K in :gh:`62308`)" msgstr "" -#: ../../whatsnew/3.13.rst:1179 +#: ../../whatsnew/3.13.rst:1183 msgid "site" msgstr "site" -#: ../../whatsnew/3.13.rst:1181 +#: ../../whatsnew/3.13.rst:1185 msgid "" ":file:`.pth` files are now decoded using UTF-8 first, and then with the :" "term:`locale encoding` if UTF-8 decoding fails. (Contributed by Inada Naoki " "in :gh:`117802`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1187 +#: ../../whatsnew/3.13.rst:1191 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.13.rst:1189 +#: ../../whatsnew/3.13.rst:1193 msgid "" "A :exc:`ResourceWarning` is now emitted if a :class:`~sqlite3.Connection` " "object is not :meth:`closed ` explicitly. " "(Contributed by Erlend E. Aasland in :gh:`105539`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1193 +#: ../../whatsnew/3.13.rst:1197 msgid "" "Add the *filter* keyword-only parameter to :meth:`.Connection.iterdump` for " "filtering database objects to dump. (Contributed by Mariusz Felisiak in :gh:" "`91602`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1199 +#: ../../whatsnew/3.13.rst:1203 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.13.rst:1201 +#: ../../whatsnew/3.13.rst:1205 msgid "" "The :func:`~ssl.create_default_context` API now includes :data:`~ssl." "VERIFY_X509_PARTIAL_CHAIN` and :data:`~ssl.VERIFY_X509_STRICT` in its " "default flags." msgstr "" -#: ../../whatsnew/3.13.rst:1207 +#: ../../whatsnew/3.13.rst:1211 msgid "" ":data:`~ssl.VERIFY_X509_STRICT` may reject pre-:rfc:`5280` or malformed " "certificates that the underlying OpenSSL implementation might otherwise " "accept. Whilst disabling this is not recommended, you can do so using:" msgstr "" -#: ../../whatsnew/3.13.rst:1212 +#: ../../whatsnew/3.13.rst:1216 msgid "" "import ssl\n" "\n" @@ -1816,15 +1824,15 @@ msgstr "" "ctx = ssl.create_default_context()\n" "ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" -#: ../../whatsnew/3.13.rst:1219 +#: ../../whatsnew/3.13.rst:1223 msgid "(Contributed by William Woodruff in :gh:`112389`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1223 +#: ../../whatsnew/3.13.rst:1227 msgid "statistics" msgstr "statistics" -#: ../../whatsnew/3.13.rst:1225 +#: ../../whatsnew/3.13.rst:1229 msgid "" "Add :func:`~statistics.kde` for kernel density estimation. This makes it " "possible to estimate a continuous probability density function from a fixed " @@ -1832,24 +1840,24 @@ msgid "" "`115863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1230 +#: ../../whatsnew/3.13.rst:1234 msgid "" "Add :func:`~statistics.kde_random` for sampling from an estimated " "probability density function created by :func:`~statistics.kde`. " "(Contributed by Raymond Hettinger in :gh:`115863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1238 +#: ../../whatsnew/3.13.rst:1242 msgid "subprocess" msgstr "subprocess" -#: ../../whatsnew/3.13.rst:1240 +#: ../../whatsnew/3.13.rst:1244 msgid "" "The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " "in more situations." msgstr "" -#: ../../whatsnew/3.13.rst:1243 +#: ../../whatsnew/3.13.rst:1247 msgid "" "Notably, when *close_fds* is ``True`` (the default), :func:`~os.posix_spawn` " "will be used when the C library provides :c:func:`!" @@ -1858,7 +1866,7 @@ msgid "" "existing Linux :c:func:`!vfork` based code." msgstr "" -#: ../../whatsnew/3.13.rst:1250 +#: ../../whatsnew/3.13.rst:1254 msgid "" "A private control knob :attr:`!subprocess._USE_POSIX_SPAWN` can be set to " "``False`` if you need to force :mod:`subprocess` to never use :func:`~os." @@ -1868,22 +1876,22 @@ msgid "" "`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1260 +#: ../../whatsnew/3.13.rst:1264 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.13.rst:1262 +#: ../../whatsnew/3.13.rst:1266 msgid "" "Add the :func:`~sys._is_interned` function to test if a string was interned. " "This function is not guaranteed to exist in all implementations of Python. " "(Contributed by Serhiy Storchaka in :gh:`78573`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1268 +#: ../../whatsnew/3.13.rst:1272 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.13.rst:1270 +#: ../../whatsnew/3.13.rst:1274 msgid "" "On Windows, the default mode ``0o700`` used by :func:`tempfile.mkdtemp` now " "limits access to the new directory due to changes to :func:`os.mkdir`. This " @@ -1891,11 +1899,11 @@ msgid "" "`118486`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1277 +#: ../../whatsnew/3.13.rst:1281 msgid "time" msgstr "time" -#: ../../whatsnew/3.13.rst:1279 +#: ../../whatsnew/3.13.rst:1283 msgid "" "On Windows, :func:`~time.monotonic` now uses the " "``QueryPerformanceCounter()`` clock for a resolution of 1 microsecond, " @@ -1903,7 +1911,7 @@ msgid "" "milliseconds. (Contributed by Victor Stinner in :gh:`88494`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1285 +#: ../../whatsnew/3.13.rst:1289 msgid "" "On Windows, :func:`~time.time` now uses the " "``GetSystemTimePreciseAsFileTime()`` clock for a resolution of 1 " @@ -1912,11 +1920,11 @@ msgid "" "`63207`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1293 +#: ../../whatsnew/3.13.rst:1297 msgid "tkinter" msgstr "tkinter" -#: ../../whatsnew/3.13.rst:1295 +#: ../../whatsnew/3.13.rst:1299 msgid "" "Add :mod:`tkinter` widget methods: :meth:`!tk_busy_hold`, :meth:`!" "tk_busy_configure`, :meth:`!tk_busy_cget`, :meth:`!tk_busy_forget`, :meth:`!" @@ -1924,7 +1932,7 @@ msgid "" "klappnase and Serhiy Storchaka in :gh:`72684`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1301 +#: ../../whatsnew/3.13.rst:1305 msgid "" "The :mod:`tkinter` widget method :meth:`!wm_attributes` now accepts the " "attribute name without the minus prefix to get window attributes, for " @@ -1933,14 +1941,14 @@ msgid "" "wm_attributes(alpha=0.5)``. (Contributed by Serhiy Storchaka in :gh:`43457`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1308 +#: ../../whatsnew/3.13.rst:1312 msgid "" ":meth:`!wm_attributes` can now return attributes as a :class:`dict`, by " "using the new optional keyword-only parameter *return_python_dict*. " "(Contributed by Serhiy Storchaka in :gh:`43457`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1312 +#: ../../whatsnew/3.13.rst:1316 msgid "" ":meth:`!Text.count` can now return a simple :class:`int` when the new " "optional keyword-only parameter *return_ints* is used. Otherwise, the single " @@ -1948,27 +1956,27 @@ msgid "" "in :gh:`97928`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1317 +#: ../../whatsnew/3.13.rst:1321 msgid "" "Support the \"vsapi\" element type in the :meth:`~tkinter.ttk.Style." "element_create` method of :class:`tkinter.ttk.Style`. (Contributed by Serhiy " "Storchaka in :gh:`68166`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1322 +#: ../../whatsnew/3.13.rst:1326 msgid "" "Add the :meth:`!after_info` method for Tkinter widgets. (Contributed by " "Cheryl Sabella in :gh:`77020`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1325 +#: ../../whatsnew/3.13.rst:1329 msgid "" "Add a new :meth:`!copy_replace` method to :class:`!PhotoImage` to copy a " "region from one image to another, possibly with pixel zooming, subsampling, " "or both. (Contributed by Serhiy Storchaka in :gh:`118225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1330 +#: ../../whatsnew/3.13.rst:1334 msgid "" "Add *from_coords* parameter to the :class:`!PhotoImage` methods :meth:`!" "copy`, :meth:`!zoom` and :meth:`!subsample`. Add *zoom* and *subsample* " @@ -1976,7 +1984,7 @@ msgid "" "Serhiy Storchaka in :gh:`118225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1336 +#: ../../whatsnew/3.13.rst:1340 msgid "" "Add the :class:`!PhotoImage` methods :meth:`!read` to read an image from a " "file and :meth:`!data` to get the image data. Add *background* and " @@ -1984,11 +1992,11 @@ msgid "" "Storchaka in :gh:`118271`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1344 +#: ../../whatsnew/3.13.rst:1348 msgid "traceback" msgstr "traceback" -#: ../../whatsnew/3.13.rst:1346 +#: ../../whatsnew/3.13.rst:1350 msgid "" "Add the :attr:`~traceback.TracebackException.exc_type_str` attribute to :" "class:`~traceback.TracebackException`, which holds a string display of the " @@ -1998,7 +2006,7 @@ msgid "" "(Contributed by Irit Katriel in :gh:`112332`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1355 +#: ../../whatsnew/3.13.rst:1359 msgid "" "Add a new *show_group* keyword-only parameter to :meth:`.TracebackException." "format_exception_only` to (recursively) format the nested exceptions of a :" @@ -2006,11 +2014,11 @@ msgid "" "`105292`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1362 +#: ../../whatsnew/3.13.rst:1366 msgid "types" msgstr "types" -#: ../../whatsnew/3.13.rst:1364 +#: ../../whatsnew/3.13.rst:1368 msgid "" ":class:`~types.SimpleNamespace` can now take a single positional argument to " "initialise the namespace's arguments. This argument must either be a mapping " @@ -2018,63 +2026,63 @@ msgid "" "`108191`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1371 ../../whatsnew/3.13.rst:1681 +#: ../../whatsnew/3.13.rst:1375 ../../whatsnew/3.13.rst:1685 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.13.rst:1373 +#: ../../whatsnew/3.13.rst:1377 msgid "" ":pep:`705`: Add :data:`~typing.ReadOnly`, a special typing construct to mark " "a :class:`~typing.TypedDict` item as read-only for type checkers." msgstr "" -#: ../../whatsnew/3.13.rst:1376 +#: ../../whatsnew/3.13.rst:1380 msgid "" ":pep:`742`: Add :data:`~typing.TypeIs`, a typing construct that can be used " "to instruct a type checker how to narrow a type." msgstr "" -#: ../../whatsnew/3.13.rst:1379 +#: ../../whatsnew/3.13.rst:1383 msgid "" "Add :data:`~typing.NoDefault`, a sentinel object used to represent the " "defaults of some parameters in the :mod:`typing` module. (Contributed by " "Jelle Zijlstra in :gh:`116126`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1383 +#: ../../whatsnew/3.13.rst:1387 msgid "" "Add :func:`~typing.get_protocol_members` to return the set of members " "defining a :class:`typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:" "`104873`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1387 +#: ../../whatsnew/3.13.rst:1391 msgid "" "Add :func:`~typing.is_protocol` to check whether a class is a :class:" "`~typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:`104873`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1391 +#: ../../whatsnew/3.13.rst:1395 msgid "" ":data:`~typing.ClassVar` can now be nested in :data:`~typing.Final`, and " "vice versa. (Contributed by Mehdi Drissi in :gh:`89547`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1397 +#: ../../whatsnew/3.13.rst:1401 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.13.rst:1399 +#: ../../whatsnew/3.13.rst:1403 msgid "" "Update the Unicode database to `version 15.1.0`__. (Contributed by James " "Gerity in :gh:`109559`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1406 +#: ../../whatsnew/3.13.rst:1410 msgid "venv" msgstr "venv" -#: ../../whatsnew/3.13.rst:1408 +#: ../../whatsnew/3.13.rst:1412 msgid "" "Add support for creating source control management (SCM) ignore files in a " "virtual environment's directory. By default, Git is supported. This is " @@ -2084,11 +2092,11 @@ msgid "" "Cannon in :gh:`108125`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1419 +#: ../../whatsnew/3.13.rst:1423 msgid "warnings" msgstr "warnings" -#: ../../whatsnew/3.13.rst:1421 +#: ../../whatsnew/3.13.rst:1425 msgid "" ":pep:`702`: The new :func:`warnings.deprecated` decorator provides a way to " "communicate deprecations to a :term:`static type checker` and to warn on " @@ -2097,62 +2105,62 @@ msgid "" "(Contributed by Jelle Zijlstra in :gh:`104003`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1430 +#: ../../whatsnew/3.13.rst:1434 msgid "xml" msgstr "xml" -#: ../../whatsnew/3.13.rst:1432 +#: ../../whatsnew/3.13.rst:1436 msgid "" "Allow controlling Expat >=2.6.0 reparse deferral (:cve:`2023-52425`) by " "adding five new methods:" msgstr "" -#: ../../whatsnew/3.13.rst:1435 +#: ../../whatsnew/3.13.rst:1439 msgid ":meth:`xml.etree.ElementTree.XMLParser.flush`" msgstr ":meth:`xml.etree.ElementTree.XMLParser.flush`" -#: ../../whatsnew/3.13.rst:1436 +#: ../../whatsnew/3.13.rst:1440 msgid ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" msgstr ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" -#: ../../whatsnew/3.13.rst:1437 +#: ../../whatsnew/3.13.rst:1441 msgid ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" msgstr ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" -#: ../../whatsnew/3.13.rst:1438 +#: ../../whatsnew/3.13.rst:1442 msgid ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" msgstr ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" -#: ../../whatsnew/3.13.rst:1439 +#: ../../whatsnew/3.13.rst:1443 msgid ":meth:`!xml.sax.expatreader.ExpatParser.flush`" msgstr ":meth:`!xml.sax.expatreader.ExpatParser.flush`" -#: ../../whatsnew/3.13.rst:1441 +#: ../../whatsnew/3.13.rst:1445 msgid "(Contributed by Sebastian Pipping in :gh:`115623`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1443 +#: ../../whatsnew/3.13.rst:1447 msgid "" "Add the :meth:`!close` method for the iterator returned by :func:`~xml.etree." "ElementTree.iterparse` for explicit cleanup. (Contributed by Serhiy " "Storchaka in :gh:`69893`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1449 +#: ../../whatsnew/3.13.rst:1453 msgid "zipimport" msgstr "zipimport" -#: ../../whatsnew/3.13.rst:1451 +#: ../../whatsnew/3.13.rst:1455 msgid "" "Add support for ZIP64_ format files. Everybody loves huge data, right? " "(Contributed by Tim Hatch in :gh:`94146`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1459 +#: ../../whatsnew/3.13.rst:1463 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.13.rst:1461 +#: ../../whatsnew/3.13.rst:1465 msgid "" "Several standard library modules have had their import times significantly " "improved. For example, the import time of the :mod:`typing` module has been " @@ -2163,13 +2171,13 @@ msgid "" "Turner, Daniel Hollas, and others in :gh:`109653`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1472 +#: ../../whatsnew/3.13.rst:1476 msgid "" ":func:`textwrap.indent` is now around 30% faster than before for large " "input. (Contributed by Inada Naoki in :gh:`107369`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1475 +#: ../../whatsnew/3.13.rst:1479 msgid "" "The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " "in more situations, including when *close_fds* is ``True`` (the default) on " @@ -2179,15 +2187,15 @@ msgid "" "Kulik in :gh:`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1485 +#: ../../whatsnew/3.13.rst:1489 msgid "Removed Modules And APIs" msgstr "" -#: ../../whatsnew/3.13.rst:1491 +#: ../../whatsnew/3.13.rst:1495 msgid "PEP 594: Remove \"dead batteries\" from the standard library" msgstr "" -#: ../../whatsnew/3.13.rst:1493 +#: ../../whatsnew/3.13.rst:1497 msgid "" ":pep:`594` proposed removing 19 modules from the standard library, " "colloquially referred to as 'dead batteries' due to their historic, " @@ -2195,23 +2203,23 @@ msgid "" "in Python 3.11, and are now removed:" msgstr "" -#: ../../whatsnew/3.13.rst:1499 +#: ../../whatsnew/3.13.rst:1503 msgid ":mod:`!aifc`" msgstr ":mod:`!aifc`" -#: ../../whatsnew/3.13.rst:1500 +#: ../../whatsnew/3.13.rst:1504 msgid ":mod:`!audioop`" msgstr ":mod:`!audioop`" -#: ../../whatsnew/3.13.rst:1501 +#: ../../whatsnew/3.13.rst:1505 msgid ":mod:`!chunk`" msgstr ":mod:`!chunk`" -#: ../../whatsnew/3.13.rst:1502 +#: ../../whatsnew/3.13.rst:1506 msgid ":mod:`!cgi` and :mod:`!cgitb`" msgstr ":mod:`!cgi` 和 :mod:`!cgitb`" -#: ../../whatsnew/3.13.rst:1504 +#: ../../whatsnew/3.13.rst:1508 msgid "" ":class:`!cgi.FieldStorage` can typically be replaced with :func:`urllib." "parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." @@ -2219,7 +2227,7 @@ msgid "" "requests." msgstr "" -#: ../../whatsnew/3.13.rst:1509 +#: ../../whatsnew/3.13.rst:1513 msgid "" ":func:`!cgi.parse` can be replaced by calling :func:`urllib.parse.parse_qs` " "directly on the desired query string, unless the input is ``multipart/form-" @@ -2227,14 +2235,14 @@ msgid "" "parse_multipart`." msgstr "" -#: ../../whatsnew/3.13.rst:1514 +#: ../../whatsnew/3.13.rst:1518 msgid "" ":func:`!cgi.parse_header` can be replaced with the functionality in the :mod:" "`email` package, which implements the same MIME RFCs. For example, with :" "class:`email.message.EmailMessage`:" msgstr "" -#: ../../whatsnew/3.13.rst:1518 +#: ../../whatsnew/3.13.rst:1522 msgid "" "from email.message import EmailMessage\n" "\n" @@ -2243,7 +2251,7 @@ msgid "" "main, params = msg.get_content_type(), msg['content-type'].params" msgstr "" -#: ../../whatsnew/3.13.rst:1526 +#: ../../whatsnew/3.13.rst:1530 msgid "" ":func:`!cgi.parse_multipart` can be replaced with the functionality in the :" "mod:`email` package, which implements the same MIME RFCs, or with the :pypi:" @@ -2251,41 +2259,41 @@ msgid "" "and :class:`email.message.Message` classes." msgstr "" -#: ../../whatsnew/3.13.rst:1532 +#: ../../whatsnew/3.13.rst:1536 msgid "" ":mod:`!crypt` and the private :mod:`!_crypt` extension. The :mod:`hashlib` " "module may be an appropriate replacement when simply hashing a value is " "required. Otherwise, various third-party libraries on PyPI are available:" msgstr "" -#: ../../whatsnew/3.13.rst:1537 +#: ../../whatsnew/3.13.rst:1541 msgid "" ":pypi:`bcrypt`: Modern password hashing for your software and your servers." msgstr "" -#: ../../whatsnew/3.13.rst:1539 +#: ../../whatsnew/3.13.rst:1543 msgid "" ":pypi:`passlib`: Comprehensive password hashing framework supporting over 30 " "schemes." msgstr "" -#: ../../whatsnew/3.13.rst:1541 +#: ../../whatsnew/3.13.rst:1545 msgid ":pypi:`argon2-cffi`: The secure Argon2 password hashing algorithm." msgstr "" -#: ../../whatsnew/3.13.rst:1543 +#: ../../whatsnew/3.13.rst:1547 msgid "" ":pypi:`legacycrypt`: :mod:`ctypes` wrapper to the POSIX crypt library call " "and associated functionality." msgstr "" -#: ../../whatsnew/3.13.rst:1546 +#: ../../whatsnew/3.13.rst:1550 msgid "" ":pypi:`crypt_r`: Fork of the :mod:`!crypt` module, wrapper to the :manpage:" "`crypt_r(3)` library call and associated functionality." msgstr "" -#: ../../whatsnew/3.13.rst:1551 +#: ../../whatsnew/3.13.rst:1555 msgid "" ":mod:`!imghdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements. For example, the :func:`!" @@ -2293,83 +2301,83 @@ msgid "" "function for all file formats that were supported by :mod:`!imghdr`." msgstr "" -#: ../../whatsnew/3.13.rst:1557 +#: ../../whatsnew/3.13.rst:1561 msgid ":mod:`!mailcap`: Use the :mod:`mimetypes` module instead." msgstr "" -#: ../../whatsnew/3.13.rst:1559 +#: ../../whatsnew/3.13.rst:1563 msgid ":mod:`!msilib`" msgstr ":mod:`!msilib`" -#: ../../whatsnew/3.13.rst:1560 +#: ../../whatsnew/3.13.rst:1564 msgid ":mod:`!nis`" msgstr ":mod:`!nis`" -#: ../../whatsnew/3.13.rst:1561 +#: ../../whatsnew/3.13.rst:1565 msgid ":mod:`!nntplib`: Use the :pypi:`pynntp` library from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1563 +#: ../../whatsnew/3.13.rst:1567 msgid "" ":mod:`!ossaudiodev`: For audio playback, use the :pypi:`pygame` library from " "PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1565 +#: ../../whatsnew/3.13.rst:1569 msgid ":mod:`!pipes`: Use the :mod:`subprocess` module instead." msgstr "" -#: ../../whatsnew/3.13.rst:1567 +#: ../../whatsnew/3.13.rst:1571 msgid "" ":mod:`!sndhdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements." msgstr "" -#: ../../whatsnew/3.13.rst:1570 +#: ../../whatsnew/3.13.rst:1574 msgid ":mod:`!spwd`: Use the :pypi:`python-pam` library from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1572 +#: ../../whatsnew/3.13.rst:1576 msgid ":mod:`!sunau`" msgstr ":mod:`!sunau`" -#: ../../whatsnew/3.13.rst:1573 +#: ../../whatsnew/3.13.rst:1577 msgid "" ":mod:`!telnetlib`, Use the :pypi:`telnetlib3` or :pypi:`Exscript` libraries " "from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1575 +#: ../../whatsnew/3.13.rst:1579 msgid "" ":mod:`!uu`: Use the :mod:`base64` module instead, as a modern alternative." msgstr "" -#: ../../whatsnew/3.13.rst:1577 +#: ../../whatsnew/3.13.rst:1581 msgid ":mod:`!xdrlib`" msgstr ":mod:`!xdrlib`" -#: ../../whatsnew/3.13.rst:1579 +#: ../../whatsnew/3.13.rst:1583 msgid "" "(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` and :gh:" "`104780`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1583 +#: ../../whatsnew/3.13.rst:1587 msgid "2to3" msgstr "2to3" -#: ../../whatsnew/3.13.rst:1585 +#: ../../whatsnew/3.13.rst:1589 msgid "" "Remove the :program:`2to3` program and the :mod:`!lib2to3` module, " "previously deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:" "`104780`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1591 +#: ../../whatsnew/3.13.rst:1595 msgid "builtins" msgstr "builtins" -#: ../../whatsnew/3.13.rst:1593 +#: ../../whatsnew/3.13.rst:1597 msgid "" "Remove support for chained :class:`classmethod` descriptors (introduced in :" "gh:`63272`). These can no longer be used to wrap other descriptors, such as :" @@ -2379,47 +2387,47 @@ msgid "" "(Contributed by Raymond Hettinger in :gh:`89519`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1602 +#: ../../whatsnew/3.13.rst:1606 msgid "" "Raise a :exc:`RuntimeError` when calling :meth:`frame.clear` on a suspended " "frame (as has always been the case for an executing frame). (Contributed by " "Irit Katriel in :gh:`79932`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1610 +#: ../../whatsnew/3.13.rst:1614 msgid "" "Remove the undocumented :class:`!LegacyInterpolation` class, deprecated in " "the docstring since Python 3.2, and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104886`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1617 +#: ../../whatsnew/3.13.rst:1621 msgid "importlib.metadata" msgstr "importlib.metadata" -#: ../../whatsnew/3.13.rst:1619 +#: ../../whatsnew/3.13.rst:1623 msgid "" "Remove deprecated subscript (:meth:`~object.__getitem__`) access for :ref:" "`EntryPoint ` objects. (Contributed by Jason R. Coombs in :gh:" "`113175`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1625 +#: ../../whatsnew/3.13.rst:1629 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.13.rst:1627 +#: ../../whatsnew/3.13.rst:1631 msgid "" "Remove the :func:`!locale.resetlocale` function, deprecated in Python 3.11. " "Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. (Contributed by " "Victor Stinner in :gh:`104783`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1633 +#: ../../whatsnew/3.13.rst:1637 msgid "opcode" msgstr "opcode" -#: ../../whatsnew/3.13.rst:1635 +#: ../../whatsnew/3.13.rst:1639 msgid "" "Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!_opcode." "ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " @@ -2427,7 +2435,7 @@ msgid "" "Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1640 +#: ../../whatsnew/3.13.rst:1644 msgid "" "Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, and :" "attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but were " @@ -2435,43 +2443,43 @@ msgid "" "be used externally. (Contributed by Irit Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1650 +#: ../../whatsnew/3.13.rst:1654 msgid "" "Remove the ability to use :class:`~pathlib.Path` objects as context " "managers. This functionality was deprecated and has had no effect since " "Python 3.9. (Contributed by Barney Gale in :gh:`83863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1658 +#: ../../whatsnew/3.13.rst:1662 msgid "" "Remove the undocumented, deprecated, and broken :func:`!re.template` " "function and :attr:`!re.TEMPLATE` / :attr:`!re.T` flag. (Contributed by " "Serhiy Storchaka and Nikita Sobolev in :gh:`105687`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1664 +#: ../../whatsnew/3.13.rst:1668 msgid "tkinter.tix" msgstr "tkinter.tix" -#: ../../whatsnew/3.13.rst:1666 +#: ../../whatsnew/3.13.rst:1670 msgid "" "Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6. The third-" "party Tix library which the module wrapped is unmaintained. (Contributed by " "Zachary Ware in :gh:`75552`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1672 +#: ../../whatsnew/3.13.rst:1676 msgid "turtle" msgstr "turtle" -#: ../../whatsnew/3.13.rst:1674 +#: ../../whatsnew/3.13.rst:1678 msgid "" "Remove the :meth:`!RawTurtle.settiltangle` method, deprecated in the " "documentation since Python 3.1 and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104876`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1683 +#: ../../whatsnew/3.13.rst:1687 msgid "" "Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces, deprecated " "since Python 3.8. The items in those namespaces can be imported directly " @@ -2479,66 +2487,66 @@ msgid "" "`92871`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1689 +#: ../../whatsnew/3.13.rst:1693 msgid "" "Remove the keyword-argument method of creating :class:`~typing.TypedDict` " "types, deprecated in Python 3.11. (Contributed by Tomas Roun in :gh:" "`104786`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1695 +#: ../../whatsnew/3.13.rst:1699 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.13.rst:1697 +#: ../../whatsnew/3.13.rst:1701 msgid "" "Remove the following :mod:`unittest` functions, deprecated in Python 3.11:" msgstr "" -#: ../../whatsnew/3.13.rst:1699 +#: ../../whatsnew/3.13.rst:1703 msgid ":func:`!unittest.findTestCases`" msgstr ":func:`!unittest.findTestCases`" -#: ../../whatsnew/3.13.rst:1700 +#: ../../whatsnew/3.13.rst:1704 msgid ":func:`!unittest.makeSuite`" msgstr ":func:`!unittest.makeSuite`" -#: ../../whatsnew/3.13.rst:1701 +#: ../../whatsnew/3.13.rst:1705 msgid ":func:`!unittest.getTestCaseNames`" msgstr ":func:`!unittest.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1703 +#: ../../whatsnew/3.13.rst:1707 msgid "Use :class:`~unittest.TestLoader` methods instead:" msgstr "" -#: ../../whatsnew/3.13.rst:1705 +#: ../../whatsnew/3.13.rst:1709 msgid ":meth:`~unittest.TestLoader.loadTestsFromModule`" msgstr ":meth:`~unittest.TestLoader.loadTestsFromModule`" -#: ../../whatsnew/3.13.rst:1706 +#: ../../whatsnew/3.13.rst:1710 msgid ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" msgstr ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" -#: ../../whatsnew/3.13.rst:1707 +#: ../../whatsnew/3.13.rst:1711 msgid ":meth:`~unittest.TestLoader.getTestCaseNames`" msgstr ":meth:`~unittest.TestLoader.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1709 +#: ../../whatsnew/3.13.rst:1713 msgid "(Contributed by Hugo van Kemenade in :gh:`104835`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1711 +#: ../../whatsnew/3.13.rst:1715 msgid "" "Remove the untested and undocumented :meth:`!TestProgram.usageExit` method, " "deprecated in Python 3.11. (Contributed by Hugo van Kemenade in :gh:" "`104992`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1717 +#: ../../whatsnew/3.13.rst:1721 msgid "urllib" msgstr "urllib" -#: ../../whatsnew/3.13.rst:1719 +#: ../../whatsnew/3.13.rst:1723 msgid "" "Remove the *cafile*, *capath*, and *cadefault* parameters of the :func:" "`urllib.request.urlopen` function, deprecated in Python 3.6. Use the " @@ -2549,33 +2557,33 @@ msgid "" "Victor Stinner in :gh:`105382`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1730 +#: ../../whatsnew/3.13.rst:1734 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.13.rst:1732 +#: ../../whatsnew/3.13.rst:1736 msgid "" "Remove the untested and undocumented :class:`!MacOSX` class, deprecated in " "Python 3.11. Use the :class:`!MacOSXOSAScript` class (introduced in Python " "3.2) instead. (Contributed by Hugo van Kemenade in :gh:`104804`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1737 +#: ../../whatsnew/3.13.rst:1741 msgid "" "Remove the deprecated :attr:`!MacOSXOSAScript._name` attribute. Use the :" "attr:`MacOSXOSAScript.name ` attribute instead. " "(Contributed by Nikita Sobolev in :gh:`105546`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1744 +#: ../../whatsnew/3.13.rst:1748 msgid "New Deprecations" msgstr "" -#: ../../whatsnew/3.13.rst:1746 +#: ../../whatsnew/3.13.rst:1750 msgid ":ref:`User-defined functions `:" msgstr "" -#: ../../whatsnew/3.13.rst:1748 +#: ../../whatsnew/3.13.rst:1752 msgid "" "Deprecate assignment to a function's :attr:`~function.__code__` attribute, " "where the new code object's type does not match the function's type. The " @@ -2583,12 +2591,12 @@ msgid "" "coroutine. (Contributed by Irit Katriel in :gh:`81137`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1754 +#: ../../whatsnew/3.13.rst:1758 #: ../../deprecations/pending-removal-in-3.16.rst:13 msgid ":mod:`array`:" msgstr ":mod:`array`:" -#: ../../whatsnew/3.13.rst:1756 +#: ../../whatsnew/3.13.rst:1760 msgid "" "Deprecate the ``'u'`` format code (:c:type:`wchar_t`) at runtime. This " "format code has been deprecated in documentation since Python 3.3, and will " @@ -2597,50 +2605,50 @@ msgid "" "`80480`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1763 -#: ../../deprecations/pending-removal-in-3.15.rst:4 +#: ../../whatsnew/3.13.rst:1767 +#: ../../deprecations/pending-removal-in-3.15.rst:16 msgid ":mod:`ctypes`:" msgstr ":mod:`ctypes`:" -#: ../../whatsnew/3.13.rst:1765 +#: ../../whatsnew/3.13.rst:1769 msgid "" "Deprecate the undocumented :func:`!SetPointerType` function, to be removed " "in Python 3.15. (Contributed by Victor Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1769 +#: ../../whatsnew/3.13.rst:1773 msgid "" ":term:`Soft-deprecate ` the :func:`~ctypes.ARRAY` function " "in favour of ``type * length`` multiplication. (Contributed by Victor " "Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1773 +#: ../../whatsnew/3.13.rst:1777 msgid ":mod:`decimal`:" msgstr ":mod:`decimal`:" -#: ../../whatsnew/3.13.rst:1775 +#: ../../whatsnew/3.13.rst:1779 msgid "" "Deprecate the non-standard and undocumented :class:`~decimal.Decimal` format " "specifier ``'N'``, which is only supported in the :mod:`!decimal` module's C " "implementation. (Contributed by Serhiy Storchaka in :gh:`89902`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1780 +#: ../../whatsnew/3.13.rst:1784 msgid ":mod:`dis`:" msgstr ":mod:`dis`:" -#: ../../whatsnew/3.13.rst:1782 +#: ../../whatsnew/3.13.rst:1786 msgid "" "Deprecate the :attr:`!HAVE_ARGUMENT` separator. Check membership in :data:" "`~dis.hasarg` instead. (Contributed by Irit Katriel in :gh:`109319`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1786 +#: ../../whatsnew/3.13.rst:1790 msgid ":mod:`getopt` and :mod:`optparse`:" msgstr ":mod:`getopt` 和 :mod:`optparse`:" -#: ../../whatsnew/3.13.rst:1788 +#: ../../whatsnew/3.13.rst:1792 msgid "" "Both modules are now :term:`soft deprecated`, with :mod:`argparse` preferred " "for new projects. This is a new soft-deprecation for the :mod:`!getopt` " @@ -2648,22 +2656,22 @@ msgid "" "deprecated. (Contributed by Victor Stinner in :gh:`106535`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1794 +#: ../../whatsnew/3.13.rst:1798 msgid ":mod:`gettext`:" msgstr ":mod:`gettext`:" -#: ../../whatsnew/3.13.rst:1796 +#: ../../whatsnew/3.13.rst:1800 msgid "" "Deprecate non-integer numbers as arguments to functions and methods that " "consider plural forms in the :mod:`!gettext` module, even if no translation " "was found. (Contributed by Serhiy Storchaka in :gh:`88434`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1801 +#: ../../whatsnew/3.13.rst:1805 msgid ":mod:`glob`:" msgstr ":mod:`glob`:" -#: ../../whatsnew/3.13.rst:1803 +#: ../../whatsnew/3.13.rst:1807 msgid "" "Deprecate the undocumented :func:`!glob0` and :func:`!glob1` functions. Use :" "func:`~glob.glob` and pass a :term:`path-like object` specifying the root " @@ -2671,12 +2679,12 @@ msgid "" "in :gh:`117337`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1808 -#: ../../deprecations/pending-removal-in-3.15.rst:9 +#: ../../whatsnew/3.13.rst:1812 +#: ../../deprecations/pending-removal-in-3.15.rst:21 msgid ":mod:`http.server`:" msgstr ":mod:`http.server`:" -#: ../../whatsnew/3.13.rst:1810 +#: ../../whatsnew/3.13.rst:1814 msgid "" "Deprecate :class:`~http.server.CGIHTTPRequestHandler`, to be removed in " "Python 3.15. Process-based CGI HTTP servers have been out of favor for a " @@ -2685,29 +2693,29 @@ msgid "" "by Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1817 +#: ../../whatsnew/3.13.rst:1821 msgid "" "Deprecate the :option:`!--cgi` flag to the :program:`python -m http.server` " "command-line interface, to be removed in Python 3.15. (Contributed by " "Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1822 +#: ../../whatsnew/3.13.rst:1826 msgid ":mod:`mimetypes`:" msgstr ":mod:`mimetypes`:" -#: ../../whatsnew/3.13.rst:1824 +#: ../../whatsnew/3.13.rst:1828 msgid "" ":term:`Soft-deprecate ` file path arguments to :func:" "`~mimetypes.guess_type`, use :func:`~mimetypes.guess_file_type` instead. " "(Contributed by Serhiy Storchaka in :gh:`66543`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1829 +#: ../../whatsnew/3.13.rst:1833 msgid ":mod:`re`:" msgstr ":mod:`re`:" -#: ../../whatsnew/3.13.rst:1831 +#: ../../whatsnew/3.13.rst:1835 msgid "" "Deprecate passing the optional *maxsplit*, *count*, or *flags* arguments as " "positional arguments to the module-level :func:`~re.split`, :func:`~re.sub`, " @@ -2716,46 +2724,46 @@ msgid "" "by Serhiy Storchaka in :gh:`56166`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1838 -#: ../../deprecations/pending-removal-in-3.15.rst:33 +#: ../../whatsnew/3.13.rst:1842 +#: ../../deprecations/pending-removal-in-3.15.rst:42 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../whatsnew/3.13.rst:1840 +#: ../../whatsnew/3.13.rst:1844 msgid "" "Deprecate :meth:`.PurePath.is_reserved`, to be removed in Python 3.15. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows. (Contributed " "by Barney Gale in :gh:`88569`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1845 -#: ../../deprecations/pending-removal-in-3.15.rst:39 +#: ../../whatsnew/3.13.rst:1849 +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../whatsnew/3.13.rst:1847 +#: ../../whatsnew/3.13.rst:1851 msgid "" "Deprecate :func:`~platform.java_ver`, to be removed in Python 3.15. This " "function is only useful for Jython support, has a confusing API, and is " "largely untested. (Contributed by Nikita Sobolev in :gh:`116349`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1853 +#: ../../whatsnew/3.13.rst:1857 msgid ":mod:`pydoc`:" msgstr ":mod:`pydoc`:" -#: ../../whatsnew/3.13.rst:1855 +#: ../../whatsnew/3.13.rst:1859 msgid "" "Deprecate the undocumented :func:`!ispackage` function. (Contributed by " "Zackery Spytz in :gh:`64020`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1858 -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../whatsnew/3.13.rst:1862 +#: ../../deprecations/pending-removal-in-3.14.rst:98 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../whatsnew/3.13.rst:1860 +#: ../../whatsnew/3.13.rst:1864 msgid "" "Deprecate passing more than one positional argument to the :func:`~sqlite3." "connect` function and the :class:`~sqlite3.Connection` constructor. The " @@ -2763,7 +2771,7 @@ msgid "" "by Erlend E. Aasland in :gh:`107948`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1866 +#: ../../whatsnew/3.13.rst:1870 msgid "" "Deprecate passing name, number of arguments, and the callable as keyword " "arguments for :meth:`.Connection.create_function` and :meth:`.Connection." @@ -2771,7 +2779,7 @@ msgid "" "3.15. (Contributed by Erlend E. Aasland in :gh:`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1872 +#: ../../whatsnew/3.13.rst:1876 msgid "" "Deprecate passing the callback callable by keyword for the :meth:`~sqlite3." "Connection.set_authorizer`, :meth:`~sqlite3.Connection." @@ -2781,46 +2789,46 @@ msgid "" "`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1880 +#: ../../whatsnew/3.13.rst:1884 #: ../../deprecations/pending-removal-in-3.16.rst:33 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" -#: ../../whatsnew/3.13.rst:1882 +#: ../../whatsnew/3.13.rst:1886 msgid "" "Deprecate the :func:`~sys._enablelegacywindowsfsencoding` function, to be " "removed in Python 3.16. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable instead. (Contributed by Inada Naoki in :gh:`73427`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1887 +#: ../../whatsnew/3.13.rst:1891 #: ../../deprecations/pending-removal-in-3.16.rst:39 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" -#: ../../whatsnew/3.13.rst:1889 +#: ../../whatsnew/3.13.rst:1893 msgid "" "Deprecate the undocumented and unused :attr:`!TarFile.tarfile` attribute, to " "be removed in Python 3.16. (Contributed in :gh:`115256`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1893 +#: ../../whatsnew/3.13.rst:1897 msgid ":mod:`traceback`:" msgstr ":mod:`traceback`:" -#: ../../whatsnew/3.13.rst:1895 +#: ../../whatsnew/3.13.rst:1899 msgid "" "Deprecate the :attr:`.TracebackException.exc_type` attribute. Use :attr:`." "TracebackException.exc_type_str` instead. (Contributed by Irit Katriel in :" "gh:`112332`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1899 -#: ../../deprecations/pending-removal-in-3.15.rst:53 +#: ../../whatsnew/3.13.rst:1903 +#: ../../deprecations/pending-removal-in-3.15.rst:62 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../whatsnew/3.13.rst:1901 +#: ../../whatsnew/3.13.rst:1905 msgid "" "Deprecate the undocumented keyword argument syntax for creating :class:" "`~typing.NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, " @@ -2828,7 +2836,7 @@ msgid "" "functional syntax instead. (Contributed by Alex Waygood in :gh:`105566`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1908 +#: ../../whatsnew/3.13.rst:1912 msgid "" "Deprecate omitting the *fields* parameter when creating a :class:`~typing." "NamedTuple` or :class:`typing.TypedDict` class, and deprecate passing " @@ -2840,7 +2848,7 @@ msgid "" "Alex Waygood in :gh:`105566` and :gh:`105570`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1918 +#: ../../whatsnew/3.13.rst:1922 msgid "" "Deprecate the :func:`typing.no_type_check_decorator` decorator function, to " "be removed in in Python 3.15. After eight years in the :mod:`typing` module, " @@ -2848,7 +2856,7 @@ msgid "" "Waygood in :gh:`106309`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1924 +#: ../../whatsnew/3.13.rst:1928 msgid "" "Deprecate :data:`typing.AnyStr`. In Python 3.16, it will be removed from " "``typing.__all__``, and a :exc:`DeprecationWarning` will be emitted at " @@ -2857,12 +2865,12 @@ msgid "" "(Contributed by Michael The in :gh:`107116`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1932 -#: ../../deprecations/pending-removal-in-3.15.rst:66 +#: ../../whatsnew/3.13.rst:1936 +#: ../../deprecations/pending-removal-in-3.15.rst:75 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../whatsnew/3.13.rst:1934 +#: ../../whatsnew/3.13.rst:1938 msgid "" "Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:" "`~wave.Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :" @@ -2876,6 +2884,22 @@ msgid "Pending Removal in Python 3.14" msgstr "Python 3.14 中待移除的項目" #: ../../deprecations/pending-removal-in-3.14.rst:4 +#: ../../deprecations/pending-removal-in-3.15.rst:4 +msgid "The import system:" +msgstr "引入系統 (import system):" + +#: ../../deprecations/pending-removal-in-3.14.rst:6 +msgid "" +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.14, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." +msgstr "" +"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " +"` 的做法已被棄用。在 Python 3.14 中," +"引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__` 。" + +#: ../../deprecations/pending-removal-in-3.14.rst:11 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" "argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " @@ -2885,7 +2909,7 @@ msgstr "" "*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " "於 :gh:`92248` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:9 +#: ../../deprecations/pending-removal-in-3.14.rst:16 msgid "" ":mod:`ast`: The following features have been deprecated in documentation " "since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " @@ -2894,38 +2918,38 @@ msgstr "" ":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時會" "於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" -#: ../../deprecations/pending-removal-in-3.14.rst:13 +#: ../../deprecations/pending-removal-in-3.14.rst:20 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" -#: ../../deprecations/pending-removal-in-3.14.rst:14 +#: ../../deprecations/pending-removal-in-3.14.rst:21 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" -#: ../../deprecations/pending-removal-in-3.14.rst:15 +#: ../../deprecations/pending-removal-in-3.14.rst:22 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" -#: ../../deprecations/pending-removal-in-3.14.rst:16 +#: ../../deprecations/pending-removal-in-3.14.rst:23 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" -#: ../../deprecations/pending-removal-in-3.14.rst:17 +#: ../../deprecations/pending-removal-in-3.14.rst:24 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" -#: ../../deprecations/pending-removal-in-3.14.rst:19 +#: ../../deprecations/pending-removal-in-3.14.rst:26 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" "`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.14.rst:29 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" -#: ../../deprecations/pending-removal-in-3.14.rst:24 +#: ../../deprecations/pending-removal-in-3.14.rst:31 msgid "" "The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" "`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" @@ -2937,7 +2961,7 @@ msgstr "" "AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " "Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:30 +#: ../../deprecations/pending-removal-in-3.14.rst:37 msgid "" ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" "`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." @@ -2949,7 +2973,7 @@ msgstr "" "AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" "除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:36 +#: ../../deprecations/pending-removal-in-3.14.rst:43 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " "now emits a :exc:`DeprecationWarning` if there is no current event loop set " @@ -2960,7 +2984,7 @@ msgstr "" "件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:41 +#: ../../deprecations/pending-removal-in-3.14.rst:48 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " @@ -2972,7 +2996,7 @@ msgstr "" "改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " "Shantanu Jain 於 :gh:`91896` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:47 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid "" ":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" @@ -2980,39 +3004,39 @@ msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:50 +#: ../../deprecations/pending-removal-in-3.14.rst:57 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:52 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:53 +#: ../../deprecations/pending-removal-in-3.14.rst:60 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:54 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:58 +#: ../../deprecations/pending-removal-in-3.14.rst:65 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:66 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:68 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:63 +#: ../../deprecations/pending-removal-in-3.14.rst:70 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -3023,7 +3047,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:69 +#: ../../deprecations/pending-removal-in-3.14.rst:76 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -3040,7 +3064,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:77 +#: ../../deprecations/pending-removal-in-3.14.rst:84 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -3048,7 +3072,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:81 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -3058,23 +3082,23 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:86 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:88 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:96 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:93 +#: ../../deprecations/pending-removal-in-3.14.rst:100 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:95 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -3084,7 +3108,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:99 +#: ../../deprecations/pending-removal-in-3.14.rst:106 msgid "" "date and datetime adapter, date and timestamp converter: see the :mod:" "`sqlite3` documentation for suggested replacement recipes." @@ -3092,7 +3116,7 @@ msgstr "" "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" "參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:109 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -3104,7 +3128,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:109 +#: ../../deprecations/pending-removal-in-3.14.rst:116 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -3112,7 +3136,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:112 +#: ../../deprecations/pending-removal-in-3.14.rst:119 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -3128,12 +3152,34 @@ msgstr "Python 3.15 中待移除的項目" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached ` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" +msgstr "" +"在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " +"` 的做法已被棄用。在 Python 3.15 中," +"引入系統或標準函式庫將不再設定或考慮 :attr:`!__cached__`。(:gh:`97879`)" + +#: ../../deprecations/pending-removal-in-3.15.rst:11 +msgid "" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent ` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" +msgstr "" +"在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " +"` 的做法已被棄用。在 Python 3.15 中," +"引入系統或標準函式庫將不再設定或考慮 :attr:`!__package__`。(:gh:`97879`)" + +#: ../../deprecations/pending-removal-in-3.15.rst:18 +msgid "" "The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " "since Python 3.13." msgstr "" "自 Python 3.13 起,未記錄的 :func:`!ctypes.SetPointerType` 函式已被棄用。" -#: ../../deprecations/pending-removal-in-3.15.rst:11 +#: ../../deprecations/pending-removal-in-3.15.rst:23 msgid "" "The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " "been deprecated since Python 3.13. No direct replacement exists. *Anything* " @@ -3143,7 +3189,7 @@ msgstr "" "起已被棄用。不存在直接的替代。*任何東西*\\ 都比 CGI 更好地將 Web 伺服器與請求" "處理程序介接起來。" -#: ../../deprecations/pending-removal-in-3.15.rst:17 +#: ../../deprecations/pending-removal-in-3.15.rst:29 msgid "" "The :option:`!--cgi` flag to the :program:`python -m http.server` command-" "line interface has been deprecated since Python 3.13." @@ -3151,19 +3197,11 @@ msgstr "" "自 Python 3.13 起,:program:`python -m http.server` 命令列介面的 :option:`!--" "cgi` 旗標已被棄用。" -#: ../../deprecations/pending-removal-in-3.15.rst:20 -msgid "" -":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " -"taken into consideration by the import system (:gh:`97879`)." -msgstr "" -":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " -"系統考慮。 (:gh:`97879`)" - -#: ../../deprecations/pending-removal-in-3.15.rst:23 +#: ../../deprecations/pending-removal-in-3.15.rst:32 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:25 +#: ../../deprecations/pending-removal-in-3.15.rst:34 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" @@ -3176,7 +3214,7 @@ msgstr "" "`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." "getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:35 +#: ../../deprecations/pending-removal-in-3.15.rst:44 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows." @@ -3184,7 +3222,7 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." "isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:41 +#: ../../deprecations/pending-removal-in-3.15.rst:50 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -3193,11 +3231,11 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:45 +#: ../../deprecations/pending-removal-in-3.15.rst:54 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:47 +#: ../../deprecations/pending-removal-in-3.15.rst:56 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -3208,7 +3246,7 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:55 +#: ../../deprecations/pending-removal-in-3.15.rst:64 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -3219,7 +3257,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:61 +#: ../../deprecations/pending-removal-in-3.15.rst:70 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -3229,7 +3267,7 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:68 +#: ../../deprecations/pending-removal-in-3.15.rst:77 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -3480,6 +3518,8 @@ msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" +"`~logging.warning`。" #: ../../deprecations/pending-removal-in-future.rst:72 msgid "" @@ -3728,11 +3768,11 @@ msgstr "" ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." "zipimporter.exec_module`。" -#: ../../whatsnew/3.13.rst:1951 +#: ../../whatsnew/3.13.rst:1955 msgid "CPython Bytecode Changes" msgstr "" -#: ../../whatsnew/3.13.rst:1953 +#: ../../whatsnew/3.13.rst:1957 msgid "" "The oparg of :opcode:`YIELD_VALUE` is now ``1`` if the yield is part of a " "yield-from or await, and ``0`` otherwise. The oparg of :opcode:`RESUME` was " @@ -3741,97 +3781,97 @@ msgid "" "`111354`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1961 +#: ../../whatsnew/3.13.rst:1965 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.13.rst:1966 +#: ../../whatsnew/3.13.rst:1970 msgid "" "Add the :ref:`PyMonitoring C API ` for generating :pep:" "`669` monitoring events:" msgstr "" -#: ../../whatsnew/3.13.rst:1969 +#: ../../whatsnew/3.13.rst:1973 msgid ":c:type:`PyMonitoringState`" msgstr ":c:type:`PyMonitoringState`" -#: ../../whatsnew/3.13.rst:1970 +#: ../../whatsnew/3.13.rst:1974 msgid ":c:func:`PyMonitoring_FirePyStartEvent`" msgstr ":c:func:`PyMonitoring_FirePyStartEvent`" -#: ../../whatsnew/3.13.rst:1971 +#: ../../whatsnew/3.13.rst:1975 msgid ":c:func:`PyMonitoring_FirePyResumeEvent`" msgstr ":c:func:`PyMonitoring_FirePyResumeEvent`" -#: ../../whatsnew/3.13.rst:1972 +#: ../../whatsnew/3.13.rst:1976 msgid ":c:func:`PyMonitoring_FirePyReturnEvent`" msgstr ":c:func:`PyMonitoring_FirePyReturnEvent`" -#: ../../whatsnew/3.13.rst:1973 +#: ../../whatsnew/3.13.rst:1977 msgid ":c:func:`PyMonitoring_FirePyYieldEvent`" msgstr ":c:func:`PyMonitoring_FirePyYieldEvent`" -#: ../../whatsnew/3.13.rst:1974 +#: ../../whatsnew/3.13.rst:1978 msgid ":c:func:`PyMonitoring_FireCallEvent`" msgstr ":c:func:`PyMonitoring_FireCallEvent`" -#: ../../whatsnew/3.13.rst:1975 +#: ../../whatsnew/3.13.rst:1979 msgid ":c:func:`PyMonitoring_FireLineEvent`" msgstr ":c:func:`PyMonitoring_FireLineEvent`" -#: ../../whatsnew/3.13.rst:1976 +#: ../../whatsnew/3.13.rst:1980 msgid ":c:func:`PyMonitoring_FireJumpEvent`" msgstr ":c:func:`PyMonitoring_FireJumpEvent`" -#: ../../whatsnew/3.13.rst:1977 +#: ../../whatsnew/3.13.rst:1981 msgid ":c:func:`PyMonitoring_FireBranchEvent`" msgstr ":c:func:`PyMonitoring_FireBranchEvent`" -#: ../../whatsnew/3.13.rst:1978 +#: ../../whatsnew/3.13.rst:1982 msgid ":c:func:`PyMonitoring_FireCReturnEvent`" msgstr ":c:func:`PyMonitoring_FireCReturnEvent`" -#: ../../whatsnew/3.13.rst:1979 +#: ../../whatsnew/3.13.rst:1983 msgid ":c:func:`PyMonitoring_FirePyThrowEvent`" msgstr ":c:func:`PyMonitoring_FirePyThrowEvent`" -#: ../../whatsnew/3.13.rst:1980 +#: ../../whatsnew/3.13.rst:1984 msgid ":c:func:`PyMonitoring_FireRaiseEvent`" msgstr ":c:func:`PyMonitoring_FireRaiseEvent`" -#: ../../whatsnew/3.13.rst:1981 +#: ../../whatsnew/3.13.rst:1985 msgid ":c:func:`PyMonitoring_FireCRaiseEvent`" msgstr ":c:func:`PyMonitoring_FireCRaiseEvent`" -#: ../../whatsnew/3.13.rst:1982 +#: ../../whatsnew/3.13.rst:1986 msgid ":c:func:`PyMonitoring_FireReraiseEvent`" msgstr ":c:func:`PyMonitoring_FireReraiseEvent`" -#: ../../whatsnew/3.13.rst:1983 +#: ../../whatsnew/3.13.rst:1987 msgid ":c:func:`PyMonitoring_FireExceptionHandledEvent`" msgstr ":c:func:`PyMonitoring_FireExceptionHandledEvent`" -#: ../../whatsnew/3.13.rst:1984 +#: ../../whatsnew/3.13.rst:1988 msgid ":c:func:`PyMonitoring_FirePyUnwindEvent`" msgstr ":c:func:`PyMonitoring_FirePyUnwindEvent`" -#: ../../whatsnew/3.13.rst:1985 +#: ../../whatsnew/3.13.rst:1989 msgid ":c:func:`PyMonitoring_FireStopIterationEvent`" msgstr ":c:func:`PyMonitoring_FireStopIterationEvent`" -#: ../../whatsnew/3.13.rst:1986 +#: ../../whatsnew/3.13.rst:1990 msgid ":c:func:`PyMonitoring_EnterScope`" msgstr ":c:func:`PyMonitoring_EnterScope`" -#: ../../whatsnew/3.13.rst:1987 +#: ../../whatsnew/3.13.rst:1991 msgid ":c:func:`PyMonitoring_ExitScope`" msgstr ":c:func:`PyMonitoring_ExitScope`" -#: ../../whatsnew/3.13.rst:1989 +#: ../../whatsnew/3.13.rst:1993 msgid "(Contributed by Irit Katriel in :gh:`111997`)." msgstr "" -#: ../../whatsnew/3.13.rst:1991 +#: ../../whatsnew/3.13.rst:1995 msgid "" "Add :c:type:`PyMutex`, a lightweight mutex that occupies a single byte, and " "the new :c:func:`PyMutex_Lock` and :c:func:`PyMutex_Unlock` functions. :c:" @@ -3839,52 +3879,52 @@ msgid "" "operation needs to block. (Contributed by Sam Gross in :gh:`108724`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1997 +#: ../../whatsnew/3.13.rst:2001 msgid "" "Add the :ref:`PyTime C API ` to provide access to system clocks:" msgstr "" -#: ../../whatsnew/3.13.rst:1999 +#: ../../whatsnew/3.13.rst:2003 msgid ":c:type:`PyTime_t`." msgstr ":c:type:`PyTime_t`。" -#: ../../whatsnew/3.13.rst:2000 +#: ../../whatsnew/3.13.rst:2004 msgid ":c:var:`PyTime_MIN` and :c:var:`PyTime_MAX`." msgstr "" -#: ../../whatsnew/3.13.rst:2001 +#: ../../whatsnew/3.13.rst:2005 msgid ":c:func:`PyTime_AsSecondsDouble`." msgstr ":c:func:`PyTime_AsSecondsDouble`。" -#: ../../whatsnew/3.13.rst:2002 +#: ../../whatsnew/3.13.rst:2006 msgid ":c:func:`PyTime_Monotonic`." msgstr ":c:func:`PyTime_Monotonic`。" -#: ../../whatsnew/3.13.rst:2003 +#: ../../whatsnew/3.13.rst:2007 msgid ":c:func:`PyTime_MonotonicRaw`." msgstr ":c:func:`PyTime_MonotonicRaw`。" -#: ../../whatsnew/3.13.rst:2004 +#: ../../whatsnew/3.13.rst:2008 msgid ":c:func:`PyTime_PerfCounter`." msgstr ":c:func:`PyTime_PerfCounter`。" -#: ../../whatsnew/3.13.rst:2005 +#: ../../whatsnew/3.13.rst:2009 msgid ":c:func:`PyTime_PerfCounterRaw`." msgstr ":c:func:`PyTime_PerfCounterRaw`。" -#: ../../whatsnew/3.13.rst:2006 +#: ../../whatsnew/3.13.rst:2010 msgid ":c:func:`PyTime_Time`." msgstr ":c:func:`PyTime_Time`。" -#: ../../whatsnew/3.13.rst:2007 +#: ../../whatsnew/3.13.rst:2011 msgid ":c:func:`PyTime_TimeRaw`." msgstr ":c:func:`PyTime_TimeRaw`。" -#: ../../whatsnew/3.13.rst:2009 +#: ../../whatsnew/3.13.rst:2013 msgid "(Contributed by Victor Stinner and Petr Viktorin in :gh:`110850`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2011 +#: ../../whatsnew/3.13.rst:2015 msgid "" "Add the :c:func:`PyDict_ContainsString` function with the same behavior as :" "c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const char*` " @@ -3892,7 +3932,7 @@ msgid "" "by Victor Stinner in :gh:`108314`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2017 +#: ../../whatsnew/3.13.rst:2021 msgid "" "Add the :c:func:`PyDict_GetItemRef` and :c:func:`PyDict_GetItemStringRef` " "functions, which behave similarly to :c:func:`PyDict_GetItemWithError`, but " @@ -3902,7 +3942,7 @@ msgid "" "`106004`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2025 +#: ../../whatsnew/3.13.rst:2029 msgid "" "Add the :c:func:`PyDict_SetDefaultRef` function, which behaves similarly to :" "c:func:`PyDict_SetDefault`, but returns a :term:`strong reference` instead " @@ -3911,7 +3951,7 @@ msgid "" "dictionary. (Contributed by Sam Gross in :gh:`112066`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2033 +#: ../../whatsnew/3.13.rst:2037 msgid "" "Add the :c:func:`PyDict_Pop` and :c:func:`PyDict_PopString` functions to " "remove a key from a dictionary and optionally return the removed value. This " @@ -3920,7 +3960,7 @@ msgid "" "Victor Stinner in :gh:`111262`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2040 +#: ../../whatsnew/3.13.rst:2044 msgid "" "Add the :c:func:`PyMapping_GetOptionalItem` and :c:func:" "`PyMapping_GetOptionalItemString` functions as alternatives to :c:func:" @@ -3931,7 +3971,7 @@ msgid "" "gh:`106307`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2050 +#: ../../whatsnew/3.13.rst:2054 msgid "" "Add the :c:func:`PyObject_GetOptionalAttr` and :c:func:" "`PyObject_GetOptionalAttrString` functions as alternatives to :c:func:" @@ -3942,37 +3982,37 @@ msgid "" "Serhiy Storchaka in :gh:`106521`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2060 +#: ../../whatsnew/3.13.rst:2064 msgid "" "Add the :c:func:`PyErr_FormatUnraisable` function as an extension to :c:func:" "`PyErr_WriteUnraisable` that allows customizing the warning message. " "(Contributed by Serhiy Storchaka in :gh:`108082`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2065 +#: ../../whatsnew/3.13.rst:2069 msgid "" "Add new functions that return a :term:`strong reference` instead of a :term:" "`borrowed reference` for frame locals, globals, and builtins, as part of :" "ref:`PEP 667 `:" msgstr "" -#: ../../whatsnew/3.13.rst:2069 +#: ../../whatsnew/3.13.rst:2073 msgid ":c:func:`PyEval_GetFrameBuiltins` replaces :c:func:`PyEval_GetBuiltins`" -msgstr "" +msgstr ":c:func:`PyEval_GetFrameBuiltins` 取代 :c:func:`PyEval_GetBuiltins`" -#: ../../whatsnew/3.13.rst:2070 +#: ../../whatsnew/3.13.rst:2074 msgid ":c:func:`PyEval_GetFrameGlobals` replaces :c:func:`PyEval_GetGlobals`" -msgstr "" +msgstr ":c:func:`PyEval_GetFrameGlobals` 取代 :c:func:`PyEval_GetGlobals`" -#: ../../whatsnew/3.13.rst:2071 +#: ../../whatsnew/3.13.rst:2075 msgid ":c:func:`PyEval_GetFrameLocals` replaces :c:func:`PyEval_GetLocals`" -msgstr "" +msgstr ":c:func:`PyEval_GetFrameLocals` 取代 :c:func:`PyEval_GetLocals`" -#: ../../whatsnew/3.13.rst:2073 +#: ../../whatsnew/3.13.rst:2077 msgid "(Contributed by Mark Shannon and Tian Gao in :gh:`74929`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2075 +#: ../../whatsnew/3.13.rst:2079 msgid "" "Add the :c:func:`Py_GetConstant` and :c:func:`Py_GetConstantBorrowed` " "functions to get :term:`strong ` or :term:`borrowed " @@ -3981,7 +4021,7 @@ msgid "" "constant zero. (Contributed by Victor Stinner in :gh:`115754`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2082 +#: ../../whatsnew/3.13.rst:2086 msgid "" "Add the :c:func:`PyImport_AddModuleRef` function as a replacement for :c:" "func:`PyImport_AddModule` that returns a :term:`strong reference` instead of " @@ -3989,35 +4029,35 @@ msgid "" "`105922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2087 +#: ../../whatsnew/3.13.rst:2091 msgid "" "Add the :c:func:`Py_IsFinalizing` function to check whether the main Python " "interpreter is :term:`shutting down `. (Contributed by " "Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2092 +#: ../../whatsnew/3.13.rst:2096 msgid "" "Add the :c:func:`PyList_GetItemRef` function as a replacement for :c:func:" "`PyList_GetItem` that returns a :term:`strong reference` instead of a :term:" "`borrowed reference`. (Contributed by Sam Gross in :gh:`114329`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2097 +#: ../../whatsnew/3.13.rst:2101 msgid "" "Add the :c:func:`PyList_Extend` and :c:func:`PyList_Clear` functions, " "mirroring the Python :meth:`!list.extend` and :meth:`!list.clear` methods. " "(Contributed by Victor Stinner in :gh:`111138`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2101 +#: ../../whatsnew/3.13.rst:2105 msgid "" "Add the :c:func:`PyLong_AsInt` function. It behaves similarly to :c:func:" "`PyLong_AsLong`, but stores the result in a C :c:expr:`int` instead of a C :" "c:expr:`long`. (Contributed by Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2106 +#: ../../whatsnew/3.13.rst:2110 msgid "" "Add the :c:func:`PyLong_AsNativeBytes`, :c:func:`PyLong_FromNativeBytes`, " "and :c:func:`PyLong_FromUnsignedNativeBytes` functions to simplify " @@ -4025,27 +4065,27 @@ msgid "" "(Contributed by Steve Dower in :gh:`111140`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2112 +#: ../../whatsnew/3.13.rst:2116 msgid "" "Add :c:func:`PyModule_Add` function, which is similar to :c:func:" "`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but always steals " "a reference to the value. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2117 +#: ../../whatsnew/3.13.rst:2121 msgid "" "Add the :c:func:`PyObject_GenericHash` function that implements the default " "hashing function of a Python object. (Contributed by Serhiy Storchaka in :gh:" "`113024`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2121 +#: ../../whatsnew/3.13.rst:2125 msgid "" "Add the :c:func:`Py_HashPointer` function to hash a raw pointer. " "(Contributed by Victor Stinner in :gh:`111545`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2124 +#: ../../whatsnew/3.13.rst:2128 msgid "" "Add the :c:func:`PyObject_VisitManagedDict` and :c:func:" "`PyObject_ClearManagedDict` functions. which must be called by the traverse " @@ -4054,7 +4094,7 @@ msgid "" "with Python 3.11 and 3.12. (Contributed by Victor Stinner in :gh:`107073`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2132 +#: ../../whatsnew/3.13.rst:2136 msgid "" "Add the :c:func:`PyRefTracer_SetTracer` and :c:func:`PyRefTracer_GetTracer` " "functions, which enable tracking object creation and destruction in the same " @@ -4062,14 +4102,14 @@ msgid "" "in :gh:`93502`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2138 +#: ../../whatsnew/3.13.rst:2142 msgid "" "Add the :c:func:`PySys_AuditTuple` function as an alternative to :c:func:" "`PySys_Audit` that takes event arguments as a Python :class:`tuple` object. " "(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2143 +#: ../../whatsnew/3.13.rst:2147 msgid "" "Add the :c:func:`PyThreadState_GetUnchecked()` function as an alternative " "to :c:func:`PyThreadState_Get()` that doesn't kill the process with a fatal " @@ -4077,7 +4117,7 @@ msgid "" "result is ``NULL``. (Contributed by Victor Stinner in :gh:`108867`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2149 +#: ../../whatsnew/3.13.rst:2153 msgid "" "Add the :c:func:`PyType_GetFullyQualifiedName` function to get the type's " "fully qualified name. The module name is prepended if :attr:`type." @@ -4085,14 +4125,14 @@ msgid "" "``'__main__'``. (Contributed by Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2155 +#: ../../whatsnew/3.13.rst:2159 msgid "" "Add the :c:func:`PyType_GetModuleName` function to get the type's module " "name. This is equivalent to getting the :attr:`type.__module__` attribute. " "(Contributed by Eric Snow and Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2160 +#: ../../whatsnew/3.13.rst:2164 msgid "" "Add the :c:func:`PyUnicode_EqualToUTF8AndSize` and :c:func:" "`PyUnicode_EqualToUTF8` functions to compare a Unicode object with a :c:expr:" @@ -4101,7 +4141,7 @@ msgid "" "Storchaka in :gh:`110289`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2167 +#: ../../whatsnew/3.13.rst:2171 msgid "" "Add the :c:func:`PyWeakref_GetRef` function as an alternative to :c:func:" "`PyWeakref_GetObject` that returns a :term:`strong reference` or ``NULL`` if " @@ -4109,47 +4149,47 @@ msgid "" "`105927`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2173 +#: ../../whatsnew/3.13.rst:2177 msgid "Add fixed variants of functions which silently ignore errors:" msgstr "" -#: ../../whatsnew/3.13.rst:2175 +#: ../../whatsnew/3.13.rst:2179 msgid "" ":c:func:`PyObject_HasAttrWithError` replaces :c:func:`PyObject_HasAttr`." msgstr "" -#: ../../whatsnew/3.13.rst:2176 +#: ../../whatsnew/3.13.rst:2180 msgid "" ":c:func:`PyObject_HasAttrStringWithError` replaces :c:func:" "`PyObject_HasAttrString`." msgstr "" -#: ../../whatsnew/3.13.rst:2178 +#: ../../whatsnew/3.13.rst:2182 msgid "" ":c:func:`PyMapping_HasKeyWithError` replaces :c:func:`PyMapping_HasKey`." msgstr "" -#: ../../whatsnew/3.13.rst:2179 +#: ../../whatsnew/3.13.rst:2183 msgid "" ":c:func:`PyMapping_HasKeyStringWithError` replaces :c:func:" "`PyMapping_HasKeyString`." msgstr "" -#: ../../whatsnew/3.13.rst:2182 +#: ../../whatsnew/3.13.rst:2186 msgid "" "The new functions return ``-1`` for errors and the standard ``1`` for true " "and ``0`` for false." msgstr "" -#: ../../whatsnew/3.13.rst:2185 +#: ../../whatsnew/3.13.rst:2189 msgid "(Contributed by Serhiy Storchaka in :gh:`108511`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2189 +#: ../../whatsnew/3.13.rst:2193 msgid "Changed C APIs" msgstr "" -#: ../../whatsnew/3.13.rst:2191 +#: ../../whatsnew/3.13.rst:2195 msgid "" "The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and :c:" "func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * const *` " @@ -4162,20 +4202,20 @@ msgid "" "`65210`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2203 +#: ../../whatsnew/3.13.rst:2207 msgid "" ":c:func:`PyArg_ParseTupleAndKeywords` now supports non-ASCII keyword " "parameter names. (Contributed by Serhiy Storchaka in :gh:`110815`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2207 +#: ../../whatsnew/3.13.rst:2211 msgid "" "The :c:func:`!PyCode_GetFirstFree` function is now unstable API and is now " "named :c:func:`PyUnstable_Code_GetFirstFree`. (Contributed by Bogdan " "Romanyuk in :gh:`115781`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2211 +#: ../../whatsnew/3.13.rst:2215 msgid "" "The :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:" "`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:" @@ -4186,35 +4226,35 @@ msgid "" "documentation. (Contributed by Serhiy Storchaka in :gh:`106672`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2220 +#: ../../whatsnew/3.13.rst:2224 msgid "" "Add support for the ``%T``, ``%#T``, ``%N`` and ``%#N`` formats to :c:func:" "`PyUnicode_FromFormat`:" msgstr "" -#: ../../whatsnew/3.13.rst:2223 +#: ../../whatsnew/3.13.rst:2227 msgid "``%T``: Get the fully qualified name of an object type" msgstr "" -#: ../../whatsnew/3.13.rst:2224 +#: ../../whatsnew/3.13.rst:2228 msgid "``%#T``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2225 +#: ../../whatsnew/3.13.rst:2229 msgid "``%N``: Get the fully qualified name of a type" msgstr "" -#: ../../whatsnew/3.13.rst:2226 +#: ../../whatsnew/3.13.rst:2230 msgid "``%#N``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2228 +#: ../../whatsnew/3.13.rst:2232 msgid "" "See :pep:`737` for more information. (Contributed by Victor Stinner in :gh:" "`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2231 +#: ../../whatsnew/3.13.rst:2235 msgid "" "You no longer have to define the ``PY_SSIZE_T_CLEAN`` macro before " "including :file:`Python.h` when using ``#`` formats in :ref:`format codes " @@ -4223,7 +4263,7 @@ msgid "" "`104922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2237 +#: ../../whatsnew/3.13.rst:2241 msgid "" "If Python is built in :ref:`debug mode ` or :option:`with " "assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and :c:func:" @@ -4231,60 +4271,60 @@ msgid "" "(Contributed by Victor Stinner in :gh:`106168`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2245 +#: ../../whatsnew/3.13.rst:2249 msgid "Limited C API Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2247 +#: ../../whatsnew/3.13.rst:2251 msgid "The following functions are now included in the Limited C API:" msgstr "" -#: ../../whatsnew/3.13.rst:2249 +#: ../../whatsnew/3.13.rst:2253 msgid ":c:func:`PyMem_RawMalloc`" msgstr ":c:func:`PyMem_RawMalloc`" -#: ../../whatsnew/3.13.rst:2250 +#: ../../whatsnew/3.13.rst:2254 msgid ":c:func:`PyMem_RawCalloc`" msgstr ":c:func:`PyMem_RawCalloc`" -#: ../../whatsnew/3.13.rst:2251 +#: ../../whatsnew/3.13.rst:2255 msgid ":c:func:`PyMem_RawRealloc`" msgstr ":c:func:`PyMem_RawRealloc`" -#: ../../whatsnew/3.13.rst:2252 +#: ../../whatsnew/3.13.rst:2256 msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" -#: ../../whatsnew/3.13.rst:2253 +#: ../../whatsnew/3.13.rst:2257 msgid ":c:func:`PySys_Audit`" msgstr ":c:func:`PySys_Audit`" -#: ../../whatsnew/3.13.rst:2254 +#: ../../whatsnew/3.13.rst:2258 msgid ":c:func:`PySys_AuditTuple`" msgstr ":c:func:`PySys_AuditTuple`" -#: ../../whatsnew/3.13.rst:2255 +#: ../../whatsnew/3.13.rst:2259 msgid ":c:func:`PyType_GetModuleByDef`" msgstr ":c:func:`PyType_GetModuleByDef`" -#: ../../whatsnew/3.13.rst:2257 +#: ../../whatsnew/3.13.rst:2261 msgid "" "(Contributed by Victor Stinner in :gh:`85283`, :gh:`85283`, and :gh:" "`116936`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2259 +#: ../../whatsnew/3.13.rst:2263 msgid "" "Python built with :option:`--with-trace-refs` (tracing references) now " "supports the :ref:`Limited API `. (Contributed by Victor " "Stinner in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2265 +#: ../../whatsnew/3.13.rst:2269 msgid "Removed C APIs" msgstr "" -#: ../../whatsnew/3.13.rst:2267 +#: ../../whatsnew/3.13.rst:2271 msgid "" "Remove several functions, macros, variables, etc with names prefixed by " "``_Py`` or ``_PY`` (which are considered private). If your project is " @@ -4294,13 +4334,13 @@ msgid "" "Victor Stinner. (Contributed by Victor Stinner in :gh:`106320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2275 +#: ../../whatsnew/3.13.rst:2279 msgid "" "Remove old buffer protocols deprecated in Python 3.0. Use :ref:" "`bufferobjects` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2278 +#: ../../whatsnew/3.13.rst:2282 msgid "" ":c:func:`!PyObject_CheckReadBuffer`: Use :c:func:`PyObject_CheckBuffer` to " "test whether the object supports the buffer protocol. Note that :c:func:" @@ -4309,13 +4349,13 @@ msgid "" "example of :c:func:`PyObject_GetBuffer`." msgstr "" -#: ../../whatsnew/3.13.rst:2286 +#: ../../whatsnew/3.13.rst:2290 msgid "" ":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: Use :c:" "func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" msgstr "" -#: ../../whatsnew/3.13.rst:2289 +#: ../../whatsnew/3.13.rst:2293 msgid "" "Py_buffer view;\n" "if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) < 0) {\n" @@ -4326,13 +4366,13 @@ msgid "" "PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2299 +#: ../../whatsnew/3.13.rst:2303 msgid "" ":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` and :c:" "func:`PyBuffer_Release` instead:" msgstr "" -#: ../../whatsnew/3.13.rst:2302 +#: ../../whatsnew/3.13.rst:2306 msgid "" "Py_buffer view;\n" "if (PyObject_GetBuffer(obj, &view, PyBUF_WRITABLE) < 0) {\n" @@ -4342,21 +4382,21 @@ msgid "" "PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2311 +#: ../../whatsnew/3.13.rst:2315 msgid "(Contributed by Inada Naoki in :gh:`85275`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2313 +#: ../../whatsnew/3.13.rst:2317 msgid "Remove various functions deprecated in Python 3.9:" msgstr "" -#: ../../whatsnew/3.13.rst:2315 +#: ../../whatsnew/3.13.rst:2319 msgid "" ":c:func:`!PyEval_CallObject`, :c:func:`!PyEval_CallObjectWithKeywords`: Use :" "c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2320 +#: ../../whatsnew/3.13.rst:2324 msgid "" "In :c:func:`PyObject_Call`, positional arguments must be a :class:`tuple` " "and must not be ``NULL``, and keyword arguments must be a :class:`dict` or " @@ -4367,106 +4407,107 @@ msgid "" "`PyTuple_New(0) `." msgstr "" -#: ../../whatsnew/3.13.rst:2330 +#: ../../whatsnew/3.13.rst:2334 msgid "" ":c:func:`!PyEval_CallFunction`: Use :c:func:`PyObject_CallFunction` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2332 +#: ../../whatsnew/3.13.rst:2336 msgid "" ":c:func:`!PyEval_CallMethod`: Use :c:func:`PyObject_CallMethod` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2334 +#: ../../whatsnew/3.13.rst:2338 msgid ":c:func:`!PyCFunction_Call`: Use :c:func:`PyObject_Call` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2337 +#: ../../whatsnew/3.13.rst:2341 msgid "(Contributed by Victor Stinner in :gh:`105107`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2339 +#: ../../whatsnew/3.13.rst:2343 msgid "" "Remove the following old functions to configure the Python initialization, " "deprecated in Python 3.11:" msgstr "" -#: ../../whatsnew/3.13.rst:2342 +#: ../../whatsnew/3.13.rst:2346 msgid "" ":c:func:`!PySys_AddWarnOptionUnicode`: Use :c:member:`PyConfig.warnoptions` " "instead." msgstr "" -#: ../../whatsnew/3.13.rst:2344 +#: ../../whatsnew/3.13.rst:2348 msgid "" ":c:func:`!PySys_AddWarnOption`: Use :c:member:`PyConfig.warnoptions` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2346 +#: ../../whatsnew/3.13.rst:2350 msgid ":c:func:`!PySys_AddXOption`: Use :c:member:`PyConfig.xoptions` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2348 +#: ../../whatsnew/3.13.rst:2352 msgid "" ":c:func:`!PySys_HasWarnOptions`: Use :c:member:`PyConfig.xoptions` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2350 +#: ../../whatsnew/3.13.rst:2354 msgid "" ":c:func:`!PySys_SetPath`: Set :c:member:`PyConfig.module_search_paths` " "instead." msgstr "" -#: ../../whatsnew/3.13.rst:2352 +#: ../../whatsnew/3.13.rst:2356 msgid "" ":c:func:`!Py_SetPath`: Set :c:member:`PyConfig.module_search_paths` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2354 +#: ../../whatsnew/3.13.rst:2358 msgid "" ":c:func:`!Py_SetStandardStreamEncoding`: Set :c:member:`PyConfig." "stdio_encoding` instead, and set also maybe :c:member:`PyConfig." "legacy_windows_stdio` (on Windows)." msgstr "" -#: ../../whatsnew/3.13.rst:2357 +#: ../../whatsnew/3.13.rst:2361 msgid "" ":c:func:`!_Py_SetProgramFullPath`: Set :c:member:`PyConfig.executable` " "instead." msgstr "" -#: ../../whatsnew/3.13.rst:2360 +#: ../../whatsnew/3.13.rst:2364 msgid "" "Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " "Configuration ` instead (:pep:`587`), added to Python 3.8. " "(Contributed by Victor Stinner in :gh:`105145`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2364 +#: ../../whatsnew/3.13.rst:2368 msgid "" "Remove :c:func:`!PyEval_AcquireLock` and :c:func:`!PyEval_ReleaseLock` " "functions, deprecated in Python 3.2. They didn't update the current thread " "state. They can be replaced with:" msgstr "" -#: ../../whatsnew/3.13.rst:2369 +#: ../../whatsnew/3.13.rst:2373 msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`;" msgstr ":c:func:`PyEval_SaveThread` 和 :c:func:`PyEval_RestoreThread`;" -#: ../../whatsnew/3.13.rst:2370 +#: ../../whatsnew/3.13.rst:2374 msgid "" "low-level :c:func:`PyEval_AcquireThread` and :c:func:`PyEval_RestoreThread`;" msgstr "" +"低階的 :c:func:`PyEval_AcquireThread` 和 :c:func:`PyEval_RestoreThread`;" -#: ../../whatsnew/3.13.rst:2371 +#: ../../whatsnew/3.13.rst:2375 msgid "or :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`." -msgstr "" +msgstr "或 :c:func:`PyGILState_Ensure` 與 :c:func:`PyGILState_Release`。" -#: ../../whatsnew/3.13.rst:2373 +#: ../../whatsnew/3.13.rst:2377 msgid "(Contributed by Victor Stinner in :gh:`105182`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2375 +#: ../../whatsnew/3.13.rst:2379 msgid "" "Remove the :c:func:`!PyEval_ThreadsInitialized` function, deprecated in " "Python 3.9. Since Python 3.7, :c:func:`!Py_Initialize` always creates the " @@ -4475,7 +4516,7 @@ msgid "" "Stinner in :gh:`105182`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2382 +#: ../../whatsnew/3.13.rst:2386 msgid "" "Remove the :c:func:`!_PyInterpreterState_Get` alias to :c:func:" "`PyInterpreterState_Get()` which was kept for backward compatibility with " @@ -4484,26 +4525,26 @@ msgid "" "Stinner in :gh:`106320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2389 +#: ../../whatsnew/3.13.rst:2393 msgid "" "Remove the private :c:func:`!_PyObject_FastCall` function: use :c:func:`!" "PyObject_Vectorcall` which is available since Python 3.8 (:pep:`590`). " "(Contributed by Victor Stinner in :gh:`106023`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2394 +#: ../../whatsnew/3.13.rst:2398 msgid "" "Remove the ``cpython/pytime.h`` header file, which only contained private " "functions. (Contributed by Victor Stinner in :gh:`106316`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2398 +#: ../../whatsnew/3.13.rst:2402 msgid "" "Remove the undocumented ``PY_TIMEOUT_MAX`` constant from the limited C API. " "(Contributed by Victor Stinner in :gh:`110014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2401 +#: ../../whatsnew/3.13.rst:2405 msgid "" "Remove the old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " "``Py_TRASHCAN_SAFE_END``. Replace both with the new macros " @@ -4511,15 +4552,15 @@ msgid "" "in :gh:`105111`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2408 +#: ../../whatsnew/3.13.rst:2412 msgid "Deprecated C APIs" msgstr "器用的 C API" -#: ../../whatsnew/3.13.rst:2410 +#: ../../whatsnew/3.13.rst:2414 msgid "Deprecate old Python initialization functions:" msgstr "" -#: ../../whatsnew/3.13.rst:2412 +#: ../../whatsnew/3.13.rst:2416 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" @@ -4528,32 +4569,32 @@ msgstr "" ":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" "data:`!warnings.filters`。" -#: ../../whatsnew/3.13.rst:2414 +#: ../../whatsnew/3.13.rst:2418 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" -#: ../../whatsnew/3.13.rst:2416 +#: ../../whatsnew/3.13.rst:2420 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" -#: ../../whatsnew/3.13.rst:2418 +#: ../../whatsnew/3.13.rst:2422 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" -#: ../../whatsnew/3.13.rst:2420 +#: ../../whatsnew/3.13.rst:2424 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" -#: ../../whatsnew/3.13.rst:2422 +#: ../../whatsnew/3.13.rst:2426 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:23 msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" -#: ../../whatsnew/3.13.rst:2424 +#: ../../whatsnew/3.13.rst:2428 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" ":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" @@ -4562,32 +4603,32 @@ msgstr "" ":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" "`PYTHONHOME` 環境變數。" -#: ../../whatsnew/3.13.rst:2428 +#: ../../whatsnew/3.13.rst:2432 msgid "(Contributed by Victor Stinner in :gh:`105145`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2430 +#: ../../whatsnew/3.13.rst:2434 msgid "" ":term:`Soft deprecate ` the :c:func:`PyEval_GetBuiltins`, :" "c:func:`PyEval_GetGlobals`, and :c:func:`PyEval_GetLocals` functions, which " "return a :term:`borrowed reference`. (Soft deprecated as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2436 +#: ../../whatsnew/3.13.rst:2440 msgid "" "Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function, which is just " "an alias to :c:func:`PyImport_ImportModule` since Python 3.3. (Contributed " "by Victor Stinner in :gh:`105396`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2440 +#: ../../whatsnew/3.13.rst:2444 msgid "" ":term:`Soft deprecate ` the :c:func:`PyModule_AddObject` " "function. It should be replaced with :c:func:`PyModule_Add` or :c:func:" "`PyModule_AddObjectRef`. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2446 +#: ../../whatsnew/3.13.rst:2450 msgid "" "Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types and the :c:" "macro:`!Py_UNICODE_WIDE` define. Use the :c:type:`wchar_t` type directly " @@ -4596,7 +4637,7 @@ msgid "" "`105156`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2453 +#: ../../whatsnew/3.13.rst:2457 msgid "" "Deprecate the :c:func:`PyWeakref_GetObject` and :c:func:" "`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed reference`. " @@ -4957,55 +4998,56 @@ msgstr "" msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.13.rst:2473 +#: ../../whatsnew/3.13.rst:2477 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.13.rst:2475 +#: ../../whatsnew/3.13.rst:2479 msgid "" "``arm64-apple-ios`` and ``arm64-apple-ios-simulator`` are both now :pep:`11` " "tier 3 platforms. (:ref:`PEP 730 ` written and " "implementation contributed by Russell Keith-Magee in :gh:`114099`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2480 +#: ../../whatsnew/3.13.rst:2484 msgid "" "``aarch64-linux-android`` and ``x86_64-linux-android`` are both now :pep:" "`11` tier 3 platforms. (:ref:`PEP 738 ` " "written and implementation contributed by Malcolm Smith in :gh:`116622`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2485 +#: ../../whatsnew/3.13.rst:2489 msgid "" "``wasm32-wasi`` is now a :pep:`11` tier 2 platform. (Contributed by Brett " "Cannon in :gh:`115192`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2488 +#: ../../whatsnew/3.13.rst:2492 msgid "" "``wasm32-emscripten`` is no longer a :pep:`11` supported platform. " "(Contributed by Brett Cannon in :gh:`115192`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2491 +#: ../../whatsnew/3.13.rst:2495 msgid "" "Building CPython now requires a compiler with support for the C11 atomic " "library, GCC built-in atomic functions, or MSVC interlocked intrinsics." msgstr "" -#: ../../whatsnew/3.13.rst:2494 +#: ../../whatsnew/3.13.rst:2498 msgid "" -"Autoconf 2.71 and aclocal 1.16.4 are now required to regenerate the :file:" -"`configure` script. (Contributed by Christian Heimes in :gh:`89886`.)" +"Autoconf 2.71 and aclocal 1.16.5 are now required to regenerate the :file:" +"`configure` script. (Contributed by Christian Heimes in :gh:`89886` and by " +"Victor Stinner in :gh:`112090`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2498 +#: ../../whatsnew/3.13.rst:2502 msgid "" "SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension " "module. (Contributed by Erlend Aasland in :gh:`105875`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2502 +#: ../../whatsnew/3.13.rst:2506 msgid "" "CPython now bundles the `mimalloc library`_ by default. It is licensed under " "the MIT license; see :ref:`mimalloc license `. The bundled " @@ -5013,28 +5055,28 @@ msgid "" "Dino Viehland in :gh:`109914`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2510 +#: ../../whatsnew/3.13.rst:2514 msgid "" "The :file:`configure` option :option:`--with-system-libmpdec` now defaults " "to ``yes``. The bundled copy of ``libmpdecimal`` will be removed in Python " "3.15." msgstr "" -#: ../../whatsnew/3.13.rst:2514 +#: ../../whatsnew/3.13.rst:2518 msgid "" "Python built with :file:`configure` :option:`--with-trace-refs` (tracing " "references) is now ABI compatible with the Python release build and :ref:" "`debug build `. (Contributed by Victor Stinner in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2519 +#: ../../whatsnew/3.13.rst:2523 msgid "" "On POSIX systems, the pkg-config (``.pc``) filenames now include the ABI " "flags. For example, the free-threaded build generates ``python-3.13t.pc`` " "and the debug build generates ``python-3.13d.pc``." msgstr "" -#: ../../whatsnew/3.13.rst:2523 +#: ../../whatsnew/3.13.rst:2527 msgid "" "The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``, " "``termios``, ``winsound``, ``_ctypes_test``, ``_multiprocessing." @@ -5044,27 +5086,27 @@ msgid "" "`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2532 +#: ../../whatsnew/3.13.rst:2536 msgid "Porting to Python 3.13" msgstr "移植至 Python 3.13" -#: ../../whatsnew/3.13.rst:2534 +#: ../../whatsnew/3.13.rst:2538 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.13.rst:2538 +#: ../../whatsnew/3.13.rst:2542 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.13.rst:2542 +#: ../../whatsnew/3.13.rst:2546 msgid "" ":ref:`PEP 667 ` introduces several changes to " "the semantics of :func:`locals` and :attr:`f_locals `:" msgstr "" -#: ../../whatsnew/3.13.rst:2545 +#: ../../whatsnew/3.13.rst:2549 msgid "" "Calling :func:`locals` in an :term:`optimized scope` now produces an " "independent snapshot on each call, and hence no longer implicitly updates " @@ -5076,7 +5118,7 @@ msgid "" "scope. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2554 +#: ../../whatsnew/3.13.rst:2558 msgid "" "Calling :func:`locals` from a comprehension at module or class scope " "(including via ``exec`` or ``eval``) once more behaves as if the " @@ -5086,7 +5128,7 @@ msgid "" "implementing :pep:`709`. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2561 +#: ../../whatsnew/3.13.rst:2565 msgid "" "Accessing :attr:`FrameType.f_locals ` in an :term:`optimized " "scope` now returns a write-through proxy rather than a snapshot that gets " @@ -5095,7 +5137,7 @@ msgid "" "of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2567 +#: ../../whatsnew/3.13.rst:2571 msgid "" ":class:`functools.partial` now emits a :exc:`FutureWarning` when used as a " "method. The behavior will change in future Python versions. Wrap it in :func:" @@ -5103,14 +5145,14 @@ msgid "" "Serhiy Storchaka in :gh:`121027`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2573 +#: ../../whatsnew/3.13.rst:2577 msgid "" "An :exc:`OSError` is now raised by :func:`getpass.getuser` for any failure " "to retrieve a username, instead of :exc:`ImportError` on non-Unix platforms " "or :exc:`KeyError` on Unix platforms where the password database is empty." msgstr "" -#: ../../whatsnew/3.13.rst:2578 +#: ../../whatsnew/3.13.rst:2582 msgid "" "The value of the :attr:`!mode` attribute of :class:`gzip.GzipFile` is now a " "string (``'rb'`` or ``'wb'``) instead of an integer (``1`` or ``2``). The " @@ -5119,13 +5161,13 @@ msgid "" "(Contributed by Serhiy Storchaka in :gh:`115961`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2584 +#: ../../whatsnew/3.13.rst:2588 msgid "" ":class:`mailbox.Maildir` now ignores files with a leading dot (``.``). " "(Contributed by Zackery Spytz in :gh:`65559`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2587 +#: ../../whatsnew/3.13.rst:2591 msgid "" ":meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` now return both " "files and directories if a pattern that ends with \"``**``\" is given, " @@ -5133,25 +5175,25 @@ msgid "" "behavior and only match directories." msgstr "" -#: ../../whatsnew/3.13.rst:2592 +#: ../../whatsnew/3.13.rst:2596 msgid "" "The :mod:`threading` module now expects the :mod:`!_thread` module to have " "an :func:`!_is_main_interpreter` function. This function takes no arguments " "and returns ``True`` if the current interpreter is the main interpreter." msgstr "" -#: ../../whatsnew/3.13.rst:2597 +#: ../../whatsnew/3.13.rst:2601 msgid "" "Any library or application that provides a custom :mod:`!_thread` module " "must provide :func:`!_is_main_interpreter`, just like the module's other " "\"private\" attributes. (:gh:`112826`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2604 +#: ../../whatsnew/3.13.rst:2608 msgid "Changes in the C API" msgstr "C API 中的改動" -#: ../../whatsnew/3.13.rst:2606 +#: ../../whatsnew/3.13.rst:2610 msgid "" "``Python.h`` no longer includes the ```` standard header. It was " "included for the :c:func:`!finite` function which is now provided by the " @@ -5160,7 +5202,7 @@ msgid "" "`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2612 +#: ../../whatsnew/3.13.rst:2616 msgid "" "``Python.h`` no longer includes these standard header files: ````, " "```` and ````. If needed, they should now be " @@ -5171,7 +5213,7 @@ msgid "" "Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2620 +#: ../../whatsnew/3.13.rst:2624 msgid "" "On Windows, ``Python.h`` no longer includes the ```` standard " "header file. If needed, it should now be included explicitly. For example, " @@ -5181,7 +5223,7 @@ msgid "" "(Contributed by Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2627 +#: ../../whatsnew/3.13.rst:2631 msgid "" "If the :c:macro:`Py_LIMITED_API` macro is defined, :c:macro:`!" "Py_BUILD_CORE`, :c:macro:`!Py_BUILD_CORE_BUILTIN` and :c:macro:`!" @@ -5189,18 +5231,18 @@ msgid "" "(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2632 +#: ../../whatsnew/3.13.rst:2636 msgid "" "The old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " "``Py_TRASHCAN_SAFE_END`` were removed. They should be replaced by the new " "macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``." msgstr "" -#: ../../whatsnew/3.13.rst:2636 +#: ../../whatsnew/3.13.rst:2640 msgid "A ``tp_dealloc`` function that has the old macros, such as::" msgstr "" -#: ../../whatsnew/3.13.rst:2638 +#: ../../whatsnew/3.13.rst:2642 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -5220,11 +5262,11 @@ msgstr "" " Py_TRASHCAN_SAFE_END\n" "}" -#: ../../whatsnew/3.13.rst:2647 +#: ../../whatsnew/3.13.rst:2651 msgid "should migrate to the new macros as follows::" msgstr "" -#: ../../whatsnew/3.13.rst:2649 +#: ../../whatsnew/3.13.rst:2653 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -5244,7 +5286,7 @@ msgstr "" " Py_TRASHCAN_END\n" "}" -#: ../../whatsnew/3.13.rst:2658 +#: ../../whatsnew/3.13.rst:2662 msgid "" "Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " "deallocation function it is in. The new macros were added in Python 3.8 and " @@ -5252,13 +5294,13 @@ msgid "" "in :gh:`105111`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2665 +#: ../../whatsnew/3.13.rst:2669 msgid "" ":ref:`PEP 667 ` introduces several changes to " "frame-related functions:" msgstr "" -#: ../../whatsnew/3.13.rst:2668 +#: ../../whatsnew/3.13.rst:2672 msgid "" "The effects of mutating the dictionary returned from :c:func:" "`PyEval_GetLocals` in an :term:`optimized scope` have changed. New dict " @@ -5272,7 +5314,7 @@ msgid "" "being used, so refer to the deprecation notice on the function for details." msgstr "" -#: ../../whatsnew/3.13.rst:2681 +#: ../../whatsnew/3.13.rst:2685 msgid "" "Calling :c:func:`PyFrame_GetLocals` in an :term:`optimized scope` now " "returns a write-through proxy rather than a snapshot that gets updated at " @@ -5281,25 +5323,25 @@ msgid "" "`PyEval_GetFrameLocals` API." msgstr "" -#: ../../whatsnew/3.13.rst:2688 +#: ../../whatsnew/3.13.rst:2692 msgid "" ":c:func:`!PyFrame_FastToLocals` and :c:func:`!PyFrame_FastToLocalsWithError` " "no longer have any effect. Calling these functions has been redundant since " "Python 3.11, when :c:func:`PyFrame_GetLocals` was first introduced." msgstr "" -#: ../../whatsnew/3.13.rst:2693 +#: ../../whatsnew/3.13.rst:2697 msgid "" ":c:func:`!PyFrame_LocalsToFast` no longer has any effect. Calling this " "function is redundant now that :c:func:`PyFrame_GetLocals` returns a write-" "through proxy for :term:`optimized scopes `." msgstr "" -#: ../../whatsnew/3.13.rst:2698 +#: ../../whatsnew/3.13.rst:2702 msgid "Regression Test Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2700 +#: ../../whatsnew/3.13.rst:2704 msgid "" "Python built with :file:`configure` :option:`--with-pydebug` now supports a :" "option:`-X presite=package.module <-X>` command-line option. If used, it " diff --git a/whatsnew/3.2.po b/whatsnew/3.2.po index a451e0c31c..2ed7e65d36 100644 --- a/whatsnew/3.2.po +++ b/whatsnew/3.2.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-10 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -465,8 +465,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:315 msgid "" -"Imported modules now have a :attr:`__cached__` attribute which stores the " -"name of the actual file that was imported:" +"Imported modules now have a :attr:`~module.__cached__` attribute which " +"stores the name of the actual file that was imported:" msgstr "" #: ../../whatsnew/3.2.rst:322 diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index 8323096a63..511a0066bc 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-10 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -3271,13 +3271,13 @@ msgstr "" #: ../../whatsnew/3.4.rst:2274 msgid "" -"The module type now initializes the :attr:`__package__` and :attr:" -"`__loader__` attributes to ``None`` by default. To determine if these " -"attributes were set in a backwards-compatible fashion, use e.g. " +"The module type now initializes the :attr:`~module.__package__` and :attr:" +"`~module.__loader__` attributes to ``None`` by default. To determine if " +"these attributes were set in a backwards-compatible fashion, use e.g. " "``getattr(module, '__loader__', None) is not None``. (:issue:`17115`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2279 +#: ../../whatsnew/3.4.rst:2280 msgid "" ":meth:`!importlib.util.module_for_loader` now sets ``__loader__`` and " "``__package__`` unconditionally to properly support reloading. If this is " @@ -3285,7 +3285,7 @@ msgid "" "use :func:`importlib.util.module_to_load` for module management." msgstr "" -#: ../../whatsnew/3.4.rst:2284 +#: ../../whatsnew/3.4.rst:2285 msgid "" "Import now resets relevant attributes (e.g. ``__name__``, ``__loader__``, " "``__package__``, ``__file__``, ``__cached__``) unconditionally when " @@ -3293,7 +3293,7 @@ msgid "" "module is re-found when re-loaded (:issue:`19413`)." msgstr "" -#: ../../whatsnew/3.4.rst:2289 +#: ../../whatsnew/3.4.rst:2290 msgid "" "Frozen packages no longer set ``__path__`` to a list containing the package " "name, they now set it to an empty list. The previous behavior could cause " @@ -3303,7 +3303,7 @@ msgid "" "'__path__')`` (:issue:`18065`)." msgstr "" -#: ../../whatsnew/3.4.rst:2296 +#: ../../whatsnew/3.4.rst:2297 msgid "" "Frozen modules no longer define a ``__file__`` attribute. It's semantically " "incorrect for frozen modules to set the attribute as they are not loaded " @@ -3314,7 +3314,7 @@ msgid "" "use :func:`!imp.is_frozen`." msgstr "" -#: ../../whatsnew/3.4.rst:2304 +#: ../../whatsnew/3.4.rst:2305 msgid "" ":func:`py_compile.compile` now raises :exc:`FileExistsError` if the file " "path it would write to is a symlink or a non-regular file. This is to act as " @@ -3322,7 +3322,7 @@ msgid "" "regardless of what type of file path they were originally." msgstr "" -#: ../../whatsnew/3.4.rst:2309 +#: ../../whatsnew/3.4.rst:2310 msgid "" ":meth:`importlib.abc.SourceLoader.get_source` no longer raises :exc:" "`ImportError` when the source code being loaded triggers a :exc:" @@ -3334,7 +3334,7 @@ msgid "" "exceptions now." msgstr "" -#: ../../whatsnew/3.4.rst:2318 +#: ../../whatsnew/3.4.rst:2319 msgid "" ":func:`functools.update_wrapper` and :func:`functools.wraps` now correctly " "set the ``__wrapped__`` attribute to the function being wrapped, even if " @@ -3346,7 +3346,7 @@ msgid "" "function in the chain that has no ``__wrapped__`` attribute." msgstr "" -#: ../../whatsnew/3.4.rst:2328 +#: ../../whatsnew/3.4.rst:2329 msgid "" ":func:`inspect.getfullargspec` has been reimplemented on top of :func:" "`inspect.signature` and hence handles a much wider variety of callable " @@ -3356,7 +3356,7 @@ msgid "" "will fail on non-Python callables may need to be adjusted accordingly." msgstr "" -#: ../../whatsnew/3.4.rst:2336 +#: ../../whatsnew/3.4.rst:2337 msgid "" ":class:`importlib.machinery.PathFinder` now passes on the current working " "directory to objects in :data:`sys.path_hooks` for the empty string. This " @@ -3370,7 +3370,7 @@ msgid "" "`18416`)." msgstr "" -#: ../../whatsnew/3.4.rst:2347 +#: ../../whatsnew/3.4.rst:2348 msgid "" "The removal of the *strict* argument to :class:`~http.client.HTTPConnection` " "and :class:`~http.client.HTTPSConnection` changes the meaning of the " @@ -3379,7 +3379,7 @@ msgid "" "should already be specifying any additional arguments via keywords." msgstr "" -#: ../../whatsnew/3.4.rst:2353 +#: ../../whatsnew/3.4.rst:2354 msgid "" "Strings between ``from __future__ import ...`` statements now *always* raise " "a :exc:`SyntaxError`. Previously if there was no leading docstring, an " @@ -3388,7 +3388,7 @@ msgid "" "`17434`)." msgstr "" -#: ../../whatsnew/3.4.rst:2359 +#: ../../whatsnew/3.4.rst:2360 msgid "" ":meth:`ssl.SSLSocket.getpeercert` and :meth:`ssl.SSLSocket.do_handshake` now " "raise an :exc:`OSError` with ``ENOTCONN`` when the ``SSLSocket`` is not " @@ -3397,7 +3397,7 @@ msgid "" "raise a :exc:`ValueError` if the handshake has not yet been done." msgstr "" -#: ../../whatsnew/3.4.rst:2365 +#: ../../whatsnew/3.4.rst:2366 msgid "" ":func:`base64.b32decode` now raises a :exc:`binascii.Error` when the input " "string contains non-b32-alphabet characters, instead of a :exc:`TypeError`. " @@ -3406,7 +3406,7 @@ msgid "" "`18011`.) Note: this change was also inadvertently applied in Python 3.3.3." msgstr "" -#: ../../whatsnew/3.4.rst:2372 +#: ../../whatsnew/3.4.rst:2373 msgid "" "The :attr:`!file` attribute is now automatically closed when the creating :" "class:`!cgi.FieldStorage` instance is garbage collected. If you were pulling " @@ -3416,14 +3416,14 @@ msgid "" "the :class:`!cgi.FieldStorage` instance is garbage collected." msgstr "" -#: ../../whatsnew/3.4.rst:2379 +#: ../../whatsnew/3.4.rst:2380 msgid "" "Calling ``read`` or ``write`` on a closed SSL socket now raises an " "informative :exc:`ValueError` rather than the previous more mysterious :exc:" "`AttributeError` (:issue:`9177`)." msgstr "" -#: ../../whatsnew/3.4.rst:2383 +#: ../../whatsnew/3.4.rst:2384 msgid "" ":meth:`slice.indices` no longer produces an :exc:`OverflowError` for huge " "values. As a consequence of this fix, :meth:`slice.indices` now raises a :" @@ -3431,7 +3431,7 @@ msgid "" "values (:issue:`14794`)." msgstr "" -#: ../../whatsnew/3.4.rst:2388 +#: ../../whatsnew/3.4.rst:2389 msgid "" "The :class:`complex` constructor, unlike the :mod:`cmath` functions, was " "incorrectly accepting :class:`float` values if an object's ``__complex__`` " @@ -3439,21 +3439,21 @@ msgid "" "`16290`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2393 +#: ../../whatsnew/3.4.rst:2394 msgid "" "The :class:`int` constructor in 3.2 and 3.3 erroneously accepts :class:" "`float` values for the *base* parameter. It is unlikely anyone was doing " "this, but if so, it will now raise a :exc:`TypeError` (:issue:`16772`)." msgstr "" -#: ../../whatsnew/3.4.rst:2397 +#: ../../whatsnew/3.4.rst:2398 msgid "" "Defaults for keyword-only arguments are now evaluated *after* defaults for " "regular keyword arguments, instead of before. Hopefully no one wrote any " "code that depends on the previous buggy behavior (:issue:`16967`)." msgstr "" -#: ../../whatsnew/3.4.rst:2401 +#: ../../whatsnew/3.4.rst:2402 msgid "" "Stale thread states are now cleared after :func:`~os.fork`. This may cause " "some system resources to be released that previously were incorrectly kept " @@ -3461,21 +3461,21 @@ msgid "" "storage). (:issue:`17094`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2406 +#: ../../whatsnew/3.4.rst:2407 msgid "" "Parameter names in ``__annotations__`` dicts are now mangled properly, " "similarly to :attr:`~function.__kwdefaults__`. (Contributed by Yury " "Selivanov in :issue:`20625`.)" msgstr "" -#: ../../whatsnew/3.4.rst:2410 +#: ../../whatsnew/3.4.rst:2411 msgid "" ":attr:`hashlib.hash.name` now always returns the identifier in lower case. " "Previously some builtin hashes had uppercase names, but now that it is a " "formal public interface the naming has been made consistent (:issue:`18532`)." msgstr "" -#: ../../whatsnew/3.4.rst:2414 +#: ../../whatsnew/3.4.rst:2415 msgid "" "Because :mod:`unittest.TestSuite` now drops references to tests after they " "are run, test harnesses that reuse a :class:`~unittest.TestSuite` to re-run " @@ -3488,7 +3488,7 @@ msgid "" "__iter__`) (:issue:`11798`)." msgstr "" -#: ../../whatsnew/3.4.rst:2424 +#: ../../whatsnew/3.4.rst:2425 msgid "" ":mod:`unittest` now uses :mod:`argparse` for command line parsing. There " "are certain invalid command forms that used to work that are no longer " @@ -3497,7 +3497,7 @@ msgid "" "use." msgstr "" -#: ../../whatsnew/3.4.rst:2429 +#: ../../whatsnew/3.4.rst:2430 msgid "" "The :func:`re.split`, :func:`re.findall`, and :func:`re.sub` functions, and " "the :meth:`~re.match.group` and :meth:`~re.match.groups` methods of " @@ -3507,13 +3507,13 @@ msgid "" "say, a ``bytearray``, you will need to change your code." msgstr "" -#: ../../whatsnew/3.4.rst:2436 +#: ../../whatsnew/3.4.rst:2437 msgid "" ":mod:`!audioop` functions now raise an error immediately if passed string " "input, instead of failing randomly later on (:issue:`16685`)." msgstr "" -#: ../../whatsnew/3.4.rst:2439 +#: ../../whatsnew/3.4.rst:2440 msgid "" "The new *convert_charrefs* argument to :class:`~html.parser.HTMLParser` " "currently defaults to ``False`` for backward compatibility, but will " @@ -3522,14 +3522,14 @@ msgid "" "HTMLParser` calls in your code (:issue:`13633`)." msgstr "" -#: ../../whatsnew/3.4.rst:2445 +#: ../../whatsnew/3.4.rst:2446 msgid "" "Since the *digestmod* argument to the :func:`hmac.new` function will in the " "future have no default, all calls to :func:`hmac.new` should be changed to " "explicitly specify a *digestmod* (:issue:`17276`)." msgstr "" -#: ../../whatsnew/3.4.rst:2449 +#: ../../whatsnew/3.4.rst:2450 msgid "" "Calling :func:`sysconfig.get_config_var` with the ``SO`` key, or looking " "``SO`` up in the results of a call to :func:`sysconfig.get_config_vars` is " @@ -3537,7 +3537,7 @@ msgid "" "``SHLIB_SUFFIX``, depending on the context (:issue:`19555`)." msgstr "" -#: ../../whatsnew/3.4.rst:2454 +#: ../../whatsnew/3.4.rst:2455 msgid "" "Any calls to ``open`` functions that specify ``U`` should be modified. ``U`` " "is ineffective in Python3 and will eventually raise an error if used. " @@ -3547,13 +3547,13 @@ msgid "" "`15204`)." msgstr "" -#: ../../whatsnew/3.4.rst:2461 +#: ../../whatsnew/3.4.rst:2462 msgid "" "If you use ``pyvenv`` in a script and desire that pip *not* be installed, " "you must add ``--without-pip`` to your command invocation." msgstr "" -#: ../../whatsnew/3.4.rst:2465 +#: ../../whatsnew/3.4.rst:2466 msgid "" "The default behavior of :func:`json.dump` and :func:`json.dumps` when an " "indent is specified has changed: it no longer produces trailing spaces after " @@ -3562,7 +3562,7 @@ msgid "" "output (:issue:`16333`)." msgstr "" -#: ../../whatsnew/3.4.rst:2471 +#: ../../whatsnew/3.4.rst:2472 msgid "" ":mod:`doctest` now looks for doctests in extension module ``__doc__`` " "strings, so if your doctest test discovery includes extension modules that " @@ -3570,7 +3570,7 @@ msgid "" "never seen before when running your tests (:issue:`3158`)." msgstr "" -#: ../../whatsnew/3.4.rst:2476 +#: ../../whatsnew/3.4.rst:2477 msgid "" "The :mod:`collections.abc` module has been slightly refactored as part of " "the Python startup improvements. As a consequence of this, it is no longer " @@ -3580,11 +3580,11 @@ msgid "" "`20784`)." msgstr "" -#: ../../whatsnew/3.4.rst:2485 +#: ../../whatsnew/3.4.rst:2486 msgid "Changes in the C API" msgstr "C API 中的改動" -#: ../../whatsnew/3.4.rst:2487 +#: ../../whatsnew/3.4.rst:2488 msgid "" ":c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr`, and :c:func:" "`PyObject_Str`, along with some other internal C APIs, now include a " @@ -3598,14 +3598,14 @@ msgid "" "version of Python that is compiled with assertions enabled." msgstr "" -#: ../../whatsnew/3.4.rst:2499 +#: ../../whatsnew/3.4.rst:2500 msgid "" ":c:func:`PyErr_SetImportError` now sets :exc:`TypeError` when its **msg** " "argument is not set. Previously only ``NULL`` was returned with no exception " "set." msgstr "" -#: ../../whatsnew/3.4.rst:2503 +#: ../../whatsnew/3.4.rst:2504 msgid "" "The result of the :c:data:`PyOS_ReadlineFunctionPointer` callback must now " "be a string allocated by :c:func:`PyMem_RawMalloc` or :c:func:" @@ -3614,30 +3614,30 @@ msgid "" "`16742`)" msgstr "" -#: ../../whatsnew/3.4.rst:2509 +#: ../../whatsnew/3.4.rst:2510 msgid "" ":c:func:`PyThread_set_key_value` now always set the value. In Python 3.3, " "the function did nothing if the key already exists (if the current value is " "a non-``NULL`` pointer)." msgstr "" -#: ../../whatsnew/3.4.rst:2513 +#: ../../whatsnew/3.4.rst:2514 msgid "" "The ``f_tstate`` (thread state) field of the :c:type:`PyFrameObject` " "structure has been removed to fix a bug: see :issue:`14432` for the " "rationale." msgstr "" -#: ../../whatsnew/3.4.rst:2518 +#: ../../whatsnew/3.4.rst:2519 msgid "Changed in 3.4.3" msgstr "3.4.3 中的變更" -#: ../../whatsnew/3.4.rst:2523 +#: ../../whatsnew/3.4.rst:2524 msgid "" "PEP 476: Enabling certificate verification by default for stdlib http clients" msgstr "" -#: ../../whatsnew/3.4.rst:2525 +#: ../../whatsnew/3.4.rst:2526 msgid "" ":mod:`http.client` and modules which use it, such as :mod:`urllib.request` " "and :mod:`xmlrpc.client`, will now verify that the server presents a " @@ -3646,13 +3646,13 @@ msgid "" "improving security for many applications." msgstr "" -#: ../../whatsnew/3.4.rst:2531 +#: ../../whatsnew/3.4.rst:2532 msgid "" "For applications which require the old previous behavior, they can pass an " "alternate context::" msgstr "" -#: ../../whatsnew/3.4.rst:2534 +#: ../../whatsnew/3.4.rst:2535 msgid "" "import urllib.request\n" "import ssl\n" diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index 43c8937a1d..9de8d2caae 100644 --- a/whatsnew/3.5.po +++ b/whatsnew/3.5.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-10-10 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -669,7 +669,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:425 msgid "" "While these annotations are available at runtime through the usual :attr:" -"`__annotations__` attribute, *no automatic type checking happens at " +"`~object.__annotations__` attribute, *no automatic type checking happens at " "runtime*. Instead, it is assumed that a separate off-line type checker (e." "g. `mypy `_) will be used for on-demand source code " "analysis." diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index c9c6896a50..a02c86b5b8 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -595,7 +595,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:400 msgid ":pep:`565` -- Show DeprecationWarning in ``__main__``" -msgstr "" +msgstr ":pep:`565` -- 在 ``__main__`` 中顯示 DeprecationWarning" #: ../../whatsnew/3.7.rst:401 msgid "PEP written and implemented by Nick Coghlan" From 0d55be1c2948aca3ae21521adc7a0ad2eaac3a16 Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Mon, 21 Oct 2024 00:31:09 +0800 Subject: [PATCH 39/89] docs(library/pickle.po): resolve all of the suggestions before 10/19 --- library/pickle.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/pickle.po b/library/pickle.po index da84ddf558..4dddef77bd 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -411,7 +411,7 @@ msgid "" "Write the pickled representation of the object *obj* to the open :term:`file " "object` *file*. This is equivalent to ``Pickler(file, protocol).dump(obj)``." msgstr "" -"將被封裝成 pickle 形式的 *obj* 寫入到已開啟的\\ :term:`file object` *file*。" +"將被封裝成 pickle 形式的物件 *obj* 寫入到已開啟的\\ :term:`file object` *file*。" "這等效於\\ ``Pickler(file, protocol).dump(obj)``。" #: ../../library/pickle.rst:222 @@ -432,7 +432,7 @@ msgid "" "Return the pickled representation of the object *obj* as a :class:`bytes` " "object, instead of writing it to a file." msgstr "" -"將被封裝為 pickle 形式的 *obj* 以 :class:`bytes` 類別回傳,而非寫入進檔案。" +"將被封裝為 pickle 形式的物件 *obj* 以 :class:`bytes` 類別回傳,而非寫入進檔案。" #: ../../library/pickle.rst:233 msgid "" From bccef33857527f0ef60b626608e7e4d076f72404 Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Mon, 21 Oct 2024 01:45:36 +0800 Subject: [PATCH 40/89] Translate `library/email.charset.po` (#989) Co-authored-by: isabellechiu <39623214+isabellechiu@users.noreply.github.com> Co-authored-by: mindihx --- library/email.charset.po | 108 ++++++++++++++++++++++++++++++--------- 1 file changed, 83 insertions(+), 25 deletions(-) diff --git a/library/email.charset.po b/library/email.charset.po index ccca6d4771..34d6286033 100644 --- a/library/email.charset.po +++ b/library/email.charset.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -20,7 +19,7 @@ msgstr "" #: ../../library/email.charset.rst:2 msgid ":mod:`!email.charset`: Representing character sets" -msgstr ":mod:`!email.charset`:表示字元集合" +msgstr ":mod:`!email.charset`:字元集合的表示" #: ../../library/email.charset.rst:7 msgid "**Source code:** :source:`Lib/email/charset.py`" @@ -38,7 +37,7 @@ msgstr "" msgid "" "The remaining text in this section is the original documentation of the " "module." -msgstr "此章節的其餘文字是原始模組的說明文件" +msgstr "此章節的其餘內容是模組的原始說明文件" #: ../../library/email.charset.rst:16 msgid "" @@ -48,17 +47,17 @@ msgid "" "Instances of :class:`Charset` are used in several other modules within the :" "mod:`email` package." msgstr "" -"此模組提供一個 class(類別) :class:`Charset` 來表示電子郵件中的字元集合和字" -"元集合轉換,以及字元集合登錄檔 (registry) 和其他許多便捷的方法以運用此登錄" -"檔。在 :mod:`email` 套件中有許多其他模組使用 :class:`Charset` 的實例。" +"此模組提供一個類別 :class:`Charset` 來表示電子郵件訊息中的字元集合和字元集合轉" +"換,也包含字元集合登錄檔 (registry) 和其他許多運用此登錄檔的便捷方法。:class:" +"`Charset` 的實例被 :mod:`email` 套件中其他數個模組所使用。" #: ../../library/email.charset.rst:22 msgid "Import this class from the :mod:`email.charset` module." -msgstr "從 :mod:`email.charset` 模組中 import 此類別" +msgstr "從 :mod:`email.charset` 模組中引入此類別" #: ../../library/email.charset.rst:27 msgid "Map character sets to their email properties." -msgstr "" +msgstr "將字元集合對映到其電子郵件特性 (properties)。" #: ../../library/email.charset.rst:29 msgid "" @@ -68,6 +67,10 @@ msgid "" "codecs. Given a character set, it will do its best to provide information " "on how to use that character set in an email message in an RFC-compliant way." msgstr "" +"此類別提供有關於電子郵件對特定字元集合的規範資訊。考慮到適用之編解碼器 " +"(codec) 的可用性,它還提供了在字元集合之間進行轉換的便利例行操作 (routine)。" +"給定一個字元集合,它將盡量提供有關如何以符合 RFC (RFC-compliant) 的方式在電子" +"郵件訊息中使用該字元集合的資訊。" #: ../../library/email.charset.rst:35 msgid "" @@ -75,6 +78,9 @@ msgid "" "used in email headers or bodies. Certain character sets must be converted " "outright, and are not allowed in email." msgstr "" +"在電子郵件標頭 (header) 或內文 (body) 用特定字元集合時必須使用可列印字元編碼 " +"(quoted-printable) 或 base64 來編碼。特定字元集合不允許出現在電子郵件中、必須" +"被徹底轉換。" #: ../../library/email.charset.rst:39 msgid "" @@ -88,10 +94,17 @@ msgid "" "with base64, bodies will not be encoded, but output text will be converted " "from the ``euc-jp`` character set to the ``iso-2022-jp`` character set." msgstr "" +"可選的 *input_charset* 描述如下;*input_charset* 會被強制轉換 (coerced) 為小寫。經過" +"別名標準化 (alias normalize) 後,會進到字元集合登錄檔 (registry) 去查詢此字元" +"集合使用的標頭編碼、內文編碼以及輸出轉換編解碼器。舉例來說,如果 " +"*input_charset* 是 ``iso-8859-1``,標頭跟內文會以可列印字元編碼並且不需要輸出" +"轉換編解碼器。如果 *input_charset* 是 ``euc-jp``,標頭則會被編碼成 base64、內" +"文不會被編碼,但輸出文字則會從 ``euc-jp`` 字元集合被轉換成 ``iso-2022-jp`` 字" +"元集合。" #: ../../library/email.charset.rst:49 msgid ":class:`Charset` instances have the following data attributes:" -msgstr "" +msgstr ":class:`Charset` 實例有以下資料屬性:" #: ../../library/email.charset.rst:53 msgid "" @@ -99,6 +112,8 @@ msgid "" "*official* email names (e.g. ``latin_1`` is converted to ``iso-8859-1``). " "Defaults to 7-bit ``us-ascii``." msgstr "" +"指定的初始字元集合。通用別名會被轉換成它們的\\ *官方*\\ 電子郵件名稱(例如:" +"``latin_1`` 會被轉換成 ``iso-8859-1``)。預設為 7 位元 ``us-ascii``。" #: ../../library/email.charset.rst:60 msgid "" @@ -107,6 +122,10 @@ msgid "" "``charset.BASE64`` (for base64 encoding), or ``charset.SHORTEST`` for the " "shortest of QP or BASE64 encoding. Otherwise, it will be ``None``." msgstr "" +"如果字元集合在被用於電子郵件標頭前必須被編碼的話,這個屬性會被設為 ``charset." +"QP``\\ (表示可列印字元編碼)、``charset.BASE64``\\ (表示 base64 編碼格式)或" +"是 ``charset.SHORTEST`` 表示最短的 QP 或是 base64 編碼格式。不然這個屬性會是 " +"``None``。" #: ../../library/email.charset.rst:69 msgid "" @@ -114,6 +133,8 @@ msgid "" "body, which indeed may be different than the header encoding. ``charset." "SHORTEST`` is not allowed for *body_encoding*." msgstr "" +"與 *header_encoding* 相同,但表示郵件訊息內文的編碼,與上述的標頭編碼有可能不" +"同。``charset.SHORTEST`` 是不允許於 *body_encoding* 使用的。" #: ../../library/email.charset.rst:76 msgid "" @@ -122,6 +143,9 @@ msgid "" "will contain the name of the character set output will be converted to. " "Otherwise, it will be ``None``." msgstr "" +"部分的字元集合在用於電子郵件的標頭或內文前必須先被轉換。如果 *input_charset* " +"是這些字元集合的其中之一,這個屬性將會包含輸出時轉換成的字元集合名稱。不然這" +"個屬性則為 ``None``。" #: ../../library/email.charset.rst:84 msgid "" @@ -129,6 +153,8 @@ msgid "" "Unicode. If no conversion codec is necessary, this attribute will be " "``None``." msgstr "" +"用於將 *input_charset* 轉換成 Unicode 的 Python 編解碼器的名稱。如果不需要轉" +"換編解碼器,這個屬性為 ``None``。" #: ../../library/email.charset.rst:91 msgid "" @@ -136,14 +162,16 @@ msgid "" "*output_charset*. If no conversion codec is necessary, this attribute will " "have the same value as the *input_codec*." msgstr "" +"用於將 Unicode 轉換成 *output_charset* 的 Python 編解碼器名稱。如果不需要轉換" +"編解碼器,這個屬性將會與 *input_codec* 有相同的值。" #: ../../library/email.charset.rst:96 msgid ":class:`Charset` instances also have the following methods:" -msgstr "" +msgstr ":class:`Charset` 實例還有以下方法:" #: ../../library/email.charset.rst:100 msgid "Return the content transfer encoding used for body encoding." -msgstr "" +msgstr "回傳用於內文編碼的內容傳輸編碼 (content transfer encoding)。" #: ../../library/email.charset.rst:102 msgid "" @@ -153,6 +181,10 @@ msgid "" "function should then set the :mailheader:`Content-Transfer-Encoding` header " "itself to whatever is appropriate." msgstr "" +"這可以是字串 ``quoted-printable`` 或 ``base64``,具體取決於所使用的編碼,或者" +"它也可以是一個函式,在這種情況下,你應該使用單個引數呼叫該函式,即正被編碼的 " +"Message 物件。然後函式應將 :mailheader:`Content-Transfer-Encoding` 標頭本身設" +"定為任何適當的值。" #: ../../library/email.charset.rst:108 msgid "" @@ -160,30 +192,33 @@ msgid "" "returns the string ``base64`` if *body_encoding* is ``BASE64``, and returns " "the string ``7bit`` otherwise." msgstr "" +"如果 *body_encoding* 為 ``QP`` 則回傳字串 ``quoted-printable``,如果 " +"*body_encoding* 為 ``BASE64`` 則回傳字串 ``base64``,否則回傳字串 ``7bit`` 。" #: ../../library/email.charset.rst:115 msgid "Return the output character set." -msgstr "" +msgstr "回傳輸出字元集合。" #: ../../library/email.charset.rst:117 msgid "" "This is the *output_charset* attribute if that is not ``None``, otherwise it " "is *input_charset*." msgstr "" +"如果不為 ``None`` 則這會是 *output_charset* 屬性,否則它是 *input_charset*。" #: ../../library/email.charset.rst:123 msgid "Header-encode the string *string*." -msgstr "" +msgstr "對字串 *string* 進行標頭編碼 (header-encode)。" #: ../../library/email.charset.rst:125 msgid "" "The type of encoding (base64 or quoted-printable) will be based on the " "*header_encoding* attribute." -msgstr "" +msgstr "編碼類型(base64 或可列印字元編碼)將基於 *header_encoding* 屬性。" #: ../../library/email.charset.rst:131 msgid "Header-encode a *string* by converting it first to bytes." -msgstr "" +msgstr "透過先將 *string* 轉換為位元組來對它進行標頭編碼。" #: ../../library/email.charset.rst:133 msgid "" @@ -192,56 +227,64 @@ msgid "" "iterator: each element returned from this iterator will provide the next " "maximum line length." msgstr "" +"這與 :meth:`header_encode` 類似,只不過字串不會超過由引數 *maxlengths* 給定的" +"最大列長度 (maximum line length),該引數必須是個疊代器:從此疊代器回傳的每個" +"元素將提供下一個最大列長度。" #: ../../library/email.charset.rst:141 msgid "Body-encode the string *string*." -msgstr "" +msgstr "對字串 *string* 進行內文編碼 (body-encode)。" #: ../../library/email.charset.rst:143 msgid "" "The type of encoding (base64 or quoted-printable) will be based on the " "*body_encoding* attribute." -msgstr "" +msgstr "編碼類型(base64 或可列印字元編碼)將基於 *body_encoding* 屬性。" #: ../../library/email.charset.rst:146 msgid "" "The :class:`Charset` class also provides a number of methods to support " "standard operations and built-in functions." -msgstr "" +msgstr ":class:`Charset` 類別也提供了許多支援標準操作和內建函式的方法。" #: ../../library/email.charset.rst:152 msgid "" "Returns *input_charset* as a string coerced to lower case. :meth:`!__repr__` " "is an alias for :meth:`!__str__`." msgstr "" +"回傳強制轉換 *input_charset* 為小寫後的字串。:meth:`!__repr__` 是 :meth:`!" +"__str__` 的別名。" #: ../../library/email.charset.rst:158 msgid "" "This method allows you to compare two :class:`Charset` instances for " "equality." -msgstr "" +msgstr "此方法讓你比較兩個 :class:`Charset` 實例的相等性。" #: ../../library/email.charset.rst:164 msgid "" "This method allows you to compare two :class:`Charset` instances for " "inequality." -msgstr "" +msgstr "此方法讓你比較兩個 :class:`Charset` 實例的不相等性。" #: ../../library/email.charset.rst:167 msgid "" "The :mod:`email.charset` module also provides the following functions for " "adding new entries to the global character set, alias, and codec registries:" msgstr "" +":mod:`email.charset` 模組還提供以下函式,用於將項目新增至全域字元集合、別名和" +"編解碼器登錄檔中:" #: ../../library/email.charset.rst:173 msgid "Add character properties to the global registry." -msgstr "" +msgstr "將字元特性 (properties) 新增至全域登錄檔。" #: ../../library/email.charset.rst:175 msgid "" "*charset* is the input character set, and must be the canonical name of a " "character set." msgstr "" +"*charset* 是輸入的字元集合,且必須是字元集合的規範名稱 (canonical name)。" #: ../../library/email.charset.rst:178 msgid "" @@ -251,6 +294,10 @@ msgid "" "encoding. ``SHORTEST`` is only valid for *header_enc*. The default is " "``None`` for no encoding." msgstr "" +"可選的 *header_enc* 和 *body_enc* 為 ``charset.QP``\\ (表示可列印字元編" +"碼)、``charset.BASE64``\\ (表示 base64 編碼)、``charset.SHORTEST``\\ (表" +"示最短的 base64 或可列印字元編碼)或 ``None``\\ (表示無編碼)。``SHORTEST`` " +"僅在用於 *header_enc* 時有效。預設為 ``None``,表示無編碼。" #: ../../library/email.charset.rst:184 msgid "" @@ -259,6 +306,9 @@ msgid "" "charset when the method :meth:`Charset.convert` is called. The default is " "to output in the same character set as the input." msgstr "" +"可選的 *output_charset* 是輸出應採用的字元集合。當呼叫 :meth:`Charset." +"convert` 方法時,將從輸入字元集合轉換為 Unicode,再轉換為輸出字元集合。預設是" +"以與輸入相同的字元集合輸出。" #: ../../library/email.charset.rst:189 msgid "" @@ -267,30 +317,36 @@ msgid "" "codecs the module does not know about. See the :mod:`codecs` module's " "documentation for more information." msgstr "" +"*input_charset* 和 *output_charset* 都必須在模組的字元集合到編解碼器對映 " +"(character set-to-codec mapping) 中具有 Unicode 編解碼器項目;使用 :func:" +"`add_codec` 來新增模組未知的編解碼器。有關更多資訊請參閱 :mod:`codecs` 模組的" +"文件。" #: ../../library/email.charset.rst:194 msgid "" "The global character set registry is kept in the module global dictionary " "``CHARSETS``." -msgstr "" +msgstr "全域字元集合登錄檔保存在模組全域字典 ``CHARSETS`` 中。" #: ../../library/email.charset.rst:200 msgid "" "Add a character set alias. *alias* is the alias name, e.g. ``latin-1``. " "*canonical* is the character set's canonical name, e.g. ``iso-8859-1``." msgstr "" +"新增字元集合別名。*alias* 是別名,例如 ``latin-1``。*canonical* 是字元集合的" +"規範名稱,例如 ``iso-8859-1``。" #: ../../library/email.charset.rst:203 msgid "" "The global charset alias registry is kept in the module global dictionary " "``ALIASES``." -msgstr "" +msgstr "全域字元集合別名登錄檔保存在模組全域字典 ``ALIASES`` 中。" #: ../../library/email.charset.rst:209 msgid "" "Add a codec that map characters in the given character set to and from " "Unicode." -msgstr "" +msgstr "新增一個編解碼器,將給定字元集合中的字元與 Unicode 進行對映。" #: ../../library/email.charset.rst:211 msgid "" @@ -298,3 +354,5 @@ msgid "" "of a Python codec, as appropriate for the second argument to the :class:" "`str`'s :meth:`~str.encode` method." msgstr "" +"*charset* 是字元集合的規範名稱。*codecname* 是 Python 編解碼器的名稱,適用" +"於 :class:`str` 的 :meth:`~str.encode` 方法的第二個引數。" From 950d450d404efea84c1118395acf27bb913941c8 Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Sat, 26 Oct 2024 21:29:15 +0800 Subject: [PATCH 41/89] Translate the first half of `library/pdb.po` (#154) * translate the first half of `library/pdb.po` * Apply suggestions from code review Co-authored-by: mindihx --------- Co-authored-by: mindihx --- library/pdb.po | 203 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 172 insertions(+), 31 deletions(-) diff --git a/library/pdb.po b/library/pdb.po index bd47a844d5..1f31a9ad78 100644 --- a/library/pdb.po +++ b/library/pdb.po @@ -2,13 +2,14 @@ # This file is distributed under the same license as the Python package. # # Translators: +# Matt Wang , 2024 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" -"PO-Revision-Date: 2018-05-23 16:07+0000\n" -"Last-Translator: Adrian Liaw \n" +"POT-Creation-Date: 2024-10-19 01:58+0800\n" +"PO-Revision-Date: 2024-10-19 17:39+0800\n" +"Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -19,7 +20,7 @@ msgstr "" #: ../../library/pdb.rst:4 msgid ":mod:`pdb` --- The Python Debugger" -msgstr "" +msgstr ":mod:`pdb` --- Python 偵錯器" #: ../../library/pdb.rst:9 msgid "**Source code:** :source:`Lib/pdb.py`" @@ -34,6 +35,11 @@ msgid "" "It also supports post-mortem debugging and can be called under program " "control." msgstr "" +":mod:`pdb` 模組定義了一個 Python 程式的互動式原始碼偵錯器。它支援在原始碼列層" +"級 (source line level) 設定(條件式的)斷點 (breakpoint) 和單步執行、檢視 " +"stack frame(堆疊框)、列出原始碼、以及在任何 stack frame 情境 (context) 中為" +"任意 Python 程式碼求值 (evaluation)。它還支援事後偵錯 (post-mortem " +"debugging),並可以在程式控制下呼叫。" #: ../../library/pdb.rst:26 msgid "" @@ -41,6 +47,9 @@ msgid "" "`Pdb`. This is currently undocumented but easily understood by reading the " "source. The extension interface uses the modules :mod:`bdb` and :mod:`cmd`." msgstr "" +"偵錯器是可擴充的 —— 偵錯器實際被定義為 :class:`Pdb` 類別。該類別目前沒有文" +"件,但可以很容易地透過閱讀原始碼來理解它。擴充套件介面使用了 :mod:`bdb` 和 :" +"mod:`cmd` 模組。" #: ../../library/pdb.rst:32 msgid "Module :mod:`faulthandler`" @@ -51,6 +60,8 @@ msgid "" "Used to dump Python tracebacks explicitly, on a fault, after a timeout, or " "on a user signal." msgstr "" +"用於在出現故障時、超時 (timeout) 後或於接收到使用者訊號時,顯式地轉儲 (dump) " +"Python 回溯 (traceback)。" #: ../../library/pdb.rst:36 msgid "Module :mod:`traceback`" @@ -60,11 +71,11 @@ msgstr ":mod:`traceback` 模組" msgid "" "Standard interface to extract, format and print stack traces of Python " "programs." -msgstr "" +msgstr "用於提取、格式化和印出 Python 程式 stack trace(堆疊追蹤)的標準介面。" #: ../../library/pdb.rst:39 msgid "The typical usage to break into the debugger is to insert::" -msgstr "" +msgstr "自一個執行中程式切入偵錯器的典型用法為插入: ::" #: ../../library/pdb.rst:41 msgid "import pdb; pdb.set_trace()" @@ -84,12 +95,16 @@ msgid "" "program. You can then step through the code following this statement, and " "continue running without the debugger using the :pdbcmd:`continue` command." msgstr "" +"到你想切入偵錯器的位置,然後執行程式,就可以單步執行上述陳述式之後的程式碼," +"並可以使用 :pdbcmd:`continue` 命令來離開偵錯器、繼續執行。" #: ../../library/pdb.rst:51 msgid "" "The built-in :func:`breakpoint`, when called with defaults, can be used " "instead of ``import pdb; pdb.set_trace()``." msgstr "" +"當使用預設值呼叫時,可以使用內建的 :func:`breakpoint` 來取代 ``import pdb; " +"pdb.set_trace()``。" #: ../../library/pdb.rst:57 msgid "" @@ -99,12 +114,17 @@ msgid "" "val = 3\n" "print(f\"{val} * 2 is {double(val)}\")" msgstr "" +"def double(x):\n" +" breakpoint()\n" +" return x * 2\n" +"val = 3\n" +"print(f\"{val} * 2 is {double(val)}\")" #: ../../library/pdb.rst:63 msgid "" "The debugger's prompt is ``(Pdb)``, which is the indicator that you are in " "debug mode::" -msgstr "" +msgstr "偵錯器的提示字元是 ``(Pdb)``,這表示你處於偵錯模式: ::" #: ../../library/pdb.rst:65 msgid "" @@ -115,6 +135,12 @@ msgid "" "(Pdb) continue\n" "3 * 2 is 6" msgstr "" +"> ...(2)double()\n" +"-> breakpoint()\n" +"(Pdb) p x\n" +"3\n" +"(Pdb) continue\n" +"3 * 2 is 6" #: ../../library/pdb.rst:72 msgid "" @@ -122,16 +148,18 @@ msgid "" "command arguments, e.g. the current global and local names are offered as " "arguments of the ``p`` command." msgstr "" +"透過 :mod:`readline` 模組達成的 tab 補全可用於補全本模組的命令和命令的引數," +"例如會提供當前的全域和區域名稱以作為 ``p`` 命令的引數。" #: ../../library/pdb.rst:78 msgid "" "You can also invoke :mod:`pdb` from the command line to debug other " "scripts. For example::" -msgstr "" +msgstr "你還可以從命令列調用 :mod:`pdb` 來偵錯其他腳本。例如: ::" #: ../../library/pdb.rst:81 msgid "python -m pdb myscript.py" -msgstr "" +msgstr "python -m pdb myscript.py" #: ../../library/pdb.rst:83 msgid "" @@ -141,12 +169,17 @@ msgid "" "Automatic restarting preserves pdb's state (such as breakpoints) and in most " "cases is more useful than quitting the debugger upon program's exit." msgstr "" +"當作為模組調用時,如果被偵錯的程序不正常地退出,pdb 將自動進入事後偵錯。事後" +"偵錯後(或程式正常退出後),pdb 將重新啟動程式。自動重新啟動會保留 pdb 的狀態" +"(例如斷點),並且在大多數情況下比在程式退出時退出偵錯器更有用。" #: ../../library/pdb.rst:89 msgid "" "Added the ``-c`` option to execute commands as if given in a :file:`.pdbrc` " "file; see :ref:`debugger-commands`." msgstr "" +"新增了 ``-c`` 選項來執行命令,就像能在 :file:`.pdbrc` 檔案中給定的那樣;請參" +"閱\\ :ref:`偵錯器命令 `。" #: ../../library/pdb.rst:93 msgid "" @@ -154,10 +187,12 @@ msgid "" "does. As with a script, the debugger will pause execution just before the " "first line of the module." msgstr "" +"新增了 ``-m`` 選項以類似於 ``python -m`` 的方式來執行模組。與腳本一樣,偵錯器" +"將在模組的第一列之前暫停執行。" #: ../../library/pdb.rst:98 msgid "Typical usage to execute a statement under control of the debugger is::" -msgstr "" +msgstr "在偵錯器控制下執行陳述式的典型用法是: ::" #: ../../library/pdb.rst:100 msgid "" @@ -170,10 +205,18 @@ msgid "" "0.5\n" ">>>" msgstr "" +">>> import pdb\n" +">>> def f(x):\n" +"... print(1 / x)\n" +">>> pdb.run(\"f(2)\")\n" +"> (1)()\n" +"(Pdb) continue\n" +"0.5\n" +">>>" #: ../../library/pdb.rst:109 msgid "The typical usage to inspect a crashed program is::" -msgstr "" +msgstr "檢查一個損壞程式的典型用法: ::" #: ../../library/pdb.rst:111 msgid "" @@ -192,6 +235,20 @@ msgid "" "0\n" "(Pdb)" msgstr "" +">>> import pdb\n" +">>> def f(x):\n" +"... print(1 / x)\n" +"...\n" +">>> f(0)\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +" File \"\", line 2, in f\n" +"ZeroDivisionError: division by zero\n" +">>> pdb.pm()\n" +"> (2)f()\n" +"(Pdb) p x\n" +"0\n" +"(Pdb)" #: ../../library/pdb.rst:126 msgid "" @@ -199,12 +256,15 @@ msgid "" "``pdb`` will immediately affect the active scope, even when running inside " "an :term:`optimized scope`." msgstr "" +":pep:`667` 的實作意味著透過 ``pdb`` 進行的名稱賦予 (name assignments) 會立即" +"影響有效作用域,即使在\\ :term:`最佳化作用域 `\\ 內運作也是" +"如此。" #: ../../library/pdb.rst:132 msgid "" "The module defines the following functions; each enters the debugger in a " "slightly different way:" -msgstr "" +msgstr "本模組定義了下列函式,每個函式進入偵錯器的方式略有不同:" #: ../../library/pdb.rst:137 msgid "" @@ -217,6 +277,12 @@ msgid "" "module :mod:`__main__` is used. (See the explanation of the built-in :func:" "`exec` or :func:`eval` functions.)" msgstr "" +"在偵錯器控制下執行 *statement*\\ (以字串或程式碼物件形式給定)。偵錯提示字元" +"會在執行任何程式碼前出現;你可以設定斷點並輸入 :pdbcmd:`continue`,或也可以使" +"用 :pdbcmd:`step` 或 :pdbcmd:`next` 逐步執行陳述式(這些命令在下面都有說" +"明)。可選引數 *globals* 和 *locals* 指定程式碼執行的環境;預設使用 :mod:" +"`__main__` 模組的字典。(請參閱內建函式 :func:`exec` 或 :func:`eval` 的說" +"明。)" #: ../../library/pdb.rst:149 msgid "" @@ -224,6 +290,9 @@ msgid "" "debugger control. When :func:`runeval` returns, it returns the value of the " "*expression*. Otherwise this function is similar to :func:`run`." msgstr "" +"在偵錯器控制下為 *expression* 求值(以字串或程式碼物件形式給定)。當 :func:" +"`runeval` 回傳時,它回傳 *expression* 的值。除此之外,該函式與 :func:`run` 類" +"似。" #: ../../library/pdb.rst:156 msgid "" @@ -232,6 +301,9 @@ msgid "" "function call returned. The debugger prompt appears as soon as the function " "is entered." msgstr "" +"使用給定的引數呼叫 *function*\\ (只可以是函式或方法物件,不能是字串)。:" +"func:`runcall` 回傳的是所呼叫函式的回傳值。偵錯器提示字元將在進入函式後立即出" +"現。" #: ../../library/pdb.rst:164 msgid "" @@ -240,16 +312,19 @@ msgid "" "otherwise being debugged (e.g. when an assertion fails). If given, *header* " "is printed to the console just before debugging begins." msgstr "" +"在呼叫此函式的 stack frame 進入偵錯器。用於在程式中給定之處寫死 (hard-code) " +"一個斷點,即便該程式碼不在偵錯狀態(如斷言失敗時)。如有給定 *header*,它將在" +"偵錯正要開始前被印出到控制台。" #: ../../library/pdb.rst:169 msgid "The keyword-only argument *header*." -msgstr "" +msgstr "僅限關鍵字引數 *header*。" #: ../../library/pdb.rst:172 msgid "" ":func:`set_trace` will enter the debugger immediately, rather than on the " "next line of code to be executed." -msgstr "" +msgstr ":func:`set_trace` 將立即進入偵錯器,而不是在下一列要執行的程式碼中。" #: ../../library/pdb.rst:178 msgid "" @@ -258,11 +333,13 @@ msgid "" "being handled (an exception must be being handled if the default is to be " "used)." msgstr "" +"進入所給定 *traceback* 物件的事後偵錯。如果沒有給定 *traceback*,預設使用當前" +"正在處理的例外之一(使用預設情況時,必須要有正在處理的例外存在)。" #: ../../library/pdb.rst:186 msgid "" "Enter post-mortem debugging of the exception found in :data:`sys.last_exc`." -msgstr "" +msgstr "進入在 :data:`sys.last_exc` 中發現的例外的事後偵錯。" #: ../../library/pdb.rst:190 msgid "" @@ -270,16 +347,20 @@ msgid "" "the :class:`Pdb` class and calling the method of the same name. If you want " "to access further features, you have to do this yourself:" msgstr "" +"``run*`` 函式和 :func:`set_trace` 都是別名,用於實例化 (instantiate) :class:" +"`Pdb` 類別並呼叫同名方法。如果要使用更多功能,則必須自己執行以下操作:" #: ../../library/pdb.rst:197 msgid ":class:`Pdb` is the debugger class." -msgstr "" +msgstr ":class:`Pdb` 是偵錯器類別。" #: ../../library/pdb.rst:199 msgid "" "The *completekey*, *stdin* and *stdout* arguments are passed to the " "underlying :class:`cmd.Cmd` class; see the description there." msgstr "" +"*completekey*、*stdin* 與 *stdout* 引數會被傳到底層的 :class:`cmd.Cmd` 類別;" +"請於該文件閱讀相關敘述。" #: ../../library/pdb.rst:202 msgid "" @@ -287,6 +368,8 @@ msgid "" "patterns. The debugger will not step into frames that originate in a module " "that matches one of these patterns. [1]_" msgstr "" +"如果給定 *skip* 引數,則它必須是一個給出 glob 樣式之模組名稱的疊代器。如果遇" +"到匹配這些樣式的模組,偵錯器將不會進入來自該模組的 frame。 [1]_" #: ../../library/pdb.rst:206 msgid "" @@ -296,16 +379,20 @@ msgid "" "pressing :kbd:`Ctrl-C`. If you want Pdb not to touch the SIGINT handler, " "set *nosigint* to true." msgstr "" +"預設情況下,當你發出 :pdbcmd:`continue` 命令時,Pdb 會為 SIGINT 訊號(即使用" +"者在控制台上按下 :kbd:`Ctrl-C` 時會發送的訊號)設定一個處理程式 (handler),這" +"允許你透過按下 :kbd:`Ctrl-C` 再次切入偵錯器。如果你希望 Pdb 不影響到 SIGINT " +"處理程式,請將 *nosigint* 設定為 true。" #: ../../library/pdb.rst:211 msgid "" "The *readrc* argument defaults to true and controls whether Pdb will load ." "pdbrc files from the filesystem." -msgstr "" +msgstr "*readrc* 引數預設為 true,它控制 Pdb 是否從檔案系統載入 .pdbrc 檔案。" #: ../../library/pdb.rst:214 msgid "Example call to enable tracing with *skip*::" -msgstr "" +msgstr "啟用追蹤 (tracing) 且帶有 *skip* 引數的呼叫示範: ::" #: ../../library/pdb.rst:216 msgid "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" @@ -314,17 +401,19 @@ msgstr "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" #: ../../library/pdb.rst:218 msgid "" "Raises an :ref:`auditing event ` ``pdb.Pdb`` with no arguments." -msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``pdb.Pdb``。" +msgstr "" +"不帶引數地引發一個\\ :ref:`稽核事件 (auditing event) ` ``pdb." +"Pdb``。" #: ../../library/pdb.rst:220 msgid "Added the *skip* parameter." -msgstr "" +msgstr "新增了 *skip* 參數。" #: ../../library/pdb.rst:223 msgid "" "Added the *nosigint* parameter. Previously, a SIGINT handler was never set " "by Pdb." -msgstr "" +msgstr "新增了 *nosigint* 參數。以前 SIGINT 處理程式從未被 Pdb 設定過。" #: ../../library/pdb.rst:227 msgid "The *readrc* argument." @@ -332,11 +421,11 @@ msgstr "*readrc* 引數。" #: ../../library/pdb.rst:235 msgid "See the documentation for the functions explained above." -msgstr "" +msgstr "請見上面關於這些函式的文件說明。" #: ../../library/pdb.rst:241 msgid "Debugger Commands" -msgstr "" +msgstr "偵錯器命令" #: ../../library/pdb.rst:243 msgid "" @@ -349,12 +438,19 @@ msgid "" "the square brackets must not be typed. Alternatives in the command syntax " "are separated by a vertical bar (``|``)." msgstr "" +"下方列出的是偵錯器能認得的命令。如下所示,大多數命令可以縮寫為一個或兩個字" +"母。如 ``h(elp)`` 表示可以輸入 ``h`` 或 ``help`` 來輸入幫助命令(但不能輸入 " +"``he`` 或 ``hel``,也不能是 ``H`` 或 ``Help`` 或 ``HELP``)。命令的引數必須用" +"空格(空格符 (spaces) 或製表符 (tabs))分隔。在命令語法中,可選引數被括在方括" +"號 (``[]``) 中;使用時請勿輸入方括號。命令語法中的選擇項由豎線 (``|``) 分隔。" #: ../../library/pdb.rst:252 msgid "" "Entering a blank line repeats the last command entered. Exception: if the " "last command was a :pdbcmd:`list` command, the next 11 lines are listed." msgstr "" +"輸入一個空白列 (blank line) 將重複上次輸入的命令。例外:如果上一個命令是 :" +"pdbcmd:`list` 命令,則會列出接下來的 11 列。" #: ../../library/pdb.rst:255 msgid "" @@ -366,12 +462,16 @@ msgid "" "in such a statement, the exception name is printed but the debugger's state " "is not changed." msgstr "" +"偵錯器無法識別的命令將被認為是 Python 陳述式,並以正在偵錯的程式之情境來執" +"行。Python 陳述式也可以用驚嘆號 (``!``) 作為前綴,這是檢視正在偵錯之程式的強" +"大方法,甚至可以修改變數或呼叫函式。當此類陳述式發生例外,將印出例外名稱,但" +"偵錯器的狀態不會改變。" #: ../../library/pdb.rst:263 msgid "" "Expressions/Statements whose prefix is a pdb command are now correctly " "identified and executed." -msgstr "" +msgstr "現在可以正確辨識並執行前綴為 pdb 命令的運算式/陳述式。" #: ../../library/pdb.rst:267 msgid "" @@ -379,6 +479,8 @@ msgid "" "parameters which allows one a certain level of adaptability to the context " "under examination." msgstr "" +"偵錯器有支援設定\\ :ref:`別名 `。別名可以有參數,使得偵錯器" +"對被檢查的情境有一定程度的適應性。" #: ../../library/pdb.rst:271 msgid "" @@ -390,6 +492,10 @@ msgid "" "double semicolons is to use implicit string concatenation ``';'';'`` or ``\";" "\"\";\"``." msgstr "" +"在一列中可以輸入多個以 ``;;`` 分隔的命令。(不能使用單個 ``;``,因為它用於分" +"隔傳遞給 Python 剖析器一列中的多個命令。)切分命令沒運用什麼高深的方式;輸入" +"總是在第一處 ``;;`` 被切分開,即使它位於引號內的字串之中。對於具有雙分號字串" +"的一個變通解法,是使用隱式字串連接 ``';'';'`` 或 ``\";\"\";\"``。" #: ../../library/pdb.rst:278 msgid "" @@ -400,26 +506,30 @@ msgid "" "program resumes execution so it's less likely to interfere with your program " "compared to using normal variables like ``foo = 1``." msgstr "" +"要設定臨時全域變數,請使用\\ *便利變數 (convenience variable)*。*便利變數*\\ " +"是名稱以 ``$`` 開頭的變數。例如 ``$foo = 1`` 會設定一個全域變數 ``$foo``,你" +"可以在偵錯器會話 (debugger session) 中使用它。當程式恢復執行時,*便利變數*\\ " +"將被清除,因此與使用 ``foo = 1`` 等普通變數相比,它不太會去干擾你的程式。" #: ../../library/pdb.rst:285 msgid "There are three preset *convenience variables*:" -msgstr "" +msgstr "共有三個預先設定的\\ *便利變數*:" #: ../../library/pdb.rst:287 msgid "``$_frame``: the current frame you are debugging" -msgstr "" +msgstr "``$_frame``:當前正在偵錯的 frame" #: ../../library/pdb.rst:288 msgid "``$_retval``: the return value if the frame is returning" -msgstr "" +msgstr "``$_retval``:frame 回傳時的回傳值" #: ../../library/pdb.rst:289 msgid "``$_exception``: the exception if the frame is raising an exception" -msgstr "" +msgstr "``$_exception``:frame 引發例外時的例外" #: ../../library/pdb.rst:293 msgid "Added the *convenience variable* feature." -msgstr "" +msgstr "新增了\\ *便利變數*\\ 功能。" #: ../../library/pdb.rst:299 msgid "" @@ -430,6 +540,10 @@ msgid "" "useful for aliases. If both files exist, the one in the home directory is " "read first and aliases defined there can be overridden by the local file." msgstr "" +"如果 :file:`.pdbrc` 檔案存在於使用者的家目錄或當前目錄中,則會使用 " +"``'utf-8'`` 編碼讀取並執行該檔案,就像在偵錯器提示字元下鍵入該檔案一樣,除了" +"空列和以 ``#`` 開頭的列會被忽略之外。這對於別名設定特別有用。如果兩個檔案都存" +"在,則先讀取家目錄中的檔案,且定義於其中的別名可以被本地檔案覆蓋。" #: ../../library/pdb.rst:306 msgid "" @@ -437,12 +551,16 @@ msgid "" "pdbcmd:`continue` or :pdbcmd:`next`. Previously, these commands had no " "effect." msgstr "" +":file:`.pdbrc` 現在可以包含繼續偵錯的命令,如 :pdbcmd:`continue` 或 :pdbcmd:" +"`next`。以前檔案中的這些命令是無效的。" #: ../../library/pdb.rst:311 msgid "" ":file:`.pdbrc` is now read with ``'utf-8'`` encoding. Previously, it was " "read with the system locale encoding." msgstr "" +":file:`.pdbrc` 現在使用 ``'utf-8'`` 編碼讀取。以前它是使用系統區域設定編碼讀" +"取的。" #: ../../library/pdb.rst:318 msgid "" @@ -452,6 +570,10 @@ msgid "" "argument must be an identifier, ``help exec`` must be entered to get help on " "the ``!`` command." msgstr "" +"如不帶引數,印出可用的命令列表。引數為 *command* 時,印出有關該命令的幫助訊" +"息,``help pdb`` 會顯示完整文件(即 :mod:`pdb` 模組的說明字串 (docstring))。" +"由於 *command* 引數必須是一個識別字 (identifier),若要獲取 ``!`` 命令的幫助訊" +"息則必須輸入 ``help exec``。" #: ../../library/pdb.rst:326 msgid "" @@ -459,18 +581,24 @@ msgid "" "(``>``) indicates the current frame, which determines the context of most " "commands." msgstr "" +"印出 stack trace,最新的 frame 會位於底部。箭頭(``>``)表示當前的 frame,它" +"也決定了大多數命令的情境。" #: ../../library/pdb.rst:331 msgid "" "Move the current frame *count* (default one) levels down in the stack trace " "(to a newer frame)." msgstr "" +"在 stack trace 中,將當前 frame 向下移動 *count* 級(預設為 1 級,移往較新的 " +"frame)。" #: ../../library/pdb.rst:336 msgid "" "Move the current frame *count* (default one) levels up in the stack trace " "(to an older frame)." msgstr "" +"在 stack trace 中,將當前 frame 向上移動 *count* 級(預設為 1 級,移向較舊的 " +"frame)。" #: ../../library/pdb.rst:341 msgid "" @@ -481,6 +609,10 @@ msgid "" "``/abspath/to/file.py``, ``relpath/file.py``, ``module`` and ``package." "module``." msgstr "" +"如帶有 *lineno* 引數,則在目前檔案中的 *lineno* 列處設定中斷。列號可以以 " +"*filename* 和冒號為前綴,以指定另一個檔案(可能是尚未載入的檔案)中的斷點。該" +"檔案會在 :data:`sys.path` 上搜尋。可接受的 *filename* 形式為 ``/abspath/to/" +"file.py``、``relpath/file.py``、``module`` 和 ``package.module``。" #: ../../library/pdb.rst:348 msgid "" @@ -488,12 +620,14 @@ msgid "" "within that function. *function* can be any expression that evaluates to a " "function in the current namespace." msgstr "" +"如帶有 *function* 引數,在該函式內的第一個可執行陳述式處設定中斷。*function* " +"可以是任何其求值結果為目前命名空間中函式的運算式。" #: ../../library/pdb.rst:352 msgid "" "If a second argument is present, it is an expression which must evaluate to " "true before the breakpoint is honored." -msgstr "" +msgstr "如果第二個引數存在,它是一個運算式,在斷點生效前其必須求值為 true" #: ../../library/pdb.rst:355 msgid "" @@ -501,18 +635,21 @@ msgid "" "of times that breakpoint has been hit, the current ignore count, and the " "associated condition if any." msgstr "" +"如果不帶引數執行會列出所有斷點資訊,包括每個斷點、命中該斷點的次數、當前的忽" +"略次數以及關聯的條件(如存在)。" #: ../../library/pdb.rst:359 msgid "" "Each breakpoint is assigned a number to which all the other breakpoint " "commands refer." -msgstr "" +msgstr "每個斷點都有賦予一個編號,所有其他斷點命令都參照該編號。" #: ../../library/pdb.rst:364 msgid "" "Temporary breakpoint, which is removed automatically when it is first hit. " "The arguments are the same as for :pdbcmd:`break`." msgstr "" +"臨時斷點,在第一次遇見時會自動被刪除。它的引數與 :pdbcmd:`break` 相同。" #: ../../library/pdb.rst:369 msgid "" @@ -520,6 +657,8 @@ msgid "" "With a space separated list of breakpoint numbers, clear those breakpoints. " "Without argument, clear all breaks (but first ask confirmation)." msgstr "" +"如帶有 *filename:lineno* 引數,則清除此列上的所有斷點。如果引數是空格分隔的斷" +"點編號列表,則清除這些斷點。如果不帶引數則清除所有斷點(但會先提示確認)。" #: ../../library/pdb.rst:375 msgid "" @@ -528,6 +667,8 @@ msgid "" "execution, but unlike clearing a breakpoint, it remains in the list of " "breakpoints and can be (re-)enabled." msgstr "" +"停用斷點,斷點以空格分隔的斷點編號列表來給定。停用斷點表示它不會導致程式停止" +"執行,但是與清除斷點不同,停用的斷點將保留在斷點列表中並且可以(重新)啟用。" #: ../../library/pdb.rst:382 msgid "Enable the breakpoints specified." From 44db333887905ab1598da897b96f534f529f482d Mon Sep 17 00:00:00 2001 From: "Raynor@GullU" Date: Thu, 31 Oct 2024 21:55:27 +0800 Subject: [PATCH 42/89] docs(library/pickle.po): update the translation of `function signature` --- library/pickle.po | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/library/pickle.po b/library/pickle.po index 4dddef77bd..370cbe643d 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -1303,8 +1303,7 @@ msgstr "" "`~object.__dict__` 屬性中。" # SkyLull: [T] -# signature: https://stackoverflow.com/questions/72788932/what-is-a-function- -# signature -> 輸入特徵 +# signature: https://jo-jo.medium.com/c-c-%E5%B9%BC%E5%B9%BC%E7%8F%AD-%E7%B0%BD%E7%AB%A0signature-fa9b04e1a3e2 #: ../../library/pickle.rst:715 msgid "" "Optionally, an iterator (and not a sequence) yielding successive items. " @@ -1319,8 +1318,8 @@ msgstr "" "可選項。一個用來提供連續項目的疊代器(而非序列)。這些項目將個別透過 ``obj." "append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被附加到" "物件中。主要用於串列(list)子類別,但只要其他類別具有相應的 :ref:`append 和 " -"extend 方法 `\\ 和相同的輸入特徵(signature)就也可以使用。 " -"(如何選擇使用 :meth:`!append` 或 :meth:`!extend` 方法將取決於所選用的 " +"extend 方法 `\\ 以及相同的函式簽章(signature)就也可以使用。 " +"(是否會調用 :meth:`!append` 或 :meth:`!extend` 方法將取決於所選用的 " "pickle 協定版本以及要附加的項目數量,因此必須同時支援這兩種方法。)" #: ../../library/pickle.rst:725 @@ -1342,7 +1341,7 @@ msgid "" "method. If not ``None``, this callable will have priority over ``obj``'s :" "meth:`__setstate__`." msgstr "" -"可選項。一個具有 ``(obj, state)`` 輸入特徵(signature)的可呼叫物件。該物件允" +"可選項。一個具有 ``(obj, state)`` 函式簽章(signature)的可呼叫物件。該物件允" "許使用者以可編寫的邏輯,而不是物件 ``obj`` 預設的 :meth:`__setstate__` 靜態方" "法去控制特定物件的狀態更新方式。如果這個物件不是 ``None``,這個物件的呼叫優先" "權將優於物件 ``obj`` 的 :meth:`__setstate__`。" From 7823bb1d72442f6079958a52d72735b1dca62234 Mon Sep 17 00:00:00 2001 From: Payon Date: Tue, 8 Oct 2024 15:47:20 +0800 Subject: [PATCH 43/89] =?UTF-8?q?fix:=20to=20rst:=20406=20-=20382=20/=2038?= =?UTF-8?q?8=20=E4=BA=9B=E5=BE=AE=E8=B6=85=E8=AD=AF=20-=20399=20populated?= =?UTF-8?q?=20=E7=94=A8=E5=A1=AB=E5=85=85=E7=B8=BD=E8=A6=BA=E5=BE=97?= =?UTF-8?q?=E6=80=AA=EF=BC=8C=E6=8F=9B=E4=BA=86=E5=80=8B=E5=AF=AB=E6=B3=95?= =?UTF-8?q?=20-=20403=20=E6=A0=B9=E6=93=9A=E5=B7=B2=E6=A3=84=E7=94=A8?= =?UTF-8?q?=E7=9A=84=20load=5Fmodule=20=E5=88=A4=E6=96=B7=E5=85=B6?= =?UTF-8?q?=E7=82=BA=E6=8E=A5=E7=AE=A1=E8=BC=89=E5=85=A5=E6=A8=A1=E7=B5=84?= =?UTF-8?q?=E4=B9=8B=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reference/import.po | 55 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/reference/import.po b/reference/import.po index 9e13d37747..1762a13f65 100644 --- a/reference/import.po +++ b/reference/import.po @@ -7,8 +7,8 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2024-10-07 21:14+0800\n" -"Last-Translator: Adrian Liaw \n" +"PO-Revision-Date: 2024-10-08 15:45+0800\n" +"Last-Translator: Ken Cheng \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -599,7 +599,7 @@ msgstr "" #: ../../reference/import.rst:342 msgid "Loading" -msgstr "" +msgstr "載入" #: ../../reference/import.rst:344 msgid "" @@ -607,6 +607,8 @@ msgid "" "the loader it contains) when loading the module. Here is an approximation " "of what happens during the loading portion of import::" msgstr "" +"如果找到模組規格,引入機制會在載入模組時使用該規格(以及它包含的載入器)。以" +"下是引入過程中載入部分的大致情況: ::" #: ../../reference/import.rst:348 msgid "" @@ -639,16 +641,45 @@ msgid "" " raise\n" "return sys.modules[spec.name]" msgstr "" +"module = None\n" +"if spec.loader is not None and hasattr(spec.loader, 'create_module'):\n" +" # 這裡假設載入器上也會定義 'exec_module'\n" +" module = spec.loader.create_module(spec)\n" +"if module is None:\n" +" module = ModuleType(spec.name)\n" +"# 與引入相關的模組屬性會在此處設定:\n" +"_init_module_attrs(spec, module)\n" +"\n" +"if spec.loader is None:\n" +" # 不支援\n" +" raise ImportError\n" +"if spec.origin is None and spec.submodule_search_locations is not None:\n" +" # 命名空間套件\n" +" sys.modules[spec.name] = module\n" +"elif not hasattr(spec.loader, 'exec_module'):\n" +" module = spec.loader.load_module(spec.name)\n" +"else:\n" +" sys.modules[spec.name] = module\n" +" try:\n" +" spec.loader.exec_module(module)\n" +" except BaseException:\n" +" try:\n" +" del sys.modules[spec.name]\n" +" except KeyError:\n" +" pass\n" +" raise\n" +"return sys.modules[spec.name]" #: ../../reference/import.rst:377 msgid "Note the following details:" -msgstr "" +msgstr "請注意下列細節:" #: ../../reference/import.rst:379 msgid "" "If there is an existing module object with the given name in :data:`sys." "modules`, import will have already returned it." msgstr "" +"如果 :data:`sys.modules` 中已存在具有給定名稱的模組物件,引入會已回傳該物件。" #: ../../reference/import.rst:382 msgid "" @@ -658,6 +689,9 @@ msgid "" "prevents unbounded recursion in the worst case and multiple loading in the " "best." msgstr "" +"在載入器執行模組程式碼之前,模組將已存在於 :data:`sys.modules` 中。這一點至關" +"重要,因為模組程式碼可能會(直接或間接)引入自己;事先將其增加到 :data:`sys." +"modules` 可以預防類似無限遞迴以及多次重覆載入等情形。" #: ../../reference/import.rst:388 msgid "" @@ -667,6 +701,10 @@ msgid "" "effect, must remain in the cache. This contrasts with reloading where even " "the failing module is left in :data:`sys.modules`." msgstr "" +"如果載入失敗,只有載入失敗的模組會從 :data:`sys.modules` 中刪除。任何已存在" +"於 :data:`sys.modules` 快取中的模組,以及任何在載入失敗前成功載入的模組,都必" +"須保留在快取中。此情形與重新載入不同,在重新載入時,即使載入失敗的模組也會保" +"留在 :data:`sys.modules` 中。" #: ../../reference/import.rst:394 msgid "" @@ -675,6 +713,9 @@ msgid "" "code example above), as summarized in a :ref:`later section `." msgstr "" +"模組建立後,在執行之前,引入機制會設置與引入相關的模組屬性(在上面的偽程式碼" +"範例中為 \"_init_module_attrs\"),具體內容在\\ :ref:`之後的段落`\\ 會總結。" #: ../../reference/import.rst:399 msgid "" @@ -682,12 +723,16 @@ msgid "" "namespace gets populated. Execution is entirely delegated to the loader, " "which gets to decide what gets populated and how." msgstr "" +"模組執行是載入過程中的關鍵時刻,此時模組的命名空間會被新增名稱。執行過程完全" +"交由載入器處理,由其決定如何新增以及新增什麼。" #: ../../reference/import.rst:403 msgid "" "The module created during loading and passed to exec_module() may not be the " "one returned at the end of import [#fnlo]_." msgstr "" +"在載入過程中建立並傳遞給 exec_module() 的模組,可能不會是引入結束時回傳的模" +"組 [#fnlo]_。" #: ../../reference/import.rst:406 msgid "" @@ -695,6 +740,8 @@ msgid "" "loaders. These were previously performed by the :meth:`importlib.abc.Loader." "load_module` method." msgstr "" +"引入系統已接管載入器中載入模組的功能。之前是由 :meth:`importlib.abc.Loader." +"load_module` 方法執行的。" #: ../../reference/import.rst:412 msgid "Loaders" From af83098a199582c32c3dc17a4517abb9e634fe34 Mon Sep 17 00:00:00 2001 From: Payon Date: Tue, 29 Oct 2024 12:12:17 +0800 Subject: [PATCH 44/89] =?UTF-8?q?fix:=20to=20rst:=20480=20-=20=E9=9C=80?= =?UTF-8?q?=E7=A2=BA=E8=AA=8D=20boilerplate=20=E6=98=AF=E5=90=A6=E9=9C=80?= =?UTF-8?q?=E7=BF=BB=E8=AD=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- reference/import.po | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/reference/import.po b/reference/import.po index 1762a13f65..6a56fcabe8 100644 --- a/reference/import.po +++ b/reference/import.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2024-10-08 15:45+0800\n" +"PO-Revision-Date: 2024-10-29 01:29+0800\n" "Last-Translator: Ken Cheng \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -745,7 +745,7 @@ msgstr "" #: ../../reference/import.rst:412 msgid "Loaders" -msgstr "" +msgstr "載入器" #: ../../reference/import.rst:414 msgid "" @@ -754,10 +754,13 @@ msgid "" "method with a single argument, the module object to execute. Any value " "returned from :meth:`~importlib.abc.Loader.exec_module` is ignored." msgstr "" +"模組載入器提供了載入的關鍵功能:模組執行。引入機制會以單一引數(即要執行的模" +"組物件)呼叫 :meth:`importlib.abc.Loader.exec_module` 方法。任何從 :meth:" +"`~importlib.abc.Loader.exec_module` 回傳的值都會被忽略。" #: ../../reference/import.rst:419 msgid "Loaders must satisfy the following requirements:" -msgstr "" +msgstr "載入器必須滿足以下要求:" #: ../../reference/import.rst:421 msgid "" @@ -765,6 +768,8 @@ msgid "" "dynamically loaded extension), the loader should execute the module's code " "in the module's global name space (``module.__dict__``)." msgstr "" +"如果模組是 Python 模組(而非內建模組或動態載入的擴充),載入器應在模組的全域" +"命名空間 (``module.__dict__``\\ ) 中執行該模組的程式碼。" #: ../../reference/import.rst:425 msgid "" @@ -772,6 +777,8 @@ msgid "" "`ImportError`, although any other exception raised during :meth:`~importlib." "abc.Loader.exec_module` will be propagated." msgstr "" +"如果載入器無法執行該模組,應引發 :exc:`ImportError`。不過,在 :meth:" +"`~importlib.abc.Loader.exec_module` 中引發的任何其他例外也會被傳播。" #: ../../reference/import.rst:429 msgid "" @@ -779,6 +786,9 @@ msgid "" "the :meth:`~importlib.abc.MetaPathFinder.find_spec` method would just return " "a spec with the loader set to ``self``." msgstr "" +"在許多情況下,尋檢器和載入器可以是同一個物件;在這種情況下,:meth:" +"`~importlib.abc.MetaPathFinder.find_spec` 方法只需回傳一個載入器設為 " +"``self`` 的規格即可。" #: ../../reference/import.rst:433 msgid "" @@ -789,10 +799,14 @@ msgid "" "the module object. If the method returns ``None``, the import machinery " "will create the new module itself." msgstr "" +"模組載入器可以選擇透過實作 :meth:`~importlib.abc.Loader.create_module` 方法," +"在載入過程中建立模組物件。該方法接受一個引數,即模組規格,並回傳在載入過程中" +"要使用的新的模組物件。``create_module()`` 不需要在模組物件上設定任何屬性。如" +"果該方法回傳 ``None``,引入機制將自行建立新的模組。" #: ../../reference/import.rst:440 msgid "The :meth:`~importlib.abc.Loader.create_module` method of loaders." -msgstr "" +msgstr "載入器的 :meth:`~importlib.abc.Loader.create_module` 方法。" #: ../../reference/import.rst:443 msgid "" @@ -800,6 +814,8 @@ msgid "" "`~importlib.abc.Loader.exec_module` and the import machinery assumed all the " "boilerplate responsibilities of loading." msgstr "" +":meth:`~importlib.abc.Loader.load_module` 方法已被 :meth:`~importlib.abc." +"Loader.exec_module` 取代,引入機制已承擔所有載入的功能。" #: ../../reference/import.rst:448 msgid "" @@ -808,6 +824,9 @@ msgid "" "also implement ``exec_module()``. However, ``load_module()`` has been " "deprecated and loaders should implement ``exec_module()`` instead." msgstr "" +"為了與現有的載入器相容,引入機制會在載入器未實作 ``exec_module()`` 且存在 " +"``load_module()`` 方法時使用該方法。然而,``load_module()`` 已被棄用,載入器" +"應改為實作 ``exec_module()``。" #: ../../reference/import.rst:453 msgid "" @@ -815,6 +834,8 @@ msgid "" "functionality described above in addition to executing the module. All the " "same constraints apply, with some additional clarification:" msgstr "" +"``load_module()`` 方法除了執行模組外,還必須實作上述全部的模板載入功能。所有" +"相同的限制依然適用,並且還有一些額外的說明:" #: ../../reference/import.rst:457 msgid "" @@ -824,12 +845,18 @@ msgid "" "exist in :data:`sys.modules`, the loader must create a new module object and " "add it to :data:`sys.modules`." msgstr "" +"如果 :data:`sys.modules` 中已存在具有給定名稱的模組物件,載入器必須使用該模組" +"(否則 :func:`importlib.reload` 將無法正常運作)。如果命名模組不存在於 :data:" +"`sys.modules` 中,載入器必須建立一個新的模組物件並將其新增至 :data:`sys." +"modules`。" #: ../../reference/import.rst:463 msgid "" "The module *must* exist in :data:`sys.modules` before the loader executes " "the module code, to prevent unbounded recursion or multiple loading." msgstr "" +"在載入器執行模組程式碼之前,該模組\\ *必須*\\ 已存在於 :data:`sys.modules` " +"中,以防止無限遞迴或多次載入。" #: ../../reference/import.rst:467 msgid "" @@ -837,22 +864,29 @@ msgid "" "data:`sys.modules`, but it must remove **only** the failing module(s), and " "only if the loader itself has loaded the module(s) explicitly." msgstr "" +"如果載入失敗,載入器必須移除已經插入到 :data:`sys.modules` 中的任何模組,但" +"\\ **只能**\\ 移除失敗的模組(們),且僅在載入器本身明確載入這些模組時才需移" +"除。" #: ../../reference/import.rst:472 msgid "" "A :exc:`DeprecationWarning` is raised when ``exec_module()`` is defined but " "``create_module()`` is not." msgstr "" +"當 ``exec_module()`` 已定義但未定義 ``create_module()`` 時,將引發 :exc:" +"`DeprecationWarning`。" #: ../../reference/import.rst:476 msgid "" "An :exc:`ImportError` is raised when ``exec_module()`` is defined but " "``create_module()`` is not." msgstr "" +"當 ``exec_module()`` 已定義但未定義 ``create_module()`` 時,將引發 :exc:" +"`ImportError`。" #: ../../reference/import.rst:480 msgid "Use of ``load_module()`` will raise :exc:`ImportWarning`." -msgstr "" +msgstr "使用 ``load_module()`` 將引發 :exc:`ImportWarning`。" #: ../../reference/import.rst:484 msgid "Submodules" From 19d2787c44671ea8ca362cfd9dde729bb7ab64f7 Mon Sep 17 00:00:00 2001 From: Payon Date: Mon, 4 Nov 2024 22:17:57 +0800 Subject: [PATCH 45/89] fix: to rst: 530 --- reference/import.po | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/reference/import.po b/reference/import.po index 6a56fcabe8..d38b654ada 100644 --- a/reference/import.po +++ b/reference/import.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2024-10-29 01:29+0800\n" +"PO-Revision-Date: 2024-11-04 22:16+0800\n" "Last-Translator: Ken Cheng \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -901,6 +901,11 @@ msgid "" "``spam.foo``, ``spam`` will have an attribute ``foo`` which is bound to the " "submodule. Let's say you have the following directory structure::" msgstr "" +"當使用任何機制(例如 ``importlib`` APIs,``import`` 或 ``import-from`` 陳述" +"式,或內建的 ``__import__()``\\ )載入子模組時,會將子模組物件繫結到父模組的" +"命名空間中。例如,如果套件 ``spam`` 有一個子模組 ``foo``,則在引入 ``spam." +"foo`` 之後,``spam`` 將擁有一個名為 ``foo`` 的屬性,該屬性繫結到子模組。我們" +"假設你有以下的目錄結構: ::" #: ../../reference/import.rst:493 msgid "" @@ -914,7 +919,7 @@ msgstr "" #: ../../reference/import.rst:497 msgid "and ``spam/__init__.py`` has the following line in it::" -msgstr "" +msgstr "並且 ``spam/__init__.py`` 中包含以下程式碼: ::" #: ../../reference/import.rst:499 msgid "from .foo import Foo" @@ -925,6 +930,7 @@ msgid "" "then executing the following puts name bindings for ``foo`` and ``Foo`` in " "the ``spam`` module::" msgstr "" +"那麼執行以下程式碼會將 ``foo`` 和 ``Foo`` 的名稱繫結到 ``spam`` 模組中: ::" #: ../../reference/import.rst:504 msgid "" @@ -948,6 +954,14 @@ msgid "" "foo']`` (as you would after the above import), the latter must appear as the " "``foo`` attribute of the former." msgstr "" +"鑑於 Python 相似的名稱繫結規則,這可能看起來有些出人意料,但這實際上是引入系" +"統的一個基本特性。不變的是如果你擁有 ``sys.modules['spam']`` 和 ``sys." +"modules['spam.foo']``(就像上述引入後那樣),那麼後者必須作為前者的 ``foo`` " +"屬性出現。" + +#: ../../reference/import.rst:517 +msgid "Module spec" +msgstr "模組規格" #: ../../reference/import.rst:519 msgid "Module specs" @@ -960,6 +974,9 @@ msgid "" "modules. The purpose of a module's spec is to encapsulate this import-" "related information on a per-module basis." msgstr "" +"引入機制在引入過程中使用有關每個模組的各種資訊,尤其是在載入之前。大多數資訊" +"對所有模組來說都是通用的。模組規格的目的是以每個模組為基礎封裝這些與引入相關" +"的資訊。" #: ../../reference/import.rst:526 msgid "" @@ -969,6 +986,9 @@ msgid "" "machinery to perform the boilerplate operations of loading, whereas without " "a module spec the loader had that responsibility." msgstr "" +"在引入過程中使用規格允許在引入系統的各個組件之間傳遞狀態,例如在建立模組規格" +"的尋檢器和執行該規格的載入器之間傳遞。最重要的是,這允許引入機制執行載入的樣" +"板操作,而在沒有模組規格的情況下,這些操作則是載入器的責任。" #: ../../reference/import.rst:532 msgid "" @@ -977,6 +997,8 @@ msgid "" "interpreter startup `. The one exception is ``__main__``, where :" "attr:`!__spec__` is :ref:`set to None in some cases `." msgstr "" +"模組的規格以 ``__spec__`` 屬性的形式公開在模組物件上。有關模組規格內容的詳細" +"資訊,請參閱 :class:`~importlib.machinery.ModuleSpec`。" #: ../../reference/import.rst:538 msgid "" From 7185585b557e5a09d600d685203705d06fb8ca91 Mon Sep 17 00:00:00 2001 From: Payon Date: Mon, 4 Nov 2024 22:24:29 +0800 Subject: [PATCH 46/89] fix conflict problem --- reference/import.po | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/reference/import.po b/reference/import.po index d38b654ada..87fb7ccb21 100644 --- a/reference/import.po +++ b/reference/import.po @@ -959,13 +959,9 @@ msgstr "" "modules['spam.foo']``(就像上述引入後那樣),那麼後者必須作為前者的 ``foo`` " "屬性出現。" -#: ../../reference/import.rst:517 -msgid "Module spec" -msgstr "模組規格" - #: ../../reference/import.rst:519 msgid "Module specs" -msgstr "" +msgstr "模組規格" #: ../../reference/import.rst:521 msgid "" From 1b2c863ed6d593bc106a4cc98cc4f5580583002f Mon Sep 17 00:00:00 2001 From: Payon Date: Mon, 4 Nov 2024 22:31:23 +0800 Subject: [PATCH 47/89] fix conflict translation --- reference/import.po | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/reference/import.po b/reference/import.po index 87fb7ccb21..b480a4be1f 100644 --- a/reference/import.po +++ b/reference/import.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2024-11-04 22:16+0800\n" +"PO-Revision-Date: 2024-11-04 22:31+0800\n" "Last-Translator: Ken Cheng \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -983,7 +983,7 @@ msgid "" "a module spec the loader had that responsibility." msgstr "" "在引入過程中使用規格允許在引入系統的各個組件之間傳遞狀態,例如在建立模組規格" -"的尋檢器和執行該規格的載入器之間傳遞。最重要的是,這允許引入機制執行載入的樣" +"的尋檢器和執行該規格的載入器之間傳遞。最重要的是,這允許引入機制執行載入的模" "板操作,而在沒有模組規格的情況下,這些操作則是載入器的責任。" #: ../../reference/import.rst:532 @@ -993,14 +993,17 @@ msgid "" "interpreter startup `. The one exception is ``__main__``, where :" "attr:`!__spec__` is :ref:`set to None in some cases `." msgstr "" -"模組的規格以 ``__spec__`` 屬性的形式公開在模組物件上。有關模組規格內容的詳細" -"資訊,請參閱 :class:`~importlib.machinery.ModuleSpec`。" +"模組的規格以 :attr:`module.__spec__` 的形式公開。適當地設定 :attr:`!" +"__spec__` 同樣適用於\\ :ref:`在直譯器啟動期間初始化的模組`。唯一的" +"例外是 ``__main__``,其中 :attr:`!__spec__` 會\\ :ref:`在某些情況下被設定成 " +"None `。" #: ../../reference/import.rst:538 msgid "" "See :class:`~importlib.machinery.ModuleSpec` for details on the contents of " "the module spec." msgstr "" +"有關模組規格內容的詳細資訊,請參閱 :class:`~importlib.machinery.ModuleSpec`。" #: ../../reference/import.rst:546 msgid "__path__ attributes on modules" From 24165e59798eba53ea546add8cb75bd620aa08fa Mon Sep 17 00:00:00 2001 From: Payon Date: Wed, 6 Nov 2024 14:56:16 +0800 Subject: [PATCH 48/89] fix: Apply suggestions from code review --- reference/import.po | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/reference/import.po b/reference/import.po index b480a4be1f..b78211cdd6 100644 --- a/reference/import.po +++ b/reference/import.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2024-11-04 22:31+0800\n" +"PO-Revision-Date: 2024-11-06 14:55+0800\n" "Last-Translator: Ken Cheng \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -713,7 +713,7 @@ msgid "" "code example above), as summarized in a :ref:`later section `." msgstr "" -"模組建立後,在執行之前,引入機制會設置與引入相關的模組屬性(在上面的偽程式碼" +"模組建立後、在執行之前,引入機制會設置與引入相關的模組屬性(在上面的偽程式碼" "範例中為 \"_init_module_attrs\"),具體內容在\\ :ref:`之後的段落`\\ 會總結。" @@ -740,8 +740,8 @@ msgid "" "loaders. These were previously performed by the :meth:`importlib.abc.Loader." "load_module` method." msgstr "" -"引入系統已接管載入器中載入模組的功能。之前是由 :meth:`importlib.abc.Loader." -"load_module` 方法執行的。" +"引入系統已接管載入器的模板 (boilerplate) 責任。之前是由 :meth:`importlib.abc." +"Loader.load_module` 方法執行的。" #: ../../reference/import.rst:412 msgid "Loaders" @@ -815,7 +815,7 @@ msgid "" "boilerplate responsibilities of loading." msgstr "" ":meth:`~importlib.abc.Loader.load_module` 方法已被 :meth:`~importlib.abc." -"Loader.exec_module` 取代,引入機制已承擔所有載入的功能。" +"Loader.exec_module` 取代,引入機制已承擔所有載入的模板責任。" #: ../../reference/import.rst:448 msgid "" @@ -901,7 +901,7 @@ msgid "" "``spam.foo``, ``spam`` will have an attribute ``foo`` which is bound to the " "submodule. Let's say you have the following directory structure::" msgstr "" -"當使用任何機制(例如 ``importlib`` APIs,``import`` 或 ``import-from`` 陳述" +"當使用任何機制(例如 ``importlib`` APIs、``import`` 或 ``import-from`` 陳述" "式,或內建的 ``__import__()``\\ )載入子模組時,會將子模組物件繫結到父模組的" "命名空間中。例如,如果套件 ``spam`` 有一個子模組 ``foo``,則在引入 ``spam." "foo`` 之後,``spam`` 將擁有一個名為 ``foo`` 的屬性,該屬性繫結到子模組。我們" @@ -994,7 +994,7 @@ msgid "" "attr:`!__spec__` is :ref:`set to None in some cases `." msgstr "" "模組的規格以 :attr:`module.__spec__` 的形式公開。適當地設定 :attr:`!" -"__spec__` 同樣適用於\\ :ref:`在直譯器啟動期間初始化的模組`。唯一的" +"__spec__` 同樣適用於\\ :ref:`在直譯器啟動期間初始化的模組 `。唯一的" "例外是 ``__main__``,其中 :attr:`!__spec__` 會\\ :ref:`在某些情況下被設定成 " "None `。" From 740e4107964cac606e72b0c395bc14bb1f0616f5 Mon Sep 17 00:00:00 2001 From: "pydoc-zh-tw[bot]" <90344106+pydoc-zh-tw[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 02:40:43 +0800 Subject: [PATCH 49/89] Sync with CPython 3.13 (#990) --- c-api/allocation.po | 30 +- c-api/arg.po | 2 +- c-api/init.po | 710 +++++------ c-api/init_config.po | 14 +- c-api/long.po | 4 +- c-api/monitoring.po | 8 +- c-api/typeobj.po | 892 +++++++------- deprecations/c-api-pending-removal-in-3.15.po | 18 +- deprecations/index.po | 223 ++-- deprecations/pending-removal-in-3.14.po | 103 +- deprecations/pending-removal-in-3.15.po | 26 +- deprecations/pending-removal-in-3.16.po | 70 +- glossary.po | 744 ++++++------ howto/enum.po | 4 +- howto/free-threading-python.po | 6 +- howto/functional.po | 6 +- howto/logging-cookbook.po | 609 +++++----- howto/regex.po | 4 +- howto/sockets.po | 2 +- howto/timerfd.po | 4 +- library/argparse.po | 1033 ++++++----------- library/builtins.po | 50 +- library/cmath.po | 85 +- library/codecs.po | 7 +- library/concurrent.futures.po | 4 +- library/configparser.po | 231 ++-- library/contextvars.po | 124 +- library/ctypes.po | 458 ++++---- library/dis.po | 8 +- library/email.message.po | 2 +- library/enum.po | 4 +- library/functions.po | 680 +++++------ library/getopt.po | 100 +- library/glob.po | 11 +- library/importlib.metadata.po | 15 +- library/ipaddress.po | 8 +- library/locale.po | 176 +-- library/math.po | 836 ++++++++++--- library/os.po | 376 +++--- library/pathlib.po | 138 +-- library/pydoc.po | 32 +- library/re.po | 2 +- library/selectors.po | 2 +- library/sqlite3.po | 110 +- library/stdtypes.po | 33 +- library/string.po | 321 ++--- library/time.po | 319 ++--- library/warnings.po | 168 +-- license.po | 88 +- reference/datamodel.po | 845 +++++++------- reference/expressions.po | 4 +- tutorial/controlflow.po | 385 +++--- tutorial/datastructures.po | 20 +- tutorial/errors.po | 18 +- tutorial/inputoutput.po | 208 ++-- using/configure.po | 4 +- using/ios.po | 9 +- using/mac.po | 2 +- using/unix.po | 18 +- using/windows.po | 8 +- whatsnew/2.2.po | 96 +- whatsnew/3.12.po | 329 ++---- whatsnew/3.13.po | 234 ++-- 63 files changed, 5866 insertions(+), 5214 deletions(-) diff --git a/c-api/allocation.po b/c-api/allocation.po index c4605012ef..2d4ce8e20a 100644 --- a/c-api/allocation.po +++ b/c-api/allocation.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -10,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-08-09 00:03+0000\n" +"POT-Creation-Date: 2024-11-06 00:13+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-" @@ -29,16 +28,13 @@ msgstr "在 heap 上分配物件" #: ../../c-api/allocation.rst:17 msgid "" "Initialize a newly allocated object *op* with its type and initial " -"reference. Returns the initialized object. If *type* indicates that the " -"object participates in the cyclic garbage detector, it is added to the " -"detector's set of observed objects. Other fields of the object are not " -"affected." +"reference. Returns the initialized object. Other fields of the object are " +"not affected." msgstr "" -"用它的型別和初始參照來初始化新分配物件 *op*。已初始化的物件會被回傳。如果 " -"*type* 表示了該物件參與迴圈垃圾檢查器,則將其新增到檢查器的觀察物件集合中。物" -"件的其他欄位不受影響。" +"用它的型別和初始參照來初始化新分配物件 *op*。已初始化的物件會被回傳。物件的其" +"他欄位不受影響。" -#: ../../c-api/allocation.rst:26 +#: ../../c-api/allocation.rst:24 msgid "" "This does everything :c:func:`PyObject_Init` does, and also initializes the " "length information for a variable-size object." @@ -46,7 +42,7 @@ msgstr "" "它會做到 :c:func:`PyObject_Init` 的所有功能,並且會初始化一個大小可變物件的長" "度資訊。" -#: ../../c-api/allocation.rst:32 +#: ../../c-api/allocation.rst:30 msgid "" "Allocate a new Python object using the C structure type *TYPE* and the " "Python type object *typeobj* (``PyTypeObject*``). Fields not defined by the " @@ -60,7 +56,7 @@ msgstr "" "化;呼叫者會擁有那個對於物件的唯一參照(物件的參照計數為一)。記憶體分配大小" "由 type 物件的 :c:member:`~PyTypeObject.tp_basicsize` 欄位來指定。" -#: ../../c-api/allocation.rst:43 +#: ../../c-api/allocation.rst:41 msgid "" "Allocate a new Python object using the C structure type *TYPE* and the " "Python type object *typeobj* (``PyTypeObject*``). Fields not defined by the " @@ -79,7 +75,7 @@ msgstr "" "於實現如 tuple 這種能夠在建立期間決定自己大小的物件是很實用的。將欄位的陣列嵌" "入到相同的記憶體分配中可以減少記憶體分配的次數,這提高了記憶體管理的效率。" -#: ../../c-api/allocation.rst:57 +#: ../../c-api/allocation.rst:55 msgid "" "Releases memory allocated to an object using :c:macro:`PyObject_New` or :c:" "macro:`PyObject_NewVar`. This is normally called from the :c:member:" @@ -92,7 +88,7 @@ msgstr "" "handler 中呼叫。呼叫這個函式以後,物件的各欄位都不可以被存取,因為原本分配的" "記憶體已不再是一個有效的 Python 物件。" -#: ../../c-api/allocation.rst:66 +#: ../../c-api/allocation.rst:64 msgid "" "Object which is visible in Python as ``None``. This should only be accessed " "using the :c:macro:`Py_None` macro, which evaluates to a pointer to this " @@ -101,10 +97,10 @@ msgstr "" "這個物件像是 Python 中的 ``None``。它只應該透過 :c:macro:`Py_None` 巨集來存" "取,該巨集的拿到指向該物件的指標。" -#: ../../c-api/allocation.rst:73 +#: ../../c-api/allocation.rst:71 msgid ":c:func:`PyModule_Create`" msgstr ":c:func:`PyModule_Create`" -#: ../../c-api/allocation.rst:74 +#: ../../c-api/allocation.rst:72 msgid "To allocate and create extension modules." msgstr "分配記憶體和建立擴充模組。" diff --git a/c-api/arg.po b/c-api/arg.po index f62175c411..6e8339452f 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -820,7 +820,7 @@ msgstr "" #: ../../c-api/arg.rst:465 msgid "Example::" -msgstr "" +msgstr "舉例來說: ::" #: ../../c-api/arg.rst:467 msgid "" diff --git a/c-api/init.po b/c-api/init.po index 4dbcd74843..1577394625 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -839,8 +839,8 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:587 ../../c-api/init.rst:826 ../../c-api/init.rst:862 -#: ../../c-api/init.rst:888 +#: ../../c-api/init.rst:587 ../../c-api/init.rst:829 ../../c-api/init.rst:865 +#: ../../c-api/init.rst:891 msgid "" "Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" "`wchar_*` string." @@ -853,19 +853,19 @@ msgid "" "not modify its value." msgstr "" -#: ../../c-api/init.rst:599 ../../c-api/init.rst:621 ../../c-api/init.rst:665 -#: ../../c-api/init.rst:686 ../../c-api/init.rst:712 ../../c-api/init.rst:900 +#: ../../c-api/init.rst:599 ../../c-api/init.rst:621 ../../c-api/init.rst:667 +#: ../../c-api/init.rst:689 ../../c-api/init.rst:715 ../../c-api/init.rst:903 msgid "" "This function should not be called before :c:func:`Py_Initialize`, otherwise " "it returns ``NULL``." msgstr "此函式不應該在 :c:func:`Py_Initialize` 之前呼叫,否則會回傳 ``NULL``。" -#: ../../c-api/init.rst:602 ../../c-api/init.rst:624 ../../c-api/init.rst:668 -#: ../../c-api/init.rst:689 ../../c-api/init.rst:717 ../../c-api/init.rst:903 +#: ../../c-api/init.rst:602 ../../c-api/init.rst:624 ../../c-api/init.rst:670 +#: ../../c-api/init.rst:692 ../../c-api/init.rst:720 ../../c-api/init.rst:906 msgid "It now returns ``NULL`` if called before :c:func:`Py_Initialize`." msgstr "如果在 :c:func:`Py_Initialize` 之前呼叫,現在會回傳 ``NULL``。" -#: ../../c-api/init.rst:605 ../../c-api/init.rst:692 +#: ../../c-api/init.rst:605 ../../c-api/init.rst:695 msgid "Get :data:`sys.executable` instead." msgstr "" @@ -879,15 +879,17 @@ msgid "" "should not modify its value. This corresponds to the :makevar:`prefix` " "variable in the top-level :file:`Makefile` and the :option:`--prefix` " "argument to the :program:`configure` script at build time. The value is " -"available to Python code as ``sys.prefix``. It is only useful on Unix. See " -"also the next function." +"available to Python code as ``sys.base_prefix``. It is only useful on Unix. " +"See also the next function." msgstr "" #: ../../c-api/init.rst:627 -msgid "Get :data:`sys.prefix` instead." +msgid "" +"Get :data:`sys.base_prefix` instead, or :data:`sys.prefix` if :ref:`virtual " +"environments ` need to be handled." msgstr "" -#: ../../c-api/init.rst:633 +#: ../../c-api/init.rst:634 msgid "" "Return the *exec-prefix* for installed platform-*dependent* files. This is " "derived through a number of complicated rules from the program name set " @@ -897,11 +899,11 @@ msgid "" "caller should not modify its value. This corresponds to the :makevar:" "`exec_prefix` variable in the top-level :file:`Makefile` and the ``--exec-" "prefix`` argument to the :program:`configure` script at build time. The " -"value is available to Python code as ``sys.exec_prefix``. It is only useful " -"on Unix." +"value is available to Python code as ``sys.base_exec_prefix``. It is only " +"useful on Unix." msgstr "" -#: ../../c-api/init.rst:643 +#: ../../c-api/init.rst:645 msgid "" "Background: The exec-prefix differs from the prefix when platform dependent " "files (such as executables and shared libraries) are installed in a " @@ -910,7 +912,7 @@ msgid "" "independent may be installed in :file:`/usr/local`." msgstr "" -#: ../../c-api/init.rst:649 +#: ../../c-api/init.rst:651 msgid "" "Generally speaking, a platform is a combination of hardware and software " "families, e.g. Sparc machines running the Solaris 2.x operating system are " @@ -924,7 +926,7 @@ msgid "" "independent from the Python version by which they were compiled!)." msgstr "" -#: ../../c-api/init.rst:660 +#: ../../c-api/init.rst:662 msgid "" "System administrators will know how to configure the :program:`mount` or :" "program:`automount` programs to share :file:`/usr/local` between platforms " @@ -932,11 +934,13 @@ msgid "" "platform." msgstr "" -#: ../../c-api/init.rst:671 -msgid "Get :data:`sys.exec_prefix` instead." +#: ../../c-api/init.rst:673 +msgid "" +"Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` if :ref:" +"`virtual environments ` need to be handled." msgstr "" -#: ../../c-api/init.rst:680 +#: ../../c-api/init.rst:683 msgid "" "Return the full program name of the Python executable; this is computed as " "a side-effect of deriving the default module search path from the program " @@ -945,7 +949,7 @@ msgid "" "available to Python code as ``sys.executable``." msgstr "" -#: ../../c-api/init.rst:702 +#: ../../c-api/init.rst:705 msgid "" "Return the default module search path; this is computed from the program " "name (set by :c:member:`PyConfig.program_name`) and some environment " @@ -958,21 +962,21 @@ msgid "" "for loading modules." msgstr "" -#: ../../c-api/init.rst:720 +#: ../../c-api/init.rst:723 msgid "Get :data:`sys.path` instead." msgstr "" -#: ../../c-api/init.rst:726 +#: ../../c-api/init.rst:729 msgid "" "Return the version of this Python interpreter. This is a string that looks " "something like ::" msgstr "" -#: ../../c-api/init.rst:729 +#: ../../c-api/init.rst:732 msgid "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" msgstr "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" -#: ../../c-api/init.rst:733 +#: ../../c-api/init.rst:736 msgid "" "The first word (up to the first space character) is the current Python " "version; the first characters are the major and minor version separated by a " @@ -981,11 +985,11 @@ msgid "" "version`." msgstr "" -#: ../../c-api/init.rst:738 +#: ../../c-api/init.rst:741 msgid "See also the :c:var:`Py_Version` constant." msgstr "" -#: ../../c-api/init.rst:745 +#: ../../c-api/init.rst:748 msgid "" "Return the platform identifier for the current platform. On Unix, this is " "formed from the \"official\" name of the operating system, converted to " @@ -996,50 +1000,50 @@ msgid "" "available to Python code as ``sys.platform``." msgstr "" -#: ../../c-api/init.rst:756 +#: ../../c-api/init.rst:759 msgid "" "Return the official copyright string for the current Python version, for " "example" msgstr "" -#: ../../c-api/init.rst:758 +#: ../../c-api/init.rst:761 msgid "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" msgstr "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" -#: ../../c-api/init.rst:762 +#: ../../c-api/init.rst:765 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as ``sys.copyright``." msgstr "" -#: ../../c-api/init.rst:768 +#: ../../c-api/init.rst:771 msgid "" "Return an indication of the compiler used to build the current Python " "version, in square brackets, for example::" msgstr "" -#: ../../c-api/init.rst:771 +#: ../../c-api/init.rst:774 msgid "\"[GCC 2.7.2.2]\"" msgstr "\"[GCC 2.7.2.2]\"" -#: ../../c-api/init.rst:775 ../../c-api/init.rst:789 +#: ../../c-api/init.rst:778 ../../c-api/init.rst:792 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as part of the variable " "``sys.version``." msgstr "" -#: ../../c-api/init.rst:782 +#: ../../c-api/init.rst:785 msgid "" "Return information about the sequence number and build date and time of the " "current Python interpreter instance, for example ::" msgstr "" -#: ../../c-api/init.rst:785 +#: ../../c-api/init.rst:788 msgid "\"#67, Aug 1 1997, 22:34:28\"" msgstr "\"#67, Aug 1 1997, 22:34:28\"" -#: ../../c-api/init.rst:801 +#: ../../c-api/init.rst:804 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` " @@ -1047,7 +1051,7 @@ msgid "" "config>`." msgstr "" -#: ../../c-api/init.rst:806 +#: ../../c-api/init.rst:809 msgid "" "Set :data:`sys.argv` based on *argc* and *argv*. These parameters are " "similar to those passed to the program's :c:func:`main` function with the " @@ -1058,84 +1062,84 @@ msgid "" "fatal condition is signalled using :c:func:`Py_FatalError`." msgstr "" -#: ../../c-api/init.rst:814 +#: ../../c-api/init.rst:817 msgid "" "If *updatepath* is zero, this is all the function does. If *updatepath* is " "non-zero, the function also modifies :data:`sys.path` according to the " "following algorithm:" msgstr "" -#: ../../c-api/init.rst:818 +#: ../../c-api/init.rst:821 msgid "" "If the name of an existing script is passed in ``argv[0]``, the absolute " "path of the directory where the script is located is prepended to :data:`sys." "path`." msgstr "" -#: ../../c-api/init.rst:821 +#: ../../c-api/init.rst:824 msgid "" "Otherwise (that is, if *argc* is ``0`` or ``argv[0]`` doesn't point to an " "existing file name), an empty string is prepended to :data:`sys.path`, which " "is the same as prepending the current working directory (``\".\"``)." msgstr "" -#: ../../c-api/init.rst:829 ../../c-api/init.rst:865 +#: ../../c-api/init.rst:832 ../../c-api/init.rst:868 msgid "" "See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv` " "members of the :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:833 +#: ../../c-api/init.rst:836 msgid "" "It is recommended that applications embedding the Python interpreter for " "purposes other than executing a single script pass ``0`` as *updatepath*, " "and update :data:`sys.path` themselves if desired. See :cve:`2008-5983`." msgstr "" -#: ../../c-api/init.rst:838 +#: ../../c-api/init.rst:841 msgid "" "On versions before 3.1.3, you can achieve the same effect by manually " "popping the first :data:`sys.path` element after having called :c:func:" "`PySys_SetArgv`, for example using::" msgstr "" -#: ../../c-api/init.rst:842 +#: ../../c-api/init.rst:845 msgid "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" msgstr "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" -#: ../../c-api/init.rst:854 +#: ../../c-api/init.rst:857 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv` and :c:member:`PyConfig.parse_argv` should be used instead, see :ref:" "`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:858 +#: ../../c-api/init.rst:861 msgid "" "This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to " "``1`` unless the :program:`python` interpreter was started with the :option:" "`-I`." msgstr "" -#: ../../c-api/init.rst:868 +#: ../../c-api/init.rst:871 msgid "The *updatepath* value depends on :option:`-I`." msgstr "" -#: ../../c-api/init.rst:875 +#: ../../c-api/init.rst:878 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "home` should be used instead, see :ref:`Python Initialization Configuration " "`." msgstr "" -#: ../../c-api/init.rst:879 +#: ../../c-api/init.rst:882 msgid "" "Set the default \"home\" directory, that is, the location of the standard " "Python libraries. See :envvar:`PYTHONHOME` for the meaning of the argument " "string." msgstr "" -#: ../../c-api/init.rst:883 +#: ../../c-api/init.rst:886 msgid "" "The argument should point to a zero-terminated character string in static " "storage whose contents will not change for the duration of the program's " @@ -1143,24 +1147,24 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:896 +#: ../../c-api/init.rst:899 msgid "" "Return the default \"home\", that is, the value set by :c:member:`PyConfig." "home`, or the value of the :envvar:`PYTHONHOME` environment variable if it " "is set." msgstr "" -#: ../../c-api/init.rst:906 +#: ../../c-api/init.rst:909 msgid "" "Get :c:member:`PyConfig.home` or :envvar:`PYTHONHOME` environment variable " "instead." msgstr "改為取得 :c:member:`PyConfig.home` 或 :envvar:`PYTHONHOME` 環境變數。" -#: ../../c-api/init.rst:914 +#: ../../c-api/init.rst:917 msgid "Thread State and the Global Interpreter Lock" msgstr "" -#: ../../c-api/init.rst:921 +#: ../../c-api/init.rst:924 msgid "" "The Python interpreter is not fully thread-safe. In order to support multi-" "threaded Python programs, there's a global lock, called the :term:`global " @@ -1172,7 +1176,7 @@ msgid "" "once instead of twice." msgstr "" -#: ../../c-api/init.rst:931 +#: ../../c-api/init.rst:934 msgid "" "Therefore, the rule exists that only the thread that has acquired the :term:" "`GIL` may operate on Python objects or call Python/C API functions. In order " @@ -1182,7 +1186,7 @@ msgid "" "a file, so that other Python threads can run in the meantime." msgstr "" -#: ../../c-api/init.rst:941 +#: ../../c-api/init.rst:944 msgid "" "The Python interpreter keeps some thread-specific bookkeeping information " "inside a data structure called :c:type:`PyThreadState`. There's also one " @@ -1190,17 +1194,17 @@ msgid "" "retrieved using :c:func:`PyThreadState_Get`." msgstr "" -#: ../../c-api/init.rst:947 +#: ../../c-api/init.rst:950 msgid "Releasing the GIL from extension code" msgstr "" -#: ../../c-api/init.rst:949 +#: ../../c-api/init.rst:952 msgid "" "Most extension code manipulating the :term:`GIL` has the following simple " "structure::" msgstr "" -#: ../../c-api/init.rst:952 +#: ../../c-api/init.rst:955 msgid "" "Save the thread state in a local variable.\n" "Release the global interpreter lock.\n" @@ -1209,29 +1213,29 @@ msgid "" "Restore the thread state from the local variable." msgstr "" -#: ../../c-api/init.rst:958 +#: ../../c-api/init.rst:961 msgid "This is so common that a pair of macros exists to simplify it::" msgstr "" -#: ../../c-api/init.rst:960 +#: ../../c-api/init.rst:963 msgid "" "Py_BEGIN_ALLOW_THREADS\n" "... Do some blocking I/O operation ...\n" "Py_END_ALLOW_THREADS" msgstr "" -#: ../../c-api/init.rst:968 +#: ../../c-api/init.rst:971 msgid "" "The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a " "hidden local variable; the :c:macro:`Py_END_ALLOW_THREADS` macro closes the " "block." msgstr "" -#: ../../c-api/init.rst:972 +#: ../../c-api/init.rst:975 msgid "The block above expands to the following code::" msgstr "" -#: ../../c-api/init.rst:974 +#: ../../c-api/init.rst:977 msgid "" "PyThreadState *_save;\n" "\n" @@ -1240,7 +1244,7 @@ msgid "" "PyEval_RestoreThread(_save);" msgstr "" -#: ../../c-api/init.rst:984 +#: ../../c-api/init.rst:987 msgid "" "Here is how these functions work: the global interpreter lock is used to " "protect the pointer to the current thread state. When releasing the lock " @@ -1251,7 +1255,7 @@ msgid "" "state, the lock must be acquired before storing the thread state pointer." msgstr "" -#: ../../c-api/init.rst:993 +#: ../../c-api/init.rst:996 msgid "" "Calling system I/O functions is the most common use case for releasing the " "GIL, but it can also be useful before calling long-running computations " @@ -1261,11 +1265,11 @@ msgid "" "compressing or hashing data." msgstr "" -#: ../../c-api/init.rst:1004 +#: ../../c-api/init.rst:1007 msgid "Non-Python created threads" msgstr "" -#: ../../c-api/init.rst:1006 +#: ../../c-api/init.rst:1009 msgid "" "When threads are created using the dedicated Python APIs (such as the :mod:" "`threading` module), a thread state is automatically associated to them and " @@ -1275,7 +1279,7 @@ msgid "" "for them." msgstr "" -#: ../../c-api/init.rst:1013 +#: ../../c-api/init.rst:1016 msgid "" "If you need to call Python code from these threads (often this will be part " "of a callback API provided by the aforementioned third-party library), you " @@ -1286,14 +1290,14 @@ msgid "" "finally free the thread state data structure." msgstr "" -#: ../../c-api/init.rst:1021 +#: ../../c-api/init.rst:1024 msgid "" "The :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` functions " "do all of the above automatically. The typical idiom for calling into " "Python from a C thread is::" msgstr "" -#: ../../c-api/init.rst:1025 +#: ../../c-api/init.rst:1028 msgid "" "PyGILState_STATE gstate;\n" "gstate = PyGILState_Ensure();\n" @@ -1306,7 +1310,7 @@ msgid "" "PyGILState_Release(gstate);" msgstr "" -#: ../../c-api/init.rst:1035 +#: ../../c-api/init.rst:1038 msgid "" "Note that the ``PyGILState_*`` functions assume there is only one global " "interpreter (created automatically by :c:func:`Py_Initialize`). Python " @@ -1315,11 +1319,11 @@ msgid "" "``PyGILState_*`` API is unsupported." msgstr "" -#: ../../c-api/init.rst:1045 +#: ../../c-api/init.rst:1048 msgid "Cautions about fork()" msgstr "" -#: ../../c-api/init.rst:1047 +#: ../../c-api/init.rst:1050 msgid "" "Another important thing to note about threads is their behaviour in the face " "of the C :c:func:`fork` call. On most systems with :c:func:`fork`, after a " @@ -1328,7 +1332,7 @@ msgid "" "CPython's runtime." msgstr "" -#: ../../c-api/init.rst:1053 +#: ../../c-api/init.rst:1056 msgid "" "The fact that only the \"current\" thread remains means any locks held by " "other threads will never be released. Python solves this for :func:`os.fork` " @@ -1345,7 +1349,7 @@ msgid "" "locks, but is not always able to." msgstr "" -#: ../../c-api/init.rst:1068 +#: ../../c-api/init.rst:1071 msgid "" "The fact that all other threads go away also means that CPython's runtime " "state there must be cleaned up properly, which :func:`os.fork` does. This " @@ -1358,17 +1362,17 @@ msgid "" "called immediately after." msgstr "" -#: ../../c-api/init.rst:1081 +#: ../../c-api/init.rst:1084 msgid "High-level API" msgstr "高階 API" -#: ../../c-api/init.rst:1083 +#: ../../c-api/init.rst:1086 msgid "" "These are the most commonly used types and functions when writing C " "extension code, or when embedding the Python interpreter:" msgstr "" -#: ../../c-api/init.rst:1088 +#: ../../c-api/init.rst:1091 msgid "" "This data structure represents the state shared by a number of cooperating " "threads. Threads belonging to the same interpreter share their module " @@ -1376,7 +1380,7 @@ msgid "" "in this structure." msgstr "" -#: ../../c-api/init.rst:1093 +#: ../../c-api/init.rst:1096 msgid "" "Threads belonging to different interpreters initially share nothing, except " "process state like available memory, open file descriptors and such. The " @@ -1384,41 +1388,41 @@ msgid "" "which interpreter they belong." msgstr "" -#: ../../c-api/init.rst:1101 +#: ../../c-api/init.rst:1104 msgid "" "This data structure represents the state of a single thread. The only " "public data member is:" msgstr "" -#: ../../c-api/init.rst:1106 +#: ../../c-api/init.rst:1109 msgid "This thread's interpreter state." msgstr "" -#: ../../c-api/init.rst:1117 +#: ../../c-api/init.rst:1120 msgid "Deprecated function which does nothing." msgstr "" -#: ../../c-api/init.rst:1119 +#: ../../c-api/init.rst:1122 msgid "" "In Python 3.6 and older, this function created the GIL if it didn't exist." msgstr "" -#: ../../c-api/init.rst:1121 +#: ../../c-api/init.rst:1124 msgid "The function now does nothing." msgstr "此函式現在不會做任何事情。" -#: ../../c-api/init.rst:1124 +#: ../../c-api/init.rst:1127 msgid "" "This function is now called by :c:func:`Py_Initialize()`, so you don't have " "to call it yourself anymore." msgstr "" -#: ../../c-api/init.rst:1128 +#: ../../c-api/init.rst:1131 msgid "" "This function cannot be called before :c:func:`Py_Initialize()` anymore." msgstr "" -#: ../../c-api/init.rst:1138 +#: ../../c-api/init.rst:1141 msgid "" "Release the global interpreter lock (if it has been created) and reset the " "thread state to ``NULL``, returning the previous thread state (which is not " @@ -1426,7 +1430,7 @@ msgid "" "acquired it." msgstr "" -#: ../../c-api/init.rst:1146 +#: ../../c-api/init.rst:1149 msgid "" "Acquire the global interpreter lock (if it has been created) and set the " "thread state to *tstate*, which must not be ``NULL``. If the lock has been " @@ -1434,8 +1438,8 @@ msgid "" "ensues." msgstr "" -#: ../../c-api/init.rst:1152 ../../c-api/init.rst:1211 -#: ../../c-api/init.rst:1493 +#: ../../c-api/init.rst:1155 ../../c-api/init.rst:1214 +#: ../../c-api/init.rst:1496 msgid "" "Calling this function from a thread when the runtime is finalizing will " "terminate the thread, even if the thread was not created by Python. You can " @@ -1444,44 +1448,44 @@ msgid "" "avoid unwanted termination." msgstr "" -#: ../../c-api/init.rst:1160 +#: ../../c-api/init.rst:1163 msgid "" "Return the current thread state. The global interpreter lock must be held. " "When the current thread state is ``NULL``, this issues a fatal error (so " "that the caller needn't check for ``NULL``)." msgstr "" -#: ../../c-api/init.rst:1164 +#: ../../c-api/init.rst:1167 msgid "See also :c:func:`PyThreadState_GetUnchecked`." msgstr "也請見 :c:func:`PyThreadState_GetUnchecked`。" -#: ../../c-api/init.rst:1169 +#: ../../c-api/init.rst:1172 msgid "" "Similar to :c:func:`PyThreadState_Get`, but don't kill the process with a " "fatal error if it is NULL. The caller is responsible to check if the result " "is NULL." msgstr "" -#: ../../c-api/init.rst:1173 +#: ../../c-api/init.rst:1176 msgid "" "In Python 3.5 to 3.12, the function was private and known as " "``_PyThreadState_UncheckedGet()``." msgstr "" -#: ../../c-api/init.rst:1180 +#: ../../c-api/init.rst:1183 msgid "" "Swap the current thread state with the thread state given by the argument " "*tstate*, which may be ``NULL``. The global interpreter lock must be held " "and is not released." msgstr "" -#: ../../c-api/init.rst:1185 +#: ../../c-api/init.rst:1188 msgid "" "The following functions use thread-local storage, and are not compatible " "with sub-interpreters:" msgstr "" -#: ../../c-api/init.rst:1190 +#: ../../c-api/init.rst:1193 msgid "" "Ensure that the current thread is ready to call the Python C API regardless " "of the current state of Python, or of the global interpreter lock. This may " @@ -1494,7 +1498,7 @@ msgid "" "is acceptable." msgstr "" -#: ../../c-api/init.rst:1200 +#: ../../c-api/init.rst:1203 msgid "" "The return value is an opaque \"handle\" to the thread state when :c:func:" "`PyGILState_Ensure` was called, and must be passed to :c:func:" @@ -1504,13 +1508,13 @@ msgid "" "func:`PyGILState_Release`." msgstr "" -#: ../../c-api/init.rst:1207 +#: ../../c-api/init.rst:1210 msgid "" "When the function returns, the current thread will hold the GIL and be able " "to call arbitrary Python code. Failure is a fatal error." msgstr "" -#: ../../c-api/init.rst:1219 +#: ../../c-api/init.rst:1222 msgid "" "Release any resources previously acquired. After this call, Python's state " "will be the same as it was prior to the corresponding :c:func:" @@ -1518,13 +1522,13 @@ msgid "" "caller, hence the use of the GILState API)." msgstr "" -#: ../../c-api/init.rst:1224 +#: ../../c-api/init.rst:1227 msgid "" "Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:" "func:`PyGILState_Release` on the same thread." msgstr "" -#: ../../c-api/init.rst:1230 +#: ../../c-api/init.rst:1233 msgid "" "Get the current thread state for this thread. May return ``NULL`` if no " "GILState API has been used on the current thread. Note that the main thread " @@ -1532,7 +1536,7 @@ msgid "" "made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -#: ../../c-api/init.rst:1238 +#: ../../c-api/init.rst:1241 msgid "" "Return ``1`` if the current thread is holding the GIL and ``0`` otherwise. " "This function can be called from any thread at any time. Only if it has had " @@ -1543,13 +1547,13 @@ msgid "" "otherwise behave differently." msgstr "" -#: ../../c-api/init.rst:1250 +#: ../../c-api/init.rst:1253 msgid "" "The following macros are normally used without a trailing semicolon; look " "for example usage in the Python source distribution." msgstr "" -#: ../../c-api/init.rst:1256 +#: ../../c-api/init.rst:1259 msgid "" "This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" "``. Note that it contains an opening brace; it must be matched with a " @@ -1557,7 +1561,7 @@ msgid "" "discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1264 +#: ../../c-api/init.rst:1267 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " "contains a closing brace; it must be matched with an earlier :c:macro:" @@ -1565,40 +1569,40 @@ msgid "" "macro." msgstr "" -#: ../../c-api/init.rst:1272 +#: ../../c-api/init.rst:1275 msgid "" "This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :" "c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" -#: ../../c-api/init.rst:1278 +#: ../../c-api/init.rst:1281 msgid "" "This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :" "c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " "declaration." msgstr "" -#: ../../c-api/init.rst:1284 +#: ../../c-api/init.rst:1287 msgid "Low-level API" msgstr "低階 API" -#: ../../c-api/init.rst:1286 +#: ../../c-api/init.rst:1289 msgid "" "All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:1288 +#: ../../c-api/init.rst:1291 msgid ":c:func:`Py_Initialize()` now initializes the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:1294 +#: ../../c-api/init.rst:1297 msgid "" "Create a new interpreter state object. The global interpreter lock need not " "be held, but may be held if it is necessary to serialize calls to this " "function." msgstr "" -#: ../../c-api/init.rst:1298 +#: ../../c-api/init.rst:1301 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_New`` with no arguments." @@ -1606,13 +1610,13 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_New``。" -#: ../../c-api/init.rst:1303 +#: ../../c-api/init.rst:1306 msgid "" "Reset all information in an interpreter state object. The global " "interpreter lock must be held." msgstr "" -#: ../../c-api/init.rst:1306 +#: ../../c-api/init.rst:1309 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_Clear`` with no arguments." @@ -1620,40 +1624,40 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_Clear``。" -#: ../../c-api/init.rst:1311 +#: ../../c-api/init.rst:1314 msgid "" "Destroy an interpreter state object. The global interpreter lock need not " "be held. The interpreter state must have been reset with a previous call " "to :c:func:`PyInterpreterState_Clear`." msgstr "" -#: ../../c-api/init.rst:1318 +#: ../../c-api/init.rst:1321 msgid "" "Create a new thread state object belonging to the given interpreter object. " "The global interpreter lock need not be held, but may be held if it is " "necessary to serialize calls to this function." msgstr "" -#: ../../c-api/init.rst:1325 +#: ../../c-api/init.rst:1328 msgid "" "Reset all information in a thread state object. The global interpreter lock " "must be held." msgstr "" -#: ../../c-api/init.rst:1328 +#: ../../c-api/init.rst:1331 msgid "" "This function now calls the :c:member:`PyThreadState.on_delete` callback. " "Previously, that happened in :c:func:`PyThreadState_Delete`." msgstr "" -#: ../../c-api/init.rst:1335 +#: ../../c-api/init.rst:1338 msgid "" "Destroy a thread state object. The global interpreter lock need not be " "held. The thread state must have been reset with a previous call to :c:func:" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1342 +#: ../../c-api/init.rst:1345 msgid "" "Destroy the current thread state and release the global interpreter lock. " "Like :c:func:`PyThreadState_Delete`, the global interpreter lock must be " @@ -1661,119 +1665,119 @@ msgid "" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1350 +#: ../../c-api/init.rst:1353 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1352 +#: ../../c-api/init.rst:1355 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: ../../c-api/init.rst:1355 +#: ../../c-api/init.rst:1358 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "也請見 :c:func:`PyEval_GetFrame`。" -#: ../../c-api/init.rst:1357 ../../c-api/init.rst:1366 -#: ../../c-api/init.rst:1375 +#: ../../c-api/init.rst:1360 ../../c-api/init.rst:1369 +#: ../../c-api/init.rst:1378 msgid "*tstate* must not be ``NULL``." msgstr "*tstate* 不可為 ``NULL``。" -#: ../../c-api/init.rst:1364 +#: ../../c-api/init.rst:1367 msgid "" "Get the unique thread state identifier of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1373 +#: ../../c-api/init.rst:1376 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1382 +#: ../../c-api/init.rst:1385 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1384 +#: ../../c-api/init.rst:1387 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -#: ../../c-api/init.rst:1391 +#: ../../c-api/init.rst:1394 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -#: ../../c-api/init.rst:1394 +#: ../../c-api/init.rst:1397 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -#: ../../c-api/init.rst:1402 +#: ../../c-api/init.rst:1405 msgid "Get the current interpreter." msgstr "" -#: ../../c-api/init.rst:1404 +#: ../../c-api/init.rst:1407 msgid "" "Issue a fatal error if there no current Python thread state or no current " "interpreter. It cannot return NULL." msgstr "" -#: ../../c-api/init.rst:1407 ../../c-api/init.rst:1417 +#: ../../c-api/init.rst:1410 ../../c-api/init.rst:1420 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/init.rst:1414 +#: ../../c-api/init.rst:1417 msgid "" "Return the interpreter's unique ID. If there was any error in doing so then " "``-1`` is returned and an error is set." msgstr "" -#: ../../c-api/init.rst:1424 +#: ../../c-api/init.rst:1427 msgid "" "Return a dictionary in which interpreter-specific data may be stored. If " "this function returns ``NULL`` then no exception has been raised and the " "caller should assume no interpreter-specific dict is available." msgstr "" -#: ../../c-api/init.rst:1428 +#: ../../c-api/init.rst:1431 msgid "" "This is not a replacement for :c:func:`PyModule_GetState()`, which " "extensions should use to store interpreter-specific state information." msgstr "" -#: ../../c-api/init.rst:1435 +#: ../../c-api/init.rst:1438 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1437 +#: ../../c-api/init.rst:1440 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1440 +#: ../../c-api/init.rst:1443 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1443 +#: ../../c-api/init.rst:1446 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: ../../c-api/init.rst:1448 +#: ../../c-api/init.rst:1451 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1450 ../../c-api/init.rst:1458 +#: ../../c-api/init.rst:1453 ../../c-api/init.rst:1461 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1456 +#: ../../c-api/init.rst:1459 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1465 +#: ../../c-api/init.rst:1468 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " @@ -1782,7 +1786,7 @@ msgid "" "raised and the caller should assume no current thread state is available." msgstr "" -#: ../../c-api/init.rst:1474 +#: ../../c-api/init.rst:1477 msgid "" "Asynchronously raise an exception in a thread. The *id* argument is the " "thread id of the target thread; *exc* is the exception object to be raised. " @@ -1794,33 +1798,33 @@ msgid "" "raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1482 +#: ../../c-api/init.rst:1485 msgid "" "The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" "`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1488 +#: ../../c-api/init.rst:1491 msgid "" "Acquire the global interpreter lock and set the current thread state to " "*tstate*, which must not be ``NULL``. The lock must have been created " "earlier. If this thread already has the lock, deadlock ensues." msgstr "" -#: ../../c-api/init.rst:1499 +#: ../../c-api/init.rst:1502 msgid "" "Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" "`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " "current thread if called while the interpreter is finalizing." msgstr "" -#: ../../c-api/init.rst:1504 +#: ../../c-api/init.rst:1507 msgid "" ":c:func:`PyEval_RestoreThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1510 +#: ../../c-api/init.rst:1513 msgid "" "Reset the current thread state to ``NULL`` and release the global " "interpreter lock. The lock must have been created earlier and must be held " @@ -1829,17 +1833,17 @@ msgid "" "isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1516 +#: ../../c-api/init.rst:1519 msgid "" ":c:func:`PyEval_SaveThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1523 +#: ../../c-api/init.rst:1526 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1525 +#: ../../c-api/init.rst:1528 msgid "" "While in most uses, you will only embed a single Python interpreter, there " "are cases where you need to create several independent interpreters in the " @@ -1847,7 +1851,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1530 +#: ../../c-api/init.rst:1533 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -1858,31 +1862,31 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1537 +#: ../../c-api/init.rst:1540 msgid "" "You can switch between sub-interpreters using the :c:func:" "`PyThreadState_Swap` function. You can create and destroy them using the " "following functions:" msgstr "" -#: ../../c-api/init.rst:1543 +#: ../../c-api/init.rst:1546 msgid "" "Structure containing most parameters to configure a sub-interpreter. Its " "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " "modified by the runtime." msgstr "" -#: ../../c-api/init.rst:1549 +#: ../../c-api/init.rst:1552 msgid "Structure fields:" msgstr "" -#: ../../c-api/init.rst:1553 +#: ../../c-api/init.rst:1556 msgid "" "If this is ``0`` then the sub-interpreter will use its own \"object\" " "allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" -#: ../../c-api/init.rst:1557 +#: ../../c-api/init.rst:1560 msgid "" "If this is ``0`` then :c:member:`~PyInterpreterConfig." "check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " @@ -1890,44 +1894,44 @@ msgid "" "`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: ../../c-api/init.rst:1565 +#: ../../c-api/init.rst:1568 msgid "" "If this is ``0`` then the runtime will not support forking the process in " "any thread where the sub-interpreter is currently active. Otherwise fork is " "unrestricted." msgstr "" -#: ../../c-api/init.rst:1569 +#: ../../c-api/init.rst:1572 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: ../../c-api/init.rst:1574 +#: ../../c-api/init.rst:1577 msgid "" "If this is ``0`` then the runtime will not support replacing the current " "process via exec (e.g. :func:`os.execv`) in any thread where the sub-" "interpreter is currently active. Otherwise exec is unrestricted." msgstr "" -#: ../../c-api/init.rst:1579 +#: ../../c-api/init.rst:1582 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: ../../c-api/init.rst:1584 +#: ../../c-api/init.rst:1587 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create threads. Otherwise threads are allowed." msgstr "" -#: ../../c-api/init.rst:1590 +#: ../../c-api/init.rst:1593 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create daemon threads. Otherwise daemon threads are allowed (as long as :c:" "member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" -#: ../../c-api/init.rst:1597 +#: ../../c-api/init.rst:1600 msgid "" "If this is ``0`` then all extension modules may be imported, including " "legacy (single-phase init) modules, in any thread where the sub-interpreter " @@ -1936,37 +1940,37 @@ msgid "" "`Py_mod_multiple_interpreters`.)" msgstr "" -#: ../../c-api/init.rst:1604 +#: ../../c-api/init.rst:1607 msgid "" "This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." "use_main_obmalloc` is ``0``." msgstr "" -#: ../../c-api/init.rst:1609 +#: ../../c-api/init.rst:1612 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: ../../c-api/init.rst:1616 +#: ../../c-api/init.rst:1619 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: ../../c-api/init.rst:1620 +#: ../../c-api/init.rst:1623 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: ../../c-api/init.rst:1624 +#: ../../c-api/init.rst:1627 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: ../../c-api/init.rst:1626 +#: ../../c-api/init.rst:1629 msgid "" "If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" "`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: ../../c-api/init.rst:1640 +#: ../../c-api/init.rst:1643 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " @@ -1979,13 +1983,13 @@ msgid "" "underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1650 +#: ../../c-api/init.rst:1653 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: ../../c-api/init.rst:1653 +#: ../../c-api/init.rst:1656 msgid "" "Upon success, *tstate_p* will be set to the first thread state created in " "the new sub-interpreter. This thread state is made in the current thread " @@ -1996,7 +2000,7 @@ msgid "" "state." msgstr "" -#: ../../c-api/init.rst:1662 +#: ../../c-api/init.rst:1665 msgid "" "Like all other Python/C API functions, the global interpreter lock must be " "held before calling this function and is still held when it returns. " @@ -2008,13 +2012,13 @@ msgid "" "released here." msgstr "" -#: ../../c-api/init.rst:1673 +#: ../../c-api/init.rst:1676 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: ../../c-api/init.rst:1676 +#: ../../c-api/init.rst:1679 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -2038,7 +2042,7 @@ msgstr "" "};\n" "PyThreadState *tstate = Py_NewInterpreterFromConfig(&config);" -#: ../../c-api/init.rst:1687 +#: ../../c-api/init.rst:1690 msgid "" "Note that the config is used only briefly and does not get modified. During " "initialization the config's values are converted into various :c:type:" @@ -2046,11 +2050,11 @@ msgid "" "internally on the :c:type:`PyInterpreterState`." msgstr "" -#: ../../c-api/init.rst:1696 +#: ../../c-api/init.rst:1699 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1698 +#: ../../c-api/init.rst:1701 msgid "" "For modules using multi-phase initialization, e.g. :c:func:" "`PyModule_FromDefAndSpec`, a separate module object is created and " @@ -2058,7 +2062,7 @@ msgid "" "are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1704 +#: ../../c-api/init.rst:1707 msgid "" "For modules using single-phase initialization, e.g. :c:func:" "`PyModule_Create`, the first time a particular extension is imported, it is " @@ -2070,7 +2074,7 @@ msgid "" "might cause unwanted behavior (see `Bugs and caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1715 +#: ../../c-api/init.rst:1718 msgid "" "Note that this is different from what happens when an extension is imported " "after the interpreter has been completely re-initialized by calling :c:func:" @@ -2080,7 +2084,7 @@ msgid "" "shared between these modules." msgstr "" -#: ../../c-api/init.rst:1735 +#: ../../c-api/init.rst:1738 msgid "" "Create a new sub-interpreter. This is essentially just a wrapper around :c:" "func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " @@ -2089,7 +2093,7 @@ msgid "" "single-phase init modules." msgstr "" -#: ../../c-api/init.rst:1747 +#: ../../c-api/init.rst:1750 msgid "" "Destroy the (sub-)interpreter represented by the given thread state. The " "given thread state must be the current thread state. See the discussion of " @@ -2099,17 +2103,17 @@ msgid "" "be held before calling this function. No GIL is held when it returns." msgstr "" -#: ../../c-api/init.rst:1755 +#: ../../c-api/init.rst:1758 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: ../../c-api/init.rst:1760 +#: ../../c-api/init.rst:1763 msgid "A Per-Interpreter GIL" msgstr "" -#: ../../c-api/init.rst:1762 +#: ../../c-api/init.rst:1765 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -2121,7 +2125,7 @@ msgid "" "just using threads. (See :pep:`554`.)" msgstr "" -#: ../../c-api/init.rst:1772 +#: ../../c-api/init.rst:1775 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -2135,7 +2139,7 @@ msgid "" "builtin objects." msgstr "" -#: ../../c-api/init.rst:1783 +#: ../../c-api/init.rst:1786 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -2143,7 +2147,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: ../../c-api/init.rst:1788 +#: ../../c-api/init.rst:1791 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -2153,11 +2157,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: ../../c-api/init.rst:1799 +#: ../../c-api/init.rst:1802 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1801 +#: ../../c-api/init.rst:1804 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -2170,7 +2174,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1811 +#: ../../c-api/init.rst:1814 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -2179,7 +2183,7 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1817 +#: ../../c-api/init.rst:1820 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " @@ -2191,25 +2195,25 @@ msgid "" "created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1828 +#: ../../c-api/init.rst:1831 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1830 +#: ../../c-api/init.rst:1833 msgid "" "A mechanism is provided to make asynchronous notifications to the main " "interpreter thread. These notifications take the form of a function pointer " "and a void pointer argument." msgstr "" -#: ../../c-api/init.rst:1837 +#: ../../c-api/init.rst:1840 msgid "" "Schedule a function to be called from the main interpreter thread. On " "success, ``0`` is returned and *func* is queued for being called in the main " "thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -#: ../../c-api/init.rst:1841 +#: ../../c-api/init.rst:1844 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2217,17 +2221,17 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1846 +#: ../../c-api/init.rst:1849 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1847 +#: ../../c-api/init.rst:1850 msgid "" "with the main thread holding the :term:`global interpreter lock` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1850 +#: ../../c-api/init.rst:1853 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " @@ -2235,20 +2239,20 @@ msgid "" "if the global interpreter lock is released." msgstr "" -#: ../../c-api/init.rst:1855 +#: ../../c-api/init.rst:1858 msgid "" "This function doesn't need a current thread state to run, and it doesn't " "need the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:1858 +#: ../../c-api/init.rst:1861 msgid "" "To call this function in a subinterpreter, the caller must hold the GIL. " "Otherwise, the function *func* can be scheduled to be called from the wrong " "interpreter." msgstr "" -#: ../../c-api/init.rst:1863 +#: ../../c-api/init.rst:1866 msgid "" "This is a low-level function, only useful for very special cases. There is " "no guarantee that *func* will be called as quick as possible. If the main " @@ -2258,7 +2262,7 @@ msgid "" "`PyGILState API`." msgstr "" -#: ../../c-api/init.rst:1872 +#: ../../c-api/init.rst:1875 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " @@ -2266,18 +2270,18 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:1881 +#: ../../c-api/init.rst:1884 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:1886 +#: ../../c-api/init.rst:1889 msgid "" "The Python interpreter provides some low-level support for attaching " "profiling and execution tracing facilities. These are used for profiling, " "debugging, and coverage analysis tools." msgstr "" -#: ../../c-api/init.rst:1890 +#: ../../c-api/init.rst:1893 msgid "" "This C interface allows the profiling or tracing code to avoid the overhead " "of calling through Python-level callable objects, making a direct C function " @@ -2287,7 +2291,7 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:1900 +#: ../../c-api/init.rst:1903 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " @@ -2299,66 +2303,66 @@ msgid "" "value of *what*:" msgstr "" -#: ../../c-api/init.rst:1909 +#: ../../c-api/init.rst:1912 msgid "Value of *what*" msgstr "" -#: ../../c-api/init.rst:1909 +#: ../../c-api/init.rst:1912 msgid "Meaning of *arg*" msgstr "*arg* 的含義" -#: ../../c-api/init.rst:1911 +#: ../../c-api/init.rst:1914 msgid ":c:data:`PyTrace_CALL`" msgstr ":c:data:`PyTrace_CALL`" -#: ../../c-api/init.rst:1911 ../../c-api/init.rst:1916 -#: ../../c-api/init.rst:1927 +#: ../../c-api/init.rst:1914 ../../c-api/init.rst:1919 +#: ../../c-api/init.rst:1930 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:1913 +#: ../../c-api/init.rst:1916 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr ":c:data:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:1913 +#: ../../c-api/init.rst:1916 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:1916 +#: ../../c-api/init.rst:1919 msgid ":c:data:`PyTrace_LINE`" msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:1918 +#: ../../c-api/init.rst:1921 msgid ":c:data:`PyTrace_RETURN`" msgstr ":c:data:`PyTrace_RETURN`" -#: ../../c-api/init.rst:1918 +#: ../../c-api/init.rst:1921 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:1921 +#: ../../c-api/init.rst:1924 msgid ":c:data:`PyTrace_C_CALL`" msgstr ":c:data:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:1921 ../../c-api/init.rst:1923 -#: ../../c-api/init.rst:1925 +#: ../../c-api/init.rst:1924 ../../c-api/init.rst:1926 +#: ../../c-api/init.rst:1928 msgid "Function object being called." msgstr "被呼叫的函式物件。" -#: ../../c-api/init.rst:1923 +#: ../../c-api/init.rst:1926 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:1925 +#: ../../c-api/init.rst:1928 msgid ":c:data:`PyTrace_C_RETURN`" msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:1927 +#: ../../c-api/init.rst:1930 msgid ":c:data:`PyTrace_OPCODE`" msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:1932 +#: ../../c-api/init.rst:1935 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -2367,7 +2371,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:1941 +#: ../../c-api/init.rst:1944 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "an exception has been raised. The callback function is called with this " @@ -2379,7 +2383,7 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:1952 +#: ../../c-api/init.rst:1955 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " @@ -2387,31 +2391,31 @@ msgid "" "f_trace_lines` to *0* on that frame." msgstr "" -#: ../../c-api/init.rst:1960 +#: ../../c-api/init.rst:1963 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a call is about to return." msgstr "" -#: ../../c-api/init.rst:1966 +#: ../../c-api/init.rst:1969 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function is about to be called." msgstr "" -#: ../../c-api/init.rst:1972 +#: ../../c-api/init.rst:1975 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has raised an exception." msgstr "" -#: ../../c-api/init.rst:1978 +#: ../../c-api/init.rst:1981 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:1984 +#: ../../c-api/init.rst:1987 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " @@ -2419,7 +2423,7 @@ msgid "" "attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:1992 +#: ../../c-api/init.rst:1995 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " @@ -2429,29 +2433,29 @@ msgid "" "`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:1999 +#: ../../c-api/init.rst:2002 msgid "See also the :func:`sys.setprofile` function." msgstr "" -#: ../../c-api/init.rst:2001 ../../c-api/init.rst:2008 -#: ../../c-api/init.rst:2027 ../../c-api/init.rst:2034 +#: ../../c-api/init.rst:2004 ../../c-api/init.rst:2011 +#: ../../c-api/init.rst:2030 ../../c-api/init.rst:2037 msgid "The caller must hold the :term:`GIL`." msgstr "呼叫者必須持有 :term:`GIL`。" -#: ../../c-api/init.rst:2005 +#: ../../c-api/init.rst:2008 msgid "" "Like :c:func:`PyEval_SetProfile` but sets the profile function in all " "running threads belonging to the current interpreter instead of the setting " "it only on the current thread." msgstr "" -#: ../../c-api/init.rst:2010 +#: ../../c-api/init.rst:2013 msgid "" "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " "while setting the profile functions in all threads." msgstr "" -#: ../../c-api/init.rst:2018 +#: ../../c-api/init.rst:2021 msgid "" "Set the tracing function to *func*. This is similar to :c:func:" "`PyEval_SetProfile`, except the tracing function does receive line-number " @@ -2462,28 +2466,28 @@ msgid "" "*what* parameter." msgstr "" -#: ../../c-api/init.rst:2025 +#: ../../c-api/init.rst:2028 msgid "See also the :func:`sys.settrace` function." msgstr "也請見 :func:`sys.settrace` 函式。" -#: ../../c-api/init.rst:2031 +#: ../../c-api/init.rst:2034 msgid "" "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " "threads belonging to the current interpreter instead of the setting it only " "on the current thread." msgstr "" -#: ../../c-api/init.rst:2036 +#: ../../c-api/init.rst:2039 msgid "" "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " "while setting the trace functions in all threads." msgstr "" -#: ../../c-api/init.rst:2042 +#: ../../c-api/init.rst:2045 msgid "Reference tracing" msgstr "" -#: ../../c-api/init.rst:2048 +#: ../../c-api/init.rst:2051 msgid "" "The type of the trace function registered using :c:func:" "`PyRefTracer_SetTracer`. The first parameter is a Python object that has " @@ -2493,19 +2497,19 @@ msgid "" "provided when :c:func:`PyRefTracer_SetTracer` was called." msgstr "" -#: ../../c-api/init.rst:2058 +#: ../../c-api/init.rst:2061 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been created." msgstr "" -#: ../../c-api/init.rst:2063 +#: ../../c-api/init.rst:2066 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been destroyed." msgstr "" -#: ../../c-api/init.rst:2068 +#: ../../c-api/init.rst:2071 msgid "" "Register a reference tracer function. The function will be called when a new " "Python has been created or when an object is going to be destroyed. If " @@ -2514,7 +2518,7 @@ msgid "" "return ``-1`` on error." msgstr "" -#: ../../c-api/init.rst:2074 +#: ../../c-api/init.rst:2077 msgid "" "Not that tracer functions **must not** create Python objects inside or " "otherwise the call will be re-entrant. The tracer also **must not** clear " @@ -2522,11 +2526,11 @@ msgid "" "the tracer function is called." msgstr "" -#: ../../c-api/init.rst:2079 ../../c-api/init.rst:2090 +#: ../../c-api/init.rst:2082 ../../c-api/init.rst:2093 msgid "The GIL must be held when calling this function." msgstr "" -#: ../../c-api/init.rst:2085 +#: ../../c-api/init.rst:2088 msgid "" "Get the registered reference tracer function and the value of the opaque " "data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " @@ -2534,48 +2538,48 @@ msgid "" "set the **data** pointer to NULL." msgstr "" -#: ../../c-api/init.rst:2097 +#: ../../c-api/init.rst:2100 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:2102 +#: ../../c-api/init.rst:2105 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:2107 +#: ../../c-api/init.rst:2110 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:2112 +#: ../../c-api/init.rst:2115 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:2117 +#: ../../c-api/init.rst:2120 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:2123 +#: ../../c-api/init.rst:2126 msgid "" "Return the pointer to the first :c:type:`PyThreadState` object in the list " "of threads associated with the interpreter *interp*." msgstr "" -#: ../../c-api/init.rst:2129 +#: ../../c-api/init.rst:2132 msgid "" "Return the next thread state object after *tstate* from the list of all such " "objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" -#: ../../c-api/init.rst:2136 +#: ../../c-api/init.rst:2139 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:2140 +#: ../../c-api/init.rst:2143 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2585,19 +2589,19 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:2147 +#: ../../c-api/init.rst:2150 msgid "" "The GIL does *not* need to be held when calling these functions; they supply " "their own locking." msgstr "" -#: ../../c-api/init.rst:2150 +#: ../../c-api/init.rst:2153 msgid "" "Note that :file:`Python.h` does not include the declaration of the TLS APIs, " "you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -#: ../../c-api/init.rst:2154 +#: ../../c-api/init.rst:2157 msgid "" "None of these API functions handle memory management on behalf of the :c:" "expr:`void*` values. You need to allocate and deallocate them yourself. If " @@ -2605,22 +2609,22 @@ msgid "" "don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:2162 +#: ../../c-api/init.rst:2165 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:2164 +#: ../../c-api/init.rst:2167 msgid "" "TSS API is introduced to supersede the use of the existing TLS API within " "the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` " "instead of :c:expr:`int` to represent thread keys." msgstr "" -#: ../../c-api/init.rst:2170 +#: ../../c-api/init.rst:2173 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:2175 +#: ../../c-api/init.rst:2178 msgid "" "This data structure represents the state of a thread key, the definition of " "which may depend on the underlying TLS implementation, and it has an " @@ -2628,52 +2632,52 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:2180 +#: ../../c-api/init.rst:2183 msgid "" "When :ref:`Py_LIMITED_API ` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -#: ../../c-api/init.rst:2186 +#: ../../c-api/init.rst:2189 msgid "" "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " "that this macro won't be defined with :ref:`Py_LIMITED_API `." msgstr "" -#: ../../c-api/init.rst:2191 +#: ../../c-api/init.rst:2194 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:2193 +#: ../../c-api/init.rst:2196 msgid "" "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " "built with :ref:`Py_LIMITED_API `, where static allocation of this " "type is not possible due to its implementation being opaque at build time." msgstr "" -#: ../../c-api/init.rst:2200 +#: ../../c-api/init.rst:2203 msgid "" "Return a value which is the same state as a value initialized with :c:macro:" "`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." msgstr "" -#: ../../c-api/init.rst:2207 +#: ../../c-api/init.rst:2210 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" -#: ../../c-api/init.rst:2213 +#: ../../c-api/init.rst:2216 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: ../../c-api/init.rst:2218 +#: ../../c-api/init.rst:2221 msgid "Methods" msgstr "方法" -#: ../../c-api/init.rst:2220 +#: ../../c-api/init.rst:2223 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " @@ -2681,13 +2685,13 @@ msgid "" "func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2228 +#: ../../c-api/init.rst:2231 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2234 +#: ../../c-api/init.rst:2237 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -2696,7 +2700,7 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:2243 +#: ../../c-api/init.rst:2246 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " @@ -2705,31 +2709,31 @@ msgid "" "key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:2252 +#: ../../c-api/init.rst:2255 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" -#: ../../c-api/init.rst:2259 +#: ../../c-api/init.rst:2262 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" -#: ../../c-api/init.rst:2267 +#: ../../c-api/init.rst:2270 msgid "Thread Local Storage (TLS) API" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../c-api/init.rst:2269 +#: ../../c-api/init.rst:2272 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API `." msgstr "" -#: ../../c-api/init.rst:2274 +#: ../../c-api/init.rst:2277 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -2738,62 +2742,62 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:2279 +#: ../../c-api/init.rst:2282 msgid "" "Due to the compatibility problem noted above, this version of the API should " "not be used in new code." msgstr "" -#: ../../c-api/init.rst:2290 +#: ../../c-api/init.rst:2293 msgid "Synchronization Primitives" msgstr "" -#: ../../c-api/init.rst:2292 +#: ../../c-api/init.rst:2295 msgid "The C-API provides a basic mutual exclusion lock." msgstr "" -#: ../../c-api/init.rst:2296 +#: ../../c-api/init.rst:2299 msgid "" "A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " "zero to represent the unlocked state. For example::" msgstr "" -#: ../../c-api/init.rst:2299 +#: ../../c-api/init.rst:2302 msgid "PyMutex mutex = {0};" msgstr "" -#: ../../c-api/init.rst:2301 +#: ../../c-api/init.rst:2304 msgid "" "Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " "contents and address of a :c:type:`!PyMutex` are meaningful, and it must " "remain at a fixed, writable location in memory." msgstr "" -#: ../../c-api/init.rst:2307 +#: ../../c-api/init.rst:2310 msgid "" "A :c:type:`!PyMutex` currently occupies one byte, but the size should be " "considered unstable. The size may change in future Python releases without " "a deprecation period." msgstr "" -#: ../../c-api/init.rst:2315 +#: ../../c-api/init.rst:2318 msgid "" "Lock mutex *m*. If another thread has already locked it, the calling thread " "will block until the mutex is unlocked. While blocked, the thread will " "temporarily release the :term:`GIL` if it is held." msgstr "" -#: ../../c-api/init.rst:2323 +#: ../../c-api/init.rst:2326 msgid "" "Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " "issue a fatal error." msgstr "" -#: ../../c-api/init.rst:2331 +#: ../../c-api/init.rst:2334 msgid "Python Critical Section API" msgstr "" -#: ../../c-api/init.rst:2333 +#: ../../c-api/init.rst:2336 msgid "" "The critical section API provides a deadlock avoidance layer on top of per-" "object locks for :term:`free-threaded ` CPython. They are " @@ -2801,7 +2805,7 @@ msgid "" "no-ops in versions of Python with the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:2338 +#: ../../c-api/init.rst:2341 msgid "" "Critical sections avoid deadlocks by implicitly suspending active critical " "sections and releasing the locks during calls to :c:func:" @@ -2811,7 +2815,7 @@ msgid "" "-- they are useful because their behavior is similar to the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:2345 +#: ../../c-api/init.rst:2348 msgid "" "The functions and structs used by the macros are exposed for cases where C " "macros are not available. They should only be used as in the given macro " @@ -2819,7 +2823,7 @@ msgid "" "future Python versions." msgstr "" -#: ../../c-api/init.rst:2352 +#: ../../c-api/init.rst:2355 msgid "" "Operations that need to lock two objects at once must use :c:macro:" "`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " @@ -2828,11 +2832,11 @@ msgid "" "lock more than two objects at once." msgstr "" -#: ../../c-api/init.rst:2358 +#: ../../c-api/init.rst:2361 msgid "Example usage::" msgstr "" -#: ../../c-api/init.rst:2360 +#: ../../c-api/init.rst:2363 msgid "" "static PyObject *\n" "set_field(MyObject *self, PyObject *value)\n" @@ -2844,71 +2848,71 @@ msgid "" "}" msgstr "" -#: ../../c-api/init.rst:2369 +#: ../../c-api/init.rst:2372 msgid "" "In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " "can call arbitrary code through an object's deallocation function. The " -"critical section API avoids potentital deadlocks due to reentrancy and lock " +"critical section API avoids potential deadlocks due to reentrancy and lock " "ordering by allowing the runtime to temporarily suspend the critical section " "if the code triggered by the finalizer blocks and calls :c:func:" "`PyEval_SaveThread`." msgstr "" -#: ../../c-api/init.rst:2377 +#: ../../c-api/init.rst:2380 msgid "" "Acquires the per-object lock for the object *op* and begins a critical " "section." msgstr "" -#: ../../c-api/init.rst:2380 ../../c-api/init.rst:2394 -#: ../../c-api/init.rst:2409 ../../c-api/init.rst:2423 +#: ../../c-api/init.rst:2383 ../../c-api/init.rst:2397 +#: ../../c-api/init.rst:2412 ../../c-api/init.rst:2426 msgid "In the free-threaded build, this macro expands to::" msgstr "" -#: ../../c-api/init.rst:2382 +#: ../../c-api/init.rst:2385 msgid "" "{\n" " PyCriticalSection _py_cs;\n" " PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" msgstr "" -#: ../../c-api/init.rst:2386 ../../c-api/init.rst:2415 +#: ../../c-api/init.rst:2389 ../../c-api/init.rst:2418 msgid "In the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2392 +#: ../../c-api/init.rst:2395 msgid "Ends the critical section and releases the per-object lock." msgstr "" -#: ../../c-api/init.rst:2396 +#: ../../c-api/init.rst:2399 msgid "" " PyCriticalSection_End(&_py_cs);\n" "}" msgstr "" -#: ../../c-api/init.rst:2399 ../../c-api/init.rst:2428 +#: ../../c-api/init.rst:2402 ../../c-api/init.rst:2431 msgid "In the default build, this macro expands to ``}``." msgstr "" -#: ../../c-api/init.rst:2405 +#: ../../c-api/init.rst:2408 msgid "" "Acquires the per-objects locks for the objects *a* and *b* and begins a " "critical section. The locks are acquired in a consistent order (lowest " "address first) to avoid lock ordering deadlocks." msgstr "" -#: ../../c-api/init.rst:2411 +#: ../../c-api/init.rst:2414 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection_Begin2(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" msgstr "" -#: ../../c-api/init.rst:2421 +#: ../../c-api/init.rst:2424 msgid "Ends the critical section and releases the per-object locks." msgstr "" -#: ../../c-api/init.rst:2425 +#: ../../c-api/init.rst:2428 msgid "" " PyCriticalSection_End2(&_py_cs2);\n" "}" @@ -2922,36 +2926,36 @@ msgstr "PyEval_InitThreads()" msgid "modules (in module sys)" msgstr "modules(sys 模組中)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:698 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 msgid "path (in module sys)" msgstr "path(sys 模組中)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:698 ../../c-api/init.rst:1133 -#: ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 ../../c-api/init.rst:1136 +#: ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 msgid "module" msgstr "模組" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 msgid "__main__" msgstr "__main__" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 msgid "sys" msgstr "sys" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:698 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 msgid "search" msgstr "search(搜尋)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:698 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 msgid "path" msgstr "path(路徑)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1692 ../../c-api/init.rst:1745 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1695 ../../c-api/init.rst:1748 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" @@ -2959,7 +2963,7 @@ msgstr "Py_FinalizeEx(C 函式)" msgid "Py_Initialize()" msgstr "Py_Initialize()" -#: ../../c-api/init.rst:567 ../../c-api/init.rst:796 +#: ../../c-api/init.rst:567 ../../c-api/init.rst:799 msgid "main()" msgstr "main()" @@ -2967,102 +2971,102 @@ msgstr "main()" msgid "Py_GetPath()" msgstr "Py_GetPath()" -#: ../../c-api/init.rst:677 +#: ../../c-api/init.rst:680 msgid "executable (in module sys)" msgstr "executable(sys 模組中)" -#: ../../c-api/init.rst:731 ../../c-api/init.rst:773 ../../c-api/init.rst:787 +#: ../../c-api/init.rst:734 ../../c-api/init.rst:776 ../../c-api/init.rst:790 msgid "version (in module sys)" msgstr "version(sys 模組中)" -#: ../../c-api/init.rst:743 +#: ../../c-api/init.rst:746 msgid "platform (in module sys)" msgstr "platform(sys 模組中)" -#: ../../c-api/init.rst:760 +#: ../../c-api/init.rst:763 msgid "copyright (in module sys)" msgstr "copyright(sys 模組中)" -#: ../../c-api/init.rst:796 +#: ../../c-api/init.rst:799 msgid "Py_FatalError()" msgstr "Py_FatalError()" -#: ../../c-api/init.rst:796 +#: ../../c-api/init.rst:799 msgid "argv (in module sys)" msgstr "argv(sys 模組中)" -#: ../../c-api/init.rst:916 +#: ../../c-api/init.rst:919 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../c-api/init.rst:916 +#: ../../c-api/init.rst:919 msgid "interpreter lock" msgstr "interpreter lock(直譯器鎖)" -#: ../../c-api/init.rst:916 +#: ../../c-api/init.rst:919 msgid "lock, interpreter" msgstr "lock, interpreter(鎖、直譯器)" -#: ../../c-api/init.rst:929 +#: ../../c-api/init.rst:932 msgid "setswitchinterval (in module sys)" msgstr "setswitchinterval (sys 模組中)" -#: ../../c-api/init.rst:938 +#: ../../c-api/init.rst:941 msgid "PyThreadState (C type)" msgstr "PyThreadState(C 型別)" -#: ../../c-api/init.rst:964 +#: ../../c-api/init.rst:967 msgid "Py_BEGIN_ALLOW_THREADS (C macro)" msgstr "Py_BEGIN_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:964 +#: ../../c-api/init.rst:967 msgid "Py_END_ALLOW_THREADS (C macro)" msgstr "Py_END_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:980 +#: ../../c-api/init.rst:983 msgid "PyEval_RestoreThread (C function)" msgstr "PyEval_RestoreThread(C 函式)" -#: ../../c-api/init.rst:980 +#: ../../c-api/init.rst:983 msgid "PyEval_SaveThread (C function)" msgstr "PyEval_SaveThread(C 函式)" -#: ../../c-api/init.rst:1111 +#: ../../c-api/init.rst:1114 msgid "PyEval_AcquireThread()" msgstr "PyEval_AcquireThread()" -#: ../../c-api/init.rst:1111 +#: ../../c-api/init.rst:1114 msgid "PyEval_ReleaseThread()" msgstr "PyEval_ReleaseThread()" -#: ../../c-api/init.rst:1111 +#: ../../c-api/init.rst:1114 msgid "PyEval_SaveThread()" msgstr "PyEval_SaveThread()" -#: ../../c-api/init.rst:1111 +#: ../../c-api/init.rst:1114 msgid "PyEval_RestoreThread()" msgstr "PyEval_RestoreThread()" -#: ../../c-api/init.rst:1133 +#: ../../c-api/init.rst:1136 msgid "_thread" msgstr "_thread" -#: ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 +#: ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 msgid "stdout (in module sys)" msgstr "stdout(sys 模組中)" -#: ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 +#: ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 msgid "stderr (in module sys)" msgstr "stderr(sys 模組中)" -#: ../../c-api/init.rst:1632 ../../c-api/init.rst:1727 +#: ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 msgid "stdin (in module sys)" msgstr "stdin(sys 模組中)" -#: ../../c-api/init.rst:1692 +#: ../../c-api/init.rst:1695 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/init.rst:1722 +#: ../../c-api/init.rst:1725 msgid "close (in module os)" msgstr "close(os 模組中)" diff --git a/c-api/init_config.po b/c-api/init_config.po index 92b1a1a024..5293b616d7 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -2171,7 +2171,7 @@ msgstr "" #: ../../c-api/init_config.rst:1556 msgid "If :c:member:`~PyConfig.isolated` is zero:" -msgstr "" +msgstr "如果 :c:member:`~PyConfig.isolated` 為零:" #: ../../c-api/init_config.rst:1558 msgid "" @@ -2212,7 +2212,7 @@ msgstr "" #: ../../c-api/init_config.rst:1574 msgid "``pybuilddir.txt`` (Unix only)" -msgstr "" +msgstr "``pybuilddir.txt``\\ (僅限 Unix)" #: ../../c-api/init_config.rst:1576 msgid "If a ``._pth`` file is present:" @@ -2250,7 +2250,7 @@ msgstr "" #: ../../c-api/init_config.rst:1594 msgid "See also :c:member:`PyConfig.orig_argv` member." -msgstr "" +msgstr "也請參與 :c:member:`PyConfig.orig_argv` 成員。" #: ../../c-api/init_config.rst:1598 msgid "Multi-Phase Initialization Private Provisional API" @@ -2403,14 +2403,8 @@ msgstr "" #: ../../c-api/init_config.rst:558 msgid "main()" -msgstr "" +msgstr "main()" #: ../../c-api/init_config.rst:558 msgid "argv (in module sys)" msgstr "" - -#~ msgid "Py_RunMain()" -#~ msgstr "Py_RunMain()" - -#~ msgid "Command line arguments: :data:`sys.argv`." -#~ msgstr "命令列引數::data:`sys.argv`。" diff --git a/c-api/long.po b/c-api/long.po index 281c5ae8a4..db11da07a8 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-14 00:14+0000\n" +"POT-Creation-Date: 2024-10-22 00:13+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-" @@ -496,7 +496,7 @@ msgstr "" #: ../../c-api/long.rst:456 msgid "" "*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults " -"that behave most like a C cast, or a combintation of the other flags in the " +"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 "" diff --git a/c-api/monitoring.po b/c-api/monitoring.po index ef4d13984c..d4d8d09510 100644 --- a/c-api/monitoring.po +++ b/c-api/monitoring.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -184,9 +184,9 @@ msgstr "" msgid "" "The ``version`` argument is a pointer to a value which should be allocated " "by the user together with ``state_array`` and initialized to 0, and then set " -"only by :c:func:`!PyMonitoring_EnterScope` itelf. It allows this function to " -"determine whether event states have changed since the previous call, and to " -"return quickly if they have not." +"only by :c:func:`!PyMonitoring_EnterScope` itself. It allows this function " +"to determine whether event states have changed since the previous call, and " +"to return quickly if they have not." msgstr "" #: ../../c-api/monitoring.rst:154 diff --git a/c-api/typeobj.po b/c-api/typeobj.po index 951587ed1f..2b7e6341f3 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:33+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1293,36 +1292,36 @@ msgstr "" #: ../../c-api/typeobj.rst:503 ../../c-api/typeobj.rst:526 #: ../../c-api/typeobj.rst:540 ../../c-api/typeobj.rst:584 -#: ../../c-api/typeobj.rst:627 ../../c-api/typeobj.rst:686 -#: ../../c-api/typeobj.rst:727 ../../c-api/typeobj.rst:744 -#: ../../c-api/typeobj.rst:761 ../../c-api/typeobj.rst:779 -#: ../../c-api/typeobj.rst:803 ../../c-api/typeobj.rst:820 -#: ../../c-api/typeobj.rst:832 ../../c-api/typeobj.rst:844 -#: ../../c-api/typeobj.rst:877 ../../c-api/typeobj.rst:899 -#: ../../c-api/typeobj.rst:919 ../../c-api/typeobj.rst:940 -#: ../../c-api/typeobj.rst:966 ../../c-api/typeobj.rst:985 -#: ../../c-api/typeobj.rst:1001 ../../c-api/typeobj.rst:1040 -#: ../../c-api/typeobj.rst:1051 ../../c-api/typeobj.rst:1061 -#: ../../c-api/typeobj.rst:1071 ../../c-api/typeobj.rst:1085 -#: ../../c-api/typeobj.rst:1103 ../../c-api/typeobj.rst:1126 -#: ../../c-api/typeobj.rst:1144 ../../c-api/typeobj.rst:1157 -#: ../../c-api/typeobj.rst:1179 ../../c-api/typeobj.rst:1223 -#: ../../c-api/typeobj.rst:1244 ../../c-api/typeobj.rst:1263 -#: ../../c-api/typeobj.rst:1293 ../../c-api/typeobj.rst:1315 -#: ../../c-api/typeobj.rst:1341 ../../c-api/typeobj.rst:1426 -#: ../../c-api/typeobj.rst:1500 ../../c-api/typeobj.rst:1561 -#: ../../c-api/typeobj.rst:1597 ../../c-api/typeobj.rst:1622 -#: ../../c-api/typeobj.rst:1645 ../../c-api/typeobj.rst:1658 -#: ../../c-api/typeobj.rst:1673 ../../c-api/typeobj.rst:1687 -#: ../../c-api/typeobj.rst:1717 ../../c-api/typeobj.rst:1749 -#: ../../c-api/typeobj.rst:1775 ../../c-api/typeobj.rst:1793 -#: ../../c-api/typeobj.rst:1822 ../../c-api/typeobj.rst:1866 -#: ../../c-api/typeobj.rst:1883 ../../c-api/typeobj.rst:1924 -#: ../../c-api/typeobj.rst:1946 ../../c-api/typeobj.rst:1978 -#: ../../c-api/typeobj.rst:2006 ../../c-api/typeobj.rst:2019 -#: ../../c-api/typeobj.rst:2029 ../../c-api/typeobj.rst:2046 -#: ../../c-api/typeobj.rst:2063 ../../c-api/typeobj.rst:2077 -#: ../../c-api/typeobj.rst:2123 ../../c-api/typeobj.rst:2146 +#: ../../c-api/typeobj.rst:627 ../../c-api/typeobj.rst:699 +#: ../../c-api/typeobj.rst:740 ../../c-api/typeobj.rst:757 +#: ../../c-api/typeobj.rst:774 ../../c-api/typeobj.rst:792 +#: ../../c-api/typeobj.rst:816 ../../c-api/typeobj.rst:833 +#: ../../c-api/typeobj.rst:845 ../../c-api/typeobj.rst:857 +#: ../../c-api/typeobj.rst:890 ../../c-api/typeobj.rst:912 +#: ../../c-api/typeobj.rst:932 ../../c-api/typeobj.rst:953 +#: ../../c-api/typeobj.rst:979 ../../c-api/typeobj.rst:998 +#: ../../c-api/typeobj.rst:1014 ../../c-api/typeobj.rst:1053 +#: ../../c-api/typeobj.rst:1064 ../../c-api/typeobj.rst:1074 +#: ../../c-api/typeobj.rst:1084 ../../c-api/typeobj.rst:1098 +#: ../../c-api/typeobj.rst:1116 ../../c-api/typeobj.rst:1139 +#: ../../c-api/typeobj.rst:1157 ../../c-api/typeobj.rst:1170 +#: ../../c-api/typeobj.rst:1192 ../../c-api/typeobj.rst:1236 +#: ../../c-api/typeobj.rst:1257 ../../c-api/typeobj.rst:1276 +#: ../../c-api/typeobj.rst:1306 ../../c-api/typeobj.rst:1328 +#: ../../c-api/typeobj.rst:1354 ../../c-api/typeobj.rst:1439 +#: ../../c-api/typeobj.rst:1513 ../../c-api/typeobj.rst:1574 +#: ../../c-api/typeobj.rst:1610 ../../c-api/typeobj.rst:1635 +#: ../../c-api/typeobj.rst:1658 ../../c-api/typeobj.rst:1671 +#: ../../c-api/typeobj.rst:1686 ../../c-api/typeobj.rst:1700 +#: ../../c-api/typeobj.rst:1730 ../../c-api/typeobj.rst:1762 +#: ../../c-api/typeobj.rst:1788 ../../c-api/typeobj.rst:1806 +#: ../../c-api/typeobj.rst:1835 ../../c-api/typeobj.rst:1879 +#: ../../c-api/typeobj.rst:1896 ../../c-api/typeobj.rst:1937 +#: ../../c-api/typeobj.rst:1959 ../../c-api/typeobj.rst:1991 +#: ../../c-api/typeobj.rst:2019 ../../c-api/typeobj.rst:2032 +#: ../../c-api/typeobj.rst:2042 ../../c-api/typeobj.rst:2059 +#: ../../c-api/typeobj.rst:2076 ../../c-api/typeobj.rst:2090 +#: ../../c-api/typeobj.rst:2125 ../../c-api/typeobj.rst:2148 msgid "**Inheritance:**" msgstr "" @@ -1355,12 +1354,12 @@ msgid "" "class. :c:func:`PyType_Ready` will not change this field if it is non-zero." msgstr "" -#: ../../c-api/typeobj.rst:528 ../../c-api/typeobj.rst:688 -#: ../../c-api/typeobj.rst:805 ../../c-api/typeobj.rst:901 -#: ../../c-api/typeobj.rst:921 ../../c-api/typeobj.rst:1624 -#: ../../c-api/typeobj.rst:1647 ../../c-api/typeobj.rst:1777 -#: ../../c-api/typeobj.rst:1795 ../../c-api/typeobj.rst:1868 -#: ../../c-api/typeobj.rst:1980 ../../c-api/typeobj.rst:2125 +#: ../../c-api/typeobj.rst:528 ../../c-api/typeobj.rst:701 +#: ../../c-api/typeobj.rst:818 ../../c-api/typeobj.rst:914 +#: ../../c-api/typeobj.rst:934 ../../c-api/typeobj.rst:1637 +#: ../../c-api/typeobj.rst:1660 ../../c-api/typeobj.rst:1790 +#: ../../c-api/typeobj.rst:1808 ../../c-api/typeobj.rst:1881 +#: ../../c-api/typeobj.rst:1993 ../../c-api/typeobj.rst:2127 msgid "This field is inherited by subtypes." msgstr "" @@ -1566,28 +1565,41 @@ msgid "" "}" msgstr "" -#: ../../c-api/typeobj.rst:693 +#: ../../c-api/typeobj.rst:687 +msgid "" +"In a garbage collected Python, :c:member:`!tp_dealloc` may be called from " +"any Python thread, not just the thread which created the object (if the " +"object becomes part of a refcount cycle, that cycle might be collected by a " +"garbage collection on any thread). This is not a problem for Python API " +"calls, since the thread on which :c:member:`!tp_dealloc` is called will own " +"the Global Interpreter Lock (GIL). However, if the object being destroyed " +"in turn destroys objects from some other C or C++ library, care should be " +"taken to ensure that destroying those objects on the thread which called :c:" +"member:`!tp_dealloc` will not violate any assumptions of the library." +msgstr "" + +#: ../../c-api/typeobj.rst:706 msgid "" "An optional offset to a per-instance function that implements calling the " "object using the :ref:`vectorcall protocol `, a more efficient " "alternative of the simpler :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:698 +#: ../../c-api/typeobj.rst:711 msgid "" "This field is only used if the flag :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` is " "set. If so, this must be a positive integer containing the offset in the " "instance of a :c:type:`vectorcallfunc` pointer." msgstr "" -#: ../../c-api/typeobj.rst:702 +#: ../../c-api/typeobj.rst:715 msgid "" "The *vectorcallfunc* pointer may be ``NULL``, in which case the instance " "behaves as if :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` was not set: calling the " "instance falls back to :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:706 +#: ../../c-api/typeobj.rst:719 msgid "" "Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also set :c:member:" "`~PyTypeObject.tp_call` and make sure its behaviour is consistent with the " @@ -1595,13 +1607,13 @@ msgid "" "`PyVectorcall_Call`." msgstr "" -#: ../../c-api/typeobj.rst:713 +#: ../../c-api/typeobj.rst:726 msgid "" "Before version 3.8, this slot was named ``tp_print``. In Python 2.x, it was " "used for printing to a file. In Python 3.0 to 3.7, it was unused." msgstr "" -#: ../../c-api/typeobj.rst:719 +#: ../../c-api/typeobj.rst:732 msgid "" "Before version 3.12, it was not recommended for :ref:`mutable heap types " "` to implement the vectorcall protocol. When a user sets :attr:" @@ -1611,7 +1623,7 @@ msgid "" "`Py_TPFLAGS_HAVE_VECTORCALL` flag." msgstr "" -#: ../../c-api/typeobj.rst:729 +#: ../../c-api/typeobj.rst:742 msgid "" "This field is always inherited. However, the :c:macro:" "`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If it's not set, " @@ -1619,11 +1631,11 @@ msgid "" "func:`PyVectorcall_Call` is explicitly called." msgstr "" -#: ../../c-api/typeobj.rst:738 +#: ../../c-api/typeobj.rst:751 msgid "An optional pointer to the get-attribute-string function." msgstr "" -#: ../../c-api/typeobj.rst:740 +#: ../../c-api/typeobj.rst:753 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, " @@ -1631,7 +1643,7 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:746 ../../c-api/typeobj.rst:942 +#: ../../c-api/typeobj.rst:759 ../../c-api/typeobj.rst:955 msgid "" "Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject." "tp_getattro`" @@ -1639,7 +1651,7 @@ msgstr "" "群組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject." "tp_getattro`" -#: ../../c-api/typeobj.rst:748 +#: ../../c-api/typeobj.rst:761 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " @@ -1648,12 +1660,12 @@ msgid "" "tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:755 ../../c-api/typeobj.rst:955 +#: ../../c-api/typeobj.rst:768 ../../c-api/typeobj.rst:968 msgid "" "An optional pointer to the function for setting and deleting attributes." msgstr "" -#: ../../c-api/typeobj.rst:757 +#: ../../c-api/typeobj.rst:770 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, " @@ -1661,7 +1673,7 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:763 ../../c-api/typeobj.rst:968 +#: ../../c-api/typeobj.rst:776 ../../c-api/typeobj.rst:981 msgid "" "Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject." "tp_setattro`" @@ -1669,7 +1681,7 @@ msgstr "" "群組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject." "tp_setattro`" -#: ../../c-api/typeobj.rst:765 +#: ../../c-api/typeobj.rst:778 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " @@ -1678,38 +1690,38 @@ msgid "" "tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:772 +#: ../../c-api/typeobj.rst:785 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement :term:`awaitable` and :term:`asynchronous iterator` " "protocols at the C-level. See :ref:`async-structs` for details." msgstr "" -#: ../../c-api/typeobj.rst:776 +#: ../../c-api/typeobj.rst:789 msgid "Formerly known as ``tp_compare`` and ``tp_reserved``." msgstr "" -#: ../../c-api/typeobj.rst:781 +#: ../../c-api/typeobj.rst:794 msgid "" "The :c:member:`~PyTypeObject.tp_as_async` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:789 +#: ../../c-api/typeobj.rst:802 msgid "" "An optional pointer to a function that implements the built-in function :" "func:`repr`." msgstr "" -#: ../../c-api/typeobj.rst:792 +#: ../../c-api/typeobj.rst:805 msgid "The signature is the same as for :c:func:`PyObject_Repr`::" msgstr "" -#: ../../c-api/typeobj.rst:794 +#: ../../c-api/typeobj.rst:807 msgid "PyObject *tp_repr(PyObject *self);" msgstr "PyObject *tp_repr(PyObject *self);" -#: ../../c-api/typeobj.rst:796 +#: ../../c-api/typeobj.rst:809 msgid "" "The function must return a string or a Unicode object. Ideally, this " "function should return a string that, when passed to :func:`eval`, given a " @@ -1718,85 +1730,85 @@ msgid "" "``'>'`` from which both the type and the value of the object can be deduced." msgstr "" -#: ../../c-api/typeobj.rst:807 ../../c-api/typeobj.rst:886 -#: ../../c-api/typeobj.rst:923 ../../c-api/typeobj.rst:948 -#: ../../c-api/typeobj.rst:974 ../../c-api/typeobj.rst:1015 -#: ../../c-api/typeobj.rst:1570 ../../c-api/typeobj.rst:1604 -#: ../../c-api/typeobj.rst:1721 ../../c-api/typeobj.rst:1754 -#: ../../c-api/typeobj.rst:1829 ../../c-api/typeobj.rst:1870 -#: ../../c-api/typeobj.rst:1888 ../../c-api/typeobj.rst:1930 -#: ../../c-api/typeobj.rst:1951 ../../c-api/typeobj.rst:1982 +#: ../../c-api/typeobj.rst:820 ../../c-api/typeobj.rst:899 +#: ../../c-api/typeobj.rst:936 ../../c-api/typeobj.rst:961 +#: ../../c-api/typeobj.rst:987 ../../c-api/typeobj.rst:1028 +#: ../../c-api/typeobj.rst:1583 ../../c-api/typeobj.rst:1617 +#: ../../c-api/typeobj.rst:1734 ../../c-api/typeobj.rst:1767 +#: ../../c-api/typeobj.rst:1842 ../../c-api/typeobj.rst:1883 +#: ../../c-api/typeobj.rst:1901 ../../c-api/typeobj.rst:1943 +#: ../../c-api/typeobj.rst:1964 ../../c-api/typeobj.rst:1995 msgid "**Default:**" msgstr "**預設:**" -#: ../../c-api/typeobj.rst:809 +#: ../../c-api/typeobj.rst:822 msgid "" "When this field is not set, a string of the form ``<%s object at %p>`` is " "returned, where ``%s`` is replaced by the type name, and ``%p`` by the " "object's memory address." msgstr "" -#: ../../c-api/typeobj.rst:816 +#: ../../c-api/typeobj.rst:829 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the number protocol. These fields are documented " "in :ref:`number-structs`." msgstr "" -#: ../../c-api/typeobj.rst:822 +#: ../../c-api/typeobj.rst:835 msgid "" "The :c:member:`~PyTypeObject.tp_as_number` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:828 +#: ../../c-api/typeobj.rst:841 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the sequence protocol. These fields are documented " "in :ref:`sequence-structs`." msgstr "" -#: ../../c-api/typeobj.rst:834 +#: ../../c-api/typeobj.rst:847 msgid "" "The :c:member:`~PyTypeObject.tp_as_sequence` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:840 +#: ../../c-api/typeobj.rst:853 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the mapping protocol. These fields are documented " "in :ref:`mapping-structs`." msgstr "" -#: ../../c-api/typeobj.rst:846 +#: ../../c-api/typeobj.rst:859 msgid "" "The :c:member:`~PyTypeObject.tp_as_mapping` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:854 +#: ../../c-api/typeobj.rst:867 msgid "" "An optional pointer to a function that implements the built-in function :" "func:`hash`." msgstr "" -#: ../../c-api/typeobj.rst:857 +#: ../../c-api/typeobj.rst:870 msgid "The signature is the same as for :c:func:`PyObject_Hash`::" msgstr "" -#: ../../c-api/typeobj.rst:859 +#: ../../c-api/typeobj.rst:872 msgid "Py_hash_t tp_hash(PyObject *);" msgstr "Py_hash_t tp_hash(PyObject *);" -#: ../../c-api/typeobj.rst:861 +#: ../../c-api/typeobj.rst:874 msgid "" "The value ``-1`` should not be returned as a normal return value; when an " "error occurs during the computation of the hash value, the function should " "set an exception and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:865 +#: ../../c-api/typeobj.rst:878 msgid "" "When this field is not set (*and* :c:member:`~PyTypeObject.tp_richcompare` " "is not set), an attempt to take the hash of the object raises :exc:" @@ -1804,7 +1816,7 @@ msgid "" "`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:869 +#: ../../c-api/typeobj.rst:882 msgid "" "This field can be set explicitly to :c:func:`PyObject_HashNotImplemented` to " "block inheritance of the hash method from a parent type. This is interpreted " @@ -1815,7 +1827,7 @@ msgid "" "`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:879 ../../c-api/typeobj.rst:1563 +#: ../../c-api/typeobj.rst:892 ../../c-api/typeobj.rst:1576 msgid "" "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject." "tp_richcompare`" @@ -1823,7 +1835,7 @@ msgstr "" "群組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject." "tp_richcompare`" -#: ../../c-api/typeobj.rst:881 +#: ../../c-api/typeobj.rst:894 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_richcompare`: a subtype inherits both of :c:member:`~PyTypeObject." @@ -1832,22 +1844,22 @@ msgid "" "are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:888 +#: ../../c-api/typeobj.rst:901 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericHash`." msgstr "" -#: ../../c-api/typeobj.rst:893 +#: ../../c-api/typeobj.rst:906 msgid "" "An optional pointer to a function that implements calling the object. This " "should be ``NULL`` if the object is not callable. The signature is the same " "as for :c:func:`PyObject_Call`::" msgstr "" -#: ../../c-api/typeobj.rst:897 +#: ../../c-api/typeobj.rst:910 msgid "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" msgstr "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" -#: ../../c-api/typeobj.rst:906 +#: ../../c-api/typeobj.rst:919 msgid "" "An optional pointer to a function that implements the built-in operation :" "func:`str`. (Note that :class:`str` is a type now, and :func:`str` calls " @@ -1856,15 +1868,15 @@ msgid "" "this handler.)" msgstr "" -#: ../../c-api/typeobj.rst:911 +#: ../../c-api/typeobj.rst:924 msgid "The signature is the same as for :c:func:`PyObject_Str`::" msgstr "" -#: ../../c-api/typeobj.rst:913 +#: ../../c-api/typeobj.rst:926 msgid "PyObject *tp_str(PyObject *self);" msgstr "PyObject *tp_str(PyObject *self);" -#: ../../c-api/typeobj.rst:915 +#: ../../c-api/typeobj.rst:928 msgid "" "The function must return a string or a Unicode object. It should be a " "\"friendly\" string representation of the object, as this is the " @@ -1872,32 +1884,32 @@ msgid "" "function." msgstr "" -#: ../../c-api/typeobj.rst:925 +#: ../../c-api/typeobj.rst:938 msgid "" "When this field is not set, :c:func:`PyObject_Repr` is called to return a " "string representation." msgstr "" -#: ../../c-api/typeobj.rst:931 +#: ../../c-api/typeobj.rst:944 msgid "An optional pointer to the get-attribute function." msgstr "" -#: ../../c-api/typeobj.rst:933 +#: ../../c-api/typeobj.rst:946 msgid "The signature is the same as for :c:func:`PyObject_GetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:935 +#: ../../c-api/typeobj.rst:948 msgid "PyObject *tp_getattro(PyObject *self, PyObject *attr);" msgstr "PyObject *tp_getattro(PyObject *self, PyObject *attr);" -#: ../../c-api/typeobj.rst:937 +#: ../../c-api/typeobj.rst:950 msgid "" "It is usually convenient to set this field to :c:func:" "`PyObject_GenericGetAttr`, which implements the normal way of looking for " "object attributes." msgstr "" -#: ../../c-api/typeobj.rst:944 +#: ../../c-api/typeobj.rst:957 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_getattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " @@ -1906,19 +1918,19 @@ msgid "" "tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:950 +#: ../../c-api/typeobj.rst:963 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:957 +#: ../../c-api/typeobj.rst:970 msgid "The signature is the same as for :c:func:`PyObject_SetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:959 +#: ../../c-api/typeobj.rst:972 msgid "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" msgstr "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" -#: ../../c-api/typeobj.rst:961 +#: ../../c-api/typeobj.rst:974 msgid "" "In addition, setting *value* to ``NULL`` to delete an attribute must be " "supported. It is usually convenient to set this field to :c:func:" @@ -1926,7 +1938,7 @@ msgid "" "attributes." msgstr "" -#: ../../c-api/typeobj.rst:970 +#: ../../c-api/typeobj.rst:983 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_setattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " @@ -1935,24 +1947,24 @@ msgid "" "tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:976 +#: ../../c-api/typeobj.rst:989 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:981 +#: ../../c-api/typeobj.rst:994 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the buffer interface. These fields are documented " "in :ref:`buffer-structs`." msgstr "" -#: ../../c-api/typeobj.rst:987 +#: ../../c-api/typeobj.rst:1000 msgid "" "The :c:member:`~PyTypeObject.tp_as_buffer` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:993 +#: ../../c-api/typeobj.rst:1006 msgid "" "This field is a bit mask of various flags. Some flags indicate variant " "semantics for certain situations; others are used to indicate that certain " @@ -1964,7 +1976,7 @@ msgid "" "accessed and must be considered to have a zero or ``NULL`` value instead." msgstr "" -#: ../../c-api/typeobj.rst:1003 +#: ../../c-api/typeobj.rst:1016 msgid "" "Inheritance of this field is complicated. Most flag bits are inherited " "individually, i.e. if the base type has a flag bit set, the subtype inherits " @@ -1980,7 +1992,7 @@ msgid "" "*really* inherited individually?" msgstr "" -#: ../../c-api/typeobj.rst:1017 +#: ../../c-api/typeobj.rst:1030 msgid "" ":c:data:`PyBaseObject_Type` uses ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``." @@ -1988,11 +2000,11 @@ msgstr "" ":c:data:`PyBaseObject_Type` 使用 ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``。" -#: ../../c-api/typeobj.rst:1020 +#: ../../c-api/typeobj.rst:1033 msgid "**Bit Masks:**" msgstr "" -#: ../../c-api/typeobj.rst:1024 +#: ../../c-api/typeobj.rst:1037 msgid "" "The following bit masks are currently defined; these can be ORed together " "using the ``|`` operator to form the value of the :c:member:`~PyTypeObject." @@ -2001,7 +2013,7 @@ msgid "" "zero." msgstr "" -#: ../../c-api/typeobj.rst:1031 +#: ../../c-api/typeobj.rst:1044 msgid "" "This bit is set when the type object itself is allocated on the heap, for " "example, types created dynamically using :c:func:`PyType_FromSpec`. In this " @@ -2014,32 +2026,32 @@ msgid "" "reference cycle with their own module object." msgstr "" -#: ../../c-api/typeobj.rst:1042 ../../c-api/typeobj.rst:1053 -#: ../../c-api/typeobj.rst:1063 ../../c-api/typeobj.rst:1073 -#: ../../c-api/typeobj.rst:1105 +#: ../../c-api/typeobj.rst:1055 ../../c-api/typeobj.rst:1066 +#: ../../c-api/typeobj.rst:1076 ../../c-api/typeobj.rst:1086 +#: ../../c-api/typeobj.rst:1118 msgid "???" msgstr "???" -#: ../../c-api/typeobj.rst:1047 +#: ../../c-api/typeobj.rst:1060 msgid "" "This bit is set when the type can be used as the base type of another type. " "If this bit is clear, the type cannot be subtyped (similar to a \"final\" " "class in Java)." msgstr "" -#: ../../c-api/typeobj.rst:1058 +#: ../../c-api/typeobj.rst:1071 msgid "" "This bit is set when the type object has been fully initialized by :c:func:" "`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1068 +#: ../../c-api/typeobj.rst:1081 msgid "" "This bit is set while :c:func:`PyType_Ready` is in the process of " "initializing the type object." msgstr "" -#: ../../c-api/typeobj.rst:1078 +#: ../../c-api/typeobj.rst:1091 msgid "" "This bit is set when the object supports garbage collection. If this bit is " "set, instances must be created using :c:macro:`PyObject_GC_New` and " @@ -2049,14 +2061,14 @@ msgid "" "tp_clear` are present in the type object." msgstr "" -#: ../../c-api/typeobj.rst:1087 ../../c-api/typeobj.rst:1428 -#: ../../c-api/typeobj.rst:1502 +#: ../../c-api/typeobj.rst:1100 ../../c-api/typeobj.rst:1441 +#: ../../c-api/typeobj.rst:1515 msgid "" "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject." "tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" msgstr "" -#: ../../c-api/typeobj.rst:1089 +#: ../../c-api/typeobj.rst:1102 msgid "" "The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with the :c:" "member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` " @@ -2066,105 +2078,105 @@ msgid "" "values." msgstr "" -#: ../../c-api/typeobj.rst:1099 +#: ../../c-api/typeobj.rst:1112 msgid "" "This is a bitmask of all the bits that pertain to the existence of certain " "fields in the type object and its extension structures. Currently, it " "includes the following bits: :c:macro:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`." msgstr "" -#: ../../c-api/typeobj.rst:1110 +#: ../../c-api/typeobj.rst:1123 msgid "This bit indicates that objects behave like unbound methods." msgstr "" -#: ../../c-api/typeobj.rst:1112 +#: ../../c-api/typeobj.rst:1125 msgid "If this flag is set for ``type(meth)``, then:" msgstr "" -#: ../../c-api/typeobj.rst:1114 +#: ../../c-api/typeobj.rst:1127 msgid "" "``meth.__get__(obj, cls)(*args, **kwds)`` (with ``obj`` not None) must be " "equivalent to ``meth(obj, *args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1117 +#: ../../c-api/typeobj.rst:1130 msgid "" "``meth.__get__(None, cls)(*args, **kwds)`` must be equivalent to " "``meth(*args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1120 +#: ../../c-api/typeobj.rst:1133 msgid "" "This flag enables an optimization for typical method calls like ``obj." "meth()``: it avoids creating a temporary \"bound method\" object for ``obj." "meth``." msgstr "" -#: ../../c-api/typeobj.rst:1128 +#: ../../c-api/typeobj.rst:1141 msgid "" "This flag is never inherited by types without the :c:macro:" "`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it is inherited " "whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1134 +#: ../../c-api/typeobj.rst:1147 msgid "" "This bit indicates that instances of the class have a `~object.__dict__` " "attribute, and that the space for the dictionary is managed by the VM." msgstr "" -#: ../../c-api/typeobj.rst:1137 +#: ../../c-api/typeobj.rst:1150 msgid "If this flag is set, :c:macro:`Py_TPFLAGS_HAVE_GC` should also be set." msgstr "" -#: ../../c-api/typeobj.rst:1139 +#: ../../c-api/typeobj.rst:1152 msgid "" "The type traverse function must call :c:func:`PyObject_VisitManagedDict` and " "its clear function must call :c:func:`PyObject_ClearManagedDict`." msgstr "" -#: ../../c-api/typeobj.rst:1146 +#: ../../c-api/typeobj.rst:1159 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject.tp_dictoffset` " "field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1152 +#: ../../c-api/typeobj.rst:1165 msgid "" "This bit indicates that instances of the class should be weakly " "referenceable." msgstr "" -#: ../../c-api/typeobj.rst:1159 +#: ../../c-api/typeobj.rst:1172 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject." "tp_weaklistoffset` field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1165 +#: ../../c-api/typeobj.rst:1178 msgid "" "Only usable with variable-size types, i.e. ones with non-zero :c:member:" "`~PyTypeObject.tp_itemsize`." msgstr "" -#: ../../c-api/typeobj.rst:1168 +#: ../../c-api/typeobj.rst:1181 msgid "" "Indicates that the variable-sized portion of an instance of this type is at " "the end of the instance's memory area, at an offset of ``Py_TYPE(obj)-" ">tp_basicsize`` (which may be different in each subclass)." msgstr "" -#: ../../c-api/typeobj.rst:1173 +#: ../../c-api/typeobj.rst:1186 msgid "" "When setting this flag, be sure that all superclasses either use this memory " "layout, or are not variable-sized. Python does not check this." msgstr "" -#: ../../c-api/typeobj.rst:1181 +#: ../../c-api/typeobj.rst:1194 msgid "This flag is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1195 +#: ../../c-api/typeobj.rst:1208 msgid "" "These flags are used by functions such as :c:func:`PyLong_Check` to quickly " "determine if a type is a subclass of a built-in type; such specific checks " @@ -2174,90 +2186,90 @@ msgid "" "behave differently depending on what kind of check is used." msgstr "" -#: ../../c-api/typeobj.rst:1206 +#: ../../c-api/typeobj.rst:1219 msgid "" "This bit is set when the :c:member:`~PyTypeObject.tp_finalize` slot is " "present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1211 +#: ../../c-api/typeobj.rst:1224 msgid "" "This flag isn't necessary anymore, as the interpreter assumes the :c:member:" "`~PyTypeObject.tp_finalize` slot is always present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1219 +#: ../../c-api/typeobj.rst:1232 msgid "" "This bit is set when the class implements the :ref:`vectorcall protocol " "`. See :c:member:`~PyTypeObject.tp_vectorcall_offset` for " "details." msgstr "" -#: ../../c-api/typeobj.rst:1225 +#: ../../c-api/typeobj.rst:1238 msgid "" "This bit is inherited if :c:member:`~PyTypeObject.tp_call` is also inherited." msgstr "" -#: ../../c-api/typeobj.rst:1232 +#: ../../c-api/typeobj.rst:1245 msgid "" "This flag is now removed from a class when the class's :py:meth:`~object." "__call__` method is reassigned." msgstr "" -#: ../../c-api/typeobj.rst:1235 +#: ../../c-api/typeobj.rst:1248 msgid "This flag can now be inherited by mutable classes." msgstr "" -#: ../../c-api/typeobj.rst:1239 +#: ../../c-api/typeobj.rst:1252 msgid "" "This bit is set for type objects that are immutable: type attributes cannot " "be set nor deleted." msgstr "" -#: ../../c-api/typeobj.rst:1241 +#: ../../c-api/typeobj.rst:1254 msgid "" ":c:func:`PyType_Ready` automatically applies this flag to :ref:`static types " "`." msgstr "" -#: ../../c-api/typeobj.rst:1246 +#: ../../c-api/typeobj.rst:1259 msgid "This flag is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:1252 +#: ../../c-api/typeobj.rst:1265 msgid "" "Disallow creating instances of the type: set :c:member:`~PyTypeObject." "tp_new` to NULL and don't create the ``__new__`` key in the type dictionary." msgstr "" -#: ../../c-api/typeobj.rst:1256 +#: ../../c-api/typeobj.rst:1269 msgid "" "The flag must be set before creating the type, not after. For example, it " "must be set before :c:func:`PyType_Ready` is called on the type." msgstr "" -#: ../../c-api/typeobj.rst:1259 +#: ../../c-api/typeobj.rst:1272 msgid "" "The flag is set automatically on :ref:`static types ` if :c:" "member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` and :c:" "member:`~PyTypeObject.tp_new` is NULL." msgstr "" -#: ../../c-api/typeobj.rst:1265 +#: ../../c-api/typeobj.rst:1278 msgid "" "This flag is not inherited. However, subclasses will not be instantiable " "unless they provide a non-NULL :c:member:`~PyTypeObject.tp_new` (which is " "only possible via the C API)." msgstr "" -#: ../../c-api/typeobj.rst:1272 +#: ../../c-api/typeobj.rst:1285 msgid "" "To disallow instantiating a class directly but allow instantiating its " "subclasses (e.g. for an :term:`abstract base class`), do not use this flag. " "Instead, make :c:member:`~PyTypeObject.tp_new` only succeed for subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1283 +#: ../../c-api/typeobj.rst:1296 msgid "" "This bit indicates that instances of the class may match mapping patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2265,23 +2277,23 @@ msgid "" "unset when registering :class:`collections.abc.Sequence`." msgstr "" -#: ../../c-api/typeobj.rst:1290 ../../c-api/typeobj.rst:1312 +#: ../../c-api/typeobj.rst:1303 ../../c-api/typeobj.rst:1325 msgid "" ":c:macro:`Py_TPFLAGS_MAPPING` and :c:macro:`Py_TPFLAGS_SEQUENCE` are " "mutually exclusive; it is an error to enable both flags simultaneously." msgstr "" -#: ../../c-api/typeobj.rst:1295 +#: ../../c-api/typeobj.rst:1308 msgid "" "This flag is inherited by types that do not already set :c:macro:" "`Py_TPFLAGS_SEQUENCE`." msgstr "" -#: ../../c-api/typeobj.rst:1298 ../../c-api/typeobj.rst:1320 +#: ../../c-api/typeobj.rst:1311 ../../c-api/typeobj.rst:1333 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: ../../c-api/typeobj.rst:1305 +#: ../../c-api/typeobj.rst:1318 msgid "" "This bit indicates that instances of the class may match sequence patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2289,53 +2301,53 @@ msgid "" "unset when registering :class:`collections.abc.Mapping`." msgstr "" -#: ../../c-api/typeobj.rst:1317 +#: ../../c-api/typeobj.rst:1330 msgid "" "This flag is inherited by types that do not already set :c:macro:" "`Py_TPFLAGS_MAPPING`." msgstr "" -#: ../../c-api/typeobj.rst:1327 +#: ../../c-api/typeobj.rst:1340 msgid "" "Internal. Do not set or unset this flag. To indicate that a class has " "changed call :c:func:`PyType_Modified`" msgstr "" -#: ../../c-api/typeobj.rst:1331 +#: ../../c-api/typeobj.rst:1344 msgid "" "This flag is present in header files, but is not be used. It will be removed " "in a future version of CPython" msgstr "" -#: ../../c-api/typeobj.rst:1337 +#: ../../c-api/typeobj.rst:1350 msgid "" "An optional pointer to a NUL-terminated C string giving the docstring for " "this type object. This is exposed as the :attr:`~type.__doc__` attribute on " "the type and instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:1343 +#: ../../c-api/typeobj.rst:1356 msgid "This field is *not* inherited by subtypes." msgstr "" -#: ../../c-api/typeobj.rst:1348 +#: ../../c-api/typeobj.rst:1361 msgid "" "An optional pointer to a traversal function for the garbage collector. This " "is only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1351 +#: ../../c-api/typeobj.rst:1364 msgid "int tp_traverse(PyObject *self, visitproc visit, void *arg);" msgstr "int tp_traverse(PyObject *self, visitproc visit, void *arg);" -#: ../../c-api/typeobj.rst:1353 ../../c-api/typeobj.rst:1497 +#: ../../c-api/typeobj.rst:1366 ../../c-api/typeobj.rst:1510 msgid "" "More information about Python's garbage collection scheme can be found in " "section :ref:`supporting-cycle-detection`." msgstr "" -#: ../../c-api/typeobj.rst:1356 +#: ../../c-api/typeobj.rst:1369 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage " "collector to detect reference cycles. A typical implementation of a :c:" @@ -2345,7 +2357,7 @@ msgid "" "`!_thread` extension module::" msgstr "" -#: ../../c-api/typeobj.rst:1362 +#: ../../c-api/typeobj.rst:1375 msgid "" "static int\n" "local_traverse(localobject *self, visitproc visit, void *arg)\n" @@ -2365,7 +2377,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1371 +#: ../../c-api/typeobj.rst:1384 msgid "" "Note that :c:func:`Py_VISIT` is called only on those members that can " "participate in reference cycles. Although there is also a ``self->key`` " @@ -2373,48 +2385,50 @@ msgid "" "part of a reference cycle." msgstr "" -#: ../../c-api/typeobj.rst:1375 +#: ../../c-api/typeobj.rst:1388 msgid "" "On the other hand, even if you know a member can never be part of a cycle, " "as a debugging aid you may want to visit it anyway just so the :mod:`gc` " "module's :func:`~gc.get_referents` function will include it." msgstr "" -#: ../../c-api/typeobj.rst:1379 +#: ../../c-api/typeobj.rst:1392 msgid "" "Heap types (:c:macro:`Py_TPFLAGS_HEAPTYPE`) must visit their type with::" msgstr "" -#: ../../c-api/typeobj.rst:1381 +#: ../../c-api/typeobj.rst:1394 msgid "Py_VISIT(Py_TYPE(self));" -msgstr "" +msgstr "Py_VISIT(Py_TYPE(self));" -#: ../../c-api/typeobj.rst:1383 +#: ../../c-api/typeobj.rst:1396 msgid "" "It is only needed since Python 3.9. To support Python 3.8 and older, this " "line must be conditional::" msgstr "" -#: ../../c-api/typeobj.rst:1386 +#: ../../c-api/typeobj.rst:1399 msgid "" "#if PY_VERSION_HEX >= 0x03090000\n" " Py_VISIT(Py_TYPE(self));\n" "#endif" msgstr "" +"#if PY_VERSION_HEX >= 0x03090000\n" +" Py_VISIT(Py_TYPE(self));\n" +"#endif" -#: ../../c-api/typeobj.rst:1390 +#: ../../c-api/typeobj.rst:1403 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" "`PyObject_VisitManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1394 -#, fuzzy +#: ../../c-api/typeobj.rst:1407 msgid "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" -msgstr "PyObject *tp_iternext(PyObject *self);" +msgstr "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" -#: ../../c-api/typeobj.rst:1397 +#: ../../c-api/typeobj.rst:1410 msgid "" "When implementing :c:member:`~PyTypeObject.tp_traverse`, only the members " "that the instance *owns* (by having :term:`strong references ` hold a reference to " "their type. Their traversal function must therefore either visit :c:func:" @@ -2443,14 +2457,14 @@ msgid "" "superclass). If they do not, the type object may not be garbage-collected." msgstr "" -#: ../../c-api/typeobj.rst:1421 +#: ../../c-api/typeobj.rst:1434 msgid "" "Heap-allocated types are expected to visit ``Py_TYPE(self)`` in " "``tp_traverse``. In earlier versions of Python, due to `bug 40217 `_, doing this may lead to crashes in subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1430 +#: ../../c-api/typeobj.rst:1443 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_clear` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:" @@ -2458,18 +2472,18 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1438 +#: ../../c-api/typeobj.rst:1451 msgid "" "An optional pointer to a clear function for the garbage collector. This is " "only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1441 +#: ../../c-api/typeobj.rst:1454 msgid "int tp_clear(PyObject *);" msgstr "int tp_clear(PyObject *);" -#: ../../c-api/typeobj.rst:1443 +#: ../../c-api/typeobj.rst:1456 msgid "" "The :c:member:`~PyTypeObject.tp_clear` member function is used to break " "reference cycles in cyclic garbage detected by the garbage collector. Taken " @@ -2484,7 +2498,7 @@ msgid "" "good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1453 +#: ../../c-api/typeobj.rst:1466 msgid "" "Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the " "instance's references to those of its members that may be Python objects, " @@ -2492,7 +2506,7 @@ msgid "" "example::" msgstr "" -#: ../../c-api/typeobj.rst:1457 +#: ../../c-api/typeobj.rst:1470 msgid "" "static int\n" "local_clear(localobject *self)\n" @@ -2514,7 +2528,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1467 +#: ../../c-api/typeobj.rst:1480 msgid "" "The :c:func:`Py_CLEAR` macro should be used, because clearing references is " "delicate: the reference to the contained object must not be released (via :" @@ -2529,19 +2543,18 @@ msgid "" "performs the operations in a safe order." msgstr "" -#: ../../c-api/typeobj.rst:1479 +#: ../../c-api/typeobj.rst:1492 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" "`PyObject_ClearManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1483 -#, fuzzy +#: ../../c-api/typeobj.rst:1496 msgid "PyObject_ClearManagedDict((PyObject*)self);" -msgstr "PyObject *am_anext(PyObject *self);" +msgstr "PyObject_ClearManagedDict((PyObject*)self);" -#: ../../c-api/typeobj.rst:1485 +#: ../../c-api/typeobj.rst:1498 msgid "" "Note that :c:member:`~PyTypeObject.tp_clear` is not *always* called before " "an instance is deallocated. For example, when reference counting is enough " @@ -2549,7 +2562,7 @@ msgid "" "is not involved and :c:member:`~PyTypeObject.tp_dealloc` is called directly." msgstr "" -#: ../../c-api/typeobj.rst:1491 +#: ../../c-api/typeobj.rst:1504 msgid "" "Because the goal of :c:member:`~PyTypeObject.tp_clear` functions is to break " "reference cycles, it's not necessary to clear contained objects like Python " @@ -2559,7 +2572,7 @@ msgid "" "invoke :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1504 +#: ../../c-api/typeobj.rst:1517 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_traverse` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :" @@ -2567,22 +2580,22 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1512 +#: ../../c-api/typeobj.rst:1525 msgid "" "An optional pointer to the rich comparison function, whose signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1514 +#: ../../c-api/typeobj.rst:1527 msgid "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" msgstr "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" -#: ../../c-api/typeobj.rst:1516 +#: ../../c-api/typeobj.rst:1529 msgid "" "The first parameter is guaranteed to be an instance of the type that is " "defined by :c:type:`PyTypeObject`." msgstr "" -#: ../../c-api/typeobj.rst:1519 +#: ../../c-api/typeobj.rst:1532 msgid "" "The function should return the result of the comparison (usually ``Py_True`` " "or ``Py_False``). If the comparison is undefined, it must return " @@ -2590,50 +2603,50 @@ msgid "" "set an exception condition." msgstr "" -#: ../../c-api/typeobj.rst:1524 +#: ../../c-api/typeobj.rst:1537 msgid "" "The following constants are defined to be used as the third argument for :c:" "member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:" msgstr "" -#: ../../c-api/typeobj.rst:1530 +#: ../../c-api/typeobj.rst:1543 msgid "Constant" msgstr "常數" -#: ../../c-api/typeobj.rst:1530 +#: ../../c-api/typeobj.rst:1543 msgid "Comparison" msgstr "" -#: ../../c-api/typeobj.rst:1532 +#: ../../c-api/typeobj.rst:1545 msgid "``<``" msgstr "``<``" -#: ../../c-api/typeobj.rst:1534 +#: ../../c-api/typeobj.rst:1547 msgid "``<=``" msgstr "``<=``" -#: ../../c-api/typeobj.rst:1536 +#: ../../c-api/typeobj.rst:1549 msgid "``==``" msgstr "``==``" -#: ../../c-api/typeobj.rst:1538 +#: ../../c-api/typeobj.rst:1551 msgid "``!=``" msgstr "``!=``" -#: ../../c-api/typeobj.rst:1540 +#: ../../c-api/typeobj.rst:1553 msgid "``>``" msgstr "``>``" -#: ../../c-api/typeobj.rst:1542 +#: ../../c-api/typeobj.rst:1555 msgid "``>=``" msgstr "``>=``" -#: ../../c-api/typeobj.rst:1545 +#: ../../c-api/typeobj.rst:1558 msgid "" "The following macro is defined to ease writing rich comparison functions:" msgstr "" -#: ../../c-api/typeobj.rst:1549 +#: ../../c-api/typeobj.rst:1562 msgid "" "Return ``Py_True`` or ``Py_False`` from the function, depending on the " "result of a comparison. VAL_A and VAL_B must be orderable by C comparison " @@ -2641,15 +2654,15 @@ msgid "" "specifies the requested operation, as for :c:func:`PyObject_RichCompare`." msgstr "" -#: ../../c-api/typeobj.rst:1555 +#: ../../c-api/typeobj.rst:1568 msgid "The returned value is a new :term:`strong reference`." msgstr "" -#: ../../c-api/typeobj.rst:1557 +#: ../../c-api/typeobj.rst:1570 msgid "On error, sets an exception and returns ``NULL`` from the function." msgstr "" -#: ../../c-api/typeobj.rst:1565 +#: ../../c-api/typeobj.rst:1578 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" @@ -2657,7 +2670,7 @@ msgid "" "tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1572 +#: ../../c-api/typeobj.rst:1585 msgid "" ":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject." "tp_richcompare` implementation, which may be inherited. However, if only :c:" @@ -2666,13 +2679,13 @@ msgid "" "comparisons." msgstr "" -#: ../../c-api/typeobj.rst:1581 +#: ../../c-api/typeobj.rst:1594 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1584 +#: ../../c-api/typeobj.rst:1597 msgid "" "If the instances of this type are weakly referenceable, this field is " "greater than zero and contains the offset in the instance structure of the " @@ -2682,19 +2695,19 @@ msgid "" "`PyObject*` which is initialized to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1591 +#: ../../c-api/typeobj.rst:1604 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_weaklist`; that " "is the list head for weak references to the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1594 +#: ../../c-api/typeobj.rst:1607 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " "and :c:member:`~PyTypeObject.tp_weaklistoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1599 +#: ../../c-api/typeobj.rst:1612 msgid "" "This field is inherited by subtypes, but see the rules listed below. A " "subtype may override this offset; this means that the subtype uses a " @@ -2703,7 +2716,7 @@ msgid "" "not be a problem." msgstr "" -#: ../../c-api/typeobj.rst:1606 +#: ../../c-api/typeobj.rst:1619 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject." @@ -2711,32 +2724,32 @@ msgid "" "unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1614 +#: ../../c-api/typeobj.rst:1627 msgid "" "An optional pointer to a function that returns an :term:`iterator` for the " "object. Its presence normally signals that the instances of this type are :" "term:`iterable` (although sequences may be iterable without this function)." msgstr "" -#: ../../c-api/typeobj.rst:1618 +#: ../../c-api/typeobj.rst:1631 msgid "This function has the same signature as :c:func:`PyObject_GetIter`::" msgstr "" -#: ../../c-api/typeobj.rst:1620 +#: ../../c-api/typeobj.rst:1633 msgid "PyObject *tp_iter(PyObject *self);" msgstr "PyObject *tp_iter(PyObject *self);" -#: ../../c-api/typeobj.rst:1629 +#: ../../c-api/typeobj.rst:1642 msgid "" "An optional pointer to a function that returns the next item in an :term:" "`iterator`. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1632 +#: ../../c-api/typeobj.rst:1645 msgid "PyObject *tp_iternext(PyObject *self);" msgstr "PyObject *tp_iternext(PyObject *self);" -#: ../../c-api/typeobj.rst:1634 +#: ../../c-api/typeobj.rst:1647 msgid "" "When the iterator is exhausted, it must return ``NULL``; a :exc:" "`StopIteration` exception may or may not be set. When another error occurs, " @@ -2744,74 +2757,74 @@ msgid "" "this type are iterators." msgstr "" -#: ../../c-api/typeobj.rst:1639 +#: ../../c-api/typeobj.rst:1652 msgid "" "Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` " "function, and that function should return the iterator instance itself (not " "a new iterator instance)." msgstr "" -#: ../../c-api/typeobj.rst:1643 +#: ../../c-api/typeobj.rst:1656 msgid "This function has the same signature as :c:func:`PyIter_Next`." msgstr "" -#: ../../c-api/typeobj.rst:1652 +#: ../../c-api/typeobj.rst:1665 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMethodDef` structures, declaring regular methods of this type." msgstr "" -#: ../../c-api/typeobj.rst:1655 +#: ../../c-api/typeobj.rst:1668 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1660 +#: ../../c-api/typeobj.rst:1673 msgid "" "This field is not inherited by subtypes (methods are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1666 +#: ../../c-api/typeobj.rst:1679 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMemberDef` structures, declaring regular data members (fields or slots) " "of instances of this type." msgstr "" -#: ../../c-api/typeobj.rst:1670 +#: ../../c-api/typeobj.rst:1683 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1675 +#: ../../c-api/typeobj.rst:1688 msgid "" "This field is not inherited by subtypes (members are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1681 +#: ../../c-api/typeobj.rst:1694 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyGetSetDef` structures, declaring computed attributes of instances of this " "type." msgstr "" -#: ../../c-api/typeobj.rst:1684 +#: ../../c-api/typeobj.rst:1697 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a getset descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1689 +#: ../../c-api/typeobj.rst:1702 msgid "" "This field is not inherited by subtypes (computed attributes are inherited " "through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1695 +#: ../../c-api/typeobj.rst:1708 msgid "" "An optional pointer to a base type from which type properties are " "inherited. At this level, only single inheritance is supported; multiple " @@ -2819,7 +2832,7 @@ msgid "" "metatype." msgstr "" -#: ../../c-api/typeobj.rst:1703 +#: ../../c-api/typeobj.rst:1716 msgid "" "Slot initialization is subject to the rules of initializing globals. C99 " "requires the initializers to be \"address constants\". Function designators " @@ -2827,7 +2840,7 @@ msgid "" "valid C99 address constants." msgstr "" -#: ../../c-api/typeobj.rst:1708 +#: ../../c-api/typeobj.rst:1721 msgid "" "However, the unary '&' operator applied to a non-static variable like :c:" "data:`PyBaseObject_Type` is not required to produce an address constant. " @@ -2835,27 +2848,27 @@ msgid "" "strictly standard conforming in this particular behavior." msgstr "" -#: ../../c-api/typeobj.rst:1714 +#: ../../c-api/typeobj.rst:1727 msgid "" "Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the " "extension module's init function." msgstr "" -#: ../../c-api/typeobj.rst:1719 +#: ../../c-api/typeobj.rst:1732 msgid "This field is not inherited by subtypes (obviously)." msgstr "" -#: ../../c-api/typeobj.rst:1723 +#: ../../c-api/typeobj.rst:1736 msgid "" "This field defaults to ``&PyBaseObject_Type`` (which to Python programmers " "is known as the type :class:`object`)." msgstr "" -#: ../../c-api/typeobj.rst:1729 +#: ../../c-api/typeobj.rst:1742 msgid "The type's dictionary is stored here by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1731 +#: ../../c-api/typeobj.rst:1744 msgid "" "This field should normally be initialized to ``NULL`` before PyType_Ready is " "called; it may also be initialized to a dictionary containing initial " @@ -2866,73 +2879,73 @@ msgid "" "be treated as read-only." msgstr "" -#: ../../c-api/typeobj.rst:1739 +#: ../../c-api/typeobj.rst:1752 msgid "" "Some types may not store their dictionary in this slot. Use :c:func:" "`PyType_GetDict` to retrieve the dictionary for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1745 +#: ../../c-api/typeobj.rst:1758 msgid "" "Internals detail: For static builtin types, this is always ``NULL``. " "Instead, the dict for such types is stored on ``PyInterpreterState``. Use :c:" "func:`PyType_GetDict` to get the dict for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1751 +#: ../../c-api/typeobj.rst:1764 msgid "" "This field is not inherited by subtypes (though the attributes defined in " "here are inherited through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1756 +#: ../../c-api/typeobj.rst:1769 msgid "" "If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new " "dictionary to it." msgstr "" -#: ../../c-api/typeobj.rst:1761 +#: ../../c-api/typeobj.rst:1774 msgid "" "It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:" "member:`~PyTypeObject.tp_dict` with the dictionary C-API." msgstr "" -#: ../../c-api/typeobj.rst:1767 +#: ../../c-api/typeobj.rst:1780 msgid "An optional pointer to a \"descriptor get\" function." msgstr "" -#: ../../c-api/typeobj.rst:1769 ../../c-api/typeobj.rst:1785 -#: ../../c-api/typeobj.rst:1849 ../../c-api/typeobj.rst:1879 -#: ../../c-api/typeobj.rst:1903 +#: ../../c-api/typeobj.rst:1782 ../../c-api/typeobj.rst:1798 +#: ../../c-api/typeobj.rst:1862 ../../c-api/typeobj.rst:1892 +#: ../../c-api/typeobj.rst:1916 msgid "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1771 +#: ../../c-api/typeobj.rst:1784 msgid "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" msgstr "" "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" -#: ../../c-api/typeobj.rst:1782 +#: ../../c-api/typeobj.rst:1795 msgid "" "An optional pointer to a function for setting and deleting a descriptor's " "value." msgstr "" -#: ../../c-api/typeobj.rst:1787 +#: ../../c-api/typeobj.rst:1800 msgid "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" msgstr "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" -#: ../../c-api/typeobj.rst:1789 +#: ../../c-api/typeobj.rst:1802 msgid "The *value* argument is set to ``NULL`` to delete the value." msgstr "" -#: ../../c-api/typeobj.rst:1800 +#: ../../c-api/typeobj.rst:1813 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_DICT` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1803 +#: ../../c-api/typeobj.rst:1816 msgid "" "If the instances of this type have a dictionary containing instance " "variables, this field is non-zero and contains the offset in the instances " @@ -2940,19 +2953,19 @@ msgid "" "func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:1808 +#: ../../c-api/typeobj.rst:1821 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_dict`; that is " "the dictionary for attributes of the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1811 +#: ../../c-api/typeobj.rst:1824 msgid "" "The value specifies the offset of the dictionary from the start of the " "instance structure." msgstr "" -#: ../../c-api/typeobj.rst:1813 +#: ../../c-api/typeobj.rst:1826 msgid "" "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" "only. To get the pointer to the dictionary call :c:func:" @@ -2961,13 +2974,13 @@ msgid "" "to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" -#: ../../c-api/typeobj.rst:1819 +#: ../../c-api/typeobj.rst:1832 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " "and :c:member:`~PyTypeObject.tp_dictoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1824 +#: ../../c-api/typeobj.rst:1837 msgid "" "This field is inherited by subtypes. A subtype should not override this " "offset; doing so could be unsafe, if C code tries to access the dictionary " @@ -2975,25 +2988,25 @@ msgid "" "`Py_TPFLAGS_MANAGED_DICT`." msgstr "" -#: ../../c-api/typeobj.rst:1831 +#: ../../c-api/typeobj.rst:1844 msgid "" "This slot has no default. For :ref:`static types `, if the " "field is ``NULL`` then no :attr:`~object.__dict__` gets created for " "instances." msgstr "" -#: ../../c-api/typeobj.rst:1834 +#: ../../c-api/typeobj.rst:1847 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_dictoffset` " "will be set to ``-1``, to indicate that it is unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1842 +#: ../../c-api/typeobj.rst:1855 msgid "An optional pointer to an instance initialization function." msgstr "" -#: ../../c-api/typeobj.rst:1844 +#: ../../c-api/typeobj.rst:1857 msgid "" "This function corresponds to the :meth:`~object.__init__` method of " "classes. Like :meth:`!__init__`, it is possible to create an instance " @@ -3001,18 +3014,18 @@ msgid "" "instance by calling its :meth:`!__init__` method again." msgstr "" -#: ../../c-api/typeobj.rst:1851 +#: ../../c-api/typeobj.rst:1864 msgid "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" msgstr "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1853 +#: ../../c-api/typeobj.rst:1866 msgid "" "The self argument is the instance to be initialized; the *args* and *kwds* " "arguments represent positional and keyword arguments of the call to :meth:" "`~object.__init__`." msgstr "" -#: ../../c-api/typeobj.rst:1857 +#: ../../c-api/typeobj.rst:1870 msgid "" "The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called " "when an instance is created normally by calling its type, after the type's :" @@ -3024,53 +3037,53 @@ msgid "" "subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" -#: ../../c-api/typeobj.rst:1864 +#: ../../c-api/typeobj.rst:1877 msgid "Returns ``0`` on success, ``-1`` and sets an exception on error." msgstr "" -#: ../../c-api/typeobj.rst:1872 +#: ../../c-api/typeobj.rst:1885 msgid "" "For :ref:`static types ` this field does not have a default." msgstr "" -#: ../../c-api/typeobj.rst:1877 +#: ../../c-api/typeobj.rst:1890 msgid "An optional pointer to an instance allocation function." msgstr "" -#: ../../c-api/typeobj.rst:1881 +#: ../../c-api/typeobj.rst:1894 msgid "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" msgstr "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" -#: ../../c-api/typeobj.rst:1885 +#: ../../c-api/typeobj.rst:1898 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)." msgstr "" -#: ../../c-api/typeobj.rst:1890 +#: ../../c-api/typeobj.rst:1903 msgid "" "For dynamic subtypes, this field is always set to :c:func:" "`PyType_GenericAlloc`, to force a standard heap allocation strategy." msgstr "" -#: ../../c-api/typeobj.rst:1894 +#: ../../c-api/typeobj.rst:1907 msgid "" "For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:" "`PyType_GenericAlloc`. That is the recommended value for all statically " "defined types." msgstr "" -#: ../../c-api/typeobj.rst:1901 +#: ../../c-api/typeobj.rst:1914 msgid "An optional pointer to an instance creation function." msgstr "" -#: ../../c-api/typeobj.rst:1905 +#: ../../c-api/typeobj.rst:1918 msgid "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" msgstr "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1907 +#: ../../c-api/typeobj.rst:1920 msgid "" "The *subtype* argument is the type of the object being created; the *args* " "and *kwds* arguments represent positional and keyword arguments of the call " @@ -3079,7 +3092,7 @@ msgid "" "that type (but not an unrelated type)." msgstr "" -#: ../../c-api/typeobj.rst:1913 +#: ../../c-api/typeobj.rst:1926 msgid "" "The :c:member:`~PyTypeObject.tp_new` function should call ``subtype-" ">tp_alloc(subtype, nitems)`` to allocate space for the object, and then do " @@ -3091,20 +3104,20 @@ msgid "" "be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" -#: ../../c-api/typeobj.rst:1921 +#: ../../c-api/typeobj.rst:1934 msgid "" "Set the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow " "creating instances of the type in Python." msgstr "" -#: ../../c-api/typeobj.rst:1926 +#: ../../c-api/typeobj.rst:1939 msgid "" "This field is inherited by subtypes, except it is not inherited by :ref:" "`static types ` whose :c:member:`~PyTypeObject.tp_base` is " "``NULL`` or ``&PyBaseObject_Type``." msgstr "" -#: ../../c-api/typeobj.rst:1932 +#: ../../c-api/typeobj.rst:1945 msgid "" "For :ref:`static types ` this field has no default. This means " "if the slot is defined as ``NULL``, the type cannot be called to create new " @@ -3112,44 +3125,44 @@ msgid "" "factory function." msgstr "" -#: ../../c-api/typeobj.rst:1940 +#: ../../c-api/typeobj.rst:1953 msgid "" "An optional pointer to an instance deallocation function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1942 +#: ../../c-api/typeobj.rst:1955 msgid "void tp_free(void *self);" msgstr "void tp_free(void *self);" -#: ../../c-api/typeobj.rst:1944 +#: ../../c-api/typeobj.rst:1957 msgid "" "An initializer that is compatible with this signature is :c:func:" "`PyObject_Free`." msgstr "" -#: ../../c-api/typeobj.rst:1948 +#: ../../c-api/typeobj.rst:1961 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)" msgstr "" -#: ../../c-api/typeobj.rst:1953 +#: ../../c-api/typeobj.rst:1966 msgid "" "In dynamic subtypes, this field is set to a deallocator suitable to match :c:" "func:`PyType_GenericAlloc` and the value of the :c:macro:" "`Py_TPFLAGS_HAVE_GC` flag bit." msgstr "" -#: ../../c-api/typeobj.rst:1957 +#: ../../c-api/typeobj.rst:1970 msgid "" "For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:`PyObject_Del`." msgstr "" -#: ../../c-api/typeobj.rst:1962 +#: ../../c-api/typeobj.rst:1975 msgid "An optional pointer to a function called by the garbage collector." msgstr "" -#: ../../c-api/typeobj.rst:1964 +#: ../../c-api/typeobj.rst:1977 msgid "" "The garbage collector needs to know whether a particular object is " "collectible or not. Normally, it is sufficient to look at the object's " @@ -3161,93 +3174,93 @@ msgid "" "instance. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1972 +#: ../../c-api/typeobj.rst:1985 msgid "int tp_is_gc(PyObject *self);" msgstr "int tp_is_gc(PyObject *self);" -#: ../../c-api/typeobj.rst:1974 +#: ../../c-api/typeobj.rst:1987 msgid "" "(The only example of this are types themselves. The metatype, :c:data:" "`PyType_Type`, defines this function to distinguish between statically and :" "ref:`dynamically allocated types `.)" msgstr "" -#: ../../c-api/typeobj.rst:1984 +#: ../../c-api/typeobj.rst:1997 msgid "" "This slot has no default. If this field is ``NULL``, :c:macro:" "`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." msgstr "" -#: ../../c-api/typeobj.rst:1990 +#: ../../c-api/typeobj.rst:2003 msgid "Tuple of base types." msgstr "" -#: ../../c-api/typeobj.rst:1992 ../../c-api/typeobj.rst:2016 +#: ../../c-api/typeobj.rst:2005 ../../c-api/typeobj.rst:2029 msgid "" "This field should be set to ``NULL`` and treated as read-only. Python will " "fill it in when the type is :c:func:`initialized `." msgstr "" -#: ../../c-api/typeobj.rst:1995 +#: ../../c-api/typeobj.rst:2008 msgid "" "For dynamically created classes, the ``Py_tp_bases`` :c:type:`slot " "` can be used instead of the *bases* argument of :c:func:" "`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" -#: ../../c-api/typeobj.rst:2002 +#: ../../c-api/typeobj.rst:2015 msgid "" "Multiple inheritance does not work well for statically defined types. If you " "set ``tp_bases`` to a tuple, Python will not raise an error, but some slots " "will only be inherited from the first base." msgstr "" -#: ../../c-api/typeobj.rst:2008 ../../c-api/typeobj.rst:2031 -#: ../../c-api/typeobj.rst:2048 ../../c-api/typeobj.rst:2065 -#: ../../c-api/typeobj.rst:2079 +#: ../../c-api/typeobj.rst:2021 ../../c-api/typeobj.rst:2044 +#: ../../c-api/typeobj.rst:2061 ../../c-api/typeobj.rst:2078 +#: ../../c-api/typeobj.rst:2092 msgid "This field is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:2013 +#: ../../c-api/typeobj.rst:2026 msgid "" "Tuple containing the expanded set of base types, starting with the type " "itself and ending with :class:`object`, in Method Resolution Order." msgstr "" -#: ../../c-api/typeobj.rst:2021 +#: ../../c-api/typeobj.rst:2034 msgid "" "This field is not inherited; it is calculated fresh by :c:func:" "`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2027 +#: ../../c-api/typeobj.rst:2040 msgid "Unused. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2036 +#: ../../c-api/typeobj.rst:2049 msgid "" "A collection of subclasses. Internal use only. May be an invalid pointer." msgstr "" -#: ../../c-api/typeobj.rst:2038 +#: ../../c-api/typeobj.rst:2051 msgid "" "To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__`." msgstr "" -#: ../../c-api/typeobj.rst:2043 +#: ../../c-api/typeobj.rst:2056 msgid "" "For some types, this field does not hold a valid :c:expr:`PyObject*`. The " "type was changed to :c:expr:`void*` to indicate this." msgstr "" -#: ../../c-api/typeobj.rst:2053 +#: ../../c-api/typeobj.rst:2066 msgid "" "Weak reference list head, for weak references to this type object. Not " "inherited. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2058 +#: ../../c-api/typeobj.rst:2071 msgid "" "Internals detail: For the static builtin types this is always ``NULL``, even " "if weakrefs are added. Instead, the weakrefs for each are stored on " @@ -3255,25 +3268,25 @@ msgid "" "``_PyObject_GET_WEAKREFS_LISTPTR()`` macro to avoid the distinction." msgstr "" -#: ../../c-api/typeobj.rst:2070 +#: ../../c-api/typeobj.rst:2083 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." msgstr "" -#: ../../c-api/typeobj.rst:2075 +#: ../../c-api/typeobj.rst:2088 msgid "Used to index into the method cache. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2084 +#: ../../c-api/typeobj.rst:2097 msgid "" "An optional pointer to an instance finalization function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2086 +#: ../../c-api/typeobj.rst:2099 msgid "void tp_finalize(PyObject *self);" msgstr "void tp_finalize(PyObject *self);" -#: ../../c-api/typeobj.rst:2088 +#: ../../c-api/typeobj.rst:2101 msgid "" "If :c:member:`~PyTypeObject.tp_finalize` is set, the interpreter calls it " "once when finalizing an instance. It is called either from the garbage " @@ -3283,14 +3296,14 @@ msgid "" "object in a sane state." msgstr "" -#: ../../c-api/typeobj.rst:2095 +#: ../../c-api/typeobj.rst:2108 msgid "" ":c:member:`~PyTypeObject.tp_finalize` should not mutate the current " "exception status; therefore, a recommended way to write a non-trivial " "finalizer is::" msgstr "" -#: ../../c-api/typeobj.rst:2098 +#: ../../c-api/typeobj.rst:2111 msgid "" "static void\n" "local_finalize(PyObject *self)\n" @@ -3307,31 +3320,18 @@ msgid "" "}" msgstr "" -#: ../../c-api/typeobj.rst:2112 -msgid "" -"Also, note that, in a garbage collected Python, :c:member:`~PyTypeObject." -"tp_dealloc` may be called from any Python thread, not just the thread which " -"created the object (if the object becomes part of a refcount cycle, that " -"cycle might be collected by a garbage collection on any thread). This is " -"not a problem for Python API calls, since the thread on which tp_dealloc is " -"called will own the Global Interpreter Lock (GIL). However, if the object " -"being destroyed in turn destroys objects from some other C or C++ library, " -"care should be taken to ensure that destroying those objects on the thread " -"which called tp_dealloc will not violate any assumptions of the library." -msgstr "" - -#: ../../c-api/typeobj.rst:2131 +#: ../../c-api/typeobj.rst:2133 msgid "" "Before version 3.8 it was necessary to set the :c:macro:" "`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be used. " "This is no longer required." msgstr "" -#: ../../c-api/typeobj.rst:2135 +#: ../../c-api/typeobj.rst:2137 msgid "\"Safe object finalization\" (:pep:`442`)" msgstr "" -#: ../../c-api/typeobj.rst:2140 +#: ../../c-api/typeobj.rst:2142 msgid "" "Vectorcall function to use for calls of this type object. In other words, it " "is used to implement :ref:`vectorcall ` for ``type.__call__``. " @@ -3339,65 +3339,65 @@ msgid "" "meth:`~object.__new__` and :meth:`~object.__init__` is used." msgstr "" -#: ../../c-api/typeobj.rst:2148 +#: ../../c-api/typeobj.rst:2150 msgid "This field is never inherited." msgstr "" -#: ../../c-api/typeobj.rst:2150 +#: ../../c-api/typeobj.rst:2152 msgid "(the field exists since 3.8 but it's only used since 3.9)" msgstr "" -#: ../../c-api/typeobj.rst:2155 +#: ../../c-api/typeobj.rst:2157 msgid "Internal. Do not use." msgstr "" -#: ../../c-api/typeobj.rst:2163 +#: ../../c-api/typeobj.rst:2165 msgid "Static Types" msgstr "" -#: ../../c-api/typeobj.rst:2165 +#: ../../c-api/typeobj.rst:2167 msgid "" "Traditionally, types defined in C code are *static*, that is, a static :c:" "type:`PyTypeObject` structure is defined directly in code and initialized " "using :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2169 +#: ../../c-api/typeobj.rst:2171 msgid "" "This results in types that are limited relative to types defined in Python:" msgstr "" -#: ../../c-api/typeobj.rst:2171 +#: ../../c-api/typeobj.rst:2173 msgid "" "Static types are limited to one base, i.e. they cannot use multiple " "inheritance." msgstr "" -#: ../../c-api/typeobj.rst:2173 +#: ../../c-api/typeobj.rst:2175 msgid "" "Static type objects (but not necessarily their instances) are immutable. It " "is not possible to add or modify the type object's attributes from Python." msgstr "" -#: ../../c-api/typeobj.rst:2175 +#: ../../c-api/typeobj.rst:2177 msgid "" "Static type objects are shared across :ref:`sub-interpreters `, so they should not include any subinterpreter-" "specific state." msgstr "" -#: ../../c-api/typeobj.rst:2179 +#: ../../c-api/typeobj.rst:2181 msgid "" "Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API " "` as an opaque struct, any extension modules using static " "types must be compiled for a specific Python minor version." msgstr "" -#: ../../c-api/typeobj.rst:2187 +#: ../../c-api/typeobj.rst:2189 msgid "Heap Types" msgstr "" -#: ../../c-api/typeobj.rst:2189 +#: ../../c-api/typeobj.rst:2191 msgid "" "An alternative to :ref:`static types ` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " @@ -3405,29 +3405,29 @@ msgid "" "`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" -#: ../../c-api/typeobj.rst:2194 +#: ../../c-api/typeobj.rst:2196 msgid "" "This is done by filling a :c:type:`PyType_Spec` structure and calling :c:" "func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:" "`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`." msgstr "" -#: ../../c-api/typeobj.rst:2202 +#: ../../c-api/typeobj.rst:2204 msgid "Number Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2209 +#: ../../c-api/typeobj.rst:2211 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the number protocol. Each function is used by the function of " "similar name documented in the :ref:`number` section." msgstr "" -#: ../../c-api/typeobj.rst:2215 ../../c-api/typeobj.rst:2539 +#: ../../c-api/typeobj.rst:2217 ../../c-api/typeobj.rst:2541 msgid "Here is the structure definition::" msgstr "" -#: ../../c-api/typeobj.rst:2217 +#: ../../c-api/typeobj.rst:2219 msgid "" "typedef struct {\n" " binaryfunc nb_add;\n" @@ -3515,7 +3515,7 @@ msgstr "" " binaryfunc nb_inplace_matrix_multiply;\n" "} PyNumberMethods;" -#: ../../c-api/typeobj.rst:2262 +#: ../../c-api/typeobj.rst:2264 msgid "" "Binary and ternary functions must check the type of all their operands, and " "implement the necessary conversions (at least one of the operands is an " @@ -3525,31 +3525,31 @@ msgid "" "and set an exception." msgstr "" -#: ../../c-api/typeobj.rst:2271 +#: ../../c-api/typeobj.rst:2273 msgid "" "The :c:member:`~PyNumberMethods.nb_reserved` field should always be " "``NULL``. It was previously called :c:member:`!nb_long`, and was renamed in " "Python 3.0.1." msgstr "" -#: ../../c-api/typeobj.rst:2316 +#: ../../c-api/typeobj.rst:2318 msgid "Mapping Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2323 +#: ../../c-api/typeobj.rst:2325 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the mapping protocol. It has three members:" msgstr "" -#: ../../c-api/typeobj.rst:2328 +#: ../../c-api/typeobj.rst:2330 msgid "" "This function is used by :c:func:`PyMapping_Size` and :c:func:" "`PyObject_Size`, and has the same signature. This slot may be set to " "``NULL`` if the object has no defined length." msgstr "" -#: ../../c-api/typeobj.rst:2334 +#: ../../c-api/typeobj.rst:2336 msgid "" "This function is used by :c:func:`PyObject_GetItem` and :c:func:" "`PySequence_GetSlice`, and has the same signature as :c:func:`!" @@ -3557,7 +3557,7 @@ msgid "" "`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2342 +#: ../../c-api/typeobj.rst:2344 msgid "" "This function is used by :c:func:`PyObject_SetItem`, :c:func:" "`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:" @@ -3567,17 +3567,17 @@ msgid "" "deletion." msgstr "" -#: ../../c-api/typeobj.rst:2353 +#: ../../c-api/typeobj.rst:2355 msgid "Sequence Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2360 +#: ../../c-api/typeobj.rst:2362 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the sequence protocol." msgstr "" -#: ../../c-api/typeobj.rst:2365 +#: ../../c-api/typeobj.rst:2367 msgid "" "This function is used by :c:func:`PySequence_Size` and :c:func:" "`PyObject_Size`, and has the same signature. It is also used for handling " @@ -3585,21 +3585,21 @@ msgid "" "member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" -#: ../../c-api/typeobj.rst:2372 +#: ../../c-api/typeobj.rst:2374 msgid "" "This function is used by :c:func:`PySequence_Concat` and has the same " "signature. It is also used by the ``+`` operator, after trying the numeric " "addition via the :c:member:`~PyNumberMethods.nb_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2378 +#: ../../c-api/typeobj.rst:2380 msgid "" "This function is used by :c:func:`PySequence_Repeat` and has the same " "signature. It is also used by the ``*`` operator, after trying numeric " "multiplication via the :c:member:`~PyNumberMethods.nb_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2384 +#: ../../c-api/typeobj.rst:2386 msgid "" "This function is used by :c:func:`PySequence_GetItem` and has the same " "signature. It is also used by :c:func:`PyObject_GetItem`, after trying the " @@ -3608,7 +3608,7 @@ msgid "" "``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2390 +#: ../../c-api/typeobj.rst:2392 msgid "" "Negative indexes are handled as follows: if the :c:member:" "`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " @@ -3617,7 +3617,7 @@ msgid "" "index is passed as is to the function." msgstr "" -#: ../../c-api/typeobj.rst:2397 +#: ../../c-api/typeobj.rst:2399 msgid "" "This function is used by :c:func:`PySequence_SetItem` and has the same " "signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:" @@ -3626,14 +3626,14 @@ msgid "" "``NULL`` if the object does not support item assignment and deletion." msgstr "" -#: ../../c-api/typeobj.rst:2406 +#: ../../c-api/typeobj.rst:2408 msgid "" "This function may be used by :c:func:`PySequence_Contains` and has the same " "signature. This slot may be left to ``NULL``, in this case :c:func:`!" "PySequence_Contains` simply traverses the sequence until it finds a match." msgstr "" -#: ../../c-api/typeobj.rst:2413 +#: ../../c-api/typeobj.rst:2415 msgid "" "This function is used by :c:func:`PySequence_InPlaceConcat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -3643,7 +3643,7 @@ msgid "" "c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2422 +#: ../../c-api/typeobj.rst:2424 msgid "" "This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -3653,76 +3653,76 @@ msgid "" "via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2433 +#: ../../c-api/typeobj.rst:2435 msgid "Buffer Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2441 +#: ../../c-api/typeobj.rst:2443 msgid "" "This structure holds pointers to the functions required by the :ref:`Buffer " "protocol `. The protocol defines how an exporter object can " "expose its internal data to consumer objects." msgstr "" -#: ../../c-api/typeobj.rst:2447 ../../c-api/typeobj.rst:2496 -#: ../../c-api/typeobj.rst:2550 ../../c-api/typeobj.rst:2561 -#: ../../c-api/typeobj.rst:2573 ../../c-api/typeobj.rst:2583 +#: ../../c-api/typeobj.rst:2449 ../../c-api/typeobj.rst:2498 +#: ../../c-api/typeobj.rst:2552 ../../c-api/typeobj.rst:2563 +#: ../../c-api/typeobj.rst:2575 ../../c-api/typeobj.rst:2585 msgid "The signature of this function is::" msgstr "" -#: ../../c-api/typeobj.rst:2449 +#: ../../c-api/typeobj.rst:2451 msgid "int (PyObject *exporter, Py_buffer *view, int flags);" msgstr "int (PyObject *exporter, Py_buffer *view, int flags);" -#: ../../c-api/typeobj.rst:2451 +#: ../../c-api/typeobj.rst:2453 msgid "" "Handle a request to *exporter* to fill in *view* as specified by *flags*. " "Except for point (3), an implementation of this function MUST take these " "steps:" msgstr "" -#: ../../c-api/typeobj.rst:2455 +#: ../../c-api/typeobj.rst:2457 msgid "" "Check if the request can be met. If not, raise :exc:`BufferError`, set :c:" "expr:`view->obj` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:2458 +#: ../../c-api/typeobj.rst:2460 msgid "Fill in the requested fields." msgstr "" -#: ../../c-api/typeobj.rst:2460 +#: ../../c-api/typeobj.rst:2462 msgid "Increment an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2462 +#: ../../c-api/typeobj.rst:2464 msgid "" "Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`." msgstr "" -#: ../../c-api/typeobj.rst:2464 +#: ../../c-api/typeobj.rst:2466 msgid "Return ``0``." msgstr "回傳 ``0``。" -#: ../../c-api/typeobj.rst:2466 +#: ../../c-api/typeobj.rst:2468 msgid "" "If *exporter* is part of a chain or tree of buffer providers, two main " "schemes can be used:" msgstr "" -#: ../../c-api/typeobj.rst:2469 +#: ../../c-api/typeobj.rst:2471 msgid "" "Re-export: Each member of the tree acts as the exporting object and sets :c:" "expr:`view->obj` to a new reference to itself." msgstr "" -#: ../../c-api/typeobj.rst:2472 +#: ../../c-api/typeobj.rst:2474 msgid "" "Redirect: The buffer request is redirected to the root object of the tree. " "Here, :c:expr:`view->obj` will be a new reference to the root object." msgstr "" -#: ../../c-api/typeobj.rst:2476 +#: ../../c-api/typeobj.rst:2478 msgid "" "The individual fields of *view* are described in section :ref:`Buffer " "structure `, the rules how an exporter must react to " @@ -3730,7 +3730,7 @@ msgid "" "types>`." msgstr "" -#: ../../c-api/typeobj.rst:2481 +#: ../../c-api/typeobj.rst:2483 msgid "" "All memory pointed to in the :c:type:`Py_buffer` structure belongs to the " "exporter and must remain valid until there are no consumers left. :c:member:" @@ -3739,23 +3739,23 @@ msgid "" "internal` are read-only for the consumer." msgstr "" -#: ../../c-api/typeobj.rst:2488 +#: ../../c-api/typeobj.rst:2490 msgid "" ":c:func:`PyBuffer_FillInfo` provides an easy way of exposing a simple bytes " "buffer while dealing correctly with all request types." msgstr "" -#: ../../c-api/typeobj.rst:2491 +#: ../../c-api/typeobj.rst:2493 msgid "" ":c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps " "this function." msgstr "" -#: ../../c-api/typeobj.rst:2498 +#: ../../c-api/typeobj.rst:2500 msgid "void (PyObject *exporter, Py_buffer *view);" msgstr "void (PyObject *exporter, Py_buffer *view);" -#: ../../c-api/typeobj.rst:2500 +#: ../../c-api/typeobj.rst:2502 msgid "" "Handle a request to release the resources of the buffer. If no resources " "need to be released, :c:member:`PyBufferProcs.bf_releasebuffer` may be " @@ -3763,15 +3763,15 @@ msgid "" "these optional steps:" msgstr "" -#: ../../c-api/typeobj.rst:2505 +#: ../../c-api/typeobj.rst:2507 msgid "Decrement an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2507 +#: ../../c-api/typeobj.rst:2509 msgid "If the counter is ``0``, free all memory associated with *view*." msgstr "" -#: ../../c-api/typeobj.rst:2509 +#: ../../c-api/typeobj.rst:2511 msgid "" "The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep " "track of buffer-specific resources. This field is guaranteed to remain " @@ -3779,30 +3779,30 @@ msgid "" "*view* argument." msgstr "" -#: ../../c-api/typeobj.rst:2515 +#: ../../c-api/typeobj.rst:2517 msgid "" "This function MUST NOT decrement :c:expr:`view->obj`, since that is done " "automatically in :c:func:`PyBuffer_Release` (this scheme is useful for " "breaking reference cycles)." msgstr "" -#: ../../c-api/typeobj.rst:2520 +#: ../../c-api/typeobj.rst:2522 msgid "" ":c:func:`PyBuffer_Release` is the interface for the consumer that wraps this " "function." msgstr "" -#: ../../c-api/typeobj.rst:2528 +#: ../../c-api/typeobj.rst:2530 msgid "Async Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2536 +#: ../../c-api/typeobj.rst:2538 msgid "" "This structure holds pointers to the functions required to implement :term:" "`awaitable` and :term:`asynchronous iterator` objects." msgstr "" -#: ../../c-api/typeobj.rst:2541 +#: ../../c-api/typeobj.rst:2543 msgid "" "typedef struct {\n" " unaryfunc am_await;\n" @@ -3818,62 +3818,62 @@ msgstr "" " sendfunc am_send;\n" "} PyAsyncMethods;" -#: ../../c-api/typeobj.rst:2552 +#: ../../c-api/typeobj.rst:2554 msgid "PyObject *am_await(PyObject *self);" msgstr "" -#: ../../c-api/typeobj.rst:2554 +#: ../../c-api/typeobj.rst:2556 msgid "" "The returned object must be an :term:`iterator`, i.e. :c:func:`PyIter_Check` " "must return ``1`` for it." msgstr "" -#: ../../c-api/typeobj.rst:2557 +#: ../../c-api/typeobj.rst:2559 msgid "" "This slot may be set to ``NULL`` if an object is not an :term:`awaitable`." msgstr "" -#: ../../c-api/typeobj.rst:2563 +#: ../../c-api/typeobj.rst:2565 msgid "PyObject *am_aiter(PyObject *self);" msgstr "PyObject *am_aiter(PyObject *self);" -#: ../../c-api/typeobj.rst:2565 +#: ../../c-api/typeobj.rst:2567 msgid "" "Must return an :term:`asynchronous iterator` object. See :meth:`~object." "__anext__` for details." msgstr "" -#: ../../c-api/typeobj.rst:2568 +#: ../../c-api/typeobj.rst:2570 msgid "" "This slot may be set to ``NULL`` if an object does not implement " "asynchronous iteration protocol." msgstr "" -#: ../../c-api/typeobj.rst:2575 +#: ../../c-api/typeobj.rst:2577 msgid "PyObject *am_anext(PyObject *self);" msgstr "PyObject *am_anext(PyObject *self);" -#: ../../c-api/typeobj.rst:2577 +#: ../../c-api/typeobj.rst:2579 msgid "" "Must return an :term:`awaitable` object. See :meth:`~object.__anext__` for " "details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2585 +#: ../../c-api/typeobj.rst:2587 msgid "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" msgstr "" "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" -#: ../../c-api/typeobj.rst:2587 +#: ../../c-api/typeobj.rst:2589 msgid "" "See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2596 +#: ../../c-api/typeobj.rst:2598 msgid "Slot Type typedefs" msgstr "" -#: ../../c-api/typeobj.rst:2600 +#: ../../c-api/typeobj.rst:2602 msgid "" "The purpose of this function is to separate memory allocation from memory " "initialization. It should return a pointer to a block of memory of adequate " @@ -3887,80 +3887,80 @@ msgid "" "length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:2610 +#: ../../c-api/typeobj.rst:2612 msgid "" "This function should not do any other instance initialization, not even to " "allocate additional memory; that should be done by :c:member:`~PyTypeObject." "tp_new`." msgstr "" -#: ../../c-api/typeobj.rst:2617 +#: ../../c-api/typeobj.rst:2619 msgid "See :c:member:`~PyTypeObject.tp_free`." msgstr "請見 :c:member:`~PyTypeObject.tp_free`。" -#: ../../c-api/typeobj.rst:2621 +#: ../../c-api/typeobj.rst:2623 msgid "See :c:member:`~PyTypeObject.tp_new`." msgstr "請見 :c:member:`~PyTypeObject.tp_new`。" -#: ../../c-api/typeobj.rst:2625 +#: ../../c-api/typeobj.rst:2627 msgid "See :c:member:`~PyTypeObject.tp_init`." msgstr "請見 :c:member:`~PyTypeObject.tp_init`。" -#: ../../c-api/typeobj.rst:2629 +#: ../../c-api/typeobj.rst:2631 msgid "See :c:member:`~PyTypeObject.tp_repr`." msgstr "請見 :c:member:`~PyTypeObject.tp_repr`。" -#: ../../c-api/typeobj.rst:2633 ../../c-api/typeobj.rst:2642 +#: ../../c-api/typeobj.rst:2635 ../../c-api/typeobj.rst:2644 msgid "Return the value of the named attribute for the object." msgstr "" -#: ../../c-api/typeobj.rst:2637 ../../c-api/typeobj.rst:2648 +#: ../../c-api/typeobj.rst:2639 ../../c-api/typeobj.rst:2650 msgid "" "Set the value of the named attribute for the object. The value argument is " "set to ``NULL`` to delete the attribute." msgstr "" -#: ../../c-api/typeobj.rst:2644 +#: ../../c-api/typeobj.rst:2646 msgid "See :c:member:`~PyTypeObject.tp_getattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_getattro`。" -#: ../../c-api/typeobj.rst:2651 +#: ../../c-api/typeobj.rst:2653 msgid "See :c:member:`~PyTypeObject.tp_setattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_setattro`。" -#: ../../c-api/typeobj.rst:2655 +#: ../../c-api/typeobj.rst:2657 msgid "See :c:member:`~PyTypeObject.tp_descr_get`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_get`。" -#: ../../c-api/typeobj.rst:2659 +#: ../../c-api/typeobj.rst:2661 msgid "See :c:member:`~PyTypeObject.tp_descr_set`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_set`。" -#: ../../c-api/typeobj.rst:2663 +#: ../../c-api/typeobj.rst:2665 msgid "See :c:member:`~PyTypeObject.tp_hash`." msgstr "請見 :c:member:`~PyTypeObject.tp_hash`。" -#: ../../c-api/typeobj.rst:2667 +#: ../../c-api/typeobj.rst:2669 msgid "See :c:member:`~PyTypeObject.tp_richcompare`." msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" -#: ../../c-api/typeobj.rst:2671 +#: ../../c-api/typeobj.rst:2673 msgid "See :c:member:`~PyTypeObject.tp_iter`." msgstr "請見 :c:member:`~PyTypeObject.tp_iter`。" -#: ../../c-api/typeobj.rst:2675 +#: ../../c-api/typeobj.rst:2677 msgid "See :c:member:`~PyTypeObject.tp_iternext`." msgstr "請見 :c:member:`~PyTypeObject.tp_iternext`。" -#: ../../c-api/typeobj.rst:2689 +#: ../../c-api/typeobj.rst:2691 msgid "See :c:member:`~PyAsyncMethods.am_send`." msgstr "請見 :c:member:`~PyAsyncMethods.am_send`。" -#: ../../c-api/typeobj.rst:2705 +#: ../../c-api/typeobj.rst:2707 msgid "Examples" msgstr "範例" -#: ../../c-api/typeobj.rst:2707 +#: ../../c-api/typeobj.rst:2709 msgid "" "The following are simple examples of Python type definitions. They include " "common usage you may encounter. Some demonstrate tricky corner cases. For " @@ -3968,11 +3968,11 @@ msgid "" "and :ref:`new-types-topics`." msgstr "" -#: ../../c-api/typeobj.rst:2712 +#: ../../c-api/typeobj.rst:2714 msgid "A basic :ref:`static type `::" msgstr "" -#: ../../c-api/typeobj.rst:2714 +#: ../../c-api/typeobj.rst:2716 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -3990,13 +3990,13 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2729 +#: ../../c-api/typeobj.rst:2731 msgid "" "You may also find older code (especially in the CPython code base) with a " "more verbose initializer::" msgstr "" -#: ../../c-api/typeobj.rst:2732 +#: ../../c-api/typeobj.rst:2734 msgid "" "static PyTypeObject MyObject_Type = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -4080,11 +4080,11 @@ msgstr "" " myobj_new, /* tp_new */\n" "};" -#: ../../c-api/typeobj.rst:2773 +#: ../../c-api/typeobj.rst:2775 msgid "A type that supports weakrefs, instance dicts, and hashing::" msgstr "" -#: ../../c-api/typeobj.rst:2775 +#: ../../c-api/typeobj.rst:2777 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4110,14 +4110,14 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2798 +#: ../../c-api/typeobj.rst:2800 msgid "" "A str subclass that cannot be subclassed and cannot be called to create " "instances (e.g. uses a separate factory func) using :c:macro:" "`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" -#: ../../c-api/typeobj.rst:2802 +#: ../../c-api/typeobj.rst:2804 msgid "" "typedef struct {\n" " PyUnicodeObject raw;\n" @@ -4135,12 +4135,12 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2817 +#: ../../c-api/typeobj.rst:2819 msgid "" "The simplest :ref:`static type ` with fixed-length instances::" msgstr "" -#: ../../c-api/typeobj.rst:2819 +#: ../../c-api/typeobj.rst:2821 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4160,13 +4160,13 @@ msgstr "" " .tp_name = \"mymod.MyObject\",\n" "};" -#: ../../c-api/typeobj.rst:2828 +#: ../../c-api/typeobj.rst:2830 msgid "" "The simplest :ref:`static type ` with variable-length " "instances::" msgstr "" -#: ../../c-api/typeobj.rst:2830 +#: ../../c-api/typeobj.rst:2832 msgid "" "typedef struct {\n" " PyObject_VAR_HEAD\n" @@ -4192,14 +4192,14 @@ msgstr "" " .tp_itemsize = sizeof(char *),\n" "};" -#: ../../c-api/typeobj.rst:787 ../../c-api/typeobj.rst:852 +#: ../../c-api/typeobj.rst:800 ../../c-api/typeobj.rst:865 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/typeobj.rst:787 +#: ../../c-api/typeobj.rst:800 msgid "repr" msgstr "repr" -#: ../../c-api/typeobj.rst:852 +#: ../../c-api/typeobj.rst:865 msgid "hash" msgstr "hash(雜湊)" diff --git a/deprecations/c-api-pending-removal-in-3.15.po b/deprecations/c-api-pending-removal-in-3.15.po index 1c765579a9..e8ab611316 100644 --- a/deprecations/c-api-pending-removal-in-3.15.po +++ b/deprecations/c-api-pending-removal-in-3.15.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -61,16 +61,24 @@ msgstr "" "data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 -msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." -msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" +msgid "" +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." +"exec_prefix` instead." +msgstr "" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" +"`sys.exec_prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 -msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." -msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" +msgid "" +":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " +"instead." +msgstr "" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." +"prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." diff --git a/deprecations/index.po b/deprecations/index.po index 24c3129544..9d2c3b3c16 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2024-11-10 17:21+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,22 +25,6 @@ msgid "Pending Removal in Python 3.14" msgstr "Python 3.14 中待移除的項目" #: ../../deprecations/pending-removal-in-3.14.rst:4 -#: ../../deprecations/pending-removal-in-3.15.rst:4 -msgid "The import system:" -msgstr "引入系統 (import system):" - -#: ../../deprecations/pending-removal-in-3.14.rst:6 -msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" -"`__spec__.loader ` is deprecated. In " -"Python 3.14, :attr:`!__loader__` will cease to be set or taken into " -"consideration by the import system or the standard library." -msgstr "" -"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " -"` 的做法已被棄用。在 Python 3.14 中," -"引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__` 。" - -#: ../../deprecations/pending-removal-in-3.14.rst:11 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" "argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " @@ -50,7 +34,7 @@ msgstr "" "*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " "於 :gh:`92248` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:16 +#: ../../deprecations/pending-removal-in-3.14.rst:9 msgid "" ":mod:`ast`: The following features have been deprecated in documentation " "since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " @@ -59,38 +43,39 @@ msgstr "" ":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時會" "於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" -#: ../../deprecations/pending-removal-in-3.14.rst:20 +#: ../../deprecations/pending-removal-in-3.14.rst:13 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" -#: ../../deprecations/pending-removal-in-3.14.rst:21 +#: ../../deprecations/pending-removal-in-3.14.rst:14 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" -#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.14.rst:15 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" -#: ../../deprecations/pending-removal-in-3.14.rst:23 +#: ../../deprecations/pending-removal-in-3.14.rst:16 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" -#: ../../deprecations/pending-removal-in-3.14.rst:24 +#: ../../deprecations/pending-removal-in-3.14.rst:17 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" -#: ../../deprecations/pending-removal-in-3.14.rst:26 +#: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" "`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:29 +#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.16.rst:19 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" -#: ../../deprecations/pending-removal-in-3.14.rst:31 +#: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" "The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" "`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" @@ -102,7 +87,7 @@ msgstr "" "AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " "Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:37 +#: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" "`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." @@ -114,7 +99,7 @@ msgstr "" "AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" "除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:43 +#: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " "now emits a :exc:`DeprecationWarning` if there is no current event loop set " @@ -125,7 +110,7 @@ msgstr "" "件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:48 +#: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " @@ -137,7 +122,7 @@ msgstr "" "改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " "Shantanu Jain 於 :gh:`91896` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:54 +#: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" ":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" @@ -145,39 +130,39 @@ msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:50 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:60 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:63 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:65 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:68 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:70 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -188,7 +173,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:76 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -205,7 +190,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -213,7 +198,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:88 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -223,27 +208,27 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:93 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:95 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../deprecations/pending-removal-in-3.14.rst:100 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -253,27 +238,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:106 -msgid "" -"date and datetime adapter, date and timestamp converter: see the :mod:" -"`sqlite3` documentation for suggested replacement recipes." -msgstr "" -"date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" -"參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" - -#: ../../deprecations/pending-removal-in-3.14.rst:109 -msgid "" -":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " -"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " -"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " -"in 3.14. (Contributed by Nikita Sobolev in :gh:`101866`.)" -msgstr "" -":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" -"exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" -"`101866` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:116 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -281,7 +246,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:119 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -295,6 +260,11 @@ msgstr "" msgid "Pending Removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" +#: ../../deprecations/pending-removal-in-3.15.rst:4 +#: ../../deprecations/pending-removal-in-3.16.rst:4 +msgid "The import system:" +msgstr "引入系統 (import system):" + #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" "Setting :attr:`~module.__cached__` on a module while failing to set :attr:" @@ -408,10 +378,26 @@ msgstr "" "任意數量的位置或關鍵字引數,並忽略每個引數。" #: ../../deprecations/pending-removal-in-3.15.rst:62 +msgid ":mod:`types`:" +msgstr ":mod:`types`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:64 +msgid "" +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" +msgstr "" +":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.15.rst:64 +#: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -422,7 +408,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:70 +#: ../../deprecations/pending-removal-in-3.15.rst:79 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -432,11 +418,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:75 +#: ../../deprecations/pending-removal-in-3.15.rst:84 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:77 +#: ../../deprecations/pending-removal-in-3.15.rst:86 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -447,32 +433,25 @@ msgstr "" "getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 -msgid "Pending Removal in Python 3.16" +msgid "Pending removal in Python 3.16" msgstr "Python 3.16 中待移除的項目" -#: ../../deprecations/pending-removal-in-3.16.rst:4 -#: ../../deprecations/pending-removal-in-future.rst:12 -msgid ":mod:`builtins`:" -msgstr ":mod:`builtins`:" - #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " -"deprecated since Python 3.12, as it produces surprising and unintuitive " -"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " -"of a Boolean. In the rare case that you need the bitwise inversion of the " -"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." msgstr "" -"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" -"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" -"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " -"``~int(x)`` (``~int(x)``)。" +"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " +"` 的做法將於 Python 3.16 被棄用。在 " +"Python 3.16 中,引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__`。" -#: ../../deprecations/pending-removal-in-3.16.rst:13 +#: ../../deprecations/pending-removal-in-3.16.rst:11 msgid ":mod:`array`:" msgstr ":mod:`array`:" -#: ../../deprecations/pending-removal-in-3.16.rst:15 +#: ../../deprecations/pending-removal-in-3.16.rst:13 msgid "" "The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " "documentation since Python 3.3 and at runtime since Python 3.13. Use the " @@ -483,10 +462,35 @@ msgstr "" "來取代 Unicode 字元。" #: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid "" +":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " +"Python 3.16, use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"by Jiahao Li and Kumar Aditya in :gh:`122875`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:26 +#: ../../deprecations/pending-removal-in-future.rst:12 +msgid ":mod:`builtins`:" +msgstr ":mod:`builtins`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:28 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" +"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" +"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" +"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " +"``~int(x)`` (``~int(x)``)。" + +#: ../../deprecations/pending-removal-in-3.16.rst:35 msgid ":mod:`shutil`:" msgstr ":mod:`shutil`:" -#: ../../deprecations/pending-removal-in-3.16.rst:23 +#: ../../deprecations/pending-removal-in-3.16.rst:37 msgid "" "The :class:`!ExecError` exception has been deprecated since Python 3.14. It " "has not been used by any function in :mod:`!shutil` since Python 3.4, and is " @@ -495,11 +499,11 @@ msgstr "" "自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" "未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" -#: ../../deprecations/pending-removal-in-3.16.rst:28 +#: ../../deprecations/pending-removal-in-3.16.rst:42 msgid ":mod:`symtable`:" msgstr ":mod:`symtable`:" -#: ../../deprecations/pending-removal-in-3.16.rst:30 +#: ../../deprecations/pending-removal-in-3.16.rst:44 msgid "" "The :meth:`Class.get_methods ` method has been " "deprecated since Python 3.14." @@ -507,11 +511,11 @@ msgstr "" "自 Python 3.14 起,:meth:`Class.get_methods ` 方" "法已被棄用。" -#: ../../deprecations/pending-removal-in-3.16.rst:33 +#: ../../deprecations/pending-removal-in-3.16.rst:47 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" -#: ../../deprecations/pending-removal-in-3.16.rst:35 +#: ../../deprecations/pending-removal-in-3.16.rst:49 msgid "" "The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " "since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " @@ -520,11 +524,11 @@ msgstr "" "自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" "請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" -#: ../../deprecations/pending-removal-in-3.16.rst:39 +#: ../../deprecations/pending-removal-in-3.16.rst:53 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" -#: ../../deprecations/pending-removal-in-3.16.rst:41 +#: ../../deprecations/pending-removal-in-3.16.rst:55 msgid "" "The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " "deprecated since Python 3.13." @@ -1182,16 +1186,24 @@ msgstr "" "data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 -msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." -msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" +msgid "" +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." +"exec_prefix` instead." +msgstr "" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" +"`sys.exec_prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 -msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." -msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" +msgid "" +":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " +"instead." +msgstr "" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." +"prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." @@ -1339,3 +1351,10 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-future.rst:50 msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" + +#~ msgid "" +#~ "date and datetime adapter, date and timestamp converter: see the :mod:" +#~ "`sqlite3` documentation for suggested replacement recipes." +#~ msgstr "" +#~ "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 " +#~ "(converter):請參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" diff --git a/deprecations/pending-removal-in-3.14.po b/deprecations/pending-removal-in-3.14.po index a552eb8e16..c471f0275a 100644 --- a/deprecations/pending-removal-in-3.14.po +++ b/deprecations/pending-removal-in-3.14.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-15 00:14+0000\n" +"POT-Creation-Date: 2024-11-10 17:21+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,21 +20,6 @@ msgid "Pending Removal in Python 3.14" msgstr "Python 3.14 中待移除的項目" #: ../../deprecations/pending-removal-in-3.14.rst:4 -msgid "The import system:" -msgstr "引入系統 (import system):" - -#: ../../deprecations/pending-removal-in-3.14.rst:6 -msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" -"`__spec__.loader ` is deprecated. In " -"Python 3.14, :attr:`!__loader__` will cease to be set or taken into " -"consideration by the import system or the standard library." -msgstr "" -"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " -"` 的做法已被棄用。在 Python 3.14 中," -"引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__` 。" - -#: ../../deprecations/pending-removal-in-3.14.rst:11 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" "argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " @@ -44,7 +29,7 @@ msgstr "" "*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " "於 :gh:`92248` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:16 +#: ../../deprecations/pending-removal-in-3.14.rst:9 msgid "" ":mod:`ast`: The following features have been deprecated in documentation " "since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " @@ -53,38 +38,38 @@ msgstr "" ":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時會" "於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" -#: ../../deprecations/pending-removal-in-3.14.rst:20 +#: ../../deprecations/pending-removal-in-3.14.rst:13 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" -#: ../../deprecations/pending-removal-in-3.14.rst:21 +#: ../../deprecations/pending-removal-in-3.14.rst:14 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" -#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.14.rst:15 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" -#: ../../deprecations/pending-removal-in-3.14.rst:23 +#: ../../deprecations/pending-removal-in-3.14.rst:16 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" -#: ../../deprecations/pending-removal-in-3.14.rst:24 +#: ../../deprecations/pending-removal-in-3.14.rst:17 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" -#: ../../deprecations/pending-removal-in-3.14.rst:26 +#: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" "`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:29 +#: ../../deprecations/pending-removal-in-3.14.rst:22 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" -#: ../../deprecations/pending-removal-in-3.14.rst:31 +#: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" "The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" "`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" @@ -96,7 +81,7 @@ msgstr "" "AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " "Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:37 +#: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" "`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." @@ -108,7 +93,7 @@ msgstr "" "AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" "除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:43 +#: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " "now emits a :exc:`DeprecationWarning` if there is no current event loop set " @@ -119,7 +104,7 @@ msgstr "" "件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:48 +#: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " @@ -131,7 +116,7 @@ msgstr "" "改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " "Shantanu Jain 於 :gh:`91896` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:54 +#: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" ":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" @@ -139,39 +124,39 @@ msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:50 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:60 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:63 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:65 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:68 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:70 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -182,7 +167,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:76 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -199,7 +184,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -207,7 +192,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:88 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -217,27 +202,27 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:93 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:95 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../deprecations/pending-removal-in-3.14.rst:100 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -247,27 +232,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:106 -msgid "" -"date and datetime adapter, date and timestamp converter: see the :mod:" -"`sqlite3` documentation for suggested replacement recipes." -msgstr "" -"date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" -"參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" - -#: ../../deprecations/pending-removal-in-3.14.rst:109 -msgid "" -":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " -"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " -"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " -"in 3.14. (Contributed by Nikita Sobolev in :gh:`101866`.)" -msgstr "" -":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" -"exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" -"`101866` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:116 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -275,7 +240,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:119 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index 1fc15168f5..0f21b19e13 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-15 00:14+0000\n" +"POT-Creation-Date: 2024-11-05 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -136,10 +136,26 @@ msgstr "" "任意數量的位置或關鍵字引數,並忽略每個引數。" #: ../../deprecations/pending-removal-in-3.15.rst:62 +msgid ":mod:`types`:" +msgstr ":mod:`types`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:64 +msgid "" +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" +msgstr "" +":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.15.rst:64 +#: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -150,7 +166,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:70 +#: ../../deprecations/pending-removal-in-3.15.rst:79 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -160,11 +176,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:75 +#: ../../deprecations/pending-removal-in-3.15.rst:84 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:77 +#: ../../deprecations/pending-removal-in-3.15.rst:86 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" diff --git a/deprecations/pending-removal-in-3.16.po b/deprecations/pending-removal-in-3.16.po index 80e023abb0..eec8eb350d 100644 --- a/deprecations/pending-removal-in-3.16.po +++ b/deprecations/pending-removal-in-3.16.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-11-10 17:21+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,31 +16,29 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: ../../deprecations/pending-removal-in-3.16.rst:2 -msgid "Pending Removal in Python 3.16" +msgid "Pending removal in Python 3.16" msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:4 -msgid ":mod:`builtins`:" -msgstr ":mod:`builtins`:" +msgid "The import system:" +msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " -"deprecated since Python 3.12, as it produces surprising and unintuitive " -"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " -"of a Boolean. In the rare case that you need the bitwise inversion of the " -"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." msgstr "" -"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" -"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" -"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " -"``~int(x)`` (``~int(x)``)。" +"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " +"` 的做法將於 Python 3.16 被棄用。在 " +"Python 3.16 中,引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__`。" -#: ../../deprecations/pending-removal-in-3.16.rst:13 +#: ../../deprecations/pending-removal-in-3.16.rst:11 msgid ":mod:`array`:" msgstr ":mod:`array`:" -#: ../../deprecations/pending-removal-in-3.16.rst:15 +#: ../../deprecations/pending-removal-in-3.16.rst:13 msgid "" "The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " "documentation since Python 3.3 and at runtime since Python 3.13. Use the " @@ -50,11 +48,39 @@ msgstr "" "Python 3.13 起在 runtime 已被棄用。請使用 ``'w'`` 格式碼 (:c:type:`Py_UCS4`) " "來取代 Unicode 字元。" +#: ../../deprecations/pending-removal-in-3.16.rst:19 +msgid ":mod:`asyncio`:" +msgstr ":mod:`asyncio`:" + #: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid "" +":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " +"Python 3.16, use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"by Jiahao Li and Kumar Aditya in :gh:`122875`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:26 +msgid ":mod:`builtins`:" +msgstr ":mod:`builtins`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:28 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" +"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" +"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" +"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " +"``~int(x)`` (``~int(x)``)。" + +#: ../../deprecations/pending-removal-in-3.16.rst:35 msgid ":mod:`shutil`:" msgstr ":mod:`shutil`:" -#: ../../deprecations/pending-removal-in-3.16.rst:23 +#: ../../deprecations/pending-removal-in-3.16.rst:37 msgid "" "The :class:`!ExecError` exception has been deprecated since Python 3.14. It " "has not been used by any function in :mod:`!shutil` since Python 3.4, and is " @@ -63,11 +89,11 @@ msgstr "" "自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" "未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" -#: ../../deprecations/pending-removal-in-3.16.rst:28 +#: ../../deprecations/pending-removal-in-3.16.rst:42 msgid ":mod:`symtable`:" msgstr ":mod:`symtable`:" -#: ../../deprecations/pending-removal-in-3.16.rst:30 +#: ../../deprecations/pending-removal-in-3.16.rst:44 msgid "" "The :meth:`Class.get_methods ` method has been " "deprecated since Python 3.14." @@ -75,11 +101,11 @@ msgstr "" "自 Python 3.14 起,:meth:`Class.get_methods ` 方" "法已被棄用。" -#: ../../deprecations/pending-removal-in-3.16.rst:33 +#: ../../deprecations/pending-removal-in-3.16.rst:47 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" -#: ../../deprecations/pending-removal-in-3.16.rst:35 +#: ../../deprecations/pending-removal-in-3.16.rst:49 msgid "" "The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " "since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " @@ -88,11 +114,11 @@ msgstr "" "自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" "請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" -#: ../../deprecations/pending-removal-in-3.16.rst:39 +#: ../../deprecations/pending-removal-in-3.16.rst:53 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" -#: ../../deprecations/pending-removal-in-3.16.rst:41 +#: ../../deprecations/pending-removal-in-3.16.rst:55 msgid "" "The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " "deprecated since Python 3.13." diff --git a/glossary.po b/glossary.po index 92507365c3..428ab89521 100644 --- a/glossary.po +++ b/glossary.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-14 00:14+0000\n" +"POT-Creation-Date: 2024-10-31 00:13+0000\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -614,43 +614,74 @@ msgstr "" "忽略它們。" #: ../../glossary.rst:262 -msgid "context manager" -msgstr "context manager(情境管理器)" +msgid "context" +msgstr "context(情境)" #: ../../glossary.rst:264 msgid "" -"An object which controls the environment seen in a :keyword:`with` statement " -"by defining :meth:`~object.__enter__` and :meth:`~object.__exit__` methods. " -"See :pep:`343`." +"This term has different meanings depending on where and how it is used. Some " +"common meanings:" msgstr "" -"一個可以控制 :keyword:`with` 陳述式中所見環境的物件,而它是透過定義 :meth:" -"`~object.__enter__` 和 :meth:`~object.__exit__` method 來控制的。請參閱 :pep:" -"`343`。" #: ../../glossary.rst:267 +msgid "" +"The temporary state or environment established by a :term:`context manager` " +"via a :keyword:`with` statement." +msgstr "" + +#: ../../glossary.rst:269 +msgid "" +"The collection of key­value bindings associated with a particular :class:" +"`contextvars.Context` object and accessed via :class:`~contextvars." +"ContextVar` objects. Also see :term:`context variable`." +msgstr "" + +#: ../../glossary.rst:273 +msgid "" +"A :class:`contextvars.Context` object. Also see :term:`current context`." +msgstr "" +"一個 :class:`contextvars.Context` 物件。另請參閱 :term:`current context`。" + +#: ../../glossary.rst:275 +msgid "context management protocol" +msgstr "context management protocol(情境管理協定)" + +#: ../../glossary.rst:277 +msgid "" +"The :meth:`~object.__enter__` and :meth:`~object.__exit__` methods called by " +"the :keyword:`with` statement. See :pep:`343`." +msgstr "" +"由 :keyword:`with` 陳述式所呼叫的 :meth:`~object.__enter__` 和 :meth:" +"`~object.__exit__` 方法。另請參閱 :pep:`343`。" + +#: ../../glossary.rst:279 +msgid "context manager" +msgstr "context manager(情境管理器)" + +#: ../../glossary.rst:281 +msgid "" +"An object which implements the :term:`context management protocol` and " +"controls the environment seen in a :keyword:`with` statement. See :pep:" +"`343`." +msgstr "" + +#: ../../glossary.rst:284 msgid "context variable" msgstr "context variable(情境變數)" -#: ../../glossary.rst:269 +#: ../../glossary.rst:286 msgid "" -"A variable which can have different values depending on its context. This is " -"similar to Thread-Local Storage in which each execution thread may have a " -"different value for a variable. However, with context variables, there may " -"be several contexts in one execution thread and the main usage for context " -"variables is to keep track of variables in concurrent asynchronous tasks. " -"See :mod:`contextvars`." +"A variable whose value depends on which context is the :term:`current " +"context`. Values are accessed via :class:`contextvars.ContextVar` objects. " +"Context variables are primarily used to isolate state between concurrent " +"asynchronous tasks." msgstr "" -"一個變數,其值可以根據上下文的情境而有所不同。這類似執行緒區域儲存區 (Thread-" -"Local Storage),在其中,一個變數在每個執行緒可能具有不同的值。然而,關於情境" -"變數,在一個執行緒中可能會有多個情境,而情境變數的主要用途,是在並行的非同步" -"任務 (concurrent asynchronous task) 中,對於變數狀態的追蹤。請參閱 :mod:" -"`contextvars`。" -#: ../../glossary.rst:276 +#: ../../glossary.rst:290 msgid "contiguous" msgstr "contiguous(連續的)" -#: ../../glossary.rst:280 +#: ../../glossary.rst:294 msgid "" "A buffer is considered contiguous exactly if it is either *C-contiguous* or " "*Fortran contiguous*. Zero-dimensional buffers are C and Fortran " @@ -667,11 +698,11 @@ msgstr "" "的順序訪問各個項目時,最後一個索引的變化最快。然而,在 Fortran contiguous 陣" "列中,第一個索引的變化最快。" -#: ../../glossary.rst:288 +#: ../../glossary.rst:302 msgid "coroutine" msgstr "coroutine(協程)" -#: ../../glossary.rst:290 +#: ../../glossary.rst:304 msgid "" "Coroutines are a more generalized form of subroutines. Subroutines are " "entered at one point and exited at another point. Coroutines can be " @@ -682,11 +713,11 @@ msgstr "" "在另一個時間點被退出。協程可以在許多不同的時間點被進入、退出和回復。它們能夠" "以 :keyword:`async def` 陳述式被實作。另請參閱 :pep:`492`。" -#: ../../glossary.rst:295 +#: ../../glossary.rst:309 msgid "coroutine function" msgstr "coroutine function(協程函式)" -#: ../../glossary.rst:297 +#: ../../glossary.rst:311 msgid "" "A function which returns a :term:`coroutine` object. A coroutine function " "may be defined with the :keyword:`async def` statement, and may contain :" @@ -697,11 +728,11 @@ msgstr "" "`async def` 陳述式被定義,並可能會包含 :keyword:`await`、:keyword:`async " "for` 和 :keyword:`async with` 關鍵字。這些關鍵字由 :pep:`492` 引入。" -#: ../../glossary.rst:302 +#: ../../glossary.rst:316 msgid "CPython" msgstr "CPython" -#: ../../glossary.rst:304 +#: ../../glossary.rst:318 msgid "" "The canonical implementation of the Python programming language, as " "distributed on `python.org `_. The term \"CPython\" " @@ -712,11 +743,25 @@ msgstr "" "`_ 上。「CPython」這個術語在必要時被使用,以區分此實" "作與其它語言的實作,例如 Jython 或 IronPython。" -#: ../../glossary.rst:308 +#: ../../glossary.rst:322 +msgid "current context" +msgstr "" + +#: ../../glossary.rst:324 +msgid "" +"The :term:`context` (:class:`contextvars.Context` object) that is currently " +"used by :class:`~contextvars.ContextVar` objects to access (get or set) the " +"values of :term:`context variables `. Each thread has its " +"own current context. Frameworks for executing asynchronous tasks (see :mod:" +"`asyncio`) associate each task with a context which becomes the current " +"context whenever the task starts or resumes execution." +msgstr "" + +#: ../../glossary.rst:330 msgid "decorator" msgstr "decorator(裝飾器)" -#: ../../glossary.rst:310 +#: ../../glossary.rst:332 msgid "" "A function returning another function, usually applied as a function " "transformation using the ``@wrapper`` syntax. Common examples for " @@ -726,13 +771,13 @@ msgstr "" "式的變換 (function transformation)。裝飾器的常見範例是 :func:`classmethod` " "和 :func:`staticmethod`。" -#: ../../glossary.rst:314 +#: ../../glossary.rst:336 msgid "" "The decorator syntax is merely syntactic sugar, the following two function " "definitions are semantically equivalent::" msgstr "裝飾器語法只是語法糖。以下兩個函式定義在語義上是等效的: ::" -#: ../../glossary.rst:317 +#: ../../glossary.rst:339 msgid "" "def f(arg):\n" " ...\n" @@ -750,7 +795,7 @@ msgstr "" "def f(arg):\n" " ..." -#: ../../glossary.rst:325 +#: ../../glossary.rst:347 msgid "" "The same concept exists for classes, but is less commonly used there. See " "the documentation for :ref:`function definitions ` and :ref:`class " @@ -759,11 +804,11 @@ msgstr "" "Class 也存在相同的概念,但在那裡比較不常用。關於裝飾器的更多內容,請參閱\\ :" "ref:`函式定義 `\\ 和 :ref:`class 定義 `\\ 的說明文件。" -#: ../../glossary.rst:328 +#: ../../glossary.rst:350 msgid "descriptor" msgstr "descriptor(描述器)" -#: ../../glossary.rst:330 +#: ../../glossary.rst:352 msgid "" "Any object which defines the methods :meth:`~object.__get__`, :meth:`~object." "__set__`, or :meth:`~object.__delete__`. When a class attribute is a " @@ -783,7 +828,7 @@ msgstr "" "們是許多功能的基礎,這些功能包括函式、method、屬性 (property)、class method、" "靜態 method,以及對 super class(父類別)的參照。" -#: ../../glossary.rst:341 +#: ../../glossary.rst:363 msgid "" "For more information about descriptors' methods, see :ref:`descriptors` or " "the :ref:`Descriptor How To Guide `." @@ -791,11 +836,11 @@ msgstr "" "關於描述器 method 的更多資訊,請參閱\\ :ref:`descriptors`\\ 或\\ :ref:`描述器" "使用指南 `。" -#: ../../glossary.rst:343 +#: ../../glossary.rst:365 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../glossary.rst:345 +#: ../../glossary.rst:367 msgid "" "An associative array, where arbitrary keys are mapped to values. The keys " "can be any object with :meth:`~object.__hash__` and :meth:`~object.__eq__` " @@ -805,11 +850,11 @@ msgstr "" "有 :meth:`~object.__hash__` 和 :meth:`~object.__eq__` method 的物件。在 Perl " "中被稱為雜湊 (hash)。" -#: ../../glossary.rst:349 +#: ../../glossary.rst:371 msgid "dictionary comprehension" msgstr "dictionary comprehension(字典綜合運算)" -#: ../../glossary.rst:351 +#: ../../glossary.rst:373 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a dictionary with the results. ``results = {n: n ** 2 for n in " @@ -820,11 +865,11 @@ msgstr "" "字典回傳。``results = {n: n ** 2 for n in range(10)}`` 會產生一個字典,它包含" "了鍵 ``n`` 對映到值 ``n ** 2``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:355 +#: ../../glossary.rst:377 msgid "dictionary view" msgstr "dictionary view(字典檢視)" -#: ../../glossary.rst:357 +#: ../../glossary.rst:379 msgid "" "The objects returned from :meth:`dict.keys`, :meth:`dict.values`, and :meth:" "`dict.items` are called dictionary views. They provide a dynamic view on the " @@ -837,11 +882,11 @@ msgstr "" "反映這些變動。若要強制將字典檢視轉為完整的 list(串列),須使用 " "``list(dictview)``。請參閱\\ :ref:`dict-views`。" -#: ../../glossary.rst:363 +#: ../../glossary.rst:385 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../glossary.rst:365 +#: ../../glossary.rst:387 msgid "" "A string literal which appears as the first expression in a class, function " "or module. While ignored when the suite is executed, it is recognized by " @@ -854,11 +899,11 @@ msgstr "" "`~definition.__doc__` 屬性中。由於說明字串可以透過內省 (introspection) 來瀏" "覽,因此它是物件的說明文件存放的標準位置。" -#: ../../glossary.rst:371 +#: ../../glossary.rst:393 msgid "duck-typing" msgstr "duck-typing(鴨子型別)" -#: ../../glossary.rst:373 +#: ../../glossary.rst:395 msgid "" "A programming style which does not look at an object's type to determine if " "it has the right interface; instead, the method or attribute is simply " @@ -879,11 +924,11 @@ msgstr "" "來補充。)然而,它通常會採用 :func:`hasattr` 測試,或是 :term:`EAFP` 程式設計" "風格。" -#: ../../glossary.rst:382 +#: ../../glossary.rst:404 msgid "EAFP" msgstr "EAFP" -#: ../../glossary.rst:384 +#: ../../glossary.rst:406 msgid "" "Easier to ask for forgiveness than permission. This common Python coding " "style assumes the existence of valid keys or attributes and catches " @@ -898,11 +943,11 @@ msgstr "" "keyword:`except` 陳述式。該技術與許多其他語言(例如 C)常見的 :term:`LBYL` 風" "格形成了對比。" -#: ../../glossary.rst:390 +#: ../../glossary.rst:412 msgid "expression" msgstr "expression(運算式)" -#: ../../glossary.rst:392 +#: ../../glossary.rst:414 msgid "" "A piece of syntax which can be evaluated to some value. In other words, an " "expression is an accumulation of expression elements like literals, names, " @@ -918,11 +963,11 @@ msgstr "" "(陳述式)不能被用作運算式,例如 :keyword:`while`。賦值 (assignment) 也是陳述" "式,而不是運算式。" -#: ../../glossary.rst:399 +#: ../../glossary.rst:421 msgid "extension module" msgstr "extension module(擴充模組)" -#: ../../glossary.rst:401 +#: ../../glossary.rst:423 msgid "" "A module written in C or C++, using Python's C API to interact with the core " "and with user code." @@ -930,11 +975,11 @@ msgstr "" "一個以 C 或 C++ 編寫的模組,它使用 Python 的 C API 來與核心及使用者程式碼進行" "互動。" -#: ../../glossary.rst:403 +#: ../../glossary.rst:425 msgid "f-string" msgstr "f-string(f 字串)" -#: ../../glossary.rst:405 +#: ../../glossary.rst:427 msgid "" "String literals prefixed with ``'f'`` or ``'F'`` are commonly called \"f-" "strings\" which is short for :ref:`formatted string literals `. " @@ -943,11 +988,11 @@ msgstr "" "以 ``'f'`` 或 ``'F'`` 為前綴的字串文本通常被稱為「f 字串」,它是\\ :ref:`格式" "化的字串文本 `\\ 的縮寫。另請參閱 :pep:`498`。" -#: ../../glossary.rst:408 +#: ../../glossary.rst:430 msgid "file object" msgstr "file object(檔案物件)" -#: ../../glossary.rst:410 +#: ../../glossary.rst:432 msgid "" "An object exposing a file-oriented API (with methods such as :meth:`!read` " "or :meth:`!write`) to an underlying resource. Depending on the way it was " @@ -962,7 +1007,7 @@ msgstr "" "衝區、socket(插座)、管線 (pipe) 等)的存取。檔案物件也被稱為\\ :dfn:`類檔案" "物件 (file-like object)` 或\\ :dfn:`串流 (stream)`。" -#: ../../glossary.rst:418 +#: ../../glossary.rst:440 msgid "" "There are actually three categories of file objects: raw :term:`binary files " "`, buffered :term:`binary files ` and :term:`text " @@ -974,19 +1019,19 @@ msgstr "" "term:`二進位檔案 `\\ 和\\ :term:`文字檔案 `。它們的介" "面在 :mod:`io` 模組中被定義。建立檔案物件的標準方法是使用 :func:`open` 函式。" -#: ../../glossary.rst:423 +#: ../../glossary.rst:445 msgid "file-like object" msgstr "file-like object(類檔案物件)" -#: ../../glossary.rst:425 +#: ../../glossary.rst:447 msgid "A synonym for :term:`file object`." msgstr ":term:`file object`\\ (檔案物件)的同義字。" -#: ../../glossary.rst:426 +#: ../../glossary.rst:448 msgid "filesystem encoding and error handler" msgstr "filesystem encoding and error handler(檔案系統編碼和錯誤處理函式)" -#: ../../glossary.rst:428 +#: ../../glossary.rst:450 msgid "" "Encoding and error handler used by Python to decode bytes from the operating " "system and encode Unicode to the operating system." @@ -994,7 +1039,7 @@ msgstr "" "Python 所使用的一種編碼和錯誤處理函式,用來解碼來自作業系統的位元組,以及將 " "Unicode 編碼到作業系統。" -#: ../../glossary.rst:431 +#: ../../glossary.rst:453 msgid "" "The filesystem encoding must guarantee to successfully decode all bytes " "below 128. If the file system encoding fails to provide this guarantee, API " @@ -1003,7 +1048,7 @@ msgstr "" "檔案系統編碼必須保證能成功解碼所有小於 128 的位元組。如果檔案系統編碼無法提供" "此保證,則 API 函式會引發 :exc:`UnicodeError`。" -#: ../../glossary.rst:435 +#: ../../glossary.rst:457 msgid "" "The :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors` functions can be used to get the filesystem " @@ -1012,7 +1057,7 @@ msgstr "" ":func:`sys.getfilesystemencoding` 和 :func:`sys.getfilesystemencodeerrors` 函" "式可用於取得檔案系統編碼和錯誤處理函式。" -#: ../../glossary.rst:439 +#: ../../glossary.rst:461 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " "startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." @@ -1024,22 +1069,22 @@ msgstr "" "member:`~PyConfig.filesystem_encoding`,以及 :c:type:`PyConfig` 的成員 :c:" "member:`~PyConfig.filesystem_errors`。" -#: ../../glossary.rst:444 +#: ../../glossary.rst:466 msgid "See also the :term:`locale encoding`." msgstr "另請參閱 :term:`locale encoding`\\ (區域編碼)。" -#: ../../glossary.rst:445 +#: ../../glossary.rst:467 msgid "finder" msgstr "finder(尋檢器)" -#: ../../glossary.rst:447 +#: ../../glossary.rst:469 msgid "" "An object that tries to find the :term:`loader` for a module that is being " "imported." msgstr "" "一個物件,它會嘗試為正在被 import 的模組尋找 :term:`loader`\\ (載入器)。" -#: ../../glossary.rst:450 +#: ../../glossary.rst:472 msgid "" "There are two types of finder: :term:`meta path finders ` " "for use with :data:`sys.meta_path`, and :term:`path entry finders ` 會使用 :data:`sys.meta_path`,而\\ :term:`路徑項目尋檢器 (path " "entry finder) ` 會使用 :data:`sys.path_hooks`。" -#: ../../glossary.rst:454 +#: ../../glossary.rst:476 msgid "" "See :ref:`finders-and-loaders` and :mod:`importlib` for much more detail." msgstr "請參閱 :ref:`finders-and-loaders` 和 :mod:`importlib` 以了解更多細節。" -#: ../../glossary.rst:455 +#: ../../glossary.rst:477 msgid "floor division" msgstr "floor division(向下取整除法)" -#: ../../glossary.rst:457 +#: ../../glossary.rst:479 msgid "" "Mathematical division that rounds down to nearest integer. The floor " "division operator is ``//``. For example, the expression ``11 // 4`` " @@ -1071,11 +1116,11 @@ msgstr "" "``2.75`` 不同。請注意,``(-11) // 4`` 的結果是 ``-3``,因為是 ``-2.75`` 被\\ " "*向下*\\ 無條件捨去。請參閱 :pep:`238`。" -#: ../../glossary.rst:462 +#: ../../glossary.rst:484 msgid "free threading" msgstr "free threading(自由執行緒)" -#: ../../glossary.rst:464 +#: ../../glossary.rst:486 msgid "" "A threading model where multiple threads can run Python bytecode " "simultaneously within the same interpreter. This is in contrast to the :" @@ -1086,11 +1131,11 @@ msgstr "" "\\ :term:`全域直譯器鎖 `\\ 形成對比,後者一次只允許" "一個執行緒執行 Python 位元組碼。請參閱 :pep:`703`。" -#: ../../glossary.rst:468 +#: ../../glossary.rst:490 msgid "free variable" msgstr "free variable(自由變數)" -#: ../../glossary.rst:470 +#: ../../glossary.rst:492 msgid "" "Formally, as defined in the :ref:`language execution model `, a " "free variable is any variable used in a namespace which is not a local " @@ -1100,11 +1145,11 @@ msgid "" "variable`." msgstr "" -#: ../../glossary.rst:475 +#: ../../glossary.rst:497 msgid "function" msgstr "function(函式)" -#: ../../glossary.rst:477 +#: ../../glossary.rst:499 msgid "" "A series of statements which returns some value to a caller. It can also be " "passed zero or more :term:`arguments ` which may be used in the " @@ -1116,15 +1161,15 @@ msgstr "" "`parameter`\\ (參數)、:term:`method`\\ (方法),以及\\ :ref:`function`\\ " "章節。" -#: ../../glossary.rst:481 +#: ../../glossary.rst:503 msgid "function annotation" msgstr "function annotation(函式註釋)" -#: ../../glossary.rst:483 +#: ../../glossary.rst:505 msgid "An :term:`annotation` of a function parameter or return value." msgstr "函式參數或回傳值的一個 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:485 +#: ../../glossary.rst:507 msgid "" "Function annotations are usually used for :term:`type hints `: " "for example, this function is expected to take two :class:`int` arguments " @@ -1133,7 +1178,7 @@ msgstr "" "函式註釋通常被使用於\\ :term:`型別提示 `:例如,這個函式預期會得到" "兩個 :class:`int` 引數,並會有一個 :class:`int` 回傳值: ::" -#: ../../glossary.rst:490 +#: ../../glossary.rst:512 msgid "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" @@ -1141,11 +1186,11 @@ msgstr "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" -#: ../../glossary.rst:493 +#: ../../glossary.rst:515 msgid "Function annotation syntax is explained in section :ref:`function`." msgstr "函式註釋的語法在\\ :ref:`function`\\ 章節有詳細解釋。" -#: ../../glossary.rst:495 +#: ../../glossary.rst:517 msgid "" "See :term:`variable annotation` and :pep:`484`, which describe this " "functionality. Also see :ref:`annotations-howto` for best practices on " @@ -1154,11 +1199,11 @@ msgstr "" "請參閱 :term:`variable annotation` 和 :pep:`484`,皆有此功能的描述。關於註釋" "的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:499 +#: ../../glossary.rst:521 msgid "__future__" msgstr "__future__" -#: ../../glossary.rst:501 +#: ../../glossary.rst:523 msgid "" "A :ref:`future statement `, ``from __future__ import ``, " "directs the compiler to compile the current module using syntax or semantics " @@ -1174,7 +1219,7 @@ msgstr "" "import 此模組並對其變數求值,你可以看見一個新的功能是何時首次被新增到此語言" "中,以及它何時將會(或已經)成為預設的功能: ::" -#: ../../glossary.rst:509 +#: ../../glossary.rst:531 msgid "" ">>> import __future__\n" ">>> __future__.division\n" @@ -1184,11 +1229,11 @@ msgstr "" ">>> __future__.division\n" "_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)" -#: ../../glossary.rst:512 +#: ../../glossary.rst:534 msgid "garbage collection" msgstr "garbage collection(垃圾回收)" -#: ../../glossary.rst:514 +#: ../../glossary.rst:536 msgid "" "The process of freeing memory when it is not used anymore. Python performs " "garbage collection via reference counting and a cyclic garbage collector " @@ -1200,11 +1245,11 @@ msgstr "" "垃圾回收器 (cyclic garbage collector) 來完成。垃圾回收器可以使用 :mod:`gc` 模" "組對其進行控制。" -#: ../../glossary.rst:519 ../../glossary.rst:520 +#: ../../glossary.rst:541 ../../glossary.rst:542 msgid "generator" msgstr "generator(產生器)" -#: ../../glossary.rst:522 +#: ../../glossary.rst:544 msgid "" "A function which returns a :term:`generator iterator`. It looks like a " "normal function except that it contains :keyword:`yield` expressions for " @@ -1215,7 +1260,7 @@ msgstr "" "個正常的函式,但不同的是它包含了 :keyword:`yield` 運算式,能產生一系列的值," "這些值可用於 for 迴圈,或是以 :func:`next` 函式,每次檢索其中的一個值。" -#: ../../glossary.rst:527 +#: ../../glossary.rst:549 msgid "" "Usually refers to a generator function, but may refer to a *generator " "iterator* in some contexts. In cases where the intended meaning isn't " @@ -1224,15 +1269,15 @@ msgstr "" "這個術語通常用來表示一個產生器函式,但在某些情境中,也可能是表示\\ *產生器疊" "代器*。萬一想表達的意思不夠清楚,那就使用完整的術語,以避免歧義。" -#: ../../glossary.rst:530 +#: ../../glossary.rst:552 msgid "generator iterator" msgstr "generator iterator(產生器疊代器)" -#: ../../glossary.rst:532 +#: ../../glossary.rst:554 msgid "An object created by a :term:`generator` function." msgstr "一個由 :term:`generator`\\ (產生器)函式所建立的物件。" -#: ../../glossary.rst:534 +#: ../../glossary.rst:556 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " "location execution state (including local variables and pending try-" @@ -1243,11 +1288,11 @@ msgstr "" "中的 try 陳述式)。當\\ *產生器疊代器*\\ 回復時,它會從停止的地方繼續執行(與" "那些每次調用時都要重新開始的函式有所不同)。" -#: ../../glossary.rst:540 ../../glossary.rst:541 +#: ../../glossary.rst:562 ../../glossary.rst:563 msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../glossary.rst:543 +#: ../../glossary.rst:565 msgid "" "An :term:`expression` that returns an :term:`iterator`. It looks like a " "normal expression followed by a :keyword:`!for` clause defining a loop " @@ -1259,7 +1304,7 @@ msgstr "" "變數、範圍以及一個選擇性的 :keyword:`!if` 子句。該組合運算式會為外層函式產生" "多個值: ::" -#: ../../glossary.rst:548 +#: ../../glossary.rst:570 msgid "" ">>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81\n" "285" @@ -1267,11 +1312,11 @@ msgstr "" ">>> sum(i*i for i in range(10)) # 平方之和 0, 1, 4, ... 81\n" "285" -#: ../../glossary.rst:550 +#: ../../glossary.rst:572 msgid "generic function" msgstr "generic function(泛型函式)" -#: ../../glossary.rst:552 +#: ../../glossary.rst:574 msgid "" "A function composed of multiple functions implementing the same operation " "for different types. Which implementation should be used during a call is " @@ -1280,7 +1325,7 @@ msgstr "" "一個由多個函式組成的函式,該函式會對不同的型別實作相同的運算。呼叫期間應該使" "用哪種實作,是由調度演算法 (dispatch algorithm) 來決定。" -#: ../../glossary.rst:556 +#: ../../glossary.rst:578 msgid "" "See also the :term:`single dispatch` glossary entry, the :func:`functools." "singledispatch` decorator, and :pep:`443`." @@ -1288,11 +1333,11 @@ msgstr "" "另請參閱 :term:`single dispatch`\\ (單一調度)術語表條目、:func:`functools." "singledispatch` 裝飾器和 :pep:`443`。" -#: ../../glossary.rst:558 +#: ../../glossary.rst:580 msgid "generic type" msgstr "generic type(泛型型別)" -#: ../../glossary.rst:560 +#: ../../glossary.rst:582 msgid "" "A :term:`type` that can be parameterized; typically a :ref:`container " "class` such as :class:`list` or :class:`dict`. Used for :" @@ -1302,7 +1347,7 @@ msgstr "" "`容器型別 `,像是 :class:`list` 和 :class:`dict`。它被用於" "\\ :term:`型別提示 `\\ 和\\ :term:`註釋 `。" -#: ../../glossary.rst:565 +#: ../../glossary.rst:587 msgid "" "For more details, see :ref:`generic alias types`, :pep:" "`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` module." @@ -1310,19 +1355,19 @@ msgstr "" "詳情請參閱\\ :ref:`泛型別名型別 `、:pep:`483`、:pep:" "`484`、:pep:`585` 和 :mod:`typing` 模組。" -#: ../../glossary.rst:567 +#: ../../glossary.rst:589 msgid "GIL" msgstr "GIL" -#: ../../glossary.rst:569 +#: ../../glossary.rst:591 msgid "See :term:`global interpreter lock`." msgstr "請參閱 :term:`global interpreter lock`\\ (全域直譯器鎖)。" -#: ../../glossary.rst:570 +#: ../../glossary.rst:592 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../glossary.rst:572 +#: ../../glossary.rst:594 msgid "" "The mechanism used by the :term:`CPython` interpreter to assure that only " "one thread executes Python :term:`bytecode` at a time. This simplifies the " @@ -1339,7 +1384,7 @@ msgstr "" "(multi-threaded),但代價是會犧牲掉多處理器的機器能夠提供的一大部分平行性 " "(parallelism)。" -#: ../../glossary.rst:581 +#: ../../glossary.rst:603 msgid "" "However, some extension modules, either standard or third-party, are " "designed so as to release the GIL when doing computationally intensive tasks " @@ -1350,7 +1395,7 @@ msgstr "" "計算密集 (computationally intensive) 的任務時,可以解除 GIL。另外,在執行 I/" "O 時,GIL 總是會被解除。" -#: ../../glossary.rst:586 +#: ../../glossary.rst:608 msgid "" "As of Python 3.13, the GIL can be disabled using the :option:`--disable-gil` " "build configuration. After building Python with this option, code must be " @@ -1365,11 +1410,11 @@ msgstr "" "多執行緒應用程式的效能,並使多核心 CPU 的高效使用變得更加容易。有關更多詳細資" "訊,請參閱 :pep:`703`。" -#: ../../glossary.rst:592 +#: ../../glossary.rst:614 msgid "hash-based pyc" msgstr "hash-based pyc(雜湊架構的 pyc)" -#: ../../glossary.rst:594 +#: ../../glossary.rst:616 msgid "" "A bytecode cache file that uses the hash rather than the last-modified time " "of the corresponding source file to determine its validity. See :ref:`pyc-" @@ -1378,11 +1423,11 @@ msgstr "" "一個位元組碼 (bytecode) 暫存檔,它使用雜湊值而不是對應原始檔案的最後修改時" "間,來確定其有效性。請參閱\\ :ref:`pyc-invalidation`。" -#: ../../glossary.rst:597 +#: ../../glossary.rst:619 msgid "hashable" msgstr "hashable(可雜湊的)" -#: ../../glossary.rst:599 +#: ../../glossary.rst:621 msgid "" "An object is *hashable* if it has a hash value which never changes during " "its lifetime (it needs a :meth:`~object.__hash__` method), and can be " @@ -1394,7 +1439,7 @@ msgstr "" "`~object.__eq__` method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結果為相等的" "多個可雜湊物件,它們必須擁有相同的雜湊值。" -#: ../../glossary.rst:605 +#: ../../glossary.rst:627 msgid "" "Hashability makes an object usable as a dictionary key and a set member, " "because these data structures use the hash value internally." @@ -1402,7 +1447,7 @@ msgstr "" "可雜湊性 (hashability) 使一個物件可用作 dictionary(字典)的鍵和 set(集合)" "的成員,因為這些資料結構都在其內部使用了雜湊值。" -#: ../../glossary.rst:608 +#: ../../glossary.rst:630 msgid "" "Most of Python's immutable built-in objects are hashable; mutable containers " "(such as lists or dictionaries) are not; immutable containers (such as " @@ -1417,11 +1462,11 @@ msgstr "" "則這些物件會被預設為可雜湊的。它們在互相比較時都是不相等的(除非它們與自己比" "較),而它們的雜湊值則是衍生自它們的 :func:`id`。" -#: ../../glossary.rst:615 +#: ../../glossary.rst:637 msgid "IDLE" msgstr "IDLE" -#: ../../glossary.rst:617 +#: ../../glossary.rst:639 msgid "" "An Integrated Development and Learning Environment for Python. :ref:`idle` " "is a basic editor and interpreter environment which ships with the standard " @@ -1431,17 +1476,17 @@ msgstr "" "境)。:ref:`idle` 是一個基本的編輯器和直譯器環境,它和 Python 的標準發行版本" "一起被提供。" -#: ../../glossary.rst:620 +#: ../../glossary.rst:642 msgid "immortal" msgstr "immportal(不滅)" -#: ../../glossary.rst:622 +#: ../../glossary.rst:644 msgid "" "*Immortal objects* are a CPython implementation detail introduced in :pep:" "`683`." msgstr "*不滅物件 (Immortal objects)* 是 :pep:`683` 引入的 CPython 實作細節。" -#: ../../glossary.rst:625 +#: ../../glossary.rst:647 msgid "" "If an object is immortal, its :term:`reference count` is never modified, and " "therefore it is never deallocated while the interpreter is running. For " @@ -1451,11 +1496,11 @@ msgstr "" "修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` 和 :const:" "`None` 在 CPython 中是不滅的。" -#: ../../glossary.rst:628 +#: ../../glossary.rst:650 msgid "immutable" msgstr "immutable(不可變物件)" -#: ../../glossary.rst:630 +#: ../../glossary.rst:652 msgid "" "An object with a fixed value. Immutable objects include numbers, strings " "and tuples. Such an object cannot be altered. A new object has to be " @@ -1467,11 +1512,11 @@ msgstr "" "能被改變的。如果一個不同的值必須被儲存,則必須建立一個新的物件。它們在需要恆" "定雜湊值的地方,扮演重要的角色,例如 dictionary(字典)中的一個鍵。" -#: ../../glossary.rst:635 +#: ../../glossary.rst:657 msgid "import path" msgstr "import path(引入路徑)" -#: ../../glossary.rst:637 +#: ../../glossary.rst:659 msgid "" "A list of locations (or :term:`path entries `) that are searched " "by the :term:`path based finder` for modules to import. During import, this " @@ -1483,11 +1528,11 @@ msgstr "" "的位置。在 import 期間,此位置列表通常是來自 :data:`sys.path`,但對於子套件 " "(subpackage) 而言,它也可能是來自父套件的 ``__path__`` 屬性。" -#: ../../glossary.rst:642 +#: ../../glossary.rst:664 msgid "importing" msgstr "importing(引入)" -#: ../../glossary.rst:644 +#: ../../glossary.rst:666 msgid "" "The process by which Python code in one module is made available to Python " "code in another module." @@ -1495,11 +1540,11 @@ msgstr "" "一個過程。一個模組中的 Python 程式碼可以透過此過程,被另一個模組中的 Python " "程式碼使用。" -#: ../../glossary.rst:646 +#: ../../glossary.rst:668 msgid "importer" msgstr "importer(引入器)" -#: ../../glossary.rst:648 +#: ../../glossary.rst:670 msgid "" "An object that both finds and loads a module; both a :term:`finder` and :" "term:`loader` object." @@ -1507,11 +1552,11 @@ msgstr "" "一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也是 :term:" "`loader`\\ (載入器)物件。" -#: ../../glossary.rst:650 +#: ../../glossary.rst:672 msgid "interactive" msgstr "interactive(互動的)" -#: ../../glossary.rst:652 +#: ../../glossary.rst:674 msgid "" "Python has an interactive interpreter which means you can enter statements " "and expressions at the interpreter prompt, immediately execute them and see " @@ -1525,11 +1570,11 @@ msgstr "" "從你的電腦的主選單選擇它)。這是測試新想法或檢查模塊和包的非常強大的方法(請" "記住help(x))。更多互動式模式相關資訊請見 :ref:`tut-interac`。" -#: ../../glossary.rst:659 +#: ../../glossary.rst:681 msgid "interpreted" msgstr "interpreted(直譯的)" -#: ../../glossary.rst:661 +#: ../../glossary.rst:683 msgid "" "Python is an interpreted language, as opposed to a compiled one, though the " "distinction can be blurry because of the presence of the bytecode compiler. " @@ -1543,11 +1588,11 @@ msgstr "" "一個執行檔,然後再執行它。直譯語言通常比編譯語言有更短的開發/除錯週期,不過" "它們的程式通常也運行得較慢。另請參閱 :term:`interactive`\\ (互動的)。" -#: ../../glossary.rst:668 +#: ../../glossary.rst:690 msgid "interpreter shutdown" msgstr "interpreter shutdown(直譯器關閉)" -#: ../../glossary.rst:670 +#: ../../glossary.rst:692 msgid "" "When asked to shut down, the Python interpreter enters a special phase where " "it gradually releases all allocated resources, such as modules and various " @@ -1565,18 +1610,18 @@ msgstr "" "段被執行的程式碼會遇到各種例外,因為它所依賴的資源可能不再有作用了(常見的例" "子是函式庫模組或是警告機制)。" -#: ../../glossary.rst:679 +#: ../../glossary.rst:701 msgid "" "The main reason for interpreter shutdown is that the ``__main__`` module or " "the script being run has finished executing." msgstr "" "直譯器關閉的主要原因,是 ``__main__`` 模組或正被運行的腳本已經執行完成。" -#: ../../glossary.rst:681 +#: ../../glossary.rst:703 msgid "iterable" msgstr "iterable(可疊代物件)" -#: ../../glossary.rst:683 +#: ../../glossary.rst:705 msgid "" "An object capable of returning its members one at a time. Examples of " "iterables include all sequence types (such as :class:`list`, :class:`str`, " @@ -1592,7 +1637,7 @@ msgstr "" "`sequence`\\ (序列)語意的 :meth:`~object.__getitem__` method,該物件就是可" "疊代物件。" -#: ../../glossary.rst:691 +#: ../../glossary.rst:713 msgid "" "Iterables can be used in a :keyword:`for` loop and in many other places " "where a sequence is needed (:func:`zip`, :func:`map`, ...). When an " @@ -1612,11 +1657,11 @@ msgstr "" "數,用於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代器)、:" "term:`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" -#: ../../glossary.rst:701 +#: ../../glossary.rst:723 msgid "iterator" msgstr "iterator(疊代器)" -#: ../../glossary.rst:703 +#: ../../glossary.rst:725 msgid "" "An object representing a stream of data. Repeated calls to the iterator's :" "meth:`~iterator.__next__` method (or passing it to the built-in function :" @@ -1645,11 +1690,11 @@ msgstr "" "此事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一個已被用盡的疊代器物" "件,使其看起來就像一個空的容器。" -#: ../../glossary.rst:718 +#: ../../glossary.rst:740 msgid "More information can be found in :ref:`typeiter`." msgstr "在\\ :ref:`typeiter`\\ 文中可以找到更多資訊。" -#: ../../glossary.rst:722 +#: ../../glossary.rst:744 msgid "" "CPython does not consistently apply the requirement that an iterator define :" "meth:`~iterator.__iter__`. And also please note that the free-threading " @@ -1659,11 +1704,11 @@ msgstr "" "__iter__`\\ 」這個規定。另請注意,free-threading(自由執行緒)CPython 不保證" "疊代器操作的執行緒安全。" -#: ../../glossary.rst:727 +#: ../../glossary.rst:749 msgid "key function" msgstr "key function(鍵函式)" -#: ../../glossary.rst:729 +#: ../../glossary.rst:751 msgid "" "A key function or collation function is a callable that returns a value used " "for sorting or ordering. For example, :func:`locale.strxfrm` is used to " @@ -1673,7 +1718,7 @@ msgstr "" "一個用於排序 (sorting) 或定序 (ordering) 的值。例如,:func:`locale.strxfrm` " "被用來產生一個了解區域特定排序慣例的排序鍵。" -#: ../../glossary.rst:734 +#: ../../glossary.rst:756 msgid "" "A number of tools in Python accept key functions to control how elements are " "ordered or grouped. They include :func:`min`, :func:`max`, :func:`sorted`, :" @@ -1685,7 +1730,7 @@ msgstr "" "merge`、:func:`heapq.nsmallest`、:func:`heapq.nlargest` 和 :func:`itertools." "groupby`。" -#: ../../glossary.rst:740 +#: ../../glossary.rst:762 msgid "" "There are several ways to create a key function. For example. the :meth:" "`str.lower` method can serve as a key function for case insensitive sorts. " @@ -1702,19 +1747,19 @@ msgstr "" "式 (constructor)。關於如何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排序 " "`。" -#: ../../glossary.rst:747 +#: ../../glossary.rst:769 msgid "keyword argument" msgstr "keyword argument(關鍵字引數)" -#: ../../glossary.rst:749 ../../glossary.rst:1053 +#: ../../glossary.rst:771 ../../glossary.rst:1075 msgid "See :term:`argument`." msgstr "請參閱 :term:`argument`\\ (引數)。" -#: ../../glossary.rst:750 +#: ../../glossary.rst:772 msgid "lambda" msgstr "lambda" -#: ../../glossary.rst:752 +#: ../../glossary.rst:774 msgid "" "An anonymous inline function consisting of a single :term:`expression` which " "is evaluated when the function is called. The syntax to create a lambda " @@ -1724,11 +1769,11 @@ msgstr "" "function),於該函式被呼叫時求值。建立 lambda 函式的語法是 ``lambda " "[parameters]: expression``" -#: ../../glossary.rst:755 +#: ../../glossary.rst:777 msgid "LBYL" msgstr "LBYL" -#: ../../glossary.rst:757 +#: ../../glossary.rst:779 msgid "" "Look before you leap. This coding style explicitly tests for pre-conditions " "before making calls or lookups. This style contrasts with the :term:`EAFP` " @@ -1739,7 +1784,7 @@ msgstr "" "地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許多 :" "keyword:`if` 陳述式的存在。" -#: ../../glossary.rst:762 +#: ../../glossary.rst:784 msgid "" "In a multi-threaded environment, the LBYL approach can risk introducing a " "race condition between \"the looking\" and \"the leaping\". For example, " @@ -1753,11 +1798,11 @@ msgstr "" "了 *key*,則該程式碼就會失效。這個問題可以用鎖 (lock) 或使用 EAFP 編碼方式來" "解決。" -#: ../../glossary.rst:767 +#: ../../glossary.rst:789 msgid "list" msgstr "list(串列)" -#: ../../glossary.rst:769 +#: ../../glossary.rst:791 msgid "" "A built-in Python :term:`sequence`. Despite its name it is more akin to an " "array in other languages than to a linked list since access to elements is " @@ -1767,11 +1812,11 @@ msgstr "" "似其他語言中的一個陣列 (array) 而較不像一個鏈結串列 (linked list),因為存取元" "素的時間複雜度是 *O*\\ (1)。" -#: ../../glossary.rst:772 +#: ../../glossary.rst:794 msgid "list comprehension" msgstr "list comprehension(串列綜合運算)" -#: ../../glossary.rst:774 +#: ../../glossary.rst:796 msgid "" "A compact way to process all or part of the elements in a sequence and " "return a list with the results. ``result = ['{:#04x}'.format(x) for x in " @@ -1785,11 +1830,11 @@ msgstr "" "keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有元素都會被" "處理。" -#: ../../glossary.rst:780 +#: ../../glossary.rst:802 msgid "loader" msgstr "loader(載入器)" -#: ../../glossary.rst:782 +#: ../../glossary.rst:804 msgid "" "An object that loads a module. It must define a method named :meth:" "`load_module`. A loader is typically returned by a :term:`finder`. See also:" @@ -1797,23 +1842,23 @@ msgstr "" "一個能夠載入模組的物件。它必須定義一個名為 :meth:`load_module` 的 method(方" "法)。載入器通常是被 :term:`finder`\\ (尋檢器)回傳。更多細節請參閱:" -#: ../../glossary.rst:786 +#: ../../glossary.rst:808 msgid ":ref:`finders-and-loaders`" msgstr ":ref:`finders-and-loaders`" -#: ../../glossary.rst:787 +#: ../../glossary.rst:809 msgid ":class:`importlib.abc.Loader`" msgstr ":class:`importlib.abc.Loader`" -#: ../../glossary.rst:788 +#: ../../glossary.rst:810 msgid ":pep:`302`" msgstr ":pep:`302`" -#: ../../glossary.rst:789 +#: ../../glossary.rst:811 msgid "locale encoding" msgstr "locale encoding(區域編碼)" -#: ../../glossary.rst:791 +#: ../../glossary.rst:813 msgid "" "On Unix, it is the encoding of the LC_CTYPE locale. It can be set with :func:" "`locale.setlocale(locale.LC_CTYPE, new_locale) `." @@ -1821,36 +1866,36 @@ msgstr "" "在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以用 :func:`locale." "setlocale(locale.LC_CTYPE, new_locale) ` 來設定。" -#: ../../glossary.rst:794 +#: ../../glossary.rst:816 msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." msgstr "在 Windows 上,它是 ANSI 代碼頁(code page,例如 ``\"cp1252\"``\\ )。" -#: ../../glossary.rst:796 +#: ../../glossary.rst:818 msgid "" "On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." msgstr "在 Android 和 VxWorks 上,Python 使用 ``\"utf-8\"`` 作為區域編碼。" -#: ../../glossary.rst:798 +#: ../../glossary.rst:820 msgid ":func:`locale.getencoding` can be used to get the locale encoding." msgstr ":func:`locale.getencoding` 可以用來取得區域編碼。" -#: ../../glossary.rst:800 +#: ../../glossary.rst:822 msgid "See also the :term:`filesystem encoding and error handler`." msgstr "也請參考 :term:`filesystem encoding and error handler`。" -#: ../../glossary.rst:801 +#: ../../glossary.rst:823 msgid "magic method" msgstr "magic method(魔術方法)" -#: ../../glossary.rst:805 +#: ../../glossary.rst:827 msgid "An informal synonym for :term:`special method`." msgstr ":term:`special method`\\ (特殊方法)的一個非正式同義詞。" -#: ../../glossary.rst:806 +#: ../../glossary.rst:828 msgid "mapping" msgstr "mapping(對映)" -#: ../../glossary.rst:808 +#: ../../glossary.rst:830 msgid "" "A container object that supports arbitrary key lookups and implements the " "methods specified in the :class:`collections.abc.Mapping` or :class:" @@ -1865,11 +1910,11 @@ msgstr "" "包括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections." "OrderedDict` 和 :class:`collections.Counter`。" -#: ../../glossary.rst:814 +#: ../../glossary.rst:836 msgid "meta path finder" msgstr "meta path finder(元路徑尋檢器)" -#: ../../glossary.rst:816 +#: ../../glossary.rst:838 msgid "" "A :term:`finder` returned by a search of :data:`sys.meta_path`. Meta path " "finders are related to, but different from :term:`path entry finders ` " "相關但是不同。" -#: ../../glossary.rst:820 +#: ../../glossary.rst:842 msgid "" "See :class:`importlib.abc.MetaPathFinder` for the methods that meta path " "finders implement." msgstr "" "關於元路徑尋檢器實作的 method,請參閱 :class:`importlib.abc.MetaPathFinder`。" -#: ../../glossary.rst:822 +#: ../../glossary.rst:844 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../glossary.rst:824 +#: ../../glossary.rst:846 msgid "" "The class of a class. Class definitions create a class name, a class " "dictionary, and a list of base classes. The metaclass is responsible for " @@ -1910,15 +1955,15 @@ msgstr "" "性存取、增加執行緒安全性、追蹤物件建立、實作單例模式 (singleton),以及許多其" "他的任務。" -#: ../../glossary.rst:834 +#: ../../glossary.rst:856 msgid "More information can be found in :ref:`metaclasses`." msgstr "更多資訊可以在\\ :ref:`metaclasses`\\ 章節中找到。" -#: ../../glossary.rst:803 ../../glossary.rst:835 ../../glossary.rst:1198 +#: ../../glossary.rst:825 ../../glossary.rst:857 ../../glossary.rst:1220 msgid "method" msgstr "method(方法)" -#: ../../glossary.rst:837 +#: ../../glossary.rst:859 msgid "" "A function which is defined inside a class body. If called as an attribute " "of an instance of that class, the method will get the instance object as its " @@ -1930,11 +1975,11 @@ msgstr "" "通常被稱為 ``self``)。請參閱 :term:`function`\\ (函式)和 :term:`nested " "scope`\\ (巢狀作用域)。" -#: ../../glossary.rst:841 +#: ../../glossary.rst:863 msgid "method resolution order" msgstr "method resolution order(方法解析順序)" -#: ../../glossary.rst:843 +#: ../../glossary.rst:865 msgid "" "Method Resolution Order is the order in which base classes are searched for " "a member during lookup. See :ref:`python_2.3_mro` for details of the " @@ -1943,11 +1988,11 @@ msgstr "" "方法解析順序是在查找某個成員的過程中,base class(基底類別)被搜尋的順序。關" "於 Python 自 2.3 版直譯器所使用的演算法細節,請參閱 :ref:`python_2.3_mro`。" -#: ../../glossary.rst:846 +#: ../../glossary.rst:868 msgid "module" msgstr "module(模組)" -#: ../../glossary.rst:848 +#: ../../glossary.rst:870 msgid "" "An object that serves as an organizational unit of Python code. Modules " "have a namespace containing arbitrary Python objects. Modules are loaded " @@ -1957,15 +2002,15 @@ msgstr "" "空間,它包含任意的 Python 物件。模組是藉由 :term:`importing` 的過程,被載入" "至 Python。" -#: ../../glossary.rst:852 +#: ../../glossary.rst:874 msgid "See also :term:`package`." msgstr "另請參閱 :term:`package`\\ (套件)。" -#: ../../glossary.rst:853 +#: ../../glossary.rst:875 msgid "module spec" msgstr "module spec(模組規格)" -#: ../../glossary.rst:855 +#: ../../glossary.rst:877 msgid "" "A namespace containing the import-related information used to load a module. " "An instance of :class:`importlib.machinery.ModuleSpec`." @@ -1973,23 +2018,23 @@ msgstr "" "一個命名空間,它包含用於載入模組的 import 相關資訊。它是 :class:`importlib." "machinery.ModuleSpec` 的一個實例。" -#: ../../glossary.rst:858 +#: ../../glossary.rst:880 msgid "See also :ref:`module-specs`." msgstr "另請參閱 :ref:`module-specs`。" -#: ../../glossary.rst:859 +#: ../../glossary.rst:881 msgid "MRO" msgstr "MRO" -#: ../../glossary.rst:861 +#: ../../glossary.rst:883 msgid "See :term:`method resolution order`." msgstr "請參閱 :term:`method resolution order`\\ (方法解析順序)。" -#: ../../glossary.rst:862 +#: ../../glossary.rst:884 msgid "mutable" msgstr "mutable(可變物件)" -#: ../../glossary.rst:864 +#: ../../glossary.rst:886 msgid "" "Mutable objects can change their value but keep their :func:`id`. See also :" "term:`immutable`." @@ -1997,11 +2042,11 @@ msgstr "" "可變物件可以改變它們的值,但維持它們的 :func:`id`。另請參閱 :term:" "`immutable`\\ (不可變物件)。" -#: ../../glossary.rst:866 +#: ../../glossary.rst:888 msgid "named tuple" msgstr "named tuple(附名元組)" -#: ../../glossary.rst:868 +#: ../../glossary.rst:890 msgid "" "The term \"named tuple\" applies to any type or class that inherits from " "tuple and whose indexable elements are also accessible using named " @@ -2011,7 +2056,7 @@ msgstr "" "索引 (indexable) 元素也可以用附名屬性來存取。這些型別或 class 也可以具有其他" "的特性。" -#: ../../glossary.rst:872 +#: ../../glossary.rst:894 msgid "" "Several built-in types are named tuples, including the values returned by :" "func:`time.localtime` and :func:`os.stat`. Another example is :data:`sys." @@ -2020,7 +2065,7 @@ msgstr "" "有些內建型別是 named tuple,包括由 :func:`time.localtime` 和 :func:`os.stat` " "回傳的值。另一個例子是 :data:`sys.float_info`: ::" -#: ../../glossary.rst:876 +#: ../../glossary.rst:898 msgid "" ">>> sys.float_info[1] # indexed access\n" "1024\n" @@ -2030,7 +2075,7 @@ msgid "" "True" msgstr "" -#: ../../glossary.rst:883 +#: ../../glossary.rst:905 msgid "" "Some named tuples are built-in types (such as the above examples). " "Alternatively, a named tuple can be created from a regular class definition " @@ -2047,11 +2092,11 @@ msgstr "" "namedtuple` 來建立。後者技術也增加了一些額外的 method,這些 method 可能是在手" "寫或內建的 named tuple 中,無法找到的。" -#: ../../glossary.rst:891 +#: ../../glossary.rst:913 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../glossary.rst:893 +#: ../../glossary.rst:915 msgid "" "The place where a variable is stored. Namespaces are implemented as " "dictionaries. There are the local, global and built-in namespaces as well " @@ -2071,11 +2116,11 @@ msgstr "" "func:`itertools.islice` 明確地表示,這些函式分別是由 :mod:`random` 和 :mod:" "`itertools` 模組在實作。" -#: ../../glossary.rst:903 +#: ../../glossary.rst:925 msgid "namespace package" msgstr "namespace package(命名空間套件)" -#: ../../glossary.rst:905 +#: ../../glossary.rst:927 msgid "" "A :pep:`420` :term:`package` which serves only as a container for " "subpackages. Namespace packages may have no physical representation, and " @@ -2086,15 +2131,15 @@ msgstr "" "一個容器。命名空間套件可能沒有實體的表示法,而且具體來說它們不像是一個 :term:" "`regular package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這個檔案。" -#: ../../glossary.rst:910 +#: ../../glossary.rst:932 msgid "See also :term:`module`." msgstr "另請參閱 :term:`module`\\ (模組)。" -#: ../../glossary.rst:911 +#: ../../glossary.rst:933 msgid "nested scope" msgstr "nested scope(巢狀作用域)" -#: ../../glossary.rst:913 +#: ../../glossary.rst:935 msgid "" "The ability to refer to a variable in an enclosing definition. For " "instance, a function defined inside another function can refer to variables " @@ -2109,11 +2154,11 @@ msgstr "" "寫入。同樣地,全域變數是在全域命名空間中讀取及寫入。:keyword:`nonlocal` 容許" "對外層作用域進行寫入。" -#: ../../glossary.rst:920 +#: ../../glossary.rst:942 msgid "new-style class" msgstr "new-style class(新式類別)" -#: ../../glossary.rst:922 +#: ../../glossary.rst:944 msgid "" "Old name for the flavor of classes now used for all class objects. In " "earlier Python versions, only new-style classes could use Python's newer, " @@ -2125,11 +2170,11 @@ msgstr "" "__slots__`、描述器 (descriptor)、屬性 (property)、:meth:`~object." "__getattribute__`、class method(類別方法)和 static method(靜態方法)。" -#: ../../glossary.rst:927 +#: ../../glossary.rst:949 msgid "object" msgstr "object(物件)" -#: ../../glossary.rst:929 +#: ../../glossary.rst:951 msgid "" "Any data with state (attributes or value) and defined behavior (methods). " "Also the ultimate base class of any :term:`new-style class`." @@ -2137,11 +2182,11 @@ msgstr "" "具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任何 :term:" "`new-style class`\\ (新式類別)的最終 base class(基底類別)。" -#: ../../glossary.rst:932 +#: ../../glossary.rst:954 msgid "optimized scope" msgstr "optimized scope(最佳化作用域)" -#: ../../glossary.rst:934 +#: ../../glossary.rst:956 msgid "" "A scope where target local variable names are reliably known to the compiler " "when the code is compiled, allowing optimization of read and write access to " @@ -2152,11 +2197,11 @@ msgid "" "to optimized scopes." msgstr "" -#: ../../glossary.rst:941 +#: ../../glossary.rst:963 msgid "package" msgstr "package(套件)" -#: ../../glossary.rst:943 +#: ../../glossary.rst:965 msgid "" "A Python :term:`module` which can contain submodules or recursively, " "subpackages. Technically, a package is a Python module with a ``__path__`` " @@ -2166,17 +2211,17 @@ msgstr "" "迴的子套件 (subpackage)。技術上而言,套件就是具有 ``__path__`` 屬性的一個 " "Python 模組。" -#: ../../glossary.rst:947 +#: ../../glossary.rst:969 msgid "See also :term:`regular package` and :term:`namespace package`." msgstr "" "另請參閱 :term:`regular package`\\ (正規套件)和 :term:`namespace " "package`\\ (命名空間套件)。" -#: ../../glossary.rst:948 +#: ../../glossary.rst:970 msgid "parameter" msgstr "parameter(參數)" -#: ../../glossary.rst:950 +#: ../../glossary.rst:972 msgid "" "A named entity in a :term:`function` (or method) definition that specifies " "an :term:`argument` (or in some cases, arguments) that the function can " @@ -2186,7 +2231,7 @@ msgstr "" "它指明該函式能夠接受的一個 :term:`argument`\\ (引數),或在某些情況下指示多" "個引數。共有有五種不同的參數類型:" -#: ../../glossary.rst:954 +#: ../../glossary.rst:976 msgid "" ":dfn:`positional-or-keyword`: specifies an argument that can be passed " "either :term:`positionally ` or as a :term:`keyword argument " @@ -2197,11 +2242,11 @@ msgstr "" "置 `\\ 或是作為\\ :term:`關鍵字引數 `\\ 被傳遞的引數。這" "是參數的預設類型,例如以下的 *foo* 和 *bar*: ::" -#: ../../glossary.rst:959 +#: ../../glossary.rst:981 msgid "def func(foo, bar=None): ..." msgstr "def func(foo, bar=None): ..." -#: ../../glossary.rst:963 +#: ../../glossary.rst:985 msgid "" ":dfn:`positional-only`: specifies an argument that can be supplied only by " "position. Positional-only parameters can be defined by including a ``/`` " @@ -2212,11 +2257,11 @@ msgstr "" "式定義的參數列表中包含一個 ``/`` 字元,就可以在該字元前面定義僅限位置參數,例" "如以下的 *posonly1* 和 *posonly2*: ::" -#: ../../glossary.rst:968 +#: ../../glossary.rst:990 msgid "def func(posonly1, posonly2, /, positional_or_keyword): ..." msgstr "def func(posonly1, posonly2, /, positional_or_keyword): ..." -#: ../../glossary.rst:972 +#: ../../glossary.rst:994 msgid "" ":dfn:`keyword-only`: specifies an argument that can be supplied only by " "keyword. Keyword-only parameters can be defined by including a single var-" @@ -2229,11 +2274,11 @@ msgstr "" "單純的 ``*`` 字元,就可以在其後方定義僅限關鍵字參數,例如以下的 *kw_only1* " "和 *kw_only2*: ::" -#: ../../glossary.rst:978 +#: ../../glossary.rst:1000 msgid "def func(arg, *, kw_only1, kw_only2): ..." msgstr "def func(arg, *, kw_only1, kw_only2): ..." -#: ../../glossary.rst:980 +#: ../../glossary.rst:1002 msgid "" ":dfn:`var-positional`: specifies that an arbitrary sequence of positional " "arguments can be provided (in addition to any positional arguments already " @@ -2245,11 +2290,11 @@ msgstr "" "數(在已被其他參數接受的任何位置引數之外)。這類參數是透過在其參數名稱字首加" "上 ``*`` 來定義的,例如以下的 *args*: ::" -#: ../../glossary.rst:986 +#: ../../glossary.rst:1008 msgid "def func(*args, **kwargs): ..." msgstr "def func(*args, **kwargs): ..." -#: ../../glossary.rst:988 +#: ../../glossary.rst:1010 msgid "" ":dfn:`var-keyword`: specifies that arbitrarily many keyword arguments can be " "provided (in addition to any keyword arguments already accepted by other " @@ -2260,14 +2305,14 @@ msgstr "" "已被其他參數接受的任何關鍵字引數之外)。這類參數是透過在其參數名稱字首加上 " "``**`` 來定義的,例如上面範例中的 *kwargs*。" -#: ../../glossary.rst:994 +#: ../../glossary.rst:1016 msgid "" "Parameters can specify both optional and required arguments, as well as " "default values for some optional arguments." msgstr "" "參數可以指明引數是選擇性的或必需的,也可以為一些選擇性的引數指定預設值。" -#: ../../glossary.rst:997 +#: ../../glossary.rst:1019 msgid "" "See also the :term:`argument` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " @@ -2278,11 +2323,11 @@ msgstr "" "參數之間的差異 `、:class:`inspect.Parameter` " "class、:ref:`function`\\ 章節,以及 :pep:`362`。" -#: ../../glossary.rst:1001 +#: ../../glossary.rst:1023 msgid "path entry" msgstr "path entry(路徑項目)" -#: ../../glossary.rst:1003 +#: ../../glossary.rst:1025 msgid "" "A single location on the :term:`import path` which the :term:`path based " "finder` consults to find modules for importing." @@ -2290,11 +2335,11 @@ msgstr "" "在 :term:`import path`\\ (引入路徑)中的一個位置,而 :term:`path based " "finder` (基於路徑的尋檢器)會參考該位置來尋找要 import 的模組。" -#: ../../glossary.rst:1005 +#: ../../glossary.rst:1027 msgid "path entry finder" msgstr "path entry finder(路徑項目尋檢器)" -#: ../../glossary.rst:1007 +#: ../../glossary.rst:1029 msgid "" "A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. a :" "term:`path entry hook`) which knows how to locate modules given a :term:" @@ -2304,7 +2349,7 @@ msgstr "" "`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一個 :term:" "`path entry`\\ 定位模組。" -#: ../../glossary.rst:1011 +#: ../../glossary.rst:1033 msgid "" "See :class:`importlib.abc.PathEntryFinder` for the methods that path entry " "finders implement." @@ -2312,11 +2357,11 @@ msgstr "" "關於路徑項目尋檢器實作的 method,請參閱 :class:`importlib.abc." "PathEntryFinder`。" -#: ../../glossary.rst:1013 +#: ../../glossary.rst:1035 msgid "path entry hook" msgstr "path entry hook(路徑項目鉤)" -#: ../../glossary.rst:1015 +#: ../../glossary.rst:1037 msgid "" "A callable on the :data:`sys.path_hooks` list which returns a :term:`path " "entry finder` if it knows how to find modules on a specific :term:`path " @@ -2326,11 +2371,11 @@ msgstr "" "個特定的 :term:`path entry` 中尋找模組,則會回傳一個 :term:`path entry " "finder`\\ (路徑項目尋檢器)。" -#: ../../glossary.rst:1018 +#: ../../glossary.rst:1040 msgid "path based finder" msgstr "path based finder(基於路徑的尋檢器)" -#: ../../glossary.rst:1020 +#: ../../glossary.rst:1042 msgid "" "One of the default :term:`meta path finders ` which " "searches an :term:`import path` for modules." @@ -2338,11 +2383,11 @@ msgstr "" "預設的\\ :term:`元路徑尋檢器 (meta path finder) ` 之一,它" "會在一個 :term:`import path` 中搜尋模組。" -#: ../../glossary.rst:1022 +#: ../../glossary.rst:1044 msgid "path-like object" msgstr "path-like object(類路徑物件)" -#: ../../glossary.rst:1024 +#: ../../glossary.rst:1046 msgid "" "An object representing a file system path. A path-like object is either a :" "class:`str` or :class:`bytes` object representing a path, or an object " @@ -2360,11 +2405,11 @@ msgstr "" "`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結果。由 :" "pep:`519` 引入。" -#: ../../glossary.rst:1032 +#: ../../glossary.rst:1054 msgid "PEP" msgstr "PEP" -#: ../../glossary.rst:1034 +#: ../../glossary.rst:1056 msgid "" "Python Enhancement Proposal. A PEP is a design document providing " "information to the Python community, or describing a new feature for Python " @@ -2375,7 +2420,7 @@ msgstr "" "為 Python 社群提供資訊,或是描述 Python 的一個新功能或該功能的程序和環境。" "PEP 應該要提供簡潔的技術規範以及被提案功能的運作原理。" -#: ../../glossary.rst:1040 +#: ../../glossary.rst:1062 msgid "" "PEPs are intended to be the primary mechanisms for proposing major new " "features, for collecting community input on an issue, and for documenting " @@ -2387,15 +2432,15 @@ msgstr "" "已納入 Python 的設計決策的記錄,這些過程的主要機制。PEP 的作者要負責在社群內" "建立共識並記錄反對意見。" -#: ../../glossary.rst:1046 +#: ../../glossary.rst:1068 msgid "See :pep:`1`." msgstr "請參閱 :pep:`1`。" -#: ../../glossary.rst:1047 +#: ../../glossary.rst:1069 msgid "portion" msgstr "portion(部分)" -#: ../../glossary.rst:1049 +#: ../../glossary.rst:1071 msgid "" "A set of files in a single directory (possibly stored in a zip file) that " "contribute to a namespace package, as defined in :pep:`420`." @@ -2403,15 +2448,15 @@ msgstr "" "在單一目錄中的一組檔案(也可能儲存在一個 zip 檔中),這些檔案能對一個命名空間" "套件 (namespace package) 有所貢獻,如同 :pep:`420` 中的定義。" -#: ../../glossary.rst:1051 +#: ../../glossary.rst:1073 msgid "positional argument" msgstr "positional argument(位置引數)" -#: ../../glossary.rst:1054 +#: ../../glossary.rst:1076 msgid "provisional API" msgstr "provisional API(暫行 API)" -#: ../../glossary.rst:1056 +#: ../../glossary.rst:1078 msgid "" "A provisional API is one which has been deliberately excluded from the " "standard library's backwards compatibility guarantees. While major changes " @@ -2427,7 +2472,7 @@ msgstr "" "該介面)。這種變更並不會無端地產生——只有 API 被納入之前未察覺的嚴重基本缺陷被" "揭露時,它們才會發生。" -#: ../../glossary.rst:1065 +#: ../../glossary.rst:1087 msgid "" "Even for provisional APIs, backwards incompatible changes are seen as a " "\"solution of last resort\" - every attempt will still be made to find a " @@ -2436,7 +2481,7 @@ msgstr "" "即使對於暫行 API,向後不相容的變更也會被視為「最後的解決方案」——對於任何被發" "現的問題,仍然會盡可能找出一個向後相容的解決方案。" -#: ../../glossary.rst:1069 +#: ../../glossary.rst:1091 msgid "" "This process allows the standard library to continue to evolve over time, " "without locking in problematic design errors for extended periods of time. " @@ -2445,19 +2490,19 @@ msgstr "" "這個過程使得標準函式庫能隨著時間不斷進化,而避免耗費過長的時間去鎖定有問題的" "設計錯誤。請參閱 :pep:`411` 了解更多細節。" -#: ../../glossary.rst:1072 +#: ../../glossary.rst:1094 msgid "provisional package" msgstr "provisional package(暫行套件)" -#: ../../glossary.rst:1074 +#: ../../glossary.rst:1096 msgid "See :term:`provisional API`." msgstr "請參閱 :term:`provisional API`\\ (暫行 API)。" -#: ../../glossary.rst:1075 +#: ../../glossary.rst:1097 msgid "Python 3000" msgstr "Python 3000" -#: ../../glossary.rst:1077 +#: ../../glossary.rst:1099 msgid "" "Nickname for the Python 3.x release line (coined long ago when the release " "of version 3 was something in the distant future.) This is also abbreviated " @@ -2466,11 +2511,11 @@ msgstr "" "Python 3.x 系列版本的暱稱(很久以前創造的,當時第 3 版的發布是在遙遠的未" "來。)也可以縮寫為「Py3k」。" -#: ../../glossary.rst:1080 +#: ../../glossary.rst:1102 msgid "Pythonic" msgstr "Pythonic(Python 風格的)" -#: ../../glossary.rst:1082 +#: ../../glossary.rst:1104 msgid "" "An idea or piece of code which closely follows the most common idioms of the " "Python language, rather than implementing code using concepts common to " @@ -2484,7 +2529,7 @@ msgstr "" "keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並沒有" "這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" -#: ../../glossary.rst:1089 +#: ../../glossary.rst:1111 msgid "" "for i in range(len(food)):\n" " print(food[i])" @@ -2492,11 +2537,11 @@ msgstr "" "for i in range(len(food)):\n" " print(food[i])" -#: ../../glossary.rst:1092 +#: ../../glossary.rst:1114 msgid "As opposed to the cleaner, Pythonic method::" msgstr "相較之下,以下方法更簡潔、更具有 Python 風格: ::" -#: ../../glossary.rst:1094 +#: ../../glossary.rst:1116 msgid "" "for piece in food:\n" " print(piece)" @@ -2504,11 +2549,11 @@ msgstr "" "for piece in food:\n" " print(piece)" -#: ../../glossary.rst:1096 +#: ../../glossary.rst:1118 msgid "qualified name" msgstr "qualified name(限定名稱)" -#: ../../glossary.rst:1098 +#: ../../glossary.rst:1120 msgid "" "A dotted name showing the \"path\" from a module's global scope to a class, " "function or method defined in that module, as defined in :pep:`3155`. For " @@ -2519,7 +2564,7 @@ msgstr "" "或 method 的「路徑」,如 :pep:`3155` 中的定義。對於頂層的函式和 class 而言," "限定名稱與其物件名稱相同: ::" -#: ../../glossary.rst:1103 +#: ../../glossary.rst:1125 msgid "" ">>> class C:\n" "... class D:\n" @@ -2545,7 +2590,7 @@ msgstr "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" -#: ../../glossary.rst:1115 +#: ../../glossary.rst:1137 msgid "" "When used to refer to modules, the *fully qualified name* means the entire " "dotted path to the module, including any parent packages, e.g. ``email.mime." @@ -2554,7 +2599,7 @@ msgstr "" "當用於引用模組時,*完全限定名稱 (fully qualified name)* 是表示該模組的完整點" "分隔路徑,包括任何的父套件,例如 ``email.mime.text``: ::" -#: ../../glossary.rst:1119 +#: ../../glossary.rst:1141 msgid "" ">>> import email.mime.text\n" ">>> email.mime.text.__name__\n" @@ -2564,11 +2609,11 @@ msgstr "" ">>> email.mime.text.__name__\n" "'email.mime.text'" -#: ../../glossary.rst:1122 +#: ../../glossary.rst:1144 msgid "reference count" msgstr "reference count(參照計數)" -#: ../../glossary.rst:1124 +#: ../../glossary.rst:1146 msgid "" "The number of references to an object. When the reference count of an " "object drops to zero, it is deallocated. Some objects are :term:`immortal` " @@ -2584,11 +2629,11 @@ msgstr "" "看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :" "func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" -#: ../../glossary.rst:1132 +#: ../../glossary.rst:1154 msgid "regular package" msgstr "regular package(正規套件)" -#: ../../glossary.rst:1134 +#: ../../glossary.rst:1156 msgid "" "A traditional :term:`package`, such as a directory containing an ``__init__." "py`` file." @@ -2596,15 +2641,15 @@ msgstr "" "一個傳統的 :term:`package`\\ (套件),例如一個包含 ``__init__.py`` 檔案的目" "錄。" -#: ../../glossary.rst:1137 +#: ../../glossary.rst:1159 msgid "See also :term:`namespace package`." msgstr "另請參閱 :term:`namespace package`\\ (命名空間套件)。" -#: ../../glossary.rst:1138 +#: ../../glossary.rst:1160 msgid "REPL" msgstr "REPL" -#: ../../glossary.rst:1140 +#: ../../glossary.rst:1162 msgid "" "An acronym for the \"read–eval–print loop\", another name for the :term:" "`interactive` interpreter shell." @@ -2612,11 +2657,11 @@ msgstr "" "「read-eval-print 迴圈 (read–eval–print loop)」的縮寫,是\\ :term:`互動式 " "`\\ 直譯器 shell 的另一個名稱。" -#: ../../glossary.rst:1142 +#: ../../glossary.rst:1164 msgid "__slots__" msgstr "__slots__" -#: ../../glossary.rst:1144 +#: ../../glossary.rst:1166 msgid "" "A declaration inside a class that saves memory by pre-declaring space for " "instance attributes and eliminating instance dictionaries. Though popular, " @@ -2629,11 +2674,11 @@ msgstr "" "最好保留給那種在一個記憶體關鍵 (memory-critical) 的應用程式中存在大量實例的罕" "見情況。" -#: ../../glossary.rst:1149 +#: ../../glossary.rst:1171 msgid "sequence" msgstr "sequence(序列)" -#: ../../glossary.rst:1151 +#: ../../glossary.rst:1173 msgid "" "An :term:`iterable` which supports efficient element access using integer " "indices via the :meth:`~object.__getitem__` special method and defines a :" @@ -2652,7 +2697,7 @@ msgstr "" "為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` 鍵," "而不是整數。" -#: ../../glossary.rst:1160 +#: ../../glossary.rst:1182 msgid "" "The :class:`collections.abc.Sequence` abstract base class defines a much " "richer interface that goes beyond just :meth:`~object.__getitem__` and :meth:" @@ -2669,11 +2714,11 @@ msgstr "" "用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於序列方法的文件,請見" "\\ :ref:`常見序列操作 `。" -#: ../../glossary.rst:1169 +#: ../../glossary.rst:1191 msgid "set comprehension" msgstr "set comprehension(集合綜合運算)" -#: ../../glossary.rst:1171 +#: ../../glossary.rst:1193 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a set with the results. ``results = {c for c in 'abracadabra' if c " @@ -2684,11 +2729,11 @@ msgstr "" "set 回傳。``results = {c for c in 'abracadabra' if c not in 'abc'}`` 會產生一" "個字串 set:``{'r', 'd'}``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:1175 +#: ../../glossary.rst:1197 msgid "single dispatch" msgstr "single dispatch(單一調度)" -#: ../../glossary.rst:1177 +#: ../../glossary.rst:1199 msgid "" "A form of :term:`generic function` dispatch where the implementation is " "chosen based on the type of a single argument." @@ -2696,11 +2741,11 @@ msgstr "" ":term:`generic function`\\ (泛型函式)調度的一種形式,在此,實作的選擇是基於" "單一引數的型別。" -#: ../../glossary.rst:1179 +#: ../../glossary.rst:1201 msgid "slice" msgstr "slice(切片)" -#: ../../glossary.rst:1181 +#: ../../glossary.rst:1203 msgid "" "An object usually containing a portion of a :term:`sequence`. A slice is " "created using the subscript notation, ``[]`` with colons between numbers " @@ -2712,11 +2757,11 @@ msgstr "" "之間使用冒號,例如 ``variable_name[1:3:5]``。在括號(下標)符號的內部,會使" "用 :class:`slice` 物件。" -#: ../../glossary.rst:1185 +#: ../../glossary.rst:1207 msgid "soft deprecated" msgstr "soft deprecated(軟性棄用)" -#: ../../glossary.rst:1187 +#: ../../glossary.rst:1209 msgid "" "A soft deprecated API should not be used in new code, but it is safe for " "already existing code to use it. The API remains documented and tested, but " @@ -2725,13 +2770,13 @@ msgstr "" "被軟性棄用的 API 代表不應再用於新程式碼中,但在現有程式碼中繼續使用它仍會是安" "全的。API 仍會以文件記錄並會被測試,但不會被繼續改進。" -#: ../../glossary.rst:1191 +#: ../../glossary.rst:1213 msgid "" "Soft deprecation, unlike normal deprecation, does not plan on removing the " "API and will not emit warnings." msgstr "與正常棄用不同,軟性棄用沒有刪除 API 的規劃,也不會發出警告。" -#: ../../glossary.rst:1194 +#: ../../glossary.rst:1216 msgid "" "See `PEP 387: Soft Deprecation `_." @@ -2739,11 +2784,11 @@ msgstr "" "請參閱 `PEP 387:軟性棄用 `_。" -#: ../../glossary.rst:1196 +#: ../../glossary.rst:1218 msgid "special method" msgstr "special method(特殊方法)" -#: ../../glossary.rst:1200 +#: ../../glossary.rst:1222 msgid "" "A method that is called implicitly by Python to execute a certain operation " "on a type, such as addition. Such methods have names starting and ending " @@ -2754,11 +2799,11 @@ msgstr "" "種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在\\ :ref:" "`specialnames`\\ 中有詳細說明。" -#: ../../glossary.rst:1204 +#: ../../glossary.rst:1226 msgid "statement" msgstr "statement(陳述式)" -#: ../../glossary.rst:1206 +#: ../../glossary.rst:1228 msgid "" "A statement is part of a suite (a \"block\" of code). A statement is either " "an :term:`expression` or one of several constructs with a keyword, such as :" @@ -2768,11 +2813,11 @@ msgstr "" "term:`expression`\\ (運算式),或是含有關鍵字(例如 :keyword:`if`、:keyword:" "`while` 或 :keyword:`for`\\ )的多種結構之一。" -#: ../../glossary.rst:1209 +#: ../../glossary.rst:1231 msgid "static type checker" msgstr "static type checker(靜態型別檢查器)" -#: ../../glossary.rst:1211 +#: ../../glossary.rst:1233 msgid "" "An external tool that reads Python code and analyzes it, looking for issues " "such as incorrect types. See also :term:`type hints ` and the :" @@ -2782,11 +2827,11 @@ msgstr "" "另請參閱\\ :term:`型別提示 (type hints) ` 以及 :mod:`typing` 模" "組。" -#: ../../glossary.rst:1214 +#: ../../glossary.rst:1236 msgid "strong reference" msgstr "strong reference(強參照)" -#: ../../glossary.rst:1216 +#: ../../glossary.rst:1238 msgid "" "In Python's C API, a strong reference is a reference to an object which is " "owned by the code holding the reference. The strong reference is taken by " @@ -2797,7 +2842,7 @@ msgstr "" "有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透過 :c:" "func:`Py_DECREF` 釋放強參照。" -#: ../../glossary.rst:1222 +#: ../../glossary.rst:1244 msgid "" "The :c:func:`Py_NewRef` function can be used to create a strong reference to " "an object. Usually, the :c:func:`Py_DECREF` function must be called on the " @@ -2807,15 +2852,15 @@ msgstr "" ":c:func:`Py_NewRef` 函式可用於建立一個對物件的強參照。通常,在退出強參照的作" "用域之前,必須在該強參照上呼叫 :c:func:`Py_DECREF` 函式,以避免洩漏一個參照。" -#: ../../glossary.rst:1227 +#: ../../glossary.rst:1249 msgid "See also :term:`borrowed reference`." msgstr "另請參閱 :term:`borrowed reference`\\ (借用參照)。" -#: ../../glossary.rst:1228 +#: ../../glossary.rst:1250 msgid "text encoding" msgstr "text encoding(文字編碼)" -#: ../../glossary.rst:1230 +#: ../../glossary.rst:1252 msgid "" "A string in Python is a sequence of Unicode code points (in range " "``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be " @@ -2824,7 +2869,7 @@ msgstr "" "Python 中的字串是一個 Unicode 碼點 (code point) 的序列(範圍在 ``U+0000`` -- " "``U+10FFFF`` 之間)。若要儲存或傳送一個字串,它必須被序列化為一個位元組序列。" -#: ../../glossary.rst:1234 +#: ../../glossary.rst:1256 msgid "" "Serializing a string into a sequence of bytes is known as \"encoding\", and " "recreating the string from the sequence of bytes is known as \"decoding\"." @@ -2832,7 +2877,7 @@ msgstr "" "將一個字串序列化為位元組序列,稱為「編碼」,而從位元組序列重新建立該字串則稱" "為「解碼 (decoding)」。" -#: ../../glossary.rst:1237 +#: ../../glossary.rst:1259 msgid "" "There are a variety of different text serialization :ref:`codecs `, which are collectively referred to as \"text encodings\"." @@ -2840,11 +2885,11 @@ msgstr "" "有多種不同的文字序列化編解碼器 (:ref:`codecs `),它們被統" "稱為「文字編碼」。" -#: ../../glossary.rst:1240 +#: ../../glossary.rst:1262 msgid "text file" msgstr "text file(文字檔案)" -#: ../../glossary.rst:1242 +#: ../../glossary.rst:1264 msgid "" "A :term:`file object` able to read and write :class:`str` objects. Often, a " "text file actually accesses a byte-oriented datastream and handles the :term:" @@ -2858,7 +2903,7 @@ msgstr "" "有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔案、:data:`sys.stdin`、:data:" "`sys.stdout` 以及 :class:`io.StringIO` 的實例。" -#: ../../glossary.rst:1249 +#: ../../glossary.rst:1271 msgid "" "See also :term:`binary file` for a file object able to read and write :term:" "`bytes-like objects `." @@ -2866,11 +2911,11 @@ msgstr "" "另請參閱 :term:`binary file`\\ (二進位檔案),它是一個能夠讀取和寫入\\ :" "term:`類位元組串物件 (bytes-like object) ` 的檔案物件。" -#: ../../glossary.rst:1251 +#: ../../glossary.rst:1273 msgid "triple-quoted string" msgstr "triple-quoted string(三引號內字串)" -#: ../../glossary.rst:1253 +#: ../../glossary.rst:1275 msgid "" "A string which is bound by three instances of either a quotation mark (\") " "or an apostrophe ('). While they don't provide any functionality not " @@ -2885,11 +2930,11 @@ msgstr "" "中包含未跳脫 (unescaped) 的單引號和雙引號,而且它們不需使用連續字元 " "(continuation character) 就可以跨越多行,這使得它們在編寫說明字串時特別有用。" -#: ../../glossary.rst:1260 +#: ../../glossary.rst:1282 msgid "type" msgstr "type(型別)" -#: ../../glossary.rst:1262 +#: ../../glossary.rst:1284 msgid "" "The type of a Python object determines what kind of object it is; every " "object has a type. An object's type is accessible as its :attr:`~object." @@ -2899,22 +2944,22 @@ msgstr "" "件的型別可以用它的 :attr:`~object.__class__` 屬性來存取,或以 ``type(obj)`` " "來檢索。" -#: ../../glossary.rst:1266 +#: ../../glossary.rst:1288 msgid "type alias" msgstr "type alias(型別別名)" -#: ../../glossary.rst:1268 +#: ../../glossary.rst:1290 msgid "A synonym for a type, created by assigning the type to an identifier." msgstr "一個型別的同義詞,透過將型別指定給一個識別符 (identifier) 來建立。" -#: ../../glossary.rst:1270 +#: ../../glossary.rst:1292 msgid "" "Type aliases are useful for simplifying :term:`type hints `. For " "example::" msgstr "" "型別別名對於簡化\\ :term:`型別提示 (type hint) ` 很有用。例如: ::" -#: ../../glossary.rst:1273 +#: ../../glossary.rst:1295 msgid "" "def remove_gray_shades(\n" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" @@ -2924,11 +2969,11 @@ msgstr "" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" " pass" -#: ../../glossary.rst:1277 +#: ../../glossary.rst:1299 msgid "could be made more readable like this::" msgstr "可以寫成這樣,更具有可讀性: ::" -#: ../../glossary.rst:1279 +#: ../../glossary.rst:1301 msgid "" "Color = tuple[int, int, int]\n" "\n" @@ -2940,15 +2985,15 @@ msgstr "" "def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" " pass" -#: ../../glossary.rst:1284 ../../glossary.rst:1298 +#: ../../glossary.rst:1306 ../../glossary.rst:1320 msgid "See :mod:`typing` and :pep:`484`, which describe this functionality." msgstr "請參閱 :mod:`typing` 和 :pep:`484`,有此功能的描述。" -#: ../../glossary.rst:1285 +#: ../../glossary.rst:1307 msgid "type hint" msgstr "type hint(型別提示)" -#: ../../glossary.rst:1287 +#: ../../glossary.rst:1309 msgid "" "An :term:`annotation` that specifies the expected type for a variable, a " "class attribute, or a function parameter or return value." @@ -2956,7 +3001,7 @@ msgstr "" "一種 :term:`annotation`\\ (註釋),它指定一個變數、一個 class 屬性或一個函式" "的參數或回傳值的預期型別。" -#: ../../glossary.rst:1290 +#: ../../glossary.rst:1312 msgid "" "Type hints are optional and are not enforced by Python but they are useful " "to :term:`static type checkers `. They can also aid " @@ -2966,7 +3011,7 @@ msgstr "" "(static type checkers) `\\ 很有用,並能協助 IDE 完成程式" "碼的補全 (completion) 和重構 (refactoring)。" -#: ../../glossary.rst:1294 +#: ../../glossary.rst:1316 msgid "" "Type hints of global variables, class attributes, and functions, but not " "local variables, can be accessed using :func:`typing.get_type_hints`." @@ -2974,11 +3019,11 @@ msgstr "" "全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使用 :func:" "`typing.get_type_hints` 來存取。" -#: ../../glossary.rst:1299 +#: ../../glossary.rst:1321 msgid "universal newlines" msgstr "universal newlines(通用換行字元)" -#: ../../glossary.rst:1301 +#: ../../glossary.rst:1323 msgid "" "A manner of interpreting text streams in which all of the following are " "recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the " @@ -2991,20 +3036,20 @@ msgstr "" "``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用於 :func:`bytes." "splitlines` 的附加用途。" -#: ../../glossary.rst:1306 +#: ../../glossary.rst:1328 msgid "variable annotation" msgstr "variable annotation(變數註釋)" -#: ../../glossary.rst:1308 +#: ../../glossary.rst:1330 msgid "An :term:`annotation` of a variable or a class attribute." msgstr "一個變數或 class 屬性的 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:1310 +#: ../../glossary.rst:1332 msgid "" "When annotating a variable or a class attribute, assignment is optional::" msgstr "註釋變數或 class 屬性時,賦值是選擇性的: ::" -#: ../../glossary.rst:1312 +#: ../../glossary.rst:1334 msgid "" "class C:\n" " field: 'annotation'" @@ -3012,7 +3057,7 @@ msgstr "" "class C:\n" " field: 'annotation'" -#: ../../glossary.rst:1315 +#: ../../glossary.rst:1337 msgid "" "Variable annotations are usually used for :term:`type hints `: " "for example this variable is expected to take :class:`int` values::" @@ -3020,15 +3065,15 @@ msgstr "" "變數註釋通常用於\\ :term:`型別提示 (type hint) `:例如,這個變數預" "期會取得 :class:`int`\\ (整數)值: ::" -#: ../../glossary.rst:1319 +#: ../../glossary.rst:1341 msgid "count: int = 0" msgstr "count: int = 0" -#: ../../glossary.rst:1321 +#: ../../glossary.rst:1343 msgid "Variable annotation syntax is explained in section :ref:`annassign`." msgstr "變數註釋的語法在\\ :ref:`annassign`\\ 章節有詳細的解釋。" -#: ../../glossary.rst:1323 +#: ../../glossary.rst:1345 msgid "" "See :term:`function annotation`, :pep:`484` and :pep:`526`, which describe " "this functionality. Also see :ref:`annotations-howto` for best practices on " @@ -3037,11 +3082,11 @@ msgstr "" "請參閱 :term:`function annotation`\\ (函式註釋)、:pep:`484` 和 :pep:`526`," "皆有此功能的描述。關於註釋的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:1327 +#: ../../glossary.rst:1349 msgid "virtual environment" msgstr "virtual environment(虛擬環境)" -#: ../../glossary.rst:1329 +#: ../../glossary.rst:1351 msgid "" "A cooperatively isolated runtime environment that allows Python users and " "applications to install and upgrade Python distribution packages without " @@ -3052,15 +3097,15 @@ msgstr "" "程式得以安裝和升級 Python 發佈套件,而不會對同一個系統上運行的其他 Python 應" "用程式的行為產生干擾。" -#: ../../glossary.rst:1334 +#: ../../glossary.rst:1356 msgid "See also :mod:`venv`." msgstr "另請參閱 :mod:`venv`。" -#: ../../glossary.rst:1335 +#: ../../glossary.rst:1357 msgid "virtual machine" msgstr "virtual machine(虛擬機器)" -#: ../../glossary.rst:1337 +#: ../../glossary.rst:1359 msgid "" "A computer defined entirely in software. Python's virtual machine executes " "the :term:`bytecode` emitted by the bytecode compiler." @@ -3068,11 +3113,11 @@ msgstr "" "一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行由 :term:" "`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" -#: ../../glossary.rst:1339 +#: ../../glossary.rst:1361 msgid "Zen of Python" msgstr "Zen of Python(Python 之禪)" -#: ../../glossary.rst:1341 +#: ../../glossary.rst:1363 msgid "" "Listing of Python design principles and philosophies that are helpful in " "understanding and using the language. The listing can be found by typing " @@ -3081,22 +3126,45 @@ msgstr "" "Python 設計原則與哲學的列表,其內容有助於理解和使用此語言。此列表可以透過在互" "動式提式字元後輸入「``import this``」來找到它。" -#: ../../glossary.rst:278 +#: ../../glossary.rst:292 msgid "C-contiguous" msgstr "C-contiguous(C 連續的)" -#: ../../glossary.rst:278 +#: ../../glossary.rst:292 msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" -#: ../../glossary.rst:803 +#: ../../glossary.rst:825 msgid "magic" msgstr "magic" -#: ../../glossary.rst:1198 +#: ../../glossary.rst:1220 msgid "special" msgstr "special" +#~ msgid "" +#~ "An object which controls the environment seen in a :keyword:`with` " +#~ "statement by defining :meth:`~object.__enter__` and :meth:`~object." +#~ "__exit__` methods. See :pep:`343`." +#~ msgstr "" +#~ "一個可以控制 :keyword:`with` 陳述式中所見環境的物件,而它是透過定義 :meth:" +#~ "`~object.__enter__` 和 :meth:`~object.__exit__` method 來控制的。請參閱 :" +#~ "pep:`343`。" + +#~ msgid "" +#~ "A variable which can have different values depending on its context. This " +#~ "is similar to Thread-Local Storage in which each execution thread may " +#~ "have a different value for a variable. However, with context variables, " +#~ "there may be several contexts in one execution thread and the main usage " +#~ "for context variables is to keep track of variables in concurrent " +#~ "asynchronous tasks. See :mod:`contextvars`." +#~ msgstr "" +#~ "一個變數,其值可以根據上下文的情境而有所不同。這類似執行緒區域儲存區 " +#~ "(Thread-Local Storage),在其中,一個變數在每個執行緒可能具有不同的值。然" +#~ "而,關於情境變數,在一個執行緒中可能會有多個情境,而情境變數的主要用途,是" +#~ "在並行的非同步任務 (concurrent asynchronous task) 中,對於變數狀態的追蹤。" +#~ "請參閱 :mod:`contextvars`。" + #~ msgid "" #~ "The main difference between a \"soft\" and a (regular) \"hard\" " #~ "deprecation is that the soft deprecation does not imply scheduling the " diff --git a/howto/enum.po b/howto/enum.po index 668b2723f2..c4f912e5cb 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -801,7 +801,7 @@ msgstr "" #: ../../howto/enum.rst:415 msgid "Then::" -msgstr "" +msgstr "然後: ::" #: ../../howto/enum.rst:417 msgid "" @@ -1238,7 +1238,7 @@ msgstr "" #: ../../howto/enum.rst:664 msgid "IntEnum" -msgstr "" +msgstr "IntEnum" #: ../../howto/enum.rst:666 msgid "" diff --git a/howto/free-threading-python.po b/howto/free-threading-python.po index 5578166a5d..519f70b2e5 100644 --- a/howto/free-threading-python.po +++ b/howto/free-threading-python.po @@ -121,11 +121,11 @@ msgstr "" #: ../../howto/free-threading-python.rst:70 msgid "https://py-free-threading.github.io/tracking/" -msgstr "" +msgstr "https://py-free-threading.github.io/tracking/" #: ../../howto/free-threading-python.rst:71 msgid "https://hugovk.github.io/free-threaded-wheels/" -msgstr "" +msgstr "https://hugovk.github.io/free-threaded-wheels/" #: ../../howto/free-threading-python.rst:75 msgid "Thread safety" @@ -229,7 +229,7 @@ msgstr "" #: ../../howto/free-threading-python.rst:135 msgid "Iterators" -msgstr "" +msgstr "疊代器" #: ../../howto/free-threading-python.rst:137 msgid "" diff --git a/howto/functional.po b/howto/functional.po index f55926dec9..a145631968 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -291,7 +291,7 @@ msgstr "" #: ../../howto/functional.rst:180 msgid "Iterators" -msgstr "" +msgstr "疊代器" #: ../../howto/functional.rst:182 msgid "" @@ -668,7 +668,7 @@ msgstr "" #: ../../howto/functional.rst:439 msgid "Generators" -msgstr "" +msgstr "產生器" #: ../../howto/functional.rst:441 msgid "" @@ -1982,7 +1982,7 @@ msgstr "https://en.wikipedia.org/wiki/Currying:%20currying%20%E6%A6%82%E5%BF%B5%E7%9A%84%E6%A2%9D%E7%9B%AE%E3%80%82" #: ../../howto/functional.rst:1233 msgid "Python-specific" -msgstr "" +msgstr "Python 特有的" #: ../../howto/functional.rst:1235 msgid "" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index abe416bd57..340d2075f3 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-11-08 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1653,14 +1653,11 @@ msgstr "" msgid "" "You could also write your own handler which uses the :class:" "`~multiprocessing.Lock` class from the :mod:`multiprocessing` module to " -"serialize access to the file from your processes. The existing :class:" -"`FileHandler` and subclasses do not make use of :mod:`multiprocessing` at " -"present, though they may do so in the future. Note that at present, the :mod:" -"`multiprocessing` module does not provide working lock functionality on all " -"platforms (see https://bugs.python.org/issue3770)." +"serialize access to the file from your processes. The stdlib :class:" +"`FileHandler` and subclasses do not make use of :mod:`multiprocessing`." msgstr "" -#: ../../howto/logging-cookbook.rst:1278 +#: ../../howto/logging-cookbook.rst:1275 msgid "" "Alternatively, you can use a ``Queue`` and a :class:`QueueHandler` to send " "all logging events to one of the processes in your multi-process " @@ -1675,7 +1672,7 @@ msgid "" "requirements::" msgstr "" -#: ../../howto/logging-cookbook.rst:1289 +#: ../../howto/logging-cookbook.rst:1286 msgid "" "# You'll need these imports in your own code\n" "import logging\n" @@ -1795,13 +1792,13 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1394 +#: ../../howto/logging-cookbook.rst:1391 msgid "" "A variant of the above script keeps the logging in the main process, in a " "separate thread::" msgstr "" -#: ../../howto/logging-cookbook.rst:1397 +#: ../../howto/logging-cookbook.rst:1394 msgid "" "import logging\n" "import logging.config\n" @@ -1898,7 +1895,7 @@ msgid "" " lp.join()" msgstr "" -#: ../../howto/logging-cookbook.rst:1489 +#: ../../howto/logging-cookbook.rst:1486 msgid "" "This variant shows how you can e.g. apply configuration for particular " "loggers - e.g. the ``foo`` logger has a special handler which stores all " @@ -1908,36 +1905,36 @@ msgid "" "appropriate destinations." msgstr "" -#: ../../howto/logging-cookbook.rst:1496 +#: ../../howto/logging-cookbook.rst:1493 msgid "Using concurrent.futures.ProcessPoolExecutor" -msgstr "" +msgstr "使用 concurrent.futures.ProcessPoolExecutor" -#: ../../howto/logging-cookbook.rst:1498 +#: ../../howto/logging-cookbook.rst:1495 msgid "" "If you want to use :class:`concurrent.futures.ProcessPoolExecutor` to start " "your worker processes, you need to create the queue slightly differently. " "Instead of" msgstr "" -#: ../../howto/logging-cookbook.rst:1502 +#: ../../howto/logging-cookbook.rst:1499 msgid "queue = multiprocessing.Queue(-1)" -msgstr "" +msgstr "queue = multiprocessing.Queue(-1)" -#: ../../howto/logging-cookbook.rst:1506 +#: ../../howto/logging-cookbook.rst:1503 msgid "you should use" msgstr "" -#: ../../howto/logging-cookbook.rst:1508 +#: ../../howto/logging-cookbook.rst:1505 msgid "" "queue = multiprocessing.Manager().Queue(-1) # also works with the examples " "above" msgstr "" -#: ../../howto/logging-cookbook.rst:1512 +#: ../../howto/logging-cookbook.rst:1509 msgid "and you can then replace the worker creation from this::" msgstr "" -#: ../../howto/logging-cookbook.rst:1514 +#: ../../howto/logging-cookbook.rst:1511 msgid "" "workers = []\n" "for i in range(10):\n" @@ -1949,22 +1946,22 @@ msgid "" " w.join()" msgstr "" -#: ../../howto/logging-cookbook.rst:1523 +#: ../../howto/logging-cookbook.rst:1520 msgid "to this (remembering to first import :mod:`concurrent.futures`)::" msgstr "" -#: ../../howto/logging-cookbook.rst:1525 +#: ../../howto/logging-cookbook.rst:1522 msgid "" "with concurrent.futures.ProcessPoolExecutor(max_workers=10) as executor:\n" " for i in range(10):\n" " executor.submit(worker_process, queue, worker_configurer)" msgstr "" -#: ../../howto/logging-cookbook.rst:1530 +#: ../../howto/logging-cookbook.rst:1527 msgid "Deploying Web applications using Gunicorn and uWSGI" msgstr "" -#: ../../howto/logging-cookbook.rst:1532 +#: ../../howto/logging-cookbook.rst:1529 msgid "" "When deploying Web applications using `Gunicorn `_ or " "`uWSGI `_ (or similar), " @@ -1976,11 +1973,11 @@ msgid "" "listener in production`_ for more details." msgstr "" -#: ../../howto/logging-cookbook.rst:1542 +#: ../../howto/logging-cookbook.rst:1539 msgid "Using file rotation" msgstr "" -#: ../../howto/logging-cookbook.rst:1547 +#: ../../howto/logging-cookbook.rst:1544 msgid "" "Sometimes you want to let a log file grow to a certain size, then open a new " "file and log to that. You may want to keep a certain number of these files, " @@ -1989,7 +1986,7 @@ msgid "" "usage pattern, the logging package provides a :class:`RotatingFileHandler`::" msgstr "" -#: ../../howto/logging-cookbook.rst:1553 +#: ../../howto/logging-cookbook.rst:1550 msgid "" "import glob\n" "import logging\n" @@ -2018,13 +2015,13 @@ msgid "" " print(filename)" msgstr "" -#: ../../howto/logging-cookbook.rst:1579 +#: ../../howto/logging-cookbook.rst:1576 msgid "" "The result should be 6 separate files, each with part of the log history for " "the application:" msgstr "" -#: ../../howto/logging-cookbook.rst:1582 +#: ../../howto/logging-cookbook.rst:1579 msgid "" "logging_rotatingfile_example.out\n" "logging_rotatingfile_example.out.1\n" @@ -2034,7 +2031,7 @@ msgid "" "logging_rotatingfile_example.out.5" msgstr "" -#: ../../howto/logging-cookbook.rst:1591 +#: ../../howto/logging-cookbook.rst:1588 msgid "" "The most current file is always :file:`logging_rotatingfile_example.out`, " "and each time it reaches the size limit it is renamed with the suffix " @@ -2042,17 +2039,17 @@ msgid "" "(``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased." msgstr "" -#: ../../howto/logging-cookbook.rst:1596 +#: ../../howto/logging-cookbook.rst:1593 msgid "" "Obviously this example sets the log length much too small as an extreme " "example. You would want to set *maxBytes* to an appropriate value." msgstr "" -#: ../../howto/logging-cookbook.rst:1604 +#: ../../howto/logging-cookbook.rst:1601 msgid "Use of alternative formatting styles" msgstr "" -#: ../../howto/logging-cookbook.rst:1606 +#: ../../howto/logging-cookbook.rst:1603 msgid "" "When logging was added to the Python standard library, the only way of " "formatting messages with variable content was to use the %-formatting " @@ -2061,7 +2058,7 @@ msgid "" "Python 2.6)." msgstr "" -#: ../../howto/logging-cookbook.rst:1612 +#: ../../howto/logging-cookbook.rst:1609 msgid "" "Logging (as of 3.2) provides improved support for these two additional " "formatting styles. The :class:`Formatter` class been enhanced to take an " @@ -2074,7 +2071,7 @@ msgid "" "session to show the possibilities:" msgstr "" -#: ../../howto/logging-cookbook.rst:1622 +#: ../../howto/logging-cookbook.rst:1619 msgid "" ">>> import logging\n" ">>> root = logging.getLogger()\n" @@ -2099,21 +2096,21 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1646 +#: ../../howto/logging-cookbook.rst:1643 msgid "" "Note that the formatting of logging messages for final output to logs is " "completely independent of how an individual logging message is constructed. " "That can still use %-formatting, as shown here::" msgstr "" -#: ../../howto/logging-cookbook.rst:1650 +#: ../../howto/logging-cookbook.rst:1647 msgid "" ">>> logger.error('This is an%s %s %s', 'other,', 'ERROR,', 'message')\n" "2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message\n" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1654 +#: ../../howto/logging-cookbook.rst:1651 msgid "" "Logging calls (``logger.debug()``, ``logger.info()`` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -2129,7 +2126,7 @@ msgid "" "strings." msgstr "" -#: ../../howto/logging-cookbook.rst:1667 +#: ../../howto/logging-cookbook.rst:1664 msgid "" "There is, however, a way that you can use {}- and $- formatting to construct " "your individual log messages. Recall that for a message you can use an " @@ -2138,7 +2135,7 @@ msgid "" "the following two classes::" msgstr "" -#: ../../howto/logging-cookbook.rst:1673 ../../howto/logging-cookbook.rst:2761 +#: ../../howto/logging-cookbook.rst:1670 ../../howto/logging-cookbook.rst:2758 msgid "" "class BraceMessage:\n" " def __init__(self, fmt, /, *args, **kwargs):\n" @@ -2176,7 +2173,7 @@ msgstr "" " from string import Template\n" " return Template(self.fmt).substitute(**self.kwargs)" -#: ../../howto/logging-cookbook.rst:1691 +#: ../../howto/logging-cookbook.rst:1688 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -2187,14 +2184,14 @@ msgid "" "used as a synonym/alias for :func:`gettext.gettext` or its brethren)." msgstr "" -#: ../../howto/logging-cookbook.rst:1699 +#: ../../howto/logging-cookbook.rst:1696 msgid "" "The above classes are not included in Python, though they're easy enough to " "copy and paste into your own code. They can be used as follows (assuming " "that they're declared in a module called ``wherever``):" msgstr "" -#: ../../howto/logging-cookbook.rst:1703 +#: ../../howto/logging-cookbook.rst:1700 msgid "" ">>> from wherever import BraceMessage as __\n" ">>> print(__('Message with {0} {name}', 2, name='placeholders'))\n" @@ -2213,14 +2210,14 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1721 +#: ../../howto/logging-cookbook.rst:1718 msgid "" "While the above examples use ``print()`` to show how the formatting works, " "you would of course use ``logger.debug()`` or similar to actually log using " "this approach." msgstr "" -#: ../../howto/logging-cookbook.rst:1725 +#: ../../howto/logging-cookbook.rst:1722 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -2231,13 +2228,13 @@ msgid "" "sugar for a constructor call to one of the :samp:`{XXX}Message` classes." msgstr "" -#: ../../howto/logging-cookbook.rst:1733 +#: ../../howto/logging-cookbook.rst:1730 msgid "" "If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar " "effect to the above, as in the following example::" msgstr "" -#: ../../howto/logging-cookbook.rst:1736 +#: ../../howto/logging-cookbook.rst:1733 msgid "" "import logging\n" "\n" @@ -2266,17 +2263,17 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1762 +#: ../../howto/logging-cookbook.rst:1759 msgid "" "The above script should log the message ``Hello, world!`` when run with " "Python 3.8 or later." msgstr "" -#: ../../howto/logging-cookbook.rst:1771 +#: ../../howto/logging-cookbook.rst:1768 msgid "Customizing ``LogRecord``" msgstr "" -#: ../../howto/logging-cookbook.rst:1773 +#: ../../howto/logging-cookbook.rst:1770 msgid "" "Every logging event is represented by a :class:`LogRecord` instance. When an " "event is logged and not filtered out by a logger's level, a :class:" @@ -2287,13 +2284,13 @@ msgid "" "was done:" msgstr "" -#: ../../howto/logging-cookbook.rst:1780 +#: ../../howto/logging-cookbook.rst:1777 msgid "" ":meth:`Logger.makeRecord`, which is called in the normal process of logging " "an event. This invoked :class:`LogRecord` directly to create an instance." msgstr "" -#: ../../howto/logging-cookbook.rst:1783 +#: ../../howto/logging-cookbook.rst:1780 msgid "" ":func:`makeLogRecord`, which is called with a dictionary containing " "attributes to be added to the LogRecord. This is typically invoked when a " @@ -2302,27 +2299,27 @@ msgid "" "`~handlers.HTTPHandler`)." msgstr "" -#: ../../howto/logging-cookbook.rst:1789 +#: ../../howto/logging-cookbook.rst:1786 msgid "" "This has usually meant that if you need to do anything special with a :class:" "`LogRecord`, you've had to do one of the following." msgstr "" -#: ../../howto/logging-cookbook.rst:1792 +#: ../../howto/logging-cookbook.rst:1789 msgid "" "Create your own :class:`Logger` subclass, which overrides :meth:`Logger." "makeRecord`, and set it using :func:`~logging.setLoggerClass` before any " "loggers that you care about are instantiated." msgstr "" -#: ../../howto/logging-cookbook.rst:1795 +#: ../../howto/logging-cookbook.rst:1792 msgid "" "Add a :class:`Filter` to a logger or handler, which does the necessary " "special manipulation you need when its :meth:`~Filter.filter` method is " "called." msgstr "" -#: ../../howto/logging-cookbook.rst:1799 +#: ../../howto/logging-cookbook.rst:1796 msgid "" "The first approach would be a little unwieldy in the scenario where (say) " "several different libraries wanted to do different things. Each would " @@ -2330,7 +2327,7 @@ msgid "" "last would win." msgstr "" -#: ../../howto/logging-cookbook.rst:1804 +#: ../../howto/logging-cookbook.rst:1801 msgid "" "The second approach works reasonably well for many cases, but does not allow " "you to e.g. use a specialized subclass of :class:`LogRecord`. Library " @@ -2339,11 +2336,11 @@ msgid "" "would do simply by adding new packages or modules and doing ::" msgstr "" -#: ../../howto/logging-cookbook.rst:1810 +#: ../../howto/logging-cookbook.rst:1807 msgid "logger = logging.getLogger(__name__)" msgstr "logger = logging.getLogger(__name__)" -#: ../../howto/logging-cookbook.rst:1812 +#: ../../howto/logging-cookbook.rst:1809 msgid "" "at module level). It's probably one too many things to think about. " "Developers could also add the filter to a :class:`~logging.NullHandler` " @@ -2353,7 +2350,7 @@ msgid "" "developer." msgstr "" -#: ../../howto/logging-cookbook.rst:1818 +#: ../../howto/logging-cookbook.rst:1815 msgid "" "In Python 3.2 and later, :class:`~logging.LogRecord` creation is done " "through a factory, which you can specify. The factory is just a callable you " @@ -2363,7 +2360,7 @@ msgid "" "`LogRecord` is the default setting for the factory." msgstr "" -#: ../../howto/logging-cookbook.rst:1825 +#: ../../howto/logging-cookbook.rst:1822 msgid "" "This approach allows a custom factory to control all aspects of LogRecord " "creation. For example, you could return a subclass, or just add some " @@ -2371,7 +2368,7 @@ msgid "" "this::" msgstr "" -#: ../../howto/logging-cookbook.rst:1829 +#: ../../howto/logging-cookbook.rst:1826 msgid "" "old_factory = logging.getLogRecordFactory()\n" "\n" @@ -2383,7 +2380,7 @@ msgid "" "logging.setLogRecordFactory(record_factory)" msgstr "" -#: ../../howto/logging-cookbook.rst:1838 +#: ../../howto/logging-cookbook.rst:1835 msgid "" "This pattern allows different libraries to chain factories together, and as " "long as they don't overwrite each other's attributes or unintentionally " @@ -2393,22 +2390,22 @@ msgid "" "used when the use of a :class:`Filter` does not provide the desired result." msgstr "" -#: ../../howto/logging-cookbook.rst:1850 +#: ../../howto/logging-cookbook.rst:1847 msgid "Subclassing QueueHandler and QueueListener- a ZeroMQ example" msgstr "" -#: ../../howto/logging-cookbook.rst:1853 ../../howto/logging-cookbook.rst:1986 +#: ../../howto/logging-cookbook.rst:1850 ../../howto/logging-cookbook.rst:1983 msgid "Subclass ``QueueHandler``" msgstr "" -#: ../../howto/logging-cookbook.rst:1855 +#: ../../howto/logging-cookbook.rst:1852 msgid "" "You can use a :class:`QueueHandler` subclass to send messages to other kinds " "of queues, for example a ZeroMQ 'publish' socket. In the example below,the " "socket is created separately and passed to the handler (as its 'queue')::" msgstr "" -#: ../../howto/logging-cookbook.rst:1859 +#: ../../howto/logging-cookbook.rst:1856 msgid "" "import zmq # using pyzmq, the Python binding for ZeroMQ\n" "import json # for serializing records portably\n" @@ -2425,13 +2422,13 @@ msgid "" "handler = ZeroMQSocketHandler(sock)" msgstr "" -#: ../../howto/logging-cookbook.rst:1874 +#: ../../howto/logging-cookbook.rst:1871 msgid "" "Of course there are other ways of organizing this, for example passing in " "the data needed by the handler to create the socket::" msgstr "" -#: ../../howto/logging-cookbook.rst:1877 +#: ../../howto/logging-cookbook.rst:1874 msgid "" "class ZeroMQSocketHandler(QueueHandler):\n" " def __init__(self, uri, socktype=zmq.PUB, ctx=None):\n" @@ -2447,17 +2444,17 @@ msgid "" " self.queue.close()" msgstr "" -#: ../../howto/logging-cookbook.rst:1892 ../../howto/logging-cookbook.rst:1922 +#: ../../howto/logging-cookbook.rst:1889 ../../howto/logging-cookbook.rst:1919 msgid "Subclass ``QueueListener``" msgstr "" -#: ../../howto/logging-cookbook.rst:1894 +#: ../../howto/logging-cookbook.rst:1891 msgid "" "You can also subclass :class:`QueueListener` to get messages from other " "kinds of queues, for example a ZeroMQ 'subscribe' socket. Here's an example::" msgstr "" -#: ../../howto/logging-cookbook.rst:1897 +#: ../../howto/logging-cookbook.rst:1894 msgid "" "class ZeroMQSocketListener(QueueListener):\n" " def __init__(self, uri, /, *handlers, **kwargs):\n" @@ -2473,11 +2470,11 @@ msgid "" " return logging.makeLogRecord(msg)" msgstr "" -#: ../../howto/logging-cookbook.rst:1912 +#: ../../howto/logging-cookbook.rst:1909 msgid "Subclassing QueueHandler and QueueListener- a ``pynng`` example" msgstr "" -#: ../../howto/logging-cookbook.rst:1914 +#: ../../howto/logging-cookbook.rst:1911 msgid "" "In a similar way to the above section, we can implement a listener and " "handler using :pypi:`pynng`, which is a Python binding to `NNG `_ of the Django documentation." msgstr "" -#: ../../howto/logging-cookbook.rst:2160 +#: ../../howto/logging-cookbook.rst:2157 msgid "Using a rotator and namer to customize log rotation processing" msgstr "" -#: ../../howto/logging-cookbook.rst:2162 +#: ../../howto/logging-cookbook.rst:2159 msgid "" "An example of how you can define a namer and rotator is given in the " "following runnable script, which shows gzip compression of the log file::" msgstr "" -#: ../../howto/logging-cookbook.rst:2165 +#: ../../howto/logging-cookbook.rst:2162 msgid "" "import gzip\n" "import logging\n" @@ -2860,12 +2857,12 @@ msgstr "" "for i in range(1000):\n" " root.info(f'Message no. {i + 1}')" -#: ../../howto/logging-cookbook.rst:2193 +#: ../../howto/logging-cookbook.rst:2190 msgid "" "After running this, you will see six new files, five of which are compressed:" msgstr "" -#: ../../howto/logging-cookbook.rst:2195 +#: ../../howto/logging-cookbook.rst:2192 msgid "" "$ ls rotated.log*\n" "rotated.log rotated.log.2.gz rotated.log.4.gz\n" @@ -2883,11 +2880,11 @@ msgstr "" "2023-01-20 02:28:17,767 Message no. 997\n" "2023-01-20 02:28:17,767 Message no. 998" -#: ../../howto/logging-cookbook.rst:2206 +#: ../../howto/logging-cookbook.rst:2203 msgid "A more elaborate multiprocessing example" msgstr "" -#: ../../howto/logging-cookbook.rst:2208 +#: ../../howto/logging-cookbook.rst:2205 msgid "" "The following working example shows how logging can be used with " "multiprocessing using configuration files. The configurations are fairly " @@ -2895,7 +2892,7 @@ msgid "" "in a real multiprocessing scenario." msgstr "" -#: ../../howto/logging-cookbook.rst:2213 +#: ../../howto/logging-cookbook.rst:2210 msgid "" "In the example, the main process spawns a listener process and some worker " "processes. Each of the main process, the listener and the workers have three " @@ -2908,13 +2905,13 @@ msgid "" "own scenario." msgstr "" -#: ../../howto/logging-cookbook.rst:2223 +#: ../../howto/logging-cookbook.rst:2220 msgid "" "Here's the script - the docstrings and the comments hopefully explain how it " "works::" msgstr "" -#: ../../howto/logging-cookbook.rst:2226 +#: ../../howto/logging-cookbook.rst:2223 msgid "" "import logging\n" "import logging.config\n" @@ -3137,11 +3134,11 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2435 +#: ../../howto/logging-cookbook.rst:2432 msgid "Inserting a BOM into messages sent to a SysLogHandler" msgstr "" -#: ../../howto/logging-cookbook.rst:2437 +#: ../../howto/logging-cookbook.rst:2434 msgid "" ":rfc:`5424` requires that a Unicode message be sent to a syslog daemon as a " "set of bytes which have the following structure: an optional pure-ASCII " @@ -3150,7 +3147,7 @@ msgid "" "<5424#section-6>`.)" msgstr "" -#: ../../howto/logging-cookbook.rst:2443 +#: ../../howto/logging-cookbook.rst:2440 msgid "" "In Python 3.1, code was added to :class:`~logging.handlers.SysLogHandler` to " "insert a BOM into the message, but unfortunately, it was implemented " @@ -3158,7 +3155,7 @@ msgid "" "hence not allowing any pure-ASCII component to appear before it." msgstr "" -#: ../../howto/logging-cookbook.rst:2449 +#: ../../howto/logging-cookbook.rst:2446 msgid "" "As this behaviour is broken, the incorrect BOM insertion code is being " "removed from Python 3.2.4 and later. However, it is not being replaced, and " @@ -3167,37 +3164,37 @@ msgid "" "encoded using UTF-8, then you need to do the following:" msgstr "" -#: ../../howto/logging-cookbook.rst:2455 +#: ../../howto/logging-cookbook.rst:2452 msgid "" "Attach a :class:`~logging.Formatter` instance to your :class:`~logging." "handlers.SysLogHandler` instance, with a format string such as::" msgstr "" -#: ../../howto/logging-cookbook.rst:2459 +#: ../../howto/logging-cookbook.rst:2456 msgid "'ASCII section\\ufeffUnicode section'" msgstr "" -#: ../../howto/logging-cookbook.rst:2461 +#: ../../howto/logging-cookbook.rst:2458 msgid "" "The Unicode code point U+FEFF, when encoded using UTF-8, will be encoded as " "a UTF-8 BOM -- the byte-string ``b'\\xef\\xbb\\xbf'``." msgstr "" -#: ../../howto/logging-cookbook.rst:2464 +#: ../../howto/logging-cookbook.rst:2461 msgid "" "Replace the ASCII section with whatever placeholders you like, but make sure " "that the data that appears in there after substitution is always ASCII (that " "way, it will remain unchanged after UTF-8 encoding)." msgstr "" -#: ../../howto/logging-cookbook.rst:2468 +#: ../../howto/logging-cookbook.rst:2465 msgid "" "Replace the Unicode section with whatever placeholders you like; if the data " "which appears there after substitution contains characters outside the ASCII " "range, that's fine -- it will be encoded using UTF-8." msgstr "" -#: ../../howto/logging-cookbook.rst:2472 +#: ../../howto/logging-cookbook.rst:2469 msgid "" "The formatted message *will* be encoded using UTF-8 encoding by " "``SysLogHandler``. If you follow the above rules, you should be able to " @@ -3206,11 +3203,11 @@ msgid "" "daemon may complain." msgstr "" -#: ../../howto/logging-cookbook.rst:2479 +#: ../../howto/logging-cookbook.rst:2476 msgid "Implementing structured logging" msgstr "" -#: ../../howto/logging-cookbook.rst:2481 +#: ../../howto/logging-cookbook.rst:2478 msgid "" "Although most logging messages are intended for reading by humans, and thus " "not readily machine-parseable, there might be circumstances where you want " @@ -3222,7 +3219,7 @@ msgid "" "machine-parseable manner::" msgstr "" -#: ../../howto/logging-cookbook.rst:2489 +#: ../../howto/logging-cookbook.rst:2486 msgid "" "import json\n" "import logging\n" @@ -3241,11 +3238,11 @@ msgid "" "logging.info(_('message 1', foo='bar', bar='baz', num=123, fnum=123.456))" msgstr "" -#: ../../howto/logging-cookbook.rst:2505 +#: ../../howto/logging-cookbook.rst:2502 msgid "If the above script is run, it prints:" msgstr "" -#: ../../howto/logging-cookbook.rst:2507 +#: ../../howto/logging-cookbook.rst:2504 msgid "" "message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": " "\"bar\"}" @@ -3253,19 +3250,19 @@ msgstr "" "message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": " "\"bar\"}" -#: ../../howto/logging-cookbook.rst:2511 ../../howto/logging-cookbook.rst:2553 +#: ../../howto/logging-cookbook.rst:2508 ../../howto/logging-cookbook.rst:2550 msgid "" "Note that the order of items might be different according to the version of " "Python used." msgstr "" -#: ../../howto/logging-cookbook.rst:2514 +#: ../../howto/logging-cookbook.rst:2511 msgid "" "If you need more specialised processing, you can use a custom JSON encoder, " "as in the following complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2517 +#: ../../howto/logging-cookbook.rst:2514 msgid "" "import json\n" "import logging\n" @@ -3298,19 +3295,19 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2547 +#: ../../howto/logging-cookbook.rst:2544 msgid "When the above script is run, it prints:" msgstr "" -#: ../../howto/logging-cookbook.rst:2549 +#: ../../howto/logging-cookbook.rst:2546 msgid "message 1 >>> {\"snowman\": \"\\u2603\", \"set_value\": [1, 2, 3]}" msgstr "message 1 >>> {\"snowman\": \"\\u2603\", \"set_value\": [1, 2, 3]}" -#: ../../howto/logging-cookbook.rst:2562 +#: ../../howto/logging-cookbook.rst:2559 msgid "Customizing handlers with :func:`dictConfig`" msgstr "" -#: ../../howto/logging-cookbook.rst:2564 +#: ../../howto/logging-cookbook.rst:2561 msgid "" "There are times when you want to customize logging handlers in particular " "ways, and if you use :func:`dictConfig` you may be able to do this without " @@ -3320,7 +3317,7 @@ msgid "" "customize handler creation using a plain function such as::" msgstr "" -#: ../../howto/logging-cookbook.rst:2571 +#: ../../howto/logging-cookbook.rst:2568 msgid "" "def owned_file_handler(filename, mode='a', encoding=None, owner=None):\n" " if owner:\n" @@ -3336,13 +3333,13 @@ msgstr "" " shutil.chown(filename, *owner)\n" " return logging.FileHandler(filename, mode, encoding)" -#: ../../howto/logging-cookbook.rst:2578 +#: ../../howto/logging-cookbook.rst:2575 msgid "" "You can then specify, in a logging configuration passed to :func:" "`dictConfig`, that a logging handler be created by calling this function::" msgstr "" -#: ../../howto/logging-cookbook.rst:2581 +#: ../../howto/logging-cookbook.rst:2578 msgid "" "LOGGING = {\n" " 'version': 1,\n" @@ -3375,14 +3372,14 @@ msgid "" "}" msgstr "" -#: ../../howto/logging-cookbook.rst:2611 +#: ../../howto/logging-cookbook.rst:2608 msgid "" "In this example I am setting the ownership using the ``pulse`` user and " "group, just for the purposes of illustration. Putting it together into a " "working script, ``chowntest.py``::" msgstr "" -#: ../../howto/logging-cookbook.rst:2615 +#: ../../howto/logging-cookbook.rst:2612 msgid "" "import logging, logging.config, os, shutil\n" "\n" @@ -3428,11 +3425,11 @@ msgid "" "logger.debug('A debug message')" msgstr "" -#: ../../howto/logging-cookbook.rst:2658 +#: ../../howto/logging-cookbook.rst:2655 msgid "To run this, you will probably need to run as ``root``:" msgstr "" -#: ../../howto/logging-cookbook.rst:2660 +#: ../../howto/logging-cookbook.rst:2657 msgid "" "$ sudo python3.3 chowntest.py\n" "$ cat chowntest.log\n" @@ -3441,7 +3438,7 @@ msgid "" "-rw-r--r-- 1 pulse pulse 55 2013-11-05 09:34 chowntest.log" msgstr "" -#: ../../howto/logging-cookbook.rst:2668 +#: ../../howto/logging-cookbook.rst:2665 msgid "" "Note that this example uses Python 3.3 because that's where :func:`shutil." "chown` makes an appearance. This approach should work with any Python " @@ -3450,25 +3447,25 @@ msgid "" "change using e.g. :func:`os.chown`." msgstr "" -#: ../../howto/logging-cookbook.rst:2674 +#: ../../howto/logging-cookbook.rst:2671 msgid "" "In practice, the handler-creating function may be in a utility module " "somewhere in your project. Instead of the line in the configuration::" msgstr "" -#: ../../howto/logging-cookbook.rst:2677 +#: ../../howto/logging-cookbook.rst:2674 msgid "'()': owned_file_handler," msgstr "'()': owned_file_handler," -#: ../../howto/logging-cookbook.rst:2679 +#: ../../howto/logging-cookbook.rst:2676 msgid "you could use e.g.::" msgstr "" -#: ../../howto/logging-cookbook.rst:2681 +#: ../../howto/logging-cookbook.rst:2678 msgid "'()': 'ext://project.util.owned_file_handler'," msgstr "'()': 'ext://project.util.owned_file_handler'," -#: ../../howto/logging-cookbook.rst:2683 +#: ../../howto/logging-cookbook.rst:2680 msgid "" "where ``project.util`` can be replaced with the actual name of the package " "where the function resides. In the above working script, using ``'ext://" @@ -3476,25 +3473,25 @@ msgid "" "resolved by :func:`dictConfig` from the ``ext://`` specification." msgstr "" -#: ../../howto/logging-cookbook.rst:2688 +#: ../../howto/logging-cookbook.rst:2685 msgid "" "This example hopefully also points the way to how you could implement other " "types of file change - e.g. setting specific POSIX permission bits - in the " "same way, using :func:`os.chmod`." msgstr "" -#: ../../howto/logging-cookbook.rst:2692 +#: ../../howto/logging-cookbook.rst:2689 msgid "" "Of course, the approach could also be extended to types of handler other " "than a :class:`~logging.FileHandler` - for example, one of the rotating file " "handlers, or a different type of handler altogether." msgstr "" -#: ../../howto/logging-cookbook.rst:2702 +#: ../../howto/logging-cookbook.rst:2699 msgid "Using particular formatting styles throughout your application" msgstr "" -#: ../../howto/logging-cookbook.rst:2704 +#: ../../howto/logging-cookbook.rst:2701 msgid "" "In Python 3.2, the :class:`~logging.Formatter` gained a ``style`` keyword " "parameter which, while defaulting to ``%`` for backward compatibility, " @@ -3505,7 +3502,7 @@ msgid "" "is constructed." msgstr "" -#: ../../howto/logging-cookbook.rst:2711 +#: ../../howto/logging-cookbook.rst:2708 msgid "" "Logging calls (:meth:`~Logger.debug`, :meth:`~Logger.info` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -3520,7 +3517,7 @@ msgid "" "calls which are out there in existing code will be using %-format strings." msgstr "" -#: ../../howto/logging-cookbook.rst:2723 +#: ../../howto/logging-cookbook.rst:2720 msgid "" "There have been suggestions to associate format styles with specific " "loggers, but that approach also runs into backward compatibility problems " @@ -3528,7 +3525,7 @@ msgid "" "formatting." msgstr "" -#: ../../howto/logging-cookbook.rst:2727 +#: ../../howto/logging-cookbook.rst:2724 msgid "" "For logging to work interoperably between any third-party libraries and your " "code, decisions about formatting need to be made at the level of the " @@ -3536,11 +3533,11 @@ msgid "" "formatting styles can be accommodated." msgstr "" -#: ../../howto/logging-cookbook.rst:2734 +#: ../../howto/logging-cookbook.rst:2731 msgid "Using LogRecord factories" msgstr "" -#: ../../howto/logging-cookbook.rst:2736 +#: ../../howto/logging-cookbook.rst:2733 msgid "" "In Python 3.2, along with the :class:`~logging.Formatter` changes mentioned " "above, the logging package gained the ability to allow users to set their " @@ -3555,17 +3552,17 @@ msgid "" "implementation does." msgstr "" -#: ../../howto/logging-cookbook.rst:2747 +#: ../../howto/logging-cookbook.rst:2744 msgid "" "Refer to the reference documentation on :func:`setLogRecordFactory` and :" "class:`LogRecord` for more information." msgstr "" -#: ../../howto/logging-cookbook.rst:2752 +#: ../../howto/logging-cookbook.rst:2749 msgid "Using custom message objects" msgstr "" -#: ../../howto/logging-cookbook.rst:2754 +#: ../../howto/logging-cookbook.rst:2751 msgid "" "There is another, perhaps simpler way that you can use {}- and $- formatting " "to construct your individual log messages. You may recall (from :ref:" @@ -3575,7 +3572,7 @@ msgid "" "following two classes::" msgstr "" -#: ../../howto/logging-cookbook.rst:2779 +#: ../../howto/logging-cookbook.rst:2776 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -3586,13 +3583,13 @@ msgid "" "using ``_`` for localization)." msgstr "" -#: ../../howto/logging-cookbook.rst:2787 +#: ../../howto/logging-cookbook.rst:2784 msgid "" "Examples of this approach are given below. Firstly, formatting with :meth:" "`str.format`::" msgstr "" -#: ../../howto/logging-cookbook.rst:2790 +#: ../../howto/logging-cookbook.rst:2787 msgid "" ">>> __ = BraceMessage\n" ">>> print(__('Message with {0} {1}', 2, 'placeholders'))\n" @@ -3607,11 +3604,11 @@ msgid "" "Message with coordinates: (0.50, 0.50)" msgstr "" -#: ../../howto/logging-cookbook.rst:2801 +#: ../../howto/logging-cookbook.rst:2798 msgid "Secondly, formatting with :class:`string.Template`::" msgstr "" -#: ../../howto/logging-cookbook.rst:2803 +#: ../../howto/logging-cookbook.rst:2800 msgid "" ">>> __ = DollarMessage\n" ">>> print(__('Message with $num $what', num=2, what='placeholders'))\n" @@ -3619,7 +3616,7 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:2808 +#: ../../howto/logging-cookbook.rst:2805 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -3631,11 +3628,11 @@ msgid "" "shown above." msgstr "" -#: ../../howto/logging-cookbook.rst:2822 +#: ../../howto/logging-cookbook.rst:2819 msgid "Configuring filters with :func:`dictConfig`" msgstr "" -#: ../../howto/logging-cookbook.rst:2824 +#: ../../howto/logging-cookbook.rst:2821 msgid "" "You *can* configure filters using :func:`~logging.config.dictConfig`, though " "it might not be obvious at first glance how to do it (hence this recipe). " @@ -3650,7 +3647,7 @@ msgid "" "complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2835 +#: ../../howto/logging-cookbook.rst:2832 msgid "" "import logging\n" "import logging.config\n" @@ -3736,26 +3733,26 @@ msgstr "" " logging.debug('hello')\n" " logging.debug('hello - noshow')" -#: ../../howto/logging-cookbook.rst:2877 +#: ../../howto/logging-cookbook.rst:2874 msgid "" "This example shows how you can pass configuration data to the callable which " "constructs the instance, in the form of keyword parameters. When run, the " "above script will print:" msgstr "" -#: ../../howto/logging-cookbook.rst:2881 +#: ../../howto/logging-cookbook.rst:2878 msgid "changed: hello" msgstr "changed: hello" -#: ../../howto/logging-cookbook.rst:2885 +#: ../../howto/logging-cookbook.rst:2882 msgid "which shows that the filter is working as configured." msgstr "" -#: ../../howto/logging-cookbook.rst:2887 +#: ../../howto/logging-cookbook.rst:2884 msgid "A couple of extra points to note:" msgstr "" -#: ../../howto/logging-cookbook.rst:2889 +#: ../../howto/logging-cookbook.rst:2886 msgid "" "If you can't refer to the callable directly in the configuration (e.g. if it " "lives in a different module, and you can't import it directly where the " @@ -3765,7 +3762,7 @@ msgid "" "the above example." msgstr "" -#: ../../howto/logging-cookbook.rst:2896 +#: ../../howto/logging-cookbook.rst:2893 msgid "" "As well as for filters, this technique can also be used to configure custom " "handlers and formatters. See :ref:`logging-config-dict-userdef` for more " @@ -3774,11 +3771,11 @@ msgid "" "above." msgstr "" -#: ../../howto/logging-cookbook.rst:2905 +#: ../../howto/logging-cookbook.rst:2902 msgid "Customized exception formatting" msgstr "" -#: ../../howto/logging-cookbook.rst:2907 +#: ../../howto/logging-cookbook.rst:2904 msgid "" "There might be times when you want to do customized exception formatting - " "for argument's sake, let's say you want exactly one line per logged event, " @@ -3786,7 +3783,7 @@ msgid "" "formatter class, as shown in the following example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2912 +#: ../../howto/logging-cookbook.rst:2909 msgid "" "import logging\n" "\n" @@ -3825,11 +3822,11 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2948 +#: ../../howto/logging-cookbook.rst:2945 msgid "When run, this produces a file with exactly two lines:" msgstr "" -#: ../../howto/logging-cookbook.rst:2950 +#: ../../howto/logging-cookbook.rst:2947 msgid "" "28/01/2015 07:21:23|INFO|Sample message|\n" "28/01/2015 07:21:23|ERROR|ZeroDivisionError: integer division or modulo by " @@ -3843,18 +3840,18 @@ msgstr "" "in main\\n x = 1 / 0\\nZeroDivisionError: integer division or modulo by " "zero'|" -#: ../../howto/logging-cookbook.rst:2955 +#: ../../howto/logging-cookbook.rst:2952 msgid "" "While the above treatment is simplistic, it points the way to how exception " "information can be formatted to your liking. The :mod:`traceback` module may " "be helpful for more specialized needs." msgstr "" -#: ../../howto/logging-cookbook.rst:2962 +#: ../../howto/logging-cookbook.rst:2959 msgid "Speaking logging messages" msgstr "" -#: ../../howto/logging-cookbook.rst:2964 +#: ../../howto/logging-cookbook.rst:2961 msgid "" "There might be situations when it is desirable to have logging messages " "rendered in an audible rather than a visible format. This is easy to do if " @@ -3871,7 +3868,7 @@ msgid "" "approach, which assumes that the ``espeak`` TTS package is available::" msgstr "" -#: ../../howto/logging-cookbook.rst:2977 +#: ../../howto/logging-cookbook.rst:2974 msgid "" "import logging\n" "import subprocess\n" @@ -3903,24 +3900,24 @@ msgid "" " sys.exit(main())" msgstr "" -#: ../../howto/logging-cookbook.rst:3006 +#: ../../howto/logging-cookbook.rst:3003 msgid "" "When run, this script should say \"Hello\" and then \"Goodbye\" in a female " "voice." msgstr "" -#: ../../howto/logging-cookbook.rst:3008 +#: ../../howto/logging-cookbook.rst:3005 msgid "" "The above approach can, of course, be adapted to other TTS systems and even " "other systems altogether which can process messages via external programs " "run from a command line." msgstr "" -#: ../../howto/logging-cookbook.rst:3016 +#: ../../howto/logging-cookbook.rst:3013 msgid "Buffering logging messages and outputting them conditionally" msgstr "" -#: ../../howto/logging-cookbook.rst:3018 +#: ../../howto/logging-cookbook.rst:3015 msgid "" "There might be situations where you want to log messages in a temporary area " "and only output them if a certain condition occurs. For example, you may " @@ -3930,7 +3927,7 @@ msgid "" "debug information to be output as well as the error." msgstr "" -#: ../../howto/logging-cookbook.rst:3025 +#: ../../howto/logging-cookbook.rst:3022 msgid "" "Here is an example which shows how you could do this using a decorator for " "your functions where you want logging to behave this way. It makes use of " @@ -3943,7 +3940,7 @@ msgid "" "subclass of ``MemoryHandler`` if you want custom flushing behavior." msgstr "" -#: ../../howto/logging-cookbook.rst:3035 +#: ../../howto/logging-cookbook.rst:3032 msgid "" "The example script has a simple function, ``foo``, which just cycles through " "all the logging levels, writing to ``sys.stderr`` to say what level it's " @@ -3952,7 +3949,7 @@ msgid "" "levels - otherwise, it only logs at DEBUG, INFO and WARNING levels." msgstr "" -#: ../../howto/logging-cookbook.rst:3041 +#: ../../howto/logging-cookbook.rst:3038 msgid "" "The script just arranges to decorate ``foo`` with a decorator which will do " "the conditional logging that's required. The decorator takes a logger as a " @@ -3964,11 +3961,11 @@ msgid "" "respectively." msgstr "" -#: ../../howto/logging-cookbook.rst:3049 +#: ../../howto/logging-cookbook.rst:3046 msgid "Here's the script::" msgstr "" -#: ../../howto/logging-cookbook.rst:3051 +#: ../../howto/logging-cookbook.rst:3048 msgid "" "import logging\n" "from logging.handlers import MemoryHandler\n" @@ -4034,11 +4031,11 @@ msgid "" " assert decorated_foo(True)" msgstr "" -#: ../../howto/logging-cookbook.rst:3112 +#: ../../howto/logging-cookbook.rst:3109 msgid "When this script is run, the following output should be observed:" msgstr "" -#: ../../howto/logging-cookbook.rst:3114 +#: ../../howto/logging-cookbook.rst:3111 msgid "" "Calling undecorated foo with False\n" "about to log at DEBUG ...\n" @@ -4067,29 +4064,29 @@ msgid "" "Actually logged at CRITICAL" msgstr "" -#: ../../howto/logging-cookbook.rst:3142 +#: ../../howto/logging-cookbook.rst:3139 msgid "" "As you can see, actual logging output only occurs when an event is logged " "whose severity is ERROR or greater, but in that case, any previous events at " "lower severities are also logged." msgstr "" -#: ../../howto/logging-cookbook.rst:3146 +#: ../../howto/logging-cookbook.rst:3143 msgid "You can of course use the conventional means of decoration::" msgstr "" -#: ../../howto/logging-cookbook.rst:3148 +#: ../../howto/logging-cookbook.rst:3145 msgid "" "@log_if_errors(logger)\n" "def foo(fail=False):\n" " ..." msgstr "" -#: ../../howto/logging-cookbook.rst:3156 +#: ../../howto/logging-cookbook.rst:3153 msgid "Sending logging messages to email, with buffering" msgstr "" -#: ../../howto/logging-cookbook.rst:3158 +#: ../../howto/logging-cookbook.rst:3155 msgid "" "To illustrate how you can send log messages via email, so that a set number " "of messages are sent per email, you can subclass :class:`~logging.handlers." @@ -4100,7 +4097,7 @@ msgid "" "argument to see the required and optional arguments.)" msgstr "" -#: ../../howto/logging-cookbook.rst:3166 +#: ../../howto/logging-cookbook.rst:3163 msgid "" "import logging\n" "import logging.handlers\n" @@ -4168,7 +4165,7 @@ msgid "" " h.close()" msgstr "" -#: ../../howto/logging-cookbook.rst:3230 +#: ../../howto/logging-cookbook.rst:3227 msgid "" "If you run this script and your SMTP server is correctly set up, you should " "find that it sends eleven emails to the addressee you specify. The first ten " @@ -4176,17 +4173,17 @@ msgid "" "messages. That makes up 102 messages as specified in the script." msgstr "" -#: ../../howto/logging-cookbook.rst:3238 +#: ../../howto/logging-cookbook.rst:3235 msgid "Formatting times using UTC (GMT) via configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:3240 +#: ../../howto/logging-cookbook.rst:3237 msgid "" "Sometimes you want to format times using UTC, which can be done using a " "class such as ``UTCFormatter``, shown below::" msgstr "" -#: ../../howto/logging-cookbook.rst:3243 +#: ../../howto/logging-cookbook.rst:3240 msgid "" "import logging\n" "import time\n" @@ -4195,7 +4192,7 @@ msgid "" " converter = time.gmtime" msgstr "" -#: ../../howto/logging-cookbook.rst:3249 +#: ../../howto/logging-cookbook.rst:3246 msgid "" "and you can then use the ``UTCFormatter`` in your code instead of :class:" "`~logging.Formatter`. If you want to do that via configuration, you can use " @@ -4203,7 +4200,7 @@ msgid "" "the following complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:3254 +#: ../../howto/logging-cookbook.rst:3251 msgid "" "import logging\n" "import logging.config\n" @@ -4244,27 +4241,29 @@ msgid "" " logging.warning('The local time is %s', time.asctime())" msgstr "" -#: ../../howto/logging-cookbook.rst:3292 +#: ../../howto/logging-cookbook.rst:3289 msgid "When this script is run, it should print something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:3294 +#: ../../howto/logging-cookbook.rst:3291 msgid "" "2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n" "2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015" msgstr "" +"2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n" +"2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015" -#: ../../howto/logging-cookbook.rst:3299 +#: ../../howto/logging-cookbook.rst:3296 msgid "" "showing how the time is formatted both as local time and UTC, one for each " "handler." msgstr "" -#: ../../howto/logging-cookbook.rst:3306 +#: ../../howto/logging-cookbook.rst:3303 msgid "Using a context manager for selective logging" msgstr "" -#: ../../howto/logging-cookbook.rst:3308 +#: ../../howto/logging-cookbook.rst:3305 msgid "" "There are times when it would be useful to temporarily change the logging " "configuration and revert it back after doing something. For this, a context " @@ -4274,7 +4273,7 @@ msgid "" "scope of the context manager::" msgstr "" -#: ../../howto/logging-cookbook.rst:3315 +#: ../../howto/logging-cookbook.rst:3312 msgid "" "import logging\n" "import sys\n" @@ -4303,7 +4302,7 @@ msgid "" " # implicit return of None => don't swallow exceptions" msgstr "" -#: ../../howto/logging-cookbook.rst:3341 +#: ../../howto/logging-cookbook.rst:3338 msgid "" "If you specify a level value, the logger's level is set to that value in the " "scope of the with block covered by the context manager. If you specify a " @@ -4312,13 +4311,13 @@ msgid "" "block exit - you could do this if you don't need the handler any more." msgstr "" -#: ../../howto/logging-cookbook.rst:3347 +#: ../../howto/logging-cookbook.rst:3344 msgid "" "To illustrate how it works, we can add the following block of code to the " "above::" msgstr "" -#: ../../howto/logging-cookbook.rst:3350 +#: ../../howto/logging-cookbook.rst:3347 msgid "" "if __name__ == '__main__':\n" " logger = logging.getLogger('foo')\n" @@ -4338,7 +4337,7 @@ msgid "" " logger.debug('7. This should not appear.')" msgstr "" -#: ../../howto/logging-cookbook.rst:3365 +#: ../../howto/logging-cookbook.rst:3362 msgid "" "We initially set the logger's level to ``INFO``, so message #1 appears and " "message #2 doesn't. We then change the level to ``DEBUG`` temporarily in the " @@ -4351,11 +4350,11 @@ msgid "" "(like message #1) whereas message #7 doesn't (just like message #2)." msgstr "" -#: ../../howto/logging-cookbook.rst:3375 +#: ../../howto/logging-cookbook.rst:3372 msgid "If we run the resulting script, the result is as follows:" msgstr "" -#: ../../howto/logging-cookbook.rst:3377 +#: ../../howto/logging-cookbook.rst:3374 msgid "" "$ python logctx.py\n" "1. This should appear just once on stderr.\n" @@ -4365,23 +4364,23 @@ msgid "" "6. This should appear just once on stderr." msgstr "" -#: ../../howto/logging-cookbook.rst:3386 +#: ../../howto/logging-cookbook.rst:3383 msgid "" "If we run it again, but pipe ``stderr`` to ``/dev/null``, we see the " "following, which is the only message written to ``stdout``:" msgstr "" -#: ../../howto/logging-cookbook.rst:3389 +#: ../../howto/logging-cookbook.rst:3386 msgid "" "$ python logctx.py 2>/dev/null\n" "5. This should appear twice - once on stderr and once on stdout." msgstr "" -#: ../../howto/logging-cookbook.rst:3394 +#: ../../howto/logging-cookbook.rst:3391 msgid "Once again, but piping ``stdout`` to ``/dev/null``, we get:" msgstr "" -#: ../../howto/logging-cookbook.rst:3396 +#: ../../howto/logging-cookbook.rst:3393 msgid "" "$ python logctx.py >/dev/null\n" "1. This should appear just once on stderr.\n" @@ -4390,42 +4389,42 @@ msgid "" "6. This should appear just once on stderr." msgstr "" -#: ../../howto/logging-cookbook.rst:3404 +#: ../../howto/logging-cookbook.rst:3401 msgid "" "In this case, the message #5 printed to ``stdout`` doesn't appear, as " "expected." msgstr "" -#: ../../howto/logging-cookbook.rst:3406 +#: ../../howto/logging-cookbook.rst:3403 msgid "" "Of course, the approach described here can be generalised, for example to " "attach logging filters temporarily. Note that the above code works in Python " "2 as well as Python 3." msgstr "" -#: ../../howto/logging-cookbook.rst:3414 +#: ../../howto/logging-cookbook.rst:3411 msgid "A CLI application starter template" msgstr "" -#: ../../howto/logging-cookbook.rst:3416 +#: ../../howto/logging-cookbook.rst:3413 msgid "Here's an example which shows how you can:" msgstr "" -#: ../../howto/logging-cookbook.rst:3418 +#: ../../howto/logging-cookbook.rst:3415 msgid "Use a logging level based on command-line arguments" msgstr "" -#: ../../howto/logging-cookbook.rst:3419 +#: ../../howto/logging-cookbook.rst:3416 msgid "" "Dispatch to multiple subcommands in separate files, all logging at the same " "level in a consistent way" msgstr "" -#: ../../howto/logging-cookbook.rst:3421 +#: ../../howto/logging-cookbook.rst:3418 msgid "Make use of simple, minimal configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:3423 +#: ../../howto/logging-cookbook.rst:3420 msgid "" "Suppose we have a command-line application whose job is to stop, start or " "restart some services. This could be organised for the purposes of " @@ -4436,7 +4435,7 @@ msgid "" "``logging.INFO``. Here's one way that ``app.py`` could be written::" msgstr "" -#: ../../howto/logging-cookbook.rst:3431 +#: ../../howto/logging-cookbook.rst:3428 msgid "" "import argparse\n" "import importlib\n" @@ -4483,13 +4482,13 @@ msgid "" " sys.exit(main())" msgstr "" -#: ../../howto/logging-cookbook.rst:3472 +#: ../../howto/logging-cookbook.rst:3469 msgid "" "And the ``start``, ``stop`` and ``restart`` commands can be implemented in " "separate modules, like so for starting::" msgstr "" -#: ../../howto/logging-cookbook.rst:3475 +#: ../../howto/logging-cookbook.rst:3472 msgid "" "# start.py\n" "import logging\n" @@ -4502,11 +4501,11 @@ msgid "" " logger.info('Started the \\'%s\\' service.', options.name)" msgstr "" -#: ../../howto/logging-cookbook.rst:3485 +#: ../../howto/logging-cookbook.rst:3482 msgid "and thus for stopping::" msgstr "" -#: ../../howto/logging-cookbook.rst:3487 +#: ../../howto/logging-cookbook.rst:3484 msgid "" "# stop.py\n" "import logging\n" @@ -4528,11 +4527,11 @@ msgid "" " logger.info('Stopped the %s service%s.', services, plural)" msgstr "" -#: ../../howto/logging-cookbook.rst:3506 +#: ../../howto/logging-cookbook.rst:3503 msgid "and similarly for restarting::" msgstr "" -#: ../../howto/logging-cookbook.rst:3508 +#: ../../howto/logging-cookbook.rst:3505 msgid "" "# restart.py\n" "import logging\n" @@ -4554,13 +4553,13 @@ msgid "" " logger.info('Restarted the %s service%s.', services, plural)" msgstr "" -#: ../../howto/logging-cookbook.rst:3527 +#: ../../howto/logging-cookbook.rst:3524 msgid "" "If we run this application with the default log level, we get output like " "this:" msgstr "" -#: ../../howto/logging-cookbook.rst:3529 +#: ../../howto/logging-cookbook.rst:3526 msgid "" "$ python app.py start foo\n" "INFO start Started the 'foo' service.\n" @@ -4572,19 +4571,19 @@ msgid "" "INFO restart Restarted the 'foo', 'bar' and 'baz' services." msgstr "" -#: ../../howto/logging-cookbook.rst:3540 +#: ../../howto/logging-cookbook.rst:3537 msgid "" "The first word is the logging level, and the second word is the module or " "package name of the place where the event was logged." msgstr "" -#: ../../howto/logging-cookbook.rst:3543 +#: ../../howto/logging-cookbook.rst:3540 msgid "" "If we change the logging level, then we can change the information sent to " "the log. For example, if we want more information:" msgstr "" -#: ../../howto/logging-cookbook.rst:3546 +#: ../../howto/logging-cookbook.rst:3543 msgid "" "$ python app.py --log-level DEBUG start foo\n" "DEBUG start About to start foo\n" @@ -4599,28 +4598,28 @@ msgid "" "INFO restart Restarted the 'foo', 'bar' and 'baz' services." msgstr "" -#: ../../howto/logging-cookbook.rst:3560 +#: ../../howto/logging-cookbook.rst:3557 msgid "And if we want less:" msgstr "" -#: ../../howto/logging-cookbook.rst:3562 +#: ../../howto/logging-cookbook.rst:3559 msgid "" "$ python app.py --log-level WARNING start foo\n" "$ python app.py --log-level WARNING stop foo bar\n" "$ python app.py --log-level WARNING restart foo bar baz" msgstr "" -#: ../../howto/logging-cookbook.rst:3568 +#: ../../howto/logging-cookbook.rst:3565 msgid "" "In this case, the commands don't print anything to the console, since " "nothing at ``WARNING`` level or above is logged by them." msgstr "" -#: ../../howto/logging-cookbook.rst:3574 +#: ../../howto/logging-cookbook.rst:3571 msgid "A Qt GUI for logging" msgstr "" -#: ../../howto/logging-cookbook.rst:3576 +#: ../../howto/logging-cookbook.rst:3573 msgid "" "A question that comes up from time to time is about how to log to a GUI " "application. The `Qt `_ framework is a popular cross-" @@ -4628,7 +4627,7 @@ msgid "" "`PyQt5` libraries." msgstr "" -#: ../../howto/logging-cookbook.rst:3581 +#: ../../howto/logging-cookbook.rst:3578 msgid "" "The following example shows how to log to a Qt GUI. This introduces a simple " "``QtHandler`` class which takes a callable, which should be a slot in the " @@ -4638,14 +4637,14 @@ msgid "" "logging messages at random levels with random short delays in between)." msgstr "" -#: ../../howto/logging-cookbook.rst:3588 +#: ../../howto/logging-cookbook.rst:3585 msgid "" "The worker thread is implemented using Qt's ``QThread`` class rather than " "the :mod:`threading` module, as there are circumstances where one has to use " "``QThread``, which offers better integration with other ``Qt`` components." msgstr "" -#: ../../howto/logging-cookbook.rst:3592 +#: ../../howto/logging-cookbook.rst:3589 msgid "" "The code should work with recent releases of any of ``PySide6``, ``PyQt6``, " "``PySide2`` or ``PyQt5``. You should be able to adapt the approach to " @@ -4653,7 +4652,7 @@ msgid "" "more detailed information." msgstr "" -#: ../../howto/logging-cookbook.rst:3597 +#: ../../howto/logging-cookbook.rst:3594 msgid "" "import datetime\n" "import logging\n" @@ -4904,11 +4903,11 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:3829 +#: ../../howto/logging-cookbook.rst:3826 msgid "Logging to syslog with RFC5424 support" msgstr "" -#: ../../howto/logging-cookbook.rst:3831 +#: ../../howto/logging-cookbook.rst:3828 msgid "" "Although :rfc:`5424` dates from 2009, most syslog servers are configured by " "default to use the older :rfc:`3164`, which hails from 2001. When " @@ -4918,14 +4917,14 @@ msgid "" "handlers.SysLogHandler` functionality has not been updated." msgstr "" -#: ../../howto/logging-cookbook.rst:3838 +#: ../../howto/logging-cookbook.rst:3835 msgid "" "RFC 5424 contains some useful features such as support for structured data, " "and if you need to be able to log to a syslog server with support for it, " "you can do so with a subclassed handler which looks something like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:3842 +#: ../../howto/logging-cookbook.rst:3839 msgid "" "import datetime\n" "import logging.handlers\n" @@ -4995,7 +4994,7 @@ msgid "" "{sdata} {msg}'" msgstr "" -#: ../../howto/logging-cookbook.rst:3904 +#: ../../howto/logging-cookbook.rst:3901 msgid "" "You'll need to be familiar with RFC 5424 to fully understand the above code, " "and it may be that you have slightly different needs (e.g. for how you pass " @@ -5004,7 +5003,7 @@ msgid "" "using something like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:3909 +#: ../../howto/logging-cookbook.rst:3906 msgid "" "sd = {\n" " 'foo@12345': {'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'},\n" @@ -5014,12 +5013,19 @@ msgid "" "i = 1\n" "logger.debug('Message %d', i, extra=extra)" msgstr "" +"sd = {\n" +" 'foo@12345': {'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'},\n" +" 'foo@54321': {'rab': 'baz', 'zab': 'bozz', 'zzif': r'buzz'}\n" +"}\n" +"extra = {'structured_data': sd}\n" +"i = 1\n" +"logger.debug('Message %d', i, extra=extra)" -#: ../../howto/logging-cookbook.rst:3918 +#: ../../howto/logging-cookbook.rst:3915 msgid "How to treat a logger like an output stream" msgstr "" -#: ../../howto/logging-cookbook.rst:3920 +#: ../../howto/logging-cookbook.rst:3917 msgid "" "Sometimes, you need to interface to a third-party API which expects a file-" "like object to write to, but you want to direct the API's output to a " @@ -5027,7 +5033,7 @@ msgid "" "API. Here's a short script illustrating such a class:" msgstr "" -#: ../../howto/logging-cookbook.rst:3925 +#: ../../howto/logging-cookbook.rst:3922 msgid "" "import logging\n" "\n" @@ -5065,23 +5071,23 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:3960 +#: ../../howto/logging-cookbook.rst:3957 msgid "When this script is run, it prints" msgstr "" -#: ../../howto/logging-cookbook.rst:3962 +#: ../../howto/logging-cookbook.rst:3959 msgid "" "INFO:demo:An INFO message\n" "DEBUG:demo:A DEBUG message" msgstr "" -#: ../../howto/logging-cookbook.rst:3967 +#: ../../howto/logging-cookbook.rst:3964 msgid "" "You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and ``sys." "stderr`` by doing something like this:" msgstr "" -#: ../../howto/logging-cookbook.rst:3970 +#: ../../howto/logging-cookbook.rst:3967 msgid "" "import sys\n" "\n" @@ -5089,7 +5095,7 @@ msgid "" "sys.stderr = LoggerWriter(logger, logging.WARNING)" msgstr "" -#: ../../howto/logging-cookbook.rst:3977 +#: ../../howto/logging-cookbook.rst:3974 msgid "" "You should do this *after* configuring logging for your needs. In the above " "example, the :func:`~logging.basicConfig` call does this (using the ``sys." @@ -5097,7 +5103,7 @@ msgid "" "Then, you'd get this kind of result:" msgstr "" -#: ../../howto/logging-cookbook.rst:3982 +#: ../../howto/logging-cookbook.rst:3979 msgid "" ">>> print('Foo')\n" "INFO:demo:Foo\n" @@ -5105,32 +5111,37 @@ msgid "" "WARNING:demo:Bar\n" ">>>" msgstr "" +">>> print('Foo')\n" +"INFO:demo:Foo\n" +">>> print('Bar', file=sys.stderr)\n" +"WARNING:demo:Bar\n" +">>>" -#: ../../howto/logging-cookbook.rst:3990 +#: ../../howto/logging-cookbook.rst:3987 msgid "" "Of course, the examples above show output according to the format used by :" "func:`~logging.basicConfig`, but you can use a different formatter when you " "configure logging." msgstr "" -#: ../../howto/logging-cookbook.rst:3994 +#: ../../howto/logging-cookbook.rst:3991 msgid "" "Note that with the above scheme, you are somewhat at the mercy of buffering " "and the sequence of write calls which you are intercepting. For example, " "with the definition of ``LoggerWriter`` above, if you have the snippet" msgstr "" -#: ../../howto/logging-cookbook.rst:3998 +#: ../../howto/logging-cookbook.rst:3995 msgid "" "sys.stderr = LoggerWriter(logger, logging.WARNING)\n" "1 / 0" msgstr "" -#: ../../howto/logging-cookbook.rst:4003 +#: ../../howto/logging-cookbook.rst:4000 msgid "then running the script results in" msgstr "" -#: ../../howto/logging-cookbook.rst:4005 +#: ../../howto/logging-cookbook.rst:4002 msgid "" "WARNING:demo:Traceback (most recent call last):\n" "\n" @@ -5149,7 +5160,7 @@ msgid "" "WARNING:demo:division by zero" msgstr "" -#: ../../howto/logging-cookbook.rst:4021 +#: ../../howto/logging-cookbook.rst:4018 msgid "" "As you can see, this output isn't ideal. That's because the underlying code " "which writes to ``sys.stderr`` makes multiple writes, each of which results " @@ -5159,7 +5170,7 @@ msgid "" "``LoggerWriter``:" msgstr "" -#: ../../howto/logging-cookbook.rst:4027 +#: ../../howto/logging-cookbook.rst:4024 msgid "" "class BufferingLoggerWriter(LoggerWriter):\n" " def __init__(self, logger, level):\n" @@ -5178,14 +5189,30 @@ msgid "" " for part in parts:\n" " self.logger.log(self.level, part)" msgstr "" +"class BufferingLoggerWriter(LoggerWriter):\n" +" def __init__(self, logger, level):\n" +" super().__init__(logger, level)\n" +" self.buffer = ''\n" +"\n" +" def write(self, message):\n" +" if '\\n' not in message:\n" +" self.buffer += message\n" +" else:\n" +" parts = message.split('\\n')\n" +" if self.buffer:\n" +" s = self.buffer + parts.pop(0)\n" +" self.logger.log(self.level, s)\n" +" self.buffer = parts.pop()\n" +" for part in parts:\n" +" self.logger.log(self.level, part)" -#: ../../howto/logging-cookbook.rst:4046 +#: ../../howto/logging-cookbook.rst:4043 msgid "" "This just buffers up stuff until a newline is seen, and then logs complete " "lines. With this approach, you get better output:" msgstr "" -#: ../../howto/logging-cookbook.rst:4049 +#: ../../howto/logging-cookbook.rst:4046 msgid "" "WARNING:demo:Traceback (most recent call last):\n" "WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 55, " @@ -5196,12 +5223,20 @@ msgid "" "WARNING:demo: 1/0\n" "WARNING:demo:ZeroDivisionError: division by zero" msgstr "" +"WARNING:demo:Traceback (most recent call last):\n" +"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 55, " +"in \n" +"WARNING:demo: main()\n" +"WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 52, " +"in main\n" +"WARNING:demo: 1/0\n" +"WARNING:demo:ZeroDivisionError: division by zero" -#: ../../howto/logging-cookbook.rst:4062 +#: ../../howto/logging-cookbook.rst:4059 msgid "Patterns to avoid" msgstr "" -#: ../../howto/logging-cookbook.rst:4064 +#: ../../howto/logging-cookbook.rst:4061 msgid "" "Although the preceding sections have described ways of doing things you " "might need to do or deal with, it is worth mentioning some usage patterns " @@ -5209,11 +5244,11 @@ msgid "" "The following sections are in no particular order." msgstr "" -#: ../../howto/logging-cookbook.rst:4070 +#: ../../howto/logging-cookbook.rst:4067 msgid "Opening the same log file multiple times" msgstr "" -#: ../../howto/logging-cookbook.rst:4072 +#: ../../howto/logging-cookbook.rst:4069 msgid "" "On Windows, you will generally not be able to open the same file multiple " "times as this will lead to a \"file is in use by another process\" error. " @@ -5221,32 +5256,32 @@ msgid "" "file multiple times. This could be done accidentally, for example by:" msgstr "" -#: ../../howto/logging-cookbook.rst:4077 +#: ../../howto/logging-cookbook.rst:4074 msgid "" "Adding a file handler more than once which references the same file (e.g. by " "a copy/paste/forget-to-change error)." msgstr "" -#: ../../howto/logging-cookbook.rst:4080 +#: ../../howto/logging-cookbook.rst:4077 msgid "" "Opening two files that look different, as they have different names, but are " "the same because one is a symbolic link to the other." msgstr "" -#: ../../howto/logging-cookbook.rst:4083 +#: ../../howto/logging-cookbook.rst:4080 msgid "" "Forking a process, following which both parent and child have a reference to " "the same file. This might be through use of the :mod:`multiprocessing` " "module, for example." msgstr "" -#: ../../howto/logging-cookbook.rst:4087 +#: ../../howto/logging-cookbook.rst:4084 msgid "" "Opening a file multiple times might *appear* to work most of the time, but " "can lead to a number of problems in practice:" msgstr "" -#: ../../howto/logging-cookbook.rst:4090 +#: ../../howto/logging-cookbook.rst:4087 msgid "" "Logging output can be garbled because multiple threads or processes try to " "write to the same file. Although logging guards against concurrent use of " @@ -5255,7 +5290,7 @@ msgid "" "different handler instances which happen to point to the same file." msgstr "" -#: ../../howto/logging-cookbook.rst:4096 +#: ../../howto/logging-cookbook.rst:4093 msgid "" "An attempt to delete a file (e.g. during file rotation) silently fails, " "because there is another reference pointing to it. This can lead to " @@ -5265,17 +5300,17 @@ msgid "" "being supposedly in place." msgstr "" -#: ../../howto/logging-cookbook.rst:4103 +#: ../../howto/logging-cookbook.rst:4100 msgid "" "Use the techniques outlined in :ref:`multiple-processes` to circumvent such " "issues." msgstr "" -#: ../../howto/logging-cookbook.rst:4107 +#: ../../howto/logging-cookbook.rst:4104 msgid "Using loggers as attributes in a class or passing them as parameters" msgstr "" -#: ../../howto/logging-cookbook.rst:4109 +#: ../../howto/logging-cookbook.rst:4106 msgid "" "While there might be unusual cases where you'll need to do this, in general " "there is no point because loggers are singletons. Code can always access a " @@ -5286,13 +5321,13 @@ msgid "" "module (and not the class) is the unit of software decomposition." msgstr "" -#: ../../howto/logging-cookbook.rst:4118 +#: ../../howto/logging-cookbook.rst:4115 msgid "" "Adding handlers other than :class:`~logging.NullHandler` to a logger in a " "library" msgstr "" -#: ../../howto/logging-cookbook.rst:4120 +#: ../../howto/logging-cookbook.rst:4117 msgid "" "Configuring logging by adding handlers, formatters and filters is the " "responsibility of the application developer, not the library developer. If " @@ -5300,11 +5335,11 @@ msgid "" "your loggers other than a :class:`~logging.NullHandler` instance." msgstr "" -#: ../../howto/logging-cookbook.rst:4126 +#: ../../howto/logging-cookbook.rst:4123 msgid "Creating a lot of loggers" msgstr "" -#: ../../howto/logging-cookbook.rst:4128 +#: ../../howto/logging-cookbook.rst:4125 msgid "" "Loggers are singletons that are never freed during a script execution, and " "so creating lots of loggers will use up memory which can't then be freed. " @@ -5315,38 +5350,38 @@ msgid "" "occasionally slightly more fine-grained than that)." msgstr "" -#: ../../howto/logging-cookbook.rst:4139 +#: ../../howto/logging-cookbook.rst:4136 msgid "Other resources" -msgstr "" +msgstr "其他資源" -#: ../../howto/logging-cookbook.rst:4143 +#: ../../howto/logging-cookbook.rst:4140 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../howto/logging-cookbook.rst:4144 +#: ../../howto/logging-cookbook.rst:4141 msgid "API reference for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4146 +#: ../../howto/logging-cookbook.rst:4143 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../howto/logging-cookbook.rst:4147 +#: ../../howto/logging-cookbook.rst:4144 msgid "Configuration API for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4149 +#: ../../howto/logging-cookbook.rst:4146 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../howto/logging-cookbook.rst:4150 +#: ../../howto/logging-cookbook.rst:4147 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4152 +#: ../../howto/logging-cookbook.rst:4149 msgid ":ref:`Basic Tutorial `" msgstr ":ref:`基礎教學 `" -#: ../../howto/logging-cookbook.rst:4154 +#: ../../howto/logging-cookbook.rst:4151 msgid ":ref:`Advanced Tutorial `" msgstr ":ref:`進階教學 `" diff --git a/howto/regex.po b/howto/regex.po index 825d7f2aff..42467d34b9 100644 --- a/howto/regex.po +++ b/howto/regex.po @@ -661,7 +661,7 @@ msgstr "" #: ../../howto/regex.rst:363 ../../howto/regex.rst:417 #: ../../howto/regex.rst:1065 msgid "Method/Attribute" -msgstr "" +msgstr "方法/屬性" #: ../../howto/regex.rst:363 ../../howto/regex.rst:417 #: ../../howto/regex.rst:1065 @@ -1005,7 +1005,7 @@ msgstr "" #: ../../howto/regex.rst:538 msgid "Flag" -msgstr "" +msgstr "旗標" #: ../../howto/regex.rst:538 msgid "Meaning" diff --git a/howto/sockets.po b/howto/sockets.po index 982fa34fd1..168504a99e 100644 --- a/howto/sockets.po +++ b/howto/sockets.po @@ -50,7 +50,7 @@ msgstr "" #: ../../howto/sockets.rst:20 msgid "Sockets" -msgstr "" +msgstr "Sockets" #: ../../howto/sockets.rst:22 msgid "" diff --git a/howto/timerfd.po b/howto/timerfd.po index 27b4768a58..dd737358de 100644 --- a/howto/timerfd.po +++ b/howto/timerfd.po @@ -27,7 +27,7 @@ msgstr "" #: ../../howto/timerfd.rst:7 msgid "1.13" -msgstr "" +msgstr "1.13" #: ../../howto/timerfd.rst:9 msgid "" @@ -36,7 +36,7 @@ msgstr "" #: ../../howto/timerfd.rst:13 msgid "Examples" -msgstr "" +msgstr "範例" #: ../../howto/timerfd.rst:15 msgid "" diff --git a/library/argparse.po b/library/argparse.po index 9c267fb807..8898a13b96 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-16 00:13+0000\n" +"POT-Creation-Date: 2024-10-31 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -94,8 +94,9 @@ msgstr "" #: ../../library/argparse.rst:53 msgid "" -"If you're looking a guide about how to upgrade optparse code to argparse, " -"see :ref:`Upgrading Optparse Code `." +"If you're looking for a guide about how to upgrade :mod:`optparse` code to :" +"mod:`!argparse`, see :ref:`Upgrading Optparse Code `." msgstr "" #: ../../library/argparse.rst:57 @@ -176,8 +177,8 @@ msgstr "" #: ../../library/argparse.rst:103 msgid "" -"exit_on_error_ - Determines whether or not ArgumentParser exits with error " -"info when an error occurs. (default: ``True``)" +"exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits " +"with error info when an error occurs. (default: ``True``)" msgstr "" #: ../../library/argparse.rst:106 @@ -615,7 +616,7 @@ msgid "" "Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. " "Parsers that need to support different or additional prefix characters, e.g. " "for options like ``+f`` or ``/foo``, may specify them using the " -"``prefix_chars=`` argument to the ArgumentParser constructor::" +"``prefix_chars=`` argument to the :class:`ArgumentParser` constructor::" msgstr "" #: ../../library/argparse.rst:377 @@ -843,9 +844,9 @@ msgstr "add_help" #: ../../library/argparse.rst:506 msgid "" -"By default, ArgumentParser objects add an option which simply displays the " -"parser's help message. If ``-h`` or ``--help`` is supplied at the command " -"line, the ArgumentParser help will be printed." +"By default, :class:`ArgumentParser` objects add an option which simply " +"displays the parser's help message. If ``-h`` or ``--help`` is supplied at " +"the command line, the :class:`!ArgumentParser` help will be printed." msgstr "" #: ../../library/argparse.rst:510 @@ -952,8 +953,8 @@ msgstr "" #: ../../library/argparse.rst:569 msgid "" -"`name or flags`_ - Either a name or a list of option strings, e.g. ``foo`` " -"or ``-f, --foo``." +"`name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'`` " +"or ``'-f', '--foo'``." msgstr "" #: ../../library/argparse.rst:572 @@ -1184,11 +1185,36 @@ msgstr "" #: ../../library/argparse.rst:695 msgid "" +"``'extend'`` - This stores a list and appends each item from the multi-value " +"argument list to it. The ``'extend'`` action is typically used with the " +"nargs_ keyword argument value ``'+'`` or ``'*'``. Note that when nargs_ is " +"``None`` (the default) or ``'?'``, each character of the argument string " +"will be appended to the list. Example usage::" +msgstr "" + +#: ../../library/argparse.rst:703 +msgid "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " +"type=str)\n" +">>> parser.parse_args([\"--foo\", \"f1\", \"--foo\", \"f2\", \"f3\", " +"\"f4\"])\n" +"Namespace(foo=['f1', 'f2', 'f3', 'f4'])" +msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " +"type=str)\n" +">>> parser.parse_args([\"--foo\", \"f1\", \"--foo\", \"f2\", \"f3\", " +"\"f4\"])\n" +"Namespace(foo=['f1', 'f2', 'f3', 'f4'])" + +#: ../../library/argparse.rst:710 +msgid "" "``'count'`` - This counts the number of times a keyword argument occurs. For " "example, this is useful for increasing verbosity levels::" msgstr "" -#: ../../library/argparse.rst:698 +#: ../../library/argparse.rst:713 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--verbose', '-v', action='http://github.com/count', default=0)\n" @@ -1196,11 +1222,11 @@ msgid "" "Namespace(verbose=3)" msgstr "" -#: ../../library/argparse.rst:703 +#: ../../library/argparse.rst:718 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." msgstr "" -#: ../../library/argparse.rst:705 +#: ../../library/argparse.rst:720 msgid "" "``'help'`` - This prints a complete help message for all the options in the " "current parser and then exits. By default a help action is automatically " @@ -1208,14 +1234,14 @@ msgid "" "output is created." msgstr "" -#: ../../library/argparse.rst:710 +#: ../../library/argparse.rst:725 msgid "" "``'version'`` - This expects a ``version=`` keyword argument in the :meth:" "`~ArgumentParser.add_argument` call, and prints version information and " "exits when invoked::" msgstr "" -#: ../../library/argparse.rst:714 +#: ../../library/argparse.rst:729 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -1231,43 +1257,21 @@ msgstr "" ">>> parser.parse_args(['--version'])\n" "PROG 2.0" -#: ../../library/argparse.rst:720 -msgid "" -"``'extend'`` - This stores a list, and extends each argument value to the " -"list. Example usage::" -msgstr "" - -#: ../../library/argparse.rst:724 -msgid "" -">>> parser = argparse.ArgumentParser()\n" -">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " -"type=str)\n" -">>> parser.parse_args([\"--foo\", \"f1\", \"--foo\", \"f2\", \"f3\", " -"\"f4\"])\n" -"Namespace(foo=['f1', 'f2', 'f3', 'f4'])" -msgstr "" -">>> parser = argparse.ArgumentParser()\n" -">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " -"type=str)\n" -">>> parser.parse_args([\"--foo\", \"f1\", \"--foo\", \"f2\", \"f3\", " -"\"f4\"])\n" -"Namespace(foo=['f1', 'f2', 'f3', 'f4'])" - -#: ../../library/argparse.rst:731 +#: ../../library/argparse.rst:735 msgid "" "Only actions that consume command-line arguments (e.g. ``'store'``, " "``'append'`` or ``'extend'``) can be used with positional arguments." msgstr "" -#: ../../library/argparse.rst:734 +#: ../../library/argparse.rst:740 msgid "" -"You may also specify an arbitrary action by passing an Action subclass or " -"other object that implements the same interface. The " -"``BooleanOptionalAction`` is available in ``argparse`` and adds support for " +"You may also specify an arbitrary action by passing an :class:`Action` " +"subclass or other object that implements the same interface. The :class:`!" +"BooleanOptionalAction` is available in :mod:`!argparse` and adds support for " "boolean actions such as ``--foo`` and ``--no-foo``::" msgstr "" -#: ../../library/argparse.rst:739 +#: ../../library/argparse.rst:745 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -1281,18 +1285,18 @@ msgstr "" ">>> parser.parse_args(['--no-foo'])\n" "Namespace(foo=False)" -#: ../../library/argparse.rst:747 +#: ../../library/argparse.rst:753 msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " -"overriding the ``__call__`` method and optionally the ``__init__`` and " -"``format_usage`` methods." +"overriding the :meth:`!__call__` method and optionally the :meth:`!__init__` " +"and :meth:`!format_usage` methods." msgstr "" -#: ../../library/argparse.rst:751 +#: ../../library/argparse.rst:757 msgid "An example of a custom action::" msgstr "" -#: ../../library/argparse.rst:753 +#: ../../library/argparse.rst:759 msgid "" ">>> class FooAction(argparse.Action):\n" "... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" @@ -1313,29 +1317,30 @@ msgid "" "Namespace(bar='1', foo='2')" msgstr "" -#: ../../library/argparse.rst:771 +#: ../../library/argparse.rst:777 msgid "For more details, see :class:`Action`." -msgstr "" +msgstr "更多詳情請見 :class:`Action`。" -#: ../../library/argparse.rst:777 +#: ../../library/argparse.rst:783 msgid "nargs" -msgstr "" +msgstr "nargs" -#: ../../library/argparse.rst:779 +#: ../../library/argparse.rst:785 msgid "" -"ArgumentParser objects usually associate a single command-line argument with " -"a single action to be taken. The ``nargs`` keyword argument associates a " -"different number of command-line arguments with a single action. See also :" -"ref:`specifying-ambiguous-arguments`. The supported values are:" +":class:`ArgumentParser` objects usually associate a single command-line " +"argument with a single action to be taken. The ``nargs`` keyword argument " +"associates a different number of command-line arguments with a single " +"action. See also :ref:`specifying-ambiguous-arguments`. The supported values " +"are:" msgstr "" -#: ../../library/argparse.rst:784 +#: ../../library/argparse.rst:790 msgid "" "``N`` (an integer). ``N`` arguments from the command line will be gathered " "together into a list. For example::" msgstr "" -#: ../../library/argparse.rst:787 +#: ../../library/argparse.rst:793 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs=2)\n" @@ -1349,13 +1354,13 @@ msgstr "" ">>> parser.parse_args('c --foo a b'.split())\n" "Namespace(bar=['c'], foo=['a', 'b'])" -#: ../../library/argparse.rst:793 +#: ../../library/argparse.rst:799 msgid "" "Note that ``nargs=1`` produces a list of one item. This is different from " "the default, in which the item is produced by itself." msgstr "" -#: ../../library/argparse.rst:798 +#: ../../library/argparse.rst:804 msgid "" "``'?'``. One argument will be consumed from the command line if possible, " "and produced as a single item. If no command-line argument is present, the " @@ -1365,7 +1370,7 @@ msgid "" "produced. Some examples to illustrate this::" msgstr "" -#: ../../library/argparse.rst:805 +#: ../../library/argparse.rst:811 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" @@ -1387,13 +1392,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(bar='d', foo='d')" -#: ../../library/argparse.rst:815 +#: ../../library/argparse.rst:821 msgid "" "One of the more common uses of ``nargs='?'`` is to allow optional input and " "output files::" msgstr "" -#: ../../library/argparse.rst:818 +#: ../../library/argparse.rst:824 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', nargs='?', type=argparse.FileType('r'),\n" @@ -1419,7 +1424,7 @@ msgstr "" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>,\n" " outfile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:832 +#: ../../library/argparse.rst:838 msgid "" "``'*'``. All command-line arguments present are gathered into a list. Note " "that it generally doesn't make much sense to have more than one positional " @@ -1427,7 +1432,7 @@ msgid "" "``nargs='*'`` is possible. For example::" msgstr "" -#: ../../library/argparse.rst:837 +#: ../../library/argparse.rst:843 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='*')\n" @@ -1443,14 +1448,14 @@ msgstr "" ">>> parser.parse_args('a b --foo x y --bar 1 2'.split())\n" "Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])" -#: ../../library/argparse.rst:846 +#: ../../library/argparse.rst:852 msgid "" "``'+'``. Just like ``'*'``, all command-line args present are gathered into " "a list. Additionally, an error message will be generated if there wasn't at " "least one command-line argument present. For example::" msgstr "" -#: ../../library/argparse.rst:850 +#: ../../library/argparse.rst:856 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('foo', nargs='+')\n" @@ -1468,7 +1473,7 @@ msgstr "" "usage: PROG [-h] foo [foo ...]\n" "PROG: error: the following arguments are required: foo" -#: ../../library/argparse.rst:858 +#: ../../library/argparse.rst:864 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " @@ -1477,11 +1482,11 @@ msgid "" "``'store_const'``) set ``nargs=0``." msgstr "" -#: ../../library/argparse.rst:868 +#: ../../library/argparse.rst:874 msgid "const" msgstr "" -#: ../../library/argparse.rst:870 +#: ../../library/argparse.rst:876 msgid "" "The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to " "hold constant values that are not read from the command line but are " @@ -1489,7 +1494,7 @@ msgid "" "common uses of it are:" msgstr "" -#: ../../library/argparse.rst:874 +#: ../../library/argparse.rst:880 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='http://github.com/store_const'`` or ``action='http://github.com/append_const'``. These actions add " @@ -1499,7 +1504,7 @@ msgid "" "receive a default value of ``None``." msgstr "" -#: ../../library/argparse.rst:882 +#: ../../library/argparse.rst:888 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with option strings " "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " @@ -1509,17 +1514,17 @@ msgid "" "to be ``None`` instead. See the nargs_ description for examples." msgstr "" -#: ../../library/argparse.rst:889 +#: ../../library/argparse.rst:895 msgid "" "``const=None`` by default, including when ``action='http://github.com/append_const'`` or " "``action='http://github.com/store_const'``." msgstr "" -#: ../../library/argparse.rst:896 +#: ../../library/argparse.rst:902 msgid "default" msgstr "" -#: ../../library/argparse.rst:898 +#: ../../library/argparse.rst:904 msgid "" "All optional arguments and some positional arguments may be omitted at the " "command line. The ``default`` keyword argument of :meth:`~ArgumentParser." @@ -1529,7 +1534,7 @@ msgid "" "command line::" msgstr "" -#: ../../library/argparse.rst:905 +#: ../../library/argparse.rst:911 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1545,13 +1550,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:912 +#: ../../library/argparse.rst:918 msgid "" "If the target namespace already has an attribute set, the action *default* " "will not overwrite it::" msgstr "" -#: ../../library/argparse.rst:915 +#: ../../library/argparse.rst:921 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1563,7 +1568,7 @@ msgstr "" ">>> parser.parse_args([], namespace=argparse.Namespace(foo=101))\n" "Namespace(foo=101)" -#: ../../library/argparse.rst:920 +#: ../../library/argparse.rst:926 msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " @@ -1571,7 +1576,7 @@ msgid "" "`Namespace` return value. Otherwise, the parser uses the value as is::" msgstr "" -#: ../../library/argparse.rst:925 +#: ../../library/argparse.rst:931 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--length', default='10', type=int)\n" @@ -1585,13 +1590,13 @@ msgstr "" ">>> parser.parse_args()\n" "Namespace(length=10, width=10.5)" -#: ../../library/argparse.rst:931 +#: ../../library/argparse.rst:937 msgid "" "For positional arguments with nargs_ equal to ``?`` or ``*``, the " "``default`` value is used when no command-line argument was present::" msgstr "" -#: ../../library/argparse.rst:934 +#: ../../library/argparse.rst:940 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', nargs='?', default=42)\n" @@ -1607,20 +1612,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:941 +#: ../../library/argparse.rst:947 msgid "" "For required_ arguments, the ``default`` value is ignored. For example, this " "applies to positional arguments with nargs_ values other than ``?`` or " "``*``, or optional arguments marked as ``required=True``." msgstr "" -#: ../../library/argparse.rst:945 +#: ../../library/argparse.rst:951 msgid "" "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " "the command-line argument was not present::" msgstr "" -#: ../../library/argparse.rst:948 +#: ../../library/argparse.rst:954 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" @@ -1636,11 +1641,11 @@ msgstr "" ">>> parser.parse_args(['--foo', '1'])\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:959 +#: ../../library/argparse.rst:965 msgid "type" msgstr "" -#: ../../library/argparse.rst:961 +#: ../../library/argparse.rst:967 msgid "" "By default, the parser reads command-line arguments in as simple strings. " "However, quite often the command-line string should instead be interpreted " @@ -1649,13 +1654,13 @@ msgid "" "checking and type conversions to be performed." msgstr "" -#: ../../library/argparse.rst:967 +#: ../../library/argparse.rst:973 msgid "" "If the type_ keyword is used with the default_ keyword, the type converter " "is only applied if the default is a string." msgstr "" -#: ../../library/argparse.rst:970 +#: ../../library/argparse.rst:976 msgid "" "The argument to ``type`` can be any callable that accepts a single string. " "If the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" @@ -1663,11 +1668,11 @@ msgid "" "is displayed. No other exception types are handled." msgstr "" -#: ../../library/argparse.rst:975 +#: ../../library/argparse.rst:981 msgid "Common built-in types and functions can be used as type converters:" msgstr "" -#: ../../library/argparse.rst:977 +#: ../../library/argparse.rst:983 msgid "" "import argparse\n" "import pathlib\n" @@ -1693,11 +1698,11 @@ msgstr "" "encoding='latin-1'))\n" "parser.add_argument('datapath', type=pathlib.Path)" -#: ../../library/argparse.rst:990 +#: ../../library/argparse.rst:996 msgid "User defined functions can be used as well:" msgstr "" -#: ../../library/argparse.rst:992 +#: ../../library/argparse.rst:998 msgid "" ">>> def hyphenated(string):\n" "... return '-'.join([word[:4] for word in string.casefold().split()])\n" @@ -1715,14 +1720,14 @@ msgstr "" ">>> parser.parse_args(['\"The Tale of Two Cities\"'])\n" "Namespace(short_title='\"the-tale-of-two-citi')" -#: ../../library/argparse.rst:1002 +#: ../../library/argparse.rst:1008 msgid "" "The :func:`bool` function is not recommended as a type converter. All it " "does is convert empty strings to ``False`` and non-empty strings to " "``True``. This is usually not what is desired." msgstr "" -#: ../../library/argparse.rst:1006 +#: ../../library/argparse.rst:1012 msgid "" "In general, the ``type`` keyword is a convenience that should only be used " "for simple conversions that can only raise one of the three supported " @@ -1730,7 +1735,7 @@ msgid "" "management should be done downstream after the arguments are parsed." msgstr "" -#: ../../library/argparse.rst:1011 +#: ../../library/argparse.rst:1017 msgid "" "For example, JSON or YAML conversions have complex error cases that require " "better reporting than can be given by the ``type`` keyword. A :exc:`~json." @@ -1738,7 +1743,7 @@ msgid "" "exception would not be handled at all." msgstr "" -#: ../../library/argparse.rst:1016 +#: ../../library/argparse.rst:1022 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " "``type`` keyword. If one argument uses :class:`~argparse.FileType` and then " @@ -1748,17 +1753,17 @@ msgid "" "files." msgstr "" -#: ../../library/argparse.rst:1023 +#: ../../library/argparse.rst:1029 msgid "" "For type checkers that simply check against a fixed set of values, consider " "using the choices_ keyword instead." msgstr "" -#: ../../library/argparse.rst:1030 +#: ../../library/argparse.rst:1036 msgid "choices" msgstr "" -#: ../../library/argparse.rst:1032 +#: ../../library/argparse.rst:1038 msgid "" "Some command-line arguments should be selected from a restricted set of " "values. These can be handled by passing a sequence object as the *choices* " @@ -1767,7 +1772,7 @@ msgid "" "be displayed if the argument was not one of the acceptable values::" msgstr "" -#: ../../library/argparse.rst:1038 +#: ../../library/argparse.rst:1044 msgid "" ">>> parser = argparse.ArgumentParser(prog='game.py')\n" ">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" @@ -1787,26 +1792,26 @@ msgstr "" "game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n" "'paper', 'scissors')" -#: ../../library/argparse.rst:1047 +#: ../../library/argparse.rst:1053 msgid "" "Note that inclusion in the *choices* sequence is checked after any type_ " "conversions have been performed, so the type of the objects in the *choices* " "sequence should match the type_ specified." msgstr "" -#: ../../library/argparse.rst:1051 +#: ../../library/argparse.rst:1057 msgid "" "Any sequence can be passed as the *choices* value, so :class:`list` " "objects, :class:`tuple` objects, and custom sequences are all supported." msgstr "" -#: ../../library/argparse.rst:1054 +#: ../../library/argparse.rst:1060 msgid "" "Use of :class:`enum.Enum` is not recommended because it is difficult to " "control its appearance in usage, help, and error messages." msgstr "" -#: ../../library/argparse.rst:1057 +#: ../../library/argparse.rst:1063 msgid "" "Formatted choices override the default *metavar* which is normally derived " "from *dest*. This is usually what you want because the user never sees the " @@ -1814,19 +1819,19 @@ msgid "" "are many choices), just specify an explicit metavar_." msgstr "" -#: ../../library/argparse.rst:1066 +#: ../../library/argparse.rst:1072 msgid "required" msgstr "" -#: ../../library/argparse.rst:1068 +#: ../../library/argparse.rst:1074 msgid "" -"In general, the :mod:`argparse` module assumes that flags like ``-f`` and " +"In general, the :mod:`!argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " "command line. To make an option *required*, ``True`` can be specified for " "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: ../../library/argparse.rst:1073 +#: ../../library/argparse.rst:1079 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', required=True)\n" @@ -1844,24 +1849,24 @@ msgstr "" "usage: [-h] --foo FOO\n" ": error: the following arguments are required: --foo" -#: ../../library/argparse.rst:1081 +#: ../../library/argparse.rst:1087 msgid "" "As the example shows, if an option is marked as ``required``, :meth:" "`~ArgumentParser.parse_args` will report an error if that option is not " "present at the command line." msgstr "" -#: ../../library/argparse.rst:1087 +#: ../../library/argparse.rst:1093 msgid "" "Required options are generally considered bad form because users expect " "*options* to be *optional*, and thus they should be avoided when possible." msgstr "" -#: ../../library/argparse.rst:1094 +#: ../../library/argparse.rst:1100 msgid "help" msgstr "幫助" -#: ../../library/argparse.rst:1096 +#: ../../library/argparse.rst:1102 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " @@ -1869,7 +1874,7 @@ msgid "" "each argument." msgstr "" -#: ../../library/argparse.rst:1101 +#: ../../library/argparse.rst:1107 msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " @@ -1878,7 +1883,7 @@ msgid "" "``%(type)s``, etc.::" msgstr "" -#: ../../library/argparse.rst:1106 +#: ../../library/argparse.rst:1112 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" @@ -1904,19 +1909,19 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1118 +#: ../../library/argparse.rst:1124 msgid "" "As the help string supports %-formatting, if you want a literal ``%`` to " "appear in the help string, you must escape it as ``%%``." msgstr "" -#: ../../library/argparse.rst:1121 +#: ../../library/argparse.rst:1127 msgid "" -":mod:`argparse` supports silencing the help entry for certain options, by " +":mod:`!argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:1124 +#: ../../library/argparse.rst:1130 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" @@ -1934,23 +1939,23 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1136 +#: ../../library/argparse.rst:1142 msgid "metavar" -msgstr "" +msgstr "metavar" -#: ../../library/argparse.rst:1138 +#: ../../library/argparse.rst:1144 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " -"refer to each expected argument. By default, ArgumentParser objects use the " -"dest_ value as the \"name\" of each object. By default, for positional " -"argument actions, the dest_ value is used directly, and for optional " -"argument actions, the dest_ value is uppercased. So, a single positional " -"argument with ``dest='bar'`` will be referred to as ``bar``. A single " -"optional argument ``--foo`` that should be followed by a single command-line " -"argument will be referred to as ``FOO``. An example::" +"refer to each expected argument. By default, :class:`!ArgumentParser` " +"objects use the dest_ value as the \"name\" of each object. By default, for " +"positional argument actions, the dest_ value is used directly, and for " +"optional argument actions, the dest_ value is uppercased. So, a single " +"positional argument with ``dest='bar'`` will be referred to as ``bar``. A " +"single optional argument ``--foo`` that should be followed by a single " +"command-line argument will be referred to as ``FOO``. An example::" msgstr "" -#: ../../library/argparse.rst:1147 +#: ../../library/argparse.rst:1153 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -1982,11 +1987,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO" -#: ../../library/argparse.rst:1162 +#: ../../library/argparse.rst:1168 msgid "An alternative name can be specified with ``metavar``::" msgstr "" -#: ../../library/argparse.rst:1164 +#: ../../library/argparse.rst:1170 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', metavar='YYY')\n" @@ -2018,21 +2023,21 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo YYY" -#: ../../library/argparse.rst:1179 +#: ../../library/argparse.rst:1185 msgid "" "Note that ``metavar`` only changes the *displayed* name - the name of the " "attribute on the :meth:`~ArgumentParser.parse_args` object is still " "determined by the dest_ value." msgstr "" -#: ../../library/argparse.rst:1183 +#: ../../library/argparse.rst:1189 msgid "" "Different values of ``nargs`` may cause the metavar to be used multiple " "times. Providing a tuple to ``metavar`` specifies a different display for " "each of the arguments::" msgstr "" -#: ../../library/argparse.rst:1187 +#: ../../library/argparse.rst:1193 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', nargs=2)\n" @@ -2056,11 +2061,11 @@ msgstr "" " -x X X\n" " --foo bar baz" -#: ../../library/argparse.rst:1202 +#: ../../library/argparse.rst:1208 msgid "dest" -msgstr "" +msgstr "dest" -#: ../../library/argparse.rst:1204 +#: ../../library/argparse.rst:1210 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " @@ -2070,7 +2075,7 @@ msgid "" "add_argument`::" msgstr "" -#: ../../library/argparse.rst:1211 +#: ../../library/argparse.rst:1217 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('bar')\n" @@ -2082,7 +2087,7 @@ msgstr "" ">>> parser.parse_args(['XXX'])\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1216 +#: ../../library/argparse.rst:1222 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " @@ -2094,7 +2099,7 @@ msgid "" "below illustrate this behavior::" msgstr "" -#: ../../library/argparse.rst:1225 +#: ../../library/argparse.rst:1231 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('-f', '--foo-bar', '--foo')\n" @@ -2112,11 +2117,11 @@ msgstr "" ">>> parser.parse_args('--foo 1 -y 2'.split())\n" "Namespace(foo_bar='1', x='2')" -#: ../../library/argparse.rst:1233 +#: ../../library/argparse.rst:1239 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" -#: ../../library/argparse.rst:1235 +#: ../../library/argparse.rst:1241 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', dest='bar')\n" @@ -2128,11 +2133,11 @@ msgstr "" ">>> parser.parse_args('--foo XXX'.split())\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1244 +#: ../../library/argparse.rst:1250 msgid "deprecated" msgstr "" -#: ../../library/argparse.rst:1246 +#: ../../library/argparse.rst:1252 msgid "" "During a project's lifetime, some arguments may need to be removed from the " "command line. Before removing them, you should inform your users that the " @@ -2143,7 +2148,7 @@ msgid "" "will be printed to :data:`sys.stderr` when the argument is used::" msgstr "" -#: ../../library/argparse.rst:1256 +#: ../../library/argparse.rst:1262 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='snake.py')\n" @@ -2163,131 +2168,124 @@ msgstr "" "snake.py: warning: option '--legs' is deprecated\n" "Namespace(legs=4)" -#: ../../library/argparse.rst:1269 +#: ../../library/argparse.rst:1275 msgid "Action classes" msgstr "" -#: ../../library/argparse.rst:1271 +#: ../../library/argparse.rst:1277 msgid "" -"Action classes implement the Action API, a callable which returns a callable " -"which processes arguments from the command-line. Any object which follows " -"this API may be passed as the ``action`` parameter to :meth:`~ArgumentParser." -"add_argument`." -msgstr "" - -#: ../../library/argparse.rst:1280 -msgid "" -"Action objects are used by an ArgumentParser to represent the information " -"needed to parse a single argument from one or more strings from the command " -"line. The Action class must accept the two positional arguments plus any " -"keyword arguments passed to :meth:`ArgumentParser.add_argument` except for " -"the ``action`` itself." +":class:`!Action` classes implement the Action API, a callable which returns " +"a callable which processes arguments from the command-line. Any object which " +"follows this API may be passed as the ``action`` parameter to :meth:" +"`~ArgumentParser.add_argument`." msgstr "" #: ../../library/argparse.rst:1286 msgid "" -"Instances of Action (or return value of any callable to the ``action`` " -"parameter) should have attributes \"dest\", \"option_strings\", \"default\", " -"\"type\", \"required\", \"help\", etc. defined. The easiest way to ensure " -"these attributes are defined is to call ``Action.__init__``." +":class:`!Action` objects are used by an :class:`ArgumentParser` to represent " +"the information needed to parse a single argument from one or more strings " +"from the command line. The :class:`!Action` class must accept the two " +"positional arguments plus any keyword arguments passed to :meth:" +"`ArgumentParser.add_argument` except for the ``action`` itself." msgstr "" -#: ../../library/argparse.rst:1291 +#: ../../library/argparse.rst:1292 msgid "" -"Action instances should be callable, so subclasses must override the " -"``__call__`` method, which should accept four parameters:" -msgstr "" - -#: ../../library/argparse.rst:1294 -msgid "*parser* - The ArgumentParser object which contains this action." +"Instances of :class:`!Action` (or return value of any callable to the " +"``action`` parameter) should have attributes :attr:`!dest`, :attr:`!" +"option_strings`, :attr:`!default`, :attr:`!type`, :attr:`!required`, :attr:`!" +"help`, etc. defined. The easiest way to ensure these attributes are defined " +"is to call :meth:`!Action.__init__`." msgstr "" -#: ../../library/argparse.rst:1296 -msgid "*namespace* - The :class:`Namespace` object that will be returned by" +#: ../../library/argparse.rst:1300 +msgid "" +":class:`!Action` instances should be callable, so subclasses must override " +"the :meth:`!__call__` method, which should accept four parameters:" msgstr "" -#: ../../library/argparse.rst:1297 +#: ../../library/argparse.rst:1303 msgid "" -":meth:`~ArgumentParser.parse_args`. Most actions add an attribute to this " -"object using :func:`setattr`." +"*parser* - The :class:`ArgumentParser` object which contains this action." msgstr "" -#: ../../library/argparse.rst:1300 +#: ../../library/argparse.rst:1305 msgid "" -"*values* - The associated command-line arguments, with any type conversions" +"*namespace* - The :class:`Namespace` object that will be returned by :meth:" +"`~ArgumentParser.parse_args`. Most actions add an attribute to this object " +"using :func:`setattr`." msgstr "" -#: ../../library/argparse.rst:1301 +#: ../../library/argparse.rst:1309 msgid "" +"*values* - The associated command-line arguments, with any type conversions " "applied. Type conversions are specified with the type_ keyword argument to :" "meth:`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1304 -msgid "" -"*option_string* - The option string that was used to invoke this action." -msgstr "" - -#: ../../library/argparse.rst:1305 +#: ../../library/argparse.rst:1313 msgid "" -"The ``option_string`` argument is optional, and will be absent if the action " -"is associated with a positional argument." +"*option_string* - The option string that was used to invoke this action. The " +"``option_string`` argument is optional, and will be absent if the action is " +"associated with a positional argument." msgstr "" -#: ../../library/argparse.rst:1308 +#: ../../library/argparse.rst:1317 msgid "" -"The ``__call__`` method may perform arbitrary actions, but will typically " -"set attributes on the ``namespace`` based on ``dest`` and ``values``." +"The :meth:`!__call__` method may perform arbitrary actions, but will " +"typically set attributes on the ``namespace`` based on ``dest`` and " +"``values``." msgstr "" -#: ../../library/argparse.rst:1311 +#: ../../library/argparse.rst:1322 msgid "" -"Action subclasses can define a ``format_usage`` method that takes no " -"argument and return a string which will be used when printing the usage of " -"the program. If such method is not provided, a sensible default will be used." +":class:`!Action` subclasses can define a :meth:`!format_usage` method that " +"takes no argument and return a string which will be used when printing the " +"usage of the program. If such method is not provided, a sensible default " +"will be used." msgstr "" -#: ../../library/argparse.rst:1317 +#: ../../library/argparse.rst:1328 msgid "The parse_args() method" -msgstr "" +msgstr "parse_args() 方法" -#: ../../library/argparse.rst:1321 +#: ../../library/argparse.rst:1332 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" -#: ../../library/argparse.rst:1324 +#: ../../library/argparse.rst:1335 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " -"created and how they are assigned. See the documentation for :meth:" -"`add_argument` for details." +"created and how they are assigned. See the documentation for :meth:`!" +"add_argument` for details." msgstr "" -#: ../../library/argparse.rst:1328 +#: ../../library/argparse.rst:1339 msgid "" "args_ - List of strings to parse. The default is taken from :data:`sys." "argv`." msgstr "" -#: ../../library/argparse.rst:1331 +#: ../../library/argparse.rst:1342 msgid "" "namespace_ - An object to take the attributes. The default is a new empty :" "class:`Namespace` object." msgstr "" -#: ../../library/argparse.rst:1336 +#: ../../library/argparse.rst:1347 msgid "Option value syntax" msgstr "" -#: ../../library/argparse.rst:1338 +#: ../../library/argparse.rst:1349 msgid "" "The :meth:`~ArgumentParser.parse_args` method supports several ways of " "specifying the value of an option (if it takes one). In the simplest case, " "the option and its value are passed as two separate arguments::" msgstr "" -#: ../../library/argparse.rst:1342 +#: ../../library/argparse.rst:1353 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2305,14 +2303,14 @@ msgstr "" ">>> parser.parse_args(['--foo', 'FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1350 +#: ../../library/argparse.rst:1361 msgid "" "For long options (options with names longer than a single character), the " "option and value can also be passed as a single command-line argument, using " "``=`` to separate them::" msgstr "" -#: ../../library/argparse.rst:1354 +#: ../../library/argparse.rst:1365 msgid "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" @@ -2320,13 +2318,13 @@ msgstr "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1357 +#: ../../library/argparse.rst:1368 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "" -#: ../../library/argparse.rst:1360 +#: ../../library/argparse.rst:1371 msgid "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" @@ -2334,13 +2332,13 @@ msgstr "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" -#: ../../library/argparse.rst:1363 +#: ../../library/argparse.rst:1374 msgid "" "Several short options can be joined together, using only a single ``-`` " "prefix, as long as only the last option (or none of them) requires a value::" msgstr "" -#: ../../library/argparse.rst:1366 +#: ../../library/argparse.rst:1377 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='http://github.com/store_true')\n" @@ -2356,11 +2354,11 @@ msgstr "" ">>> parser.parse_args(['-xyzZ'])\n" "Namespace(x=True, y=True, z='Z')" -#: ../../library/argparse.rst:1375 +#: ../../library/argparse.rst:1386 msgid "Invalid arguments" -msgstr "" +msgstr "無效引數" -#: ../../library/argparse.rst:1377 +#: ../../library/argparse.rst:1388 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " @@ -2368,7 +2366,7 @@ msgid "" "an error, it exits and prints the error along with a usage message::" msgstr "" -#: ../../library/argparse.rst:1382 +#: ../../library/argparse.rst:1393 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', type=int)\n" @@ -2390,11 +2388,11 @@ msgid "" "PROG: error: extra arguments found: badger" msgstr "" -#: ../../library/argparse.rst:1403 +#: ../../library/argparse.rst:1414 msgid "Arguments containing ``-``" -msgstr "" +msgstr "包含 ``-`` 的引數" -#: ../../library/argparse.rst:1405 +#: ../../library/argparse.rst:1416 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " @@ -2406,7 +2404,7 @@ msgid "" "negative numbers::" msgstr "" -#: ../../library/argparse.rst:1413 +#: ../../library/argparse.rst:1424 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2439,7 +2437,7 @@ msgid "" "PROG: error: argument -1: expected one argument" msgstr "" -#: ../../library/argparse.rst:1443 +#: ../../library/argparse.rst:1454 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " @@ -2447,7 +2445,7 @@ msgid "" "positional argument::" msgstr "" -#: ../../library/argparse.rst:1448 +#: ../../library/argparse.rst:1459 msgid "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" @@ -2455,24 +2453,24 @@ msgstr "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" -#: ../../library/argparse.rst:1451 +#: ../../library/argparse.rst:1462 msgid "" "See also :ref:`the argparse howto on ambiguous arguments ` for more details." msgstr "" -#: ../../library/argparse.rst:1457 +#: ../../library/argparse.rst:1468 msgid "Argument abbreviations (prefix matching)" msgstr "" -#: ../../library/argparse.rst:1459 +#: ../../library/argparse.rst:1470 msgid "" "The :meth:`~ArgumentParser.parse_args` method :ref:`by default " "` allows long options to be abbreviated to a prefix, if the " "abbreviation is unambiguous (the prefix matches a unique option)::" msgstr "" -#: ../../library/argparse.rst:1463 +#: ../../library/argparse.rst:1474 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -2496,25 +2494,25 @@ msgstr "" "usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" "PROG: error: ambiguous option: -ba could match -badger, -bacon" -#: ../../library/argparse.rst:1474 +#: ../../library/argparse.rst:1485 msgid "" "An error is produced for arguments that could produce more than one options. " "This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." msgstr "" -#: ../../library/argparse.rst:1480 +#: ../../library/argparse.rst:1491 msgid "Beyond ``sys.argv``" msgstr "" -#: ../../library/argparse.rst:1482 +#: ../../library/argparse.rst:1493 msgid "" -"Sometimes it may be useful to have an ArgumentParser parse arguments other " -"than those of :data:`sys.argv`. This can be accomplished by passing a list " -"of strings to :meth:`~ArgumentParser.parse_args`. This is useful for " -"testing at the interactive prompt::" +"Sometimes it may be useful to have an :class:`ArgumentParser` parse " +"arguments other than those of :data:`sys.argv`. This can be accomplished by " +"passing a list of strings to :meth:`~ArgumentParser.parse_args`. This is " +"useful for testing at the interactive prompt::" msgstr "" -#: ../../library/argparse.rst:1487 +#: ../../library/argparse.rst:1498 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\n" @@ -2540,24 +2538,24 @@ msgstr "" ">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" "Namespace(accumulate=, integers=[1, 2, 3, 4])" -#: ../../library/argparse.rst:1502 +#: ../../library/argparse.rst:1513 msgid "The Namespace object" -msgstr "" +msgstr "命名空間物件" -#: ../../library/argparse.rst:1506 +#: ../../library/argparse.rst:1517 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." msgstr "" -#: ../../library/argparse.rst:1509 +#: ../../library/argparse.rst:1520 msgid "" "This class is deliberately simple, just an :class:`object` subclass with a " "readable string representation. If you prefer to have dict-like view of the " "attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" -#: ../../library/argparse.rst:1513 +#: ../../library/argparse.rst:1524 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2571,14 +2569,14 @@ msgstr "" ">>> vars(args)\n" "{'foo': 'BAR'}" -#: ../../library/argparse.rst:1519 +#: ../../library/argparse.rst:1530 msgid "" "It may also be useful to have an :class:`ArgumentParser` assign attributes " "to an already existing object, rather than a new :class:`Namespace` object. " "This can be achieved by specifying the ``namespace=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:1523 +#: ../../library/argparse.rst:1534 msgid "" ">>> class C:\n" "... pass\n" @@ -2600,92 +2598,92 @@ msgstr "" ">>> c.foo\n" "'BAR'" -#: ../../library/argparse.rst:1535 +#: ../../library/argparse.rst:1546 msgid "Other utilities" msgstr "" -#: ../../library/argparse.rst:1538 +#: ../../library/argparse.rst:1549 msgid "Sub-commands" msgstr "" -#: ../../library/argparse.rst:1545 +#: ../../library/argparse.rst:1556 msgid "" "Many programs split up their functionality into a number of subcommands, for " "example, the ``svn`` program can invoke subcommands like ``svn checkout``, " "``svn update``, and ``svn commit``. Splitting up functionality this way can " "be a particularly good idea when a program performs several different " "functions which require different kinds of command-line arguments. :class:" -"`ArgumentParser` supports the creation of such subcommands with the :meth:" -"`add_subparsers` method. The :meth:`add_subparsers` method is normally " +"`ArgumentParser` supports the creation of such subcommands with the :meth:`!" +"add_subparsers` method. The :meth:`!add_subparsers` method is normally " "called with no arguments and returns a special action object. This object " "has a single method, :meth:`~_SubParsersAction.add_parser`, which takes a " -"command name and any :class:`ArgumentParser` constructor arguments, and " -"returns an :class:`ArgumentParser` object that can be modified as usual." +"command name and any :class:`!ArgumentParser` constructor arguments, and " +"returns an :class:`!ArgumentParser` object that can be modified as usual." msgstr "" -#: ../../library/argparse.rst:1557 +#: ../../library/argparse.rst:1568 msgid "Description of parameters:" -msgstr "" +msgstr "參數的解釋:" -#: ../../library/argparse.rst:1559 +#: ../../library/argparse.rst:1570 msgid "" "*title* - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " "positional arguments" msgstr "" -#: ../../library/argparse.rst:1563 +#: ../../library/argparse.rst:1574 msgid "" "*description* - description for the sub-parser group in help output, by " "default ``None``" msgstr "" -#: ../../library/argparse.rst:1566 +#: ../../library/argparse.rst:1577 msgid "" "*prog* - usage information that will be displayed with sub-command help, by " "default the name of the program and any positional arguments before the " "subparser argument" msgstr "" -#: ../../library/argparse.rst:1570 +#: ../../library/argparse.rst:1581 msgid "" "*parser_class* - class which will be used to create sub-parser instances, by " -"default the class of the current parser (e.g. ArgumentParser)" +"default the class of the current parser (e.g. :class:`ArgumentParser`)" msgstr "" -#: ../../library/argparse.rst:1573 +#: ../../library/argparse.rst:1584 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "" -#: ../../library/argparse.rst:1576 +#: ../../library/argparse.rst:1587 msgid "" "dest_ - name of the attribute under which sub-command name will be stored; " "by default ``None`` and no value is stored" msgstr "" -#: ../../library/argparse.rst:1579 +#: ../../library/argparse.rst:1590 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "" -#: ../../library/argparse.rst:1582 +#: ../../library/argparse.rst:1593 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" -#: ../../library/argparse.rst:1584 +#: ../../library/argparse.rst:1595 msgid "" "metavar_ - string presenting available subcommands in help; by default it is " "``None`` and presents subcommands in form {cmd1, cmd2, ..}" msgstr "" -#: ../../library/argparse.rst:1587 +#: ../../library/argparse.rst:1598 msgid "Some example usage::" msgstr "一些使用範例: ::" -#: ../../library/argparse.rst:1589 +#: ../../library/argparse.rst:1600 msgid "" ">>> # create the top-level parser\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -2708,7 +2706,7 @@ msgid "" "Namespace(baz='Z', foo=True)" msgstr "" -#: ../../library/argparse.rst:1608 +#: ../../library/argparse.rst:1619 msgid "" "Note that the object returned by :meth:`parse_args` will only contain " "attributes for the main parser and the subparser that was selected by the " @@ -2718,7 +2716,7 @@ msgid "" "``baz`` attributes are present." msgstr "" -#: ../../library/argparse.rst:1615 +#: ../../library/argparse.rst:1626 msgid "" "Similarly, when a help message is requested from a subparser, only the help " "for that particular parser will be printed. The help message will not " @@ -2727,7 +2725,7 @@ msgid "" "to :meth:`~_SubParsersAction.add_parser` as above.)" msgstr "" -#: ../../library/argparse.rst:1623 +#: ../../library/argparse.rst:1634 msgid "" ">>> parser.parse_args(['--help'])\n" "usage: PROG [-h] [--foo] {a,b} ...\n" @@ -2785,14 +2783,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --baz {X,Y,Z} baz help" -#: ../../library/argparse.rst:1651 +#: ../../library/argparse.rst:1662 msgid "" "The :meth:`add_subparsers` method also supports ``title`` and " "``description`` keyword arguments. When either is present, the subparser's " "commands will appear in their own group in the help output. For example::" msgstr "" -#: ../../library/argparse.rst:1655 +#: ../../library/argparse.rst:1666 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -2828,7 +2826,7 @@ msgstr "" "\n" " {foo,bar} additional help" -#: ../../library/argparse.rst:1672 +#: ../../library/argparse.rst:1683 msgid "" "Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional " "*aliases* argument, which allows multiple strings to refer to the same " @@ -2836,7 +2834,7 @@ msgid "" "``checkout``::" msgstr "" -#: ../../library/argparse.rst:1677 +#: ../../library/argparse.rst:1688 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -2852,13 +2850,13 @@ msgstr "" ">>> parser.parse_args(['co', 'bar'])\n" "Namespace(foo='bar')" -#: ../../library/argparse.rst:1684 +#: ../../library/argparse.rst:1695 msgid "" ":meth:`~_SubParsersAction.add_parser` supports also an additional " "*deprecated* argument, which allows to deprecate the subparser." msgstr "" -#: ../../library/argparse.rst:1698 +#: ../../library/argparse.rst:1709 msgid "" "One particularly effective way of handling subcommands is to combine the use " "of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so " @@ -2866,7 +2864,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:1703 +#: ../../library/argparse.rst:1714 msgid "" ">>> # subcommand functions\n" ">>> def foo(args):\n" @@ -2901,7 +2899,7 @@ msgid "" "((XYZYX))" msgstr "" -#: ../../library/argparse.rst:1735 +#: ../../library/argparse.rst:1746 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " @@ -2911,7 +2909,7 @@ msgid "" "argument to the :meth:`add_subparsers` call will work::" msgstr "" -#: ../../library/argparse.rst:1742 +#: ../../library/argparse.rst:1753 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" @@ -2931,15 +2929,15 @@ msgstr "" ">>> parser.parse_args(['2', 'frobble'])\n" "Namespace(subparser_name='2', y='frobble')" -#: ../../library/argparse.rst:1751 -msgid "New *required* keyword argument." +#: ../../library/argparse.rst:1762 +msgid "New *required* keyword-only parameter." msgstr "" -#: ../../library/argparse.rst:1756 +#: ../../library/argparse.rst:1767 msgid "FileType objects" msgstr "FileType 物件" -#: ../../library/argparse.rst:1760 +#: ../../library/argparse.rst:1771 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " "argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" @@ -2948,7 +2946,7 @@ msgid "" "the :func:`open` function for more details)::" msgstr "" -#: ../../library/argparse.rst:1766 +#: ../../library/argparse.rst:1777 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" @@ -2966,14 +2964,14 @@ msgstr "" "Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " "raw=<_io.FileIO name='raw.dat' mode='wb'>)" -#: ../../library/argparse.rst:1772 +#: ../../library/argparse.rst:1783 msgid "" "FileType objects understand the pseudo-argument ``'-'`` and automatically " "convert this into :data:`sys.stdin` for readable :class:`FileType` objects " "and :data:`sys.stdout` for writable :class:`FileType` objects::" msgstr "" -#: ../../library/argparse.rst:1776 +#: ../../library/argparse.rst:1787 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" @@ -2985,24 +2983,24 @@ msgstr "" ">>> parser.parse_args(['-'])\n" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1781 +#: ../../library/argparse.rst:1792 msgid "Added the *encodings* and *errors* parameters." msgstr "" -#: ../../library/argparse.rst:1786 +#: ../../library/argparse.rst:1797 msgid "Argument groups" msgstr "" -#: ../../library/argparse.rst:1791 +#: ../../library/argparse.rst:1802 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"options\" when displaying help messages. When " "there is a better conceptual grouping of arguments than this default one, " -"appropriate groups can be created using the :meth:`add_argument_group` " +"appropriate groups can be created using the :meth:`!add_argument_group` " "method::" msgstr "" -#: ../../library/argparse.rst:1797 +#: ../../library/argparse.rst:1808 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group = parser.add_argument_group('group')\n" @@ -3026,18 +3024,18 @@ msgstr "" " bar bar help\n" " --foo FOO foo help" -#: ../../library/argparse.rst:1808 +#: ../../library/argparse.rst:1819 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " "has an :meth:`~ArgumentParser.add_argument` method just like a regular :" "class:`ArgumentParser`. When an argument is added to the group, the parser " "treats it just like a normal argument, but displays the argument in a " -"separate group for help messages. The :meth:`add_argument_group` method " +"separate group for help messages. The :meth:`!add_argument_group` method " "accepts *title* and *description* arguments which can be used to customize " "this display::" msgstr "" -#: ../../library/argparse.rst:1816 +#: ../../library/argparse.rst:1827 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" @@ -3075,7 +3073,7 @@ msgstr "" "\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1834 +#: ../../library/argparse.rst:1845 msgid "" "The optional, keyword-only parameters argument_default_ and " "conflict_handler_ allow for finer-grained control of the behavior of the " @@ -3084,13 +3082,13 @@ msgid "" "rather than the entire parser." msgstr "" -#: ../../library/argparse.rst:1839 +#: ../../library/argparse.rst:1850 msgid "" "Note that any arguments not in your user-defined groups will end up back in " "the usual \"positional arguments\" and \"optional arguments\" sections." msgstr "" -#: ../../library/argparse.rst:1842 +#: ../../library/argparse.rst:1853 msgid "" "Calling :meth:`add_argument_group` on an argument group is deprecated. This " "feature was never supported and does not always work correctly. The function " @@ -3098,18 +3096,18 @@ msgid "" "future." msgstr "" -#: ../../library/argparse.rst:1850 +#: ../../library/argparse.rst:1861 msgid "Mutual exclusion" msgstr "" -#: ../../library/argparse.rst:1854 +#: ../../library/argparse.rst:1865 msgid "" -"Create a mutually exclusive group. :mod:`argparse` will make sure that only " +"Create a mutually exclusive group. :mod:`!argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " "command line::" msgstr "" -#: ../../library/argparse.rst:1858 +#: ../../library/argparse.rst:1869 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -3135,14 +3133,14 @@ msgstr "" "usage: PROG [-h] [--foo | --bar]\n" "PROG: error: argument --bar: not allowed with argument --foo" -#: ../../library/argparse.rst:1870 +#: ../../library/argparse.rst:1881 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " "is required::" msgstr "" -#: ../../library/argparse.rst:1874 +#: ../../library/argparse.rst:1885 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -3160,7 +3158,7 @@ msgstr "" "usage: PROG [-h] (--foo | --bar)\n" "PROG: error: one of the arguments --foo --bar is required" -#: ../../library/argparse.rst:1882 +#: ../../library/argparse.rst:1893 msgid "" "Note that currently mutually exclusive argument groups do not support the " "*title* and *description* arguments of :meth:`~ArgumentParser." @@ -3168,7 +3166,7 @@ msgid "" "argument group that has a title and description. For example::" msgstr "" -#: ../../library/argparse.rst:1888 +#: ../../library/argparse.rst:1899 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -3204,7 +3202,7 @@ msgstr "" " --foo FOO foo help\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1905 +#: ../../library/argparse.rst:1916 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " "on a mutually exclusive group is deprecated. These features were never " @@ -3212,11 +3210,11 @@ msgid "" "by accident through inheritance and will be removed in the future." msgstr "" -#: ../../library/argparse.rst:1913 +#: ../../library/argparse.rst:1924 msgid "Parser defaults" msgstr "" -#: ../../library/argparse.rst:1917 +#: ../../library/argparse.rst:1928 msgid "" "Most of the time, the attributes of the object returned by :meth:" "`parse_args` will be fully determined by inspecting the command-line " @@ -3225,7 +3223,7 @@ msgid "" "command line to be added::" msgstr "" -#: ../../library/argparse.rst:1923 +#: ../../library/argparse.rst:1934 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -3239,12 +3237,12 @@ msgstr "" ">>> parser.parse_args(['736'])\n" "Namespace(bar=42, baz='badger', foo=736)" -#: ../../library/argparse.rst:1929 +#: ../../library/argparse.rst:1940 msgid "" "Note that parser-level defaults always override argument-level defaults::" msgstr "" -#: ../../library/argparse.rst:1931 +#: ../../library/argparse.rst:1942 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -3258,20 +3256,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo='spam')" -#: ../../library/argparse.rst:1937 +#: ../../library/argparse.rst:1948 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " "example of this type." msgstr "" -#: ../../library/argparse.rst:1943 +#: ../../library/argparse.rst:1954 msgid "" "Get the default value for a namespace attribute, as set by either :meth:" "`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" msgstr "" -#: ../../library/argparse.rst:1947 +#: ../../library/argparse.rst:1958 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" @@ -3283,54 +3281,54 @@ msgstr "" ">>> parser.get_default('foo')\n" "'badger'" -#: ../../library/argparse.rst:1954 +#: ../../library/argparse.rst:1965 msgid "Printing help" -msgstr "" +msgstr "印出幫助訊息" -#: ../../library/argparse.rst:1956 +#: ../../library/argparse.rst:1967 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " "several formatting methods are available:" msgstr "" -#: ../../library/argparse.rst:1962 +#: ../../library/argparse.rst:1973 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " "assumed." msgstr "" -#: ../../library/argparse.rst:1968 +#: ../../library/argparse.rst:1979 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " "``None``, :data:`sys.stdout` is assumed." msgstr "" -#: ../../library/argparse.rst:1972 +#: ../../library/argparse.rst:1983 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "" -#: ../../library/argparse.rst:1977 +#: ../../library/argparse.rst:1988 msgid "" "Return a string containing a brief description of how the :class:" "`ArgumentParser` should be invoked on the command line." msgstr "" -#: ../../library/argparse.rst:1982 +#: ../../library/argparse.rst:1993 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:1987 +#: ../../library/argparse.rst:1998 msgid "Partial parsing" msgstr "" -#: ../../library/argparse.rst:1991 +#: ../../library/argparse.rst:2002 msgid "" "Sometimes a script may only parse a few of the command-line arguments, " "passing the remaining arguments on to another script or program. In these " @@ -3341,7 +3339,7 @@ msgid "" "remaining argument strings." msgstr "" -#: ../../library/argparse.rst:2000 +#: ../../library/argparse.rst:2011 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/store_true')\n" @@ -3355,7 +3353,7 @@ msgstr "" ">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" -#: ../../library/argparse.rst:2007 +#: ../../library/argparse.rst:2018 msgid "" ":ref:`Prefix matching ` rules apply to :meth:" "`~ArgumentParser.parse_known_args`. The parser may consume an option even if " @@ -3363,11 +3361,11 @@ msgid "" "remaining arguments list." msgstr "" -#: ../../library/argparse.rst:2014 +#: ../../library/argparse.rst:2025 msgid "Customizing file parsing" msgstr "" -#: ../../library/argparse.rst:2018 +#: ../../library/argparse.rst:2029 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -3375,20 +3373,20 @@ msgid "" "reading." msgstr "" -#: ../../library/argparse.rst:2023 +#: ../../library/argparse.rst:2034 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " "The method is called once per line read from the argument file, in order." msgstr "" -#: ../../library/argparse.rst:2027 +#: ../../library/argparse.rst:2038 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" msgstr "" -#: ../../library/argparse.rst:2030 +#: ../../library/argparse.rst:2041 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" @@ -3398,18 +3396,18 @@ msgstr "" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" -#: ../../library/argparse.rst:2036 +#: ../../library/argparse.rst:2047 msgid "Exiting methods" msgstr "" -#: ../../library/argparse.rst:2040 +#: ../../library/argparse.rst:2051 msgid "" "This method terminates the program, exiting with the specified *status* and, " "if given, it prints a *message* to :data:`sys.stderr` before that. The user " "can override this method to handle these steps differently::" msgstr "" -#: ../../library/argparse.rst:2044 +#: ../../library/argparse.rst:2055 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -3423,17 +3421,17 @@ msgstr "" " raise Exception(f'Exiting because of an error: {message}')\n" " exit(status)" -#: ../../library/argparse.rst:2052 +#: ../../library/argparse.rst:2063 msgid "" "This method prints a usage message, including the *message*, to :data:`sys." "stderr` and terminates the program with a status code of 2." msgstr "" -#: ../../library/argparse.rst:2057 +#: ../../library/argparse.rst:2068 msgid "Intermixed parsing" msgstr "" -#: ../../library/argparse.rst:2062 +#: ../../library/argparse.rst:2073 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -3441,15 +3439,15 @@ msgid "" "parsing style." msgstr "" -#: ../../library/argparse.rst:2067 +#: ../../library/argparse.rst:2078 msgid "" -"These parsers do not support all the argparse features, and will raise " -"exceptions if unsupported features are used. In particular, subparsers, and " -"mutually exclusive groups that include both optionals and positionals are " -"not supported." +"These parsers do not support all the :mod:`!argparse` features, and will " +"raise exceptions if unsupported features are used. In particular, " +"subparsers, and mutually exclusive groups that include both optionals and " +"positionals are not supported." msgstr "" -#: ../../library/argparse.rst:2072 +#: ../../library/argparse.rst:2083 msgid "" "The following example shows the difference between :meth:`~ArgumentParser." "parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " @@ -3457,7 +3455,7 @@ msgid "" "collects all the positionals into ``rest``. ::" msgstr "" -#: ../../library/argparse.rst:2078 +#: ../../library/argparse.rst:2089 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3477,7 +3475,7 @@ msgstr "" ">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" "Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" -#: ../../library/argparse.rst:2087 +#: ../../library/argparse.rst:2098 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -3485,371 +3483,42 @@ msgid "" "there are any remaining unparsed argument strings." msgstr "" -#: ../../library/argparse.rst:2096 +#: ../../library/argparse.rst:2107 msgid "Exceptions" -msgstr "" +msgstr "例外" -#: ../../library/argparse.rst:2100 +#: ../../library/argparse.rst:2111 msgid "An error from creating or using an argument (optional or positional)." msgstr "" -#: ../../library/argparse.rst:2102 +#: ../../library/argparse.rst:2113 msgid "" "The string value of this exception is the message, augmented with " "information about the argument that caused it." msgstr "" -#: ../../library/argparse.rst:2107 +#: ../../library/argparse.rst:2118 msgid "" "Raised when something goes wrong converting a command line string to a type." msgstr "" -#: ../../library/argparse.rst:2111 +#: ../../library/argparse.rst:2122 msgid "Guides and Tutorials" msgstr "" -#: ../../library/argparse.rst:796 +#: ../../library/argparse.rst:802 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/argparse.rst:796 ../../library/argparse.rst:830 -#: ../../library/argparse.rst:844 +#: ../../library/argparse.rst:802 ../../library/argparse.rst:836 +#: ../../library/argparse.rst:850 msgid "in argparse module" msgstr "於 argparse 模組中" -#: ../../library/argparse.rst:830 +#: ../../library/argparse.rst:836 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/argparse.rst:844 +#: ../../library/argparse.rst:850 msgid "+ (plus)" msgstr "+ (加號)" - -#~ msgid "Name" -#~ msgstr "名稱" - -#~ msgid "Description" -#~ msgstr "描述" - -#~ msgid "Values" -#~ msgstr "數值" - -#~ msgid "action_" -#~ msgstr "action_" - -#~ msgid "" -#~ "``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, " -#~ "``'append_const'``, ``'count'``, ``'help'``, ``'version'``" -#~ msgstr "" -#~ "``'store'``, ``'store_const'``, ``'store_true'``, ``'append'``, " -#~ "``'append_const'``, ``'count'``, ``'help'``, ``'version'``" - -#~ msgid "choices_" -#~ msgstr "choices_" - -#~ msgid "const_" -#~ msgstr "const_" - -#~ msgid "default_" -#~ msgstr "default_" - -#~ msgid "dest_" -#~ msgstr "dest_" - -#~ msgid "help_" -#~ msgstr "help_" - -#~ msgid "metavar_" -#~ msgstr "metavar_" - -#~ msgid "nargs_" -#~ msgstr "nargs_" - -#~ msgid ":class:`int`, ``'?'``, ``'*'``, or ``'+'``" -#~ msgstr ":class:`int`, ``'?'``, ``'*'``, or ``'+'``" - -#~ msgid "required_" -#~ msgstr "required_" - -#~ msgid "``True`` or ``False``" -#~ msgstr "``True`` 或 ``False``" - -#~ msgid "" -#~ ":class:`int`, :class:`float`, ``argparse.FileType('w')``, or callable " -#~ "function" -#~ msgstr "" -#~ ":class:`int`、:class:`float`、``argparse.FileType('w')`` 或可呼叫的函式" - -#~ msgid "Example" -#~ msgstr "範例" - -#~ msgid "" -#~ "import argparse\n" -#~ "\n" -#~ "parser = argparse.ArgumentParser(description='Process some integers.')\n" -#~ "parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" -#~ " help='an integer for the accumulator')\n" -#~ "parser.add_argument('--sum', dest='accumulate', action='http://github.com/store_const',\n" -#~ " const=sum, default=max,\n" -#~ " help='sum the integers (default: find the max)')\n" -#~ "\n" -#~ "args = parser.parse_args()\n" -#~ "print(args.accumulate(args.integers))" -#~ msgstr "" -#~ "import argparse\n" -#~ "\n" -#~ "parser = argparse.ArgumentParser(description='Process some integers.')\n" -#~ "parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" -#~ " help='an integer for the accumulator')\n" -#~ "parser.add_argument('--sum', dest='accumulate', action='http://github.com/store_const',\n" -#~ " const=sum, default=max,\n" -#~ " help='sum the integers (default: find the max)')\n" -#~ "\n" -#~ "args = parser.parse_args()\n" -#~ "print(args.accumulate(args.integers))" - -#~ msgid "" -#~ "$ python prog.py -h\n" -#~ "usage: prog.py [-h] [--sum] N [N ...]\n" -#~ "\n" -#~ "Process some integers.\n" -#~ "\n" -#~ "positional arguments:\n" -#~ " N an integer for the accumulator\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --sum sum the integers (default: find the max)" -#~ msgstr "" -#~ "$ python prog.py -h\n" -#~ "usage: prog.py [-h] [--sum] N [N ...]\n" -#~ "\n" -#~ "Process some integers.\n" -#~ "\n" -#~ "positional arguments:\n" -#~ " N an integer for the accumulator\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --sum sum the integers (default: find the max)" - -#~ msgid "" -#~ "$ python prog.py 1 2 3 4\n" -#~ "4\n" -#~ "\n" -#~ "$ python prog.py 1 2 3 4 --sum\n" -#~ "10" -#~ msgstr "" -#~ "$ python prog.py 1 2 3 4\n" -#~ "4\n" -#~ "\n" -#~ "$ python prog.py 1 2 3 4 --sum\n" -#~ "10" - -#~ msgid "" -#~ "$ python prog.py a b c\n" -#~ "usage: prog.py [-h] [--sum] N [N ...]\n" -#~ "prog.py: error: argument N: invalid int value: 'a'" -#~ msgstr "" -#~ "$ python prog.py a b c\n" -#~ "usage: prog.py [-h] [--sum] N [N ...]\n" -#~ "prog.py: error: argument N: invalid int value: 'a'" - -#~ msgid "Creating a parser" -#~ msgstr "建立一個剖析器" - -#~ msgid "" -#~ ">>> parser = argparse.ArgumentParser(description='Process some integers.')" -#~ msgstr "" -#~ ">>> parser = argparse.ArgumentParser(description='Process some integers.')" - -#~ msgid "Adding arguments" -#~ msgstr "增加引數" - -#~ msgid "" -#~ ">>> parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" -#~ "... help='an integer for the accumulator')\n" -#~ ">>> parser.add_argument('--sum', dest='accumulate', " -#~ "action='http://github.com/store_const',\n" -#~ "... const=sum, default=max,\n" -#~ "... help='sum the integers (default: find the max)')" -#~ msgstr "" -#~ ">>> parser.add_argument('integers', metavar='N', type=int, nargs='+',\n" -#~ "... help='an integer for the accumulator')\n" -#~ ">>> parser.add_argument('--sum', dest='accumulate', " -#~ "action='http://github.com/store_const',\n" -#~ "... const=sum, default=max,\n" -#~ "... help='sum the integers (default: find the max)')" - -#~ msgid "Parsing arguments" -#~ msgstr "剖析引數" - -#~ msgid "" -#~ ">>> parser.parse_args(['--sum', '7', '-1', '42'])\n" -#~ "Namespace(accumulate=, integers=[7, -1, 42])" -#~ msgstr "" -#~ ">>> parser.parse_args(['--sum', '7', '-1', '42'])\n" -#~ "Namespace(accumulate=, integers=[7, -1, 42])" - -#~ msgid "" -#~ "import argparse\n" -#~ "parser = argparse.ArgumentParser()\n" -#~ "parser.add_argument('--foo', help='foo help')\n" -#~ "args = parser.parse_args()" -#~ msgstr "" -#~ "import argparse\n" -#~ "parser = argparse.ArgumentParser()\n" -#~ "parser.add_argument('--foo', help='foo help')\n" -#~ "args = parser.parse_args()" - -#~ msgid "" -#~ "$ python myprogram.py --help\n" -#~ "usage: myprogram.py [-h] [--foo FOO]\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo FOO foo help\n" -#~ "$ cd ..\n" -#~ "$ python subdir/myprogram.py --help\n" -#~ "usage: myprogram.py [-h] [--foo FOO]\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo FOO foo help" -#~ msgstr "" -#~ "$ python myprogram.py --help\n" -#~ "usage: myprogram.py [-h] [--foo FOO]\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo FOO foo help\n" -#~ "$ cd ..\n" -#~ "$ python subdir/myprogram.py --help\n" -#~ "usage: myprogram.py [-h] [--foo FOO]\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo FOO foo help" - -#~ msgid "" -#~ ">>> parser = argparse.ArgumentParser(prog='PROG')\n" -#~ ">>> parser.add_argument('--foo', nargs='?', help='foo help')\n" -#~ ">>> parser.add_argument('bar', nargs='+', help='bar help')\n" -#~ ">>> parser.print_help()\n" -#~ "usage: PROG [-h] [--foo [FOO]] bar [bar ...]\n" -#~ "\n" -#~ "positional arguments:\n" -#~ " bar bar help\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo [FOO] foo help" -#~ msgstr "" -#~ ">>> parser = argparse.ArgumentParser(prog='PROG')\n" -#~ ">>> parser.add_argument('--foo', nargs='?', help='foo help')\n" -#~ ">>> parser.add_argument('bar', nargs='+', help='bar help')\n" -#~ ">>> parser.print_help()\n" -#~ "usage: PROG [-h] [--foo [FOO]] bar [bar ...]\n" -#~ "\n" -#~ "positional arguments:\n" -#~ " bar bar help\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo [FOO] foo help" - -#~ msgid "" -#~ ">>> parser = argparse.ArgumentParser(description='A foo that bars')\n" -#~ ">>> parser.print_help()\n" -#~ "usage: argparse.py [-h]\n" -#~ "\n" -#~ "A foo that bars\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit" -#~ msgstr "" -#~ ">>> parser = argparse.ArgumentParser(description='A foo that bars')\n" -#~ ">>> parser.print_help()\n" -#~ "usage: argparse.py [-h]\n" -#~ "\n" -#~ "A foo that bars\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit" - -#~ msgid "" -#~ "$ python myprogram.py --help\n" -#~ "usage: myprogram.py [-h] [--foo FOO]\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo FOO foo help" -#~ msgstr "" -#~ "$ python myprogram.py --help\n" -#~ "usage: myprogram.py [-h] [--foo FOO]\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo FOO foo help" - -#~ msgid "" -#~ ">>> parser = argparse.ArgumentParser()\n" -#~ ">>> parser.add_argument('--foo')\n" -#~ ">>> parser.parse_args('--foo 1'.split())\n" -#~ "Namespace(foo='1')" -#~ msgstr "" -#~ ">>> parser = argparse.ArgumentParser()\n" -#~ ">>> parser.add_argument('--foo')\n" -#~ ">>> parser.parse_args('--foo 1'.split())\n" -#~ "Namespace(foo='1')" - -#~ msgid "" -#~ ">>> parser = argparse.ArgumentParser(prog='doors.py')\n" -#~ ">>> parser.add_argument('door', type=int, choices=range(1, 4))\n" -#~ ">>> print(parser.parse_args(['3']))\n" -#~ "Namespace(door=3)\n" -#~ ">>> parser.parse_args(['4'])\n" -#~ "usage: doors.py [-h] {1,2,3}\n" -#~ "doors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3)" -#~ msgstr "" -#~ ">>> parser = argparse.ArgumentParser(prog='doors.py')\n" -#~ ">>> parser.add_argument('door', type=int, choices=range(1, 4))\n" -#~ ">>> print(parser.parse_args(['3']))\n" -#~ "Namespace(door=3)\n" -#~ ">>> parser.parse_args(['4'])\n" -#~ "usage: doors.py [-h] {1,2,3}\n" -#~ "doors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3)" - -#~ msgid "" -#~ ">>> parser = argparse.ArgumentParser(prog='frobble')\n" -#~ ">>> parser.add_argument('--foo', action='http://github.com/store_true',\n" -#~ "... help='foo the bars before frobbling')\n" -#~ ">>> parser.add_argument('bar', nargs='+',\n" -#~ "... help='one of the bars to be frobbled')\n" -#~ ">>> parser.parse_args(['-h'])\n" -#~ "usage: frobble [-h] [--foo] bar [bar ...]\n" -#~ "\n" -#~ "positional arguments:\n" -#~ " bar one of the bars to be frobbled\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo foo the bars before frobbling" -#~ msgstr "" -#~ ">>> parser = argparse.ArgumentParser(prog='frobble')\n" -#~ ">>> parser.add_argument('--foo', action='http://github.com/store_true',\n" -#~ "... help='foo the bars before frobbling')\n" -#~ ">>> parser.add_argument('bar', nargs='+',\n" -#~ "... help='one of the bars to be frobbled')\n" -#~ ">>> parser.parse_args(['-h'])\n" -#~ "usage: frobble [-h] [--foo] bar [bar ...]\n" -#~ "\n" -#~ "positional arguments:\n" -#~ " bar one of the bars to be frobbled\n" -#~ "\n" -#~ "options:\n" -#~ " -h, --help show this help message and exit\n" -#~ " --foo foo the bars before frobbling" - -#~ msgid "type_" -#~ msgstr "type_" diff --git a/library/builtins.po b/library/builtins.po index d2a6cc577f..ab36c9d83d 100644 --- a/library/builtins.po +++ b/library/builtins.po @@ -1,14 +1,14 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Adrian Liaw , 2018 -# Matt Wang , 2022 +# Matt Wang , 2022-2024 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: 2022-02-15 20:55+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,14 +28,12 @@ msgstr ":mod:`!builtins` --- 內建物件" msgid "" "This module provides direct access to all 'built-in' identifiers of Python; " "for example, ``builtins.open`` is the full name for the built-in function :" -"func:`open`. See :ref:`built-in-funcs` and :ref:`built-in-consts` for " -"documentation." +"func:`open`." msgstr "" "該模組提供對 Python 所有'內建'識別符號的直接存取;例如 ``builtins.open`` 是內" -"建函式 :func:`open` 的全名。請參閱\\ :ref:`built-in-funcs`\\ 和\\ :ref:" -"`built-in-consts`\\ 的文件。" +"建函式 :func:`open` 的全名。" -#: ../../library/builtins.rst:15 +#: ../../library/builtins.rst:12 msgid "" "This module is not normally accessed explicitly by most applications, but " "can be useful in modules that provide objects with the same name as a built-" @@ -47,7 +45,7 @@ msgstr "" "能很有用,不過其中還會需要內建該名稱。例如,在一個將內建 :func:`open` 包裝起" "來以實現另一版本 :func:`open` 函式的模組中,這個模組可以直接被使用: ::" -#: ../../library/builtins.rst:21 +#: ../../library/builtins.rst:18 msgid "" "import builtins\n" "\n" @@ -66,8 +64,24 @@ msgid "" "\n" " # ..." msgstr "" +"import builtins\n" +"\n" +"def open(path):\n" +" f = builtins.open(path, 'r')\n" +" return UpperCaser(f)\n" +"\n" +"class UpperCaser:\n" +" '''將輸出轉換成大寫的檔案包裝器'''\n" +"\n" +" def __init__(self, f):\n" +" self._f = f\n" +"\n" +" def read(self, count=-1):\n" +" return self._f.read(count).upper()\n" +"\n" +" # ..." -#: ../../library/builtins.rst:38 +#: ../../library/builtins.rst:35 msgid "" "As an implementation detail, most modules have the name ``__builtins__`` " "made available as part of their globals. The value of ``__builtins__`` is " @@ -79,3 +93,19 @@ msgstr "" "以提使用。``__builtins__`` 的值通常是這個模組或者這個模組的 :attr:`~object." "__dict__` 屬性值。由於這是一個實作細節,因此 Python 的其他實作可能不會使用" "它。" + +#: ../../library/builtins.rst:43 +msgid ":ref:`built-in-consts`" +msgstr ":ref:`built-in-consts`" + +#: ../../library/builtins.rst:44 +msgid ":ref:`bltin-exceptions`" +msgstr ":ref:`bltin-exceptions`" + +#: ../../library/builtins.rst:45 +msgid ":ref:`built-in-funcs`" +msgstr ":ref:`built-in-funcs`" + +#: ../../library/builtins.rst:46 +msgid ":ref:`bltin-types`" +msgstr ":ref:`bltin-types`" diff --git a/library/cmath.po b/library/cmath.po index 40159235bf..ba28b03e18 100644 --- a/library/cmath.po +++ b/library/cmath.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-11-05 00:13+0000\n" "PO-Revision-Date: 2024-03-14 09:26+0800\n" "Last-Translator: Enkai Huang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -311,93 +310,89 @@ msgstr "如果 *a* 和 *b* 的值相互接近,則回傳 ``True``,否則回 #: ../../library/cmath.rst:223 msgid "" "Whether or not two values are considered close is determined according to " -"given absolute and relative tolerances." +"given absolute and relative tolerances. If no errors occur, the result will " +"be: ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``." msgstr "" -"兩個值是否被認為相互接近是由給定的絕對和相對容許偏差 (tolerance) 所決定的。" +"兩數是否足夠接近取決於給定的絕對及相對容許偏差 (tolerance)。如果沒有錯誤發" +"生,結果將為:``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``。" -#: ../../library/cmath.rst:226 +#: ../../library/cmath.rst:227 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " "For example, to set a tolerance of 5%, pass ``rel_tol=0.05``. The default " "tolerance is ``1e-09``, which assures that the two values are the same " -"within about 9 decimal digits. *rel_tol* must be greater than zero." +"within about 9 decimal digits. *rel_tol* must be nonnegative and less than " +"``1.0``." msgstr "" -"*rel_tol* 是相對容許偏差 -- 它是 *a* 和 *b* 之間的最大容許偏差值,相對於 *a* " -"或 *b* 的較大絕對值。例如,要設定 5% 的容許偏差,請傳遞 ``rel_tol=0.05``。預" -"設容許偏差是 ``1e-09``,它確保兩個值在大約 9 位十進制數字內相同。 *rel_tol* " -"必須大於零。" - -#: ../../library/cmath.rst:232 -msgid "" -"*abs_tol* is the minimum absolute tolerance -- useful for comparisons near " -"zero. *abs_tol* must be at least zero." -msgstr "" -"*abs_tol* 是最小絕對容許偏差 -- 對於接近零的比較很有用。 *abs_tol* 必須至少為" -"零。" - -#: ../../library/cmath.rst:235 -msgid "" -"If no errors occur, the result will be: ``abs(a-b) <= max(rel_tol * " -"max(abs(a), abs(b)), abs_tol)``." +"*rel_tol* 為相對容許偏差 ── *a* 與 *b* 兩數差的最大容許值,與 *a* 及 *b* 兩數" +"的絕對值中較大者相關。例如欲設置 5% 的容許偏差,則傳入 ``rel_tol=0.05``。其預" +"設值為 ``1e-09``,該值可確保兩數於大約 9 個十進數位內相同。*rel_tol* 須不為負" +"且小於 ``1.0``。" + +#: ../../library/cmath.rst:234 +msgid "" +"*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " +"nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " +"as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any ``x`` and " +"rel_tol less than ``1.0``. So add an appropriate positive abs_tol argument " +"to the call." msgstr "" -"如果未發生錯誤,結果將為: ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), " -"abs_tol)``。" -#: ../../library/cmath.rst:238 +#: ../../library/cmath.rst:240 msgid "" "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " "handled according to IEEE rules. Specifically, ``NaN`` is not considered " "close to any other value, including ``NaN``. ``inf`` and ``-inf`` are only " "considered close to themselves." msgstr "" -"IEEE 754 特殊值 ``NaN`` 、 ``inf`` 和 ``-inf`` 將會根據 IEEE 規則進行處理。具" -"體來說, ``NaN`` 不被認為接近任何其他值,包括 ``NaN``。 ``inf`` 和 ``-inf`` " -"只被認為是接近它們自己的。" +"定義於 IEEE 754 浮點標準中的特殊值 ``NaN``、``inf`` 和 ``-inf`` 會根據該標準" +"處理。更明確地說,``NaN`` 不會與包含自身在內的任何數字足夠接近,而 ``inf`` " +"及 ``-inf`` 皆只與自身接近。" -#: ../../library/cmath.rst:247 +#: ../../library/cmath.rst:249 msgid ":pep:`485` -- A function for testing approximate equality" -msgstr ":pep:`485` -- 一個用來測試近似相等的函式" +msgstr ":pep:`485` ── 用於測試近似相等的函式" -#: ../../library/cmath.rst:251 +#: ../../library/cmath.rst:253 msgid "Constants" msgstr "常數" -#: ../../library/cmath.rst:255 +#: ../../library/cmath.rst:257 msgid "The mathematical constant *π*, as a float." msgstr "數學常數 *π*,作為一個浮點數。" -#: ../../library/cmath.rst:260 +#: ../../library/cmath.rst:262 msgid "The mathematical constant *e*, as a float." msgstr "數學常數 *e*,作為一個浮點數。" -#: ../../library/cmath.rst:265 +#: ../../library/cmath.rst:267 msgid "The mathematical constant *τ*, as a float." msgstr "數學常數 *τ*,作為一個浮點數。" -#: ../../library/cmath.rst:272 +#: ../../library/cmath.rst:274 msgid "Floating-point positive infinity. Equivalent to ``float('inf')``." msgstr "正無窮大的浮點數。相當於 ``float('inf')``。" -#: ../../library/cmath.rst:279 +#: ../../library/cmath.rst:281 msgid "" "Complex number with zero real part and positive infinity imaginary part. " "Equivalent to ``complex(0.0, float('inf'))``." msgstr "實部為零和虛部為正無窮的複數。相當於 ``complex(0.0, float('inf'))``。" -#: ../../library/cmath.rst:287 +#: ../../library/cmath.rst:289 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to " "``float('nan')``." msgstr "浮點「非數字」 (NaN) 值。相當於 ``float('nan')``。" -#: ../../library/cmath.rst:295 +#: ../../library/cmath.rst:297 msgid "" "Complex number with zero real part and NaN imaginary part. Equivalent to " "``complex(0.0, float('nan'))``." msgstr "實部為零和虛部為 NaN 的複數。相當於 ``complex(0.0, float('nan'))``。" -#: ../../library/cmath.rst:303 +#: ../../library/cmath.rst:305 msgid "" "Note that the selection of functions is similar, but not identical, to that " "in module :mod:`math`. The reason for having two modules is that some users " @@ -413,7 +408,7 @@ msgstr "" "sqrt(-1)`` 引發異常,也不願它回傳複數。另請注意, :mod:`cmath` 中所定義的函式" "始終都會回傳複數,即使答案可以表示為實數(在這種情況下,複數的虛部為零)。" -#: ../../library/cmath.rst:311 +#: ../../library/cmath.rst:313 msgid "" "A note on branch cuts: They are curves along which the given function fails " "to be continuous. They are a necessary feature of many complex functions. " @@ -428,17 +423,17 @@ msgstr "" "所有關於複變函數的(不是太初級的)書籍以獲得啟發。對於如何正確地基於數值目的" "選擇分枝切割的相關訊息,以下內容應該是一個很好的參考:" -#: ../../library/cmath.rst:321 +#: ../../library/cmath.rst:323 msgid "" "Kahan, W: Branch cuts for complex elementary functions; or, Much ado about " "nothing's sign bit. In Iserles, A., and Powell, M. (eds.), The state of the " "art in numerical analysis. Clarendon Press (1987) pp165--211." msgstr "" -#: ../../library/cmath.rst:301 +#: ../../library/cmath.rst:303 msgid "module" msgstr "module(模組)" -#: ../../library/cmath.rst:301 +#: ../../library/cmath.rst:303 msgid "math" msgstr "math(數學)" diff --git a/library/codecs.po b/library/codecs.po index 5ccfe0b8b7..90de1fd8dd 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -1667,9 +1667,8 @@ msgid "cp932" msgstr "cp932" #: ../../library/codecs.rst:1135 -#, fuzzy msgid "932, ms932, mskanji, ms-kanji, windows-31j" -msgstr "932, ms932, mskanji, ms-kanji" +msgstr "932, ms932, mskanji, ms-kanji, windows-31j" #: ../../library/codecs.rst:1135 ../../library/codecs.rst:1171 #: ../../library/codecs.rst:1173 ../../library/codecs.rst:1175 @@ -1883,7 +1882,7 @@ msgstr "gb18030-2000" #: ../../library/codecs.rst:1190 msgid "hz" -msgstr "" +msgstr "hz" #: ../../library/codecs.rst:1190 msgid "hzgb, hz-gb, hz-gb-2312" @@ -2047,7 +2046,7 @@ msgstr "iso-8859-11, thai" #: ../../library/codecs.rst:1232 msgid "Thai languages" -msgstr "" +msgstr "泰語" #: ../../library/codecs.rst:1234 msgid "iso8859_13" diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index 682bcbacad..8bec6881d5 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: 2023-01-24 03:33+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -379,7 +379,7 @@ msgid "" " 'http://www.cnn.com/',\n" " 'http://europe.wsj.com/',\n" " 'http://www.bbc.co.uk/',\n" -" 'http://nonexistant-subdomain.python.org/']\n" +" 'http://nonexistent-subdomain.python.org/']\n" "\n" "# Retrieve a single page and report the URL and contents\n" "def load_url(http://github.com/url,%20timeout):\n" diff --git a/library/configparser.po b/library/configparser.po index 3bc3843a4c..1cf79e0a29 100644 --- a/library/configparser.po +++ b/library/configparser.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-12 00:13+0000\n" +"POT-Creation-Date: 2024-11-06 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -132,6 +132,21 @@ msgid "" "... config.write(configfile)\n" "..." msgstr "" +">>> import configparser\n" +">>> config = configparser.ConfigParser()\n" +">>> config['DEFAULT'] = {'ServerAliveInterval': '45',\n" +"... 'Compression': 'yes',\n" +"... 'CompressionLevel': '9'}\n" +">>> config['forge.example'] = {}\n" +">>> config['forge.example']['User'] = 'hg'\n" +">>> config['topsecret.server.example'] = {}\n" +">>> topsecret = config['topsecret.server.example']\n" +">>> topsecret['Port'] = '50022' # mutates the parser\n" +">>> topsecret['ForwardX11'] = 'no' # same here\n" +">>> config['DEFAULT']['ForwardX11'] = 'yes'\n" +">>> with open('example.ini', 'w') as configfile:\n" +"... config.write(configfile)\n" +"..." #: ../../library/configparser.rst:104 msgid "" @@ -178,6 +193,35 @@ msgid "" ">>> config['forge.example']['ForwardX11']\n" "'yes'" msgstr "" +">>> config = configparser.ConfigParser()\n" +">>> config.sections()\n" +"[]\n" +">>> config.read('example.ini')\n" +"['example.ini']\n" +">>> config.sections()\n" +"['forge.example', 'topsecret.server.example']\n" +">>> 'forge.example' in config\n" +"True\n" +">>> 'python.org' in config\n" +"False\n" +">>> config['forge.example']['User']\n" +"'hg'\n" +">>> config['DEFAULT']['Compression']\n" +"'yes'\n" +">>> topsecret = config['topsecret.server.example']\n" +">>> topsecret['ForwardX11']\n" +"'no'\n" +">>> topsecret['Port']\n" +"'50022'\n" +">>> for key in config['forge.example']: \n" +"... print(key)\n" +"user\n" +"compressionlevel\n" +"serveraliveinterval\n" +"compression\n" +"forwardx11\n" +">>> config['forge.example']['ForwardX11']\n" +"'yes'" #: ../../library/configparser.rst:143 msgid "" @@ -187,7 +231,7 @@ msgid "" "and stored in lowercase [1]_." msgstr "" -#: ../../library/configparser.rst:148 ../../library/configparser.rst:993 +#: ../../library/configparser.rst:148 ../../library/configparser.rst:1003 msgid "" "It is possible to read several configurations into a single :class:" "`ConfigParser`, where the most recently added configuration has the highest " @@ -197,7 +241,7 @@ msgid "" "``example.ini`` file." msgstr "" -#: ../../library/configparser.rst:155 ../../library/configparser.rst:1000 +#: ../../library/configparser.rst:155 ../../library/configparser.rst:1010 msgid "" "[DEFAULT]\n" "ServerAliveInterval = -1" @@ -205,7 +249,7 @@ msgstr "" "[DEFAULT]\n" "ServerAliveInterval = -1" -#: ../../library/configparser.rst:160 ../../library/configparser.rst:1005 +#: ../../library/configparser.rst:160 ../../library/configparser.rst:1015 msgid "" ">>> config_override = configparser.ConfigParser()\n" ">>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}\n" @@ -488,6 +532,16 @@ msgid "" ">>> unnamed.get(configparser.UNNAMED_SECTION, 'option')\n" "'value'" msgstr "" +">>> config = \"\"\"\n" +"... option = value\n" +"...\n" +"... [ Section 2 ]\n" +"... another = val\n" +"... \"\"\"\n" +">>> unnamed = configparser.ConfigParser(allow_unnamed_section=True)\n" +">>> unnamed.read_string(config)\n" +">>> unnamed.get(configparser.UNNAMED_SECTION, 'option')\n" +"'value'" #: ../../library/configparser.rst:361 msgid "Interpolation of values" @@ -1329,7 +1383,7 @@ msgstr "" msgid "ConfigParser Objects" msgstr "ConfigParser 物件" -#: ../../library/configparser.rst:947 +#: ../../library/configparser.rst:953 msgid "" "The main configuration parser. When *defaults* is given, it is initialized " "into the dictionary of intrinsic defaults. When *dict_type* is given, it " @@ -1337,7 +1391,7 @@ msgid "" "the options within a section, and for the default values." msgstr "" -#: ../../library/configparser.rst:952 +#: ../../library/configparser.rst:958 msgid "" "When *delimiters* is given, it is used as the set of substrings that divide " "keys from values. When *comment_prefixes* is given, it will be used as the " @@ -1346,7 +1400,7 @@ msgid "" "as the set of substrings that prefix comments in non-empty lines." msgstr "" -#: ../../library/configparser.rst:958 +#: ../../library/configparser.rst:964 msgid "" "When *strict* is ``True`` (the default), the parser won't allow for any " "section or option duplicates while reading from a single source (file, " @@ -1359,7 +1413,7 @@ msgid "" "without the trailing delimiter." msgstr "" -#: ../../library/configparser.rst:968 +#: ../../library/configparser.rst:974 msgid "" "When *default_section* is given, it specifies the name for the special " "section holding default values for other sections and interpolation purposes " @@ -1369,7 +1423,7 @@ msgid "" "settings to a new config file." msgstr "" -#: ../../library/configparser.rst:975 +#: ../../library/configparser.rst:981 msgid "" "Interpolation behaviour may be customized by providing a custom handler " "through the *interpolation* argument. ``None`` can be used to turn off " @@ -1378,7 +1432,7 @@ msgid "" "`dedicated documentation section <#interpolation-of-values>`_." msgstr "" -#: ../../library/configparser.rst:981 +#: ../../library/configparser.rst:987 msgid "" "All option names used in interpolation will be passed through the :meth:" "`optionxform` method just like any other option name reference. For " @@ -1387,7 +1441,7 @@ msgid "" "%(BAR)s`` are equivalent." msgstr "" -#: ../../library/configparser.rst:987 +#: ../../library/configparser.rst:993 msgid "" "When *converters* is given, it should be a dictionary where each key " "represents the name of a type converter and each value is a callable " @@ -1396,50 +1450,61 @@ msgid "" "object and section proxies." msgstr "" -#: ../../library/configparser.rst:1018 +#: ../../library/configparser.rst:999 +msgid "" +"When *allow_unnamed_section* is ``True`` (default: ``False``), the first " +"section name can be omitted. See the `\"Unnamed Sections\" section <#unnamed-" +"sections>`_." +msgstr "" + +#: ../../library/configparser.rst:1028 msgid "The default *dict_type* is :class:`collections.OrderedDict`." msgstr "" -#: ../../library/configparser.rst:1021 +#: ../../library/configparser.rst:1031 ../../library/configparser.rst:1320 msgid "" "*allow_no_value*, *delimiters*, *comment_prefixes*, *strict*, " "*empty_lines_in_values*, *default_section* and *interpolation* were added." msgstr "" -#: ../../library/configparser.rst:1026 +#: ../../library/configparser.rst:1036 ../../library/configparser.rst:1325 msgid "The *converters* argument was added." msgstr "新增 *converters* 引數。" -#: ../../library/configparser.rst:1029 +#: ../../library/configparser.rst:1039 msgid "" "The *defaults* argument is read with :meth:`read_dict`, providing consistent " "behavior across the parser: non-string keys and values are implicitly " "converted to strings." msgstr "" -#: ../../library/configparser.rst:1034 ../../library/configparser.rst:1306 +#: ../../library/configparser.rst:1044 ../../library/configparser.rst:1328 msgid "" "The default *dict_type* is :class:`dict`, since it now preserves insertion " "order." msgstr "" -#: ../../library/configparser.rst:1038 +#: ../../library/configparser.rst:1048 msgid "" "Raise a :exc:`MultilineContinuationError` when *allow_no_value* is ``True``, " "and a key without a value is continued with an indented line." msgstr "" -#: ../../library/configparser.rst:1044 +#: ../../library/configparser.rst:1052 ../../library/configparser.rst:1332 +msgid "The *allow_unnamed_section* argument was added." +msgstr "新增 *allow_unnamed_section* 引數。" + +#: ../../library/configparser.rst:1057 msgid "Return a dictionary containing the instance-wide defaults." msgstr "" -#: ../../library/configparser.rst:1049 +#: ../../library/configparser.rst:1062 msgid "" "Return a list of the sections available; the *default section* is not " "included in the list." msgstr "" -#: ../../library/configparser.rst:1055 +#: ../../library/configparser.rst:1068 msgid "" "Add a section named *section* to the instance. If a section by the given " "name already exists, :exc:`DuplicateSectionError` is raised. If the " @@ -1447,34 +1512,34 @@ msgid "" "the section must be a string; if not, :exc:`TypeError` is raised." msgstr "" -#: ../../library/configparser.rst:1060 +#: ../../library/configparser.rst:1073 msgid "Non-string section names raise :exc:`TypeError`." msgstr "" -#: ../../library/configparser.rst:1066 +#: ../../library/configparser.rst:1079 msgid "" "Indicates whether the named *section* is present in the configuration. The " "*default section* is not acknowledged." msgstr "" -#: ../../library/configparser.rst:1072 +#: ../../library/configparser.rst:1085 msgid "Return a list of options available in the specified *section*." msgstr "" -#: ../../library/configparser.rst:1077 +#: ../../library/configparser.rst:1090 msgid "" "If the given *section* exists, and contains the given *option*, return :" "const:`True`; otherwise return :const:`False`. If the specified *section* " "is :const:`None` or an empty string, DEFAULT is assumed." msgstr "" -#: ../../library/configparser.rst:1084 +#: ../../library/configparser.rst:1097 msgid "" "Attempt to read and parse an iterable of filenames, returning a list of " "filenames which were successfully parsed." msgstr "" -#: ../../library/configparser.rst:1087 +#: ../../library/configparser.rst:1100 msgid "" "If *filenames* is a string, a :class:`bytes` object or a :term:`path-like " "object`, it is treated as a single filename. If a file named in *filenames* " @@ -1485,7 +1550,7 @@ msgid "" "be read." msgstr "" -#: ../../library/configparser.rst:1096 +#: ../../library/configparser.rst:1109 msgid "" "If none of the named files exist, the :class:`ConfigParser` instance will " "contain an empty dataset. An application which requires initial values to " @@ -1493,7 +1558,7 @@ msgid "" "`read_file` before calling :meth:`read` for any optional files::" msgstr "" -#: ../../library/configparser.rst:1102 +#: ../../library/configparser.rst:1115 msgid "" "import configparser, os\n" "\n" @@ -1509,49 +1574,49 @@ msgstr "" "config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')],\n" " encoding='cp1250')" -#: ../../library/configparser.rst:1109 +#: ../../library/configparser.rst:1122 msgid "" "Added the *encoding* parameter. Previously, all files were read using the " "default encoding for :func:`open`." msgstr "" -#: ../../library/configparser.rst:1113 +#: ../../library/configparser.rst:1126 msgid "The *filenames* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/configparser.rst:1116 +#: ../../library/configparser.rst:1129 msgid "The *filenames* parameter accepts a :class:`bytes` object." msgstr "" -#: ../../library/configparser.rst:1122 +#: ../../library/configparser.rst:1135 msgid "" "Read and parse configuration data from *f* which must be an iterable " "yielding Unicode strings (for example files opened in text mode)." msgstr "" -#: ../../library/configparser.rst:1125 +#: ../../library/configparser.rst:1138 msgid "" "Optional argument *source* specifies the name of the file being read. If " "not given and *f* has a :attr:`!name` attribute, that is used for *source*; " "the default is ``''``." msgstr "" -#: ../../library/configparser.rst:1129 +#: ../../library/configparser.rst:1142 msgid "Replaces :meth:`!readfp`." msgstr "取代 :meth:`!readfp`。" -#: ../../library/configparser.rst:1134 +#: ../../library/configparser.rst:1147 msgid "Parse configuration data from a string." msgstr "" -#: ../../library/configparser.rst:1136 +#: ../../library/configparser.rst:1149 msgid "" "Optional argument *source* specifies a context-specific name of the string " "passed. If not given, ``''`` is used. This should commonly be a " "filesystem path or a URL." msgstr "" -#: ../../library/configparser.rst:1145 +#: ../../library/configparser.rst:1158 msgid "" "Load configuration from any object that provides a dict-like ``items()`` " "method. Keys are section names, values are dictionaries with keys and " @@ -1560,17 +1625,17 @@ msgid "" "automatically converted to strings." msgstr "" -#: ../../library/configparser.rst:1151 +#: ../../library/configparser.rst:1164 msgid "" "Optional argument *source* specifies a context-specific name of the " "dictionary passed. If not given, ```` is used." msgstr "" -#: ../../library/configparser.rst:1154 +#: ../../library/configparser.rst:1167 msgid "This method can be used to copy state between parsers." msgstr "" -#: ../../library/configparser.rst:1161 +#: ../../library/configparser.rst:1174 msgid "" "Get an *option* value for the named *section*. If *vars* is provided, it " "must be a dictionary. The *option* is looked up in *vars* (if provided), " @@ -1579,35 +1644,35 @@ msgid "" "provided as a *fallback* value." msgstr "" -#: ../../library/configparser.rst:1167 +#: ../../library/configparser.rst:1180 msgid "" "All the ``'%'`` interpolations are expanded in the return values, unless the " "*raw* argument is true. Values for interpolation keys are looked up in the " "same manner as the option." msgstr "" -#: ../../library/configparser.rst:1171 +#: ../../library/configparser.rst:1184 msgid "" "Arguments *raw*, *vars* and *fallback* are keyword only to protect users " "from trying to use the third argument as the *fallback* fallback (especially " "when using the mapping protocol)." msgstr "" -#: ../../library/configparser.rst:1179 +#: ../../library/configparser.rst:1192 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to an integer. See :meth:`get` for explanation of *raw*, *vars* and " "*fallback*." msgstr "" -#: ../../library/configparser.rst:1186 +#: ../../library/configparser.rst:1199 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a floating-point number. See :meth:`get` for explanation of *raw*, " "*vars* and *fallback*." msgstr "" -#: ../../library/configparser.rst:1193 +#: ../../library/configparser.rst:1206 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a Boolean value. Note that the accepted values for the option are " @@ -1619,34 +1684,34 @@ msgid "" "*fallback*." msgstr "" -#: ../../library/configparser.rst:1206 +#: ../../library/configparser.rst:1219 msgid "" "When *section* is not given, return a list of *section_name*, " "*section_proxy* pairs, including DEFAULTSECT." msgstr "" -#: ../../library/configparser.rst:1209 +#: ../../library/configparser.rst:1222 msgid "" "Otherwise, return a list of *name*, *value* pairs for the options in the " "given *section*. Optional arguments have the same meaning as for the :meth:" "`get` method." msgstr "" -#: ../../library/configparser.rst:1213 +#: ../../library/configparser.rst:1226 msgid "" "Items present in *vars* no longer appear in the result. The previous " "behaviour mixed actual parser options with variables provided for " "interpolation." msgstr "" -#: ../../library/configparser.rst:1221 +#: ../../library/configparser.rst:1234 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. *option* and *value* must be " "strings; if not, :exc:`TypeError` is raised." msgstr "" -#: ../../library/configparser.rst:1228 +#: ../../library/configparser.rst:1241 msgid "" "Write a representation of the configuration to the specified :term:`file " "object`, which must be opened in text mode (accepting strings). This " @@ -1655,27 +1720,27 @@ msgid "" "surrounded by spaces." msgstr "" -#: ../../library/configparser.rst:1236 +#: ../../library/configparser.rst:1249 msgid "" "Comments in the original configuration file are not preserved when writing " "the configuration back. What is considered a comment, depends on the given " "values for *comment_prefix* and *inline_comment_prefix*." msgstr "" -#: ../../library/configparser.rst:1244 +#: ../../library/configparser.rst:1257 msgid "" "Remove the specified *option* from the specified *section*. If the section " "does not exist, raise :exc:`NoSectionError`. If the option existed to be " "removed, return :const:`True`; otherwise return :const:`False`." msgstr "" -#: ../../library/configparser.rst:1252 +#: ../../library/configparser.rst:1265 msgid "" "Remove the specified *section* from the configuration. If the section in " "fact existed, return ``True``. Otherwise return ``False``." msgstr "" -#: ../../library/configparser.rst:1258 +#: ../../library/configparser.rst:1271 msgid "" "Transforms the option name *option* as found in an input file or as passed " "in by client code to the form that should be used in the internal " @@ -1684,7 +1749,7 @@ msgid "" "of this name on instances to affect this behavior." msgstr "" -#: ../../library/configparser.rst:1264 +#: ../../library/configparser.rst:1277 msgid "" "You don't need to subclass the parser to use this method, you can also set " "it on an instance, to a function that takes a string argument and returns a " @@ -1692,7 +1757,7 @@ msgid "" "sensitive::" msgstr "" -#: ../../library/configparser.rst:1269 +#: ../../library/configparser.rst:1282 msgid "" "cfgparser = ConfigParser()\n" "cfgparser.optionxform = str" @@ -1700,30 +1765,30 @@ msgstr "" "cfgparser = ConfigParser()\n" "cfgparser.optionxform = str" -#: ../../library/configparser.rst:1272 +#: ../../library/configparser.rst:1285 msgid "" "Note that when reading configuration files, whitespace around the option " "names is stripped before :meth:`optionxform` is called." msgstr "" -#: ../../library/configparser.rst:1278 +#: ../../library/configparser.rst:1291 msgid "" "A special object representing a section name used to reference the unnamed " "section (see :ref:`unnamed-sections`)." msgstr "" -#: ../../library/configparser.rst:1283 +#: ../../library/configparser.rst:1296 msgid "" "The maximum depth for recursive interpolation for :meth:`~configparser." "ConfigParser.get` when the *raw* parameter is false. This is relevant only " "when the default *interpolation* is used." msgstr "" -#: ../../library/configparser.rst:1291 +#: ../../library/configparser.rst:1304 msgid "RawConfigParser Objects" msgstr "RawConfigParser 物件" -#: ../../library/configparser.rst:1301 +#: ../../library/configparser.rst:1315 msgid "" "Legacy variant of the :class:`ConfigParser`. It has interpolation disabled " "by default and allows for non-string section names, option names, and values " @@ -1731,27 +1796,27 @@ msgid "" "``defaults=`` keyword argument handling." msgstr "" -#: ../../library/configparser.rst:1311 +#: ../../library/configparser.rst:1336 msgid "" "Consider using :class:`ConfigParser` instead which checks types of the " "values to be stored internally. If you don't want interpolation, you can " "use ``ConfigParser(interpolation=None)``." msgstr "" -#: ../../library/configparser.rst:1318 +#: ../../library/configparser.rst:1343 msgid "" "Add a section named *section* to the instance. If a section by the given " "name already exists, :exc:`DuplicateSectionError` is raised. If the " "*default section* name is passed, :exc:`ValueError` is raised." msgstr "" -#: ../../library/configparser.rst:1322 +#: ../../library/configparser.rst:1347 msgid "" "Type of *section* is not checked which lets users create non-string named " "sections. This behaviour is unsupported and may cause internal errors." msgstr "" -#: ../../library/configparser.rst:1328 +#: ../../library/configparser.rst:1353 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. While it is possible to use :class:" @@ -1761,7 +1826,7 @@ msgid "" "string values." msgstr "" -#: ../../library/configparser.rst:1335 +#: ../../library/configparser.rst:1360 msgid "" "This method lets users assign non-string values to keys internally. This " "behaviour is unsupported and will cause errors when attempting to write to a " @@ -1769,32 +1834,32 @@ msgid "" "not allow such assignments to take place." msgstr "" -#: ../../library/configparser.rst:1342 +#: ../../library/configparser.rst:1367 msgid "Exceptions" msgstr "例外" -#: ../../library/configparser.rst:1346 +#: ../../library/configparser.rst:1371 msgid "Base class for all other :mod:`configparser` exceptions." msgstr "" -#: ../../library/configparser.rst:1351 +#: ../../library/configparser.rst:1376 msgid "Exception raised when a specified section is not found." msgstr "" -#: ../../library/configparser.rst:1356 +#: ../../library/configparser.rst:1381 msgid "" "Exception raised if :meth:`~ConfigParser.add_section` is called with the " "name of a section that is already present or in strict parsers when a " "section if found more than once in a single input file, string or dictionary." msgstr "" -#: ../../library/configparser.rst:1360 +#: ../../library/configparser.rst:1385 msgid "" "Added the optional *source* and *lineno* attributes and parameters to :meth:" "`!__init__`." msgstr "" -#: ../../library/configparser.rst:1367 +#: ../../library/configparser.rst:1392 msgid "" "Exception raised by strict parsers if a single option appears twice during " "reading from a single file, string or dictionary. This catches misspellings " @@ -1802,64 +1867,64 @@ msgid "" "representing the same case-insensitive configuration key." msgstr "" -#: ../../library/configparser.rst:1375 +#: ../../library/configparser.rst:1400 msgid "" "Exception raised when a specified option is not found in the specified " "section." msgstr "" -#: ../../library/configparser.rst:1381 +#: ../../library/configparser.rst:1406 msgid "" "Base class for exceptions raised when problems occur performing string " "interpolation." msgstr "" -#: ../../library/configparser.rst:1387 +#: ../../library/configparser.rst:1412 msgid "" "Exception raised when string interpolation cannot be completed because the " "number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass of :" "exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1394 +#: ../../library/configparser.rst:1419 msgid "" "Exception raised when an option referenced from a value does not exist. " "Subclass of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1400 +#: ../../library/configparser.rst:1425 msgid "" "Exception raised when the source text into which substitutions are made does " "not conform to the required syntax. Subclass of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1406 +#: ../../library/configparser.rst:1431 msgid "" "Exception raised when attempting to parse a file which has no section " "headers." msgstr "" -#: ../../library/configparser.rst:1412 +#: ../../library/configparser.rst:1437 msgid "Exception raised when errors occur attempting to parse a file." msgstr "" -#: ../../library/configparser.rst:1414 +#: ../../library/configparser.rst:1439 msgid "" "The ``filename`` attribute and :meth:`!__init__` constructor argument were " "removed. They have been available using the name ``source`` since 3.2." msgstr "" -#: ../../library/configparser.rst:1420 +#: ../../library/configparser.rst:1445 msgid "" "Exception raised when a key without a corresponding value is continued with " "an indented line." msgstr "" -#: ../../library/configparser.rst:1426 +#: ../../library/configparser.rst:1451 msgid "Footnotes" msgstr "註解" -#: ../../library/configparser.rst:1427 +#: ../../library/configparser.rst:1452 msgid "" "Config parsers allow for heavy customization. If you are interested in " "changing the behaviour outlined by the footnote reference, consult the " diff --git a/library/contextvars.po b/library/contextvars.po index 8f8fe6b9cd..b229a722fe 100644 --- a/library/contextvars.po +++ b/library/contextvars.po @@ -1,11 +1,10 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 23:08+0000\n" +"POT-Creation-Date: 2024-10-31 00:13+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -73,7 +72,7 @@ msgstr "" #: ../../library/contextvars.rst:49 msgid "The name of the variable. This is a read-only property." -msgstr "" +msgstr "這個變數的名稱。這是一個唯讀屬性。" #: ../../library/contextvars.rst:55 msgid "Return a value for the context variable for the current context." @@ -98,7 +97,7 @@ msgstr "" #: ../../library/contextvars.rst:66 msgid "raise a :exc:`LookupError`." -msgstr "" +msgstr "引發一個 :exc:`LookupError`。" #: ../../library/contextvars.rst:70 msgid "" @@ -203,45 +202,90 @@ msgstr "" #: ../../library/contextvars.rst:147 msgid "" -"Every thread will have a different top-level :class:`~contextvars.Context` " -"object. This means that a :class:`ContextVar` object behaves in a similar " -"fashion to :func:`threading.local` when values are assigned in different " -"threads." +"Each thread has its own effective stack of :class:`!Context` objects. The :" +"term:`current context` is the :class:`!Context` object at the top of the " +"current thread's stack. All :class:`!Context` objects in the stacks are " +"considered to be *entered*." msgstr "" #: ../../library/contextvars.rst:152 -msgid "Context implements the :class:`collections.abc.Mapping` interface." +msgid "" +"*Entering* a context, which can be done by calling its :meth:`~Context.run` " +"method, makes the context the current context by pushing it onto the top of " +"the current thread's context stack." msgstr "" #: ../../library/contextvars.rst:156 msgid "" -"Execute ``callable(*args, **kwargs)`` code in the context object the *run* " -"method is called on. Return the result of the execution or propagate an " -"exception if one occurred." +"*Exiting* from the current context, which can be done by returning from the " +"callback passed to the :meth:`~Context.run` method, restores the current " +"context to what it was before the context was entered by popping the context " +"off the top of the context stack." msgstr "" -#: ../../library/contextvars.rst:160 +#: ../../library/contextvars.rst:161 msgid "" -"Any changes to any context variables that *callable* makes will be contained " -"in the context object::" +"Since each thread has its own context stack, :class:`ContextVar` objects " +"behave in a similar fashion to :func:`threading.local` when values are " +"assigned in different threads." msgstr "" -#: ../../library/contextvars.rst:163 +#: ../../library/contextvars.rst:165 msgid "" -"var = ContextVar('var')\n" +"Attempting to enter an already entered context, including contexts entered " +"in other threads, raises a :exc:`RuntimeError`." +msgstr "" + +#: ../../library/contextvars.rst:168 +msgid "After exiting a context, it can later be re-entered (from any thread)." +msgstr "" + +#: ../../library/contextvars.rst:170 +msgid "" +"Any changes to :class:`ContextVar` values via the :meth:`ContextVar.set` " +"method are recorded in the current context. The :meth:`ContextVar.get` " +"method returns the value associated with the current context. Exiting a " +"context effectively reverts any changes made to context variables while the " +"context was entered (if needed, the values can be restored by re-entering " +"the context)." +msgstr "" + +#: ../../library/contextvars.rst:177 +msgid "Context implements the :class:`collections.abc.Mapping` interface." +msgstr "" + +#: ../../library/contextvars.rst:181 +msgid "" +"Enters the Context, executes ``callable(*args, **kwargs)``, then exits the " +"Context. Returns *callable*'s return value, or propagates an exception if " +"one occurred." +msgstr "" + +#: ../../library/contextvars.rst:185 +msgid "Example:" +msgstr "舉例來說:" + +#: ../../library/contextvars.rst:187 +msgid "" +"import contextvars\n" +"\n" +"var = contextvars.ContextVar('var')\n" "var.set('spam')\n" +"print(var.get()) # 'spam'\n" +"\n" +"ctx = contextvars.copy_context()\n" "\n" "def main():\n" " # 'var' was set to 'spam' before\n" " # calling 'copy_context()' and 'ctx.run(main)', so:\n" -" # var.get() == ctx[var] == 'spam'\n" +" print(var.get()) # 'spam'\n" +" print(ctx[var]) # 'spam'\n" "\n" " var.set('ham')\n" "\n" " # Now, after setting 'var' to 'ham':\n" -" # var.get() == ctx[var] == 'ham'\n" -"\n" -"ctx = copy_context()\n" +" print(var.get()) # 'ham'\n" +" print(ctx[var]) # 'ham'\n" "\n" "# Any changes that the 'main' function makes to 'var'\n" "# will be contained in 'ctx'.\n" @@ -249,67 +293,61 @@ msgid "" "\n" "# The 'main()' function was run in the 'ctx' context,\n" "# so changes to 'var' are contained in it:\n" -"# ctx[var] == 'ham'\n" +"print(ctx[var]) # 'ham'\n" "\n" "# However, outside of 'ctx', 'var' is still set to 'spam':\n" -"# var.get() == 'spam'" +"print(var.get()) # 'spam'" msgstr "" -#: ../../library/contextvars.rst:189 -msgid "" -"The method raises a :exc:`RuntimeError` when called on the same context " -"object from more than one OS thread, or when called recursively." -msgstr "" - -#: ../../library/contextvars.rst:195 +#: ../../library/contextvars.rst:233 msgid "Return a shallow copy of the context object." msgstr "" -#: ../../library/contextvars.rst:199 +#: ../../library/contextvars.rst:237 msgid "" "Return ``True`` if the *context* has a value for *var* set; return ``False`` " "otherwise." msgstr "" -#: ../../library/contextvars.rst:204 +#: ../../library/contextvars.rst:242 msgid "" "Return the value of the *var* :class:`ContextVar` variable. If the variable " "is not set in the context object, a :exc:`KeyError` is raised." msgstr "" -#: ../../library/contextvars.rst:210 +#: ../../library/contextvars.rst:248 msgid "" "Return the value for *var* if *var* has the value in the context object. " "Return *default* otherwise. If *default* is not given, return ``None``." msgstr "" -#: ../../library/contextvars.rst:216 +#: ../../library/contextvars.rst:254 msgid "Return an iterator over the variables stored in the context object." msgstr "" -#: ../../library/contextvars.rst:221 +#: ../../library/contextvars.rst:259 msgid "Return the number of variables set in the context object." msgstr "" -#: ../../library/contextvars.rst:225 +#: ../../library/contextvars.rst:263 msgid "Return a list of all variables in the context object." msgstr "" -#: ../../library/contextvars.rst:229 +#: ../../library/contextvars.rst:267 msgid "Return a list of all variables' values in the context object." msgstr "" -#: ../../library/contextvars.rst:234 +#: ../../library/contextvars.rst:272 msgid "" "Return a list of 2-tuples containing all variables and their values in the " "context object." msgstr "" -#: ../../library/contextvars.rst:239 +#: ../../library/contextvars.rst:277 msgid "asyncio support" -msgstr "" +msgstr "對 asyncio 的支援" -#: ../../library/contextvars.rst:241 +#: ../../library/contextvars.rst:279 msgid "" "Context variables are natively supported in :mod:`asyncio` and are ready to " "be used without any extra configuration. For example, here is a simple echo " @@ -317,7 +355,7 @@ msgid "" "available in the Task that handles that client::" msgstr "" -#: ../../library/contextvars.rst:247 +#: ../../library/contextvars.rst:285 msgid "" "import asyncio\n" "import contextvars\n" diff --git a/library/ctypes.po b/library/ctypes.po index 0fb1ee514b..1ecac422b6 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-09 00:13+0000\n" +"POT-Creation-Date: 2024-10-29 00:13+0000\n" "PO-Revision-Date: 2023-04-26 02:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -376,7 +376,7 @@ msgid "" "learn more about :mod:`ctypes` data types." msgstr "" -#: ../../library/ctypes.rst:212 ../../library/ctypes.rst:2203 +#: ../../library/ctypes.rst:212 ../../library/ctypes.rst:2213 msgid "Fundamental data types" msgstr "" @@ -740,7 +740,6 @@ msgid "" msgstr "" #: ../../library/ctypes.rst:351 -#, fuzzy msgid "" ">>> printf = libc.printf\n" ">>> printf(b\"Hello, %s\\n\", b\"World!\")\n" @@ -772,7 +771,8 @@ msgstr "" ">>> printf(b\"%f bottles of beer\\n\", 42.5)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -"ArgumentError: argument 2: TypeError: Don't know how to convert parameter 2\n" +"ctypes.ArgumentError: argument 2: TypeError: Don't know how to convert " +"parameter 2\n" ">>>" #: ../../library/ctypes.rst:367 @@ -809,7 +809,7 @@ msgstr "" #: ../../library/ctypes.rst:386 msgid "" -"On those platforms it is required to specify the :attr:`~_FuncPtr.argtypes` " +"On those platforms it is required to specify the :attr:`~_CFuncPtr.argtypes` " "attribute for the regular, non-variadic, function arguments:" msgstr "" @@ -820,7 +820,7 @@ msgstr "libc.printf.argtypes = [ctypes.c_char_p]" #: ../../library/ctypes.rst:393 msgid "" "Because specifying the attribute does not inhibit portability it is advised " -"to always specify :attr:`~_FuncPtr.argtypes` for all variadic functions." +"to always specify :attr:`~_CFuncPtr.argtypes` for all variadic functions." msgstr "" #: ../../library/ctypes.rst:400 @@ -872,12 +872,12 @@ msgstr "" #: ../../library/ctypes.rst:428 msgid "" "It is possible to specify the required argument types of functions exported " -"from DLLs by setting the :attr:`~_FuncPtr.argtypes` attribute." +"from DLLs by setting the :attr:`~_CFuncPtr.argtypes` attribute." msgstr "" #: ../../library/ctypes.rst:431 msgid "" -":attr:`~_FuncPtr.argtypes` must be a sequence of C data types (the :func:`!" +":attr:`~_CFuncPtr.argtypes` must be a sequence of C data types (the :func:`!" "printf` function is probably not a good example here, because it takes a " "variable number and different types of parameters depending on the format " "string, on the other hand this is quite handy to experiment with this " @@ -906,7 +906,6 @@ msgid "" msgstr "" #: ../../library/ctypes.rst:445 -#, fuzzy msgid "" ">>> printf(b\"%d %d %d\", 1, 2, 3)\n" "Traceback (most recent call last):\n" @@ -921,7 +920,8 @@ msgstr "" ">>> printf(b\"%d %d %d\", 1, 2, 3)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -"ArgumentError: argument 2: TypeError: wrong type\n" +"ctypes.ArgumentError: argument 2: TypeError: 'int' object cannot be " +"interpreted as ctypes.c_char_p\n" ">>> printf(b\"%s %d %f\\n\", b\"X\", 2, 3)\n" "X 2 3.000000\n" "13\n" @@ -931,7 +931,7 @@ msgstr "" msgid "" "If you have defined your own classes which you pass to function calls, you " "have to implement a :meth:`~_CData.from_param` class method for them to be " -"able to use them in the :attr:`~_FuncPtr.argtypes` sequence. The :meth:" +"able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. The :meth:" "`~_CData.from_param` class method receives the Python object passed to the " "function call, it should do a typecheck or whatever is needed to make sure " "this object is acceptable, and then return the object itself, its :attr:`!" @@ -948,7 +948,7 @@ msgstr "" #: ../../library/ctypes.rst:478 msgid "" "By default functions are assumed to return the C :c:expr:`int` type. Other " -"return types can be specified by setting the :attr:`~_FuncPtr.restype` " +"return types can be specified by setting the :attr:`~_CFuncPtr.restype` " "attribute of the function object." msgstr "" @@ -964,7 +964,7 @@ msgid ">>> libc.time.restype = c_time_t" msgstr ">>> libc.time.restype = c_time_t" #: ../../library/ctypes.rst:488 -msgid "The argument types can be specified using :attr:`~_FuncPtr.argtypes`::" +msgid "The argument types can be specified using :attr:`~_CFuncPtr.argtypes`::" msgstr "" #: ../../library/ctypes.rst:490 @@ -1016,7 +1016,7 @@ msgstr "" #: ../../library/ctypes.rst:510 msgid "" "If you want to avoid the :func:`ord(\"x\") ` calls above, you can set " -"the :attr:`~_FuncPtr.argtypes` attribute, and the second argument will be " +"the :attr:`~_CFuncPtr.argtypes` attribute, and the second argument will be " "converted from a single character Python bytes object into a C char:" msgstr "" @@ -1053,11 +1053,11 @@ msgstr "" #: ../../library/ctypes.rst:529 msgid "" "You can also use a callable Python object (a function or a class for " -"example) as the :attr:`~_FuncPtr.restype` attribute, if the foreign function " -"returns an integer. The callable will be called with the *integer* the C " -"function returns, and the result of this call will be used as the result of " -"your function call. This is useful to check for error return values and " -"automatically raise an exception::" +"example) as the :attr:`~_CFuncPtr.restype` attribute, if the foreign " +"function returns an integer. The callable will be called with the *integer* " +"the C function returns, and the result of this call will be used as the " +"result of your function call. This is useful to check for error return " +"values and automatically raise an exception::" msgstr "" #: ../../library/ctypes.rst:535 @@ -1107,7 +1107,7 @@ msgstr "" #: ../../library/ctypes.rst:557 msgid "" "Please note that a much more powerful error checking mechanism is available " -"through the :attr:`~_FuncPtr.errcheck` attribute; see the reference manual " +"through the :attr:`~_CFuncPtr.errcheck` attribute; see the reference manual " "for details." msgstr "" @@ -1665,7 +1665,7 @@ msgstr "" #: ../../library/ctypes.rst:861 msgid "" "Usually, ctypes does strict type checking. This means, if you have " -"``POINTER(c_int)`` in the :attr:`~_FuncPtr.argtypes` list of a function or " +"``POINTER(c_int)`` in the :attr:`~_CFuncPtr.argtypes` list of a function or " "as the type of a member field in a structure definition, only instances of " "exactly the same type are accepted. There are some exceptions to this rule, " "where ctypes accepts other objects. For example, you can pass compatible " @@ -1706,7 +1706,7 @@ msgstr "" #: ../../library/ctypes.rst:882 msgid "" "In addition, if a function argument is explicitly declared to be a pointer " -"type (such as ``POINTER(c_int)``) in :attr:`~_FuncPtr.argtypes`, an object " +"type (such as ``POINTER(c_int)``) in :attr:`~_CFuncPtr.argtypes`, an object " "of the pointed type (``c_int`` in this case) can be passed to the function. " "ctypes will apply the required :func:`byref` conversion in this case " "automatically." @@ -2497,7 +2497,7 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:1316 ../../library/ctypes.rst:1977 +#: ../../library/ctypes.rst:1316 ../../library/ctypes.rst:1987 msgid "The exact functionality is system dependent." msgstr "" @@ -2875,32 +2875,48 @@ msgid "" "attributes of loaded shared libraries. The function objects created in this " "way by default accept any number of arguments, accept any ctypes data " "instances as arguments, and return the default result type specified by the " -"library loader. They are instances of a private class:" +"library loader." +msgstr "" + +#: ../../library/ctypes.rst:1613 +msgid "" +"They are instances of a private local class :class:`!_FuncPtr` (not exposed " +"in :mod:`!ctypes`) which inherits from the private :class:`_CFuncPtr` class:" +msgstr "" + +#: ../../library/ctypes.rst:1616 +msgid "" +">>> import ctypes\n" +">>> lib = ctypes.CDLL(None)\n" +">>> issubclass(lib._FuncPtr, ctypes._CFuncPtr)\n" +"True\n" +">>> lib._FuncPtr is ctypes._CFuncPtr\n" +"False" msgstr "" -#: ../../library/ctypes.rst:1617 +#: ../../library/ctypes.rst:1627 msgid "Base class for C callable foreign functions." msgstr "" -#: ../../library/ctypes.rst:1619 +#: ../../library/ctypes.rst:1629 msgid "" "Instances of foreign functions are also C compatible data types; they " "represent C function pointers." msgstr "" -#: ../../library/ctypes.rst:1622 +#: ../../library/ctypes.rst:1632 msgid "" "This behavior can be customized by assigning to special attributes of the " "foreign function object." msgstr "" -#: ../../library/ctypes.rst:1627 +#: ../../library/ctypes.rst:1637 msgid "" "Assign a ctypes type to specify the result type of the foreign function. Use " "``None`` for :c:expr:`void`, a function not returning anything." msgstr "" -#: ../../library/ctypes.rst:1630 +#: ../../library/ctypes.rst:1640 msgid "" "It is possible to assign a callable Python object that is not a ctypes type, " "in this case the function is assumed to return a C :c:expr:`int`, and the " @@ -2910,7 +2926,7 @@ msgid "" "callable to the :attr:`errcheck` attribute." msgstr "" -#: ../../library/ctypes.rst:1639 +#: ../../library/ctypes.rst:1649 msgid "" "Assign a tuple of ctypes types to specify the argument types that the " "function accepts. Functions using the ``stdcall`` calling convention can " @@ -2919,7 +2935,7 @@ msgid "" "unspecified arguments as well." msgstr "" -#: ../../library/ctypes.rst:1645 +#: ../../library/ctypes.rst:1655 msgid "" "When a foreign function is called, each actual argument is passed to the :" "meth:`~_CData.from_param` class method of the items in the :attr:`argtypes` " @@ -2929,7 +2945,7 @@ msgid "" "object using ctypes conversion rules." msgstr "" -#: ../../library/ctypes.rst:1652 +#: ../../library/ctypes.rst:1662 msgid "" "New: It is now possible to put items in argtypes which are not ctypes types, " "but each item must have a :meth:`~_CData.from_param` method which returns a " @@ -2937,44 +2953,44 @@ msgid "" "defining adapters that can adapt custom objects as function parameters." msgstr "" -#: ../../library/ctypes.rst:1659 +#: ../../library/ctypes.rst:1669 msgid "" "Assign a Python function or another callable to this attribute. The callable " "will be called with three or more arguments:" msgstr "" -#: ../../library/ctypes.rst:1666 +#: ../../library/ctypes.rst:1676 msgid "" "*result* is what the foreign function returns, as specified by the :attr:`!" "restype` attribute." msgstr "" -#: ../../library/ctypes.rst:1669 +#: ../../library/ctypes.rst:1679 msgid "" "*func* is the foreign function object itself, this allows reusing the same " "callable object to check or post process the results of several functions." msgstr "" -#: ../../library/ctypes.rst:1673 +#: ../../library/ctypes.rst:1683 msgid "" "*arguments* is a tuple containing the parameters originally passed to the " "function call, this allows specializing the behavior on the arguments used." msgstr "" -#: ../../library/ctypes.rst:1677 +#: ../../library/ctypes.rst:1687 msgid "" "The object that this function returns will be returned from the foreign " "function call, but it can also check the result value and raise an exception " "if the foreign function call failed." msgstr "" -#: ../../library/ctypes.rst:1684 +#: ../../library/ctypes.rst:1694 msgid "" "This exception is raised when a foreign function call cannot convert one of " "the passed arguments." msgstr "" -#: ../../library/ctypes.rst:1688 ../../library/ctypes.rst:1690 +#: ../../library/ctypes.rst:1698 ../../library/ctypes.rst:1700 msgid "" "On Windows, when a foreign function call raises a system exception (for " "example, due to an access violation), it will be captured and replaced with " @@ -2983,18 +2999,18 @@ msgid "" "hook to replace the exception with its own." msgstr "" -#: ../../library/ctypes.rst:1696 ../../library/ctypes.rst:1698 +#: ../../library/ctypes.rst:1706 ../../library/ctypes.rst:1708 msgid "" "Some ways to invoke foreign function calls may raise an auditing event " "``ctypes.call_function`` with arguments ``function pointer`` and " "``arguments``." msgstr "" -#: ../../library/ctypes.rst:1704 +#: ../../library/ctypes.rst:1714 msgid "Function prototypes" msgstr "" -#: ../../library/ctypes.rst:1706 +#: ../../library/ctypes.rst:1716 msgid "" "Foreign functions can also be created by instantiating function prototypes. " "Function prototypes are similar to function prototypes in C; they describe a " @@ -3005,7 +3021,7 @@ msgid "" "``@wrapper`` syntax. See :ref:`ctypes-callback-functions` for examples." msgstr "" -#: ../../library/ctypes.rst:1717 +#: ../../library/ctypes.rst:1727 msgid "" "The returned function prototype creates functions that use the standard C " "calling convention. The function will release the GIL during the call. If " @@ -3014,37 +3030,37 @@ msgid "" "after the call; *use_last_error* does the same for the Windows error code." msgstr "" -#: ../../library/ctypes.rst:1727 +#: ../../library/ctypes.rst:1737 msgid "" "Windows only: The returned function prototype creates functions that use the " "``stdcall`` calling convention. The function will release the GIL during " "the call. *use_errno* and *use_last_error* have the same meaning as above." msgstr "" -#: ../../library/ctypes.rst:1735 +#: ../../library/ctypes.rst:1745 msgid "" "The returned function prototype creates functions that use the Python " "calling convention. The function will *not* release the GIL during the call." msgstr "" -#: ../../library/ctypes.rst:1738 +#: ../../library/ctypes.rst:1748 msgid "" "Function prototypes created by these factory functions can be instantiated " "in different ways, depending on the type and number of the parameters in the " "call:" msgstr "" -#: ../../library/ctypes.rst:1745 +#: ../../library/ctypes.rst:1755 msgid "" "Returns a foreign function at the specified address which must be an integer." msgstr "" -#: ../../library/ctypes.rst:1752 +#: ../../library/ctypes.rst:1762 msgid "" "Create a C callable function (a callback function) from a Python *callable*." msgstr "" -#: ../../library/ctypes.rst:1759 +#: ../../library/ctypes.rst:1769 msgid "" "Returns a foreign function exported by a shared library. *func_spec* must be " "a 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the " @@ -3052,7 +3068,7 @@ msgid "" "small integer. The second item is the shared library instance." msgstr "" -#: ../../library/ctypes.rst:1769 +#: ../../library/ctypes.rst:1779 msgid "" "Returns a foreign function that will call a COM method. *vtbl_index* is the " "index into the virtual function table, a small non-negative integer. *name* " @@ -3060,79 +3076,79 @@ msgid "" "identifier which is used in extended error reporting." msgstr "" -#: ../../library/ctypes.rst:1774 +#: ../../library/ctypes.rst:1784 msgid "" "COM methods use a special calling convention: They require a pointer to the " "COM interface as first argument, in addition to those parameters that are " "specified in the :attr:`!argtypes` tuple." msgstr "" -#: ../../library/ctypes.rst:1778 +#: ../../library/ctypes.rst:1788 msgid "" "The optional *paramflags* parameter creates foreign function wrappers with " "much more functionality than the features described above." msgstr "" -#: ../../library/ctypes.rst:1781 +#: ../../library/ctypes.rst:1791 msgid "" -"*paramflags* must be a tuple of the same length as :attr:`~_FuncPtr." +"*paramflags* must be a tuple of the same length as :attr:`~_CFuncPtr." "argtypes`." msgstr "" -#: ../../library/ctypes.rst:1783 +#: ../../library/ctypes.rst:1793 msgid "" "Each item in this tuple contains further information about a parameter, it " "must be a tuple containing one, two, or three items." msgstr "" -#: ../../library/ctypes.rst:1786 +#: ../../library/ctypes.rst:1796 msgid "" "The first item is an integer containing a combination of direction flags for " "the parameter:" msgstr "" -#: ../../library/ctypes.rst:1789 +#: ../../library/ctypes.rst:1799 msgid "1" msgstr "1" -#: ../../library/ctypes.rst:1790 +#: ../../library/ctypes.rst:1800 msgid "Specifies an input parameter to the function." msgstr "" -#: ../../library/ctypes.rst:1792 +#: ../../library/ctypes.rst:1802 msgid "2" msgstr "2" -#: ../../library/ctypes.rst:1793 +#: ../../library/ctypes.rst:1803 msgid "Output parameter. The foreign function fills in a value." msgstr "" -#: ../../library/ctypes.rst:1795 +#: ../../library/ctypes.rst:1805 msgid "4" msgstr "4" -#: ../../library/ctypes.rst:1796 +#: ../../library/ctypes.rst:1806 msgid "Input parameter which defaults to the integer zero." msgstr "" -#: ../../library/ctypes.rst:1798 +#: ../../library/ctypes.rst:1808 msgid "" "The optional second item is the parameter name as string. If this is " "specified, the foreign function can be called with named parameters." msgstr "" -#: ../../library/ctypes.rst:1801 +#: ../../library/ctypes.rst:1811 msgid "The optional third item is the default value for this parameter." msgstr "" -#: ../../library/ctypes.rst:1804 +#: ../../library/ctypes.rst:1814 msgid "" "The following example demonstrates how to wrap the Windows ``MessageBoxW`` " "function so that it supports default parameters and named arguments. The C " "declaration from the windows header file is this::" msgstr "" -#: ../../library/ctypes.rst:1808 +#: ../../library/ctypes.rst:1818 msgid "" "WINUSERAPI int WINAPI\n" "MessageBoxW(\n" @@ -3148,11 +3164,11 @@ msgstr "" " LPCWSTR lpCaption,\n" " UINT uType);" -#: ../../library/ctypes.rst:1815 ../../library/ctypes.rst:1838 +#: ../../library/ctypes.rst:1825 ../../library/ctypes.rst:1848 msgid "Here is the wrapping with :mod:`ctypes`::" msgstr "" -#: ../../library/ctypes.rst:1817 +#: ../../library/ctypes.rst:1827 msgid "" ">>> from ctypes import c_int, WINFUNCTYPE, windll\n" ">>> from ctypes.wintypes import HWND, LPCWSTR, UINT\n" @@ -3168,11 +3184,11 @@ msgstr "" "\"Hello from ctypes\"), (1, \"flags\", 0)\n" ">>> MessageBox = prototype((\"MessageBoxW\", windll.user32), paramflags)" -#: ../../library/ctypes.rst:1823 +#: ../../library/ctypes.rst:1833 msgid "The ``MessageBox`` foreign function can now be called in these ways::" msgstr "" -#: ../../library/ctypes.rst:1825 +#: ../../library/ctypes.rst:1835 msgid "" ">>> MessageBox()\n" ">>> MessageBox(text=\"Spam, spam, spam\")\n" @@ -3182,7 +3198,7 @@ msgstr "" ">>> MessageBox(text=\"Spam, spam, spam\")\n" ">>> MessageBox(flags=2, text=\"foo bar\")" -#: ../../library/ctypes.rst:1829 +#: ../../library/ctypes.rst:1839 msgid "" "A second example demonstrates output parameters. The win32 " "``GetWindowRect`` function retrieves the dimensions of a specified window by " @@ -3190,7 +3206,7 @@ msgid "" "the C declaration::" msgstr "" -#: ../../library/ctypes.rst:1833 +#: ../../library/ctypes.rst:1843 msgid "" "WINUSERAPI BOOL WINAPI\n" "GetWindowRect(\n" @@ -3202,7 +3218,7 @@ msgstr "" " HWND hWnd,\n" " LPRECT lpRect);" -#: ../../library/ctypes.rst:1840 +#: ../../library/ctypes.rst:1850 msgid "" ">>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError\n" ">>> from ctypes.wintypes import BOOL, HWND, RECT\n" @@ -3220,7 +3236,7 @@ msgstr "" "paramflags)\n" ">>>" -#: ../../library/ctypes.rst:1847 +#: ../../library/ctypes.rst:1857 msgid "" "Functions with output parameters will automatically return the output " "parameter value if there is a single one, or a tuple containing the output " @@ -3228,16 +3244,16 @@ msgid "" "now returns a RECT instance, when called." msgstr "" -#: ../../library/ctypes.rst:1852 +#: ../../library/ctypes.rst:1862 msgid "" -"Output parameters can be combined with the :attr:`~_FuncPtr.errcheck` " +"Output parameters can be combined with the :attr:`~_CFuncPtr.errcheck` " "protocol to do further output processing and error checking. The win32 " "``GetWindowRect`` api function returns a ``BOOL`` to signal success or " "failure, so this function could do the error checking, and raises an " "exception when the api call failed::" msgstr "" -#: ../../library/ctypes.rst:1857 +#: ../../library/ctypes.rst:1867 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3255,16 +3271,16 @@ msgstr "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" -#: ../../library/ctypes.rst:1865 +#: ../../library/ctypes.rst:1875 msgid "" -"If the :attr:`~_FuncPtr.errcheck` function returns the argument tuple it " +"If the :attr:`~_CFuncPtr.errcheck` function returns the argument tuple it " "receives unchanged, :mod:`ctypes` continues the normal processing it does on " "the output parameters. If you want to return a tuple of window coordinates " "instead of a ``RECT`` instance, you can retrieve the fields in the function " "and return them instead, the normal processing will no longer take place::" msgstr "" -#: ../../library/ctypes.rst:1871 +#: ../../library/ctypes.rst:1881 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3284,17 +3300,17 @@ msgstr "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" -#: ../../library/ctypes.rst:1884 +#: ../../library/ctypes.rst:1894 msgid "Utility functions" msgstr "" -#: ../../library/ctypes.rst:1888 +#: ../../library/ctypes.rst:1898 msgid "" "Returns the address of the memory buffer as integer. *obj* must be an " "instance of a ctypes type." msgstr "" -#: ../../library/ctypes.rst:1891 +#: ../../library/ctypes.rst:1901 msgid "" "Raises an :ref:`auditing event ` ``ctypes.addressof`` with " "argument ``obj``." @@ -3302,34 +3318,34 @@ msgstr "" "引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` ``ctypes." "addressof``。" -#: ../../library/ctypes.rst:1896 +#: ../../library/ctypes.rst:1906 msgid "" "Returns the alignment requirements of a ctypes type. *obj_or_type* must be a " "ctypes type or instance." msgstr "" -#: ../../library/ctypes.rst:1902 +#: ../../library/ctypes.rst:1912 msgid "" "Returns a light-weight pointer to *obj*, which must be an instance of a " "ctypes type. *offset* defaults to zero, and must be an integer that will be " "added to the internal pointer value." msgstr "" -#: ../../library/ctypes.rst:1906 +#: ../../library/ctypes.rst:1916 msgid "``byref(obj, offset)`` corresponds to this C code::" msgstr "" -#: ../../library/ctypes.rst:1908 +#: ../../library/ctypes.rst:1918 msgid "(((char *)&obj) + offset)" msgstr "(((char *)&obj) + offset)" -#: ../../library/ctypes.rst:1910 +#: ../../library/ctypes.rst:1920 msgid "" "The returned object can only be used as a foreign function call parameter. " "It behaves similar to ``pointer(obj)``, but the construction is a lot faster." msgstr "" -#: ../../library/ctypes.rst:1916 +#: ../../library/ctypes.rst:1926 msgid "" "This function is similar to the cast operator in C. It returns a new " "instance of *type* which points to the same memory block as *obj*. *type* " @@ -3337,19 +3353,19 @@ msgid "" "as a pointer." msgstr "" -#: ../../library/ctypes.rst:1924 +#: ../../library/ctypes.rst:1934 msgid "" "This function creates a mutable character buffer. The returned object is a " "ctypes array of :class:`c_char`." msgstr "" -#: ../../library/ctypes.rst:1927 +#: ../../library/ctypes.rst:1937 msgid "" "*init_or_size* must be an integer which specifies the size of the array, or " "a bytes object which will be used to initialize the array items." msgstr "" -#: ../../library/ctypes.rst:1930 +#: ../../library/ctypes.rst:1940 msgid "" "If a bytes object is specified as first argument, the buffer is made one " "item larger than its length so that the last element in the array is a NUL " @@ -3358,7 +3374,7 @@ msgid "" "not be used." msgstr "" -#: ../../library/ctypes.rst:1935 +#: ../../library/ctypes.rst:1945 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_string_buffer`` " "with arguments ``init``, ``size``." @@ -3366,19 +3382,19 @@ msgstr "" "引發一個附帶引數 ``init`` 與 ``size`` 的\\ :ref:`稽核事件 ` " "``ctypes.create_string_buffer``。" -#: ../../library/ctypes.rst:1940 +#: ../../library/ctypes.rst:1950 msgid "" "This function creates a mutable unicode character buffer. The returned " "object is a ctypes array of :class:`c_wchar`." msgstr "" -#: ../../library/ctypes.rst:1943 +#: ../../library/ctypes.rst:1953 msgid "" "*init_or_size* must be an integer which specifies the size of the array, or " "a string which will be used to initialize the array items." msgstr "" -#: ../../library/ctypes.rst:1946 +#: ../../library/ctypes.rst:1956 msgid "" "If a string is specified as first argument, the buffer is made one item " "larger than the length of the string so that the last element in the array " @@ -3387,7 +3403,7 @@ msgid "" "should not be used." msgstr "" -#: ../../library/ctypes.rst:1952 +#: ../../library/ctypes.rst:1962 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_unicode_buffer`` " "with arguments ``init``, ``size``." @@ -3395,21 +3411,21 @@ msgstr "" "引發一個附帶引數 ``init`` 與 ``size`` 的\\ :ref:`稽核事件 ` " "``ctypes.create_unicode_buffer``。" -#: ../../library/ctypes.rst:1957 +#: ../../library/ctypes.rst:1967 msgid "" "Windows only: This function is a hook which allows implementing in-process " "COM servers with ctypes. It is called from the DllCanUnloadNow function " "that the _ctypes extension dll exports." msgstr "" -#: ../../library/ctypes.rst:1964 +#: ../../library/ctypes.rst:1974 msgid "" "Windows only: This function is a hook which allows implementing in-process " "COM servers with ctypes. It is called from the DllGetClassObject function " "that the ``_ctypes`` extension dll exports." msgstr "" -#: ../../library/ctypes.rst:1972 +#: ../../library/ctypes.rst:1982 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like ``lib``, suffix like ``.so``, ``.dylib`` or version " @@ -3417,94 +3433,94 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:1983 +#: ../../library/ctypes.rst:1993 msgid "" "Windows only: return the filename of the VC runtime library used by Python, " "and by the extension modules. If the name of the library cannot be " "determined, ``None`` is returned." msgstr "" -#: ../../library/ctypes.rst:1987 +#: ../../library/ctypes.rst:1997 msgid "" "If you need to free memory, for example, allocated by an extension module " "with a call to the ``free(void *)``, it is important that you use the " "function in the same library that allocated the memory." msgstr "" -#: ../../library/ctypes.rst:1994 +#: ../../library/ctypes.rst:2004 msgid "" "Windows only: Returns a textual description of the error code *code*. If no " "error code is specified, the last error code is used by calling the Windows " "api function GetLastError." msgstr "" -#: ../../library/ctypes.rst:2001 +#: ../../library/ctypes.rst:2011 msgid "" "Windows only: Returns the last error code set by Windows in the calling " "thread. This function calls the Windows ``GetLastError()`` function " "directly, it does not return the ctypes-private copy of the error code." msgstr "" -#: ../../library/ctypes.rst:2007 +#: ../../library/ctypes.rst:2017 msgid "" "Returns the current value of the ctypes-private copy of the system :data:" "`errno` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:2010 +#: ../../library/ctypes.rst:2020 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_errno`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``ctypes.get_errno``。" -#: ../../library/ctypes.rst:2014 +#: ../../library/ctypes.rst:2024 msgid "" "Windows only: returns the current value of the ctypes-private copy of the " "system :data:`!LastError` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:2017 +#: ../../library/ctypes.rst:2027 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_last_error`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``ctypes.get_last_error``。" -#: ../../library/ctypes.rst:2021 +#: ../../library/ctypes.rst:2031 msgid "" "Same as the standard C memmove library function: copies *count* bytes from " "*src* to *dst*. *dst* and *src* must be integers or ctypes instances that " "can be converted to pointers." msgstr "" -#: ../../library/ctypes.rst:2028 +#: ../../library/ctypes.rst:2038 msgid "" "Same as the standard C memset library function: fills the memory block at " "address *dst* with *count* bytes of value *c*. *dst* must be an integer " "specifying an address, or a ctypes instance." msgstr "" -#: ../../library/ctypes.rst:2035 +#: ../../library/ctypes.rst:2045 msgid "" "Create and return a new ctypes pointer type. Pointer types are cached and " "reused internally, so calling this function repeatedly is cheap. *type* must " "be a ctypes type." msgstr "" -#: ../../library/ctypes.rst:2042 +#: ../../library/ctypes.rst:2052 msgid "" "Create a new pointer instance, pointing to *obj*. The returned object is of " "the type ``POINTER(type(obj))``." msgstr "" -#: ../../library/ctypes.rst:2045 +#: ../../library/ctypes.rst:2055 msgid "" "Note: If you just want to pass a pointer to an object to a foreign function " "call, you should use ``byref(obj)`` which is much faster." msgstr "" -#: ../../library/ctypes.rst:2051 +#: ../../library/ctypes.rst:2061 msgid "" "This function resizes the internal memory buffer of *obj*, which must be an " "instance of a ctypes type. It is not possible to make the buffer smaller " @@ -3512,13 +3528,13 @@ msgid "" "but it is possible to enlarge the buffer." msgstr "" -#: ../../library/ctypes.rst:2059 +#: ../../library/ctypes.rst:2069 msgid "" "Set the current value of the ctypes-private copy of the system :data:`errno` " "variable in the calling thread to *value* and return the previous value." msgstr "" -#: ../../library/ctypes.rst:2062 +#: ../../library/ctypes.rst:2072 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_errno`` with " "argument ``errno``." @@ -3526,14 +3542,14 @@ msgstr "" "引發一個附帶引數 ``errno`` 的\\ :ref:`稽核事件 ` ``ctypes." "set_errno``。" -#: ../../library/ctypes.rst:2067 +#: ../../library/ctypes.rst:2077 msgid "" "Windows only: set the current value of the ctypes-private copy of the " "system :data:`!LastError` variable in the calling thread to *value* and " "return the previous value." msgstr "" -#: ../../library/ctypes.rst:2071 +#: ../../library/ctypes.rst:2081 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_last_error`` with " "argument ``error``." @@ -3541,19 +3557,19 @@ msgstr "" "引發一個附帶引數 ``error`` 的\\ :ref:`稽核事件 ` ``ctypes." "set_last_error``。" -#: ../../library/ctypes.rst:2076 +#: ../../library/ctypes.rst:2086 msgid "" "Returns the size in bytes of a ctypes type or instance memory buffer. Does " "the same as the C ``sizeof`` operator." msgstr "" -#: ../../library/ctypes.rst:2082 +#: ../../library/ctypes.rst:2092 msgid "" "Return the byte string at *void \\*ptr*. If *size* is specified, it is used " "as size, otherwise the string is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2086 +#: ../../library/ctypes.rst:2096 msgid "" "Raises an :ref:`auditing event ` ``ctypes.string_at`` with " "arguments ``ptr``, ``size``." @@ -3561,7 +3577,7 @@ msgstr "" "引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." "string_at``。" -#: ../../library/ctypes.rst:2091 +#: ../../library/ctypes.rst:2101 msgid "" "Windows only: this function is probably the worst-named thing in ctypes. It " "creates an instance of :exc:`OSError`. If *code* is not specified, " @@ -3570,20 +3586,20 @@ msgid "" "error." msgstr "" -#: ../../library/ctypes.rst:2097 +#: ../../library/ctypes.rst:2107 msgid "" "An instance of :exc:`WindowsError` used to be created, which is now an alias " "of :exc:`OSError`." msgstr "" -#: ../../library/ctypes.rst:2104 +#: ../../library/ctypes.rst:2114 msgid "" "Return the wide-character string at *void \\*ptr*. If *size* is specified, " "it is used as the number of characters of the string, otherwise the string " "is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2109 +#: ../../library/ctypes.rst:2119 msgid "" "Raises an :ref:`auditing event ` ``ctypes.wstring_at`` with " "arguments ``ptr``, ``size``." @@ -3591,11 +3607,11 @@ msgstr "" "引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." "wstring_at``。" -#: ../../library/ctypes.rst:2115 +#: ../../library/ctypes.rst:2125 msgid "Data types" msgstr "" -#: ../../library/ctypes.rst:2120 +#: ../../library/ctypes.rst:2130 msgid "" "This non-public class is the common base class of all ctypes data types. " "Among other things, all ctypes type instances contain a memory block that " @@ -3605,13 +3621,13 @@ msgid "" "alive in case the memory block contains pointers." msgstr "" -#: ../../library/ctypes.rst:2127 +#: ../../library/ctypes.rst:2137 msgid "" "Common methods of ctypes data types, these are all class methods (to be " "exact, they are methods of the :term:`metaclass`):" msgstr "" -#: ../../library/ctypes.rst:2132 +#: ../../library/ctypes.rst:2142 msgid "" "This method returns a ctypes instance that shares the buffer of the *source* " "object. The *source* object must support the writeable buffer interface. " @@ -3620,7 +3636,7 @@ msgid "" "exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2138 ../../library/ctypes.rst:2148 +#: ../../library/ctypes.rst:2148 ../../library/ctypes.rst:2158 msgid "" "Raises an :ref:`auditing event ` ``ctypes.cdata/buffer`` with " "arguments ``pointer``, ``size``, ``offset``." @@ -3628,7 +3644,7 @@ msgstr "" "引發一個附帶引數 ``pointer``、``size``、``offset`` 的\\ :ref:`稽核事件 " "` ``ctypes.cdata/buffer``。" -#: ../../library/ctypes.rst:2142 +#: ../../library/ctypes.rst:2152 msgid "" "This method creates a ctypes instance, copying the buffer from the *source* " "object buffer which must be readable. The optional *offset* parameter " @@ -3636,45 +3652,45 @@ msgid "" "If the source buffer is not large enough a :exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2152 +#: ../../library/ctypes.rst:2162 msgid "" "This method returns a ctypes type instance using the memory specified by " "*address* which must be an integer." msgstr "" -#: ../../library/ctypes.rst:2155 ../../library/ctypes.rst:2157 +#: ../../library/ctypes.rst:2165 ../../library/ctypes.rst:2167 msgid "" "This method, and others that indirectly call this method, raises an :ref:" "`auditing event ` ``ctypes.cdata`` with argument ``address``." msgstr "" -#: ../../library/ctypes.rst:2163 +#: ../../library/ctypes.rst:2173 msgid "" "This method adapts *obj* to a ctypes type. It is called with the actual " "object used in a foreign function call when the type is present in the " -"foreign function's :attr:`~_FuncPtr.argtypes` tuple; it must return an " +"foreign function's :attr:`~_CFuncPtr.argtypes` tuple; it must return an " "object that can be used as a function call parameter." msgstr "" -#: ../../library/ctypes.rst:2168 +#: ../../library/ctypes.rst:2178 msgid "" "All ctypes data types have a default implementation of this classmethod that " "normally returns *obj* if that is an instance of the type. Some types " "accept other objects as well." msgstr "" -#: ../../library/ctypes.rst:2174 +#: ../../library/ctypes.rst:2184 msgid "" "This method returns a ctypes type instance exported by a shared library. " "*name* is the name of the symbol that exports the data, *library* is the " "loaded shared library." msgstr "" -#: ../../library/ctypes.rst:2178 +#: ../../library/ctypes.rst:2188 msgid "Common instance variables of ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2182 +#: ../../library/ctypes.rst:2192 msgid "" "Sometimes ctypes data instances do not own the memory block they contain, " "instead they share part of the memory block of a base object. The :attr:" @@ -3682,13 +3698,13 @@ msgid "" "block." msgstr "" -#: ../../library/ctypes.rst:2189 +#: ../../library/ctypes.rst:2199 msgid "" "This read-only variable is true when the ctypes data instance has allocated " "the memory block itself, false otherwise." msgstr "" -#: ../../library/ctypes.rst:2194 +#: ../../library/ctypes.rst:2204 msgid "" "This member is either ``None`` or a dictionary containing Python objects " "that need to be kept alive so that the memory block contents is kept valid. " @@ -3696,7 +3712,7 @@ msgid "" "dictionary." msgstr "" -#: ../../library/ctypes.rst:2207 +#: ../../library/ctypes.rst:2217 msgid "" "This non-public class is the base class of all fundamental ctypes data " "types. It is mentioned here because it contains the common attributes of the " @@ -3705,11 +3721,11 @@ msgid "" "types that are not and do not contain pointers can now be pickled." msgstr "" -#: ../../library/ctypes.rst:2213 +#: ../../library/ctypes.rst:2223 msgid "Instances have a single attribute:" msgstr "" -#: ../../library/ctypes.rst:2217 +#: ../../library/ctypes.rst:2227 msgid "" "This attribute contains the actual value of the instance. For integer and " "pointer types, it is an integer, for character types, it is a single " @@ -3717,7 +3733,7 @@ msgid "" "bytes object or string." msgstr "" -#: ../../library/ctypes.rst:2222 +#: ../../library/ctypes.rst:2232 msgid "" "When the ``value`` attribute is retrieved from a ctypes instance, usually a " "new object is returned each time. :mod:`ctypes` does *not* implement " @@ -3725,17 +3741,17 @@ msgid "" "true for all other ctypes object instances." msgstr "" -#: ../../library/ctypes.rst:2228 +#: ../../library/ctypes.rst:2238 msgid "" "Fundamental data types, when returned as foreign function call results, or, " "for example, by retrieving structure field members or array items, are " "transparently converted to native Python types. In other words, if a " -"foreign function has a :attr:`~_FuncPtr.restype` of :class:`c_char_p`, you " +"foreign function has a :attr:`~_CFuncPtr.restype` of :class:`c_char_p`, you " "will always receive a Python bytes object, *not* a :class:`c_char_p` " "instance." msgstr "" -#: ../../library/ctypes.rst:2236 +#: ../../library/ctypes.rst:2246 msgid "" "Subclasses of fundamental data types do *not* inherit this behavior. So, if " "a foreign functions :attr:`!restype` is a subclass of :class:`c_void_p`, you " @@ -3743,25 +3759,25 @@ msgid "" "you can get the value of the pointer by accessing the ``value`` attribute." msgstr "" -#: ../../library/ctypes.rst:2241 +#: ../../library/ctypes.rst:2251 msgid "These are the fundamental ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2245 +#: ../../library/ctypes.rst:2255 msgid "" "Represents the C :c:expr:`signed char` datatype, and interprets the value as " "small integer. The constructor accepts an optional integer initializer; no " "overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2252 +#: ../../library/ctypes.rst:2262 msgid "" "Represents the C :c:expr:`char` datatype, and interprets the value as a " "single character. The constructor accepts an optional string initializer, " "the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2259 +#: ../../library/ctypes.rst:2269 msgid "" "Represents the C :c:expr:`char *` datatype when it points to a zero-" "terminated string. For a general character pointer that may also point to " @@ -3769,182 +3785,182 @@ msgid "" "integer address, or a bytes object." msgstr "" -#: ../../library/ctypes.rst:2267 +#: ../../library/ctypes.rst:2277 msgid "" "Represents the C :c:expr:`double` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2273 +#: ../../library/ctypes.rst:2283 msgid "" "Represents the C :c:expr:`long double` datatype. The constructor accepts an " "optional float initializer. On platforms where ``sizeof(long double) == " "sizeof(double)`` it is an alias to :class:`c_double`." msgstr "" -#: ../../library/ctypes.rst:2279 +#: ../../library/ctypes.rst:2289 msgid "" "Represents the C :c:expr:`float` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2285 +#: ../../library/ctypes.rst:2295 msgid "" "Represents the C :c:expr:`signed int` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias to :class:`c_long`." msgstr "" -#: ../../library/ctypes.rst:2292 +#: ../../library/ctypes.rst:2302 msgid "" "Represents the C 8-bit :c:expr:`signed int` datatype. Usually an alias for :" "class:`c_byte`." msgstr "" -#: ../../library/ctypes.rst:2298 +#: ../../library/ctypes.rst:2308 msgid "" "Represents the C 16-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_short`." msgstr "" -#: ../../library/ctypes.rst:2304 +#: ../../library/ctypes.rst:2314 msgid "" "Represents the C 32-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_int`." msgstr "" -#: ../../library/ctypes.rst:2310 +#: ../../library/ctypes.rst:2320 msgid "" "Represents the C 64-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_longlong`." msgstr "" -#: ../../library/ctypes.rst:2316 +#: ../../library/ctypes.rst:2326 msgid "" "Represents the C :c:expr:`signed long` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2322 +#: ../../library/ctypes.rst:2332 msgid "" "Represents the C :c:expr:`signed long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2328 +#: ../../library/ctypes.rst:2338 msgid "" "Represents the C :c:expr:`signed short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2334 +#: ../../library/ctypes.rst:2344 msgid "Represents the C :c:type:`size_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2339 +#: ../../library/ctypes.rst:2349 msgid "Represents the C :c:type:`ssize_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2346 +#: ../../library/ctypes.rst:2356 msgid "Represents the C :c:type:`time_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2353 +#: ../../library/ctypes.rst:2363 msgid "" "Represents the C :c:expr:`unsigned char` datatype, it interprets the value " "as small integer. The constructor accepts an optional integer initializer; " "no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2360 +#: ../../library/ctypes.rst:2370 msgid "" "Represents the C :c:expr:`unsigned int` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`." msgstr "" -#: ../../library/ctypes.rst:2367 +#: ../../library/ctypes.rst:2377 msgid "" "Represents the C 8-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ubyte`." msgstr "" -#: ../../library/ctypes.rst:2373 +#: ../../library/ctypes.rst:2383 msgid "" "Represents the C 16-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ushort`." msgstr "" -#: ../../library/ctypes.rst:2379 +#: ../../library/ctypes.rst:2389 msgid "" "Represents the C 32-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_uint`." msgstr "" -#: ../../library/ctypes.rst:2385 +#: ../../library/ctypes.rst:2395 msgid "" "Represents the C 64-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ulonglong`." msgstr "" -#: ../../library/ctypes.rst:2391 +#: ../../library/ctypes.rst:2401 msgid "" "Represents the C :c:expr:`unsigned long` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2397 +#: ../../library/ctypes.rst:2407 msgid "" "Represents the C :c:expr:`unsigned long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2403 +#: ../../library/ctypes.rst:2413 msgid "" "Represents the C :c:expr:`unsigned short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2409 +#: ../../library/ctypes.rst:2419 msgid "" "Represents the C :c:expr:`void *` type. The value is represented as " "integer. The constructor accepts an optional integer initializer." msgstr "" -#: ../../library/ctypes.rst:2415 +#: ../../library/ctypes.rst:2425 msgid "" "Represents the C :c:type:`wchar_t` datatype, and interprets the value as a " "single character unicode string. The constructor accepts an optional string " "initializer, the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2422 +#: ../../library/ctypes.rst:2432 msgid "" "Represents the C :c:expr:`wchar_t *` datatype, which must be a pointer to a " "zero-terminated wide character string. The constructor accepts an integer " "address, or a string." msgstr "" -#: ../../library/ctypes.rst:2429 +#: ../../library/ctypes.rst:2439 msgid "" "Represent the C :c:expr:`bool` datatype (more accurately, :c:expr:`_Bool` " "from C99). Its value can be ``True`` or ``False``, and the constructor " "accepts any object that has a truth value." msgstr "" -#: ../../library/ctypes.rst:2436 +#: ../../library/ctypes.rst:2446 msgid "" "Windows only: Represents a :c:type:`!HRESULT` value, which contains success " "or error information for a function or method call." msgstr "" -#: ../../library/ctypes.rst:2442 +#: ../../library/ctypes.rst:2452 msgid "" "Represents the C :c:expr:`PyObject *` datatype. Calling this without an " "argument creates a ``NULL`` :c:expr:`PyObject *` pointer." msgstr "" -#: ../../library/ctypes.rst:2445 +#: ../../library/ctypes.rst:2455 msgid "" "The :mod:`!ctypes.wintypes` module provides quite some other Windows " "specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, or :c:" @@ -3952,41 +3968,41 @@ msgid "" "are also defined." msgstr "" -#: ../../library/ctypes.rst:2453 +#: ../../library/ctypes.rst:2463 msgid "Structured data types" msgstr "" -#: ../../library/ctypes.rst:2458 +#: ../../library/ctypes.rst:2468 msgid "Abstract base class for unions in native byte order." msgstr "" -#: ../../library/ctypes.rst:2463 +#: ../../library/ctypes.rst:2473 msgid "Abstract base class for unions in *big endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2469 +#: ../../library/ctypes.rst:2479 msgid "Abstract base class for unions in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2475 +#: ../../library/ctypes.rst:2485 msgid "Abstract base class for structures in *big endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2480 +#: ../../library/ctypes.rst:2490 msgid "Abstract base class for structures in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2482 +#: ../../library/ctypes.rst:2492 msgid "" "Structures and unions with non-native byte order cannot contain pointer type " "fields, or any other data types containing pointer type fields." msgstr "" -#: ../../library/ctypes.rst:2488 +#: ../../library/ctypes.rst:2498 msgid "Abstract base class for structures in *native* byte order." msgstr "" -#: ../../library/ctypes.rst:2490 +#: ../../library/ctypes.rst:2500 msgid "" "Concrete structure and union types must be created by subclassing one of " "these types, and at least define a :attr:`_fields_` class variable. :mod:" @@ -3994,34 +4010,34 @@ msgid "" "the fields by direct attribute accesses. These are the" msgstr "" -#: ../../library/ctypes.rst:2498 +#: ../../library/ctypes.rst:2508 msgid "" "A sequence defining the structure fields. The items must be 2-tuples or 3-" "tuples. The first item is the name of the field, the second item specifies " "the type of the field; it can be any ctypes data type." msgstr "" -#: ../../library/ctypes.rst:2502 +#: ../../library/ctypes.rst:2512 msgid "" "For integer type fields like :class:`c_int`, a third optional item can be " "given. It must be a small positive integer defining the bit width of the " "field." msgstr "" -#: ../../library/ctypes.rst:2506 +#: ../../library/ctypes.rst:2516 msgid "" "Field names must be unique within one structure or union. This is not " "checked, only one field can be accessed when names are repeated." msgstr "" -#: ../../library/ctypes.rst:2509 +#: ../../library/ctypes.rst:2519 msgid "" "It is possible to define the :attr:`_fields_` class variable *after* the " "class statement that defines the Structure subclass, this allows creating " "data types that directly or indirectly reference themselves::" msgstr "" -#: ../../library/ctypes.rst:2513 +#: ../../library/ctypes.rst:2523 msgid "" "class List(Structure):\n" " pass\n" @@ -4035,7 +4051,7 @@ msgstr "" " ...\n" " ]" -#: ../../library/ctypes.rst:2519 +#: ../../library/ctypes.rst:2529 msgid "" "The :attr:`_fields_` class variable must, however, be defined before the " "type is first used (an instance is created, :func:`sizeof` is called on it, " @@ -4043,14 +4059,14 @@ msgid "" "raise an AttributeError." msgstr "" -#: ../../library/ctypes.rst:2524 +#: ../../library/ctypes.rst:2534 msgid "" "It is possible to define sub-subclasses of structure types, they inherit the " "fields of the base class plus the :attr:`_fields_` defined in the sub-" "subclass, if any." msgstr "" -#: ../../library/ctypes.rst:2531 +#: ../../library/ctypes.rst:2541 msgid "" "An optional small integer that allows overriding the alignment of structure " "fields in the instance. :attr:`_pack_` must already be defined when :attr:" @@ -4058,21 +4074,21 @@ msgid "" "attribute to 0 is the same as not setting it at all." msgstr "" -#: ../../library/ctypes.rst:2539 +#: ../../library/ctypes.rst:2549 msgid "" "An optional small integer that allows overriding the alignment of the " "structure when being packed or unpacked to/from memory. Setting this " "attribute to 0 is the same as not setting it at all." msgstr "" -#: ../../library/ctypes.rst:2547 +#: ../../library/ctypes.rst:2557 msgid "" "An optional sequence that lists the names of unnamed (anonymous) fields. :" "attr:`_anonymous_` must be already defined when :attr:`_fields_` is " "assigned, otherwise it will have no effect." msgstr "" -#: ../../library/ctypes.rst:2551 +#: ../../library/ctypes.rst:2561 msgid "" "The fields listed in this variable must be structure or union type fields. :" "mod:`ctypes` will create descriptors in the structure type that allows " @@ -4080,11 +4096,11 @@ msgid "" "structure or union field." msgstr "" -#: ../../library/ctypes.rst:2556 +#: ../../library/ctypes.rst:2566 msgid "Here is an example type (Windows)::" msgstr "" -#: ../../library/ctypes.rst:2558 +#: ../../library/ctypes.rst:2568 msgid "" "class _U(Union):\n" " _fields_ = [(\"lptdesc\", POINTER(TYPEDESC)),\n" @@ -4106,7 +4122,7 @@ msgstr "" " _fields_ = [(\"u\", _U),\n" " (\"vt\", VARTYPE)]" -#: ../../library/ctypes.rst:2569 +#: ../../library/ctypes.rst:2579 msgid "" "The ``TYPEDESC`` structure describes a COM data type, the ``vt`` field " "specifies which one of the union fields is valid. Since the ``u`` field is " @@ -4116,7 +4132,7 @@ msgid "" "temporary union instance::" msgstr "" -#: ../../library/ctypes.rst:2576 +#: ../../library/ctypes.rst:2586 msgid "" "td = TYPEDESC()\n" "td.vt = VT_PTR\n" @@ -4128,7 +4144,7 @@ msgstr "" "td.lptdesc = POINTER(some_type)\n" "td.u.lptdesc = POINTER(some_type)" -#: ../../library/ctypes.rst:2581 +#: ../../library/ctypes.rst:2591 msgid "" "It is possible to define sub-subclasses of structures, they inherit the " "fields of the base class. If the subclass definition has a separate :attr:" @@ -4136,7 +4152,7 @@ msgid "" "of the base class." msgstr "" -#: ../../library/ctypes.rst:2586 +#: ../../library/ctypes.rst:2596 msgid "" "Structure and union constructors accept both positional and keyword " "arguments. Positional arguments are used to initialize member fields in the " @@ -4146,15 +4162,15 @@ msgid "" "names not present in :attr:`_fields_`." msgstr "" -#: ../../library/ctypes.rst:2597 +#: ../../library/ctypes.rst:2607 msgid "Arrays and pointers" msgstr "" -#: ../../library/ctypes.rst:2601 +#: ../../library/ctypes.rst:2611 msgid "Abstract base class for arrays." msgstr "" -#: ../../library/ctypes.rst:2603 +#: ../../library/ctypes.rst:2613 msgid "" "The recommended way to create concrete array types is by multiplying any :" "mod:`ctypes` data type with a non-negative integer. Alternatively, you can " @@ -4164,46 +4180,46 @@ msgid "" "an :class:`Array`." msgstr "" -#: ../../library/ctypes.rst:2613 +#: ../../library/ctypes.rst:2623 msgid "" "A positive integer specifying the number of elements in the array. Out-of-" "range subscripts result in an :exc:`IndexError`. Will be returned by :func:" "`len`." msgstr "" -#: ../../library/ctypes.rst:2620 +#: ../../library/ctypes.rst:2630 msgid "Specifies the type of each element in the array." msgstr "" -#: ../../library/ctypes.rst:2623 +#: ../../library/ctypes.rst:2633 msgid "" "Array subclass constructors accept positional arguments, used to initialize " "the elements in order." msgstr "" -#: ../../library/ctypes.rst:2628 +#: ../../library/ctypes.rst:2638 msgid "" "Create an array. Equivalent to ``type * length``, where *type* is a :mod:" "`ctypes` data type and *length* an integer." msgstr "" -#: ../../library/ctypes.rst:2632 +#: ../../library/ctypes.rst:2642 msgid "" "This function is :term:`soft deprecated` in favor of multiplication. There " "are no plans to remove it." msgstr "" -#: ../../library/ctypes.rst:2638 +#: ../../library/ctypes.rst:2648 msgid "Private, abstract base class for pointers." msgstr "" -#: ../../library/ctypes.rst:2640 +#: ../../library/ctypes.rst:2650 msgid "" "Concrete pointer types are created by calling :func:`POINTER` with the type " "that will be pointed to; this is done automatically by :func:`pointer`." msgstr "" -#: ../../library/ctypes.rst:2644 +#: ../../library/ctypes.rst:2654 msgid "" "If a pointer points to an array, its elements can be read and written using " "standard subscript and slice accesses. Pointer objects have no size, so :" @@ -4212,11 +4228,11 @@ msgid "" "probably crash with an access violation (if you're lucky)." msgstr "" -#: ../../library/ctypes.rst:2654 +#: ../../library/ctypes.rst:2664 msgid "Specifies the type pointed to." msgstr "" -#: ../../library/ctypes.rst:2658 +#: ../../library/ctypes.rst:2668 msgid "" "Returns the object to which to pointer points. Assigning to this attribute " "changes the pointer to point to the assigned object." diff --git a/library/dis.po b/library/dis.po index 7a33889933..6cf423905f 100644 --- a/library/dis.po +++ b/library/dis.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-09 00:13+0000\n" +"POT-Creation-Date: 2024-11-05 00:13+0000\n" "PO-Revision-Date: 2018-07-27 16:55+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1709,7 +1709,7 @@ msgstr "" #: ../../library/dis.rst:1553 msgid "" "Pushes a new function object on the stack built from the code object at " -"``STACK[1]``." +"``STACK[-1]``." msgstr "" #: ../../library/dis.rst:1555 @@ -1970,11 +1970,11 @@ msgstr "" #: ../../library/dis.rst:1743 ../../library/dis.rst:1797 msgid "Operand" -msgstr "" +msgstr "運算元" #: ../../library/dis.rst:1743 ../../library/dis.rst:1797 msgid "Description" -msgstr "" +msgstr "描述" #: ../../library/dis.rst:1745 msgid "``INTRINSIC_1_INVALID``" diff --git a/library/email.message.po b/library/email.message.po index 49155f42d7..6be5abfbdc 100644 --- a/library/email.message.po +++ b/library/email.message.po @@ -28,7 +28,7 @@ msgstr "**原始碼:**\\ :source:`Lib/email/message.py`" #: ../../library/email.message.rst:14 msgid "[1]_" -msgstr "" +msgstr "[1]_" #: ../../library/email.message.rst:16 msgid "" diff --git a/library/enum.po b/library/enum.po index d67a0bd1b5..25abbe8562 100644 --- a/library/enum.po +++ b/library/enum.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-11-02 00:13+0000\n" "PO-Revision-Date: 2023-09-11 14:08+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -83,7 +83,7 @@ msgid "" "... BLUE = 3\n" "\n" ">>> # functional syntax\n" -">>> Color = Enum('Color', ['RED', 'GREEN', 'BLUE'])" +">>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)])" msgstr "" #: ../../library/enum.rst:49 diff --git a/library/functions.po b/library/functions.po index 59b35e4bb2..aec90b86d9 100644 --- a/library/functions.po +++ b/library/functions.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-12 00:13+0000\n" +"POT-Creation-Date: 2024-10-31 00:13+0000\n" "PO-Revision-Date: 2024-05-06 17:06+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -514,8 +514,8 @@ msgid "" "ways." msgstr "如果不一定需要 \"0b\" 前綴,還可以使用如下的方法。" -#: ../../library/functions.rst:141 ../../library/functions.rst:932 -#: ../../library/functions.rst:1312 +#: ../../library/functions.rst:141 ../../library/functions.rst:942 +#: ../../library/functions.rst:1323 msgid "See also :func:`format` for more information." msgstr "可參考 :func:`format` 獲取更多資訊。" @@ -534,7 +534,7 @@ msgstr "" "(參見 :ref:`typesnumeric`),其他 class 不能繼承自它。它只有 ``False`` 和 " "``True`` 兩個實例(參見 :ref:`typebool`)。" -#: ../../library/functions.rst:156 ../../library/functions.rst:797 +#: ../../library/functions.rst:156 ../../library/functions.rst:807 msgid "The parameter is now positional-only." msgstr "現在為僅限位置參數。" @@ -932,8 +932,8 @@ msgid "" "number from real and imaginary parts." msgstr "" -#: ../../library/functions.rst:384 ../../library/functions.rst:742 -#: ../../library/functions.rst:988 +#: ../../library/functions.rst:384 ../../library/functions.rst:752 +#: ../../library/functions.rst:998 msgid "Examples:" msgstr "例如: ::" @@ -1022,8 +1022,8 @@ msgstr "" msgid "The complex type is described in :ref:`typesnumeric`." msgstr "複數型別在 :ref:`typesnumeric` 中有相關描述。" -#: ../../library/functions.rst:447 ../../library/functions.rst:794 -#: ../../library/functions.rst:1037 +#: ../../library/functions.rst:447 ../../library/functions.rst:804 +#: ../../library/functions.rst:1047 msgid "Grouping digits with underscores as in code literals is allowed." msgstr "可以使用底線將程式碼文字中的數字進行分組。" @@ -1228,7 +1228,13 @@ msgstr "引發" msgid "Syntax errors are reported as exceptions." msgstr "" -#: ../../library/functions.rst:591 +#: ../../library/functions.rst:593 ../../library/functions.rst:654 +msgid "" +"This function executes arbitrary code. Calling it with user-supplied input " +"may lead to security vulnerabilities." +msgstr "" + +#: ../../library/functions.rst:596 msgid "" "The *expression* argument is parsed and evaluated as a Python expression " "(technically speaking, a condition list) using the *globals* and *locals* " @@ -1258,11 +1264,11 @@ msgstr "" "locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透過 :keyword:" "`nonlocal` 陳述式)。" -#: ../../library/functions.rst:607 +#: ../../library/functions.rst:612 msgid "Example:" msgstr "範例:" -#: ../../library/functions.rst:613 +#: ../../library/functions.rst:618 msgid "" "This function can also be used to execute arbitrary code objects (such as " "those created by :func:`compile`). In this case, pass a code object instead " @@ -1273,7 +1279,7 @@ msgstr "" "情況下,傳入的引數是程式碼物件而不是字串。如果編譯該物件時的 *mode* 引數是 " "``'exec'``,那麼 :func:`eval` 回傳值為 ``None``。" -#: ../../library/functions.rst:618 +#: ../../library/functions.rst:623 msgid "" "Hints: dynamic execution of statements is supported by the :func:`exec` " "function. The :func:`globals` and :func:`locals` functions return the " @@ -1284,13 +1290,13 @@ msgstr "" "函式分別回傳當前的全域性和局部性 dictionary,它們對於將引數傳遞給 :func:" "`eval` 或 :func:`exec` 可能會方便許多。" -#: ../../library/functions.rst:623 +#: ../../library/functions.rst:628 msgid "" "If the given source is a string, then leading and trailing spaces and tabs " "are stripped." msgstr "如果給定來源是一個字串,那麼其前後的空格和定位字元會被移除。" -#: ../../library/functions.rst:626 +#: ../../library/functions.rst:631 msgid "" "See :func:`ast.literal_eval` for a function that can safely evaluate strings " "with expressions containing only literals." @@ -1298,8 +1304,8 @@ msgstr "" "另外可以參閱 :func:`ast.literal_eval`,該函式可以安全執行僅包含文字的運算式字" "串。" -#: ../../library/functions.rst:629 ../../library/functions.rst:631 -#: ../../library/functions.rst:686 ../../library/functions.rst:688 +#: ../../library/functions.rst:634 ../../library/functions.rst:636 +#: ../../library/functions.rst:696 ../../library/functions.rst:698 msgid "" "Raises an :ref:`auditing event ` ``exec`` with the code object as " "the argument. Code compilation events may also be raised." @@ -1307,17 +1313,17 @@ msgstr "" "引發一個附帶程式碼物件為引數的\\ :ref:`稽核事件 ` ``exec``。也可能" "會引發程式碼編譯事件。" -#: ../../library/functions.rst:636 ../../library/functions.rst:708 +#: ../../library/functions.rst:641 ../../library/functions.rst:718 msgid "The *globals* and *locals* arguments can now be passed as keywords." msgstr "" -#: ../../library/functions.rst:640 ../../library/functions.rst:712 +#: ../../library/functions.rst:645 ../../library/functions.rst:722 msgid "" "The semantics of the default *locals* namespace have been adjusted as " "described for the :func:`locals` builtin." msgstr "" -#: ../../library/functions.rst:647 +#: ../../library/functions.rst:657 msgid "" "This function supports dynamic execution of Python code. *source* must be " "either a string or a code object. If it is a string, the string is parsed " @@ -1337,7 +1343,7 @@ msgstr "" "`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在函式之外使" "用。該函式回傳值是 ``None``。" -#: ../../library/functions.rst:658 +#: ../../library/functions.rst:668 msgid "" "In all cases, if the optional parts are omitted, the code is executed in the " "current scope. If only *globals* is provided, it must be a dictionary (and " @@ -1353,7 +1359,7 @@ msgstr "" "用作全域和區域變數。如果提供了 *locals*,則它可以是任何對映物件。請記住在 " "module 層級中全域和區域變數是相同的 dictionary。" -#: ../../library/functions.rst:668 +#: ../../library/functions.rst:678 msgid "" "When ``exec`` gets two separate objects as *globals* and *locals*, the code " "will be executed as if it were embedded in a class definition. This means " @@ -1362,7 +1368,7 @@ msgid "" "are treated as class variables in a class definition)." msgstr "" -#: ../../library/functions.rst:674 +#: ../../library/functions.rst:684 msgid "" "If the *globals* dictionary does not contain a value for the key " "``__builtins__``, a reference to the dictionary of the built-in module :mod:" @@ -1375,7 +1381,7 @@ msgstr "" "dictionary 傳入 :func:`exec` 之前,你可以透過將它插入 *globals* 來控制你需要" "哪些內建函式來執行程式碼。" -#: ../../library/functions.rst:680 +#: ../../library/functions.rst:690 msgid "" "The *closure* argument specifies a closure--a tuple of cellvars. It's only " "valid when the *object* is a code object containing :term:`free (closure) " @@ -1387,7 +1393,7 @@ msgstr "" "variables) ` 的程式碼物件時,它才有效。Tuple 的長度必須與程" "式碼物件的 :attr:`~codeobject.co_freevars` 屬性完全匹配。" -#: ../../library/functions.rst:693 +#: ../../library/functions.rst:703 msgid "" "The built-in functions :func:`globals` and :func:`locals` return the current " "global and local namespace, respectively, which may be useful to pass around " @@ -1396,7 +1402,7 @@ msgstr "" "內建 :func:`globals` 和 :func:`locals` 函式各自回傳當前的全域和區域命名空間," "因此可以將它們傳遞給 :func:`exec` 的第二個和第三個引數以供後續使用。" -#: ../../library/functions.rst:699 +#: ../../library/functions.rst:709 msgid "" "The default *locals* act as described for function :func:`locals` below. " "Pass an explicit *locals* dictionary if you need to see effects of the code " @@ -1406,11 +1412,11 @@ msgstr "" "func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 *locals* " "dictionary 。" -#: ../../library/functions.rst:703 +#: ../../library/functions.rst:713 msgid "Added the *closure* parameter." msgstr "增加了 *closure* 參數。" -#: ../../library/functions.rst:718 +#: ../../library/functions.rst:728 msgid "" "Construct an iterator from those elements of *iterable* for which *function* " "is true. *iterable* may be either a sequence, a container which supports " @@ -1422,7 +1428,7 @@ msgstr "" "*function* 是 ``None``,則會假設它是一個識別性函式,即 *iterable* 中所有假值" "元素會被移除。" -#: ../../library/functions.rst:724 +#: ../../library/functions.rst:734 msgid "" "Note that ``filter(function, iterable)`` is equivalent to the generator " "expression ``(item for item in iterable if function(item))`` if function is " @@ -1433,7 +1439,7 @@ msgstr "" "是 ``None`` 的時候為 ``(item for item in iterable if function(item))``;" "function 是 ``None`` 的時候為 ``(item for item in iterable if item)``。" -#: ../../library/functions.rst:729 +#: ../../library/functions.rst:739 msgid "" "See :func:`itertools.filterfalse` for the complementary function that " "returns elements of *iterable* for which *function* is false." @@ -1441,11 +1447,11 @@ msgstr "" "請參閱 :func:`itertools.filterfalse`,只有 *function* 為 false 時才選取 " "*iterable* 中元素的互補函式。" -#: ../../library/functions.rst:740 +#: ../../library/functions.rst:750 msgid "Return a floating-point number constructed from a number or a string." msgstr "回傳從數字或字串生成的浮點數。" -#: ../../library/functions.rst:744 +#: ../../library/functions.rst:754 msgid "" ">>> float('+1.23')\n" "1.23\n" @@ -1469,7 +1475,7 @@ msgstr "" ">>> float('-Infinity')\n" "-inf" -#: ../../library/functions.rst:757 +#: ../../library/functions.rst:767 msgid "" "If the argument is a string, it should contain a decimal number, optionally " "preceded by a sign, and optionally embedded in whitespace. The optional " @@ -1484,7 +1490,7 @@ msgstr "" "數也可以是 NaN(非數字)或正負無窮大的字串。確切地說,除去首尾的空格後,輸入" "必須遵循以下語法中 :token:`~float:floatvalue` 的生成規則:" -#: ../../library/functions.rst:778 +#: ../../library/functions.rst:788 msgid "" "Case is not significant, so, for example, \"inf\", \"Inf\", \"INFINITY\", " "and \"iNfINity\" are all acceptable spellings for positive infinity." @@ -1492,7 +1498,7 @@ msgstr "" "字母大小寫不影響,例如,\"inf\"、\"Inf\"、\"INFINITY\"、\"iNfINity\" 都可以表" "示正無窮大。" -#: ../../library/functions.rst:781 +#: ../../library/functions.rst:791 msgid "" "Otherwise, if the argument is an integer or a floating-point number, a " "floating-point number with the same value (within Python's floating-point " @@ -1502,7 +1508,7 @@ msgstr "" "否則,如果引數是整數或浮點數,則回傳具有相同值(在 Python 浮點精度範圍內)的" "浮點數。如果引數在 Python 浮點精度範圍外,則會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:786 +#: ../../library/functions.rst:796 msgid "" "For a general Python object ``x``, ``float(x)`` delegates to ``x." "__float__()``. If :meth:`~object.__float__` is not defined then it falls " @@ -1511,22 +1517,22 @@ msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 會委派給 ``x.__float__()``。如果未" "定義 :meth:`~object.__float__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:790 +#: ../../library/functions.rst:800 msgid "If no argument is given, ``0.0`` is returned." msgstr "如果沒有引數,則回傳 ``0.0``。" -#: ../../library/functions.rst:792 +#: ../../library/functions.rst:802 msgid "The float type is described in :ref:`typesnumeric`." msgstr ":ref:`typesnumeric` 描述了浮點數型別。" -#: ../../library/functions.rst:800 +#: ../../library/functions.rst:810 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not " "defined." msgstr "" "如果 :meth:`~object.__float__` 未定義,則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:810 +#: ../../library/functions.rst:820 msgid "" "Convert a *value* to a \"formatted\" representation, as controlled by " "*format_spec*. The interpretation of *format_spec* will depend on the type " @@ -1537,7 +1543,7 @@ msgstr "" "取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語法::ref:" "`formatspec`。" -#: ../../library/functions.rst:815 +#: ../../library/functions.rst:825 msgid "" "The default *format_spec* is an empty string which usually gives the same " "effect as calling :func:`str(value) `." @@ -1545,7 +1551,7 @@ msgstr "" "預設的 *format_spec* 是一個空字串,它通常和呼叫 :func:`str(value) ` 的效" "果相同。" -#: ../../library/functions.rst:818 +#: ../../library/functions.rst:828 msgid "" "A call to ``format(value, format_spec)`` is translated to ``type(value)." "__format__(value, format_spec)`` which bypasses the instance dictionary when " @@ -1559,7 +1565,7 @@ msgstr "" "實例中的字典。如果搜尋到 :mod:`object` 這個 method 但 *format_spec* 不為空," "或是 *format_spec* 或回傳值不是字串,則會引發 :exc:`TypeError`。" -#: ../../library/functions.rst:825 +#: ../../library/functions.rst:835 msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." @@ -1567,7 +1573,7 @@ msgstr "" "當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:834 +#: ../../library/functions.rst:844 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " "*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" @@ -1577,7 +1583,7 @@ msgstr "" "``frozenset`` 是一個內建的 class。有關此 class 的文件,請參閱 :class:" "`frozenset` 和 :ref:`types-set`。" -#: ../../library/functions.rst:838 +#: ../../library/functions.rst:848 msgid "" "For other containers see the built-in :class:`set`, :class:`list`, :class:" "`tuple`, and :class:`dict` classes, as well as the :mod:`collections` module." @@ -1585,7 +1591,7 @@ msgstr "" "請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` " "class,以及 :mod:`collections` module 來了解其它的容器。" -#: ../../library/functions.rst:846 +#: ../../library/functions.rst:856 msgid "" "Return the value of the named attribute of *object*. *name* must be a " "string. If the string is the name of one of the object's attributes, the " @@ -1600,7 +1606,7 @@ msgstr "" "`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:" "`setattr`)。" -#: ../../library/functions.rst:855 +#: ../../library/functions.rst:865 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " @@ -1611,7 +1617,7 @@ msgstr "" "發生在編譯期,因此你必須手動改編私有屬性(有兩個前導底線的屬性)的名稱,才能" "使用 :func:`getattr` 來取得它。" -#: ../../library/functions.rst:863 +#: ../../library/functions.rst:873 msgid "" "Return the dictionary implementing the current module namespace. For code " "within functions, this is set when the function is defined and remains the " @@ -1620,7 +1626,7 @@ msgstr "" "回傳代表當前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義" "函式時設定且不論該函式是在何處呼叫都會保持相同。" -#: ../../library/functions.rst:870 +#: ../../library/functions.rst:880 msgid "" "The arguments are an object and a string. The result is ``True`` if the " "string is the name of one of the object's attributes, ``False`` if not. " @@ -1631,7 +1637,7 @@ msgstr "" "則回傳 ``False``。(此功能是透過呼叫 ``getattr(object, name)`` 並檢查是否引" "發 :exc:`AttributeError` 來實作的。)" -#: ../../library/functions.rst:878 +#: ../../library/functions.rst:888 msgid "" "Return the hash value of the object (if it has one). Hash values are " "integers. They are used to quickly compare dictionary keys during a " @@ -1642,7 +1648,7 @@ msgstr "" "時用來快速比較 dictionary 的鍵。相同大小的數字數值有相同的雜湊值(即使它們型" "別不同,如 1 和 1.0)。" -#: ../../library/functions.rst:885 +#: ../../library/functions.rst:895 msgid "" "For objects with custom :meth:`~object.__hash__` methods, note that :func:" "`hash` truncates the return value based on the bit width of the host machine." @@ -1650,7 +1656,7 @@ msgstr "" "請注意,如果物件帶有自訂的 :meth:`~object.__hash__` 方法,:func:`hash` 將根據" "運行機器的位元長度來截斷回傳值。" -#: ../../library/functions.rst:892 +#: ../../library/functions.rst:902 msgid "" "Invoke the built-in help system. (This function is intended for interactive " "use.) If no argument is given, the interactive help system starts on the " @@ -1664,7 +1670,7 @@ msgstr "" "關鍵字或說明文件主題中搜索該字串,並在控制台上列印幫助資訊。如果引數是其他任" "意物件,則會生成該物件的幫助頁。" -#: ../../library/functions.rst:899 +#: ../../library/functions.rst:909 msgid "" "Note that if a slash(/) appears in the parameter list of a function when " "invoking :func:`help`, it means that the parameters prior to the slash are " @@ -1675,12 +1681,12 @@ msgstr "" "前面的參數是僅限位置 (positional-only) 參數。有關更多資訊,請參閱\\ :ref:`常" "見問答集中的僅限位置參數條目 `。" -#: ../../library/functions.rst:904 +#: ../../library/functions.rst:914 msgid "" "This function is added to the built-in namespace by the :mod:`site` module." msgstr "此函式會被 :mod:`site` module 加入到內建命名空間。" -#: ../../library/functions.rst:906 +#: ../../library/functions.rst:916 msgid "" "Changes to :mod:`pydoc` and :mod:`inspect` mean that the reported signatures " "for callables are now more comprehensive and consistent." @@ -1688,7 +1694,7 @@ msgstr "" "對於 :mod:`pydoc` 和 :mod:`inspect` 的變更,使得可呼叫物件回報的的簽名 " "(signature) 更加全面和一致。" -#: ../../library/functions.rst:913 +#: ../../library/functions.rst:923 msgid "" "Convert an integer number to a lowercase hexadecimal string prefixed with " "\"0x\". If *x* is not a Python :class:`int` object, it has to define an :" @@ -1698,7 +1704,7 @@ msgstr "" "class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並且回傳一" "個整數。舉例來說:" -#: ../../library/functions.rst:922 +#: ../../library/functions.rst:932 msgid "" "If you want to convert an integer number to an uppercase or lower " "hexadecimal string with prefix or not, you can use either of the following " @@ -1707,20 +1713,20 @@ msgstr "" "如果要將整數轉換為大寫或小寫的十六進位制字串,並可選擇有無 \"0x\" 前綴,則可" "以使用如下方法:" -#: ../../library/functions.rst:934 +#: ../../library/functions.rst:944 msgid "" "See also :func:`int` for converting a hexadecimal string to an integer using " "a base of 16." msgstr "另請參閱 :func:`int` 將十六進位制字串轉換為以 16 為基數的整數。" -#: ../../library/functions.rst:939 +#: ../../library/functions.rst:949 msgid "" "To obtain a hexadecimal string representation for a float, use the :meth:" "`float.hex` method." msgstr "" "如果要獲取浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" -#: ../../library/functions.rst:945 +#: ../../library/functions.rst:955 msgid "" "Return the \"identity\" of an object. This is an integer which is " "guaranteed to be unique and constant for this object during its lifetime. " @@ -1730,18 +1736,18 @@ msgstr "" "回傳物件的 \"識別性\" 。該值是一個整數,在此物件的生命週期中保證是唯一且恆定" "的。兩個生命期不重疊的物件可能具有相同的 :func:`id` 值。" -#: ../../library/functions.rst:950 +#: ../../library/functions.rst:960 msgid "This is the address of the object in memory." msgstr "這是該物件在記憶體中的位址。" -#: ../../library/functions.rst:952 +#: ../../library/functions.rst:962 msgid "" "Raises an :ref:`auditing event ` ``builtins.id`` with argument " "``id``." msgstr "" "引發一個附帶引數 ``id`` 的\\ :ref:`稽核事件 ` ``builtins.id``。" -#: ../../library/functions.rst:958 +#: ../../library/functions.rst:968 msgid "" "If the *prompt* argument is present, it is written to standard output " "without a trailing newline. The function then reads a line from input, " @@ -1752,7 +1758,7 @@ msgstr "" "從輸入中讀取一行,將其轉換為字串(去除末尾的換行符)並回傳。當讀取到 EOF 時," "則引發 :exc:`EOFError`。例如: ::" -#: ../../library/functions.rst:963 +#: ../../library/functions.rst:973 msgid "" ">>> s = input('--> ') \n" "--> Monty Python's Flying Circus\n" @@ -1764,7 +1770,7 @@ msgstr "" ">>> s \n" "\"Monty Python's Flying Circus\"" -#: ../../library/functions.rst:968 +#: ../../library/functions.rst:978 msgid "" "If the :mod:`readline` module was loaded, then :func:`input` will use it to " "provide elaborate line editing and history features." @@ -1772,7 +1778,7 @@ msgstr "" "如果載入了 :mod:`readline` module,:func:`input` 將使用它來提供複雜的行編輯和" "歷史記錄功能。" -#: ../../library/functions.rst:971 ../../library/functions.rst:973 +#: ../../library/functions.rst:981 ../../library/functions.rst:983 msgid "" "Raises an :ref:`auditing event ` ``builtins.input`` with argument " "``prompt`` before reading input" @@ -1780,7 +1786,7 @@ msgstr "" "引發一個附帶讀取輸入前的引數 ``prompt`` 的\\ :ref:`稽核事件 ` " "``builtins.input``。" -#: ../../library/functions.rst:976 ../../library/functions.rst:978 +#: ../../library/functions.rst:986 ../../library/functions.rst:988 msgid "" "Raises an :ref:`auditing event ` ``builtins.input/result`` with " "the result after successfully reading input." @@ -1788,13 +1794,13 @@ msgstr "" "引發一個附帶成功讀取結果的\\ :ref:`稽核事件 ` ``builtins.input/" "result``。" -#: ../../library/functions.rst:985 +#: ../../library/functions.rst:995 msgid "" "Return an integer object constructed from a number or a string, or return " "``0`` if no arguments are given." msgstr "" -#: ../../library/functions.rst:990 +#: ../../library/functions.rst:1000 msgid "" ">>> int(123.45)\n" "123\n" @@ -1822,7 +1828,7 @@ msgstr "" ">>> int('01110011', base=2)\n" "115" -#: ../../library/functions.rst:1005 +#: ../../library/functions.rst:1015 msgid "" "If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x." "__int__()``. If the argument defines :meth:`~object.__index__`, it returns " @@ -1835,7 +1841,7 @@ msgstr "" "義了 :meth:`~object.__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數,則會向零" "的方向無條件捨去。" -#: ../../library/functions.rst:1011 +#: ../../library/functions.rst:1021 msgid "" "If the argument is not a number or if *base* is given, then it must be a " "string, :class:`bytes`, or :class:`bytearray` instance representing an " @@ -1848,7 +1854,7 @@ msgstr "" "以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、或在" "數字間有單一底線。" -#: ../../library/functions.rst:1017 +#: ../../library/functions.rst:1027 msgid "" "A base-n integer string contains digits, each representing a value from 0 to " "n-1. The values 0--9 can be represented by any Unicode decimal digit. The " @@ -1870,11 +1876,11 @@ msgstr "" "進制中的一個,所以 ``int('010', 0)`` 是非法的,但 ``int('010')`` 和 " "``int('010', 8)`` 是有效的。" -#: ../../library/functions.rst:1028 +#: ../../library/functions.rst:1038 msgid "The integer type is described in :ref:`typesnumeric`." msgstr "整數型別定義請參閱\\ :ref:`typesnumeric`。" -#: ../../library/functions.rst:1030 +#: ../../library/functions.rst:1040 msgid "" "If *base* is not an instance of :class:`int` and the *base* object has a :" "meth:`base.__index__ ` method, that method is called to " @@ -1886,22 +1892,22 @@ msgstr "" "的版本使用 :meth:`base.__int__ ` 而不是 :meth:`base." "__index__ `。" -#: ../../library/functions.rst:1040 +#: ../../library/functions.rst:1050 msgid "The first parameter is now positional-only." msgstr "第一個參數為僅限位置參數。" -#: ../../library/functions.rst:1043 +#: ../../library/functions.rst:1053 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not " "defined." msgstr "" "如果未定義 :meth:`~object.__int__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:1046 +#: ../../library/functions.rst:1056 msgid "The delegation to :meth:`~object.__trunc__` is deprecated." msgstr "對 :meth:`~object.__trunc__` 的委派已棄用。" -#: ../../library/functions.rst:1049 +#: ../../library/functions.rst:1059 msgid "" ":class:`int` string inputs and string representations can be limited to help " "avoid denial of service attacks. A :exc:`ValueError` is raised when the " @@ -1915,7 +1921,7 @@ msgstr "" "`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱\\ :ref:`整" "數字串轉換的長度限制 `\\ 說明文件。" -#: ../../library/functions.rst:1059 +#: ../../library/functions.rst:1069 msgid "" "Return ``True`` if the *object* argument is an instance of the *classinfo* " "argument, or of a (direct, indirect, or :term:`virtual `) of *classinfo*. A class is considered a " @@ -1955,7 +1961,7 @@ msgstr "" "是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:1091 +#: ../../library/functions.rst:1101 msgid "" "Return an :term:`iterator` object. The first argument is interpreted very " "differently depending on the presence of the second argument. Without a " @@ -1979,11 +1985,11 @@ msgstr "" "__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 *sentinel* 則引發 :" "exc:`StopIteration`,否則回傳呼叫結果。" -#: ../../library/functions.rst:1105 +#: ../../library/functions.rst:1115 msgid "See also :ref:`typeiter`." msgstr "另請參閱 :ref:`typeiter`。" -#: ../../library/functions.rst:1107 +#: ../../library/functions.rst:1117 msgid "" "One useful application of the second form of :func:`iter` is to build a " "block-reader. For example, reading fixed-width blocks from a binary database " @@ -1992,7 +1998,7 @@ msgstr "" ":func:`iter` 的第二種形式有一個好用的應用,是能夠建立一個區塊閱讀器 (block-" "reader)。例如,從二進位資料庫檔案中讀取固定寬度的區塊,直到檔案的結尾: ::" -#: ../../library/functions.rst:1111 +#: ../../library/functions.rst:1121 msgid "" "from functools import partial\n" "with open('mydata.db', 'rb') as f:\n" @@ -2004,7 +2010,7 @@ msgstr "" " for block in iter(partial(f.read, 64), b''):\n" " process_block(block)" -#: ../../library/functions.rst:1119 +#: ../../library/functions.rst:1129 msgid "" "Return the length (the number of items) of an object. The argument may be a " "sequence (such as a string, bytes, tuple, list, or range) or a collection " @@ -2013,7 +2019,7 @@ msgstr "" "回傳物件的長度(元素個數)。引數可以是序列(如 string、bytes、tuple、list 或 " "range)或集合(如 dictionary、set 或 frozen set)。" -#: ../../library/functions.rst:1125 +#: ../../library/functions.rst:1135 msgid "" "``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." "maxsize`, such as :class:`range(2 ** 100) `." @@ -2021,7 +2027,7 @@ msgstr "" "如果物件長度大於 :data:`sys.maxsize`,像是 :class:`range(2 ** 100) `," "則 ``len`` 會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:1134 +#: ../../library/functions.rst:1144 msgid "" "Rather than being a function, :class:`list` is actually a mutable sequence " "type, as documented in :ref:`typesseq-list` and :ref:`typesseq`." @@ -2029,33 +2035,33 @@ msgstr "" "除了是函式,:class:`list` 也是可變序列型別,詳情請參閱 :ref:`typesseq-list` " "和 :ref:`typesseq`。" -#: ../../library/functions.rst:1140 +#: ../../library/functions.rst:1150 msgid "" "Return a mapping object representing the current local symbol table, with " "variable names as the keys, and their currently bound references as the " "values." msgstr "" -#: ../../library/functions.rst:1144 +#: ../../library/functions.rst:1154 msgid "" "At module scope, as well as when using :func:`exec` or :func:`eval` with a " "single namespace, this function returns the same namespace as :func:" "`globals`." msgstr "" -#: ../../library/functions.rst:1148 +#: ../../library/functions.rst:1158 msgid "" "At class scope, it returns the namespace that will be passed to the " "metaclass constructor." msgstr "" -#: ../../library/functions.rst:1151 +#: ../../library/functions.rst:1161 msgid "" "When using ``exec()`` or ``eval()`` with separate local and global " "arguments, it returns the local namespace passed in to the function call." msgstr "" -#: ../../library/functions.rst:1154 +#: ../../library/functions.rst:1164 msgid "" "In all of the above cases, each call to ``locals()`` in a given frame of " "execution will return the *same* mapping object. Changes made through the " @@ -2065,7 +2071,7 @@ msgid "" "returned mapping object." msgstr "" -#: ../../library/functions.rst:1161 +#: ../../library/functions.rst:1171 msgid "" "In an :term:`optimized scope` (including functions, generators, and " "coroutines), each call to ``locals()`` instead returns a fresh dictionary " @@ -2077,7 +2083,7 @@ msgid "" "previously returned dictionaries." msgstr "" -#: ../../library/functions.rst:1170 +#: ../../library/functions.rst:1180 msgid "" "Calling ``locals()`` as part of a comprehension in a function, generator, or " "coroutine is equivalent to calling it in the containing scope, except that " @@ -2086,19 +2092,19 @@ msgid "" "function." msgstr "" -#: ../../library/functions.rst:1176 +#: ../../library/functions.rst:1186 msgid "" "Calling ``locals()`` as part of a generator expression is equivalent to " "calling it in a nested generator function." msgstr "" -#: ../../library/functions.rst:1179 +#: ../../library/functions.rst:1189 msgid "" "The behaviour of ``locals()`` in a comprehension has been updated as " "described in :pep:`709`." msgstr "" -#: ../../library/functions.rst:1183 +#: ../../library/functions.rst:1193 msgid "" "As part of :pep:`667`, the semantics of mutating the mapping objects " "returned from this function are now defined. The behavior in :term:" @@ -2107,7 +2113,7 @@ msgid "" "versions." msgstr "" -#: ../../library/functions.rst:1193 +#: ../../library/functions.rst:1203 msgid "" "Return an iterator that applies *function* to every item of *iterable*, " "yielding the results. If additional *iterables* arguments are passed, " @@ -2122,13 +2128,13 @@ msgstr "" "iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經被編排為引數的 tuple," "請參閱 :func:`itertools.starmap`。" -#: ../../library/functions.rst:1205 +#: ../../library/functions.rst:1215 msgid "" "Return the largest item in an iterable or the largest of two or more " "arguments." msgstr "回傳 iterable 中最大的元素,或者回傳兩個以上的引數中最大的。" -#: ../../library/functions.rst:1208 +#: ../../library/functions.rst:1218 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The largest item in the iterable is returned. If two or more positional " @@ -2137,7 +2143,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是個 :term:`iterable`,iterable 中最大的元素" "會被回傳。如果提供了兩個或以上的位置引數,則回傳最大的位置引數。" -#: ../../library/functions.rst:1213 ../../library/functions.rst:1251 +#: ../../library/functions.rst:1223 ../../library/functions.rst:1261 msgid "" "There are two optional keyword-only arguments. The *key* argument specifies " "a one-argument ordering function like that used for :meth:`list.sort`. The " @@ -2150,7 +2156,7 @@ msgstr "" "的物件。如果 iterable 為空,並且沒有提供 *default*,則會引發 :exc:" "`ValueError`。" -#: ../../library/functions.rst:1219 +#: ../../library/functions.rst:1229 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2161,15 +2167,15 @@ msgstr "" "``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " "iterable, key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1224 ../../library/functions.rst:1262 +#: ../../library/functions.rst:1234 ../../library/functions.rst:1272 msgid "Added the *default* keyword-only parameter." msgstr "新增 *default* 僅限關鍵字參數。" -#: ../../library/functions.rst:1227 ../../library/functions.rst:1265 +#: ../../library/functions.rst:1237 ../../library/functions.rst:1275 msgid "The *key* can be ``None``." msgstr "*key* 可以為 ``None``。" -#: ../../library/functions.rst:1235 +#: ../../library/functions.rst:1245 msgid "" "Return a \"memory view\" object created from the given argument. See :ref:" "`typememoryview` for more information." @@ -2177,13 +2183,13 @@ msgstr "" "回傳由給定的引數所建立之「memory view(記憶體檢視)」物件。有關詳細資訊,請參" "閱\\ :ref:`typememoryview`。" -#: ../../library/functions.rst:1243 +#: ../../library/functions.rst:1253 msgid "" "Return the smallest item in an iterable or the smallest of two or more " "arguments." msgstr "回傳 iterable 中最小的元素,或者回傳兩個以上的引數中最小的。" -#: ../../library/functions.rst:1246 +#: ../../library/functions.rst:1256 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The smallest item in the iterable is returned. If two or more positional " @@ -2192,7 +2198,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是 :term:`iterable`,iterable 中最小的元素會" "被回傳。如果提供了兩個以上的位置引數,則回傳最小的位置引數。" -#: ../../library/functions.rst:1257 +#: ../../library/functions.rst:1267 msgid "" "If multiple items are minimal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2203,7 +2209,7 @@ msgstr "" "``sorted(iterable, key=keyfunc)[0]`` 和 ``heapq.nsmallest(1, iterable, " "key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1272 +#: ../../library/functions.rst:1282 msgid "" "Retrieve the next item from the :term:`iterator` by calling its :meth:" "`~iterator.__next__` method. If *default* is given, it is returned if the " @@ -2213,16 +2219,18 @@ msgstr "" "素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引發 :" "exc:`StopIteration`。" -#: ../../library/functions.rst:1279 +#: ../../library/functions.rst:1289 msgid "" -"Return a new featureless object. :class:`object` is a base for all classes. " -"It has methods that are common to all instances of Python classes. This " -"function does not accept any arguments." +"This is the ultimate base class of all other classes. It has methods that " +"are common to all instances of Python classes. When the constructor is " +"called, it returns a new featureless object. The constructor does not accept " +"any arguments." msgstr "" -"回傳一個沒有特徵的新物件。:class:`object` 是所有 class 的基礎,它具有所有 " -"Python class 實例的通用 method。這個函式不接受任何引數。" +"這是所有其他 class 的基礎,它具有所有 Python class 實例的通用 method。當建構" +"函式被呼叫時,它會回傳一個新的沒有特徵 (featureless) 的物件。這個建構函式不接" +"受任何引數。" -#: ../../library/functions.rst:1285 +#: ../../library/functions.rst:1296 msgid "" ":class:`object` instances do *not* have :attr:`~object.__dict__` attributes, " "so you can't assign arbitrary attributes to an instance of :class:`object`." @@ -2230,7 +2238,7 @@ msgstr "" "由於 :class:`object` 實例\\ *沒有* :attr:`~object.__dict__` 屬性,因此無法將" "任意屬性賦給 :class:`object` 的實例。" -#: ../../library/functions.rst:1292 +#: ../../library/functions.rst:1303 msgid "" "Convert an integer number to an octal string prefixed with \"0o\". The " "result is a valid Python expression. If *x* is not a Python :class:`int` " @@ -2241,7 +2249,7 @@ msgstr "" "Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" "`~object.__index__` method 回傳一個整數。舉例來說:" -#: ../../library/functions.rst:1302 +#: ../../library/functions.rst:1313 msgid "" "If you want to convert an integer number to an octal string either with the " "prefix \"0o\" or not, you can use either of the following ways." @@ -2249,7 +2257,7 @@ msgstr "" "如果要將整數轉換為八進位制字串,不論是否具備 \"0o\" 前綴,都可以使用下面的方" "法。" -#: ../../library/functions.rst:1319 +#: ../../library/functions.rst:1330 msgid "" "Open *file* and return a corresponding :term:`file object`. If the file " "cannot be opened, an :exc:`OSError` is raised. See :ref:`tut-files` for more " @@ -2259,7 +2267,7 @@ msgstr "" "啟,則引發 :exc:`OSError`。關於使用此函式的更多方法,請參閱\\ :ref:`tut-" "files`。" -#: ../../library/functions.rst:1323 +#: ../../library/functions.rst:1334 msgid "" "*file* is a :term:`path-like object` giving the pathname (absolute or " "relative to the current working directory) of the file to be opened or an " @@ -2272,7 +2280,7 @@ msgstr "" "器 (file descriptor)。(如果有給定檔案描述器,它會隨著回傳的 I/O 物件關閉而關" "閉,除非 *closefd* 被設為 ``False``。)" -#: ../../library/functions.rst:1329 +#: ../../library/functions.rst:1340 msgid "" "*mode* is an optional string that specifies the mode in which the file is " "opened. It defaults to ``'r'`` which means open for reading in text mode. " @@ -2293,71 +2301,71 @@ msgstr "" "getencoding` 來獲取當前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制模" "式且不要指定 *encoding*。)可用的模式有:" -#: ../../library/functions.rst:1346 +#: ../../library/functions.rst:1357 msgid "Character" msgstr "字元" -#: ../../library/functions.rst:1346 +#: ../../library/functions.rst:1357 msgid "Meaning" msgstr "意義" -#: ../../library/functions.rst:1348 +#: ../../library/functions.rst:1359 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/functions.rst:1348 +#: ../../library/functions.rst:1359 msgid "open for reading (default)" msgstr "讀取(預設)" -#: ../../library/functions.rst:1349 +#: ../../library/functions.rst:1360 msgid "``'w'``" msgstr "``'w'``" -#: ../../library/functions.rst:1349 +#: ../../library/functions.rst:1360 msgid "open for writing, truncating the file first" msgstr "寫入,會先清除檔案內容" -#: ../../library/functions.rst:1350 +#: ../../library/functions.rst:1361 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/functions.rst:1350 +#: ../../library/functions.rst:1361 msgid "open for exclusive creation, failing if the file already exists" msgstr "唯一性建立,如果文件已存在則會失敗" -#: ../../library/functions.rst:1351 +#: ../../library/functions.rst:1362 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/functions.rst:1351 +#: ../../library/functions.rst:1362 msgid "open for writing, appending to the end of file if it exists" msgstr "寫入,如果檔案存在則在其末端附加內容" -#: ../../library/functions.rst:1352 +#: ../../library/functions.rst:1363 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/functions.rst:1352 ../../library/functions.rst:1496 +#: ../../library/functions.rst:1363 ../../library/functions.rst:1507 msgid "binary mode" msgstr "二進制模式" -#: ../../library/functions.rst:1353 +#: ../../library/functions.rst:1364 msgid "``'t'``" msgstr "``'t'``" -#: ../../library/functions.rst:1353 +#: ../../library/functions.rst:1364 msgid "text mode (default)" msgstr "文字模式(預設)" -#: ../../library/functions.rst:1354 +#: ../../library/functions.rst:1365 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/functions.rst:1354 +#: ../../library/functions.rst:1365 msgid "open for updating (reading and writing)" msgstr "更新(讀取並寫入)" -#: ../../library/functions.rst:1357 +#: ../../library/functions.rst:1368 msgid "" "The default mode is ``'r'`` (open for reading text, a synonym of ``'rt'``). " "Modes ``'w+'`` and ``'w+b'`` open and truncate the file. Modes ``'r+'`` and " @@ -2367,7 +2375,7 @@ msgstr "" "``'w+b'`` 模式會開啟並清除檔案。``'r+'`` 和 ``'r+b'`` 模式會開啟且保留檔案內" "容。" -#: ../../library/functions.rst:1361 +#: ../../library/functions.rst:1372 msgid "" "As mentioned in the :ref:`io-overview`, Python distinguishes between binary " "and text I/O. Files opened in binary mode (including ``'b'`` in the *mode* " @@ -2383,7 +2391,7 @@ msgstr "" "``'t'``),檔案的內容會以 :class:`str` 回傳,其位元組已經先被解碼,使用的是取" "決於平台的編碼系統或是給定的 *encoding*。" -#: ../../library/functions.rst:1371 +#: ../../library/functions.rst:1382 msgid "" "Python doesn't depend on the underlying operating system's notion of text " "files; all the processing is done by Python itself, and is therefore " @@ -2392,7 +2400,7 @@ msgstr "" "Python 不會使用底層作業系統對於文字檔案的操作概念;所有的處理都是由 Python 獨" "自完成的,因此能獨立於不同平台。" -#: ../../library/functions.rst:1375 +#: ../../library/functions.rst:1386 msgid "" "*buffering* is an optional integer used to set the buffering policy. Pass 0 " "to switch buffering off (only allowed in binary mode), 1 to select line " @@ -2413,7 +2421,7 @@ msgstr "" "``write_through`` 旗標。若未給定 *buffering* 引數,則預設的緩衝策略會運作如" "下:" -#: ../../library/functions.rst:1385 +#: ../../library/functions.rst:1396 msgid "" "Binary files are buffered in fixed-size chunks; the size of the buffer is " "chosen using a heuristic trying to determine the underlying device's \"block " @@ -2425,7 +2433,7 @@ msgstr "" "DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 8192 個位元" "組。" -#: ../../library/functions.rst:1390 +#: ../../library/functions.rst:1401 msgid "" "\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` " "returns ``True``) use line buffering. Other text files use the policy " @@ -2434,7 +2442,7 @@ msgstr "" "「互動式」文字檔(:meth:`~io.IOBase.isatty` 回傳 ``True`` 的檔案)會使用列緩" "衝。其他文字檔則使用上述的二進制檔案緩衝策略。" -#: ../../library/functions.rst:1394 +#: ../../library/functions.rst:1405 msgid "" "*encoding* is the name of the encoding used to decode or encode the file. " "This should only be used in text mode. The default encoding is platform " @@ -2447,7 +2455,7 @@ msgstr "" "Python 支援的任何 :term:`text encoding`\\ (文字編碼)都是可以使用的。關於支" "援的編碼系統清單,請參閱 :mod:`codecs` module。" -#: ../../library/functions.rst:1400 +#: ../../library/functions.rst:1411 msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled—this cannot be used in binary mode. A variety of " @@ -2460,7 +2468,7 @@ msgstr "" "handlers`\\ 有列出清單),不過任何已註冊到 :func:`codecs.register_error` 的錯" "誤處理程式名稱也都是有效的。標準的名稱包括:" -#: ../../library/functions.rst:1408 +#: ../../library/functions.rst:1419 msgid "" "``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding " "error. The default value of ``None`` has the same effect." @@ -2468,20 +2476,20 @@ msgstr "" "``'strict'`` 如果發生編碼錯誤,則引發 :exc:`ValueError` 例外。預設值 " "``None`` 也有相同的效果。" -#: ../../library/functions.rst:1412 +#: ../../library/functions.rst:1423 msgid "" "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to " "data loss." msgstr "``'ignore'`` 忽略錯誤。請注意,忽略編碼錯誤可能導致資料遺失。" -#: ../../library/functions.rst:1415 +#: ../../library/functions.rst:1426 msgid "" "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted " "where there is malformed data." msgstr "" "``'replace'`` 會在格式不正確的資料位置插入一個替換標誌(像是 ``'?'``)。" -#: ../../library/functions.rst:1418 +#: ../../library/functions.rst:1429 msgid "" "``'surrogateescape'`` will represent any incorrect bytes as low surrogate " "code units ranging from U+DC80 to U+DCFF. These surrogate code units will " @@ -2494,7 +2502,7 @@ msgstr "" "被還原回 ``surrogateescape`` 錯誤處理程式當時所處理的那些相同位元組。這對於處" "理未知編碼方式的檔案會很好用。" -#: ../../library/functions.rst:1425 +#: ../../library/functions.rst:1436 msgid "" "``'xmlcharrefreplace'`` is only supported when writing to a file. Characters " "not supported by the encoding are replaced with the appropriate XML " @@ -2503,7 +2511,7 @@ msgstr "" "``'xmlcharrefreplace'`` 僅在寫入檔案時可支援。編碼系統不支援的字元會被替換為" "適當的 XML 字元參考 (character reference) ``&#nnn;``。" -#: ../../library/functions.rst:1429 +#: ../../library/functions.rst:1440 msgid "" "``'backslashreplace'`` replaces malformed data by Python's backslashed " "escape sequences." @@ -2511,7 +2519,7 @@ msgstr "" "``'backslashreplace'`` 會用 Python 的反斜線跳脫序列 (backslashed escape " "sequence) 替換格式不正確的資料。" -#: ../../library/functions.rst:1432 +#: ../../library/functions.rst:1443 msgid "" "``'namereplace'`` (also only supported when writing) replaces unsupported " "characters with ``\\N{...}`` escape sequences." @@ -2519,7 +2527,7 @@ msgstr "" "``'namereplace'``\\ (也僅在寫入時支援)會將不支援的字元替換為 ``\\N{...}`` " "跳脫序列。" -#: ../../library/functions.rst:1440 +#: ../../library/functions.rst:1451 msgid "" "*newline* determines how to parse newline characters from the stream. It can " "be ``None``, ``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as " @@ -2528,7 +2536,7 @@ msgstr "" "*newline* 會決定如何剖析資料串流 (stream) 中的換行字元。它可以是 ``None``、" "``''``、``'\\n'``、``'\\r'`` 或 ``'\\r\\n'``。它的運作規則如下:" -#: ../../library/functions.rst:1444 +#: ../../library/functions.rst:1455 msgid "" "When reading input from the stream, if *newline* is ``None``, universal " "newlines mode is enabled. Lines in the input can end in ``'\\n'``, " @@ -2544,7 +2552,7 @@ msgstr "" "傳給呼叫方時,行尾符號不會被轉換。如果它是任何其他有效的值,則輸入資料的行只" "會由給定的字串做結尾,且在回傳給呼叫方時,行尾符號不會被轉換。" -#: ../../library/functions.rst:1452 +#: ../../library/functions.rst:1463 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -2557,7 +2565,7 @@ msgstr "" "``''`` 或 ``'\\n'``,則不做任何轉換。如果 *newline* 是任何其他有效的值,則寫" "入的任何 ``'\\n'`` 字元都將轉換為給定的字串。" -#: ../../library/functions.rst:1458 +#: ../../library/functions.rst:1469 msgid "" "If *closefd* is ``False`` and a file descriptor rather than a filename was " "given, the underlying file descriptor will be kept open when the file is " @@ -2568,7 +2576,7 @@ msgstr "" "則當檔案關閉時,底層的檔案描述器會保持開啟狀態。如果有給定一個檔名,則 " "*closefd* 必須是 ``True``\\ (預設值);否則將引發錯誤。" -#: ../../library/functions.rst:1463 +#: ../../library/functions.rst:1474 msgid "" "A custom opener can be used by passing a callable as *opener*. The " "underlying file descriptor for the file object is then obtained by calling " @@ -2581,11 +2589,11 @@ msgstr "" "必須回傳一個開啟的檔案描述器(將 :mod:`os.open` 作為 *opener* 傳入,在功能上" "的結果會相當於傳入 ``None``)。" -#: ../../library/functions.rst:1469 +#: ../../library/functions.rst:1480 msgid "The newly created file is :ref:`non-inheritable `." msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" -#: ../../library/functions.rst:1471 +#: ../../library/functions.rst:1482 msgid "" "The following example uses the :ref:`dir_fd ` parameter of the :func:" "`os.open` function to open a file relative to a given directory::" @@ -2593,7 +2601,7 @@ msgstr "" "下面的範例使用 :func:`os.open` 函式回傳值當作 :ref:`dir_fd ` 的參數," "從給定的目錄中用相對路徑開啟檔案: ::" -#: ../../library/functions.rst:1474 +#: ../../library/functions.rst:1485 msgid "" ">>> import os\n" ">>> dir_fd = os.open('somedir', os.O_RDONLY)\n" @@ -2606,7 +2614,7 @@ msgid "" ">>> os.close(dir_fd) # don't leak a file descriptor" msgstr "" -#: ../../library/functions.rst:1484 +#: ../../library/functions.rst:1495 msgid "" "The type of :term:`file object` returned by the :func:`open` function " "depends on the mode. When :func:`open` is used to open a file in a text " @@ -2630,7 +2638,7 @@ msgstr "" "BufferedRandom`。當緩衝被停用時,會回傳原始資料串流 :class:`io.FileIO`,它" "是 :class:`io.RawIOBase` 的一個 subclass。" -#: ../../library/functions.rst:1505 +#: ../../library/functions.rst:1516 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " "(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" @@ -2640,7 +2648,7 @@ msgstr "" "`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以及 :mod:" "`shutil`。" -#: ../../library/functions.rst:1509 +#: ../../library/functions.rst:1520 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." @@ -2648,25 +2656,25 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " "` ``open``。" -#: ../../library/functions.rst:1511 +#: ../../library/functions.rst:1522 msgid "" "The ``mode`` and ``flags`` arguments may have been modified or inferred from " "the original call." msgstr "``mode`` 和 ``flags`` 引數可能會被原始的呼叫所修改或推論 (infer)。" -#: ../../library/functions.rst:1516 +#: ../../library/functions.rst:1527 msgid "The *opener* parameter was added." msgstr "增加了 *opener* 參數。" -#: ../../library/functions.rst:1517 +#: ../../library/functions.rst:1528 msgid "The ``'x'`` mode was added." msgstr "增加了 ``'x'`` 模式。" -#: ../../library/functions.rst:1518 +#: ../../library/functions.rst:1529 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "過去引發的 :exc:`IOError`,現在是 :exc:`OSError` 的別名。" -#: ../../library/functions.rst:1519 +#: ../../library/functions.rst:1530 msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." @@ -2674,11 +2682,11 @@ msgstr "" "如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引發 :exc:" "`FileExistsError`。" -#: ../../library/functions.rst:1524 +#: ../../library/functions.rst:1535 msgid "The file is now non-inheritable." msgstr "檔案在此版本開始是不可繼承的。" -#: ../../library/functions.rst:1528 +#: ../../library/functions.rst:1539 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the function now retries the system call instead of raising an :" @@ -2687,15 +2695,15 @@ msgstr "" "如果系統呼叫被中斷,但訊號處理程式沒有引發例外,此函式現在會重試系統呼叫,而" "不是引發 :exc:`InterruptedError` 例外(原因詳見 :pep:`475`)。" -#: ../../library/functions.rst:1531 +#: ../../library/functions.rst:1542 msgid "The ``'namereplace'`` error handler was added." msgstr "增加了 ``'namereplace'`` 錯誤處理程式。" -#: ../../library/functions.rst:1535 +#: ../../library/functions.rst:1546 msgid "Support added to accept objects implementing :class:`os.PathLike`." msgstr "增加對於實作 :class:`os.PathLike` 物件的支援。" -#: ../../library/functions.rst:1536 +#: ../../library/functions.rst:1547 msgid "" "On Windows, opening a console buffer may return a subclass of :class:`io." "RawIOBase` other than :class:`io.FileIO`." @@ -2703,11 +2711,11 @@ msgstr "" "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " "subclass,而不是 :class:`io.FileIO`。" -#: ../../library/functions.rst:1539 +#: ../../library/functions.rst:1550 msgid "The ``'U'`` mode has been removed." msgstr "``'U'`` 模式被移除。" -#: ../../library/functions.rst:1544 +#: ../../library/functions.rst:1555 msgid "" "Given a string representing one Unicode character, return an integer " "representing the Unicode code point of that character. For example, " @@ -2718,7 +2726,7 @@ msgstr "" "``ord('a')`` 回傳整數 ``97``、``ord('€')``\\ (歐元符號)回傳 ``8364``。這" "是 :func:`chr` 的逆函式。" -#: ../../library/functions.rst:1552 +#: ../../library/functions.rst:1563 msgid "" "Return *base* to the power *exp*; if *mod* is present, return *base* to the " "power *exp*, modulo *mod* (computed more efficiently than ``pow(base, exp) % " @@ -2729,7 +2737,7 @@ msgstr "" "*mod* 取餘數(比直接呼叫 ``pow(base, exp) % mod`` 計算更高效)。兩個引數形式" "的 ``pow(exp, exp)`` 等價於次方運算子:``base**exp``。" -#: ../../library/functions.rst:1557 +#: ../../library/functions.rst:1568 msgid "" "The arguments must have numeric types. With mixed operand types, the " "coercion rules for binary arithmetic operators apply. For :class:`int` " @@ -2753,7 +2761,7 @@ msgstr "" "`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 ``pow(-9, 2.0)`` " "會回傳 ``81.0``。" -#: ../../library/functions.rst:1569 +#: ../../library/functions.rst:1580 msgid "" "For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must " "also be of integer type and *mod* must be nonzero. If *mod* is present and " @@ -2766,11 +2774,11 @@ msgstr "" "與 *mod* 互質。在這種情況下,會回傳 ``pow(inv_base, -exp, mod)``,其中 " "*inv_base* 是 *base* 對 *mod* 的模倒數 (inverse modulo)。" -#: ../../library/functions.rst:1575 +#: ../../library/functions.rst:1586 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" msgstr "以下是一個計算 ``38`` 對 ``97`` 取模倒數的範例: ::" -#: ../../library/functions.rst:1577 +#: ../../library/functions.rst:1588 msgid "" ">>> pow(38, -1, mod=97)\n" "23\n" @@ -2782,7 +2790,7 @@ msgstr "" ">>> 23 * 38 % 97 == 1\n" "True" -#: ../../library/functions.rst:1582 +#: ../../library/functions.rst:1593 msgid "" "For :class:`int` operands, the three-argument form of ``pow`` now allows the " "second argument to be negative, permitting computation of modular inverses." @@ -2790,12 +2798,12 @@ msgstr "" "對於 :class:`int` 運算元,現在 ``pow`` 的三引數形式允許第二個引數為負數,也容" "許模倒數的計算。" -#: ../../library/functions.rst:1587 +#: ../../library/functions.rst:1598 msgid "" "Allow keyword arguments. Formerly, only positional arguments were supported." msgstr "允許關鍵字引數。在此之前只支援位置引數。" -#: ../../library/functions.rst:1594 +#: ../../library/functions.rst:1605 msgid "" "Print *objects* to the text stream *file*, separated by *sep* and followed " "by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as " @@ -2804,7 +2812,7 @@ msgstr "" "將 *objects* 列印到文字資料串流 *file*,用 *sep* 分隔並以 *end* 結尾。如果有" "給定 *sep*、*end*、*file* 和 *flush*,那麼它們必須是關鍵字引數的形式。" -#: ../../library/functions.rst:1598 +#: ../../library/functions.rst:1609 msgid "" "All non-keyword arguments are converted to strings like :func:`str` does and " "written to the stream, separated by *sep* and followed by *end*. Both *sep* " @@ -2817,7 +2825,7 @@ msgstr "" "以是 ``None``,這表示使用預設值。如果沒有給定 *objects*,:func:`print` 就只會" "寫入 *end*。" -#: ../../library/functions.rst:1604 +#: ../../library/functions.rst:1615 msgid "" "The *file* argument must be an object with a ``write(string)`` method; if it " "is not present or ``None``, :data:`sys.stdout` will be used. Since printed " @@ -2829,7 +2837,7 @@ msgstr "" "串,所以 :func:`print` 不能用於二進位模式的檔案物件。對於此類物件,請改用 " "``file.write(...)``。" -#: ../../library/functions.rst:1609 +#: ../../library/functions.rst:1620 msgid "" "Output buffering is usually determined by *file*. However, if *flush* is " "true, the stream is forcibly flushed." @@ -2837,15 +2845,15 @@ msgstr "" "輸出緩衝通常會由 *file* 決定。但是如果 *flush* 為 true,則資料串流會被強制清" "除。" -#: ../../library/functions.rst:1613 +#: ../../library/functions.rst:1624 msgid "Added the *flush* keyword argument." msgstr "增加了 *flush* 關鍵字引數。" -#: ../../library/functions.rst:1619 +#: ../../library/functions.rst:1630 msgid "Return a property attribute." msgstr "回傳 property 屬性。" -#: ../../library/functions.rst:1621 +#: ../../library/functions.rst:1632 msgid "" "*fget* is a function for getting an attribute value. *fset* is a function " "for setting an attribute value. *fdel* is a function for deleting an " @@ -2854,11 +2862,11 @@ msgstr "" "*fget* 是一個用於取得屬性值的函式,*fset* 是一個用於設定屬性值的函式,*fdel* " "是一個用於刪除屬性值的函式,而 *doc* 會為該屬性建立一個說明字串。" -#: ../../library/functions.rst:1625 +#: ../../library/functions.rst:1636 msgid "A typical use is to define a managed attribute ``x``::" msgstr "一個典型的用途是定義一個受管理的屬性 ``x``: ::" -#: ../../library/functions.rst:1627 +#: ../../library/functions.rst:1638 msgid "" "class C:\n" " def __init__(self):\n" @@ -2890,7 +2898,7 @@ msgstr "" "\n" " x = property(getx, setx, delx, \"I'm the 'x' property.\")" -#: ../../library/functions.rst:1642 +#: ../../library/functions.rst:1653 msgid "" "If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = " "value`` will invoke the setter, and ``del c.x`` the deleter." @@ -2898,7 +2906,7 @@ msgstr "" "如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會呼叫取得器 (getter),``c.x = " "value`` 會呼叫設定器 (setter),而 ``del c.x`` 會呼叫刪除器 (deleter)。" -#: ../../library/functions.rst:1645 +#: ../../library/functions.rst:1656 msgid "" "If given, *doc* will be the docstring of the property attribute. Otherwise, " "the property will copy *fget*'s docstring (if it exists). This makes it " @@ -2909,7 +2917,7 @@ msgstr "" "*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使用 :func:" "`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" -#: ../../library/functions.rst:1649 +#: ../../library/functions.rst:1660 msgid "" "class Parrot:\n" " def __init__(self):\n" @@ -2921,14 +2929,14 @@ msgid "" " return self._voltage" msgstr "" -#: ../../library/functions.rst:1658 +#: ../../library/functions.rst:1669 msgid "" "The ``@property`` decorator turns the :meth:`!voltage` method into a " "\"getter\" for a read-only attribute with the same name, and it sets the " "docstring for *voltage* to \"Get the current voltage.\"" msgstr "" -#: ../../library/functions.rst:1666 +#: ../../library/functions.rst:1677 msgid "" "A property object has ``getter``, ``setter``, and ``deleter`` methods usable " "as decorators that create a copy of the property with the corresponding " @@ -2936,7 +2944,7 @@ msgid "" "with an example:" msgstr "" -#: ../../library/functions.rst:1671 +#: ../../library/functions.rst:1682 msgid "" "class C:\n" " def __init__(self):\n" @@ -2972,36 +2980,36 @@ msgstr "" " def x(self):\n" " del self._x" -#: ../../library/functions.rst:1690 +#: ../../library/functions.rst:1701 msgid "" "This code is exactly equivalent to the first example. Be sure to give the " "additional functions the same name as the original property (``x`` in this " "case.)" msgstr "" -#: ../../library/functions.rst:1694 +#: ../../library/functions.rst:1705 msgid "" "The returned property object also has the attributes ``fget``, ``fset``, and " "``fdel`` corresponding to the constructor arguments." msgstr "" -#: ../../library/functions.rst:1697 +#: ../../library/functions.rst:1708 msgid "The docstrings of property objects are now writeable." msgstr "" -#: ../../library/functions.rst:1702 +#: ../../library/functions.rst:1713 msgid "" "Attribute holding the name of the property. The name of the property can be " "changed at runtime." msgstr "" -#: ../../library/functions.rst:1713 +#: ../../library/functions.rst:1724 msgid "" "Rather than being a function, :class:`range` is actually an immutable " "sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:1719 +#: ../../library/functions.rst:1730 msgid "" "Return a string containing a printable representation of an object. For " "many types, this function makes an attempt to return a string that would " @@ -3014,11 +3022,11 @@ msgid "" "raise :exc:`RuntimeError`." msgstr "" -#: ../../library/functions.rst:1730 +#: ../../library/functions.rst:1741 msgid "This class has a custom representation that can be evaluated::" msgstr "" -#: ../../library/functions.rst:1732 +#: ../../library/functions.rst:1743 msgid "" "class Person:\n" " def __init__(self, name, age):\n" @@ -3036,7 +3044,7 @@ msgstr "" " def __repr__(self):\n" " return f\"Person('{self.name}', {self.age})\"" -#: ../../library/functions.rst:1743 +#: ../../library/functions.rst:1754 msgid "" "Return a reverse :term:`iterator`. *seq* must be an object which has a :" "meth:`~object.__reversed__` method or supports the sequence protocol (the :" @@ -3044,14 +3052,14 @@ msgid "" "with integer arguments starting at ``0``)." msgstr "" -#: ../../library/functions.rst:1751 +#: ../../library/functions.rst:1762 msgid "" "Return *number* rounded to *ndigits* precision after the decimal point. If " "*ndigits* is omitted or is ``None``, it returns the nearest integer to its " "input." msgstr "" -#: ../../library/functions.rst:1755 +#: ../../library/functions.rst:1766 msgid "" "For the built-in types supporting :func:`round`, values are rounded to the " "closest multiple of 10 to the power minus *ndigits*; if two multiples are " @@ -3062,13 +3070,13 @@ msgid "" "``None``. Otherwise, the return value has the same type as *number*." msgstr "" -#: ../../library/functions.rst:1764 +#: ../../library/functions.rst:1775 msgid "" "For a general Python object ``number``, ``round`` delegates to ``number." "__round__``." msgstr "" -#: ../../library/functions.rst:1769 +#: ../../library/functions.rst:1780 msgid "" "The behavior of :func:`round` for floats can be surprising: for example, " "``round(2.675, 2)`` gives ``2.67`` instead of the expected ``2.68``. This is " @@ -3077,21 +3085,21 @@ msgid "" "information." msgstr "" -#: ../../library/functions.rst:1781 +#: ../../library/functions.rst:1792 msgid "" "Return a new :class:`set` object, optionally with elements taken from " "*iterable*. ``set`` is a built-in class. See :class:`set` and :ref:`types-" "set` for documentation about this class." msgstr "" -#: ../../library/functions.rst:1785 +#: ../../library/functions.rst:1796 msgid "" "For other containers see the built-in :class:`frozenset`, :class:`list`, :" "class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` " "module." msgstr "" -#: ../../library/functions.rst:1792 +#: ../../library/functions.rst:1803 msgid "" "This is the counterpart of :func:`getattr`. The arguments are an object, a " "string, and an arbitrary value. The string may name an existing attribute " @@ -3100,7 +3108,7 @@ msgid "" "is equivalent to ``x.foobar = 123``." msgstr "" -#: ../../library/functions.rst:1798 +#: ../../library/functions.rst:1809 msgid "" "*name* need not be a Python identifier as defined in :ref:`identifiers` " "unless the object chooses to enforce that, for example in a custom :meth:" @@ -3109,21 +3117,21 @@ msgid "" "notation, but is accessible through :func:`getattr` etc.." msgstr "" -#: ../../library/functions.rst:1806 +#: ../../library/functions.rst:1817 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " "with two leading underscores) name in order to set it with :func:`setattr`." msgstr "" -#: ../../library/functions.rst:1815 +#: ../../library/functions.rst:1826 msgid "" "Return a :term:`slice` object representing the set of indices specified by " "``range(start, stop, step)``. The *start* and *step* arguments default to " "``None``." msgstr "" -#: ../../library/functions.rst:1823 +#: ../../library/functions.rst:1834 msgid "" "Slice objects have read-only data attributes :attr:`!start`, :attr:`!stop`, " "and :attr:`!step` which merely return the argument values (or their " @@ -3131,48 +3139,48 @@ msgid "" "by NumPy and other third-party packages." msgstr "" -#: ../../library/functions.rst:1828 +#: ../../library/functions.rst:1839 msgid "" "Slice objects are also generated when extended indexing syntax is used. For " "example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See :func:" "`itertools.islice` for an alternate version that returns an :term:`iterator`." msgstr "" -#: ../../library/functions.rst:1833 +#: ../../library/functions.rst:1844 msgid "" "Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:" "`~slice.stop`, and :attr:`~slice.step` are hashable)." msgstr "" -#: ../../library/functions.rst:1839 +#: ../../library/functions.rst:1850 msgid "Return a new sorted list from the items in *iterable*." msgstr "" -#: ../../library/functions.rst:1841 +#: ../../library/functions.rst:1852 msgid "" "Has two optional arguments which must be specified as keyword arguments." msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" -#: ../../library/functions.rst:1843 +#: ../../library/functions.rst:1854 msgid "" "*key* specifies a function of one argument that is used to extract a " "comparison key from each element in *iterable* (for example, ``key=str." "lower``). The default value is ``None`` (compare the elements directly)." msgstr "" -#: ../../library/functions.rst:1847 +#: ../../library/functions.rst:1858 msgid "" "*reverse* is a boolean value. If set to ``True``, then the list elements " "are sorted as if each comparison were reversed." msgstr "" -#: ../../library/functions.rst:1850 +#: ../../library/functions.rst:1861 msgid "" "Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a " "*key* function." msgstr "" -#: ../../library/functions.rst:1853 +#: ../../library/functions.rst:1864 msgid "" "The built-in :func:`sorted` function is guaranteed to be stable. A sort is " "stable if it guarantees not to change the relative order of elements that " @@ -3180,7 +3188,7 @@ msgid "" "example, sort by department, then by salary grade)." msgstr "" -#: ../../library/functions.rst:1858 +#: ../../library/functions.rst:1869 msgid "" "The sort algorithm uses only ``<`` comparisons between items. While " "defining an :meth:`~object.__lt__` method will suffice for sorting, :PEP:`8` " @@ -3192,22 +3200,22 @@ msgid "" "method." msgstr "" -#: ../../library/functions.rst:1867 +#: ../../library/functions.rst:1878 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -#: ../../library/functions.rst:1871 +#: ../../library/functions.rst:1882 msgid "Transform a method into a static method." msgstr "" -#: ../../library/functions.rst:1873 +#: ../../library/functions.rst:1884 msgid "" "A static method does not receive an implicit first argument. To declare a " "static method, use this idiom::" msgstr "" -#: ../../library/functions.rst:1876 +#: ../../library/functions.rst:1887 msgid "" "class C:\n" " @staticmethod\n" @@ -3217,7 +3225,7 @@ msgstr "" " @staticmethod\n" " def f(arg1, arg2, argN): ..." -#: ../../library/functions.rst:1880 +#: ../../library/functions.rst:1891 msgid "" "The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" "`function` for details." @@ -3225,7 +3233,7 @@ msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" -#: ../../library/functions.rst:1883 +#: ../../library/functions.rst:1894 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " "an instance (such as ``C().f()``). Moreover, the static method :term:" @@ -3233,14 +3241,14 @@ msgid "" "(such as ``f()``)." msgstr "" -#: ../../library/functions.rst:1888 +#: ../../library/functions.rst:1899 msgid "" "Static methods in Python are similar to those found in Java or C++. Also, " "see :func:`classmethod` for a variant that is useful for creating alternate " "class constructors." msgstr "" -#: ../../library/functions.rst:1892 +#: ../../library/functions.rst:1903 msgid "" "Like all decorators, it is also possible to call ``staticmethod`` as a " "regular function and do something with its result. This is needed in some " @@ -3249,7 +3257,7 @@ msgid "" "cases, use this idiom::" msgstr "" -#: ../../library/functions.rst:1898 +#: ../../library/functions.rst:1909 msgid "" "def regular_function():\n" " ...\n" @@ -3263,11 +3271,11 @@ msgstr "" "class C:\n" " method = staticmethod(regular_function)" -#: ../../library/functions.rst:1904 +#: ../../library/functions.rst:1915 msgid "For more information on static methods, see :ref:`types`." msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" -#: ../../library/functions.rst:1906 +#: ../../library/functions.rst:1917 msgid "" "Static methods now inherit the method attributes (:attr:`~function." "__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" @@ -3279,25 +3287,25 @@ msgstr "" "__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " "``__wrapped__`` 屬性,且為如一般函式的可呼叫物件。" -#: ../../library/functions.rst:1922 +#: ../../library/functions.rst:1933 msgid "" "Return a :class:`str` version of *object*. See :func:`str` for details." msgstr "" -#: ../../library/functions.rst:1924 +#: ../../library/functions.rst:1935 msgid "" "``str`` is the built-in string :term:`class`. For general information about " "strings, see :ref:`textseq`." msgstr "" -#: ../../library/functions.rst:1930 +#: ../../library/functions.rst:1941 msgid "" "Sums *start* and the items of an *iterable* from left to right and returns " "the total. The *iterable*'s items are normally numbers, and the start value " "is not allowed to be a string." msgstr "" -#: ../../library/functions.rst:1934 +#: ../../library/functions.rst:1945 msgid "" "For some use cases, there are good alternatives to :func:`sum`. The " "preferred, fast way to concatenate a sequence of strings is by calling ``''." @@ -3306,37 +3314,37 @@ msgid "" "using :func:`itertools.chain`." msgstr "" -#: ../../library/functions.rst:1940 +#: ../../library/functions.rst:1951 msgid "The *start* parameter can be specified as a keyword argument." msgstr "*start* 參數可被指定為關鍵字引數。" -#: ../../library/functions.rst:1943 +#: ../../library/functions.rst:1954 msgid "" "Summation of floats switched to an algorithm that gives higher accuracy and " "better commutativity on most builds." msgstr "" -#: ../../library/functions.rst:1950 +#: ../../library/functions.rst:1961 msgid "" "Return a proxy object that delegates method calls to a parent or sibling " "class of *type*. This is useful for accessing inherited methods that have " "been overridden in a class." msgstr "" -#: ../../library/functions.rst:1954 +#: ../../library/functions.rst:1965 msgid "" "The *object_or_type* determines the :term:`method resolution order` to be " "searched. The search starts from the class right after the *type*." msgstr "" -#: ../../library/functions.rst:1958 +#: ../../library/functions.rst:1969 msgid "" "For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C -" "> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" -#: ../../library/functions.rst:1962 +#: ../../library/functions.rst:1973 msgid "" "The :attr:`~type.__mro__` attribute of the class corresponding to " "*object_or_type* lists the method resolution search order used by both :func:" @@ -3344,7 +3352,7 @@ msgid "" "whenever the inheritance hierarchy is updated." msgstr "" -#: ../../library/functions.rst:1967 +#: ../../library/functions.rst:1978 msgid "" "If the second argument is omitted, the super object returned is unbound. If " "the second argument is an object, ``isinstance(obj, type)`` must be true. " @@ -3352,7 +3360,7 @@ msgid "" "(this is useful for classmethods)." msgstr "" -#: ../../library/functions.rst:1972 +#: ../../library/functions.rst:1983 msgid "" "When called directly within an ordinary method of a class, both arguments " "may be omitted (\"zero-argument :func:`!super`\"). In this case, *type* will " @@ -3362,7 +3370,7 @@ msgid "" "including generator expressions, which implicitly create nested functions.)" msgstr "" -#: ../../library/functions.rst:1979 +#: ../../library/functions.rst:1990 msgid "" "There are two typical use cases for *super*. In a class hierarchy with " "single inheritance, *super* can be used to refer to parent classes without " @@ -3370,7 +3378,7 @@ msgid "" "closely parallels the use of *super* in other programming languages." msgstr "" -#: ../../library/functions.rst:1984 +#: ../../library/functions.rst:1995 msgid "" "The second use case is to support cooperative multiple inheritance in a " "dynamic execution environment. This use case is unique to Python and is not " @@ -3383,11 +3391,11 @@ msgid "" "classes that are unknown prior to runtime)." msgstr "" -#: ../../library/functions.rst:1994 +#: ../../library/functions.rst:2005 msgid "For both use cases, a typical superclass call looks like this::" msgstr "" -#: ../../library/functions.rst:1996 +#: ../../library/functions.rst:2007 msgid "" "class C(B):\n" " def method(self, arg):\n" @@ -3395,14 +3403,14 @@ msgid "" " # super(C, self).method(arg)" msgstr "" -#: ../../library/functions.rst:2001 +#: ../../library/functions.rst:2012 msgid "" "In addition to method lookups, :func:`super` also works for attribute " "lookups. One possible use case for this is calling :term:`descriptors " "` in a parent or sibling class." msgstr "" -#: ../../library/functions.rst:2005 +#: ../../library/functions.rst:2016 msgid "" "Note that :func:`super` is implemented as part of the binding process for " "explicit dotted attribute lookups such as ``super().__getitem__(name)``. It " @@ -3412,7 +3420,7 @@ msgid "" "using statements or operators such as ``super()[name]``." msgstr "" -#: ../../library/functions.rst:2013 +#: ../../library/functions.rst:2024 msgid "" "Also note that, aside from the zero argument form, :func:`super` is not " "limited to use inside methods. The two argument form specifies the " @@ -3422,33 +3430,33 @@ msgid "" "accessing the current instance for ordinary methods." msgstr "" -#: ../../library/functions.rst:2020 +#: ../../library/functions.rst:2031 msgid "" "For practical suggestions on how to design cooperative classes using :func:" "`super`, see `guide to using super() `_." msgstr "" -#: ../../library/functions.rst:2030 +#: ../../library/functions.rst:2041 msgid "" "Rather than being a function, :class:`tuple` is actually an immutable " "sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:2039 +#: ../../library/functions.rst:2050 msgid "" "With one argument, return the type of an *object*. The return value is a " "type object and generally the same object as returned by :attr:`object." "__class__`." msgstr "" -#: ../../library/functions.rst:2043 +#: ../../library/functions.rst:2054 msgid "" "The :func:`isinstance` built-in function is recommended for testing the type " "of an object, because it takes subclasses into account." msgstr "" -#: ../../library/functions.rst:2046 +#: ../../library/functions.rst:2057 msgid "" "With three arguments, return a new type object. This is essentially a " "dynamic form of the :keyword:`class` statement. The *name* string is the " @@ -3461,21 +3469,21 @@ msgid "" "type` objects:" msgstr "" -#: ../../library/functions.rst:2061 +#: ../../library/functions.rst:2072 msgid "See also:" msgstr "" -#: ../../library/functions.rst:2063 +#: ../../library/functions.rst:2074 msgid "" ":ref:`Documentation on attributes and methods on classes `." msgstr "" -#: ../../library/functions.rst:2064 +#: ../../library/functions.rst:2075 msgid ":ref:`bltin-type-objects`" msgstr ":ref:`bltin-type-objects`" -#: ../../library/functions.rst:2066 +#: ../../library/functions.rst:2077 msgid "" "Keyword arguments provided to the three argument form are passed to the " "appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`) " @@ -3483,23 +3491,23 @@ msgid "" "would." msgstr "" -#: ../../library/functions.rst:2071 +#: ../../library/functions.rst:2082 msgid "See also :ref:`class-customization`." msgstr "另請參閱 :ref:`class-customization`。" -#: ../../library/functions.rst:2073 +#: ../../library/functions.rst:2084 msgid "" "Subclasses of :class:`!type` which don't override ``type.__new__`` may no " "longer use the one-argument form to get the type of an object." msgstr "" -#: ../../library/functions.rst:2080 +#: ../../library/functions.rst:2091 msgid "" "Return the :attr:`~object.__dict__` attribute for a module, class, instance, " "or any other object with a :attr:`!__dict__` attribute." msgstr "" -#: ../../library/functions.rst:2083 +#: ../../library/functions.rst:2094 msgid "" "Objects such as modules and instances have an updateable :attr:`~object." "__dict__` attribute; however, other objects may have write restrictions on " @@ -3507,34 +3515,34 @@ msgid "" "MappingProxyType` to prevent direct dictionary updates)." msgstr "" -#: ../../library/functions.rst:2088 +#: ../../library/functions.rst:2099 msgid "Without an argument, :func:`vars` acts like :func:`locals`." msgstr "" -#: ../../library/functions.rst:2090 +#: ../../library/functions.rst:2101 msgid "" "A :exc:`TypeError` exception is raised if an object is specified but it " "doesn't have a :attr:`~object.__dict__` attribute (for example, if its class " "defines the :attr:`~object.__slots__` attribute)." msgstr "" -#: ../../library/functions.rst:2096 +#: ../../library/functions.rst:2107 msgid "" "The result of calling this function without an argument has been updated as " "described for the :func:`locals` builtin." msgstr "" -#: ../../library/functions.rst:2102 +#: ../../library/functions.rst:2113 msgid "" "Iterate over several iterables in parallel, producing tuples with an item " "from each one." msgstr "" -#: ../../library/functions.rst:2105 +#: ../../library/functions.rst:2116 msgid "Example::" msgstr "例如: ::" -#: ../../library/functions.rst:2107 +#: ../../library/functions.rst:2118 msgid "" ">>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):\n" "... print(item)\n" @@ -3550,27 +3558,27 @@ msgstr "" "(2, 'spice')\n" "(3, 'everything nice')" -#: ../../library/functions.rst:2114 +#: ../../library/functions.rst:2125 msgid "" "More formally: :func:`zip` returns an iterator of tuples, where the *i*-th " "tuple contains the *i*-th element from each of the argument iterables." msgstr "" -#: ../../library/functions.rst:2117 +#: ../../library/functions.rst:2128 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " "columns into rows. This is similar to `transposing a matrix `_." msgstr "" -#: ../../library/functions.rst:2121 +#: ../../library/functions.rst:2132 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " "iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" "`list`." msgstr "" -#: ../../library/functions.rst:2125 +#: ../../library/functions.rst:2136 msgid "" "One thing to consider is that the iterables passed to :func:`zip` could have " "different lengths; sometimes by design, and sometimes because of a bug in " @@ -3578,14 +3586,14 @@ msgid "" "approaches to dealing with this issue:" msgstr "" -#: ../../library/functions.rst:2130 +#: ../../library/functions.rst:2141 msgid "" "By default, :func:`zip` stops when the shortest iterable is exhausted. It " "will ignore the remaining items in the longer iterables, cutting off the " "result to the length of the shortest iterable::" msgstr "" -#: ../../library/functions.rst:2134 +#: ../../library/functions.rst:2145 msgid "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" @@ -3593,14 +3601,14 @@ msgstr "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" -#: ../../library/functions.rst:2137 +#: ../../library/functions.rst:2148 msgid "" ":func:`zip` is often used in cases where the iterables are assumed to be of " "equal length. In such cases, it's recommended to use the ``strict=True`` " "option. Its output is the same as regular :func:`zip`::" msgstr "" -#: ../../library/functions.rst:2141 +#: ../../library/functions.rst:2152 msgid "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" @@ -3608,37 +3616,37 @@ msgstr "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" -#: ../../library/functions.rst:2144 +#: ../../library/functions.rst:2155 msgid "" "Unlike the default behavior, it raises a :exc:`ValueError` if one iterable " "is exhausted before the others:" msgstr "" -#: ../../library/functions.rst:2162 +#: ../../library/functions.rst:2173 msgid "" "Without the ``strict=True`` argument, any bug that results in iterables of " "different lengths will be silenced, possibly manifesting as a hard-to-find " "bug in another part of the program." msgstr "" -#: ../../library/functions.rst:2166 +#: ../../library/functions.rst:2177 msgid "" "Shorter iterables can be padded with a constant value to make all the " "iterables have the same length. This is done by :func:`itertools." "zip_longest`." msgstr "" -#: ../../library/functions.rst:2170 +#: ../../library/functions.rst:2181 msgid "" "Edge cases: With a single iterable argument, :func:`zip` returns an iterator " "of 1-tuples. With no arguments, it returns an empty iterator." msgstr "" -#: ../../library/functions.rst:2173 +#: ../../library/functions.rst:2184 msgid "Tips and tricks:" msgstr "" -#: ../../library/functions.rst:2175 +#: ../../library/functions.rst:2186 msgid "" "The left-to-right evaluation order of the iterables is guaranteed. This " "makes possible an idiom for clustering a data series into n-length groups " @@ -3647,13 +3655,13 @@ msgid "" "iterator. This has the effect of dividing the input into n-length chunks." msgstr "" -#: ../../library/functions.rst:2181 +#: ../../library/functions.rst:2192 msgid "" ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " "list::" msgstr "" -#: ../../library/functions.rst:2184 +#: ../../library/functions.rst:2195 msgid "" ">>> x = [1, 2, 3]\n" ">>> y = [4, 5, 6]\n" @@ -3671,17 +3679,17 @@ msgstr "" ">>> x == list(x2) and y == list(y2)\n" "True" -#: ../../library/functions.rst:2192 +#: ../../library/functions.rst:2203 msgid "Added the ``strict`` argument." msgstr "增加了 ``strict`` 引數。" -#: ../../library/functions.rst:2204 +#: ../../library/functions.rst:2215 msgid "" "This is an advanced function that is not needed in everyday Python " "programming, unlike :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2207 +#: ../../library/functions.rst:2218 msgid "" "This function is invoked by the :keyword:`import` statement. It can be " "replaced (by importing the :mod:`builtins` module and assigning to " @@ -3693,7 +3701,7 @@ msgid "" "discouraged in favor of :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2216 +#: ../../library/functions.rst:2227 msgid "" "The function imports the module *name*, potentially using the given " "*globals* and *locals* to determine how to interpret the name in a package " @@ -3703,7 +3711,7 @@ msgid "" "determine the package context of the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2223 +#: ../../library/functions.rst:2234 msgid "" "*level* specifies whether to use absolute or relative imports. ``0`` (the " "default) means only perform absolute imports. Positive values for *level* " @@ -3712,7 +3720,7 @@ msgid "" "details)." msgstr "" -#: ../../library/functions.rst:2229 +#: ../../library/functions.rst:2240 msgid "" "When the *name* variable is of the form ``package.module``, normally, the " "top-level package (the name up till the first dot) is returned, *not* the " @@ -3720,37 +3728,37 @@ msgid "" "given, the module named by *name* is returned." msgstr "" -#: ../../library/functions.rst:2234 +#: ../../library/functions.rst:2245 msgid "" "For example, the statement ``import spam`` results in bytecode resembling " "the following code::" msgstr "" -#: ../../library/functions.rst:2237 +#: ../../library/functions.rst:2248 msgid "spam = __import__('spam', globals(), locals(), [], 0)" msgstr "spam = __import__('spam', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2239 +#: ../../library/functions.rst:2250 msgid "The statement ``import spam.ham`` results in this call::" msgstr "" -#: ../../library/functions.rst:2241 +#: ../../library/functions.rst:2252 msgid "spam = __import__('spam.ham', globals(), locals(), [], 0)" msgstr "spam = __import__('spam.ham', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2243 +#: ../../library/functions.rst:2254 msgid "" "Note how :func:`__import__` returns the toplevel module here because this is " "the object that is bound to a name by the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2246 +#: ../../library/functions.rst:2257 msgid "" "On the other hand, the statement ``from spam.ham import eggs, sausage as " "saus`` results in ::" msgstr "" -#: ../../library/functions.rst:2249 +#: ../../library/functions.rst:2260 msgid "" "_temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)\n" "eggs = _temp.eggs\n" @@ -3760,36 +3768,36 @@ msgstr "" "eggs = _temp.eggs\n" "saus = _temp.sausage" -#: ../../library/functions.rst:2253 +#: ../../library/functions.rst:2264 msgid "" "Here, the ``spam.ham`` module is returned from :func:`__import__`. From " "this object, the names to import are retrieved and assigned to their " "respective names." msgstr "" -#: ../../library/functions.rst:2257 +#: ../../library/functions.rst:2268 msgid "" "If you simply want to import a module (potentially within a package) by " "name, use :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2260 +#: ../../library/functions.rst:2271 msgid "" "Negative values for *level* are no longer supported (which also changes the " "default value to 0)." msgstr "" -#: ../../library/functions.rst:2264 +#: ../../library/functions.rst:2275 msgid "" "When the command line options :option:`-E` or :option:`-I` are being used, " "the environment variable :envvar:`PYTHONCASEOK` is now ignored." msgstr "" -#: ../../library/functions.rst:2269 +#: ../../library/functions.rst:2280 msgid "Footnotes" msgstr "註解" -#: ../../library/functions.rst:2270 +#: ../../library/functions.rst:2281 msgid "" "Note that the parser only accepts the Unix-style end of line convention. If " "you are reading the code from a file, make sure to use newline conversion " @@ -3802,107 +3810,107 @@ msgstr "" msgid "Boolean" msgstr "Boolean(布林值)" -#: ../../library/functions.rst:154 ../../library/functions.rst:2037 +#: ../../library/functions.rst:154 ../../library/functions.rst:2048 msgid "type" msgstr "type(型別)" -#: ../../library/functions.rst:643 +#: ../../library/functions.rst:648 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/functions.rst:643 +#: ../../library/functions.rst:648 msgid "exec" msgstr "exec" -#: ../../library/functions.rst:736 +#: ../../library/functions.rst:746 msgid "NaN" msgstr "NaN" -#: ../../library/functions.rst:736 +#: ../../library/functions.rst:746 msgid "Infinity" msgstr "Infinity(無窮)" -#: ../../library/functions.rst:804 +#: ../../library/functions.rst:814 msgid "__format__" msgstr "__format__" -#: ../../library/functions.rst:804 ../../library/functions.rst:1914 +#: ../../library/functions.rst:814 ../../library/functions.rst:1925 msgid "string" msgstr "string(字串)" -#: ../../library/functions.rst:804 +#: ../../library/functions.rst:814 msgid "format() (built-in function)" msgstr "format()(內建函式)" -#: ../../library/functions.rst:1314 +#: ../../library/functions.rst:1325 msgid "file object" msgstr "file object(檔案物件)" -#: ../../library/functions.rst:1314 ../../library/functions.rst:1435 +#: ../../library/functions.rst:1325 ../../library/functions.rst:1446 msgid "open() built-in function" msgstr "open() 內建函式" -#: ../../library/functions.rst:1342 +#: ../../library/functions.rst:1353 msgid "file" msgstr "file(檔案)" -#: ../../library/functions.rst:1342 +#: ../../library/functions.rst:1353 msgid "modes" msgstr "modes(模式)" -#: ../../library/functions.rst:1435 +#: ../../library/functions.rst:1446 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/functions.rst:1496 +#: ../../library/functions.rst:1507 msgid "line-buffered I/O" msgstr "line-buffered I/O(行緩衝 I/O)" -#: ../../library/functions.rst:1496 +#: ../../library/functions.rst:1507 msgid "unbuffered I/O" msgstr "unbuffered I/O(非緩衝 I/O)" -#: ../../library/functions.rst:1496 +#: ../../library/functions.rst:1507 msgid "buffer size, I/O" msgstr "buffer size, I/O(緩衝區大小、I/O)" -#: ../../library/functions.rst:1496 +#: ../../library/functions.rst:1507 msgid "I/O control" msgstr "I/O control(I/O 控制)" -#: ../../library/functions.rst:1496 +#: ../../library/functions.rst:1507 msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/functions.rst:1496 +#: ../../library/functions.rst:1507 msgid "text mode" msgstr "text mode(文字模式)" -#: ../../library/functions.rst:1496 ../../library/functions.rst:2198 +#: ../../library/functions.rst:1507 ../../library/functions.rst:2209 msgid "module" msgstr "module(模組)" -#: ../../library/functions.rst:1496 +#: ../../library/functions.rst:1507 msgid "sys" msgstr "sys" -#: ../../library/functions.rst:1914 +#: ../../library/functions.rst:1925 msgid "str() (built-in function)" msgstr "str() (內建函式)" -#: ../../library/functions.rst:2037 +#: ../../library/functions.rst:2048 msgid "object" msgstr "object(物件)" -#: ../../library/functions.rst:2198 +#: ../../library/functions.rst:2209 msgid "statement" msgstr "statement(陳述式)" -#: ../../library/functions.rst:2198 +#: ../../library/functions.rst:2209 msgid "import" msgstr "import(引入)" -#: ../../library/functions.rst:2198 +#: ../../library/functions.rst:2209 msgid "builtins" msgstr "builtins(內建)" diff --git a/library/getopt.po b/library/getopt.po index f4467adec5..8ec79f09ad 100644 --- a/library/getopt.po +++ b/library/getopt.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-11-05 00:13+0000\n" "PO-Revision-Date: 2016-01-31 07:19+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -132,15 +131,65 @@ msgstr "" msgid "An example using only Unix style options:" msgstr "" -#: ../../library/getopt.rst:110 +#: ../../library/getopt.rst:100 +msgid "" +">>> import getopt\n" +">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n" +">>> args\n" +"['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2']\n" +">>> optlist, args = getopt.getopt(args, 'abc:d:')\n" +">>> optlist\n" +"[('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]\n" +">>> args\n" +"['a1', 'a2']" +msgstr "" +">>> import getopt\n" +">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n" +">>> args\n" +"['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2']\n" +">>> optlist, args = getopt.getopt(args, 'abc:d:')\n" +">>> optlist\n" +"[('-a', ''), ('-b', ''), ('-c', 'foo'), ('-d', 'bar')]\n" +">>> args\n" +"['a1', 'a2']" + +#: ../../library/getopt.rst:112 msgid "Using long option names is equally easy:" msgstr "" -#: ../../library/getopt.rst:123 -msgid "In a script, typical usage is something like this::" +#: ../../library/getopt.rst:114 +msgid "" +">>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'\n" +">>> args = s.split()\n" +">>> args\n" +"['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', " +"'a2']\n" +">>> optlist, args = getopt.getopt(args, 'x', [\n" +"... 'condition=', 'output-file=', 'testing'])\n" +">>> optlist\n" +"[('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-" +"x', '')]\n" +">>> args\n" +"['a1', 'a2']" +msgstr "" +">>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'\n" +">>> args = s.split()\n" +">>> args\n" +"['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', " +"'a2']\n" +">>> optlist, args = getopt.getopt(args, 'x', [\n" +"... 'condition=', 'output-file=', 'testing'])\n" +">>> optlist\n" +"[('--condition', 'foo'), ('--testing', ''), ('--output-file', 'abc.def'), ('-" +"x', '')]\n" +">>> args\n" +"['a1', 'a2']" + +#: ../../library/getopt.rst:127 +msgid "In a script, typical usage is something like this:" msgstr "" -#: ../../library/getopt.rst:125 +#: ../../library/getopt.rst:129 msgid "" "import getopt, sys\n" "\n" @@ -171,15 +220,42 @@ msgid "" "if __name__ == \"__main__\":\n" " main()" msgstr "" +"import getopt, sys\n" +"\n" +"def main():\n" +" try:\n" +" opts, args = getopt.getopt(sys.argv[1:], \"ho:v\", [\"help\", " +"\"output=\"])\n" +" except getopt.GetoptError as err:\n" +" # 印出幫助訊息並退出:\n" +" print(err) # 會印出像是 \"option -a not recognized\" 的訊息\n" +" usage()\n" +" sys.exit(2)\n" +" output = None\n" +" verbose = False\n" +" for o, a in opts:\n" +" if o == \"-v\":\n" +" verbose = True\n" +" elif o in (\"-h\", \"--help\"):\n" +" usage()\n" +" sys.exit()\n" +" elif o in (\"-o\", \"--output\"):\n" +" output = a\n" +" else:\n" +" assert False, \"unhandled option\"\n" +" # ...\n" +"\n" +"if __name__ == \"__main__\":\n" +" main()" -#: ../../library/getopt.rst:152 +#: ../../library/getopt.rst:158 msgid "" "Note that an equivalent command line interface could be produced with less " "code and more informative help and error messages by using the :mod:" -"`argparse` module::" +"`argparse` module:" msgstr "" -#: ../../library/getopt.rst:155 +#: ../../library/getopt.rst:161 msgid "" "import argparse\n" "\n" @@ -192,10 +268,10 @@ msgid "" " # ... do something with args.verbose .." msgstr "" -#: ../../library/getopt.rst:167 +#: ../../library/getopt.rst:175 msgid "Module :mod:`argparse`" msgstr ":mod:`argparse` 模組" -#: ../../library/getopt.rst:168 +#: ../../library/getopt.rst:176 msgid "Alternative command line option and argument parsing library." msgstr "" diff --git a/library/glob.po b/library/glob.po index 08c7f860d9..287f0efe19 100644 --- a/library/glob.po +++ b/library/glob.po @@ -186,7 +186,7 @@ msgstr "" #: ../../library/glob.rst:131 msgid "For example:" -msgstr "" +msgstr "舉例來說:" #: ../../library/glob.rst:142 msgid "" @@ -221,10 +221,9 @@ msgstr "" #: ../../library/glob.rst:165 msgid "Examples" -msgstr "" +msgstr "範例" #: ../../library/glob.rst:167 -#, fuzzy msgid "" "Consider a directory containing the following files: :file:`1.gif`, :file:`2." "txt`, :file:`card.gif` and a subdirectory :file:`sub` which contains only " @@ -285,10 +284,9 @@ msgstr "" "['.card.gif']" #: ../../library/glob.rst:196 -#, fuzzy msgid "" "The :mod:`fnmatch` module offers shell-style filename (not path) expansion." -msgstr "Shell 風格檔案名(不是路徑)的擴展" +msgstr ":mod:`fnmatch` 模組提供了 shell 風格檔案名(不是路徑)的擴展" #: ../../library/glob.rst:199 msgid "The :mod:`pathlib` module offers high-level path objects." @@ -333,6 +331,3 @@ msgstr ". (點)" #: ../../library/glob.rst:61 msgid "**" msgstr "**" - -#~ msgid "Module :mod:`fnmatch`" -#~ msgstr ":mod:`fnmatch` 模組" diff --git a/library/importlib.metadata.po b/library/importlib.metadata.po index c84bdc92dd..19f0cfe625 100644 --- a/library/importlib.metadata.po +++ b/library/importlib.metadata.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-08 03:35+0000\n" +"POT-Creation-Date: 2024-10-31 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -72,7 +72,7 @@ msgstr "" #: ../../library/importlib.metadata.rst:55 msgid "https://importlib-metadata.readthedocs.io/" -msgstr "" +msgstr "https://importlib-metadata.readthedocs.io/" #: ../../library/importlib.metadata.rst:56 msgid "" @@ -369,13 +369,10 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:231 -msgid "A concrete implementation of the" -msgstr "" - -#: ../../library/importlib.metadata.rst:232 msgid "" -"`PackageMetadata protocol `_." +"A concrete implementation of the `PackageMetadata protocol `_." msgstr "" #: ../../library/importlib.metadata.rst:234 @@ -878,7 +875,7 @@ msgstr "" #: ../../library/importlib.metadata.rst:558 msgid "" -"class DatabaseDistribution(importlib.metadata.Distributon):\n" +"class DatabaseDistribution(importlib.metadata.Distribution):\n" " def __init__(self, record):\n" " self.record = record\n" "\n" diff --git a/library/ipaddress.po b/library/ipaddress.po index a5c2cc8284..f168829f23 100644 --- a/library/ipaddress.po +++ b/library/ipaddress.po @@ -480,7 +480,7 @@ msgstr "" #: ../../library/ipaddress.rst:405 ../../library/ipaddress.rst:789 #: ../../library/ipaddress.rst:925 msgid "Operators" -msgstr "" +msgstr "運算子" #: ../../library/ipaddress.rst:407 msgid "" @@ -491,7 +491,7 @@ msgstr "" #: ../../library/ipaddress.rst:413 msgid "Comparison operators" -msgstr "" +msgstr "比較運算子" #: ../../library/ipaddress.rst:415 msgid "" @@ -526,7 +526,7 @@ msgstr "" #: ../../library/ipaddress.rst:432 msgid "Arithmetic operators" -msgstr "" +msgstr "算術運算子" #: ../../library/ipaddress.rst:434 msgid "" @@ -879,7 +879,7 @@ msgstr "" #: ../../library/ipaddress.rst:804 msgid "Iteration" -msgstr "" +msgstr "疊代" #: ../../library/ipaddress.rst:806 msgid "" diff --git a/library/locale.po b/library/locale.po index c36cbfaff7..6a5c230140 100644 --- a/library/locale.po +++ b/library/locale.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -331,111 +331,110 @@ msgstr "" #: ../../library/locale.rst:161 msgid "" -"Return some locale-specific information as a string (or a tuple for " -"``ALT_DIGITS``). This function is not available on all systems, and the set " -"of possible options might also vary across platforms. The possible argument " -"values are numbers, for which symbolic constants are available in the locale " -"module." +"Return some locale-specific information as a string. This function is not " +"available on all systems, and the set of possible options might also vary " +"across platforms. The possible argument values are numbers, for which " +"symbolic constants are available in the locale module." msgstr "" -#: ../../library/locale.rst:167 +#: ../../library/locale.rst:166 msgid "" "The :func:`nl_langinfo` function accepts one of the following keys. Most " "descriptions are taken from the corresponding description in the GNU C " "library." msgstr "" -#: ../../library/locale.rst:173 +#: ../../library/locale.rst:172 msgid "" "Get a string with the name of the character encoding used in the selected " "locale." msgstr "" -#: ../../library/locale.rst:178 +#: ../../library/locale.rst:177 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent date and time in a locale-specific way." msgstr "" -#: ../../library/locale.rst:183 +#: ../../library/locale.rst:182 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent a date in a locale-specific way." msgstr "" -#: ../../library/locale.rst:188 +#: ../../library/locale.rst:187 msgid "" "Get a string that can be used as a format string for :func:`time.strftime` " "to represent a time in a locale-specific way." msgstr "" -#: ../../library/locale.rst:193 +#: ../../library/locale.rst:192 msgid "" "Get a format string for :func:`time.strftime` to represent time in the am/pm " "format." msgstr "" -#: ../../library/locale.rst:204 +#: ../../library/locale.rst:203 msgid "Get the name of the n-th day of the week." msgstr "" -#: ../../library/locale.rst:208 +#: ../../library/locale.rst:207 msgid "" "This follows the US convention of :const:`DAY_1` being Sunday, not the " "international convention (ISO 8601) that Monday is the first day of the week." msgstr "" -#: ../../library/locale.rst:220 +#: ../../library/locale.rst:219 msgid "Get the abbreviated name of the n-th day of the week." msgstr "" -#: ../../library/locale.rst:235 +#: ../../library/locale.rst:234 msgid "Get the name of the n-th month." msgstr "" -#: ../../library/locale.rst:250 +#: ../../library/locale.rst:249 msgid "Get the abbreviated name of the n-th month." msgstr "" -#: ../../library/locale.rst:254 +#: ../../library/locale.rst:253 msgid "Get the radix character (decimal dot, decimal comma, etc.)." msgstr "" -#: ../../library/locale.rst:258 +#: ../../library/locale.rst:257 msgid "Get the separator character for thousands (groups of three digits)." msgstr "" -#: ../../library/locale.rst:262 +#: ../../library/locale.rst:261 msgid "" "Get a regular expression that can be used with the regex function to " "recognize a positive response to a yes/no question." msgstr "" -#: ../../library/locale.rst:267 +#: ../../library/locale.rst:266 msgid "" "Get a regular expression that can be used with the ``regex(3)`` function to " "recognize a negative response to a yes/no question." msgstr "" -#: ../../library/locale.rst:272 +#: ../../library/locale.rst:271 msgid "" "The regular expressions for :const:`YESEXPR` and :const:`NOEXPR` use syntax " "suitable for the ``regex`` function from the C library, which might differ " "from the syntax used in :mod:`re`." msgstr "" -#: ../../library/locale.rst:279 +#: ../../library/locale.rst:278 msgid "" "Get the currency symbol, preceded by \"-\" if the symbol should appear " "before the value, \"+\" if the symbol should appear after the value, or \"." "\" if the symbol should replace the radix character." msgstr "" -#: ../../library/locale.rst:285 +#: ../../library/locale.rst:284 msgid "Get a string that represents the era used in the current locale." msgstr "" -#: ../../library/locale.rst:287 +#: ../../library/locale.rst:286 msgid "" "Most locales do not define this value. An example of a locale which does " "define this value is the Japanese one. In Japan, the traditional " @@ -443,7 +442,7 @@ msgid "" "then-emperor's reign." msgstr "" -#: ../../library/locale.rst:292 +#: ../../library/locale.rst:291 msgid "" "Normally it should not be necessary to use this value directly. Specifying " "the ``E`` modifier in their format strings causes the :func:`time.strftime` " @@ -452,35 +451,38 @@ msgid "" "systems." msgstr "" -#: ../../library/locale.rst:300 +#: ../../library/locale.rst:299 msgid "" "Get a format string for :func:`time.strftime` to represent date and time in " "a locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:305 +#: ../../library/locale.rst:304 msgid "" "Get a format string for :func:`time.strftime` to represent a date in a " "locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:310 +#: ../../library/locale.rst:309 msgid "" "Get a format string for :func:`time.strftime` to represent a time in a " "locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:315 -msgid "Get a tuple of up to 100 strings used to represent the values 0 to 99." +#: ../../library/locale.rst:314 +msgid "" +"Get a string consisting of up to 100 semicolon-separated symbols used to " +"represent the values 0 to 99 in a locale-specific way. In most locales this " +"is an empty string." msgstr "" -#: ../../library/locale.rst:320 +#: ../../library/locale.rst:321 msgid "" "Tries to determine the default locale settings and returns them as a tuple " "of the form ``(language code, encoding)``." msgstr "" -#: ../../library/locale.rst:323 +#: ../../library/locale.rst:324 msgid "" "According to POSIX, a program which has not called ``setlocale(LC_ALL, '')`` " "runs using the portable ``'C'`` locale. Calling ``setlocale(LC_ALL, '')`` " @@ -489,7 +491,7 @@ msgid "" "emulate the behavior in the way described above." msgstr "" -#: ../../library/locale.rst:329 +#: ../../library/locale.rst:330 msgid "" "To maintain compatibility with other platforms, not only the :envvar:`LANG` " "variable is tested, but a list of variables given as envvars parameter. The " @@ -499,21 +501,21 @@ msgid "" "``'LC_CTYPE'``, ``'LANG'`` and ``'LANGUAGE'``, in that order." msgstr "" -#: ../../library/locale.rst:336 ../../library/locale.rst:349 +#: ../../library/locale.rst:337 ../../library/locale.rst:350 msgid "" "Except for the code ``'C'``, the language code corresponds to :rfc:`1766`. " "*language code* and *encoding* may be ``None`` if their values cannot be " "determined." msgstr "" -#: ../../library/locale.rst:345 +#: ../../library/locale.rst:346 msgid "" "Returns the current setting for the given locale category as sequence " "containing *language code*, *encoding*. *category* may be one of the :const:" "`!LC_\\*` values except :const:`LC_ALL`. It defaults to :const:`LC_CTYPE`." msgstr "" -#: ../../library/locale.rst:356 +#: ../../library/locale.rst:357 msgid "" "Return the :term:`locale encoding` used for text data, according to user " "preferences. User preferences are expressed differently on different " @@ -521,72 +523,72 @@ msgid "" "this function only returns a guess." msgstr "" -#: ../../library/locale.rst:361 +#: ../../library/locale.rst:362 msgid "" "On some systems, it is necessary to invoke :func:`setlocale` to obtain the " "user preferences, so this function is not thread-safe. If invoking setlocale " "is not necessary or desired, *do_setlocale* should be set to ``False``." msgstr "" -#: ../../library/locale.rst:365 +#: ../../library/locale.rst:366 msgid "" "On Android or if the :ref:`Python UTF-8 Mode ` is enabled, always " "return ``'utf-8'``, the :term:`locale encoding` and the *do_setlocale* " "argument are ignored." msgstr "" -#: ../../library/locale.rst:369 ../../library/locale.rst:387 +#: ../../library/locale.rst:370 ../../library/locale.rst:388 msgid "" "The :ref:`Python preinitialization ` configures the LC_CTYPE " "locale. See also the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../library/locale.rst:372 +#: ../../library/locale.rst:373 msgid "" "The function now always returns ``\"utf-8\"`` on Android or if the :ref:" "`Python UTF-8 Mode ` is enabled." msgstr "" -#: ../../library/locale.rst:379 +#: ../../library/locale.rst:380 msgid "Get the current :term:`locale encoding`:" msgstr "" -#: ../../library/locale.rst:381 +#: ../../library/locale.rst:382 msgid "On Android and VxWorks, return ``\"utf-8\"``." msgstr "" -#: ../../library/locale.rst:382 +#: ../../library/locale.rst:383 msgid "" "On Unix, return the encoding of the current :data:`LC_CTYPE` locale. Return " "``\"utf-8\"`` if ``nl_langinfo(CODESET)`` returns an empty string: for " "example, if the current LC_CTYPE locale is not supported." msgstr "" -#: ../../library/locale.rst:385 +#: ../../library/locale.rst:386 msgid "On Windows, return the ANSI code page." msgstr "" -#: ../../library/locale.rst:390 +#: ../../library/locale.rst:391 msgid "" "This function is similar to :func:`getpreferredencoding(False) " "` except this function ignores the :ref:`Python UTF-8 " "Mode `." msgstr "" -#: ../../library/locale.rst:399 +#: ../../library/locale.rst:400 msgid "" "Returns a normalized locale code for the given locale name. The returned " "locale code is formatted for use with :func:`setlocale`. If normalization " "fails, the original name is returned unchanged." msgstr "" -#: ../../library/locale.rst:403 +#: ../../library/locale.rst:404 msgid "" "If the given encoding is not known, the function defaults to the default " "encoding for the locale code just like :func:`setlocale`." msgstr "" -#: ../../library/locale.rst:409 +#: ../../library/locale.rst:410 msgid "" "Compares two strings according to the current :const:`LC_COLLATE` setting. " "As any other compare function, returns a negative, or a positive value, or " @@ -594,7 +596,7 @@ msgid "" "is equal to it." msgstr "" -#: ../../library/locale.rst:417 +#: ../../library/locale.rst:418 msgid "" "Transforms a string to one that can be used in locale-aware comparisons. " "For example, ``strxfrm(s1) < strxfrm(s2)`` is equivalent to ``strcoll(s1, " @@ -602,7 +604,7 @@ msgid "" "repeatedly, e.g. when collating a sequence of strings." msgstr "" -#: ../../library/locale.rst:426 +#: ../../library/locale.rst:427 msgid "" "Formats a number *val* according to the current :const:`LC_NUMERIC` setting. " "The format follows the conventions of the ``%`` operator. For floating-" @@ -610,29 +612,29 @@ msgid "" "is ``True``, also takes the grouping into account." msgstr "" -#: ../../library/locale.rst:431 +#: ../../library/locale.rst:432 msgid "" "If *monetary* is true, the conversion uses monetary thousands separator and " "grouping strings." msgstr "" -#: ../../library/locale.rst:434 +#: ../../library/locale.rst:435 msgid "" "Processes formatting specifiers as in ``format % val``, but takes the " "current locale settings into account." msgstr "" -#: ../../library/locale.rst:437 +#: ../../library/locale.rst:438 msgid "The *monetary* keyword parameter was added." msgstr "" -#: ../../library/locale.rst:443 +#: ../../library/locale.rst:444 msgid "" "Formats a number *val* according to the current :const:`LC_MONETARY` " "settings." msgstr "" -#: ../../library/locale.rst:445 +#: ../../library/locale.rst:446 msgid "" "The returned string includes the currency symbol if *symbol* is true, which " "is the default. If *grouping* is ``True`` (which is not the default), " @@ -640,43 +642,43 @@ msgid "" "not the default), the international currency symbol is used." msgstr "" -#: ../../library/locale.rst:452 +#: ../../library/locale.rst:453 msgid "" "This function will not work with the 'C' locale, so you have to set a locale " "via :func:`setlocale` first." msgstr "" -#: ../../library/locale.rst:458 +#: ../../library/locale.rst:459 msgid "" "Formats a floating-point number using the same format as the built-in " "function ``str(float)``, but takes the decimal point into account." msgstr "" -#: ../../library/locale.rst:464 +#: ../../library/locale.rst:465 msgid "" "Converts a string into a normalized number string, following the :const:" "`LC_NUMERIC` settings." msgstr "" -#: ../../library/locale.rst:472 +#: ../../library/locale.rst:473 msgid "" "Converts a normalized number string into a formatted string following the :" "const:`LC_NUMERIC` settings." msgstr "" -#: ../../library/locale.rst:480 +#: ../../library/locale.rst:481 msgid "" "Converts a string to a number, following the :const:`LC_NUMERIC` settings, " "by calling *func* on the result of calling :func:`delocalize` on *string*." msgstr "" -#: ../../library/locale.rst:486 +#: ../../library/locale.rst:487 msgid "" "Converts a string to an integer, following the :const:`LC_NUMERIC` " "conventions." msgstr "" -#: ../../library/locale.rst:491 +#: ../../library/locale.rst:492 msgid "" "Locale category for the character type functions. Most importantly, this " "category defines the text encoding, i.e. how bytes are interpreted as " @@ -686,32 +688,32 @@ msgid "" "SSH connections." msgstr "" -#: ../../library/locale.rst:498 +#: ../../library/locale.rst:499 msgid "" "Python doesn't internally use locale-dependent character transformation " "functions from ``ctype.h``. Instead, an internal ``pyctype.h`` provides " "locale-independent equivalents like :c:macro:`!Py_TOLOWER`." msgstr "" -#: ../../library/locale.rst:505 +#: ../../library/locale.rst:506 msgid "" "Locale category for sorting strings. The functions :func:`strcoll` and :" "func:`strxfrm` of the :mod:`locale` module are affected." msgstr "" -#: ../../library/locale.rst:511 +#: ../../library/locale.rst:512 msgid "" "Locale category for the formatting of time. The function :func:`time." "strftime` follows these conventions." msgstr "" -#: ../../library/locale.rst:517 +#: ../../library/locale.rst:518 msgid "" "Locale category for formatting of monetary values. The available options " "are available from the :func:`localeconv` function." msgstr "" -#: ../../library/locale.rst:523 +#: ../../library/locale.rst:524 msgid "" "Locale category for message display. Python currently does not support " "application specific locale-aware messages. Messages displayed by the " @@ -719,13 +721,13 @@ msgid "" "affected by this category." msgstr "" -#: ../../library/locale.rst:528 +#: ../../library/locale.rst:529 msgid "" "This value may not be available on operating systems not conforming to the " "POSIX standard, most notably Windows." msgstr "" -#: ../../library/locale.rst:534 +#: ../../library/locale.rst:535 msgid "" "Locale category for formatting numbers. The functions :func:" "`format_string`, :func:`atoi`, :func:`atof` and :func:`.str` of the :mod:" @@ -733,7 +735,7 @@ msgid "" "operations are not affected." msgstr "" -#: ../../library/locale.rst:542 +#: ../../library/locale.rst:543 msgid "" "Combination of all locale settings. If this flag is used when the locale is " "changed, setting the locale for all categories is attempted. If that fails " @@ -743,17 +745,17 @@ msgid "" "settings." msgstr "" -#: ../../library/locale.rst:551 +#: ../../library/locale.rst:552 msgid "" "This is a symbolic constant used for different values returned by :func:" "`localeconv`." msgstr "" -#: ../../library/locale.rst:555 +#: ../../library/locale.rst:556 msgid "Example::" msgstr "範例: ::" -#: ../../library/locale.rst:557 +#: ../../library/locale.rst:558 msgid "" ">>> import locale\n" ">>> loc = locale.getlocale() # get current locale\n" @@ -766,11 +768,11 @@ msgid "" ">>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale" msgstr "" -#: ../../library/locale.rst:568 +#: ../../library/locale.rst:569 msgid "Background, details, hints, tips and caveats" msgstr "" -#: ../../library/locale.rst:570 +#: ../../library/locale.rst:571 msgid "" "The C standard defines the locale as a program-wide property that may be " "relatively expensive to change. On top of that, some implementations are " @@ -778,7 +780,7 @@ msgid "" "This makes the locale somewhat painful to use correctly." msgstr "" -#: ../../library/locale.rst:575 +#: ../../library/locale.rst:576 msgid "" "Initially, when a program is started, the locale is the ``C`` locale, no " "matter what the user's preferred locale is. There is one exception: the :" @@ -788,7 +790,7 @@ msgid "" "categories by calling ``setlocale(LC_ALL, '')``." msgstr "" -#: ../../library/locale.rst:582 +#: ../../library/locale.rst:583 msgid "" "It is generally a bad idea to call :func:`setlocale` in some library " "routine, since as a side effect it affects the entire program. Saving and " @@ -796,7 +798,7 @@ msgid "" "that happen to run before the settings have been restored." msgstr "" -#: ../../library/locale.rst:587 +#: ../../library/locale.rst:588 msgid "" "If, when coding a module for general use, you need a locale independent " "version of an operation that is affected by the locale (such as certain " @@ -807,14 +809,14 @@ msgid "" "settings." msgstr "" -#: ../../library/locale.rst:594 +#: ../../library/locale.rst:595 msgid "" "The only way to perform numeric operations according to the locale is to use " "the special functions defined by this module: :func:`atof`, :func:`atoi`, :" "func:`format_string`, :func:`.str`." msgstr "" -#: ../../library/locale.rst:598 +#: ../../library/locale.rst:599 msgid "" "There is no way to perform case conversions and character classifications " "according to the locale. For (Unicode) text strings these are done " @@ -825,11 +827,11 @@ msgid "" "whitespace." msgstr "" -#: ../../library/locale.rst:609 +#: ../../library/locale.rst:610 msgid "For extension writers and programs that embed Python" msgstr "" -#: ../../library/locale.rst:611 +#: ../../library/locale.rst:612 msgid "" "Extension modules should never call :func:`setlocale`, except to find out " "what the current locale is. But since the return value can only be used " @@ -837,7 +839,7 @@ msgid "" "whether or not the locale is ``C``)." msgstr "" -#: ../../library/locale.rst:616 +#: ../../library/locale.rst:617 msgid "" "When Python code uses the :mod:`locale` module to change the locale, this " "also affects the embedding application. If the embedding application " @@ -847,11 +849,11 @@ msgid "" "accessible as a shared library." msgstr "" -#: ../../library/locale.rst:627 +#: ../../library/locale.rst:628 msgid "Access to message catalogs" msgstr "" -#: ../../library/locale.rst:636 +#: ../../library/locale.rst:637 msgid "" "The locale module exposes the C library's gettext interface on systems that " "provide this interface. It consists of the functions :func:`gettext`, :func:" @@ -862,7 +864,7 @@ msgid "" "locating message catalogs." msgstr "" -#: ../../library/locale.rst:643 +#: ../../library/locale.rst:644 msgid "" "Python applications should normally find no need to invoke these functions, " "and should use :mod:`gettext` instead. A known exception to this rule are " diff --git a/library/math.po b/library/math.po index b691fbe5dc..84d6d52e0d 100644 --- a/library/math.po +++ b/library/math.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-11-05 00:13+0000\n" "PO-Revision-Date: 2024-04-26 15:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -52,10 +51,544 @@ msgid "" msgstr "此模組提供下列函式。除非特意註明,否則回傳值皆為浮點數。" #: ../../library/math.rst:30 +msgid "**Number-theoretic and representation functions**" +msgstr "**數論與表現函式**" + +#: ../../library/math.rst:32 +msgid ":func:`ceil(x) `" +msgstr ":func:`ceil(x) `" + +#: ../../library/math.rst:32 +msgid "Ceiling of *x*, the smallest integer greater than or equal to *x*" +msgstr "" + +#: ../../library/math.rst:33 +msgid ":func:`comb(n, k) `" +msgstr ":func:`comb(n, k) `" + +#: ../../library/math.rst:33 +msgid "" +"Number of ways to choose *k* items from *n* items without repetition and " +"without order" +msgstr "從 *n* 個物品中不重複且不考慮排序地取出 *k* 個物品的方法數。" + +#: ../../library/math.rst:34 +msgid ":func:`copysign(x, y) `" +msgstr ":func:`copysign(x, y) `" + +#: ../../library/math.rst:34 +msgid "Magnitude (absolute value) of *x* with the sign of *y*" +msgstr "" + +#: ../../library/math.rst:35 +msgid ":func:`fabs(x) `" +msgstr ":func:`fabs(x) `" + +#: ../../library/math.rst:35 +msgid "Absolute value of *x*" +msgstr "*x* 的絕對值。" + +#: ../../library/math.rst:36 +msgid ":func:`factorial(n) `" +msgstr ":func:`factorial(n) `" + +#: ../../library/math.rst:36 +msgid "*n* factorial" +msgstr "" + +#: ../../library/math.rst:37 +msgid ":func:`floor (x) `" +msgstr ":func:`floor (x) `" + +#: ../../library/math.rst:37 +msgid "Floor of *x*, the largest integer less than or equal to *x*" +msgstr "" + +#: ../../library/math.rst:38 +msgid ":func:`fma(x, y, z) `" +msgstr ":func:`fma(x, y, z) `" + +#: ../../library/math.rst:38 +msgid "Fused multiply-add operation: ``(x * y) + z``" +msgstr "" + +#: ../../library/math.rst:39 +msgid ":func:`fmod(x, y) `" +msgstr ":func:`fmod(x, y) `" + +#: ../../library/math.rst:39 +msgid "Remainder of division ``x / y``" +msgstr "" + +#: ../../library/math.rst:40 +msgid ":func:`frexp(x) `" +msgstr ":func:`frexp(x) `" + +#: ../../library/math.rst:40 +msgid "Mantissa and exponent of *x*" +msgstr "" + +#: ../../library/math.rst:41 +msgid ":func:`fsum(iterable) `" +msgstr ":func:`fsum(iterable) `" + +#: ../../library/math.rst:41 +msgid "Sum of values in the input *iterable*" +msgstr "" + +#: ../../library/math.rst:42 +msgid ":func:`gcd(*integers) `" +msgstr ":func:`gcd(*integers) `" + +#: ../../library/math.rst:42 +msgid "Greatest common divisor of the integer arguments" +msgstr "" + +#: ../../library/math.rst:43 +msgid ":func:`isclose(a, b, rel_tol, abs_tol) `" +msgstr ":func:`isclose(a, b, rel_tol, abs_tol) `" + +#: ../../library/math.rst:43 +msgid "Check if the values *a* and *b* are close to each other" +msgstr "" + +#: ../../library/math.rst:44 +msgid ":func:`isfinite(x) `" +msgstr ":func:`isfinite(x) `" + +#: ../../library/math.rst:44 +msgid "Check if *x* is neither an infinity nor a NaN" +msgstr "" + +#: ../../library/math.rst:45 +msgid ":func:`isinf(x) `" +msgstr ":func:`isinf(x) `" + +#: ../../library/math.rst:45 +msgid "Check if *x* is a positive or negative infinity" +msgstr "" + +#: ../../library/math.rst:46 +msgid ":func:`isnan(x) `" +msgstr ":func:`isnan(x) `" + +#: ../../library/math.rst:46 +msgid "Check if *x* is a NaN (not a number)" +msgstr "" + +#: ../../library/math.rst:47 +msgid ":func:`isqrt(n) `" +msgstr ":func:`isqrt(n) `" + +#: ../../library/math.rst:47 +msgid "Integer square root of a nonnegative integer *n*" +msgstr "" + +#: ../../library/math.rst:48 +msgid ":func:`lcm(*integers) `" +msgstr ":func:`lcm(*integers) `" + +#: ../../library/math.rst:48 +msgid "Least common multiple of the integer arguments" +msgstr "" + +#: ../../library/math.rst:49 +msgid ":func:`ldexp(x, i) `" +msgstr ":func:`ldexp(x, i) `" + +#: ../../library/math.rst:49 +msgid "``x * (2**i)``, inverse of function :func:`frexp`" +msgstr "" + +#: ../../library/math.rst:50 +msgid ":func:`modf(x) `" +msgstr ":func:`modf(x) `" + +#: ../../library/math.rst:50 +msgid "Fractional and integer parts of *x*" +msgstr "" + +#: ../../library/math.rst:51 +msgid ":func:`nextafter(x, y, steps) `" +msgstr ":func:`nextafter(x, y, steps) `" + +#: ../../library/math.rst:51 +msgid "Floating-point value *steps* steps after *x* towards *y*" +msgstr "" + +#: ../../library/math.rst:52 +msgid ":func:`perm(n, k) `" +msgstr ":func:`perm(n, k) `" + +#: ../../library/math.rst:52 +msgid "" +"Number of ways to choose *k* items from *n* items without repetition and " +"with order" +msgstr "從 *n* 個物品中不重複但考慮排序地取出 *k* 個物品的方法數。" + +#: ../../library/math.rst:53 +msgid ":func:`prod(iterable, start) `" +msgstr ":func:`prod(iterable, start) `" + +#: ../../library/math.rst:53 +msgid "Product of elements in the input *iterable* with a *start* value" +msgstr "" + +#: ../../library/math.rst:54 +msgid ":func:`remainder(x, y) `" +msgstr ":func:`remainder(x, y) `" + +#: ../../library/math.rst:54 +msgid "Remainder of *x* with respect to *y*" +msgstr "" + +#: ../../library/math.rst:55 +msgid ":func:`sumprod(p, q) `" +msgstr ":func:`sumprod(p, q) `" + +#: ../../library/math.rst:55 +msgid "Sum of products from two iterables *p* and *q*" +msgstr "" + +#: ../../library/math.rst:56 +msgid ":func:`trunc(x) `" +msgstr ":func:`trunc(x) `" + +#: ../../library/math.rst:56 +msgid "Integer part of *x*" +msgstr "" + +#: ../../library/math.rst:57 +msgid ":func:`ulp(x) `" +msgstr ":func:`ulp(x) `" + +#: ../../library/math.rst:57 +msgid "Value of the least significant bit of *x*" +msgstr "" + +#: ../../library/math.rst:59 +msgid "**Power and logarithmic functions**" +msgstr "" + +#: ../../library/math.rst:61 +msgid ":func:`cbrt(x) `" +msgstr ":func:`cbrt(x) `" + +#: ../../library/math.rst:61 +msgid "Cube root of *x*" +msgstr "" + +#: ../../library/math.rst:62 +msgid ":func:`exp(x) `" +msgstr ":func:`exp(x) `" + +#: ../../library/math.rst:62 +msgid "*e* raised to the power *x*" +msgstr "" + +#: ../../library/math.rst:63 +msgid ":func:`exp2(x) `" +msgstr ":func:`exp2(x) `" + +#: ../../library/math.rst:63 +msgid "*2* raised to the power *x*" +msgstr "" + +#: ../../library/math.rst:64 +msgid ":func:`expm1(x) `" +msgstr ":func:`expm1(x) `" + +#: ../../library/math.rst:64 +msgid "*e* raised to the power *x*, minus 1" +msgstr "" + +#: ../../library/math.rst:65 +msgid ":func:`log(x, base) `" +msgstr ":func:`log(x, base) `" + +#: ../../library/math.rst:65 +msgid "Logarithm of *x* to the given base (*e* by default)" +msgstr "" + +#: ../../library/math.rst:66 +msgid ":func:`log1p(x) `" +msgstr ":func:`log1p(x) `" + +#: ../../library/math.rst:66 +msgid "Natural logarithm of *1+x* (base *e*)" +msgstr "" + +#: ../../library/math.rst:67 +msgid ":func:`log2(x) `" +msgstr ":func:`log2(x) `" + +#: ../../library/math.rst:67 +msgid "Base-2 logarithm of *x*" +msgstr "" + +#: ../../library/math.rst:68 +msgid ":func:`log10(x) `" +msgstr ":func:`log10(x) `" + +#: ../../library/math.rst:68 +msgid "Base-10 logarithm of *x*" +msgstr "" + +#: ../../library/math.rst:69 +msgid ":func:`pow(x, y) `" +msgstr ":func:`pow(x, y) `" + +#: ../../library/math.rst:69 +msgid "*x* raised to the power *y*" +msgstr "" + +#: ../../library/math.rst:70 +msgid ":func:`sqrt(x) `" +msgstr ":func:`sqrt(x) `" + +#: ../../library/math.rst:70 +msgid "Square root of *x*" +msgstr "*x* 的平方根" + +#: ../../library/math.rst:72 +msgid "**Trigonometric functions**" +msgstr "" + +#: ../../library/math.rst:74 +msgid ":func:`acos(x) `" +msgstr ":func:`acos(x) `" + +#: ../../library/math.rst:74 +msgid "Arc cosine of *x*" +msgstr "" + +#: ../../library/math.rst:75 +msgid ":func:`asin(x) `" +msgstr ":func:`asin(x) `" + +#: ../../library/math.rst:75 +msgid "Arc sine of *x*" +msgstr "" + +#: ../../library/math.rst:76 +msgid ":func:`atan(x) `" +msgstr ":func:`atan(x) `" + +#: ../../library/math.rst:76 +msgid "Arc tangent of *x*" +msgstr "" + +#: ../../library/math.rst:77 +msgid ":func:`atan2(y, x) `" +msgstr ":func:`atan2(y, x) `" + +#: ../../library/math.rst:77 +msgid "``atan(y / x)``" +msgstr "``atan(y / x)``" + +#: ../../library/math.rst:78 +msgid ":func:`cos(x) `" +msgstr ":func:`cos(x) `" + +#: ../../library/math.rst:78 +msgid "Cosine of *x*" +msgstr "" + +#: ../../library/math.rst:79 +msgid ":func:`dist(p, q) `" +msgstr ":func:`dist(p, q) `" + +#: ../../library/math.rst:79 +msgid "" +"Euclidean distance between two points *p* and *q* given as an iterable of " +"coordinates" +msgstr "" + +#: ../../library/math.rst:80 +msgid ":func:`hypot(*coordinates) `" +msgstr ":func:`hypot(*coordinates) `" + +#: ../../library/math.rst:80 +msgid "Euclidean norm of an iterable of coordinates" +msgstr "" + +#: ../../library/math.rst:81 +msgid ":func:`sin(x) `" +msgstr ":func:`sin(x) `" + +#: ../../library/math.rst:81 +msgid "Sine of *x*" +msgstr "" + +#: ../../library/math.rst:82 +msgid ":func:`tan(x) `" +msgstr ":func:`tan(x) `" + +#: ../../library/math.rst:82 +msgid "Tangent of *x*" +msgstr "" + +#: ../../library/math.rst:84 +msgid "**Angular conversion**" +msgstr "" + +#: ../../library/math.rst:86 +msgid ":func:`degrees(x) `" +msgstr ":func:`degrees(x) `" + +#: ../../library/math.rst:86 +msgid "Convert angle *x* from radians to degrees" +msgstr "" + +#: ../../library/math.rst:87 +msgid ":func:`radians(x) `" +msgstr ":func:`radians(x) `" + +#: ../../library/math.rst:87 +msgid "Convert angle *x* from degrees to radians" +msgstr "" + +#: ../../library/math.rst:89 +msgid "**Hyperbolic functions**" +msgstr "" + +#: ../../library/math.rst:91 +msgid ":func:`acosh(x) `" +msgstr ":func:`acosh(x) `" + +#: ../../library/math.rst:91 +msgid "Inverse hyperbolic cosine of *x*" +msgstr "" + +#: ../../library/math.rst:92 +msgid ":func:`asinh(x) `" +msgstr ":func:`asinh(x) `" + +#: ../../library/math.rst:92 +msgid "Inverse hyperbolic sine of *x*" +msgstr "" + +#: ../../library/math.rst:93 +msgid ":func:`atanh(x) `" +msgstr ":func:`atanh(x) `" + +#: ../../library/math.rst:93 +msgid "Inverse hyperbolic tangent of *x*" +msgstr "" + +#: ../../library/math.rst:94 +msgid ":func:`cosh(x) `" +msgstr ":func:`cosh(x) `" + +#: ../../library/math.rst:94 +msgid "Hyperbolic cosine of *x*" +msgstr "" + +#: ../../library/math.rst:95 +msgid ":func:`sinh(x) `" +msgstr ":func:`sinh(x) `" + +#: ../../library/math.rst:95 +msgid "Hyperbolic sine of *x*" +msgstr "" + +#: ../../library/math.rst:96 +msgid ":func:`tanh(x) `" +msgstr ":func:`tanh(x) `" + +#: ../../library/math.rst:96 +msgid "Hyperbolic tangent of *x*" +msgstr "" + +#: ../../library/math.rst:98 +msgid "**Special functions**" +msgstr "" + +#: ../../library/math.rst:100 +msgid ":func:`erf(x) `" +msgstr ":func:`erf(x) `" + +#: ../../library/math.rst:100 +msgid "`Error function `_ at *x*" +msgstr "" + +#: ../../library/math.rst:101 +msgid ":func:`erfc(x) `" +msgstr ":func:`erfc(x) `" + +#: ../../library/math.rst:101 +msgid "" +"`Complementary error function `_ at *x*" +msgstr "" + +#: ../../library/math.rst:102 +msgid ":func:`gamma(x) `" +msgstr ":func:`gamma(x) `" + +#: ../../library/math.rst:102 +msgid "`Gamma function `_ at *x*" +msgstr "" + +#: ../../library/math.rst:103 +msgid ":func:`lgamma(x) `" +msgstr ":func:`lgamma(x) `" + +#: ../../library/math.rst:103 +msgid "" +"Natural logarithm of the absolute value of the `Gamma function `_ at *x*" +msgstr "" + +#: ../../library/math.rst:105 +msgid "**Constants**" +msgstr "**常數**" + +#: ../../library/math.rst:107 +msgid ":data:`pi`" +msgstr ":data:`pi`" + +#: ../../library/math.rst:107 +msgid "*π* = 3.141592..." +msgstr "*π* = 3.141592..." + +#: ../../library/math.rst:108 +msgid ":data:`e`" +msgstr ":data:`e`" + +#: ../../library/math.rst:108 +msgid "*e* = 2.718281..." +msgstr "*e* = 2.718281..." + +#: ../../library/math.rst:109 +msgid ":data:`tau`" +msgstr ":data:`tau`" + +#: ../../library/math.rst:109 +msgid "*τ* = 2\\ *π* = 6.283185..." +msgstr "*τ* = 2\\ *π* = 6.283185..." + +#: ../../library/math.rst:110 +msgid ":data:`inf`" +msgstr ":data:`inf`" + +#: ../../library/math.rst:110 +msgid "Positive infinity" +msgstr "正無限大" + +#: ../../library/math.rst:111 +msgid ":data:`nan`" +msgstr ":data:`nan`" + +#: ../../library/math.rst:111 +msgid "\"Not a number\" (NaN)" +msgstr "" + +#: ../../library/math.rst:116 msgid "Number-theoretic and representation functions" msgstr "數論與表現函式" -#: ../../library/math.rst:34 +#: ../../library/math.rst:120 msgid "" "Return the ceiling of *x*, the smallest integer greater than or equal to " "*x*. If *x* is not a float, delegates to :meth:`x.__ceil__ `,並回傳 :class:`~numbers." "Integral` 型別的值。" -#: ../../library/math.rst:41 +#: ../../library/math.rst:127 msgid "" "Return the number of ways to choose *k* items from *n* items without " "repetition and without order." msgstr "回傳從 *n* 個物品中不重複且不考慮排序地取出 *k* 個物品的方法數。" -#: ../../library/math.rst:44 +#: ../../library/math.rst:130 msgid "" "Evaluates to ``n! / (k! * (n - k)!)`` when ``k <= n`` and evaluates to zero " "when ``k > n``." msgstr "當 ``k <= n`` 時其值為 ``n! / (k! * (n - k)!)``,否則其值為 ``0``。" -#: ../../library/math.rst:47 +#: ../../library/math.rst:133 msgid "" "Also called the binomial coefficient because it is equivalent to the " "coefficient of k-th term in polynomial expansion of ``(1 + x)ⁿ``." @@ -85,7 +618,7 @@ msgstr "" "因為此值等同於 ``(1 + x)ⁿ`` 進行多項式展開後第 k 項的係數,所以又稱為二項式係" "數。" -#: ../../library/math.rst:51 ../../library/math.rst:274 +#: ../../library/math.rst:137 ../../library/math.rst:362 msgid "" "Raises :exc:`TypeError` if either of the arguments are not integers. Raises :" "exc:`ValueError` if either of the arguments are negative." @@ -93,7 +626,7 @@ msgstr "" "當任一參數非整數型別時會引發 :exc:`TypeError`。當任一參數為負數時會引發 :exc:" "`ValueError`。" -#: ../../library/math.rst:59 +#: ../../library/math.rst:145 msgid "" "Return a float with the magnitude (absolute value) of *x* but the sign of " "*y*. On platforms that support signed zeros, ``copysign(1.0, -0.0)`` " @@ -102,23 +635,23 @@ msgstr "" "回傳與 *x* 相同長度(絕對值)且與 *y* 同號的浮點數。在支援帶符號零的平臺上," "``copysign(1.0, -0.0)`` 回傳 *-1.0*。" -#: ../../library/math.rst:66 +#: ../../library/math.rst:152 msgid "Return the absolute value of *x*." msgstr "回傳 *x* 的絕對值。" -#: ../../library/math.rst:71 +#: ../../library/math.rst:157 msgid "" "Return *n* factorial as an integer. Raises :exc:`ValueError` if *n* is not " "integral or is negative." msgstr "" "以整數回傳 *n* 的階乘。若 *n* 非整數型別或其值為負會引發 :exc:`ValueError`。" -#: ../../library/math.rst:74 +#: ../../library/math.rst:160 #, fuzzy msgid "Floats with integral values (like ``5.0``) are no longer accepted." msgstr "允許傳入其值為整數的浮點數(如:``5.0``)已被棄用。" -#: ../../library/math.rst:80 +#: ../../library/math.rst:166 msgid "" "Return the floor of *x*, the largest integer less than or equal to *x*. If " "*x* is not a float, delegates to :meth:`x.__floor__ `, " @@ -128,7 +661,7 @@ msgstr "" "將委派給 :meth:`x.__floor__ `,並回傳 :class:`~numbers." "Integral` 型別的值。" -#: ../../library/math.rst:87 +#: ../../library/math.rst:173 msgid "" "Fused multiply-add operation. Return ``(x * y) + z``, computed as though " "with infinite precision and range followed by a single round to the " @@ -136,7 +669,7 @@ msgid "" "direct expression ``(x * y) + z``." msgstr "" -#: ../../library/math.rst:92 +#: ../../library/math.rst:178 msgid "" "This function follows the specification of the fusedMultiplyAdd operation " "described in the IEEE 754 standard. The standard leaves one case " @@ -145,7 +678,7 @@ msgid "" "not raise any exception." msgstr "" -#: ../../library/math.rst:103 +#: ../../library/math.rst:189 msgid "" "Return ``fmod(x, y)``, as defined by the platform C library. Note that the " "Python expression ``x % y`` may not return the same result. The intent of " @@ -169,7 +702,7 @@ msgstr "" "示成浮點數,並會四捨五入為出乎意料的 ``1e100``。因此,處理浮點數時通常會選擇" "函式 :func:`fmod`,而處理整數時會選擇 Python 運算式 ``x % y``。" -#: ../../library/math.rst:118 +#: ../../library/math.rst:204 msgid "" "Return the mantissa and exponent of *x* as the pair ``(m, e)``. *m* is a " "float and *e* is an integer such that ``x == m * 2**e`` exactly. If *x* is " @@ -180,7 +713,7 @@ msgstr "" "數,且兩者精確地使 ``x == m * 2**e``。若 *x* 為零,回傳 ``(0.0, 0)``,否則令 " "``0.5 <= abs(m) < 1``。此函式用於以可攜的方式「分割」浮點數內部表示法。" -#: ../../library/math.rst:126 +#: ../../library/math.rst:212 msgid "" "Return an accurate floating-point sum of values in the iterable. Avoids " "loss of precision by tracking multiple intermediate partial sums." @@ -188,7 +721,7 @@ msgstr "" "回傳可疊代物件(iterable)中所有值的精確浮點數和。透過追蹤過程中多個部分和" "(partial sum)以避免精確度損失。" -#: ../../library/math.rst:129 +#: ../../library/math.rst:215 msgid "" "The algorithm's accuracy depends on IEEE-754 arithmetic guarantees and the " "typical case where the rounding mode is half-even. On some non-Windows " @@ -200,7 +733,7 @@ msgstr "" "有些非 Windows 平台建置時,底層 C 函式庫使用延伸精度加法運算,而可能導致對過" "程中同一部分和重複捨入,並使其最低有效位不如預期。" -#: ../../library/math.rst:135 +#: ../../library/math.rst:221 msgid "" "For further discussion and two alternative approaches, see the `ASPN " "cookbook recipes for accurate floating-point summation `_。" -#: ../../library/math.rst:142 +#: ../../library/math.rst:228 msgid "" "Return the greatest common divisor of the specified integer arguments. If " "any of the arguments is nonzero, then the returned value is the largest " @@ -222,54 +755,51 @@ msgstr "" "最大的正整數。若所有引數皆為零,則回傳值為 ``0``。``gcd()`` 若未傳入任何引數" "也將回傳 ``0``。" -#: ../../library/math.rst:150 +#: ../../library/math.rst:236 msgid "" "Added support for an arbitrary number of arguments. Formerly, only two " "arguments were supported." msgstr "新增支援任意數量的引數。先前僅支援兩個引數。" -#: ../../library/math.rst:157 +#: ../../library/math.rst:243 msgid "" "Return ``True`` if the values *a* and *b* are close to each other and " "``False`` otherwise." msgstr "若 *a* 及 *b* 兩值足夠接近便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:160 +#: ../../library/math.rst:246 msgid "" "Whether or not two values are considered close is determined according to " -"given absolute and relative tolerances." -msgstr "兩數是否足夠接近取決於給定的絕對及相對容許偏差(tolerance)。" +"given absolute and relative tolerances. If no errors occur, the result will " +"be: ``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``." +msgstr "" +"兩數是否足夠接近取決於給定的絕對及相對容許偏差 (tolerance)。如果沒有錯誤發" +"生,結果將為:``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``。" -#: ../../library/math.rst:163 +#: ../../library/math.rst:250 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " "For example, to set a tolerance of 5%, pass ``rel_tol=0.05``. The default " "tolerance is ``1e-09``, which assures that the two values are the same " -"within about 9 decimal digits. *rel_tol* must be greater than zero." +"within about 9 decimal digits. *rel_tol* must be nonnegative and less than " +"``1.0``." msgstr "" "*rel_tol* 為相對容許偏差 ── *a* 與 *b* 兩數差的最大容許值,與 *a* 及 *b* 兩數" "的絕對值中較大者相關。例如欲設置 5% 的容許偏差,則傳入 ``rel_tol=0.05``。其預" -"設值為 ``1e-09``,該值可確保兩數於大約 9 個十進數位內相同。*rel_tol* 須大於 " -"``0``。" +"設值為 ``1e-09``,該值可確保兩數於大約 9 個十進數位內相同。*rel_tol* 須不為負" +"且小於 ``1.0``。" -#: ../../library/math.rst:169 +#: ../../library/math.rst:257 msgid "" -"*abs_tol* is the minimum absolute tolerance -- useful for comparisons near " -"zero. *abs_tol* must be at least zero." +"*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " +"nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " +"as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any ``x`` and " +"rel_tol less than ``1.0``. So add an appropriate positive abs_tol argument " +"to the call." msgstr "" -"*abs_tol* 為最小絕對容許偏差 ── 於接近零的比較時很有用。*abs_tol* 須大於等於 " -"``0``。" -#: ../../library/math.rst:172 -msgid "" -"If no errors occur, the result will be: ``abs(a-b) <= max(rel_tol * " -"max(abs(a), abs(b)), abs_tol)``." -msgstr "" -"若未發生任何錯誤,函式結果為 ``abs(a-b) <= max(rel_tol * max(abs(a), " -"abs(b)), abs_tol)``。" - -#: ../../library/math.rst:175 +#: ../../library/math.rst:263 msgid "" "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " "handled according to IEEE rules. Specifically, ``NaN`` is not considered " @@ -280,11 +810,11 @@ msgstr "" "處理。更明確地說,``NaN`` 不會與包含自身在內的任何數字足夠接近,而 ``inf`` " "及 ``-inf`` 皆只與自身接近。" -#: ../../library/math.rst:184 +#: ../../library/math.rst:272 msgid ":pep:`485` -- A function for testing approximate equality" msgstr ":pep:`485` ── 用於測試近似相等的函式" -#: ../../library/math.rst:189 +#: ../../library/math.rst:277 msgid "" "Return ``True`` if *x* is neither an infinity nor a NaN, and ``False`` " "otherwise. (Note that ``0.0`` *is* considered finite.)" @@ -292,20 +822,20 @@ msgstr "" "若 *x* 不是無限值或 ``NaN`` 便回傳 ``True``,否則回傳 ``False``。(注意 " "``0.0`` 被視為有限數。)" -#: ../../library/math.rst:197 +#: ../../library/math.rst:285 msgid "" "Return ``True`` if *x* is a positive or negative infinity, and ``False`` " "otherwise." msgstr "若 *x* 是正無限值或負無限值便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:203 +#: ../../library/math.rst:291 msgid "" "Return ``True`` if *x* is a NaN (not a number), and ``False`` otherwise." msgstr "" "若 *x* 是 ``NaN`` ── 即非數字(NaN, not a number)── 便回傳 ``True``,否則回" "傳 ``False``。" -#: ../../library/math.rst:208 +#: ../../library/math.rst:296 msgid "" "Return the integer square root of the nonnegative integer *n*. This is the " "floor of the exact square root of *n*, or equivalently the greatest integer " @@ -314,7 +844,7 @@ msgstr "" "回傳非負整數 *n* 的整數平方根。此值為 *n* 精確平方根經下取整的值,亦等同於滿" "足 *a*\\ ² |nbsp| ≤ |nbsp| *n* 的最大整數值 *a*。" -#: ../../library/math.rst:212 +#: ../../library/math.rst:300 msgid "" "For some applications, it may be more convenient to have the least integer " "*a* such that *n* |nbsp| ≤ |nbsp| *a*\\ ², or in other words the ceiling of " @@ -325,7 +855,7 @@ msgstr "" "者說 *n* 精確平方根經上取整的值 ── 會更加方便。對正數 *n*,此值可使用 ``a = " "1 + isqrt(n - 1)`` 計算。" -#: ../../library/math.rst:222 +#: ../../library/math.rst:310 msgid "" "Return the least common multiple of the specified integer arguments. If all " "arguments are nonzero, then the returned value is the smallest positive " @@ -337,86 +867,86 @@ msgstr "" "最小的正整數。若存在任一引數值為零,則回傳值為 ``0``。``lcm()`` 若未傳入任何" "引數將回傳 ``1``。" -#: ../../library/math.rst:233 +#: ../../library/math.rst:321 msgid "" "Return ``x * (2**i)``. This is essentially the inverse of function :func:" "`frexp`." msgstr "回傳 ``x * (2**i)``。此函式本質上為 :func:`frexp` 的反函式。" -#: ../../library/math.rst:239 +#: ../../library/math.rst:327 msgid "" "Return the fractional and integer parts of *x*. Both results carry the sign " "of *x* and are floats." msgstr "" -#: ../../library/math.rst:245 +#: ../../library/math.rst:333 msgid "Return the floating-point value *steps* steps after *x* towards *y*." msgstr "" -#: ../../library/math.rst:247 +#: ../../library/math.rst:335 msgid "If *x* is equal to *y*, return *y*, unless *steps* is zero." msgstr "" -#: ../../library/math.rst:249 +#: ../../library/math.rst:337 msgid "Examples:" msgstr "範例:" -#: ../../library/math.rst:251 +#: ../../library/math.rst:339 msgid "``math.nextafter(x, math.inf)`` goes up: towards positive infinity." msgstr "" -#: ../../library/math.rst:252 +#: ../../library/math.rst:340 msgid "``math.nextafter(x, -math.inf)`` goes down: towards minus infinity." msgstr "" -#: ../../library/math.rst:253 +#: ../../library/math.rst:341 msgid "``math.nextafter(x, 0.0)`` goes towards zero." msgstr "" -#: ../../library/math.rst:254 +#: ../../library/math.rst:342 msgid "``math.nextafter(x, math.copysign(math.inf, x))`` goes away from zero." msgstr "" -#: ../../library/math.rst:256 +#: ../../library/math.rst:344 msgid "See also :func:`math.ulp`." msgstr "另請參閱 :func:`math.ulp`。" -#: ../../library/math.rst:260 +#: ../../library/math.rst:348 msgid "Added the *steps* argument." msgstr "新增 *steps* 引數。" -#: ../../library/math.rst:265 +#: ../../library/math.rst:353 msgid "" "Return the number of ways to choose *k* items from *n* items without " "repetition and with order." msgstr "" -#: ../../library/math.rst:268 +#: ../../library/math.rst:356 msgid "" "Evaluates to ``n! / (n - k)!`` when ``k <= n`` and evaluates to zero when " "``k > n``." msgstr "" -#: ../../library/math.rst:271 +#: ../../library/math.rst:359 msgid "" "If *k* is not specified or is ``None``, then *k* defaults to *n* and the " "function returns ``n!``." msgstr "" -#: ../../library/math.rst:282 +#: ../../library/math.rst:370 msgid "" "Calculate the product of all the elements in the input *iterable*. The " "default *start* value for the product is ``1``." msgstr "" -#: ../../library/math.rst:285 +#: ../../library/math.rst:373 msgid "" "When the iterable is empty, return the start value. This function is " "intended specifically for use with numeric values and may reject non-numeric " "types." msgstr "" -#: ../../library/math.rst:294 +#: ../../library/math.rst:382 msgid "" "Return the IEEE 754-style remainder of *x* with respect to *y*. For finite " "*x* and finite nonzero *y*, this is the difference ``x - n*y``, where ``n`` " @@ -426,7 +956,7 @@ msgid "" "thus always satisfies ``abs(r) <= 0.5 * abs(y)``." msgstr "" -#: ../../library/math.rst:301 +#: ../../library/math.rst:389 msgid "" "Special cases follow IEEE 754: in particular, ``remainder(x, math.inf)`` is " "*x* for any finite *x*, and ``remainder(x, 0)`` and ``remainder(math.inf, " @@ -434,35 +964,35 @@ msgid "" "remainder operation is zero, that zero will have the same sign as *x*." msgstr "" -#: ../../library/math.rst:307 +#: ../../library/math.rst:395 msgid "" "On platforms using IEEE 754 binary floating point, the result of this " "operation is always exactly representable: no rounding error is introduced." msgstr "" -#: ../../library/math.rst:315 +#: ../../library/math.rst:403 msgid "Return the sum of products of values from two iterables *p* and *q*." msgstr "" -#: ../../library/math.rst:317 +#: ../../library/math.rst:405 msgid "Raises :exc:`ValueError` if the inputs do not have the same length." msgstr "" -#: ../../library/math.rst:319 ../../library/math.rst:514 +#: ../../library/math.rst:407 ../../library/math.rst:602 msgid "Roughly equivalent to::" msgstr "" -#: ../../library/math.rst:321 +#: ../../library/math.rst:409 msgid "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" msgstr "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" -#: ../../library/math.rst:323 +#: ../../library/math.rst:411 msgid "" "For float and mixed int/float inputs, the intermediate products and sums are " "computed with extended precision." msgstr "" -#: ../../library/math.rst:331 +#: ../../library/math.rst:419 msgid "" "Return *x* with the fractional part removed, leaving the integer part. This " "rounds toward 0: ``trunc()`` is equivalent to :func:`floor` for positive " @@ -471,54 +1001,54 @@ msgid "" "class:`~numbers.Integral` value." msgstr "" -#: ../../library/math.rst:339 +#: ../../library/math.rst:427 msgid "Return the value of the least significant bit of the float *x*:" msgstr "" -#: ../../library/math.rst:341 +#: ../../library/math.rst:429 msgid "If *x* is a NaN (not a number), return *x*." msgstr "" -#: ../../library/math.rst:342 +#: ../../library/math.rst:430 msgid "If *x* is negative, return ``ulp(-x)``." -msgstr "" +msgstr "若 *x* 為負值,回傳 ``ulp(-x)``。" -#: ../../library/math.rst:343 +#: ../../library/math.rst:431 msgid "If *x* is a positive infinity, return *x*." -msgstr "" +msgstr "若 *x* 為正無限值,回傳 *x*。" -#: ../../library/math.rst:344 +#: ../../library/math.rst:432 msgid "" "If *x* is equal to zero, return the smallest positive *denormalized* " "representable float (smaller than the minimum positive *normalized* float, :" "data:`sys.float_info.min `)." msgstr "" -#: ../../library/math.rst:347 +#: ../../library/math.rst:435 msgid "" "If *x* is equal to the largest positive representable float, return the " "value of the least significant bit of *x*, such that the first float smaller " "than *x* is ``x - ulp(x)``." msgstr "" -#: ../../library/math.rst:350 +#: ../../library/math.rst:438 msgid "" "Otherwise (*x* is a positive finite number), return the value of the least " "significant bit of *x*, such that the first float bigger than *x* is ``x + " "ulp(x)``." msgstr "" -#: ../../library/math.rst:354 +#: ../../library/math.rst:442 msgid "ULP stands for \"Unit in the Last Place\"." msgstr "" -#: ../../library/math.rst:356 +#: ../../library/math.rst:444 msgid "" "See also :func:`math.nextafter` and :data:`sys.float_info.epsilon `." msgstr "" -#: ../../library/math.rst:362 +#: ../../library/math.rst:450 msgid "" "Note that :func:`frexp` and :func:`modf` have a different call/return " "pattern than their C equivalents: they take a single argument and return a " @@ -526,7 +1056,7 @@ msgid "" "'output parameter' (there is no such thing in Python)." msgstr "" -#: ../../library/math.rst:367 +#: ../../library/math.rst:455 msgid "" "For the :func:`ceil`, :func:`floor`, and :func:`modf` functions, note that " "*all* floating-point numbers of sufficiently large magnitude are exact " @@ -535,26 +1065,26 @@ msgid "" "``abs(x) >= 2**52`` necessarily has no fractional bits." msgstr "" -#: ../../library/math.rst:375 +#: ../../library/math.rst:463 msgid "Power and logarithmic functions" msgstr "" -#: ../../library/math.rst:379 +#: ../../library/math.rst:467 msgid "Return the cube root of *x*." msgstr "" -#: ../../library/math.rst:386 +#: ../../library/math.rst:474 msgid "" "Return *e* raised to the power *x*, where *e* = 2.718281... is the base of " "natural logarithms. This is usually more accurate than ``math.e ** x`` or " "``pow(math.e, x)``." msgstr "" -#: ../../library/math.rst:393 +#: ../../library/math.rst:481 msgid "Return *2* raised to the power *x*." msgstr "" -#: ../../library/math.rst:400 +#: ../../library/math.rst:488 msgid "" "Return *e* raised to the power *x*, minus 1. Here *e* is the base of " "natural logarithms. For small floats *x*, the subtraction in ``exp(x) - 1`` " @@ -563,90 +1093,90 @@ msgid "" "compute this quantity to full precision:" msgstr "" -#: ../../library/math.rst:417 +#: ../../library/math.rst:505 msgid "With one argument, return the natural logarithm of *x* (to base *e*)." msgstr "" -#: ../../library/math.rst:419 +#: ../../library/math.rst:507 msgid "" "With two arguments, return the logarithm of *x* to the given *base*, " "calculated as ``log(x)/log(base)``." msgstr "" -#: ../../library/math.rst:425 +#: ../../library/math.rst:513 msgid "" "Return the natural logarithm of *1+x* (base *e*). The result is calculated " "in a way which is accurate for *x* near zero." msgstr "" -#: ../../library/math.rst:431 +#: ../../library/math.rst:519 msgid "" "Return the base-2 logarithm of *x*. This is usually more accurate than " "``log(x, 2)``." msgstr "" -#: ../../library/math.rst:438 +#: ../../library/math.rst:526 msgid "" ":meth:`int.bit_length` returns the number of bits necessary to represent an " "integer in binary, excluding the sign and leading zeros." msgstr "" -#: ../../library/math.rst:444 +#: ../../library/math.rst:532 msgid "" "Return the base-10 logarithm of *x*. This is usually more accurate than " "``log(x, 10)``." msgstr "" -#: ../../library/math.rst:450 +#: ../../library/math.rst:538 msgid "" -"Return ``x`` raised to the power ``y``. Exceptional cases follow the IEEE " -"754 standard as far as possible. In particular, ``pow(1.0, x)`` and " -"``pow(x, 0.0)`` always return ``1.0``, even when ``x`` is a zero or a NaN. " -"If both ``x`` and ``y`` are finite, ``x`` is negative, and ``y`` is not an " -"integer then ``pow(x, y)`` is undefined, and raises :exc:`ValueError`." +"Return *x* raised to the power *y*. Exceptional cases follow the IEEE 754 " +"standard as far as possible. In particular, ``pow(1.0, x)`` and ``pow(x, " +"0.0)`` always return ``1.0``, even when *x* is a zero or a NaN. If both *x* " +"and *y* are finite, *x* is negative, and *y* is not an integer then ``pow(x, " +"y)`` is undefined, and raises :exc:`ValueError`." msgstr "" -#: ../../library/math.rst:457 +#: ../../library/math.rst:545 msgid "" "Unlike the built-in ``**`` operator, :func:`math.pow` converts both its " "arguments to type :class:`float`. Use ``**`` or the built-in :func:`pow` " "function for computing exact integer powers." msgstr "" -#: ../../library/math.rst:461 +#: ../../library/math.rst:549 msgid "" "The special cases ``pow(0.0, -inf)`` and ``pow(-0.0, -inf)`` were changed to " "return ``inf`` instead of raising :exc:`ValueError`, for consistency with " "IEEE 754." msgstr "" -#: ../../library/math.rst:469 +#: ../../library/math.rst:557 msgid "Return the square root of *x*." msgstr "" -#: ../../library/math.rst:473 +#: ../../library/math.rst:561 msgid "Trigonometric functions" msgstr "" -#: ../../library/math.rst:477 +#: ../../library/math.rst:565 msgid "" "Return the arc cosine of *x*, in radians. The result is between ``0`` and " "``pi``." msgstr "" -#: ../../library/math.rst:483 +#: ../../library/math.rst:571 msgid "" "Return the arc sine of *x*, in radians. The result is between ``-pi/2`` and " "``pi/2``." msgstr "" -#: ../../library/math.rst:489 +#: ../../library/math.rst:577 msgid "" "Return the arc tangent of *x*, in radians. The result is between ``-pi/2`` " "and ``pi/2``." msgstr "" -#: ../../library/math.rst:495 +#: ../../library/math.rst:583 msgid "" "Return ``atan(y / x)``, in radians. The result is between ``-pi`` and " "``pi``. The vector in the plane from the origin to point ``(x, y)`` makes " @@ -656,128 +1186,128 @@ msgid "" "``pi/4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." msgstr "" -#: ../../library/math.rst:505 +#: ../../library/math.rst:593 msgid "Return the cosine of *x* radians." msgstr "" -#: ../../library/math.rst:510 +#: ../../library/math.rst:598 msgid "" "Return the Euclidean distance between two points *p* and *q*, each given as " "a sequence (or iterable) of coordinates. The two points must have the same " "dimension." msgstr "" -#: ../../library/math.rst:516 +#: ../../library/math.rst:604 msgid "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" msgstr "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" -#: ../../library/math.rst:523 +#: ../../library/math.rst:611 msgid "" "Return the Euclidean norm, ``sqrt(sum(x**2 for x in coordinates))``. This is " "the length of the vector from the origin to the point given by the " "coordinates." msgstr "" -#: ../../library/math.rst:527 +#: ../../library/math.rst:615 msgid "" "For a two dimensional point ``(x, y)``, this is equivalent to computing the " "hypotenuse of a right triangle using the Pythagorean theorem, ``sqrt(x*x + " "y*y)``." msgstr "" -#: ../../library/math.rst:531 +#: ../../library/math.rst:619 msgid "" "Added support for n-dimensional points. Formerly, only the two dimensional " "case was supported." msgstr "" -#: ../../library/math.rst:535 +#: ../../library/math.rst:623 msgid "" "Improved the algorithm's accuracy so that the maximum error is under 1 ulp " "(unit in the last place). More typically, the result is almost always " "correctly rounded to within 1/2 ulp." msgstr "" -#: ../../library/math.rst:543 +#: ../../library/math.rst:631 msgid "Return the sine of *x* radians." msgstr "" -#: ../../library/math.rst:548 +#: ../../library/math.rst:636 msgid "Return the tangent of *x* radians." msgstr "" -#: ../../library/math.rst:552 +#: ../../library/math.rst:640 msgid "Angular conversion" msgstr "" -#: ../../library/math.rst:556 +#: ../../library/math.rst:644 msgid "Convert angle *x* from radians to degrees." msgstr "" -#: ../../library/math.rst:561 +#: ../../library/math.rst:649 msgid "Convert angle *x* from degrees to radians." msgstr "" -#: ../../library/math.rst:565 +#: ../../library/math.rst:653 msgid "Hyperbolic functions" msgstr "" -#: ../../library/math.rst:567 +#: ../../library/math.rst:655 msgid "" "`Hyperbolic functions `_ " "are analogs of trigonometric functions that are based on hyperbolas instead " "of circles." msgstr "" -#: ../../library/math.rst:573 +#: ../../library/math.rst:661 msgid "Return the inverse hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:578 +#: ../../library/math.rst:666 msgid "Return the inverse hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:583 +#: ../../library/math.rst:671 msgid "Return the inverse hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:588 +#: ../../library/math.rst:676 msgid "Return the hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:593 +#: ../../library/math.rst:681 msgid "Return the hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:598 +#: ../../library/math.rst:686 msgid "Return the hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:602 +#: ../../library/math.rst:690 msgid "Special functions" -msgstr "" +msgstr "特殊函式" -#: ../../library/math.rst:606 +#: ../../library/math.rst:694 msgid "" "Return the `error function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:609 +#: ../../library/math.rst:697 msgid "" "The :func:`erf` function can be used to compute traditional statistical " "functions such as the `cumulative standard normal distribution `_::" msgstr "" -#: ../../library/math.rst:613 +#: ../../library/math.rst:701 msgid "" "def phi(x):\n" " 'Cumulative distribution function for the standard normal distribution'\n" " return (1.0 + erf(x / sqrt(2.0))) / 2.0" msgstr "" -#: ../../library/math.rst:622 +#: ../../library/math.rst:710 msgid "" "Return the complementary error function at *x*. The `complementary error " "function `_ is defined as " @@ -786,31 +1316,31 @@ msgid "" "Loss_of_significance>`_\\." msgstr "" -#: ../../library/math.rst:633 +#: ../../library/math.rst:721 msgid "" "Return the `Gamma function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:641 +#: ../../library/math.rst:729 msgid "" "Return the natural logarithm of the absolute value of the Gamma function at " "*x*." msgstr "" -#: ../../library/math.rst:648 +#: ../../library/math.rst:736 msgid "Constants" msgstr "常數" -#: ../../library/math.rst:652 +#: ../../library/math.rst:740 msgid "The mathematical constant *π* = 3.141592..., to available precision." msgstr "" -#: ../../library/math.rst:657 +#: ../../library/math.rst:745 msgid "The mathematical constant *e* = 2.718281..., to available precision." msgstr "" -#: ../../library/math.rst:662 +#: ../../library/math.rst:750 msgid "" "The mathematical constant *τ* = 6.283185..., to available precision. Tau is " "a circle constant equal to 2\\ *π*, the ratio of a circle's circumference to " @@ -819,13 +1349,13 @@ msgid "" "celebrating `Tau day `_ by eating twice as much pie!" msgstr "" -#: ../../library/math.rst:673 +#: ../../library/math.rst:761 msgid "" "A floating-point positive infinity. (For negative infinity, use ``-math." "inf``.) Equivalent to the output of ``float('inf')``." msgstr "" -#: ../../library/math.rst:681 +#: ../../library/math.rst:769 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to the output of " "``float('nan')``. Due to the requirements of the `IEEE-754 standard \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -350,26 +350,26 @@ msgstr "" #: ../../library/os.rst:2592 ../../library/os.rst:2614 #: ../../library/os.rst:3322 ../../library/os.rst:3456 #: ../../library/os.rst:3479 ../../library/os.rst:3493 -#: ../../library/os.rst:3712 ../../library/os.rst:3737 -#: ../../library/os.rst:3762 ../../library/os.rst:3816 -#: ../../library/os.rst:3825 ../../library/os.rst:3834 -#: ../../library/os.rst:3842 ../../library/os.rst:3851 -#: ../../library/os.rst:3860 ../../library/os.rst:3932 -#: ../../library/os.rst:3995 ../../library/os.rst:4005 -#: ../../library/os.rst:4023 ../../library/os.rst:4032 -#: ../../library/os.rst:4042 ../../library/os.rst:4052 -#: ../../library/os.rst:4062 ../../library/os.rst:4073 -#: ../../library/os.rst:4218 ../../library/os.rst:4287 -#: ../../library/os.rst:4322 ../../library/os.rst:4330 -#: ../../library/os.rst:4337 ../../library/os.rst:4344 -#: ../../library/os.rst:4351 ../../library/os.rst:4358 -#: ../../library/os.rst:4365 ../../library/os.rst:4372 -#: ../../library/os.rst:4380 ../../library/os.rst:4388 -#: ../../library/os.rst:4395 ../../library/os.rst:4402 -#: ../../library/os.rst:4411 ../../library/os.rst:4419 -#: ../../library/os.rst:4427 ../../library/os.rst:4434 -#: ../../library/os.rst:4441 ../../library/os.rst:4490 -#: ../../library/os.rst:4517 ../../library/os.rst:4541 +#: ../../library/os.rst:3713 ../../library/os.rst:3738 +#: ../../library/os.rst:3763 ../../library/os.rst:3817 +#: ../../library/os.rst:3826 ../../library/os.rst:3835 +#: ../../library/os.rst:3843 ../../library/os.rst:3852 +#: ../../library/os.rst:3861 ../../library/os.rst:3933 +#: ../../library/os.rst:3996 ../../library/os.rst:4006 +#: ../../library/os.rst:4024 ../../library/os.rst:4033 +#: ../../library/os.rst:4043 ../../library/os.rst:4053 +#: ../../library/os.rst:4063 ../../library/os.rst:4074 +#: ../../library/os.rst:4219 ../../library/os.rst:4288 +#: ../../library/os.rst:4323 ../../library/os.rst:4331 +#: ../../library/os.rst:4338 ../../library/os.rst:4345 +#: ../../library/os.rst:4352 ../../library/os.rst:4359 +#: ../../library/os.rst:4366 ../../library/os.rst:4373 +#: ../../library/os.rst:4381 ../../library/os.rst:4389 +#: ../../library/os.rst:4396 ../../library/os.rst:4403 +#: ../../library/os.rst:4412 ../../library/os.rst:4420 +#: ../../library/os.rst:4428 ../../library/os.rst:4435 +#: ../../library/os.rst:4442 ../../library/os.rst:4491 +#: ../../library/os.rst:4518 ../../library/os.rst:4541 #: ../../library/os.rst:4557 ../../library/os.rst:4564 #: ../../library/os.rst:4575 ../../library/os.rst:4585 #: ../../library/os.rst:4594 ../../library/os.rst:4626 @@ -1517,8 +1517,8 @@ msgstr "" #: ../../library/os.rst:2759 ../../library/os.rst:3049 #: ../../library/os.rst:3336 ../../library/os.rst:3500 #: ../../library/os.rst:3516 ../../library/os.rst:3556 -#: ../../library/os.rst:3655 ../../library/os.rst:3716 -#: ../../library/os.rst:4113 ../../library/os.rst:4293 +#: ../../library/os.rst:3656 ../../library/os.rst:3717 +#: ../../library/os.rst:4114 ../../library/os.rst:4294 #: ../../library/os.rst:4859 msgid "Accepts a :term:`path-like object`." msgstr "" @@ -3386,9 +3386,9 @@ msgid "" "``follow_symlinks=False``, or use :func:`lstat`." msgstr "" -#: ../../library/os.rst:3014 ../../library/os.rst:4092 -#: ../../library/os.rst:4108 ../../library/os.rst:4124 -#: ../../library/os.rst:4144 +#: ../../library/os.rst:3014 ../../library/os.rst:4093 +#: ../../library/os.rst:4109 ../../library/os.rst:4125 +#: ../../library/os.rst:4145 msgid "" "This function can support :ref:`specifying a file descriptor ` and :" "ref:`not following symlinks `." @@ -3408,7 +3408,7 @@ msgid "" "junction points, which will raise the usual exceptions." msgstr "" -#: ../../library/os.rst:3030 ../../library/os.rst:3799 +#: ../../library/os.rst:3030 ../../library/os.rst:3800 msgid "Example::" msgstr "範例: ::" @@ -4087,7 +4087,7 @@ msgid "" "directory, and assumes that its caller doesn't either." msgstr "" -#: ../../library/os.rst:3621 ../../library/os.rst:3682 +#: ../../library/os.rst:3621 ../../library/os.rst:3683 msgid "" "This example displays the number of bytes taken by non-directory files in " "each directory under the starting directory, except that it doesn't look " @@ -4124,10 +4124,11 @@ msgid "" " for name in files:\n" " os.remove(os.path.join(root, name))\n" " for name in dirs:\n" -" os.rmdir(os.path.join(root, name))" +" os.rmdir(os.path.join(root, name))\n" +"os.rmdir(top)" msgstr "" -#: ../../library/os.rst:3649 +#: ../../library/os.rst:3650 msgid "" "Raises an :ref:`auditing event ` ``os.walk`` with arguments " "``top``, ``topdown``, ``onerror``, ``followlinks``." @@ -4135,25 +4136,25 @@ msgstr "" "引發一個附帶引數 ``top``、``topdown``、``onerror``、``followlinks`` 的\\ :" "ref:`稽核事件 ` ``os.walk``。" -#: ../../library/os.rst:3651 +#: ../../library/os.rst:3652 msgid "" "This function now calls :func:`os.scandir` instead of :func:`os.listdir`, " "making it faster by reducing the number of calls to :func:`os.stat`." msgstr "" -#: ../../library/os.rst:3665 +#: ../../library/os.rst:3666 msgid "" "This behaves exactly like :func:`walk`, except that it yields a 4-tuple " "``(dirpath, dirnames, filenames, dirfd)``, and it supports ``dir_fd``." msgstr "" -#: ../../library/os.rst:3668 +#: ../../library/os.rst:3669 msgid "" "*dirpath*, *dirnames* and *filenames* are identical to :func:`walk` output, " "and *dirfd* is a file descriptor referring to the directory *dirpath*." msgstr "" -#: ../../library/os.rst:3671 +#: ../../library/os.rst:3672 msgid "" "This function always supports :ref:`paths relative to directory descriptors " "` and :ref:`not following symlinks `. Note however " @@ -4161,14 +4162,14 @@ msgid "" "*follow_symlinks* is ``False``." msgstr "" -#: ../../library/os.rst:3678 +#: ../../library/os.rst:3679 msgid "" "Since :func:`fwalk` yields file descriptors, those are only valid until the " "next iteration step, so you should duplicate them (e.g. with :func:`dup`) if " "you want to keep them longer." msgstr "" -#: ../../library/os.rst:3686 +#: ../../library/os.rst:3687 msgid "" "import os\n" "for root, dirs, files, rootfd in os.fwalk('python/Lib/email'):\n" @@ -4180,13 +4181,13 @@ msgid "" " dirs.remove('CVS') # don't visit CVS directories" msgstr "" -#: ../../library/os.rst:3695 +#: ../../library/os.rst:3696 msgid "" "In the next example, walking the tree bottom-up is essential: :func:`rmdir` " "doesn't allow deleting a directory before the directory is empty::" msgstr "" -#: ../../library/os.rst:3699 +#: ../../library/os.rst:3700 msgid "" "# Delete everything reachable from the directory named in \"top\",\n" "# assuming there are no symbolic links.\n" @@ -4200,7 +4201,7 @@ msgid "" " os.rmdir(name, dir_fd=rootfd)" msgstr "" -#: ../../library/os.rst:3710 +#: ../../library/os.rst:3711 msgid "" "Raises an :ref:`auditing event ` ``os.fwalk`` with arguments " "``top``, ``topdown``, ``onerror``, ``follow_symlinks``, ``dir_fd``." @@ -4208,11 +4209,11 @@ msgstr "" "引發一個附帶引數 ``top``、``topdown``、``onerror``、``follow_symlinks``、" "``dir_fd`` 的\\ :ref:`稽核事件 ` ``os.fwalk``。" -#: ../../library/os.rst:3719 +#: ../../library/os.rst:3720 msgid "Added support for :class:`bytes` paths." msgstr "新增對 :class:`bytes` 路徑的支援。" -#: ../../library/os.rst:3725 +#: ../../library/os.rst:3726 msgid "" "Create an anonymous file and return a file descriptor that refers to it. " "*flags* must be one of the ``os.MFD_*`` constants available on the system " @@ -4220,7 +4221,7 @@ msgid "" "descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3730 +#: ../../library/os.rst:3731 msgid "" "The name supplied in *name* is used as a filename and will be displayed as " "the target of the corresponding symbolic link in the directory ``/proc/self/" @@ -4230,15 +4231,15 @@ msgid "" "side effects." msgstr "" -#: ../../library/os.rst:3760 +#: ../../library/os.rst:3761 msgid "These flags can be passed to :func:`memfd_create`." msgstr "這些旗標可以傳給 :func:`memfd_create`。" -#: ../../library/os.rst:3764 +#: ../../library/os.rst:3765 msgid "The ``MFD_HUGE*`` flags are only available since Linux 4.14." msgstr "``MFD_HUGE*`` 旗標僅在 Linux 4.14 以上可用。" -#: ../../library/os.rst:3771 +#: ../../library/os.rst:3772 msgid "" "Create and return an event file descriptor. The file descriptors supports " "raw :func:`read` and :func:`write` with a buffer size of 8, :func:`~select." @@ -4247,7 +4248,7 @@ msgid "" "ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3777 +#: ../../library/os.rst:3778 msgid "" "*initval* is the initial value of the event counter. The initial value must " "be a 32 bit unsigned integer. Please note that the initial value is limited " @@ -4255,39 +4256,39 @@ msgid "" "integer with a maximum value of 2\\ :sup:`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3782 +#: ../../library/os.rst:3783 msgid "" "*flags* can be constructed from :const:`EFD_CLOEXEC`, :const:`EFD_NONBLOCK`, " "and :const:`EFD_SEMAPHORE`." msgstr "" -#: ../../library/os.rst:3785 +#: ../../library/os.rst:3786 msgid "" "If :const:`EFD_SEMAPHORE` is specified and the event counter is non-zero, :" "func:`eventfd_read` returns 1 and decrements the counter by one." msgstr "" -#: ../../library/os.rst:3788 +#: ../../library/os.rst:3789 msgid "" "If :const:`EFD_SEMAPHORE` is not specified and the event counter is non-" "zero, :func:`eventfd_read` returns the current event counter value and " "resets the counter to zero." msgstr "" -#: ../../library/os.rst:3792 +#: ../../library/os.rst:3793 msgid "" "If the event counter is zero and :const:`EFD_NONBLOCK` is not specified, :" "func:`eventfd_read` blocks." msgstr "" -#: ../../library/os.rst:3795 +#: ../../library/os.rst:3796 msgid "" ":func:`eventfd_write` increments the event counter. Write blocks if the " "write operation would increment the counter to a value larger than 2\\ :sup:" "`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3801 +#: ../../library/os.rst:3802 msgid "" "import os\n" "\n" @@ -4305,64 +4306,64 @@ msgid "" " os.close(fd)" msgstr "" -#: ../../library/os.rst:3822 +#: ../../library/os.rst:3823 msgid "" "Read value from an :func:`eventfd` file descriptor and return a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3831 +#: ../../library/os.rst:3832 msgid "" "Add value to an :func:`eventfd` file descriptor. *value* must be a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3840 +#: ../../library/os.rst:3841 msgid "Set close-on-exec flag for new :func:`eventfd` file descriptor." msgstr "" -#: ../../library/os.rst:3848 +#: ../../library/os.rst:3849 msgid "" "Set :const:`O_NONBLOCK` status flag for new :func:`eventfd` file descriptor." msgstr "設定新的 :func:`eventfd` 檔案描述器的 :const:`O_NONBLOCK` 狀態旗標。" -#: ../../library/os.rst:3857 +#: ../../library/os.rst:3858 msgid "" "Provide semaphore-like semantics for reads from an :func:`eventfd` file " "descriptor. On read the internal counter is decremented by one." msgstr "" -#: ../../library/os.rst:3868 +#: ../../library/os.rst:3869 msgid "Timer File Descriptors" msgstr "" -#: ../../library/os.rst:3872 +#: ../../library/os.rst:3873 msgid "" "These functions provide support for Linux's *timer file descriptor* API. " "Naturally, they are all only available on Linux." msgstr "" -#: ../../library/os.rst:3877 +#: ../../library/os.rst:3878 msgid "Create and return a timer file descriptor (*timerfd*)." msgstr "" -#: ../../library/os.rst:3879 +#: ../../library/os.rst:3880 msgid "The file descriptor returned by :func:`timerfd_create` supports:" msgstr "" -#: ../../library/os.rst:3881 +#: ../../library/os.rst:3882 msgid ":func:`read`" msgstr ":func:`read`" -#: ../../library/os.rst:3882 +#: ../../library/os.rst:3883 msgid ":func:`~select.select`" msgstr ":func:`~select.select`" -#: ../../library/os.rst:3883 +#: ../../library/os.rst:3884 msgid ":func:`~select.poll`" msgstr ":func:`~select.poll`" -#: ../../library/os.rst:3885 +#: ../../library/os.rst:3886 msgid "" "The file descriptor's :func:`read` method can be called with a buffer size " "of 8. If the timer has already expired one or more times, :func:`read` " @@ -4371,31 +4372,31 @@ msgid "" "byteorder)``." msgstr "" -#: ../../library/os.rst:3890 +#: ../../library/os.rst:3891 msgid "" ":func:`~select.select` and :func:`~select.poll` can be used to wait until " "timer expires and the file descriptor is readable." msgstr "" -#: ../../library/os.rst:3893 +#: ../../library/os.rst:3894 msgid "" "*clockid* must be a valid :ref:`clock ID `, as " "defined in the :py:mod:`time` module:" msgstr "" -#: ../../library/os.rst:3896 +#: ../../library/os.rst:3897 msgid ":const:`time.CLOCK_REALTIME`" msgstr ":const:`time.CLOCK_REALTIME`" -#: ../../library/os.rst:3897 +#: ../../library/os.rst:3898 msgid ":const:`time.CLOCK_MONOTONIC`" msgstr ":const:`time.CLOCK_MONOTONIC`" -#: ../../library/os.rst:3898 +#: ../../library/os.rst:3899 msgid ":const:`time.CLOCK_BOOTTIME` (Since Linux 3.15 for timerfd_create)" msgstr "" -#: ../../library/os.rst:3900 +#: ../../library/os.rst:3901 msgid "" "If *clockid* is :const:`time.CLOCK_REALTIME`, a settable system-wide real-" "time clock is used. If system clock is changed, timer setting need to be " @@ -4403,35 +4404,35 @@ msgid "" "`TFD_TIMER_CANCEL_ON_SET`." msgstr "" -#: ../../library/os.rst:3905 +#: ../../library/os.rst:3906 msgid "" "If *clockid* is :const:`time.CLOCK_MONOTONIC`, a non-settable monotonically " "increasing clock is used. Even if the system clock is changed, the timer " "setting will not be affected." msgstr "" -#: ../../library/os.rst:3909 +#: ../../library/os.rst:3910 msgid "" "If *clockid* is :const:`time.CLOCK_BOOTTIME`, same as :const:`time." "CLOCK_MONOTONIC` except it includes any time that the system is suspended." msgstr "" -#: ../../library/os.rst:3912 +#: ../../library/os.rst:3913 msgid "" "The file descriptor's behaviour can be modified by specifying a *flags* " "value. Any of the following variables may used, combined using bitwise OR " "(the ``|`` operator):" msgstr "" -#: ../../library/os.rst:3916 +#: ../../library/os.rst:3917 msgid ":const:`TFD_NONBLOCK`" msgstr ":const:`TFD_NONBLOCK`" -#: ../../library/os.rst:3917 +#: ../../library/os.rst:3918 msgid ":const:`TFD_CLOEXEC`" msgstr ":const:`TFD_CLOEXEC`" -#: ../../library/os.rst:3919 +#: ../../library/os.rst:3920 msgid "" "If :const:`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks until the " "timer expires. If it is set as a flag, :func:`read` doesn't block, but If " @@ -4439,46 +4440,46 @@ msgid "" "raises :class:`OSError` with ``errno`` is set to :const:`errno.EAGAIN`." msgstr "" -#: ../../library/os.rst:3925 +#: ../../library/os.rst:3926 msgid ":const:`TFD_CLOEXEC` is always set by Python automatically." msgstr "" -#: ../../library/os.rst:3927 +#: ../../library/os.rst:3928 msgid "" "The file descriptor must be closed with :func:`os.close` when it is no " "longer needed, or else the file descriptor will be leaked." msgstr "" -#: ../../library/os.rst:3930 +#: ../../library/os.rst:3931 msgid "The :manpage:`timerfd_create(2)` man page." msgstr ":manpage:`timerfd_create(2)` 手冊頁。" -#: ../../library/os.rst:3939 +#: ../../library/os.rst:3940 msgid "" "Alter a timer file descriptor's internal timer. This function operates the " "same interval timer as :func:`timerfd_settime_ns`." msgstr "" -#: ../../library/os.rst:3942 +#: ../../library/os.rst:3943 msgid "*fd* must be a valid timer file descriptor." msgstr "" -#: ../../library/os.rst:3944 +#: ../../library/os.rst:3945 msgid "" "The timer's behaviour can be modified by specifying a *flags* value. Any of " "the following variables may used, combined using bitwise OR (the ``|`` " "operator):" msgstr "" -#: ../../library/os.rst:3948 +#: ../../library/os.rst:3949 msgid ":const:`TFD_TIMER_ABSTIME`" msgstr ":const:`TFD_TIMER_ABSTIME`" -#: ../../library/os.rst:3949 +#: ../../library/os.rst:3950 msgid ":const:`TFD_TIMER_CANCEL_ON_SET`" msgstr ":const:`TFD_TIMER_CANCEL_ON_SET`" -#: ../../library/os.rst:3951 +#: ../../library/os.rst:3952 msgid "" "The timer is disabled by setting *initial* to zero (``0``). If *initial* is " "equal to or greater than zero, the timer is enabled. If *initial* is less " @@ -4486,20 +4487,20 @@ msgid "" "const:`errno.EINVAL`" msgstr "" -#: ../../library/os.rst:3956 +#: ../../library/os.rst:3957 msgid "" "By default the timer will fire when *initial* seconds have elapsed. (If " "*initial* is zero, timer will fire immediately.)" msgstr "" -#: ../../library/os.rst:3959 +#: ../../library/os.rst:3960 msgid "" "However, if the :const:`TFD_TIMER_ABSTIME` flag is set, the timer will fire " "when the timer's clock (set by *clockid* in :func:`timerfd_create`) reaches " "*initial* seconds." msgstr "" -#: ../../library/os.rst:3963 +#: ../../library/os.rst:3964 msgid "" "The timer's interval is set by the *interval* :py:class:`float`. If " "*interval* is zero, the timer only fires once, on the initial expiration. If " @@ -4509,7 +4510,7 @@ msgid "" "EINVAL`" msgstr "" -#: ../../library/os.rst:3970 +#: ../../library/os.rst:3971 msgid "" "If the :const:`TFD_TIMER_CANCEL_ON_SET` flag is set along with :const:" "`TFD_TIMER_ABSTIME` and the clock for this timer is :const:`time." @@ -4518,86 +4519,86 @@ msgid "" "ECANCELED." msgstr "" -#: ../../library/os.rst:3976 +#: ../../library/os.rst:3977 msgid "" "Linux manages system clock as UTC. A daylight-savings time transition is " "done by changing time offset only and doesn't cause discontinuous system " "clock change." msgstr "" -#: ../../library/os.rst:3980 +#: ../../library/os.rst:3981 msgid "" "Discontinuous system clock change will be caused by the following events:" msgstr "" -#: ../../library/os.rst:3982 +#: ../../library/os.rst:3983 msgid "``settimeofday``" msgstr "``settimeofday``" -#: ../../library/os.rst:3983 +#: ../../library/os.rst:3984 msgid "``clock_settime``" msgstr "``clock_settime``" -#: ../../library/os.rst:3984 +#: ../../library/os.rst:3985 msgid "set the system date and time by ``date`` command" msgstr "" -#: ../../library/os.rst:3986 +#: ../../library/os.rst:3987 msgid "" "Return a two-item tuple of (``next_expiration``, ``interval``) from the " "previous timer state, before this function executed." msgstr "" -#: ../../library/os.rst:3991 +#: ../../library/os.rst:3992 msgid "" ":manpage:`timerfd_create(2)`, :manpage:`timerfd_settime(2)`, :manpage:" "`settimeofday(2)`, :manpage:`clock_settime(2)`, and :manpage:`date(1)`." msgstr "" -#: ../../library/os.rst:4002 +#: ../../library/os.rst:4003 msgid "" "Similar to :func:`timerfd_settime`, but use time as nanoseconds. This " "function operates the same interval timer as :func:`timerfd_settime`." msgstr "" -#: ../../library/os.rst:4012 +#: ../../library/os.rst:4013 msgid "Return a two-item tuple of floats (``next_expiration``, ``interval``)." msgstr "" -#: ../../library/os.rst:4014 +#: ../../library/os.rst:4015 msgid "" "``next_expiration`` denotes the relative time until next the timer next " "fires, regardless of if the :const:`TFD_TIMER_ABSTIME` flag is set." msgstr "" -#: ../../library/os.rst:4017 +#: ../../library/os.rst:4018 msgid "" "``interval`` denotes the timer's interval. If zero, the timer will only fire " "once, after ``next_expiration`` seconds have elapsed." msgstr "" -#: ../../library/os.rst:4021 +#: ../../library/os.rst:4022 msgid ":manpage:`timerfd_gettime(2)`" msgstr ":manpage:`timerfd_gettime(2)`" -#: ../../library/os.rst:4030 +#: ../../library/os.rst:4031 msgid "Similar to :func:`timerfd_gettime`, but return time as nanoseconds." msgstr "" -#: ../../library/os.rst:4038 +#: ../../library/os.rst:4039 msgid "" "A flag for the :func:`timerfd_create` function, which sets the :const:" "`O_NONBLOCK` status flag for the new timer file descriptor. If :const:" "`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks." msgstr "" -#: ../../library/os.rst:4048 +#: ../../library/os.rst:4049 msgid "" "A flag for the :func:`timerfd_create` function, If :const:`TFD_CLOEXEC` is " "set as a flag, set close-on-exec flag for new file descriptor." msgstr "" -#: ../../library/os.rst:4058 +#: ../../library/os.rst:4059 msgid "" "A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " "functions. If this flag is set, *initial* is interpreted as an absolute " @@ -4605,22 +4606,22 @@ msgid "" "Epoch)." msgstr "" -#: ../../library/os.rst:4068 +#: ../../library/os.rst:4069 msgid "" "A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " "functions along with :const:`TFD_TIMER_ABSTIME`. The timer is cancelled when " "the time of the underlying clock changes discontinuously." msgstr "" -#: ../../library/os.rst:4079 +#: ../../library/os.rst:4080 msgid "Linux extended attributes" msgstr "" -#: ../../library/os.rst:4083 +#: ../../library/os.rst:4084 msgid "These functions are all available on Linux only." msgstr "" -#: ../../library/os.rst:4087 +#: ../../library/os.rst:4088 msgid "" "Return the value of the extended filesystem attribute *attribute* for " "*path*. *attribute* can be bytes or str (directly or indirectly through the :" @@ -4628,7 +4629,7 @@ msgid "" "encoding." msgstr "" -#: ../../library/os.rst:4095 +#: ../../library/os.rst:4096 msgid "" "Raises an :ref:`auditing event ` ``os.getxattr`` with arguments " "``path``, ``attribute``." @@ -4636,12 +4637,12 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute`` 的\\ :ref:`稽核事件 ` " "``os.getxattr``。" -#: ../../library/os.rst:4097 ../../library/os.rst:4129 -#: ../../library/os.rst:4154 +#: ../../library/os.rst:4098 ../../library/os.rst:4130 +#: ../../library/os.rst:4155 msgid "Accepts a :term:`path-like object` for *path* and *attribute*." msgstr "" -#: ../../library/os.rst:4103 +#: ../../library/os.rst:4104 msgid "" "Return a list of the extended filesystem attributes on *path*. The " "attributes in the list are represented as strings decoded with the " @@ -4649,14 +4650,14 @@ msgid "" "the current directory." msgstr "" -#: ../../library/os.rst:4111 +#: ../../library/os.rst:4112 msgid "" "Raises an :ref:`auditing event ` ``os.listxattr`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.listxattr``。" -#: ../../library/os.rst:4119 +#: ../../library/os.rst:4120 msgid "" "Removes the extended filesystem attribute *attribute* from *path*. " "*attribute* should be bytes or str (directly or indirectly through the :" @@ -4664,7 +4665,7 @@ msgid "" "`filesystem encoding and error handler`." msgstr "" -#: ../../library/os.rst:4127 +#: ../../library/os.rst:4128 msgid "" "Raises an :ref:`auditing event ` ``os.removexattr`` with arguments " "``path``, ``attribute``." @@ -4672,7 +4673,7 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute`` 的\\ :ref:`稽核事件 ` " "``os.removexattr``。" -#: ../../library/os.rst:4135 +#: ../../library/os.rst:4136 msgid "" "Set the extended filesystem attribute *attribute* on *path* to *value*. " "*attribute* must be a bytes or str with no embedded NULs (directly or " @@ -4684,13 +4685,13 @@ msgid "" "will not be created and ``EEXISTS`` will be raised." msgstr "" -#: ../../library/os.rst:4149 +#: ../../library/os.rst:4150 msgid "" "A bug in Linux kernel versions less than 2.6.39 caused the flags argument to " "be ignored on some filesystems." msgstr "" -#: ../../library/os.rst:4152 +#: ../../library/os.rst:4153 msgid "" "Raises an :ref:`auditing event ` ``os.setxattr`` with arguments " "``path``, ``attribute``, ``value``, ``flags``." @@ -4698,33 +4699,33 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute``、``value``、``flags`` 的\\ :ref:`稽" "核事件 ` ``os.setxattr``。" -#: ../../library/os.rst:4160 +#: ../../library/os.rst:4161 msgid "" "The maximum size the value of an extended attribute can be. Currently, this " "is 64 KiB on Linux." msgstr "" -#: ../../library/os.rst:4166 +#: ../../library/os.rst:4167 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must create an attribute." msgstr "" -#: ../../library/os.rst:4172 +#: ../../library/os.rst:4173 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must replace an existing attribute." msgstr "" -#: ../../library/os.rst:4179 +#: ../../library/os.rst:4180 msgid "Process Management" msgstr "行程管理" -#: ../../library/os.rst:4181 +#: ../../library/os.rst:4182 msgid "These functions may be used to create and manage processes." msgstr "" -#: ../../library/os.rst:4183 +#: ../../library/os.rst:4184 msgid "" "The various :func:`exec\\* ` functions take a list of arguments for " "the new program loaded into the process. In each case, the first of these " @@ -4735,7 +4736,7 @@ msgid "" "standard output; ``foo`` will seem to be ignored." msgstr "" -#: ../../library/os.rst:4194 +#: ../../library/os.rst:4195 msgid "" "Generate a :const:`SIGABRT` signal to the current process. On Unix, the " "default behavior is to produce a core dump; on Windows, the process " @@ -4744,31 +4745,31 @@ msgid "" "`SIGABRT` with :func:`signal.signal`." msgstr "" -#: ../../library/os.rst:4203 +#: ../../library/os.rst:4204 msgid "Add a path to the DLL search path." msgstr "" -#: ../../library/os.rst:4205 +#: ../../library/os.rst:4206 msgid "" "This search path is used when resolving dependencies for imported extension " "modules (the module itself is resolved through :data:`sys.path`), and also " "by :mod:`ctypes`." msgstr "" -#: ../../library/os.rst:4209 +#: ../../library/os.rst:4210 msgid "" "Remove the directory by calling **close()** on the returned object or using " "it in a :keyword:`with` statement." msgstr "" -#: ../../library/os.rst:4212 +#: ../../library/os.rst:4213 msgid "" "See the `Microsoft documentation `_ for more information about how " "DLLs are loaded." msgstr "" -#: ../../library/os.rst:4216 +#: ../../library/os.rst:4217 msgid "" "Raises an :ref:`auditing event ` ``os.add_dll_directory`` with " "argument ``path``." @@ -4776,7 +4777,7 @@ msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os." "add_dll_directory``。" -#: ../../library/os.rst:4220 +#: ../../library/os.rst:4221 msgid "" "Previous versions of CPython would resolve DLLs using the default behavior " "for the current process. This led to inconsistencies, such as only sometimes " @@ -4784,14 +4785,14 @@ msgid "" "such as ``AddDllDirectory`` having no effect." msgstr "" -#: ../../library/os.rst:4227 +#: ../../library/os.rst:4228 msgid "" "In 3.8, the two primary ways DLLs are loaded now explicitly override the " "process-wide behavior to ensure consistency. See the :ref:`porting notes " "` for information on updating libraries." msgstr "" -#: ../../library/os.rst:4242 +#: ../../library/os.rst:4243 msgid "" "These functions all execute a new program, replacing the current process; " "they do not return. On Unix, the new executable is loaded into the current " @@ -4799,7 +4800,7 @@ msgid "" "reported as :exc:`OSError` exceptions." msgstr "" -#: ../../library/os.rst:4247 +#: ../../library/os.rst:4248 msgid "" "The current process is replaced immediately. Open file objects and " "descriptors are not flushed, so if there may be data buffered on these open " @@ -4807,7 +4808,7 @@ msgid "" "fsync` before calling an :func:`exec\\* ` function." msgstr "" -#: ../../library/os.rst:4253 +#: ../../library/os.rst:4254 msgid "" "The \"l\" and \"v\" variants of the :func:`exec\\* ` functions differ " "in how command-line arguments are passed. The \"l\" variants are perhaps " @@ -4820,7 +4821,7 @@ msgid "" "is not enforced." msgstr "" -#: ../../library/os.rst:4262 +#: ../../library/os.rst:4263 msgid "" "The variants which include a \"p\" near the end (:func:`execlp`, :func:" "`execlpe`, :func:`execvp`, and :func:`execvpe`) will use the :envvar:`PATH` " @@ -4834,7 +4835,7 @@ msgid "" "even on Windows, as plain names will not be resolved." msgstr "" -#: ../../library/os.rst:4273 +#: ../../library/os.rst:4274 msgid "" "For :func:`execle`, :func:`execlpe`, :func:`execve`, and :func:`execvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -4844,7 +4845,7 @@ msgid "" "process to inherit the environment of the current process." msgstr "" -#: ../../library/os.rst:4280 +#: ../../library/os.rst:4281 msgid "" "For :func:`execve` on some platforms, *path* may also be specified as an " "open file descriptor. This functionality may not be supported on your " @@ -4853,7 +4854,7 @@ msgid "" "`NotImplementedError`." msgstr "" -#: ../../library/os.rst:4285 +#: ../../library/os.rst:4286 msgid "" "Raises an :ref:`auditing event ` ``os.exec`` with arguments " "``path``, ``args``, ``env``." @@ -4861,25 +4862,25 @@ msgstr "" "引發一個附帶引數 ``path``、``args``、``env`` 的\\ :ref:`稽核事件 ` " "``os.exec``。" -#: ../../library/os.rst:4289 +#: ../../library/os.rst:4290 msgid "" "Added support for specifying *path* as an open file descriptor for :func:" "`execve`." msgstr "" -#: ../../library/os.rst:4298 +#: ../../library/os.rst:4299 msgid "" "Exit the process with status *n*, without calling cleanup handlers, flushing " "stdio buffers, etc." msgstr "" -#: ../../library/os.rst:4303 +#: ../../library/os.rst:4304 msgid "" "The standard way to exit is :func:`sys.exit(n) `. :func:`!_exit` " "should normally only be used in the child process after a :func:`fork`." msgstr "" -#: ../../library/os.rst:4306 +#: ../../library/os.rst:4307 msgid "" "The following exit codes are defined and can be used with :func:`_exit`, " "although they are not required. These are typically used for system " @@ -4887,139 +4888,139 @@ msgid "" "delivery program." msgstr "" -#: ../../library/os.rst:4312 +#: ../../library/os.rst:4313 msgid "" "Some of these may not be available on all Unix platforms, since there is " "some variation. These constants are defined where they are defined by the " "underlying platform." msgstr "" -#: ../../library/os.rst:4319 +#: ../../library/os.rst:4320 msgid "" "Exit code that means no error occurred. May be taken from the defined value " "of ``EXIT_SUCCESS`` on some platforms. Generally has a value of zero." msgstr "" -#: ../../library/os.rst:4327 +#: ../../library/os.rst:4328 msgid "" "Exit code that means the command was used incorrectly, such as when the " "wrong number of arguments are given." msgstr "" -#: ../../library/os.rst:4335 +#: ../../library/os.rst:4336 msgid "Exit code that means the input data was incorrect." msgstr "" -#: ../../library/os.rst:4342 +#: ../../library/os.rst:4343 msgid "Exit code that means an input file did not exist or was not readable." msgstr "" -#: ../../library/os.rst:4349 +#: ../../library/os.rst:4350 msgid "Exit code that means a specified user did not exist." msgstr "" -#: ../../library/os.rst:4356 +#: ../../library/os.rst:4357 msgid "Exit code that means a specified host did not exist." msgstr "" -#: ../../library/os.rst:4363 +#: ../../library/os.rst:4364 msgid "Exit code that means that a required service is unavailable." msgstr "" -#: ../../library/os.rst:4370 +#: ../../library/os.rst:4371 msgid "Exit code that means an internal software error was detected." msgstr "" -#: ../../library/os.rst:4377 +#: ../../library/os.rst:4378 msgid "" "Exit code that means an operating system error was detected, such as the " "inability to fork or create a pipe." msgstr "" -#: ../../library/os.rst:4385 +#: ../../library/os.rst:4386 msgid "" "Exit code that means some system file did not exist, could not be opened, or " "had some other kind of error." msgstr "" -#: ../../library/os.rst:4393 +#: ../../library/os.rst:4394 msgid "Exit code that means a user specified output file could not be created." msgstr "" -#: ../../library/os.rst:4400 +#: ../../library/os.rst:4401 msgid "" "Exit code that means that an error occurred while doing I/O on some file." msgstr "" -#: ../../library/os.rst:4407 +#: ../../library/os.rst:4408 msgid "" "Exit code that means a temporary failure occurred. This indicates something " "that may not really be an error, such as a network connection that couldn't " "be made during a retryable operation." msgstr "" -#: ../../library/os.rst:4416 +#: ../../library/os.rst:4417 msgid "" "Exit code that means that a protocol exchange was illegal, invalid, or not " "understood." msgstr "" -#: ../../library/os.rst:4424 +#: ../../library/os.rst:4425 msgid "" "Exit code that means that there were insufficient permissions to perform the " "operation (but not intended for file system problems)." msgstr "" -#: ../../library/os.rst:4432 +#: ../../library/os.rst:4433 msgid "Exit code that means that some kind of configuration error occurred." msgstr "" -#: ../../library/os.rst:4439 +#: ../../library/os.rst:4440 msgid "Exit code that means something like \"an entry was not found\"." msgstr "" -#: ../../library/os.rst:4446 +#: ../../library/os.rst:4447 msgid "" "Fork a child process. Return ``0`` in the child and the child's process id " "in the parent. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:4449 +#: ../../library/os.rst:4450 msgid "" "Note that some platforms including FreeBSD <= 6.3 and Cygwin have known " "issues when using ``fork()`` from a thread." msgstr "" -#: ../../library/os.rst:4452 +#: ../../library/os.rst:4453 msgid "" "Raises an :ref:`auditing event ` ``os.fork`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.fork``。" -#: ../../library/os.rst:4456 +#: ../../library/os.rst:4457 msgid "" "If you use TLS sockets in an application calling ``fork()``, see the warning " "in the :mod:`ssl` documentation." msgstr "" -#: ../../library/os.rst:4461 ../../library/os.rst:4505 +#: ../../library/os.rst:4462 ../../library/os.rst:4506 msgid "" "On macOS the use of this function is unsafe when mixed with using higher-" "level system APIs, and that includes using :mod:`urllib.request`." msgstr "" -#: ../../library/os.rst:4464 +#: ../../library/os.rst:4465 msgid "" "Calling ``fork()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:4468 +#: ../../library/os.rst:4469 msgid "" "If Python is able to detect that your process has multiple threads, :func:" "`os.fork` now raises a :exc:`DeprecationWarning`." msgstr "" -#: ../../library/os.rst:4472 +#: ../../library/os.rst:4473 msgid "" "We chose to surface this as a warning, when detectable, to better inform " "developers of a design problem that the POSIX platform specifically notes as " @@ -5030,21 +5031,21 @@ msgid "" "``free``)." msgstr "" -#: ../../library/os.rst:4481 +#: ../../library/os.rst:4482 msgid "" "Users of macOS or users of libc or malloc implementations other than those " "typically found in glibc to date are among those already more likely to " "experience deadlocks running such code." msgstr "" -#: ../../library/os.rst:4485 +#: ../../library/os.rst:4486 msgid "" "See `this discussion on fork being incompatible with threads `_ for technical details of why we're surfacing " "this longstanding platform compatibility problem to developers." msgstr "" -#: ../../library/os.rst:4495 +#: ../../library/os.rst:4496 msgid "" "Fork a child process, using a new pseudo-terminal as the child's controlling " "terminal. Return a pair of ``(pid, fd)``, where *pid* is ``0`` in the child, " @@ -5053,39 +5054,38 @@ msgid "" "the :mod:`pty` module. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:4501 +#: ../../library/os.rst:4502 msgid "" "Raises an :ref:`auditing event ` ``os.forkpty`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.forkpty``。" -#: ../../library/os.rst:4508 +#: ../../library/os.rst:4509 msgid "" "Calling ``forkpty()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:4512 +#: ../../library/os.rst:4513 msgid "" "If Python is able to detect that your process has multiple threads, this now " "raises a :exc:`DeprecationWarning`. See the longer explanation on :func:`os." "fork`." msgstr "" -#: ../../library/os.rst:4526 +#: ../../library/os.rst:4527 msgid "" "Send signal *sig* to the process *pid*. Constants for the specific signals " "available on the host platform are defined in the :mod:`signal` module." msgstr "" -#: ../../library/os.rst:4529 +#: ../../library/os.rst:4530 msgid "" "Windows: The :const:`signal.CTRL_C_EVENT` and :const:`signal." "CTRL_BREAK_EVENT` signals are special signals which can only be sent to " "console processes which share a common console window, e.g., some " "subprocesses. Any other value for *sig* will cause the process to be " "unconditionally killed by the TerminateProcess API, and the exit code will " -"be set to *sig*. The Windows version of :func:`kill` additionally takes " -"process handles to be killed." +"be set to *sig*." msgstr "" #: ../../library/os.rst:4537 @@ -6276,7 +6276,7 @@ msgid "" msgstr "" #: ../../library/os.rst:5544 -msgid "See also the :func:`sched_getaffinity` functions." +msgid "See also the :func:`sched_getaffinity` function." msgstr "也請見 :func:`sched_getaffinity` 函式。" #: ../../library/os.rst:5551 @@ -6515,7 +6515,7 @@ msgstr "" #: ../../library/os.rst:372 ../../library/os.rst:438 ../../library/os.rst:447 #: ../../library/os.rst:456 ../../library/os.rst:470 ../../library/os.rst:666 -#: ../../library/os.rst:4522 ../../library/os.rst:4549 +#: ../../library/os.rst:4523 ../../library/os.rst:4549 msgid "process" msgstr "process" @@ -6569,7 +6569,7 @@ msgstr "pty" #: ../../library/os.rst:2045 ../../library/os.rst:2457 #: ../../library/os.rst:2658 ../../library/os.rst:3562 -#: ../../library/os.rst:3661 +#: ../../library/os.rst:3662 msgid "directory" msgstr "directory(目錄)" @@ -6593,19 +6593,19 @@ msgstr "以及 os.makedirs()" msgid "stat" msgstr "stat" -#: ../../library/os.rst:3562 ../../library/os.rst:3661 +#: ../../library/os.rst:3562 ../../library/os.rst:3662 msgid "walking" msgstr "" -#: ../../library/os.rst:3562 ../../library/os.rst:3661 +#: ../../library/os.rst:3562 ../../library/os.rst:3662 msgid "traversal" msgstr "traversal(遍歷)" -#: ../../library/os.rst:4522 ../../library/os.rst:4549 +#: ../../library/os.rst:4523 ../../library/os.rst:4549 msgid "killing" msgstr "" -#: ../../library/os.rst:4522 ../../library/os.rst:4549 +#: ../../library/os.rst:4523 ../../library/os.rst:4549 msgid "signalling" msgstr "signalling(信號)" diff --git a/library/pathlib.po b/library/pathlib.po index ffd0c4ac4f..4db35f669b 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -23,9 +23,8 @@ msgid ":mod:`!pathlib` --- Object-oriented filesystem paths" msgstr ":mod:`!pathlib` --- 物件導向檔案系統路徑" #: ../../library/pathlib.rst:9 -#, fuzzy msgid "**Source code:** :source:`Lib/pathlib/`" -msgstr "**原始碼:**\\ :source:`Lib/pathlib.py`" +msgstr "**原始碼:**\\ :source:`Lib/pathlib/`" #: ../../library/pathlib.rst:15 msgid "" @@ -188,9 +187,8 @@ msgstr "" "'#!/bin/bash\\n'" #: ../../library/pathlib.rst:97 -#, fuzzy msgid "Exceptions" -msgstr "operations(操作)" +msgstr "例外" #: ../../library/pathlib.rst:101 msgid "" @@ -864,9 +862,8 @@ msgstr "" "''" #: ../../library/pathlib.rst:447 -#, fuzzy msgid "The last dot-separated portion of the final component, if any::" -msgstr "若存在則為最後的路徑組成的檔案副檔名: ::" +msgstr "以點分隔路徑的最後一個部分(如存在): ::" #: ../../library/pathlib.rst:449 msgid "" @@ -885,14 +882,12 @@ msgstr "" "''" #: ../../library/pathlib.rst:456 -#, fuzzy msgid "This is commonly called the file extension." -msgstr "路徑檔案副檔名的串列: ::" +msgstr "這通常被稱為檔案副檔名。" #: ../../library/pathlib.rst:460 -#, fuzzy msgid "A list of the path's suffixes, often called file extensions::" -msgstr "路徑檔案副檔名的串列: ::" +msgstr "一個路徑後綴 (suffix) 的串列,通常被稱為檔案副檔名: ::" #: ../../library/pathlib.rst:462 msgid "" @@ -912,7 +907,7 @@ msgstr "" #: ../../library/pathlib.rst:472 msgid "The final path component, without its suffix::" -msgstr "最後的路徑組成,不包括後綴 (suffix): ::" +msgstr "最後的路徑組成,不包括後綴: ::" #: ../../library/pathlib.rst:474 msgid "" @@ -1054,16 +1049,14 @@ msgstr "" "PureWindowsPath('c:/Program Files')" #: ../../library/pathlib.rst:568 -#, fuzzy msgid "" "Match this path against the provided glob-style pattern. Return ``True`` if " "matching is successful, ``False`` otherwise. For example::" msgstr "" "將路徑與 glob 形式的樣式 (glob-style pattern) 做比對。如果比對成功則回傳 " -"``True``,否則回傳 ``False``。" +"``True``,否則回傳 ``False``,例如: ::" #: ../../library/pathlib.rst:571 -#, fuzzy msgid "" ">>> PurePath('a/b.py').full_match('a/*.py')\n" "True\n" @@ -1074,12 +1067,14 @@ msgid "" ">>> PurePath('/a/b/c.py').full_match('**/*.py')\n" "True" msgstr "" -">>> PurePath('a/b.py').match('*.py')\n" +">>> PurePath('a/b.py').full_match('a/*.py')\n" "True\n" -">>> PurePath('/a/b/c.py').match('b/*.py')\n" +">>> PurePath('a/b.py').full_match('*.py')\n" +"False\n" +">>> PurePath('/a/b/c.py').full_match('/a/**')\n" "True\n" -">>> PurePath('/a/b/c.py').match('a/*.py')\n" -"False" +">>> PurePath('/a/b/c.py').full_match('**/*.py')\n" +"True" #: ../../library/pathlib.rst:581 ../../library/pathlib.rst:1291 msgid ":ref:`pathlib-pattern-language` documentation." @@ -1090,16 +1085,15 @@ msgid "As with other methods, case-sensitivity follows platform defaults::" msgstr "像其它方法一樣,是否區分大小寫會遵循平台的預設行為: ::" #: ../../library/pathlib.rst:585 -#, fuzzy msgid "" ">>> PurePosixPath('b.py').full_match('*.PY')\n" "False\n" ">>> PureWindowsPath('b.py').full_match('*.PY')\n" "True" msgstr "" -">>> PurePosixPath('b.py').match('*.PY')\n" +">>> PurePosixPath('b.py').full_match('*.PY')\n" "False\n" -">>> PureWindowsPath('b.py').match('*.PY')\n" +">>> PureWindowsPath('b.py').full_match('*.PY')\n" "True" #: ../../library/pathlib.rst:590 @@ -1108,13 +1102,12 @@ msgid "" msgstr "將 *case_sensitive* 設定成 ``True`` 或 ``False`` 會覆蓋這個行為。" #: ../../library/pathlib.rst:597 -#, fuzzy msgid "" "Match this path against the provided non-recursive glob-style pattern. " "Return ``True`` if matching is successful, ``False`` otherwise." msgstr "" -"將路徑與 glob 形式的樣式 (glob-style pattern) 做比對。如果比對成功則回傳 " -"``True``,否則回傳 ``False``。" +"將路徑與非遞迴 glob 形式的樣式 (glob-style pattern) 做比對。如果比對成功則回" +"傳 ``True``,否則回傳 ``False``。" #: ../../library/pathlib.rst:600 msgid "" @@ -1478,7 +1471,6 @@ msgstr "" "你的應用程式導致漏洞或故障): ::" #: ../../library/pathlib.rst:802 -#, fuzzy msgid "" ">>> import os\n" ">>> os.name\n" @@ -1506,7 +1498,7 @@ msgstr "" " File \"\", line 1, in \n" " File \"pathlib.py\", line 798, in __new__\n" " % (cls.__name__,))\n" -"NotImplementedError: cannot instantiate 'WindowsPath' on your system" +"UnsupportedOperation: cannot instantiate 'WindowsPath' on your system" #: ../../library/pathlib.rst:816 msgid "" @@ -1536,12 +1528,11 @@ msgid "Return a new path object from parsing a 'file' URI. For example::" msgstr "" #: ../../library/pathlib.rst:835 -#, fuzzy msgid "" ">>> p = Path.from_uri('file:///etc/hosts')\n" "PosixPath('/etc/hosts')" msgstr "" -">>> PosixPath('/etc/hosts')\n" +">>> p = Path.from_uri('file:///etc/hosts')\n" "PosixPath('/etc/hosts')" #: ../../library/pathlib.rst:838 @@ -1549,17 +1540,16 @@ msgid "On Windows, DOS device and UNC paths may be parsed from URIs::" msgstr "" #: ../../library/pathlib.rst:840 -#, fuzzy msgid "" ">>> p = Path.from_uri('file:///c:/windows')\n" "WindowsPath('c:/windows')\n" ">>> p = Path.from_uri('file://server/share')\n" "WindowsPath('//server/share')" msgstr "" -">>> PureWindowsPath('c:/', 'Users', 'Ximénez')\n" -"PureWindowsPath('c:/Users/Ximénez')\n" -">>> PureWindowsPath('//server/share/file')\n" -"PureWindowsPath('//server/share/file')" +">>> p = Path.from_uri('file:///c:/windows')\n" +"WindowsPath('c:/windows')\n" +">>> p = Path.from_uri('file://server/share')\n" +"WindowsPath('//server/share')" #: ../../library/pathlib.rst:845 msgid "Several variant forms are supported::" @@ -1584,15 +1574,14 @@ msgid "" msgstr "" #: ../../library/pathlib.rst:864 -#, fuzzy msgid "" "Represent the path as a 'file' URI. :exc:`ValueError` is raised if the path " "isn't absolute." msgstr "" -"以 ``file`` URI 來表示一個路徑。如果不是絕對路徑會引發 :exc:`ValueError`。" +"以 ``file`` URI 來表示一個路徑。如果路徑不是絕對的則會引發 :exc:" +"`ValueError`。" #: ../../library/pathlib.rst:867 -#, fuzzy msgid "" ">>> p = PosixPath('/etc/passwd')\n" ">>> p.as_uri()\n" @@ -1601,12 +1590,12 @@ msgid "" ">>> p.as_uri()\n" "'file:///c:/Windows'" msgstr "" -">>> p = PurePath('/etc')\n" -">>> str(p)\n" -"'/etc'\n" -">>> p = PureWindowsPath('c:/Program Files')\n" -">>> str(p)\n" -"'c:\\\\Program Files'" +">>> p = PosixPath('/etc/passwd')\n" +">>> p.as_uri()\n" +"'file:///etc/passwd'\n" +">>> p = WindowsPath('c:/Windows')\n" +">>> p.as_uri()\n" +"'file:///c:/Windows'" #: ../../library/pathlib.rst:876 msgid "" @@ -1727,16 +1716,15 @@ msgstr "" "PosixPath('/home/antoine/pathlib/setup.py')" #: ../../library/pathlib.rst:951 -#, fuzzy msgid "" "If a path doesn't exist or a symlink loop is encountered, and *strict* is " "``True``, :exc:`OSError` is raised. If *strict* is ``False``, the path is " "resolved as far as possible and any remainder is appended without checking " "whether it exists." msgstr "" -"如果路徑不存在且 *strict* 為 ``True``,則引發 :exc:`FileNotFoundError`。如果 " -"*strict* 為 ``False``,則將盡可能解析該路徑,並將任何剩餘部分追加到路徑中,而" -"不檢查其是否存在。如果在解析過程中遇到無窮迴圈,則引發 :exc:`RuntimeError`。" +"如果路徑不存在或遇到符號連結迴圈,且 *strict* 為 ``True``,則引發 :exc:" +"`OSError`。如果 *strict* 為 ``False``,則將盡可能解析該路徑,並將任何剩餘部分" +"追加到路徑中,而不檢查其是否存在。" #: ../../library/pathlib.rst:956 msgid "The *strict* parameter was added (pre-3.6 behavior is strict)." @@ -1869,13 +1857,12 @@ msgstr "" "False" #: ../../library/pathlib.rst:1045 -#, fuzzy msgid "" "Return ``True`` if the path points to a regular file, ``False`` if it points " "to another kind of file." msgstr "" -"如果該路徑指向一個普通檔案(或者是一個指向普通檔案的符號連結)則回傳 " -"``True``,如果指向其他類型的檔案則回傳 ``False``。" +"如果該路徑指向一個普通檔案則回傳 ``True``,如果指向其他類型的檔案則回傳 " +"``False``。" #: ../../library/pathlib.rst:1048 ../../library/pathlib.rst:1063 #: ../../library/pathlib.rst:1111 ../../library/pathlib.rst:1120 @@ -1888,30 +1875,27 @@ msgstr "" "限錯誤)則會傳遞出來。" #: ../../library/pathlib.rst:1051 -#, fuzzy msgid "" "This method normally follows symlinks; to exclude symlinks, add the argument " "``follow_symlinks=False``." msgstr "" -"此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " +"此方法通常會跟隨符號連結;如果想將符號連結除外,可以加上引數 " "``follow_symlinks=False``。" #: ../../library/pathlib.rst:1060 -#, fuzzy msgid "" "Return ``True`` if the path points to a directory, ``False`` if it points to " "another kind of file." msgstr "" -"如果該路徑指向一個目錄(或者是一個指向目錄的符號連結)則回傳 ``True``,如果指" -"向其他類型的檔案則回傳 ``False``。" +"如果該路徑指向一個目錄則回傳 ``True``,如果指向其他類型的檔案則回傳 " +"``False``。" #: ../../library/pathlib.rst:1066 -#, fuzzy msgid "" "This method normally follows symlinks; to exclude symlinks to directories, " "add the argument ``follow_symlinks=False``." msgstr "" -"此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " +"此方法通常會跟隨符號連結;如果想將對目錄的符號連結除外,可以加上引數 " "``follow_symlinks=False``。" #: ../../library/pathlib.rst:1075 @@ -2174,7 +2158,6 @@ msgstr "" "對到的檔案(任意類型): ::" #: ../../library/pathlib.rst:1279 -#, fuzzy msgid "" ">>> sorted(Path('.').glob('*.py'))\n" "[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." @@ -2188,6 +2171,11 @@ msgid "" " PosixPath('setup.py'),\n" " PosixPath('test_pathlib.py')]" msgstr "" +">>> sorted(Path('.').glob('*.py'))\n" +"[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." +"py')]\n" +">>> sorted(Path('.').glob('*/*.py'))\n" +"[PosixPath('docs/conf.py')]\n" ">>> sorted(Path('.').glob('**/*.py'))\n" "[PosixPath('build/lib/pathlib.py'),\n" " PosixPath('docs/conf.py'),\n" @@ -2223,9 +2211,8 @@ msgstr "" "``pathlib.Path.glob``。" #: ../../library/pathlib.rst:1307 ../../library/pathlib.rst:1332 -#, fuzzy msgid "The *recurse_symlinks* parameter was added." -msgstr "新增 *follow_symlinks* 參數。" +msgstr "新增 *recurse_symlinks* 參數。" #: ../../library/pathlib.rst:1313 msgid "" @@ -2235,18 +2222,16 @@ msgid "" msgstr "" #: ../../library/pathlib.rst:1321 -#, fuzzy msgid "" "Glob the given relative *pattern* recursively. This is like calling :func:" "`Path.glob` with \"``**/``\" added in front of the *pattern*." msgstr "" "遞迴地 glob 給定的相對 *pattern*。這相當於在給定的相對 *pattern* 前面加上 " -"\"``**/``\" 並呼叫 :func:`Path.glob`,其中 *patterns* 和給 :mod:`fnmatch` 的" -"相同: ::" +"\"``**/``\" 並呼叫 :func:`Path.glob`。" #: ../../library/pathlib.rst:1325 msgid ":ref:`pathlib-pattern-language` and :meth:`Path.glob` documentation." -msgstr "" +msgstr ":ref:`pathlib-pattern-language` 和 :meth:`Path.glob` 文件。" #: ../../library/pathlib.rst:1327 msgid "" @@ -2670,7 +2655,6 @@ msgid "Permissions and ownership" msgstr "" #: ../../library/pathlib.rst:1590 -#, fuzzy msgid "" "Return the name of the user owning the file. :exc:`KeyError` is raised if " "the file's user identifier (UID) isn't found in the system database." @@ -2679,12 +2663,11 @@ msgstr "" "(UID),則會引發 :exc:`KeyError`。" #: ../../library/pathlib.rst:1593 -#, fuzzy msgid "" "This method normally follows symlinks; to get the owner of the symlink, add " "the argument ``follow_symlinks=False``." msgstr "" -"此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " +"此方法通常會跟隨符號連結;如果想取得符號連結的擁有者,可以加上引數 " "``follow_symlinks=False``。" #: ../../library/pathlib.rst:1596 @@ -2694,7 +2677,6 @@ msgid "" msgstr "" #: ../../library/pathlib.rst:1606 -#, fuzzy msgid "" "Return the name of the group owning the file. :exc:`KeyError` is raised if " "the file's group identifier (GID) isn't found in the system database." @@ -2703,12 +2685,11 @@ msgstr "" "發 :exc:`KeyError`。" #: ../../library/pathlib.rst:1609 -#, fuzzy msgid "" "This method normally follows symlinks; to get the group of the symlink, add " "the argument ``follow_symlinks=False``." msgstr "" -"此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " +"此方法通常會跟隨符號連結;如果想取得符號連結的群組,可以加上引數 " "``follow_symlinks=False``。" #: ../../library/pathlib.rst:1612 @@ -2828,11 +2809,11 @@ msgstr "" #: ../../library/pathlib.rst:1674 msgid "Meaning" -msgstr "" +msgstr "意涵" #: ../../library/pathlib.rst:1676 msgid "\"``**/*``\"" -msgstr "" +msgstr "\"``**/*``\"" #: ../../library/pathlib.rst:1676 msgid "Any path with at least one segment." @@ -2840,7 +2821,7 @@ msgstr "" #: ../../library/pathlib.rst:1677 msgid "\"``**/*.py``\"" -msgstr "" +msgstr "\"``**/*.py``\"" #: ../../library/pathlib.rst:1677 msgid "Any path with a final segment ending \"``.py``\"." @@ -2848,7 +2829,7 @@ msgstr "" #: ../../library/pathlib.rst:1678 msgid "\"``assets/**``\"" -msgstr "" +msgstr "\"``assets/**``\"" #: ../../library/pathlib.rst:1678 msgid "Any path starting with \"``assets/``\"." @@ -2856,7 +2837,7 @@ msgstr "" #: ../../library/pathlib.rst:1679 msgid "\"``assets/**/*``\"" -msgstr "" +msgstr "\"``assets/**/*``\"" #: ../../library/pathlib.rst:1679 msgid "" @@ -2882,18 +2863,16 @@ msgid "" msgstr "" #: ../../library/pathlib.rst:1693 -#, fuzzy msgid "" "Globbing with a pattern that ends with a pathname components separator (:" "data:`~os.sep` or :data:`~os.altsep`) returns only directories." msgstr "" "如果 *pattern* 以路徑名稱組成的分隔符號(:data:`~os.sep` 或 :data:`~os." -"altsep`)作結尾則只會回傳目錄。" +"altsep`)作結尾來 glob 則只會回傳目錄。" #: ../../library/pathlib.rst:1699 -#, fuzzy msgid "Comparison to the :mod:`glob` module" -msgstr "與 :mod:`os` 模組裡的工具的對應關係" +msgstr "與 :mod:`glob` 模組的比較" #: ../../library/pathlib.rst:1701 msgid "" @@ -2942,9 +2921,8 @@ msgid "" msgstr "" #: ../../library/pathlib.rst:1724 -#, fuzzy msgid "Comparison to the :mod:`os` and :mod:`os.path` modules" -msgstr ":mod:`os` 和 :mod:`os.path`" +msgstr "與 :mod:`os` 和 :mod:`os.path` 模組的比較" #: ../../library/pathlib.rst:1726 msgid "" diff --git a/library/pydoc.po b/library/pydoc.po index d301141ac0..8e39b85b7c 100644 --- a/library/pydoc.po +++ b/library/pydoc.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-10-30 00:13+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -80,18 +79,19 @@ msgstr "" #: ../../library/pydoc.rst:54 msgid "" "When printing output to the console, :program:`pydoc` attempts to paginate " -"the output for easier reading. If the :envvar:`PAGER` environment variable " -"is set, :program:`pydoc` will use its value as a pagination program." +"the output for easier reading. If either the :envvar:`MANPAGER` or the :" +"envvar:`PAGER` environment variable is set, :program:`pydoc` will use its " +"value as a pagination program. When both are set, :envvar:`MANPAGER` is used." msgstr "" -#: ../../library/pydoc.rst:58 +#: ../../library/pydoc.rst:59 msgid "" "Specifying a ``-w`` flag before the argument will cause HTML documentation " "to be written out to a file in the current directory, instead of displaying " "text on the console." msgstr "" -#: ../../library/pydoc.rst:62 +#: ../../library/pydoc.rst:63 msgid "" "Specifying a ``-k`` flag before the argument will search the synopsis lines " "of all available modules for the keyword given as the argument, again in a " @@ -99,7 +99,7 @@ msgid "" "module is the first line of its documentation string." msgstr "" -#: ../../library/pydoc.rst:67 +#: ../../library/pydoc.rst:68 msgid "" "You can also use :program:`pydoc` to start an HTTP server on the local " "machine that will serve documentation to visiting web browsers. :program:" @@ -109,7 +109,7 @@ msgid "" "arbitrary unused port." msgstr "" -#: ../../library/pydoc.rst:73 +#: ../../library/pydoc.rst:74 msgid "" ":program:`python -m pydoc -n ` will start the server listening at " "the given hostname. By default the hostname is 'localhost' but if you want " @@ -118,7 +118,7 @@ msgid "" "especially useful if you want to run pydoc from within a container." msgstr "" -#: ../../library/pydoc.rst:79 +#: ../../library/pydoc.rst:80 msgid "" ":program:`python -m pydoc -b` will start the server and additionally open a " "web browser to a module index page. Each served page has a navigation bar " @@ -127,7 +127,7 @@ msgid "" "*Topics* and *Keywords* pages." msgstr "" -#: ../../library/pydoc.rst:85 +#: ../../library/pydoc.rst:86 msgid "" "When :program:`pydoc` generates documentation, it uses the current " "environment and path to locate modules. Thus, invoking :program:`pydoc " @@ -135,7 +135,7 @@ msgid "" "started the Python interpreter and typed ``import spam``." msgstr "" -#: ../../library/pydoc.rst:90 +#: ../../library/pydoc.rst:91 msgid "" "Module docs for core modules are assumed to reside in ``https://docs.python." "org/X.Y/library/`` where ``X`` and ``Y`` are the major and minor version " @@ -144,21 +144,21 @@ msgid "" "directory containing the Library Reference Manual pages." msgstr "" -#: ../../library/pydoc.rst:97 +#: ../../library/pydoc.rst:98 msgid "Added the ``-b`` option." msgstr "新增 ``-b`` 選項。" -#: ../../library/pydoc.rst:100 +#: ../../library/pydoc.rst:101 msgid "The ``-g`` command line option was removed." msgstr "" -#: ../../library/pydoc.rst:103 +#: ../../library/pydoc.rst:104 msgid "" ":mod:`!pydoc` now uses :func:`inspect.signature` rather than :func:`inspect." "getfullargspec` to extract signature information from callables." msgstr "" -#: ../../library/pydoc.rst:108 +#: ../../library/pydoc.rst:109 msgid "Added the ``-n`` option." msgstr "新增 ``-n`` 選項。" diff --git a/library/re.po b/library/re.po index ade794f4a6..c5ceb995d2 100644 --- a/library/re.po +++ b/library/re.po @@ -1615,7 +1615,7 @@ msgstr "" #: ../../library/re.rst:1184 msgid "Exceptions" -msgstr "" +msgstr "例外" #: ../../library/re.rst:1188 msgid "" diff --git a/library/selectors.po b/library/selectors.po index 8ba4c1202d..6b0f35f089 100644 --- a/library/selectors.po +++ b/library/selectors.po @@ -114,7 +114,7 @@ msgstr "" #: ../../library/selectors.rst:61 msgid "Constant" -msgstr "" +msgstr "常數" #: ../../library/selectors.rst:61 msgid "Meaning" diff --git a/library/sqlite3.po b/library/sqlite3.po index 05aaa3758b..7d1f66f4ea 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-11-02 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -811,7 +811,7 @@ msgstr "" #: ../../library/sqlite3.rst:596 msgid "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" -msgstr "" +msgstr "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" #: ../../library/sqlite3.rst:597 msgid "SQLite docs: Database Connection Configuration Options" @@ -2959,20 +2959,22 @@ msgid "" ">>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n" ">>> con.execute(\"CREATE TABLE readonly(data)\")\n" "Traceback (most recent call last):\n" -"OperationalError: attempt to write a readonly database" +"OperationalError: attempt to write a readonly database\n" +">>> con.close()" msgstr "" ">>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n" ">>> con.execute(\"CREATE TABLE readonly(data)\")\n" "Traceback (most recent call last):\n" -"OperationalError: attempt to write a readonly database" +"OperationalError: attempt to write a readonly database\n" +">>> con.close()" -#: ../../library/sqlite3.rst:2464 +#: ../../library/sqlite3.rst:2465 msgid "" "Do not implicitly create a new database file if it does not already exist; " "will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:" msgstr "" -#: ../../library/sqlite3.rst:2467 +#: ../../library/sqlite3.rst:2468 msgid "" ">>> con = sqlite3.connect(\"file:nosuchdb.db?mode=rw\", uri=True)\n" "Traceback (most recent call last):\n" @@ -2982,11 +2984,11 @@ msgstr "" "Traceback (most recent call last):\n" "OperationalError: unable to open database file" -#: ../../library/sqlite3.rst:2474 +#: ../../library/sqlite3.rst:2475 msgid "Create a shared named in-memory database:" msgstr "" -#: ../../library/sqlite3.rst:2476 +#: ../../library/sqlite3.rst:2477 msgid "" "db = \"file:mem1?mode=memory&cache=shared\"\n" "con1 = sqlite3.connect(db, uri=True)\n" @@ -3012,24 +3014,24 @@ msgstr "" "con1.close()\n" "con2.close()" -#: ../../library/sqlite3.rst:2490 +#: ../../library/sqlite3.rst:2491 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:2499 +#: ../../library/sqlite3.rst:2500 msgid "How to create and use row factories" msgstr "" -#: ../../library/sqlite3.rst:2501 +#: ../../library/sqlite3.rst:2502 msgid "" "By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If a :" "class:`!tuple` does not suit your needs, you can use the :class:`sqlite3." "Row` class or a custom :attr:`~Cursor.row_factory`." msgstr "" -#: ../../library/sqlite3.rst:2506 +#: ../../library/sqlite3.rst:2507 msgid "" "While :attr:`!row_factory` exists as an attribute both on the :class:" "`Cursor` and the :class:`Connection`, it is recommended to set :class:" @@ -3037,7 +3039,7 @@ msgid "" "use the same row factory." msgstr "" -#: ../../library/sqlite3.rst:2511 +#: ../../library/sqlite3.rst:2512 msgid "" ":class:`!Row` provides indexed and case-insensitive named access to columns, " "with minimal memory overhead and performance impact over a :class:`!tuple`. " @@ -3045,7 +3047,7 @@ msgid "" "attribute:" msgstr "" -#: ../../library/sqlite3.rst:2516 +#: ../../library/sqlite3.rst:2517 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" @@ -3053,11 +3055,11 @@ msgstr "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" -#: ../../library/sqlite3.rst:2521 +#: ../../library/sqlite3.rst:2522 msgid "Queries now return :class:`!Row` objects:" msgstr "" -#: ../../library/sqlite3.rst:2523 +#: ../../library/sqlite3.rst:2524 msgid "" ">>> res = con.execute(\"SELECT 'Earth' AS name, 6378 AS radius\")\n" ">>> row = res.fetchone()\n" @@ -3072,7 +3074,7 @@ msgid "" ">>> con.close()" msgstr "" -#: ../../library/sqlite3.rst:2539 +#: ../../library/sqlite3.rst:2540 msgid "" "The ``FROM`` clause can be omitted in the ``SELECT`` statement, as in the " "above example. In such cases, SQLite returns a single row with columns " @@ -3080,13 +3082,13 @@ msgid "" "alias``." msgstr "" -#: ../../library/sqlite3.rst:2544 +#: ../../library/sqlite3.rst:2545 msgid "" "You can create a custom :attr:`~Cursor.row_factory` that returns each row as " "a :class:`dict`, with column names mapped to values:" msgstr "" -#: ../../library/sqlite3.rst:2547 +#: ../../library/sqlite3.rst:2548 msgid "" "def dict_factory(cursor, row):\n" " fields = [column[0] for column in cursor.description]\n" @@ -3096,12 +3098,12 @@ msgstr "" " fields = [column[0] for column in cursor.description]\n" " return {key: value for key, value in zip(fields, row)}" -#: ../../library/sqlite3.rst:2553 +#: ../../library/sqlite3.rst:2554 msgid "" "Using it, queries now return a :class:`!dict` instead of a :class:`!tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2555 +#: ../../library/sqlite3.rst:2556 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = dict_factory\n" @@ -3117,11 +3119,11 @@ msgstr "" "{'a': 1, 'b': 2}\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2564 +#: ../../library/sqlite3.rst:2565 msgid "The following row factory returns a :term:`named tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2566 +#: ../../library/sqlite3.rst:2567 msgid "" "from collections import namedtuple\n" "\n" @@ -3137,11 +3139,11 @@ msgstr "" " cls = namedtuple(\"Row\", fields)\n" " return cls._make(row)" -#: ../../library/sqlite3.rst:2575 +#: ../../library/sqlite3.rst:2576 msgid ":func:`!namedtuple_factory` can be used as follows:" msgstr "" -#: ../../library/sqlite3.rst:2577 +#: ../../library/sqlite3.rst:2578 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = namedtuple_factory\n" @@ -3167,18 +3169,18 @@ msgstr "" "2\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2591 +#: ../../library/sqlite3.rst:2592 msgid "" "With some adjustments, the above recipe can be adapted to use a :class:" "`~dataclasses.dataclass`, or any other custom class, instead of a :class:" "`~collections.namedtuple`." msgstr "" -#: ../../library/sqlite3.rst:2599 +#: ../../library/sqlite3.rst:2600 msgid "How to handle non-UTF-8 text encodings" msgstr "" -#: ../../library/sqlite3.rst:2601 +#: ../../library/sqlite3.rst:2602 msgid "" "By default, :mod:`!sqlite3` uses :class:`str` to adapt SQLite values with " "the ``TEXT`` data type. This works well for UTF-8 encoded text, but it might " @@ -3186,7 +3188,7 @@ msgid "" "`~Connection.text_factory` to handle such cases." msgstr "" -#: ../../library/sqlite3.rst:2607 +#: ../../library/sqlite3.rst:2608 msgid "" "Because of SQLite's `flexible typing`_, it is not uncommon to encounter " "table columns with the ``TEXT`` data type containing non-UTF-8 encodings, or " @@ -3197,39 +3199,39 @@ msgid "" "text using this :attr:`~Connection.text_factory`:" msgstr "" -#: ../../library/sqlite3.rst:2616 +#: ../../library/sqlite3.rst:2617 msgid "con.text_factory = lambda data: str(data, encoding=\"latin2\")" msgstr "con.text_factory = lambda data: str(data, encoding=\"latin2\")" -#: ../../library/sqlite3.rst:2620 +#: ../../library/sqlite3.rst:2621 msgid "" "For invalid UTF-8 or arbitrary data in stored in ``TEXT`` table columns, you " "can use the following technique, borrowed from the :ref:`unicode-howto`:" msgstr "" -#: ../../library/sqlite3.rst:2623 +#: ../../library/sqlite3.rst:2624 msgid "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" msgstr "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" -#: ../../library/sqlite3.rst:2629 +#: ../../library/sqlite3.rst:2630 msgid "" "The :mod:`!sqlite3` module API does not support strings containing " "surrogates." msgstr "" -#: ../../library/sqlite3.rst:2634 +#: ../../library/sqlite3.rst:2635 msgid ":ref:`unicode-howto`" msgstr ":ref:`unicode-howto`" -#: ../../library/sqlite3.rst:2640 +#: ../../library/sqlite3.rst:2641 msgid "Explanation" msgstr "解釋" -#: ../../library/sqlite3.rst:2646 +#: ../../library/sqlite3.rst:2647 msgid "Transaction control" msgstr "" -#: ../../library/sqlite3.rst:2648 +#: ../../library/sqlite3.rst:2649 msgid "" ":mod:`!sqlite3` offers multiple methods of controlling whether, when and how " "database transactions are opened and closed. :ref:`sqlite3-transaction-" @@ -3237,24 +3239,24 @@ msgid "" "isolation-level` retains the pre-Python 3.12 behaviour." msgstr "" -#: ../../library/sqlite3.rst:2657 +#: ../../library/sqlite3.rst:2658 msgid "Transaction control via the ``autocommit`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2659 +#: ../../library/sqlite3.rst:2660 msgid "" "The recommended way of controlling transaction behaviour is through the :" "attr:`Connection.autocommit` attribute, which should preferably be set using " "the *autocommit* parameter of :func:`connect`." msgstr "" -#: ../../library/sqlite3.rst:2664 +#: ../../library/sqlite3.rst:2665 msgid "" "It is suggested to set *autocommit* to ``False``, which implies :pep:`249`-" "compliant transaction control. This means:" msgstr "" -#: ../../library/sqlite3.rst:2668 +#: ../../library/sqlite3.rst:2669 msgid "" ":mod:`!sqlite3` ensures that a transaction is always open, so :func:" "`connect`, :meth:`Connection.commit`, and :meth:`Connection.rollback` will " @@ -3263,21 +3265,21 @@ msgid "" "when opening transactions." msgstr "" -#: ../../library/sqlite3.rst:2673 +#: ../../library/sqlite3.rst:2674 msgid "Transactions should be committed explicitly using :meth:`!commit`." msgstr "" -#: ../../library/sqlite3.rst:2674 +#: ../../library/sqlite3.rst:2675 msgid "Transactions should be rolled back explicitly using :meth:`!rollback`." msgstr "" -#: ../../library/sqlite3.rst:2675 +#: ../../library/sqlite3.rst:2676 msgid "" "An implicit rollback is performed if the database is :meth:`~Connection." "close`-ed with pending changes." msgstr "" -#: ../../library/sqlite3.rst:2678 +#: ../../library/sqlite3.rst:2679 msgid "" "Set *autocommit* to ``True`` to enable SQLite's `autocommit mode`_. In this " "mode, :meth:`Connection.commit` and :meth:`Connection.rollback` have no " @@ -3286,25 +3288,25 @@ msgid "" "in_transaction` to query the low-level SQLite autocommit mode." msgstr "" -#: ../../library/sqlite3.rst:2686 +#: ../../library/sqlite3.rst:2687 msgid "" "Set *autocommit* to :data:`LEGACY_TRANSACTION_CONTROL` to leave transaction " "control behaviour to the :attr:`Connection.isolation_level` attribute. See :" "ref:`sqlite3-transaction-control-isolation-level` for more information." msgstr "" -#: ../../library/sqlite3.rst:2695 +#: ../../library/sqlite3.rst:2696 msgid "Transaction control via the ``isolation_level`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2699 +#: ../../library/sqlite3.rst:2700 msgid "" "The recommended way of controlling transactions is via the :attr:" "`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-control-" "autocommit`." msgstr "" -#: ../../library/sqlite3.rst:2703 +#: ../../library/sqlite3.rst:2704 msgid "" "If :attr:`Connection.autocommit` is set to :data:" "`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour is " @@ -3312,7 +3314,7 @@ msgid "" "Otherwise, :attr:`!isolation_level` has no effect." msgstr "" -#: ../../library/sqlite3.rst:2709 +#: ../../library/sqlite3.rst:2710 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " "``None``, new transactions are implicitly opened before :meth:`~Cursor." @@ -3326,7 +3328,7 @@ msgid "" "attribute." msgstr "" -#: ../../library/sqlite3.rst:2722 +#: ../../library/sqlite3.rst:2723 msgid "" "If :attr:`~Connection.isolation_level` is set to ``None``, no transactions " "are implicitly opened at all. This leaves the underlying SQLite library in " @@ -3336,20 +3338,20 @@ msgid "" "in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:2730 +#: ../../library/sqlite3.rst:2731 msgid "" "The :meth:`~Cursor.executescript` method implicitly commits any pending " "transaction before execution of the given SQL script, regardless of the " "value of :attr:`~Connection.isolation_level`." msgstr "" -#: ../../library/sqlite3.rst:2734 +#: ../../library/sqlite3.rst:2735 msgid "" ":mod:`!sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:2738 +#: ../../library/sqlite3.rst:2739 msgid "" "The recommended way of controlling transactions is now via the :attr:" "`~Connection.autocommit` attribute." diff --git a/library/stdtypes.po b/library/stdtypes.po index e25ed787d8..7421a5e216 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-12 00:13+0000\n" +"POT-Creation-Date: 2024-10-30 00:13+0000\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -6447,7 +6447,7 @@ msgstr "" msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " -"from the method). or an iterable of key/value pairs (as tuples or other " +"from the method) or an iterable of key/value pairs (as tuples or other " "iterables of length two). If keyword arguments are specified, the dictionary " "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" @@ -7777,7 +7777,7 @@ msgstr "更多資訊請見 :ref:`instance-methods`。" #: ../../library/stdtypes.rst:5388 msgid "Code Objects" -msgstr "" +msgstr "程式碼物件" #: ../../library/stdtypes.rst:5394 msgid "" @@ -7826,7 +7826,7 @@ msgstr "" #: ../../library/stdtypes.rst:5434 msgid "The Null Object" -msgstr "" +msgstr "Null 物件" #: ../../library/stdtypes.rst:5436 msgid "" @@ -8005,6 +8005,13 @@ msgid "" "... '571186405732').to_bytes(53, 'big')\n" "..." msgstr "" +">>> import sys\n" +">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" +">>> assert sys.int_info.str_digits_check_threshold == 640, sys.int_info\n" +">>> msg = int('578966293710682886880994035146873798396722250538762761564'\n" +"... '9252925514383915483333812743580549779436104706260696366600'\n" +"... '571186405732').to_bytes(53, 'big')\n" +"..." #: ../../library/stdtypes.rst:5588 msgid "Affected APIs" @@ -8179,6 +8186,15 @@ msgid "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" msgstr "" +">>> import sys\n" +">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" +"... upper_bound = 68000\n" +"... lower_bound = 4004\n" +"... current_limit = sys.get_int_max_str_digits()\n" +"... if current_limit == 0 or current_limit > upper_bound:\n" +"... sys.set_int_max_str_digits(upper_bound)\n" +"... elif current_limit < lower_bound:\n" +"... sys.set_int_max_str_digits(lower_bound)" #: ../../library/stdtypes.rst:5678 msgid "If you need to disable it entirely, set it to ``0``." @@ -8963,12 +8979,3 @@ msgstr "..." #: ../../library/stdtypes.rst:5443 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" - -#~ msgid "" -#~ ">>> int.__subclasses__()\n" -#~ "[, , , ]" -#~ msgstr "" -#~ ">>> int.__subclasses__()\n" -#~ "[, , , ]" diff --git a/library/string.po b/library/string.po index e780be5352..8e279ed304 100644 --- a/library/string.po +++ b/library/string.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-15 00:14+0000\n" +"POT-Creation-Date: 2024-11-02 00:13+0000\n" "PO-Revision-Date: 2024-03-10 15:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -457,13 +457,13 @@ msgstr "" msgid "The meaning of the various alignment options is as follows:" msgstr "" -#: ../../library/string.rst:342 ../../library/string.rst:373 +#: ../../library/string.rst:342 ../../library/string.rst:374 msgid "Option" msgstr "選項" -#: ../../library/string.rst:342 ../../library/string.rst:373 -#: ../../library/string.rst:456 ../../library/string.rst:467 -#: ../../library/string.rst:502 +#: ../../library/string.rst:342 ../../library/string.rst:374 +#: ../../library/string.rst:457 ../../library/string.rst:468 +#: ../../library/string.rst:503 msgid "Meaning" msgstr "含義" @@ -495,19 +495,20 @@ msgstr "``'='``" msgid "" "Forces the padding to be placed after the sign (if any) but before the " "digits. This is used for printing fields in the form '+000000120'. This " -"alignment option is only valid for numeric types. It becomes the default " -"for numbers when '0' immediately precedes the field width." +"alignment option is only valid for numeric types, excluding :class:" +"`complex`. It becomes the default for numbers when '0' immediately precedes " +"the field width." msgstr "" -#: ../../library/string.rst:356 +#: ../../library/string.rst:357 msgid "``'^'``" msgstr "``'^'``" -#: ../../library/string.rst:356 +#: ../../library/string.rst:357 msgid "Forces the field to be centered within the available space." msgstr "強制欄位在可用空間內置中。" -#: ../../library/string.rst:360 +#: ../../library/string.rst:361 msgid "" "Note that unless a minimum field width is defined, the field width will " "always be the same size as the data to fill it, so that the alignment option " @@ -516,54 +517,54 @@ msgstr "" "請注意,除非有定義了最小欄位寬度,否則欄位寬度將始終與填充它的資料大小相同," "故在該情況下的對齊選項是沒有意義的。" -#: ../../library/string.rst:364 +#: ../../library/string.rst:365 msgid "" "The *sign* option is only valid for number types, and can be one of the " "following:" msgstr "*sign* 選項只適用於數字型別,並可為以下之一:" -#: ../../library/string.rst:375 +#: ../../library/string.rst:376 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/string.rst:375 +#: ../../library/string.rst:376 msgid "" "indicates that a sign should be used for both positive as well as negative " "numbers." msgstr "表示正數與負數均需使用符號。" -#: ../../library/string.rst:378 +#: ../../library/string.rst:379 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/string.rst:378 +#: ../../library/string.rst:379 msgid "" "indicates that a sign should be used only for negative numbers (this is the " "default behavior)." msgstr "" -#: ../../library/string.rst:367 ../../library/string.rst:381 +#: ../../library/string.rst:368 ../../library/string.rst:382 msgid "space" msgstr "" -#: ../../library/string.rst:381 +#: ../../library/string.rst:382 msgid "" "indicates that a leading space should be used on positive numbers, and a " "minus sign on negative numbers." msgstr "表示正數應使用前導空格,負數應使用減號。" -#: ../../library/string.rst:388 +#: ../../library/string.rst:389 msgid "" "The ``'z'`` option coerces negative zero floating-point values to positive " "zero after rounding to the format precision. This option is only valid for " "floating-point presentation types." msgstr "" -#: ../../library/string.rst:392 +#: ../../library/string.rst:393 msgid "Added the ``'z'`` option (see also :pep:`682`)." msgstr "新增 ``'z'`` 選項(請見 :pep:`682`\\ )。" -#: ../../library/string.rst:397 +#: ../../library/string.rst:398 msgid "" "The ``'#'`` option causes the \"alternate form\" to be used for the " "conversion. The alternate form is defined differently for different types. " @@ -577,17 +578,17 @@ msgid "" "and ``'G'`` conversions, trailing zeros are not removed from the result." msgstr "" -#: ../../library/string.rst:411 +#: ../../library/string.rst:412 msgid "" "The ``','`` option signals the use of a comma for a thousands separator. For " "a locale aware separator, use the ``'n'`` integer presentation type instead." msgstr "" -#: ../../library/string.rst:415 +#: ../../library/string.rst:416 msgid "Added the ``','`` option (see also :pep:`378`)." msgstr "新增 ``','`` 選項(請見 :pep:`378`\\ )。" -#: ../../library/string.rst:420 +#: ../../library/string.rst:421 msgid "" "The ``'_'`` option signals the use of an underscore for a thousands " "separator for floating-point presentation types and for integer presentation " @@ -599,11 +600,11 @@ msgstr "" "號。對於整數表示型別 ``'b'``,``'o'``,``'x'`` 和 ``'X'``,每 4 位數字會插入" "底線。對於其他表示型別,指定此選項會出錯。" -#: ../../library/string.rst:427 +#: ../../library/string.rst:428 msgid "Added the ``'_'`` option (see also :pep:`515`)." msgstr "新增 ``'_'`` 選項(請見 :pep:`515`\\ )。" -#: ../../library/string.rst:430 +#: ../../library/string.rst:431 msgid "" "*width* is a decimal integer defining the minimum total field width, " "including any prefixes, separators, and other formatting characters. If not " @@ -612,24 +613,24 @@ msgstr "" "*width* 是一個十進位整數,定義了最小總欄位寬度,包括任何前綴、分隔符號和其他" "格式字元。如果未指定,則欄位寬度將由內容決定。" -#: ../../library/string.rst:434 +#: ../../library/string.rst:435 msgid "" "When no explicit alignment is given, preceding the *width* field by a zero " -"(``'0'``) character enables sign-aware zero-padding for numeric types. This " -"is equivalent to a *fill* character of ``'0'`` with an *alignment* type of " -"``'='``." +"(``'0'``) character enables sign-aware zero-padding for numeric types, " +"excluding :class:`complex`. This is equivalent to a *fill* character of " +"``'0'`` with an *alignment* type of ``'='``." msgstr "" -"當未給予明確的對齊指示,在 *width* 欄位前面填入零 (``'0'``) 字元將會為數值型" -"別啟用有符號察覺的零填充 (sign-aware zero-padding)。這相當於使用 ``'0'`` 為 " -"*fill* 字元且對齊類型為 ``'='``。" +"當未給予明確的對齊指示,在 *width* 欄位前面填入零 (``'0'``) 字元將會為 :" +"class:`complex` 以外的數值型別啟用有符號察覺的零填充 (sign-aware zero-" +"padding)。這相當於使用 ``'0'`` 為 *fill* 字元且對齊類型為 ``'='``。" -#: ../../library/string.rst:439 +#: ../../library/string.rst:440 msgid "" "Preceding the *width* field by ``'0'`` no longer affects the default " "alignment for strings." msgstr "在 *width* 欄位前面加上 ``'0'`` 不再影響字串的預設對齊方式。" -#: ../../library/string.rst:443 +#: ../../library/string.rst:444 msgid "" "The *precision* is a decimal integer indicating how many digits should be " "displayed after the decimal point for presentation types ``'f'`` and " @@ -644,89 +645,89 @@ msgstr "" "示類型,該欄位指定最大欄位大小 - 換言之,將使用欄位中的多少字元。整數表示類型" "不允許使用 *precision*。" -#: ../../library/string.rst:451 +#: ../../library/string.rst:452 msgid "Finally, the *type* determines how the data should be presented." msgstr "最終,型別決定了資料將會如何呈現" -#: ../../library/string.rst:453 +#: ../../library/string.rst:454 msgid "The available string presentation types are:" msgstr "可用的字串表示型別有:" -#: ../../library/string.rst:456 ../../library/string.rst:467 -#: ../../library/string.rst:502 +#: ../../library/string.rst:457 ../../library/string.rst:468 +#: ../../library/string.rst:503 msgid "Type" msgstr "型別" -#: ../../library/string.rst:458 +#: ../../library/string.rst:459 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/string.rst:458 +#: ../../library/string.rst:459 msgid "String format. This is the default type for strings and may be omitted." msgstr "" -#: ../../library/string.rst:461 ../../library/string.rst:490 -#: ../../library/string.rst:575 +#: ../../library/string.rst:462 ../../library/string.rst:491 +#: ../../library/string.rst:576 msgid "None" msgstr "None" -#: ../../library/string.rst:461 +#: ../../library/string.rst:462 msgid "The same as ``'s'``." msgstr "" -#: ../../library/string.rst:464 +#: ../../library/string.rst:465 msgid "The available integer presentation types are:" msgstr "" -#: ../../library/string.rst:469 +#: ../../library/string.rst:470 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/string.rst:469 +#: ../../library/string.rst:470 msgid "Binary format. Outputs the number in base 2." msgstr "" -#: ../../library/string.rst:471 +#: ../../library/string.rst:472 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/string.rst:471 +#: ../../library/string.rst:472 msgid "" "Character. Converts the integer to the corresponding unicode character " "before printing." msgstr "" -#: ../../library/string.rst:474 +#: ../../library/string.rst:475 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/string.rst:474 +#: ../../library/string.rst:475 msgid "Decimal Integer. Outputs the number in base 10." msgstr "" -#: ../../library/string.rst:476 +#: ../../library/string.rst:477 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/string.rst:476 +#: ../../library/string.rst:477 msgid "Octal format. Outputs the number in base 8." msgstr "" -#: ../../library/string.rst:478 +#: ../../library/string.rst:479 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/string.rst:478 +#: ../../library/string.rst:479 msgid "" "Hex format. Outputs the number in base 16, using lower-case letters for the " "digits above 9." msgstr "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用小寫字母。" -#: ../../library/string.rst:481 +#: ../../library/string.rst:482 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/string.rst:481 +#: ../../library/string.rst:482 msgid "" "Hex format. Outputs the number in base 16, using upper-case letters for the " "digits above 9. In case ``'#'`` is specified, the prefix ``'0x'`` will be " @@ -735,21 +736,21 @@ msgstr "" "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用大寫字母。如果指定了 " "``'#'``,則前綴 ``'0x'`` 也會被轉成大寫的 ``'0X'``。" -#: ../../library/string.rst:486 ../../library/string.rst:568 +#: ../../library/string.rst:487 ../../library/string.rst:569 msgid "``'n'``" msgstr "``'n'``" -#: ../../library/string.rst:486 +#: ../../library/string.rst:487 msgid "" "Number. This is the same as ``'d'``, except that it uses the current locale " "setting to insert the appropriate number separator characters." msgstr "" -#: ../../library/string.rst:490 +#: ../../library/string.rst:491 msgid "The same as ``'d'``." msgstr "" -#: ../../library/string.rst:493 +#: ../../library/string.rst:494 msgid "" "In addition to the above presentation types, integers can be formatted with " "the floating-point presentation types listed below (except ``'n'`` and " @@ -757,17 +758,17 @@ msgid "" "floating-point number before formatting." msgstr "" -#: ../../library/string.rst:498 +#: ../../library/string.rst:499 msgid "" "The available presentation types for :class:`float` and :class:`~decimal." "Decimal` values are:" msgstr "" -#: ../../library/string.rst:504 +#: ../../library/string.rst:505 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/string.rst:504 +#: ../../library/string.rst:505 msgid "" "Scientific notation. For a given precision ``p``, formats the number in " "scientific notation with the letter 'e' separating the coefficient from the " @@ -779,21 +780,21 @@ msgid "" "is used." msgstr "" -#: ../../library/string.rst:515 +#: ../../library/string.rst:516 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/string.rst:515 +#: ../../library/string.rst:516 msgid "" "Scientific notation. Same as ``'e'`` except it uses an upper case 'E' as the " "separator character." msgstr "" -#: ../../library/string.rst:518 +#: ../../library/string.rst:519 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/string.rst:518 +#: ../../library/string.rst:519 msgid "" "Fixed-point notation. For a given precision ``p``, formats the number as a " "decimal number with exactly ``p`` digits following the decimal point. With " @@ -803,21 +804,21 @@ msgid "" "point is omitted unless the ``#`` option is used." msgstr "" -#: ../../library/string.rst:527 +#: ../../library/string.rst:528 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/string.rst:527 +#: ../../library/string.rst:528 msgid "" "Fixed-point notation. Same as ``'f'``, but converts ``nan`` to ``NAN`` and " "``inf`` to ``INF``." msgstr "" -#: ../../library/string.rst:530 +#: ../../library/string.rst:531 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/string.rst:530 +#: ../../library/string.rst:531 msgid "" "General format. For a given precision ``p >= 1``, this rounds the number to " "``p`` significant digits and then formats the result in either fixed-point " @@ -825,7 +826,7 @@ msgid "" "``0`` is treated as equivalent to a precision of ``1``." msgstr "" -#: ../../library/string.rst:537 +#: ../../library/string.rst:538 msgid "" "The precise rules are as follows: suppose that the result formatted with " "presentation type ``'e'`` and precision ``p-1`` would have exponent " @@ -838,7 +839,7 @@ msgid "" "unless the ``'#'`` option is used." msgstr "" -#: ../../library/string.rst:550 +#: ../../library/string.rst:551 msgid "" "With no precision given, uses a precision of ``6`` significant digits for :" "class:`float`. For :class:`~decimal.Decimal`, the coefficient of the result " @@ -848,40 +849,40 @@ msgid "" "notation is used otherwise." msgstr "" -#: ../../library/string.rst:559 +#: ../../library/string.rst:560 msgid "" "Positive and negative infinity, positive and negative zero, and nans, are " "formatted as ``inf``, ``-inf``, ``0``, ``-0`` and ``nan`` respectively, " "regardless of the precision." msgstr "" -#: ../../library/string.rst:564 +#: ../../library/string.rst:565 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/string.rst:564 +#: ../../library/string.rst:565 msgid "" "General format. Same as ``'g'`` except switches to ``'E'`` if the number " "gets too large. The representations of infinity and NaN are uppercased, too." msgstr "" -#: ../../library/string.rst:568 +#: ../../library/string.rst:569 msgid "" "Number. This is the same as ``'g'``, except that it uses the current locale " "setting to insert the appropriate number separator characters." msgstr "" -#: ../../library/string.rst:572 +#: ../../library/string.rst:573 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/string.rst:572 +#: ../../library/string.rst:573 msgid "" "Percentage. Multiplies the number by 100 and displays in fixed (``'f'``) " "format, followed by a percent sign." msgstr "" -#: ../../library/string.rst:575 +#: ../../library/string.rst:576 msgid "" "For :class:`float` this is like the ``'g'`` type, except that when fixed-" "point notation is used to format the result, it always includes at least one " @@ -890,30 +891,42 @@ msgid "" "as large as needed to represent the given value faithfully." msgstr "" -#: ../../library/string.rst:583 +#: ../../library/string.rst:584 msgid "" "For :class:`~decimal.Decimal`, this is the same as either ``'g'`` or ``'G'`` " "depending on the value of ``context.capitals`` for the current decimal " "context." msgstr "" -#: ../../library/string.rst:587 +#: ../../library/string.rst:588 msgid "" "The overall effect is to match the output of :func:`str` as altered by the " "other format modifiers." msgstr "" -#: ../../library/string.rst:595 +#: ../../library/string.rst:592 +msgid "" +"The available presentation types for :class:`complex` are the same as those " +"for :class:`float` (``'%'`` is not allowed). Both the real and imaginary " +"components of a complex number are formatted as floating-point numbers, " +"according to the specified presentation type. They are separated by the " +"mandatory sign of the imaginary part, the latter being terminated by a ``j`` " +"suffix. If the presentation type is missing, the result will match the " +"output of :func:`str` (complex numbers with a non-zero real part are also " +"surrounded by parentheses), possibly altered by other format modifiers." +msgstr "" + +#: ../../library/string.rst:605 msgid "Format examples" msgstr "格式範例" -#: ../../library/string.rst:597 +#: ../../library/string.rst:607 msgid "" "This section contains examples of the :meth:`str.format` syntax and " "comparison with the old ``%``-formatting." msgstr "本節包含 :meth:`str.format` 語法以及與舊式 ``%`` 格式的比較。" -#: ../../library/string.rst:600 +#: ../../library/string.rst:610 msgid "" "In most of the cases the syntax is similar to the old ``%``-formatting, with " "the addition of the ``{}`` and with ``:`` used instead of ``%``. For " @@ -922,17 +935,17 @@ msgstr "" "此語法在大多情況下與舊式的 ``%`` 格式類似,只是增加了 ``{}`` 和 ``:`` 來取代 " "``%``。例如,``'%03.2f'`` 可以改寫為 ``'{:03.2f}'``。" -#: ../../library/string.rst:604 +#: ../../library/string.rst:614 msgid "" "The new format syntax also supports new and different options, shown in the " "following examples." msgstr "新的語法還支援新的選項,將在以下的範例中說明。" -#: ../../library/string.rst:607 +#: ../../library/string.rst:617 msgid "Accessing arguments by position::" msgstr "按位置存取引數: ::" -#: ../../library/string.rst:609 +#: ../../library/string.rst:619 msgid "" ">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" "'a, b, c'\n" @@ -947,11 +960,11 @@ msgid "" "'abracadabra'" msgstr "" -#: ../../library/string.rst:620 +#: ../../library/string.rst:630 msgid "Accessing arguments by name::" msgstr "按名稱存取引數: ::" -#: ../../library/string.rst:622 +#: ../../library/string.rst:632 msgid "" ">>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', " "longitude='-115.81W')\n" @@ -961,11 +974,11 @@ msgid "" "'Coordinates: 37.24N, -115.81W'" msgstr "" -#: ../../library/string.rst:628 +#: ../../library/string.rst:638 msgid "Accessing arguments' attributes::" msgstr "存取引數的屬性: ::" -#: ../../library/string.rst:630 +#: ../../library/string.rst:640 msgid "" ">>> c = 3-5j\n" ">>> ('The complex number {0} is formed from the real part {0.real} '\n" @@ -982,22 +995,22 @@ msgid "" "'Point(4, 2)'" msgstr "" -#: ../../library/string.rst:643 +#: ../../library/string.rst:653 msgid "Accessing arguments' items::" msgstr "存取引數的內容: ::" -#: ../../library/string.rst:645 +#: ../../library/string.rst:655 msgid "" ">>> coord = (3, 5)\n" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" "'X: 3; Y: 5'" msgstr "" -#: ../../library/string.rst:649 +#: ../../library/string.rst:659 msgid "Replacing ``%s`` and ``%r``::" msgstr "替換 ``%s`` 和 ``%r``: ::" -#: ../../library/string.rst:651 +#: ../../library/string.rst:661 msgid "" ">>> \"repr() shows quotes: {!r}; str() doesn't: {!s}\".format('test1', " "'test2')\n" @@ -1007,11 +1020,11 @@ msgstr "" "'test2')\n" "\"repr() shows quotes: 'test1'; str() doesn't: test2\"" -#: ../../library/string.rst:654 +#: ../../library/string.rst:664 msgid "Aligning the text and specifying a width::" msgstr "對齊文字以及指定寬度: ::" -#: ../../library/string.rst:656 +#: ../../library/string.rst:666 msgid "" ">>> '{:<30}'.format('left aligned')\n" "'left aligned '\n" @@ -1023,11 +1036,11 @@ msgid "" "'***********centered***********'" msgstr "" -#: ../../library/string.rst:665 +#: ../../library/string.rst:675 msgid "Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::" msgstr "替換 ``%+f``、``%-f`` 和 ``% f`` 以及指定正負號: ::" -#: ../../library/string.rst:667 +#: ../../library/string.rst:677 msgid "" ">>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always\n" "'+3.140000; -3.140000'\n" @@ -1038,12 +1051,12 @@ msgid "" "'3.140000; -3.140000'" msgstr "" -#: ../../library/string.rst:674 +#: ../../library/string.rst:684 msgid "" "Replacing ``%x`` and ``%o`` and converting the value to different bases::" msgstr "替換 ``%x`` 和 ``%o`` 並將其值轉換為不同的進位制: ::" -#: ../../library/string.rst:676 +#: ../../library/string.rst:686 msgid "" ">>> # format also supports binary numbers\n" ">>> \"int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}\".format(42)\n" @@ -1053,11 +1066,11 @@ msgid "" "'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'" msgstr "" -#: ../../library/string.rst:683 +#: ../../library/string.rst:693 msgid "Using the comma as a thousands separator::" msgstr "使用逗號作為千位分隔符: ::" -#: ../../library/string.rst:685 +#: ../../library/string.rst:695 msgid "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" @@ -1065,11 +1078,11 @@ msgstr "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" -#: ../../library/string.rst:688 +#: ../../library/string.rst:698 msgid "Expressing a percentage::" msgstr "表示為百分比: ::" -#: ../../library/string.rst:690 +#: ../../library/string.rst:700 msgid "" ">>> points = 19\n" ">>> total = 22\n" @@ -1081,11 +1094,11 @@ msgstr "" ">>> 'Correct answers: {:.2%}'.format(points/total)\n" "'Correct answers: 86.36%'" -#: ../../library/string.rst:695 +#: ../../library/string.rst:705 msgid "Using type-specific formatting::" msgstr "作為特定型別格式: ::" -#: ../../library/string.rst:697 +#: ../../library/string.rst:707 msgid "" ">>> import datetime\n" ">>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n" @@ -1097,11 +1110,11 @@ msgstr "" ">>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" "'2010-07-04 12:15:58'" -#: ../../library/string.rst:702 +#: ../../library/string.rst:712 msgid "Nesting arguments and more complex examples::" msgstr "巢狀引數及更多複雜範例: ::" -#: ../../library/string.rst:704 +#: ../../library/string.rst:714 msgid "" ">>> for align, text in zip('<^>', ['left', 'center', 'right']):\n" "... '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n" @@ -1159,11 +1172,11 @@ msgstr "" " 10 A 12 1010\n" " 11 B 13 1011" -#: ../../library/string.rst:736 +#: ../../library/string.rst:746 msgid "Template strings" msgstr "模板字串" -#: ../../library/string.rst:738 +#: ../../library/string.rst:748 msgid "" "Template strings provide simpler string substitutions as described in :pep:" "`292`. A primary use case for template strings is for internationalization " @@ -1177,17 +1190,17 @@ msgstr "" "化工具更容易翻譯。基於模板字串建構的 i18n 函式庫範例,請參閱 `flufl.i18n " "`_ 套件。" -#: ../../library/string.rst:748 +#: ../../library/string.rst:758 msgid "" "Template strings support ``$``-based substitutions, using the following " "rules:" msgstr "" -#: ../../library/string.rst:750 +#: ../../library/string.rst:760 msgid "``$$`` is an escape; it is replaced with a single ``$``." msgstr "" -#: ../../library/string.rst:752 +#: ../../library/string.rst:762 msgid "" "``$identifier`` names a substitution placeholder matching a mapping key of " "``\"identifier\"``. By default, ``\"identifier\"`` is restricted to any " @@ -1197,30 +1210,30 @@ msgid "" "specification." msgstr "" -#: ../../library/string.rst:759 +#: ../../library/string.rst:769 msgid "" "``${identifier}`` is equivalent to ``$identifier``. It is required when " "valid identifier characters follow the placeholder but are not part of the " "placeholder, such as ``\"${noun}ification\"``." msgstr "" -#: ../../library/string.rst:763 +#: ../../library/string.rst:773 msgid "" "Any other appearance of ``$`` in the string will result in a :exc:" "`ValueError` being raised." msgstr "" -#: ../../library/string.rst:766 +#: ../../library/string.rst:776 msgid "" "The :mod:`string` module provides a :class:`Template` class that implements " "these rules. The methods of :class:`Template` are:" msgstr "" -#: ../../library/string.rst:772 +#: ../../library/string.rst:782 msgid "The constructor takes a single argument which is the template string." msgstr "" -#: ../../library/string.rst:777 +#: ../../library/string.rst:787 msgid "" "Performs the template substitution, returning a new string. *mapping* is " "any dictionary-like object with keys that match the placeholders in the " @@ -1232,7 +1245,7 @@ msgstr "" "的字典型物件。或者如果關鍵字就是佔位符號時,你也可以改提供關鍵字引數。當 " "*mapping* 跟 *kwds* 同時給定並存在重複時,*kwds* 的佔位符號會被優先使用。" -#: ../../library/string.rst:786 +#: ../../library/string.rst:796 msgid "" "Like :meth:`substitute`, except that if placeholders are missing from " "*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the " @@ -1245,7 +1258,7 @@ msgstr "" "與 :meth:`substitute` 不同的是,任何包含 ``$`` 的字句會直接回傳 ``$`` 而非引" "發 :exc:`ValueError`。" -#: ../../library/string.rst:792 +#: ../../library/string.rst:802 msgid "" "While other exceptions may still occur, this method is called \"safe\" " "because it always tries to return a usable string instead of raising an " @@ -1259,7 +1272,7 @@ msgstr "" "完全安全,因為它會默默忽略格式錯誤的模板,這些模板包含了多餘的左右定界符、不" "匹配的括號,或者不是有效的 Python 識別字的佔位符號。" -#: ../../library/string.rst:802 +#: ../../library/string.rst:812 msgid "" "Returns false if the template has invalid placeholders that will cause :meth:" "`substitute` to raise :exc:`ValueError`." @@ -1267,18 +1280,18 @@ msgstr "" "如果模板有將導致 :meth:`substitute` 引發 :exc:`ValueError` 的無效佔位符號,就" "會回傳 false。" -#: ../../library/string.rst:810 +#: ../../library/string.rst:820 msgid "" "Returns a list of the valid identifiers in the template, in the order they " "first appear, ignoring any invalid identifiers." msgstr "" "回傳模板中有效識別字的串列,按照它們首次出現的順序,並忽略任何無效的識別字。" -#: ../../library/string.rst:815 +#: ../../library/string.rst:825 msgid ":class:`Template` instances also provide one public data attribute:" msgstr ":class:`Template` 實例也提供一個公開的資料屬性:" -#: ../../library/string.rst:819 +#: ../../library/string.rst:829 msgid "" "This is the object passed to the constructor's *template* argument. In " "general, you shouldn't change it, but read-only access is not enforced." @@ -1286,11 +1299,11 @@ msgstr "" "這是傳遞給建構函式 *template* 引數的物件。一般來說,你不應該改變它,但並沒有" "強制設定成唯讀。" -#: ../../library/string.rst:822 +#: ../../library/string.rst:832 msgid "Here is an example of how to use a Template::" msgstr "以下是如何使用 Template 的一個範例: ::" -#: ../../library/string.rst:824 +#: ../../library/string.rst:834 msgid "" ">>> from string import Template\n" ">>> s = Template('$who likes $what')\n" @@ -1324,7 +1337,7 @@ msgstr "" ">>> Template('$who likes $what').safe_substitute(d)\n" "'tim likes $what'" -#: ../../library/string.rst:840 +#: ../../library/string.rst:850 msgid "" "Advanced usage: you can derive subclasses of :class:`Template` to customize " "the placeholder syntax, delimiter character, or the entire regular " @@ -1334,7 +1347,7 @@ msgstr "" "進階用法:你可以衍生 :class:`Template` 類別來自定義佔位符號語法、左右定界符字" "元,或者用於剖析模板字串的正規表示式。你可以透過覆寫這些類別屬性來達成:" -#: ../../library/string.rst:845 +#: ../../library/string.rst:855 msgid "" "*delimiter* -- This is the literal string describing a placeholder " "introducing delimiter. The default value is ``$``. Note that this should " @@ -1348,7 +1361,7 @@ msgstr "" "注意你不能在建立類別後修改左右定界符。(意即在子類別的命名空間中必須設置不同" "的左右定界符)" -#: ../../library/string.rst:852 +#: ../../library/string.rst:862 msgid "" "*idpattern* -- This is the regular expression describing the pattern for non-" "braced placeholders. The default value is the regular expression ``(?a:[_a-" @@ -1356,19 +1369,19 @@ msgid "" "pattern will also apply to braced placeholders." msgstr "" -#: ../../library/string.rst:859 +#: ../../library/string.rst:869 msgid "" "Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with " "some non-ASCII characters. That's why we use the local ``a`` flag here." msgstr "" -#: ../../library/string.rst:863 +#: ../../library/string.rst:873 msgid "" "*braceidpattern* can be used to define separate patterns used inside and " "outside the braces." msgstr "" -#: ../../library/string.rst:867 +#: ../../library/string.rst:877 msgid "" "*braceidpattern* -- This is like *idpattern* but describes the pattern for " "braced placeholders. Defaults to ``None`` which means to fall back to " @@ -1377,7 +1390,7 @@ msgid "" "unbraced placeholders." msgstr "" -#: ../../library/string.rst:875 +#: ../../library/string.rst:885 msgid "" "*flags* -- The regular expression flags that will be applied when compiling " "the regular expression used for recognizing substitutions. The default " @@ -1386,7 +1399,7 @@ msgid "" "regular expressions." msgstr "" -#: ../../library/string.rst:883 +#: ../../library/string.rst:893 msgid "" "Alternatively, you can provide the entire regular expression pattern by " "overriding the class attribute *pattern*. If you do this, the value must be " @@ -1395,13 +1408,13 @@ msgid "" "placeholder rule:" msgstr "" -#: ../../library/string.rst:889 +#: ../../library/string.rst:899 msgid "" "*escaped* -- This group matches the escape sequence, e.g. ``$$``, in the " "default pattern." msgstr "*escaped* -- 此群組與跳脫序列匹配,例如在預設模式下為 ``$$``。" -#: ../../library/string.rst:892 +#: ../../library/string.rst:902 msgid "" "*named* -- This group matches the unbraced placeholder name; it should not " "include the delimiter in capturing group." @@ -1409,7 +1422,7 @@ msgstr "" "*named* -- 此群組與不帶大括號的佔位符號名稱匹配;它不應包含擷取群組中的左右定" "界符號。" -#: ../../library/string.rst:895 +#: ../../library/string.rst:905 msgid "" "*braced* -- This group matches the brace enclosed placeholder name; it " "should not include either the delimiter or braces in the capturing group." @@ -1417,7 +1430,7 @@ msgstr "" "*braced* -- 此群組與大括號括起來的佔位符號名稱匹配;它不應在擷取群組中包含左" "右定界符或大括號。" -#: ../../library/string.rst:898 +#: ../../library/string.rst:908 msgid "" "*invalid* -- This group matches any other delimiter pattern (usually a " "single delimiter), and it should appear last in the regular expression." @@ -1425,7 +1438,7 @@ msgstr "" "*invalid* -- 此群組與任何其他左右定界符模式(通常是單一左右定界符)匹配,且它" "應該出現在正規表示式的最後。" -#: ../../library/string.rst:901 +#: ../../library/string.rst:911 msgid "" "The methods on this class will raise :exc:`ValueError` if the pattern " "matches the template without one of these named groups matching." @@ -1433,11 +1446,11 @@ msgstr "" "當此模式有匹配於模板但這些命名組中卻有任一個不匹配,此類別的方法將引發 :exc:" "`ValueError`。" -#: ../../library/string.rst:906 +#: ../../library/string.rst:916 msgid "Helper functions" msgstr "輔助函式" -#: ../../library/string.rst:910 +#: ../../library/string.rst:920 msgid "" "Split the argument into words using :meth:`str.split`, capitalize each word " "using :meth:`str.capitalize`, and join the capitalized words using :meth:" @@ -1456,9 +1469,9 @@ msgid "{} (curly brackets)" msgstr "{} (花括號)" #: ../../library/string.rst:195 ../../library/string.rst:335 -#: ../../library/string.rst:367 ../../library/string.rst:386 -#: ../../library/string.rst:395 ../../library/string.rst:409 -#: ../../library/string.rst:418 +#: ../../library/string.rst:368 ../../library/string.rst:387 +#: ../../library/string.rst:396 ../../library/string.rst:410 +#: ../../library/string.rst:419 msgid "in string formatting" msgstr "於字串格式化" @@ -1494,34 +1507,34 @@ msgstr "= (等於)" msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../library/string.rst:367 +#: ../../library/string.rst:368 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../library/string.rst:367 +#: ../../library/string.rst:368 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/string.rst:386 +#: ../../library/string.rst:387 msgid "z" msgstr "z" -#: ../../library/string.rst:395 +#: ../../library/string.rst:396 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/string.rst:409 +#: ../../library/string.rst:410 msgid ", (comma)" msgstr ", (逗號)" -#: ../../library/string.rst:418 +#: ../../library/string.rst:419 msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../library/string.rst:746 +#: ../../library/string.rst:756 msgid "$ (dollar)" msgstr "$ (金錢符號)" -#: ../../library/string.rst:746 +#: ../../library/string.rst:756 msgid "in template strings" msgstr "於 template strings(模板字串)" diff --git a/library/time.po b/library/time.po index c3f7ef4998..b110d06f95 100644 --- a/library/time.po +++ b/library/time.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-11-01 00:15+0000\n" "PO-Revision-Date: 2024-08-14 16:05+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -266,14 +266,14 @@ msgstr "" #: ../../library/time.rst:149 ../../library/time.rst:161 #: ../../library/time.rst:174 ../../library/time.rst:183 #: ../../library/time.rst:196 ../../library/time.rst:205 -#: ../../library/time.rst:721 ../../library/time.rst:745 -#: ../../library/time.rst:841 ../../library/time.rst:852 -#: ../../library/time.rst:862 ../../library/time.rst:872 -#: ../../library/time.rst:881 ../../library/time.rst:890 -#: ../../library/time.rst:899 ../../library/time.rst:910 -#: ../../library/time.rst:918 ../../library/time.rst:929 -#: ../../library/time.rst:940 ../../library/time.rst:949 -#: ../../library/time.rst:962 +#: ../../library/time.rst:734 ../../library/time.rst:758 +#: ../../library/time.rst:854 ../../library/time.rst:865 +#: ../../library/time.rst:875 ../../library/time.rst:885 +#: ../../library/time.rst:894 ../../library/time.rst:903 +#: ../../library/time.rst:912 ../../library/time.rst:923 +#: ../../library/time.rst:931 ../../library/time.rst:942 +#: ../../library/time.rst:953 ../../library/time.rst:962 +#: ../../library/time.rst:975 msgid "Availability" msgstr "" @@ -476,7 +476,7 @@ msgstr "" "示)。該時鐘不受系統時鐘更新的影響。回傳值的參考點沒有定義,因此只有兩次呼叫" "結果之間的差異才是有效的。" -#: ../../library/time.rst:290 ../../library/time.rst:687 +#: ../../library/time.rst:290 ../../library/time.rst:700 msgid "Clock:" msgstr "" @@ -534,8 +534,8 @@ msgstr "" #: ../../library/time.rst:330 msgid "" -"On CPython, use the same clock than :func:`time.monotonic` and is a " -"monotonic clock, i.e. a clock that cannot go backwards." +"On CPython, use the same clock as :func:`time.monotonic` and is a monotonic " +"clock, i.e. a clock that cannot go backwards." msgstr "" #: ../../library/time.rst:333 @@ -550,9 +550,8 @@ msgid "On Windows, the function is now system-wide." msgstr "在 Windows 上,此函式現在涵蓋整個系統。" #: ../../library/time.rst:341 -#, fuzzy -msgid "Use the same clock than :func:`time.monotonic`." -msgstr "``'monotonic'``::func:`time.monotonic`" +msgid "Use the same clock as :func:`time.monotonic`." +msgstr "與 :func:`time.monotonic` 使用相同的時鐘。" #: ../../library/time.rst:347 msgid "Similar to :func:`perf_counter`, but return time as nanoseconds." @@ -846,23 +845,31 @@ msgstr "" "一年中的週數(星期天作為一週的第一天),表示為十進位數 [00,53]。新的一年中," "在第一個星期天之前的所有日子都被認定為第 0 週。" -#: ../../library/time.rst:478 ../../library/time.rst:489 +#: ../../library/time.rst:478 ../../library/time.rst:492 msgid "\\(4)" msgstr "\\(4)" #: ../../library/time.rst:486 +msgid "``%u``" +msgstr "``%u``" + +#: ../../library/time.rst:486 +msgid "Day of the week (Monday is 1; Sunday is 7) as a decimal number [1, 7]." +msgstr "一週中的日期(周一為 1;週日為 7),表示為十進位數 [1,7]。" + +#: ../../library/time.rst:489 msgid "``%w``" msgstr "``%w``" -#: ../../library/time.rst:486 +#: ../../library/time.rst:489 msgid "Weekday as a decimal number [0(Sunday),6]." msgstr "週間日,表示為十進位數 [0(星期天),6]。" -#: ../../library/time.rst:489 +#: ../../library/time.rst:492 msgid "``%W``" msgstr "``%W``" -#: ../../library/time.rst:489 +#: ../../library/time.rst:492 msgid "" "Week number of the year (Monday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Monday are " @@ -871,43 +878,43 @@ msgstr "" "一年中的週數(星期一作為一週的第一天),表示為十進位數 [00,53]。新的一年中," "在第一個星期一之前的所有日子都被認定為第 0 週。" -#: ../../library/time.rst:497 +#: ../../library/time.rst:500 msgid "``%x``" msgstr "``%x``" -#: ../../library/time.rst:497 +#: ../../library/time.rst:500 msgid "Locale's appropriate date representation." msgstr "區域設定的合適的日期表示法。" -#: ../../library/time.rst:500 +#: ../../library/time.rst:503 msgid "``%X``" msgstr "``%X``" -#: ../../library/time.rst:500 +#: ../../library/time.rst:503 msgid "Locale's appropriate time representation." msgstr "區域設定的合適的時間表示法。" -#: ../../library/time.rst:503 +#: ../../library/time.rst:506 msgid "``%y``" msgstr "``%y``" -#: ../../library/time.rst:503 +#: ../../library/time.rst:506 msgid "Year without century as a decimal number [00,99]." msgstr "去掉世紀的年份,表示為十進位數 [00,99]。" -#: ../../library/time.rst:506 +#: ../../library/time.rst:509 msgid "``%Y``" msgstr "``%Y``" -#: ../../library/time.rst:506 +#: ../../library/time.rst:509 msgid "Year with century as a decimal number." msgstr "帶世紀的年份,表示為十進位數。" -#: ../../library/time.rst:509 +#: ../../library/time.rst:512 msgid "``%z``" msgstr "``%z``" -#: ../../library/time.rst:509 +#: ../../library/time.rst:512 msgid "" "Time zone offset indicating a positive or negative time difference from UTC/" "GMT of the form +HHMM or -HHMM, where H represents decimal hour digits and M " @@ -916,27 +923,49 @@ msgstr "" "時區偏移量,表示與 UTC/GMT 的正或負時間差,形式為 +HHMM 或 -HHMM,其中 H 代表" "十進位的小時數碼 (digits),M 代表十進位的分鐘數碼 [-23:59, +23:59]。 [1]_" -#: ../../library/time.rst:515 +#: ../../library/time.rst:518 msgid "``%Z``" msgstr "``%Z``" -#: ../../library/time.rst:515 +#: ../../library/time.rst:518 msgid "Time zone name (no characters if no time zone exists). Deprecated. [1]_" msgstr "時區名稱(如果不存在時區,則無字元)。已被棄用。 [1]_" -#: ../../library/time.rst:518 +#: ../../library/time.rst:521 +msgid "``%G``" +msgstr "``%G``" + +#: ../../library/time.rst:521 +msgid "" +"ISO 8601 year (similar to ``%Y`` but follows the rules for the ISO 8601 " +"calendar year). The year starts with the week that contains the first " +"Thursday of the calendar year." +msgstr "" + +#: ../../library/time.rst:526 +msgid "``%V``" +msgstr "``%V``" + +#: ../../library/time.rst:526 +msgid "" +"ISO 8601 week number (as a decimal number [01,53]). The first week of the " +"year is the one that contains the first Thursday of the year. Weeks start on " +"Monday." +msgstr "" + +#: ../../library/time.rst:531 msgid "``%%``" msgstr "``%%``" -#: ../../library/time.rst:518 +#: ../../library/time.rst:531 msgid "A literal ``'%'`` character." msgstr "字面意義上的 ``'%'`` 字元。" -#: ../../library/time.rst:521 +#: ../../library/time.rst:534 msgid "Notes:" msgstr "註解:" -#: ../../library/time.rst:524 +#: ../../library/time.rst:537 msgid "" "The ``%f`` format directive only applies to :func:`strptime`, not to :func:" "`strftime`. However, see also :meth:`datetime.datetime.strptime` and :meth:" @@ -947,7 +976,7 @@ msgstr "" "在 :meth:`datetime.datetime.strptime` 和 :meth:`datetime.datetime.strftime` " "其中的 ``%f`` 格式的指令\\ :ref:`適用於微秒 `。" -#: ../../library/time.rst:530 +#: ../../library/time.rst:543 msgid "" "When used with the :func:`strptime` function, the ``%p`` directive only " "affects the output hour field if the ``%I`` directive is used to parse the " @@ -956,7 +985,7 @@ msgstr "" "當與 :func:`strptime` 函式一起使用時,``%p`` 指令僅在使用 ``%I`` 指令剖析小時" "時影響輸出小時的欄位。" -#: ../../library/time.rst:536 +#: ../../library/time.rst:549 msgid "" "The range really is ``0`` to ``61``; value ``60`` is valid in timestamps " "representing `leap seconds`_ and value ``61`` is supported for historical " @@ -965,7 +994,7 @@ msgstr "" "範圍確實是從 ``0`` 到 ``61``;數值 ``60`` 在表示 `leap seconds`_ 的時間戳中是" "有效的,而數值 ``61`` 是出於歷史因素而被支援。" -#: ../../library/time.rst:541 +#: ../../library/time.rst:554 msgid "" "When used with the :func:`strptime` function, ``%U`` and ``%W`` are only " "used in calculations when the day of the week and the year are specified." @@ -973,7 +1002,7 @@ msgstr "" "當與 :func:`strptime` 函式一起使用時,``%U`` 和 ``%W`` 僅在指定週間的某天和年" "份時用於計算中。" -#: ../../library/time.rst:544 +#: ../../library/time.rst:557 msgid "" "Here is an example, a format for dates compatible with that specified in " "the :rfc:`2822` Internet email standard. [1]_ ::" @@ -981,7 +1010,7 @@ msgstr "" "以下是一個範例,其為一種與 :rfc:`2822` 網際網路電子郵件標準中指定的日期格式兼" "容的格式。 [1]_: ::" -#: ../../library/time.rst:547 +#: ../../library/time.rst:560 msgid "" ">>> from time import gmtime, strftime\n" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" @@ -991,7 +1020,7 @@ msgstr "" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" "'Thu, 28 Jun 2001 14:17:15 +0000'" -#: ../../library/time.rst:551 +#: ../../library/time.rst:564 msgid "" "Additional directives may be supported on certain platforms, but only the " "ones listed here have a meaning standardized by ANSI C. To see the full set " @@ -1001,7 +1030,7 @@ msgstr "" "某些平台可能支援額外的指令,但只有這裡列出的指令具有 ANSI C 標準化的意義。要" "查看你的平台上支援的完整格式碼集,請參閱 :manpage:`strftime(3)` 文件。" -#: ../../library/time.rst:556 +#: ../../library/time.rst:569 msgid "" "On some platforms, an optional field width and precision specification can " "immediately follow the initial ``'%'`` of a directive in the following " @@ -1011,7 +1040,7 @@ msgstr "" "在某些平台上,可選的欄位寬度和精度規範可以以此順序緊跟在指令初始的 ``'%'`` 之" "後;這也是不可攜 (portable) 的。欄位寬度通常為 2,除了 ``%j`` 為 3。" -#: ../../library/time.rst:567 +#: ../../library/time.rst:580 msgid "" "Parse a string representing a time according to a format. The return value " "is a :class:`struct_time` as returned by :func:`gmtime` or :func:`localtime`." @@ -1019,7 +1048,7 @@ msgstr "" "根據格式剖析表示時間的字串。回傳值是 :class:`struct_time`,如同由 :func:" "`gmtime` 或 :func:`localtime` 回傳的一樣。" -#: ../../library/time.rst:571 +#: ../../library/time.rst:584 msgid "" "The *format* parameter uses the same directives as those used by :func:" "`strftime`; it defaults to ``\"%a %b %d %H:%M:%S %Y\"`` which matches the " @@ -1035,11 +1064,11 @@ msgstr "" "時,用來填充任何缺失資料的預設值為 ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)``。" "*string* 和 *format* 都必須是字串。" -#: ../../library/time.rst:579 +#: ../../library/time.rst:592 msgid "For example:" msgstr "例如:" -#: ../../library/time.rst:586 +#: ../../library/time.rst:599 msgid "" "Support for the ``%Z`` directive is based on the values contained in " "``tzname`` and whether ``daylight`` is true. Because of this, it is " @@ -1050,7 +1079,7 @@ msgstr "" "因此,除了識別始終已知的 UTC 和 GMT(且被考慮為非日光節約時區)外,這是特定於" "平台的。" -#: ../../library/time.rst:591 +#: ../../library/time.rst:604 msgid "" "Only the directives specified in the documentation are supported. Because " "``strftime()`` is implemented per platform it can sometimes offer more " @@ -1062,7 +1091,7 @@ msgstr "" "提供比列出的還要更多的指令。但是 ``strptime()`` 與任何平台無關,因此不一定支" "援所有未記載為支援的指令。" -#: ../../library/time.rst:600 +#: ../../library/time.rst:613 msgid "" "The type of the time value sequence returned by :func:`gmtime`, :func:" "`localtime`, and :func:`strptime`. It is an object with a :term:`named " @@ -1073,110 +1102,110 @@ msgstr "" "別。它是一個具有 :term:`named tuple` 介面的物件:值可以通過索引和屬性名稱存" "取。包含以下值:" -#: ../../library/time.rst:607 +#: ../../library/time.rst:620 msgid "Index" msgstr "索引" -#: ../../library/time.rst:608 +#: ../../library/time.rst:621 msgid "Attribute" msgstr "屬性" -#: ../../library/time.rst:609 +#: ../../library/time.rst:622 msgid "Values" msgstr "值" -#: ../../library/time.rst:611 +#: ../../library/time.rst:624 msgid "0" msgstr "0" -#: ../../library/time.rst:613 +#: ../../library/time.rst:626 msgid "(for example, 1993)" msgstr "(例如 1993)" -#: ../../library/time.rst:615 +#: ../../library/time.rst:628 msgid "1" msgstr "1" -#: ../../library/time.rst:617 +#: ../../library/time.rst:630 msgid "range [1, 12]" msgstr "範圍 [1, 12]" -#: ../../library/time.rst:619 +#: ../../library/time.rst:632 msgid "2" msgstr "2" -#: ../../library/time.rst:621 +#: ../../library/time.rst:634 msgid "range [1, 31]" msgstr "範圍 [1, 31]" -#: ../../library/time.rst:623 +#: ../../library/time.rst:636 msgid "3" msgstr "3" -#: ../../library/time.rst:625 +#: ../../library/time.rst:638 msgid "range [0, 23]" msgstr "範圍 [0, 23]" -#: ../../library/time.rst:627 +#: ../../library/time.rst:640 msgid "4" msgstr "4" -#: ../../library/time.rst:629 +#: ../../library/time.rst:642 msgid "range [0, 59]" msgstr "範圍 [0, 59]" -#: ../../library/time.rst:631 +#: ../../library/time.rst:644 msgid "5" msgstr "5" -#: ../../library/time.rst:633 +#: ../../library/time.rst:646 msgid "range [0, 61]; see :ref:`Note (2) ` in :func:`strftime`" msgstr "" "範圍 [0, 61];參見 :func:`strftime` 中的\\ :ref:`註釋 (2) `" -#: ../../library/time.rst:635 +#: ../../library/time.rst:648 msgid "6" msgstr "6" -#: ../../library/time.rst:637 +#: ../../library/time.rst:650 msgid "range [0, 6]; Monday is 0" msgstr "範圍 [0, 6];星期一是 0" -#: ../../library/time.rst:639 +#: ../../library/time.rst:652 msgid "7" msgstr "7" -#: ../../library/time.rst:641 +#: ../../library/time.rst:654 msgid "range [1, 366]" msgstr "範圍 [1, 366]" -#: ../../library/time.rst:643 +#: ../../library/time.rst:656 msgid "8" msgstr "8" -#: ../../library/time.rst:645 +#: ../../library/time.rst:658 msgid "0, 1 or -1; see below" msgstr "0、1 或 -1;見下文" -#: ../../library/time.rst:647 ../../library/time.rst:651 +#: ../../library/time.rst:660 ../../library/time.rst:664 msgid "N/A" msgstr "N/A" -#: ../../library/time.rst:649 +#: ../../library/time.rst:662 msgid "abbreviation of timezone name" msgstr "時區名稱的縮寫" -#: ../../library/time.rst:653 +#: ../../library/time.rst:666 msgid "offset east of UTC in seconds" msgstr "UTC 向東的偏移量(以秒為單位)" -#: ../../library/time.rst:655 +#: ../../library/time.rst:668 msgid "" "Note that unlike the C structure, the month value is a range of [1, 12], not " "[0, 11]." msgstr "請注意,與 C 結構不同,月份值的範圍是 [1, 12],而不是 [0, 11]。" -#: ../../library/time.rst:658 +#: ../../library/time.rst:671 msgid "" "In calls to :func:`mktime`, :attr:`tm_isdst` may be set to 1 when daylight " "savings time is in effect, and 0 when it is not. A value of -1 indicates " @@ -1186,7 +1215,7 @@ msgstr "" "在呼叫 :func:`mktime` 時,當日光節約時間生效的時候,:attr:`tm_isdst` 可以設定" "為 1,不生效時設定為 0。值 -1 表示未知是否生效,通常結果會填入正確的狀態。" -#: ../../library/time.rst:662 +#: ../../library/time.rst:675 msgid "" "When a tuple with an incorrect length is passed to a function expecting a :" "class:`struct_time`, or having elements of the wrong type, a :exc:" @@ -1195,7 +1224,7 @@ msgstr "" "當一個長度不正確的元組被傳遞給預期得到 :class:`struct_time` 的函式時,或者其" "中有元素型別錯誤時,將引發 :exc:`TypeError`。" -#: ../../library/time.rst:668 +#: ../../library/time.rst:681 msgid "" "Return the time in seconds since the epoch_ as a floating-point number. The " "handling of `leap seconds`_ is platform dependent. On Windows and most Unix " @@ -1207,7 +1236,7 @@ msgstr "" "關的。在 Windows 和大多數 Unix 系統上,閏秒不計入自 epoch_ 起的秒數中。這通常" "被稱為 `Unix 時間 `_。" -#: ../../library/time.rst:674 +#: ../../library/time.rst:687 msgid "" "Note that even though the time is always returned as a floating-point " "number, not all systems provide time with a better precision than 1 second. " @@ -1219,7 +1248,7 @@ msgstr "" "間。雖然此函式通常回傳非遞減的值,但如果在兩次呼叫之間系統時鐘被回調,則它可" "能回傳比之前呼叫更小的值。" -#: ../../library/time.rst:680 +#: ../../library/time.rst:693 msgid "" "The number returned by :func:`.time` may be converted into a more common " "time format (i.e. year, month, day, hour, etc...) in UTC by passing it to :" @@ -1233,31 +1262,31 @@ msgstr "" "為當地時間。在這兩種情況下都會回傳一個 :class:`struct_time` 物件,從中可以作" "為屬性存取日曆日期的組成部分。" -#: ../../library/time.rst:689 +#: ../../library/time.rst:702 msgid "On Windows, call ``GetSystemTimeAsFileTime()``." msgstr "" -#: ../../library/time.rst:690 +#: ../../library/time.rst:703 msgid "Call ``clock_gettime(CLOCK_REALTIME)`` if available." msgstr "" -#: ../../library/time.rst:691 +#: ../../library/time.rst:704 msgid "Otherwise, call ``gettimeofday()``." msgstr "" -#: ../../library/time.rst:693 +#: ../../library/time.rst:706 msgid "" "Use :func:`time_ns` to avoid the precision loss caused by the :class:`float` " "type." msgstr "使用 :func:`time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:699 +#: ../../library/time.rst:712 msgid "" "Similar to :func:`~time.time` but returns time as an integer number of " "nanoseconds since the epoch_." msgstr "類似於 :func:`~time.time`,但回傳自 epoch_ 起的以奈秒為單位的整數。" -#: ../../library/time.rst:712 +#: ../../library/time.rst:725 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current thread. It does not include time elapsed during " @@ -1266,21 +1295,21 @@ msgid "" "of two calls in the same thread is valid." msgstr "" -#: ../../library/time.rst:718 +#: ../../library/time.rst:731 msgid "" "Use :func:`thread_time_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" -#: ../../library/time.rst:723 +#: ../../library/time.rst:736 msgid "Unix systems supporting ``CLOCK_THREAD_CPUTIME_ID``." msgstr "" -#: ../../library/time.rst:730 +#: ../../library/time.rst:743 msgid "Similar to :func:`thread_time` but return time as nanoseconds." msgstr "" -#: ../../library/time.rst:737 +#: ../../library/time.rst:750 msgid "" "Reset the time conversion rules used by the library routines. The " "environment variable :envvar:`TZ` specifies how this is done. It will also " @@ -1291,46 +1320,46 @@ msgid "" "when daylight saving time applies)." msgstr "" -#: ../../library/time.rst:749 +#: ../../library/time.rst:762 msgid "" "Although in many cases, changing the :envvar:`TZ` environment variable may " "affect the output of functions like :func:`localtime` without calling :func:" "`tzset`, this behavior should not be relied on." msgstr "" -#: ../../library/time.rst:753 +#: ../../library/time.rst:766 msgid "The :envvar:`TZ` environment variable should contain no whitespace." msgstr "" -#: ../../library/time.rst:755 +#: ../../library/time.rst:768 msgid "" "The standard format of the :envvar:`TZ` environment variable is (whitespace " "added for clarity)::" msgstr "" -#: ../../library/time.rst:758 +#: ../../library/time.rst:771 msgid "std offset [dst [offset [,start[/time], end[/time]]]]" msgstr "std offset [dst [offset [,start[/time], end[/time]]]]" -#: ../../library/time.rst:760 +#: ../../library/time.rst:773 msgid "Where the components are:" msgstr "" -#: ../../library/time.rst:762 +#: ../../library/time.rst:775 msgid "``std`` and ``dst``" msgstr "``std`` 和 ``dst``" -#: ../../library/time.rst:763 +#: ../../library/time.rst:776 msgid "" "Three or more alphanumerics giving the timezone abbreviations. These will be " "propagated into time.tzname" msgstr "" -#: ../../library/time.rst:766 +#: ../../library/time.rst:779 msgid "``offset``" msgstr "``offset``" -#: ../../library/time.rst:767 +#: ../../library/time.rst:780 msgid "" "The offset has the form: ``± hh[:mm[:ss]]``. This indicates the value added " "the local time to arrive at UTC. If preceded by a '-', the timezone is east " @@ -1338,41 +1367,41 @@ msgid "" "summer time is assumed to be one hour ahead of standard time." msgstr "" -#: ../../library/time.rst:772 +#: ../../library/time.rst:785 msgid "``start[/time], end[/time]``" msgstr "``start[/time], end[/time]``" -#: ../../library/time.rst:773 +#: ../../library/time.rst:786 msgid "" "Indicates when to change to and back from DST. The format of the start and " "end dates are one of the following:" msgstr "" -#: ../../library/time.rst:776 +#: ../../library/time.rst:789 msgid ":samp:`J{n}`" msgstr ":samp:`J{n}`" -#: ../../library/time.rst:777 +#: ../../library/time.rst:790 msgid "" "The Julian day *n* (1 <= *n* <= 365). Leap days are not counted, so in all " "years February 28 is day 59 and March 1 is day 60." msgstr "" -#: ../../library/time.rst:780 +#: ../../library/time.rst:793 msgid ":samp:`{n}`" msgstr ":samp:`{n}`" -#: ../../library/time.rst:781 +#: ../../library/time.rst:794 msgid "" "The zero-based Julian day (0 <= *n* <= 365). Leap days are counted, and it " "is possible to refer to February 29." msgstr "" -#: ../../library/time.rst:784 +#: ../../library/time.rst:797 msgid ":samp:`M{m}.{n}.{d}`" msgstr ":samp:`M{m}.{n}.{d}`" -#: ../../library/time.rst:785 +#: ../../library/time.rst:798 msgid "" "The *d*'th day (0 <= *d* <= 6) of week *n* of month *m* of the year (1 <= " "*n* <= 5, 1 <= *m* <= 12, where week 5 means \"the last *d* day in month " @@ -1380,13 +1409,13 @@ msgid "" "first week in which the *d*'th day occurs. Day zero is a Sunday." msgstr "" -#: ../../library/time.rst:791 +#: ../../library/time.rst:804 msgid "" "``time`` has the same format as ``offset`` except that no leading sign ('-' " "or '+') is allowed. The default, if time is not given, is 02:00:00." msgstr "" -#: ../../library/time.rst:796 +#: ../../library/time.rst:809 msgid "" ">>> os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0'\n" ">>> time.tzset()\n" @@ -1406,7 +1435,7 @@ msgstr "" ">>> time.strftime('%X %x %Z')\n" "'16:08:12 05/08/03 AEST'" -#: ../../library/time.rst:805 +#: ../../library/time.rst:818 msgid "" "On many Unix systems (including \\*BSD, Linux, Solaris, and Darwin), it is " "more convenient to use the system's zoneinfo (:manpage:`tzfile(5)`) " @@ -1417,7 +1446,7 @@ msgid "" "``'Australia/Melbourne'``, ``'Egypt'`` or ``'Europe/Amsterdam'``. ::" msgstr "" -#: ../../library/time.rst:813 +#: ../../library/time.rst:826 msgid "" ">>> os.environ['TZ'] = 'US/Eastern'\n" ">>> time.tzset()\n" @@ -1429,23 +1458,23 @@ msgid "" "('EET', 'EEST')" msgstr "" -#: ../../library/time.rst:826 +#: ../../library/time.rst:839 msgid "Clock ID Constants" msgstr "" -#: ../../library/time.rst:828 +#: ../../library/time.rst:841 msgid "" "These constants are used as parameters for :func:`clock_getres` and :func:" "`clock_gettime`." msgstr "" -#: ../../library/time.rst:833 +#: ../../library/time.rst:846 msgid "" "Identical to :data:`CLOCK_MONOTONIC`, except it also includes any time that " "the system is suspended." msgstr "" -#: ../../library/time.rst:836 +#: ../../library/time.rst:849 msgid "" "This allows applications to get a suspend-aware monotonic clock without " "having to deal with the complications of :data:`CLOCK_REALTIME`, which may " @@ -1453,87 +1482,87 @@ msgid "" "similar." msgstr "" -#: ../../library/time.rst:848 +#: ../../library/time.rst:861 msgid "" "The Solaris OS has a ``CLOCK_HIGHRES`` timer that attempts to use an optimal " "hardware source, and may give close to nanosecond resolution. " "``CLOCK_HIGHRES`` is the nonadjustable, high-resolution clock." msgstr "" -#: ../../library/time.rst:859 +#: ../../library/time.rst:872 msgid "" "Clock that cannot be set and represents monotonic time since some " "unspecified starting point." msgstr "" -#: ../../library/time.rst:869 +#: ../../library/time.rst:882 msgid "" "Similar to :data:`CLOCK_MONOTONIC`, but provides access to a raw hardware-" "based time that is not subject to NTP adjustments." msgstr "" -#: ../../library/time.rst:878 +#: ../../library/time.rst:891 msgid "" "Similar to :data:`CLOCK_MONOTONIC_RAW`, but reads a value cached by the " "system at context switch and hence has less accuracy." msgstr "" -#: ../../library/time.rst:888 ../../library/time.rst:897 +#: ../../library/time.rst:901 ../../library/time.rst:910 msgid "High-resolution per-process timer from the CPU." msgstr "" -#: ../../library/time.rst:905 +#: ../../library/time.rst:918 msgid "" "`International Atomic Time `_" msgstr "" -#: ../../library/time.rst:907 +#: ../../library/time.rst:920 msgid "" "The system must have a current leap second table in order for this to give " "the correct answer. PTP or NTP software can maintain a leap second table." msgstr "" -#: ../../library/time.rst:916 +#: ../../library/time.rst:929 msgid "Thread-specific CPU-time clock." msgstr "" -#: ../../library/time.rst:925 +#: ../../library/time.rst:938 msgid "" "Time whose absolute value is the time the system has been running and not " "suspended, providing accurate uptime measurement, both absolute and interval." msgstr "" -#: ../../library/time.rst:936 +#: ../../library/time.rst:949 msgid "" "Clock that increments monotonically, tracking the time since an arbitrary " "point, unaffected by frequency or time adjustments and not incremented while " "the system is asleep." msgstr "" -#: ../../library/time.rst:946 +#: ../../library/time.rst:959 msgid "" "Like :data:`CLOCK_UPTIME_RAW`, but the value is cached by the system at " "context switches and therefore has less accuracy." msgstr "" -#: ../../library/time.rst:953 +#: ../../library/time.rst:966 msgid "" "The following constant is the only parameter that can be sent to :func:" "`clock_settime`." msgstr "" -#: ../../library/time.rst:959 +#: ../../library/time.rst:972 msgid "" "System-wide real-time clock. Setting this clock requires appropriate " "privileges." msgstr "" -#: ../../library/time.rst:970 +#: ../../library/time.rst:983 msgid "Timezone Constants" msgstr "" -#: ../../library/time.rst:974 +#: ../../library/time.rst:987 msgid "" "The offset of the local DST timezone, in seconds west of UTC, if one is " "defined. This is negative if the local DST timezone is east of UTC (as in " @@ -1541,25 +1570,25 @@ msgid "" "nonzero. See note below." msgstr "" -#: ../../library/time.rst:980 +#: ../../library/time.rst:993 msgid "Nonzero if a DST timezone is defined. See note below." msgstr "" -#: ../../library/time.rst:984 +#: ../../library/time.rst:997 msgid "" "The offset of the local (non-DST) timezone, in seconds west of UTC (negative " "in most of Western Europe, positive in the US, zero in the UK). See note " "below." msgstr "" -#: ../../library/time.rst:989 +#: ../../library/time.rst:1002 msgid "" "A tuple of two strings: the first is the name of the local non-DST timezone, " "the second is the name of the local DST timezone. If no DST timezone is " "defined, the second string should not be used. See note below." msgstr "" -#: ../../library/time.rst:995 +#: ../../library/time.rst:1008 msgid "" "For the above Timezone constants (:data:`altzone`, :data:`daylight`, :data:" "`timezone`, and :data:`tzname`), the value is determined by the timezone " @@ -1569,40 +1598,40 @@ msgid "" "func:`localtime` to obtain timezone information." msgstr "" -#: ../../library/time.rst:1004 +#: ../../library/time.rst:1017 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/time.rst:1005 +#: ../../library/time.rst:1018 msgid "More object-oriented interface to dates and times." msgstr "" -#: ../../library/time.rst:1007 +#: ../../library/time.rst:1020 msgid "Module :mod:`locale`" msgstr ":mod:`locale` 模組" -#: ../../library/time.rst:1008 +#: ../../library/time.rst:1021 msgid "" "Internationalization services. The locale setting affects the " "interpretation of many format specifiers in :func:`strftime` and :func:" "`strptime`." msgstr "" -#: ../../library/time.rst:1011 +#: ../../library/time.rst:1024 msgid "Module :mod:`calendar`" msgstr ":mod:`calendar` 模組" -#: ../../library/time.rst:1012 +#: ../../library/time.rst:1025 msgid "" "General calendar-related functions. :func:`~calendar.timegm` is the " "inverse of :func:`gmtime` from this module." msgstr "" -#: ../../library/time.rst:1016 +#: ../../library/time.rst:1029 msgid "Footnotes" msgstr "註解" -#: ../../library/time.rst:1017 +#: ../../library/time.rst:1030 msgid "" "The use of ``%Z`` is now deprecated, but the ``%z`` escape that expands to " "the preferred hour/minute offset is not supported by all ANSI C libraries. " @@ -1642,22 +1671,22 @@ msgid "Daylight Saving Time" msgstr "Daylight Saving Time(日光節約時間)" #: ../../library/time.rst:319 ../../library/time.rst:354 -#: ../../library/time.rst:707 +#: ../../library/time.rst:720 msgid "benchmarking" msgstr "benchmarking(基準測試)" -#: ../../library/time.rst:354 ../../library/time.rst:707 +#: ../../library/time.rst:354 ../../library/time.rst:720 msgid "CPU time" msgstr "CPU time(CPU 時間)" -#: ../../library/time.rst:354 ../../library/time.rst:707 +#: ../../library/time.rst:354 ../../library/time.rst:720 msgid "processor time" msgstr "processor time(處理器時間)" -#: ../../library/time.rst:416 ../../library/time.rst:562 +#: ../../library/time.rst:416 ../../library/time.rst:575 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/time.rst:416 ../../library/time.rst:562 +#: ../../library/time.rst:416 ../../library/time.rst:575 msgid "datetime format" msgstr "datetime format(日期時間格式)" diff --git a/library/warnings.po b/library/warnings.po index 14bf51843b..914b791ce7 100644 --- a/library/warnings.po +++ b/library/warnings.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-11-03 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -354,11 +354,39 @@ msgid "" "\"default\" action is applied (hence its name)." msgstr "" -#: ../../library/warnings.rst:184 +#: ../../library/warnings.rst:185 +msgid "Repeated Warning Suppression Criteria" +msgstr "" + +#: ../../library/warnings.rst:187 +msgid "" +"The filters that suppress repeated warnings apply the following criteria to " +"determine if a warning is considered a repeat:" +msgstr "" + +#: ../../library/warnings.rst:189 +msgid "" +"``\"default\"``: A warning is considered a repeat only if the (*message*, " +"*category*, *module*, *lineno*) are all the same." +msgstr "" + +#: ../../library/warnings.rst:190 +msgid "" +"``\"module\"``: A warning is considered a repeat if the (*message*, " +"*category*, *module*) are the same, ignoring the line number." +msgstr "" + +#: ../../library/warnings.rst:191 +msgid "" +"``\"once\"``: A warning is considered a repeat if the (*message*, " +"*category*) are the same, ignoring the module and line number." +msgstr "" + +#: ../../library/warnings.rst:197 msgid "Describing Warning Filters" msgstr "" -#: ../../library/warnings.rst:186 +#: ../../library/warnings.rst:199 msgid "" "The warnings filter is initialized by :option:`-W` options passed to the " "Python interpreter command line and the :envvar:`PYTHONWARNINGS` environment " @@ -368,17 +396,17 @@ msgid "" "after printing a message to :data:`sys.stderr`)." msgstr "" -#: ../../library/warnings.rst:193 +#: ../../library/warnings.rst:206 msgid "" "Individual warnings filters are specified as a sequence of fields separated " "by colons::" msgstr "" -#: ../../library/warnings.rst:196 +#: ../../library/warnings.rst:209 msgid "action:message:category:module:line" msgstr "action:message:category:module:line" -#: ../../library/warnings.rst:198 +#: ../../library/warnings.rst:211 msgid "" "The meaning of each of these fields is as described in :ref:`warning-" "filter`. When listing multiple filters on a single line (as for :envvar:" @@ -388,14 +416,14 @@ msgid "" "precedence over earlier ones)." msgstr "" -#: ../../library/warnings.rst:205 +#: ../../library/warnings.rst:218 msgid "" "Commonly used warning filters apply to either all warnings, warnings in a " "particular category, or warnings raised by particular modules or packages. " "Some examples::" msgstr "" -#: ../../library/warnings.rst:209 +#: ../../library/warnings.rst:222 msgid "" "default # Show all warnings (even those ignored by " "default)\n" @@ -408,24 +436,24 @@ msgid "" "error:::mymodule # Convert warnings to errors in \"mymodule\"" msgstr "" -#: ../../library/warnings.rst:221 +#: ../../library/warnings.rst:234 msgid "Default Warning Filter" msgstr "" -#: ../../library/warnings.rst:223 +#: ../../library/warnings.rst:236 msgid "" "By default, Python installs several warning filters, which can be overridden " "by the :option:`-W` command-line option, the :envvar:`PYTHONWARNINGS` " "environment variable and calls to :func:`filterwarnings`." msgstr "" -#: ../../library/warnings.rst:227 +#: ../../library/warnings.rst:240 msgid "" "In regular release builds, the default warning filter has the following " "entries (in order of precedence)::" msgstr "" -#: ../../library/warnings.rst:230 +#: ../../library/warnings.rst:243 msgid "" "default::DeprecationWarning:__main__\n" "ignore::DeprecationWarning\n" @@ -439,36 +467,36 @@ msgstr "" "ignore::ImportWarning\n" "ignore::ResourceWarning" -#: ../../library/warnings.rst:236 +#: ../../library/warnings.rst:249 msgid "" "In a :ref:`debug build `, the list of default warning filters " "is empty." msgstr "" -#: ../../library/warnings.rst:238 +#: ../../library/warnings.rst:251 msgid "" ":exc:`DeprecationWarning` is now ignored by default in addition to :exc:" "`PendingDeprecationWarning`." msgstr "" -#: ../../library/warnings.rst:242 +#: ../../library/warnings.rst:255 msgid "" ":exc:`DeprecationWarning` is once again shown by default when triggered " "directly by code in ``__main__``." msgstr "" -#: ../../library/warnings.rst:246 +#: ../../library/warnings.rst:259 msgid "" ":exc:`BytesWarning` no longer appears in the default filter list and is " "instead configured via :data:`sys.warnoptions` when :option:`-b` is " "specified twice." msgstr "" -#: ../../library/warnings.rst:255 +#: ../../library/warnings.rst:268 msgid "Overriding the default filter" msgstr "" -#: ../../library/warnings.rst:257 +#: ../../library/warnings.rst:270 msgid "" "Developers of applications written in Python may wish to hide *all* Python " "level warnings from their users by default, and only display them when " @@ -478,7 +506,7 @@ msgid "" "disabled::" msgstr "" -#: ../../library/warnings.rst:263 +#: ../../library/warnings.rst:276 msgid "" "import sys\n" "\n" @@ -492,14 +520,14 @@ msgstr "" " import warnings\n" " warnings.simplefilter(\"ignore\")" -#: ../../library/warnings.rst:269 +#: ../../library/warnings.rst:282 msgid "" "Developers of test runners for Python code are advised to instead ensure " "that *all* warnings are displayed by default for the code under test, using " "code like::" msgstr "" -#: ../../library/warnings.rst:273 +#: ../../library/warnings.rst:286 msgid "" "import sys\n" "\n" @@ -509,7 +537,7 @@ msgid "" " os.environ[\"PYTHONWARNINGS\"] = \"default\" # Also affect subprocesses" msgstr "" -#: ../../library/warnings.rst:280 +#: ../../library/warnings.rst:293 msgid "" "Finally, developers of interactive shells that run user code in a namespace " "other than ``__main__`` are advised to ensure that :exc:`DeprecationWarning` " @@ -517,7 +545,7 @@ msgid "" "``user_ns`` is the module used to execute code entered interactively)::" msgstr "" -#: ../../library/warnings.rst:285 +#: ../../library/warnings.rst:298 msgid "" "import warnings\n" "warnings.filterwarnings(\"default\", category=DeprecationWarning,\n" @@ -527,11 +555,11 @@ msgstr "" "warnings.filterwarnings(\"default\", category=DeprecationWarning,\n" " module=user_ns.get(\"__name__\"))" -#: ../../library/warnings.rst:293 +#: ../../library/warnings.rst:306 msgid "Temporarily Suppressing Warnings" msgstr "" -#: ../../library/warnings.rst:295 +#: ../../library/warnings.rst:308 msgid "" "If you are using code that you know will raise a warning, such as a " "deprecated function, but do not want to see the warning (even when warnings " @@ -539,7 +567,7 @@ msgid "" "to suppress the warning using the :class:`catch_warnings` context manager::" msgstr "" -#: ../../library/warnings.rst:300 +#: ../../library/warnings.rst:313 msgid "" "import warnings\n" "\n" @@ -559,7 +587,7 @@ msgstr "" " warnings.simplefilter(\"ignore\")\n" " fxn()" -#: ../../library/warnings.rst:309 +#: ../../library/warnings.rst:322 msgid "" "While within the context manager all warnings will simply be ignored. This " "allows you to use known-deprecated code without having to see the warning " @@ -569,11 +597,11 @@ msgid "" "context manager at the same time, the behavior is undefined." msgstr "" -#: ../../library/warnings.rst:321 +#: ../../library/warnings.rst:334 msgid "Testing Warnings" msgstr "" -#: ../../library/warnings.rst:323 +#: ../../library/warnings.rst:336 msgid "" "To test warnings raised by code, use the :class:`catch_warnings` context " "manager. With it you can temporarily mutate the warnings filter to " @@ -581,7 +609,7 @@ msgid "" "raised warnings to check::" msgstr "" -#: ../../library/warnings.rst:328 +#: ../../library/warnings.rst:341 msgid "" "import warnings\n" "\n" @@ -599,7 +627,7 @@ msgid "" " assert \"deprecated\" in str(w[-1].message)" msgstr "" -#: ../../library/warnings.rst:343 +#: ../../library/warnings.rst:356 msgid "" "One can also cause all warnings to be exceptions by using ``error`` instead " "of ``always``. One thing to be aware of is that if a warning has already " @@ -608,7 +636,7 @@ msgid "" "registry related to the warning has been cleared." msgstr "" -#: ../../library/warnings.rst:349 +#: ../../library/warnings.rst:362 msgid "" "Once the context manager exits, the warnings filter is restored to its state " "when the context was entered. This prevents tests from changing the warnings " @@ -619,7 +647,7 @@ msgid "" "manager at the same time, the behavior is undefined." msgstr "" -#: ../../library/warnings.rst:357 +#: ../../library/warnings.rst:370 msgid "" "When testing multiple operations that raise the same kind of warning, it is " "important to test them in a manner that confirms each operation is raising a " @@ -629,18 +657,18 @@ msgid "" "entries from the warnings list before each new operation)." msgstr "" -#: ../../library/warnings.rst:368 +#: ../../library/warnings.rst:381 msgid "Updating Code For New Versions of Dependencies" msgstr "" -#: ../../library/warnings.rst:370 +#: ../../library/warnings.rst:383 msgid "" "Warning categories that are primarily of interest to Python developers " "(rather than end users of applications written in Python) are ignored by " "default." msgstr "" -#: ../../library/warnings.rst:373 +#: ../../library/warnings.rst:386 msgid "" "Notably, this \"ignored by default\" list includes :exc:`DeprecationWarning` " "(for every module except ``__main__``), which means developers should make " @@ -649,14 +677,14 @@ msgid "" "(whether in the standard library or third party packages)." msgstr "" -#: ../../library/warnings.rst:379 +#: ../../library/warnings.rst:392 msgid "" "In the ideal case, the code will have a suitable test suite, and the test " "runner will take care of implicitly enabling all warnings when running tests " "(the test runner provided by the :mod:`unittest` module does this)." msgstr "" -#: ../../library/warnings.rst:383 +#: ../../library/warnings.rst:396 msgid "" "In less ideal cases, applications can be checked for use of deprecated " "interfaces by passing :option:`-Wd <-W>` to the Python interpreter (this is " @@ -668,11 +696,11 @@ msgid "" "what is possible." msgstr "" -#: ../../library/warnings.rst:396 +#: ../../library/warnings.rst:409 msgid "Available Functions" msgstr "" -#: ../../library/warnings.rst:401 +#: ../../library/warnings.rst:414 msgid "" "Issue a warning, or maybe ignore it or raise an exception. The *category* " "argument, if given, must be a :ref:`warning category class `. The entry is inserted at the front by default; if " @@ -806,7 +834,7 @@ msgid "" "everything." msgstr "" -#: ../../library/warnings.rst:511 +#: ../../library/warnings.rst:524 msgid "" "Insert a simple entry into the list of :ref:`warnings filter specifications " "`. The meaning of the function parameters is as for :func:" @@ -815,18 +843,18 @@ msgid "" "and line number match." msgstr "" -#: ../../library/warnings.rst:520 +#: ../../library/warnings.rst:533 msgid "" "Reset the warnings filter. This discards the effect of all previous calls " "to :func:`filterwarnings`, including that of the :option:`-W` command line " "options and calls to :func:`simplefilter`." msgstr "" -#: ../../library/warnings.rst:527 +#: ../../library/warnings.rst:540 msgid "Decorator to indicate that a class, function or overload is deprecated." msgstr "" -#: ../../library/warnings.rst:529 +#: ../../library/warnings.rst:542 msgid "" "When this decorator is applied to an object, deprecation warnings may be " "emitted at runtime when the object is used. :term:`static type checkers " @@ -834,11 +862,11 @@ msgid "" "deprecated object." msgstr "" -#: ../../library/warnings.rst:534 +#: ../../library/warnings.rst:547 msgid "Usage::" msgstr "" -#: ../../library/warnings.rst:536 +#: ../../library/warnings.rst:549 msgid "" "from warnings import deprecated\n" "from typing import overload\n" @@ -858,7 +886,7 @@ msgid "" "def g(x: str) -> int: ..." msgstr "" -#: ../../library/warnings.rst:553 +#: ../../library/warnings.rst:566 msgid "" "The warning specified by *category* will be emitted at runtime on use of " "deprecated objects. For functions, that happens on calls; for classes, on " @@ -870,7 +898,7 @@ msgid "" "*category* and *stacklevel* arguments." msgstr "" -#: ../../library/warnings.rst:564 +#: ../../library/warnings.rst:577 msgid "" "The deprecation message passed to the decorator is saved in the " "``__deprecated__`` attribute on the decorated object. If applied to an " @@ -879,15 +907,15 @@ msgid "" "by :func:`typing.get_overloads`." msgstr "" -#: ../../library/warnings.rst:571 +#: ../../library/warnings.rst:584 msgid "See :pep:`702`." msgstr "" -#: ../../library/warnings.rst:576 +#: ../../library/warnings.rst:589 msgid "Available Context Managers" msgstr "" -#: ../../library/warnings.rst:580 +#: ../../library/warnings.rst:593 msgid "" "A context manager that copies and, upon exit, restores the warnings filter " "and the :func:`showwarning` function. If the *record* argument is :const:" @@ -898,27 +926,27 @@ msgid "" "has attributes with the same names as the arguments to :func:`showwarning`." msgstr "" -#: ../../library/warnings.rst:589 +#: ../../library/warnings.rst:602 msgid "" "The *module* argument takes a module that will be used instead of the module " "returned when you import :mod:`warnings` whose filter will be protected. " "This argument exists primarily for testing the :mod:`warnings` module itself." msgstr "" -#: ../../library/warnings.rst:594 +#: ../../library/warnings.rst:607 msgid "" "If the *action* argument is not ``None``, the remaining arguments are passed " "to :func:`simplefilter` as if it were called immediately on entering the " "context." msgstr "" -#: ../../library/warnings.rst:598 +#: ../../library/warnings.rst:611 msgid "" "See :ref:`warning-filter` for the meaning of the *category* and *lineno* " "parameters." msgstr "" -#: ../../library/warnings.rst:603 +#: ../../library/warnings.rst:616 msgid "" "The :class:`catch_warnings` manager works by replacing and then later " "restoring the module's :func:`showwarning` function and internal list of " @@ -926,7 +954,7 @@ msgid "" "state and therefore is not thread-safe." msgstr "" -#: ../../library/warnings.rst:611 +#: ../../library/warnings.rst:624 msgid "Added the *action*, *category*, *lineno*, and *append* parameters." msgstr "新增 *action*、*category*、*lineno* 和 *append* 參數。" diff --git a/license.po b/license.po index de6467b90f..f56bcc5556 100644 --- a/license.po +++ b/license.po @@ -264,7 +264,6 @@ msgid "PSF LICENSE AGREEMENT FOR PYTHON |release|" msgstr "用於 PYTHON |release| 的 PSF 授權合約" #: ../../license.rst:94 -#, fuzzy msgid "" "1. This LICENSE AGREEMENT is between the Python Software Foundation " "(\"PSF\"), and\n" @@ -350,7 +349,7 @@ msgstr "" "derivative\n" " version, provided, however, that PSF's License Agreement and PSF's notice " "of\n" -" copyright, i.e., \"Copyright © 2001-2023 Python Software Foundation; All " +" copyright, i.e., \"Copyright © 2001-2024 Python Software Foundation; All " "Rights\n" " Reserved\" are retained in Python |release| alone or in any derivative " "version\n" @@ -1195,9 +1194,8 @@ msgid "UUencode and UUdecode functions" msgstr "UUencode 與 UUdecode 函式" #: ../../license.rst:479 -#, fuzzy msgid "The ``uu`` codec contains the following notice::" -msgstr ":mod:`uu` 模組包含以下聲明: ::" +msgstr "``uu`` 編解碼器包含以下聲明: ::" #: ../../license.rst:481 msgid "" @@ -2326,14 +2324,13 @@ msgstr "" #: ../../license.rst:1048 msgid "mimalloc" -msgstr "" +msgstr "mimalloc" #: ../../license.rst:1050 msgid "MIT License::" msgstr "" #: ../../license.rst:1052 -#, fuzzy msgid "" "Copyright (c) 2018-2021 Microsoft Corporation, Daan Leijen\n" "\n" @@ -2362,26 +2359,32 @@ msgid "" "THE\n" "SOFTWARE." msgstr "" -"Copyright (c) 2001-2006 Twisted Matrix Laboratories.\n" +"Copyright (c) 2018-2021 Microsoft Corporation, Daan Leijen\n" "\n" -"Permission is hereby granted, free of charge, to any person obtaining\n" -"a copy of this software and associated documentation files (the\n" -"\"Software\"), to deal in the Software without restriction, including\n" -"without limitation the rights to use, copy, modify, merge, publish,\n" -"distribute, sublicense, and/or sell copies of the Software, and to\n" -"permit persons to whom the Software is furnished to do so, subject to\n" -"the following conditions:\n" +"Permission is hereby granted, free of charge, to any person obtaining a " +"copy\n" +"of this software and associated documentation files (the \"Software\"), to " +"deal\n" +"in the Software without restriction, including without limitation the " +"rights\n" +"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n" +"copies of the Software, and to permit persons to whom the Software is\n" +"furnished to do so, subject to the following conditions:\n" "\n" -"The above copyright notice and this permission notice shall be\n" -"included in all copies or substantial portions of the Software.\n" +"The above copyright notice and this permission notice shall be included in " +"all\n" +"copies or substantial portions of the Software.\n" "\n" -"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" -"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" -"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" -"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n" -"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n" -"OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" -"WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS " +"OR\n" +"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n" +"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n" +"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n" +"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING " +"FROM,\n" +"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN " +"THE\n" +"SOFTWARE." #: ../../license.rst:1074 msgid "asyncio" @@ -2453,7 +2456,6 @@ msgid "" msgstr "" #: ../../license.rst:1110 -#, fuzzy msgid "" "Copyright (c) 2019,2020 Jeffrey Roberson \n" "\n" @@ -2478,37 +2480,25 @@ msgid "" "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n" "THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." msgstr "" -"Copyright (c) 2008-2020 Stefan Krah. All rights reserved.\n" +"Copyright (c) 2019,2020 Jeffrey Roberson \n" "\n" "Redistribution and use in source and binary forms, with or without\n" "modification, are permitted provided that the following conditions\n" "are met:\n" -"\n" "1. Redistributions of source code must retain the above copyright\n" -" notice, this list of conditions and the following disclaimer.\n" -"\n" +" notice unmodified, this list of conditions, and the following\n" +" disclaimer.\n" "2. Redistributions in binary form must reproduce the above copyright\n" " notice, this list of conditions and the following disclaimer in the\n" " documentation and/or other materials provided with the distribution.\n" "\n" -"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS \"AS IS\" AND\n" -"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" -"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" -"ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n" -"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" -"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" -"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" -"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" -"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" -"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" -"SUCH DAMAGE." - -#~ msgid "Audioop" -#~ msgstr "Audioop" - -#~ msgid "" -#~ "The audioop module uses the code base in g771.c file of the SoX project. " -#~ "https://sourceforge.net/projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz" -#~ msgstr "" -#~ "audioop 模組使用 SoX 專案的 g771.c 檔案中的程式碼。 https://sourceforge." -#~ "net/projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n" +"IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n" +"OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n" +"IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n" +"INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n" +"NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n" +"DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n" +"THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" +"(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n" +"THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." diff --git a/reference/datamodel.po b/reference/datamodel.po index abda8ae6ec..ab96edc064 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2024-11-10 17:21+0000\n" "PO-Revision-Date: 2024-09-24 19:03+0900\n" "Last-Translator: Kisaragi Hiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -795,7 +795,7 @@ msgstr "" #: ../../reference/datamodel.rst:659 msgid "Instance methods" -msgstr "" +msgstr "實例方法" #: ../../reference/datamodel.rst:666 msgid "" @@ -894,7 +894,7 @@ msgstr "" #: ../../reference/datamodel.rst:741 msgid "Generator functions" -msgstr "Generator(產生器)函式" +msgstr "產生器函式" #: ../../reference/datamodel.rst:747 msgid "" @@ -924,7 +924,7 @@ msgstr "" #: ../../reference/datamodel.rst:772 msgid "Asynchronous generator functions" -msgstr "" +msgstr "非同步產生器函式" #: ../../reference/datamodel.rst:778 msgid "" @@ -986,7 +986,7 @@ msgstr "" #: ../../reference/datamodel.rst:821 msgid "Built-in methods" -msgstr "" +msgstr "內建方法" #: ../../reference/datamodel.rst:828 msgid "" @@ -1014,7 +1014,7 @@ msgstr "" #: ../../reference/datamodel.rst:848 msgid "Class Instances" -msgstr "" +msgstr "類別實例" #: ../../reference/datamodel.rst:850 msgid "" @@ -1210,10 +1210,13 @@ msgstr "" #: ../../reference/datamodel.rst:1016 msgid "" "Setting :attr:`!__loader__` on a module while failing to set :attr:`!" -"__spec__.loader` is deprecated. In Python 3.14, :attr:`!__loader__` will " +"__spec__.loader` is deprecated. In Python 3.16, :attr:`!__loader__` will " "cease to be set or taken into consideration by the import system or the " "standard library." msgstr "" +"在模組上設定 :attr:`!__loader__` 而沒有設定 :attr:`!__spec__.loader` 的做法已" +"被棄用。在 Python 3.16 中,引入系統或標準函式庫將不再設定或考慮 :attr:`!" +"__loader__`。" #: ../../reference/datamodel.rst:1024 msgid "" @@ -1483,10 +1486,14 @@ msgid "" ">>> A.__subclasses__()\n" "[]" msgstr "" +">>> class A: pass\n" +">>> class B(A): pass\n" +">>> A.__subclasses__()\n" +"[]" #: ../../reference/datamodel.rst:1263 msgid "Class instances" -msgstr "" +msgstr "類別實例" #: ../../reference/datamodel.rst:1271 msgid "" @@ -1564,7 +1571,7 @@ msgstr "" #: ../../reference/datamodel.rst:1362 msgid "Code objects" -msgstr "" +msgstr "程式碼物件" #: ../../reference/datamodel.rst:1366 msgid "" @@ -1670,7 +1677,7 @@ msgstr "" #: ../../reference/datamodel.rst:1461 msgid "" "This attribute of code objects is deprecated, and may be removed in Python " -"3.14." +"3.15." msgstr "" #: ../../reference/datamodel.rst:1466 @@ -2292,37 +2299,39 @@ msgstr "" #: ../../reference/datamodel.rst:1988 msgid "" "This is typically used for debugging, so it is important that the " -"representation is information-rich and unambiguous." +"representation is information-rich and unambiguous. A default implementation " +"is provided by the :class:`object` class itself." msgstr "" -#: ../../reference/datamodel.rst:1999 +#: ../../reference/datamodel.rst:2000 msgid "" -"Called by :func:`str(object) ` and the built-in functions :func:" -"`format` and :func:`print` to compute the \"informal\" or nicely printable " -"string representation of an object. The return value must be a :ref:`string " -"` object." +"Called by :func:`str(object) `, the default :meth:`__format__` " +"implementation, and the built-in function :func:`print`, to compute the " +"\"informal\" or nicely printable string representation of an object. The " +"return value must be a :ref:`str ` object." msgstr "" -#: ../../reference/datamodel.rst:2004 +#: ../../reference/datamodel.rst:2005 msgid "" "This method differs from :meth:`object.__repr__` in that there is no " "expectation that :meth:`__str__` return a valid Python expression: a more " "convenient or concise representation can be used." msgstr "" -#: ../../reference/datamodel.rst:2008 +#: ../../reference/datamodel.rst:2009 msgid "" "The default implementation defined by the built-in type :class:`object` " "calls :meth:`object.__repr__`." msgstr "" -#: ../../reference/datamodel.rst:2018 +#: ../../reference/datamodel.rst:2019 msgid "" "Called by :ref:`bytes ` to compute a byte-string representation " -"of an object. This should return a :class:`bytes` object." +"of an object. This should return a :class:`bytes` object. The :class:" +"`object` class itself does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:2029 +#: ../../reference/datamodel.rst:2031 msgid "" "Called by the :func:`format` built-in function, and by extension, evaluation " "of :ref:`formatted string literals ` and the :meth:`str.format` " @@ -2334,28 +2343,34 @@ msgid "" "formatting option syntax." msgstr "" -#: ../../reference/datamodel.rst:2039 +#: ../../reference/datamodel.rst:2041 msgid "" "See :ref:`formatspec` for a description of the standard formatting syntax." msgstr "" -#: ../../reference/datamodel.rst:2041 +#: ../../reference/datamodel.rst:2043 msgid "The return value must be a string object." +msgstr "回傳值必須是個字串物件。" + +#: ../../reference/datamodel.rst:2045 +msgid "" +"The default implementation by the :class:`object` class should be given an " +"empty *format_spec* string. It delegates to :meth:`__str__`." msgstr "" -#: ../../reference/datamodel.rst:2043 +#: ../../reference/datamodel.rst:2048 msgid "" "The __format__ method of ``object`` itself raises a :exc:`TypeError` if " "passed any non-empty string." msgstr "" -#: ../../reference/datamodel.rst:2047 +#: ../../reference/datamodel.rst:2052 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " "``format(str(x), '')``." msgstr "" -#: ../../reference/datamodel.rst:2063 +#: ../../reference/datamodel.rst:2068 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " "between operator symbols and method names is as follows: ``x.__hash__``." msgstr "" -#: ../../reference/datamodel.rst:2155 +#: ../../reference/datamodel.rst:2166 msgid "" "If a class that does not override :meth:`__eq__` wishes to suppress hash " "support, it should include ``__hash__ = None`` in the class definition. A " @@ -2489,7 +2514,7 @@ msgid "" "``isinstance(obj, collections.abc.Hashable)`` call." msgstr "" -#: ../../reference/datamodel.rst:2164 +#: ../../reference/datamodel.rst:2175 msgid "" "By default, the :meth:`__hash__` values of str and bytes objects are " "\"salted\" with an unpredictable random value. Although they remain " @@ -2497,7 +2522,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: ../../reference/datamodel.rst:2169 +#: ../../reference/datamodel.rst:2180 msgid "" "This is intended to provide protection against a denial-of-service caused by " "carefully chosen inputs that exploit the worst case performance of a dict " @@ -2505,52 +2530,54 @@ msgid "" "advisories/ocert-2011-003.html for details." msgstr "" -#: ../../reference/datamodel.rst:2174 +#: ../../reference/datamodel.rst:2185 msgid "" "Changing hash values affects the iteration order of sets. Python has never " "made guarantees about this ordering (and it typically varies between 32-bit " "and 64-bit builds)." msgstr "" -#: ../../reference/datamodel.rst:2178 +#: ../../reference/datamodel.rst:2189 msgid "See also :envvar:`PYTHONHASHSEED`." msgstr "另請參閱 :envvar:`PYTHONHASHSEED`。" -#: ../../reference/datamodel.rst:2180 +#: ../../reference/datamodel.rst:2191 msgid "Hash randomization is enabled by default." msgstr "" -#: ../../reference/datamodel.rst:2188 +#: ../../reference/datamodel.rst:2199 msgid "" "Called to implement truth value testing and the built-in operation " "``bool()``; should return ``False`` or ``True``. When this method is not " "defined, :meth:`~object.__len__` is called, if it is defined, and the object " "is considered true if its result is nonzero. If a class defines neither :" -"meth:`!__len__` nor :meth:`!__bool__`, all its instances are considered true." +"meth:`!__len__` nor :meth:`!__bool__` (which is true of the :class:`object` " +"class itself), all its instances are considered true." msgstr "" -#: ../../reference/datamodel.rst:2199 +#: ../../reference/datamodel.rst:2210 msgid "Customizing attribute access" msgstr "" -#: ../../reference/datamodel.rst:2201 +#: ../../reference/datamodel.rst:2212 msgid "" "The following methods can be defined to customize the meaning of attribute " "access (use of, assignment to, or deletion of ``x.name``) for class " "instances." msgstr "" -#: ../../reference/datamodel.rst:2209 +#: ../../reference/datamodel.rst:2220 msgid "" "Called when the default attribute access fails with an :exc:`AttributeError` " "(either :meth:`__getattribute__` raises an :exc:`AttributeError` because " "*name* is not an instance attribute or an attribute in the class tree for " "``self``; or :meth:`__get__` of a *name* property raises :exc:" "`AttributeError`). This method should either return the (computed) " -"attribute value or raise an :exc:`AttributeError` exception." +"attribute value or raise an :exc:`AttributeError` exception. The :class:" +"`object` class itself does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:2216 +#: ../../reference/datamodel.rst:2228 msgid "" "Note that if the attribute is found through the normal mechanism, :meth:" "`__getattr__` is not called. (This is an intentional asymmetry between :" @@ -2563,7 +2590,7 @@ msgid "" "actually get total control over attribute access." msgstr "" -#: ../../reference/datamodel.rst:2229 +#: ../../reference/datamodel.rst:2241 msgid "" "Called unconditionally to implement attribute accesses for instances of the " "class. If the class also defines :meth:`__getattr__`, the latter will not be " @@ -2575,64 +2602,64 @@ msgid "" "example, ``object.__getattribute__(self, name)``." msgstr "" -#: ../../reference/datamodel.rst:2240 +#: ../../reference/datamodel.rst:2252 msgid "" "This method may still be bypassed when looking up special methods as the " "result of implicit invocation via language syntax or :ref:`built-in " "functions `. See :ref:`special-lookup`." msgstr "" -#: ../../reference/datamodel.rst:2245 ../../reference/datamodel.rst:2247 +#: ../../reference/datamodel.rst:2257 ../../reference/datamodel.rst:2259 msgid "" "For certain sensitive attribute accesses, raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:2254 +#: ../../reference/datamodel.rst:2266 msgid "" "Called when an attribute assignment is attempted. This is called instead of " "the normal mechanism (i.e. store the value in the instance dictionary). " "*name* is the attribute name, *value* is the value to be assigned to it." msgstr "" -#: ../../reference/datamodel.rst:2258 +#: ../../reference/datamodel.rst:2270 msgid "" "If :meth:`__setattr__` wants to assign to an instance attribute, it should " "call the base class method with the same name, for example, ``object." "__setattr__(self, name, value)``." msgstr "" -#: ../../reference/datamodel.rst:2262 ../../reference/datamodel.rst:2264 +#: ../../reference/datamodel.rst:2274 ../../reference/datamodel.rst:2276 msgid "" "For certain sensitive attribute assignments, raises an :ref:`auditing event " "` ``object.__setattr__`` with arguments ``obj``, ``name``, " "``value``." msgstr "" -#: ../../reference/datamodel.rst:2271 +#: ../../reference/datamodel.rst:2283 msgid "" "Like :meth:`__setattr__` but for attribute deletion instead of assignment. " "This should only be implemented if ``del obj.name`` is meaningful for the " "object." msgstr "" -#: ../../reference/datamodel.rst:2274 ../../reference/datamodel.rst:2276 +#: ../../reference/datamodel.rst:2286 ../../reference/datamodel.rst:2288 msgid "" "For certain sensitive attribute deletions, raises an :ref:`auditing event " "` ``object.__delattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:2283 +#: ../../reference/datamodel.rst:2295 msgid "" "Called when :func:`dir` is called on the object. An iterable must be " "returned. :func:`dir` converts the returned iterable to a list and sorts it." msgstr "" -#: ../../reference/datamodel.rst:2288 +#: ../../reference/datamodel.rst:2300 msgid "Customizing module attribute access" msgstr "" -#: ../../reference/datamodel.rst:2295 +#: ../../reference/datamodel.rst:2307 msgid "" "Special names ``__getattr__`` and ``__dir__`` can be also used to customize " "access to module attributes. The ``__getattr__`` function at the module " @@ -2644,21 +2671,21 @@ msgid "" "with the attribute name and the result is returned." msgstr "" -#: ../../reference/datamodel.rst:2304 +#: ../../reference/datamodel.rst:2316 msgid "" "The ``__dir__`` function should accept no arguments, and return an iterable " "of strings that represents the names accessible on module. If present, this " "function overrides the standard :func:`dir` search on a module." msgstr "" -#: ../../reference/datamodel.rst:2308 +#: ../../reference/datamodel.rst:2320 msgid "" "For a more fine grained customization of the module behavior (setting " "attributes, properties, etc.), one can set the ``__class__`` attribute of a " "module object to a subclass of :class:`types.ModuleType`. For example::" msgstr "" -#: ../../reference/datamodel.rst:2312 +#: ../../reference/datamodel.rst:2324 msgid "" "import sys\n" "from types import ModuleType\n" @@ -2686,7 +2713,7 @@ msgstr "" "\n" "sys.modules[__name__].__class__ = VerboseModule" -#: ../../reference/datamodel.rst:2326 +#: ../../reference/datamodel.rst:2338 msgid "" "Defining module ``__getattr__`` and setting module ``__class__`` only affect " "lookups made using the attribute access syntax -- directly accessing the " @@ -2694,37 +2721,38 @@ msgid "" "module's globals dictionary) is unaffected." msgstr "" -#: ../../reference/datamodel.rst:2331 +#: ../../reference/datamodel.rst:2343 msgid "``__class__`` module attribute is now writable." -msgstr "" +msgstr "``__class__`` 模組屬性現在是可寫入的。" -#: ../../reference/datamodel.rst:2334 +#: ../../reference/datamodel.rst:2346 msgid "``__getattr__`` and ``__dir__`` module attributes." -msgstr "" +msgstr "``__getattr__`` 和 ``__dir__`` 模組屬性。" -#: ../../reference/datamodel.rst:2339 +#: ../../reference/datamodel.rst:2351 msgid ":pep:`562` - Module __getattr__ and __dir__" msgstr ":pep:`562` - 模組 __getattr__ 和 __dir__" -#: ../../reference/datamodel.rst:2340 +#: ../../reference/datamodel.rst:2352 msgid "Describes the ``__getattr__`` and ``__dir__`` functions on modules." msgstr "" -#: ../../reference/datamodel.rst:2346 +#: ../../reference/datamodel.rst:2358 msgid "Implementing Descriptors" -msgstr "" +msgstr "實作描述器" -#: ../../reference/datamodel.rst:2348 +#: ../../reference/datamodel.rst:2360 msgid "" "The following methods only apply when an instance of the class containing " "the method (a so-called *descriptor* class) appears in an *owner* class (the " "descriptor must be in either the owner's class dictionary or in the class " "dictionary for one of its parents). In the examples below, \"the " "attribute\" refers to the attribute whose name is the key of the property in " -"the owner class' :attr:`~object.__dict__`." +"the owner class' :attr:`~object.__dict__`. The :class:`object` class itself " +"does not implement any of these protocols." msgstr "" -#: ../../reference/datamodel.rst:2358 +#: ../../reference/datamodel.rst:2370 msgid "" "Called to get the attribute of the owner class (class attribute access) or " "of an instance of that class (instance attribute access). The optional " @@ -2733,13 +2761,13 @@ msgid "" "accessed through the *owner*." msgstr "" -#: ../../reference/datamodel.rst:2364 +#: ../../reference/datamodel.rst:2376 msgid "" "This method should return the computed attribute value or raise an :exc:" "`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:2367 +#: ../../reference/datamodel.rst:2379 msgid "" ":PEP:`252` specifies that :meth:`__get__` is callable with one or two " "arguments. Python's own built-in descriptors support this specification; " @@ -2749,31 +2777,31 @@ msgid "" "not." msgstr "" -#: ../../reference/datamodel.rst:2376 +#: ../../reference/datamodel.rst:2388 msgid "" "Called to set the attribute on an instance *instance* of the owner class to " "a new value, *value*." msgstr "" -#: ../../reference/datamodel.rst:2379 +#: ../../reference/datamodel.rst:2391 msgid "" "Note, adding :meth:`__set__` or :meth:`__delete__` changes the kind of " "descriptor to a \"data descriptor\". See :ref:`descriptor-invocation` for " "more details." msgstr "" -#: ../../reference/datamodel.rst:2385 +#: ../../reference/datamodel.rst:2397 msgid "" "Called to delete the attribute on an instance *instance* of the owner class." msgstr "" -#: ../../reference/datamodel.rst:2387 +#: ../../reference/datamodel.rst:2399 msgid "" "Instances of descriptors may also have the :attr:`!__objclass__` attribute " "present:" msgstr "" -#: ../../reference/datamodel.rst:2392 +#: ../../reference/datamodel.rst:2404 msgid "" "The attribute :attr:`!__objclass__` is interpreted by the :mod:`inspect` " "module as specifying the class where this object was defined (setting this " @@ -2784,11 +2812,11 @@ msgid "" "are implemented in C)." msgstr "" -#: ../../reference/datamodel.rst:2403 +#: ../../reference/datamodel.rst:2415 msgid "Invoking Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2405 +#: ../../reference/datamodel.rst:2417 msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " @@ -2797,7 +2825,7 @@ msgid "" "is said to be a descriptor." msgstr "" -#: ../../reference/datamodel.rst:2411 +#: ../../reference/datamodel.rst:2423 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " @@ -2805,7 +2833,7 @@ msgid "" "continuing through the base classes of ``type(a)`` excluding metaclasses." msgstr "" -#: ../../reference/datamodel.rst:2416 +#: ../../reference/datamodel.rst:2428 msgid "" "However, if the looked-up value is an object defining one of the descriptor " "methods, then Python may override the default behavior and invoke the " @@ -2813,54 +2841,54 @@ msgid "" "depends on which descriptor methods were defined and how they were called." msgstr "" -#: ../../reference/datamodel.rst:2421 +#: ../../reference/datamodel.rst:2433 msgid "" "The starting point for descriptor invocation is a binding, ``a.x``. How the " "arguments are assembled depends on ``a``:" msgstr "" -#: ../../reference/datamodel.rst:2424 +#: ../../reference/datamodel.rst:2436 msgid "Direct Call" -msgstr "" +msgstr "直接呼叫" -#: ../../reference/datamodel.rst:2425 +#: ../../reference/datamodel.rst:2437 msgid "" "The simplest and least common call is when user code directly invokes a " "descriptor method: ``x.__get__(a)``." msgstr "" -#: ../../reference/datamodel.rst:2428 +#: ../../reference/datamodel.rst:2440 msgid "Instance Binding" msgstr "" -#: ../../reference/datamodel.rst:2429 +#: ../../reference/datamodel.rst:2441 msgid "" "If binding to an object instance, ``a.x`` is transformed into the call: " "``type(a).__dict__['x'].__get__(a, type(a))``." msgstr "" -#: ../../reference/datamodel.rst:2432 +#: ../../reference/datamodel.rst:2444 msgid "Class Binding" msgstr "" -#: ../../reference/datamodel.rst:2433 +#: ../../reference/datamodel.rst:2445 msgid "" "If binding to a class, ``A.x`` is transformed into the call: ``A." "__dict__['x'].__get__(None, A)``." msgstr "" -#: ../../reference/datamodel.rst:2436 +#: ../../reference/datamodel.rst:2448 msgid "Super Binding" msgstr "" -#: ../../reference/datamodel.rst:2437 +#: ../../reference/datamodel.rst:2449 msgid "" "A dotted lookup such as ``super(A, a).x`` searches ``a.__class__.__mro__`` " "for a base class ``B`` following ``A`` and then returns ``B.__dict__['x']." "__get__(a, A)``. If not a descriptor, ``x`` is returned unchanged." msgstr "" -#: ../../reference/datamodel.rst:2474 +#: ../../reference/datamodel.rst:2486 msgid "" "For instance bindings, the precedence of descriptor invocation depends on " "which descriptor methods are defined. A descriptor can define any " @@ -2878,7 +2906,7 @@ msgid "" "instances." msgstr "" -#: ../../reference/datamodel.rst:2489 +#: ../../reference/datamodel.rst:2501 msgid "" "Python methods (including those decorated with :func:`@staticmethod " "` and :func:`@classmethod `) are implemented as " @@ -2887,30 +2915,30 @@ msgid "" "from other instances of the same class." msgstr "" -#: ../../reference/datamodel.rst:2495 +#: ../../reference/datamodel.rst:2507 msgid "" "The :func:`property` function is implemented as a data descriptor. " "Accordingly, instances cannot override the behavior of a property." msgstr "" -#: ../../reference/datamodel.rst:2502 +#: ../../reference/datamodel.rst:2514 msgid "__slots__" msgstr "__slots__" -#: ../../reference/datamodel.rst:2504 +#: ../../reference/datamodel.rst:2516 msgid "" "*__slots__* allow us to explicitly declare data members (like properties) " "and deny the creation of :attr:`~object.__dict__` and *__weakref__* (unless " "explicitly declared in *__slots__* or available in a parent.)" msgstr "" -#: ../../reference/datamodel.rst:2508 +#: ../../reference/datamodel.rst:2520 msgid "" "The space saved over using :attr:`~object.__dict__` can be significant. " "Attribute lookup speed can be significantly improved as well." msgstr "" -#: ../../reference/datamodel.rst:2513 +#: ../../reference/datamodel.rst:2525 msgid "" "This class variable can be assigned a string, iterable, or sequence of " "strings with variable names used by instances. *__slots__* reserves space " @@ -2918,18 +2946,18 @@ msgid "" "`~object.__dict__` and *__weakref__* for each instance." msgstr "" -#: ../../reference/datamodel.rst:2522 +#: ../../reference/datamodel.rst:2534 msgid "Notes on using *__slots__*:" msgstr "" -#: ../../reference/datamodel.rst:2524 +#: ../../reference/datamodel.rst:2536 msgid "" "When inheriting from a class without *__slots__*, the :attr:`~object." "__dict__` and *__weakref__* attribute of the instances will always be " "accessible." msgstr "" -#: ../../reference/datamodel.rst:2528 +#: ../../reference/datamodel.rst:2540 msgid "" "Without a :attr:`~object.__dict__` variable, instances cannot be assigned " "new variables not listed in the *__slots__* definition. Attempts to assign " @@ -2938,7 +2966,7 @@ msgid "" "sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2535 +#: ../../reference/datamodel.rst:2547 msgid "" "Without a *__weakref__* variable for each instance, classes defining " "*__slots__* do not support :mod:`weak references ` to its " @@ -2946,7 +2974,7 @@ msgid "" "to the sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2541 +#: ../../reference/datamodel.rst:2553 msgid "" "*__slots__* are implemented at the class level by creating :ref:`descriptors " "` for each variable name. As a result, class attributes cannot " @@ -2954,7 +2982,7 @@ msgid "" "otherwise, the class attribute would overwrite the descriptor assignment." msgstr "" -#: ../../reference/datamodel.rst:2547 +#: ../../reference/datamodel.rst:2559 msgid "" "The action of a *__slots__* declaration is not limited to the class where it " "is defined. *__slots__* declared in parents are available in child classes. " @@ -2963,7 +2991,7 @@ msgid "" "only contain names of any *additional* slots)." msgstr "" -#: ../../reference/datamodel.rst:2553 +#: ../../reference/datamodel.rst:2565 msgid "" "If a class defines a slot also defined in a base class, the instance " "variable defined by the base class slot is inaccessible (except by " @@ -2972,7 +3000,7 @@ msgid "" "prevent this." msgstr "" -#: ../../reference/datamodel.rst:2558 +#: ../../reference/datamodel.rst:2570 msgid "" ":exc:`TypeError` will be raised if nonempty *__slots__* are defined for a " "class derived from a :c:member:`\"variable-length\" built-in type " @@ -2980,11 +3008,11 @@ msgid "" "`tuple`." msgstr "" -#: ../../reference/datamodel.rst:2563 +#: ../../reference/datamodel.rst:2575 msgid "Any non-string :term:`iterable` may be assigned to *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2565 +#: ../../reference/datamodel.rst:2577 msgid "" "If a :class:`dictionary ` is used to assign *__slots__*, the " "dictionary keys will be used as the slot names. The values of the dictionary " @@ -2992,13 +3020,13 @@ msgid "" "func:`inspect.getdoc` and displayed in the output of :func:`help`." msgstr "" -#: ../../reference/datamodel.rst:2570 +#: ../../reference/datamodel.rst:2582 msgid "" ":attr:`~object.__class__` assignment works only if both classes have the " "same *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2573 +#: ../../reference/datamodel.rst:2585 msgid "" ":ref:`Multiple inheritance ` with multiple slotted parent " "classes can be used, but only one parent is allowed to have attributes " @@ -3006,18 +3034,18 @@ msgid "" "raise :exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:2579 +#: ../../reference/datamodel.rst:2591 msgid "" "If an :term:`iterator` is used for *__slots__* then a :term:`descriptor` is " "created for each of the iterator's values. However, the *__slots__* " "attribute will be an empty iterator." msgstr "" -#: ../../reference/datamodel.rst:2587 +#: ../../reference/datamodel.rst:2599 msgid "Customizing class creation" msgstr "" -#: ../../reference/datamodel.rst:2589 +#: ../../reference/datamodel.rst:2601 msgid "" "Whenever a class inherits from another class, :meth:`~object." "__init_subclass__` is called on the parent class. This way, it is possible " @@ -3027,14 +3055,14 @@ msgid "" "future subclasses of the class defining the method." msgstr "" -#: ../../reference/datamodel.rst:2598 +#: ../../reference/datamodel.rst:2610 msgid "" "This method is called whenever the containing class is subclassed. *cls* is " "then the new subclass. If defined as a normal instance method, this method " "is implicitly converted to a class method." msgstr "" -#: ../../reference/datamodel.rst:2602 +#: ../../reference/datamodel.rst:2614 msgid "" "Keyword arguments which are given to a new class are passed to the parent " "class's ``__init_subclass__``. For compatibility with other classes using " @@ -3042,7 +3070,7 @@ msgid "" "pass the others over to the base class, as in::" msgstr "" -#: ../../reference/datamodel.rst:2608 +#: ../../reference/datamodel.rst:2620 msgid "" "class Philosopher:\n" " def __init_subclass__(cls, /, default_name, **kwargs):\n" @@ -3060,13 +3088,13 @@ msgstr "" "class AustralianPhilosopher(Philosopher, default_name=\"Bruce\"):\n" " pass" -#: ../../reference/datamodel.rst:2616 +#: ../../reference/datamodel.rst:2628 msgid "" "The default implementation ``object.__init_subclass__`` does nothing, but " "raises an error if it is called with any arguments." msgstr "" -#: ../../reference/datamodel.rst:2621 +#: ../../reference/datamodel.rst:2633 msgid "" "The metaclass hint ``metaclass`` is consumed by the rest of the type " "machinery, and is never passed to ``__init_subclass__`` implementations. The " @@ -3074,19 +3102,19 @@ msgid "" "``type(cls)``." msgstr "" -#: ../../reference/datamodel.rst:2629 +#: ../../reference/datamodel.rst:2641 msgid "" "When a class is created, :meth:`type.__new__` scans the class variables and " "makes callbacks to those with a :meth:`~object.__set_name__` hook." msgstr "" -#: ../../reference/datamodel.rst:2634 +#: ../../reference/datamodel.rst:2646 msgid "" "Automatically called at the time the owning class *owner* is created. The " "object has been assigned to *name* in that class::" msgstr "" -#: ../../reference/datamodel.rst:2637 +#: ../../reference/datamodel.rst:2649 msgid "" "class A:\n" " x = C() # Automatically calls: x.__set_name__(A, 'x')" @@ -3094,14 +3122,14 @@ msgstr "" "class A:\n" " x = C() # 自動呼叫:x.__set_name__(A, 'x')" -#: ../../reference/datamodel.rst:2640 +#: ../../reference/datamodel.rst:2652 msgid "" "If the class variable is assigned after the class is created, :meth:" "`__set_name__` will not be called automatically. If needed, :meth:" "`__set_name__` can be called directly::" msgstr "" -#: ../../reference/datamodel.rst:2644 +#: ../../reference/datamodel.rst:2656 msgid "" "class A:\n" " pass\n" @@ -3111,22 +3139,22 @@ msgid "" "c.__set_name__(A, 'x') # Manually invoke the hook" msgstr "" -#: ../../reference/datamodel.rst:2651 +#: ../../reference/datamodel.rst:2663 msgid "See :ref:`class-object-creation` for more details." msgstr "更多細節請見 :ref:`class-object-creation`。" -#: ../../reference/datamodel.rst:2659 +#: ../../reference/datamodel.rst:2671 msgid "Metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2666 +#: ../../reference/datamodel.rst:2678 msgid "" "By default, classes are constructed using :func:`type`. The class body is " "executed in a new namespace and the class name is bound locally to the " "result of ``type(name, bases, namespace)``." msgstr "" -#: ../../reference/datamodel.rst:2670 +#: ../../reference/datamodel.rst:2682 msgid "" "The class creation process can be customized by passing the ``metaclass`` " "keyword argument in the class definition line, or by inheriting from an " @@ -3134,7 +3162,7 @@ msgid "" "both ``MyClass`` and ``MySubclass`` are instances of ``Meta``::" msgstr "" -#: ../../reference/datamodel.rst:2675 +#: ../../reference/datamodel.rst:2687 msgid "" "class Meta(type):\n" " pass\n" @@ -3154,41 +3182,41 @@ msgstr "" "class MySubclass(MyClass):\n" " pass" -#: ../../reference/datamodel.rst:2684 +#: ../../reference/datamodel.rst:2696 msgid "" "Any other keyword arguments that are specified in the class definition are " "passed through to all metaclass operations described below." msgstr "" -#: ../../reference/datamodel.rst:2687 +#: ../../reference/datamodel.rst:2699 msgid "When a class definition is executed, the following steps occur:" msgstr "" -#: ../../reference/datamodel.rst:2689 +#: ../../reference/datamodel.rst:2701 msgid "MRO entries are resolved;" msgstr "" -#: ../../reference/datamodel.rst:2690 +#: ../../reference/datamodel.rst:2702 msgid "the appropriate metaclass is determined;" msgstr "" -#: ../../reference/datamodel.rst:2691 +#: ../../reference/datamodel.rst:2703 msgid "the class namespace is prepared;" msgstr "" -#: ../../reference/datamodel.rst:2692 +#: ../../reference/datamodel.rst:2704 msgid "the class body is executed;" msgstr "" -#: ../../reference/datamodel.rst:2693 +#: ../../reference/datamodel.rst:2705 msgid "the class object is created." msgstr "" -#: ../../reference/datamodel.rst:2697 +#: ../../reference/datamodel.rst:2709 msgid "Resolving MRO entries" msgstr "" -#: ../../reference/datamodel.rst:2701 +#: ../../reference/datamodel.rst:2713 msgid "" "If a base that appears in a class definition is not an instance of :class:" "`type`, then an :meth:`!__mro_entries__` method is searched on the base. If " @@ -3200,59 +3228,59 @@ msgid "" "is ignored." msgstr "" -#: ../../reference/datamodel.rst:2712 +#: ../../reference/datamodel.rst:2724 msgid ":func:`types.resolve_bases`" msgstr ":func:`types.resolve_bases`" -#: ../../reference/datamodel.rst:2713 +#: ../../reference/datamodel.rst:2725 msgid "Dynamically resolve bases that are not instances of :class:`type`." msgstr "" -#: ../../reference/datamodel.rst:2715 +#: ../../reference/datamodel.rst:2727 msgid ":func:`types.get_original_bases`" msgstr ":func:`types.get_original_bases`" -#: ../../reference/datamodel.rst:2716 +#: ../../reference/datamodel.rst:2728 msgid "" "Retrieve a class's \"original bases\" prior to modifications by :meth:" "`~object.__mro_entries__`." msgstr "" -#: ../../reference/datamodel.rst:2719 +#: ../../reference/datamodel.rst:2731 msgid ":pep:`560`" msgstr ":pep:`560`" -#: ../../reference/datamodel.rst:2720 +#: ../../reference/datamodel.rst:2732 msgid "Core support for typing module and generic types." msgstr "" -#: ../../reference/datamodel.rst:2724 +#: ../../reference/datamodel.rst:2736 msgid "Determining the appropriate metaclass" msgstr "" -#: ../../reference/datamodel.rst:2728 +#: ../../reference/datamodel.rst:2740 msgid "" "The appropriate metaclass for a class definition is determined as follows:" msgstr "" -#: ../../reference/datamodel.rst:2730 +#: ../../reference/datamodel.rst:2742 msgid "" "if no bases and no explicit metaclass are given, then :func:`type` is used;" msgstr "" -#: ../../reference/datamodel.rst:2731 +#: ../../reference/datamodel.rst:2743 msgid "" "if an explicit metaclass is given and it is *not* an instance of :func:" "`type`, then it is used directly as the metaclass;" msgstr "" -#: ../../reference/datamodel.rst:2733 +#: ../../reference/datamodel.rst:2745 msgid "" "if an instance of :func:`type` is given as the explicit metaclass, or bases " "are defined, then the most derived metaclass is used." msgstr "" -#: ../../reference/datamodel.rst:2736 +#: ../../reference/datamodel.rst:2748 msgid "" "The most derived metaclass is selected from the explicitly specified " "metaclass (if any) and the metaclasses (i.e. ``type(cls)``) of all specified " @@ -3261,11 +3289,11 @@ msgid "" "that criterion, then the class definition will fail with ``TypeError``." msgstr "" -#: ../../reference/datamodel.rst:2746 +#: ../../reference/datamodel.rst:2758 msgid "Preparing the class namespace" msgstr "" -#: ../../reference/datamodel.rst:2751 +#: ../../reference/datamodel.rst:2763 msgid "" "Once the appropriate metaclass has been identified, then the class namespace " "is prepared. If the metaclass has a ``__prepare__`` attribute, it is called " @@ -3277,25 +3305,25 @@ msgid "" "copied into a new ``dict``." msgstr "" -#: ../../reference/datamodel.rst:2760 +#: ../../reference/datamodel.rst:2772 msgid "" "If the metaclass has no ``__prepare__`` attribute, then the class namespace " "is initialised as an empty ordered mapping." msgstr "" -#: ../../reference/datamodel.rst:2765 +#: ../../reference/datamodel.rst:2777 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/datamodel.rst:2766 +#: ../../reference/datamodel.rst:2778 msgid "Introduced the ``__prepare__`` namespace hook" msgstr "" -#: ../../reference/datamodel.rst:2770 +#: ../../reference/datamodel.rst:2782 msgid "Executing the class body" msgstr "" -#: ../../reference/datamodel.rst:2775 +#: ../../reference/datamodel.rst:2787 msgid "" "The class body is executed (approximately) as ``exec(body, globals(), " "namespace)``. The key difference from a normal call to :func:`exec` is that " @@ -3304,7 +3332,7 @@ msgid "" "inside a function." msgstr "" -#: ../../reference/datamodel.rst:2781 +#: ../../reference/datamodel.rst:2793 msgid "" "However, even when the class definition occurs inside the function, methods " "defined inside the class still cannot see names defined at the class scope. " @@ -3313,11 +3341,11 @@ msgid "" "reference described in the next section." msgstr "" -#: ../../reference/datamodel.rst:2790 +#: ../../reference/datamodel.rst:2802 msgid "Creating the class object" msgstr "" -#: ../../reference/datamodel.rst:2797 +#: ../../reference/datamodel.rst:2809 msgid "" "Once the class namespace has been populated by executing the class body, the " "class object is created by calling ``metaclass(name, bases, namespace, " @@ -3325,7 +3353,7 @@ msgid "" "to ``__prepare__``)." msgstr "" -#: ../../reference/datamodel.rst:2802 +#: ../../reference/datamodel.rst:2814 msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " @@ -3336,7 +3364,7 @@ msgid "" "is identified based on the first argument passed to the method." msgstr "" -#: ../../reference/datamodel.rst:2812 +#: ../../reference/datamodel.rst:2824 msgid "" "In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass " "as a ``__classcell__`` entry in the class namespace. If present, this must " @@ -3345,39 +3373,39 @@ msgid "" "in Python 3.8." msgstr "" -#: ../../reference/datamodel.rst:2818 +#: ../../reference/datamodel.rst:2830 msgid "" "When using the default metaclass :class:`type`, or any metaclass that " "ultimately calls ``type.__new__``, the following additional customization " "steps are invoked after creating the class object:" msgstr "" -#: ../../reference/datamodel.rst:2822 +#: ../../reference/datamodel.rst:2834 msgid "" "The ``type.__new__`` method collects all of the attributes in the class " "namespace that define a :meth:`~object.__set_name__` method;" msgstr "" -#: ../../reference/datamodel.rst:2824 +#: ../../reference/datamodel.rst:2836 msgid "" "Those ``__set_name__`` methods are called with the class being defined and " "the assigned name of that particular attribute;" msgstr "" -#: ../../reference/datamodel.rst:2826 +#: ../../reference/datamodel.rst:2838 msgid "" "The :meth:`~object.__init_subclass__` hook is called on the immediate parent " "of the new class in its method resolution order." msgstr "" -#: ../../reference/datamodel.rst:2829 +#: ../../reference/datamodel.rst:2841 msgid "" "After the class object is created, it is passed to the class decorators " "included in the class definition (if any) and the resulting object is bound " "in the local namespace as the defined class." msgstr "" -#: ../../reference/datamodel.rst:2833 +#: ../../reference/datamodel.rst:2845 msgid "" "When a new class is created by ``type.__new__``, the object provided as the " "namespace parameter is copied to a new ordered mapping and the original " @@ -3385,19 +3413,19 @@ msgid "" "becomes the :attr:`~type.__dict__` attribute of the class object." msgstr "" -#: ../../reference/datamodel.rst:2840 +#: ../../reference/datamodel.rst:2852 msgid ":pep:`3135` - New super" msgstr "" -#: ../../reference/datamodel.rst:2841 +#: ../../reference/datamodel.rst:2853 msgid "Describes the implicit ``__class__`` closure reference" msgstr "" -#: ../../reference/datamodel.rst:2845 +#: ../../reference/datamodel.rst:2857 msgid "Uses for metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2847 +#: ../../reference/datamodel.rst:2859 msgid "" "The potential uses for metaclasses are boundless. Some ideas that have been " "explored include enum, logging, interface checking, automatic delegation, " @@ -3405,17 +3433,17 @@ msgid "" "locking/synchronization." msgstr "" -#: ../../reference/datamodel.rst:2854 +#: ../../reference/datamodel.rst:2866 msgid "Customizing instance and subclass checks" msgstr "" -#: ../../reference/datamodel.rst:2856 +#: ../../reference/datamodel.rst:2868 msgid "" "The following methods are used to override the default behavior of the :func:" "`isinstance` and :func:`issubclass` built-in functions." msgstr "" -#: ../../reference/datamodel.rst:2859 +#: ../../reference/datamodel.rst:2871 msgid "" "In particular, the metaclass :class:`abc.ABCMeta` implements these methods " "in order to allow the addition of Abstract Base Classes (ABCs) as \"virtual " @@ -3423,21 +3451,21 @@ msgid "" "other ABCs." msgstr "" -#: ../../reference/datamodel.rst:2866 +#: ../../reference/datamodel.rst:2878 msgid "" "Return true if *instance* should be considered a (direct or indirect) " "instance of *class*. If defined, called to implement ``isinstance(instance, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2873 +#: ../../reference/datamodel.rst:2885 msgid "" "Return true if *subclass* should be considered a (direct or indirect) " "subclass of *class*. If defined, called to implement ``issubclass(subclass, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2878 +#: ../../reference/datamodel.rst:2890 msgid "" "Note that these methods are looked up on the type (metaclass) of a class. " "They cannot be defined as class methods in the actual class. This is " @@ -3445,11 +3473,11 @@ msgid "" "only in this case the instance is itself a class." msgstr "" -#: ../../reference/datamodel.rst:2885 +#: ../../reference/datamodel.rst:2897 msgid ":pep:`3119` - Introducing Abstract Base Classes" msgstr "" -#: ../../reference/datamodel.rst:2886 +#: ../../reference/datamodel.rst:2898 msgid "" "Includes the specification for customizing :func:`isinstance` and :func:" "`issubclass` behavior through :meth:`~type.__instancecheck__` and :meth:" @@ -3458,11 +3486,11 @@ msgid "" "language." msgstr "" -#: ../../reference/datamodel.rst:2894 +#: ../../reference/datamodel.rst:2906 msgid "Emulating generic types" msgstr "" -#: ../../reference/datamodel.rst:2896 +#: ../../reference/datamodel.rst:2908 msgid "" "When using :term:`type annotations`, it is often useful to " "*parameterize* a :term:`generic type` using Python's square-brackets " @@ -3470,65 +3498,65 @@ msgid "" "a :class:`list` in which all the elements are of type :class:`int`." msgstr "" -#: ../../reference/datamodel.rst:2903 +#: ../../reference/datamodel.rst:2915 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/datamodel.rst:2904 +#: ../../reference/datamodel.rst:2916 msgid "Introducing Python's framework for type annotations" msgstr "" -#: ../../reference/datamodel.rst:2906 +#: ../../reference/datamodel.rst:2918 msgid ":ref:`Generic Alias Types`" msgstr ":ref:`泛型別名型別 `" -#: ../../reference/datamodel.rst:2907 +#: ../../reference/datamodel.rst:2919 msgid "Documentation for objects representing parameterized generic classes" msgstr "" -#: ../../reference/datamodel.rst:2909 +#: ../../reference/datamodel.rst:2921 msgid "" ":ref:`Generics`, :ref:`user-defined generics` and :" "class:`typing.Generic`" msgstr "" -#: ../../reference/datamodel.rst:2910 +#: ../../reference/datamodel.rst:2922 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" -#: ../../reference/datamodel.rst:2913 +#: ../../reference/datamodel.rst:2925 msgid "" "A class can *generally* only be parameterized if it defines the special " "class method ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2918 +#: ../../reference/datamodel.rst:2930 msgid "" "Return an object representing the specialization of a generic class by type " "arguments found in *key*." msgstr "" -#: ../../reference/datamodel.rst:2921 +#: ../../reference/datamodel.rst:2933 msgid "" "When defined on a class, ``__class_getitem__()`` is automatically a class " "method. As such, there is no need for it to be decorated with :func:" "`@classmethod` when it is defined." msgstr "" -#: ../../reference/datamodel.rst:2927 +#: ../../reference/datamodel.rst:2939 msgid "The purpose of *__class_getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2929 +#: ../../reference/datamodel.rst:2941 msgid "" "The purpose of :meth:`~object.__class_getitem__` is to allow runtime " "parameterization of standard-library generic classes in order to more easily " "apply :term:`type hints` to these classes." msgstr "" -#: ../../reference/datamodel.rst:2933 +#: ../../reference/datamodel.rst:2945 msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " @@ -3537,7 +3565,7 @@ msgid "" "own implementation of ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2939 +#: ../../reference/datamodel.rst:2951 msgid "" "Custom implementations of :meth:`~object.__class_getitem__` on classes " "defined outside of the standard library may not be understood by third-party " @@ -3545,11 +3573,11 @@ msgid "" "purposes other than type hinting is discouraged." msgstr "" -#: ../../reference/datamodel.rst:2949 +#: ../../reference/datamodel.rst:2961 msgid "*__class_getitem__* versus *__getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2951 +#: ../../reference/datamodel.rst:2963 msgid "" "Usually, the :ref:`subscription` of an object using square " "brackets will call the :meth:`~object.__getitem__` instance method defined " @@ -3559,14 +3587,14 @@ msgid "" "genericalias>` object if it is properly defined." msgstr "" -#: ../../reference/datamodel.rst:2958 +#: ../../reference/datamodel.rst:2970 msgid "" "Presented with the :term:`expression` ``obj[x]``, the Python interpreter " "follows something like the following process to decide whether :meth:" "`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" msgstr "" -#: ../../reference/datamodel.rst:2963 +#: ../../reference/datamodel.rst:2975 msgid "" "from inspect import isclass\n" "\n" @@ -3592,7 +3620,7 @@ msgid "" " )" msgstr "" -#: ../../reference/datamodel.rst:2986 +#: ../../reference/datamodel.rst:2998 msgid "" "In Python, all classes are themselves instances of other classes. The class " "of a class is known as that class's :term:`metaclass`, and most classes have " @@ -3602,7 +3630,7 @@ msgid "" "__class_getitem__` being called::" msgstr "" -#: ../../reference/datamodel.rst:2993 +#: ../../reference/datamodel.rst:3005 msgid "" ">>> # list has class \"type\" as its metaclass, like most classes:\n" ">>> type(list)\n" @@ -3617,14 +3645,14 @@ msgid "" "" msgstr "" -#: ../../reference/datamodel.rst:3005 +#: ../../reference/datamodel.rst:3017 msgid "" "However, if a class has a custom metaclass that defines :meth:`~object." "__getitem__`, subscribing the class may result in different behaviour. An " "example of this can be found in the :mod:`enum` module::" msgstr "" -#: ../../reference/datamodel.rst:3009 +#: ../../reference/datamodel.rst:3021 msgid "" ">>> from enum import Enum\n" ">>> class Menu(Enum):\n" @@ -3644,43 +3672,44 @@ msgid "" "" msgstr "" -#: ../../reference/datamodel.rst:3028 +#: ../../reference/datamodel.rst:3040 msgid ":pep:`560` - Core Support for typing module and generic types" msgstr "" -#: ../../reference/datamodel.rst:3029 +#: ../../reference/datamodel.rst:3041 msgid "" "Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" "`subscription` results in ``__class_getitem__()`` being " "called instead of :meth:`~object.__getitem__`" msgstr "" -#: ../../reference/datamodel.rst:3037 +#: ../../reference/datamodel.rst:3049 msgid "Emulating callable objects" msgstr "" -#: ../../reference/datamodel.rst:3044 +#: ../../reference/datamodel.rst:3056 msgid "" "Called when the instance is \"called\" as a function; if this method is " "defined, ``x(arg1, arg2, ...)`` roughly translates to ``type(x).__call__(x, " -"arg1, ...)``." +"arg1, ...)``. The :class:`object` class itself does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:3051 +#: ../../reference/datamodel.rst:3064 msgid "Emulating container types" msgstr "" -#: ../../reference/datamodel.rst:3053 +#: ../../reference/datamodel.rst:3066 msgid "" -"The following methods can be defined to implement container objects. " -"Containers usually are :term:`sequences ` (such as :class:`lists " -"` or :class:`tuples `) or :term:`mappings ` (like :" -"class:`dictionaries `), but can represent other containers as well. " -"The first set of methods is used either to emulate a sequence or to emulate " -"a mapping; the difference is that for a sequence, the allowable keys should " -"be the integers *k* for which ``0 <= k < N`` where *N* is the length of the " -"sequence, or :class:`slice` objects, which define a range of items. It is " -"also recommended that mappings provide the methods :meth:`!keys`, :meth:`!" +"The following methods can be defined to implement container objects. None of " +"them are provided by the :class:`object` class itself. Containers usually " +"are :term:`sequences ` (such as :class:`lists ` or :class:" +"`tuples `) or :term:`mappings ` (like :term:`dictionaries " +"`), but can represent other containers as well. The first set " +"of methods is used either to emulate a sequence or to emulate a mapping; the " +"difference is that for a sequence, the allowable keys should be the integers " +"*k* for which ``0 <= k < N`` where *N* is the length of the sequence, or :" +"class:`slice` objects, which define a range of items. It is also " +"recommended that mappings provide the methods :meth:`!keys`, :meth:`!" "values`, :meth:`!items`, :meth:`!get`, :meth:`!clear`, :meth:`!setdefault`, :" "meth:`!pop`, :meth:`!popitem`, :meth:`!copy`, and :meth:`!update` behaving " "similar to those for Python's standard :class:`dictionary ` objects. " @@ -3706,7 +3735,7 @@ msgid "" "should iterate through the values." msgstr "" -#: ../../reference/datamodel.rst:3094 +#: ../../reference/datamodel.rst:3108 msgid "" "Called to implement the built-in function :func:`len`. Should return the " "length of the object, an integer ``>=`` 0. Also, an object that doesn't " @@ -3714,7 +3743,7 @@ msgid "" "returns zero is considered to be false in a Boolean context." msgstr "" -#: ../../reference/datamodel.rst:3101 +#: ../../reference/datamodel.rst:3115 msgid "" "In CPython, the length is required to be at most :data:`sys.maxsize`. If the " "length is larger than :data:`!sys.maxsize` some features (such as :func:" @@ -3723,7 +3752,7 @@ msgid "" "`~object.__bool__` method." msgstr "" -#: ../../reference/datamodel.rst:3110 +#: ../../reference/datamodel.rst:3124 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " @@ -3733,28 +3762,28 @@ msgid "" "never required for correctness." msgstr "" -#: ../../reference/datamodel.rst:3124 +#: ../../reference/datamodel.rst:3138 msgid "" "Slicing is done exclusively with the following three methods. A call like ::" msgstr "" -#: ../../reference/datamodel.rst:3126 +#: ../../reference/datamodel.rst:3140 msgid "a[1:2] = b" msgstr "a[1:2] = b" -#: ../../reference/datamodel.rst:3128 +#: ../../reference/datamodel.rst:3142 msgid "is translated to ::" msgstr "" -#: ../../reference/datamodel.rst:3130 +#: ../../reference/datamodel.rst:3144 msgid "a[slice(1, 2, None)] = b" msgstr "a[slice(1, 2, None)] = b" -#: ../../reference/datamodel.rst:3132 +#: ../../reference/datamodel.rst:3146 msgid "and so forth. Missing slice items are always filled in with ``None``." msgstr "" -#: ../../reference/datamodel.rst:3137 +#: ../../reference/datamodel.rst:3151 msgid "" "Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " "the accepted keys should be integers. Optionally, they may support :class:" @@ -3766,20 +3795,20 @@ msgid "" "`KeyError` should be raised." msgstr "" -#: ../../reference/datamodel.rst:3149 +#: ../../reference/datamodel.rst:3163 msgid "" ":keyword:`for` loops expect that an :exc:`IndexError` will be raised for " "illegal indexes to allow proper detection of the end of the sequence." msgstr "" -#: ../../reference/datamodel.rst:3154 +#: ../../reference/datamodel.rst:3168 msgid "" "When :ref:`subscripting` a *class*, the special class method :" "meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " "See :ref:`classgetitem-versus-getitem` for more details." msgstr "" -#: ../../reference/datamodel.rst:3162 +#: ../../reference/datamodel.rst:3176 msgid "" "Called to implement assignment to ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3788,7 +3817,7 @@ msgid "" "for improper *key* values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:3171 +#: ../../reference/datamodel.rst:3185 msgid "" "Called to implement deletion of ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3797,13 +3826,13 @@ msgid "" "values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:3180 +#: ../../reference/datamodel.rst:3194 msgid "" "Called by :class:`dict`\\ .\\ :meth:`__getitem__` to implement ``self[key]`` " "for dict subclasses when key is not in the dictionary." msgstr "" -#: ../../reference/datamodel.rst:3186 +#: ../../reference/datamodel.rst:3200 msgid "" "This method is called when an :term:`iterator` is required for a container. " "This method should return a new iterator object that can iterate over all " @@ -3811,14 +3840,14 @@ msgid "" "of the container." msgstr "" -#: ../../reference/datamodel.rst:3194 +#: ../../reference/datamodel.rst:3208 msgid "" "Called (if present) by the :func:`reversed` built-in to implement reverse " "iteration. It should return a new iterator object that iterates over all " "the objects in the container in reverse order." msgstr "" -#: ../../reference/datamodel.rst:3198 +#: ../../reference/datamodel.rst:3212 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " "built-in will fall back to using the sequence protocol (:meth:`__len__` and :" @@ -3827,7 +3856,7 @@ msgid "" "more efficient than the one provided by :func:`reversed`." msgstr "" -#: ../../reference/datamodel.rst:3205 +#: ../../reference/datamodel.rst:3219 msgid "" "The membership test operators (:keyword:`in` and :keyword:`not in`) are " "normally implemented as an iteration through a container. However, container " @@ -3835,14 +3864,14 @@ msgid "" "implementation, which also does not require the object be iterable." msgstr "" -#: ../../reference/datamodel.rst:3212 +#: ../../reference/datamodel.rst:3226 msgid "" "Called to implement membership test operators. Should return true if *item* " "is in *self*, false otherwise. For mapping objects, this should consider " "the keys of the mapping rather than the values or the key-item pairs." msgstr "" -#: ../../reference/datamodel.rst:3216 +#: ../../reference/datamodel.rst:3230 msgid "" "For objects that don't define :meth:`__contains__`, the membership test " "first tries iteration via :meth:`__iter__`, then the old sequence iteration " @@ -3850,11 +3879,11 @@ msgid "" "reference `." msgstr "" -#: ../../reference/datamodel.rst:3225 +#: ../../reference/datamodel.rst:3239 msgid "Emulating numeric types" msgstr "" -#: ../../reference/datamodel.rst:3227 +#: ../../reference/datamodel.rst:3241 msgid "" "The following methods can be defined to emulate numeric objects. Methods " "corresponding to operations that are not supported by the particular kind of " @@ -3862,7 +3891,7 @@ msgid "" "should be left undefined." msgstr "" -#: ../../reference/datamodel.rst:3253 +#: ../../reference/datamodel.rst:3267 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3876,13 +3905,13 @@ msgid "" "function is to be supported." msgstr "" -#: ../../reference/datamodel.rst:3264 +#: ../../reference/datamodel.rst:3278 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return :data:`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3287 +#: ../../reference/datamodel.rst:3301 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3895,13 +3924,13 @@ msgid "" "`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3299 +#: ../../reference/datamodel.rst:3313 msgid "" "Note that ternary :func:`pow` will not try calling :meth:`__rpow__` (the " "coercion rules would become too complicated)." msgstr "" -#: ../../reference/datamodel.rst:3304 +#: ../../reference/datamodel.rst:3318 msgid "" "If the right operand's type is a subclass of the left operand's type and " "that subclass provides a different implementation of the reflected method " @@ -3910,7 +3939,7 @@ msgid "" "ancestors' operations." msgstr "" -#: ../../reference/datamodel.rst:3325 +#: ../../reference/datamodel.rst:3339 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -3928,19 +3957,19 @@ msgid "" "data model." msgstr "" -#: ../../reference/datamodel.rst:3348 +#: ../../reference/datamodel.rst:3362 msgid "" "Called to implement the unary arithmetic operations (``-``, ``+``, :func:" "`abs` and ``~``)." msgstr "" -#: ../../reference/datamodel.rst:3361 +#: ../../reference/datamodel.rst:3375 msgid "" "Called to implement the built-in functions :func:`complex`, :func:`int` and :" "func:`float`. Should return a value of the appropriate type." msgstr "" -#: ../../reference/datamodel.rst:3368 +#: ../../reference/datamodel.rst:3382 msgid "" "Called to implement :func:`operator.index`, and whenever Python needs to " "losslessly convert the numeric object to an integer object (such as in " @@ -3949,14 +3978,14 @@ msgid "" "integer type. Must return an integer." msgstr "" -#: ../../reference/datamodel.rst:3374 +#: ../../reference/datamodel.rst:3388 msgid "" "If :meth:`__int__`, :meth:`__float__` and :meth:`__complex__` are not " "defined then corresponding built-in functions :func:`int`, :func:`float` " "and :func:`complex` fall back to :meth:`__index__`." msgstr "" -#: ../../reference/datamodel.rst:3386 +#: ../../reference/datamodel.rst:3400 msgid "" "Called to implement the built-in function :func:`round` and :mod:`math` " "functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`. " @@ -3965,21 +3994,21 @@ msgid "" "(typically an :class:`int`)." msgstr "" -#: ../../reference/datamodel.rst:3392 +#: ../../reference/datamodel.rst:3406 msgid "" "The built-in function :func:`int` falls back to :meth:`__trunc__` if " "neither :meth:`__int__` nor :meth:`__index__` is defined." msgstr "" -#: ../../reference/datamodel.rst:3395 +#: ../../reference/datamodel.rst:3409 msgid "The delegation of :func:`int` to :meth:`__trunc__` is deprecated." msgstr "" -#: ../../reference/datamodel.rst:3402 +#: ../../reference/datamodel.rst:3416 msgid "With Statement Context Managers" msgstr "With 陳述式的情境管理器" -#: ../../reference/datamodel.rst:3404 +#: ../../reference/datamodel.rst:3418 msgid "" "A :dfn:`context manager` is an object that defines the runtime context to be " "established when executing a :keyword:`with` statement. The context manager " @@ -3989,32 +4018,34 @@ msgid "" "can also be used by directly invoking their methods." msgstr "" -#: ../../reference/datamodel.rst:3415 +#: ../../reference/datamodel.rst:3429 msgid "" "Typical uses of context managers include saving and restoring various kinds " "of global state, locking and unlocking resources, closing opened files, etc." msgstr "" -#: ../../reference/datamodel.rst:3418 +#: ../../reference/datamodel.rst:3432 msgid "" -"For more information on context managers, see :ref:`typecontextmanager`." +"For more information on context managers, see :ref:`typecontextmanager`. " +"The :class:`object` class itself does not provide the context manager " +"methods." msgstr "" -#: ../../reference/datamodel.rst:3423 +#: ../../reference/datamodel.rst:3438 msgid "" "Enter the runtime context related to this object. The :keyword:`with` " "statement will bind this method's return value to the target(s) specified in " "the :keyword:`!as` clause of the statement, if any." msgstr "" -#: ../../reference/datamodel.rst:3430 +#: ../../reference/datamodel.rst:3445 msgid "" "Exit the runtime context related to this object. The parameters describe the " "exception that caused the context to be exited. If the context was exited " "without an exception, all three arguments will be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:3434 +#: ../../reference/datamodel.rst:3449 msgid "" "If an exception is supplied, and the method wishes to suppress the exception " "(i.e., prevent it from being propagated), it should return a true value. " @@ -4022,27 +4053,27 @@ msgid "" "method." msgstr "" -#: ../../reference/datamodel.rst:3438 +#: ../../reference/datamodel.rst:3453 msgid "" "Note that :meth:`~object.__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" -#: ../../reference/datamodel.rst:3444 +#: ../../reference/datamodel.rst:3459 msgid ":pep:`343` - The \"with\" statement" msgstr ":pep:`343` - \"with\" 陳述式" -#: ../../reference/datamodel.rst:3445 +#: ../../reference/datamodel.rst:3460 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3452 +#: ../../reference/datamodel.rst:3467 msgid "Customizing positional arguments in class pattern matching" msgstr "" -#: ../../reference/datamodel.rst:3454 +#: ../../reference/datamodel.rst:3469 msgid "" "When using a class name in a pattern, positional arguments in the pattern " "are not allowed by default, i.e. ``case MyClass(x, y)`` is typically invalid " @@ -4050,7 +4081,7 @@ msgid "" "pattern, the class needs to define a *__match_args__* attribute." msgstr "" -#: ../../reference/datamodel.rst:3461 +#: ../../reference/datamodel.rst:3476 msgid "" "This class variable can be assigned a tuple of strings. When this class is " "used in a class pattern with positional arguments, each positional argument " @@ -4059,7 +4090,7 @@ msgid "" "to setting it to ``()``." msgstr "" -#: ../../reference/datamodel.rst:3467 +#: ../../reference/datamodel.rst:3482 msgid "" "For example, if ``MyClass.__match_args__`` is ``(\"left\", \"center\", " "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " @@ -4069,19 +4100,19 @@ msgid "" "exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:3477 +#: ../../reference/datamodel.rst:3492 msgid ":pep:`634` - Structural Pattern Matching" msgstr "" -#: ../../reference/datamodel.rst:3478 +#: ../../reference/datamodel.rst:3493 msgid "The specification for the Python ``match`` statement." msgstr "" -#: ../../reference/datamodel.rst:3484 +#: ../../reference/datamodel.rst:3499 msgid "Emulating buffer types" msgstr "" -#: ../../reference/datamodel.rst:3486 +#: ../../reference/datamodel.rst:3501 msgid "" "The :ref:`buffer protocol ` provides a way for Python objects " "to expose efficient access to a low-level memory array. This protocol is " @@ -4089,13 +4120,13 @@ msgid "" "and third-party libraries may define additional buffer types." msgstr "" -#: ../../reference/datamodel.rst:3491 +#: ../../reference/datamodel.rst:3506 msgid "" "While buffer types are usually implemented in C, it is also possible to " "implement the protocol in Python." msgstr "" -#: ../../reference/datamodel.rst:3496 +#: ../../reference/datamodel.rst:3511 msgid "" "Called when a buffer is requested from *self* (for example, by the :class:" "`memoryview` constructor). The *flags* argument is an integer representing " @@ -4105,7 +4136,7 @@ msgid "" "`memoryview` object." msgstr "" -#: ../../reference/datamodel.rst:3505 +#: ../../reference/datamodel.rst:3520 msgid "" "Called when a buffer is no longer needed. The *buffer* argument is a :class:" "`memoryview` object that was previously returned by :meth:`~object." @@ -4114,28 +4145,28 @@ msgid "" "to perform any cleanup are not required to implement this method." msgstr "" -#: ../../reference/datamodel.rst:3516 +#: ../../reference/datamodel.rst:3531 msgid ":pep:`688` - Making the buffer protocol accessible in Python" msgstr "" -#: ../../reference/datamodel.rst:3517 +#: ../../reference/datamodel.rst:3532 msgid "" "Introduces the Python ``__buffer__`` and ``__release_buffer__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3519 +#: ../../reference/datamodel.rst:3534 msgid ":class:`collections.abc.Buffer`" msgstr ":class:`collections.abc.Buffer`" -#: ../../reference/datamodel.rst:3520 +#: ../../reference/datamodel.rst:3535 msgid "ABC for buffer types." msgstr "" -#: ../../reference/datamodel.rst:3525 +#: ../../reference/datamodel.rst:3540 msgid "Special method lookup" msgstr "" -#: ../../reference/datamodel.rst:3527 +#: ../../reference/datamodel.rst:3542 msgid "" "For custom classes, implicit invocations of special methods are only " "guaranteed to work correctly if defined on an object's type, not in the " @@ -4143,7 +4174,7 @@ msgid "" "following code raises an exception::" msgstr "" -#: ../../reference/datamodel.rst:3532 +#: ../../reference/datamodel.rst:3547 msgid "" ">>> class C:\n" "... pass\n" @@ -4165,7 +4196,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: object of type 'C' has no len()" -#: ../../reference/datamodel.rst:3542 +#: ../../reference/datamodel.rst:3557 msgid "" "The rationale behind this behaviour lies with a number of special methods " "such as :meth:`~object.__hash__` and :meth:`~object.__repr__` that are " @@ -4174,7 +4205,7 @@ msgid "" "invoked on the type object itself::" msgstr "" -#: ../../reference/datamodel.rst:3549 +#: ../../reference/datamodel.rst:3564 msgid "" ">>> 1 .__hash__() == hash(1)\n" "True\n" @@ -4190,14 +4221,14 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: descriptor '__hash__' of 'int' object needs an argument" -#: ../../reference/datamodel.rst:3556 +#: ../../reference/datamodel.rst:3571 msgid "" "Incorrectly attempting to invoke an unbound method of a class in this way is " "sometimes referred to as 'metaclass confusion', and is avoided by bypassing " "the instance when looking up special methods::" msgstr "" -#: ../../reference/datamodel.rst:3560 +#: ../../reference/datamodel.rst:3575 msgid "" ">>> type(1).__hash__(1) == hash(1)\n" "True\n" @@ -4209,14 +4240,14 @@ msgstr "" ">>> type(int).__hash__(int) == hash(int)\n" "True" -#: ../../reference/datamodel.rst:3565 +#: ../../reference/datamodel.rst:3580 msgid "" "In addition to bypassing any instance attributes in the interest of " "correctness, implicit special method lookup generally also bypasses the :" "meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" -#: ../../reference/datamodel.rst:3569 +#: ../../reference/datamodel.rst:3584 msgid "" ">>> class Meta(type):\n" "... def __getattribute__(*args):\n" @@ -4241,7 +4272,7 @@ msgid "" "10" msgstr "" -#: ../../reference/datamodel.rst:3591 +#: ../../reference/datamodel.rst:3606 msgid "" "Bypassing the :meth:`~object.__getattribute__` machinery in this fashion " "provides significant scope for speed optimisations within the interpreter, " @@ -4250,36 +4281,37 @@ msgid "" "consistently invoked by the interpreter)." msgstr "" -#: ../../reference/datamodel.rst:3602 +#: ../../reference/datamodel.rst:3617 msgid "Coroutines" msgstr "協程" -#: ../../reference/datamodel.rst:3606 +#: ../../reference/datamodel.rst:3621 msgid "Awaitable Objects" msgstr "" -#: ../../reference/datamodel.rst:3608 +#: ../../reference/datamodel.rst:3623 msgid "" "An :term:`awaitable` object generally implements an :meth:`~object." "__await__` method. :term:`Coroutine objects ` returned from :" "keyword:`async def` functions are awaitable." msgstr "" -#: ../../reference/datamodel.rst:3614 +#: ../../reference/datamodel.rst:3629 msgid "" "The :term:`generator iterator` objects returned from generators decorated " "with :func:`types.coroutine` are also awaitable, but they do not implement :" "meth:`~object.__await__`." msgstr "" -#: ../../reference/datamodel.rst:3620 +#: ../../reference/datamodel.rst:3635 msgid "" "Must return an :term:`iterator`. Should be used to implement :term:" "`awaitable` objects. For instance, :class:`asyncio.Future` implements this " -"method to be compatible with the :keyword:`await` expression." +"method to be compatible with the :keyword:`await` expression. The :class:" +"`object` class itself is not awaitable and does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:3626 +#: ../../reference/datamodel.rst:3643 msgid "" "The language doesn't place any restriction on the type or value of the " "objects yielded by the iterator returned by ``__await__``, as this is " @@ -4287,15 +4319,15 @@ msgid "" "g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." msgstr "" -#: ../../reference/datamodel.rst:3634 +#: ../../reference/datamodel.rst:3651 msgid ":pep:`492` for additional information about awaitable objects." msgstr "" -#: ../../reference/datamodel.rst:3640 +#: ../../reference/datamodel.rst:3657 msgid "Coroutine Objects" -msgstr "" +msgstr "協程物件" -#: ../../reference/datamodel.rst:3642 +#: ../../reference/datamodel.rst:3659 msgid "" ":term:`Coroutine objects ` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`~object.__await__` " @@ -4306,18 +4338,18 @@ msgid "" "should not directly raise unhandled :exc:`StopIteration` exceptions." msgstr "" -#: ../../reference/datamodel.rst:3650 +#: ../../reference/datamodel.rst:3667 msgid "" "Coroutines also have the methods listed below, which are analogous to those " "of generators (see :ref:`generator-methods`). However, unlike generators, " "coroutines do not directly support iteration." msgstr "" -#: ../../reference/datamodel.rst:3654 +#: ../../reference/datamodel.rst:3671 msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" -#: ../../reference/datamodel.rst:3660 +#: ../../reference/datamodel.rst:3677 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " "is equivalent to advancing the iterator returned by :meth:`~object." @@ -4328,7 +4360,7 @@ msgid "" "value, described above." msgstr "" -#: ../../reference/datamodel.rst:3671 +#: ../../reference/datamodel.rst:3688 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " @@ -4339,13 +4371,13 @@ msgid "" "not caught in the coroutine, it propagates back to the caller." msgstr "" -#: ../../reference/datamodel.rst:3682 +#: ../../reference/datamodel.rst:3699 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" -#: ../../reference/datamodel.rst:3687 +#: ../../reference/datamodel.rst:3704 msgid "" "Causes the coroutine to clean itself up and exit. If the coroutine is " "suspended, this method first delegates to the :meth:`~generator.close` " @@ -4355,42 +4387,46 @@ msgid "" "is marked as having finished executing, even if it was never started." msgstr "" -#: ../../reference/datamodel.rst:3695 +#: ../../reference/datamodel.rst:3712 msgid "" "Coroutine objects are automatically closed using the above process when they " "are about to be destroyed." msgstr "" -#: ../../reference/datamodel.rst:3701 +#: ../../reference/datamodel.rst:3718 msgid "Asynchronous Iterators" msgstr "" -#: ../../reference/datamodel.rst:3703 +#: ../../reference/datamodel.rst:3720 msgid "" "An *asynchronous iterator* can call asynchronous code in its ``__anext__`` " "method." msgstr "" -#: ../../reference/datamodel.rst:3706 +#: ../../reference/datamodel.rst:3723 msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "" -#: ../../reference/datamodel.rst:3710 +#: ../../reference/datamodel.rst:3725 ../../reference/datamodel.rst:3774 +msgid "The :class:`object` class itself does not provide these methods." +msgstr "" + +#: ../../reference/datamodel.rst:3730 msgid "Must return an *asynchronous iterator* object." msgstr "" -#: ../../reference/datamodel.rst:3714 +#: ../../reference/datamodel.rst:3734 msgid "" "Must return an *awaitable* resulting in a next value of the iterator. " "Should raise a :exc:`StopAsyncIteration` error when the iteration is over." msgstr "" -#: ../../reference/datamodel.rst:3717 +#: ../../reference/datamodel.rst:3737 msgid "An example of an asynchronous iterable object::" msgstr "" -#: ../../reference/datamodel.rst:3719 +#: ../../reference/datamodel.rst:3739 msgid "" "class Reader:\n" " async def readline(self):\n" @@ -4418,53 +4454,53 @@ msgstr "" " raise StopAsyncIteration\n" " return val" -#: ../../reference/datamodel.rst:3734 +#: ../../reference/datamodel.rst:3754 msgid "" "Prior to Python 3.7, :meth:`~object.__aiter__` could return an *awaitable* " "that would resolve to an :term:`asynchronous iterator `." msgstr "" -#: ../../reference/datamodel.rst:3739 +#: ../../reference/datamodel.rst:3759 msgid "" "Starting with Python 3.7, :meth:`~object.__aiter__` must return an " "asynchronous iterator object. Returning anything else will result in a :exc:" "`TypeError` error." msgstr "" -#: ../../reference/datamodel.rst:3747 +#: ../../reference/datamodel.rst:3767 msgid "Asynchronous Context Managers" msgstr "" -#: ../../reference/datamodel.rst:3749 +#: ../../reference/datamodel.rst:3769 msgid "" "An *asynchronous context manager* is a *context manager* that is able to " "suspend execution in its ``__aenter__`` and ``__aexit__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3752 +#: ../../reference/datamodel.rst:3772 msgid "" "Asynchronous context managers can be used in an :keyword:`async with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3756 +#: ../../reference/datamodel.rst:3778 msgid "" "Semantically similar to :meth:`~object.__enter__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3761 +#: ../../reference/datamodel.rst:3783 msgid "" "Semantically similar to :meth:`~object.__exit__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3764 +#: ../../reference/datamodel.rst:3786 msgid "An example of an asynchronous context manager class::" msgstr "" -#: ../../reference/datamodel.rst:3766 +#: ../../reference/datamodel.rst:3788 msgid "" "class AsyncContextManager:\n" " async def __aenter__(self):\n" @@ -4480,18 +4516,18 @@ msgstr "" " async def __aexit__(self, exc_type, exc, tb):\n" " await log('exiting context')" -#: ../../reference/datamodel.rst:3777 +#: ../../reference/datamodel.rst:3799 msgid "Footnotes" msgstr "註解" -#: ../../reference/datamodel.rst:3778 +#: ../../reference/datamodel.rst:3800 msgid "" "It *is* possible in some cases to change an object's type, under certain " "controlled conditions. It generally isn't a good idea though, since it can " "lead to some very strange behaviour if it is handled incorrectly." msgstr "" -#: ../../reference/datamodel.rst:3782 +#: ../../reference/datamodel.rst:3804 msgid "" "The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." "__reversed__`, :meth:`~object.__contains__`, :meth:`~object." @@ -4500,7 +4536,7 @@ msgid "" "by relying on the behavior that ``None`` is not callable." msgstr "" -#: ../../reference/datamodel.rst:3789 +#: ../../reference/datamodel.rst:3811 msgid "" "\"Does not support\" here means that the class has no such method, or the " "method returns :data:`NotImplemented`. Do not set the method to ``None`` if " @@ -4508,7 +4544,7 @@ msgid "" "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" -#: ../../reference/datamodel.rst:3795 +#: ../../reference/datamodel.rst:3817 msgid "" "For operands of the same type, it is assumed that if the non-reflected " "method -- such as :meth:`~object.__add__` -- fails then the overall " @@ -4531,7 +4567,7 @@ msgstr "" #: ../../reference/datamodel.rst:1265 ../../reference/datamodel.rst:1292 #: ../../reference/datamodel.rst:1364 ../../reference/datamodel.rst:1472 #: ../../reference/datamodel.rst:1581 ../../reference/datamodel.rst:1691 -#: ../../reference/datamodel.rst:2105 ../../reference/datamodel.rst:3120 +#: ../../reference/datamodel.rst:2116 ../../reference/datamodel.rst:3134 msgid "object" msgstr "object(物件)" @@ -4543,12 +4579,12 @@ msgstr "data(資料)" #: ../../reference/datamodel.rst:343 ../../reference/datamodel.rst:427 #: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:799 #: ../../reference/datamodel.rst:1321 ../../reference/datamodel.rst:1774 -#: ../../reference/datamodel.rst:2016 ../../reference/datamodel.rst:2021 -#: ../../reference/datamodel.rst:2105 ../../reference/datamodel.rst:2661 -#: ../../reference/datamodel.rst:3090 ../../reference/datamodel.rst:3248 -#: ../../reference/datamodel.rst:3283 ../../reference/datamodel.rst:3297 -#: ../../reference/datamodel.rst:3346 ../../reference/datamodel.rst:3356 -#: ../../reference/datamodel.rst:3384 +#: ../../reference/datamodel.rst:2017 ../../reference/datamodel.rst:2023 +#: ../../reference/datamodel.rst:2116 ../../reference/datamodel.rst:2673 +#: ../../reference/datamodel.rst:3104 ../../reference/datamodel.rst:3262 +#: ../../reference/datamodel.rst:3297 ../../reference/datamodel.rst:3311 +#: ../../reference/datamodel.rst:3360 ../../reference/datamodel.rst:3370 +#: ../../reference/datamodel.rst:3398 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -4557,7 +4593,7 @@ msgid "id" msgstr "id" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:126 -#: ../../reference/datamodel.rst:2661 +#: ../../reference/datamodel.rst:2673 msgid "type" msgstr "type(型別)" @@ -4681,12 +4717,12 @@ msgstr "number(數字)" msgid "Java" msgstr "Java" -#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3356 +#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3370 msgid "complex" msgstr "complex(複數)" #: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:427 -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:3090 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:3104 msgid "len" msgstr "len" @@ -4719,8 +4755,8 @@ msgstr "immutable sequence(不可變序列)" msgid "immutable" msgstr "immutable(不可變)" -#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1991 -#: ../../reference/datamodel.rst:2021 +#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1992 +#: ../../reference/datamodel.rst:2023 msgid "string" msgstr "string(字串)" @@ -4756,7 +4792,7 @@ msgstr "singleton(單例)" msgid "empty" msgstr "empty(空的)" -#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:2016 +#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:2017 msgid "bytes" msgstr "bytes(位元組)" @@ -4779,7 +4815,7 @@ msgstr "assignment(賦值)" #: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:859 #: ../../reference/datamodel.rst:1728 ../../reference/datamodel.rst:1910 -#: ../../reference/datamodel.rst:3411 +#: ../../reference/datamodel.rst:3425 msgid "statement" msgstr "statement(陳述式)" @@ -4816,7 +4852,7 @@ msgid "mapping" msgstr "mapping(對映)" #: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:1126 -#: ../../reference/datamodel.rst:2105 +#: ../../reference/datamodel.rst:2116 msgid "dictionary" msgstr "dictionary(字典)" @@ -4839,7 +4875,7 @@ msgid "function" msgstr "function (函式)" #: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:1126 -#: ../../reference/datamodel.rst:1149 ../../reference/datamodel.rst:3042 +#: ../../reference/datamodel.rst:1149 ../../reference/datamodel.rst:3054 msgid "call" msgstr "call(呼叫)" @@ -4947,7 +4983,7 @@ msgstr "generator(產生器)" msgid "iterator" msgstr "itorator(疊代器)" -#: ../../reference/datamodel.rst:761 ../../reference/datamodel.rst:3598 +#: ../../reference/datamodel.rst:761 ../../reference/datamodel.rst:3613 msgid "coroutine" msgstr "coroutine(協程)" @@ -5013,7 +5049,7 @@ msgstr "__dict__ (模組屬性)" #: ../../reference/datamodel.rst:1126 ../../reference/datamodel.rst:1144 #: ../../reference/datamodel.rst:1265 ../../reference/datamodel.rst:1893 -#: ../../reference/datamodel.rst:2772 +#: ../../reference/datamodel.rst:2784 msgid "class" msgstr "class(類別)" @@ -5023,7 +5059,7 @@ msgid "class instance" msgstr "class instance(類別實例)" #: ../../reference/datamodel.rst:1126 ../../reference/datamodel.rst:1265 -#: ../../reference/datamodel.rst:3042 +#: ../../reference/datamodel.rst:3054 msgid "instance" msgstr "instance(實例)" @@ -5319,7 +5355,7 @@ msgstr "try" msgid "tb_next (traceback attribute)" msgstr "tb_next (traceback 屬性)" -#: ../../reference/datamodel.rst:1774 ../../reference/datamodel.rst:3120 +#: ../../reference/datamodel.rst:1774 ../../reference/datamodel.rst:3134 msgid "slice" msgstr "slice(切片)" @@ -5379,152 +5415,119 @@ msgstr "repr() (內建函式)" msgid "__repr__() (object method)" msgstr "__repr__() (物件方法)" -#: ../../reference/datamodel.rst:1991 +#: ../../reference/datamodel.rst:1992 msgid "__str__() (object method)" msgstr "__str__() (物件方法)" -#: ../../reference/datamodel.rst:1991 +#: ../../reference/datamodel.rst:1992 msgid "format() (built-in function)" msgstr "format() (內建函式)" -#: ../../reference/datamodel.rst:1991 +#: ../../reference/datamodel.rst:1992 msgid "print() (built-in function)" msgstr "print() (內建函式)" -#: ../../reference/datamodel.rst:2021 +#: ../../reference/datamodel.rst:2023 msgid "__format__() (object method)" msgstr "__format__() (物件方法)" -#: ../../reference/datamodel.rst:2021 +#: ../../reference/datamodel.rst:2023 msgid "conversion" msgstr "conversion" -#: ../../reference/datamodel.rst:2021 +#: ../../reference/datamodel.rst:2023 msgid "print" msgstr "print" -#: ../../reference/datamodel.rst:2060 +#: ../../reference/datamodel.rst:2065 msgid "comparisons" msgstr "comparison(比較)" -#: ../../reference/datamodel.rst:2105 +#: ../../reference/datamodel.rst:2116 msgid "hash" msgstr "hash(雜湊)" -#: ../../reference/datamodel.rst:2186 +#: ../../reference/datamodel.rst:2197 msgid "__len__() (mapping object method)" msgstr "__len__() (對映物件方法)" -#: ../../reference/datamodel.rst:2290 +#: ../../reference/datamodel.rst:2302 msgid "__getattr__ (module attribute)" msgstr "__getattr__ (模組屬性)" -#: ../../reference/datamodel.rst:2290 +#: ../../reference/datamodel.rst:2302 msgid "__dir__ (module attribute)" msgstr "__dir__ (模組屬性)" -#: ../../reference/datamodel.rst:2290 +#: ../../reference/datamodel.rst:2302 msgid "__class__ (module attribute)" msgstr "__class__ (模組屬性)" -#: ../../reference/datamodel.rst:2661 +#: ../../reference/datamodel.rst:2673 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../reference/datamodel.rst:2661 +#: ../../reference/datamodel.rst:2673 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/datamodel.rst:2661 +#: ../../reference/datamodel.rst:2673 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/datamodel.rst:2725 +#: ../../reference/datamodel.rst:2737 msgid "metaclass hint" msgstr "metaclass hint(元類別提示)" -#: ../../reference/datamodel.rst:2748 +#: ../../reference/datamodel.rst:2760 msgid "__prepare__ (metaclass method)" msgstr "__prepare__ (元類別方法)" -#: ../../reference/datamodel.rst:2772 +#: ../../reference/datamodel.rst:2784 msgid "body" msgstr "body" -#: ../../reference/datamodel.rst:2792 +#: ../../reference/datamodel.rst:2804 msgid "__class__ (method cell)" msgstr "__class__ (方法 cell)" -#: ../../reference/datamodel.rst:2792 +#: ../../reference/datamodel.rst:2804 msgid "__classcell__ (class namespace entry)" msgstr "__classcell__ (類別命名空間項目)" -#: ../../reference/datamodel.rst:3090 +#: ../../reference/datamodel.rst:3104 msgid "__bool__() (object method)" msgstr "__bool__() (物件方法)" -#: ../../reference/datamodel.rst:3248 ../../reference/datamodel.rst:3283 +#: ../../reference/datamodel.rst:3262 ../../reference/datamodel.rst:3297 msgid "divmod" msgstr "divmod" -#: ../../reference/datamodel.rst:3248 ../../reference/datamodel.rst:3283 -#: ../../reference/datamodel.rst:3297 +#: ../../reference/datamodel.rst:3262 ../../reference/datamodel.rst:3297 +#: ../../reference/datamodel.rst:3311 msgid "pow" msgstr "pow" -#: ../../reference/datamodel.rst:3346 +#: ../../reference/datamodel.rst:3360 msgid "abs" msgstr "abs" -#: ../../reference/datamodel.rst:3356 +#: ../../reference/datamodel.rst:3370 msgid "int" msgstr "int" -#: ../../reference/datamodel.rst:3356 +#: ../../reference/datamodel.rst:3370 msgid "float" msgstr "float" -#: ../../reference/datamodel.rst:3384 +#: ../../reference/datamodel.rst:3398 msgid "round" msgstr "round" -#: ../../reference/datamodel.rst:3411 +#: ../../reference/datamodel.rst:3425 msgid "with" msgstr "with" -#: ../../reference/datamodel.rst:3411 +#: ../../reference/datamodel.rst:3425 msgid "context manager" msgstr "context manager(情境管理器)" - -#~ msgid ":attr:`__name__`" -#~ msgstr ":attr:`__name__`" - -#~ msgid ":attr:`__doc__`" -#~ msgstr ":attr:`__doc__`" - -#~ msgid ":attr:`__file__`" -#~ msgstr ":attr:`__file__`" - -#~ msgid ":attr:`__annotations__`" -#~ msgstr ":attr:`__annotations__`" - -#~ msgid ":attr:`~definition.__name__`" -#~ msgstr ":attr:`~definition.__name__`" - -#~ msgid ":attr:`__module__`" -#~ msgstr ":attr:`__module__`" - -#~ msgid ":attr:`~object.__dict__`" -#~ msgstr ":attr:`~object.__dict__`" - -#~ msgid ":attr:`~class.__bases__`" -#~ msgstr ":attr:`~class.__bases__`" - -#~ msgid ":attr:`__type_params__`" -#~ msgstr ":attr:`__type_params__`" - -#~ msgid ":attr:`~class.__static_attributes__`" -#~ msgstr ":attr:`~class.__static_attributes__`" - -#~ msgid ":attr:`__firstlineno__`" -#~ msgstr ":attr:`__firstlineno__`" diff --git a/reference/expressions.po b/reference/expressions.po index 48e8693491..a6d34f67a1 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -786,7 +786,7 @@ msgstr "" #: ../../reference/expressions.rst:682 msgid "Asynchronous generator functions" -msgstr "" +msgstr "非同步產生器函式" #: ../../reference/expressions.rst:684 msgid "" @@ -2213,7 +2213,7 @@ msgstr "" #: ../../reference/expressions.rst:1995 msgid "Operator" -msgstr "" +msgstr "運算子" #: ../../reference/expressions.rst:1995 msgid "Description" diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index 13344d6ba7..b4bf143460 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -11,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-14 00:14+0000\n" +"POT-Creation-Date: 2024-10-31 00:13+0000\n" "PO-Revision-Date: 2022-07-24 14:52+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -366,11 +365,11 @@ msgstr "" "Found an even number 8\n" "Found an odd number 9" -#: ../../tutorial/controlflow.rst:201 +#: ../../tutorial/controlflow.rst:202 msgid ":keyword:`!else` Clauses on Loops" msgstr "迴圈的 :keyword:`!else` 子句" -#: ../../tutorial/controlflow.rst:203 +#: ../../tutorial/controlflow.rst:204 msgid "" "In a :keyword:`!for` or :keyword:`!while` loop the :keyword:`!break` " "statement may be paired with an :keyword:`!else` clause. If the loop " @@ -378,20 +377,20 @@ msgid "" "clause executes." msgstr "" -#: ../../tutorial/controlflow.rst:207 +#: ../../tutorial/controlflow.rst:208 msgid "" "In a :keyword:`for` loop, the :keyword:`!else` clause is executed after the " "loop finishes its final iteration, that is, if no break occurred." msgstr "" "在 :keyword:`for` 迴圈中,:keyword:`!else` 子句會在迴圈完成最終的疊代後執行。" -#: ../../tutorial/controlflow.rst:210 +#: ../../tutorial/controlflow.rst:211 msgid "" "In a :keyword:`while` loop, it's executed after the loop's condition becomes " "false." msgstr "在 :keyword:`while` 迴圈中,它會在迴圈條件變為 false 後執行。" -#: ../../tutorial/controlflow.rst:212 +#: ../../tutorial/controlflow.rst:213 msgid "" "In either kind of loop, the :keyword:`!else` clause is **not** executed if " "the loop was terminated by a :keyword:`break`. Of course, other ways of " @@ -402,13 +401,13 @@ msgstr "" "else` 子句。當然其他提早結束迴圈的方式(例如 :keyword:`return` 或引發例外)也" "會跳過 :keyword:`else` 子句的執行。" -#: ../../tutorial/controlflow.rst:217 +#: ../../tutorial/controlflow.rst:218 msgid "" "This is exemplified in the following :keyword:`!for` loop, which searches " "for prime numbers::" msgstr "下面的 :keyword:`!for` 迴圈對此進行了舉例說明,該迴圈用以搜索質數: ::" -#: ../../tutorial/controlflow.rst:220 +#: ../../tutorial/controlflow.rst:221 msgid "" ">>> for n in range(2, 10):\n" "... for x in range(2, n):\n" @@ -429,7 +428,7 @@ msgid "" "9 equals 3 * 3" msgstr "" -#: ../../tutorial/controlflow.rst:238 +#: ../../tutorial/controlflow.rst:239 msgid "" "(Yes, this is the correct code. Look closely: the ``else`` clause belongs " "to the ``for`` loop, **not** the ``if`` statement.)" @@ -437,7 +436,7 @@ msgstr "" "(沒錯,這是正確的程式碼。請看仔細:``else`` 子句屬於 ``for`` 迴圈,**並非** " "``if`` 陳述式。)" -#: ../../tutorial/controlflow.rst:241 +#: ../../tutorial/controlflow.rst:242 msgid "" "One way to think of the else clause is to imagine it paired with the ``if`` " "inside the loop. As the loop executes, it will run a sequence like if/if/if/" @@ -446,7 +445,7 @@ msgid "" "true, the ``else`` clause outside the loop will execute." msgstr "" -#: ../../tutorial/controlflow.rst:247 +#: ../../tutorial/controlflow.rst:248 msgid "" "When used with a loop, the ``else`` clause has more in common with the " "``else`` clause of a :keyword:`try` statement than it does with that of " @@ -461,11 +460,11 @@ msgstr "" "``break`` 發生時執行。更多有關 ``try`` 陳述式和例外的介紹,見\\ :ref:`tut-" "handling`。" -#: ../../tutorial/controlflow.rst:256 +#: ../../tutorial/controlflow.rst:257 msgid ":keyword:`!pass` Statements" msgstr ":keyword:`!pass` 陳述式" -#: ../../tutorial/controlflow.rst:258 +#: ../../tutorial/controlflow.rst:259 msgid "" "The :keyword:`pass` statement does nothing. It can be used when a statement " "is required syntactically but the program requires no action. For example::" @@ -473,18 +472,18 @@ msgstr "" ":keyword:`pass` 陳述式不執行任何動作。它可用在語法上需要一個陳述式但程式不需" "要執行任何動作的時候。例如: ::" -#: ../../tutorial/controlflow.rst:261 +#: ../../tutorial/controlflow.rst:262 msgid "" ">>> while True:\n" "... pass # Busy-wait for keyboard interrupt (Ctrl+C)\n" "..." msgstr "" -#: ../../tutorial/controlflow.rst:265 +#: ../../tutorial/controlflow.rst:266 msgid "This is commonly used for creating minimal classes::" msgstr "這經常用於建立簡單的 class(類別): ::" -#: ../../tutorial/controlflow.rst:267 +#: ../../tutorial/controlflow.rst:268 msgid "" ">>> class MyEmptyClass:\n" "... pass\n" @@ -494,7 +493,7 @@ msgstr "" "... pass\n" "..." -#: ../../tutorial/controlflow.rst:271 +#: ../../tutorial/controlflow.rst:272 msgid "" "Another place :keyword:`pass` can be used is as a place-holder for a " "function or conditional body when you are working on new code, allowing you " @@ -504,18 +503,18 @@ msgstr "" ":keyword:`pass` 亦可作為一個函式或條件判斷主體的預留位置,在你撰寫新的程式碼" "時讓你保持在更抽象的思維層次。:keyword:`!pass` 會直接被忽略: ::" -#: ../../tutorial/controlflow.rst:275 +#: ../../tutorial/controlflow.rst:276 msgid "" ">>> def initlog(*args):\n" "... pass # Remember to implement this!\n" "..." msgstr "" -#: ../../tutorial/controlflow.rst:283 +#: ../../tutorial/controlflow.rst:284 msgid ":keyword:`!match` Statements" msgstr ":keyword:`!match` 陳述式" -#: ../../tutorial/controlflow.rst:285 +#: ../../tutorial/controlflow.rst:286 msgid "" "A :keyword:`match` statement takes an expression and compares its value to " "successive patterns given as one or more case blocks. This is superficially " @@ -531,14 +530,14 @@ msgstr "" "言中的模式匹配 (pattern matching) 更為相近。只有第一個匹配成功的模式會被執" "行,而它也可以將成分(序列元素或物件屬性)從值中提取到變數中。" -#: ../../tutorial/controlflow.rst:293 +#: ../../tutorial/controlflow.rst:294 msgid "" "The simplest form compares a subject value against one or more literals::" msgstr "" "最簡單的形式,是將一個主題值 (subject value) 與一個或多個字面值 (literal) 進" "行比較: ::" -#: ../../tutorial/controlflow.rst:295 +#: ../../tutorial/controlflow.rst:296 msgid "" "def http_error(status):\n" " match status:\n" @@ -562,7 +561,7 @@ msgstr "" " case _:\n" " return \"Something's wrong with the internet\"" -#: ../../tutorial/controlflow.rst:306 +#: ../../tutorial/controlflow.rst:307 msgid "" "Note the last block: the \"variable name\" ``_`` acts as a *wildcard* and " "never fails to match. If no case matches, none of the branches is executed." @@ -570,12 +569,12 @@ msgstr "" "請注意最後一段:「變數名稱」\\ ``_`` 是作為\\ *通用字元 (wildcard)*\\ 的角" "色,且永遠不會匹配失敗。如果沒有 case 匹配成功,則不會執行任何的分支。" -#: ../../tutorial/controlflow.rst:309 +#: ../../tutorial/controlflow.rst:310 msgid "" "You can combine several literals in a single pattern using ``|`` (\"or\")::" msgstr "你可以使用 ``|``\\ (「或」)來將多個字面值組合在單一模式中: ::" -#: ../../tutorial/controlflow.rst:311 +#: ../../tutorial/controlflow.rst:312 msgid "" "case 401 | 403 | 404:\n" " return \"Not allowed\"" @@ -583,14 +582,14 @@ msgstr "" "case 401 | 403 | 404:\n" " return \"Not allowed\"" -#: ../../tutorial/controlflow.rst:314 +#: ../../tutorial/controlflow.rst:315 msgid "" "Patterns can look like unpacking assignments, and can be used to bind " "variables::" msgstr "" "模式可以看起來像是拆解賦值 (unpacking assignment),且可以用來連結變數: ::" -#: ../../tutorial/controlflow.rst:317 +#: ../../tutorial/controlflow.rst:318 msgid "" "# point is an (x, y) tuple\n" "match point:\n" @@ -606,7 +605,7 @@ msgid "" " raise ValueError(\"Not a point\")" msgstr "" -#: ../../tutorial/controlflow.rst:330 +#: ../../tutorial/controlflow.rst:331 msgid "" "Study that one carefully! The first pattern has two literals, and can be " "thought of as an extension of the literal pattern shown above. But the next " @@ -620,7 +619,7 @@ msgstr "" "(bind)* 了來自主題 (``point``) 的一個值。第四個模式會擷取兩個值,這使得它在概" "念上類似於拆解賦值 ``(x, y) = point``。" -#: ../../tutorial/controlflow.rst:337 +#: ../../tutorial/controlflow.rst:338 msgid "" "If you are using classes to structure your data you can use the class name " "followed by an argument list resembling a constructor, but with the ability " @@ -629,7 +628,7 @@ msgstr "" "如果你要用 class 來結構化你的資料,你可以使用該 class 的名稱加上一個引數列" "表,類似一個建構式 (constructor),但它能夠將屬性擷取到變數中: ::" -#: ../../tutorial/controlflow.rst:341 +#: ../../tutorial/controlflow.rst:342 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -667,7 +666,7 @@ msgstr "" " case _:\n" " print(\"Not a point\")" -#: ../../tutorial/controlflow.rst:359 +#: ../../tutorial/controlflow.rst:360 msgid "" "You can use positional parameters with some builtin classes that provide an " "ordering for their attributes (e.g. dataclasses). You can also define a " @@ -681,7 +680,7 @@ msgstr "" "``__match_args__``,來定義模式中屬性們的特定位置。如果它被設定為 (\"x\", " "\"y\"),則以下的模式都是等價的(且都會將屬性 ``y`` 連結到變數 ``var``): ::" -#: ../../tutorial/controlflow.rst:365 +#: ../../tutorial/controlflow.rst:366 msgid "" "Point(1, var)\n" "Point(1, y=var)\n" @@ -693,7 +692,7 @@ msgstr "" "Point(x=1, y=var)\n" "Point(y=var, x=1)" -#: ../../tutorial/controlflow.rst:370 +#: ../../tutorial/controlflow.rst:371 msgid "" "A recommended way to read patterns is to look at them as an extended form of " "what you would put on the left of an assignment, to understand which " @@ -709,7 +708,7 @@ msgstr "" "的 ``x=`` 及 ``y=``)或 class 名稱(由它們後面的 \"(...)\" 被辨識,如上面的 " "``Point``)則永遠無法被賦值。" -#: ../../tutorial/controlflow.rst:377 +#: ../../tutorial/controlflow.rst:378 msgid "" "Patterns can be arbitrarily nested. For example, if we have a short list of " "Points, with ``__match_args__`` added, we could match it like this::" @@ -717,7 +716,7 @@ msgstr "" "模式可以任意地被巢套 (nested)。例如,如果我們有一個由某些點所組成的簡短 " "list,我們就可以像這樣加入 ``__match_args__`` 來對它進行匹配: ::" -#: ../../tutorial/controlflow.rst:380 +#: ../../tutorial/controlflow.rst:381 msgid "" "class Point:\n" " __match_args__ = ('x', 'y')\n" @@ -755,7 +754,7 @@ msgstr "" " case _:\n" " print(\"Something else\")" -#: ../../tutorial/controlflow.rst:398 +#: ../../tutorial/controlflow.rst:399 msgid "" "We can add an ``if`` clause to a pattern, known as a \"guard\". If the " "guard is false, ``match`` goes on to try the next case block. Note that " @@ -765,7 +764,7 @@ msgstr "" "則 ``match`` 會繼續嘗試下一個 case 區塊。請注意,值的擷取會發生在防護的評估之" "前: ::" -#: ../../tutorial/controlflow.rst:402 +#: ../../tutorial/controlflow.rst:403 msgid "" "match point:\n" " case Point(x, y) if x == y:\n" @@ -779,11 +778,11 @@ msgstr "" " case Point(x, y):\n" " print(f\"Not on the diagonal\")" -#: ../../tutorial/controlflow.rst:408 +#: ../../tutorial/controlflow.rst:409 msgid "Several other key features of this statement:" msgstr "此種陳述式的其他幾個重要特色:" -#: ../../tutorial/controlflow.rst:410 +#: ../../tutorial/controlflow.rst:411 msgid "" "Like unpacking assignments, tuple and list patterns have exactly the same " "meaning and actually match arbitrary sequences. An important exception is " @@ -792,7 +791,7 @@ msgstr "" "與拆解賦值的情況類似,tuple(元組)和 list 模式具有完全相同的意義,而且實際上" "可以匹配任意的序列。一個重要的例外,是它們不能匹配疊代器 (iterator) 或字串。" -#: ../../tutorial/controlflow.rst:414 +#: ../../tutorial/controlflow.rst:415 msgid "" "Sequence patterns support extended unpacking: ``[x, y, *rest]`` and ``(x, y, " "*rest)`` work similar to unpacking assignments. The name after ``*`` may " @@ -804,7 +803,7 @@ msgstr "" "``_``,所以 ``(x, y, *_)`` 會匹配一個至少兩項的序列,且不會連結那兩項以外的其" "餘項。" -#: ../../tutorial/controlflow.rst:419 +#: ../../tutorial/controlflow.rst:420 msgid "" "Mapping patterns: ``{\"bandwidth\": b, \"latency\": l}`` captures the " "``\"bandwidth\"`` and ``\"latency\"`` values from a dictionary. Unlike " @@ -816,15 +815,15 @@ msgstr "" "式不同,額外的鍵 (key) 會被忽略。一種像是 ``**rest`` 的拆解方式,也是可被支援" "的。(但 ``**_`` 則是多餘的做法,所以它並不被允許。)" -#: ../../tutorial/controlflow.rst:424 +#: ../../tutorial/controlflow.rst:425 msgid "Subpatterns may be captured using the ``as`` keyword::" msgstr "使用關鍵字 ``as`` 可以擷取子模式 (subpattern): ::" -#: ../../tutorial/controlflow.rst:426 +#: ../../tutorial/controlflow.rst:427 msgid "case (Point(x1, y1), Point(x2, y2) as p2): ..." msgstr "case (Point(x1, y1), Point(x2, y2) as p2): ..." -#: ../../tutorial/controlflow.rst:428 +#: ../../tutorial/controlflow.rst:429 msgid "" "will capture the second element of the input as ``p2`` (as long as the input " "is a sequence of two points)" @@ -832,7 +831,7 @@ msgstr "" "將會擷取輸入的第二個元素作為 ``p2``\\ (只要該輸入是一個由兩個點所組成的序" "列)。" -#: ../../tutorial/controlflow.rst:431 +#: ../../tutorial/controlflow.rst:432 msgid "" "Most literals are compared by equality, however the singletons ``True``, " "``False`` and ``None`` are compared by identity." @@ -840,7 +839,7 @@ msgstr "" "大部分的字面值是藉由相等性 (equality) 來比較,但是單例物件 (singleton) " "``True``、``False`` 和 ``None`` 是藉由標識值 (identity) 來比較。" -#: ../../tutorial/controlflow.rst:434 +#: ../../tutorial/controlflow.rst:435 msgid "" "Patterns may use named constants. These must be dotted names to prevent " "them from being interpreted as capture variable::" @@ -848,7 +847,7 @@ msgstr "" "模式可以使用附名常數 (named constant)。這些模式必須是點分隔名稱,以免它們被解" "釋為擷取變數: ::" -#: ../../tutorial/controlflow.rst:437 +#: ../../tutorial/controlflow.rst:438 msgid "" "from enum import Enum\n" "class Color(Enum):\n" @@ -882,24 +881,24 @@ msgstr "" " case Color.BLUE:\n" " print(\"I'm feeling the blues :(\")" -#: ../../tutorial/controlflow.rst:453 +#: ../../tutorial/controlflow.rst:454 msgid "" "For a more detailed explanation and additional examples, you can look into :" "pep:`636` which is written in a tutorial format." msgstr "" "關於更詳細的解釋和其他範例,你可以閱讀 :pep:`636`,它是以教學的格式編寫而成。" -#: ../../tutorial/controlflow.rst:459 +#: ../../tutorial/controlflow.rst:460 msgid "Defining Functions" msgstr "定義函式 (function)" -#: ../../tutorial/controlflow.rst:461 +#: ../../tutorial/controlflow.rst:462 msgid "" "We can create a function that writes the Fibonacci series to an arbitrary " "boundary::" msgstr "我們可以建立一個函式來產生費式數列到任何一個上界: ::" -#: ../../tutorial/controlflow.rst:464 +#: ../../tutorial/controlflow.rst:465 msgid "" ">>> def fib(n): # write Fibonacci series less than n\n" "... \"\"\"Print a Fibonacci series less than n.\"\"\"\n" @@ -914,7 +913,7 @@ msgid "" "0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597" msgstr "" -#: ../../tutorial/controlflow.rst:481 +#: ../../tutorial/controlflow.rst:482 msgid "" "The keyword :keyword:`def` introduces a function *definition*. It must be " "followed by the function name and the parenthesized list of formal " @@ -924,7 +923,7 @@ msgstr "" "關鍵字 :keyword:`def` 介紹一個函式的\\ *定義*。它之後必須連著該函式的名稱和置" "於括號之中的一串參數。自下一行起,所有縮排的陳述式成為該函式的主體。" -#: ../../tutorial/controlflow.rst:486 +#: ../../tutorial/controlflow.rst:487 msgid "" "The first statement of the function body can optionally be a string literal; " "this string literal is the function's documentation string, or :dfn:" @@ -940,7 +939,7 @@ msgstr "" "件,或讓使用者能以互動的方式在原始碼中瀏覽文件。在原始碼中加入 docstring 是個" "好慣例,應該養成這樣的習慣。" -#: ../../tutorial/controlflow.rst:493 +#: ../../tutorial/controlflow.rst:494 msgid "" "The *execution* of a function introduces a new symbol table used for the " "local variables of the function. More precisely, all variable assignments " @@ -961,7 +960,7 @@ msgstr "" "域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數在 :keyword:" "`nonlocal` 陳述式中被定義)。" -#: ../../tutorial/controlflow.rst:504 +#: ../../tutorial/controlflow.rst:505 msgid "" "The actual parameters (arguments) to a function call are introduced in the " "local symbol table of the called function when it is called; thus, arguments " @@ -975,7 +974,7 @@ msgstr "" "永遠是一個物件的\\ *參照 (reference)*,而不是該物件的值)。 [#]_ 當一個函式呼" "叫別的函式或遞迴呼叫它自己時,在被呼叫的函式中會建立一個新的區域符號表。" -#: ../../tutorial/controlflow.rst:511 +#: ../../tutorial/controlflow.rst:512 msgid "" "A function definition associates the function name with the function object " "in the current symbol table. The interpreter recognizes the object pointed " @@ -986,7 +985,7 @@ msgstr "" "直譯器辨識為使用者自定函式 (user-defined function)。該值可以被指定給別的變數" "名,使該變數名也可以被當作函式使用。這是常見的重新命名方式: ::" -#: ../../tutorial/controlflow.rst:516 +#: ../../tutorial/controlflow.rst:517 msgid "" ">>> fib\n" "\n" @@ -1000,7 +999,7 @@ msgstr "" ">>> f(100)\n" "0 1 1 2 3 5 8 13 21 34 55 89" -#: ../../tutorial/controlflow.rst:522 +#: ../../tutorial/controlflow.rst:523 msgid "" "Coming from other languages, you might object that ``fib`` is not a function " "but a procedure since it doesn't return a value. In fact, even functions " @@ -1015,7 +1014,7 @@ msgstr "" "亦有一個固定的回傳值。這個值稱為 ``None``\\ (它是一個內建名稱)。在直譯器中" "單獨使用 ``None`` 時,通常不會被顯示。你可以使用 :func:`print` 來看到它: ::" -#: ../../tutorial/controlflow.rst:529 +#: ../../tutorial/controlflow.rst:530 msgid "" ">>> fib(0)\n" ">>> print(fib(0))\n" @@ -1025,13 +1024,13 @@ msgstr "" ">>> print(fib(0))\n" "None" -#: ../../tutorial/controlflow.rst:533 +#: ../../tutorial/controlflow.rst:534 msgid "" "It is simple to write a function that returns a list of the numbers of the " "Fibonacci series, instead of printing it::" msgstr "如果要寫一個函式回傳費式數列的 list 而不是直接印出它,這也很容易: ::" -#: ../../tutorial/controlflow.rst:536 +#: ../../tutorial/controlflow.rst:537 msgid "" ">>> def fib2(n): # return Fibonacci series up to n\n" "... \"\"\"Return a list containing the Fibonacci series up to n.\"\"\"\n" @@ -1047,11 +1046,11 @@ msgid "" "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]" msgstr "" -#: ../../tutorial/controlflow.rst:549 +#: ../../tutorial/controlflow.rst:550 msgid "This example, as usual, demonstrates some new Python features:" msgstr "這個例子一樣示範了一些新的 Python 特性:" -#: ../../tutorial/controlflow.rst:551 +#: ../../tutorial/controlflow.rst:552 msgid "" "The :keyword:`return` statement returns with a value from a function. :" "keyword:`!return` without an expression argument returns ``None``. Falling " @@ -1061,7 +1060,7 @@ msgstr "" "不外加一個運算式作為引數時會回傳 ``None``。一個函式執行到結束也會回傳 " "``None``。" -#: ../../tutorial/controlflow.rst:555 +#: ../../tutorial/controlflow.rst:556 msgid "" "The statement ``result.append(a)`` calls a *method* of the list object " "``result``. A method is a function that 'belongs' to an object and is named " @@ -1084,22 +1083,22 @@ msgstr "" "義在 list 物件中;它會在該 list 的末端加入一個新的元素。這個例子等同於 " "``result = result + [a]``,但更有效率。" -#: ../../tutorial/controlflow.rst:570 +#: ../../tutorial/controlflow.rst:571 msgid "More on Defining Functions" msgstr "深入了解函式定義" -#: ../../tutorial/controlflow.rst:572 +#: ../../tutorial/controlflow.rst:573 msgid "" "It is also possible to define functions with a variable number of arguments. " "There are three forms, which can be combined." msgstr "" "定義函式時使用的引數 (argument) 數量是可變的。總共有三種可以組合使用的形式。" -#: ../../tutorial/controlflow.rst:579 +#: ../../tutorial/controlflow.rst:580 msgid "Default Argument Values" msgstr "預設引數值" -#: ../../tutorial/controlflow.rst:581 +#: ../../tutorial/controlflow.rst:582 msgid "" "The most useful form is to specify a default value for one or more " "arguments. This creates a function that can be called with fewer arguments " @@ -1108,7 +1107,7 @@ msgstr "" "為一個或多個引數指定預設值是很有用的方式。函式建立後,可以用比定義時更少的引" "數呼叫該函式。例如: ::" -#: ../../tutorial/controlflow.rst:585 +#: ../../tutorial/controlflow.rst:586 msgid "" "def ask_ok(prompt, retries=4, reminder='Please try again!'):\n" " while True:\n" @@ -1134,22 +1133,22 @@ msgstr "" " raise ValueError('invalid user response')\n" " print(reminder)" -#: ../../tutorial/controlflow.rst:597 +#: ../../tutorial/controlflow.rst:598 msgid "This function can be called in several ways:" msgstr "該函式可以用以下幾種方式被呼叫:" -#: ../../tutorial/controlflow.rst:599 +#: ../../tutorial/controlflow.rst:600 msgid "" "giving only the mandatory argument: ``ask_ok('Do you really want to quit?')``" msgstr "只給必要引數:``ask_ok('Do you really want to quit?')``" -#: ../../tutorial/controlflow.rst:601 +#: ../../tutorial/controlflow.rst:602 msgid "" "giving one of the optional arguments: ``ask_ok('OK to overwrite the file?', " "2)``" msgstr "給予一個選擇性引數:``ask_ok('OK to overwrite the file?', 2)``" -#: ../../tutorial/controlflow.rst:603 +#: ../../tutorial/controlflow.rst:604 msgid "" "or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come " "on, only yes or no!')``" @@ -1157,19 +1156,19 @@ msgstr "" "給予所有引數:``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or " "no!')``" -#: ../../tutorial/controlflow.rst:606 +#: ../../tutorial/controlflow.rst:607 msgid "" "This example also introduces the :keyword:`in` keyword. This tests whether " "or not a sequence contains a certain value." msgstr "此例也使用了關鍵字 :keyword:`in`,用於測試序列中是否包含某個特定值。" -#: ../../tutorial/controlflow.rst:609 +#: ../../tutorial/controlflow.rst:610 msgid "" "The default values are evaluated at the point of function definition in the " "*defining* scope, so that ::" msgstr "預設值是在函式定義當下,於\\ *定義時*\\ 的作用域中求值,所以: ::" -#: ../../tutorial/controlflow.rst:612 +#: ../../tutorial/controlflow.rst:613 msgid "" "i = 5\n" "\n" @@ -1187,11 +1186,11 @@ msgstr "" "i = 6\n" "f()" -#: ../../tutorial/controlflow.rst:620 +#: ../../tutorial/controlflow.rst:621 msgid "will print ``5``." msgstr "將會輸出 ``5``。" -#: ../../tutorial/controlflow.rst:622 +#: ../../tutorial/controlflow.rst:623 msgid "" "**Important warning:** The default value is evaluated only once. This makes " "a difference when the default is a mutable object such as a list, " @@ -1202,7 +1201,7 @@ msgstr "" "(字典)或許多類別實例時,會產生不同的結果。例如,以下函式於後續呼叫時會累積" "曾經傳遞的引數: ::" -#: ../../tutorial/controlflow.rst:627 +#: ../../tutorial/controlflow.rst:628 msgid "" "def f(a, L=[]):\n" " L.append(a)\n" @@ -1220,11 +1219,11 @@ msgstr "" "print(f(2))\n" "print(f(3))" -#: ../../tutorial/controlflow.rst:635 +#: ../../tutorial/controlflow.rst:636 msgid "This will print ::" msgstr "將會輸出: ::" -#: ../../tutorial/controlflow.rst:637 +#: ../../tutorial/controlflow.rst:638 msgid "" "[1]\n" "[1, 2]\n" @@ -1234,13 +1233,13 @@ msgstr "" "[1, 2]\n" "[1, 2, 3]" -#: ../../tutorial/controlflow.rst:641 +#: ../../tutorial/controlflow.rst:642 msgid "" "If you don't want the default to be shared between subsequent calls, you can " "write the function like this instead::" msgstr "如果不想在後續呼叫之間共用預設值,應以如下方式編寫函式:" -#: ../../tutorial/controlflow.rst:644 +#: ../../tutorial/controlflow.rst:645 msgid "" "def f(a, L=None):\n" " if L is None:\n" @@ -1254,11 +1253,11 @@ msgstr "" " L.append(a)\n" " return L" -#: ../../tutorial/controlflow.rst:654 +#: ../../tutorial/controlflow.rst:655 msgid "Keyword Arguments" msgstr "關鍵字引數" -#: ../../tutorial/controlflow.rst:656 +#: ../../tutorial/controlflow.rst:657 msgid "" "Functions can also be called using :term:`keyword arguments ` of the form ``kwarg=value``. For instance, the following " @@ -1267,7 +1266,7 @@ msgstr "" "函式也可以使用\\ :term:`關鍵字引數 `,以 ``kwarg=value`` 的" "形式呼叫。舉例來說,以下函式: ::" -#: ../../tutorial/controlflow.rst:659 +#: ../../tutorial/controlflow.rst:660 msgid "" "def parrot(voltage, state='a stiff', action='http://github.com/voom', type='Norwegian Blue'):\n" " print(\"-- This parrot wouldn't\", action, end=' ')\n" @@ -1281,7 +1280,7 @@ msgstr "" " print(\"-- Lovely plumage, the\", type)\n" " print(\"-- It's\", state, \"!\")" -#: ../../tutorial/controlflow.rst:665 +#: ../../tutorial/controlflow.rst:666 msgid "" "accepts one required argument (``voltage``) and three optional arguments " "(``state``, ``action``, and ``type``). This function can be called in any " @@ -1290,7 +1289,7 @@ msgstr "" "接受一個必要引數 (``voltage``) 和三個選擇性引數 (``state``,``action``,和 " "``type``)。該函式可用下列任一方式呼叫: ::" -#: ../../tutorial/controlflow.rst:669 +#: ../../tutorial/controlflow.rst:670 msgid "" "parrot(1000) # 1 positional " "argument\n" @@ -1303,11 +1302,11 @@ msgid "" "keyword" msgstr "" -#: ../../tutorial/controlflow.rst:676 +#: ../../tutorial/controlflow.rst:677 msgid "but all the following calls would be invalid::" msgstr "但以下呼叫方式都無效: ::" -#: ../../tutorial/controlflow.rst:678 +#: ../../tutorial/controlflow.rst:679 msgid "" "parrot() # required argument missing\n" "parrot(voltage=5.0, 'dead') # non-keyword argument after a keyword " @@ -1316,7 +1315,7 @@ msgid "" "parrot(actor='John Cleese') # unknown keyword argument" msgstr "" -#: ../../tutorial/controlflow.rst:683 +#: ../../tutorial/controlflow.rst:684 msgid "" "In a function call, keyword arguments must follow positional arguments. All " "the keyword arguments passed must match one of the arguments accepted by the " @@ -1332,7 +1331,7 @@ msgstr "" "則也包括必要引數,(\\ ``parrot(voltage=1000)`` 也有效)。一個引數不可多次被" "賦值,下面就是一個因此限制而無效的例子: ::" -#: ../../tutorial/controlflow.rst:691 +#: ../../tutorial/controlflow.rst:692 msgid "" ">>> def function(a):\n" "... pass\n" @@ -1350,7 +1349,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: function() got multiple values for argument 'a'" -#: ../../tutorial/controlflow.rst:699 +#: ../../tutorial/controlflow.rst:700 msgid "" "When a final formal parameter of the form ``**name`` is present, it receives " "a dictionary (see :ref:`typesmapping`) containing all keyword arguments " @@ -1366,7 +1365,7 @@ msgstr "" "個 :ref:`tuple `,該 tuple 包含一般參數以外的位置引數(\\ " "``*name`` 必須出現在 ``**name`` 前面)。例如,若我們定義這樣的函式: ::" -#: ../../tutorial/controlflow.rst:707 +#: ../../tutorial/controlflow.rst:708 msgid "" "def cheeseshop(kind, *arguments, **keywords):\n" " print(\"-- Do you have any\", kind, \"?\")\n" @@ -1386,11 +1385,11 @@ msgstr "" " for kw in keywords:\n" " print(kw, \":\", keywords[kw])" -#: ../../tutorial/controlflow.rst:716 +#: ../../tutorial/controlflow.rst:717 msgid "It could be called like this::" msgstr "它可以被如此呼叫: ::" -#: ../../tutorial/controlflow.rst:718 +#: ../../tutorial/controlflow.rst:719 msgid "" "cheeseshop(\"Limburger\", \"It's very runny, sir.\",\n" " \"It's really very, VERY runny, sir.\",\n" @@ -1404,11 +1403,11 @@ msgstr "" " client=\"John Cleese\",\n" " sketch=\"Cheese Shop Sketch\")" -#: ../../tutorial/controlflow.rst:724 +#: ../../tutorial/controlflow.rst:725 msgid "and of course it would print:" msgstr "輸出結果如下: ::" -#: ../../tutorial/controlflow.rst:726 +#: ../../tutorial/controlflow.rst:727 msgid "" "-- Do you have any Limburger ?\n" "-- I'm sorry, we're all out of Limburger\n" @@ -1428,17 +1427,17 @@ msgstr "" "client : John Cleese\n" "sketch : Cheese Shop Sketch" -#: ../../tutorial/controlflow.rst:737 +#: ../../tutorial/controlflow.rst:738 msgid "" "Note that the order in which the keyword arguments are printed is guaranteed " "to match the order in which they were provided in the function call." msgstr "注意,關鍵字引數的輸出順序與呼叫函式時被提供的順序必定一致。" -#: ../../tutorial/controlflow.rst:741 +#: ../../tutorial/controlflow.rst:742 msgid "Special parameters" msgstr "特殊參數" -#: ../../tutorial/controlflow.rst:743 +#: ../../tutorial/controlflow.rst:744 msgid "" "By default, arguments may be passed to a Python function either by position " "or explicitly by keyword. For readability and performance, it makes sense to " @@ -1450,11 +1449,11 @@ msgstr "" "及效能,限制引數的傳遞方式是合理的,如此,開發者只需查看函式定義,即可確定各" "項目是按位置,按位置或關鍵字,還是按關鍵字傳遞。" -#: ../../tutorial/controlflow.rst:749 +#: ../../tutorial/controlflow.rst:750 msgid "A function definition may look like:" msgstr "函式定義可能如以下樣式:" -#: ../../tutorial/controlflow.rst:751 +#: ../../tutorial/controlflow.rst:752 msgid "" "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):\n" " ----------- ---------- ----------\n" @@ -1470,7 +1469,7 @@ msgstr "" " | - Keyword only\n" " -- Positional only" -#: ../../tutorial/controlflow.rst:760 +#: ../../tutorial/controlflow.rst:761 msgid "" "where ``/`` and ``*`` are optional. If used, these symbols indicate the kind " "of parameter by how the arguments may be passed to the function: positional-" @@ -1481,22 +1480,22 @@ msgstr "" "類:僅限位置、位置或關鍵字、僅限關鍵字。關鍵字參數也稱為附名參數 (named " "parameters)。" -#: ../../tutorial/controlflow.rst:767 +#: ../../tutorial/controlflow.rst:768 msgid "Positional-or-Keyword Arguments" msgstr "位置或關鍵字引數 (Positional-or-Keyword Arguments)" -#: ../../tutorial/controlflow.rst:769 +#: ../../tutorial/controlflow.rst:770 msgid "" "If ``/`` and ``*`` are not present in the function definition, arguments may " "be passed to a function by position or by keyword." msgstr "" "若函式定義中未使用 ``/`` 和 ``*`` 時,引數可以按位置或關鍵字傳遞給函式。" -#: ../../tutorial/controlflow.rst:774 +#: ../../tutorial/controlflow.rst:775 msgid "Positional-Only Parameters" msgstr "僅限位置參數 (Positional-Only Parameters)" -#: ../../tutorial/controlflow.rst:776 +#: ../../tutorial/controlflow.rst:777 msgid "" "Looking at this in a bit more detail, it is possible to mark certain " "parameters as *positional-only*. If *positional-only*, the parameters' order " @@ -1511,17 +1510,17 @@ msgstr "" "``\\ (斜線)之前。``/`` 用於在邏輯上分開僅限位置參數與其餘參數。如果函式定義" "中沒有 ``/``,則表示沒有任何僅限位置參數。" -#: ../../tutorial/controlflow.rst:784 +#: ../../tutorial/controlflow.rst:785 msgid "" "Parameters following the ``/`` may be *positional-or-keyword* or *keyword-" "only*." msgstr "``/`` 後面的參數可以是\\ *位置或關鍵字*\\ 或\\ *僅限關鍵字*\\ 參數。" -#: ../../tutorial/controlflow.rst:788 +#: ../../tutorial/controlflow.rst:789 msgid "Keyword-Only Arguments" msgstr "僅限關鍵字引數 (Keyword-Only Arguments)" -#: ../../tutorial/controlflow.rst:790 +#: ../../tutorial/controlflow.rst:791 msgid "" "To mark parameters as *keyword-only*, indicating the parameters must be " "passed by keyword argument, place an ``*`` in the arguments list just before " @@ -1530,17 +1529,17 @@ msgstr "" "要把參數標記為\\ *僅限關鍵字*,表明參數必須以關鍵字引數傳遞,必須在引數列表中" "第一個\\ *僅限關鍵字*\\ 參數前放上 ``*``。" -#: ../../tutorial/controlflow.rst:796 +#: ../../tutorial/controlflow.rst:797 msgid "Function Examples" msgstr "函式範例" -#: ../../tutorial/controlflow.rst:798 +#: ../../tutorial/controlflow.rst:799 msgid "" "Consider the following example function definitions paying close attention " "to the markers ``/`` and ``*``::" msgstr "請看以下的函式定義範例,注意 ``/`` 和 ``*`` 記號: ::" -#: ../../tutorial/controlflow.rst:801 +#: ../../tutorial/controlflow.rst:802 msgid "" ">>> def standard_arg(arg):\n" "... print(arg)\n" @@ -1566,7 +1565,7 @@ msgstr "" ">>> def combined_example(pos_only, /, standard, *, kwd_only):\n" "... print(pos_only, standard, kwd_only)" -#: ../../tutorial/controlflow.rst:814 +#: ../../tutorial/controlflow.rst:815 msgid "" "The first function definition, ``standard_arg``, the most familiar form, " "places no restrictions on the calling convention and arguments may be passed " @@ -1575,7 +1574,7 @@ msgstr "" "第一個函式定義 ``standard_arg`` 是我們最熟悉的形式,對呼叫方式沒有任何限制," "可以按位置或關鍵字傳遞引數: ::" -#: ../../tutorial/controlflow.rst:818 +#: ../../tutorial/controlflow.rst:819 msgid "" ">>> standard_arg(2)\n" "2\n" @@ -1589,14 +1588,14 @@ msgstr "" ">>> standard_arg(arg=2)\n" "2" -#: ../../tutorial/controlflow.rst:824 +#: ../../tutorial/controlflow.rst:825 msgid "" "The second function ``pos_only_arg`` is restricted to only use positional " "parameters as there is a ``/`` in the function definition::" msgstr "" "第二個函式 ``pos_only_arg`` 的函式定義中有 ``/``,因此僅限使用位置參數: ::" -#: ../../tutorial/controlflow.rst:827 +#: ../../tutorial/controlflow.rst:828 msgid "" ">>> pos_only_arg(1)\n" "1\n" @@ -1616,14 +1615,14 @@ msgstr "" "TypeError: pos_only_arg() got some positional-only arguments passed as " "keyword arguments: 'arg'" -#: ../../tutorial/controlflow.rst:835 +#: ../../tutorial/controlflow.rst:836 msgid "" "The third function ``kwd_only_arg`` only allows keyword arguments as " "indicated by a ``*`` in the function definition::" msgstr "" "第三個函式 ``kwd_only_arg`` 的函式定義透過 ``*`` 表明僅限關鍵字引數: ::" -#: ../../tutorial/controlflow.rst:838 +#: ../../tutorial/controlflow.rst:839 msgid "" ">>> kwd_only_arg(3)\n" "Traceback (most recent call last):\n" @@ -1641,13 +1640,13 @@ msgstr "" ">>> kwd_only_arg(arg=3)\n" "3" -#: ../../tutorial/controlflow.rst:846 +#: ../../tutorial/controlflow.rst:847 msgid "" "And the last uses all three calling conventions in the same function " "definition::" msgstr "最後一個函式在同一個函式定義中,使用了全部三種呼叫方式: ::" -#: ../../tutorial/controlflow.rst:849 +#: ../../tutorial/controlflow.rst:850 msgid "" ">>> combined_example(1, 2, 3)\n" "Traceback (most recent call last):\n" @@ -1683,7 +1682,7 @@ msgstr "" "TypeError: combined_example() got some positional-only arguments passed as " "keyword arguments: 'pos_only'" -#: ../../tutorial/controlflow.rst:866 +#: ../../tutorial/controlflow.rst:867 msgid "" "Finally, consider this function definition which has a potential collision " "between the positional argument ``name`` and ``**kwds`` which has ``name`` " @@ -1692,7 +1691,7 @@ msgstr "" "最後,請看這個函式定義,如果 ``**kwds`` 內有 ``name`` 這個鍵,可能與位置引數 " "``name`` 產生潛在衝突: ::" -#: ../../tutorial/controlflow.rst:868 +#: ../../tutorial/controlflow.rst:869 msgid "" "def foo(name, **kwds):\n" " return 'name' in kwds" @@ -1700,7 +1699,7 @@ msgstr "" "def foo(name, **kwds):\n" " return 'name' in kwds" -#: ../../tutorial/controlflow.rst:871 +#: ../../tutorial/controlflow.rst:872 msgid "" "There is no possible call that will make it return ``True`` as the keyword " "``'name'`` will always bind to the first parameter. For example::" @@ -1708,7 +1707,7 @@ msgstr "" "呼叫該函式不可能回傳 ``True``,因為關鍵字 ``'name'`` 永遠是連結在第一個參數。" "例如: ::" -#: ../../tutorial/controlflow.rst:874 +#: ../../tutorial/controlflow.rst:875 msgid "" ">>> foo(1, **{'name': 2})\n" "Traceback (most recent call last):\n" @@ -1722,7 +1721,7 @@ msgstr "" "TypeError: foo() got multiple values for argument 'name'\n" ">>>" -#: ../../tutorial/controlflow.rst:880 +#: ../../tutorial/controlflow.rst:881 msgid "" "But using ``/`` (positional only arguments), it is possible since it allows " "``name`` as a positional argument and ``'name'`` as a key in the keyword " @@ -1731,7 +1730,7 @@ msgstr "" "使用 ``/``\\ (僅限位置引數)後,就可以了。函式定義會允許 ``name`` 當作位置引" "數,而 ``'name'`` 也可以當作關鍵字引數中的鍵: ::" -#: ../../tutorial/controlflow.rst:882 +#: ../../tutorial/controlflow.rst:883 msgid "" ">>> def foo(name, /, **kwds):\n" "... return 'name' in kwds\n" @@ -1745,31 +1744,31 @@ msgstr "" ">>> foo(1, **{'name': 2})\n" "True" -#: ../../tutorial/controlflow.rst:888 +#: ../../tutorial/controlflow.rst:889 msgid "" "In other words, the names of positional-only parameters can be used in " "``**kwds`` without ambiguity." msgstr "換句話說,僅限位置參數的名稱可以在 ``**kwds`` 中使用,而不產生歧義。" -#: ../../tutorial/controlflow.rst:893 +#: ../../tutorial/controlflow.rst:894 msgid "Recap" msgstr "回顧" -#: ../../tutorial/controlflow.rst:895 +#: ../../tutorial/controlflow.rst:896 msgid "" "The use case will determine which parameters to use in the function " "definition::" msgstr "此用例決定哪些參數可以用於函式定義: ::" -#: ../../tutorial/controlflow.rst:897 +#: ../../tutorial/controlflow.rst:898 msgid "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):" msgstr "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):" -#: ../../tutorial/controlflow.rst:899 +#: ../../tutorial/controlflow.rst:900 msgid "As guidance:" msgstr "說明:" -#: ../../tutorial/controlflow.rst:901 +#: ../../tutorial/controlflow.rst:902 msgid "" "Use positional-only if you want the name of the parameters to not be " "available to the user. This is useful when parameter names have no real " @@ -1781,7 +1780,7 @@ msgstr "" "想控制引數在函式呼叫的排列順序,或同時使用位置參數和任意關鍵字時,這種方式很" "有用。" -#: ../../tutorial/controlflow.rst:906 +#: ../../tutorial/controlflow.rst:907 msgid "" "Use keyword-only when names have meaning and the function definition is more " "understandable by being explicit with names or you want to prevent users " @@ -1790,7 +1789,7 @@ msgstr "" "當參數名稱有意義,且明確的名稱可讓函式定義更易理解,或是你不希望使用者依賴引" "數被傳遞時的位置時,請使用僅限關鍵字。" -#: ../../tutorial/controlflow.rst:909 +#: ../../tutorial/controlflow.rst:910 msgid "" "For an API, use positional-only to prevent breaking API changes if the " "parameter's name is modified in the future." @@ -1798,11 +1797,11 @@ msgstr "" "對於應用程式介面 (API),使用僅限位置,以防止未來參數名稱被修改時造成 API 的中" "斷性變更。" -#: ../../tutorial/controlflow.rst:915 +#: ../../tutorial/controlflow.rst:916 msgid "Arbitrary Argument Lists" msgstr "任意引數列表 (Arbitrary Argument Lists)" -#: ../../tutorial/controlflow.rst:920 +#: ../../tutorial/controlflow.rst:921 msgid "" "Finally, the least frequently used option is to specify that a function can " "be called with an arbitrary number of arguments. These arguments will be " @@ -1813,7 +1812,7 @@ msgstr "" "數會被包裝進一個 tuple 中(詳見 :ref:`tut-tuples`\\ )。在可變數量的引數之" "前,可能有零個或多個普通引數: ::" -#: ../../tutorial/controlflow.rst:925 +#: ../../tutorial/controlflow.rst:926 msgid "" "def write_multiple_items(file, separator, *args):\n" " file.write(separator.join(args))" @@ -1821,7 +1820,7 @@ msgstr "" "def write_multiple_items(file, separator, *args):\n" " file.write(separator.join(args))" -#: ../../tutorial/controlflow.rst:929 +#: ../../tutorial/controlflow.rst:930 msgid "" "Normally, these *variadic* arguments will be last in the list of formal " "parameters, because they scoop up all remaining input arguments that are " @@ -1835,7 +1834,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:935 +#: ../../tutorial/controlflow.rst:936 msgid "" ">>> def concat(*args, sep=\"/\"):\n" "... return sep.join(args)\n" @@ -1853,11 +1852,11 @@ msgstr "" ">>> concat(\"earth\", \"mars\", \"venus\", sep=\".\")\n" "'earth.mars.venus'" -#: ../../tutorial/controlflow.rst:946 +#: ../../tutorial/controlflow.rst:947 msgid "Unpacking Argument Lists" msgstr "拆解引數列表(Unpacking Argument Lists)" -#: ../../tutorial/controlflow.rst:948 +#: ../../tutorial/controlflow.rst:949 msgid "" "The reverse situation occurs when the arguments are already in a list or " "tuple but need to be unpacked for a function call requiring separate " @@ -1871,7 +1870,7 @@ msgstr "" "的 *start* 和 *stop* 引數。如果這些引數不是分開的,則要在呼叫函式時,用 " "``*`` 運算子把引數們從 list 或 tuple 中拆解出來: ::" -#: ../../tutorial/controlflow.rst:955 +#: ../../tutorial/controlflow.rst:956 msgid "" ">>> list(range(3, 6)) # normal call with separate arguments\n" "[3, 4, 5]\n" @@ -1881,13 +1880,13 @@ msgid "" "[3, 4, 5]" msgstr "" -#: ../../tutorial/controlflow.rst:964 +#: ../../tutorial/controlflow.rst:965 msgid "" "In the same fashion, dictionaries can deliver keyword arguments with the " "``**``\\ -operator::" msgstr "同樣地,dictionary(字典)可以用 ``**`` 運算子傳遞關鍵字引數: ::" -#: ../../tutorial/controlflow.rst:967 +#: ../../tutorial/controlflow.rst:968 msgid "" ">>> def parrot(voltage, state='a stiff', action='http://github.com/voom'):\n" "... print(\"-- This parrot wouldn't\", action, end=' ')\n" @@ -1911,11 +1910,11 @@ msgstr "" "-- This parrot wouldn't VOOM if you put four million volts through it. E's " "bleedin' demised !" -#: ../../tutorial/controlflow.rst:980 +#: ../../tutorial/controlflow.rst:981 msgid "Lambda Expressions" msgstr "Lambda 運算式" -#: ../../tutorial/controlflow.rst:982 +#: ../../tutorial/controlflow.rst:983 msgid "" "Small anonymous functions can be created with the :keyword:`lambda` keyword. " "This function returns the sum of its two arguments: ``lambda a, b: a+b``. " @@ -1930,7 +1929,7 @@ msgstr "" "能是單一運算式。在語義上,它就是一個普通函式定義的語法糖 (syntactic sugar)。" "與巢狀函式定義一樣,lambda 函式可以從包含它的作用域中引用變數: ::" -#: ../../tutorial/controlflow.rst:990 +#: ../../tutorial/controlflow.rst:991 msgid "" ">>> def make_incrementor(n):\n" "... return lambda x: x + n\n" @@ -1950,7 +1949,7 @@ msgstr "" ">>> f(1)\n" "43" -#: ../../tutorial/controlflow.rst:999 +#: ../../tutorial/controlflow.rst:1000 msgid "" "The above example uses a lambda expression to return a function. Another " "use is to pass a small function as an argument::" @@ -1958,7 +1957,7 @@ msgstr "" "上面的例子用 lambda 運算式回傳了一個函式。另外的用法是傳遞一個小函式當作引" "數: ::" -#: ../../tutorial/controlflow.rst:1002 +#: ../../tutorial/controlflow.rst:1003 msgid "" ">>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]\n" ">>> pairs.sort(key=lambda pair: pair[1])\n" @@ -1970,17 +1969,17 @@ msgstr "" ">>> pairs\n" "[(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]" -#: ../../tutorial/controlflow.rst:1011 +#: ../../tutorial/controlflow.rst:1012 msgid "Documentation Strings" msgstr "說明文件字串 (Documentation Strings)" -#: ../../tutorial/controlflow.rst:1018 +#: ../../tutorial/controlflow.rst:1019 msgid "" "Here are some conventions about the content and formatting of documentation " "strings." msgstr "以下是關於說明文件字串內容和格式的慣例。" -#: ../../tutorial/controlflow.rst:1021 +#: ../../tutorial/controlflow.rst:1022 msgid "" "The first line should always be a short, concise summary of the object's " "purpose. For brevity, it should not explicitly state the object's name or " @@ -1992,7 +1991,7 @@ msgstr "" "的名稱或型別,因為有其他方法可以達到相同目的(除非該名稱剛好是一個描述函式運" "算的動詞)。這一行應以大寫字母開頭,以句號結尾。" -#: ../../tutorial/controlflow.rst:1027 +#: ../../tutorial/controlflow.rst:1028 msgid "" "If there are more lines in the documentation string, the second line should " "be blank, visually separating the summary from the rest of the description. " @@ -2002,7 +2001,7 @@ msgstr "" "文件字串為多行時,第二行應為空白行,在視覺上將摘要與其餘描述分開。後面幾行可" "包含一或多個段落,描述此物件的呼叫慣例、副作用等。" -#: ../../tutorial/controlflow.rst:1032 +#: ../../tutorial/controlflow.rst:1033 msgid "" "The Python parser does not strip indentation from multi-line string literals " "in Python, so tools that process documentation have to strip indentation if " @@ -2024,11 +2023,11 @@ msgstr "" "出現了,這些行的全部前導空白字元都應被去除。展開 tab 鍵後(通常為八個空格)," "應測試空白字元量是否等價。" -#: ../../tutorial/controlflow.rst:1044 +#: ../../tutorial/controlflow.rst:1045 msgid "Here is an example of a multi-line docstring::" msgstr "下面是多行說明字串的一個範例: ::" -#: ../../tutorial/controlflow.rst:1046 +#: ../../tutorial/controlflow.rst:1047 msgid "" ">>> def my_function():\n" "... \"\"\"Do nothing, but document it.\n" @@ -2043,11 +2042,11 @@ msgid "" " No, really, it doesn't do anything." msgstr "" -#: ../../tutorial/controlflow.rst:1062 +#: ../../tutorial/controlflow.rst:1063 msgid "Function Annotations" msgstr "函式註釋 (Function Annotations)" -#: ../../tutorial/controlflow.rst:1070 +#: ../../tutorial/controlflow.rst:1071 msgid "" ":ref:`Function annotations ` are completely optional metadata " "information about the types used by user-defined functions (see :pep:`3107` " @@ -2056,7 +2055,7 @@ msgstr "" ":ref:`函式註釋 `\\ 是選擇性的元資料(metadata)資訊,描述使用者定義" "函式所使用的型別(更多資訊詳見 :pep:`3107` 和 :pep:`484`\\ )。" -#: ../../tutorial/controlflow.rst:1074 +#: ../../tutorial/controlflow.rst:1075 msgid "" ":term:`Annotations ` are stored in the :attr:`!" "__annotations__` attribute of the function as a dictionary and have no " @@ -2074,7 +2073,7 @@ msgstr "" ">`` 文字接著一個運算式。以下範例註釋了一個必要引數、一個選擇性引數,以及回傳" "值: ::" -#: ../../tutorial/controlflow.rst:1083 +#: ../../tutorial/controlflow.rst:1084 msgid "" ">>> def f(ham: str, eggs: str = 'eggs') -> str:\n" "... print(\"Annotations:\", f.__annotations__)\n" @@ -2098,11 +2097,11 @@ msgstr "" "Arguments: spam eggs\n" "'spam and eggs'" -#: ../../tutorial/controlflow.rst:1096 +#: ../../tutorial/controlflow.rst:1097 msgid "Intermezzo: Coding Style" msgstr "間奏曲:程式碼風格 (Coding Style)" -#: ../../tutorial/controlflow.rst:1101 +#: ../../tutorial/controlflow.rst:1102 msgid "" "Now that you are about to write longer, more complex pieces of Python, it is " "a good time to talk about *coding style*. Most languages can be written (or " @@ -2115,7 +2114,7 @@ msgstr "" "式比其他的更具可讀性。能讓其他人輕鬆閱讀你的程式碼永遠是一個好主意,而使用優" "良的編碼樣式對此有極大的幫助。" -#: ../../tutorial/controlflow.rst:1107 +#: ../../tutorial/controlflow.rst:1108 msgid "" "For Python, :pep:`8` has emerged as the style guide that most projects " "adhere to; it promotes a very readable and eye-pleasing coding style. Every " @@ -2125,11 +2124,11 @@ msgstr "" "對於 Python,大多數的專案都遵循 :pep:`8` 的樣式指南;它推行的編碼樣式相當可讀" "且賞心悅目。每個 Python 開發者都應該花點時間研讀;這裡是該指南的核心重點:" -#: ../../tutorial/controlflow.rst:1112 +#: ../../tutorial/controlflow.rst:1113 msgid "Use 4-space indentation, and no tabs." msgstr "用 4 個空格縮排,不要用 tab 鍵。" -#: ../../tutorial/controlflow.rst:1114 +#: ../../tutorial/controlflow.rst:1115 msgid "" "4 spaces are a good compromise between small indentation (allows greater " "nesting depth) and large indentation (easier to read). Tabs introduce " @@ -2138,11 +2137,11 @@ msgstr "" "4 個空格是小縮排(容許更大的巢套深度)和大縮排(較易閱讀)之間的折衷方案。" "Tab 鍵會造成混亂,最好別用。" -#: ../../tutorial/controlflow.rst:1118 +#: ../../tutorial/controlflow.rst:1119 msgid "Wrap lines so that they don't exceed 79 characters." msgstr "換行,使一行不超過 79 個字元。" -#: ../../tutorial/controlflow.rst:1120 +#: ../../tutorial/controlflow.rst:1121 msgid "" "This helps users with small displays and makes it possible to have several " "code files side-by-side on larger displays." @@ -2150,21 +2149,21 @@ msgstr "" "換行能讓使用小顯示器的使用者方便閱讀,也可以在較大顯示器上並排陳列多個程式碼" "檔案。" -#: ../../tutorial/controlflow.rst:1123 +#: ../../tutorial/controlflow.rst:1124 msgid "" "Use blank lines to separate functions and classes, and larger blocks of code " "inside functions." msgstr "用空行分隔函式和 class(類別),及函式內較大塊的程式碼。" -#: ../../tutorial/controlflow.rst:1126 +#: ../../tutorial/controlflow.rst:1127 msgid "When possible, put comments on a line of their own." msgstr "如果可以,把註解放在單獨一行。" -#: ../../tutorial/controlflow.rst:1128 +#: ../../tutorial/controlflow.rst:1129 msgid "Use docstrings." msgstr "使用說明字串。" -#: ../../tutorial/controlflow.rst:1130 +#: ../../tutorial/controlflow.rst:1131 msgid "" "Use spaces around operators and after commas, but not directly inside " "bracketing constructs: ``a = f(1, 2) + g(3, 4)``." @@ -2172,7 +2171,7 @@ msgstr "" "運算子前後、逗號後要加空格,但不要直接放在括號內側:``a = f(1, 2) + g(3, " "4)``。" -#: ../../tutorial/controlflow.rst:1133 +#: ../../tutorial/controlflow.rst:1134 msgid "" "Name your classes and functions consistently; the convention is to use " "``UpperCamelCase`` for classes and ``lowercase_with_underscores`` for " @@ -2184,7 +2183,7 @@ msgstr "" "底線)。永遠用 ``self`` 作為 method 第一個引數的名稱(關於 class 和 method," "詳見 :ref:`tut-firstclasses`\\ )。" -#: ../../tutorial/controlflow.rst:1138 +#: ../../tutorial/controlflow.rst:1139 msgid "" "Don't use fancy encodings if your code is meant to be used in international " "environments. Python's default, UTF-8, or even plain ASCII work best in any " @@ -2193,7 +2192,7 @@ msgstr "" "若程式碼是為了用於國際環境時,不要用花俏的編碼。Python 預設的 UTF-8 或甚至普" "通的 ASCII,就可以勝任各種情況。" -#: ../../tutorial/controlflow.rst:1142 +#: ../../tutorial/controlflow.rst:1143 msgid "" "Likewise, don't use non-ASCII characters in identifiers if there is only the " "slightest chance people speaking a different language will read or maintain " @@ -2202,11 +2201,11 @@ msgstr "" "同樣地,若不同語言使用者閱讀或維護程式碼的可能性微乎其微,就不要在命名時使用" "非 ASCII 字元。" -#: ../../tutorial/controlflow.rst:1148 +#: ../../tutorial/controlflow.rst:1149 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/controlflow.rst:1149 +#: ../../tutorial/controlflow.rst:1150 msgid "" "Actually, *call by object reference* would be a better description, since if " "a mutable object is passed, the caller will see any changes the callee makes " @@ -2224,55 +2223,55 @@ msgstr "statement(陳述式)" msgid "for" msgstr "for" -#: ../../tutorial/controlflow.rst:476 ../../tutorial/controlflow.rst:1013 +#: ../../tutorial/controlflow.rst:477 ../../tutorial/controlflow.rst:1014 msgid "documentation strings" msgstr "ddocumentation strings(說明字串)" -#: ../../tutorial/controlflow.rst:476 ../../tutorial/controlflow.rst:1013 +#: ../../tutorial/controlflow.rst:477 ../../tutorial/controlflow.rst:1014 msgid "docstrings" msgstr "docstrings(說明字串)" -#: ../../tutorial/controlflow.rst:476 ../../tutorial/controlflow.rst:1013 +#: ../../tutorial/controlflow.rst:477 ../../tutorial/controlflow.rst:1014 msgid "strings, documentation" msgstr "strings(字串), documentation(說明文件)" -#: ../../tutorial/controlflow.rst:917 +#: ../../tutorial/controlflow.rst:918 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../tutorial/controlflow.rst:917 ../../tutorial/controlflow.rst:961 +#: ../../tutorial/controlflow.rst:918 ../../tutorial/controlflow.rst:962 msgid "in function calls" msgstr "於函式呼叫中" -#: ../../tutorial/controlflow.rst:961 +#: ../../tutorial/controlflow.rst:962 msgid "**" msgstr "**" -#: ../../tutorial/controlflow.rst:1065 +#: ../../tutorial/controlflow.rst:1066 msgid "function" msgstr "function(函式)" -#: ../../tutorial/controlflow.rst:1065 +#: ../../tutorial/controlflow.rst:1066 msgid "annotations" msgstr "annotations(註釋)" -#: ../../tutorial/controlflow.rst:1065 +#: ../../tutorial/controlflow.rst:1066 msgid "->" msgstr "->" -#: ../../tutorial/controlflow.rst:1065 +#: ../../tutorial/controlflow.rst:1066 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../tutorial/controlflow.rst:1065 +#: ../../tutorial/controlflow.rst:1066 msgid ": (colon)" msgstr ": (冒號)" -#: ../../tutorial/controlflow.rst:1099 +#: ../../tutorial/controlflow.rst:1100 msgid "coding" msgstr "coding(程式編寫)" -#: ../../tutorial/controlflow.rst:1099 +#: ../../tutorial/controlflow.rst:1100 msgid "style" msgstr "style(風格)" diff --git a/tutorial/datastructures.po b/tutorial/datastructures.po index 27fcb13025..2974c0a980 100644 --- a/tutorial/datastructures.po +++ b/tutorial/datastructures.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-10-31 00:13+0000\n" "PO-Revision-Date: 2024-01-22 21:43+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -49,16 +49,16 @@ msgstr "" "method:" #: ../../tutorial/datastructures.rst:22 -msgid "" -"Add an item to the end of the list. Equivalent to ``a[len(a):] = [x]``." -msgstr "將一個新的項目加到 list 的尾端。等同於 ``a[len(a):] = [x]``。" +msgid "Add an item to the end of the list. Similar to ``a[len(a):] = [x]``." +msgstr "將一個新的項目加到 list 的尾端。與 ``a[len(a):] = [x]`` 類似。" #: ../../tutorial/datastructures.rst:28 msgid "" -"Extend the list by appending all the items from the iterable. Equivalent to " +"Extend the list by appending all the items from the iterable. Similar to " "``a[len(a):] = iterable``." msgstr "" -"將 iterable(可疊代物件)接到 list 的尾端。等同於 ``a[len(a):] = iterable``。" +"將 iterable(可疊代物件)接到 list 的尾端。與 ``a[len(a):] = iterable`` 類" +"似。" #: ../../tutorial/datastructures.rst:35 msgid "" @@ -90,8 +90,8 @@ msgstr "" "exc:`IndexError` 例外。" #: ../../tutorial/datastructures.rst:59 -msgid "Remove all items from the list. Equivalent to ``del a[:]``." -msgstr "刪除 list 中所有項目。這等同於 ``del a[:]``。" +msgid "Remove all items from the list. Similar to ``del a[:]``." +msgstr "刪除 list 中所有項目。與 ``del a[:]`` 類似。" #: ../../tutorial/datastructures.rst:65 msgid "" @@ -129,8 +129,8 @@ msgid "Reverse the elements of the list in place." msgstr "將 list 中的項目前後順序反過來。" #: ../../tutorial/datastructures.rst:96 -msgid "Return a shallow copy of the list. Equivalent to ``a[:]``." -msgstr "回傳一個淺複製 (shallow copy) 的 list。等同於 ``a[:]``。" +msgid "Return a shallow copy of the list. Similar to ``a[:]``." +msgstr "回傳一個淺複製 (shallow copy) 的 list。與 ``a[:]`` 類似。" #: ../../tutorial/datastructures.rst:99 msgid "An example that uses most of the list methods::" diff --git a/tutorial/errors.po b/tutorial/errors.po index fd65d5efcd..37d81af4bb 100644 --- a/tutorial/errors.po +++ b/tutorial/errors.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-27 00:14+0000\n" "PO-Revision-Date: 2022-10-24 14:54+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -62,7 +62,6 @@ msgstr "" "SyntaxError: invalid syntax" #: ../../tutorial/errors.rst:26 -#, fuzzy msgid "" "The parser repeats the offending line and displays little 'arrow's pointing " "at the token in the line where the error was detected. The error may be " @@ -72,10 +71,9 @@ msgid "" "you know where to look in case the input came from a script." msgstr "" "剖析器 (parser) 會重複犯錯的那一行,並用一個小「箭頭」指向該行檢測到的第一個" -"錯誤點。錯誤是由箭頭\\ *之前*\\ 的標記 (token) 導致的(或至少是在這裡檢測到" -"的):此例中,錯誤是在 :func:`print` 函式中被檢測到,因為在它前面少了一個冒" -"號 (``':'``)。檔案名稱和行號會被印出來,所以如果訊息是來自腳本時,就可以知道" -"去哪裡找問題。" +"錯誤點。錯誤是由箭頭\\ *之前*\\ 的標記 (token) 導致的。此例中,錯誤是在 :" +"func:`print` 函式中被檢測到,因為在它前面少了一個冒號 (``':'``)。檔案名稱和列" +"號會被印出來,所以如果訊息是來自腳本時,就可以知道去哪裡找問題。" #: ../../tutorial/errors.rst:37 msgid "Exceptions" @@ -219,8 +217,8 @@ msgid "" "First, the *try clause* (the statement(s) between the :keyword:`try` and :" "keyword:`except` keywords) is executed." msgstr "" -"首先,執行 *try 子句*\\ (\\ :keyword:`try` 和 :keyword:`except` 關鍵字之間的" -"陳述式)。" +"首先,執行 *try 子句*\\ (:keyword:`try` 和 :keyword:`except` 關鍵字之間的陳" +"述式)。" #: ../../tutorial/errors.rst:107 msgid "" @@ -939,7 +937,7 @@ msgid "" "executing finally clause\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -" divide(\"2\", \"0\")\n" +" divide(\"2\", \"1\")\n" " ~~~~~~^^^^^^^^^^\n" " File \"\", line 3, in divide\n" " result = x / y\n" @@ -966,7 +964,7 @@ msgstr "" "executing finally clause\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -" divide(\"2\", \"0\")\n" +" divide(\"2\", \"1\")\n" " ~~~~~~^^^^^^^^^^\n" " File \"\", line 3, in divide\n" " result = x / y\n" diff --git a/tutorial/inputoutput.po b/tutorial/inputoutput.po index 3fbc7a6674..860e9deca2 100644 --- a/tutorial/inputoutput.po +++ b/tutorial/inputoutput.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-10-31 00:13+0000\n" "PO-Revision-Date: 2022-10-05 10:26+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -197,11 +197,11 @@ msgstr "" "值替代為字串的另一種方法。該方法使用 ``$x`` 佔位符號,並以 dictionary 的值進" "行取代,但對格式的控制明顯較少。" -#: ../../tutorial/inputoutput.rst:107 +#: ../../tutorial/inputoutput.rst:114 msgid "Formatted String Literals" msgstr "格式化的字串文本 (Formatted String Literals)" -#: ../../tutorial/inputoutput.rst:109 +#: ../../tutorial/inputoutput.rst:116 msgid "" ":ref:`Formatted string literals ` (also called f-strings for " "short) let you include the value of Python expressions inside a string by " @@ -212,7 +212,7 @@ msgstr "" "``f`` 或 ``F``,並將運算式編寫為 ``{expression}``,讓你可以在字串內加入 " "Python 運算式的值。" -#: ../../tutorial/inputoutput.rst:114 +#: ../../tutorial/inputoutput.rst:121 msgid "" "An optional format specifier can follow the expression. This allows greater " "control over how the value is formatted. The following example rounds pi to " @@ -221,7 +221,7 @@ msgstr "" "格式說明符 (format specifier) 是選擇性的,寫在運算式後面,可以更好地控制值的" "格式化方式。以下範例將 pi 捨入到小數點後三位: ::" -#: ../../tutorial/inputoutput.rst:118 +#: ../../tutorial/inputoutput.rst:125 msgid "" ">>> import math\n" ">>> print(f'The value of pi is approximately {math.pi:.3f}.')\n" @@ -231,7 +231,7 @@ msgstr "" ">>> print(f'The value of pi is approximately {math.pi:.3f}.')\n" "The value of pi is approximately 3.142." -#: ../../tutorial/inputoutput.rst:122 +#: ../../tutorial/inputoutput.rst:129 msgid "" "Passing an integer after the ``':'`` will cause that field to be a minimum " "number of characters wide. This is useful for making columns line up. ::" @@ -239,7 +239,7 @@ msgstr "" "在 ``':'`` 後傳遞一個整數,可以設定該欄位至少為幾個字元寬,常用於將每一欄對" "齊。 ::" -#: ../../tutorial/inputoutput.rst:125 +#: ../../tutorial/inputoutput.rst:132 msgid "" ">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 7678}\n" ">>> for name, phone in table.items():\n" @@ -257,7 +257,7 @@ msgstr "" "Jack ==> 4098\n" "Dcab ==> 7678" -#: ../../tutorial/inputoutput.rst:133 +#: ../../tutorial/inputoutput.rst:140 msgid "" "Other modifiers can be used to convert the value before it is formatted. ``'!" "a'`` applies :func:`ascii`, ``'!s'`` applies :func:`str`, and ``'!r'`` " @@ -266,7 +266,7 @@ msgstr "" "還有一些修飾符號可以在格式化前先將值轉換過。``'!a'`` 會套用 :func:`ascii`," "``'!s'`` 會套用 :func:`str`,``'!r'`` 會套用 :func:`repr`: ::" -#: ../../tutorial/inputoutput.rst:137 +#: ../../tutorial/inputoutput.rst:144 msgid "" ">>> animals = 'eels'\n" ">>> print(f'My hovercraft is full of {animals}.')\n" @@ -280,7 +280,7 @@ msgstr "" ">>> print(f'My hovercraft is full of {animals!r}.')\n" "My hovercraft is full of 'eels'." -#: ../../tutorial/inputoutput.rst:143 +#: ../../tutorial/inputoutput.rst:150 msgid "" "The ``=`` specifier can be used to expand an expression to the text of the " "expression, an equal sign, then the representation of the evaluated " @@ -289,7 +289,7 @@ msgstr "" "``=`` 說明符可用於將一個運算式擴充為該運算式的文字、一個等號、以及對該運算式" "求值 (evaluate) 後的表示法:" -#: ../../tutorial/inputoutput.rst:152 +#: ../../tutorial/inputoutput.rst:159 msgid "" "See :ref:`self-documenting expressions ` for more " "information on the ``=`` specifier. For a reference on these format " @@ -299,15 +299,15 @@ msgstr "" "expressions) `。若要參考這些格式化字串的規格,詳見 :ref:" "`formatspec` 參考指南。" -#: ../../tutorial/inputoutput.rst:159 +#: ../../tutorial/inputoutput.rst:166 msgid "The String format() Method" msgstr "字串的 format() method" -#: ../../tutorial/inputoutput.rst:161 +#: ../../tutorial/inputoutput.rst:168 msgid "Basic usage of the :meth:`str.format` method looks like this::" msgstr ":meth:`str.format` method 的基本用法如下: ::" -#: ../../tutorial/inputoutput.rst:163 +#: ../../tutorial/inputoutput.rst:170 msgid "" ">>> print('We are the {} who say \"{}!\"'.format('knights', 'Ni'))\n" "We are the knights who say \"Ni!\"" @@ -315,7 +315,7 @@ msgstr "" ">>> print('We are the {} who say \"{}!\"'.format('knights', 'Ni'))\n" "We are the knights who say \"Ni!\"" -#: ../../tutorial/inputoutput.rst:166 +#: ../../tutorial/inputoutput.rst:173 msgid "" "The brackets and characters within them (called format fields) are replaced " "with the objects passed into the :meth:`str.format` method. A number in the " @@ -326,7 +326,7 @@ msgstr "" "的物件。大括號中的數字表示該物件在傳遞給 :meth:`str.format` method 時所在的位" "置。 ::" -#: ../../tutorial/inputoutput.rst:171 +#: ../../tutorial/inputoutput.rst:178 msgid "" ">>> print('{0} and {1}'.format('spam', 'eggs'))\n" "spam and eggs\n" @@ -338,7 +338,7 @@ msgstr "" ">>> print('{1} and {0}'.format('spam', 'eggs'))\n" "eggs and spam" -#: ../../tutorial/inputoutput.rst:176 +#: ../../tutorial/inputoutput.rst:183 msgid "" "If keyword arguments are used in the :meth:`str.format` method, their values " "are referred to by using the name of the argument. ::" @@ -346,7 +346,7 @@ msgstr "" "如果在 :meth:`str.format` method 中使用關鍵字引數,可以使用引數名稱去引用它們" "的值。 ::" -#: ../../tutorial/inputoutput.rst:179 +#: ../../tutorial/inputoutput.rst:186 msgid "" ">>> print('This {food} is {adjective}.'.format(\n" "... food='spam', adjective='absolutely horrible'))\n" @@ -356,11 +356,11 @@ msgstr "" "... food='spam', adjective='absolutely horrible'))\n" "This spam is absolutely horrible." -#: ../../tutorial/inputoutput.rst:183 +#: ../../tutorial/inputoutput.rst:190 msgid "Positional and keyword arguments can be arbitrarily combined::" msgstr "位置引數和關鍵字引數可以任意組合: ::" -#: ../../tutorial/inputoutput.rst:185 +#: ../../tutorial/inputoutput.rst:192 msgid "" ">>> print('The story of {0}, {1}, and {other}.'.format('Bill', 'Manfred',\n" "... other='Georg'))\n" @@ -370,7 +370,7 @@ msgstr "" "... other='Georg'))\n" "The story of Bill, Manfred, and Georg." -#: ../../tutorial/inputoutput.rst:189 +#: ../../tutorial/inputoutput.rst:196 msgid "" "If you have a really long format string that you don't want to split up, it " "would be nice if you could reference the variables to be formatted by name " @@ -381,7 +381,7 @@ msgstr "" "數。這項操作可以透過傳遞字典 (dict),並用方括號 ``'[]'`` 使用鍵 (key) 來輕鬆" "完成。 ::" -#: ../../tutorial/inputoutput.rst:194 +#: ../../tutorial/inputoutput.rst:201 msgid "" ">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" ">>> print('Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; '\n" @@ -393,14 +393,14 @@ msgstr "" "... 'Dcab: {0[Dcab]:d}'.format(table))\n" "Jack: 4098; Sjoerd: 4127; Dcab: 8637678" -#: ../../tutorial/inputoutput.rst:199 +#: ../../tutorial/inputoutput.rst:206 msgid "" "This could also be done by passing the ``table`` dictionary as keyword " "arguments with the ``**`` notation. ::" msgstr "" "用 '**' 符號,把 ``table`` 字典當作關鍵字引數來傳遞,也有一樣的結果。 ::" -#: ../../tutorial/inputoutput.rst:202 +#: ../../tutorial/inputoutput.rst:209 msgid "" ">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" ">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: {Dcab:d}'." @@ -412,7 +412,7 @@ msgstr "" "format(**table))\n" "Jack: 4098; Sjoerd: 4127; Dcab: 8637678" -#: ../../tutorial/inputoutput.rst:206 +#: ../../tutorial/inputoutput.rst:213 msgid "" "This is particularly useful in combination with the built-in function :func:" "`vars`, which returns a dictionary containing all local variables::" @@ -420,7 +420,7 @@ msgstr "" "與內建函式 :func:`vars` 組合使用時,這種方式特別實用。該函式可以回傳一個包含" "所有區域變數的 dictionary: ::" -#: ../../tutorial/inputoutput.rst:209 +#: ../../tutorial/inputoutput.rst:216 msgid "" ">>> table = {k: str(v) for k, v in vars().items()}\n" ">>> message = \" \".join([f'{k}: ' + '{' + k +'};' for k in table.keys()])\n" @@ -432,13 +432,13 @@ msgstr "" ">>> print(message.format(**table))\n" "__name__: __main__; __doc__: None; __package__: None; __loader__: ..." -#: ../../tutorial/inputoutput.rst:214 +#: ../../tutorial/inputoutput.rst:221 msgid "" "As an example, the following lines produce a tidily aligned set of columns " "giving integers and their squares and cubes::" msgstr "例如,下面的程式碼產生一組排列整齊的欄,列出整數及其平方與立方: ::" -#: ../../tutorial/inputoutput.rst:217 +#: ../../tutorial/inputoutput.rst:224 msgid "" ">>> for x in range(1, 11):\n" "... print('{0:2d} {1:3d} {2:4d}'.format(x, x*x, x*x*x))\n" @@ -468,7 +468,7 @@ msgstr "" " 9 81 729\n" "10 100 1000" -#: ../../tutorial/inputoutput.rst:231 +#: ../../tutorial/inputoutput.rst:238 msgid "" "For a complete overview of string formatting with :meth:`str.format`, see :" "ref:`formatstrings`." @@ -476,15 +476,15 @@ msgstr "" "關於使用 :meth:`str.format` 進行字串格式化的完整概述,請見\\ :ref:" "`formatstrings`。" -#: ../../tutorial/inputoutput.rst:236 +#: ../../tutorial/inputoutput.rst:243 msgid "Manual String Formatting" msgstr "手動格式化字串" -#: ../../tutorial/inputoutput.rst:238 +#: ../../tutorial/inputoutput.rst:245 msgid "Here's the same table of squares and cubes, formatted manually::" msgstr "下面是以手動格式化完成的同一個平方及立方的表: ::" -#: ../../tutorial/inputoutput.rst:240 +#: ../../tutorial/inputoutput.rst:247 msgid "" ">>> for x in range(1, 11):\n" "... print(repr(x).rjust(2), repr(x*x).rjust(3), end=' ')\n" @@ -518,7 +518,7 @@ msgstr "" " 9 81 729\n" "10 100 1000" -#: ../../tutorial/inputoutput.rst:256 +#: ../../tutorial/inputoutput.rst:263 msgid "" "(Note that the one space between each column was added by the way :func:" "`print` works: it always adds spaces between its arguments.)" @@ -526,7 +526,7 @@ msgstr "" "(請注意,使用 :func:`print` 讓每欄之間加入一個空格的方法:這種方法總是在其引" "數間加入空格。)" -#: ../../tutorial/inputoutput.rst:259 +#: ../../tutorial/inputoutput.rst:266 msgid "" "The :meth:`str.rjust` method of string objects right-justifies a string in a " "field of a given width by padding it with spaces on the left. There are " @@ -544,7 +544,7 @@ msgstr "" "好,那種情況會讓值變得不正確。(如果你真的想截斷字串,可以加入像 ``x.ljust(n)" "[:n]`` 這樣的切片運算。)" -#: ../../tutorial/inputoutput.rst:268 +#: ../../tutorial/inputoutput.rst:275 msgid "" "There is another method, :meth:`str.zfill`, which pads a numeric string on " "the left with zeros. It understands about plus and minus signs::" @@ -552,7 +552,7 @@ msgstr "" "另一種 method 是 :meth:`str.zfill`,可在數值字串的左邊填補零,且能識別正負" "號: ::" -#: ../../tutorial/inputoutput.rst:271 +#: ../../tutorial/inputoutput.rst:278 msgid "" ">>> '12'.zfill(5)\n" "'00012'\n" @@ -568,11 +568,11 @@ msgstr "" ">>> '3.14159265359'.zfill(5)\n" "'3.14159265359'" -#: ../../tutorial/inputoutput.rst:280 +#: ../../tutorial/inputoutput.rst:287 msgid "Old string formatting" msgstr "格式化字串的舊方法" -#: ../../tutorial/inputoutput.rst:282 +#: ../../tutorial/inputoutput.rst:289 msgid "" "The % operator (modulo) can also be used for string formatting. Given " "``format % values`` (where *format* is a string), ``%`` conversion " @@ -584,7 +584,7 @@ msgstr "" "*format* 是個字串),*format* 內的 ``%`` 轉換規格會被 *values* 的零個或多個元" "素所取代。此運算常被稱為字串插值 (string interpolation)。例如: ::" -#: ../../tutorial/inputoutput.rst:289 +#: ../../tutorial/inputoutput.rst:296 msgid "" ">>> import math\n" ">>> print('The value of pi is approximately %5.3f.' % math.pi)\n" @@ -594,16 +594,16 @@ msgstr "" ">>> print('The value of pi is approximately %5.3f.' % math.pi)\n" "The value of pi is approximately 3.142." -#: ../../tutorial/inputoutput.rst:293 +#: ../../tutorial/inputoutput.rst:300 msgid "" "More information can be found in the :ref:`old-string-formatting` section." msgstr "更多資訊請見 :ref:`old-string-formatting`\\ 小節。" -#: ../../tutorial/inputoutput.rst:299 +#: ../../tutorial/inputoutput.rst:306 msgid "Reading and Writing Files" msgstr "讀寫檔案" -#: ../../tutorial/inputoutput.rst:305 +#: ../../tutorial/inputoutput.rst:312 msgid "" ":func:`open` returns a :term:`file object`, and is most commonly used with " "two positional arguments and one keyword argument: ``open(filename, mode, " @@ -612,11 +612,11 @@ msgstr "" ":func:`open` 回傳一個 :term:`file object`,而它最常使用的兩個位置引數和一個關" "鍵字引數是:``open(filename, mode, encoding=None)``" -#: ../../tutorial/inputoutput.rst:311 +#: ../../tutorial/inputoutput.rst:318 msgid ">>> f = open('workfile', 'w', encoding=\"utf-8\")" msgstr ">>> f = open('workfile', 'w', encoding=\"utf-8\")" -#: ../../tutorial/inputoutput.rst:318 +#: ../../tutorial/inputoutput.rst:325 msgid "" "The first argument is a string containing the filename. The second argument " "is another string containing a few characters describing the way in which " @@ -633,7 +633,7 @@ msgstr "" "內容為目的開啟檔案,任何寫入檔案的資料會自動被加入到檔案的結尾。``'r+'`` 可以" "開啟檔案並進行讀取和寫入。*mode* 引數是選擇性的,若省略時會預設為 ``'r'``。" -#: ../../tutorial/inputoutput.rst:327 +#: ../../tutorial/inputoutput.rst:334 msgid "" "Normally, files are opened in :dfn:`text mode`, that means, you read and " "write strings from and to the file, which are encoded in a specific " @@ -651,7 +651,7 @@ msgstr "" "mode`\\ (二進制模式)開啟檔案,二進制模式資料以 :class:`bytes` 物件的形式被" "讀寫。以二進制模式開啟檔案時不可以指定 *encoding*。" -#: ../../tutorial/inputoutput.rst:337 +#: ../../tutorial/inputoutput.rst:344 msgid "" "In text mode, the default when reading is to convert platform-specific line " "endings (``\\n`` on Unix, ``\\r\\n`` on Windows) to just ``\\n``. When " @@ -667,7 +667,7 @@ msgstr "" "文字檔案來說沒有問題,但會毀壞像是 :file:`JPEG` 或 :file:`EXE` 檔案中的二進制" "資料。在讀寫此類檔案時,注意一定要使用二進制模式。" -#: ../../tutorial/inputoutput.rst:345 +#: ../../tutorial/inputoutput.rst:352 msgid "" "It is good practice to use the :keyword:`with` keyword when dealing with " "file objects. The advantage is that the file is properly closed after its " @@ -679,7 +679,7 @@ msgstr "" "束後,即使在某個時刻引發了例外,檔案仍會正確地被關閉。使用 :keyword:`!with` " "也比寫等效的 :keyword:`try`\\ -\\ :keyword:`finally` 區塊,來得簡短許多: ::" -#: ../../tutorial/inputoutput.rst:351 +#: ../../tutorial/inputoutput.rst:358 msgid "" ">>> with open('workfile', encoding=\"utf-8\") as f:\n" "... read_data = f.read()\n" @@ -695,7 +695,7 @@ msgstr "" ">>> f.closed\n" "True" -#: ../../tutorial/inputoutput.rst:358 +#: ../../tutorial/inputoutput.rst:365 msgid "" "If you're not using the :keyword:`with` keyword, then you should call ``f." "close()`` to close the file and immediately free up any system resources " @@ -704,7 +704,7 @@ msgstr "" "如果你沒有使用 :keyword:`with` 關鍵字,則應呼叫 ``f.close()`` 關閉檔案,可以" "立即釋放被它所使用的系統資源。" -#: ../../tutorial/inputoutput.rst:363 +#: ../../tutorial/inputoutput.rst:370 msgid "" "Calling ``f.write()`` without using the :keyword:`!with` keyword or calling " "``f.close()`` **might** result in the arguments of ``f.write()`` not being " @@ -714,7 +714,7 @@ msgstr "" "即使程式成功退出,也\\ **可能**\\ 導致 ``f.write()`` 的引數沒有被完全寫入硬" "碟。" -#: ../../tutorial/inputoutput.rst:371 +#: ../../tutorial/inputoutput.rst:378 msgid "" "After a file object is closed, either by a :keyword:`with` statement or by " "calling ``f.close()``, attempts to use the file object will automatically " @@ -723,7 +723,7 @@ msgstr "" "不論是透過 :keyword:`with` 陳述式,或呼叫 ``f.close()`` 關閉一個檔案物件之" "後,嘗試使用該檔案物件將會自動失效。 ::" -#: ../../tutorial/inputoutput.rst:375 +#: ../../tutorial/inputoutput.rst:382 msgid "" ">>> f.close()\n" ">>> f.read()\n" @@ -737,17 +737,17 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: I/O operation on closed file." -#: ../../tutorial/inputoutput.rst:385 +#: ../../tutorial/inputoutput.rst:392 msgid "Methods of File Objects" msgstr "檔案物件的 method" -#: ../../tutorial/inputoutput.rst:387 +#: ../../tutorial/inputoutput.rst:394 msgid "" "The rest of the examples in this section will assume that a file object " "called ``f`` has already been created." msgstr "本節其餘的範例皆假設一個名為 ``f`` 的檔案物件已被建立。" -#: ../../tutorial/inputoutput.rst:390 +#: ../../tutorial/inputoutput.rst:397 msgid "" "To read a file's contents, call ``f.read(size)``, which reads some quantity " "of data and returns it as a string (in text mode) or bytes object (in binary " @@ -765,7 +765,7 @@ msgstr "" "字模式)或 *size* 數量的位元組串(二進制模式)會被讀取及回傳。如果之前已經到" "達檔案的末端,``f.read()`` 會回傳空字串(``''``)。 ::" -#: ../../tutorial/inputoutput.rst:399 +#: ../../tutorial/inputoutput.rst:406 msgid "" ">>> f.read()\n" "'This is the entire file.\\n'\n" @@ -777,7 +777,7 @@ msgstr "" ">>> f.read()\n" "''" -#: ../../tutorial/inputoutput.rst:404 +#: ../../tutorial/inputoutput.rst:411 msgid "" "``f.readline()`` reads a single line from the file; a newline character " "(``\\n``) is left at the end of the string, and is only omitted on the last " @@ -791,7 +791,7 @@ msgstr "" "傳值清晰明確;只要 ``f.readline()`` 回傳一個空字串,就表示已經到達了檔案末" "端,而空白行的表示法是 ``'\\n'``,也就是只含一個換行字元的字串。 ::" -#: ../../tutorial/inputoutput.rst:411 +#: ../../tutorial/inputoutput.rst:418 msgid "" ">>> f.readline()\n" "'This is the first line of the file.\\n'\n" @@ -807,7 +807,7 @@ msgstr "" ">>> f.readline()\n" "''" -#: ../../tutorial/inputoutput.rst:418 +#: ../../tutorial/inputoutput.rst:425 msgid "" "For reading lines from a file, you can loop over the file object. This is " "memory efficient, fast, and leads to simple code::" @@ -815,7 +815,7 @@ msgstr "" "想從檔案中讀取多行時,可以對檔案物件進行迴圈。這種方法能有效地使用記憶體、快" "速,且程式碼簡潔: ::" -#: ../../tutorial/inputoutput.rst:421 +#: ../../tutorial/inputoutput.rst:428 msgid "" ">>> for line in f:\n" "... print(line, end='')\n" @@ -829,7 +829,7 @@ msgstr "" "This is the first line of the file.\n" "Second line of the file" -#: ../../tutorial/inputoutput.rst:427 +#: ../../tutorial/inputoutput.rst:434 msgid "" "If you want to read all the lines of a file in a list you can also use " "``list(f)`` or ``f.readlines()``." @@ -837,14 +837,14 @@ msgstr "" "如果你想把一個檔案的所有行讀進一個 list 裡,可以用 ``list(f)`` 或 ``f." "readlines()``。" -#: ../../tutorial/inputoutput.rst:430 +#: ../../tutorial/inputoutput.rst:437 msgid "" "``f.write(string)`` writes the contents of *string* to the file, returning " "the number of characters written. ::" msgstr "" "``f.write(string)`` 把 *string* 的內容寫入檔案,並回傳寫入的字元數。 ::" -#: ../../tutorial/inputoutput.rst:433 +#: ../../tutorial/inputoutput.rst:440 msgid "" ">>> f.write('This is a test\\n')\n" "15" @@ -852,7 +852,7 @@ msgstr "" ">>> f.write('This is a test\\n')\n" "15" -#: ../../tutorial/inputoutput.rst:436 +#: ../../tutorial/inputoutput.rst:443 msgid "" "Other types of objects need to be converted -- either to a string (in text " "mode) or a bytes object (in binary mode) -- before writing them::" @@ -860,7 +860,7 @@ msgstr "" "寫入其他類型的物件之前,要先把它們轉換為字串(文字模式)或位元組串物件(二進" "制模式): ::" -#: ../../tutorial/inputoutput.rst:439 +#: ../../tutorial/inputoutput.rst:446 msgid "" ">>> value = ('the answer', 42)\n" ">>> s = str(value) # convert the tuple to string\n" @@ -872,7 +872,7 @@ msgstr "" ">>> f.write(s)\n" "18" -#: ../../tutorial/inputoutput.rst:444 +#: ../../tutorial/inputoutput.rst:451 msgid "" "``f.tell()`` returns an integer giving the file object's current position in " "the file represented as number of bytes from the beginning of the file when " @@ -881,7 +881,7 @@ msgstr "" "``f.tell()`` 回傳一個整數,它給出檔案物件在檔案中的當前位置,在二進制模式下表" "示為檔案開始至今的位元組數,在文字模式下表示為一個意義不明的數字。" -#: ../../tutorial/inputoutput.rst:448 +#: ../../tutorial/inputoutput.rst:455 msgid "" "To change the file object's position, use ``f.seek(offset, whence)``. The " "position is computed from adding *offset* to a reference point; the " @@ -896,7 +896,7 @@ msgstr "" "為 0 時,表示使用檔案開頭,1 表示使用當前的檔案位置,2 表示使用檔案末端作為參" "考點。*whence* 可省略,其預設值為 0,即以檔案開頭作為參考點。 ::" -#: ../../tutorial/inputoutput.rst:455 +#: ../../tutorial/inputoutput.rst:462 msgid "" ">>> f = open('workfile', 'rb+')\n" ">>> f.write(b'0123456789abcdef')\n" @@ -922,7 +922,7 @@ msgstr "" ">>> f.read(1)\n" "b'd'" -#: ../../tutorial/inputoutput.rst:467 +#: ../../tutorial/inputoutput.rst:474 msgid "" "In text files (those opened without a ``b`` in the mode string), only seeks " "relative to the beginning of the file are allowed (the exception being " @@ -935,7 +935,7 @@ msgstr "" "的值,或是 0,才是有效的 *offset* 值。其他任何 *offset* 值都會產生未定義的行" "為。" -#: ../../tutorial/inputoutput.rst:473 +#: ../../tutorial/inputoutput.rst:480 msgid "" "File objects have some additional methods, such as :meth:`~io.IOBase.isatty` " "and :meth:`~io.IOBase.truncate` which are less frequently used; consult the " @@ -944,11 +944,11 @@ msgstr "" "檔案物件還有一些附加的 method,像是較不常使用的 :meth:`~io.IOBase.isatty` " "和 :meth:`~io.IOBase.truncate`;檔案物件的完整指南詳見程式庫參考手冊。" -#: ../../tutorial/inputoutput.rst:481 +#: ../../tutorial/inputoutput.rst:488 msgid "Saving structured data with :mod:`json`" msgstr "使用 :mod:`json` 儲存結構化資料" -#: ../../tutorial/inputoutput.rst:485 +#: ../../tutorial/inputoutput.rst:492 msgid "" "Strings can easily be written to and read from a file. Numbers take a bit " "more effort, since the :meth:`~io.TextIOBase.read` method only returns " @@ -963,7 +963,7 @@ msgstr "" "dictionary(字典)等複雜的資料類型時,手動剖析 (parsing) 和序列化 " "(serializing) 就變得複雜。" -#: ../../tutorial/inputoutput.rst:492 +#: ../../tutorial/inputoutput.rst:499 msgid "" "Rather than having users constantly writing and debugging code to save " "complicated data types to files, Python allows you to use the popular data " @@ -982,7 +982,7 @@ msgstr "" "則稱為 :dfn:`deserializing`\\ (反序列化)。在序列化和反序列化之間,表示物件" "的字串可以被儲存在檔案或資料中,或通過網路連接發送到遠端的機器。" -#: ../../tutorial/inputoutput.rst:503 +#: ../../tutorial/inputoutput.rst:510 msgid "" "The JSON format is commonly used by modern applications to allow for data " "exchange. Many programmers are already familiar with it, which makes it a " @@ -991,14 +991,14 @@ msgstr "" "JSON 格式經常地使用於現代應用程式的資料交換。許多程序設計師早已對它耳熟能詳," "使它成為提升互操作性 (interoperability) 的好選擇。" -#: ../../tutorial/inputoutput.rst:507 +#: ../../tutorial/inputoutput.rst:514 msgid "" "If you have an object ``x``, you can view its JSON string representation " "with a simple line of code::" msgstr "" "如果你有一個物件 ``x``,只需一行簡單的程式碼即可檢視它的 JSON 字串表示法: ::" -#: ../../tutorial/inputoutput.rst:510 +#: ../../tutorial/inputoutput.rst:517 msgid "" ">>> import json\n" ">>> x = [1, 'simple', 'list']\n" @@ -1010,7 +1010,7 @@ msgstr "" ">>> json.dumps(x)\n" "'[1, \"simple\", \"list\"]'" -#: ../../tutorial/inputoutput.rst:515 +#: ../../tutorial/inputoutput.rst:522 msgid "" "Another variant of the :func:`~json.dumps` function, called :func:`~json." "dump`, simply serializes the object to a :term:`text file`. So if ``f`` is " @@ -1020,11 +1020,11 @@ msgstr "" "列化為 :term:`text file`。因此,如果 ``f`` 是一個為了寫入而開啟的 :term:" "`text file` 物件,我們可以這樣做: ::" -#: ../../tutorial/inputoutput.rst:519 +#: ../../tutorial/inputoutput.rst:526 msgid "json.dump(x, f)" msgstr "json.dump(x, f)" -#: ../../tutorial/inputoutput.rst:521 +#: ../../tutorial/inputoutput.rst:528 msgid "" "To decode the object again, if ``f`` is a :term:`binary file` or :term:`text " "file` object which has been opened for reading::" @@ -1032,11 +1032,11 @@ msgstr "" "若 ``f`` 是一個已開啟、可讀取的 :term:`binary file` 或 :term:`text file` 物" "件,要再次解碼物件的話: ::" -#: ../../tutorial/inputoutput.rst:524 +#: ../../tutorial/inputoutput.rst:531 msgid "x = json.load(f)" msgstr "x = json.load(f)" -#: ../../tutorial/inputoutput.rst:527 +#: ../../tutorial/inputoutput.rst:534 msgid "" "JSON files must be encoded in UTF-8. Use ``encoding=\"utf-8\"`` when opening " "JSON file as a :term:`text file` for both of reading and writing." @@ -1044,7 +1044,7 @@ msgstr "" "JSON 檔案必須以 UTF-8 格式編碼。在開啟 JSON 檔案以作為一個可讀取與寫入的 :" "term:`text file` 時,要用 ``encoding=\"utf-8\"``。" -#: ../../tutorial/inputoutput.rst:530 +#: ../../tutorial/inputoutput.rst:537 msgid "" "This simple serialization technique can handle lists and dictionaries, but " "serializing arbitrary class instances in JSON requires a bit of extra " @@ -1055,11 +1055,11 @@ msgstr "" "class(類別)實例,則需要一些額外的工作。:mod:`json` 模組的參考資料包含對此的" "說明。" -#: ../../tutorial/inputoutput.rst:536 +#: ../../tutorial/inputoutput.rst:543 msgid ":mod:`pickle` - the pickle module" msgstr ":mod:`pickle` - pickle 模組" -#: ../../tutorial/inputoutput.rst:538 +#: ../../tutorial/inputoutput.rst:545 msgid "" "Contrary to :ref:`JSON `, *pickle* is a protocol which allows the " "serialization of arbitrarily complex Python objects. As such, it is " @@ -1073,26 +1073,54 @@ msgstr "" "通。在預設情況,它也是不安全的:如果資料是由手段高明的攻擊者精心設計,將這段" "來自於不受信任來源的 pickle 資料反序列化,可以執行任意的程式碼。" -#: ../../tutorial/inputoutput.rst:301 +#: ../../tutorial/inputoutput.rst:103 +msgid "formatted string literal" +msgstr "formatted string literal(格式化的字串常數)" + +#: ../../tutorial/inputoutput.rst:103 +msgid "interpolated string literal" +msgstr "interpolated string literal(內插字串常數)" + +#: ../../tutorial/inputoutput.rst:103 +msgid "string" +msgstr "string(字串)" + +#: ../../tutorial/inputoutput.rst:103 +msgid "formatted literal" +msgstr "formatted literal(格式化的文本)" + +#: ../../tutorial/inputoutput.rst:103 +msgid "interpolated literal" +msgstr "interpolated literal(插值常數)" + +#: ../../tutorial/inputoutput.rst:103 +msgid "f-string" +msgstr "f-string(f 字串)" + +#: ../../tutorial/inputoutput.rst:103 +msgid "fstring" +msgstr "fstring(f 字串)" + +#: ../../tutorial/inputoutput.rst:308 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../tutorial/inputoutput.rst:301 +#: ../../tutorial/inputoutput.rst:308 msgid "open" msgstr "open" -#: ../../tutorial/inputoutput.rst:301 +#: ../../tutorial/inputoutput.rst:308 msgid "object" msgstr "object(物件)" -#: ../../tutorial/inputoutput.rst:301 +#: ../../tutorial/inputoutput.rst:308 msgid "file" msgstr "file(檔案)" -#: ../../tutorial/inputoutput.rst:483 +#: ../../tutorial/inputoutput.rst:490 msgid "module" msgstr "module(模組)" -#: ../../tutorial/inputoutput.rst:483 +#: ../../tutorial/inputoutput.rst:490 msgid "json" msgstr "json" diff --git a/using/configure.po b/using/configure.po index a3a919df74..080a472bd9 100644 --- a/using/configure.po +++ b/using/configure.po @@ -479,7 +479,7 @@ msgstr "" #: ../../using/configure.rst:271 msgid "Object:" -msgstr "" +msgstr "物件:" #: ../../using/configure.rst:273 msgid "incref and decref;" @@ -2018,7 +2018,7 @@ msgstr "" #: ../../using/configure.rst:1438 msgid "Footnotes" -msgstr "" +msgstr "註腳" #: ../../using/configure.rst:1439 msgid "" diff --git a/using/ios.po b/using/ios.po index f2c2df9111..080e6a1879 100644 --- a/using/ios.po +++ b/using/ios.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -19,15 +18,15 @@ msgstr "" #: ../../using/ios.rst:5 msgid "Using Python on iOS" -msgstr "" +msgstr "在 iOS 上使用 Python" #: ../../using/ios.rst:0 msgid "Authors" -msgstr "" +msgstr "作者" #: ../../using/ios.rst:8 msgid "Russell Keith-Magee (2024-03)" -msgstr "" +msgstr "Russell Keith-Magee (2024-03)" #: ../../using/ios.rst:10 msgid "" @@ -318,7 +317,7 @@ msgstr "" #: ../../using/ios.rst:200 msgid "Build Options" -msgstr "" +msgstr "建置選項" #: ../../using/ios.rst:202 msgid "User Script Sandboxing: No" diff --git a/using/mac.po b/using/mac.po index 79ab0b1827..8d8653a3f1 100644 --- a/using/mac.po +++ b/using/mac.po @@ -403,7 +403,7 @@ msgstr "" #: ../../using/mac.rst:262 msgid "(Experimental)" -msgstr "" +msgstr "(實驗性的)" #: ../../using/mac.rst:266 msgid "" diff --git a/using/unix.po b/using/unix.po index ebbda0b865..e787864dc8 100644 --- a/using/unix.po +++ b/using/unix.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: 2023-03-27 12:40+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,21 +35,21 @@ msgstr "在 Linux 上" msgid "" "Python comes preinstalled on most Linux distributions, and is available as a " "package on all others. However there are certain features you might want to " -"use that are not available on your distro's package. You can easily compile " -"the latest version of Python from source." +"use that are not available on your distro's package. You can compile the " +"latest version of Python from source." msgstr "" "在大多數 Linux 發行版上會預先安裝 Python,並作為一個套件提供給所有其他使用" "者。但是發行版提供的套件可能沒有你想要使用的某些功能,這時你可以選擇從原始碼" -"編譯最新版本的 Python,做法相當容易。" +"編譯最新版本的 Python。" #: ../../using/unix.rst:23 msgid "" -"In the event that Python doesn't come preinstalled and isn't in the " -"repositories as well, you can easily make packages for your own distro. " -"Have a look at the following links:" +"In the event that the latest version of Python doesn't come preinstalled and " +"isn't in the repositories as well, you can make packages for your own " +"distro. Have a look at the following links:" msgstr "" -"如果 Python 沒有預先安裝,並且不在發行版提供的儲存庫 (repository) 中,你可以" -"輕鬆地為自己使用的發行版建立套件。參閱以下連結:" +"如果最新版的 Python 沒有預先安裝,並且不在發行版提供的儲存庫 (repository) " +"中,你可以輕鬆地為自己使用的發行版建立套件。參閱以下連結:" #: ../../using/unix.rst:29 msgid "https://www.debian.org/doc/manuals/maint-guide/first.en.html" diff --git a/using/windows.po b/using/windows.po index a61e7c9881..8ff3e1e9ed 100644 --- a/using/windows.po +++ b/using/windows.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -688,7 +688,7 @@ msgstr "" #: ../../using/windows.rst:315 ../../using/windows.rst:501 msgid "(Experimental)" -msgstr "" +msgstr "(實驗性的)" #: ../../using/windows.rst:319 ../../using/windows.rst:505 msgid "" @@ -1517,8 +1517,8 @@ msgstr "" #: ../../using/windows.rst:840 msgid "" -"The Company is matched on the full string, case-insenitive. The Tag is " -"matched oneither the full string, or a prefix, provided the next character " +"The Company is matched on the full string, case-insensitive. The Tag is " +"matched on either the full string, or a prefix, provided the next character " "is a dot or a hyphen. This allows ``-V:3.1`` to match ``3.1-32``, but not " "``3.10``. Tags are sorted using numerical ordering (``3.10`` is newer than " "``3.1``), but are compared using text (``-V:3.01`` does not match ``3.1``)." diff --git a/whatsnew/2.2.po b/whatsnew/2.2.po index 440d72550b..a20f58263f 100644 --- a/whatsnew/2.2.po +++ b/whatsnew/2.2.po @@ -151,7 +151,7 @@ msgstr "" #: ../../whatsnew/2.2.rst:100 msgid "Old and New Classes" -msgstr "" +msgstr "舊的和新的類別" #: ../../whatsnew/2.2.rst:102 msgid "" @@ -180,6 +180,10 @@ msgid "" " ...\n" " ..." msgstr "" +"class C(object):\n" +" def __init__ (self):\n" +" ...\n" +" ..." #: ../../whatsnew/2.2.rst:121 msgid "" @@ -205,6 +209,10 @@ msgid "" ">>> int('123')\n" "123" msgstr "" +">>> int\n" +"\n" +">>> int('123')\n" +"123" #: ../../whatsnew/2.2.rst:136 msgid "" @@ -221,6 +229,11 @@ msgid "" " return fcntl.lockf(self.fileno(), operation,\n" " length, start, whence)" msgstr "" +"class LockableFile(file):\n" +" def lock (self, operation, length=0, start=0, whence=0):\n" +" import fcntl\n" +" return fcntl.lockf(self.fileno(), operation,\n" +" length, start, whence)" #: ../../whatsnew/2.2.rst:146 msgid "" @@ -232,7 +245,7 @@ msgstr "" #: ../../whatsnew/2.2.rst:153 msgid "Descriptors" -msgstr "" +msgstr "描述器" #: ../../whatsnew/2.2.rst:155 msgid "" @@ -295,6 +308,8 @@ msgid "" "descriptor = obj.__class__.x\n" "descriptor.__get__(obj)" msgstr "" +"descriptor = obj.__class__.x\n" +"descriptor.__get__(obj)" #: ../../whatsnew/2.2.rst:189 msgid "" @@ -658,6 +673,8 @@ msgid "" "def __getitem__(self, index):\n" " return " msgstr "" +"def __getitem__(self, index):\n" +" return " #: ../../whatsnew/2.2.rst:433 msgid "" @@ -721,6 +738,21 @@ msgid "" "StopIteration\n" ">>>" msgstr "" +">>> L = [1,2,3]\n" +">>> i = iter(L)\n" +">>> print i\n" +"\n" +">>> i.next()\n" +"1\n" +">>> i.next()\n" +"2\n" +">>> i.next()\n" +"3\n" +">>> i.next()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in ?\n" +"StopIteration\n" +">>>" #: ../../whatsnew/2.2.rst:479 msgid "" @@ -742,6 +774,11 @@ msgid "" ">>> a,b,c\n" "(1, 2, 3)" msgstr "" +">>> L = [1,2,3]\n" +">>> i = iter(L)\n" +">>> a,b,c = i\n" +">>> a,b,c\n" +"(1, 2, 3)" #: ../../whatsnew/2.2.rst:493 msgid "" @@ -769,6 +806,22 @@ msgid "" "Dec 12\n" "Oct 10" msgstr "" +">>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,\n" +"... 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}\n" +">>> for key in m: print key, m[key]\n" +"...\n" +"Mar 3\n" +"Feb 2\n" +"Aug 8\n" +"Sep 9\n" +"May 5\n" +"Jun 6\n" +"Jul 7\n" +"Jan 1\n" +"Apr 4\n" +"Nov 11\n" +"Dec 12\n" +"Oct 10" #: ../../whatsnew/2.2.rst:513 msgid "" @@ -815,7 +868,7 @@ msgstr "" #: ../../whatsnew/2.2.rst:543 msgid "PEP 255: Simple Generators" -msgstr "" +msgstr "PEP 255:簡單產生器" #: ../../whatsnew/2.2.rst:545 msgid "" @@ -846,6 +899,9 @@ msgid "" " for i in range(N):\n" " yield i" msgstr "" +"def generate_ints(N):\n" +" for i in range(N):\n" +" yield i" #: ../../whatsnew/2.2.rst:563 msgid "" @@ -895,6 +951,20 @@ msgid "" " File \"\", line 2, in generate_ints\n" "StopIteration" msgstr "" +">>> gen = generate_ints(3)\n" +">>> gen\n" +"\n" +">>> gen.next()\n" +"0\n" +">>> gen.next()\n" +"1\n" +">>> gen.next()\n" +"2\n" +">>> gen.next()\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in ?\n" +" File \"\", line 2, in generate_ints\n" +"StopIteration" #: ../../whatsnew/2.2.rst:601 msgid "" @@ -962,6 +1032,8 @@ msgid "" "sentence := \"Store it in the neighboring harbor\"\n" "if (i := find(\"or\", sentence)) > 5 then write(i)" msgstr "" +"sentence := \"Store it in the neighboring harbor\"\n" +"if (i := find(\"or\", sentence)) > 5 then write(i)" #: ../../whatsnew/2.2.rst:645 msgid "" @@ -986,7 +1058,7 @@ msgstr "" #: ../../whatsnew/2.2.rst:662 msgid ":pep:`255` - Simple Generators" -msgstr "" +msgstr ":pep:`255` - 簡單產生器" #: ../../whatsnew/2.2.rst:663 msgid "" @@ -1030,6 +1102,10 @@ msgid "" ">>> 2 ** 64\n" "18446744073709551616L" msgstr "" +">>> 1234567890123\n" +"1234567890123L\n" +">>> 2 ** 64\n" +"18446744073709551616L" #: ../../whatsnew/2.2.rst:695 msgid "" @@ -1266,6 +1342,12 @@ msgid "" " return g(value-1) + 1\n" " ..." msgstr "" +"def f():\n" +" ...\n" +" def g(value):\n" +" ...\n" +" return g(value-1) + 1\n" +" ..." #: ../../whatsnew/2.2.rst:863 msgid "" @@ -1344,6 +1426,12 @@ msgid "" " def g():\n" " return x" msgstr "" +"x = 1\n" +"def f():\n" +" # 下一行為語法錯誤\n" +" exec 'x=2'\n" +" def g():\n" +" return x" #: ../../whatsnew/2.2.rst:917 msgid "" diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index 829ac57ea5..5a4af094ce 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2024-11-10 17:21+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-" @@ -1711,7 +1711,7 @@ msgid "Deprecated" msgstr "已棄用" #: ../../whatsnew/3.12.rst:1145 -#: ../../deprecations/pending-removal-in-3.14.rst:11 +#: ../../deprecations/pending-removal-in-3.14.rst:4 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" "argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " @@ -1730,32 +1730,32 @@ msgid "" msgstr "" #: ../../whatsnew/3.12.rst:1154 -#: ../../deprecations/pending-removal-in-3.14.rst:20 +#: ../../deprecations/pending-removal-in-3.14.rst:13 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" #: ../../whatsnew/3.12.rst:1155 -#: ../../deprecations/pending-removal-in-3.14.rst:21 +#: ../../deprecations/pending-removal-in-3.14.rst:14 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" #: ../../whatsnew/3.12.rst:1156 -#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.14.rst:15 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" #: ../../whatsnew/3.12.rst:1157 -#: ../../deprecations/pending-removal-in-3.14.rst:23 +#: ../../deprecations/pending-removal-in-3.14.rst:16 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" #: ../../whatsnew/3.12.rst:1158 -#: ../../deprecations/pending-removal-in-3.14.rst:24 +#: ../../deprecations/pending-removal-in-3.14.rst:17 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" #: ../../whatsnew/3.12.rst:1160 -#: ../../deprecations/pending-removal-in-3.14.rst:26 +#: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" "`90953`.)" @@ -1763,7 +1763,8 @@ msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" #: ../../whatsnew/3.12.rst:1163 -#: ../../deprecations/pending-removal-in-3.14.rst:29 +#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.16.rst:19 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" @@ -1776,7 +1777,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.12.rst:1171 -#: ../../deprecations/pending-removal-in-3.14.rst:37 +#: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" "`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." @@ -1789,7 +1790,7 @@ msgstr "" "除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../whatsnew/3.12.rst:1177 -#: ../../deprecations/pending-removal-in-3.14.rst:43 +#: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " "now emits a :exc:`DeprecationWarning` if there is no current event loop set " @@ -1844,37 +1845,37 @@ msgid "" msgstr ":mod:`importlib.abc`:棄用下列類別,預定於 Python 3.14 中移除:" #: ../../whatsnew/3.12.rst:1205 -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" #: ../../whatsnew/3.12.rst:1206 -#: ../../deprecations/pending-removal-in-3.14.rst:60 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" #: ../../whatsnew/3.12.rst:1207 -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" #: ../../whatsnew/3.12.rst:1209 -#: ../../deprecations/pending-removal-in-3.14.rst:63 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" #: ../../whatsnew/3.12.rst:1211 -#: ../../deprecations/pending-removal-in-3.14.rst:65 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" #: ../../whatsnew/3.12.rst:1212 -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" #: ../../whatsnew/3.12.rst:1214 -#: ../../deprecations/pending-removal-in-3.14.rst:68 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" @@ -1958,7 +1959,7 @@ msgstr "" "*onexc*。(由 Irit Katriel 於 :gh:`102828` 中貢獻。)" #: ../../whatsnew/3.12.rst:1267 -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" @@ -1994,7 +1995,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.12.rst:1290 -#: ../../deprecations/pending-removal-in-3.15.rst:62 +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" @@ -2058,9 +2059,12 @@ msgstr "" msgid "" "Accessing :attr:`~codeobject.co_lnotab` on code objects was deprecated in " "Python 3.10 via :pep:`626`, but it only got a proper :exc:" -"`DeprecationWarning` in 3.12, therefore it will be removed in 3.14. " -"(Contributed by Nikita Sobolev in :gh:`101866`.)" +"`DeprecationWarning` in 3.12. May be removed in 3.15. (Contributed by Nikita " +"Sobolev in :gh:`101866`.)" msgstr "" +"自 3.10 起,於程式碼物件存取 :attr:`~codeobject.co_lnotab` 的功能已在 :pep:" +"`626` 中被棄用,但只在 3.12 中於適時發出 :exc:`DeprecationWarning`。可能在 " +"3.15 中移除。(由 Nikita Sobolev 於 :gh:`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.13.rst:2 msgid "Pending Removal in Python 3.13" @@ -2241,23 +2245,7 @@ msgstr "" msgid "Pending Removal in Python 3.14" msgstr "Python 3.14 中待移除的項目" -#: ../../deprecations/pending-removal-in-3.14.rst:4 -#: ../../deprecations/pending-removal-in-3.15.rst:4 -msgid "The import system:" -msgstr "引入系統 (import system):" - -#: ../../deprecations/pending-removal-in-3.14.rst:6 -msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" -"`__spec__.loader ` is deprecated. In " -"Python 3.14, :attr:`!__loader__` will cease to be set or taken into " -"consideration by the import system or the standard library." -msgstr "" -"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " -"` 的做法已被棄用。在 Python 3.14 中," -"引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__` 。" - -#: ../../deprecations/pending-removal-in-3.14.rst:16 +#: ../../deprecations/pending-removal-in-3.14.rst:9 msgid "" ":mod:`ast`: The following features have been deprecated in documentation " "since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " @@ -2266,7 +2254,7 @@ msgstr "" ":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時會" "於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" -#: ../../deprecations/pending-removal-in-3.14.rst:31 +#: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" "The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" "`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" @@ -2278,7 +2266,7 @@ msgstr "" "AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " "Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:48 +#: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " @@ -2290,7 +2278,7 @@ msgstr "" "改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " "Shantanu Jain 於 :gh:`91896` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:54 +#: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" ":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" @@ -2298,11 +2286,11 @@ msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:50 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:70 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -2313,7 +2301,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:76 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -2330,7 +2318,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -2338,7 +2326,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:88 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -2348,23 +2336,23 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:93 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:95 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:100 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -2374,27 +2362,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:106 -msgid "" -"date and datetime adapter, date and timestamp converter: see the :mod:" -"`sqlite3` documentation for suggested replacement recipes." -msgstr "" -"date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" -"參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" - -#: ../../deprecations/pending-removal-in-3.14.rst:109 -msgid "" -":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " -"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " -"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " -"in 3.14. (Contributed by Nikita Sobolev in :gh:`101866`.)" -msgstr "" -":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" -"exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" -"`101866` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:116 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -2402,7 +2370,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:119 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -2416,6 +2384,11 @@ msgstr "" msgid "Pending Removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" +#: ../../deprecations/pending-removal-in-3.15.rst:4 +#: ../../deprecations/pending-removal-in-3.16.rst:4 +msgid "The import system:" +msgstr "引入系統 (import system):" + #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" "Setting :attr:`~module.__cached__` on a module while failing to set :attr:" @@ -2528,8 +2501,24 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" +#: ../../deprecations/pending-removal-in-3.15.rst:62 +msgid ":mod:`types`:" +msgstr ":mod:`types`:" + #: ../../deprecations/pending-removal-in-3.15.rst:64 msgid "" +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" +msgstr "" +":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.15.rst:73 +msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " "has been deprecated since Python 3.13. Use the class-based syntax or the " @@ -2539,7 +2528,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:70 +#: ../../deprecations/pending-removal-in-3.15.rst:79 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -2549,11 +2538,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:75 +#: ../../deprecations/pending-removal-in-3.15.rst:84 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:77 +#: ../../deprecations/pending-removal-in-3.15.rst:86 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -2564,32 +2553,25 @@ msgstr "" "getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 -msgid "Pending Removal in Python 3.16" +msgid "Pending removal in Python 3.16" msgstr "Python 3.16 中待移除的項目" -#: ../../deprecations/pending-removal-in-3.16.rst:4 -#: ../../deprecations/pending-removal-in-future.rst:12 -msgid ":mod:`builtins`:" -msgstr ":mod:`builtins`:" - #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " -"deprecated since Python 3.12, as it produces surprising and unintuitive " -"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " -"of a Boolean. In the rare case that you need the bitwise inversion of the " -"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." msgstr "" -"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" -"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" -"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " -"``~int(x)`` (``~int(x)``)。" +"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " +"` 的做法將於 Python 3.16 被棄用。在 " +"Python 3.16 中,引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__`。" -#: ../../deprecations/pending-removal-in-3.16.rst:13 +#: ../../deprecations/pending-removal-in-3.16.rst:11 msgid ":mod:`array`:" msgstr ":mod:`array`:" -#: ../../deprecations/pending-removal-in-3.16.rst:15 +#: ../../deprecations/pending-removal-in-3.16.rst:13 msgid "" "The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " "documentation since Python 3.3 and at runtime since Python 3.13. Use the " @@ -2600,10 +2582,35 @@ msgstr "" "來取代 Unicode 字元。" #: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid "" +":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " +"Python 3.16, use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"by Jiahao Li and Kumar Aditya in :gh:`122875`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:26 +#: ../../deprecations/pending-removal-in-future.rst:12 +msgid ":mod:`builtins`:" +msgstr ":mod:`builtins`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:28 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" +"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" +"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" +"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " +"``~int(x)`` (``~int(x)``)。" + +#: ../../deprecations/pending-removal-in-3.16.rst:35 msgid ":mod:`shutil`:" msgstr ":mod:`shutil`:" -#: ../../deprecations/pending-removal-in-3.16.rst:23 +#: ../../deprecations/pending-removal-in-3.16.rst:37 msgid "" "The :class:`!ExecError` exception has been deprecated since Python 3.14. It " "has not been used by any function in :mod:`!shutil` since Python 3.4, and is " @@ -2612,11 +2619,11 @@ msgstr "" "自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" "未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" -#: ../../deprecations/pending-removal-in-3.16.rst:28 +#: ../../deprecations/pending-removal-in-3.16.rst:42 msgid ":mod:`symtable`:" msgstr ":mod:`symtable`:" -#: ../../deprecations/pending-removal-in-3.16.rst:30 +#: ../../deprecations/pending-removal-in-3.16.rst:44 msgid "" "The :meth:`Class.get_methods ` method has been " "deprecated since Python 3.14." @@ -2624,11 +2631,11 @@ msgstr "" "自 Python 3.14 起,:meth:`Class.get_methods ` 方" "法已被棄用。" -#: ../../deprecations/pending-removal-in-3.16.rst:33 +#: ../../deprecations/pending-removal-in-3.16.rst:47 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" -#: ../../deprecations/pending-removal-in-3.16.rst:35 +#: ../../deprecations/pending-removal-in-3.16.rst:49 msgid "" "The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " "since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " @@ -2637,11 +2644,11 @@ msgstr "" "自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" "請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" -#: ../../deprecations/pending-removal-in-3.16.rst:39 +#: ../../deprecations/pending-removal-in-3.16.rst:53 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" -#: ../../deprecations/pending-removal-in-3.16.rst:41 +#: ../../deprecations/pending-removal-in-3.16.rst:55 msgid "" "The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " "deprecated since Python 3.13." @@ -4279,7 +4286,7 @@ msgstr "" #: ../../whatsnew/3.12.rst:1970 msgid "``sys.getunicodeinternedsize`` This returns the total number of unicode" -msgstr "" +msgstr "``sys.getunicodeinternedsize`` 這會回傳 unicode 的總數" #: ../../whatsnew/3.12.rst:1971 msgid "" @@ -5016,16 +5023,24 @@ msgstr "" "data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 -msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." -msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" +msgid "" +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." +"exec_prefix` instead." +msgstr "" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" +"`sys.exec_prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 -msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." -msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" +msgid "" +":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " +"instead." +msgstr "" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." +"prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." @@ -5228,105 +5243,3 @@ msgid "" msgstr "" "移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner 於 :gh:" "`85858` 中貢獻。)" - -#~ msgid "" -#~ ":mod:`platform`: :func:`~platform.java_ver` is deprecated and will be " -#~ "removed in 3.15. It was largely untested, had a confusing API, and was " -#~ "only useful for Jython support. (Contributed by Nikita Sobolev in :gh:" -#~ "`116349`.)" -#~ msgstr "" -#~ ":mod:`platform`::func:`~platform.java_ver` 已被棄用並將在 3.15 中移除。它" -#~ "幾乎沒有被測試過,API 令人困惑並且只對 Jython 支援有用。 (由 Nikita " -#~ "Sobolev 於 :gh:`116349` 貢獻。)" - -#~ msgid "" -#~ ":mod:`threading`: Passing any arguments to :func:`threading.RLock` is now " -#~ "deprecated. C version allows any numbers of args and kwargs, but they are " -#~ "just ignored. Python version does not allow any arguments. All arguments " -#~ "will be removed from :func:`threading.RLock` in Python 3.15. (Contributed " -#~ "by Nikita Sobolev in :gh:`102029`.)" -#~ msgstr "" -#~ ":mod:`threading`:對 :func:`threading.RLock` 傳遞任何引數現在已被棄用。C " -#~ "版本允許任意數量的引數和關鍵字引數,但它們會被忽略。Python 版本不允許任何" -#~ "引數。所有引數將在 Python 3.15 中從 :func:`threading.RLock` 中移除。 (由 " -#~ "Nikita Sobolev 於 :gh:`102029` 貢獻。)" - -#~ msgid ":class:`typing.NamedTuple`:" -#~ msgstr ":class:`typing.NamedTuple`:" - -#~ msgid "" -#~ "When using the functional syntax to create a :class:`!NamedTuple` class, " -#~ "failing to pass a value to the *fields* parameter (``NT = " -#~ "NamedTuple(\"NT\")``) is deprecated. Passing ``None`` to the *fields* " -#~ "parameter (``NT = NamedTuple(\"NT\", None)``) is also deprecated. Both " -#~ "will be disallowed in Python 3.15. To create a :class:`!NamedTuple` class " -#~ "with 0 fields, use ``class NT(NamedTuple): pass`` or ``NT = " -#~ "NamedTuple(\"NT\", [])``." -#~ msgstr "" -#~ "當使用函式語法來建立 :class:`!NamedTuple` 類別時,沒將值傳遞給 *fields* 參" -#~ "數的方式 (``NT = NamedTuple(\"NT\")``) 已被棄用,將 ``None`` 傳遞給 " -#~ "*fields* 參數(``NT = NamedTuple(\"NT\", None)``)也已被棄用。這兩者將在 " -#~ "Python 3.15 中會被禁止。要建立一個沒有欄位的 :class:`!NamedTuple` 類別,請" -#~ "使用 ``class NT(NamedTuple): pass`` 或 ``NT = NamedTuple(\"NT\", [])``。" - -#~ msgid "" -#~ ":class:`typing.TypedDict`: When using the functional syntax to create a :" -#~ "class:`!TypedDict` class, failing to pass a value to the *fields* " -#~ "parameter (``TD = TypedDict(\"TD\")``) is deprecated. Passing ``None`` to " -#~ "the *fields* parameter (``TD = TypedDict(\"TD\", None)``) is also " -#~ "deprecated. Both will be disallowed in Python 3.15. To create a :class:`!" -#~ "TypedDict` class with 0 fields, use ``class TD(TypedDict): pass`` or ``TD " -#~ "= TypedDict(\"TD\", {})``." -#~ msgstr "" -#~ ":class:`typing.TypedDict`:當使用函式語法來建立 :class:`!TypedDict` 類別" -#~ "時,沒將值傳遞給 *fields* 參數的方式(``TD = TypedDict(\"TD\")``)已被棄" -#~ "用,將 ``None`` 傳遞給 *fields* 參數(``TD = TypedDict(\"TD\", None)``)也" -#~ "已被棄用。這兩者將在 Python 3.15 中會被禁止。要建立一個沒有欄位的 :class:" -#~ "`!TypedDict` 類別,請使用 ``class TD(TypedDict): pass`` 或 ``TD = " -#~ "TypedDict(\"TD\", {})``。" - -#~ msgid "" -#~ ":mod:`array`: :class:`array.array` ``'u'`` type (:c:type:`wchar_t`): use " -#~ "the ``'w'`` type instead (``Py_UCS4``)." -#~ msgstr "" -#~ ":mod:`array`::class:`array.array` ``'u'`` 型別 (:c:type:`wchar_t`):請改" -#~ "用 ``'w'`` 型別 (``Py_UCS4``)。" - -#~ msgid ":mod:`builtins`: ``~bool``, bitwise inversion on bool." -#~ msgstr ":mod:`builtins`:``~bool``,對 bool 進行位元反轉。" - -#~ msgid "" -#~ ":mod:`symtable`: Deprecate :meth:`symtable.Class.get_methods` due to the " -#~ "lack of interest. (Contributed by Bénédikt Tran in :gh:`119698`.)" -#~ msgstr "" -#~ ":mod:`symtable`:由於並沒有太多關注,已棄用 :meth:`symtable.Class." -#~ "get_methods`。 (由 Bénédikt Tran 於 :gh:`119698` 貢獻。)" - -#~ msgid "" -#~ ":c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef` instead." -#~ msgstr ":c:func:`PyWeakref_GetObject`:請改用 :c:func:`PyWeakref_GetRef`。" - -#~ msgid ":c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead." -#~ msgstr ":c:type:`!Py_UNICODE_WIDE` type:請改用 :c:type:`wchar_t`。" - -#~ msgid "Notable changes in 3.12.4" -#~ msgstr "3.12.4 中的顯著變更" - -#~ msgid "ipaddress" -#~ msgstr "ipaddress" - -#~ msgid "" -#~ "Fixed ``is_global`` and ``is_private`` behavior in ``IPv4Address``, " -#~ "``IPv6Address``, ``IPv4Network`` and ``IPv6Network``." -#~ msgstr "" -#~ "修正 ``IPv4Address``、``IPv6Address``、``IPv4Network`` 和 ``IPv6Network`` " -#~ "中的 ``is_global`` 和 ``is_private`` 行為。" - -#~ msgid "Notable changes in 3.12.5" -#~ msgstr "3.12.5 中的顯著變更" - -#~ msgid "email" -#~ msgstr "email" - -#~ msgid "Notable changes in 3.12.6" -#~ msgstr "3.12.6 中的顯著變更" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index f41fa1d4c1..bbc57bb4aa 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-15 00:14+0000\n" +"POT-Creation-Date: 2024-11-10 17:21+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-" @@ -437,7 +437,8 @@ msgid "" " ^^^^^^^^^^^^^^\n" "AttributeError: module 'random' has no attribute 'randint' (consider " "renaming '/home/me/random.py' since it has the same name as the standard " -"library module named 'random' and the import system gives it precedence)" +"library module named 'random' and prevents importing that standard library " +"module)" msgstr "" "$ python random.py\n" "Traceback (most recent call last):\n" @@ -448,7 +449,8 @@ msgstr "" " ^^^^^^^^^^^^^^\n" "AttributeError: module 'random' has no attribute 'randint' (consider " "renaming '/home/me/random.py' since it has the same name as the standard " -"library module named 'random' and the import system gives it precedence)" +"library module named 'random' and prevents importing that standard library " +"module)" #: ../../whatsnew/3.13.rst:279 msgid "" @@ -467,8 +469,8 @@ msgid "" " np.array([1, 2, 3])\n" " ^^^^^^^^\n" "AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/" -"home/me/numpy.py' if it has the same name as a third-party module you " -"intended to import)" +"home/me/numpy.py' if it has the same name as a library you intended to " +"import)" msgstr "" "$ python numpy.py\n" "Traceback (most recent call last):\n" @@ -478,8 +480,7 @@ msgstr "" " np.array([1, 2, 3])\n" " ^^^^^^^^\n" "AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/" -"home/me/numpy.py' if it has the same name as a third-party module you " -"intended to import)" +"home/me/numpy.py' if it has the same name as a library you intended to " #: ../../whatsnew/3.13.rst:294 msgid "(Contributed by Shantanu Jain in :gh:`95754`.)" @@ -2592,7 +2593,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1758 -#: ../../deprecations/pending-removal-in-3.16.rst:13 +#: ../../deprecations/pending-removal-in-3.16.rst:11 msgid ":mod:`array`:" msgstr ":mod:`array`:" @@ -2759,7 +2760,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1862 -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" @@ -2790,7 +2791,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1884 -#: ../../deprecations/pending-removal-in-3.16.rst:33 +#: ../../deprecations/pending-removal-in-3.16.rst:47 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" @@ -2802,7 +2803,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1891 -#: ../../deprecations/pending-removal-in-3.16.rst:39 +#: ../../deprecations/pending-removal-in-3.16.rst:53 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" @@ -2824,7 +2825,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1903 -#: ../../deprecations/pending-removal-in-3.15.rst:62 +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" @@ -2866,7 +2867,7 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1936 -#: ../../deprecations/pending-removal-in-3.15.rst:75 +#: ../../deprecations/pending-removal-in-3.15.rst:84 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" @@ -2884,22 +2885,6 @@ msgid "Pending Removal in Python 3.14" msgstr "Python 3.14 中待移除的項目" #: ../../deprecations/pending-removal-in-3.14.rst:4 -#: ../../deprecations/pending-removal-in-3.15.rst:4 -msgid "The import system:" -msgstr "引入系統 (import system):" - -#: ../../deprecations/pending-removal-in-3.14.rst:6 -msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" -"`__spec__.loader ` is deprecated. In " -"Python 3.14, :attr:`!__loader__` will cease to be set or taken into " -"consideration by the import system or the standard library." -msgstr "" -"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " -"` 的做法已被棄用。在 Python 3.14 中," -"引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__` 。" - -#: ../../deprecations/pending-removal-in-3.14.rst:11 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" "argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " @@ -2909,7 +2894,7 @@ msgstr "" "*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " "於 :gh:`92248` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:16 +#: ../../deprecations/pending-removal-in-3.14.rst:9 msgid "" ":mod:`ast`: The following features have been deprecated in documentation " "since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " @@ -2918,38 +2903,39 @@ msgstr "" ":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時會" "於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" -#: ../../deprecations/pending-removal-in-3.14.rst:20 +#: ../../deprecations/pending-removal-in-3.14.rst:13 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" -#: ../../deprecations/pending-removal-in-3.14.rst:21 +#: ../../deprecations/pending-removal-in-3.14.rst:14 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" -#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.14.rst:15 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" -#: ../../deprecations/pending-removal-in-3.14.rst:23 +#: ../../deprecations/pending-removal-in-3.14.rst:16 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" -#: ../../deprecations/pending-removal-in-3.14.rst:24 +#: ../../deprecations/pending-removal-in-3.14.rst:17 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" -#: ../../deprecations/pending-removal-in-3.14.rst:26 +#: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" "`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:29 +#: ../../deprecations/pending-removal-in-3.14.rst:22 +#: ../../deprecations/pending-removal-in-3.16.rst:19 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" -#: ../../deprecations/pending-removal-in-3.14.rst:31 +#: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" "The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" "`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" @@ -2961,7 +2947,7 @@ msgstr "" "AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " "Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:37 +#: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" "`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." @@ -2973,7 +2959,7 @@ msgstr "" "AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" "除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:43 +#: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " "now emits a :exc:`DeprecationWarning` if there is no current event loop set " @@ -2984,7 +2970,7 @@ msgstr "" "件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:48 +#: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " @@ -2996,7 +2982,7 @@ msgstr "" "改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " "Shantanu Jain 於 :gh:`91896` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:54 +#: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" ":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" @@ -3004,39 +2990,39 @@ msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:50 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:60 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:63 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:65 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:68 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:70 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -3047,7 +3033,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:76 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -3064,7 +3050,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -3072,7 +3058,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:88 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -3082,23 +3068,23 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:93 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:95 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:100 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -3108,27 +3094,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:106 -msgid "" -"date and datetime adapter, date and timestamp converter: see the :mod:" -"`sqlite3` documentation for suggested replacement recipes." -msgstr "" -"date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" -"參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" - -#: ../../deprecations/pending-removal-in-3.14.rst:109 -msgid "" -":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " -"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " -"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " -"in 3.14. (Contributed by Nikita Sobolev in :gh:`101866`.)" -msgstr "" -":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" -"exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" -"`101866` 貢獻。)" - -#: ../../deprecations/pending-removal-in-3.14.rst:116 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -3136,7 +3102,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:119 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -3150,6 +3116,11 @@ msgstr "" msgid "Pending Removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" +#: ../../deprecations/pending-removal-in-3.15.rst:4 +#: ../../deprecations/pending-removal-in-3.16.rst:4 +msgid "The import system:" +msgstr "引入系統 (import system):" + #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" "Setting :attr:`~module.__cached__` on a module while failing to set :attr:" @@ -3246,8 +3217,24 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" +#: ../../deprecations/pending-removal-in-3.15.rst:62 +msgid ":mod:`types`:" +msgstr ":mod:`types`:" + #: ../../deprecations/pending-removal-in-3.15.rst:64 msgid "" +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" +msgstr "" +":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.15.rst:73 +msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " "has been deprecated since Python 3.13. Use the class-based syntax or the " @@ -3257,7 +3244,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:70 +#: ../../deprecations/pending-removal-in-3.15.rst:79 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -3267,7 +3254,7 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:77 +#: ../../deprecations/pending-removal-in-3.15.rst:86 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -3278,15 +3265,43 @@ msgstr "" "getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 -msgid "Pending Removal in Python 3.16" +msgid "Pending removal in Python 3.16" msgstr "Python 3.16 中待移除的項目" -#: ../../deprecations/pending-removal-in-3.16.rst:4 +#: ../../deprecations/pending-removal-in-3.16.rst:6 +msgid "" +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader ` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." +msgstr "" +"在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " +"` 的做法將於 Python 3.16 被棄用。在 " +"Python 3.16 中,引入系統或標準函式庫將不再設定或考慮 :attr:`!__loader__`。" + +#: ../../deprecations/pending-removal-in-3.16.rst:13 +msgid "" +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." +msgstr "" +"自 Python 3.3 起,``'u'`` 格式碼 (:c:type:`wchar_t`) 在文件中已被棄用,自 " +"Python 3.13 起在 runtime 已被棄用。請使用 ``'w'`` 格式碼 (:c:type:`Py_UCS4`) " +"來取代 Unicode 字元。" + +#: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid "" +":func:`!asyncio.iscoroutinefunction` is deprecated and will be removed in " +"Python 3.16, use :func:`inspect.iscoroutinefunction` instead. (Contributed " +"by Jiahao Li and Kumar Aditya in :gh:`122875`.)" +msgstr "" + +#: ../../deprecations/pending-removal-in-3.16.rst:26 #: ../../deprecations/pending-removal-in-future.rst:12 msgid ":mod:`builtins`:" msgstr ":mod:`builtins`:" -#: ../../deprecations/pending-removal-in-3.16.rst:6 +#: ../../deprecations/pending-removal-in-3.16.rst:28 msgid "" "Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " "deprecated since Python 3.12, as it produces surprising and unintuitive " @@ -3299,21 +3314,11 @@ msgstr "" "邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " "``~int(x)`` (``~int(x)``)。" -#: ../../deprecations/pending-removal-in-3.16.rst:15 -msgid "" -"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " -"documentation since Python 3.3 and at runtime since Python 3.13. Use the " -"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." -msgstr "" -"自 Python 3.3 起,``'u'`` 格式碼 (:c:type:`wchar_t`) 在文件中已被棄用,自 " -"Python 3.13 起在 runtime 已被棄用。請使用 ``'w'`` 格式碼 (:c:type:`Py_UCS4`) " -"來取代 Unicode 字元。" - -#: ../../deprecations/pending-removal-in-3.16.rst:21 +#: ../../deprecations/pending-removal-in-3.16.rst:35 msgid ":mod:`shutil`:" msgstr ":mod:`shutil`:" -#: ../../deprecations/pending-removal-in-3.16.rst:23 +#: ../../deprecations/pending-removal-in-3.16.rst:37 msgid "" "The :class:`!ExecError` exception has been deprecated since Python 3.14. It " "has not been used by any function in :mod:`!shutil` since Python 3.4, and is " @@ -3322,11 +3327,11 @@ msgstr "" "自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" "未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" -#: ../../deprecations/pending-removal-in-3.16.rst:28 +#: ../../deprecations/pending-removal-in-3.16.rst:42 msgid ":mod:`symtable`:" msgstr ":mod:`symtable`:" -#: ../../deprecations/pending-removal-in-3.16.rst:30 +#: ../../deprecations/pending-removal-in-3.16.rst:44 msgid "" "The :meth:`Class.get_methods ` method has been " "deprecated since Python 3.14." @@ -3334,7 +3339,7 @@ msgstr "" "自 Python 3.14 起,:meth:`Class.get_methods ` 方" "法已被棄用。" -#: ../../deprecations/pending-removal-in-3.16.rst:35 +#: ../../deprecations/pending-removal-in-3.16.rst:49 msgid "" "The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " "since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " @@ -3343,7 +3348,7 @@ msgstr "" "自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" "請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" -#: ../../deprecations/pending-removal-in-3.16.rst:41 +#: ../../deprecations/pending-removal-in-3.16.rst:55 msgid "" "The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " "deprecated since Python 3.13." @@ -4570,7 +4575,6 @@ msgstr "" "data:`!warnings.filters`。" #: ../../whatsnew/3.13.rst:2418 -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" @@ -4580,7 +4584,6 @@ msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" #: ../../whatsnew/3.13.rst:2422 -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" @@ -4867,6 +4870,22 @@ msgstr "" msgid "Python initialization functions:" msgstr "Python 初始化函式:" +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 +msgid "" +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." +"exec_prefix` instead." +msgstr "" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" +"`sys.exec_prefix`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid "" +":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " +"instead." +msgstr "" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." +"prefix`。" + #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" "The following APIs are deprecated and will be removed, although there is " @@ -5349,3 +5368,10 @@ msgid "" "interpreter, before ``site.py`` is executed. (Contributed by Łukasz Langa " "in :gh:`110769`.)" msgstr "" + +#~ msgid "" +#~ "date and datetime adapter, date and timestamp converter: see the :mod:" +#~ "`sqlite3` documentation for suggested replacement recipes." +#~ msgstr "" +#~ "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 " +#~ "(converter):請參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" From 889bd64f53f554774fef59eddc3006f901bb1726 Mon Sep 17 00:00:00 2001 From: Matt Wang Date: Mon, 28 Oct 2024 16:02:07 +0800 Subject: [PATCH 50/89] translate the first half of `library/signal.po` --- library/signal.po | 191 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 144 insertions(+), 47 deletions(-) diff --git a/library/signal.po b/library/signal.po index ca7802204d..9ffd90409f 100644 --- a/library/signal.po +++ b/library/signal.po @@ -27,11 +27,11 @@ msgstr "**原始碼:**\\ :source:`Lib/signal.py`" #: ../../library/signal.rst:11 msgid "This module provides mechanisms to use signal handlers in Python." -msgstr "" +msgstr "本模組提供於 Python 中使用訊號處理程式的機制。" #: ../../library/signal.rst:15 msgid "General rules" -msgstr "" +msgstr "一般規則" #: ../../library/signal.rst:17 msgid "" @@ -42,6 +42,10 @@ msgid "" "translated into a :exc:`KeyboardInterrupt` exception if the parent process " "has not changed it." msgstr "" +":func:`signal.signal` 函式允許定義自訂的處理程式,會在收到訊號時執行。我們安" +"裝了少數的預設處理程式::const:`SIGPIPE` 會被忽略 (所以管道和 socket 上的寫入" +"錯誤可以當作一般的 Python 例外報告),而 :const:`SIGINT`\\ (如果父行程沒有改" +"變它的話)會被轉換成 :exc:`KeyboardInterrupt` 例外。" #: ../../library/signal.rst:24 msgid "" @@ -50,6 +54,9 @@ msgid "" "underlying implementation), with the exception of the handler for :const:" "`SIGCHLD`, which follows the underlying implementation." msgstr "" +"特定訊號的處理程式一旦被設定,就會一直被安裝,直到被明確地重設為止 (不管底層" +"的實作為何,Python 皆模擬出 BSD 風格的介面),但 :const:`SIGCHLD` 的處理程式除" +"外,它會跟隨底層的實作。" #: ../../library/signal.rst:29 msgid "" @@ -57,10 +64,12 @@ msgid "" "differently. Several functions and signals are not available on these " "platforms." msgstr "" +"在 WebAssembly 平台上,訊號是模擬出來的,故行為不同。有幾個函式和訊號在這些平" +"台上是不可用的。" #: ../../library/signal.rst:34 msgid "Execution of Python signal handlers" -msgstr "" +msgstr "Python 訊號處理程式的執行" #: ../../library/signal.rst:36 msgid "" @@ -70,6 +79,10 @@ msgid "" "handler at a later point(for example at the next :term:`bytecode` " "instruction). This has consequences:" msgstr "" +"Python 訊號處理程式不會在低階(C 語言)訊號處理程式中執行。相反地,低階訊號處" +"理程式會設定一個旗標,告訴\\ :term:`虛擬機 `\\ 在稍後執行相" +"對應的 Python 訊號處理程式(例如在下一個 :term:`bytecode` 指令)。這會有後" +"果:" #: ../../library/signal.rst:42 msgid "" @@ -80,6 +93,10 @@ msgid "" "onwards, you can use the :mod:`faulthandler` module to report on synchronous " "errors." msgstr "" +"捕捉像 :const:`SIGFPE` 或 :const:`SIGSEGV` 這類由 C 程式碼中無效操作所引起的" +"同步錯誤是沒有意義的。Python 將從訊號處理程式中回傳到 C 程式碼,而 C 程式碼很" +"可能再次引發相同的訊號,導致 Python 明顯掛斷。從 Python 3.3 開始,你可以使" +"用 :mod:`faulthandler` 模組來報告同步錯誤。" #: ../../library/signal.rst:49 msgid "" @@ -88,6 +105,9 @@ msgid "" "arbitrary amount of time, regardless of any signals received. The Python " "signal handlers will be called when the calculation finishes." msgstr "" +"純粹以 C 實作的長時間計算(例如在大量文字上的正規表示式比對)可能會不間斷地運" +"行任意長度的時間而不考慮收到的任何訊號。當計算完成時,Python 訊號處理程式會被" +"呼叫。" #: ../../library/signal.rst:54 msgid "" @@ -95,10 +115,12 @@ msgid "" "the main thread. See the :ref:`note below ` for a " "discussion." msgstr "" +"如果處理程式引發例外,就會在主執行緒中「憑空」產生例外。請參閱\\ :ref:`下面的" +"說明 `。" #: ../../library/signal.rst:62 msgid "Signals and threads" -msgstr "" +msgstr "訊號和執行緒" #: ../../library/signal.rst:64 msgid "" @@ -108,12 +130,15 @@ msgid "" "You can use the synchronization primitives from the :mod:`threading` module " "instead." msgstr "" +"Python 訊號處理程式總是在主直譯器的主 Python 執行緒中執行,即使訊號是在另一個" +"執行緒中接收到的。這意味著訊號不能用來做為執行緒間通訊的方式。你可以使用 :" +"mod:`threading` 模組的同步原語 (synchronization primitive) 來代替。" #: ../../library/signal.rst:69 msgid "" "Besides, only the main thread of the main interpreter is allowed to set a " "new signal handler." -msgstr "" +msgstr "此外,只有主直譯器的主執行緒才被允許設定新的訊號處理程式。" #: ../../library/signal.rst:73 msgid "Module contents" @@ -129,27 +154,36 @@ msgid "" "`sigwait` functions return human-readable :class:`enums ` as :" "class:`Signals` objects." msgstr "" +"下面列出的訊號 (SIG*)、處理器(:const:`SIG_DFL`、:const:`SIG_IGN`)和訊號遮" +"罩 (sigmask)(:const:`SIG_BLOCK`、:const:`SIG_UNBLOCK`、:const:" +"`SIG_SETMASK`)相關常數被轉換成 :class:`enums `\\ (:class:" +"`Signals`、:class:`Handlers` 和 :class:`Sigmasks`)。:func:`getsignal`、:" +"func:`pthread_sigmask`、:func:`sigpending` 和 :func:`sigwait` 函式會回傳可被" +"人類讀取的\\ :class:`枚舉 `\\ 作為 :class:`Signals` 物件。" #: ../../library/signal.rst:85 msgid "The signal module defines three enums:" -msgstr "" +msgstr "訊號模組定義了三個枚舉:" #: ../../library/signal.rst:89 msgid "" ":class:`enum.IntEnum` collection of SIG* constants and the CTRL_* constants." -msgstr "" +msgstr "SIG* 常數和 CTRL_* 常數的 :class:`enum.IntEnum` 集合。" #: ../../library/signal.rst:95 msgid "" ":class:`enum.IntEnum` collection the constants :const:`SIG_DFL` and :const:" "`SIG_IGN`." msgstr "" +":const:`SIG_DFL` 和 :const:`SIG_IGN` 常數的 :class:`enum.IntEnum` 集合。" #: ../../library/signal.rst:101 msgid "" ":class:`enum.IntEnum` collection the constants :const:`SIG_BLOCK`, :const:" "`SIG_UNBLOCK` and :const:`SIG_SETMASK`." msgstr "" +":const:`SIG_BLOCK`、:const:`SIG_UNBLOCK` 和 :const:`SIG_SETMASK` 常數的 :" +"class:`enum.IntEnum` 集合。" #: ../../library/signal.rst:103 ../../library/signal.rst:136 #: ../../library/signal.rst:142 ../../library/signal.rst:148 @@ -173,12 +207,12 @@ msgid "" "See the man page :manpage:`sigprocmask(2)` and :manpage:`pthread_sigmask(3)` " "for further information." msgstr "" -"更多資訊請見 :manpage:`sigprocmask(2)` 與 :manpage:`pthread_sigmask(3)` 手冊" -"頁。" +"更多資訊請見 :manpage:`sigprocmask(2)` 與 :manpage:`pthread_sigmask(3)` 線上" +"手冊。" #: ../../library/signal.rst:111 msgid "The variables defined in the :mod:`signal` module are:" -msgstr "" +msgstr "在 :mod:`signal` 模組中定義的變數有:" #: ../../library/signal.rst:116 msgid "" @@ -187,32 +221,35 @@ msgid "" "default action for :const:`SIGQUIT` is to dump core and exit, while the " "default action for :const:`SIGCHLD` is to simply ignore it." msgstr "" +"這是兩種標準訊號處理選項之一;它會簡單地執行訊號的預設功能。例如,在大多數系" +"統上,:const:`SIGQUIT` 的預設動作是轉儲 (dump) 核心並退出,而 :const:" +"`SIGCHLD` 的預設動作是直接忽略。" #: ../../library/signal.rst:124 msgid "" "This is another standard signal handler, which will simply ignore the given " "signal." -msgstr "" +msgstr "這是另一個標準的訊號處理程式,會直接忽略給定的訊號。" #: ../../library/signal.rst:130 msgid "Abort signal from :manpage:`abort(3)`." -msgstr "" +msgstr "來自 :manpage:`abort(3)` 的中止訊號。" #: ../../library/signal.rst:134 msgid "Timer signal from :manpage:`alarm(2)`." -msgstr "" +msgstr "來自 :manpage:`alarm(2)` 的計時器訊號。" #: ../../library/signal.rst:140 msgid "Interrupt from keyboard (CTRL + BREAK)." -msgstr "" +msgstr "從鍵盤中斷 (CTRL + BREAK)。" #: ../../library/signal.rst:146 msgid "Bus error (bad memory access)." -msgstr "" +msgstr "匯流排錯誤(記憶體存取不良)。" #: ../../library/signal.rst:152 msgid "Child process stopped or terminated." -msgstr "" +msgstr "子行程停止或終止。" #: ../../library/signal.rst:158 msgid "Alias to :data:`SIGCHLD`." @@ -220,82 +257,87 @@ msgstr ":data:`SIGCHLD` 的別名。" #: ../../library/signal.rst:164 msgid "Continue the process if it is currently stopped" -msgstr "" +msgstr "如果目前行程是被停止的,則繼續運行" #: ../../library/signal.rst:170 msgid "Floating-point exception. For example, division by zero." -msgstr "" +msgstr "浮點運算例外。例如除以零。" #: ../../library/signal.rst:173 msgid "" ":exc:`ZeroDivisionError` is raised when the second argument of a division or " "modulo operation is zero." msgstr "" +":exc:`ZeroDivisionError` 會在除法或模運算 (modulo operation) 的第二個引數為零" +"時引發。" #: ../../library/signal.rst:178 msgid "" "Hangup detected on controlling terminal or death of controlling process." -msgstr "" +msgstr "偵測到控制終端機掛斷 (hangup) 或控制行程死亡。" #: ../../library/signal.rst:184 msgid "Illegal instruction." -msgstr "" +msgstr "非法指令。" #: ../../library/signal.rst:188 msgid "Interrupt from keyboard (CTRL + C)." -msgstr "" +msgstr "從鍵盤中斷 (CTRL + C)。" #: ../../library/signal.rst:190 msgid "Default action is to raise :exc:`KeyboardInterrupt`." -msgstr "" +msgstr "預設動作是引發 :exc:`KeyboardInterrupt`。" #: ../../library/signal.rst:194 msgid "Kill signal." -msgstr "" +msgstr "殺死訊號。" #: ../../library/signal.rst:196 msgid "It cannot be caught, blocked, or ignored." -msgstr "" +msgstr "它無法被捕捉、阻擋或忽略。" #: ../../library/signal.rst:202 msgid "Broken pipe: write to pipe with no readers." -msgstr "" +msgstr "管道中斷 (broken pipe):寫到沒有讀取器 (reader) 的管道。" #: ../../library/signal.rst:204 msgid "Default action is to ignore the signal." -msgstr "" +msgstr "預設動作是忽略訊號。" #: ../../library/signal.rst:210 msgid "Segmentation fault: invalid memory reference." -msgstr "" +msgstr "記憶體區段錯誤 (segmentation fault):無效記憶體參照。" #: ../../library/signal.rst:214 msgid "" "Stack fault on coprocessor. The Linux kernel does not raise this signal: it " "can only be raised in user space." msgstr "" +"輔助處理器 (coprocessor) 上的堆疊錯誤 (stack fault)。Linux 核心不會引發此訊" +"號:它只能在使用者空間中引發。" #: ../../library/signal.rst:219 msgid "" "On architectures where the signal is available. See the man page :manpage:" "`signal(7)` for further information." msgstr "" +"在訊號可用的架構上。請參閱 :manpage:`signal(7)` 線上手冊以取得更多資訊。" #: ../../library/signal.rst:226 msgid "Termination signal." -msgstr "" +msgstr "終止訊號。" #: ../../library/signal.rst:230 msgid "User-defined signal 1." -msgstr "" +msgstr "使用者定義訊號 1。" #: ../../library/signal.rst:236 msgid "User-defined signal 2." -msgstr "" +msgstr "使用者定義訊號 2。" #: ../../library/signal.rst:242 msgid "Window resize signal." -msgstr "" +msgstr "視窗調整大小訊號。" #: ../../library/signal.rst:248 msgid "" @@ -307,36 +349,46 @@ msgid "" "`signal(7)`). Note that not all systems define the same set of signal names; " "only those names defined by the system are defined by this module." msgstr "" +"所有的訊號編號都是以符號定義的。例如,掛斷訊號被定義為 :const:`signal." +"SIGHUP`;變數名稱與 C 程式中使用的名稱相同,可在 ```` 中找到。Unix " +"線上手冊 ':c:func:`signal`' 列出了現有的訊號(在某些系統上是 :manpage:" +"`signal(2)`,在其他系統上是在 :manpage:`signal(7)` 中)。請注意,並非所有系統" +"都會定義同一套訊號名稱;只有那些由系統所定義的名稱才會由這個模組定義。" #: ../../library/signal.rst:259 msgid "" "The signal corresponding to the :kbd:`Ctrl+C` keystroke event. This signal " "can only be used with :func:`os.kill`." msgstr "" +"與 :kbd:`Ctrl+C` 擊鍵 (keystroke) 事件相對應的訊號。此訊號只能與 :func:`os." +"kill` 搭配使用。" #: ../../library/signal.rst:269 msgid "" "The signal corresponding to the :kbd:`Ctrl+Break` keystroke event. This " "signal can only be used with :func:`os.kill`." msgstr "" +"與 :kbd:`Ctrl+Break` 擊鍵事件相對應的訊號。此訊號只能與 :func:`os.kill` 搭配" +"使用。" #: ../../library/signal.rst:279 msgid "" "One more than the number of the highest signal number. Use :func:" "`valid_signals` to get valid signal numbers." msgstr "" +"比最高編號訊號的編號多一。使用 :func:`valid_signals` 來取得有效的訊號編號。" #: ../../library/signal.rst:285 msgid "" "Decrements interval timer in real time, and delivers :const:`SIGALRM` upon " "expiration." -msgstr "" +msgstr "即時減少間隔計時器 (interval timer),並在到期時送出 :const:`SIGALRM`。" #: ../../library/signal.rst:291 msgid "" "Decrements interval timer only when the process is executing, and delivers " "SIGVTALRM upon expiration." -msgstr "" +msgstr "僅在執行行程時遞減間隔計時器,並在到期時傳送 SIGVTALRM。" #: ../../library/signal.rst:297 msgid "" @@ -345,28 +397,33 @@ msgid "" "timer is usually used to profile the time spent by the application in user " "and kernel space. SIGPROF is delivered upon expiration." msgstr "" +"當行程執行或系統代表行程執行時,都會減少間隔計時器。與 ITIMER_VIRTUAL 配合," +"這個計時器通常用來分析 (profile) 應用程式在使用者空間 (user space) 與核心空" +"間 (kernel space) 所花費的時間。SIGPROF 會在到期時傳送。" #: ../../library/signal.rst:305 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that signals are to be blocked." -msgstr "" +msgstr ":func:`pthread_sigmask` 的 *how* 參數的可能值,表示訊號將被阻檔。" #: ../../library/signal.rst:312 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that signals are to be unblocked." -msgstr "" +msgstr ":func:`pthread_sigmask` 的 *how* 參數的可能值,表示訊號將被解除阻檔。" #: ../../library/signal.rst:319 msgid "" "A possible value for the *how* parameter to :func:`pthread_sigmask` " "indicating that the signal mask is to be replaced." msgstr "" +":func:`pthread_sigmask` 的 *how* 參數的可能值,表示訊號遮罩 (signal mask) 要" +"被取代。" #: ../../library/signal.rst:325 msgid "The :mod:`signal` module defines one exception:" -msgstr "" +msgstr ":mod:`signal` 模組定義了一個例外:" #: ../../library/signal.rst:329 msgid "" @@ -375,16 +432,19 @@ msgid "" "or a negative time is passed to :func:`setitimer`. This error is a subtype " "of :exc:`OSError`." msgstr "" +"當 :func:`setitimer` 或 :func:`getitimer` 底層實作發生錯誤時引發訊號。如果傳" +"給 :func:`setitimer` 的是無效的間隔計時器或負數時間,則預期會發生此錯誤。這個" +"錯誤是 :exc:`OSError` 的子型別。" #: ../../library/signal.rst:334 msgid "" "This error used to be a subtype of :exc:`IOError`, which is now an alias of :" "exc:`OSError`." -msgstr "" +msgstr "此錯誤過去是 :exc:`IOError` 的子型別,現在是 :exc:`OSError` 的別名。" #: ../../library/signal.rst:339 msgid "The :mod:`signal` module defines the following functions:" -msgstr "" +msgstr ":mod:`signal` 模組定義了下列函式:" #: ../../library/signal.rst:344 msgid "" @@ -396,10 +456,14 @@ msgid "" "alarm is canceled. If the return value is zero, no alarm is currently " "scheduled." msgstr "" +"如果 *time* 非零,則此函式會要求在 *time* 秒內傳送 :const:`SIGALRM` 訊號給該" +"行程。任何先前排程 (scheduled) 的警報都會被取消(任何時候都只能排程一個警" +"報)。回傳值是之前設定的警報要傳送的秒數。如果 *time* 為零,則沒有排程任何警" +"報,且已排程的警報會被取消。如果回傳值為零,則代表目前未排程任何警報。" #: ../../library/signal.rst:353 msgid "See the man page :manpage:`alarm(2)` for further information." -msgstr "更多資訊請見 :manpage:`alarm(2)` 手冊頁。" +msgstr "更多資訊請見 :manpage:`alarm(2)` 線上手冊。" #: ../../library/signal.rst:358 msgid "" @@ -411,6 +475,11 @@ msgid "" "previously in use, and ``None`` means that the previous signal handler was " "not installed from Python." msgstr "" +"回傳訊號 *signalnum* 的目前訊號處理程式。回傳值可以是一個可呼叫的 Python 物" +"件,或是特殊值 :const:`signal.SIG_IGN`、:const:`signal.SIG_DFL` 或 :const:" +"`None` 之一。這裡的 :const:`signal.SIG_IGN` 表示訊號先前被忽略,:const:" +"`signal.SIG_DFL` 表示訊號先前使用預設的處理方式,而 ``None`` 表示先前的訊號處" +"理程式並未從 Python 安裝。" #: ../../library/signal.rst:369 msgid "" @@ -418,6 +487,9 @@ msgid "" "const:`SIGINT`. Returns :const:`None` if *signalnum* has no description. " "Raises :exc:`ValueError` if *signalnum* is invalid." msgstr "" +"回傳訊號 *signalnum* 的描述,例如 :const:`SIGINT` 的 \"Interrupt\"。如果 " +"*signalnum* 沒有描述,則回傳 :const:`None`。如果 *signalnum* 無效則會引發 :" +"exc:`ValueError`。" #: ../../library/signal.rst:378 msgid "" @@ -425,26 +497,30 @@ msgid "" "than ``range(1, NSIG)`` if some signals are reserved by the system for " "internal use." msgstr "" +"回傳此平台上的有效訊號編號集合。如果某些訊號被系統保留作為內部使用,則此值可" +"能小於 ``range(1, NSIG)``。" #: ../../library/signal.rst:387 msgid "" "Cause the process to sleep until a signal is received; the appropriate " "handler will then be called. Returns nothing." -msgstr "" +msgstr "使行程休眠,直到接收到訊號;然後呼叫適當的處理程式。不會回傳任何東西。" #: ../../library/signal.rst:392 msgid "See the man page :manpage:`signal(2)` for further information." -msgstr "更多資訊請見 :manpage:`signal(2)` 手冊頁。" +msgstr "更多資訊請見 :manpage:`signal(2)` 線上手冊。" #: ../../library/signal.rst:394 msgid "" "See also :func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` and :" "func:`sigpending`." msgstr "" +"也請見 :func:`sigwait`、:func:`sigwaitinfo`、:func:`sigtimedwait` 和 :func:" +"`sigpending`。" #: ../../library/signal.rst:400 msgid "Sends a signal to the calling process. Returns nothing." -msgstr "" +msgstr "傳送訊號至呼叫的行程。不會回傳任何東西。" #: ../../library/signal.rst:407 msgid "" @@ -453,10 +529,12 @@ msgid "" "``None``. The *flags* argument is provided for future extensions; no flag " "values are currently defined." msgstr "" +"傳送訊號 *sig* 到檔案描述器 *pidfd* 所指的行程。Python 目前不支援 *siginfo* " +"參數;它必須是 ``None``。*flags* 引數是提供給未來的擴充;目前沒有定義旗標值。" #: ../../library/signal.rst:412 msgid "See the :manpage:`pidfd_send_signal(2)` man page for more information." -msgstr "更多資訊請見 :manpage:`pidfd_send_signal(2)` 手冊頁。" +msgstr "更多資訊請見 :manpage:`pidfd_send_signal(2)` 線上手冊。" #: ../../library/signal.rst:420 msgid "" @@ -468,6 +546,11 @@ msgid "" "point of sending a signal to a particular Python thread would be to force a " "running system call to fail with :exc:`InterruptedError`." msgstr "" +"將訊號 *signalnum* 傳送給與呼叫者在同一行程中的另一個執行緒 *thread_id*。目標" +"執行緒能執行任何程式碼(無論為 Python 與否)。但是,如果目標執行緒正執行 " +"Python 直譯器,Python 訊號處理程式將會\\ :ref:`由主直譯器的主執行緒來執行 " +"`。因此,向特定 Python 執行緒發送訊號的唯一意義是強制執" +"行中的系統呼叫以 :exc:`InterruptedError` 方式失敗。" #: ../../library/signal.rst:428 msgid "" @@ -475,12 +558,16 @@ msgid "" "attribute of :class:`threading.Thread` objects to get a suitable value for " "*thread_id*." msgstr "" +"使用 :func:`threading.get_ident` 或 :class:`threading.Thread` 物件的 :attr:" +"`~threading.Thread.ident` 屬性來取得 *thread_id* 的適當值。" #: ../../library/signal.rst:432 msgid "" "If *signalnum* is 0, then no signal is sent, but error checking is still " "performed; this can be used to check if the target thread is still running." msgstr "" +"如果 *signalnum* 為 0,則不會傳送訊號,但仍會執行錯誤檢查;這可用來檢查目標執" +"行緒是否仍在執行。" #: ../../library/signal.rst:435 msgid "" @@ -492,7 +579,7 @@ msgstr "" #: ../../library/signal.rst:439 msgid "See the man page :manpage:`pthread_kill(3)` for further information." -msgstr "更多資訊請見 :manpage:`pthread_kill(3)` 手冊頁。" +msgstr "更多資訊請見 :manpage:`pthread_kill(3)` 線上手冊。" #: ../../library/signal.rst:441 msgid "See also :func:`os.kill`." @@ -504,17 +591,20 @@ msgid "" "is the set of signals whose delivery is currently blocked for the caller. " "Return the old signal mask as a set of signals." msgstr "" +"擷取和/或變更呼叫執行緒的訊號遮罩。訊號遮罩是目前阻擋呼叫者傳送的訊號集合。將" +"舊的訊號遮罩作為一組訊號集合回傳。" #: ../../library/signal.rst:452 msgid "" "The behavior of the call is dependent on the value of *how*, as follows." -msgstr "" +msgstr "呼叫的行為取決於 *how* 的值,如下所示。" #: ../../library/signal.rst:454 msgid "" ":data:`SIG_BLOCK`: The set of blocked signals is the union of the current " "set and the *mask* argument." msgstr "" +":data:`SIG_BLOCK`:被阻檔的訊號集合是目前訊號集合與 *mask* 參數的聯集。" #: ../../library/signal.rst:456 msgid "" @@ -522,12 +612,14 @@ msgid "" "of blocked signals. It is permissible to attempt to unblock a signal which " "is not blocked." msgstr "" +":data:`SIG_UNBLOCK`:將 *mask* 中的訊號從目前阻檔的訊號集合中移除。嘗試為未被" +"阻檔的訊號解除阻檔是允許的。" #: ../../library/signal.rst:459 msgid "" ":data:`SIG_SETMASK`: The set of blocked signals is set to the *mask* " "argument." -msgstr "" +msgstr ":data:`SIG_SETMASK`:將被阻檔的訊號集合設定為 *mask* 引數。" #: ../../library/signal.rst:462 msgid "" @@ -535,16 +627,21 @@ msgid "" "`signal.SIGTERM`}). Use :func:`~signal.valid_signals` for a full mask " "including all signals." msgstr "" +"*mask* 是一組訊號編號(例如 {:const:`signal.SIGINT`, :const:`signal." +"SIGTERM`})。使用 :func:`~signal.valid_signals` 來取得包含所有訊號的完整遮" +"罩。" #: ../../library/signal.rst:466 msgid "" "For example, ``signal.pthread_sigmask(signal.SIG_BLOCK, [])`` reads the " "signal mask of the calling thread." msgstr "" +"例如,``signal.pthread_sigmask(signal.SIG_BLOCK, [])`` 會讀取呼叫執行緒的訊號" +"遮罩。" #: ../../library/signal.rst:469 msgid ":data:`SIGKILL` and :data:`SIGSTOP` cannot be blocked." -msgstr "" +msgstr ":data:`SIGKILL` 和 :data:`SIGSTOP` 不能被阻檔。" #: ../../library/signal.rst:476 msgid "See also :func:`pause`, :func:`sigpending` and :func:`sigwait`." From bcf2bc8dba3ace62281d6aeea8e7cb89cf8bfeb2 Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Tue, 12 Nov 2024 11:11:39 +0800 Subject: [PATCH 51/89] Apply suggestions from code review Co-authored-by: Payon --- library/signal.po | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/library/signal.po b/library/signal.po index 9ffd90409f..6119c47a3f 100644 --- a/library/signal.po +++ b/library/signal.po @@ -81,8 +81,8 @@ msgid "" msgstr "" "Python 訊號處理程式不會在低階(C 語言)訊號處理程式中執行。相反地,低階訊號處" "理程式會設定一個旗標,告訴\\ :term:`虛擬機 `\\ 在稍後執行相" -"對應的 Python 訊號處理程式(例如在下一個 :term:`bytecode` 指令)。這會有後" -"果:" +"對應的 Python 訊號處理程式(例如在下一個 :term:`bytecode` 指令)。這會有一些" +"後果:" #: ../../library/signal.rst:42 msgid "" @@ -95,8 +95,8 @@ msgid "" msgstr "" "捕捉像 :const:`SIGFPE` 或 :const:`SIGSEGV` 這類由 C 程式碼中無效操作所引起的" "同步錯誤是沒有意義的。Python 將從訊號處理程式中回傳到 C 程式碼,而 C 程式碼很" -"可能再次引發相同的訊號,導致 Python 明顯掛斷。從 Python 3.3 開始,你可以使" -"用 :mod:`faulthandler` 模組來報告同步錯誤。" +"可能再次引發相同的訊號,導致 Python 明顯假當機 (hang)。從 Python 3.3 開始,你" +"可以使用 :mod:`faulthandler` 模組來報告同步錯誤。" #: ../../library/signal.rst:49 msgid "" @@ -156,10 +156,10 @@ msgid "" msgstr "" "下面列出的訊號 (SIG*)、處理器(:const:`SIG_DFL`、:const:`SIG_IGN`)和訊號遮" "罩 (sigmask)(:const:`SIG_BLOCK`、:const:`SIG_UNBLOCK`、:const:" -"`SIG_SETMASK`)相關常數被轉換成 :class:`enums `\\ (:class:" +"`SIG_SETMASK`)的相關常數被轉換成 :class:`enums `\\ (:class:" "`Signals`、:class:`Handlers` 和 :class:`Sigmasks`)。:func:`getsignal`、:" "func:`pthread_sigmask`、:func:`sigpending` 和 :func:`sigwait` 函式會回傳可被" -"人類讀取的\\ :class:`枚舉 `\\ 作為 :class:`Signals` 物件。" +"人類閱讀的\\ :class:`枚舉 `\\ 作為 :class:`Signals` 物件。" #: ../../library/signal.rst:85 msgid "The signal module defines three enums:" @@ -314,7 +314,7 @@ msgid "" "can only be raised in user space." msgstr "" "輔助處理器 (coprocessor) 上的堆疊錯誤 (stack fault)。Linux 核心不會引發此訊" -"號:它只能在使用者空間中引發。" +"號:它只能在使用者空間 (user space) 中引發。" #: ../../library/signal.rst:219 msgid "" @@ -398,8 +398,8 @@ msgid "" "and kernel space. SIGPROF is delivered upon expiration." msgstr "" "當行程執行或系統代表行程執行時,都會減少間隔計時器。與 ITIMER_VIRTUAL 配合," -"這個計時器通常用來分析 (profile) 應用程式在使用者空間 (user space) 與核心空" -"間 (kernel space) 所花費的時間。SIGPROF 會在到期時傳送。" +"這個計時器通常用來分析 (profile) 應用程式在使用者空間與核心空間 (kernel " +"space) 所花費的時間。SIGPROF 會在到期時傳送。" #: ../../library/signal.rst:305 msgid "" @@ -456,10 +456,11 @@ msgid "" "alarm is canceled. If the return value is zero, no alarm is currently " "scheduled." msgstr "" -"如果 *time* 非零,則此函式會要求在 *time* 秒內傳送 :const:`SIGALRM` 訊號給該" +"如果 *time* 非零,則此函式會要求在 *time* 秒後傳送 :const:`SIGALRM` 訊號給該" "行程。任何先前排程 (scheduled) 的警報都會被取消(任何時候都只能排程一個警" -"報)。回傳值是之前設定的警報要傳送的秒數。如果 *time* 為零,則沒有排程任何警" -"報,且已排程的警報會被取消。如果回傳值為零,則代表目前未排程任何警報。" +"報)。回傳值是先前設定的警報原本再等多久就會被傳送的秒數。如果 *time* 為零," +"則不會去排程任何警報,且已排程的警報會被取消。如果回傳值為零,則代表目前未排" +"程任何警報。" #: ../../library/signal.rst:353 msgid "See the man page :manpage:`alarm(2)` for further information." @@ -604,7 +605,7 @@ msgid "" ":data:`SIG_BLOCK`: The set of blocked signals is the union of the current " "set and the *mask* argument." msgstr "" -":data:`SIG_BLOCK`:被阻檔的訊號集合是目前訊號集合與 *mask* 參數的聯集。" +":data:`SIG_BLOCK`:被阻檔的訊號集合是目前訊號集合與 *mask* 引數的聯集。" #: ../../library/signal.rst:456 msgid "" @@ -628,8 +629,8 @@ msgid "" "including all signals." msgstr "" "*mask* 是一組訊號編號(例如 {:const:`signal.SIGINT`, :const:`signal." -"SIGTERM`})。使用 :func:`~signal.valid_signals` 來取得包含所有訊號的完整遮" -"罩。" +"SIGTERM`})的集合。使用 :func:`~signal.valid_signals` 來取得包含所有訊號的完" +"整遮罩。" #: ../../library/signal.rst:466 msgid "" From af4187da12578e044041126b8248a2216f95914b Mon Sep 17 00:00:00 2001 From: RockLeon <34214497+rockleona@users.noreply.github.com> Date: Wed, 13 Nov 2024 11:14:54 +0800 Subject: [PATCH 52/89] Update Translation `howto/sorting.po` (#906) --- howto/sorting.po | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/howto/sorting.po b/howto/sorting.po index f8846e6300..c61a7fc774 100644 --- a/howto/sorting.po +++ b/howto/sorting.po @@ -9,7 +9,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-08-12 15:09+0800\n" -"Last-Translator: Adrian Liaw \n" +"Last-Translator: Li-Hung Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -17,6 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.4.2\n" #: ../../howto/sorting.rst:4 msgid "Sorting Techniques" @@ -188,10 +189,12 @@ msgid "" "or they can be instances of :class:`~dataclasses.dataclass` or a :term:" "`named tuple`." msgstr "" +"具有命名屬性的物件可以如上方的方式使用一個常規的類別建立,或是他們可以是 :" +"class:`~dataclasses.dataclass` 的實例或是一個 :term:`named tuple`。" #: ../../howto/sorting.rst:104 msgid "Operator Module Functions and Partial Function Evaluation" -msgstr "" +msgstr "Operator 模組函式以及部份函式 (partial function) 評估" #: ../../howto/sorting.rst:106 msgid "" @@ -255,6 +258,9 @@ msgid "" "`_ of a multi-argument function making " "it suitable for use as a key-function." msgstr "" +"模組 :mod:`functools` 提供了另一個製作鍵函式的好用工具。:func:`~functools." +"partial` 函式可以減少多引數函式的\\ `引數數目 `_,使其更適合作為鍵函式使用。" #: ../../howto/sorting.rst:139 msgid "" @@ -599,6 +605,10 @@ msgid "" "six comparison methods be implemented. The :func:`~functools.total_ordering` " "decorator is provided to make that task easier." msgstr "" +"然而,請注意,當 :meth:`~object.__lt__` 沒有被實做時,``<`` 可以回退 (fall " +"back) 使用 :meth:`~object.__gt__`\\ (有關技術上的細節資訊請看 :func:`object." +"__lt__` )。為了避免意外發生,:pep:`8` 建議所有六種的比較函式都需要被實作。裝飾" +"器 :func:`~functools.total_ordering` 被提供用來讓任務更為簡單。" #: ../../howto/sorting.rst:314 msgid "" @@ -624,13 +634,15 @@ msgstr "" #: ../../howto/sorting.rst:327 msgid "Partial Sorts" -msgstr "" +msgstr "部份排序" #: ../../howto/sorting.rst:329 msgid "" "Some applications require only some of the data to be ordered. The standard " "library provides several tools that do less work than a full sort:" msgstr "" +"有些應用程式只需要排序部份的資料。基礎函式庫提供相較做完整排序更為輕鬆的多項" +"工具:" #: ../../howto/sorting.rst:332 msgid "" @@ -638,6 +650,8 @@ msgid "" "respectively. These functions make a single pass over the input data and " "require almost no auxiliary memory." msgstr "" +":func:`min` 以及 :func:`max` 會分別回傳最小值及最大值。這些函式會將輸入資料進" +"行一次傳遞且幾乎無須輔助記憶體。" #: ../../howto/sorting.rst:336 msgid "" @@ -647,6 +661,9 @@ msgid "" "that are small relative to the number of inputs, these functions make far " "fewer comparisons than a full sort." msgstr "" +":func:`heapq.nsmallest` 以及 :func:`heapq.nlargest` 會分別回傳 *n* 個最小值及" +"最大值。這些函式會將資料進行一次傳遞且一次只會保留 *n* 個元素在記憶體中。對於" +"相對於輸入數量較小的 *n* 個值,這些函數進行的比較比完整排序要少得多。" #: ../../howto/sorting.rst:342 msgid "" @@ -655,3 +672,7 @@ msgid "" "position ``0``. These functions are suitable for implementing priority " "queues which are commonly used for task scheduling." msgstr "" +":func:`heapq.heappush` 和 :func:`heapq.heappop` 會建立並維持一個部份排序的資料" +"排列,將最小的元素保持在位置 ``0``。這些函式適合用來實作常用於任務排程的優先" +"佇列。" + From 10794fd724aac79f748d14765c2dea66e143749a Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Sat, 16 Nov 2024 15:39:44 +0800 Subject: [PATCH 53/89] Translate the second half of `library/pdb.po` (#991) Co-authored-by: mindihx --- library/pdb.po | 197 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 173 insertions(+), 24 deletions(-) diff --git a/library/pdb.po b/library/pdb.po index 1f31a9ad78..82e3ec7697 100644 --- a/library/pdb.po +++ b/library/pdb.po @@ -672,7 +672,7 @@ msgstr "" #: ../../library/pdb.rst:382 msgid "Enable the breakpoints specified." -msgstr "" +msgstr "啟用指定的斷點。" #: ../../library/pdb.rst:386 msgid "" @@ -682,6 +682,9 @@ msgid "" "the breakpoint is reached and the breakpoint is not disabled and any " "associated condition evaluates to true." msgstr "" +"為給定的斷點編號設定忽略計數。如果省略 *count* 則忽略計數設定為 0。當忽略計數" +"為 0 時,斷點將變為有效狀態。當非 0 時,每次到達斷點,且斷點沒有被禁用,且任" +"何關聯的條件被求值為 true,則 *count* 就會遞減。" #: ../../library/pdb.rst:394 msgid "" @@ -689,6 +692,8 @@ msgid "" "to true before the breakpoint is honored. If *condition* is absent, any " "existing condition is removed; i.e., the breakpoint is made unconditional." msgstr "" +"為斷點設定一個新 *condition*,為一個運算式,且其求值結果為 true 時斷點才會起" +"作用。如果沒有給定 *condition*,則刪除任何現有條件,也就是不為斷點設定條件。" #: ../../library/pdb.rst:400 msgid "" @@ -696,6 +701,8 @@ msgid "" "themselves appear on the following lines. Type a line containing just " "``end`` to terminate the commands. An example::" msgstr "" +"為編號是 *bpnumber* 的斷點指定一系列命令。命令內容出現在後續的幾列中。輸入僅" +"包含 ``end`` 的一列來結束命令列表。例如: ::" #: ../../library/pdb.rst:404 msgid "" @@ -704,17 +711,23 @@ msgid "" "(com) end\n" "(Pdb)" msgstr "" +"(Pdb) commands 1\n" +"(com) p some_variable\n" +"(com) end\n" +"(Pdb)" #: ../../library/pdb.rst:409 msgid "" "To remove all commands from a breakpoint, type ``commands`` and follow it " "immediately with ``end``; that is, give no commands." msgstr "" +"要刪除斷點上的所有命令,請輸入 ``commands`` 並立即以 ``end`` 結尾,也就是不指" +"定任何命令。" #: ../../library/pdb.rst:412 msgid "" "With no *bpnumber* argument, ``commands`` refers to the last breakpoint set." -msgstr "" +msgstr "不帶有 *bpnumber* 引數則 ``commands`` 會關聯到上一個設定的斷點。" #: ../../library/pdb.rst:414 msgid "" @@ -722,6 +735,8 @@ msgid "" "the :pdbcmd:`continue` command, or :pdbcmd:`step`, or any other command that " "resumes execution." msgstr "" +"可以使用斷點命令來重新啟動程式,只需使用 :pdbcmd:`continue` 或 :pdbcmd:" +"`step` 命令,或其他可以繼續執行程式的命令。" #: ../../library/pdb.rst:418 msgid "" @@ -733,6 +748,11 @@ msgid "" "another breakpoint—which could have its own command list, leading to " "ambiguities about which list to execute." msgstr "" +"如果指定了某個繼續執行程式的命令(目前包括 :pdbcmd:`continue`、:pdbcmd:" +"`step`、:pdbcmd:`next`、:pdbcmd:`return`、:pdbcmd:`jump`、:pdbcmd:`quit` 及它" +"們的縮寫)將終止命令列表(就像該命令後馬上跟著 end)。因為在任何時候繼續執行" +"下去(即使是簡單的 next 或 step),都可能會遇到另一個斷點,該斷點可能具有自己" +"的命令列表,這會導致無法確定要執行哪個列表。" #: ../../library/pdb.rst:427 msgid "" @@ -742,12 +762,17 @@ msgid "" "of the other commands print anything, you see no sign that the breakpoint " "was reached." msgstr "" +"如果你在命令列表中使用 ``silent`` 命令,則平常會有的那些關於停止於斷點處的訊" +"息就不會印出。對於要印出特定訊息再繼續的斷點來說,這可能會是需要的功能。如果" +"其他命令都沒有印出任何內容,那你就看不到已到達斷點的跡象。" #: ../../library/pdb.rst:434 msgid "" "Execute the current line, stop at the first possible occasion (either in a " "function that is called or on the next line in the current function)." msgstr "" +"執行當前列,在第一個可以停止的位置(在被呼叫的函式內部或在當前函式的下一列)" +"停止。" #: ../../library/pdb.rst:439 msgid "" @@ -757,12 +782,16 @@ msgid "" "executes called functions at (nearly) full speed, only stopping at the next " "line in the current function.)" msgstr "" +"繼續執行,直至執行到當前函式的下一列或者當前函式回傳為止。(:pdbcmd:`next` " +"和 :pdbcmd:`step` 之間的區別在於 :pdbcmd:`step` 會在被呼叫函式的內部停止、" +"而 :pdbcmd:`next`\\ (幾乎)全速執行被呼叫的函式,並僅在當前函式的下一列停" +"止。)" #: ../../library/pdb.rst:447 msgid "" "Without argument, continue execution until the line with a number greater " "than the current one is reached." -msgstr "" +msgstr "如果不帶引數則繼續執行,直到列號比當前的列大時停止。" #: ../../library/pdb.rst:450 msgid "" @@ -770,18 +799,20 @@ msgid "" "equal to *lineno* is reached. In both cases, also stop when the current " "frame returns." msgstr "" +"如帶有 *lineno* 則繼續執行,直到到達列號大於或等於 *lineno* 的那一列。在這兩" +"種情況下,當前 frame 回傳時也會停止。" #: ../../library/pdb.rst:454 msgid "Allow giving an explicit line number." -msgstr "" +msgstr "允許明確給定一個列號。" #: ../../library/pdb.rst:459 msgid "Continue execution until the current function returns." -msgstr "" +msgstr "繼續執行,直到目前的函式回傳。" #: ../../library/pdb.rst:463 msgid "Continue execution, only stop when a breakpoint is encountered." -msgstr "" +msgstr "繼續執行,除非遇到斷點才停下來。" #: ../../library/pdb.rst:467 msgid "" @@ -789,6 +820,8 @@ msgid "" "frame. This lets you jump back and execute code again, or jump forward to " "skip code that you don't want to run." msgstr "" +"設定即將執行的下一列,僅可用於堆疊中最底部的 frame。這讓你可以跳回去並再次執" +"行程式碼,或者往前跳以跳過不想執行的程式碼。" #: ../../library/pdb.rst:471 msgid "" @@ -796,6 +829,8 @@ msgid "" "possible to jump into the middle of a :keyword:`for` loop or out of a :" "keyword:`finally` clause." msgstr "" +"需要注意的是,不是所有的跳轉都是被允許的 -- 例如不能跳轉到 :keyword:`for` 迴" +"圈的中間或跳出 :keyword:`finally` 子句。" #: ../../library/pdb.rst:477 msgid "" @@ -805,6 +840,10 @@ msgid "" "lines around at that line. With two arguments, list the given range; if the " "second argument is less than the first, it is interpreted as a count." msgstr "" +"列出當前檔案的原始碼。如果不帶引數,則列出當前列周圍的 11 列,或繼續先前的列" +"表操作。如果用 ``.`` 作為引數,則列出當前列周圍的 11 列。如果帶有一個引數,則" +"列出那一列周圍的 11 列。如果帶有兩個引數,則列出給定範圍中的程式碼;如果第二" +"個引數小於第一個引數,則將其直譯為要列出的列數。" #: ../../library/pdb.rst:483 msgid "" @@ -813,55 +852,62 @@ msgid "" "raised or propagated is indicated by ``>>``, if it differs from the current " "line." msgstr "" +"當前 frame 中的當前列會用 ``->`` 標記出來。如果正在偵錯一個例外,且引發或傳遞" +"該例外的那一列不是當前列,則會用 ``>>`` 來標記該列。" #: ../../library/pdb.rst:488 msgid "Added the ``>>`` marker." -msgstr "" +msgstr "新增了 ``>>`` 標記。" #: ../../library/pdb.rst:493 msgid "" "List all source code for the current function or frame. Interesting lines " "are marked as for :pdbcmd:`list`." msgstr "" +"列出當前函式或 frame 的所有原始碼。相關列的標記方式與 :pdbcmd:`list` 相同。" #: ../../library/pdb.rst:500 msgid "Print the arguments of the current function and their current values." -msgstr "" +msgstr "印出當前函式的引數及它們當前的值。" #: ../../library/pdb.rst:504 msgid "Evaluate *expression* in the current context and print its value." -msgstr "" +msgstr "在當前情境中為 *expression* 求值並印出其值。" #: ../../library/pdb.rst:508 msgid "" "``print()`` can also be used, but is not a debugger command --- this " "executes the Python :func:`print` function." msgstr "" +"也可以使用 ``print()``,但它不是一個偵錯器命令 --- 它會執行 Python :func:" +"`print` 函式。" #: ../../library/pdb.rst:514 msgid "" "Like the :pdbcmd:`p` command, except the value of *expression* is pretty-" "printed using the :mod:`pprint` module." msgstr "" +"與 :pdbcmd:`p` 命令類似,除了 *expression* 的值是使用 :mod:`pprint` 模組美化" +"後印出來的。" #: ../../library/pdb.rst:519 msgid "Print the type of *expression*." -msgstr "" +msgstr "印出 *expression* 的型別。" #: ../../library/pdb.rst:523 msgid "Try to get source code of *expression* and display it." -msgstr "" +msgstr "嘗試獲取 *expression* 的原始碼並顯示它。" #: ../../library/pdb.rst:529 msgid "" "Display the value of *expression* if it changed, each time execution stops " "in the current frame." -msgstr "" +msgstr "每次在當前 frame 中停止執行時,顯示 *expression* 的值(如果有變更)。" #: ../../library/pdb.rst:532 msgid "" "Without *expression*, list all display expressions for the current frame." -msgstr "" +msgstr "如果不帶有 *expression*,則列出當前 frame 的所有運算式。" #: ../../library/pdb.rst:536 msgid "" @@ -869,10 +915,12 @@ msgid "" "evaluation of *expression*, so when the result is mutable, display may not " "be able to pick up the changes." msgstr "" +"display 會對 *expression* 求值並將結果與之前 *expression* 的求值結果進行比" +"較,因此當結果可變時,display 可能無法獲取其變更。" #: ../../library/pdb.rst:540 ../../library/pdb.rst:690 msgid "Example::" -msgstr "範例: ::" +msgstr "範例如下: ::" #: ../../library/pdb.rst:542 msgid "" @@ -882,12 +930,19 @@ msgid "" "lst.append(1)\n" "print(lst)" msgstr "" +"lst = []\n" +"breakpoint()\n" +"pass\n" +"lst.append(1)\n" +"print(lst)" #: ../../library/pdb.rst:548 msgid "" "Display won't realize ``lst`` has been changed because the result of " "evaluation is modified in place by ``lst.append(1)`` before being compared::" msgstr "" +"display 不會意識到 ``lst`` 已更改,因為其求值結果在比較之前已被 ``lst." +"append(1)`` 原地 (in place) 修改: ::" #: ../../library/pdb.rst:551 msgid "" @@ -903,10 +958,21 @@ msgid "" "-> print(lst)\n" "(Pdb)" msgstr "" +"> example.py(3)()\n" +"-> pass\n" +"(Pdb) display lst\n" +"display lst: []\n" +"(Pdb) n\n" +"> example.py(4)()\n" +"-> lst.append(1)\n" +"(Pdb) n\n" +"> example.py(5)()\n" +"-> print(lst)\n" +"(Pdb)" #: ../../library/pdb.rst:563 msgid "You can do some tricks with copy mechanism to make it work::" -msgstr "" +msgstr "你可以運用複製機制的一些技巧來使其能夠運作: ::" #: ../../library/pdb.rst:565 msgid "" @@ -923,12 +989,26 @@ msgid "" "display lst[:]: [1] [old: []]\n" "(Pdb)" msgstr "" +"> example.py(3)()\n" +"-> pass\n" +"(Pdb) display lst[:]\n" +"display lst[:]: []\n" +"(Pdb) n\n" +"> example.py(4)()\n" +"-> lst.append(1)\n" +"(Pdb) n\n" +"> example.py(5)()\n" +"-> print(lst)\n" +"display lst[:]: [1] [old: []]\n" +"(Pdb)" #: ../../library/pdb.rst:582 msgid "" "Do not display *expression* anymore in the current frame. Without " "*expression*, clear all display expressions for the current frame." msgstr "" +"不再顯示當前 frame 中的 *expression*。如果不帶有 *expression*,則清除當前 " +"frame 的所有顯示運算式。" #: ../../library/pdb.rst:589 msgid "" @@ -937,6 +1017,9 @@ msgid "" "current scope. Use ``exit()`` or ``quit()`` to exit the interpreter and " "return to the debugger." msgstr "" +"在從目前作用域的區域和全域命名空間初始化的新全域命名空間中啟動互動式直譯器" +"(使用 :mod:`code` 模組)。可使用 ``exit()`` 或 ``quit()`` 退出直譯器並回到偵" +"錯器。" #: ../../library/pdb.rst:596 msgid "" @@ -945,17 +1028,22 @@ msgid "" "modifications to any referenced mutable objects will be reflected in the " "original namespaces as usual." msgstr "" +"由於 ``interact`` 為程式碼執行建立了一個新的專用命名空間,因此變數的賦值不會" +"影響原始命名空間,但是對任何被參照的可變物件的修改將像往常一樣反映在原始命名" +"空間中。" #: ../../library/pdb.rst:603 msgid "" "``exit()`` and ``quit()`` can be used to exit the :pdbcmd:`interact` command." -msgstr "" +msgstr "``exit()`` 和 ``quit()`` 可用來退出 :pdbcmd:`interact` 命令。" #: ../../library/pdb.rst:607 msgid "" ":pdbcmd:`interact` directs its output to the debugger's output channel " "rather than :data:`sys.stderr`." msgstr "" +":pdbcmd:`interact` 將其輸出導向到偵錯器的輸出通道 (output channel),而不是 :" +"data:`sys.stderr`。" #: ../../library/pdb.rst:615 msgid "" @@ -965,6 +1053,10 @@ msgid "" "parameters. If *command* is omitted, the current alias for *name* is shown. " "If no arguments are given, all aliases are listed." msgstr "" +"建立一個名為 *name* 的別名,用於執行 *command*。*command* *不得*\\ 用引號包起" +"來。可被替換的參數要用 ``%1``、``%2``、 ... 和 ``%9`` 標示,而 ``%*`` 則被所" +"有參數替換。如果省略 *command*,則顯示 *name* 的目前別名。如果未給定引數,則" +"列出所有別名。" #: ../../library/pdb.rst:621 msgid "" @@ -974,12 +1066,16 @@ msgid "" "Aliasing is recursively applied to the first word of the command line; all " "other words in the line are left alone." msgstr "" +"巢狀別名是允許的,且可包含能在 pdb 提示字元下合法輸入的任何內容。請注意,內" +"部 pdb 命令\\ *可以*\\ 被別名所覆蓋。這樣的命令在別名被移除前都將被隱藏。別名" +"會遞迴地應用到命令列的第一個單詞;該列內的其他單詞則不會受影響。" #: ../../library/pdb.rst:627 msgid "" "As an example, here are two useful aliases (especially when placed in the :" "file:`.pdbrc` file)::" msgstr "" +"作為範例,這裡列出了兩個有用的別名(特別是放在 :file:`.pdbrc` 檔案中時): ::" #: ../../library/pdb.rst:630 msgid "" @@ -988,10 +1084,14 @@ msgid "" "# Print instance variables in self\n" "alias ps pi self" msgstr "" +"# 印出實例變數(用法如 \"pi classInst\")\n" +"alias pi for k in %1.__dict__.keys(): print(f\"%1.{k} = {%1.__dict__[k]}\")\n" +"# 印出 self 中的實例變數\n" +"alias ps pi self" #: ../../library/pdb.rst:637 msgid "Delete the specified alias *name*." -msgstr "" +msgstr "刪除指定的別名 *name*。" #: ../../library/pdb.rst:641 msgid "" @@ -999,24 +1099,32 @@ msgid "" "frame. The exclamation point can be omitted unless the first word of the " "statement resembles a debugger command, e.g.:" msgstr "" +"在當前 stack frame 的情境中執行(單列)\\ *statement*。除非陳述式的第一個單詞" +"類似於偵錯器命令,否則可以省略驚嘆號,例如:" #: ../../library/pdb.rst:645 msgid "" "(Pdb) ! n=42\n" "(Pdb)" msgstr "" +"(Pdb) ! n=42\n" +"(Pdb)" #: ../../library/pdb.rst:650 msgid "" "To set a global variable, you can prefix the assignment command with a :" "keyword:`global` statement on the same line, e.g.:" msgstr "" +"要設定全域變數,你可以在同一列的賦值命令前面加上 :keyword:`global` 陳述式,例" +"如:" #: ../../library/pdb.rst:653 msgid "" "(Pdb) global list_options; list_options = ['-l']\n" "(Pdb)" msgstr "" +"(Pdb) global list_options; list_options = ['-l']\n" +"(Pdb)" #: ../../library/pdb.rst:661 msgid "" @@ -1025,24 +1133,29 @@ msgid "" "History, breakpoints, actions and debugger options are preserved. :pdbcmd:" "`restart` is an alias for :pdbcmd:`run`." msgstr "" +"重新啟動已偵錯完畢的 Python 程式。如果提供了 *args*,它將以 :mod:`shlex` 分" +"割,並將結果用作新的 :data:`sys.argv`。歷史記錄、斷點、操作和偵錯器選項均會被" +"保留。:pdbcmd:`restart` 是 :pdbcmd:`run` 的別名。" #: ../../library/pdb.rst:668 msgid "Quit from the debugger. The program being executed is aborted." -msgstr "" +msgstr "離開偵錯器,執行中的程式會被中止。" #: ../../library/pdb.rst:672 msgid "" "Enter a recursive debugger that steps through *code* (which is an arbitrary " "expression or statement to be executed in the current environment)." msgstr "" +"進入一個遞迴偵錯器,逐步執行 *code*\\ (這是要在當前環境中執行的任意運算式或" +"陳述式)。" #: ../../library/pdb.rst:678 msgid "Print the return value for the last return of the current function." -msgstr "" +msgstr "印出當前函式最後一次回傳的回傳值。" #: ../../library/pdb.rst:682 msgid "List or jump between chained exceptions." -msgstr "" +msgstr "列出鏈接例外 (chained exceptions),或在其間跳轉。" #: ../../library/pdb.rst:684 msgid "" @@ -1051,6 +1164,9 @@ msgid "" "chained exceptions using ``exceptions`` command to list exceptions, and " "``exception `` to switch to that exception." msgstr "" +"當使用 ``pdb.pm()`` 或 ``Pdb.post_mortem(...)`` 於鏈接例外而不是回溯時,它允" +"許使用者在鏈接例外之間移動,使用 ``exceptions`` 命令以列出例外,並使用 " +"``exception `` 切換到該例外。" #: ../../library/pdb.rst:692 msgid "" @@ -1071,10 +1187,26 @@ msgid "" "\n" " out()" msgstr "" +"def out():\n" +" try:\n" +" middle()\n" +" except Exception as e:\n" +" raise ValueError(\"reraise middle() error\") from e\n" +"\n" +"def middle():\n" +" try:\n" +" return inner(0)\n" +" except Exception as e:\n" +" raise ValueError(\"Middle fail\")\n" +"\n" +"def inner(x):\n" +" 1 / x\n" +"\n" +" out()" #: ../../library/pdb.rst:709 msgid "calling ``pdb.pm()`` will allow to move between exceptions::" -msgstr "" +msgstr "呼叫 ``pdb.pm()`` 將允許在例外之間移動: ::" #: ../../library/pdb.rst:711 msgid "" @@ -1094,20 +1226,37 @@ msgid "" "> example.py(10)middle()\n" "-> return inner(0)" msgstr "" +"> example.py(5)out()\n" +"-> raise ValueError(\"reraise middle() error\") from e\n" +"\n" +"(Pdb) exceptions\n" +" 0 ZeroDivisionError('division by zero')\n" +" 1 ValueError('Middle fail')\n" +"> 2 ValueError('reraise middle() error')\n" +"\n" +"(Pdb) exceptions 0\n" +"> example.py(16)inner()\n" +"-> 1 / x\n" +"\n" +"(Pdb) up\n" +"> example.py(10)middle()\n" +"-> return inner(0)" #: ../../library/pdb.rst:730 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../library/pdb.rst:731 msgid "" "Whether a frame is considered to originate in a certain module is determined " "by the ``__name__`` in the frame globals." msgstr "" +"一個 frame 是否會被認為源自特定模組是由該 frame 全域性變數中的 ``__name__`` " +"來決定的。" #: ../../library/pdb.rst:11 msgid "debugging" -msgstr "debugging(除錯)" +msgstr "debugging(偵錯)" #: ../../library/pdb.rst:21 msgid "Pdb (class in pdb)" @@ -1135,7 +1284,7 @@ msgstr "file(檔案)" #: ../../library/pdb.rst:295 msgid "debugger" -msgstr "debugger(除錯器)" +msgstr "debugger(偵錯器)" #: ../../library/pdb.rst:295 msgid "configuration" From 4f8f2805e39fb000966adf4473a595315f3a47b4 Mon Sep 17 00:00:00 2001 From: Payon Date: Wed, 20 Nov 2024 17:15:57 +0800 Subject: [PATCH 54/89] feat: translate time in 3.13 (#979) Co-authored-by: Wei-Hsiang (Matt) Wang --- library/time.po | 143 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 117 insertions(+), 26 deletions(-) diff --git a/library/time.po b/library/time.po index b110d06f95..a3390646e8 100644 --- a/library/time.po +++ b/library/time.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-01 00:15+0000\n" -"PO-Revision-Date: 2024-08-14 16:05+0800\n" +"PO-Revision-Date: 2024-11-20 15:25+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.4.4\n" +"X-Generator: Poedit 3.5\n" #: ../../library/time.rst:2 msgid ":mod:`!time` --- Time access and conversions" @@ -275,7 +275,7 @@ msgstr "" #: ../../library/time.rst:953 ../../library/time.rst:962 #: ../../library/time.rst:975 msgid "Availability" -msgstr "" +msgstr ":ref:`適用 `" #: ../../library/time.rst:151 msgid "" @@ -478,29 +478,32 @@ msgstr "" #: ../../library/time.rst:290 ../../library/time.rst:700 msgid "Clock:" -msgstr "" +msgstr "時鐘:" #: ../../library/time.rst:292 msgid "" "On Windows, call ``QueryPerformanceCounter()`` and " "``QueryPerformanceFrequency()``." msgstr "" +"在 Windows 上,呼叫 ``QueryPerformanceCounter()`` 和 " +"``QueryPerformanceFrequency()``。" #: ../../library/time.rst:294 msgid "On macOS, call ``mach_absolute_time()`` and ``mach_timebase_info()``." msgstr "" +"在 macOS 上,呼叫 ``mach_absolute_time()`` 和 ``mach_timebase_info()``。" #: ../../library/time.rst:295 msgid "On HP-UX, call ``gethrtime()``." -msgstr "" +msgstr "在 HP-UX 上,呼叫 ``gethrtime()``。" #: ../../library/time.rst:296 msgid "Call ``clock_gettime(CLOCK_HIGHRES)`` if available." -msgstr "" +msgstr "如果可以的話,呼叫 ``clock_gettime(CLOCK_HIGHRES)``。" #: ../../library/time.rst:297 msgid "Otherwise, call ``clock_gettime(CLOCK_MONOTONIC)``." -msgstr "" +msgstr "否則,呼叫 ``clock_gettime(CLOCK_MONOTONIC)``。" #: ../../library/time.rst:299 msgid "" @@ -537,6 +540,8 @@ msgid "" "On CPython, use the same clock as :func:`time.monotonic` and is a monotonic " "clock, i.e. a clock that cannot go backwards." msgstr "" +"在 CPython 上,使用與 :func:`time.monotonic` 相同的時鐘,且其為單調時鐘(即不" +"能倒轉的時鐘)。" #: ../../library/time.rst:333 msgid "" @@ -551,7 +556,7 @@ msgstr "在 Windows 上,此函式現在涵蓋整個系統。" #: ../../library/time.rst:341 msgid "Use the same clock as :func:`time.monotonic`." -msgstr "與 :func:`time.monotonic` 使用相同的時鐘。" +msgstr "使用與 :func:`time.monotonic` 相同的時鐘。" #: ../../library/time.rst:347 msgid "Similar to :func:`perf_counter`, but return time as nanoseconds." @@ -640,6 +645,8 @@ msgid "" "Raises an :ref:`auditing event ` ``time.sleep`` with argument " "``secs``." msgstr "" +"引發一個帶有引數 ``secs`` 的\\ :ref:`稽核事件 (auditing event) ` " +"``time.sleep``。" #: ../../library/time.rst:404 msgid "" @@ -660,7 +667,7 @@ msgstr "" #: ../../library/time.rst:413 msgid "Raises an auditing event." -msgstr "" +msgstr "引發一個稽核事件。" #: ../../library/time.rst:421 msgid "" @@ -941,6 +948,8 @@ msgid "" "calendar year). The year starts with the week that contains the first " "Thursday of the calendar year." msgstr "" +"ISO 8601 年(類似於 ``%Y``,但遵循 ISO 8601 日曆年的規則)。年份從包含該日曆" +"年第一個星期四的那一週開始。" #: ../../library/time.rst:526 msgid "``%V``" @@ -952,6 +961,8 @@ msgid "" "year is the one that contains the first Thursday of the year. Weeks start on " "Monday." msgstr "" +"ISO 8601 週數(以十進位數表示 [01,53])。年份的第一週是包含該年第一個星期四的" +"那一週。每週從星期一開始。" #: ../../library/time.rst:531 msgid "``%%``" @@ -1264,15 +1275,15 @@ msgstr "" #: ../../library/time.rst:702 msgid "On Windows, call ``GetSystemTimeAsFileTime()``." -msgstr "" +msgstr "在 Windows 上,呼叫 ``GetSystemTimeAsFileTime()``。" #: ../../library/time.rst:703 msgid "Call ``clock_gettime(CLOCK_REALTIME)`` if available." -msgstr "" +msgstr "如果可以的話,呼叫 ``clock_gettime(CLOCK_REALTIME)``。" #: ../../library/time.rst:704 msgid "Otherwise, call ``gettimeofday()``." -msgstr "" +msgstr "否則,呼叫 ``gettimeofday()``。" #: ../../library/time.rst:706 msgid "" @@ -1294,20 +1305,24 @@ msgid "" "returned value is undefined, so that only the difference between the results " "of two calls in the same thread is valid." msgstr "" +"回傳當前執行緒的系統和用戶 CPU 時間之和(以帶有小數的秒數表示)。它不包括睡眠" +"期間經過的時間。根據定義,這是執行緒特定 (thread-specific) 的。回傳值的參照點" +"未定義,因此只有同一執行緒中兩次呼叫結果之間的差異才是有效的。" #: ../../library/time.rst:731 msgid "" "Use :func:`thread_time_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" +"使用 :func:`thread_time_ns` 以避免 :class:`float` 型別造成的精確度損失。" #: ../../library/time.rst:736 msgid "Unix systems supporting ``CLOCK_THREAD_CPUTIME_ID``." -msgstr "" +msgstr "有支援 ``CLOCK_THREAD_CPUTIME_ID`` 的 Unix 系統。" #: ../../library/time.rst:743 msgid "Similar to :func:`thread_time` but return time as nanoseconds." -msgstr "" +msgstr "類似於 :func:`thread_time`,但回傳以奈秒為單位的時間。" #: ../../library/time.rst:750 msgid "" @@ -1319,6 +1334,12 @@ msgid "" "saving time rules, or to nonzero if there is a time, past, present or future " "when daylight saving time applies)." msgstr "" +"重置函式庫常式 (routine) 使用的時間轉換規則。環境變數 :envvar:`TZ` 指定了這一" +"過程的實施方式。它還會設定變數 ``tzname``\\ (來自 :envvar:`TZ` 環境變數)、" +"``timezone``\\ (非日光節約時間的 UTC 以西的時間偏移,單位為秒)、" +"``altzone``\\ (日光節約時間的 UTC 以西的時間偏移,單位為秒)和 " +"``daylight``\\ (如果該時區沒有日光節約時間規則,則設定為 0;如果在過去、現在" +"或未來的某個時間有日光節約時間規則,則設置為非零的值)。" #: ../../library/time.rst:762 msgid "" @@ -1326,16 +1347,19 @@ msgid "" "affect the output of functions like :func:`localtime` without calling :func:" "`tzset`, this behavior should not be relied on." msgstr "" +"雖然在許多情況下,更改 :envvar:`TZ` 環境變數可能會在沒有呼叫 :func:`tzset` 的" +"情況下影響 :func:`localtime` 等函式的輸出,但是這種行為是不該被依賴的。" #: ../../library/time.rst:766 msgid "The :envvar:`TZ` environment variable should contain no whitespace." -msgstr "" +msgstr ":envvar:`TZ` 環境變數不應包含空格字元。" #: ../../library/time.rst:768 msgid "" "The standard format of the :envvar:`TZ` environment variable is (whitespace " "added for clarity)::" msgstr "" +":envvar:`TZ` 環境變數的標準格式為(為了清楚表達,中間增加了空格字元): ::" #: ../../library/time.rst:771 msgid "std offset [dst [offset [,start[/time], end[/time]]]]" @@ -1343,7 +1367,7 @@ msgstr "std offset [dst [offset [,start[/time], end[/time]]]]" #: ../../library/time.rst:773 msgid "Where the components are:" -msgstr "" +msgstr "其中各個組成部分為:" #: ../../library/time.rst:775 msgid "``std`` and ``dst``" @@ -1354,6 +1378,8 @@ msgid "" "Three or more alphanumerics giving the timezone abbreviations. These will be " "propagated into time.tzname" msgstr "" +"三個或更多字母與數字 (alphanumerics) 組成的時區縮寫。這些縮寫會被傳播到 time." +"tzname 中。" #: ../../library/time.rst:779 msgid "``offset``" @@ -1366,6 +1392,9 @@ msgid "" "of the Prime Meridian; otherwise, it is west. If no offset follows dst, " "summer time is assumed to be one hour ahead of standard time." msgstr "" +"偏移量的格式為:``± hh[:mm[:ss]]``。這表示為達到 UTC 而增加到當地時間的值。如" +"果以 '-' 開頭,則表示該時區位於本初子午線以東;否則,位於其西。如果 dst 之後" +"沒有偏移量,則假定日光時間比標準時間快一小時。" #: ../../library/time.rst:785 msgid "``start[/time], end[/time]``" @@ -1376,6 +1405,7 @@ msgid "" "Indicates when to change to and back from DST. The format of the start and " "end dates are one of the following:" msgstr "" +"表示何時切換至日光節約時間及何時切換回來。開始和結束日期的格式如以下其一:" #: ../../library/time.rst:789 msgid ":samp:`J{n}`" @@ -1386,6 +1416,8 @@ msgid "" "The Julian day *n* (1 <= *n* <= 365). Leap days are not counted, so in all " "years February 28 is day 59 and March 1 is day 60." msgstr "" +"儒略日 (Julian day) *n*(1 <= *n* <= 365)。閏日不計算,因此在所有年份中,2 " +"月 28 日是第 59 天,3 月 1 日是第 60 天。" #: ../../library/time.rst:793 msgid ":samp:`{n}`" @@ -1396,6 +1428,7 @@ msgid "" "The zero-based Julian day (0 <= *n* <= 365). Leap days are counted, and it " "is possible to refer to February 29." msgstr "" +"從 0 開始的儒略日 (0 <= *n* <= 365)。閏日會計算,因此可以適用至 2 月 29 日。" #: ../../library/time.rst:797 msgid ":samp:`M{m}.{n}.{d}`" @@ -1408,12 +1441,17 @@ msgid "" "*m*\" which may occur in either the fourth or the fifth week). Week 1 is the " "first week in which the *d*'th day occurs. Day zero is a Sunday." msgstr "" +"一年中第 *m* 月的第 *n* 週的第 *d* 天(0 <= *d* <= 6,1 <= *n* <= 5,1 <= " +"*m* <= 12,其中 *n* 為 5 表示「該月的最後一個第 *d* 天」,這可能出現在第四或" +"第五週)。第 1 週是 *d* 天首次出現的那一週。第零天為星期天。" #: ../../library/time.rst:804 msgid "" "``time`` has the same format as ``offset`` except that no leading sign ('-' " "or '+') is allowed. The default, if time is not given, is 02:00:00." msgstr "" +"``time`` 的格式與 ``offset`` 相同,但不允許出現前導符號('-' 或 '+')。如果未" +"指定時間,則預設為 02:00:00。" #: ../../library/time.rst:809 msgid "" @@ -1445,6 +1483,12 @@ msgid "" "located at :file:`/usr/share/zoneinfo`. For example, ``'US/Eastern'``, " "``'Australia/Melbourne'``, ``'Egypt'`` or ``'Europe/Amsterdam'``. ::" msgstr "" +"在許多 Unix 系統(包括 \\*BSD、Linux、Solaris 和 Darwin)上,使用系統的 " +"zoneinfo (:manpage:`tzfile(5)`) 資料庫來指定時區規則會更加方便。要這樣做,請" +"將 :envvar:`TZ` 環境變數設定為所需時區資料檔案的路徑,相對於系統 'zoneinfo' " +"時區資料庫的根目錄,通常位於 :file:`/usr/share/zoneinfo`。例如,``'US/" +"Eastern'``、``'Australia/Melbourne'``、``'Egypt'`` 或 ``'Europe/" +"Amsterdam'``。 ::" #: ../../library/time.rst:826 msgid "" @@ -1457,22 +1501,31 @@ msgid "" ">>> time.tzname\n" "('EET', 'EEST')" msgstr "" +">>> os.environ['TZ'] = 'US/Eastern'\n" +">>> time.tzset()\n" +">>> time.tzname\n" +"('EST', 'EDT')\n" +">>> os.environ['TZ'] = 'Egypt'\n" +">>> time.tzset()\n" +">>> time.tzname\n" +"('EET', 'EEST')" #: ../../library/time.rst:839 msgid "Clock ID Constants" -msgstr "" +msgstr "時鐘 ID 常數" #: ../../library/time.rst:841 msgid "" "These constants are used as parameters for :func:`clock_getres` and :func:" "`clock_gettime`." -msgstr "" +msgstr "這些常數用作 :func:`clock_getres` 和 :func:`clock_gettime` 的參數。" #: ../../library/time.rst:846 msgid "" "Identical to :data:`CLOCK_MONOTONIC`, except it also includes any time that " "the system is suspended." msgstr "" +"與 :data:`CLOCK_MONOTONIC` 基本相同,不同之處在於它還包括系統暫停的任何時間。" #: ../../library/time.rst:849 msgid "" @@ -1481,6 +1534,9 @@ msgid "" "have discontinuities if the time is changed using ``settimeofday()`` or " "similar." msgstr "" +"這允許應用程式獲取一個能夠感知暫停的單調時鐘,而無需處理 :data:" +"`CLOCK_REALTIME` 的複雜情況,後者在使用 ``settimeofday()`` 或類似函式更改時間" +"時可能會出現不連續的情況。" #: ../../library/time.rst:861 msgid "" @@ -1488,50 +1544,61 @@ msgid "" "hardware source, and may give close to nanosecond resolution. " "``CLOCK_HIGHRES`` is the nonadjustable, high-resolution clock." msgstr "" +"Solaris 作業系統具有 ``CLOCK_HIGHRES`` 計時器,它嘗試使用最佳的硬體資源,並可" +"能提供接近奈秒的解析度。``CLOCK_HIGHRES`` 是不可調整且高解析度的時鐘。" #: ../../library/time.rst:872 msgid "" "Clock that cannot be set and represents monotonic time since some " "unspecified starting point." -msgstr "" +msgstr "該時鐘無法被設定,其表示自某個未指定起點以來的單調時間。" #: ../../library/time.rst:882 msgid "" "Similar to :data:`CLOCK_MONOTONIC`, but provides access to a raw hardware-" "based time that is not subject to NTP adjustments." msgstr "" +"類似於 :data:`CLOCK_MONOTONIC`,但提供對基於硬體的原始時間的存取,此時間不受 " +"NTP 調整的影響。" #: ../../library/time.rst:891 msgid "" "Similar to :data:`CLOCK_MONOTONIC_RAW`, but reads a value cached by the " "system at context switch and hence has less accuracy." msgstr "" +"類似於 :data:`CLOCK_MONOTONIC_RAW`,但讀取的是系統在情境切換時快取的值,因此" +"精準度較低。" #: ../../library/time.rst:901 ../../library/time.rst:910 msgid "High-resolution per-process timer from the CPU." -msgstr "" +msgstr "來自 CPU 的高解析度每個行程的計時器。" #: ../../library/time.rst:918 msgid "" "`International Atomic Time `_" msgstr "" +"`國際原子時間 `_" #: ../../library/time.rst:920 msgid "" "The system must have a current leap second table in order for this to give " "the correct answer. PTP or NTP software can maintain a leap second table." msgstr "" +"系統必須擁有當前的閏秒表才能給出正確答案。PTP 或 NTP 軟體可以維護閏秒表。" #: ../../library/time.rst:929 msgid "Thread-specific CPU-time clock." -msgstr "" +msgstr "執行緒相關的 CPU 時間時鐘。" #: ../../library/time.rst:938 msgid "" "Time whose absolute value is the time the system has been running and not " "suspended, providing accurate uptime measurement, both absolute and interval." msgstr "" +"表示系統運作且無暫停的絕對時間,提供包括絕對時間 (absolute) 和時間區間 " +"(interval) 的精確的正常上線時間 (uptime) 測量。" #: ../../library/time.rst:949 msgid "" @@ -1539,28 +1606,32 @@ msgid "" "point, unaffected by frequency or time adjustments and not incremented while " "the system is asleep." msgstr "" +"單調增量的時鐘,從某個任意點開始計時,不受頻率或時間調整影響,並且在系統休眠" +"時不增量。" #: ../../library/time.rst:959 msgid "" "Like :data:`CLOCK_UPTIME_RAW`, but the value is cached by the system at " "context switches and therefore has less accuracy." msgstr "" +"類似於 :data:`CLOCK_UPTIME_RAW`,但該值在情境切換時由系統快取,因此精準度較" +"低。" #: ../../library/time.rst:966 msgid "" "The following constant is the only parameter that can be sent to :func:" "`clock_settime`." -msgstr "" +msgstr "以下常數是唯一可以傳遞給 :func:`clock_settime` 的參數。" #: ../../library/time.rst:972 msgid "" "System-wide real-time clock. Setting this clock requires appropriate " "privileges." -msgstr "" +msgstr "涵蓋整個系統的即時時鐘。設定此時鐘需要適當的權限。" #: ../../library/time.rst:983 msgid "Timezone Constants" -msgstr "" +msgstr "時區常數" #: ../../library/time.rst:987 msgid "" @@ -1569,10 +1640,13 @@ msgid "" "Western Europe, including the UK). Only use this if ``daylight`` is " "nonzero. See note below." msgstr "" +"如果本地 DST 時區有被定義,則此值為本地 DST 時區相對於 UTC 以西的偏移量(以秒" +"為單位)。若本地 DST 時區位於 UTC 以東(例如包括英國在內的西歐),則此值為負" +"值。僅在 ``daylight`` 為非零時使用此值。詳情請參見下方註釋。" #: ../../library/time.rst:993 msgid "Nonzero if a DST timezone is defined. See note below." -msgstr "" +msgstr "如果定義了 DST 時區,則為非零值。詳情請參見下方註釋。" #: ../../library/time.rst:997 msgid "" @@ -1580,6 +1654,8 @@ msgid "" "in most of Western Europe, positive in the US, zero in the UK). See note " "below." msgstr "" +"本地(非 DST)時區相對於 UTC 以西的偏移量(以秒為單位),西歐大多數地區為負," +"美國為正,英國為零。詳情請參見下方註釋。" #: ../../library/time.rst:1002 msgid "" @@ -1587,6 +1663,8 @@ msgid "" "the second is the name of the local DST timezone. If no DST timezone is " "defined, the second string should not be used. See note below." msgstr "" +"一個包含兩個字串的元組:第一個是本地非 DST 時區的名稱,第二個是本地 DST 時區" +"的名稱。如果沒有定義 DST 時區,則不應使用第二個字串。詳情請參見下方註釋。" #: ../../library/time.rst:1008 msgid "" @@ -1597,6 +1675,10 @@ msgid "" "attr:`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` results from :" "func:`localtime` to obtain timezone information." msgstr "" +"對於上述時區常數(:data:`altzone`、:data:`daylight`、:data:`timezone` 和 :" +"data:`tzname`),其值由模組載入時或 :func:`tzset` 最後一次被呼叫時的時區規則" +"決定,且過去的時間可能會不準確。建議使用 :func:`localtime` 回傳的 :attr:" +"`~struct_time.tm_gmtoff` 和 :attr:`~struct_time.tm_zone` 來獲取時區資訊。" #: ../../library/time.rst:1017 msgid "Module :mod:`datetime`" @@ -1604,7 +1686,7 @@ msgstr ":mod:`datetime` 模組" #: ../../library/time.rst:1018 msgid "More object-oriented interface to dates and times." -msgstr "" +msgstr "更多物件導向的日期和時間介面。" #: ../../library/time.rst:1020 msgid "Module :mod:`locale`" @@ -1616,6 +1698,8 @@ msgid "" "interpretation of many format specifiers in :func:`strftime` and :func:" "`strptime`." msgstr "" +"國際化服務。區域設定會影響 :func:`strftime` 和 :func:`strptime` 中許多格式指" +"定符號 (format specifiers) 的解譯。" #: ../../library/time.rst:1024 msgid "Module :mod:`calendar`" @@ -1626,6 +1710,8 @@ msgid "" "General calendar-related functions. :func:`~calendar.timegm` is the " "inverse of :func:`gmtime` from this module." msgstr "" +"通用的日曆相關函式。:func:`~calendar.timegm` 是本模組中 :func:`gmtime` 的反函" +"式。" #: ../../library/time.rst:1029 msgid "Footnotes" @@ -1641,6 +1727,11 @@ msgid "" "the 4-digit year has been first recommended by :rfc:`1123` and then mandated " "by :rfc:`2822`." msgstr "" +"現在 ``%Z`` 已被棄用,``%z`` 藉由擴展為偏好的小時/分鐘偏移而逃離了被棄用的命" +"運,但其並不是被所有 ANSI C 函式庫支援。此外,嚴格按照 1982 年的 :rfc:`822` " +"標準,應該使用兩位數年份(``%y`` 而不是 ``%Y``),但實作中在 2000 年之前就已" +"經轉向使用四位數年份。之後,:rfc:`822` 被淘汰,四位數年份首先由 :rfc:`1123` " +"推薦,然後由 :rfc:`2822` 正式批准。" #: ../../library/time.rst:22 msgid "epoch" From 9e4dde8f6cb4124720c3c4c902d837d043a16581 Mon Sep 17 00:00:00 2001 From: "Wei-Hsiang (Matt) Wang" Date: Fri, 22 Nov 2024 15:46:18 +0800 Subject: [PATCH 55/89] Translate `library/sys.monitoring` (#892) * translate `library/sys.monitoring.po` * Apply suggestions from code review Co-authored-by: mindihx --------- Co-authored-by: mindihx --- library/sys.monitoring.po | 169 ++++++++++++++++++++++++++------------ 1 file changed, 116 insertions(+), 53 deletions(-) diff --git a/library/sys.monitoring.po b/library/sys.monitoring.po index 99edc3a8a0..e09420449f 100644 --- a/library/sys.monitoring.po +++ b/library/sys.monitoring.po @@ -1,16 +1,16 @@ # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy +# Translators: +# Matt Wang , 2024 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"POT-Creation-Date: 2024-10-19 01:58+0800\n" +"PO-Revision-Date: 2024-10-21 17:51+0800\n" +"Last-Translator: Matt Wang \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -18,7 +18,7 @@ msgstr "" #: ../../library/sys.monitoring.rst:2 msgid ":mod:`!sys.monitoring` --- Execution event monitoring" -msgstr "" +msgstr ":mod:`!sys.monitoring` --- 執行事件監控" #: ../../library/sys.monitoring.rst:13 msgid "" @@ -26,12 +26,15 @@ msgid "" "independent module, so there is no need to ``import sys.monitoring``, simply " "``import sys`` and then use ``sys.monitoring``." msgstr "" +":mod:`sys.monitoring` 是 :mod:`sys` 模組內的一個命名空間,不是一個獨立的模" +"組,所以不需要 ``import sys.monitoring``,只需 ``import sys`` 然後使用 ``sys." +"monitoring``。" #: ../../library/sys.monitoring.rst:19 msgid "" "This namespace provides access to the functions and constants necessary to " "activate and control event monitoring." -msgstr "" +msgstr "此命名空間提供對啟動和控制事件監控所需的函式和常數的存取。" #: ../../library/sys.monitoring.rst:22 msgid "" @@ -39,18 +42,20 @@ msgid "" "monitor execution. The :mod:`sys.monitoring` namespace provides means to " "receive callbacks when events of interest occur." msgstr "" +"當程式執行時,會發生一些能被監控工具關注的事件。:mod:`sys.monitoring` 命名空" +"間提供了在發生欲關注事件時接收回呼的方法。" #: ../../library/sys.monitoring.rst:26 msgid "The monitoring API consists of three components:" -msgstr "" +msgstr "監控 API 由三個元件組成:" #: ../../library/sys.monitoring.rst:28 msgid "`Tool identifiers`_" -msgstr "`Tool identifiers`_" +msgstr "`工具識別器 `_" #: ../../library/sys.monitoring.rst:29 msgid "`Events`_" -msgstr "`Events`_" +msgstr "`事件 `_" #: ../../library/sys.monitoring.rst:30 msgid ":ref:`Callbacks `" @@ -58,7 +63,7 @@ msgstr ":ref:`回呼 (callbacks) `" #: ../../library/sys.monitoring.rst:33 msgid "Tool identifiers" -msgstr "" +msgstr "工具識別器" #: ../../library/sys.monitoring.rst:35 msgid "" @@ -68,26 +73,32 @@ msgid "" "independent and cannot be used to monitor each other. This restriction may " "be lifted in the future." msgstr "" +"工具識別器是一個整數和關聯的名稱。工具識別器用於防止工具相互干擾並允許多個工" +"具同時運作。目前工具是完全獨立的,不能用來互相監控。將來此限制可能會取消。" #: ../../library/sys.monitoring.rst:41 msgid "" "Before registering or activating events, a tool should choose an identifier. " "Identifiers are integers in the range 0 to 5 inclusive." msgstr "" +"在註冊或啟動事件之前,工具應選擇一個識別器。識別器是 0 到 5(含)範圍內的整" +"數。" #: ../../library/sys.monitoring.rst:45 msgid "Registering and using tools" -msgstr "" +msgstr "註冊和使用工具" #: ../../library/sys.monitoring.rst:49 msgid "" "Must be called before *tool_id* can be used. *tool_id* must be in the range " "0 to 5 inclusive. Raises a :exc:`ValueError` if *tool_id* is in use." msgstr "" +"必須在使用 *tool_id* 之前呼叫。*tool_id* 必須在 0 到 5(含)範圍內。如果 " +"*tool_id* 正在使用,則引發 :exc:`ValueError`。" #: ../../library/sys.monitoring.rst:55 msgid "Should be called once a tool no longer requires *tool_id*." -msgstr "" +msgstr "一旦工具不再需要 *tool_id* 就應該被呼叫。" #: ../../library/sys.monitoring.rst:59 msgid "" @@ -96,18 +107,24 @@ msgid "" "only intended to be used to notify the VM that the particular *tool_id* is " "no longer in use." msgstr "" +":func:`free_tool_id` 不會停用與 *tool_id* 相關的全域或區域事件,也不會取消註" +"冊任何回呼函式。這個函式只是用來通知虛擬機器 (VM) 不再使用特定的 *tool_id*。" #: ../../library/sys.monitoring.rst:66 msgid "" "Returns the name of the tool if *tool_id* is in use, otherwise it returns " "``None``. *tool_id* must be in the range 0 to 5 inclusive." msgstr "" +"如果 *tool_id* 正在使用,則回傳該工具的名稱,否則回傳 ``None``。*tool_id* 必" +"須在 0 到 5(含)範圍內。" #: ../../library/sys.monitoring.rst:70 msgid "" "All IDs are treated the same by the VM with regard to events, but the " "following IDs are pre-defined to make co-operation of tools easier::" msgstr "" +"對於事件,虛擬機器對所有 ID 的處理都是相同的,但預先定義了以下 ID,以使工具間" +"的協作更容易: ::" #: ../../library/sys.monitoring.rst:73 msgid "" @@ -127,99 +144,105 @@ msgstr "事件" #: ../../library/sys.monitoring.rst:82 msgid "The following events are supported:" -msgstr "" +msgstr "支援以下事件:" #: ../../library/sys.monitoring.rst:86 msgid "A conditional branch is taken (or not)." -msgstr "" +msgstr "採取(或不採取)一個條件分支。" #: ../../library/sys.monitoring.rst:90 msgid "A call in Python code (event occurs before the call)." -msgstr "" +msgstr "Python 程式碼中的呼叫(事件發生在呼叫之前)。" #: ../../library/sys.monitoring.rst:94 msgid "" "An exception raised from any callable, except for Python functions (event " "occurs after the exit)." -msgstr "" +msgstr "從任何可呼叫物件引發的例外,除 Python 函式外(事件發生在退出之後)。" #: ../../library/sys.monitoring.rst:98 msgid "" "Return from any callable, except for Python functions (event occurs after " "the return)." -msgstr "" +msgstr "從任何可呼叫函式回傳,除 Python 函式外(事件發生在回傳之後)。" #: ../../library/sys.monitoring.rst:102 msgid "An exception is handled." -msgstr "" +msgstr "一個例外被處理。" #: ../../library/sys.monitoring.rst:106 msgid "A VM instruction is about to be executed." -msgstr "" +msgstr "虛擬機器指令即將被執行。" #: ../../library/sys.monitoring.rst:110 msgid "An unconditional jump in the control flow graph is made." -msgstr "" +msgstr "在控制流程圖中進行無條件跳轉。" #: ../../library/sys.monitoring.rst:114 msgid "" "An instruction is about to be executed that has a different line number from " "the preceding instruction." -msgstr "" +msgstr "即將執行的指令與前一條指令的列號不同。" #: ../../library/sys.monitoring.rst:118 msgid "" "Resumption of a Python function (for generator and coroutine functions), " "except for ``throw()`` calls." -msgstr "" +msgstr "Python 函式的繼續執行(對於產生器和協程函式),除了 ``throw()`` 呼叫。" #: ../../library/sys.monitoring.rst:122 msgid "" "Return from a Python function (occurs immediately before the return, the " "callee's frame will be on the stack)." msgstr "" +"從 Python 函式回傳(發生在即將回傳之前,被呼叫者的 frame 將位於堆疊上)。" #: ../../library/sys.monitoring.rst:126 msgid "" "Start of a Python function (occurs immediately after the call, the callee's " "frame will be on the stack)" -msgstr "" +msgstr "Python 函式的開始(在呼叫後立即發生,被呼叫者的 frame 將位於堆疊上)" #: ../../library/sys.monitoring.rst:130 msgid "A Python function is resumed by a ``throw()`` call." -msgstr "" +msgstr "Python 函式透過 ``throw()`` 呼叫來繼續。" #: ../../library/sys.monitoring.rst:134 msgid "Exit from a Python function during exception unwinding." -msgstr "" +msgstr "在例外展開 (unwind) 期間從 Python 函式退出。" #: ../../library/sys.monitoring.rst:138 msgid "" "Yield from a Python function (occurs immediately before the yield, the " "callee's frame will be on the stack)." msgstr "" +"來自 Python 函式的 yield(在即將 yield 之前發生,被呼叫者的 frame 將位於堆疊" +"上)。" #: ../../library/sys.monitoring.rst:142 msgid "" "An exception is raised, except those that cause a :monitoring-event:" "`STOP_ITERATION` event." msgstr "" +"例外被引發,除了那些會導致 :monitoring-event:`STOP_ITERATION` 的事件外。" #: ../../library/sys.monitoring.rst:146 msgid "" "An exception is re-raised, for example at the end of a :keyword:`finally` " "block." -msgstr "" +msgstr "例外被重新引發 (re-raise),例如在 :keyword:`finally` 區塊的最後。" #: ../../library/sys.monitoring.rst:150 msgid "" "An artificial :exc:`StopIteration` is raised; see `the STOP_ITERATION " "event`_." msgstr "" +"一個人為的 :exc:`StopIteration` 被引發;請參閱 `STOP_ITERATION 事件 `_。" #: ../../library/sys.monitoring.rst:153 msgid "More events may be added in the future." -msgstr "" +msgstr "將來可能會新增更多事件。" #: ../../library/sys.monitoring.rst:155 msgid "" @@ -229,10 +252,14 @@ msgid "" "specify both :monitoring-event:`PY_RETURN` and :monitoring-event:`PY_START` " "events, use the expression ``PY_RETURN | PY_START``." msgstr "" +"這些事件是 :mod:`!sys.monitoring.events` 命名空間的屬性。每個事件以 2 次方的" +"整數常數表示。要定義一組事件,只要將個別事件以 bitwise or 相接即可。例如,若" +"要指定 :monitoring-event:`PY_RETURN` 和 :monitoring-event:`PY_START` 兩個事" +"件,請使用運算式 ``PY_RETURN | PY_START``。" #: ../../library/sys.monitoring.rst:163 msgid "An alias for ``0`` so users can do explicit comparisons like::" -msgstr "" +msgstr "``0`` 的別名,以便使用者可以進行明確比較,例如: ::" #: ../../library/sys.monitoring.rst:165 msgid "" @@ -244,11 +271,11 @@ msgstr "" #: ../../library/sys.monitoring.rst:168 msgid "Events are divided into three groups:" -msgstr "" +msgstr "事件被分為三組:" #: ../../library/sys.monitoring.rst:171 msgid "Local events" -msgstr "" +msgstr "區域事件" #: ../../library/sys.monitoring.rst:173 msgid "" @@ -256,6 +283,8 @@ msgid "" "at clearly defined locations. All local events can be disabled. The local " "events are:" msgstr "" +"區域事件與程式的正常執行相關,並發生在明確定義的位置。所有區域事件都可以被停" +"用。區域事件有:" #: ../../library/sys.monitoring.rst:177 msgid ":monitoring-event:`PY_START`" @@ -299,13 +328,13 @@ msgstr ":monitoring-event:`STOP_ITERATION`" #: ../../library/sys.monitoring.rst:189 msgid "Ancillary events" -msgstr "輔助事件" +msgstr "附屬事件 (ancillary events)" #: ../../library/sys.monitoring.rst:191 msgid "" "Ancillary events can be monitored like other events, but are controlled by " "another event:" -msgstr "" +msgstr "附屬事件可以像其他事件一樣被監控,但由另一個事件所控制:" #: ../../library/sys.monitoring.rst:194 msgid ":monitoring-event:`C_RAISE`" @@ -322,6 +351,10 @@ msgid "" "`C_RETURN` and :monitoring-event:`C_RAISE` events will only be seen if the " "corresponding :monitoring-event:`CALL` event is being monitored." msgstr "" +":monitoring-event:`C_RETURN` 和 :monitoring-event:`C_RAISE` 事件由 :" +"monitoring-event:`CALL` 事件控制。只有當對應的 :monitoring-event:`CALL` 事件" +"受到監控時,才會看到 :monitoring-event:`C_RETURN` 和 :monitoring-event:" +"`C_RAISE` 事件。" #: ../../library/sys.monitoring.rst:203 msgid "Other events" @@ -331,11 +364,11 @@ msgstr "其他事件" msgid "" "Other events are not necessarily tied to a specific location in the program " "and cannot be individually disabled." -msgstr "" +msgstr "其他事件不一定與程式中的特定位置相關聯,也不能單獨停用。" #: ../../library/sys.monitoring.rst:208 msgid "The other events that can be monitored are:" -msgstr "" +msgstr "其他可以監控的事件有:" #: ../../library/sys.monitoring.rst:210 msgid ":monitoring-event:`PY_THROW`" @@ -355,7 +388,7 @@ msgstr ":monitoring-event:`EXCEPTION_HANDLED`" #: ../../library/sys.monitoring.rst:217 msgid "The STOP_ITERATION event" -msgstr "" +msgstr "STOP_ITERATION 事件" #: ../../library/sys.monitoring.rst:219 msgid "" @@ -365,6 +398,10 @@ msgid "" "value, so some Python implementations, notably CPython 3.12+, do not raise " "an exception unless it would be visible to other code." msgstr "" +":pep:`PEP 380 <380#use-of-stopiteration-to-return-values>` 指出從產生器或協程" +"回傳值時要引發 :exc:`StopIteration` 例外。然而,這是一種非常低效的回傳值方" +"式,因此有一些 Python 實作(特別是 CPython 3.12+)不會引發例外,除非它對其他" +"程式碼是可見的。" #: ../../library/sys.monitoring.rst:225 msgid "" @@ -373,10 +410,13 @@ msgid "" "provided. :monitoring-event:`STOP_ITERATION` can be locally disabled, " "unlike :monitoring-event:`RAISE`." msgstr "" +"為了允許工具去監控真正的例外而不減慢產生器和協程的速度,提供了 :monitoring-" +"event:`STOP_ITERATION` 事件。與 :monitoring-event:`RAISE` 不同,:monitoring-" +"event:`STOP_ITERATION` 可以區域停用。" #: ../../library/sys.monitoring.rst:231 msgid "Turning events on and off" -msgstr "" +msgstr "開啟和關閉事件" #: ../../library/sys.monitoring.rst:233 msgid "" @@ -384,34 +424,38 @@ msgid "" "callback must be registered. Events can be turned on or off by setting the " "events either globally or for a particular code object." msgstr "" +"為了監控一個事件,必須打開它並註冊相應的回呼。可以透過將事件設定為全域或只為" +"特定程式碼物件來開啟或關閉事件。" #: ../../library/sys.monitoring.rst:240 msgid "Setting events globally" -msgstr "" +msgstr "全域設定事件" #: ../../library/sys.monitoring.rst:242 msgid "" "Events can be controlled globally by modifying the set of events being " "monitored." -msgstr "" +msgstr "可以透過修改正在監控的事件集合來全域地控制事件。" #: ../../library/sys.monitoring.rst:246 msgid "Returns the ``int`` representing all the active events." -msgstr "" +msgstr "回傳代表所有有效事件的 ``int``。" #: ../../library/sys.monitoring.rst:250 msgid "" "Activates all events which are set in *event_set*. Raises a :exc:" "`ValueError` if *tool_id* is not in use." msgstr "" +"啟動 *event_set* 中設定的所有事件。如果 *tool_id* 並未正在被使用,則引發 :" +"exc:`ValueError`。" #: ../../library/sys.monitoring.rst:253 msgid "No events are active by default." -msgstr "" +msgstr "預設沒有有效事件。" #: ../../library/sys.monitoring.rst:256 msgid "Per code object events" -msgstr "" +msgstr "各別程式碼物件事件" #: ../../library/sys.monitoring.rst:258 msgid "" @@ -420,22 +464,29 @@ msgid "" "accept a look-alike object from functions which are not defined in Python " "(see :ref:`c-api-monitoring`)." msgstr "" +"事件還可以基於各別程式碼物件進行控制。下面定義的、接受 :class:`types." +"CodeType` 的函式應該準備好接受來自 Python 中未定義函式的類似物件(請參閱 :" +"ref:`c-api-monitoring`)。" #: ../../library/sys.monitoring.rst:265 msgid "Returns all the local events for *code*" -msgstr "" +msgstr "回傳 *code* 的所有區域事件" #: ../../library/sys.monitoring.rst:269 msgid "" "Activates all the local events for *code* which are set in *event_set*. " "Raises a :exc:`ValueError` if *tool_id* is not in use." msgstr "" +"啟動 *event_set* 中針對 *code* 設定的所有區域事件。如果 *tool_id* 並未正在被" +"使用,則引發 :exc:`ValueError`。" #: ../../library/sys.monitoring.rst:272 msgid "" "Local events add to global events, but do not mask them. In other words, all " "global events will trigger for a code object, regardless of the local events." msgstr "" +"區域事件會加入到全域事件中,但不會掩蓋它們。換句話說,無論區域事件如何,所有" +"全域事件都將為程式碼物件觸發。" #: ../../library/sys.monitoring.rst:278 msgid "Disabling events" @@ -445,7 +496,7 @@ msgstr "停用事件" msgid "" "A special value that can be returned from a callback function to disable " "events for the current code location." -msgstr "" +msgstr "可以從回呼函式回傳的特殊值,以停用當前程式碼位置的事件。" #: ../../library/sys.monitoring.rst:285 msgid "" @@ -453,6 +504,8 @@ msgid "" "`sys.monitoring.DISABLE` from a callback function. This does not change " "which events are set, or any other code locations for the same event." msgstr "" +"可透過回呼函式回傳 :data:`sys.monitoring.DISABLE` 來停用特定程式碼位置的區域" +"事件。這不會改變被設定的事件,或相同事件的任何其他程式碼位置。" #: ../../library/sys.monitoring.rst:289 msgid "" @@ -461,12 +514,14 @@ msgid "" "with no overhead if the debugger disables all monitoring except for a few " "breakpoints." msgstr "" +"停用特定位置的事件對於高效能監控非常重要。舉例來說,如果除少數斷點外,偵錯器" +"可以停用所有監控,那麼在偵錯器下執行程式就不會有任何開銷 (overhead)。" #: ../../library/sys.monitoring.rst:296 msgid "" "Enable all the events that were disabled by :data:`sys.monitoring.DISABLE` " "for all tools." -msgstr "" +msgstr "為所有工具啟用由 :data:`sys.monitoring.DISABLE` 停用的所有事件。" #: ../../library/sys.monitoring.rst:303 msgid "Registering callback functions" @@ -474,11 +529,11 @@ msgstr "註冊回呼函式" #: ../../library/sys.monitoring.rst:305 msgid "To register a callable for events call" -msgstr "" +msgstr "用來註冊對事件呼叫的可呼叫物件" #: ../../library/sys.monitoring.rst:309 msgid "Registers the callable *func* for the *event* with the given *tool_id*" -msgstr "" +msgstr "使用給定的 *tool_id* 來註冊對 *event* 的可呼叫物件 *func*" #: ../../library/sys.monitoring.rst:311 msgid "" @@ -486,22 +541,26 @@ msgid "" "is unregistered and returned. Otherwise :func:`register_callback` returns " "``None``." msgstr "" +"如果給定的 *tool_id* 和 *event* 已經註冊了另一個回呼,則會取消註冊並回傳。否" +"則 :func:`register_callback` 會回傳 ``None``。" #: ../../library/sys.monitoring.rst:316 msgid "" "Functions can be unregistered by calling ``sys.monitoring." "register_callback(tool_id, event, None)``." msgstr "" +"可以透過呼叫 ``sys.monitoring.register_callback(tool_id, event, None)`` 來取" +"消註冊函式。" #: ../../library/sys.monitoring.rst:319 msgid "Callback functions can be registered and unregistered at any time." -msgstr "" +msgstr "回呼函式可以隨時被註冊和取消註冊。" #: ../../library/sys.monitoring.rst:321 msgid "" "Registering or unregistering a callback function will generate a :func:`sys." "audit` event." -msgstr "" +msgstr "註冊或取消註冊回呼函式將產生 :func:`sys.audit` 事件。" #: ../../library/sys.monitoring.rst:325 msgid "Callback function arguments" @@ -511,7 +570,7 @@ msgstr "回呼函式引數" msgid "" "A special value that is passed to a callback function to indicate that there " "are no arguments to the call." -msgstr "" +msgstr "傳遞給回呼函式的特殊值,表示該呼叫沒有引數。" #: ../../library/sys.monitoring.rst:332 msgid "" @@ -519,6 +578,8 @@ msgid "" "Different events will provide the callback function with different " "arguments, as follows:" msgstr "" +"當有效事件發生時,已註冊的回呼函式會被呼叫。不同的事件會為回呼函式提供不同的" +"引數,如下所示:" #: ../../library/sys.monitoring.rst:335 msgid ":monitoring-event:`PY_START` and :monitoring-event:`PY_RESUME`::" @@ -559,7 +620,7 @@ msgstr "" #: ../../library/sys.monitoring.rst:347 msgid "" "If there are no arguments, *arg0* is set to :data:`sys.monitoring.MISSING`." -msgstr "" +msgstr "如果沒有引數,*arg0* 將被設定為 :data:`sys.monitoring.MISSING`。" #: ../../library/sys.monitoring.rst:349 msgid "" @@ -605,6 +666,8 @@ msgid "" "an untaken branch this will be the offset of the instruction following the " "branch." msgstr "" +"請注意,*destination_offset* 是程式碼接下來要執行的地方。對於未採用的分支,這" +"將是該分支之後的指令的偏移量。" #: ../../library/sys.monitoring.rst:366 msgid ":monitoring-event:`INSTRUCTION`::" From 2f9db7be04583bc301ad202c0e62e769922829f3 Mon Sep 17 00:00:00 2001 From: Payon Date: Fri, 22 Nov 2024 15:48:31 +0800 Subject: [PATCH 56/89] fix: remove the translation since it caused the page to miss some text (#1001) --- library/time.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/time.po b/library/time.po index a3390646e8..8b595a42b9 100644 --- a/library/time.po +++ b/library/time.po @@ -275,7 +275,7 @@ msgstr "" #: ../../library/time.rst:953 ../../library/time.rst:962 #: ../../library/time.rst:975 msgid "Availability" -msgstr ":ref:`適用 `" +msgstr "" #: ../../library/time.rst:151 msgid "" From fc9f0d6989dfc51f6e4c80e76c25a8bd34977983 Mon Sep 17 00:00:00 2001 From: "pydoc-zh-tw[bot]" <90344106+pydoc-zh-tw[bot]@users.noreply.github.com> Date: Sun, 1 Dec 2024 07:06:04 +0800 Subject: [PATCH 57/89] Sync with CPython 3.13 (#998) Co-authored-by: github-actions[bot] Co-authored-by: Wei-Hsiang (Matt) Wang --- c-api/frame.po | 5 +- c-api/init.po | 439 ++++--- c-api/monitoring.po | 33 +- c-api/time.po | 7 +- deprecations/c-api-pending-removal-in-3.14.po | 4 +- deprecations/c-api-pending-removal-in-3.15.po | 5 +- .../c-api-pending-removal-in-future.po | 5 +- deprecations/index.po | 14 +- deprecations/pending-removal-in-3.13.po | 4 +- deprecations/pending-removal-in-3.14.po | 4 +- deprecations/pending-removal-in-3.15.po | 4 +- deprecations/pending-removal-in-3.16.po | 7 +- deprecations/pending-removal-in-future.po | 5 +- howto/argparse-optparse.po | 7 +- howto/descriptor.po | 167 +-- howto/enum.po | 779 +++++------ howto/free-threading-extensions.po | 5 +- howto/free-threading-python.po | 3 +- howto/isolating-extensions.po | 3 +- howto/mro.po | 3 +- howto/timerfd.po | 4 +- library/aifc.po | 39 + library/argparse.po | 504 ++++---- library/asynchat.po | 43 + library/asyncio-eventloop.po | 37 +- library/asyncio-extending.po | 4 +- library/asyncio-runner.po | 4 +- library/asyncio-stream.po | 196 +-- library/asyncio-sync.po | 28 +- library/asyncore.po | 43 + library/audioop.po | 39 + library/cgi.po | 48 + library/cgitb.po | 48 + library/chunk.po | 39 + library/crypt.po | 50 + library/crypto.po | 5 +- library/ctypes.po | 561 ++++---- library/distutils.po | 41 + library/imghdr.po | 48 + library/imp.po | 46 + library/importlib.metadata.po | 8 +- library/importlib.resources.abc.po | 4 +- library/importlib.resources.po | 38 +- library/locale.po | 138 +- library/mailcap.po | 39 + library/marshal.po | 31 +- library/math.po | 1149 +++++++++-------- library/msilib.po | 39 + library/multiprocessing.po | 10 +- library/multiprocessing.shared_memory.po | 2 +- library/nis.po | 39 + library/nntplib.po | 39 + library/ossaudiodev.po | 39 + library/pickle.po | 24 +- library/pipes.po | 43 + library/pprint.po | 14 +- library/removed.po | 28 + library/shutil.po | 192 ++- library/smtpd.po | 47 + library/sndhdr.po | 48 + library/socket.po | 488 +++---- library/spwd.po | 47 + library/sqlite3.po | 4 +- library/stdtypes.po | 7 +- library/sunau.po | 40 + library/sys.po | 551 ++++---- library/sys_path_init.po | 14 +- library/telnetlib.po | 48 + library/time.po | 8 +- library/typing.po | 29 +- library/urllib.parse.po | 189 +-- library/urllib.request.po | 579 +++++---- library/uu.po | 39 + library/xdrlib.po | 40 + reference/compound_stmts.po | 832 ++++++------ reference/expressions.po | 644 ++++----- reference/import.po | 4 +- tutorial/errors.po | 30 +- using/android.po | 23 +- using/configure.po | 613 ++++----- using/ios.po | 15 +- using/windows.po | 32 +- whatsnew/3.12.po | 643 ++++----- whatsnew/3.13.po | 677 +++++----- whatsnew/3.4.po | 4 +- whatsnew/3.6.po | 16 +- whatsnew/3.7.po | 8 +- whatsnew/3.8.po | 14 +- 88 files changed, 6142 insertions(+), 4797 deletions(-) create mode 100644 library/aifc.po create mode 100644 library/asynchat.po create mode 100644 library/asyncore.po create mode 100644 library/audioop.po create mode 100644 library/cgi.po create mode 100644 library/cgitb.po create mode 100644 library/chunk.po create mode 100644 library/crypt.po create mode 100644 library/distutils.po create mode 100644 library/imghdr.po create mode 100644 library/imp.po create mode 100644 library/mailcap.po create mode 100644 library/msilib.po create mode 100644 library/nis.po create mode 100644 library/nntplib.po create mode 100644 library/ossaudiodev.po create mode 100644 library/pipes.po create mode 100644 library/removed.po create mode 100644 library/smtpd.po create mode 100644 library/sndhdr.po create mode 100644 library/spwd.po create mode 100644 library/sunau.po create mode 100644 library/telnetlib.po create mode 100644 library/uu.po create mode 100644 library/xdrlib.po diff --git a/c-api/frame.po b/c-api/frame.po index 1e518a36e3..1616a3cc27 100644 --- a/c-api/frame.po +++ b/c-api/frame.po @@ -1,7 +1,5 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # #, fuzzy msgid "" @@ -11,7 +9,8 @@ msgstr "" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/c-api/init.po b/c-api/init.po index 1577394625..5809d4bf46 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # This file is distributed under the same license as the Python package. # @@ -8,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-22 00:13+0000\n" +"POT-Creation-Date: 2024-11-25 00:14+0000\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1439,7 +1438,7 @@ msgid "" msgstr "" #: ../../c-api/init.rst:1155 ../../c-api/init.rst:1214 -#: ../../c-api/init.rst:1496 +#: ../../c-api/init.rst:1499 msgid "" "Calling this function from a thread when the runtime is finalizing will " "terminate the thread, even if the thread was not created by Python. You can " @@ -1650,14 +1649,18 @@ msgid "" "Previously, that happened in :c:func:`PyThreadState_Delete`." msgstr "" -#: ../../c-api/init.rst:1338 +#: ../../c-api/init.rst:1335 +msgid "The :c:member:`PyThreadState.on_delete` callback was removed." +msgstr ":c:member:`PyThreadState.on_delete` 回呼已被移除。" + +#: ../../c-api/init.rst:1341 msgid "" "Destroy a thread state object. The global interpreter lock need not be " "held. The thread state must have been reset with a previous call to :c:func:" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1345 +#: ../../c-api/init.rst:1348 msgid "" "Destroy the current thread state and release the global interpreter lock. " "Like :c:func:`PyThreadState_Delete`, the global interpreter lock must be " @@ -1665,119 +1668,119 @@ msgid "" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1353 +#: ../../c-api/init.rst:1356 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1355 +#: ../../c-api/init.rst:1358 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: ../../c-api/init.rst:1358 +#: ../../c-api/init.rst:1361 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "也請見 :c:func:`PyEval_GetFrame`。" -#: ../../c-api/init.rst:1360 ../../c-api/init.rst:1369 -#: ../../c-api/init.rst:1378 +#: ../../c-api/init.rst:1363 ../../c-api/init.rst:1372 +#: ../../c-api/init.rst:1381 msgid "*tstate* must not be ``NULL``." msgstr "*tstate* 不可為 ``NULL``。" -#: ../../c-api/init.rst:1367 +#: ../../c-api/init.rst:1370 msgid "" "Get the unique thread state identifier of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1376 +#: ../../c-api/init.rst:1379 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1385 +#: ../../c-api/init.rst:1388 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1387 +#: ../../c-api/init.rst:1390 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -#: ../../c-api/init.rst:1394 +#: ../../c-api/init.rst:1397 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -#: ../../c-api/init.rst:1397 +#: ../../c-api/init.rst:1400 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -#: ../../c-api/init.rst:1405 +#: ../../c-api/init.rst:1408 msgid "Get the current interpreter." msgstr "" -#: ../../c-api/init.rst:1407 +#: ../../c-api/init.rst:1410 msgid "" "Issue a fatal error if there no current Python thread state or no current " "interpreter. It cannot return NULL." msgstr "" -#: ../../c-api/init.rst:1410 ../../c-api/init.rst:1420 +#: ../../c-api/init.rst:1413 ../../c-api/init.rst:1423 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/init.rst:1417 +#: ../../c-api/init.rst:1420 msgid "" "Return the interpreter's unique ID. If there was any error in doing so then " "``-1`` is returned and an error is set." msgstr "" -#: ../../c-api/init.rst:1427 +#: ../../c-api/init.rst:1430 msgid "" "Return a dictionary in which interpreter-specific data may be stored. If " "this function returns ``NULL`` then no exception has been raised and the " "caller should assume no interpreter-specific dict is available." msgstr "" -#: ../../c-api/init.rst:1431 +#: ../../c-api/init.rst:1434 msgid "" "This is not a replacement for :c:func:`PyModule_GetState()`, which " "extensions should use to store interpreter-specific state information." msgstr "" -#: ../../c-api/init.rst:1438 +#: ../../c-api/init.rst:1441 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1440 +#: ../../c-api/init.rst:1443 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1443 +#: ../../c-api/init.rst:1446 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1446 +#: ../../c-api/init.rst:1449 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: ../../c-api/init.rst:1451 +#: ../../c-api/init.rst:1454 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1453 ../../c-api/init.rst:1461 +#: ../../c-api/init.rst:1456 ../../c-api/init.rst:1464 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1459 +#: ../../c-api/init.rst:1462 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1468 +#: ../../c-api/init.rst:1471 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " @@ -1786,7 +1789,7 @@ msgid "" "raised and the caller should assume no current thread state is available." msgstr "" -#: ../../c-api/init.rst:1477 +#: ../../c-api/init.rst:1480 msgid "" "Asynchronously raise an exception in a thread. The *id* argument is the " "thread id of the target thread; *exc* is the exception object to be raised. " @@ -1798,33 +1801,33 @@ msgid "" "raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1485 +#: ../../c-api/init.rst:1488 msgid "" "The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" "`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1491 +#: ../../c-api/init.rst:1494 msgid "" "Acquire the global interpreter lock and set the current thread state to " "*tstate*, which must not be ``NULL``. The lock must have been created " "earlier. If this thread already has the lock, deadlock ensues." msgstr "" -#: ../../c-api/init.rst:1502 +#: ../../c-api/init.rst:1505 msgid "" "Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" "`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " "current thread if called while the interpreter is finalizing." msgstr "" -#: ../../c-api/init.rst:1507 +#: ../../c-api/init.rst:1510 msgid "" ":c:func:`PyEval_RestoreThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1513 +#: ../../c-api/init.rst:1516 msgid "" "Reset the current thread state to ``NULL`` and release the global " "interpreter lock. The lock must have been created earlier and must be held " @@ -1833,17 +1836,17 @@ msgid "" "isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1519 +#: ../../c-api/init.rst:1522 msgid "" ":c:func:`PyEval_SaveThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1526 +#: ../../c-api/init.rst:1529 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1528 +#: ../../c-api/init.rst:1531 msgid "" "While in most uses, you will only embed a single Python interpreter, there " "are cases where you need to create several independent interpreters in the " @@ -1851,7 +1854,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1533 +#: ../../c-api/init.rst:1536 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -1862,31 +1865,31 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1540 +#: ../../c-api/init.rst:1543 msgid "" "You can switch between sub-interpreters using the :c:func:" "`PyThreadState_Swap` function. You can create and destroy them using the " "following functions:" msgstr "" -#: ../../c-api/init.rst:1546 +#: ../../c-api/init.rst:1549 msgid "" "Structure containing most parameters to configure a sub-interpreter. Its " "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " "modified by the runtime." msgstr "" -#: ../../c-api/init.rst:1552 +#: ../../c-api/init.rst:1555 msgid "Structure fields:" msgstr "" -#: ../../c-api/init.rst:1556 +#: ../../c-api/init.rst:1559 msgid "" "If this is ``0`` then the sub-interpreter will use its own \"object\" " "allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" -#: ../../c-api/init.rst:1560 +#: ../../c-api/init.rst:1563 msgid "" "If this is ``0`` then :c:member:`~PyInterpreterConfig." "check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " @@ -1894,44 +1897,44 @@ msgid "" "`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: ../../c-api/init.rst:1568 +#: ../../c-api/init.rst:1571 msgid "" "If this is ``0`` then the runtime will not support forking the process in " "any thread where the sub-interpreter is currently active. Otherwise fork is " "unrestricted." msgstr "" -#: ../../c-api/init.rst:1572 +#: ../../c-api/init.rst:1575 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: ../../c-api/init.rst:1577 +#: ../../c-api/init.rst:1580 msgid "" "If this is ``0`` then the runtime will not support replacing the current " "process via exec (e.g. :func:`os.execv`) in any thread where the sub-" "interpreter is currently active. Otherwise exec is unrestricted." msgstr "" -#: ../../c-api/init.rst:1582 +#: ../../c-api/init.rst:1585 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: ../../c-api/init.rst:1587 +#: ../../c-api/init.rst:1590 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create threads. Otherwise threads are allowed." msgstr "" -#: ../../c-api/init.rst:1593 +#: ../../c-api/init.rst:1596 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create daemon threads. Otherwise daemon threads are allowed (as long as :c:" "member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" -#: ../../c-api/init.rst:1600 +#: ../../c-api/init.rst:1603 msgid "" "If this is ``0`` then all extension modules may be imported, including " "legacy (single-phase init) modules, in any thread where the sub-interpreter " @@ -1940,37 +1943,37 @@ msgid "" "`Py_mod_multiple_interpreters`.)" msgstr "" -#: ../../c-api/init.rst:1607 +#: ../../c-api/init.rst:1610 msgid "" "This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." "use_main_obmalloc` is ``0``." msgstr "" -#: ../../c-api/init.rst:1612 +#: ../../c-api/init.rst:1615 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: ../../c-api/init.rst:1619 +#: ../../c-api/init.rst:1622 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: ../../c-api/init.rst:1623 +#: ../../c-api/init.rst:1626 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: ../../c-api/init.rst:1627 +#: ../../c-api/init.rst:1630 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: ../../c-api/init.rst:1629 +#: ../../c-api/init.rst:1632 msgid "" "If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" "`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: ../../c-api/init.rst:1643 +#: ../../c-api/init.rst:1646 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " @@ -1983,13 +1986,13 @@ msgid "" "underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1653 +#: ../../c-api/init.rst:1656 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: ../../c-api/init.rst:1656 +#: ../../c-api/init.rst:1659 msgid "" "Upon success, *tstate_p* will be set to the first thread state created in " "the new sub-interpreter. This thread state is made in the current thread " @@ -2000,7 +2003,7 @@ msgid "" "state." msgstr "" -#: ../../c-api/init.rst:1665 +#: ../../c-api/init.rst:1668 msgid "" "Like all other Python/C API functions, the global interpreter lock must be " "held before calling this function and is still held when it returns. " @@ -2012,13 +2015,13 @@ msgid "" "released here." msgstr "" -#: ../../c-api/init.rst:1676 +#: ../../c-api/init.rst:1679 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: ../../c-api/init.rst:1679 +#: ../../c-api/init.rst:1682 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -2029,7 +2032,11 @@ msgid "" " .check_multi_interp_extensions = 1,\n" " .gil = PyInterpreterConfig_OWN_GIL,\n" "};\n" -"PyThreadState *tstate = Py_NewInterpreterFromConfig(&config);" +"PyThreadState *tstate = NULL;\n" +"PyStatus status = Py_NewInterpreterFromConfig(&tstate, &config);\n" +"if (PyStatus_Exception(status)) {\n" +" Py_ExitStatusException(status);\n" +"}" msgstr "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -2040,9 +2047,13 @@ msgstr "" " .check_multi_interp_extensions = 1,\n" " .gil = PyInterpreterConfig_OWN_GIL,\n" "};\n" -"PyThreadState *tstate = Py_NewInterpreterFromConfig(&config);" +"PyThreadState *tstate = NULL;\n" +"PyStatus status = Py_NewInterpreterFromConfig(&tstate, &config);\n" +"if (PyStatus_Exception(status)) {\n" +" Py_ExitStatusException(status);\n" +"}" -#: ../../c-api/init.rst:1690 +#: ../../c-api/init.rst:1697 msgid "" "Note that the config is used only briefly and does not get modified. During " "initialization the config's values are converted into various :c:type:" @@ -2050,11 +2061,11 @@ msgid "" "internally on the :c:type:`PyInterpreterState`." msgstr "" -#: ../../c-api/init.rst:1699 +#: ../../c-api/init.rst:1706 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1701 +#: ../../c-api/init.rst:1708 msgid "" "For modules using multi-phase initialization, e.g. :c:func:" "`PyModule_FromDefAndSpec`, a separate module object is created and " @@ -2062,7 +2073,7 @@ msgid "" "are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1707 +#: ../../c-api/init.rst:1714 msgid "" "For modules using single-phase initialization, e.g. :c:func:" "`PyModule_Create`, the first time a particular extension is imported, it is " @@ -2074,7 +2085,7 @@ msgid "" "might cause unwanted behavior (see `Bugs and caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1718 +#: ../../c-api/init.rst:1725 msgid "" "Note that this is different from what happens when an extension is imported " "after the interpreter has been completely re-initialized by calling :c:func:" @@ -2084,7 +2095,7 @@ msgid "" "shared between these modules." msgstr "" -#: ../../c-api/init.rst:1738 +#: ../../c-api/init.rst:1745 msgid "" "Create a new sub-interpreter. This is essentially just a wrapper around :c:" "func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " @@ -2093,7 +2104,7 @@ msgid "" "single-phase init modules." msgstr "" -#: ../../c-api/init.rst:1750 +#: ../../c-api/init.rst:1757 msgid "" "Destroy the (sub-)interpreter represented by the given thread state. The " "given thread state must be the current thread state. See the discussion of " @@ -2103,17 +2114,17 @@ msgid "" "be held before calling this function. No GIL is held when it returns." msgstr "" -#: ../../c-api/init.rst:1758 +#: ../../c-api/init.rst:1765 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: ../../c-api/init.rst:1763 +#: ../../c-api/init.rst:1770 msgid "A Per-Interpreter GIL" msgstr "" -#: ../../c-api/init.rst:1765 +#: ../../c-api/init.rst:1772 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -2125,7 +2136,7 @@ msgid "" "just using threads. (See :pep:`554`.)" msgstr "" -#: ../../c-api/init.rst:1775 +#: ../../c-api/init.rst:1782 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -2139,7 +2150,7 @@ msgid "" "builtin objects." msgstr "" -#: ../../c-api/init.rst:1786 +#: ../../c-api/init.rst:1793 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -2147,7 +2158,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: ../../c-api/init.rst:1791 +#: ../../c-api/init.rst:1798 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -2157,11 +2168,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: ../../c-api/init.rst:1802 +#: ../../c-api/init.rst:1809 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1804 +#: ../../c-api/init.rst:1811 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -2174,7 +2185,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1814 +#: ../../c-api/init.rst:1821 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -2183,7 +2194,7 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1820 +#: ../../c-api/init.rst:1827 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " @@ -2195,25 +2206,25 @@ msgid "" "created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1831 +#: ../../c-api/init.rst:1838 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1833 +#: ../../c-api/init.rst:1840 msgid "" "A mechanism is provided to make asynchronous notifications to the main " "interpreter thread. These notifications take the form of a function pointer " "and a void pointer argument." msgstr "" -#: ../../c-api/init.rst:1840 +#: ../../c-api/init.rst:1847 msgid "" "Schedule a function to be called from the main interpreter thread. On " "success, ``0`` is returned and *func* is queued for being called in the main " "thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -#: ../../c-api/init.rst:1844 +#: ../../c-api/init.rst:1851 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2221,17 +2232,17 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1849 +#: ../../c-api/init.rst:1856 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1850 +#: ../../c-api/init.rst:1857 msgid "" "with the main thread holding the :term:`global interpreter lock` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1853 +#: ../../c-api/init.rst:1860 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " @@ -2239,20 +2250,20 @@ msgid "" "if the global interpreter lock is released." msgstr "" -#: ../../c-api/init.rst:1858 +#: ../../c-api/init.rst:1865 msgid "" "This function doesn't need a current thread state to run, and it doesn't " "need the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:1861 +#: ../../c-api/init.rst:1868 msgid "" "To call this function in a subinterpreter, the caller must hold the GIL. " "Otherwise, the function *func* can be scheduled to be called from the wrong " "interpreter." msgstr "" -#: ../../c-api/init.rst:1866 +#: ../../c-api/init.rst:1873 msgid "" "This is a low-level function, only useful for very special cases. There is " "no guarantee that *func* will be called as quick as possible. If the main " @@ -2262,7 +2273,7 @@ msgid "" "`PyGILState API`." msgstr "" -#: ../../c-api/init.rst:1875 +#: ../../c-api/init.rst:1882 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " @@ -2270,18 +2281,18 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:1884 +#: ../../c-api/init.rst:1891 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:1889 +#: ../../c-api/init.rst:1896 msgid "" "The Python interpreter provides some low-level support for attaching " "profiling and execution tracing facilities. These are used for profiling, " "debugging, and coverage analysis tools." msgstr "" -#: ../../c-api/init.rst:1893 +#: ../../c-api/init.rst:1900 msgid "" "This C interface allows the profiling or tracing code to avoid the overhead " "of calling through Python-level callable objects, making a direct C function " @@ -2291,7 +2302,7 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:1903 +#: ../../c-api/init.rst:1910 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " @@ -2303,66 +2314,66 @@ msgid "" "value of *what*:" msgstr "" -#: ../../c-api/init.rst:1912 +#: ../../c-api/init.rst:1919 msgid "Value of *what*" msgstr "" -#: ../../c-api/init.rst:1912 +#: ../../c-api/init.rst:1919 msgid "Meaning of *arg*" msgstr "*arg* 的含義" -#: ../../c-api/init.rst:1914 +#: ../../c-api/init.rst:1921 msgid ":c:data:`PyTrace_CALL`" msgstr ":c:data:`PyTrace_CALL`" -#: ../../c-api/init.rst:1914 ../../c-api/init.rst:1919 -#: ../../c-api/init.rst:1930 +#: ../../c-api/init.rst:1921 ../../c-api/init.rst:1926 +#: ../../c-api/init.rst:1937 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:1916 +#: ../../c-api/init.rst:1923 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr ":c:data:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:1916 +#: ../../c-api/init.rst:1923 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:1919 +#: ../../c-api/init.rst:1926 msgid ":c:data:`PyTrace_LINE`" msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:1921 +#: ../../c-api/init.rst:1928 msgid ":c:data:`PyTrace_RETURN`" msgstr ":c:data:`PyTrace_RETURN`" -#: ../../c-api/init.rst:1921 +#: ../../c-api/init.rst:1928 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:1924 +#: ../../c-api/init.rst:1931 msgid ":c:data:`PyTrace_C_CALL`" msgstr ":c:data:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:1924 ../../c-api/init.rst:1926 -#: ../../c-api/init.rst:1928 +#: ../../c-api/init.rst:1931 ../../c-api/init.rst:1933 +#: ../../c-api/init.rst:1935 msgid "Function object being called." msgstr "被呼叫的函式物件。" -#: ../../c-api/init.rst:1926 +#: ../../c-api/init.rst:1933 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:1928 +#: ../../c-api/init.rst:1935 msgid ":c:data:`PyTrace_C_RETURN`" msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:1930 +#: ../../c-api/init.rst:1937 msgid ":c:data:`PyTrace_OPCODE`" msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:1935 +#: ../../c-api/init.rst:1942 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -2371,7 +2382,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:1944 +#: ../../c-api/init.rst:1951 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "an exception has been raised. The callback function is called with this " @@ -2383,7 +2394,7 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:1955 +#: ../../c-api/init.rst:1962 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " @@ -2391,31 +2402,31 @@ msgid "" "f_trace_lines` to *0* on that frame." msgstr "" -#: ../../c-api/init.rst:1963 +#: ../../c-api/init.rst:1970 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a call is about to return." msgstr "" -#: ../../c-api/init.rst:1969 +#: ../../c-api/init.rst:1976 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function is about to be called." msgstr "" -#: ../../c-api/init.rst:1975 +#: ../../c-api/init.rst:1982 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has raised an exception." msgstr "" -#: ../../c-api/init.rst:1981 +#: ../../c-api/init.rst:1988 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:1987 +#: ../../c-api/init.rst:1994 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " @@ -2423,7 +2434,7 @@ msgid "" "attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:1995 +#: ../../c-api/init.rst:2002 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " @@ -2433,29 +2444,29 @@ msgid "" "`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:2002 +#: ../../c-api/init.rst:2009 msgid "See also the :func:`sys.setprofile` function." msgstr "" -#: ../../c-api/init.rst:2004 ../../c-api/init.rst:2011 -#: ../../c-api/init.rst:2030 ../../c-api/init.rst:2037 +#: ../../c-api/init.rst:2011 ../../c-api/init.rst:2018 +#: ../../c-api/init.rst:2037 ../../c-api/init.rst:2044 msgid "The caller must hold the :term:`GIL`." msgstr "呼叫者必須持有 :term:`GIL`。" -#: ../../c-api/init.rst:2008 +#: ../../c-api/init.rst:2015 msgid "" "Like :c:func:`PyEval_SetProfile` but sets the profile function in all " "running threads belonging to the current interpreter instead of the setting " "it only on the current thread." msgstr "" -#: ../../c-api/init.rst:2013 +#: ../../c-api/init.rst:2020 msgid "" "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " "while setting the profile functions in all threads." msgstr "" -#: ../../c-api/init.rst:2021 +#: ../../c-api/init.rst:2028 msgid "" "Set the tracing function to *func*. This is similar to :c:func:" "`PyEval_SetProfile`, except the tracing function does receive line-number " @@ -2466,28 +2477,28 @@ msgid "" "*what* parameter." msgstr "" -#: ../../c-api/init.rst:2028 +#: ../../c-api/init.rst:2035 msgid "See also the :func:`sys.settrace` function." msgstr "也請見 :func:`sys.settrace` 函式。" -#: ../../c-api/init.rst:2034 +#: ../../c-api/init.rst:2041 msgid "" "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " "threads belonging to the current interpreter instead of the setting it only " "on the current thread." msgstr "" -#: ../../c-api/init.rst:2039 +#: ../../c-api/init.rst:2046 msgid "" "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " "while setting the trace functions in all threads." msgstr "" -#: ../../c-api/init.rst:2045 +#: ../../c-api/init.rst:2052 msgid "Reference tracing" msgstr "" -#: ../../c-api/init.rst:2051 +#: ../../c-api/init.rst:2058 msgid "" "The type of the trace function registered using :c:func:" "`PyRefTracer_SetTracer`. The first parameter is a Python object that has " @@ -2497,19 +2508,19 @@ msgid "" "provided when :c:func:`PyRefTracer_SetTracer` was called." msgstr "" -#: ../../c-api/init.rst:2061 +#: ../../c-api/init.rst:2068 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been created." msgstr "" -#: ../../c-api/init.rst:2066 +#: ../../c-api/init.rst:2073 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been destroyed." msgstr "" -#: ../../c-api/init.rst:2071 +#: ../../c-api/init.rst:2078 msgid "" "Register a reference tracer function. The function will be called when a new " "Python has been created or when an object is going to be destroyed. If " @@ -2518,7 +2529,7 @@ msgid "" "return ``-1`` on error." msgstr "" -#: ../../c-api/init.rst:2077 +#: ../../c-api/init.rst:2084 msgid "" "Not that tracer functions **must not** create Python objects inside or " "otherwise the call will be re-entrant. The tracer also **must not** clear " @@ -2526,11 +2537,11 @@ msgid "" "the tracer function is called." msgstr "" -#: ../../c-api/init.rst:2082 ../../c-api/init.rst:2093 +#: ../../c-api/init.rst:2089 ../../c-api/init.rst:2100 msgid "The GIL must be held when calling this function." msgstr "" -#: ../../c-api/init.rst:2088 +#: ../../c-api/init.rst:2095 msgid "" "Get the registered reference tracer function and the value of the opaque " "data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " @@ -2538,48 +2549,48 @@ msgid "" "set the **data** pointer to NULL." msgstr "" -#: ../../c-api/init.rst:2100 +#: ../../c-api/init.rst:2107 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:2105 +#: ../../c-api/init.rst:2112 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:2110 +#: ../../c-api/init.rst:2117 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:2115 +#: ../../c-api/init.rst:2122 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:2120 +#: ../../c-api/init.rst:2127 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:2126 +#: ../../c-api/init.rst:2133 msgid "" "Return the pointer to the first :c:type:`PyThreadState` object in the list " "of threads associated with the interpreter *interp*." msgstr "" -#: ../../c-api/init.rst:2132 +#: ../../c-api/init.rst:2139 msgid "" "Return the next thread state object after *tstate* from the list of all such " "objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" -#: ../../c-api/init.rst:2139 +#: ../../c-api/init.rst:2146 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:2143 +#: ../../c-api/init.rst:2150 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2589,19 +2600,19 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:2150 +#: ../../c-api/init.rst:2157 msgid "" "The GIL does *not* need to be held when calling these functions; they supply " "their own locking." msgstr "" -#: ../../c-api/init.rst:2153 +#: ../../c-api/init.rst:2160 msgid "" "Note that :file:`Python.h` does not include the declaration of the TLS APIs, " "you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -#: ../../c-api/init.rst:2157 +#: ../../c-api/init.rst:2164 msgid "" "None of these API functions handle memory management on behalf of the :c:" "expr:`void*` values. You need to allocate and deallocate them yourself. If " @@ -2609,22 +2620,22 @@ msgid "" "don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:2165 +#: ../../c-api/init.rst:2172 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:2167 +#: ../../c-api/init.rst:2174 msgid "" "TSS API is introduced to supersede the use of the existing TLS API within " "the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` " "instead of :c:expr:`int` to represent thread keys." msgstr "" -#: ../../c-api/init.rst:2173 +#: ../../c-api/init.rst:2180 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:2178 +#: ../../c-api/init.rst:2185 msgid "" "This data structure represents the state of a thread key, the definition of " "which may depend on the underlying TLS implementation, and it has an " @@ -2632,52 +2643,52 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:2183 +#: ../../c-api/init.rst:2190 msgid "" "When :ref:`Py_LIMITED_API ` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -#: ../../c-api/init.rst:2189 +#: ../../c-api/init.rst:2196 msgid "" "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " "that this macro won't be defined with :ref:`Py_LIMITED_API `." msgstr "" -#: ../../c-api/init.rst:2194 +#: ../../c-api/init.rst:2201 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:2196 +#: ../../c-api/init.rst:2203 msgid "" "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " "built with :ref:`Py_LIMITED_API `, where static allocation of this " "type is not possible due to its implementation being opaque at build time." msgstr "" -#: ../../c-api/init.rst:2203 +#: ../../c-api/init.rst:2210 msgid "" "Return a value which is the same state as a value initialized with :c:macro:" "`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." msgstr "" -#: ../../c-api/init.rst:2210 +#: ../../c-api/init.rst:2217 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" -#: ../../c-api/init.rst:2216 +#: ../../c-api/init.rst:2223 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: ../../c-api/init.rst:2221 +#: ../../c-api/init.rst:2228 msgid "Methods" msgstr "方法" -#: ../../c-api/init.rst:2223 +#: ../../c-api/init.rst:2230 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " @@ -2685,13 +2696,13 @@ msgid "" "func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2231 +#: ../../c-api/init.rst:2238 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2237 +#: ../../c-api/init.rst:2244 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -2700,7 +2711,7 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:2246 +#: ../../c-api/init.rst:2253 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " @@ -2709,31 +2720,31 @@ msgid "" "key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:2255 +#: ../../c-api/init.rst:2262 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" -#: ../../c-api/init.rst:2262 +#: ../../c-api/init.rst:2269 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" -#: ../../c-api/init.rst:2270 +#: ../../c-api/init.rst:2277 msgid "Thread Local Storage (TLS) API" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../c-api/init.rst:2272 +#: ../../c-api/init.rst:2279 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API `." msgstr "" -#: ../../c-api/init.rst:2277 +#: ../../c-api/init.rst:2284 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -2742,62 +2753,62 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:2282 +#: ../../c-api/init.rst:2289 msgid "" "Due to the compatibility problem noted above, this version of the API should " "not be used in new code." msgstr "" -#: ../../c-api/init.rst:2293 +#: ../../c-api/init.rst:2300 msgid "Synchronization Primitives" msgstr "" -#: ../../c-api/init.rst:2295 +#: ../../c-api/init.rst:2302 msgid "The C-API provides a basic mutual exclusion lock." msgstr "" -#: ../../c-api/init.rst:2299 +#: ../../c-api/init.rst:2306 msgid "" "A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " "zero to represent the unlocked state. For example::" msgstr "" -#: ../../c-api/init.rst:2302 +#: ../../c-api/init.rst:2309 msgid "PyMutex mutex = {0};" msgstr "" -#: ../../c-api/init.rst:2304 +#: ../../c-api/init.rst:2311 msgid "" "Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " "contents and address of a :c:type:`!PyMutex` are meaningful, and it must " "remain at a fixed, writable location in memory." msgstr "" -#: ../../c-api/init.rst:2310 +#: ../../c-api/init.rst:2317 msgid "" "A :c:type:`!PyMutex` currently occupies one byte, but the size should be " "considered unstable. The size may change in future Python releases without " "a deprecation period." msgstr "" -#: ../../c-api/init.rst:2318 +#: ../../c-api/init.rst:2325 msgid "" "Lock mutex *m*. If another thread has already locked it, the calling thread " "will block until the mutex is unlocked. While blocked, the thread will " "temporarily release the :term:`GIL` if it is held." msgstr "" -#: ../../c-api/init.rst:2326 +#: ../../c-api/init.rst:2333 msgid "" "Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " "issue a fatal error." msgstr "" -#: ../../c-api/init.rst:2334 +#: ../../c-api/init.rst:2341 msgid "Python Critical Section API" msgstr "" -#: ../../c-api/init.rst:2336 +#: ../../c-api/init.rst:2343 msgid "" "The critical section API provides a deadlock avoidance layer on top of per-" "object locks for :term:`free-threaded ` CPython. They are " @@ -2805,7 +2816,7 @@ msgid "" "no-ops in versions of Python with the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:2341 +#: ../../c-api/init.rst:2348 msgid "" "Critical sections avoid deadlocks by implicitly suspending active critical " "sections and releasing the locks during calls to :c:func:" @@ -2815,7 +2826,7 @@ msgid "" "-- they are useful because their behavior is similar to the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:2348 +#: ../../c-api/init.rst:2355 msgid "" "The functions and structs used by the macros are exposed for cases where C " "macros are not available. They should only be used as in the given macro " @@ -2823,7 +2834,7 @@ msgid "" "future Python versions." msgstr "" -#: ../../c-api/init.rst:2355 +#: ../../c-api/init.rst:2362 msgid "" "Operations that need to lock two objects at once must use :c:macro:" "`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " @@ -2832,11 +2843,11 @@ msgid "" "lock more than two objects at once." msgstr "" -#: ../../c-api/init.rst:2361 +#: ../../c-api/init.rst:2368 msgid "Example usage::" msgstr "" -#: ../../c-api/init.rst:2363 +#: ../../c-api/init.rst:2370 msgid "" "static PyObject *\n" "set_field(MyObject *self, PyObject *value)\n" @@ -2848,7 +2859,7 @@ msgid "" "}" msgstr "" -#: ../../c-api/init.rst:2372 +#: ../../c-api/init.rst:2379 msgid "" "In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " "can call arbitrary code through an object's deallocation function. The " @@ -2858,63 +2869,63 @@ msgid "" "`PyEval_SaveThread`." msgstr "" -#: ../../c-api/init.rst:2380 +#: ../../c-api/init.rst:2387 msgid "" "Acquires the per-object lock for the object *op* and begins a critical " "section." msgstr "" -#: ../../c-api/init.rst:2383 ../../c-api/init.rst:2397 -#: ../../c-api/init.rst:2412 ../../c-api/init.rst:2426 +#: ../../c-api/init.rst:2390 ../../c-api/init.rst:2404 +#: ../../c-api/init.rst:2419 ../../c-api/init.rst:2433 msgid "In the free-threaded build, this macro expands to::" msgstr "" -#: ../../c-api/init.rst:2385 +#: ../../c-api/init.rst:2392 msgid "" "{\n" " PyCriticalSection _py_cs;\n" " PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" msgstr "" -#: ../../c-api/init.rst:2389 ../../c-api/init.rst:2418 +#: ../../c-api/init.rst:2396 ../../c-api/init.rst:2425 msgid "In the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2395 +#: ../../c-api/init.rst:2402 msgid "Ends the critical section and releases the per-object lock." msgstr "" -#: ../../c-api/init.rst:2399 +#: ../../c-api/init.rst:2406 msgid "" " PyCriticalSection_End(&_py_cs);\n" "}" msgstr "" -#: ../../c-api/init.rst:2402 ../../c-api/init.rst:2431 +#: ../../c-api/init.rst:2409 ../../c-api/init.rst:2438 msgid "In the default build, this macro expands to ``}``." msgstr "" -#: ../../c-api/init.rst:2408 +#: ../../c-api/init.rst:2415 msgid "" "Acquires the per-objects locks for the objects *a* and *b* and begins a " "critical section. The locks are acquired in a consistent order (lowest " "address first) to avoid lock ordering deadlocks." msgstr "" -#: ../../c-api/init.rst:2414 +#: ../../c-api/init.rst:2421 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" -" PyCriticalSection_Begin2(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" +" PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" msgstr "" -#: ../../c-api/init.rst:2424 +#: ../../c-api/init.rst:2431 msgid "Ends the critical section and releases the per-object locks." msgstr "" -#: ../../c-api/init.rst:2428 +#: ../../c-api/init.rst:2435 msgid "" -" PyCriticalSection_End2(&_py_cs2);\n" +" PyCriticalSection2_End(&_py_cs2);\n" "}" msgstr "" @@ -2931,19 +2942,19 @@ msgid "path (in module sys)" msgstr "path(sys 模組中)" #: ../../c-api/init.rst:350 ../../c-api/init.rst:701 ../../c-api/init.rst:1136 -#: ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 +#: ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 msgid "module" msgstr "模組" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 msgid "__main__" msgstr "__main__" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 msgid "sys" msgstr "sys" @@ -2955,7 +2966,7 @@ msgstr "search(搜尋)" msgid "path" msgstr "path(路徑)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1695 ../../c-api/init.rst:1748 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1702 ../../c-api/init.rst:1755 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" @@ -3051,22 +3062,22 @@ msgstr "PyEval_RestoreThread()" msgid "_thread" msgstr "_thread" -#: ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 +#: ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 msgid "stdout (in module sys)" msgstr "stdout(sys 模組中)" -#: ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 +#: ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 msgid "stderr (in module sys)" msgstr "stderr(sys 模組中)" -#: ../../c-api/init.rst:1635 ../../c-api/init.rst:1730 +#: ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 msgid "stdin (in module sys)" msgstr "stdin(sys 模組中)" -#: ../../c-api/init.rst:1695 +#: ../../c-api/init.rst:1702 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/init.rst:1725 +#: ../../c-api/init.rst:1732 msgid "close (in module os)" msgstr "close(os 模組中)" diff --git a/c-api/monitoring.po b/c-api/monitoring.po index d4d8d09510..67816dfd7a 100644 --- a/c-api/monitoring.po +++ b/c-api/monitoring.po @@ -1,7 +1,5 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # #, fuzzy msgid "" @@ -11,7 +9,8 @@ msgstr "" "POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -19,11 +18,11 @@ msgstr "" #: ../../c-api/monitoring.rst:6 msgid "Monitoring C API" -msgstr "" +msgstr "監控 C API" #: ../../c-api/monitoring.rst:8 msgid "Added in version 3.13." -msgstr "" +msgstr "於 3.13 版本中新增。" #: ../../c-api/monitoring.rst:10 msgid "" @@ -76,43 +75,43 @@ msgstr "" #: ../../c-api/monitoring.rst:41 msgid "See :mod:`sys.monitoring` for descriptions of the events." -msgstr "" +msgstr "關於事件的敘述請見 :mod:`sys.monitoring`。" #: ../../c-api/monitoring.rst:45 msgid "Fire a ``PY_START`` event." -msgstr "" +msgstr "發出一個 ``PY_START`` 事件。" #: ../../c-api/monitoring.rst:50 msgid "Fire a ``PY_RESUME`` event." -msgstr "" +msgstr "發出一個 ``PY_RESUME`` 事件。" #: ../../c-api/monitoring.rst:55 msgid "Fire a ``PY_RETURN`` event." -msgstr "" +msgstr "發出一個 ``PY_RETURN`` 事件。" #: ../../c-api/monitoring.rst:60 msgid "Fire a ``PY_YIELD`` event." -msgstr "" +msgstr "發出一個 ``PY_YIELD`` 事件。" #: ../../c-api/monitoring.rst:65 msgid "Fire a ``CALL`` event." -msgstr "" +msgstr "發出一個 ``CALL`` 事件。" #: ../../c-api/monitoring.rst:70 msgid "Fire a ``LINE`` event." -msgstr "" +msgstr "發出一個 ``LINE`` 事件。" #: ../../c-api/monitoring.rst:75 msgid "Fire a ``JUMP`` event." -msgstr "" +msgstr "發出一個 ``JUMP`` 事件。" #: ../../c-api/monitoring.rst:80 msgid "Fire a ``BRANCH`` event." -msgstr "" +msgstr "發出一個 ``BRANCH`` 事件。" #: ../../c-api/monitoring.rst:85 msgid "Fire a ``C_RETURN`` event." -msgstr "" +msgstr "發出一個 ``C_RETURN`` 事件。" #: ../../c-api/monitoring.rst:90 msgid "" @@ -201,7 +200,7 @@ msgstr "" #: ../../c-api/monitoring.rst:161 msgid "The macros for *event_types* are:" -msgstr "" +msgstr "*event_types* 的巨集有:" #: ../../c-api/monitoring.rst:169 msgid "Macro" @@ -209,7 +208,7 @@ msgstr "巨集" #: ../../c-api/monitoring.rst:169 msgid "Event" -msgstr "" +msgstr "事件" #: ../../c-api/monitoring.rst:171 msgid ":monitoring-event:`BRANCH`" diff --git a/c-api/time.po b/c-api/time.po index 7636335954..a3c2646b3a 100644 --- a/c-api/time.po +++ b/c-api/time.po @@ -1,7 +1,5 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # #, fuzzy msgid "" @@ -11,7 +9,8 @@ msgstr "" "POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -19,7 +18,7 @@ msgstr "" #: ../../c-api/time.rst:6 msgid "PyTime C API" -msgstr "" +msgstr "PyTime C API" #: ../../c-api/time.rst:10 msgid "" diff --git a/deprecations/c-api-pending-removal-in-3.14.po b/deprecations/c-api-pending-removal-in-3.14.po index aaa4c2db16..ed8747f95e 100644 --- a/deprecations/c-api-pending-removal-in-3.14.po +++ b/deprecations/c-api-pending-removal-in-3.14.po @@ -1,6 +1,5 @@ # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # msgid "" msgstr "" @@ -9,7 +8,8 @@ msgstr "" "POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/deprecations/c-api-pending-removal-in-3.15.po b/deprecations/c-api-pending-removal-in-3.15.po index e8ab611316..f828c57849 100644 --- a/deprecations/c-api-pending-removal-in-3.15.po +++ b/deprecations/c-api-pending-removal-in-3.15.po @@ -1,7 +1,5 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # msgid "" msgstr "" @@ -10,7 +8,8 @@ msgstr "" "POT-Creation-Date: 2024-10-22 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/deprecations/c-api-pending-removal-in-future.po b/deprecations/c-api-pending-removal-in-future.po index a042b964bc..49bec35846 100644 --- a/deprecations/c-api-pending-removal-in-future.po +++ b/deprecations/c-api-pending-removal-in-future.po @@ -1,7 +1,5 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # msgid "" msgstr "" @@ -10,7 +8,8 @@ msgstr "" "POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/deprecations/index.po b/deprecations/index.po index 9d2c3b3c16..b6c4ff73e5 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -1,6 +1,5 @@ # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # msgid "" msgstr "" @@ -9,7 +8,8 @@ msgstr "" "POT-Creation-Date: 2024-11-10 17:21+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -467,6 +467,9 @@ msgid "" "Python 3.16, use :func:`inspect.iscoroutinefunction` instead. (Contributed " "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" +":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" +"gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 #: ../../deprecations/pending-removal-in-future.rst:12 @@ -1351,10 +1354,3 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-future.rst:50 msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" - -#~ msgid "" -#~ "date and datetime adapter, date and timestamp converter: see the :mod:" -#~ "`sqlite3` documentation for suggested replacement recipes." -#~ msgstr "" -#~ "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 " -#~ "(converter):請參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" diff --git a/deprecations/pending-removal-in-3.13.po b/deprecations/pending-removal-in-3.13.po index d39a172a1a..6e382beeb8 100644 --- a/deprecations/pending-removal-in-3.13.po +++ b/deprecations/pending-removal-in-3.13.po @@ -1,6 +1,5 @@ # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # msgid "" msgstr "" @@ -9,7 +8,8 @@ msgstr "" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/deprecations/pending-removal-in-3.14.po b/deprecations/pending-removal-in-3.14.po index c471f0275a..f6e86c446f 100644 --- a/deprecations/pending-removal-in-3.14.po +++ b/deprecations/pending-removal-in-3.14.po @@ -1,6 +1,5 @@ # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # msgid "" msgstr "" @@ -9,7 +8,8 @@ msgstr "" "POT-Creation-Date: 2024-11-10 17:21+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index 0f21b19e13..8c048042e0 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -1,6 +1,5 @@ # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # msgid "" msgstr "" @@ -9,7 +8,8 @@ msgstr "" "POT-Creation-Date: 2024-11-05 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/deprecations/pending-removal-in-3.16.po b/deprecations/pending-removal-in-3.16.po index eec8eb350d..785fc0e03f 100644 --- a/deprecations/pending-removal-in-3.16.po +++ b/deprecations/pending-removal-in-3.16.po @@ -1,6 +1,5 @@ # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # msgid "" msgstr "" @@ -9,7 +8,8 @@ msgstr "" "POT-Creation-Date: 2024-11-10 17:21+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -58,6 +58,9 @@ msgid "" "Python 3.16, use :func:`inspect.iscoroutinefunction` instead. (Contributed " "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" +":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" +"gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 msgid ":mod:`builtins`:" diff --git a/deprecations/pending-removal-in-future.po b/deprecations/pending-removal-in-future.po index 80f5e1023a..9649475ba7 100644 --- a/deprecations/pending-removal-in-future.po +++ b/deprecations/pending-removal-in-future.po @@ -1,6 +1,6 @@ # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. +# FIRST AUTHOR , YEAR # msgid "" msgstr "" @@ -9,7 +9,8 @@ msgstr "" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/howto/argparse-optparse.po b/howto/argparse-optparse.po index d54b85eb9c..39f928c87d 100644 --- a/howto/argparse-optparse.po +++ b/howto/argparse-optparse.po @@ -1,7 +1,5 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # #, fuzzy msgid "" @@ -11,7 +9,8 @@ msgstr "" "POT-Creation-Date: 2024-10-09 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -19,7 +18,7 @@ msgstr "" #: ../../howto/argparse-optparse.rst:7 msgid "Upgrading optparse code" -msgstr "" +msgstr "升級 optparse 程式碼" #: ../../howto/argparse-optparse.rst:9 msgid "" diff --git a/howto/descriptor.po b/howto/descriptor.po index 876ca82e89..4d1b659340 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-11-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -95,8 +95,8 @@ msgstr "" #: ../../howto/descriptor.rst:45 msgid "" -"The :class:`Ten` class is a descriptor whose :meth:`__get__` method always " -"returns the constant ``10``:" +"The :class:`!Ten` class is a descriptor whose :meth:`~object.__get__` method " +"always returns the constant ``10``:" msgstr "" #: ../../howto/descriptor.rst:48 @@ -214,11 +214,11 @@ msgstr "" #: ../../howto/descriptor.rst:122 msgid "" "Besides showing how descriptors can run computations, this example also " -"reveals the purpose of the parameters to :meth:`__get__`. The *self* " -"parameter is *size*, an instance of *DirectorySize*. The *obj* parameter is " -"either *g* or *s*, an instance of *Directory*. It is the *obj* parameter " -"that lets the :meth:`__get__` method learn the target directory. The " -"*objtype* parameter is the class *Directory*." +"reveals the purpose of the parameters to :meth:`~object.__get__`. The " +"*self* parameter is *size*, an instance of *DirectorySize*. The *obj* " +"parameter is either *g* or *s*, an instance of *Directory*. It is the *obj* " +"parameter that lets the :meth:`~object.__get__` method learn the target " +"directory. The *objtype* parameter is the class *Directory*." msgstr "" #: ../../howto/descriptor.rst:131 @@ -230,8 +230,8 @@ msgid "" "A popular use for descriptors is managing access to instance data. The " "descriptor is assigned to a public attribute in the class dictionary while " "the actual data is stored as a private attribute in the instance " -"dictionary. The descriptor's :meth:`__get__` and :meth:`__set__` methods " -"are triggered when the public attribute is accessed." +"dictionary. The descriptor's :meth:`~object.__get__` and :meth:`~object." +"__set__` methods are triggered when the public attribute is accessed." msgstr "" #: ../../howto/descriptor.rst:139 @@ -326,10 +326,10 @@ msgstr "" #: ../../howto/descriptor.rst:218 msgid "" -"In this example, the :class:`Person` class has two descriptor instances, " -"*name* and *age*. When the :class:`Person` class is defined, it makes a " -"callback to :meth:`__set_name__` in *LoggedAccess* so that the field names " -"can be recorded, giving each descriptor its own *public_name* and " +"In this example, the :class:`!Person` class has two descriptor instances, " +"*name* and *age*. When the :class:`!Person` class is defined, it makes a " +"callback to :meth:`~object.__set_name__` in *LoggedAccess* so that the field " +"names can be recorded, giving each descriptor its own *public_name* and " "*private_name*:" msgstr "" @@ -369,9 +369,9 @@ msgstr "" #: ../../howto/descriptor.rst:256 msgid "" -"An interactive session shows that the :class:`Person` class has called :meth:" -"`__set_name__` so that the field names would be recorded. Here we call :" -"func:`vars` to look up the descriptor without triggering it:" +"An interactive session shows that the :class:`!Person` class has called :" +"meth:`~object.__set_name__` so that the field names would be recorded. Here " +"we call :func:`vars` to look up the descriptor without triggering it:" msgstr "" #: ../../howto/descriptor.rst:260 @@ -428,16 +428,16 @@ msgstr "" #: ../../howto/descriptor.rst:297 msgid "" -"A :term:`descriptor` is what we call any object that defines :meth:" -"`__get__`, :meth:`__set__`, or :meth:`__delete__`." +"A :term:`descriptor` is what we call any object that defines :meth:`~object." +"__get__`, :meth:`~object.__set__`, or :meth:`~object.__delete__`." msgstr "" #: ../../howto/descriptor.rst:300 msgid "" -"Optionally, descriptors can have a :meth:`__set_name__` method. This is " -"only used in cases where a descriptor needs to know either the class where " -"it was created or the name of class variable it was assigned to. (This " -"method, if present, is called even if the class is not a descriptor.)" +"Optionally, descriptors can have a :meth:`~object.__set_name__` method. " +"This is only used in cases where a descriptor needs to know either the class " +"where it was created or the name of class variable it was assigned to. " +"(This method, if present, is called even if the class is not a descriptor.)" msgstr "" #: ../../howto/descriptor.rst:305 @@ -498,7 +498,7 @@ msgstr "" #: ../../howto/descriptor.rst:340 msgid "" -"This :class:`Validator` class is both an :term:`abstract base class` and a " +"This :class:`!Validator` class is both an :term:`abstract base class` and a " "managed attribute descriptor:" msgstr "" @@ -542,8 +542,8 @@ msgstr "" #: ../../howto/descriptor.rst:363 msgid "" -"Custom validators need to inherit from :class:`Validator` and must supply a :" -"meth:`validate` method to test various restrictions as needed." +"Custom validators need to inherit from :class:`!Validator` and must supply " +"a :meth:`!validate` method to test various restrictions as needed." msgstr "" #: ../../howto/descriptor.rst:368 @@ -556,19 +556,19 @@ msgstr "" #: ../../howto/descriptor.rst:372 msgid "" -":class:`OneOf` verifies that a value is one of a restricted set of options." +":class:`!OneOf` verifies that a value is one of a restricted set of options." msgstr "" #: ../../howto/descriptor.rst:374 msgid "" -":class:`Number` verifies that a value is either an :class:`int` or :class:" +":class:`!Number` verifies that a value is either an :class:`int` or :class:" "`float`. Optionally, it verifies that a value is between a given minimum or " "maximum." msgstr "" #: ../../howto/descriptor.rst:378 msgid "" -":class:`String` verifies that a value is a :class:`str`. Optionally, it " +":class:`!String` verifies that a value is a :class:`str`. Optionally, it " "validates a given minimum or maximum length. It can validate a user-defined " "`predicate `_ " "as well." @@ -716,9 +716,9 @@ msgstr "" #: ../../howto/descriptor.rst:503 msgid "" "In general, a descriptor is an attribute value that has one of the methods " -"in the descriptor protocol. Those methods are :meth:`__get__`, :meth:" -"`__set__`, and :meth:`__delete__`. If any of those methods are defined for " -"an attribute, it is said to be a :term:`descriptor`." +"in the descriptor protocol. Those methods are :meth:`~object.__get__`, :" +"meth:`~object.__set__`, and :meth:`~object.__delete__`. If any of those " +"methods are defined for an attribute, it is said to be a :term:`descriptor`." msgstr "" #: ../../howto/descriptor.rst:508 @@ -767,10 +767,10 @@ msgstr "" #: ../../howto/descriptor.rst:537 msgid "" -"If an object defines :meth:`__set__` or :meth:`__delete__`, it is considered " -"a data descriptor. Descriptors that only define :meth:`__get__` are called " -"non-data descriptors (they are often used for methods but other uses are " -"possible)." +"If an object defines :meth:`~object.__set__` or :meth:`~object.__delete__`, " +"it is considered a data descriptor. Descriptors that only define :meth:" +"`~object.__get__` are called non-data descriptors (they are often used for " +"methods but other uses are possible)." msgstr "" #: ../../howto/descriptor.rst:542 @@ -784,10 +784,10 @@ msgstr "" #: ../../howto/descriptor.rst:548 msgid "" -"To make a read-only data descriptor, define both :meth:`__get__` and :meth:" -"`__set__` with the :meth:`__set__` raising an :exc:`AttributeError` when " -"called. Defining the :meth:`__set__` method with an exception raising " -"placeholder is enough to make it a data descriptor." +"To make a read-only data descriptor, define both :meth:`~object.__get__` " +"and :meth:`~object.__set__` with the :meth:`~object.__set__` raising an :exc:" +"`AttributeError` when called. Defining the :meth:`~object.__set__` method " +"with an exception raising placeholder is enough to make it a data descriptor." msgstr "" #: ../../howto/descriptor.rst:555 @@ -828,8 +828,8 @@ msgstr "" msgid "" "Instance lookup scans through a chain of namespaces giving data descriptors " "the highest priority, followed by instance variables, then non-data " -"descriptors, then class variables, and lastly :meth:`__getattr__` if it is " -"provided." +"descriptors, then class variables, and lastly :meth:`~object.__getattr__` if " +"it is provided." msgstr "" #: ../../howto/descriptor.rst:580 @@ -875,16 +875,17 @@ msgstr "" #: ../../howto/descriptor.rst:722 msgid "" -"Note, there is no :meth:`__getattr__` hook in the :meth:`__getattribute__` " -"code. That is why calling :meth:`__getattribute__` directly or with " -"``super().__getattribute__`` will bypass :meth:`__getattr__` entirely." +"Note, there is no :meth:`~object.__getattr__` hook in the :meth:`~object." +"__getattribute__` code. That is why calling :meth:`~object." +"__getattribute__` directly or with ``super().__getattribute__`` will bypass :" +"meth:`~object.__getattr__` entirely." msgstr "" #: ../../howto/descriptor.rst:726 msgid "" "Instead, it is the dot operator and the :func:`getattr` function that are " -"responsible for invoking :meth:`__getattr__` whenever :meth:" -"`__getattribute__` raises an :exc:`AttributeError`. Their logic is " +"responsible for invoking :meth:`~object.__getattr__` whenever :meth:`~object." +"__getattribute__` raises an :exc:`AttributeError`. Their logic is " "encapsulated in a helper function:" msgstr "" @@ -914,8 +915,8 @@ msgstr "" #: ../../howto/descriptor.rst:778 msgid "" -"The logic for a dotted lookup such as ``A.x`` is in :meth:`type." -"__getattribute__`. The steps are similar to those for :meth:`object." +"The logic for a dotted lookup such as ``A.x`` is in :meth:`!type." +"__getattribute__`. The steps are similar to those for :meth:`!object." "__getattribute__` but the instance dictionary lookup is replaced by a search " "through the class's :term:`method resolution order`." msgstr "" @@ -936,8 +937,8 @@ msgstr "" #: ../../howto/descriptor.rst:792 msgid "" -"The logic for super's dotted lookup is in the :meth:`__getattribute__` " -"method for object returned by :func:`super`." +"The logic for super's dotted lookup is in the :meth:`~object." +"__getattribute__` method for object returned by :func:`super`." msgstr "" #: ../../howto/descriptor.rst:795 @@ -962,8 +963,9 @@ msgstr "" #: ../../howto/descriptor.rst:809 msgid "" -"The mechanism for descriptors is embedded in the :meth:`__getattribute__` " -"methods for :class:`object`, :class:`type`, and :func:`super`." +"The mechanism for descriptors is embedded in the :meth:`~object." +"__getattribute__` methods for :class:`object`, :class:`type`, and :func:" +"`super`." msgstr "" #: ../../howto/descriptor.rst:812 @@ -971,7 +973,7 @@ msgid "The important points to remember are:" msgstr "要記住的重點是:" #: ../../howto/descriptor.rst:814 -msgid "Descriptors are invoked by the :meth:`__getattribute__` method." +msgid "Descriptors are invoked by the :meth:`~object.__getattribute__` method." msgstr "" #: ../../howto/descriptor.rst:816 @@ -982,16 +984,16 @@ msgstr "" #: ../../howto/descriptor.rst:819 msgid "" -"Overriding :meth:`__getattribute__` prevents automatic descriptor calls " -"because all the descriptor logic is in that method." +"Overriding :meth:`~object.__getattribute__` prevents automatic descriptor " +"calls because all the descriptor logic is in that method." msgstr "" #: ../../howto/descriptor.rst:822 msgid "" -":meth:`object.__getattribute__` and :meth:`type.__getattribute__` make " -"different calls to :meth:`__get__`. The first includes the instance and may " -"include the class. The second puts in ``None`` for the instance and always " -"includes the class." +":meth:`!object.__getattribute__` and :meth:`!type.__getattribute__` make " +"different calls to :meth:`~object.__get__`. The first includes the instance " +"and may include the class. The second puts in ``None`` for the instance and " +"always includes the class." msgstr "" #: ../../howto/descriptor.rst:827 @@ -1011,9 +1013,9 @@ msgid "" "Sometimes it is desirable for a descriptor to know what class variable name " "it was assigned to. When a new class is created, the :class:`type` " "metaclass scans the dictionary of the new class. If any of the entries are " -"descriptors and if they define :meth:`__set_name__`, that method is called " -"with two arguments. The *owner* is the class where the descriptor is used, " -"and the *name* is the class variable the descriptor was assigned to." +"descriptors and if they define :meth:`~object.__set_name__`, that method is " +"called with two arguments. The *owner* is the class where the descriptor is " +"used, and the *name* is the class variable the descriptor was assigned to." msgstr "" #: ../../howto/descriptor.rst:842 @@ -1024,9 +1026,9 @@ msgstr "" #: ../../howto/descriptor.rst:845 msgid "" -"Since the update logic is in :meth:`type.__new__`, notifications only take " +"Since the update logic is in :meth:`!type.__new__`, notifications only take " "place at the time of class creation. If descriptors are added to the class " -"afterwards, :meth:`__set_name__` will need to be called manually." +"afterwards, :meth:`~object.__set_name__` will need to be called manually." msgstr "" #: ../../howto/descriptor.rst:851 @@ -1081,7 +1083,7 @@ msgstr "" #: ../../howto/descriptor.rst:876 msgid "" -"We can use the :class:`Field` class to define `models `_ that describe the schema for each table in a " "database:" msgstr "" @@ -1281,7 +1283,7 @@ msgstr "" #: ../../howto/descriptor.rst:1143 msgid "" -"Either the built-in :func:`property` or our :func:`Property` equivalent " +"Either the built-in :func:`property` or our :func:`!Property` equivalent " "would work in this example." msgstr "" @@ -1341,9 +1343,9 @@ msgstr "" #: ../../howto/descriptor.rst:1189 msgid "" "To support automatic creation of methods, functions include the :meth:" -"`__get__` method for binding methods during attribute access. This means " -"that functions are non-data descriptors that return bound methods during " -"dotted lookup from an instance. Here's how it works:" +"`~object.__get__` method for binding methods during attribute access. This " +"means that functions are non-data descriptors that return bound methods " +"during dotted lookup from an instance. Here's how it works:" msgstr "" #: ../../howto/descriptor.rst:1194 @@ -1396,7 +1398,7 @@ msgstr "" #: ../../howto/descriptor.rst:1233 msgid "" "Accessing the function through the class dictionary does not invoke :meth:" -"`__get__`. Instead, it just returns the underlying function object::" +"`~object.__get__`. Instead, it just returns the underlying function object::" msgstr "" #: ../../howto/descriptor.rst:1236 @@ -1409,8 +1411,8 @@ msgstr "" #: ../../howto/descriptor.rst:1239 msgid "" -"Dotted access from a class calls :meth:`__get__` which just returns the " -"underlying function unchanged::" +"Dotted access from a class calls :meth:`~object.__get__` which just returns " +"the underlying function unchanged::" msgstr "" #: ../../howto/descriptor.rst:1242 @@ -1424,7 +1426,8 @@ msgstr "" #: ../../howto/descriptor.rst:1245 msgid "" "The interesting behavior occurs during dotted access from an instance. The " -"dotted lookup calls :meth:`__get__` which returns a bound method object::" +"dotted lookup calls :meth:`~object.__get__` which returns a bound method " +"object::" msgstr "" #: ../../howto/descriptor.rst:1248 @@ -1475,10 +1478,10 @@ msgstr "" #: ../../howto/descriptor.rst:1271 msgid "" -"To recap, functions have a :meth:`__get__` method so that they can be " -"converted to a method when accessed as attributes. The non-data descriptor " -"transforms an ``obj.f(*args)`` call into ``f(obj, *args)``. Calling ``cls." -"f(*args)`` becomes ``f(*args)``." +"To recap, functions have a :meth:`~object.__get__` method so that they can " +"be converted to a method when accessed as attributes. The non-data " +"descriptor transforms an ``obj.f(*args)`` call into ``f(obj, *args)``. " +"Calling ``cls.f(*args)`` becomes ``f(*args)``." msgstr "" #: ../../howto/descriptor.rst:1276 @@ -1913,8 +1916,8 @@ msgstr "" #: ../../howto/descriptor.rst:1670 msgid "" -"The :meth:`type.__new__` method takes care of adding member objects to class " -"variables:" +"The :meth:`!type.__new__` method takes care of adding member objects to " +"class variables:" msgstr "" #: ../../howto/descriptor.rst:1673 @@ -1972,8 +1975,8 @@ msgstr "" #: ../../howto/descriptor.rst:1721 msgid "" -"To use the simulation in a real class, just inherit from :class:`Object` and " -"set the :term:`metaclass` to :class:`Type`:" +"To use the simulation in a real class, just inherit from :class:`!Object` " +"and set the :term:`metaclass` to :class:`Type`:" msgstr "" #: ../../howto/descriptor.rst:1724 diff --git a/howto/enum.po b/howto/enum.po index c4f912e5cb..eeeae58470 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -1,17 +1,16 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-11-27 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -119,9 +118,16 @@ msgid "" ">>> isinstance(Weekday.FRIDAY, Weekday)\n" "True" msgstr "" +">>> type(Weekday.MONDAY)\n" +"\n" +">>> isinstance(Weekday.FRIDAY, Weekday)\n" +"True>>> type(Weekday.MONDAY)\n" +"\n" +">>> isinstance(Weekday.FRIDAY, Weekday)\n" +"True" #: ../../howto/enum.rst:67 -msgid "Enum members have an attribute that contains just their :attr:`name`::" +msgid "Enum members have an attribute that contains just their :attr:`!name`::" msgstr "" #: ../../howto/enum.rst:69 @@ -133,7 +139,7 @@ msgstr "" "TUESDAY" #: ../../howto/enum.rst:72 -msgid "Likewise, they have an attribute for their :attr:`value`::" +msgid "Likewise, they have an attribute for their :attr:`!value`::" msgstr "" #: ../../howto/enum.rst:75 @@ -148,25 +154,29 @@ msgstr "" msgid "" "Unlike many languages that treat enumerations solely as name/value pairs, " "Python Enums can have behavior added. For example, :class:`datetime.date` " -"has two methods for returning the weekday: :meth:`weekday` and :meth:" -"`isoweekday`. The difference is that one of them counts from 0-6 and the " -"other from 1-7. Rather than keep track of that ourselves we can add a method " -"to the :class:`Weekday` enum to extract the day from the :class:`date` " -"instance and return the matching enum member::" +"has two methods for returning the weekday: :meth:`~datetime.date.weekday` " +"and :meth:`~datetime.date.isoweekday`. The difference is that one of them " +"counts from 0-6 and the other from 1-7. Rather than keep track of that " +"ourselves we can add a method to the :class:`!Weekday` enum to extract the " +"day from the :class:`~datetime.date` instance and return the matching enum " +"member::" msgstr "" -#: ../../howto/enum.rst:86 +#: ../../howto/enum.rst:87 msgid "" "@classmethod\n" "def from_date(cls, date):\n" " return cls(date.isoweekday())" msgstr "" +"@classmethod\n" +"def from_date(cls, date):\n" +" return cls(date.isoweekday())" -#: ../../howto/enum.rst:90 -msgid "The complete :class:`Weekday` enum now looks like this::" +#: ../../howto/enum.rst:91 +msgid "The complete :class:`!Weekday` enum now looks like this::" msgstr "" -#: ../../howto/enum.rst:92 +#: ../../howto/enum.rst:93 msgid "" ">>> class Weekday(Enum):\n" "... MONDAY = 1\n" @@ -194,32 +204,32 @@ msgstr "" "... def from_date(cls, date):\n" "... return cls(date.isoweekday())" -#: ../../howto/enum.rst:105 +#: ../../howto/enum.rst:106 msgid "Now we can find out what today is! Observe::" msgstr "" -#: ../../howto/enum.rst:107 +#: ../../howto/enum.rst:108 msgid "" ">>> from datetime import date\n" ">>> Weekday.from_date(date.today()) \n" "" msgstr "" -#: ../../howto/enum.rst:111 +#: ../../howto/enum.rst:112 msgid "" "Of course, if you're reading this on some other day, you'll see that day " "instead." msgstr "" -#: ../../howto/enum.rst:113 +#: ../../howto/enum.rst:114 msgid "" -"This :class:`Weekday` enum is great if our variable only needs one day, but " +"This :class:`!Weekday` enum is great if our variable only needs one day, but " "what if we need several? Maybe we're writing a function to plot chores " "during a week, and don't want to use a :class:`list` -- we could use a " "different type of :class:`Enum`::" msgstr "" -#: ../../howto/enum.rst:118 +#: ../../howto/enum.rst:119 msgid "" ">>> from enum import Flag\n" ">>> class Weekday(Flag):\n" @@ -241,19 +251,19 @@ msgstr "" "... SATURDAY = 32\n" "... SUNDAY = 64" -#: ../../howto/enum.rst:128 +#: ../../howto/enum.rst:129 msgid "" "We've changed two things: we're inherited from :class:`Flag`, and the values " "are all powers of 2." msgstr "" -#: ../../howto/enum.rst:131 +#: ../../howto/enum.rst:132 msgid "" -"Just like the original :class:`Weekday` enum above, we can have a single " +"Just like the original :class:`!Weekday` enum above, we can have a single " "selection::" msgstr "" -#: ../../howto/enum.rst:133 +#: ../../howto/enum.rst:134 msgid "" ">>> first_week_day = Weekday.MONDAY\n" ">>> first_week_day\n" @@ -263,13 +273,13 @@ msgstr "" ">>> first_week_day\n" "" -#: ../../howto/enum.rst:137 +#: ../../howto/enum.rst:138 msgid "" "But :class:`Flag` also allows us to combine several members into a single " "variable::" msgstr "" -#: ../../howto/enum.rst:140 +#: ../../howto/enum.rst:141 msgid "" ">>> weekend = Weekday.SATURDAY | Weekday.SUNDAY\n" ">>> weekend\n" @@ -279,11 +289,11 @@ msgstr "" ">>> weekend\n" "" -#: ../../howto/enum.rst:144 +#: ../../howto/enum.rst:145 msgid "You can even iterate over a :class:`Flag` variable::" msgstr "" -#: ../../howto/enum.rst:146 +#: ../../howto/enum.rst:147 msgid "" ">>> for day in weekend:\n" "... print(day)\n" @@ -295,11 +305,11 @@ msgstr "" "Weekday.SATURDAY\n" "Weekday.SUNDAY" -#: ../../howto/enum.rst:151 +#: ../../howto/enum.rst:152 msgid "Okay, let's get some chores set up::" msgstr "" -#: ../../howto/enum.rst:153 +#: ../../howto/enum.rst:154 msgid "" ">>> chores_for_ethan = {\n" "... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday." @@ -315,11 +325,11 @@ msgstr "" "... 'answer SO questions': Weekday.SATURDAY,\n" "... }" -#: ../../howto/enum.rst:159 +#: ../../howto/enum.rst:160 msgid "And a function to display the chores for a given day::" msgstr "" -#: ../../howto/enum.rst:161 +#: ../../howto/enum.rst:162 msgid "" ">>> def show_chores(chores, day):\n" "... for chore, days in chores.items():\n" @@ -337,13 +347,13 @@ msgstr "" ">>> show_chores(chores_for_ethan, Weekday.SATURDAY)\n" "answer SO questions" -#: ../../howto/enum.rst:169 +#: ../../howto/enum.rst:170 msgid "" "In cases where the actual values of the members do not matter, you can save " "yourself some work and use :func:`auto` for the values::" msgstr "" -#: ../../howto/enum.rst:172 +#: ../../howto/enum.rst:173 msgid "" ">>> from enum import auto\n" ">>> class Weekday(Flag):\n" @@ -367,18 +377,18 @@ msgstr "" "... SUNDAY = auto()\n" "... WEEKEND = SATURDAY | SUNDAY" -#: ../../howto/enum.rst:188 +#: ../../howto/enum.rst:189 msgid "Programmatic access to enumeration members and their attributes" msgstr "" -#: ../../howto/enum.rst:190 +#: ../../howto/enum.rst:191 msgid "" "Sometimes it's useful to access members in enumerations programmatically (i." "e. situations where ``Color.RED`` won't do because the exact color is not " "known at program-writing time). ``Enum`` allows such access::" msgstr "" -#: ../../howto/enum.rst:194 +#: ../../howto/enum.rst:195 msgid "" ">>> Color(1)\n" "\n" @@ -390,11 +400,11 @@ msgstr "" ">>> Color(3)\n" "" -#: ../../howto/enum.rst:199 +#: ../../howto/enum.rst:200 msgid "If you want to access enum members by *name*, use item access::" msgstr "" -#: ../../howto/enum.rst:201 +#: ../../howto/enum.rst:202 msgid "" ">>> Color['RED']\n" "\n" @@ -406,11 +416,12 @@ msgstr "" ">>> Color['GREEN']\n" "" -#: ../../howto/enum.rst:206 -msgid "If you have an enum member and need its :attr:`name` or :attr:`value`::" +#: ../../howto/enum.rst:207 +msgid "" +"If you have an enum member and need its :attr:`!name` or :attr:`!value`::" msgstr "" -#: ../../howto/enum.rst:208 +#: ../../howto/enum.rst:209 msgid "" ">>> member = Color.RED\n" ">>> member.name\n" @@ -424,15 +435,15 @@ msgstr "" ">>> member.value\n" "1" -#: ../../howto/enum.rst:216 +#: ../../howto/enum.rst:217 msgid "Duplicating enum members and values" msgstr "" -#: ../../howto/enum.rst:218 +#: ../../howto/enum.rst:219 msgid "Having two enum members with the same name is invalid::" msgstr "" -#: ../../howto/enum.rst:220 +#: ../../howto/enum.rst:221 msgid "" ">>> class Shape(Enum):\n" "... SQUARE = 2\n" @@ -450,7 +461,7 @@ msgstr "" "...\n" "TypeError: 'SQUARE' already defined as 2" -#: ../../howto/enum.rst:228 +#: ../../howto/enum.rst:229 msgid "" "However, an enum member can have other names associated with it. Given two " "entries ``A`` and ``B`` with the same value (and ``A`` defined first), ``B`` " @@ -459,7 +470,7 @@ msgid "" "member ``A``. By-name lookup of ``B`` will also return the member ``A``::" msgstr "" -#: ../../howto/enum.rst:234 +#: ../../howto/enum.rst:235 msgid "" ">>> class Shape(Enum):\n" "... SQUARE = 2\n" @@ -487,24 +498,24 @@ msgstr "" ">>> Shape(2)\n" "" -#: ../../howto/enum.rst:249 +#: ../../howto/enum.rst:250 msgid "" "Attempting to create a member with the same name as an already defined " "attribute (another member, a method, etc.) or attempting to create an " "attribute with the same name as a member is not allowed." msgstr "" -#: ../../howto/enum.rst:255 +#: ../../howto/enum.rst:256 msgid "Ensuring unique enumeration values" msgstr "" -#: ../../howto/enum.rst:257 +#: ../../howto/enum.rst:258 msgid "" "By default, enumerations allow multiple names as aliases for the same value. " "When this behavior isn't desired, you can use the :func:`unique` decorator::" msgstr "" -#: ../../howto/enum.rst:260 +#: ../../howto/enum.rst:261 msgid "" ">>> from enum import Enum, unique\n" ">>> @unique\n" @@ -530,15 +541,15 @@ msgstr "" "...\n" "ValueError: duplicate values found in : FOUR -> THREE" -#: ../../howto/enum.rst:274 +#: ../../howto/enum.rst:275 msgid "Using automatic values" msgstr "" -#: ../../howto/enum.rst:276 +#: ../../howto/enum.rst:277 msgid "If the exact value is unimportant you can use :class:`auto`::" msgstr "" -#: ../../howto/enum.rst:278 +#: ../../howto/enum.rst:279 msgid "" ">>> from enum import Enum, auto\n" ">>> class Color(Enum):\n" @@ -558,13 +569,13 @@ msgstr "" ">>> [member.value for member in Color]\n" "[1, 2, 3]" -#: ../../howto/enum.rst:287 +#: ../../howto/enum.rst:288 msgid "" -"The values are chosen by :func:`_generate_next_value_`, which can be " +"The values are chosen by :func:`~Enum._generate_next_value_`, which can be " "overridden::" msgstr "" -#: ../../howto/enum.rst:290 +#: ../../howto/enum.rst:291 msgid "" ">>> class AutoName(Enum):\n" "... @staticmethod\n" @@ -594,20 +605,21 @@ msgstr "" ">>> [member.value for member in Ordinal]\n" "['NORTH', 'SOUTH', 'EAST', 'WEST']" -#: ../../howto/enum.rst:306 +#: ../../howto/enum.rst:307 msgid "" -"The :meth:`_generate_next_value_` method must be defined before any members." +"The :meth:`~Enum._generate_next_value_` method must be defined before any " +"members." msgstr "" -#: ../../howto/enum.rst:309 +#: ../../howto/enum.rst:310 msgid "Iteration" msgstr "" -#: ../../howto/enum.rst:311 +#: ../../howto/enum.rst:312 msgid "Iterating over the members of an enum does not provide the aliases::" msgstr "" -#: ../../howto/enum.rst:313 +#: ../../howto/enum.rst:314 msgid "" ">>> list(Shape)\n" "[, , ]\n" @@ -623,20 +635,20 @@ msgstr "" "THURSDAY: 8>, , , ]" -#: ../../howto/enum.rst:318 +#: ../../howto/enum.rst:319 msgid "" "Note that the aliases ``Shape.ALIAS_FOR_SQUARE`` and ``Weekday.WEEKEND`` " "aren't shown." msgstr "" -#: ../../howto/enum.rst:320 +#: ../../howto/enum.rst:321 msgid "" "The special attribute ``__members__`` is a read-only ordered mapping of " "names to members. It includes all names defined in the enumeration, " "including the aliases::" msgstr "" -#: ../../howto/enum.rst:324 +#: ../../howto/enum.rst:325 msgid "" ">>> for name, member in Shape.__members__.items():\n" "... name, member\n" @@ -654,13 +666,13 @@ msgstr "" "('CIRCLE', )\n" "('ALIAS_FOR_SQUARE', )" -#: ../../howto/enum.rst:332 +#: ../../howto/enum.rst:333 msgid "" "The ``__members__`` attribute can be used for detailed programmatic access " "to the enumeration members. For example, finding all the aliases::" msgstr "" -#: ../../howto/enum.rst:335 +#: ../../howto/enum.rst:336 msgid "" ">>> [name for name, member in Shape.__members__.items() if member.name != " "name]\n" @@ -670,21 +682,21 @@ msgstr "" "name]\n" "['ALIAS_FOR_SQUARE']" -#: ../../howto/enum.rst:340 +#: ../../howto/enum.rst:341 msgid "" "Aliases for flags include values with multiple flags set, such as ``3``, and " "no flags set, i.e. ``0``." msgstr "" -#: ../../howto/enum.rst:345 +#: ../../howto/enum.rst:346 msgid "Comparisons" msgstr "比較" -#: ../../howto/enum.rst:347 +#: ../../howto/enum.rst:348 msgid "Enumeration members are compared by identity::" msgstr "" -#: ../../howto/enum.rst:349 +#: ../../howto/enum.rst:350 msgid "" ">>> Color.RED is Color.RED\n" "True\n" @@ -700,13 +712,13 @@ msgstr "" ">>> Color.RED is not Color.BLUE\n" "True" -#: ../../howto/enum.rst:356 +#: ../../howto/enum.rst:357 msgid "" "Ordered comparisons between enumeration values are *not* supported. Enum " "members are not integers (but see `IntEnum`_ below)::" msgstr "" -#: ../../howto/enum.rst:359 +#: ../../howto/enum.rst:360 msgid "" ">>> Color.RED < Color.BLUE\n" "Traceback (most recent call last):\n" @@ -718,11 +730,11 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: '<' not supported between instances of 'Color' and 'Color'" -#: ../../howto/enum.rst:364 +#: ../../howto/enum.rst:365 msgid "Equality comparisons are defined though::" msgstr "" -#: ../../howto/enum.rst:366 +#: ../../howto/enum.rst:367 msgid "" ">>> Color.BLUE == Color.RED\n" "False\n" @@ -738,14 +750,14 @@ msgstr "" ">>> Color.BLUE == Color.BLUE\n" "True" -#: ../../howto/enum.rst:373 +#: ../../howto/enum.rst:374 msgid "" "Comparisons against non-enumeration values will always compare not equal " "(again, :class:`IntEnum` was explicitly designed to behave differently, see " "below)::" msgstr "" -#: ../../howto/enum.rst:377 +#: ../../howto/enum.rst:378 msgid "" ">>> Color.BLUE == 2\n" "False" @@ -753,18 +765,18 @@ msgstr "" ">>> Color.BLUE == 2\n" "False" -#: ../../howto/enum.rst:382 +#: ../../howto/enum.rst:383 msgid "" "It is possible to reload modules -- if a reloaded module contains enums, " "they will be recreated, and the new members may not compare identical/equal " "to the original members." msgstr "" -#: ../../howto/enum.rst:387 +#: ../../howto/enum.rst:388 msgid "Allowed members and attributes of enumerations" msgstr "" -#: ../../howto/enum.rst:389 +#: ../../howto/enum.rst:390 msgid "" "Most of the examples above use integers for enumeration values. Using " "integers is short and handy (and provided by default by the `Functional " @@ -773,13 +785,13 @@ msgid "" "*is* important, enumerations can have arbitrary values." msgstr "" -#: ../../howto/enum.rst:395 +#: ../../howto/enum.rst:396 msgid "" "Enumerations are Python classes, and can have methods and special methods as " "usual. If we have this enumeration::" msgstr "" -#: ../../howto/enum.rst:398 +#: ../../howto/enum.rst:399 msgid "" ">>> class Mood(Enum):\n" "... FUNKY = 1\n" @@ -799,11 +811,11 @@ msgid "" "..." msgstr "" -#: ../../howto/enum.rst:415 +#: ../../howto/enum.rst:416 msgid "Then::" msgstr "然後: ::" -#: ../../howto/enum.rst:417 +#: ../../howto/enum.rst:418 msgid "" ">>> Mood.favorite_mood()\n" "\n" @@ -819,43 +831,43 @@ msgstr "" ">>> str(Mood.FUNKY)\n" "'my custom str! 1'" -#: ../../howto/enum.rst:424 +#: ../../howto/enum.rst:425 msgid "" "The rules for what is allowed are as follows: names that start and end with " "a single underscore are reserved by enum and cannot be used; all other " "attributes defined within an enumeration will become members of this " -"enumeration, with the exception of special methods (:meth:`__str__`, :meth:" -"`__add__`, etc.), descriptors (methods are also descriptors), and variable " -"names listed in :attr:`_ignore_`." +"enumeration, with the exception of special methods (:meth:`~object." +"__str__`, :meth:`~object.__add__`, etc.), descriptors (methods are also " +"descriptors), and variable names listed in :attr:`~Enum._ignore_`." msgstr "" -#: ../../howto/enum.rst:431 +#: ../../howto/enum.rst:432 msgid "" -"Note: if your enumeration defines :meth:`__new__` and/or :meth:`__init__`, " -"any value(s) given to the enum member will be passed into those methods. See " -"`Planet`_ for an example." +"Note: if your enumeration defines :meth:`~object.__new__` and/or :meth:" +"`~object.__init__`, any value(s) given to the enum member will be passed " +"into those methods. See `Planet`_ for an example." msgstr "" -#: ../../howto/enum.rst:437 +#: ../../howto/enum.rst:438 msgid "" -"The :meth:`__new__` method, if defined, is used during creation of the Enum " -"members; it is then replaced by Enum's :meth:`__new__` which is used after " -"class creation for lookup of existing members. See :ref:`new-vs-init` for " -"more details." +"The :meth:`~object.__new__` method, if defined, is used during creation of " +"the Enum members; it is then replaced by Enum's :meth:`~object.__new__` " +"which is used after class creation for lookup of existing members. See :ref:" +"`new-vs-init` for more details." msgstr "" -#: ../../howto/enum.rst:444 +#: ../../howto/enum.rst:445 msgid "Restricted Enum subclassing" msgstr "" -#: ../../howto/enum.rst:446 +#: ../../howto/enum.rst:447 msgid "" "A new :class:`Enum` class must have one base enum class, up to one concrete " "data type, and as many :class:`object`-based mixin classes as needed. The " "order of these base classes is::" msgstr "" -#: ../../howto/enum.rst:450 +#: ../../howto/enum.rst:451 msgid "" "class EnumName([mix-in, ...,] [data-type,] base-enum):\n" " pass" @@ -863,13 +875,13 @@ msgstr "" "class EnumName([mix-in, ...,] [data-type,] base-enum):\n" " pass" -#: ../../howto/enum.rst:453 +#: ../../howto/enum.rst:454 msgid "" "Also, subclassing an enumeration is allowed only if the enumeration does not " "define any members. So this is forbidden::" msgstr "" -#: ../../howto/enum.rst:456 +#: ../../howto/enum.rst:457 msgid "" ">>> class MoreColor(Color):\n" "... PINK = 17\n" @@ -885,11 +897,11 @@ msgstr "" "...\n" "TypeError: cannot extend " -#: ../../howto/enum.rst:463 +#: ../../howto/enum.rst:464 msgid "But this is allowed::" msgstr "但這是允許的:" -#: ../../howto/enum.rst:465 +#: ../../howto/enum.rst:466 msgid "" ">>> class Foo(Enum):\n" "... def some_behavior(self):\n" @@ -909,7 +921,7 @@ msgstr "" "... SAD = 2\n" "..." -#: ../../howto/enum.rst:474 +#: ../../howto/enum.rst:475 msgid "" "Allowing subclassing of enums that define members would lead to a violation " "of some important invariants of types and instances. On the other hand, it " @@ -917,17 +929,17 @@ msgid "" "enumerations. (See `OrderedEnum`_ for an example.)" msgstr "" -#: ../../howto/enum.rst:483 +#: ../../howto/enum.rst:484 msgid "Dataclass support" msgstr "" -#: ../../howto/enum.rst:485 +#: ../../howto/enum.rst:486 msgid "" "When inheriting from a :class:`~dataclasses.dataclass`, the :meth:`~Enum." "__repr__` omits the inherited class' name. For example::" msgstr "" -#: ../../howto/enum.rst:488 +#: ../../howto/enum.rst:489 msgid "" ">>> from dataclasses import dataclass, field\n" ">>> @dataclass\n" @@ -957,19 +969,19 @@ msgstr "" ">>> Creature.DOG\n" "" -#: ../../howto/enum.rst:502 +#: ../../howto/enum.rst:503 msgid "" "Use the :func:`~dataclasses.dataclass` argument ``repr=False`` to use the " "standard :func:`repr`." msgstr "" -#: ../../howto/enum.rst:505 +#: ../../howto/enum.rst:506 msgid "" "Only the dataclass fields are shown in the value area, not the dataclass' " "name." msgstr "" -#: ../../howto/enum.rst:511 +#: ../../howto/enum.rst:512 msgid "" "Adding :func:`~dataclasses.dataclass` decorator to :class:`Enum` and its " "subclasses is not supported. It will not raise any errors, but it will " @@ -977,7 +989,7 @@ msgid "" "other::" msgstr "" -#: ../../howto/enum.rst:516 +#: ../../howto/enum.rst:517 msgid "" ">>> @dataclass # don't do this: it does not make any sense\n" "... class Color(Enum):\n" @@ -990,15 +1002,15 @@ msgid "" "True" msgstr "" -#: ../../howto/enum.rst:528 +#: ../../howto/enum.rst:529 msgid "Pickling" msgstr "" -#: ../../howto/enum.rst:530 +#: ../../howto/enum.rst:531 msgid "Enumerations can be pickled and unpickled::" msgstr "" -#: ../../howto/enum.rst:532 +#: ../../howto/enum.rst:533 msgid "" ">>> from test.test_enum import Fruit\n" ">>> from pickle import dumps, loads\n" @@ -1010,27 +1022,27 @@ msgstr "" ">>> Fruit.TOMATO is loads(dumps(Fruit.TOMATO))\n" "True" -#: ../../howto/enum.rst:537 +#: ../../howto/enum.rst:538 msgid "" "The usual restrictions for pickling apply: picklable enums must be defined " "in the top level of a module, since unpickling requires them to be " "importable from that module." msgstr "" -#: ../../howto/enum.rst:543 +#: ../../howto/enum.rst:544 msgid "" "With pickle protocol version 4 it is possible to easily pickle enums nested " "in other classes." msgstr "" -#: ../../howto/enum.rst:546 +#: ../../howto/enum.rst:547 msgid "" "It is possible to modify how enum members are pickled/unpickled by defining :" -"meth:`__reduce_ex__` in the enumeration class. The default method is by-" -"value, but enums with complicated values may want to use by-name::" +"meth:`~object.__reduce_ex__` in the enumeration class. The default method " +"is by-value, but enums with complicated values may want to use by-name::" msgstr "" -#: ../../howto/enum.rst:550 +#: ../../howto/enum.rst:551 msgid "" ">>> import enum\n" ">>> class MyEnum(enum.Enum):\n" @@ -1040,22 +1052,22 @@ msgstr "" ">>> class MyEnum(enum.Enum):\n" "... __reduce_ex__ = enum.pickle_by_enum_name" -#: ../../howto/enum.rst:556 +#: ../../howto/enum.rst:557 msgid "" "Using by-name for flags is not recommended, as unnamed aliases will not " "unpickle." msgstr "" -#: ../../howto/enum.rst:561 +#: ../../howto/enum.rst:562 msgid "Functional API" msgstr "" -#: ../../howto/enum.rst:563 +#: ../../howto/enum.rst:564 msgid "" "The :class:`Enum` class is callable, providing the following functional API::" msgstr "" -#: ../../howto/enum.rst:565 +#: ../../howto/enum.rst:566 msgid "" ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG')\n" ">>> Animal\n" @@ -1073,13 +1085,13 @@ msgstr "" ">>> list(Animal)\n" "[, , , ]" -#: ../../howto/enum.rst:573 +#: ../../howto/enum.rst:574 msgid "" "The semantics of this API resemble :class:`~collections.namedtuple`. The " "first argument of the call to :class:`Enum` is the name of the enumeration." msgstr "" -#: ../../howto/enum.rst:576 +#: ../../howto/enum.rst:577 msgid "" "The second argument is the *source* of enumeration member names. It can be " "a whitespace-separated string of names, a sequence of names, a sequence of 2-" @@ -1088,10 +1100,10 @@ msgid "" "enumerations; the others auto-assign increasing integers starting with 1 " "(use the ``start`` parameter to specify a different starting value). A new " "class derived from :class:`Enum` is returned. In other words, the above " -"assignment to :class:`Animal` is equivalent to::" +"assignment to :class:`!Animal` is equivalent to::" msgstr "" -#: ../../howto/enum.rst:585 +#: ../../howto/enum.rst:586 msgid "" ">>> class Animal(Enum):\n" "... ANT = 1\n" @@ -1107,14 +1119,14 @@ msgstr "" "... DOG = 4\n" "..." -#: ../../howto/enum.rst:592 +#: ../../howto/enum.rst:593 msgid "" "The reason for defaulting to ``1`` as the starting number and not ``0`` is " "that ``0`` is ``False`` in a boolean sense, but by default enum members all " "evaluate to ``True``." msgstr "" -#: ../../howto/enum.rst:596 +#: ../../howto/enum.rst:597 msgid "" "Pickling enums created with the functional API can be tricky as frame stack " "implementation details are used to try and figure out which module the " @@ -1123,18 +1135,18 @@ msgid "" "Jython). The solution is to specify the module name explicitly as follows::" msgstr "" -#: ../../howto/enum.rst:602 +#: ../../howto/enum.rst:603 msgid ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=__name__)" msgstr ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=__name__)" -#: ../../howto/enum.rst:606 +#: ../../howto/enum.rst:607 msgid "" "If ``module`` is not supplied, and Enum cannot determine what it is, the new " "Enum members will not be unpicklable; to keep errors closer to the source, " "pickling will be disabled." msgstr "" -#: ../../howto/enum.rst:610 +#: ../../howto/enum.rst:611 msgid "" "The new pickle protocol 4 also, in some circumstances, relies on :attr:" "`~type.__qualname__` being set to the location where pickle will be able to " @@ -1142,17 +1154,17 @@ msgid "" "SomeData in the global scope::" msgstr "" -#: ../../howto/enum.rst:615 +#: ../../howto/enum.rst:616 msgid "" ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', qualname='SomeData.Animal')" msgstr "" ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', qualname='SomeData.Animal')" -#: ../../howto/enum.rst:617 +#: ../../howto/enum.rst:618 msgid "The complete signature is::" msgstr "" -#: ../../howto/enum.rst:619 +#: ../../howto/enum.rst:620 msgid "" "Enum(\n" " value='NewEnumName',\n" @@ -1174,73 +1186,73 @@ msgstr "" " start=1,\n" " )" -#: ../../howto/enum.rst:629 +#: ../../howto/enum.rst:630 msgid "*value*: What the new enum class will record as its name." msgstr "" -#: ../../howto/enum.rst:631 +#: ../../howto/enum.rst:632 msgid "" "*names*: The enum members. This can be a whitespace- or comma-separated " "string (values will start at 1 unless otherwise specified)::" msgstr "" -#: ../../howto/enum.rst:634 +#: ../../howto/enum.rst:635 msgid "'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'" msgstr "'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'" -#: ../../howto/enum.rst:636 +#: ../../howto/enum.rst:637 msgid "or an iterator of names::" msgstr "" -#: ../../howto/enum.rst:638 +#: ../../howto/enum.rst:639 msgid "['RED', 'GREEN', 'BLUE']" msgstr "['RED', 'GREEN', 'BLUE']" -#: ../../howto/enum.rst:640 +#: ../../howto/enum.rst:641 msgid "or an iterator of (name, value) pairs::" msgstr "" -#: ../../howto/enum.rst:642 +#: ../../howto/enum.rst:643 msgid "[('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)]" msgstr "[('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)]" -#: ../../howto/enum.rst:644 +#: ../../howto/enum.rst:645 msgid "or a mapping::" msgstr "" -#: ../../howto/enum.rst:646 +#: ../../howto/enum.rst:647 msgid "{'CHARTREUSE': 7, 'SEA_GREEN': 11, 'ROSEMARY': 42}" msgstr "{'CHARTREUSE': 7, 'SEA_GREEN': 11, 'ROSEMARY': 42}" -#: ../../howto/enum.rst:648 +#: ../../howto/enum.rst:649 msgid "*module*: name of module where new enum class can be found." msgstr "" -#: ../../howto/enum.rst:650 +#: ../../howto/enum.rst:651 msgid "*qualname*: where in module new enum class can be found." msgstr "" -#: ../../howto/enum.rst:652 +#: ../../howto/enum.rst:653 msgid "*type*: type to mix in to new enum class." msgstr "" -#: ../../howto/enum.rst:654 +#: ../../howto/enum.rst:655 msgid "*start*: number to start counting at if only names are passed in." msgstr "" -#: ../../howto/enum.rst:656 +#: ../../howto/enum.rst:657 msgid "The *start* parameter was added." msgstr "" -#: ../../howto/enum.rst:661 +#: ../../howto/enum.rst:662 msgid "Derived Enumerations" msgstr "" -#: ../../howto/enum.rst:664 +#: ../../howto/enum.rst:665 msgid "IntEnum" msgstr "IntEnum" -#: ../../howto/enum.rst:666 +#: ../../howto/enum.rst:667 msgid "" "The first variation of :class:`Enum` that is provided is also a subclass of :" "class:`int`. Members of an :class:`IntEnum` can be compared to integers; by " @@ -1248,7 +1260,7 @@ msgid "" "each other::" msgstr "" -#: ../../howto/enum.rst:671 +#: ../../howto/enum.rst:672 msgid "" ">>> from enum import IntEnum\n" ">>> class Shape(IntEnum):\n" @@ -1282,13 +1294,13 @@ msgstr "" ">>> Shape.CIRCLE == Request.POST\n" "True" -#: ../../howto/enum.rst:687 +#: ../../howto/enum.rst:688 msgid "" "However, they still can't be compared to standard :class:`Enum` " "enumerations::" msgstr "" -#: ../../howto/enum.rst:689 +#: ../../howto/enum.rst:690 msgid "" ">>> class Shape(IntEnum):\n" "... CIRCLE = 1\n" @@ -1312,12 +1324,12 @@ msgstr "" ">>> Shape.CIRCLE == Color.RED\n" "False" -#: ../../howto/enum.rst:700 +#: ../../howto/enum.rst:701 msgid "" ":class:`IntEnum` values behave like integers in other ways you'd expect::" msgstr "" -#: ../../howto/enum.rst:702 +#: ../../howto/enum.rst:703 msgid "" ">>> int(Shape.CIRCLE)\n" "1\n" @@ -1333,11 +1345,11 @@ msgstr "" ">>> [i for i in range(Shape.SQUARE)]\n" "[0, 1]" -#: ../../howto/enum.rst:711 +#: ../../howto/enum.rst:712 msgid "StrEnum" msgstr "StrEnum" -#: ../../howto/enum.rst:713 +#: ../../howto/enum.rst:714 msgid "" "The second variation of :class:`Enum` that is provided is also a subclass " "of :class:`str`. Members of a :class:`StrEnum` can be compared to strings; " @@ -1345,11 +1357,11 @@ msgid "" "each other." msgstr "" -#: ../../howto/enum.rst:722 +#: ../../howto/enum.rst:723 msgid "IntFlag" msgstr "IntFlag" -#: ../../howto/enum.rst:724 +#: ../../howto/enum.rst:725 msgid "" "The next variation of :class:`Enum` provided, :class:`IntFlag`, is also " "based on :class:`int`. The difference being :class:`IntFlag` members can be " @@ -1359,23 +1371,23 @@ msgid "" "is used." msgstr "" -#: ../../howto/enum.rst:732 +#: ../../howto/enum.rst:733 msgid "" "Any operation on an :class:`IntFlag` member besides the bit-wise operations " "will lose the :class:`IntFlag` membership." msgstr "" -#: ../../howto/enum.rst:735 +#: ../../howto/enum.rst:736 msgid "" "Bit-wise operations that result in invalid :class:`IntFlag` values will lose " "the :class:`IntFlag` membership. See :class:`FlagBoundary` for details." msgstr "" -#: ../../howto/enum.rst:742 +#: ../../howto/enum.rst:743 msgid "Sample :class:`IntFlag` class::" msgstr "" -#: ../../howto/enum.rst:744 +#: ../../howto/enum.rst:745 msgid "" ">>> from enum import IntFlag\n" ">>> class Perm(IntFlag):\n" @@ -1405,11 +1417,11 @@ msgstr "" ">>> Perm.R in RW\n" "True" -#: ../../howto/enum.rst:758 +#: ../../howto/enum.rst:759 msgid "It is also possible to name the combinations::" msgstr "" -#: ../../howto/enum.rst:760 +#: ../../howto/enum.rst:761 msgid "" ">>> class Perm(IntFlag):\n" "... R = 4\n" @@ -1437,20 +1449,20 @@ msgstr "" ">>> Perm(7)\n" "" -#: ../../howto/enum.rst:775 +#: ../../howto/enum.rst:776 msgid "" "Named combinations are considered aliases. Aliases do not show up during " "iteration, but can be returned from by-value lookups." msgstr "" -#: ../../howto/enum.rst:780 +#: ../../howto/enum.rst:781 msgid "" "Another important difference between :class:`IntFlag` and :class:`Enum` is " "that if no flags are set (the value is 0), its boolean evaluation is :data:" "`False`::" msgstr "" -#: ../../howto/enum.rst:783 +#: ../../howto/enum.rst:784 msgid "" ">>> Perm.R & Perm.X\n" "\n" @@ -1462,13 +1474,13 @@ msgstr "" ">>> bool(Perm.R & Perm.X)\n" "False" -#: ../../howto/enum.rst:788 +#: ../../howto/enum.rst:789 msgid "" "Because :class:`IntFlag` members are also subclasses of :class:`int` they " "can be combined with them (but may lose :class:`IntFlag` membership::" msgstr "" -#: ../../howto/enum.rst:791 +#: ../../howto/enum.rst:792 msgid "" ">>> Perm.X | 4\n" "\n" @@ -1482,13 +1494,13 @@ msgstr "" ">>> Perm.X + 8\n" "9" -#: ../../howto/enum.rst:799 +#: ../../howto/enum.rst:800 msgid "" "The negation operator, ``~``, always returns an :class:`IntFlag` member with " "a positive value::" msgstr "" -#: ../../howto/enum.rst:802 +#: ../../howto/enum.rst:803 msgid "" ">>> (~Perm.X).value == (Perm.R|Perm.W).value == 6\n" "True" @@ -1496,11 +1508,11 @@ msgstr "" ">>> (~Perm.X).value == (Perm.R|Perm.W).value == 6\n" "True" -#: ../../howto/enum.rst:805 +#: ../../howto/enum.rst:806 msgid ":class:`IntFlag` members can also be iterated over::" msgstr "" -#: ../../howto/enum.rst:807 +#: ../../howto/enum.rst:808 msgid "" ">>> list(RW)\n" "[, ]" @@ -1508,11 +1520,11 @@ msgstr "" ">>> list(RW)\n" "[, ]" -#: ../../howto/enum.rst:814 +#: ../../howto/enum.rst:815 msgid "Flag" msgstr "Flag" -#: ../../howto/enum.rst:816 +#: ../../howto/enum.rst:817 msgid "" "The last variation is :class:`Flag`. Like :class:`IntFlag`, :class:`Flag` " "members can be combined using the bitwise operators (&, \\|, ^, ~). Unlike :" @@ -1522,13 +1534,13 @@ msgid "" "value and let :class:`Flag` select an appropriate value." msgstr "" -#: ../../howto/enum.rst:825 +#: ../../howto/enum.rst:826 msgid "" "Like :class:`IntFlag`, if a combination of :class:`Flag` members results in " "no flags being set, the boolean evaluation is :data:`False`::" msgstr "" -#: ../../howto/enum.rst:828 +#: ../../howto/enum.rst:829 msgid "" ">>> from enum import Flag, auto\n" ">>> class Color(Flag):\n" @@ -1552,13 +1564,13 @@ msgstr "" ">>> bool(Color.RED & Color.GREEN)\n" "False" -#: ../../howto/enum.rst:839 +#: ../../howto/enum.rst:840 msgid "" "Individual flags should have values that are powers of two (1, 2, 4, " "8, ...), while combinations of flags will not::" msgstr "" -#: ../../howto/enum.rst:842 +#: ../../howto/enum.rst:843 msgid "" ">>> class Color(Flag):\n" "... RED = auto()\n" @@ -1578,13 +1590,13 @@ msgstr "" ">>> Color.WHITE\n" "" -#: ../../howto/enum.rst:851 +#: ../../howto/enum.rst:852 msgid "" "Giving a name to the \"no flags set\" condition does not change its boolean " "value::" msgstr "" -#: ../../howto/enum.rst:854 +#: ../../howto/enum.rst:855 msgid "" ">>> class Color(Flag):\n" "... BLACK = 0\n" @@ -1608,11 +1620,11 @@ msgstr "" ">>> bool(Color.BLACK)\n" "False" -#: ../../howto/enum.rst:865 +#: ../../howto/enum.rst:866 msgid ":class:`Flag` members can also be iterated over::" msgstr "" -#: ../../howto/enum.rst:867 +#: ../../howto/enum.rst:868 msgid "" ">>> purple = Color.RED | Color.BLUE\n" ">>> list(purple)\n" @@ -1622,7 +1634,7 @@ msgstr "" ">>> list(purple)\n" "[, ]" -#: ../../howto/enum.rst:875 +#: ../../howto/enum.rst:876 msgid "" "For the majority of new code, :class:`Enum` and :class:`Flag` are strongly " "recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic " @@ -1633,17 +1645,17 @@ msgid "" "enumerations, or for interoperability with other systems." msgstr "" -#: ../../howto/enum.rst:885 +#: ../../howto/enum.rst:886 msgid "Others" msgstr "其他" -#: ../../howto/enum.rst:887 +#: ../../howto/enum.rst:888 msgid "" "While :class:`IntEnum` is part of the :mod:`enum` module, it would be very " "simple to implement independently::" msgstr "" -#: ../../howto/enum.rst:890 +#: ../../howto/enum.rst:891 msgid "" "class IntEnum(int, ReprEnum): # or Enum instead of ReprEnum\n" " pass" @@ -1651,32 +1663,32 @@ msgstr "" "class IntEnum(int, ReprEnum): # 或用 Enum 取代 ReprEnum\n" " pass" -#: ../../howto/enum.rst:893 +#: ../../howto/enum.rst:894 msgid "" "This demonstrates how similar derived enumerations can be defined; for " -"example a :class:`FloatEnum` that mixes in :class:`float` instead of :class:" +"example a :class:`!FloatEnum` that mixes in :class:`float` instead of :class:" "`int`." msgstr "" -#: ../../howto/enum.rst:896 +#: ../../howto/enum.rst:897 msgid "Some rules:" msgstr "一些規則:" -#: ../../howto/enum.rst:898 +#: ../../howto/enum.rst:899 msgid "" "When subclassing :class:`Enum`, mix-in types must appear before the :class:" "`Enum` class itself in the sequence of bases, as in the :class:`IntEnum` " "example above." msgstr "" -#: ../../howto/enum.rst:901 +#: ../../howto/enum.rst:902 msgid "" "Mix-in types must be subclassable. For example, :class:`bool` and :class:" "`range` are not subclassable and will throw an error during Enum creation if " "used as the mix-in type." msgstr "" -#: ../../howto/enum.rst:904 +#: ../../howto/enum.rst:905 msgid "" "While :class:`Enum` can have members of any type, once you mix in an " "additional type, all the members must have values of that type, e.g. :class:" @@ -1684,57 +1696,60 @@ msgid "" "methods and don't specify another type." msgstr "" -#: ../../howto/enum.rst:908 +#: ../../howto/enum.rst:909 msgid "" -"When another data type is mixed in, the :attr:`value` attribute is *not the " -"same* as the enum member itself, although it is equivalent and will compare " -"equal." +"When another data type is mixed in, the :attr:`~Enum.value` attribute is " +"*not the same* as the enum member itself, although it is equivalent and will " +"compare equal." msgstr "" -#: ../../howto/enum.rst:911 +#: ../../howto/enum.rst:912 msgid "" -"A ``data type`` is a mixin that defines :meth:`__new__`, or a :class:" +"A ``data type`` is a mixin that defines :meth:`~object.__new__`, or a :class:" "`~dataclasses.dataclass`" msgstr "" -#: ../../howto/enum.rst:913 +#: ../../howto/enum.rst:914 msgid "" "%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` class's :meth:" -"`__str__` and :meth:`__repr__` respectively; other codes (such as ``%i`` or " -"``%h`` for IntEnum) treat the enum member as its mixed-in type." +"`~object.__str__` and :meth:`~object.__repr__` respectively; other codes " +"(such as ``%i`` or ``%h`` for IntEnum) treat the enum member as its mixed-in " +"type." msgstr "" -#: ../../howto/enum.rst:916 +#: ../../howto/enum.rst:917 msgid "" ":ref:`Formatted string literals `, :meth:`str.format`, and :func:" -"`format` will use the enum's :meth:`__str__` method." +"`format` will use the enum's :meth:`~object.__str__` method." msgstr "" -#: ../../howto/enum.rst:921 +#: ../../howto/enum.rst:922 msgid "" "Because :class:`IntEnum`, :class:`IntFlag`, and :class:`StrEnum` are " "designed to be drop-in replacements for existing constants, their :meth:" -"`__str__` method has been reset to their data types' :meth:`__str__` method." +"`~object.__str__` method has been reset to their data types' :meth:`~object." +"__str__` method." msgstr "" -#: ../../howto/enum.rst:929 -msgid "When to use :meth:`__new__` vs. :meth:`__init__`" +#: ../../howto/enum.rst:930 +msgid "When to use :meth:`~object.__new__` vs. :meth:`~object.__init__`" msgstr "" -#: ../../howto/enum.rst:931 +#: ../../howto/enum.rst:932 msgid "" -":meth:`__new__` must be used whenever you want to customize the actual value " -"of the :class:`Enum` member. Any other modifications may go in either :meth:" -"`__new__` or :meth:`__init__`, with :meth:`__init__` being preferred." +":meth:`~object.__new__` must be used whenever you want to customize the " +"actual value of the :class:`Enum` member. Any other modifications may go in " +"either :meth:`~object.__new__` or :meth:`~object.__init__`, with :meth:" +"`~object.__init__` being preferred." msgstr "" -#: ../../howto/enum.rst:935 +#: ../../howto/enum.rst:936 msgid "" "For example, if you want to pass several items to the constructor, but only " "want one of them to be the value::" msgstr "" -#: ../../howto/enum.rst:938 +#: ../../howto/enum.rst:939 msgid "" ">>> class Coordinate(bytes, Enum):\n" "... \"\"\"\n" @@ -1759,113 +1774,114 @@ msgid "" "Coordinate.VY" msgstr "" -#: ../../howto/enum.rst:962 +#: ../../howto/enum.rst:963 msgid "" "*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the " "one that is found; instead, use the data type directly." msgstr "" -#: ../../howto/enum.rst:967 +#: ../../howto/enum.rst:968 msgid "Finer Points" msgstr "" -#: ../../howto/enum.rst:970 +#: ../../howto/enum.rst:971 msgid "Supported ``__dunder__`` names" msgstr "" -#: ../../howto/enum.rst:972 +#: ../../howto/enum.rst:973 msgid "" -":attr:`__members__` is a read-only ordered mapping of ``member_name``:" -"``member`` items. It is only available on the class." +":attr:`~enum.EnumType.__members__` is a read-only ordered mapping of " +"``member_name``:``member`` items. It is only available on the class." msgstr "" -#: ../../howto/enum.rst:975 +#: ../../howto/enum.rst:976 msgid "" -":meth:`__new__`, if specified, must create and return the enum members; it " -"is also a very good idea to set the member's :attr:`_value_` appropriately. " -"Once all the members are created it is no longer used." +":meth:`~object.__new__`, if specified, must create and return the enum " +"members; it is also a very good idea to set the member's :attr:`~Enum." +"_value_` appropriately. Once all the members are created it is no longer " +"used." msgstr "" -#: ../../howto/enum.rst:981 +#: ../../howto/enum.rst:982 msgid "Supported ``_sunder_`` names" msgstr "" -#: ../../howto/enum.rst:983 +#: ../../howto/enum.rst:984 msgid ":attr:`~Enum._name_` -- name of the member" msgstr ":attr:`~Enum._name_` -- 成員的名稱" -#: ../../howto/enum.rst:984 +#: ../../howto/enum.rst:985 msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" msgstr "" -#: ../../howto/enum.rst:985 +#: ../../howto/enum.rst:986 msgid "" ":meth:`~Enum._missing_` -- a lookup function used when a value is not found; " "may be overridden" msgstr "" -#: ../../howto/enum.rst:987 +#: ../../howto/enum.rst:988 msgid "" ":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" "class:`str`, that will not be transformed into members, and will be removed " "from the final class" msgstr "" -#: ../../howto/enum.rst:990 +#: ../../howto/enum.rst:991 msgid "" ":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for " "an enum member; may be overridden" msgstr "" -#: ../../howto/enum.rst:992 +#: ../../howto/enum.rst:993 msgid "" -":meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing " +":meth:`~EnumType._add_alias_` -- adds a new name as an alias to an existing " "member." msgstr "" -#: ../../howto/enum.rst:994 +#: ../../howto/enum.rst:995 msgid "" -":meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an " +":meth:`~EnumType._add_value_alias_` -- adds a new value as an alias to an " "existing member. See `MultiValueEnum`_ for an example." msgstr "" -#: ../../howto/enum.rst:999 +#: ../../howto/enum.rst:1000 msgid "" "For standard :class:`Enum` classes the next value chosen is the highest " "value seen incremented by one." msgstr "" -#: ../../howto/enum.rst:1002 +#: ../../howto/enum.rst:1003 msgid "" "For :class:`Flag` classes the next value chosen will be the next highest " "power-of-two." msgstr "" -#: ../../howto/enum.rst:1005 +#: ../../howto/enum.rst:1006 msgid "" "Prior versions would use the last seen value instead of the highest value." msgstr "" -#: ../../howto/enum.rst:1008 +#: ../../howto/enum.rst:1009 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" msgstr "``_missing_``、``_order_``、``_generate_next_value_``" -#: ../../howto/enum.rst:1009 +#: ../../howto/enum.rst:1010 msgid "``_ignore_``" msgstr "``_ignore_``" -#: ../../howto/enum.rst:1010 +#: ../../howto/enum.rst:1011 msgid "``_add_alias_``, ``_add_value_alias_``" msgstr "" -#: ../../howto/enum.rst:1012 +#: ../../howto/enum.rst:1013 msgid "" -"To help keep Python 2 / Python 3 code in sync an :attr:`_order_` attribute " -"can be provided. It will be checked against the actual order of the " -"enumeration and raise an error if the two do not match::" +"To help keep Python 2 / Python 3 code in sync an :attr:`~Enum._order_` " +"attribute can be provided. It will be checked against the actual order of " +"the enumeration and raise an error if the two do not match::" msgstr "" -#: ../../howto/enum.rst:1016 +#: ../../howto/enum.rst:1017 msgid "" ">>> class Color(Enum):\n" "... _order_ = 'RED GREEN BLUE'\n" @@ -1891,27 +1907,27 @@ msgstr "" " ['RED', 'BLUE', 'GREEN']\n" " ['RED', 'GREEN', 'BLUE']" -#: ../../howto/enum.rst:1030 +#: ../../howto/enum.rst:1031 msgid "" -"In Python 2 code the :attr:`_order_` attribute is necessary as definition " -"order is lost before it can be recorded." +"In Python 2 code the :attr:`~Enum._order_` attribute is necessary as " +"definition order is lost before it can be recorded." msgstr "" -#: ../../howto/enum.rst:1035 +#: ../../howto/enum.rst:1036 msgid "_Private__names" msgstr "_Private__names" -#: ../../howto/enum.rst:1037 +#: ../../howto/enum.rst:1038 msgid "" ":ref:`Private names ` are not converted to enum " "members, but remain normal attributes." msgstr "" -#: ../../howto/enum.rst:1044 +#: ../../howto/enum.rst:1045 msgid "``Enum`` member type" msgstr "" -#: ../../howto/enum.rst:1046 +#: ../../howto/enum.rst:1047 msgid "" "Enum members are instances of their enum class, and are normally accessed as " "``EnumClass.member``. In certain situations, such as writing custom enum " @@ -1921,18 +1937,18 @@ msgid "" "strongly recommended." msgstr "" -#: ../../howto/enum.rst:1057 +#: ../../howto/enum.rst:1058 msgid "Creating members that are mixed with other data types" msgstr "" -#: ../../howto/enum.rst:1059 +#: ../../howto/enum.rst:1060 msgid "" "When subclassing other data types, such as :class:`int` or :class:`str`, " "with an :class:`Enum`, all values after the ``=`` are passed to that data " "type's constructor. For example::" msgstr "" -#: ../../howto/enum.rst:1063 +#: ../../howto/enum.rst:1064 msgid "" ">>> class MyEnum(IntEnum): # help(int) -> int(x, base=10) -> integer\n" "... example = '11', 16 # so x='11' and base=16\n" @@ -1946,11 +1962,11 @@ msgstr "" ">>> MyEnum.example.value # 且 hex(11) 為...\n" "17" -#: ../../howto/enum.rst:1071 +#: ../../howto/enum.rst:1072 msgid "Boolean value of ``Enum`` classes and members" msgstr "" -#: ../../howto/enum.rst:1073 +#: ../../howto/enum.rst:1074 msgid "" "Enum classes that are mixed with non-:class:`Enum` types (such as :class:" "`int`, :class:`str`, etc.) are evaluated according to the mixed-in type's " @@ -1959,7 +1975,7 @@ msgid "" "your class::" msgstr "" -#: ../../howto/enum.rst:1079 +#: ../../howto/enum.rst:1080 msgid "" "def __bool__(self):\n" " return bool(self.value)" @@ -1967,22 +1983,22 @@ msgstr "" "def __bool__(self):\n" " return bool(self.value)" -#: ../../howto/enum.rst:1082 +#: ../../howto/enum.rst:1083 msgid "Plain :class:`Enum` classes always evaluate as :data:`True`." msgstr "" -#: ../../howto/enum.rst:1086 +#: ../../howto/enum.rst:1087 msgid "``Enum`` classes with methods" msgstr "" -#: ../../howto/enum.rst:1088 +#: ../../howto/enum.rst:1089 msgid "" "If you give your enum subclass extra methods, like the `Planet`_ class " "below, those methods will show up in a :func:`dir` of the member, but not of " "the class::" msgstr "" -#: ../../howto/enum.rst:1092 +#: ../../howto/enum.rst:1093 msgid "" ">>> dir(Planet) \n" "['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', " @@ -1998,17 +2014,17 @@ msgstr "" "['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', " "'surface_gravity', 'value']" -#: ../../howto/enum.rst:1099 +#: ../../howto/enum.rst:1100 msgid "Combining members of ``Flag``" msgstr "" -#: ../../howto/enum.rst:1101 +#: ../../howto/enum.rst:1102 msgid "" "Iterating over a combination of :class:`Flag` members will only return the " "members that are comprised of a single bit::" msgstr "" -#: ../../howto/enum.rst:1104 +#: ../../howto/enum.rst:1105 msgid "" ">>> class Color(Flag):\n" "... RED = auto()\n" @@ -2024,15 +2040,15 @@ msgid "" "" msgstr "" -#: ../../howto/enum.rst:1119 +#: ../../howto/enum.rst:1120 msgid "``Flag`` and ``IntFlag`` minutia" msgstr "" -#: ../../howto/enum.rst:1121 +#: ../../howto/enum.rst:1122 msgid "Using the following snippet for our examples::" msgstr "" -#: ../../howto/enum.rst:1123 +#: ../../howto/enum.rst:1124 msgid "" ">>> class Color(IntFlag):\n" "... BLACK = 0\n" @@ -2052,23 +2068,23 @@ msgstr "" "... WHITE = RED | GREEN | BLUE\n" "..." -#: ../../howto/enum.rst:1132 +#: ../../howto/enum.rst:1133 msgid "the following are true:" msgstr "" -#: ../../howto/enum.rst:1134 +#: ../../howto/enum.rst:1135 msgid "single-bit flags are canonical" msgstr "" -#: ../../howto/enum.rst:1135 +#: ../../howto/enum.rst:1136 msgid "multi-bit and zero-bit flags are aliases" msgstr "" -#: ../../howto/enum.rst:1136 +#: ../../howto/enum.rst:1137 msgid "only canonical flags are returned during iteration::" msgstr "" -#: ../../howto/enum.rst:1138 +#: ../../howto/enum.rst:1139 msgid "" ">>> list(Color.WHITE)\n" "[, , ]" @@ -2076,13 +2092,13 @@ msgstr "" ">>> list(Color.WHITE)\n" "[, , ]" -#: ../../howto/enum.rst:1141 +#: ../../howto/enum.rst:1142 msgid "" "negating a flag or flag set returns a new flag/flag set with the " "corresponding positive integer value::" msgstr "" -#: ../../howto/enum.rst:1144 +#: ../../howto/enum.rst:1145 msgid "" ">>> Color.BLUE\n" "\n" @@ -2096,11 +2112,11 @@ msgstr "" ">>> ~Color.BLUE\n" "" -#: ../../howto/enum.rst:1150 +#: ../../howto/enum.rst:1151 msgid "names of pseudo-flags are constructed from their members' names::" msgstr "" -#: ../../howto/enum.rst:1152 +#: ../../howto/enum.rst:1153 msgid "" ">>> (Color.RED | Color.GREEN).name\n" "'RED|GREEN'\n" @@ -2114,11 +2130,11 @@ msgid "" "True" msgstr "" -#: ../../howto/enum.rst:1163 +#: ../../howto/enum.rst:1164 msgid "multi-bit flags, aka aliases, can be returned from operations::" msgstr "" -#: ../../howto/enum.rst:1165 +#: ../../howto/enum.rst:1166 msgid "" ">>> Color.RED | Color.BLUE\n" "\n" @@ -2138,13 +2154,13 @@ msgstr "" ">>> Color(0)\n" "" -#: ../../howto/enum.rst:1174 +#: ../../howto/enum.rst:1175 msgid "" "membership / containment checking: zero-valued flags are always considered " "to be contained::" msgstr "" -#: ../../howto/enum.rst:1177 +#: ../../howto/enum.rst:1178 msgid "" ">>> Color.BLACK in Color.WHITE\n" "True" @@ -2152,13 +2168,13 @@ msgstr "" ">>> Color.BLACK in Color.WHITE\n" "True" -#: ../../howto/enum.rst:1180 +#: ../../howto/enum.rst:1181 msgid "" "otherwise, only if all bits of one flag are in the other flag will True be " "returned::" msgstr "" -#: ../../howto/enum.rst:1183 +#: ../../howto/enum.rst:1184 msgid "" ">>> Color.PURPLE in Color.WHITE\n" "True\n" @@ -2172,77 +2188,78 @@ msgstr "" ">>> Color.GREEN in Color.PURPLE\n" "False" -#: ../../howto/enum.rst:1189 +#: ../../howto/enum.rst:1190 msgid "" "There is a new boundary mechanism that controls how out-of-range / invalid " "bits are handled: ``STRICT``, ``CONFORM``, ``EJECT``, and ``KEEP``:" msgstr "" -#: ../../howto/enum.rst:1192 +#: ../../howto/enum.rst:1193 msgid "STRICT --> raises an exception when presented with invalid values" msgstr "" -#: ../../howto/enum.rst:1193 +#: ../../howto/enum.rst:1194 msgid "CONFORM --> discards any invalid bits" msgstr "" -#: ../../howto/enum.rst:1194 +#: ../../howto/enum.rst:1195 msgid "EJECT --> lose Flag status and become a normal int with the given value" msgstr "" -#: ../../howto/enum.rst:1195 +#: ../../howto/enum.rst:1196 msgid "KEEP --> keep the extra bits" msgstr "" -#: ../../howto/enum.rst:1197 +#: ../../howto/enum.rst:1198 msgid "keeps Flag status and extra bits" msgstr "" -#: ../../howto/enum.rst:1198 +#: ../../howto/enum.rst:1199 msgid "extra bits do not show up in iteration" msgstr "" -#: ../../howto/enum.rst:1199 +#: ../../howto/enum.rst:1200 msgid "extra bits do show up in repr() and str()" msgstr "" -#: ../../howto/enum.rst:1201 +#: ../../howto/enum.rst:1202 msgid "" "The default for Flag is ``STRICT``, the default for ``IntFlag`` is " "``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see ``ssl." "Options`` for an example of when ``KEEP`` is needed)." msgstr "" -#: ../../howto/enum.rst:1209 +#: ../../howto/enum.rst:1210 msgid "How are Enums and Flags different?" msgstr "" -#: ../../howto/enum.rst:1211 +#: ../../howto/enum.rst:1212 msgid "" "Enums have a custom metaclass that affects many aspects of both derived :" "class:`Enum` classes and their instances (members)." msgstr "" -#: ../../howto/enum.rst:1216 +#: ../../howto/enum.rst:1217 msgid "Enum Classes" msgstr "Enum 類別" -#: ../../howto/enum.rst:1218 +#: ../../howto/enum.rst:1219 msgid "" "The :class:`EnumType` metaclass is responsible for providing the :meth:" -"`__contains__`, :meth:`__dir__`, :meth:`__iter__` and other methods that " -"allow one to do things with an :class:`Enum` class that fail on a typical " -"class, such as ``list(Color)`` or ``some_enum_var in Color``. :class:" -"`EnumType` is responsible for ensuring that various other methods on the " -"final :class:`Enum` class are correct (such as :meth:`__new__`, :meth:" -"`__getnewargs__`, :meth:`__str__` and :meth:`__repr__`)." +"`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` " +"and other methods that allow one to do things with an :class:`Enum` class " +"that fail on a typical class, such as ``list(Color)`` or ``some_enum_var in " +"Color``. :class:`EnumType` is responsible for ensuring that various other " +"methods on the final :class:`Enum` class are correct (such as :meth:`~object." +"__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` and :meth:" +"`~object.__repr__`)." msgstr "" -#: ../../howto/enum.rst:1227 +#: ../../howto/enum.rst:1228 msgid "Flag Classes" msgstr "Flag 類別" -#: ../../howto/enum.rst:1229 +#: ../../howto/enum.rst:1230 msgid "" "Flags have an expanded view of aliasing: to be canonical, the value of a " "flag needs to be a power-of-two value, and not a duplicate name. So, in " @@ -2251,30 +2268,30 @@ msgid "" "considered an alias." msgstr "" -#: ../../howto/enum.rst:1235 +#: ../../howto/enum.rst:1236 msgid "Enum Members (aka instances)" msgstr "" -#: ../../howto/enum.rst:1237 +#: ../../howto/enum.rst:1238 msgid "" "The most interesting thing about enum members is that they are singletons. :" "class:`EnumType` creates them all while it is creating the enum class " -"itself, and then puts a custom :meth:`__new__` in place to ensure that no " -"new ones are ever instantiated by returning only the existing member " +"itself, and then puts a custom :meth:`~object.__new__` in place to ensure " +"that no new ones are ever instantiated by returning only the existing member " "instances." msgstr "" -#: ../../howto/enum.rst:1243 +#: ../../howto/enum.rst:1244 msgid "Flag Members" msgstr "Flag 成員" -#: ../../howto/enum.rst:1245 +#: ../../howto/enum.rst:1246 msgid "" "Flag members can be iterated over just like the :class:`Flag` class, and " "only the canonical members will be returned. For example::" msgstr "" -#: ../../howto/enum.rst:1248 +#: ../../howto/enum.rst:1249 msgid "" ">>> list(Color)\n" "[, , ]" @@ -2282,17 +2299,17 @@ msgstr "" ">>> list(Color)\n" "[, , ]" -#: ../../howto/enum.rst:1251 +#: ../../howto/enum.rst:1252 msgid "(Note that ``BLACK``, ``PURPLE``, and ``WHITE`` do not show up.)" msgstr "" -#: ../../howto/enum.rst:1253 +#: ../../howto/enum.rst:1254 msgid "" "Inverting a flag member returns the corresponding positive value, rather " "than a negative value --- for example::" msgstr "" -#: ../../howto/enum.rst:1256 +#: ../../howto/enum.rst:1257 msgid "" ">>> ~Color.RED\n" "" @@ -2300,13 +2317,13 @@ msgstr "" ">>> ~Color.RED\n" "" -#: ../../howto/enum.rst:1259 +#: ../../howto/enum.rst:1260 msgid "" "Flag members have a length corresponding to the number of power-of-two " "values they contain. For example::" msgstr "" -#: ../../howto/enum.rst:1262 +#: ../../howto/enum.rst:1263 msgid "" ">>> len(Color.PURPLE)\n" "2" @@ -2314,11 +2331,11 @@ msgstr "" ">>> len(Color.PURPLE)\n" "2" -#: ../../howto/enum.rst:1269 +#: ../../howto/enum.rst:1270 msgid "Enum Cookbook" msgstr "" -#: ../../howto/enum.rst:1272 +#: ../../howto/enum.rst:1273 msgid "" "While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, and :" "class:`IntFlag` are expected to cover the majority of use-cases, they cannot " @@ -2326,50 +2343,50 @@ msgid "" "that can be used directly, or as examples for creating one's own." msgstr "" -#: ../../howto/enum.rst:1279 +#: ../../howto/enum.rst:1280 msgid "Omitting values" msgstr "" -#: ../../howto/enum.rst:1281 +#: ../../howto/enum.rst:1282 msgid "" "In many use-cases, one doesn't care what the actual value of an enumeration " "is. There are several ways to define this type of simple enumeration:" msgstr "" -#: ../../howto/enum.rst:1284 +#: ../../howto/enum.rst:1285 msgid "use instances of :class:`auto` for the value" msgstr "" -#: ../../howto/enum.rst:1285 +#: ../../howto/enum.rst:1286 msgid "use instances of :class:`object` as the value" msgstr "" -#: ../../howto/enum.rst:1286 +#: ../../howto/enum.rst:1287 msgid "use a descriptive string as the value" msgstr "" -#: ../../howto/enum.rst:1287 +#: ../../howto/enum.rst:1288 msgid "" -"use a tuple as the value and a custom :meth:`__new__` to replace the tuple " -"with an :class:`int` value" +"use a tuple as the value and a custom :meth:`~object.__new__` to replace the " +"tuple with an :class:`int` value" msgstr "" -#: ../../howto/enum.rst:1290 +#: ../../howto/enum.rst:1291 msgid "" "Using any of these methods signifies to the user that these values are not " "important, and also enables one to add, remove, or reorder members without " "having to renumber the remaining members." msgstr "" -#: ../../howto/enum.rst:1296 +#: ../../howto/enum.rst:1297 msgid "Using :class:`auto`" msgstr "使用 :class:`auto`" -#: ../../howto/enum.rst:1298 +#: ../../howto/enum.rst:1299 msgid "Using :class:`auto` would look like::" msgstr "" -#: ../../howto/enum.rst:1300 +#: ../../howto/enum.rst:1301 msgid "" ">>> class Color(Enum):\n" "... RED = auto()\n" @@ -2387,15 +2404,15 @@ msgstr "" ">>> Color.GREEN\n" "" -#: ../../howto/enum.rst:1310 +#: ../../howto/enum.rst:1311 msgid "Using :class:`object`" msgstr "使用 :class:`object`" -#: ../../howto/enum.rst:1312 +#: ../../howto/enum.rst:1313 msgid "Using :class:`object` would look like::" msgstr "" -#: ../../howto/enum.rst:1314 +#: ../../howto/enum.rst:1315 msgid "" ">>> class Color(Enum):\n" "... RED = object()\n" @@ -2413,13 +2430,13 @@ msgstr "" ">>> Color.GREEN \n" ">" -#: ../../howto/enum.rst:1322 +#: ../../howto/enum.rst:1323 msgid "" "This is also a good example of why you might want to write your own :meth:" -"`__repr__`::" +"`~object.__repr__`::" msgstr "" -#: ../../howto/enum.rst:1325 +#: ../../howto/enum.rst:1326 msgid "" ">>> class Color(Enum):\n" "... RED = object()\n" @@ -2441,15 +2458,15 @@ msgstr "" ">>> Color.GREEN\n" "" -#: ../../howto/enum.rst:1338 +#: ../../howto/enum.rst:1339 msgid "Using a descriptive string" msgstr "" -#: ../../howto/enum.rst:1340 +#: ../../howto/enum.rst:1341 msgid "Using a string as the value would look like::" msgstr "" -#: ../../howto/enum.rst:1342 +#: ../../howto/enum.rst:1343 msgid "" ">>> class Color(Enum):\n" "... RED = 'stop'\n" @@ -2467,15 +2484,15 @@ msgstr "" ">>> Color.GREEN\n" "" -#: ../../howto/enum.rst:1352 -msgid "Using a custom :meth:`__new__`" +#: ../../howto/enum.rst:1353 +msgid "Using a custom :meth:`~object.__new__`" msgstr "" -#: ../../howto/enum.rst:1354 -msgid "Using an auto-numbering :meth:`__new__` would look like::" +#: ../../howto/enum.rst:1355 +msgid "Using an auto-numbering :meth:`~object.__new__` would look like::" msgstr "" -#: ../../howto/enum.rst:1356 +#: ../../howto/enum.rst:1357 msgid "" ">>> class AutoNumber(Enum):\n" "... def __new__(cls):\n" @@ -2507,13 +2524,13 @@ msgstr "" ">>> Color.GREEN\n" "" -#: ../../howto/enum.rst:1371 +#: ../../howto/enum.rst:1372 msgid "" "To make a more general purpose ``AutoNumber``, add ``*args`` to the " "signature::" msgstr "" -#: ../../howto/enum.rst:1373 +#: ../../howto/enum.rst:1374 msgid "" ">>> class AutoNumber(Enum):\n" "... def __new__(cls, *args): # this is the only change from above\n" @@ -2524,13 +2541,13 @@ msgid "" "..." msgstr "" -#: ../../howto/enum.rst:1381 +#: ../../howto/enum.rst:1382 msgid "" "Then when you inherit from ``AutoNumber`` you can write your own " "``__init__`` to handle any extra arguments::" msgstr "" -#: ../../howto/enum.rst:1384 +#: ../../howto/enum.rst:1385 msgid "" ">>> class Swatch(AutoNumber):\n" "... def __init__(self, pantone='unknown'):\n" @@ -2547,35 +2564,35 @@ msgid "" "'unknown'" msgstr "" -#: ../../howto/enum.rst:1400 +#: ../../howto/enum.rst:1401 msgid "" -"The :meth:`__new__` method, if defined, is used during creation of the Enum " -"members; it is then replaced by Enum's :meth:`__new__` which is used after " -"class creation for lookup of existing members." +"The :meth:`~object.__new__` method, if defined, is used during creation of " +"the Enum members; it is then replaced by Enum's :meth:`~object.__new__` " +"which is used after class creation for lookup of existing members." msgstr "" -#: ../../howto/enum.rst:1406 +#: ../../howto/enum.rst:1407 msgid "" "*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the " "one that is found; instead, use the data type directly -- e.g.::" msgstr "" -#: ../../howto/enum.rst:1409 +#: ../../howto/enum.rst:1410 msgid "obj = int.__new__(cls, value)" msgstr "obj = int.__new__(cls, value)" -#: ../../howto/enum.rst:1413 +#: ../../howto/enum.rst:1414 msgid "OrderedEnum" msgstr "OrderedEnum" -#: ../../howto/enum.rst:1415 +#: ../../howto/enum.rst:1416 msgid "" "An ordered enumeration that is not based on :class:`IntEnum` and so " "maintains the normal :class:`Enum` invariants (such as not being comparable " "to other enumerations)::" msgstr "" -#: ../../howto/enum.rst:1419 +#: ../../howto/enum.rst:1420 msgid "" ">>> class OrderedEnum(Enum):\n" "... def __ge__(self, other):\n" @@ -2633,17 +2650,17 @@ msgstr "" ">>> Grade.C < Grade.A\n" "True" -#: ../../howto/enum.rst:1449 +#: ../../howto/enum.rst:1450 msgid "DuplicateFreeEnum" msgstr "DuplicateFreeEnum" -#: ../../howto/enum.rst:1451 +#: ../../howto/enum.rst:1452 msgid "" "Raises an error if a duplicate member value is found instead of creating an " "alias::" msgstr "" -#: ../../howto/enum.rst:1454 +#: ../../howto/enum.rst:1455 msgid "" ">>> class DuplicateFreeEnum(Enum):\n" "... def __init__(self, *args):\n" @@ -2667,22 +2684,22 @@ msgid "" "ValueError: aliases not allowed in DuplicateFreeEnum: 'GRENE' --> 'GREEN'" msgstr "" -#: ../../howto/enum.rst:1476 +#: ../../howto/enum.rst:1477 msgid "" "This is a useful example for subclassing Enum to add or change other " "behaviors as well as disallowing aliases. If the only desired change is " "disallowing aliases, the :func:`unique` decorator can be used instead." msgstr "" -#: ../../howto/enum.rst:1482 +#: ../../howto/enum.rst:1483 msgid "MultiValueEnum" msgstr "MultiValueEnum" -#: ../../howto/enum.rst:1484 +#: ../../howto/enum.rst:1485 msgid "Supports having more than one value per member::" msgstr "" -#: ../../howto/enum.rst:1486 +#: ../../howto/enum.rst:1487 msgid "" ">>> class MultiValueEnum(Enum):\n" "... def __new__(cls, value, *values):\n" @@ -2702,17 +2719,17 @@ msgid "" "" msgstr "" -#: ../../howto/enum.rst:1505 +#: ../../howto/enum.rst:1506 msgid "Planet" msgstr "" -#: ../../howto/enum.rst:1507 +#: ../../howto/enum.rst:1508 msgid "" -"If :meth:`__new__` or :meth:`__init__` is defined, the value of the enum " -"member will be passed to those methods::" +"If :meth:`~object.__new__` or :meth:`~object.__init__` is defined, the value " +"of the enum member will be passed to those methods::" msgstr "" -#: ../../howto/enum.rst:1510 +#: ../../howto/enum.rst:1511 msgid "" ">>> class Planet(Enum):\n" "... MERCURY = (3.303e+23, 2.4397e6)\n" @@ -2738,15 +2755,15 @@ msgid "" "9.802652743337129" msgstr "" -#: ../../howto/enum.rst:1536 +#: ../../howto/enum.rst:1537 msgid "TimePeriod" msgstr "" -#: ../../howto/enum.rst:1538 -msgid "An example to show the :attr:`_ignore_` attribute in use::" +#: ../../howto/enum.rst:1539 +msgid "An example to show the :attr:`~Enum._ignore_` attribute in use::" msgstr "" -#: ../../howto/enum.rst:1540 +#: ../../howto/enum.rst:1541 msgid "" ">>> from datetime import timedelta\n" ">>> class Period(timedelta, Enum):\n" @@ -2764,11 +2781,11 @@ msgid "" "timedelta(days=366)>]" msgstr "" -#: ../../howto/enum.rst:1557 +#: ../../howto/enum.rst:1558 msgid "Subclassing EnumType" msgstr "子類別化 EnumType" -#: ../../howto/enum.rst:1559 +#: ../../howto/enum.rst:1560 msgid "" "While most enum needs can be met by customizing :class:`Enum` subclasses, " "either with class decorators or custom functions, :class:`EnumType` can be " diff --git a/howto/free-threading-extensions.po b/howto/free-threading-extensions.po index 988740ef1d..83e6596e5d 100644 --- a/howto/free-threading-extensions.po +++ b/howto/free-threading-extensions.po @@ -1,7 +1,5 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. # #, fuzzy msgid "" @@ -11,7 +9,8 @@ msgstr "" "POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/howto/free-threading-python.po b/howto/free-threading-python.po index 519f70b2e5..d2f09a2deb 100644 --- a/howto/free-threading-python.po +++ b/howto/free-threading-python.po @@ -11,7 +11,8 @@ msgstr "" "POT-Creation-Date: 2024-10-04 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/howto/isolating-extensions.po b/howto/isolating-extensions.po index b77676fcb3..9399fe584b 100644 --- a/howto/isolating-extensions.po +++ b/howto/isolating-extensions.po @@ -11,7 +11,8 @@ msgstr "" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/howto/mro.po b/howto/mro.po index ac73681c25..4b1860b886 100644 --- a/howto/mro.po +++ b/howto/mro.po @@ -10,7 +10,8 @@ msgstr "" "POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/howto/timerfd.po b/howto/timerfd.po index dd737358de..cb0dfd1ced 100644 --- a/howto/timerfd.po +++ b/howto/timerfd.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -11,7 +10,8 @@ msgstr "" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/library/aifc.po b/library/aifc.po new file mode 100644 index 0000000000..2cfcb0d41f --- /dev/null +++ b/library/aifc.po @@ -0,0 +1,39 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/aifc.rst:2 +msgid ":mod:`!aifc` --- Read and write AIFF and AIFC files" +msgstr ":mod:`!aifc` --- 讀寫 AIFF 與 AIFC 檔案" + +#: ../../library/aifc.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/aifc.rst:14 +msgid "" +"The last version of Python that provided the :mod:`!aifc` module was `Python " +"3.12 `_." +msgstr "" +"最後提供 :mod:`!aifc` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/argparse.po b/library/argparse.po index 8898a13b96..4bdf1f6631 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-31 00:13+0000\n" +"POT-Creation-Date: 2024-11-23 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1289,14 +1289,16 @@ msgstr "" msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " "overriding the :meth:`!__call__` method and optionally the :meth:`!__init__` " -"and :meth:`!format_usage` methods." +"and :meth:`!format_usage` methods. You can also register custom actions " +"using the :meth:`~ArgumentParser.register` method and reference them by " +"their registered name." msgstr "" -#: ../../library/argparse.rst:757 +#: ../../library/argparse.rst:758 msgid "An example of a custom action::" msgstr "" -#: ../../library/argparse.rst:759 +#: ../../library/argparse.rst:760 msgid "" ">>> class FooAction(argparse.Action):\n" "... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" @@ -1317,15 +1319,15 @@ msgid "" "Namespace(bar='1', foo='2')" msgstr "" -#: ../../library/argparse.rst:777 +#: ../../library/argparse.rst:778 msgid "For more details, see :class:`Action`." msgstr "更多詳情請見 :class:`Action`。" -#: ../../library/argparse.rst:783 +#: ../../library/argparse.rst:784 msgid "nargs" msgstr "nargs" -#: ../../library/argparse.rst:785 +#: ../../library/argparse.rst:786 msgid "" ":class:`ArgumentParser` objects usually associate a single command-line " "argument with a single action to be taken. The ``nargs`` keyword argument " @@ -1334,13 +1336,13 @@ msgid "" "are:" msgstr "" -#: ../../library/argparse.rst:790 +#: ../../library/argparse.rst:791 msgid "" "``N`` (an integer). ``N`` arguments from the command line will be gathered " "together into a list. For example::" msgstr "" -#: ../../library/argparse.rst:793 +#: ../../library/argparse.rst:794 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs=2)\n" @@ -1354,13 +1356,13 @@ msgstr "" ">>> parser.parse_args('c --foo a b'.split())\n" "Namespace(bar=['c'], foo=['a', 'b'])" -#: ../../library/argparse.rst:799 +#: ../../library/argparse.rst:800 msgid "" "Note that ``nargs=1`` produces a list of one item. This is different from " "the default, in which the item is produced by itself." msgstr "" -#: ../../library/argparse.rst:804 +#: ../../library/argparse.rst:805 msgid "" "``'?'``. One argument will be consumed from the command line if possible, " "and produced as a single item. If no command-line argument is present, the " @@ -1370,7 +1372,7 @@ msgid "" "produced. Some examples to illustrate this::" msgstr "" -#: ../../library/argparse.rst:811 +#: ../../library/argparse.rst:812 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" @@ -1392,13 +1394,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(bar='d', foo='d')" -#: ../../library/argparse.rst:821 +#: ../../library/argparse.rst:822 msgid "" "One of the more common uses of ``nargs='?'`` is to allow optional input and " "output files::" msgstr "" -#: ../../library/argparse.rst:824 +#: ../../library/argparse.rst:825 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', nargs='?', type=argparse.FileType('r'),\n" @@ -1424,7 +1426,7 @@ msgstr "" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>,\n" " outfile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:838 +#: ../../library/argparse.rst:839 msgid "" "``'*'``. All command-line arguments present are gathered into a list. Note " "that it generally doesn't make much sense to have more than one positional " @@ -1432,7 +1434,7 @@ msgid "" "``nargs='*'`` is possible. For example::" msgstr "" -#: ../../library/argparse.rst:843 +#: ../../library/argparse.rst:844 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='*')\n" @@ -1448,14 +1450,14 @@ msgstr "" ">>> parser.parse_args('a b --foo x y --bar 1 2'.split())\n" "Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])" -#: ../../library/argparse.rst:852 +#: ../../library/argparse.rst:853 msgid "" "``'+'``. Just like ``'*'``, all command-line args present are gathered into " "a list. Additionally, an error message will be generated if there wasn't at " "least one command-line argument present. For example::" msgstr "" -#: ../../library/argparse.rst:856 +#: ../../library/argparse.rst:857 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('foo', nargs='+')\n" @@ -1473,7 +1475,7 @@ msgstr "" "usage: PROG [-h] foo [foo ...]\n" "PROG: error: the following arguments are required: foo" -#: ../../library/argparse.rst:864 +#: ../../library/argparse.rst:865 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " @@ -1482,11 +1484,11 @@ msgid "" "``'store_const'``) set ``nargs=0``." msgstr "" -#: ../../library/argparse.rst:874 +#: ../../library/argparse.rst:875 msgid "const" msgstr "" -#: ../../library/argparse.rst:876 +#: ../../library/argparse.rst:877 msgid "" "The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to " "hold constant values that are not read from the command line but are " @@ -1494,7 +1496,7 @@ msgid "" "common uses of it are:" msgstr "" -#: ../../library/argparse.rst:880 +#: ../../library/argparse.rst:881 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='http://github.com/store_const'`` or ``action='http://github.com/append_const'``. These actions add " @@ -1504,7 +1506,7 @@ msgid "" "receive a default value of ``None``." msgstr "" -#: ../../library/argparse.rst:888 +#: ../../library/argparse.rst:889 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with option strings " "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " @@ -1514,17 +1516,17 @@ msgid "" "to be ``None`` instead. See the nargs_ description for examples." msgstr "" -#: ../../library/argparse.rst:895 +#: ../../library/argparse.rst:896 msgid "" "``const=None`` by default, including when ``action='http://github.com/append_const'`` or " "``action='http://github.com/store_const'``." msgstr "" -#: ../../library/argparse.rst:902 +#: ../../library/argparse.rst:903 msgid "default" msgstr "" -#: ../../library/argparse.rst:904 +#: ../../library/argparse.rst:905 msgid "" "All optional arguments and some positional arguments may be omitted at the " "command line. The ``default`` keyword argument of :meth:`~ArgumentParser." @@ -1534,7 +1536,7 @@ msgid "" "command line::" msgstr "" -#: ../../library/argparse.rst:911 +#: ../../library/argparse.rst:912 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1550,13 +1552,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:918 +#: ../../library/argparse.rst:919 msgid "" "If the target namespace already has an attribute set, the action *default* " "will not overwrite it::" msgstr "" -#: ../../library/argparse.rst:921 +#: ../../library/argparse.rst:922 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1568,7 +1570,7 @@ msgstr "" ">>> parser.parse_args([], namespace=argparse.Namespace(foo=101))\n" "Namespace(foo=101)" -#: ../../library/argparse.rst:926 +#: ../../library/argparse.rst:927 msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " @@ -1576,7 +1578,7 @@ msgid "" "`Namespace` return value. Otherwise, the parser uses the value as is::" msgstr "" -#: ../../library/argparse.rst:931 +#: ../../library/argparse.rst:932 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--length', default='10', type=int)\n" @@ -1590,13 +1592,13 @@ msgstr "" ">>> parser.parse_args()\n" "Namespace(length=10, width=10.5)" -#: ../../library/argparse.rst:937 +#: ../../library/argparse.rst:938 msgid "" "For positional arguments with nargs_ equal to ``?`` or ``*``, the " "``default`` value is used when no command-line argument was present::" msgstr "" -#: ../../library/argparse.rst:940 +#: ../../library/argparse.rst:941 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', nargs='?', default=42)\n" @@ -1612,20 +1614,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:947 +#: ../../library/argparse.rst:948 msgid "" "For required_ arguments, the ``default`` value is ignored. For example, this " "applies to positional arguments with nargs_ values other than ``?`` or " "``*``, or optional arguments marked as ``required=True``." msgstr "" -#: ../../library/argparse.rst:951 +#: ../../library/argparse.rst:952 msgid "" "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " "the command-line argument was not present::" msgstr "" -#: ../../library/argparse.rst:954 +#: ../../library/argparse.rst:955 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" @@ -1641,11 +1643,11 @@ msgstr "" ">>> parser.parse_args(['--foo', '1'])\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:965 +#: ../../library/argparse.rst:966 msgid "type" msgstr "" -#: ../../library/argparse.rst:967 +#: ../../library/argparse.rst:968 msgid "" "By default, the parser reads command-line arguments in as simple strings. " "However, quite often the command-line string should instead be interpreted " @@ -1654,25 +1656,26 @@ msgid "" "checking and type conversions to be performed." msgstr "" -#: ../../library/argparse.rst:973 +#: ../../library/argparse.rst:974 msgid "" "If the type_ keyword is used with the default_ keyword, the type converter " "is only applied if the default is a string." msgstr "" -#: ../../library/argparse.rst:976 +#: ../../library/argparse.rst:977 msgid "" -"The argument to ``type`` can be any callable that accepts a single string. " -"If the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" +"The argument to ``type`` can be a callable that accepts a single string or " +"the name of a registered type (see :meth:`~ArgumentParser.register`) If the " +"function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" "`ValueError`, the exception is caught and a nicely formatted error message " -"is displayed. No other exception types are handled." +"is displayed. Other exception types are not handled." msgstr "" -#: ../../library/argparse.rst:981 +#: ../../library/argparse.rst:983 msgid "Common built-in types and functions can be used as type converters:" msgstr "" -#: ../../library/argparse.rst:983 +#: ../../library/argparse.rst:985 msgid "" "import argparse\n" "import pathlib\n" @@ -1698,11 +1701,11 @@ msgstr "" "encoding='latin-1'))\n" "parser.add_argument('datapath', type=pathlib.Path)" -#: ../../library/argparse.rst:996 +#: ../../library/argparse.rst:998 msgid "User defined functions can be used as well:" msgstr "" -#: ../../library/argparse.rst:998 +#: ../../library/argparse.rst:1000 msgid "" ">>> def hyphenated(string):\n" "... return '-'.join([word[:4] for word in string.casefold().split()])\n" @@ -1720,14 +1723,14 @@ msgstr "" ">>> parser.parse_args(['\"The Tale of Two Cities\"'])\n" "Namespace(short_title='\"the-tale-of-two-citi')" -#: ../../library/argparse.rst:1008 +#: ../../library/argparse.rst:1010 msgid "" "The :func:`bool` function is not recommended as a type converter. All it " "does is convert empty strings to ``False`` and non-empty strings to " "``True``. This is usually not what is desired." msgstr "" -#: ../../library/argparse.rst:1012 +#: ../../library/argparse.rst:1014 msgid "" "In general, the ``type`` keyword is a convenience that should only be used " "for simple conversions that can only raise one of the three supported " @@ -1735,7 +1738,7 @@ msgid "" "management should be done downstream after the arguments are parsed." msgstr "" -#: ../../library/argparse.rst:1017 +#: ../../library/argparse.rst:1019 msgid "" "For example, JSON or YAML conversions have complex error cases that require " "better reporting than can be given by the ``type`` keyword. A :exc:`~json." @@ -1743,7 +1746,7 @@ msgid "" "exception would not be handled at all." msgstr "" -#: ../../library/argparse.rst:1022 +#: ../../library/argparse.rst:1024 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " "``type`` keyword. If one argument uses :class:`~argparse.FileType` and then " @@ -1753,17 +1756,17 @@ msgid "" "files." msgstr "" -#: ../../library/argparse.rst:1029 +#: ../../library/argparse.rst:1031 msgid "" "For type checkers that simply check against a fixed set of values, consider " "using the choices_ keyword instead." msgstr "" -#: ../../library/argparse.rst:1036 +#: ../../library/argparse.rst:1038 msgid "choices" msgstr "" -#: ../../library/argparse.rst:1038 +#: ../../library/argparse.rst:1040 msgid "" "Some command-line arguments should be selected from a restricted set of " "values. These can be handled by passing a sequence object as the *choices* " @@ -1772,7 +1775,7 @@ msgid "" "be displayed if the argument was not one of the acceptable values::" msgstr "" -#: ../../library/argparse.rst:1044 +#: ../../library/argparse.rst:1046 msgid "" ">>> parser = argparse.ArgumentParser(prog='game.py')\n" ">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" @@ -1792,26 +1795,26 @@ msgstr "" "game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n" "'paper', 'scissors')" -#: ../../library/argparse.rst:1053 +#: ../../library/argparse.rst:1055 msgid "" "Note that inclusion in the *choices* sequence is checked after any type_ " "conversions have been performed, so the type of the objects in the *choices* " "sequence should match the type_ specified." msgstr "" -#: ../../library/argparse.rst:1057 +#: ../../library/argparse.rst:1059 msgid "" "Any sequence can be passed as the *choices* value, so :class:`list` " "objects, :class:`tuple` objects, and custom sequences are all supported." msgstr "" -#: ../../library/argparse.rst:1060 +#: ../../library/argparse.rst:1062 msgid "" "Use of :class:`enum.Enum` is not recommended because it is difficult to " "control its appearance in usage, help, and error messages." msgstr "" -#: ../../library/argparse.rst:1063 +#: ../../library/argparse.rst:1065 msgid "" "Formatted choices override the default *metavar* which is normally derived " "from *dest*. This is usually what you want because the user never sees the " @@ -1819,11 +1822,11 @@ msgid "" "are many choices), just specify an explicit metavar_." msgstr "" -#: ../../library/argparse.rst:1072 +#: ../../library/argparse.rst:1074 msgid "required" msgstr "" -#: ../../library/argparse.rst:1074 +#: ../../library/argparse.rst:1076 msgid "" "In general, the :mod:`!argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " @@ -1831,7 +1834,7 @@ msgid "" "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: ../../library/argparse.rst:1079 +#: ../../library/argparse.rst:1081 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', required=True)\n" @@ -1849,24 +1852,24 @@ msgstr "" "usage: [-h] --foo FOO\n" ": error: the following arguments are required: --foo" -#: ../../library/argparse.rst:1087 +#: ../../library/argparse.rst:1089 msgid "" "As the example shows, if an option is marked as ``required``, :meth:" "`~ArgumentParser.parse_args` will report an error if that option is not " "present at the command line." msgstr "" -#: ../../library/argparse.rst:1093 +#: ../../library/argparse.rst:1095 msgid "" "Required options are generally considered bad form because users expect " "*options* to be *optional*, and thus they should be avoided when possible." msgstr "" -#: ../../library/argparse.rst:1100 +#: ../../library/argparse.rst:1102 msgid "help" msgstr "幫助" -#: ../../library/argparse.rst:1102 +#: ../../library/argparse.rst:1104 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " @@ -1874,7 +1877,7 @@ msgid "" "each argument." msgstr "" -#: ../../library/argparse.rst:1107 +#: ../../library/argparse.rst:1109 msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " @@ -1883,7 +1886,7 @@ msgid "" "``%(type)s``, etc.::" msgstr "" -#: ../../library/argparse.rst:1112 +#: ../../library/argparse.rst:1114 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" @@ -1909,19 +1912,19 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1124 +#: ../../library/argparse.rst:1126 msgid "" "As the help string supports %-formatting, if you want a literal ``%`` to " "appear in the help string, you must escape it as ``%%``." msgstr "" -#: ../../library/argparse.rst:1127 +#: ../../library/argparse.rst:1129 msgid "" ":mod:`!argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:1130 +#: ../../library/argparse.rst:1132 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" @@ -1939,11 +1942,11 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1142 +#: ../../library/argparse.rst:1144 msgid "metavar" msgstr "metavar" -#: ../../library/argparse.rst:1144 +#: ../../library/argparse.rst:1146 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " "refer to each expected argument. By default, :class:`!ArgumentParser` " @@ -1955,7 +1958,7 @@ msgid "" "command-line argument will be referred to as ``FOO``. An example::" msgstr "" -#: ../../library/argparse.rst:1153 +#: ../../library/argparse.rst:1155 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -1987,11 +1990,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO" -#: ../../library/argparse.rst:1168 +#: ../../library/argparse.rst:1170 msgid "An alternative name can be specified with ``metavar``::" msgstr "" -#: ../../library/argparse.rst:1170 +#: ../../library/argparse.rst:1172 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', metavar='YYY')\n" @@ -2023,21 +2026,21 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo YYY" -#: ../../library/argparse.rst:1185 +#: ../../library/argparse.rst:1187 msgid "" "Note that ``metavar`` only changes the *displayed* name - the name of the " "attribute on the :meth:`~ArgumentParser.parse_args` object is still " "determined by the dest_ value." msgstr "" -#: ../../library/argparse.rst:1189 +#: ../../library/argparse.rst:1191 msgid "" "Different values of ``nargs`` may cause the metavar to be used multiple " "times. Providing a tuple to ``metavar`` specifies a different display for " "each of the arguments::" msgstr "" -#: ../../library/argparse.rst:1193 +#: ../../library/argparse.rst:1195 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', nargs=2)\n" @@ -2061,11 +2064,11 @@ msgstr "" " -x X X\n" " --foo bar baz" -#: ../../library/argparse.rst:1208 +#: ../../library/argparse.rst:1210 msgid "dest" msgstr "dest" -#: ../../library/argparse.rst:1210 +#: ../../library/argparse.rst:1212 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " @@ -2075,7 +2078,7 @@ msgid "" "add_argument`::" msgstr "" -#: ../../library/argparse.rst:1217 +#: ../../library/argparse.rst:1219 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('bar')\n" @@ -2087,7 +2090,7 @@ msgstr "" ">>> parser.parse_args(['XXX'])\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1222 +#: ../../library/argparse.rst:1224 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " @@ -2099,7 +2102,7 @@ msgid "" "below illustrate this behavior::" msgstr "" -#: ../../library/argparse.rst:1231 +#: ../../library/argparse.rst:1233 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('-f', '--foo-bar', '--foo')\n" @@ -2117,11 +2120,11 @@ msgstr "" ">>> parser.parse_args('--foo 1 -y 2'.split())\n" "Namespace(foo_bar='1', x='2')" -#: ../../library/argparse.rst:1239 +#: ../../library/argparse.rst:1241 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" -#: ../../library/argparse.rst:1241 +#: ../../library/argparse.rst:1243 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', dest='bar')\n" @@ -2133,11 +2136,11 @@ msgstr "" ">>> parser.parse_args('--foo XXX'.split())\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1250 +#: ../../library/argparse.rst:1252 msgid "deprecated" msgstr "" -#: ../../library/argparse.rst:1252 +#: ../../library/argparse.rst:1254 msgid "" "During a project's lifetime, some arguments may need to be removed from the " "command line. Before removing them, you should inform your users that the " @@ -2148,7 +2151,7 @@ msgid "" "will be printed to :data:`sys.stderr` when the argument is used::" msgstr "" -#: ../../library/argparse.rst:1262 +#: ../../library/argparse.rst:1264 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='snake.py')\n" @@ -2168,11 +2171,11 @@ msgstr "" "snake.py: warning: option '--legs' is deprecated\n" "Namespace(legs=4)" -#: ../../library/argparse.rst:1275 +#: ../../library/argparse.rst:1277 msgid "Action classes" msgstr "" -#: ../../library/argparse.rst:1277 +#: ../../library/argparse.rst:1279 msgid "" ":class:`!Action` classes implement the Action API, a callable which returns " "a callable which processes arguments from the command-line. Any object which " @@ -2180,7 +2183,7 @@ msgid "" "`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1286 +#: ../../library/argparse.rst:1288 msgid "" ":class:`!Action` objects are used by an :class:`ArgumentParser` to represent " "the information needed to parse a single argument from one or more strings " @@ -2189,7 +2192,7 @@ msgid "" "`ArgumentParser.add_argument` except for the ``action`` itself." msgstr "" -#: ../../library/argparse.rst:1292 +#: ../../library/argparse.rst:1294 msgid "" "Instances of :class:`!Action` (or return value of any callable to the " "``action`` parameter) should have attributes :attr:`!dest`, :attr:`!" @@ -2198,46 +2201,46 @@ msgid "" "is to call :meth:`!Action.__init__`." msgstr "" -#: ../../library/argparse.rst:1300 +#: ../../library/argparse.rst:1302 msgid "" ":class:`!Action` instances should be callable, so subclasses must override " "the :meth:`!__call__` method, which should accept four parameters:" msgstr "" -#: ../../library/argparse.rst:1303 +#: ../../library/argparse.rst:1305 msgid "" "*parser* - The :class:`ArgumentParser` object which contains this action." msgstr "" -#: ../../library/argparse.rst:1305 +#: ../../library/argparse.rst:1307 msgid "" "*namespace* - The :class:`Namespace` object that will be returned by :meth:" "`~ArgumentParser.parse_args`. Most actions add an attribute to this object " "using :func:`setattr`." msgstr "" -#: ../../library/argparse.rst:1309 +#: ../../library/argparse.rst:1311 msgid "" "*values* - The associated command-line arguments, with any type conversions " "applied. Type conversions are specified with the type_ keyword argument to :" "meth:`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1313 +#: ../../library/argparse.rst:1315 msgid "" "*option_string* - The option string that was used to invoke this action. The " "``option_string`` argument is optional, and will be absent if the action is " "associated with a positional argument." msgstr "" -#: ../../library/argparse.rst:1317 +#: ../../library/argparse.rst:1319 msgid "" "The :meth:`!__call__` method may perform arbitrary actions, but will " "typically set attributes on the ``namespace`` based on ``dest`` and " "``values``." msgstr "" -#: ../../library/argparse.rst:1322 +#: ../../library/argparse.rst:1324 msgid "" ":class:`!Action` subclasses can define a :meth:`!format_usage` method that " "takes no argument and return a string which will be used when printing the " @@ -2245,47 +2248,47 @@ msgid "" "will be used." msgstr "" -#: ../../library/argparse.rst:1328 +#: ../../library/argparse.rst:1330 msgid "The parse_args() method" msgstr "parse_args() 方法" -#: ../../library/argparse.rst:1332 +#: ../../library/argparse.rst:1334 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" -#: ../../library/argparse.rst:1335 +#: ../../library/argparse.rst:1337 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " "created and how they are assigned. See the documentation for :meth:`!" "add_argument` for details." msgstr "" -#: ../../library/argparse.rst:1339 +#: ../../library/argparse.rst:1341 msgid "" "args_ - List of strings to parse. The default is taken from :data:`sys." "argv`." msgstr "" -#: ../../library/argparse.rst:1342 +#: ../../library/argparse.rst:1344 msgid "" "namespace_ - An object to take the attributes. The default is a new empty :" "class:`Namespace` object." msgstr "" -#: ../../library/argparse.rst:1347 +#: ../../library/argparse.rst:1349 msgid "Option value syntax" msgstr "" -#: ../../library/argparse.rst:1349 +#: ../../library/argparse.rst:1351 msgid "" "The :meth:`~ArgumentParser.parse_args` method supports several ways of " "specifying the value of an option (if it takes one). In the simplest case, " "the option and its value are passed as two separate arguments::" msgstr "" -#: ../../library/argparse.rst:1353 +#: ../../library/argparse.rst:1355 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2303,14 +2306,14 @@ msgstr "" ">>> parser.parse_args(['--foo', 'FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1361 +#: ../../library/argparse.rst:1363 msgid "" "For long options (options with names longer than a single character), the " "option and value can also be passed as a single command-line argument, using " "``=`` to separate them::" msgstr "" -#: ../../library/argparse.rst:1365 +#: ../../library/argparse.rst:1367 msgid "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" @@ -2318,13 +2321,13 @@ msgstr "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1368 +#: ../../library/argparse.rst:1370 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "" -#: ../../library/argparse.rst:1371 +#: ../../library/argparse.rst:1373 msgid "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" @@ -2332,13 +2335,13 @@ msgstr "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" -#: ../../library/argparse.rst:1374 +#: ../../library/argparse.rst:1376 msgid "" "Several short options can be joined together, using only a single ``-`` " "prefix, as long as only the last option (or none of them) requires a value::" msgstr "" -#: ../../library/argparse.rst:1377 +#: ../../library/argparse.rst:1379 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='http://github.com/store_true')\n" @@ -2354,11 +2357,11 @@ msgstr "" ">>> parser.parse_args(['-xyzZ'])\n" "Namespace(x=True, y=True, z='Z')" -#: ../../library/argparse.rst:1386 +#: ../../library/argparse.rst:1388 msgid "Invalid arguments" msgstr "無效引數" -#: ../../library/argparse.rst:1388 +#: ../../library/argparse.rst:1390 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " @@ -2366,7 +2369,7 @@ msgid "" "an error, it exits and prints the error along with a usage message::" msgstr "" -#: ../../library/argparse.rst:1393 +#: ../../library/argparse.rst:1395 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', type=int)\n" @@ -2388,11 +2391,11 @@ msgid "" "PROG: error: extra arguments found: badger" msgstr "" -#: ../../library/argparse.rst:1414 +#: ../../library/argparse.rst:1416 msgid "Arguments containing ``-``" msgstr "包含 ``-`` 的引數" -#: ../../library/argparse.rst:1416 +#: ../../library/argparse.rst:1418 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " @@ -2404,7 +2407,7 @@ msgid "" "negative numbers::" msgstr "" -#: ../../library/argparse.rst:1424 +#: ../../library/argparse.rst:1426 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2437,7 +2440,7 @@ msgid "" "PROG: error: argument -1: expected one argument" msgstr "" -#: ../../library/argparse.rst:1454 +#: ../../library/argparse.rst:1456 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " @@ -2445,7 +2448,7 @@ msgid "" "positional argument::" msgstr "" -#: ../../library/argparse.rst:1459 +#: ../../library/argparse.rst:1461 msgid "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" @@ -2453,24 +2456,24 @@ msgstr "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" -#: ../../library/argparse.rst:1462 +#: ../../library/argparse.rst:1464 msgid "" "See also :ref:`the argparse howto on ambiguous arguments ` for more details." msgstr "" -#: ../../library/argparse.rst:1468 +#: ../../library/argparse.rst:1470 msgid "Argument abbreviations (prefix matching)" msgstr "" -#: ../../library/argparse.rst:1470 +#: ../../library/argparse.rst:1472 msgid "" "The :meth:`~ArgumentParser.parse_args` method :ref:`by default " "` allows long options to be abbreviated to a prefix, if the " "abbreviation is unambiguous (the prefix matches a unique option)::" msgstr "" -#: ../../library/argparse.rst:1474 +#: ../../library/argparse.rst:1476 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -2494,17 +2497,17 @@ msgstr "" "usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" "PROG: error: ambiguous option: -ba could match -badger, -bacon" -#: ../../library/argparse.rst:1485 +#: ../../library/argparse.rst:1487 msgid "" "An error is produced for arguments that could produce more than one options. " "This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." msgstr "" -#: ../../library/argparse.rst:1491 +#: ../../library/argparse.rst:1493 msgid "Beyond ``sys.argv``" msgstr "" -#: ../../library/argparse.rst:1493 +#: ../../library/argparse.rst:1495 msgid "" "Sometimes it may be useful to have an :class:`ArgumentParser` parse " "arguments other than those of :data:`sys.argv`. This can be accomplished by " @@ -2512,7 +2515,7 @@ msgid "" "useful for testing at the interactive prompt::" msgstr "" -#: ../../library/argparse.rst:1498 +#: ../../library/argparse.rst:1500 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\n" @@ -2538,24 +2541,24 @@ msgstr "" ">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" "Namespace(accumulate=, integers=[1, 2, 3, 4])" -#: ../../library/argparse.rst:1513 +#: ../../library/argparse.rst:1515 msgid "The Namespace object" msgstr "命名空間物件" -#: ../../library/argparse.rst:1517 +#: ../../library/argparse.rst:1519 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." msgstr "" -#: ../../library/argparse.rst:1520 +#: ../../library/argparse.rst:1522 msgid "" "This class is deliberately simple, just an :class:`object` subclass with a " "readable string representation. If you prefer to have dict-like view of the " "attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" -#: ../../library/argparse.rst:1524 +#: ../../library/argparse.rst:1526 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2569,14 +2572,14 @@ msgstr "" ">>> vars(args)\n" "{'foo': 'BAR'}" -#: ../../library/argparse.rst:1530 +#: ../../library/argparse.rst:1532 msgid "" "It may also be useful to have an :class:`ArgumentParser` assign attributes " "to an already existing object, rather than a new :class:`Namespace` object. " "This can be achieved by specifying the ``namespace=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:1534 +#: ../../library/argparse.rst:1536 msgid "" ">>> class C:\n" "... pass\n" @@ -2598,15 +2601,15 @@ msgstr "" ">>> c.foo\n" "'BAR'" -#: ../../library/argparse.rst:1546 +#: ../../library/argparse.rst:1548 msgid "Other utilities" msgstr "" -#: ../../library/argparse.rst:1549 +#: ../../library/argparse.rst:1551 msgid "Sub-commands" msgstr "" -#: ../../library/argparse.rst:1556 +#: ../../library/argparse.rst:1558 msgid "" "Many programs split up their functionality into a number of subcommands, for " "example, the ``svn`` program can invoke subcommands like ``svn checkout``, " @@ -2621,69 +2624,69 @@ msgid "" "returns an :class:`!ArgumentParser` object that can be modified as usual." msgstr "" -#: ../../library/argparse.rst:1568 +#: ../../library/argparse.rst:1570 msgid "Description of parameters:" msgstr "參數的解釋:" -#: ../../library/argparse.rst:1570 +#: ../../library/argparse.rst:1572 msgid "" "*title* - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " "positional arguments" msgstr "" -#: ../../library/argparse.rst:1574 +#: ../../library/argparse.rst:1576 msgid "" "*description* - description for the sub-parser group in help output, by " "default ``None``" msgstr "" -#: ../../library/argparse.rst:1577 +#: ../../library/argparse.rst:1579 msgid "" "*prog* - usage information that will be displayed with sub-command help, by " "default the name of the program and any positional arguments before the " "subparser argument" msgstr "" -#: ../../library/argparse.rst:1581 +#: ../../library/argparse.rst:1583 msgid "" "*parser_class* - class which will be used to create sub-parser instances, by " "default the class of the current parser (e.g. :class:`ArgumentParser`)" msgstr "" -#: ../../library/argparse.rst:1584 +#: ../../library/argparse.rst:1586 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "" -#: ../../library/argparse.rst:1587 +#: ../../library/argparse.rst:1589 msgid "" "dest_ - name of the attribute under which sub-command name will be stored; " "by default ``None`` and no value is stored" msgstr "" -#: ../../library/argparse.rst:1590 +#: ../../library/argparse.rst:1592 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "" -#: ../../library/argparse.rst:1593 +#: ../../library/argparse.rst:1595 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" -#: ../../library/argparse.rst:1595 +#: ../../library/argparse.rst:1597 msgid "" "metavar_ - string presenting available subcommands in help; by default it is " "``None`` and presents subcommands in form {cmd1, cmd2, ..}" msgstr "" -#: ../../library/argparse.rst:1598 +#: ../../library/argparse.rst:1600 msgid "Some example usage::" msgstr "一些使用範例: ::" -#: ../../library/argparse.rst:1600 +#: ../../library/argparse.rst:1602 msgid "" ">>> # create the top-level parser\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -2706,7 +2709,7 @@ msgid "" "Namespace(baz='Z', foo=True)" msgstr "" -#: ../../library/argparse.rst:1619 +#: ../../library/argparse.rst:1621 msgid "" "Note that the object returned by :meth:`parse_args` will only contain " "attributes for the main parser and the subparser that was selected by the " @@ -2716,7 +2719,7 @@ msgid "" "``baz`` attributes are present." msgstr "" -#: ../../library/argparse.rst:1626 +#: ../../library/argparse.rst:1628 msgid "" "Similarly, when a help message is requested from a subparser, only the help " "for that particular parser will be printed. The help message will not " @@ -2725,7 +2728,7 @@ msgid "" "to :meth:`~_SubParsersAction.add_parser` as above.)" msgstr "" -#: ../../library/argparse.rst:1634 +#: ../../library/argparse.rst:1636 msgid "" ">>> parser.parse_args(['--help'])\n" "usage: PROG [-h] [--foo] {a,b} ...\n" @@ -2783,14 +2786,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --baz {X,Y,Z} baz help" -#: ../../library/argparse.rst:1662 +#: ../../library/argparse.rst:1664 msgid "" "The :meth:`add_subparsers` method also supports ``title`` and " "``description`` keyword arguments. When either is present, the subparser's " "commands will appear in their own group in the help output. For example::" msgstr "" -#: ../../library/argparse.rst:1666 +#: ../../library/argparse.rst:1668 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -2826,7 +2829,7 @@ msgstr "" "\n" " {foo,bar} additional help" -#: ../../library/argparse.rst:1683 +#: ../../library/argparse.rst:1685 msgid "" "Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional " "*aliases* argument, which allows multiple strings to refer to the same " @@ -2834,7 +2837,7 @@ msgid "" "``checkout``::" msgstr "" -#: ../../library/argparse.rst:1688 +#: ../../library/argparse.rst:1690 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -2850,13 +2853,13 @@ msgstr "" ">>> parser.parse_args(['co', 'bar'])\n" "Namespace(foo='bar')" -#: ../../library/argparse.rst:1695 +#: ../../library/argparse.rst:1697 msgid "" ":meth:`~_SubParsersAction.add_parser` supports also an additional " "*deprecated* argument, which allows to deprecate the subparser." msgstr "" -#: ../../library/argparse.rst:1709 +#: ../../library/argparse.rst:1711 msgid "" "One particularly effective way of handling subcommands is to combine the use " "of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so " @@ -2864,7 +2867,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:1714 +#: ../../library/argparse.rst:1716 msgid "" ">>> # subcommand functions\n" ">>> def foo(args):\n" @@ -2899,7 +2902,7 @@ msgid "" "((XYZYX))" msgstr "" -#: ../../library/argparse.rst:1746 +#: ../../library/argparse.rst:1748 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " @@ -2909,7 +2912,7 @@ msgid "" "argument to the :meth:`add_subparsers` call will work::" msgstr "" -#: ../../library/argparse.rst:1753 +#: ../../library/argparse.rst:1755 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" @@ -2929,15 +2932,15 @@ msgstr "" ">>> parser.parse_args(['2', 'frobble'])\n" "Namespace(subparser_name='2', y='frobble')" -#: ../../library/argparse.rst:1762 +#: ../../library/argparse.rst:1764 msgid "New *required* keyword-only parameter." msgstr "" -#: ../../library/argparse.rst:1767 +#: ../../library/argparse.rst:1769 msgid "FileType objects" msgstr "FileType 物件" -#: ../../library/argparse.rst:1771 +#: ../../library/argparse.rst:1773 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " "argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" @@ -2946,7 +2949,7 @@ msgid "" "the :func:`open` function for more details)::" msgstr "" -#: ../../library/argparse.rst:1777 +#: ../../library/argparse.rst:1779 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" @@ -2964,14 +2967,14 @@ msgstr "" "Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " "raw=<_io.FileIO name='raw.dat' mode='wb'>)" -#: ../../library/argparse.rst:1783 +#: ../../library/argparse.rst:1785 msgid "" "FileType objects understand the pseudo-argument ``'-'`` and automatically " "convert this into :data:`sys.stdin` for readable :class:`FileType` objects " "and :data:`sys.stdout` for writable :class:`FileType` objects::" msgstr "" -#: ../../library/argparse.rst:1787 +#: ../../library/argparse.rst:1789 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" @@ -2983,15 +2986,15 @@ msgstr "" ">>> parser.parse_args(['-'])\n" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1792 +#: ../../library/argparse.rst:1794 msgid "Added the *encodings* and *errors* parameters." msgstr "" -#: ../../library/argparse.rst:1797 +#: ../../library/argparse.rst:1799 msgid "Argument groups" msgstr "" -#: ../../library/argparse.rst:1802 +#: ../../library/argparse.rst:1804 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"options\" when displaying help messages. When " @@ -3000,7 +3003,7 @@ msgid "" "method::" msgstr "" -#: ../../library/argparse.rst:1808 +#: ../../library/argparse.rst:1810 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group = parser.add_argument_group('group')\n" @@ -3024,7 +3027,7 @@ msgstr "" " bar bar help\n" " --foo FOO foo help" -#: ../../library/argparse.rst:1819 +#: ../../library/argparse.rst:1821 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " "has an :meth:`~ArgumentParser.add_argument` method just like a regular :" @@ -3035,7 +3038,7 @@ msgid "" "this display::" msgstr "" -#: ../../library/argparse.rst:1827 +#: ../../library/argparse.rst:1829 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" @@ -3073,7 +3076,7 @@ msgstr "" "\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1845 +#: ../../library/argparse.rst:1847 msgid "" "The optional, keyword-only parameters argument_default_ and " "conflict_handler_ allow for finer-grained control of the behavior of the " @@ -3082,13 +3085,13 @@ msgid "" "rather than the entire parser." msgstr "" -#: ../../library/argparse.rst:1850 +#: ../../library/argparse.rst:1852 msgid "" "Note that any arguments not in your user-defined groups will end up back in " "the usual \"positional arguments\" and \"optional arguments\" sections." msgstr "" -#: ../../library/argparse.rst:1853 +#: ../../library/argparse.rst:1855 msgid "" "Calling :meth:`add_argument_group` on an argument group is deprecated. This " "feature was never supported and does not always work correctly. The function " @@ -3096,18 +3099,18 @@ msgid "" "future." msgstr "" -#: ../../library/argparse.rst:1861 +#: ../../library/argparse.rst:1863 msgid "Mutual exclusion" msgstr "" -#: ../../library/argparse.rst:1865 +#: ../../library/argparse.rst:1867 msgid "" "Create a mutually exclusive group. :mod:`!argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " "command line::" msgstr "" -#: ../../library/argparse.rst:1869 +#: ../../library/argparse.rst:1871 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -3133,14 +3136,14 @@ msgstr "" "usage: PROG [-h] [--foo | --bar]\n" "PROG: error: argument --bar: not allowed with argument --foo" -#: ../../library/argparse.rst:1881 +#: ../../library/argparse.rst:1883 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " "is required::" msgstr "" -#: ../../library/argparse.rst:1885 +#: ../../library/argparse.rst:1887 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -3158,7 +3161,7 @@ msgstr "" "usage: PROG [-h] (--foo | --bar)\n" "PROG: error: one of the arguments --foo --bar is required" -#: ../../library/argparse.rst:1893 +#: ../../library/argparse.rst:1895 msgid "" "Note that currently mutually exclusive argument groups do not support the " "*title* and *description* arguments of :meth:`~ArgumentParser." @@ -3166,7 +3169,7 @@ msgid "" "argument group that has a title and description. For example::" msgstr "" -#: ../../library/argparse.rst:1899 +#: ../../library/argparse.rst:1901 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -3202,7 +3205,7 @@ msgstr "" " --foo FOO foo help\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1916 +#: ../../library/argparse.rst:1918 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " "on a mutually exclusive group is deprecated. These features were never " @@ -3210,11 +3213,11 @@ msgid "" "by accident through inheritance and will be removed in the future." msgstr "" -#: ../../library/argparse.rst:1924 +#: ../../library/argparse.rst:1926 msgid "Parser defaults" msgstr "" -#: ../../library/argparse.rst:1928 +#: ../../library/argparse.rst:1930 msgid "" "Most of the time, the attributes of the object returned by :meth:" "`parse_args` will be fully determined by inspecting the command-line " @@ -3223,7 +3226,7 @@ msgid "" "command line to be added::" msgstr "" -#: ../../library/argparse.rst:1934 +#: ../../library/argparse.rst:1936 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -3237,12 +3240,12 @@ msgstr "" ">>> parser.parse_args(['736'])\n" "Namespace(bar=42, baz='badger', foo=736)" -#: ../../library/argparse.rst:1940 +#: ../../library/argparse.rst:1942 msgid "" "Note that parser-level defaults always override argument-level defaults::" msgstr "" -#: ../../library/argparse.rst:1942 +#: ../../library/argparse.rst:1944 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -3256,20 +3259,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo='spam')" -#: ../../library/argparse.rst:1948 +#: ../../library/argparse.rst:1950 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " "example of this type." msgstr "" -#: ../../library/argparse.rst:1954 +#: ../../library/argparse.rst:1956 msgid "" "Get the default value for a namespace attribute, as set by either :meth:" "`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" msgstr "" -#: ../../library/argparse.rst:1958 +#: ../../library/argparse.rst:1960 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" @@ -3281,54 +3284,54 @@ msgstr "" ">>> parser.get_default('foo')\n" "'badger'" -#: ../../library/argparse.rst:1965 +#: ../../library/argparse.rst:1967 msgid "Printing help" msgstr "印出幫助訊息" -#: ../../library/argparse.rst:1967 +#: ../../library/argparse.rst:1969 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " "several formatting methods are available:" msgstr "" -#: ../../library/argparse.rst:1973 +#: ../../library/argparse.rst:1975 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " "assumed." msgstr "" -#: ../../library/argparse.rst:1979 +#: ../../library/argparse.rst:1981 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " "``None``, :data:`sys.stdout` is assumed." msgstr "" -#: ../../library/argparse.rst:1983 +#: ../../library/argparse.rst:1985 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "" -#: ../../library/argparse.rst:1988 +#: ../../library/argparse.rst:1990 msgid "" "Return a string containing a brief description of how the :class:" "`ArgumentParser` should be invoked on the command line." msgstr "" -#: ../../library/argparse.rst:1993 +#: ../../library/argparse.rst:1995 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:1998 +#: ../../library/argparse.rst:2000 msgid "Partial parsing" msgstr "" -#: ../../library/argparse.rst:2002 +#: ../../library/argparse.rst:2004 msgid "" "Sometimes a script may only parse a few of the command-line arguments, " "passing the remaining arguments on to another script or program. In these " @@ -3339,7 +3342,7 @@ msgid "" "remaining argument strings." msgstr "" -#: ../../library/argparse.rst:2011 +#: ../../library/argparse.rst:2013 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/store_true')\n" @@ -3353,7 +3356,7 @@ msgstr "" ">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" -#: ../../library/argparse.rst:2018 +#: ../../library/argparse.rst:2020 msgid "" ":ref:`Prefix matching ` rules apply to :meth:" "`~ArgumentParser.parse_known_args`. The parser may consume an option even if " @@ -3361,11 +3364,11 @@ msgid "" "remaining arguments list." msgstr "" -#: ../../library/argparse.rst:2025 +#: ../../library/argparse.rst:2027 msgid "Customizing file parsing" msgstr "" -#: ../../library/argparse.rst:2029 +#: ../../library/argparse.rst:2031 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -3373,20 +3376,20 @@ msgid "" "reading." msgstr "" -#: ../../library/argparse.rst:2034 +#: ../../library/argparse.rst:2036 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " "The method is called once per line read from the argument file, in order." msgstr "" -#: ../../library/argparse.rst:2038 +#: ../../library/argparse.rst:2040 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" msgstr "" -#: ../../library/argparse.rst:2041 +#: ../../library/argparse.rst:2043 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" @@ -3396,18 +3399,18 @@ msgstr "" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" -#: ../../library/argparse.rst:2047 +#: ../../library/argparse.rst:2049 msgid "Exiting methods" msgstr "" -#: ../../library/argparse.rst:2051 +#: ../../library/argparse.rst:2053 msgid "" "This method terminates the program, exiting with the specified *status* and, " "if given, it prints a *message* to :data:`sys.stderr` before that. The user " "can override this method to handle these steps differently::" msgstr "" -#: ../../library/argparse.rst:2055 +#: ../../library/argparse.rst:2057 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -3421,17 +3424,17 @@ msgstr "" " raise Exception(f'Exiting because of an error: {message}')\n" " exit(status)" -#: ../../library/argparse.rst:2063 +#: ../../library/argparse.rst:2065 msgid "" "This method prints a usage message, including the *message*, to :data:`sys." "stderr` and terminates the program with a status code of 2." msgstr "" -#: ../../library/argparse.rst:2068 +#: ../../library/argparse.rst:2070 msgid "Intermixed parsing" msgstr "" -#: ../../library/argparse.rst:2073 +#: ../../library/argparse.rst:2075 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -3439,7 +3442,7 @@ msgid "" "parsing style." msgstr "" -#: ../../library/argparse.rst:2078 +#: ../../library/argparse.rst:2080 msgid "" "These parsers do not support all the :mod:`!argparse` features, and will " "raise exceptions if unsupported features are used. In particular, " @@ -3447,7 +3450,7 @@ msgid "" "positionals are not supported." msgstr "" -#: ../../library/argparse.rst:2083 +#: ../../library/argparse.rst:2085 msgid "" "The following example shows the difference between :meth:`~ArgumentParser." "parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " @@ -3455,7 +3458,7 @@ msgid "" "collects all the positionals into ``rest``. ::" msgstr "" -#: ../../library/argparse.rst:2089 +#: ../../library/argparse.rst:2091 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3475,7 +3478,7 @@ msgstr "" ">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" "Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" -#: ../../library/argparse.rst:2098 +#: ../../library/argparse.rst:2100 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -3483,42 +3486,83 @@ msgid "" "there are any remaining unparsed argument strings." msgstr "" -#: ../../library/argparse.rst:2107 +#: ../../library/argparse.rst:2109 +msgid "Registering custom types or actions" +msgstr "" + +#: ../../library/argparse.rst:2113 +msgid "" +"Sometimes it's desirable to use a custom string in error messages to provide " +"more user-friendly output. In these cases, :meth:`!register` can be used to " +"register custom actions or types with a parser and allow you to reference " +"the type by their registered name instead of their callable name." +msgstr "" + +#: ../../library/argparse.rst:2118 +msgid "" +"The :meth:`!register` method accepts three arguments - a *registry_name*, " +"specifying the internal registry where the object will be stored (e.g., " +"``action``, ``type``), *value*, which is the key under which the object will " +"be registered, and object, the callable to be registered." +msgstr "" + +#: ../../library/argparse.rst:2123 +msgid "" +"The following example shows how to register a custom type with a parser::" +msgstr "" + +#: ../../library/argparse.rst:2125 +msgid "" +">>> import argparse\n" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.register('type', 'hexadecimal integer', lambda s: int(s, 16))\n" +">>> parser.add_argument('--foo', type='hexadecimal integer')\n" +"_StoreAction(option_strings=['--foo'], dest='foo', nargs=None, const=None, " +"default=None, type='hexadecimal integer', choices=None, required=False, " +"help=None, metavar=None, deprecated=False)\n" +">>> parser.parse_args(['--foo', '0xFA'])\n" +"Namespace(foo=250)\n" +">>> parser.parse_args(['--foo', '1.2'])\n" +"usage: PROG [-h] [--foo FOO]\n" +"PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'" +msgstr "" + +#: ../../library/argparse.rst:2137 msgid "Exceptions" msgstr "例外" -#: ../../library/argparse.rst:2111 +#: ../../library/argparse.rst:2141 msgid "An error from creating or using an argument (optional or positional)." msgstr "" -#: ../../library/argparse.rst:2113 +#: ../../library/argparse.rst:2143 msgid "" "The string value of this exception is the message, augmented with " "information about the argument that caused it." msgstr "" -#: ../../library/argparse.rst:2118 +#: ../../library/argparse.rst:2148 msgid "" "Raised when something goes wrong converting a command line string to a type." msgstr "" -#: ../../library/argparse.rst:2122 +#: ../../library/argparse.rst:2152 msgid "Guides and Tutorials" msgstr "" -#: ../../library/argparse.rst:802 +#: ../../library/argparse.rst:803 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/argparse.rst:802 ../../library/argparse.rst:836 -#: ../../library/argparse.rst:850 +#: ../../library/argparse.rst:803 ../../library/argparse.rst:837 +#: ../../library/argparse.rst:851 msgid "in argparse module" msgstr "於 argparse 模組中" -#: ../../library/argparse.rst:836 +#: ../../library/argparse.rst:837 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/argparse.rst:850 +#: ../../library/argparse.rst:851 msgid "+ (plus)" msgstr "+ (加號)" diff --git a/library/asynchat.po b/library/asynchat.po new file mode 100644 index 0000000000..cd03892c96 --- /dev/null +++ b/library/asynchat.po @@ -0,0 +1,43 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/asynchat.rst:2 +msgid ":mod:`!asynchat` --- Asynchronous socket command/response handler" +msgstr ":mod:`!asynchat` --- 非同步 socket 指令/回應處理函式" + +#: ../../library/asynchat.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.12 ` after being deprecated in " +"Python 3.6. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.6 中被棄用,並\\ :" +"ref:`已在 Python 3.12 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/asynchat.rst:14 +msgid "Applications should use the :mod:`asyncio` module instead." +msgstr "應用程式應改用 :mod:`asyncio` 模組。" + +#: ../../library/asynchat.rst:16 +msgid "" +"The last version of Python that provided the :mod:`!asynchat` module was " +"`Python 3.11 `_." +msgstr "" +"最後提供 :mod:`!asynchat` 模組的 Python 版本是 `Python 3.11 `_。" diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index 8cb8efab1e..dba9cad94d 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-11-12 00:13+0000\n" "PO-Revision-Date: 2022-02-20 12:36+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1228,9 +1228,8 @@ msgid "" msgstr "" #: ../../library/asyncio-eventloop.rst:744 -#, fuzzy msgid "Added the *keep_alive* parameter." -msgstr "加入 *name* 參數。" +msgstr "加入 *keep_alive* 參數。" #: ../../library/asyncio-eventloop.rst:746 msgid "" @@ -1314,9 +1313,8 @@ msgstr "" "個 :class:`~pathlib.Path` 物件。" #: ../../library/asyncio-eventloop.rst:819 -#, fuzzy msgid "Added the *cleanup_socket* parameter." -msgstr "加入 *context* 參數。" +msgstr "加入 *cleanup_socket* 參數。" #: ../../library/asyncio-eventloop.rst:826 msgid "Wrap an already accepted connection into a transport/protocol pair." @@ -2506,9 +2504,8 @@ msgstr "" "躍連線)。" #: ../../library/asyncio-eventloop.rst:1657 -#, fuzzy msgid "Close all existing incoming client connections." -msgstr "代表現有傳入用戶端連線的 sockets 仍然保持開啟。" +msgstr "關閉所有現有的傳入客戶端連線。" #: ../../library/asyncio-eventloop.rst:1659 msgid "" @@ -2633,18 +2630,14 @@ msgstr "" "`ProactorEventLoop`。" #: ../../library/asyncio-eventloop.rst:1759 -#, fuzzy msgid "By default asyncio is configured to use :class:`EventLoop`." -msgstr "" -"預設情況下,asyncio 配置為在 Unix 上使用 :class:`SelectorEventLoop`,在 " -"Windows 上使用 :class:`ProactorEventLoop`。" +msgstr "預設情況下,asyncio 被配置為要使用 :class:`EventLoop`。" #: ../../library/asyncio-eventloop.rst:1764 -#, fuzzy msgid "" "A subclass of :class:`AbstractEventLoop` based on the :mod:`selectors` " "module." -msgstr "基於 :mod:`selectors` 模組的事件迴圈。" +msgstr "基於 :mod:`selectors` 模組的一個 :class:`AbstractEventLoop` 子類別。" #: ../../library/asyncio-eventloop.rst:1767 msgid "" @@ -2678,19 +2671,20 @@ msgstr "" "asyncio.set_event_loop_policy(MyPolicy())" #: ../../library/asyncio-eventloop.rst:1787 -#, fuzzy msgid "" "A subclass of :class:`AbstractEventLoop` for Windows that uses \"I/O " "Completion Ports\" (IOCP)." -msgstr "用於 Windows 的事件迴圈,使用\"I/O 完成埠\"(IOCP)。" +msgstr "" +"用於 Windows 的 :class:`AbstractEventLoop` 子類別,使用「I/O 完成埠 (IOCP, I/" +"O Completion Ports)」。" #: ../../library/asyncio-eventloop.rst:1793 msgid "" -"`MSDN documentation on I/O Completion Ports `_." +"`MSDN documentation on I/O Completion Ports `_." msgstr "" -"`I/O 完成埠(I/O Completion Ports)的 MSDN 文件 `_。" +"`I/O 完成埠的 MSDN 文件 `_。" #: ../../library/asyncio-eventloop.rst:1798 msgid "" @@ -2699,13 +2693,12 @@ msgid "" msgstr "" #: ../../library/asyncio-eventloop.rst:1801 -#, fuzzy msgid "" "It is an alias to :class:`SelectorEventLoop` on Unix and :class:" "`ProactorEventLoop` on Windows." msgstr "" -"預設情況下,asyncio 配置為在 Unix 上使用 :class:`SelectorEventLoop`,在 " -"Windows 上使用 :class:`ProactorEventLoop`。" +"在 Unix 上是 :class:`SelectorEventLoop` 的別名,在 Windows 上是 :class:" +"`ProactorEventLoop` 的別名。" #: ../../library/asyncio-eventloop.rst:1807 msgid "Abstract base class for asyncio-compliant event loops." diff --git a/library/asyncio-extending.po b/library/asyncio-extending.po index 506947aa5f..f7a1ab412f 100644 --- a/library/asyncio-extending.po +++ b/library/asyncio-extending.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -11,7 +10,8 @@ msgstr "" "POT-Creation-Date: 2023-07-29 10:36+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/library/asyncio-runner.po b/library/asyncio-runner.po index 0dd0adb9cc..4030cbdb6e 100644 --- a/library/asyncio-runner.po +++ b/library/asyncio-runner.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -11,7 +10,8 @@ msgstr "" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/library/asyncio-stream.po b/library/asyncio-stream.po index 667acc44fd..f4ca808ca4 100644 --- a/library/asyncio-stream.po +++ b/library/asyncio-stream.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-11-25 00:14+0000\n" "PO-Revision-Date: 2022-10-31 16:28+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,7 +42,7 @@ msgstr "" msgid "Here is an example of a TCP echo client written using asyncio streams::" msgstr "這是一個使用 asyncio 串流編寫的 TCP echo 客戶端範例: ::" -#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:415 +#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:419 msgid "" "import asyncio\n" "\n" @@ -110,7 +110,7 @@ msgstr "" "回傳的 *reader* 和 *writer* 物件是 :class:`StreamReader` 和 :class:" "`StreamWriter` 類別的實例。" -#: ../../library/asyncio-stream.rst:64 ../../library/asyncio-stream.rst:109 +#: ../../library/asyncio-stream.rst:64 ../../library/asyncio-stream.rst:110 msgid "" "*limit* determines the buffer size limit used by the returned :class:" "`StreamReader` instance. By default the *limit* is set to 64 KiB." @@ -124,7 +124,7 @@ msgid "" "create_connection`." msgstr "其餘的引數會直接傳遞到 :meth:`loop.create_connection`。" -#: ../../library/asyncio-stream.rst:73 ../../library/asyncio-stream.rst:147 +#: ../../library/asyncio-stream.rst:73 ../../library/asyncio-stream.rst:151 msgid "" "The *sock* argument transfers ownership of the socket to the :class:" "`StreamWriter` created. To close the socket, call its :meth:`~asyncio." @@ -139,22 +139,22 @@ msgstr "新增 *ssl_handshake_timeout* 參數。" msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." msgstr "新增 *happy_eyeballs_delay* 和 *interleave* 參數。" -#: ../../library/asyncio-stream.rst:83 ../../library/asyncio-stream.rst:125 -#: ../../library/asyncio-stream.rst:157 ../../library/asyncio-stream.rst:187 +#: ../../library/asyncio-stream.rst:83 ../../library/asyncio-stream.rst:126 +#: ../../library/asyncio-stream.rst:161 ../../library/asyncio-stream.rst:191 msgid "Removed the *loop* parameter." msgstr "移除 *loop* 參數。" -#: ../../library/asyncio-stream.rst:86 ../../library/asyncio-stream.rst:128 -#: ../../library/asyncio-stream.rst:160 ../../library/asyncio-stream.rst:190 -#: ../../library/asyncio-stream.rst:383 +#: ../../library/asyncio-stream.rst:86 ../../library/asyncio-stream.rst:129 +#: ../../library/asyncio-stream.rst:164 ../../library/asyncio-stream.rst:194 +#: ../../library/asyncio-stream.rst:387 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "新增 *ssl_shutdown_timeout* 參數。" -#: ../../library/asyncio-stream.rst:98 +#: ../../library/asyncio-stream.rst:99 msgid "Start a socket server." msgstr "啟動 socket 伺服器。" -#: ../../library/asyncio-stream.rst:100 +#: ../../library/asyncio-stream.rst:101 msgid "" "The *client_connected_cb* callback is called whenever a new client " "connection is established. It receives a ``(reader, writer)`` pair as two " @@ -165,7 +165,7 @@ msgstr "" "式會接收到一對引數 ``(reader, writer)``,分別為 :class:`StreamReader` 和 :" "class:`StreamWriter` 的實例。" -#: ../../library/asyncio-stream.rst:105 +#: ../../library/asyncio-stream.rst:106 msgid "" "*client_connected_cb* can be a plain callable or a :ref:`coroutine function " "`; if it is a coroutine function, it will be automatically " @@ -175,43 +175,47 @@ msgstr "" "ref:`協程函式 `;如果它是一個協程函式,它將自動作為 :class:`Task` " "來被排程。" -#: ../../library/asyncio-stream.rst:113 +#: ../../library/asyncio-stream.rst:114 msgid "" "The rest of the arguments are passed directly to :meth:`loop.create_server`." msgstr "剩下的引數將會直接傳遞給 :meth:`loop.create_server`。" -#: ../../library/asyncio-stream.rst:118 ../../library/asyncio-stream.rst:177 +#: ../../library/asyncio-stream.rst:119 ../../library/asyncio-stream.rst:181 msgid "" "The *sock* argument transfers ownership of the socket to the server created. " "To close the socket, call the server's :meth:`~asyncio.Server.close` method." msgstr "" -#: ../../library/asyncio-stream.rst:122 +#: ../../library/asyncio-stream.rst:123 msgid "Added the *ssl_handshake_timeout* and *start_serving* parameters." msgstr "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。" -#: ../../library/asyncio-stream.rst:133 +#: ../../library/asyncio-stream.rst:132 +msgid "Added the *keep_alive* parameter." +msgstr "新增 *keep_alive* 參數。" + +#: ../../library/asyncio-stream.rst:137 msgid "Unix Sockets" msgstr "Unix Sockets" -#: ../../library/asyncio-stream.rst:138 +#: ../../library/asyncio-stream.rst:142 msgid "" "Establish a Unix socket connection and return a pair of ``(reader, writer)``." msgstr "建立一個 Unix socket 連線並回傳一對 ``(reader, writer)``。" -#: ../../library/asyncio-stream.rst:141 +#: ../../library/asyncio-stream.rst:145 msgid "Similar to :func:`open_connection` but operates on Unix sockets." msgstr "與 :func:`open_connection` 相似,但是是操作 Unix sockets。" -#: ../../library/asyncio-stream.rst:143 +#: ../../library/asyncio-stream.rst:147 msgid "See also the documentation of :meth:`loop.create_unix_connection`." msgstr "另請參閱 :meth:`loop.create_unix_connection` 文件。" -#: ../../library/asyncio-stream.rst:151 ../../library/asyncio-stream.rst:181 +#: ../../library/asyncio-stream.rst:155 ../../library/asyncio-stream.rst:185 msgid "Availability" msgstr "" -#: ../../library/asyncio-stream.rst:153 +#: ../../library/asyncio-stream.rst:157 msgid "" "Added the *ssl_handshake_timeout* parameter. The *path* parameter can now be " "a :term:`path-like object`" @@ -219,19 +223,19 @@ msgstr "" "新增 *ssl_handshake_timeout* 參數。*path* 參數現在可以是個 :term:`path-like " "object`" -#: ../../library/asyncio-stream.rst:169 +#: ../../library/asyncio-stream.rst:173 msgid "Start a Unix socket server." msgstr "啟動一個 Unix socket 伺服器。" -#: ../../library/asyncio-stream.rst:171 +#: ../../library/asyncio-stream.rst:175 msgid "Similar to :func:`start_server` but works with Unix sockets." msgstr "與 :func:`start_server` 相似,但會是操作 Unix sockets。" -#: ../../library/asyncio-stream.rst:173 +#: ../../library/asyncio-stream.rst:177 msgid "See also the documentation of :meth:`loop.create_unix_server`." msgstr "另請參閱 :meth:`loop.create_unix_server` 文件。" -#: ../../library/asyncio-stream.rst:183 +#: ../../library/asyncio-stream.rst:187 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :term:`path-like object`." @@ -239,11 +243,11 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。*path* 參數現在可以是" "個 :term:`path-like object`。" -#: ../../library/asyncio-stream.rst:195 +#: ../../library/asyncio-stream.rst:199 msgid "StreamReader" msgstr "StreamReader" -#: ../../library/asyncio-stream.rst:199 +#: ../../library/asyncio-stream.rst:203 msgid "" "Represents a reader object that provides APIs to read data from the IO " "stream. As an :term:`asynchronous iterable`, the object supports the :" @@ -252,7 +256,7 @@ msgstr "" "表示一個有提供 API 來從 IO 串流中讀取資料的 reader 物件。作為一個 :term:" "`asynchronous iterable`,此物件支援 :keyword:`async for` 陳述式。" -#: ../../library/asyncio-stream.rst:203 +#: ../../library/asyncio-stream.rst:207 msgid "" "It is not recommended to instantiate *StreamReader* objects directly; use :" "func:`open_connection` and :func:`start_server` instead." @@ -260,15 +264,15 @@ msgstr "" "不建議直接實例化 *StreamReader* 物件;使用 :func:`open_connection` 和 :func:" "`start_server` 會是較好的做法。" -#: ../../library/asyncio-stream.rst:209 +#: ../../library/asyncio-stream.rst:213 msgid "Acknowledge the EOF." msgstr "" -#: ../../library/asyncio-stream.rst:213 +#: ../../library/asyncio-stream.rst:217 msgid "Read up to *n* bytes from the stream." msgstr "從串流中讀取至多 *n* 個位元組的資料。" -#: ../../library/asyncio-stream.rst:215 +#: ../../library/asyncio-stream.rst:219 msgid "" "If *n* is not provided or set to ``-1``, read until EOF, then return all " "read :class:`bytes`. If EOF was received and the internal buffer is empty, " @@ -278,39 +282,39 @@ msgstr "" "的 :class:`bytes`。讀取到 EOF 且內部緩衝區是空的,則回傳一個空的 ``bytes`` 物" "件。" -#: ../../library/asyncio-stream.rst:220 +#: ../../library/asyncio-stream.rst:224 msgid "If *n* is ``0``, return an empty ``bytes`` object immediately." msgstr "如果 *n* 為 ``0``,則立即回傳一個空的 ``bytes`` 物件。" -#: ../../library/asyncio-stream.rst:222 +#: ../../library/asyncio-stream.rst:226 msgid "" "If *n* is positive, return at most *n* available ``bytes`` as soon as at " "least 1 byte is available in the internal buffer. If EOF is received before " "any byte is read, return an empty ``bytes`` object." msgstr "" -#: ../../library/asyncio-stream.rst:229 +#: ../../library/asyncio-stream.rst:233 msgid "" "Read one line, where \"line\" is a sequence of bytes ending with ``\\n``." msgstr "讀取一行,其中\"行\"指的是以 ``\\n`` 結尾的位元組序列。" -#: ../../library/asyncio-stream.rst:232 +#: ../../library/asyncio-stream.rst:236 msgid "" "If EOF is received and ``\\n`` was not found, the method returns partially " "read data." msgstr "如果讀取到 EOF 而沒有找到 ``\\n``,該方法會回傳部分的已讀取資料。" -#: ../../library/asyncio-stream.rst:235 +#: ../../library/asyncio-stream.rst:239 msgid "" "If EOF is received and the internal buffer is empty, return an empty " "``bytes`` object." msgstr "如果讀取到 EOF 且內部緩衝區是空的,則回傳一個空的 ``bytes`` 物件。" -#: ../../library/asyncio-stream.rst:240 +#: ../../library/asyncio-stream.rst:244 msgid "Read exactly *n* bytes." msgstr "讀取剛好 *n* 個位元組。" -#: ../../library/asyncio-stream.rst:242 +#: ../../library/asyncio-stream.rst:246 msgid "" "Raise an :exc:`IncompleteReadError` if EOF is reached before *n* can be " "read. Use the :attr:`IncompleteReadError.partial` attribute to get the " @@ -320,11 +324,11 @@ msgstr "" "`IncompleteReadError`。使用 :attr:`IncompleteReadError.partial` 屬性來獲取串" "流結束前已讀取的部分資料。" -#: ../../library/asyncio-stream.rst:248 +#: ../../library/asyncio-stream.rst:252 msgid "Read data from the stream until *separator* is found." msgstr "從串流中持續讀取資料直到出現 *separator*。" -#: ../../library/asyncio-stream.rst:250 +#: ../../library/asyncio-stream.rst:254 msgid "" "On success, the data and separator will be removed from the internal buffer " "(consumed). Returned data will include the separator at the end." @@ -332,7 +336,7 @@ msgstr "" "成功後,資料和 separator(分隔符號)會從內部緩衝區中刪除(或者說是被消費掉 " "(consumed))。回傳的資料在末尾會有一個 separator。" -#: ../../library/asyncio-stream.rst:254 +#: ../../library/asyncio-stream.rst:258 msgid "" "If the amount of data read exceeds the configured stream limit, a :exc:" "`LimitOverrunError` exception is raised, and the data is left in the " @@ -341,7 +345,7 @@ msgstr "" "如果讀取的資料量超過了設定的串流限制,將會引發 :exc:`LimitOverrunError` 例" "外,資料將被留在內部緩衝區中,並可以再次被讀取。" -#: ../../library/asyncio-stream.rst:258 +#: ../../library/asyncio-stream.rst:262 msgid "" "If EOF is reached before the complete separator is found, an :exc:" "`IncompleteReadError` exception is raised, and the internal buffer is " @@ -352,7 +356,7 @@ msgstr "" "`IncompleteReadError` 例外,且內部緩衝區會被重置。:attr:`IncompleteReadError." "partial` 屬性可能包含一部分的 separator。" -#: ../../library/asyncio-stream.rst:263 +#: ../../library/asyncio-stream.rst:267 msgid "" "The *separator* may also be a tuple of separators. In this case the return " "value will be the shortest possible that has any separator as the suffix. " @@ -360,24 +364,24 @@ msgid "" "separator is considered to be the one that matched." msgstr "" -#: ../../library/asyncio-stream.rst:273 +#: ../../library/asyncio-stream.rst:277 msgid "The *separator* parameter may now be a :class:`tuple` of separators." -msgstr "" +msgstr "現在 *separator* 參數可以是一個分隔符號的 :class:`tuple`。" -#: ../../library/asyncio-stream.rst:278 +#: ../../library/asyncio-stream.rst:282 msgid "Return ``True`` if the buffer is empty and :meth:`feed_eof` was called." msgstr "如果緩衝區是空的且 :meth:`feed_eof` 曾被呼叫則回傳 ``True``。" -#: ../../library/asyncio-stream.rst:283 +#: ../../library/asyncio-stream.rst:287 msgid "StreamWriter" msgstr "StreamWriter" -#: ../../library/asyncio-stream.rst:287 +#: ../../library/asyncio-stream.rst:291 msgid "" "Represents a writer object that provides APIs to write data to the IO stream." msgstr "表示一個有提供 API 來將資料寫入 IO 串流的 writer 物件。" -#: ../../library/asyncio-stream.rst:290 +#: ../../library/asyncio-stream.rst:294 msgid "" "It is not recommended to instantiate *StreamWriter* objects directly; use :" "func:`open_connection` and :func:`start_server` instead." @@ -385,7 +389,7 @@ msgstr "" "不建議直接實例化 *StreamWriter* 物件;使用 :func:`open_connection` 和 :func:" "`start_server` 會是較好的做法。" -#: ../../library/asyncio-stream.rst:296 +#: ../../library/asyncio-stream.rst:300 msgid "" "The method attempts to write the *data* to the underlying socket " "immediately. If that fails, the data is queued in an internal write buffer " @@ -394,11 +398,11 @@ msgstr "" "此方法會嘗試立即將 *data* 寫入到底層的 socket。如果失敗,資料會被放到內部寫入" "緩衝中排隊等待 (queue),直到它可被發送。" -#: ../../library/asyncio-stream.rst:300 ../../library/asyncio-stream.rst:312 +#: ../../library/asyncio-stream.rst:304 ../../library/asyncio-stream.rst:316 msgid "The method should be used along with the ``drain()`` method::" msgstr "此方法應當與 ``drain()`` 方法一起使用: ::" -#: ../../library/asyncio-stream.rst:302 +#: ../../library/asyncio-stream.rst:306 msgid "" "stream.write(data)\n" "await stream.drain()" @@ -406,7 +410,7 @@ msgstr "" "stream.write(data)\n" "await stream.drain()" -#: ../../library/asyncio-stream.rst:307 +#: ../../library/asyncio-stream.rst:311 msgid "" "The method writes a list (or any iterable) of bytes to the underlying socket " "immediately. If that fails, the data is queued in an internal write buffer " @@ -415,7 +419,7 @@ msgstr "" "此方法會立即嘗試將一個位元組 list(或任何可疊代物件 (iterable))寫入到底層的 " "socket。如果失敗,資料會被放到內部寫入緩衝中排隊等待,直到它可被發送。" -#: ../../library/asyncio-stream.rst:314 +#: ../../library/asyncio-stream.rst:318 msgid "" "stream.writelines(lines)\n" "await stream.drain()" @@ -423,17 +427,17 @@ msgstr "" "stream.writelines(lines)\n" "await stream.drain()" -#: ../../library/asyncio-stream.rst:319 +#: ../../library/asyncio-stream.rst:323 msgid "The method closes the stream and the underlying socket." msgstr "此方法會關閉串流以及底層的 socket。" -#: ../../library/asyncio-stream.rst:321 +#: ../../library/asyncio-stream.rst:325 msgid "" "The method should be used, though not mandatory, along with the " "``wait_closed()`` method::" msgstr "此方法應與 ``wait_closed()`` 方法一起使用,但並非強制: ::" -#: ../../library/asyncio-stream.rst:324 +#: ../../library/asyncio-stream.rst:328 msgid "" "stream.close()\n" "await stream.wait_closed()" @@ -441,7 +445,7 @@ msgstr "" "stream.close()\n" "await stream.wait_closed()" -#: ../../library/asyncio-stream.rst:329 +#: ../../library/asyncio-stream.rst:333 msgid "" "Return ``True`` if the underlying transport supports the :meth:`write_eof` " "method, ``False`` otherwise." @@ -449,26 +453,26 @@ msgstr "" "如果底層的傳輸支援 :meth:`write_eof` 方法就回傳 ``True``,否則回傳 " "``False``。" -#: ../../library/asyncio-stream.rst:334 +#: ../../library/asyncio-stream.rst:338 msgid "" "Close the write end of the stream after the buffered write data is flushed." msgstr "在已緩衝的寫入資料被清理 (flush) 後關閉串流的寫入端。" -#: ../../library/asyncio-stream.rst:339 +#: ../../library/asyncio-stream.rst:343 msgid "Return the underlying asyncio transport." msgstr "回傳底層的 asyncio 傳輸。" -#: ../../library/asyncio-stream.rst:343 +#: ../../library/asyncio-stream.rst:347 msgid "" "Access optional transport information; see :meth:`BaseTransport." "get_extra_info` for details." msgstr "存取可選的傳輸資訊;詳情請見 :meth:`BaseTransport.get_extra_info`。" -#: ../../library/asyncio-stream.rst:348 +#: ../../library/asyncio-stream.rst:352 msgid "Wait until it is appropriate to resume writing to the stream. Example::" msgstr "等待直到可以繼續寫入到串流。範例: ::" -#: ../../library/asyncio-stream.rst:351 +#: ../../library/asyncio-stream.rst:355 msgid "" "writer.write(data)\n" "await writer.drain()" @@ -476,7 +480,7 @@ msgstr "" "writer.write(data)\n" "await writer.drain()" -#: ../../library/asyncio-stream.rst:354 +#: ../../library/asyncio-stream.rst:358 msgid "" "This is a flow control method that interacts with the underlying IO write " "buffer. When the size of the buffer reaches the high watermark, *drain()* " @@ -488,48 +492,48 @@ msgstr "" "(high watermark) 時,*drain()* 會阻塞直到緩衝區大小減少至最低標記位 (low " "watermark) 以便繼續寫入。當沒有要等待的資料時,:meth:`drain` 會立即回傳。" -#: ../../library/asyncio-stream.rst:364 +#: ../../library/asyncio-stream.rst:368 msgid "Upgrade an existing stream-based connection to TLS." -msgstr "" +msgstr "將現有的基於串流的連線升級到 TLS。" -#: ../../library/asyncio-stream.rst:366 +#: ../../library/asyncio-stream.rst:370 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-stream.rst:368 +#: ../../library/asyncio-stream.rst:372 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." -msgstr "" +msgstr "*sslcontext*:一個 :class:`~ssl.SSLContext` 的已配置實例。" -#: ../../library/asyncio-stream.rst:370 +#: ../../library/asyncio-stream.rst:374 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." -msgstr "" +msgstr "*server_hostname*:設定或覆寫將會被目標伺服器憑證比對的主機名稱。" -#: ../../library/asyncio-stream.rst:373 +#: ../../library/asyncio-stream.rst:377 msgid "" "*ssl_handshake_timeout* is the time in seconds to wait for the TLS handshake " "to complete before aborting the connection. ``60.0`` seconds if ``None`` " "(default)." msgstr "" -#: ../../library/asyncio-stream.rst:377 +#: ../../library/asyncio-stream.rst:381 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " "(default)." msgstr "" -#: ../../library/asyncio-stream.rst:389 +#: ../../library/asyncio-stream.rst:393 msgid "" "Return ``True`` if the stream is closed or in the process of being closed." msgstr "如果串流已被關閉或正在被關閉則回傳 ``True``。" -#: ../../library/asyncio-stream.rst:396 +#: ../../library/asyncio-stream.rst:400 msgid "Wait until the stream is closed." msgstr "等待直到串流被關閉。" -#: ../../library/asyncio-stream.rst:398 +#: ../../library/asyncio-stream.rst:402 msgid "" "Should be called after :meth:`close` to wait until the underlying connection " "is closed, ensuring that all data has been flushed before e.g. exiting the " @@ -538,19 +542,19 @@ msgstr "" "應當在 :meth:`close` 之後才被呼叫,這會持續等待直到底層的連線被關閉,以確保在" "這之前(例如在程式退出前)所有資料都已經被清空" -#: ../../library/asyncio-stream.rst:406 +#: ../../library/asyncio-stream.rst:410 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-stream.rst:411 +#: ../../library/asyncio-stream.rst:415 msgid "TCP echo client using streams" msgstr "使用串流的 TCP echo 客戶端" -#: ../../library/asyncio-stream.rst:413 +#: ../../library/asyncio-stream.rst:417 msgid "TCP echo client using the :func:`asyncio.open_connection` function::" msgstr "使用 :func:`asyncio.open_connection` 函式的 TCP echo 客戶端: ::" -#: ../../library/asyncio-stream.rst:437 +#: ../../library/asyncio-stream.rst:441 msgid "" "The :ref:`TCP echo client protocol " "` example uses the low-level :meth:" @@ -559,15 +563,15 @@ msgstr "" "使用低階 :meth:`loop.create_connection` 方法的 :ref:`TCP echo 客戶端協定 " "`\\ 範例。" -#: ../../library/asyncio-stream.rst:444 +#: ../../library/asyncio-stream.rst:448 msgid "TCP echo server using streams" msgstr "使用串流的 TCP echo 伺服器" -#: ../../library/asyncio-stream.rst:446 +#: ../../library/asyncio-stream.rst:450 msgid "TCP echo server using the :func:`asyncio.start_server` function::" msgstr "TCP echo 伺服器使用 :func:`asyncio.start_server` 函式: ::" -#: ../../library/asyncio-stream.rst:448 +#: ../../library/asyncio-stream.rst:452 msgid "" "import asyncio\n" "\n" @@ -627,7 +631,7 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../library/asyncio-stream.rst:480 +#: ../../library/asyncio-stream.rst:484 msgid "" "The :ref:`TCP echo server protocol " "` example uses the :meth:`loop." @@ -636,16 +640,16 @@ msgstr "" "使用 :meth:`loop.create_server` 方法的 :ref:`TCP echo 伺服器協定 " "` 範例。" -#: ../../library/asyncio-stream.rst:485 +#: ../../library/asyncio-stream.rst:489 msgid "Get HTTP headers" msgstr "獲取 HTTP 標頭" -#: ../../library/asyncio-stream.rst:487 +#: ../../library/asyncio-stream.rst:491 msgid "" "Simple example querying HTTP headers of the URL passed on the command line::" msgstr "查詢自命令列傳入之 URL 所帶有 HTTP 標頭的簡單範例: ::" -#: ../../library/asyncio-stream.rst:489 +#: ../../library/asyncio-stream.rst:493 msgid "" "import asyncio\n" "import urllib.parse\n" @@ -684,34 +688,34 @@ msgid "" "asyncio.run(print_http_headers(url))" msgstr "" -#: ../../library/asyncio-stream.rst:526 +#: ../../library/asyncio-stream.rst:530 msgid "Usage::" msgstr "用法: ::" -#: ../../library/asyncio-stream.rst:528 +#: ../../library/asyncio-stream.rst:532 msgid "python example.py http://example.com/path/page.html" msgstr "python example.py http://example.com/path/page.html" -#: ../../library/asyncio-stream.rst:530 +#: ../../library/asyncio-stream.rst:534 msgid "or with HTTPS::" msgstr "或使用 HTTPS: ::" -#: ../../library/asyncio-stream.rst:532 +#: ../../library/asyncio-stream.rst:536 msgid "python example.py https://example.com/path/page.html" msgstr "python example.py https://example.com/path/page.html" -#: ../../library/asyncio-stream.rst:538 +#: ../../library/asyncio-stream.rst:542 msgid "Register an open socket to wait for data using streams" msgstr "註冊一個使用串流來等待資料的開放 socket" -#: ../../library/asyncio-stream.rst:540 +#: ../../library/asyncio-stream.rst:544 msgid "" "Coroutine waiting until a socket receives data using the :func:" "`open_connection` function::" msgstr "" "等待直到 socket 透過使用 :func:`open_connection` 函式接收到資料的協程: ::" -#: ../../library/asyncio-stream.rst:543 +#: ../../library/asyncio-stream.rst:547 msgid "" "import asyncio\n" "import socket\n" @@ -744,7 +748,7 @@ msgid "" "asyncio.run(wait_for_data())" msgstr "" -#: ../../library/asyncio-stream.rst:575 +#: ../../library/asyncio-stream.rst:579 msgid "" "The :ref:`register an open socket to wait for data using a protocol " "` example uses a low-level protocol and " @@ -754,7 +758,7 @@ msgstr "" "`\\ 範例中,有使用了低階協定以及 :meth:" "`loop.create_connection` 方法。" -#: ../../library/asyncio-stream.rst:579 +#: ../../library/asyncio-stream.rst:583 msgid "" "The :ref:`watch a file descriptor for read events " "` example uses the low-level :meth:`loop." diff --git a/library/asyncio-sync.po b/library/asyncio-sync.po index ffee4a801a..f7068e20fe 100644 --- a/library/asyncio-sync.po +++ b/library/asyncio-sync.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # This file is distributed under the same license as the Python package. # @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-11-30 00:14+0000\n" "PO-Revision-Date: 2022-02-09 19:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -340,13 +339,12 @@ msgstr "" "``True``。" #: ../../library/asyncio-sync.rst:219 -#, fuzzy msgid "" "Wake up *n* tasks (1 by default) waiting on this condition. If fewer than " "*n* tasks are waiting they are all awakened." msgstr "" -"喚醒至多 *n* 個正在等待此條件的任務(預設為 1),如果沒有正在等待的任務則此方" -"法為空操作 (no-op)。" +"喚醒至多 *n* 個正在等待此條件的任務(預設為 1),如果少於 *n* 個任務則全部被" +"喚醒。" #: ../../library/asyncio-sync.rst:222 ../../library/asyncio-sync.rst:237 msgid "" @@ -402,8 +400,9 @@ msgstr "" #: ../../library/asyncio-sync.rst:260 msgid "" "Note that a task *may* return from this call spuriously, which is why the " -"caller should always re-check the state and be prepared to :meth:`wait` " -"again. For this reason, you may prefer to use :meth:`wait_for` instead." +"caller should always re-check the state and be prepared to :meth:`~Condition." +"wait` again. For this reason, you may prefer to use :meth:`~Condition." +"wait_for` instead." msgstr "" #: ../../library/asyncio-sync.rst:267 @@ -411,14 +410,14 @@ msgid "Wait until a predicate becomes *true*." msgstr "持續等待直到謂語 (predicate) 成為 *true*。" #: ../../library/asyncio-sync.rst:269 -#, fuzzy msgid "" "The predicate must be a callable which result will be interpreted as a " -"boolean value. The method will repeatedly :meth:`wait` until the predicate " -"evaluates to *true*. The final value is the return value." +"boolean value. The method will repeatedly :meth:`~Condition.wait` until the " +"predicate evaluates to *true*. The final value is the return value." msgstr "" -"謂語必須是一個結果可被直譯為一個 boolean 值的可呼叫物件 (callable)。最終值為" -"回傳值。" +"謂語必須是一個結果可被直譯為一個 boolean 值的可呼叫物件 (callable)。此方法會" +"重複地 :meth:`~Condition.wait` 直到謂語求值結果為 *true*。最終的值即為回傳" +"值。" #: ../../library/asyncio-sync.rst:276 msgid "Semaphore" @@ -643,8 +642,9 @@ msgstr "" #: ../../library/asyncio-sync.rst:436 msgid "" "Put the barrier into a broken state. This causes any active or future calls " -"to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use this for " -"example if one of the tasks needs to abort, to avoid infinite waiting tasks." +"to :meth:`~Barrier.wait` to fail with the :class:`BrokenBarrierError`. Use " +"this for example if one of the tasks needs to abort, to avoid infinite " +"waiting tasks." msgstr "" #: ../../library/asyncio-sync.rst:443 diff --git a/library/asyncore.po b/library/asyncore.po new file mode 100644 index 0000000000..98419d8bc4 --- /dev/null +++ b/library/asyncore.po @@ -0,0 +1,43 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/asyncore.rst:2 +msgid ":mod:`!asyncore` --- Asynchronous socket handler" +msgstr ":mod:`!asyncore` --- 非同步 socket 處理函式" + +#: ../../library/asyncore.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.12 ` after being deprecated in " +"Python 3.6. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.6 中被棄用,並\\ :" +"ref:`已在 Python 3.12 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/asyncore.rst:14 +msgid "Applications should use the :mod:`asyncio` module instead." +msgstr "應用程式應改用 :mod:`asyncio` 模組。" + +#: ../../library/asyncore.rst:16 +msgid "" +"The last version of Python that provided the :mod:`!asyncore` module was " +"`Python 3.11 `_." +msgstr "" +"最後提供 :mod:`!asyncore` 模組的 Python 版本是 `Python 3.11 `_。" diff --git a/library/audioop.po b/library/audioop.po new file mode 100644 index 0000000000..7e17882da9 --- /dev/null +++ b/library/audioop.po @@ -0,0 +1,39 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/audioop.rst:2 +msgid ":mod:`!audioop` --- Manipulate raw audio data" +msgstr ":mod:`!audioop` --- 操作原始聲音檔案" + +#: ../../library/audioop.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/audioop.rst:14 +msgid "" +"The last version of Python that provided the :mod:`!audioop` module was " +"`Python 3.12 `_." +msgstr "" +"最後提供 :mod:`!audioop` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/cgi.po b/library/cgi.po new file mode 100644 index 0000000000..5333d176a0 --- /dev/null +++ b/library/cgi.po @@ -0,0 +1,48 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/cgi.rst:2 +msgid ":mod:`!cgi` --- Common Gateway Interface support" +msgstr ":mod:`!cgi` --- 通用閘道器介面支援" + +#: ../../library/cgi.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/cgi.rst:14 +msgid "" +"A fork of the module on PyPI can be used instead: :pypi:`legacy-cgi`. This " +"is a copy of the cgi module, no longer maintained or supported by the core " +"Python team." +msgstr "" +"可以改用 PyPI 上的模組 fork::pypi:`legacy-cgi`。這是 cgi 模組的一個副本,不" +"再由 Python 核心團隊維護或支援。" + +#: ../../library/cgi.rst:18 +msgid "" +"The last version of Python that provided the :mod:`!cgi` module was `Python " +"3.12 `_." +msgstr "" +"最後提供 :mod:`!cgi` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/cgitb.po b/library/cgitb.po new file mode 100644 index 0000000000..bc357c01ba --- /dev/null +++ b/library/cgitb.po @@ -0,0 +1,48 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/cgitb.rst:2 +msgid ":mod:`!cgitb` --- Traceback manager for CGI scripts" +msgstr ":mod:`!cgitb` --- CGI 腳本的回溯管理器 (traceback manager)" + +#: ../../library/cgitb.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/cgitb.rst:14 +msgid "" +"A fork of the module on PyPI can now be used instead: :pypi:`legacy-cgi`. " +"This is a copy of the cgi module, no longer maintained or supported by the " +"core Python team." +msgstr "" +"可以改用 PyPI 上的模組 fork::pypi:`legacy-cgi`。這是 cgi 模組的一個複本,不" +"再由 Python 核心團隊維護或支援。" + +#: ../../library/cgitb.rst:18 +msgid "" +"The last version of Python that provided the :mod:`!cgitb` module was " +"`Python 3.12 `_." +msgstr "" +"最後提供 :mod:`!cgitb` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/chunk.po b/library/chunk.po new file mode 100644 index 0000000000..981361eca2 --- /dev/null +++ b/library/chunk.po @@ -0,0 +1,39 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/chunk.rst:2 +msgid ":mod:`!chunk` --- Read IFF chunked data" +msgstr ":mod:`!chunk` --- 讀取 IFF 分塊資料" + +#: ../../library/chunk.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/chunk.rst:14 +msgid "" +"The last version of Python that provided the :mod:`!chunk` module was " +"`Python 3.12 `_." +msgstr "" +"最後提供 :mod:`!chunk` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/crypt.po b/library/crypt.po new file mode 100644 index 0000000000..c8e1251bc0 --- /dev/null +++ b/library/crypt.po @@ -0,0 +1,50 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/crypt.rst:2 +msgid ":mod:`!crypt` --- Function to check Unix passwords" +msgstr ":mod:`!crypt` --- 用於檢查 Unix 密碼的函式" + +#: ../../library/crypt.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/crypt.rst:14 +msgid "" +"Applications can use the :mod:`hashlib` module from the standard library. " +"Other possible replacements are third-party libraries from PyPI: :pypi:" +"`legacycrypt`, :pypi:`bcrypt`, :pypi:`argon2-cffi`, or :pypi:`passlib`. " +"These are not supported or maintained by the Python core team." +msgstr "" +"應用程式可以改用標準函式庫中的 :mod:`hashlib` 模組。其他可能的替代方案是 " +"PyPI 上的第三方庫::pypi:`legacycrypt`、:pypi:`bcrypt`、:pypi:`argon2-cffi` " +"或 :pypi:`passlib`。這些函式庫並不受 Python 核心團隊支援或維護。" + +#: ../../library/crypt.rst:19 +msgid "" +"The last version of Python that provided the :mod:`!crypt` module was " +"`Python 3.12 `_." +msgstr "" +"最後提供 :mod:`!crypt` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/crypto.po b/library/crypto.po index fcccdac384..acdd2c02bf 100644 --- a/library/crypto.po +++ b/library/crypto.po @@ -24,14 +24,13 @@ msgid "Cryptographic Services" msgstr "加密服務" #: ../../library/crypto.rst:9 -#, fuzzy msgid "" "The modules described in this chapter implement various algorithms of a " "cryptographic nature. They are available at the discretion of the " "installation. Here's an overview:" msgstr "" -"本章所描述的模組 (module) 實作了多種加密演算法。它們可以在安裝時選擇是否一同" -"安裝。在 Unix 系統上,:mod:`crypt` 模組也有機會能夠被使用。以下為概述:" +"本章所描述的模組實作了多種加密演算法。它們可以在安裝時選擇是否一同安裝。以下" +"為概述:" #: ../../library/crypto.rst:7 msgid "cryptography" diff --git a/library/ctypes.po b/library/ctypes.po index 1ecac422b6..233c1e14ac 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-29 00:13+0000\n" +"POT-Creation-Date: 2024-11-23 00:14+0000\n" "PO-Revision-Date: 2023-04-26 02:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -376,7 +376,7 @@ msgid "" "learn more about :mod:`ctypes` data types." msgstr "" -#: ../../library/ctypes.rst:212 ../../library/ctypes.rst:2213 +#: ../../library/ctypes.rst:212 ../../library/ctypes.rst:2242 msgid "Fundamental data types" msgstr "" @@ -2497,7 +2497,7 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:1316 ../../library/ctypes.rst:1987 +#: ../../library/ctypes.rst:1316 ../../library/ctypes.rst:2002 msgid "The exact functionality is system dependent." msgstr "" @@ -2615,8 +2615,8 @@ msgid "" "determine which one is not found using Windows debugging and tracing tools." msgstr "" -#: ../../library/ctypes.rst:1388 ../../library/ctypes.rst:1411 -#: ../../library/ctypes.rst:1422 ../../library/ctypes.rst:1439 +#: ../../library/ctypes.rst:1388 ../../library/ctypes.rst:1413 +#: ../../library/ctypes.rst:1426 ../../library/ctypes.rst:1444 msgid "The *name* parameter can now be a :term:`path-like object`." msgstr "" @@ -2628,34 +2628,44 @@ msgstr "" #: ../../library/ctypes.rst:1398 msgid "" -"Windows only: Instances of this class represent loaded shared libraries, " -"functions in these libraries use the ``stdcall`` calling convention, and are " -"assumed to return the windows specific :class:`HRESULT` code. :class:" -"`HRESULT` values contain information specifying whether the function call " -"failed or succeeded, together with additional error code. If the return " -"value signals a failure, an :class:`OSError` is automatically raised." +"Instances of this class represent loaded shared libraries, functions in " +"these libraries use the ``stdcall`` calling convention, and are assumed to " +"return the windows specific :class:`HRESULT` code. :class:`HRESULT` values " +"contain information specifying whether the function call failed or " +"succeeded, together with additional error code. If the return value signals " +"a failure, an :class:`OSError` is automatically raised." msgstr "" -#: ../../library/ctypes.rst:1405 +#: ../../library/ctypes.rst:1405 ../../library/ctypes.rst:1422 +#: ../../library/ctypes.rst:1566 ../../library/ctypes.rst:1574 +#: ../../library/ctypes.rst:1751 ../../library/ctypes.rst:1982 +#: ../../library/ctypes.rst:1991 ../../library/ctypes.rst:2016 +#: ../../library/ctypes.rst:2025 ../../library/ctypes.rst:2034 +#: ../../library/ctypes.rst:2049 ../../library/ctypes.rst:2106 +#: ../../library/ctypes.rst:2134 ../../library/ctypes.rst:2478 +msgid "Availability" +msgstr "" + +#: ../../library/ctypes.rst:1407 msgid "" ":exc:`WindowsError` used to be raised, which is now an alias of :exc:" "`OSError`." msgstr "" -#: ../../library/ctypes.rst:1416 +#: ../../library/ctypes.rst:1418 msgid "" -"Windows only: Instances of this class represent loaded shared libraries, " -"functions in these libraries use the ``stdcall`` calling convention, and are " -"assumed to return :c:expr:`int` by default." +"Instances of this class represent loaded shared libraries, functions in " +"these libraries use the ``stdcall`` calling convention, and are assumed to " +"return :c:expr:`int` by default." msgstr "" -#: ../../library/ctypes.rst:1424 +#: ../../library/ctypes.rst:1429 msgid "" "The Python :term:`global interpreter lock` is released before calling any " "function exported by these libraries, and reacquired afterwards." msgstr "" -#: ../../library/ctypes.rst:1430 +#: ../../library/ctypes.rst:1435 msgid "" "Instances of this class behave like :class:`CDLL` instances, except that the " "Python GIL is *not* released during the function call, and after the " @@ -2663,11 +2673,11 @@ msgid "" "set, a Python exception is raised." msgstr "" -#: ../../library/ctypes.rst:1435 +#: ../../library/ctypes.rst:1440 msgid "Thus, this is only useful to call Python C api functions directly." msgstr "" -#: ../../library/ctypes.rst:1441 +#: ../../library/ctypes.rst:1446 msgid "" "All these classes can be instantiated by calling them with at least one " "argument, the pathname of the shared library. If you have an existing " @@ -2677,7 +2687,7 @@ msgid "" "the process, and to get a handle to it." msgstr "" -#: ../../library/ctypes.rst:1448 +#: ../../library/ctypes.rst:1453 msgid "" "The *mode* parameter can be used to specify how the library is loaded. For " "details, consult the :manpage:`dlopen(3)` manpage. On Windows, *mode* is " @@ -2685,7 +2695,7 @@ msgid "" "configurable." msgstr "" -#: ../../library/ctypes.rst:1453 +#: ../../library/ctypes.rst:1458 msgid "" "The *use_errno* parameter, when set to true, enables a ctypes mechanism that " "allows accessing the system :data:`errno` error number in a safe way. :mod:" @@ -2695,14 +2705,14 @@ msgid "" "private copy, the same happens immediately after the function call." msgstr "" -#: ../../library/ctypes.rst:1460 +#: ../../library/ctypes.rst:1465 msgid "" "The function :func:`ctypes.get_errno` returns the value of the ctypes " "private copy, and the function :func:`ctypes.set_errno` changes the ctypes " "private copy to a new value and returns the former value." msgstr "" -#: ../../library/ctypes.rst:1464 +#: ../../library/ctypes.rst:1469 msgid "" "The *use_last_error* parameter, when set to true, enables the same mechanism " "for the Windows error code which is managed by the :func:`GetLastError` and :" @@ -2711,7 +2721,7 @@ msgid "" "private copy of the windows error code." msgstr "" -#: ../../library/ctypes.rst:1470 +#: ../../library/ctypes.rst:1475 msgid "" "The *winmode* parameter is used on Windows to specify how the library is " "loaded (since *mode* is ignored). It takes any value that is valid for the " @@ -2721,29 +2731,29 @@ msgid "" "ensure the correct library and dependencies are loaded." msgstr "" -#: ../../library/ctypes.rst:1477 +#: ../../library/ctypes.rst:1482 msgid "Added *winmode* parameter." msgstr "新增 *winmode* 參數。" -#: ../../library/ctypes.rst:1484 +#: ../../library/ctypes.rst:1489 msgid "" "Flag to use as *mode* parameter. On platforms where this flag is not " "available, it is defined as the integer zero." msgstr "" -#: ../../library/ctypes.rst:1491 +#: ../../library/ctypes.rst:1496 msgid "" "Flag to use as *mode* parameter. On platforms where this is not available, " "it is the same as *RTLD_GLOBAL*." msgstr "" -#: ../../library/ctypes.rst:1498 +#: ../../library/ctypes.rst:1503 msgid "" "The default mode which is used to load shared libraries. On OSX 10.3, this " "is *RTLD_GLOBAL*, otherwise it is the same as *RTLD_LOCAL*." msgstr "" -#: ../../library/ctypes.rst:1501 +#: ../../library/ctypes.rst:1506 msgid "" "Instances of these classes have no public methods. Functions exported by " "the shared library can be accessed as attributes or by index. Please note " @@ -2752,7 +2762,7 @@ msgid "" "other hand, accessing it through an index returns a new object each time::" msgstr "" -#: ../../library/ctypes.rst:1507 +#: ../../library/ctypes.rst:1512 msgid "" ">>> from ctypes import CDLL\n" ">>> libc = CDLL(\"libc.so.6\") # On Linux\n" @@ -2768,21 +2778,21 @@ msgstr "" ">>> libc['time'] == libc['time']\n" "False" -#: ../../library/ctypes.rst:1514 +#: ../../library/ctypes.rst:1519 msgid "" "The following public attributes are available, their name starts with an " "underscore to not clash with exported function names:" msgstr "" -#: ../../library/ctypes.rst:1520 +#: ../../library/ctypes.rst:1525 msgid "The system handle used to access the library." msgstr "" -#: ../../library/ctypes.rst:1525 +#: ../../library/ctypes.rst:1530 msgid "The name of the library passed in the constructor." msgstr "" -#: ../../library/ctypes.rst:1527 +#: ../../library/ctypes.rst:1532 msgid "" "Shared libraries can also be loaded by using one of the prefabricated " "objects, which are instances of the :class:`LibraryLoader` class, either by " @@ -2790,13 +2800,13 @@ msgid "" "library as attribute of the loader instance." msgstr "" -#: ../../library/ctypes.rst:1535 +#: ../../library/ctypes.rst:1540 msgid "" "Class which loads shared libraries. *dlltype* should be one of the :class:" "`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." msgstr "" -#: ../../library/ctypes.rst:1538 +#: ../../library/ctypes.rst:1543 msgid "" ":meth:`!__getattr__` has special behavior: It allows loading a shared " "library by accessing it as attribute of a library loader instance. The " @@ -2804,39 +2814,39 @@ msgid "" "each time." msgstr "" -#: ../../library/ctypes.rst:1544 +#: ../../library/ctypes.rst:1549 msgid "" "Load a shared library into the process and return it. This method always " "returns a new instance of the library." msgstr "" -#: ../../library/ctypes.rst:1548 +#: ../../library/ctypes.rst:1553 msgid "These prefabricated library loaders are available:" msgstr "" -#: ../../library/ctypes.rst:1553 +#: ../../library/ctypes.rst:1558 msgid "Creates :class:`CDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1559 -msgid "Windows only: Creates :class:`WinDLL` instances." +#: ../../library/ctypes.rst:1564 +msgid "Creates :class:`WinDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1565 -msgid "Windows only: Creates :class:`OleDLL` instances." +#: ../../library/ctypes.rst:1572 +msgid "Creates :class:`OleDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1571 +#: ../../library/ctypes.rst:1580 msgid "Creates :class:`PyDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1574 +#: ../../library/ctypes.rst:1583 msgid "" "For accessing the C Python api directly, a ready-to-use Python shared " "library object is available:" msgstr "" -#: ../../library/ctypes.rst:1580 +#: ../../library/ctypes.rst:1589 msgid "" "An instance of :class:`PyDLL` that exposes Python C API functions as " "attributes. Note that all these functions are assumed to return C :c:expr:" @@ -2844,32 +2854,32 @@ msgid "" "correct :attr:`!restype` attribute to use these functions." msgstr "" -#: ../../library/ctypes.rst:1585 ../../library/ctypes.rst:1587 +#: ../../library/ctypes.rst:1594 ../../library/ctypes.rst:1596 msgid "" "Loading a library through any of these objects raises an :ref:`auditing " "event ` ``ctypes.dlopen`` with string argument ``name``, the name " "used to load the library." msgstr "" -#: ../../library/ctypes.rst:1591 ../../library/ctypes.rst:1593 +#: ../../library/ctypes.rst:1600 ../../library/ctypes.rst:1602 msgid "" "Accessing a function on a loaded library raises an auditing event ``ctypes." "dlsym`` with arguments ``library`` (the library object) and ``name`` (the " "symbol's name as a string or integer)." msgstr "" -#: ../../library/ctypes.rst:1597 ../../library/ctypes.rst:1599 +#: ../../library/ctypes.rst:1606 ../../library/ctypes.rst:1608 msgid "" "In cases when only the library handle is available rather than the object, " "accessing a function raises an auditing event ``ctypes.dlsym/handle`` with " "arguments ``handle`` (the raw library handle) and ``name``." msgstr "" -#: ../../library/ctypes.rst:1606 +#: ../../library/ctypes.rst:1615 msgid "Foreign functions" msgstr "" -#: ../../library/ctypes.rst:1608 +#: ../../library/ctypes.rst:1617 msgid "" "As explained in the previous section, foreign functions can be accessed as " "attributes of loaded shared libraries. The function objects created in this " @@ -2878,13 +2888,13 @@ msgid "" "library loader." msgstr "" -#: ../../library/ctypes.rst:1613 +#: ../../library/ctypes.rst:1622 msgid "" "They are instances of a private local class :class:`!_FuncPtr` (not exposed " "in :mod:`!ctypes`) which inherits from the private :class:`_CFuncPtr` class:" msgstr "" -#: ../../library/ctypes.rst:1616 +#: ../../library/ctypes.rst:1625 msgid "" ">>> import ctypes\n" ">>> lib = ctypes.CDLL(None)\n" @@ -2894,29 +2904,29 @@ msgid "" "False" msgstr "" -#: ../../library/ctypes.rst:1627 +#: ../../library/ctypes.rst:1636 msgid "Base class for C callable foreign functions." msgstr "" -#: ../../library/ctypes.rst:1629 +#: ../../library/ctypes.rst:1638 msgid "" "Instances of foreign functions are also C compatible data types; they " "represent C function pointers." msgstr "" -#: ../../library/ctypes.rst:1632 +#: ../../library/ctypes.rst:1641 msgid "" "This behavior can be customized by assigning to special attributes of the " "foreign function object." msgstr "" -#: ../../library/ctypes.rst:1637 +#: ../../library/ctypes.rst:1646 msgid "" "Assign a ctypes type to specify the result type of the foreign function. Use " "``None`` for :c:expr:`void`, a function not returning anything." msgstr "" -#: ../../library/ctypes.rst:1640 +#: ../../library/ctypes.rst:1649 msgid "" "It is possible to assign a callable Python object that is not a ctypes type, " "in this case the function is assumed to return a C :c:expr:`int`, and the " @@ -2926,7 +2936,7 @@ msgid "" "callable to the :attr:`errcheck` attribute." msgstr "" -#: ../../library/ctypes.rst:1649 +#: ../../library/ctypes.rst:1658 msgid "" "Assign a tuple of ctypes types to specify the argument types that the " "function accepts. Functions using the ``stdcall`` calling convention can " @@ -2935,7 +2945,7 @@ msgid "" "unspecified arguments as well." msgstr "" -#: ../../library/ctypes.rst:1655 +#: ../../library/ctypes.rst:1664 msgid "" "When a foreign function is called, each actual argument is passed to the :" "meth:`~_CData.from_param` class method of the items in the :attr:`argtypes` " @@ -2945,7 +2955,7 @@ msgid "" "object using ctypes conversion rules." msgstr "" -#: ../../library/ctypes.rst:1662 +#: ../../library/ctypes.rst:1671 msgid "" "New: It is now possible to put items in argtypes which are not ctypes types, " "but each item must have a :meth:`~_CData.from_param` method which returns a " @@ -2953,44 +2963,44 @@ msgid "" "defining adapters that can adapt custom objects as function parameters." msgstr "" -#: ../../library/ctypes.rst:1669 +#: ../../library/ctypes.rst:1678 msgid "" "Assign a Python function or another callable to this attribute. The callable " "will be called with three or more arguments:" msgstr "" -#: ../../library/ctypes.rst:1676 +#: ../../library/ctypes.rst:1685 msgid "" "*result* is what the foreign function returns, as specified by the :attr:`!" "restype` attribute." msgstr "" -#: ../../library/ctypes.rst:1679 +#: ../../library/ctypes.rst:1688 msgid "" "*func* is the foreign function object itself, this allows reusing the same " "callable object to check or post process the results of several functions." msgstr "" -#: ../../library/ctypes.rst:1683 +#: ../../library/ctypes.rst:1692 msgid "" "*arguments* is a tuple containing the parameters originally passed to the " "function call, this allows specializing the behavior on the arguments used." msgstr "" -#: ../../library/ctypes.rst:1687 +#: ../../library/ctypes.rst:1696 msgid "" "The object that this function returns will be returned from the foreign " "function call, but it can also check the result value and raise an exception " "if the foreign function call failed." msgstr "" -#: ../../library/ctypes.rst:1694 +#: ../../library/ctypes.rst:1703 msgid "" "This exception is raised when a foreign function call cannot convert one of " "the passed arguments." msgstr "" -#: ../../library/ctypes.rst:1698 ../../library/ctypes.rst:1700 +#: ../../library/ctypes.rst:1707 ../../library/ctypes.rst:1709 msgid "" "On Windows, when a foreign function call raises a system exception (for " "example, due to an access violation), it will be captured and replaced with " @@ -2999,18 +3009,18 @@ msgid "" "hook to replace the exception with its own." msgstr "" -#: ../../library/ctypes.rst:1706 ../../library/ctypes.rst:1708 +#: ../../library/ctypes.rst:1715 ../../library/ctypes.rst:1717 msgid "" "Some ways to invoke foreign function calls may raise an auditing event " "``ctypes.call_function`` with arguments ``function pointer`` and " "``arguments``." msgstr "" -#: ../../library/ctypes.rst:1714 +#: ../../library/ctypes.rst:1723 msgid "Function prototypes" msgstr "" -#: ../../library/ctypes.rst:1716 +#: ../../library/ctypes.rst:1725 msgid "" "Foreign functions can also be created by instantiating function prototypes. " "Function prototypes are similar to function prototypes in C; they describe a " @@ -3021,7 +3031,7 @@ msgid "" "``@wrapper`` syntax. See :ref:`ctypes-callback-functions` for examples." msgstr "" -#: ../../library/ctypes.rst:1727 +#: ../../library/ctypes.rst:1736 msgid "" "The returned function prototype creates functions that use the standard C " "calling convention. The function will release the GIL during the call. If " @@ -3030,37 +3040,37 @@ msgid "" "after the call; *use_last_error* does the same for the Windows error code." msgstr "" -#: ../../library/ctypes.rst:1737 +#: ../../library/ctypes.rst:1746 msgid "" -"Windows only: The returned function prototype creates functions that use the " -"``stdcall`` calling convention. The function will release the GIL during " -"the call. *use_errno* and *use_last_error* have the same meaning as above." +"The returned function prototype creates functions that use the ``stdcall`` " +"calling convention. The function will release the GIL during the call. " +"*use_errno* and *use_last_error* have the same meaning as above." msgstr "" -#: ../../library/ctypes.rst:1745 +#: ../../library/ctypes.rst:1756 msgid "" "The returned function prototype creates functions that use the Python " "calling convention. The function will *not* release the GIL during the call." msgstr "" -#: ../../library/ctypes.rst:1748 +#: ../../library/ctypes.rst:1759 msgid "" "Function prototypes created by these factory functions can be instantiated " "in different ways, depending on the type and number of the parameters in the " "call:" msgstr "" -#: ../../library/ctypes.rst:1755 +#: ../../library/ctypes.rst:1766 msgid "" "Returns a foreign function at the specified address which must be an integer." msgstr "" -#: ../../library/ctypes.rst:1762 +#: ../../library/ctypes.rst:1773 msgid "" "Create a C callable function (a callback function) from a Python *callable*." msgstr "" -#: ../../library/ctypes.rst:1769 +#: ../../library/ctypes.rst:1780 msgid "" "Returns a foreign function exported by a shared library. *func_spec* must be " "a 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the " @@ -3068,7 +3078,7 @@ msgid "" "small integer. The second item is the shared library instance." msgstr "" -#: ../../library/ctypes.rst:1779 +#: ../../library/ctypes.rst:1790 msgid "" "Returns a foreign function that will call a COM method. *vtbl_index* is the " "index into the virtual function table, a small non-negative integer. *name* " @@ -3076,79 +3086,79 @@ msgid "" "identifier which is used in extended error reporting." msgstr "" -#: ../../library/ctypes.rst:1784 +#: ../../library/ctypes.rst:1795 msgid "" "COM methods use a special calling convention: They require a pointer to the " "COM interface as first argument, in addition to those parameters that are " "specified in the :attr:`!argtypes` tuple." msgstr "" -#: ../../library/ctypes.rst:1788 +#: ../../library/ctypes.rst:1799 msgid "" "The optional *paramflags* parameter creates foreign function wrappers with " "much more functionality than the features described above." msgstr "" -#: ../../library/ctypes.rst:1791 +#: ../../library/ctypes.rst:1802 msgid "" "*paramflags* must be a tuple of the same length as :attr:`~_CFuncPtr." "argtypes`." msgstr "" -#: ../../library/ctypes.rst:1793 +#: ../../library/ctypes.rst:1804 msgid "" "Each item in this tuple contains further information about a parameter, it " "must be a tuple containing one, two, or three items." msgstr "" -#: ../../library/ctypes.rst:1796 +#: ../../library/ctypes.rst:1807 msgid "" "The first item is an integer containing a combination of direction flags for " "the parameter:" msgstr "" -#: ../../library/ctypes.rst:1799 +#: ../../library/ctypes.rst:1810 msgid "1" msgstr "1" -#: ../../library/ctypes.rst:1800 +#: ../../library/ctypes.rst:1811 msgid "Specifies an input parameter to the function." msgstr "" -#: ../../library/ctypes.rst:1802 +#: ../../library/ctypes.rst:1813 msgid "2" msgstr "2" -#: ../../library/ctypes.rst:1803 +#: ../../library/ctypes.rst:1814 msgid "Output parameter. The foreign function fills in a value." msgstr "" -#: ../../library/ctypes.rst:1805 +#: ../../library/ctypes.rst:1816 msgid "4" msgstr "4" -#: ../../library/ctypes.rst:1806 +#: ../../library/ctypes.rst:1817 msgid "Input parameter which defaults to the integer zero." msgstr "" -#: ../../library/ctypes.rst:1808 +#: ../../library/ctypes.rst:1819 msgid "" "The optional second item is the parameter name as string. If this is " "specified, the foreign function can be called with named parameters." msgstr "" -#: ../../library/ctypes.rst:1811 +#: ../../library/ctypes.rst:1822 msgid "The optional third item is the default value for this parameter." msgstr "" -#: ../../library/ctypes.rst:1814 +#: ../../library/ctypes.rst:1825 msgid "" "The following example demonstrates how to wrap the Windows ``MessageBoxW`` " "function so that it supports default parameters and named arguments. The C " "declaration from the windows header file is this::" msgstr "" -#: ../../library/ctypes.rst:1818 +#: ../../library/ctypes.rst:1829 msgid "" "WINUSERAPI int WINAPI\n" "MessageBoxW(\n" @@ -3164,11 +3174,11 @@ msgstr "" " LPCWSTR lpCaption,\n" " UINT uType);" -#: ../../library/ctypes.rst:1825 ../../library/ctypes.rst:1848 +#: ../../library/ctypes.rst:1836 ../../library/ctypes.rst:1859 msgid "Here is the wrapping with :mod:`ctypes`::" msgstr "" -#: ../../library/ctypes.rst:1827 +#: ../../library/ctypes.rst:1838 msgid "" ">>> from ctypes import c_int, WINFUNCTYPE, windll\n" ">>> from ctypes.wintypes import HWND, LPCWSTR, UINT\n" @@ -3184,11 +3194,11 @@ msgstr "" "\"Hello from ctypes\"), (1, \"flags\", 0)\n" ">>> MessageBox = prototype((\"MessageBoxW\", windll.user32), paramflags)" -#: ../../library/ctypes.rst:1833 +#: ../../library/ctypes.rst:1844 msgid "The ``MessageBox`` foreign function can now be called in these ways::" msgstr "" -#: ../../library/ctypes.rst:1835 +#: ../../library/ctypes.rst:1846 msgid "" ">>> MessageBox()\n" ">>> MessageBox(text=\"Spam, spam, spam\")\n" @@ -3198,7 +3208,7 @@ msgstr "" ">>> MessageBox(text=\"Spam, spam, spam\")\n" ">>> MessageBox(flags=2, text=\"foo bar\")" -#: ../../library/ctypes.rst:1839 +#: ../../library/ctypes.rst:1850 msgid "" "A second example demonstrates output parameters. The win32 " "``GetWindowRect`` function retrieves the dimensions of a specified window by " @@ -3206,7 +3216,7 @@ msgid "" "the C declaration::" msgstr "" -#: ../../library/ctypes.rst:1843 +#: ../../library/ctypes.rst:1854 msgid "" "WINUSERAPI BOOL WINAPI\n" "GetWindowRect(\n" @@ -3218,7 +3228,7 @@ msgstr "" " HWND hWnd,\n" " LPRECT lpRect);" -#: ../../library/ctypes.rst:1850 +#: ../../library/ctypes.rst:1861 msgid "" ">>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError\n" ">>> from ctypes.wintypes import BOOL, HWND, RECT\n" @@ -3236,7 +3246,7 @@ msgstr "" "paramflags)\n" ">>>" -#: ../../library/ctypes.rst:1857 +#: ../../library/ctypes.rst:1868 msgid "" "Functions with output parameters will automatically return the output " "parameter value if there is a single one, or a tuple containing the output " @@ -3244,7 +3254,7 @@ msgid "" "now returns a RECT instance, when called." msgstr "" -#: ../../library/ctypes.rst:1862 +#: ../../library/ctypes.rst:1873 msgid "" "Output parameters can be combined with the :attr:`~_CFuncPtr.errcheck` " "protocol to do further output processing and error checking. The win32 " @@ -3253,7 +3263,7 @@ msgid "" "exception when the api call failed::" msgstr "" -#: ../../library/ctypes.rst:1867 +#: ../../library/ctypes.rst:1878 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3271,7 +3281,7 @@ msgstr "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" -#: ../../library/ctypes.rst:1875 +#: ../../library/ctypes.rst:1886 msgid "" "If the :attr:`~_CFuncPtr.errcheck` function returns the argument tuple it " "receives unchanged, :mod:`ctypes` continues the normal processing it does on " @@ -3280,7 +3290,7 @@ msgid "" "and return them instead, the normal processing will no longer take place::" msgstr "" -#: ../../library/ctypes.rst:1881 +#: ../../library/ctypes.rst:1892 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3300,17 +3310,17 @@ msgstr "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" -#: ../../library/ctypes.rst:1894 +#: ../../library/ctypes.rst:1905 msgid "Utility functions" msgstr "" -#: ../../library/ctypes.rst:1898 +#: ../../library/ctypes.rst:1909 msgid "" "Returns the address of the memory buffer as integer. *obj* must be an " "instance of a ctypes type." msgstr "" -#: ../../library/ctypes.rst:1901 +#: ../../library/ctypes.rst:1912 msgid "" "Raises an :ref:`auditing event ` ``ctypes.addressof`` with " "argument ``obj``." @@ -3318,34 +3328,34 @@ msgstr "" "引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` ``ctypes." "addressof``。" -#: ../../library/ctypes.rst:1906 +#: ../../library/ctypes.rst:1917 msgid "" "Returns the alignment requirements of a ctypes type. *obj_or_type* must be a " "ctypes type or instance." msgstr "" -#: ../../library/ctypes.rst:1912 +#: ../../library/ctypes.rst:1923 msgid "" "Returns a light-weight pointer to *obj*, which must be an instance of a " "ctypes type. *offset* defaults to zero, and must be an integer that will be " "added to the internal pointer value." msgstr "" -#: ../../library/ctypes.rst:1916 +#: ../../library/ctypes.rst:1927 msgid "``byref(obj, offset)`` corresponds to this C code::" msgstr "" -#: ../../library/ctypes.rst:1918 +#: ../../library/ctypes.rst:1929 msgid "(((char *)&obj) + offset)" msgstr "(((char *)&obj) + offset)" -#: ../../library/ctypes.rst:1920 +#: ../../library/ctypes.rst:1931 msgid "" "The returned object can only be used as a foreign function call parameter. " "It behaves similar to ``pointer(obj)``, but the construction is a lot faster." msgstr "" -#: ../../library/ctypes.rst:1926 +#: ../../library/ctypes.rst:1937 msgid "" "This function is similar to the cast operator in C. It returns a new " "instance of *type* which points to the same memory block as *obj*. *type* " @@ -3353,19 +3363,19 @@ msgid "" "as a pointer." msgstr "" -#: ../../library/ctypes.rst:1934 +#: ../../library/ctypes.rst:1945 msgid "" "This function creates a mutable character buffer. The returned object is a " "ctypes array of :class:`c_char`." msgstr "" -#: ../../library/ctypes.rst:1937 +#: ../../library/ctypes.rst:1948 msgid "" "*init_or_size* must be an integer which specifies the size of the array, or " "a bytes object which will be used to initialize the array items." msgstr "" -#: ../../library/ctypes.rst:1940 +#: ../../library/ctypes.rst:1951 msgid "" "If a bytes object is specified as first argument, the buffer is made one " "item larger than its length so that the last element in the array is a NUL " @@ -3374,7 +3384,7 @@ msgid "" "not be used." msgstr "" -#: ../../library/ctypes.rst:1945 +#: ../../library/ctypes.rst:1956 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_string_buffer`` " "with arguments ``init``, ``size``." @@ -3382,19 +3392,19 @@ msgstr "" "引發一個附帶引數 ``init`` 與 ``size`` 的\\ :ref:`稽核事件 ` " "``ctypes.create_string_buffer``。" -#: ../../library/ctypes.rst:1950 +#: ../../library/ctypes.rst:1961 msgid "" "This function creates a mutable unicode character buffer. The returned " "object is a ctypes array of :class:`c_wchar`." msgstr "" -#: ../../library/ctypes.rst:1953 +#: ../../library/ctypes.rst:1964 msgid "" "*init_or_size* must be an integer which specifies the size of the array, or " "a string which will be used to initialize the array items." msgstr "" -#: ../../library/ctypes.rst:1956 +#: ../../library/ctypes.rst:1967 msgid "" "If a string is specified as first argument, the buffer is made one item " "larger than the length of the string so that the last element in the array " @@ -3403,7 +3413,7 @@ msgid "" "should not be used." msgstr "" -#: ../../library/ctypes.rst:1962 +#: ../../library/ctypes.rst:1973 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_unicode_buffer`` " "with arguments ``init``, ``size``." @@ -3411,21 +3421,21 @@ msgstr "" "引發一個附帶引數 ``init`` 與 ``size`` 的\\ :ref:`稽核事件 ` " "``ctypes.create_unicode_buffer``。" -#: ../../library/ctypes.rst:1967 +#: ../../library/ctypes.rst:1978 msgid "" -"Windows only: This function is a hook which allows implementing in-process " -"COM servers with ctypes. It is called from the DllCanUnloadNow function " -"that the _ctypes extension dll exports." +"This function is a hook which allows implementing in-process COM servers " +"with ctypes. It is called from the DllCanUnloadNow function that the " +"_ctypes extension dll exports." msgstr "" -#: ../../library/ctypes.rst:1974 +#: ../../library/ctypes.rst:1987 msgid "" -"Windows only: This function is a hook which allows implementing in-process " -"COM servers with ctypes. It is called from the DllGetClassObject function " -"that the ``_ctypes`` extension dll exports." +"This function is a hook which allows implementing in-process COM servers " +"with ctypes. It is called from the DllGetClassObject function that the " +"``_ctypes`` extension dll exports." msgstr "" -#: ../../library/ctypes.rst:1982 +#: ../../library/ctypes.rst:1997 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like ``lib``, suffix like ``.so``, ``.dylib`` or version " @@ -3433,94 +3443,94 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:1993 +#: ../../library/ctypes.rst:2008 msgid "" -"Windows only: return the filename of the VC runtime library used by Python, " -"and by the extension modules. If the name of the library cannot be " -"determined, ``None`` is returned." +"Returns the filename of the VC runtime library used by Python, and by the " +"extension modules. If the name of the library cannot be determined, " +"``None`` is returned." msgstr "" -#: ../../library/ctypes.rst:1997 +#: ../../library/ctypes.rst:2012 msgid "" "If you need to free memory, for example, allocated by an extension module " "with a call to the ``free(void *)``, it is important that you use the " "function in the same library that allocated the memory." msgstr "" -#: ../../library/ctypes.rst:2004 +#: ../../library/ctypes.rst:2021 msgid "" -"Windows only: Returns a textual description of the error code *code*. If no " -"error code is specified, the last error code is used by calling the Windows " -"api function GetLastError." +"Returns a textual description of the error code *code*. If no error code is " +"specified, the last error code is used by calling the Windows api function " +"GetLastError." msgstr "" -#: ../../library/ctypes.rst:2011 +#: ../../library/ctypes.rst:2030 msgid "" -"Windows only: Returns the last error code set by Windows in the calling " -"thread. This function calls the Windows ``GetLastError()`` function " -"directly, it does not return the ctypes-private copy of the error code." +"Returns the last error code set by Windows in the calling thread. This " +"function calls the Windows ``GetLastError()`` function directly, it does not " +"return the ctypes-private copy of the error code." msgstr "" -#: ../../library/ctypes.rst:2017 +#: ../../library/ctypes.rst:2039 msgid "" "Returns the current value of the ctypes-private copy of the system :data:" "`errno` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:2020 +#: ../../library/ctypes.rst:2042 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_errno`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``ctypes.get_errno``。" -#: ../../library/ctypes.rst:2024 +#: ../../library/ctypes.rst:2046 msgid "" -"Windows only: returns the current value of the ctypes-private copy of the " -"system :data:`!LastError` variable in the calling thread." +"Returns the current value of the ctypes-private copy of the system :data:`!" +"LastError` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:2027 +#: ../../library/ctypes.rst:2051 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_last_error`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``ctypes.get_last_error``。" -#: ../../library/ctypes.rst:2031 +#: ../../library/ctypes.rst:2056 msgid "" "Same as the standard C memmove library function: copies *count* bytes from " "*src* to *dst*. *dst* and *src* must be integers or ctypes instances that " "can be converted to pointers." msgstr "" -#: ../../library/ctypes.rst:2038 +#: ../../library/ctypes.rst:2063 msgid "" "Same as the standard C memset library function: fills the memory block at " "address *dst* with *count* bytes of value *c*. *dst* must be an integer " "specifying an address, or a ctypes instance." msgstr "" -#: ../../library/ctypes.rst:2045 +#: ../../library/ctypes.rst:2070 msgid "" "Create and return a new ctypes pointer type. Pointer types are cached and " "reused internally, so calling this function repeatedly is cheap. *type* must " "be a ctypes type." msgstr "" -#: ../../library/ctypes.rst:2052 +#: ../../library/ctypes.rst:2077 msgid "" "Create a new pointer instance, pointing to *obj*. The returned object is of " "the type ``POINTER(type(obj))``." msgstr "" -#: ../../library/ctypes.rst:2055 +#: ../../library/ctypes.rst:2080 msgid "" "Note: If you just want to pass a pointer to an object to a foreign function " "call, you should use ``byref(obj)`` which is much faster." msgstr "" -#: ../../library/ctypes.rst:2061 +#: ../../library/ctypes.rst:2086 msgid "" "This function resizes the internal memory buffer of *obj*, which must be an " "instance of a ctypes type. It is not possible to make the buffer smaller " @@ -3528,13 +3538,13 @@ msgid "" "but it is possible to enlarge the buffer." msgstr "" -#: ../../library/ctypes.rst:2069 +#: ../../library/ctypes.rst:2094 msgid "" "Set the current value of the ctypes-private copy of the system :data:`errno` " "variable in the calling thread to *value* and return the previous value." msgstr "" -#: ../../library/ctypes.rst:2072 +#: ../../library/ctypes.rst:2097 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_errno`` with " "argument ``errno``." @@ -3542,14 +3552,14 @@ msgstr "" "引發一個附帶引數 ``errno`` 的\\ :ref:`稽核事件 ` ``ctypes." "set_errno``。" -#: ../../library/ctypes.rst:2077 +#: ../../library/ctypes.rst:2102 msgid "" -"Windows only: set the current value of the ctypes-private copy of the " -"system :data:`!LastError` variable in the calling thread to *value* and " -"return the previous value." +"Sets the current value of the ctypes-private copy of the system :data:`!" +"LastError` variable in the calling thread to *value* and return the previous " +"value." msgstr "" -#: ../../library/ctypes.rst:2081 +#: ../../library/ctypes.rst:2108 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_last_error`` with " "argument ``error``." @@ -3557,19 +3567,19 @@ msgstr "" "引發一個附帶引數 ``error`` 的\\ :ref:`稽核事件 ` ``ctypes." "set_last_error``。" -#: ../../library/ctypes.rst:2086 +#: ../../library/ctypes.rst:2113 msgid "" "Returns the size in bytes of a ctypes type or instance memory buffer. Does " "the same as the C ``sizeof`` operator." msgstr "" -#: ../../library/ctypes.rst:2092 +#: ../../library/ctypes.rst:2119 msgid "" "Return the byte string at *void \\*ptr*. If *size* is specified, it is used " "as size, otherwise the string is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2096 +#: ../../library/ctypes.rst:2123 msgid "" "Raises an :ref:`auditing event ` ``ctypes.string_at`` with " "arguments ``ptr``, ``size``." @@ -3577,29 +3587,28 @@ msgstr "" "引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." "string_at``。" -#: ../../library/ctypes.rst:2101 +#: ../../library/ctypes.rst:2128 msgid "" -"Windows only: this function is probably the worst-named thing in ctypes. It " -"creates an instance of :exc:`OSError`. If *code* is not specified, " -"``GetLastError`` is called to determine the error code. If *descr* is not " -"specified, :func:`FormatError` is called to get a textual description of the " -"error." +"This function is probably the worst-named thing in ctypes. It creates an " +"instance of :exc:`OSError`. If *code* is not specified, ``GetLastError`` is " +"called to determine the error code. If *descr* is not specified, :func:" +"`FormatError` is called to get a textual description of the error." msgstr "" -#: ../../library/ctypes.rst:2107 +#: ../../library/ctypes.rst:2136 msgid "" "An instance of :exc:`WindowsError` used to be created, which is now an alias " "of :exc:`OSError`." msgstr "" -#: ../../library/ctypes.rst:2114 +#: ../../library/ctypes.rst:2143 msgid "" "Return the wide-character string at *void \\*ptr*. If *size* is specified, " "it is used as the number of characters of the string, otherwise the string " "is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2119 +#: ../../library/ctypes.rst:2148 msgid "" "Raises an :ref:`auditing event ` ``ctypes.wstring_at`` with " "arguments ``ptr``, ``size``." @@ -3607,11 +3616,11 @@ msgstr "" "引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." "wstring_at``。" -#: ../../library/ctypes.rst:2125 +#: ../../library/ctypes.rst:2154 msgid "Data types" msgstr "" -#: ../../library/ctypes.rst:2130 +#: ../../library/ctypes.rst:2159 msgid "" "This non-public class is the common base class of all ctypes data types. " "Among other things, all ctypes type instances contain a memory block that " @@ -3621,13 +3630,13 @@ msgid "" "alive in case the memory block contains pointers." msgstr "" -#: ../../library/ctypes.rst:2137 +#: ../../library/ctypes.rst:2166 msgid "" "Common methods of ctypes data types, these are all class methods (to be " "exact, they are methods of the :term:`metaclass`):" msgstr "" -#: ../../library/ctypes.rst:2142 +#: ../../library/ctypes.rst:2171 msgid "" "This method returns a ctypes instance that shares the buffer of the *source* " "object. The *source* object must support the writeable buffer interface. " @@ -3636,7 +3645,7 @@ msgid "" "exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2148 ../../library/ctypes.rst:2158 +#: ../../library/ctypes.rst:2177 ../../library/ctypes.rst:2187 msgid "" "Raises an :ref:`auditing event ` ``ctypes.cdata/buffer`` with " "arguments ``pointer``, ``size``, ``offset``." @@ -3644,7 +3653,7 @@ msgstr "" "引發一個附帶引數 ``pointer``、``size``、``offset`` 的\\ :ref:`稽核事件 " "` ``ctypes.cdata/buffer``。" -#: ../../library/ctypes.rst:2152 +#: ../../library/ctypes.rst:2181 msgid "" "This method creates a ctypes instance, copying the buffer from the *source* " "object buffer which must be readable. The optional *offset* parameter " @@ -3652,19 +3661,19 @@ msgid "" "If the source buffer is not large enough a :exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2162 +#: ../../library/ctypes.rst:2191 msgid "" "This method returns a ctypes type instance using the memory specified by " "*address* which must be an integer." msgstr "" -#: ../../library/ctypes.rst:2165 ../../library/ctypes.rst:2167 +#: ../../library/ctypes.rst:2194 ../../library/ctypes.rst:2196 msgid "" "This method, and others that indirectly call this method, raises an :ref:" "`auditing event ` ``ctypes.cdata`` with argument ``address``." msgstr "" -#: ../../library/ctypes.rst:2173 +#: ../../library/ctypes.rst:2202 msgid "" "This method adapts *obj* to a ctypes type. It is called with the actual " "object used in a foreign function call when the type is present in the " @@ -3672,25 +3681,25 @@ msgid "" "object that can be used as a function call parameter." msgstr "" -#: ../../library/ctypes.rst:2178 +#: ../../library/ctypes.rst:2207 msgid "" "All ctypes data types have a default implementation of this classmethod that " "normally returns *obj* if that is an instance of the type. Some types " "accept other objects as well." msgstr "" -#: ../../library/ctypes.rst:2184 +#: ../../library/ctypes.rst:2213 msgid "" "This method returns a ctypes type instance exported by a shared library. " "*name* is the name of the symbol that exports the data, *library* is the " "loaded shared library." msgstr "" -#: ../../library/ctypes.rst:2188 +#: ../../library/ctypes.rst:2217 msgid "Common instance variables of ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2192 +#: ../../library/ctypes.rst:2221 msgid "" "Sometimes ctypes data instances do not own the memory block they contain, " "instead they share part of the memory block of a base object. The :attr:" @@ -3698,13 +3707,13 @@ msgid "" "block." msgstr "" -#: ../../library/ctypes.rst:2199 +#: ../../library/ctypes.rst:2228 msgid "" "This read-only variable is true when the ctypes data instance has allocated " "the memory block itself, false otherwise." msgstr "" -#: ../../library/ctypes.rst:2204 +#: ../../library/ctypes.rst:2233 msgid "" "This member is either ``None`` or a dictionary containing Python objects " "that need to be kept alive so that the memory block contents is kept valid. " @@ -3712,7 +3721,7 @@ msgid "" "dictionary." msgstr "" -#: ../../library/ctypes.rst:2217 +#: ../../library/ctypes.rst:2246 msgid "" "This non-public class is the base class of all fundamental ctypes data " "types. It is mentioned here because it contains the common attributes of the " @@ -3721,11 +3730,11 @@ msgid "" "types that are not and do not contain pointers can now be pickled." msgstr "" -#: ../../library/ctypes.rst:2223 +#: ../../library/ctypes.rst:2252 msgid "Instances have a single attribute:" msgstr "" -#: ../../library/ctypes.rst:2227 +#: ../../library/ctypes.rst:2256 msgid "" "This attribute contains the actual value of the instance. For integer and " "pointer types, it is an integer, for character types, it is a single " @@ -3733,7 +3742,7 @@ msgid "" "bytes object or string." msgstr "" -#: ../../library/ctypes.rst:2232 +#: ../../library/ctypes.rst:2261 msgid "" "When the ``value`` attribute is retrieved from a ctypes instance, usually a " "new object is returned each time. :mod:`ctypes` does *not* implement " @@ -3741,7 +3750,7 @@ msgid "" "true for all other ctypes object instances." msgstr "" -#: ../../library/ctypes.rst:2238 +#: ../../library/ctypes.rst:2267 msgid "" "Fundamental data types, when returned as foreign function call results, or, " "for example, by retrieving structure field members or array items, are " @@ -3751,7 +3760,7 @@ msgid "" "instance." msgstr "" -#: ../../library/ctypes.rst:2246 +#: ../../library/ctypes.rst:2275 msgid "" "Subclasses of fundamental data types do *not* inherit this behavior. So, if " "a foreign functions :attr:`!restype` is a subclass of :class:`c_void_p`, you " @@ -3759,25 +3768,25 @@ msgid "" "you can get the value of the pointer by accessing the ``value`` attribute." msgstr "" -#: ../../library/ctypes.rst:2251 +#: ../../library/ctypes.rst:2280 msgid "These are the fundamental ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2255 +#: ../../library/ctypes.rst:2284 msgid "" "Represents the C :c:expr:`signed char` datatype, and interprets the value as " "small integer. The constructor accepts an optional integer initializer; no " "overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2262 +#: ../../library/ctypes.rst:2291 msgid "" "Represents the C :c:expr:`char` datatype, and interprets the value as a " "single character. The constructor accepts an optional string initializer, " "the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2269 +#: ../../library/ctypes.rst:2298 msgid "" "Represents the C :c:expr:`char *` datatype when it points to a zero-" "terminated string. For a general character pointer that may also point to " @@ -3785,182 +3794,182 @@ msgid "" "integer address, or a bytes object." msgstr "" -#: ../../library/ctypes.rst:2277 +#: ../../library/ctypes.rst:2306 msgid "" "Represents the C :c:expr:`double` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2283 +#: ../../library/ctypes.rst:2312 msgid "" "Represents the C :c:expr:`long double` datatype. The constructor accepts an " "optional float initializer. On platforms where ``sizeof(long double) == " "sizeof(double)`` it is an alias to :class:`c_double`." msgstr "" -#: ../../library/ctypes.rst:2289 +#: ../../library/ctypes.rst:2318 msgid "" "Represents the C :c:expr:`float` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2295 +#: ../../library/ctypes.rst:2324 msgid "" "Represents the C :c:expr:`signed int` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias to :class:`c_long`." msgstr "" -#: ../../library/ctypes.rst:2302 +#: ../../library/ctypes.rst:2331 msgid "" "Represents the C 8-bit :c:expr:`signed int` datatype. Usually an alias for :" "class:`c_byte`." msgstr "" -#: ../../library/ctypes.rst:2308 +#: ../../library/ctypes.rst:2337 msgid "" "Represents the C 16-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_short`." msgstr "" -#: ../../library/ctypes.rst:2314 +#: ../../library/ctypes.rst:2343 msgid "" "Represents the C 32-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_int`." msgstr "" -#: ../../library/ctypes.rst:2320 +#: ../../library/ctypes.rst:2349 msgid "" "Represents the C 64-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_longlong`." msgstr "" -#: ../../library/ctypes.rst:2326 +#: ../../library/ctypes.rst:2355 msgid "" "Represents the C :c:expr:`signed long` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2332 +#: ../../library/ctypes.rst:2361 msgid "" "Represents the C :c:expr:`signed long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2338 +#: ../../library/ctypes.rst:2367 msgid "" "Represents the C :c:expr:`signed short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2344 +#: ../../library/ctypes.rst:2373 msgid "Represents the C :c:type:`size_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2349 +#: ../../library/ctypes.rst:2378 msgid "Represents the C :c:type:`ssize_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2356 +#: ../../library/ctypes.rst:2385 msgid "Represents the C :c:type:`time_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2363 +#: ../../library/ctypes.rst:2392 msgid "" "Represents the C :c:expr:`unsigned char` datatype, it interprets the value " "as small integer. The constructor accepts an optional integer initializer; " "no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2370 +#: ../../library/ctypes.rst:2399 msgid "" "Represents the C :c:expr:`unsigned int` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`." msgstr "" -#: ../../library/ctypes.rst:2377 +#: ../../library/ctypes.rst:2406 msgid "" "Represents the C 8-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ubyte`." msgstr "" -#: ../../library/ctypes.rst:2383 +#: ../../library/ctypes.rst:2412 msgid "" "Represents the C 16-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ushort`." msgstr "" -#: ../../library/ctypes.rst:2389 +#: ../../library/ctypes.rst:2418 msgid "" "Represents the C 32-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_uint`." msgstr "" -#: ../../library/ctypes.rst:2395 +#: ../../library/ctypes.rst:2424 msgid "" "Represents the C 64-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ulonglong`." msgstr "" -#: ../../library/ctypes.rst:2401 +#: ../../library/ctypes.rst:2430 msgid "" "Represents the C :c:expr:`unsigned long` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2407 +#: ../../library/ctypes.rst:2436 msgid "" "Represents the C :c:expr:`unsigned long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2413 +#: ../../library/ctypes.rst:2442 msgid "" "Represents the C :c:expr:`unsigned short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2419 +#: ../../library/ctypes.rst:2448 msgid "" "Represents the C :c:expr:`void *` type. The value is represented as " "integer. The constructor accepts an optional integer initializer." msgstr "" -#: ../../library/ctypes.rst:2425 +#: ../../library/ctypes.rst:2454 msgid "" "Represents the C :c:type:`wchar_t` datatype, and interprets the value as a " "single character unicode string. The constructor accepts an optional string " "initializer, the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2432 +#: ../../library/ctypes.rst:2461 msgid "" "Represents the C :c:expr:`wchar_t *` datatype, which must be a pointer to a " "zero-terminated wide character string. The constructor accepts an integer " "address, or a string." msgstr "" -#: ../../library/ctypes.rst:2439 +#: ../../library/ctypes.rst:2468 msgid "" "Represent the C :c:expr:`bool` datatype (more accurately, :c:expr:`_Bool` " "from C99). Its value can be ``True`` or ``False``, and the constructor " "accepts any object that has a truth value." msgstr "" -#: ../../library/ctypes.rst:2446 +#: ../../library/ctypes.rst:2475 msgid "" -"Windows only: Represents a :c:type:`!HRESULT` value, which contains success " -"or error information for a function or method call." +"Represents a :c:type:`!HRESULT` value, which contains success or error " +"information for a function or method call." msgstr "" -#: ../../library/ctypes.rst:2452 +#: ../../library/ctypes.rst:2483 msgid "" "Represents the C :c:expr:`PyObject *` datatype. Calling this without an " "argument creates a ``NULL`` :c:expr:`PyObject *` pointer." msgstr "" -#: ../../library/ctypes.rst:2455 +#: ../../library/ctypes.rst:2486 msgid "" "The :mod:`!ctypes.wintypes` module provides quite some other Windows " "specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, or :c:" @@ -3968,41 +3977,41 @@ msgid "" "are also defined." msgstr "" -#: ../../library/ctypes.rst:2463 +#: ../../library/ctypes.rst:2494 msgid "Structured data types" msgstr "" -#: ../../library/ctypes.rst:2468 +#: ../../library/ctypes.rst:2499 msgid "Abstract base class for unions in native byte order." msgstr "" -#: ../../library/ctypes.rst:2473 +#: ../../library/ctypes.rst:2504 msgid "Abstract base class for unions in *big endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2479 +#: ../../library/ctypes.rst:2510 msgid "Abstract base class for unions in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2485 +#: ../../library/ctypes.rst:2516 msgid "Abstract base class for structures in *big endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2490 +#: ../../library/ctypes.rst:2521 msgid "Abstract base class for structures in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2492 +#: ../../library/ctypes.rst:2523 msgid "" "Structures and unions with non-native byte order cannot contain pointer type " "fields, or any other data types containing pointer type fields." msgstr "" -#: ../../library/ctypes.rst:2498 +#: ../../library/ctypes.rst:2529 msgid "Abstract base class for structures in *native* byte order." msgstr "" -#: ../../library/ctypes.rst:2500 +#: ../../library/ctypes.rst:2531 msgid "" "Concrete structure and union types must be created by subclassing one of " "these types, and at least define a :attr:`_fields_` class variable. :mod:" @@ -4010,34 +4019,34 @@ msgid "" "the fields by direct attribute accesses. These are the" msgstr "" -#: ../../library/ctypes.rst:2508 +#: ../../library/ctypes.rst:2539 msgid "" "A sequence defining the structure fields. The items must be 2-tuples or 3-" "tuples. The first item is the name of the field, the second item specifies " "the type of the field; it can be any ctypes data type." msgstr "" -#: ../../library/ctypes.rst:2512 +#: ../../library/ctypes.rst:2543 msgid "" "For integer type fields like :class:`c_int`, a third optional item can be " "given. It must be a small positive integer defining the bit width of the " "field." msgstr "" -#: ../../library/ctypes.rst:2516 +#: ../../library/ctypes.rst:2547 msgid "" "Field names must be unique within one structure or union. This is not " "checked, only one field can be accessed when names are repeated." msgstr "" -#: ../../library/ctypes.rst:2519 +#: ../../library/ctypes.rst:2550 msgid "" "It is possible to define the :attr:`_fields_` class variable *after* the " "class statement that defines the Structure subclass, this allows creating " "data types that directly or indirectly reference themselves::" msgstr "" -#: ../../library/ctypes.rst:2523 +#: ../../library/ctypes.rst:2554 msgid "" "class List(Structure):\n" " pass\n" @@ -4051,7 +4060,7 @@ msgstr "" " ...\n" " ]" -#: ../../library/ctypes.rst:2529 +#: ../../library/ctypes.rst:2560 msgid "" "The :attr:`_fields_` class variable must, however, be defined before the " "type is first used (an instance is created, :func:`sizeof` is called on it, " @@ -4059,14 +4068,14 @@ msgid "" "raise an AttributeError." msgstr "" -#: ../../library/ctypes.rst:2534 +#: ../../library/ctypes.rst:2565 msgid "" "It is possible to define sub-subclasses of structure types, they inherit the " "fields of the base class plus the :attr:`_fields_` defined in the sub-" "subclass, if any." msgstr "" -#: ../../library/ctypes.rst:2541 +#: ../../library/ctypes.rst:2572 msgid "" "An optional small integer that allows overriding the alignment of structure " "fields in the instance. :attr:`_pack_` must already be defined when :attr:" @@ -4074,21 +4083,21 @@ msgid "" "attribute to 0 is the same as not setting it at all." msgstr "" -#: ../../library/ctypes.rst:2549 +#: ../../library/ctypes.rst:2580 msgid "" "An optional small integer that allows overriding the alignment of the " "structure when being packed or unpacked to/from memory. Setting this " "attribute to 0 is the same as not setting it at all." msgstr "" -#: ../../library/ctypes.rst:2557 +#: ../../library/ctypes.rst:2588 msgid "" "An optional sequence that lists the names of unnamed (anonymous) fields. :" "attr:`_anonymous_` must be already defined when :attr:`_fields_` is " "assigned, otherwise it will have no effect." msgstr "" -#: ../../library/ctypes.rst:2561 +#: ../../library/ctypes.rst:2592 msgid "" "The fields listed in this variable must be structure or union type fields. :" "mod:`ctypes` will create descriptors in the structure type that allows " @@ -4096,11 +4105,11 @@ msgid "" "structure or union field." msgstr "" -#: ../../library/ctypes.rst:2566 +#: ../../library/ctypes.rst:2597 msgid "Here is an example type (Windows)::" msgstr "" -#: ../../library/ctypes.rst:2568 +#: ../../library/ctypes.rst:2599 msgid "" "class _U(Union):\n" " _fields_ = [(\"lptdesc\", POINTER(TYPEDESC)),\n" @@ -4122,7 +4131,7 @@ msgstr "" " _fields_ = [(\"u\", _U),\n" " (\"vt\", VARTYPE)]" -#: ../../library/ctypes.rst:2579 +#: ../../library/ctypes.rst:2610 msgid "" "The ``TYPEDESC`` structure describes a COM data type, the ``vt`` field " "specifies which one of the union fields is valid. Since the ``u`` field is " @@ -4132,7 +4141,7 @@ msgid "" "temporary union instance::" msgstr "" -#: ../../library/ctypes.rst:2586 +#: ../../library/ctypes.rst:2617 msgid "" "td = TYPEDESC()\n" "td.vt = VT_PTR\n" @@ -4144,7 +4153,7 @@ msgstr "" "td.lptdesc = POINTER(some_type)\n" "td.u.lptdesc = POINTER(some_type)" -#: ../../library/ctypes.rst:2591 +#: ../../library/ctypes.rst:2622 msgid "" "It is possible to define sub-subclasses of structures, they inherit the " "fields of the base class. If the subclass definition has a separate :attr:" @@ -4152,7 +4161,7 @@ msgid "" "of the base class." msgstr "" -#: ../../library/ctypes.rst:2596 +#: ../../library/ctypes.rst:2627 msgid "" "Structure and union constructors accept both positional and keyword " "arguments. Positional arguments are used to initialize member fields in the " @@ -4162,15 +4171,15 @@ msgid "" "names not present in :attr:`_fields_`." msgstr "" -#: ../../library/ctypes.rst:2607 +#: ../../library/ctypes.rst:2638 msgid "Arrays and pointers" msgstr "" -#: ../../library/ctypes.rst:2611 +#: ../../library/ctypes.rst:2642 msgid "Abstract base class for arrays." msgstr "" -#: ../../library/ctypes.rst:2613 +#: ../../library/ctypes.rst:2644 msgid "" "The recommended way to create concrete array types is by multiplying any :" "mod:`ctypes` data type with a non-negative integer. Alternatively, you can " @@ -4180,46 +4189,46 @@ msgid "" "an :class:`Array`." msgstr "" -#: ../../library/ctypes.rst:2623 +#: ../../library/ctypes.rst:2654 msgid "" "A positive integer specifying the number of elements in the array. Out-of-" "range subscripts result in an :exc:`IndexError`. Will be returned by :func:" "`len`." msgstr "" -#: ../../library/ctypes.rst:2630 +#: ../../library/ctypes.rst:2661 msgid "Specifies the type of each element in the array." msgstr "" -#: ../../library/ctypes.rst:2633 +#: ../../library/ctypes.rst:2664 msgid "" "Array subclass constructors accept positional arguments, used to initialize " "the elements in order." msgstr "" -#: ../../library/ctypes.rst:2638 +#: ../../library/ctypes.rst:2669 msgid "" "Create an array. Equivalent to ``type * length``, where *type* is a :mod:" "`ctypes` data type and *length* an integer." msgstr "" -#: ../../library/ctypes.rst:2642 +#: ../../library/ctypes.rst:2673 msgid "" "This function is :term:`soft deprecated` in favor of multiplication. There " "are no plans to remove it." msgstr "" -#: ../../library/ctypes.rst:2648 +#: ../../library/ctypes.rst:2679 msgid "Private, abstract base class for pointers." msgstr "" -#: ../../library/ctypes.rst:2650 +#: ../../library/ctypes.rst:2681 msgid "" "Concrete pointer types are created by calling :func:`POINTER` with the type " "that will be pointed to; this is done automatically by :func:`pointer`." msgstr "" -#: ../../library/ctypes.rst:2654 +#: ../../library/ctypes.rst:2685 msgid "" "If a pointer points to an array, its elements can be read and written using " "standard subscript and slice accesses. Pointer objects have no size, so :" @@ -4228,11 +4237,11 @@ msgid "" "probably crash with an access violation (if you're lucky)." msgstr "" -#: ../../library/ctypes.rst:2664 +#: ../../library/ctypes.rst:2695 msgid "Specifies the type pointed to." msgstr "" -#: ../../library/ctypes.rst:2668 +#: ../../library/ctypes.rst:2699 msgid "" "Returns the object to which to pointer points. Assigning to this attribute " "changes the pointer to point to the assigned object." diff --git a/library/distutils.po b/library/distutils.po new file mode 100644 index 0000000000..5705c4cc8a --- /dev/null +++ b/library/distutils.po @@ -0,0 +1,41 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/distutils.rst:2 +msgid ":mod:`!distutils` --- Building and installing Python modules" +msgstr ":mod:`!distutils` --- 建置與安裝 Python 模組" + +#: ../../library/distutils.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.12 ` after being " +"deprecated in Python 3.10. The removal was decided in :pep:`632`, which has " +"`migration advice `_." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.10 中被棄用,並\\ :" +"ref:`已在 Python 3.12 中被移除 `。它的移除是" +"在 :pep:`632` 中決定的,該 PEP 附有\\ `遷移建議 `_。" + +#: ../../library/distutils.rst:16 +msgid "" +"The last version of Python that provided the :mod:`!distutils` module was " +"`Python 3.11 `_." +msgstr "" +"最後提供 :mod:`!distutils` 模組的 Python 版本是 `Python 3.11 `_。" diff --git a/library/imghdr.po b/library/imghdr.po new file mode 100644 index 0000000000..3f80af2be5 --- /dev/null +++ b/library/imghdr.po @@ -0,0 +1,48 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/imghdr.rst:2 +msgid ":mod:`!imghdr` --- Determine the type of an image" +msgstr ":mod:`imghdr` --- 判定圖片種類" + +#: ../../library/imghdr.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/imghdr.rst:14 +msgid "" +"Possible replacements are third-party libraries from PyPI: :pypi:" +"`filetype`, :pypi:`puremagic`, or :pypi:`python-magic`. These are not " +"supported or maintained by the Python core team." +msgstr "" +"可能的替代方案是 PyPI 上的第三方函式庫::pypi:`filetype`、:pypi:`puremagic` " +"或 :pypi:`python-magic`。它們並不受 Python 核心團隊支援或維護。" + +#: ../../library/imghdr.rst:18 +msgid "" +"The last version of Python that provided the :mod:`!imghdr` module was " +"`Python 3.12 `_." +msgstr "" +"最後提供 :mod:`!imghdr` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/imp.po b/library/imp.po new file mode 100644 index 0000000000..e90534acb9 --- /dev/null +++ b/library/imp.po @@ -0,0 +1,46 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/imp.rst:2 +msgid ":mod:`!imp` --- Access the import internals" +msgstr ":mod:`!imp` --- 存取引入系統內層" + +#: ../../library/imp.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.12 ` after being deprecated in " +"Python 3.4." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.4 中被棄用,並\\ :" +"ref:`已在 Python 3.12 中被移除 `。" + +#: ../../library/imp.rst:14 +msgid "" +"The :ref:`removal notice ` includes guidance for " +"migrating code from :mod:`!imp` to :mod:`importlib`." +msgstr "" +"其\\ :ref:`移除通知 `\\ 包含了從 :mod:`!imp` 遷移" +"至 :mod:`importlib` 的指引。" + +#: ../../library/imp.rst:17 +msgid "" +"The last version of Python that provided the :mod:`!imp` module was `Python " +"3.11 `_." +msgstr "" +"最後提供 :mod:`!imp` 模組的 Python 版本是 `Python 3.11 `_。" diff --git a/library/importlib.metadata.po b/library/importlib.metadata.po index 19f0cfe625..3f925524cf 100644 --- a/library/importlib.metadata.po +++ b/library/importlib.metadata.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-31 00:13+0000\n" +"POT-Creation-Date: 2024-11-23 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -202,9 +202,9 @@ msgstr "" #: ../../library/importlib.metadata.rst:136 msgid "" -"Also provides a ``.groups`` attribute that reports all identifed entry point " -"groups, and a ``.names`` attribute that reports all identified entry point " -"names." +"Also provides a ``.groups`` attribute that reports all identified entry " +"point groups, and a ``.names`` attribute that reports all identified entry " +"point names." msgstr "" #: ../../library/importlib.metadata.rst:142 diff --git a/library/importlib.resources.abc.po b/library/importlib.resources.abc.po index 5439f00156..f000c0ec12 100644 --- a/library/importlib.resources.abc.po +++ b/library/importlib.resources.abc.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -11,7 +10,8 @@ msgstr "" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff --git a/library/importlib.resources.po b/library/importlib.resources.po index 01d3b9aa4c..8263a1f83d 100644 --- a/library/importlib.resources.po +++ b/library/importlib.resources.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -11,7 +10,8 @@ msgstr "" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -20,7 +20,7 @@ msgstr "" #: ../../library/importlib.resources.rst:2 msgid "" ":mod:`!importlib.resources` -- Package resource reading, opening and access" -msgstr "" +msgstr ":mod:`!importlib.resources` -- 套件資源的讀取、開啟與存取" #: ../../library/importlib.resources.rst:7 msgid "**Source code:** :source:`Lib/importlib/resources/__init__.py`" @@ -179,6 +179,8 @@ msgid "" "importlib.resources.read_binary(my_module, \"pics/painting.png\")\n" "importlib.resources.read_binary(my_module, \"pics\", \"painting.png\")" msgstr "" +"importlib.resources.read_binary(my_module, \"pics/painting.png\")\n" +"importlib.resources.read_binary(my_module, \"pics\", \"painting.png\")" #: ../../library/importlib.resources.rst:130 msgid "" @@ -192,6 +194,8 @@ msgid "" "importlib.resources.read_text(my_module, \"info\", \"chapter1.txt\",\n" " encoding='utf-8')" msgstr "" +"importlib.resources.read_text(my_module, \"info\", \"chapter1.txt\",\n" +" encoding='utf-8')" #: ../../library/importlib.resources.rst:139 msgid "Open the named resource for binary reading." @@ -224,9 +228,8 @@ msgid "This function is roughly equivalent to::" msgstr "" #: ../../library/importlib.resources.rst:149 -#, fuzzy msgid "files(anchor).joinpath(*path_names).open('rb')" -msgstr "files(package).joinpath(resource).open('rb')" +msgstr "files(anchor).joinpath(*path_names).open('rb')" #: ../../library/importlib.resources.rst:151 #: ../../library/importlib.resources.rst:191 @@ -263,9 +266,8 @@ msgid "" msgstr "" #: ../../library/importlib.resources.rst:173 -#, fuzzy msgid "files(anchor).joinpath(*path_names).open('r', encoding=encoding)" -msgstr "files(package).joinpath(resource).open('r', encoding=encoding)" +msgstr "files(anchor).joinpath(*path_names).open('r', encoding=encoding)" #: ../../library/importlib.resources.rst:175 #: ../../library/importlib.resources.rst:212 @@ -280,9 +282,8 @@ msgid "Read and return the contents of the named resource as :class:`bytes`." msgstr "" #: ../../library/importlib.resources.rst:189 -#, fuzzy msgid "files(anchor).joinpath(*path_names).read_bytes()" -msgstr "files(package).joinpath(resource).read_bytes()" +msgstr "files(anchor).joinpath(*path_names).read_bytes()" #: ../../library/importlib.resources.rst:197 msgid "" @@ -291,9 +292,8 @@ msgid "" msgstr "" #: ../../library/importlib.resources.rst:210 -#, fuzzy msgid "files(anchor).joinpath(*path_names).read_text(encoding=encoding)" -msgstr "files(package).joinpath(resource).read_text(encoding=encoding)" +msgstr "files(anchor).joinpath(*path_names).read_text(encoding=encoding)" #: ../../library/importlib.resources.rst:219 msgid "" @@ -319,11 +319,12 @@ msgid "" "with importlib.resources.path(anchor, \"resource.txt\") as fspath:\n" " result = fspath.stat()" msgstr "" +"with importlib.resources.path(anchor, \"resource.txt\") as fspath:\n" +" result = fspath.stat()" #: ../../library/importlib.resources.rst:237 -#, fuzzy msgid "as_file(files(anchor).joinpath(*path_names))" -msgstr "as_file(files(package).joinpath(resource))" +msgstr "as_file(files(anchor).joinpath(*path_names))" #: ../../library/importlib.resources.rst:246 msgid "" @@ -332,9 +333,8 @@ msgid "" msgstr "" #: ../../library/importlib.resources.rst:254 -#, fuzzy msgid "files(anchor).joinpath(*path_names).is_file()" -msgstr "files(package).joinpath(resource).is_file()" +msgstr "files(anchor).joinpath(*path_names).is_file()" #: ../../library/importlib.resources.rst:262 msgid "" @@ -345,19 +345,15 @@ msgid "" msgstr "" #: ../../library/importlib.resources.rst:272 -#, fuzzy msgid "" "for resource in files(anchor).joinpath(*path_names).iterdir():\n" " yield resource.name" msgstr "" -"(resource.name for resource in files(package).iterdir() if resource." -"is_file())" +"for resource in files(anchor).joinpath(*path_names).iterdir():\n" +" yield resource.name" #: ../../library/importlib.resources.rst:275 msgid "" "Prefer ``iterdir()`` as above, which offers more control over the results " "and richer functionality." msgstr "" - -#~ msgid "Deprecated functions" -#~ msgstr "已棄用函式" diff --git a/library/locale.po b/library/locale.po index 6a5c230140..edd5415af8 100644 --- a/library/locale.po +++ b/library/locale.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # This file is distributed under the same license as the Python package. # @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-22 00:13+0000\n" +"POT-Creation-Date: 2024-11-22 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -431,10 +430,12 @@ msgid "" msgstr "" #: ../../library/locale.rst:284 -msgid "Get a string that represents the era used in the current locale." +msgid "" +"Get a string which describes how years are counted and displayed for each " +"era in a locale." msgstr "" -#: ../../library/locale.rst:286 +#: ../../library/locale.rst:287 msgid "" "Most locales do not define this value. An example of a locale which does " "define this value is the Japanese one. In Japan, the traditional " @@ -442,47 +443,48 @@ msgid "" "then-emperor's reign." msgstr "" -#: ../../library/locale.rst:291 +#: ../../library/locale.rst:292 msgid "" "Normally it should not be necessary to use this value directly. Specifying " "the ``E`` modifier in their format strings causes the :func:`time.strftime` " -"function to use this information. The format of the returned string is not " -"specified, and therefore you should not assume knowledge of it on different " -"systems." +"function to use this information. The format of the returned string is " +"specified in *The Open Group Base Specifications Issue 8*, paragraph " +"`7.3.5.2 LC_TIME C-Language Access `_." msgstr "" -#: ../../library/locale.rst:299 +#: ../../library/locale.rst:301 msgid "" "Get a format string for :func:`time.strftime` to represent date and time in " "a locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:304 +#: ../../library/locale.rst:306 msgid "" "Get a format string for :func:`time.strftime` to represent a date in a " "locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:309 +#: ../../library/locale.rst:311 msgid "" "Get a format string for :func:`time.strftime` to represent a time in a " "locale-specific era-based way." msgstr "" -#: ../../library/locale.rst:314 +#: ../../library/locale.rst:316 msgid "" "Get a string consisting of up to 100 semicolon-separated symbols used to " "represent the values 0 to 99 in a locale-specific way. In most locales this " "is an empty string." msgstr "" -#: ../../library/locale.rst:321 +#: ../../library/locale.rst:323 msgid "" "Tries to determine the default locale settings and returns them as a tuple " "of the form ``(language code, encoding)``." msgstr "" -#: ../../library/locale.rst:324 +#: ../../library/locale.rst:326 msgid "" "According to POSIX, a program which has not called ``setlocale(LC_ALL, '')`` " "runs using the portable ``'C'`` locale. Calling ``setlocale(LC_ALL, '')`` " @@ -491,7 +493,7 @@ msgid "" "emulate the behavior in the way described above." msgstr "" -#: ../../library/locale.rst:330 +#: ../../library/locale.rst:332 msgid "" "To maintain compatibility with other platforms, not only the :envvar:`LANG` " "variable is tested, but a list of variables given as envvars parameter. The " @@ -501,21 +503,21 @@ msgid "" "``'LC_CTYPE'``, ``'LANG'`` and ``'LANGUAGE'``, in that order." msgstr "" -#: ../../library/locale.rst:337 ../../library/locale.rst:350 +#: ../../library/locale.rst:339 ../../library/locale.rst:352 msgid "" "Except for the code ``'C'``, the language code corresponds to :rfc:`1766`. " "*language code* and *encoding* may be ``None`` if their values cannot be " "determined." msgstr "" -#: ../../library/locale.rst:346 +#: ../../library/locale.rst:348 msgid "" "Returns the current setting for the given locale category as sequence " "containing *language code*, *encoding*. *category* may be one of the :const:" "`!LC_\\*` values except :const:`LC_ALL`. It defaults to :const:`LC_CTYPE`." msgstr "" -#: ../../library/locale.rst:357 +#: ../../library/locale.rst:359 msgid "" "Return the :term:`locale encoding` used for text data, according to user " "preferences. User preferences are expressed differently on different " @@ -523,72 +525,72 @@ msgid "" "this function only returns a guess." msgstr "" -#: ../../library/locale.rst:362 +#: ../../library/locale.rst:364 msgid "" "On some systems, it is necessary to invoke :func:`setlocale` to obtain the " "user preferences, so this function is not thread-safe. If invoking setlocale " "is not necessary or desired, *do_setlocale* should be set to ``False``." msgstr "" -#: ../../library/locale.rst:366 +#: ../../library/locale.rst:368 msgid "" "On Android or if the :ref:`Python UTF-8 Mode ` is enabled, always " "return ``'utf-8'``, the :term:`locale encoding` and the *do_setlocale* " "argument are ignored." msgstr "" -#: ../../library/locale.rst:370 ../../library/locale.rst:388 +#: ../../library/locale.rst:372 ../../library/locale.rst:390 msgid "" "The :ref:`Python preinitialization ` configures the LC_CTYPE " "locale. See also the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../library/locale.rst:373 +#: ../../library/locale.rst:375 msgid "" "The function now always returns ``\"utf-8\"`` on Android or if the :ref:" "`Python UTF-8 Mode ` is enabled." msgstr "" -#: ../../library/locale.rst:380 +#: ../../library/locale.rst:382 msgid "Get the current :term:`locale encoding`:" msgstr "" -#: ../../library/locale.rst:382 +#: ../../library/locale.rst:384 msgid "On Android and VxWorks, return ``\"utf-8\"``." msgstr "" -#: ../../library/locale.rst:383 +#: ../../library/locale.rst:385 msgid "" "On Unix, return the encoding of the current :data:`LC_CTYPE` locale. Return " "``\"utf-8\"`` if ``nl_langinfo(CODESET)`` returns an empty string: for " "example, if the current LC_CTYPE locale is not supported." msgstr "" -#: ../../library/locale.rst:386 +#: ../../library/locale.rst:388 msgid "On Windows, return the ANSI code page." msgstr "" -#: ../../library/locale.rst:391 +#: ../../library/locale.rst:393 msgid "" "This function is similar to :func:`getpreferredencoding(False) " "` except this function ignores the :ref:`Python UTF-8 " "Mode `." msgstr "" -#: ../../library/locale.rst:400 +#: ../../library/locale.rst:402 msgid "" "Returns a normalized locale code for the given locale name. The returned " "locale code is formatted for use with :func:`setlocale`. If normalization " "fails, the original name is returned unchanged." msgstr "" -#: ../../library/locale.rst:404 +#: ../../library/locale.rst:406 msgid "" "If the given encoding is not known, the function defaults to the default " "encoding for the locale code just like :func:`setlocale`." msgstr "" -#: ../../library/locale.rst:410 +#: ../../library/locale.rst:412 msgid "" "Compares two strings according to the current :const:`LC_COLLATE` setting. " "As any other compare function, returns a negative, or a positive value, or " @@ -596,7 +598,7 @@ msgid "" "is equal to it." msgstr "" -#: ../../library/locale.rst:418 +#: ../../library/locale.rst:420 msgid "" "Transforms a string to one that can be used in locale-aware comparisons. " "For example, ``strxfrm(s1) < strxfrm(s2)`` is equivalent to ``strcoll(s1, " @@ -604,7 +606,7 @@ msgid "" "repeatedly, e.g. when collating a sequence of strings." msgstr "" -#: ../../library/locale.rst:427 +#: ../../library/locale.rst:429 msgid "" "Formats a number *val* according to the current :const:`LC_NUMERIC` setting. " "The format follows the conventions of the ``%`` operator. For floating-" @@ -612,29 +614,29 @@ msgid "" "is ``True``, also takes the grouping into account." msgstr "" -#: ../../library/locale.rst:432 +#: ../../library/locale.rst:434 msgid "" "If *monetary* is true, the conversion uses monetary thousands separator and " "grouping strings." msgstr "" -#: ../../library/locale.rst:435 +#: ../../library/locale.rst:437 msgid "" "Processes formatting specifiers as in ``format % val``, but takes the " "current locale settings into account." msgstr "" -#: ../../library/locale.rst:438 +#: ../../library/locale.rst:440 msgid "The *monetary* keyword parameter was added." msgstr "" -#: ../../library/locale.rst:444 +#: ../../library/locale.rst:446 msgid "" "Formats a number *val* according to the current :const:`LC_MONETARY` " "settings." msgstr "" -#: ../../library/locale.rst:446 +#: ../../library/locale.rst:448 msgid "" "The returned string includes the currency symbol if *symbol* is true, which " "is the default. If *grouping* is ``True`` (which is not the default), " @@ -642,43 +644,43 @@ msgid "" "not the default), the international currency symbol is used." msgstr "" -#: ../../library/locale.rst:453 +#: ../../library/locale.rst:455 msgid "" "This function will not work with the 'C' locale, so you have to set a locale " "via :func:`setlocale` first." msgstr "" -#: ../../library/locale.rst:459 +#: ../../library/locale.rst:461 msgid "" "Formats a floating-point number using the same format as the built-in " "function ``str(float)``, but takes the decimal point into account." msgstr "" -#: ../../library/locale.rst:465 +#: ../../library/locale.rst:467 msgid "" "Converts a string into a normalized number string, following the :const:" "`LC_NUMERIC` settings." msgstr "" -#: ../../library/locale.rst:473 +#: ../../library/locale.rst:475 msgid "" "Converts a normalized number string into a formatted string following the :" "const:`LC_NUMERIC` settings." msgstr "" -#: ../../library/locale.rst:481 +#: ../../library/locale.rst:483 msgid "" "Converts a string to a number, following the :const:`LC_NUMERIC` settings, " "by calling *func* on the result of calling :func:`delocalize` on *string*." msgstr "" -#: ../../library/locale.rst:487 +#: ../../library/locale.rst:489 msgid "" "Converts a string to an integer, following the :const:`LC_NUMERIC` " "conventions." msgstr "" -#: ../../library/locale.rst:492 +#: ../../library/locale.rst:494 msgid "" "Locale category for the character type functions. Most importantly, this " "category defines the text encoding, i.e. how bytes are interpreted as " @@ -688,32 +690,32 @@ msgid "" "SSH connections." msgstr "" -#: ../../library/locale.rst:499 +#: ../../library/locale.rst:501 msgid "" "Python doesn't internally use locale-dependent character transformation " "functions from ``ctype.h``. Instead, an internal ``pyctype.h`` provides " "locale-independent equivalents like :c:macro:`!Py_TOLOWER`." msgstr "" -#: ../../library/locale.rst:506 +#: ../../library/locale.rst:508 msgid "" "Locale category for sorting strings. The functions :func:`strcoll` and :" "func:`strxfrm` of the :mod:`locale` module are affected." msgstr "" -#: ../../library/locale.rst:512 +#: ../../library/locale.rst:514 msgid "" "Locale category for the formatting of time. The function :func:`time." "strftime` follows these conventions." msgstr "" -#: ../../library/locale.rst:518 +#: ../../library/locale.rst:520 msgid "" "Locale category for formatting of monetary values. The available options " "are available from the :func:`localeconv` function." msgstr "" -#: ../../library/locale.rst:524 +#: ../../library/locale.rst:526 msgid "" "Locale category for message display. Python currently does not support " "application specific locale-aware messages. Messages displayed by the " @@ -721,13 +723,13 @@ msgid "" "affected by this category." msgstr "" -#: ../../library/locale.rst:529 +#: ../../library/locale.rst:531 msgid "" "This value may not be available on operating systems not conforming to the " "POSIX standard, most notably Windows." msgstr "" -#: ../../library/locale.rst:535 +#: ../../library/locale.rst:537 msgid "" "Locale category for formatting numbers. The functions :func:" "`format_string`, :func:`atoi`, :func:`atof` and :func:`.str` of the :mod:" @@ -735,7 +737,7 @@ msgid "" "operations are not affected." msgstr "" -#: ../../library/locale.rst:543 +#: ../../library/locale.rst:545 msgid "" "Combination of all locale settings. If this flag is used when the locale is " "changed, setting the locale for all categories is attempted. If that fails " @@ -745,17 +747,17 @@ msgid "" "settings." msgstr "" -#: ../../library/locale.rst:552 +#: ../../library/locale.rst:554 msgid "" "This is a symbolic constant used for different values returned by :func:" "`localeconv`." msgstr "" -#: ../../library/locale.rst:556 +#: ../../library/locale.rst:558 msgid "Example::" msgstr "範例: ::" -#: ../../library/locale.rst:558 +#: ../../library/locale.rst:560 msgid "" ">>> import locale\n" ">>> loc = locale.getlocale() # get current locale\n" @@ -768,11 +770,11 @@ msgid "" ">>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale" msgstr "" -#: ../../library/locale.rst:569 +#: ../../library/locale.rst:571 msgid "Background, details, hints, tips and caveats" msgstr "" -#: ../../library/locale.rst:571 +#: ../../library/locale.rst:573 msgid "" "The C standard defines the locale as a program-wide property that may be " "relatively expensive to change. On top of that, some implementations are " @@ -780,7 +782,7 @@ msgid "" "This makes the locale somewhat painful to use correctly." msgstr "" -#: ../../library/locale.rst:576 +#: ../../library/locale.rst:578 msgid "" "Initially, when a program is started, the locale is the ``C`` locale, no " "matter what the user's preferred locale is. There is one exception: the :" @@ -790,7 +792,7 @@ msgid "" "categories by calling ``setlocale(LC_ALL, '')``." msgstr "" -#: ../../library/locale.rst:583 +#: ../../library/locale.rst:585 msgid "" "It is generally a bad idea to call :func:`setlocale` in some library " "routine, since as a side effect it affects the entire program. Saving and " @@ -798,7 +800,7 @@ msgid "" "that happen to run before the settings have been restored." msgstr "" -#: ../../library/locale.rst:588 +#: ../../library/locale.rst:590 msgid "" "If, when coding a module for general use, you need a locale independent " "version of an operation that is affected by the locale (such as certain " @@ -809,14 +811,14 @@ msgid "" "settings." msgstr "" -#: ../../library/locale.rst:595 +#: ../../library/locale.rst:597 msgid "" "The only way to perform numeric operations according to the locale is to use " "the special functions defined by this module: :func:`atof`, :func:`atoi`, :" "func:`format_string`, :func:`.str`." msgstr "" -#: ../../library/locale.rst:599 +#: ../../library/locale.rst:601 msgid "" "There is no way to perform case conversions and character classifications " "according to the locale. For (Unicode) text strings these are done " @@ -827,11 +829,11 @@ msgid "" "whitespace." msgstr "" -#: ../../library/locale.rst:610 +#: ../../library/locale.rst:612 msgid "For extension writers and programs that embed Python" msgstr "" -#: ../../library/locale.rst:612 +#: ../../library/locale.rst:614 msgid "" "Extension modules should never call :func:`setlocale`, except to find out " "what the current locale is. But since the return value can only be used " @@ -839,7 +841,7 @@ msgid "" "whether or not the locale is ``C``)." msgstr "" -#: ../../library/locale.rst:617 +#: ../../library/locale.rst:619 msgid "" "When Python code uses the :mod:`locale` module to change the locale, this " "also affects the embedding application. If the embedding application " @@ -849,11 +851,11 @@ msgid "" "accessible as a shared library." msgstr "" -#: ../../library/locale.rst:628 +#: ../../library/locale.rst:630 msgid "Access to message catalogs" msgstr "" -#: ../../library/locale.rst:637 +#: ../../library/locale.rst:639 msgid "" "The locale module exposes the C library's gettext interface on systems that " "provide this interface. It consists of the functions :func:`gettext`, :func:" @@ -864,7 +866,7 @@ msgid "" "locating message catalogs." msgstr "" -#: ../../library/locale.rst:644 +#: ../../library/locale.rst:646 msgid "" "Python applications should normally find no need to invoke these functions, " "and should use :mod:`gettext` instead. A known exception to this rule are " diff --git a/library/mailcap.po b/library/mailcap.po new file mode 100644 index 0000000000..cfbe289d7a --- /dev/null +++ b/library/mailcap.po @@ -0,0 +1,39 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/mailcap.rst:2 +msgid ":mod:`!mailcap` --- Mailcap file handling" +msgstr ":mod:`!mailcap` --- Mailcap 檔案處理" + +#: ../../library/mailcap.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/mailcap.rst:14 +msgid "" +"The last version of Python that provided the :mod:`!mailcap` module was " +"`Python 3.12 `_." +msgstr "" +"最後提供 :mod:`!mailcap` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/marshal.po b/library/marshal.po index 472d892438..03ab684ed4 100644 --- a/library/marshal.po +++ b/library/marshal.po @@ -73,7 +73,6 @@ msgstr "" "unmarshal 來自不受信任的或來源未經驗證的資料。" #: ../../library/marshal.rst:43 -#, fuzzy msgid "" "Not all Python object types are supported; in general, only objects whose " "value is independent from a particular invocation of Python can be written " @@ -91,11 +90,11 @@ msgstr "" "特定 Python 調用 (invocation) 的物件。下列型別是有支援的:布林 (boolean)、整" "數、浮點數 (floating-point number)、複數、字串、位元組串 (bytes)、位元組陣列 " "(bytearray)、元組 (tuple)、list、集合 (set)、凍結集合 (frozenset)、" -"dictionary 和程式碼物件,需要了解的一點是元組、list、集合、凍結集合和 " -"dictionary 只在其所包含的值也屬於這些型別時才會支援。單例 (singleton) 物件 :" -"const:`None`、:const:`Ellipsis` 和 :exc:`StopIteration` 也可以被 marshal 和 " -"unmarshal。對於 *version* 低於 3 的格式,遞迴 list、集合和 dictionary 無法被" -"寫入(見下文)。" +"dictionary 和程式碼物件(如 *allow_code* 為 true),需要了解的一點是元組、" +"list、集合、凍結集合和 dictionary 只在其所包含的值也屬於這些型別時才會支援。" +"單例 (singleton) 物件 :const:`None`、:const:`Ellipsis` 和 :exc:" +"`StopIteration` 也可以被 marshal 和 unmarshal。對於 *version* 低於 3 的格式," +"遞迴 list、集合和 dictionary 無法被寫入(見下文)。" #: ../../library/marshal.rst:56 msgid "" @@ -117,7 +116,6 @@ msgstr "" "file`。" #: ../../library/marshal.rst:67 -#, fuzzy msgid "" "If the value has (or contains an object that has) an unsupported type, a :" "exc:`ValueError` exception is raised --- but garbage data will also be " @@ -127,7 +125,8 @@ msgid "" msgstr "" "如果值具有(或其所包含的物件具有)不支援的型別,則會引發 :exc:`ValueError` 例" "外 --- 但是垃圾資料 (garbage data) 也將寫入檔案,物件也無法正確地透過 :func:" -"`load` 重新讀取。" +"`load` 重新讀取。:ref:`程式碼物件 `\\ 只有在 *allow_code* 為 " +"true 時才會支援。" #: ../../library/marshal.rst:72 msgid "" @@ -146,10 +145,9 @@ msgstr "" #: ../../library/marshal.rst:77 ../../library/marshal.rst:101 #: ../../library/marshal.rst:117 ../../library/marshal.rst:135 msgid "Added the *allow_code* parameter." -msgstr "" +msgstr "新增 *allow_code* 參數。" #: ../../library/marshal.rst:83 -#, fuzzy msgid "" "Read one value from the open file and return it. If no valid value is read " "(e.g. because the data has a different Python version's incompatible marshal " @@ -159,7 +157,8 @@ msgid "" msgstr "" "從開啟的檔案讀取一個值並回傳。如果讀不到有效的值(例如,由於資料為不同 " "Python 版本的不相容 marshal 格式),則會引發 :exc:`EOFError`、:exc:" -"`ValueError` 或 :exc:`TypeError`。檔案必須為可讀取的 :term:`binary file`。" +"`ValueError` 或 :exc:`TypeError`。:ref:`程式碼物件 `\\ 只有在 " +"*allow_code* 為 true 時才會支援。檔案必須為可讀取的 :term:`binary file`。" #: ../../library/marshal.rst:89 msgid "" @@ -184,7 +183,6 @@ msgstr "" "載入操作引發單個 ``marshal.load`` 事件。" #: ../../library/marshal.rst:107 -#, fuzzy msgid "" "Return the bytes object that would be written to a file by ``dump(value, " "file)``. The value must be a supported type. Raise a :exc:`ValueError` " @@ -194,7 +192,8 @@ msgid "" msgstr "" "回傳將透過 ``dump(value, file)`` 來被寫入一個檔案的位元組串物件,其值必須是有" "支援的型別,如果值(或其包含的任一物件)為不支援的型別則會引發 :exc:" -"`ValueError`。" +"`ValueError`。:ref:`程式碼物件 `\\ 只有在 *allow_code* 為 true " +"時才會支援。" #: ../../library/marshal.rst:112 msgid "" @@ -203,7 +202,6 @@ msgid "" msgstr "*version* 引數指明 ``dumps`` 應當使用的資料型別(見下文)。" #: ../../library/marshal.rst:123 -#, fuzzy msgid "" "Convert the :term:`bytes-like object` to a value. If no valid value is " "found, raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. :ref:" @@ -211,8 +209,9 @@ msgid "" "Extra bytes in the input are ignored." msgstr "" "將 :term:`bytes-like object` 轉換為一個值。如果找不到有效的值,則會引發 :exc:" -"`EOFError`、:exc:`ValueError` 或 :exc:`TypeError`。輸入中額外的位元組串會被忽" -"略。" +"`EOFError`、:exc:`ValueError` 或 :exc:`TypeError`。:ref:`程式碼物件 `\\ 只有在 *allow_code* 為 true 時才會支援。輸入中額外的位元組串會被" +"忽略。" #: ../../library/marshal.rst:128 msgid "" diff --git a/library/math.po b/library/math.po index 84d6d52e0d..8280532b1a 100644 --- a/library/math.po +++ b/library/math.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-05 00:13+0000\n" +"POT-Creation-Date: 2024-11-20 00:14+0000\n" "PO-Revision-Date: 2024-04-26 15:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,566 +51,568 @@ msgid "" msgstr "此模組提供下列函式。除非特意註明,否則回傳值皆為浮點數。" #: ../../library/math.rst:30 -msgid "**Number-theoretic and representation functions**" -msgstr "**數論與表現函式**" +msgid "**Number-theoretic functions**" +msgstr "**數論函式**" #: ../../library/math.rst:32 -msgid ":func:`ceil(x) `" -msgstr ":func:`ceil(x) `" - -#: ../../library/math.rst:32 -msgid "Ceiling of *x*, the smallest integer greater than or equal to *x*" -msgstr "" - -#: ../../library/math.rst:33 msgid ":func:`comb(n, k) `" msgstr ":func:`comb(n, k) `" -#: ../../library/math.rst:33 +#: ../../library/math.rst:32 msgid "" "Number of ways to choose *k* items from *n* items without repetition and " "without order" msgstr "從 *n* 個物品中不重複且不考慮排序地取出 *k* 個物品的方法數。" +#: ../../library/math.rst:33 +msgid ":func:`factorial(n) `" +msgstr ":func:`factorial(n) `" + +#: ../../library/math.rst:33 +msgid "*n* factorial" +msgstr "" + #: ../../library/math.rst:34 -msgid ":func:`copysign(x, y) `" -msgstr ":func:`copysign(x, y) `" +msgid ":func:`gcd(*integers) `" +msgstr ":func:`gcd(*integers) `" #: ../../library/math.rst:34 -msgid "Magnitude (absolute value) of *x* with the sign of *y*" +msgid "Greatest common divisor of the integer arguments" msgstr "" #: ../../library/math.rst:35 -msgid ":func:`fabs(x) `" -msgstr ":func:`fabs(x) `" +msgid ":func:`isqrt(n) `" +msgstr ":func:`isqrt(n) `" #: ../../library/math.rst:35 -msgid "Absolute value of *x*" -msgstr "*x* 的絕對值。" +msgid "Integer square root of a nonnegative integer *n*" +msgstr "" #: ../../library/math.rst:36 -msgid ":func:`factorial(n) `" -msgstr ":func:`factorial(n) `" +msgid ":func:`lcm(*integers) `" +msgstr ":func:`lcm(*integers) `" #: ../../library/math.rst:36 -msgid "*n* factorial" +msgid "Least common multiple of the integer arguments" msgstr "" #: ../../library/math.rst:37 -msgid ":func:`floor (x) `" -msgstr ":func:`floor (x) `" +msgid ":func:`perm(n, k) `" +msgstr ":func:`perm(n, k) `" #: ../../library/math.rst:37 -msgid "Floor of *x*, the largest integer less than or equal to *x*" -msgstr "" - -#: ../../library/math.rst:38 -msgid ":func:`fma(x, y, z) `" -msgstr ":func:`fma(x, y, z) `" - -#: ../../library/math.rst:38 -msgid "Fused multiply-add operation: ``(x * y) + z``" -msgstr "" - -#: ../../library/math.rst:39 -msgid ":func:`fmod(x, y) `" -msgstr ":func:`fmod(x, y) `" +msgid "" +"Number of ways to choose *k* items from *n* items without repetition and " +"with order" +msgstr "從 *n* 個物品中不重複但考慮排序地取出 *k* 個物品的方法數。" #: ../../library/math.rst:39 -msgid "Remainder of division ``x / y``" -msgstr "" - -#: ../../library/math.rst:40 -msgid ":func:`frexp(x) `" -msgstr ":func:`frexp(x) `" - -#: ../../library/math.rst:40 -msgid "Mantissa and exponent of *x*" +msgid "**Floating point arithmetic**" msgstr "" #: ../../library/math.rst:41 -msgid ":func:`fsum(iterable) `" -msgstr ":func:`fsum(iterable) `" +msgid ":func:`ceil(x) `" +msgstr ":func:`ceil(x) `" #: ../../library/math.rst:41 -msgid "Sum of values in the input *iterable*" +msgid "Ceiling of *x*, the smallest integer greater than or equal to *x*" msgstr "" #: ../../library/math.rst:42 -msgid ":func:`gcd(*integers) `" -msgstr ":func:`gcd(*integers) `" +msgid ":func:`fabs(x) `" +msgstr ":func:`fabs(x) `" #: ../../library/math.rst:42 -msgid "Greatest common divisor of the integer arguments" -msgstr "" +msgid "Absolute value of *x*" +msgstr "*x* 的絕對值。" #: ../../library/math.rst:43 -msgid ":func:`isclose(a, b, rel_tol, abs_tol) `" -msgstr ":func:`isclose(a, b, rel_tol, abs_tol) `" +msgid ":func:`floor(x) `" +msgstr ":func:`floor(x) `" #: ../../library/math.rst:43 -msgid "Check if the values *a* and *b* are close to each other" +msgid "Floor of *x*, the largest integer less than or equal to *x*" msgstr "" #: ../../library/math.rst:44 -msgid ":func:`isfinite(x) `" -msgstr ":func:`isfinite(x) `" +msgid ":func:`fma(x, y, z) `" +msgstr ":func:`fma(x, y, z) `" #: ../../library/math.rst:44 -msgid "Check if *x* is neither an infinity nor a NaN" +msgid "Fused multiply-add operation: ``(x * y) + z``" msgstr "" #: ../../library/math.rst:45 -msgid ":func:`isinf(x) `" -msgstr ":func:`isinf(x) `" +msgid ":func:`fmod(x, y) `" +msgstr ":func:`fmod(x, y) `" #: ../../library/math.rst:45 -msgid "Check if *x* is a positive or negative infinity" +msgid "Remainder of division ``x / y``" msgstr "" #: ../../library/math.rst:46 -msgid ":func:`isnan(x) `" -msgstr ":func:`isnan(x) `" +msgid ":func:`modf(x) `" +msgstr ":func:`modf(x) `" #: ../../library/math.rst:46 -msgid "Check if *x* is a NaN (not a number)" +msgid "Fractional and integer parts of *x*" msgstr "" #: ../../library/math.rst:47 -msgid ":func:`isqrt(n) `" -msgstr ":func:`isqrt(n) `" +msgid ":func:`remainder(x, y) `" +msgstr ":func:`remainder(x, y) `" #: ../../library/math.rst:47 -msgid "Integer square root of a nonnegative integer *n*" +msgid "Remainder of *x* with respect to *y*" msgstr "" #: ../../library/math.rst:48 -msgid ":func:`lcm(*integers) `" -msgstr ":func:`lcm(*integers) `" +msgid ":func:`trunc(x) `" +msgstr ":func:`trunc(x) `" #: ../../library/math.rst:48 -msgid "Least common multiple of the integer arguments" -msgstr "" - -#: ../../library/math.rst:49 -msgid ":func:`ldexp(x, i) `" -msgstr ":func:`ldexp(x, i) `" - -#: ../../library/math.rst:49 -msgid "``x * (2**i)``, inverse of function :func:`frexp`" +msgid "Integer part of *x*" msgstr "" #: ../../library/math.rst:50 -msgid ":func:`modf(x) `" -msgstr ":func:`modf(x) `" - -#: ../../library/math.rst:50 -msgid "Fractional and integer parts of *x*" -msgstr "" - -#: ../../library/math.rst:51 -msgid ":func:`nextafter(x, y, steps) `" -msgstr ":func:`nextafter(x, y, steps) `" - -#: ../../library/math.rst:51 -msgid "Floating-point value *steps* steps after *x* towards *y*" -msgstr "" +msgid "**Floating point manipulation functions**" +msgstr "**浮點數操作函式**" #: ../../library/math.rst:52 -msgid ":func:`perm(n, k) `" -msgstr ":func:`perm(n, k) `" +msgid ":func:`copysign(x, y) `" +msgstr ":func:`copysign(x, y) `" #: ../../library/math.rst:52 -msgid "" -"Number of ways to choose *k* items from *n* items without repetition and " -"with order" -msgstr "從 *n* 個物品中不重複但考慮排序地取出 *k* 個物品的方法數。" +msgid "Magnitude (absolute value) of *x* with the sign of *y*" +msgstr "" #: ../../library/math.rst:53 -msgid ":func:`prod(iterable, start) `" -msgstr ":func:`prod(iterable, start) `" +msgid ":func:`frexp(x) `" +msgstr ":func:`frexp(x) `" #: ../../library/math.rst:53 -msgid "Product of elements in the input *iterable* with a *start* value" +msgid "Mantissa and exponent of *x*" msgstr "" #: ../../library/math.rst:54 -msgid ":func:`remainder(x, y) `" -msgstr ":func:`remainder(x, y) `" +msgid ":func:`isclose(a, b, rel_tol, abs_tol) `" +msgstr ":func:`isclose(a, b, rel_tol, abs_tol) `" #: ../../library/math.rst:54 -msgid "Remainder of *x* with respect to *y*" +msgid "Check if the values *a* and *b* are close to each other" msgstr "" #: ../../library/math.rst:55 -msgid ":func:`sumprod(p, q) `" -msgstr ":func:`sumprod(p, q) `" +msgid ":func:`isfinite(x) `" +msgstr ":func:`isfinite(x) `" #: ../../library/math.rst:55 -msgid "Sum of products from two iterables *p* and *q*" +msgid "Check if *x* is neither an infinity nor a NaN" msgstr "" #: ../../library/math.rst:56 -msgid ":func:`trunc(x) `" -msgstr ":func:`trunc(x) `" +msgid ":func:`isinf(x) `" +msgstr ":func:`isinf(x) `" #: ../../library/math.rst:56 -msgid "Integer part of *x*" +msgid "Check if *x* is a positive or negative infinity" msgstr "" #: ../../library/math.rst:57 +msgid ":func:`isnan(x) `" +msgstr ":func:`isnan(x) `" + +#: ../../library/math.rst:57 +msgid "Check if *x* is a NaN (not a number)" +msgstr "" + +#: ../../library/math.rst:58 +msgid ":func:`ldexp(x, i) `" +msgstr ":func:`ldexp(x, i) `" + +#: ../../library/math.rst:58 +msgid "``x * (2**i)``, inverse of function :func:`frexp`" +msgstr "" + +#: ../../library/math.rst:59 +msgid ":func:`nextafter(x, y, steps) `" +msgstr ":func:`nextafter(x, y, steps) `" + +#: ../../library/math.rst:59 +msgid "Floating-point value *steps* steps after *x* towards *y*" +msgstr "" + +#: ../../library/math.rst:60 msgid ":func:`ulp(x) `" msgstr ":func:`ulp(x) `" -#: ../../library/math.rst:57 +#: ../../library/math.rst:60 msgid "Value of the least significant bit of *x*" msgstr "" -#: ../../library/math.rst:59 -msgid "**Power and logarithmic functions**" +#: ../../library/math.rst:62 +msgid "**Power, exponential and logarithmic functions**" msgstr "" -#: ../../library/math.rst:61 +#: ../../library/math.rst:64 msgid ":func:`cbrt(x) `" msgstr ":func:`cbrt(x) `" -#: ../../library/math.rst:61 +#: ../../library/math.rst:64 msgid "Cube root of *x*" msgstr "" -#: ../../library/math.rst:62 +#: ../../library/math.rst:65 msgid ":func:`exp(x) `" msgstr ":func:`exp(x) `" -#: ../../library/math.rst:62 +#: ../../library/math.rst:65 msgid "*e* raised to the power *x*" msgstr "" -#: ../../library/math.rst:63 +#: ../../library/math.rst:66 msgid ":func:`exp2(x) `" msgstr ":func:`exp2(x) `" -#: ../../library/math.rst:63 +#: ../../library/math.rst:66 msgid "*2* raised to the power *x*" msgstr "" -#: ../../library/math.rst:64 +#: ../../library/math.rst:67 msgid ":func:`expm1(x) `" msgstr ":func:`expm1(x) `" -#: ../../library/math.rst:64 +#: ../../library/math.rst:67 msgid "*e* raised to the power *x*, minus 1" msgstr "" -#: ../../library/math.rst:65 +#: ../../library/math.rst:68 msgid ":func:`log(x, base) `" msgstr ":func:`log(x, base) `" -#: ../../library/math.rst:65 +#: ../../library/math.rst:68 msgid "Logarithm of *x* to the given base (*e* by default)" msgstr "" -#: ../../library/math.rst:66 +#: ../../library/math.rst:69 msgid ":func:`log1p(x) `" msgstr ":func:`log1p(x) `" -#: ../../library/math.rst:66 +#: ../../library/math.rst:69 msgid "Natural logarithm of *1+x* (base *e*)" msgstr "" -#: ../../library/math.rst:67 +#: ../../library/math.rst:70 msgid ":func:`log2(x) `" msgstr ":func:`log2(x) `" -#: ../../library/math.rst:67 +#: ../../library/math.rst:70 msgid "Base-2 logarithm of *x*" msgstr "" -#: ../../library/math.rst:68 +#: ../../library/math.rst:71 msgid ":func:`log10(x) `" msgstr ":func:`log10(x) `" -#: ../../library/math.rst:68 +#: ../../library/math.rst:71 msgid "Base-10 logarithm of *x*" msgstr "" -#: ../../library/math.rst:69 +#: ../../library/math.rst:72 msgid ":func:`pow(x, y) `" msgstr ":func:`pow(x, y) `" -#: ../../library/math.rst:69 +#: ../../library/math.rst:72 msgid "*x* raised to the power *y*" msgstr "" -#: ../../library/math.rst:70 +#: ../../library/math.rst:73 msgid ":func:`sqrt(x) `" msgstr ":func:`sqrt(x) `" -#: ../../library/math.rst:70 +#: ../../library/math.rst:73 msgid "Square root of *x*" msgstr "*x* 的平方根" -#: ../../library/math.rst:72 +#: ../../library/math.rst:75 +msgid "**Summation and product functions**" +msgstr "" + +#: ../../library/math.rst:77 +msgid ":func:`dist(p, q) `" +msgstr ":func:`dist(p, q) `" + +#: ../../library/math.rst:77 +msgid "" +"Euclidean distance between two points *p* and *q* given as an iterable of " +"coordinates" +msgstr "" + +#: ../../library/math.rst:78 +msgid ":func:`fsum(iterable) `" +msgstr ":func:`fsum(iterable) `" + +#: ../../library/math.rst:78 +msgid "Sum of values in the input *iterable*" +msgstr "" + +#: ../../library/math.rst:79 +msgid ":func:`hypot(*coordinates) `" +msgstr ":func:`hypot(*coordinates) `" + +#: ../../library/math.rst:79 +msgid "Euclidean norm of an iterable of coordinates" +msgstr "" + +#: ../../library/math.rst:80 +msgid ":func:`prod(iterable, start) `" +msgstr ":func:`prod(iterable, start) `" + +#: ../../library/math.rst:80 +msgid "Product of elements in the input *iterable* with a *start* value" +msgstr "" + +#: ../../library/math.rst:81 +msgid ":func:`sumprod(p, q) `" +msgstr ":func:`sumprod(p, q) `" + +#: ../../library/math.rst:81 +msgid "Sum of products from two iterables *p* and *q*" +msgstr "" + +#: ../../library/math.rst:83 +msgid "**Angular conversion**" +msgstr "" + +#: ../../library/math.rst:85 +msgid ":func:`degrees(x) `" +msgstr ":func:`degrees(x) `" + +#: ../../library/math.rst:85 +msgid "Convert angle *x* from radians to degrees" +msgstr "" + +#: ../../library/math.rst:86 +msgid ":func:`radians(x) `" +msgstr ":func:`radians(x) `" + +#: ../../library/math.rst:86 +msgid "Convert angle *x* from degrees to radians" +msgstr "" + +#: ../../library/math.rst:88 msgid "**Trigonometric functions**" msgstr "" -#: ../../library/math.rst:74 +#: ../../library/math.rst:90 msgid ":func:`acos(x) `" msgstr ":func:`acos(x) `" -#: ../../library/math.rst:74 +#: ../../library/math.rst:90 msgid "Arc cosine of *x*" msgstr "" -#: ../../library/math.rst:75 +#: ../../library/math.rst:91 msgid ":func:`asin(x) `" msgstr ":func:`asin(x) `" -#: ../../library/math.rst:75 +#: ../../library/math.rst:91 msgid "Arc sine of *x*" msgstr "" -#: ../../library/math.rst:76 +#: ../../library/math.rst:92 msgid ":func:`atan(x) `" msgstr ":func:`atan(x) `" -#: ../../library/math.rst:76 +#: ../../library/math.rst:92 msgid "Arc tangent of *x*" msgstr "" -#: ../../library/math.rst:77 +#: ../../library/math.rst:93 msgid ":func:`atan2(y, x) `" msgstr ":func:`atan2(y, x) `" -#: ../../library/math.rst:77 +#: ../../library/math.rst:93 msgid "``atan(y / x)``" msgstr "``atan(y / x)``" -#: ../../library/math.rst:78 +#: ../../library/math.rst:94 msgid ":func:`cos(x) `" msgstr ":func:`cos(x) `" -#: ../../library/math.rst:78 +#: ../../library/math.rst:94 msgid "Cosine of *x*" msgstr "" -#: ../../library/math.rst:79 -msgid ":func:`dist(p, q) `" -msgstr ":func:`dist(p, q) `" - -#: ../../library/math.rst:79 -msgid "" -"Euclidean distance between two points *p* and *q* given as an iterable of " -"coordinates" -msgstr "" - -#: ../../library/math.rst:80 -msgid ":func:`hypot(*coordinates) `" -msgstr ":func:`hypot(*coordinates) `" - -#: ../../library/math.rst:80 -msgid "Euclidean norm of an iterable of coordinates" -msgstr "" - -#: ../../library/math.rst:81 +#: ../../library/math.rst:95 msgid ":func:`sin(x) `" msgstr ":func:`sin(x) `" -#: ../../library/math.rst:81 +#: ../../library/math.rst:95 msgid "Sine of *x*" msgstr "" -#: ../../library/math.rst:82 +#: ../../library/math.rst:96 msgid ":func:`tan(x) `" msgstr ":func:`tan(x) `" -#: ../../library/math.rst:82 +#: ../../library/math.rst:96 msgid "Tangent of *x*" msgstr "" -#: ../../library/math.rst:84 -msgid "**Angular conversion**" -msgstr "" - -#: ../../library/math.rst:86 -msgid ":func:`degrees(x) `" -msgstr ":func:`degrees(x) `" - -#: ../../library/math.rst:86 -msgid "Convert angle *x* from radians to degrees" -msgstr "" - -#: ../../library/math.rst:87 -msgid ":func:`radians(x) `" -msgstr ":func:`radians(x) `" - -#: ../../library/math.rst:87 -msgid "Convert angle *x* from degrees to radians" -msgstr "" - -#: ../../library/math.rst:89 +#: ../../library/math.rst:98 msgid "**Hyperbolic functions**" msgstr "" -#: ../../library/math.rst:91 +#: ../../library/math.rst:100 msgid ":func:`acosh(x) `" msgstr ":func:`acosh(x) `" -#: ../../library/math.rst:91 +#: ../../library/math.rst:100 msgid "Inverse hyperbolic cosine of *x*" msgstr "" -#: ../../library/math.rst:92 +#: ../../library/math.rst:101 msgid ":func:`asinh(x) `" msgstr ":func:`asinh(x) `" -#: ../../library/math.rst:92 +#: ../../library/math.rst:101 msgid "Inverse hyperbolic sine of *x*" msgstr "" -#: ../../library/math.rst:93 +#: ../../library/math.rst:102 msgid ":func:`atanh(x) `" msgstr ":func:`atanh(x) `" -#: ../../library/math.rst:93 +#: ../../library/math.rst:102 msgid "Inverse hyperbolic tangent of *x*" msgstr "" -#: ../../library/math.rst:94 +#: ../../library/math.rst:103 msgid ":func:`cosh(x) `" msgstr ":func:`cosh(x) `" -#: ../../library/math.rst:94 +#: ../../library/math.rst:103 msgid "Hyperbolic cosine of *x*" msgstr "" -#: ../../library/math.rst:95 +#: ../../library/math.rst:104 msgid ":func:`sinh(x) `" msgstr ":func:`sinh(x) `" -#: ../../library/math.rst:95 +#: ../../library/math.rst:104 msgid "Hyperbolic sine of *x*" msgstr "" -#: ../../library/math.rst:96 +#: ../../library/math.rst:105 msgid ":func:`tanh(x) `" msgstr ":func:`tanh(x) `" -#: ../../library/math.rst:96 +#: ../../library/math.rst:105 msgid "Hyperbolic tangent of *x*" msgstr "" -#: ../../library/math.rst:98 +#: ../../library/math.rst:107 msgid "**Special functions**" msgstr "" -#: ../../library/math.rst:100 +#: ../../library/math.rst:109 msgid ":func:`erf(x) `" msgstr ":func:`erf(x) `" -#: ../../library/math.rst:100 +#: ../../library/math.rst:109 msgid "`Error function `_ at *x*" msgstr "" -#: ../../library/math.rst:101 +#: ../../library/math.rst:110 msgid ":func:`erfc(x) `" msgstr ":func:`erfc(x) `" -#: ../../library/math.rst:101 +#: ../../library/math.rst:110 msgid "" "`Complementary error function `_ at *x*" msgstr "" -#: ../../library/math.rst:102 +#: ../../library/math.rst:111 msgid ":func:`gamma(x) `" msgstr ":func:`gamma(x) `" -#: ../../library/math.rst:102 +#: ../../library/math.rst:111 msgid "`Gamma function `_ at *x*" msgstr "" -#: ../../library/math.rst:103 +#: ../../library/math.rst:112 msgid ":func:`lgamma(x) `" msgstr ":func:`lgamma(x) `" -#: ../../library/math.rst:103 +#: ../../library/math.rst:112 msgid "" "Natural logarithm of the absolute value of the `Gamma function `_ at *x*" msgstr "" -#: ../../library/math.rst:105 +#: ../../library/math.rst:114 msgid "**Constants**" msgstr "**常數**" -#: ../../library/math.rst:107 +#: ../../library/math.rst:116 msgid ":data:`pi`" msgstr ":data:`pi`" -#: ../../library/math.rst:107 +#: ../../library/math.rst:116 msgid "*π* = 3.141592..." msgstr "*π* = 3.141592..." -#: ../../library/math.rst:108 +#: ../../library/math.rst:117 msgid ":data:`e`" msgstr ":data:`e`" -#: ../../library/math.rst:108 +#: ../../library/math.rst:117 msgid "*e* = 2.718281..." msgstr "*e* = 2.718281..." -#: ../../library/math.rst:109 +#: ../../library/math.rst:118 msgid ":data:`tau`" msgstr ":data:`tau`" -#: ../../library/math.rst:109 +#: ../../library/math.rst:118 msgid "*τ* = 2\\ *π* = 6.283185..." msgstr "*τ* = 2\\ *π* = 6.283185..." -#: ../../library/math.rst:110 +#: ../../library/math.rst:119 msgid ":data:`inf`" msgstr ":data:`inf`" -#: ../../library/math.rst:110 +#: ../../library/math.rst:119 msgid "Positive infinity" msgstr "正無限大" -#: ../../library/math.rst:111 +#: ../../library/math.rst:120 msgid ":data:`nan`" msgstr ":data:`nan`" -#: ../../library/math.rst:111 +#: ../../library/math.rst:120 msgid "\"Not a number\" (NaN)" msgstr "" -#: ../../library/math.rst:116 -msgid "Number-theoretic and representation functions" -msgstr "數論與表現函式" - -#: ../../library/math.rst:120 -msgid "" -"Return the ceiling of *x*, the smallest integer greater than or equal to " -"*x*. If *x* is not a float, delegates to :meth:`x.__ceil__ `, which should return an :class:`~numbers.Integral` value." -msgstr "" -"回傳 *x* 經上取整的值,即大於或等於 *x* 的最小整數。若 *x* 並非浮點數,此函式" -"將委派給 :meth:`x.__ceil__ `,並回傳 :class:`~numbers." -"Integral` 型別的值。" +#: ../../library/math.rst:125 +msgid "Number-theoretic functions" +msgstr "數論函式" -#: ../../library/math.rst:127 +#: ../../library/math.rst:129 msgid "" "Return the number of ways to choose *k* items from *n* items without " "repetition and without order." msgstr "回傳從 *n* 個物品中不重複且不考慮排序地取出 *k* 個物品的方法數。" -#: ../../library/math.rst:130 +#: ../../library/math.rst:132 msgid "" "Evaluates to ``n! / (k! * (n - k)!)`` when ``k <= n`` and evaluates to zero " "when ``k > n``." msgstr "當 ``k <= n`` 時其值為 ``n! / (k! * (n - k)!)``,否則其值為 ``0``。" -#: ../../library/math.rst:133 +#: ../../library/math.rst:135 msgid "" "Also called the binomial coefficient because it is equivalent to the " "coefficient of k-th term in polynomial expansion of ``(1 + x)ⁿ``." @@ -618,7 +620,7 @@ msgstr "" "因為此值等同於 ``(1 + x)ⁿ`` 進行多項式展開後第 k 項的係數,所以又稱為二項式係" "數。" -#: ../../library/math.rst:137 ../../library/math.rst:362 +#: ../../library/math.rst:139 ../../library/math.rst:205 msgid "" "Raises :exc:`TypeError` if either of the arguments are not integers. Raises :" "exc:`ValueError` if either of the arguments are negative." @@ -626,32 +628,104 @@ msgstr "" "當任一參數非整數型別時會引發 :exc:`TypeError`。當任一參數為負數時會引發 :exc:" "`ValueError`。" -#: ../../library/math.rst:145 -msgid "" -"Return a float with the magnitude (absolute value) of *x* but the sign of " -"*y*. On platforms that support signed zeros, ``copysign(1.0, -0.0)`` " -"returns *-1.0*." -msgstr "" -"回傳與 *x* 相同長度(絕對值)且與 *y* 同號的浮點數。在支援帶符號零的平臺上," -"``copysign(1.0, -0.0)`` 回傳 *-1.0*。" - -#: ../../library/math.rst:152 -msgid "Return the absolute value of *x*." -msgstr "回傳 *x* 的絕對值。" - -#: ../../library/math.rst:157 +#: ../../library/math.rst:147 msgid "" "Return *n* factorial as an integer. Raises :exc:`ValueError` if *n* is not " "integral or is negative." msgstr "" "以整數回傳 *n* 的階乘。若 *n* 非整數型別或其值為負會引發 :exc:`ValueError`。" -#: ../../library/math.rst:160 -#, fuzzy +#: ../../library/math.rst:150 msgid "Floats with integral values (like ``5.0``) are no longer accepted." -msgstr "允許傳入其值為整數的浮點數(如:``5.0``)已被棄用。" +msgstr "其值為整數的浮點數(如:``5.0``)已不再被接受。" + +#: ../../library/math.rst:156 +msgid "" +"Return the greatest common divisor of the specified integer arguments. If " +"any of the arguments is nonzero, then the returned value is the largest " +"positive integer that is a divisor of all arguments. If all arguments are " +"zero, then the returned value is ``0``. ``gcd()`` without arguments returns " +"``0``." +msgstr "" +"回傳指定整數引數的最大公因數。若存在任一非零引數,回傳值為所有引數共有因數中" +"最大的正整數。若所有引數皆為零,則回傳值為 ``0``。``gcd()`` 若未傳入任何引數" +"也將回傳 ``0``。" + +#: ../../library/math.rst:164 +msgid "" +"Added support for an arbitrary number of arguments. Formerly, only two " +"arguments were supported." +msgstr "新增支援任意數量的引數。先前僅支援兩個引數。" + +#: ../../library/math.rst:171 +msgid "" +"Return the integer square root of the nonnegative integer *n*. This is the " +"floor of the exact square root of *n*, or equivalently the greatest integer " +"*a* such that *a*\\ ² |nbsp| ≤ |nbsp| *n*." +msgstr "" +"回傳非負整數 *n* 的整數平方根。此值為 *n* 精確平方根經下取整的值,亦等同於滿" +"足 *a*\\ ² |nbsp| ≤ |nbsp| *n* 的最大整數值 *a*。" + +#: ../../library/math.rst:175 +msgid "" +"For some applications, it may be more convenient to have the least integer " +"*a* such that *n* |nbsp| ≤ |nbsp| *a*\\ ², or in other words the ceiling of " +"the exact square root of *n*. For positive *n*, this can be computed using " +"``a = 1 + isqrt(n - 1)``." +msgstr "" +"於有些應用程式中,取得滿足 *n* |nbsp| ≤ |nbsp| *a*\\ ² 的最小整數值 *a* ── 或" +"者說 *n* 精確平方根經上取整的值 ── 會更加方便。對正數 *n*,此值可使用 ``a = " +"1 + isqrt(n - 1)`` 計算。" + +#: ../../library/math.rst:185 +msgid "" +"Return the least common multiple of the specified integer arguments. If all " +"arguments are nonzero, then the returned value is the smallest positive " +"integer that is a multiple of all arguments. If any of the arguments is " +"zero, then the returned value is ``0``. ``lcm()`` without arguments returns " +"``1``." +msgstr "" +"回傳指定整數引數的最小公倍數。若所有引數值皆非零,回傳值為所有引數共有倍數中" +"最小的正整數。若存在任一引數值為零,則回傳值為 ``0``。``lcm()`` 若未傳入任何" +"引數將回傳 ``1``。" + +#: ../../library/math.rst:196 +msgid "" +"Return the number of ways to choose *k* items from *n* items without " +"repetition and with order." +msgstr "" + +#: ../../library/math.rst:199 +msgid "" +"Evaluates to ``n! / (n - k)!`` when ``k <= n`` and evaluates to zero when " +"``k > n``." +msgstr "" + +#: ../../library/math.rst:202 +msgid "" +"If *k* is not specified or is ``None``, then *k* defaults to *n* and the " +"function returns ``n!``." +msgstr "" + +#: ../../library/math.rst:212 +msgid "Floating point arithmetic" +msgstr "" + +#: ../../library/math.rst:216 +msgid "" +"Return the ceiling of *x*, the smallest integer greater than or equal to " +"*x*. If *x* is not a float, delegates to :meth:`x.__ceil__ `, which should return an :class:`~numbers.Integral` value." +msgstr "" +"回傳 *x* 經上取整的值,即大於或等於 *x* 的最小整數。若 *x* 並非浮點數,此函式" +"將委派給 :meth:`x.__ceil__ `,並回傳 :class:`~numbers." +"Integral` 型別的值。" + +#: ../../library/math.rst:223 +msgid "Return the absolute value of *x*." +msgstr "回傳 *x* 的絕對值。" -#: ../../library/math.rst:166 +#: ../../library/math.rst:228 msgid "" "Return the floor of *x*, the largest integer less than or equal to *x*. If " "*x* is not a float, delegates to :meth:`x.__floor__ `, " @@ -661,7 +735,7 @@ msgstr "" "將委派給 :meth:`x.__floor__ `,並回傳 :class:`~numbers." "Integral` 型別的值。" -#: ../../library/math.rst:173 +#: ../../library/math.rst:235 msgid "" "Fused multiply-add operation. Return ``(x * y) + z``, computed as though " "with infinite precision and range followed by a single round to the " @@ -669,7 +743,7 @@ msgid "" "direct expression ``(x * y) + z``." msgstr "" -#: ../../library/math.rst:178 +#: ../../library/math.rst:240 msgid "" "This function follows the specification of the fusedMultiplyAdd operation " "described in the IEEE 754 standard. The standard leaves one case " @@ -678,7 +752,7 @@ msgid "" "not raise any exception." msgstr "" -#: ../../library/math.rst:189 +#: ../../library/math.rst:251 msgid "" "Return ``fmod(x, y)``, as defined by the platform C library. Note that the " "Python expression ``x % y`` may not return the same result. The intent of " @@ -702,72 +776,101 @@ msgstr "" "示成浮點數,並會四捨五入為出乎意料的 ``1e100``。因此,處理浮點數時通常會選擇" "函式 :func:`fmod`,而處理整數時會選擇 Python 運算式 ``x % y``。" -#: ../../library/math.rst:204 +#: ../../library/math.rst:266 msgid "" -"Return the mantissa and exponent of *x* as the pair ``(m, e)``. *m* is a " -"float and *e* is an integer such that ``x == m * 2**e`` exactly. If *x* is " -"zero, returns ``(0.0, 0)``, otherwise ``0.5 <= abs(m) < 1``. This is used " -"to \"pick apart\" the internal representation of a float in a portable way." +"Return the fractional and integer parts of *x*. Both results carry the sign " +"of *x* and are floats." msgstr "" -"以 ``(m, e)`` 對的格式回傳 *x* 的尾數 *m* 及指數 *e*。*m* 是浮點數而 *e* 是整" -"數,且兩者精確地使 ``x == m * 2**e``。若 *x* 為零,回傳 ``(0.0, 0)``,否則令 " -"``0.5 <= abs(m) < 1``。此函式用於以可攜的方式「分割」浮點數內部表示法。" -#: ../../library/math.rst:212 +#: ../../library/math.rst:269 msgid "" -"Return an accurate floating-point sum of values in the iterable. Avoids " -"loss of precision by tracking multiple intermediate partial sums." +"Note that :func:`modf` has a different call/return pattern than its C " +"equivalents: it takes a single argument and return a pair of values, rather " +"than returning its second return value through an 'output parameter' (there " +"is no such thing in Python)." msgstr "" -"回傳可疊代物件(iterable)中所有值的精確浮點數和。透過追蹤過程中多個部分和" -"(partial sum)以避免精確度損失。" -#: ../../library/math.rst:215 +#: ../../library/math.rst:277 msgid "" -"The algorithm's accuracy depends on IEEE-754 arithmetic guarantees and the " -"typical case where the rounding mode is half-even. On some non-Windows " -"builds, the underlying C library uses extended precision addition and may " -"occasionally double-round an intermediate sum causing it to be off in its " -"least significant bit." +"Return the IEEE 754-style remainder of *x* with respect to *y*. For finite " +"*x* and finite nonzero *y*, this is the difference ``x - n*y``, where ``n`` " +"is the closest integer to the exact value of the quotient ``x / y``. If " +"``x / y`` is exactly halfway between two consecutive integers, the nearest " +"*even* integer is used for ``n``. The remainder ``r = remainder(x, y)`` " +"thus always satisfies ``abs(r) <= 0.5 * abs(y)``." msgstr "" -"此演算法準確性奠基於保證 IEEE-754 浮點標準及典型奇進偶捨(half-even)模式。於" -"有些非 Windows 平台建置時,底層 C 函式庫使用延伸精度加法運算,而可能導致對過" -"程中同一部分和重複捨入,並使其最低有效位不如預期。" -#: ../../library/math.rst:221 +#: ../../library/math.rst:284 msgid "" -"For further discussion and two alternative approaches, see the `ASPN " -"cookbook recipes for accurate floating-point summation `_\\." +"Special cases follow IEEE 754: in particular, ``remainder(x, math.inf)`` is " +"*x* for any finite *x*, and ``remainder(x, 0)`` and ``remainder(math.inf, " +"x)`` raise :exc:`ValueError` for any non-NaN *x*. If the result of the " +"remainder operation is zero, that zero will have the same sign as *x*." msgstr "" -"更深入的討論及兩種替代做法請參閱 `ASPN cookbook recipes 精準的浮點數總和 " -"`_。" -#: ../../library/math.rst:228 +#: ../../library/math.rst:290 msgid "" -"Return the greatest common divisor of the specified integer arguments. If " -"any of the arguments is nonzero, then the returned value is the largest " -"positive integer that is a divisor of all arguments. If all arguments are " -"zero, then the returned value is ``0``. ``gcd()`` without arguments returns " -"``0``." +"On platforms using IEEE 754 binary floating point, the result of this " +"operation is always exactly representable: no rounding error is introduced." msgstr "" -"回傳指定整數引數的最大公因數。若存在任一非零引數,回傳值為所有引數共有因數中" -"最大的正整數。若所有引數皆為零,則回傳值為 ``0``。``gcd()`` 若未傳入任何引數" -"也將回傳 ``0``。" -#: ../../library/math.rst:236 +#: ../../library/math.rst:298 msgid "" -"Added support for an arbitrary number of arguments. Formerly, only two " -"arguments were supported." -msgstr "新增支援任意數量的引數。先前僅支援兩個引數。" +"Return *x* with the fractional part removed, leaving the integer part. This " +"rounds toward 0: ``trunc()`` is equivalent to :func:`floor` for positive " +"*x*, and equivalent to :func:`ceil` for negative *x*. If *x* is not a float, " +"delegates to :meth:`x.__trunc__ `, which should return an :" +"class:`~numbers.Integral` value." +msgstr "" + +#: ../../library/math.rst:305 +msgid "" +"For the :func:`ceil`, :func:`floor`, and :func:`modf` functions, note that " +"*all* floating-point numbers of sufficiently large magnitude are exact " +"integers. Python floats typically carry no more than 53 bits of precision " +"(the same as the platform C double type), in which case any float *x* with " +"``abs(x) >= 2**52`` necessarily has no fractional bits." +msgstr "" + +#: ../../library/math.rst:313 +msgid "Floating point manipulation functions" +msgstr "" + +#: ../../library/math.rst:317 +msgid "" +"Return a float with the magnitude (absolute value) of *x* but the sign of " +"*y*. On platforms that support signed zeros, ``copysign(1.0, -0.0)`` " +"returns *-1.0*." +msgstr "" +"回傳與 *x* 相同長度(絕對值)且與 *y* 同號的浮點數。在支援帶符號零的平臺上," +"``copysign(1.0, -0.0)`` 回傳 *-1.0*。" + +#: ../../library/math.rst:324 +msgid "" +"Return the mantissa and exponent of *x* as the pair ``(m, e)``. *m* is a " +"float and *e* is an integer such that ``x == m * 2**e`` exactly. If *x* is " +"zero, returns ``(0.0, 0)``, otherwise ``0.5 <= abs(m) < 1``. This is used " +"to \"pick apart\" the internal representation of a float in a portable way." +msgstr "" +"以 ``(m, e)`` 對的格式回傳 *x* 的尾數 *m* 及指數 *e*。*m* 是浮點數而 *e* 是整" +"數,且兩者精確地使 ``x == m * 2**e``。若 *x* 為零,回傳 ``(0.0, 0)``,否則令 " +"``0.5 <= abs(m) < 1``。此函式用於以可攜的方式「分割」浮點數內部表示法。" + +#: ../../library/math.rst:329 +msgid "" +"Note that :func:`frexp` has a different call/return pattern than its C " +"equivalents: it takes a single argument and return a pair of values, rather " +"than returning its second return value through an 'output parameter' (there " +"is no such thing in Python)." +msgstr "" -#: ../../library/math.rst:243 +#: ../../library/math.rst:336 msgid "" "Return ``True`` if the values *a* and *b* are close to each other and " "``False`` otherwise." msgstr "若 *a* 及 *b* 兩值足夠接近便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:246 +#: ../../library/math.rst:339 msgid "" "Whether or not two values are considered close is determined according to " "given absolute and relative tolerances. If no errors occur, the result will " @@ -776,7 +879,7 @@ msgstr "" "兩數是否足夠接近取決於給定的絕對及相對容許偏差 (tolerance)。如果沒有錯誤發" "生,結果將為:``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``。" -#: ../../library/math.rst:250 +#: ../../library/math.rst:343 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " @@ -790,7 +893,7 @@ msgstr "" "設值為 ``1e-09``,該值可確保兩數於大約 9 個十進數位內相同。*rel_tol* 須不為負" "且小於 ``1.0``。" -#: ../../library/math.rst:257 +#: ../../library/math.rst:350 msgid "" "*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " "nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " @@ -799,7 +902,7 @@ msgid "" "to the call." msgstr "" -#: ../../library/math.rst:263 +#: ../../library/math.rst:356 msgid "" "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " "handled according to IEEE rules. Specifically, ``NaN`` is not considered " @@ -810,11 +913,11 @@ msgstr "" "處理。更明確地說,``NaN`` 不會與包含自身在內的任何數字足夠接近,而 ``inf`` " "及 ``-inf`` 皆只與自身接近。" -#: ../../library/math.rst:272 +#: ../../library/math.rst:365 msgid ":pep:`485` -- A function for testing approximate equality" msgstr ":pep:`485` ── 用於測試近似相等的函式" -#: ../../library/math.rst:277 +#: ../../library/math.rst:370 msgid "" "Return ``True`` if *x* is neither an infinity nor a NaN, and ``False`` " "otherwise. (Note that ``0.0`` *is* considered finite.)" @@ -822,269 +925,128 @@ msgstr "" "若 *x* 不是無限值或 ``NaN`` 便回傳 ``True``,否則回傳 ``False``。(注意 " "``0.0`` 被視為有限數。)" -#: ../../library/math.rst:285 -msgid "" -"Return ``True`` if *x* is a positive or negative infinity, and ``False`` " -"otherwise." -msgstr "若 *x* 是正無限值或負無限值便回傳 ``True``,否則回傳 ``False``。" - -#: ../../library/math.rst:291 -msgid "" -"Return ``True`` if *x* is a NaN (not a number), and ``False`` otherwise." -msgstr "" -"若 *x* 是 ``NaN`` ── 即非數字(NaN, not a number)── 便回傳 ``True``,否則回" -"傳 ``False``。" - -#: ../../library/math.rst:296 -msgid "" -"Return the integer square root of the nonnegative integer *n*. This is the " -"floor of the exact square root of *n*, or equivalently the greatest integer " -"*a* such that *a*\\ ² |nbsp| ≤ |nbsp| *n*." -msgstr "" -"回傳非負整數 *n* 的整數平方根。此值為 *n* 精確平方根經下取整的值,亦等同於滿" -"足 *a*\\ ² |nbsp| ≤ |nbsp| *n* 的最大整數值 *a*。" - -#: ../../library/math.rst:300 +#: ../../library/math.rst:378 msgid "" -"For some applications, it may be more convenient to have the least integer " -"*a* such that *n* |nbsp| ≤ |nbsp| *a*\\ ², or in other words the ceiling of " -"the exact square root of *n*. For positive *n*, this can be computed using " -"``a = 1 + isqrt(n - 1)``." -msgstr "" -"於有些應用程式中,取得滿足 *n* |nbsp| ≤ |nbsp| *a*\\ ² 的最小整數值 *a* ── 或" -"者說 *n* 精確平方根經上取整的值 ── 會更加方便。對正數 *n*,此值可使用 ``a = " -"1 + isqrt(n - 1)`` 計算。" +"Return ``True`` if *x* is a positive or negative infinity, and ``False`` " +"otherwise." +msgstr "若 *x* 是正無限值或負無限值便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:310 +#: ../../library/math.rst:384 msgid "" -"Return the least common multiple of the specified integer arguments. If all " -"arguments are nonzero, then the returned value is the smallest positive " -"integer that is a multiple of all arguments. If any of the arguments is " -"zero, then the returned value is ``0``. ``lcm()`` without arguments returns " -"``1``." +"Return ``True`` if *x* is a NaN (not a number), and ``False`` otherwise." msgstr "" -"回傳指定整數引數的最小公倍數。若所有引數值皆非零,回傳值為所有引數共有倍數中" -"最小的正整數。若存在任一引數值為零,則回傳值為 ``0``。``lcm()`` 若未傳入任何" -"引數將回傳 ``1``。" +"若 *x* 是 ``NaN`` ── 即非數字(NaN, not a number)── 便回傳 ``True``,否則回" +"傳 ``False``。" -#: ../../library/math.rst:321 +#: ../../library/math.rst:389 msgid "" "Return ``x * (2**i)``. This is essentially the inverse of function :func:" "`frexp`." msgstr "回傳 ``x * (2**i)``。此函式本質上為 :func:`frexp` 的反函式。" -#: ../../library/math.rst:327 -msgid "" -"Return the fractional and integer parts of *x*. Both results carry the sign " -"of *x* and are floats." -msgstr "" - -#: ../../library/math.rst:333 +#: ../../library/math.rst:395 msgid "Return the floating-point value *steps* steps after *x* towards *y*." msgstr "" -#: ../../library/math.rst:335 +#: ../../library/math.rst:397 msgid "If *x* is equal to *y*, return *y*, unless *steps* is zero." msgstr "" -#: ../../library/math.rst:337 +#: ../../library/math.rst:399 msgid "Examples:" msgstr "範例:" -#: ../../library/math.rst:339 +#: ../../library/math.rst:401 msgid "``math.nextafter(x, math.inf)`` goes up: towards positive infinity." msgstr "" -#: ../../library/math.rst:340 +#: ../../library/math.rst:402 msgid "``math.nextafter(x, -math.inf)`` goes down: towards minus infinity." msgstr "" -#: ../../library/math.rst:341 +#: ../../library/math.rst:403 msgid "``math.nextafter(x, 0.0)`` goes towards zero." msgstr "" -#: ../../library/math.rst:342 +#: ../../library/math.rst:404 msgid "``math.nextafter(x, math.copysign(math.inf, x))`` goes away from zero." msgstr "" -#: ../../library/math.rst:344 +#: ../../library/math.rst:406 msgid "See also :func:`math.ulp`." msgstr "另請參閱 :func:`math.ulp`。" -#: ../../library/math.rst:348 +#: ../../library/math.rst:410 msgid "Added the *steps* argument." msgstr "新增 *steps* 引數。" -#: ../../library/math.rst:353 -msgid "" -"Return the number of ways to choose *k* items from *n* items without " -"repetition and with order." -msgstr "" - -#: ../../library/math.rst:356 -msgid "" -"Evaluates to ``n! / (n - k)!`` when ``k <= n`` and evaluates to zero when " -"``k > n``." -msgstr "" - -#: ../../library/math.rst:359 -msgid "" -"If *k* is not specified or is ``None``, then *k* defaults to *n* and the " -"function returns ``n!``." -msgstr "" - -#: ../../library/math.rst:370 -msgid "" -"Calculate the product of all the elements in the input *iterable*. The " -"default *start* value for the product is ``1``." -msgstr "" - -#: ../../library/math.rst:373 -msgid "" -"When the iterable is empty, return the start value. This function is " -"intended specifically for use with numeric values and may reject non-numeric " -"types." -msgstr "" - -#: ../../library/math.rst:382 -msgid "" -"Return the IEEE 754-style remainder of *x* with respect to *y*. For finite " -"*x* and finite nonzero *y*, this is the difference ``x - n*y``, where ``n`` " -"is the closest integer to the exact value of the quotient ``x / y``. If " -"``x / y`` is exactly halfway between two consecutive integers, the nearest " -"*even* integer is used for ``n``. The remainder ``r = remainder(x, y)`` " -"thus always satisfies ``abs(r) <= 0.5 * abs(y)``." -msgstr "" - -#: ../../library/math.rst:389 -msgid "" -"Special cases follow IEEE 754: in particular, ``remainder(x, math.inf)`` is " -"*x* for any finite *x*, and ``remainder(x, 0)`` and ``remainder(math.inf, " -"x)`` raise :exc:`ValueError` for any non-NaN *x*. If the result of the " -"remainder operation is zero, that zero will have the same sign as *x*." -msgstr "" - -#: ../../library/math.rst:395 -msgid "" -"On platforms using IEEE 754 binary floating point, the result of this " -"operation is always exactly representable: no rounding error is introduced." -msgstr "" - -#: ../../library/math.rst:403 -msgid "Return the sum of products of values from two iterables *p* and *q*." -msgstr "" - -#: ../../library/math.rst:405 -msgid "Raises :exc:`ValueError` if the inputs do not have the same length." -msgstr "" - -#: ../../library/math.rst:407 ../../library/math.rst:602 -msgid "Roughly equivalent to::" -msgstr "" - -#: ../../library/math.rst:409 -msgid "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" -msgstr "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" - -#: ../../library/math.rst:411 -msgid "" -"For float and mixed int/float inputs, the intermediate products and sums are " -"computed with extended precision." -msgstr "" - -#: ../../library/math.rst:419 -msgid "" -"Return *x* with the fractional part removed, leaving the integer part. This " -"rounds toward 0: ``trunc()`` is equivalent to :func:`floor` for positive " -"*x*, and equivalent to :func:`ceil` for negative *x*. If *x* is not a float, " -"delegates to :meth:`x.__trunc__ `, which should return an :" -"class:`~numbers.Integral` value." -msgstr "" - -#: ../../library/math.rst:427 +#: ../../library/math.rst:416 msgid "Return the value of the least significant bit of the float *x*:" msgstr "" -#: ../../library/math.rst:429 +#: ../../library/math.rst:418 msgid "If *x* is a NaN (not a number), return *x*." msgstr "" -#: ../../library/math.rst:430 +#: ../../library/math.rst:419 msgid "If *x* is negative, return ``ulp(-x)``." msgstr "若 *x* 為負值,回傳 ``ulp(-x)``。" -#: ../../library/math.rst:431 +#: ../../library/math.rst:420 msgid "If *x* is a positive infinity, return *x*." msgstr "若 *x* 為正無限值,回傳 *x*。" -#: ../../library/math.rst:432 +#: ../../library/math.rst:421 msgid "" "If *x* is equal to zero, return the smallest positive *denormalized* " "representable float (smaller than the minimum positive *normalized* float, :" "data:`sys.float_info.min `)." msgstr "" -#: ../../library/math.rst:435 +#: ../../library/math.rst:424 msgid "" "If *x* is equal to the largest positive representable float, return the " "value of the least significant bit of *x*, such that the first float smaller " "than *x* is ``x - ulp(x)``." msgstr "" -#: ../../library/math.rst:438 +#: ../../library/math.rst:427 msgid "" "Otherwise (*x* is a positive finite number), return the value of the least " "significant bit of *x*, such that the first float bigger than *x* is ``x + " "ulp(x)``." msgstr "" -#: ../../library/math.rst:442 +#: ../../library/math.rst:431 msgid "ULP stands for \"Unit in the Last Place\"." msgstr "" -#: ../../library/math.rst:444 +#: ../../library/math.rst:433 msgid "" "See also :func:`math.nextafter` and :data:`sys.float_info.epsilon `." msgstr "" -#: ../../library/math.rst:450 -msgid "" -"Note that :func:`frexp` and :func:`modf` have a different call/return " -"pattern than their C equivalents: they take a single argument and return a " -"pair of values, rather than returning their second return value through an " -"'output parameter' (there is no such thing in Python)." -msgstr "" - -#: ../../library/math.rst:455 -msgid "" -"For the :func:`ceil`, :func:`floor`, and :func:`modf` functions, note that " -"*all* floating-point numbers of sufficiently large magnitude are exact " -"integers. Python floats typically carry no more than 53 bits of precision " -"(the same as the platform C double type), in which case any float *x* with " -"``abs(x) >= 2**52`` necessarily has no fractional bits." -msgstr "" - -#: ../../library/math.rst:463 -msgid "Power and logarithmic functions" +#: ../../library/math.rst:440 +msgid "Power, exponential and logarithmic functions" msgstr "" -#: ../../library/math.rst:467 +#: ../../library/math.rst:444 msgid "Return the cube root of *x*." msgstr "" -#: ../../library/math.rst:474 +#: ../../library/math.rst:451 msgid "" "Return *e* raised to the power *x*, where *e* = 2.718281... is the base of " "natural logarithms. This is usually more accurate than ``math.e ** x`` or " "``pow(math.e, x)``." msgstr "" -#: ../../library/math.rst:481 +#: ../../library/math.rst:458 msgid "Return *2* raised to the power *x*." msgstr "" -#: ../../library/math.rst:488 +#: ../../library/math.rst:465 msgid "" "Return *e* raised to the power *x*, minus 1. Here *e* is the base of " "natural logarithms. For small floats *x*, the subtraction in ``exp(x) - 1`` " @@ -1093,41 +1055,41 @@ msgid "" "compute this quantity to full precision:" msgstr "" -#: ../../library/math.rst:505 +#: ../../library/math.rst:482 msgid "With one argument, return the natural logarithm of *x* (to base *e*)." msgstr "" -#: ../../library/math.rst:507 +#: ../../library/math.rst:484 msgid "" "With two arguments, return the logarithm of *x* to the given *base*, " "calculated as ``log(x)/log(base)``." msgstr "" -#: ../../library/math.rst:513 +#: ../../library/math.rst:490 msgid "" "Return the natural logarithm of *1+x* (base *e*). The result is calculated " "in a way which is accurate for *x* near zero." msgstr "" -#: ../../library/math.rst:519 +#: ../../library/math.rst:496 msgid "" "Return the base-2 logarithm of *x*. This is usually more accurate than " "``log(x, 2)``." msgstr "" -#: ../../library/math.rst:526 +#: ../../library/math.rst:503 msgid "" ":meth:`int.bit_length` returns the number of bits necessary to represent an " "integer in binary, excluding the sign and leading zeros." msgstr "" -#: ../../library/math.rst:532 +#: ../../library/math.rst:509 msgid "" "Return the base-10 logarithm of *x*. This is usually more accurate than " "``log(x, 10)``." msgstr "" -#: ../../library/math.rst:538 +#: ../../library/math.rst:515 msgid "" "Return *x* raised to the power *y*. Exceptional cases follow the IEEE 754 " "standard as far as possible. In particular, ``pow(1.0, x)`` and ``pow(x, " @@ -1136,178 +1098,247 @@ msgid "" "y)`` is undefined, and raises :exc:`ValueError`." msgstr "" -#: ../../library/math.rst:545 +#: ../../library/math.rst:522 msgid "" "Unlike the built-in ``**`` operator, :func:`math.pow` converts both its " "arguments to type :class:`float`. Use ``**`` or the built-in :func:`pow` " "function for computing exact integer powers." msgstr "" -#: ../../library/math.rst:549 +#: ../../library/math.rst:526 msgid "" "The special cases ``pow(0.0, -inf)`` and ``pow(-0.0, -inf)`` were changed to " "return ``inf`` instead of raising :exc:`ValueError`, for consistency with " "IEEE 754." msgstr "" -#: ../../library/math.rst:557 +#: ../../library/math.rst:534 msgid "Return the square root of *x*." msgstr "" -#: ../../library/math.rst:561 -msgid "Trigonometric functions" +#: ../../library/math.rst:538 +msgid "Summation and product functions" msgstr "" -#: ../../library/math.rst:565 +#: ../../library/math.rst:542 msgid "" -"Return the arc cosine of *x*, in radians. The result is between ``0`` and " -"``pi``." +"Return the Euclidean distance between two points *p* and *q*, each given as " +"a sequence (or iterable) of coordinates. The two points must have the same " +"dimension." msgstr "" -#: ../../library/math.rst:571 -msgid "" -"Return the arc sine of *x*, in radians. The result is between ``-pi/2`` and " -"``pi/2``." +#: ../../library/math.rst:546 ../../library/math.rst:607 +msgid "Roughly equivalent to::" msgstr "" -#: ../../library/math.rst:577 -msgid "" -"Return the arc tangent of *x*, in radians. The result is between ``-pi/2`` " -"and ``pi/2``." -msgstr "" +#: ../../library/math.rst:548 +msgid "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" +msgstr "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" -#: ../../library/math.rst:583 +#: ../../library/math.rst:555 msgid "" -"Return ``atan(y / x)``, in radians. The result is between ``-pi`` and " -"``pi``. The vector in the plane from the origin to point ``(x, y)`` makes " -"this angle with the positive X axis. The point of :func:`atan2` is that the " -"signs of both inputs are known to it, so it can compute the correct quadrant " -"for the angle. For example, ``atan(1)`` and ``atan2(1, 1)`` are both " -"``pi/4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." +"Return an accurate floating-point sum of values in the iterable. Avoids " +"loss of precision by tracking multiple intermediate partial sums." msgstr "" +"回傳可疊代物件(iterable)中所有值的精確浮點數和。透過追蹤過程中多個部分和" +"(partial sum)以避免精確度損失。" -#: ../../library/math.rst:593 -msgid "Return the cosine of *x* radians." +#: ../../library/math.rst:558 +msgid "" +"The algorithm's accuracy depends on IEEE-754 arithmetic guarantees and the " +"typical case where the rounding mode is half-even. On some non-Windows " +"builds, the underlying C library uses extended precision addition and may " +"occasionally double-round an intermediate sum causing it to be off in its " +"least significant bit." msgstr "" +"此演算法準確性奠基於保證 IEEE-754 浮點標準及典型奇進偶捨(half-even)模式。於" +"有些非 Windows 平台建置時,底層 C 函式庫使用延伸精度加法運算,而可能導致對過" +"程中同一部分和重複捨入,並使其最低有效位不如預期。" -#: ../../library/math.rst:598 +#: ../../library/math.rst:564 msgid "" -"Return the Euclidean distance between two points *p* and *q*, each given as " -"a sequence (or iterable) of coordinates. The two points must have the same " -"dimension." +"For further discussion and two alternative approaches, see the `ASPN " +"cookbook recipes for accurate floating-point summation `_\\." msgstr "" +"更深入的討論及兩種替代做法請參閱 `ASPN cookbook recipes 精準的浮點數總和 " +"`_。" -#: ../../library/math.rst:604 -msgid "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" -msgstr "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" - -#: ../../library/math.rst:611 +#: ../../library/math.rst:571 msgid "" "Return the Euclidean norm, ``sqrt(sum(x**2 for x in coordinates))``. This is " "the length of the vector from the origin to the point given by the " "coordinates." msgstr "" -#: ../../library/math.rst:615 +#: ../../library/math.rst:575 msgid "" "For a two dimensional point ``(x, y)``, this is equivalent to computing the " "hypotenuse of a right triangle using the Pythagorean theorem, ``sqrt(x*x + " "y*y)``." msgstr "" -#: ../../library/math.rst:619 +#: ../../library/math.rst:579 msgid "" "Added support for n-dimensional points. Formerly, only the two dimensional " "case was supported." msgstr "" -#: ../../library/math.rst:623 +#: ../../library/math.rst:583 msgid "" "Improved the algorithm's accuracy so that the maximum error is under 1 ulp " "(unit in the last place). More typically, the result is almost always " "correctly rounded to within 1/2 ulp." msgstr "" -#: ../../library/math.rst:631 -msgid "Return the sine of *x* radians." +#: ../../library/math.rst:591 +msgid "" +"Calculate the product of all the elements in the input *iterable*. The " +"default *start* value for the product is ``1``." msgstr "" -#: ../../library/math.rst:636 -msgid "Return the tangent of *x* radians." +#: ../../library/math.rst:594 +msgid "" +"When the iterable is empty, return the start value. This function is " +"intended specifically for use with numeric values and may reject non-numeric " +"types." +msgstr "" + +#: ../../library/math.rst:603 +msgid "Return the sum of products of values from two iterables *p* and *q*." +msgstr "" + +#: ../../library/math.rst:605 +msgid "Raises :exc:`ValueError` if the inputs do not have the same length." +msgstr "" + +#: ../../library/math.rst:609 +msgid "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" +msgstr "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" + +#: ../../library/math.rst:611 +msgid "" +"For float and mixed int/float inputs, the intermediate products and sums are " +"computed with extended precision." msgstr "" -#: ../../library/math.rst:640 +#: ../../library/math.rst:618 msgid "Angular conversion" msgstr "" -#: ../../library/math.rst:644 +#: ../../library/math.rst:622 msgid "Convert angle *x* from radians to degrees." msgstr "" -#: ../../library/math.rst:649 +#: ../../library/math.rst:627 msgid "Convert angle *x* from degrees to radians." msgstr "" +#: ../../library/math.rst:631 +msgid "Trigonometric functions" +msgstr "" + +#: ../../library/math.rst:635 +msgid "" +"Return the arc cosine of *x*, in radians. The result is between ``0`` and " +"``pi``." +msgstr "" + +#: ../../library/math.rst:641 +msgid "" +"Return the arc sine of *x*, in radians. The result is between ``-pi/2`` and " +"``pi/2``." +msgstr "" + +#: ../../library/math.rst:647 +msgid "" +"Return the arc tangent of *x*, in radians. The result is between ``-pi/2`` " +"and ``pi/2``." +msgstr "" + #: ../../library/math.rst:653 +msgid "" +"Return ``atan(y / x)``, in radians. The result is between ``-pi`` and " +"``pi``. The vector in the plane from the origin to point ``(x, y)`` makes " +"this angle with the positive X axis. The point of :func:`atan2` is that the " +"signs of both inputs are known to it, so it can compute the correct quadrant " +"for the angle. For example, ``atan(1)`` and ``atan2(1, 1)`` are both " +"``pi/4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." +msgstr "" + +#: ../../library/math.rst:663 +msgid "Return the cosine of *x* radians." +msgstr "" + +#: ../../library/math.rst:668 +msgid "Return the sine of *x* radians." +msgstr "" + +#: ../../library/math.rst:673 +msgid "Return the tangent of *x* radians." +msgstr "" + +#: ../../library/math.rst:677 msgid "Hyperbolic functions" msgstr "" -#: ../../library/math.rst:655 +#: ../../library/math.rst:679 msgid "" "`Hyperbolic functions `_ " "are analogs of trigonometric functions that are based on hyperbolas instead " "of circles." msgstr "" -#: ../../library/math.rst:661 +#: ../../library/math.rst:685 msgid "Return the inverse hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:666 +#: ../../library/math.rst:690 msgid "Return the inverse hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:671 +#: ../../library/math.rst:695 msgid "Return the inverse hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:676 +#: ../../library/math.rst:700 msgid "Return the hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:681 +#: ../../library/math.rst:705 msgid "Return the hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:686 +#: ../../library/math.rst:710 msgid "Return the hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:690 +#: ../../library/math.rst:714 msgid "Special functions" msgstr "特殊函式" -#: ../../library/math.rst:694 +#: ../../library/math.rst:718 msgid "" "Return the `error function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:697 +#: ../../library/math.rst:721 msgid "" "The :func:`erf` function can be used to compute traditional statistical " "functions such as the `cumulative standard normal distribution `_::" msgstr "" -#: ../../library/math.rst:701 +#: ../../library/math.rst:725 msgid "" "def phi(x):\n" " 'Cumulative distribution function for the standard normal distribution'\n" " return (1.0 + erf(x / sqrt(2.0))) / 2.0" msgstr "" -#: ../../library/math.rst:710 +#: ../../library/math.rst:734 msgid "" "Return the complementary error function at *x*. The `complementary error " "function `_ is defined as " @@ -1316,31 +1347,31 @@ msgid "" "Loss_of_significance>`_\\." msgstr "" -#: ../../library/math.rst:721 +#: ../../library/math.rst:745 msgid "" "Return the `Gamma function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:729 +#: ../../library/math.rst:753 msgid "" "Return the natural logarithm of the absolute value of the Gamma function at " "*x*." msgstr "" -#: ../../library/math.rst:736 +#: ../../library/math.rst:760 msgid "Constants" msgstr "常數" -#: ../../library/math.rst:740 +#: ../../library/math.rst:764 msgid "The mathematical constant *π* = 3.141592..., to available precision." msgstr "" -#: ../../library/math.rst:745 +#: ../../library/math.rst:769 msgid "The mathematical constant *e* = 2.718281..., to available precision." msgstr "" -#: ../../library/math.rst:750 +#: ../../library/math.rst:774 msgid "" "The mathematical constant *τ* = 6.283185..., to available precision. Tau is " "a circle constant equal to 2\\ *π*, the ratio of a circle's circumference to " @@ -1349,13 +1380,13 @@ msgid "" "celebrating `Tau day `_ by eating twice as much pie!" msgstr "" -#: ../../library/math.rst:761 +#: ../../library/math.rst:785 msgid "" "A floating-point positive infinity. (For negative infinity, use ``-math." "inf``.) Equivalent to the output of ``float('inf')``." msgstr "" -#: ../../library/math.rst:769 +#: ../../library/math.rst:793 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to the output of " "``float('nan')``. Due to the requirements of the `IEEE-754 standard \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/msilib.rst:2 +msgid ":mod:`!msilib` --- Read and write Microsoft Installer files" +msgstr ":mod:`!msilib` --- 讀寫 Microsoft Installer 檔案" + +#: ../../library/msilib.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/msilib.rst:14 +msgid "" +"The last version of Python that provided the :mod:`!msilib` module was " +"`Python 3.12 `_." +msgstr "" +"最後提供 :mod:`!msilib` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/multiprocessing.po b/library/multiprocessing.po index da2a98eeaa..810572ad3d 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-11-23 00:14+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-" @@ -496,7 +496,7 @@ msgstr "" #: ../../library/multiprocessing.rst:285 msgid "" -"The :meth:`~Connection.send` method serializes the the object and :meth:" +"The :meth:`~Connection.send` method serializes the object and :meth:" "`~Connection.recv` re-creates the object." msgstr "" @@ -1325,9 +1325,9 @@ msgstr "" #: ../../library/multiprocessing.rst:822 msgid "" -"The :meth:`~multiprocessing.Connection.send` method serializes the the " -"object using :mod:`pickle` and the :meth:`~multiprocessing.Connection.recv` " -"re-creates the object." +"The :meth:`~multiprocessing.Connection.send` method serializes the object " +"using :mod:`pickle` and the :meth:`~multiprocessing.Connection.recv` re-" +"creates the object." msgstr "" #: ../../library/multiprocessing.rst:827 diff --git a/library/multiprocessing.shared_memory.po b/library/multiprocessing.shared_memory.po index 78ad49ee37..a9244ed858 100644 --- a/library/multiprocessing.shared_memory.po +++ b/library/multiprocessing.shared_memory.po @@ -148,7 +148,7 @@ msgstr "" #: ../../library/multiprocessing.shared_memory.rst:91 msgid "Added the *track* parameter." -msgstr "" +msgstr "新增 *track* 參數。" #: ../../library/multiprocessing.shared_memory.rst:96 msgid "" diff --git a/library/nis.po b/library/nis.po new file mode 100644 index 0000000000..e2e5bb1c79 --- /dev/null +++ b/library/nis.po @@ -0,0 +1,39 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/nis.rst:2 +msgid ":mod:`!nis` --- Interface to Sun’s NIS (Yellow Pages)" +msgstr ":mod:`!nis` --- Sun NIS (Yellow Pages) 介面" + +#: ../../library/nis.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/nis.rst:14 +msgid "" +"The last version of Python that provided the :mod:`!nis` module was `Python " +"3.12 `_." +msgstr "" +"最後提供 :mod:`!nis` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/nntplib.po b/library/nntplib.po new file mode 100644 index 0000000000..e90544691c --- /dev/null +++ b/library/nntplib.po @@ -0,0 +1,39 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/nntplib.rst:2 +msgid ":mod:`!nntplib` --- NNTP protocol client" +msgstr ":mod:`!nntplib` --- NNTP 協定客戶端" + +#: ../../library/nntplib.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/nntplib.rst:14 +msgid "" +"The last version of Python that provided the :mod:`!nntplib` module was " +"`Python 3.12 `_." +msgstr "" +"最後提供 :mod:`!nntplib` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/ossaudiodev.po b/library/ossaudiodev.po new file mode 100644 index 0000000000..6154c77b2e --- /dev/null +++ b/library/ossaudiodev.po @@ -0,0 +1,39 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/ossaudiodev.rst:2 +msgid ":mod:`!ossaudiodev` --- Access to OSS-compatible audio devices" +msgstr ":mod:`!ossaudiodev` --- 對 OSS 相容聲音裝置的存取" + +#: ../../library/ossaudiodev.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/ossaudiodev.rst:14 +msgid "" +"The last version of Python that provided the :mod:`!ossaudiodev` module was " +"`Python 3.12 `_." +msgstr "" +"最後提供 :mod:`!ossaudiodev` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/pickle.po b/library/pickle.po index 370cbe643d..4846877e33 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -240,8 +240,8 @@ msgid "" "Python programs may not be able to reconstruct pickled Python objects." msgstr "" ":mod:`pickle` 使用的資料格式是針對 Python 而設計的。好處是他不會受到外部標準" -"(像是 JSON,無法紀錄指標共用)的限制;不過這也代表其他不是 " -"Python 的程式可能無法重建 pickle 封裝的 Python 物件。" +"(像是 JSON,無法紀錄指標共用)的限制;不過這也代表其他不是 Python 的程式可能" +"無法重建 pickle 封裝的 Python 物件。" #: ../../library/pickle.rst:131 msgid "" @@ -267,8 +267,8 @@ msgid "" "The higher the protocol used, the more recent the version of Python needed " "to read the pickle produced." msgstr "" -"截至目前為止,共有六種不同版本的協定可用於封裝 pickle。數字越大版本代表你需" -"要使用越新的 Python 版本來拆封相應的 pickle 封裝。" +"截至目前為止,共有六種不同版本的協定可用於封裝 pickle。數字越大版本代表你需要" +"使用越新的 Python 版本來拆封相應的 pickle 封裝。" #: ../../library/pickle.rst:143 msgid "" @@ -411,8 +411,8 @@ msgid "" "Write the pickled representation of the object *obj* to the open :term:`file " "object` *file*. This is equivalent to ``Pickler(file, protocol).dump(obj)``." msgstr "" -"將被封裝成 pickle 形式的物件 *obj* 寫入到已開啟的\\ :term:`file object` *file*。" -"這等效於\\ ``Pickler(file, protocol).dump(obj)``。" +"將被封裝成 pickle 形式的物件 *obj* 寫入到已開啟的\\ :term:`file object` " +"*file*。這等效於\\ ``Pickler(file, protocol).dump(obj)``。" #: ../../library/pickle.rst:222 msgid "" @@ -432,7 +432,8 @@ msgid "" "Return the pickled representation of the object *obj* as a :class:`bytes` " "object, instead of writing it to a file." msgstr "" -"將被封裝為 pickle 形式的物件 *obj* 以 :class:`bytes` 類別回傳,而非寫入進檔案。" +"將被封裝為 pickle 形式的物件 *obj* 以 :class:`bytes` 類別回傳,而非寫入進檔" +"案。" #: ../../library/pickle.rst:233 msgid "" @@ -640,8 +641,7 @@ msgstr "關於細節與用法範例請見 :ref:`pickle-persistent`。" msgid "" "Add the default implementation of this method in the C implementation of :" "class:`!Pickler`." -msgstr "" -"在 C 的 class:`!Pickler` 實作中的增加了這個方法的預設實作。" +msgstr "在 C 的 :class:`!Pickler` 實作中的增加了這個方法的預設實作。" # SkyLull: [T] # dispatch table -> 調度表 @@ -1105,7 +1105,7 @@ msgid "" "``args`` which will be passed to the :meth:`__new__` method upon unpickling." msgstr "" "此方法與 :meth:`__getnewargs_ex__` 的目的一樣,但僅支援位置參數。它必須回傳一" -"個由傳入引數所組成的元組(tuple)``args``,這些引數會在拆封時傳遞給 :meth:" +"個由傳入引數所組成的元組(tuple)\\ ``args``,這些引數會在拆封時傳遞給 :meth:" "`__new__` 方法。" #: ../../library/pickle.rst:610 @@ -1318,8 +1318,8 @@ msgstr "" "可選項。一個用來提供連續項目的疊代器(而非序列)。這些項目將個別透過 ``obj." "append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被附加到" "物件中。主要用於串列(list)子類別,但只要其他類別具有相應的 :ref:`append 和 " -"extend 方法 `\\ 以及相同的函式簽章(signature)就也可以使用。 " -"(是否會調用 :meth:`!append` 或 :meth:`!extend` 方法將取決於所選用的 " +"extend 方法 `\\ 以及相同的函式簽章(signature)就也可以使" +"用。 (是否會調用 :meth:`!append` 或 :meth:`!extend` 方法將取決於所選用的 " "pickle 協定版本以及要附加的項目數量,因此必須同時支援這兩種方法。)" #: ../../library/pickle.rst:725 diff --git a/library/pipes.po b/library/pipes.po new file mode 100644 index 0000000000..5abbbde3db --- /dev/null +++ b/library/pipes.po @@ -0,0 +1,43 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/pipes.rst:2 +msgid ":mod:`!pipes` --- Interface to shell pipelines" +msgstr ":mod:`!pipes` --- shell pipelines 介面" + +#: ../../library/pipes.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/pipes.rst:14 +msgid "Applications should use the :mod:`subprocess` module instead." +msgstr "應用程式應改用 :mod:`subprocess` 模組。" + +#: ../../library/pipes.rst:16 +msgid "" +"The last version of Python that provided the :mod:`!pipes` module was " +"`Python 3.12 `_." +msgstr "" +"最後提供 :mod:`!pipes` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/pprint.po b/library/pprint.po index ce89afcb1b..4af5384160 100644 --- a/library/pprint.po +++ b/library/pprint.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-11-15 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -68,11 +68,11 @@ msgstr "" #: ../../library/pprint.rst:0 msgid "Parameters" -msgstr "" +msgstr "參數" #: ../../library/pprint.rst:46 msgid "The object to be printed." -msgstr "" +msgstr "將被印出的物件。" #: ../../library/pprint.rst:49 msgid "" @@ -164,7 +164,7 @@ msgstr "PrettyPrinter 物件" #: ../../library/pprint.rst:160 msgid "Construct a :class:`PrettyPrinter` instance." -msgstr "" +msgstr "建立一個 :class:`PrettyPrinter` 實例。" #: ../../library/pprint.rst:162 msgid "" @@ -190,7 +190,7 @@ msgstr "" #: ../../library/pprint.rst:202 msgid ":class:`PrettyPrinter` instances have the following methods:" -msgstr "" +msgstr ":class:`PrettyPrinter` 實例有以下方法:" #: ../../library/pprint.rst:207 msgid "" @@ -266,13 +266,13 @@ msgid "" ">>> import json\n" ">>> import pprint\n" ">>> from urllib.request import urlopen\n" -">>> with urlopen('https://pypi.org/pypi/sampleproject/json') as resp:\n" +">>> with urlopen('https://pypi.org/pypi/sampleproject/1.2.0/json') as resp:\n" "... project_info = json.load(resp)['info']" msgstr "" ">>> import json\n" ">>> import pprint\n" ">>> from urllib.request import urlopen\n" -">>> with urlopen('https://pypi.org/pypi/sampleproject/json') as resp:\n" +">>> with urlopen('https://pypi.org/pypi/sampleproject/1.2.0/json') as resp:\n" "... project_info = json.load(resp)['info']" #: ../../library/pprint.rst:273 diff --git a/library/removed.po b/library/removed.po new file mode 100644 index 0000000000..c13cb4637f --- /dev/null +++ b/library/removed.po @@ -0,0 +1,28 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/removed.rst:7 +msgid "Removed Modules" +msgstr "已移除的模組" + +#: ../../library/removed.rst:9 +msgid "" +"The modules described in this chapter have been removed from the Python " +"standard library. They are documented here to help people find replacements." +msgstr "" +"本章描述的模組已從 Python 標準函式庫中移除。這裡提供文件以協助尋找替代方案。" diff --git a/library/shutil.po b/library/shutil.po index 496e83ef0e..633b582f04 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-11-23 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -568,9 +568,8 @@ msgstr "" "` ``shutil.chown``。" #: ../../library/shutil.rst:440 -#, fuzzy msgid "Added *dir_fd* and *follow_symlinks* parameters." -msgstr "新增 *follow_symlinks* 引數。" +msgstr "新增 *dir_fd* 和 *follow_symlinks* 參數。" #: ../../library/shutil.rst:446 msgid "" @@ -630,6 +629,8 @@ msgid "" ">> shutil.which(\"C:\\\\Python33\\\\python\")\n" "'C:\\\\Python33\\\\python.EXE'" msgstr "" +">> shutil.which(\"C:\\\\Python33\\\\python\")\n" +"'C:\\\\Python33\\\\python.EXE'" #: ../../library/shutil.rst:481 msgid "" @@ -648,25 +649,18 @@ msgid "" "now be found." msgstr "" -#: ../../library/shutil.rst:494 -msgid "" -"On Windows, if *mode* includes ``os.X_OK``, executables with an extension in " -"``PATHEXT`` will be preferred over executables without a matching extension. " -"This brings behavior closer to that of Python 3.11." -msgstr "" - -#: ../../library/shutil.rst:502 +#: ../../library/shutil.rst:496 msgid "" "This exception collects exceptions that are raised during a multi-file " "operation. For :func:`copytree`, the exception argument is a list of 3-" "tuples (*srcname*, *dstname*, *exception*)." msgstr "" -#: ../../library/shutil.rst:509 +#: ../../library/shutil.rst:503 msgid "Platform-dependent efficient copy operations" msgstr "" -#: ../../library/shutil.rst:511 +#: ../../library/shutil.rst:505 msgid "" "Starting from Python 3.8, all functions involving a file copy (:func:" "`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, and :func:" @@ -676,37 +670,37 @@ msgid "" "buffers in Python as in \"``outfd.write(infd.read())``\"." msgstr "" -#: ../../library/shutil.rst:519 +#: ../../library/shutil.rst:513 msgid "On macOS `fcopyfile`_ is used to copy the file content (not metadata)." msgstr "" -#: ../../library/shutil.rst:521 +#: ../../library/shutil.rst:515 msgid "On Linux :func:`os.sendfile` is used." msgstr "" -#: ../../library/shutil.rst:523 +#: ../../library/shutil.rst:517 msgid "" "On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " "instead of 64 KiB) and a :func:`memoryview`-based variant of :func:`shutil." "copyfileobj` is used." msgstr "" -#: ../../library/shutil.rst:527 +#: ../../library/shutil.rst:521 msgid "" "If the fast-copy operation fails and no data was written in the destination " "file then shutil will silently fallback on using less efficient :func:" "`copyfileobj` function internally." msgstr "" -#: ../../library/shutil.rst:536 +#: ../../library/shutil.rst:530 msgid "copytree example" -msgstr "" +msgstr "copytree 範例" -#: ../../library/shutil.rst:538 +#: ../../library/shutil.rst:532 msgid "An example that uses the :func:`ignore_patterns` helper::" msgstr "" -#: ../../library/shutil.rst:540 +#: ../../library/shutil.rst:534 msgid "" "from shutil import copytree, ignore_patterns\n" "\n" @@ -716,17 +710,17 @@ msgstr "" "\n" "copytree(source, destination, ignore=ignore_patterns('*.pyc', 'tmp*'))" -#: ../../library/shutil.rst:544 +#: ../../library/shutil.rst:538 msgid "" "This will copy everything except ``.pyc`` files and files or directories " "whose name starts with ``tmp``." msgstr "" -#: ../../library/shutil.rst:547 +#: ../../library/shutil.rst:541 msgid "Another example that uses the *ignore* argument to add a logging call::" msgstr "" -#: ../../library/shutil.rst:549 +#: ../../library/shutil.rst:543 msgid "" "from shutil import copytree\n" "import logging\n" @@ -738,11 +732,11 @@ msgid "" "copytree(source, destination, ignore=_logpath)" msgstr "" -#: ../../library/shutil.rst:562 +#: ../../library/shutil.rst:556 msgid "rmtree example" msgstr "rmtree 範例" -#: ../../library/shutil.rst:564 +#: ../../library/shutil.rst:558 msgid "" "This example shows how to remove a directory tree on Windows where some of " "the files have their read-only bit set. It uses the onexc callback to clear " @@ -750,7 +744,7 @@ msgid "" "propagate. ::" msgstr "" -#: ../../library/shutil.rst:569 +#: ../../library/shutil.rst:563 msgid "" "import os, stat\n" "import shutil\n" @@ -763,31 +757,31 @@ msgid "" "shutil.rmtree(directory, onexc=remove_readonly)" msgstr "" -#: ../../library/shutil.rst:582 +#: ../../library/shutil.rst:576 msgid "Archiving operations" msgstr "" -#: ../../library/shutil.rst:586 +#: ../../library/shutil.rst:580 msgid "Added support for the *xztar* format." msgstr "新增 *xztar* 格式的支援。" -#: ../../library/shutil.rst:590 +#: ../../library/shutil.rst:584 msgid "" "High-level utilities to create and read compressed and archived files are " "also provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules." msgstr "" -#: ../../library/shutil.rst:595 +#: ../../library/shutil.rst:589 msgid "Create an archive file (such as zip or tar) and return its name." msgstr "" -#: ../../library/shutil.rst:597 +#: ../../library/shutil.rst:591 msgid "" "*base_name* is the name of the file to create, including the path, minus any " "format-specific extension." msgstr "" -#: ../../library/shutil.rst:600 +#: ../../library/shutil.rst:594 msgid "" "*format* is the archive format: one of \"zip\" (if the :mod:`zlib` module is " "available), \"tar\", \"gztar\" (if the :mod:`zlib` module is available), " @@ -795,14 +789,14 @@ msgid "" "`lzma` module is available)." msgstr "" -#: ../../library/shutil.rst:605 +#: ../../library/shutil.rst:599 msgid "" "*root_dir* is a directory that will be the root directory of the archive, " "all paths in the archive will be relative to it; for example, we typically " "chdir into *root_dir* before creating the archive." msgstr "" -#: ../../library/shutil.rst:609 +#: ../../library/shutil.rst:603 msgid "" "*base_dir* is the directory where we start archiving from; i.e. *base_dir* " "will be the common prefix of all files and directories in the archive. " @@ -810,33 +804,33 @@ msgid "" "example-with-basedir` for how to use *base_dir* and *root_dir* together." msgstr "" -#: ../../library/shutil.rst:615 +#: ../../library/shutil.rst:609 msgid "*root_dir* and *base_dir* both default to the current directory." msgstr "" -#: ../../library/shutil.rst:617 +#: ../../library/shutil.rst:611 msgid "" "If *dry_run* is true, no archive is created, but the operations that would " "be executed are logged to *logger*." msgstr "" -#: ../../library/shutil.rst:620 +#: ../../library/shutil.rst:614 msgid "" "*owner* and *group* are used when creating a tar archive. By default, uses " "the current owner and group." msgstr "" -#: ../../library/shutil.rst:623 +#: ../../library/shutil.rst:617 msgid "" "*logger* must be an object compatible with :pep:`282`, usually an instance " "of :class:`logging.Logger`." msgstr "" -#: ../../library/shutil.rst:626 +#: ../../library/shutil.rst:620 msgid "The *verbose* argument is unused and deprecated." msgstr "" -#: ../../library/shutil.rst:628 +#: ../../library/shutil.rst:622 msgid "" "Raises an :ref:`auditing event ` ``shutil.make_archive`` with " "arguments ``base_name``, ``format``, ``root_dir``, ``base_dir``." @@ -844,7 +838,7 @@ msgstr "" "引發一個附帶引數 ``base_name``、``format``、``root_dir``、``base_dir`` 的\\ :" "ref:`稽核事件 ` ``shutil.make_archive``。" -#: ../../library/shutil.rst:632 +#: ../../library/shutil.rst:626 msgid "" "This function is not thread-safe when custom archivers registered with :func:" "`register_archive_format` do not support the *root_dir* argument. In this " @@ -852,60 +846,60 @@ msgid "" "*root_dir* to perform archiving." msgstr "" -#: ../../library/shutil.rst:638 +#: ../../library/shutil.rst:632 msgid "" "The modern pax (POSIX.1-2001) format is now used instead of the legacy GNU " "format for archives created with ``format=\"tar\"``." msgstr "" -#: ../../library/shutil.rst:642 +#: ../../library/shutil.rst:636 msgid "" "This function is now made thread-safe during creation of standard ``.zip`` " "and tar archives." msgstr "" -#: ../../library/shutil.rst:648 +#: ../../library/shutil.rst:642 msgid "" "Return a list of supported formats for archiving. Each element of the " "returned sequence is a tuple ``(name, description)``." msgstr "" -#: ../../library/shutil.rst:651 ../../library/shutil.rst:762 +#: ../../library/shutil.rst:645 ../../library/shutil.rst:756 msgid "By default :mod:`shutil` provides these formats:" msgstr "" -#: ../../library/shutil.rst:653 +#: ../../library/shutil.rst:647 msgid "*zip*: ZIP file (if the :mod:`zlib` module is available)." msgstr "" -#: ../../library/shutil.rst:654 +#: ../../library/shutil.rst:648 msgid "" "*tar*: Uncompressed tar file. Uses POSIX.1-2001 pax format for new archives." msgstr "" -#: ../../library/shutil.rst:655 ../../library/shutil.rst:767 +#: ../../library/shutil.rst:649 ../../library/shutil.rst:761 msgid "*gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available)." msgstr "" -#: ../../library/shutil.rst:656 ../../library/shutil.rst:768 +#: ../../library/shutil.rst:650 ../../library/shutil.rst:762 msgid "*bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available)." msgstr "" -#: ../../library/shutil.rst:657 ../../library/shutil.rst:769 +#: ../../library/shutil.rst:651 ../../library/shutil.rst:763 msgid "*xztar*: xz'ed tar-file (if the :mod:`lzma` module is available)." msgstr "" -#: ../../library/shutil.rst:659 +#: ../../library/shutil.rst:653 msgid "" "You can register new formats or provide your own archiver for any existing " "formats, by using :func:`register_archive_format`." msgstr "" -#: ../../library/shutil.rst:665 +#: ../../library/shutil.rst:659 msgid "Register an archiver for the format *name*." msgstr "" -#: ../../library/shutil.rst:667 +#: ../../library/shutil.rst:661 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive the *base_name* of the file to create, followed by the " @@ -914,7 +908,7 @@ msgid "" "*dry_run* and *logger* (as passed in :func:`make_archive`)." msgstr "" -#: ../../library/shutil.rst:673 +#: ../../library/shutil.rst:667 msgid "" "If *function* has the custom attribute ``function.supports_root_dir`` set to " "``True``, the *root_dir* argument is passed as a keyword argument. Otherwise " @@ -923,37 +917,37 @@ msgid "" "not thread-safe." msgstr "" -#: ../../library/shutil.rst:679 +#: ../../library/shutil.rst:673 msgid "" "If given, *extra_args* is a sequence of ``(name, value)`` pairs that will be " "used as extra keywords arguments when the archiver callable is used." msgstr "" -#: ../../library/shutil.rst:682 +#: ../../library/shutil.rst:676 msgid "" "*description* is used by :func:`get_archive_formats` which returns the list " "of archivers. Defaults to an empty string." msgstr "" -#: ../../library/shutil.rst:685 +#: ../../library/shutil.rst:679 msgid "Added support for functions supporting the *root_dir* argument." msgstr "" -#: ../../library/shutil.rst:691 +#: ../../library/shutil.rst:685 msgid "Remove the archive format *name* from the list of supported formats." msgstr "" -#: ../../library/shutil.rst:696 +#: ../../library/shutil.rst:690 msgid "Unpack an archive. *filename* is the full path of the archive." msgstr "" -#: ../../library/shutil.rst:698 +#: ../../library/shutil.rst:692 msgid "" "*extract_dir* is the name of the target directory where the archive is " "unpacked. If not provided, the current working directory is used." msgstr "" -#: ../../library/shutil.rst:701 +#: ../../library/shutil.rst:695 msgid "" "*format* is the archive format: one of \"zip\", \"tar\", \"gztar\", " "\"bztar\", or \"xztar\". Or any other format registered with :func:" @@ -962,7 +956,7 @@ msgid "" "that extension. In case none is found, a :exc:`ValueError` is raised." msgstr "" -#: ../../library/shutil.rst:708 +#: ../../library/shutil.rst:702 msgid "" "The keyword-only *filter* argument is passed to the underlying unpacking " "function. For zip files, *filter* is not accepted. For tar files, it is " @@ -972,7 +966,7 @@ msgid "" "Python 3.14." msgstr "" -#: ../../library/shutil.rst:716 +#: ../../library/shutil.rst:710 msgid "" "Raises an :ref:`auditing event ` ``shutil.unpack_archive`` with " "arguments ``filename``, ``extract_dir``, ``format``." @@ -980,7 +974,7 @@ msgstr "" "引發一個附帶引數 ``filename``、``extract_dir``、``format`` 的\\ :ref:`稽核事" "件 ` ``shutil.unpack_archive``。" -#: ../../library/shutil.rst:720 +#: ../../library/shutil.rst:714 msgid "" "Never extract archives from untrusted sources without prior inspection. It " "is possible that files are created outside of the path specified in the " @@ -988,91 +982,91 @@ msgid "" "with \"/\" or filenames with two dots \"..\"." msgstr "" -#: ../../library/shutil.rst:725 +#: ../../library/shutil.rst:719 msgid "Accepts a :term:`path-like object` for *filename* and *extract_dir*." msgstr "" -#: ../../library/shutil.rst:728 +#: ../../library/shutil.rst:722 msgid "Added the *filter* argument." msgstr "新增 *filter* 引數。" -#: ../../library/shutil.rst:733 +#: ../../library/shutil.rst:727 msgid "" "Registers an unpack format. *name* is the name of the format and " "*extensions* is a list of extensions corresponding to the format, like ``." "zip`` for Zip files." msgstr "" -#: ../../library/shutil.rst:737 +#: ../../library/shutil.rst:731 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive:" msgstr "" -#: ../../library/shutil.rst:740 +#: ../../library/shutil.rst:734 msgid "the path of the archive, as a positional argument;" msgstr "" -#: ../../library/shutil.rst:741 +#: ../../library/shutil.rst:735 msgid "" "the directory the archive must be extracted to, as a positional argument;" msgstr "" -#: ../../library/shutil.rst:742 +#: ../../library/shutil.rst:736 msgid "" "possibly a *filter* keyword argument, if it was given to :func:" "`unpack_archive`;" msgstr "" -#: ../../library/shutil.rst:744 +#: ../../library/shutil.rst:738 msgid "" "additional keyword arguments, specified by *extra_args* as a sequence of " "``(name, value)`` tuples." msgstr "" -#: ../../library/shutil.rst:747 +#: ../../library/shutil.rst:741 msgid "" "*description* can be provided to describe the format, and will be returned " "by the :func:`get_unpack_formats` function." msgstr "" -#: ../../library/shutil.rst:753 +#: ../../library/shutil.rst:747 msgid "Unregister an unpack format. *name* is the name of the format." msgstr "" -#: ../../library/shutil.rst:758 +#: ../../library/shutil.rst:752 msgid "" "Return a list of all registered formats for unpacking. Each element of the " "returned sequence is a tuple ``(name, extensions, description)``." msgstr "" -#: ../../library/shutil.rst:764 +#: ../../library/shutil.rst:758 msgid "" "*zip*: ZIP file (unpacking compressed files works only if the corresponding " "module is available)." msgstr "" -#: ../../library/shutil.rst:766 +#: ../../library/shutil.rst:760 msgid "*tar*: uncompressed tar file." msgstr "" -#: ../../library/shutil.rst:771 +#: ../../library/shutil.rst:765 msgid "" "You can register new formats or provide your own unpacker for any existing " "formats, by using :func:`register_unpack_format`." msgstr "" -#: ../../library/shutil.rst:778 +#: ../../library/shutil.rst:772 msgid "Archiving example" msgstr "" -#: ../../library/shutil.rst:780 +#: ../../library/shutil.rst:774 msgid "" "In this example, we create a gzip'ed tar-file archive containing all files " "found in the :file:`.ssh` directory of the user::" msgstr "" -#: ../../library/shutil.rst:783 +#: ../../library/shutil.rst:777 msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1082,11 +1076,11 @@ msgid "" "'/Users/tarek/myarchive.tar.gz'" msgstr "" -#: ../../library/shutil.rst:790 +#: ../../library/shutil.rst:784 msgid "The resulting archive contains:" msgstr "" -#: ../../library/shutil.rst:792 +#: ../../library/shutil.rst:786 msgid "" "$ tar -tzvf /Users/tarek/myarchive.tar.gz\n" "drwx------ tarek/staff 0 2010-02-01 16:23:40 ./\n" @@ -1108,18 +1102,18 @@ msgstr "" "-rw-r--r-- tarek/staff 397 2008-06-09 13:26:54 ./id_rsa.pub\n" "-rw-r--r-- tarek/staff 37192 2010-02-06 18:23:10 ./known_hosts" -#: ../../library/shutil.rst:808 +#: ../../library/shutil.rst:802 msgid "Archiving example with *base_dir*" msgstr "" -#: ../../library/shutil.rst:810 +#: ../../library/shutil.rst:804 msgid "" "In this example, similar to the `one above `_, we " "show how to use :func:`make_archive`, but this time with the usage of " "*base_dir*. We now have the following directory structure:" msgstr "" -#: ../../library/shutil.rst:814 +#: ../../library/shutil.rst:808 msgid "" "$ tree tmp\n" "tmp\n" @@ -1137,13 +1131,13 @@ msgstr "" " └── please_add.txt\n" " └── do_not_add.txt" -#: ../../library/shutil.rst:824 +#: ../../library/shutil.rst:818 msgid "" "In the final archive, :file:`please_add.txt` should be included, but :file:" "`do_not_add.txt` should not. Therefore we use the following::" msgstr "" -#: ../../library/shutil.rst:827 +#: ../../library/shutil.rst:821 msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1167,11 +1161,11 @@ msgstr "" "... )\n" "'/Users/tarek/my_archive.tar'" -#: ../../library/shutil.rst:838 +#: ../../library/shutil.rst:832 msgid "Listing the files in the resulting archive gives us:" msgstr "" -#: ../../library/shutil.rst:840 +#: ../../library/shutil.rst:834 msgid "" "$ python -m tarfile -l /Users/tarek/myarchive.tar\n" "structure/content/\n" @@ -1181,29 +1175,29 @@ msgstr "" "structure/content/\n" "structure/content/please_add.txt" -#: ../../library/shutil.rst:848 +#: ../../library/shutil.rst:842 msgid "Querying the size of the output terminal" msgstr "" -#: ../../library/shutil.rst:852 +#: ../../library/shutil.rst:846 msgid "Get the size of the terminal window." msgstr "" -#: ../../library/shutil.rst:854 +#: ../../library/shutil.rst:848 msgid "" "For each of the two dimensions, the environment variable, ``COLUMNS`` and " "``LINES`` respectively, is checked. If the variable is defined and the value " "is a positive integer, it is used." msgstr "" -#: ../../library/shutil.rst:858 +#: ../../library/shutil.rst:852 msgid "" "When ``COLUMNS`` or ``LINES`` is not defined, which is the common case, the " "terminal connected to :data:`sys.__stdout__` is queried by invoking :func:" "`os.get_terminal_size`." msgstr "" -#: ../../library/shutil.rst:862 +#: ../../library/shutil.rst:856 msgid "" "If the terminal size cannot be successfully queried, either because the " "system doesn't support querying, or because we are not connected to a " @@ -1212,17 +1206,17 @@ msgid "" "emulators." msgstr "" -#: ../../library/shutil.rst:868 +#: ../../library/shutil.rst:862 msgid "The value returned is a named tuple of type :class:`os.terminal_size`." msgstr "" -#: ../../library/shutil.rst:870 +#: ../../library/shutil.rst:864 msgid "" "See also: The Single UNIX Specification, Version 2, `Other Environment " "Variables`_." msgstr "" -#: ../../library/shutil.rst:875 +#: ../../library/shutil.rst:869 msgid "" "The ``fallback`` values are also used if :func:`os.get_terminal_size` " "returns zeroes." diff --git a/library/smtpd.po b/library/smtpd.po new file mode 100644 index 0000000000..1bd616eb4c --- /dev/null +++ b/library/smtpd.po @@ -0,0 +1,47 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/smtpd.rst:2 +msgid ":mod:`!smtpd` --- SMTP Server" +msgstr ":mod:`!smtpd` --- SMTP 伺服器" + +#: ../../library/smtpd.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.12 ` after being deprecated in " +"Python 3.6. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.6 中被棄用,並\\ :" +"ref:`已在 Python 3.12 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/smtpd.rst:14 +msgid "" +"A possible replacement is the third-party :pypi:`aiosmtpd` library. This " +"library is not maintained or supported by the Python core team." +msgstr "" +"一個可能的替代方案是第三方 :pypi:`aiosmtpd` 函式庫。這個函式庫並不是由 " +"Python 核心團隊維護或支援。" + +#: ../../library/smtpd.rst:17 +msgid "" +"The last version of Python that provided the :mod:`!smtpd` module was " +"`Python 3.11 `_." +msgstr "" +"最後提供 :mod:`!smtpd` 模組的 Python 版本是 `Python 3.11 `_。" diff --git a/library/sndhdr.po b/library/sndhdr.po new file mode 100644 index 0000000000..1f2b9ff476 --- /dev/null +++ b/library/sndhdr.po @@ -0,0 +1,48 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/sndhdr.rst:2 +msgid ":mod:`!sndhdr` --- Determine type of sound file" +msgstr ":mod:`!sndhdr` --- 判定聲音檔案的種類" + +#: ../../library/sndhdr.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/sndhdr.rst:14 +msgid "" +"Possible replacements are third-party modules from PyPI: :pypi:`filetype`, :" +"pypi:`puremagic`, or :pypi:`python-magic`. These are not supported or " +"maintained by the Python core team." +msgstr "" +"可能的替代方案是 PyPI 上的第三方模組::pypi:`filetype`、:pypi:`puremagic` " +"或 :pypi:`python-magic`。它們並不受 Python 核心團隊支援或維護。" + +#: ../../library/sndhdr.rst:18 +msgid "" +"The last version of Python that provided the :mod:`!sndhdr` module was " +"`Python 3.12 `_." +msgstr "" +"最後提供 :mod:`!sndhdr` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/socket.po b/library/socket.po index 16a36ca0b5..c7e95f09c9 100644 --- a/library/socket.po +++ b/library/socket.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-11-23 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,22 +51,22 @@ msgstr "" #: ../../library/socket.rst:658 ../../library/socket.rst:667 #: ../../library/socket.rst:684 ../../library/socket.rst:699 #: ../../library/socket.rst:709 ../../library/socket.rst:898 -#: ../../library/socket.rst:994 ../../library/socket.rst:1010 -#: ../../library/socket.rst:1023 ../../library/socket.rst:1038 -#: ../../library/socket.rst:1055 ../../library/socket.rst:1066 -#: ../../library/socket.rst:1077 ../../library/socket.rst:1088 -#: ../../library/socket.rst:1177 ../../library/socket.rst:1197 -#: ../../library/socket.rst:1223 ../../library/socket.rst:1246 -#: ../../library/socket.rst:1275 ../../library/socket.rst:1286 -#: ../../library/socket.rst:1313 ../../library/socket.rst:1330 -#: ../../library/socket.rst:1347 ../../library/socket.rst:1361 -#: ../../library/socket.rst:1412 ../../library/socket.rst:1459 -#: ../../library/socket.rst:1473 ../../library/socket.rst:1493 -#: ../../library/socket.rst:1540 ../../library/socket.rst:1585 -#: ../../library/socket.rst:1715 ../../library/socket.rst:1759 -#: ../../library/socket.rst:1867 ../../library/socket.rst:1885 -#: ../../library/socket.rst:1969 ../../library/socket.rst:1979 -#: ../../library/socket.rst:1991 ../../includes/wasm-notavail.rst:3 +#: ../../library/socket.rst:1023 ../../library/socket.rst:1039 +#: ../../library/socket.rst:1052 ../../library/socket.rst:1067 +#: ../../library/socket.rst:1084 ../../library/socket.rst:1095 +#: ../../library/socket.rst:1106 ../../library/socket.rst:1117 +#: ../../library/socket.rst:1206 ../../library/socket.rst:1226 +#: ../../library/socket.rst:1252 ../../library/socket.rst:1275 +#: ../../library/socket.rst:1304 ../../library/socket.rst:1315 +#: ../../library/socket.rst:1342 ../../library/socket.rst:1359 +#: ../../library/socket.rst:1376 ../../library/socket.rst:1390 +#: ../../library/socket.rst:1441 ../../library/socket.rst:1488 +#: ../../library/socket.rst:1502 ../../library/socket.rst:1522 +#: ../../library/socket.rst:1569 ../../library/socket.rst:1614 +#: ../../library/socket.rst:1744 ../../library/socket.rst:1788 +#: ../../library/socket.rst:1896 ../../library/socket.rst:1914 +#: ../../library/socket.rst:1998 ../../library/socket.rst:2008 +#: ../../library/socket.rst:2020 ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "" @@ -139,8 +139,8 @@ msgid "" "Previously, :const:`AF_UNIX` socket paths were assumed to use UTF-8 encoding." msgstr "" -#: ../../library/socket.rst:66 ../../library/socket.rst:1160 -#: ../../library/socket.rst:1202 ../../library/socket.rst:1963 +#: ../../library/socket.rst:66 ../../library/socket.rst:1189 +#: ../../library/socket.rst:1231 ../../library/socket.rst:1992 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" @@ -736,7 +736,7 @@ msgid "" "the :meth:`~socket.socket.ioctl` method of socket objects." msgstr "" -#: ../../library/socket.rst:579 ../../library/socket.rst:1575 +#: ../../library/socket.rst:579 ../../library/socket.rst:1604 msgid "``SIO_LOOPBACK_FAST_PATH`` was added." msgstr "加入 ``SIO_LOOPBACK_FAST_PATH``。" @@ -849,7 +849,7 @@ msgid "" msgstr "" #: ../../library/socket.rst:741 ../../library/socket.rst:887 -#: ../../library/socket.rst:1394 ../../library/socket.rst:1488 +#: ../../library/socket.rst:1423 ../../library/socket.rst:1517 msgid "The newly created socket is :ref:`non-inheritable `." msgstr "" @@ -1078,6 +1078,11 @@ msgstr "" #: ../../library/socket.rst:925 msgid "" +"This function wraps the C function ``getaddrinfo`` of the underlying system." +msgstr "" + +#: ../../library/socket.rst:927 +msgid "" "Translate the *host*/*port* argument into a sequence of 5-tuples that " "contain all the necessary arguments for creating a socket connected to that " "service. *host* is a domain name, a string representation of an IPv4/v6 " @@ -1086,26 +1091,31 @@ msgid "" "and *port*, you can pass ``NULL`` to the underlying C API." msgstr "" -#: ../../library/socket.rst:932 +#: ../../library/socket.rst:934 msgid "" "The *family*, *type* and *proto* arguments can be optionally specified in " -"order to narrow the list of addresses returned. Passing zero as a value for " -"each of these arguments selects the full range of results. The *flags* " -"argument can be one or several of the ``AI_*`` constants, and will influence " -"how results are computed and returned. For example, :const:`AI_NUMERICHOST` " -"will disable domain name resolution and will raise an error if *host* is a " -"domain name." +"order to provide options and limit the list of addresses returned. Pass " +"their default values (:data:`AF_UNSPEC`, 0, and 0, respectively) to not " +"limit the results. See the note below for details." msgstr "" -#: ../../library/socket.rst:940 +#: ../../library/socket.rst:939 +msgid "" +"The *flags* argument can be one or several of the ``AI_*`` constants, and " +"will influence how results are computed and returned. For example, :const:" +"`AI_NUMERICHOST` will disable domain name resolution and will raise an error " +"if *host* is a domain name." +msgstr "" + +#: ../../library/socket.rst:944 msgid "The function returns a list of 5-tuples with the following structure:" msgstr "" -#: ../../library/socket.rst:942 +#: ../../library/socket.rst:946 msgid "``(family, type, proto, canonname, sockaddr)``" msgstr "``(family, type, proto, canonname, sockaddr)``" -#: ../../library/socket.rst:944 +#: ../../library/socket.rst:948 msgid "" "In these tuples, *family*, *type*, *proto* are all integers and are meant to " "be passed to the :func:`~socket.socket` function. *canonname* will be a " @@ -1117,7 +1127,39 @@ msgid "" "`AF_INET6`), and is meant to be passed to the :meth:`socket.connect` method." msgstr "" -#: ../../library/socket.rst:954 +#: ../../library/socket.rst:960 +msgid "" +"If you intend to use results from :func:`!getaddrinfo` to create a socket " +"(rather than, for example, retrieve *canonname*), consider limiting the " +"results by *type* (e.g. :data:`SOCK_STREAM` or :data:`SOCK_DGRAM`) and/or " +"*proto* (e.g. :data:`IPPROTO_TCP` or :data:`IPPROTO_UDP`) that your " +"application can handle." +msgstr "" + +#: ../../library/socket.rst:966 +msgid "" +"The behavior with default values of *family*, *type*, *proto* and *flags* is " +"system-specific." +msgstr "" + +#: ../../library/socket.rst:969 +msgid "" +"Many systems (for example, most Linux configurations) will return a sorted " +"list of all matching addresses. These addresses should generally be tried in " +"order until a connection succeeds (possibly tried in parallel, for example, " +"using a `Happy Eyeballs`_ algorithm). In these cases, limiting the *type* " +"and/or *proto* can help eliminate unsuccessful or unusable connection " +"attempts." +msgstr "" + +#: ../../library/socket.rst:976 +msgid "" +"Some systems will, however, only return a single address. (For example, this " +"was reported on Solaris and AIX configurations.) On these systems, limiting " +"the *type* and/or *proto* helps ensure that this address is usable." +msgstr "" + +#: ../../library/socket.rst:981 msgid "" "Raises an :ref:`auditing event ` ``socket.getaddrinfo`` with " "arguments ``host``, ``port``, ``family``, ``type``, ``protocol``." @@ -1125,14 +1167,14 @@ msgstr "" "引發一個附帶引數 ``host``、``port``、``family``、``type``、``protocol`` 的" "\\ :ref:`稽核事件 ` ``socket.getaddrinfo``。" -#: ../../library/socket.rst:956 +#: ../../library/socket.rst:983 msgid "" "The following example fetches address information for a hypothetical TCP " "connection to ``example.org`` on port 80 (results may differ on your system " "if IPv6 isn't enabled)::" msgstr "" -#: ../../library/socket.rst:960 +#: ../../library/socket.rst:987 msgid "" ">>> socket.getaddrinfo(\"example.org\", 80, proto=socket.IPPROTO_TCP)\n" "[(socket.AF_INET6, socket.SOCK_STREAM,\n" @@ -1146,17 +1188,17 @@ msgstr "" " (socket.AF_INET, socket.SOCK_STREAM,\n" " 6, '', ('93.184.216.34', 80))]" -#: ../../library/socket.rst:966 +#: ../../library/socket.rst:993 msgid "parameters can now be passed using keyword arguments." msgstr "" -#: ../../library/socket.rst:969 +#: ../../library/socket.rst:996 msgid "" "for IPv6 multicast addresses, string representing an address will not " "contain ``%scope_id`` part." msgstr "" -#: ../../library/socket.rst:975 +#: ../../library/socket.rst:1004 msgid "" "Return a fully qualified domain name for *name*. If *name* is omitted or " "empty, it is interpreted as the local host. To find the fully qualified " @@ -1167,7 +1209,7 @@ msgid "" "``'0.0.0.0'``, the hostname from :func:`gethostname` is returned." msgstr "" -#: ../../library/socket.rst:986 +#: ../../library/socket.rst:1015 msgid "" "Translate a host name to IPv4 address format. The IPv4 address is returned " "as a string, such as ``'100.50.200.5'``. If the host name is an IPv4 " @@ -1177,7 +1219,7 @@ msgid "" "stack support." msgstr "" -#: ../../library/socket.rst:992 ../../library/socket.rst:1008 +#: ../../library/socket.rst:1021 ../../library/socket.rst:1037 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyname`` with " "argument ``hostname``." @@ -1185,7 +1227,7 @@ msgstr "" "引發一個附帶引數 ``hostname`` 的\\ :ref:`稽核事件 ` ``socket." "gethostbyname``。" -#: ../../library/socket.rst:999 +#: ../../library/socket.rst:1028 msgid "" "Translate a host name to IPv4 address format, extended interface. Return a 3-" "tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the host's " @@ -1197,26 +1239,26 @@ msgid "" "stack support." msgstr "" -#: ../../library/socket.rst:1015 +#: ../../library/socket.rst:1044 msgid "" "Return a string containing the hostname of the machine where the Python " "interpreter is currently executing." msgstr "" -#: ../../library/socket.rst:1018 +#: ../../library/socket.rst:1047 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostname`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``socket.gethostname``。" -#: ../../library/socket.rst:1020 +#: ../../library/socket.rst:1049 msgid "" "Note: :func:`gethostname` doesn't always return the fully qualified domain " "name; use :func:`getfqdn` for that." msgstr "" -#: ../../library/socket.rst:1028 +#: ../../library/socket.rst:1057 msgid "" "Return a 3-tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is " "the primary host name responding to the given *ip_address*, *aliaslist* is a " @@ -1227,7 +1269,7 @@ msgid "" "`gethostbyaddr` supports both IPv4 and IPv6." msgstr "" -#: ../../library/socket.rst:1036 +#: ../../library/socket.rst:1065 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyaddr`` with " "argument ``ip_address``." @@ -1235,7 +1277,7 @@ msgstr "" "引發一個附帶引數 ``ip_address`` 的\\ :ref:`稽核事件 ` ``socket." "gethostbyaddr``。" -#: ../../library/socket.rst:1043 +#: ../../library/socket.rst:1072 msgid "" "Translate a socket address *sockaddr* into a 2-tuple ``(host, port)``. " "Depending on the settings of *flags*, the result can contain a fully " @@ -1243,18 +1285,18 @@ msgid "" "Similarly, *port* can contain a string port name or a numeric port number." msgstr "" -#: ../../library/socket.rst:1048 +#: ../../library/socket.rst:1077 msgid "" "For IPv6 addresses, ``%scope_id`` is appended to the host part if *sockaddr* " "contains meaningful *scope_id*. Usually this happens for multicast addresses." msgstr "" -#: ../../library/socket.rst:1051 +#: ../../library/socket.rst:1080 msgid "" "For more information about *flags* you can consult :manpage:`getnameinfo(3)`." msgstr "" -#: ../../library/socket.rst:1053 +#: ../../library/socket.rst:1082 msgid "" "Raises an :ref:`auditing event ` ``socket.getnameinfo`` with " "argument ``sockaddr``." @@ -1262,7 +1304,7 @@ msgstr "" "引發一個附帶引數 ``sockaddr`` 的\\ :ref:`稽核事件 ` ``socket." "getnameinfo``。" -#: ../../library/socket.rst:1060 +#: ../../library/socket.rst:1089 msgid "" "Translate an internet protocol name (for example, ``'icmp'``) to a constant " "suitable for passing as the (optional) third argument to the :func:`~socket." @@ -1271,14 +1313,14 @@ msgid "" "is chosen automatically if the protocol is omitted or zero." msgstr "" -#: ../../library/socket.rst:1071 +#: ../../library/socket.rst:1100 msgid "" "Translate an internet service name and protocol name to a port number for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: ../../library/socket.rst:1075 +#: ../../library/socket.rst:1104 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyname`` with " "arguments ``servicename``, ``protocolname``." @@ -1286,14 +1328,14 @@ msgstr "" "引發一個附帶引數 ``sockaddr``、``protocolname`` 的\\ :ref:`稽核事件 " "` ``socket.getservbyname``。" -#: ../../library/socket.rst:1082 +#: ../../library/socket.rst:1111 msgid "" "Translate an internet port number and protocol name to a service name for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: ../../library/socket.rst:1086 +#: ../../library/socket.rst:1115 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyport`` with " "arguments ``port``, ``protocolname``." @@ -1301,40 +1343,40 @@ msgstr "" "引發一個附帶引數 ``port``、``protocolname`` 的\\ :ref:`稽核事件 ` " "``socket.getservbyport``。" -#: ../../library/socket.rst:1093 +#: ../../library/socket.rst:1122 msgid "" "Convert 32-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: ../../library/socket.rst:1100 +#: ../../library/socket.rst:1129 msgid "" "Convert 16-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: ../../library/socket.rst:1104 ../../library/socket.rst:1122 +#: ../../library/socket.rst:1133 ../../library/socket.rst:1151 msgid "" "Raises :exc:`OverflowError` if *x* does not fit in a 16-bit unsigned integer." msgstr "" -#: ../../library/socket.rst:1111 +#: ../../library/socket.rst:1140 msgid "" "Convert 32-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: ../../library/socket.rst:1118 +#: ../../library/socket.rst:1147 msgid "" "Convert 16-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: ../../library/socket.rst:1129 +#: ../../library/socket.rst:1158 msgid "" "Convert an IPv4 address from dotted-quad string format (for example, " "'123.45.67.89') to 32-bit packed binary format, as a bytes object four " @@ -1343,26 +1385,26 @@ msgid "" "which is the C type for the 32-bit packed binary this function returns." msgstr "" -#: ../../library/socket.rst:1135 +#: ../../library/socket.rst:1164 msgid "" ":func:`inet_aton` also accepts strings with less than three dots; see the " "Unix manual page :manpage:`inet(3)` for details." msgstr "" -#: ../../library/socket.rst:1138 +#: ../../library/socket.rst:1167 msgid "" "If the IPv4 address string passed to this function is invalid, :exc:" "`OSError` will be raised. Note that exactly what is valid depends on the " "underlying C implementation of :c:func:`inet_aton`." msgstr "" -#: ../../library/socket.rst:1142 +#: ../../library/socket.rst:1171 msgid "" ":func:`inet_aton` does not support IPv6, and :func:`inet_pton` should be " "used instead for IPv4/v6 dual stack support." msgstr "" -#: ../../library/socket.rst:1148 +#: ../../library/socket.rst:1177 msgid "" "Convert a 32-bit packed IPv4 address (a :term:`bytes-like object` four bytes " "in length) to its standard dotted-quad string representation (for example, " @@ -1372,7 +1414,7 @@ msgid "" "argument." msgstr "" -#: ../../library/socket.rst:1155 +#: ../../library/socket.rst:1184 msgid "" "If the byte sequence passed to this function is not exactly 4 bytes in " "length, :exc:`OSError` will be raised. :func:`inet_ntoa` does not support " @@ -1380,7 +1422,7 @@ msgid "" "support." msgstr "" -#: ../../library/socket.rst:1166 +#: ../../library/socket.rst:1195 msgid "" "Convert an IP address from its family-specific string format to a packed, " "binary format. :func:`inet_pton` is useful when a library or network " @@ -1388,7 +1430,7 @@ msgid "" "`inet_aton`) or :c:struct:`in6_addr`." msgstr "" -#: ../../library/socket.rst:1171 +#: ../../library/socket.rst:1200 msgid "" "Supported values for *address_family* are currently :const:`AF_INET` and :" "const:`AF_INET6`. If the IP address string *ip_string* is invalid, :exc:" @@ -1397,11 +1439,11 @@ msgid "" "`inet_pton`." msgstr "" -#: ../../library/socket.rst:1179 ../../library/socket.rst:1199 +#: ../../library/socket.rst:1208 ../../library/socket.rst:1228 msgid "Windows support added" msgstr "" -#: ../../library/socket.rst:1185 +#: ../../library/socket.rst:1214 msgid "" "Convert a packed IP address (a :term:`bytes-like object` of some number of " "bytes) to its standard, family-specific string representation (for example, " @@ -1410,7 +1452,7 @@ msgid "" "(similar to :func:`inet_ntoa`) or :c:struct:`in6_addr`." msgstr "" -#: ../../library/socket.rst:1192 +#: ../../library/socket.rst:1221 msgid "" "Supported values for *address_family* are currently :const:`AF_INET` and :" "const:`AF_INET6`. If the bytes object *packed_ip* is not the correct length " @@ -1418,7 +1460,7 @@ msgid "" "`OSError` is raised for errors from the call to :func:`inet_ntop`." msgstr "" -#: ../../library/socket.rst:1214 +#: ../../library/socket.rst:1243 msgid "" "Return the total length, without trailing padding, of an ancillary data item " "with associated data of the given *length*. This value can often be used as " @@ -1429,12 +1471,12 @@ msgid "" "the permissible range of values." msgstr "" -#: ../../library/socket.rst:1225 ../../library/socket.rst:1717 -#: ../../library/socket.rst:1761 ../../library/socket.rst:1869 +#: ../../library/socket.rst:1254 ../../library/socket.rst:1746 +#: ../../library/socket.rst:1790 ../../library/socket.rst:1898 msgid "Most Unix platforms." msgstr "" -#: ../../library/socket.rst:1232 +#: ../../library/socket.rst:1261 msgid "" "Return the buffer size needed for :meth:`~socket.recvmsg` to receive an " "ancillary data item with associated data of the given *length*, along with " @@ -1444,7 +1486,7 @@ msgid "" "values." msgstr "" -#: ../../library/socket.rst:1240 +#: ../../library/socket.rst:1269 msgid "" "Note that some systems might support ancillary data without providing this " "function. Also note that setting the buffer size using the results of this " @@ -1452,31 +1494,31 @@ msgid "" "received, since additional data may be able to fit into the padding area." msgstr "" -#: ../../library/socket.rst:1248 +#: ../../library/socket.rst:1277 msgid "most Unix platforms." msgstr "" -#: ../../library/socket.rst:1255 +#: ../../library/socket.rst:1284 msgid "" "Return the default timeout in seconds (float) for new socket objects. A " "value of ``None`` indicates that new socket objects have no timeout. When " "the socket module is first imported, the default is ``None``." msgstr "" -#: ../../library/socket.rst:1262 +#: ../../library/socket.rst:1291 msgid "" "Set the default timeout in seconds (float) for new socket objects. When the " "socket module is first imported, the default is ``None``. See :meth:" "`~socket.settimeout` for possible values and their respective meanings." msgstr "" -#: ../../library/socket.rst:1270 +#: ../../library/socket.rst:1299 msgid "" "Set the machine's hostname to *name*. This will raise an :exc:`OSError` if " "you don't have enough rights." msgstr "" -#: ../../library/socket.rst:1273 +#: ../../library/socket.rst:1302 msgid "" "Raises an :ref:`auditing event ` ``socket.sethostname`` with " "argument ``name``." @@ -1484,102 +1526,102 @@ msgstr "" "引發一個附帶引數 ``name`` 的\\ :ref:`稽核事件 ` ``socket." "sethostname``。" -#: ../../library/socket.rst:1282 +#: ../../library/socket.rst:1311 msgid "" "Return a list of network interface information (index int, name string) " "tuples. :exc:`OSError` if the system call fails." msgstr "" -#: ../../library/socket.rst:1290 ../../library/socket.rst:1317 -#: ../../library/socket.rst:1334 +#: ../../library/socket.rst:1319 ../../library/socket.rst:1346 +#: ../../library/socket.rst:1363 msgid "Windows support was added." msgstr "增加對 Windows 的支援。" -#: ../../library/socket.rst:1295 +#: ../../library/socket.rst:1324 msgid "" "On Windows network interfaces have different names in different contexts " "(all names are examples):" msgstr "" -#: ../../library/socket.rst:1298 +#: ../../library/socket.rst:1327 msgid "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" msgstr "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" -#: ../../library/socket.rst:1299 +#: ../../library/socket.rst:1328 msgid "name: ``ethernet_32770``" msgstr "" -#: ../../library/socket.rst:1300 +#: ../../library/socket.rst:1329 msgid "friendly name: ``vEthernet (nat)``" msgstr "" -#: ../../library/socket.rst:1301 +#: ../../library/socket.rst:1330 msgid "description: ``Hyper-V Virtual Ethernet Adapter``" msgstr "" -#: ../../library/socket.rst:1303 +#: ../../library/socket.rst:1332 msgid "" "This function returns names of the second form from the list, " "``ethernet_32770`` in this example case." msgstr "" -#: ../../library/socket.rst:1309 +#: ../../library/socket.rst:1338 msgid "" "Return a network interface index number corresponding to an interface name. :" "exc:`OSError` if no interface with the given name exists." msgstr "" -#: ../../library/socket.rst:1321 ../../library/socket.rst:1338 +#: ../../library/socket.rst:1350 ../../library/socket.rst:1367 msgid "\"Interface name\" is a name as documented in :func:`if_nameindex`." msgstr "" -#: ../../library/socket.rst:1326 +#: ../../library/socket.rst:1355 msgid "" "Return a network interface name corresponding to an interface index number. :" "exc:`OSError` if no interface with the given index exists." msgstr "" -#: ../../library/socket.rst:1343 +#: ../../library/socket.rst:1372 msgid "" "Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket " "*sock*. The *fds* parameter is a sequence of file descriptors. Consult :meth:" "`~socket.sendmsg` for the documentation of these parameters." msgstr "" -#: ../../library/socket.rst:1349 ../../library/socket.rst:1363 +#: ../../library/socket.rst:1378 ../../library/socket.rst:1392 msgid "" "Unix platforms supporting :meth:`~socket.sendmsg` and :const:`SCM_RIGHTS` " "mechanism." msgstr "" -#: ../../library/socket.rst:1357 +#: ../../library/socket.rst:1386 msgid "" "Receive up to *maxfds* file descriptors from an :const:`AF_UNIX` socket " "*sock*. Return ``(msg, list(fds), flags, addr)``. Consult :meth:`~socket." "recvmsg` for the documentation of these parameters." msgstr "" -#: ../../library/socket.rst:1370 +#: ../../library/socket.rst:1399 msgid "Any truncated integers at the end of the list of file descriptors." msgstr "" -#: ../../library/socket.rst:1376 +#: ../../library/socket.rst:1405 msgid "Socket Objects" msgstr "Socket 物件" -#: ../../library/socket.rst:1378 +#: ../../library/socket.rst:1407 msgid "" "Socket objects have the following methods. Except for :meth:`~socket." "makefile`, these correspond to Unix system calls applicable to sockets." msgstr "" -#: ../../library/socket.rst:1382 +#: ../../library/socket.rst:1411 msgid "" "Support for the :term:`context manager` protocol was added. Exiting the " "context manager is equivalent to calling :meth:`~socket.close`." msgstr "" -#: ../../library/socket.rst:1389 +#: ../../library/socket.rst:1418 msgid "" "Accept a connection. The socket must be bound to an address and listening " "for connections. The return value is a pair ``(conn, address)`` where *conn* " @@ -1588,27 +1630,27 @@ msgid "" "connection." msgstr "" -#: ../../library/socket.rst:1396 ../../library/socket.rst:1490 +#: ../../library/socket.rst:1425 ../../library/socket.rst:1519 msgid "The socket is now non-inheritable." msgstr "" -#: ../../library/socket.rst:1399 ../../library/socket.rst:1630 -#: ../../library/socket.rst:1644 ../../library/socket.rst:1721 -#: ../../library/socket.rst:1794 ../../library/socket.rst:1813 -#: ../../library/socket.rst:1830 ../../library/socket.rst:1875 +#: ../../library/socket.rst:1428 ../../library/socket.rst:1659 +#: ../../library/socket.rst:1673 ../../library/socket.rst:1750 +#: ../../library/socket.rst:1823 ../../library/socket.rst:1842 +#: ../../library/socket.rst:1859 ../../library/socket.rst:1904 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the method now retries the system call instead of raising an :exc:" "`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -#: ../../library/socket.rst:1407 +#: ../../library/socket.rst:1436 msgid "" "Bind the socket to *address*. The socket must not already be bound. (The " "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1410 +#: ../../library/socket.rst:1439 msgid "" "Raises an :ref:`auditing event ` ``socket.bind`` with arguments " "``self``, ``address``." @@ -1616,7 +1658,7 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.bind``。" -#: ../../library/socket.rst:1417 +#: ../../library/socket.rst:1446 msgid "" "Mark the socket closed. The underlying system resource (e.g. a file " "descriptor) is also closed when all file objects from :meth:`makefile` are " @@ -1625,33 +1667,33 @@ msgid "" "flushed)." msgstr "" -#: ../../library/socket.rst:1423 +#: ../../library/socket.rst:1452 msgid "" "Sockets are automatically closed when they are garbage-collected, but it is " "recommended to :meth:`close` them explicitly, or to use a :keyword:`with` " "statement around them." msgstr "" -#: ../../library/socket.rst:1427 +#: ../../library/socket.rst:1456 msgid "" ":exc:`OSError` is now raised if an error occurs when the underlying :c:func:" "`close` call is made." msgstr "" -#: ../../library/socket.rst:1433 +#: ../../library/socket.rst:1462 msgid "" ":meth:`close` releases the resource associated with a connection but does " "not necessarily close the connection immediately. If you want to close the " "connection in a timely fashion, call :meth:`shutdown` before :meth:`close`." msgstr "" -#: ../../library/socket.rst:1441 +#: ../../library/socket.rst:1470 msgid "" "Connect to a remote socket at *address*. (The format of *address* depends on " "the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1444 +#: ../../library/socket.rst:1473 msgid "" "If the connection is interrupted by a signal, the method waits until the " "connection completes, or raise a :exc:`TimeoutError` on timeout, if the " @@ -1661,7 +1703,7 @@ msgid "" "(or the exception raised by the signal handler)." msgstr "" -#: ../../library/socket.rst:1451 ../../library/socket.rst:1471 +#: ../../library/socket.rst:1480 ../../library/socket.rst:1500 msgid "" "Raises an :ref:`auditing event ` ``socket.connect`` with arguments " "``self``, ``address``." @@ -1669,7 +1711,7 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.connect``。" -#: ../../library/socket.rst:1453 +#: ../../library/socket.rst:1482 msgid "" "The method now waits until the connection completes instead of raising an :" "exc:`InterruptedError` exception if the connection is interrupted by a " @@ -1677,7 +1719,7 @@ msgid "" "blocking or has a timeout (see the :pep:`475` for the rationale)." msgstr "" -#: ../../library/socket.rst:1464 +#: ../../library/socket.rst:1493 msgid "" "Like ``connect(address)``, but return an error indicator instead of raising " "an exception for errors returned by the C-level :c:func:`connect` call " @@ -1687,38 +1729,38 @@ msgid "" "asynchronous connects." msgstr "" -#: ../../library/socket.rst:1477 +#: ../../library/socket.rst:1506 msgid "" "Put the socket object into closed state without actually closing the " "underlying file descriptor. The file descriptor is returned, and can be " "reused for other purposes." msgstr "" -#: ../../library/socket.rst:1486 +#: ../../library/socket.rst:1515 msgid "Duplicate the socket." msgstr "" -#: ../../library/socket.rst:1498 +#: ../../library/socket.rst:1527 msgid "" "Return the socket's file descriptor (a small integer), or -1 on failure. " "This is useful with :func:`select.select`." msgstr "" -#: ../../library/socket.rst:1501 +#: ../../library/socket.rst:1530 msgid "" "Under Windows the small integer returned by this method cannot be used where " "a file descriptor can be used (such as :func:`os.fdopen`). Unix does not " "have this limitation." msgstr "" -#: ../../library/socket.rst:1507 +#: ../../library/socket.rst:1536 msgid "" "Get the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle: ``True`` if the socket can be inherited in " "child processes, ``False`` if it cannot." msgstr "" -#: ../../library/socket.rst:1516 +#: ../../library/socket.rst:1545 msgid "" "Return the remote address to which the socket is connected. This is useful " "to find out the port number of a remote IPv4/v6 socket, for instance. (The " @@ -1726,14 +1768,14 @@ msgid "" "above.) On some systems this function is not supported." msgstr "" -#: ../../library/socket.rst:1524 +#: ../../library/socket.rst:1553 msgid "" "Return the socket's own address. This is useful to find out the port number " "of an IPv4/v6 socket, for instance. (The format of the address returned " "depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1531 +#: ../../library/socket.rst:1560 msgid "" "Return the value of the given socket option (see the Unix man page :manpage:" "`getsockopt(2)`). The needed symbolic constants (:ref:`SO_\\* etc. `_ for more information." msgstr "" -#: ../../library/socket.rst:1569 +#: ../../library/socket.rst:1598 msgid "" "On other platforms, the generic :func:`fcntl.fcntl` and :func:`fcntl.ioctl` " "functions may be used; they accept a socket object as their first argument." msgstr "" -#: ../../library/socket.rst:1572 +#: ../../library/socket.rst:1601 msgid "" "Currently only the following control codes are supported: ``SIO_RCVALL``, " "``SIO_KEEPALIVE_VALS``, and ``SIO_LOOPBACK_FAST_PATH``." msgstr "" -#: ../../library/socket.rst:1580 +#: ../../library/socket.rst:1609 msgid "" "Enable a server to accept connections. If *backlog* is specified, it must " "be at least 0 (if it is lower, it is set to 0); it specifies the number of " @@ -1797,11 +1839,11 @@ msgid "" "connections. If not specified, a default reasonable value is chosen." msgstr "" -#: ../../library/socket.rst:1587 +#: ../../library/socket.rst:1616 msgid "The *backlog* parameter is now optional." msgstr "" -#: ../../library/socket.rst:1596 +#: ../../library/socket.rst:1625 msgid "" "Return a :term:`file object` associated with the socket. The exact returned " "type depends on the arguments given to :meth:`makefile`. These arguments " @@ -1810,28 +1852,28 @@ msgid "" "``'b'``, or a combination of those." msgstr "" -#: ../../library/socket.rst:1602 +#: ../../library/socket.rst:1631 msgid "" "The socket must be in blocking mode; it can have a timeout, but the file " "object's internal buffer may end up in an inconsistent state if a timeout " "occurs." msgstr "" -#: ../../library/socket.rst:1606 +#: ../../library/socket.rst:1635 msgid "" "Closing the file object returned by :meth:`makefile` won't close the " "original socket unless all other file objects have been closed and :meth:" "`socket.close` has been called on the socket object." msgstr "" -#: ../../library/socket.rst:1612 +#: ../../library/socket.rst:1641 msgid "" "On Windows, the file-like object created by :meth:`makefile` cannot be used " "where a file object with a file descriptor is expected, such as the stream " "arguments of :meth:`subprocess.Popen`." msgstr "" -#: ../../library/socket.rst:1619 +#: ../../library/socket.rst:1648 msgid "" "Receive data from the socket. The return value is a bytes object " "representing the data received. The maximum amount of data to be received " @@ -1841,13 +1883,13 @@ msgid "" "zero." msgstr "" -#: ../../library/socket.rst:1627 +#: ../../library/socket.rst:1656 msgid "" "For best match with hardware and network realities, the value of *bufsize* " "should be a relatively small power of 2, for example, 4096." msgstr "" -#: ../../library/socket.rst:1638 +#: ../../library/socket.rst:1667 msgid "" "Receive data from the socket. The return value is a pair ``(bytes, " "address)`` where *bytes* is a bytes object representing the data received " @@ -1857,14 +1899,14 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1649 +#: ../../library/socket.rst:1678 msgid "" "For multicast IPv6 address, first item of *address* does not contain " "``%scope_id`` part anymore. In order to get full IPv6 address use :func:" "`getnameinfo`." msgstr "" -#: ../../library/socket.rst:1656 +#: ../../library/socket.rst:1685 msgid "" "Receive normal data (up to *bufsize* bytes) and ancillary data from the " "socket. The *ancbufsize* argument sets the size in bytes of the internal " @@ -1875,7 +1917,7 @@ msgid "" "*flags* argument defaults to 0 and has the same meaning as for :meth:`recv`." msgstr "" -#: ../../library/socket.rst:1666 +#: ../../library/socket.rst:1695 msgid "" "The return value is a 4-tuple: ``(data, ancdata, msg_flags, address)``. The " "*data* item is a :class:`bytes` object holding the non-ancillary data " @@ -1890,7 +1932,7 @@ msgid "" "socket, if available; otherwise, its value is unspecified." msgstr "" -#: ../../library/socket.rst:1680 +#: ../../library/socket.rst:1709 msgid "" "On some systems, :meth:`sendmsg` and :meth:`recvmsg` can be used to pass " "file descriptors between processes over an :const:`AF_UNIX` socket. When " @@ -1903,7 +1945,7 @@ msgid "" "descriptors received via this mechanism." msgstr "" -#: ../../library/socket.rst:1691 +#: ../../library/socket.rst:1720 msgid "" "Some systems do not indicate the truncated length of ancillary data items " "which have been only partially received. If an item appears to extend " @@ -1912,7 +1954,7 @@ msgid "" "provided it has not been truncated before the start of its associated data." msgstr "" -#: ../../library/socket.rst:1698 +#: ../../library/socket.rst:1727 msgid "" "On systems which support the :const:`SCM_RIGHTS` mechanism, the following " "function will receive up to *maxfds* file descriptors, returning the message " @@ -1921,7 +1963,7 @@ msgid "" "meth:`sendmsg`. ::" msgstr "" -#: ../../library/socket.rst:1704 +#: ../../library/socket.rst:1733 msgid "" "import socket, array\n" "\n" @@ -1938,7 +1980,7 @@ msgid "" " return msg, list(fds)" msgstr "" -#: ../../library/socket.rst:1729 +#: ../../library/socket.rst:1758 msgid "" "Receive normal data and ancillary data from the socket, behaving as :meth:" "`recvmsg` would, but scatter the non-ancillary data into a series of buffers " @@ -1951,7 +1993,7 @@ msgid "" "arguments have the same meaning as for :meth:`recvmsg`." msgstr "" -#: ../../library/socket.rst:1740 +#: ../../library/socket.rst:1769 msgid "" "The return value is a 4-tuple: ``(nbytes, ancdata, msg_flags, address)``, " "where *nbytes* is the total number of bytes of non-ancillary data written " @@ -1959,11 +2001,11 @@ msgid "" "for :meth:`recvmsg`." msgstr "" -#: ../../library/socket.rst:1745 +#: ../../library/socket.rst:1774 msgid "Example::" msgstr "範例: ::" -#: ../../library/socket.rst:1747 +#: ../../library/socket.rst:1776 msgid "" ">>> import socket\n" ">>> s1, s2 = socket.socketpair()\n" @@ -1989,7 +2031,7 @@ msgstr "" ">>> [b1, b2, b3]\n" "[bytearray(b'Mary'), bytearray(b'01 had a 9'), bytearray(b'little lamb---')]" -#: ../../library/socket.rst:1768 +#: ../../library/socket.rst:1797 msgid "" "Receive data from the socket, writing it into *buffer* instead of creating a " "new bytestring. The return value is a pair ``(nbytes, address)`` where " @@ -1999,7 +2041,7 @@ msgid "" "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1778 +#: ../../library/socket.rst:1807 msgid "" "Receive up to *nbytes* bytes from the socket, storing the data into a buffer " "rather than creating a new bytestring. If *nbytes* is not specified (or 0), " @@ -2008,7 +2050,7 @@ msgid "" "of the optional argument *flags*; it defaults to zero." msgstr "" -#: ../../library/socket.rst:1787 +#: ../../library/socket.rst:1816 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -2018,7 +2060,7 @@ msgid "" "data. For further information on this topic, consult the :ref:`socket-howto`." msgstr "" -#: ../../library/socket.rst:1802 +#: ../../library/socket.rst:1831 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -2028,13 +2070,13 @@ msgid "" "to determine how much data, if any, was successfully sent." msgstr "" -#: ../../library/socket.rst:1809 +#: ../../library/socket.rst:1838 msgid "" "The socket timeout is no longer reset each time data is sent successfully. " "The socket timeout is now the maximum total duration to send all data." msgstr "" -#: ../../library/socket.rst:1822 +#: ../../library/socket.rst:1851 msgid "" "Send data to the socket. The socket should not be connected to a remote " "socket, since the destination socket is specified by *address*. The " @@ -2043,7 +2085,7 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1828 +#: ../../library/socket.rst:1857 msgid "" "Raises an :ref:`auditing event ` ``socket.sendto`` with arguments " "``self``, ``address``." @@ -2051,7 +2093,7 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.sendto``。" -#: ../../library/socket.rst:1838 +#: ../../library/socket.rst:1867 msgid "" "Send normal and ancillary data to the socket, gathering the non-ancillary " "data from a series of buffers and concatenating it into a single message. " @@ -2071,14 +2113,14 @@ msgid "" "bytes of non-ancillary data sent." msgstr "" -#: ../../library/socket.rst:1858 +#: ../../library/socket.rst:1887 msgid "" "The following function sends the list of file descriptors *fds* over an :" "const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` " "mechanism. See also :meth:`recvmsg`. ::" msgstr "" -#: ../../library/socket.rst:1862 +#: ../../library/socket.rst:1891 msgid "" "import socket, array\n" "\n" @@ -2092,7 +2134,7 @@ msgstr "" " return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array." "array(\"i\", fds))])" -#: ../../library/socket.rst:1871 +#: ../../library/socket.rst:1900 msgid "" "Raises an :ref:`auditing event ` ``socket.sendmsg`` with arguments " "``self``, ``address``." @@ -2100,14 +2142,14 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.sendmsg``。" -#: ../../library/socket.rst:1882 +#: ../../library/socket.rst:1911 msgid "" "Specialized version of :meth:`~socket.sendmsg` for :const:`AF_ALG` socket. " "Set mode, IV, AEAD associated data length and flags for :const:`AF_ALG` " "socket." msgstr "" -#: ../../library/socket.rst:1891 +#: ../../library/socket.rst:1920 msgid "" "Send a file until EOF is reached by using high-performance :mod:`os." "sendfile` and return the total number of bytes which were sent. *file* must " @@ -2121,38 +2163,38 @@ msgid "" "be of :const:`SOCK_STREAM` type. Non-blocking sockets are not supported." msgstr "" -#: ../../library/socket.rst:1907 +#: ../../library/socket.rst:1936 msgid "" "Set the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle." msgstr "" -#: ../../library/socket.rst:1915 +#: ../../library/socket.rst:1944 msgid "" "Set blocking or non-blocking mode of the socket: if *flag* is false, the " "socket is set to non-blocking, else to blocking mode." msgstr "" -#: ../../library/socket.rst:1918 +#: ../../library/socket.rst:1947 msgid "" "This method is a shorthand for certain :meth:`~socket.settimeout` calls:" msgstr "" -#: ../../library/socket.rst:1920 +#: ../../library/socket.rst:1949 msgid "``sock.setblocking(True)`` is equivalent to ``sock.settimeout(None)``" msgstr "``sock.setblocking(True)`` 等價於 ``sock.settimeout(None)``" -#: ../../library/socket.rst:1922 +#: ../../library/socket.rst:1951 msgid "``sock.setblocking(False)`` is equivalent to ``sock.settimeout(0.0)``" msgstr "``sock.setblocking(False)`` 等價於 ``sock.settimeout(0.0)``" -#: ../../library/socket.rst:1924 +#: ../../library/socket.rst:1953 msgid "" "The method no longer applies :const:`SOCK_NONBLOCK` flag on :attr:`socket." "type`." msgstr "" -#: ../../library/socket.rst:1931 +#: ../../library/socket.rst:1960 msgid "" "Set a timeout on blocking socket operations. The *value* argument can be a " "nonnegative floating-point number expressing seconds, or ``None``. If a non-" @@ -2162,19 +2204,19 @@ msgid "" "blocking mode. If ``None`` is given, the socket is put in blocking mode." msgstr "" -#: ../../library/socket.rst:1938 +#: ../../library/socket.rst:1967 msgid "" "For further information, please consult the :ref:`notes on socket timeouts " "`." msgstr "" -#: ../../library/socket.rst:1940 +#: ../../library/socket.rst:1969 msgid "" "The method no longer toggles :const:`SOCK_NONBLOCK` flag on :attr:`socket." "type`." msgstr "" -#: ../../library/socket.rst:1953 +#: ../../library/socket.rst:1982 msgid "" "Set the value of the given socket option (see the Unix manual page :manpage:" "`setsockopt(2)`). The needed symbolic constants are defined in this module " @@ -2187,11 +2229,11 @@ msgid "" "C function with ``optval=NULL`` and ``optlen=optlen``." msgstr "" -#: ../../library/socket.rst:1966 +#: ../../library/socket.rst:1995 msgid "setsockopt(level, optname, None, optlen: int) form added." msgstr "" -#: ../../library/socket.rst:1974 +#: ../../library/socket.rst:2003 msgid "" "Shut down one or both halves of the connection. If *how* is :const:" "`SHUT_RD`, further receives are disallowed. If *how* is :const:`SHUT_WR`, " @@ -2199,7 +2241,7 @@ msgid "" "and receives are disallowed." msgstr "" -#: ../../library/socket.rst:1984 +#: ../../library/socket.rst:2013 msgid "" "Duplicate a socket and prepare it for sharing with a target process. The " "target process must be provided with *process_id*. The resulting bytes " @@ -2210,48 +2252,48 @@ msgid "" "process." msgstr "" -#: ../../library/socket.rst:1996 +#: ../../library/socket.rst:2025 msgid "" "Note that there are no methods :meth:`read` or :meth:`write`; use :meth:" "`~socket.recv` and :meth:`~socket.send` without *flags* argument instead." msgstr "" -#: ../../library/socket.rst:1999 +#: ../../library/socket.rst:2028 msgid "" "Socket objects also have these (read-only) attributes that correspond to the " "values given to the :class:`~socket.socket` constructor." msgstr "" -#: ../../library/socket.rst:2005 +#: ../../library/socket.rst:2034 msgid "The socket family." msgstr "" -#: ../../library/socket.rst:2010 +#: ../../library/socket.rst:2039 msgid "The socket type." msgstr "" -#: ../../library/socket.rst:2015 +#: ../../library/socket.rst:2044 msgid "The socket protocol." msgstr "" -#: ../../library/socket.rst:2022 +#: ../../library/socket.rst:2051 msgid "Notes on socket timeouts" msgstr "" -#: ../../library/socket.rst:2024 +#: ../../library/socket.rst:2053 msgid "" "A socket object can be in one of three modes: blocking, non-blocking, or " "timeout. Sockets are by default always created in blocking mode, but this " "can be changed by calling :func:`setdefaulttimeout`." msgstr "" -#: ../../library/socket.rst:2028 +#: ../../library/socket.rst:2057 msgid "" "In *blocking mode*, operations block until complete or the system returns an " "error (such as connection timed out)." msgstr "" -#: ../../library/socket.rst:2031 +#: ../../library/socket.rst:2060 msgid "" "In *non-blocking mode*, operations fail (with an error that is unfortunately " "system-dependent) if they cannot be completed immediately: functions from " @@ -2259,14 +2301,14 @@ msgid "" "available for reading or writing." msgstr "" -#: ../../library/socket.rst:2036 +#: ../../library/socket.rst:2065 msgid "" "In *timeout mode*, operations fail if they cannot be completed within the " "timeout specified for the socket (they raise a :exc:`timeout` exception) or " "if the system returns an error." msgstr "" -#: ../../library/socket.rst:2041 +#: ../../library/socket.rst:2070 msgid "" "At the operating system level, sockets in *timeout mode* are internally set " "in non-blocking mode. Also, the blocking and timeout modes are shared " @@ -2275,11 +2317,11 @@ msgid "" "you decide to use the :meth:`~socket.fileno` of a socket." msgstr "" -#: ../../library/socket.rst:2048 +#: ../../library/socket.rst:2077 msgid "Timeouts and the ``connect`` method" msgstr "" -#: ../../library/socket.rst:2050 +#: ../../library/socket.rst:2079 msgid "" "The :meth:`~socket.connect` operation is also subject to the timeout " "setting, and in general it is recommended to call :meth:`~socket.settimeout` " @@ -2289,24 +2331,24 @@ msgid "" "setting." msgstr "" -#: ../../library/socket.rst:2058 +#: ../../library/socket.rst:2087 msgid "Timeouts and the ``accept`` method" msgstr "" -#: ../../library/socket.rst:2060 +#: ../../library/socket.rst:2089 msgid "" "If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by the :" "meth:`~socket.accept` method inherit that timeout. Otherwise, the behaviour " "depends on settings of the listening socket:" msgstr "" -#: ../../library/socket.rst:2064 +#: ../../library/socket.rst:2093 msgid "" "if the listening socket is in *blocking mode* or in *timeout mode*, the " "socket returned by :meth:`~socket.accept` is in *blocking mode*;" msgstr "" -#: ../../library/socket.rst:2067 +#: ../../library/socket.rst:2096 msgid "" "if the listening socket is in *non-blocking mode*, whether the socket " "returned by :meth:`~socket.accept` is in blocking or non-blocking mode is " @@ -2314,11 +2356,11 @@ msgid "" "it is recommended you manually override this setting." msgstr "" -#: ../../library/socket.rst:2076 +#: ../../library/socket.rst:2105 msgid "Example" msgstr "範例" -#: ../../library/socket.rst:2078 +#: ../../library/socket.rst:2107 msgid "" "Here are four minimal example programs using the TCP/IP protocol: a server " "that echoes all data that it receives back (servicing only one client), and " @@ -2331,11 +2373,11 @@ msgid "" "on the new socket returned by :meth:`~socket.accept`." msgstr "" -#: ../../library/socket.rst:2088 +#: ../../library/socket.rst:2117 msgid "The first two examples support IPv4 only. ::" msgstr "前兩個範例只支援 IPv4: ::" -#: ../../library/socket.rst:2090 +#: ../../library/socket.rst:2119 msgid "" "# Echo server program\n" "import socket\n" @@ -2354,7 +2396,7 @@ msgid "" " conn.sendall(data)" msgstr "" -#: ../../library/socket.rst:2108 +#: ../../library/socket.rst:2137 msgid "" "# Echo client program\n" "import socket\n" @@ -2368,7 +2410,7 @@ msgid "" "print('Received', repr(data))" msgstr "" -#: ../../library/socket.rst:2119 +#: ../../library/socket.rst:2148 msgid "" "The next two examples are identical to the above two, but support both IPv4 " "and IPv6. The server side will listen to the first address family available " @@ -2378,7 +2420,7 @@ msgid "" "resolution, and sends traffic to the first one connected successfully. ::" msgstr "" -#: ../../library/socket.rst:2126 +#: ../../library/socket.rst:2155 msgid "" "# Echo server program\n" "import socket\n" @@ -2415,7 +2457,7 @@ msgid "" " conn.send(data)" msgstr "" -#: ../../library/socket.rst:2162 +#: ../../library/socket.rst:2191 msgid "" "# Echo client program\n" "import socket\n" @@ -2448,14 +2490,14 @@ msgid "" "print('Received', repr(data))" msgstr "" -#: ../../library/socket.rst:2191 +#: ../../library/socket.rst:2220 msgid "" "The next example shows how to write a very simple network sniffer with raw " "sockets on Windows. The example requires administrator privileges to modify " "the interface::" msgstr "" -#: ../../library/socket.rst:2195 +#: ../../library/socket.rst:2224 msgid "" "import socket\n" "\n" @@ -2479,29 +2521,29 @@ msgid "" "s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)" msgstr "" -#: ../../library/socket.rst:2216 +#: ../../library/socket.rst:2245 msgid "" "The next example shows how to use the socket interface to communicate to a " "CAN network using the raw socket protocol. To use CAN with the broadcast " "manager protocol instead, open a socket with::" msgstr "" -#: ../../library/socket.rst:2220 +#: ../../library/socket.rst:2249 msgid "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" msgstr "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" -#: ../../library/socket.rst:2222 +#: ../../library/socket.rst:2251 msgid "" "After binding (:const:`CAN_RAW`) or connecting (:const:`CAN_BCM`) the " "socket, you can use the :meth:`socket.send` and :meth:`socket.recv` " "operations (and their counterparts) on the socket object as usual." msgstr "" -#: ../../library/socket.rst:2226 +#: ../../library/socket.rst:2255 msgid "This last example might require special privileges::" msgstr "" -#: ../../library/socket.rst:2228 +#: ../../library/socket.rst:2257 msgid "" "import socket\n" "import struct\n" @@ -2543,29 +2585,29 @@ msgid "" " print('Error sending CAN frame')" msgstr "" -#: ../../library/socket.rst:2266 +#: ../../library/socket.rst:2295 msgid "" "Running an example several times with too small delay between executions, " "could lead to this error::" msgstr "" -#: ../../library/socket.rst:2269 +#: ../../library/socket.rst:2298 msgid "OSError: [Errno 98] Address already in use" msgstr "OSError: [Errno 98] Address already in use" -#: ../../library/socket.rst:2271 +#: ../../library/socket.rst:2300 msgid "" "This is because the previous execution has left the socket in a " "``TIME_WAIT`` state, and can't be immediately reused." msgstr "" -#: ../../library/socket.rst:2274 +#: ../../library/socket.rst:2303 msgid "" "There is a :mod:`socket` flag to set, in order to prevent this, :const:" "`socket.SO_REUSEADDR`::" msgstr "" -#: ../../library/socket.rst:2277 +#: ../../library/socket.rst:2306 msgid "" "s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" @@ -2575,30 +2617,30 @@ msgstr "" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" "s.bind((HOST, PORT))" -#: ../../library/socket.rst:2281 +#: ../../library/socket.rst:2310 msgid "" "the :data:`SO_REUSEADDR` flag tells the kernel to reuse a local socket in " "``TIME_WAIT`` state, without waiting for its natural timeout to expire." msgstr "" -#: ../../library/socket.rst:2287 +#: ../../library/socket.rst:2316 msgid "" "For an introduction to socket programming (in C), see the following papers:" msgstr "" -#: ../../library/socket.rst:2289 +#: ../../library/socket.rst:2318 msgid "" "*An Introductory 4.3BSD Interprocess Communication Tutorial*, by Stuart " "Sechrest" msgstr "" -#: ../../library/socket.rst:2291 +#: ../../library/socket.rst:2320 msgid "" "*An Advanced 4.3BSD Interprocess Communication Tutorial*, by Samuel J. " "Leffler et al," msgstr "" -#: ../../library/socket.rst:2294 +#: ../../library/socket.rst:2323 msgid "" "both in the UNIX Programmer's Manual, Supplementary Documents 1 (sections " "PS1:7 and PS1:8). The platform-specific reference material for the various " @@ -2617,18 +2659,18 @@ msgstr "object(物件)" msgid "socket" msgstr "socket" -#: ../../library/socket.rst:1594 +#: ../../library/socket.rst:1623 msgid "I/O control" msgstr "I/O control(I/O 控制)" -#: ../../library/socket.rst:1594 +#: ../../library/socket.rst:1623 msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/socket.rst:1951 +#: ../../library/socket.rst:1980 msgid "module" msgstr "module(模組)" -#: ../../library/socket.rst:1951 +#: ../../library/socket.rst:1980 msgid "struct" msgstr "struct" diff --git a/library/spwd.po b/library/spwd.po new file mode 100644 index 0000000000..adcb3a7591 --- /dev/null +++ b/library/spwd.po @@ -0,0 +1,47 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/spwd.rst:2 +msgid ":mod:`!spwd` --- The shadow password database" +msgstr ":mod:`!spwd` --- shadow 密碼資料庫" + +#: ../../library/spwd.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/spwd.rst:14 +msgid "" +"A possible replacement is the third-party library :pypi:`python-pam`. This " +"library is not supported or maintained by the Python core team." +msgstr "" +"可能的替代方案是 PyPI 上的第三方函式庫::pypi:`python-pam`。這並不受 Python " +"核心團隊支援或維護。" + +#: ../../library/spwd.rst:17 +msgid "" +"The last version of Python that provided the :mod:`!spwd` module was `Python " +"3.12 `_." +msgstr "" +"最後提供 :mod:`!spwd` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/sqlite3.po b/library/sqlite3.po index 7d1f66f4ea..509dad97ff 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -720,11 +720,11 @@ msgstr "" #: ../../library/sqlite3.rst:529 msgid "SQLite threading mode" -msgstr "" +msgstr "SQLite 執行緒模式" #: ../../library/sqlite3.rst:529 msgid ":pep:`threadsafety <0249#threadsafety>`" -msgstr "" +msgstr ":pep:`執行緒安全 <0249#threadsafety>`" #: ../../library/sqlite3.rst:529 msgid "`SQLITE_THREADSAFE`_" diff --git a/library/stdtypes.po b/library/stdtypes.po index 7421a5e216..332f14e2f5 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -6861,9 +6861,10 @@ msgid "" msgstr "" "``GenericAlias`` 物件通常是透過\\ :ref:`下標 (subscripting) ` " "一個類別來建立的。它們最常與\\ :ref:`容器類別 ` 一起使用,像" -"是 :class:`list` 或 :class:`dict`。例如 ``list[int]`` 是一個``GenericAlias`` " -"物件,它是透過使用引數 :class:`int` 來下標 ``list`` 類別而建立的。" -"``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使用。" +"是 :class:`list` 或 :class:`dict`。例如 ``list[int]`` 是一個 " +"``GenericAlias`` 物件,它是透過使用引數 :class:`int` 來下標 ``list`` 類別而建" +"立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" +"用。" #: ../../library/stdtypes.rst:4928 msgid "" diff --git a/library/sunau.po b/library/sunau.po new file mode 100644 index 0000000000..b980962514 --- /dev/null +++ b/library/sunau.po @@ -0,0 +1,40 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/sunau.rst:2 +msgid ":mod:`!sunau` --- Read and write Sun AU files" +msgstr ":mod:`!sunau` --- 讀寫 Sun AU 檔案" + +#: ../../library/sunau.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/sunau.rst:14 +msgid "" +"The last version of Python that provided the :mod:`!sunau` module was " +"`Python 3.12 `_." +msgstr "" +"最後提供 :mod:`!sunau` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/sys.po b/library/sys.po index 096b946f75..0cafa0cde7 100644 --- a/library/sys.po +++ b/library/sys.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-11-13 00:13+0000\n" "PO-Revision-Date: 2023-04-26 02:54+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -44,10 +44,10 @@ msgstr "" #: ../../library/sys.rst:25 ../../library/sys.rst:299 ../../library/sys.rst:369 #: ../../library/sys.rst:760 ../../library/sys.rst:778 -#: ../../library/sys.rst:991 ../../library/sys.rst:1490 -#: ../../library/sys.rst:1731 ../../library/sys.rst:1746 -#: ../../library/sys.rst:1754 ../../library/sys.rst:1770 -#: ../../library/sys.rst:2014 +#: ../../library/sys.rst:1020 ../../library/sys.rst:1519 +#: ../../library/sys.rst:1760 ../../library/sys.rst:1775 +#: ../../library/sys.rst:1783 ../../library/sys.rst:1799 +#: ../../library/sys.rst:2043 msgid "Availability" msgstr "" @@ -1177,15 +1177,48 @@ msgstr "" "引發一個附帶引數 ``depth`` 的\\ :ref:`稽核事件 ` ``sys." "_getframemodulename``。" +#: ../../library/sys.rst:925 +msgid "" +"This function only exists if CPython was built using the specialized " +"configure option :option:`--with-trace-refs`. It is intended only for " +"debugging garbage-collection issues." +msgstr "" + #: ../../library/sys.rst:929 +msgid "" +"Return a list of up to *limit* dynamically allocated Python objects. If " +"*type* is given, only objects of that exact type (not subtypes) are included." +msgstr "" + +#: ../../library/sys.rst:933 +msgid "" +"Objects from the list are not safe to use. Specifically, the result will " +"include objects from all interpreters that share their object allocator " +"state (that is, ones created with :c:member:`PyInterpreterConfig." +"use_main_obmalloc` set to 1 or using :c:func:`Py_NewInterpreter`, and the :" +"ref:`main interpreter `). Mixing objects from " +"different interpreters may lead to crashes or other unexpected behavior." +msgstr "" + +#: ../../library/sys.rst:944 +msgid "" +"This function should be used for specialized purposes only. It is not " +"guaranteed to exist in all implementations of Python." +msgstr "" + +#: ../../library/sys.rst:949 +msgid "The result may include objects from other interpreters." +msgstr "" + +#: ../../library/sys.rst:958 msgid "Get the profiler function as set by :func:`setprofile`." msgstr "" -#: ../../library/sys.rst:938 +#: ../../library/sys.rst:967 msgid "Get the trace function as set by :func:`settrace`." msgstr "" -#: ../../library/sys.rst:942 +#: ../../library/sys.rst:971 msgid "" "The :func:`gettrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -1193,7 +1226,7 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:950 +#: ../../library/sys.rst:979 msgid "" "Return a named tuple describing the Windows version currently running. The " "named elements are *major*, *minor*, *build*, *platform*, *service_pack*, " @@ -1205,54 +1238,54 @@ msgid "" "first 5 elements are retrievable by indexing." msgstr "" -#: ../../library/sys.rst:961 +#: ../../library/sys.rst:990 msgid "*platform* will be ``2`` (VER_PLATFORM_WIN32_NT)." msgstr "" -#: ../../library/sys.rst:963 +#: ../../library/sys.rst:992 msgid "*product_type* may be one of the following values:" msgstr "" -#: ../../library/sys.rst:966 +#: ../../library/sys.rst:995 msgid "Constant" msgstr "" -#: ../../library/sys.rst:966 +#: ../../library/sys.rst:995 msgid "Meaning" msgstr "含義" -#: ../../library/sys.rst:968 +#: ../../library/sys.rst:997 msgid "``1`` (VER_NT_WORKSTATION)" msgstr "``1`` (VER_NT_WORKSTATION)" -#: ../../library/sys.rst:968 +#: ../../library/sys.rst:997 msgid "The system is a workstation." msgstr "" -#: ../../library/sys.rst:970 +#: ../../library/sys.rst:999 msgid "``2`` (VER_NT_DOMAIN_CONTROLLER)" msgstr "``2`` (VER_NT_DOMAIN_CONTROLLER)" -#: ../../library/sys.rst:970 +#: ../../library/sys.rst:999 msgid "The system is a domain controller." msgstr "" -#: ../../library/sys.rst:973 +#: ../../library/sys.rst:1002 msgid "``3`` (VER_NT_SERVER)" msgstr "``3`` (VER_NT_SERVER)" -#: ../../library/sys.rst:973 +#: ../../library/sys.rst:1002 msgid "The system is a server, but not a domain controller." msgstr "" -#: ../../library/sys.rst:977 +#: ../../library/sys.rst:1006 msgid "" "This function wraps the Win32 :c:func:`!GetVersionEx` function; see the " "Microsoft documentation on :c:func:`!OSVERSIONINFOEX` for more information " "about these fields." msgstr "" -#: ../../library/sys.rst:981 +#: ../../library/sys.rst:1010 msgid "" "*platform_version* returns the major version, minor version and build number " "of the current operating system, rather than the version that is being " @@ -1260,24 +1293,24 @@ msgid "" "feature detection." msgstr "" -#: ../../library/sys.rst:987 +#: ../../library/sys.rst:1016 msgid "" "*platform_version* derives the version from kernel32.dll which can be of a " "different version than the OS version. Please use :mod:`platform` module for " "achieving accurate OS version." msgstr "" -#: ../../library/sys.rst:993 +#: ../../library/sys.rst:1022 msgid "" "Changed to a named tuple and added *service_pack_minor*, " "*service_pack_major*, *suite_mask*, and *product_type*." msgstr "" -#: ../../library/sys.rst:997 +#: ../../library/sys.rst:1026 msgid "Added *platform_version*" msgstr "新增 *platform_version*" -#: ../../library/sys.rst:1003 +#: ../../library/sys.rst:1032 msgid "" "Returns an *asyncgen_hooks* object, which is similar to a :class:" "`~collections.namedtuple` of the form ``(firstiter, finalizer)``, where " @@ -1287,71 +1320,71 @@ msgid "" "loop." msgstr "" -#: ../../library/sys.rst:1010 +#: ../../library/sys.rst:1039 msgid "See :pep:`525` for more details." msgstr "更多細節請見 :pep:`525`。" -#: ../../library/sys.rst:1014 ../../library/sys.rst:1702 +#: ../../library/sys.rst:1043 ../../library/sys.rst:1731 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.)" msgstr "" -#: ../../library/sys.rst:1020 +#: ../../library/sys.rst:1049 msgid "" "Get the current coroutine origin tracking depth, as set by :func:" "`set_coroutine_origin_tracking_depth`." msgstr "" -#: ../../library/sys.rst:1026 ../../library/sys.rst:1723 +#: ../../library/sys.rst:1055 ../../library/sys.rst:1752 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.) Use it only for debugging purposes." msgstr "" -#: ../../library/sys.rst:1032 +#: ../../library/sys.rst:1061 msgid "" "A :term:`named tuple` giving parameters of the numeric hash implementation. " "For more details about hashing of numeric types, see :ref:`numeric-hash`." msgstr "" -#: ../../library/sys.rst:1038 +#: ../../library/sys.rst:1067 msgid "The width in bits used for hash values" msgstr "" -#: ../../library/sys.rst:1042 +#: ../../library/sys.rst:1071 msgid "The prime modulus P used for numeric hash scheme" msgstr "" -#: ../../library/sys.rst:1046 +#: ../../library/sys.rst:1075 msgid "The hash value returned for a positive infinity" msgstr "" -#: ../../library/sys.rst:1050 +#: ../../library/sys.rst:1079 msgid "(This attribute is no longer used)" msgstr "" -#: ../../library/sys.rst:1054 +#: ../../library/sys.rst:1083 msgid "The multiplier used for the imaginary part of a complex number" msgstr "" -#: ../../library/sys.rst:1058 +#: ../../library/sys.rst:1087 msgid "The name of the algorithm for hashing of str, bytes, and memoryview" msgstr "" -#: ../../library/sys.rst:1062 +#: ../../library/sys.rst:1091 msgid "The internal output size of the hash algorithm" msgstr "" -#: ../../library/sys.rst:1066 +#: ../../library/sys.rst:1095 msgid "The size of the seed key of the hash algorithm" msgstr "" -#: ../../library/sys.rst:1070 +#: ../../library/sys.rst:1099 msgid "Added *algorithm*, *hash_bits* and *seed_bits*" msgstr "新增 *algorithm*、*hash_bits* 與 *seed_bits*" -#: ../../library/sys.rst:1076 +#: ../../library/sys.rst:1105 msgid "" "The version number encoded as a single integer. This is guaranteed to " "increase with each version, including proper support for non-production " @@ -1359,7 +1392,7 @@ msgid "" "version 1.5.2, use::" msgstr "" -#: ../../library/sys.rst:1080 +#: ../../library/sys.rst:1109 msgid "" "if sys.hexversion >= 0x010502F0:\n" " # use some advanced feature\n" @@ -1369,7 +1402,7 @@ msgid "" " ..." msgstr "" -#: ../../library/sys.rst:1087 +#: ../../library/sys.rst:1116 msgid "" "This is called ``hexversion`` since it only really looks meaningful when " "viewed as the result of passing it to the built-in :func:`hex` function. " @@ -1377,25 +1410,25 @@ msgid "" "human-friendly encoding of the same information." msgstr "" -#: ../../library/sys.rst:1092 +#: ../../library/sys.rst:1121 msgid "More details of ``hexversion`` can be found at :ref:`apiabiversion`." msgstr "" -#: ../../library/sys.rst:1097 +#: ../../library/sys.rst:1126 msgid "" "An object containing information about the implementation of the currently " "running Python interpreter. The following attributes are required to exist " "in all Python implementations." msgstr "" -#: ../../library/sys.rst:1101 +#: ../../library/sys.rst:1130 msgid "" "*name* is the implementation's identifier, e.g. ``'cpython'``. The actual " "string is defined by the Python implementation, but it is guaranteed to be " "lower case." msgstr "" -#: ../../library/sys.rst:1105 +#: ../../library/sys.rst:1134 msgid "" "*version* is a named tuple, in the same format as :data:`sys.version_info`. " "It represents the version of the Python *implementation*. This has a " @@ -1407,13 +1440,13 @@ msgid "" "the same value, since it is the reference implementation." msgstr "" -#: ../../library/sys.rst:1115 +#: ../../library/sys.rst:1144 msgid "" "*hexversion* is the implementation version in hexadecimal format, like :data:" "`sys.hexversion`." msgstr "" -#: ../../library/sys.rst:1118 +#: ../../library/sys.rst:1147 msgid "" "*cache_tag* is the tag used by the import machinery in the filenames of " "cached modules. By convention, it would be a composite of the " @@ -1422,7 +1455,7 @@ msgid "" "set to ``None``, it indicates that module caching should be disabled." msgstr "" -#: ../../library/sys.rst:1125 +#: ../../library/sys.rst:1154 msgid "" ":data:`sys.implementation` may contain additional attributes specific to the " "Python implementation. These non-standard attributes must start with an " @@ -1432,41 +1465,41 @@ msgid "" "versions, however.) See :pep:`421` for more information." msgstr "" -#: ../../library/sys.rst:1136 +#: ../../library/sys.rst:1165 msgid "" "The addition of new required attributes must go through the normal PEP " "process. See :pep:`421` for more information." msgstr "" -#: ../../library/sys.rst:1141 +#: ../../library/sys.rst:1170 msgid "" "A :term:`named tuple` that holds information about Python's internal " "representation of integers. The attributes are read only." msgstr "" -#: ../../library/sys.rst:1146 +#: ../../library/sys.rst:1175 msgid "" "The number of bits held in each digit. Python integers are stored internally " "in base ``2**int_info.bits_per_digit``." msgstr "" -#: ../../library/sys.rst:1151 +#: ../../library/sys.rst:1180 msgid "The size in bytes of the C type used to represent a digit." msgstr "" -#: ../../library/sys.rst:1155 +#: ../../library/sys.rst:1184 msgid "" "The default value for :func:`sys.get_int_max_str_digits` when it is not " "otherwise explicitly configured." msgstr "" -#: ../../library/sys.rst:1160 +#: ../../library/sys.rst:1189 msgid "" "The minimum non-zero value for :func:`sys.set_int_max_str_digits`, :envvar:" "`PYTHONINTMAXSTRDIGITS`, or :option:`-X int_max_str_digits <-X>`." msgstr "" -#: ../../library/sys.rst:1167 +#: ../../library/sys.rst:1196 msgid "" "Added :attr:`~int_info.default_max_str_digits` and :attr:`~int_info." "str_digits_check_threshold`." @@ -1474,7 +1507,7 @@ msgstr "" "新增 :attr:`~int_info.default_max_str_digits` 和 :attr:`~int_info." "str_digits_check_threshold`。" -#: ../../library/sys.rst:1173 +#: ../../library/sys.rst:1202 msgid "" "When this attribute exists, its value is automatically called (with no " "arguments) when the interpreter is launched in :ref:`interactive mode `." msgstr "" -#: ../../library/sys.rst:1179 ../../library/sys.rst:1181 +#: ../../library/sys.rst:1208 ../../library/sys.rst:1210 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_interactivehook`` " "with the hook object as the argument when the hook is called on startup." msgstr "" -#: ../../library/sys.rst:1190 +#: ../../library/sys.rst:1219 msgid "" "Enter *string* in the table of \"interned\" strings and return the interned " "string -- which is *string* itself or a copy. Interning strings is useful to " @@ -1501,29 +1534,29 @@ msgid "" "attributes have interned keys." msgstr "" -#: ../../library/sys.rst:1198 +#: ../../library/sys.rst:1227 msgid "" "Interned strings are not :term:`immortal`; you must keep a reference to the " "return value of :func:`intern` around to benefit from it." msgstr "" -#: ../../library/sys.rst:1204 +#: ../../library/sys.rst:1233 msgid "" "Return :const:`True` if the :term:`GIL` is enabled and :const:`False` if it " "is disabled." msgstr "" -#: ../../library/sys.rst:1212 +#: ../../library/sys.rst:1241 msgid "" "Return :const:`True` if the main Python interpreter is :term:`shutting down " "`. Return :const:`False` otherwise." msgstr "" -#: ../../library/sys.rst:1215 +#: ../../library/sys.rst:1244 msgid "See also the :exc:`PythonFinalizationError` exception." msgstr "" -#: ../../library/sys.rst:1221 +#: ../../library/sys.rst:1250 msgid "" "This variable is not always defined; it is set to the exception instance " "when an exception is not handled and the interpreter prints an error message " @@ -1534,44 +1567,44 @@ msgid "" "more information.)" msgstr "" -#: ../../library/sys.rst:1233 +#: ../../library/sys.rst:1262 msgid "" "Return :const:`True` if the given string is \"interned\", :const:`False` " "otherwise." msgstr "" -#: ../../library/sys.rst:1240 +#: ../../library/sys.rst:1269 msgid "It is not guaranteed to exist in all implementations of Python." msgstr "" -#: ../../library/sys.rst:1247 +#: ../../library/sys.rst:1276 msgid "" "These three variables are deprecated; use :data:`sys.last_exc` instead. They " "hold the legacy representation of ``sys.last_exc``, as returned from :func:" "`exc_info` above." msgstr "" -#: ../../library/sys.rst:1253 +#: ../../library/sys.rst:1282 msgid "" "An integer giving the maximum value a variable of type :c:type:`Py_ssize_t` " "can take. It's usually ``2**31 - 1`` on a 32-bit platform and ``2**63 - 1`` " "on a 64-bit platform." msgstr "" -#: ../../library/sys.rst:1260 +#: ../../library/sys.rst:1289 msgid "" "An integer giving the value of the largest Unicode code point, i.e. " "``1114111`` (``0x10FFFF`` in hexadecimal)." msgstr "" -#: ../../library/sys.rst:1263 +#: ../../library/sys.rst:1292 msgid "" "Before :pep:`393`, ``sys.maxunicode`` used to be either ``0xFFFF`` or " "``0x10FFFF``, depending on the configuration option that specified whether " "Unicode characters were stored as UCS-2 or UCS-4." msgstr "" -#: ../../library/sys.rst:1271 +#: ../../library/sys.rst:1300 msgid "" "A list of :term:`meta path finder` objects that have their :meth:`~importlib." "abc.MetaPathFinder.find_spec` methods called to see if one of the objects " @@ -1584,40 +1617,40 @@ msgid "" "``None`` if the module cannot be found." msgstr "" -#: ../../library/sys.rst:1284 +#: ../../library/sys.rst:1313 msgid ":class:`importlib.abc.MetaPathFinder`" msgstr ":class:`importlib.abc.MetaPathFinder`" -#: ../../library/sys.rst:1285 +#: ../../library/sys.rst:1314 msgid "" "The abstract base class defining the interface of finder objects on :data:" "`meta_path`." msgstr "" -#: ../../library/sys.rst:1287 +#: ../../library/sys.rst:1316 msgid ":class:`importlib.machinery.ModuleSpec`" msgstr ":class:`importlib.machinery.ModuleSpec`" -#: ../../library/sys.rst:1288 +#: ../../library/sys.rst:1317 msgid "" "The concrete class which :meth:`~importlib.abc.MetaPathFinder.find_spec` " "should return instances of." msgstr "" -#: ../../library/sys.rst:1294 +#: ../../library/sys.rst:1323 msgid "" ":term:`Module specs ` were introduced in Python 3.4, by :pep:" "`451`." msgstr "" -#: ../../library/sys.rst:1299 +#: ../../library/sys.rst:1328 msgid "" "Removed the fallback that looked for a :meth:`!find_module` method if a :" "data:`meta_path` entry didn't have a :meth:`~importlib.abc.MetaPathFinder." "find_spec` method." msgstr "" -#: ../../library/sys.rst:1305 +#: ../../library/sys.rst:1334 msgid "" "This is a dictionary that maps module names to modules which have already " "been loaded. This can be manipulated to force reloading of modules and " @@ -1629,13 +1662,13 @@ msgid "" "other threads." msgstr "" -#: ../../library/sys.rst:1317 +#: ../../library/sys.rst:1346 msgid "" "The list of the original command line arguments passed to the Python " "executable." msgstr "" -#: ../../library/sys.rst:1320 +#: ../../library/sys.rst:1349 msgid "" "The elements of :data:`sys.orig_argv` are the arguments to the Python " "interpreter, while the elements of :data:`sys.argv` are the arguments to the " @@ -1643,68 +1676,68 @@ msgid "" "in :data:`sys.orig_argv` and missing from :data:`sys.argv`." msgstr "" -#: ../../library/sys.rst:1332 +#: ../../library/sys.rst:1361 msgid "" "A list of strings that specifies the search path for modules. Initialized " "from the environment variable :envvar:`PYTHONPATH`, plus an installation-" "dependent default." msgstr "" -#: ../../library/sys.rst:1336 +#: ../../library/sys.rst:1365 msgid "" "By default, as initialized upon program startup, a potentially unsafe path " "is prepended to :data:`sys.path` (*before* the entries inserted as a result " "of :envvar:`PYTHONPATH`):" msgstr "" -#: ../../library/sys.rst:1340 +#: ../../library/sys.rst:1369 msgid "" "``python -m module`` command line: prepend the current working directory." msgstr "" -#: ../../library/sys.rst:1342 +#: ../../library/sys.rst:1371 msgid "" "``python script.py`` command line: prepend the script's directory. If it's a " "symbolic link, resolve symbolic links." msgstr "" -#: ../../library/sys.rst:1344 +#: ../../library/sys.rst:1373 msgid "" "``python -c code`` and ``python`` (REPL) command lines: prepend an empty " "string, which means the current working directory." msgstr "" -#: ../../library/sys.rst:1347 +#: ../../library/sys.rst:1376 msgid "" "To not prepend this potentially unsafe path, use the :option:`-P` command " "line option or the :envvar:`PYTHONSAFEPATH` environment variable." msgstr "" -#: ../../library/sys.rst:1350 +#: ../../library/sys.rst:1379 msgid "" "A program is free to modify this list for its own purposes. Only strings " "should be added to :data:`sys.path`; all other data types are ignored during " "import." msgstr "" -#: ../../library/sys.rst:1356 +#: ../../library/sys.rst:1385 msgid "" "Module :mod:`site` This describes how to use .pth files to extend :data:`sys." "path`." msgstr "" -#: ../../library/sys.rst:1361 +#: ../../library/sys.rst:1390 msgid "" "A list of callables that take a path argument to try to create a :term:" "`finder` for the path. If a finder can be created, it is to be returned by " "the callable, else raise :exc:`ImportError`." msgstr "" -#: ../../library/sys.rst:1365 ../../library/sys.rst:1376 +#: ../../library/sys.rst:1394 ../../library/sys.rst:1405 msgid "Originally specified in :pep:`302`." msgstr "" -#: ../../library/sys.rst:1370 +#: ../../library/sys.rst:1399 msgid "" "A dictionary acting as a cache for :term:`finder` objects. The keys are " "paths that have been passed to :data:`sys.path_hooks` and the values are the " @@ -1712,91 +1745,91 @@ msgid "" "is found on :data:`sys.path_hooks` then ``None`` is stored." msgstr "" -#: ../../library/sys.rst:1381 +#: ../../library/sys.rst:1410 msgid "A string containing a platform identifier. Known values are:" msgstr "" -#: ../../library/sys.rst:1384 +#: ../../library/sys.rst:1413 msgid "System" msgstr "" -#: ../../library/sys.rst:1384 +#: ../../library/sys.rst:1413 msgid "``platform`` value" msgstr "" -#: ../../library/sys.rst:1386 +#: ../../library/sys.rst:1415 msgid "AIX" msgstr "AIX" -#: ../../library/sys.rst:1386 +#: ../../library/sys.rst:1415 msgid "``'aix'``" msgstr "``'aix'``" -#: ../../library/sys.rst:1387 +#: ../../library/sys.rst:1416 msgid "Android" msgstr "Android" -#: ../../library/sys.rst:1387 +#: ../../library/sys.rst:1416 msgid "``'android'``" msgstr "``'android'``" -#: ../../library/sys.rst:1388 +#: ../../library/sys.rst:1417 msgid "Emscripten" msgstr "Emscripten" -#: ../../library/sys.rst:1388 +#: ../../library/sys.rst:1417 msgid "``'emscripten'``" msgstr "``'emscripten'``" -#: ../../library/sys.rst:1389 +#: ../../library/sys.rst:1418 msgid "iOS" msgstr "iOS" -#: ../../library/sys.rst:1389 +#: ../../library/sys.rst:1418 msgid "``'ios'``" msgstr "``'ios'``" -#: ../../library/sys.rst:1390 +#: ../../library/sys.rst:1419 msgid "Linux" msgstr "Linux" -#: ../../library/sys.rst:1390 +#: ../../library/sys.rst:1419 msgid "``'linux'``" msgstr "``'linux'``" -#: ../../library/sys.rst:1391 +#: ../../library/sys.rst:1420 msgid "macOS" msgstr "macOS" -#: ../../library/sys.rst:1391 +#: ../../library/sys.rst:1420 msgid "``'darwin'``" msgstr "``'darwin'``" -#: ../../library/sys.rst:1392 +#: ../../library/sys.rst:1421 msgid "Windows" msgstr "Windows" -#: ../../library/sys.rst:1392 +#: ../../library/sys.rst:1421 msgid "``'win32'``" msgstr "``'win32'``" -#: ../../library/sys.rst:1393 +#: ../../library/sys.rst:1422 msgid "Windows/Cygwin" msgstr "Windows/Cygwin" -#: ../../library/sys.rst:1393 +#: ../../library/sys.rst:1422 msgid "``'cygwin'``" msgstr "``'cygwin'``" -#: ../../library/sys.rst:1394 +#: ../../library/sys.rst:1423 msgid "WASI" msgstr "WASI" -#: ../../library/sys.rst:1394 +#: ../../library/sys.rst:1423 msgid "``'wasi'``" msgstr "``'wasi'``" -#: ../../library/sys.rst:1397 +#: ../../library/sys.rst:1426 msgid "" "On Unix systems not listed in the table, the value is the lowercased OS name " "as returned by ``uname -s``, with the first part of the version as returned " @@ -1805,81 +1838,81 @@ msgid "" "version, it is therefore recommended to use the following idiom::" msgstr "" -#: ../../library/sys.rst:1403 +#: ../../library/sys.rst:1432 msgid "" "if sys.platform.startswith('freebsd'):\n" " # FreeBSD-specific code here..." msgstr "" -#: ../../library/sys.rst:1406 +#: ../../library/sys.rst:1435 msgid "" "On Linux, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``." msgstr "" -#: ../../library/sys.rst:1410 +#: ../../library/sys.rst:1439 msgid "" "On AIX, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``." msgstr "" -#: ../../library/sys.rst:1414 +#: ../../library/sys.rst:1443 msgid "" "On Android, :data:`sys.platform` now returns ``'android'`` rather than " "``'linux'``." msgstr "" -#: ../../library/sys.rst:1420 +#: ../../library/sys.rst:1449 msgid "" ":data:`os.name` has a coarser granularity. :func:`os.uname` gives system-" "dependent version information." msgstr "" -#: ../../library/sys.rst:1423 +#: ../../library/sys.rst:1452 msgid "" "The :mod:`platform` module provides detailed checks for the system's " "identity." msgstr "" -#: ../../library/sys.rst:1429 +#: ../../library/sys.rst:1458 msgid "" "Name of the platform-specific library directory. It is used to build the " "path of standard library and the paths of installed extension modules." msgstr "" -#: ../../library/sys.rst:1432 +#: ../../library/sys.rst:1461 msgid "" "It is equal to ``\"lib\"`` on most platforms. On Fedora and SuSE, it is " "equal to ``\"lib64\"`` on 64-bit platforms which gives the following ``sys." "path`` paths (where ``X.Y`` is the Python ``major.minor`` version):" msgstr "" -#: ../../library/sys.rst:1436 +#: ../../library/sys.rst:1465 msgid "" "``/usr/lib64/pythonX.Y/``: Standard library (like ``os.py`` of the :mod:`os` " "module)" msgstr "" -#: ../../library/sys.rst:1438 +#: ../../library/sys.rst:1467 msgid "" "``/usr/lib64/pythonX.Y/lib-dynload/``: C extension modules of the standard " "library (like the :mod:`errno` module, the exact filename is platform " "specific)" msgstr "" -#: ../../library/sys.rst:1441 +#: ../../library/sys.rst:1470 msgid "" "``/usr/lib/pythonX.Y/site-packages/`` (always use ``lib``, not :data:`sys." "platlibdir`): Third-party modules" msgstr "" -#: ../../library/sys.rst:1443 +#: ../../library/sys.rst:1472 msgid "" "``/usr/lib64/pythonX.Y/site-packages/``: C extension modules of third-party " "packages" msgstr "" -#: ../../library/sys.rst:1451 +#: ../../library/sys.rst:1480 msgid "" "A string giving the site-specific directory prefix where the platform " "independent Python files are installed; on Unix, the default is :file:`/usr/" @@ -1888,14 +1921,14 @@ msgid "" "derived paths." msgstr "" -#: ../../library/sys.rst:1457 +#: ../../library/sys.rst:1486 msgid "" "If a :ref:`virtual environment ` is in effect, this value will be " "changed in ``site.py`` to point to the virtual environment. The value for " "the Python installation will still be available, via :data:`base_prefix`." msgstr "" -#: ../../library/sys.rst:1472 +#: ../../library/sys.rst:1501 msgid "" "Strings specifying the primary and secondary prompt of the interpreter. " "These are only defined if the interpreter is in interactive mode. Their " @@ -1905,7 +1938,7 @@ msgid "" "used to implement a dynamic prompt." msgstr "" -#: ../../library/sys.rst:1482 +#: ../../library/sys.rst:1511 msgid "" "Set the flags used by the interpreter for :c:func:`dlopen` calls, such as " "when the interpreter loads extension modules. Among other things, this will " @@ -1916,14 +1949,14 @@ msgid "" "g. :const:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:1494 +#: ../../library/sys.rst:1523 msgid "" "Set the :ref:`integer string conversion length limitation " "` used by this interpreter. See also :func:" "`get_int_max_str_digits`." msgstr "" -#: ../../library/sys.rst:1506 +#: ../../library/sys.rst:1535 msgid "" "Set the system's profile function, which allows you to implement a Python " "source code profiler in Python. See chapter :ref:`profile` for more " @@ -1938,14 +1971,14 @@ msgid "" "in the profile function will cause itself unset." msgstr "" -#: ../../library/sys.rst:1518 +#: ../../library/sys.rst:1547 msgid "" "The same tracing mechanism is used for :func:`!setprofile` as :func:" "`settrace`. To trace calls with :func:`!setprofile` inside a tracing " "function (e.g. in a debugger breakpoint), see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1522 +#: ../../library/sys.rst:1551 msgid "" "Profile functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -1953,71 +1986,71 @@ msgid "" "depends on the event type." msgstr "" -#: ../../library/sys.rst:1527 ../../library/sys.rst:1614 +#: ../../library/sys.rst:1556 ../../library/sys.rst:1643 msgid "The events have the following meaning:" msgstr "" -#: ../../library/sys.rst:1529 ../../library/sys.rst:1616 +#: ../../library/sys.rst:1558 ../../library/sys.rst:1645 msgid "``'call'``" msgstr "``'call'``" -#: ../../library/sys.rst:1530 +#: ../../library/sys.rst:1559 msgid "" "A function is called (or some other code block entered). The profile " "function is called; *arg* is ``None``." msgstr "" -#: ../../library/sys.rst:1533 ../../library/sys.rst:1631 +#: ../../library/sys.rst:1562 ../../library/sys.rst:1660 msgid "``'return'``" msgstr "``'return'``" -#: ../../library/sys.rst:1534 +#: ../../library/sys.rst:1563 msgid "" "A function (or other code block) is about to return. The profile function " "is called; *arg* is the value that will be returned, or ``None`` if the " "event is caused by an exception being raised." msgstr "" -#: ../../library/sys.rst:1538 +#: ../../library/sys.rst:1567 msgid "``'c_call'``" msgstr "``'c_call'``" -#: ../../library/sys.rst:1539 +#: ../../library/sys.rst:1568 msgid "" "A C function is about to be called. This may be an extension function or a " "built-in. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1542 +#: ../../library/sys.rst:1571 msgid "``'c_return'``" msgstr "``'c_return'``" -#: ../../library/sys.rst:1543 +#: ../../library/sys.rst:1572 msgid "A C function has returned. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1545 +#: ../../library/sys.rst:1574 msgid "``'c_exception'``" msgstr "``'c_exception'``" -#: ../../library/sys.rst:1546 +#: ../../library/sys.rst:1575 msgid "A C function has raised an exception. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1548 +#: ../../library/sys.rst:1577 msgid "" "Raises an :ref:`auditing event ` ``sys.setprofile`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.setprofile``。" -#: ../../library/sys.rst:1553 +#: ../../library/sys.rst:1582 msgid "" "Set the maximum depth of the Python interpreter stack to *limit*. This " "limit prevents infinite recursion from causing an overflow of the C stack " "and crashing Python." msgstr "" -#: ../../library/sys.rst:1557 +#: ../../library/sys.rst:1586 msgid "" "The highest possible limit is platform-dependent. A user may need to set " "the limit higher when they have a program that requires deep recursion and a " @@ -2025,19 +2058,19 @@ msgid "" "because a too-high limit can lead to a crash." msgstr "" -#: ../../library/sys.rst:1562 +#: ../../library/sys.rst:1591 msgid "" "If the new limit is too low at the current recursion depth, a :exc:" "`RecursionError` exception is raised." msgstr "" -#: ../../library/sys.rst:1565 +#: ../../library/sys.rst:1594 msgid "" "A :exc:`RecursionError` exception is now raised if the new limit is too low " "at the current recursion depth." msgstr "" -#: ../../library/sys.rst:1572 +#: ../../library/sys.rst:1601 msgid "" "Set the interpreter's thread switch interval (in seconds). This floating-" "point value determines the ideal duration of the \"timeslices\" allocated to " @@ -2048,7 +2081,7 @@ msgid "" "scheduler." msgstr "" -#: ../../library/sys.rst:1589 +#: ../../library/sys.rst:1618 msgid "" "Set the system's trace function, which allows you to implement a Python " "source code debugger in Python. The function is thread-specific; for a " @@ -2057,7 +2090,7 @@ msgid "" "`threading.settrace`." msgstr "" -#: ../../library/sys.rst:1594 +#: ../../library/sys.rst:1623 msgid "" "Trace functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -2065,7 +2098,7 @@ msgid "" "the event type." msgstr "" -#: ../../library/sys.rst:1599 +#: ../../library/sys.rst:1628 msgid "" "The trace function is invoked (with *event* set to ``'call'``) whenever a " "new local scope is entered; it should return a reference to a local trace " @@ -2073,36 +2106,36 @@ msgid "" "traced." msgstr "" -#: ../../library/sys.rst:1604 +#: ../../library/sys.rst:1633 msgid "" "The local trace function should return a reference to itself, or to another " "function which would then be used as the local trace function for the scope." msgstr "" -#: ../../library/sys.rst:1607 +#: ../../library/sys.rst:1636 msgid "" "If there is any error occurred in the trace function, it will be unset, just " "like ``settrace(None)`` is called." msgstr "" -#: ../../library/sys.rst:1611 +#: ../../library/sys.rst:1640 msgid "" "Tracing is disabled while calling the trace function (e.g. a function set " "by :func:`!settrace`). For recursive tracing see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1617 +#: ../../library/sys.rst:1646 msgid "" "A function is called (or some other code block entered). The global trace " "function is called; *arg* is ``None``; the return value specifies the local " "trace function." msgstr "" -#: ../../library/sys.rst:1621 +#: ../../library/sys.rst:1650 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/sys.rst:1622 +#: ../../library/sys.rst:1651 msgid "" "The interpreter is about to execute a new line of code or re-execute the " "condition of a loop. The local trace function is called; *arg* is ``None``; " @@ -2112,7 +2145,7 @@ msgid "" "to :const:`False` on that :ref:`frame `." msgstr "" -#: ../../library/sys.rst:1632 +#: ../../library/sys.rst:1661 msgid "" "A function (or other code block) is about to return. The local trace " "function is called; *arg* is the value that will be returned, or ``None`` if " @@ -2120,22 +2153,22 @@ msgid "" "return value is ignored." msgstr "" -#: ../../library/sys.rst:1637 +#: ../../library/sys.rst:1666 msgid "``'exception'``" msgstr "``'exception'``" -#: ../../library/sys.rst:1638 +#: ../../library/sys.rst:1667 msgid "" "An exception has occurred. The local trace function is called; *arg* is a " "tuple ``(exception, value, traceback)``; the return value specifies the new " "local trace function." msgstr "" -#: ../../library/sys.rst:1642 +#: ../../library/sys.rst:1671 msgid "``'opcode'``" msgstr "``'opcode'``" -#: ../../library/sys.rst:1643 +#: ../../library/sys.rst:1672 msgid "" "The interpreter is about to execute a new opcode (see :mod:`dis` for opcode " "details). The local trace function is called; *arg* is ``None``; the return " @@ -2145,13 +2178,13 @@ msgid "" "objects>`." msgstr "" -#: ../../library/sys.rst:1650 +#: ../../library/sys.rst:1679 msgid "" "Note that as an exception is propagated down the chain of callers, an " "``'exception'`` event is generated at each level." msgstr "" -#: ../../library/sys.rst:1653 +#: ../../library/sys.rst:1682 msgid "" "For more fine-grained usage, it's possible to set a trace function by " "assigning ``frame.f_trace = tracefunc`` explicitly, rather than relying on " @@ -2165,17 +2198,17 @@ msgid "" "on each frame)." msgstr "" -#: ../../library/sys.rst:1664 +#: ../../library/sys.rst:1693 msgid "For more information on code and frame objects, refer to :ref:`types`." msgstr "" -#: ../../library/sys.rst:1666 +#: ../../library/sys.rst:1695 msgid "" "Raises an :ref:`auditing event ` ``sys.settrace`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.settrace``。" -#: ../../library/sys.rst:1670 +#: ../../library/sys.rst:1699 msgid "" "The :func:`settrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -2183,13 +2216,13 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:1677 +#: ../../library/sys.rst:1706 msgid "" "``'opcode'`` event type added; :attr:`~frame.f_trace_lines` and :attr:" "`~frame.f_trace_opcodes` attributes added to frames" msgstr "" -#: ../../library/sys.rst:1682 +#: ../../library/sys.rst:1711 msgid "" "Accepts two optional keyword arguments which are callables that accept an :" "term:`asynchronous generator iterator` as an argument. The *firstiter* " @@ -2198,7 +2231,7 @@ msgid "" "about to be garbage collected." msgstr "" -#: ../../library/sys.rst:1688 +#: ../../library/sys.rst:1717 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_firstiter`` with no arguments." @@ -2206,7 +2239,7 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." "set_asyncgen_hooks_firstiter``。" -#: ../../library/sys.rst:1690 +#: ../../library/sys.rst:1719 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_finalizer`` with no arguments." @@ -2214,20 +2247,20 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." "set_asyncgen_hooks_finalizer``。" -#: ../../library/sys.rst:1692 +#: ../../library/sys.rst:1721 msgid "" "Two auditing events are raised because the underlying API consists of two " "calls, each of which must raise its own event." msgstr "" -#: ../../library/sys.rst:1695 +#: ../../library/sys.rst:1724 msgid "" "See :pep:`525` for more details, and for a reference example of a " "*finalizer* method see the implementation of ``asyncio.Loop." "shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`" msgstr "" -#: ../../library/sys.rst:1707 +#: ../../library/sys.rst:1736 msgid "" "Allows enabling or disabling coroutine origin tracking. When enabled, the " "``cr_origin`` attribute on coroutine objects will contain a tuple of " @@ -2236,111 +2269,111 @@ msgid "" "disabled, ``cr_origin`` will be ``None``." msgstr "" -#: ../../library/sys.rst:1714 +#: ../../library/sys.rst:1743 msgid "" "To enable, pass a *depth* value greater than zero; this sets the number of " "frames whose information will be captured. To disable, pass set *depth* to " "zero." msgstr "" -#: ../../library/sys.rst:1718 +#: ../../library/sys.rst:1747 msgid "This setting is thread-specific." msgstr "" -#: ../../library/sys.rst:1728 +#: ../../library/sys.rst:1757 msgid "" "Activate the stack profiler trampoline *backend*. The only supported backend " "is ``\"perf\"``." msgstr "" -#: ../../library/sys.rst:1737 +#: ../../library/sys.rst:1766 msgid ":ref:`perf_profiling`" msgstr ":ref:`perf_profiling`" -#: ../../library/sys.rst:1738 +#: ../../library/sys.rst:1767 msgid "https://perf.wiki.kernel.org/" msgstr "https://perf.wiki.kernel.org/" -#: ../../library/sys.rst:1742 +#: ../../library/sys.rst:1771 msgid "Deactivate the current stack profiler trampoline backend." msgstr "" -#: ../../library/sys.rst:1744 +#: ../../library/sys.rst:1773 msgid "If no stack profiler is activated, this function has no effect." msgstr "" -#: ../../library/sys.rst:1752 +#: ../../library/sys.rst:1781 msgid "Return ``True`` if a stack profiler trampoline is active." msgstr "" -#: ../../library/sys.rst:1760 +#: ../../library/sys.rst:1789 msgid "" "Changes the :term:`filesystem encoding and error handler` to 'mbcs' and " "'replace' respectively, for consistency with versions of Python prior to 3.6." msgstr "" -#: ../../library/sys.rst:1764 +#: ../../library/sys.rst:1793 msgid "" "This is equivalent to defining the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable before launching Python." msgstr "" -#: ../../library/sys.rst:1767 +#: ../../library/sys.rst:1796 msgid "" "See also :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors`." msgstr "" -#: ../../library/sys.rst:1773 +#: ../../library/sys.rst:1802 msgid "" "Changing the filesystem encoding after Python startup is risky because the " "old fsencoding or paths encoded by the old fsencoding may be cached " "somewhere. Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." msgstr "" -#: ../../library/sys.rst:1777 +#: ../../library/sys.rst:1806 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`。" -#: ../../library/sys.rst:1780 +#: ../../library/sys.rst:1809 msgid "Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." msgstr "" -#: ../../library/sys.rst:1787 +#: ../../library/sys.rst:1816 msgid "" ":term:`File objects ` used by the interpreter for standard " "input, output and errors:" msgstr "" -#: ../../library/sys.rst:1790 +#: ../../library/sys.rst:1819 msgid "" "``stdin`` is used for all interactive input (including calls to :func:" "`input`);" msgstr "" -#: ../../library/sys.rst:1792 +#: ../../library/sys.rst:1821 msgid "" "``stdout`` is used for the output of :func:`print` and :term:`expression` " "statements and for the prompts of :func:`input`;" msgstr "" -#: ../../library/sys.rst:1794 +#: ../../library/sys.rst:1823 msgid "The interpreter's own prompts and its error messages go to ``stderr``." msgstr "" -#: ../../library/sys.rst:1796 +#: ../../library/sys.rst:1825 msgid "" "These streams are regular :term:`text files ` like those returned " "by the :func:`open` function. Their parameters are chosen as follows:" msgstr "" -#: ../../library/sys.rst:1800 +#: ../../library/sys.rst:1829 msgid "" "The encoding and error handling are is initialized from :c:member:`PyConfig." "stdio_encoding` and :c:member:`PyConfig.stdio_errors`." msgstr "" -#: ../../library/sys.rst:1803 +#: ../../library/sys.rst:1832 msgid "" "On Windows, UTF-8 is used for the console device. Non-character devices " "such as disk files and pipes use the system locale encoding (i.e. the ANSI " @@ -2351,14 +2384,14 @@ msgid "" "initially attached to a console." msgstr "" -#: ../../library/sys.rst:1812 +#: ../../library/sys.rst:1841 msgid "" "The special behaviour of the console can be overridden by setting the " "environment variable PYTHONLEGACYWINDOWSSTDIO before starting Python. In " "that case, the console codepages are used as for any other character device." msgstr "" -#: ../../library/sys.rst:1817 +#: ../../library/sys.rst:1846 msgid "" "Under all platforms, you can override the character encoding by setting the :" "envvar:`PYTHONIOENCODING` environment variable before starting Python or by " @@ -2367,7 +2400,7 @@ msgid "" "only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set." msgstr "" -#: ../../library/sys.rst:1824 +#: ../../library/sys.rst:1853 msgid "" "When interactive, the ``stdout`` stream is line-buffered. Otherwise, it is " "block-buffered like regular text files. The ``stderr`` stream is line-" @@ -2376,19 +2409,19 @@ msgid "" "`PYTHONUNBUFFERED` environment variable." msgstr "" -#: ../../library/sys.rst:1830 +#: ../../library/sys.rst:1859 msgid "" "Non-interactive ``stderr`` is now line-buffered instead of fully buffered." msgstr "" -#: ../../library/sys.rst:1836 +#: ../../library/sys.rst:1865 msgid "" "To write or read binary data from/to the standard streams, use the " "underlying binary :data:`~io.TextIOBase.buffer` object. For example, to " "write bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``." msgstr "" -#: ../../library/sys.rst:1840 +#: ../../library/sys.rst:1869 msgid "" "However, if you are writing a library (and do not control in which context " "its code will be executed), be aware that the standard streams may be " @@ -2396,7 +2429,7 @@ msgid "" "support the :attr:`!buffer` attribute." msgstr "" -#: ../../library/sys.rst:1850 +#: ../../library/sys.rst:1879 msgid "" "These objects contain the original values of ``stdin``, ``stderr`` and " "``stdout`` at the start of the program. They are used during finalization, " @@ -2404,7 +2437,7 @@ msgid "" "``sys.std*`` object has been redirected." msgstr "" -#: ../../library/sys.rst:1855 +#: ../../library/sys.rst:1884 msgid "" "It can also be used to restore the actual files to known working file " "objects in case they have been overwritten with a broken object. However, " @@ -2412,7 +2445,7 @@ msgid "" "before replacing it, and restore the saved object." msgstr "" -#: ../../library/sys.rst:1861 +#: ../../library/sys.rst:1890 msgid "" "Under some conditions ``stdin``, ``stdout`` and ``stderr`` as well as the " "original values ``__stdin__``, ``__stdout__`` and ``__stderr__`` can be " @@ -2420,12 +2453,12 @@ msgid "" "to a console and Python apps started with :program:`pythonw`." msgstr "" -#: ../../library/sys.rst:1869 +#: ../../library/sys.rst:1898 msgid "" "A frozenset of strings containing the names of standard library modules." msgstr "" -#: ../../library/sys.rst:1871 +#: ../../library/sys.rst:1900 msgid "" "It is the same on all platforms. Modules which are not available on some " "platforms and modules disabled at Python build are also listed. All module " @@ -2433,7 +2466,7 @@ msgid "" "modules are excluded." msgstr "" -#: ../../library/sys.rst:1876 +#: ../../library/sys.rst:1905 msgid "" "For packages, only the main package is listed: sub-packages and sub-modules " "are not listed. For example, the ``email`` package is listed, but the " @@ -2441,60 +2474,60 @@ msgid "" "listed." msgstr "" -#: ../../library/sys.rst:1881 +#: ../../library/sys.rst:1910 msgid "See also the :data:`sys.builtin_module_names` list." msgstr "另請參閱 :attr:`sys.builtin_module_names` 清單。" -#: ../../library/sys.rst:1888 +#: ../../library/sys.rst:1917 msgid "" "A :term:`named tuple` holding information about the thread implementation." msgstr "" -#: ../../library/sys.rst:1893 +#: ../../library/sys.rst:1922 msgid "The name of the thread implementation:" msgstr "" -#: ../../library/sys.rst:1895 +#: ../../library/sys.rst:1924 msgid "``\"nt\"``: Windows threads" msgstr "``\"nt\"``: Windows 執行緒" -#: ../../library/sys.rst:1896 +#: ../../library/sys.rst:1925 msgid "``\"pthread\"``: POSIX threads" msgstr "``\"pthread\"``: POSIX 執行緒" -#: ../../library/sys.rst:1897 +#: ../../library/sys.rst:1926 msgid "" "``\"pthread-stubs\"``: stub POSIX threads (on WebAssembly platforms without " "threading support)" msgstr "" -#: ../../library/sys.rst:1899 +#: ../../library/sys.rst:1928 msgid "``\"solaris\"``: Solaris threads" msgstr "" -#: ../../library/sys.rst:1903 +#: ../../library/sys.rst:1932 msgid "The name of the lock implementation:" msgstr "" -#: ../../library/sys.rst:1905 +#: ../../library/sys.rst:1934 msgid "``\"semaphore\"``: a lock uses a semaphore" msgstr "" -#: ../../library/sys.rst:1906 +#: ../../library/sys.rst:1935 msgid "``\"mutex+cond\"``: a lock uses a mutex and a condition variable" msgstr "" -#: ../../library/sys.rst:1907 +#: ../../library/sys.rst:1936 msgid "``None`` if this information is unknown" msgstr "為 ``None`` 表示此資訊未知" -#: ../../library/sys.rst:1911 +#: ../../library/sys.rst:1940 msgid "" "The name and version of the thread library. It is a string, or ``None`` if " "this information is unknown." msgstr "" -#: ../../library/sys.rst:1919 +#: ../../library/sys.rst:1948 msgid "" "When this variable is set to an integer value, it determines the maximum " "number of levels of traceback information printed when an unhandled " @@ -2503,73 +2536,73 @@ msgid "" "are printed." msgstr "" -#: ../../library/sys.rst:1927 +#: ../../library/sys.rst:1956 msgid "Handle an unraisable exception." msgstr "處理一個不可被引發的例外。" -#: ../../library/sys.rst:1929 +#: ../../library/sys.rst:1958 msgid "" "Called when an exception has occurred but there is no way for Python to " "handle it. For example, when a destructor raises an exception or during " "garbage collection (:func:`gc.collect`)." msgstr "" -#: ../../library/sys.rst:1933 +#: ../../library/sys.rst:1962 msgid "The *unraisable* argument has the following attributes:" msgstr "" -#: ../../library/sys.rst:1935 +#: ../../library/sys.rst:1964 msgid ":attr:`!exc_type`: Exception type." msgstr ":attr:`!exc_type`: 例外型別。" -#: ../../library/sys.rst:1936 +#: ../../library/sys.rst:1965 msgid ":attr:`!exc_value`: Exception value, can be ``None``." msgstr ":attr:`!exc_value`: 例外值,可以為 ``None``。" -#: ../../library/sys.rst:1937 +#: ../../library/sys.rst:1966 msgid ":attr:`!exc_traceback`: Exception traceback, can be ``None``." msgstr ":attr:`!exc_traceback`: 例外追蹤,可以為 ``None``。" -#: ../../library/sys.rst:1938 +#: ../../library/sys.rst:1967 msgid ":attr:`!err_msg`: Error message, can be ``None``." msgstr ":attr:`!err_msg`: 錯誤訊息,可以為 ``None``。" -#: ../../library/sys.rst:1939 +#: ../../library/sys.rst:1968 msgid ":attr:`!object`: Object causing the exception, can be ``None``." msgstr ":attr:`!object`: 導致例外的物件,可以為 ``None``。" -#: ../../library/sys.rst:1941 +#: ../../library/sys.rst:1970 msgid "" "The default hook formats :attr:`!err_msg` and :attr:`!object` as: " "``f'{err_msg}: {object!r}'``; use \"Exception ignored in\" error message if :" "attr:`!err_msg` is ``None``." msgstr "" -#: ../../library/sys.rst:1945 +#: ../../library/sys.rst:1974 msgid "" ":func:`sys.unraisablehook` can be overridden to control how unraisable " "exceptions are handled." msgstr "" -#: ../../library/sys.rst:1950 +#: ../../library/sys.rst:1979 msgid ":func:`excepthook` which handles uncaught exceptions." msgstr "處理未被捕捉到例外的 :func:`excepthook`。" -#: ../../library/sys.rst:1954 +#: ../../library/sys.rst:1983 msgid "" "Storing :attr:`!exc_value` using a custom hook can create a reference cycle. " "It should be cleared explicitly to break the reference cycle when the " "exception is no longer needed." msgstr "" -#: ../../library/sys.rst:1958 +#: ../../library/sys.rst:1987 msgid "" "Storing :attr:`!object` using a custom hook can resurrect it if it is set to " "an object which is being finalized. Avoid storing :attr:`!object` after the " "custom hook completes to avoid resurrecting objects." msgstr "" -#: ../../library/sys.rst:1962 ../../library/sys.rst:1964 +#: ../../library/sys.rst:1991 ../../library/sys.rst:1993 msgid "" "Raise an auditing event ``sys.unraisablehook`` with arguments *hook*, " "*unraisable* when an exception that cannot be handled occurs. The " @@ -2577,7 +2610,7 @@ msgid "" "hook has been set, *hook* may be ``None``." msgstr "" -#: ../../library/sys.rst:1973 +#: ../../library/sys.rst:2002 msgid "" "A string containing the version number of the Python interpreter plus " "additional information on the build number and compiler used. This string " @@ -2586,13 +2619,13 @@ msgid "" "functions provided by the :mod:`platform` module." msgstr "" -#: ../../library/sys.rst:1982 +#: ../../library/sys.rst:2011 msgid "" "The C API version for this interpreter. Programmers may find this useful " "when debugging version conflicts between Python and extension modules." msgstr "" -#: ../../library/sys.rst:1988 +#: ../../library/sys.rst:2017 msgid "" "A tuple containing the five components of the version number: *major*, " "*minor*, *micro*, *releaselevel*, and *serial*. All values except " @@ -2603,18 +2636,18 @@ msgid "" "version_info.major`` and so on." msgstr "" -#: ../../library/sys.rst:1996 +#: ../../library/sys.rst:2025 msgid "Added named component attributes." msgstr "新增了附名的元件屬性。" -#: ../../library/sys.rst:2001 +#: ../../library/sys.rst:2030 msgid "" "This is an implementation detail of the warnings framework; do not modify " "this value. Refer to the :mod:`warnings` module for more information on the " "warnings framework." msgstr "" -#: ../../library/sys.rst:2008 +#: ../../library/sys.rst:2037 msgid "" "The version number used to form registry keys on Windows platforms. This is " "stored as string resource 1000 in the Python DLL. The value is normally the " @@ -2623,20 +2656,20 @@ msgid "" "has no effect on the registry keys used by Python." msgstr "" -#: ../../library/sys.rst:2020 +#: ../../library/sys.rst:2049 msgid "" "Namespace containing functions and constants for register callbacks and " "controlling monitoring events. See :mod:`sys.monitoring` for details." msgstr "" -#: ../../library/sys.rst:2026 +#: ../../library/sys.rst:2055 msgid "" "A dictionary of the various implementation-specific flags passed through " "the :option:`-X` command-line option. Option names are either mapped to " "their values, if given explicitly, or to :const:`True`. Example:" msgstr "" -#: ../../library/sys.rst:2030 +#: ../../library/sys.rst:2059 msgid "" "$ ./python -Xa=b -Xc\n" "Python 3.2a3+ (py3k, Oct 16 2010, 20:14:50)\n" @@ -2656,18 +2689,18 @@ msgstr "" ">>> sys._xoptions\n" "{'a': 'b', 'c': True}" -#: ../../library/sys.rst:2042 +#: ../../library/sys.rst:2071 msgid "" "This is a CPython-specific way of accessing options passed through :option:`-" "X`. Other implementations may export them through other means, or not at " "all." msgstr "" -#: ../../library/sys.rst:2050 +#: ../../library/sys.rst:2079 msgid "Citations" msgstr "引用" -#: ../../library/sys.rst:2051 +#: ../../library/sys.rst:2080 msgid "" "ISO/IEC 9899:1999. \"Programming languages -- C.\" A public draft of this " "standard is available at https://www.open-std.org/jtc1/sc22/wg14/www/docs/" @@ -2688,50 +2721,50 @@ msgstr "object(物件)" msgid "traceback" msgstr "traceback" -#: ../../library/sys.rst:925 ../../library/sys.rst:1502 +#: ../../library/sys.rst:954 ../../library/sys.rst:1531 msgid "profile function" msgstr "" -#: ../../library/sys.rst:925 ../../library/sys.rst:1502 +#: ../../library/sys.rst:954 ../../library/sys.rst:1531 msgid "profiler" msgstr "" -#: ../../library/sys.rst:934 ../../library/sys.rst:1585 +#: ../../library/sys.rst:963 ../../library/sys.rst:1614 msgid "trace function" msgstr "" -#: ../../library/sys.rst:934 ../../library/sys.rst:1585 +#: ../../library/sys.rst:963 ../../library/sys.rst:1614 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/sys.rst:1330 +#: ../../library/sys.rst:1359 msgid "module" msgstr "module(模組)" -#: ../../library/sys.rst:1330 +#: ../../library/sys.rst:1359 msgid "search" msgstr "search(搜尋)" -#: ../../library/sys.rst:1330 +#: ../../library/sys.rst:1359 msgid "path" msgstr "path(路徑)" -#: ../../library/sys.rst:1466 +#: ../../library/sys.rst:1495 msgid "interpreter prompts" msgstr "interpreter prompts(直譯器提示)" -#: ../../library/sys.rst:1466 +#: ../../library/sys.rst:1495 msgid "prompts, interpreter" msgstr "prompts, interpreter(提示、直譯器)" -#: ../../library/sys.rst:1466 +#: ../../library/sys.rst:1495 msgid ">>>" msgstr ">>>" -#: ../../library/sys.rst:1466 +#: ../../library/sys.rst:1495 msgid "interpreter prompt" msgstr "interpreter prompt(直譯器提示)" -#: ../../library/sys.rst:1466 +#: ../../library/sys.rst:1495 msgid "..." msgstr "..." diff --git a/library/sys_path_init.po b/library/sys_path_init.po index 4e699203ea..060912a646 100644 --- a/library/sys_path_init.po +++ b/library/sys_path_init.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. @@ -11,7 +10,8 @@ msgstr "" "POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -19,7 +19,7 @@ msgstr "" #: ../../library/sys_path_init.rst:4 msgid "The initialization of the :data:`sys.path` module search path" -msgstr "" +msgstr ":data:`sys.path` 模組搜尋路徑的初始化" #: ../../library/sys_path_init.rst:6 msgid "" @@ -110,7 +110,7 @@ msgstr "" #: ../../library/sys_path_init.rst:64 msgid "Virtual environments" -msgstr "" +msgstr "虛擬環境" #: ../../library/sys_path_init.rst:66 msgid "" @@ -133,7 +133,7 @@ msgstr "" #: ../../library/sys_path_init.rst:77 msgid "_pth files" -msgstr "" +msgstr "_pth 檔案" #: ../../library/sys_path_init.rst:79 msgid "" @@ -176,8 +176,8 @@ msgstr "" #: ../../library/sys_path_init.rst:106 msgid ":ref:`windows_finding_modules` for detailed Windows notes." -msgstr "" +msgstr ":ref:`windows_finding_modules` 有關於 Windows 的詳細資訊。" #: ../../library/sys_path_init.rst:107 msgid ":ref:`using-on-unix` for Unix details." -msgstr "" +msgstr ":ref:`using-on-unix` 有關於 Unix 的詳細資訊。" diff --git a/library/telnetlib.po b/library/telnetlib.po new file mode 100644 index 0000000000..cd0b4c26d3 --- /dev/null +++ b/library/telnetlib.po @@ -0,0 +1,48 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/telnetlib.rst:2 +msgid ":mod:`!telnetlib` --- Telnet client" +msgstr ":mod:`!telnetlib` --- Telnet 客戶端" + +#: ../../library/telnetlib.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 ` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 `。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/telnetlib.rst:14 +msgid "" +"Possible replacements are third-party libraries from PyPI: :pypi:" +"`telnetlib3` or :pypi:`Exscript`. These are not supported or maintained by " +"the Python core team." +msgstr "" +"可能的替代方案是 PyPI 上的第三方函式庫::pypi:`telnetlib3` 或 :pypi:" +"`Exscript`。它們並不受 Python 核心團隊支援或維護。" + +#: ../../library/telnetlib.rst:18 +msgid "" +"The last version of Python that provided the :mod:`!telnetlib` module was " +"`Python 3.12 `_." +msgstr "" +"最後提供 :mod:`!telnetlib` 模組的 Python 版本是 `Python 3.12 `_。" diff --git a/library/time.po b/library/time.po index 8b595a42b9..db6badd4c8 100644 --- a/library/time.po +++ b/library/time.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-01 00:15+0000\n" +"POT-Creation-Date: 2024-11-12 00:13+0000\n" "PO-Revision-Date: 2024-11-20 15:25+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -614,14 +614,14 @@ msgid "" "time slice to any other thread that is ready to run. If there are no other " "threads ready to run, the function returns immediately, and the thread " "continues execution. On Windows 8.1 and newer the implementation uses a " -"`high-resolution timer `_ which provides resolution of 100 " +"`high-resolution timer `_ which provides resolution of 100 " "nanoseconds. If *secs* is zero, ``Sleep(0)`` is used." msgstr "" "在 Windows 上,如果 *secs* 為零,則執行緒將其剩餘的時間片段讓給任何準備運行的" "其他執行緒。如果沒有其他執行緒準備運行,該函式將立即回傳,而執行緒會繼續執" "行。在 Windows 8.1 及更新的版本中,此實作使用\\ `高解析度計時器 `_,其解析度為 100 奈秒。如果 *secs* 為零,則使用 ``Sleep(0)``。" #: ../../library/time.rst:396 diff --git a/library/typing.po b/library/typing.po index 2c5d63c990..909335de57 100644 --- a/library/typing.po +++ b/library/typing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-30 09:19+0000\n" +"POT-Creation-Date: 2024-11-11 06:16+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-" @@ -2788,13 +2788,14 @@ msgstr "" #: ../../library/typing.rst:1729 msgid "" -"This syntax can also be used to create bound and constrained type variables::" +"This syntax can also be used to create bounded and constrained type " +"variables::" msgstr "" #: ../../library/typing.rst:1732 msgid "" -"class StrSequence[S: str]: # S is a TypeVar bound to str\n" -" ...\n" +"class StrSequence[S: str]: # S is a TypeVar with a `str` upper bound;\n" +" ... # we can say that S is \"bounded by `str`\"\n" "\n" "\n" "class StrOrBytesSequence[A: (str, bytes)]: # A is a TypeVar constrained to " @@ -2843,8 +2844,8 @@ msgstr "" #: ../../library/typing.rst:1766 msgid "" -"Note that type variables can be *bound*, *constrained*, or neither, but " -"cannot be both bound *and* constrained." +"Note that type variables can be *bounded*, *constrained*, or neither, but " +"cannot be both bounded *and* constrained." msgstr "" #: ../../library/typing.rst:1769 @@ -2859,9 +2860,9 @@ msgstr "" #: ../../library/typing.rst:1777 msgid "" -"Bound type variables and constrained type variables have different semantics " -"in several important ways. Using a *bound* type variable means that the " -"``TypeVar`` will be solved using the most specific type possible::" +"Bounded type variables and constrained type variables have different " +"semantics in several important ways. Using a *bounded* type variable means " +"that the ``TypeVar`` will be solved using the most specific type possible::" msgstr "" #: ../../library/typing.rst:1781 @@ -2880,8 +2881,8 @@ msgstr "" #: ../../library/typing.rst:1792 msgid "" -"Type variables can be bound to concrete types, abstract types (ABCs or " -"protocols), and even unions of types::" +"The upper bound of a type variable can be a concrete type, abstract type " +"(ABC or Protocol), or even a union of types::" msgstr "" #: ../../library/typing.rst:1795 @@ -2936,7 +2937,7 @@ msgid "" msgstr "" #: ../../library/typing.rst:1837 -msgid "The bound of the type variable, if any." +msgid "The upper bound of the type variable, if any." msgstr "" #: ../../library/typing.rst:1841 @@ -3249,8 +3250,8 @@ msgstr "" #: ../../library/typing.rst:2062 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " -"use a :class:`TypeVar` with bound ``Callable[..., Any]``. However this " -"causes two problems:" +"use a :class:`TypeVar` with upper bound ``Callable[..., Any]``. However " +"this causes two problems:" msgstr "" #: ../../library/typing.rst:2066 diff --git a/library/urllib.parse.po b/library/urllib.parse.po index d522fd40ff..d8aa51ce60 100644 --- a/library/urllib.parse.po +++ b/library/urllib.parse.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-11-16 00:16+0000\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -190,22 +190,22 @@ msgid "" msgstr "" #: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 -#: ../../library/urllib.parse.rst:423 +#: ../../library/urllib.parse.rst:432 msgid "Attribute" msgstr "屬性" #: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 -#: ../../library/urllib.parse.rst:423 +#: ../../library/urllib.parse.rst:432 msgid "Index" msgstr "" #: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 -#: ../../library/urllib.parse.rst:423 +#: ../../library/urllib.parse.rst:432 msgid "Value" msgstr "" #: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 -#: ../../library/urllib.parse.rst:423 +#: ../../library/urllib.parse.rst:432 msgid "Value if not present" msgstr "" @@ -214,7 +214,7 @@ msgid ":attr:`scheme`" msgstr ":attr:`scheme`" #: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:312 -#: ../../library/urllib.parse.rst:425 +#: ../../library/urllib.parse.rst:434 msgid "0" msgstr "0" @@ -231,7 +231,7 @@ msgid ":attr:`netloc`" msgstr ":attr:`netloc`" #: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:314 -#: ../../library/urllib.parse.rst:427 +#: ../../library/urllib.parse.rst:436 msgid "1" msgstr "1" @@ -243,8 +243,8 @@ msgstr "" #: ../../library/urllib.parse.rst:129 ../../library/urllib.parse.rst:132 #: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:314 #: ../../library/urllib.parse.rst:316 ../../library/urllib.parse.rst:318 -#: ../../library/urllib.parse.rst:320 ../../library/urllib.parse.rst:425 -#: ../../library/urllib.parse.rst:427 +#: ../../library/urllib.parse.rst:320 ../../library/urllib.parse.rst:434 +#: ../../library/urllib.parse.rst:436 msgid "empty string" msgstr "" @@ -285,7 +285,7 @@ msgid "Query component" msgstr "" #: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:320 -#: ../../library/urllib.parse.rst:427 +#: ../../library/urllib.parse.rst:436 msgid ":attr:`fragment`" msgstr ":attr:`fragment`" @@ -294,7 +294,7 @@ msgid "5" msgstr "5" #: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:320 -#: ../../library/urllib.parse.rst:427 +#: ../../library/urllib.parse.rst:436 msgid "Fragment identifier" msgstr "" @@ -523,7 +523,7 @@ msgid "" msgstr "" "(addressing scheme, network location, path, query, fragment identifier)." -#: ../../library/urllib.parse.rst:306 ../../library/urllib.parse.rst:419 +#: ../../library/urllib.parse.rst:306 ../../library/urllib.parse.rst:428 msgid "" "The return value is a :term:`named tuple`, its items can be accessed by " "index or as named attributes:" @@ -597,11 +597,20 @@ msgid "" "and :func:`urlunsplit`, removing possible *scheme* and *netloc* parts." msgstr "" -#: ../../library/urllib.parse.rst:409 +#: ../../library/urllib.parse.rst:408 +msgid "" +"Because an absolute URL may be passed as the ``url`` parameter, it is " +"generally **not secure** to use ``urljoin`` with an attacker-controlled " +"``url``. For example in, ``urljoin(\"https://website.com/users//", " +"username)``, if ``username`` can contain an absolute URL, the result of " +"``urljoin`` will be the absolute URL." +msgstr "" + +#: ../../library/urllib.parse.rst:418 msgid "Behavior updated to match the semantics defined in :rfc:`3986`." msgstr "" -#: ../../library/urllib.parse.rst:414 +#: ../../library/urllib.parse.rst:423 msgid "" "If *url* contains a fragment identifier, return a modified version of *url* " "with no fragment identifier, and the fragment identifier as a separate " @@ -609,25 +618,25 @@ msgid "" "unmodified and an empty string." msgstr "" -#: ../../library/urllib.parse.rst:425 +#: ../../library/urllib.parse.rst:434 msgid ":attr:`url`" msgstr ":attr:`url`" -#: ../../library/urllib.parse.rst:425 +#: ../../library/urllib.parse.rst:434 msgid "URL with no fragment" msgstr "" -#: ../../library/urllib.parse.rst:430 +#: ../../library/urllib.parse.rst:439 msgid "" "See section :ref:`urlparse-result-object` for more information on the result " "object." msgstr "" -#: ../../library/urllib.parse.rst:433 +#: ../../library/urllib.parse.rst:442 msgid "Result is a structured object rather than a simple 2-tuple." msgstr "" -#: ../../library/urllib.parse.rst:438 +#: ../../library/urllib.parse.rst:447 msgid "" "Extract the url from a wrapped URL (that is, a string formatted as ````, ````, ``URL:scheme://host/path`` " @@ -635,11 +644,11 @@ msgid "" "without changes." msgstr "" -#: ../../library/urllib.parse.rst:446 +#: ../../library/urllib.parse.rst:455 msgid "URL parsing security" msgstr "" -#: ../../library/urllib.parse.rst:448 +#: ../../library/urllib.parse.rst:457 msgid "" "The :func:`urlsplit` and :func:`urlparse` APIs do not perform **validation** " "of inputs. They may not raise errors on inputs that other applications " @@ -648,14 +657,14 @@ msgid "" "rather than purity." msgstr "" -#: ../../library/urllib.parse.rst:454 +#: ../../library/urllib.parse.rst:463 msgid "" "Instead of raising an exception on unusual input, they may instead return " "some component parts as empty strings. Or components may contain more than " "perhaps they should." msgstr "" -#: ../../library/urllib.parse.rst:458 +#: ../../library/urllib.parse.rst:467 msgid "" "We recommend that users of these APIs where the values may be used anywhere " "with security implications code defensively. Do some verification within " @@ -664,7 +673,7 @@ msgid "" "that ``hostname``? etc." msgstr "" -#: ../../library/urllib.parse.rst:464 +#: ../../library/urllib.parse.rst:473 msgid "" "What constitutes a URL is not universally well defined. Different " "applications have different needs and desired constraints. For instance the " @@ -676,11 +685,11 @@ msgid "" "API behavior changes." msgstr "" -#: ../../library/urllib.parse.rst:475 +#: ../../library/urllib.parse.rst:484 msgid "Parsing ASCII Encoded Bytes" msgstr "" -#: ../../library/urllib.parse.rst:477 +#: ../../library/urllib.parse.rst:486 msgid "" "The URL parsing functions were originally designed to operate on character " "strings only. In practice, it is useful to be able to manipulate properly " @@ -689,14 +698,14 @@ msgid "" "`bytearray` objects in addition to :class:`str` objects." msgstr "" -#: ../../library/urllib.parse.rst:483 +#: ../../library/urllib.parse.rst:492 msgid "" "If :class:`str` data is passed in, the result will also contain only :class:" "`str` data. If :class:`bytes` or :class:`bytearray` data is passed in, the " "result will contain only :class:`bytes` data." msgstr "" -#: ../../library/urllib.parse.rst:487 +#: ../../library/urllib.parse.rst:496 msgid "" "Attempting to mix :class:`str` data with :class:`bytes` or :class:" "`bytearray` in a single function call will result in a :exc:`TypeError` " @@ -704,7 +713,7 @@ msgid "" "trigger :exc:`UnicodeDecodeError`." msgstr "" -#: ../../library/urllib.parse.rst:492 +#: ../../library/urllib.parse.rst:501 msgid "" "To support easier conversion of result objects between :class:`str` and :" "class:`bytes`, all return values from URL parsing functions provide either " @@ -717,14 +726,14 @@ msgid "" "`str` data (for :meth:`decode` methods)." msgstr "" -#: ../../library/urllib.parse.rst:503 +#: ../../library/urllib.parse.rst:512 msgid "" "Applications that need to operate on potentially improperly quoted URLs that " "may contain non-ASCII data will need to do their own decoding from bytes to " "characters before invoking the URL parsing methods." msgstr "" -#: ../../library/urllib.parse.rst:507 +#: ../../library/urllib.parse.rst:516 msgid "" "The behaviour described in this section applies only to the URL parsing " "functions. The URL quoting functions use their own rules when producing or " @@ -732,15 +741,15 @@ msgid "" "URL quoting functions." msgstr "" -#: ../../library/urllib.parse.rst:512 +#: ../../library/urllib.parse.rst:521 msgid "URL parsing functions now accept ASCII encoded byte sequences" msgstr "" -#: ../../library/urllib.parse.rst:519 +#: ../../library/urllib.parse.rst:528 msgid "Structured Parse Results" msgstr "" -#: ../../library/urllib.parse.rst:521 +#: ../../library/urllib.parse.rst:530 msgid "" "The result objects from the :func:`urlparse`, :func:`urlsplit` and :func:" "`urldefrag` functions are subclasses of the :class:`tuple` type. These " @@ -749,7 +758,7 @@ msgid "" "section, as well as an additional method:" msgstr "" -#: ../../library/urllib.parse.rst:529 +#: ../../library/urllib.parse.rst:538 msgid "" "Return the re-combined version of the original URL as a string. This may " "differ from the original URL in that the scheme may be normalized to lower " @@ -757,72 +766,72 @@ msgid "" "queries, and fragment identifiers will be removed." msgstr "" -#: ../../library/urllib.parse.rst:534 +#: ../../library/urllib.parse.rst:543 msgid "" "For :func:`urldefrag` results, only empty fragment identifiers will be " "removed. For :func:`urlsplit` and :func:`urlparse` results, all noted " "changes will be made to the URL returned by this method." msgstr "" -#: ../../library/urllib.parse.rst:538 +#: ../../library/urllib.parse.rst:547 msgid "" "The result of this method remains unchanged if passed back through the " "original parsing function:" msgstr "" -#: ../../library/urllib.parse.rst:551 +#: ../../library/urllib.parse.rst:560 msgid "" "The following classes provide the implementations of the structured parse " "results when operating on :class:`str` objects:" msgstr "" -#: ../../library/urllib.parse.rst:556 +#: ../../library/urllib.parse.rst:565 msgid "" "Concrete class for :func:`urldefrag` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`DefragResultBytes` instance." msgstr "" -#: ../../library/urllib.parse.rst:564 +#: ../../library/urllib.parse.rst:573 msgid "" "Concrete class for :func:`urlparse` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`ParseResultBytes` instance." msgstr "" -#: ../../library/urllib.parse.rst:570 +#: ../../library/urllib.parse.rst:579 msgid "" "Concrete class for :func:`urlsplit` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`SplitResultBytes` instance." msgstr "" -#: ../../library/urllib.parse.rst:575 +#: ../../library/urllib.parse.rst:584 msgid "" "The following classes provide the implementations of the parse results when " "operating on :class:`bytes` or :class:`bytearray` objects:" msgstr "" -#: ../../library/urllib.parse.rst:580 +#: ../../library/urllib.parse.rst:589 msgid "" "Concrete class for :func:`urldefrag` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`DefragResult` instance." msgstr "" -#: ../../library/urllib.parse.rst:588 +#: ../../library/urllib.parse.rst:597 msgid "" "Concrete class for :func:`urlparse` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`ParseResult` instance." msgstr "" -#: ../../library/urllib.parse.rst:596 +#: ../../library/urllib.parse.rst:605 msgid "" "Concrete class for :func:`urlsplit` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`SplitResult` instance." msgstr "" -#: ../../library/urllib.parse.rst:604 +#: ../../library/urllib.parse.rst:613 msgid "URL Quoting" msgstr "" -#: ../../library/urllib.parse.rst:606 +#: ../../library/urllib.parse.rst:615 msgid "" "The URL quoting functions focus on taking program data and making it safe " "for use as URL components by quoting special characters and appropriately " @@ -831,7 +840,7 @@ msgid "" "isn't already covered by the URL parsing functions above." msgstr "" -#: ../../library/urllib.parse.rst:614 +#: ../../library/urllib.parse.rst:623 msgid "" "Replace special characters in *string* using the :samp:`%{xx}` escape. " "Letters, digits, and the characters ``'_.-~'`` are never quoted. By default, " @@ -840,18 +849,18 @@ msgid "" "not be quoted --- its default value is ``'/'``." msgstr "" -#: ../../library/urllib.parse.rst:620 ../../library/urllib.parse.rst:666 -#: ../../library/urllib.parse.rst:695 +#: ../../library/urllib.parse.rst:629 ../../library/urllib.parse.rst:675 +#: ../../library/urllib.parse.rst:704 msgid "*string* may be either a :class:`str` or a :class:`bytes` object." msgstr "" -#: ../../library/urllib.parse.rst:622 +#: ../../library/urllib.parse.rst:631 msgid "" "Moved from :rfc:`2396` to :rfc:`3986` for quoting URL strings. \"~\" is now " "included in the set of unreserved characters." msgstr "" -#: ../../library/urllib.parse.rst:626 +#: ../../library/urllib.parse.rst:635 msgid "" "The optional *encoding* and *errors* parameters specify how to deal with non-" "ASCII characters, as accepted by the :meth:`str.encode` method. *encoding* " @@ -861,17 +870,17 @@ msgid "" "`TypeError` is raised." msgstr "" -#: ../../library/urllib.parse.rst:634 +#: ../../library/urllib.parse.rst:643 msgid "" "Note that ``quote(string, safe, encoding, errors)`` is equivalent to " "``quote_from_bytes(string.encode(encoding, errors), safe)``." msgstr "" -#: ../../library/urllib.parse.rst:637 +#: ../../library/urllib.parse.rst:646 msgid "Example: ``quote('/El Niño/')`` yields ``'/El%20Ni%C3%B1o/'``." msgstr "" -#: ../../library/urllib.parse.rst:642 +#: ../../library/urllib.parse.rst:651 msgid "" "Like :func:`quote`, but also replace spaces with plus signs, as required for " "quoting HTML form values when building up a query string to go into a URL. " @@ -879,21 +888,21 @@ msgid "" "*safe*. It also does not have *safe* default to ``'/'``." msgstr "" -#: ../../library/urllib.parse.rst:647 +#: ../../library/urllib.parse.rst:656 msgid "Example: ``quote_plus('/El Niño/')`` yields ``'%2FEl+Ni%C3%B1o%2F'``." msgstr "" -#: ../../library/urllib.parse.rst:652 +#: ../../library/urllib.parse.rst:661 msgid "" "Like :func:`quote`, but accepts a :class:`bytes` object rather than a :class:" "`str`, and does not perform string-to-bytes encoding." msgstr "" -#: ../../library/urllib.parse.rst:655 +#: ../../library/urllib.parse.rst:664 msgid "Example: ``quote_from_bytes(b'a&\\xef')`` yields ``'a%26%EF'``." msgstr "" -#: ../../library/urllib.parse.rst:661 +#: ../../library/urllib.parse.rst:670 msgid "" "Replace :samp:`%{xx}` escapes with their single-character equivalent. The " "optional *encoding* and *errors* parameters specify how to decode percent-" @@ -901,52 +910,52 @@ msgid "" "decode` method." msgstr "" -#: ../../library/urllib.parse.rst:668 +#: ../../library/urllib.parse.rst:677 msgid "" "*encoding* defaults to ``'utf-8'``. *errors* defaults to ``'replace'``, " "meaning invalid sequences are replaced by a placeholder character." msgstr "" -#: ../../library/urllib.parse.rst:672 +#: ../../library/urllib.parse.rst:681 msgid "Example: ``unquote('/El%20Ni%C3%B1o/')`` yields ``'/El Niño/'``." msgstr "" -#: ../../library/urllib.parse.rst:674 +#: ../../library/urllib.parse.rst:683 msgid "" "*string* parameter supports bytes and str objects (previously only str)." msgstr "" -#: ../../library/urllib.parse.rst:682 +#: ../../library/urllib.parse.rst:691 msgid "" "Like :func:`unquote`, but also replace plus signs with spaces, as required " "for unquoting HTML form values." msgstr "" -#: ../../library/urllib.parse.rst:685 +#: ../../library/urllib.parse.rst:694 msgid "*string* must be a :class:`str`." msgstr "" -#: ../../library/urllib.parse.rst:687 +#: ../../library/urllib.parse.rst:696 msgid "Example: ``unquote_plus('/El+Ni%C3%B1o/')`` yields ``'/El Niño/'``." msgstr "" -#: ../../library/urllib.parse.rst:692 +#: ../../library/urllib.parse.rst:701 msgid "" "Replace :samp:`%{xx}` escapes with their single-octet equivalent, and return " "a :class:`bytes` object." msgstr "" -#: ../../library/urllib.parse.rst:697 +#: ../../library/urllib.parse.rst:706 msgid "" "If it is a :class:`str`, unescaped non-ASCII characters in *string* are " "encoded into UTF-8 bytes." msgstr "" -#: ../../library/urllib.parse.rst:700 +#: ../../library/urllib.parse.rst:709 msgid "Example: ``unquote_to_bytes('a%26%EF')`` yields ``b'a&\\xef'``." msgstr "" -#: ../../library/urllib.parse.rst:706 +#: ../../library/urllib.parse.rst:715 msgid "" "Convert a mapping object or a sequence of two-element tuples, which may " "contain :class:`str` or :class:`bytes` objects, to a percent-encoded ASCII " @@ -955,7 +964,7 @@ msgid "" "be encoded to bytes, otherwise it would result in a :exc:`TypeError`." msgstr "" -#: ../../library/urllib.parse.rst:713 +#: ../../library/urllib.parse.rst:722 msgid "" "The resulting string is a series of ``key=value`` pairs separated by ``'&'`` " "characters, where both *key* and *value* are quoted using the *quote_via* " @@ -968,7 +977,7 @@ msgid "" "``quote`` and specify a value for *safe*." msgstr "" -#: ../../library/urllib.parse.rst:723 +#: ../../library/urllib.parse.rst:732 msgid "" "When a sequence of two-element tuples is used as the *query* argument, the " "first element of each tuple is a key and the second is a value. The value " @@ -979,49 +988,49 @@ msgid "" "order of parameter tuples in the sequence." msgstr "" -#: ../../library/urllib.parse.rst:731 +#: ../../library/urllib.parse.rst:740 msgid "" "The *safe*, *encoding*, and *errors* parameters are passed down to " "*quote_via* (the *encoding* and *errors* parameters are only passed when a " "query element is a :class:`str`)." msgstr "" -#: ../../library/urllib.parse.rst:735 +#: ../../library/urllib.parse.rst:744 msgid "" "To reverse this encoding process, :func:`parse_qs` and :func:`parse_qsl` are " "provided in this module to parse query strings into Python data structures." msgstr "" -#: ../../library/urllib.parse.rst:738 +#: ../../library/urllib.parse.rst:747 msgid "" "Refer to :ref:`urllib examples ` to find out how the :func:" "`urllib.parse.urlencode` method can be used for generating the query string " "of a URL or data for a POST request." msgstr "" -#: ../../library/urllib.parse.rst:742 +#: ../../library/urllib.parse.rst:751 msgid "*query* supports bytes and string objects." msgstr "" -#: ../../library/urllib.parse.rst:745 +#: ../../library/urllib.parse.rst:754 msgid "Added the *quote_via* parameter." msgstr "新增 *quote_via* 參數。" -#: ../../library/urllib.parse.rst:751 +#: ../../library/urllib.parse.rst:760 msgid "`WHATWG`_ - URL Living standard" msgstr "" -#: ../../library/urllib.parse.rst:752 +#: ../../library/urllib.parse.rst:761 msgid "" "Working Group for the URL Standard that defines URLs, domains, IP addresses, " "the application/x-www-form-urlencoded format, and their API." msgstr "" -#: ../../library/urllib.parse.rst:755 +#: ../../library/urllib.parse.rst:764 msgid ":rfc:`3986` - Uniform Resource Identifiers" msgstr "" -#: ../../library/urllib.parse.rst:756 +#: ../../library/urllib.parse.rst:765 msgid "" "This is the current standard (STD66). Any changes to urllib.parse module " "should conform to this. Certain deviations could be observed, which are " @@ -1029,49 +1038,49 @@ msgid "" "requirements as commonly observed in major browsers." msgstr "" -#: ../../library/urllib.parse.rst:761 +#: ../../library/urllib.parse.rst:770 msgid ":rfc:`2732` - Format for Literal IPv6 Addresses in URL's." msgstr "" -#: ../../library/urllib.parse.rst:762 +#: ../../library/urllib.parse.rst:771 msgid "This specifies the parsing requirements of IPv6 URLs." msgstr "" -#: ../../library/urllib.parse.rst:764 +#: ../../library/urllib.parse.rst:773 msgid ":rfc:`2396` - Uniform Resource Identifiers (URI): Generic Syntax" msgstr "" -#: ../../library/urllib.parse.rst:765 +#: ../../library/urllib.parse.rst:774 msgid "" "Document describing the generic syntactic requirements for both Uniform " "Resource Names (URNs) and Uniform Resource Locators (URLs)." msgstr "" -#: ../../library/urllib.parse.rst:768 +#: ../../library/urllib.parse.rst:777 msgid ":rfc:`2368` - The mailto URL scheme." msgstr "" -#: ../../library/urllib.parse.rst:769 +#: ../../library/urllib.parse.rst:778 msgid "Parsing requirements for mailto URL schemes." msgstr "" -#: ../../library/urllib.parse.rst:771 +#: ../../library/urllib.parse.rst:780 msgid ":rfc:`1808` - Relative Uniform Resource Locators" msgstr "" ":rfc:`1808` - 相對的統一資源定位器 (Relative Uniform Resource Locators)" -#: ../../library/urllib.parse.rst:772 +#: ../../library/urllib.parse.rst:781 msgid "" "This Request For Comments includes the rules for joining an absolute and a " "relative URL, including a fair number of \"Abnormal Examples\" which govern " "the treatment of border cases." msgstr "" -#: ../../library/urllib.parse.rst:776 +#: ../../library/urllib.parse.rst:785 msgid ":rfc:`1738` - Uniform Resource Locators (URL)" msgstr ":rfc:`1738` - 統一資源定位器 (URL, Uniform Resource Locators)" -#: ../../library/urllib.parse.rst:777 +#: ../../library/urllib.parse.rst:786 msgid "This specifies the formal syntax and semantics of absolute URLs." msgstr "" diff --git a/library/urllib.request.po b/library/urllib.request.po index aa86249d18..e18223387e 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-11-25 00:14+0000\n" "PO-Revision-Date: 2022-04-21 17:59+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -290,27 +290,46 @@ msgstr "" #: ../../library/urllib.request.rst:152 msgid "" -"Convert the pathname *path* from the local syntax for a path to the form " -"used in the path component of a URL. This does not produce a complete URL. " -"The return value will already be quoted using the :func:`~urllib.parse." -"quote` function." +"Convert the given local path to a ``file:`` URL. This function uses :func:" +"`~urllib.parse.quote` function to encode the path. For historical reasons, " +"the return value omits the ``file:`` scheme prefix. This example shows the " +"function being used on Windows::" msgstr "" -"將路徑名 *path* 從路徑的本地語法 (local syntax) 轉換為 URL 中的 path " -"component(路徑元件)格式。本函式並不會產生完整的 URL。回傳值將使用 :func:" -"`~urllib.parse.quote` 函式先進行編碼過。" -#: ../../library/urllib.request.rst:159 +#: ../../library/urllib.request.rst:157 msgid "" -"Convert the path component *path* from a percent-encoded URL to the local " -"syntax for a path. This does not accept a complete URL. This function " -"uses :func:`~urllib.parse.unquote` to decode *path*." +">>> from urllib.request import pathname2url\n" +">>> path = 'C:\\\\Program Files'\n" +">>> 'file:' + pathname2url(http://github.com/path)\n" +"'file:///C:/Program%20Files'" msgstr "" -"將一個用 \"%\" 編碼過的 URL path component *path* 轉換為路徑的本地語法 " -"(local syntax)。本函式並不接受完整的 URL。本函式使用 :func:`~urllib.parse." -"unquote` 來將 *path* 解碼。" +">>> from urllib.request import pathname2url\n" +">>> path = 'C:\\\\Program Files'\n" +">>> 'file:' + pathname2url(http://github.com/path)\n" +"'file:///C:/Program%20Files'" #: ../../library/urllib.request.rst:165 msgid "" +"Convert the given ``file:`` URL to a local path. This function uses :func:" +"`~urllib.parse.unquote` to decode the URL. For historical reasons, the given " +"value *must* omit the ``file:`` scheme prefix. This example shows the " +"function being used on Windows::" +msgstr "" + +#: ../../library/urllib.request.rst:170 +msgid "" +">>> from urllib.request import url2pathname\n" +">>> url = 'file:///C:/Program%20Files'\n" +">>> url2pathname(url.removeprefix('file:'))\n" +"'C:\\\\Program Files'" +msgstr "" +">>> from urllib.request import url2pathname\n" +">>> url = 'file:///C:/Program%20Files'\n" +">>> url2pathname(url.removeprefix('file:'))\n" +"'C:\\\\Program Files'" + +#: ../../library/urllib.request.rst:177 +msgid "" "This helper function returns a dictionary of scheme to proxy server URL " "mappings. It scans the environment for variables named ``_proxy``, " "in a case insensitive approach, for all operating systems first, and when it " @@ -324,7 +343,7 @@ msgstr "" "Configuration) 或是 Windows 系統中的 Windows Systems Registry 尋找代理服務設" "定。如果大小寫的環境變數同時存在且值有不同,小寫的環境變數會被選用。" -#: ../../library/urllib.request.rst:175 +#: ../../library/urllib.request.rst:187 msgid "" "If the environment variable ``REQUEST_METHOD`` is set, which usually " "indicates your script is running in a CGI environment, the environment " @@ -341,19 +360,19 @@ msgstr "" "``ProxyHandler``,亦或是確認變數名稱是小寫的(或至少 ``_proxy`` 後綴是小寫" "的)。" -#: ../../library/urllib.request.rst:184 +#: ../../library/urllib.request.rst:196 msgid "The following classes are provided:" msgstr "提供了以下的 classes:" -#: ../../library/urllib.request.rst:188 +#: ../../library/urllib.request.rst:200 msgid "This class is an abstraction of a URL request." msgstr "這個 class 是一個 URL 請求的抽象 class。" -#: ../../library/urllib.request.rst:190 +#: ../../library/urllib.request.rst:202 msgid "*url* should be a string containing a valid, properly encoded URL." msgstr "*url* 是一個包含有效且適當編碼的 URL 字串。" -#: ../../library/urllib.request.rst:192 +#: ../../library/urllib.request.rst:204 msgid "" "*data* must be an object specifying additional data to send to the server, " "or ``None`` if no such data is needed. Currently HTTP requests are the only " @@ -374,7 +393,7 @@ msgstr "" "``Transfer-Encoding: chunked`` 則會被用來傳送檔案或是其它可疊代物件 " "(iterables)。" -#: ../../library/urllib.request.rst:202 +#: ../../library/urllib.request.rst:214 msgid "" "For an HTTP POST request method, *data* should be a buffer in the standard :" "mimetype:`application/x-www-form-urlencoded` format. The :func:`urllib." @@ -387,7 +406,7 @@ msgstr "" "個 mapping 或是 sequence(序列)的 2-tuples,並回傳一個對應格式的 ASCII 字" "串。在被作為 *data* 參數前它應該被編碼成位元組串。" -#: ../../library/urllib.request.rst:208 +#: ../../library/urllib.request.rst:220 msgid "" "*headers* should be a dictionary, and will be treated as if :meth:" "`add_header` was called with each key and value as arguments. This is often " @@ -408,7 +427,7 @@ msgstr "" "(在 Python 2.6 上)。所有 header 的鍵都會以 camel case(駝峰式大小寫)來傳" "送。" -#: ../../library/urllib.request.rst:219 +#: ../../library/urllib.request.rst:231 msgid "" "An appropriate ``Content-Type`` header should be included if the *data* " "argument is present. If this header has not been provided and *data* is not " @@ -419,14 +438,14 @@ msgstr "" "個 header 沒有被提供且 *data* 也不為 ``None`` 時,預設值 ``Content-Type: " "application/x-www-form-urlencoded`` 會被新增至請求中。" -#: ../../library/urllib.request.rst:224 +#: ../../library/urllib.request.rst:236 msgid "" "The next two arguments are only of interest for correct handling of third-" "party HTTP cookies:" msgstr "" "接下來的兩個引數的介紹提供給那些有興趣正確處理第三方 HTTP cookies 的使用者:" -#: ../../library/urllib.request.rst:227 +#: ../../library/urllib.request.rst:239 msgid "" "*origin_req_host* should be the request-host of the origin transaction, as " "defined by :rfc:`2965`. It defaults to ``http.cookiejar." @@ -440,7 +459,7 @@ msgstr "" "起的原始請求的主機名稱或是 IP 位址。例如當請求是要求一個 HTML 文件中的一個影" "像,則這個屬性應為請求包含影像頁面的請求主機。" -#: ../../library/urllib.request.rst:235 +#: ../../library/urllib.request.rst:247 msgid "" "*unverifiable* should indicate whether the request is unverifiable, as " "defined by :rfc:`2965`. It defaults to ``False``. An unverifiable request " @@ -453,7 +472,7 @@ msgstr "" "URL,例如一個對於 HTML 文件中的影像所做的請求,而使用者沒有機會去批准是否能自" "動擷取影像,則這個值應該為 true。" -#: ../../library/urllib.request.rst:242 +#: ../../library/urllib.request.rst:254 msgid "" "*method* should be a string that indicates the HTTP request method that will " "be used (e.g. ``'HEAD'``). If provided, its value is stored in the :attr:" @@ -468,7 +487,7 @@ msgstr "" "Subclasses 可以透過設置其 :attr:`~Request.method` 屬性來設定不一樣的預設請求" "方法。" -#: ../../library/urllib.request.rst:250 +#: ../../library/urllib.request.rst:262 msgid "" "The request will not work as expected if the data object is unable to " "deliver its content more than once (e.g. a file or an iterable that can " @@ -482,15 +501,15 @@ msgstr "" "新嘗試傳送,則該請求不會正常運作。*data* 會接在 headers 之後被送至 HTTP 伺服" "器。此函式庫沒有支援 100-continue expectation。" -#: ../../library/urllib.request.rst:257 +#: ../../library/urllib.request.rst:269 msgid ":attr:`Request.method` argument is added to the Request class." msgstr "新增 :attr:`Request.method` 引數到 Request class。" -#: ../../library/urllib.request.rst:260 +#: ../../library/urllib.request.rst:272 msgid "Default :attr:`Request.method` may be indicated at the class level." msgstr "能夠在 class 中設置預設的 :attr:`Request.method`。" -#: ../../library/urllib.request.rst:263 +#: ../../library/urllib.request.rst:275 msgid "" "Do not raise an error if the ``Content-Length`` has not been provided and " "*data* is neither ``None`` nor a bytes object. Fall back to use chunked " @@ -500,34 +519,34 @@ msgstr "" "串物件,則不會觸發錯誤,並 fall back(後備)使用分塊傳輸編碼 (chunked " "transfer encoding)。" -#: ../../library/urllib.request.rst:270 +#: ../../library/urllib.request.rst:282 msgid "" "The :class:`OpenerDirector` class opens URLs via :class:`BaseHandler`\\ s " "chained together. It manages the chaining of handlers, and recovery from " "errors." msgstr "" -#: ../../library/urllib.request.rst:276 +#: ../../library/urllib.request.rst:288 msgid "" "This is the base class for all registered handlers --- and handles only the " "simple mechanics of registration." msgstr "" -#: ../../library/urllib.request.rst:282 +#: ../../library/urllib.request.rst:294 msgid "" "A class which defines a default handler for HTTP error responses; all " "responses are turned into :exc:`~urllib.error.HTTPError` exceptions." msgstr "" -#: ../../library/urllib.request.rst:288 +#: ../../library/urllib.request.rst:300 msgid "A class to handle redirections." msgstr "" -#: ../../library/urllib.request.rst:293 +#: ../../library/urllib.request.rst:305 msgid "A class to handle HTTP Cookies." msgstr "" -#: ../../library/urllib.request.rst:298 +#: ../../library/urllib.request.rst:310 msgid "" "Cause requests to go through a proxy. If *proxies* is given, it must be a " "dictionary mapping protocol names to URLs of proxies. The default is to read " @@ -538,11 +557,11 @@ msgid "" "Configuration Framework." msgstr "" -#: ../../library/urllib.request.rst:306 +#: ../../library/urllib.request.rst:318 msgid "To disable autodetected proxy pass an empty dictionary." msgstr "" -#: ../../library/urllib.request.rst:308 +#: ../../library/urllib.request.rst:320 msgid "" "The :envvar:`no_proxy` environment variable can be used to specify hosts " "which shouldn't be reached via proxy; if set, it should be a comma-separated " @@ -550,24 +569,24 @@ msgid "" "``cern.ch,ncsa.uiuc.edu,some.host:8080``." msgstr "" -#: ../../library/urllib.request.rst:315 +#: ../../library/urllib.request.rst:327 msgid "" "``HTTP_PROXY`` will be ignored if a variable ``REQUEST_METHOD`` is set; see " "the documentation on :func:`~urllib.request.getproxies`." msgstr "" -#: ../../library/urllib.request.rst:321 +#: ../../library/urllib.request.rst:333 msgid "Keep a database of ``(realm, uri) -> (user, password)`` mappings." msgstr "" -#: ../../library/urllib.request.rst:326 +#: ../../library/urllib.request.rst:338 msgid "" "Keep a database of ``(realm, uri) -> (user, password)`` mappings. A realm " "of ``None`` is considered a catch-all realm, which is searched if no other " "realm fits." msgstr "" -#: ../../library/urllib.request.rst:333 +#: ../../library/urllib.request.rst:345 msgid "" "A variant of :class:`HTTPPasswordMgrWithDefaultRealm` that also has a " "database of ``uri -> is_authenticated`` mappings. Can be used by a " @@ -575,7 +594,7 @@ msgid "" "immediately instead of waiting for a ``401`` response first." msgstr "" -#: ../../library/urllib.request.rst:343 +#: ../../library/urllib.request.rst:355 msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " @@ -594,11 +613,11 @@ msgid "" "will automatically include the authentication credentials." msgstr "" -#: ../../library/urllib.request.rst:360 +#: ../../library/urllib.request.rst:372 msgid "Added ``is_authenticated`` support." msgstr "新增 ``is_authenticated`` 的支援。" -#: ../../library/urllib.request.rst:366 +#: ../../library/urllib.request.rst:378 msgid "" "Handle authentication with the remote host. *password_mgr*, if given, should " "be something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -607,7 +626,7 @@ msgid "" "presented with a wrong Authentication scheme." msgstr "" -#: ../../library/urllib.request.rst:375 ../../library/urllib.request.rst:409 +#: ../../library/urllib.request.rst:387 ../../library/urllib.request.rst:421 msgid "" "Handle authentication with the proxy. *password_mgr*, if given, should be " "something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -615,7 +634,7 @@ msgid "" "be supported." msgstr "" -#: ../../library/urllib.request.rst:383 +#: ../../library/urllib.request.rst:395 msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " @@ -623,7 +642,7 @@ msgid "" "`http-password-mgr` for information on the interface that must be supported." msgstr "" -#: ../../library/urllib.request.rst:392 +#: ../../library/urllib.request.rst:404 msgid "" "Handle authentication with the remote host. *password_mgr*, if given, should " "be something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -636,108 +655,108 @@ msgid "" "Digest or Basic." msgstr "" -#: ../../library/urllib.request.rst:402 +#: ../../library/urllib.request.rst:414 msgid "Raise :exc:`ValueError` on unsupported Authentication Scheme." msgstr "" -#: ../../library/urllib.request.rst:417 +#: ../../library/urllib.request.rst:429 msgid "A class to handle opening of HTTP URLs." msgstr "" -#: ../../library/urllib.request.rst:422 +#: ../../library/urllib.request.rst:434 msgid "" "A class to handle opening of HTTPS URLs. *context* and *check_hostname* " "have the same meaning as in :class:`http.client.HTTPSConnection`." msgstr "" -#: ../../library/urllib.request.rst:425 +#: ../../library/urllib.request.rst:437 msgid "*context* and *check_hostname* were added." msgstr "新增 *context* 與 *check_hostname*。" -#: ../../library/urllib.request.rst:431 +#: ../../library/urllib.request.rst:443 msgid "Open local files." msgstr "" -#: ../../library/urllib.request.rst:435 +#: ../../library/urllib.request.rst:447 msgid "Open data URLs." msgstr "" -#: ../../library/urllib.request.rst:441 +#: ../../library/urllib.request.rst:453 msgid "Open FTP URLs." -msgstr "" +msgstr "打開 FTP URLs。" -#: ../../library/urllib.request.rst:446 +#: ../../library/urllib.request.rst:458 msgid "" "Open FTP URLs, keeping a cache of open FTP connections to minimize delays." msgstr "" -#: ../../library/urllib.request.rst:451 +#: ../../library/urllib.request.rst:463 msgid "A catch-all class to handle unknown URLs." msgstr "" -#: ../../library/urllib.request.rst:456 ../../library/urllib.request.rst:1162 +#: ../../library/urllib.request.rst:468 ../../library/urllib.request.rst:1174 msgid "Process HTTP error responses." msgstr "" -#: ../../library/urllib.request.rst:462 +#: ../../library/urllib.request.rst:474 msgid "Request Objects" -msgstr "" +msgstr "Request 物件" -#: ../../library/urllib.request.rst:464 +#: ../../library/urllib.request.rst:476 msgid "" "The following methods describe :class:`Request`'s public interface, and so " "all may be overridden in subclasses. It also defines several public " "attributes that can be used by clients to inspect the parsed request." msgstr "" -#: ../../library/urllib.request.rst:471 +#: ../../library/urllib.request.rst:483 msgid "The original URL passed to the constructor." msgstr "" -#: ../../library/urllib.request.rst:475 +#: ../../library/urllib.request.rst:487 msgid "" "Request.full_url is a property with setter, getter and a deleter. Getting :" "attr:`~Request.full_url` returns the original request URL with the fragment, " "if it was present." msgstr "" -#: ../../library/urllib.request.rst:481 +#: ../../library/urllib.request.rst:493 msgid "The URI scheme." msgstr "" -#: ../../library/urllib.request.rst:485 +#: ../../library/urllib.request.rst:497 msgid "" "The URI authority, typically a host, but may also contain a port separated " "by a colon." msgstr "" -#: ../../library/urllib.request.rst:490 +#: ../../library/urllib.request.rst:502 msgid "The original host for the request, without port." msgstr "" -#: ../../library/urllib.request.rst:494 +#: ../../library/urllib.request.rst:506 msgid "" "The URI path. If the :class:`Request` uses a proxy, then selector will be " "the full URL that is passed to the proxy." msgstr "" -#: ../../library/urllib.request.rst:499 +#: ../../library/urllib.request.rst:511 msgid "The entity body for the request, or ``None`` if not specified." msgstr "" -#: ../../library/urllib.request.rst:501 +#: ../../library/urllib.request.rst:513 msgid "" "Changing value of :attr:`Request.data` now deletes \"Content-Length\" header " "if it was previously set or calculated." msgstr "" -#: ../../library/urllib.request.rst:507 +#: ../../library/urllib.request.rst:519 msgid "" "boolean, indicates whether the request is unverifiable as defined by :rfc:" "`2965`." msgstr "" -#: ../../library/urllib.request.rst:512 +#: ../../library/urllib.request.rst:524 msgid "" "The HTTP request method to use. By default its value is :const:`None`, " "which means that :meth:`~Request.get_method` will do its normal computation " @@ -748,13 +767,13 @@ msgid "" "argument." msgstr "" -#: ../../library/urllib.request.rst:522 +#: ../../library/urllib.request.rst:534 msgid "" "A default value can now be set in subclasses; previously it could only be " "set via the constructor argument." msgstr "" -#: ../../library/urllib.request.rst:529 +#: ../../library/urllib.request.rst:541 msgid "" "Return a string indicating the HTTP request method. If :attr:`Request." "method` is not ``None``, return its value, otherwise return ``'GET'`` if :" @@ -762,11 +781,11 @@ msgid "" "meaningful for HTTP requests." msgstr "" -#: ../../library/urllib.request.rst:534 +#: ../../library/urllib.request.rst:546 msgid "get_method now looks at the value of :attr:`Request.method`." msgstr "" -#: ../../library/urllib.request.rst:540 +#: ../../library/urllib.request.rst:552 msgid "" "Add another header to the request. Headers are currently ignored by all " "handlers except HTTP handlers, where they are added to the list of headers " @@ -778,64 +797,64 @@ msgid "" "headers added using this method are also added to redirected requests." msgstr "" -#: ../../library/urllib.request.rst:552 +#: ../../library/urllib.request.rst:564 msgid "Add a header that will not be added to a redirected request." msgstr "" -#: ../../library/urllib.request.rst:557 +#: ../../library/urllib.request.rst:569 msgid "" "Return whether the instance has the named header (checks both regular and " "unredirected)." msgstr "" -#: ../../library/urllib.request.rst:563 +#: ../../library/urllib.request.rst:575 msgid "" "Remove named header from the request instance (both from regular and " "unredirected headers)." msgstr "" -#: ../../library/urllib.request.rst:571 +#: ../../library/urllib.request.rst:583 msgid "Return the URL given in the constructor." msgstr "" -#: ../../library/urllib.request.rst:575 +#: ../../library/urllib.request.rst:587 msgid "Returns :attr:`Request.full_url`" -msgstr "" +msgstr "回傳 :attr:`Request.full_url`" -#: ../../library/urllib.request.rst:580 +#: ../../library/urllib.request.rst:592 msgid "" "Prepare the request by connecting to a proxy server. The *host* and *type* " "will replace those of the instance, and the instance's selector will be the " "original URL given in the constructor." msgstr "" -#: ../../library/urllib.request.rst:587 +#: ../../library/urllib.request.rst:599 msgid "" "Return the value of the given header. If the header is not present, return " "the default value." msgstr "" -#: ../../library/urllib.request.rst:593 +#: ../../library/urllib.request.rst:605 msgid "" "Return a list of tuples (header_name, header_value) of the Request headers." msgstr "" -#: ../../library/urllib.request.rst:595 +#: ../../library/urllib.request.rst:607 msgid "" "The request methods add_data, has_data, get_data, get_type, get_host, " "get_selector, get_origin_req_host and is_unverifiable that were deprecated " "since 3.3 have been removed." msgstr "" -#: ../../library/urllib.request.rst:604 +#: ../../library/urllib.request.rst:616 msgid "OpenerDirector Objects" msgstr "OpenerDirector 物件" -#: ../../library/urllib.request.rst:606 +#: ../../library/urllib.request.rst:618 msgid ":class:`OpenerDirector` instances have the following methods:" -msgstr "" +msgstr ":class:`OpenerDirector` 物件有以下的方法:" -#: ../../library/urllib.request.rst:611 +#: ../../library/urllib.request.rst:623 msgid "" "*handler* should be an instance of :class:`BaseHandler`. The following " "methods are searched, and added to the possible chains (note that HTTP " @@ -846,53 +865,53 @@ msgid "" "`http_error_404` would handle HTTP 404 errors." msgstr "" -#: ../../library/urllib.request.rst:619 +#: ../../library/urllib.request.rst:631 msgid "" ":meth:`!_open` --- signal that the handler knows how to open " "*protocol* URLs." msgstr "" -#: ../../library/urllib.request.rst:622 +#: ../../library/urllib.request.rst:634 msgid "See |protocol_open|_ for more information." msgstr "更多資訊請見 |protocol_open|_。" -#: ../../library/urllib.request.rst:624 +#: ../../library/urllib.request.rst:636 msgid "" ":meth:`!http_error_\\` --- signal that the handler knows how to " "handle HTTP errors with HTTP error code *type*." msgstr "" -#: ../../library/urllib.request.rst:627 +#: ../../library/urllib.request.rst:639 msgid "See |http_error_nnn|_ for more information." msgstr "更多資訊請見 |http_error_nnn|_。" -#: ../../library/urllib.request.rst:629 +#: ../../library/urllib.request.rst:641 msgid "" ":meth:`!_error` --- signal that the handler knows how to handle " "errors from (non-\\ ``http``) *protocol*." msgstr "" -#: ../../library/urllib.request.rst:632 +#: ../../library/urllib.request.rst:644 msgid "" ":meth:`!_request` --- signal that the handler knows how to pre-" "process *protocol* requests." msgstr "" -#: ../../library/urllib.request.rst:635 +#: ../../library/urllib.request.rst:647 msgid "See |protocol_request|_ for more information." msgstr "更多資訊請見 |protocol_request|_。" -#: ../../library/urllib.request.rst:637 +#: ../../library/urllib.request.rst:649 msgid "" ":meth:`!_response` --- signal that the handler knows how to post-" "process *protocol* responses." msgstr "" -#: ../../library/urllib.request.rst:640 +#: ../../library/urllib.request.rst:652 msgid "See |protocol_response|_ for more information." msgstr "更多資訊請見 |protocol_response|_。" -#: ../../library/urllib.request.rst:649 +#: ../../library/urllib.request.rst:661 msgid "" "Open the given *url* (which can be a request object or a string), optionally " "passing the given *data*. Arguments, return values and exceptions raised are " @@ -904,7 +923,7 @@ msgid "" "HTTP, HTTPS and FTP connections." msgstr "" -#: ../../library/urllib.request.rst:661 +#: ../../library/urllib.request.rst:673 msgid "" "Handle an error of the given protocol. This will call the registered error " "handlers for the given protocol with the given arguments (which are protocol " @@ -913,28 +932,28 @@ msgid "" "http_error_\\` methods of the handler classes." msgstr "" -#: ../../library/urllib.request.rst:667 +#: ../../library/urllib.request.rst:679 msgid "" "Return values and exceptions raised are the same as those of :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:669 +#: ../../library/urllib.request.rst:681 msgid "OpenerDirector objects open URLs in three stages:" msgstr "" -#: ../../library/urllib.request.rst:671 +#: ../../library/urllib.request.rst:683 msgid "" "The order in which these methods are called within each stage is determined " "by sorting the handler instances." msgstr "" -#: ../../library/urllib.request.rst:674 +#: ../../library/urllib.request.rst:686 msgid "" "Every handler with a method named like :meth:`!_request` has that " "method called to pre-process the request." msgstr "" -#: ../../library/urllib.request.rst:677 +#: ../../library/urllib.request.rst:689 msgid "" "Handlers with a method named like :meth:`!_open` are called to " "handle the request. This stage ends when a handler either returns a non-\\ :" @@ -942,7 +961,7 @@ msgid "" "`~urllib.error.URLError`). Exceptions are allowed to propagate." msgstr "" -#: ../../library/urllib.request.rst:682 +#: ../../library/urllib.request.rst:694 msgid "" "In fact, the above algorithm is first tried for methods named :meth:" "`~BaseHandler.default_open`. If all such methods return :const:`None`, the " @@ -951,64 +970,64 @@ msgid "" "named :meth:`~BaseHandler.unknown_open`." msgstr "" -#: ../../library/urllib.request.rst:688 +#: ../../library/urllib.request.rst:700 msgid "" "Note that the implementation of these methods may involve calls of the " "parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` and :" "meth:`~OpenerDirector.error` methods." msgstr "" -#: ../../library/urllib.request.rst:692 +#: ../../library/urllib.request.rst:704 msgid "" "Every handler with a method named like :meth:`!_response` has that " "method called to post-process the response." msgstr "" -#: ../../library/urllib.request.rst:699 +#: ../../library/urllib.request.rst:711 msgid "BaseHandler Objects" msgstr "BaseHandler 物件" -#: ../../library/urllib.request.rst:701 +#: ../../library/urllib.request.rst:713 msgid "" ":class:`BaseHandler` objects provide a couple of methods that are directly " "useful, and others that are meant to be used by derived classes. These are " "intended for direct use:" msgstr "" -#: ../../library/urllib.request.rst:708 +#: ../../library/urllib.request.rst:720 msgid "Add a director as parent." msgstr "" -#: ../../library/urllib.request.rst:713 +#: ../../library/urllib.request.rst:725 msgid "Remove any parents." msgstr "" -#: ../../library/urllib.request.rst:715 +#: ../../library/urllib.request.rst:727 msgid "" "The following attribute and methods should only be used by classes derived " "from :class:`BaseHandler`." msgstr "" -#: ../../library/urllib.request.rst:720 +#: ../../library/urllib.request.rst:732 msgid "" "The convention has been adopted that subclasses defining :meth:`!" "_request` or :meth:`!_response` methods are named :class:" "`!\\*Processor`; all others are named :class:`!\\*Handler`." msgstr "" -#: ../../library/urllib.request.rst:727 +#: ../../library/urllib.request.rst:739 msgid "" "A valid :class:`OpenerDirector`, which can be used to open using a different " "protocol, or handle errors." msgstr "" -#: ../../library/urllib.request.rst:733 +#: ../../library/urllib.request.rst:745 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to catch all URLs." msgstr "" -#: ../../library/urllib.request.rst:736 +#: ../../library/urllib.request.rst:748 msgid "" "This method, if implemented, will be called by the parent :class:" "`OpenerDirector`. It should return a file-like object as described in the " @@ -1018,38 +1037,38 @@ msgid "" "`MemoryError` should not be mapped to :exc:`~urllib.error.URLError`)." msgstr "" -#: ../../library/urllib.request.rst:743 +#: ../../library/urllib.request.rst:755 msgid "This method will be called before any protocol-specific open method." msgstr "" -#: ../../library/urllib.request.rst:750 +#: ../../library/urllib.request.rst:762 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to handle URLs with the given protocol." msgstr "" -#: ../../library/urllib.request.rst:753 +#: ../../library/urllib.request.rst:765 msgid "" "This method, if defined, will be called by the parent :class:" "`OpenerDirector`. Return values should be the same as for :meth:" "`~BaseHandler.default_open`." msgstr "" -#: ../../library/urllib.request.rst:759 +#: ../../library/urllib.request.rst:771 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to catch all URLs with no specific registered handler " "to open it." msgstr "" -#: ../../library/urllib.request.rst:763 +#: ../../library/urllib.request.rst:775 msgid "" "This method, if implemented, will be called by the :attr:`parent` :class:" "`OpenerDirector`. Return values should be the same as for :meth:" "`default_open`." msgstr "" -#: ../../library/urllib.request.rst:770 +#: ../../library/urllib.request.rst:782 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "override it if they intend to provide a catch-all for otherwise unhandled " @@ -1058,7 +1077,7 @@ msgid "" "other circumstances." msgstr "" -#: ../../library/urllib.request.rst:775 +#: ../../library/urllib.request.rst:787 msgid "" "*req* will be a :class:`Request` object, *fp* will be a file-like object " "with the HTTP error body, *code* will be the three-digit code of the error, " @@ -1066,49 +1085,49 @@ msgid "" "mapping object with the headers of the error." msgstr "" -#: ../../library/urllib.request.rst:780 +#: ../../library/urllib.request.rst:792 msgid "" "Return values and exceptions raised should be the same as those of :func:" "`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:787 +#: ../../library/urllib.request.rst:799 msgid "" "*nnn* should be a three-digit HTTP error code. This method is also not " "defined in :class:`BaseHandler`, but will be called, if it exists, on an " "instance of a subclass, when an HTTP error with code *nnn* occurs." msgstr "" -#: ../../library/urllib.request.rst:791 +#: ../../library/urllib.request.rst:803 msgid "Subclasses should override this method to handle specific HTTP errors." msgstr "" -#: ../../library/urllib.request.rst:793 +#: ../../library/urllib.request.rst:805 msgid "" "Arguments, return values and exceptions raised should be the same as for :" "meth:`~BaseHandler.http_error_default`." msgstr "" -#: ../../library/urllib.request.rst:801 +#: ../../library/urllib.request.rst:813 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to pre-process requests of the given protocol." msgstr "" -#: ../../library/urllib.request.rst:804 +#: ../../library/urllib.request.rst:816 msgid "" "This method, if defined, will be called by the parent :class:" "`OpenerDirector`. *req* will be a :class:`Request` object. The return value " "should be a :class:`Request` object." msgstr "" -#: ../../library/urllib.request.rst:813 +#: ../../library/urllib.request.rst:825 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to post-process responses of the given protocol." msgstr "" -#: ../../library/urllib.request.rst:816 +#: ../../library/urllib.request.rst:828 msgid "" "This method, if defined, will be called by the parent :class:" "`OpenerDirector`. *req* will be a :class:`Request` object. *response* will " @@ -1117,25 +1136,25 @@ msgid "" "return value of :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:826 +#: ../../library/urllib.request.rst:838 msgid "HTTPRedirectHandler Objects" msgstr "HTTPRedirectHandler 物件" -#: ../../library/urllib.request.rst:830 +#: ../../library/urllib.request.rst:842 msgid "" "Some HTTP redirections require action from this module's client code. If " "this is the case, :exc:`~urllib.error.HTTPError` is raised. See :rfc:`2616` " "for details of the precise meanings of the various redirection codes." msgstr "" -#: ../../library/urllib.request.rst:834 +#: ../../library/urllib.request.rst:846 msgid "" "An :exc:`~urllib.error.HTTPError` exception raised as a security " "consideration if the HTTPRedirectHandler is presented with a redirected URL " "which is not an HTTP, HTTPS or FTP URL." msgstr "" -#: ../../library/urllib.request.rst:841 +#: ../../library/urllib.request.rst:853 msgid "" "Return a :class:`Request` or ``None`` in response to a redirect. This is " "called by the default implementations of the :meth:`!http_error_30\\*` " @@ -1146,7 +1165,7 @@ msgid "" "URL, or return ``None`` if you can't but another handler might." msgstr "" -#: ../../library/urllib.request.rst:851 +#: ../../library/urllib.request.rst:863 msgid "" "The default implementation of this method does not strictly follow :rfc:" "`2616`, which says that 301 and 302 responses to ``POST`` requests must not " @@ -1155,54 +1174,54 @@ msgid "" "POST to a ``GET``, and the default implementation reproduces this behavior." msgstr "" -#: ../../library/urllib.request.rst:860 +#: ../../library/urllib.request.rst:872 msgid "" "Redirect to the ``Location:`` or ``URI:`` URL. This method is called by the " "parent :class:`OpenerDirector` when getting an HTTP 'moved permanently' " "response." msgstr "" -#: ../../library/urllib.request.rst:866 +#: ../../library/urllib.request.rst:878 msgid "" "The same as :meth:`http_error_301`, but called for the 'found' response." msgstr "" -#: ../../library/urllib.request.rst:871 +#: ../../library/urllib.request.rst:883 msgid "" "The same as :meth:`http_error_301`, but called for the 'see other' response." msgstr "" -#: ../../library/urllib.request.rst:876 +#: ../../library/urllib.request.rst:888 msgid "" "The same as :meth:`http_error_301`, but called for the 'temporary redirect' " "response. It does not allow changing the request method from ``POST`` to " "``GET``." msgstr "" -#: ../../library/urllib.request.rst:883 +#: ../../library/urllib.request.rst:895 msgid "" "The same as :meth:`http_error_301`, but called for the 'permanent redirect' " "response. It does not allow changing the request method from ``POST`` to " "``GET``." msgstr "" -#: ../../library/urllib.request.rst:893 +#: ../../library/urllib.request.rst:905 msgid "HTTPCookieProcessor Objects" msgstr "HTTPCookieProcessor 物件" -#: ../../library/urllib.request.rst:895 +#: ../../library/urllib.request.rst:907 msgid ":class:`HTTPCookieProcessor` instances have one attribute:" msgstr "" -#: ../../library/urllib.request.rst:899 +#: ../../library/urllib.request.rst:911 msgid "The :class:`http.cookiejar.CookieJar` in which cookies are stored." msgstr "" -#: ../../library/urllib.request.rst:905 +#: ../../library/urllib.request.rst:917 msgid "ProxyHandler Objects" msgstr "ProxyHandler 物件" -#: ../../library/urllib.request.rst:911 +#: ../../library/urllib.request.rst:923 msgid "" "The :class:`ProxyHandler` will have a method :meth:`!_open` for " "every *protocol* which has a proxy in the *proxies* dictionary given in the " @@ -1211,17 +1230,17 @@ msgid "" "actually execute the protocol." msgstr "" -#: ../../library/urllib.request.rst:921 +#: ../../library/urllib.request.rst:933 msgid "HTTPPasswordMgr Objects" msgstr "HTTPPasswordMgr 物件" -#: ../../library/urllib.request.rst:923 +#: ../../library/urllib.request.rst:935 msgid "" "These methods are available on :class:`HTTPPasswordMgr` and :class:" "`HTTPPasswordMgrWithDefaultRealm` objects." msgstr "" -#: ../../library/urllib.request.rst:929 +#: ../../library/urllib.request.rst:941 msgid "" "*uri* can be either a single URI, or a sequence of URIs. *realm*, *user* and " "*passwd* must be strings. This causes ``(user, passwd)`` to be used as " @@ -1229,30 +1248,30 @@ msgid "" "of the given URIs is given." msgstr "" -#: ../../library/urllib.request.rst:937 +#: ../../library/urllib.request.rst:949 msgid "" "Get user/password for given realm and URI, if any. This method will return " "``(None, None)`` if there is no matching user/password." msgstr "" -#: ../../library/urllib.request.rst:940 +#: ../../library/urllib.request.rst:952 msgid "" "For :class:`HTTPPasswordMgrWithDefaultRealm` objects, the realm ``None`` " "will be searched if the given *realm* has no matching user/password." msgstr "" -#: ../../library/urllib.request.rst:947 +#: ../../library/urllib.request.rst:959 msgid "HTTPPasswordMgrWithPriorAuth Objects" msgstr "HTTPPasswordMgrWithPriorAuth 物件" -#: ../../library/urllib.request.rst:949 +#: ../../library/urllib.request.rst:961 msgid "" "This password manager extends :class:`HTTPPasswordMgrWithDefaultRealm` to " "support tracking URIs for which authentication credentials should always be " "sent." msgstr "" -#: ../../library/urllib.request.rst:956 +#: ../../library/urllib.request.rst:968 msgid "" "*realm*, *uri*, *user*, *passwd* are as for :meth:`HTTPPasswordMgr." "add_password`. *is_authenticated* sets the initial value of the " @@ -1260,25 +1279,25 @@ msgid "" "*is_authenticated* is specified as ``True``, *realm* is ignored." msgstr "" -#: ../../library/urllib.request.rst:964 +#: ../../library/urllib.request.rst:976 msgid "Same as for :class:`HTTPPasswordMgrWithDefaultRealm` objects" msgstr "" -#: ../../library/urllib.request.rst:970 +#: ../../library/urllib.request.rst:982 msgid "" "Update the ``is_authenticated`` flag for the given *uri* or list of URIs." msgstr "" -#: ../../library/urllib.request.rst:976 +#: ../../library/urllib.request.rst:988 msgid "" "Returns the current state of the ``is_authenticated`` flag for the given URI." msgstr "" -#: ../../library/urllib.request.rst:983 +#: ../../library/urllib.request.rst:995 msgid "AbstractBasicAuthHandler Objects" msgstr "AbstractBasicAuthHandler 物件" -#: ../../library/urllib.request.rst:988 +#: ../../library/urllib.request.rst:1000 msgid "" "Handle an authentication request by getting a user/password pair, and re-" "trying the request. *authreq* should be the name of the header where the " @@ -1287,7 +1306,7 @@ msgid "" "`Request` object, and *headers* should be the error headers." msgstr "" -#: ../../library/urllib.request.rst:994 +#: ../../library/urllib.request.rst:1006 msgid "" "*host* is either an authority (e.g. ``\"python.org\"``) or a URL containing " "an authority component (e.g. ``\"http://python.org//"``). In either case, " @@ -1295,24 +1314,24 @@ msgid "" "and ``\"python.org:80\"`` are fine, ``\"joe:password@python.org\"`` is not)." msgstr "" -#: ../../library/urllib.request.rst:1003 +#: ../../library/urllib.request.rst:1015 msgid "HTTPBasicAuthHandler Objects" msgstr "HTTPBasicAuthHandler 物件" -#: ../../library/urllib.request.rst:1008 ../../library/urllib.request.rst:1019 -#: ../../library/urllib.request.rst:1044 ../../library/urllib.request.rst:1055 +#: ../../library/urllib.request.rst:1020 ../../library/urllib.request.rst:1031 +#: ../../library/urllib.request.rst:1056 ../../library/urllib.request.rst:1067 msgid "Retry the request with authentication information, if available." msgstr "" -#: ../../library/urllib.request.rst:1014 +#: ../../library/urllib.request.rst:1026 msgid "ProxyBasicAuthHandler Objects" msgstr "ProxyBasicAuthHandler 物件" -#: ../../library/urllib.request.rst:1025 +#: ../../library/urllib.request.rst:1037 msgid "AbstractDigestAuthHandler Objects" msgstr "AbstractDigestAuthHandler 物件" -#: ../../library/urllib.request.rst:1030 +#: ../../library/urllib.request.rst:1042 msgid "" "*authreq* should be the name of the header where the information about the " "realm is included in the request, *host* should be the host to authenticate " @@ -1320,55 +1339,55 @@ msgid "" "should be the error headers." msgstr "" -#: ../../library/urllib.request.rst:1039 +#: ../../library/urllib.request.rst:1051 msgid "HTTPDigestAuthHandler Objects" msgstr "HTTPDigestAuthHandler 物件" -#: ../../library/urllib.request.rst:1050 +#: ../../library/urllib.request.rst:1062 msgid "ProxyDigestAuthHandler Objects" msgstr "ProxyDigestAuthHandler 物件" -#: ../../library/urllib.request.rst:1061 +#: ../../library/urllib.request.rst:1073 msgid "HTTPHandler Objects" msgstr "HTTPHandler 物件" -#: ../../library/urllib.request.rst:1066 +#: ../../library/urllib.request.rst:1078 msgid "" "Send an HTTP request, which can be either GET or POST, depending on ``req." "has_data()``." msgstr "" -#: ../../library/urllib.request.rst:1073 +#: ../../library/urllib.request.rst:1085 msgid "HTTPSHandler Objects" msgstr "HTTPSHandler 物件" -#: ../../library/urllib.request.rst:1078 +#: ../../library/urllib.request.rst:1090 msgid "" "Send an HTTPS request, which can be either GET or POST, depending on ``req." "has_data()``." msgstr "" -#: ../../library/urllib.request.rst:1085 +#: ../../library/urllib.request.rst:1097 msgid "FileHandler Objects" msgstr "FileHandler 物件" -#: ../../library/urllib.request.rst:1090 +#: ../../library/urllib.request.rst:1102 msgid "" "Open the file locally, if there is no host name, or the host name is " "``'localhost'``." msgstr "" -#: ../../library/urllib.request.rst:1093 +#: ../../library/urllib.request.rst:1105 msgid "" "This method is applicable only for local hostnames. When a remote hostname " "is given, a :exc:`~urllib.error.URLError` is raised." msgstr "" -#: ../../library/urllib.request.rst:1101 +#: ../../library/urllib.request.rst:1113 msgid "DataHandler Objects" msgstr "DataHandler 物件" -#: ../../library/urllib.request.rst:1105 +#: ../../library/urllib.request.rst:1117 msgid "" "Read a data URL. This kind of URL contains the content encoded in the URL " "itself. The data URL syntax is specified in :rfc:`2397`. This implementation " @@ -1378,51 +1397,51 @@ msgid "" "implementation will raise a :exc:`ValueError` in that case." msgstr "" -#: ../../library/urllib.request.rst:1116 +#: ../../library/urllib.request.rst:1128 msgid "FTPHandler Objects" msgstr "FTPHandler 物件" -#: ../../library/urllib.request.rst:1121 +#: ../../library/urllib.request.rst:1133 msgid "" "Open the FTP file indicated by *req*. The login is always done with empty " "username and password." msgstr "" -#: ../../library/urllib.request.rst:1128 +#: ../../library/urllib.request.rst:1140 msgid "CacheFTPHandler Objects" msgstr "CacheFTPHandler 物件" -#: ../../library/urllib.request.rst:1130 +#: ../../library/urllib.request.rst:1142 msgid "" ":class:`CacheFTPHandler` objects are :class:`FTPHandler` objects with the " "following additional methods:" msgstr "" -#: ../../library/urllib.request.rst:1136 +#: ../../library/urllib.request.rst:1148 msgid "Set timeout of connections to *t* seconds." msgstr "" -#: ../../library/urllib.request.rst:1141 +#: ../../library/urllib.request.rst:1153 msgid "Set maximum number of cached connections to *m*." msgstr "" -#: ../../library/urllib.request.rst:1147 +#: ../../library/urllib.request.rst:1159 msgid "UnknownHandler Objects" msgstr "UnknownHandler 物件" -#: ../../library/urllib.request.rst:1152 +#: ../../library/urllib.request.rst:1164 msgid "Raise a :exc:`~urllib.error.URLError` exception." msgstr "" -#: ../../library/urllib.request.rst:1158 +#: ../../library/urllib.request.rst:1170 msgid "HTTPErrorProcessor Objects" msgstr "HTTPErrorProcessor 物件" -#: ../../library/urllib.request.rst:1164 +#: ../../library/urllib.request.rst:1176 msgid "For 200 error codes, the response object is returned immediately." msgstr "" -#: ../../library/urllib.request.rst:1166 +#: ../../library/urllib.request.rst:1178 msgid "" "For non-200 error codes, this simply passes the job on to the :meth:`!" "http_error_\\` handler methods, via :meth:`OpenerDirector.error`. " @@ -1430,31 +1449,31 @@ msgid "" "error.HTTPError` if no other handler handles the error." msgstr "" -#: ../../library/urllib.request.rst:1174 +#: ../../library/urllib.request.rst:1186 msgid "Process HTTPS error responses." msgstr "" -#: ../../library/urllib.request.rst:1176 +#: ../../library/urllib.request.rst:1188 msgid "The behavior is same as :meth:`http_response`." msgstr "" -#: ../../library/urllib.request.rst:1182 +#: ../../library/urllib.request.rst:1194 msgid "Examples" msgstr "範例" -#: ../../library/urllib.request.rst:1184 +#: ../../library/urllib.request.rst:1196 msgid "" "In addition to the examples below, more examples are given in :ref:`urllib-" "howto`." msgstr "" -#: ../../library/urllib.request.rst:1187 +#: ../../library/urllib.request.rst:1199 msgid "" "This example gets the python.org main page and displays the first 300 bytes " "of it. ::" msgstr "" -#: ../../library/urllib.request.rst:1190 +#: ../../library/urllib.request.rst:1202 msgid "" ">>> import urllib.request\n" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" @@ -1480,7 +1499,7 @@ msgstr "" ">\\n\n" "Python Programming '" -#: ../../library/urllib.request.rst:1200 +#: ../../library/urllib.request.rst:1212 msgid "" "Note that urlopen returns a bytes object. This is because there is no way " "for urlopen to automatically determine the encoding of the byte stream it " @@ -1489,20 +1508,20 @@ msgid "" "appropriate encoding." msgstr "" -#: ../../library/urllib.request.rst:1206 +#: ../../library/urllib.request.rst:1218 msgid "" "The following W3C document, https://www.w3.org/International/O-charset\\ , " "lists the various ways in which an (X)HTML or an XML document could have " "specified its encoding information." msgstr "" -#: ../../library/urllib.request.rst:1210 +#: ../../library/urllib.request.rst:1222 msgid "" "As the python.org website uses *utf-8* encoding as specified in its meta " "tag, we will use the same for decoding the bytes object. ::" msgstr "" -#: ../../library/urllib.request.rst:1213 +#: ../../library/urllib.request.rst:1225 msgid "" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" "... print(f.read(100).decode('utf-8'))\n" @@ -1516,13 +1535,13 @@ msgstr "" "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" "\"http://www.w3.org/TR/xhtml1/DTD/xhtm" -#: ../../library/urllib.request.rst:1219 +#: ../../library/urllib.request.rst:1231 msgid "" "It is also possible to achieve the same result without using the :term:" "`context manager` approach. ::" msgstr "" -#: ../../library/urllib.request.rst:1222 +#: ../../library/urllib.request.rst:1234 msgid "" ">>> import urllib.request\n" ">>> f = urllib.request.urlopen('http://www.python.org/')\n" @@ -1536,14 +1555,14 @@ msgstr "" "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" "\"http://www.w3.org/TR/xhtml1/DTD/xhtm" -#: ../../library/urllib.request.rst:1228 +#: ../../library/urllib.request.rst:1240 msgid "" "In the following example, we are sending a data-stream to the stdin of a CGI " "and reading the data it returns to us. Note that this example will only work " "when the Python installation supports SSL. ::" msgstr "" -#: ../../library/urllib.request.rst:1232 +#: ../../library/urllib.request.rst:1244 msgid "" ">>> import urllib.request\n" ">>> req = urllib.request.Request(url='https://localhost/cgi-bin/test.cgi',\n" @@ -1554,11 +1573,11 @@ msgid "" "Got Data: \"This data is passed to stdin of the CGI\"" msgstr "" -#: ../../library/urllib.request.rst:1240 +#: ../../library/urllib.request.rst:1252 msgid "The code for the sample CGI used in the above example is::" msgstr "" -#: ../../library/urllib.request.rst:1242 +#: ../../library/urllib.request.rst:1254 msgid "" "#!/usr/bin/env python\n" "import sys\n" @@ -1570,11 +1589,11 @@ msgstr "" "data = sys.stdin.read()\n" "print('Content-type: text/plain\\n\\nGot Data: \"%s\"' % data)" -#: ../../library/urllib.request.rst:1247 +#: ../../library/urllib.request.rst:1259 msgid "Here is an example of doing a ``PUT`` request using :class:`Request`::" msgstr "" -#: ../../library/urllib.request.rst:1249 +#: ../../library/urllib.request.rst:1261 msgid "" "import urllib.request\n" "DATA = b'some data'\n" @@ -1594,11 +1613,11 @@ msgstr "" "print(f.status)\n" "print(f.reason)" -#: ../../library/urllib.request.rst:1257 +#: ../../library/urllib.request.rst:1269 msgid "Use of Basic HTTP Authentication::" msgstr "" -#: ../../library/urllib.request.rst:1259 +#: ../../library/urllib.request.rst:1271 msgid "" "import urllib.request\n" "# Create an OpenerDirector with support for Basic HTTP Authentication...\n" @@ -1613,7 +1632,7 @@ msgid "" "urllib.request.urlopen('http://www.example.com/login.html')" msgstr "" -#: ../../library/urllib.request.rst:1271 +#: ../../library/urllib.request.rst:1283 msgid "" ":func:`build_opener` provides many handlers by default, including a :class:" "`ProxyHandler`. By default, :class:`ProxyHandler` uses the environment " @@ -1622,14 +1641,14 @@ msgid "" "read to obtain the HTTP proxy's URL." msgstr "" -#: ../../library/urllib.request.rst:1277 +#: ../../library/urllib.request.rst:1289 msgid "" "This example replaces the default :class:`ProxyHandler` with one that uses " "programmatically supplied proxy URLs, and adds proxy authorization support " "with :class:`ProxyBasicAuthHandler`. ::" msgstr "" -#: ../../library/urllib.request.rst:1281 +#: ../../library/urllib.request.rst:1293 msgid "" "proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example./" "com:3128/'})\n" @@ -1649,15 +1668,15 @@ msgstr "" "# 這次我們直接使用它而不安裝 OpenerDirector:\n" "opener.open('http://www.example.com/login.html')" -#: ../../library/urllib.request.rst:1289 +#: ../../library/urllib.request.rst:1301 msgid "Adding HTTP headers:" msgstr "" -#: ../../library/urllib.request.rst:1291 +#: ../../library/urllib.request.rst:1303 msgid "Use the *headers* argument to the :class:`Request` constructor, or::" msgstr "" -#: ../../library/urllib.request.rst:1293 +#: ../../library/urllib.request.rst:1305 msgid "" "import urllib.request\n" "req = urllib.request.Request('http://www.example.com/')\n" @@ -1673,13 +1692,13 @@ msgstr "" "req.add_header('User-Agent', 'urllib-example/0.1 (Contact: . . .)')\n" "r = urllib.request.urlopen(req)" -#: ../../library/urllib.request.rst:1300 +#: ../../library/urllib.request.rst:1312 msgid "" ":class:`OpenerDirector` automatically adds a :mailheader:`User-Agent` header " "to every :class:`Request`. To change this::" msgstr "" -#: ../../library/urllib.request.rst:1303 +#: ../../library/urllib.request.rst:1315 msgid "" "import urllib.request\n" "opener = urllib.request.build_opener()\n" @@ -1691,20 +1710,20 @@ msgstr "" "opener.addheaders = [('User-agent', 'Mozilla/5.0')]\n" "opener.open('http://www.example.com/')" -#: ../../library/urllib.request.rst:1308 +#: ../../library/urllib.request.rst:1320 msgid "" "Also, remember that a few standard headers (:mailheader:`Content-Length`, :" "mailheader:`Content-Type` and :mailheader:`Host`) are added when the :class:" "`Request` is passed to :func:`urlopen` (or :meth:`OpenerDirector.open`)." msgstr "" -#: ../../library/urllib.request.rst:1315 +#: ../../library/urllib.request.rst:1327 msgid "" "Here is an example session that uses the ``GET`` method to retrieve a URL " "containing parameters::" msgstr "" -#: ../../library/urllib.request.rst:1318 +#: ../../library/urllib.request.rst:1330 msgid "" ">>> import urllib.request\n" ">>> import urllib.parse\n" @@ -1722,14 +1741,14 @@ msgstr "" "... print(f.read().decode('utf-8'))\n" "..." -#: ../../library/urllib.request.rst:1326 +#: ../../library/urllib.request.rst:1338 msgid "" "The following example uses the ``POST`` method instead. Note that params " "output from urlencode is encoded to bytes before it is sent to urlopen as " "data::" msgstr "" -#: ../../library/urllib.request.rst:1329 +#: ../../library/urllib.request.rst:1341 msgid "" ">>> import urllib.request\n" ">>> import urllib.parse\n" @@ -1749,13 +1768,13 @@ msgstr "" "... print(f.read().decode('utf-8'))\n" "..." -#: ../../library/urllib.request.rst:1337 +#: ../../library/urllib.request.rst:1349 msgid "" "The following example uses an explicitly specified HTTP proxy, overriding " "environment settings::" msgstr "" -#: ../../library/urllib.request.rst:1340 +#: ../../library/urllib.request.rst:1352 msgid "" ">>> import urllib.request\n" ">>> proxies = {'http': 'http://proxy.example.com:8080/'}\n" @@ -1771,13 +1790,13 @@ msgstr "" "... f.read().decode('utf-8')\n" "..." -#: ../../library/urllib.request.rst:1347 +#: ../../library/urllib.request.rst:1359 msgid "" "The following example uses no proxies at all, overriding environment " "settings::" msgstr "" -#: ../../library/urllib.request.rst:1349 +#: ../../library/urllib.request.rst:1361 msgid "" ">>> import urllib.request\n" ">>> opener = urllib.request.FancyURLopener({})\n" @@ -1791,18 +1810,18 @@ msgstr "" "... f.read().decode('utf-8')\n" "..." -#: ../../library/urllib.request.rst:1357 +#: ../../library/urllib.request.rst:1369 msgid "Legacy interface" msgstr "" -#: ../../library/urllib.request.rst:1359 +#: ../../library/urllib.request.rst:1371 msgid "" "The following functions and classes are ported from the Python 2 module " "``urllib`` (as opposed to ``urllib2``). They might become deprecated at " "some point in the future." msgstr "" -#: ../../library/urllib.request.rst:1365 +#: ../../library/urllib.request.rst:1377 msgid "" "Copy a network object denoted by a URL to a local file. If the URL points to " "a local file, the object will not be copied unless filename is supplied. " @@ -1812,7 +1831,7 @@ msgid "" "a remote object). Exceptions are the same as for :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:1372 +#: ../../library/urllib.request.rst:1384 msgid "" "The second argument, if present, specifies the file location to copy to (if " "absent, the location will be a tempfile with a generated name). The third " @@ -1824,11 +1843,11 @@ msgid "" "file size in response to a retrieval request." msgstr "" -#: ../../library/urllib.request.rst:1381 +#: ../../library/urllib.request.rst:1393 msgid "The following example illustrates the most common usage scenario::" msgstr "" -#: ../../library/urllib.request.rst:1383 +#: ../../library/urllib.request.rst:1395 msgid "" ">>> import urllib.request\n" ">>> local_filename, headers = urllib.request.urlretrieve('http://python./" @@ -1842,7 +1861,7 @@ msgstr "" ">>> html = open(local_filename)\n" ">>> html.close()" -#: ../../library/urllib.request.rst:1388 +#: ../../library/urllib.request.rst:1400 msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " @@ -1851,7 +1870,7 @@ msgid "" "parse.urlencode` function." msgstr "" -#: ../../library/urllib.request.rst:1394 +#: ../../library/urllib.request.rst:1406 msgid "" ":func:`urlretrieve` will raise :exc:`~urllib.error.ContentTooShortError` " "when it detects that the amount of data available was less than the " @@ -1859,40 +1878,40 @@ msgid "" "This can occur, for example, when the download is interrupted." msgstr "" -#: ../../library/urllib.request.rst:1399 +#: ../../library/urllib.request.rst:1411 msgid "" "The *Content-Length* is treated as a lower bound: if there's more data to " "read, urlretrieve reads more data, but if less data is available, it raises " "the exception." msgstr "" -#: ../../library/urllib.request.rst:1403 +#: ../../library/urllib.request.rst:1415 msgid "" "You can still retrieve the downloaded data in this case, it is stored in " "the :attr:`!content` attribute of the exception instance." msgstr "" -#: ../../library/urllib.request.rst:1406 +#: ../../library/urllib.request.rst:1418 msgid "" "If no *Content-Length* header was supplied, urlretrieve can not check the " "size of the data it has downloaded, and just returns it. In this case you " "just have to assume that the download was successful." msgstr "" -#: ../../library/urllib.request.rst:1412 +#: ../../library/urllib.request.rst:1424 msgid "" "Cleans up temporary files that may have been left behind by previous calls " "to :func:`urlretrieve`." msgstr "" -#: ../../library/urllib.request.rst:1419 +#: ../../library/urllib.request.rst:1431 msgid "" "Base class for opening and reading URLs. Unless you need to support opening " "objects using schemes other than :file:`http:`, :file:`ftp:`, or :file:`file:" "`, you probably want to use :class:`FancyURLopener`." msgstr "" -#: ../../library/urllib.request.rst:1423 +#: ../../library/urllib.request.rst:1435 msgid "" "By default, the :class:`URLopener` class sends a :mailheader:`User-Agent` " "header of ``urllib/VVV``, where *VVV* is the :mod:`urllib` version number. " @@ -1902,7 +1921,7 @@ msgid "" "subclass definition." msgstr "" -#: ../../library/urllib.request.rst:1429 +#: ../../library/urllib.request.rst:1441 msgid "" "The optional *proxies* parameter should be a dictionary mapping scheme names " "to proxy URLs, where an empty dictionary turns proxies off completely. Its " @@ -1910,7 +1929,7 @@ msgid "" "be used if present, as discussed in the definition of :func:`urlopen`, above." msgstr "" -#: ../../library/urllib.request.rst:1434 +#: ../../library/urllib.request.rst:1446 msgid "" "Additional keyword parameters, collected in *x509*, may be used for " "authentication of the client when using the :file:`https:` scheme. The " @@ -1918,13 +1937,13 @@ msgid "" "certificate; both are needed to support client authentication." msgstr "" -#: ../../library/urllib.request.rst:1439 +#: ../../library/urllib.request.rst:1451 msgid "" ":class:`URLopener` objects will raise an :exc:`OSError` exception if the " "server returns an error code." msgstr "" -#: ../../library/urllib.request.rst:1444 +#: ../../library/urllib.request.rst:1456 msgid "" "Open *fullurl* using the appropriate protocol. This method sets up cache " "and proxy information, then calls the appropriate open method with its input " @@ -1933,15 +1952,15 @@ msgid "" "`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:1450 +#: ../../library/urllib.request.rst:1462 msgid "This method always quotes *fullurl* using :func:`~urllib.parse.quote`." msgstr "" -#: ../../library/urllib.request.rst:1454 +#: ../../library/urllib.request.rst:1466 msgid "Overridable interface to open unknown URL types." msgstr "" -#: ../../library/urllib.request.rst:1459 +#: ../../library/urllib.request.rst:1471 msgid "" "Retrieves the contents of *url* and places it in *filename*. The return " "value is a tuple consisting of a local filename and either an :class:`email." @@ -1958,7 +1977,7 @@ msgid "" "*reporthook* is ignored for local URLs." msgstr "" -#: ../../library/urllib.request.rst:1472 +#: ../../library/urllib.request.rst:1484 msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " @@ -1967,7 +1986,7 @@ msgid "" "urlencode` function." msgstr "" -#: ../../library/urllib.request.rst:1481 +#: ../../library/urllib.request.rst:1493 msgid "" "Variable that specifies the user agent of the opener object. To get :mod:" "`urllib` to tell servers that it is a particular user agent, set this in a " @@ -1975,7 +1994,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/urllib.request.rst:1491 +#: ../../library/urllib.request.rst:1503 msgid "" ":class:`FancyURLopener` subclasses :class:`URLopener` providing default " "handling for the following HTTP response codes: 301, 302, 303, 307 and 401. " @@ -1986,14 +2005,14 @@ msgid "" "defaults to 10." msgstr "" -#: ../../library/urllib.request.rst:1498 +#: ../../library/urllib.request.rst:1510 msgid "" "For all other response codes, the method :meth:`~BaseHandler." "http_error_default` is called which you can override in subclasses to handle " "the error appropriately." msgstr "" -#: ../../library/urllib.request.rst:1503 +#: ../../library/urllib.request.rst:1515 msgid "" "According to the letter of :rfc:`2616`, 301 and 302 responses to POST " "requests must not be automatically redirected without confirmation by the " @@ -2002,13 +2021,13 @@ msgid "" "behaviour." msgstr "" -#: ../../library/urllib.request.rst:1508 +#: ../../library/urllib.request.rst:1520 msgid "" "The parameters to the constructor are the same as those for :class:" "`URLopener`." msgstr "" -#: ../../library/urllib.request.rst:1512 +#: ../../library/urllib.request.rst:1524 msgid "" "When performing basic authentication, a :class:`FancyURLopener` instance " "calls its :meth:`prompt_user_passwd` method. The default implementation " @@ -2017,59 +2036,59 @@ msgid "" "needed." msgstr "" -#: ../../library/urllib.request.rst:1517 +#: ../../library/urllib.request.rst:1529 msgid "" "The :class:`FancyURLopener` class offers one additional method that should " "be overloaded to provide the appropriate behavior:" msgstr "" -#: ../../library/urllib.request.rst:1522 +#: ../../library/urllib.request.rst:1534 msgid "" "Return information needed to authenticate the user at the given host in the " "specified security realm. The return value should be a tuple, ``(user, " "password)``, which can be used for basic authentication." msgstr "" -#: ../../library/urllib.request.rst:1526 +#: ../../library/urllib.request.rst:1538 msgid "" "The implementation prompts for this information on the terminal; an " "application should override this method to use an appropriate interaction " "model in the local environment." msgstr "" -#: ../../library/urllib.request.rst:1532 +#: ../../library/urllib.request.rst:1544 msgid ":mod:`urllib.request` Restrictions" msgstr "" -#: ../../library/urllib.request.rst:1538 +#: ../../library/urllib.request.rst:1550 msgid "" "Currently, only the following protocols are supported: HTTP (versions 0.9 " "and 1.0), FTP, local files, and data URLs." msgstr "" -#: ../../library/urllib.request.rst:1541 +#: ../../library/urllib.request.rst:1553 msgid "Added support for data URLs." msgstr "" -#: ../../library/urllib.request.rst:1543 +#: ../../library/urllib.request.rst:1555 msgid "" "The caching feature of :func:`urlretrieve` has been disabled until someone " "finds the time to hack proper processing of Expiration time headers." msgstr "" -#: ../../library/urllib.request.rst:1546 +#: ../../library/urllib.request.rst:1558 msgid "" "There should be a function to query whether a particular URL is in the cache." msgstr "" -#: ../../library/urllib.request.rst:1548 +#: ../../library/urllib.request.rst:1560 msgid "" "For backward compatibility, if a URL appears to point to a local file but " "the file can't be opened, the URL is re-interpreted using the FTP protocol. " "This can sometimes cause confusing error messages." msgstr "" -#: ../../library/urllib.request.rst:1552 +#: ../../library/urllib.request.rst:1564 msgid "" "The :func:`urlopen` and :func:`urlretrieve` functions can cause arbitrarily " "long delays while waiting for a network connection to be set up. This means " @@ -2077,7 +2096,7 @@ msgid "" "functions without using threads." msgstr "" -#: ../../library/urllib.request.rst:1561 +#: ../../library/urllib.request.rst:1573 msgid "" "The data returned by :func:`urlopen` or :func:`urlretrieve` is the raw data " "returned by the server. This may be binary data (such as an image), plain " @@ -2087,7 +2106,7 @@ msgid "" "module :mod:`html.parser` to parse it." msgstr "" -#: ../../library/urllib.request.rst:1570 +#: ../../library/urllib.request.rst:1582 msgid "" "The code handling the FTP protocol cannot differentiate between a file and a " "directory. This can lead to unexpected behavior when attempting to read a " @@ -2105,11 +2124,11 @@ msgid "" "meet your needs." msgstr "" -#: ../../library/urllib.request.rst:1587 +#: ../../library/urllib.request.rst:1599 msgid ":mod:`urllib.response` --- Response classes used by urllib" msgstr "" -#: ../../library/urllib.request.rst:1592 +#: ../../library/urllib.request.rst:1604 msgid "" "The :mod:`urllib.response` module defines functions and classes which define " "a minimal file-like interface, including ``read()`` and ``readline()``. " @@ -2118,46 +2137,46 @@ msgid "" "addinfourl` instance:" msgstr "" -#: ../../library/urllib.request.rst:1601 +#: ../../library/urllib.request.rst:1613 msgid "" "URL of the resource retrieved, commonly used to determine if a redirect was " "followed." msgstr "" -#: ../../library/urllib.request.rst:1605 +#: ../../library/urllib.request.rst:1617 msgid "" "Returns the headers of the response in the form of an :class:`~email.message." "EmailMessage` instance." msgstr "" -#: ../../library/urllib.request.rst:1611 +#: ../../library/urllib.request.rst:1623 msgid "Status code returned by server." msgstr "" -#: ../../library/urllib.request.rst:1615 +#: ../../library/urllib.request.rst:1627 msgid "Deprecated in favor of :attr:`~addinfourl.url`." msgstr "" -#: ../../library/urllib.request.rst:1620 +#: ../../library/urllib.request.rst:1632 msgid "Deprecated in favor of :attr:`~addinfourl.headers`." msgstr "" -#: ../../library/urllib.request.rst:1625 ../../library/urllib.request.rst:1630 +#: ../../library/urllib.request.rst:1637 ../../library/urllib.request.rst:1642 msgid "Deprecated in favor of :attr:`~addinfourl.status`." msgstr "" -#: ../../library/urllib.request.rst:1534 ../../library/urllib.request.rst:1557 +#: ../../library/urllib.request.rst:1546 ../../library/urllib.request.rst:1569 msgid "HTTP" msgstr "HTTP" -#: ../../library/urllib.request.rst:1534 ../../library/urllib.request.rst:1557 +#: ../../library/urllib.request.rst:1546 ../../library/urllib.request.rst:1569 msgid "protocol" msgstr "protocol(協定)" -#: ../../library/urllib.request.rst:1534 ../../library/urllib.request.rst:1568 +#: ../../library/urllib.request.rst:1546 ../../library/urllib.request.rst:1580 msgid "FTP" msgstr "FTP" -#: ../../library/urllib.request.rst:1557 +#: ../../library/urllib.request.rst:1569 msgid "HTML" msgstr "HTML" diff --git a/library/uu.po b/library/uu.po new file mode 100644 index 0000000000..574b21d479 --- /dev/null +++ b/library/uu.po @@ -0,0 +1,39 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/uu.rst:2 +msgid ":mod:`!uu` --- Encode and decode uuencode files" +msgstr ":mod:`!uu` --- uuencode 檔案的編碼與解碼" + +#: ../../library/uu.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 <whatsnew313-pep594>` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 <whatsnew313-pep594>`。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/uu.rst:14 +msgid "" +"The last version of Python that provided the :mod:`!uu` module was `Python " +"3.12 <https://docs.python.org/3.12/library/uu.html>`_." +msgstr "" +"最後提供 :mod:`!uu` 模組的 Python 版本是 `Python 3.12 <https://docs.python." +"org/3.12/library/uu.html>`_。" diff --git a/library/xdrlib.po b/library/xdrlib.po new file mode 100644 index 0000000000..383e29047e --- /dev/null +++ b/library/xdrlib.po @@ -0,0 +1,40 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/xdrlib.rst:2 +msgid ":mod:`!xdrlib` --- Encode and decode XDR data" +msgstr ":mod:`!xdrlib` --- XDR 資料的編碼與解碼" + +#: ../../library/xdrlib.rst:10 +msgid "" +"This module is no longer part of the Python standard library. It was :ref:" +"`removed in Python 3.13 <whatsnew313-pep594>` after being deprecated in " +"Python 3.11. The removal was decided in :pep:`594`." +msgstr "" +"這個模組已不再是 Python 標準函式庫的一部分。它在 Python 3.11 中被棄用,並\\ :" +"ref:`已在 Python 3.13 中被移除 <whatsnew313-pep594>`。它的移除是在 :pep:" +"`594` 中決定的。" + +#: ../../library/xdrlib.rst:14 +msgid "" +"The last version of Python that provided the :mod:`!xdrlib` module was " +"`Python 3.12 <https://docs.python.org/3.12/library/xdrlib.html>`_." +msgstr "" +"最後提供 :mod:`!xdrlib` 模組的 Python 版本是 `Python 3.12 <https://docs." +"python.org/3.12/library/xdrlib.html>`_。" diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index db077dfd9a..6c12ef1f85 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-11-12 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -90,7 +90,7 @@ msgstr "" #: ../../reference/compound_stmts.rst:84 msgid "The :keyword:`!if` statement" -msgstr "" +msgstr ":keyword:`!if` 陳述式" #: ../../reference/compound_stmts.rst:92 msgid "The :keyword:`if` statement is used for conditional execution:" @@ -108,7 +108,7 @@ msgstr "" #: ../../reference/compound_stmts.rst:109 msgid "The :keyword:`!while` statement" -msgstr "" +msgstr ":keyword:`!while` 陳述式" #: ../../reference/compound_stmts.rst:117 msgid "" @@ -134,7 +134,7 @@ msgstr "" #: ../../reference/compound_stmts.rst:142 msgid "The :keyword:`!for` statement" -msgstr "" +msgstr ":keyword:`!for` 陳述式" #: ../../reference/compound_stmts.rst:153 msgid "" @@ -193,7 +193,7 @@ msgstr "" #: ../../reference/compound_stmts.rst:205 msgid "The :keyword:`!try` statement" -msgstr "" +msgstr ":keyword:`!try` 陳述式" #: ../../reference/compound_stmts.rst:215 msgid "" @@ -210,7 +210,7 @@ msgstr "" #: ../../reference/compound_stmts.rst:239 msgid ":keyword:`!except` clause" -msgstr "" +msgstr ":keyword:`!except` 子句" #: ../../reference/compound_stmts.rst:241 msgid "" @@ -433,7 +433,7 @@ msgstr "" #: ../../reference/compound_stmts.rst:399 msgid ":keyword:`!else` clause" -msgstr "" +msgstr ":keyword:`!else` 子句" #: ../../reference/compound_stmts.rst:401 msgid "" @@ -446,7 +446,7 @@ msgstr "" #: ../../reference/compound_stmts.rst:413 msgid ":keyword:`!finally` clause" -msgstr "" +msgstr ":keyword:`!finally` 子句" #: ../../reference/compound_stmts.rst:415 msgid "" @@ -532,7 +532,7 @@ msgstr "" #: ../../reference/compound_stmts.rst:469 msgid "The :keyword:`!with` statement" -msgstr "" +msgstr ":keyword:`!with` 陳述式" #: ../../reference/compound_stmts.rst:478 msgid "" @@ -610,10 +610,10 @@ msgid "" msgstr "" #: ../../reference/compound_stmts.rst:526 -#: ../../reference/compound_stmts.rst:1547 -#: ../../reference/compound_stmts.rst:1588 +#: ../../reference/compound_stmts.rst:1544 +#: ../../reference/compound_stmts.rst:1585 msgid "The following code::" -msgstr "" +msgstr "以下程式碼: ::" #: ../../reference/compound_stmts.rst:528 msgid "" @@ -624,10 +624,10 @@ msgstr "" " SUITE" #: ../../reference/compound_stmts.rst:531 -#: ../../reference/compound_stmts.rst:556 -#: ../../reference/compound_stmts.rst:1593 +#: ../../reference/compound_stmts.rst:553 +#: ../../reference/compound_stmts.rst:1590 msgid "is semantically equivalent to::" -msgstr "" +msgstr "在語義上等同於: ::" #: ../../reference/compound_stmts.rst:533 msgid "" @@ -635,43 +635,37 @@ msgid "" "enter = type(manager).__enter__\n" "exit = type(manager).__exit__\n" "value = enter(manager)\n" -"hit_except = False\n" "\n" "try:\n" " TARGET = value\n" " SUITE\n" "except:\n" -" hit_except = True\n" " if not exit(manager, *sys.exc_info()):\n" " raise\n" -"finally:\n" -" if not hit_except:\n" -" exit(manager, None, None, None)" +"else:\n" +" exit(manager, None, None, None)" msgstr "" "manager = (EXPRESSION)\n" "enter = type(manager).__enter__\n" "exit = type(manager).__exit__\n" "value = enter(manager)\n" -"hit_except = False\n" "\n" "try:\n" " TARGET = value\n" " SUITE\n" "except:\n" -" hit_except = True\n" " if not exit(manager, *sys.exc_info()):\n" " raise\n" -"finally:\n" -" if not hit_except:\n" -" exit(manager, None, None, None)" +"else:\n" +" exit(manager, None, None, None)" -#: ../../reference/compound_stmts.rst:550 +#: ../../reference/compound_stmts.rst:547 msgid "" "With more than one item, the context managers are processed as if multiple :" "keyword:`with` statements were nested::" msgstr "" -#: ../../reference/compound_stmts.rst:553 +#: ../../reference/compound_stmts.rst:550 msgid "" "with A() as a, B() as b:\n" " SUITE" @@ -679,7 +673,7 @@ msgstr "" "with A() as a, B() as b:\n" " SUITE" -#: ../../reference/compound_stmts.rst:558 +#: ../../reference/compound_stmts.rst:555 msgid "" "with A() as a:\n" " with B() as b:\n" @@ -689,13 +683,13 @@ msgstr "" " with B() as b:\n" " SUITE" -#: ../../reference/compound_stmts.rst:562 +#: ../../reference/compound_stmts.rst:559 msgid "" "You can also write multi-item context managers in multiple lines if the " "items are surrounded by parentheses. For example::" msgstr "" -#: ../../reference/compound_stmts.rst:565 +#: ../../reference/compound_stmts.rst:562 msgid "" "with (\n" " A() as a,\n" @@ -709,88 +703,88 @@ msgstr "" "):\n" " SUITE" -#: ../../reference/compound_stmts.rst:571 +#: ../../reference/compound_stmts.rst:568 msgid "Support for multiple context expressions." msgstr "" -#: ../../reference/compound_stmts.rst:574 +#: ../../reference/compound_stmts.rst:571 msgid "" "Support for using grouping parentheses to break the statement in multiple " "lines." msgstr "" -#: ../../reference/compound_stmts.rst:579 +#: ../../reference/compound_stmts.rst:576 msgid ":pep:`343` - The \"with\" statement" msgstr "" -#: ../../reference/compound_stmts.rst:580 +#: ../../reference/compound_stmts.rst:577 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/compound_stmts.rst:586 +#: ../../reference/compound_stmts.rst:583 msgid "The :keyword:`!match` statement" -msgstr "" +msgstr ":keyword:`!match` 陳述式" -#: ../../reference/compound_stmts.rst:600 +#: ../../reference/compound_stmts.rst:597 msgid "The match statement is used for pattern matching. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:609 +#: ../../reference/compound_stmts.rst:606 msgid "" "This section uses single quotes to denote :ref:`soft keywords <soft-" "keywords>`." msgstr "" -#: ../../reference/compound_stmts.rst:612 +#: ../../reference/compound_stmts.rst:609 msgid "" "Pattern matching takes a pattern as input (following ``case``) and a subject " "value (following ``match``). The pattern (which may contain subpatterns) is " "matched against the subject value. The outcomes are:" msgstr "" -#: ../../reference/compound_stmts.rst:616 +#: ../../reference/compound_stmts.rst:613 msgid "A match success or failure (also termed a pattern success or failure)." msgstr "" -#: ../../reference/compound_stmts.rst:618 +#: ../../reference/compound_stmts.rst:615 msgid "" "Possible binding of matched values to a name. The prerequisites for this " "are further discussed below." msgstr "" -#: ../../reference/compound_stmts.rst:621 +#: ../../reference/compound_stmts.rst:618 msgid "" "The ``match`` and ``case`` keywords are :ref:`soft keywords <soft-keywords>`." msgstr "" -#: ../../reference/compound_stmts.rst:625 -#: ../../reference/compound_stmts.rst:1182 +#: ../../reference/compound_stmts.rst:622 +#: ../../reference/compound_stmts.rst:1179 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: ../../reference/compound_stmts.rst:626 -#: ../../reference/compound_stmts.rst:1183 +#: ../../reference/compound_stmts.rst:623 +#: ../../reference/compound_stmts.rst:1180 msgid ":pep:`636` -- Structural Pattern Matching: Tutorial" msgstr "" -#: ../../reference/compound_stmts.rst:630 +#: ../../reference/compound_stmts.rst:627 msgid "Overview" msgstr "" -#: ../../reference/compound_stmts.rst:632 +#: ../../reference/compound_stmts.rst:629 msgid "Here's an overview of the logical flow of a match statement:" msgstr "" -#: ../../reference/compound_stmts.rst:635 +#: ../../reference/compound_stmts.rst:632 msgid "" "The subject expression ``subject_expr`` is evaluated and a resulting subject " "value obtained. If the subject expression contains a comma, a tuple is " "constructed using :ref:`the standard rules <typesseq-tuple>`." msgstr "" -#: ../../reference/compound_stmts.rst:639 +#: ../../reference/compound_stmts.rst:636 msgid "" "Each pattern in a ``case_block`` is attempted to match with the subject " "value. The specific rules for success or failure are described below. The " @@ -800,7 +794,7 @@ msgid "" "outlive the executed block and can be used after the match statement**." msgstr "" -#: ../../reference/compound_stmts.rst:648 +#: ../../reference/compound_stmts.rst:645 msgid "" "During failed pattern matches, some subpatterns may succeed. Do not rely on " "bindings being made for a failed match. Conversely, do not rely on " @@ -809,38 +803,38 @@ msgid "" "made to allow different implementations to add optimizations." msgstr "" -#: ../../reference/compound_stmts.rst:655 +#: ../../reference/compound_stmts.rst:652 msgid "" "If the pattern succeeds, the corresponding guard (if present) is evaluated. " "In this case all name bindings are guaranteed to have happened." msgstr "" -#: ../../reference/compound_stmts.rst:658 +#: ../../reference/compound_stmts.rst:655 msgid "" "If the guard evaluates as true or is missing, the ``block`` inside " "``case_block`` is executed." msgstr "" -#: ../../reference/compound_stmts.rst:661 +#: ../../reference/compound_stmts.rst:658 msgid "Otherwise, the next ``case_block`` is attempted as described above." msgstr "" -#: ../../reference/compound_stmts.rst:663 +#: ../../reference/compound_stmts.rst:660 msgid "If there are no further case blocks, the match statement is completed." msgstr "" -#: ../../reference/compound_stmts.rst:667 +#: ../../reference/compound_stmts.rst:664 msgid "" "Users should generally never rely on a pattern being evaluated. Depending " "on implementation, the interpreter may cache values or use other " "optimizations which skip repeated evaluations." msgstr "" -#: ../../reference/compound_stmts.rst:671 +#: ../../reference/compound_stmts.rst:668 msgid "A sample match statement::" msgstr "" -#: ../../reference/compound_stmts.rst:673 +#: ../../reference/compound_stmts.rst:670 msgid "" ">>> flag = False\n" ">>> match (100, 200):\n" @@ -856,56 +850,56 @@ msgid "" "Case 3, y: 200" msgstr "" -#: ../../reference/compound_stmts.rst:687 +#: ../../reference/compound_stmts.rst:684 msgid "" "In this case, ``if flag`` is a guard. Read more about that in the next " "section." msgstr "" -#: ../../reference/compound_stmts.rst:690 +#: ../../reference/compound_stmts.rst:687 msgid "Guards" msgstr "" -#: ../../reference/compound_stmts.rst:697 +#: ../../reference/compound_stmts.rst:694 msgid "" "A ``guard`` (which is part of the ``case``) must succeed for code inside the " "``case`` block to execute. It takes the form: :keyword:`if` followed by an " "expression." msgstr "" -#: ../../reference/compound_stmts.rst:702 +#: ../../reference/compound_stmts.rst:699 msgid "The logical flow of a ``case`` block with a ``guard`` follows:" msgstr "" -#: ../../reference/compound_stmts.rst:704 +#: ../../reference/compound_stmts.rst:701 msgid "" "Check that the pattern in the ``case`` block succeeded. If the pattern " "failed, the ``guard`` is not evaluated and the next ``case`` block is " "checked." msgstr "" -#: ../../reference/compound_stmts.rst:708 +#: ../../reference/compound_stmts.rst:705 msgid "If the pattern succeeded, evaluate the ``guard``." msgstr "" -#: ../../reference/compound_stmts.rst:710 +#: ../../reference/compound_stmts.rst:707 msgid "" "If the ``guard`` condition evaluates as true, the case block is selected." msgstr "" -#: ../../reference/compound_stmts.rst:713 +#: ../../reference/compound_stmts.rst:710 msgid "" "If the ``guard`` condition evaluates as false, the case block is not " "selected." msgstr "" -#: ../../reference/compound_stmts.rst:716 +#: ../../reference/compound_stmts.rst:713 msgid "" "If the ``guard`` raises an exception during evaluation, the exception " "bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:719 +#: ../../reference/compound_stmts.rst:716 msgid "" "Guards are allowed to have side effects as they are expressions. Guard " "evaluation must proceed from the first to the last case block, one at a " @@ -914,17 +908,17 @@ msgid "" "block is selected." msgstr "" -#: ../../reference/compound_stmts.rst:729 +#: ../../reference/compound_stmts.rst:726 msgid "Irrefutable Case Blocks" msgstr "" -#: ../../reference/compound_stmts.rst:733 +#: ../../reference/compound_stmts.rst:730 msgid "" "An irrefutable case block is a match-all case block. A match statement may " "have at most one irrefutable case block, and it must be last." msgstr "" -#: ../../reference/compound_stmts.rst:736 +#: ../../reference/compound_stmts.rst:733 msgid "" "A case block is considered irrefutable if it has no guard and its pattern is " "irrefutable. A pattern is considered irrefutable if we can prove from its " @@ -932,47 +926,47 @@ msgid "" "irrefutable:" msgstr "" -#: ../../reference/compound_stmts.rst:741 +#: ../../reference/compound_stmts.rst:738 msgid ":ref:`as-patterns` whose left-hand side is irrefutable" msgstr "" -#: ../../reference/compound_stmts.rst:743 +#: ../../reference/compound_stmts.rst:740 msgid ":ref:`or-patterns` containing at least one irrefutable pattern" msgstr "" -#: ../../reference/compound_stmts.rst:745 +#: ../../reference/compound_stmts.rst:742 msgid ":ref:`capture-patterns`" msgstr ":ref:`capture-patterns`" -#: ../../reference/compound_stmts.rst:747 +#: ../../reference/compound_stmts.rst:744 msgid ":ref:`wildcard-patterns`" msgstr ":ref:`wildcard-patterns`" -#: ../../reference/compound_stmts.rst:749 +#: ../../reference/compound_stmts.rst:746 msgid "parenthesized irrefutable patterns" msgstr "" -#: ../../reference/compound_stmts.rst:753 +#: ../../reference/compound_stmts.rst:750 msgid "Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:760 +#: ../../reference/compound_stmts.rst:757 msgid "This section uses grammar notations beyond standard EBNF:" msgstr "" -#: ../../reference/compound_stmts.rst:762 +#: ../../reference/compound_stmts.rst:759 msgid "the notation ``SEP.RULE+`` is shorthand for ``RULE (SEP RULE)*``" msgstr "" -#: ../../reference/compound_stmts.rst:764 +#: ../../reference/compound_stmts.rst:761 msgid "the notation ``!RULE`` is shorthand for a negative lookahead assertion" msgstr "" -#: ../../reference/compound_stmts.rst:767 +#: ../../reference/compound_stmts.rst:764 msgid "The top-level syntax for ``patterns`` is:" msgstr "" -#: ../../reference/compound_stmts.rst:781 +#: ../../reference/compound_stmts.rst:778 msgid "" "The descriptions below will include a description \"in simple terms\" of " "what a pattern does for illustration purposes (credits to Raymond Hettinger " @@ -982,70 +976,70 @@ msgid "" "forms." msgstr "" -#: ../../reference/compound_stmts.rst:791 +#: ../../reference/compound_stmts.rst:788 msgid "OR Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:793 +#: ../../reference/compound_stmts.rst:790 msgid "" "An OR pattern is two or more patterns separated by vertical bars ``|``. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:799 +#: ../../reference/compound_stmts.rst:796 msgid "" "Only the final subpattern may be :ref:`irrefutable <irrefutable_case>`, and " "each subpattern must bind the same set of names to avoid ambiguity." msgstr "" -#: ../../reference/compound_stmts.rst:802 +#: ../../reference/compound_stmts.rst:799 msgid "" "An OR pattern matches each of its subpatterns in turn to the subject value, " "until one succeeds. The OR pattern is then considered successful. " "Otherwise, if none of the subpatterns succeed, the OR pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:806 +#: ../../reference/compound_stmts.rst:803 msgid "" "In simple terms, ``P1 | P2 | ...`` will try to match ``P1``, if it fails it " "will try to match ``P2``, succeeding immediately if any succeeds, failing " "otherwise." msgstr "" -#: ../../reference/compound_stmts.rst:812 +#: ../../reference/compound_stmts.rst:809 msgid "AS Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:814 +#: ../../reference/compound_stmts.rst:811 msgid "" "An AS pattern matches an OR pattern on the left of the :keyword:`as` keyword " "against a subject. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:820 +#: ../../reference/compound_stmts.rst:817 msgid "" "If the OR pattern fails, the AS pattern fails. Otherwise, the AS pattern " "binds the subject to the name on the right of the as keyword and succeeds. " "``capture_pattern`` cannot be a ``_``." msgstr "" -#: ../../reference/compound_stmts.rst:824 +#: ../../reference/compound_stmts.rst:821 msgid "" "In simple terms ``P as NAME`` will match with ``P``, and on success it will " "set ``NAME = <subject>``." msgstr "" -#: ../../reference/compound_stmts.rst:831 +#: ../../reference/compound_stmts.rst:828 msgid "Literal Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:833 +#: ../../reference/compound_stmts.rst:830 msgid "" "A literal pattern corresponds to most :ref:`literals <literals>` in Python. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:846 +#: ../../reference/compound_stmts.rst:843 msgid "" "The rule ``strings`` and the token ``NUMBER`` are defined in the :doc:" "`standard Python grammar <./grammar>`. Triple-quoted strings are " @@ -1053,42 +1047,42 @@ msgid "" "are not supported." msgstr "" -#: ../../reference/compound_stmts.rst:851 +#: ../../reference/compound_stmts.rst:848 msgid "" "The forms ``signed_number '+' NUMBER`` and ``signed_number '-' NUMBER`` are " "for expressing :ref:`complex numbers <imaginary>`; they require a real " "number on the left and an imaginary number on the right. E.g. ``3 + 4j``." msgstr "" -#: ../../reference/compound_stmts.rst:855 +#: ../../reference/compound_stmts.rst:852 msgid "" "In simple terms, ``LITERAL`` will succeed only if ``<subject> == LITERAL``. " "For the singletons ``None``, ``True`` and ``False``, the :keyword:`is` " "operator is used." msgstr "" -#: ../../reference/compound_stmts.rst:861 +#: ../../reference/compound_stmts.rst:858 msgid "Capture Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:863 +#: ../../reference/compound_stmts.rst:860 msgid "A capture pattern binds the subject value to a name. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:869 +#: ../../reference/compound_stmts.rst:866 msgid "" "A single underscore ``_`` is not a capture pattern (this is what ``!'_'`` " "expresses). It is instead treated as a :token:`~python-grammar:" "wildcard_pattern`." msgstr "" -#: ../../reference/compound_stmts.rst:873 +#: ../../reference/compound_stmts.rst:870 msgid "" "In a given pattern, a given name can only be bound once. E.g. ``case x, " "x: ...`` is invalid while ``case [x] | x: ...`` is allowed." msgstr "" -#: ../../reference/compound_stmts.rst:876 +#: ../../reference/compound_stmts.rst:873 msgid "" "Capture patterns always succeed. The binding follows scoping rules " "established by the assignment expression operator in :pep:`572`; the name " @@ -1096,55 +1090,55 @@ msgid "" "there's an applicable :keyword:`global` or :keyword:`nonlocal` statement." msgstr "" -#: ../../reference/compound_stmts.rst:881 +#: ../../reference/compound_stmts.rst:878 msgid "" "In simple terms ``NAME`` will always succeed and it will set ``NAME = " "<subject>``." msgstr "" -#: ../../reference/compound_stmts.rst:886 +#: ../../reference/compound_stmts.rst:883 msgid "Wildcard Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:888 +#: ../../reference/compound_stmts.rst:885 msgid "" "A wildcard pattern always succeeds (matches anything) and binds no name. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:894 +#: ../../reference/compound_stmts.rst:891 msgid "" "``_`` is a :ref:`soft keyword <soft-keywords>` within any pattern, but only " "within patterns. It is an identifier, as usual, even within ``match`` " "subject expressions, ``guard``\\ s, and ``case`` blocks." msgstr "" -#: ../../reference/compound_stmts.rst:898 +#: ../../reference/compound_stmts.rst:895 msgid "In simple terms, ``_`` will always succeed." msgstr "" -#: ../../reference/compound_stmts.rst:903 +#: ../../reference/compound_stmts.rst:900 msgid "Value Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:905 +#: ../../reference/compound_stmts.rst:902 msgid "A value pattern represents a named value in Python. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:913 +#: ../../reference/compound_stmts.rst:910 msgid "" "The dotted name in the pattern is looked up using standard Python :ref:`name " "resolution rules <resolve_names>`. The pattern succeeds if the value found " "compares equal to the subject value (using the ``==`` equality operator)." msgstr "" -#: ../../reference/compound_stmts.rst:918 +#: ../../reference/compound_stmts.rst:915 msgid "" "In simple terms ``NAME1.NAME2`` will succeed only if ``<subject> == NAME1." "NAME2``" msgstr "" -#: ../../reference/compound_stmts.rst:922 +#: ../../reference/compound_stmts.rst:919 msgid "" "If the same value occurs multiple times in the same match statement, the " "interpreter may cache the first value found and reuse it rather than repeat " @@ -1152,44 +1146,44 @@ msgid "" "given match statement." msgstr "" -#: ../../reference/compound_stmts.rst:930 +#: ../../reference/compound_stmts.rst:927 msgid "Group Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:932 +#: ../../reference/compound_stmts.rst:929 msgid "" "A group pattern allows users to add parentheses around patterns to emphasize " "the intended grouping. Otherwise, it has no additional syntax. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:939 +#: ../../reference/compound_stmts.rst:936 msgid "In simple terms ``(P)`` has the same effect as ``P``." msgstr "" -#: ../../reference/compound_stmts.rst:944 +#: ../../reference/compound_stmts.rst:941 msgid "Sequence Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:946 +#: ../../reference/compound_stmts.rst:943 msgid "" "A sequence pattern contains several subpatterns to be matched against " "sequence elements. The syntax is similar to the unpacking of a list or tuple." msgstr "" -#: ../../reference/compound_stmts.rst:957 +#: ../../reference/compound_stmts.rst:954 msgid "" "There is no difference if parentheses or square brackets are used for " "sequence patterns (i.e. ``(...)`` vs ``[...]`` )." msgstr "" -#: ../../reference/compound_stmts.rst:961 +#: ../../reference/compound_stmts.rst:958 msgid "" "A single pattern enclosed in parentheses without a trailing comma (e.g. ``(3 " "| 4)``) is a :ref:`group pattern <group-patterns>`. While a single pattern " "enclosed in square brackets (e.g. ``[3 | 4]``) is still a sequence pattern." msgstr "" -#: ../../reference/compound_stmts.rst:966 +#: ../../reference/compound_stmts.rst:963 msgid "" "At most one star subpattern may be in a sequence pattern. The star " "subpattern may occur in any position. If no star subpattern is present, the " @@ -1197,40 +1191,40 @@ msgid "" "variable-length sequence pattern." msgstr "" -#: ../../reference/compound_stmts.rst:971 +#: ../../reference/compound_stmts.rst:968 msgid "" "The following is the logical flow for matching a sequence pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:974 +#: ../../reference/compound_stmts.rst:971 msgid "" "If the subject value is not a sequence [#]_, the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:977 +#: ../../reference/compound_stmts.rst:974 msgid "" "If the subject value is an instance of ``str``, ``bytes`` or ``bytearray`` " "the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:980 +#: ../../reference/compound_stmts.rst:977 msgid "" "The subsequent steps depend on whether the sequence pattern is fixed or " "variable-length." msgstr "" -#: ../../reference/compound_stmts.rst:983 +#: ../../reference/compound_stmts.rst:980 msgid "If the sequence pattern is fixed-length:" msgstr "" -#: ../../reference/compound_stmts.rst:985 +#: ../../reference/compound_stmts.rst:982 msgid "" "If the length of the subject sequence is not equal to the number of " "subpatterns, the sequence pattern fails" msgstr "" -#: ../../reference/compound_stmts.rst:988 +#: ../../reference/compound_stmts.rst:985 msgid "" "Subpatterns in the sequence pattern are matched to their corresponding items " "in the subject sequence from left to right. Matching stops as soon as a " @@ -1238,118 +1232,118 @@ msgid "" "corresponding item, the sequence pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:993 +#: ../../reference/compound_stmts.rst:990 msgid "Otherwise, if the sequence pattern is variable-length:" msgstr "" -#: ../../reference/compound_stmts.rst:995 +#: ../../reference/compound_stmts.rst:992 msgid "" "If the length of the subject sequence is less than the number of non-star " "subpatterns, the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:998 +#: ../../reference/compound_stmts.rst:995 msgid "" "The leading non-star subpatterns are matched to their corresponding items as " "for fixed-length sequences." msgstr "" -#: ../../reference/compound_stmts.rst:1001 +#: ../../reference/compound_stmts.rst:998 msgid "" "If the previous step succeeds, the star subpattern matches a list formed of " "the remaining subject items, excluding the remaining items corresponding to " "non-star subpatterns following the star subpattern." msgstr "" -#: ../../reference/compound_stmts.rst:1005 +#: ../../reference/compound_stmts.rst:1002 msgid "" "Remaining non-star subpatterns are matched to their corresponding subject " "items, as for a fixed-length sequence." msgstr "" -#: ../../reference/compound_stmts.rst:1008 +#: ../../reference/compound_stmts.rst:1005 msgid "" "The length of the subject sequence is obtained via :func:`len` (i.e. via " "the :meth:`__len__` protocol). This length may be cached by the interpreter " "in a similar manner as :ref:`value patterns <value-patterns>`." msgstr "" -#: ../../reference/compound_stmts.rst:1014 +#: ../../reference/compound_stmts.rst:1011 msgid "" "In simple terms ``[P1, P2, P3,`` ... ``, P<N>]`` matches only if all the " "following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1017 +#: ../../reference/compound_stmts.rst:1014 msgid "check ``<subject>`` is a sequence" msgstr "" -#: ../../reference/compound_stmts.rst:1018 +#: ../../reference/compound_stmts.rst:1015 msgid "``len(subject) == <N>``" msgstr "``len(subject) == <N>``" -#: ../../reference/compound_stmts.rst:1019 +#: ../../reference/compound_stmts.rst:1016 msgid "" "``P1`` matches ``<subject>[0]`` (note that this match can also bind names)" msgstr "" -#: ../../reference/compound_stmts.rst:1020 +#: ../../reference/compound_stmts.rst:1017 msgid "" "``P2`` matches ``<subject>[1]`` (note that this match can also bind names)" msgstr "" -#: ../../reference/compound_stmts.rst:1021 +#: ../../reference/compound_stmts.rst:1018 msgid "... and so on for the corresponding pattern/element." msgstr "" -#: ../../reference/compound_stmts.rst:1026 +#: ../../reference/compound_stmts.rst:1023 msgid "Mapping Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:1028 +#: ../../reference/compound_stmts.rst:1025 msgid "" "A mapping pattern contains one or more key-value patterns. The syntax is " "similar to the construction of a dictionary. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:1039 +#: ../../reference/compound_stmts.rst:1036 msgid "" "At most one double star pattern may be in a mapping pattern. The double " "star pattern must be the last subpattern in the mapping pattern." msgstr "" -#: ../../reference/compound_stmts.rst:1042 +#: ../../reference/compound_stmts.rst:1039 msgid "" "Duplicate keys in mapping patterns are disallowed. Duplicate literal keys " "will raise a :exc:`SyntaxError`. Two keys that otherwise have the same value " "will raise a :exc:`ValueError` at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1046 +#: ../../reference/compound_stmts.rst:1043 msgid "" "The following is the logical flow for matching a mapping pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:1049 +#: ../../reference/compound_stmts.rst:1046 msgid "If the subject value is not a mapping [#]_,the mapping pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:1051 +#: ../../reference/compound_stmts.rst:1048 msgid "" "If every key given in the mapping pattern is present in the subject mapping, " "and the pattern for each key matches the corresponding item of the subject " "mapping, the mapping pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:1055 +#: ../../reference/compound_stmts.rst:1052 msgid "" "If duplicate keys are detected in the mapping pattern, the pattern is " "considered invalid. A :exc:`SyntaxError` is raised for duplicate literal " "values; or a :exc:`ValueError` for named keys of the same value." msgstr "" -#: ../../reference/compound_stmts.rst:1059 +#: ../../reference/compound_stmts.rst:1056 msgid "" "Key-value pairs are matched using the two-argument form of the mapping " "subject's ``get()`` method. Matched key-value pairs must already be present " @@ -1357,256 +1351,256 @@ msgid "" "`~object.__getitem__`." msgstr "" -#: ../../reference/compound_stmts.rst:1064 +#: ../../reference/compound_stmts.rst:1061 msgid "" "In simple terms ``{KEY1: P1, KEY2: P2, ... }`` matches only if all the " "following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1067 +#: ../../reference/compound_stmts.rst:1064 msgid "check ``<subject>`` is a mapping" msgstr "" -#: ../../reference/compound_stmts.rst:1068 +#: ../../reference/compound_stmts.rst:1065 msgid "``KEY1 in <subject>``" msgstr "``KEY1 in <subject>``" -#: ../../reference/compound_stmts.rst:1069 +#: ../../reference/compound_stmts.rst:1066 msgid "``P1`` matches ``<subject>[KEY1]``" msgstr "" -#: ../../reference/compound_stmts.rst:1070 +#: ../../reference/compound_stmts.rst:1067 msgid "... and so on for the corresponding KEY/pattern pair." msgstr "" -#: ../../reference/compound_stmts.rst:1076 +#: ../../reference/compound_stmts.rst:1073 msgid "Class Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:1078 +#: ../../reference/compound_stmts.rst:1075 msgid "" "A class pattern represents a class and its positional and keyword arguments " "(if any). Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:1089 +#: ../../reference/compound_stmts.rst:1086 msgid "The same keyword should not be repeated in class patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1091 +#: ../../reference/compound_stmts.rst:1088 msgid "" "The following is the logical flow for matching a class pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:1094 +#: ../../reference/compound_stmts.rst:1091 msgid "" "If ``name_or_attr`` is not an instance of the builtin :class:`type` , raise :" "exc:`TypeError`." msgstr "" -#: ../../reference/compound_stmts.rst:1097 +#: ../../reference/compound_stmts.rst:1094 msgid "" "If the subject value is not an instance of ``name_or_attr`` (tested via :" "func:`isinstance`), the class pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:1100 +#: ../../reference/compound_stmts.rst:1097 msgid "" "If no pattern arguments are present, the pattern succeeds. Otherwise, the " "subsequent steps depend on whether keyword or positional argument patterns " "are present." msgstr "" -#: ../../reference/compound_stmts.rst:1104 +#: ../../reference/compound_stmts.rst:1101 msgid "" "For a number of built-in types (specified below), a single positional " "subpattern is accepted which will match the entire subject; for these types " "keyword patterns also work as for other types." msgstr "" -#: ../../reference/compound_stmts.rst:1108 +#: ../../reference/compound_stmts.rst:1105 msgid "" "If only keyword patterns are present, they are processed as follows, one by " "one:" msgstr "" -#: ../../reference/compound_stmts.rst:1111 +#: ../../reference/compound_stmts.rst:1108 msgid "I. The keyword is looked up as an attribute on the subject." msgstr "" -#: ../../reference/compound_stmts.rst:1113 +#: ../../reference/compound_stmts.rst:1110 msgid "" "If this raises an exception other than :exc:`AttributeError`, the exception " "bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:1116 +#: ../../reference/compound_stmts.rst:1113 msgid "If this raises :exc:`AttributeError`, the class pattern has failed." msgstr "" -#: ../../reference/compound_stmts.rst:1118 +#: ../../reference/compound_stmts.rst:1115 msgid "" "Else, the subpattern associated with the keyword pattern is matched against " "the subject's attribute value. If this fails, the class pattern fails; if " "this succeeds, the match proceeds to the next keyword." msgstr "" -#: ../../reference/compound_stmts.rst:1123 +#: ../../reference/compound_stmts.rst:1120 msgid "II. If all keyword patterns succeed, the class pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:1125 +#: ../../reference/compound_stmts.rst:1122 msgid "" "If any positional patterns are present, they are converted to keyword " "patterns using the :data:`~object.__match_args__` attribute on the class " "``name_or_attr`` before matching:" msgstr "" -#: ../../reference/compound_stmts.rst:1129 +#: ../../reference/compound_stmts.rst:1126 msgid "" "I. The equivalent of ``getattr(cls, \"__match_args__\", ())`` is called." msgstr "" -#: ../../reference/compound_stmts.rst:1131 +#: ../../reference/compound_stmts.rst:1128 msgid "If this raises an exception, the exception bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:1133 +#: ../../reference/compound_stmts.rst:1130 msgid "" "If the returned value is not a tuple, the conversion fails and :exc:" "`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1136 +#: ../../reference/compound_stmts.rst:1133 msgid "" "If there are more positional patterns than ``len(cls.__match_args__)``, :exc:" "`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1139 +#: ../../reference/compound_stmts.rst:1136 msgid "" "Otherwise, positional pattern ``i`` is converted to a keyword pattern using " "``__match_args__[i]`` as the keyword. ``__match_args__[i]`` must be a " "string; if not :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1143 +#: ../../reference/compound_stmts.rst:1140 msgid "If there are duplicate keywords, :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1145 +#: ../../reference/compound_stmts.rst:1142 msgid ":ref:`class-pattern-matching`" msgstr ":ref:`class-pattern-matching`" -#: ../../reference/compound_stmts.rst:1147 +#: ../../reference/compound_stmts.rst:1144 msgid "" "II. Once all positional patterns have been converted to keyword patterns," msgstr "" -#: ../../reference/compound_stmts.rst:1148 +#: ../../reference/compound_stmts.rst:1145 msgid "the match proceeds as if there were only keyword patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1150 +#: ../../reference/compound_stmts.rst:1147 msgid "" "For the following built-in types the handling of positional subpatterns is " "different:" msgstr "" -#: ../../reference/compound_stmts.rst:1153 +#: ../../reference/compound_stmts.rst:1150 msgid ":class:`bool`" msgstr ":class:`bool`" -#: ../../reference/compound_stmts.rst:1154 +#: ../../reference/compound_stmts.rst:1151 msgid ":class:`bytearray`" msgstr ":class:`bytearray`" -#: ../../reference/compound_stmts.rst:1155 +#: ../../reference/compound_stmts.rst:1152 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../reference/compound_stmts.rst:1156 +#: ../../reference/compound_stmts.rst:1153 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../reference/compound_stmts.rst:1157 +#: ../../reference/compound_stmts.rst:1154 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../reference/compound_stmts.rst:1158 +#: ../../reference/compound_stmts.rst:1155 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../reference/compound_stmts.rst:1159 +#: ../../reference/compound_stmts.rst:1156 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../reference/compound_stmts.rst:1160 -#: ../../reference/compound_stmts.rst:1878 +#: ../../reference/compound_stmts.rst:1157 +#: ../../reference/compound_stmts.rst:1875 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../reference/compound_stmts.rst:1161 +#: ../../reference/compound_stmts.rst:1158 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../reference/compound_stmts.rst:1162 +#: ../../reference/compound_stmts.rst:1159 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../reference/compound_stmts.rst:1163 -#: ../../reference/compound_stmts.rst:1881 +#: ../../reference/compound_stmts.rst:1160 +#: ../../reference/compound_stmts.rst:1878 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../reference/compound_stmts.rst:1165 +#: ../../reference/compound_stmts.rst:1162 msgid "" "These classes accept a single positional argument, and the pattern there is " "matched against the whole object rather than an attribute. For example " "``int(0|1)`` matches the value ``0``, but not the value ``0.0``." msgstr "" -#: ../../reference/compound_stmts.rst:1169 +#: ../../reference/compound_stmts.rst:1166 msgid "" "In simple terms ``CLS(P1, attr=P2)`` matches only if the following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1171 +#: ../../reference/compound_stmts.rst:1168 msgid "``isinstance(<subject>, CLS)``" msgstr "``isinstance(<subject>, CLS)``" -#: ../../reference/compound_stmts.rst:1172 +#: ../../reference/compound_stmts.rst:1169 msgid "convert ``P1`` to a keyword pattern using ``CLS.__match_args__``" msgstr "" -#: ../../reference/compound_stmts.rst:1173 +#: ../../reference/compound_stmts.rst:1170 msgid "For each keyword argument ``attr=P2``:" msgstr "" -#: ../../reference/compound_stmts.rst:1175 +#: ../../reference/compound_stmts.rst:1172 msgid "``hasattr(<subject>, \"attr\")``" msgstr "``hasattr(<subject>, \"attr\")``" -#: ../../reference/compound_stmts.rst:1176 +#: ../../reference/compound_stmts.rst:1173 msgid "``P2`` matches ``<subject>.attr``" msgstr "" -#: ../../reference/compound_stmts.rst:1178 +#: ../../reference/compound_stmts.rst:1175 msgid "... and so on for the corresponding keyword argument/pattern pair." msgstr "" -#: ../../reference/compound_stmts.rst:1193 +#: ../../reference/compound_stmts.rst:1190 msgid "Function definitions" msgstr "函式定義" -#: ../../reference/compound_stmts.rst:1208 +#: ../../reference/compound_stmts.rst:1205 msgid "" "A function definition defines a user-defined function object (see section :" "ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1228 +#: ../../reference/compound_stmts.rst:1225 msgid "" "A function definition is an executable statement. Its execution binds the " "function name in the current local namespace to a function object (a wrapper " @@ -1615,13 +1609,13 @@ msgid "" "used when the function is called." msgstr "" -#: ../../reference/compound_stmts.rst:1234 +#: ../../reference/compound_stmts.rst:1231 msgid "" "The function definition does not execute the function body; this gets " "executed only when the function is called. [#]_" msgstr "" -#: ../../reference/compound_stmts.rst:1240 +#: ../../reference/compound_stmts.rst:1237 msgid "" "A function definition may be wrapped by one or more :term:`decorator` " "expressions. Decorator expressions are evaluated when the function is " @@ -1632,7 +1626,7 @@ msgid "" "example, the following code ::" msgstr "" -#: ../../reference/compound_stmts.rst:1247 +#: ../../reference/compound_stmts.rst:1244 msgid "" "@f1(arg)\n" "@f2\n" @@ -1642,12 +1636,12 @@ msgstr "" "@f2\n" "def func(): pass" -#: ../../reference/compound_stmts.rst:1251 -#: ../../reference/compound_stmts.rst:1446 +#: ../../reference/compound_stmts.rst:1248 +#: ../../reference/compound_stmts.rst:1443 msgid "is roughly equivalent to ::" msgstr "大致等價於: ::" -#: ../../reference/compound_stmts.rst:1253 +#: ../../reference/compound_stmts.rst:1250 msgid "" "def func(): pass\n" "func = f1(arg)(f2(func))" @@ -1655,20 +1649,20 @@ msgstr "" "def func(): pass\n" "func = f1(arg)(f2(func))" -#: ../../reference/compound_stmts.rst:1256 +#: ../../reference/compound_stmts.rst:1253 msgid "" "except that the original function is not temporarily bound to the name " "``func``." msgstr "" -#: ../../reference/compound_stmts.rst:1258 +#: ../../reference/compound_stmts.rst:1255 msgid "" "Functions may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1263 +#: ../../reference/compound_stmts.rst:1260 msgid "" "A list of :ref:`type parameters <type-params>` may be given in square " "brackets between the function's name and the opening parenthesis for its " @@ -1678,12 +1672,12 @@ msgid "" "functions` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1270 -#: ../../reference/compound_stmts.rst:1465 +#: ../../reference/compound_stmts.rst:1267 +#: ../../reference/compound_stmts.rst:1462 msgid "Type parameter lists are new in Python 3.12." msgstr "" -#: ../../reference/compound_stmts.rst:1278 +#: ../../reference/compound_stmts.rst:1275 msgid "" "When one or more :term:`parameters <parameter>` have the form *parameter* " "``=`` *expression*, the function is said to have \"default parameter values." @@ -1694,7 +1688,7 @@ msgid "" "syntactic restriction that is not expressed by the grammar." msgstr "" -#: ../../reference/compound_stmts.rst:1286 +#: ../../reference/compound_stmts.rst:1283 msgid "" "**Default parameter values are evaluated from left to right when the " "function definition is executed.** This means that the expression is " @@ -1707,7 +1701,7 @@ msgid "" "the default, and explicitly test for it in the body of the function, e.g.::" msgstr "" -#: ../../reference/compound_stmts.rst:1296 +#: ../../reference/compound_stmts.rst:1293 msgid "" "def whats_on_the_telly(penguin=None):\n" " if penguin is None:\n" @@ -1716,7 +1710,7 @@ msgid "" " return penguin" msgstr "" -#: ../../reference/compound_stmts.rst:1307 +#: ../../reference/compound_stmts.rst:1304 msgid "" "Function call semantics are described in more detail in section :ref:" "`calls`. A function call always assigns values to all parameters mentioned " @@ -1732,13 +1726,13 @@ msgid "" "positional arguments." msgstr "" -#: ../../reference/compound_stmts.rst:1319 +#: ../../reference/compound_stmts.rst:1316 msgid "" "The ``/`` function parameter syntax may be used to indicate positional-only " "parameters. See :pep:`570` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1328 +#: ../../reference/compound_stmts.rst:1325 msgid "" "Parameters may have an :term:`annotation <function annotation>` of the form " "\"``: expression``\" following the parameter name. Any parameter may have " @@ -1757,13 +1751,13 @@ msgid "" "in the source code." msgstr "" -#: ../../reference/compound_stmts.rst:1342 +#: ../../reference/compound_stmts.rst:1339 msgid "" "Parameters of the form \"``*identifier``\" may have an annotation \"``: " "*expression``\". See :pep:`646`." msgstr "" -#: ../../reference/compound_stmts.rst:1348 +#: ../../reference/compound_stmts.rst:1345 msgid "" "It is also possible to create anonymous functions (functions not bound to a " "name), for immediate use in expressions. This uses lambda expressions, " @@ -1775,7 +1769,7 @@ msgid "" "execution of multiple statements and annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1356 +#: ../../reference/compound_stmts.rst:1353 msgid "" "**Programmer's note:** Functions are first-class objects. A \"``def``\" " "statement executed inside a function definition defines a local function " @@ -1784,61 +1778,61 @@ msgid "" "See section :ref:`naming` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1364 +#: ../../reference/compound_stmts.rst:1361 msgid ":pep:`3107` - Function Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1365 +#: ../../reference/compound_stmts.rst:1362 msgid "The original specification for function annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1367 +#: ../../reference/compound_stmts.rst:1364 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/compound_stmts.rst:1368 +#: ../../reference/compound_stmts.rst:1365 msgid "Definition of a standard meaning for annotations: type hints." msgstr "" -#: ../../reference/compound_stmts.rst:1370 +#: ../../reference/compound_stmts.rst:1367 msgid ":pep:`526` - Syntax for Variable Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1371 +#: ../../reference/compound_stmts.rst:1368 msgid "" "Ability to type hint variable declarations, including class variables and " "instance variables." msgstr "" -#: ../../reference/compound_stmts.rst:1374 +#: ../../reference/compound_stmts.rst:1371 msgid ":pep:`563` - Postponed Evaluation of Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1375 +#: ../../reference/compound_stmts.rst:1372 msgid "" "Support for forward references within annotations by preserving annotations " "in a string form at runtime instead of eager evaluation." msgstr "" -#: ../../reference/compound_stmts.rst:1378 +#: ../../reference/compound_stmts.rst:1375 msgid ":pep:`318` - Decorators for Functions and Methods" msgstr "" -#: ../../reference/compound_stmts.rst:1379 +#: ../../reference/compound_stmts.rst:1376 msgid "" "Function and method decorators were introduced. Class decorators were " "introduced in :pep:`3129`." msgstr "" -#: ../../reference/compound_stmts.rst:1385 +#: ../../reference/compound_stmts.rst:1382 msgid "Class definitions" msgstr "類別定義" -#: ../../reference/compound_stmts.rst:1400 +#: ../../reference/compound_stmts.rst:1397 msgid "A class definition defines a class object (see section :ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1407 +#: ../../reference/compound_stmts.rst:1404 msgid "" "A class definition is an executable statement. The inheritance list usually " "gives a list of base classes (see :ref:`metaclasses` for more advanced " @@ -1847,7 +1841,7 @@ msgid "" "default, from the base class :class:`object`; hence, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1413 +#: ../../reference/compound_stmts.rst:1410 msgid "" "class Foo:\n" " pass" @@ -1855,11 +1849,11 @@ msgstr "" "class Foo:\n" " pass" -#: ../../reference/compound_stmts.rst:1416 +#: ../../reference/compound_stmts.rst:1413 msgid "is equivalent to ::" msgstr "" -#: ../../reference/compound_stmts.rst:1418 +#: ../../reference/compound_stmts.rst:1415 msgid "" "class Foo(object):\n" " pass" @@ -1867,7 +1861,7 @@ msgstr "" "class Foo(object):\n" " pass" -#: ../../reference/compound_stmts.rst:1421 +#: ../../reference/compound_stmts.rst:1418 msgid "" "The class's suite is then executed in a new execution frame (see :ref:" "`naming`), using a newly created local namespace and the original global " @@ -1879,7 +1873,7 @@ msgid "" "original local namespace." msgstr "" -#: ../../reference/compound_stmts.rst:1430 +#: ../../reference/compound_stmts.rst:1427 msgid "" "The order in which attributes are defined in the class body is preserved in " "the new class's :attr:`~type.__dict__`. Note that this is reliable only " @@ -1887,17 +1881,17 @@ msgid "" "using the definition syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1435 +#: ../../reference/compound_stmts.rst:1432 msgid "" "Class creation can be customized heavily using :ref:`metaclasses " "<metaclasses>`." msgstr "" -#: ../../reference/compound_stmts.rst:1440 +#: ../../reference/compound_stmts.rst:1437 msgid "Classes can also be decorated: just like when decorating functions, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1442 +#: ../../reference/compound_stmts.rst:1439 msgid "" "@f1(arg)\n" "@f2\n" @@ -1907,7 +1901,7 @@ msgstr "" "@f2\n" "class Foo: pass" -#: ../../reference/compound_stmts.rst:1448 +#: ../../reference/compound_stmts.rst:1445 msgid "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" @@ -1915,20 +1909,20 @@ msgstr "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" -#: ../../reference/compound_stmts.rst:1451 +#: ../../reference/compound_stmts.rst:1448 msgid "" "The evaluation rules for the decorator expressions are the same as for " "function decorators. The result is then bound to the class name." msgstr "" -#: ../../reference/compound_stmts.rst:1454 +#: ../../reference/compound_stmts.rst:1451 msgid "" "Classes may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1459 +#: ../../reference/compound_stmts.rst:1456 msgid "" "A list of :ref:`type parameters <type-params>` may be given in square " "brackets immediately after the class's name. This indicates to static type " @@ -1937,7 +1931,7 @@ msgid "" "`generic-classes` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1468 +#: ../../reference/compound_stmts.rst:1465 msgid "" "**Programmer's note:** Variables defined in the class definition are class " "attributes; they are shared by instances. Instance attributes can be set in " @@ -1950,35 +1944,35 @@ msgid "" "implementation details." msgstr "" -#: ../../reference/compound_stmts.rst:1480 +#: ../../reference/compound_stmts.rst:1477 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/compound_stmts.rst:1481 +#: ../../reference/compound_stmts.rst:1478 msgid "" "The proposal that changed the declaration of metaclasses to the current " "syntax, and the semantics for how classes with metaclasses are constructed." msgstr "" -#: ../../reference/compound_stmts.rst:1485 +#: ../../reference/compound_stmts.rst:1482 msgid ":pep:`3129` - Class Decorators" msgstr ":pep:`3129` - 類別裝飾器" -#: ../../reference/compound_stmts.rst:1486 +#: ../../reference/compound_stmts.rst:1483 msgid "" "The proposal that added class decorators. Function and method decorators " "were introduced in :pep:`318`." msgstr "" -#: ../../reference/compound_stmts.rst:1493 +#: ../../reference/compound_stmts.rst:1490 msgid "Coroutines" msgstr "協程" -#: ../../reference/compound_stmts.rst:1501 +#: ../../reference/compound_stmts.rst:1498 msgid "Coroutine function definition" msgstr "協程函式定義" -#: ../../reference/compound_stmts.rst:1511 +#: ../../reference/compound_stmts.rst:1508 msgid "" "Execution of Python coroutines can be suspended and resumed at many points " "(see :term:`coroutine`). :keyword:`await` expressions, :keyword:`async for` " @@ -1986,23 +1980,23 @@ msgid "" "function." msgstr "" -#: ../../reference/compound_stmts.rst:1515 +#: ../../reference/compound_stmts.rst:1512 msgid "" "Functions defined with ``async def`` syntax are always coroutine functions, " "even if they do not contain ``await`` or ``async`` keywords." msgstr "" -#: ../../reference/compound_stmts.rst:1518 +#: ../../reference/compound_stmts.rst:1515 msgid "" "It is a :exc:`SyntaxError` to use a ``yield from`` expression inside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1521 +#: ../../reference/compound_stmts.rst:1518 msgid "An example of a coroutine function::" msgstr "一個協程函式範例: ::" -#: ../../reference/compound_stmts.rst:1523 +#: ../../reference/compound_stmts.rst:1520 msgid "" "async def func(param1, param2):\n" " do_stuff()\n" @@ -2012,30 +2006,30 @@ msgstr "" " do_stuff()\n" " await some_coroutine()" -#: ../../reference/compound_stmts.rst:1527 +#: ../../reference/compound_stmts.rst:1524 msgid "" "``await`` and ``async`` are now keywords; previously they were only treated " "as such inside the body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1535 +#: ../../reference/compound_stmts.rst:1532 msgid "The :keyword:`!async for` statement" msgstr ":keyword:`!async for` 陳述式" -#: ../../reference/compound_stmts.rst:1540 +#: ../../reference/compound_stmts.rst:1537 msgid "" "An :term:`asynchronous iterable` provides an ``__aiter__`` method that " "directly returns an :term:`asynchronous iterator`, which can call " "asynchronous code in its ``__anext__`` method." msgstr "" -#: ../../reference/compound_stmts.rst:1544 +#: ../../reference/compound_stmts.rst:1541 msgid "" "The ``async for`` statement allows convenient iteration over asynchronous " "iterables." msgstr "" -#: ../../reference/compound_stmts.rst:1549 +#: ../../reference/compound_stmts.rst:1546 msgid "" "async for TARGET in ITER:\n" " SUITE\n" @@ -2047,11 +2041,11 @@ msgstr "" "else:\n" " SUITE2" -#: ../../reference/compound_stmts.rst:1554 +#: ../../reference/compound_stmts.rst:1551 msgid "Is semantically equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1556 +#: ../../reference/compound_stmts.rst:1553 msgid "" "iter = (ITER)\n" "iter = type(iter).__aiter__(iter)\n" @@ -2081,28 +2075,28 @@ msgstr "" "else:\n" " SUITE2" -#: ../../reference/compound_stmts.rst:1570 +#: ../../reference/compound_stmts.rst:1567 msgid "" "See also :meth:`~object.__aiter__` and :meth:`~object.__anext__` for details." msgstr "更多細節請見 :meth:`~object.__aiter__` 與 :meth:`~object.__anext__`。" -#: ../../reference/compound_stmts.rst:1572 +#: ../../reference/compound_stmts.rst:1569 msgid "" "It is a :exc:`SyntaxError` to use an ``async for`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1580 +#: ../../reference/compound_stmts.rst:1577 msgid "The :keyword:`!async with` statement" msgstr ":keyword:`!async with` 陳述式" -#: ../../reference/compound_stmts.rst:1585 +#: ../../reference/compound_stmts.rst:1582 msgid "" "An :term:`asynchronous context manager` is a :term:`context manager` that is " "able to suspend execution in its *enter* and *exit* methods." msgstr "" -#: ../../reference/compound_stmts.rst:1590 +#: ../../reference/compound_stmts.rst:1587 msgid "" "async with EXPRESSION as TARGET:\n" " SUITE" @@ -2110,7 +2104,7 @@ msgstr "" "async with EXPRESSION as TARGET:\n" " SUITE" -#: ../../reference/compound_stmts.rst:1595 +#: ../../reference/compound_stmts.rst:1592 msgid "" "manager = (EXPRESSION)\n" "aenter = type(manager).__aenter__\n" @@ -2146,44 +2140,44 @@ msgstr "" " if not hit_except:\n" " await aexit(manager, None, None, None)" -#: ../../reference/compound_stmts.rst:1612 +#: ../../reference/compound_stmts.rst:1609 msgid "" "See also :meth:`~object.__aenter__` and :meth:`~object.__aexit__` for " "details." msgstr "更多細節請見 :meth:`~object.__aenter__` 與 :meth:`~object.__aexit__`。" -#: ../../reference/compound_stmts.rst:1614 +#: ../../reference/compound_stmts.rst:1611 msgid "" "It is a :exc:`SyntaxError` to use an ``async with`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1619 +#: ../../reference/compound_stmts.rst:1616 msgid ":pep:`492` - Coroutines with async and await syntax" msgstr "" -#: ../../reference/compound_stmts.rst:1620 +#: ../../reference/compound_stmts.rst:1617 msgid "" "The proposal that made coroutines a proper standalone concept in Python, and " "added supporting syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1626 +#: ../../reference/compound_stmts.rst:1623 msgid "Type parameter lists" msgstr "" -#: ../../reference/compound_stmts.rst:1630 +#: ../../reference/compound_stmts.rst:1627 msgid "Support for default values was added (see :pep:`696`)." msgstr "" -#: ../../reference/compound_stmts.rst:1643 +#: ../../reference/compound_stmts.rst:1640 msgid "" ":ref:`Functions <def>` (including :ref:`coroutines <async def>`), :ref:" "`classes <class>` and :ref:`type aliases <type>` may contain a type " "parameter list::" msgstr "" -#: ../../reference/compound_stmts.rst:1647 +#: ../../reference/compound_stmts.rst:1644 msgid "" "def max[T](args: list[T]) -> T:\n" " ...\n" @@ -2215,7 +2209,7 @@ msgstr "" "\n" "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1662 +#: ../../reference/compound_stmts.rst:1659 msgid "" "Semantically, this indicates that the function, class, or type alias is " "generic over a type variable. This information is primarily used by static " @@ -2223,7 +2217,7 @@ msgid "" "generic counterparts." msgstr "" -#: ../../reference/compound_stmts.rst:1667 +#: ../../reference/compound_stmts.rst:1664 msgid "" "Type parameters are declared in square brackets (``[]``) immediately after " "the name of the function, class, or type alias. The type parameters are " @@ -2235,36 +2229,36 @@ msgid "" "wraps the creation of the generic object." msgstr "" -#: ../../reference/compound_stmts.rst:1676 +#: ../../reference/compound_stmts.rst:1673 msgid "" "Generic functions, classes, and type aliases have a :attr:`~definition." "__type_params__` attribute listing their type parameters." msgstr "" -#: ../../reference/compound_stmts.rst:1679 +#: ../../reference/compound_stmts.rst:1676 msgid "Type parameters come in three kinds:" msgstr "" -#: ../../reference/compound_stmts.rst:1681 +#: ../../reference/compound_stmts.rst:1678 msgid "" ":data:`typing.TypeVar`, introduced by a plain name (e.g., ``T``). " "Semantically, this represents a single type to a type checker." msgstr "" -#: ../../reference/compound_stmts.rst:1683 +#: ../../reference/compound_stmts.rst:1680 msgid "" ":data:`typing.TypeVarTuple`, introduced by a name prefixed with a single " "asterisk (e.g., ``*Ts``). Semantically, this stands for a tuple of any " "number of types." msgstr "" -#: ../../reference/compound_stmts.rst:1686 +#: ../../reference/compound_stmts.rst:1683 msgid "" ":data:`typing.ParamSpec`, introduced by a name prefixed with two asterisks " "(e.g., ``**P``). Semantically, this stands for the parameters of a callable." msgstr "" -#: ../../reference/compound_stmts.rst:1689 +#: ../../reference/compound_stmts.rst:1686 msgid "" ":data:`typing.TypeVar` declarations can define *bounds* and *constraints* " "with a colon (``:``) followed by an expression. A single expression after " @@ -2276,7 +2270,7 @@ msgid "" "variables can only take on one of the types in the list of constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1698 +#: ../../reference/compound_stmts.rst:1695 msgid "" "For :data:`!typing.TypeVar`\\ s declared using the type parameter list " "syntax, the bound and constraints are not evaluated when the generic object " @@ -2286,13 +2280,13 @@ msgid "" "<annotation-scopes>`." msgstr "" -#: ../../reference/compound_stmts.rst:1704 +#: ../../reference/compound_stmts.rst:1701 msgid "" ":data:`typing.TypeVarTuple`\\ s and :data:`typing.ParamSpec`\\ s cannot have " "bounds or constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1707 +#: ../../reference/compound_stmts.rst:1704 msgid "" "All three flavors of type parameters can also have a *default value*, which " "is used when the type parameter is not explicitly provided. This is added by " @@ -2305,13 +2299,13 @@ msgid "" "attribute is set to the special sentinel object :data:`typing.NoDefault`." msgstr "" -#: ../../reference/compound_stmts.rst:1717 +#: ../../reference/compound_stmts.rst:1714 msgid "" "The following example indicates the full set of allowed type parameter " "declarations::" msgstr "" -#: ../../reference/compound_stmts.rst:1719 +#: ../../reference/compound_stmts.rst:1716 msgid "" "def overly_generic[\n" " SimpleTypeVar,\n" @@ -2343,24 +2337,24 @@ msgstr "" " *e: SimpleTypeVarTuple,\n" "): ..." -#: ../../reference/compound_stmts.rst:1737 +#: ../../reference/compound_stmts.rst:1734 msgid "Generic functions" msgstr "" -#: ../../reference/compound_stmts.rst:1739 +#: ../../reference/compound_stmts.rst:1736 msgid "Generic functions are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1741 +#: ../../reference/compound_stmts.rst:1738 msgid "def func[T](arg: T): ..." msgstr "def func[T](arg: T): ..." -#: ../../reference/compound_stmts.rst:1743 -#: ../../reference/compound_stmts.rst:1803 +#: ../../reference/compound_stmts.rst:1740 +#: ../../reference/compound_stmts.rst:1800 msgid "This syntax is equivalent to::" msgstr "語法大致等價於: ::" -#: ../../reference/compound_stmts.rst:1745 +#: ../../reference/compound_stmts.rst:1742 msgid "" "annotation-def TYPE_PARAMS_OF_func():\n" " T = typing.TypeVar(\"T\")\n" @@ -2376,7 +2370,7 @@ msgstr "" " return func\n" "func = TYPE_PARAMS_OF_func()" -#: ../../reference/compound_stmts.rst:1752 +#: ../../reference/compound_stmts.rst:1749 msgid "" "Here ``annotation-def`` indicates an :ref:`annotation scope <annotation-" "scopes>`, which is not actually bound to any name at runtime. (One other " @@ -2385,20 +2379,20 @@ msgid "" "data:`typing.TypeVar` directly.)" msgstr "" -#: ../../reference/compound_stmts.rst:1758 +#: ../../reference/compound_stmts.rst:1755 msgid "" "The annotations of generic functions are evaluated within the annotation " "scope used for declaring the type parameters, but the function's defaults " "and decorators are not." msgstr "" -#: ../../reference/compound_stmts.rst:1762 +#: ../../reference/compound_stmts.rst:1759 msgid "" "The following example illustrates the scoping rules for these cases, as well " "as for additional flavors of type parameters::" msgstr "" -#: ../../reference/compound_stmts.rst:1765 +#: ../../reference/compound_stmts.rst:1762 msgid "" "@decorator\n" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" @@ -2408,13 +2402,13 @@ msgstr "" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" " ..." -#: ../../reference/compound_stmts.rst:1769 +#: ../../reference/compound_stmts.rst:1766 msgid "" "Except for the :ref:`lazy evaluation <lazy-evaluation>` of the :class:" "`~typing.TypeVar` bound, this is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1772 +#: ../../reference/compound_stmts.rst:1769 msgid "" "DEFAULT_OF_arg = some_default\n" "\n" @@ -2436,25 +2430,25 @@ msgid "" "func = decorator(TYPE_PARAMS_OF_func())" msgstr "" -#: ../../reference/compound_stmts.rst:1791 +#: ../../reference/compound_stmts.rst:1788 msgid "" "The capitalized names like ``DEFAULT_OF_arg`` are not actually bound at " "runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1797 +#: ../../reference/compound_stmts.rst:1794 msgid "Generic classes" msgstr "" -#: ../../reference/compound_stmts.rst:1799 +#: ../../reference/compound_stmts.rst:1796 msgid "Generic classes are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1801 +#: ../../reference/compound_stmts.rst:1798 msgid "class Bag[T]: ..." msgstr "class Bag[T]: ..." -#: ../../reference/compound_stmts.rst:1805 +#: ../../reference/compound_stmts.rst:1802 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2472,14 +2466,14 @@ msgstr "" " return Bag\n" "Bag = TYPE_PARAMS_OF_Bag()" -#: ../../reference/compound_stmts.rst:1813 +#: ../../reference/compound_stmts.rst:1810 msgid "" "Here again ``annotation-def`` (not a real keyword) indicates an :ref:" "`annotation scope <annotation-scopes>`, and the name ``TYPE_PARAMS_OF_Bag`` " "is not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1817 +#: ../../reference/compound_stmts.rst:1814 msgid "" "Generic classes implicitly inherit from :data:`typing.Generic`. The base " "classes and keyword arguments of generic classes are evaluated within the " @@ -2487,7 +2481,7 @@ msgid "" "that scope. This is illustrated by this example::" msgstr "" -#: ../../reference/compound_stmts.rst:1823 +#: ../../reference/compound_stmts.rst:1820 msgid "" "@decorator\n" "class Bag(Base[T], arg=T): ..." @@ -2495,11 +2489,11 @@ msgstr "" "@decorator\n" "class Bag(Base[T], arg=T): ..." -#: ../../reference/compound_stmts.rst:1826 +#: ../../reference/compound_stmts.rst:1823 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../reference/compound_stmts.rst:1828 +#: ../../reference/compound_stmts.rst:1825 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2517,27 +2511,27 @@ msgstr "" " return Bag\n" "Bag = decorator(TYPE_PARAMS_OF_Bag())" -#: ../../reference/compound_stmts.rst:1839 +#: ../../reference/compound_stmts.rst:1836 msgid "Generic type aliases" msgstr "" -#: ../../reference/compound_stmts.rst:1841 +#: ../../reference/compound_stmts.rst:1838 msgid "" "The :keyword:`type` statement can also be used to create a generic type " "alias::" msgstr "" -#: ../../reference/compound_stmts.rst:1843 +#: ../../reference/compound_stmts.rst:1840 msgid "type ListOrSet[T] = list[T] | set[T]" msgstr "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1845 +#: ../../reference/compound_stmts.rst:1842 msgid "" "Except for the :ref:`lazy evaluation <lazy-evaluation>` of the value, this " "is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1848 +#: ../../reference/compound_stmts.rst:1845 msgid "" "annotation-def TYPE_PARAMS_OF_ListOrSet():\n" " T = typing.TypeVar(\"T\")\n" @@ -2550,105 +2544,105 @@ msgid "" "ListOrSet = TYPE_PARAMS_OF_ListOrSet()" msgstr "" -#: ../../reference/compound_stmts.rst:1857 +#: ../../reference/compound_stmts.rst:1854 msgid "" "Here, ``annotation-def`` (not a real keyword) indicates an :ref:`annotation " "scope <annotation-scopes>`. The capitalized names like " "``TYPE_PARAMS_OF_ListOrSet`` are not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1862 +#: ../../reference/compound_stmts.rst:1859 msgid "Footnotes" msgstr "註解" -#: ../../reference/compound_stmts.rst:1863 +#: ../../reference/compound_stmts.rst:1860 msgid "" "The exception is propagated to the invocation stack unless there is a :" "keyword:`finally` clause which happens to raise another exception. That new " "exception causes the old one to be lost." msgstr "" -#: ../../reference/compound_stmts.rst:1867 +#: ../../reference/compound_stmts.rst:1864 msgid "In pattern matching, a sequence is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1869 +#: ../../reference/compound_stmts.rst:1866 msgid "a class that inherits from :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1870 +#: ../../reference/compound_stmts.rst:1867 msgid "" "a Python class that has been registered as :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1871 +#: ../../reference/compound_stmts.rst:1868 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_SEQUENCE` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1872 -#: ../../reference/compound_stmts.rst:1891 +#: ../../reference/compound_stmts.rst:1869 +#: ../../reference/compound_stmts.rst:1888 msgid "a class that inherits from any of the above" msgstr "" -#: ../../reference/compound_stmts.rst:1874 +#: ../../reference/compound_stmts.rst:1871 msgid "The following standard library classes are sequences:" msgstr "" -#: ../../reference/compound_stmts.rst:1876 +#: ../../reference/compound_stmts.rst:1873 msgid ":class:`array.array`" msgstr ":class:`array.array`" -#: ../../reference/compound_stmts.rst:1877 +#: ../../reference/compound_stmts.rst:1874 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../reference/compound_stmts.rst:1879 +#: ../../reference/compound_stmts.rst:1876 msgid ":class:`memoryview`" msgstr ":class:`memoryview`" -#: ../../reference/compound_stmts.rst:1880 +#: ../../reference/compound_stmts.rst:1877 msgid ":class:`range`" msgstr ":class:`range`" -#: ../../reference/compound_stmts.rst:1883 +#: ../../reference/compound_stmts.rst:1880 msgid "" "Subject values of type ``str``, ``bytes``, and ``bytearray`` do not match " "sequence patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1886 +#: ../../reference/compound_stmts.rst:1883 msgid "In pattern matching, a mapping is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1888 +#: ../../reference/compound_stmts.rst:1885 msgid "a class that inherits from :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1889 +#: ../../reference/compound_stmts.rst:1886 msgid "" "a Python class that has been registered as :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1890 +#: ../../reference/compound_stmts.rst:1887 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_MAPPING` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1893 +#: ../../reference/compound_stmts.rst:1890 msgid "" "The standard library classes :class:`dict` and :class:`types." "MappingProxyType` are mappings." msgstr "" -#: ../../reference/compound_stmts.rst:1896 +#: ../../reference/compound_stmts.rst:1893 msgid "" "A string literal appearing as the first statement in the function body is " "transformed into the function's :attr:`~function.__doc__` attribute and " "therefore the function's :term:`docstring`." msgstr "" -#: ../../reference/compound_stmts.rst:1900 +#: ../../reference/compound_stmts.rst:1897 msgid "" "A string literal appearing as the first statement in the class body is " "transformed into the namespace's :attr:`~type.__doc__` item and therefore " @@ -2668,12 +2662,12 @@ msgstr "compound(複合)" #: ../../reference/compound_stmts.rst:390 #: ../../reference/compound_stmts.rst:437 #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:588 -#: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1387 -#: ../../reference/compound_stmts.rst:1497 -#: ../../reference/compound_stmts.rst:1531 -#: ../../reference/compound_stmts.rst:1576 +#: ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1494 +#: ../../reference/compound_stmts.rst:1528 +#: ../../reference/compound_stmts.rst:1573 msgid "statement" msgstr "statement(陳述式)" @@ -2709,7 +2703,7 @@ msgstr "" msgid "else" msgstr "else" -#: ../../reference/compound_stmts.rst:86 ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:86 ../../reference/compound_stmts.rst:585 msgid "if" msgstr "if" @@ -2720,8 +2714,8 @@ msgstr "if" #: ../../reference/compound_stmts.rst:390 #: ../../reference/compound_stmts.rst:408 #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:588 -#: ../../reference/compound_stmts.rst:1507 +#: ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:1504 msgid "keyword" msgstr "keyword(關鍵字)" @@ -2733,10 +2727,10 @@ msgstr "elif" #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:207 #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:588 -#: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1323 -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1320 +#: ../../reference/compound_stmts.rst:1384 msgid ": (colon)" msgstr ": (冒號)" @@ -2744,9 +2738,9 @@ msgstr ": (冒號)" #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:207 #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:588 -#: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1384 msgid "compound statement" msgstr "compound statement(複合陳述式)" @@ -2791,8 +2785,8 @@ msgstr "list(串列)" #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:298 -#: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1384 msgid "object" msgstr "object(物件)" @@ -2824,7 +2818,7 @@ msgstr "finally" #: ../../reference/compound_stmts.rst:207 #: ../../reference/compound_stmts.rst:265 #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:585 msgid "as" msgstr "as" @@ -2862,199 +2856,199 @@ msgid "with statement" msgstr "with statement(with 陳述式)" #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1384 msgid ", (comma)" msgstr ", (逗號)" -#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:585 msgid "match" msgstr "match" -#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:585 msgid "case" msgstr "case" -#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:585 msgid "pattern matching" msgstr "pattern matching(模式匹配)" -#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:585 msgid "match statement" msgstr "match statement(匹配陳述式)" -#: ../../reference/compound_stmts.rst:692 +#: ../../reference/compound_stmts.rst:689 msgid "guard" msgstr "guard" -#: ../../reference/compound_stmts.rst:731 +#: ../../reference/compound_stmts.rst:728 msgid "irrefutable case block" msgstr "" -#: ../../reference/compound_stmts.rst:731 +#: ../../reference/compound_stmts.rst:728 msgid "case block" msgstr "" -#: ../../reference/compound_stmts.rst:755 +#: ../../reference/compound_stmts.rst:752 msgid "! patterns" msgstr "" -#: ../../reference/compound_stmts.rst:755 +#: ../../reference/compound_stmts.rst:752 msgid "AS pattern, OR pattern, capture pattern, wildcard pattern" msgstr "" -#: ../../reference/compound_stmts.rst:1186 -#: ../../reference/compound_stmts.rst:1273 +#: ../../reference/compound_stmts.rst:1183 +#: ../../reference/compound_stmts.rst:1270 msgid "parameter" msgstr "parameter(參數)" -#: ../../reference/compound_stmts.rst:1186 -#: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1237 -#: ../../reference/compound_stmts.rst:1273 -#: ../../reference/compound_stmts.rst:1302 +#: ../../reference/compound_stmts.rst:1183 +#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1234 +#: ../../reference/compound_stmts.rst:1270 +#: ../../reference/compound_stmts.rst:1299 msgid "function definition" msgstr "function definition(函式定義)" -#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1192 msgid "def" msgstr "def" -#: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1323 +#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1320 msgid "function" msgstr "function (函式)" -#: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1384 msgid "definition" msgstr "definition(定義)" -#: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1384 msgid "name" msgstr "name(名稱)" -#: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1384 msgid "binding" msgstr "binding(綁定)" -#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1192 msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" -#: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1384 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1192 msgid "parameter list" msgstr "parameter list(參數列表)" -#: ../../reference/compound_stmts.rst:1237 -#: ../../reference/compound_stmts.rst:1437 +#: ../../reference/compound_stmts.rst:1234 +#: ../../reference/compound_stmts.rst:1434 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/compound_stmts.rst:1273 +#: ../../reference/compound_stmts.rst:1270 msgid "default" msgstr "default(預設)" -#: ../../reference/compound_stmts.rst:1273 +#: ../../reference/compound_stmts.rst:1270 msgid "value" msgstr "value(值)" -#: ../../reference/compound_stmts.rst:1273 +#: ../../reference/compound_stmts.rst:1270 msgid "argument" msgstr "argument(引數)" -#: ../../reference/compound_stmts.rst:1273 +#: ../../reference/compound_stmts.rst:1270 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/compound_stmts.rst:1302 +#: ../../reference/compound_stmts.rst:1299 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/compound_stmts.rst:1302 +#: ../../reference/compound_stmts.rst:1299 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/compound_stmts.rst:1302 +#: ../../reference/compound_stmts.rst:1299 msgid "**" msgstr "**" -#: ../../reference/compound_stmts.rst:1323 +#: ../../reference/compound_stmts.rst:1320 msgid "annotations" msgstr "annotations(註釋)" -#: ../../reference/compound_stmts.rst:1323 +#: ../../reference/compound_stmts.rst:1320 msgid "->" msgstr "->" -#: ../../reference/compound_stmts.rst:1323 +#: ../../reference/compound_stmts.rst:1320 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../reference/compound_stmts.rst:1346 +#: ../../reference/compound_stmts.rst:1343 msgid "lambda" msgstr "lambda" -#: ../../reference/compound_stmts.rst:1346 +#: ../../reference/compound_stmts.rst:1343 msgid "expression" msgstr "expression(運算式)" -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1384 msgid "class" msgstr "class(類別)" -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1384 msgid "execution" msgstr "execution(執行)" -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1384 msgid "frame" msgstr "frame" -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1384 msgid "inheritance" msgstr "inheritance(繼承)" -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1384 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../reference/compound_stmts.rst:1387 -#: ../../reference/compound_stmts.rst:1437 +#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1434 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1384 msgid "expression list" msgstr "expression list(表達式列表)" -#: ../../reference/compound_stmts.rst:1497 +#: ../../reference/compound_stmts.rst:1494 msgid "async def" msgstr "async def" -#: ../../reference/compound_stmts.rst:1507 +#: ../../reference/compound_stmts.rst:1504 msgid "async" msgstr "async" -#: ../../reference/compound_stmts.rst:1507 +#: ../../reference/compound_stmts.rst:1504 msgid "await" msgstr "await" -#: ../../reference/compound_stmts.rst:1531 +#: ../../reference/compound_stmts.rst:1528 msgid "async for" msgstr "async for" -#: ../../reference/compound_stmts.rst:1576 +#: ../../reference/compound_stmts.rst:1573 msgid "async with" msgstr "async with" -#: ../../reference/compound_stmts.rst:1633 +#: ../../reference/compound_stmts.rst:1630 msgid "type parameters" msgstr "type parameter(型別參數)" diff --git a/reference/expressions.po b/reference/expressions.po index a6d34f67a1..32ca7edb29 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-08 03:35+0000\n" +"POT-Creation-Date: 2024-11-15 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1280,76 +1280,78 @@ msgid "" "The first thing the code block will do is bind the formal parameters to the " "arguments; this is described in section :ref:`function`. When the code " "block executes a :keyword:`return` statement, this specifies the return " -"value of the function call." +"value of the function call. If execution reaches the end of the code block " +"without executing a :keyword:`return` statement, the return value is " +"``None``." msgstr "" -#: ../../reference/expressions.rst:1161 +#: ../../reference/expressions.rst:1162 msgid "a built-in function or method:" msgstr "" -#: ../../reference/expressions.rst:1172 +#: ../../reference/expressions.rst:1173 msgid "" "The result is up to the interpreter; see :ref:`built-in-funcs` for the " "descriptions of built-in functions and methods." msgstr "" -#: ../../reference/expressions.rst:1175 +#: ../../reference/expressions.rst:1176 msgid "a class object:" msgstr "" -#: ../../reference/expressions.rst:1180 +#: ../../reference/expressions.rst:1181 msgid "A new instance of that class is returned." msgstr "" -#: ../../reference/expressions.rst:1182 +#: ../../reference/expressions.rst:1183 msgid "a class instance method:" msgstr "" -#: ../../reference/expressions.rst:1188 +#: ../../reference/expressions.rst:1189 msgid "" "The corresponding user-defined function is called, with an argument list " "that is one longer than the argument list of the call: the instance becomes " "the first argument." msgstr "" -#: ../../reference/expressions.rst:1192 +#: ../../reference/expressions.rst:1193 msgid "a class instance:" msgstr "" -#: ../../reference/expressions.rst:1197 +#: ../../reference/expressions.rst:1198 msgid "" "The class must define a :meth:`~object.__call__` method; the effect is then " "the same as if that method was called." msgstr "" -#: ../../reference/expressions.rst:1205 ../../reference/expressions.rst:2006 +#: ../../reference/expressions.rst:1206 ../../reference/expressions.rst:2007 msgid "Await expression" msgstr "" -#: ../../reference/expressions.rst:1207 +#: ../../reference/expressions.rst:1208 msgid "" "Suspend the execution of :term:`coroutine` on an :term:`awaitable` object. " "Can only be used inside a :term:`coroutine function`." msgstr "" -#: ../../reference/expressions.rst:1219 +#: ../../reference/expressions.rst:1220 msgid "The power operator" msgstr "" -#: ../../reference/expressions.rst:1225 +#: ../../reference/expressions.rst:1226 msgid "" "The power operator binds more tightly than unary operators on its left; it " "binds less tightly than unary operators on its right. The syntax is:" msgstr "" -#: ../../reference/expressions.rst:1231 +#: ../../reference/expressions.rst:1232 msgid "" "Thus, in an unparenthesized sequence of power and unary operators, the " "operators are evaluated from right to left (this does not constrain the " "evaluation order for the operands): ``-1**2`` results in ``-1``." msgstr "" -#: ../../reference/expressions.rst:1235 +#: ../../reference/expressions.rst:1236 msgid "" "The power operator has the same semantics as the built-in :func:`pow` " "function, when called with two arguments: it yields its left argument raised " @@ -1357,7 +1359,7 @@ msgid "" "converted to a common type, and the result is of that type." msgstr "" -#: ../../reference/expressions.rst:1240 +#: ../../reference/expressions.rst:1241 msgid "" "For int operands, the result has the same type as the operands unless the " "second argument is negative; in that case, all arguments are converted to " @@ -1365,41 +1367,41 @@ msgid "" "``100``, but ``10**-2`` returns ``0.01``." msgstr "" -#: ../../reference/expressions.rst:1245 +#: ../../reference/expressions.rst:1246 msgid "" "Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`. " "Raising a negative number to a fractional power results in a :class:" "`complex` number. (In earlier versions it raised a :exc:`ValueError`.)" msgstr "" -#: ../../reference/expressions.rst:1249 +#: ../../reference/expressions.rst:1250 msgid "" "This operation can be customized using the special :meth:`~object.__pow__` " "and :meth:`~object.__rpow__` methods." msgstr "" -#: ../../reference/expressions.rst:1255 +#: ../../reference/expressions.rst:1256 msgid "Unary arithmetic and bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1261 +#: ../../reference/expressions.rst:1262 msgid "All unary arithmetic and bitwise operations have the same priority:" msgstr "" -#: ../../reference/expressions.rst:1272 +#: ../../reference/expressions.rst:1273 msgid "" "The unary ``-`` (minus) operator yields the negation of its numeric " "argument; the operation can be overridden with the :meth:`~object.__neg__` " "special method." msgstr "" -#: ../../reference/expressions.rst:1280 +#: ../../reference/expressions.rst:1281 msgid "" "The unary ``+`` (plus) operator yields its numeric argument unchanged; the " "operation can be overridden with the :meth:`~object.__pos__` special method." msgstr "" -#: ../../reference/expressions.rst:1287 +#: ../../reference/expressions.rst:1288 msgid "" "The unary ``~`` (invert) operator yields the bitwise inversion of its " "integer argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. " @@ -1407,17 +1409,17 @@ msgid "" "meth:`~object.__invert__` special method." msgstr "" -#: ../../reference/expressions.rst:1296 +#: ../../reference/expressions.rst:1297 msgid "" "In all three cases, if the argument does not have the proper type, a :exc:" "`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1303 +#: ../../reference/expressions.rst:1304 msgid "Binary arithmetic operations" msgstr "" -#: ../../reference/expressions.rst:1307 +#: ../../reference/expressions.rst:1308 msgid "" "The binary arithmetic operations have the conventional priority levels. " "Note that some of these operations also apply to certain non-numeric types. " @@ -1425,7 +1427,7 @@ msgid "" "multiplicative operators and one for additive operators:" msgstr "" -#: ../../reference/expressions.rst:1322 +#: ../../reference/expressions.rst:1323 msgid "" "The ``*`` (multiplication) operator yields the product of its arguments. " "The arguments must either both be numbers, or one argument must be an " @@ -1435,25 +1437,25 @@ msgid "" "an empty sequence." msgstr "" -#: ../../reference/expressions.rst:1328 +#: ../../reference/expressions.rst:1329 msgid "" "This operation can be customized using the special :meth:`~object.__mul__` " "and :meth:`~object.__rmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1335 +#: ../../reference/expressions.rst:1336 msgid "" "The ``@`` (at) operator is intended to be used for matrix multiplication. " "No builtin Python types implement this operator." msgstr "" -#: ../../reference/expressions.rst:1338 +#: ../../reference/expressions.rst:1339 msgid "" "This operation can be customized using the special :meth:`~object." "__matmul__` and :meth:`~object.__rmatmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1349 +#: ../../reference/expressions.rst:1350 msgid "" "The ``/`` (division) and ``//`` (floor division) operators yield the " "quotient of their arguments. The numeric arguments are first converted to a " @@ -1463,7 +1465,7 @@ msgid "" "the :exc:`ZeroDivisionError` exception." msgstr "" -#: ../../reference/expressions.rst:1356 +#: ../../reference/expressions.rst:1357 msgid "" "The division operation can be customized using the special :meth:`~object." "__truediv__` and :meth:`~object.__rtruediv__` methods. The floor division " @@ -1471,7 +1473,7 @@ msgid "" "and :meth:`~object.__rfloordiv__` methods." msgstr "" -#: ../../reference/expressions.rst:1365 +#: ../../reference/expressions.rst:1366 msgid "" "The ``%`` (modulo) operator yields the remainder from the division of the " "first argument by the second. The numeric arguments are first converted to " @@ -1483,7 +1485,7 @@ msgid "" "absolute value of the second operand [#]_." msgstr "" -#: ../../reference/expressions.rst:1374 +#: ../../reference/expressions.rst:1375 msgid "" "The floor division and modulo operators are connected by the following " "identity: ``x == (x//y)*y + (x%y)``. Floor division and modulo are also " @@ -1491,7 +1493,7 @@ msgid "" "y, x%y)``. [#]_." msgstr "" -#: ../../reference/expressions.rst:1379 +#: ../../reference/expressions.rst:1380 msgid "" "In addition to performing the modulo operation on numbers, the ``%`` " "operator is also overloaded by string objects to perform old-style string " @@ -1500,20 +1502,20 @@ msgid "" "formatting`." msgstr "" -#: ../../reference/expressions.rst:1384 +#: ../../reference/expressions.rst:1385 msgid "" "The *modulo* operation can be customized using the special :meth:`~object." "__mod__` and :meth:`~object.__rmod__` methods." msgstr "" -#: ../../reference/expressions.rst:1387 +#: ../../reference/expressions.rst:1388 msgid "" "The floor division operator, the modulo operator, and the :func:`divmod` " "function are not defined for complex numbers. Instead, convert to a " "floating-point number using the :func:`abs` function if appropriate." msgstr "" -#: ../../reference/expressions.rst:1396 +#: ../../reference/expressions.rst:1397 msgid "" "The ``+`` (addition) operator yields the sum of its arguments. The " "arguments must either both be numbers or both be sequences of the same " @@ -1521,40 +1523,40 @@ msgid "" "then added together. In the latter case, the sequences are concatenated." msgstr "" -#: ../../reference/expressions.rst:1401 +#: ../../reference/expressions.rst:1402 msgid "" "This operation can be customized using the special :meth:`~object.__add__` " "and :meth:`~object.__radd__` methods." msgstr "" -#: ../../reference/expressions.rst:1409 +#: ../../reference/expressions.rst:1410 msgid "" "The ``-`` (subtraction) operator yields the difference of its arguments. " "The numeric arguments are first converted to a common type." msgstr "" -#: ../../reference/expressions.rst:1412 +#: ../../reference/expressions.rst:1413 msgid "" "This operation can be customized using the special :meth:`~object.__sub__` " "and :meth:`~object.__rsub__` methods." msgstr "" -#: ../../reference/expressions.rst:1419 +#: ../../reference/expressions.rst:1420 msgid "Shifting operations" msgstr "" -#: ../../reference/expressions.rst:1426 +#: ../../reference/expressions.rst:1427 msgid "" "The shifting operations have lower priority than the arithmetic operations:" msgstr "" -#: ../../reference/expressions.rst:1431 +#: ../../reference/expressions.rst:1432 msgid "" "These operators accept integers as arguments. They shift the first argument " "to the left or right by the number of bits given by the second argument." msgstr "" -#: ../../reference/expressions.rst:1434 +#: ../../reference/expressions.rst:1435 msgid "" "The left shift operation can be customized using the special :meth:`~object." "__lshift__` and :meth:`~object.__rlshift__` methods. The right shift " @@ -1562,46 +1564,46 @@ msgid "" "and :meth:`~object.__rrshift__` methods." msgstr "" -#: ../../reference/expressions.rst:1441 +#: ../../reference/expressions.rst:1442 msgid "" "A right shift by *n* bits is defined as floor division by ``pow(2,n)``. A " "left shift by *n* bits is defined as multiplication with ``pow(2,n)``." msgstr "" -#: ../../reference/expressions.rst:1448 +#: ../../reference/expressions.rst:1449 msgid "Binary bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1452 +#: ../../reference/expressions.rst:1453 msgid "Each of the three bitwise operations has a different priority level:" msgstr "" -#: ../../reference/expressions.rst:1463 +#: ../../reference/expressions.rst:1464 msgid "" "The ``&`` operator yields the bitwise AND of its arguments, which must be " "integers or one of them must be a custom object overriding :meth:`~object." "__and__` or :meth:`~object.__rand__` special methods." msgstr "" -#: ../../reference/expressions.rst:1472 +#: ../../reference/expressions.rst:1473 msgid "" "The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, " "which must be integers or one of them must be a custom object overriding :" "meth:`~object.__xor__` or :meth:`~object.__rxor__` special methods." msgstr "" -#: ../../reference/expressions.rst:1481 +#: ../../reference/expressions.rst:1482 msgid "" "The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which " "must be integers or one of them must be a custom object overriding :meth:" "`~object.__or__` or :meth:`~object.__ror__` special methods." msgstr "" -#: ../../reference/expressions.rst:1489 +#: ../../reference/expressions.rst:1490 msgid "Comparisons" msgstr "" -#: ../../reference/expressions.rst:1501 +#: ../../reference/expressions.rst:1502 msgid "" "Unlike C, all comparison operations in Python have the same priority, which " "is lower than that of any arithmetic, shifting or bitwise operation. Also " @@ -1609,14 +1611,14 @@ msgid "" "conventional in mathematics:" msgstr "" -#: ../../reference/expressions.rst:1511 +#: ../../reference/expressions.rst:1512 msgid "" "Comparisons yield boolean values: ``True`` or ``False``. Custom :dfn:`rich " "comparison methods` may return non-boolean values. In this case Python will " "call :func:`bool` on such value in boolean contexts." msgstr "" -#: ../../reference/expressions.rst:1517 +#: ../../reference/expressions.rst:1518 msgid "" "Comparisons can be chained arbitrarily, e.g., ``x < y <= z`` is equivalent " "to ``x < y and y <= z``, except that ``y`` is evaluated only once (but in " @@ -1624,7 +1626,7 @@ msgid "" "false)." msgstr "" -#: ../../reference/expressions.rst:1521 +#: ../../reference/expressions.rst:1522 msgid "" "Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*, " "*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y opN " @@ -1632,24 +1634,24 @@ msgid "" "each expression is evaluated at most once." msgstr "" -#: ../../reference/expressions.rst:1526 +#: ../../reference/expressions.rst:1527 msgid "" "Note that ``a op1 b op2 c`` doesn't imply any kind of comparison between *a* " "and *c*, so that, e.g., ``x < y > z`` is perfectly legal (though perhaps not " "pretty)." msgstr "" -#: ../../reference/expressions.rst:1533 +#: ../../reference/expressions.rst:1534 msgid "Value comparisons" msgstr "" -#: ../../reference/expressions.rst:1535 +#: ../../reference/expressions.rst:1536 msgid "" "The operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare the " "values of two objects. The objects do not need to have the same type." msgstr "" -#: ../../reference/expressions.rst:1538 +#: ../../reference/expressions.rst:1539 msgid "" "Chapter :ref:`objects` states that objects have a value (in addition to type " "and identity). The value of an object is a rather abstract notion in " @@ -1661,7 +1663,7 @@ msgid "" "indirectly, by means of their comparison implementation." msgstr "" -#: ../../reference/expressions.rst:1547 +#: ../../reference/expressions.rst:1548 msgid "" "Because all types are (direct or indirect) subtypes of :class:`object`, they " "inherit the default comparison behavior from :class:`object`. Types can " @@ -1669,7 +1671,7 @@ msgid "" "methods` like :meth:`~object.__lt__`, described in :ref:`customization`." msgstr "" -#: ../../reference/expressions.rst:1553 +#: ../../reference/expressions.rst:1554 msgid "" "The default behavior for equality comparison (``==`` and ``!=``) is based on " "the identity of the objects. Hence, equality comparison of instances with " @@ -1679,14 +1681,14 @@ msgid "" "``x is y`` implies ``x == y``)." msgstr "" -#: ../../reference/expressions.rst:1560 +#: ../../reference/expressions.rst:1561 msgid "" "A default order comparison (``<``, ``>``, ``<=``, and ``>=``) is not " "provided; an attempt raises :exc:`TypeError`. A motivation for this default " "behavior is the lack of a similar invariant as for equality." msgstr "" -#: ../../reference/expressions.rst:1564 +#: ../../reference/expressions.rst:1565 msgid "" "The behavior of the default equality comparison, that instances with " "different identities are always unequal, may be in contrast to what types " @@ -1695,13 +1697,13 @@ msgid "" "in fact, a number of built-in types have done that." msgstr "" -#: ../../reference/expressions.rst:1570 +#: ../../reference/expressions.rst:1571 msgid "" "The following list describes the comparison behavior of the most important " "built-in types." msgstr "" -#: ../../reference/expressions.rst:1573 +#: ../../reference/expressions.rst:1574 msgid "" "Numbers of built-in numeric types (:ref:`typesnumeric`) and of the standard " "library types :class:`fractions.Fraction` and :class:`decimal.Decimal` can " @@ -1711,7 +1713,7 @@ msgid "" "of precision." msgstr "" -#: ../../reference/expressions.rst:1580 +#: ../../reference/expressions.rst:1581 msgid "" "The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are " "special. Any ordered comparison of a number to a not-a-number value is " @@ -1721,32 +1723,32 @@ msgid "" "is compliant with IEEE 754." msgstr "" -#: ../../reference/expressions.rst:1587 +#: ../../reference/expressions.rst:1588 msgid "" "``None`` and :data:`NotImplemented` are singletons. :PEP:`8` advises that " "comparisons for singletons should always be done with ``is`` or ``is not``, " "never the equality operators." msgstr "" -#: ../../reference/expressions.rst:1591 +#: ../../reference/expressions.rst:1592 msgid "" "Binary sequences (instances of :class:`bytes` or :class:`bytearray`) can be " "compared within and across their types. They compare lexicographically " "using the numeric values of their elements." msgstr "" -#: ../../reference/expressions.rst:1595 +#: ../../reference/expressions.rst:1596 msgid "" "Strings (instances of :class:`str`) compare lexicographically using the " "numerical Unicode code points (the result of the built-in function :func:" "`ord`) of their characters. [#]_" msgstr "" -#: ../../reference/expressions.rst:1599 +#: ../../reference/expressions.rst:1600 msgid "Strings and binary sequences cannot be directly compared." msgstr "" -#: ../../reference/expressions.rst:1601 +#: ../../reference/expressions.rst:1602 msgid "" "Sequences (instances of :class:`tuple`, :class:`list`, or :class:`range`) " "can be compared only within each of their types, with the restriction that " @@ -1755,7 +1757,7 @@ msgid "" "raises :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1607 +#: ../../reference/expressions.rst:1608 msgid "" "Sequences compare lexicographically using comparison of corresponding " "elements. The built-in containers typically assume identical objects are " @@ -1763,19 +1765,19 @@ msgid "" "objects to improve performance and to maintain their internal invariants." msgstr "" -#: ../../reference/expressions.rst:1612 +#: ../../reference/expressions.rst:1613 msgid "" "Lexicographical comparison between built-in collections works as follows:" msgstr "" -#: ../../reference/expressions.rst:1614 +#: ../../reference/expressions.rst:1615 msgid "" "For two collections to compare equal, they must be of the same type, have " "the same length, and each pair of corresponding elements must compare equal " "(for example, ``[1,2] == (1,2)`` is false because the type is not the same)." msgstr "" -#: ../../reference/expressions.rst:1619 +#: ../../reference/expressions.rst:1620 msgid "" "Collections that support order comparison are ordered the same as their " "first unequal elements (for example, ``[1,2,x] <= [1,2,y]`` has the same " @@ -1784,25 +1786,25 @@ msgid "" "true)." msgstr "" -#: ../../reference/expressions.rst:1625 +#: ../../reference/expressions.rst:1626 msgid "" "Mappings (instances of :class:`dict`) compare equal if and only if they have " "equal ``(key, value)`` pairs. Equality comparison of the keys and values " "enforces reflexivity." msgstr "" -#: ../../reference/expressions.rst:1629 +#: ../../reference/expressions.rst:1630 msgid "" "Order comparisons (``<``, ``>``, ``<=``, and ``>=``) raise :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1631 +#: ../../reference/expressions.rst:1632 msgid "" "Sets (instances of :class:`set` or :class:`frozenset`) can be compared " "within and across their types." msgstr "" -#: ../../reference/expressions.rst:1634 +#: ../../reference/expressions.rst:1635 msgid "" "They define order comparison operators to mean subset and superset tests. " "Those relations do not define total orderings (for example, the two sets " @@ -1813,110 +1815,110 @@ msgid "" "sets as inputs)." msgstr "" -#: ../../reference/expressions.rst:1642 +#: ../../reference/expressions.rst:1643 msgid "Comparison of sets enforces reflexivity of its elements." msgstr "" -#: ../../reference/expressions.rst:1644 +#: ../../reference/expressions.rst:1645 msgid "" "Most other built-in types have no comparison methods implemented, so they " "inherit the default comparison behavior." msgstr "" -#: ../../reference/expressions.rst:1647 +#: ../../reference/expressions.rst:1648 msgid "" "User-defined classes that customize their comparison behavior should follow " "some consistency rules, if possible:" msgstr "" -#: ../../reference/expressions.rst:1650 +#: ../../reference/expressions.rst:1651 msgid "" "Equality comparison should be reflexive. In other words, identical objects " "should compare equal:" msgstr "" -#: ../../reference/expressions.rst:1653 +#: ../../reference/expressions.rst:1654 msgid "``x is y`` implies ``x == y``" msgstr "" -#: ../../reference/expressions.rst:1655 +#: ../../reference/expressions.rst:1656 msgid "" "Comparison should be symmetric. In other words, the following expressions " "should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1658 +#: ../../reference/expressions.rst:1659 msgid "``x == y`` and ``y == x``" msgstr "``x == y`` 和 ``y == x``" -#: ../../reference/expressions.rst:1660 +#: ../../reference/expressions.rst:1661 msgid "``x != y`` and ``y != x``" msgstr "``x != y`` 和 ``y != x``" -#: ../../reference/expressions.rst:1662 +#: ../../reference/expressions.rst:1663 msgid "``x < y`` and ``y > x``" msgstr "``x < y`` 和 ``y > x``" -#: ../../reference/expressions.rst:1664 +#: ../../reference/expressions.rst:1665 msgid "``x <= y`` and ``y >= x``" msgstr "``x <= y`` 和 ``y >= x``" -#: ../../reference/expressions.rst:1666 +#: ../../reference/expressions.rst:1667 msgid "" "Comparison should be transitive. The following (non-exhaustive) examples " "illustrate that:" msgstr "" -#: ../../reference/expressions.rst:1669 +#: ../../reference/expressions.rst:1670 msgid "``x > y and y > z`` implies ``x > z``" msgstr "``x > y and y > z`` 暗示了 ``x > z``" -#: ../../reference/expressions.rst:1671 +#: ../../reference/expressions.rst:1672 msgid "``x < y and y <= z`` implies ``x < z``" msgstr "``x < y and y <= z`` 暗示了 ``x < z``" -#: ../../reference/expressions.rst:1673 +#: ../../reference/expressions.rst:1674 msgid "" "Inverse comparison should result in the boolean negation. In other words, " "the following expressions should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1676 +#: ../../reference/expressions.rst:1677 msgid "``x == y`` and ``not x != y``" msgstr "``x == y`` 和 ``not x != y``" -#: ../../reference/expressions.rst:1678 +#: ../../reference/expressions.rst:1679 msgid "``x < y`` and ``not x >= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1680 +#: ../../reference/expressions.rst:1681 msgid "``x > y`` and ``not x <= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1682 +#: ../../reference/expressions.rst:1683 msgid "" "The last two expressions apply to totally ordered collections (e.g. to " "sequences, but not to sets or mappings). See also the :func:`~functools." "total_ordering` decorator." msgstr "" -#: ../../reference/expressions.rst:1686 +#: ../../reference/expressions.rst:1687 msgid "" "The :func:`hash` result should be consistent with equality. Objects that are " "equal should either have the same hash value, or be marked as unhashable." msgstr "" -#: ../../reference/expressions.rst:1690 +#: ../../reference/expressions.rst:1691 msgid "" "Python does not enforce these consistency rules. In fact, the not-a-number " "values are an example for not following these rules." msgstr "" -#: ../../reference/expressions.rst:1699 +#: ../../reference/expressions.rst:1700 msgid "Membership test operations" msgstr "" -#: ../../reference/expressions.rst:1701 +#: ../../reference/expressions.rst:1702 msgid "" "The operators :keyword:`in` and :keyword:`not in` test for membership. ``x " "in s`` evaluates to ``True`` if *x* is a member of *s*, and ``False`` " @@ -1927,7 +1929,7 @@ msgid "" "expression ``x in y`` is equivalent to ``any(x is e or x == e for e in y)``." msgstr "" -#: ../../reference/expressions.rst:1709 +#: ../../reference/expressions.rst:1710 msgid "" "For the string and bytes types, ``x in y`` is ``True`` if and only if *x* is " "a substring of *y*. An equivalent test is ``y.find(x) != -1``. Empty " @@ -1935,14 +1937,14 @@ msgid "" "``\"\" in \"abc\"`` will return ``True``." msgstr "" -#: ../../reference/expressions.rst:1714 +#: ../../reference/expressions.rst:1715 msgid "" "For user-defined classes which define the :meth:`~object.__contains__` " "method, ``x in y`` returns ``True`` if ``y.__contains__(x)`` returns a true " "value, and ``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1718 +#: ../../reference/expressions.rst:1719 msgid "" "For user-defined classes which do not define :meth:`~object.__contains__` " "but do define :meth:`~object.__iter__`, ``x in y`` is ``True`` if some value " @@ -1951,7 +1953,7 @@ msgid "" "it is as if :keyword:`in` raised that exception." msgstr "" -#: ../../reference/expressions.rst:1724 +#: ../../reference/expressions.rst:1725 msgid "" "Lastly, the old-style iteration protocol is tried: if a class defines :meth:" "`~object.__getitem__`, ``x in y`` is ``True`` if and only if there is a non-" @@ -1960,17 +1962,17 @@ msgid "" "exception is raised, it is as if :keyword:`in` raised that exception)." msgstr "" -#: ../../reference/expressions.rst:1736 +#: ../../reference/expressions.rst:1737 msgid "" "The operator :keyword:`not in` is defined to have the inverse truth value " "of :keyword:`in`." msgstr "" -#: ../../reference/expressions.rst:1749 +#: ../../reference/expressions.rst:1750 msgid "Identity comparisons" msgstr "" -#: ../../reference/expressions.rst:1751 +#: ../../reference/expressions.rst:1752 msgid "" "The operators :keyword:`is` and :keyword:`is not` test for an object's " "identity: ``x is y`` is true if and only if *x* and *y* are the same " @@ -1978,11 +1980,11 @@ msgid "" "``x is not y`` yields the inverse truth value. [#]_" msgstr "" -#: ../../reference/expressions.rst:1763 +#: ../../reference/expressions.rst:1764 msgid "Boolean operations" msgstr "" -#: ../../reference/expressions.rst:1774 +#: ../../reference/expressions.rst:1775 msgid "" "In the context of Boolean operations, and also when expressions are used by " "control flow statements, the following values are interpreted as false: " @@ -1993,25 +1995,25 @@ msgid "" "__bool__` method." msgstr "" -#: ../../reference/expressions.rst:1783 +#: ../../reference/expressions.rst:1784 msgid "" "The operator :keyword:`not` yields ``True`` if its argument is false, " "``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1788 +#: ../../reference/expressions.rst:1789 msgid "" "The expression ``x and y`` first evaluates *x*; if *x* is false, its value " "is returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1793 +#: ../../reference/expressions.rst:1794 msgid "" "The expression ``x or y`` first evaluates *x*; if *x* is true, its value is " "returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1796 +#: ../../reference/expressions.rst:1797 msgid "" "Note that neither :keyword:`and` nor :keyword:`or` restrict the value and " "type they return to ``False`` and ``True``, but rather return the last " @@ -2022,11 +2024,11 @@ msgid "" "argument (for example, ``not 'foo'`` produces ``False`` rather than ``''``.)" msgstr "" -#: ../../reference/expressions.rst:1815 +#: ../../reference/expressions.rst:1816 msgid "Assignment expressions" msgstr "" -#: ../../reference/expressions.rst:1820 +#: ../../reference/expressions.rst:1821 msgid "" "An assignment expression (sometimes also called a \"named expression\" or " "\"walrus\") assigns an :token:`~python-grammar:expression` to an :token:" @@ -2034,11 +2036,11 @@ msgid "" "`~python-grammar:expression`." msgstr "" -#: ../../reference/expressions.rst:1825 +#: ../../reference/expressions.rst:1826 msgid "One common use case is when handling matched regular expressions:" msgstr "" -#: ../../reference/expressions.rst:1827 +#: ../../reference/expressions.rst:1828 msgid "" "if matching := pattern.search(data):\n" " do_something(matching)" @@ -2046,11 +2048,11 @@ msgstr "" "if matching := pattern.search(data):\n" " do_something(matching)" -#: ../../reference/expressions.rst:1832 +#: ../../reference/expressions.rst:1833 msgid "Or, when processing a file stream in chunks:" msgstr "" -#: ../../reference/expressions.rst:1834 +#: ../../reference/expressions.rst:1835 msgid "" "while chunk := file.read(9000):\n" " process(chunk)" @@ -2058,7 +2060,7 @@ msgstr "" "while chunk := file.read(9000):\n" " process(chunk)" -#: ../../reference/expressions.rst:1839 +#: ../../reference/expressions.rst:1840 msgid "" "Assignment expressions must be surrounded by parentheses when used as " "expression statements and when used as sub-expressions in slicing, " @@ -2068,36 +2070,36 @@ msgid "" "and ``while`` statements." msgstr "" -#: ../../reference/expressions.rst:1847 +#: ../../reference/expressions.rst:1848 msgid "See :pep:`572` for more details about assignment expressions." msgstr "" -#: ../../reference/expressions.rst:1854 +#: ../../reference/expressions.rst:1855 msgid "Conditional expressions" msgstr "" -#: ../../reference/expressions.rst:1866 +#: ../../reference/expressions.rst:1867 msgid "" "Conditional expressions (sometimes called a \"ternary operator\") have the " "lowest priority of all Python operations." msgstr "" -#: ../../reference/expressions.rst:1869 +#: ../../reference/expressions.rst:1870 msgid "" "The expression ``x if C else y`` first evaluates the condition, *C* rather " "than *x*. If *C* is true, *x* is evaluated and its value is returned; " "otherwise, *y* is evaluated and its value is returned." msgstr "" -#: ../../reference/expressions.rst:1873 +#: ../../reference/expressions.rst:1874 msgid "See :pep:`308` for more details about conditional expressions." msgstr "" -#: ../../reference/expressions.rst:1880 +#: ../../reference/expressions.rst:1881 msgid "Lambdas" msgstr "" -#: ../../reference/expressions.rst:1891 +#: ../../reference/expressions.rst:1892 msgid "" "Lambda expressions (sometimes called lambda forms) are used to create " "anonymous functions. The expression ``lambda parameters: expression`` yields " @@ -2105,7 +2107,7 @@ msgid "" "defined with:" msgstr "" -#: ../../reference/expressions.rst:1895 +#: ../../reference/expressions.rst:1896 msgid "" "def <lambda>(parameters):\n" " return expression" @@ -2113,25 +2115,25 @@ msgstr "" "def <lambda>(parameters):\n" " return expression" -#: ../../reference/expressions.rst:1900 +#: ../../reference/expressions.rst:1901 msgid "" "See section :ref:`function` for the syntax of parameter lists. Note that " "functions created with lambda expressions cannot contain statements or " "annotations." msgstr "" -#: ../../reference/expressions.rst:1908 +#: ../../reference/expressions.rst:1909 msgid "Expression lists" msgstr "" -#: ../../reference/expressions.rst:1924 +#: ../../reference/expressions.rst:1925 msgid "" "Except when part of a list or set display, an expression list containing at " "least one comma yields a tuple. The length of the tuple is the number of " "expressions in the list. The expressions are evaluated from left to right." msgstr "" -#: ../../reference/expressions.rst:1933 +#: ../../reference/expressions.rst:1934 msgid "" "An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be " "an :term:`iterable`. The iterable is expanded into a sequence of items, " @@ -2139,16 +2141,16 @@ msgid "" "unpacking." msgstr "" -#: ../../reference/expressions.rst:1938 +#: ../../reference/expressions.rst:1939 msgid "" "Iterable unpacking in expression lists, originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1941 +#: ../../reference/expressions.rst:1942 msgid "Any item in an expression list may be starred. See :pep:`646`." msgstr "" -#: ../../reference/expressions.rst:1946 +#: ../../reference/expressions.rst:1947 msgid "" "A trailing comma is required only to create a one-item tuple, such as ``1," "``; it is optional in all other cases. A single expression without a " @@ -2157,24 +2159,24 @@ msgid "" "``()``.)" msgstr "" -#: ../../reference/expressions.rst:1957 +#: ../../reference/expressions.rst:1958 msgid "Evaluation order" msgstr "" -#: ../../reference/expressions.rst:1961 +#: ../../reference/expressions.rst:1962 msgid "" "Python evaluates expressions from left to right. Notice that while " "evaluating an assignment, the right-hand side is evaluated before the left-" "hand side." msgstr "" -#: ../../reference/expressions.rst:1964 +#: ../../reference/expressions.rst:1965 msgid "" "In the following lines, expressions will be evaluated in the arithmetic " "order of their suffixes::" msgstr "" -#: ../../reference/expressions.rst:1967 +#: ../../reference/expressions.rst:1968 msgid "" "expr1, expr2, expr3, expr4\n" "(expr1, expr2, expr3, expr4)\n" @@ -2190,11 +2192,11 @@ msgstr "" "expr1(expr2, expr3, *expr4, **expr5)\n" "expr3, expr4 = expr1, expr2" -#: ../../reference/expressions.rst:1978 +#: ../../reference/expressions.rst:1979 msgid "Operator precedence" msgstr "" -#: ../../reference/expressions.rst:1983 +#: ../../reference/expressions.rst:1984 msgid "" "The following table summarizes the operator precedence in Python, from " "highest precedence (most binding) to lowest precedence (least binding). " @@ -2204,176 +2206,176 @@ msgid "" "group from right to left)." msgstr "" -#: ../../reference/expressions.rst:1989 +#: ../../reference/expressions.rst:1990 msgid "" "Note that comparisons, membership tests, and identity tests, all have the " "same precedence and have a left-to-right chaining feature as described in " "the :ref:`comparisons` section." msgstr "" -#: ../../reference/expressions.rst:1995 +#: ../../reference/expressions.rst:1996 msgid "Operator" msgstr "運算子" -#: ../../reference/expressions.rst:1995 +#: ../../reference/expressions.rst:1996 msgid "Description" msgstr "描述" -#: ../../reference/expressions.rst:1997 +#: ../../reference/expressions.rst:1998 msgid "``(expressions...)``," msgstr "``(expressions...)``," -#: ../../reference/expressions.rst:1999 +#: ../../reference/expressions.rst:2000 msgid "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" msgstr "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" -#: ../../reference/expressions.rst:1997 +#: ../../reference/expressions.rst:1998 msgid "" "Binding or parenthesized expression, list display, dictionary display, set " "display" msgstr "" -#: ../../reference/expressions.rst:2003 +#: ../../reference/expressions.rst:2004 msgid "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" msgstr "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" -#: ../../reference/expressions.rst:2003 +#: ../../reference/expressions.rst:2004 msgid "Subscription, slicing, call, attribute reference" msgstr "" -#: ../../reference/expressions.rst:2006 +#: ../../reference/expressions.rst:2007 msgid ":keyword:`await x <await>`" msgstr ":keyword:`await x <await>`" -#: ../../reference/expressions.rst:2008 +#: ../../reference/expressions.rst:2009 msgid "``**``" msgstr "``**``" -#: ../../reference/expressions.rst:2008 +#: ../../reference/expressions.rst:2009 msgid "Exponentiation [#]_" msgstr "" -#: ../../reference/expressions.rst:2010 +#: ../../reference/expressions.rst:2011 msgid "``+x``, ``-x``, ``~x``" msgstr "``+x``, ``-x``, ``~x``" -#: ../../reference/expressions.rst:2010 +#: ../../reference/expressions.rst:2011 msgid "Positive, negative, bitwise NOT" msgstr "" -#: ../../reference/expressions.rst:2012 +#: ../../reference/expressions.rst:2013 msgid "``*``, ``@``, ``/``, ``//``, ``%``" msgstr "``*``, ``@``, ``/``, ``//``, ``%``" -#: ../../reference/expressions.rst:2012 +#: ../../reference/expressions.rst:2013 msgid "" "Multiplication, matrix multiplication, division, floor division, remainder " "[#]_" msgstr "" -#: ../../reference/expressions.rst:2016 +#: ../../reference/expressions.rst:2017 msgid "``+``, ``-``" msgstr "``+``, ``-``" -#: ../../reference/expressions.rst:2016 +#: ../../reference/expressions.rst:2017 msgid "Addition and subtraction" msgstr "" -#: ../../reference/expressions.rst:2018 +#: ../../reference/expressions.rst:2019 msgid "``<<``, ``>>``" msgstr "``<<``, ``>>``" -#: ../../reference/expressions.rst:2018 +#: ../../reference/expressions.rst:2019 msgid "Shifts" msgstr "" -#: ../../reference/expressions.rst:2020 +#: ../../reference/expressions.rst:2021 msgid "``&``" msgstr "``&``" -#: ../../reference/expressions.rst:2020 +#: ../../reference/expressions.rst:2021 msgid "Bitwise AND" msgstr "" -#: ../../reference/expressions.rst:2022 +#: ../../reference/expressions.rst:2023 msgid "``^``" msgstr "``^``" -#: ../../reference/expressions.rst:2022 +#: ../../reference/expressions.rst:2023 msgid "Bitwise XOR" msgstr "" -#: ../../reference/expressions.rst:2024 +#: ../../reference/expressions.rst:2025 msgid "``|``" msgstr "``|``" -#: ../../reference/expressions.rst:2024 +#: ../../reference/expressions.rst:2025 msgid "Bitwise OR" msgstr "" -#: ../../reference/expressions.rst:2026 +#: ../../reference/expressions.rst:2027 msgid "" ":keyword:`in`, :keyword:`not in`, :keyword:`is`, :keyword:`is not`, ``<``, " "``<=``, ``>``, ``>=``, ``!=``, ``==``" msgstr "" -#: ../../reference/expressions.rst:2026 +#: ../../reference/expressions.rst:2027 msgid "Comparisons, including membership tests and identity tests" msgstr "" -#: ../../reference/expressions.rst:2030 +#: ../../reference/expressions.rst:2031 msgid ":keyword:`not x <not>`" msgstr ":keyword:`not x <not>`" -#: ../../reference/expressions.rst:2030 +#: ../../reference/expressions.rst:2031 msgid "Boolean NOT" msgstr "" -#: ../../reference/expressions.rst:2032 +#: ../../reference/expressions.rst:2033 msgid ":keyword:`and`" msgstr ":keyword:`and`" -#: ../../reference/expressions.rst:2032 +#: ../../reference/expressions.rst:2033 msgid "Boolean AND" msgstr "" -#: ../../reference/expressions.rst:2034 +#: ../../reference/expressions.rst:2035 msgid ":keyword:`or`" msgstr ":keyword:`or`" -#: ../../reference/expressions.rst:2034 +#: ../../reference/expressions.rst:2035 msgid "Boolean OR" msgstr "" -#: ../../reference/expressions.rst:2036 +#: ../../reference/expressions.rst:2037 msgid ":keyword:`if <if_expr>` -- :keyword:`!else`" msgstr ":keyword:`if <if_expr>` -- :keyword:`!else`" -#: ../../reference/expressions.rst:2036 +#: ../../reference/expressions.rst:2037 msgid "Conditional expression" msgstr "" -#: ../../reference/expressions.rst:2038 +#: ../../reference/expressions.rst:2039 msgid ":keyword:`lambda`" msgstr ":keyword:`lambda`" -#: ../../reference/expressions.rst:2038 +#: ../../reference/expressions.rst:2039 msgid "Lambda expression" msgstr "" -#: ../../reference/expressions.rst:2040 +#: ../../reference/expressions.rst:2041 msgid "``:=``" msgstr "``:=``" -#: ../../reference/expressions.rst:2040 +#: ../../reference/expressions.rst:2041 msgid "Assignment expression" msgstr "" -#: ../../reference/expressions.rst:2045 +#: ../../reference/expressions.rst:2046 msgid "Footnotes" msgstr "註解" -#: ../../reference/expressions.rst:2046 +#: ../../reference/expressions.rst:2047 msgid "" "While ``abs(x%y) < abs(y)`` is true mathematically, for floats it may not be " "true numerically due to roundoff. For example, and assuming a platform on " @@ -2385,7 +2387,7 @@ msgid "" "approach is more appropriate depends on the application." msgstr "" -#: ../../reference/expressions.rst:2055 +#: ../../reference/expressions.rst:2056 msgid "" "If x is very close to an exact integer multiple of y, it's possible for ``x//" "y`` to be one larger than ``(x-x%y)//y`` due to rounding. In such cases, " @@ -2393,7 +2395,7 @@ msgid "" "* y + x % y`` be very close to ``x``." msgstr "" -#: ../../reference/expressions.rst:2060 +#: ../../reference/expressions.rst:2061 msgid "" "The Unicode standard distinguishes between :dfn:`code points` (e.g. U+0041) " "and :dfn:`abstract characters` (e.g. \"LATIN CAPITAL LETTER A\"). While most " @@ -2407,7 +2409,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: ../../reference/expressions.rst:2071 +#: ../../reference/expressions.rst:2072 msgid "" "The comparison operators on strings compare at the level of Unicode code " "points. This may be counter-intuitive to humans. For example, ``\"\\u00C7\" " @@ -2415,13 +2417,13 @@ msgid "" "same abstract character \"LATIN CAPITAL LETTER C WITH CEDILLA\"." msgstr "" -#: ../../reference/expressions.rst:2076 +#: ../../reference/expressions.rst:2077 msgid "" "To compare strings at the level of abstract characters (that is, in a way " "intuitive to humans), use :func:`unicodedata.normalize`." msgstr "" -#: ../../reference/expressions.rst:2079 +#: ../../reference/expressions.rst:2080 msgid "" "Due to automatic garbage-collection, free lists, and the dynamic nature of " "descriptors, you may notice seemingly unusual behaviour in certain uses of " @@ -2429,22 +2431,22 @@ msgid "" "instance methods, or constants. Check their documentation for more info." msgstr "" -#: ../../reference/expressions.rst:2084 +#: ../../reference/expressions.rst:2085 msgid "" "The power operator ``**`` binds less tightly than an arithmetic or bitwise " "unary operator on its right, that is, ``2**-1`` is ``0.5``." msgstr "" -#: ../../reference/expressions.rst:2087 +#: ../../reference/expressions.rst:2088 msgid "" "The ``%`` operator is also used for string formatting; the same precedence " "applies." msgstr "" #: ../../reference/expressions.rst:8 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1765 -#: ../../reference/expressions.rst:1805 ../../reference/expressions.rst:1856 -#: ../../reference/expressions.rst:1882 ../../reference/expressions.rst:1910 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1766 +#: ../../reference/expressions.rst:1806 ../../reference/expressions.rst:1857 +#: ../../reference/expressions.rst:1883 ../../reference/expressions.rst:1911 msgid "expression" msgstr "" @@ -2452,8 +2454,8 @@ msgstr "" msgid "BNF" msgstr "BNF" -#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1257 -#: ../../reference/expressions.rst:1305 +#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1258 +#: ../../reference/expressions.rst:1306 msgid "arithmetic" msgstr "" @@ -2476,8 +2478,8 @@ msgstr "" #: ../../reference/expressions.rst:74 ../../reference/expressions.rst:569 #: ../../reference/expressions.rst:624 ../../reference/expressions.rst:753 #: ../../reference/expressions.rst:805 ../../reference/expressions.rst:851 -#: ../../reference/expressions.rst:1294 ../../reference/expressions.rst:1343 -#: ../../reference/expressions.rst:1439 +#: ../../reference/expressions.rst:1295 ../../reference/expressions.rst:1344 +#: ../../reference/expressions.rst:1440 msgid "exception" msgstr "" @@ -2519,9 +2521,9 @@ msgstr "type(型別)" #: ../../reference/expressions.rst:557 ../../reference/expressions.rst:743 #: ../../reference/expressions.rst:851 ../../reference/expressions.rst:880 #: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1001 -#: ../../reference/expressions.rst:1149 ../../reference/expressions.rst:1162 -#: ../../reference/expressions.rst:1176 ../../reference/expressions.rst:1183 -#: ../../reference/expressions.rst:1730 ../../reference/expressions.rst:1922 +#: ../../reference/expressions.rst:1149 ../../reference/expressions.rst:1163 +#: ../../reference/expressions.rst:1177 ../../reference/expressions.rst:1184 +#: ../../reference/expressions.rst:1731 ../../reference/expressions.rst:1923 msgid "object" msgstr "object(物件)" @@ -2543,18 +2545,18 @@ msgid "empty" msgstr "" #: ../../reference/expressions.rst:175 ../../reference/expressions.rst:880 -#: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1922 +#: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1923 msgid "tuple" msgstr "" -#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1944 +#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1945 msgid "comma" msgstr "" #: ../../reference/expressions.rst:181 ../../reference/expressions.rst:275 #: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 #: ../../reference/expressions.rst:951 ../../reference/expressions.rst:1001 -#: ../../reference/expressions.rst:1910 +#: ../../reference/expressions.rst:1911 msgid ", (comma)" msgstr ", (逗號)" @@ -2571,7 +2573,7 @@ msgstr "for" msgid "in comprehensions" msgstr "於 comprehensions(綜合運算)" -#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1856 +#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1857 msgid "if" msgstr "if" @@ -2579,13 +2581,13 @@ msgstr "if" msgid "async for" msgstr "async for" -#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1201 +#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1202 msgid "await" msgstr "await" #: ../../reference/expressions.rst:275 ../../reference/expressions.rst:851 #: ../../reference/expressions.rst:880 ../../reference/expressions.rst:957 -#: ../../reference/expressions.rst:1910 +#: ../../reference/expressions.rst:1911 msgid "list" msgstr "list(串列)" @@ -2603,7 +2605,7 @@ msgid "list expression" msgstr "list expression(串列運算式)" #: ../../reference/expressions.rst:275 ../../reference/expressions.rst:301 -#: ../../reference/expressions.rst:1910 +#: ../../reference/expressions.rst:1911 msgid "expression list" msgstr "expression list(運算式串列)" @@ -2641,7 +2643,7 @@ msgid "dictionary expression" msgstr "dictionary expression(字典運算式)" #: ../../reference/expressions.rst:329 ../../reference/expressions.rst:951 -#: ../../reference/expressions.rst:1882 +#: ../../reference/expressions.rst:1883 msgid ": (colon)" msgstr ": (冒號)" @@ -2654,12 +2656,12 @@ msgid "in dictionary displays" msgstr "於字典顯示" #: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1084 -#: ../../reference/expressions.rst:1929 +#: ../../reference/expressions.rst:1930 msgid "unpacking" msgstr "unpacking(解包)" #: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1114 -#: ../../reference/expressions.rst:1221 +#: ../../reference/expressions.rst:1222 msgid "**" msgstr "**" @@ -2676,7 +2678,7 @@ msgstr "generator(產生器)" msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1201 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1202 msgid "keyword" msgstr "keyword(關鍵字)" @@ -2689,7 +2691,7 @@ msgid "from" msgstr "from" #: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1149 -#: ../../reference/expressions.rst:1162 ../../reference/expressions.rst:1882 +#: ../../reference/expressions.rst:1163 ../../reference/expressions.rst:1883 msgid "function" msgstr "function (函式)" @@ -2754,7 +2756,7 @@ msgid "subscription" msgstr "subscription(下標)" #: ../../reference/expressions.rst:880 ../../reference/expressions.rst:957 -#: ../../reference/expressions.rst:1730 +#: ../../reference/expressions.rst:1731 msgid "sequence" msgstr "sequence(序列)" @@ -2800,8 +2802,8 @@ msgid "callable" msgstr "callable(可呼叫物件)" #: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1149 -#: ../../reference/expressions.rst:1162 ../../reference/expressions.rst:1176 -#: ../../reference/expressions.rst:1183 ../../reference/expressions.rst:1193 +#: ../../reference/expressions.rst:1163 ../../reference/expressions.rst:1177 +#: ../../reference/expressions.rst:1184 ../../reference/expressions.rst:1194 msgid "call" msgstr "call(呼叫)" @@ -2830,8 +2832,8 @@ msgstr "於函式呼叫中" msgid "parameter" msgstr "parameter(參數)" -#: ../../reference/expressions.rst:1084 ../../reference/expressions.rst:1318 -#: ../../reference/expressions.rst:1929 +#: ../../reference/expressions.rst:1084 ../../reference/expressions.rst:1319 +#: ../../reference/expressions.rst:1930 msgid "* (asterisk)" msgstr "* (星號)" @@ -2843,366 +2845,366 @@ msgstr "user-defined(使用者定義)" msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" -#: ../../reference/expressions.rst:1162 +#: ../../reference/expressions.rst:1163 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../reference/expressions.rst:1162 +#: ../../reference/expressions.rst:1163 msgid "method" msgstr "method(方法)" -#: ../../reference/expressions.rst:1162 +#: ../../reference/expressions.rst:1163 msgid "built-in method" msgstr "built-in method(內建方法)" -#: ../../reference/expressions.rst:1176 +#: ../../reference/expressions.rst:1177 msgid "class" msgstr "class(類別)" -#: ../../reference/expressions.rst:1176 +#: ../../reference/expressions.rst:1177 msgid "class object" msgstr "class object(類別物件)" -#: ../../reference/expressions.rst:1183 +#: ../../reference/expressions.rst:1184 msgid "class instance" msgstr "class instance(類別實例)" -#: ../../reference/expressions.rst:1183 ../../reference/expressions.rst:1193 +#: ../../reference/expressions.rst:1184 ../../reference/expressions.rst:1194 msgid "instance" msgstr "instance(實例)" -#: ../../reference/expressions.rst:1193 +#: ../../reference/expressions.rst:1194 msgid "__call__() (object method)" msgstr "__call__() (物件方法)" -#: ../../reference/expressions.rst:1221 +#: ../../reference/expressions.rst:1222 msgid "power" msgstr "power(次方)" -#: ../../reference/expressions.rst:1221 ../../reference/expressions.rst:1257 -#: ../../reference/expressions.rst:1305 ../../reference/expressions.rst:1421 -#: ../../reference/expressions.rst:1450 ../../reference/expressions.rst:1765 +#: ../../reference/expressions.rst:1222 ../../reference/expressions.rst:1258 +#: ../../reference/expressions.rst:1306 ../../reference/expressions.rst:1422 +#: ../../reference/expressions.rst:1451 ../../reference/expressions.rst:1766 msgid "operation" msgstr "operation(操作)" -#: ../../reference/expressions.rst:1221 ../../reference/expressions.rst:1266 -#: ../../reference/expressions.rst:1275 ../../reference/expressions.rst:1283 -#: ../../reference/expressions.rst:1318 ../../reference/expressions.rst:1331 -#: ../../reference/expressions.rst:1343 ../../reference/expressions.rst:1361 -#: ../../reference/expressions.rst:1391 ../../reference/expressions.rst:1404 -#: ../../reference/expressions.rst:1421 ../../reference/expressions.rst:1459 -#: ../../reference/expressions.rst:1467 ../../reference/expressions.rst:1476 -#: ../../reference/expressions.rst:1491 ../../reference/expressions.rst:1730 -#: ../../reference/expressions.rst:1739 ../../reference/expressions.rst:1781 -#: ../../reference/expressions.rst:1786 ../../reference/expressions.rst:1791 -#: ../../reference/expressions.rst:1856 ../../reference/expressions.rst:1980 +#: ../../reference/expressions.rst:1222 ../../reference/expressions.rst:1267 +#: ../../reference/expressions.rst:1276 ../../reference/expressions.rst:1284 +#: ../../reference/expressions.rst:1319 ../../reference/expressions.rst:1332 +#: ../../reference/expressions.rst:1344 ../../reference/expressions.rst:1362 +#: ../../reference/expressions.rst:1392 ../../reference/expressions.rst:1405 +#: ../../reference/expressions.rst:1422 ../../reference/expressions.rst:1460 +#: ../../reference/expressions.rst:1468 ../../reference/expressions.rst:1477 +#: ../../reference/expressions.rst:1492 ../../reference/expressions.rst:1731 +#: ../../reference/expressions.rst:1740 ../../reference/expressions.rst:1782 +#: ../../reference/expressions.rst:1787 ../../reference/expressions.rst:1792 +#: ../../reference/expressions.rst:1857 ../../reference/expressions.rst:1981 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/expressions.rst:1257 +#: ../../reference/expressions.rst:1258 msgid "unary" msgstr "unary(一元)" -#: ../../reference/expressions.rst:1257 ../../reference/expressions.rst:1450 -#: ../../reference/expressions.rst:1459 ../../reference/expressions.rst:1467 -#: ../../reference/expressions.rst:1476 +#: ../../reference/expressions.rst:1258 ../../reference/expressions.rst:1451 +#: ../../reference/expressions.rst:1460 ../../reference/expressions.rst:1468 +#: ../../reference/expressions.rst:1477 msgid "bitwise" msgstr "bitwise(位元)" -#: ../../reference/expressions.rst:1266 +#: ../../reference/expressions.rst:1267 msgid "negation" msgstr "negation(否定)" -#: ../../reference/expressions.rst:1266 +#: ../../reference/expressions.rst:1267 msgid "minus" msgstr "minus(減)" -#: ../../reference/expressions.rst:1266 ../../reference/expressions.rst:1404 +#: ../../reference/expressions.rst:1267 ../../reference/expressions.rst:1405 msgid "- (minus)" msgstr "- (減號)" -#: ../../reference/expressions.rst:1266 ../../reference/expressions.rst:1275 +#: ../../reference/expressions.rst:1267 ../../reference/expressions.rst:1276 msgid "unary operator" msgstr "unary operator(一元運算子)" -#: ../../reference/expressions.rst:1275 +#: ../../reference/expressions.rst:1276 msgid "plus" msgstr "plus(加)" -#: ../../reference/expressions.rst:1275 ../../reference/expressions.rst:1391 +#: ../../reference/expressions.rst:1276 ../../reference/expressions.rst:1392 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../reference/expressions.rst:1283 +#: ../../reference/expressions.rst:1284 msgid "inversion" msgstr "inversion(反轉)" -#: ../../reference/expressions.rst:1283 +#: ../../reference/expressions.rst:1284 msgid "~ (tilde)" msgstr "~ (波浪號)" -#: ../../reference/expressions.rst:1294 +#: ../../reference/expressions.rst:1295 msgid "TypeError" msgstr "TypeError" -#: ../../reference/expressions.rst:1305 ../../reference/expressions.rst:1450 +#: ../../reference/expressions.rst:1306 ../../reference/expressions.rst:1451 msgid "binary" msgstr "binary(二進位)" -#: ../../reference/expressions.rst:1318 +#: ../../reference/expressions.rst:1319 msgid "multiplication" msgstr "multiplication(乘)" -#: ../../reference/expressions.rst:1331 +#: ../../reference/expressions.rst:1332 msgid "matrix multiplication" msgstr "matrix multiplication(矩陣乘法)" -#: ../../reference/expressions.rst:1331 +#: ../../reference/expressions.rst:1332 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/expressions.rst:1343 +#: ../../reference/expressions.rst:1344 msgid "ZeroDivisionError" msgstr "ZeroDivisionError" -#: ../../reference/expressions.rst:1343 +#: ../../reference/expressions.rst:1344 msgid "division" msgstr "division(除)" -#: ../../reference/expressions.rst:1343 +#: ../../reference/expressions.rst:1344 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/expressions.rst:1343 +#: ../../reference/expressions.rst:1344 msgid "//" msgstr "//" -#: ../../reference/expressions.rst:1361 +#: ../../reference/expressions.rst:1362 msgid "modulo" msgstr "modulo(餘數)" -#: ../../reference/expressions.rst:1361 +#: ../../reference/expressions.rst:1362 msgid "% (percent)" msgstr "% (百分號)" -#: ../../reference/expressions.rst:1391 +#: ../../reference/expressions.rst:1392 msgid "addition" msgstr "addition(加)" -#: ../../reference/expressions.rst:1391 ../../reference/expressions.rst:1404 +#: ../../reference/expressions.rst:1392 ../../reference/expressions.rst:1405 msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../reference/expressions.rst:1404 +#: ../../reference/expressions.rst:1405 msgid "subtraction" msgstr "subtraction(減)" -#: ../../reference/expressions.rst:1421 +#: ../../reference/expressions.rst:1422 msgid "shifting" msgstr "shifting(移動)" -#: ../../reference/expressions.rst:1421 +#: ../../reference/expressions.rst:1422 msgid "<<" msgstr "<<" -#: ../../reference/expressions.rst:1421 +#: ../../reference/expressions.rst:1422 msgid ">>" msgstr ">>" -#: ../../reference/expressions.rst:1439 +#: ../../reference/expressions.rst:1440 msgid "ValueError" msgstr "ValueError" -#: ../../reference/expressions.rst:1459 ../../reference/expressions.rst:1786 +#: ../../reference/expressions.rst:1460 ../../reference/expressions.rst:1787 msgid "and" msgstr "and" -#: ../../reference/expressions.rst:1459 +#: ../../reference/expressions.rst:1460 msgid "& (ampersand)" msgstr "& (和號)" -#: ../../reference/expressions.rst:1467 +#: ../../reference/expressions.rst:1468 msgid "xor" msgstr "xor" -#: ../../reference/expressions.rst:1467 +#: ../../reference/expressions.rst:1468 msgid "exclusive" msgstr "exclusive(排外)" -#: ../../reference/expressions.rst:1467 ../../reference/expressions.rst:1476 -#: ../../reference/expressions.rst:1791 +#: ../../reference/expressions.rst:1468 ../../reference/expressions.rst:1477 +#: ../../reference/expressions.rst:1792 msgid "or" msgstr "or" -#: ../../reference/expressions.rst:1467 +#: ../../reference/expressions.rst:1468 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../reference/expressions.rst:1476 +#: ../../reference/expressions.rst:1477 msgid "inclusive" msgstr "inclusive(包含)" -#: ../../reference/expressions.rst:1476 +#: ../../reference/expressions.rst:1477 msgid "| (vertical bar)" msgstr "| (垂直線)" -#: ../../reference/expressions.rst:1491 +#: ../../reference/expressions.rst:1492 msgid "comparison" msgstr "comparison(比較)" -#: ../../reference/expressions.rst:1491 +#: ../../reference/expressions.rst:1492 msgid "C" msgstr "C" -#: ../../reference/expressions.rst:1491 +#: ../../reference/expressions.rst:1492 msgid "language" msgstr "language(語言)" -#: ../../reference/expressions.rst:1491 +#: ../../reference/expressions.rst:1492 msgid "< (less)" msgstr "< (小於)" -#: ../../reference/expressions.rst:1491 +#: ../../reference/expressions.rst:1492 msgid "> (greater)" msgstr "> (大於)" -#: ../../reference/expressions.rst:1491 +#: ../../reference/expressions.rst:1492 msgid "<=" msgstr "<=" -#: ../../reference/expressions.rst:1491 +#: ../../reference/expressions.rst:1492 msgid ">=" msgstr ">=" -#: ../../reference/expressions.rst:1491 +#: ../../reference/expressions.rst:1492 msgid "==" msgstr "==" -#: ../../reference/expressions.rst:1491 +#: ../../reference/expressions.rst:1492 msgid "!=" msgstr "!=" -#: ../../reference/expressions.rst:1515 +#: ../../reference/expressions.rst:1516 msgid "chaining" msgstr "chaining(鏈接)" -#: ../../reference/expressions.rst:1515 +#: ../../reference/expressions.rst:1516 msgid "comparisons" msgstr "comparisons(比較)" -#: ../../reference/expressions.rst:1730 +#: ../../reference/expressions.rst:1731 msgid "in" msgstr "in" -#: ../../reference/expressions.rst:1730 +#: ../../reference/expressions.rst:1731 msgid "not in" msgstr "not in" -#: ../../reference/expressions.rst:1730 +#: ../../reference/expressions.rst:1731 msgid "membership" msgstr "membership(成員)" -#: ../../reference/expressions.rst:1730 ../../reference/expressions.rst:1739 +#: ../../reference/expressions.rst:1731 ../../reference/expressions.rst:1740 msgid "test" msgstr "test(測試)" -#: ../../reference/expressions.rst:1739 +#: ../../reference/expressions.rst:1740 msgid "is" msgstr "is" -#: ../../reference/expressions.rst:1739 +#: ../../reference/expressions.rst:1740 msgid "is not" msgstr "is not" -#: ../../reference/expressions.rst:1739 +#: ../../reference/expressions.rst:1740 msgid "identity" msgstr "identity" -#: ../../reference/expressions.rst:1765 +#: ../../reference/expressions.rst:1766 msgid "Conditional" msgstr "Conditional(條件式)" -#: ../../reference/expressions.rst:1765 +#: ../../reference/expressions.rst:1766 msgid "Boolean" msgstr "Boolean(布林)" -#: ../../reference/expressions.rst:1781 +#: ../../reference/expressions.rst:1782 msgid "not" msgstr "not" -#: ../../reference/expressions.rst:1805 +#: ../../reference/expressions.rst:1806 msgid ":= (colon equals)" msgstr ":= (冒號等於)" -#: ../../reference/expressions.rst:1805 +#: ../../reference/expressions.rst:1806 msgid "assignment expression" msgstr "assignment expression(賦值運算式)" -#: ../../reference/expressions.rst:1805 +#: ../../reference/expressions.rst:1806 msgid "walrus operator" msgstr "walrus operator(海象運算子)" -#: ../../reference/expressions.rst:1805 +#: ../../reference/expressions.rst:1806 msgid "named expression" msgstr "named expression(附名運算式)" -#: ../../reference/expressions.rst:1805 +#: ../../reference/expressions.rst:1806 msgid "assignment" msgstr "assignment(賦值)" -#: ../../reference/expressions.rst:1856 +#: ../../reference/expressions.rst:1857 msgid "conditional" msgstr "conditional(條件式)" -#: ../../reference/expressions.rst:1856 +#: ../../reference/expressions.rst:1857 msgid "ternary" msgstr "ternary(三元)" -#: ../../reference/expressions.rst:1856 +#: ../../reference/expressions.rst:1857 msgid "conditional expression" msgstr "conditional expression(條件運算式)" -#: ../../reference/expressions.rst:1856 +#: ../../reference/expressions.rst:1857 msgid "else" msgstr "else" -#: ../../reference/expressions.rst:1882 +#: ../../reference/expressions.rst:1883 msgid "lambda" msgstr "lambda" -#: ../../reference/expressions.rst:1882 +#: ../../reference/expressions.rst:1883 msgid "form" msgstr "form" -#: ../../reference/expressions.rst:1882 +#: ../../reference/expressions.rst:1883 msgid "anonymous" msgstr "anonymous(匿名)" -#: ../../reference/expressions.rst:1882 +#: ../../reference/expressions.rst:1883 msgid "lambda expression" msgstr "lambda expression(lambda 運算式)" -#: ../../reference/expressions.rst:1929 +#: ../../reference/expressions.rst:1930 msgid "iterable" msgstr "iterable(可疊代)" -#: ../../reference/expressions.rst:1929 +#: ../../reference/expressions.rst:1930 msgid "in expression lists" msgstr "於 expression list(運算式串列)" -#: ../../reference/expressions.rst:1944 +#: ../../reference/expressions.rst:1945 msgid "trailing" msgstr "trailing" -#: ../../reference/expressions.rst:1959 +#: ../../reference/expressions.rst:1960 msgid "evaluation" msgstr "evaluation" -#: ../../reference/expressions.rst:1959 +#: ../../reference/expressions.rst:1960 msgid "order" msgstr "order(順序)" -#: ../../reference/expressions.rst:1980 +#: ../../reference/expressions.rst:1981 msgid "precedence" msgstr "precedence(優先順序)" diff --git a/reference/import.po b/reference/import.po index b78211cdd6..54ab4c6fff 100644 --- a/reference/import.po +++ b/reference/import.po @@ -956,8 +956,8 @@ msgid "" msgstr "" "鑑於 Python 相似的名稱繫結規則,這可能看起來有些出人意料,但這實際上是引入系" "統的一個基本特性。不變的是如果你擁有 ``sys.modules['spam']`` 和 ``sys." -"modules['spam.foo']``(就像上述引入後那樣),那麼後者必須作為前者的 ``foo`` " -"屬性出現。" +"modules['spam.foo']``\\ (就像上述引入後那樣),那麼後者必須作為前者的 " +"``foo`` 屬性出現。" #: ../../reference/import.rst:519 msgid "Module specs" diff --git a/tutorial/errors.po b/tutorial/errors.po index 37d81af4bb..bd14d08027 100644 --- a/tutorial/errors.po +++ b/tutorial/errors.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-27 00:14+0000\n" +"POT-Creation-Date: 2024-11-26 00:14+0000\n" "PO-Revision-Date: 2022-10-24 14:54+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -63,17 +63,17 @@ msgstr "" #: ../../tutorial/errors.rst:26 msgid "" -"The parser repeats the offending line and displays little 'arrow's pointing " -"at the token in the line where the error was detected. The error may be " -"caused by the absence of a token *before* the indicated token. In the " -"example, the error is detected at the function :func:`print`, since a colon " -"(``':'``) is missing before it. File name and line number are printed so " -"you know where to look in case the input came from a script." +"The parser repeats the offending line and displays little arrows pointing at " +"the token in the line where the error was detected. The error may be caused " +"by the absence of a token *before* the indicated token. In the example, the " +"error is detected at the function :func:`print`, since a colon (``':'``) is " +"missing before it. File name and line number are printed so you know where " +"to look in case the input came from a script." msgstr "" -"剖析器 (parser) 會重複犯錯的那一行,並用一個小「箭頭」指向該行檢測到的第一個" -"錯誤點。錯誤是由箭頭\\ *之前*\\ 的標記 (token) 導致的。此例中,錯誤是在 :" -"func:`print` 函式中被檢測到,因為在它前面少了一個冒號 (``':'``)。檔案名稱和列" -"號會被印出來,所以如果訊息是來自腳本時,就可以知道去哪裡找問題。" +"剖析器 (parser) 會重複犯錯的那一行,並用一個小箭頭指向該行檢測到的第一個錯誤" +"點。錯誤是由箭頭\\ *之前*\\ 的標記 (token) 導致的。此例中,錯誤是在 :func:" +"`print` 函式中被檢測到,因為在它前面少了一個冒號 (``':'``)。檔案名稱和列號會" +"被印出來,所以如果訊息是來自腳本時,就可以知道去哪裡找問題。" #: ../../tutorial/errors.rst:37 msgid "Exceptions" @@ -273,7 +273,6 @@ msgstr "" "... pass" #: ../../tutorial/errors.rst:128 -#, fuzzy msgid "" "A class in an :keyword:`except` clause matches exceptions which are " "instances of the class itself or one of its derived classes (but not the " @@ -281,10 +280,9 @@ msgid "" "match instances of its base classes). For example, the following code will " "print B, C, D in that order::" msgstr "" -"一個在 :keyword:`except` 子句中的 class(類別)和一個例外是可相容的,只要它與" -"例外是同一個 class 或是為其 base class(基底類別);反之則無法成立——列出 " -"derived class (衍生類別)的 *except 子句*\\ 並不能與 base class 相容。例如," -"以下程式碼會依序印出 B、C、D: ::" +":keyword:`except` 子句中的一個類別符合該類別本身或它的衍生類別的例外(但不是" +"反過來 -- 列出一個衍生類別的 *except 子句*\\ 不會符合它的基底類別的例外)。例" +"如,以下程式碼會按照 B、C、D 的順序印出: ::" #: ../../tutorial/errors.rst:133 msgid "" diff --git a/using/android.po b/using/android.po index dbb98acccb..24f937b566 100644 --- a/using/android.po +++ b/using/android.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. @@ -11,7 +10,8 @@ msgstr "" "POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: LANGUAGE <LL@li.org>\n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -19,7 +19,7 @@ msgstr "" #: ../../using/android.rst:5 msgid "Using Python on Android" -msgstr "" +msgstr "在 Android 上使用 Python" #: ../../using/android.rst:7 msgid "" @@ -56,7 +56,7 @@ msgstr "" #: ../../using/android.rst:28 msgid "Adding Python to an Android app" -msgstr "" +msgstr "將 Python 加入 Android 應用程式" #: ../../using/android.rst:30 msgid "" @@ -68,24 +68,25 @@ msgstr "" #: ../../using/android.rst:34 msgid "" "`Briefcase <https://briefcase.readthedocs.io>`__, from the BeeWare project" -msgstr "" +msgstr "`Briefcase <https://briefcase.readthedocs.io>`__,由 BeeWare 專案提供" #: ../../using/android.rst:35 msgid "`Buildozer <https://buildozer.readthedocs.io>`__, from the Kivy project" -msgstr "" +msgstr "`Buildozer <https://buildozer.readthedocs.io>`__,由 Kivy 專案提供" #: ../../using/android.rst:36 msgid "`Chaquopy <https://chaquo.com/chaquopy>`__" -msgstr "" +msgstr "`Chaquopy <https://chaquo.com/chaquopy>`__" #: ../../using/android.rst:37 msgid "" "`pyqtdeploy <https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/>`__" msgstr "" +"`pyqtdeploy <https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/>`__" #: ../../using/android.rst:38 msgid "`Termux <https://termux.dev/en/>`__" -msgstr "" +msgstr "`Termux <https://termux.dev/en/>`__" #: ../../using/android.rst:40 msgid "" @@ -116,7 +117,7 @@ msgstr "``libpython*.*.so``" #: ../../using/android.rst:53 msgid "``lib*_python.so`` (external libraries such as OpenSSL)" -msgstr "" +msgstr "``lib*_python.so``\\ (外部函式庫,例如 OpenSSL)" #: ../../using/android.rst:55 msgid "In your assets:" @@ -124,11 +125,11 @@ msgstr "" #: ../../using/android.rst:57 msgid "``python*.*`` (the Python standard library)" -msgstr "" +msgstr "``python*.*``\\ (Python 標準函式庫)" #: ../../using/android.rst:58 msgid "``python*.*/site-packages`` (your own Python code)" -msgstr "" +msgstr "``python*.*/site-packages``\\ (你自己的 Python 程式碼)" #: ../../using/android.rst:60 msgid "" diff --git a/using/configure.po b/using/configure.po index 080a472bd9..caaba60971 100644 --- a/using/configure.po +++ b/using/configure.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-15 00:14+0000\n" +"POT-Creation-Date: 2024-11-13 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -379,7 +379,7 @@ msgid "" "cleared." msgstr "" -#: ../../using/configure.rst:236 ../../using/configure.rst:708 +#: ../../using/configure.rst:236 ../../using/configure.rst:721 msgid "Effects:" msgstr "效果:" @@ -555,217 +555,247 @@ msgid "See :ref:`whatsnew313-free-threaded-cpython` for more detail." msgstr "" #: ../../using/configure.rst:308 -msgid "Path to ``pkg-config`` utility." +msgid "" +"Indicate how to integrate the :ref:`JIT compiler <whatsnew313-jit-compiler>`." +msgstr "" + +#: ../../using/configure.rst:310 +msgid "``no`` - build the interpreter without the JIT." +msgstr "" + +#: ../../using/configure.rst:311 +msgid "``yes`` - build the interpreter with the JIT." +msgstr "" + +#: ../../using/configure.rst:312 +msgid "" +"``yes-off`` - build the interpreter with the JIT but disable it by default." msgstr "" #: ../../using/configure.rst:313 +msgid "" +"``interpreter`` - build the interpreter without the JIT, but with the tier 2 " +"enabled interpreter." +msgstr "" + +#: ../../using/configure.rst:315 +msgid "" +"By convention, ``--enable-experimental-jit`` is a shorthand for ``--enable-" +"experimental-jit=yes``." +msgstr "" + +#: ../../using/configure.rst:321 +msgid "Path to ``pkg-config`` utility." +msgstr "" + +#: ../../using/configure.rst:326 #, fuzzy msgid "``pkg-config`` options." msgstr "設定選項" -#: ../../using/configure.rst:317 +#: ../../using/configure.rst:330 #, fuzzy msgid "C compiler options" msgstr "C 編譯器指令。" -#: ../../using/configure.rst:321 ../../using/configure.rst:1228 +#: ../../using/configure.rst:334 ../../using/configure.rst:1241 msgid "C compiler command." msgstr "C 編譯器指令。" -#: ../../using/configure.rst:325 ../../using/configure.rst:1240 +#: ../../using/configure.rst:338 ../../using/configure.rst:1253 msgid "C compiler flags." msgstr "C 編譯器旗標。" -#: ../../using/configure.rst:329 +#: ../../using/configure.rst:342 #, fuzzy msgid "C preprocessor command." msgstr "C 編譯器指令。" -#: ../../using/configure.rst:333 +#: ../../using/configure.rst:346 msgid "C preprocessor flags, e.g. :samp:`-I{include_dir}`." msgstr "" -#: ../../using/configure.rst:337 ../../using/configure.rst:779 +#: ../../using/configure.rst:350 ../../using/configure.rst:792 msgid "Linker options" msgstr "" -#: ../../using/configure.rst:341 +#: ../../using/configure.rst:354 msgid "Linker flags, e.g. :samp:`-L{library_directory}`." msgstr "" -#: ../../using/configure.rst:345 +#: ../../using/configure.rst:358 msgid "Libraries to pass to the linker, e.g. :samp:`-l{library}`." msgstr "" -#: ../../using/configure.rst:349 +#: ../../using/configure.rst:362 msgid "Name for machine-dependent library files." msgstr "" -#: ../../using/configure.rst:353 +#: ../../using/configure.rst:366 msgid "Options for third-party dependencies" msgstr "" -#: ../../using/configure.rst:360 +#: ../../using/configure.rst:373 msgid "" "C compiler and linker flags to link Python to ``libbz2``, used by :mod:`bz2` " "module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:366 +#: ../../using/configure.rst:379 msgid "" "C compiler and linker flags for ``libncurses`` or ``libncursesw``, used by :" "mod:`curses` module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:372 +#: ../../using/configure.rst:385 msgid "C compiler and linker flags for ``gdbm``." msgstr "" -#: ../../using/configure.rst:377 +#: ../../using/configure.rst:390 msgid "" "C compiler and linker flags for ``libb2`` (:ref:`BLAKE2 <hashlib-blake2>`), " "used by :mod:`hashlib` module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:383 +#: ../../using/configure.rst:396 msgid "" "C compiler and linker flags for ``libedit``, used by :mod:`readline` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:389 +#: ../../using/configure.rst:402 msgid "" "C compiler and linker flags for ``libffi``, used by :mod:`ctypes` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:395 +#: ../../using/configure.rst:408 msgid "" "C compiler and linker flags for ``libmpdec``, used by :mod:`decimal` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:400 +#: ../../using/configure.rst:413 msgid "" "These environment variables have no effect unless :option:`--with-system-" "libmpdec` is specified." msgstr "" -#: ../../using/configure.rst:406 +#: ../../using/configure.rst:419 msgid "" "C compiler and linker flags for ``liblzma``, used by :mod:`lzma` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:412 +#: ../../using/configure.rst:425 msgid "" "C compiler and linker flags for ``libreadline``, used by :mod:`readline` " "module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:418 +#: ../../using/configure.rst:431 msgid "" "C compiler and linker flags for ``libsqlite3``, used by :mod:`sqlite3` " "module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:424 +#: ../../using/configure.rst:437 msgid "" "C compiler and linker flags for ``libuuid``, used by :mod:`uuid` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:430 +#: ../../using/configure.rst:443 msgid "C compiler and linker flags for PANEL, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:432 +#: ../../using/configure.rst:445 msgid "" "C compiler and linker flags for ``libpanel`` or ``libpanelw``, used by :mod:" "`curses.panel` module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:438 +#: ../../using/configure.rst:451 msgid "C compiler and linker flags for TCLTK, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:443 +#: ../../using/configure.rst:456 msgid "" "C compiler and linker flags for ``libzlib``, used by :mod:`gzip` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:448 +#: ../../using/configure.rst:461 msgid "WebAssembly Options" msgstr "WebAssembly 選項" -#: ../../using/configure.rst:452 +#: ../../using/configure.rst:465 msgid "Set build flavor for ``wasm32-emscripten``." msgstr "" -#: ../../using/configure.rst:454 +#: ../../using/configure.rst:467 msgid "``browser`` (default): preload minimal stdlib, default MEMFS." msgstr "" -#: ../../using/configure.rst:455 +#: ../../using/configure.rst:468 msgid "``node``: NODERAWFS and pthread support." msgstr "``node``:對 NODERAWFS 和 pthread 支援。" -#: ../../using/configure.rst:461 +#: ../../using/configure.rst:474 msgid "Turn on dynamic linking support for WASM." msgstr "" -#: ../../using/configure.rst:463 +#: ../../using/configure.rst:476 msgid "" "Dynamic linking enables ``dlopen``. File size of the executable increases " "due to limited dead code elimination and additional features." msgstr "" -#: ../../using/configure.rst:470 +#: ../../using/configure.rst:483 msgid "Turn on pthreads support for WASM." msgstr "" -#: ../../using/configure.rst:476 +#: ../../using/configure.rst:489 msgid "Install Options" msgstr "安裝選項" -#: ../../using/configure.rst:480 +#: ../../using/configure.rst:493 msgid "" "Install architecture-independent files in PREFIX. On Unix, it defaults to :" "file:`/usr/local`." msgstr "" -#: ../../using/configure.rst:483 +#: ../../using/configure.rst:496 msgid "This value can be retrieved at runtime using :data:`sys.prefix`." msgstr "這個值可以在 runtime 使用 :data:`sys.prefix` 取得。" -#: ../../using/configure.rst:485 +#: ../../using/configure.rst:498 msgid "" "As an example, one can use ``--prefix=\"$HOME/.local/\"`` to install a " "Python in its home directory." msgstr "" -#: ../../using/configure.rst:490 +#: ../../using/configure.rst:503 msgid "" "Install architecture-dependent files in EPREFIX, defaults to :option:`--" "prefix`." msgstr "" -#: ../../using/configure.rst:492 +#: ../../using/configure.rst:505 msgid "This value can be retrieved at runtime using :data:`sys.exec_prefix`." msgstr "這個值可以在 runtime 使用 :data:`sys.exec_prefix` 取得" -#: ../../using/configure.rst:496 +#: ../../using/configure.rst:509 msgid "" "Don't build nor install test modules, like the :mod:`test` package or the :" "mod:`!_testcapi` extension module (built and installed by default)." msgstr "" -#: ../../using/configure.rst:503 +#: ../../using/configure.rst:516 msgid "Select the :mod:`ensurepip` command run on Python installation:" msgstr "選擇在 Python 安裝時執行的 :mod:`ensurepip` 命令:" -#: ../../using/configure.rst:505 +#: ../../using/configure.rst:518 msgid "" "``upgrade`` (default): run ``python -m ensurepip --altinstall --upgrade`` " "command." @@ -773,45 +803,45 @@ msgstr "" "``upgrade`` (預設):執行 ``python -m ensurepip --altinstall --upgrade`` 命" "令。" -#: ../../using/configure.rst:507 +#: ../../using/configure.rst:520 msgid "``install``: run ``python -m ensurepip --altinstall`` command;" msgstr "``install``:執行 ``python -m ensurepip --altinstall`` 命令;" -#: ../../using/configure.rst:508 +#: ../../using/configure.rst:521 msgid "``no``: don't run ensurepip;" msgstr "``no``:不要執行 ensurepip;" -#: ../../using/configure.rst:514 +#: ../../using/configure.rst:527 msgid "Performance options" msgstr "" -#: ../../using/configure.rst:516 +#: ../../using/configure.rst:529 msgid "" "Configuring Python using ``--enable-optimizations --with-lto`` (PGO + LTO) " "is recommended for best performance. The experimental ``--enable-bolt`` flag " "can also be used to improve performance." msgstr "" -#: ../../using/configure.rst:522 +#: ../../using/configure.rst:535 msgid "" "Enable Profile Guided Optimization (PGO) using :envvar:`PROFILE_TASK` " "(disabled by default)." msgstr "" -#: ../../using/configure.rst:525 +#: ../../using/configure.rst:538 msgid "" "The C compiler Clang requires ``llvm-profdata`` program for PGO. On macOS, " "GCC also requires it: GCC is just an alias to Clang on macOS." msgstr "" -#: ../../using/configure.rst:528 +#: ../../using/configure.rst:541 msgid "" "Disable also semantic interposition in libpython if ``--enable-shared`` and " "GCC is used: add ``-fno-semantic-interposition`` to the compiler and linker " "flags." msgstr "" -#: ../../using/configure.rst:534 +#: ../../using/configure.rst:547 msgid "" "During the build, you may encounter compiler warnings about profile data not " "being available for some source files. These warnings are harmless, as only " @@ -820,58 +850,58 @@ msgid "" "profile-instr-unprofiled`` to :envvar:`CFLAGS`." msgstr "" -#: ../../using/configure.rst:543 +#: ../../using/configure.rst:556 msgid "Use ``-fno-semantic-interposition`` on GCC." msgstr "在 GCC 上使用 ``-fno-semantic-interposition``。" -#: ../../using/configure.rst:548 +#: ../../using/configure.rst:561 msgid "" "Environment variable used in the Makefile: Python command line arguments for " "the PGO generation task." msgstr "" -#: ../../using/configure.rst:551 +#: ../../using/configure.rst:564 msgid "Default: ``-m test --pgo --timeout=$(TESTTIMEOUT)``." msgstr "預設值:``-m test --pgo --timeout=$(TESTTIMEOUT)``。" -#: ../../using/configure.rst:555 +#: ../../using/configure.rst:568 msgid "Task failure is no longer ignored silently." msgstr "" -#: ../../using/configure.rst:560 +#: ../../using/configure.rst:573 msgid "Enable Link Time Optimization (LTO) in any build (disabled by default)." msgstr "" -#: ../../using/configure.rst:562 +#: ../../using/configure.rst:575 msgid "" "The C compiler Clang requires ``llvm-ar`` for LTO (``ar`` on macOS), as well " "as an LTO-aware linker (``ld.gold`` or ``lld``)." msgstr "" -#: ../../using/configure.rst:567 +#: ../../using/configure.rst:580 msgid "To use ThinLTO feature, use ``--with-lto=thin`` on Clang." msgstr "" -#: ../../using/configure.rst:570 +#: ../../using/configure.rst:583 msgid "" "Use ThinLTO as the default optimization policy on Clang if the compiler " "accepts the flag." msgstr "" -#: ../../using/configure.rst:575 +#: ../../using/configure.rst:588 msgid "" "Enable usage of the `BOLT post-link binary optimizer <https://github.com/" "llvm/llvm-project/tree/main/bolt>`_ (disabled by default)." msgstr "" -#: ../../using/configure.rst:579 +#: ../../using/configure.rst:592 msgid "" "BOLT is part of the LLVM project but is not always included in their binary " "distributions. This flag requires that ``llvm-bolt`` and ``merge-fdata`` are " "available." msgstr "" -#: ../../using/configure.rst:583 +#: ../../using/configure.rst:596 msgid "" "BOLT is still a fairly new project so this flag should be considered " "experimental for now. Because this tool operates on machine code its success " @@ -882,7 +912,7 @@ msgid "" "encouraged." msgstr "" -#: ../../using/configure.rst:591 +#: ../../using/configure.rst:604 msgid "" "The :envvar:`!BOLT_INSTRUMENT_FLAGS` and :envvar:`!BOLT_APPLY_FLAGS` :" "program:`configure` variables can be defined to override the default set of " @@ -890,116 +920,116 @@ msgid "" "binaries, respectively." msgstr "" -#: ../../using/configure.rst:600 +#: ../../using/configure.rst:613 msgid "" "Arguments to ``llvm-bolt`` when creating a `BOLT optimized binary <https://" "github.com/facebookarchive/BOLT>`_." msgstr "" -#: ../../using/configure.rst:607 +#: ../../using/configure.rst:620 msgid "Arguments to ``llvm-bolt`` when instrumenting binaries." msgstr "" -#: ../../using/configure.rst:613 +#: ../../using/configure.rst:626 msgid "" "Enable computed gotos in evaluation loop (enabled by default on supported " "compilers)." msgstr "" -#: ../../using/configure.rst:618 +#: ../../using/configure.rst:631 msgid "" "Disable the fast :ref:`mimalloc <mimalloc>` allocator (enabled by default)." msgstr "" -#: ../../using/configure.rst:621 ../../using/configure.rst:628 +#: ../../using/configure.rst:634 ../../using/configure.rst:641 msgid "See also :envvar:`PYTHONMALLOC` environment variable." msgstr "另請參閱 :envvar:`PYTHONMALLOC` 環境變數。" -#: ../../using/configure.rst:625 +#: ../../using/configure.rst:638 msgid "" "Disable the specialized Python memory allocator :ref:`pymalloc <pymalloc>` " "(enabled by default)." msgstr "" -#: ../../using/configure.rst:632 +#: ../../using/configure.rst:645 msgid "" "Disable static documentation strings to reduce the memory footprint (enabled " "by default). Documentation strings defined in Python are not affected." msgstr "" -#: ../../using/configure.rst:635 +#: ../../using/configure.rst:648 msgid "Don't define the ``WITH_DOC_STRINGS`` macro." msgstr "不要定義 ``WITH_DOC_STRINGS`` 巨集。" -#: ../../using/configure.rst:637 +#: ../../using/configure.rst:650 msgid "See the ``PyDoc_STRVAR()`` macro." msgstr "請見 ``PyDoc_STRVAR()`` 巨集。" -#: ../../using/configure.rst:641 +#: ../../using/configure.rst:654 msgid "Enable C-level code profiling with ``gprof`` (disabled by default)." msgstr "" -#: ../../using/configure.rst:645 +#: ../../using/configure.rst:658 msgid "" "Add ``-fstrict-overflow`` to the C compiler flags (by default we add ``-fno-" "strict-overflow`` instead)." msgstr "" -#: ../../using/configure.rst:652 +#: ../../using/configure.rst:665 msgid "Python Debug Build" msgstr "" -#: ../../using/configure.rst:654 +#: ../../using/configure.rst:667 msgid "" "A debug build is Python built with the :option:`--with-pydebug` configure " "option." msgstr "" -#: ../../using/configure.rst:657 +#: ../../using/configure.rst:670 msgid "Effects of a debug build:" msgstr "" -#: ../../using/configure.rst:659 +#: ../../using/configure.rst:672 msgid "" "Display all warnings by default: the list of default warning filters is " "empty in the :mod:`warnings` module." msgstr "" -#: ../../using/configure.rst:661 +#: ../../using/configure.rst:674 msgid "Add ``d`` to :data:`sys.abiflags`." msgstr "新增 ``d`` 到 :data:`sys.abiflags`。" -#: ../../using/configure.rst:662 +#: ../../using/configure.rst:675 msgid "Add :func:`!sys.gettotalrefcount` function." msgstr "新增 :func:`!sys.gettotalrefcount` 函式。" -#: ../../using/configure.rst:663 +#: ../../using/configure.rst:676 msgid "Add :option:`-X showrefcount <-X>` command line option." msgstr "新增 :option:`-X showrefcount <-X>` 命令列選項。" -#: ../../using/configure.rst:664 +#: ../../using/configure.rst:677 msgid "" "Add :option:`-d` command line option and :envvar:`PYTHONDEBUG` environment " "variable to debug the parser." msgstr "" -#: ../../using/configure.rst:666 +#: ../../using/configure.rst:679 msgid "" "Add support for the ``__lltrace__`` variable: enable low-level tracing in " "the bytecode evaluation loop if the variable is defined." msgstr "" -#: ../../using/configure.rst:668 +#: ../../using/configure.rst:681 msgid "" "Install :ref:`debug hooks on memory allocators <default-memory-allocators>` " "to detect buffer overflow and other memory errors." msgstr "" -#: ../../using/configure.rst:670 +#: ../../using/configure.rst:683 msgid "Define ``Py_DEBUG`` and ``Py_REF_DEBUG`` macros." msgstr "定義 ``Py_DEBUG`` 和 ``Py_REF_DEBUG`` 巨集。" -#: ../../using/configure.rst:671 +#: ../../using/configure.rst:684 msgid "" "Add runtime checks: code surrounded by ``#ifdef Py_DEBUG`` and ``#endif``. " "Enable ``assert(...)`` and ``_PyObject_ASSERT(...)`` assertions: don't set " @@ -1007,387 +1037,388 @@ msgid "" "option). Main runtime checks:" msgstr "" -#: ../../using/configure.rst:676 +#: ../../using/configure.rst:689 msgid "Add sanity checks on the function arguments." msgstr "" -#: ../../using/configure.rst:677 +#: ../../using/configure.rst:690 msgid "" "Unicode and int objects are created with their memory filled with a pattern " "to detect usage of uninitialized objects." msgstr "" -#: ../../using/configure.rst:679 +#: ../../using/configure.rst:692 msgid "" "Ensure that functions which can clear or replace the current exception are " "not called with an exception raised." msgstr "" -#: ../../using/configure.rst:681 +#: ../../using/configure.rst:694 msgid "Check that deallocator functions don't change the current exception." msgstr "" -#: ../../using/configure.rst:682 +#: ../../using/configure.rst:695 msgid "" "The garbage collector (:func:`gc.collect` function) runs some basic checks " "on objects consistency." msgstr "" -#: ../../using/configure.rst:684 +#: ../../using/configure.rst:697 msgid "" "The :c:macro:`!Py_SAFE_DOWNCAST()` macro checks for integer underflow and " "overflow when downcasting from wide types to narrow types." msgstr "" -#: ../../using/configure.rst:687 +#: ../../using/configure.rst:700 msgid "" "See also the :ref:`Python Development Mode <devmode>` and the :option:`--" "with-trace-refs` configure option." msgstr "" -#: ../../using/configure.rst:690 +#: ../../using/configure.rst:703 msgid "" "Release builds and debug builds are now ABI compatible: defining the " "``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` macro (see the :" "option:`--with-trace-refs` option)." msgstr "" -#: ../../using/configure.rst:697 +#: ../../using/configure.rst:710 msgid "Debug options" msgstr "" -#: ../../using/configure.rst:701 +#: ../../using/configure.rst:714 msgid "" ":ref:`Build Python in debug mode <debug-build>`: define the ``Py_DEBUG`` " "macro (disabled by default)." msgstr "" -#: ../../using/configure.rst:706 +#: ../../using/configure.rst:719 msgid "Enable tracing references for debugging purpose (disabled by default)." msgstr "" -#: ../../using/configure.rst:710 +#: ../../using/configure.rst:723 msgid "Define the ``Py_TRACE_REFS`` macro." msgstr "定義 ``Py_TRACE_REFS`` 巨集。" -#: ../../using/configure.rst:711 -msgid "Add :func:`!sys.getobjects` function." +#: ../../using/configure.rst:724 +#, fuzzy +msgid "Add :func:`sys.getobjects` function." msgstr "新增 :func:`!sys.getobjects` 函式。" -#: ../../using/configure.rst:712 +#: ../../using/configure.rst:725 msgid "Add :envvar:`PYTHONDUMPREFS` environment variable." msgstr "新增 :envvar:`PYTHONDUMPREFS` 環境變數。" -#: ../../using/configure.rst:714 +#: ../../using/configure.rst:727 msgid "" "The :envvar:`PYTHONDUMPREFS` environment variable can be used to dump " "objects and reference counts still alive at Python exit." msgstr "" -#: ../../using/configure.rst:717 +#: ../../using/configure.rst:730 msgid ":ref:`Statically allocated objects <static-types>` are not traced." msgstr "" -#: ../../using/configure.rst:721 +#: ../../using/configure.rst:734 msgid "" "This build is now ABI compatible with release build and :ref:`debug build " "<debug-build>`." msgstr "" -#: ../../using/configure.rst:727 +#: ../../using/configure.rst:740 msgid "" "Build with C assertions enabled (default is no): ``assert(...);`` and " "``_PyObject_ASSERT(...);``." msgstr "" -#: ../../using/configure.rst:730 +#: ../../using/configure.rst:743 msgid "" "If set, the ``NDEBUG`` macro is not defined in the :envvar:`OPT` compiler " "variable." msgstr "" -#: ../../using/configure.rst:733 +#: ../../using/configure.rst:746 msgid "" "See also the :option:`--with-pydebug` option (:ref:`debug build <debug-" "build>`) which also enables assertions." msgstr "" -#: ../../using/configure.rst:740 +#: ../../using/configure.rst:753 msgid "Enable Valgrind support (default is no)." msgstr "啟用 Valgrind 支援(預設不啟用)。" -#: ../../using/configure.rst:744 +#: ../../using/configure.rst:757 msgid "Enable DTrace support (default is no)." msgstr "啟用 DTrace 支援(預設不啟用)。" -#: ../../using/configure.rst:746 +#: ../../using/configure.rst:759 msgid "" "See :ref:`Instrumenting CPython with DTrace and SystemTap <instrumentation>`." msgstr "" -#: ../../using/configure.rst:753 +#: ../../using/configure.rst:766 msgid "" "Enable AddressSanitizer memory error detector, ``asan`` (default is no)." msgstr "" -#: ../../using/configure.rst:759 +#: ../../using/configure.rst:772 msgid "" "Enable MemorySanitizer allocation error detector, ``msan`` (default is no)." msgstr "" -#: ../../using/configure.rst:765 +#: ../../using/configure.rst:778 msgid "" "Enable UndefinedBehaviorSanitizer undefined behaviour detector, ``ubsan`` " "(default is no)." msgstr "" -#: ../../using/configure.rst:772 +#: ../../using/configure.rst:785 #, fuzzy msgid "Enable ThreadSanitizer data race detector, ``tsan`` (default is no)." msgstr "啟用 DTrace 支援(預設不啟用)。" -#: ../../using/configure.rst:783 +#: ../../using/configure.rst:796 msgid "Enable building a shared Python library: ``libpython`` (default is no)." msgstr "" -#: ../../using/configure.rst:787 +#: ../../using/configure.rst:800 msgid "" "Do not build ``libpythonMAJOR.MINOR.a`` and do not install ``python.o`` " "(built and enabled by default)." msgstr "" -#: ../../using/configure.rst:794 +#: ../../using/configure.rst:807 msgid "Libraries options" msgstr "函式庫選項" -#: ../../using/configure.rst:798 +#: ../../using/configure.rst:811 msgid "Link against additional libraries (default is no)." msgstr "" -#: ../../using/configure.rst:802 +#: ../../using/configure.rst:815 msgid "" "Build the :mod:`!pyexpat` module using an installed ``expat`` library " "(default is no)." msgstr "" -#: ../../using/configure.rst:807 +#: ../../using/configure.rst:820 msgid "" "Build the ``_decimal`` extension module using an installed ``mpdecimal`` " "library, see the :mod:`decimal` module (default is yes)." msgstr "" -#: ../../using/configure.rst:812 +#: ../../using/configure.rst:825 msgid "Default to using the installed ``mpdecimal`` library." msgstr "" -#: ../../using/configure.rst:815 +#: ../../using/configure.rst:828 msgid "" "A copy of the ``mpdecimal`` library sources will no longer be distributed " "with Python 3.15." msgstr "" -#: ../../using/configure.rst:819 +#: ../../using/configure.rst:832 msgid ":option:`LIBMPDEC_CFLAGS` and :option:`LIBMPDEC_LIBS`." msgstr "" -#: ../../using/configure.rst:823 +#: ../../using/configure.rst:836 msgid "Designate a backend library for the :mod:`readline` module." msgstr "" -#: ../../using/configure.rst:825 +#: ../../using/configure.rst:838 msgid "readline: Use readline as the backend." msgstr "" -#: ../../using/configure.rst:826 +#: ../../using/configure.rst:839 msgid "editline: Use editline as the backend." msgstr "" -#: ../../using/configure.rst:832 +#: ../../using/configure.rst:845 msgid "Don't build the :mod:`readline` module (built by default)." msgstr "" -#: ../../using/configure.rst:834 +#: ../../using/configure.rst:847 msgid "Don't define the ``HAVE_LIBREADLINE`` macro." msgstr "不要定義 ``HAVE_LIBREADLINE`` 巨集。" -#: ../../using/configure.rst:840 +#: ../../using/configure.rst:853 msgid "" "Override ``libm`` math library to *STRING* (default is system-dependent)." msgstr "" -#: ../../using/configure.rst:844 +#: ../../using/configure.rst:857 msgid "Override ``libc`` C library to *STRING* (default is system-dependent)." msgstr "" -#: ../../using/configure.rst:848 +#: ../../using/configure.rst:861 msgid "Root of the OpenSSL directory." msgstr "" -#: ../../using/configure.rst:854 +#: ../../using/configure.rst:867 msgid "Set runtime library directory (rpath) for OpenSSL libraries:" msgstr "" -#: ../../using/configure.rst:856 +#: ../../using/configure.rst:869 msgid "``no`` (default): don't set rpath;" msgstr "" -#: ../../using/configure.rst:857 +#: ../../using/configure.rst:870 msgid "" "``auto``: auto-detect rpath from :option:`--with-openssl` and ``pkg-config``;" msgstr "" -#: ../../using/configure.rst:859 +#: ../../using/configure.rst:872 msgid "*DIR*: set an explicit rpath." msgstr "" -#: ../../using/configure.rst:865 +#: ../../using/configure.rst:878 msgid "Security Options" msgstr "" -#: ../../using/configure.rst:869 +#: ../../using/configure.rst:882 msgid "Select hash algorithm for use in ``Python/pyhash.c``:" msgstr "" -#: ../../using/configure.rst:871 +#: ../../using/configure.rst:884 msgid "``siphash13`` (default);" msgstr "" -#: ../../using/configure.rst:872 +#: ../../using/configure.rst:885 msgid "``siphash24``;" msgstr "``siphash24``;" -#: ../../using/configure.rst:873 +#: ../../using/configure.rst:886 msgid "``fnv``." msgstr "``fnv``。" -#: ../../using/configure.rst:877 +#: ../../using/configure.rst:890 msgid "``siphash13`` is added and it is the new default." msgstr "" -#: ../../using/configure.rst:882 +#: ../../using/configure.rst:895 msgid "Built-in hash modules:" msgstr "內建雜湊模組:" -#: ../../using/configure.rst:884 +#: ../../using/configure.rst:897 msgid "``md5``;" msgstr "``md5``;" -#: ../../using/configure.rst:885 +#: ../../using/configure.rst:898 msgid "``sha1``;" msgstr "``sha1``;" -#: ../../using/configure.rst:886 +#: ../../using/configure.rst:899 msgid "``sha256``;" msgstr "``sha256``;" -#: ../../using/configure.rst:887 +#: ../../using/configure.rst:900 msgid "``sha512``;" msgstr "``sha512``;" -#: ../../using/configure.rst:888 +#: ../../using/configure.rst:901 msgid "``sha3`` (with shake);" msgstr "" -#: ../../using/configure.rst:889 +#: ../../using/configure.rst:902 msgid "``blake2``." msgstr "``blake2``。" -#: ../../using/configure.rst:895 +#: ../../using/configure.rst:908 msgid "Override the OpenSSL default cipher suites string:" msgstr "" -#: ../../using/configure.rst:897 +#: ../../using/configure.rst:910 msgid "``python`` (default): use Python's preferred selection;" msgstr "" -#: ../../using/configure.rst:898 +#: ../../using/configure.rst:911 msgid "``openssl``: leave OpenSSL's defaults untouched;" msgstr "" -#: ../../using/configure.rst:899 +#: ../../using/configure.rst:912 msgid "*STRING*: use a custom string" msgstr "" -#: ../../using/configure.rst:901 +#: ../../using/configure.rst:914 msgid "See the :mod:`ssl` module." msgstr "請見 :mod:`ssl` 模組。" -#: ../../using/configure.rst:907 +#: ../../using/configure.rst:920 msgid "" "The settings ``python`` and *STRING* also set TLS 1.2 as minimum protocol " "version." msgstr "" -#: ../../using/configure.rst:911 +#: ../../using/configure.rst:924 msgid "macOS Options" msgstr "macOS 選項" -#: ../../using/configure.rst:913 +#: ../../using/configure.rst:926 #, fuzzy msgid "See :source:`Mac/README.rst`." msgstr "參閱 ``Mac/README.rst``。" -#: ../../using/configure.rst:918 +#: ../../using/configure.rst:931 msgid "" "Create a universal binary build. *SDKDIR* specifies which macOS SDK should " "be used to perform the build (default is no)." msgstr "" -#: ../../using/configure.rst:924 +#: ../../using/configure.rst:937 msgid "" "Create a Python.framework rather than a traditional Unix install. Optional " "*INSTALLDIR* specifies the installation path (default is no)." msgstr "" -#: ../../using/configure.rst:929 +#: ../../using/configure.rst:942 msgid "" "Specify the kind of universal binary that should be created. This option is " "only valid when :option:`--enable-universalsdk` is set." msgstr "" -#: ../../using/configure.rst:932 +#: ../../using/configure.rst:945 msgid "Options:" msgstr "選項:" -#: ../../using/configure.rst:934 +#: ../../using/configure.rst:947 msgid "``universal2``;" msgstr "``universal2``;" -#: ../../using/configure.rst:935 +#: ../../using/configure.rst:948 msgid "``32-bit``;" msgstr "``32-bit``;" -#: ../../using/configure.rst:936 +#: ../../using/configure.rst:949 msgid "``64-bit``;" msgstr "``64-bit``;" -#: ../../using/configure.rst:937 +#: ../../using/configure.rst:950 msgid "``3-way``;" msgstr "``3-way``;" -#: ../../using/configure.rst:938 +#: ../../using/configure.rst:951 msgid "``intel``;" msgstr "``intel``;" -#: ../../using/configure.rst:939 +#: ../../using/configure.rst:952 msgid "``intel-32``;" msgstr "``intel-32``;" -#: ../../using/configure.rst:940 +#: ../../using/configure.rst:953 msgid "``intel-64``;" msgstr "``intel-64``;" -#: ../../using/configure.rst:941 +#: ../../using/configure.rst:954 msgid "``all``." msgstr "``all``。" -#: ../../using/configure.rst:945 +#: ../../using/configure.rst:958 msgid "" "Specify the name for the python framework on macOS only valid when :option:" "`--enable-framework` is set (default: ``Python``)." msgstr "" -#: ../../using/configure.rst:951 +#: ../../using/configure.rst:964 msgid "" "The Python standard library contains strings that are known to trigger " "automated inspection tool errors when submitted for distribution by the " @@ -1396,31 +1427,31 @@ msgid "" "can also be specified. This option is disabled by default." msgstr "" -#: ../../using/configure.rst:960 +#: ../../using/configure.rst:973 #, fuzzy msgid "iOS Options" msgstr "macOS 選項" -#: ../../using/configure.rst:962 +#: ../../using/configure.rst:975 #, fuzzy msgid "See :source:`iOS/README.rst`." msgstr "參閱 ``Mac/README.rst``。" -#: ../../using/configure.rst:966 +#: ../../using/configure.rst:979 msgid "" "Create a Python.framework. Unlike macOS, the *INSTALLDIR* argument " "specifying the installation path is mandatory." msgstr "" -#: ../../using/configure.rst:971 +#: ../../using/configure.rst:984 msgid "Specify the name for the framework (default: ``Python``)." msgstr "" -#: ../../using/configure.rst:975 +#: ../../using/configure.rst:988 msgid "Cross Compiling Options" msgstr "" -#: ../../using/configure.rst:977 +#: ../../using/configure.rst:990 msgid "" "Cross compiling, also known as cross building, can be used to build Python " "for another CPU architecture or platform. Cross compiling requires a Python " @@ -1428,28 +1459,28 @@ msgid "" "match the version of the cross compiled host Python." msgstr "" -#: ../../using/configure.rst:984 +#: ../../using/configure.rst:997 msgid "" "configure for building on BUILD, usually guessed by :program:`config.guess`." msgstr "" -#: ../../using/configure.rst:988 +#: ../../using/configure.rst:1001 msgid "cross-compile to build programs to run on HOST (target platform)" msgstr "" -#: ../../using/configure.rst:992 +#: ../../using/configure.rst:1005 msgid "path to build ``python`` binary for cross compiling" msgstr "" -#: ../../using/configure.rst:998 +#: ../../using/configure.rst:1011 msgid "An environment variable that points to a file with configure overrides." msgstr "" -#: ../../using/configure.rst:1000 +#: ../../using/configure.rst:1013 msgid "Example *config.site* file:" msgstr "" -#: ../../using/configure.rst:1002 +#: ../../using/configure.rst:1015 msgid "" "# config.site-aarch64\n" "ac_cv_buggy_getaddrinfo=no\n" @@ -1461,15 +1492,15 @@ msgstr "" "ac_cv_file__dev_ptmx=yes\n" "ac_cv_file__dev_ptc=no" -#: ../../using/configure.rst:1011 +#: ../../using/configure.rst:1024 msgid "Program to run CPython for the host platform for cross-compilation." msgstr "" -#: ../../using/configure.rst:1016 +#: ../../using/configure.rst:1029 msgid "Cross compiling example::" msgstr "" -#: ../../using/configure.rst:1018 +#: ../../using/configure.rst:1031 msgid "" "CONFIG_SITE=config.site-aarch64 ../configure \\\n" " --build=x86_64-pc-linux-gnu \\\n" @@ -1481,64 +1512,64 @@ msgstr "" " --host=aarch64-unknown-linux-gnu \\\n" " --with-build-python=../x86_64/python" -#: ../../using/configure.rst:1025 +#: ../../using/configure.rst:1038 msgid "Python Build System" msgstr "" -#: ../../using/configure.rst:1028 +#: ../../using/configure.rst:1041 msgid "Main files of the build system" msgstr "" -#: ../../using/configure.rst:1030 +#: ../../using/configure.rst:1043 msgid ":file:`configure.ac` => :file:`configure`;" msgstr ":file:`configure.ac` => :file:`configure`\\ ;" -#: ../../using/configure.rst:1031 +#: ../../using/configure.rst:1044 msgid "" ":file:`Makefile.pre.in` => :file:`Makefile` (created by :file:`configure`);" msgstr "" -#: ../../using/configure.rst:1032 +#: ../../using/configure.rst:1045 msgid ":file:`pyconfig.h` (created by :file:`configure`);" msgstr ":file:`pyconfig.h` (created by :file:`configure`)\\ ;" -#: ../../using/configure.rst:1033 +#: ../../using/configure.rst:1046 msgid "" ":file:`Modules/Setup`: C extensions built by the Makefile using :file:" "`Module/makesetup` shell script;" msgstr "" -#: ../../using/configure.rst:1037 +#: ../../using/configure.rst:1050 msgid "Main build steps" msgstr "主要建置步驟" -#: ../../using/configure.rst:1039 +#: ../../using/configure.rst:1052 msgid "C files (``.c``) are built as object files (``.o``)." msgstr "" -#: ../../using/configure.rst:1040 +#: ../../using/configure.rst:1053 msgid "A static ``libpython`` library (``.a``) is created from objects files." msgstr "" -#: ../../using/configure.rst:1041 +#: ../../using/configure.rst:1054 msgid "" "``python.o`` and the static ``libpython`` library are linked into the final " "``python`` program." msgstr "" -#: ../../using/configure.rst:1043 +#: ../../using/configure.rst:1056 msgid "C extensions are built by the Makefile (see :file:`Modules/Setup`)." msgstr "" -#: ../../using/configure.rst:1046 +#: ../../using/configure.rst:1059 msgid "Main Makefile targets" msgstr "主要 Makefile 目標" -#: ../../using/configure.rst:1049 +#: ../../using/configure.rst:1062 msgid "make" msgstr "" -#: ../../using/configure.rst:1051 +#: ../../using/configure.rst:1064 msgid "" "For the most part, when rebuilding after editing some code or refreshing " "your checkout from upstream, all you need to do is execute ``make``, which " @@ -1549,20 +1580,20 @@ msgid "" "all`` will build. The three choices are:" msgstr "" -#: ../../using/configure.rst:1060 +#: ../../using/configure.rst:1073 msgid "``profile-opt`` (configured with ``--enable-optimizations``)" msgstr "" -#: ../../using/configure.rst:1061 +#: ../../using/configure.rst:1074 msgid "``build_wasm`` (configured with ``--with-emscripten-target``)" msgstr "" -#: ../../using/configure.rst:1062 +#: ../../using/configure.rst:1075 msgid "" "``build_all`` (configured without explicitly using either of the others)" msgstr "" -#: ../../using/configure.rst:1064 +#: ../../using/configure.rst:1077 msgid "" "Depending on the most recent source file changes, Make will rebuild any " "targets (object files and executables) deemed out-of-date, including running " @@ -1575,11 +1606,11 @@ msgid "" "problems, at the expense of longer build times." msgstr "" -#: ../../using/configure.rst:1077 +#: ../../using/configure.rst:1090 msgid "make platform" msgstr "" -#: ../../using/configure.rst:1079 +#: ../../using/configure.rst:1092 msgid "" "Build the ``python`` program, but don't build the standard library extension " "modules. This generates a file named ``platform`` which contains a single " @@ -1587,82 +1618,82 @@ msgid "" "arm64-3.12`` or ``linux-x86_64-3.13``." msgstr "" -#: ../../using/configure.rst:1086 +#: ../../using/configure.rst:1099 msgid "make profile-opt" msgstr "" -#: ../../using/configure.rst:1088 +#: ../../using/configure.rst:1101 msgid "" "Build Python using profile-guided optimization (PGO). You can use the " "configure :option:`--enable-optimizations` option to make this the default " "target of the ``make`` command (``make all`` or just ``make``)." msgstr "" -#: ../../using/configure.rst:1096 +#: ../../using/configure.rst:1109 msgid "make clean" msgstr "" -#: ../../using/configure.rst:1098 +#: ../../using/configure.rst:1111 msgid "Remove built files." msgstr "" -#: ../../using/configure.rst:1102 +#: ../../using/configure.rst:1115 msgid "make distclean" msgstr "" -#: ../../using/configure.rst:1104 +#: ../../using/configure.rst:1117 msgid "" "In addition to the work done by ``make clean``, remove files created by the " "configure script. ``configure`` will have to be run before building again. " "[#]_" msgstr "" -#: ../../using/configure.rst:1110 +#: ../../using/configure.rst:1123 msgid "make install" msgstr "" -#: ../../using/configure.rst:1112 +#: ../../using/configure.rst:1125 msgid "Build the ``all`` target and install Python." msgstr "" -#: ../../using/configure.rst:1116 +#: ../../using/configure.rst:1129 msgid "make test" msgstr "" -#: ../../using/configure.rst:1118 +#: ../../using/configure.rst:1131 msgid "" "Build the ``all`` target and run the Python test suite with the ``--fast-" "ci`` option. Variables:" msgstr "" -#: ../../using/configure.rst:1121 +#: ../../using/configure.rst:1134 msgid "``TESTOPTS``: additional regrtest command-line options." msgstr "" -#: ../../using/configure.rst:1122 +#: ../../using/configure.rst:1135 msgid "``TESTPYTHONOPTS``: additional Python command-line options." msgstr "" -#: ../../using/configure.rst:1123 +#: ../../using/configure.rst:1136 msgid "``TESTTIMEOUT``: timeout in seconds (default: 10 minutes)." msgstr "" -#: ../../using/configure.rst:1127 +#: ../../using/configure.rst:1140 #, fuzzy msgid "make buildbottest" msgstr "主要建置步驟" -#: ../../using/configure.rst:1129 +#: ../../using/configure.rst:1142 msgid "" "This is similar to ``make test``, but uses the ``--slow-ci`` option and " "default timeout of 20 minutes, instead of ``--fast-ci`` option." msgstr "" -#: ../../using/configure.rst:1134 +#: ../../using/configure.rst:1147 msgid "make regen-all" msgstr "" -#: ../../using/configure.rst:1136 +#: ../../using/configure.rst:1149 msgid "" "Regenerate (almost) all generated files. These include (but are not limited " "to) bytecode cases, and parser generator file. ``make regen-stdlib-module-" @@ -1670,18 +1701,18 @@ msgid "" "files <#generated-files>`_." msgstr "" -#: ../../using/configure.rst:1143 +#: ../../using/configure.rst:1156 msgid "C extensions" msgstr "C 擴充模組" -#: ../../using/configure.rst:1145 +#: ../../using/configure.rst:1158 msgid "" "Some C extensions are built as built-in modules, like the ``sys`` module. " "They are built with the ``Py_BUILD_CORE_BUILTIN`` macro defined. Built-in " "modules have no ``__file__`` attribute:" msgstr "" -#: ../../using/configure.rst:1149 +#: ../../using/configure.rst:1162 msgid "" ">>> import sys\n" ">>> sys\n" @@ -1692,14 +1723,14 @@ msgid "" "AttributeError: module 'sys' has no attribute '__file__'" msgstr "" -#: ../../using/configure.rst:1159 +#: ../../using/configure.rst:1172 msgid "" "Other C extensions are built as dynamic libraries, like the ``_asyncio`` " "module. They are built with the ``Py_BUILD_CORE_MODULE`` macro defined. " "Example on Linux x86-64:" msgstr "" -#: ../../using/configure.rst:1163 +#: ../../using/configure.rst:1176 msgid "" ">>> import _asyncio\n" ">>> _asyncio\n" @@ -1715,7 +1746,7 @@ msgstr "" ">>> _asyncio.__file__\n" "'/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'" -#: ../../using/configure.rst:1171 +#: ../../using/configure.rst:1184 msgid "" ":file:`Modules/Setup` is used to generate Makefile targets to build C " "extensions. At the beginning of the files, C extensions are built as built-" @@ -1723,304 +1754,304 @@ msgid "" "dynamic libraries." msgstr "" -#: ../../using/configure.rst:1175 +#: ../../using/configure.rst:1188 msgid "" "The :c:macro:`!PyAPI_FUNC()`, :c:macro:`!PyAPI_DATA()` and :c:macro:" "`PyMODINIT_FUNC` macros of :file:`Include/exports.h` are defined differently " "depending if the ``Py_BUILD_CORE_MODULE`` macro is defined:" msgstr "" -#: ../../using/configure.rst:1179 +#: ../../using/configure.rst:1192 msgid "Use ``Py_EXPORTED_SYMBOL`` if the ``Py_BUILD_CORE_MODULE`` is defined" msgstr "如果定義了 ``Py_BUILD_CORE_MODULE``,則使用 ``Py_EXPORTED_SYMBOL``" -#: ../../using/configure.rst:1180 +#: ../../using/configure.rst:1193 msgid "Use ``Py_IMPORTED_SYMBOL`` otherwise." msgstr "否則使用 ``Py_IMPORTED_SYMBOL``。" -#: ../../using/configure.rst:1182 +#: ../../using/configure.rst:1195 msgid "" "If the ``Py_BUILD_CORE_BUILTIN`` macro is used by mistake on a C extension " "built as a shared library, its :samp:`PyInit_{xxx}()` function is not " "exported, causing an :exc:`ImportError` on import." msgstr "" -#: ../../using/configure.rst:1188 +#: ../../using/configure.rst:1201 msgid "Compiler and linker flags" msgstr "" -#: ../../using/configure.rst:1190 +#: ../../using/configure.rst:1203 msgid "" "Options set by the ``./configure`` script and environment variables and used " "by ``Makefile``." msgstr "" -#: ../../using/configure.rst:1194 +#: ../../using/configure.rst:1207 msgid "Preprocessor flags" msgstr "" -#: ../../using/configure.rst:1198 +#: ../../using/configure.rst:1211 msgid "" "Value of :envvar:`CPPFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:1204 +#: ../../using/configure.rst:1217 msgid "" "(Objective) C/C++ preprocessor flags, e.g. :samp:`-I{include_dir}` if you " "have headers in a nonstandard directory *include_dir*." msgstr "" -#: ../../using/configure.rst:1207 ../../using/configure.rst:1397 +#: ../../using/configure.rst:1220 ../../using/configure.rst:1410 msgid "" "Both :envvar:`CPPFLAGS` and :envvar:`LDFLAGS` need to contain the shell's " "value to be able to build extension modules using the directories specified " "in the environment variables." msgstr "" -#: ../../using/configure.rst:1217 +#: ../../using/configure.rst:1230 msgid "" "Extra preprocessor flags added for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:1219 +#: ../../using/configure.rst:1232 msgid "" "Default: ``$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) " "$(CPPFLAGS)``." msgstr "" -#: ../../using/configure.rst:1224 +#: ../../using/configure.rst:1237 msgid "Compiler flags" msgstr "編譯器旗標" -#: ../../using/configure.rst:1230 +#: ../../using/configure.rst:1243 msgid "Example: ``gcc -pthread``." msgstr "" -#: ../../using/configure.rst:1234 +#: ../../using/configure.rst:1247 msgid "C++ compiler command." msgstr "C++ 編譯器指令。" -#: ../../using/configure.rst:1236 +#: ../../using/configure.rst:1249 msgid "Example: ``g++ -pthread``." msgstr "範例:``g++ -pthread``。" -#: ../../using/configure.rst:1244 +#: ../../using/configure.rst:1257 msgid "" ":envvar:`CFLAGS_NODIST` is used for building the interpreter and stdlib C " "extensions. Use it when a compiler flag should *not* be part of :envvar:" "`CFLAGS` once Python is installed (:gh:`65320`)." msgstr "" -#: ../../using/configure.rst:1248 +#: ../../using/configure.rst:1261 msgid "In particular, :envvar:`CFLAGS` should not contain:" msgstr "" -#: ../../using/configure.rst:1250 +#: ../../using/configure.rst:1263 msgid "" "the compiler flag ``-I`` (for setting the search path for include files). " "The ``-I`` flags are processed from left to right, and any flags in :envvar:" "`CFLAGS` would take precedence over user- and package-supplied ``-I`` flags." msgstr "" -#: ../../using/configure.rst:1255 +#: ../../using/configure.rst:1268 msgid "" "hardening flags such as ``-Werror`` because distributions cannot control " "whether packages installed by users conform to such heightened standards." msgstr "" -#: ../../using/configure.rst:1263 +#: ../../using/configure.rst:1276 msgid "" "Options passed to the :mod:`compileall` command line when building PYC files " "in ``make install``. Default: ``-j0``." msgstr "" -#: ../../using/configure.rst:1270 +#: ../../using/configure.rst:1283 msgid "Extra C compiler flags." msgstr "額外的 C 編譯器旗標。" -#: ../../using/configure.rst:1274 +#: ../../using/configure.rst:1287 msgid "" "Value of :envvar:`CFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:1281 +#: ../../using/configure.rst:1294 msgid "" "Value of :envvar:`CFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: ../../using/configure.rst:1288 +#: ../../using/configure.rst:1301 msgid "Base compiler flags." msgstr "基本編譯器旗標。" -#: ../../using/configure.rst:1292 +#: ../../using/configure.rst:1305 msgid "Optimization flags." msgstr "最佳化旗標。" -#: ../../using/configure.rst:1296 +#: ../../using/configure.rst:1309 msgid "Strict or non-strict aliasing flags used to compile ``Python/dtoa.c``." msgstr "" -#: ../../using/configure.rst:1302 +#: ../../using/configure.rst:1315 msgid "Compiler flags used to build a shared library." msgstr "" -#: ../../using/configure.rst:1304 +#: ../../using/configure.rst:1317 msgid "For example, ``-fPIC`` is used on Linux and on BSD." msgstr "例如說 ``-fPIC`` 被使用於 Linux 與 BSD 上。" -#: ../../using/configure.rst:1308 +#: ../../using/configure.rst:1321 msgid "Extra C flags added for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:1310 +#: ../../using/configure.rst:1323 msgid "" "Default: ``$(CCSHARED)`` when :option:`--enable-shared` is used, or an empty " "string otherwise." msgstr "" -#: ../../using/configure.rst:1315 +#: ../../using/configure.rst:1328 msgid "" "Default: ``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) " "$(EXTRA_CFLAGS)``." msgstr "" -#: ../../using/configure.rst:1319 +#: ../../using/configure.rst:1332 msgid "" "Default: ``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/" "internal``." msgstr "" -#: ../../using/configure.rst:1325 +#: ../../using/configure.rst:1338 msgid "C flags used for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:1327 +#: ../../using/configure.rst:1340 msgid "" "Default: ``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) " "$(CFLAGSFORSHARED)``." msgstr "" -#: ../../using/configure.rst:1333 +#: ../../using/configure.rst:1346 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``." msgstr "" -#: ../../using/configure.rst:1339 +#: ../../using/configure.rst:1352 msgid "" "Compiler flags to build a standard library extension module as a built-in " "module, like the :mod:`posix` module." msgstr "" -#: ../../using/configure.rst:1342 +#: ../../using/configure.rst:1355 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``." msgstr "" -#: ../../using/configure.rst:1348 +#: ../../using/configure.rst:1361 msgid "Purify command. Purify is a memory debugger program." msgstr "" -#: ../../using/configure.rst:1350 +#: ../../using/configure.rst:1363 msgid "Default: empty string (not used)." msgstr "" -#: ../../using/configure.rst:1354 +#: ../../using/configure.rst:1367 msgid "Linker flags" msgstr "" -#: ../../using/configure.rst:1358 +#: ../../using/configure.rst:1371 msgid "" "Linker command used to build programs like ``python`` and ``_testembed``." msgstr "" -#: ../../using/configure.rst:1360 +#: ../../using/configure.rst:1373 msgid "Default: ``$(PURIFY) $(CC)``." msgstr "" -#: ../../using/configure.rst:1364 +#: ../../using/configure.rst:1377 msgid "" "Value of :envvar:`LDFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:1366 +#: ../../using/configure.rst:1379 msgid "" "Avoid assigning :envvar:`CFLAGS`, :envvar:`LDFLAGS`, etc. so users can use " "them on the command line to append to these values without stomping the pre-" "set values." msgstr "" -#: ../../using/configure.rst:1374 +#: ../../using/configure.rst:1387 msgid "" ":envvar:`LDFLAGS_NODIST` is used in the same manner as :envvar:" "`CFLAGS_NODIST`. Use it when a linker flag should *not* be part of :envvar:" "`LDFLAGS` once Python is installed (:gh:`65320`)." msgstr "" -#: ../../using/configure.rst:1378 +#: ../../using/configure.rst:1391 msgid "In particular, :envvar:`LDFLAGS` should not contain:" msgstr "" -#: ../../using/configure.rst:1380 +#: ../../using/configure.rst:1393 msgid "" "the compiler flag ``-L`` (for setting the search path for libraries). The ``-" "L`` flags are processed from left to right, and any flags in :envvar:" "`LDFLAGS` would take precedence over user- and package-supplied ``-L`` flags." msgstr "" -#: ../../using/configure.rst:1387 +#: ../../using/configure.rst:1400 msgid "" "Value of :envvar:`LDFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: ../../using/configure.rst:1394 +#: ../../using/configure.rst:1407 msgid "" "Linker flags, e.g. :samp:`-L{lib_dir}` if you have libraries in a " "nonstandard directory *lib_dir*." msgstr "" -#: ../../using/configure.rst:1403 +#: ../../using/configure.rst:1416 msgid "" "Linker flags to pass libraries to the linker when linking the Python " "executable." msgstr "" -#: ../../using/configure.rst:1406 +#: ../../using/configure.rst:1419 msgid "Example: ``-lrt``." msgstr "範例:``-lrt``。" -#: ../../using/configure.rst:1410 +#: ../../using/configure.rst:1423 msgid "Command to build a shared library." msgstr "" -#: ../../using/configure.rst:1412 +#: ../../using/configure.rst:1425 msgid "Default: ``@LDSHARED@ $(PY_LDFLAGS)``." msgstr "預設值:``@LDSHARED@ $(PY_LDFLAGS)``。" -#: ../../using/configure.rst:1416 +#: ../../using/configure.rst:1429 msgid "Command to build ``libpython`` shared library." msgstr "" -#: ../../using/configure.rst:1418 +#: ../../using/configure.rst:1431 msgid "Default: ``@BLDSHARED@ $(PY_CORE_LDFLAGS)``." msgstr "預設值:``@BLDSHARED@ $(PY_CORE_LDFLAGS)``。" -#: ../../using/configure.rst:1422 +#: ../../using/configure.rst:1435 msgid "Default: ``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``." msgstr "預設值:``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``。" -#: ../../using/configure.rst:1426 +#: ../../using/configure.rst:1439 msgid "Default: ``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``." msgstr "預設值:``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``。" -#: ../../using/configure.rst:1432 +#: ../../using/configure.rst:1445 msgid "Linker flags used for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:1438 +#: ../../using/configure.rst:1451 msgid "Footnotes" msgstr "註腳" -#: ../../using/configure.rst:1439 +#: ../../using/configure.rst:1452 msgid "" "``git clean -fdx`` is an even more extreme way to \"clean\" your checkout. " "It removes all files not known to Git. When bug hunting using ``git " diff --git a/using/ios.po b/using/ios.po index 080e6a1879..1f1bd2a519 100644 --- a/using/ios.po +++ b/using/ios.po @@ -10,7 +10,8 @@ msgstr "" "POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: LANGUAGE <LL@li.org>\n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -372,6 +373,18 @@ msgid "" "\"$CODESIGNING_FOLDER_PATH/python/lib/\"\n" "fi" msgstr "" +"set -e\n" +"\n" +"mkdir -p \"$CODESIGNING_FOLDER_PATH/python/lib\"\n" +"if [ \"$EFFECTIVE_PLATFORM_NAME\" = \"-iphonesimulator\" ]; then\n" +" echo \"Installing Python modules for iOS Simulator\"\n" +" rsync -au --delete \"$PROJECT_DIR/Python.xcframework/ios-arm64_x86_64-" +"simulator/lib/\" \"$CODESIGNING_FOLDER_PATH/python/lib/\"\n" +"else\n" +" echo \"Installing Python modules for iOS Device\"\n" +" rsync -au --delete \"$PROJECT_DIR/Python.xcframework/ios-arm64/lib/\" " +"\"$CODESIGNING_FOLDER_PATH/python/lib/\"\n" +"fi" #: ../../using/ios.rst:233 msgid "" diff --git a/using/windows.po b/using/windows.po index 8ff3e1e9ed..6b1c4c3ad0 100644 --- a/using/windows.po +++ b/using/windows.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-22 00:13+0000\n" +"POT-Creation-Date: 2024-11-12 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -895,7 +895,7 @@ msgid "" "For more detail on the technical basis for these limitations, please consult " "Microsoft's documentation on packaged full-trust apps, currently available " "at `docs.microsoft.com/en-us/windows/msix/desktop/desktop-to-uwp-behind-the-" -"scenes <https://docs.microsoft.com/en-us/windows/msix/desktop/desktop-to-uwp-" +"scenes <https://learn.microsoft.com/windows/msix/desktop/desktop-to-uwp-" "behind-the-scenes>`_" msgstr "" @@ -1027,7 +1027,7 @@ msgstr "" #: ../../using/windows.rst:537 msgid "" "The embedded distribution does not include the `Microsoft C Runtime <https://" -"docs.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist#visual-" +"learn.microsoft.com/cpp/windows/latest-supported-vc-redist#visual-" "studio-2015-2017-2019-and-2022>`_ and it is the responsibility of the " "application installer to provide this. The runtime may have already been " "installed on a user's system previously or automatically via Windows Update, " @@ -1257,11 +1257,9 @@ msgstr "" #: ../../using/windows.rst:681 msgid "" -"https://docs.microsoft.com/en-us/windows/win32/procthread/environment-" -"variables" +"https://learn.microsoft.com/windows/win32/procthread/environment-variables" msgstr "" -"https://docs.microsoft.com/en-us/windows/win32/procthread/environment-" -"variables" +"https://learn.microsoft.com/windows/win32/procthread/environment-variables" #: ../../using/windows.rst:682 msgid "Overview of environment variables on Windows" @@ -1269,11 +1267,11 @@ msgstr "Windows 上的環境變數概要" #: ../../using/windows.rst:684 msgid "" -"https://docs.microsoft.com/en-us/windows-server/administration/windows-" -"commands/set_1" +"https://learn.microsoft.com/windows-server/administration/windows-commands/" +"set_1" msgstr "" -"https://docs.microsoft.com/en-us/windows-server/administration/windows-" -"commands/set_1" +"https://learn.microsoft.com/windows-server/administration/windows-commands/" +"set_1" #: ../../using/windows.rst:685 msgid "The ``set`` command, for temporarily modifying environment variables" @@ -1281,11 +1279,11 @@ msgstr "" #: ../../using/windows.rst:687 msgid "" -"https://docs.microsoft.com/en-us/windows-server/administration/windows-" -"commands/setx" +"https://learn.microsoft.com/windows-server/administration/windows-commands/" +"setx" msgstr "" -"https://docs.microsoft.com/en-us/windows-server/administration/windows-" -"commands/setx" +"https://learn.microsoft.com/windows-server/administration/windows-commands/" +"setx" #: ../../using/windows.rst:688 msgid "The ``setx`` command, for permanently modifying environment variables" @@ -2270,7 +2268,7 @@ msgstr "" #: ../../using/windows.rst:1292 msgid "" -"`Component Object Model <https://docs.microsoft.com/en-us/windows/win32/com/" +"`Component Object Model <https://learn.microsoft.com/windows/win32/com/" "component-object-model--com--portal>`_ (COM)" msgstr "" @@ -2288,7 +2286,7 @@ msgstr "事件日誌(Event log)" #: ../../using/windows.rst:1298 msgid "" -"`Microsoft Foundation Classes <https://docs.microsoft.com/en-us/cpp/mfc/mfc-" +"`Microsoft Foundation Classes <https://learn.microsoft.com/cpp/mfc/mfc-" "desktop-applications>`_ (MFC) user interfaces" msgstr "" diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index 5a4af094ce..b0f93a3c71 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-10 17:21+0000\n" +"POT-Creation-Date: 2024-11-18 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -265,7 +265,7 @@ msgstr "" "`unittest.TestCase` 的\\ `方法別名 <unittest-TestCase-removed-aliases_>`_\\ " "已被刪除。" -#: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1826 +#: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1832 msgid "New Features" msgstr "新增功能" @@ -1251,7 +1251,7 @@ msgid "" "Windows. (Contributed by Charles Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:861 ../../whatsnew/3.12.rst:1530 +#: ../../whatsnew/3.12.rst:861 ../../whatsnew/3.12.rst:1536 msgid "sqlite3" msgstr "sqlite3" @@ -1326,7 +1326,7 @@ msgid "" "Katriel in :gh:`102778`.)" msgstr "" -#: ../../whatsnew/3.12.rst:912 ../../whatsnew/3.12.rst:1725 +#: ../../whatsnew/3.12.rst:912 ../../whatsnew/3.12.rst:1731 msgid "" ":func:`sys._current_exceptions` now returns a mapping from thread-id to an " "exception instance, rather than to a ``(typ, exc, tb)`` tuple. (Contributed " @@ -1498,7 +1498,7 @@ msgid "" "Benjamin Peterson in :gh:`96734`)." msgstr "" -#: ../../whatsnew/3.12.rst:1026 ../../whatsnew/3.12.rst:1570 +#: ../../whatsnew/3.12.rst:1026 ../../whatsnew/3.12.rst:1576 msgid "unittest" msgstr "unittest" @@ -1706,7 +1706,7 @@ msgid "" "demos>`_. (Contributed by Victor Stinner in :gh:`97669`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1143 ../../whatsnew/3.12.rst:2128 +#: ../../whatsnew/3.12.rst:1143 ../../whatsnew/3.12.rst:2134 msgid "Deprecated" msgstr "已棄用" @@ -1906,6 +1906,9 @@ msgid "" "are deprecated and will be removed in Python 3.14; use :func:`importlib.util." "find_spec` instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" +":mod:`pkgutil`::func:`pkgutil.find_loader` 和 :func:`pkgutil.get_loader` 已" +"被棄用並將在 Python 3.14 中移除;請改用 :func:`importlib.util.find_spec`。" +"(由 Nikita Sobolev 於 :gh:`97850` 中貢獻。)" #: ../../whatsnew/3.12.rst:1237 msgid "" @@ -1986,6 +1989,9 @@ msgid "" "last_traceback` fields are deprecated. Use :data:`sys.last_exc` instead. " "(Contributed by Irit Katriel in :gh:`102778`.)" msgstr "" +":mod:`sys`::data:`sys.last_type`、:data:`sys.last_value` 和 :data:`sys." +"last_traceback` 欄位已被棄用。請改用 :data:`sys.last_exc`。(由 Irit Katriel " +"於 :gh:`102778` 中貢獻。)" #: ../../whatsnew/3.12.rst:1286 msgid "" @@ -2587,6 +2593,9 @@ msgid "" "Python 3.16, use :func:`inspect.iscoroutinefunction` instead. (Contributed " "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" +":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" +"gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 #: ../../deprecations/pending-removal-in-future.rst:12 @@ -3063,32 +3072,32 @@ msgstr "" ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." "zipimporter.exec_module`。" -#: ../../whatsnew/3.12.rst:1345 ../../whatsnew/3.12.rst:2223 +#: ../../whatsnew/3.12.rst:1347 ../../whatsnew/3.12.rst:2229 msgid "Removed" msgstr "已移除" -#: ../../whatsnew/3.12.rst:1348 +#: ../../whatsnew/3.12.rst:1350 msgid "asynchat and asyncore" msgstr "asynchat 和 asyncore" -#: ../../whatsnew/3.12.rst:1350 +#: ../../whatsnew/3.12.rst:1352 msgid "" "These two modules have been removed according to the schedule in :pep:`594`, " "having been deprecated in Python 3.6. Use :mod:`asyncio` instead. " "(Contributed by Nikita Sobolev in :gh:`96580`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1357 +#: ../../whatsnew/3.12.rst:1359 msgid "configparser" msgstr "configparser" -#: ../../whatsnew/3.12.rst:1359 +#: ../../whatsnew/3.12.rst:1361 msgid "" "Several names deprecated in the :mod:`configparser` way back in 3.2 have " "been removed per :gh:`89336`:" msgstr "" -#: ../../whatsnew/3.12.rst:1362 +#: ../../whatsnew/3.12.rst:1364 msgid "" ":class:`configparser.ParsingError` no longer has a ``filename`` attribute or " "argument. Use the ``source`` attribute and argument instead." @@ -3096,23 +3105,23 @@ msgstr "" ":class:`configparser.ParsingError` 不再具有 ``filename`` 屬性或引數。請改用 " "``source`` 屬性和引數。" -#: ../../whatsnew/3.12.rst:1364 +#: ../../whatsnew/3.12.rst:1366 msgid "" ":mod:`configparser` no longer has a ``SafeConfigParser`` class. Use the " "shorter :class:`~configparser.ConfigParser` name instead." msgstr "" -#: ../../whatsnew/3.12.rst:1366 +#: ../../whatsnew/3.12.rst:1368 msgid "" ":class:`configparser.ConfigParser` no longer has a ``readfp`` method. Use :" "meth:`~configparser.ConfigParser.read_file` instead." msgstr "" -#: ../../whatsnew/3.12.rst:1370 +#: ../../whatsnew/3.12.rst:1374 msgid "distutils" msgstr "distutils" -#: ../../whatsnew/3.12.rst:1372 +#: ../../whatsnew/3.12.rst:1376 msgid "" "Remove the :py:mod:`!distutils` package. It was deprecated in Python 3.10 " "by :pep:`632` \"Deprecate distutils module\". For projects still using " @@ -3121,17 +3130,17 @@ msgid "" "Victor Stinner in :gh:`92584`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1379 +#: ../../whatsnew/3.12.rst:1383 msgid "ensurepip" msgstr "ensurepip" -#: ../../whatsnew/3.12.rst:1381 +#: ../../whatsnew/3.12.rst:1385 msgid "" "Remove the bundled setuptools wheel from :mod:`ensurepip`, and stop " "installing setuptools in environments created by :mod:`venv`." msgstr "" -#: ../../whatsnew/3.12.rst:1384 +#: ../../whatsnew/3.12.rst:1388 msgid "" "``pip (>= 22.1)`` does not require setuptools to be installed in the " "environment. ``setuptools``-based (and ``distutils``-based) packages can " @@ -3139,7 +3148,7 @@ msgid "" "the build environment it uses for building a package." msgstr "" -#: ../../whatsnew/3.12.rst:1390 +#: ../../whatsnew/3.12.rst:1394 msgid "" "``easy_install``, ``pkg_resources``, ``setuptools`` and ``distutils`` are no " "longer provided by default in environments created with ``venv`` or " @@ -3149,25 +3158,25 @@ msgid "" "(typically, using pip)." msgstr "" -#: ../../whatsnew/3.12.rst:1397 +#: ../../whatsnew/3.12.rst:1401 msgid "(Contributed by Pradyun Gedam in :gh:`95299`.)" msgstr "(由 Pradyun Gedam 於 :gh:`95299` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1400 +#: ../../whatsnew/3.12.rst:1404 msgid "enum" msgstr "enum" -#: ../../whatsnew/3.12.rst:1402 +#: ../../whatsnew/3.12.rst:1406 msgid "" "Remove :mod:`enum`'s ``EnumMeta.__getattr__``, which is no longer needed for " "enum attribute access. (Contributed by Ethan Furman in :gh:`95083`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1407 +#: ../../whatsnew/3.12.rst:1411 msgid "ftplib" msgstr "ftplib" -#: ../../whatsnew/3.12.rst:1409 +#: ../../whatsnew/3.12.rst:1413 msgid "" "Remove :mod:`ftplib`'s ``FTP_TLS.ssl_version`` class attribute: use the " "*context* parameter instead. (Contributed by Victor Stinner in :gh:`94172`.)" @@ -3175,11 +3184,11 @@ msgstr "" "移除 :mod:`ftplib` 的 ``FTP_TLS.ssl_version`` 類別屬性:請改用 *context* 參" "數。(由 Victor Stinner 於 :gh:`94172` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1414 +#: ../../whatsnew/3.12.rst:1418 msgid "gzip" msgstr "gzip" -#: ../../whatsnew/3.12.rst:1416 +#: ../../whatsnew/3.12.rst:1420 msgid "" "Remove the ``filename`` attribute of :mod:`gzip`'s :class:`gzip.GzipFile`, " "deprecated since Python 2.6, use the :attr:`~gzip.GzipFile.name` attribute " @@ -3188,11 +3197,11 @@ msgid "" "`94196`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1423 +#: ../../whatsnew/3.12.rst:1427 msgid "hashlib" msgstr "hashlib" -#: ../../whatsnew/3.12.rst:1425 +#: ../../whatsnew/3.12.rst:1429 msgid "" "Remove the pure Python implementation of :mod:`hashlib`'s :func:`hashlib." "pbkdf2_hmac`, deprecated in Python 3.10. Python 3.10 and newer requires " @@ -3201,17 +3210,17 @@ msgid "" "Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1432 ../../whatsnew/3.12.rst:1459 +#: ../../whatsnew/3.12.rst:1436 ../../whatsnew/3.12.rst:1465 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.12.rst:1434 +#: ../../whatsnew/3.12.rst:1438 msgid "" "Many previously deprecated cleanups in :mod:`importlib` have now been " "completed:" msgstr "現已完成清理 :mod:`importlib` 中許多過去已經棄用的東西:" -#: ../../whatsnew/3.12.rst:1437 +#: ../../whatsnew/3.12.rst:1441 msgid "" "References to, and support for :meth:`!module_repr` has been removed. " "(Contributed by Barry Warsaw in :gh:`97850`.)" @@ -3219,134 +3228,134 @@ msgstr "" "對 :meth:`!module_repr` 的參照和支援已刪除。(由 Barry Warsaw 在 :gh:`97850` " "中貢獻。)" -#: ../../whatsnew/3.12.rst:1440 +#: ../../whatsnew/3.12.rst:1444 msgid "" "``importlib.util.set_package``, ``importlib.util.set_loader`` and " "``importlib.util.module_for_loader`` have all been removed. (Contributed by " "Brett Cannon and Nikita Sobolev in :gh:`65961` and :gh:`97850`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1444 +#: ../../whatsnew/3.12.rst:1448 msgid "" "Support for ``find_loader()`` and ``find_module()`` APIs have been removed. " "(Contributed by Barry Warsaw in :gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1447 +#: ../../whatsnew/3.12.rst:1451 msgid "" "``importlib.abc.Finder``, ``pkgutil.ImpImporter``, and ``pkgutil.ImpLoader`` " "have been removed. (Contributed by Barry Warsaw in :gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1451 ../../whatsnew/3.12.rst:1459 +#: ../../whatsnew/3.12.rst:1457 ../../whatsnew/3.12.rst:1465 msgid "imp" msgstr "imp" -#: ../../whatsnew/3.12.rst:1453 +#: ../../whatsnew/3.12.rst:1459 msgid "" "The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in :" "gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1456 +#: ../../whatsnew/3.12.rst:1462 msgid "To migrate, consult the following correspondence table:" msgstr "" -#: ../../whatsnew/3.12.rst:1461 +#: ../../whatsnew/3.12.rst:1467 msgid "``imp.NullImporter``" msgstr "``imp.NullImporter``" -#: ../../whatsnew/3.12.rst:1461 +#: ../../whatsnew/3.12.rst:1467 msgid "Insert ``None`` into ``sys.path_importer_cache``" msgstr "將 ``None`` 插入 ``sys.path_importer_cache``" -#: ../../whatsnew/3.12.rst:1462 +#: ../../whatsnew/3.12.rst:1468 msgid "``imp.cache_from_source()``" msgstr "``imp.cache_from_source()``" -#: ../../whatsnew/3.12.rst:1462 +#: ../../whatsnew/3.12.rst:1468 msgid ":func:`importlib.util.cache_from_source`" msgstr ":func:`importlib.util.cache_from_source`" -#: ../../whatsnew/3.12.rst:1463 +#: ../../whatsnew/3.12.rst:1469 msgid "``imp.find_module()``" msgstr "``imp.find_module()``" -#: ../../whatsnew/3.12.rst:1463 +#: ../../whatsnew/3.12.rst:1469 msgid ":func:`importlib.util.find_spec`" msgstr ":func:`importlib.util.find_spec`" -#: ../../whatsnew/3.12.rst:1464 +#: ../../whatsnew/3.12.rst:1470 msgid "``imp.get_magic()``" msgstr "``imp.get_magic()``" -#: ../../whatsnew/3.12.rst:1464 +#: ../../whatsnew/3.12.rst:1470 msgid ":attr:`importlib.util.MAGIC_NUMBER`" msgstr ":attr:`importlib.util.MAGIC_NUMBER`" -#: ../../whatsnew/3.12.rst:1465 +#: ../../whatsnew/3.12.rst:1471 msgid "``imp.get_suffixes()``" msgstr "``imp.get_suffixes()``" -#: ../../whatsnew/3.12.rst:1465 +#: ../../whatsnew/3.12.rst:1471 msgid "" ":attr:`importlib.machinery.SOURCE_SUFFIXES`, :attr:`importlib.machinery." "EXTENSION_SUFFIXES`, and :attr:`importlib.machinery.BYTECODE_SUFFIXES`" msgstr "" -#: ../../whatsnew/3.12.rst:1466 +#: ../../whatsnew/3.12.rst:1472 msgid "``imp.get_tag()``" msgstr "``imp.get_tag()``" -#: ../../whatsnew/3.12.rst:1466 +#: ../../whatsnew/3.12.rst:1472 msgid ":attr:`sys.implementation.cache_tag <sys.implementation>`" msgstr ":attr:`sys.implementation.cache_tag <sys.implementation>`" -#: ../../whatsnew/3.12.rst:1467 +#: ../../whatsnew/3.12.rst:1473 msgid "``imp.load_module()``" msgstr "``imp.load_module()``" -#: ../../whatsnew/3.12.rst:1467 +#: ../../whatsnew/3.12.rst:1473 msgid ":func:`importlib.import_module`" msgstr ":func:`importlib.import_module`" -#: ../../whatsnew/3.12.rst:1468 +#: ../../whatsnew/3.12.rst:1474 msgid "``imp.new_module(name)``" msgstr "``imp.new_module(name)``" -#: ../../whatsnew/3.12.rst:1468 +#: ../../whatsnew/3.12.rst:1474 msgid "``types.ModuleType(name)``" msgstr "``types.ModuleType(name)``" -#: ../../whatsnew/3.12.rst:1469 +#: ../../whatsnew/3.12.rst:1475 msgid "``imp.reload()``" msgstr "``imp.reload()``" -#: ../../whatsnew/3.12.rst:1469 +#: ../../whatsnew/3.12.rst:1475 msgid ":func:`importlib.reload`" msgstr ":func:`importlib.reload`" -#: ../../whatsnew/3.12.rst:1470 +#: ../../whatsnew/3.12.rst:1476 msgid "``imp.source_from_cache()``" msgstr "``imp.source_from_cache()``" -#: ../../whatsnew/3.12.rst:1470 +#: ../../whatsnew/3.12.rst:1476 msgid ":func:`importlib.util.source_from_cache`" msgstr ":func:`importlib.util.source_from_cache`" -#: ../../whatsnew/3.12.rst:1471 +#: ../../whatsnew/3.12.rst:1477 msgid "``imp.load_source()``" msgstr "``imp.load_source()``" -#: ../../whatsnew/3.12.rst:1471 +#: ../../whatsnew/3.12.rst:1477 msgid "*See below*" msgstr "*見下文*" -#: ../../whatsnew/3.12.rst:1474 +#: ../../whatsnew/3.12.rst:1480 msgid "Replace ``imp.load_source()`` with::" msgstr "用以下取代 ``imp.load_source()``: ::" -#: ../../whatsnew/3.12.rst:1476 +#: ../../whatsnew/3.12.rst:1482 msgid "" "import importlib.util\n" "import importlib.machinery\n" @@ -3363,37 +3372,37 @@ msgid "" " return module" msgstr "" -#: ../../whatsnew/3.12.rst:1489 +#: ../../whatsnew/3.12.rst:1495 msgid "Remove :mod:`!imp` functions and attributes with no replacements:" msgstr "移除 :mod:`!imp` 函式和屬性、沒有替代方案:" -#: ../../whatsnew/3.12.rst:1491 +#: ../../whatsnew/3.12.rst:1497 msgid "Undocumented functions:" msgstr "未以文件記錄的函式:" -#: ../../whatsnew/3.12.rst:1493 +#: ../../whatsnew/3.12.rst:1499 msgid "``imp.init_builtin()``" msgstr "``imp.init_builtin()``" -#: ../../whatsnew/3.12.rst:1494 +#: ../../whatsnew/3.12.rst:1500 msgid "``imp.load_compiled()``" msgstr "``imp.load_compiled()``" -#: ../../whatsnew/3.12.rst:1495 +#: ../../whatsnew/3.12.rst:1501 msgid "``imp.load_dynamic()``" msgstr "``imp.load_dynamic()``" -#: ../../whatsnew/3.12.rst:1496 +#: ../../whatsnew/3.12.rst:1502 msgid "``imp.load_package()``" msgstr "``imp.load_package()``" -#: ../../whatsnew/3.12.rst:1498 +#: ../../whatsnew/3.12.rst:1504 msgid "" "``imp.lock_held()``, ``imp.acquire_lock()``, ``imp.release_lock()``: the " "locking scheme has changed in Python 3.3 to per-module locks." msgstr "" -#: ../../whatsnew/3.12.rst:1500 +#: ../../whatsnew/3.12.rst:1506 msgid "" "``imp.find_module()`` constants: ``SEARCH_ERROR``, ``PY_SOURCE``, " "``PY_COMPILED``, ``C_EXTENSION``, ``PY_RESOURCE``, ``PKG_DIRECTORY``, " @@ -3403,11 +3412,11 @@ msgstr "" "``PY_COMPILED``、``C_EXTENSION``、``PY_RESOURCE``、``PKG_DIRECTORY``、" "``C_BUILTIN``、``PY_FROZEN``、``PY_CODERESOURCE``、``IMP_HOOK``。" -#: ../../whatsnew/3.12.rst:1505 +#: ../../whatsnew/3.12.rst:1511 msgid "io" msgstr "io" -#: ../../whatsnew/3.12.rst:1507 +#: ../../whatsnew/3.12.rst:1513 msgid "" "Remove :mod:`io`'s ``io.OpenWrapper`` and ``_pyio.OpenWrapper``, deprecated " "in Python 3.10: just use :func:`open` instead. The :func:`open` (:func:`io." @@ -3416,22 +3425,22 @@ msgid "" "`94169`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1514 +#: ../../whatsnew/3.12.rst:1520 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.12.rst:1516 +#: ../../whatsnew/3.12.rst:1522 msgid "" "Remove :mod:`locale`'s :func:`!locale.format` function, deprecated in Python " "3.7: use :func:`locale.format_string` instead. (Contributed by Victor " "Stinner in :gh:`94226`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1521 +#: ../../whatsnew/3.12.rst:1527 msgid "smtpd" msgstr "smtpd" -#: ../../whatsnew/3.12.rst:1523 +#: ../../whatsnew/3.12.rst:1529 msgid "" "The ``smtpd`` module has been removed according to the schedule in :pep:" "`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use the :pypi:" @@ -3439,27 +3448,27 @@ msgid "" "(Contributed by Oleg Iarygin in :gh:`93243`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1532 +#: ../../whatsnew/3.12.rst:1538 msgid "" "The following undocumented :mod:`sqlite3` features, deprecated in Python " "3.10, are now removed:" msgstr "" -#: ../../whatsnew/3.12.rst:1535 +#: ../../whatsnew/3.12.rst:1541 msgid "``sqlite3.enable_shared_cache()``" msgstr "``sqlite3.enable_shared_cache()``" -#: ../../whatsnew/3.12.rst:1536 +#: ../../whatsnew/3.12.rst:1542 msgid "``sqlite3.OptimizedUnicode``" msgstr "``sqlite3.OptimizedUnicode``" -#: ../../whatsnew/3.12.rst:1538 +#: ../../whatsnew/3.12.rst:1544 msgid "" "If a shared cache must be used, open the database in URI mode using the " "``cache=shared`` query parameter." msgstr "" -#: ../../whatsnew/3.12.rst:1541 +#: ../../whatsnew/3.12.rst:1547 msgid "" "The ``sqlite3.OptimizedUnicode`` text factory has been an alias for :class:" "`str` since Python 3.3. Code that previously set the text factory to " @@ -3467,22 +3476,22 @@ msgid "" "default value which is also ``str``." msgstr "" -#: ../../whatsnew/3.12.rst:1546 +#: ../../whatsnew/3.12.rst:1552 msgid "(Contributed by Erlend E. Aasland in :gh:`92548`.)" msgstr "(由 Erlend E. Aasland 於 :gh:`92548` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1549 +#: ../../whatsnew/3.12.rst:1555 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.12.rst:1551 +#: ../../whatsnew/3.12.rst:1557 msgid "" "Remove :mod:`ssl`'s :func:`!ssl.RAND_pseudo_bytes` function, deprecated in " "Python 3.6: use :func:`os.urandom` or :func:`ssl.RAND_bytes` instead. " "(Contributed by Victor Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1555 +#: ../../whatsnew/3.12.rst:1561 msgid "" "Remove the :func:`!ssl.match_hostname` function. It was deprecated in Python " "3.7. OpenSSL performs hostname matching since Python 3.7, Python no longer " @@ -3490,7 +3499,7 @@ msgid "" "Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1561 +#: ../../whatsnew/3.12.rst:1567 msgid "" "Remove the :func:`!ssl.wrap_socket` function, deprecated in Python 3.7: " "instead, create a :class:`ssl.SSLContext` object and call its :class:`ssl." @@ -3501,189 +3510,189 @@ msgid "" "`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1572 +#: ../../whatsnew/3.12.rst:1578 msgid "Remove many long-deprecated :mod:`unittest` features:" msgstr "移除許多 :mod:`unittest` 中被棄用已久的功能:" -#: ../../whatsnew/3.12.rst:1576 +#: ../../whatsnew/3.12.rst:1582 msgid "A number of :class:`~unittest.TestCase` method aliases:" msgstr "許多 :class:`~unittest.TestCase` 方法別名:" -#: ../../whatsnew/3.12.rst:1579 +#: ../../whatsnew/3.12.rst:1585 msgid "Deprecated alias" msgstr "已棄用的別名" -#: ../../whatsnew/3.12.rst:1579 +#: ../../whatsnew/3.12.rst:1585 msgid "Method Name" msgstr "方法名稱" -#: ../../whatsnew/3.12.rst:1579 +#: ../../whatsnew/3.12.rst:1585 msgid "Deprecated in" msgstr "已棄用於" -#: ../../whatsnew/3.12.rst:1581 +#: ../../whatsnew/3.12.rst:1587 msgid "``failUnless``" msgstr "``failUnless``" -#: ../../whatsnew/3.12.rst:1581 ../../whatsnew/3.12.rst:1588 +#: ../../whatsnew/3.12.rst:1587 ../../whatsnew/3.12.rst:1594 msgid ":meth:`.assertTrue`" msgstr ":meth:`.assertTrue`" -#: ../../whatsnew/3.12.rst:1581 ../../whatsnew/3.12.rst:1582 -#: ../../whatsnew/3.12.rst:1583 ../../whatsnew/3.12.rst:1584 -#: ../../whatsnew/3.12.rst:1585 ../../whatsnew/3.12.rst:1586 -#: ../../whatsnew/3.12.rst:1587 +#: ../../whatsnew/3.12.rst:1587 ../../whatsnew/3.12.rst:1588 +#: ../../whatsnew/3.12.rst:1589 ../../whatsnew/3.12.rst:1590 +#: ../../whatsnew/3.12.rst:1591 ../../whatsnew/3.12.rst:1592 +#: ../../whatsnew/3.12.rst:1593 msgid "3.1" msgstr "3.1" -#: ../../whatsnew/3.12.rst:1582 +#: ../../whatsnew/3.12.rst:1588 msgid "``failIf``" msgstr "``failIf``" -#: ../../whatsnew/3.12.rst:1582 +#: ../../whatsnew/3.12.rst:1588 msgid ":meth:`.assertFalse`" msgstr ":meth:`.assertFalse`" -#: ../../whatsnew/3.12.rst:1583 +#: ../../whatsnew/3.12.rst:1589 msgid "``failUnlessEqual``" msgstr "``failUnlessEqual``" -#: ../../whatsnew/3.12.rst:1583 ../../whatsnew/3.12.rst:1589 +#: ../../whatsnew/3.12.rst:1589 ../../whatsnew/3.12.rst:1595 msgid ":meth:`.assertEqual`" msgstr ":meth:`.assertEqual`" -#: ../../whatsnew/3.12.rst:1584 +#: ../../whatsnew/3.12.rst:1590 msgid "``failIfEqual``" msgstr "``failIfEqual``" -#: ../../whatsnew/3.12.rst:1584 ../../whatsnew/3.12.rst:1590 +#: ../../whatsnew/3.12.rst:1590 ../../whatsnew/3.12.rst:1596 msgid ":meth:`.assertNotEqual`" msgstr ":meth:`.assertNotEqual`" -#: ../../whatsnew/3.12.rst:1585 +#: ../../whatsnew/3.12.rst:1591 msgid "``failUnlessAlmostEqual``" msgstr "``failUnlessAlmostEqual``" -#: ../../whatsnew/3.12.rst:1585 ../../whatsnew/3.12.rst:1591 +#: ../../whatsnew/3.12.rst:1591 ../../whatsnew/3.12.rst:1597 msgid ":meth:`.assertAlmostEqual`" msgstr ":meth:`.assertAlmostEqual`" -#: ../../whatsnew/3.12.rst:1586 +#: ../../whatsnew/3.12.rst:1592 msgid "``failIfAlmostEqual``" msgstr "``failIfAlmostEqual``" -#: ../../whatsnew/3.12.rst:1586 ../../whatsnew/3.12.rst:1592 +#: ../../whatsnew/3.12.rst:1592 ../../whatsnew/3.12.rst:1598 msgid ":meth:`.assertNotAlmostEqual`" msgstr ":meth:`.assertNotAlmostEqual`" -#: ../../whatsnew/3.12.rst:1587 +#: ../../whatsnew/3.12.rst:1593 msgid "``failUnlessRaises``" msgstr "``failUnlessRaises``" -#: ../../whatsnew/3.12.rst:1587 +#: ../../whatsnew/3.12.rst:1593 msgid ":meth:`.assertRaises`" msgstr ":meth:`.assertRaises`" -#: ../../whatsnew/3.12.rst:1588 +#: ../../whatsnew/3.12.rst:1594 msgid "``assert_``" msgstr "``assert_``" -#: ../../whatsnew/3.12.rst:1588 ../../whatsnew/3.12.rst:1589 -#: ../../whatsnew/3.12.rst:1590 ../../whatsnew/3.12.rst:1591 -#: ../../whatsnew/3.12.rst:1592 ../../whatsnew/3.12.rst:1593 -#: ../../whatsnew/3.12.rst:1594 +#: ../../whatsnew/3.12.rst:1594 ../../whatsnew/3.12.rst:1595 +#: ../../whatsnew/3.12.rst:1596 ../../whatsnew/3.12.rst:1597 +#: ../../whatsnew/3.12.rst:1598 ../../whatsnew/3.12.rst:1599 +#: ../../whatsnew/3.12.rst:1600 msgid "3.2" msgstr "3.2" -#: ../../whatsnew/3.12.rst:1589 +#: ../../whatsnew/3.12.rst:1595 msgid "``assertEquals``" msgstr "``assertEquals``" -#: ../../whatsnew/3.12.rst:1590 +#: ../../whatsnew/3.12.rst:1596 msgid "``assertNotEquals``" msgstr "``assertNotEquals``" -#: ../../whatsnew/3.12.rst:1591 +#: ../../whatsnew/3.12.rst:1597 msgid "``assertAlmostEquals``" msgstr "``assertAlmostEquals``" -#: ../../whatsnew/3.12.rst:1592 +#: ../../whatsnew/3.12.rst:1598 msgid "``assertNotAlmostEquals``" msgstr "``assertNotAlmostEquals``" -#: ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1599 msgid "``assertRegexpMatches``" msgstr "``assertRegexpMatches``" -#: ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1599 msgid ":meth:`.assertRegex`" msgstr ":meth:`.assertRegex`" -#: ../../whatsnew/3.12.rst:1594 +#: ../../whatsnew/3.12.rst:1600 msgid "``assertRaisesRegexp``" msgstr "``assertRaisesRegexp``" -#: ../../whatsnew/3.12.rst:1594 +#: ../../whatsnew/3.12.rst:1600 msgid ":meth:`.assertRaisesRegex`" msgstr ":meth:`.assertRaisesRegex`" -#: ../../whatsnew/3.12.rst:1595 +#: ../../whatsnew/3.12.rst:1601 msgid "``assertNotRegexpMatches``" msgstr "``assertNotRegexpMatches``" -#: ../../whatsnew/3.12.rst:1595 +#: ../../whatsnew/3.12.rst:1601 msgid ":meth:`.assertNotRegex`" msgstr ":meth:`.assertNotRegex`" -#: ../../whatsnew/3.12.rst:1595 +#: ../../whatsnew/3.12.rst:1601 msgid "3.5" msgstr "3.5" -#: ../../whatsnew/3.12.rst:1598 +#: ../../whatsnew/3.12.rst:1604 msgid "" "You can use https://github.com/isidentical/teyit to automatically modernise " "your unit tests." msgstr "" -#: ../../whatsnew/3.12.rst:1601 +#: ../../whatsnew/3.12.rst:1607 msgid "" "Undocumented and broken :class:`~unittest.TestCase` method " "``assertDictContainsSubset`` (deprecated in Python 3.2)." msgstr "" -#: ../../whatsnew/3.12.rst:1604 +#: ../../whatsnew/3.12.rst:1610 msgid "" "Undocumented :meth:`TestLoader.loadTestsFromModule <unittest.TestLoader." "loadTestsFromModule>` parameter *use_load_tests* (deprecated and ignored " "since Python 3.5)." msgstr "" -#: ../../whatsnew/3.12.rst:1608 +#: ../../whatsnew/3.12.rst:1614 msgid "" "An alias of the :class:`~unittest.TextTestResult` class: ``_TextTestResult`` " "(deprecated in Python 3.2)." msgstr "" -#: ../../whatsnew/3.12.rst:1611 +#: ../../whatsnew/3.12.rst:1617 msgid "(Contributed by Serhiy Storchaka in :gh:`89325`.)" msgstr "(由 Serhiy Storchaka 於 :gh:`89325` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1614 +#: ../../whatsnew/3.12.rst:1620 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.12.rst:1616 +#: ../../whatsnew/3.12.rst:1622 msgid "" "Remove support for obsolete browsers from :mod:`webbrowser`. The removed " "browsers include: Grail, Mosaic, Netscape, Galeon, Skipstone, Iceape, " "Firebird, and Firefox versions 35 and below (:gh:`102871`)." msgstr "" -#: ../../whatsnew/3.12.rst:1621 +#: ../../whatsnew/3.12.rst:1627 msgid "xml.etree.ElementTree" msgstr "xml.etree.ElementTree" -#: ../../whatsnew/3.12.rst:1623 +#: ../../whatsnew/3.12.rst:1629 msgid "" "Remove the ``ElementTree.Element.copy()`` method of the pure Python " "implementation, deprecated in Python 3.10, use the :func:`copy.copy` " @@ -3692,22 +3701,22 @@ msgid "" "Stinner in :gh:`94383`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1630 +#: ../../whatsnew/3.12.rst:1636 msgid "zipimport" msgstr "zipimport" -#: ../../whatsnew/3.12.rst:1632 +#: ../../whatsnew/3.12.rst:1638 msgid "" "Remove :mod:`zipimport`'s ``find_loader()`` and ``find_module()`` methods, " "deprecated in Python 3.10: use the ``find_spec()`` method instead. See :pep:" "`451` for the rationale. (Contributed by Victor Stinner in :gh:`94379`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1638 +#: ../../whatsnew/3.12.rst:1644 msgid "Others" msgstr "其他" -#: ../../whatsnew/3.12.rst:1640 +#: ../../whatsnew/3.12.rst:1646 msgid "" "Remove the ``suspicious`` rule from the documentation :file:`Makefile` and :" "file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint <https://github." @@ -3715,7 +3724,7 @@ msgid "" "`98179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1645 +#: ../../whatsnew/3.12.rst:1651 msgid "" "Remove the *keyfile* and *certfile* parameters from the :mod:`ftplib`, :mod:" "`imaplib`, :mod:`poplib` and :mod:`smtplib` modules, and the *key_file*, " @@ -3725,7 +3734,7 @@ msgid "" "in :gh:`94172`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1653 +#: ../../whatsnew/3.12.rst:1659 msgid "" "Remove ``Jython`` compatibility hacks from several stdlib modules and tests. " "(Contributed by Nikita Sobolev in :gh:`99482`.)" @@ -3733,7 +3742,7 @@ msgstr "" "移除數個標準函式庫模組與測試中的 ``Jython`` 相容性修補程式。(由 Nikita " "Sobolev 於 :gh:`99482` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1656 +#: ../../whatsnew/3.12.rst:1662 msgid "" "Remove ``_use_broken_old_ctypes_structure_semantics_`` flag from :mod:" "`ctypes` module. (Contributed by Nikita Sobolev in :gh:`99285`.)" @@ -3741,21 +3750,21 @@ msgstr "" "移除 :mod:`ctypes` 模組中的 ``_use_broken_old_ctypes_structure_semantics_`` " "旗標。(由 Nikita Sobolev 於 :gh:`99285` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1664 ../../whatsnew/3.12.rst:1988 +#: ../../whatsnew/3.12.rst:1670 ../../whatsnew/3.12.rst:1994 msgid "Porting to Python 3.12" msgstr "移植至 Python 3.12" -#: ../../whatsnew/3.12.rst:1666 +#: ../../whatsnew/3.12.rst:1672 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.12.rst:1670 +#: ../../whatsnew/3.12.rst:1676 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.12.rst:1672 +#: ../../whatsnew/3.12.rst:1678 msgid "" "More strict rules are now applied for numerical group references and group " "names in regular expressions. Only sequence of ASCII digits is now accepted " @@ -3764,7 +3773,7 @@ msgid "" "(Contributed by Serhiy Storchaka in :gh:`91760`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1679 +#: ../../whatsnew/3.12.rst:1685 msgid "" "Remove ``randrange()`` functionality deprecated since Python 3.10. " "Formerly, ``randrange(10.0)`` losslessly converted to ``randrange(10)``. " @@ -3776,7 +3785,7 @@ msgid "" "`86388`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1687 +#: ../../whatsnew/3.12.rst:1693 msgid "" ":class:`argparse.ArgumentParser` changed encoding and error handler for " "reading arguments from file (e.g. ``fromfile_prefix_chars`` option) from " @@ -3786,21 +3795,21 @@ msgid "" "on Windows." msgstr "" -#: ../../whatsnew/3.12.rst:1693 +#: ../../whatsnew/3.12.rst:1699 msgid "" "Remove the ``asyncore``-based ``smtpd`` module deprecated in Python 3.4.7 " "and 3.5.4. A recommended replacement is the :mod:`asyncio`-based :pypi:" "`aiosmtpd` PyPI module." msgstr "" -#: ../../whatsnew/3.12.rst:1697 +#: ../../whatsnew/3.12.rst:1703 msgid "" ":func:`shlex.split`: Passing ``None`` for *s* argument now raises an " "exception, rather than reading :data:`sys.stdin`. The feature was deprecated " "in Python 3.9. (Contributed by Victor Stinner in :gh:`94352`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1702 +#: ../../whatsnew/3.12.rst:1708 msgid "" "The :mod:`os` module no longer accepts bytes-like paths, like :class:" "`bytearray` and :class:`memoryview` types: only the exact :class:`bytes` " @@ -3808,7 +3817,7 @@ msgid "" "`98393`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1707 +#: ../../whatsnew/3.12.rst:1713 msgid "" ":func:`syslog.openlog` and :func:`syslog.closelog` now fail if used in " "subinterpreters. :func:`syslog.syslog` may still be used in subinterpreters, " @@ -3820,7 +3829,7 @@ msgid "" "(Contributed by Donghee Na in :gh:`99127`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1716 +#: ../../whatsnew/3.12.rst:1722 msgid "" "The undocumented locking behavior of :func:`~functools.cached_property` is " "removed, because it locked across all instances of the class, leading to " @@ -3832,14 +3841,14 @@ msgid "" "property getter function or around multi-threaded access points." msgstr "" -#: ../../whatsnew/3.12.rst:1729 +#: ../../whatsnew/3.12.rst:1735 msgid "" "When extracting tar files using :mod:`tarfile` or :func:`shutil." "unpack_archive`, pass the *filter* argument to limit features that may be " "surprising or dangerous. See :ref:`tarfile-extraction-filter` for details." msgstr "" -#: ../../whatsnew/3.12.rst:1734 +#: ../../whatsnew/3.12.rst:1740 msgid "" "The output of the :func:`tokenize.tokenize` and :func:`tokenize." "generate_tokens` functions is now changed due to the changes introduced in :" @@ -3851,15 +3860,15 @@ msgid "" "``f\"start {1+1} end\"`` the old version of the tokenizer emitted::" msgstr "" -#: ../../whatsnew/3.12.rst:1743 +#: ../../whatsnew/3.12.rst:1749 msgid "1,0-1,18: STRING 'f\"start {1+1} end\"'" msgstr "1,0-1,18: STRING 'f\"start {1+1} end\"'" -#: ../../whatsnew/3.12.rst:1745 +#: ../../whatsnew/3.12.rst:1751 msgid "while the new version emits::" msgstr "" -#: ../../whatsnew/3.12.rst:1747 +#: ../../whatsnew/3.12.rst:1753 msgid "" "1,0-1,2: FSTRING_START 'f\"'\n" "1,2-1,8: FSTRING_MIDDLE 'start '\n" @@ -3881,54 +3890,54 @@ msgstr "" "1,13-1,17: FSTRING_MIDDLE ' end'\n" "1,17-1,18: FSTRING_END '\"'" -#: ../../whatsnew/3.12.rst:1757 +#: ../../whatsnew/3.12.rst:1763 msgid "" "Additionally, there may be some minor behavioral changes as a consequence of " "the changes required to support :pep:`701`. Some of these changes include:" msgstr "" -#: ../../whatsnew/3.12.rst:1760 +#: ../../whatsnew/3.12.rst:1766 msgid "" "The ``type`` attribute of the tokens emitted when tokenizing some invalid " "Python characters such as ``!`` has changed from ``ERRORTOKEN`` to ``OP``." msgstr "" -#: ../../whatsnew/3.12.rst:1763 +#: ../../whatsnew/3.12.rst:1769 msgid "" "Incomplete single-line strings now also raise :exc:`tokenize.TokenError` as " "incomplete multiline strings do." msgstr "" -#: ../../whatsnew/3.12.rst:1766 +#: ../../whatsnew/3.12.rst:1772 msgid "" "Some incomplete or invalid Python code now raises :exc:`tokenize.TokenError` " "instead of returning arbitrary ``ERRORTOKEN`` tokens when tokenizing it." msgstr "" -#: ../../whatsnew/3.12.rst:1769 +#: ../../whatsnew/3.12.rst:1775 msgid "" "Mixing tabs and spaces as indentation in the same file is not supported " "anymore and will raise a :exc:`TabError`." msgstr "" -#: ../../whatsnew/3.12.rst:1772 +#: ../../whatsnew/3.12.rst:1778 msgid "" "The :mod:`threading` module now expects the :mod:`!_thread` module to have " "an ``_is_main_interpreter`` attribute. It is a function with no arguments " "that returns ``True`` if the current interpreter is the main interpreter." msgstr "" -#: ../../whatsnew/3.12.rst:1777 +#: ../../whatsnew/3.12.rst:1783 msgid "" "Any library or application that provides a custom ``_thread`` module should " "provide ``_is_main_interpreter()``. (See :gh:`112826`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1782 +#: ../../whatsnew/3.12.rst:1788 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.12.rst:1784 +#: ../../whatsnew/3.12.rst:1790 msgid "" "Python no longer uses :file:`setup.py` to build shared C extension modules. " "Build parameters like headers and libraries are detected in ``configure`` " @@ -3937,21 +3946,21 @@ msgid "" "in :gh:`93939`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1790 +#: ../../whatsnew/3.12.rst:1796 msgid "" "``va_start()`` with two parameters, like ``va_start(args, format),`` is now " "required to build Python. ``va_start()`` is no longer called with a single " "parameter. (Contributed by Kumar Aditya in :gh:`93207`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1795 +#: ../../whatsnew/3.12.rst:1801 msgid "" "CPython now uses the ThinLTO option as the default link time optimization " "policy if the Clang compiler accepts the flag. (Contributed by Donghee Na " "in :gh:`89536`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1799 +#: ../../whatsnew/3.12.rst:1805 msgid "" "Add ``COMPILEALL_OPTS`` variable in :file:`Makefile` to override :mod:" "`compileall` options (default: ``-j0``) in ``make install``. Also merged the " @@ -3960,46 +3969,46 @@ msgid "" "`99289`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1805 +#: ../../whatsnew/3.12.rst:1811 msgid "Add platform triplets for 64-bit LoongArch:" msgstr "" -#: ../../whatsnew/3.12.rst:1807 +#: ../../whatsnew/3.12.rst:1813 msgid "loongarch64-linux-gnusf" msgstr "loongarch64-linux-gnusf" -#: ../../whatsnew/3.12.rst:1808 +#: ../../whatsnew/3.12.rst:1814 msgid "loongarch64-linux-gnuf32" msgstr "loongarch64-linux-gnuf32" -#: ../../whatsnew/3.12.rst:1809 +#: ../../whatsnew/3.12.rst:1815 msgid "loongarch64-linux-gnu" msgstr "loongarch64-linux-gnu" -#: ../../whatsnew/3.12.rst:1811 +#: ../../whatsnew/3.12.rst:1817 msgid "(Contributed by Zhang Na in :gh:`90656`.)" msgstr "(由 Zhang Na 於 :gh:`90656` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1813 +#: ../../whatsnew/3.12.rst:1819 msgid "``PYTHON_FOR_REGEN`` now require Python 3.10 or newer." msgstr "" -#: ../../whatsnew/3.12.rst:1815 +#: ../../whatsnew/3.12.rst:1821 msgid "" "Autoconf 2.71 and aclocal 1.16.4 is now required to regenerate :file:`!" "configure`. (Contributed by Christian Heimes in :gh:`89886`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1819 +#: ../../whatsnew/3.12.rst:1825 msgid "" "Windows builds and macOS installers from python.org now use OpenSSL 3.0." msgstr "" -#: ../../whatsnew/3.12.rst:1823 +#: ../../whatsnew/3.12.rst:1829 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.12.rst:1830 +#: ../../whatsnew/3.12.rst:1836 msgid "" ":pep:`697`: Introduce the :ref:`Unstable C API tier <unstable-c-api>`, " "intended for low-level tools like debuggers and JIT compilers. This API may " @@ -4007,15 +4016,15 @@ msgid "" "contents are marked by the ``PyUnstable_`` prefix in names." msgstr "" -#: ../../whatsnew/3.12.rst:1836 +#: ../../whatsnew/3.12.rst:1842 msgid "Code object constructors:" msgstr "程式碼物件建構函式:" -#: ../../whatsnew/3.12.rst:1838 +#: ../../whatsnew/3.12.rst:1844 msgid "``PyUnstable_Code_New()`` (renamed from ``PyCode_New``)" msgstr "``PyUnstable_Code_New()``\\ (自 ``PyCode_New`` 重新命名)" -#: ../../whatsnew/3.12.rst:1839 +#: ../../whatsnew/3.12.rst:1845 msgid "" "``PyUnstable_Code_NewWithPosOnlyArgs()`` (renamed from " "``PyCode_NewWithPosOnlyArgs``)" @@ -4023,11 +4032,11 @@ msgstr "" "``PyUnstable_Code_NewWithPosOnlyArgs()``\\ (自 " "``PyCode_NewWithPosOnlyArgs`` 重新命名)" -#: ../../whatsnew/3.12.rst:1841 +#: ../../whatsnew/3.12.rst:1847 msgid "Extra storage for code objects (:pep:`523`):" msgstr "程式碼物件的額外儲存 (:pep:`523`):" -#: ../../whatsnew/3.12.rst:1843 +#: ../../whatsnew/3.12.rst:1849 msgid "" "``PyUnstable_Eval_RequestCodeExtraIndex()`` (renamed from " "``_PyEval_RequestCodeExtraIndex``)" @@ -4035,31 +4044,31 @@ msgstr "" "``PyUnstable_Eval_RequestCodeExtraIndex()``\\ (自 " "``_PyEval_RequestCodeExtraIndex`` 重新命名)" -#: ../../whatsnew/3.12.rst:1844 +#: ../../whatsnew/3.12.rst:1850 msgid "``PyUnstable_Code_GetExtra()`` (renamed from ``_PyCode_GetExtra``)" msgstr "``PyUnstable_Code_GetExtra()``\\ (自 ``_PyCode_GetExtra`` 重新命名)" -#: ../../whatsnew/3.12.rst:1845 +#: ../../whatsnew/3.12.rst:1851 msgid "``PyUnstable_Code_SetExtra()`` (renamed from ``_PyCode_SetExtra``)" msgstr "``PyUnstable_Code_SetExtra()``\\ (自 ``_PyCode_SetExtra`` 重新命名)" -#: ../../whatsnew/3.12.rst:1847 +#: ../../whatsnew/3.12.rst:1853 msgid "" "The original names will continue to be available until the respective API " "changes." msgstr "原始名稱將可繼續使用,直到相應的 API 發生變更。" -#: ../../whatsnew/3.12.rst:1850 +#: ../../whatsnew/3.12.rst:1856 msgid "(Contributed by Petr Viktorin in :gh:`101101`.)" msgstr "(由 Petr Viktorin 於 :gh:`101101` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1852 +#: ../../whatsnew/3.12.rst:1858 msgid "" ":pep:`697`: Add an API for extending types whose instance memory layout is " "opaque:" msgstr "" -#: ../../whatsnew/3.12.rst:1855 +#: ../../whatsnew/3.12.rst:1861 msgid "" ":c:member:`PyType_Spec.basicsize` can be zero or negative to specify " "inheriting or extending the base class size." @@ -4067,30 +4076,30 @@ msgstr "" ":c:member:`PyType_Spec.basicsize` 可以為零或負數來指定繼承或擴充基底類別大" "小。" -#: ../../whatsnew/3.12.rst:1857 +#: ../../whatsnew/3.12.rst:1863 msgid "" ":c:func:`PyObject_GetTypeData` and :c:func:`PyType_GetTypeDataSize` added to " "allow access to subclass-specific instance data." msgstr "" -#: ../../whatsnew/3.12.rst:1859 +#: ../../whatsnew/3.12.rst:1865 msgid "" ":c:macro:`Py_TPFLAGS_ITEMS_AT_END` and :c:func:`PyObject_GetItemData` added " "to allow safely extending certain variable-sized types, including :c:var:" "`PyType_Type`." msgstr "" -#: ../../whatsnew/3.12.rst:1862 +#: ../../whatsnew/3.12.rst:1868 msgid "" ":c:macro:`Py_RELATIVE_OFFSET` added to allow defining :c:type:`members " "<PyMemberDef>` in terms of a subclass-specific struct." msgstr "" -#: ../../whatsnew/3.12.rst:1865 +#: ../../whatsnew/3.12.rst:1871 msgid "(Contributed by Petr Viktorin in :gh:`103509`.)" msgstr "(由 Petr Viktorin 於 :gh:`103509` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1867 +#: ../../whatsnew/3.12.rst:1873 msgid "" "Add the new :ref:`limited C API <limited-c-api>` function :c:func:" "`PyType_FromMetaclass`, which generalizes the existing :c:func:" @@ -4098,29 +4107,29 @@ msgid "" "(Contributed by Wenzel Jakob in :gh:`93012`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1872 +#: ../../whatsnew/3.12.rst:1878 msgid "" "API for creating objects that can be called using :ref:`the vectorcall " "protocol <vectorcall>` was added to the :ref:`Limited API <stable>`:" msgstr "" -#: ../../whatsnew/3.12.rst:1876 +#: ../../whatsnew/3.12.rst:1882 msgid ":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`" msgstr ":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`" -#: ../../whatsnew/3.12.rst:1877 +#: ../../whatsnew/3.12.rst:1883 msgid ":c:func:`PyVectorcall_NARGS`" msgstr ":c:func:`PyVectorcall_NARGS`" -#: ../../whatsnew/3.12.rst:1878 +#: ../../whatsnew/3.12.rst:1884 msgid ":c:func:`PyVectorcall_Call`" msgstr ":c:func:`PyVectorcall_Call`" -#: ../../whatsnew/3.12.rst:1879 +#: ../../whatsnew/3.12.rst:1885 msgid ":c:type:`vectorcallfunc`" msgstr ":c:type:`vectorcallfunc`" -#: ../../whatsnew/3.12.rst:1881 +#: ../../whatsnew/3.12.rst:1887 msgid "" "The :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class " "when the class's :py:meth:`~object.__call__` method is reassigned. This " @@ -4131,7 +4140,7 @@ msgid "" "`93274`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1889 +#: ../../whatsnew/3.12.rst:1895 msgid "" "The :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows extensions " @@ -4139,32 +4148,32 @@ msgid "" "bookkeeping, using less memory and with faster access." msgstr "" -#: ../../whatsnew/3.12.rst:1894 +#: ../../whatsnew/3.12.rst:1900 msgid "" "API for performing calls using :ref:`the vectorcall protocol <vectorcall>` " "was added to the :ref:`Limited API <stable>`:" msgstr "" -#: ../../whatsnew/3.12.rst:1898 +#: ../../whatsnew/3.12.rst:1904 msgid ":c:func:`PyObject_Vectorcall`" msgstr ":c:func:`PyObject_Vectorcall`" -#: ../../whatsnew/3.12.rst:1899 +#: ../../whatsnew/3.12.rst:1905 msgid ":c:func:`PyObject_VectorcallMethod`" msgstr ":c:func:`PyObject_VectorcallMethod`" -#: ../../whatsnew/3.12.rst:1900 +#: ../../whatsnew/3.12.rst:1906 msgid ":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`" msgstr ":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`" -#: ../../whatsnew/3.12.rst:1902 +#: ../../whatsnew/3.12.rst:1908 msgid "" "This means that both the incoming and outgoing ends of the vector call " "protocol are now available in the :ref:`Limited API <stable>`. (Contributed " "by Wenzel Jakob in :gh:`98586`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1906 +#: ../../whatsnew/3.12.rst:1912 msgid "" "Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` and :c:" "func:`PyEval_SetTraceAllThreads`, that allow to set tracing and profiling " @@ -4172,14 +4181,14 @@ msgid "" "(Contributed by Pablo Galindo in :gh:`93503`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1912 +#: ../../whatsnew/3.12.rst:1918 msgid "" "Add new function :c:func:`PyFunction_SetVectorcall` to the C API which sets " "the vectorcall field of a given :c:type:`PyFunctionObject`. (Contributed by " "Andrew Frost in :gh:`92257`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1916 +#: ../../whatsnew/3.12.rst:1922 msgid "" "The C API now permits registering callbacks via :c:func:" "`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to be called " @@ -4188,28 +4197,28 @@ msgid "" "`91052`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1922 +#: ../../whatsnew/3.12.rst:1928 msgid "" "Add :c:func:`PyType_AddWatcher` and :c:func:`PyType_Watch` API to register " "callbacks to receive notification on changes to a type. (Contributed by Carl " "Meyer in :gh:`91051`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1926 +#: ../../whatsnew/3.12.rst:1932 msgid "" "Add :c:func:`PyCode_AddWatcher` and :c:func:`PyCode_ClearWatcher` APIs to " "register callbacks to receive notification on creation and destruction of " "code objects. (Contributed by Itamar Oren in :gh:`91054`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1931 +#: ../../whatsnew/3.12.rst:1937 msgid "" "Add :c:func:`PyFrame_GetVar` and :c:func:`PyFrame_GetVarString` functions to " "get a frame variable by its name. (Contributed by Victor Stinner in :gh:" "`91248`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1935 +#: ../../whatsnew/3.12.rst:1941 msgid "" "Add :c:func:`PyErr_GetRaisedException` and :c:func:" "`PyErr_SetRaisedException` for saving and restoring the current exception. " @@ -4219,14 +4228,14 @@ msgid "" "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1943 +#: ../../whatsnew/3.12.rst:1949 msgid "" "Add ``_PyErr_ChainExceptions1``, which takes an exception instance, to " "replace the legacy-API ``_PyErr_ChainExceptions``, which is now deprecated. " "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1947 +#: ../../whatsnew/3.12.rst:1953 msgid "" "Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs` as " "convenience functions for retrieving and modifying the :attr:`~BaseException." @@ -4234,71 +4243,71 @@ msgid "" "in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1952 +#: ../../whatsnew/3.12.rst:1958 msgid "" "Add :c:func:`PyErr_DisplayException`, which takes an exception instance, to " "replace the legacy-api :c:func:`!PyErr_Display`. (Contributed by Irit " "Katriel in :gh:`102755`)." msgstr "" -#: ../../whatsnew/3.12.rst:1958 +#: ../../whatsnew/3.12.rst:1964 msgid "" ":pep:`683`: Introduce *Immortal Objects*, which allows objects to bypass " "reference counts, and related changes to the C-API:" msgstr "" -#: ../../whatsnew/3.12.rst:1961 +#: ../../whatsnew/3.12.rst:1967 msgid "``_Py_IMMORTAL_REFCNT``: The reference count that defines an object" msgstr "``_Py_IMMORTAL_REFCNT``:定義物件的參照計數" -#: ../../whatsnew/3.12.rst:1962 +#: ../../whatsnew/3.12.rst:1968 msgid "as immortal." msgstr "" -#: ../../whatsnew/3.12.rst:1963 +#: ../../whatsnew/3.12.rst:1969 msgid "" "``_Py_IsImmortal`` Checks if an object has the immortal reference count." msgstr "" -#: ../../whatsnew/3.12.rst:1964 +#: ../../whatsnew/3.12.rst:1970 msgid "``PyObject_HEAD_INIT`` This will now initialize reference count to" msgstr "``PyObject_HEAD_INIT`` 這現在將初始化參照計數" -#: ../../whatsnew/3.12.rst:1965 +#: ../../whatsnew/3.12.rst:1971 msgid "``_Py_IMMORTAL_REFCNT`` when used with ``Py_BUILD_CORE``." msgstr "``_Py_IMMORTAL_REFCNT``\\ (與 ``Py_BUILD_CORE`` 一起使用時)。" -#: ../../whatsnew/3.12.rst:1966 +#: ../../whatsnew/3.12.rst:1972 msgid "``SSTATE_INTERNED_IMMORTAL`` An identifier for interned unicode objects" msgstr "" -#: ../../whatsnew/3.12.rst:1967 +#: ../../whatsnew/3.12.rst:1973 msgid "that are immortal." msgstr "" -#: ../../whatsnew/3.12.rst:1968 +#: ../../whatsnew/3.12.rst:1974 msgid "``SSTATE_INTERNED_IMMORTAL_STATIC`` An identifier for interned unicode" msgstr "" -#: ../../whatsnew/3.12.rst:1969 +#: ../../whatsnew/3.12.rst:1975 msgid "objects that are immortal and static" msgstr "" -#: ../../whatsnew/3.12.rst:1970 +#: ../../whatsnew/3.12.rst:1976 msgid "``sys.getunicodeinternedsize`` This returns the total number of unicode" msgstr "``sys.getunicodeinternedsize`` 這會回傳 unicode 的總數" -#: ../../whatsnew/3.12.rst:1971 +#: ../../whatsnew/3.12.rst:1977 msgid "" "objects that have been interned. This is now needed for :file:`refleak.py` " "to correctly track reference counts and allocated blocks" msgstr "" -#: ../../whatsnew/3.12.rst:1974 +#: ../../whatsnew/3.12.rst:1980 msgid "(Contributed by Eddie Elizondo in :gh:`84436`.)" msgstr "(由 Eddie Elizondo 於 :gh:`84436` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1976 +#: ../../whatsnew/3.12.rst:1982 msgid "" ":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function and :" "c:type:`PyInterpreterConfig`, which may be used to create sub-interpreters " @@ -4306,27 +4315,27 @@ msgid "" "(Contributed by Eric Snow in :gh:`104110`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1982 +#: ../../whatsnew/3.12.rst:1988 msgid "" "In the limited C API version 3.12, :c:func:`Py_INCREF` and :c:func:" "`Py_DECREF` functions are now implemented as opaque function calls to hide " "implementation details. (Contributed by Victor Stinner in :gh:`105387`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1990 +#: ../../whatsnew/3.12.rst:1996 msgid "" "Legacy Unicode APIs based on ``Py_UNICODE*`` representation has been " "removed. Please migrate to APIs based on UTF-8 or ``wchar_t*``." msgstr "" -#: ../../whatsnew/3.12.rst:1993 +#: ../../whatsnew/3.12.rst:1999 msgid "" "Argument parsing functions like :c:func:`PyArg_ParseTuple` doesn't support " "``Py_UNICODE*`` based format (e.g. ``u``, ``Z``) anymore. Please migrate to " "other formats for Unicode like ``s``, ``z``, ``es``, and ``U``." msgstr "" -#: ../../whatsnew/3.12.rst:1997 +#: ../../whatsnew/3.12.rst:2003 msgid "" "``tp_weaklist`` for all static builtin types is always ``NULL``. This is an " "internal-only field on ``PyTypeObject`` but we're pointing out the change in " @@ -4335,7 +4344,7 @@ msgid "" "necessary, the (internal-only) ``_PyObject_GET_WEAKREFS_LISTPTR()`` macro." msgstr "" -#: ../../whatsnew/3.12.rst:2004 +#: ../../whatsnew/3.12.rst:2010 msgid "" "This internal-only :c:member:`PyTypeObject.tp_subclasses` may now not be a " "valid object pointer. Its type was changed to :c:expr:`void *` to reflect " @@ -4343,13 +4352,13 @@ msgid "" "only field directly." msgstr "" -#: ../../whatsnew/3.12.rst:2009 +#: ../../whatsnew/3.12.rst:2015 msgid "" "To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__` (using :c:func:`PyObject_CallMethod`, for example)." msgstr "" -#: ../../whatsnew/3.12.rst:2013 +#: ../../whatsnew/3.12.rst:2019 msgid "" "Add support of more formatting options (left aligning, octals, uppercase " "hexadecimals, :c:type:`intmax_t`, :c:type:`ptrdiff_t`, :c:type:`wchar_t` C " @@ -4358,7 +4367,7 @@ msgid "" "`98836`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2019 +#: ../../whatsnew/3.12.rst:2025 msgid "" "An unrecognized format character in :c:func:`PyUnicode_FromFormat` and :c:" "func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In previous " @@ -4367,13 +4376,13 @@ msgid "" "Storchaka in :gh:`95781`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2025 +#: ../../whatsnew/3.12.rst:2031 msgid "" "Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` and :c:func:" "`PyUnicode_FromFormatV`. (Contributed by Philip Georgi in :gh:`95504`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2029 +#: ../../whatsnew/3.12.rst:2035 msgid "" "Extension classes wanting to add a :attr:`~object.__dict__` or weak " "reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" @@ -4387,7 +4396,7 @@ msgid "" "func:`PyObject_ClearWeakRefs`, as before." msgstr "" -#: ../../whatsnew/3.12.rst:2041 +#: ../../whatsnew/3.12.rst:2047 msgid "" "The :c:func:`PyUnicode_FSDecoder` function no longer accepts bytes-like " "paths, like :class:`bytearray` and :class:`memoryview` types: only the " @@ -4395,7 +4404,7 @@ msgid "" "Victor Stinner in :gh:`98393`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2046 +#: ../../whatsnew/3.12.rst:2052 msgid "" "The :c:macro:`Py_CLEAR`, :c:macro:`Py_SETREF` and :c:macro:`Py_XSETREF` " "macros now only evaluate their arguments once. If an argument has side " @@ -4403,7 +4412,7 @@ msgid "" "Stinner in :gh:`98724`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2051 +#: ../../whatsnew/3.12.rst:2057 msgid "" "The interpreter's error indicator is now always normalized. This means that :" "c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other functions " @@ -4411,7 +4420,7 @@ msgid "" "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2056 +#: ../../whatsnew/3.12.rst:2062 msgid "" "``_Py_RefTotal`` is no longer authoritative and only kept around for ABI " "compatibility. Note that it is an internal global and only available on " @@ -4419,25 +4428,25 @@ msgid "" "``_Py_GetGlobalRefTotal()``." msgstr "" -#: ../../whatsnew/3.12.rst:2061 +#: ../../whatsnew/3.12.rst:2067 msgid "" "The following functions now select an appropriate metaclass for the newly " "created type:" msgstr "" -#: ../../whatsnew/3.12.rst:2064 +#: ../../whatsnew/3.12.rst:2070 msgid ":c:func:`PyType_FromSpec`" msgstr ":c:func:`PyType_FromSpec`" -#: ../../whatsnew/3.12.rst:2065 +#: ../../whatsnew/3.12.rst:2071 msgid ":c:func:`PyType_FromSpecWithBases`" msgstr ":c:func:`PyType_FromSpecWithBases`" -#: ../../whatsnew/3.12.rst:2066 +#: ../../whatsnew/3.12.rst:2072 msgid ":c:func:`PyType_FromModuleAndSpec`" msgstr ":c:func:`PyType_FromModuleAndSpec`" -#: ../../whatsnew/3.12.rst:2068 +#: ../../whatsnew/3.12.rst:2074 msgid "" "Creating classes whose metaclass overrides :c:member:`~PyTypeObject.tp_new` " "is deprecated, and in Python 3.14+ it will be disallowed. Note that these " @@ -4445,14 +4454,14 @@ msgid "" "initialization." msgstr "" -#: ../../whatsnew/3.12.rst:2073 +#: ../../whatsnew/3.12.rst:2079 msgid "" "Note that :c:func:`PyType_FromMetaclass` (added in Python 3.12) already " "disallows creating classes whose metaclass overrides ``tp_new`` (:meth:" "`~object.__new__` in Python)." msgstr "" -#: ../../whatsnew/3.12.rst:2077 +#: ../../whatsnew/3.12.rst:2083 msgid "" "Since ``tp_new`` overrides almost everything ``PyType_From*`` functions do, " "the two are incompatible with each other. The existing behavior -- ignoring " @@ -4461,17 +4470,17 @@ msgid "" "general workaround. One of the following may work for you:" msgstr "" -#: ../../whatsnew/3.12.rst:2084 +#: ../../whatsnew/3.12.rst:2090 msgid "If you control the metaclass, avoid using ``tp_new`` in it:" msgstr "" -#: ../../whatsnew/3.12.rst:2086 +#: ../../whatsnew/3.12.rst:2092 msgid "" "If initialization can be skipped, it can be done in :c:member:`~PyTypeObject." "tp_init` instead." msgstr "" -#: ../../whatsnew/3.12.rst:2088 +#: ../../whatsnew/3.12.rst:2094 msgid "" "If the metaclass doesn't need to be instantiated from Python, set its " "``tp_new`` to ``NULL`` using the :c:macro:" @@ -4479,20 +4488,20 @@ msgid "" "``PyType_From*`` functions." msgstr "" -#: ../../whatsnew/3.12.rst:2093 +#: ../../whatsnew/3.12.rst:2099 msgid "" "Avoid ``PyType_From*`` functions: if you don't need C-specific features " "(slots or setting the instance size), create types by :ref:`calling <call>` " "the metaclass." msgstr "" -#: ../../whatsnew/3.12.rst:2097 +#: ../../whatsnew/3.12.rst:2103 msgid "" "If you *know* the ``tp_new`` can be skipped safely, filter the deprecation " "warning out using :func:`warnings.catch_warnings` from Python." msgstr "" -#: ../../whatsnew/3.12.rst:2100 +#: ../../whatsnew/3.12.rst:2106 msgid "" ":c:var:`PyOS_InputHook` and :c:var:`PyOS_ReadlineFunctionPointer` are no " "longer called in :ref:`subinterpreters <sub-interpreter-support>`. This is " @@ -4500,14 +4509,14 @@ msgid "" "callbacks have no way of recovering extension module state)." msgstr "" -#: ../../whatsnew/3.12.rst:2105 +#: ../../whatsnew/3.12.rst:2111 msgid "" "This also avoids situations where extensions may find themselves running in " "a subinterpreter that they don't support (or haven't yet been loaded in). " "See :gh:`104668` for more info." msgstr "" -#: ../../whatsnew/3.12.rst:2109 +#: ../../whatsnew/3.12.rst:2115 msgid "" ":c:struct:`PyLongObject` has had its internals changed for better " "performance. Although the internals of :c:struct:`PyLongObject` are private, " @@ -4518,15 +4527,15 @@ msgid "" "a single machine word:" msgstr "" -#: ../../whatsnew/3.12.rst:2117 +#: ../../whatsnew/3.12.rst:2123 msgid ":c:func:`PyUnstable_Long_IsCompact`" msgstr ":c:func:`PyUnstable_Long_IsCompact`" -#: ../../whatsnew/3.12.rst:2118 +#: ../../whatsnew/3.12.rst:2124 msgid ":c:func:`PyUnstable_Long_CompactValue`" msgstr ":c:func:`PyUnstable_Long_CompactValue`" -#: ../../whatsnew/3.12.rst:2120 +#: ../../whatsnew/3.12.rst:2126 msgid "" "Custom allocators, set via :c:func:`PyMem_SetAllocator`, are now required to " "be thread-safe, regardless of memory domain. Allocators that don't have " @@ -4535,7 +4544,7 @@ msgid "" "create a new GitHub issue and CC ``@ericsnowcurrently``." msgstr "" -#: ../../whatsnew/3.12.rst:2130 +#: ../../whatsnew/3.12.rst:2136 msgid "" "In accordance with :pep:`699`, the ``ma_version_tag`` field in :c:type:" "`PyDictObject` is deprecated for extension modules. Accessing this field " @@ -4544,76 +4553,76 @@ msgid "" "PEP by Ken Jin.)" msgstr "" -#: ../../whatsnew/3.12.rst:2135 +#: ../../whatsnew/3.12.rst:2141 msgid "Deprecate global configuration variable:" msgstr "棄用全域配置變數:" -#: ../../whatsnew/3.12.rst:2137 +#: ../../whatsnew/3.12.rst:2143 msgid ":c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug`" msgstr ":c:var:`Py_DebugFlag`: 請改用 :c:member:`PyConfig.parser_debug`" -#: ../../whatsnew/3.12.rst:2138 +#: ../../whatsnew/3.12.rst:2144 msgid ":c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose`" msgstr ":c:var:`Py_VerboseFlag`: 請改用 :c:member:`PyConfig.verbose`" -#: ../../whatsnew/3.12.rst:2139 +#: ../../whatsnew/3.12.rst:2145 msgid ":c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet`" msgstr ":c:var:`Py_QuietFlag`: 請改用 :c:member:`PyConfig.quiet`" -#: ../../whatsnew/3.12.rst:2140 +#: ../../whatsnew/3.12.rst:2146 msgid ":c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive`" msgstr ":c:var:`Py_InteractiveFlag`: 請改用 :c:member:`PyConfig.interactive`" -#: ../../whatsnew/3.12.rst:2141 +#: ../../whatsnew/3.12.rst:2147 msgid ":c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect`" msgstr ":c:var:`Py_InspectFlag`: 請改用 :c:member:`PyConfig.inspect`" -#: ../../whatsnew/3.12.rst:2142 +#: ../../whatsnew/3.12.rst:2148 msgid ":c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level`" msgstr "" ":c:var:`Py_OptimizeFlag`: 請改用 :c:member:`PyConfig.optimization_level`" -#: ../../whatsnew/3.12.rst:2143 +#: ../../whatsnew/3.12.rst:2149 msgid ":c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import`" msgstr ":c:var:`Py_NoSiteFlag`: 請改用 :c:member:`PyConfig.site_import`" -#: ../../whatsnew/3.12.rst:2144 +#: ../../whatsnew/3.12.rst:2150 msgid ":c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning`" msgstr "" ":c:var:`Py_BytesWarningFlag`: 請改用 :c:member:`PyConfig.bytes_warning`" -#: ../../whatsnew/3.12.rst:2145 +#: ../../whatsnew/3.12.rst:2151 msgid ":c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings`" msgstr "" ":c:var:`Py_FrozenFlag`: 請改用 :c:member:`PyConfig.pathconfig_warnings`" -#: ../../whatsnew/3.12.rst:2146 +#: ../../whatsnew/3.12.rst:2152 msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment`" msgstr "" ":c:var:`Py_IgnoreEnvironmentFlag`: 請改用 :c:member:`PyConfig." "use_environment`" -#: ../../whatsnew/3.12.rst:2147 +#: ../../whatsnew/3.12.rst:2153 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode`" msgstr "" ":c:var:`Py_DontWriteBytecodeFlag`: 請改用 :c:member:`PyConfig.write_bytecode`" -#: ../../whatsnew/3.12.rst:2148 +#: ../../whatsnew/3.12.rst:2154 msgid "" ":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig.user_site_directory`" msgstr "" ":c:var:`Py_NoUserSiteDirectory`: 請改用 :c:member:`PyConfig." "user_site_directory`" -#: ../../whatsnew/3.12.rst:2149 +#: ../../whatsnew/3.12.rst:2155 msgid "" ":c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio`" msgstr "" ":c:var:`Py_UnbufferedStdioFlag`: 請改用 :c:member:`PyConfig.buffered_stdio`" -#: ../../whatsnew/3.12.rst:2150 +#: ../../whatsnew/3.12.rst:2156 msgid "" ":c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed`" @@ -4621,11 +4630,11 @@ msgstr "" ":c:var:`Py_HashRandomizationFlag`: 請改用 :c:member:`PyConfig.use_hash_seed` " "和 :c:member:`PyConfig.hash_seed`" -#: ../../whatsnew/3.12.rst:2152 +#: ../../whatsnew/3.12.rst:2158 msgid ":c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated`" msgstr ":c:var:`Py_IsolatedFlag`: 請改用 :c:member:`PyConfig.isolated`" -#: ../../whatsnew/3.12.rst:2153 +#: ../../whatsnew/3.12.rst:2159 msgid "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." "legacy_windows_fs_encoding`" @@ -4633,7 +4642,7 @@ msgstr "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`: 請改用 :c:member:`PyPreConfig." "legacy_windows_fs_encoding`" -#: ../../whatsnew/3.12.rst:2154 +#: ../../whatsnew/3.12.rst:2160 msgid "" ":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." "legacy_windows_stdio`" @@ -4641,7 +4650,7 @@ msgstr "" ":c:var:`Py_LegacyWindowsStdioFlag`: 請改用 :c:member:`PyConfig." "legacy_windows_stdio`" -#: ../../whatsnew/3.12.rst:2155 +#: ../../whatsnew/3.12.rst:2161 msgid "" ":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." "filesystem_encoding`" @@ -4649,7 +4658,7 @@ msgstr "" ":c:var:`!Py_FileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." "filesystem_encoding`" -#: ../../whatsnew/3.12.rst:2156 +#: ../../whatsnew/3.12.rst:2162 msgid "" ":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." "filesystem_encoding`" @@ -4657,7 +4666,7 @@ msgstr "" ":c:var:`!Py_HasFileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." "filesystem_encoding`" -#: ../../whatsnew/3.12.rst:2157 +#: ../../whatsnew/3.12.rst:2163 msgid "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." "filesystem_errors`" @@ -4665,7 +4674,7 @@ msgstr "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`: 請改用 :c:member:`PyConfig." "filesystem_errors`" -#: ../../whatsnew/3.12.rst:2158 +#: ../../whatsnew/3.12.rst:2164 msgid "" ":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:" "`Py_PreInitialize`)" @@ -4673,7 +4682,7 @@ msgstr "" ":c:var:`!Py_UTF8Mode`: 請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參見 :c:" "func:`Py_PreInitialize`)" -#: ../../whatsnew/3.12.rst:2160 +#: ../../whatsnew/3.12.rst:2166 msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" "`PyConfig` instead. (Contributed by Victor Stinner in :gh:`77782`.)" @@ -4681,25 +4690,25 @@ msgstr "" ":c:func:`Py_InitializeFromConfig` API 應改為與 :c:type:`PyConfig` 一起使用。" "(由 Victor Stinner 於 :gh:`77782` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2164 +#: ../../whatsnew/3.12.rst:2170 msgid "" "Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable " "bases is deprecated and will be disabled in Python 3.14. (:gh:`95388`)" msgstr "" -#: ../../whatsnew/3.12.rst:2167 +#: ../../whatsnew/3.12.rst:2173 msgid "" "The :file:`structmember.h` header is deprecated, though it continues to be " "available and there are no plans to remove it." msgstr ":file:`structmember.h` 標頭已棄用,但仍可使用,且還沒有移除它的計畫。" -#: ../../whatsnew/3.12.rst:2170 +#: ../../whatsnew/3.12.rst:2176 msgid "" "Its contents are now available just by including :file:`Python.h`, with a " "``Py`` prefix added if it was missing:" msgstr "" -#: ../../whatsnew/3.12.rst:2173 +#: ../../whatsnew/3.12.rst:2179 msgid "" ":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` and :c:func:" "`PyMember_SetOne`" @@ -4707,13 +4716,13 @@ msgstr "" ":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` 和 :c:func:" "`PyMember_SetOne`" -#: ../../whatsnew/3.12.rst:2175 +#: ../../whatsnew/3.12.rst:2181 msgid "" "Type macros like :c:macro:`Py_T_INT`, :c:macro:`Py_T_DOUBLE`, etc. " "(previously ``T_INT``, ``T_DOUBLE``, etc.)" msgstr "" -#: ../../whatsnew/3.12.rst:2177 +#: ../../whatsnew/3.12.rst:2183 msgid "" "The flags :c:macro:`Py_READONLY` (previously ``READONLY``) and :c:macro:" "`Py_AUDIT_READ` (previously all uppercase)" @@ -4721,23 +4730,23 @@ msgstr "" ":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)和 :c:macro:" "`Py_AUDIT_READ`\\ (先前全大寫)旗標" -#: ../../whatsnew/3.12.rst:2180 +#: ../../whatsnew/3.12.rst:2186 msgid "Several items are not exposed from :file:`Python.h`:" msgstr "數個項目不再從 :file:`Python.h` 中公開:" -#: ../../whatsnew/3.12.rst:2182 +#: ../../whatsnew/3.12.rst:2188 msgid ":c:macro:`T_OBJECT` (use :c:macro:`Py_T_OBJECT_EX`)" msgstr ":c:macro:`T_OBJECT`\\ (請改用 :c:macro:`Py_T_OBJECT_EX`)" -#: ../../whatsnew/3.12.rst:2183 +#: ../../whatsnew/3.12.rst:2189 msgid ":c:macro:`T_NONE` (previously undocumented, and pretty quirky)" msgstr ":c:macro:`T_NONE`\\ (先前未記錄於文件上,且相當古怪)" -#: ../../whatsnew/3.12.rst:2184 +#: ../../whatsnew/3.12.rst:2190 msgid "The macro ``WRITE_RESTRICTED`` which does nothing." msgstr "不做任何事的巨集 ``WRITE_RESTRICTED``。" -#: ../../whatsnew/3.12.rst:2185 +#: ../../whatsnew/3.12.rst:2191 msgid "" "The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of :c:macro:" "`Py_AUDIT_READ`." @@ -4745,33 +4754,33 @@ msgstr "" "``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當於 :c:macro:" "`Py_AUDIT_READ`。" -#: ../../whatsnew/3.12.rst:2187 +#: ../../whatsnew/3.12.rst:2193 msgid "" "In some configurations, ``<stddef.h>`` is not included from :file:`Python." "h`. It should be included manually when using ``offsetof()``." msgstr "" -#: ../../whatsnew/3.12.rst:2190 +#: ../../whatsnew/3.12.rst:2196 msgid "" "The deprecated header continues to provide its original contents under the " "original names. Your old code can stay unchanged, unless the extra include " "and non-namespaced macros bother you greatly." msgstr "" -#: ../../whatsnew/3.12.rst:2195 +#: ../../whatsnew/3.12.rst:2201 msgid "" "(Contributed in :gh:`47146` by Petr Viktorin, based on earlier work by " "Alexander Belopolsky and Matthias Braun.)" msgstr "" -#: ../../whatsnew/3.12.rst:2198 +#: ../../whatsnew/3.12.rst:2204 msgid "" ":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. Use :c:" "func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException` " "instead. (Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2203 +#: ../../whatsnew/3.12.rst:2209 msgid "" ":c:func:`!PyErr_Display` is deprecated. Use :c:func:`PyErr_DisplayException` " "instead. (Contributed by Irit Katriel in :gh:`102755`)." @@ -4779,7 +4788,7 @@ msgstr "" ":c:func:`!PyErr_Display` 已棄用,請改用 :c:func:`PyErr_DisplayException`。" "(由 Irit Katriel 於 :gh:`102755` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2206 +#: ../../whatsnew/3.12.rst:2212 msgid "" "``_PyErr_ChainExceptions`` is deprecated. Use ``_PyErr_ChainExceptions1`` " "instead. (Contributed by Irit Katriel in :gh:`102192`.)" @@ -4787,7 +4796,7 @@ msgstr "" "``_PyErr_ChainExceptions`` 已棄用,請改用 ``_PyErr_ChainExceptions1``。(由 " "Irit Katriel 於 :gh:`102192` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2209 +#: ../../whatsnew/3.12.rst:2215 msgid "" "Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` or :c:" "func:`PyType_FromModuleAndSpec` to create a class whose metaclass overrides :" @@ -5189,54 +5198,54 @@ msgstr "" msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.12.rst:2225 +#: ../../whatsnew/3.12.rst:2231 msgid "" "Remove the :file:`token.h` header file. There was never any public tokenizer " "C API. The :file:`token.h` header file was only designed to be used by " "Python internals. (Contributed by Victor Stinner in :gh:`92651`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2230 +#: ../../whatsnew/3.12.rst:2236 msgid "Legacy Unicode APIs have been removed. See :pep:`623` for detail." msgstr "" -#: ../../whatsnew/3.12.rst:2232 +#: ../../whatsnew/3.12.rst:2238 msgid ":c:macro:`!PyUnicode_WCHAR_KIND`" msgstr ":c:macro:`!PyUnicode_WCHAR_KIND`" -#: ../../whatsnew/3.12.rst:2233 +#: ../../whatsnew/3.12.rst:2239 msgid ":c:func:`!PyUnicode_AS_UNICODE`" msgstr ":c:func:`!PyUnicode_AS_UNICODE`" -#: ../../whatsnew/3.12.rst:2234 +#: ../../whatsnew/3.12.rst:2240 msgid ":c:func:`!PyUnicode_AsUnicode`" msgstr ":c:func:`!PyUnicode_AsUnicode`" -#: ../../whatsnew/3.12.rst:2235 +#: ../../whatsnew/3.12.rst:2241 msgid ":c:func:`!PyUnicode_AsUnicodeAndSize`" msgstr ":c:func:`!PyUnicode_AsUnicodeAndSize`" -#: ../../whatsnew/3.12.rst:2236 +#: ../../whatsnew/3.12.rst:2242 msgid ":c:func:`!PyUnicode_AS_DATA`" msgstr ":c:func:`!PyUnicode_AS_DATA`" -#: ../../whatsnew/3.12.rst:2237 +#: ../../whatsnew/3.12.rst:2243 msgid ":c:func:`!PyUnicode_FromUnicode`" msgstr ":c:func:`!PyUnicode_FromUnicode`" -#: ../../whatsnew/3.12.rst:2238 +#: ../../whatsnew/3.12.rst:2244 msgid ":c:func:`!PyUnicode_GET_SIZE`" msgstr ":c:func:`!PyUnicode_GET_SIZE`" -#: ../../whatsnew/3.12.rst:2239 +#: ../../whatsnew/3.12.rst:2245 msgid ":c:func:`!PyUnicode_GetSize`" msgstr ":c:func:`!PyUnicode_GetSize`" -#: ../../whatsnew/3.12.rst:2240 +#: ../../whatsnew/3.12.rst:2246 msgid ":c:func:`!PyUnicode_GET_DATA_SIZE`" msgstr ":c:func:`!PyUnicode_GET_DATA_SIZE`" -#: ../../whatsnew/3.12.rst:2242 +#: ../../whatsnew/3.12.rst:2248 msgid "" "Remove the ``PyUnicode_InternImmortal()`` function macro. (Contributed by " "Victor Stinner in :gh:`85858`.)" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index bbc57bb4aa..5e82698d42 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-10 17:21+0000\n" +"POT-Creation-Date: 2024-11-15 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -345,7 +345,7 @@ msgid "" "years of security fixes." msgstr "" -#: ../../whatsnew/3.13.rst:208 ../../whatsnew/3.13.rst:1968 +#: ../../whatsnew/3.13.rst:208 ../../whatsnew/3.13.rst:1970 msgid "New Features" msgstr "新增功能" @@ -484,7 +484,7 @@ msgstr "" #: ../../whatsnew/3.13.rst:294 msgid "(Contributed by Shantanu Jain in :gh:`95754`.)" -msgstr "" +msgstr "(由 Shantanu Jain 在 :gh:`95754` 中貢獻。)" #: ../../whatsnew/3.13.rst:296 msgid "" @@ -813,7 +813,7 @@ msgstr "" #: ../../whatsnew/3.13.rst:524 msgid "(Contributed by Inada Naoki in :gh:`81283`.)" -msgstr "" +msgstr "(由 Inada Naoki 在 :gh:`81283` 中貢獻。)" #: ../../whatsnew/3.13.rst:526 msgid "" @@ -832,7 +832,7 @@ msgstr "" #: ../../whatsnew/3.13.rst:536 msgid "(Contributed by Jelle Zijlstra in :gh:`109118` and :gh:`118160`.)" -msgstr "" +msgstr "(由 Jelle Zijlstra 在 :gh:`109118` 和 :gh:`118160` 中貢獻。)" #: ../../whatsnew/3.13.rst:538 msgid "" @@ -937,13 +937,15 @@ msgstr ":class:`subprocess.Popen`" #: ../../whatsnew/3.13.rst:598 msgid "(Contributed by Victor Stinner in :gh:`114570`.)" -msgstr "" +msgstr "(由 Victor Stinner 在 :gh:`114570` 中貢獻。)" #: ../../whatsnew/3.13.rst:600 msgid "" "Allow the *count* argument of :meth:`str.replace` to be a keyword. " "(Contributed by Hugo van Kemenade in :gh:`106487`.)" msgstr "" +"允許 :meth:`str.replace` 的 *count* 引數為關鍵字。(由 Hugo van Kemenade 在 :" +"gh:`106487` 中貢獻。)" #: ../../whatsnew/3.13.rst:603 msgid "" @@ -1172,7 +1174,7 @@ msgstr "" msgid "concurrent.futures" msgstr "concurrent.futures" -#: ../../whatsnew/3.13.rst:771 ../../whatsnew/3.13.rst:1612 +#: ../../whatsnew/3.13.rst:771 ../../whatsnew/3.13.rst:1614 msgid "configparser" msgstr "configparser" @@ -1632,7 +1634,7 @@ msgid "" "file is not accessible. (Contributed by Moonsik Park in :gh:`82367`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1091 ../../whatsnew/3.13.rst:1652 +#: ../../whatsnew/3.13.rst:1091 ../../whatsnew/3.13.rst:1654 msgid "pathlib" msgstr "pathlib" @@ -1746,7 +1748,7 @@ msgid "" "Kemenade in :gh:`118131`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1168 ../../whatsnew/3.13.rst:1660 +#: ../../whatsnew/3.13.rst:1168 ../../whatsnew/3.13.rst:1662 msgid "re" msgstr "re" @@ -1827,7 +1829,7 @@ msgstr "" #: ../../whatsnew/3.13.rst:1223 msgid "(Contributed by William Woodruff in :gh:`112389`.)" -msgstr "" +msgstr "(由 William Woodruff 在 :gh:`112389` 中貢獻。)" #: ../../whatsnew/3.13.rst:1227 msgid "statistics" @@ -1877,7 +1879,7 @@ msgid "" "`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1264 +#: ../../whatsnew/3.13.rst:1264 ../../whatsnew/3.13.rst:2717 msgid "sys" msgstr "sys" @@ -2027,7 +2029,7 @@ msgid "" "`108191`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1375 ../../whatsnew/3.13.rst:1685 +#: ../../whatsnew/3.13.rst:1375 ../../whatsnew/3.13.rst:1687 msgid "typing" msgstr "typing" @@ -2138,7 +2140,7 @@ msgstr ":meth:`!xml.sax.expatreader.ExpatParser.flush`" #: ../../whatsnew/3.13.rst:1445 msgid "(Contributed by Sebastian Pipping in :gh:`115623`.)" -msgstr "" +msgstr "(由 Sebastian Pipping 在 :gh:`115623` 中貢獻。)" #: ../../whatsnew/3.13.rst:1447 msgid "" @@ -2325,60 +2327,62 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1569 -msgid ":mod:`!pipes`: Use the :mod:`subprocess` module instead." +msgid "" +":mod:`!pipes`: Use the :mod:`subprocess` module instead. Use :func:`shlex." +"quote` to replace the undocumented ``pipes.quote`` function." msgstr "" -#: ../../whatsnew/3.13.rst:1571 +#: ../../whatsnew/3.13.rst:1573 msgid "" ":mod:`!sndhdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements." msgstr "" -#: ../../whatsnew/3.13.rst:1574 +#: ../../whatsnew/3.13.rst:1576 msgid ":mod:`!spwd`: Use the :pypi:`python-pam` library from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1576 +#: ../../whatsnew/3.13.rst:1578 msgid ":mod:`!sunau`" msgstr ":mod:`!sunau`" -#: ../../whatsnew/3.13.rst:1577 +#: ../../whatsnew/3.13.rst:1579 msgid "" ":mod:`!telnetlib`, Use the :pypi:`telnetlib3` or :pypi:`Exscript` libraries " "from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1579 +#: ../../whatsnew/3.13.rst:1581 msgid "" ":mod:`!uu`: Use the :mod:`base64` module instead, as a modern alternative." msgstr "" -#: ../../whatsnew/3.13.rst:1581 +#: ../../whatsnew/3.13.rst:1583 msgid ":mod:`!xdrlib`" msgstr ":mod:`!xdrlib`" -#: ../../whatsnew/3.13.rst:1583 +#: ../../whatsnew/3.13.rst:1585 msgid "" "(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` and :gh:" "`104780`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1587 +#: ../../whatsnew/3.13.rst:1589 msgid "2to3" msgstr "2to3" -#: ../../whatsnew/3.13.rst:1589 +#: ../../whatsnew/3.13.rst:1591 msgid "" "Remove the :program:`2to3` program and the :mod:`!lib2to3` module, " "previously deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:" "`104780`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1595 +#: ../../whatsnew/3.13.rst:1597 msgid "builtins" msgstr "builtins" -#: ../../whatsnew/3.13.rst:1597 +#: ../../whatsnew/3.13.rst:1599 msgid "" "Remove support for chained :class:`classmethod` descriptors (introduced in :" "gh:`63272`). These can no longer be used to wrap other descriptors, such as :" @@ -2388,47 +2392,47 @@ msgid "" "(Contributed by Raymond Hettinger in :gh:`89519`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1606 +#: ../../whatsnew/3.13.rst:1608 msgid "" "Raise a :exc:`RuntimeError` when calling :meth:`frame.clear` on a suspended " "frame (as has always been the case for an executing frame). (Contributed by " "Irit Katriel in :gh:`79932`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1614 +#: ../../whatsnew/3.13.rst:1616 msgid "" "Remove the undocumented :class:`!LegacyInterpolation` class, deprecated in " "the docstring since Python 3.2, and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104886`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1621 +#: ../../whatsnew/3.13.rst:1623 msgid "importlib.metadata" msgstr "importlib.metadata" -#: ../../whatsnew/3.13.rst:1623 +#: ../../whatsnew/3.13.rst:1625 msgid "" "Remove deprecated subscript (:meth:`~object.__getitem__`) access for :ref:" "`EntryPoint <entry-points>` objects. (Contributed by Jason R. Coombs in :gh:" "`113175`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1629 +#: ../../whatsnew/3.13.rst:1631 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.13.rst:1631 +#: ../../whatsnew/3.13.rst:1633 msgid "" "Remove the :func:`!locale.resetlocale` function, deprecated in Python 3.11. " "Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. (Contributed by " "Victor Stinner in :gh:`104783`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1637 +#: ../../whatsnew/3.13.rst:1639 msgid "opcode" msgstr "opcode" -#: ../../whatsnew/3.13.rst:1639 +#: ../../whatsnew/3.13.rst:1641 msgid "" "Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!_opcode." "ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " @@ -2436,7 +2440,7 @@ msgid "" "Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1644 +#: ../../whatsnew/3.13.rst:1646 msgid "" "Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, and :" "attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but were " @@ -2444,43 +2448,43 @@ msgid "" "be used externally. (Contributed by Irit Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1654 +#: ../../whatsnew/3.13.rst:1656 msgid "" "Remove the ability to use :class:`~pathlib.Path` objects as context " "managers. This functionality was deprecated and has had no effect since " "Python 3.9. (Contributed by Barney Gale in :gh:`83863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1662 +#: ../../whatsnew/3.13.rst:1664 msgid "" "Remove the undocumented, deprecated, and broken :func:`!re.template` " "function and :attr:`!re.TEMPLATE` / :attr:`!re.T` flag. (Contributed by " "Serhiy Storchaka and Nikita Sobolev in :gh:`105687`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1668 +#: ../../whatsnew/3.13.rst:1670 msgid "tkinter.tix" msgstr "tkinter.tix" -#: ../../whatsnew/3.13.rst:1670 +#: ../../whatsnew/3.13.rst:1672 msgid "" "Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6. The third-" "party Tix library which the module wrapped is unmaintained. (Contributed by " "Zachary Ware in :gh:`75552`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1676 +#: ../../whatsnew/3.13.rst:1678 msgid "turtle" msgstr "turtle" -#: ../../whatsnew/3.13.rst:1678 +#: ../../whatsnew/3.13.rst:1680 msgid "" "Remove the :meth:`!RawTurtle.settiltangle` method, deprecated in the " "documentation since Python 3.1 and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104876`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1687 +#: ../../whatsnew/3.13.rst:1689 msgid "" "Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces, deprecated " "since Python 3.8. The items in those namespaces can be imported directly " @@ -2488,66 +2492,66 @@ msgid "" "`92871`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1693 +#: ../../whatsnew/3.13.rst:1695 msgid "" "Remove the keyword-argument method of creating :class:`~typing.TypedDict` " "types, deprecated in Python 3.11. (Contributed by Tomas Roun in :gh:" "`104786`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1699 +#: ../../whatsnew/3.13.rst:1701 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.13.rst:1701 +#: ../../whatsnew/3.13.rst:1703 msgid "" "Remove the following :mod:`unittest` functions, deprecated in Python 3.11:" msgstr "" -#: ../../whatsnew/3.13.rst:1703 +#: ../../whatsnew/3.13.rst:1705 msgid ":func:`!unittest.findTestCases`" msgstr ":func:`!unittest.findTestCases`" -#: ../../whatsnew/3.13.rst:1704 +#: ../../whatsnew/3.13.rst:1706 msgid ":func:`!unittest.makeSuite`" msgstr ":func:`!unittest.makeSuite`" -#: ../../whatsnew/3.13.rst:1705 +#: ../../whatsnew/3.13.rst:1707 msgid ":func:`!unittest.getTestCaseNames`" msgstr ":func:`!unittest.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1707 +#: ../../whatsnew/3.13.rst:1709 msgid "Use :class:`~unittest.TestLoader` methods instead:" msgstr "" -#: ../../whatsnew/3.13.rst:1709 +#: ../../whatsnew/3.13.rst:1711 msgid ":meth:`~unittest.TestLoader.loadTestsFromModule`" msgstr ":meth:`~unittest.TestLoader.loadTestsFromModule`" -#: ../../whatsnew/3.13.rst:1710 +#: ../../whatsnew/3.13.rst:1712 msgid ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" msgstr ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" -#: ../../whatsnew/3.13.rst:1711 +#: ../../whatsnew/3.13.rst:1713 msgid ":meth:`~unittest.TestLoader.getTestCaseNames`" msgstr ":meth:`~unittest.TestLoader.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1713 +#: ../../whatsnew/3.13.rst:1715 msgid "(Contributed by Hugo van Kemenade in :gh:`104835`.)" -msgstr "" +msgstr "(由 Hugo van Kemenade 在 :gh:`104835` 中貢獻。)" -#: ../../whatsnew/3.13.rst:1715 +#: ../../whatsnew/3.13.rst:1717 msgid "" "Remove the untested and undocumented :meth:`!TestProgram.usageExit` method, " "deprecated in Python 3.11. (Contributed by Hugo van Kemenade in :gh:" "`104992`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1721 +#: ../../whatsnew/3.13.rst:1723 msgid "urllib" msgstr "urllib" -#: ../../whatsnew/3.13.rst:1723 +#: ../../whatsnew/3.13.rst:1725 msgid "" "Remove the *cafile*, *capath*, and *cadefault* parameters of the :func:" "`urllib.request.urlopen` function, deprecated in Python 3.6. Use the " @@ -2558,33 +2562,33 @@ msgid "" "Victor Stinner in :gh:`105382`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1734 +#: ../../whatsnew/3.13.rst:1736 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.13.rst:1736 +#: ../../whatsnew/3.13.rst:1738 msgid "" "Remove the untested and undocumented :class:`!MacOSX` class, deprecated in " "Python 3.11. Use the :class:`!MacOSXOSAScript` class (introduced in Python " "3.2) instead. (Contributed by Hugo van Kemenade in :gh:`104804`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1741 +#: ../../whatsnew/3.13.rst:1743 msgid "" "Remove the deprecated :attr:`!MacOSXOSAScript._name` attribute. Use the :" "attr:`MacOSXOSAScript.name <webbrowser.controller.name>` attribute instead. " "(Contributed by Nikita Sobolev in :gh:`105546`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1748 +#: ../../whatsnew/3.13.rst:1750 msgid "New Deprecations" msgstr "" -#: ../../whatsnew/3.13.rst:1750 +#: ../../whatsnew/3.13.rst:1752 msgid ":ref:`User-defined functions <user-defined-funcs>`:" msgstr "" -#: ../../whatsnew/3.13.rst:1752 +#: ../../whatsnew/3.13.rst:1754 msgid "" "Deprecate assignment to a function's :attr:`~function.__code__` attribute, " "where the new code object's type does not match the function's type. The " @@ -2592,12 +2596,12 @@ msgid "" "coroutine. (Contributed by Irit Katriel in :gh:`81137`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1758 +#: ../../whatsnew/3.13.rst:1760 #: ../../deprecations/pending-removal-in-3.16.rst:11 msgid ":mod:`array`:" msgstr ":mod:`array`:" -#: ../../whatsnew/3.13.rst:1760 +#: ../../whatsnew/3.13.rst:1762 msgid "" "Deprecate the ``'u'`` format code (:c:type:`wchar_t`) at runtime. This " "format code has been deprecated in documentation since Python 3.3, and will " @@ -2606,50 +2610,50 @@ msgid "" "`80480`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1767 +#: ../../whatsnew/3.13.rst:1769 #: ../../deprecations/pending-removal-in-3.15.rst:16 msgid ":mod:`ctypes`:" msgstr ":mod:`ctypes`:" -#: ../../whatsnew/3.13.rst:1769 +#: ../../whatsnew/3.13.rst:1771 msgid "" "Deprecate the undocumented :func:`!SetPointerType` function, to be removed " "in Python 3.15. (Contributed by Victor Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1773 +#: ../../whatsnew/3.13.rst:1775 msgid "" ":term:`Soft-deprecate <soft deprecated>` the :func:`~ctypes.ARRAY` function " "in favour of ``type * length`` multiplication. (Contributed by Victor " "Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1777 +#: ../../whatsnew/3.13.rst:1779 msgid ":mod:`decimal`:" msgstr ":mod:`decimal`:" -#: ../../whatsnew/3.13.rst:1779 +#: ../../whatsnew/3.13.rst:1781 msgid "" "Deprecate the non-standard and undocumented :class:`~decimal.Decimal` format " "specifier ``'N'``, which is only supported in the :mod:`!decimal` module's C " "implementation. (Contributed by Serhiy Storchaka in :gh:`89902`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1784 +#: ../../whatsnew/3.13.rst:1786 msgid ":mod:`dis`:" msgstr ":mod:`dis`:" -#: ../../whatsnew/3.13.rst:1786 +#: ../../whatsnew/3.13.rst:1788 msgid "" "Deprecate the :attr:`!HAVE_ARGUMENT` separator. Check membership in :data:" "`~dis.hasarg` instead. (Contributed by Irit Katriel in :gh:`109319`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1790 +#: ../../whatsnew/3.13.rst:1792 msgid ":mod:`getopt` and :mod:`optparse`:" msgstr ":mod:`getopt` 和 :mod:`optparse`:" -#: ../../whatsnew/3.13.rst:1792 +#: ../../whatsnew/3.13.rst:1794 msgid "" "Both modules are now :term:`soft deprecated`, with :mod:`argparse` preferred " "for new projects. This is a new soft-deprecation for the :mod:`!getopt` " @@ -2657,22 +2661,22 @@ msgid "" "deprecated. (Contributed by Victor Stinner in :gh:`106535`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1798 +#: ../../whatsnew/3.13.rst:1800 msgid ":mod:`gettext`:" msgstr ":mod:`gettext`:" -#: ../../whatsnew/3.13.rst:1800 +#: ../../whatsnew/3.13.rst:1802 msgid "" "Deprecate non-integer numbers as arguments to functions and methods that " "consider plural forms in the :mod:`!gettext` module, even if no translation " "was found. (Contributed by Serhiy Storchaka in :gh:`88434`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1805 +#: ../../whatsnew/3.13.rst:1807 msgid ":mod:`glob`:" msgstr ":mod:`glob`:" -#: ../../whatsnew/3.13.rst:1807 +#: ../../whatsnew/3.13.rst:1809 msgid "" "Deprecate the undocumented :func:`!glob0` and :func:`!glob1` functions. Use :" "func:`~glob.glob` and pass a :term:`path-like object` specifying the root " @@ -2680,12 +2684,12 @@ msgid "" "in :gh:`117337`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1812 +#: ../../whatsnew/3.13.rst:1814 #: ../../deprecations/pending-removal-in-3.15.rst:21 msgid ":mod:`http.server`:" msgstr ":mod:`http.server`:" -#: ../../whatsnew/3.13.rst:1814 +#: ../../whatsnew/3.13.rst:1816 msgid "" "Deprecate :class:`~http.server.CGIHTTPRequestHandler`, to be removed in " "Python 3.15. Process-based CGI HTTP servers have been out of favor for a " @@ -2694,29 +2698,29 @@ msgid "" "by Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1821 +#: ../../whatsnew/3.13.rst:1823 msgid "" "Deprecate the :option:`!--cgi` flag to the :program:`python -m http.server` " "command-line interface, to be removed in Python 3.15. (Contributed by " "Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1826 +#: ../../whatsnew/3.13.rst:1828 msgid ":mod:`mimetypes`:" msgstr ":mod:`mimetypes`:" -#: ../../whatsnew/3.13.rst:1828 +#: ../../whatsnew/3.13.rst:1830 msgid "" ":term:`Soft-deprecate <soft deprecated>` file path arguments to :func:" "`~mimetypes.guess_type`, use :func:`~mimetypes.guess_file_type` instead. " "(Contributed by Serhiy Storchaka in :gh:`66543`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1833 +#: ../../whatsnew/3.13.rst:1835 msgid ":mod:`re`:" msgstr ":mod:`re`:" -#: ../../whatsnew/3.13.rst:1835 +#: ../../whatsnew/3.13.rst:1837 msgid "" "Deprecate passing the optional *maxsplit*, *count*, or *flags* arguments as " "positional arguments to the module-level :func:`~re.split`, :func:`~re.sub`, " @@ -2725,46 +2729,46 @@ msgid "" "by Serhiy Storchaka in :gh:`56166`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1842 +#: ../../whatsnew/3.13.rst:1844 #: ../../deprecations/pending-removal-in-3.15.rst:42 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../whatsnew/3.13.rst:1844 +#: ../../whatsnew/3.13.rst:1846 msgid "" "Deprecate :meth:`.PurePath.is_reserved`, to be removed in Python 3.15. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows. (Contributed " "by Barney Gale in :gh:`88569`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1849 +#: ../../whatsnew/3.13.rst:1851 #: ../../deprecations/pending-removal-in-3.15.rst:48 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../whatsnew/3.13.rst:1851 +#: ../../whatsnew/3.13.rst:1853 msgid "" "Deprecate :func:`~platform.java_ver`, to be removed in Python 3.15. This " "function is only useful for Jython support, has a confusing API, and is " "largely untested. (Contributed by Nikita Sobolev in :gh:`116349`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1857 +#: ../../whatsnew/3.13.rst:1859 msgid ":mod:`pydoc`:" msgstr ":mod:`pydoc`:" -#: ../../whatsnew/3.13.rst:1859 +#: ../../whatsnew/3.13.rst:1861 msgid "" "Deprecate the undocumented :func:`!ispackage` function. (Contributed by " "Zackery Spytz in :gh:`64020`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1862 +#: ../../whatsnew/3.13.rst:1864 #: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../whatsnew/3.13.rst:1864 +#: ../../whatsnew/3.13.rst:1866 msgid "" "Deprecate passing more than one positional argument to the :func:`~sqlite3." "connect` function and the :class:`~sqlite3.Connection` constructor. The " @@ -2772,7 +2776,7 @@ msgid "" "by Erlend E. Aasland in :gh:`107948`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1870 +#: ../../whatsnew/3.13.rst:1872 msgid "" "Deprecate passing name, number of arguments, and the callable as keyword " "arguments for :meth:`.Connection.create_function` and :meth:`.Connection." @@ -2780,7 +2784,7 @@ msgid "" "3.15. (Contributed by Erlend E. Aasland in :gh:`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1876 +#: ../../whatsnew/3.13.rst:1878 msgid "" "Deprecate passing the callback callable by keyword for the :meth:`~sqlite3." "Connection.set_authorizer`, :meth:`~sqlite3.Connection." @@ -2790,46 +2794,46 @@ msgid "" "`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1884 +#: ../../whatsnew/3.13.rst:1886 #: ../../deprecations/pending-removal-in-3.16.rst:47 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" -#: ../../whatsnew/3.13.rst:1886 +#: ../../whatsnew/3.13.rst:1888 msgid "" "Deprecate the :func:`~sys._enablelegacywindowsfsencoding` function, to be " "removed in Python 3.16. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable instead. (Contributed by Inada Naoki in :gh:`73427`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1891 +#: ../../whatsnew/3.13.rst:1893 #: ../../deprecations/pending-removal-in-3.16.rst:53 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" -#: ../../whatsnew/3.13.rst:1893 +#: ../../whatsnew/3.13.rst:1895 msgid "" "Deprecate the undocumented and unused :attr:`!TarFile.tarfile` attribute, to " "be removed in Python 3.16. (Contributed in :gh:`115256`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1897 +#: ../../whatsnew/3.13.rst:1899 msgid ":mod:`traceback`:" msgstr ":mod:`traceback`:" -#: ../../whatsnew/3.13.rst:1899 +#: ../../whatsnew/3.13.rst:1901 msgid "" "Deprecate the :attr:`.TracebackException.exc_type` attribute. Use :attr:`." "TracebackException.exc_type_str` instead. (Contributed by Irit Katriel in :" "gh:`112332`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1903 +#: ../../whatsnew/3.13.rst:1905 #: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../whatsnew/3.13.rst:1905 +#: ../../whatsnew/3.13.rst:1907 msgid "" "Deprecate the undocumented keyword argument syntax for creating :class:" "`~typing.NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, " @@ -2837,7 +2841,7 @@ msgid "" "functional syntax instead. (Contributed by Alex Waygood in :gh:`105566`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1912 +#: ../../whatsnew/3.13.rst:1914 msgid "" "Deprecate omitting the *fields* parameter when creating a :class:`~typing." "NamedTuple` or :class:`typing.TypedDict` class, and deprecate passing " @@ -2849,7 +2853,7 @@ msgid "" "Alex Waygood in :gh:`105566` and :gh:`105570`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1922 +#: ../../whatsnew/3.13.rst:1924 msgid "" "Deprecate the :func:`typing.no_type_check_decorator` decorator function, to " "be removed in in Python 3.15. After eight years in the :mod:`typing` module, " @@ -2857,7 +2861,7 @@ msgid "" "Waygood in :gh:`106309`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1928 +#: ../../whatsnew/3.13.rst:1930 msgid "" "Deprecate :data:`typing.AnyStr`. In Python 3.16, it will be removed from " "``typing.__all__``, and a :exc:`DeprecationWarning` will be emitted at " @@ -2866,12 +2870,12 @@ msgid "" "(Contributed by Michael The in :gh:`107116`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1936 +#: ../../whatsnew/3.13.rst:1938 #: ../../deprecations/pending-removal-in-3.15.rst:84 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../whatsnew/3.13.rst:1938 +#: ../../whatsnew/3.13.rst:1940 msgid "" "Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:" "`~wave.Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :" @@ -3295,6 +3299,9 @@ msgid "" "Python 3.16, use :func:`inspect.iscoroutinefunction` instead. (Contributed " "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" +":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" +"gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 #: ../../deprecations/pending-removal-in-future.rst:12 @@ -3773,11 +3780,11 @@ msgstr "" ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." "zipimporter.exec_module`。" -#: ../../whatsnew/3.13.rst:1955 +#: ../../whatsnew/3.13.rst:1957 msgid "CPython Bytecode Changes" msgstr "" -#: ../../whatsnew/3.13.rst:1957 +#: ../../whatsnew/3.13.rst:1959 msgid "" "The oparg of :opcode:`YIELD_VALUE` is now ``1`` if the yield is part of a " "yield-from or await, and ``0`` otherwise. The oparg of :opcode:`RESUME` was " @@ -3786,97 +3793,97 @@ msgid "" "`111354`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1965 +#: ../../whatsnew/3.13.rst:1967 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.13.rst:1970 +#: ../../whatsnew/3.13.rst:1972 msgid "" "Add the :ref:`PyMonitoring C API <c-api-monitoring>` for generating :pep:" "`669` monitoring events:" msgstr "" -#: ../../whatsnew/3.13.rst:1973 +#: ../../whatsnew/3.13.rst:1975 msgid ":c:type:`PyMonitoringState`" msgstr ":c:type:`PyMonitoringState`" -#: ../../whatsnew/3.13.rst:1974 +#: ../../whatsnew/3.13.rst:1976 msgid ":c:func:`PyMonitoring_FirePyStartEvent`" msgstr ":c:func:`PyMonitoring_FirePyStartEvent`" -#: ../../whatsnew/3.13.rst:1975 +#: ../../whatsnew/3.13.rst:1977 msgid ":c:func:`PyMonitoring_FirePyResumeEvent`" msgstr ":c:func:`PyMonitoring_FirePyResumeEvent`" -#: ../../whatsnew/3.13.rst:1976 +#: ../../whatsnew/3.13.rst:1978 msgid ":c:func:`PyMonitoring_FirePyReturnEvent`" msgstr ":c:func:`PyMonitoring_FirePyReturnEvent`" -#: ../../whatsnew/3.13.rst:1977 +#: ../../whatsnew/3.13.rst:1979 msgid ":c:func:`PyMonitoring_FirePyYieldEvent`" msgstr ":c:func:`PyMonitoring_FirePyYieldEvent`" -#: ../../whatsnew/3.13.rst:1978 +#: ../../whatsnew/3.13.rst:1980 msgid ":c:func:`PyMonitoring_FireCallEvent`" msgstr ":c:func:`PyMonitoring_FireCallEvent`" -#: ../../whatsnew/3.13.rst:1979 +#: ../../whatsnew/3.13.rst:1981 msgid ":c:func:`PyMonitoring_FireLineEvent`" msgstr ":c:func:`PyMonitoring_FireLineEvent`" -#: ../../whatsnew/3.13.rst:1980 +#: ../../whatsnew/3.13.rst:1982 msgid ":c:func:`PyMonitoring_FireJumpEvent`" msgstr ":c:func:`PyMonitoring_FireJumpEvent`" -#: ../../whatsnew/3.13.rst:1981 +#: ../../whatsnew/3.13.rst:1983 msgid ":c:func:`PyMonitoring_FireBranchEvent`" msgstr ":c:func:`PyMonitoring_FireBranchEvent`" -#: ../../whatsnew/3.13.rst:1982 +#: ../../whatsnew/3.13.rst:1984 msgid ":c:func:`PyMonitoring_FireCReturnEvent`" msgstr ":c:func:`PyMonitoring_FireCReturnEvent`" -#: ../../whatsnew/3.13.rst:1983 +#: ../../whatsnew/3.13.rst:1985 msgid ":c:func:`PyMonitoring_FirePyThrowEvent`" msgstr ":c:func:`PyMonitoring_FirePyThrowEvent`" -#: ../../whatsnew/3.13.rst:1984 +#: ../../whatsnew/3.13.rst:1986 msgid ":c:func:`PyMonitoring_FireRaiseEvent`" msgstr ":c:func:`PyMonitoring_FireRaiseEvent`" -#: ../../whatsnew/3.13.rst:1985 +#: ../../whatsnew/3.13.rst:1987 msgid ":c:func:`PyMonitoring_FireCRaiseEvent`" msgstr ":c:func:`PyMonitoring_FireCRaiseEvent`" -#: ../../whatsnew/3.13.rst:1986 +#: ../../whatsnew/3.13.rst:1988 msgid ":c:func:`PyMonitoring_FireReraiseEvent`" msgstr ":c:func:`PyMonitoring_FireReraiseEvent`" -#: ../../whatsnew/3.13.rst:1987 +#: ../../whatsnew/3.13.rst:1989 msgid ":c:func:`PyMonitoring_FireExceptionHandledEvent`" msgstr ":c:func:`PyMonitoring_FireExceptionHandledEvent`" -#: ../../whatsnew/3.13.rst:1988 +#: ../../whatsnew/3.13.rst:1990 msgid ":c:func:`PyMonitoring_FirePyUnwindEvent`" msgstr ":c:func:`PyMonitoring_FirePyUnwindEvent`" -#: ../../whatsnew/3.13.rst:1989 +#: ../../whatsnew/3.13.rst:1991 msgid ":c:func:`PyMonitoring_FireStopIterationEvent`" msgstr ":c:func:`PyMonitoring_FireStopIterationEvent`" -#: ../../whatsnew/3.13.rst:1990 +#: ../../whatsnew/3.13.rst:1992 msgid ":c:func:`PyMonitoring_EnterScope`" msgstr ":c:func:`PyMonitoring_EnterScope`" -#: ../../whatsnew/3.13.rst:1991 +#: ../../whatsnew/3.13.rst:1993 msgid ":c:func:`PyMonitoring_ExitScope`" msgstr ":c:func:`PyMonitoring_ExitScope`" -#: ../../whatsnew/3.13.rst:1993 +#: ../../whatsnew/3.13.rst:1995 msgid "(Contributed by Irit Katriel in :gh:`111997`)." msgstr "" -#: ../../whatsnew/3.13.rst:1995 +#: ../../whatsnew/3.13.rst:1997 msgid "" "Add :c:type:`PyMutex`, a lightweight mutex that occupies a single byte, and " "the new :c:func:`PyMutex_Lock` and :c:func:`PyMutex_Unlock` functions. :c:" @@ -3884,52 +3891,52 @@ msgid "" "operation needs to block. (Contributed by Sam Gross in :gh:`108724`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2001 +#: ../../whatsnew/3.13.rst:2003 msgid "" "Add the :ref:`PyTime C API <c-api-time>` to provide access to system clocks:" msgstr "" -#: ../../whatsnew/3.13.rst:2003 +#: ../../whatsnew/3.13.rst:2005 msgid ":c:type:`PyTime_t`." msgstr ":c:type:`PyTime_t`。" -#: ../../whatsnew/3.13.rst:2004 +#: ../../whatsnew/3.13.rst:2006 msgid ":c:var:`PyTime_MIN` and :c:var:`PyTime_MAX`." msgstr "" -#: ../../whatsnew/3.13.rst:2005 +#: ../../whatsnew/3.13.rst:2007 msgid ":c:func:`PyTime_AsSecondsDouble`." msgstr ":c:func:`PyTime_AsSecondsDouble`。" -#: ../../whatsnew/3.13.rst:2006 +#: ../../whatsnew/3.13.rst:2008 msgid ":c:func:`PyTime_Monotonic`." msgstr ":c:func:`PyTime_Monotonic`。" -#: ../../whatsnew/3.13.rst:2007 +#: ../../whatsnew/3.13.rst:2009 msgid ":c:func:`PyTime_MonotonicRaw`." msgstr ":c:func:`PyTime_MonotonicRaw`。" -#: ../../whatsnew/3.13.rst:2008 +#: ../../whatsnew/3.13.rst:2010 msgid ":c:func:`PyTime_PerfCounter`." msgstr ":c:func:`PyTime_PerfCounter`。" -#: ../../whatsnew/3.13.rst:2009 +#: ../../whatsnew/3.13.rst:2011 msgid ":c:func:`PyTime_PerfCounterRaw`." msgstr ":c:func:`PyTime_PerfCounterRaw`。" -#: ../../whatsnew/3.13.rst:2010 +#: ../../whatsnew/3.13.rst:2012 msgid ":c:func:`PyTime_Time`." msgstr ":c:func:`PyTime_Time`。" -#: ../../whatsnew/3.13.rst:2011 +#: ../../whatsnew/3.13.rst:2013 msgid ":c:func:`PyTime_TimeRaw`." msgstr ":c:func:`PyTime_TimeRaw`。" -#: ../../whatsnew/3.13.rst:2013 +#: ../../whatsnew/3.13.rst:2015 msgid "(Contributed by Victor Stinner and Petr Viktorin in :gh:`110850`.)" -msgstr "" +msgstr "(由 Victor Stinner 和 Petr Viktorin 在 :gh:`110850` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2015 +#: ../../whatsnew/3.13.rst:2017 msgid "" "Add the :c:func:`PyDict_ContainsString` function with the same behavior as :" "c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const char*` " @@ -3937,7 +3944,7 @@ msgid "" "by Victor Stinner in :gh:`108314`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2021 +#: ../../whatsnew/3.13.rst:2023 msgid "" "Add the :c:func:`PyDict_GetItemRef` and :c:func:`PyDict_GetItemStringRef` " "functions, which behave similarly to :c:func:`PyDict_GetItemWithError`, but " @@ -3947,7 +3954,7 @@ msgid "" "`106004`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2029 +#: ../../whatsnew/3.13.rst:2031 msgid "" "Add the :c:func:`PyDict_SetDefaultRef` function, which behaves similarly to :" "c:func:`PyDict_SetDefault`, but returns a :term:`strong reference` instead " @@ -3956,7 +3963,7 @@ msgid "" "dictionary. (Contributed by Sam Gross in :gh:`112066`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2037 +#: ../../whatsnew/3.13.rst:2039 msgid "" "Add the :c:func:`PyDict_Pop` and :c:func:`PyDict_PopString` functions to " "remove a key from a dictionary and optionally return the removed value. This " @@ -3965,7 +3972,7 @@ msgid "" "Victor Stinner in :gh:`111262`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2044 +#: ../../whatsnew/3.13.rst:2046 msgid "" "Add the :c:func:`PyMapping_GetOptionalItem` and :c:func:" "`PyMapping_GetOptionalItemString` functions as alternatives to :c:func:" @@ -3976,7 +3983,7 @@ msgid "" "gh:`106307`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2054 +#: ../../whatsnew/3.13.rst:2056 msgid "" "Add the :c:func:`PyObject_GetOptionalAttr` and :c:func:" "`PyObject_GetOptionalAttrString` functions as alternatives to :c:func:" @@ -3987,37 +3994,37 @@ msgid "" "Serhiy Storchaka in :gh:`106521`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2064 +#: ../../whatsnew/3.13.rst:2066 msgid "" "Add the :c:func:`PyErr_FormatUnraisable` function as an extension to :c:func:" "`PyErr_WriteUnraisable` that allows customizing the warning message. " "(Contributed by Serhiy Storchaka in :gh:`108082`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2069 +#: ../../whatsnew/3.13.rst:2071 msgid "" "Add new functions that return a :term:`strong reference` instead of a :term:" "`borrowed reference` for frame locals, globals, and builtins, as part of :" "ref:`PEP 667 <whatsnew313-locals-semantics>`:" msgstr "" -#: ../../whatsnew/3.13.rst:2073 +#: ../../whatsnew/3.13.rst:2075 msgid ":c:func:`PyEval_GetFrameBuiltins` replaces :c:func:`PyEval_GetBuiltins`" msgstr ":c:func:`PyEval_GetFrameBuiltins` 取代 :c:func:`PyEval_GetBuiltins`" -#: ../../whatsnew/3.13.rst:2074 +#: ../../whatsnew/3.13.rst:2076 msgid ":c:func:`PyEval_GetFrameGlobals` replaces :c:func:`PyEval_GetGlobals`" msgstr ":c:func:`PyEval_GetFrameGlobals` 取代 :c:func:`PyEval_GetGlobals`" -#: ../../whatsnew/3.13.rst:2075 +#: ../../whatsnew/3.13.rst:2077 msgid ":c:func:`PyEval_GetFrameLocals` replaces :c:func:`PyEval_GetLocals`" msgstr ":c:func:`PyEval_GetFrameLocals` 取代 :c:func:`PyEval_GetLocals`" -#: ../../whatsnew/3.13.rst:2077 +#: ../../whatsnew/3.13.rst:2079 msgid "(Contributed by Mark Shannon and Tian Gao in :gh:`74929`.)" -msgstr "" +msgstr "(由 Mark Shannon 和 Tian Gao 在 :gh:`74929` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2079 +#: ../../whatsnew/3.13.rst:2081 msgid "" "Add the :c:func:`Py_GetConstant` and :c:func:`Py_GetConstantBorrowed` " "functions to get :term:`strong <strong reference>` or :term:`borrowed " @@ -4026,7 +4033,7 @@ msgid "" "constant zero. (Contributed by Victor Stinner in :gh:`115754`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2086 +#: ../../whatsnew/3.13.rst:2088 msgid "" "Add the :c:func:`PyImport_AddModuleRef` function as a replacement for :c:" "func:`PyImport_AddModule` that returns a :term:`strong reference` instead of " @@ -4034,35 +4041,35 @@ msgid "" "`105922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2091 +#: ../../whatsnew/3.13.rst:2093 msgid "" "Add the :c:func:`Py_IsFinalizing` function to check whether the main Python " "interpreter is :term:`shutting down <interpreter shutdown>`. (Contributed by " "Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2096 +#: ../../whatsnew/3.13.rst:2098 msgid "" "Add the :c:func:`PyList_GetItemRef` function as a replacement for :c:func:" "`PyList_GetItem` that returns a :term:`strong reference` instead of a :term:" "`borrowed reference`. (Contributed by Sam Gross in :gh:`114329`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2101 +#: ../../whatsnew/3.13.rst:2103 msgid "" "Add the :c:func:`PyList_Extend` and :c:func:`PyList_Clear` functions, " "mirroring the Python :meth:`!list.extend` and :meth:`!list.clear` methods. " "(Contributed by Victor Stinner in :gh:`111138`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2105 +#: ../../whatsnew/3.13.rst:2107 msgid "" "Add the :c:func:`PyLong_AsInt` function. It behaves similarly to :c:func:" "`PyLong_AsLong`, but stores the result in a C :c:expr:`int` instead of a C :" "c:expr:`long`. (Contributed by Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2110 +#: ../../whatsnew/3.13.rst:2112 msgid "" "Add the :c:func:`PyLong_AsNativeBytes`, :c:func:`PyLong_FromNativeBytes`, " "and :c:func:`PyLong_FromUnsignedNativeBytes` functions to simplify " @@ -4070,27 +4077,27 @@ msgid "" "(Contributed by Steve Dower in :gh:`111140`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2116 +#: ../../whatsnew/3.13.rst:2118 msgid "" "Add :c:func:`PyModule_Add` function, which is similar to :c:func:" "`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but always steals " "a reference to the value. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2121 +#: ../../whatsnew/3.13.rst:2123 msgid "" "Add the :c:func:`PyObject_GenericHash` function that implements the default " "hashing function of a Python object. (Contributed by Serhiy Storchaka in :gh:" "`113024`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2125 +#: ../../whatsnew/3.13.rst:2127 msgid "" "Add the :c:func:`Py_HashPointer` function to hash a raw pointer. " "(Contributed by Victor Stinner in :gh:`111545`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2128 +#: ../../whatsnew/3.13.rst:2130 msgid "" "Add the :c:func:`PyObject_VisitManagedDict` and :c:func:" "`PyObject_ClearManagedDict` functions. which must be called by the traverse " @@ -4099,7 +4106,7 @@ msgid "" "with Python 3.11 and 3.12. (Contributed by Victor Stinner in :gh:`107073`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2136 +#: ../../whatsnew/3.13.rst:2138 msgid "" "Add the :c:func:`PyRefTracer_SetTracer` and :c:func:`PyRefTracer_GetTracer` " "functions, which enable tracking object creation and destruction in the same " @@ -4107,14 +4114,14 @@ msgid "" "in :gh:`93502`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2142 +#: ../../whatsnew/3.13.rst:2144 msgid "" "Add the :c:func:`PySys_AuditTuple` function as an alternative to :c:func:" "`PySys_Audit` that takes event arguments as a Python :class:`tuple` object. " "(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2147 +#: ../../whatsnew/3.13.rst:2149 msgid "" "Add the :c:func:`PyThreadState_GetUnchecked()` function as an alternative " "to :c:func:`PyThreadState_Get()` that doesn't kill the process with a fatal " @@ -4122,7 +4129,7 @@ msgid "" "result is ``NULL``. (Contributed by Victor Stinner in :gh:`108867`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2153 +#: ../../whatsnew/3.13.rst:2155 msgid "" "Add the :c:func:`PyType_GetFullyQualifiedName` function to get the type's " "fully qualified name. The module name is prepended if :attr:`type." @@ -4130,14 +4137,14 @@ msgid "" "``'__main__'``. (Contributed by Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2159 +#: ../../whatsnew/3.13.rst:2161 msgid "" "Add the :c:func:`PyType_GetModuleName` function to get the type's module " "name. This is equivalent to getting the :attr:`type.__module__` attribute. " "(Contributed by Eric Snow and Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2164 +#: ../../whatsnew/3.13.rst:2166 msgid "" "Add the :c:func:`PyUnicode_EqualToUTF8AndSize` and :c:func:" "`PyUnicode_EqualToUTF8` functions to compare a Unicode object with a :c:expr:" @@ -4146,7 +4153,7 @@ msgid "" "Storchaka in :gh:`110289`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2171 +#: ../../whatsnew/3.13.rst:2173 msgid "" "Add the :c:func:`PyWeakref_GetRef` function as an alternative to :c:func:" "`PyWeakref_GetObject` that returns a :term:`strong reference` or ``NULL`` if " @@ -4154,47 +4161,47 @@ msgid "" "`105927`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2177 +#: ../../whatsnew/3.13.rst:2179 msgid "Add fixed variants of functions which silently ignore errors:" msgstr "" -#: ../../whatsnew/3.13.rst:2179 +#: ../../whatsnew/3.13.rst:2181 msgid "" ":c:func:`PyObject_HasAttrWithError` replaces :c:func:`PyObject_HasAttr`." msgstr "" -#: ../../whatsnew/3.13.rst:2180 +#: ../../whatsnew/3.13.rst:2182 msgid "" ":c:func:`PyObject_HasAttrStringWithError` replaces :c:func:" "`PyObject_HasAttrString`." msgstr "" -#: ../../whatsnew/3.13.rst:2182 +#: ../../whatsnew/3.13.rst:2184 msgid "" ":c:func:`PyMapping_HasKeyWithError` replaces :c:func:`PyMapping_HasKey`." msgstr "" -#: ../../whatsnew/3.13.rst:2183 +#: ../../whatsnew/3.13.rst:2185 msgid "" ":c:func:`PyMapping_HasKeyStringWithError` replaces :c:func:" "`PyMapping_HasKeyString`." msgstr "" -#: ../../whatsnew/3.13.rst:2186 +#: ../../whatsnew/3.13.rst:2188 msgid "" "The new functions return ``-1`` for errors and the standard ``1`` for true " "and ``0`` for false." msgstr "" -#: ../../whatsnew/3.13.rst:2189 +#: ../../whatsnew/3.13.rst:2191 msgid "(Contributed by Serhiy Storchaka in :gh:`108511`.)" -msgstr "" +msgstr "(由 Serhiy Storchaka 在 :gh:`108511` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2193 +#: ../../whatsnew/3.13.rst:2195 msgid "Changed C APIs" msgstr "" -#: ../../whatsnew/3.13.rst:2195 +#: ../../whatsnew/3.13.rst:2197 msgid "" "The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and :c:" "func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * const *` " @@ -4207,20 +4214,20 @@ msgid "" "`65210`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2207 +#: ../../whatsnew/3.13.rst:2209 msgid "" ":c:func:`PyArg_ParseTupleAndKeywords` now supports non-ASCII keyword " "parameter names. (Contributed by Serhiy Storchaka in :gh:`110815`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2211 +#: ../../whatsnew/3.13.rst:2213 msgid "" "The :c:func:`!PyCode_GetFirstFree` function is now unstable API and is now " "named :c:func:`PyUnstable_Code_GetFirstFree`. (Contributed by Bogdan " "Romanyuk in :gh:`115781`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2215 +#: ../../whatsnew/3.13.rst:2217 msgid "" "The :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:" "`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:" @@ -4231,35 +4238,35 @@ msgid "" "documentation. (Contributed by Serhiy Storchaka in :gh:`106672`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2224 +#: ../../whatsnew/3.13.rst:2226 msgid "" "Add support for the ``%T``, ``%#T``, ``%N`` and ``%#N`` formats to :c:func:" "`PyUnicode_FromFormat`:" msgstr "" -#: ../../whatsnew/3.13.rst:2227 +#: ../../whatsnew/3.13.rst:2229 msgid "``%T``: Get the fully qualified name of an object type" msgstr "" -#: ../../whatsnew/3.13.rst:2228 +#: ../../whatsnew/3.13.rst:2230 msgid "``%#T``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2229 +#: ../../whatsnew/3.13.rst:2231 msgid "``%N``: Get the fully qualified name of a type" msgstr "" -#: ../../whatsnew/3.13.rst:2230 +#: ../../whatsnew/3.13.rst:2232 msgid "``%#N``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2232 +#: ../../whatsnew/3.13.rst:2234 msgid "" "See :pep:`737` for more information. (Contributed by Victor Stinner in :gh:" "`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2235 +#: ../../whatsnew/3.13.rst:2237 msgid "" "You no longer have to define the ``PY_SSIZE_T_CLEAN`` macro before " "including :file:`Python.h` when using ``#`` formats in :ref:`format codes " @@ -4268,7 +4275,7 @@ msgid "" "`104922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2241 +#: ../../whatsnew/3.13.rst:2243 msgid "" "If Python is built in :ref:`debug mode <debug-build>` or :option:`with " "assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and :c:func:" @@ -4276,60 +4283,61 @@ msgid "" "(Contributed by Victor Stinner in :gh:`106168`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2249 +#: ../../whatsnew/3.13.rst:2251 msgid "Limited C API Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2251 +#: ../../whatsnew/3.13.rst:2253 msgid "The following functions are now included in the Limited C API:" msgstr "" -#: ../../whatsnew/3.13.rst:2253 +#: ../../whatsnew/3.13.rst:2255 msgid ":c:func:`PyMem_RawMalloc`" msgstr ":c:func:`PyMem_RawMalloc`" -#: ../../whatsnew/3.13.rst:2254 +#: ../../whatsnew/3.13.rst:2256 msgid ":c:func:`PyMem_RawCalloc`" msgstr ":c:func:`PyMem_RawCalloc`" -#: ../../whatsnew/3.13.rst:2255 +#: ../../whatsnew/3.13.rst:2257 msgid ":c:func:`PyMem_RawRealloc`" msgstr ":c:func:`PyMem_RawRealloc`" -#: ../../whatsnew/3.13.rst:2256 +#: ../../whatsnew/3.13.rst:2258 msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" -#: ../../whatsnew/3.13.rst:2257 +#: ../../whatsnew/3.13.rst:2259 msgid ":c:func:`PySys_Audit`" msgstr ":c:func:`PySys_Audit`" -#: ../../whatsnew/3.13.rst:2258 +#: ../../whatsnew/3.13.rst:2260 msgid ":c:func:`PySys_AuditTuple`" msgstr ":c:func:`PySys_AuditTuple`" -#: ../../whatsnew/3.13.rst:2259 +#: ../../whatsnew/3.13.rst:2261 msgid ":c:func:`PyType_GetModuleByDef`" msgstr ":c:func:`PyType_GetModuleByDef`" -#: ../../whatsnew/3.13.rst:2261 +#: ../../whatsnew/3.13.rst:2263 msgid "" "(Contributed by Victor Stinner in :gh:`85283`, :gh:`85283`, and :gh:" "`116936`.)" msgstr "" +"(由 Victor Stinner 貢獻於 :gh:`85283`、:gh:`85283` 和 :gh:`116936`。)" -#: ../../whatsnew/3.13.rst:2263 +#: ../../whatsnew/3.13.rst:2265 msgid "" "Python built with :option:`--with-trace-refs` (tracing references) now " "supports the :ref:`Limited API <limited-c-api>`. (Contributed by Victor " "Stinner in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2269 +#: ../../whatsnew/3.13.rst:2271 msgid "Removed C APIs" -msgstr "" +msgstr "移除的 C API" -#: ../../whatsnew/3.13.rst:2271 +#: ../../whatsnew/3.13.rst:2273 msgid "" "Remove several functions, macros, variables, etc with names prefixed by " "``_Py`` or ``_PY`` (which are considered private). If your project is " @@ -4339,13 +4347,13 @@ msgid "" "Victor Stinner. (Contributed by Victor Stinner in :gh:`106320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2279 +#: ../../whatsnew/3.13.rst:2281 msgid "" "Remove old buffer protocols deprecated in Python 3.0. Use :ref:" "`bufferobjects` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2282 +#: ../../whatsnew/3.13.rst:2284 msgid "" ":c:func:`!PyObject_CheckReadBuffer`: Use :c:func:`PyObject_CheckBuffer` to " "test whether the object supports the buffer protocol. Note that :c:func:" @@ -4354,13 +4362,15 @@ msgid "" "example of :c:func:`PyObject_GetBuffer`." msgstr "" -#: ../../whatsnew/3.13.rst:2290 +#: ../../whatsnew/3.13.rst:2292 msgid "" ":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: Use :c:" "func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" msgstr "" +":c:func:`!PyObject_AsCharBuffer`、:c:func:`!PyObject_AsReadBuffer`:請改用 :" +"c:func:`PyObject_GetBuffer` 和 :c:func:`PyBuffer_Release`。" -#: ../../whatsnew/3.13.rst:2293 +#: ../../whatsnew/3.13.rst:2295 msgid "" "Py_buffer view;\n" "if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) < 0) {\n" @@ -4371,13 +4381,15 @@ msgid "" "PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2303 +#: ../../whatsnew/3.13.rst:2305 msgid "" ":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` and :c:" "func:`PyBuffer_Release` instead:" msgstr "" +":c:func:`!PyObject_AsWriteBuffer`:請改用 :c:func:`PyObject_GetBuffer` 和 :c:" +"func:`PyBuffer_Release`。" -#: ../../whatsnew/3.13.rst:2306 +#: ../../whatsnew/3.13.rst:2308 msgid "" "Py_buffer view;\n" "if (PyObject_GetBuffer(obj, &view, PyBUF_WRITABLE) < 0) {\n" @@ -4387,21 +4399,23 @@ msgid "" "PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2315 +#: ../../whatsnew/3.13.rst:2317 msgid "(Contributed by Inada Naoki in :gh:`85275`.)" -msgstr "" +msgstr "(由 Inada Naoki 貢獻於 :gh:`85275`。)" -#: ../../whatsnew/3.13.rst:2317 +#: ../../whatsnew/3.13.rst:2319 msgid "Remove various functions deprecated in Python 3.9:" msgstr "" -#: ../../whatsnew/3.13.rst:2319 +#: ../../whatsnew/3.13.rst:2321 msgid "" ":c:func:`!PyEval_CallObject`, :c:func:`!PyEval_CallObjectWithKeywords`: Use :" "c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead." msgstr "" +":c:func:`!PyEval_CallObject`、:c:func:`!PyEval_CallObjectWithKeywords`:請改" +"用 :c:func:`PyObject_CallNoArgs` 或 :c:func:`PyObject_Call`。" -#: ../../whatsnew/3.13.rst:2324 +#: ../../whatsnew/3.13.rst:2326 msgid "" "In :c:func:`PyObject_Call`, positional arguments must be a :class:`tuple` " "and must not be ``NULL``, and keyword arguments must be a :class:`dict` or " @@ -4412,107 +4426,124 @@ msgid "" "`PyTuple_New(0) <PyTuple_New>`." msgstr "" -#: ../../whatsnew/3.13.rst:2334 +#: ../../whatsnew/3.13.rst:2336 msgid "" ":c:func:`!PyEval_CallFunction`: Use :c:func:`PyObject_CallFunction` instead." msgstr "" +":c:func:`!PyEval_CallFunction`:請改用 :c:func:`PyObject_CallFunction`。" -#: ../../whatsnew/3.13.rst:2336 +#: ../../whatsnew/3.13.rst:2338 msgid "" ":c:func:`!PyEval_CallMethod`: Use :c:func:`PyObject_CallMethod` instead." -msgstr "" +msgstr ":c:func:`!PyEval_CallMethod`:請改用 :c:func:`PyObject_CallMethod`。" -#: ../../whatsnew/3.13.rst:2338 +#: ../../whatsnew/3.13.rst:2340 msgid ":c:func:`!PyCFunction_Call`: Use :c:func:`PyObject_Call` instead." -msgstr "" +msgstr ":c:func:`!PyCFunction_Call`:請改用 :c:func:`PyCFunction_Call`。" -#: ../../whatsnew/3.13.rst:2341 +#: ../../whatsnew/3.13.rst:2343 msgid "(Contributed by Victor Stinner in :gh:`105107`.)" -msgstr "" +msgstr "(由 Victor Stinner 貢獻於 :gh:`105107`。)" -#: ../../whatsnew/3.13.rst:2343 +#: ../../whatsnew/3.13.rst:2345 msgid "" "Remove the following old functions to configure the Python initialization, " "deprecated in Python 3.11:" msgstr "" -#: ../../whatsnew/3.13.rst:2346 +#: ../../whatsnew/3.13.rst:2348 msgid "" ":c:func:`!PySys_AddWarnOptionUnicode`: Use :c:member:`PyConfig.warnoptions` " "instead." msgstr "" +":c:func:`!PySys_AddWarnOptionUnicode`:請改用 :c:member:`PyConfig." +"warnoptions`。" -#: ../../whatsnew/3.13.rst:2348 +#: ../../whatsnew/3.13.rst:2350 msgid "" ":c:func:`!PySys_AddWarnOption`: Use :c:member:`PyConfig.warnoptions` instead." msgstr "" +":c:func:`!PySys_AddWarnOption`:請改用 :c:member:`PyConfig.warnoptions`。" -#: ../../whatsnew/3.13.rst:2350 +#: ../../whatsnew/3.13.rst:2352 msgid ":c:func:`!PySys_AddXOption`: Use :c:member:`PyConfig.xoptions` instead." -msgstr "" +msgstr ":c:func:`!PySys_AddXOption`:請改用 :c:member:`PyConfig.xoptions`。" -#: ../../whatsnew/3.13.rst:2352 +#: ../../whatsnew/3.13.rst:2354 msgid "" ":c:func:`!PySys_HasWarnOptions`: Use :c:member:`PyConfig.xoptions` instead." msgstr "" +":c:func:`!PySys_HasWarnOptions`:請改用 :c:member:`PyConfig.xoptions`。" -#: ../../whatsnew/3.13.rst:2354 +#: ../../whatsnew/3.13.rst:2356 msgid "" ":c:func:`!PySys_SetPath`: Set :c:member:`PyConfig.module_search_paths` " "instead." msgstr "" +":c:func:`!PySys_SetPath`:請改用 :c:member:`PyConfig.module_search_paths`。" -#: ../../whatsnew/3.13.rst:2356 +#: ../../whatsnew/3.13.rst:2358 msgid "" ":c:func:`!Py_SetPath`: Set :c:member:`PyConfig.module_search_paths` instead." msgstr "" +":c:func:`!Py_SetPath`:請改用 :c:member:`PyConfig.module_search_paths`。" -#: ../../whatsnew/3.13.rst:2358 +#: ../../whatsnew/3.13.rst:2360 msgid "" ":c:func:`!Py_SetStandardStreamEncoding`: Set :c:member:`PyConfig." "stdio_encoding` instead, and set also maybe :c:member:`PyConfig." "legacy_windows_stdio` (on Windows)." msgstr "" +":c:func:`!Py_SetStandardStreamEncoding`:請改用 :c:member:`PyConfig." +"stdio_encoding` 並設定可能的 :c:member:`PyConfig.legacy_windows_stdio`\\ " +"(在 Windows 上)。" -#: ../../whatsnew/3.13.rst:2361 +#: ../../whatsnew/3.13.rst:2363 msgid "" ":c:func:`!_Py_SetProgramFullPath`: Set :c:member:`PyConfig.executable` " "instead." msgstr "" +":c:func:`!_Py_SetProgramFullPath`:請改用 :c:member:`PyConfig.executable`。" -#: ../../whatsnew/3.13.rst:2364 +#: ../../whatsnew/3.13.rst:2366 msgid "" "Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " "Configuration <init-config>` instead (:pep:`587`), added to Python 3.8. " "(Contributed by Victor Stinner in :gh:`105145`.)" msgstr "" +"請改用 :ref:`Python 初始化設定 <init-config>`\\ 的新 :c:type:`PyConfig` API " +"(:pep:`587`),這是在 Python 3.8 中新增的。(由 Victor Stinner 於 :gh:" +"`105145` 貢獻。)" -#: ../../whatsnew/3.13.rst:2368 +#: ../../whatsnew/3.13.rst:2370 msgid "" "Remove :c:func:`!PyEval_AcquireLock` and :c:func:`!PyEval_ReleaseLock` " "functions, deprecated in Python 3.2. They didn't update the current thread " "state. They can be replaced with:" msgstr "" +"移除 :c:func:`!PyEval_AcquireLock` 和 :c:func:`!PyEval_ReleaseLock` 函式,這" +"些函式在 Python 3.2 中已被廢棄。它們不會更新目前的執行緒狀態。可以用以下函式" +"取代:" -#: ../../whatsnew/3.13.rst:2373 +#: ../../whatsnew/3.13.rst:2375 msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`;" msgstr ":c:func:`PyEval_SaveThread` 和 :c:func:`PyEval_RestoreThread`;" -#: ../../whatsnew/3.13.rst:2374 +#: ../../whatsnew/3.13.rst:2376 msgid "" "low-level :c:func:`PyEval_AcquireThread` and :c:func:`PyEval_RestoreThread`;" msgstr "" "低階的 :c:func:`PyEval_AcquireThread` 和 :c:func:`PyEval_RestoreThread`;" -#: ../../whatsnew/3.13.rst:2375 +#: ../../whatsnew/3.13.rst:2377 msgid "or :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`." msgstr "或 :c:func:`PyGILState_Ensure` 與 :c:func:`PyGILState_Release`。" -#: ../../whatsnew/3.13.rst:2377 +#: ../../whatsnew/3.13.rst:2379 msgid "(Contributed by Victor Stinner in :gh:`105182`.)" -msgstr "" +msgstr "(由 Victor Stinner 貢獻於 :gh:`105182`。)" -#: ../../whatsnew/3.13.rst:2379 +#: ../../whatsnew/3.13.rst:2381 msgid "" "Remove the :c:func:`!PyEval_ThreadsInitialized` function, deprecated in " "Python 3.9. Since Python 3.7, :c:func:`!Py_Initialize` always creates the " @@ -4521,7 +4552,7 @@ msgid "" "Stinner in :gh:`105182`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2386 +#: ../../whatsnew/3.13.rst:2388 msgid "" "Remove the :c:func:`!_PyInterpreterState_Get` alias to :c:func:" "`PyInterpreterState_Get()` which was kept for backward compatibility with " @@ -4530,26 +4561,28 @@ msgid "" "Stinner in :gh:`106320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2393 +#: ../../whatsnew/3.13.rst:2395 msgid "" "Remove the private :c:func:`!_PyObject_FastCall` function: use :c:func:`!" "PyObject_Vectorcall` which is available since Python 3.8 (:pep:`590`). " "(Contributed by Victor Stinner in :gh:`106023`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2398 +#: ../../whatsnew/3.13.rst:2400 msgid "" "Remove the ``cpython/pytime.h`` header file, which only contained private " "functions. (Contributed by Victor Stinner in :gh:`106316`.)" msgstr "" +"移除只包含私有函式的 ``cpython/pytime.h`` 標頭檔。(由 Victor Stinner 於 :gh:" +"`106316` 貢獻。)" -#: ../../whatsnew/3.13.rst:2402 +#: ../../whatsnew/3.13.rst:2404 msgid "" "Remove the undocumented ``PY_TIMEOUT_MAX`` constant from the limited C API. " "(Contributed by Victor Stinner in :gh:`110014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2405 +#: ../../whatsnew/3.13.rst:2407 msgid "" "Remove the old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " "``Py_TRASHCAN_SAFE_END``. Replace both with the new macros " @@ -4557,15 +4590,15 @@ msgid "" "in :gh:`105111`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2412 +#: ../../whatsnew/3.13.rst:2414 msgid "Deprecated C APIs" msgstr "器用的 C API" -#: ../../whatsnew/3.13.rst:2414 +#: ../../whatsnew/3.13.rst:2416 msgid "Deprecate old Python initialization functions:" msgstr "" -#: ../../whatsnew/3.13.rst:2416 +#: ../../whatsnew/3.13.rst:2418 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" @@ -4574,30 +4607,30 @@ msgstr "" ":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" "data:`!warnings.filters`。" -#: ../../whatsnew/3.13.rst:2418 +#: ../../whatsnew/3.13.rst:2420 msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" -#: ../../whatsnew/3.13.rst:2420 +#: ../../whatsnew/3.13.rst:2422 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" -#: ../../whatsnew/3.13.rst:2422 +#: ../../whatsnew/3.13.rst:2424 msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" -#: ../../whatsnew/3.13.rst:2424 +#: ../../whatsnew/3.13.rst:2426 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" -#: ../../whatsnew/3.13.rst:2426 +#: ../../whatsnew/3.13.rst:2428 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:23 msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" -#: ../../whatsnew/3.13.rst:2428 +#: ../../whatsnew/3.13.rst:2430 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" ":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" @@ -4606,32 +4639,32 @@ msgstr "" ":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" "`PYTHONHOME` 環境變數。" -#: ../../whatsnew/3.13.rst:2432 +#: ../../whatsnew/3.13.rst:2434 msgid "(Contributed by Victor Stinner in :gh:`105145`.)" -msgstr "" +msgstr "(由 Victor Stinner 在 :gh:`105145` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2434 +#: ../../whatsnew/3.13.rst:2436 msgid "" ":term:`Soft deprecate <soft deprecated>` the :c:func:`PyEval_GetBuiltins`, :" "c:func:`PyEval_GetGlobals`, and :c:func:`PyEval_GetLocals` functions, which " "return a :term:`borrowed reference`. (Soft deprecated as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2440 +#: ../../whatsnew/3.13.rst:2442 msgid "" "Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function, which is just " "an alias to :c:func:`PyImport_ImportModule` since Python 3.3. (Contributed " "by Victor Stinner in :gh:`105396`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2444 +#: ../../whatsnew/3.13.rst:2446 msgid "" ":term:`Soft deprecate <soft deprecated>` the :c:func:`PyModule_AddObject` " "function. It should be replaced with :c:func:`PyModule_Add` or :c:func:" "`PyModule_AddObjectRef`. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2450 +#: ../../whatsnew/3.13.rst:2452 msgid "" "Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types and the :c:" "macro:`!Py_UNICODE_WIDE` define. Use the :c:type:`wchar_t` type directly " @@ -4640,7 +4673,7 @@ msgid "" "`105156`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2457 +#: ../../whatsnew/3.13.rst:2459 msgid "" "Deprecate the :c:func:`PyWeakref_GetObject` and :c:func:" "`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed reference`. " @@ -5017,56 +5050,56 @@ msgstr "" msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.13.rst:2477 +#: ../../whatsnew/3.13.rst:2479 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.13.rst:2479 +#: ../../whatsnew/3.13.rst:2481 msgid "" "``arm64-apple-ios`` and ``arm64-apple-ios-simulator`` are both now :pep:`11` " "tier 3 platforms. (:ref:`PEP 730 <whatsnew313-platform-support>` written and " "implementation contributed by Russell Keith-Magee in :gh:`114099`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2484 +#: ../../whatsnew/3.13.rst:2486 msgid "" "``aarch64-linux-android`` and ``x86_64-linux-android`` are both now :pep:" "`11` tier 3 platforms. (:ref:`PEP 738 <whatsnew313-platform-support>` " "written and implementation contributed by Malcolm Smith in :gh:`116622`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2489 +#: ../../whatsnew/3.13.rst:2491 msgid "" "``wasm32-wasi`` is now a :pep:`11` tier 2 platform. (Contributed by Brett " "Cannon in :gh:`115192`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2492 +#: ../../whatsnew/3.13.rst:2494 msgid "" "``wasm32-emscripten`` is no longer a :pep:`11` supported platform. " "(Contributed by Brett Cannon in :gh:`115192`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2495 +#: ../../whatsnew/3.13.rst:2497 msgid "" "Building CPython now requires a compiler with support for the C11 atomic " "library, GCC built-in atomic functions, or MSVC interlocked intrinsics." msgstr "" -#: ../../whatsnew/3.13.rst:2498 +#: ../../whatsnew/3.13.rst:2500 msgid "" "Autoconf 2.71 and aclocal 1.16.5 are now required to regenerate the :file:" "`configure` script. (Contributed by Christian Heimes in :gh:`89886` and by " "Victor Stinner in :gh:`112090`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2502 +#: ../../whatsnew/3.13.rst:2504 msgid "" "SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension " "module. (Contributed by Erlend Aasland in :gh:`105875`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2506 +#: ../../whatsnew/3.13.rst:2508 msgid "" "CPython now bundles the `mimalloc library`_ by default. It is licensed under " "the MIT license; see :ref:`mimalloc license <mimalloc-license>`. The bundled " @@ -5074,28 +5107,28 @@ msgid "" "Dino Viehland in :gh:`109914`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2514 +#: ../../whatsnew/3.13.rst:2516 msgid "" "The :file:`configure` option :option:`--with-system-libmpdec` now defaults " "to ``yes``. The bundled copy of ``libmpdecimal`` will be removed in Python " "3.15." msgstr "" -#: ../../whatsnew/3.13.rst:2518 +#: ../../whatsnew/3.13.rst:2520 msgid "" "Python built with :file:`configure` :option:`--with-trace-refs` (tracing " "references) is now ABI compatible with the Python release build and :ref:" "`debug build <debug-build>`. (Contributed by Victor Stinner in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2523 +#: ../../whatsnew/3.13.rst:2525 msgid "" "On POSIX systems, the pkg-config (``.pc``) filenames now include the ABI " "flags. For example, the free-threaded build generates ``python-3.13t.pc`` " "and the debug build generates ``python-3.13d.pc``." msgstr "" -#: ../../whatsnew/3.13.rst:2527 +#: ../../whatsnew/3.13.rst:2529 msgid "" "The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``, " "``termios``, ``winsound``, ``_ctypes_test``, ``_multiprocessing." @@ -5105,27 +5138,27 @@ msgid "" "`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2536 +#: ../../whatsnew/3.13.rst:2538 msgid "Porting to Python 3.13" msgstr "移植至 Python 3.13" -#: ../../whatsnew/3.13.rst:2538 +#: ../../whatsnew/3.13.rst:2540 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.13.rst:2542 +#: ../../whatsnew/3.13.rst:2544 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.13.rst:2546 +#: ../../whatsnew/3.13.rst:2548 msgid "" ":ref:`PEP 667 <whatsnew313-locals-semantics>` introduces several changes to " "the semantics of :func:`locals` and :attr:`f_locals <frame.f_locals>`:" msgstr "" -#: ../../whatsnew/3.13.rst:2549 +#: ../../whatsnew/3.13.rst:2551 msgid "" "Calling :func:`locals` in an :term:`optimized scope` now produces an " "independent snapshot on each call, and hence no longer implicitly updates " @@ -5137,7 +5170,7 @@ msgid "" "scope. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2558 +#: ../../whatsnew/3.13.rst:2560 msgid "" "Calling :func:`locals` from a comprehension at module or class scope " "(including via ``exec`` or ``eval``) once more behaves as if the " @@ -5147,7 +5180,7 @@ msgid "" "implementing :pep:`709`. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2565 +#: ../../whatsnew/3.13.rst:2567 msgid "" "Accessing :attr:`FrameType.f_locals <frame.f_locals>` in an :term:`optimized " "scope` now returns a write-through proxy rather than a snapshot that gets " @@ -5156,7 +5189,7 @@ msgid "" "of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2571 +#: ../../whatsnew/3.13.rst:2573 msgid "" ":class:`functools.partial` now emits a :exc:`FutureWarning` when used as a " "method. The behavior will change in future Python versions. Wrap it in :func:" @@ -5164,14 +5197,14 @@ msgid "" "Serhiy Storchaka in :gh:`121027`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2577 +#: ../../whatsnew/3.13.rst:2579 msgid "" "An :exc:`OSError` is now raised by :func:`getpass.getuser` for any failure " "to retrieve a username, instead of :exc:`ImportError` on non-Unix platforms " "or :exc:`KeyError` on Unix platforms where the password database is empty." msgstr "" -#: ../../whatsnew/3.13.rst:2582 +#: ../../whatsnew/3.13.rst:2584 msgid "" "The value of the :attr:`!mode` attribute of :class:`gzip.GzipFile` is now a " "string (``'rb'`` or ``'wb'``) instead of an integer (``1`` or ``2``). The " @@ -5180,13 +5213,13 @@ msgid "" "(Contributed by Serhiy Storchaka in :gh:`115961`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2588 +#: ../../whatsnew/3.13.rst:2590 msgid "" ":class:`mailbox.Maildir` now ignores files with a leading dot (``.``). " "(Contributed by Zackery Spytz in :gh:`65559`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2591 +#: ../../whatsnew/3.13.rst:2593 msgid "" ":meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` now return both " "files and directories if a pattern that ends with \"``**``\" is given, " @@ -5194,25 +5227,25 @@ msgid "" "behavior and only match directories." msgstr "" -#: ../../whatsnew/3.13.rst:2596 +#: ../../whatsnew/3.13.rst:2598 msgid "" "The :mod:`threading` module now expects the :mod:`!_thread` module to have " "an :func:`!_is_main_interpreter` function. This function takes no arguments " "and returns ``True`` if the current interpreter is the main interpreter." msgstr "" -#: ../../whatsnew/3.13.rst:2601 +#: ../../whatsnew/3.13.rst:2603 msgid "" "Any library or application that provides a custom :mod:`!_thread` module " "must provide :func:`!_is_main_interpreter`, just like the module's other " "\"private\" attributes. (:gh:`112826`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2608 +#: ../../whatsnew/3.13.rst:2610 msgid "Changes in the C API" msgstr "C API 中的改動" -#: ../../whatsnew/3.13.rst:2610 +#: ../../whatsnew/3.13.rst:2612 msgid "" "``Python.h`` no longer includes the ``<ieeefp.h>`` standard header. It was " "included for the :c:func:`!finite` function which is now provided by the " @@ -5221,7 +5254,7 @@ msgid "" "`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2616 +#: ../../whatsnew/3.13.rst:2618 msgid "" "``Python.h`` no longer includes these standard header files: ``<time.h>``, " "``<sys/select.h>`` and ``<sys/time.h>``. If needed, they should now be " @@ -5232,7 +5265,7 @@ msgid "" "Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2624 +#: ../../whatsnew/3.13.rst:2626 msgid "" "On Windows, ``Python.h`` no longer includes the ``<stddef.h>`` standard " "header file. If needed, it should now be included explicitly. For example, " @@ -5242,7 +5275,7 @@ msgid "" "(Contributed by Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2631 +#: ../../whatsnew/3.13.rst:2633 msgid "" "If the :c:macro:`Py_LIMITED_API` macro is defined, :c:macro:`!" "Py_BUILD_CORE`, :c:macro:`!Py_BUILD_CORE_BUILTIN` and :c:macro:`!" @@ -5250,18 +5283,18 @@ msgid "" "(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2636 +#: ../../whatsnew/3.13.rst:2638 msgid "" "The old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " "``Py_TRASHCAN_SAFE_END`` were removed. They should be replaced by the new " "macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``." msgstr "" -#: ../../whatsnew/3.13.rst:2640 +#: ../../whatsnew/3.13.rst:2642 msgid "A ``tp_dealloc`` function that has the old macros, such as::" -msgstr "" +msgstr "有舊巨集的 ``tp_dealloc`` 函式,例如: ::" -#: ../../whatsnew/3.13.rst:2642 +#: ../../whatsnew/3.13.rst:2644 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -5281,11 +5314,11 @@ msgstr "" " Py_TRASHCAN_SAFE_END\n" "}" -#: ../../whatsnew/3.13.rst:2651 +#: ../../whatsnew/3.13.rst:2653 msgid "should migrate to the new macros as follows::" -msgstr "" +msgstr "應該改為使用新的巨集,如下所示: ::" -#: ../../whatsnew/3.13.rst:2653 +#: ../../whatsnew/3.13.rst:2655 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -5305,7 +5338,7 @@ msgstr "" " Py_TRASHCAN_END\n" "}" -#: ../../whatsnew/3.13.rst:2662 +#: ../../whatsnew/3.13.rst:2664 msgid "" "Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " "deallocation function it is in. The new macros were added in Python 3.8 and " @@ -5313,13 +5346,13 @@ msgid "" "in :gh:`105111`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2669 +#: ../../whatsnew/3.13.rst:2671 msgid "" ":ref:`PEP 667 <whatsnew313-locals-semantics>` introduces several changes to " "frame-related functions:" msgstr "" -#: ../../whatsnew/3.13.rst:2672 +#: ../../whatsnew/3.13.rst:2674 msgid "" "The effects of mutating the dictionary returned from :c:func:" "`PyEval_GetLocals` in an :term:`optimized scope` have changed. New dict " @@ -5333,7 +5366,7 @@ msgid "" "being used, so refer to the deprecation notice on the function for details." msgstr "" -#: ../../whatsnew/3.13.rst:2685 +#: ../../whatsnew/3.13.rst:2687 msgid "" "Calling :c:func:`PyFrame_GetLocals` in an :term:`optimized scope` now " "returns a write-through proxy rather than a snapshot that gets updated at " @@ -5342,25 +5375,25 @@ msgid "" "`PyEval_GetFrameLocals` API." msgstr "" -#: ../../whatsnew/3.13.rst:2692 +#: ../../whatsnew/3.13.rst:2694 msgid "" ":c:func:`!PyFrame_FastToLocals` and :c:func:`!PyFrame_FastToLocalsWithError` " "no longer have any effect. Calling these functions has been redundant since " "Python 3.11, when :c:func:`PyFrame_GetLocals` was first introduced." msgstr "" -#: ../../whatsnew/3.13.rst:2697 +#: ../../whatsnew/3.13.rst:2699 msgid "" ":c:func:`!PyFrame_LocalsToFast` no longer has any effect. Calling this " "function is redundant now that :c:func:`PyFrame_GetLocals` returns a write-" "through proxy for :term:`optimized scopes <optimized scope>`." msgstr "" -#: ../../whatsnew/3.13.rst:2702 +#: ../../whatsnew/3.13.rst:2704 msgid "Regression Test Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2704 +#: ../../whatsnew/3.13.rst:2706 msgid "" "Python built with :file:`configure` :option:`--with-pydebug` now supports a :" "option:`-X presite=package.module <-X>` command-line option. If used, it " @@ -5369,9 +5402,13 @@ msgid "" "in :gh:`110769`.)" msgstr "" -#~ msgid "" -#~ "date and datetime adapter, date and timestamp converter: see the :mod:" -#~ "`sqlite3` documentation for suggested replacement recipes." -#~ msgstr "" -#~ "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 " -#~ "(converter):請參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" +#: ../../whatsnew/3.13.rst:2714 +msgid "Notable changes in 3.13.1" +msgstr "Python 3.13.1 中顯著的變更" + +#: ../../whatsnew/3.13.rst:2719 +msgid "" +"The previously undocumented special function :func:`sys.getobjects`, which " +"only exists in specialized builds of Python, may now return objects from " +"other interpreters than the one it's called in." +msgstr "" diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index 511a0066bc..d928fca84e 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2024-11-26 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2828,7 +2828,7 @@ msgstr "" #: ../../whatsnew/3.4.rst:1982 msgid "" -"A new opcode, :opcode:`LOAD_CLASSDEREF`, has been added to fix a bug in the " +"A new opcode, :opcode:`!LOAD_CLASSDEREF`, has been added to fix a bug in the " "loading of free variables in class bodies that could be triggered by certain " "uses of :ref:`__prepare__ <prepare>`. (Contributed by Benjamin Peterson in :" "issue:`17853`.)" diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index 53d989f8b5..b63071a79e 100644 --- a/whatsnew/3.6.po +++ b/whatsnew/3.6.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-11-26 00:14+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -3465,8 +3465,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:2369 msgid "" -"The new :opcode:`FORMAT_VALUE` and :opcode:`BUILD_STRING` opcodes as part of " -"the :ref:`formatted string literal <whatsnew36-pep498>` implementation. " +"The new :opcode:`!FORMAT_VALUE` and :opcode:`BUILD_STRING` opcodes as part " +"of the :ref:`formatted string literal <whatsnew36-pep498>` implementation. " "(Contributed by Eric Smith in :issue:`25483` and Serhiy Storchaka in :issue:" "`27078`.)" msgstr "" @@ -3481,10 +3481,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:2378 msgid "" "The function call opcodes have been heavily reworked for better performance " -"and simpler implementation. The :opcode:`MAKE_FUNCTION`, :opcode:" -"`CALL_FUNCTION`, :opcode:`CALL_FUNCTION_KW` and :opcode:" -"`BUILD_MAP_UNPACK_WITH_CALL` opcodes have been modified, the new :opcode:" -"`CALL_FUNCTION_EX` and :opcode:`BUILD_TUPLE_UNPACK_WITH_CALL` have been " +"and simpler implementation. The :opcode:`MAKE_FUNCTION`, :opcode:`!" +"CALL_FUNCTION`, :opcode:`!CALL_FUNCTION_KW` and :opcode:`!" +"BUILD_MAP_UNPACK_WITH_CALL` opcodes have been modified, the new :opcode:" +"`CALL_FUNCTION_EX` and :opcode:`!BUILD_TUPLE_UNPACK_WITH_CALL` have been " "added, and ``CALL_FUNCTION_VAR``, ``CALL_FUNCTION_VAR_KW`` and " "``MAKE_CLOSURE`` opcodes have been removed. (Contributed by Demur Rumed in :" "issue:`27095`, and Serhiy Storchaka in :issue:`27213`, :issue:`28257`.)" @@ -3492,7 +3492,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:2389 msgid "" -"The new :opcode:`SETUP_ANNOTATIONS` and :opcode:`STORE_ANNOTATION` opcodes " +"The new :opcode:`SETUP_ANNOTATIONS` and :opcode:`!STORE_ANNOTATION` opcodes " "have been added to support the new :term:`variable annotation` syntax. " "(Contributed by Ivan Levkivskyi in :issue:`27985`.)" msgstr "" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index a02c86b5b8..6e6f30678a 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-11-26 00:14+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -3546,14 +3546,14 @@ msgstr "CPython 位元組碼變更" #: ../../whatsnew/3.7.rst:2479 msgid "" -"There are two new opcodes: :opcode:`LOAD_METHOD` and :opcode:`CALL_METHOD`. " +"There are two new opcodes: :opcode:`LOAD_METHOD` and :opcode:`!CALL_METHOD`. " "(Contributed by Yury Selivanov and INADA Naoki in :issue:`26110`.)" msgstr "" #: ../../whatsnew/3.7.rst:2482 msgid "" -"The :opcode:`STORE_ANNOTATION` opcode has been removed. (Contributed by Mark " -"Shannon in :issue:`32550`.)" +"The :opcode:`!STORE_ANNOTATION` opcode has been removed. (Contributed by " +"Mark Shannon in :issue:`32550`.)" msgstr "" #: ../../whatsnew/3.7.rst:2489 diff --git a/whatsnew/3.8.po b/whatsnew/3.8.po index ca437cad1c..a537637276 100644 --- a/whatsnew/3.8.po +++ b/whatsnew/3.8.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-11-26 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1528,7 +1528,7 @@ msgstr "logging" #: ../../whatsnew/3.8.rst:939 msgid "" -"Added a *force* keyword argument to :func:`logging.basicConfig` When set to " +"Added a *force* keyword argument to :func:`logging.basicConfig`. When set to " "true, any existing handlers attached to the root logger are removed and " "closed before carrying out the configuration specified by the other " "arguments." @@ -3348,11 +3348,11 @@ msgstr "" #: ../../whatsnew/3.8.rst:2155 msgid "" -"Removed opcodes :opcode:`BREAK_LOOP`, :opcode:`CONTINUE_LOOP`, :opcode:" -"`SETUP_LOOP` and :opcode:`SETUP_EXCEPT`. Added new opcodes :opcode:" -"`ROT_FOUR`, :opcode:`BEGIN_FINALLY`, :opcode:`CALL_FINALLY` and :opcode:" -"`POP_FINALLY`. Changed the behavior of :opcode:`END_FINALLY` and :opcode:" -"`WITH_CLEANUP_START`." +"Removed opcodes :opcode:`!BREAK_LOOP`, :opcode:`!CONTINUE_LOOP`, :opcode:`!" +"SETUP_LOOP` and :opcode:`!SETUP_EXCEPT`. Added new opcodes :opcode:`!" +"ROT_FOUR`, :opcode:`!BEGIN_FINALLY`, :opcode:`!CALL_FINALLY` and :opcode:`!" +"POP_FINALLY`. Changed the behavior of :opcode:`!END_FINALLY` and :opcode:`!" +"WITH_CLEANUP_START`." msgstr "" #: ../../whatsnew/3.8.rst:2161 From 85fadd958e1da01602740fbabec024abab37e15c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 1 Dec 2024 23:00:26 +0800 Subject: [PATCH 58/89] build(deps): bump JamesIves/github-pages-deploy-action from 4.6.8 to 4.7.1 (#1003) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/deploy-gh-page.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-gh-page.yml b/.github/workflows/deploy-gh-page.yml index f1fad14f30..ed99a444c7 100644 --- a/.github/workflows/deploy-gh-page.yml +++ b/.github/workflows/deploy-gh-page.yml @@ -18,7 +18,7 @@ jobs: run: JOBS=4 MODE=html make all - name: Deploy to gh page - uses: JamesIves/github-pages-deploy-action@v4.6.8 + uses: JamesIves/github-pages-deploy-action@v4.7.1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BRANCH: gh-pages From c4c0d587365c87623e027809ce8c1b0d5eeac64b Mon Sep 17 00:00:00 2001 From: "pydoc-zh-tw[bot]" <90344106+pydoc-zh-tw[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2024 02:06:26 +0800 Subject: [PATCH 59/89] Sync with CPython 3.13 (#1002) --- c-api/frame.po | 43 ++- c-api/init.po | 719 +++++++++++++++++++------------------ c-api/init_config.po | 227 ++++++------ c-api/object.po | 33 +- c-api/stable.po | 74 ++-- c-api/sys.po | 6 +- c-api/type.po | 10 +- howto/gdb_helpers.po | 18 +- library/ast.po | 10 +- library/collections.po | 21 +- library/dis.po | 313 ++++++++-------- library/http.cookies.po | 8 +- library/itertools.po | 16 +- library/string.po | 299 ++++++++------- library/token.po | 18 +- library/traceback.po | 171 ++++----- library/xmlrpc.po | 10 +- reference/simple_stmts.po | 113 +++--- tutorial/datastructures.po | 98 ++++- using/ios.po | 108 +++++- whatsnew/2.6.po | 433 ++++++++++++++++++++-- whatsnew/2.7.po | 160 ++++++++- whatsnew/3.0.po | 184 +++++----- whatsnew/3.12.po | 2 +- whatsnew/3.13.po | 2 +- whatsnew/3.6.po | 4 +- whatsnew/3.7.po | 2 +- 27 files changed, 1955 insertions(+), 1147 deletions(-) diff --git a/c-api/frame.po b/c-api/frame.po index 1616a3cc27..da34208fb5 100644 --- a/c-api/frame.po +++ b/c-api/frame.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-12-12 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -154,34 +154,61 @@ msgid "" msgstr "" #: ../../c-api/frame.rst:134 -msgid "As part of :pep:`667`, return a proxy object for optimized scopes." +msgid "" +"As part of :pep:`667`, return an instance of :c:var:" +"`PyFrameLocalsProxy_Type`." msgstr "" #: ../../c-api/frame.rst:140 msgid "Return the line number that *frame* is currently executing." msgstr "" -#: ../../c-api/frame.rst:145 +#: ../../c-api/frame.rst:144 +msgid "Frame Locals Proxies" +msgstr "" + +#: ../../c-api/frame.rst:148 +msgid "" +"The :attr:`~frame.f_locals` attribute on a :ref:`frame object <frame-" +"objects>` is an instance of a \"frame-locals proxy\". The proxy object " +"exposes a write-through view of the underlying locals dictionary for the " +"frame. This ensures that the variables exposed by ``f_locals`` are always up " +"to date with the live local variables in the frame itself." +msgstr "" + +#: ../../c-api/frame.rst:154 +msgid "See :pep:`667` for more information." +msgstr "" + +#: ../../c-api/frame.rst:158 +msgid "The type of frame :func:`locals` proxy objects." +msgstr "" + +#: ../../c-api/frame.rst:162 +msgid "Return non-zero if *obj* is a frame :func:`locals` proxy." +msgstr "" + +#: ../../c-api/frame.rst:165 msgid "Internal Frames" msgstr "" -#: ../../c-api/frame.rst:147 +#: ../../c-api/frame.rst:167 msgid "Unless using :pep:`523`, you will not need this." msgstr "" -#: ../../c-api/frame.rst:151 +#: ../../c-api/frame.rst:171 msgid "The interpreter's internal frame representation." msgstr "" -#: ../../c-api/frame.rst:157 +#: ../../c-api/frame.rst:177 msgid "Return a :term:`strong reference` to the code object for the frame." msgstr "" -#: ../../c-api/frame.rst:164 +#: ../../c-api/frame.rst:184 msgid "Return the byte offset into the last executed instruction." msgstr "" -#: ../../c-api/frame.rst:171 +#: ../../c-api/frame.rst:191 msgid "" "Return the currently executing line number, or -1 if there is no line number." msgstr "" diff --git a/c-api/init.po b/c-api/init.po index 5809d4bf46..e1c8407423 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-25 00:14+0000\n" +"POT-Creation-Date: 2024-12-12 00:15+0000\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -814,17 +814,28 @@ msgid "" msgstr "" #: ../../c-api/init.rst:562 +msgid "" +"Register an :mod:`atexit` callback for the target interpreter *interp*. This " +"is similar to :c:func:`Py_AtExit`, but takes an explicit interpreter and " +"data pointer for the callback." +msgstr "" + +#: ../../c-api/init.rst:566 +msgid "The :term:`GIL` must be held for *interp*." +msgstr "" + +#: ../../c-api/init.rst:571 msgid "Process-wide parameters" msgstr "" -#: ../../c-api/init.rst:572 +#: ../../c-api/init.rst:581 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "program_name` should be used instead, see :ref:`Python Initialization " "Configuration <init-config>`." msgstr "" -#: ../../c-api/init.rst:576 +#: ../../c-api/init.rst:585 msgid "" "This function should be called before :c:func:`Py_Initialize` is called for " "the first time, if it is called at all. It tells the interpreter the value " @@ -838,37 +849,37 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:587 ../../c-api/init.rst:829 ../../c-api/init.rst:865 -#: ../../c-api/init.rst:891 +#: ../../c-api/init.rst:596 ../../c-api/init.rst:838 ../../c-api/init.rst:874 +#: ../../c-api/init.rst:900 msgid "" "Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" "`wchar_*` string." msgstr "" -#: ../../c-api/init.rst:595 +#: ../../c-api/init.rst:604 msgid "" "Return the program name set with :c:member:`PyConfig.program_name`, or the " "default. The returned string points into static storage; the caller should " "not modify its value." msgstr "" -#: ../../c-api/init.rst:599 ../../c-api/init.rst:621 ../../c-api/init.rst:667 -#: ../../c-api/init.rst:689 ../../c-api/init.rst:715 ../../c-api/init.rst:903 +#: ../../c-api/init.rst:608 ../../c-api/init.rst:630 ../../c-api/init.rst:676 +#: ../../c-api/init.rst:698 ../../c-api/init.rst:724 ../../c-api/init.rst:912 msgid "" "This function should not be called before :c:func:`Py_Initialize`, otherwise " "it returns ``NULL``." msgstr "此函式不應該在 :c:func:`Py_Initialize` 之前呼叫,否則會回傳 ``NULL``。" -#: ../../c-api/init.rst:602 ../../c-api/init.rst:624 ../../c-api/init.rst:670 -#: ../../c-api/init.rst:692 ../../c-api/init.rst:720 ../../c-api/init.rst:906 +#: ../../c-api/init.rst:611 ../../c-api/init.rst:633 ../../c-api/init.rst:679 +#: ../../c-api/init.rst:701 ../../c-api/init.rst:729 ../../c-api/init.rst:915 msgid "It now returns ``NULL`` if called before :c:func:`Py_Initialize`." msgstr "如果在 :c:func:`Py_Initialize` 之前呼叫,現在會回傳 ``NULL``。" -#: ../../c-api/init.rst:605 ../../c-api/init.rst:695 +#: ../../c-api/init.rst:614 ../../c-api/init.rst:704 msgid "Get :data:`sys.executable` instead." msgstr "" -#: ../../c-api/init.rst:611 +#: ../../c-api/init.rst:620 msgid "" "Return the *prefix* for installed platform-independent files. This is " "derived through a number of complicated rules from the program name set " @@ -882,13 +893,13 @@ msgid "" "See also the next function." msgstr "" -#: ../../c-api/init.rst:627 +#: ../../c-api/init.rst:636 msgid "" "Get :data:`sys.base_prefix` instead, or :data:`sys.prefix` if :ref:`virtual " "environments <venv-def>` need to be handled." msgstr "" -#: ../../c-api/init.rst:634 +#: ../../c-api/init.rst:643 msgid "" "Return the *exec-prefix* for installed platform-*dependent* files. This is " "derived through a number of complicated rules from the program name set " @@ -902,7 +913,7 @@ msgid "" "useful on Unix." msgstr "" -#: ../../c-api/init.rst:645 +#: ../../c-api/init.rst:654 msgid "" "Background: The exec-prefix differs from the prefix when platform dependent " "files (such as executables and shared libraries) are installed in a " @@ -911,7 +922,7 @@ msgid "" "independent may be installed in :file:`/usr/local`." msgstr "" -#: ../../c-api/init.rst:651 +#: ../../c-api/init.rst:660 msgid "" "Generally speaking, a platform is a combination of hardware and software " "families, e.g. Sparc machines running the Solaris 2.x operating system are " @@ -925,7 +936,7 @@ msgid "" "independent from the Python version by which they were compiled!)." msgstr "" -#: ../../c-api/init.rst:662 +#: ../../c-api/init.rst:671 msgid "" "System administrators will know how to configure the :program:`mount` or :" "program:`automount` programs to share :file:`/usr/local` between platforms " @@ -933,13 +944,13 @@ msgid "" "platform." msgstr "" -#: ../../c-api/init.rst:673 +#: ../../c-api/init.rst:682 msgid "" "Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` if :ref:" "`virtual environments <venv-def>` need to be handled." msgstr "" -#: ../../c-api/init.rst:683 +#: ../../c-api/init.rst:692 msgid "" "Return the full program name of the Python executable; this is computed as " "a side-effect of deriving the default module search path from the program " @@ -948,7 +959,7 @@ msgid "" "available to Python code as ``sys.executable``." msgstr "" -#: ../../c-api/init.rst:705 +#: ../../c-api/init.rst:714 msgid "" "Return the default module search path; this is computed from the program " "name (set by :c:member:`PyConfig.program_name`) and some environment " @@ -961,21 +972,21 @@ msgid "" "for loading modules." msgstr "" -#: ../../c-api/init.rst:723 +#: ../../c-api/init.rst:732 msgid "Get :data:`sys.path` instead." msgstr "" -#: ../../c-api/init.rst:729 +#: ../../c-api/init.rst:738 msgid "" "Return the version of this Python interpreter. This is a string that looks " "something like ::" msgstr "" -#: ../../c-api/init.rst:732 +#: ../../c-api/init.rst:741 msgid "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" msgstr "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" -#: ../../c-api/init.rst:736 +#: ../../c-api/init.rst:745 msgid "" "The first word (up to the first space character) is the current Python " "version; the first characters are the major and minor version separated by a " @@ -984,11 +995,11 @@ msgid "" "version`." msgstr "" -#: ../../c-api/init.rst:741 +#: ../../c-api/init.rst:750 msgid "See also the :c:var:`Py_Version` constant." msgstr "" -#: ../../c-api/init.rst:748 +#: ../../c-api/init.rst:757 msgid "" "Return the platform identifier for the current platform. On Unix, this is " "formed from the \"official\" name of the operating system, converted to " @@ -999,50 +1010,50 @@ msgid "" "available to Python code as ``sys.platform``." msgstr "" -#: ../../c-api/init.rst:759 +#: ../../c-api/init.rst:768 msgid "" "Return the official copyright string for the current Python version, for " "example" msgstr "" -#: ../../c-api/init.rst:761 +#: ../../c-api/init.rst:770 msgid "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" msgstr "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" -#: ../../c-api/init.rst:765 +#: ../../c-api/init.rst:774 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as ``sys.copyright``." msgstr "" -#: ../../c-api/init.rst:771 +#: ../../c-api/init.rst:780 msgid "" "Return an indication of the compiler used to build the current Python " "version, in square brackets, for example::" msgstr "" -#: ../../c-api/init.rst:774 +#: ../../c-api/init.rst:783 msgid "\"[GCC 2.7.2.2]\"" msgstr "\"[GCC 2.7.2.2]\"" -#: ../../c-api/init.rst:778 ../../c-api/init.rst:792 +#: ../../c-api/init.rst:787 ../../c-api/init.rst:801 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as part of the variable " "``sys.version``." msgstr "" -#: ../../c-api/init.rst:785 +#: ../../c-api/init.rst:794 msgid "" "Return information about the sequence number and build date and time of the " "current Python interpreter instance, for example ::" msgstr "" -#: ../../c-api/init.rst:788 +#: ../../c-api/init.rst:797 msgid "\"#67, Aug 1 1997, 22:34:28\"" msgstr "\"#67, Aug 1 1997, 22:34:28\"" -#: ../../c-api/init.rst:804 +#: ../../c-api/init.rst:813 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` " @@ -1050,7 +1061,7 @@ msgid "" "config>`." msgstr "" -#: ../../c-api/init.rst:809 +#: ../../c-api/init.rst:818 msgid "" "Set :data:`sys.argv` based on *argc* and *argv*. These parameters are " "similar to those passed to the program's :c:func:`main` function with the " @@ -1061,84 +1072,84 @@ msgid "" "fatal condition is signalled using :c:func:`Py_FatalError`." msgstr "" -#: ../../c-api/init.rst:817 +#: ../../c-api/init.rst:826 msgid "" "If *updatepath* is zero, this is all the function does. If *updatepath* is " "non-zero, the function also modifies :data:`sys.path` according to the " "following algorithm:" msgstr "" -#: ../../c-api/init.rst:821 +#: ../../c-api/init.rst:830 msgid "" "If the name of an existing script is passed in ``argv[0]``, the absolute " "path of the directory where the script is located is prepended to :data:`sys." "path`." msgstr "" -#: ../../c-api/init.rst:824 +#: ../../c-api/init.rst:833 msgid "" "Otherwise (that is, if *argc* is ``0`` or ``argv[0]`` doesn't point to an " "existing file name), an empty string is prepended to :data:`sys.path`, which " "is the same as prepending the current working directory (``\".\"``)." msgstr "" -#: ../../c-api/init.rst:832 ../../c-api/init.rst:868 +#: ../../c-api/init.rst:841 ../../c-api/init.rst:877 msgid "" "See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv` " "members of the :ref:`Python Initialization Configuration <init-config>`." msgstr "" -#: ../../c-api/init.rst:836 +#: ../../c-api/init.rst:845 msgid "" "It is recommended that applications embedding the Python interpreter for " "purposes other than executing a single script pass ``0`` as *updatepath*, " "and update :data:`sys.path` themselves if desired. See :cve:`2008-5983`." msgstr "" -#: ../../c-api/init.rst:841 +#: ../../c-api/init.rst:850 msgid "" "On versions before 3.1.3, you can achieve the same effect by manually " "popping the first :data:`sys.path` element after having called :c:func:" "`PySys_SetArgv`, for example using::" msgstr "" -#: ../../c-api/init.rst:845 +#: ../../c-api/init.rst:854 msgid "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" msgstr "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" -#: ../../c-api/init.rst:857 +#: ../../c-api/init.rst:866 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv` and :c:member:`PyConfig.parse_argv` should be used instead, see :ref:" "`Python Initialization Configuration <init-config>`." msgstr "" -#: ../../c-api/init.rst:861 +#: ../../c-api/init.rst:870 msgid "" "This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to " "``1`` unless the :program:`python` interpreter was started with the :option:" "`-I`." msgstr "" -#: ../../c-api/init.rst:871 +#: ../../c-api/init.rst:880 msgid "The *updatepath* value depends on :option:`-I`." msgstr "" -#: ../../c-api/init.rst:878 +#: ../../c-api/init.rst:887 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "home` should be used instead, see :ref:`Python Initialization Configuration " "<init-config>`." msgstr "" -#: ../../c-api/init.rst:882 +#: ../../c-api/init.rst:891 msgid "" "Set the default \"home\" directory, that is, the location of the standard " "Python libraries. See :envvar:`PYTHONHOME` for the meaning of the argument " "string." msgstr "" -#: ../../c-api/init.rst:886 +#: ../../c-api/init.rst:895 msgid "" "The argument should point to a zero-terminated character string in static " "storage whose contents will not change for the duration of the program's " @@ -1146,24 +1157,24 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:899 +#: ../../c-api/init.rst:908 msgid "" "Return the default \"home\", that is, the value set by :c:member:`PyConfig." "home`, or the value of the :envvar:`PYTHONHOME` environment variable if it " "is set." msgstr "" -#: ../../c-api/init.rst:909 +#: ../../c-api/init.rst:918 msgid "" "Get :c:member:`PyConfig.home` or :envvar:`PYTHONHOME` environment variable " "instead." msgstr "改為取得 :c:member:`PyConfig.home` 或 :envvar:`PYTHONHOME` 環境變數。" -#: ../../c-api/init.rst:917 +#: ../../c-api/init.rst:926 msgid "Thread State and the Global Interpreter Lock" msgstr "" -#: ../../c-api/init.rst:924 +#: ../../c-api/init.rst:933 msgid "" "The Python interpreter is not fully thread-safe. In order to support multi-" "threaded Python programs, there's a global lock, called the :term:`global " @@ -1175,7 +1186,7 @@ msgid "" "once instead of twice." msgstr "" -#: ../../c-api/init.rst:934 +#: ../../c-api/init.rst:943 msgid "" "Therefore, the rule exists that only the thread that has acquired the :term:" "`GIL` may operate on Python objects or call Python/C API functions. In order " @@ -1185,7 +1196,7 @@ msgid "" "a file, so that other Python threads can run in the meantime." msgstr "" -#: ../../c-api/init.rst:944 +#: ../../c-api/init.rst:953 msgid "" "The Python interpreter keeps some thread-specific bookkeeping information " "inside a data structure called :c:type:`PyThreadState`. There's also one " @@ -1193,17 +1204,17 @@ msgid "" "retrieved using :c:func:`PyThreadState_Get`." msgstr "" -#: ../../c-api/init.rst:950 +#: ../../c-api/init.rst:959 msgid "Releasing the GIL from extension code" msgstr "" -#: ../../c-api/init.rst:952 +#: ../../c-api/init.rst:961 msgid "" "Most extension code manipulating the :term:`GIL` has the following simple " "structure::" msgstr "" -#: ../../c-api/init.rst:955 +#: ../../c-api/init.rst:964 msgid "" "Save the thread state in a local variable.\n" "Release the global interpreter lock.\n" @@ -1212,29 +1223,29 @@ msgid "" "Restore the thread state from the local variable." msgstr "" -#: ../../c-api/init.rst:961 +#: ../../c-api/init.rst:970 msgid "This is so common that a pair of macros exists to simplify it::" msgstr "" -#: ../../c-api/init.rst:963 +#: ../../c-api/init.rst:972 msgid "" "Py_BEGIN_ALLOW_THREADS\n" "... Do some blocking I/O operation ...\n" "Py_END_ALLOW_THREADS" msgstr "" -#: ../../c-api/init.rst:971 +#: ../../c-api/init.rst:980 msgid "" "The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a " "hidden local variable; the :c:macro:`Py_END_ALLOW_THREADS` macro closes the " "block." msgstr "" -#: ../../c-api/init.rst:975 +#: ../../c-api/init.rst:984 msgid "The block above expands to the following code::" msgstr "" -#: ../../c-api/init.rst:977 +#: ../../c-api/init.rst:986 msgid "" "PyThreadState *_save;\n" "\n" @@ -1243,7 +1254,7 @@ msgid "" "PyEval_RestoreThread(_save);" msgstr "" -#: ../../c-api/init.rst:987 +#: ../../c-api/init.rst:996 msgid "" "Here is how these functions work: the global interpreter lock is used to " "protect the pointer to the current thread state. When releasing the lock " @@ -1254,7 +1265,7 @@ msgid "" "state, the lock must be acquired before storing the thread state pointer." msgstr "" -#: ../../c-api/init.rst:996 +#: ../../c-api/init.rst:1005 msgid "" "Calling system I/O functions is the most common use case for releasing the " "GIL, but it can also be useful before calling long-running computations " @@ -1264,11 +1275,11 @@ msgid "" "compressing or hashing data." msgstr "" -#: ../../c-api/init.rst:1007 +#: ../../c-api/init.rst:1016 msgid "Non-Python created threads" msgstr "" -#: ../../c-api/init.rst:1009 +#: ../../c-api/init.rst:1018 msgid "" "When threads are created using the dedicated Python APIs (such as the :mod:" "`threading` module), a thread state is automatically associated to them and " @@ -1278,7 +1289,7 @@ msgid "" "for them." msgstr "" -#: ../../c-api/init.rst:1016 +#: ../../c-api/init.rst:1025 msgid "" "If you need to call Python code from these threads (often this will be part " "of a callback API provided by the aforementioned third-party library), you " @@ -1289,14 +1300,14 @@ msgid "" "finally free the thread state data structure." msgstr "" -#: ../../c-api/init.rst:1024 +#: ../../c-api/init.rst:1033 msgid "" "The :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` functions " "do all of the above automatically. The typical idiom for calling into " "Python from a C thread is::" msgstr "" -#: ../../c-api/init.rst:1028 +#: ../../c-api/init.rst:1037 msgid "" "PyGILState_STATE gstate;\n" "gstate = PyGILState_Ensure();\n" @@ -1309,7 +1320,7 @@ msgid "" "PyGILState_Release(gstate);" msgstr "" -#: ../../c-api/init.rst:1038 +#: ../../c-api/init.rst:1047 msgid "" "Note that the ``PyGILState_*`` functions assume there is only one global " "interpreter (created automatically by :c:func:`Py_Initialize`). Python " @@ -1318,11 +1329,11 @@ msgid "" "``PyGILState_*`` API is unsupported." msgstr "" -#: ../../c-api/init.rst:1048 +#: ../../c-api/init.rst:1057 msgid "Cautions about fork()" msgstr "" -#: ../../c-api/init.rst:1050 +#: ../../c-api/init.rst:1059 msgid "" "Another important thing to note about threads is their behaviour in the face " "of the C :c:func:`fork` call. On most systems with :c:func:`fork`, after a " @@ -1331,7 +1342,7 @@ msgid "" "CPython's runtime." msgstr "" -#: ../../c-api/init.rst:1056 +#: ../../c-api/init.rst:1065 msgid "" "The fact that only the \"current\" thread remains means any locks held by " "other threads will never be released. Python solves this for :func:`os.fork` " @@ -1348,7 +1359,7 @@ msgid "" "locks, but is not always able to." msgstr "" -#: ../../c-api/init.rst:1071 +#: ../../c-api/init.rst:1080 msgid "" "The fact that all other threads go away also means that CPython's runtime " "state there must be cleaned up properly, which :func:`os.fork` does. This " @@ -1361,17 +1372,17 @@ msgid "" "called immediately after." msgstr "" -#: ../../c-api/init.rst:1084 +#: ../../c-api/init.rst:1093 msgid "High-level API" msgstr "高階 API" -#: ../../c-api/init.rst:1086 +#: ../../c-api/init.rst:1095 msgid "" "These are the most commonly used types and functions when writing C " "extension code, or when embedding the Python interpreter:" msgstr "" -#: ../../c-api/init.rst:1091 +#: ../../c-api/init.rst:1100 msgid "" "This data structure represents the state shared by a number of cooperating " "threads. Threads belonging to the same interpreter share their module " @@ -1379,7 +1390,7 @@ msgid "" "in this structure." msgstr "" -#: ../../c-api/init.rst:1096 +#: ../../c-api/init.rst:1105 msgid "" "Threads belonging to different interpreters initially share nothing, except " "process state like available memory, open file descriptors and such. The " @@ -1387,41 +1398,41 @@ msgid "" "which interpreter they belong." msgstr "" -#: ../../c-api/init.rst:1104 +#: ../../c-api/init.rst:1113 msgid "" "This data structure represents the state of a single thread. The only " "public data member is:" msgstr "" -#: ../../c-api/init.rst:1109 +#: ../../c-api/init.rst:1118 msgid "This thread's interpreter state." msgstr "" -#: ../../c-api/init.rst:1120 +#: ../../c-api/init.rst:1129 msgid "Deprecated function which does nothing." msgstr "" -#: ../../c-api/init.rst:1122 +#: ../../c-api/init.rst:1131 msgid "" "In Python 3.6 and older, this function created the GIL if it didn't exist." msgstr "" -#: ../../c-api/init.rst:1124 +#: ../../c-api/init.rst:1133 msgid "The function now does nothing." msgstr "此函式現在不會做任何事情。" -#: ../../c-api/init.rst:1127 +#: ../../c-api/init.rst:1136 msgid "" "This function is now called by :c:func:`Py_Initialize()`, so you don't have " "to call it yourself anymore." msgstr "" -#: ../../c-api/init.rst:1131 +#: ../../c-api/init.rst:1140 msgid "" "This function cannot be called before :c:func:`Py_Initialize()` anymore." msgstr "" -#: ../../c-api/init.rst:1141 +#: ../../c-api/init.rst:1150 msgid "" "Release the global interpreter lock (if it has been created) and reset the " "thread state to ``NULL``, returning the previous thread state (which is not " @@ -1429,7 +1440,7 @@ msgid "" "acquired it." msgstr "" -#: ../../c-api/init.rst:1149 +#: ../../c-api/init.rst:1158 msgid "" "Acquire the global interpreter lock (if it has been created) and set the " "thread state to *tstate*, which must not be ``NULL``. If the lock has been " @@ -1437,8 +1448,8 @@ msgid "" "ensues." msgstr "" -#: ../../c-api/init.rst:1155 ../../c-api/init.rst:1214 -#: ../../c-api/init.rst:1499 +#: ../../c-api/init.rst:1164 ../../c-api/init.rst:1223 +#: ../../c-api/init.rst:1508 msgid "" "Calling this function from a thread when the runtime is finalizing will " "terminate the thread, even if the thread was not created by Python. You can " @@ -1447,44 +1458,44 @@ msgid "" "avoid unwanted termination." msgstr "" -#: ../../c-api/init.rst:1163 +#: ../../c-api/init.rst:1172 msgid "" "Return the current thread state. The global interpreter lock must be held. " "When the current thread state is ``NULL``, this issues a fatal error (so " "that the caller needn't check for ``NULL``)." msgstr "" -#: ../../c-api/init.rst:1167 +#: ../../c-api/init.rst:1176 msgid "See also :c:func:`PyThreadState_GetUnchecked`." msgstr "也請見 :c:func:`PyThreadState_GetUnchecked`。" -#: ../../c-api/init.rst:1172 +#: ../../c-api/init.rst:1181 msgid "" "Similar to :c:func:`PyThreadState_Get`, but don't kill the process with a " "fatal error if it is NULL. The caller is responsible to check if the result " "is NULL." msgstr "" -#: ../../c-api/init.rst:1176 +#: ../../c-api/init.rst:1185 msgid "" "In Python 3.5 to 3.12, the function was private and known as " "``_PyThreadState_UncheckedGet()``." msgstr "" -#: ../../c-api/init.rst:1183 +#: ../../c-api/init.rst:1192 msgid "" "Swap the current thread state with the thread state given by the argument " "*tstate*, which may be ``NULL``. The global interpreter lock must be held " "and is not released." msgstr "" -#: ../../c-api/init.rst:1188 +#: ../../c-api/init.rst:1197 msgid "" "The following functions use thread-local storage, and are not compatible " "with sub-interpreters:" msgstr "" -#: ../../c-api/init.rst:1193 +#: ../../c-api/init.rst:1202 msgid "" "Ensure that the current thread is ready to call the Python C API regardless " "of the current state of Python, or of the global interpreter lock. This may " @@ -1497,7 +1508,7 @@ msgid "" "is acceptable." msgstr "" -#: ../../c-api/init.rst:1203 +#: ../../c-api/init.rst:1212 msgid "" "The return value is an opaque \"handle\" to the thread state when :c:func:" "`PyGILState_Ensure` was called, and must be passed to :c:func:" @@ -1507,13 +1518,13 @@ msgid "" "func:`PyGILState_Release`." msgstr "" -#: ../../c-api/init.rst:1210 +#: ../../c-api/init.rst:1219 msgid "" "When the function returns, the current thread will hold the GIL and be able " "to call arbitrary Python code. Failure is a fatal error." msgstr "" -#: ../../c-api/init.rst:1222 +#: ../../c-api/init.rst:1231 msgid "" "Release any resources previously acquired. After this call, Python's state " "will be the same as it was prior to the corresponding :c:func:" @@ -1521,13 +1532,13 @@ msgid "" "caller, hence the use of the GILState API)." msgstr "" -#: ../../c-api/init.rst:1227 +#: ../../c-api/init.rst:1236 msgid "" "Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:" "func:`PyGILState_Release` on the same thread." msgstr "" -#: ../../c-api/init.rst:1233 +#: ../../c-api/init.rst:1242 msgid "" "Get the current thread state for this thread. May return ``NULL`` if no " "GILState API has been used on the current thread. Note that the main thread " @@ -1535,7 +1546,7 @@ msgid "" "made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -#: ../../c-api/init.rst:1241 +#: ../../c-api/init.rst:1250 msgid "" "Return ``1`` if the current thread is holding the GIL and ``0`` otherwise. " "This function can be called from any thread at any time. Only if it has had " @@ -1546,13 +1557,13 @@ msgid "" "otherwise behave differently." msgstr "" -#: ../../c-api/init.rst:1253 +#: ../../c-api/init.rst:1262 msgid "" "The following macros are normally used without a trailing semicolon; look " "for example usage in the Python source distribution." msgstr "" -#: ../../c-api/init.rst:1259 +#: ../../c-api/init.rst:1268 msgid "" "This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" "``. Note that it contains an opening brace; it must be matched with a " @@ -1560,7 +1571,7 @@ msgid "" "discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1267 +#: ../../c-api/init.rst:1276 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " "contains a closing brace; it must be matched with an earlier :c:macro:" @@ -1568,40 +1579,40 @@ msgid "" "macro." msgstr "" -#: ../../c-api/init.rst:1275 +#: ../../c-api/init.rst:1284 msgid "" "This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :" "c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" -#: ../../c-api/init.rst:1281 +#: ../../c-api/init.rst:1290 msgid "" "This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :" "c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " "declaration." msgstr "" -#: ../../c-api/init.rst:1287 +#: ../../c-api/init.rst:1296 msgid "Low-level API" msgstr "低階 API" -#: ../../c-api/init.rst:1289 +#: ../../c-api/init.rst:1298 msgid "" "All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:1291 +#: ../../c-api/init.rst:1300 msgid ":c:func:`Py_Initialize()` now initializes the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:1297 +#: ../../c-api/init.rst:1306 msgid "" "Create a new interpreter state object. The global interpreter lock need not " "be held, but may be held if it is necessary to serialize calls to this " "function." msgstr "" -#: ../../c-api/init.rst:1301 +#: ../../c-api/init.rst:1310 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython." "PyInterpreterState_New`` with no arguments." @@ -1609,13 +1620,13 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 <auditing>` ``cpython." "PyInterpreterState_New``。" -#: ../../c-api/init.rst:1306 +#: ../../c-api/init.rst:1315 msgid "" "Reset all information in an interpreter state object. The global " "interpreter lock must be held." msgstr "" -#: ../../c-api/init.rst:1309 +#: ../../c-api/init.rst:1318 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython." "PyInterpreterState_Clear`` with no arguments." @@ -1623,44 +1634,44 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 <auditing>` ``cpython." "PyInterpreterState_Clear``。" -#: ../../c-api/init.rst:1314 +#: ../../c-api/init.rst:1323 msgid "" "Destroy an interpreter state object. The global interpreter lock need not " "be held. The interpreter state must have been reset with a previous call " "to :c:func:`PyInterpreterState_Clear`." msgstr "" -#: ../../c-api/init.rst:1321 +#: ../../c-api/init.rst:1330 msgid "" "Create a new thread state object belonging to the given interpreter object. " "The global interpreter lock need not be held, but may be held if it is " "necessary to serialize calls to this function." msgstr "" -#: ../../c-api/init.rst:1328 +#: ../../c-api/init.rst:1337 msgid "" "Reset all information in a thread state object. The global interpreter lock " "must be held." msgstr "" -#: ../../c-api/init.rst:1331 +#: ../../c-api/init.rst:1340 msgid "" "This function now calls the :c:member:`PyThreadState.on_delete` callback. " "Previously, that happened in :c:func:`PyThreadState_Delete`." msgstr "" -#: ../../c-api/init.rst:1335 +#: ../../c-api/init.rst:1344 msgid "The :c:member:`PyThreadState.on_delete` callback was removed." msgstr ":c:member:`PyThreadState.on_delete` 回呼已被移除。" -#: ../../c-api/init.rst:1341 +#: ../../c-api/init.rst:1350 msgid "" "Destroy a thread state object. The global interpreter lock need not be " "held. The thread state must have been reset with a previous call to :c:func:" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1348 +#: ../../c-api/init.rst:1357 msgid "" "Destroy the current thread state and release the global interpreter lock. " "Like :c:func:`PyThreadState_Delete`, the global interpreter lock must be " @@ -1668,119 +1679,119 @@ msgid "" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1356 +#: ../../c-api/init.rst:1365 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1358 +#: ../../c-api/init.rst:1367 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: ../../c-api/init.rst:1361 +#: ../../c-api/init.rst:1370 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "也請見 :c:func:`PyEval_GetFrame`。" -#: ../../c-api/init.rst:1363 ../../c-api/init.rst:1372 -#: ../../c-api/init.rst:1381 +#: ../../c-api/init.rst:1372 ../../c-api/init.rst:1381 +#: ../../c-api/init.rst:1390 msgid "*tstate* must not be ``NULL``." msgstr "*tstate* 不可為 ``NULL``。" -#: ../../c-api/init.rst:1370 +#: ../../c-api/init.rst:1379 msgid "" "Get the unique thread state identifier of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1379 +#: ../../c-api/init.rst:1388 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1388 +#: ../../c-api/init.rst:1397 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1390 +#: ../../c-api/init.rst:1399 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -#: ../../c-api/init.rst:1397 +#: ../../c-api/init.rst:1406 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -#: ../../c-api/init.rst:1400 +#: ../../c-api/init.rst:1409 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -#: ../../c-api/init.rst:1408 +#: ../../c-api/init.rst:1417 msgid "Get the current interpreter." msgstr "" -#: ../../c-api/init.rst:1410 +#: ../../c-api/init.rst:1419 msgid "" "Issue a fatal error if there no current Python thread state or no current " "interpreter. It cannot return NULL." msgstr "" -#: ../../c-api/init.rst:1413 ../../c-api/init.rst:1423 +#: ../../c-api/init.rst:1422 ../../c-api/init.rst:1432 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/init.rst:1420 +#: ../../c-api/init.rst:1429 msgid "" "Return the interpreter's unique ID. If there was any error in doing so then " "``-1`` is returned and an error is set." msgstr "" -#: ../../c-api/init.rst:1430 +#: ../../c-api/init.rst:1439 msgid "" "Return a dictionary in which interpreter-specific data may be stored. If " "this function returns ``NULL`` then no exception has been raised and the " "caller should assume no interpreter-specific dict is available." msgstr "" -#: ../../c-api/init.rst:1434 +#: ../../c-api/init.rst:1443 msgid "" "This is not a replacement for :c:func:`PyModule_GetState()`, which " "extensions should use to store interpreter-specific state information." msgstr "" -#: ../../c-api/init.rst:1441 +#: ../../c-api/init.rst:1450 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1443 +#: ../../c-api/init.rst:1452 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1446 +#: ../../c-api/init.rst:1455 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1449 +#: ../../c-api/init.rst:1458 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: ../../c-api/init.rst:1454 +#: ../../c-api/init.rst:1463 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1456 ../../c-api/init.rst:1464 +#: ../../c-api/init.rst:1465 ../../c-api/init.rst:1473 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1462 +#: ../../c-api/init.rst:1471 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1471 +#: ../../c-api/init.rst:1480 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " @@ -1789,7 +1800,7 @@ msgid "" "raised and the caller should assume no current thread state is available." msgstr "" -#: ../../c-api/init.rst:1480 +#: ../../c-api/init.rst:1489 msgid "" "Asynchronously raise an exception in a thread. The *id* argument is the " "thread id of the target thread; *exc* is the exception object to be raised. " @@ -1801,33 +1812,33 @@ msgid "" "raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1488 +#: ../../c-api/init.rst:1497 msgid "" "The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" "`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1494 +#: ../../c-api/init.rst:1503 msgid "" "Acquire the global interpreter lock and set the current thread state to " "*tstate*, which must not be ``NULL``. The lock must have been created " "earlier. If this thread already has the lock, deadlock ensues." msgstr "" -#: ../../c-api/init.rst:1505 +#: ../../c-api/init.rst:1514 msgid "" "Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" "`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " "current thread if called while the interpreter is finalizing." msgstr "" -#: ../../c-api/init.rst:1510 +#: ../../c-api/init.rst:1519 msgid "" ":c:func:`PyEval_RestoreThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1516 +#: ../../c-api/init.rst:1525 msgid "" "Reset the current thread state to ``NULL`` and release the global " "interpreter lock. The lock must have been created earlier and must be held " @@ -1836,17 +1847,17 @@ msgid "" "isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1522 +#: ../../c-api/init.rst:1531 msgid "" ":c:func:`PyEval_SaveThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1529 +#: ../../c-api/init.rst:1538 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1531 +#: ../../c-api/init.rst:1540 msgid "" "While in most uses, you will only embed a single Python interpreter, there " "are cases where you need to create several independent interpreters in the " @@ -1854,7 +1865,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1536 +#: ../../c-api/init.rst:1545 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -1865,31 +1876,31 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1543 +#: ../../c-api/init.rst:1552 msgid "" "You can switch between sub-interpreters using the :c:func:" "`PyThreadState_Swap` function. You can create and destroy them using the " "following functions:" msgstr "" -#: ../../c-api/init.rst:1549 +#: ../../c-api/init.rst:1558 msgid "" "Structure containing most parameters to configure a sub-interpreter. Its " "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " "modified by the runtime." msgstr "" -#: ../../c-api/init.rst:1555 +#: ../../c-api/init.rst:1564 msgid "Structure fields:" msgstr "" -#: ../../c-api/init.rst:1559 +#: ../../c-api/init.rst:1568 msgid "" "If this is ``0`` then the sub-interpreter will use its own \"object\" " "allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" -#: ../../c-api/init.rst:1563 +#: ../../c-api/init.rst:1572 msgid "" "If this is ``0`` then :c:member:`~PyInterpreterConfig." "check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " @@ -1897,44 +1908,44 @@ msgid "" "`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: ../../c-api/init.rst:1571 +#: ../../c-api/init.rst:1580 msgid "" "If this is ``0`` then the runtime will not support forking the process in " "any thread where the sub-interpreter is currently active. Otherwise fork is " "unrestricted." msgstr "" -#: ../../c-api/init.rst:1575 +#: ../../c-api/init.rst:1584 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: ../../c-api/init.rst:1580 +#: ../../c-api/init.rst:1589 msgid "" "If this is ``0`` then the runtime will not support replacing the current " "process via exec (e.g. :func:`os.execv`) in any thread where the sub-" "interpreter is currently active. Otherwise exec is unrestricted." msgstr "" -#: ../../c-api/init.rst:1585 +#: ../../c-api/init.rst:1594 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: ../../c-api/init.rst:1590 +#: ../../c-api/init.rst:1599 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create threads. Otherwise threads are allowed." msgstr "" -#: ../../c-api/init.rst:1596 +#: ../../c-api/init.rst:1605 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create daemon threads. Otherwise daemon threads are allowed (as long as :c:" "member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" -#: ../../c-api/init.rst:1603 +#: ../../c-api/init.rst:1612 msgid "" "If this is ``0`` then all extension modules may be imported, including " "legacy (single-phase init) modules, in any thread where the sub-interpreter " @@ -1943,37 +1954,37 @@ msgid "" "`Py_mod_multiple_interpreters`.)" msgstr "" -#: ../../c-api/init.rst:1610 +#: ../../c-api/init.rst:1619 msgid "" "This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." "use_main_obmalloc` is ``0``." msgstr "" -#: ../../c-api/init.rst:1615 +#: ../../c-api/init.rst:1624 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: ../../c-api/init.rst:1622 +#: ../../c-api/init.rst:1631 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: ../../c-api/init.rst:1626 +#: ../../c-api/init.rst:1635 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: ../../c-api/init.rst:1630 +#: ../../c-api/init.rst:1639 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: ../../c-api/init.rst:1632 +#: ../../c-api/init.rst:1641 msgid "" "If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" "`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: ../../c-api/init.rst:1646 +#: ../../c-api/init.rst:1655 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " @@ -1986,13 +1997,13 @@ msgid "" "underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1656 +#: ../../c-api/init.rst:1665 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: ../../c-api/init.rst:1659 +#: ../../c-api/init.rst:1668 msgid "" "Upon success, *tstate_p* will be set to the first thread state created in " "the new sub-interpreter. This thread state is made in the current thread " @@ -2003,7 +2014,7 @@ msgid "" "state." msgstr "" -#: ../../c-api/init.rst:1668 +#: ../../c-api/init.rst:1677 msgid "" "Like all other Python/C API functions, the global interpreter lock must be " "held before calling this function and is still held when it returns. " @@ -2015,13 +2026,13 @@ msgid "" "released here." msgstr "" -#: ../../c-api/init.rst:1679 +#: ../../c-api/init.rst:1688 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: ../../c-api/init.rst:1682 +#: ../../c-api/init.rst:1691 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -2053,7 +2064,7 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init.rst:1697 +#: ../../c-api/init.rst:1706 msgid "" "Note that the config is used only briefly and does not get modified. During " "initialization the config's values are converted into various :c:type:" @@ -2061,11 +2072,11 @@ msgid "" "internally on the :c:type:`PyInterpreterState`." msgstr "" -#: ../../c-api/init.rst:1706 +#: ../../c-api/init.rst:1715 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1708 +#: ../../c-api/init.rst:1717 msgid "" "For modules using multi-phase initialization, e.g. :c:func:" "`PyModule_FromDefAndSpec`, a separate module object is created and " @@ -2073,7 +2084,7 @@ msgid "" "are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1714 +#: ../../c-api/init.rst:1723 msgid "" "For modules using single-phase initialization, e.g. :c:func:" "`PyModule_Create`, the first time a particular extension is imported, it is " @@ -2085,7 +2096,7 @@ msgid "" "might cause unwanted behavior (see `Bugs and caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1725 +#: ../../c-api/init.rst:1734 msgid "" "Note that this is different from what happens when an extension is imported " "after the interpreter has been completely re-initialized by calling :c:func:" @@ -2095,7 +2106,7 @@ msgid "" "shared between these modules." msgstr "" -#: ../../c-api/init.rst:1745 +#: ../../c-api/init.rst:1754 msgid "" "Create a new sub-interpreter. This is essentially just a wrapper around :c:" "func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " @@ -2104,7 +2115,7 @@ msgid "" "single-phase init modules." msgstr "" -#: ../../c-api/init.rst:1757 +#: ../../c-api/init.rst:1766 msgid "" "Destroy the (sub-)interpreter represented by the given thread state. The " "given thread state must be the current thread state. See the discussion of " @@ -2114,17 +2125,17 @@ msgid "" "be held before calling this function. No GIL is held when it returns." msgstr "" -#: ../../c-api/init.rst:1765 +#: ../../c-api/init.rst:1774 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: ../../c-api/init.rst:1770 +#: ../../c-api/init.rst:1779 msgid "A Per-Interpreter GIL" msgstr "" -#: ../../c-api/init.rst:1772 +#: ../../c-api/init.rst:1781 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -2136,7 +2147,7 @@ msgid "" "just using threads. (See :pep:`554`.)" msgstr "" -#: ../../c-api/init.rst:1782 +#: ../../c-api/init.rst:1791 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -2150,7 +2161,7 @@ msgid "" "builtin objects." msgstr "" -#: ../../c-api/init.rst:1793 +#: ../../c-api/init.rst:1802 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -2158,7 +2169,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: ../../c-api/init.rst:1798 +#: ../../c-api/init.rst:1807 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -2168,11 +2179,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: ../../c-api/init.rst:1809 +#: ../../c-api/init.rst:1818 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1811 +#: ../../c-api/init.rst:1820 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -2185,7 +2196,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1821 +#: ../../c-api/init.rst:1830 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -2194,7 +2205,7 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1827 +#: ../../c-api/init.rst:1836 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " @@ -2206,25 +2217,25 @@ msgid "" "created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1838 +#: ../../c-api/init.rst:1847 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1840 +#: ../../c-api/init.rst:1849 msgid "" "A mechanism is provided to make asynchronous notifications to the main " "interpreter thread. These notifications take the form of a function pointer " "and a void pointer argument." msgstr "" -#: ../../c-api/init.rst:1847 +#: ../../c-api/init.rst:1856 msgid "" "Schedule a function to be called from the main interpreter thread. On " "success, ``0`` is returned and *func* is queued for being called in the main " "thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -#: ../../c-api/init.rst:1851 +#: ../../c-api/init.rst:1860 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2232,17 +2243,17 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1856 +#: ../../c-api/init.rst:1865 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1857 +#: ../../c-api/init.rst:1866 msgid "" "with the main thread holding the :term:`global interpreter lock` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1860 +#: ../../c-api/init.rst:1869 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " @@ -2250,20 +2261,20 @@ msgid "" "if the global interpreter lock is released." msgstr "" -#: ../../c-api/init.rst:1865 +#: ../../c-api/init.rst:1874 msgid "" "This function doesn't need a current thread state to run, and it doesn't " "need the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:1868 +#: ../../c-api/init.rst:1877 msgid "" "To call this function in a subinterpreter, the caller must hold the GIL. " "Otherwise, the function *func* can be scheduled to be called from the wrong " "interpreter." msgstr "" -#: ../../c-api/init.rst:1873 +#: ../../c-api/init.rst:1882 msgid "" "This is a low-level function, only useful for very special cases. There is " "no guarantee that *func* will be called as quick as possible. If the main " @@ -2273,7 +2284,7 @@ msgid "" "`PyGILState API<gilstate>`." msgstr "" -#: ../../c-api/init.rst:1882 +#: ../../c-api/init.rst:1891 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " @@ -2281,18 +2292,18 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:1891 +#: ../../c-api/init.rst:1900 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:1896 +#: ../../c-api/init.rst:1905 msgid "" "The Python interpreter provides some low-level support for attaching " "profiling and execution tracing facilities. These are used for profiling, " "debugging, and coverage analysis tools." msgstr "" -#: ../../c-api/init.rst:1900 +#: ../../c-api/init.rst:1909 msgid "" "This C interface allows the profiling or tracing code to avoid the overhead " "of calling through Python-level callable objects, making a direct C function " @@ -2302,7 +2313,7 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:1910 +#: ../../c-api/init.rst:1919 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " @@ -2314,66 +2325,66 @@ msgid "" "value of *what*:" msgstr "" -#: ../../c-api/init.rst:1919 +#: ../../c-api/init.rst:1928 msgid "Value of *what*" msgstr "" -#: ../../c-api/init.rst:1919 +#: ../../c-api/init.rst:1928 msgid "Meaning of *arg*" msgstr "*arg* 的含義" -#: ../../c-api/init.rst:1921 +#: ../../c-api/init.rst:1930 msgid ":c:data:`PyTrace_CALL`" msgstr ":c:data:`PyTrace_CALL`" -#: ../../c-api/init.rst:1921 ../../c-api/init.rst:1926 -#: ../../c-api/init.rst:1937 +#: ../../c-api/init.rst:1930 ../../c-api/init.rst:1935 +#: ../../c-api/init.rst:1946 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:1923 +#: ../../c-api/init.rst:1932 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr ":c:data:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:1923 +#: ../../c-api/init.rst:1932 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:1926 +#: ../../c-api/init.rst:1935 msgid ":c:data:`PyTrace_LINE`" msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:1928 +#: ../../c-api/init.rst:1937 msgid ":c:data:`PyTrace_RETURN`" msgstr ":c:data:`PyTrace_RETURN`" -#: ../../c-api/init.rst:1928 +#: ../../c-api/init.rst:1937 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:1931 +#: ../../c-api/init.rst:1940 msgid ":c:data:`PyTrace_C_CALL`" msgstr ":c:data:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:1931 ../../c-api/init.rst:1933 -#: ../../c-api/init.rst:1935 +#: ../../c-api/init.rst:1940 ../../c-api/init.rst:1942 +#: ../../c-api/init.rst:1944 msgid "Function object being called." msgstr "被呼叫的函式物件。" -#: ../../c-api/init.rst:1933 +#: ../../c-api/init.rst:1942 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:1935 +#: ../../c-api/init.rst:1944 msgid ":c:data:`PyTrace_C_RETURN`" msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:1937 +#: ../../c-api/init.rst:1946 msgid ":c:data:`PyTrace_OPCODE`" msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:1942 +#: ../../c-api/init.rst:1951 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -2382,7 +2393,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:1951 +#: ../../c-api/init.rst:1960 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "an exception has been raised. The callback function is called with this " @@ -2394,7 +2405,7 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:1962 +#: ../../c-api/init.rst:1971 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " @@ -2402,31 +2413,31 @@ msgid "" "f_trace_lines` to *0* on that frame." msgstr "" -#: ../../c-api/init.rst:1970 +#: ../../c-api/init.rst:1979 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a call is about to return." msgstr "" -#: ../../c-api/init.rst:1976 +#: ../../c-api/init.rst:1985 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function is about to be called." msgstr "" -#: ../../c-api/init.rst:1982 +#: ../../c-api/init.rst:1991 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has raised an exception." msgstr "" -#: ../../c-api/init.rst:1988 +#: ../../c-api/init.rst:1997 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:1994 +#: ../../c-api/init.rst:2003 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " @@ -2434,7 +2445,7 @@ msgid "" "attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:2002 +#: ../../c-api/init.rst:2011 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " @@ -2444,29 +2455,29 @@ msgid "" "`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:2009 +#: ../../c-api/init.rst:2018 msgid "See also the :func:`sys.setprofile` function." msgstr "" -#: ../../c-api/init.rst:2011 ../../c-api/init.rst:2018 -#: ../../c-api/init.rst:2037 ../../c-api/init.rst:2044 +#: ../../c-api/init.rst:2020 ../../c-api/init.rst:2027 +#: ../../c-api/init.rst:2046 ../../c-api/init.rst:2053 msgid "The caller must hold the :term:`GIL`." msgstr "呼叫者必須持有 :term:`GIL`。" -#: ../../c-api/init.rst:2015 +#: ../../c-api/init.rst:2024 msgid "" "Like :c:func:`PyEval_SetProfile` but sets the profile function in all " "running threads belonging to the current interpreter instead of the setting " "it only on the current thread." msgstr "" -#: ../../c-api/init.rst:2020 +#: ../../c-api/init.rst:2029 msgid "" "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " "while setting the profile functions in all threads." msgstr "" -#: ../../c-api/init.rst:2028 +#: ../../c-api/init.rst:2037 msgid "" "Set the tracing function to *func*. This is similar to :c:func:" "`PyEval_SetProfile`, except the tracing function does receive line-number " @@ -2477,28 +2488,28 @@ msgid "" "*what* parameter." msgstr "" -#: ../../c-api/init.rst:2035 +#: ../../c-api/init.rst:2044 msgid "See also the :func:`sys.settrace` function." msgstr "也請見 :func:`sys.settrace` 函式。" -#: ../../c-api/init.rst:2041 +#: ../../c-api/init.rst:2050 msgid "" "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " "threads belonging to the current interpreter instead of the setting it only " "on the current thread." msgstr "" -#: ../../c-api/init.rst:2046 +#: ../../c-api/init.rst:2055 msgid "" "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " "while setting the trace functions in all threads." msgstr "" -#: ../../c-api/init.rst:2052 +#: ../../c-api/init.rst:2061 msgid "Reference tracing" msgstr "" -#: ../../c-api/init.rst:2058 +#: ../../c-api/init.rst:2067 msgid "" "The type of the trace function registered using :c:func:" "`PyRefTracer_SetTracer`. The first parameter is a Python object that has " @@ -2508,19 +2519,19 @@ msgid "" "provided when :c:func:`PyRefTracer_SetTracer` was called." msgstr "" -#: ../../c-api/init.rst:2068 +#: ../../c-api/init.rst:2077 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been created." msgstr "" -#: ../../c-api/init.rst:2073 +#: ../../c-api/init.rst:2082 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been destroyed." msgstr "" -#: ../../c-api/init.rst:2078 +#: ../../c-api/init.rst:2087 msgid "" "Register a reference tracer function. The function will be called when a new " "Python has been created or when an object is going to be destroyed. If " @@ -2529,7 +2540,7 @@ msgid "" "return ``-1`` on error." msgstr "" -#: ../../c-api/init.rst:2084 +#: ../../c-api/init.rst:2093 msgid "" "Not that tracer functions **must not** create Python objects inside or " "otherwise the call will be re-entrant. The tracer also **must not** clear " @@ -2537,11 +2548,11 @@ msgid "" "the tracer function is called." msgstr "" -#: ../../c-api/init.rst:2089 ../../c-api/init.rst:2100 +#: ../../c-api/init.rst:2098 ../../c-api/init.rst:2109 msgid "The GIL must be held when calling this function." msgstr "" -#: ../../c-api/init.rst:2095 +#: ../../c-api/init.rst:2104 msgid "" "Get the registered reference tracer function and the value of the opaque " "data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " @@ -2549,48 +2560,48 @@ msgid "" "set the **data** pointer to NULL." msgstr "" -#: ../../c-api/init.rst:2107 +#: ../../c-api/init.rst:2116 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:2112 +#: ../../c-api/init.rst:2121 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:2117 +#: ../../c-api/init.rst:2126 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:2122 +#: ../../c-api/init.rst:2131 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:2127 +#: ../../c-api/init.rst:2136 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:2133 +#: ../../c-api/init.rst:2142 msgid "" "Return the pointer to the first :c:type:`PyThreadState` object in the list " "of threads associated with the interpreter *interp*." msgstr "" -#: ../../c-api/init.rst:2139 +#: ../../c-api/init.rst:2148 msgid "" "Return the next thread state object after *tstate* from the list of all such " "objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" -#: ../../c-api/init.rst:2146 +#: ../../c-api/init.rst:2155 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:2150 +#: ../../c-api/init.rst:2159 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2600,19 +2611,19 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:2157 +#: ../../c-api/init.rst:2166 msgid "" "The GIL does *not* need to be held when calling these functions; they supply " "their own locking." msgstr "" -#: ../../c-api/init.rst:2160 +#: ../../c-api/init.rst:2169 msgid "" "Note that :file:`Python.h` does not include the declaration of the TLS APIs, " "you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -#: ../../c-api/init.rst:2164 +#: ../../c-api/init.rst:2173 msgid "" "None of these API functions handle memory management on behalf of the :c:" "expr:`void*` values. You need to allocate and deallocate them yourself. If " @@ -2620,22 +2631,22 @@ msgid "" "don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:2172 +#: ../../c-api/init.rst:2181 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:2174 +#: ../../c-api/init.rst:2183 msgid "" "TSS API is introduced to supersede the use of the existing TLS API within " "the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` " "instead of :c:expr:`int` to represent thread keys." msgstr "" -#: ../../c-api/init.rst:2180 +#: ../../c-api/init.rst:2189 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:2185 +#: ../../c-api/init.rst:2194 msgid "" "This data structure represents the state of a thread key, the definition of " "which may depend on the underlying TLS implementation, and it has an " @@ -2643,52 +2654,52 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:2190 +#: ../../c-api/init.rst:2199 msgid "" "When :ref:`Py_LIMITED_API <stable>` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -#: ../../c-api/init.rst:2196 +#: ../../c-api/init.rst:2205 msgid "" "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " "that this macro won't be defined with :ref:`Py_LIMITED_API <stable>`." msgstr "" -#: ../../c-api/init.rst:2201 +#: ../../c-api/init.rst:2210 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:2203 +#: ../../c-api/init.rst:2212 msgid "" "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " "built with :ref:`Py_LIMITED_API <stable>`, where static allocation of this " "type is not possible due to its implementation being opaque at build time." msgstr "" -#: ../../c-api/init.rst:2210 +#: ../../c-api/init.rst:2219 msgid "" "Return a value which is the same state as a value initialized with :c:macro:" "`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." msgstr "" -#: ../../c-api/init.rst:2217 +#: ../../c-api/init.rst:2226 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" -#: ../../c-api/init.rst:2223 +#: ../../c-api/init.rst:2232 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: ../../c-api/init.rst:2228 +#: ../../c-api/init.rst:2237 msgid "Methods" msgstr "方法" -#: ../../c-api/init.rst:2230 +#: ../../c-api/init.rst:2239 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " @@ -2696,13 +2707,13 @@ msgid "" "func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2238 +#: ../../c-api/init.rst:2247 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2244 +#: ../../c-api/init.rst:2253 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -2711,7 +2722,7 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:2253 +#: ../../c-api/init.rst:2262 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " @@ -2720,31 +2731,31 @@ msgid "" "key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:2262 +#: ../../c-api/init.rst:2271 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" -#: ../../c-api/init.rst:2269 +#: ../../c-api/init.rst:2278 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" -#: ../../c-api/init.rst:2277 +#: ../../c-api/init.rst:2286 msgid "Thread Local Storage (TLS) API" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../c-api/init.rst:2279 +#: ../../c-api/init.rst:2288 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API <thread-" "specific-storage-api>`." msgstr "" -#: ../../c-api/init.rst:2284 +#: ../../c-api/init.rst:2293 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -2753,62 +2764,62 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:2289 +#: ../../c-api/init.rst:2298 msgid "" "Due to the compatibility problem noted above, this version of the API should " "not be used in new code." msgstr "" -#: ../../c-api/init.rst:2300 +#: ../../c-api/init.rst:2309 msgid "Synchronization Primitives" msgstr "" -#: ../../c-api/init.rst:2302 +#: ../../c-api/init.rst:2311 msgid "The C-API provides a basic mutual exclusion lock." msgstr "" -#: ../../c-api/init.rst:2306 +#: ../../c-api/init.rst:2315 msgid "" "A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " "zero to represent the unlocked state. For example::" msgstr "" -#: ../../c-api/init.rst:2309 +#: ../../c-api/init.rst:2318 msgid "PyMutex mutex = {0};" msgstr "" -#: ../../c-api/init.rst:2311 +#: ../../c-api/init.rst:2320 msgid "" "Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " "contents and address of a :c:type:`!PyMutex` are meaningful, and it must " "remain at a fixed, writable location in memory." msgstr "" -#: ../../c-api/init.rst:2317 +#: ../../c-api/init.rst:2326 msgid "" "A :c:type:`!PyMutex` currently occupies one byte, but the size should be " "considered unstable. The size may change in future Python releases without " "a deprecation period." msgstr "" -#: ../../c-api/init.rst:2325 +#: ../../c-api/init.rst:2334 msgid "" "Lock mutex *m*. If another thread has already locked it, the calling thread " "will block until the mutex is unlocked. While blocked, the thread will " "temporarily release the :term:`GIL` if it is held." msgstr "" -#: ../../c-api/init.rst:2333 +#: ../../c-api/init.rst:2342 msgid "" "Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " "issue a fatal error." msgstr "" -#: ../../c-api/init.rst:2341 +#: ../../c-api/init.rst:2350 msgid "Python Critical Section API" msgstr "" -#: ../../c-api/init.rst:2343 +#: ../../c-api/init.rst:2352 msgid "" "The critical section API provides a deadlock avoidance layer on top of per-" "object locks for :term:`free-threaded <free threading>` CPython. They are " @@ -2816,7 +2827,7 @@ msgid "" "no-ops in versions of Python with the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:2348 +#: ../../c-api/init.rst:2357 msgid "" "Critical sections avoid deadlocks by implicitly suspending active critical " "sections and releasing the locks during calls to :c:func:" @@ -2826,7 +2837,7 @@ msgid "" "-- they are useful because their behavior is similar to the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:2355 +#: ../../c-api/init.rst:2364 msgid "" "The functions and structs used by the macros are exposed for cases where C " "macros are not available. They should only be used as in the given macro " @@ -2834,7 +2845,7 @@ msgid "" "future Python versions." msgstr "" -#: ../../c-api/init.rst:2362 +#: ../../c-api/init.rst:2371 msgid "" "Operations that need to lock two objects at once must use :c:macro:" "`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " @@ -2843,11 +2854,11 @@ msgid "" "lock more than two objects at once." msgstr "" -#: ../../c-api/init.rst:2368 +#: ../../c-api/init.rst:2377 msgid "Example usage::" msgstr "" -#: ../../c-api/init.rst:2370 +#: ../../c-api/init.rst:2379 msgid "" "static PyObject *\n" "set_field(MyObject *self, PyObject *value)\n" @@ -2859,7 +2870,7 @@ msgid "" "}" msgstr "" -#: ../../c-api/init.rst:2379 +#: ../../c-api/init.rst:2388 msgid "" "In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " "can call arbitrary code through an object's deallocation function. The " @@ -2869,61 +2880,61 @@ msgid "" "`PyEval_SaveThread`." msgstr "" -#: ../../c-api/init.rst:2387 +#: ../../c-api/init.rst:2396 msgid "" "Acquires the per-object lock for the object *op* and begins a critical " "section." msgstr "" -#: ../../c-api/init.rst:2390 ../../c-api/init.rst:2404 -#: ../../c-api/init.rst:2419 ../../c-api/init.rst:2433 +#: ../../c-api/init.rst:2399 ../../c-api/init.rst:2413 +#: ../../c-api/init.rst:2428 ../../c-api/init.rst:2442 msgid "In the free-threaded build, this macro expands to::" msgstr "" -#: ../../c-api/init.rst:2392 +#: ../../c-api/init.rst:2401 msgid "" "{\n" " PyCriticalSection _py_cs;\n" " PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" msgstr "" -#: ../../c-api/init.rst:2396 ../../c-api/init.rst:2425 +#: ../../c-api/init.rst:2405 ../../c-api/init.rst:2434 msgid "In the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2402 +#: ../../c-api/init.rst:2411 msgid "Ends the critical section and releases the per-object lock." msgstr "" -#: ../../c-api/init.rst:2406 +#: ../../c-api/init.rst:2415 msgid "" " PyCriticalSection_End(&_py_cs);\n" "}" msgstr "" -#: ../../c-api/init.rst:2409 ../../c-api/init.rst:2438 +#: ../../c-api/init.rst:2418 ../../c-api/init.rst:2447 msgid "In the default build, this macro expands to ``}``." msgstr "" -#: ../../c-api/init.rst:2415 +#: ../../c-api/init.rst:2424 msgid "" "Acquires the per-objects locks for the objects *a* and *b* and begins a " "critical section. The locks are acquired in a consistent order (lowest " "address first) to avoid lock ordering deadlocks." msgstr "" -#: ../../c-api/init.rst:2421 +#: ../../c-api/init.rst:2430 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" msgstr "" -#: ../../c-api/init.rst:2431 +#: ../../c-api/init.rst:2440 msgid "Ends the critical section and releases the per-object locks." msgstr "" -#: ../../c-api/init.rst:2435 +#: ../../c-api/init.rst:2444 msgid "" " PyCriticalSection2_End(&_py_cs2);\n" "}" @@ -2937,147 +2948,147 @@ msgstr "PyEval_InitThreads()" msgid "modules (in module sys)" msgstr "modules(sys 模組中)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:710 msgid "path (in module sys)" msgstr "path(sys 模組中)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 ../../c-api/init.rst:1136 -#: ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:710 ../../c-api/init.rst:1145 +#: ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 msgid "module" msgstr "模組" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 msgid "__main__" msgstr "__main__" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 msgid "sys" msgstr "sys" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:710 msgid "search" msgstr "search(搜尋)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:701 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:710 msgid "path" msgstr "path(路徑)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1702 ../../c-api/init.rst:1755 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1711 ../../c-api/init.rst:1764 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" -#: ../../c-api/init.rst:567 +#: ../../c-api/init.rst:576 msgid "Py_Initialize()" msgstr "Py_Initialize()" -#: ../../c-api/init.rst:567 ../../c-api/init.rst:799 +#: ../../c-api/init.rst:576 ../../c-api/init.rst:808 msgid "main()" msgstr "main()" -#: ../../c-api/init.rst:567 +#: ../../c-api/init.rst:576 msgid "Py_GetPath()" msgstr "Py_GetPath()" -#: ../../c-api/init.rst:680 +#: ../../c-api/init.rst:689 msgid "executable (in module sys)" msgstr "executable(sys 模組中)" -#: ../../c-api/init.rst:734 ../../c-api/init.rst:776 ../../c-api/init.rst:790 +#: ../../c-api/init.rst:743 ../../c-api/init.rst:785 ../../c-api/init.rst:799 msgid "version (in module sys)" msgstr "version(sys 模組中)" -#: ../../c-api/init.rst:746 +#: ../../c-api/init.rst:755 msgid "platform (in module sys)" msgstr "platform(sys 模組中)" -#: ../../c-api/init.rst:763 +#: ../../c-api/init.rst:772 msgid "copyright (in module sys)" msgstr "copyright(sys 模組中)" -#: ../../c-api/init.rst:799 +#: ../../c-api/init.rst:808 msgid "Py_FatalError()" msgstr "Py_FatalError()" -#: ../../c-api/init.rst:799 +#: ../../c-api/init.rst:808 msgid "argv (in module sys)" msgstr "argv(sys 模組中)" -#: ../../c-api/init.rst:919 +#: ../../c-api/init.rst:928 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../c-api/init.rst:919 +#: ../../c-api/init.rst:928 msgid "interpreter lock" msgstr "interpreter lock(直譯器鎖)" -#: ../../c-api/init.rst:919 +#: ../../c-api/init.rst:928 msgid "lock, interpreter" msgstr "lock, interpreter(鎖、直譯器)" -#: ../../c-api/init.rst:932 +#: ../../c-api/init.rst:941 msgid "setswitchinterval (in module sys)" msgstr "setswitchinterval (sys 模組中)" -#: ../../c-api/init.rst:941 +#: ../../c-api/init.rst:950 msgid "PyThreadState (C type)" msgstr "PyThreadState(C 型別)" -#: ../../c-api/init.rst:967 +#: ../../c-api/init.rst:976 msgid "Py_BEGIN_ALLOW_THREADS (C macro)" msgstr "Py_BEGIN_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:967 +#: ../../c-api/init.rst:976 msgid "Py_END_ALLOW_THREADS (C macro)" msgstr "Py_END_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:983 +#: ../../c-api/init.rst:992 msgid "PyEval_RestoreThread (C function)" msgstr "PyEval_RestoreThread(C 函式)" -#: ../../c-api/init.rst:983 +#: ../../c-api/init.rst:992 msgid "PyEval_SaveThread (C function)" msgstr "PyEval_SaveThread(C 函式)" -#: ../../c-api/init.rst:1114 +#: ../../c-api/init.rst:1123 msgid "PyEval_AcquireThread()" msgstr "PyEval_AcquireThread()" -#: ../../c-api/init.rst:1114 +#: ../../c-api/init.rst:1123 msgid "PyEval_ReleaseThread()" msgstr "PyEval_ReleaseThread()" -#: ../../c-api/init.rst:1114 +#: ../../c-api/init.rst:1123 msgid "PyEval_SaveThread()" msgstr "PyEval_SaveThread()" -#: ../../c-api/init.rst:1114 +#: ../../c-api/init.rst:1123 msgid "PyEval_RestoreThread()" msgstr "PyEval_RestoreThread()" -#: ../../c-api/init.rst:1136 +#: ../../c-api/init.rst:1145 msgid "_thread" msgstr "_thread" -#: ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 msgid "stdout (in module sys)" msgstr "stdout(sys 模組中)" -#: ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 msgid "stderr (in module sys)" msgstr "stderr(sys 模組中)" -#: ../../c-api/init.rst:1638 ../../c-api/init.rst:1737 +#: ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 msgid "stdin (in module sys)" msgstr "stdin(sys 模組中)" -#: ../../c-api/init.rst:1702 +#: ../../c-api/init.rst:1711 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/init.rst:1732 +#: ../../c-api/init.rst:1741 msgid "close (in module os)" msgstr "close(os 模組中)" diff --git a/c-api/init_config.po b/c-api/init_config.po index 5293b616d7..a8fedbc984 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-09 00:13+0000\n" +"POT-Creation-Date: 2024-12-11 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -479,7 +479,7 @@ msgstr "" #: ../../c-api/init_config.rst:952 ../../c-api/init_config.rst:1012 #: ../../c-api/init_config.rst:1064 ../../c-api/init_config.rst:1126 #: ../../c-api/init_config.rst:1180 ../../c-api/init_config.rst:1209 -#: ../../c-api/init_config.rst:1298 +#: ../../c-api/init_config.rst:1309 msgid "Default: ``0``." msgstr "預設:``0``。" @@ -573,7 +573,7 @@ msgid "" "`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -#: ../../c-api/init_config.rst:401 ../../c-api/init_config.rst:1359 +#: ../../c-api/init_config.rst:401 ../../c-api/init_config.rst:1370 msgid "" "The caller is responsible to handle exceptions (error or exit) using :c:func:" "`PyStatus_Exception` and :c:func:`Py_ExitStatusException`." @@ -902,7 +902,7 @@ msgid "stdin is always opened in buffered mode." msgstr "" #: ../../c-api/init_config.rst:645 ../../c-api/init_config.rst:678 -#: ../../c-api/init_config.rst:1197 ../../c-api/init_config.rst:1330 +#: ../../c-api/init_config.rst:1197 ../../c-api/init_config.rst:1341 msgid "Default: ``1``." msgstr "預設值:``1``。" @@ -1215,7 +1215,7 @@ msgid "Install Python signal handlers?" msgstr "" #: ../../c-api/init_config.rst:863 ../../c-api/init_config.rst:1047 -#: ../../c-api/init_config.rst:1071 ../../c-api/init_config.rst:1282 +#: ../../c-api/init_config.rst:1071 ../../c-api/init_config.rst:1293 msgid "Default: ``1`` in Python mode, ``0`` in isolated mode." msgstr "" @@ -1434,8 +1434,8 @@ msgid "" "`Py_GetArgcArgv` function." msgstr "" -#: ../../c-api/init_config.rst:1029 ../../c-api/init_config.rst:1317 -#: ../../c-api/init_config.rst:1336 +#: ../../c-api/init_config.rst:1029 ../../c-api/init_config.rst:1328 +#: ../../c-api/init_config.rst:1347 msgid "Default: empty list." msgstr "" @@ -1740,88 +1740,101 @@ msgid "Set to ``0`` by the :option:`-E` environment variable." msgstr "" #: ../../c-api/init_config.rst:1276 +msgid "" +"If non-zero, ``stdout`` and ``stderr`` will be redirected to the system log." +msgstr "" + +#: ../../c-api/init_config.rst:1279 +msgid "Only available on macOS 10.12 and later, and on iOS." +msgstr "" + +#: ../../c-api/init_config.rst:1281 +msgid "Default: ``0`` (don't use system log)." +msgstr "" + +#: ../../c-api/init_config.rst:1287 msgid "If non-zero, add the user site directory to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1278 +#: ../../c-api/init_config.rst:1289 msgid "Set to ``0`` by the :option:`-s` and :option:`-I` command line options." msgstr "" -#: ../../c-api/init_config.rst:1280 +#: ../../c-api/init_config.rst:1291 msgid "Set to ``0`` by the :envvar:`PYTHONNOUSERSITE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1286 +#: ../../c-api/init_config.rst:1297 msgid "" "Verbose mode. If greater than ``0``, print a message each time a module is " "imported, showing the place (filename or built-in module) from which it is " "loaded." msgstr "" -#: ../../c-api/init_config.rst:1290 +#: ../../c-api/init_config.rst:1301 msgid "" "If greater than or equal to ``2``, print a message for each file that is " "checked for when searching for a module. Also provides information on module " "cleanup at exit." msgstr "" -#: ../../c-api/init_config.rst:1294 +#: ../../c-api/init_config.rst:1305 msgid "Incremented by the :option:`-v` command line option." msgstr "" -#: ../../c-api/init_config.rst:1296 +#: ../../c-api/init_config.rst:1307 msgid "Set by the :envvar:`PYTHONVERBOSE` environment variable value." msgstr "" -#: ../../c-api/init_config.rst:1302 +#: ../../c-api/init_config.rst:1313 msgid "" "Options of the :mod:`warnings` module to build warnings filters, lowest to " "highest priority: :data:`sys.warnoptions`." msgstr "" -#: ../../c-api/init_config.rst:1305 +#: ../../c-api/init_config.rst:1316 msgid "" "The :mod:`warnings` module adds :data:`sys.warnoptions` in the reverse " "order: the last :c:member:`PyConfig.warnoptions` item becomes the first item " "of :data:`warnings.filters` which is checked first (highest priority)." msgstr "" -#: ../../c-api/init_config.rst:1310 +#: ../../c-api/init_config.rst:1321 msgid "" "The :option:`-W` command line options adds its value to :c:member:`~PyConfig." "warnoptions`, it can be used multiple times." msgstr "" -#: ../../c-api/init_config.rst:1313 +#: ../../c-api/init_config.rst:1324 msgid "" "The :envvar:`PYTHONWARNINGS` environment variable can also be used to add " "warning options. Multiple options can be specified, separated by commas (``," "``)." msgstr "" -#: ../../c-api/init_config.rst:1321 +#: ../../c-api/init_config.rst:1332 msgid "" "If equal to ``0``, Python won't try to write ``.pyc`` files on the import of " "source modules." msgstr "" -#: ../../c-api/init_config.rst:1324 +#: ../../c-api/init_config.rst:1335 msgid "" "Set to ``0`` by the :option:`-B` command line option and the :envvar:" "`PYTHONDONTWRITEBYTECODE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1327 +#: ../../c-api/init_config.rst:1338 msgid "" ":data:`sys.dont_write_bytecode` is initialized to the inverted value of :c:" "member:`~PyConfig.write_bytecode`." msgstr "" -#: ../../c-api/init_config.rst:1334 +#: ../../c-api/init_config.rst:1345 msgid "Values of the :option:`-X` command line options: :data:`sys._xoptions`." msgstr "" -#: ../../c-api/init_config.rst:1338 +#: ../../c-api/init_config.rst:1349 msgid "" "If :c:member:`~PyConfig.parse_argv` is non-zero, :c:member:`~PyConfig.argv` " "arguments are parsed the same way the regular Python parses :ref:`command " @@ -1829,27 +1842,27 @@ msgid "" "c:member:`~PyConfig.argv`." msgstr "" -#: ../../c-api/init_config.rst:1343 +#: ../../c-api/init_config.rst:1354 msgid "" "The :c:member:`~PyConfig.xoptions` options are parsed to set other options: " "see the :option:`-X` command line option." msgstr "" -#: ../../c-api/init_config.rst:1348 +#: ../../c-api/init_config.rst:1359 msgid "The ``show_alloc_count`` field has been removed." msgstr "" -#: ../../c-api/init_config.rst:1354 +#: ../../c-api/init_config.rst:1365 msgid "Initialization with PyConfig" msgstr "" -#: ../../c-api/init_config.rst:1356 +#: ../../c-api/init_config.rst:1367 msgid "" "Initializing the interpreter from a populated configuration struct is " "handled by calling :c:func:`Py_InitializeFromConfig`." msgstr "" -#: ../../c-api/init_config.rst:1362 +#: ../../c-api/init_config.rst:1373 msgid "" "If :c:func:`PyImport_FrozenModules`, :c:func:`PyImport_AppendInittab` or :c:" "func:`PyImport_ExtendInittab` are used, they must be set or called after " @@ -1858,17 +1871,17 @@ msgid "" "`PyImport_ExtendInittab` must be called before each Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1369 +#: ../../c-api/init_config.rst:1380 msgid "" "The current configuration (``PyConfig`` type) is stored in " "``PyInterpreterState.config``." msgstr "" -#: ../../c-api/init_config.rst:1372 +#: ../../c-api/init_config.rst:1383 msgid "Example setting the program name::" msgstr "" -#: ../../c-api/init_config.rst:1374 +#: ../../c-api/init_config.rst:1385 msgid "" "void init_python(void)\n" "{\n" @@ -1922,7 +1935,7 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init_config.rst:1400 +#: ../../c-api/init_config.rst:1411 msgid "" "More complete example modifying the default configuration, read the " "configuration, and then override some parameters. Note that since 3.11, many " @@ -1931,7 +1944,7 @@ msgid "" "called will be left unchanged by initialization::" msgstr "" -#: ../../c-api/init_config.rst:1407 +#: ../../c-api/init_config.rst:1418 msgid "" "PyStatus init_python(const char *program_name)\n" "{\n" @@ -1986,18 +1999,18 @@ msgid "" "}" msgstr "" -#: ../../c-api/init_config.rst:1463 +#: ../../c-api/init_config.rst:1474 msgid "Isolated Configuration" msgstr "" -#: ../../c-api/init_config.rst:1465 +#: ../../c-api/init_config.rst:1476 msgid "" ":c:func:`PyPreConfig_InitIsolatedConfig` and :c:func:" "`PyConfig_InitIsolatedConfig` functions create a configuration to isolate " "Python from the system. For example, to embed Python into an application." msgstr "" -#: ../../c-api/init_config.rst:1470 +#: ../../c-api/init_config.rst:1481 msgid "" "This configuration ignores global configuration variables, environment " "variables, command line arguments (:c:member:`PyConfig.argv` is not parsed) " @@ -2005,115 +2018,115 @@ msgid "" "LC_CTYPE locale are left unchanged. Signal handlers are not installed." msgstr "" -#: ../../c-api/init_config.rst:1475 +#: ../../c-api/init_config.rst:1486 msgid "" "Configuration files are still used with this configuration to determine " "paths that are unspecified. Ensure :c:member:`PyConfig.home` is specified to " "avoid computing the default path configuration." msgstr "" -#: ../../c-api/init_config.rst:1483 +#: ../../c-api/init_config.rst:1494 msgid "Python Configuration" msgstr "" -#: ../../c-api/init_config.rst:1485 +#: ../../c-api/init_config.rst:1496 msgid "" ":c:func:`PyPreConfig_InitPythonConfig` and :c:func:" "`PyConfig_InitPythonConfig` functions create a configuration to build a " "customized Python which behaves as the regular Python." msgstr "" -#: ../../c-api/init_config.rst:1489 +#: ../../c-api/init_config.rst:1500 msgid "" "Environments variables and command line arguments are used to configure " "Python, whereas global configuration variables are ignored." msgstr "" -#: ../../c-api/init_config.rst:1492 +#: ../../c-api/init_config.rst:1503 msgid "" "This function enables C locale coercion (:pep:`538`) and :ref:`Python UTF-8 " "Mode <utf8-mode>` (:pep:`540`) depending on the LC_CTYPE locale, :envvar:" "`PYTHONUTF8` and :envvar:`PYTHONCOERCECLOCALE` environment variables." msgstr "" -#: ../../c-api/init_config.rst:1501 +#: ../../c-api/init_config.rst:1512 msgid "Python Path Configuration" msgstr "" -#: ../../c-api/init_config.rst:1503 +#: ../../c-api/init_config.rst:1514 msgid ":c:type:`PyConfig` contains multiple fields for the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1505 +#: ../../c-api/init_config.rst:1516 msgid "Path configuration inputs:" msgstr "" -#: ../../c-api/init_config.rst:1507 +#: ../../c-api/init_config.rst:1518 msgid ":c:member:`PyConfig.home`" msgstr ":c:member:`PyConfig.home`" -#: ../../c-api/init_config.rst:1508 +#: ../../c-api/init_config.rst:1519 msgid ":c:member:`PyConfig.platlibdir`" msgstr ":c:member:`PyConfig.platlibdir`" -#: ../../c-api/init_config.rst:1509 +#: ../../c-api/init_config.rst:1520 msgid ":c:member:`PyConfig.pathconfig_warnings`" msgstr ":c:member:`PyConfig.pathconfig_warnings`" -#: ../../c-api/init_config.rst:1510 +#: ../../c-api/init_config.rst:1521 msgid ":c:member:`PyConfig.program_name`" msgstr ":c:member:`PyConfig.program_name`" -#: ../../c-api/init_config.rst:1511 +#: ../../c-api/init_config.rst:1522 msgid ":c:member:`PyConfig.pythonpath_env`" msgstr ":c:member:`PyConfig.pythonpath_env`" -#: ../../c-api/init_config.rst:1512 +#: ../../c-api/init_config.rst:1523 msgid "current working directory: to get absolute paths" msgstr "" -#: ../../c-api/init_config.rst:1513 +#: ../../c-api/init_config.rst:1524 msgid "" "``PATH`` environment variable to get the program full path (from :c:member:" "`PyConfig.program_name`)" msgstr "" -#: ../../c-api/init_config.rst:1515 +#: ../../c-api/init_config.rst:1526 msgid "``__PYVENV_LAUNCHER__`` environment variable" msgstr "``__PYVENV_LAUNCHER__`` 環境變數" -#: ../../c-api/init_config.rst:1516 +#: ../../c-api/init_config.rst:1527 msgid "" "(Windows only) Application paths in the registry under " "\"Software\\Python\\PythonCore\\X.Y\\PythonPath\" of HKEY_CURRENT_USER and " "HKEY_LOCAL_MACHINE (where X.Y is the Python version)." msgstr "" -#: ../../c-api/init_config.rst:1520 +#: ../../c-api/init_config.rst:1531 msgid "Path configuration output fields:" msgstr "" -#: ../../c-api/init_config.rst:1522 +#: ../../c-api/init_config.rst:1533 msgid ":c:member:`PyConfig.base_exec_prefix`" msgstr ":c:member:`PyConfig.base_exec_prefix`" -#: ../../c-api/init_config.rst:1523 +#: ../../c-api/init_config.rst:1534 msgid ":c:member:`PyConfig.base_executable`" msgstr ":c:member:`PyConfig.base_executable`" -#: ../../c-api/init_config.rst:1524 +#: ../../c-api/init_config.rst:1535 msgid ":c:member:`PyConfig.base_prefix`" msgstr ":c:member:`PyConfig.base_prefix`" -#: ../../c-api/init_config.rst:1525 +#: ../../c-api/init_config.rst:1536 msgid ":c:member:`PyConfig.exec_prefix`" msgstr ":c:member:`PyConfig.exec_prefix`" -#: ../../c-api/init_config.rst:1526 +#: ../../c-api/init_config.rst:1537 msgid ":c:member:`PyConfig.executable`" msgstr ":c:member:`PyConfig.executable`" -#: ../../c-api/init_config.rst:1527 +#: ../../c-api/init_config.rst:1538 msgid "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" @@ -2121,11 +2134,11 @@ msgstr "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" -#: ../../c-api/init_config.rst:1529 +#: ../../c-api/init_config.rst:1540 msgid ":c:member:`PyConfig.prefix`" msgstr ":c:member:`PyConfig.prefix`" -#: ../../c-api/init_config.rst:1531 +#: ../../c-api/init_config.rst:1542 msgid "" "If at least one \"output field\" is not set, Python calculates the path " "configuration to fill unset fields. If :c:member:`~PyConfig." @@ -2134,7 +2147,7 @@ msgid "" "module_search_paths_set` is set to ``1``." msgstr "" -#: ../../c-api/init_config.rst:1537 +#: ../../c-api/init_config.rst:1548 msgid "" "It is possible to completely ignore the function calculating the default " "path configuration by setting explicitly all path configuration output " @@ -2144,52 +2157,52 @@ msgid "" "modification." msgstr "" -#: ../../c-api/init_config.rst:1544 +#: ../../c-api/init_config.rst:1555 msgid "" "Set :c:member:`~PyConfig.pathconfig_warnings` to ``0`` to suppress warnings " "when calculating the path configuration (Unix only, Windows does not log any " "warning)." msgstr "" -#: ../../c-api/init_config.rst:1547 +#: ../../c-api/init_config.rst:1558 msgid "" "If :c:member:`~PyConfig.base_prefix` or :c:member:`~PyConfig." "base_exec_prefix` fields are not set, they inherit their value from :c:" "member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` respectively." msgstr "" -#: ../../c-api/init_config.rst:1551 +#: ../../c-api/init_config.rst:1562 msgid ":c:func:`Py_RunMain` and :c:func:`Py_Main` modify :data:`sys.path`:" msgstr "" -#: ../../c-api/init_config.rst:1553 +#: ../../c-api/init_config.rst:1564 msgid "" "If :c:member:`~PyConfig.run_filename` is set and is a directory which " "contains a ``__main__.py`` script, prepend :c:member:`~PyConfig." "run_filename` to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1556 +#: ../../c-api/init_config.rst:1567 msgid "If :c:member:`~PyConfig.isolated` is zero:" msgstr "如果 :c:member:`~PyConfig.isolated` 為零:" -#: ../../c-api/init_config.rst:1558 +#: ../../c-api/init_config.rst:1569 msgid "" "If :c:member:`~PyConfig.run_module` is set, prepend the current directory " "to :data:`sys.path`. Do nothing if the current directory cannot be read." msgstr "" -#: ../../c-api/init_config.rst:1560 +#: ../../c-api/init_config.rst:1571 msgid "" "If :c:member:`~PyConfig.run_filename` is set, prepend the directory of the " "filename to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1562 +#: ../../c-api/init_config.rst:1573 msgid "Otherwise, prepend an empty string to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1564 +#: ../../c-api/init_config.rst:1575 msgid "" "If :c:member:`~PyConfig.site_import` is non-zero, :data:`sys.path` can be " "modified by the :mod:`site` module. If :c:member:`~PyConfig." @@ -2198,143 +2211,143 @@ msgid "" "data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1570 +#: ../../c-api/init_config.rst:1581 msgid "The following configuration files are used by the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1572 +#: ../../c-api/init_config.rst:1583 msgid "``pyvenv.cfg``" msgstr "``pyvenv.cfg``" -#: ../../c-api/init_config.rst:1573 +#: ../../c-api/init_config.rst:1584 msgid "``._pth`` file (ex: ``python._pth``)" msgstr "" -#: ../../c-api/init_config.rst:1574 +#: ../../c-api/init_config.rst:1585 msgid "``pybuilddir.txt`` (Unix only)" msgstr "``pybuilddir.txt``\\ (僅限 Unix)" -#: ../../c-api/init_config.rst:1576 +#: ../../c-api/init_config.rst:1587 msgid "If a ``._pth`` file is present:" msgstr "" -#: ../../c-api/init_config.rst:1578 +#: ../../c-api/init_config.rst:1589 msgid "Set :c:member:`~PyConfig.isolated` to ``1``." msgstr "將 :c:member:`~PyConfig.isolated` 設定為 ``1``。" -#: ../../c-api/init_config.rst:1579 +#: ../../c-api/init_config.rst:1590 msgid "Set :c:member:`~PyConfig.use_environment` to ``0``." msgstr "將 :c:member:`~PyConfig.use_environment` 設定為 ``0``。" -#: ../../c-api/init_config.rst:1580 +#: ../../c-api/init_config.rst:1591 msgid "Set :c:member:`~PyConfig.site_import` to ``0``." msgstr "將 :c:member:`~PyConfig.site_import` 設定為 ``0``。" -#: ../../c-api/init_config.rst:1581 +#: ../../c-api/init_config.rst:1592 msgid "Set :c:member:`~PyConfig.safe_path` to ``1``." msgstr "將 :c:member:`~PyConfig.safe_path` 設定為 ``1``。" -#: ../../c-api/init_config.rst:1583 +#: ../../c-api/init_config.rst:1594 msgid "" "The ``__PYVENV_LAUNCHER__`` environment variable is used to set :c:member:" "`PyConfig.base_executable`." msgstr "" -#: ../../c-api/init_config.rst:1588 +#: ../../c-api/init_config.rst:1599 msgid "Py_GetArgcArgv()" msgstr "Py_GetArgcArgv()" -#: ../../c-api/init_config.rst:1592 +#: ../../c-api/init_config.rst:1603 msgid "Get the original command line arguments, before Python modified them." msgstr "" -#: ../../c-api/init_config.rst:1594 +#: ../../c-api/init_config.rst:1605 msgid "See also :c:member:`PyConfig.orig_argv` member." msgstr "也請參與 :c:member:`PyConfig.orig_argv` 成員。" -#: ../../c-api/init_config.rst:1598 +#: ../../c-api/init_config.rst:1609 msgid "Multi-Phase Initialization Private Provisional API" msgstr "" -#: ../../c-api/init_config.rst:1600 +#: ../../c-api/init_config.rst:1611 msgid "" "This section is a private provisional API introducing multi-phase " "initialization, the core feature of :pep:`432`:" msgstr "" -#: ../../c-api/init_config.rst:1603 +#: ../../c-api/init_config.rst:1614 msgid "\"Core\" initialization phase, \"bare minimum Python\":" msgstr "" -#: ../../c-api/init_config.rst:1605 +#: ../../c-api/init_config.rst:1616 msgid "Builtin types;" msgstr "內建型別;" -#: ../../c-api/init_config.rst:1606 +#: ../../c-api/init_config.rst:1617 msgid "Builtin exceptions;" msgstr "內建例外;" -#: ../../c-api/init_config.rst:1607 +#: ../../c-api/init_config.rst:1618 msgid "Builtin and frozen modules;" msgstr "" -#: ../../c-api/init_config.rst:1608 +#: ../../c-api/init_config.rst:1619 msgid "" "The :mod:`sys` module is only partially initialized (ex: :data:`sys.path` " "doesn't exist yet)." msgstr "" -#: ../../c-api/init_config.rst:1611 +#: ../../c-api/init_config.rst:1622 msgid "\"Main\" initialization phase, Python is fully initialized:" msgstr "" -#: ../../c-api/init_config.rst:1613 +#: ../../c-api/init_config.rst:1624 msgid "Install and configure :mod:`importlib`;" msgstr "" -#: ../../c-api/init_config.rst:1614 +#: ../../c-api/init_config.rst:1625 msgid "Apply the :ref:`Path Configuration <init-path-config>`;" msgstr "" -#: ../../c-api/init_config.rst:1615 +#: ../../c-api/init_config.rst:1626 msgid "Install signal handlers;" msgstr "" -#: ../../c-api/init_config.rst:1616 +#: ../../c-api/init_config.rst:1627 msgid "" "Finish :mod:`sys` module initialization (ex: create :data:`sys.stdout` and :" "data:`sys.path`);" msgstr "" -#: ../../c-api/init_config.rst:1618 +#: ../../c-api/init_config.rst:1629 msgid "" "Enable optional features like :mod:`faulthandler` and :mod:`tracemalloc`;" msgstr "" -#: ../../c-api/init_config.rst:1619 +#: ../../c-api/init_config.rst:1630 msgid "Import the :mod:`site` module;" msgstr "引入 :mod:`site` 模組;" -#: ../../c-api/init_config.rst:1620 +#: ../../c-api/init_config.rst:1631 msgid "etc." msgstr "" -#: ../../c-api/init_config.rst:1622 +#: ../../c-api/init_config.rst:1633 msgid "Private provisional API:" msgstr "" -#: ../../c-api/init_config.rst:1624 +#: ../../c-api/init_config.rst:1635 msgid "" ":c:member:`PyConfig._init_main`: if set to ``0``, :c:func:" "`Py_InitializeFromConfig` stops at the \"Core\" initialization phase." msgstr "" -#: ../../c-api/init_config.rst:1629 +#: ../../c-api/init_config.rst:1640 msgid "" "Move to the \"Main\" initialization phase, finish the Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1631 +#: ../../c-api/init_config.rst:1642 msgid "" "No module is imported during the \"Core\" phase and the ``importlib`` module " "is not configured: the :ref:`Path Configuration <init-path-config>` is only " @@ -2343,14 +2356,14 @@ msgid "" "maybe install a custom :data:`sys.meta_path` importer or an import hook, etc." msgstr "" -#: ../../c-api/init_config.rst:1637 +#: ../../c-api/init_config.rst:1648 msgid "" "It may become possible to calculate the :ref:`Path Configuration <init-path-" "config>` in Python, after the Core phase and before the Main phase, which is " "one of the :pep:`432` motivation." msgstr "" -#: ../../c-api/init_config.rst:1641 +#: ../../c-api/init_config.rst:1652 msgid "" "The \"Core\" phase is not properly defined: what should be and what should " "not be available at this phase is not specified yet. The API is marked as " @@ -2358,13 +2371,13 @@ msgid "" "until a proper public API is designed." msgstr "" -#: ../../c-api/init_config.rst:1646 +#: ../../c-api/init_config.rst:1657 msgid "" "Example running Python code between \"Core\" and \"Main\" initialization " "phases::" msgstr "" -#: ../../c-api/init_config.rst:1649 +#: ../../c-api/init_config.rst:1660 msgid "" "void init_python(void)\n" "{\n" diff --git a/c-api/object.po b/c-api/object.po index d557e3d5c6..5898ca290c 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-12-14 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -623,6 +623,13 @@ msgstr "" #: ../../c-api/object.rst:514 msgid "" +"This is equivalent to the Python ``__iter__(self): return self`` method. It " +"is intended for :term:`iterator` types, to be used in the :c:member:" +"`PyTypeObject.tp_iter` slot." +msgstr "" + +#: ../../c-api/object.rst:520 +msgid "" "This is the equivalent to the Python expression ``aiter(o)``. Takes an :" "class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it. " "This is typically a new iterator but if the argument is an :class:" @@ -630,67 +637,67 @@ msgid "" "``NULL`` if the object cannot be iterated." msgstr "" -#: ../../c-api/object.rst:524 +#: ../../c-api/object.rst:530 msgid "Get a pointer to subclass-specific data reserved for *cls*." msgstr "" -#: ../../c-api/object.rst:526 +#: ../../c-api/object.rst:532 msgid "" "The object *o* must be an instance of *cls*, and *cls* must have been " "created using negative :c:member:`PyType_Spec.basicsize`. Python does not " "check this." msgstr "" -#: ../../c-api/object.rst:530 +#: ../../c-api/object.rst:536 msgid "On error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/object.rst:536 +#: ../../c-api/object.rst:542 msgid "" "Return the size of the instance memory space reserved for *cls*, i.e. the " "size of the memory :c:func:`PyObject_GetTypeData` returns." msgstr "" -#: ../../c-api/object.rst:539 +#: ../../c-api/object.rst:545 msgid "" "This may be larger than requested using :c:member:`-PyType_Spec.basicsize " "<PyType_Spec.basicsize>`; it is safe to use this larger size (e.g. with :c:" "func:`!memset`)." msgstr "" -#: ../../c-api/object.rst:542 +#: ../../c-api/object.rst:548 msgid "" "The type *cls* **must** have been created using negative :c:member:" "`PyType_Spec.basicsize`. Python does not check this." msgstr "" -#: ../../c-api/object.rst:546 +#: ../../c-api/object.rst:552 msgid "On error, set an exception and return a negative value." msgstr "" -#: ../../c-api/object.rst:552 +#: ../../c-api/object.rst:558 msgid "" "Get a pointer to per-item data for a class with :c:macro:" "`Py_TPFLAGS_ITEMS_AT_END`." msgstr "" -#: ../../c-api/object.rst:555 +#: ../../c-api/object.rst:561 msgid "" "On error, set an exception and return ``NULL``. :py:exc:`TypeError` is " "raised if *o* does not have :c:macro:`Py_TPFLAGS_ITEMS_AT_END` set." msgstr "" -#: ../../c-api/object.rst:563 +#: ../../c-api/object.rst:569 msgid "Visit the managed dictionary of *obj*." msgstr "" -#: ../../c-api/object.rst:565 ../../c-api/object.rst:574 +#: ../../c-api/object.rst:571 ../../c-api/object.rst:580 msgid "" "This function must only be called in a traverse function of the type which " "has the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." msgstr "" -#: ../../c-api/object.rst:572 +#: ../../c-api/object.rst:578 msgid "Clear the managed dictionary of *obj*." msgstr "" diff --git a/c-api/stable.po b/c-api/stable.po index 919634426e..5aa8323e0c 100644 --- a/c-api/stable.po +++ b/c-api/stable.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-19 00:03+0000\n" +"POT-Creation-Date: 2024-12-04 00:14+0000\n" "PO-Revision-Date: 2023-01-24 21:07+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -134,13 +134,13 @@ msgstr "受限 C API" #: ../../c-api/stable.rst:67 msgid "" "Python 3.2 introduced the *Limited API*, a subset of Python's C API. " -"Extensions that only use the Limited API can be compiled once and work with " -"multiple versions of Python. Contents of the Limited API are :ref:`listed " +"Extensions that only use the Limited API can be compiled once and be loaded " +"on multiple versions of Python. Contents of the Limited API are :ref:`listed " "below <limited-api-list>`." msgstr "" "Python 3.2 引入了\\ *受限 API (Limited API)*,它是 Python C API 的一個子集。" -"僅使用受限 API 的擴充可以只編譯一次就使用於多個版本的 Python。受限 API 的內容" -"\\ :ref:`列在下方 <limited-api-list>`。" +"僅使用受限 API 的擴充可以只編譯一次就被載入於多個版本的 Python。受限 API 的內" +"容\\ :ref:`列在下方 <limited-api-list>`。" #: ../../c-api/stable.rst:74 msgid "" @@ -153,13 +153,12 @@ msgstr "" msgid "" "Define ``Py_LIMITED_API`` to the value of :c:macro:`PY_VERSION_HEX` " "corresponding to the lowest Python version your extension supports. The " -"extension will work without recompilation with all Python 3 releases from " -"the specified one onward, and can use Limited API introduced up to that " -"version." +"extension will be ABI-compatible with all Python 3 releases from the " +"specified one onward, and can use Limited API introduced up to that version." msgstr "" "將 ``Py_LIMITED_API`` 定義為對應於你的擴充有支援的最低 Python 版本的 :c:" -"macro:`PY_VERSION_HEX` 值。該擴充無需重新編譯即可與從指定版本開始的所有 " -"Python 3 版本一起使用,並且可以使用過去版本有引入的受限 API。" +"macro:`PY_VERSION_HEX` 值。該擴充與從指定版本開始的所有 Python 3 版本之 ABI " +"相容,並且可以使用過去版本有引入的受限 API。" #: ../../c-api/stable.rst:83 msgid "" @@ -186,12 +185,21 @@ msgstr "穩定 ABI" #: ../../c-api/stable.rst:96 msgid "" "To enable this, Python provides a *Stable ABI*: a set of symbols that will " -"remain compatible across Python 3.x versions." +"remain ABI-compatible across Python 3.x versions." msgstr "" "為了實現它,Python 提供了一個\\ *穩定 ABI (Stable ABI)*:一組將在各個 Python " -"3.x 版本之間保持相容的符號。" +"3.x 版本之間保持 ABI 相容的符號。" -#: ../../c-api/stable.rst:99 +#: ../../c-api/stable.rst:101 +msgid "" +"The Stable ABI prevents ABI issues, like linker errors due to missing " +"symbols or data corruption due to changes in structure layouts or function " +"signatures. However, other changes in Python can change the *behavior* of " +"extensions. See Python's Backwards Compatibility Policy (:pep:`387`) for " +"details." +msgstr "" + +#: ../../c-api/stable.rst:107 msgid "" "The Stable ABI contains symbols exposed in the :ref:`Limited API <limited-c-" "api>`, but also other ones – for example, functions necessary to support " @@ -200,7 +208,7 @@ msgstr "" "穩定 ABI 被包含在\\ :ref:`受限 API <limited-c-api>` 中開放的符號,但也包含其" "他符號 - 例如,支援舊版受限 API 所必需的函式。" -#: ../../c-api/stable.rst:103 +#: ../../c-api/stable.rst:111 msgid "" "On Windows, extensions that use the Stable ABI should be linked against " "``python3.dll`` rather than a version-specific library such as ``python39." @@ -209,7 +217,7 @@ msgstr "" "在 Windows 上,使用穩定 ABI 的擴充應該連接到 ``python3.dll`` 而不是特定版本的" "函式庫,例如 ``python39.dll``。" -#: ../../c-api/stable.rst:107 +#: ../../c-api/stable.rst:115 msgid "" "On some platforms, Python will look for and load shared library files named " "with the ``abi3`` tag (e.g. ``mymodule.abi3.so``). It does not check if such " @@ -222,7 +230,7 @@ msgstr "" "用者(或者打包工具)身上,例如使用 3.10+ 受限 API 建置的擴充不會為較低版本的 " "Python 所安裝。" -#: ../../c-api/stable.rst:114 +#: ../../c-api/stable.rst:122 msgid "" "All functions in the Stable ABI are present as functions in Python's shared " "library, not solely as macros. This makes them usable from languages that " @@ -231,18 +239,18 @@ msgstr "" "穩定 ABI 中的所有函式都作為函式存在於 Python 的共享函式庫中,而不僅是作為巨" "集。這使得它們可被用於不使用 C 預處理器 (preprocessor) 的語言。" -#: ../../c-api/stable.rst:120 +#: ../../c-api/stable.rst:128 msgid "Limited API Scope and Performance" msgstr "受限 API 範圍和性能" -#: ../../c-api/stable.rst:122 +#: ../../c-api/stable.rst:130 msgid "" "The goal for the Limited API is to allow everything that is possible with " "the full C API, but possibly with a performance penalty." msgstr "" "受限 API 的目標是允許使用完整的 C API 進行所有可能的操作,但可能會降低性能。" -#: ../../c-api/stable.rst:125 +#: ../../c-api/stable.rst:133 msgid "" "For example, while :c:func:`PyList_GetItem` is available, its “unsafe” macro " "variant :c:func:`PyList_GET_ITEM` is not. The macro can be faster because it " @@ -252,7 +260,7 @@ msgstr "" "`PyList_GET_ITEM` 為不可用。巨集運行可以更快,因為它可以依賴 list 物件的特定" "版本實作細節。" -#: ../../c-api/stable.rst:130 +#: ../../c-api/stable.rst:138 msgid "" "Without ``Py_LIMITED_API`` defined, some C API functions are inlined or " "replaced by macros. Defining ``Py_LIMITED_API`` disables this inlining, " @@ -263,7 +271,7 @@ msgstr "" "``Py_LIMITED_API`` 會禁用嵌入,從而隨著 Python 資料結構的改進而提高穩定性,但" "可能會降低性能。" -#: ../../c-api/stable.rst:135 +#: ../../c-api/stable.rst:143 msgid "" "By leaving out the ``Py_LIMITED_API`` definition, it is possible to compile " "a Limited API extension with a version-specific ABI. This can improve " @@ -277,11 +285,11 @@ msgstr "" "將產生一個擴充,可以在特定版本的擴充不可用的地方發布 — 例如,用於即將發布的 " "Python 版本的預發布版本 (prerelease)。" -#: ../../c-api/stable.rst:144 +#: ../../c-api/stable.rst:152 msgid "Limited API Caveats" msgstr "受限 API 注意事項" -#: ../../c-api/stable.rst:146 +#: ../../c-api/stable.rst:154 msgid "" "Note that compiling with ``Py_LIMITED_API`` is *not* a complete guarantee " "that code conforms to the :ref:`Limited API <limited-c-api>` or the :ref:" @@ -293,7 +301,7 @@ msgstr "" "``Py_LIMITED_API`` 僅涵蓋定義,但 API 還包括其他議題,例如預期的語義 " "(semantic)。" -#: ../../c-api/stable.rst:151 +#: ../../c-api/stable.rst:159 msgid "" "One issue that ``Py_LIMITED_API`` does not guard against is calling a " "function with arguments that are invalid in a lower Python version. For " @@ -307,7 +315,7 @@ msgstr "" "現在代表選擇預設行為,但在 Python 3.8 中,引數將被直接使用,導致 ``NULL`` 取" "消參照 (dereference) 且崩潰 (crash)。類似的引數適用於結構 (struct) 的欄位。" -#: ../../c-api/stable.rst:158 +#: ../../c-api/stable.rst:166 msgid "" "Another issue is that some struct fields are currently not hidden when " "``Py_LIMITED_API`` is defined, even though they're part of the Limited API." @@ -315,7 +323,7 @@ msgstr "" "另一個問題是,當有定義 ``Py_LIMITED_API`` 時,一些結構欄位目前不會被隱藏,即" "使它們是受限 API 的一部分。" -#: ../../c-api/stable.rst:161 +#: ../../c-api/stable.rst:169 msgid "" "For these reasons, we recommend testing an extension with *all* minor Python " "versions it supports, and preferably to build with the *lowest* such version." @@ -323,7 +331,7 @@ msgstr "" "出於這些原因,我們建議要以它支援的\\ *所有*\\ 次要 Python 版本來測試擴充,並" "且最好使用\\ *最低*\\ 版本進行建置。" -#: ../../c-api/stable.rst:164 +#: ../../c-api/stable.rst:172 msgid "" "We also recommend reviewing documentation of all used API to check if it is " "explicitly part of the Limited API. Even with ``Py_LIMITED_API`` defined, a " @@ -334,7 +342,7 @@ msgstr "" "義 ``Py_LIMITED_API``,一些私有聲明也會因為技術原因(或者甚至是無意地,例如臭" "蟲)而被公開出來。" -#: ../../c-api/stable.rst:169 +#: ../../c-api/stable.rst:177 msgid "" "Also note that the Limited API is not necessarily stable: compiling with " "``Py_LIMITED_API`` with Python 3.8 means that the extension will run with " @@ -346,11 +354,11 @@ msgstr "" "行編譯意味著擴充將能以 Python 3.12 運行,但不一定能以 Python 3.12 *編譯*。特" "別是如果穩定 ABI 保持穩定,部分受限 API 可能會被棄用和刪除。" -#: ../../c-api/stable.rst:179 +#: ../../c-api/stable.rst:187 msgid "Platform Considerations" msgstr "平台注意事項" -#: ../../c-api/stable.rst:181 +#: ../../c-api/stable.rst:189 msgid "" "ABI stability depends not only on Python, but also on the compiler used, " "lower-level libraries and compiler options. For the purposes of the :ref:" @@ -361,7 +369,7 @@ msgstr "" "於\\ :ref:`穩定 ABI <stable-abi>` 的目的,這些細節定義了一個「平台」。它們通" "常取決於作業系統種類和處理器架構" -#: ../../c-api/stable.rst:186 +#: ../../c-api/stable.rst:194 msgid "" "It is the responsibility of each particular distributor of Python to ensure " "that all Python versions on a particular platform are built in a way that " @@ -372,11 +380,11 @@ msgstr "" "定 ABI 的方式建置。``python.org`` 和許多第三方發布者發布的 Windows 和 macOS " "版本就是這種情況。" -#: ../../c-api/stable.rst:196 +#: ../../c-api/stable.rst:204 msgid "Contents of Limited API" msgstr "受限 API 的內容" -#: ../../c-api/stable.rst:199 +#: ../../c-api/stable.rst:207 msgid "" "Currently, the :ref:`Limited API <limited-c-api>` includes the following " "items:" diff --git a/c-api/sys.po b/c-api/sys.po index 5fa011518f..9037d85432 100644 --- a/c-api/sys.po +++ b/c-api/sys.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-12-12 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -486,6 +486,10 @@ msgid "" "should be called by *func*." msgstr "" +#: ../../c-api/sys.rst:432 +msgid ":c:func:`PyUnstable_AtExit` for passing a ``void *data`` argument." +msgstr "" + #: ../../c-api/sys.rst:101 msgid "USE_STACKCHECK (C macro)" msgstr "USE_STACKCHECK(C 巨集)" diff --git a/c-api/type.po b/c-api/type.po index 9ca76377b5..570d06ce19 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2024-12-01 15:01+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -602,24 +602,24 @@ msgid "" "`PyType_FromSpecWithBases` instead." msgstr "" -#: ../../c-api/type.rst:517 +#: ../../c-api/type.rst:515 msgid "Slots in :c:type:`PyBufferProcs` may be set in the unlimited API." msgstr "" -#: ../../c-api/type.rst:519 +#: ../../c-api/type.rst:518 msgid "" ":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." "bf_releasebuffer` are now available under the :ref:`limited API <limited-c-" "api>`." msgstr "" -#: ../../c-api/type.rst:526 +#: ../../c-api/type.rst:525 msgid "" "The desired value of the slot. In most cases, this is a pointer to a " "function." msgstr "" -#: ../../c-api/type.rst:529 +#: ../../c-api/type.rst:528 msgid "Slots other than ``Py_tp_doc`` may not be ``NULL``." msgstr "" diff --git a/howto/gdb_helpers.po b/howto/gdb_helpers.po index 67e53cc2e0..4dae44f916 100644 --- a/howto/gdb_helpers.po +++ b/howto/gdb_helpers.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-12 00:04+0000\n" +"POT-Creation-Date: 2024-12-06 00:14+0000\n" "PO-Revision-Date: 2024-05-11 14:42+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -391,16 +391,20 @@ msgstr "" #: ../../howto/gdb_helpers.rst:183 msgid "" "The internal structure can be revealed with a cast to :c:expr:`PyLongObject " -"*`:" -msgstr "可以透過轉換 (cast) 為 :c:expr:`PyLongObject *` 來揭示內部結構:" +"*`::" +msgstr "可以透過轉換 (cast) 為 :c:expr:`PyLongObject *` 來揭示內部結構: ::" #: ../../howto/gdb_helpers.rst:185 msgid "" -"(gdb) p *(PyLongObject*)some_python_integer $5 = {ob_base = {ob_base = " -"{ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1}, ob_digit = {42}}" +"(gdb) p *(PyLongObject*)some_python_integer\n" +"$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size " +"= 1},\n" +"ob_digit = {42}}" msgstr "" -"(gdb) p *(PyLongObject*)some_python_integer $5 = {ob_base = {ob_base = " -"{ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size = 1}, ob_digit = {42}}" +"(gdb) p *(PyLongObject*)some_python_integer\n" +"$5 = {ob_base = {ob_base = {ob_refcnt = 8, ob_type = 0x3dad39f5e0}, ob_size " +"= 1},\n" +"ob_digit = {42}}" #: ../../howto/gdb_helpers.rst:189 msgid "" diff --git a/library/ast.po b/library/ast.po index 2bfa5f5ae3..a117a57e5a 100644 --- a/library/ast.po +++ b/library/ast.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2024-12-15 17:05+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -3194,7 +3194,7 @@ msgstr "" #: ../../library/ast.rst:1803 msgid "" -">>> print(ast.dump(ast.parse(\"type Alias[**P = (int, str)] = Callable[P, " +">>> print(ast.dump(ast.parse(\"type Alias[**P = [int, str]] = Callable[P, " "int]\"), indent=4))\n" "Module(\n" " body=[\n" @@ -3203,7 +3203,7 @@ msgid "" " type_params=[\n" " ParamSpec(\n" " name='P',\n" -" default_value=Tuple(\n" +" default_value=List(\n" " elts=[\n" " Name(id='int', ctx=Load()),\n" " Name(id='str', ctx=Load())],\n" @@ -3217,7 +3217,7 @@ msgid "" " ctx=Load()),\n" " ctx=Load()))])" msgstr "" -">>> print(ast.dump(ast.parse(\"type Alias[**P = (int, str)] = Callable[P, " +">>> print(ast.dump(ast.parse(\"type Alias[**P = [int, str]] = Callable[P, " "int]\"), indent=4))\n" "Module(\n" " body=[\n" @@ -3226,7 +3226,7 @@ msgstr "" " type_params=[\n" " ParamSpec(\n" " name='P',\n" -" default_value=Tuple(\n" +" default_value=List(\n" " elts=[\n" " Name(id='int', ctx=Load()),\n" " Name(id='str', ctx=Load())],\n" diff --git a/library/collections.po b/library/collections.po index b2cd7486d9..abc99d12e2 100644 --- a/library/collections.po +++ b/library/collections.po @@ -1,16 +1,15 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # 周 忠毅 <rilakcrc35@gmail.com>, 2016 # Adrian Liaw <adrianliaw2000@gmail.com>, 2018 -# Matt Wang <mattwang44@gmail.com>, 2022 +# Matt Wang <mattwang44@gmail.com>, 2022-2024 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-28 00:13+0000\n" +"POT-Creation-Date: 2024-12-03 00:15+0000\n" "PO-Revision-Date: 2024-01-22 21:42+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1228,19 +1227,19 @@ msgstr "" msgid "" "When each key is encountered for the first time, it is not already in the " "mapping; so an entry is automatically created using the :attr:`~defaultdict." -"default_factory` function which returns an empty :class:`list`. The :meth:" -"`list.append` operation then attaches the value to the new list. When keys " +"default_factory` function which returns an empty :class:`list`. The :meth:`!" +"list.append` operation then attaches the value to the new list. When keys " "are encountered again, the look-up proceeds normally (returning the list for " -"that key) and the :meth:`list.append` operation adds another value to the " +"that key) and the :meth:`!list.append` operation adds another value to the " "list. This technique is simpler and faster than an equivalent technique " "using :meth:`dict.setdefault`:" msgstr "" "當每個鍵第一次被存取時,它還沒有存在於對映中,所以會自動呼叫 :attr:" "`~defaultdict.default_factory` 方法來回傳一個空的 :class:`list` 以建立一個條" -"目,:meth:`list.append` 操作後續會再新增值到這個新的列表裡。當再次存取該鍵" -"時,就如普通字典般操作(回傳該鍵所對應到的 list),:meth:`list.append` 也會新" -"增另一個值到 list 中。和使用與其等價的 :meth:`dict.setdefault` 相比,這個技巧" -"更加快速和簡單:" +"目,:meth:`!list.append` 操作後續會再新增值到這個新的列表裡。當再次存取該鍵" +"時,就如普通字典般操作(回傳該鍵所對應到的 list),:meth:`!list.append` 也會" +"新增另一個值到 list 中。和使用與其等價的 :meth:`dict.setdefault` 相比,這個技" +"巧更加快速和簡單:" #: ../../library/collections.rst:799 msgid "" diff --git a/library/dis.po b/library/dis.po index 6cf423905f..74ac573ea5 100644 --- a/library/dis.po +++ b/library/dis.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-05 00:13+0000\n" +"POT-Creation-Date: 2024-12-03 00:15+0000\n" "PO-Revision-Date: 2018-07-27 16:55+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1119,7 +1119,7 @@ msgid "" "class:`tuple` containing the corresponding values. Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:994 ../../library/dis.rst:1665 +#: ../../library/dis.rst:994 ../../library/dis.rst:1686 msgid "" "Previously, this instruction also pushed a boolean value indicating success " "(``True``) or failure (``False``)." @@ -1534,45 +1534,64 @@ msgstr "" #: ../../library/dis.rst:1388 msgid "" +"Pushes references to ``co_varnames[var_nums >> 4]`` and " +"``co_varnames[var_nums & 15]`` onto the stack." +msgstr "" + +#: ../../library/dis.rst:1395 +msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack, " "raising an :exc:`UnboundLocalError` if the local variable has not been " "initialized." msgstr "" -#: ../../library/dis.rst:1396 +#: ../../library/dis.rst:1403 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack (or " "pushes ``NULL`` onto the stack if the local variable has not been " "initialized) and sets ``co_varnames[var_num]`` to ``NULL``." msgstr "" -#: ../../library/dis.rst:1404 +#: ../../library/dis.rst:1411 msgid "Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1409 +#: ../../library/dis.rst:1415 +msgid "" +"Stores ``STACK[-1]`` into ``co_varnames[var_nums >> 4]`` and ``STACK[-2]`` " +"into ``co_varnames[var_nums & 15]``." +msgstr "" + +#: ../../library/dis.rst:1422 +msgid "" +"Stores ``STACK.pop()`` into the local ``co_varnames[var_nums >> 4]`` and " +"pushes a reference to the local ``co_varnames[var_nums & 15]`` onto the " +"stack." +msgstr "" + +#: ../../library/dis.rst:1430 msgid "Deletes local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1414 +#: ../../library/dis.rst:1435 msgid "" "Creates a new cell in slot ``i``. If that slot is nonempty then that value " "is stored into the new cell." msgstr "" -#: ../../library/dis.rst:1422 +#: ../../library/dis.rst:1443 msgid "" "Loads the cell contained in slot ``i`` of the \"fast locals\" storage. " "Pushes a reference to the object the cell contains on the stack." msgstr "" -#: ../../library/dis.rst:1425 ../../library/dis.rst:1447 -#: ../../library/dis.rst:1458 +#: ../../library/dis.rst:1446 ../../library/dis.rst:1468 +#: ../../library/dis.rst:1479 msgid "" "``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`." msgstr "" -#: ../../library/dis.rst:1431 +#: ../../library/dis.rst:1452 msgid "" "Pops a mapping off the stack and looks up the name associated with slot " "``i`` of the \"fast locals\" storage in this mapping. If the name is not " @@ -1583,112 +1602,112 @@ msgid "" "class bodies." msgstr "" -#: ../../library/dis.rst:1444 +#: ../../library/dis.rst:1465 msgid "" "Stores ``STACK.pop()`` into the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1453 +#: ../../library/dis.rst:1474 msgid "" "Empties the cell contained in slot ``i`` of the \"fast locals\" storage. " "Used by the :keyword:`del` statement." msgstr "" -#: ../../library/dis.rst:1464 +#: ../../library/dis.rst:1485 msgid "" "Copies the ``n`` :term:`free (closure) variables <closure variable>` from " "the closure into the frame. Removes the need for special code on the " "caller's side when calling closures." msgstr "" -#: ../../library/dis.rst:1473 +#: ../../library/dis.rst:1494 msgid "" "Raises an exception using one of the 3 forms of the ``raise`` statement, " "depending on the value of *argc*:" msgstr "" -#: ../../library/dis.rst:1476 +#: ../../library/dis.rst:1497 msgid "0: ``raise`` (re-raise previous exception)" msgstr "" -#: ../../library/dis.rst:1477 +#: ../../library/dis.rst:1498 msgid "" "1: ``raise STACK[-1]`` (raise exception instance or type at ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1478 +#: ../../library/dis.rst:1499 msgid "" "2: ``raise STACK[-2] from STACK[-1]`` (raise exception instance or type at " "``STACK[-2]`` with ``__cause__`` set to ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1484 +#: ../../library/dis.rst:1505 msgid "" "Calls a callable object with the number of arguments specified by ``argc``. " "On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1487 ../../library/dis.rst:1511 +#: ../../library/dis.rst:1508 ../../library/dis.rst:1532 msgid "The callable" msgstr "" -#: ../../library/dis.rst:1488 ../../library/dis.rst:1512 +#: ../../library/dis.rst:1509 ../../library/dis.rst:1533 msgid "``self`` or ``NULL``" msgstr "" -#: ../../library/dis.rst:1489 ../../library/dis.rst:1513 +#: ../../library/dis.rst:1510 ../../library/dis.rst:1534 msgid "The remaining positional arguments" msgstr "" -#: ../../library/dis.rst:1491 +#: ../../library/dis.rst:1512 msgid "``argc`` is the total of the positional arguments, excluding ``self``." msgstr "" -#: ../../library/dis.rst:1493 +#: ../../library/dis.rst:1514 msgid "" "``CALL`` pops all arguments and the callable object off the stack, calls the " "callable object with those arguments, and pushes the return value returned " "by the callable object." msgstr "" -#: ../../library/dis.rst:1499 +#: ../../library/dis.rst:1520 msgid "The callable now always appears at the same position on the stack." msgstr "" -#: ../../library/dis.rst:1502 +#: ../../library/dis.rst:1523 msgid "Calls with keyword arguments are now handled by :opcode:`CALL_KW`." msgstr "" -#: ../../library/dis.rst:1508 +#: ../../library/dis.rst:1529 msgid "" "Calls a callable object with the number of arguments specified by ``argc``, " "including one or more named arguments. On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1514 +#: ../../library/dis.rst:1535 msgid "The named arguments" msgstr "" -#: ../../library/dis.rst:1515 +#: ../../library/dis.rst:1536 msgid "A :class:`tuple` of keyword argument names" msgstr "" -#: ../../library/dis.rst:1517 +#: ../../library/dis.rst:1538 msgid "" "``argc`` is the total of the positional and named arguments, excluding " "``self``. The length of the tuple of keyword argument names is the number of " "named arguments." msgstr "" -#: ../../library/dis.rst:1520 +#: ../../library/dis.rst:1541 msgid "" "``CALL_KW`` pops all arguments, the keyword names, and the callable object " "off the stack, calls the callable object with those arguments, and pushes " "the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1529 +#: ../../library/dis.rst:1550 msgid "" "Calls a callable object with variable set of positional and keyword " "arguments. If the lowest bit of *flags* is set, the top of the stack " @@ -1700,33 +1719,33 @@ msgid "" "arguments, and pushes the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1544 +#: ../../library/dis.rst:1565 msgid "" "Pushes a ``NULL`` to the stack. Used in the call sequence to match the " "``NULL`` pushed by :opcode:`LOAD_METHOD` for non-method calls." msgstr "" -#: ../../library/dis.rst:1553 +#: ../../library/dis.rst:1574 msgid "" "Pushes a new function object on the stack built from the code object at " "``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:1555 +#: ../../library/dis.rst:1576 msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" msgstr "" -#: ../../library/dis.rst:1558 +#: ../../library/dis.rst:1579 msgid "Qualified name at ``STACK[-1]`` was removed." msgstr "" -#: ../../library/dis.rst:1561 +#: ../../library/dis.rst:1582 msgid "" "Extra function attributes on the stack, signaled by oparg flags, were " "removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`." msgstr "" -#: ../../library/dis.rst:1568 +#: ../../library/dis.rst:1589 msgid "" "Sets an attribute on a function object. Expects the function at " "``STACK[-1]`` and the attribute value to set at ``STACK[-2]``; consumes both " @@ -1734,42 +1753,42 @@ msgid "" "attribute to set:" msgstr "" -#: ../../library/dis.rst:1572 +#: ../../library/dis.rst:1593 msgid "" "``0x01`` a tuple of default values for positional-only and positional-or-" "keyword parameters in positional order" msgstr "" -#: ../../library/dis.rst:1574 +#: ../../library/dis.rst:1595 msgid "``0x02`` a dictionary of keyword-only parameters' default values" msgstr "" -#: ../../library/dis.rst:1575 +#: ../../library/dis.rst:1596 msgid "``0x04`` a tuple of strings containing parameters' annotations" msgstr "" -#: ../../library/dis.rst:1576 +#: ../../library/dis.rst:1597 msgid "``0x08`` a tuple containing cells for free variables, making a closure" msgstr "" -#: ../../library/dis.rst:1585 +#: ../../library/dis.rst:1606 msgid "" "Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, " "implements::" msgstr "" -#: ../../library/dis.rst:1587 +#: ../../library/dis.rst:1608 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" "STACK.append(slice(start, end))" msgstr "" -#: ../../library/dis.rst:1591 +#: ../../library/dis.rst:1612 msgid "if it is 3, implements::" msgstr "" -#: ../../library/dis.rst:1593 +#: ../../library/dis.rst:1614 msgid "" "step = STACK.pop()\n" "end = STACK.pop()\n" @@ -1781,11 +1800,11 @@ msgstr "" "start = STACK.pop()\n" "STACK.append(slice(start, end, step))" -#: ../../library/dis.rst:1598 +#: ../../library/dis.rst:1619 msgid "See the :func:`slice` built-in function for more information." msgstr "" -#: ../../library/dis.rst:1603 +#: ../../library/dis.rst:1624 msgid "" "Prefixes any opcode which has an argument too big to fit into the default " "one byte. *ext* holds an additional byte which act as higher bits in the " @@ -1793,11 +1812,11 @@ msgid "" "allowed, forming an argument from two-byte to four-byte." msgstr "" -#: ../../library/dis.rst:1611 +#: ../../library/dis.rst:1632 msgid "Convert value to a string, depending on ``oparg``::" msgstr "" -#: ../../library/dis.rst:1613 +#: ../../library/dis.rst:1634 msgid "" "value = STACK.pop()\n" "result = func(value)\n" @@ -1807,28 +1826,28 @@ msgstr "" "result = func(value)\n" "STACK.append(result)" -#: ../../library/dis.rst:1617 +#: ../../library/dis.rst:1638 msgid "``oparg == 1``: call :func:`str` on *value*" msgstr "" -#: ../../library/dis.rst:1618 +#: ../../library/dis.rst:1639 msgid "``oparg == 2``: call :func:`repr` on *value*" msgstr "" -#: ../../library/dis.rst:1619 +#: ../../library/dis.rst:1640 msgid "``oparg == 3``: call :func:`ascii` on *value*" msgstr "" -#: ../../library/dis.rst:1621 ../../library/dis.rst:1634 -#: ../../library/dis.rst:1647 +#: ../../library/dis.rst:1642 ../../library/dis.rst:1655 +#: ../../library/dis.rst:1668 msgid "Used for implementing formatted literal strings (f-strings)." msgstr "" -#: ../../library/dis.rst:1628 +#: ../../library/dis.rst:1649 msgid "Formats the value on top of stack::" msgstr "" -#: ../../library/dis.rst:1630 +#: ../../library/dis.rst:1651 msgid "" "value = STACK.pop()\n" "result = value.__format__(\"\")\n" @@ -1838,11 +1857,11 @@ msgstr "" "result = value.__format__(\"\")\n" "STACK.append(result)" -#: ../../library/dis.rst:1640 +#: ../../library/dis.rst:1661 msgid "Formats the given value with the given format spec::" msgstr "" -#: ../../library/dis.rst:1642 +#: ../../library/dis.rst:1663 msgid "" "spec = STACK.pop()\n" "value = STACK.pop()\n" @@ -1854,14 +1873,14 @@ msgstr "" "result = value.__format__(spec)\n" "STACK.append(result)" -#: ../../library/dis.rst:1654 +#: ../../library/dis.rst:1675 msgid "" "``STACK[-1]`` is a tuple of keyword attribute names, ``STACK[-2]`` is the " "class being matched against, and ``STACK[-3]`` is the match subject. " "*count* is the number of positional sub-patterns." msgstr "" -#: ../../library/dis.rst:1658 +#: ../../library/dis.rst:1679 msgid "" "Pop ``STACK[-1]``, ``STACK[-2]``, and ``STACK[-3]``. If ``STACK[-3]`` is an " "instance of ``STACK[-2]`` and has the positional and keyword attributes " @@ -1869,219 +1888,219 @@ msgid "" "Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:1672 +#: ../../library/dis.rst:1693 msgid "A no-op. Performs internal tracing, debugging and optimization checks." msgstr "" -#: ../../library/dis.rst:1674 +#: ../../library/dis.rst:1695 msgid "" "The ``context`` oparand consists of two parts. The lowest two bits indicate " "where the ``RESUME`` occurs:" msgstr "" -#: ../../library/dis.rst:1677 +#: ../../library/dis.rst:1698 msgid "" "``0`` The start of a function, which is neither a generator, coroutine nor " "an async generator" msgstr "" -#: ../../library/dis.rst:1679 +#: ../../library/dis.rst:1700 msgid "``1`` After a ``yield`` expression" msgstr "" -#: ../../library/dis.rst:1680 +#: ../../library/dis.rst:1701 msgid "``2`` After a ``yield from`` expression" msgstr "" -#: ../../library/dis.rst:1681 +#: ../../library/dis.rst:1702 msgid "``3`` After an ``await`` expression" msgstr "" -#: ../../library/dis.rst:1683 +#: ../../library/dis.rst:1704 msgid "" "The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` " "otherwise." msgstr "" -#: ../../library/dis.rst:1688 +#: ../../library/dis.rst:1709 msgid "The oparg value changed to include information about except-depth" msgstr "" -#: ../../library/dis.rst:1694 +#: ../../library/dis.rst:1715 msgid "" "Create a generator, coroutine, or async generator from the current frame. " "Used as first opcode of in code object for the above mentioned callables. " "Clear the current frame and return the newly created generator." msgstr "" -#: ../../library/dis.rst:1703 +#: ../../library/dis.rst:1724 msgid "" "Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])``. Used in ``yield " "from`` and ``await`` statements." msgstr "" -#: ../../library/dis.rst:1706 +#: ../../library/dis.rst:1727 msgid "" "If the call raises :exc:`StopIteration`, pop the top value from the stack, " "push the exception's ``value`` attribute, and increment the bytecode counter " "by *delta*." msgstr "" -#: ../../library/dis.rst:1715 +#: ../../library/dis.rst:1736 msgid "" "This is not really an opcode. It identifies the dividing line between " "opcodes in the range [0,255] which don't use their argument and those that " "do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively)." msgstr "" -#: ../../library/dis.rst:1719 +#: ../../library/dis.rst:1740 msgid "" "If your application uses pseudo instructions or specialized instructions, " "use the :data:`hasarg` collection instead." msgstr "" -#: ../../library/dis.rst:1722 +#: ../../library/dis.rst:1743 msgid "" "Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT`` " "ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument." msgstr "" -#: ../../library/dis.rst:1726 +#: ../../library/dis.rst:1747 msgid "" "Pseudo instructions were added to the :mod:`dis` module, and for them it is " "not true that comparison with ``HAVE_ARGUMENT`` indicates whether they use " "their arg." msgstr "" -#: ../../library/dis.rst:1731 +#: ../../library/dis.rst:1752 msgid "Use :data:`hasarg` instead." msgstr "" -#: ../../library/dis.rst:1736 +#: ../../library/dis.rst:1757 msgid "" "Calls an intrinsic function with one argument. Passes ``STACK[-1]`` as the " "argument and sets ``STACK[-1]`` to the result. Used to implement " "functionality that is not performance critical." msgstr "" -#: ../../library/dis.rst:1740 ../../library/dis.rst:1794 +#: ../../library/dis.rst:1761 ../../library/dis.rst:1815 msgid "The operand determines which intrinsic function is called:" msgstr "" -#: ../../library/dis.rst:1743 ../../library/dis.rst:1797 +#: ../../library/dis.rst:1764 ../../library/dis.rst:1818 msgid "Operand" msgstr "運算元" -#: ../../library/dis.rst:1743 ../../library/dis.rst:1797 +#: ../../library/dis.rst:1764 ../../library/dis.rst:1818 msgid "Description" msgstr "描述" -#: ../../library/dis.rst:1745 +#: ../../library/dis.rst:1766 msgid "``INTRINSIC_1_INVALID``" msgstr "``INTRINSIC_1_INVALID``" -#: ../../library/dis.rst:1745 ../../library/dis.rst:1799 +#: ../../library/dis.rst:1766 ../../library/dis.rst:1820 msgid "Not valid" msgstr "" -#: ../../library/dis.rst:1747 +#: ../../library/dis.rst:1768 msgid "``INTRINSIC_PRINT``" msgstr "``INTRINSIC_PRINT``" -#: ../../library/dis.rst:1747 +#: ../../library/dis.rst:1768 msgid "Prints the argument to standard out. Used in the REPL." msgstr "" -#: ../../library/dis.rst:1750 +#: ../../library/dis.rst:1771 msgid "``INTRINSIC_IMPORT_STAR``" msgstr "``INTRINSIC_IMPORT_STAR``" -#: ../../library/dis.rst:1750 +#: ../../library/dis.rst:1771 msgid "Performs ``import *`` for the named module." msgstr "" -#: ../../library/dis.rst:1753 +#: ../../library/dis.rst:1774 msgid "``INTRINSIC_STOPITERATION_ERROR``" msgstr "``INTRINSIC_STOPITERATION_ERROR``" -#: ../../library/dis.rst:1753 +#: ../../library/dis.rst:1774 msgid "Extracts the return value from a ``StopIteration`` exception." msgstr "" -#: ../../library/dis.rst:1756 +#: ../../library/dis.rst:1777 msgid "``INTRINSIC_ASYNC_GEN_WRAP``" msgstr "``INTRINSIC_ASYNC_GEN_WRAP``" -#: ../../library/dis.rst:1756 +#: ../../library/dis.rst:1777 msgid "Wraps an async generator value" msgstr "" -#: ../../library/dis.rst:1758 +#: ../../library/dis.rst:1779 msgid "``INTRINSIC_UNARY_POSITIVE``" msgstr "``INTRINSIC_UNARY_POSITIVE``" -#: ../../library/dis.rst:1758 +#: ../../library/dis.rst:1779 msgid "Performs the unary ``+`` operation" msgstr "" -#: ../../library/dis.rst:1761 +#: ../../library/dis.rst:1782 msgid "``INTRINSIC_LIST_TO_TUPLE``" msgstr "``INTRINSIC_LIST_TO_TUPLE``" -#: ../../library/dis.rst:1761 +#: ../../library/dis.rst:1782 msgid "Converts a list to a tuple" msgstr "" -#: ../../library/dis.rst:1763 +#: ../../library/dis.rst:1784 msgid "``INTRINSIC_TYPEVAR``" msgstr "``INTRINSIC_TYPEVAR``" -#: ../../library/dis.rst:1763 +#: ../../library/dis.rst:1784 msgid "Creates a :class:`typing.TypeVar`" msgstr "" -#: ../../library/dis.rst:1765 +#: ../../library/dis.rst:1786 msgid "``INTRINSIC_PARAMSPEC``" msgstr "``INTRINSIC_PARAMSPEC``" -#: ../../library/dis.rst:1765 +#: ../../library/dis.rst:1786 msgid "Creates a :class:`typing.ParamSpec`" msgstr "" -#: ../../library/dis.rst:1768 +#: ../../library/dis.rst:1789 msgid "``INTRINSIC_TYPEVARTUPLE``" msgstr "``INTRINSIC_TYPEVARTUPLE``" -#: ../../library/dis.rst:1768 +#: ../../library/dis.rst:1789 msgid "Creates a :class:`typing.TypeVarTuple`" msgstr "" -#: ../../library/dis.rst:1771 +#: ../../library/dis.rst:1792 msgid "``INTRINSIC_SUBSCRIPT_GENERIC``" msgstr "``INTRINSIC_SUBSCRIPT_GENERIC``" -#: ../../library/dis.rst:1771 +#: ../../library/dis.rst:1792 msgid "Returns :class:`typing.Generic` subscripted with the argument" msgstr "" -#: ../../library/dis.rst:1774 +#: ../../library/dis.rst:1795 msgid "``INTRINSIC_TYPEALIAS``" msgstr "``INTRINSIC_TYPEALIAS``" -#: ../../library/dis.rst:1774 +#: ../../library/dis.rst:1795 msgid "" "Creates a :class:`typing.TypeAliasType`; used in the :keyword:`type` " "statement. The argument is a tuple of the type alias's name, type " "parameters, and value." msgstr "" -#: ../../library/dis.rst:1786 +#: ../../library/dis.rst:1807 msgid "" "Calls an intrinsic function with two arguments. Used to implement " "functionality that is not performance critical::" msgstr "" -#: ../../library/dis.rst:1789 +#: ../../library/dis.rst:1810 msgid "" "arg2 = STACK.pop()\n" "arg1 = STACK.pop()\n" @@ -2093,61 +2112,61 @@ msgstr "" "result = intrinsic2(arg1, arg2)\n" "STACK.append(result)" -#: ../../library/dis.rst:1799 +#: ../../library/dis.rst:1820 msgid "``INTRINSIC_2_INVALID``" msgstr "``INTRINSIC_2_INVALID``" -#: ../../library/dis.rst:1801 +#: ../../library/dis.rst:1822 msgid "``INTRINSIC_PREP_RERAISE_STAR``" msgstr "``INTRINSIC_PREP_RERAISE_STAR``" -#: ../../library/dis.rst:1801 +#: ../../library/dis.rst:1822 msgid "Calculates the :exc:`ExceptionGroup` to raise from a ``try-except*``." msgstr "" -#: ../../library/dis.rst:1805 +#: ../../library/dis.rst:1826 msgid "``INTRINSIC_TYPEVAR_WITH_BOUND``" msgstr "``INTRINSIC_TYPEVAR_WITH_BOUND``" -#: ../../library/dis.rst:1805 +#: ../../library/dis.rst:1826 msgid "Creates a :class:`typing.TypeVar` with a bound." msgstr "" -#: ../../library/dis.rst:1808 +#: ../../library/dis.rst:1829 msgid "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" msgstr "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" -#: ../../library/dis.rst:1808 +#: ../../library/dis.rst:1829 msgid "Creates a :class:`typing.TypeVar` with constraints." msgstr "" -#: ../../library/dis.rst:1812 +#: ../../library/dis.rst:1833 msgid "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" msgstr "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" -#: ../../library/dis.rst:1812 +#: ../../library/dis.rst:1833 msgid "Sets the ``__type_params__`` attribute of a function." msgstr "" -#: ../../library/dis.rst:1819 +#: ../../library/dis.rst:1840 msgid "**Pseudo-instructions**" msgstr "" -#: ../../library/dis.rst:1821 +#: ../../library/dis.rst:1842 msgid "" "These opcodes do not appear in Python bytecode. They are used by the " "compiler but are replaced by real opcodes or removed before bytecode is " "generated." msgstr "" -#: ../../library/dis.rst:1826 +#: ../../library/dis.rst:1847 msgid "" "Set up an exception handler for the following code block. If an exception " "occurs, the value stack level is restored to its current state and control " "is transferred to the exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1833 +#: ../../library/dis.rst:1854 msgid "" "Like ``SETUP_FINALLY``, but in case of an exception also pushes the last " "instruction (``lasti``) to the stack so that ``RERAISE`` can restore it. If " @@ -2156,91 +2175,91 @@ msgid "" "exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1842 +#: ../../library/dis.rst:1863 msgid "" "Like ``SETUP_CLEANUP``, but in case of an exception one more item is popped " "from the stack before control is transferred to the exception handler at " "``target``." msgstr "" -#: ../../library/dis.rst:1846 +#: ../../library/dis.rst:1867 msgid "" "This variant is used in :keyword:`with` and :keyword:`async with` " "constructs, which push the return value of the context manager's :meth:" "`~object.__enter__` or :meth:`~object.__aenter__` to the stack." msgstr "" -#: ../../library/dis.rst:1853 +#: ../../library/dis.rst:1874 msgid "" "Marks the end of the code block associated with the last ``SETUP_FINALLY``, " "``SETUP_CLEANUP`` or ``SETUP_WITH``." msgstr "" -#: ../../library/dis.rst:1859 +#: ../../library/dis.rst:1880 msgid "" "Undirected relative jump instructions which are replaced by their directed " "(forward/backward) counterparts by the assembler." msgstr "" -#: ../../library/dis.rst:1864 +#: ../../library/dis.rst:1885 msgid "" "Pushes a reference to the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1867 +#: ../../library/dis.rst:1888 msgid "" "Note that ``LOAD_CLOSURE`` is replaced with ``LOAD_FAST`` in the assembler." msgstr "" -#: ../../library/dis.rst:1869 +#: ../../library/dis.rst:1890 msgid "This opcode is now a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1875 +#: ../../library/dis.rst:1896 msgid "" "Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode with a " "flag set in the arg." msgstr "" -#: ../../library/dis.rst:1882 +#: ../../library/dis.rst:1903 msgid "Opcode collections" msgstr "" -#: ../../library/dis.rst:1884 +#: ../../library/dis.rst:1905 msgid "" "These collections are provided for automatic introspection of bytecode " "instructions:" msgstr "" -#: ../../library/dis.rst:1887 +#: ../../library/dis.rst:1908 msgid "" "The collections now contain pseudo instructions and instrumented " "instructions as well. These are opcodes with values ``>= MIN_PSEUDO_OPCODE`` " "and ``>= MIN_INSTRUMENTED_OPCODE``." msgstr "" -#: ../../library/dis.rst:1894 +#: ../../library/dis.rst:1915 msgid "Sequence of operation names, indexable using the bytecode." msgstr "" -#: ../../library/dis.rst:1899 +#: ../../library/dis.rst:1920 msgid "Dictionary mapping operation names to bytecodes." msgstr "" -#: ../../library/dis.rst:1904 +#: ../../library/dis.rst:1925 msgid "Sequence of all compare operation names." msgstr "" -#: ../../library/dis.rst:1909 +#: ../../library/dis.rst:1930 msgid "Sequence of bytecodes that use their argument." msgstr "" -#: ../../library/dis.rst:1916 +#: ../../library/dis.rst:1937 msgid "Sequence of bytecodes that access a constant." msgstr "" -#: ../../library/dis.rst:1921 +#: ../../library/dis.rst:1942 msgid "" "Sequence of bytecodes that access a :term:`free (closure) variable <closure " "variable>`. 'free' in this context refers to names in the current scope that " @@ -2249,47 +2268,47 @@ msgid "" "scopes." msgstr "" -#: ../../library/dis.rst:1929 +#: ../../library/dis.rst:1950 msgid "Sequence of bytecodes that access an attribute by name." msgstr "" -#: ../../library/dis.rst:1934 +#: ../../library/dis.rst:1955 msgid "Sequence of bytecodes that have a jump target. All jumps are relative." msgstr "" -#: ../../library/dis.rst:1941 +#: ../../library/dis.rst:1962 msgid "Sequence of bytecodes that access a local variable." msgstr "" -#: ../../library/dis.rst:1946 +#: ../../library/dis.rst:1967 msgid "Sequence of bytecodes of Boolean operations." msgstr "" -#: ../../library/dis.rst:1950 +#: ../../library/dis.rst:1971 msgid "Sequence of bytecodes that set an exception handler." msgstr "" -#: ../../library/dis.rst:1957 +#: ../../library/dis.rst:1978 msgid "Sequence of bytecodes that have a relative jump target." msgstr "" -#: ../../library/dis.rst:1959 +#: ../../library/dis.rst:1980 msgid "All jumps are now relative. Use :data:`hasjump`." msgstr "" -#: ../../library/dis.rst:1965 +#: ../../library/dis.rst:1986 msgid "Sequence of bytecodes that have an absolute jump target." msgstr "" -#: ../../library/dis.rst:1967 +#: ../../library/dis.rst:1988 msgid "All jumps are now relative. This list is empty." msgstr "" -#: ../../library/dis.rst:1583 +#: ../../library/dis.rst:1604 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/dis.rst:1583 +#: ../../library/dis.rst:1604 msgid "slice" msgstr "slice(切片)" diff --git a/library/http.cookies.po b/library/http.cookies.po index 4bd8b76059..283f303aa9 100644 --- a/library/http.cookies.po +++ b/library/http.cookies.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-12-14 00:14+0000\n" "PO-Revision-Date: 2016-11-19 00:31+0000\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -133,9 +133,9 @@ msgstr "" #: ../../library/http.cookies.rst:100 msgid "" "Return a string representation suitable to be sent as HTTP headers. *attrs* " -"and *header* are sent to each :class:`Morsel`'s :meth:`output` method. *sep* " -"is used to join the headers together, and is by default the combination " -"``'\\r\\n'`` (CRLF)." +"and *header* are sent to each :class:`Morsel`'s :meth:`~Morsel.output` " +"method. *sep* is used to join the headers together, and is by default the " +"combination ``'\\r\\n'`` (CRLF)." msgstr "" #: ../../library/http.cookies.rst:108 diff --git a/library/itertools.po b/library/itertools.po index b02809e1e2..f7ba031e9c 100644 --- a/library/itertools.po +++ b/library/itertools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-09 00:13+0000\n" +"POT-Creation-Date: 2024-12-05 00:14+0000\n" "PO-Revision-Date: 2024-08-16 15:01+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1725,6 +1725,11 @@ msgid "" " \"Returns the sequence elements n times.\"\n" " return chain.from_iterable(repeat(tuple(iterable), n))\n" "\n" +"def loops(n):\n" +" \"Loop n times. Like range(n) but without creating integers.\"\n" +" # for _ in loops(100): ...\n" +" return repeat(None, n)\n" +"\n" "def tail(n, iterable):\n" " \"Return an iterator over the last n items.\"\n" " # tail(3, 'ABCDEFG') → E F G\n" @@ -1858,11 +1863,11 @@ msgid "" " yield func()" msgstr "" -#: ../../library/itertools.rst:1008 +#: ../../library/itertools.rst:1013 msgid "The following recipes have a more mathematical flavor:" msgstr "以下的應用技巧具有更多的數學風格:" -#: ../../library/itertools.rst:1010 +#: ../../library/itertools.rst:1015 msgid "" "def powerset(iterable):\n" " \"powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)\"\n" @@ -1954,6 +1959,11 @@ msgid "" " data[p*p : n : p+p] = bytes(len(range(p*p, n, p+p)))\n" " yield from iter_index(data, 1, start=3)\n" "\n" +"def is_prime(n):\n" +" \"Return True if n is prime.\"\n" +" # is_prime(1_000_000_000_000_403) → True\n" +" return n > 1 and all(n % p for p in sieve(math.isqrt(n) + 1))\n" +"\n" "def factor(n):\n" " \"Prime factors of n.\"\n" " # factor(99) → 3 3 11\n" diff --git a/library/string.po b/library/string.po index 8e279ed304..5537df8ef6 100644 --- a/library/string.po +++ b/library/string.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-02 00:13+0000\n" +"POT-Creation-Date: 2024-12-15 00:17+0000\n" "PO-Revision-Date: 2024-03-10 15:57+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -64,15 +63,15 @@ msgid "" "The uppercase letters ``'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``. This value is not " "locale-dependent and will not change." msgstr "" -"大寫字母 ``’ABCDEFGHIJKLMNOPQRSTUVWXYZ’``。 此值與地區設定無關且不會改變。" +"大寫字母 ``'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``。此值與地區設定無關且不會改變。" #: ../../library/string.rst:44 msgid "The string ``'0123456789'``." -msgstr "字串 ``’0123456789’``。" +msgstr "字串 ``'0123456789'``。" #: ../../library/string.rst:49 msgid "The string ``'0123456789abcdefABCDEF'``." -msgstr "字串 ``’0123456789abcdefABCDEF’``。" +msgstr "字串 ``'0123456789abcdefABCDEF'``。" #: ../../library/string.rst:54 msgid "The string ``'01234567'``." @@ -83,7 +82,7 @@ msgid "" "String of ASCII characters which are considered punctuation characters in " "the ``C`` locale: ``!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~``." msgstr "" -"在 ``C`` 語言中被視為標點符號的 ASCII 字元的字串: ``!”#$%&’()*+,-./:;<=>?" +"在 ``C`` 語言中被視為標點符號的 ASCII 字元的字串:``!\"#$%&'()*+,-./:;<=>?" "@[\\]^_`{|}~``。" #: ../../library/string.rst:64 @@ -462,8 +461,8 @@ msgid "Option" msgstr "選項" #: ../../library/string.rst:342 ../../library/string.rst:374 -#: ../../library/string.rst:457 ../../library/string.rst:468 -#: ../../library/string.rst:503 +#: ../../library/string.rst:459 ../../library/string.rst:470 +#: ../../library/string.rst:505 msgid "Meaning" msgstr "含義" @@ -545,7 +544,7 @@ msgstr "" #: ../../library/string.rst:368 ../../library/string.rst:382 msgid "space" -msgstr "" +msgstr "空格" #: ../../library/string.rst:382 msgid "" @@ -580,15 +579,17 @@ msgstr "" #: ../../library/string.rst:412 msgid "" -"The ``','`` option signals the use of a comma for a thousands separator. For " -"a locale aware separator, use the ``'n'`` integer presentation type instead." +"The ``','`` option signals the use of a comma for a thousands separator for " +"floating-point presentation types and for integer presentation type ``'d'``. " +"For other presentation types, this option is an error. For a locale aware " +"separator, use the ``'n'`` integer presentation type instead." msgstr "" -#: ../../library/string.rst:416 +#: ../../library/string.rst:418 msgid "Added the ``','`` option (see also :pep:`378`)." msgstr "新增 ``','`` 選項(請見 :pep:`378`\\ )。" -#: ../../library/string.rst:421 +#: ../../library/string.rst:423 msgid "" "The ``'_'`` option signals the use of an underscore for a thousands " "separator for floating-point presentation types and for integer presentation " @@ -600,11 +601,11 @@ msgstr "" "號。對於整數表示型別 ``'b'``,``'o'``,``'x'`` 和 ``'X'``,每 4 位數字會插入" "底線。對於其他表示型別,指定此選項會出錯。" -#: ../../library/string.rst:428 +#: ../../library/string.rst:430 msgid "Added the ``'_'`` option (see also :pep:`515`)." msgstr "新增 ``'_'`` 選項(請見 :pep:`515`\\ )。" -#: ../../library/string.rst:431 +#: ../../library/string.rst:433 msgid "" "*width* is a decimal integer defining the minimum total field width, " "including any prefixes, separators, and other formatting characters. If not " @@ -613,7 +614,7 @@ msgstr "" "*width* 是一個十進位整數,定義了最小總欄位寬度,包括任何前綴、分隔符號和其他" "格式字元。如果未指定,則欄位寬度將由內容決定。" -#: ../../library/string.rst:435 +#: ../../library/string.rst:437 msgid "" "When no explicit alignment is given, preceding the *width* field by a zero " "(``'0'``) character enables sign-aware zero-padding for numeric types, " @@ -624,13 +625,13 @@ msgstr "" "class:`complex` 以外的數值型別啟用有符號察覺的零填充 (sign-aware zero-" "padding)。這相當於使用 ``'0'`` 為 *fill* 字元且對齊類型為 ``'='``。" -#: ../../library/string.rst:440 +#: ../../library/string.rst:442 msgid "" "Preceding the *width* field by ``'0'`` no longer affects the default " "alignment for strings." msgstr "在 *width* 欄位前面加上 ``'0'`` 不再影響字串的預設對齊方式。" -#: ../../library/string.rst:444 +#: ../../library/string.rst:446 msgid "" "The *precision* is a decimal integer indicating how many digits should be " "displayed after the decimal point for presentation types ``'f'`` and " @@ -645,89 +646,89 @@ msgstr "" "示類型,該欄位指定最大欄位大小 - 換言之,將使用欄位中的多少字元。整數表示類型" "不允許使用 *precision*。" -#: ../../library/string.rst:452 +#: ../../library/string.rst:454 msgid "Finally, the *type* determines how the data should be presented." msgstr "最終,型別決定了資料將會如何呈現" -#: ../../library/string.rst:454 +#: ../../library/string.rst:456 msgid "The available string presentation types are:" msgstr "可用的字串表示型別有:" -#: ../../library/string.rst:457 ../../library/string.rst:468 -#: ../../library/string.rst:503 +#: ../../library/string.rst:459 ../../library/string.rst:470 +#: ../../library/string.rst:505 msgid "Type" msgstr "型別" -#: ../../library/string.rst:459 +#: ../../library/string.rst:461 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/string.rst:459 +#: ../../library/string.rst:461 msgid "String format. This is the default type for strings and may be omitted." msgstr "" -#: ../../library/string.rst:462 ../../library/string.rst:491 -#: ../../library/string.rst:576 +#: ../../library/string.rst:464 ../../library/string.rst:493 +#: ../../library/string.rst:578 msgid "None" msgstr "None" -#: ../../library/string.rst:462 +#: ../../library/string.rst:464 msgid "The same as ``'s'``." -msgstr "" +msgstr "與 ``'s'`` 相同。" -#: ../../library/string.rst:465 +#: ../../library/string.rst:467 msgid "The available integer presentation types are:" msgstr "" -#: ../../library/string.rst:470 +#: ../../library/string.rst:472 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/string.rst:470 +#: ../../library/string.rst:472 msgid "Binary format. Outputs the number in base 2." msgstr "" -#: ../../library/string.rst:472 +#: ../../library/string.rst:474 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/string.rst:472 +#: ../../library/string.rst:474 msgid "" "Character. Converts the integer to the corresponding unicode character " "before printing." msgstr "" -#: ../../library/string.rst:475 +#: ../../library/string.rst:477 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/string.rst:475 +#: ../../library/string.rst:477 msgid "Decimal Integer. Outputs the number in base 10." msgstr "" -#: ../../library/string.rst:477 +#: ../../library/string.rst:479 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/string.rst:477 +#: ../../library/string.rst:479 msgid "Octal format. Outputs the number in base 8." msgstr "" -#: ../../library/string.rst:479 +#: ../../library/string.rst:481 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/string.rst:479 +#: ../../library/string.rst:481 msgid "" "Hex format. Outputs the number in base 16, using lower-case letters for the " "digits above 9." msgstr "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用小寫字母。" -#: ../../library/string.rst:482 +#: ../../library/string.rst:484 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/string.rst:482 +#: ../../library/string.rst:484 msgid "" "Hex format. Outputs the number in base 16, using upper-case letters for the " "digits above 9. In case ``'#'`` is specified, the prefix ``'0x'`` will be " @@ -736,21 +737,21 @@ msgstr "" "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用大寫字母。如果指定了 " "``'#'``,則前綴 ``'0x'`` 也會被轉成大寫的 ``'0X'``。" -#: ../../library/string.rst:487 ../../library/string.rst:569 +#: ../../library/string.rst:489 ../../library/string.rst:571 msgid "``'n'``" msgstr "``'n'``" -#: ../../library/string.rst:487 +#: ../../library/string.rst:489 msgid "" "Number. This is the same as ``'d'``, except that it uses the current locale " "setting to insert the appropriate number separator characters." msgstr "" -#: ../../library/string.rst:491 +#: ../../library/string.rst:493 msgid "The same as ``'d'``." -msgstr "" +msgstr "與 ``'d'`` 相同。" -#: ../../library/string.rst:494 +#: ../../library/string.rst:496 msgid "" "In addition to the above presentation types, integers can be formatted with " "the floating-point presentation types listed below (except ``'n'`` and " @@ -758,17 +759,17 @@ msgid "" "floating-point number before formatting." msgstr "" -#: ../../library/string.rst:499 +#: ../../library/string.rst:501 msgid "" "The available presentation types for :class:`float` and :class:`~decimal." "Decimal` values are:" msgstr "" -#: ../../library/string.rst:505 +#: ../../library/string.rst:507 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/string.rst:505 +#: ../../library/string.rst:507 msgid "" "Scientific notation. For a given precision ``p``, formats the number in " "scientific notation with the letter 'e' separating the coefficient from the " @@ -780,21 +781,21 @@ msgid "" "is used." msgstr "" -#: ../../library/string.rst:516 +#: ../../library/string.rst:518 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/string.rst:516 +#: ../../library/string.rst:518 msgid "" "Scientific notation. Same as ``'e'`` except it uses an upper case 'E' as the " "separator character." msgstr "" -#: ../../library/string.rst:519 +#: ../../library/string.rst:521 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/string.rst:519 +#: ../../library/string.rst:521 msgid "" "Fixed-point notation. For a given precision ``p``, formats the number as a " "decimal number with exactly ``p`` digits following the decimal point. With " @@ -804,21 +805,21 @@ msgid "" "point is omitted unless the ``#`` option is used." msgstr "" -#: ../../library/string.rst:528 +#: ../../library/string.rst:530 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/string.rst:528 +#: ../../library/string.rst:530 msgid "" "Fixed-point notation. Same as ``'f'``, but converts ``nan`` to ``NAN`` and " "``inf`` to ``INF``." msgstr "" -#: ../../library/string.rst:531 +#: ../../library/string.rst:533 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/string.rst:531 +#: ../../library/string.rst:533 msgid "" "General format. For a given precision ``p >= 1``, this rounds the number to " "``p`` significant digits and then formats the result in either fixed-point " @@ -826,7 +827,7 @@ msgid "" "``0`` is treated as equivalent to a precision of ``1``." msgstr "" -#: ../../library/string.rst:538 +#: ../../library/string.rst:540 msgid "" "The precise rules are as follows: suppose that the result formatted with " "presentation type ``'e'`` and precision ``p-1`` would have exponent " @@ -839,7 +840,7 @@ msgid "" "unless the ``'#'`` option is used." msgstr "" -#: ../../library/string.rst:551 +#: ../../library/string.rst:553 msgid "" "With no precision given, uses a precision of ``6`` significant digits for :" "class:`float`. For :class:`~decimal.Decimal`, the coefficient of the result " @@ -849,40 +850,40 @@ msgid "" "notation is used otherwise." msgstr "" -#: ../../library/string.rst:560 +#: ../../library/string.rst:562 msgid "" "Positive and negative infinity, positive and negative zero, and nans, are " "formatted as ``inf``, ``-inf``, ``0``, ``-0`` and ``nan`` respectively, " "regardless of the precision." msgstr "" -#: ../../library/string.rst:565 +#: ../../library/string.rst:567 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/string.rst:565 +#: ../../library/string.rst:567 msgid "" "General format. Same as ``'g'`` except switches to ``'E'`` if the number " "gets too large. The representations of infinity and NaN are uppercased, too." msgstr "" -#: ../../library/string.rst:569 +#: ../../library/string.rst:571 msgid "" "Number. This is the same as ``'g'``, except that it uses the current locale " "setting to insert the appropriate number separator characters." msgstr "" -#: ../../library/string.rst:573 +#: ../../library/string.rst:575 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/string.rst:573 +#: ../../library/string.rst:575 msgid "" "Percentage. Multiplies the number by 100 and displays in fixed (``'f'``) " "format, followed by a percent sign." msgstr "" -#: ../../library/string.rst:576 +#: ../../library/string.rst:578 msgid "" "For :class:`float` this is like the ``'g'`` type, except that when fixed-" "point notation is used to format the result, it always includes at least one " @@ -891,20 +892,28 @@ msgid "" "as large as needed to represent the given value faithfully." msgstr "" -#: ../../library/string.rst:584 +#: ../../library/string.rst:586 msgid "" "For :class:`~decimal.Decimal`, this is the same as either ``'g'`` or ``'G'`` " "depending on the value of ``context.capitals`` for the current decimal " "context." msgstr "" -#: ../../library/string.rst:588 +#: ../../library/string.rst:590 msgid "" "The overall effect is to match the output of :func:`str` as altered by the " "other format modifiers." msgstr "" -#: ../../library/string.rst:592 +#: ../../library/string.rst:594 +msgid "" +"The result should be correctly rounded to a given precision ``p`` of digits " +"after the decimal point. The rounding mode for :class:`float` matches that " +"of the :func:`round` builtin. For :class:`~decimal.Decimal`, the rounding " +"mode of the current :ref:`context <decimal-context>` will be used." +msgstr "" + +#: ../../library/string.rst:599 msgid "" "The available presentation types for :class:`complex` are the same as those " "for :class:`float` (``'%'`` is not allowed). Both the real and imaginary " @@ -916,17 +925,17 @@ msgid "" "surrounded by parentheses), possibly altered by other format modifiers." msgstr "" -#: ../../library/string.rst:605 +#: ../../library/string.rst:612 msgid "Format examples" msgstr "格式範例" -#: ../../library/string.rst:607 +#: ../../library/string.rst:614 msgid "" "This section contains examples of the :meth:`str.format` syntax and " "comparison with the old ``%``-formatting." msgstr "本節包含 :meth:`str.format` 語法以及與舊式 ``%`` 格式的比較。" -#: ../../library/string.rst:610 +#: ../../library/string.rst:617 msgid "" "In most of the cases the syntax is similar to the old ``%``-formatting, with " "the addition of the ``{}`` and with ``:`` used instead of ``%``. For " @@ -935,17 +944,17 @@ msgstr "" "此語法在大多情況下與舊式的 ``%`` 格式類似,只是增加了 ``{}`` 和 ``:`` 來取代 " "``%``。例如,``'%03.2f'`` 可以改寫為 ``'{:03.2f}'``。" -#: ../../library/string.rst:614 +#: ../../library/string.rst:621 msgid "" "The new format syntax also supports new and different options, shown in the " "following examples." msgstr "新的語法還支援新的選項,將在以下的範例中說明。" -#: ../../library/string.rst:617 +#: ../../library/string.rst:624 msgid "Accessing arguments by position::" msgstr "按位置存取引數: ::" -#: ../../library/string.rst:619 +#: ../../library/string.rst:626 msgid "" ">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" "'a, b, c'\n" @@ -959,12 +968,22 @@ msgid "" "repeated\n" "'abracadabra'" msgstr "" +">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" +"'a, b, c'\n" +">>> '{}, {}, {}'.format('a', 'b', 'c') # 3.1+ only\n" +"'a, b, c'\n" +">>> '{2}, {1}, {0}'.format('a', 'b', 'c')\n" +"'c, b, a'\n" +">>> '{2}, {1}, {0}'.format(*'abc') # 解包引數序列\n" +"'c, b, a'\n" +">>> '{0}{1}{0}'.format('abra', 'cad') # 引數索引可以重複\n" +"'abracadabra'" -#: ../../library/string.rst:630 +#: ../../library/string.rst:637 msgid "Accessing arguments by name::" msgstr "按名稱存取引數: ::" -#: ../../library/string.rst:632 +#: ../../library/string.rst:639 msgid "" ">>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', " "longitude='-115.81W')\n" @@ -974,11 +993,11 @@ msgid "" "'Coordinates: 37.24N, -115.81W'" msgstr "" -#: ../../library/string.rst:638 +#: ../../library/string.rst:645 msgid "Accessing arguments' attributes::" msgstr "存取引數的屬性: ::" -#: ../../library/string.rst:640 +#: ../../library/string.rst:647 msgid "" ">>> c = 3-5j\n" ">>> ('The complex number {0} is formed from the real part {0.real} '\n" @@ -995,22 +1014,25 @@ msgid "" "'Point(4, 2)'" msgstr "" -#: ../../library/string.rst:653 +#: ../../library/string.rst:660 msgid "Accessing arguments' items::" msgstr "存取引數的內容: ::" -#: ../../library/string.rst:655 +#: ../../library/string.rst:662 msgid "" ">>> coord = (3, 5)\n" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" "'X: 3; Y: 5'" msgstr "" +">>> coord = (3, 5)\n" +">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" +"'X: 3; Y: 5'" -#: ../../library/string.rst:659 +#: ../../library/string.rst:666 msgid "Replacing ``%s`` and ``%r``::" msgstr "替換 ``%s`` 和 ``%r``: ::" -#: ../../library/string.rst:661 +#: ../../library/string.rst:668 msgid "" ">>> \"repr() shows quotes: {!r}; str() doesn't: {!s}\".format('test1', " "'test2')\n" @@ -1020,11 +1042,11 @@ msgstr "" "'test2')\n" "\"repr() shows quotes: 'test1'; str() doesn't: test2\"" -#: ../../library/string.rst:664 +#: ../../library/string.rst:671 msgid "Aligning the text and specifying a width::" msgstr "對齊文字以及指定寬度: ::" -#: ../../library/string.rst:666 +#: ../../library/string.rst:673 msgid "" ">>> '{:<30}'.format('left aligned')\n" "'left aligned '\n" @@ -1036,11 +1058,11 @@ msgid "" "'***********centered***********'" msgstr "" -#: ../../library/string.rst:675 +#: ../../library/string.rst:682 msgid "Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::" msgstr "替換 ``%+f``、``%-f`` 和 ``% f`` 以及指定正負號: ::" -#: ../../library/string.rst:677 +#: ../../library/string.rst:684 msgid "" ">>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always\n" "'+3.140000; -3.140000'\n" @@ -1050,13 +1072,20 @@ msgid "" "f}; {:f}'\n" "'3.140000; -3.140000'" msgstr "" +">>> '{:+f}; {:+f}'.format(3.14, -3.14) # 總會顯示\n" +"'+3.140000; -3.140000'\n" +">>> '{: f}; {: f}'.format(3.14, -3.14) # 若為正數則顯示空格\n" +"' 3.140000; -3.140000'\n" +">>> '{:-f}; {:-f}'.format(3.14, -3.14) # 只顯示負號 -- 與 '{:f}; {:f}' 相" +"同\n" +"'3.140000; -3.140000'" -#: ../../library/string.rst:684 +#: ../../library/string.rst:691 msgid "" "Replacing ``%x`` and ``%o`` and converting the value to different bases::" msgstr "替換 ``%x`` 和 ``%o`` 並將其值轉換為不同的進位制: ::" -#: ../../library/string.rst:686 +#: ../../library/string.rst:693 msgid "" ">>> # format also supports binary numbers\n" ">>> \"int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}\".format(42)\n" @@ -1066,11 +1095,11 @@ msgid "" "'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'" msgstr "" -#: ../../library/string.rst:693 +#: ../../library/string.rst:700 msgid "Using the comma as a thousands separator::" msgstr "使用逗號作為千位分隔符: ::" -#: ../../library/string.rst:695 +#: ../../library/string.rst:702 msgid "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" @@ -1078,11 +1107,11 @@ msgstr "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" -#: ../../library/string.rst:698 +#: ../../library/string.rst:705 msgid "Expressing a percentage::" msgstr "表示為百分比: ::" -#: ../../library/string.rst:700 +#: ../../library/string.rst:707 msgid "" ">>> points = 19\n" ">>> total = 22\n" @@ -1094,11 +1123,11 @@ msgstr "" ">>> 'Correct answers: {:.2%}'.format(points/total)\n" "'Correct answers: 86.36%'" -#: ../../library/string.rst:705 +#: ../../library/string.rst:712 msgid "Using type-specific formatting::" msgstr "作為特定型別格式: ::" -#: ../../library/string.rst:707 +#: ../../library/string.rst:714 msgid "" ">>> import datetime\n" ">>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n" @@ -1110,11 +1139,11 @@ msgstr "" ">>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" "'2010-07-04 12:15:58'" -#: ../../library/string.rst:712 +#: ../../library/string.rst:719 msgid "Nesting arguments and more complex examples::" msgstr "巢狀引數及更多複雜範例: ::" -#: ../../library/string.rst:714 +#: ../../library/string.rst:721 msgid "" ">>> for align, text in zip('<^>', ['left', 'center', 'right']):\n" "... '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n" @@ -1172,11 +1201,11 @@ msgstr "" " 10 A 12 1010\n" " 11 B 13 1011" -#: ../../library/string.rst:746 +#: ../../library/string.rst:753 msgid "Template strings" msgstr "模板字串" -#: ../../library/string.rst:748 +#: ../../library/string.rst:755 msgid "" "Template strings provide simpler string substitutions as described in :pep:" "`292`. A primary use case for template strings is for internationalization " @@ -1190,17 +1219,17 @@ msgstr "" "化工具更容易翻譯。基於模板字串建構的 i18n 函式庫範例,請參閱 `flufl.i18n " "<https://flufli18n.readthedocs.io/en/latest/>`_ 套件。" -#: ../../library/string.rst:758 +#: ../../library/string.rst:765 msgid "" "Template strings support ``$``-based substitutions, using the following " "rules:" msgstr "" -#: ../../library/string.rst:760 +#: ../../library/string.rst:767 msgid "``$$`` is an escape; it is replaced with a single ``$``." msgstr "" -#: ../../library/string.rst:762 +#: ../../library/string.rst:769 msgid "" "``$identifier`` names a substitution placeholder matching a mapping key of " "``\"identifier\"``. By default, ``\"identifier\"`` is restricted to any " @@ -1210,30 +1239,30 @@ msgid "" "specification." msgstr "" -#: ../../library/string.rst:769 +#: ../../library/string.rst:776 msgid "" "``${identifier}`` is equivalent to ``$identifier``. It is required when " "valid identifier characters follow the placeholder but are not part of the " "placeholder, such as ``\"${noun}ification\"``." msgstr "" -#: ../../library/string.rst:773 +#: ../../library/string.rst:780 msgid "" "Any other appearance of ``$`` in the string will result in a :exc:" "`ValueError` being raised." msgstr "" -#: ../../library/string.rst:776 +#: ../../library/string.rst:783 msgid "" "The :mod:`string` module provides a :class:`Template` class that implements " "these rules. The methods of :class:`Template` are:" msgstr "" -#: ../../library/string.rst:782 +#: ../../library/string.rst:789 msgid "The constructor takes a single argument which is the template string." msgstr "" -#: ../../library/string.rst:787 +#: ../../library/string.rst:794 msgid "" "Performs the template substitution, returning a new string. *mapping* is " "any dictionary-like object with keys that match the placeholders in the " @@ -1245,7 +1274,7 @@ msgstr "" "的字典型物件。或者如果關鍵字就是佔位符號時,你也可以改提供關鍵字引數。當 " "*mapping* 跟 *kwds* 同時給定並存在重複時,*kwds* 的佔位符號會被優先使用。" -#: ../../library/string.rst:796 +#: ../../library/string.rst:803 msgid "" "Like :meth:`substitute`, except that if placeholders are missing from " "*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the " @@ -1258,7 +1287,7 @@ msgstr "" "與 :meth:`substitute` 不同的是,任何包含 ``$`` 的字句會直接回傳 ``$`` 而非引" "發 :exc:`ValueError`。" -#: ../../library/string.rst:802 +#: ../../library/string.rst:809 msgid "" "While other exceptions may still occur, this method is called \"safe\" " "because it always tries to return a usable string instead of raising an " @@ -1272,7 +1301,7 @@ msgstr "" "完全安全,因為它會默默忽略格式錯誤的模板,這些模板包含了多餘的左右定界符、不" "匹配的括號,或者不是有效的 Python 識別字的佔位符號。" -#: ../../library/string.rst:812 +#: ../../library/string.rst:819 msgid "" "Returns false if the template has invalid placeholders that will cause :meth:" "`substitute` to raise :exc:`ValueError`." @@ -1280,18 +1309,18 @@ msgstr "" "如果模板有將導致 :meth:`substitute` 引發 :exc:`ValueError` 的無效佔位符號,就" "會回傳 false。" -#: ../../library/string.rst:820 +#: ../../library/string.rst:827 msgid "" "Returns a list of the valid identifiers in the template, in the order they " "first appear, ignoring any invalid identifiers." msgstr "" "回傳模板中有效識別字的串列,按照它們首次出現的順序,並忽略任何無效的識別字。" -#: ../../library/string.rst:825 +#: ../../library/string.rst:832 msgid ":class:`Template` instances also provide one public data attribute:" msgstr ":class:`Template` 實例也提供一個公開的資料屬性:" -#: ../../library/string.rst:829 +#: ../../library/string.rst:836 msgid "" "This is the object passed to the constructor's *template* argument. In " "general, you shouldn't change it, but read-only access is not enforced." @@ -1299,11 +1328,11 @@ msgstr "" "這是傳遞給建構函式 *template* 引數的物件。一般來說,你不應該改變它,但並沒有" "強制設定成唯讀。" -#: ../../library/string.rst:832 +#: ../../library/string.rst:839 msgid "Here is an example of how to use a Template::" msgstr "以下是如何使用 Template 的一個範例: ::" -#: ../../library/string.rst:834 +#: ../../library/string.rst:841 msgid "" ">>> from string import Template\n" ">>> s = Template('$who likes $what')\n" @@ -1337,7 +1366,7 @@ msgstr "" ">>> Template('$who likes $what').safe_substitute(d)\n" "'tim likes $what'" -#: ../../library/string.rst:850 +#: ../../library/string.rst:857 msgid "" "Advanced usage: you can derive subclasses of :class:`Template` to customize " "the placeholder syntax, delimiter character, or the entire regular " @@ -1347,7 +1376,7 @@ msgstr "" "進階用法:你可以衍生 :class:`Template` 類別來自定義佔位符號語法、左右定界符字" "元,或者用於剖析模板字串的正規表示式。你可以透過覆寫這些類別屬性來達成:" -#: ../../library/string.rst:855 +#: ../../library/string.rst:862 msgid "" "*delimiter* -- This is the literal string describing a placeholder " "introducing delimiter. The default value is ``$``. Note that this should " @@ -1361,7 +1390,7 @@ msgstr "" "注意你不能在建立類別後修改左右定界符。(意即在子類別的命名空間中必須設置不同" "的左右定界符)" -#: ../../library/string.rst:862 +#: ../../library/string.rst:869 msgid "" "*idpattern* -- This is the regular expression describing the pattern for non-" "braced placeholders. The default value is the regular expression ``(?a:[_a-" @@ -1369,19 +1398,19 @@ msgid "" "pattern will also apply to braced placeholders." msgstr "" -#: ../../library/string.rst:869 +#: ../../library/string.rst:876 msgid "" "Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with " "some non-ASCII characters. That's why we use the local ``a`` flag here." msgstr "" -#: ../../library/string.rst:873 +#: ../../library/string.rst:880 msgid "" "*braceidpattern* can be used to define separate patterns used inside and " "outside the braces." msgstr "" -#: ../../library/string.rst:877 +#: ../../library/string.rst:884 msgid "" "*braceidpattern* -- This is like *idpattern* but describes the pattern for " "braced placeholders. Defaults to ``None`` which means to fall back to " @@ -1390,7 +1419,7 @@ msgid "" "unbraced placeholders." msgstr "" -#: ../../library/string.rst:885 +#: ../../library/string.rst:892 msgid "" "*flags* -- The regular expression flags that will be applied when compiling " "the regular expression used for recognizing substitutions. The default " @@ -1399,7 +1428,7 @@ msgid "" "regular expressions." msgstr "" -#: ../../library/string.rst:893 +#: ../../library/string.rst:900 msgid "" "Alternatively, you can provide the entire regular expression pattern by " "overriding the class attribute *pattern*. If you do this, the value must be " @@ -1408,13 +1437,13 @@ msgid "" "placeholder rule:" msgstr "" -#: ../../library/string.rst:899 +#: ../../library/string.rst:906 msgid "" "*escaped* -- This group matches the escape sequence, e.g. ``$$``, in the " "default pattern." msgstr "*escaped* -- 此群組與跳脫序列匹配,例如在預設模式下為 ``$$``。" -#: ../../library/string.rst:902 +#: ../../library/string.rst:909 msgid "" "*named* -- This group matches the unbraced placeholder name; it should not " "include the delimiter in capturing group." @@ -1422,7 +1451,7 @@ msgstr "" "*named* -- 此群組與不帶大括號的佔位符號名稱匹配;它不應包含擷取群組中的左右定" "界符號。" -#: ../../library/string.rst:905 +#: ../../library/string.rst:912 msgid "" "*braced* -- This group matches the brace enclosed placeholder name; it " "should not include either the delimiter or braces in the capturing group." @@ -1430,7 +1459,7 @@ msgstr "" "*braced* -- 此群組與大括號括起來的佔位符號名稱匹配;它不應在擷取群組中包含左" "右定界符或大括號。" -#: ../../library/string.rst:908 +#: ../../library/string.rst:915 msgid "" "*invalid* -- This group matches any other delimiter pattern (usually a " "single delimiter), and it should appear last in the regular expression." @@ -1438,7 +1467,7 @@ msgstr "" "*invalid* -- 此群組與任何其他左右定界符模式(通常是單一左右定界符)匹配,且它" "應該出現在正規表示式的最後。" -#: ../../library/string.rst:911 +#: ../../library/string.rst:918 msgid "" "The methods on this class will raise :exc:`ValueError` if the pattern " "matches the template without one of these named groups matching." @@ -1446,11 +1475,11 @@ msgstr "" "當此模式有匹配於模板但這些命名組中卻有任一個不匹配,此類別的方法將引發 :exc:" "`ValueError`。" -#: ../../library/string.rst:916 +#: ../../library/string.rst:923 msgid "Helper functions" msgstr "輔助函式" -#: ../../library/string.rst:920 +#: ../../library/string.rst:927 msgid "" "Split the argument into words using :meth:`str.split`, capitalize each word " "using :meth:`str.capitalize`, and join the capitalized words using :meth:" @@ -1471,7 +1500,7 @@ msgstr "{} (花括號)" #: ../../library/string.rst:195 ../../library/string.rst:335 #: ../../library/string.rst:368 ../../library/string.rst:387 #: ../../library/string.rst:396 ../../library/string.rst:410 -#: ../../library/string.rst:419 +#: ../../library/string.rst:421 msgid "in string formatting" msgstr "於字串格式化" @@ -1527,14 +1556,14 @@ msgstr "# (井字號)" msgid ", (comma)" msgstr ", (逗號)" -#: ../../library/string.rst:419 +#: ../../library/string.rst:421 msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../library/string.rst:756 +#: ../../library/string.rst:763 msgid "$ (dollar)" msgstr "$ (金錢符號)" -#: ../../library/string.rst:756 +#: ../../library/string.rst:763 msgid "in template strings" msgstr "於 template strings(模板字串)" diff --git a/library/token.po b/library/token.po index bd30000c13..de853e2c2d 100644 --- a/library/token.po +++ b/library/token.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-11-30 23:07+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -287,21 +287,27 @@ msgid "" "only produced when :func:`ast.parse` is invoked with ``type_comments=True``." msgstr "" -#: ../../library/token.rst:82 +#: ../../library/token.rst:84 +msgid "" +"A dictionary mapping the string representation of a token to its numeric " +"code." +msgstr "" + +#: ../../library/token.rst:89 msgid "Added :data:`!AWAIT` and :data:`!ASYNC` tokens." msgstr "" -#: ../../library/token.rst:85 +#: ../../library/token.rst:92 msgid "Added :data:`COMMENT`, :data:`NL` and :data:`ENCODING` tokens." msgstr "" -#: ../../library/token.rst:88 +#: ../../library/token.rst:95 msgid "" "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens. \"async\" and \"await\" " "are now tokenized as :data:`NAME` tokens." msgstr "" -#: ../../library/token.rst:92 +#: ../../library/token.rst:99 msgid "" "Added :data:`TYPE_COMMENT`, :data:`TYPE_IGNORE`, :data:`COLONEQUAL`. Added :" "data:`!AWAIT` and :data:`!ASYNC` tokens back (they're needed to support " @@ -309,6 +315,6 @@ msgid "" "set to 6 or lower)." msgstr "" -#: ../../library/token.rst:98 +#: ../../library/token.rst:105 msgid "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens again." msgstr "" diff --git a/library/traceback.po b/library/traceback.po index b2fbc3ea87..3a7269ef34 100644 --- a/library/traceback.po +++ b/library/traceback.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-12-13 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -150,11 +150,11 @@ msgid "" "when printing an unhandled exception." msgstr "" -#: ../../library/traceback.rst:104 ../../library/traceback.rst:208 +#: ../../library/traceback.rst:104 ../../library/traceback.rst:215 msgid "The *etype* argument is ignored and inferred from the type of *value*." msgstr "" -#: ../../library/traceback.rst:107 ../../library/traceback.rst:188 +#: ../../library/traceback.rst:107 ../../library/traceback.rst:195 msgid "" "The *etype* parameter has been renamed to *exc* and is now positional-only." msgstr "" @@ -205,6 +205,13 @@ msgstr "" #: ../../library/traceback.rst:162 msgid "" +"Print the list of tuples as returned by :func:`extract_tb` or :func:" +"`extract_stack` as a formatted stack trace to the given file. If *file* is " +"``None``, the output is written to :data:`sys.stderr`." +msgstr "" + +#: ../../library/traceback.rst:169 +msgid "" "Given a list of tuples or :class:`FrameSummary` objects as returned by :func:" "`extract_tb` or :func:`extract_stack`, return a list of strings ready for " "printing. Each string in the resulting list corresponds to the item with " @@ -213,7 +220,7 @@ msgid "" "text line is not ``None``." msgstr "" -#: ../../library/traceback.rst:172 +#: ../../library/traceback.rst:179 msgid "" "Format the exception part of a traceback using an exception value such as " "given by :data:`sys.last_value`. The return value is a list of strings, " @@ -224,31 +231,31 @@ msgid "" "contains the exception's :attr:`notes <BaseException.__notes__>`." msgstr "" -#: ../../library/traceback.rst:180 +#: ../../library/traceback.rst:187 msgid "" "Since Python 3.10, instead of passing *value*, an exception object can be " "passed as the first argument. If *value* is provided, the first argument is " "ignored in order to provide backwards compatibility." msgstr "" -#: ../../library/traceback.rst:184 ../../library/traceback.rst:415 +#: ../../library/traceback.rst:191 ../../library/traceback.rst:422 msgid "" "When *show_group* is ``True``, and the exception is an instance of :exc:" "`BaseExceptionGroup`, the nested exceptions are included as well, " "recursively, with indentation relative to their nesting depth." msgstr "" -#: ../../library/traceback.rst:192 +#: ../../library/traceback.rst:199 msgid "" "The returned list now includes any :attr:`notes <BaseException.__notes__>` " "attached to the exception." msgstr "" -#: ../../library/traceback.rst:196 +#: ../../library/traceback.rst:203 msgid "*show_group* parameter was added." msgstr "" -#: ../../library/traceback.rst:202 +#: ../../library/traceback.rst:209 msgid "" "Format a stack trace and the exception information. The arguments have the " "same meaning as the corresponding arguments to :func:`print_exception`. The " @@ -257,69 +264,69 @@ msgid "" "printed, exactly the same text is printed as does :func:`print_exception`." msgstr "" -#: ../../library/traceback.rst:211 +#: ../../library/traceback.rst:218 msgid "" "This function's behavior and signature were modified to match :func:" "`print_exception`." msgstr "" -#: ../../library/traceback.rst:218 +#: ../../library/traceback.rst:225 msgid "" "This is like ``print_exc(limit)`` but returns a string instead of printing " "to a file." msgstr "" -#: ../../library/traceback.rst:224 +#: ../../library/traceback.rst:231 msgid "A shorthand for ``format_list(extract_tb(tb, limit))``." msgstr "``format_list(extract_tb(tb, limit))`` 的簡寫。" -#: ../../library/traceback.rst:229 +#: ../../library/traceback.rst:236 msgid "A shorthand for ``format_list(extract_stack(f, limit))``." msgstr "``format_list(extract_stack(f, limit))`` 的簡寫。" -#: ../../library/traceback.rst:233 +#: ../../library/traceback.rst:240 msgid "" "Clears the local variables of all the stack frames in a :ref:`traceback " "<traceback-objects>` *tb* by calling the :meth:`~frame.clear` method of " "each :ref:`frame object <frame-objects>`." msgstr "" -#: ../../library/traceback.rst:242 +#: ../../library/traceback.rst:249 msgid "" "Walk a stack following :attr:`f.f_back <frame.f_back>` from the given frame, " "yielding the frame and line number for each frame. If *f* is ``None``, the " "current stack is used. This helper is used with :meth:`StackSummary.extract`." msgstr "" -#: ../../library/traceback.rst:251 +#: ../../library/traceback.rst:258 msgid "" "Walk a traceback following :attr:`~traceback.tb_next` yielding the frame and " "line number for each frame. This helper is used with :meth:`StackSummary." "extract`." msgstr "" -#: ../../library/traceback.rst:259 +#: ../../library/traceback.rst:266 msgid ":class:`!TracebackException` Objects" msgstr ":class:`!TracebackException` 物件" -#: ../../library/traceback.rst:263 +#: ../../library/traceback.rst:270 msgid "" ":class:`!TracebackException` objects are created from actual exceptions to " "capture data for later printing. They offer a more lightweight method of " "storing this information by avoiding holding references to :ref:" -"`traceback<traceback-objects>` and :ref:`frame<frame-objects>` objects In " +"`traceback<traceback-objects>` and :ref:`frame<frame-objects>` objects. In " "addition, they expose more options to configure the output compared to the " "module-level functions described above." msgstr "" -#: ../../library/traceback.rst:272 +#: ../../library/traceback.rst:279 msgid "" "Capture an exception for later rendering. The meaning of *limit*, " "*lookup_lines* and *capture_locals* are as for the :class:`StackSummary` " "class." msgstr "" -#: ../../library/traceback.rst:276 +#: ../../library/traceback.rst:283 msgid "" "If *compact* is true, only data that is required by :class:`!" "TracebackException`'s :meth:`format` method is saved in the class " @@ -327,12 +334,12 @@ msgid "" "if :attr:`__cause__` is ``None`` and :attr:`__suppress_context__` is false." msgstr "" -#: ../../library/traceback.rst:282 ../../library/traceback.rst:383 +#: ../../library/traceback.rst:289 ../../library/traceback.rst:390 msgid "" "Note that when locals are captured, they are also shown in the traceback." msgstr "" -#: ../../library/traceback.rst:284 +#: ../../library/traceback.rst:291 msgid "" "*max_group_width* and *max_group_depth* control the formatting of exception " "groups (see :exc:`BaseExceptionGroup`). The depth refers to the nesting " @@ -341,128 +348,128 @@ msgid "" "limit is exceeded." msgstr "" -#: ../../library/traceback.rst:290 +#: ../../library/traceback.rst:297 msgid "Added the *compact* parameter." msgstr "新增 *compact* 參數。" -#: ../../library/traceback.rst:293 +#: ../../library/traceback.rst:300 msgid "Added the *max_group_width* and *max_group_depth* parameters." msgstr "新增 *max_group_width* 和 *max_group_depth* 參數。" -#: ../../library/traceback.rst:298 +#: ../../library/traceback.rst:305 msgid "" "A :class:`!TracebackException` of the original :attr:`~BaseException." "__cause__`." msgstr "" -#: ../../library/traceback.rst:303 +#: ../../library/traceback.rst:310 msgid "" "A :class:`!TracebackException` of the original :attr:`~BaseException." "__context__`." msgstr "" -#: ../../library/traceback.rst:308 +#: ../../library/traceback.rst:315 msgid "" "If ``self`` represents an :exc:`ExceptionGroup`, this field holds a list of :" "class:`!TracebackException` instances representing the nested exceptions. " "Otherwise it is ``None``." msgstr "" -#: ../../library/traceback.rst:316 +#: ../../library/traceback.rst:323 msgid "" "The :attr:`~BaseException.__suppress_context__` value from the original " "exception." msgstr "" -#: ../../library/traceback.rst:321 +#: ../../library/traceback.rst:328 msgid "" "The :attr:`~BaseException.__notes__` value from the original exception, or " "``None`` if the exception does not have any notes. If it is not ``None`` is " "it formatted in the traceback after the exception string." msgstr "" -#: ../../library/traceback.rst:330 +#: ../../library/traceback.rst:337 msgid "A :class:`StackSummary` representing the traceback." msgstr "" -#: ../../library/traceback.rst:334 +#: ../../library/traceback.rst:341 msgid "The class of the original traceback." msgstr "" -#: ../../library/traceback.rst:340 +#: ../../library/traceback.rst:347 msgid "String display of the class of the original exception." msgstr "" -#: ../../library/traceback.rst:346 +#: ../../library/traceback.rst:353 msgid "For syntax errors - the file name where the error occurred." msgstr "" -#: ../../library/traceback.rst:350 +#: ../../library/traceback.rst:357 msgid "For syntax errors - the line number where the error occurred." msgstr "" -#: ../../library/traceback.rst:354 +#: ../../library/traceback.rst:361 msgid "" "For syntax errors - the end line number where the error occurred. Can be " "``None`` if not present." msgstr "" -#: ../../library/traceback.rst:361 +#: ../../library/traceback.rst:368 msgid "For syntax errors - the text where the error occurred." msgstr "" -#: ../../library/traceback.rst:365 +#: ../../library/traceback.rst:372 msgid "For syntax errors - the offset into the text where the error occurred." msgstr "" -#: ../../library/traceback.rst:369 +#: ../../library/traceback.rst:376 msgid "" "For syntax errors - the end offset into the text where the error occurred. " "Can be ``None`` if not present." msgstr "" -#: ../../library/traceback.rst:376 +#: ../../library/traceback.rst:383 msgid "For syntax errors - the compiler error message." msgstr "" -#: ../../library/traceback.rst:380 +#: ../../library/traceback.rst:387 msgid "" "Capture an exception for later rendering. *limit*, *lookup_lines* and " "*capture_locals* are as for the :class:`StackSummary` class." msgstr "" -#: ../../library/traceback.rst:387 +#: ../../library/traceback.rst:394 msgid "" "Print to *file* (default ``sys.stderr``) the exception information returned " "by :meth:`format`." msgstr "" -#: ../../library/traceback.rst:394 +#: ../../library/traceback.rst:401 msgid "Format the exception." msgstr "" -#: ../../library/traceback.rst:396 +#: ../../library/traceback.rst:403 msgid "" "If *chain* is not ``True``, :attr:`__cause__` and :attr:`__context__` will " "not be formatted." msgstr "" -#: ../../library/traceback.rst:399 +#: ../../library/traceback.rst:406 msgid "" "The return value is a generator of strings, each ending in a newline and " "some containing internal newlines. :func:`~traceback.print_exception` is a " "wrapper around this method which just prints the lines to a file." msgstr "" -#: ../../library/traceback.rst:405 +#: ../../library/traceback.rst:412 msgid "Format the exception part of the traceback." msgstr "" -#: ../../library/traceback.rst:407 +#: ../../library/traceback.rst:414 msgid "The return value is a generator of strings, each ending in a newline." msgstr "" -#: ../../library/traceback.rst:409 +#: ../../library/traceback.rst:416 msgid "" "When *show_group* is ``False``, the generator emits the exception's message " "followed by its notes (if it has any). The exception message is normally a " @@ -471,32 +478,32 @@ msgid "" "the syntax error occurred." msgstr "" -#: ../../library/traceback.rst:419 +#: ../../library/traceback.rst:426 msgid "" "The exception's :attr:`notes <BaseException.__notes__>` are now included in " "the output." msgstr "" -#: ../../library/traceback.rst:423 +#: ../../library/traceback.rst:430 msgid "Added the *show_group* parameter." msgstr "新增 *show_group* 參數。" -#: ../../library/traceback.rst:428 +#: ../../library/traceback.rst:435 msgid ":class:`!StackSummary` Objects" msgstr ":class:`!StackSummary` 物件" -#: ../../library/traceback.rst:432 +#: ../../library/traceback.rst:439 msgid "" ":class:`!StackSummary` objects represent a call stack ready for formatting." msgstr "" -#: ../../library/traceback.rst:438 +#: ../../library/traceback.rst:445 msgid "" "Construct a :class:`!StackSummary` object from a frame generator (such as is " "returned by :func:`~traceback.walk_stack` or :func:`~traceback.walk_tb`)." msgstr "" -#: ../../library/traceback.rst:442 +#: ../../library/traceback.rst:449 msgid "" "If *limit* is supplied, only this many frames are taken from *frame_gen*. If " "*lookup_lines* is ``False``, the returned :class:`FrameSummary` objects will " @@ -506,20 +513,20 @@ msgid "" "class:`!FrameSummary` are captured as object representations." msgstr "" -#: ../../library/traceback.rst:450 +#: ../../library/traceback.rst:457 msgid "" "Exceptions raised from :func:`repr` on a local variable (when " "*capture_locals* is ``True``) are no longer propagated to the caller." msgstr "" -#: ../../library/traceback.rst:456 +#: ../../library/traceback.rst:463 msgid "" "Construct a :class:`!StackSummary` object from a supplied list of :class:" "`FrameSummary` objects or old-style list of tuples. Each tuple should be a " "4-tuple with *filename*, *lineno*, *name*, *line* as the elements." msgstr "" -#: ../../library/traceback.rst:463 +#: ../../library/traceback.rst:470 msgid "" "Returns a list of strings ready for printing. Each string in the resulting " "list corresponds to a single :ref:`frame <frame-objects>` from the stack. " @@ -527,18 +534,18 @@ msgid "" "well, for those items with source text lines." msgstr "" -#: ../../library/traceback.rst:469 +#: ../../library/traceback.rst:476 msgid "" "For long sequences of the same frame and line, the first few repetitions are " "shown, followed by a summary line stating the exact number of further " "repetitions." msgstr "" -#: ../../library/traceback.rst:473 +#: ../../library/traceback.rst:480 msgid "Long sequences of repeated frames are now abbreviated." msgstr "" -#: ../../library/traceback.rst:478 +#: ../../library/traceback.rst:485 msgid "" "Returns a string for printing one of the :ref:`frames <frame-objects>` " "involved in the stack. This method is called for each :class:`FrameSummary` " @@ -546,17 +553,17 @@ msgid "" "the frame is omitted from the output." msgstr "" -#: ../../library/traceback.rst:488 +#: ../../library/traceback.rst:495 msgid ":class:`!FrameSummary` Objects" msgstr ":class:`!FrameSummary` 物件" -#: ../../library/traceback.rst:492 +#: ../../library/traceback.rst:499 msgid "" "A :class:`!FrameSummary` object represents a single :ref:`frame <frame-" "objects>` in a :ref:`traceback <traceback-objects>`." msgstr "" -#: ../../library/traceback.rst:497 +#: ../../library/traceback.rst:504 msgid "" "Represents a single :ref:`frame <frame-objects>` in the :ref:`traceback " "<traceback-objects>` or stack that is being formatted or printed. It may " @@ -570,38 +577,38 @@ msgid "" "display." msgstr "" -#: ../../library/traceback.rst:508 +#: ../../library/traceback.rst:515 msgid ":class:`!FrameSummary` instances have the following attributes:" msgstr "" -#: ../../library/traceback.rst:512 +#: ../../library/traceback.rst:519 msgid "" "The filename of the source code for this frame. Equivalent to accessing :" "attr:`f.f_code.co_filename <codeobject.co_filename>` on a :ref:`frame object " "<frame-objects>` *f*." msgstr "" -#: ../../library/traceback.rst:518 +#: ../../library/traceback.rst:525 msgid "The line number of the source code for this frame." msgstr "" -#: ../../library/traceback.rst:522 +#: ../../library/traceback.rst:529 msgid "" "Equivalent to accessing :attr:`f.f_code.co_name <codeobject.co_name>` on a :" "ref:`frame object <frame-objects>` *f*." msgstr "" -#: ../../library/traceback.rst:527 +#: ../../library/traceback.rst:534 msgid "" "A string representing the source code for this frame, with leading and " "trailing whitespace stripped. If the source is not available, it is ``None``." msgstr "" -#: ../../library/traceback.rst:534 +#: ../../library/traceback.rst:541 msgid "Examples of Using the Module-Level Functions" msgstr "" -#: ../../library/traceback.rst:536 +#: ../../library/traceback.rst:543 msgid "" "This simple example implements a basic read-eval-print loop, similar to (but " "less useful than) the standard Python interactive interpreter loop. For a " @@ -609,7 +616,7 @@ msgid "" "`code` module. ::" msgstr "" -#: ../../library/traceback.rst:541 +#: ../../library/traceback.rst:548 msgid "" "import sys, traceback\n" "\n" @@ -628,13 +635,13 @@ msgid "" " run_user_code(envdir)" msgstr "" -#: ../../library/traceback.rst:558 +#: ../../library/traceback.rst:565 msgid "" "The following example demonstrates the different ways to print and format " "the exception and traceback:" msgstr "" -#: ../../library/traceback.rst:561 +#: ../../library/traceback.rst:568 msgid "" "import sys, traceback\n" "\n" @@ -666,11 +673,11 @@ msgid "" " print(\"*** tb_lineno:\", exc.__traceback__.tb_lineno)" msgstr "" -#: ../../library/traceback.rst:592 +#: ../../library/traceback.rst:599 msgid "The output for the example would look similar to this:" msgstr "" -#: ../../library/traceback.rst:594 +#: ../../library/traceback.rst:601 msgid "" "*** print_tb:\n" " File \"<doctest...>\", line 10, in <module>\n" @@ -720,13 +727,13 @@ msgid "" "*** tb_lineno: 10" msgstr "" -#: ../../library/traceback.rst:639 +#: ../../library/traceback.rst:646 msgid "" "The following example shows the different ways to print and format the " "stack::" msgstr "" -#: ../../library/traceback.rst:641 +#: ../../library/traceback.rst:648 msgid "" ">>> import traceback\n" ">>> def another_function():\n" @@ -778,11 +785,11 @@ msgstr "" " ' File \"<doctest>\", line 8, in lumberstack\\n print(repr(traceback." "format_stack()))\\n']" -#: ../../library/traceback.rst:665 +#: ../../library/traceback.rst:672 msgid "This last example demonstrates the final few formatting functions:" msgstr "" -#: ../../library/traceback.rst:667 +#: ../../library/traceback.rst:674 msgid "" ">>> import traceback\n" ">>> traceback.format_list([('spam.py', 3, '<module>', 'spam.eggs()'),\n" @@ -794,15 +801,15 @@ msgid "" "['IndexError: tuple index out of range\\n']" msgstr "" -#: ../../library/traceback.rst:681 +#: ../../library/traceback.rst:688 msgid "Examples of Using :class:`TracebackException`" msgstr ":class:`TracebackException` 的使用範例" -#: ../../library/traceback.rst:683 +#: ../../library/traceback.rst:690 msgid "With the helper class, we have more options::" msgstr "" -#: ../../library/traceback.rst:685 +#: ../../library/traceback.rst:692 msgid "" ">>> import sys\n" ">>> from traceback import TracebackException\n" diff --git a/library/xmlrpc.po b/library/xmlrpc.po index 15a6dc34eb..00defcf838 100644 --- a/library/xmlrpc.po +++ b/library/xmlrpc.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-29 10:36+0000\n" +"POT-Creation-Date: 2024-12-11 00:14+0000\n" "PO-Revision-Date: 2022-02-16 01:58+0800\n" "Last-Translator: Matt Wang <mattwang44@gamil.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,7 +23,7 @@ msgstr "" msgid ":mod:`!xmlrpc` --- XMLRPC server and client modules" msgstr ":mod:`!xmlrpc` --- XMLRPC 伺服器與用戶模組" -#: ../../library/xmlrpc.rst:4 +#: ../../library/xmlrpc.rst:7 msgid "" "XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP as a " "transport. With it, a client can call methods with parameters on a remote " @@ -33,17 +33,17 @@ msgstr "" "(transport)的 XML 來做傳遞。有了它,用戶端可以在遠端伺服器上呼叫帶有參數的" "方法(伺服器以 URI 命名)並獲取結構化的資料。" -#: ../../library/xmlrpc.rst:8 +#: ../../library/xmlrpc.rst:11 msgid "" "``xmlrpc`` is a package that collects server and client modules implementing " "XML-RPC. The modules are:" msgstr "" "``xmlrpc`` 是一個集合了 XML-RPC 伺服器與用戶端模組實作的套件。這些模組是:" -#: ../../library/xmlrpc.rst:11 +#: ../../library/xmlrpc.rst:14 msgid ":mod:`xmlrpc.client`" msgstr ":mod:`xmlrpc.client`" -#: ../../library/xmlrpc.rst:12 +#: ../../library/xmlrpc.rst:15 msgid ":mod:`xmlrpc.server`" msgstr ":mod:`xmlrpc.server`" diff --git a/reference/simple_stmts.po b/reference/simple_stmts.po index b29815534b..8ad51dca40 100644 --- a/reference/simple_stmts.po +++ b/reference/simple_stmts.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-12-03 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -447,12 +447,13 @@ msgstr "" msgid "" "These equivalences assume that :const:`__debug__` and :exc:`AssertionError` " "refer to the built-in variables with those names. In the current " -"implementation, the built-in variable :const:`__debug__` is ``True`` under " -"normal circumstances, ``False`` when optimization is requested (command line " -"option :option:`-O`). The current code generator emits no code for an " -"assert statement when optimization is requested at compile time. Note that " -"it is unnecessary to include the source code for the expression that failed " -"in the error message; it will be displayed as part of the stack trace." +"implementation, the built-in variable ``__debug__`` is ``True`` under normal " +"circumstances, ``False`` when optimization is requested (command line " +"option :option:`-O`). The current code generator emits no code for an :" +"keyword:`assert` statement when optimization is requested at compile time. " +"Note that it is unnecessary to include the source code for the expression " +"that failed in the error message; it will be displayed as part of the stack " +"trace." msgstr "" #: ../../reference/simple_stmts.rst:416 @@ -569,7 +570,7 @@ msgstr ":keyword:`!yield` 陳述式" #: ../../reference/simple_stmts.rst:533 msgid "" "A :keyword:`yield` statement is semantically equivalent to a :ref:`yield " -"expression <yieldexpr>`. The yield statement can be used to omit the " +"expression <yieldexpr>`. The ``yield`` statement can be used to omit the " "parentheses that would otherwise be required in the equivalent yield " "expression statement. For example, the yield statements ::" msgstr "" @@ -598,8 +599,9 @@ msgstr "" msgid "" "Yield expressions and statements are only used when defining a :term:" "`generator` function, and are only used in the body of the generator " -"function. Using yield in a function definition is sufficient to cause that " -"definition to create a generator function instead of a normal function." +"function. Using :keyword:`yield` in a function definition is sufficient to " +"cause that definition to create a generator function instead of a normal " +"function." msgstr "" #: ../../reference/simple_stmts.rst:551 @@ -1153,35 +1155,20 @@ msgstr ":keyword:`!global` 陳述式" #: ../../reference/simple_stmts.rst:967 msgid "" -"The :keyword:`global` statement is a declaration which holds for the entire " -"current code block. It means that the listed identifiers are to be " -"interpreted as globals. It would be impossible to assign to a global " +"The :keyword:`global` statement causes the listed identifiers to be " +"interpreted as globals. It would be impossible to assign to a global " "variable without :keyword:`!global`, although free variables may refer to " "globals without being declared global." msgstr "" -#: ../../reference/simple_stmts.rst:973 +#: ../../reference/simple_stmts.rst:972 msgid "" -"Names listed in a :keyword:`global` statement must not be used in the same " -"code block textually preceding that :keyword:`!global` statement." +"The :keyword:`global` statement applies to the entire scope of a function or " +"class body. A :exc:`SyntaxError` is raised if a variable is used or assigned " +"to prior to its global declaration in the scope." msgstr "" -#: ../../reference/simple_stmts.rst:976 -msgid "" -"Names listed in a :keyword:`global` statement must not be defined as formal " -"parameters, or as targets in :keyword:`with` statements or :keyword:`except` " -"clauses, or in a :keyword:`for` target list, :keyword:`class` definition, " -"function definition, :keyword:`import` statement, or variable annotation." -msgstr "" - -#: ../../reference/simple_stmts.rst:983 -msgid "" -"The current implementation does not enforce some of these restrictions, but " -"programs should not abuse this freedom, as future implementations may " -"enforce them or silently change the meaning of the program." -msgstr "" - -#: ../../reference/simple_stmts.rst:992 +#: ../../reference/simple_stmts.rst:981 msgid "" "**Programmer's note:** :keyword:`global` is a directive to the parser. It " "applies only to code parsed at the same time as the :keyword:`!global` " @@ -1193,11 +1180,11 @@ msgid "" "func:`compile` functions." msgstr "" -#: ../../reference/simple_stmts.rst:1004 +#: ../../reference/simple_stmts.rst:993 msgid "The :keyword:`!nonlocal` statement" msgstr ":keyword:`!nonlocal` 陳述式" -#: ../../reference/simple_stmts.rst:1012 +#: ../../reference/simple_stmts.rst:1001 msgid "" "When the definition of a function or class is nested (enclosed) within the " "definitions of other functions, its nonlocal scopes are the local scopes of " @@ -1209,64 +1196,64 @@ msgid "" "`SyntaxError` is raised." msgstr "" -#: ../../reference/simple_stmts.rst:1021 +#: ../../reference/simple_stmts.rst:1010 msgid "" -"The nonlocal statement applies to the entire scope of a function or class " -"body. A :exc:`SyntaxError` is raised if a variable is used or assigned to " -"prior to its nonlocal declaration in the scope." +"The :keyword:`nonlocal` statement applies to the entire scope of a function " +"or class body. A :exc:`SyntaxError` is raised if a variable is used or " +"assigned to prior to its nonlocal declaration in the scope." msgstr "" -#: ../../reference/simple_stmts.rst:1027 +#: ../../reference/simple_stmts.rst:1016 msgid ":pep:`3104` - Access to Names in Outer Scopes" msgstr "" -#: ../../reference/simple_stmts.rst:1028 +#: ../../reference/simple_stmts.rst:1017 msgid "The specification for the :keyword:`nonlocal` statement." msgstr "" -#: ../../reference/simple_stmts.rst:1030 +#: ../../reference/simple_stmts.rst:1019 msgid "" "**Programmer's note:** :keyword:`nonlocal` is a directive to the parser and " "applies only to code parsed along with it. See the note for the :keyword:" "`global` statement." msgstr "" -#: ../../reference/simple_stmts.rst:1038 +#: ../../reference/simple_stmts.rst:1027 msgid "The :keyword:`!type` statement" msgstr ":keyword:`!type` 陳述式" -#: ../../reference/simple_stmts.rst:1045 +#: ../../reference/simple_stmts.rst:1034 msgid "" "The :keyword:`!type` statement declares a type alias, which is an instance " "of :class:`typing.TypeAliasType`." msgstr "" -#: ../../reference/simple_stmts.rst:1048 +#: ../../reference/simple_stmts.rst:1037 msgid "For example, the following statement creates a type alias::" msgstr "" -#: ../../reference/simple_stmts.rst:1050 +#: ../../reference/simple_stmts.rst:1039 msgid "type Point = tuple[float, float]" msgstr "" -#: ../../reference/simple_stmts.rst:1052 +#: ../../reference/simple_stmts.rst:1041 msgid "This code is roughly equivalent to::" msgstr "" -#: ../../reference/simple_stmts.rst:1054 +#: ../../reference/simple_stmts.rst:1043 msgid "" "annotation-def VALUE_OF_Point():\n" " return tuple[float, float]\n" "Point = typing.TypeAliasType(\"Point\", VALUE_OF_Point())" msgstr "" -#: ../../reference/simple_stmts.rst:1058 +#: ../../reference/simple_stmts.rst:1047 msgid "" "``annotation-def`` indicates an :ref:`annotation scope <annotation-scopes>`, " "which behaves mostly like a function, but with several small differences." msgstr "" -#: ../../reference/simple_stmts.rst:1061 +#: ../../reference/simple_stmts.rst:1050 msgid "" "The value of the type alias is evaluated in the annotation scope. It is not " "evaluated when the type alias is created, but only when the value is " @@ -1275,21 +1262,21 @@ msgid "" "not yet defined." msgstr "" -#: ../../reference/simple_stmts.rst:1067 +#: ../../reference/simple_stmts.rst:1056 msgid "" "Type aliases may be made generic by adding a :ref:`type parameter list <type-" "params>` after the name. See :ref:`generic-type-aliases` for more." msgstr "" -#: ../../reference/simple_stmts.rst:1070 +#: ../../reference/simple_stmts.rst:1059 msgid ":keyword:`!type` is a :ref:`soft keyword <soft-keywords>`." msgstr "" -#: ../../reference/simple_stmts.rst:1076 +#: ../../reference/simple_stmts.rst:1065 msgid ":pep:`695` - Type Parameter Syntax" msgstr "" -#: ../../reference/simple_stmts.rst:1077 +#: ../../reference/simple_stmts.rst:1066 msgid "" "Introduced the :keyword:`!type` statement and syntax for generic classes and " "functions." @@ -1307,8 +1294,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:523 ../../reference/simple_stmts.rst:559 #: ../../reference/simple_stmts.rst:684 ../../reference/simple_stmts.rst:718 #: ../../reference/simple_stmts.rst:743 ../../reference/simple_stmts.rst:873 -#: ../../reference/simple_stmts.rst:959 ../../reference/simple_stmts.rst:1006 -#: ../../reference/simple_stmts.rst:1040 +#: ../../reference/simple_stmts.rst:959 ../../reference/simple_stmts.rst:995 +#: ../../reference/simple_stmts.rst:1029 msgid "statement" msgstr "statement(陳述式)" @@ -1322,7 +1309,7 @@ msgstr "" msgid "list" msgstr "list(串列)" -#: ../../reference/simple_stmts.rst:56 ../../reference/simple_stmts.rst:987 +#: ../../reference/simple_stmts.rst:56 ../../reference/simple_stmts.rst:976 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -1418,7 +1405,7 @@ msgstr "target" #: ../../reference/simple_stmts.rst:116 ../../reference/simple_stmts.rst:382 #: ../../reference/simple_stmts.rst:743 ../../reference/simple_stmts.rst:959 -#: ../../reference/simple_stmts.rst:1006 +#: ../../reference/simple_stmts.rst:995 msgid ", (comma)" msgstr ", (逗號)" @@ -1748,26 +1735,26 @@ msgstr "__future__" msgid "future statement" msgstr "future statement(future 陳述式)" -#: ../../reference/simple_stmts.rst:959 ../../reference/simple_stmts.rst:1006 +#: ../../reference/simple_stmts.rst:959 ../../reference/simple_stmts.rst:995 msgid "identifier list" msgstr "identifier list(識別符號清單)" -#: ../../reference/simple_stmts.rst:987 +#: ../../reference/simple_stmts.rst:976 msgid "exec" msgstr "exec" -#: ../../reference/simple_stmts.rst:987 +#: ../../reference/simple_stmts.rst:976 msgid "eval" msgstr "eval" -#: ../../reference/simple_stmts.rst:987 +#: ../../reference/simple_stmts.rst:976 msgid "compile" msgstr "compile(編譯)" -#: ../../reference/simple_stmts.rst:1006 +#: ../../reference/simple_stmts.rst:995 msgid "nonlocal" msgstr "nonlocal" -#: ../../reference/simple_stmts.rst:1040 +#: ../../reference/simple_stmts.rst:1029 msgid "type" msgstr "" diff --git a/tutorial/datastructures.po b/tutorial/datastructures.po index 2974c0a980..d466df73d1 100644 --- a/tutorial/datastructures.po +++ b/tutorial/datastructures.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-31 00:13+0000\n" +"POT-Creation-Date: 2024-12-07 00:14+0000\n" "PO-Revision-Date: 2024-01-22 21:43+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -160,6 +160,27 @@ msgid "" ">>> fruits.pop()\n" "'pear'" msgstr "" +">>> fruits = ['orange', 'apple', 'pear', 'banana', 'kiwi', 'apple', " +"'banana']\n" +">>> fruits.count('apple')\n" +"2\n" +">>> fruits.count('tangerine')\n" +"0\n" +">>> fruits.index('banana')\n" +"3\n" +">>> fruits.index('banana', 4) # 從位置 4 開始找到下一個 banana\n" +"6\n" +">>> fruits.reverse()\n" +">>> fruits\n" +"['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange']\n" +">>> fruits.append('grape')\n" +">>> fruits\n" +"['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange', 'grape']\n" +">>> fruits.sort()\n" +">>> fruits\n" +"['apple', 'apple', 'banana', 'banana', 'grape', 'kiwi', 'orange', 'pear']\n" +">>> fruits.pop()\n" +"'pear'" #: ../../tutorial/datastructures.rst:122 msgid "" @@ -193,14 +214,14 @@ msgstr "將 List 作為 Stack(堆疊)使用" msgid "" "The list methods make it very easy to use a list as a stack, where the last " "element added is the first element retrieved (\"last-in, first-out\"). To " -"add an item to the top of the stack, use :meth:`~list.append`. To retrieve " -"an item from the top of the stack, use :meth:`~list.pop` without an explicit " -"index. For example::" +"add an item to the top of the stack, use :meth:`!append`. To retrieve an " +"item from the top of the stack, use :meth:`!pop` without an explicit index. " +"For example::" msgstr "" "List 的操作方法使得它非常簡單可以用來實作 stack(堆疊)。Stack 為一個遵守最後" "加入元素最先被取回(後進先出,\"last-in, first-out\")規則的資料結構。你可以" -"使用方法 :meth:`~list.append` 將一個項目放到堆疊的頂層。而使用方法 :meth:" -"`~list.pop` 且不給定索引值去取得堆疊最上面的項目。舉例而言: ::" +"使用方法 :meth:`!append` 將一個項目放到堆疊的頂層。而使用方法 :meth:`!pop` 且" +"不給定索引值去取得堆疊最上面的項目。舉例而言: ::" #: ../../tutorial/datastructures.rst:148 msgid "" @@ -274,6 +295,16 @@ msgid "" ">>> queue # Remaining queue in order of arrival\n" "deque(['Michael', 'Terry', 'Graham'])" msgstr "" +">>> from collections import deque\n" +">>> queue = deque([\"Eric\", \"John\", \"Michael\"])\n" +">>> queue.append(\"Terry\") # Terry 加進來\n" +">>> queue.append(\"Graham\") # Graham 加進來\n" +">>> queue.popleft() # 第一個加進來的現在離開\n" +"'Eric'\n" +">>> queue.popleft() # 第二個加進來的現在離開\n" +"'John'\n" +">>> queue # queue 裡剩下的會按照加進來的順序排列\n" +"deque(['Michael', 'Terry', 'Graham'])" #: ../../tutorial/datastructures.rst:196 msgid "List Comprehensions" @@ -528,6 +559,16 @@ msgid "" ">>> transposed\n" "[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]" msgstr "" +">>> transposed = []\n" +">>> for i in range(4):\n" +"... # 下面這三行實作了巢狀的 listcomp\n" +"... transposed_row = []\n" +"... for row in matrix:\n" +"... transposed_row.append(row[i])\n" +"... transposed.append(transposed_row)\n" +"...\n" +">>> transposed\n" +"[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]" #: ../../tutorial/datastructures.rst:329 msgid "" @@ -557,15 +598,15 @@ msgstr ":keyword:`!del` 陳述式" #: ../../tutorial/datastructures.rst:342 msgid "" "There is a way to remove an item from a list given its index instead of its " -"value: the :keyword:`del` statement. This differs from the :meth:`~list." -"pop` method which returns a value. The :keyword:`!del` statement can also " -"be used to remove slices from a list or clear the entire list (which we did " +"value: the :keyword:`del` statement. This differs from the :meth:`!pop` " +"method which returns a value. The :keyword:`!del` statement can also be " +"used to remove slices from a list or clear the entire list (which we did " "earlier by assignment of an empty list to the slice). For example::" msgstr "" "有一個方法可以藉由索引而不是值來刪除 list 中的項目::keyword:`del` 陳述式。這" -"和 :meth:`~list.pop` method 傳回一個值不同,:keyword:`!del` 陳述式可以用來刪" -"除 list 中的片段或者清空整個 list(我們之前藉由指派一個空的 list 給想刪除的片" -"段來完成這件事)。例如: ::" +"和 :meth:`!pop` method 傳回一個值不同,:keyword:`!del` 陳述式可以用來刪除 " +"list 中的片段或者清空整個 list(我們之前藉由指派一個空的 list 給想刪除的片段" +"來完成這件事)。例如: ::" #: ../../tutorial/datastructures.rst:348 msgid "" @@ -650,6 +691,24 @@ msgid "" ">>> v\n" "([1, 2, 3], [3, 2, 1])" msgstr "" +">>> t = 12345, 54321, 'hello!'\n" +">>> t[0]\n" +"12345\n" +">>> t\n" +"(12345, 54321, 'hello!')\n" +">>> # Tuple 可以為巢狀的:\n" +">>> u = t, (1, 2, 3, 4, 5)\n" +">>> u\n" +"((12345, 54321, 'hello!'), (1, 2, 3, 4, 5))\n" +">>> # Tuple 為不可變的:\n" +">>> t[0] = 88888\n" +"Traceback (most recent call last):\n" +" File \"<stdin>\", line 1, in <module>\n" +"TypeError: 'tuple' object does not support item assignment\n" +">>> # but they can contain mutable objects:\n" +">>> v = ([1, 2, 3], [3, 2, 1])\n" +">>> v\n" +"([1, 2, 3], [3, 2, 1])" #: ../../tutorial/datastructures.rst:400 msgid "" @@ -706,6 +765,14 @@ msgid "" ">>> singleton\n" "('hello',)" msgstr "" +">>> empty = ()\n" +">>> singleton = 'hello', # <-- 注意後面有個逗號\n" +">>> len(empty)\n" +"0\n" +">>> len(singleton)\n" +"1\n" +">>> singleton\n" +"('hello',)" #: ../../tutorial/datastructures.rst:430 msgid "" @@ -822,8 +889,8 @@ msgid "" "can be used as keys if they contain only strings, numbers, or tuples; if a " "tuple contains any mutable object either directly or indirectly, it cannot " "be used as a key. You can't use lists as keys, since lists can be modified " -"in place using index assignments, slice assignments, or methods like :meth:" -"`~list.append` and :meth:`~list.extend`." +"in place using index assignments, slice assignments, or methods like :meth:`!" +"append` and :meth:`!extend`." msgstr "" "下一個常用的 Python 內建資料類型為 *dictionary*\\ (請參考\\ :ref:" "`typesmapping`\\ )。 Dictionary 有時被稱為「關聯記憶體」(associative " @@ -832,8 +899,7 @@ msgstr "" "和數字都可以當作鍵。Tuple 也可以當作鍵,如果他們只含有字串、數字或 tuple;若" "一個 tuple 直接或間接地含有任何可變的物件,它就不能當作鍵。你無法使用 list 當" "作鍵,因為 list 可以經由索引指派 (index assignment)、切片指派 (slice " -"assignment) 或是像 :meth:`~list.append` 和 :meth:`~list.extend` 等 method 被" -"修改。" +"assignment) 或是像 :meth:`!append` 和 :meth:`!extend` 等 method 被修改。" #: ../../tutorial/datastructures.rst:506 msgid "" diff --git a/using/ios.po b/using/ios.po index 1f1bd2a519..1f08607933 100644 --- a/using/ios.po +++ b/using/ios.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2024-12-10 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -473,59 +473,65 @@ msgid "" msgstr "" #: ../../using/ios.rst:295 -msgid ":c:member:`UTF-8 mode <PyPreConfig.utf8_mode>` is *enabled*;" +msgid "UTF-8 mode (:c:member:`PyPreConfig.utf8_mode`) is *enabled*;" msgstr "" #: ../../using/ios.rst:296 -msgid ":c:member:`Buffered stdio <PyConfig.buffered_stdio>` is *disabled*;" +msgid "Buffered stdio (:c:member:`PyConfig.buffered_stdio`) is *disabled*;" msgstr "" #: ../../using/ios.rst:297 -msgid ":c:member:`Writing bytecode <PyConfig.write_bytecode>` is *disabled*;" +msgid "Writing bytecode (:c:member:`PyConfig.write_bytecode`) is *disabled*;" msgstr "" #: ../../using/ios.rst:298 msgid "" -":c:member:`Signal handlers <PyConfig.install_signal_handlers>` are *enabled*;" +"Signal handlers (:c:member:`PyConfig.install_signal_handlers`) are *enabled*;" msgstr "" #: ../../using/ios.rst:299 msgid "" +"System logging (:c:member:`PyConfig.use_system_logger`) is *enabled* " +"(optional, but strongly recommended);" +msgstr "" + +#: ../../using/ios.rst:301 +msgid "" "``PYTHONHOME`` for the interpreter is configured to point at the ``python`` " "subfolder of your app's bundle; and" msgstr "" -#: ../../using/ios.rst:301 +#: ../../using/ios.rst:303 msgid "The ``PYTHONPATH`` for the interpreter includes:" msgstr "" -#: ../../using/ios.rst:303 +#: ../../using/ios.rst:305 msgid "the ``python/lib/python3.X`` subfolder of your app's bundle," msgstr "" -#: ../../using/ios.rst:304 +#: ../../using/ios.rst:306 msgid "" "the ``python/lib/python3.X/lib-dynload`` subfolder of your app's bundle, and" msgstr "" -#: ../../using/ios.rst:305 +#: ../../using/ios.rst:307 msgid "the ``app`` subfolder of your app's bundle" msgstr "" -#: ../../using/ios.rst:307 +#: ../../using/ios.rst:309 msgid "" "Your app's bundle location can be determined using ``[[NSBundle mainBundle] " "resourcePath]``." msgstr "" -#: ../../using/ios.rst:310 +#: ../../using/ios.rst:312 msgid "" "Steps 8, 9 and 10 of these instructions assume that you have a single folder " "of pure Python application code, named ``app``. If you have third-party " "binary modules in your app, some additional steps will be required:" msgstr "" -#: ../../using/ios.rst:314 +#: ../../using/ios.rst:316 msgid "" "You need to ensure that any folders containing third-party binaries are " "either associated with the app target, or copied in as part of step 8. Step " @@ -534,24 +540,90 @@ msgid "" "building an app targeting the simulator)." msgstr "" -#: ../../using/ios.rst:320 +#: ../../using/ios.rst:322 msgid "" "Any folders that contain third-party binaries must be processed into " "framework form by step 9. The invocation of ``install_dylib`` that processes " "the ``lib-dynload`` folder can be copied and adapted for this purpose." msgstr "" -#: ../../using/ios.rst:324 +#: ../../using/ios.rst:326 msgid "" "If you're using a separate folder for third-party packages, ensure that " "folder is included as part of the ``PYTHONPATH`` configuration in step 10." msgstr "" -#: ../../using/ios.rst:328 +#: ../../using/ios.rst:330 +msgid "Testing a Python package" +msgstr "" + +#: ../../using/ios.rst:332 +msgid "" +"The CPython source tree contains :source:`a testbed project <iOS/testbed>` " +"that is used to run the CPython test suite on the iOS simulator. This " +"testbed can also be used as a testbed project for running your Python " +"library's test suite on iOS." +msgstr "" + +#: ../../using/ios.rst:336 +msgid "" +"After building or obtaining an iOS XCFramework (See :source:`iOS/README.rst` " +"for details), create a clone of the Python iOS testbed project by running:" +msgstr "" + +#: ../../using/ios.rst:339 +msgid "" +"$ python iOS/testbed clone --framework <path/to/Python.xcframework> --app " +"<path/to/module1> --app <path/to/module2> app-testbed" +msgstr "" + +#: ../../using/ios.rst:343 +msgid "" +"You will need to modify the ``iOS/testbed`` reference to point to that " +"directory in the CPython source tree; any folders specified with the ``--" +"app`` flag will be copied into the cloned testbed project. The resulting " +"testbed will be created in the ``app-testbed`` folder. In this example, the " +"``module1`` and ``module2`` would be importable modules at runtime. If your " +"project has additional dependencies, they can be installed into the ``app-" +"testbed/iOSTestbed/app_packages`` folder (using ``pip install --target app-" +"testbed/iOSTestbed/app_packages`` or similar)." +msgstr "" + +#: ../../using/ios.rst:352 +msgid "" +"You can then use the ``app-testbed`` folder to run the test suite for your " +"app, For example, if ``module1.tests`` was the entry point to your test " +"suite, you could run:" +msgstr "" + +#: ../../using/ios.rst:356 +msgid "$ python app-testbed run -- module1.tests" +msgstr "" + +#: ../../using/ios.rst:360 +msgid "" +"This is the equivalent of running ``python -m module1.tests`` on a desktop " +"Python build. Any arguments after the ``--`` will be passed to the testbed " +"as if they were arguments to ``python -m`` on a desktop machine." +msgstr "" + +#: ../../using/ios.rst:364 +msgid "You can also open the testbed project in Xcode by running:" +msgstr "" + +#: ../../using/ios.rst:366 +msgid "$ open app-testbed/iOSTestbed.xcodeproj" +msgstr "" + +#: ../../using/ios.rst:370 +msgid "This will allow you to use the full Xcode suite of tools for debugging." +msgstr "" + +#: ../../using/ios.rst:373 msgid "App Store Compliance" msgstr "" -#: ../../using/ios.rst:330 +#: ../../using/ios.rst:375 msgid "" "The only mechanism for distributing apps to third-party iOS devices is to " "submit the app to the iOS App Store; apps submitted for distribution must " @@ -560,7 +632,7 @@ msgid "" "problematic code." msgstr "" -#: ../../using/ios.rst:335 +#: ../../using/ios.rst:380 msgid "" "The Python standard library contains some code that is known to violate " "these automated rules. While these violations appear to be false positives, " @@ -568,7 +640,7 @@ msgid "" "Python standard library for an app to pass App Store review." msgstr "" -#: ../../using/ios.rst:340 +#: ../../using/ios.rst:385 msgid "" "The Python source tree contains :source:`a patch file <Mac/Resources/app-" "store-compliance.patch>` that will remove all code that is known to cause " diff --git a/whatsnew/2.6.po b/whatsnew/2.6.po index c5606c2af5..a7e0c2a770 100644 --- a/whatsnew/2.6.po +++ b/whatsnew/2.6.po @@ -34,6 +34,8 @@ msgid "" "This article explains the new features in Python 2.6, released on October 1, " "2008. The release schedule is described in :pep:`361`." msgstr "" +"本文介紹了已於 2008 年 10 月 1 日發布的 Python 2.6 有哪些新功能。發布時間表請" +"見 :pep:`361`。" #: ../../whatsnew/2.6.rst:53 msgid "" @@ -199,7 +201,7 @@ msgstr "https://bugs.python.org/" #: ../../whatsnew/2.6.rst:183 msgid "The Python bug tracker." -msgstr "" +msgstr "Python 問題追蹤系統。" #: ../../whatsnew/2.6.rst:185 msgid "https://bugs.jython.org/" @@ -207,7 +209,7 @@ msgstr "https://bugs.jython.org/" #: ../../whatsnew/2.6.rst:186 msgid "The Jython bug tracker." -msgstr "" +msgstr "Jython 問題追蹤系統。" #: ../../whatsnew/2.6.rst:188 msgid "https://roundup.sourceforge.io/" @@ -223,11 +225,11 @@ msgstr "https://svn.python.org/view/tracker/importer/" #: ../../whatsnew/2.6.rst:192 msgid "Martin von Löwis's conversion scripts." -msgstr "" +msgstr "Martin von Löwis 的轉換腳本。" #: ../../whatsnew/2.6.rst:195 msgid "New Documentation Format: reStructuredText Using Sphinx" -msgstr "" +msgstr "新文件格式:使用 Sphinx 的 reStructuredText" #: ../../whatsnew/2.6.rst:197 msgid "" @@ -276,31 +278,31 @@ msgstr "" #: ../../whatsnew/2.6.rst:233 msgid "`Documenting Python <https://devguide.python.org/documenting/>`__" -msgstr "" +msgstr "`Python 文件撰寫 <https://devguide.python.org/documenting/>`__" #: ../../whatsnew/2.6.rst:234 msgid "Describes how to write for Python's documentation." -msgstr "" +msgstr "說明如何為 Python 撰寫文件。" #: ../../whatsnew/2.6.rst:236 msgid "`Sphinx <https://www.sphinx-doc.org/>`__" -msgstr "" +msgstr "`Sphinx <https://www.sphinx-doc.org/>`__" #: ../../whatsnew/2.6.rst:237 msgid "Documentation and code for the Sphinx toolchain." -msgstr "" +msgstr "Sphinx 工具鏈的文件和程式碼。" #: ../../whatsnew/2.6.rst:239 msgid "`Docutils <https://docutils.sourceforge.io>`__" -msgstr "" +msgstr "`Docutils <https://docutils.sourceforge.io>`__" #: ../../whatsnew/2.6.rst:240 msgid "The underlying reStructuredText parser and toolset." -msgstr "" +msgstr "底層 reStructuredText 剖析器和工具集。" #: ../../whatsnew/2.6.rst:246 msgid "PEP 343: The 'with' statement" -msgstr "" +msgstr "PEP 343:'with' 陳述式" #: ../../whatsnew/2.6.rst:248 msgid "" @@ -333,6 +335,8 @@ msgid "" "with expression [as variable]:\n" " with-block" msgstr "" +"with expression [as variable]:\n" +" with-block" #: ../../whatsnew/2.6.rst:269 msgid "" @@ -370,6 +374,10 @@ msgid "" " print line\n" " ... more processing code ..." msgstr "" +"with open('/etc/passwd', 'r') as f:\n" +" for line in f:\n" +" print line\n" +" ... 更多處理程式碼 ..." #: ../../whatsnew/2.6.rst:290 msgid "" @@ -458,7 +466,7 @@ msgstr "" #: ../../whatsnew/2.6.rst:347 msgid "The code in *BLOCK* is executed." -msgstr "" +msgstr "*BLOCK* 中的程式碼會被執行。" #: ../../whatsnew/2.6.rst:349 msgid "" @@ -508,6 +516,11 @@ msgid "" " cursor.execute('delete from ...')\n" " # ... more operations ..." msgstr "" +"db_connection = DatabaseConnection()\n" +"with db_connection as cursor:\n" +" cursor.execute('insert into ...')\n" +" cursor.execute('delete from ...')\n" +" # ... 更多操作 ..." #: ../../whatsnew/2.6.rst:379 msgid "" @@ -625,6 +638,22 @@ msgid "" "with db_transaction(db) as cursor:\n" " ..." msgstr "" +"from contextlib import contextmanager\n" +"\n" +"@contextmanager\n" +"def db_transaction(connection):\n" +" cursor = connection.cursor()\n" +" try:\n" +" yield cursor\n" +" except:\n" +" connection.rollback()\n" +" raise\n" +" else:\n" +" connection.commit()\n" +"\n" +"db = DatabaseConnection()\n" +"with db_transaction(db) as cursor:\n" +" ..." #: ../../whatsnew/2.6.rst:463 msgid "" @@ -641,6 +670,9 @@ msgid "" "with nested (db_transaction(db), lock) as (cursor, locked):\n" " ..." msgstr "" +"lock = threading.Lock()\n" +"with nested (db_transaction(db), lock) as (cursor, locked):\n" +" ..." #: ../../whatsnew/2.6.rst:472 msgid "" @@ -658,10 +690,16 @@ msgid "" " for line in f:\n" " sys.stdout.write(line)" msgstr "" +"import urllib, sys\n" +"from contextlib import closing\n" +"\n" +"with closing(urllib.urlopen('http://www.yahoo.com/')) as f:\n" +" for line in f:\n" +" sys.stdout.write(line)" #: ../../whatsnew/2.6.rst:486 msgid ":pep:`343` - The \"with\" statement" -msgstr "" +msgstr ":pep:`343` - \"with\" 陳述式" #: ../../whatsnew/2.6.rst:487 msgid "" @@ -721,11 +759,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:530 msgid "Unix and Mac OS X: :file:`~/.local/`" -msgstr "" +msgstr "Unix 和 Mac OS X::file:`~/.local/`" #: ../../whatsnew/2.6.rst:531 msgid "Windows: :file:`%APPDATA%/Python`" -msgstr "" +msgstr "Windows::file:`%APPDATA%/Python`" #: ../../whatsnew/2.6.rst:533 msgid "" @@ -822,6 +860,35 @@ msgid "" " result = queue.get()\n" " print 'Factorial', N, '=', result" msgstr "" +"import time\n" +"from multiprocessing import Process, Queue\n" +"\n" +"\n" +"def factorial(queue, N):\n" +" \"計算階乘。\"\n" +" # 如果 N 是 4 的倍數,則此函式將花費更多時間。\n" +" if (N % 4) == 0:\n" +" time.sleep(.05 * N/4)\n" +"\n" +" # 計算結果\n" +" fact = 1L\n" +" for i in range(1, N+1):\n" +" fact = fact * i\n" +"\n" +" # 將結果放進佇列裡\n" +" queue.put(fact)\n" +"\n" +"if __name__ == '__main__':\n" +" queue = Queue()\n" +"\n" +" N = 5\n" +"\n" +" p = Process(target=factorial, args=(queue, N))\n" +" p.start()\n" +" p.join()\n" +"\n" +" result = queue.get()\n" +" print 'Factorial', N, '=', result" #: ../../whatsnew/2.6.rst:614 msgid "" @@ -856,6 +923,15 @@ msgid "" "for v in result:\n" " print v" msgstr "" +"from multiprocessing import Pool\n" +"\n" +"def factorial(N, dictionary):\n" +" \"計算階乘。\"\n" +" ...\n" +"p = Pool(5)\n" +"result = p.map(factorial, range(1, 1000, 10))\n" +"for v in result:\n" +" print v" #: ../../whatsnew/2.6.rst:640 msgid "This produces the following output::" @@ -870,6 +946,12 @@ msgid "" "33452526613163807108170062053440751665152000000000\n" "..." msgstr "" +"1\n" +"39916800\n" +"51090942171709440000\n" +"8222838654177922817725562880000000\n" +"33452526613163807108170062053440751665152000000000\n" +"..." #: ../../whatsnew/2.6.rst:649 msgid "" @@ -1014,6 +1096,16 @@ msgid "" ">>> 'Content-type: {0[.mp4]}'.format(mimetypes.types_map)\n" "'Content-type: video/mp4'" msgstr "" +">>> import sys\n" +">>> print 'Platform: {0.platform}\\nPython version: {0.version}'." +"format(sys)\n" +"Platform: darwin\n" +"Python version: 2.6a1+ (trunk:61261M, Mar 5 2008, 20:29:41)\n" +"[GCC 4.0.1 (Apple Computer, Inc. build 5367)]'\n" +"\n" +">>> import mimetypes\n" +">>> 'Content-type: {0[.mp4]}'.format(mimetypes.types_map)\n" +"'Content-type: video/mp4'" #: ../../whatsnew/2.6.rst:754 msgid "" @@ -1065,11 +1157,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:787 msgid "Character" -msgstr "" +msgstr "字元" #: ../../whatsnew/2.6.rst:787 msgid "Effect" -msgstr "" +msgstr "效果" #: ../../whatsnew/2.6.rst:789 msgid "< (default)" @@ -1117,6 +1209,10 @@ msgid "" ">>> '{0:e}'.format(3.75)\n" "'3.750000e+00'" msgstr "" +">>> '{0:g}'.format(3.75)\n" +"'3.75'\n" +">>> '{0:e}'.format(3.75)\n" +"'3.750000e+00'" #: ../../whatsnew/2.6.rst:804 msgid "" @@ -1223,6 +1319,11 @@ msgid "" " else:\n" " return str(self)" msgstr "" +"def __format__(self, format_spec):\n" +" if isinstance(format_spec, unicode):\n" +" return unicode(str(self))\n" +" else:\n" +" return str(self)" #: ../../whatsnew/2.6.rst:836 msgid "" @@ -1235,6 +1336,8 @@ msgid "" ">>> format(75.6564, '.2f')\n" "'75.66'" msgstr "" +">>> format(75.6564, '.2f')\n" +"'75.66'" #: ../../whatsnew/2.6.rst:846 msgid ":ref:`formatstrings`" @@ -1274,6 +1377,8 @@ msgid "" ">>> from __future__ import print_function\n" ">>> print('# of entries', len(dictionary), file=sys.stderr)" msgstr "" +">>> from __future__ import print_function\n" +">>> print('# of entries', len(dictionary), file=sys.stderr)" #: ../../whatsnew/2.6.rst:869 msgid "The signature of the new function is::" @@ -1281,7 +1386,7 @@ msgstr "" #: ../../whatsnew/2.6.rst:871 msgid "def print(*args, sep=' ', end='\\n', file=None)" -msgstr "" +msgstr "def print(*args, sep=' ', end='\\n', file=None)" #: ../../whatsnew/2.6.rst:874 msgid "The parameters are:" @@ -1307,7 +1412,7 @@ msgstr "" #: ../../whatsnew/2.6.rst:884 msgid ":pep:`3105` - Make print a function" -msgstr "" +msgstr ":pep:`3105` - 將 print 變成函式" #: ../../whatsnew/2.6.rst:885 msgid "PEP written by Georg Brandl." @@ -1330,6 +1435,10 @@ msgid "" "except TypeError, ValueError: # Wrong!\n" " ..." msgstr "" +"try:\n" +" ...\n" +"except TypeError, ValueError: # 錯誤!\n" +" ..." #: ../../whatsnew/2.6.rst:902 msgid "" @@ -1347,6 +1456,10 @@ msgid "" "except (TypeError, ValueError):\n" " ..." msgstr "" +"try:\n" +" ...\n" +"except (TypeError, ValueError):\n" +" ..." #: ../../whatsnew/2.6.rst:914 msgid "" @@ -1369,6 +1482,10 @@ msgid "" "except TypeError as exc:\n" " ..." msgstr "" +"try:\n" +" ...\n" +"except TypeError as exc:\n" +" ..." #: ../../whatsnew/2.6.rst:927 msgid "" @@ -1435,6 +1552,12 @@ msgid "" "\n" "print len(s) # 12 Unicode characters" msgstr "" +"from __future__ import unicode_literals\n" +"\n" +"s = ('\\u751f\\u3080\\u304e\\u3000\\u751f\\u3054'\n" +" '\\u3081\\u3000\\u751f\\u305f\\u307e\\u3054')\n" +"\n" +"print len(s) # 12 個 Unicode 字元" #: ../../whatsnew/2.6.rst:977 msgid "" @@ -1465,6 +1588,16 @@ msgid "" ">>> unicode(str(b), 'utf-8')\n" "u'\\u31ef \\u3244'" msgstr "" +">>> bytearray([65, 66, 67])\n" +"bytearray(b'ABC')\n" +">>> b = bytearray(u'\\u21ef\\u3244', 'utf-8')\n" +">>> b\n" +"bytearray(b'\\xe2\\x87\\xaf\\xe3\\x89\\x84')\n" +">>> b[0] = '\\xe3'\n" +">>> b\n" +"bytearray(b'\\xe3\\x87\\xaf\\xe3\\x89\\x84')\n" +">>> unicode(str(b), 'utf-8')\n" +"u'\\u31ef \\u3244'" #: ../../whatsnew/2.6.rst:999 msgid "" @@ -1481,6 +1614,11 @@ msgid "" ">>> b\n" "bytearray(b'ABCde')" msgstr "" +">>> b = bytearray('ABC')\n" +">>> b.append('d')\n" +">>> b.append(ord('e'))\n" +">>> b\n" +"bytearray(b'ABCde')" #: ../../whatsnew/2.6.rst:1012 msgid "" @@ -1498,7 +1636,7 @@ msgstr "" #: ../../whatsnew/2.6.rst:1027 msgid "PEP 3116: New I/O Library" -msgstr "" +msgstr "PEP 3116:新 I/O 函式庫" #: ../../whatsnew/2.6.rst:1029 msgid "" @@ -1721,6 +1859,10 @@ msgid "" "class Storage(collections.MutableMapping):\n" " ..." msgstr "" +"import collections\n" +"\n" +"class Storage(collections.MutableMapping):\n" +" ..." #: ../../whatsnew/2.6.rst:1196 msgid "" @@ -1738,6 +1880,12 @@ msgid "" "\n" "collections.MutableMapping.register(Storage)" msgstr "" +"import collections\n" +"\n" +"class Storage:\n" +" ...\n" +"\n" +"collections.MutableMapping.register(Storage)" #: ../../whatsnew/2.6.rst:1207 msgid "" @@ -1755,6 +1903,10 @@ msgid "" "PrintableType.register(float)\n" "PrintableType.register(str)" msgstr "" +"# 註冊 Python 的型別\n" +"PrintableType.register(int)\n" +"PrintableType.register(float)\n" +"PrintableType.register(str)" #: ../../whatsnew/2.6.rst:1219 msgid "" @@ -1775,6 +1927,9 @@ msgid "" " if not isinstance(d, collections.MutableMapping):\n" " raise ValueError(\"Mapping object expected, not %r\" % d)" msgstr "" +"def func(d):\n" +" if not isinstance(d, collections.MutableMapping):\n" +" raise ValueError(\"Mapping object expected, not %r\" % d)" #: ../../whatsnew/2.6.rst:1230 msgid "" @@ -1811,6 +1966,22 @@ msgid "" " def draw(self, x, y, scale):\n" " ..." msgstr "" +"from abc import ABCMeta, abstractmethod\n" +"\n" +"class Drawable():\n" +" __metaclass__ = ABCMeta\n" +"\n" +" @abstractmethod\n" +" def draw(self, x, y, scale=1.0):\n" +" pass\n" +"\n" +" def draw_doubled(self, x, y):\n" +" self.draw(x, y, scale=2.0)\n" +"\n" +"\n" +"class Square(Drawable):\n" +" def draw(self, x, y, scale):\n" +" ..." #: ../../whatsnew/2.6.rst:1258 msgid "" @@ -1843,6 +2014,15 @@ msgid "" "draw\n" ">>>" msgstr "" +">>> class Circle(Drawable):\n" +"... pass\n" +"...\n" +">>> c = Circle()\n" +"Traceback (most recent call last):\n" +" File \"<stdin>\", line 1, in <module>\n" +"TypeError: Can't instantiate abstract class Circle with abstract methods " +"draw\n" +">>>" #: ../../whatsnew/2.6.rst:1281 msgid "" @@ -1859,6 +2039,12 @@ msgid "" "def readonly(self):\n" " return self._x" msgstr "" +"from abc import abstractproperty\n" +"...\n" +"\n" +"@abstractproperty\n" +"def readonly(self):\n" +" return self._x" #: ../../whatsnew/2.6.rst:1291 msgid "Subclasses must then define a :meth:`readonly` property." @@ -1898,6 +2084,10 @@ msgid "" ">>> 0b101111\n" "47" msgstr "" +">>> 0o21, 2*8 + 1\n" +"(17, 17)\n" +">>> 0b101111\n" +"47" #: ../../whatsnew/2.6.rst:1320 msgid "" @@ -1915,6 +2105,12 @@ msgid "" ">>> bin(173)\n" "'0b10101101'" msgstr "" +">>> oct(42)\n" +"'052'\n" +">>> future_builtins.oct(42)\n" +"'0o52'\n" +">>> bin(173)\n" +"'0b10101101'" #: ../../whatsnew/2.6.rst:1331 msgid "" @@ -1935,6 +2131,14 @@ msgid "" ">>> int('0b1101', 0)\n" "13" msgstr "" +">>> int ('0o52', 0)\n" +"42\n" +">>> int('1101', 2)\n" +"13\n" +">>> int('0b1101', 2)\n" +"13\n" +">>> int('0b1101', 0)\n" +"13" #: ../../whatsnew/2.6.rst:1348 msgid ":pep:`3127` - Integer Literal Support and Syntax" @@ -1961,10 +2165,14 @@ msgid "" "class A:\n" " pass" msgstr "" +"@foo\n" +"@bar\n" +"class A:\n" +" pass" #: ../../whatsnew/2.6.rst:1367 msgid "This is equivalent to::" -msgstr "" +msgstr "這等價於: ::" #: ../../whatsnew/2.6.rst:1369 msgid "" @@ -1973,6 +2181,10 @@ msgid "" "\n" "A = foo(bar(A))" msgstr "" +"class A:\n" +" pass\n" +"\n" +"A = foo(bar(A))" #: ../../whatsnew/2.6.rst:1376 msgid ":pep:`3129` - Class Decorators" @@ -2093,6 +2305,15 @@ msgid "" ">>> a/b\n" "Fraction(5, 3)" msgstr "" +">>> from fractions import Fraction\n" +">>> a = Fraction(2, 3)\n" +">>> b = Fraction(2, 5)\n" +">>> float(a), float(b)\n" +"(0.66666666666666663, 0.40000000000000002)\n" +">>> a+b\n" +"Fraction(16, 15)\n" +">>> a/b\n" +"Fraction(5, 3)" #: ../../whatsnew/2.6.rst:1455 msgid "" @@ -2110,6 +2331,12 @@ msgid "" ">>> (1./3) .as_integer_ratio()\n" "(6004799503160661L, 18014398509481984L)" msgstr "" +">>> (2.5) .as_integer_ratio()\n" +"(5, 2)\n" +">>> (3.1415) .as_integer_ratio()\n" +"(7074029114692207L, 2251799813685248L)\n" +">>> (1./3) .as_integer_ratio()\n" +"(6004799503160661L, 18014398509481984L)" #: ../../whatsnew/2.6.rst:1467 msgid "" @@ -2171,6 +2398,14 @@ msgid "" ">>> f(**ud)\n" "['a', 'b']" msgstr "" +">>> def f(**kw):\n" +"... print sorted(kw)\n" +"...\n" +">>> ud=UserDict.UserDict()\n" +">>> ud['a'] = 1\n" +">>> ud['b'] = 'string'\n" +">>> f(**ud)\n" +"['a', 'b']" #: ../../whatsnew/2.6.rst:1511 msgid "(Contributed by Alexander Belopolsky; :issue:`1686487`.)" @@ -2190,6 +2425,11 @@ msgid "" ">>> f(1,2,3, *(4,5,6), keyword=13)\n" "(1, 2, 3, 4, 5, 6) {'keyword': 13}" msgstr "" +">>> def f(*args, **kw):\n" +"... print args, kw\n" +"...\n" +">>> f(1,2,3, *(4,5,6), keyword=13)\n" +"(1, 2, 3, 4, 5, 6) {'keyword': 13}" #: ../../whatsnew/2.6.rst:1522 msgid "" @@ -2264,6 +2504,27 @@ msgid "" " def x(self, value):\n" " self._x = value / 2" msgstr "" +"class C(object):\n" +" @property\n" +" def x(self):\n" +" return self._x\n" +"\n" +" @x.setter\n" +" def x(self, value):\n" +" self._x = value\n" +"\n" +" @x.deleter\n" +" def x(self):\n" +" del self._x\n" +"\n" +"class D(C):\n" +" @C.x.getter\n" +" def x(self):\n" +" return self._x * 2\n" +"\n" +" @x.setter\n" +" def x(self, value):\n" +" self._x = value / 2" #: ../../whatsnew/2.6.rst:1576 msgid "" @@ -2323,6 +2584,14 @@ msgid "" ">>> b.hex()\n" "'0x1.5555555555555p-2'" msgstr "" +">>> a = 3.75\n" +">>> a.hex()\n" +"'0x1.e000000000000p+1'\n" +">>> float.fromhex('0x1.e000000000000p+1')\n" +"3.75\n" +">>> b=1./3\n" +">>> b.hex()\n" +"'0x1.5555555555555p-2'" #: ../../whatsnew/2.6.rst:1619 msgid "" @@ -2701,6 +2970,16 @@ msgid "" ">>> dq\n" "deque([2, 3, 4], maxlen=3)" msgstr "" +">>> from collections import deque\n" +">>> dq=deque(maxlen=3)\n" +">>> dq\n" +"deque([], maxlen=3)\n" +">>> dq.append(1); dq.append(2); dq.append(3)\n" +">>> dq\n" +"deque([1, 2, 3], maxlen=3)\n" +">>> dq.append(4)\n" +">>> dq\n" +"deque([2, 3, 4], maxlen=3)" #: ../../whatsnew/2.6.rst:1898 msgid "" @@ -2758,6 +3037,12 @@ msgid "" ">>> Decimal(1000).log10()\n" "Decimal(\"3\")" msgstr "" +">>> Decimal(1).exp()\n" +"Decimal(\"2.718281828459045235360287471\")\n" +">>> Decimal(\"2.7182818\").ln()\n" +"Decimal(\"0.9999999895305022877376682436\")\n" +">>> Decimal(1000).log10()\n" +"Decimal(\"3\")" #: ../../whatsnew/2.6.rst:1935 msgid "" @@ -2826,6 +3111,8 @@ msgid "" ">>> list(heapq.merge([1, 3, 5, 9], [2, 8, 16]))\n" "[1, 2, 3, 5, 8, 9, 16]" msgstr "" +">>> list(heapq.merge([1, 3, 5, 9], [2, 8, 16]))\n" +"[1, 2, 3, 5, 8, 9, 16]" #: ../../whatsnew/2.6.rst:1978 msgid "" @@ -2880,6 +3167,8 @@ msgid "" ">>> tuple(itertools.izip_longest([1,2,3], [1,2,3,4,5]))\n" "((1, 1), (2, 2), (3, 3), (None, 4), (None, 5))" msgstr "" +">>> tuple(itertools.izip_longest([1,2,3], [1,2,3,4,5]))\n" +"((1, 1), (2, 2), (3, 3), (None, 4), (None, 5))" #: ../../whatsnew/2.6.rst:2013 msgid "" @@ -2895,6 +3184,10 @@ msgid "" " (2, 4), (2, 5), (2, 6),\n" " (3, 4), (3, 5), (3, 6)]" msgstr "" +">>> list(itertools.product([1,2,3], [4,5,6]))\n" +"[(1, 4), (1, 5), (1, 6),\n" +" (2, 4), (2, 5), (2, 6),\n" +" (3, 4), (3, 5), (3, 6)]" #: ../../whatsnew/2.6.rst:2022 msgid "" @@ -2909,6 +3202,9 @@ msgid "" "[(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2),\n" " (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)]" msgstr "" +">>> list(itertools.product([1,2], repeat=3))\n" +"[(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2),\n" +" (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)]" #: ../../whatsnew/2.6.rst:2031 msgid "With two iterables, *2N*-tuples are returned. ::" @@ -2922,6 +3218,11 @@ msgid "" " (2, 3, 1, 3), (2, 3, 1, 4), (2, 3, 2, 3), (2, 3, 2, 4),\n" " (2, 4, 1, 3), (2, 4, 1, 4), (2, 4, 2, 3), (2, 4, 2, 4)]" msgstr "" +">>> list(itertools.product([1,2], [3,4], repeat=2))\n" +"[(1, 3, 1, 3), (1, 3, 1, 4), (1, 3, 2, 3), (1, 3, 2, 4),\n" +" (1, 4, 1, 3), (1, 4, 1, 4), (1, 4, 2, 3), (1, 4, 2, 4),\n" +" (2, 3, 1, 3), (2, 3, 1, 4), (2, 3, 2, 3), (2, 3, 2, 4),\n" +" (2, 4, 1, 3), (2, 4, 1, 4), (2, 4, 2, 3), (2, 4, 2, 4)]" #: ../../whatsnew/2.6.rst:2039 msgid "" @@ -2939,6 +3240,13 @@ msgid "" "[('1', '2', '3'), ('1', '2', '4'),\n" " ('1', '3', '4'), ('2', '3', '4')]" msgstr "" +">>> list(itertools.combinations('123', 2))\n" +"[('1', '2'), ('1', '3'), ('2', '3')]\n" +">>> list(itertools.combinations('123', 3))\n" +"[('1', '2', '3')]\n" +">>> list(itertools.combinations('1234', 3))\n" +"[('1', '2', '3'), ('1', '2', '4'),\n" +" ('1', '3', '4'), ('2', '3', '4')]" #: ../../whatsnew/2.6.rst:2050 msgid "" @@ -2955,6 +3263,11 @@ msgid "" " (3, 1), (3, 2), (3, 4),\n" " (4, 1), (4, 2), (4, 3)]" msgstr "" +">>> list(itertools.permutations([1,2,3,4], 2))\n" +"[(1, 2), (1, 3), (1, 4),\n" +" (2, 1), (2, 3), (2, 4),\n" +" (3, 1), (3, 2), (3, 4),\n" +" (4, 1), (4, 2), (4, 3)]" #: ../../whatsnew/2.6.rst:2060 msgid "" @@ -2970,6 +3283,8 @@ msgid "" ">>> list(itertools.chain.from_iterable([[1,2,3], [4,5,6]]))\n" "[1, 2, 3, 4, 5, 6]" msgstr "" +">>> list(itertools.chain.from_iterable([[1,2,3], [4,5,6]]))\n" +"[1, 2, 3, 4, 5, 6]" #: ../../whatsnew/2.6.rst:2070 msgid "(All contributed by Raymond Hettinger.)" @@ -3103,6 +3418,12 @@ msgid "" ">>> inst_name(help)\n" "'_Helper'" msgstr "" +">>> inst_name = operator.attrgetter(\n" +"... '__class__.__name__')\n" +">>> inst_name('')\n" +"'str'\n" +">>> inst_name(help)\n" +"'_Helper'" #: ../../whatsnew/2.6.rst:2157 msgid "(Contributed by Georg Brandl, after a suggestion by Barry Warsaw.)" @@ -3217,6 +3538,16 @@ msgid "" " +-- StandardError\n" " ..." msgstr "" +">>> import pkgutil\n" +">>> print pkgutil.get_data('test', 'exception_hierarchy.txt')\n" +"BaseException\n" +" +-- SystemExit\n" +" +-- KeyboardInterrupt\n" +" +-- GeneratorExit\n" +" +-- Exception\n" +" +-- StopIteration\n" +" +-- StandardError\n" +" ..." #: ../../whatsnew/2.6.rst:2236 msgid "(Contributed by Paul Moore; :issue:`2439`.)" @@ -3320,6 +3651,8 @@ msgid "" "shutil.copytree('Doc/library', '/tmp/library',\n" " ignore=shutil.ignore_patterns('*~', '.svn'))" msgstr "" +"shutil.copytree('Doc/library', '/tmp/library',\n" +" ignore=shutil.ignore_patterns('*~', '.svn'))" #: ../../whatsnew/2.6.rst:2310 msgid "(Contributed by Tarek Ziadé; :issue:`2663`.)" @@ -3504,6 +3837,8 @@ msgid "" "tar = tarfile.open(\"output.tar\", \"w\",\n" " format=tarfile.PAX_FORMAT)" msgstr "" +"tar = tarfile.open(\"output.tar\", \"w\",\n" +" format=tarfile.PAX_FORMAT)" #: ../../whatsnew/2.6.rst:2444 msgid "" @@ -3583,6 +3918,10 @@ msgid "" " f = urllib.urlopen('https://sf.net/')\n" " ..." msgstr "" +"with test_support.TransientResource(IOError,\n" +" errno=errno.ETIMEDOUT):\n" +" f = urllib.urlopen('https://sf.net/')\n" +" ..." #: ../../whatsnew/2.6.rst:2498 msgid "" @@ -3735,6 +4074,12 @@ msgid "" "urllib2.URLError: <urlopen error timed out>\n" ">>>" msgstr "" +">>> u = urllib2.urlopen(\"http://slow.example.com/",\n" +" timeout=3)\n" +"Traceback (most recent call last):\n" +" ...\n" +"urllib2.URLError: <urlopen error timed out>\n" +">>>" #: ../../whatsnew/2.6.rst:2592 msgid "(Added by Facundo Batista.)" @@ -3864,6 +4209,15 @@ msgid "" "\"\"\")\n" "print ast.dump(t)" msgstr "" +"import ast\n" +"\n" +"t = ast.parse(\"\"\"\n" +"d = {}\n" +"for i in 'abcdefghijklm':\n" +" d[i + i] = ord(i) - ord('a') + 1\n" +"print d\n" +"\"\"\")\n" +"print ast.dump(t)" #: ../../whatsnew/2.6.rst:2685 msgid "This outputs a deeply nested tree::" @@ -3902,6 +4256,36 @@ msgid "" " ], nl=True)\n" " ])" msgstr "" +"Module(body=[\n" +" Assign(targets=[\n" +" Name(id='d', ctx=Store())\n" +" ], value=Dict(keys=[], values=[]))\n" +" For(target=Name(id='i', ctx=Store()),\n" +" iter=Str(s='abcdefghijklm'), body=[\n" +" Assign(targets=[\n" +" Subscript(value=\n" +" Name(id='d', ctx=Load()),\n" +" slice=\n" +" Index(value=\n" +" BinOp(left=Name(id='i', ctx=Load()), op=Add(),\n" +" right=Name(id='i', ctx=Load()))), ctx=Store())\n" +" ], value=\n" +" BinOp(left=\n" +" BinOp(left=\n" +" Call(func=\n" +" Name(id='ord', ctx=Load()), args=[\n" +" Name(id='i', ctx=Load())\n" +" ], keywords=[], starargs=None, kwargs=None),\n" +" op=Sub(), right=Call(func=\n" +" Name(id='ord', ctx=Load()), args=[\n" +" Str(s='a')\n" +" ], keywords=[], starargs=None, kwargs=None)),\n" +" op=Add(), right=Num(n=1)))\n" +" ], orelse=[])\n" +" Print(dest=None, values=[\n" +" Name(id='d', ctx=Load())\n" +" ], nl=True)\n" +" ])" #: ../../whatsnew/2.6.rst:2718 msgid "" @@ -3923,6 +4307,13 @@ msgid "" " ...\n" "ValueError: malformed string" msgstr "" +">>> literal = '(\"a\", \"b\", {2:4, 3:8, 1:2})'\n" +">>> print ast.literal_eval(literal)\n" +"('a', 'b', {1: 2, 2: 4, 3: 8})\n" +">>> print ast.literal_eval('\"a\" + \"b\"')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: malformed string" #: ../../whatsnew/2.6.rst:2734 msgid "" diff --git a/whatsnew/2.7.po b/whatsnew/2.7.po index 8eaa5f46cd..969d821d8b 100644 --- a/whatsnew/2.7.po +++ b/whatsnew/2.7.po @@ -307,6 +307,12 @@ msgid "" ">>> d.items()\n" "[('first', 1), ('second', 2), ('third', 3)]" msgstr "" +">>> from collections import OrderedDict\n" +">>> d = OrderedDict([('first', 1),\n" +"... ('second', 2),\n" +"... ('third', 3)])\n" +">>> d.items()\n" +"[('first', 1), ('second', 2), ('third', 3)]" #: ../../whatsnew/2.7.rst:233 msgid "" @@ -320,6 +326,9 @@ msgid "" ">>> d.items()\n" "[('first', 1), ('second', 4), ('third', 3)]" msgstr "" +">>> d['second'] = 4\n" +">>> d.items()\n" +"[('first', 1), ('second', 4), ('third', 3)]" #: ../../whatsnew/2.7.rst:240 msgid "Deleting an entry and reinserting it will move it to the end::" @@ -332,6 +341,10 @@ msgid "" ">>> d.items()\n" "[('first', 1), ('third', 3), ('second', 5)]" msgstr "" +">>> del d['second']\n" +">>> d['second'] = 5\n" +">>> d.items()\n" +"[('first', 1), ('third', 3), ('second', 5)]" #: ../../whatsnew/2.7.rst:247 msgid "" @@ -353,6 +366,15 @@ msgid "" ">>> od.popitem(last=False)\n" "(1, 0)" msgstr "" +">>> od = OrderedDict([(x,0) for x in range(20)])\n" +">>> od.popitem()\n" +"(19, 0)\n" +">>> od.popitem()\n" +"(18, 0)\n" +">>> od.popitem(last=False)\n" +"(0, 0)\n" +">>> od.popitem(last=False)\n" +"(1, 0)" #: ../../whatsnew/2.7.rst:262 msgid "" @@ -375,6 +397,18 @@ msgid "" ">>> od1 == od2\n" "True" msgstr "" +">>> od1 = OrderedDict([('first', 1),\n" +"... ('second', 2),\n" +"... ('third', 3)])\n" +">>> od2 = OrderedDict([('third', 3),\n" +"... ('first', 1),\n" +"... ('second', 2)])\n" +">>> od1 == od2\n" +"False\n" +">>> # Move 'third' key to the end\n" +">>> del od2['third']; od2['third'] = 3\n" +">>> od1 == od2\n" +"True" #: ../../whatsnew/2.7.rst:278 msgid "" @@ -461,6 +495,8 @@ msgid "" ">>> '{:20,.2f}'.format(18446744073709551616.0)\n" "'18,446,744,073,709,551,616.00'" msgstr "" +">>> '{:20,.2f}'.format(18446744073709551616.0)\n" +"'18,446,744,073,709,551,616.00'" #: ../../whatsnew/2.7.rst:333 msgid "When formatting an integer, include the comma after the width:" @@ -563,6 +599,20 @@ msgid "" " -o FILE direct output to FILE instead of stdout\n" " -C NUM display NUM lines of added context" msgstr "" +"-> ./python.exe argparse-example.py --help\n" +"usage: argparse-example.py [-h] [-v] [-o FILE] [-C NUM] [inputs " +"[inputs ...]]\n" +"\n" +"Command-line example.\n" +"\n" +"positional arguments:\n" +" inputs input filenames (default is stdin)\n" +"\n" +"optional arguments:\n" +" -h, --help show this help message and exit\n" +" -v produce verbose output\n" +" -o FILE direct output to FILE instead of stdout\n" +" -C NUM display NUM lines of added context" #: ../../whatsnew/2.7.rst:410 msgid "" @@ -584,6 +634,17 @@ msgid "" " 'context': 4,\n" " 'inputs': ['file1', 'file2']}" msgstr "" +"-> ./python.exe argparse-example.py -v\n" +"{'output': None,\n" +" 'is_verbose': True,\n" +" 'context': 0,\n" +" 'inputs': []}\n" +"\n" +"-> ./python.exe argparse-example.py -v -o /tmp/output -C 4 file1 file2\n" +"{'output': '/tmp/output',\n" +" 'is_verbose': True,\n" +" 'context': 4,\n" +" 'inputs': ['file1', 'file2']}" #: ../../whatsnew/2.7.rst:425 msgid "" @@ -773,6 +834,11 @@ msgid "" ">>> d.viewkeys()\n" "dict_keys([0, 130, 10, 140, 20, 150, 30, ..., 250])" msgstr "" +">>> d = dict((i*10, chr(65+i)) for i in range(26))\n" +">>> d\n" +"{0: 'A', 130: 'N', 10: 'B', 140: 'O', 20: ..., 250: 'Z'}\n" +">>> d.viewkeys()\n" +"dict_keys([0, 130, 10, 140, 20, 150, 30, ..., 250])" #: ../../whatsnew/2.7.rst:568 msgid "" @@ -789,6 +855,12 @@ msgid "" ">>> d1.viewkeys() | range(0, 30)\n" "set([0, 1, 130, 3, 4, 5, 6, ..., 120, 250])" msgstr "" +">>> d1 = dict((i*10, chr(65+i)) for i in range(26))\n" +">>> d2 = dict((i**.5, i) for i in range(1000))\n" +">>> d1.viewkeys() & d2.viewkeys()\n" +"set([0.0, 10.0, 20.0, 30.0])\n" +">>> d1.viewkeys() | range(0, 30)\n" +"set([0, 1, 130, 3, 4, 5, 6, ..., 120, 250])" #: ../../whatsnew/2.7.rst:579 msgid "" @@ -805,6 +877,12 @@ msgid "" ">>> vk\n" "dict_keys([0, 130, 260, 10, ..., 250])" msgstr "" +">>> vk = d.viewkeys()\n" +">>> vk\n" +"dict_keys([0, 130, 10, ..., 250])\n" +">>> d[260] = '&'\n" +">>> vk\n" +"dict_keys([0, 130, 260, 10, ..., 250])" #: ../../whatsnew/2.7.rst:589 msgid "" @@ -821,6 +899,12 @@ msgid "" " File \"<stdin>\", line 1, in <module>\n" "RuntimeError: dictionary changed size during iteration" msgstr "" +">>> for k in vk:\n" +"... d[k*2] = k\n" +"...\n" +"Traceback (most recent call last):\n" +" File \"<stdin>\", line 1, in <module>\n" +"RuntimeError: dictionary changed size during iteration" #: ../../whatsnew/2.7.rst:599 msgid "" @@ -878,6 +962,11 @@ msgid "" "[97, 98, 99, 100, 101, 102, 103, ... 121, 122]\n" ">>>" msgstr "" +">>> m2.tobytes()\n" +"'abcdefghijklmnopqrstuvwxyz'\n" +">>> m2.tolist()\n" +"[97, 98, 99, 100, 101, 102, 103, ... 121, 122]\n" +">>>" #: ../../whatsnew/2.7.rst:643 msgid "" @@ -956,6 +1045,10 @@ msgid "" ">>> {('a'*x) for x in range(6)}\n" "set(['', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa'])" msgstr "" +">>> {x: x*x for x in range(6)}\n" +"{0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25}\n" +">>> {('a'*x) for x in range(6)}\n" +"set(['', 'a', 'aa', 'aaa', 'aaaa', 'aaaaa'])" #: ../../whatsnew/2.7.rst:707 msgid "Backported by Alexandre Vassalotti; :issue:`2333`." @@ -976,7 +1069,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:717 msgid "is equivalent to::" -msgstr "" +msgstr "等價於: ::" #: ../../whatsnew/2.7.rst:719 msgid "" @@ -996,6 +1089,7 @@ msgid "" "(Proposed in https://codereview.appspot.com/53094; implemented by Georg " "Brandl.)" msgstr "" +"(於 https://codereview.appspot.com/53094 提出;由 Georg Brandl 實作。)" #: ../../whatsnew/2.7.rst:729 msgid "" @@ -1050,6 +1144,11 @@ msgid "" ">>> n - long(float(n))\n" "65535L" msgstr "" +">>> n = 295147905179352891391\n" +">>> float(n)\n" +"2.9514790517935283e+20\n" +">>> n - long(float(n))\n" +"65535L" #: ../../whatsnew/2.7.rst:773 msgid "" @@ -1065,6 +1164,11 @@ msgid "" ">>> n - long(float(n))\n" "-1L" msgstr "" +">>> n = 295147905179352891391\n" +">>> float(n)\n" +"2.9514790517935289e+20\n" +">>> n - long(float(n))\n" +"-1L" #: ../../whatsnew/2.7.rst:782 msgid "(Implemented by Mark Dickinson; :issue:`3166`.)" @@ -1097,6 +1201,10 @@ msgid "" ">>> '{}:{}:{day}'.format(2009, 4, day='Sunday')\n" "'2009:4:Sunday'" msgstr "" +">>> '{}:{}:{}'.format(2009, 04, 'Sunday')\n" +"'2009:4:Sunday'\n" +">>> '{}:{}:{day}'.format(2009, 4, day='Sunday')\n" +"'2009:4:Sunday'" #: ../../whatsnew/2.7.rst:800 msgid "" @@ -1155,6 +1263,16 @@ msgid "" ">>> (n+1).bit_length()\n" "124" msgstr "" +">>> n = 37\n" +">>> bin(n)\n" +"'0b100101'\n" +">>> n.bit_length()\n" +"6\n" +">>> n = 2**123-1\n" +">>> n.bit_length()\n" +"123\n" +">>> (n+1).bit_length()\n" +"124" #: ../../whatsnew/2.7.rst:843 msgid "(Contributed by Fredrik Johansson and Victor Stinner; :issue:`3439`.)" @@ -1268,7 +1386,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:924 msgid "export PYTHONWARNINGS=all,error:::Cookie:0" -msgstr "" +msgstr "export PYTHONWARNINGS=all,error:::Cookie:0" #: ../../whatsnew/2.7.rst:930 msgid "Optimizations" @@ -1336,6 +1454,9 @@ msgid "" ">>> sys.long_info\n" "sys.long_info(bits_per_digit=30, sizeof_digit=4)" msgstr "" +">>> import sys\n" +">>> sys.long_info\n" +"sys.long_info(bits_per_digit=30, sizeof_digit=4)" #: ../../whatsnew/2.7.rst:978 msgid "(Contributed by Mark Dickinson; :issue:`4258`.)" @@ -1474,6 +1595,19 @@ msgid "" ">>> c['z']\n" "0" msgstr "" +">>> from collections import Counter\n" +">>> c = Counter()\n" +">>> for letter in 'here is a sample of english text':\n" +"... c[letter] += 1\n" +"...\n" +">>> c \n" +"Counter({' ': 6, 'e': 5, 's': 3, 'a': 2, 'i': 2, 'h': 2,\n" +"'l': 2, 't': 2, 'g': 1, 'f': 1, 'm': 1, 'o': 1, 'n': 1,\n" +"'p': 1, 'r': 1, 'x': 1})\n" +">>> c['e']\n" +"5\n" +">>> c['z']\n" +"0" #: ../../whatsnew/2.7.rst:1081 msgid "" @@ -1504,7 +1638,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:1104 msgid "Contributed by Raymond Hettinger; :issue:`1696199`." -msgstr "" +msgstr "由 Raymond Hettinger 貢獻;:issue:`1696199`。" #: ../../whatsnew/2.7.rst:1108 msgid "" @@ -1840,7 +1974,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:1346 msgid "Contributed by George Sakkis; :issue:`3135`." -msgstr "" +msgstr "由 George Sakkis 貢獻;:issue:`3135`。" #: ../../whatsnew/2.7.rst:1348 msgid "" @@ -2846,14 +2980,14 @@ msgid "" "ElementTree's code for converting trees to a string has been significantly " "reworked, making it roughly twice as fast in many cases. The :meth:" "`ElementTree.write() <xml.etree.ElementTree.ElementTree.write>` and :meth:" -"`Element.write` methods now have a *method* parameter that can be " -"\"xml\" (the default), \"html\", or \"text\". HTML mode will output empty " -"elements as ``<empty></empty>`` instead of ``<empty/>``, and text mode will " -"skip over elements and only output the text chunks. If you set the :attr:" -"`~xml.etree.ElementTree.Element.tag` attribute of an element to ``None`` but " -"leave its children in place, the element will be omitted when the tree is " -"written out, so you don't need to do more extensive rearrangement to remove " -"a single element." +"`Element.write` methods now have a *method* parameter that can be \"xml\" " +"(the default), \"html\", or \"text\". HTML mode will output empty elements " +"as ``<empty></empty>`` instead of ``<empty/>``, and text mode will skip over " +"elements and only output the text chunks. If you set the :attr:`~xml.etree." +"ElementTree.Element.tag` attribute of an element to ``None`` but leave its " +"children in place, the element will be omitted when the tree is written out, " +"so you don't need to do more extensive rearrangement to remove a single " +"element." msgstr "" #: ../../whatsnew/2.7.rst:2044 @@ -3379,7 +3513,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:2439 msgid "Porting to Python 2.7" -msgstr "" +msgstr "移植至 Python 2.7" #: ../../whatsnew/2.7.rst:2441 msgid "" diff --git a/whatsnew/3.0.po b/whatsnew/3.0.po index 029b569e43..77d4d2f766 100644 --- a/whatsnew/3.0.po +++ b/whatsnew/3.0.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2024-12-11 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -72,7 +72,7 @@ msgstr "" #: ../../whatsnew/3.0.rst:95 msgid "Print Is A Function" -msgstr "" +msgstr "Print 是一個函式" #: ../../whatsnew/3.0.rst:97 msgid "" @@ -80,6 +80,8 @@ msgid "" "with keyword arguments to replace most of the special syntax of the old " "``print`` statement (:pep:`3105`). Examples::" msgstr "" +"``print`` 陳述式已經被 :func:`print` 函式所取代,且舊 ``print`` 陳述式的大部" +"分特殊語法也被關鍵字引數所取代 (:pep:`3105`)。範例如下: ::" #: ../../whatsnew/3.0.rst:101 msgid "" @@ -146,7 +148,7 @@ msgstr "" #: ../../whatsnew/3.0.rst:145 msgid "Some well-known APIs no longer return lists:" -msgstr "" +msgstr "一些眾所周知的 API 不再回傳串列:" #: ../../whatsnew/3.0.rst:147 msgid "" @@ -158,7 +160,7 @@ msgstr "" #: ../../whatsnew/3.0.rst:153 msgid "" -"Also, the :meth:`dict.iterkeys`, :meth:`dict.iteritems` and :meth:`dict." +"Also, the :meth:`!dict.iterkeys`, :meth:`!dict.iteritems` and :meth:`!dict." "itervalues` methods are no longer supported." msgstr "" @@ -185,13 +187,13 @@ msgstr "" #: ../../whatsnew/3.0.rst:173 msgid "" -":func:`range` now behaves like :func:`xrange` used to behave, except it " +":func:`range` now behaves like :func:`!xrange` used to behave, except it " "works with values of arbitrary size. The latter no longer exists." msgstr "" #: ../../whatsnew/3.0.rst:177 msgid ":func:`zip` now returns an iterator." -msgstr "" +msgstr ":func:`zip` 現在會回傳一個疊代器。" #: ../../whatsnew/3.0.rst:180 msgid "Ordering Comparisons" @@ -215,18 +217,19 @@ msgstr "" #: ../../whatsnew/3.0.rst:195 msgid "" -":meth:`builtin.sorted` and :meth:`list.sort` no longer accept the *cmp* " -"argument providing a comparison function. Use the *key* argument instead. N." -"B. the *key* and *reverse* arguments are now \"keyword-only\"." +":meth:`sorted` and :meth:`list.sort` no longer accept the *cmp* argument " +"providing a comparison function. Use the *key* argument instead. N.B. the " +"*key* and *reverse* arguments are now \"keyword-only\"." msgstr "" #: ../../whatsnew/3.0.rst:200 msgid "" -"The :func:`cmp` function should be treated as gone, and the :meth:`__cmp__` " -"special method is no longer supported. Use :meth:`__lt__` for sorting, :" -"meth:`__eq__` with :meth:`__hash__`, and other rich comparisons as needed. " -"(If you really need the :func:`cmp` functionality, you could use the " -"expression ``(a > b) - (a < b)`` as the equivalent for ``cmp(a, b)``.)" +"The :func:`!cmp` function should be treated as gone, and the :meth:`!" +"__cmp__` special method is no longer supported. Use :meth:`~object.__lt__` " +"for sorting, :meth:`~object.__eq__` with :meth:`~object.__hash__`, and other " +"rich comparisons as needed. (If you really need the :func:`!cmp` " +"functionality, you could use the expression ``(a > b) - (a < b)`` as the " +"equivalent for ``cmp(a, b)``.)" msgstr "" #: ../../whatsnew/3.0.rst:207 @@ -235,9 +238,9 @@ msgstr "整數" #: ../../whatsnew/3.0.rst:209 msgid "" -":pep:`237`: Essentially, :class:`long` renamed to :class:`int`. That is, " +":pep:`237`: Essentially, :class:`!long` renamed to :class:`int`. That is, " "there is only one built-in integral type, named :class:`int`; but it behaves " -"mostly like the old :class:`long` type." +"mostly like the old :class:`!long` type." msgstr "" #: ../../whatsnew/3.0.rst:213 @@ -249,11 +252,11 @@ msgstr "" #: ../../whatsnew/3.0.rst:217 msgid "" -"The :data:`sys.maxint` constant was removed, since there is no longer a " +"The :data:`!sys.maxint` constant was removed, since there is no longer a " "limit to the value of integers. However, :data:`sys.maxsize` can be used as " "an integer larger than any practical list or string index. It conforms to " "the implementation's \"natural\" integer size and is typically the same as :" -"data:`sys.maxint` in previous releases on the same platform (assuming the " +"data:`!sys.maxint` in previous releases on the same platform (assuming the " "same build options)." msgstr "" @@ -298,7 +301,7 @@ msgid "" "uses Unicode, encodings or binary data most likely has to change. The " "change is for the better, as in the 2.x world there were numerous bugs " "having to do with mixing encoded and unencoded text. To be prepared in " -"Python 2.x, start using :class:`unicode` for all unencoded text, and :class:" +"Python 2.x, start using :class:`!unicode` for all unencoded text, and :class:" "`str` for binary or encoded data only. Then the ``2to3`` tool will do most " "of the work for you." msgstr "" @@ -323,7 +326,8 @@ msgid "" "Like :class:`str`, the :class:`bytes` type is immutable. There is a " "separate *mutable* type to hold buffered binary data, :class:`bytearray`. " "Nearly all APIs that accept :class:`bytes` also accept :class:`bytearray`. " -"The mutable API is based on :class:`collections.MutableSequence`." +"The mutable API is based on :class:`collections.MutableSequence <collections." +"abc.MutableSequence>`." msgstr "" #: ../../whatsnew/3.0.rst:274 @@ -338,10 +342,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:281 msgid "" -"The built-in :class:`basestring` abstract type was removed. Use :class:" +"The built-in :class:`!basestring` abstract type was removed. Use :class:" "`str` instead. The :class:`str` and :class:`bytes` types don't have " "functionality enough in common to warrant a shared base class. The ``2to3`` " -"tool (see below) replaces every occurrence of :class:`basestring` with :" +"tool (see below) replaces every occurrence of :class:`!basestring` with :" "class:`str`." msgstr "" @@ -436,16 +440,16 @@ msgstr "" #: ../../whatsnew/3.0.rst:354 msgid "New Syntax" -msgstr "" +msgstr "新增語法" #: ../../whatsnew/3.0.rst:356 msgid "" ":pep:`3107`: Function argument and return value annotations. This provides " "a standardized way of annotating a function's parameters and return value. " "There are no semantics attached to such annotations except that they can be " -"introspected at runtime using the :attr:`~object.__annotations__` " -"attribute. The intent is to encourage experimentation through metaclasses, " -"decorators or frameworks." +"introspected at runtime using the :attr:`!__annotations__` attribute. The " +"intent is to encourage experimentation through metaclasses, decorators or " +"frameworks." msgstr "" #: ../../whatsnew/3.0.rst:363 @@ -482,11 +486,12 @@ msgstr "" #: ../../whatsnew/3.0.rst:383 msgid "(a, *rest, b) = range(5)" -msgstr "" +msgstr "(a, *rest, b) = range(5)" #: ../../whatsnew/3.0.rst:385 msgid "This sets *a* to ``0``, *b* to ``4``, and *rest* to ``[1, 2, 3]``." msgstr "" +"這會將 *a* 設為 ``0``、將 *b* 設為 ``4``,並將 *rest* 設為 ``[1, 2, 3]``。" #: ../../whatsnew/3.0.rst:387 msgid "" @@ -558,20 +563,25 @@ msgid "" " __metaclass__ = M\n" " ..." msgstr "" +"class C:\n" +" __metaclass__ = M\n" +" ..." #: ../../whatsnew/3.0.rst:426 msgid "you must now use::" -msgstr "" +msgstr "現在必須使用: ::" #: ../../whatsnew/3.0.rst:428 msgid "" "class C(metaclass=M):\n" " ..." msgstr "" +"class C(metaclass=M):\n" +" ..." #: ../../whatsnew/3.0.rst:431 msgid "" -"The module-global :data:`__metaclass__` variable is no longer supported. " +"The module-global :data:`!__metaclass__` variable is no longer supported. " "(It was a crutch to make it easier to default to new-style classes without " "deriving every class from :class:`object`.)" msgstr "" @@ -606,11 +616,11 @@ msgstr "" #: ../../whatsnew/3.0.rst:456 msgid "Removed backticks (use :func:`repr` instead)." -msgstr "" +msgstr "移除反引號(請改用 :func:`repr`)。" #: ../../whatsnew/3.0.rst:458 msgid "Removed ``<>`` (use ``!=`` instead)." -msgstr "移除 ``<>``\\ (請改用 ``!=``\\ )。" +msgstr "移除 ``<>``\\ (請改用 ``!=``)。" #: ../../whatsnew/3.0.rst:460 msgid "" @@ -715,15 +725,15 @@ msgid "" "and has additional keyword arguments *encoding*, *errors*, *newline* and " "*closefd*. Also note that an invalid *mode* argument now raises :exc:" "`ValueError`, not :exc:`IOError`. The binary file object underlying a text " -"file object can be accessed as :attr:`f.buffer` (but beware that the text " +"file object can be accessed as :attr:`!f.buffer` (but beware that the text " "object maintains a buffer of itself in order to speed up the encoding and " "decoding operations)." msgstr "" #: ../../whatsnew/3.0.rst:529 msgid "" -":ref:`pep-3118`. The old builtin :func:`buffer` is now really gone; the new " -"builtin :func:`memoryview` provides (mostly) similar functionality." +":ref:`pep-3118`. The old builtin :func:`!buffer` is now really gone; the " +"new builtin :func:`memoryview` provides (mostly) similar functionality." msgstr "" #: ../../whatsnew/3.0.rst:533 @@ -731,8 +741,9 @@ msgid "" ":ref:`pep-3119`. The :mod:`abc` module and the ABCs defined in the :mod:" "`collections` module plays a somewhat more prominent role in the language " "now, and built-in collection types like :class:`dict` and :class:`list` " -"conform to the :class:`collections.MutableMapping` and :class:`collections." -"MutableSequence` ABCs, respectively." +"conform to the :class:`collections.MutableMapping <collections.abc." +"MutableMapping>` and :class:`collections.MutableSequence <collections.abc." +"MutableSequence>` ABCs, respectively." msgstr "" #: ../../whatsnew/3.0.rst:539 @@ -905,10 +916,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:615 msgid "" -":mod:`tkinter` (all :mod:`Tkinter`-related modules except :mod:`turtle`). " -"The target audience of :mod:`turtle` doesn't really care about :mod:" -"`tkinter`. Also note that as of Python 2.6, the functionality of :mod:" -"`turtle` has been greatly enhanced." +":mod:`tkinter` (all ``Tkinter``-related modules except :mod:`turtle`). The " +"target audience of :mod:`turtle` doesn't really care about :mod:`tkinter`. " +"Also note that as of Python 2.6, the functionality of :mod:`turtle` has been " +"greatly enhanced." msgstr "" #: ../../whatsnew/3.0.rst:620 @@ -938,24 +949,26 @@ msgstr "移除 :mod:`!sets`。請使用內建的 :func:`set` 類別。" #: ../../whatsnew/3.0.rst:631 msgid "" -"Cleanup of the :mod:`sys` module: removed :func:`sys.exitfunc`, :func:`sys." -"exc_clear`, :data:`sys.exc_type`, :data:`sys.exc_value`, :data:`sys." +"Cleanup of the :mod:`sys` module: removed :func:`!sys.exitfunc`, :func:`!sys." +"exc_clear`, :data:`!sys.exc_type`, :data:`!sys.exc_value`, :data:`!sys." "exc_traceback`. (Note that :data:`sys.last_type` etc. remain.)" msgstr "" #: ../../whatsnew/3.0.rst:636 msgid "" -"Cleanup of the :class:`array.array` type: the :meth:`read` and :meth:`write` " -"methods are gone; use :meth:`fromfile` and :meth:`tofile` instead. Also, " -"the ``'c'`` typecode for array is gone -- use either ``'b'`` for bytes or " -"``'u'`` for Unicode characters." +"Cleanup of the :class:`array.array` type: the :meth:`!read` and :meth:`!" +"write` methods are gone; use :meth:`~array.array.fromfile` and :meth:`~array." +"array.tofile` instead. Also, the ``'c'`` typecode for array is gone -- use " +"either ``'b'`` for bytes or ``'u'`` for Unicode characters." msgstr "" #: ../../whatsnew/3.0.rst:642 msgid "" -"Cleanup of the :mod:`operator` module: removed :func:`sequenceIncludes` and :" -"func:`isCallable`." +"Cleanup of the :mod:`operator` module: removed :func:`!sequenceIncludes` " +"and :func:`!isCallable`." msgstr "" +"清理 :mod:`operator` 模組:移除 :func:`!sequenceIncludes` 和 :func:`!" +"isCallable`。" #: ../../whatsnew/3.0.rst:645 msgid "" @@ -965,8 +978,9 @@ msgid "" msgstr "" #: ../../whatsnew/3.0.rst:649 -msgid "Cleanup of the :mod:`random` module: removed the :func:`jumpahead` API." -msgstr "清理 :mod:`random` 模組:移除 :func:`jumpahead` API。" +msgid "" +"Cleanup of the :mod:`random` module: removed the :func:`!jumpahead` API." +msgstr "清理 :mod:`random` 模組:移除 :func:`!jumpahead` API。" #: ../../whatsnew/3.0.rst:651 msgid "The :mod:`!new` module is gone." @@ -974,8 +988,8 @@ msgstr "移除 :mod:`!new` 模組。" #: ../../whatsnew/3.0.rst:653 msgid "" -"The functions :func:`os.tmpnam`, :func:`os.tempnam` and :func:`os.tmpfile` " -"have been removed in favor of the :mod:`tempfile` module." +"The functions :func:`!os.tmpnam`, :func:`!os.tempnam` and :func:`!os." +"tmpfile` have been removed in favor of the :mod:`tempfile` module." msgstr "" #: ../../whatsnew/3.0.rst:657 @@ -986,19 +1000,19 @@ msgstr "" #: ../../whatsnew/3.0.rst:661 msgid "" -":data:`string.letters` and its friends (:data:`string.lowercase` and :data:" -"`string.uppercase`) are gone. Use :data:`string.ascii_letters` etc. " -"instead. (The reason for the removal is that :data:`string.letters` and " +":data:`!string.letters` and its friends (:data:`!string.lowercase` and :data:" +"`!string.uppercase`) are gone. Use :data:`string.ascii_letters` etc. " +"instead. (The reason for the removal is that :data:`!string.letters` and " "friends had locale-specific behavior, which is a bad idea for such " "attractively named global \"constants\".)" msgstr "" #: ../../whatsnew/3.0.rst:668 msgid "" -"Renamed module :mod:`__builtin__` to :mod:`builtins` (removing the " -"underscores, adding an 's'). The :data:`__builtins__` variable found in " +"Renamed module :mod:`!__builtin__` to :mod:`builtins` (removing the " +"underscores, adding an 's'). The :data:`!__builtins__` variable found in " "most global namespaces is unchanged. To modify a builtin, you should use :" -"mod:`builtins`, not :data:`__builtins__`!" +"mod:`builtins`, not :data:`!__builtins__`!" msgstr "" #: ../../whatsnew/3.0.rst:675 @@ -1043,13 +1057,13 @@ msgid "" msgstr "" #: ../../whatsnew/3.0.rst:705 -msgid ":exc:`StandardError` was removed." -msgstr ":exc:`StandardError` 被移除。" +msgid ":exc:`!StandardError` was removed." +msgstr ":exc:`!StandardError` 已被移除。" #: ../../whatsnew/3.0.rst:707 msgid "" -"Exceptions no longer behave as sequences. Use the :attr:`args` attribute " -"instead." +"Exceptions no longer behave as sequences. Use the :attr:`~BaseException." +"args` attribute instead." msgstr "" #: ../../whatsnew/3.0.rst:710 @@ -1135,10 +1149,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:768 msgid "" -":meth:`__getslice__`, :meth:`__setslice__` and :meth:`__delslice__` were " +":meth:`!__getslice__`, :meth:`!__setslice__` and :meth:`!__delslice__` were " "killed. The syntax ``a[i:j]`` now translates to ``a.__getitem__(slice(i, " -"j))`` (or :meth:`__setitem__` or :meth:`__delitem__`, when used as an " -"assignment or deletion target, respectively)." +"j))`` (or :meth:`~object.__setitem__` or :meth:`~object.__delitem__`, when " +"used as an assignment or deletion target, respectively)." msgstr "" #: ../../whatsnew/3.0.rst:774 @@ -1149,14 +1163,14 @@ msgstr "" #: ../../whatsnew/3.0.rst:777 msgid "" -"The :meth:`__oct__` and :meth:`__hex__` special methods are removed -- :func:" -"`oct` and :func:`hex` use :meth:`__index__` now to convert the argument to " -"an integer." +"The :meth:`!__oct__` and :meth:`!__hex__` special methods are removed -- :" +"func:`oct` and :func:`hex` use :meth:`~object.__index__` now to convert the " +"argument to an integer." msgstr "" #: ../../whatsnew/3.0.rst:781 -msgid "Removed support for :attr:`__members__` and :attr:`__methods__`." -msgstr "移除對 :attr:`__members__` 和 :attr:`__methods__` 的支援。" +msgid "Removed support for :attr:`!__members__` and :attr:`!__methods__`." +msgstr "移除對 :attr:`!__members__` 和 :attr:`!__methods__` 的支援。" #: ../../whatsnew/3.0.rst:783 msgid "" @@ -1189,7 +1203,7 @@ msgstr "" #: ../../whatsnew/3.0.rst:805 msgid "" -":pep:`3111`: :func:`raw_input` was renamed to :func:`input`. That is, the " +":pep:`3111`: :func:`!raw_input` was renamed to :func:`input`. That is, the " "new :func:`input` function reads a line from :data:`sys.stdin` and returns " "it with the trailing newline stripped. It raises :exc:`EOFError` if the " "input is terminated prematurely. To get the old behavior of :func:`input`, " @@ -1214,55 +1228,55 @@ msgid "" msgstr "" #: ../../whatsnew/3.0.rst:823 -msgid "Moved :func:`intern` to :func:`sys.intern`." +msgid "Moved :func:`!intern` to :func:`sys.intern`." msgstr "" #: ../../whatsnew/3.0.rst:825 msgid "" -"Removed: :func:`apply`. Instead of ``apply(f, args)`` use ``f(*args)``." -msgstr "" +"Removed: :func:`!apply`. Instead of ``apply(f, args)`` use ``f(*args)``." +msgstr "移除 :func:`!apply`。請使用 ``f(*args)`` 來替換 ``apply(f, args)``。" #: ../../whatsnew/3.0.rst:828 msgid "" "Removed :func:`callable`. Instead of ``callable(f)`` you can use " -"``isinstance(f, collections.Callable)``. The :func:`operator.isCallable` " +"``isinstance(f, collections.Callable)``. The :func:`!operator.isCallable` " "function is also gone." msgstr "" #: ../../whatsnew/3.0.rst:832 msgid "" -"Removed :func:`coerce`. This function no longer serves a purpose now that " +"Removed :func:`!coerce`. This function no longer serves a purpose now that " "classic classes are gone." msgstr "" #: ../../whatsnew/3.0.rst:835 msgid "" -"Removed :func:`execfile`. Instead of ``execfile(fn)`` use ``exec(open(fn)." +"Removed :func:`!execfile`. Instead of ``execfile(fn)`` use ``exec(open(fn)." "read())``." msgstr "" -"移除 :func:`execfile`。請使用 ``exec(open(fn).read())`` 來替換 " +"移除 :func:`!execfile`。請使用 ``exec(open(fn).read())`` 來替換 " "``execfile(fn)``。" #: ../../whatsnew/3.0.rst:838 msgid "" -"Removed the :class:`file` type. Use :func:`open`. There are now several " +"Removed the :class:`!file` type. Use :func:`open`. There are now several " "different kinds of streams that open can return in the :mod:`io` module." msgstr "" #: ../../whatsnew/3.0.rst:841 msgid "" -"Removed :func:`reduce`. Use :func:`functools.reduce` if you really need it; " -"however, 99 percent of the time an explicit :keyword:`for` loop is more " +"Removed :func:`!reduce`. Use :func:`functools.reduce` if you really need " +"it; however, 99 percent of the time an explicit :keyword:`for` loop is more " "readable." msgstr "" #: ../../whatsnew/3.0.rst:845 -msgid "Removed :func:`reload`. Use :func:`!imp.reload`." -msgstr "" +msgid "Removed :func:`!reload`. Use :func:`!imp.reload`." +msgstr "移除 :func:`!reload`。請使用 :func:`!imp.reload`。" #: ../../whatsnew/3.0.rst:847 msgid "" -"Removed. :meth:`dict.has_key` -- use the :keyword:`in` operator instead." +"Removed. :meth:`!dict.has_key` -- use the :keyword:`in` operator instead." msgstr "" #: ../../whatsnew/3.0.rst:854 diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index b0f93a3c71..3202bc30a7 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -3991,7 +3991,7 @@ msgstr "(由 Zhang Na 於 :gh:`90656` 中貢獻。)" #: ../../whatsnew/3.12.rst:1819 msgid "``PYTHON_FOR_REGEN`` now require Python 3.10 or newer." -msgstr "" +msgstr "``PYTHON_FOR_REGEN`` 現在需要 Python 3.10 或更新的版本。" #: ../../whatsnew/3.12.rst:1821 msgid "" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index 5e82698d42..ea9bec402b 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -513,7 +513,7 @@ msgstr "" #: ../../whatsnew/3.13.rst:308 msgid "" "(Contributed by Pablo Galindo Salgado and Shantanu Jain in :gh:`107944`.)" -msgstr "" +msgstr "(由 Pablo Galindo Salgado 和 Shantanu Jain 於 :gh:`107944` 中貢獻。)" #: ../../whatsnew/3.13.rst:314 msgid "Free-threaded CPython" diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index b63071a79e..d4e6ccd8c2 100644 --- a/whatsnew/3.6.po +++ b/whatsnew/3.6.po @@ -1167,7 +1167,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:801 msgid "Contributed by Serhiy Storchaka in :issue:`26492`." -msgstr "" +msgstr "由 Serhiy Storchaka 於 :issue:`26492` 中貢獻。" #: ../../whatsnew/3.6.rst:804 msgid "ast" @@ -1181,7 +1181,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:809 msgid "Contributed by Victor Stinner in :issue:`26146`." -msgstr "" +msgstr "由 Victor Stinner 於 :issue:`26146` 中貢獻。" #: ../../whatsnew/3.6.rst:813 msgid "asyncio" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index 6e6f30678a..b2c04d4e21 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -882,7 +882,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:610 msgid "Contributed by Barry Warsaw and Brett Cannon in :issue:`32248`." -msgstr "" +msgstr "由 Barry Warsaw 與 Brett Cannon 在 :issue:`32248` 中貢獻。" #: ../../whatsnew/3.7.rst:614 msgid "" From cc66b147be2cdcd5eb611641bb7c6d9d597715c7 Mon Sep 17 00:00:00 2001 From: Tommy Chiang <oToToT@users.noreply.github.com> Date: Fri, 20 Dec 2024 22:33:30 +0800 Subject: [PATCH 60/89] fix(library/tempfile): add a missing backtick (#1009) --- library/tempfile.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/tempfile.po b/library/tempfile.po index 1263ef9a43..ea21fbf628 100644 --- a/library/tempfile.po +++ b/library/tempfile.po @@ -186,7 +186,7 @@ msgid "" msgstr "" "回傳的物件始終是一個\\ :term:`類檔案物件 <file-like object>`,其 :attr:`!" "file` 屬性是底層的真實檔案物件。這個類檔案物件可以在 :keyword:`with` 陳述式中" -"使用,就像普通檔案一樣。臨時檔案的名稱可以從回傳的類檔案物件的 :attr:!name` " +"使用,就像普通檔案一樣。臨時檔案的名稱可以從回傳的類檔案物件的 :attr:`!name` " "屬性中取得。在 Unix 上則與 :func:`TemporaryFile` 不同,目錄條目不會在檔案建立" "後立即被取消鏈接 (unlink)。" From e7b56755cae7dba3f19e8e27c66c01826b6628b8 Mon Sep 17 00:00:00 2001 From: mindihx <ymhuang.ymh@gmail.com> Date: Mon, 23 Dec 2024 20:43:45 +0800 Subject: [PATCH 61/89] Update translation for library/enum, library/exceptions and howto/sorting (#1010) --- howto/sorting.po | 51 ++++++++++++++--- library/enum.po | 124 +++++++++++++++++++++--------------------- library/exceptions.po | 55 +++++++++---------- 3 files changed, 130 insertions(+), 100 deletions(-) diff --git a/howto/sorting.po b/howto/sorting.po index c61a7fc774..f66a0870ce 100644 --- a/howto/sorting.po +++ b/howto/sorting.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2023-08-12 15:09+0800\n" +"PO-Revision-Date: 2024-12-20 19:16+0800\n" "Last-Translator: Li-Hung Wang <li-hung@sciwork.dev>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -128,6 +128,8 @@ msgid "" ">>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n" "['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']" msgstr "" +">>> sorted(\"This is a test string from Andrew\".split(), key=str.casefold)\n" +"['a', 'Andrew', 'from', 'is', 'string', 'test', 'This']" #: ../../howto/sorting.rst:61 msgid "" @@ -157,6 +159,13 @@ msgid "" ">>> sorted(student_tuples, key=lambda student: student[2]) # sort by age\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" +">>> student_tuples = [\n" +"... ('john', 'A', 15),\n" +"... ('jane', 'B', 12),\n" +"... ('dave', 'B', 10),\n" +"... ]\n" +">>> sorted(student_tuples, key=lambda student: student[2]) # 依照年齡排序\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" #: ../../howto/sorting.rst:79 msgid "" @@ -182,6 +191,22 @@ msgid "" "age\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" +">>> class Student:\n" +"... def __init__(self, name, grade, age):\n" +"... self.name = name\n" +"... self.grade = grade\n" +"... self.age = age\n" +"... def __repr__(self):\n" +"... return repr((self.name, self.grade, self.age))\n" +"\n" +">>> student_objects = [\n" +"... Student('john', 'A', 15),\n" +"... Student('jane', 'B', 12),\n" +"... Student('dave', 'B', 10),\n" +"... ]\n" +">>> sorted(student_objects, key=lambda student: student.age) # 依照年齡排" +"序\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" #: ../../howto/sorting.rst:99 msgid "" @@ -363,6 +388,10 @@ msgid "" "primary key, descending\n" "[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" msgstr "" +">>> s = sorted(student_objects, key=attrgetter('age')) # 依照次要鍵排序\n" +">>> sorted(s, key=attrgetter('grade'), reverse=True) # 現在依照主要鍵降" +"冪排序\n" +"[('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)]" #: ../../howto/sorting.rst:193 msgid "" @@ -436,6 +465,11 @@ msgid "" ">>> [student for grade, i, student in decorated] # undecorate\n" "[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]" msgstr "" +">>> decorated = [(student.grade, i, student) for i, student in " +"enumerate(student_objects)]\n" +">>> decorated.sort()\n" +">>> [student for grade, i, student in decorated] # 移除裝飾\n" +"[('john', 'A', 15), ('jane', 'B', 12), ('dave', 'B', 10)]" #: ../../howto/sorting.rst:231 msgid "" @@ -532,7 +566,7 @@ msgstr "" #: ../../howto/sorting.rst:273 msgid "sorted(words, key=cmp_to_key(strcoll)) # locale-aware sort order" -msgstr "" +msgstr "sorted(words, key=cmp_to_key(strcoll)) # 理解語系的排序順序" #: ../../howto/sorting.rst:276 msgid "Odds and Ends" @@ -605,10 +639,10 @@ msgid "" "six comparison methods be implemented. The :func:`~functools.total_ordering` " "decorator is provided to make that task easier." msgstr "" -"然而,請注意,當 :meth:`~object.__lt__` 沒有被實做時,``<`` 可以回退 (fall " +"然而,請注意,當 :meth:`~object.__lt__` 沒有被實作時,``<`` 可以回退 (fall " "back) 使用 :meth:`~object.__gt__`\\ (有關技術上的細節資訊請看 :func:`object." -"__lt__` )。為了避免意外發生,:pep:`8` 建議所有六種的比較函式都需要被實作。裝飾" -"器 :func:`~functools.total_ordering` 被提供用來讓任務更為簡單。" +"__lt__` )。為了避免意外發生,:pep:`8` 建議所有六種的比較函式都需要被實作。裝" +"飾器 :func:`~functools.total_ordering` 被提供用來讓任務更為簡單。" #: ../../howto/sorting.rst:314 msgid "" @@ -672,7 +706,6 @@ msgid "" "position ``0``. These functions are suitable for implementing priority " "queues which are commonly used for task scheduling." msgstr "" -":func:`heapq.heappush` 和 :func:`heapq.heappop` 會建立並維持一個部份排序的資料" -"排列,將最小的元素保持在位置 ``0``。這些函式適合用來實作常用於任務排程的優先" -"佇列。" - +":func:`heapq.heappush` 和 :func:`heapq.heappop` 會建立並維持一個部份排序的資" +"料排列,將最小的元素保持在位置 ``0``。這些函式適合用來實作常用於任務排程的優" +"先佇列。" diff --git a/library/enum.po b/library/enum.po index 25abbe8562..85b9d2908d 100644 --- a/library/enum.po +++ b/library/enum.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-11-02 00:13+0000\n" -"PO-Revision-Date: 2023-09-11 14:08+0800\n" +"PO-Revision-Date: 2024-12-21 13:50+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -85,6 +85,16 @@ msgid "" ">>> # functional syntax\n" ">>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)])" msgstr "" +">>> from enum import Enum\n" +"\n" +">>> # class 語法\n" +">>> class Color(Enum):\n" +"... RED = 1\n" +"... GREEN = 2\n" +"... BLUE = 3\n" +"\n" +">>> # 函式語法\n" +">>> Color = Enum('Color', [('RED', 1), ('GREEN', 2), ('BLUE', 3)])" #: ../../library/enum.rst:49 msgid "" @@ -199,7 +209,7 @@ msgid "" "the :class:`str() <str>` of the mixed-in type." msgstr "" "由 :class:`IntEnum`、:class:`StrEnum` 及 :class:`IntFlag` 所使用來保留這些混" -"合類型的 :class:`str() <str>`。" +"合型別的 :class:`str() <str>`。" #: ../../library/enum.rst:101 msgid ":class:`EnumCheck`" @@ -331,20 +341,19 @@ msgid "" "to subclass *EnumType* -- see :ref:`Subclassing EnumType <enumtype-" "examples>` for details." msgstr "" -"*EnumType* 是\\ *列舉*\\ 的 :term:`metaclass`。*EnumType* 可以有子類別 -- 細" +"*EnumType* 是 *enum* 列舉的 :term:`metaclass`。*EnumType* 可以有子類別 -- 細" "節請參考 :ref:`建立 EnumType 的子類別 <enumtype-examples>`。" #: ../../library/enum.rst:168 -#, fuzzy msgid "" "``EnumType`` is responsible for setting the correct :meth:`!__repr__`, :meth:" "`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the " "final *enum*, as well as creating the enum members, properly handling " "duplicates, providing iteration over the enum class, etc." msgstr "" -"*EnumType* 負責在最後的\\ *列舉*\\ 上面設定正確的 :meth:`!__repr__`、:meth:`!" -"__str__`、:meth:`!__format__` 及 :meth:`!__reduce__` 方法,以及建立列舉成員," -"並正確處理重複,提供列舉類別的疊代等等。" +"``EnumType`` 負責在最後的\\ *列舉*\\ 上面設定正確的 :meth:`!__repr__`、:meth:" +"`!__str__`、:meth:`!__format__` 及 :meth:`!__reduce__` 方法,以及建立列舉成" +"員、正確處理重複、提供列舉類別的疊代等等。" #: ../../library/enum.rst:175 msgid "This method is called in two different ways:" @@ -410,7 +419,7 @@ msgstr "type" #: ../../library/enum.rst:190 msgid "A mix-in type for the new Enum." -msgstr "新列舉的混合類型。" +msgstr "新列舉的混合型別。" #: ../../library/enum.rst:0 msgid "start" @@ -534,20 +543,22 @@ msgid "" "Adds a new name as an alias to an existing member. Raises a :exc:" "`NameError` if the name is already assigned to a different member." msgstr "" +"新增一個名稱作為現有成員的別名。如果該名稱已被指派給不同的成員,則會引發 :" +"exc:`NameError`。" #: ../../library/enum.rst:256 msgid "" "Adds a new value as an alias to an existing member. Raises a :exc:" "`ValueError` if the value is already linked with a different member." msgstr "" +"新增一個值作為現有成員的別名。如果該值已與不同成員連結,則會引發 :exc:" +"`ValueError`。" #: ../../library/enum.rst:261 -#, fuzzy msgid "" "Before 3.11 ``EnumType`` was called ``EnumMeta``, which is still available " "as an alias." -msgstr "" -"在 3.11 之前,``enum`` 使用 ``EnumMeta`` 類型,目前保留此類型當作別名。" +msgstr "在 3.11 之前,``EnumType`` 稱作 ``EnumMeta``,其目前仍可作為別名使用。" #: ../../library/enum.rst:266 msgid "*Enum* is the base class for all *enum* enumerations." @@ -602,6 +613,9 @@ msgid "" "quadratic performance impact during creation relative to the total number of " "mutable/unhashable values in the enum." msgstr "" +"雖然可以使用可變的 (mutable) / 不可雜湊的 (unhashable) 值,例如 :class:" +"`dict`、:class:`list` 或可變的 :class:`~dataclasses.dataclass`,它們在建立期" +"間會對效能產生相對於列舉中可變的 / 不可雜湊的值總數量的二次方影響。" #: ../../library/enum.rst:298 msgid "Name of the member." @@ -806,7 +820,7 @@ msgstr "" #: ../../library/enum.rst:408 msgid "" "results in the call ``int('1a', 16)`` and a value of ``26`` for the member." -msgstr "" +msgstr "會產生呼叫 ``int('1a', 16)`` 而該成員的值為 ``26``。" #: ../../library/enum.rst:412 msgid "" @@ -925,15 +939,14 @@ msgid "Added :ref:`enum-dataclass-support`" msgstr "新增 :ref:`enum-dataclass-support`" #: ../../library/enum.rst:471 -#, fuzzy msgid "" "*IntEnum* is the same as :class:`Enum`, but its members are also integers " "and can be used anywhere that an integer can be used. If any integer " "operation is performed with an *IntEnum* member, the resulting value loses " "its enumeration status." msgstr "" -"*IntEnum* 和 *Enum* 一樣,但其成員同時也是整數而可以被用在任何使用整數的地" -"方。如果 *IntEnum* 成員經過任何整數運算,其結果會失去列舉狀態。" +"*IntEnum* 和 :class:`Enum` 一樣,但其成員同時也是整數而可以被用在任何使用整數" +"的地方。如果 *IntEnum* 成員經過任何整數運算,結果值會失去其列舉狀態。" #: ../../library/enum.rst:492 msgid "" @@ -952,15 +965,14 @@ msgstr "" "meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" #: ../../library/enum.rst:502 -#, fuzzy msgid "" "``StrEnum`` is the same as :class:`Enum`, but its members are also strings " "and can be used in most of the same places that a string can be used. The " "result of any string operation performed on or with a *StrEnum* member is " "not part of the enumeration." msgstr "" -"*StrEnum* 和 *Enum* 一樣,但其成員同時也是字串而可以被用在幾乎所有使用字串的" -"地方。*StrEnum* 成員經過任何字串操作的結果會不再是列舉的一部份。" +"``StrEnum`` 和 :class:`Enum` 一樣,但其成員同時也是字串而可以被用在幾乎所有使" +"用字串的地方。*StrEnum* 成員經過任何字串操作的結果會不再是列舉的一部份。" #: ../../library/enum.rst:508 msgid "" @@ -1138,9 +1150,8 @@ msgstr "" "<Color.RED|GREEN|BLUE: 7>" #: ../../library/enum.rst:614 -#, fuzzy msgid "Returns all the flags in *type(self)* that are not in *self*::" -msgstr "回傳所有在 *type(self)* 但不在 self 裡的旗標: ::" +msgstr "回傳所有在 *type(self)* 但不在 *self* 裡的旗標: ::" #: ../../library/enum.rst:616 msgid "" @@ -1177,13 +1188,12 @@ msgid "The *repr()* of zero-valued flags has changed. It is now::" msgstr "值為 0 的旗標的 *repr()* 已改變。現在是: ::" #: ../../library/enum.rst:641 -#, fuzzy msgid "" "``IntFlag`` is the same as :class:`Flag`, but its members are also integers " "and can be used anywhere that an integer can be used." msgstr "" -"*IntFlag* 和 *Flag* 一樣,但其成員同時也是整數而可以被用在任何使用整數的地" -"方。" +"``IntFlag`` 和 :class:`Flag` 一樣,但其成員同時也是整數而可以被用在任何使用整" +"數的地方。" #: ../../library/enum.rst:655 msgid "" @@ -1200,25 +1210,22 @@ msgstr "" "3" #: ../../library/enum.rst:661 -#, fuzzy msgid "If a :class:`Flag` operation is performed with an *IntFlag* member and:" -msgstr "如果 *IntFlag* 成員經過 *Flag* 操作且:" +msgstr "如果 *IntFlag* 成員經過 :class:`Flag` 操作且:" #: ../../library/enum.rst:663 msgid "the result is a valid *IntFlag*: an *IntFlag* is returned" msgstr "結果是合法的 *IntFlag*:回傳 *IntFlag*" #: ../../library/enum.rst:664 -#, fuzzy msgid "" "the result is not a valid *IntFlag*: the result depends on the :class:" "`FlagBoundary` setting" -msgstr "結果不是合法的 *IntFlag*:結果會根據 *FlagBoundary* 的設定" +msgstr "結果不是合法的 *IntFlag*:結果會根據 :class:`FlagBoundary` 的設定" #: ../../library/enum.rst:666 -#, fuzzy msgid "The :func:`repr` of unnamed zero-valued flags has changed. It is now:" -msgstr "未命名且值為 0 的旗標的 *repr()* 已改變。現在是: ::" +msgstr "未命名且值為 0 的旗標的 :func:`repr` 已改變。現在是:" #: ../../library/enum.rst:673 msgid "" @@ -1252,7 +1259,7 @@ msgid "" "but the :class:`str() <str>` of the mixed-in data type:" msgstr "" ":class:`!ReprEnum` 使用 :class:`Enum` 的 :meth:`repr() <Enum.__repr__>`,但使" -"用混合資料類型的 :class:`str() <str>`:" +"用混合資料型別的 :class:`str() <str>`:" #: ../../library/enum.rst:691 msgid ":meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag`" @@ -1268,7 +1275,7 @@ msgid "" "`format` of the mixed-in data type instead of using the :class:`Enum`-" "default :meth:`str() <Enum.__str__>`." msgstr "" -"繼承 :class:`!ReprEnum` 來保留混合資料類型的 :class:`str() <str>` / :func:" +"繼承 :class:`!ReprEnum` 來保留混合資料型別的 :class:`str() <str>` / :func:" "`format`,而不是使用 :class:`Enum` 預設的 :meth:`str() <Enum.__str__>`。" #: ../../library/enum.rst:703 @@ -1377,11 +1384,10 @@ msgid "" msgstr "CONTINUOUS 和 NAMED_FLAGS 是設計用來運作在整數值的成員上。" #: ../../library/enum.rst:762 -#, fuzzy msgid "" "``FlagBoundary`` controls how out-of-range values are handled in :class:" "`Flag` and its subclasses." -msgstr "*FlagBoundary* 控制在 *Flag* 及其子類別中如何處理範圍外的值。" +msgstr "``FlagBoundary`` 控制在 :class:`Flag` 及其子類別中如何處理範圍外的值。" #: ../../library/enum.rst:767 msgid "" @@ -1418,11 +1424,10 @@ msgstr "" " allowed 0b0 00111" #: ../../library/enum.rst:785 -#, fuzzy msgid "" "Out-of-range values have invalid values removed, leaving a valid :class:" "`Flag` value::" -msgstr "範圍外的值會移除非法值,留下合法的 *Flag* 值: ::" +msgstr "會移除範圍外的值中的非法值,留下合法的 :class:`Flag` 值: ::" #: ../../library/enum.rst:788 msgid "" @@ -1445,20 +1450,18 @@ msgstr "" "<ConformFlag.BLUE: 4>" #: ../../library/enum.rst:799 -#, fuzzy msgid "" "Out-of-range values lose their :class:`Flag` membership and revert to :class:" "`int`." -msgstr "範圍外的值會失去它們的 *Flag* 成員資格且恢復成 :class:`int`。" +msgstr "範圍外的值會失去它們的 :class:`Flag` 成員資格且恢復成 :class:`int`。" #: ../../library/enum.rst:812 -#, fuzzy msgid "" "Out-of-range values are kept, and the :class:`Flag` membership is kept. This " "is the default for :class:`IntFlag`::" msgstr "" -"範圍外的值會被保留,*Flag* 成員資格也會被保留。這是 :class:`IntFlag` 的預設行" -"為: ::" +"範圍外的值會被保留,:class:`Flag` 成員資格也會被保留。這是 :class:`IntFlag` " +"的預設行為: ::" #: ../../library/enum.rst:815 msgid "" @@ -1482,7 +1485,7 @@ msgstr "" #: ../../library/enum.rst:829 msgid "Supported ``__dunder__`` names" -msgstr "支援 ``__dunder__`` 名稱" +msgstr "支援的 ``__dunder__`` 名稱" #: ../../library/enum.rst:831 msgid "" @@ -1493,31 +1496,30 @@ msgstr "" "目的對映。只有在類別上可用。" #: ../../library/enum.rst:834 -#, fuzzy msgid "" ":meth:`~Enum.__new__`, if specified, must create and return the enum " "members; it is also a very good idea to set the member's :attr:`!_value_` " "appropriately. Once all the members are created it is no longer used." msgstr "" -"如果指定了 :meth:`~Enum.__new__`,它必須建立並回傳列舉成員;適當地設定成員" +":meth:`~Enum.__new__`,如果有指定,它必須建立並回傳列舉成員;適當地設定成員" "的 :attr:`!_value_` 也是一個很好的主意。一旦所有成員都建立之後就不會再被用" "到。" #: ../../library/enum.rst:840 msgid "Supported ``_sunder_`` names" -msgstr "支援 ``_sunder_`` 名稱" +msgstr "支援的 ``_sunder_`` 名稱" #: ../../library/enum.rst:842 msgid "" ":meth:`~EnumType._add_alias_` -- adds a new name as an alias to an existing " "member." -msgstr "" +msgstr ":meth:`~EnumType._add_alias_` -- 新增一個名稱作為現有成員的別名。" #: ../../library/enum.rst:844 msgid "" ":meth:`~EnumType._add_value_alias_` -- adds a new value as an alias to an " "existing member." -msgstr "" +msgstr ":meth:`~EnumType._add_value_alias_` -- 新增一個值作為現有成員的別名。" #: ../../library/enum.rst:846 msgid ":attr:`~Enum._name_` -- name of the member" @@ -1559,32 +1561,33 @@ msgstr "" ":meth:`~Enum._generate_next_value_` -- 用來為列舉成員取得合適的值;可以被覆寫" #: ../../library/enum.rst:860 -#, fuzzy msgid "" "For standard :class:`Enum` classes the next value chosen is the highest " "value seen incremented by one." msgstr "" -"對標準的 :class:`Enum` 類別來說,下一個被選擇的值是最後一個看見的值加一。" +"對標準的 :class:`Enum` 類別來說,下一個被選擇的值是所看過的最大值加一。" #: ../../library/enum.rst:863 -#, fuzzy msgid "" "For :class:`Flag` classes the next value chosen will be the next highest " "power-of-two." msgstr "" -"對 :class:`Flag` 類別來說,下一個被選擇的值是下一個最大的 2 的次方,不管最後" -"一個看見的值是什麼。" +"對 :class:`Flag` 類別來說,下一個被選擇的值是下一個最大的 2 的次方的數字。" #: ../../library/enum.rst:866 msgid "" "While ``_sunder_`` names are generally reserved for the further development " "of the :class:`Enum` class and can not be used, some are explicitly allowed:" msgstr "" +"雖然 ``_sunder_`` 名稱通常保留用於 :class:`Enum` 類別的進一步開發而不能被使" +"用,但有些是明確允許的:" #: ../../library/enum.rst:869 msgid "" "``_repr_*`` (e.g. ``_repr_html_``), as used in `IPython's rich display`_" msgstr "" +"``_repr_*``(例如 ``_repr_html_``),例如用於 `IPython 的豐富顯示 <IPython’s " +"rich display_>`_" #: ../../library/enum.rst:871 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" @@ -1596,14 +1599,13 @@ msgstr "``_ignore_``" #: ../../library/enum.rst:873 msgid "``_add_alias_``, ``_add_value_alias_``, ``_repr_*``" -msgstr "" +msgstr "``_add_alias_``、``_add_value_alias_``、``_repr_*``" #: ../../library/enum.rst:879 msgid "Utilities and Decorators" msgstr "通用項目與裝飾器" #: ../../library/enum.rst:883 -#, fuzzy msgid "" "*auto* can be used in place of a value. If used, the *Enum* machinery will " "call an :class:`Enum`'s :meth:`~Enum._generate_next_value_` to get an " @@ -1613,11 +1615,11 @@ msgid "" "for :class:`StrEnum` it will be the lower-cased version of the member's " "name. Care must be taken if mixing *auto()* with manually specified values." msgstr "" -"*auto* 可以用來取代給值。如果使用的話,*Enum* 系統會呼叫 *Enum* 的 :meth:" -"`~Enum._generate_next_value_` 來取得合適的值。對 *Enum* 和 *IntEnum* 來說,合" -"適的值是最後一個值加一;對 *Flag* 和 *IntFlag* 來說,是第一個比最大值還大的 " -"2 的次方的數字;對 *StrEnum* 來說,是成員名稱的小寫版本。如果混用 *auto()* 和" -"手動指定值的話要特別注意。" +"*auto* 可以用來取代給值。如果使用的話,*Enum* 系統會呼叫 :class:`Enum` 的 :" +"meth:`~Enum._generate_next_value_` 來取得合適的值。對 :class:`Enum` 和 :" +"class:`IntEnum` 來說,合適的值是最後一個值加一;對 :class:`Flag` 和 :class:" +"`IntFlag` 來說,是第一個比最大值還大的 2 的次方的數字;對 :class:`StrEnum` 來" +"說,是成員名稱的小寫版本。如果混用 *auto()* 和手動指定值的話要特別注意。" #: ../../library/enum.rst:891 msgid "" @@ -1663,7 +1665,7 @@ msgid "" "incompatible type." msgstr "" "在 3.13 預設 ``_generate_next_value_`` 總是回傳最大的成員值加一,如果任何成員" -"是不相容的類型就會失敗。" +"是不相容的型別就會失敗。" #: ../../library/enum.rst:913 msgid "" @@ -1765,7 +1767,7 @@ msgid "" "These three enum types are designed to be drop-in replacements for existing " "integer- and string-based values; as such, they have extra limitations:" msgstr "" -"這三種列舉類型是設計來直接取代現有以整數及字串為基底的值;因此它們有額外的限" +"這三種列舉型別是設計來直接取代現有以整數及字串為基底的值;因此它們有額外的限" "制:" #: ../../library/enum.rst:988 @@ -1783,7 +1785,7 @@ msgid "" "If you do not need/want those limitations, you can either create your own " "base class by mixing in the ``int`` or ``str`` type yourself::" msgstr "" -"如果你不需要或不想要這些限制,你可以透過混合 ``int`` 或 ``str`` 類型來建立自" +"如果你不需要或不想要這些限制,你可以透過混合 ``int`` 或 ``str`` 型別來建立自" "己的基礎類別: ::" #: ../../library/enum.rst:996 diff --git a/library/exceptions.po b/library/exceptions.po index eb2e321fa6..b413eabffe 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" -"PO-Revision-Date: 2024-09-17 09:18+0800\n" +"PO-Revision-Date: 2024-12-20 16:57+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -18,7 +18,6 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.4.2\n" #: ../../library/exceptions.rst:4 msgid "Built-in Exceptions" @@ -163,7 +162,7 @@ msgid "" "possible conflicts between how the bases handle the ``args`` attribute, as " "well as due to possible memory layout incompatibilities." msgstr "" -"使用者的程式碼可以建立繼承自例外類型的子類別。建議一次只繼承一種例外類型以避" +"使用者的程式碼可以建立繼承自例外型別的子類別。建議一次只繼承一種例外型別以避" "免在基底類別之間如何處理 ``args`` 屬性的任何可能衝突,以及可能的記憶體佈局 " "(memory layout) 不相容。" @@ -177,9 +176,9 @@ msgid "" "it's recommended to avoid subclassing multiple exception types altogether." msgstr "" "為了效率,大部分的內建例外使用 C 來實作,參考 :source:`Objects/exceptions." -"c`。一些例外有客製化的記憶體佈局,使其不可能建立一個繼承多種例外類型的子類" -"別。類型的記憶體佈局是實作細節且可能會在不同 Python 版本間改變,造成未來新的" -"衝突。因此,總之建議避免繼承多種例外類型。" +"c`。一些例外有客製化的記憶體佈局,使其不可能建立一個繼承多種例外型別的子類" +"別。型別的記憶體佈局是實作細節且可能會在不同 Python 版本間改變,造成未來新的" +"衝突。因此,總之建議避免繼承多種例外型別。" #: ../../library/exceptions.rst:105 msgid "Base classes" @@ -624,24 +623,26 @@ msgstr "" "化,大部分的浮點數運算都沒有被檢查。" #: ../../library/exceptions.rst:421 -#, fuzzy msgid "" "This exception is derived from :exc:`RuntimeError`. It is raised when an " "operation is blocked during interpreter shutdown also known as :term:`Python " "finalization <interpreter shutdown>`." msgstr "" -"此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參考 :" -"func:`sys.getrecursionlimit`)時會引發此例外。" +"此例外衍生自 :exc:`RuntimeError`。當一個操作在直譯器關閉(也稱作 :term:" +"`Python 最終化 (Python finalization) <interpreter shutdown>`)期間被阻塞會引" +"發此例外。" #: ../../library/exceptions.rst:425 msgid "" "Examples of operations which can be blocked with a :exc:" "`PythonFinalizationError` during the Python finalization:" msgstr "" +"在 Python 最終化期間,能夠以 :exc:`PythonFinalizationError` 被阻塞的操作範" +"例:" #: ../../library/exceptions.rst:428 msgid "Creating a new Python thread." -msgstr "" +msgstr "建立新的 Python 執行緒。" #: ../../library/exceptions.rst:429 msgid ":func:`os.fork`." @@ -649,7 +650,7 @@ msgstr ":func:`os.fork`。" #: ../../library/exceptions.rst:431 msgid "See also the :func:`sys.is_finalizing` function." -msgstr "" +msgstr "也可以參閱 :func:`sys.is_finalizing` 函式。" #: ../../library/exceptions.rst:433 ../../library/exceptions.rst:443 msgid "Previously, a plain :exc:`RuntimeError` was raised." @@ -878,7 +879,7 @@ msgstr "" "可以正確地向上傳遞並導致直譯器結束。當它未被處理時,Python 直譯器會結束;不會" "印出堆疊回溯。建構函式接受跟傳入 :func:`sys.exit` 一樣的可選引數。如果該值是" "整數,它會指定系統的結束狀態(傳入 C 的 :c:func:`exit` 函式 );如果它是 " -"``None``,結束狀態會是 0;如果它是其他類型(例如字串),則物件的值會被印出而" +"``None``,結束狀態會是 0;如果它是其他型別(例如字串),則物件的值會被印出而" "結束狀態是 1。" #: ../../library/exceptions.rst:587 @@ -907,8 +908,8 @@ msgid "" "inappropriate type. The associated value is a string giving details about " "the type mismatch." msgstr "" -"當一個操作或函式被用在不適合的類型的物件時會引發此例外。關聯值是一個字串,提" -"供關於不相符類型的細節。" +"當一個操作或函式被用在不適合的型別的物件時會引發此例外。關聯值是一個字串,提" +"供關於不相符型別的細節。" #: ../../library/exceptions.rst:605 msgid "" @@ -928,7 +929,7 @@ msgid "" "arguments with the wrong value (e.g. a number outside expected boundaries) " "should result in a :exc:`ValueError`." msgstr "" -"傳入錯誤類型的引數(例如當預期傳入 :class:`int` 卻傳入 :class:`list`)應該要" +"傳入錯誤型別的引數(例如當預期傳入 :class:`int` 卻傳入 :class:`list`)應該要" "導致 :exc:`TypeError`,但傳入帶有錯誤值的引數(例如超出預期範圍的數值)應該要" "導致 :exc:`ValueError`。" @@ -1008,7 +1009,7 @@ msgid "" "type but an inappropriate value, and the situation is not described by a " "more precise exception such as :exc:`IndexError`." msgstr "" -"當一個操作或函式收到引數是正確類型但是不適合的值,且該情況無法被更精確的例外" +"當一個操作或函式收到引數是正確型別但是不適合的值,且該情況無法被更精確的例外" "例如 :exc:`IndexError` 所描述時會引發此例外。" #: ../../library/exceptions.rst:679 @@ -1337,7 +1338,7 @@ msgid "" "based on the types of the contained exceptions." msgstr "" "當需要引發多個不相關例外時會使用下列的類別。它們是例外階層的一部分所以可以像" -"所有其他例外一樣使用 :keyword:`except` 來處理。此外,它們會以包含的例外類型為" +"所有其他例外一樣使用 :keyword:`except` 來處理。此外,它們會以包含的例外型別為" "基礎來比對其子群組而被 :keyword:`except*<except_star>` 辨認出來。" #: ../../library/exceptions.rst:932 @@ -1350,7 +1351,7 @@ msgid "" "is so that ``except Exception`` catches an :exc:`ExceptionGroup` but not :" "exc:`BaseExceptionGroup`." msgstr "" -"這兩個例外類型都將例外包裝在序列 ``excs`` 中。``msg`` 參數必須是字串。這兩個" +"這兩個例外型別都將例外包裝在序列 ``excs`` 中。``msg`` 參數必須是字串。這兩個" "類別的差異是 :exc:`BaseExceptionGroup` 擴充了 :exc:`BaseException` 且可以包裝" "任何例外,而 :exc:`ExceptionGroup` 擴充了 :exc:`Exception` 且只能包裝 :exc:" "`Exception` 的子類別。這個設計使得 ``except Exception`` 可以捕捉 :exc:" @@ -1395,6 +1396,10 @@ msgid "" "type object) that accepts an exception as its single argument and returns " "true for the exceptions that should be in the subgroup." msgstr "" +"條件式可以是一個例外型別或是例外型別的元組,在此情況下,每個例外都會使用與 " +"``except`` 子句中使用的相同檢查方法來檢查是否有匹配。條件式也可以是一個可呼叫" +"物件(除了型別物件之外),其接受一個例外作為單一引數,而如果該例外應該在子群" +"組中就回傳 true。" #: ../../library/exceptions.rst:967 msgid "" @@ -1420,7 +1425,7 @@ msgstr "" #: ../../library/exceptions.rst:978 msgid "``condition`` can be any callable which is not a type object." -msgstr "" +msgstr "``condition`` 可以是任何不是型別物件的可呼叫物件。" #: ../../library/exceptions.rst:983 msgid "" @@ -1565,7 +1570,6 @@ msgid "The class hierarchy for built-in exceptions is:" msgstr "內建例外的類別階層如下:" #: ../../library/exceptions.rst:1058 -#, fuzzy msgid "" "BaseException\n" " ├── BaseExceptionGroup\n" @@ -1678,6 +1682,7 @@ msgstr "" " ├── ReferenceError\n" " ├── RuntimeError\n" " │ ├── NotImplementedError\n" +" │ ├── PythonFinalizationError\n" " │ └── RecursionError\n" " ├── StopAsyncIteration\n" " ├── StopIteration\n" @@ -1752,13 +1757,3 @@ msgstr "module(模組)" #: ../../library/exceptions.rst:345 msgid "errno" msgstr "errno" - -#~ msgid "" -#~ "The condition can be either a function that accepts an exception and " -#~ "returns true for those that should be in the subgroup, or it can be an " -#~ "exception type or a tuple of exception types, which is used to check for " -#~ "a match using the same check that is used in an ``except`` clause." -#~ msgstr "" -#~ "條件可以是一個函式,接受一個例外並對那些應該要在子群組裡的例外回傳 true," -#~ "或者可以是一個例外類型或例外類型的元組,並使用與 ``except`` 子句所使用的相" -#~ "同檢查來檢查是否有比對到。" From 059c1ddf83b7a7599e2e415dd6b6918e80c30025 Mon Sep 17 00:00:00 2001 From: mindihx <ymhuang.ymh@gmail.com> Date: Mon, 23 Dec 2024 16:27:53 +0800 Subject: [PATCH 62/89] Translate library/http.cookies --- library/http.cookies.po | 132 ++++++++++++++++++++++++++++++++++------ 1 file changed, 115 insertions(+), 17 deletions(-) diff --git a/library/http.cookies.po b/library/http.cookies.po index 283f303aa9..7c170d45c2 100644 --- a/library/http.cookies.po +++ b/library/http.cookies.po @@ -32,6 +32,8 @@ msgid "" "string-only cookies, and provides an abstraction for having any serializable " "data-type as cookie value." msgstr "" +":mod:`http.cookies` 模組定義了抽象 HTTP 狀態管理機制 (state management " +"mechanism) 的類別,它支援簡單的字串僅有的 cookie,並為 cookie 值提供了抽象。" #: ../../library/http.cookies.rst:19 msgid "" @@ -42,6 +44,9 @@ msgid "" "comes to cookie handling. As a result, this module now uses parsing rules " "that are a bit less strict than they once were." msgstr "" +"此模組原先絕對遵循了 :rfc:`2109` 和 :rfc:`2068` 規範所描述的解析規則。後來發" +"現 MSIE 3.0x 並不遵循這些規範所描述的字元規則,許多當前的瀏覽器和伺服器也在處" +"理 cookie 時有放逐解析規則。因此,此模組現在使用的解析規則比它之前更輕鬆。" #: ../../library/http.cookies.rst:26 msgid "" @@ -49,10 +54,12 @@ msgid "" "``!#$%&'*+-.^_`|~:`` denote the set of valid characters allowed by this " "module in a cookie name (as :attr:`~Morsel.key`)." msgstr "" +"此模組在 cookie 名稱(:attr:`~Morsel.key`)中允許的有效字元為 :data:`string." +"ascii_letters`、:data:`string.digits` 和 ``!#$%&'*+-.^_`|~``。" #: ../../library/http.cookies.rst:30 msgid "Allowed ':' as a valid cookie name character." -msgstr "" +msgstr "允許 ':' 作為有效的 cookie 名稱字元。" #: ../../library/http.cookies.rst:36 msgid "" @@ -60,12 +67,16 @@ msgid "" "cookie data comes from a browser you should always prepare for invalid data " "and catch :exc:`CookieError` on parsing." msgstr "" +"當遇到無效的 cookie 時,將引發 :exc:`CookieError`,因此如果你的 cookie 資料來" +"自瀏覽器,你應該總是準備面臨無效的資料並捕捉 :exc:`CookieError`。" #: ../../library/http.cookies.rst:43 msgid "" "Exception failing because of :rfc:`2109` invalidity: incorrect attributes, " "incorrect :mailheader:`Set-Cookie` header, etc." msgstr "" +"因為 :rfc:`2109` 無效而引發的例外:不正確的屬性、不正確的 :mailheader:`Set-" +"Cookie` 標頭等。" #: ../../library/http.cookies.rst:49 msgid "" @@ -74,10 +85,12 @@ msgid "" "value, the value is first converted to a :class:`Morsel` containing the key " "and the value." msgstr "" +"這個類別是一個字典式物件,其中的鍵是字串,而值則是 :class:`Morsel` 物件。請注" +"意,當設定鍵時,值會先被轉換為一個包含鍵和值的 :class:`Morsel`。" #: ../../library/http.cookies.rst:53 msgid "If *input* is given, it is passed to the :meth:`load` method." -msgstr "" +msgstr "如果 *input* 被提供,它會被傳遞給 :meth:`load` 方法。" #: ../../library/http.cookies.rst:58 msgid "" @@ -87,6 +100,10 @@ msgid "" "SimpleCookie` calls the builtin :func:`str` to convert the value to a " "string. Values received from HTTP are kept as strings." msgstr "" +"這個類別繼承自 :class:`BaseCookie` 並覆寫了 :meth:`~BaseCookie.value_decode` " +"和 :meth:`~BaseCookie.value_encode`。:class:`!SimpleCookie` 支援字串作為 " +"cookie 值。當設定值時,:class:`!SimpleCookie` 會呼叫內建的 :func:`str` 來將值" +"轉換為字串。從 HTTP 接收的值會保持為字串。" #: ../../library/http.cookies.rst:66 msgid "Module :mod:`http.cookiejar`" @@ -97,14 +114,16 @@ msgid "" "HTTP cookie handling for web *clients*. The :mod:`http.cookiejar` and :mod:" "`http.cookies` modules do not depend on each other." msgstr "" +"用於 *網路客戶端* 的 HTTP cookie 處理。:mod:`http.cookiejar` 和 :mod:`http." +"cookies` 模組不相依。" #: ../../library/http.cookies.rst:70 msgid ":rfc:`2109` - HTTP State Management Mechanism" -msgstr "" +msgstr ":rfc:`2109` - HTTP 狀態管理機制" #: ../../library/http.cookies.rst:71 msgid "This is the state management specification implemented by this module." -msgstr "" +msgstr "這是這個模組實作的狀態管理規範。" #: ../../library/http.cookies.rst:77 msgid "Cookie Objects" @@ -116,6 +135,9 @@ msgid "" "``real_value`` can be any type. This method does no decoding in :class:" "`BaseCookie` --- it exists so it can be overridden." msgstr "" +"從字串表示法回傳 ``(real_value, coded_value)`` 的元組。``real_value`` 可以是" +"任何類型。此方法在 :class:`BaseCookie` 中不會進行解碼 --- 它存在以便可以被覆" +"寫。" #: ../../library/http.cookies.rst:89 msgid "" @@ -123,12 +145,17 @@ msgid "" "``coded_value`` will always be converted to a string. This method does no " "encoding in :class:`BaseCookie` --- it exists so it can be overridden." msgstr "" +"回傳一個元組 ``(real_value, coded_value)``。*val* 可以是任何類型,但 " +"``coded_value`` 會總是轉換為字串。此方法在 :class:`BaseCookie` 中不做編碼 " +"--- 它存在以便可以被覆寫。" #: ../../library/http.cookies.rst:94 msgid "" "In general, it should be the case that :meth:`value_encode` and :meth:" "`value_decode` are inverses on the range of *value_decode*." msgstr "" +"一般來說,:meth:`value_encode` 和 :meth:`value_decode` 應該是在 " +"*value_decode* 的範圍內的逆函式。" #: ../../library/http.cookies.rst:100 msgid "" @@ -137,17 +164,22 @@ msgid "" "method. *sep* is used to join the headers together, and is by default the " "combination ``'\\r\\n'`` (CRLF)." msgstr "" +"回傳一個適合作為 HTTP 標頭的字串表示。*attrs* 和 *header* 會傳送給每個 :" +"class:`Morsel` 的 :meth:`~Morsel.output` 方法。*sep* 用來連結標頭,預設為 " +"``\\\\r\\\\n``(CRLF)。" #: ../../library/http.cookies.rst:108 msgid "" "Return an embeddable JavaScript snippet, which, if run on a browser which " "supports JavaScript, will act the same as if the HTTP headers was sent." msgstr "" +"回傳一個可嵌入的 JavaScript 片段,如果在支援 JavaScript 的瀏覽器上執行,它的" +"行為會與如果 HTTP 標頭被傳送的情況相同。" #: ../../library/http.cookies.rst:111 ../../library/http.cookies.rst:207 #: ../../library/http.cookies.rst:215 msgid "The meaning for *attrs* is the same as in :meth:`output`." -msgstr "" +msgstr "*attrs* 的意義與 :meth:`output` 相同。" #: ../../library/http.cookies.rst:116 msgid "" @@ -155,6 +187,8 @@ msgid "" "found there as :class:`Morsel`\\ s. If it is a dictionary, it is equivalent " "to::" msgstr "" +"如果 *rawdata* 是字串,則將其解析為 ``HTTP_COOKIE``,並將在其中找到的值當作 :" +"class:`Morsel`\\ s 新增。如果它是一個字典,則等同於: ::" #: ../../library/http.cookies.rst:119 msgid "" @@ -170,13 +204,15 @@ msgstr "Morsel 物件" #: ../../library/http.cookies.rst:131 msgid "Abstract a key/value pair, which has some :rfc:`2109` attributes." -msgstr "" +msgstr "抽象一個 key/value 對,它有一些 :rfc:`2109` 屬性。" #: ../../library/http.cookies.rst:133 msgid "" "Morsels are dictionary-like objects, whose set of keys is constant --- the " "valid :rfc:`2109` attributes, which are:" msgstr "" +"Morsels 是一種類似字典的物件,其鍵的集合是固定的 --- 有效的 :rfc:`2109` 屬" +"性,它們是:" #: ../../library/http.cookies.rst:146 msgid "" @@ -184,6 +220,8 @@ msgid "" "in HTTP requests, and is not accessible through JavaScript. This is intended " "to mitigate some forms of cross-site scripting." msgstr "" +"屬性 :attr:`httponly` 指定 cookie 僅在 HTTP 請求中傳輸,而不可通過 " +"JavaScript 存取。這是為了減輕某些形式的跨網站腳本攻擊。" #: ../../library/http.cookies.rst:150 msgid "" @@ -191,22 +229,27 @@ msgid "" "send the cookie along with cross-site requests. This helps to mitigate CSRF " "attacks. Valid values for this attribute are \"Strict\" and \"Lax\"." msgstr "" +"屬性 :attr:`samesite` 指定瀏覽器不能將 Cookie 與跨網站請求一起傳送。這有助於" +"減輕 CSRF 攻擊。此屬性的有效值為 \"Strict\" 和 \"Lax\"。" #: ../../library/http.cookies.rst:154 msgid "The keys are case-insensitive and their default value is ``''``." -msgstr "" +msgstr "鍵的大小寫不敏感,其預設值為 ``''``。" #: ../../library/http.cookies.rst:156 msgid "" ":meth:`!__eq__` now takes :attr:`~Morsel.key` and :attr:`~Morsel.value` into " "account." msgstr "" +":meth:`!__eq__` 現在會考慮 :attr:`~Morsel.key` 和 :attr:`~Morsel.value`。" #: ../../library/http.cookies.rst:160 msgid "" "Attributes :attr:`~Morsel.key`, :attr:`~Morsel.value` and :attr:`~Morsel." "coded_value` are read-only. Use :meth:`~Morsel.set` for setting them." msgstr "" +"屬性 :attr:`~Morsel.key`、:attr:`~Morsel.value` 和 :attr:`~Morsel." +"coded_value` 為只讀。請使用 :meth:`~Morsel.set` 來設定它們。" #: ../../library/http.cookies.rst:165 msgid "Added support for the :attr:`samesite` attribute." @@ -214,23 +257,23 @@ msgstr "新增 :attr:`samesite` 屬性的支援" #: ../../library/http.cookies.rst:171 msgid "The value of the cookie." -msgstr "" +msgstr "cookie 的值。" #: ../../library/http.cookies.rst:176 msgid "The encoded value of the cookie --- this is what should be sent." -msgstr "" +msgstr "cookie 的編碼值 --- 這是應該被傳送的值。" #: ../../library/http.cookies.rst:181 msgid "The name of the cookie." -msgstr "" +msgstr "cookie 的名稱。" #: ../../library/http.cookies.rst:186 msgid "Set the *key*, *value* and *coded_value* attributes." -msgstr "" +msgstr "設定 *key*、*value* 和 *coded_value* 屬性。" #: ../../library/http.cookies.rst:191 msgid "Whether *K* is a member of the set of keys of a :class:`Morsel`." -msgstr "" +msgstr "*K* 是 :class:`Morsel` 的鍵集中的成員嗎?" #: ../../library/http.cookies.rst:196 msgid "" @@ -239,18 +282,23 @@ msgid "" "given, in which case it should be a list of attributes to use. *header* is " "by default ``\"Set-Cookie:\"``." msgstr "" +"回傳 Morsel 的字串表示,適合作為 HTTP 標頭。預設會包含所有屬性,除非 *attrs* " +"被提供,在此情況下,它應該是一個屬性清單,用來選擇要使用的屬性。預設的 " +"*header* 是 ``\"Set-Cookie:\"``。" #: ../../library/http.cookies.rst:204 msgid "" "Return an embeddable JavaScript snippet, which, if run on a browser which " "supports JavaScript, will act the same as if the HTTP header was sent." msgstr "" +"回傳一個可嵌入的 JavaScript 片段,如果在支援 JavaScript 的瀏覽器上執行,它的" +"行為與如果 HTTP 標頭被傳送的情況相同。" #: ../../library/http.cookies.rst:212 msgid "" "Return a string representing the Morsel, without any surrounding HTTP or " "JavaScript." -msgstr "" +msgstr "回傳 Morsel 的字串表示,不包含任何 HTTP 或 JavaScript。" #: ../../library/http.cookies.rst:220 msgid "" @@ -258,24 +306,28 @@ msgid "" "*values*. Raise an error if any of the keys in the *values* dict is not a " "valid :rfc:`2109` attribute." msgstr "" +"更新 Morsel 字典中的值為 *values* 字典中的值。如果 *values* 字典中的任何鍵不" +"是有效的 :rfc:`2109` 屬性,則引發錯誤。" #: ../../library/http.cookies.rst:224 msgid "an error is raised for invalid keys." -msgstr "" +msgstr "對於無效的 key 會引發錯誤。" #: ../../library/http.cookies.rst:230 msgid "Return a shallow copy of the Morsel object." -msgstr "" +msgstr "回傳 Morsel 物件的淺複製。" #: ../../library/http.cookies.rst:232 msgid "return a Morsel object instead of a dict." -msgstr "" +msgstr "回傳 Morsel 物件而不是 dict。" #: ../../library/http.cookies.rst:238 msgid "" "Raise an error if key is not a valid :rfc:`2109` attribute, otherwise behave " "the same as :meth:`dict.setdefault`." msgstr "" +"如果 key 不是一個有效的 :rfc:`2109` 屬性,則引發錯誤,否則行為與 :meth:`dict." +"setdefault` 相同。" #: ../../library/http.cookies.rst:245 msgid "Example" @@ -284,7 +336,7 @@ msgstr "範例" #: ../../library/http.cookies.rst:247 msgid "" "The following example demonstrates how to use the :mod:`http.cookies` module." -msgstr "" +msgstr "以下範例示範如何使用 :mod:`http.cookies` 模組。" #: ../../library/http.cookies.rst:249 msgid "" @@ -335,3 +387,49 @@ msgid "" "Set-Cookie: number=7\n" "Set-Cookie: string=seven" msgstr "" +">>> from http import cookies\n" +">>> C = cookies.SimpleCookie()\n" +">>> C[\"fig\"] = \"newton\"\n" +">>> C[\"sugar\"] = \"wafer\"\n" +">>> print(C) # generate HTTP headers\n" +"Set-Cookie: fig=newton\n" +"Set-Cookie: sugar=wafer\n" +">>> print(C.output()) # same thing\n" +"Set-Cookie: fig=newton\n" +"Set-Cookie: sugar=wafer\n" +">>> C = cookies.SimpleCookie()\n" +">>> C[\"rocky\"] = \"road\"\n" +">>> C[\"rocky\"][\"path\"] = \"/cookie\"\n" +">>> print(C.output(header=\"Cookie:\"))\n" +"Cookie: rocky=road; Path=/cookie\n" +">>> print(C.output(attrs=[], header=\"Cookie:\"))\n" +"Cookie: rocky=road\n" +">>> C = cookies.SimpleCookie()\n" +">>> C.load(\"chips=ahoy; vienna=finger\") # load from a string (HTTP " +"header)\n" +">>> print(C)\n" +"Set-Cookie: chips=ahoy\n" +"Set-Cookie: vienna=finger\n" +">>> C = cookies.SimpleCookie()\n" +">>> C.load('keebler=\"E=everybody; L=\\\\\"Loves\\\\\"; fudge=\\\\012;\";')\n" +">>> print(C)\n" +"Set-Cookie: keebler=\"E=everybody; L=\\\"Loves\\\"; fudge=\\012;\"\n" +">>> C = cookies.SimpleCookie()\n" +">>> C[\"oreo\"] = \"doublestuff\"\n" +">>> C[\"oreo\"][\"path\"] = \"/\"\n" +">>> print(C)\n" +"Set-Cookie: oreo=doublestuff; Path=/\n" +">>> C = cookies.SimpleCookie()\n" +">>> C[\"twix\"] = \"none for you\"\n" +">>> C[\"twix\"].value\n" +"'none for you'\n" +">>> C = cookies.SimpleCookie()\n" +">>> C[\"number\"] = 7 # equivalent to C[\"number\"] = str(7)\n" +">>> C[\"string\"] = \"seven\"\n" +">>> C[\"number\"].value\n" +"'7'\n" +">>> C[\"string\"].value\n" +"'seven'\n" +">>> print(C)\n" +"Set-Cookie: number=7\n" +"Set-Cookie: string=seven" From e5cecf11329b939cc5fdfe5e0923d4637c2f916b Mon Sep 17 00:00:00 2001 From: mindihx <ymhuang.ymh@gmail.com> Date: Tue, 24 Dec 2024 15:46:13 +0800 Subject: [PATCH 63/89] Update translation for library/http.cookies --- library/http.cookies.po | 96 ++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/library/http.cookies.po b/library/http.cookies.po index 7c170d45c2..a7daf65b2c 100644 --- a/library/http.cookies.po +++ b/library/http.cookies.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-12-14 00:14+0000\n" -"PO-Revision-Date: 2016-11-19 00:31+0000\n" +"PO-Revision-Date: 2024-12-24 18:31+0800\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -32,8 +32,9 @@ msgid "" "string-only cookies, and provides an abstraction for having any serializable " "data-type as cookie value." msgstr "" -":mod:`http.cookies` 模組定義了抽象 HTTP 狀態管理機制 (state management " -"mechanism) 的類別,它支援簡單的字串僅有的 cookie,並為 cookie 值提供了抽象。" +":mod:`http.cookies` 模組定義了 cookie 概念的抽象化的類別,cookie 是一種 HTTP " +"狀態管理機制。它支援簡單的純字串 cookie,也提供了將任何可序列化的資料型別作" +"為 cookie 值的抽象化。" #: ../../library/http.cookies.rst:19 msgid "" @@ -44,9 +45,9 @@ msgid "" "comes to cookie handling. As a result, this module now uses parsing rules " "that are a bit less strict than they once were." msgstr "" -"此模組原先絕對遵循了 :rfc:`2109` 和 :rfc:`2068` 規範所描述的解析規則。後來發" +"此模組原先嚴格遵循了 :rfc:`2109` 和 :rfc:`2068` 規範所描述的剖析規則。自從發" "現 MSIE 3.0x 並不遵循這些規範所描述的字元規則,許多當前的瀏覽器和伺服器也在處" -"理 cookie 時有放逐解析規則。因此,此模組現在使用的解析規則比它之前更輕鬆。" +"理 cookie 時放寬了剖析規則。因此,此模組現在使用的剖析規則比之前的更為寬鬆。" #: ../../library/http.cookies.rst:26 msgid "" @@ -54,8 +55,8 @@ msgid "" "``!#$%&'*+-.^_`|~:`` denote the set of valid characters allowed by this " "module in a cookie name (as :attr:`~Morsel.key`)." msgstr "" -"此模組在 cookie 名稱(:attr:`~Morsel.key`)中允許的有效字元為 :data:`string." -"ascii_letters`、:data:`string.digits` 和 ``!#$%&'*+-.^_`|~``。" +"字元集 :data:`string.ascii_letters`、:data:`string.digits` 和 ``!#$%&'*+-." +"^_`|~`` 表示此模組在 cookie 名稱 (:attr:`~Morsel.key`) 中允許的合法字元集合。" #: ../../library/http.cookies.rst:30 msgid "Allowed ':' as a valid cookie name character." @@ -67,15 +68,15 @@ msgid "" "cookie data comes from a browser you should always prepare for invalid data " "and catch :exc:`CookieError` on parsing." msgstr "" -"當遇到無效的 cookie 時,將引發 :exc:`CookieError`,因此如果你的 cookie 資料來" -"自瀏覽器,你應該總是準備面臨無效的資料並捕捉 :exc:`CookieError`。" +"當遇到無效的 cookie 時,會引發 :exc:`CookieError`,因此如果你的 cookie 資料來" +"自瀏覽器,在剖析時你應該總是為無效資料作準備並捕捉 :exc:`CookieError`。" #: ../../library/http.cookies.rst:43 msgid "" "Exception failing because of :rfc:`2109` invalidity: incorrect attributes, " "incorrect :mailheader:`Set-Cookie` header, etc." msgstr "" -"因為 :rfc:`2109` 無效而引發的例外:不正確的屬性、不正確的 :mailheader:`Set-" +"因為不符合 :rfc:`2109` 而引發的例外:不正確的屬性、不正確的 :mailheader:`Set-" "Cookie` 標頭等。" #: ../../library/http.cookies.rst:49 @@ -85,12 +86,12 @@ msgid "" "value, the value is first converted to a :class:`Morsel` containing the key " "and the value." msgstr "" -"這個類別是一個字典式物件,其中的鍵是字串,而值則是 :class:`Morsel` 物件。請注" -"意,當設定鍵時,值會先被轉換為一個包含鍵和值的 :class:`Morsel`。" +"這個類別是一個類似字典的物件,其中的鍵是字串,而值則是 :class:`Morsel` 實例。" +"請注意,當設定鍵的值時,值會先被轉換為一個包含該鍵和值的 :class:`Morsel`。" #: ../../library/http.cookies.rst:53 msgid "If *input* is given, it is passed to the :meth:`load` method." -msgstr "如果 *input* 被提供,它會被傳遞給 :meth:`load` 方法。" +msgstr "如果有給定 *input*,它會被傳遞給 :meth:`load` 方法。" #: ../../library/http.cookies.rst:58 msgid "" @@ -114,8 +115,8 @@ msgid "" "HTTP cookie handling for web *clients*. The :mod:`http.cookiejar` and :mod:" "`http.cookies` modules do not depend on each other." msgstr "" -"用於 *網路客戶端* 的 HTTP cookie 處理。:mod:`http.cookiejar` 和 :mod:`http." -"cookies` 模組不相依。" +"用於網路\\ *用戶端*\\ 的 HTTP cookie 處理。:mod:`http.cookiejar` 和 :mod:" +"`http.cookies` 模組互不相依。" #: ../../library/http.cookies.rst:70 msgid ":rfc:`2109` - HTTP State Management Mechanism" @@ -123,7 +124,7 @@ msgstr ":rfc:`2109` - HTTP 狀態管理機制" #: ../../library/http.cookies.rst:71 msgid "This is the state management specification implemented by this module." -msgstr "這是這個模組實作的狀態管理規範。" +msgstr "這是此模組實作的狀態管理規範。" #: ../../library/http.cookies.rst:77 msgid "Cookie Objects" @@ -135,9 +136,8 @@ msgid "" "``real_value`` can be any type. This method does no decoding in :class:" "`BaseCookie` --- it exists so it can be overridden." msgstr "" -"從字串表示法回傳 ``(real_value, coded_value)`` 的元組。``real_value`` 可以是" -"任何類型。此方法在 :class:`BaseCookie` 中不會進行解碼 --- 它存在以便可以被覆" -"寫。" +"從字串表示回傳 ``(real_value, coded_value)`` 的元組。``real_value`` 可以是任" +"何型別。此方法在 :class:`BaseCookie` 中不做解碼 --- 它存在以便可以被覆寫。" #: ../../library/http.cookies.rst:89 msgid "" @@ -145,8 +145,8 @@ msgid "" "``coded_value`` will always be converted to a string. This method does no " "encoding in :class:`BaseCookie` --- it exists so it can be overridden." msgstr "" -"回傳一個元組 ``(real_value, coded_value)``。*val* 可以是任何類型,但 " -"``coded_value`` 會總是轉換為字串。此方法在 :class:`BaseCookie` 中不做編碼 " +"回傳一個元組 ``(real_value, coded_value)``。*val* 可以是任何型別,但 " +"``coded_value`` 總是會被轉換為字串。此方法在 :class:`BaseCookie` 中不做編碼 " "--- 它存在以便可以被覆寫。" #: ../../library/http.cookies.rst:94 @@ -154,8 +154,8 @@ msgid "" "In general, it should be the case that :meth:`value_encode` and :meth:" "`value_decode` are inverses on the range of *value_decode*." msgstr "" -"一般來說,:meth:`value_encode` 和 :meth:`value_decode` 應該是在 " -"*value_decode* 的範圍內的逆函式。" +"一般來說,:meth:`value_encode` 和 :meth:`value_decode` 應該在 *value_decode* " +"的範圍內是互逆的 (inverse)。" #: ../../library/http.cookies.rst:100 msgid "" @@ -164,9 +164,9 @@ msgid "" "method. *sep* is used to join the headers together, and is by default the " "combination ``'\\r\\n'`` (CRLF)." msgstr "" -"回傳一個適合作為 HTTP 標頭的字串表示。*attrs* 和 *header* 會傳送給每個 :" -"class:`Morsel` 的 :meth:`~Morsel.output` 方法。*sep* 用來連結標頭,預設為 " -"``\\\\r\\\\n``(CRLF)。" +"回傳一個適合作為 HTTP 標頭來傳送的字串表示。*attrs* 和 *header* 會傳送給每" +"個 :class:`Morsel` 的 :meth:`~Morsel.output` 方法。*sep* 用來連接標頭,預設" +"為 ``'\\r\\n'`` (CRLF) 的組合。" #: ../../library/http.cookies.rst:108 msgid "" @@ -174,12 +174,12 @@ msgid "" "supports JavaScript, will act the same as if the HTTP headers was sent." msgstr "" "回傳一個可嵌入的 JavaScript 片段,如果在支援 JavaScript 的瀏覽器上執行,它的" -"行為會與如果 HTTP 標頭被傳送的情況相同。" +"行為會與 HTTP 標頭被傳送的情況相同。" #: ../../library/http.cookies.rst:111 ../../library/http.cookies.rst:207 #: ../../library/http.cookies.rst:215 msgid "The meaning for *attrs* is the same as in :meth:`output`." -msgstr "*attrs* 的意義與 :meth:`output` 相同。" +msgstr "*attrs* 的意義與 :meth:`output` 裡的相同。" #: ../../library/http.cookies.rst:116 msgid "" @@ -187,8 +187,8 @@ msgid "" "found there as :class:`Morsel`\\ s. If it is a dictionary, it is equivalent " "to::" msgstr "" -"如果 *rawdata* 是字串,則將其解析為 ``HTTP_COOKIE``,並將在其中找到的值當作 :" -"class:`Morsel`\\ s 新增。如果它是一個字典,則等同於: ::" +"如果 *rawdata* 是字串,會將其作為 ``HTTP_COOKIE`` 剖析,並將在其中找到的值當" +"作 :class:`Morsel` 新增。如果它是一個字典,則等同於: ::" #: ../../library/http.cookies.rst:119 msgid "" @@ -204,15 +204,15 @@ msgstr "Morsel 物件" #: ../../library/http.cookies.rst:131 msgid "Abstract a key/value pair, which has some :rfc:`2109` attributes." -msgstr "抽象一個 key/value 對,它有一些 :rfc:`2109` 屬性。" +msgstr "抽象化一個鍵 / 值對,它有一些 :rfc:`2109` 屬性。" #: ../../library/http.cookies.rst:133 msgid "" "Morsels are dictionary-like objects, whose set of keys is constant --- the " "valid :rfc:`2109` attributes, which are:" msgstr "" -"Morsels 是一種類似字典的物件,其鍵的集合是固定的 --- 有效的 :rfc:`2109` 屬" -"性,它們是:" +"Morsel 是一種類似字典的物件,其鍵的集合是固定的 --- 有效的 :rfc:`2109` 屬性," +"它們是:" #: ../../library/http.cookies.rst:146 msgid "" @@ -229,12 +229,12 @@ msgid "" "send the cookie along with cross-site requests. This helps to mitigate CSRF " "attacks. Valid values for this attribute are \"Strict\" and \"Lax\"." msgstr "" -"屬性 :attr:`samesite` 指定瀏覽器不能將 Cookie 與跨網站請求一起傳送。這有助於" +"屬性 :attr:`samesite` 指定瀏覽器不能將 cookie 與跨網站請求一起傳送。這有助於" "減輕 CSRF 攻擊。此屬性的有效值為 \"Strict\" 和 \"Lax\"。" #: ../../library/http.cookies.rst:154 msgid "The keys are case-insensitive and their default value is ``''``." -msgstr "鍵的大小寫不敏感,其預設值為 ``''``。" +msgstr "鍵不區分大小寫,其預設值為 ``''``。" #: ../../library/http.cookies.rst:156 msgid "" @@ -249,11 +249,11 @@ msgid "" "coded_value` are read-only. Use :meth:`~Morsel.set` for setting them." msgstr "" "屬性 :attr:`~Morsel.key`、:attr:`~Morsel.value` 和 :attr:`~Morsel." -"coded_value` 為只讀。請使用 :meth:`~Morsel.set` 來設定它們。" +"coded_value` 是唯讀的。請使用 :meth:`~Morsel.set` 來設定它們。" #: ../../library/http.cookies.rst:165 msgid "Added support for the :attr:`samesite` attribute." -msgstr "新增 :attr:`samesite` 屬性的支援" +msgstr "新增對 :attr:`samesite` 屬性的支援。" #: ../../library/http.cookies.rst:171 msgid "The value of the cookie." @@ -273,7 +273,7 @@ msgstr "設定 *key*、*value* 和 *coded_value* 屬性。" #: ../../library/http.cookies.rst:191 msgid "Whether *K* is a member of the set of keys of a :class:`Morsel`." -msgstr "*K* 是 :class:`Morsel` 的鍵集中的成員嗎?" +msgstr "*K* 是否為 :class:`Morsel` 的鍵集合中的成員。" #: ../../library/http.cookies.rst:196 msgid "" @@ -282,9 +282,9 @@ msgid "" "given, in which case it should be a list of attributes to use. *header* is " "by default ``\"Set-Cookie:\"``." msgstr "" -"回傳 Morsel 的字串表示,適合作為 HTTP 標頭。預設會包含所有屬性,除非 *attrs* " -"被提供,在此情況下,它應該是一個屬性清單,用來選擇要使用的屬性。預設的 " -"*header* 是 ``\"Set-Cookie:\"``。" +"回傳適合作為 HTTP 標頭傳送的 Morsel 的字串表示。預設會包含所有屬性,除非有給" +"定 *attrs*,在此情況下,它應該是一個要使用的屬性的串列。預設的 *header* 是 " +"``\"Set-Cookie:\"``。" #: ../../library/http.cookies.rst:204 msgid "" @@ -292,13 +292,13 @@ msgid "" "supports JavaScript, will act the same as if the HTTP header was sent." msgstr "" "回傳一個可嵌入的 JavaScript 片段,如果在支援 JavaScript 的瀏覽器上執行,它的" -"行為與如果 HTTP 標頭被傳送的情況相同。" +"行為會與 HTTP 標頭被傳送的情況相同。" #: ../../library/http.cookies.rst:212 msgid "" "Return a string representing the Morsel, without any surrounding HTTP or " "JavaScript." -msgstr "回傳 Morsel 的字串表示,不包含任何 HTTP 或 JavaScript。" +msgstr "回傳表示 Morsel 的字串,不包含周圍任何的 HTTP 或 JavaScript。" #: ../../library/http.cookies.rst:220 msgid "" @@ -307,26 +307,26 @@ msgid "" "valid :rfc:`2109` attribute." msgstr "" "更新 Morsel 字典中的值為 *values* 字典中的值。如果 *values* 字典中的任何鍵不" -"是有效的 :rfc:`2109` 屬性,則引發錯誤。" +"是有效的 :rfc:`2109` 屬性則引發錯誤。" #: ../../library/http.cookies.rst:224 msgid "an error is raised for invalid keys." -msgstr "對於無效的 key 會引發錯誤。" +msgstr "對於無效的鍵會引發錯誤。" #: ../../library/http.cookies.rst:230 msgid "Return a shallow copy of the Morsel object." -msgstr "回傳 Morsel 物件的淺複製。" +msgstr "回傳 Morsel 物件的淺層複製。" #: ../../library/http.cookies.rst:232 msgid "return a Morsel object instead of a dict." -msgstr "回傳 Morsel 物件而不是 dict。" +msgstr "回傳 Morsel 物件而不是字典。" #: ../../library/http.cookies.rst:238 msgid "" "Raise an error if key is not a valid :rfc:`2109` attribute, otherwise behave " "the same as :meth:`dict.setdefault`." msgstr "" -"如果 key 不是一個有效的 :rfc:`2109` 屬性,則引發錯誤,否則行為與 :meth:`dict." +"如果鍵不是一個有效的 :rfc:`2109` 屬性會引發錯誤,否則行為與 :meth:`dict." "setdefault` 相同。" #: ../../library/http.cookies.rst:245 From 43ad743231223c2872a8f341472e4476e83a4ab2 Mon Sep 17 00:00:00 2001 From: mindihx <ymhuang.ymh@gmail.com> Date: Tue, 24 Dec 2024 18:50:34 +0800 Subject: [PATCH 64/89] Update translation in code comment for library/http.cookies --- library/http.cookies.po | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/library/http.cookies.po b/library/http.cookies.po index a7daf65b2c..ef5a4f6381 100644 --- a/library/http.cookies.po +++ b/library/http.cookies.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-12-14 00:14+0000\n" -"PO-Revision-Date: 2024-12-24 18:31+0800\n" +"PO-Revision-Date: 2024-12-24 18:49+0800\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -391,10 +391,10 @@ msgstr "" ">>> C = cookies.SimpleCookie()\n" ">>> C[\"fig\"] = \"newton\"\n" ">>> C[\"sugar\"] = \"wafer\"\n" -">>> print(C) # generate HTTP headers\n" +">>> print(C) # 產生 HTTP 標頭\n" "Set-Cookie: fig=newton\n" "Set-Cookie: sugar=wafer\n" -">>> print(C.output()) # same thing\n" +">>> print(C.output()) # 同上\n" "Set-Cookie: fig=newton\n" "Set-Cookie: sugar=wafer\n" ">>> C = cookies.SimpleCookie()\n" @@ -405,8 +405,7 @@ msgstr "" ">>> print(C.output(attrs=[], header=\"Cookie:\"))\n" "Cookie: rocky=road\n" ">>> C = cookies.SimpleCookie()\n" -">>> C.load(\"chips=ahoy; vienna=finger\") # load from a string (HTTP " -"header)\n" +">>> C.load(\"chips=ahoy; vienna=finger\") # 從字串(HTTP 標頭)載入\n" ">>> print(C)\n" "Set-Cookie: chips=ahoy\n" "Set-Cookie: vienna=finger\n" @@ -424,7 +423,7 @@ msgstr "" ">>> C[\"twix\"].value\n" "'none for you'\n" ">>> C = cookies.SimpleCookie()\n" -">>> C[\"number\"] = 7 # equivalent to C[\"number\"] = str(7)\n" +">>> C[\"number\"] = 7 # 等同於 C[\"number\"] = str(7)\n" ">>> C[\"string\"] = \"seven\"\n" ">>> C[\"number\"].value\n" "'7'\n" From f3042a1d39c8de168eb5805d7941a69cbaa09409 Mon Sep 17 00:00:00 2001 From: "pydoc-zh-tw[bot]" <90344106+pydoc-zh-tw[bot]@users.noreply.github.com> Date: Mon, 30 Dec 2024 00:04:07 +0800 Subject: [PATCH 65/89] Sync with CPython 3.13 (#1008) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: W. H. Wang <mattwang44@gmail.com> --- c-api/object.po | 181 ++-- faq/library.po | 2 +- faq/programming.po | 11 +- howto/argparse-optparse.po | 122 ++- howto/argparse.po | 315 +++---- howto/free-threading-python.po | 23 +- howto/functional.po | 42 +- howto/perf_profiling.po | 2 +- howto/sorting.po | 2 +- library/_thread.po | 2 +- library/argparse.po | 865 ++++++++++--------- library/asyncio-eventloop.po | 4 +- library/cmdlinelibs.po | 32 + library/csv.po | 2 +- library/enum.po | 423 +++++----- library/filesys.po | 17 +- library/getopt.po | 144 +++- library/io.po | 2 +- library/itertools.po | 513 ++++++----- library/json.po | 2 +- library/optparse.po | 1455 ++++++++++++++++++++------------ library/os.path.po | 4 +- library/pickle.po | 76 +- library/random.po | 2 +- library/ssl.po | 11 +- library/superseded.po | 34 +- library/timeit.po | 2 +- library/tty.po | 4 +- library/unittest.po | 81 +- reference/compound_stmts.po | 810 +++++++++--------- tutorial/index.po | 2 +- whatsnew/3.10.po | 4 +- whatsnew/3.12.po | 108 ++- whatsnew/3.13.po | 950 +++++++++++---------- whatsnew/3.4.po | 2 +- whatsnew/3.5.po | 2 +- whatsnew/3.6.po | 2 +- whatsnew/3.7.po | 2 +- whatsnew/3.9.po | 2 +- 39 files changed, 3548 insertions(+), 2711 deletions(-) create mode 100644 library/cmdlinelibs.po diff --git a/c-api/object.po b/c-api/object.po index 5898ca290c..a2be5438c2 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-14 00:14+0000\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,15 +36,15 @@ msgstr "" #: ../../c-api/object.rst:20 msgid "Constant Identifier" -msgstr "" +msgstr "常數識別字" #: ../../c-api/object.rst:20 msgid "Value" -msgstr "" +msgstr "數值" #: ../../c-api/object.rst:20 msgid "Returned object" -msgstr "" +msgstr "回傳物件" #: ../../c-api/object.rst:22 ../../c-api/object.rst:27 msgid "``0``" @@ -126,7 +126,7 @@ msgstr "" #: ../../c-api/object.rst:42 msgid "In CPython, all of these constants are :term:`immortal`." -msgstr "" +msgstr "在 CPython 中,所有這些常數都是\\ :term:`不滅 <immortal>`\\ 的。" #: ../../c-api/object.rst:47 msgid "" @@ -196,19 +196,20 @@ msgstr "" #: ../../c-api/object.rst:113 msgid "" "Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" -"`~object.__getattribute__` methods are silently ignored. For proper error " -"handling, use :c:func:`PyObject_HasAttrWithError`, :c:func:" -"`PyObject_GetOptionalAttr` or :c:func:`PyObject_GetAttr` instead." +"`~object.__getattribute__` methods aren't propagated, but instead given to :" +"func:`sys.unraisablehook`. For proper error handling, use :c:func:" +"`PyObject_HasAttrWithError`, :c:func:`PyObject_GetOptionalAttr` or :c:func:" +"`PyObject_GetAttr` instead." msgstr "" -#: ../../c-api/object.rst:121 +#: ../../c-api/object.rst:122 msgid "" "This is the same as :c:func:`PyObject_HasAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/object.rst:127 +#: ../../c-api/object.rst:128 msgid "" "Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" "`~object.__getattribute__` methods or while creating the temporary :class:" @@ -217,39 +218,39 @@ msgid "" "or :c:func:`PyObject_GetAttrString` instead." msgstr "" -#: ../../c-api/object.rst:137 +#: ../../c-api/object.rst:138 msgid "" "Retrieve an attribute named *attr_name* from object *o*. Returns the " "attribute value on success, or ``NULL`` on failure. This is the equivalent " "of the Python expression ``o.attr_name``." msgstr "" -#: ../../c-api/object.rst:141 +#: ../../c-api/object.rst:142 msgid "" "If the missing attribute should not be treated as a failure, you can use :c:" "func:`PyObject_GetOptionalAttr` instead." msgstr "" -#: ../../c-api/object.rst:147 +#: ../../c-api/object.rst:148 msgid "" "This is the same as :c:func:`PyObject_GetAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/object.rst:151 +#: ../../c-api/object.rst:152 msgid "" "If the missing attribute should not be treated as a failure, you can use :c:" "func:`PyObject_GetOptionalAttrString` instead." msgstr "" -#: ../../c-api/object.rst:157 +#: ../../c-api/object.rst:158 msgid "" "Variant of :c:func:`PyObject_GetAttr` which doesn't raise :exc:" "`AttributeError` if the attribute is not found." msgstr "" -#: ../../c-api/object.rst:160 +#: ../../c-api/object.rst:161 msgid "" "If the attribute is found, return ``1`` and set *\\*result* to a new :term:" "`strong reference` to the attribute. If the attribute is not found, return " @@ -258,14 +259,14 @@ msgid "" "``-1`` and set *\\*result* to ``NULL``." msgstr "" -#: ../../c-api/object.rst:172 +#: ../../c-api/object.rst:173 msgid "" "This is the same as :c:func:`PyObject_GetOptionalAttr`, but *attr_name* is " "specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " "a :c:expr:`PyObject*`." msgstr "" -#: ../../c-api/object.rst:180 +#: ../../c-api/object.rst:181 msgid "" "Generic attribute getter function that is meant to be put into a type " "object's ``tp_getattro`` slot. It looks for a descriptor in the dictionary " @@ -275,34 +276,34 @@ msgid "" "descriptors don't. Otherwise, an :exc:`AttributeError` is raised." msgstr "" -#: ../../c-api/object.rst:190 +#: ../../c-api/object.rst:191 msgid "" "Set the value of the attribute named *attr_name*, for object *o*, to the " "value *v*. Raise an exception and return ``-1`` on failure; return ``0`` on " "success. This is the equivalent of the Python statement ``o.attr_name = v``." msgstr "" -#: ../../c-api/object.rst:195 +#: ../../c-api/object.rst:196 msgid "" "If *v* is ``NULL``, the attribute is deleted. This behaviour is deprecated " "in favour of using :c:func:`PyObject_DelAttr`, but there are currently no " "plans to remove it." msgstr "" -#: ../../c-api/object.rst:202 +#: ../../c-api/object.rst:203 msgid "" "This is the same as :c:func:`PyObject_SetAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/object.rst:206 +#: ../../c-api/object.rst:207 msgid "" "If *v* is ``NULL``, the attribute is deleted, but this feature is deprecated " "in favour of using :c:func:`PyObject_DelAttrString`." msgstr "" -#: ../../c-api/object.rst:209 +#: ../../c-api/object.rst:210 msgid "" "The number of different attribute names passed to this function should be " "kept small, usually by using a statically allocated string as *attr_name*. " @@ -312,7 +313,7 @@ msgid "" "internally to create a key object." msgstr "" -#: ../../c-api/object.rst:219 +#: ../../c-api/object.rst:220 msgid "" "Generic attribute setter and deleter function that is meant to be put into a " "type object's :c:member:`~PyTypeObject.tp_setattro` slot. It looks for a " @@ -324,20 +325,20 @@ msgid "" "returned." msgstr "" -#: ../../c-api/object.rst:231 +#: ../../c-api/object.rst:232 msgid "" "Delete attribute named *attr_name*, for object *o*. Returns ``-1`` on " "failure. This is the equivalent of the Python statement ``del o.attr_name``." msgstr "" -#: ../../c-api/object.rst:237 +#: ../../c-api/object.rst:238 msgid "" "This is the same as :c:func:`PyObject_DelAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/object.rst:241 +#: ../../c-api/object.rst:242 msgid "" "The number of different attribute names passed to this function should be " "kept small, usually by using a statically allocated string as *attr_name*. " @@ -347,13 +348,13 @@ msgid "" "internally to create a key object for lookup." msgstr "" -#: ../../c-api/object.rst:252 +#: ../../c-api/object.rst:253 msgid "" "A generic implementation for the getter of a ``__dict__`` descriptor. It " "creates the dictionary if necessary." msgstr "" -#: ../../c-api/object.rst:255 +#: ../../c-api/object.rst:256 msgid "" "This function may also be called to get the :py:attr:`~object.__dict__` of " "the object *o*. Pass ``NULL`` for *context* when calling it. Since this " @@ -362,30 +363,30 @@ msgid "" "the object." msgstr "" -#: ../../c-api/object.rst:261 +#: ../../c-api/object.rst:262 msgid "On failure, returns ``NULL`` with an exception set." msgstr "在失敗時,會回傳 ``NULL`` 並設定例外。" -#: ../../c-api/object.rst:268 +#: ../../c-api/object.rst:269 msgid "" "A generic implementation for the setter of a ``__dict__`` descriptor. This " "implementation does not allow the dictionary to be deleted." msgstr "" -#: ../../c-api/object.rst:276 +#: ../../c-api/object.rst:277 msgid "" "Return a pointer to :py:attr:`~object.__dict__` of the object *obj*. If " "there is no ``__dict__``, return ``NULL`` without setting an exception." msgstr "" -#: ../../c-api/object.rst:279 +#: ../../c-api/object.rst:280 msgid "" "This function may need to allocate memory for the dictionary, so it may be " "more efficient to call :c:func:`PyObject_GetAttr` when accessing an " "attribute on the object." msgstr "" -#: ../../c-api/object.rst:286 +#: ../../c-api/object.rst:287 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " "which must be one of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`, :" @@ -396,33 +397,33 @@ msgid "" "success, or ``NULL`` on failure." msgstr "" -#: ../../c-api/object.rst:296 +#: ../../c-api/object.rst:297 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " "like :c:func:`PyObject_RichCompare`, but returns ``-1`` on error, ``0`` if " "the result is false, ``1`` otherwise." msgstr "" -#: ../../c-api/object.rst:301 +#: ../../c-api/object.rst:302 msgid "" "If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool` " "will always return ``1`` for :c:macro:`Py_EQ` and ``0`` for :c:macro:`Py_NE`." msgstr "" -#: ../../c-api/object.rst:306 +#: ../../c-api/object.rst:307 msgid "" "Format *obj* using *format_spec*. This is equivalent to the Python " "expression ``format(obj, format_spec)``." msgstr "" -#: ../../c-api/object.rst:309 +#: ../../c-api/object.rst:310 msgid "" "*format_spec* may be ``NULL``. In this case the call is equivalent to " "``format(obj)``. Returns the formatted string on success, ``NULL`` on " "failure." msgstr "" -#: ../../c-api/object.rst:317 +#: ../../c-api/object.rst:318 msgid "" "Compute a string representation of object *o*. Returns the string " "representation on success, ``NULL`` on failure. This is the equivalent of " @@ -430,13 +431,13 @@ msgid "" "function." msgstr "" -#: ../../c-api/object.rst:321 ../../c-api/object.rst:345 +#: ../../c-api/object.rst:322 ../../c-api/object.rst:346 msgid "" "This function now includes a debug assertion to help ensure that it does not " "silently discard an active exception." msgstr "" -#: ../../c-api/object.rst:329 +#: ../../c-api/object.rst:330 msgid "" "As :c:func:`PyObject_Repr`, compute a string representation of object *o*, " "but escape the non-ASCII characters in the string returned by :c:func:" @@ -445,7 +446,7 @@ msgid "" "Called by the :func:`ascii` built-in function." msgstr "" -#: ../../c-api/object.rst:340 +#: ../../c-api/object.rst:341 msgid "" "Compute a string representation of object *o*. Returns the string " "representation on success, ``NULL`` on failure. This is the equivalent of " @@ -453,7 +454,7 @@ msgid "" "function and, therefore, by the :func:`print` function." msgstr "" -#: ../../c-api/object.rst:354 +#: ../../c-api/object.rst:355 msgid "" "Compute a bytes representation of object *o*. ``NULL`` is returned on " "failure and a bytes object on success. This is equivalent to the Python " @@ -462,20 +463,20 @@ msgid "" "bytes object." msgstr "" -#: ../../c-api/object.rst:363 +#: ../../c-api/object.rst:364 msgid "" "Return ``1`` if the class *derived* is identical to or derived from the " "class *cls*, otherwise return ``0``. In case of an error, return ``-1``." msgstr "" -#: ../../c-api/object.rst:366 ../../c-api/object.rst:385 +#: ../../c-api/object.rst:367 ../../c-api/object.rst:386 msgid "" "If *cls* is a tuple, the check will be done against every entry in *cls*. " "The result will be ``1`` when at least one of the checks returns ``1``, " "otherwise it will be ``0``." msgstr "" -#: ../../c-api/object.rst:370 +#: ../../c-api/object.rst:371 msgid "" "If *cls* has a :meth:`~type.__subclasscheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " @@ -483,52 +484,52 @@ msgid "" "e. contained in :attr:`cls.__mro__ <type.__mro__>`." msgstr "" -#: ../../c-api/object.rst:375 +#: ../../c-api/object.rst:376 msgid "" "Normally only class objects, i.e. instances of :class:`type` or a derived " "class, are considered classes. However, objects can override this by having " "a :attr:`~type.__bases__` attribute (which must be a tuple of base classes)." msgstr "" -#: ../../c-api/object.rst:382 +#: ../../c-api/object.rst:383 msgid "" "Return ``1`` if *inst* is an instance of the class *cls* or a subclass of " "*cls*, or ``0`` if not. On error, returns ``-1`` and sets an exception." msgstr "" -#: ../../c-api/object.rst:389 +#: ../../c-api/object.rst:390 msgid "" "If *cls* has a :meth:`~type.__instancecheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " "*inst* is an instance of *cls* if its class is a subclass of *cls*." msgstr "" -#: ../../c-api/object.rst:393 +#: ../../c-api/object.rst:394 msgid "" "An instance *inst* can override what is considered its class by having a :" "attr:`~object.__class__` attribute." msgstr "" -#: ../../c-api/object.rst:396 +#: ../../c-api/object.rst:397 msgid "" "An object *cls* can override if it is considered a class, and what its base " "classes are, by having a :attr:`~type.__bases__` attribute (which must be a " "tuple of base classes)." msgstr "" -#: ../../c-api/object.rst:405 +#: ../../c-api/object.rst:406 msgid "" "Compute and return the hash value of an object *o*. On failure, return " "``-1``. This is the equivalent of the Python expression ``hash(o)``." msgstr "" -#: ../../c-api/object.rst:408 +#: ../../c-api/object.rst:409 msgid "" "The return type is now Py_hash_t. This is a signed integer the same size " "as :c:type:`Py_ssize_t`." msgstr "" -#: ../../c-api/object.rst:415 +#: ../../c-api/object.rst:416 msgid "" "Set a :exc:`TypeError` indicating that ``type(o)`` is not :term:`hashable` " "and return ``-1``. This function receives special treatment when stored in a " @@ -536,21 +537,21 @@ msgid "" "that it is not hashable." msgstr "" -#: ../../c-api/object.rst:423 +#: ../../c-api/object.rst:424 msgid "" "Returns ``1`` if the object *o* is considered to be true, and ``0`` " "otherwise. This is equivalent to the Python expression ``not not o``. On " "failure, return ``-1``." msgstr "" -#: ../../c-api/object.rst:430 +#: ../../c-api/object.rst:431 msgid "" "Returns ``0`` if the object *o* is considered to be true, and ``1`` " "otherwise. This is equivalent to the Python expression ``not o``. On " "failure, return ``-1``." msgstr "" -#: ../../c-api/object.rst:439 +#: ../../c-api/object.rst:440 msgid "" "When *o* is non-``NULL``, returns a type object corresponding to the object " "type of object *o*. On failure, raises :exc:`SystemError` and returns " @@ -561,13 +562,13 @@ msgid "" "when a new :term:`strong reference` is needed." msgstr "" -#: ../../c-api/object.rst:451 +#: ../../c-api/object.rst:452 msgid "" "Return non-zero if the object *o* is of type *type* or a subtype of *type*, " "and ``0`` otherwise. Both parameters must be non-``NULL``." msgstr "" -#: ../../c-api/object.rst:460 +#: ../../c-api/object.rst:461 msgid "" "Return the length of object *o*. If the object *o* provides either the " "sequence and mapping protocols, the sequence length is returned. On error, " @@ -575,7 +576,7 @@ msgid "" "``len(o)``." msgstr "" -#: ../../c-api/object.rst:467 +#: ../../c-api/object.rst:468 msgid "" "Return an estimated length for the object *o*. First try to return its " "actual length, then an estimate using :meth:`~object.__length_hint__`, and " @@ -584,26 +585,26 @@ msgid "" "defaultvalue)``." msgstr "" -#: ../../c-api/object.rst:477 +#: ../../c-api/object.rst:478 msgid "" "Return element of *o* corresponding to the object *key* or ``NULL`` on " "failure. This is the equivalent of the Python expression ``o[key]``." msgstr "" -#: ../../c-api/object.rst:483 +#: ../../c-api/object.rst:484 msgid "" "Map the object *key* to the value *v*. Raise an exception and return ``-1`` " "on failure; return ``0`` on success. This is the equivalent of the Python " "statement ``o[key] = v``. This function *does not* steal a reference to *v*." msgstr "" -#: ../../c-api/object.rst:491 +#: ../../c-api/object.rst:492 msgid "" "Remove the mapping for the object *key* from the object *o*. Return ``-1`` " "on failure. This is equivalent to the Python statement ``del o[key]``." msgstr "" -#: ../../c-api/object.rst:497 +#: ../../c-api/object.rst:498 msgid "" "This is equivalent to the Python expression ``dir(o)``, returning a " "(possibly empty) list of strings appropriate for the object argument, or " @@ -613,7 +614,7 @@ msgid "" "`PyErr_Occurred` will return false." msgstr "" -#: ../../c-api/object.rst:506 +#: ../../c-api/object.rst:507 msgid "" "This is equivalent to the Python expression ``iter(o)``. It returns a new " "iterator for the object argument, or the object itself if the object is " @@ -621,14 +622,14 @@ msgid "" "object cannot be iterated." msgstr "" -#: ../../c-api/object.rst:514 +#: ../../c-api/object.rst:515 msgid "" "This is equivalent to the Python ``__iter__(self): return self`` method. It " "is intended for :term:`iterator` types, to be used in the :c:member:" "`PyTypeObject.tp_iter` slot." msgstr "" -#: ../../c-api/object.rst:520 +#: ../../c-api/object.rst:521 msgid "" "This is the equivalent to the Python expression ``aiter(o)``. Takes an :" "class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it. " @@ -637,104 +638,104 @@ msgid "" "``NULL`` if the object cannot be iterated." msgstr "" -#: ../../c-api/object.rst:530 +#: ../../c-api/object.rst:531 msgid "Get a pointer to subclass-specific data reserved for *cls*." msgstr "" -#: ../../c-api/object.rst:532 +#: ../../c-api/object.rst:533 msgid "" "The object *o* must be an instance of *cls*, and *cls* must have been " "created using negative :c:member:`PyType_Spec.basicsize`. Python does not " "check this." msgstr "" -#: ../../c-api/object.rst:536 +#: ../../c-api/object.rst:537 msgid "On error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/object.rst:542 +#: ../../c-api/object.rst:543 msgid "" "Return the size of the instance memory space reserved for *cls*, i.e. the " "size of the memory :c:func:`PyObject_GetTypeData` returns." msgstr "" -#: ../../c-api/object.rst:545 +#: ../../c-api/object.rst:546 msgid "" "This may be larger than requested using :c:member:`-PyType_Spec.basicsize " "<PyType_Spec.basicsize>`; it is safe to use this larger size (e.g. with :c:" "func:`!memset`)." msgstr "" -#: ../../c-api/object.rst:548 +#: ../../c-api/object.rst:549 msgid "" "The type *cls* **must** have been created using negative :c:member:" "`PyType_Spec.basicsize`. Python does not check this." msgstr "" -#: ../../c-api/object.rst:552 +#: ../../c-api/object.rst:553 msgid "On error, set an exception and return a negative value." msgstr "" -#: ../../c-api/object.rst:558 +#: ../../c-api/object.rst:559 msgid "" "Get a pointer to per-item data for a class with :c:macro:" "`Py_TPFLAGS_ITEMS_AT_END`." msgstr "" -#: ../../c-api/object.rst:561 +#: ../../c-api/object.rst:562 msgid "" "On error, set an exception and return ``NULL``. :py:exc:`TypeError` is " "raised if *o* does not have :c:macro:`Py_TPFLAGS_ITEMS_AT_END` set." msgstr "" -#: ../../c-api/object.rst:569 +#: ../../c-api/object.rst:570 msgid "Visit the managed dictionary of *obj*." msgstr "" -#: ../../c-api/object.rst:571 ../../c-api/object.rst:580 +#: ../../c-api/object.rst:572 ../../c-api/object.rst:581 msgid "" "This function must only be called in a traverse function of the type which " "has the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." msgstr "" -#: ../../c-api/object.rst:578 +#: ../../c-api/object.rst:579 msgid "Clear the managed dictionary of *obj*." msgstr "" -#: ../../c-api/object.rst:315 ../../c-api/object.rst:327 -#: ../../c-api/object.rst:352 ../../c-api/object.rst:403 -#: ../../c-api/object.rst:437 ../../c-api/object.rst:458 +#: ../../c-api/object.rst:316 ../../c-api/object.rst:328 +#: ../../c-api/object.rst:353 ../../c-api/object.rst:404 +#: ../../c-api/object.rst:438 ../../c-api/object.rst:459 msgid "built-in function" msgstr "bulit-in function(內建函式)" -#: ../../c-api/object.rst:315 +#: ../../c-api/object.rst:316 msgid "repr" msgstr "repr" -#: ../../c-api/object.rst:327 +#: ../../c-api/object.rst:328 msgid "ascii" msgstr "ascii" -#: ../../c-api/object.rst:335 +#: ../../c-api/object.rst:336 msgid "string" msgstr "string(字串)" -#: ../../c-api/object.rst:335 +#: ../../c-api/object.rst:336 msgid "PyObject_Str (C function)" msgstr "PyObject_Str(C 函式)" -#: ../../c-api/object.rst:352 +#: ../../c-api/object.rst:353 msgid "bytes" msgstr "bytes(位元組)" -#: ../../c-api/object.rst:403 +#: ../../c-api/object.rst:404 msgid "hash" msgstr "hash(雜湊)" -#: ../../c-api/object.rst:437 +#: ../../c-api/object.rst:438 msgid "type" msgstr "type(型別)" -#: ../../c-api/object.rst:458 +#: ../../c-api/object.rst:459 msgid "len" msgstr "len" diff --git a/faq/library.po b/faq/library.po index 3a9a9e0094..648029c94e 100644 --- a/faq/library.po +++ b/faq/library.po @@ -1301,7 +1301,7 @@ msgstr "``uniform(a, b)`` 會選擇 [a, b) 範圍內的浮點數。" #: ../../faq/library.rst:805 msgid "" "``normalvariate(mean, sdev)`` samples the normal (Gaussian) distribution." -msgstr "``normalvariate(mean, sdev)`` 對常態(高斯)分佈進行採樣 (sample)。" +msgstr "``normalvariate(mean, sdev)`` 對常態(高斯)分佈進行取樣 (sample)。" #: ../../faq/library.rst:807 msgid "Some higher-level functions operate on sequences directly, such as:" diff --git a/faq/programming.po b/faq/programming.po index 3a4d4abfe8..1d9f44ebb3 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -4205,7 +4205,7 @@ msgid "" msgstr "" "模組可以透過查看預定義的全域變數 ``__name__`` 來找出自己的模組名稱。如果它的" "值為``'__main__'``,則該程式作為腳本運行。許多通常透過引入使用的模組還提供命" -"令行界面或自檢,只有在檢查 ``__name__`` 後才執行此程式碼: ::" +"令行介面或自檢,只有在檢查 ``__name__`` 後才執行此程式碼: ::" #: ../../faq/programming.rst:2134 msgid "" @@ -4216,11 +4216,16 @@ msgid "" "if __name__ == '__main__':\n" " main()" msgstr "" +"def main():\n" +" print('Running test...')\n" +" ...\n" +"\n" +"if __name__ == '__main__':\n" +" main()" #: ../../faq/programming.rst:2143 -#, fuzzy msgid "How can I have modules that mutually import each other?" -msgstr "我怎樣才能擁有相互引入的模組?" +msgstr "要怎樣才能擁有相互引入的模組?" #: ../../faq/programming.rst:2145 msgid "Suppose you have the following modules:" diff --git a/howto/argparse-optparse.po b/howto/argparse-optparse.po index 39f928c87d..62fdf4ecdd 100644 --- a/howto/argparse-optparse.po +++ b/howto/argparse-optparse.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-09 00:13+0000\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -16,103 +16,151 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ../../howto/argparse-optparse.rst:7 -msgid "Upgrading optparse code" -msgstr "升級 optparse 程式碼" +#: ../../howto/argparse-optparse.rst:8 +msgid "Migrating ``optparse`` code to ``argparse``" +msgstr "將 ``optparse`` 程式碼遷移到 ``argparse``" -#: ../../howto/argparse-optparse.rst:9 +#: ../../howto/argparse-optparse.rst:10 msgid "" -"Originally, the :mod:`argparse` module had attempted to maintain " -"compatibility with :mod:`optparse`. However, :mod:`optparse` was difficult " -"to extend transparently, particularly with the changes required to support " -"``nargs=`` specifiers and better usage messages. When most everything in :" -"mod:`optparse` had either been copy-pasted over or monkey-patched, it no " -"longer seemed practical to try to maintain the backwards compatibility." +"The :mod:`argparse` module offers several higher level features not natively " +"provided by the :mod:`optparse` module, including:" msgstr "" +":mod:`argparse` 模組提供了一些高階功能,這些功能在 :mod:`optparse` 模組中並未" +"原生提供,包括:" -#: ../../howto/argparse-optparse.rst:16 -msgid "" -"The :mod:`argparse` module improves on the :mod:`optparse` module in a " -"number of ways including:" -msgstr "" - -#: ../../howto/argparse-optparse.rst:19 +#: ../../howto/argparse-optparse.rst:13 msgid "Handling positional arguments." -msgstr "" +msgstr "處理位置引數。" -#: ../../howto/argparse-optparse.rst:20 +#: ../../howto/argparse-optparse.rst:14 msgid "Supporting subcommands." -msgstr "" +msgstr "支援子命令。" -#: ../../howto/argparse-optparse.rst:21 +#: ../../howto/argparse-optparse.rst:15 msgid "Allowing alternative option prefixes like ``+`` and ``/``." -msgstr "" +msgstr "允許替代選項前綴,如 ``+`` 和 ``/``。" -#: ../../howto/argparse-optparse.rst:22 +#: ../../howto/argparse-optparse.rst:16 msgid "Handling zero-or-more and one-or-more style arguments." msgstr "" +"處理零或多個 (zero-or-more) 和一個或多個 (and one-or-more) 樣式的引數。" -#: ../../howto/argparse-optparse.rst:23 +#: ../../howto/argparse-optparse.rst:17 msgid "Producing more informative usage messages." -msgstr "" +msgstr "產生更多資訊的使用訊息。" -#: ../../howto/argparse-optparse.rst:24 +#: ../../howto/argparse-optparse.rst:18 msgid "Providing a much simpler interface for custom ``type`` and ``action``." +msgstr "為自訂 ``type`` 和 ``action`` 提供了一個更簡單的介面。" + +#: ../../howto/argparse-optparse.rst:20 +msgid "" +"Originally, the :mod:`argparse` module attempted to maintain compatibility " +"with :mod:`optparse`. However, the fundamental design differences between " +"supporting declarative command line option processing (while leaving " +"positional argument processing to application code), and supporting both " +"named options and positional arguments in the declarative interface mean " +"that the API has diverged from that of ``optparse`` over time." +msgstr "" +"最初 :mod:`argparse` 模組試圖保持與 :mod:`optparse` 的相容性,但在基礎設計上" +"的存在差異 -- 支援宣告式 (declarative) 命令列選項處理 (同時將位置引數處理留給" +"應用程式的程式碼) 和在宣告式介面中支援命名選項 (named options) 和位置引數 -- " +"代表 API 隨著時間的推移已經與 ``optparse`` API 分歧。" + +#: ../../howto/argparse-optparse.rst:27 +msgid "" +"As described in :ref:`choosing-an-argument-parser`, applications that are " +"currently using :mod:`optparse` and are happy with the way it works can just " +"continue to use ``optparse``." +msgstr "" +"如 :ref:`choosing-an-argument-parser` 中所述,目前使用 :mod:`optparse` 並對其" +"運作方式滿意的應用程式可以繼續使用 ``optparse``。" + +#: ../../howto/argparse-optparse.rst:31 +msgid "" +"Application developers that are considering migrating should also review the " +"list of intrinsic behavioural differences described in that section before " +"deciding whether or not migration is desirable." msgstr "" +"在決定是否遷移之前,應用程式開發人員應該先檢閱該段落中描述的內在行為差異清" +"單,來決定是否值得遷移。" -#: ../../howto/argparse-optparse.rst:26 -msgid "A partial upgrade path from :mod:`optparse` to :mod:`argparse`:" +#: ../../howto/argparse-optparse.rst:35 +msgid "" +"For applications that do choose to migrate from :mod:`optparse` to :mod:" +"`argparse`, the following suggestions should be helpful:" msgstr "" +"對於選擇從 :mod:`optparse` 遷移到 :mod:`argparse` 的應用程式,以下建議應會有" +"所幫助:" -#: ../../howto/argparse-optparse.rst:28 +#: ../../howto/argparse-optparse.rst:38 msgid "" "Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:" "`ArgumentParser.add_argument` calls." msgstr "" +"將所有 :meth:`optparse.OptionParser.add_option` 呼叫替換為 :meth:" +"`ArgumentParser.add_argument` 呼叫。" -#: ../../howto/argparse-optparse.rst:31 +#: ../../howto/argparse-optparse.rst:41 msgid "" "Replace ``(options, args) = parser.parse_args()`` with ``args = parser." "parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls " "for the positional arguments. Keep in mind that what was previously called " "``options``, now in the :mod:`argparse` context is called ``args``." msgstr "" +"將 ``(options, args) = parser.parse_args()`` 替換為 ``args = parser." +"parse_args()``,並為位置引數新增額外的 :meth:`ArgumentParser.add_argument` 呼" +"叫。請記住,以前稱為 ``options`` 的東西,在 :mod:`argparse` 情境中現在稱為 " +"``args``。" -#: ../../howto/argparse-optparse.rst:36 +#: ../../howto/argparse-optparse.rst:46 msgid "" "Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using :" "meth:`~ArgumentParser.parse_intermixed_args` instead of :meth:" "`~ArgumentParser.parse_args`." msgstr "" +"使用 :meth:`~ArgumentParser.parse_intermixed_args` 來替換掉 :meth:`optparse." +"OptionParser.disable_interspersed_args`,而不是使用 :meth:`~ArgumentParser." +"parse_args`。" -#: ../../howto/argparse-optparse.rst:40 +#: ../../howto/argparse-optparse.rst:50 msgid "" "Replace callback actions and the ``callback_*`` keyword arguments with " "``type`` or ``action`` arguments." msgstr "" +"將回呼動作和 ``callback_*`` 關鍵字引數替換為 ``type`` 或 ``action`` 引數。" -#: ../../howto/argparse-optparse.rst:43 +#: ../../howto/argparse-optparse.rst:53 msgid "" "Replace string names for ``type`` keyword arguments with the corresponding " "type objects (e.g. int, float, complex, etc)." msgstr "" +"將 ``type`` 關鍵字引數的字串名稱替換為相應的類型物件 (例如 int、float、" +"complex 等)。" -#: ../../howto/argparse-optparse.rst:46 +#: ../../howto/argparse-optparse.rst:56 msgid "" "Replace :class:`optparse.Values` with :class:`Namespace` and :exc:`optparse." "OptionError` and :exc:`optparse.OptionValueError` with :exc:`ArgumentError`." msgstr "" +"將 :class:`optparse.Values` 替換為 :class:`Namespace`,並將 :exc:`optparse." +"OptionError` 和 :exc:`optparse.OptionValueError` 替換為 :exc:" +"`ArgumentError`。" -#: ../../howto/argparse-optparse.rst:50 +#: ../../howto/argparse-optparse.rst:60 msgid "" "Replace strings with implicit arguments such as ``%default`` or ``%prog`` " "with the standard Python syntax to use dictionaries to format strings, that " "is, ``%(default)s`` and ``%(prog)s``." msgstr "" +"將隱式引數的字串,如 ``%default`` 或 ``%prog`` 替換為使用字典來格式化字串的標" +"準 Python 語法,即 ``%(default)s`` 和 ``%(prog)s``。" -#: ../../howto/argparse-optparse.rst:54 +#: ../../howto/argparse-optparse.rst:64 msgid "" "Replace the OptionParser constructor ``version`` argument with a call to " "``parser.add_argument('--version', action='http://github.com/version', version='<the " "version>')``." msgstr "" +"將 OptionParser 建構函式的 ``version`` 引數替換為呼叫 ``parser." +"add_argument('--version', action='http://github.com/version', version='<the version>')``。" diff --git a/howto/argparse.po b/howto/argparse.po index c71d110388..323727fd39 100644 --- a/howto/argparse.po +++ b/howto/argparse.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-18 00:14+0000\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2023-12-11 17:33+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -46,27 +46,36 @@ msgstr "" #: ../../howto/argparse.rst:16 msgid "" -"There are two other modules that fulfill the same task, namely :mod:`getopt` " -"(an equivalent for ``getopt()`` from the C language) and the deprecated :mod:" -"`optparse`. Note also that :mod:`argparse` is based on :mod:`optparse`, and " -"therefore very similar in terms of usage." -msgstr "" -"另外還有兩個模組可以完成相同的任務,即 :mod:`getopt`\\ (相當於 C 語言中的 " -"``getopt()``)和已棄用的 :mod:`optparse`。另請注意,:mod:`argparse` 是基於 :" -"mod:`optparse` 的,因此在用法上非常相似。" +"The standard library includes two other libraries directly related to " +"command-line parameter processing: the lower level :mod:`optparse` module " +"(which may require more code to configure for a given application, but also " +"allows an application to request behaviors that ``argparse`` doesn't " +"support), and the very low level :mod:`getopt` (which specifically serves as " +"an equivalent to the :c:func:`!getopt` family of functions available to C " +"programmers). While neither of those modules is covered directly in this " +"guide, many of the core concepts in ``argparse`` first originated in " +"``optparse``, so some aspects of this tutorial will also be relevant to " +"``optparse`` users." +msgstr "" +"標準函式庫包含另外兩個與命令列參數處理直接相關的函式庫:較低階的 :mod:" +"`optparse` 模組(可能需要更多程式碼來為給定應用程式設定,但也允許應用程式要" +"求 ``argparse`` 不支援的行為),以及非常低階的 :mod:`getopt`\\ (專門用作 C " +"程式設計師可用的 :c:func:`!getopt` 函式系列的等價)。雖然這個指南並未直接涵蓋" +"這些模組,但 ``argparse`` 的許多核心概念最初來自於 ``optparse``,因此本教學的" +"某些部分也適用於 ``optparse`` 使用者。" -#: ../../howto/argparse.rst:24 +#: ../../howto/argparse.rst:29 msgid "Concepts" msgstr "概念" -#: ../../howto/argparse.rst:26 +#: ../../howto/argparse.rst:31 msgid "" "Let's show the sort of functionality that we are going to explore in this " "introductory tutorial by making use of the :command:`ls` command:" msgstr "" "讓我們透過使用 :command:`ls` 指令來展示我們將在本介紹教學中探索的功能類型:" -#: ../../howto/argparse.rst:29 +#: ../../howto/argparse.rst:34 msgid "" "$ ls\n" "cpython devguide prog.py pypy rm-unused-function.patch\n" @@ -102,11 +111,11 @@ msgstr "" "Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n" "..." -#: ../../howto/argparse.rst:48 +#: ../../howto/argparse.rst:53 msgid "A few concepts we can learn from the four commands:" msgstr "我們可以從這四個命令中學到一些概念:" -#: ../../howto/argparse.rst:50 +#: ../../howto/argparse.rst:55 msgid "" "The :command:`ls` command is useful when run without any options at all. It " "defaults to displaying the contents of the current directory." @@ -114,7 +123,7 @@ msgstr "" ":command:`ls` 命令即便在沒有任何選項的情況下執行仍非常有用。它預設顯示目前目" "錄的內容。" -#: ../../howto/argparse.rst:53 +#: ../../howto/argparse.rst:58 msgid "" "If we want beyond what it provides by default, we tell it a bit more. In " "this case, we want it to display a different directory, ``pypy``. What we " @@ -131,7 +140,7 @@ msgstr "" "command:`cp` 這樣的指令更相關,其最基本的用法是 ``cp SRC DEST``。第一個是\\ *" "你想要複製的位置*,第二個是\\ *你想要複製過去的位置*。" -#: ../../howto/argparse.rst:62 +#: ../../howto/argparse.rst:67 msgid "" "Now, say we want to change behaviour of the program. In our example, we " "display more info for each file instead of just showing the file names. The " @@ -140,7 +149,7 @@ msgstr "" "現在假設我們想要改變程式的行為。在我們的範例中,我們顯示每個檔案的更多資訊," "而不僅是顯示檔案名稱。在這種情況下,``-l`` 被稱為可選引數。" -#: ../../howto/argparse.rst:66 +#: ../../howto/argparse.rst:71 msgid "" "That's a snippet of the help text. It's very useful in that you can come " "across a program you have never used before, and can figure out how it works " @@ -149,15 +158,15 @@ msgstr "" "這是幫助文字的片段。它非常有用,因為當你遇到以前從未使用過的程式時,只需閱讀" "其幫助文字即可了解它的工作原理。" -#: ../../howto/argparse.rst:72 +#: ../../howto/argparse.rst:77 msgid "The basics" msgstr "基本用法" -#: ../../howto/argparse.rst:74 +#: ../../howto/argparse.rst:79 msgid "Let us start with a very simple example which does (almost) nothing::" msgstr "讓我們從一個非常簡單的例子開始,它(幾乎)什麼都不做: ::" -#: ../../howto/argparse.rst:76 +#: ../../howto/argparse.rst:81 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -167,12 +176,12 @@ msgstr "" "parser = argparse.ArgumentParser()\n" "parser.parse_args()" -#: ../../howto/argparse.rst:80 ../../howto/argparse.rst:188 -#: ../../howto/argparse.rst:209 +#: ../../howto/argparse.rst:85 ../../howto/argparse.rst:193 +#: ../../howto/argparse.rst:214 msgid "Following is a result of running the code:" msgstr "程式碼執行結果如下:" -#: ../../howto/argparse.rst:82 +#: ../../howto/argparse.rst:87 msgid "" "$ python prog.py\n" "$ python prog.py --help\n" @@ -200,18 +209,18 @@ msgstr "" "usage: prog.py [-h]\n" "prog.py: error: unrecognized arguments: foo" -#: ../../howto/argparse.rst:97 ../../howto/argparse.rst:254 -#: ../../howto/argparse.rst:298 +#: ../../howto/argparse.rst:102 ../../howto/argparse.rst:259 +#: ../../howto/argparse.rst:303 msgid "Here is what is happening:" msgstr "這是發生的事情:" -#: ../../howto/argparse.rst:99 +#: ../../howto/argparse.rst:104 msgid "" "Running the script without any options results in nothing displayed to " "stdout. Not so useful." msgstr "執行不帶任何選項的腳本不會在標準輸出中顯示任何內容。不太有用。" -#: ../../howto/argparse.rst:102 +#: ../../howto/argparse.rst:107 msgid "" "The second one starts to display the usefulness of the :mod:`argparse` " "module. We have done almost nothing, but already we get a nice help message." @@ -219,7 +228,7 @@ msgstr "" "第二個開始能夠顯現 :mod:`argparse` 模組的有用之處。我們幾乎什麼也沒做,但我們" "已經收到了一個很好的幫助訊息。" -#: ../../howto/argparse.rst:105 +#: ../../howto/argparse.rst:110 msgid "" "The ``--help`` option, which can also be shortened to ``-h``, is the only " "option we get for free (i.e. no need to specify it). Specifying anything " @@ -230,15 +239,15 @@ msgstr "" "它)。指定任何其他內容都會導致錯誤。但即便如此,我們也還是輕鬆地獲得了有用的" "使用資訊。" -#: ../../howto/argparse.rst:112 +#: ../../howto/argparse.rst:117 msgid "Introducing Positional arguments" msgstr "位置引數的介紹" -#: ../../howto/argparse.rst:114 +#: ../../howto/argparse.rst:119 msgid "An example::" msgstr "例如: ::" -#: ../../howto/argparse.rst:116 +#: ../../howto/argparse.rst:121 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -252,11 +261,11 @@ msgstr "" "args = parser.parse_args()\n" "print(args.echo)" -#: ../../howto/argparse.rst:122 +#: ../../howto/argparse.rst:127 msgid "And running the code:" msgstr "執行這段程式碼:" -#: ../../howto/argparse.rst:124 +#: ../../howto/argparse.rst:129 msgid "" "$ python prog.py\n" "usage: prog.py [-h] echo\n" @@ -286,11 +295,11 @@ msgstr "" "$ python prog.py foo\n" "foo" -#: ../../howto/argparse.rst:140 +#: ../../howto/argparse.rst:145 msgid "Here is what's happening:" msgstr "這是會發生的事情:" -#: ../../howto/argparse.rst:142 +#: ../../howto/argparse.rst:147 msgid "" "We've added the :meth:`~ArgumentParser.add_argument` method, which is what " "we use to specify which command-line options the program is willing to " @@ -300,11 +309,11 @@ msgstr "" "我們新增了 :meth:`~ArgumentParser.add_argument` 方法,我們用它來指定程式願意" "接受哪些命令列選項。在本例中,我將其命名為 ``echo``,以便與其功能一致。" -#: ../../howto/argparse.rst:146 +#: ../../howto/argparse.rst:151 msgid "Calling our program now requires us to specify an option." msgstr "現在呼叫我們的程式時需要指定一個選項。" -#: ../../howto/argparse.rst:148 +#: ../../howto/argparse.rst:153 msgid "" "The :meth:`~ArgumentParser.parse_args` method actually returns some data " "from the options specified, in this case, ``echo``." @@ -312,7 +321,7 @@ msgstr "" ":meth:`~ArgumentParser.parse_args` 方法實際上從指定的選項中回傳一些資料,在本" "例中為 ``echo``。" -#: ../../howto/argparse.rst:151 +#: ../../howto/argparse.rst:156 msgid "" "The variable is some form of 'magic' that :mod:`argparse` performs for free " "(i.e. no need to specify which variable that value is stored in). You will " @@ -322,7 +331,7 @@ msgstr "" "該變數是某種形式的「魔法」,:mod:`argparse` 可以自由執行(即無需指定該值儲存" "在哪個變數中)。你還會注意到,它的名稱與提供給方法 ``echo`` 的字串引數相符。" -#: ../../howto/argparse.rst:156 +#: ../../howto/argparse.rst:161 msgid "" "Note however that, although the help display looks nice and all, it " "currently is not as helpful as it can be. For example we see that we got " @@ -334,7 +343,7 @@ msgstr "" "看到 ``echo`` 作為位置引數,但除了猜測或閱讀原始程式碼之外,我們不知道它的作" "用。那麼,我們來讓它變得更有用一點: ::" -#: ../../howto/argparse.rst:161 +#: ../../howto/argparse.rst:166 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -348,11 +357,11 @@ msgstr "" "args = parser.parse_args()\n" "print(args.echo)" -#: ../../howto/argparse.rst:167 +#: ../../howto/argparse.rst:172 msgid "And we get:" msgstr "然後我們得到:" -#: ../../howto/argparse.rst:169 +#: ../../howto/argparse.rst:174 msgid "" "$ python prog.py -h\n" "usage: prog.py [-h] echo\n" @@ -372,11 +381,11 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../howto/argparse.rst:180 +#: ../../howto/argparse.rst:185 msgid "Now, how about doing something even more useful::" msgstr "現在來做一些更有用處的事情: ::" -#: ../../howto/argparse.rst:182 +#: ../../howto/argparse.rst:187 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -392,7 +401,7 @@ msgstr "" "args = parser.parse_args()\n" "print(args.square**2)" -#: ../../howto/argparse.rst:190 +#: ../../howto/argparse.rst:195 msgid "" "$ python prog.py 4\n" "Traceback (most recent call last):\n" @@ -406,7 +415,7 @@ msgstr "" " print(args.square**2)\n" "TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'" -#: ../../howto/argparse.rst:198 +#: ../../howto/argparse.rst:203 msgid "" "That didn't go so well. That's because :mod:`argparse` treats the options we " "give it as strings, unless we tell it otherwise. So, let's tell :mod:" @@ -415,7 +424,7 @@ msgstr "" "進展不太順利。這是因為,除非我們另有說明,:mod:`argparse` 會將我們給它的選項" "視為字串。因此,讓我們告訴 :mod:`argparse` 將該輸入視為整數: ::" -#: ../../howto/argparse.rst:202 +#: ../../howto/argparse.rst:207 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -433,7 +442,7 @@ msgstr "" "args = parser.parse_args()\n" "print(args.square**2)" -#: ../../howto/argparse.rst:211 +#: ../../howto/argparse.rst:216 msgid "" "$ python prog.py 4\n" "16\n" @@ -447,23 +456,23 @@ msgstr "" "usage: prog.py [-h] square\n" "prog.py: error: argument square: invalid int value: 'four'" -#: ../../howto/argparse.rst:219 +#: ../../howto/argparse.rst:224 msgid "" "That went well. The program now even helpfully quits on bad illegal input " "before proceeding." msgstr "順利進展。現在該程式甚至可以在繼續操作之前因錯誤的非法輸入而退出。" -#: ../../howto/argparse.rst:224 +#: ../../howto/argparse.rst:229 msgid "Introducing Optional arguments" msgstr "可選引數的介紹" -#: ../../howto/argparse.rst:226 +#: ../../howto/argparse.rst:231 msgid "" "So far we have been playing with positional arguments. Let us have a look on " "how to add optional ones::" msgstr "到目前為止,我們一直在討論位置引數。我們來看看如何新增可選引數: ::" -#: ../../howto/argparse.rst:229 +#: ../../howto/argparse.rst:234 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -479,12 +488,12 @@ msgstr "" "if args.verbosity:\n" " print(\"verbosity turned on\")" -#: ../../howto/argparse.rst:236 ../../howto/argparse.rst:282 -#: ../../howto/argparse.rst:398 ../../howto/argparse.rst:432 +#: ../../howto/argparse.rst:241 ../../howto/argparse.rst:287 +#: ../../howto/argparse.rst:403 ../../howto/argparse.rst:437 msgid "And the output:" msgstr "接者是結果:" -#: ../../howto/argparse.rst:238 +#: ../../howto/argparse.rst:243 msgid "" "$ python prog.py --verbosity 1\n" "verbosity turned on\n" @@ -514,7 +523,7 @@ msgstr "" "usage: prog.py [-h] [--verbosity VERBOSITY]\n" "prog.py: error: argument --verbosity: expected one argument" -#: ../../howto/argparse.rst:256 +#: ../../howto/argparse.rst:261 msgid "" "The program is written so as to display something when ``--verbosity`` is " "specified and display nothing when not." @@ -522,7 +531,7 @@ msgstr "" "程式被編寫為在指定 ``--verbosity`` 時顯示一些內容,並在未指定時不顯示任何內" "容。" -#: ../../howto/argparse.rst:259 +#: ../../howto/argparse.rst:264 msgid "" "To show that the option is actually optional, there is no error when running " "the program without it. Note that by default, if an optional argument isn't " @@ -534,17 +543,17 @@ msgstr "" "情況下,如果未使用可選引數,則相關變數(在本例中為 ``args.verbosity``)將被賦" "予 ``None`` 作為值,這就是它未能通過 :keyword:`if` 陳述式真值測試的原因。" -#: ../../howto/argparse.rst:265 +#: ../../howto/argparse.rst:270 msgid "The help message is a bit different." msgstr "幫助訊息有點不同。" -#: ../../howto/argparse.rst:267 +#: ../../howto/argparse.rst:272 msgid "" "When using the ``--verbosity`` option, one must also specify some value, any " "value." msgstr "當使用 ``--verbosity`` 選項時必須要指定一些值,任何值都可以。" -#: ../../howto/argparse.rst:270 +#: ../../howto/argparse.rst:275 msgid "" "The above example accepts arbitrary integer values for ``--verbosity``, but " "for our simple program, only two values are actually useful, ``True`` or " @@ -553,7 +562,7 @@ msgstr "" "在上面的例子中,``--verbosity`` 接受任意的整數,但對我們的程式來說只接受兩個" "輸入值, ``True`` 或 ``False``。所以我們來修改一下程式碼使其符合: ::" -#: ../../howto/argparse.rst:274 +#: ../../howto/argparse.rst:279 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -571,7 +580,7 @@ msgstr "" "if args.verbose:\n" " print(\"verbosity turned on\")" -#: ../../howto/argparse.rst:284 +#: ../../howto/argparse.rst:289 msgid "" "$ python prog.py --verbose\n" "verbosity turned on\n" @@ -597,7 +606,7 @@ msgstr "" " -h, --help show this help message and exit\n" " --verbose increase output verbosity" -#: ../../howto/argparse.rst:300 +#: ../../howto/argparse.rst:305 msgid "" "The option is now more of a flag than something that requires a value. We " "even changed the name of the option to match that idea. Note that we now " @@ -610,21 +619,21 @@ msgstr "" "``\"store_true\"``。這意味著,如果指定了該選項,則將值 ``True`` 指派給 " "``args.verbose``。不指定它代表為 ``False``。" -#: ../../howto/argparse.rst:307 +#: ../../howto/argparse.rst:312 msgid "" "It complains when you specify a value, in true spirit of what flags actually " "are." msgstr "當你指定一個值時,它會本著旗標的實際精神來抱怨。" -#: ../../howto/argparse.rst:310 +#: ../../howto/argparse.rst:315 msgid "Notice the different help text." msgstr "請注意不同的幫助文字。" -#: ../../howto/argparse.rst:314 +#: ../../howto/argparse.rst:319 msgid "Short options" msgstr "短選項" -#: ../../howto/argparse.rst:316 +#: ../../howto/argparse.rst:321 msgid "" "If you are familiar with command line usage, you will notice that I haven't " "yet touched on the topic of short versions of the options. It's quite " @@ -632,7 +641,7 @@ msgid "" msgstr "" "如果你熟悉命令列用法,你會注意到我尚未提及選項的簡短版本。這很簡單: ::" -#: ../../howto/argparse.rst:320 +#: ../../howto/argparse.rst:325 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -652,11 +661,11 @@ msgstr "" "if args.verbose:\n" " print(\"verbosity turned on\")" -#: ../../howto/argparse.rst:328 +#: ../../howto/argparse.rst:333 msgid "And here goes:" msgstr "而這為:" -#: ../../howto/argparse.rst:330 +#: ../../howto/argparse.rst:335 msgid "" "$ python prog.py -v\n" "verbosity turned on\n" @@ -676,19 +685,19 @@ msgstr "" " -h, --help show this help message and exit\n" " -v, --verbose increase output verbosity" -#: ../../howto/argparse.rst:341 +#: ../../howto/argparse.rst:346 msgid "Note that the new ability is also reflected in the help text." msgstr "請注意,新功能也反映在幫助文字中。" -#: ../../howto/argparse.rst:345 +#: ../../howto/argparse.rst:350 msgid "Combining Positional and Optional arguments" msgstr "組合位置引數和可選引數" -#: ../../howto/argparse.rst:347 +#: ../../howto/argparse.rst:352 msgid "Our program keeps growing in complexity::" msgstr "我們的程式的複雜性不斷增加: ::" -#: ../../howto/argparse.rst:349 +#: ../../howto/argparse.rst:354 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -716,11 +725,11 @@ msgstr "" "else:\n" " print(answer)" -#: ../../howto/argparse.rst:362 +#: ../../howto/argparse.rst:367 msgid "And now the output:" msgstr "然後現在的輸出結果:" -#: ../../howto/argparse.rst:364 +#: ../../howto/argparse.rst:369 msgid "" "$ python prog.py\n" "usage: prog.py [-h] [-v] square\n" @@ -742,15 +751,15 @@ msgstr "" "$ python prog.py --verbose 4\n" "the square of 4 equals 16" -#: ../../howto/argparse.rst:376 +#: ../../howto/argparse.rst:381 msgid "We've brought back a positional argument, hence the complaint." msgstr "我們帶回了位置引數,因而被抱怨。" -#: ../../howto/argparse.rst:378 +#: ../../howto/argparse.rst:383 msgid "Note that the order does not matter." msgstr "請注意,順序並不重要。" -#: ../../howto/argparse.rst:380 +#: ../../howto/argparse.rst:385 msgid "" "How about we give this program of ours back the ability to have multiple " "verbosity values, and actually get to use them::" @@ -758,7 +767,7 @@ msgstr "" "我們讓這個程式擁有多個訊息詳細級別 (verbosity) 之值的能力,並實際使用它" "們: ::" -#: ../../howto/argparse.rst:383 +#: ../../howto/argparse.rst:388 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -790,7 +799,7 @@ msgstr "" "else:\n" " print(answer)" -#: ../../howto/argparse.rst:400 +#: ../../howto/argparse.rst:405 msgid "" "$ python prog.py 4\n" "16\n" @@ -816,7 +825,7 @@ msgstr "" "$ python prog.py 4 -v 3\n" "16" -#: ../../howto/argparse.rst:414 +#: ../../howto/argparse.rst:419 msgid "" "These all look good except the last one, which exposes a bug in our program. " "Let's fix it by restricting the values the ``--verbosity`` option can " @@ -825,7 +834,7 @@ msgstr "" "除了最後一個外都看起來正常,它透露了我們程式中的一個錯誤。我們可透過限制 ``--" "verbosity`` 選項可以接受的值來修復它: ::" -#: ../../howto/argparse.rst:417 +#: ../../howto/argparse.rst:422 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -857,7 +866,7 @@ msgstr "" "else:\n" " print(answer)" -#: ../../howto/argparse.rst:434 +#: ../../howto/argparse.rst:439 msgid "" "$ python prog.py 4 -v 3\n" "usage: prog.py [-h] [-v {0,1,2}] square\n" @@ -889,13 +898,13 @@ msgstr "" " -v, --verbosity {0,1,2}\n" " increase output verbosity" -#: ../../howto/argparse.rst:450 +#: ../../howto/argparse.rst:455 msgid "" "Note that the change also reflects both in the error message as well as the " "help string." msgstr "請注意,更改也會反映在錯誤訊息和幫助字串中。" -#: ../../howto/argparse.rst:453 +#: ../../howto/argparse.rst:458 msgid "" "Now, let's use a different approach of playing with verbosity, which is " "pretty common. It also matches the way the CPython executable handles its " @@ -904,7 +913,7 @@ msgstr "" "現在,讓我們使用另一種常見方法來玩玩訊息詳細級別。它也與 CPython 執行檔處理其" "自身訊息詳細級別引數的方式相符(請見 ``python --help`` 的輸出): ::" -#: ../../howto/argparse.rst:457 +#: ../../howto/argparse.rst:462 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -936,13 +945,13 @@ msgstr "" "else:\n" " print(answer)" -#: ../../howto/argparse.rst:472 +#: ../../howto/argparse.rst:477 msgid "" "We have introduced another action, \"count\", to count the number of " "occurrences of specific options." msgstr "我們已經介紹過另一個操作 \"count\" 用來計算指定的選項出現的次數。" -#: ../../howto/argparse.rst:476 +#: ../../howto/argparse.rst:481 msgid "" "$ python prog.py 4\n" "16\n" @@ -990,7 +999,7 @@ msgstr "" "$ python prog.py 4 -vvv\n" "16" -#: ../../howto/argparse.rst:501 +#: ../../howto/argparse.rst:506 msgid "" "Yes, it's now more of a flag (similar to ``action=\"store_true\"``) in the " "previous version of our script. That should explain the complaint." @@ -998,29 +1007,29 @@ msgstr "" "是的,現在它更像是我們上一版腳本中的旗標(類似於 " "``action=\"store_true\"``),這應該可以解釋抱怨的原因。" -#: ../../howto/argparse.rst:504 +#: ../../howto/argparse.rst:509 msgid "It also behaves similar to \"store_true\" action." msgstr "它的行為也類似 \"store_true\" 操作。" -#: ../../howto/argparse.rst:506 +#: ../../howto/argparse.rst:511 msgid "" "Now here's a demonstration of what the \"count\" action gives. You've " "probably seen this sort of usage before." msgstr "現在這裡示範了 \"count\" 動作的作用。你可能以前見過這種用法。" -#: ../../howto/argparse.rst:509 +#: ../../howto/argparse.rst:514 msgid "" "And if you don't specify the ``-v`` flag, that flag is considered to have " "``None`` value." msgstr "如果你不指定 ``-v`` 旗標,則該旗標被視為具有 ``None`` 值。" -#: ../../howto/argparse.rst:512 +#: ../../howto/argparse.rst:517 msgid "" "As should be expected, specifying the long form of the flag, we should get " "the same output." msgstr "正如預期的那樣,指定長形式旗標,我們應該得到相同的輸出。" -#: ../../howto/argparse.rst:515 +#: ../../howto/argparse.rst:520 msgid "" "Sadly, our help output isn't very informative on the new ability our script " "has acquired, but that can always be fixed by improving the documentation " @@ -1029,15 +1038,15 @@ msgstr "" "遺憾的是,我們的幫助輸出對於我們腳本獲得的新功能並沒有提供太多資訊,但我們都" "可以透過改進腳本的文件來解決這個問題(例如:透過 ``help`` 關鍵字引數)。" -#: ../../howto/argparse.rst:519 +#: ../../howto/argparse.rst:524 msgid "That last output exposes a bug in our program." msgstr "最後的輸出透露了我們程式中的一個錯誤。" -#: ../../howto/argparse.rst:522 +#: ../../howto/argparse.rst:527 msgid "Let's fix::" msgstr "讓我們來解決問題: ::" -#: ../../howto/argparse.rst:524 +#: ../../howto/argparse.rst:529 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -1073,11 +1082,11 @@ msgstr "" "else:\n" " print(answer)" -#: ../../howto/argparse.rst:541 +#: ../../howto/argparse.rst:546 msgid "And this is what it gives:" msgstr "這就是它給出的:" -#: ../../howto/argparse.rst:543 +#: ../../howto/argparse.rst:548 msgid "" "$ python prog.py 4 -vvv\n" "the square of 4 equals 16\n" @@ -1099,7 +1108,7 @@ msgstr "" " if args.verbosity >= 2:\n" "TypeError: '>=' not supported between instances of 'NoneType' and 'int'" -#: ../../howto/argparse.rst:556 +#: ../../howto/argparse.rst:561 msgid "" "First output went well, and fixes the bug we had before. That is, we want " "any value >= 2 to be as verbose as possible." @@ -1107,15 +1116,15 @@ msgstr "" "第一次輸出順利進行,並修復了我們之前遇到的錯誤。也就是說,我們希望任何 >= 2 " "的值都盡可能詳細。" -#: ../../howto/argparse.rst:559 +#: ../../howto/argparse.rst:564 msgid "Third output not so good." msgstr "第三個輸出不太好。" -#: ../../howto/argparse.rst:561 +#: ../../howto/argparse.rst:566 msgid "Let's fix that bug::" msgstr "我們來修復這個錯誤: ::" -#: ../../howto/argparse.rst:563 +#: ../../howto/argparse.rst:568 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -1147,7 +1156,7 @@ msgstr "" "else:\n" " print(answer)" -#: ../../howto/argparse.rst:578 +#: ../../howto/argparse.rst:583 msgid "" "We've just introduced yet another keyword, ``default``. We've set it to " "``0`` in order to make it comparable to the other int values. Remember that " @@ -1159,11 +1168,11 @@ msgstr "" "int 值進行比較。請記住,預設情況下,如果未指定可選引數,它將獲得 ``None`` " "值,並且不能與 int 值進行比較(因此會出現 :exc:`TypeError` 例外)。" -#: ../../howto/argparse.rst:585 +#: ../../howto/argparse.rst:590 msgid "And:" msgstr "而且:" -#: ../../howto/argparse.rst:587 +#: ../../howto/argparse.rst:592 msgid "" "$ python prog.py 4\n" "16" @@ -1171,7 +1180,7 @@ msgstr "" "$ python prog.py 4\n" "16" -#: ../../howto/argparse.rst:592 +#: ../../howto/argparse.rst:597 msgid "" "You can go quite far just with what we've learned so far, and we have only " "scratched the surface. The :mod:`argparse` module is very powerful, and " @@ -1181,17 +1190,17 @@ msgstr "" "毛而已。:mod:`argparse` 模組非常強大,在結束本教學之前我們會對它進行更多探" "索。" -#: ../../howto/argparse.rst:599 +#: ../../howto/argparse.rst:604 msgid "Getting a little more advanced" msgstr "更進階一點" -#: ../../howto/argparse.rst:601 +#: ../../howto/argparse.rst:606 msgid "" "What if we wanted to expand our tiny program to perform other powers, not " "just squares::" msgstr "如果我們想擴充我們的小程式來執行其他次方的運算,而不僅是平方: ::" -#: ../../howto/argparse.rst:604 +#: ../../howto/argparse.rst:609 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -1221,12 +1230,12 @@ msgstr "" "else:\n" " print(answer)" -#: ../../howto/argparse.rst:618 ../../howto/argparse.rst:656 -#: ../../howto/argparse.rst:872 +#: ../../howto/argparse.rst:623 ../../howto/argparse.rst:661 +#: ../../howto/argparse.rst:877 msgid "Output:" msgstr "結果:" -#: ../../howto/argparse.rst:620 +#: ../../howto/argparse.rst:625 msgid "" "$ python prog.py\n" "usage: prog.py [-h] [-v] x y\n" @@ -1260,7 +1269,7 @@ msgstr "" "$ python prog.py 4 2 -v\n" "4^2 == 16" -#: ../../howto/argparse.rst:639 +#: ../../howto/argparse.rst:644 msgid "" "Notice that so far we've been using verbosity level to *change* the text " "that gets displayed. The following example instead uses verbosity level to " @@ -1269,7 +1278,7 @@ msgstr "" "請注意,到目前為止,我們一直在使用詳細級別來\\ *更改*\\ 顯示的文字。以下範例" "使用詳細級別來顯示\\ *更多*\\ 文字: ::" -#: ../../howto/argparse.rst:643 +#: ../../howto/argparse.rst:648 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -1297,7 +1306,7 @@ msgstr "" " print(f\"{args.x}^{args.y} == \", end=\"\")\n" "print(answer)" -#: ../../howto/argparse.rst:658 +#: ../../howto/argparse.rst:663 msgid "" "$ python prog.py 4 2\n" "16\n" @@ -1315,11 +1324,11 @@ msgstr "" "Running 'prog.py'\n" "4^2 == 16" -#: ../../howto/argparse.rst:672 +#: ../../howto/argparse.rst:677 msgid "Specifying ambiguous arguments" msgstr "指定不明確的引數" -#: ../../howto/argparse.rst:674 +#: ../../howto/argparse.rst:679 msgid "" "When there is ambiguity in deciding whether an argument is positional or for " "an argument, ``--`` can be used to tell :meth:`~ArgumentParser.parse_args` " @@ -1328,7 +1337,7 @@ msgstr "" "當決定一個引數是位置引數還是引數會有歧義,可以使用 ``--`` 來告訴 :meth:" "`~ArgumentParser.parse_args` 之後的所有內容都是位置引數: ::" -#: ../../howto/argparse.rst:678 +#: ../../howto/argparse.rst:683 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-n', nargs='+')\n" @@ -1368,11 +1377,11 @@ msgstr "" ">>> parser.parse_args(['-n', '1', '--', '2', '3'])\n" "Namespace(args=['2', '3'], n=['1'])" -#: ../../howto/argparse.rst:699 +#: ../../howto/argparse.rst:704 msgid "Conflicting options" msgstr "相互衝突的選項" -#: ../../howto/argparse.rst:701 +#: ../../howto/argparse.rst:706 msgid "" "So far, we have been working with two methods of an :class:`argparse." "ArgumentParser` instance. Let's introduce a third one, :meth:" @@ -1386,7 +1395,7 @@ msgstr "" "許我們指定彼此衝突的選項。我們還可以更改程式的其餘部分,以使得新功能更有意" "義:我們將引入 ``--quiet`` 選項,該選項與 ``--verbose`` 選項相反: ::" -#: ../../howto/argparse.rst:709 +#: ../../howto/argparse.rst:714 msgid "" "import argparse\n" "\n" @@ -1424,7 +1433,7 @@ msgstr "" "else:\n" " print(f\"{args.x}^{args.y} == {answer}\")" -#: ../../howto/argparse.rst:727 +#: ../../howto/argparse.rst:732 msgid "" "Our program is now simpler, and we've lost some functionality for the sake " "of demonstration. Anyways, here's the output:" @@ -1432,7 +1441,7 @@ msgstr "" "我們的程式現在更簡單了,我們因為功能展示失去了一些功能,但無論如何,以下這是" "輸出:" -#: ../../howto/argparse.rst:730 +#: ../../howto/argparse.rst:735 msgid "" "$ python prog.py 4 2\n" "4^2 == 16\n" @@ -1460,7 +1469,7 @@ msgstr "" "usage: prog.py [-h] [-v | -q] x y\n" "prog.py: error: argument -q/--quiet: not allowed with argument -v/--verbose" -#: ../../howto/argparse.rst:745 +#: ../../howto/argparse.rst:750 msgid "" "That should be easy to follow. I've added that last output so you can see " "the sort of flexibility you get, i.e. mixing long form options with short " @@ -1469,14 +1478,14 @@ msgstr "" "這應該很容易理解。我新增了最後一個輸出,以便看到所獲得的靈活性,即可以混合長" "形式與短形式選項。" -#: ../../howto/argparse.rst:749 +#: ../../howto/argparse.rst:754 msgid "" "Before we conclude, you probably want to tell your users the main purpose of " "your program, just in case they don't know::" msgstr "" "在我們結束之前,你可能想告訴使用者你的程式的主要目的,以防他們不知道: ::" -#: ../../howto/argparse.rst:752 +#: ../../howto/argparse.rst:757 msgid "" "import argparse\n" "\n" @@ -1516,7 +1525,7 @@ msgstr "" "else:\n" " print(f\"{args.x}^{args.y} == {answer}\")" -#: ../../howto/argparse.rst:770 +#: ../../howto/argparse.rst:775 msgid "" "Note that slight difference in the usage text. Note the ``[-v | -q]``, which " "tells us that we can either use ``-v`` or ``-q``, but not both at the same " @@ -1525,7 +1534,7 @@ msgstr "" "請注意用法文字中的細微差別。注意 ``[-v | -q]``,它告訴我們可以使用 ``-v`` 或 " "``-q``,但不能同時使用:" -#: ../../howto/argparse.rst:774 ../../howto/argparse.rst:801 +#: ../../howto/argparse.rst:779 ../../howto/argparse.rst:806 msgid "" "$ python prog.py --help\n" "usage: prog.py [-h] [-v | -q] x y\n" @@ -1555,11 +1564,11 @@ msgstr "" " -v, --verbose\n" " -q, --quiet" -#: ../../howto/argparse.rst:792 +#: ../../howto/argparse.rst:797 msgid "How to translate the argparse output" msgstr "如何翻譯 argparse 輸出" -#: ../../howto/argparse.rst:794 +#: ../../howto/argparse.rst:799 msgid "" "The output of the :mod:`argparse` module such as its help text and error " "messages are all made translatable using the :mod:`gettext` module. This " @@ -1570,11 +1579,11 @@ msgstr "" "`gettext` 模組進行翻譯。這允許應用程式能輕鬆本地化 :mod:`argparse` 生成的訊" "息。另請參閱 :ref:`i18n-howto`。" -#: ../../howto/argparse.rst:799 +#: ../../howto/argparse.rst:804 msgid "For instance, in this :mod:`argparse` output:" msgstr "例如,在此 :mod:`argparse` 輸出中:" -#: ../../howto/argparse.rst:817 +#: ../../howto/argparse.rst:822 msgid "" "The strings ``usage:``, ``positional arguments:``, ``options:`` and ``show " "this help message and exit`` are all translatable." @@ -1582,7 +1591,7 @@ msgstr "" "字串 ``usage:``、``positional arguments:``、``options:`` 和 ``show this help " "message and exit`` 都是可被翻譯的。" -#: ../../howto/argparse.rst:820 +#: ../../howto/argparse.rst:825 msgid "" "In order to translate these strings, they must first be extracted into a ``." "po`` file. For example, using `Babel <https://babel.pocoo.org/>`__, run this " @@ -1591,11 +1600,11 @@ msgstr "" "為了翻譯這些字串,必須先將它們提取到 ``.po`` 檔案中。例如,使用 `Babel " "<https://babel.pocoo.org/>`__ 並執行下列命令:" -#: ../../howto/argparse.rst:824 +#: ../../howto/argparse.rst:829 msgid "$ pybabel extract -o messages.po /usr/lib/python3.12/argparse.py" msgstr "$ pybabel extract -o messages.po /usr/lib/python3.12/argparse.py" -#: ../../howto/argparse.rst:828 +#: ../../howto/argparse.rst:833 msgid "" "This command will extract all translatable strings from the :mod:`argparse` " "module and output them into a file named ``messages.po``. This command " @@ -1604,13 +1613,13 @@ msgstr "" "此命令將從 :mod:`argparse` 模組中提取出所有可翻譯的字串,並將它們輸出到名為 " "``messages.po`` 的檔案中。這個指令假設你的 Python 是安裝在 ``/usr/lib`` 中。" -#: ../../howto/argparse.rst:832 +#: ../../howto/argparse.rst:837 msgid "" "You can find out the location of the :mod:`argparse` module on your system " "using this script::" msgstr "你可以使用以下腳本找到 :mod:`argparse` 模組在系統上的位置: ::" -#: ../../howto/argparse.rst:835 +#: ../../howto/argparse.rst:840 msgid "" "import argparse\n" "print(argparse.__file__)" @@ -1618,7 +1627,7 @@ msgstr "" "import argparse\n" "print(argparse.__file__)" -#: ../../howto/argparse.rst:838 +#: ../../howto/argparse.rst:843 msgid "" "Once the messages in the ``.po`` file are translated and the translations " "are installed using :mod:`gettext`, :mod:`argparse` will be able to display " @@ -1627,17 +1636,17 @@ msgstr "" "一旦翻譯了 ``.po`` 檔案中的訊息並使用 :mod:`gettext` 安裝了翻譯,:mod:" "`argparse` 將能夠顯示翻譯後的訊息。" -#: ../../howto/argparse.rst:842 +#: ../../howto/argparse.rst:847 msgid "" "To translate your own strings in the :mod:`argparse` output, use :mod:" "`gettext`." msgstr "若要在 :mod:`argparse` 輸出中翻譯你自己的字串,請使用 :mod:`gettext`。" -#: ../../howto/argparse.rst:845 +#: ../../howto/argparse.rst:850 msgid "Custom type converters" msgstr "" -#: ../../howto/argparse.rst:847 +#: ../../howto/argparse.rst:852 msgid "" "The :mod:`argparse` module allows you to specify custom type converters for " "your command-line arguments. This allows you to modify user input before " @@ -1645,7 +1654,7 @@ msgid "" "need to pre-process the input before it is used in your program." msgstr "" -#: ../../howto/argparse.rst:852 +#: ../../howto/argparse.rst:857 msgid "" "When using a custom type converter, you can use any callable that takes a " "single string argument (the argument value) and returns the converted value. " @@ -1653,13 +1662,13 @@ msgid "" "action class with the **action** parameter instead." msgstr "" -#: ../../howto/argparse.rst:857 +#: ../../howto/argparse.rst:862 msgid "" "For example, let's say you want to handle arguments with different prefixes " "and process them accordingly::" msgstr "" -#: ../../howto/argparse.rst:860 +#: ../../howto/argparse.rst:865 msgid "" "import argparse\n" "\n" @@ -1685,7 +1694,7 @@ msgstr "" "args = parser.parse_args()\n" "print(args)" -#: ../../howto/argparse.rst:874 +#: ../../howto/argparse.rst:879 msgid "" "$ python prog.py -a value1 +a value2\n" "Namespace(a=[('-', 'value1'), ('+', 'value2')])" @@ -1693,24 +1702,24 @@ msgstr "" "$ python prog.py -a value1 +a value2\n" "Namespace(a=[('-', 'value1'), ('+', 'value2')])" -#: ../../howto/argparse.rst:879 +#: ../../howto/argparse.rst:884 msgid "In this example, we:" msgstr "在這個範例當中,我們:" -#: ../../howto/argparse.rst:881 +#: ../../howto/argparse.rst:886 msgid "" "Created a parser with custom prefix characters using the ``prefix_chars`` " "parameter." msgstr "" -#: ../../howto/argparse.rst:884 +#: ../../howto/argparse.rst:889 msgid "" "Defined two arguments, ``-a`` and ``+a``, which used the ``type`` parameter " "to create custom type converters to store the value in a tuple with the " "prefix." msgstr "" -#: ../../howto/argparse.rst:887 +#: ../../howto/argparse.rst:892 msgid "" "Without the custom type converters, the arguments would have treated the ``-" "a`` and ``+a`` as the same argument, which would have been undesirable. By " @@ -1718,11 +1727,11 @@ msgid "" "arguments." msgstr "" -#: ../../howto/argparse.rst:892 +#: ../../howto/argparse.rst:897 msgid "Conclusion" msgstr "結論" -#: ../../howto/argparse.rst:894 +#: ../../howto/argparse.rst:899 msgid "" "The :mod:`argparse` module offers a lot more than shown here. Its docs are " "quite detailed and thorough, and full of examples. Having gone through this " diff --git a/howto/free-threading-python.po b/howto/free-threading-python.po index d2f09a2deb..fe26e49d23 100644 --- a/howto/free-threading-python.po +++ b/howto/free-threading-python.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. @@ -20,7 +19,7 @@ msgstr "" #: ../../howto/free-threading-python.rst:5 msgid "Python experimental support for free threading" -msgstr "" +msgstr "Python 自由執行緒的實驗性支援" #: ../../howto/free-threading-python.rst:7 msgid "" @@ -54,7 +53,7 @@ msgstr "" #: ../../howto/free-threading-python.rst:28 msgid "Installation" -msgstr "" +msgstr "安裝" #: ../../howto/free-threading-python.rst:30 msgid "" @@ -130,7 +129,7 @@ msgstr "https://hugovk.github.io/free-threaded-wheels/" #: ../../howto/free-threading-python.rst:75 msgid "Thread safety" -msgstr "" +msgstr "執行緒安全" #: ../../howto/free-threading-python.rst:77 msgid "" @@ -153,7 +152,7 @@ msgstr "" #: ../../howto/free-threading-python.rst:94 msgid "Known limitations" -msgstr "" +msgstr "已知限制" #: ../../howto/free-threading-python.rst:96 msgid "" @@ -162,7 +161,7 @@ msgstr "" #: ../../howto/free-threading-python.rst:99 msgid "Immortalization" -msgstr "" +msgstr "不滅化 (Immortalization)" #: ../../howto/free-threading-python.rst:101 msgid "" @@ -182,23 +181,23 @@ msgstr "" #: ../../howto/free-threading-python.rst:109 msgid "" ":ref:`function <user-defined-funcs>` objects declared at the module level" -msgstr "" +msgstr "在模組層級宣告的\\ :ref:`函式 <user-defined-funcs>`\\ 物件" #: ../../howto/free-threading-python.rst:110 msgid ":ref:`method <instance-methods>` descriptors" -msgstr "" +msgstr ":ref:`方法 <instance-methods>`\\ 描述器" #: ../../howto/free-threading-python.rst:111 msgid ":ref:`code <code-objects>` objects" -msgstr "" +msgstr ":ref:`程式碼 <code-objects>`\\ 物件" #: ../../howto/free-threading-python.rst:112 msgid ":term:`module` objects and their dictionaries" -msgstr "" +msgstr ":term:`模組 <module>`\\ 物件及其字典" #: ../../howto/free-threading-python.rst:113 msgid ":ref:`classes <classes>` (type objects)" -msgstr "" +msgstr ":ref:`類別 <classes>`\\ (型別物件)" #: ../../howto/free-threading-python.rst:115 msgid "" @@ -241,7 +240,7 @@ msgstr "" #: ../../howto/free-threading-python.rst:143 msgid "Single-threaded performance" -msgstr "" +msgstr "單執行緒效能" #: ../../howto/free-threading-python.rst:145 msgid "" diff --git a/howto/functional.po b/howto/functional.po index a145631968..15ccb13599 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -164,23 +164,23 @@ msgstr "" #: ../../howto/functional.rst:94 msgid "Formal provability." -msgstr "" +msgstr "形式可證明性 (Formal provability)。" #: ../../howto/functional.rst:95 msgid "Modularity." -msgstr "" +msgstr "模組化 (Modularity)。" #: ../../howto/functional.rst:96 msgid "Composability." -msgstr "" +msgstr "可組合性 (Composability)。" #: ../../howto/functional.rst:97 msgid "Ease of debugging and testing." -msgstr "" +msgstr "容易除錯與測試。" #: ../../howto/functional.rst:101 msgid "Formal provability" -msgstr "" +msgstr "形式可證明性" #: ../../howto/functional.rst:103 msgid "" @@ -231,7 +231,7 @@ msgstr "" #: ../../howto/functional.rst:137 msgid "Modularity" -msgstr "" +msgstr "模組化" #: ../../howto/functional.rst:139 msgid "" @@ -244,7 +244,7 @@ msgstr "" #: ../../howto/functional.rst:147 msgid "Ease of debugging and testing" -msgstr "" +msgstr "容易除錯與測試" #: ../../howto/functional.rst:149 msgid "Testing and debugging a functional-style program is easier." @@ -269,7 +269,7 @@ msgstr "" #: ../../howto/functional.rst:163 msgid "Composability" -msgstr "" +msgstr "可組合性" #: ../../howto/functional.rst:165 msgid "" @@ -498,7 +498,7 @@ msgstr "" #: ../../howto/functional.rst:333 msgid "Generator expressions and list comprehensions" -msgstr "" +msgstr "產生器運算式與串列綜合運算式" #: ../../howto/functional.rst:335 msgid "" @@ -527,6 +527,13 @@ msgid "" ">>> # List comprehension -- returns list\n" ">>> stripped_list = [line.strip() for line in line_list]" msgstr "" +">>> line_list = [' line 1\\n', 'line 2 \\n', ' \\n', '']\n" +"\n" +">>> # 產生器運算式 -- 回傳疊代器\n" +">>> stripped_iter = (line.strip() for line in line_list)\n" +"\n" +">>> # 串列綜合運算式 -- 回傳串列\n" +">>> stripped_list = [line.strip() for line in line_list]" #: ../../howto/functional.rst:354 msgid "" @@ -692,7 +699,7 @@ msgstr "" #: ../../howto/functional.rst:454 msgid "Here's the simplest example of a generator function:" -msgstr "" +msgstr "以下是最簡單的產生器函式範例:" #: ../../howto/functional.rst:460 msgid "" @@ -715,7 +722,7 @@ msgstr "" #: ../../howto/functional.rst:473 msgid "Here's a sample usage of the ``generate_ints()`` generator:" -msgstr "" +msgstr "以下是 ``generate_ints()`` 產生器的使用範例:" #: ../../howto/functional.rst:490 msgid "" @@ -840,6 +847,15 @@ msgid "" " else:\n" " i += 1" msgstr "" +"def counter(maximum):\n" +" i = 0\n" +" while i < maximum:\n" +" val = (yield i)\n" +" # 如有提供值則改變計數器\n" +" if val is not None:\n" +" i = val\n" +" else:\n" +" i += 1" #: ../../howto/functional.rst:576 msgid "And here's an example of changing the counter:" @@ -917,12 +933,14 @@ msgstr "" #: ../../howto/functional.rst:633 msgid "" ":func:`map(f, iterA, iterB, ...) <map>` returns an iterator over the sequence" -msgstr "" +msgstr ":func:`map(f, iterA, iterB, ...) <map>` 回傳一個元素為序列的疊代器" #: ../../howto/functional.rst:634 msgid "" "``f(iterA[0], iterB[0]), f(iterA[1], iterB[1]), f(iterA[2], iterB[2]), ...``." msgstr "" +"``f(iterA[0], iterB[0]), f(iterA[1], iterB[1]), f(iterA[2], iterB[2]), ..." +"``。" #: ../../howto/functional.rst:644 msgid "You can of course achieve the same effect with a list comprehension." diff --git a/howto/perf_profiling.po b/howto/perf_profiling.po index d89ee4250b..0274ff095f 100644 --- a/howto/perf_profiling.po +++ b/howto/perf_profiling.po @@ -115,7 +115,7 @@ msgstr "" #: ../../howto/perf_profiling.rst:55 msgid "We can run ``perf`` to sample CPU stack traces at 9999 hertz::" -msgstr "我們可以執行 ``perf`` 以 9999 赫茲採樣 CPU 堆疊追蹤 (stack trace): ::" +msgstr "我們可以執行 ``perf`` 以 9999 赫茲取樣 CPU 堆疊追蹤 (stack trace): ::" #: ../../howto/perf_profiling.rst:57 msgid "$ perf record -F 9999 -g -o perf.data python my_script.py" diff --git a/howto/sorting.po b/howto/sorting.po index f66a0870ce..dcdc529f4e 100644 --- a/howto/sorting.po +++ b/howto/sorting.po @@ -697,7 +697,7 @@ msgid "" msgstr "" ":func:`heapq.nsmallest` 以及 :func:`heapq.nlargest` 會分別回傳 *n* 個最小值及" "最大值。這些函式會將資料進行一次傳遞且一次只會保留 *n* 個元素在記憶體中。對於" -"相對於輸入數量較小的 *n* 個值,這些函數進行的比較比完整排序要少得多。" +"相對於輸入數量較小的 *n* 個值,這些函式進行的比較比完整排序要少得多。" #: ../../howto/sorting.rst:342 msgid "" diff --git a/library/_thread.po b/library/_thread.po index 91130e2cc2..1dbd585c96 100644 --- a/library/_thread.po +++ b/library/_thread.po @@ -319,7 +319,7 @@ msgid "" "Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is " "equivalent to calling :func:`_thread.exit`." msgstr "" -"呼叫 :func:`sys.exit` 函數或引發 :exc:`SystemExit` 例外等同於呼叫 :func:" +"呼叫 :func:`sys.exit` 函式或引發 :exc:`SystemExit` 例外等同於呼叫 :func:" "`_thread.exit` 函式。" #: ../../library/_thread.rst:222 diff --git a/library/argparse.po b/library/argparse.po index 4bdf1f6631..b0188fae49 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-23 00:14+0000\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,24 +21,37 @@ msgstr "" msgid "" ":mod:`!argparse` --- Parser for command-line options, arguments and " "subcommands" -msgstr "" +msgstr ":mod:`!argparse` --- 命令列選項、引數和子命令的剖析器" #: ../../library/argparse.rst:12 msgid "**Source code:** :source:`Lib/argparse.py`" msgstr "**原始碼:**\\ :source:`Lib/argparse.py`" +#: ../../library/argparse.rst:16 +msgid "" +"While :mod:`argparse` is the default recommended standard library module for " +"implementing basic command line applications, authors with more exacting " +"requirements for exactly how their command line applications behave may find " +"it doesn't provide the necessary level of control. Refer to :ref:`choosing-" +"an-argument-parser` for alternatives to consider when ``argparse`` doesn't " +"support behaviors that the application requires (such as entirely disabling " +"support for interspersed options and positional arguments, or accepting " +"option parameter values that start with ``-`` even when they correspond to " +"another defined option)." +msgstr "" + #: ../../library/argparse.rst:-1 msgid "Tutorial" msgstr "教學" -#: ../../library/argparse.rst:18 +#: ../../library/argparse.rst:30 msgid "" "This page contains the API reference information. For a more gentle " "introduction to Python command-line parsing, have a look at the :ref:" "`argparse tutorial <argparse-tutorial>`." msgstr "" -#: ../../library/argparse.rst:22 +#: ../../library/argparse.rst:34 msgid "" "The :mod:`!argparse` module makes it easy to write user-friendly command-" "line interfaces. The program defines what arguments it requires, and :mod:`!" @@ -49,7 +61,7 @@ msgid "" "invalid arguments." msgstr "" -#: ../../library/argparse.rst:28 +#: ../../library/argparse.rst:40 msgid "" "The :mod:`!argparse` module's support for command-line interfaces is built " "around an instance of :class:`argparse.ArgumentParser`. It is a container " @@ -57,177 +69,187 @@ msgid "" "whole::" msgstr "" -#: ../../library/argparse.rst:32 +#: ../../library/argparse.rst:44 msgid "" "parser = argparse.ArgumentParser(\n" " prog='ProgramName',\n" " description='What the program does',\n" " epilog='Text at the bottom of help')" msgstr "" +"parser = argparse.ArgumentParser(\n" +" prog='ProgramName',\n" +" description='What the program does',\n" +" epilog='Text at the bottom of help')" -#: ../../library/argparse.rst:37 +#: ../../library/argparse.rst:49 msgid "" "The :meth:`ArgumentParser.add_argument` method attaches individual argument " "specifications to the parser. It supports positional arguments, options " "that accept values, and on/off flags::" msgstr "" -#: ../../library/argparse.rst:41 +#: ../../library/argparse.rst:53 msgid "" "parser.add_argument('filename') # positional argument\n" "parser.add_argument('-c', '--count') # option that takes a value\n" "parser.add_argument('-v', '--verbose',\n" " action='http://github.com/store_true') # on/off flag" msgstr "" +"parser.add_argument('filename') # 位置引數\n" +"parser.add_argument('-c', '--count') # 接收一個值的選項\n" +"parser.add_argument('-v', '--verbose',\n" +" action='http://github.com/store_true') # 開關旗標" -#: ../../library/argparse.rst:46 +#: ../../library/argparse.rst:58 msgid "" "The :meth:`ArgumentParser.parse_args` method runs the parser and places the " "extracted data in a :class:`argparse.Namespace` object::" msgstr "" -#: ../../library/argparse.rst:49 +#: ../../library/argparse.rst:61 msgid "" "args = parser.parse_args()\n" "print(args.filename, args.count, args.verbose)" msgstr "" +"args = parser.parse_args()\n" +"print(args.filename, args.count, args.verbose)" -#: ../../library/argparse.rst:53 +#: ../../library/argparse.rst:65 msgid "" "If you're looking for a guide about how to upgrade :mod:`optparse` code to :" "mod:`!argparse`, see :ref:`Upgrading Optparse Code <upgrading-optparse-" "code>`." msgstr "" -#: ../../library/argparse.rst:57 +#: ../../library/argparse.rst:69 msgid "ArgumentParser objects" msgstr "ArgumentParser 物件" -#: ../../library/argparse.rst:66 +#: ../../library/argparse.rst:78 msgid "" "Create a new :class:`ArgumentParser` object. All parameters should be passed " "as keyword arguments. Each parameter has its own more detailed description " "below, but in short they are:" msgstr "" -#: ../../library/argparse.rst:70 +#: ../../library/argparse.rst:82 msgid "" "prog_ - The name of the program (default: ``os.path.basename(sys.argv[0])``)" -msgstr "" +msgstr "prog_ - 程式的名稱(預設值:``os.path.basename(sys.argv[0])``)" -#: ../../library/argparse.rst:73 +#: ../../library/argparse.rst:85 msgid "" "usage_ - The string describing the program usage (default: generated from " "arguments added to parser)" -msgstr "" +msgstr "usage_ - 描述程式用法的字串(預設值:從新增到剖析器的引數產生)" -#: ../../library/argparse.rst:76 +#: ../../library/argparse.rst:88 msgid "" "description_ - Text to display before the argument help (by default, no text)" -msgstr "" +msgstr "description_ - 引數說明之前要顯示的文字(預設值:無文字)" -#: ../../library/argparse.rst:79 +#: ../../library/argparse.rst:91 msgid "epilog_ - Text to display after the argument help (by default, no text)" -msgstr "" +msgstr "epilog_ - 引數說明之後要顯示的文字(預設值:無文字)" -#: ../../library/argparse.rst:81 +#: ../../library/argparse.rst:93 msgid "" "parents_ - A list of :class:`ArgumentParser` objects whose arguments should " "also be included" -msgstr "" +msgstr "parents_ - 一個 :class:`ArgumentParser` 物件的串列,其引數也應該被包含" -#: ../../library/argparse.rst:84 +#: ../../library/argparse.rst:96 msgid "formatter_class_ - A class for customizing the help output" -msgstr "" +msgstr "formatter_class_ - 用於自訂說明輸出的類別" -#: ../../library/argparse.rst:86 +#: ../../library/argparse.rst:98 msgid "" "prefix_chars_ - The set of characters that prefix optional arguments " "(default: '-')" -msgstr "" +msgstr "prefix_chars_ - 前綴可選引數的字元集合(預設值:'-')" -#: ../../library/argparse.rst:89 +#: ../../library/argparse.rst:101 msgid "" "fromfile_prefix_chars_ - The set of characters that prefix files from which " "additional arguments should be read (default: ``None``)" msgstr "" -#: ../../library/argparse.rst:92 +#: ../../library/argparse.rst:104 msgid "" "argument_default_ - The global default value for arguments (default: " "``None``)" msgstr "" -#: ../../library/argparse.rst:95 +#: ../../library/argparse.rst:107 msgid "" "conflict_handler_ - The strategy for resolving conflicting optionals " "(usually unnecessary)" msgstr "" -#: ../../library/argparse.rst:98 +#: ../../library/argparse.rst:110 msgid "" "add_help_ - Add a ``-h/--help`` option to the parser (default: ``True``)" msgstr "" -#: ../../library/argparse.rst:100 +#: ../../library/argparse.rst:112 msgid "" "allow_abbrev_ - Allows long options to be abbreviated if the abbreviation is " "unambiguous. (default: ``True``)" msgstr "" -#: ../../library/argparse.rst:103 +#: ../../library/argparse.rst:115 msgid "" "exit_on_error_ - Determines whether or not :class:`!ArgumentParser` exits " "with error info when an error occurs. (default: ``True``)" msgstr "" -#: ../../library/argparse.rst:106 +#: ../../library/argparse.rst:118 msgid "*allow_abbrev* parameter was added." msgstr "新增 *allow_abbrev* 參數。" -#: ../../library/argparse.rst:109 +#: ../../library/argparse.rst:121 msgid "" "In previous versions, *allow_abbrev* also disabled grouping of short flags " "such as ``-vv`` to mean ``-v -v``." msgstr "" -#: ../../library/argparse.rst:113 +#: ../../library/argparse.rst:125 msgid "*exit_on_error* parameter was added." msgstr "新增 *exit_on_error* 參數。" -#: ../../library/argparse.rst:116 ../../library/argparse.rst:598 +#: ../../library/argparse.rst:128 ../../library/argparse.rst:610 msgid "The following sections describe how each of these are used." msgstr "" -#: ../../library/argparse.rst:122 +#: ../../library/argparse.rst:134 msgid "prog" -msgstr "" +msgstr "prog" -#: ../../library/argparse.rst:125 +#: ../../library/argparse.rst:137 msgid "" "By default, :class:`ArgumentParser` calculates the name of the program to " "display in help messages depending on the way the Python interpreter was run:" msgstr "" -#: ../../library/argparse.rst:128 +#: ../../library/argparse.rst:140 msgid "" "The :func:`base name <os.path.basename>` of ``sys.argv[0]`` if a file was " "passed as argument." msgstr "" -#: ../../library/argparse.rst:130 +#: ../../library/argparse.rst:142 msgid "" "The Python interpreter name followed by ``sys.argv[0]`` if a directory or a " "zipfile was passed as argument." msgstr "" -#: ../../library/argparse.rst:132 +#: ../../library/argparse.rst:144 msgid "" "The Python interpreter name followed by ``-m`` followed by the module or " "package name if the :option:`-m` option was used." msgstr "" -#: ../../library/argparse.rst:135 +#: ../../library/argparse.rst:147 msgid "" "This default is almost always desirable because it will make the help " "messages match the string that was used to invoke the program on the command " @@ -235,7 +257,7 @@ msgid "" "supplied using the ``prog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:140 +#: ../../library/argparse.rst:152 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.print_help()\n" @@ -251,14 +273,14 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:147 +#: ../../library/argparse.rst:159 msgid "" "Note that the program name, whether determined from ``sys.argv[0]`` or from " "the ``prog=`` argument, is available to help messages using the ``%(prog)s`` " "format specifier." msgstr "" -#: ../../library/argparse.rst:153 +#: ../../library/argparse.rst:165 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.add_argument('--foo', help='foo of the %(prog)s program')\n" @@ -278,18 +300,18 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO foo of the myprogram program" -#: ../../library/argparse.rst:164 +#: ../../library/argparse.rst:176 msgid "usage" -msgstr "" +msgstr "usage" -#: ../../library/argparse.rst:166 +#: ../../library/argparse.rst:178 msgid "" "By default, :class:`ArgumentParser` calculates the usage message from the " "arguments it contains. The default message can be overridden with the " "``usage=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:170 +#: ../../library/argparse.rst:182 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s " "[options]')\n" @@ -319,17 +341,17 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo [FOO] foo help" -#: ../../library/argparse.rst:183 +#: ../../library/argparse.rst:195 msgid "" "The ``%(prog)s`` format specifier is available to fill in the program name " "in your usage messages." msgstr "" -#: ../../library/argparse.rst:190 +#: ../../library/argparse.rst:202 msgid "description" -msgstr "描述" +msgstr "description" -#: ../../library/argparse.rst:192 +#: ../../library/argparse.rst:204 msgid "" "Most calls to the :class:`ArgumentParser` constructor will use the " "``description=`` keyword argument. This argument gives a brief description " @@ -338,24 +360,24 @@ msgid "" "messages for the various arguments." msgstr "" -#: ../../library/argparse.rst:198 +#: ../../library/argparse.rst:210 msgid "" "By default, the description will be line-wrapped so that it fits within the " "given space. To change this behavior, see the formatter_class_ argument." msgstr "" -#: ../../library/argparse.rst:203 +#: ../../library/argparse.rst:215 msgid "epilog" -msgstr "" +msgstr "epilog" -#: ../../library/argparse.rst:205 +#: ../../library/argparse.rst:217 msgid "" "Some programs like to display additional description of the program after " "the description of the arguments. Such text can be specified using the " "``epilog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:209 +#: ../../library/argparse.rst:221 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... description='A foo that bars',\n" @@ -383,18 +405,18 @@ msgstr "" "\n" "And that's how you'd foo a bar" -#: ../../library/argparse.rst:222 +#: ../../library/argparse.rst:234 msgid "" "As with the description_ argument, the ``epilog=`` text is by default line-" "wrapped, but this behavior can be adjusted with the formatter_class_ " "argument to :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:228 +#: ../../library/argparse.rst:240 msgid "parents" -msgstr "" +msgstr "parents" -#: ../../library/argparse.rst:230 +#: ../../library/argparse.rst:242 msgid "" "Sometimes, several parsers share a common set of arguments. Rather than " "repeating the definitions of these arguments, a single parser with all the " @@ -405,7 +427,7 @@ msgid "" "object being constructed::" msgstr "" -#: ../../library/argparse.rst:237 +#: ../../library/argparse.rst:249 msgid "" ">>> parent_parser = argparse.ArgumentParser(add_help=False)\n" ">>> parent_parser.add_argument('--parent', type=int)\n" @@ -433,32 +455,32 @@ msgstr "" ">>> bar_parser.parse_args(['--bar', 'YYY'])\n" "Namespace(bar='YYY', parent=None)" -#: ../../library/argparse.rst:250 +#: ../../library/argparse.rst:262 msgid "" "Note that most parent parsers will specify ``add_help=False``. Otherwise, " "the :class:`ArgumentParser` will see two ``-h/--help`` options (one in the " "parent and one in the child) and raise an error." msgstr "" -#: ../../library/argparse.rst:255 +#: ../../library/argparse.rst:267 msgid "" "You must fully initialize the parsers before passing them via ``parents=``. " "If you change the parent parsers after the child parser, those changes will " "not be reflected in the child." msgstr "" -#: ../../library/argparse.rst:263 +#: ../../library/argparse.rst:275 msgid "formatter_class" msgstr "formatter_class" -#: ../../library/argparse.rst:265 +#: ../../library/argparse.rst:277 msgid "" ":class:`ArgumentParser` objects allow the help formatting to be customized " "by specifying an alternate formatting class. Currently, there are four such " "classes:" msgstr "" -#: ../../library/argparse.rst:274 +#: ../../library/argparse.rst:286 msgid "" ":class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give " "more control over how textual descriptions are displayed. By default, :class:" @@ -466,7 +488,7 @@ msgid "" "command-line help messages::" msgstr "" -#: ../../library/argparse.rst:279 +#: ../../library/argparse.rst:291 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -490,14 +512,14 @@ msgid "" "will be wrapped across a couple lines" msgstr "" -#: ../../library/argparse.rst:299 +#: ../../library/argparse.rst:311 msgid "" "Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` " "indicates that description_ and epilog_ are already correctly formatted and " "should not be line-wrapped::" msgstr "" -#: ../../library/argparse.rst:303 +#: ../../library/argparse.rst:315 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -521,8 +543,29 @@ msgid "" "options:\n" " -h, --help show this help message and exit" msgstr "" +">>> parser = argparse.ArgumentParser(\n" +"... prog='PROG',\n" +"... formatter_class=argparse.RawDescriptionHelpFormatter,\n" +"... description=textwrap.dedent('''\\\n" +"... Please do not mess up this text!\n" +"... --------------------------------\n" +"... I have indented it\n" +"... exactly the way\n" +"... I want it\n" +"... '''))\n" +">>> parser.print_help()\n" +"usage: PROG [-h]\n" +"\n" +"Please do not mess up this text!\n" +"--------------------------------\n" +" I have indented it\n" +" exactly the way\n" +" I want it\n" +"\n" +"options:\n" +" -h, --help show this help message and exit" -#: ../../library/argparse.rst:325 +#: ../../library/argparse.rst:337 msgid "" ":class:`RawTextHelpFormatter` maintains whitespace for all sorts of help " "text, including argument descriptions. However, multiple newlines are " @@ -530,13 +573,13 @@ msgid "" "between the newlines." msgstr "" -#: ../../library/argparse.rst:330 +#: ../../library/argparse.rst:342 msgid "" ":class:`ArgumentDefaultsHelpFormatter` automatically adds information about " "default values to each of the argument help messages::" msgstr "" -#: ../../library/argparse.rst:333 +#: ../../library/argparse.rst:345 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -568,14 +611,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO FOO! (default: 42)" -#: ../../library/argparse.rst:348 +#: ../../library/argparse.rst:360 msgid "" ":class:`MetavarTypeHelpFormatter` uses the name of the type_ argument for " "each argument as the display name for its values (rather than using the " "dest_ as the regular formatter does)::" msgstr "" -#: ../../library/argparse.rst:352 +#: ../../library/argparse.rst:364 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -607,11 +650,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo int" -#: ../../library/argparse.rst:369 +#: ../../library/argparse.rst:381 msgid "prefix_chars" msgstr "prefix_chars" -#: ../../library/argparse.rst:371 +#: ../../library/argparse.rst:383 msgid "" "Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. " "Parsers that need to support different or additional prefix characters, e.g. " @@ -619,7 +662,7 @@ msgid "" "``prefix_chars=`` argument to the :class:`ArgumentParser` constructor::" msgstr "" -#: ../../library/argparse.rst:377 +#: ../../library/argparse.rst:389 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')\n" ">>> parser.add_argument('+f')\n" @@ -633,18 +676,18 @@ msgstr "" ">>> parser.parse_args('+f X ++bar Y'.split())\n" "Namespace(bar='Y', f='X')" -#: ../../library/argparse.rst:383 +#: ../../library/argparse.rst:395 msgid "" "The ``prefix_chars=`` argument defaults to ``'-'``. Supplying a set of " "characters that does not include ``-`` will cause ``-f/--foo`` options to be " "disallowed." msgstr "" -#: ../../library/argparse.rst:389 +#: ../../library/argparse.rst:401 msgid "fromfile_prefix_chars" msgstr "fromfile_prefix_chars" -#: ../../library/argparse.rst:391 +#: ../../library/argparse.rst:403 msgid "" "Sometimes, when dealing with a particularly long argument list, it may make " "sense to keep the list of arguments in a file rather than typing it out at " @@ -654,7 +697,7 @@ msgid "" "by the arguments they contain. For example::" msgstr "" -#: ../../library/argparse.rst:398 +#: ../../library/argparse.rst:410 msgid "" ">>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:\n" "... fp.write('-f\\nbar')\n" @@ -672,7 +715,7 @@ msgstr "" ">>> parser.parse_args(['-f', 'foo', '@args.txt'])\n" "Namespace(f='bar')" -#: ../../library/argparse.rst:406 +#: ../../library/argparse.rst:418 msgid "" "Arguments read from a file must by default be one per line (but see also :" "meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they " @@ -682,19 +725,19 @@ msgid "" "f', 'bar']``." msgstr "" -#: ../../library/argparse.rst:412 +#: ../../library/argparse.rst:424 msgid "" ":class:`ArgumentParser` uses :term:`filesystem encoding and error handler` " "to read the file containing arguments." msgstr "" -#: ../../library/argparse.rst:415 +#: ../../library/argparse.rst:427 msgid "" "The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that " "arguments will never be treated as file references." msgstr "" -#: ../../library/argparse.rst:418 +#: ../../library/argparse.rst:430 msgid "" ":class:`ArgumentParser` changed encoding and errors to read arguments files " "from default (e.g. :func:`locale.getpreferredencoding(False) <locale." @@ -703,11 +746,11 @@ msgid "" "ANSI Codepage on Windows." msgstr "" -#: ../../library/argparse.rst:426 +#: ../../library/argparse.rst:438 msgid "argument_default" msgstr "argument_default" -#: ../../library/argparse.rst:428 +#: ../../library/argparse.rst:440 msgid "" "Generally, argument defaults are specified either by passing a default to :" "meth:`~ArgumentParser.add_argument` or by calling the :meth:`~ArgumentParser." @@ -719,7 +762,7 @@ msgid "" "supply ``argument_default=SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:437 +#: ../../library/argparse.rst:449 msgid "" ">>> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)\n" ">>> parser.add_argument('--foo')\n" @@ -737,22 +780,22 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace()" -#: ../../library/argparse.rst:448 +#: ../../library/argparse.rst:460 msgid "allow_abbrev" msgstr "allow_abbrev" -#: ../../library/argparse.rst:450 +#: ../../library/argparse.rst:462 msgid "" "Normally, when you pass an argument list to the :meth:`~ArgumentParser." "parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes " "abbreviations <prefix-matching>` of long options." msgstr "" -#: ../../library/argparse.rst:454 +#: ../../library/argparse.rst:466 msgid "This feature can be disabled by setting ``allow_abbrev`` to ``False``::" msgstr "" -#: ../../library/argparse.rst:456 +#: ../../library/argparse.rst:468 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False)\n" ">>> parser.add_argument('--foobar', action='http://github.com/store_true')\n" @@ -768,11 +811,11 @@ msgstr "" "usage: PROG [-h] [--foobar] [--foonley]\n" "PROG: error: unrecognized arguments: --foon" -#: ../../library/argparse.rst:467 +#: ../../library/argparse.rst:479 msgid "conflict_handler" msgstr "conflict_handler" -#: ../../library/argparse.rst:469 +#: ../../library/argparse.rst:481 msgid "" ":class:`ArgumentParser` objects do not allow two actions with the same " "option string. By default, :class:`ArgumentParser` objects raise an " @@ -780,7 +823,7 @@ msgid "" "that is already in use::" msgstr "" -#: ../../library/argparse.rst:474 +#: ../../library/argparse.rst:486 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo', help='old foo help')\n" @@ -796,7 +839,7 @@ msgstr "" " ..\n" "ArgumentError: argument --foo: conflicting option string(s): --foo" -#: ../../library/argparse.rst:481 +#: ../../library/argparse.rst:493 msgid "" "Sometimes (e.g. when using parents_) it may be useful to simply override any " "older arguments with the same option string. To get this behavior, the " @@ -804,7 +847,7 @@ msgid "" "of :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:486 +#: ../../library/argparse.rst:498 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', " "conflict_handler='resolve')\n" @@ -830,7 +873,7 @@ msgstr "" " -f FOO old foo help\n" " --foo FOO new foo help" -#: ../../library/argparse.rst:497 +#: ../../library/argparse.rst:509 msgid "" "Note that :class:`ArgumentParser` objects only remove an action if all of " "its option strings are overridden. So, in the example above, the old ``-f/--" @@ -838,25 +881,25 @@ msgid "" "option string was overridden." msgstr "" -#: ../../library/argparse.rst:504 +#: ../../library/argparse.rst:516 msgid "add_help" msgstr "add_help" -#: ../../library/argparse.rst:506 +#: ../../library/argparse.rst:518 msgid "" "By default, :class:`ArgumentParser` objects add an option which simply " "displays the parser's help message. If ``-h`` or ``--help`` is supplied at " "the command line, the :class:`!ArgumentParser` help will be printed." msgstr "" -#: ../../library/argparse.rst:510 +#: ../../library/argparse.rst:522 msgid "" "Occasionally, it may be useful to disable the addition of this help option. " "This can be achieved by passing ``False`` as the ``add_help=`` argument to :" "class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:514 +#: ../../library/argparse.rst:526 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> parser.add_argument('--foo', help='foo help')\n" @@ -874,7 +917,7 @@ msgstr "" "options:\n" " --foo FOO foo help" -#: ../../library/argparse.rst:522 +#: ../../library/argparse.rst:534 msgid "" "The help option is typically ``-h/--help``. The exception to this is if the " "``prefix_chars=`` is specified and does not include ``-``, in which case ``-" @@ -882,7 +925,7 @@ msgid "" "in ``prefix_chars`` is used to prefix the help options::" msgstr "" -#: ../../library/argparse.rst:528 +#: ../../library/argparse.rst:540 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')\n" ">>> parser.print_help()\n" @@ -898,24 +941,24 @@ msgstr "" "options:\n" " +h, ++help show this help message and exit" -#: ../../library/argparse.rst:537 +#: ../../library/argparse.rst:549 msgid "exit_on_error" msgstr "exit_on_error" -#: ../../library/argparse.rst:539 +#: ../../library/argparse.rst:551 msgid "" "Normally, when you pass an invalid argument list to the :meth:" "`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will " "print a *message* to :data:`sys.stderr` and exit with a status code of 2." msgstr "" -#: ../../library/argparse.rst:543 +#: ../../library/argparse.rst:555 msgid "" "If the user would like to catch errors manually, the feature can be enabled " "by setting ``exit_on_error`` to ``False``::" msgstr "" -#: ../../library/argparse.rst:546 +#: ../../library/argparse.rst:558 msgid "" ">>> parser = argparse.ArgumentParser(exit_on_error=False)\n" ">>> parser.add_argument('--integers', type=int)\n" @@ -941,81 +984,81 @@ msgstr "" "...\n" "Catching an argumentError" -#: ../../library/argparse.rst:560 +#: ../../library/argparse.rst:572 msgid "The add_argument() method" -msgstr "" +msgstr "add_argument() 方法" -#: ../../library/argparse.rst:566 +#: ../../library/argparse.rst:578 msgid "" "Define how a single command-line argument should be parsed. Each parameter " "has its own more detailed description below, but in short they are:" msgstr "" -#: ../../library/argparse.rst:569 +#: ../../library/argparse.rst:581 msgid "" "`name or flags`_ - Either a name or a list of option strings, e.g. ``'foo'`` " "or ``'-f', '--foo'``." msgstr "" -#: ../../library/argparse.rst:572 +#: ../../library/argparse.rst:584 msgid "" "action_ - The basic type of action to be taken when this argument is " "encountered at the command line." msgstr "" -#: ../../library/argparse.rst:575 +#: ../../library/argparse.rst:587 msgid "nargs_ - The number of command-line arguments that should be consumed." msgstr "" -#: ../../library/argparse.rst:577 +#: ../../library/argparse.rst:589 msgid "" "const_ - A constant value required by some action_ and nargs_ selections." msgstr "" -#: ../../library/argparse.rst:579 +#: ../../library/argparse.rst:591 msgid "" "default_ - The value produced if the argument is absent from the command " "line and if it is absent from the namespace object." msgstr "" -#: ../../library/argparse.rst:582 +#: ../../library/argparse.rst:594 msgid "" "type_ - The type to which the command-line argument should be converted." msgstr "" -#: ../../library/argparse.rst:584 +#: ../../library/argparse.rst:596 msgid "choices_ - A sequence of the allowable values for the argument." msgstr "" -#: ../../library/argparse.rst:586 +#: ../../library/argparse.rst:598 msgid "" "required_ - Whether or not the command-line option may be omitted (optionals " "only)." msgstr "" -#: ../../library/argparse.rst:589 +#: ../../library/argparse.rst:601 msgid "help_ - A brief description of what the argument does." msgstr "" -#: ../../library/argparse.rst:591 +#: ../../library/argparse.rst:603 msgid "metavar_ - A name for the argument in usage messages." msgstr "" -#: ../../library/argparse.rst:593 +#: ../../library/argparse.rst:605 msgid "" "dest_ - The name of the attribute to be added to the object returned by :" "meth:`parse_args`." msgstr "" -#: ../../library/argparse.rst:596 +#: ../../library/argparse.rst:608 msgid "deprecated_ - Whether or not use of the argument is deprecated." msgstr "" -#: ../../library/argparse.rst:604 +#: ../../library/argparse.rst:616 msgid "name or flags" -msgstr "" +msgstr "name or flags" -#: ../../library/argparse.rst:606 +#: ../../library/argparse.rst:618 msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " @@ -1024,30 +1067,30 @@ msgid "" "or a simple argument name." msgstr "" -#: ../../library/argparse.rst:612 +#: ../../library/argparse.rst:624 msgid "For example, an optional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:614 +#: ../../library/argparse.rst:626 msgid ">>> parser.add_argument('-f', '--foo')" msgstr ">>> parser.add_argument('-f', '--foo')" -#: ../../library/argparse.rst:616 +#: ../../library/argparse.rst:628 msgid "while a positional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:618 +#: ../../library/argparse.rst:630 msgid ">>> parser.add_argument('bar')" msgstr ">>> parser.add_argument('bar')" -#: ../../library/argparse.rst:620 +#: ../../library/argparse.rst:632 msgid "" "When :meth:`~ArgumentParser.parse_args` is called, optional arguments will " "be identified by the ``-`` prefix, and the remaining arguments will be " "assumed to be positional::" msgstr "" -#: ../../library/argparse.rst:624 +#: ../../library/argparse.rst:636 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo')\n" @@ -1071,11 +1114,11 @@ msgstr "" "usage: PROG [-h] [-f FOO] bar\n" "PROG: error: the following arguments are required: bar" -#: ../../library/argparse.rst:639 +#: ../../library/argparse.rst:651 msgid "action" -msgstr "" +msgstr "action" -#: ../../library/argparse.rst:641 +#: ../../library/argparse.rst:653 msgid "" ":class:`ArgumentParser` objects associate command-line arguments with " "actions. These actions can do just about anything with the command-line " @@ -1085,13 +1128,13 @@ msgid "" "be handled. The supplied actions are:" msgstr "" -#: ../../library/argparse.rst:647 +#: ../../library/argparse.rst:659 msgid "" "``'store'`` - This just stores the argument's value. This is the default " "action." msgstr "" -#: ../../library/argparse.rst:650 +#: ../../library/argparse.rst:662 msgid "" "``'store_const'`` - This stores the value specified by the const_ keyword " "argument; note that the const_ keyword argument defaults to ``None``. The " @@ -1099,7 +1142,7 @@ msgid "" "specify some sort of flag. For example::" msgstr "" -#: ../../library/argparse.rst:655 +#: ../../library/argparse.rst:667 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/store_const', const=42)\n" @@ -1111,7 +1154,7 @@ msgstr "" ">>> parser.parse_args(['--foo'])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:660 +#: ../../library/argparse.rst:672 msgid "" "``'store_true'`` and ``'store_false'`` - These are special cases of " "``'store_const'`` used for storing the values ``True`` and ``False`` " @@ -1119,7 +1162,7 @@ msgid "" "``True`` respectively::" msgstr "" -#: ../../library/argparse.rst:665 +#: ../../library/argparse.rst:677 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/store_true')\n" @@ -1135,7 +1178,7 @@ msgstr "" ">>> parser.parse_args('--foo --bar'.split())\n" "Namespace(foo=True, bar=False, baz=True)" -#: ../../library/argparse.rst:672 +#: ../../library/argparse.rst:684 msgid "" "``'append'`` - This stores a list, and appends each argument value to the " "list. It is useful to allow an option to be specified multiple times. If the " @@ -1144,7 +1187,7 @@ msgid "" "after those default values. Example usage::" msgstr "" -#: ../../library/argparse.rst:678 +#: ../../library/argparse.rst:690 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/append')\n" @@ -1156,7 +1199,7 @@ msgstr "" ">>> parser.parse_args('--foo 1 --foo 2'.split())\n" "Namespace(foo=['1', '2'])" -#: ../../library/argparse.rst:683 +#: ../../library/argparse.rst:695 msgid "" "``'append_const'`` - This stores a list, and appends the value specified by " "the const_ keyword argument to the list; note that the const_ keyword " @@ -1165,7 +1208,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:689 +#: ../../library/argparse.rst:701 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--str', dest='types', action='http://github.com/append_const', " @@ -1183,7 +1226,7 @@ msgstr "" ">>> parser.parse_args('--str --int'.split())\n" "Namespace(types=[<class 'str'>, <class 'int'>])" -#: ../../library/argparse.rst:695 +#: ../../library/argparse.rst:707 msgid "" "``'extend'`` - This stores a list and appends each item from the multi-value " "argument list to it. The ``'extend'`` action is typically used with the " @@ -1192,7 +1235,7 @@ msgid "" "will be appended to the list. Example usage::" msgstr "" -#: ../../library/argparse.rst:703 +#: ../../library/argparse.rst:715 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " @@ -1208,13 +1251,13 @@ msgstr "" "\"f4\"])\n" "Namespace(foo=['f1', 'f2', 'f3', 'f4'])" -#: ../../library/argparse.rst:710 +#: ../../library/argparse.rst:722 msgid "" "``'count'`` - This counts the number of times a keyword argument occurs. For " "example, this is useful for increasing verbosity levels::" msgstr "" -#: ../../library/argparse.rst:713 +#: ../../library/argparse.rst:725 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--verbose', '-v', action='http://github.com/count', default=0)\n" @@ -1222,11 +1265,11 @@ msgid "" "Namespace(verbose=3)" msgstr "" -#: ../../library/argparse.rst:718 +#: ../../library/argparse.rst:730 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." msgstr "" -#: ../../library/argparse.rst:720 +#: ../../library/argparse.rst:732 msgid "" "``'help'`` - This prints a complete help message for all the options in the " "current parser and then exits. By default a help action is automatically " @@ -1234,14 +1277,14 @@ msgid "" "output is created." msgstr "" -#: ../../library/argparse.rst:725 +#: ../../library/argparse.rst:737 msgid "" "``'version'`` - This expects a ``version=`` keyword argument in the :meth:" "`~ArgumentParser.add_argument` call, and prints version information and " "exits when invoked::" msgstr "" -#: ../../library/argparse.rst:729 +#: ../../library/argparse.rst:741 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -1257,13 +1300,13 @@ msgstr "" ">>> parser.parse_args(['--version'])\n" "PROG 2.0" -#: ../../library/argparse.rst:735 +#: ../../library/argparse.rst:747 msgid "" "Only actions that consume command-line arguments (e.g. ``'store'``, " "``'append'`` or ``'extend'``) can be used with positional arguments." msgstr "" -#: ../../library/argparse.rst:740 +#: ../../library/argparse.rst:752 msgid "" "You may also specify an arbitrary action by passing an :class:`Action` " "subclass or other object that implements the same interface. The :class:`!" @@ -1271,7 +1314,7 @@ msgid "" "boolean actions such as ``--foo`` and ``--no-foo``::" msgstr "" -#: ../../library/argparse.rst:745 +#: ../../library/argparse.rst:757 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -1285,7 +1328,7 @@ msgstr "" ">>> parser.parse_args(['--no-foo'])\n" "Namespace(foo=False)" -#: ../../library/argparse.rst:753 +#: ../../library/argparse.rst:765 msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " "overriding the :meth:`!__call__` method and optionally the :meth:`!__init__` " @@ -1294,11 +1337,11 @@ msgid "" "their registered name." msgstr "" -#: ../../library/argparse.rst:758 +#: ../../library/argparse.rst:770 msgid "An example of a custom action::" msgstr "" -#: ../../library/argparse.rst:760 +#: ../../library/argparse.rst:772 msgid "" ">>> class FooAction(argparse.Action):\n" "... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" @@ -1319,15 +1362,15 @@ msgid "" "Namespace(bar='1', foo='2')" msgstr "" -#: ../../library/argparse.rst:778 +#: ../../library/argparse.rst:790 msgid "For more details, see :class:`Action`." msgstr "更多詳情請見 :class:`Action`。" -#: ../../library/argparse.rst:784 +#: ../../library/argparse.rst:796 msgid "nargs" msgstr "nargs" -#: ../../library/argparse.rst:786 +#: ../../library/argparse.rst:798 msgid "" ":class:`ArgumentParser` objects usually associate a single command-line " "argument with a single action to be taken. The ``nargs`` keyword argument " @@ -1336,13 +1379,13 @@ msgid "" "are:" msgstr "" -#: ../../library/argparse.rst:791 +#: ../../library/argparse.rst:803 msgid "" "``N`` (an integer). ``N`` arguments from the command line will be gathered " "together into a list. For example::" msgstr "" -#: ../../library/argparse.rst:794 +#: ../../library/argparse.rst:806 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs=2)\n" @@ -1356,13 +1399,13 @@ msgstr "" ">>> parser.parse_args('c --foo a b'.split())\n" "Namespace(bar=['c'], foo=['a', 'b'])" -#: ../../library/argparse.rst:800 +#: ../../library/argparse.rst:812 msgid "" "Note that ``nargs=1`` produces a list of one item. This is different from " "the default, in which the item is produced by itself." msgstr "" -#: ../../library/argparse.rst:805 +#: ../../library/argparse.rst:817 msgid "" "``'?'``. One argument will be consumed from the command line if possible, " "and produced as a single item. If no command-line argument is present, the " @@ -1372,7 +1415,7 @@ msgid "" "produced. Some examples to illustrate this::" msgstr "" -#: ../../library/argparse.rst:812 +#: ../../library/argparse.rst:824 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" @@ -1394,13 +1437,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(bar='d', foo='d')" -#: ../../library/argparse.rst:822 +#: ../../library/argparse.rst:834 msgid "" "One of the more common uses of ``nargs='?'`` is to allow optional input and " "output files::" msgstr "" -#: ../../library/argparse.rst:825 +#: ../../library/argparse.rst:837 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', nargs='?', type=argparse.FileType('r'),\n" @@ -1426,7 +1469,7 @@ msgstr "" "Namespace(infile=<_io.TextIOWrapper name='<stdin>' encoding='UTF-8'>,\n" " outfile=<_io.TextIOWrapper name='<stdout>' encoding='UTF-8'>)" -#: ../../library/argparse.rst:839 +#: ../../library/argparse.rst:851 msgid "" "``'*'``. All command-line arguments present are gathered into a list. Note " "that it generally doesn't make much sense to have more than one positional " @@ -1434,7 +1477,7 @@ msgid "" "``nargs='*'`` is possible. For example::" msgstr "" -#: ../../library/argparse.rst:844 +#: ../../library/argparse.rst:856 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='*')\n" @@ -1450,14 +1493,14 @@ msgstr "" ">>> parser.parse_args('a b --foo x y --bar 1 2'.split())\n" "Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])" -#: ../../library/argparse.rst:853 +#: ../../library/argparse.rst:865 msgid "" "``'+'``. Just like ``'*'``, all command-line args present are gathered into " "a list. Additionally, an error message will be generated if there wasn't at " "least one command-line argument present. For example::" msgstr "" -#: ../../library/argparse.rst:857 +#: ../../library/argparse.rst:869 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('foo', nargs='+')\n" @@ -1475,7 +1518,7 @@ msgstr "" "usage: PROG [-h] foo [foo ...]\n" "PROG: error: the following arguments are required: foo" -#: ../../library/argparse.rst:865 +#: ../../library/argparse.rst:877 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " @@ -1484,11 +1527,11 @@ msgid "" "``'store_const'``) set ``nargs=0``." msgstr "" -#: ../../library/argparse.rst:875 +#: ../../library/argparse.rst:887 msgid "const" -msgstr "" +msgstr "const" -#: ../../library/argparse.rst:877 +#: ../../library/argparse.rst:889 msgid "" "The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to " "hold constant values that are not read from the command line but are " @@ -1496,7 +1539,7 @@ msgid "" "common uses of it are:" msgstr "" -#: ../../library/argparse.rst:881 +#: ../../library/argparse.rst:893 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='http://github.com/store_const'`` or ``action='http://github.com/append_const'``. These actions add " @@ -1506,7 +1549,7 @@ msgid "" "receive a default value of ``None``." msgstr "" -#: ../../library/argparse.rst:889 +#: ../../library/argparse.rst:901 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with option strings " "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " @@ -1516,17 +1559,17 @@ msgid "" "to be ``None`` instead. See the nargs_ description for examples." msgstr "" -#: ../../library/argparse.rst:896 +#: ../../library/argparse.rst:908 msgid "" "``const=None`` by default, including when ``action='http://github.com/append_const'`` or " "``action='http://github.com/store_const'``." msgstr "" -#: ../../library/argparse.rst:903 +#: ../../library/argparse.rst:915 msgid "default" -msgstr "" +msgstr "default" -#: ../../library/argparse.rst:905 +#: ../../library/argparse.rst:917 msgid "" "All optional arguments and some positional arguments may be omitted at the " "command line. The ``default`` keyword argument of :meth:`~ArgumentParser." @@ -1536,7 +1579,7 @@ msgid "" "command line::" msgstr "" -#: ../../library/argparse.rst:912 +#: ../../library/argparse.rst:924 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1552,13 +1595,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:919 +#: ../../library/argparse.rst:931 msgid "" "If the target namespace already has an attribute set, the action *default* " "will not overwrite it::" msgstr "" -#: ../../library/argparse.rst:922 +#: ../../library/argparse.rst:934 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1570,7 +1613,7 @@ msgstr "" ">>> parser.parse_args([], namespace=argparse.Namespace(foo=101))\n" "Namespace(foo=101)" -#: ../../library/argparse.rst:927 +#: ../../library/argparse.rst:939 msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " @@ -1578,7 +1621,7 @@ msgid "" "`Namespace` return value. Otherwise, the parser uses the value as is::" msgstr "" -#: ../../library/argparse.rst:932 +#: ../../library/argparse.rst:944 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--length', default='10', type=int)\n" @@ -1592,13 +1635,13 @@ msgstr "" ">>> parser.parse_args()\n" "Namespace(length=10, width=10.5)" -#: ../../library/argparse.rst:938 +#: ../../library/argparse.rst:950 msgid "" "For positional arguments with nargs_ equal to ``?`` or ``*``, the " "``default`` value is used when no command-line argument was present::" msgstr "" -#: ../../library/argparse.rst:941 +#: ../../library/argparse.rst:953 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', nargs='?', default=42)\n" @@ -1614,20 +1657,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:948 +#: ../../library/argparse.rst:960 msgid "" "For required_ arguments, the ``default`` value is ignored. For example, this " "applies to positional arguments with nargs_ values other than ``?`` or " "``*``, or optional arguments marked as ``required=True``." msgstr "" -#: ../../library/argparse.rst:952 +#: ../../library/argparse.rst:964 msgid "" "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " "the command-line argument was not present::" msgstr "" -#: ../../library/argparse.rst:955 +#: ../../library/argparse.rst:967 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" @@ -1643,11 +1686,11 @@ msgstr "" ">>> parser.parse_args(['--foo', '1'])\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:966 +#: ../../library/argparse.rst:978 msgid "type" -msgstr "" +msgstr "type" -#: ../../library/argparse.rst:968 +#: ../../library/argparse.rst:980 msgid "" "By default, the parser reads command-line arguments in as simple strings. " "However, quite often the command-line string should instead be interpreted " @@ -1656,13 +1699,13 @@ msgid "" "checking and type conversions to be performed." msgstr "" -#: ../../library/argparse.rst:974 +#: ../../library/argparse.rst:986 msgid "" "If the type_ keyword is used with the default_ keyword, the type converter " "is only applied if the default is a string." msgstr "" -#: ../../library/argparse.rst:977 +#: ../../library/argparse.rst:989 msgid "" "The argument to ``type`` can be a callable that accepts a single string or " "the name of a registered type (see :meth:`~ArgumentParser.register`) If the " @@ -1671,11 +1714,11 @@ msgid "" "is displayed. Other exception types are not handled." msgstr "" -#: ../../library/argparse.rst:983 +#: ../../library/argparse.rst:995 msgid "Common built-in types and functions can be used as type converters:" msgstr "" -#: ../../library/argparse.rst:985 +#: ../../library/argparse.rst:997 msgid "" "import argparse\n" "import pathlib\n" @@ -1701,11 +1744,11 @@ msgstr "" "encoding='latin-1'))\n" "parser.add_argument('datapath', type=pathlib.Path)" -#: ../../library/argparse.rst:998 +#: ../../library/argparse.rst:1010 msgid "User defined functions can be used as well:" msgstr "" -#: ../../library/argparse.rst:1000 +#: ../../library/argparse.rst:1012 msgid "" ">>> def hyphenated(string):\n" "... return '-'.join([word[:4] for word in string.casefold().split()])\n" @@ -1723,14 +1766,14 @@ msgstr "" ">>> parser.parse_args(['\"The Tale of Two Cities\"'])\n" "Namespace(short_title='\"the-tale-of-two-citi')" -#: ../../library/argparse.rst:1010 +#: ../../library/argparse.rst:1022 msgid "" "The :func:`bool` function is not recommended as a type converter. All it " "does is convert empty strings to ``False`` and non-empty strings to " "``True``. This is usually not what is desired." msgstr "" -#: ../../library/argparse.rst:1014 +#: ../../library/argparse.rst:1026 msgid "" "In general, the ``type`` keyword is a convenience that should only be used " "for simple conversions that can only raise one of the three supported " @@ -1738,7 +1781,7 @@ msgid "" "management should be done downstream after the arguments are parsed." msgstr "" -#: ../../library/argparse.rst:1019 +#: ../../library/argparse.rst:1031 msgid "" "For example, JSON or YAML conversions have complex error cases that require " "better reporting than can be given by the ``type`` keyword. A :exc:`~json." @@ -1746,7 +1789,7 @@ msgid "" "exception would not be handled at all." msgstr "" -#: ../../library/argparse.rst:1024 +#: ../../library/argparse.rst:1036 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " "``type`` keyword. If one argument uses :class:`~argparse.FileType` and then " @@ -1756,17 +1799,17 @@ msgid "" "files." msgstr "" -#: ../../library/argparse.rst:1031 +#: ../../library/argparse.rst:1043 msgid "" "For type checkers that simply check against a fixed set of values, consider " "using the choices_ keyword instead." msgstr "" -#: ../../library/argparse.rst:1038 +#: ../../library/argparse.rst:1050 msgid "choices" -msgstr "" +msgstr "choices" -#: ../../library/argparse.rst:1040 +#: ../../library/argparse.rst:1052 msgid "" "Some command-line arguments should be selected from a restricted set of " "values. These can be handled by passing a sequence object as the *choices* " @@ -1775,7 +1818,7 @@ msgid "" "be displayed if the argument was not one of the acceptable values::" msgstr "" -#: ../../library/argparse.rst:1046 +#: ../../library/argparse.rst:1058 msgid "" ">>> parser = argparse.ArgumentParser(prog='game.py')\n" ">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" @@ -1795,26 +1838,26 @@ msgstr "" "game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n" "'paper', 'scissors')" -#: ../../library/argparse.rst:1055 +#: ../../library/argparse.rst:1067 msgid "" "Note that inclusion in the *choices* sequence is checked after any type_ " "conversions have been performed, so the type of the objects in the *choices* " "sequence should match the type_ specified." msgstr "" -#: ../../library/argparse.rst:1059 +#: ../../library/argparse.rst:1071 msgid "" "Any sequence can be passed as the *choices* value, so :class:`list` " "objects, :class:`tuple` objects, and custom sequences are all supported." msgstr "" -#: ../../library/argparse.rst:1062 +#: ../../library/argparse.rst:1074 msgid "" "Use of :class:`enum.Enum` is not recommended because it is difficult to " "control its appearance in usage, help, and error messages." msgstr "" -#: ../../library/argparse.rst:1065 +#: ../../library/argparse.rst:1077 msgid "" "Formatted choices override the default *metavar* which is normally derived " "from *dest*. This is usually what you want because the user never sees the " @@ -1822,11 +1865,11 @@ msgid "" "are many choices), just specify an explicit metavar_." msgstr "" -#: ../../library/argparse.rst:1074 +#: ../../library/argparse.rst:1086 msgid "required" -msgstr "" +msgstr "required" -#: ../../library/argparse.rst:1076 +#: ../../library/argparse.rst:1088 msgid "" "In general, the :mod:`!argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " @@ -1834,7 +1877,7 @@ msgid "" "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: ../../library/argparse.rst:1081 +#: ../../library/argparse.rst:1093 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', required=True)\n" @@ -1852,24 +1895,24 @@ msgstr "" "usage: [-h] --foo FOO\n" ": error: the following arguments are required: --foo" -#: ../../library/argparse.rst:1089 +#: ../../library/argparse.rst:1101 msgid "" "As the example shows, if an option is marked as ``required``, :meth:" "`~ArgumentParser.parse_args` will report an error if that option is not " "present at the command line." msgstr "" -#: ../../library/argparse.rst:1095 +#: ../../library/argparse.rst:1107 msgid "" "Required options are generally considered bad form because users expect " "*options* to be *optional*, and thus they should be avoided when possible." msgstr "" -#: ../../library/argparse.rst:1102 +#: ../../library/argparse.rst:1114 msgid "help" -msgstr "幫助" +msgstr "help" -#: ../../library/argparse.rst:1104 +#: ../../library/argparse.rst:1116 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " @@ -1877,7 +1920,7 @@ msgid "" "each argument." msgstr "" -#: ../../library/argparse.rst:1109 +#: ../../library/argparse.rst:1121 msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " @@ -1886,7 +1929,7 @@ msgid "" "``%(type)s``, etc.::" msgstr "" -#: ../../library/argparse.rst:1114 +#: ../../library/argparse.rst:1126 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" @@ -1912,19 +1955,19 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1126 +#: ../../library/argparse.rst:1138 msgid "" "As the help string supports %-formatting, if you want a literal ``%`` to " "appear in the help string, you must escape it as ``%%``." msgstr "" -#: ../../library/argparse.rst:1129 +#: ../../library/argparse.rst:1141 msgid "" ":mod:`!argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:1132 +#: ../../library/argparse.rst:1144 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" @@ -1942,11 +1985,11 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1144 +#: ../../library/argparse.rst:1156 msgid "metavar" msgstr "metavar" -#: ../../library/argparse.rst:1146 +#: ../../library/argparse.rst:1158 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " "refer to each expected argument. By default, :class:`!ArgumentParser` " @@ -1958,7 +2001,7 @@ msgid "" "command-line argument will be referred to as ``FOO``. An example::" msgstr "" -#: ../../library/argparse.rst:1155 +#: ../../library/argparse.rst:1167 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -1990,11 +2033,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO" -#: ../../library/argparse.rst:1170 +#: ../../library/argparse.rst:1182 msgid "An alternative name can be specified with ``metavar``::" msgstr "" -#: ../../library/argparse.rst:1172 +#: ../../library/argparse.rst:1184 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', metavar='YYY')\n" @@ -2026,21 +2069,21 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo YYY" -#: ../../library/argparse.rst:1187 +#: ../../library/argparse.rst:1199 msgid "" "Note that ``metavar`` only changes the *displayed* name - the name of the " "attribute on the :meth:`~ArgumentParser.parse_args` object is still " "determined by the dest_ value." msgstr "" -#: ../../library/argparse.rst:1191 +#: ../../library/argparse.rst:1203 msgid "" "Different values of ``nargs`` may cause the metavar to be used multiple " "times. Providing a tuple to ``metavar`` specifies a different display for " "each of the arguments::" msgstr "" -#: ../../library/argparse.rst:1195 +#: ../../library/argparse.rst:1207 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', nargs=2)\n" @@ -2064,11 +2107,11 @@ msgstr "" " -x X X\n" " --foo bar baz" -#: ../../library/argparse.rst:1210 +#: ../../library/argparse.rst:1222 msgid "dest" msgstr "dest" -#: ../../library/argparse.rst:1212 +#: ../../library/argparse.rst:1224 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " @@ -2078,7 +2121,7 @@ msgid "" "add_argument`::" msgstr "" -#: ../../library/argparse.rst:1219 +#: ../../library/argparse.rst:1231 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('bar')\n" @@ -2090,7 +2133,7 @@ msgstr "" ">>> parser.parse_args(['XXX'])\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1224 +#: ../../library/argparse.rst:1236 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " @@ -2102,7 +2145,7 @@ msgid "" "below illustrate this behavior::" msgstr "" -#: ../../library/argparse.rst:1233 +#: ../../library/argparse.rst:1245 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('-f', '--foo-bar', '--foo')\n" @@ -2120,11 +2163,11 @@ msgstr "" ">>> parser.parse_args('--foo 1 -y 2'.split())\n" "Namespace(foo_bar='1', x='2')" -#: ../../library/argparse.rst:1241 +#: ../../library/argparse.rst:1253 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" -#: ../../library/argparse.rst:1243 +#: ../../library/argparse.rst:1255 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', dest='bar')\n" @@ -2136,11 +2179,11 @@ msgstr "" ">>> parser.parse_args('--foo XXX'.split())\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1252 +#: ../../library/argparse.rst:1264 msgid "deprecated" -msgstr "" +msgstr "deprecated" -#: ../../library/argparse.rst:1254 +#: ../../library/argparse.rst:1266 msgid "" "During a project's lifetime, some arguments may need to be removed from the " "command line. Before removing them, you should inform your users that the " @@ -2151,7 +2194,7 @@ msgid "" "will be printed to :data:`sys.stderr` when the argument is used::" msgstr "" -#: ../../library/argparse.rst:1264 +#: ../../library/argparse.rst:1276 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='snake.py')\n" @@ -2171,11 +2214,11 @@ msgstr "" "snake.py: warning: option '--legs' is deprecated\n" "Namespace(legs=4)" -#: ../../library/argparse.rst:1277 +#: ../../library/argparse.rst:1289 msgid "Action classes" -msgstr "" +msgstr "Action 類別" -#: ../../library/argparse.rst:1279 +#: ../../library/argparse.rst:1291 msgid "" ":class:`!Action` classes implement the Action API, a callable which returns " "a callable which processes arguments from the command-line. Any object which " @@ -2183,7 +2226,7 @@ msgid "" "`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1288 +#: ../../library/argparse.rst:1300 msgid "" ":class:`!Action` objects are used by an :class:`ArgumentParser` to represent " "the information needed to parse a single argument from one or more strings " @@ -2192,7 +2235,7 @@ msgid "" "`ArgumentParser.add_argument` except for the ``action`` itself." msgstr "" -#: ../../library/argparse.rst:1294 +#: ../../library/argparse.rst:1306 msgid "" "Instances of :class:`!Action` (or return value of any callable to the " "``action`` parameter) should have attributes :attr:`!dest`, :attr:`!" @@ -2201,46 +2244,46 @@ msgid "" "is to call :meth:`!Action.__init__`." msgstr "" -#: ../../library/argparse.rst:1302 +#: ../../library/argparse.rst:1314 msgid "" ":class:`!Action` instances should be callable, so subclasses must override " "the :meth:`!__call__` method, which should accept four parameters:" msgstr "" -#: ../../library/argparse.rst:1305 +#: ../../library/argparse.rst:1317 msgid "" "*parser* - The :class:`ArgumentParser` object which contains this action." msgstr "" -#: ../../library/argparse.rst:1307 +#: ../../library/argparse.rst:1319 msgid "" "*namespace* - The :class:`Namespace` object that will be returned by :meth:" "`~ArgumentParser.parse_args`. Most actions add an attribute to this object " "using :func:`setattr`." msgstr "" -#: ../../library/argparse.rst:1311 +#: ../../library/argparse.rst:1323 msgid "" "*values* - The associated command-line arguments, with any type conversions " "applied. Type conversions are specified with the type_ keyword argument to :" "meth:`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1315 +#: ../../library/argparse.rst:1327 msgid "" "*option_string* - The option string that was used to invoke this action. The " "``option_string`` argument is optional, and will be absent if the action is " "associated with a positional argument." msgstr "" -#: ../../library/argparse.rst:1319 +#: ../../library/argparse.rst:1331 msgid "" "The :meth:`!__call__` method may perform arbitrary actions, but will " "typically set attributes on the ``namespace`` based on ``dest`` and " "``values``." msgstr "" -#: ../../library/argparse.rst:1324 +#: ../../library/argparse.rst:1336 msgid "" ":class:`!Action` subclasses can define a :meth:`!format_usage` method that " "takes no argument and return a string which will be used when printing the " @@ -2248,47 +2291,47 @@ msgid "" "will be used." msgstr "" -#: ../../library/argparse.rst:1330 +#: ../../library/argparse.rst:1342 msgid "The parse_args() method" msgstr "parse_args() 方法" -#: ../../library/argparse.rst:1334 +#: ../../library/argparse.rst:1346 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" -#: ../../library/argparse.rst:1337 +#: ../../library/argparse.rst:1349 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " "created and how they are assigned. See the documentation for :meth:`!" "add_argument` for details." msgstr "" -#: ../../library/argparse.rst:1341 +#: ../../library/argparse.rst:1353 msgid "" "args_ - List of strings to parse. The default is taken from :data:`sys." "argv`." msgstr "" -#: ../../library/argparse.rst:1344 +#: ../../library/argparse.rst:1356 msgid "" "namespace_ - An object to take the attributes. The default is a new empty :" "class:`Namespace` object." msgstr "" -#: ../../library/argparse.rst:1349 +#: ../../library/argparse.rst:1361 msgid "Option value syntax" msgstr "" -#: ../../library/argparse.rst:1351 +#: ../../library/argparse.rst:1363 msgid "" "The :meth:`~ArgumentParser.parse_args` method supports several ways of " "specifying the value of an option (if it takes one). In the simplest case, " "the option and its value are passed as two separate arguments::" msgstr "" -#: ../../library/argparse.rst:1355 +#: ../../library/argparse.rst:1367 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2306,14 +2349,14 @@ msgstr "" ">>> parser.parse_args(['--foo', 'FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1363 +#: ../../library/argparse.rst:1375 msgid "" "For long options (options with names longer than a single character), the " "option and value can also be passed as a single command-line argument, using " "``=`` to separate them::" msgstr "" -#: ../../library/argparse.rst:1367 +#: ../../library/argparse.rst:1379 msgid "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" @@ -2321,13 +2364,13 @@ msgstr "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1370 +#: ../../library/argparse.rst:1382 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "" -#: ../../library/argparse.rst:1373 +#: ../../library/argparse.rst:1385 msgid "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" @@ -2335,13 +2378,13 @@ msgstr "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" -#: ../../library/argparse.rst:1376 +#: ../../library/argparse.rst:1388 msgid "" "Several short options can be joined together, using only a single ``-`` " "prefix, as long as only the last option (or none of them) requires a value::" msgstr "" -#: ../../library/argparse.rst:1379 +#: ../../library/argparse.rst:1391 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='http://github.com/store_true')\n" @@ -2357,11 +2400,11 @@ msgstr "" ">>> parser.parse_args(['-xyzZ'])\n" "Namespace(x=True, y=True, z='Z')" -#: ../../library/argparse.rst:1388 +#: ../../library/argparse.rst:1400 msgid "Invalid arguments" msgstr "無效引數" -#: ../../library/argparse.rst:1390 +#: ../../library/argparse.rst:1402 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " @@ -2369,7 +2412,7 @@ msgid "" "an error, it exits and prints the error along with a usage message::" msgstr "" -#: ../../library/argparse.rst:1395 +#: ../../library/argparse.rst:1407 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', type=int)\n" @@ -2390,12 +2433,30 @@ msgid "" "usage: PROG [-h] [--foo FOO] [bar]\n" "PROG: error: extra arguments found: badger" msgstr "" +">>> parser = argparse.ArgumentParser(prog='PROG')\n" +">>> parser.add_argument('--foo', type=int)\n" +">>> parser.add_argument('bar', nargs='?')\n" +"\n" +">>> # 無效型別\n" +">>> parser.parse_args(['--foo', 'spam'])\n" +"usage: PROG [-h] [--foo FOO] [bar]\n" +"PROG: error: argument --foo: invalid int value: 'spam'\n" +"\n" +">>> # 無效選項\n" +">>> parser.parse_args(['--bar'])\n" +"usage: PROG [-h] [--foo FOO] [bar]\n" +"PROG: error: no such option: --bar\n" +"\n" +">>> # 錯誤引數數量\n" +">>> parser.parse_args(['spam', 'badger'])\n" +"usage: PROG [-h] [--foo FOO] [bar]\n" +"PROG: error: extra arguments found: badger" -#: ../../library/argparse.rst:1416 +#: ../../library/argparse.rst:1428 msgid "Arguments containing ``-``" msgstr "包含 ``-`` 的引數" -#: ../../library/argparse.rst:1418 +#: ../../library/argparse.rst:1430 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " @@ -2407,7 +2468,7 @@ msgid "" "negative numbers::" msgstr "" -#: ../../library/argparse.rst:1426 +#: ../../library/argparse.rst:1438 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2440,7 +2501,7 @@ msgid "" "PROG: error: argument -1: expected one argument" msgstr "" -#: ../../library/argparse.rst:1456 +#: ../../library/argparse.rst:1468 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " @@ -2448,7 +2509,7 @@ msgid "" "positional argument::" msgstr "" -#: ../../library/argparse.rst:1461 +#: ../../library/argparse.rst:1473 msgid "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" @@ -2456,24 +2517,24 @@ msgstr "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" -#: ../../library/argparse.rst:1464 +#: ../../library/argparse.rst:1476 msgid "" "See also :ref:`the argparse howto on ambiguous arguments <specifying-" "ambiguous-arguments>` for more details." msgstr "" -#: ../../library/argparse.rst:1470 +#: ../../library/argparse.rst:1482 msgid "Argument abbreviations (prefix matching)" -msgstr "" +msgstr "引數縮寫 (前綴匹配)" -#: ../../library/argparse.rst:1472 +#: ../../library/argparse.rst:1484 msgid "" "The :meth:`~ArgumentParser.parse_args` method :ref:`by default " "<allow_abbrev>` allows long options to be abbreviated to a prefix, if the " "abbreviation is unambiguous (the prefix matches a unique option)::" msgstr "" -#: ../../library/argparse.rst:1476 +#: ../../library/argparse.rst:1488 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -2497,17 +2558,17 @@ msgstr "" "usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" "PROG: error: ambiguous option: -ba could match -badger, -bacon" -#: ../../library/argparse.rst:1487 +#: ../../library/argparse.rst:1499 msgid "" "An error is produced for arguments that could produce more than one options. " "This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." msgstr "" -#: ../../library/argparse.rst:1493 +#: ../../library/argparse.rst:1505 msgid "Beyond ``sys.argv``" msgstr "" -#: ../../library/argparse.rst:1495 +#: ../../library/argparse.rst:1507 msgid "" "Sometimes it may be useful to have an :class:`ArgumentParser` parse " "arguments other than those of :data:`sys.argv`. This can be accomplished by " @@ -2515,7 +2576,7 @@ msgid "" "useful for testing at the interactive prompt::" msgstr "" -#: ../../library/argparse.rst:1500 +#: ../../library/argparse.rst:1512 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\n" @@ -2541,24 +2602,24 @@ msgstr "" ">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" "Namespace(accumulate=<built-in function sum>, integers=[1, 2, 3, 4])" -#: ../../library/argparse.rst:1515 +#: ../../library/argparse.rst:1527 msgid "The Namespace object" msgstr "命名空間物件" -#: ../../library/argparse.rst:1519 +#: ../../library/argparse.rst:1531 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." msgstr "" -#: ../../library/argparse.rst:1522 +#: ../../library/argparse.rst:1534 msgid "" "This class is deliberately simple, just an :class:`object` subclass with a " "readable string representation. If you prefer to have dict-like view of the " "attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" -#: ../../library/argparse.rst:1526 +#: ../../library/argparse.rst:1538 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2572,14 +2633,14 @@ msgstr "" ">>> vars(args)\n" "{'foo': 'BAR'}" -#: ../../library/argparse.rst:1532 +#: ../../library/argparse.rst:1544 msgid "" "It may also be useful to have an :class:`ArgumentParser` assign attributes " "to an already existing object, rather than a new :class:`Namespace` object. " "This can be achieved by specifying the ``namespace=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:1536 +#: ../../library/argparse.rst:1548 msgid "" ">>> class C:\n" "... pass\n" @@ -2601,15 +2662,15 @@ msgstr "" ">>> c.foo\n" "'BAR'" -#: ../../library/argparse.rst:1548 +#: ../../library/argparse.rst:1560 msgid "Other utilities" msgstr "" -#: ../../library/argparse.rst:1551 +#: ../../library/argparse.rst:1563 msgid "Sub-commands" -msgstr "" +msgstr "子命令" -#: ../../library/argparse.rst:1558 +#: ../../library/argparse.rst:1570 msgid "" "Many programs split up their functionality into a number of subcommands, for " "example, the ``svn`` program can invoke subcommands like ``svn checkout``, " @@ -2624,69 +2685,69 @@ msgid "" "returns an :class:`!ArgumentParser` object that can be modified as usual." msgstr "" -#: ../../library/argparse.rst:1570 +#: ../../library/argparse.rst:1582 msgid "Description of parameters:" msgstr "參數的解釋:" -#: ../../library/argparse.rst:1572 +#: ../../library/argparse.rst:1584 msgid "" "*title* - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " "positional arguments" msgstr "" -#: ../../library/argparse.rst:1576 +#: ../../library/argparse.rst:1588 msgid "" "*description* - description for the sub-parser group in help output, by " "default ``None``" msgstr "" -#: ../../library/argparse.rst:1579 +#: ../../library/argparse.rst:1591 msgid "" "*prog* - usage information that will be displayed with sub-command help, by " "default the name of the program and any positional arguments before the " "subparser argument" msgstr "" -#: ../../library/argparse.rst:1583 +#: ../../library/argparse.rst:1595 msgid "" "*parser_class* - class which will be used to create sub-parser instances, by " "default the class of the current parser (e.g. :class:`ArgumentParser`)" msgstr "" -#: ../../library/argparse.rst:1586 +#: ../../library/argparse.rst:1598 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "" -#: ../../library/argparse.rst:1589 +#: ../../library/argparse.rst:1601 msgid "" "dest_ - name of the attribute under which sub-command name will be stored; " "by default ``None`` and no value is stored" msgstr "" -#: ../../library/argparse.rst:1592 +#: ../../library/argparse.rst:1604 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "" -#: ../../library/argparse.rst:1595 +#: ../../library/argparse.rst:1607 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" -#: ../../library/argparse.rst:1597 +#: ../../library/argparse.rst:1609 msgid "" "metavar_ - string presenting available subcommands in help; by default it is " "``None`` and presents subcommands in form {cmd1, cmd2, ..}" msgstr "" -#: ../../library/argparse.rst:1600 +#: ../../library/argparse.rst:1612 msgid "Some example usage::" msgstr "一些使用範例: ::" -#: ../../library/argparse.rst:1602 +#: ../../library/argparse.rst:1614 msgid "" ">>> # create the top-level parser\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -2709,7 +2770,7 @@ msgid "" "Namespace(baz='Z', foo=True)" msgstr "" -#: ../../library/argparse.rst:1621 +#: ../../library/argparse.rst:1633 msgid "" "Note that the object returned by :meth:`parse_args` will only contain " "attributes for the main parser and the subparser that was selected by the " @@ -2719,7 +2780,7 @@ msgid "" "``baz`` attributes are present." msgstr "" -#: ../../library/argparse.rst:1628 +#: ../../library/argparse.rst:1640 msgid "" "Similarly, when a help message is requested from a subparser, only the help " "for that particular parser will be printed. The help message will not " @@ -2728,7 +2789,7 @@ msgid "" "to :meth:`~_SubParsersAction.add_parser` as above.)" msgstr "" -#: ../../library/argparse.rst:1636 +#: ../../library/argparse.rst:1648 msgid "" ">>> parser.parse_args(['--help'])\n" "usage: PROG [-h] [--foo] {a,b} ...\n" @@ -2786,14 +2847,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --baz {X,Y,Z} baz help" -#: ../../library/argparse.rst:1664 +#: ../../library/argparse.rst:1676 msgid "" "The :meth:`add_subparsers` method also supports ``title`` and " "``description`` keyword arguments. When either is present, the subparser's " "commands will appear in their own group in the help output. For example::" msgstr "" -#: ../../library/argparse.rst:1668 +#: ../../library/argparse.rst:1680 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -2829,7 +2890,7 @@ msgstr "" "\n" " {foo,bar} additional help" -#: ../../library/argparse.rst:1685 +#: ../../library/argparse.rst:1697 msgid "" "Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional " "*aliases* argument, which allows multiple strings to refer to the same " @@ -2837,7 +2898,7 @@ msgid "" "``checkout``::" msgstr "" -#: ../../library/argparse.rst:1690 +#: ../../library/argparse.rst:1702 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -2853,13 +2914,13 @@ msgstr "" ">>> parser.parse_args(['co', 'bar'])\n" "Namespace(foo='bar')" -#: ../../library/argparse.rst:1697 +#: ../../library/argparse.rst:1709 msgid "" ":meth:`~_SubParsersAction.add_parser` supports also an additional " "*deprecated* argument, which allows to deprecate the subparser." msgstr "" -#: ../../library/argparse.rst:1711 +#: ../../library/argparse.rst:1723 msgid "" "One particularly effective way of handling subcommands is to combine the use " "of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` so " @@ -2867,7 +2928,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:1716 +#: ../../library/argparse.rst:1728 msgid "" ">>> # subcommand functions\n" ">>> def foo(args):\n" @@ -2902,7 +2963,7 @@ msgid "" "((XYZYX))" msgstr "" -#: ../../library/argparse.rst:1748 +#: ../../library/argparse.rst:1760 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " @@ -2912,7 +2973,7 @@ msgid "" "argument to the :meth:`add_subparsers` call will work::" msgstr "" -#: ../../library/argparse.rst:1755 +#: ../../library/argparse.rst:1767 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" @@ -2932,15 +2993,15 @@ msgstr "" ">>> parser.parse_args(['2', 'frobble'])\n" "Namespace(subparser_name='2', y='frobble')" -#: ../../library/argparse.rst:1764 +#: ../../library/argparse.rst:1776 msgid "New *required* keyword-only parameter." msgstr "" -#: ../../library/argparse.rst:1769 +#: ../../library/argparse.rst:1781 msgid "FileType objects" msgstr "FileType 物件" -#: ../../library/argparse.rst:1773 +#: ../../library/argparse.rst:1785 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " "argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" @@ -2949,7 +3010,7 @@ msgid "" "the :func:`open` function for more details)::" msgstr "" -#: ../../library/argparse.rst:1779 +#: ../../library/argparse.rst:1791 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" @@ -2967,14 +3028,14 @@ msgstr "" "Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " "raw=<_io.FileIO name='raw.dat' mode='wb'>)" -#: ../../library/argparse.rst:1785 +#: ../../library/argparse.rst:1797 msgid "" "FileType objects understand the pseudo-argument ``'-'`` and automatically " "convert this into :data:`sys.stdin` for readable :class:`FileType` objects " "and :data:`sys.stdout` for writable :class:`FileType` objects::" msgstr "" -#: ../../library/argparse.rst:1789 +#: ../../library/argparse.rst:1801 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" @@ -2986,15 +3047,15 @@ msgstr "" ">>> parser.parse_args(['-'])\n" "Namespace(infile=<_io.TextIOWrapper name='<stdin>' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1794 +#: ../../library/argparse.rst:1806 msgid "Added the *encodings* and *errors* parameters." msgstr "" -#: ../../library/argparse.rst:1799 +#: ../../library/argparse.rst:1811 msgid "Argument groups" msgstr "" -#: ../../library/argparse.rst:1804 +#: ../../library/argparse.rst:1816 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"options\" when displaying help messages. When " @@ -3003,7 +3064,7 @@ msgid "" "method::" msgstr "" -#: ../../library/argparse.rst:1810 +#: ../../library/argparse.rst:1822 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group = parser.add_argument_group('group')\n" @@ -3027,7 +3088,7 @@ msgstr "" " bar bar help\n" " --foo FOO foo help" -#: ../../library/argparse.rst:1821 +#: ../../library/argparse.rst:1833 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " "has an :meth:`~ArgumentParser.add_argument` method just like a regular :" @@ -3038,7 +3099,7 @@ msgid "" "this display::" msgstr "" -#: ../../library/argparse.rst:1829 +#: ../../library/argparse.rst:1841 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" @@ -3076,7 +3137,7 @@ msgstr "" "\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1847 +#: ../../library/argparse.rst:1859 msgid "" "The optional, keyword-only parameters argument_default_ and " "conflict_handler_ allow for finer-grained control of the behavior of the " @@ -3085,13 +3146,13 @@ msgid "" "rather than the entire parser." msgstr "" -#: ../../library/argparse.rst:1852 +#: ../../library/argparse.rst:1864 msgid "" "Note that any arguments not in your user-defined groups will end up back in " "the usual \"positional arguments\" and \"optional arguments\" sections." msgstr "" -#: ../../library/argparse.rst:1855 +#: ../../library/argparse.rst:1867 msgid "" "Calling :meth:`add_argument_group` on an argument group is deprecated. This " "feature was never supported and does not always work correctly. The function " @@ -3099,18 +3160,18 @@ msgid "" "future." msgstr "" -#: ../../library/argparse.rst:1863 +#: ../../library/argparse.rst:1875 msgid "Mutual exclusion" msgstr "" -#: ../../library/argparse.rst:1867 +#: ../../library/argparse.rst:1879 msgid "" "Create a mutually exclusive group. :mod:`!argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " "command line::" msgstr "" -#: ../../library/argparse.rst:1871 +#: ../../library/argparse.rst:1883 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -3136,14 +3197,14 @@ msgstr "" "usage: PROG [-h] [--foo | --bar]\n" "PROG: error: argument --bar: not allowed with argument --foo" -#: ../../library/argparse.rst:1883 +#: ../../library/argparse.rst:1895 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " "is required::" msgstr "" -#: ../../library/argparse.rst:1887 +#: ../../library/argparse.rst:1899 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -3161,7 +3222,7 @@ msgstr "" "usage: PROG [-h] (--foo | --bar)\n" "PROG: error: one of the arguments --foo --bar is required" -#: ../../library/argparse.rst:1895 +#: ../../library/argparse.rst:1907 msgid "" "Note that currently mutually exclusive argument groups do not support the " "*title* and *description* arguments of :meth:`~ArgumentParser." @@ -3169,7 +3230,7 @@ msgid "" "argument group that has a title and description. For example::" msgstr "" -#: ../../library/argparse.rst:1901 +#: ../../library/argparse.rst:1913 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -3205,7 +3266,7 @@ msgstr "" " --foo FOO foo help\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1918 +#: ../../library/argparse.rst:1930 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " "on a mutually exclusive group is deprecated. These features were never " @@ -3213,11 +3274,11 @@ msgid "" "by accident through inheritance and will be removed in the future." msgstr "" -#: ../../library/argparse.rst:1926 +#: ../../library/argparse.rst:1938 msgid "Parser defaults" msgstr "" -#: ../../library/argparse.rst:1930 +#: ../../library/argparse.rst:1942 msgid "" "Most of the time, the attributes of the object returned by :meth:" "`parse_args` will be fully determined by inspecting the command-line " @@ -3226,7 +3287,7 @@ msgid "" "command line to be added::" msgstr "" -#: ../../library/argparse.rst:1936 +#: ../../library/argparse.rst:1948 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -3240,12 +3301,12 @@ msgstr "" ">>> parser.parse_args(['736'])\n" "Namespace(bar=42, baz='badger', foo=736)" -#: ../../library/argparse.rst:1942 +#: ../../library/argparse.rst:1954 msgid "" "Note that parser-level defaults always override argument-level defaults::" msgstr "" -#: ../../library/argparse.rst:1944 +#: ../../library/argparse.rst:1956 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -3259,20 +3320,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo='spam')" -#: ../../library/argparse.rst:1950 +#: ../../library/argparse.rst:1962 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " "example of this type." msgstr "" -#: ../../library/argparse.rst:1956 +#: ../../library/argparse.rst:1968 msgid "" "Get the default value for a namespace attribute, as set by either :meth:" "`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" msgstr "" -#: ../../library/argparse.rst:1960 +#: ../../library/argparse.rst:1972 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" @@ -3284,54 +3345,54 @@ msgstr "" ">>> parser.get_default('foo')\n" "'badger'" -#: ../../library/argparse.rst:1967 +#: ../../library/argparse.rst:1979 msgid "Printing help" msgstr "印出幫助訊息" -#: ../../library/argparse.rst:1969 +#: ../../library/argparse.rst:1981 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " "several formatting methods are available:" msgstr "" -#: ../../library/argparse.rst:1975 +#: ../../library/argparse.rst:1987 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " "assumed." msgstr "" -#: ../../library/argparse.rst:1981 +#: ../../library/argparse.rst:1993 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " "``None``, :data:`sys.stdout` is assumed." msgstr "" -#: ../../library/argparse.rst:1985 +#: ../../library/argparse.rst:1997 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "" -#: ../../library/argparse.rst:1990 +#: ../../library/argparse.rst:2002 msgid "" "Return a string containing a brief description of how the :class:" "`ArgumentParser` should be invoked on the command line." msgstr "" -#: ../../library/argparse.rst:1995 +#: ../../library/argparse.rst:2007 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:2000 +#: ../../library/argparse.rst:2012 msgid "Partial parsing" msgstr "" -#: ../../library/argparse.rst:2004 +#: ../../library/argparse.rst:2016 msgid "" "Sometimes a script may only parse a few of the command-line arguments, " "passing the remaining arguments on to another script or program. In these " @@ -3342,7 +3403,7 @@ msgid "" "remaining argument strings." msgstr "" -#: ../../library/argparse.rst:2013 +#: ../../library/argparse.rst:2025 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='http://github.com/store_true')\n" @@ -3356,7 +3417,7 @@ msgstr "" ">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" -#: ../../library/argparse.rst:2020 +#: ../../library/argparse.rst:2032 msgid "" ":ref:`Prefix matching <prefix-matching>` rules apply to :meth:" "`~ArgumentParser.parse_known_args`. The parser may consume an option even if " @@ -3364,11 +3425,11 @@ msgid "" "remaining arguments list." msgstr "" -#: ../../library/argparse.rst:2027 +#: ../../library/argparse.rst:2039 msgid "Customizing file parsing" msgstr "" -#: ../../library/argparse.rst:2031 +#: ../../library/argparse.rst:2043 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -3376,20 +3437,20 @@ msgid "" "reading." msgstr "" -#: ../../library/argparse.rst:2036 +#: ../../library/argparse.rst:2048 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " "The method is called once per line read from the argument file, in order." msgstr "" -#: ../../library/argparse.rst:2040 +#: ../../library/argparse.rst:2052 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" msgstr "" -#: ../../library/argparse.rst:2043 +#: ../../library/argparse.rst:2055 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" @@ -3399,18 +3460,18 @@ msgstr "" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" -#: ../../library/argparse.rst:2049 +#: ../../library/argparse.rst:2061 msgid "Exiting methods" msgstr "" -#: ../../library/argparse.rst:2053 +#: ../../library/argparse.rst:2065 msgid "" "This method terminates the program, exiting with the specified *status* and, " "if given, it prints a *message* to :data:`sys.stderr` before that. The user " "can override this method to handle these steps differently::" msgstr "" -#: ../../library/argparse.rst:2057 +#: ../../library/argparse.rst:2069 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -3424,17 +3485,17 @@ msgstr "" " raise Exception(f'Exiting because of an error: {message}')\n" " exit(status)" -#: ../../library/argparse.rst:2065 +#: ../../library/argparse.rst:2077 msgid "" "This method prints a usage message, including the *message*, to :data:`sys." "stderr` and terminates the program with a status code of 2." msgstr "" -#: ../../library/argparse.rst:2070 +#: ../../library/argparse.rst:2082 msgid "Intermixed parsing" msgstr "" -#: ../../library/argparse.rst:2075 +#: ../../library/argparse.rst:2087 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -3442,7 +3503,7 @@ msgid "" "parsing style." msgstr "" -#: ../../library/argparse.rst:2080 +#: ../../library/argparse.rst:2092 msgid "" "These parsers do not support all the :mod:`!argparse` features, and will " "raise exceptions if unsupported features are used. In particular, " @@ -3450,7 +3511,7 @@ msgid "" "positionals are not supported." msgstr "" -#: ../../library/argparse.rst:2085 +#: ../../library/argparse.rst:2097 msgid "" "The following example shows the difference between :meth:`~ArgumentParser." "parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " @@ -3458,7 +3519,7 @@ msgid "" "collects all the positionals into ``rest``. ::" msgstr "" -#: ../../library/argparse.rst:2091 +#: ../../library/argparse.rst:2103 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3478,7 +3539,7 @@ msgstr "" ">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" "Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" -#: ../../library/argparse.rst:2100 +#: ../../library/argparse.rst:2112 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -3486,11 +3547,11 @@ msgid "" "there are any remaining unparsed argument strings." msgstr "" -#: ../../library/argparse.rst:2109 +#: ../../library/argparse.rst:2121 msgid "Registering custom types or actions" msgstr "" -#: ../../library/argparse.rst:2113 +#: ../../library/argparse.rst:2125 msgid "" "Sometimes it's desirable to use a custom string in error messages to provide " "more user-friendly output. In these cases, :meth:`!register` can be used to " @@ -3498,7 +3559,7 @@ msgid "" "the type by their registered name instead of their callable name." msgstr "" -#: ../../library/argparse.rst:2118 +#: ../../library/argparse.rst:2130 msgid "" "The :meth:`!register` method accepts three arguments - a *registry_name*, " "specifying the internal registry where the object will be stored (e.g., " @@ -3506,12 +3567,12 @@ msgid "" "be registered, and object, the callable to be registered." msgstr "" -#: ../../library/argparse.rst:2123 +#: ../../library/argparse.rst:2135 msgid "" "The following example shows how to register a custom type with a parser::" msgstr "" -#: ../../library/argparse.rst:2125 +#: ../../library/argparse.rst:2137 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -3527,42 +3588,42 @@ msgid "" "PROG: error: argument --foo: invalid 'hexadecimal integer' value: '1.2'" msgstr "" -#: ../../library/argparse.rst:2137 +#: ../../library/argparse.rst:2149 msgid "Exceptions" msgstr "例外" -#: ../../library/argparse.rst:2141 +#: ../../library/argparse.rst:2153 msgid "An error from creating or using an argument (optional or positional)." msgstr "" -#: ../../library/argparse.rst:2143 +#: ../../library/argparse.rst:2155 msgid "" "The string value of this exception is the message, augmented with " "information about the argument that caused it." msgstr "" -#: ../../library/argparse.rst:2148 +#: ../../library/argparse.rst:2160 msgid "" "Raised when something goes wrong converting a command line string to a type." msgstr "" -#: ../../library/argparse.rst:2152 +#: ../../library/argparse.rst:2164 msgid "Guides and Tutorials" msgstr "" -#: ../../library/argparse.rst:803 +#: ../../library/argparse.rst:815 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/argparse.rst:803 ../../library/argparse.rst:837 -#: ../../library/argparse.rst:851 +#: ../../library/argparse.rst:815 ../../library/argparse.rst:849 +#: ../../library/argparse.rst:863 msgid "in argparse module" msgstr "於 argparse 模組中" -#: ../../library/argparse.rst:837 +#: ../../library/argparse.rst:849 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/argparse.rst:851 +#: ../../library/argparse.rst:863 msgid "+ (plus)" msgstr "+ (加號)" diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index dba9cad94d..d668319414 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -229,8 +229,8 @@ msgid "" "and then exit." msgstr "" "如果在呼叫 :meth:`run_forever` 之前呼叫 :meth:`stop`,則迴圈將使用超時為零的" -"方式輪詢 I/O 選擇器,運行所有回應 I/O 事件(以及已經排程的事件)的回呼函數," -"然後退出。" +"方式輪詢 I/O 選擇器,運行所有回應 I/O 事件(以及已經排程的事件)的回呼,然後" +"退出。" #: ../../library/asyncio-eventloop.rst:134 msgid "" diff --git a/library/cmdlinelibs.po b/library/cmdlinelibs.po new file mode 100644 index 0000000000..74afa150da --- /dev/null +++ b/library/cmdlinelibs.po @@ -0,0 +1,32 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../library/cmdlinelibs.rst:5 +msgid "Command Line Interface Libraries" +msgstr "命令列介面函式庫" + +#: ../../library/cmdlinelibs.rst:7 +msgid "" +"The modules described in this chapter assist with implementing command line " +"and terminal interfaces for applications." +msgstr "本章節所描述的模組協助實作應用程式的命令列與終端介面。" + +#: ../../library/cmdlinelibs.rst:10 +msgid "Here's an overview:" +msgstr "以下為概覽:" diff --git a/library/csv.po b/library/csv.po index 05f0cd536c..afc879deaf 100644 --- a/library/csv.po +++ b/library/csv.po @@ -486,7 +486,7 @@ msgid "" "Twenty rows after the first row are sampled; if more than half of columns + " "rows meet the criteria, :const:`True` is returned." msgstr "" -"對第一列之後的二十個列進行採樣;如果超過一半的行及列滿足條件,則返回 :const:" +"對第一列之後的二十個列進行取樣;如果超過一半的行及列滿足條件,則返回 :const:" "`True`。" #: ../../library/csv.rst:302 diff --git a/library/enum.po b/library/enum.po index 85b9d2908d..285fdae837 100644 --- a/library/enum.po +++ b/library/enum.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-02 00:13+0000\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2024-12-21 13:50+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -238,10 +238,18 @@ msgstr "" "對如何處理非法值做更細微的控制。" #: ../../library/enum.rst:113 +msgid ":class:`EnumDict`" +msgstr ":class:`EnumDict`" + +#: ../../library/enum.rst:115 +msgid "A subclass of :class:`dict` for use when subclassing :class:`EnumType`." +msgstr ":class:`dict` 的子類別,用於當作 :class:`EnumType` 的子類別時使用。" + +#: ../../library/enum.rst:117 msgid ":class:`auto`" msgstr ":class:`auto`" -#: ../../library/enum.rst:115 +#: ../../library/enum.rst:119 msgid "" "Instances are replaced with an appropriate value for Enum members. :class:" "`StrEnum` defaults to the lower-cased version of the member name, while " @@ -250,11 +258,11 @@ msgstr "" "列舉成員的實例會被取代成合適的值。:class:`StrEnum` 預設是小寫版本的成員名稱," "其它列舉則預設是 1 且往後遞增。" -#: ../../library/enum.rst:119 +#: ../../library/enum.rst:123 msgid ":func:`~enum.property`" msgstr ":func:`~enum.property`" -#: ../../library/enum.rst:121 +#: ../../library/enum.rst:125 msgid "" "Allows :class:`Enum` members to have attributes without conflicting with " "member names. The ``value`` and ``name`` attributes are implemented this " @@ -263,46 +271,46 @@ msgstr "" "允許 :class:`Enum` 成員擁有屬性且不會與成員名稱有衝突。``value`` 及 ``name`` " "屬性是用這個方式來實作。" -#: ../../library/enum.rst:125 +#: ../../library/enum.rst:129 msgid ":func:`unique`" msgstr ":func:`unique`" -#: ../../library/enum.rst:127 +#: ../../library/enum.rst:131 msgid "" "Enum class decorator that ensures only one name is bound to any one value." msgstr "Enum 類別的裝飾器,用來確保任何值只有綁定到一個名稱上。" -#: ../../library/enum.rst:129 +#: ../../library/enum.rst:133 msgid ":func:`verify`" msgstr ":func:`verify`" -#: ../../library/enum.rst:131 +#: ../../library/enum.rst:135 msgid "" "Enum class decorator that checks user-selectable constraints on an " "enumeration." msgstr "Enum 類別的裝飾器,用來檢查列舉上使用者所選的限制。" -#: ../../library/enum.rst:134 +#: ../../library/enum.rst:138 msgid ":func:`member`" msgstr ":func:`member`" -#: ../../library/enum.rst:136 +#: ../../library/enum.rst:140 msgid "Make ``obj`` a member. Can be used as a decorator." msgstr "讓 ``obj`` 變成成員。可以當作裝飾器使用。" -#: ../../library/enum.rst:138 +#: ../../library/enum.rst:142 msgid ":func:`nonmember`" msgstr ":func:`nonmember`" -#: ../../library/enum.rst:140 +#: ../../library/enum.rst:144 msgid "Do not make ``obj`` a member. Can be used as a decorator." msgstr "不讓 ``obj`` 變成成員。可以當作裝飾器使用。" -#: ../../library/enum.rst:142 +#: ../../library/enum.rst:146 msgid ":func:`global_enum`" msgstr ":func:`global_enum`" -#: ../../library/enum.rst:144 +#: ../../library/enum.rst:148 msgid "" "Modify the :class:`str() <str>` and :func:`repr` of an enum to show its " "members as belonging to the module instead of its class, and export the enum " @@ -311,19 +319,19 @@ msgstr "" "修改列舉上的 :class:`str() <str>` 及 :func:`repr` ,讓成員顯示為屬於模組而不" "是類別,並將該列舉成員匯出到全域命名空間。" -#: ../../library/enum.rst:148 +#: ../../library/enum.rst:152 msgid ":func:`show_flag_values`" msgstr ":func:`show_flag_values`" -#: ../../library/enum.rst:150 +#: ../../library/enum.rst:154 msgid "Return a list of all power-of-two integers contained in a flag." msgstr "回傳旗標 (flag) 裡包含的所有 2 的次方的整數串列。" -#: ../../library/enum.rst:153 +#: ../../library/enum.rst:157 msgid "``Flag``, ``IntFlag``, ``auto``" msgstr "``Flag``, ``IntFlag``, ``auto``" -#: ../../library/enum.rst:154 +#: ../../library/enum.rst:158 msgid "" "``StrEnum``, ``EnumCheck``, ``ReprEnum``, ``FlagBoundary``, ``property``, " "``member``, ``nonmember``, ``global_enum``, ``show_flag_values``" @@ -332,10 +340,14 @@ msgstr "" "``member``, ``nonmember``, ``global_enum``, ``show_flag_values``" #: ../../library/enum.rst:159 +msgid "``EnumDict``" +msgstr "``EnumDict``" + +#: ../../library/enum.rst:164 msgid "Data Types" msgstr "資料型別" -#: ../../library/enum.rst:164 +#: ../../library/enum.rst:169 msgid "" "*EnumType* is the :term:`metaclass` for *enum* enumerations. It is possible " "to subclass *EnumType* -- see :ref:`Subclassing EnumType <enumtype-" @@ -344,7 +356,7 @@ msgstr "" "*EnumType* 是 *enum* 列舉的 :term:`metaclass`。*EnumType* 可以有子類別 -- 細" "節請參考 :ref:`建立 EnumType 的子類別 <enumtype-examples>`。" -#: ../../library/enum.rst:168 +#: ../../library/enum.rst:173 msgid "" "``EnumType`` is responsible for setting the correct :meth:`!__repr__`, :meth:" "`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the " @@ -355,11 +367,11 @@ msgstr "" "`!__str__`、:meth:`!__format__` 及 :meth:`!__reduce__` 方法,以及建立列舉成" "員、正確處理重複、提供列舉類別的疊代等等。" -#: ../../library/enum.rst:175 +#: ../../library/enum.rst:180 msgid "This method is called in two different ways:" msgstr "這個方法可以用兩種不同的方式呼叫:" -#: ../../library/enum.rst:177 +#: ../../library/enum.rst:182 msgid "to look up an existing member:" msgstr "查詢已存在的成員:" @@ -367,7 +379,7 @@ msgstr "查詢已存在的成員:" msgid "cls" msgstr "cls" -#: ../../library/enum.rst:179 ../../library/enum.rst:185 +#: ../../library/enum.rst:184 ../../library/enum.rst:190 msgid "The enum class being called." msgstr "所呼叫的列舉類別。" @@ -375,17 +387,17 @@ msgstr "所呼叫的列舉類別。" msgid "value" msgstr "value" -#: ../../library/enum.rst:180 +#: ../../library/enum.rst:185 msgid "The value to lookup." msgstr "要查詢的值。" -#: ../../library/enum.rst:182 +#: ../../library/enum.rst:187 msgid "" "to use the ``cls`` enum to create a new enum (only if the existing enum does " "not have any members):" msgstr "使用 ``cls`` 列舉來建立新列舉(只有在現有列舉沒有任何成員時)" -#: ../../library/enum.rst:186 +#: ../../library/enum.rst:191 msgid "The name of the new Enum to create." msgstr "要建立的新列舉的名稱。" @@ -393,7 +405,7 @@ msgstr "要建立的新列舉的名稱。" msgid "names" msgstr "names" -#: ../../library/enum.rst:187 +#: ../../library/enum.rst:192 msgid "The names/values of the members for the new Enum." msgstr "新列舉的成員的名稱/值。" @@ -401,7 +413,7 @@ msgstr "新列舉的成員的名稱/值。" msgid "module" msgstr "module" -#: ../../library/enum.rst:188 +#: ../../library/enum.rst:193 msgid "The name of the module the new Enum is created in." msgstr "新列舉要建立在哪個模組名稱下。" @@ -409,7 +421,7 @@ msgstr "新列舉要建立在哪個模組名稱下。" msgid "qualname" msgstr "qualname" -#: ../../library/enum.rst:189 +#: ../../library/enum.rst:194 msgid "The actual location in the module where this Enum can be found." msgstr "這個列舉在模組裡實際上的位置。" @@ -417,7 +429,7 @@ msgstr "這個列舉在模組裡實際上的位置。" msgid "type" msgstr "type" -#: ../../library/enum.rst:190 +#: ../../library/enum.rst:195 msgid "A mix-in type for the new Enum." msgstr "新列舉的混合型別。" @@ -425,7 +437,7 @@ msgstr "新列舉的混合型別。" msgid "start" msgstr "start" -#: ../../library/enum.rst:191 +#: ../../library/enum.rst:196 msgid "The first integer value for the Enum (used by :class:`auto`)." msgstr "列舉的第一個整數值(由 :class:`auto` 所使用)" @@ -433,16 +445,16 @@ msgstr "列舉的第一個整數值(由 :class:`auto` 所使用)" msgid "boundary" msgstr "boundary" -#: ../../library/enum.rst:192 +#: ../../library/enum.rst:197 msgid "" "How to handle out-of-range values from bit operations (:class:`Flag` only)." msgstr "在位元操作時怎麼處理範圍外的值(只有 :class:`Flag` 會用到)" -#: ../../library/enum.rst:196 +#: ../../library/enum.rst:201 msgid "Returns ``True`` if member belongs to the ``cls``::" msgstr "如果 member 屬於 ``cls`` 則回傳 ``True``: ::" -#: ../../library/enum.rst:198 +#: ../../library/enum.rst:203 msgid "" ">>> some_var = Color.RED\n" ">>> some_var in Color\n" @@ -456,7 +468,7 @@ msgstr "" ">>> Color.RED.value in Color\n" "True" -#: ../../library/enum.rst:206 +#: ../../library/enum.rst:211 msgid "" "Before Python 3.12, a ``TypeError`` is raised if a non-Enum-member is used " "in a containment check." @@ -464,7 +476,7 @@ msgstr "" "在 Python 3.12 之前,如果用非列舉成員做屬於檢查 (containment check) 會引發 " "``TypeError``。" -#: ../../library/enum.rst:211 +#: ../../library/enum.rst:216 msgid "" "Returns ``['__class__', '__doc__', '__members__', '__module__']`` and the " "names of the members in *cls*::" @@ -472,7 +484,7 @@ msgstr "" "回傳 ``['__class__', '__doc__', '__members__', '__module__']`` 及 *cls* 的成" "員名稱: ::" -#: ../../library/enum.rst:214 +#: ../../library/enum.rst:219 msgid "" ">>> dir(Color)\n" "['BLUE', 'GREEN', 'RED', '__class__', '__contains__', '__doc__', " @@ -484,13 +496,13 @@ msgstr "" "'__getitem__', '__init_subclass__', '__iter__', '__len__', '__members__', " "'__module__', '__name__', '__qualname__']" -#: ../../library/enum.rst:219 +#: ../../library/enum.rst:224 msgid "" "Returns the Enum member in *cls* matching *name*, or raises a :exc:" "`KeyError`::" msgstr "回傳 *cls* 中符合 *name* 的列舉成員,或引發 :exc:`KeyError`: ::" -#: ../../library/enum.rst:221 +#: ../../library/enum.rst:226 msgid "" ">>> Color['BLUE']\n" "<Color.BLUE: 3>" @@ -498,11 +510,11 @@ msgstr "" ">>> Color['BLUE']\n" "<Color.BLUE: 3>" -#: ../../library/enum.rst:226 +#: ../../library/enum.rst:231 msgid "Returns each member in *cls* in definition order::" msgstr "以定義的順序回傳在 *cls* 中的每個成員: ::" -#: ../../library/enum.rst:228 +#: ../../library/enum.rst:233 msgid "" ">>> list(Color)\n" "[<Color.RED: 1>, <Color.GREEN: 2>, <Color.BLUE: 3>]" @@ -510,11 +522,11 @@ msgstr "" ">>> list(Color)\n" "[<Color.RED: 1>, <Color.GREEN: 2>, <Color.BLUE: 3>]" -#: ../../library/enum.rst:233 +#: ../../library/enum.rst:238 msgid "Returns the number of member in *cls*::" msgstr "回傳 *cls* 的成員數量: ::" -#: ../../library/enum.rst:235 +#: ../../library/enum.rst:240 msgid "" ">>> len(Color)\n" "3" @@ -522,15 +534,15 @@ msgstr "" ">>> len(Color)\n" "3" -#: ../../library/enum.rst:240 +#: ../../library/enum.rst:245 msgid "Returns a mapping of every enum name to its member, including aliases" msgstr "回傳每個列舉名稱到其成員的對映,包括別名" -#: ../../library/enum.rst:244 +#: ../../library/enum.rst:249 msgid "Returns each member in *cls* in reverse definition order::" msgstr "以跟定義相反的順序回傳 *cls* 的每個成員: ::" -#: ../../library/enum.rst:246 +#: ../../library/enum.rst:251 msgid "" ">>> list(reversed(Color))\n" "[<Color.BLUE: 3>, <Color.GREEN: 2>, <Color.RED: 1>]" @@ -538,7 +550,7 @@ msgstr "" ">>> list(reversed(Color))\n" "[<Color.BLUE: 3>, <Color.GREEN: 2>, <Color.RED: 1>]" -#: ../../library/enum.rst:251 +#: ../../library/enum.rst:256 msgid "" "Adds a new name as an alias to an existing member. Raises a :exc:" "`NameError` if the name is already assigned to a different member." @@ -546,7 +558,7 @@ msgstr "" "新增一個名稱作為現有成員的別名。如果該名稱已被指派給不同的成員,則會引發 :" "exc:`NameError`。" -#: ../../library/enum.rst:256 +#: ../../library/enum.rst:261 msgid "" "Adds a new value as an alias to an existing member. Raises a :exc:" "`ValueError` if the value is already linked with a different member." @@ -554,21 +566,21 @@ msgstr "" "新增一個值作為現有成員的別名。如果該值已與不同成員連結,則會引發 :exc:" "`ValueError`。" -#: ../../library/enum.rst:261 +#: ../../library/enum.rst:266 msgid "" "Before 3.11 ``EnumType`` was called ``EnumMeta``, which is still available " "as an alias." msgstr "在 3.11 之前,``EnumType`` 稱作 ``EnumMeta``,其目前仍可作為別名使用。" -#: ../../library/enum.rst:266 +#: ../../library/enum.rst:271 msgid "*Enum* is the base class for all *enum* enumerations." msgstr "*Enum* 是所有 *enum* 列舉的基礎類別。" -#: ../../library/enum.rst:270 +#: ../../library/enum.rst:275 msgid "The name used to define the ``Enum`` member::" msgstr "用來定義 ``Enum`` 成員的名稱: ::" -#: ../../library/enum.rst:272 +#: ../../library/enum.rst:277 msgid "" ">>> Color.BLUE.name\n" "'BLUE'" @@ -576,11 +588,11 @@ msgstr "" ">>> Color.BLUE.name\n" "'BLUE'" -#: ../../library/enum.rst:277 +#: ../../library/enum.rst:282 msgid "The value given to the ``Enum`` member::" msgstr "``Enum`` 成員給定的值: ::" -#: ../../library/enum.rst:279 +#: ../../library/enum.rst:284 msgid "" ">>> Color.RED.value\n" "1" @@ -588,15 +600,15 @@ msgstr "" ">>> Color.RED.value\n" "1" -#: ../../library/enum.rst:282 ../../library/enum.rst:302 +#: ../../library/enum.rst:287 ../../library/enum.rst:307 msgid "Value of the member, can be set in :meth:`~Enum.__new__`." msgstr "成員的值,可以在 :meth:`~Enum.__new__` 設定。" -#: ../../library/enum.rst:284 +#: ../../library/enum.rst:289 msgid "Enum member values" msgstr "列舉成員的值" -#: ../../library/enum.rst:286 +#: ../../library/enum.rst:291 msgid "" "Member values can be anything: :class:`int`, :class:`str`, etc. If the " "exact value is unimportant you may use :class:`auto` instances and an " @@ -606,7 +618,7 @@ msgstr "" "重要,你可以使用 :class:`auto` 實例,它會為你選擇合適的值。更多細節請參考 :" "class:`auto`。" -#: ../../library/enum.rst:291 +#: ../../library/enum.rst:296 msgid "" "While mutable/unhashable values, such as :class:`dict`, :class:`list` or a " "mutable :class:`~dataclasses.dataclass`, can be used, they will have a " @@ -617,23 +629,23 @@ msgstr "" "`dict`、:class:`list` 或可變的 :class:`~dataclasses.dataclass`,它們在建立期" "間會對效能產生相對於列舉中可變的 / 不可雜湊的值總數量的二次方影響。" -#: ../../library/enum.rst:298 +#: ../../library/enum.rst:303 msgid "Name of the member." msgstr "成員名稱。" -#: ../../library/enum.rst:306 +#: ../../library/enum.rst:311 msgid "" "No longer used, kept for backward compatibility. (class attribute, removed " "during class creation)." msgstr "已不再使用,只為了向後相容而保留(類別屬性,在類別建立時移除)" -#: ../../library/enum.rst:311 +#: ../../library/enum.rst:316 msgid "" "``_ignore_`` is only used during creation and is removed from the " "enumeration once creation is complete." msgstr "``_ignore_`` 只有在建立的時候用到,在列舉建立完成後會被移除。" -#: ../../library/enum.rst:314 +#: ../../library/enum.rst:319 msgid "" "``_ignore_`` is a list of names that will not become members, and whose " "names will also be removed from the completed enumeration. See :ref:" @@ -642,7 +654,7 @@ msgstr "" "``_ignore_`` 是一個不會變成成員的名稱串列,在列舉建立完成後其名稱會被移除。範" "例請參考 :ref:`TimePeriod <enum-time-period>`。" -#: ../../library/enum.rst:320 +#: ../../library/enum.rst:325 msgid "" "Returns ``['__class__', '__doc__', '__module__', 'name', 'value']`` and any " "public methods defined on *self.__class__*::" @@ -650,7 +662,7 @@ msgstr "" "回傳 ``['__class__', '__doc__', '__module__', 'name', 'value']`` 及任何 " "*self.__class__* 上定義的公開方法: ::" -#: ../../library/enum.rst:323 +#: ../../library/enum.rst:328 msgid "" ">>> from datetime import date\n" ">>> class Weekday(Enum):\n" @@ -690,11 +702,11 @@ msgstr "" msgid "name" msgstr "name" -#: ../../library/enum.rst:341 +#: ../../library/enum.rst:346 msgid "The name of the member being defined (e.g. 'RED')." msgstr "定義的成員名稱(例如 'RED')。" -#: ../../library/enum.rst:342 +#: ../../library/enum.rst:347 msgid "The start value for the Enum; the default is 1." msgstr "列舉的開始值,預設為 1。" @@ -702,7 +714,7 @@ msgstr "列舉的開始值,預設為 1。" msgid "count" msgstr "count" -#: ../../library/enum.rst:343 +#: ../../library/enum.rst:348 msgid "The number of members currently defined, not including this one." msgstr "已定義的成員數量,不包含目前這一個。" @@ -710,17 +722,17 @@ msgstr "已定義的成員數量,不包含目前這一個。" msgid "last_values" msgstr "last_values" -#: ../../library/enum.rst:344 +#: ../../library/enum.rst:349 msgid "A list of the previous values." msgstr "一個之前值的串列。" -#: ../../library/enum.rst:346 +#: ../../library/enum.rst:351 msgid "" "A *staticmethod* that is used to determine the next value returned by :class:" "`auto`::" msgstr "一個 *staticmethod*,用來決定 :class:`auto` 下一個要回傳的值的: ::" -#: ../../library/enum.rst:349 +#: ../../library/enum.rst:354 msgid "" ">>> from enum import auto\n" ">>> class PowersOfThree(Enum):\n" @@ -744,7 +756,7 @@ msgstr "" ">>> PowersOfThree.SECOND.value\n" "9" -#: ../../library/enum.rst:362 +#: ../../library/enum.rst:367 msgid "" "By default, does nothing. If multiple values are given in the member " "assignment, those values become separate arguments to ``__init__``; e.g." @@ -752,19 +764,19 @@ msgstr "" "預設情況下,不執行任何操作。如果在成員賦值中給出多個值,這些值將成為與 " "``__init__`` 分別的引數;例如" -#: ../../library/enum.rst:369 +#: ../../library/enum.rst:374 msgid "" "``Weekday.__init__()`` would be called as ``Weekday.__init__(self, 1, " "'Mon')``" msgstr "``Weekday.__init__()`` 將被稱為 ``Weekday.__init__(self, 1, 'Mon')``" -#: ../../library/enum.rst:373 +#: ../../library/enum.rst:378 msgid "" "A *classmethod* that is used to further configure subsequent subclasses. By " "default, does nothing." msgstr "一個 *classmethod*,用來進一步設定後續的子類別,預設不做任何事。" -#: ../../library/enum.rst:378 +#: ../../library/enum.rst:383 msgid "" "A *classmethod* for looking up values not found in *cls*. By default it " "does nothing, but can be overridden to implement custom search behavior::" @@ -772,7 +784,7 @@ msgstr "" "一個 *classmethod*,用來查詢在 *cls* 裡找不到的值。預設不做任何事,但可以被覆" "寫以實作客製化的搜尋行為: ::" -#: ../../library/enum.rst:381 +#: ../../library/enum.rst:386 msgid "" ">>> from enum import StrEnum\n" ">>> class Build(StrEnum):\n" @@ -808,7 +820,7 @@ msgstr "" ">>> Build('deBUG')\n" "<Build.DEBUG: 'debug'>" -#: ../../library/enum.rst:400 +#: ../../library/enum.rst:405 msgid "" "By default, doesn't exist. If specified, either in the enum class " "definition or in a mixin class (such as ``int``), all values given in the " @@ -817,12 +829,12 @@ msgstr "" "預設情況下不存在。如果有指定,無論是在列舉類別定義中還是在 mixin 類別中(例" "如 ``int``\\ ),都將傳遞成員賦值中給出的所有值;例如" -#: ../../library/enum.rst:408 +#: ../../library/enum.rst:413 msgid "" "results in the call ``int('1a', 16)`` and a value of ``26`` for the member." msgstr "會產生呼叫 ``int('1a', 16)`` 而該成員的值為 ``26``。" -#: ../../library/enum.rst:412 +#: ../../library/enum.rst:417 msgid "" "When writing a custom ``__new__``, do not use ``super().__new__`` -- call " "the appropriate ``__new__`` instead." @@ -830,7 +842,7 @@ msgstr "" "當寫自訂的 ``__new__`` 時,不要使用 ``super().__new__``,而是要呼叫適當的 " "``__new__``。" -#: ../../library/enum.rst:417 +#: ../../library/enum.rst:422 msgid "" "Returns the string used for *repr()* calls. By default, returns the *Enum* " "name, member name, and value, but can be overridden::" @@ -838,7 +850,7 @@ msgstr "" "回傳呼叫 *repr()* 時使用的字串。預設回傳 *Enum* 名稱、成員名稱及值,但可以被" "覆寫: ::" -#: ../../library/enum.rst:420 +#: ../../library/enum.rst:425 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -864,7 +876,7 @@ msgstr "" "ALTERNATE}\"\n" "(OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')" -#: ../../library/enum.rst:433 +#: ../../library/enum.rst:438 msgid "" "Returns the string used for *str()* calls. By default, returns the *Enum* " "name and member name, but can be overridden::" @@ -872,7 +884,7 @@ msgstr "" "回傳呼叫 *str()* 時使用的字串。預設回傳 *Enum* 名稱及成員名稱,但可以被覆" "寫: ::" -#: ../../library/enum.rst:436 +#: ../../library/enum.rst:441 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -896,7 +908,7 @@ msgstr "" "ALTERNATE}\"\n" "(<OtherStyle.ALTERNATE: 1>, 'ALTERNATE', 'ALTERNATE')" -#: ../../library/enum.rst:448 +#: ../../library/enum.rst:453 msgid "" "Returns the string used for *format()* and *f-string* calls. By default, " "returns :meth:`__str__` return value, but can be overridden::" @@ -904,7 +916,7 @@ msgstr "" "回傳呼叫 *format()* 及 *f-string* 時使用的字串。預設回傳 :meth:`__str__` 的回" "傳值,但可以被覆寫: ::" -#: ../../library/enum.rst:451 +#: ../../library/enum.rst:456 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -928,17 +940,17 @@ msgstr "" "ALTERNATE}\"\n" "(<OtherStyle.ALTERNATE: 1>, 'OtherStyle.ALTERNATE', 'ALTERNATE')" -#: ../../library/enum.rst:463 +#: ../../library/enum.rst:468 msgid "" "Using :class:`auto` with :class:`Enum` results in integers of increasing " "value, starting with ``1``." msgstr ":class:`Enum` 使用 :class:`auto` 會產生從 ``1`` 開始遞增的整數。" -#: ../../library/enum.rst:466 +#: ../../library/enum.rst:471 msgid "Added :ref:`enum-dataclass-support`" msgstr "新增 :ref:`enum-dataclass-support`" -#: ../../library/enum.rst:471 +#: ../../library/enum.rst:476 msgid "" "*IntEnum* is the same as :class:`Enum`, but its members are also integers " "and can be used anywhere that an integer can be used. If any integer " @@ -948,13 +960,13 @@ msgstr "" "*IntEnum* 和 :class:`Enum` 一樣,但其成員同時也是整數而可以被用在任何使用整數" "的地方。如果 *IntEnum* 成員經過任何整數運算,結果值會失去其列舉狀態。" -#: ../../library/enum.rst:492 +#: ../../library/enum.rst:497 msgid "" "Using :class:`auto` with :class:`IntEnum` results in integers of increasing " "value, starting with ``1``." msgstr ":class:`IntEnum` 使用 :class:`auto` 會產生從 ``1`` 開始遞增的整數。" -#: ../../library/enum.rst:495 +#: ../../library/enum.rst:500 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` was " @@ -964,7 +976,7 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" -#: ../../library/enum.rst:502 +#: ../../library/enum.rst:507 msgid "" "``StrEnum`` is the same as :class:`Enum`, but its members are also strings " "and can be used in most of the same places that a string can be used. The " @@ -974,7 +986,7 @@ msgstr "" "``StrEnum`` 和 :class:`Enum` 一樣,但其成員同時也是字串而可以被用在幾乎所有使" "用字串的地方。*StrEnum* 成員經過任何字串操作的結果會不再是列舉的一部份。" -#: ../../library/enum.rst:508 +#: ../../library/enum.rst:513 msgid "" "There are places in the stdlib that check for an exact :class:`str` instead " "of a :class:`str` subclass (i.e. ``type(unknown) == str`` instead of " @@ -985,13 +997,13 @@ msgstr "" "是 ``type(unknown) == str`` 而不是 ``isinstance(unknown, str)``),在這些地方" "你需要使用 ``str(StrEnum.member)``。" -#: ../../library/enum.rst:515 +#: ../../library/enum.rst:520 msgid "" "Using :class:`auto` with :class:`StrEnum` results in the lower-cased member " "name as the value." msgstr ":class:`StrEnum` 使用 :class:`auto` 會產生小寫的成員名稱當作值。" -#: ../../library/enum.rst:520 +#: ../../library/enum.rst:525 msgid "" ":meth:`~object.__str__` is :meth:`!str.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` is " @@ -1001,7 +1013,7 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!str.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 也會是 :meth:`!str.__format__`。" -#: ../../library/enum.rst:528 +#: ../../library/enum.rst:533 msgid "" "``Flag`` is the same as :class:`Enum`, but its members support the bitwise " "operators ``&`` (*AND*), ``|`` (*OR*), ``^`` (*XOR*), and ``~`` (*INVERT*); " @@ -1011,11 +1023,11 @@ msgstr "" "(*OR*)、``^`` (*XOR*) 和 ``~`` (*INVERT*);這些操作的結果是列舉的成員(的別" "名)。" -#: ../../library/enum.rst:534 +#: ../../library/enum.rst:539 msgid "Returns *True* if value is in self::" msgstr "如果 value 在 self 裡則回傳 *True*: ::" -#: ../../library/enum.rst:536 +#: ../../library/enum.rst:541 msgid "" ">>> from enum import Flag, auto\n" ">>> class Color(Flag):\n" @@ -1051,11 +1063,11 @@ msgstr "" ">>> white in purple\n" "False" -#: ../../library/enum.rst:555 +#: ../../library/enum.rst:560 msgid "Returns all contained non-alias members::" msgstr "回傳所有包含的非別名成員: ::" -#: ../../library/enum.rst:557 +#: ../../library/enum.rst:562 msgid "" ">>> list(Color.RED)\n" "[<Color.RED: 1>]\n" @@ -1067,11 +1079,11 @@ msgstr "" ">>> list(purple)\n" "[<Color.RED: 1>, <Color.BLUE: 4>]" -#: ../../library/enum.rst:566 +#: ../../library/enum.rst:571 msgid "Returns number of members in flag::" msgstr "回傳旗標裡的成員數量: ::" -#: ../../library/enum.rst:568 +#: ../../library/enum.rst:573 msgid "" ">>> len(Color.GREEN)\n" "1\n" @@ -1083,11 +1095,11 @@ msgstr "" ">>> len(white)\n" "3" -#: ../../library/enum.rst:577 +#: ../../library/enum.rst:582 msgid "Returns *True* if any members in flag, *False* otherwise::" msgstr "如果成員在旗標裡則回傳 *True*,否則回傳 *False*: ::" -#: ../../library/enum.rst:579 +#: ../../library/enum.rst:584 msgid "" ">>> bool(Color.GREEN)\n" "True\n" @@ -1105,11 +1117,11 @@ msgstr "" ">>> bool(black)\n" "False" -#: ../../library/enum.rst:589 +#: ../../library/enum.rst:594 msgid "Returns current flag binary or'ed with other::" msgstr "回傳和 other 做 OR 過後的二進位旗標: ::" -#: ../../library/enum.rst:591 +#: ../../library/enum.rst:596 msgid "" ">>> Color.RED | Color.GREEN\n" "<Color.RED|GREEN: 3>" @@ -1117,11 +1129,11 @@ msgstr "" ">>> Color.RED | Color.GREEN\n" "<Color.RED|GREEN: 3>" -#: ../../library/enum.rst:596 +#: ../../library/enum.rst:601 msgid "Returns current flag binary and'ed with other::" msgstr "回傳和 other 做 AND 過後的二進位旗標: ::" -#: ../../library/enum.rst:598 +#: ../../library/enum.rst:603 msgid "" ">>> purple & white\n" "<Color.RED|BLUE: 5>\n" @@ -1133,11 +1145,11 @@ msgstr "" ">>> purple & Color.GREEN\n" "<Color: 0>" -#: ../../library/enum.rst:605 +#: ../../library/enum.rst:610 msgid "Returns current flag binary xor'ed with other::" msgstr "回傳和 other 做 XOR 過後的二進位旗標: ::" -#: ../../library/enum.rst:607 +#: ../../library/enum.rst:612 msgid "" ">>> purple ^ white\n" "<Color.GREEN: 2>\n" @@ -1149,11 +1161,11 @@ msgstr "" ">>> purple ^ Color.GREEN\n" "<Color.RED|GREEN|BLUE: 7>" -#: ../../library/enum.rst:614 +#: ../../library/enum.rst:619 msgid "Returns all the flags in *type(self)* that are not in *self*::" msgstr "回傳所有在 *type(self)* 但不在 *self* 裡的旗標: ::" -#: ../../library/enum.rst:616 +#: ../../library/enum.rst:621 msgid "" ">>> ~white\n" "<Color: 0>\n" @@ -1169,7 +1181,7 @@ msgstr "" ">>> ~Color.RED\n" "<Color.GREEN|BLUE: 6>" -#: ../../library/enum.rst:625 +#: ../../library/enum.rst:630 msgid "" "Function used to format any remaining unnamed numeric values. Default is " "the value's repr; common choices are :func:`hex` and :func:`oct`." @@ -1177,17 +1189,17 @@ msgstr "" "用來格式化任何剩下未命名數值的函式。預設是值的 repr,常見選擇是 :func:`hex` " "和 :func:`oct`。" -#: ../../library/enum.rst:630 +#: ../../library/enum.rst:635 msgid "" "Using :class:`auto` with :class:`Flag` results in integers that are powers " "of two, starting with ``1``." msgstr ":class:`Flag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" -#: ../../library/enum.rst:633 +#: ../../library/enum.rst:638 msgid "The *repr()* of zero-valued flags has changed. It is now::" msgstr "值為 0 的旗標的 *repr()* 已改變。現在是: ::" -#: ../../library/enum.rst:641 +#: ../../library/enum.rst:646 msgid "" "``IntFlag`` is the same as :class:`Flag`, but its members are also integers " "and can be used anywhere that an integer can be used." @@ -1195,13 +1207,13 @@ msgstr "" "``IntFlag`` 和 :class:`Flag` 一樣,但其成員同時也是整數而可以被用在任何使用整" "數的地方。" -#: ../../library/enum.rst:655 +#: ../../library/enum.rst:660 msgid "" "If any integer operation is performed with an *IntFlag* member, the result " "is not an *IntFlag*::" msgstr "如果 *IntFlag* 成員經過任何整數運算,其結果不是 *IntFlag*: ::" -#: ../../library/enum.rst:658 +#: ../../library/enum.rst:663 msgid "" ">>> Color.RED + 2\n" "3" @@ -1209,32 +1221,32 @@ msgstr "" ">>> Color.RED + 2\n" "3" -#: ../../library/enum.rst:661 +#: ../../library/enum.rst:666 msgid "If a :class:`Flag` operation is performed with an *IntFlag* member and:" msgstr "如果 *IntFlag* 成員經過 :class:`Flag` 操作且:" -#: ../../library/enum.rst:663 +#: ../../library/enum.rst:668 msgid "the result is a valid *IntFlag*: an *IntFlag* is returned" msgstr "結果是合法的 *IntFlag*:回傳 *IntFlag*" -#: ../../library/enum.rst:664 +#: ../../library/enum.rst:669 msgid "" "the result is not a valid *IntFlag*: the result depends on the :class:" "`FlagBoundary` setting" msgstr "結果不是合法的 *IntFlag*:結果會根據 :class:`FlagBoundary` 的設定" -#: ../../library/enum.rst:666 +#: ../../library/enum.rst:671 msgid "The :func:`repr` of unnamed zero-valued flags has changed. It is now:" msgstr "未命名且值為 0 的旗標的 :func:`repr` 已改變。現在是:" -#: ../../library/enum.rst:673 +#: ../../library/enum.rst:678 msgid "" "Using :class:`auto` with :class:`IntFlag` results in integers that are " "powers of two, starting with ``1``." msgstr "" ":class:`IntFlag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" -#: ../../library/enum.rst:678 +#: ../../library/enum.rst:683 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` " @@ -1244,7 +1256,7 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" -#: ../../library/enum.rst:682 +#: ../../library/enum.rst:687 msgid "" "Inversion of an :class:`!IntFlag` now returns a positive value that is the " "union of all flags not in the given flag, rather than a negative value. This " @@ -1253,7 +1265,7 @@ msgstr "" ":class:`!IntFlag` 的反轉 (inversion) 現在會回傳正值,該值是不在給定旗標的所有" "旗標聯集,而不是一個負值。這符合現有 :class:`Flag` 的行為。" -#: ../../library/enum.rst:688 +#: ../../library/enum.rst:693 msgid "" ":class:`!ReprEnum` uses the :meth:`repr() <Enum.__repr__>` of :class:`Enum`, " "but the :class:`str() <str>` of the mixed-in data type:" @@ -1261,15 +1273,15 @@ msgstr "" ":class:`!ReprEnum` 使用 :class:`Enum` 的 :meth:`repr() <Enum.__repr__>`,但使" "用混合資料型別的 :class:`str() <str>`:" -#: ../../library/enum.rst:691 +#: ../../library/enum.rst:696 msgid ":meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag`" msgstr "對 :class:`IntEnum` 和 :class:`IntFlag` 是 :meth:`!int.__str__`" -#: ../../library/enum.rst:692 +#: ../../library/enum.rst:697 msgid ":meth:`!str.__str__` for :class:`StrEnum`" msgstr "對 :class:`StrEnum` 是 :meth:`!str.__str__`" -#: ../../library/enum.rst:694 +#: ../../library/enum.rst:699 msgid "" "Inherit from :class:`!ReprEnum` to keep the :class:`str() <str>` / :func:" "`format` of the mixed-in data type instead of using the :class:`Enum`-" @@ -1278,7 +1290,7 @@ msgstr "" "繼承 :class:`!ReprEnum` 來保留混合資料型別的 :class:`str() <str>` / :func:" "`format`,而不是使用 :class:`Enum` 預設的 :meth:`str() <Enum.__str__>`。" -#: ../../library/enum.rst:703 +#: ../../library/enum.rst:708 msgid "" "*EnumCheck* contains the options used by the :func:`verify` decorator to " "ensure various constraints; failed constraints result in a :exc:`ValueError`." @@ -1286,11 +1298,11 @@ msgstr "" "*EnumCheck* 包含 :func:`verify` 裝飾器使用的選項,以確保多樣的限制,不符合限" "制會產生 :exc:`ValueError`。" -#: ../../library/enum.rst:708 +#: ../../library/enum.rst:713 msgid "Ensure that each value has only one name::" msgstr "確保每個值只有一個名稱: ::" -#: ../../library/enum.rst:710 +#: ../../library/enum.rst:715 msgid "" ">>> from enum import Enum, verify, UNIQUE\n" ">>> @verify(UNIQUE)\n" @@ -1314,13 +1326,13 @@ msgstr "" "...\n" "ValueError: aliases found in <enum 'Color'>: CRIMSON -> RED" -#: ../../library/enum.rst:724 +#: ../../library/enum.rst:729 msgid "" "Ensure that there are no missing values between the lowest-valued member and " "the highest-valued member::" msgstr "確保在最小值成員跟最大值成員間沒有缺少值: ::" -#: ../../library/enum.rst:727 +#: ../../library/enum.rst:732 msgid "" ">>> from enum import Enum, verify, CONTINUOUS\n" ">>> @verify(CONTINUOUS)\n" @@ -1342,7 +1354,7 @@ msgstr "" "...\n" "ValueError: invalid enum 'Color': missing values 3, 4" -#: ../../library/enum.rst:739 +#: ../../library/enum.rst:744 msgid "" "Ensure that any flag groups/masks contain only named flags -- useful when " "values are specified instead of being generated by :func:`auto`::" @@ -1350,7 +1362,7 @@ msgstr "" "確保任何旗標群組 / 遮罩只包含命名旗標 -- 當值是用指定而不是透過 :func:`auto` " "產生時是很實用的: ::" -#: ../../library/enum.rst:742 +#: ../../library/enum.rst:747 msgid "" ">>> from enum import Flag, verify, NAMED_FLAGS\n" ">>> @verify(NAMED_FLAGS)\n" @@ -1378,24 +1390,24 @@ msgstr "" "ValueError: invalid Flag 'Color': aliases WHITE and NEON are missing " "combined values of 0x18 [use enum.show_flag_values(value) for details]" -#: ../../library/enum.rst:756 +#: ../../library/enum.rst:761 msgid "" "CONTINUOUS and NAMED_FLAGS are designed to work with integer-valued members." msgstr "CONTINUOUS 和 NAMED_FLAGS 是設計用來運作在整數值的成員上。" -#: ../../library/enum.rst:762 +#: ../../library/enum.rst:767 msgid "" "``FlagBoundary`` controls how out-of-range values are handled in :class:" "`Flag` and its subclasses." msgstr "``FlagBoundary`` 控制在 :class:`Flag` 及其子類別中如何處理範圍外的值。" -#: ../../library/enum.rst:767 +#: ../../library/enum.rst:772 msgid "" "Out-of-range values cause a :exc:`ValueError` to be raised. This is the " "default for :class:`Flag`::" msgstr "範圍外的值會引發 :exc:`ValueError`。這是 :class:`Flag` 的預設行為: ::" -#: ../../library/enum.rst:770 +#: ../../library/enum.rst:775 msgid "" ">>> from enum import Flag, STRICT, auto\n" ">>> class StrictFlag(Flag, boundary=STRICT):\n" @@ -1423,13 +1435,13 @@ msgstr "" " given 0b0 10100\n" " allowed 0b0 00111" -#: ../../library/enum.rst:785 +#: ../../library/enum.rst:790 msgid "" "Out-of-range values have invalid values removed, leaving a valid :class:" "`Flag` value::" msgstr "會移除範圍外的值中的非法值,留下合法的 :class:`Flag` 值: ::" -#: ../../library/enum.rst:788 +#: ../../library/enum.rst:793 msgid "" ">>> from enum import Flag, CONFORM, auto\n" ">>> class ConformFlag(Flag, boundary=CONFORM):\n" @@ -1449,13 +1461,13 @@ msgstr "" ">>> ConformFlag(2**2 + 2**4)\n" "<ConformFlag.BLUE: 4>" -#: ../../library/enum.rst:799 +#: ../../library/enum.rst:804 msgid "" "Out-of-range values lose their :class:`Flag` membership and revert to :class:" "`int`." msgstr "範圍外的值會失去它們的 :class:`Flag` 成員資格且恢復成 :class:`int`。" -#: ../../library/enum.rst:812 +#: ../../library/enum.rst:817 msgid "" "Out-of-range values are kept, and the :class:`Flag` membership is kept. This " "is the default for :class:`IntFlag`::" @@ -1463,7 +1475,7 @@ msgstr "" "範圍外的值會被保留,:class:`Flag` 成員資格也會被保留。這是 :class:`IntFlag` " "的預設行為: ::" -#: ../../library/enum.rst:815 +#: ../../library/enum.rst:820 msgid "" ">>> from enum import Flag, KEEP, auto\n" ">>> class KeepFlag(Flag, boundary=KEEP):\n" @@ -1483,11 +1495,40 @@ msgstr "" ">>> KeepFlag(2**2 + 2**4)\n" "<KeepFlag.BLUE|16: 20>" -#: ../../library/enum.rst:829 +#: ../../library/enum.rst:833 +msgid "" +"*EnumDict* is a subclass of :class:`dict` that is used as the namespace for " +"defining enum classes (see :ref:`prepare`). It is exposed to allow " +"subclasses of :class:`EnumType` with advanced behavior like having multiple " +"values per member. It should be called with the name of the enum class being " +"created, otherwise private names and internal classes will not be handled " +"correctly." +msgstr "" +"*EnumDict* 是 :class:`dict` 的子類別,用來作為定義列舉類別的命名空間(參見 :" +"ref:`prepare`)。它被公開來使得 :class:`EnumType` 的子類別能具有進階行為,例" +"如讓每個成員有多個值。它應該在被呼叫時帶上正在建立的列舉類別名稱,否則私有名" +"稱和內部類別將無法被正確處理。" + +#: ../../library/enum.rst:840 +msgid "" +"Note that only the :class:`~collections.abc.MutableMapping` interface (:meth:" +"`~object.__setitem__` and :meth:`~dict.update`) is overridden. It may be " +"possible to bypass the checks using other :class:`!dict` operations like :" +"meth:`|= <object.__ior__>`." +msgstr "" +"注意只有 :class:`~collections.abc.MutableMapping` 介面(:meth:`~object." +"__setitem__` 和 :meth:`~dict.update`)被覆寫。可能可以使用其他 :class:`!" +"dict` 操作來繞過檢查,例如 :meth:`|= <object.__ior__>`。" + +#: ../../library/enum.rst:847 +msgid "A list of member names." +msgstr "一個成員名稱的串列。" + +#: ../../library/enum.rst:854 msgid "Supported ``__dunder__`` names" msgstr "支援的 ``__dunder__`` 名稱" -#: ../../library/enum.rst:831 +#: ../../library/enum.rst:856 msgid "" ":attr:`~EnumType.__members__` is a read-only ordered mapping of " "``member_name``:``member`` items. It is only available on the class." @@ -1495,7 +1536,7 @@ msgstr "" ":attr:`~EnumType.__members__` 是一個唯讀有序的\\ ``成員名稱``:``成員``\\ 項" "目的對映。只有在類別上可用。" -#: ../../library/enum.rst:834 +#: ../../library/enum.rst:859 msgid "" ":meth:`~Enum.__new__`, if specified, must create and return the enum " "members; it is also a very good idea to set the member's :attr:`!_value_` " @@ -1505,38 +1546,38 @@ msgstr "" "的 :attr:`!_value_` 也是一個很好的主意。一旦所有成員都建立之後就不會再被用" "到。" -#: ../../library/enum.rst:840 +#: ../../library/enum.rst:865 msgid "Supported ``_sunder_`` names" msgstr "支援的 ``_sunder_`` 名稱" -#: ../../library/enum.rst:842 +#: ../../library/enum.rst:867 msgid "" ":meth:`~EnumType._add_alias_` -- adds a new name as an alias to an existing " "member." msgstr ":meth:`~EnumType._add_alias_` -- 新增一個名稱作為現有成員的別名。" -#: ../../library/enum.rst:844 +#: ../../library/enum.rst:869 msgid "" ":meth:`~EnumType._add_value_alias_` -- adds a new value as an alias to an " "existing member." msgstr ":meth:`~EnumType._add_value_alias_` -- 新增一個值作為現有成員的別名。" -#: ../../library/enum.rst:846 +#: ../../library/enum.rst:871 msgid ":attr:`~Enum._name_` -- name of the member" msgstr ":attr:`~Enum._name_` -- 成員名稱" -#: ../../library/enum.rst:847 +#: ../../library/enum.rst:872 msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" msgstr ":attr:`~Enum._value_` -- 成員的值;可以在 ``__new__`` 設定" -#: ../../library/enum.rst:848 +#: ../../library/enum.rst:873 msgid "" ":meth:`~Enum._missing_` -- a lookup function used when a value is not found; " "may be overridden" msgstr "" ":meth:`~Enum._missing_` -- 當值沒有被找到時會使用的查詢函式;可以被覆寫" -#: ../../library/enum.rst:850 +#: ../../library/enum.rst:875 msgid "" ":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" "class:`str`, that will not be transformed into members, and will be removed " @@ -1545,7 +1586,7 @@ msgstr "" ":attr:`~Enum._ignore_` -- 一個名稱的串列,可以是 :class:`list` 或 :class:" "`str`,它不會被轉換成成員,且在最後的類別上會被移除" -#: ../../library/enum.rst:853 +#: ../../library/enum.rst:878 msgid "" ":attr:`~Enum._order_` -- no longer used, kept for backward compatibility " "(class attribute, removed during class creation)" @@ -1553,28 +1594,28 @@ msgstr "" ":attr:`~Enum._order_` -- 不再被使用,僅為了向後相容而保留(類別屬性,在類別建" "立時移除)" -#: ../../library/enum.rst:855 +#: ../../library/enum.rst:880 msgid "" ":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for " "an enum member; may be overridden" msgstr "" ":meth:`~Enum._generate_next_value_` -- 用來為列舉成員取得合適的值;可以被覆寫" -#: ../../library/enum.rst:860 +#: ../../library/enum.rst:885 msgid "" "For standard :class:`Enum` classes the next value chosen is the highest " "value seen incremented by one." msgstr "" "對標準的 :class:`Enum` 類別來說,下一個被選擇的值是所看過的最大值加一。" -#: ../../library/enum.rst:863 +#: ../../library/enum.rst:888 msgid "" "For :class:`Flag` classes the next value chosen will be the next highest " "power-of-two." msgstr "" "對 :class:`Flag` 類別來說,下一個被選擇的值是下一個最大的 2 的次方的數字。" -#: ../../library/enum.rst:866 +#: ../../library/enum.rst:891 msgid "" "While ``_sunder_`` names are generally reserved for the further development " "of the :class:`Enum` class and can not be used, some are explicitly allowed:" @@ -1582,30 +1623,30 @@ msgstr "" "雖然 ``_sunder_`` 名稱通常保留用於 :class:`Enum` 類別的進一步開發而不能被使" "用,但有些是明確允許的:" -#: ../../library/enum.rst:869 +#: ../../library/enum.rst:894 msgid "" "``_repr_*`` (e.g. ``_repr_html_``), as used in `IPython's rich display`_" msgstr "" -"``_repr_*``(例如 ``_repr_html_``),例如用於 `IPython 的豐富顯示 <IPython’s " -"rich display_>`_" +"``_repr_*``\\ (例如 ``_repr_html_``),例如用於 `IPython 的豐富顯示 " +"<IPython’s rich display_>`_" -#: ../../library/enum.rst:871 +#: ../../library/enum.rst:896 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" msgstr "``_missing_``、``_order_``、``_generate_next_value_``" -#: ../../library/enum.rst:872 +#: ../../library/enum.rst:897 msgid "``_ignore_``" msgstr "``_ignore_``" -#: ../../library/enum.rst:873 +#: ../../library/enum.rst:898 msgid "``_add_alias_``, ``_add_value_alias_``, ``_repr_*``" msgstr "``_add_alias_``、``_add_value_alias_``、``_repr_*``" -#: ../../library/enum.rst:879 +#: ../../library/enum.rst:904 msgid "Utilities and Decorators" msgstr "通用項目與裝飾器" -#: ../../library/enum.rst:883 +#: ../../library/enum.rst:908 msgid "" "*auto* can be used in place of a value. If used, the *Enum* machinery will " "call an :class:`Enum`'s :meth:`~Enum._generate_next_value_` to get an " @@ -1621,16 +1662,16 @@ msgstr "" "`IntFlag` 來說,是第一個比最大值還大的 2 的次方的數字;對 :class:`StrEnum` 來" "說,是成員名稱的小寫版本。如果混用 *auto()* 和手動指定值的話要特別注意。" -#: ../../library/enum.rst:891 +#: ../../library/enum.rst:916 msgid "" "*auto* instances are only resolved when at the top level of an assignment:" msgstr "*auto* 實例只有在最上層的賦值時才會被解析:" -#: ../../library/enum.rst:893 +#: ../../library/enum.rst:918 msgid "``FIRST = auto()`` will work (auto() is replaced with ``1``);" msgstr "``FIRST = auto()`` 可以運作(auto() 會被取代成 ``1``)" -#: ../../library/enum.rst:894 +#: ../../library/enum.rst:919 msgid "" "``SECOND = auto(), -2`` will work (auto is replaced with ``2``, so ``2, -2`` " "is used to create the ``SECOND`` enum member;" @@ -1638,7 +1679,7 @@ msgstr "" "``SECOND = auto(), -2`` 可以運作(auto 會被取代成 ``2``, 因此 ``2, -2`` 會被" "用來建立列舉成員 ``SECOND``;" -#: ../../library/enum.rst:896 +#: ../../library/enum.rst:921 msgid "" "``THREE = [auto(), -3]`` will *not* work (``<auto instance>, -3`` is used to " "create the ``THREE`` enum member)" @@ -1646,19 +1687,19 @@ msgstr "" "``THREE = [auto(), -3]`` *無法*\\ 運作(\\ ``<auto 實例>, -3`` 會被用來建立列" "舉成員 ``THREE``)" -#: ../../library/enum.rst:901 +#: ../../library/enum.rst:926 msgid "" "In prior versions, ``auto()`` had to be the only thing on the assignment " "line to work properly." msgstr "在之前的版本中,``auto()`` 必須是賦值行裡的唯一內容才能運作正確。" -#: ../../library/enum.rst:904 +#: ../../library/enum.rst:929 msgid "" "``_generate_next_value_`` can be overridden to customize the values used by " "*auto*." msgstr "可以覆寫 ``_generate_next_value_`` 來客製 *auto* 使用的值。" -#: ../../library/enum.rst:907 +#: ../../library/enum.rst:932 msgid "" "in 3.13 the default ``_generate_next_value_`` will always return the highest " "member value incremented by 1, and will fail if any member is an " @@ -1667,7 +1708,7 @@ msgstr "" "在 3.13 預設 ``_generate_next_value_`` 總是回傳最大的成員值加一,如果任何成員" "是不相容的型別就會失敗。" -#: ../../library/enum.rst:913 +#: ../../library/enum.rst:938 msgid "" "A decorator similar to the built-in *property*, but specifically for " "enumerations. It allows member attributes to have the same names as members " @@ -1676,7 +1717,7 @@ msgstr "" "和內建的 *property* 相似的裝飾器,但只專門針對列舉。它允許成員屬性和成員本身" "有相同名稱。" -#: ../../library/enum.rst:917 +#: ../../library/enum.rst:942 msgid "" "the *property* and the member must be defined in separate classes; for " "example, the *value* and *name* attributes are defined in the *Enum* class, " @@ -1686,7 +1727,7 @@ msgstr "" "*屬性*\\ 和成員必須定義在分開的類別裡;例如 *value* 和 *name* 屬性定義在 " "*Enum* 類別而 *Enum* 子類別可以定義成員名稱為 ``value`` 和 ``name``。" -#: ../../library/enum.rst:926 +#: ../../library/enum.rst:951 msgid "" "A :keyword:`class` decorator specifically for enumerations. It searches an " "enumeration's :attr:`~EnumType.__members__`, gathering any aliases it finds; " @@ -1696,7 +1737,7 @@ msgstr "" "__members__`,蒐集任何它找到的別名;如果有找到任何別名則引發 :exc:" "`ValueError` 並附上細節: ::" -#: ../../library/enum.rst:930 +#: ../../library/enum.rst:955 msgid "" ">>> from enum import Enum, unique\n" ">>> @unique\n" @@ -1722,7 +1763,7 @@ msgstr "" "...\n" "ValueError: duplicate values found in <enum 'Mistake'>: FOUR -> THREE" -#: ../../library/enum.rst:944 +#: ../../library/enum.rst:969 msgid "" "A :keyword:`class` decorator specifically for enumerations. Members from :" "class:`EnumCheck` are used to specify which constraints should be checked on " @@ -1731,15 +1772,15 @@ msgstr "" "專門針對列舉的 :keyword:`class` 裝飾器。使用 :class:`EnumCheck` 裡的成員來指" "定在裝飾的列舉上應該檢查什麼限制。" -#: ../../library/enum.rst:952 +#: ../../library/enum.rst:977 msgid "A decorator for use in enums: its target will become a member." msgstr "列舉所使用的裝飾器:其目標會變成成員。" -#: ../../library/enum.rst:958 +#: ../../library/enum.rst:983 msgid "A decorator for use in enums: its target will not become a member." msgstr "列舉所使用的裝飾器:其目標不會變成成員。" -#: ../../library/enum.rst:964 +#: ../../library/enum.rst:989 msgid "" "A decorator to change the :class:`str() <str>` and :func:`repr` of an enum " "to show its members as belonging to the module instead of its class. Should " @@ -1750,19 +1791,19 @@ msgstr "" "組而不是其類別。應該只有當列舉成員被匯出到模組的全域命名空間才使用(範例請參" "考 :class:`re.RegexFlag`)。" -#: ../../library/enum.rst:974 +#: ../../library/enum.rst:998 msgid "Return a list of all power-of-two integers contained in a flag *value*." msgstr "回傳在旗標\\ *值*\\ 中包含的所有 2 的次方的整數串列。" -#: ../../library/enum.rst:981 +#: ../../library/enum.rst:1006 msgid "Notes" msgstr "備註" -#: ../../library/enum.rst:983 +#: ../../library/enum.rst:1008 msgid ":class:`IntEnum`, :class:`StrEnum`, and :class:`IntFlag`" msgstr ":class:`IntEnum`、:class:`StrEnum` 及 :class:`IntFlag`" -#: ../../library/enum.rst:985 +#: ../../library/enum.rst:1010 msgid "" "These three enum types are designed to be drop-in replacements for existing " "integer- and string-based values; as such, they have extra limitations:" @@ -1770,17 +1811,17 @@ msgstr "" "這三種列舉型別是設計來直接取代現有以整數及字串為基底的值;因此它們有額外的限" "制:" -#: ../../library/enum.rst:988 +#: ../../library/enum.rst:1013 msgid "``__str__`` uses the value and not the name of the enum member" msgstr "``__str__`` 使用值而不是列舉成員的名稱" -#: ../../library/enum.rst:990 +#: ../../library/enum.rst:1015 msgid "" "``__format__``, because it uses ``__str__``, will also use the value of the " "enum member instead of its name" msgstr "``__format__`` 因為使用 ``__str__``,也會使用值而不是列舉成員的名稱" -#: ../../library/enum.rst:993 +#: ../../library/enum.rst:1018 msgid "" "If you do not need/want those limitations, you can either create your own " "base class by mixing in the ``int`` or ``str`` type yourself::" @@ -1788,7 +1829,7 @@ msgstr "" "如果你不需要或不想要這些限制,你可以透過混合 ``int`` 或 ``str`` 型別來建立自" "己的基礎類別: ::" -#: ../../library/enum.rst:996 +#: ../../library/enum.rst:1021 msgid "" ">>> from enum import Enum\n" ">>> class MyIntEnum(int, Enum):\n" @@ -1798,11 +1839,11 @@ msgstr "" ">>> class MyIntEnum(int, Enum):\n" "... pass" -#: ../../library/enum.rst:1000 +#: ../../library/enum.rst:1025 msgid "or you can reassign the appropriate :meth:`str`, etc., in your enum::" msgstr "或者你也可以在你的列舉重新給定合適的 :meth:`str`: ::" -#: ../../library/enum.rst:1002 +#: ../../library/enum.rst:1027 msgid "" ">>> from enum import Enum, IntEnum\n" ">>> class MyIntEnum(IntEnum):\n" diff --git a/library/filesys.po b/library/filesys.po index 039d7bf996..9c42ea3858 100644 --- a/library/filesys.po +++ b/library/filesys.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -9,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-18 00:04+0000\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2021-11-22 20:13+0800\n" "Last-Translator: Allen Wu <allen91.wu@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,11 +35,11 @@ msgstr "" "取檔案的屬性、以可攜 (portable) 方式操作路徑以及建立暫存檔。本章中的完整 " "module 清單是:" -#: ../../library/filesys.rst:29 +#: ../../library/filesys.rst:28 msgid "Module :mod:`os`" msgstr "Module :mod:`os`" -#: ../../library/filesys.rst:30 +#: ../../library/filesys.rst:29 msgid "" "Operating system interfaces, including functions to work with files at a " "lower level than Python :term:`file objects <file object>`." @@ -48,11 +47,11 @@ msgstr "" "作業系統介面,包括處理比 Python :term:`檔案物件 <file object>`\\ 更低階檔案的" "函式。" -#: ../../library/filesys.rst:33 +#: ../../library/filesys.rst:32 msgid "Module :mod:`io`" msgstr "Module :mod:`io`" -#: ../../library/filesys.rst:34 +#: ../../library/filesys.rst:33 msgid "" "Python's built-in I/O library, including both abstract classes and some " "concrete classes such as file I/O." @@ -60,10 +59,10 @@ msgstr "" "Python 的內建 I/O 函式庫,包含抽象類別和一些具體類別 (concrete class),如檔" "案 I/O。" -#: ../../library/filesys.rst:37 +#: ../../library/filesys.rst:36 msgid "Built-in function :func:`open`" msgstr "內建函式 :func:`open`" -#: ../../library/filesys.rst:38 +#: ../../library/filesys.rst:37 msgid "The standard way to open files for reading and writing with Python." msgstr "使用 Python 打開檔案以進行讀寫檔案的標準方法。" diff --git a/library/getopt.po b/library/getopt.po index 8ec79f09ad..f9d84aca9d 100644 --- a/library/getopt.po +++ b/library/getopt.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-05 00:13+0000\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2016-01-31 07:19+0000\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,22 +25,16 @@ msgstr ":mod:`!getopt` --- 用於命令列選項的 C 風格剖析器" msgid "**Source code:** :source:`Lib/getopt.py`" msgstr "**原始碼:**\\ :source:`Lib/getopt.py`" -#: ../../library/getopt.rst:10 +#: ../../library/getopt.rst:12 msgid "" -"The :mod:`getopt` module is :term:`soft deprecated` and will not be " -"developed further; development will continue with the :mod:`argparse` module." +"This module is considered feature complete. A more declarative and " +"extensible alternative to this API is provided in the :mod:`optparse` " +"module. Further functional enhancements for command line parameter " +"processing are provided either as third party modules on PyPI, or else as " +"features in the :mod:`argparse` module." msgstr "" -#: ../../library/getopt.rst:17 -msgid "" -"The :mod:`getopt` module is a parser for command line options whose API is " -"designed to be familiar to users of the C :c:func:`!getopt` function. Users " -"who are unfamiliar with the C :c:func:`!getopt` function or who would like " -"to write less code and get better help and error messages should consider " -"using the :mod:`argparse` module instead." -msgstr "" - -#: ../../library/getopt.rst:25 +#: ../../library/getopt.rst:20 msgid "" "This module helps scripts to parse the command line arguments in ``sys." "argv``. It supports the same conventions as the Unix :c:func:`!getopt` " @@ -49,11 +43,21 @@ msgid "" "be used as well via an optional third argument." msgstr "" -#: ../../library/getopt.rst:31 -msgid "This module provides two functions and an exception:" +#: ../../library/getopt.rst:26 +msgid "" +"Users who are unfamiliar with the Unix :c:func:`!getopt` function should " +"consider using the :mod:`argparse` module instead. Users who are familiar " +"with the Unix :c:func:`!getopt` function, but would like to get equivalent " +"behavior while writing less code and getting better help and error messages " +"should consider using the :mod:`optparse` module. See :ref:`choosing-an-" +"argument-parser` for additional details." msgstr "" -#: ../../library/getopt.rst:37 +#: ../../library/getopt.rst:33 +msgid "This module provides two functions and an exception:" +msgstr "這個模組提供兩個函式和一個例外:" + +#: ../../library/getopt.rst:39 msgid "" "Parses command line options and parameter list. *args* is the argument list " "to be parsed, without the leading reference to the running program. " @@ -63,14 +67,14 @@ msgid "" "func:`!getopt` uses)." msgstr "" -#: ../../library/getopt.rst:45 +#: ../../library/getopt.rst:47 msgid "" "Unlike GNU :c:func:`!getopt`, after a non-option argument, all further " "arguments are considered also non-options. This is similar to the way non-" "GNU Unix systems work." msgstr "" -#: ../../library/getopt.rst:49 +#: ../../library/getopt.rst:51 msgid "" "*longopts*, if specified, must be a list of strings with the names of the " "long options which should be supported. The leading ``'--'`` characters " @@ -84,7 +88,7 @@ msgid "" "uniquely, so :exc:`GetoptError` will be raised." msgstr "" -#: ../../library/getopt.rst:60 +#: ../../library/getopt.rst:62 msgid "" "The return value consists of two elements: the first is a list of ``(option, " "value)`` pairs; the second is the list of program arguments left after the " @@ -97,7 +101,7 @@ msgid "" "occurrences. Long and short options may be mixed." msgstr "" -#: ../../library/getopt.rst:73 +#: ../../library/getopt.rst:75 msgid "" "This function works like :func:`getopt`, except that GNU style scanning mode " "is used by default. This means that option and non-option arguments may be " @@ -105,14 +109,14 @@ msgid "" "a non-option argument is encountered." msgstr "" -#: ../../library/getopt.rst:78 +#: ../../library/getopt.rst:80 msgid "" "If the first character of the option string is ``'+'``, or if the " "environment variable :envvar:`!POSIXLY_CORRECT` is set, then option " "processing stops as soon as a non-option argument is encountered." msgstr "" -#: ../../library/getopt.rst:85 +#: ../../library/getopt.rst:87 msgid "" "This is raised when an unrecognized option is found in the argument list or " "when an option requiring an argument is given none. The argument to the " @@ -123,15 +127,15 @@ msgid "" "which the exception relates, :attr:`!opt` is an empty string." msgstr "" -#: ../../library/getopt.rst:96 +#: ../../library/getopt.rst:98 msgid "Alias for :exc:`GetoptError`; for backward compatibility." -msgstr "" +msgstr "為了向後相容性而設的 :exc:`GetoptError` 別名。" -#: ../../library/getopt.rst:98 +#: ../../library/getopt.rst:100 msgid "An example using only Unix style options:" -msgstr "" +msgstr "一個僅使用 Unix 風格選項的範例:" -#: ../../library/getopt.rst:100 +#: ../../library/getopt.rst:102 msgid "" ">>> import getopt\n" ">>> args = '-a -b -cfoo -d bar a1 a2'.split()\n" @@ -153,11 +157,11 @@ msgstr "" ">>> args\n" "['a1', 'a2']" -#: ../../library/getopt.rst:112 +#: ../../library/getopt.rst:114 msgid "Using long option names is equally easy:" -msgstr "" +msgstr "使用長選項名稱同樣容易:" -#: ../../library/getopt.rst:114 +#: ../../library/getopt.rst:116 msgid "" ">>> s = '--condition=foo --testing --output-file abc.def -x a1 a2'\n" ">>> args = s.split()\n" @@ -185,11 +189,11 @@ msgstr "" ">>> args\n" "['a1', 'a2']" -#: ../../library/getopt.rst:127 +#: ../../library/getopt.rst:129 msgid "In a script, typical usage is something like this:" -msgstr "" +msgstr "在腳本中,典型的用法如下:" -#: ../../library/getopt.rst:129 +#: ../../library/getopt.rst:131 msgid "" "import getopt, sys\n" "\n" @@ -215,7 +219,7 @@ msgid "" " output = a\n" " else:\n" " assert False, \"unhandled option\"\n" -" # ...\n" +" process(args, output=output, verbose=verbose)\n" "\n" "if __name__ == \"__main__\":\n" " main()" @@ -243,35 +247,87 @@ msgstr "" " output = a\n" " else:\n" " assert False, \"unhandled option\"\n" -" # ...\n" +" process(args, output=output, verbose=verbose)\n" "\n" "if __name__ == \"__main__\":\n" " main()" -#: ../../library/getopt.rst:158 +#: ../../library/getopt.rst:160 msgid "" "Note that an equivalent command line interface could be produced with less " "code and more informative help and error messages by using the :mod:" -"`argparse` module:" +"`optparse` module:" msgstr "" -#: ../../library/getopt.rst:161 +#: ../../library/getopt.rst:163 msgid "" +"import optparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = optparse.OptionParser()\n" +" parser.add_option('-o', '--output')\n" +" parser.add_option('-v', dest='verbose', action='http://github.com/store_true')\n" +" opts, args = parser.parse_args()\n" +" process(args, output=opts.output, verbose=opts.verbose)" +msgstr "" +"import optparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = optparse.OptionParser()\n" +" parser.add_option('-o', '--output')\n" +" parser.add_option('-v', dest='verbose', action='http://github.com/store_true')\n" +" opts, args = parser.parse_args()\n" +" process(args, output=opts.output, verbose=opts.verbose)" + +#: ../../library/getopt.rst:174 +msgid "" +"A roughly equivalent command line interface for this case can also be " +"produced by using the :mod:`argparse` module:" +msgstr "" + +#: ../../library/getopt.rst:177 +msgid "" +"import argparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = argparse.ArgumentParser()\n" +" parser.add_argument('-o', '--output')\n" +" parser.add_argument('-v', dest='verbose', action='http://github.com/store_true')\n" +" parser.add_argument('rest', nargs='*')\n" +" args = parser.parse_args()\n" +" process(args.rest, output=args.output, verbose=args.verbose)" +msgstr "" "import argparse\n" "\n" "if __name__ == '__main__':\n" " parser = argparse.ArgumentParser()\n" " parser.add_argument('-o', '--output')\n" " parser.add_argument('-v', dest='verbose', action='http://github.com/store_true')\n" +" parser.add_argument('rest', nargs='*')\n" " args = parser.parse_args()\n" -" # ... do something with args.output ...\n" -" # ... do something with args.verbose .." +" process(args.rest, output=args.output, verbose=args.verbose)" + +#: ../../library/getopt.rst:189 +msgid "" +"See :ref:`choosing-an-argument-parser` for details on how the ``argparse`` " +"version of this code differs in behaviour from the ``optparse`` (and " +"``getopt``) version." msgstr "" +"參見 :ref:`choosing-an-argument-parser` 以瞭解這段程式碼的 ``argparse`` 版本" +"與 ``optparse``\\(以及 ``getopt``)版本在行為上的差異。" + +#: ../../library/getopt.rst:195 +msgid "Module :mod:`optparse`" +msgstr ":mod:`optparse` 模組" + +#: ../../library/getopt.rst:196 +msgid "Declarative command line option parsing." +msgstr "宣告式命令列選項剖析。" -#: ../../library/getopt.rst:175 +#: ../../library/getopt.rst:198 msgid "Module :mod:`argparse`" msgstr ":mod:`argparse` 模組" -#: ../../library/getopt.rst:176 -msgid "Alternative command line option and argument parsing library." +#: ../../library/getopt.rst:199 +msgid "More opinionated command line option and argument parsing library." msgstr "" diff --git a/library/io.po b/library/io.po index feecd18d50..22a257e59f 100644 --- a/library/io.po +++ b/library/io.po @@ -345,7 +345,7 @@ msgid "" "This is a helper function for callables that use :func:`open` or :class:" "`TextIOWrapper` and have an ``encoding=None`` parameter." msgstr "" -"這是個輔助函數,適用於使用 :func:`open` 或 :class:`TextIOWrapper` 且具有 " +"這是個輔助函式,適用於使用 :func:`open` 或 :class:`TextIOWrapper` 且具有 " "``encoding=None`` 參數的可呼叫物件。" #: ../../library/io.rst:203 diff --git a/library/itertools.po b/library/itertools.po index f7ba031e9c..48da6e992c 100644 --- a/library/itertools.po +++ b/library/itertools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-05 00:14+0000\n" +"POT-Creation-Date: 2024-12-17 00:14+0000\n" "PO-Revision-Date: 2024-08-16 15:01+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -55,383 +55,371 @@ msgstr "" "f(1), ...``。在 Python 中,可以透過結合 :func:`map` 和 :func:`count` 組成 " "``map(f, count())`` 以達到同樣的效果。" -#: ../../library/itertools.rst:33 -msgid "" -"These tools and their built-in counterparts also work well with the high-" -"speed functions in the :mod:`operator` module. For example, the " -"multiplication operator can be mapped across two vectors to form an " -"efficient dot-product: ``sum(starmap(operator.mul, zip(vec1, vec2, " -"strict=True)))``." -msgstr "" -"這些工具及其內建的對等部分 (counterpart) 也可以很好地與 :mod:`operator` 模組" -"中的高速函式配合使用。例如,乘法運算子可以對映到兩個向量上以組成高效率的內" -"積:``sum(starmap(operator.mul, zip(vec1, vec2, strict=True)))``。" - -#: ../../library/itertools.rst:39 +#: ../../library/itertools.rst:34 msgid "**Infinite iterators:**" msgstr "**無限疊代器:**" -#: ../../library/itertools.rst:42 ../../library/itertools.rst:52 -#: ../../library/itertools.rst:73 +#: ../../library/itertools.rst:37 ../../library/itertools.rst:47 +#: ../../library/itertools.rst:68 msgid "Iterator" msgstr "疊代器" -#: ../../library/itertools.rst:42 ../../library/itertools.rst:52 -#: ../../library/itertools.rst:73 +#: ../../library/itertools.rst:37 ../../library/itertools.rst:47 +#: ../../library/itertools.rst:68 msgid "Arguments" msgstr "引數" -#: ../../library/itertools.rst:42 ../../library/itertools.rst:52 -#: ../../library/itertools.rst:73 ../../library/itertools.rst:82 +#: ../../library/itertools.rst:37 ../../library/itertools.rst:47 +#: ../../library/itertools.rst:68 ../../library/itertools.rst:77 msgid "Results" msgstr "結果" -#: ../../library/itertools.rst:42 ../../library/itertools.rst:52 +#: ../../library/itertools.rst:37 ../../library/itertools.rst:47 msgid "Example" msgstr "範例" -#: ../../library/itertools.rst:44 +#: ../../library/itertools.rst:39 msgid ":func:`count`" msgstr ":func:`count`" -#: ../../library/itertools.rst:44 +#: ../../library/itertools.rst:39 msgid "[start[, step]]" msgstr "[start[, step]]" -#: ../../library/itertools.rst:44 +#: ../../library/itertools.rst:39 msgid "start, start+step, start+2*step, ..." msgstr "start, start+step, start+2*step, ..." -#: ../../library/itertools.rst:44 +#: ../../library/itertools.rst:39 msgid "``count(10) → 10 11 12 13 14 ...``" msgstr "``count(10) → 10 11 12 13 14 ...``" -#: ../../library/itertools.rst:45 +#: ../../library/itertools.rst:40 msgid ":func:`cycle`" msgstr ":func:`cycle`" -#: ../../library/itertools.rst:45 +#: ../../library/itertools.rst:40 msgid "p" msgstr "p" -#: ../../library/itertools.rst:45 +#: ../../library/itertools.rst:40 msgid "p0, p1, ... plast, p0, p1, ..." msgstr "p0, p1, ... plast, p0, p1, ..." -#: ../../library/itertools.rst:45 +#: ../../library/itertools.rst:40 msgid "``cycle('ABCD') → A B C D A B C D ...``" msgstr "``cycle('ABCD') → A B C D A B C D ...``" -#: ../../library/itertools.rst:46 +#: ../../library/itertools.rst:41 msgid ":func:`repeat`" msgstr ":func:`repeat`" -#: ../../library/itertools.rst:46 +#: ../../library/itertools.rst:41 msgid "elem [,n]" msgstr "elem [,n]" -#: ../../library/itertools.rst:46 +#: ../../library/itertools.rst:41 msgid "elem, elem, elem, ... endlessly or up to n times" msgstr "elem, elem, elem,... 重複無限次或 n 次" -#: ../../library/itertools.rst:46 +#: ../../library/itertools.rst:41 msgid "``repeat(10, 3) → 10 10 10``" msgstr "``repeat(10, 3) → 10 10 10``" -#: ../../library/itertools.rst:49 +#: ../../library/itertools.rst:44 msgid "**Iterators terminating on the shortest input sequence:**" msgstr "**在最短輸入序列 (shortest input sequence) 處終止的疊代器:**" -#: ../../library/itertools.rst:54 +#: ../../library/itertools.rst:49 msgid ":func:`accumulate`" msgstr ":func:`accumulate`" -#: ../../library/itertools.rst:54 +#: ../../library/itertools.rst:49 msgid "p [,func]" msgstr "p [,func]" -#: ../../library/itertools.rst:54 +#: ../../library/itertools.rst:49 msgid "p0, p0+p1, p0+p1+p2, ..." msgstr "p0, p0+p1, p0+p1+p2, ..." -#: ../../library/itertools.rst:54 +#: ../../library/itertools.rst:49 msgid "``accumulate([1,2,3,4,5]) → 1 3 6 10 15``" msgstr "``accumulate([1,2,3,4,5]) → 1 3 6 10 15``" -#: ../../library/itertools.rst:55 +#: ../../library/itertools.rst:50 msgid ":func:`batched`" msgstr ":func:`batched`" -#: ../../library/itertools.rst:55 +#: ../../library/itertools.rst:50 msgid "p, n" msgstr "p, n" -#: ../../library/itertools.rst:55 +#: ../../library/itertools.rst:50 msgid "(p0, p1, ..., p_n-1), ..." msgstr "(p0, p1, ..., p_n-1), ..." -#: ../../library/itertools.rst:55 +#: ../../library/itertools.rst:50 msgid "``batched('ABCDEFG', n=3) → ABC DEF G``" msgstr "``batched('ABCDEFG', n=3) → ABC DEF G``" -#: ../../library/itertools.rst:56 +#: ../../library/itertools.rst:51 msgid ":func:`chain`" msgstr ":func:`chain`" -#: ../../library/itertools.rst:56 ../../library/itertools.rst:67 +#: ../../library/itertools.rst:51 ../../library/itertools.rst:62 msgid "p, q, ..." msgstr "p, q, ..." -#: ../../library/itertools.rst:56 ../../library/itertools.rst:57 +#: ../../library/itertools.rst:51 ../../library/itertools.rst:52 msgid "p0, p1, ... plast, q0, q1, ..." msgstr "p0, p1, ... plast, q0, q1, ..." -#: ../../library/itertools.rst:56 +#: ../../library/itertools.rst:51 msgid "``chain('ABC', 'DEF') → A B C D E F``" msgstr "``chain('ABC', 'DEF') → A B C D E F``" -#: ../../library/itertools.rst:57 +#: ../../library/itertools.rst:52 msgid ":func:`chain.from_iterable`" msgstr ":func:`chain.from_iterable`" -#: ../../library/itertools.rst:57 ../../library/itertools.rst:63 +#: ../../library/itertools.rst:52 ../../library/itertools.rst:58 msgid "iterable" msgstr "可疊代物件" -#: ../../library/itertools.rst:57 +#: ../../library/itertools.rst:52 msgid "``chain.from_iterable(['ABC', 'DEF']) → A B C D E F``" msgstr "``chain.from_iterable(['ABC', 'DEF']) → A B C D E F``" -#: ../../library/itertools.rst:58 +#: ../../library/itertools.rst:53 msgid ":func:`compress`" msgstr ":func:`compress`" -#: ../../library/itertools.rst:58 +#: ../../library/itertools.rst:53 msgid "data, selectors" msgstr "data, selectors" -#: ../../library/itertools.rst:58 +#: ../../library/itertools.rst:53 msgid "(d[0] if s[0]), (d[1] if s[1]), ..." msgstr "(d[0] if s[0]), (d[1] if s[1]), ..." -#: ../../library/itertools.rst:58 +#: ../../library/itertools.rst:53 msgid "``compress('ABCDEF', [1,0,1,0,1,1]) → A C E F``" msgstr "``compress('ABCDEF', [1,0,1,0,1,1]) → A C E F``" -#: ../../library/itertools.rst:59 +#: ../../library/itertools.rst:54 msgid ":func:`dropwhile`" msgstr ":func:`dropwhile`" -#: ../../library/itertools.rst:59 ../../library/itertools.rst:60 -#: ../../library/itertools.rst:65 +#: ../../library/itertools.rst:54 ../../library/itertools.rst:55 +#: ../../library/itertools.rst:60 msgid "predicate, seq" msgstr "predicate, seq" -#: ../../library/itertools.rst:59 +#: ../../library/itertools.rst:54 msgid "seq[n], seq[n+1], starting when predicate fails" msgstr "seq[n], seq[n+1],當 predicate 失敗時開始" -#: ../../library/itertools.rst:59 +#: ../../library/itertools.rst:54 msgid "``dropwhile(lambda x: x<5, [1,4,6,3,8]) → 6 3 8``" msgstr "``dropwhile(lambda x: x<5, [1,4,6,3,8]) → 6 3 8``" -#: ../../library/itertools.rst:60 +#: ../../library/itertools.rst:55 msgid ":func:`filterfalse`" msgstr ":func:`filterfalse`" -#: ../../library/itertools.rst:60 +#: ../../library/itertools.rst:55 msgid "elements of seq where predicate(elem) fails" msgstr "當 predicate(elem) 失敗時 seq 的元素" -#: ../../library/itertools.rst:60 +#: ../../library/itertools.rst:55 msgid "``filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8``" msgstr "``filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8``" -#: ../../library/itertools.rst:61 +#: ../../library/itertools.rst:56 msgid ":func:`groupby`" msgstr ":func:`groupby`" -#: ../../library/itertools.rst:61 +#: ../../library/itertools.rst:56 msgid "iterable[, key]" msgstr "iterable[, key]" -#: ../../library/itertools.rst:61 +#: ../../library/itertools.rst:56 msgid "sub-iterators grouped by value of key(v)" msgstr "根據 key(v) 的值分組的子疊代器" -#: ../../library/itertools.rst:61 +#: ../../library/itertools.rst:56 msgid "``groupby(['A','B','DEF'], len) → (1, A B) (3, DEF)``" msgstr "``groupby(['A','B','DEF'], len) → (1, A B) (3, DEF)``" -#: ../../library/itertools.rst:62 +#: ../../library/itertools.rst:57 msgid ":func:`islice`" msgstr ":func:`islice`" -#: ../../library/itertools.rst:62 +#: ../../library/itertools.rst:57 msgid "seq, [start,] stop [, step]" msgstr "seq, [start,] stop [, step]" -#: ../../library/itertools.rst:62 +#: ../../library/itertools.rst:57 msgid "elements from seq[start:stop:step]" msgstr "seq[start:stop:step] 的元素" -#: ../../library/itertools.rst:62 +#: ../../library/itertools.rst:57 msgid "``islice('ABCDEFG', 2, None) → C D E F G``" msgstr "``islice('ABCDEFG', 2, None) → C D E F G``" -#: ../../library/itertools.rst:63 +#: ../../library/itertools.rst:58 msgid ":func:`pairwise`" msgstr ":func:`pairwise`" -#: ../../library/itertools.rst:63 +#: ../../library/itertools.rst:58 msgid "(p[0], p[1]), (p[1], p[2])" msgstr "(p[0], p[1]), (p[1], p[2])" -#: ../../library/itertools.rst:63 +#: ../../library/itertools.rst:58 msgid "``pairwise('ABCDEFG') → AB BC CD DE EF FG``" msgstr "``pairwise('ABCDEFG') → AB BC CD DE EF FG``" -#: ../../library/itertools.rst:64 +#: ../../library/itertools.rst:59 msgid ":func:`starmap`" msgstr ":func:`starmap`" -#: ../../library/itertools.rst:64 +#: ../../library/itertools.rst:59 msgid "func, seq" msgstr "func, seq" -#: ../../library/itertools.rst:64 +#: ../../library/itertools.rst:59 msgid "func(\\*seq[0]), func(\\*seq[1]), ..." msgstr "func(\\*seq[0]), func(\\*seq[1]), ..." -#: ../../library/itertools.rst:64 +#: ../../library/itertools.rst:59 msgid "``starmap(pow, [(2,5), (3,2), (10,3)]) → 32 9 1000``" msgstr "``starmap(pow, [(2,5), (3,2), (10,3)]) → 32 9 1000``" -#: ../../library/itertools.rst:65 +#: ../../library/itertools.rst:60 msgid ":func:`takewhile`" msgstr ":func:`takewhile`" -#: ../../library/itertools.rst:65 +#: ../../library/itertools.rst:60 msgid "seq[0], seq[1], until predicate fails" msgstr "seq[0], seq[1],直到 predicate 失敗" -#: ../../library/itertools.rst:65 +#: ../../library/itertools.rst:60 msgid "``takewhile(lambda x: x<5, [1,4,6,3,8]) → 1 4``" msgstr "``takewhile(lambda x: x<5, [1,4,6,3,8]) → 1 4``" -#: ../../library/itertools.rst:66 +#: ../../library/itertools.rst:61 msgid ":func:`tee`" msgstr ":func:`tee`" -#: ../../library/itertools.rst:66 +#: ../../library/itertools.rst:61 msgid "it, n" msgstr "it, n" -#: ../../library/itertools.rst:66 +#: ../../library/itertools.rst:61 msgid "it1, it2, ... itn splits one iterator into n" msgstr "it1, it2, ... itn,將一個疊代器分成 n 個" -#: ../../library/itertools.rst:67 +#: ../../library/itertools.rst:62 msgid ":func:`zip_longest`" msgstr ":func:`zip_longest`" -#: ../../library/itertools.rst:67 +#: ../../library/itertools.rst:62 msgid "(p[0], q[0]), (p[1], q[1]), ..." msgstr "(p[0], q[0]), (p[1], q[1]), ..." -#: ../../library/itertools.rst:67 +#: ../../library/itertools.rst:62 msgid "``zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-``" msgstr "``zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-``" -#: ../../library/itertools.rst:70 +#: ../../library/itertools.rst:65 msgid "**Combinatoric iterators:**" msgstr "**組合疊代器:**" -#: ../../library/itertools.rst:75 +#: ../../library/itertools.rst:70 msgid ":func:`product`" msgstr ":func:`product`" -#: ../../library/itertools.rst:75 +#: ../../library/itertools.rst:70 msgid "p, q, ... [repeat=1]" msgstr "p, q, ... [repeat=1]" -#: ../../library/itertools.rst:75 +#: ../../library/itertools.rst:70 msgid "cartesian product, equivalent to a nested for-loop" msgstr "笛卡爾乘積 (cartesian product),相當於巢狀的 for 迴圈" -#: ../../library/itertools.rst:76 +#: ../../library/itertools.rst:71 msgid ":func:`permutations`" msgstr ":func:`permutations`" -#: ../../library/itertools.rst:76 +#: ../../library/itertools.rst:71 msgid "p[, r]" msgstr "p[, r]" -#: ../../library/itertools.rst:76 +#: ../../library/itertools.rst:71 msgid "r-length tuples, all possible orderings, no repeated elements" msgstr "長度為 r 的元組,所有可能的定序,無重複元素" -#: ../../library/itertools.rst:77 +#: ../../library/itertools.rst:72 msgid ":func:`combinations`" msgstr ":func:`combinations`" -#: ../../library/itertools.rst:77 ../../library/itertools.rst:78 +#: ../../library/itertools.rst:72 ../../library/itertools.rst:73 msgid "p, r" msgstr "p, r" -#: ../../library/itertools.rst:77 +#: ../../library/itertools.rst:72 msgid "r-length tuples, in sorted order, no repeated elements" msgstr "長度為 r 的元組,按照排序過後的定序,無重複元素" -#: ../../library/itertools.rst:78 +#: ../../library/itertools.rst:73 msgid ":func:`combinations_with_replacement`" msgstr ":func:`combinations_with_replacement`" -#: ../../library/itertools.rst:78 +#: ../../library/itertools.rst:73 msgid "r-length tuples, in sorted order, with repeated elements" msgstr "長度為 r 的元組,按照排序過後的定序,有重複元素" -#: ../../library/itertools.rst:82 +#: ../../library/itertools.rst:77 msgid "Examples" msgstr "範例" -#: ../../library/itertools.rst:84 +#: ../../library/itertools.rst:79 msgid "``product('ABCD', repeat=2)``" msgstr "``product('ABCD', repeat=2)``" -#: ../../library/itertools.rst:84 +#: ../../library/itertools.rst:79 msgid "``AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD``" msgstr "``AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD``" -#: ../../library/itertools.rst:85 +#: ../../library/itertools.rst:80 msgid "``permutations('ABCD', 2)``" msgstr "``permutations('ABCD', 2)``" -#: ../../library/itertools.rst:85 +#: ../../library/itertools.rst:80 msgid "``AB AC AD BA BC BD CA CB CD DA DB DC``" msgstr "``AB AC AD BA BC BD CA CB CD DA DB DC``" -#: ../../library/itertools.rst:86 +#: ../../library/itertools.rst:81 msgid "``combinations('ABCD', 2)``" msgstr "``combinations('ABCD', 2)``" -#: ../../library/itertools.rst:86 +#: ../../library/itertools.rst:81 msgid "``AB AC AD BC BD CD``" msgstr "``AB AC AD BC BD CD``" -#: ../../library/itertools.rst:87 +#: ../../library/itertools.rst:82 msgid "``combinations_with_replacement('ABCD', 2)``" msgstr "``combinations_with_replacement('ABCD', 2)``" -#: ../../library/itertools.rst:87 +#: ../../library/itertools.rst:82 msgid "``AA AB AC AD BB BC BD CC CD DD``" msgstr "``AA AB AC AD BB BC BD CC CD DD``" -#: ../../library/itertools.rst:94 +#: ../../library/itertools.rst:89 msgid "Itertool Functions" msgstr "Itertool 函式" -#: ../../library/itertools.rst:96 +#: ../../library/itertools.rst:91 msgid "" "The following functions all construct and return iterators. Some provide " "streams of infinite length, so they should only be accessed by functions or " @@ -440,13 +428,13 @@ msgstr "" "以下的函式都會建構並回傳疊代器。一些函式提供無限長度的串流 (stream),因此應僅" "由截斷串流的函式或迴圈來存取它們。" -#: ../../library/itertools.rst:103 +#: ../../library/itertools.rst:98 msgid "" "Make an iterator that returns accumulated sums or accumulated results from " "other binary functions." msgstr "建立一個回傳累積和的疊代器,或其他二進位函式的累積結果。" -#: ../../library/itertools.rst:106 +#: ../../library/itertools.rst:101 msgid "" "The *function* defaults to addition. The *function* should accept two " "arguments, an accumulated total and a value from the *iterable*." @@ -454,7 +442,7 @@ msgstr "" "*function* 預設為加法。*function* 應接受兩個引數,即累積總和和來自 " "*iterable* 的值。" -#: ../../library/itertools.rst:109 +#: ../../library/itertools.rst:104 msgid "" "If an *initial* value is provided, the accumulation will start with that " "value and the output will have one more element than the input iterable." @@ -462,15 +450,15 @@ msgstr "" "如果提供了 *initial* 值,則累積將從該值開始,並且輸出的元素數將比輸入的可疊代" "物件多一個。" -#: ../../library/itertools.rst:113 ../../library/itertools.rst:186 -#: ../../library/itertools.rst:245 ../../library/itertools.rst:288 -#: ../../library/itertools.rst:489 ../../library/itertools.rst:524 -#: ../../library/itertools.rst:561 ../../library/itertools.rst:637 -#: ../../library/itertools.rst:698 ../../library/itertools.rst:779 +#: ../../library/itertools.rst:108 ../../library/itertools.rst:181 +#: ../../library/itertools.rst:240 ../../library/itertools.rst:283 +#: ../../library/itertools.rst:484 ../../library/itertools.rst:519 +#: ../../library/itertools.rst:556 ../../library/itertools.rst:632 +#: ../../library/itertools.rst:693 ../../library/itertools.rst:774 msgid "Roughly equivalent to::" msgstr "大致等價於: ::" -#: ../../library/itertools.rst:115 +#: ../../library/itertools.rst:110 msgid "" "def accumulate(iterable, function=operator.add, *, initial=None):\n" " 'Return running totals'\n" @@ -492,7 +480,7 @@ msgid "" " yield total" msgstr "" -#: ../../library/itertools.rst:134 +#: ../../library/itertools.rst:129 msgid "" "To compute a running minimum, set *function* to :func:`min`. For a running " "maximum, set *function* to :func:`max`. Or for a running product, set " @@ -505,7 +493,7 @@ msgstr "" "也可以透過累積利息和付款來建立\\ `攤銷表 (Amortization tables) <https://www." "ramseysolutions.com/real-estate/amortization-schedule>`_ :" -#: ../../library/itertools.rst:141 +#: ../../library/itertools.rst:136 msgid "" ">>> data = [3, 4, 6, 2, 1, 9, 0, 7, 5, 8]\n" ">>> list(accumulate(data, max)) # running maximum\n" @@ -519,35 +507,35 @@ msgid "" "[1000, 960, 918, 874, 828, 779, 728, 674, 618, 559, 497]" msgstr "" -#: ../../library/itertools.rst:154 +#: ../../library/itertools.rst:149 msgid "" "See :func:`functools.reduce` for a similar function that returns only the " "final accumulated value." msgstr "" "可參見 :func:`functools.reduce`,其是個類似的函式,但僅回傳最終的累積值。" -#: ../../library/itertools.rst:159 +#: ../../library/itertools.rst:154 msgid "Added the optional *function* parameter." msgstr "新增可選的 *function* 參數。" -#: ../../library/itertools.rst:162 +#: ../../library/itertools.rst:157 msgid "Added the optional *initial* parameter." msgstr "新增可選的 *initial* 參數。" -#: ../../library/itertools.rst:168 +#: ../../library/itertools.rst:163 msgid "" "Batch data from the *iterable* into tuples of length *n*. The last batch may " "be shorter than *n*." msgstr "" "將來自 *iterable* 的資料分批為長度為 *n* 的元組。最後一個批次可能比 *n* 短。" -#: ../../library/itertools.rst:171 +#: ../../library/itertools.rst:166 msgid "" "If *strict* is true, will raise a :exc:`ValueError` if the final batch is " "shorter than *n*." msgstr "" -#: ../../library/itertools.rst:174 +#: ../../library/itertools.rst:169 msgid "" "Loops over the input iterable and accumulates data into tuples up to size " "*n*. The input is consumed lazily, just enough to fill a batch. The result " @@ -558,7 +546,7 @@ msgstr "" "消耗 (consumed lazily) 的,會剛好足夠填充一批的資料。一旦批次填滿或輸入的可疊" "代物件耗盡,就會 yield 出結果:" -#: ../../library/itertools.rst:179 +#: ../../library/itertools.rst:174 msgid "" ">>> flattened_data = ['roses', 'red', 'violets', 'blue', 'sugar', 'sweet']\n" ">>> unflattened = list(batched(flattened_data, 2))\n" @@ -570,7 +558,7 @@ msgstr "" ">>> unflattened\n" "[('roses', 'red'), ('violets', 'blue'), ('sugar', 'sweet')]" -#: ../../library/itertools.rst:188 +#: ../../library/itertools.rst:183 msgid "" "def batched(iterable, n, *, strict=False):\n" " # batched('ABCDEFG', 3) → ABC DEF G\n" @@ -592,11 +580,11 @@ msgstr "" " raise ValueError('batched(): incomplete batch')\n" " yield batch" -#: ../../library/itertools.rst:200 +#: ../../library/itertools.rst:195 msgid "Added the *strict* option." msgstr "新增 *strict* 選項。" -#: ../../library/itertools.rst:206 +#: ../../library/itertools.rst:201 msgid "" "Make an iterator that returns elements from the first iterable until it is " "exhausted, then proceeds to the next iterable, until all of the iterables " @@ -607,7 +595,7 @@ msgstr "" "代物件,直到所有可疊代物件都耗盡。這將多個資料來源結合為單一個疊代器。大致等" "價於: ::" -#: ../../library/itertools.rst:211 +#: ../../library/itertools.rst:206 msgid "" "def chain(*iterables):\n" " # chain('ABC', 'DEF') → A B C D E F\n" @@ -615,7 +603,7 @@ msgid "" " yield from iterable" msgstr "" -#: ../../library/itertools.rst:219 +#: ../../library/itertools.rst:214 msgid "" "Alternate constructor for :func:`chain`. Gets chained inputs from a single " "iterable argument that is evaluated lazily. Roughly equivalent to::" @@ -623,7 +611,7 @@ msgstr "" ":func:`chain` 的另一個建構函式。從單個可疊代的引數中得到鏈接的輸入,該引數是" "惰性計算的。大致等價於:" -#: ../../library/itertools.rst:222 +#: ../../library/itertools.rst:217 msgid "" "def from_iterable(iterables):\n" " # chain.from_iterable(['ABC', 'DEF']) → A B C D E F\n" @@ -635,11 +623,11 @@ msgstr "" " for iterable in iterables:\n" " yield from iterable" -#: ../../library/itertools.rst:230 +#: ../../library/itertools.rst:225 msgid "Return *r* length subsequences of elements from the input *iterable*." msgstr "從輸入 *iterable* 中回傳長度為 *r* 的元素的子序列。" -#: ../../library/itertools.rst:232 +#: ../../library/itertools.rst:227 msgid "" "The output is a subsequence of :func:`product` keeping only entries that are " "subsequences of the *iterable*. The length of the output is given by :func:" @@ -650,7 +638,7 @@ msgstr "" "度由 :func:`math.comb` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / r! / (n - r)!" "``,當 ``r > n`` 時為零。" -#: ../../library/itertools.rst:237 +#: ../../library/itertools.rst:232 msgid "" "The combination tuples are emitted in lexicographic order according to the " "order of the input *iterable*. If the input *iterable* is sorted, the output " @@ -659,7 +647,7 @@ msgstr "" "根據輸入值 *iterable* 的順序,組合的元組會按照字典順序輸出。如果輸入的 " "*iterable* 已經排序,則輸出的元組也將按排序的順序產生。" -#: ../../library/itertools.rst:241 +#: ../../library/itertools.rst:236 msgid "" "Elements are treated as unique based on their position, not on their value. " "If the input elements are unique, there will be no repeated values within " @@ -668,7 +656,7 @@ msgstr "" "元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,則每" "個組合內將不會有重複的值。" -#: ../../library/itertools.rst:247 +#: ../../library/itertools.rst:242 msgid "" "def combinations(iterable, r):\n" " # combinations('ABCD', 2) → AB AC AD BC BD CD\n" @@ -693,14 +681,14 @@ msgid "" " yield tuple(pool[i] for i in indices)" msgstr "" -#: ../../library/itertools.rst:272 +#: ../../library/itertools.rst:267 msgid "" "Return *r* length subsequences of elements from the input *iterable* " "allowing individual elements to be repeated more than once." msgstr "" "回傳來自輸入 *iterable* 的長度為 *r* 的子序列,且允許個別元素重複多次。" -#: ../../library/itertools.rst:275 +#: ../../library/itertools.rst:270 msgid "" "The output is a subsequence of :func:`product` that keeps only entries that " "are subsequences (with possible repeated elements) of the *iterable*. The " @@ -711,7 +699,7 @@ msgstr "" "複元素)的條目。當 ``n > 0`` 時,回傳的子序列數量為 ``(n + r - 1)! / r! / (n " "- 1)!``。" -#: ../../library/itertools.rst:280 +#: ../../library/itertools.rst:275 msgid "" "The combination tuples are emitted in lexicographic order according to the " "order of the input *iterable*. if the input *iterable* is sorted, the output " @@ -720,7 +708,7 @@ msgstr "" "根據輸入值 *iterable* 的順序,組合的元組會按照字典順序輸出。如果輸入的 " "*iterable* 已經排序,則輸出的元組也將按排序的順序產生。" -#: ../../library/itertools.rst:284 +#: ../../library/itertools.rst:279 msgid "" "Elements are treated as unique based on their position, not on their value. " "If the input elements are unique, the generated combinations will also be " @@ -729,7 +717,7 @@ msgstr "" "元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,生成" "的組合也將是獨特的。" -#: ../../library/itertools.rst:290 +#: ../../library/itertools.rst:285 msgid "" "def combinations_with_replacement(iterable, r):\n" " # combinations_with_replacement('ABC', 2) → AA AB AC BB BC CC\n" @@ -751,7 +739,7 @@ msgid "" " yield tuple(pool[i] for i in indices)" msgstr "" -#: ../../library/itertools.rst:314 +#: ../../library/itertools.rst:309 msgid "" "Make an iterator that returns elements from *data* where the corresponding " "element in *selectors* is true. Stops when either the *data* or *selectors* " @@ -760,14 +748,14 @@ msgstr "" "建立一個疊代器,回傳 *data* 中對應 *selectors* 的元素為 true 的元素。當 " "*data* 或 *selectors* 可疊代物件耗盡時停止。大致等價於: ::" -#: ../../library/itertools.rst:319 +#: ../../library/itertools.rst:314 msgid "" "def compress(data, selectors):\n" " # compress('ABCDEF', [1,0,1,0,1,1]) → A C E F\n" " return (datum for datum, selector in zip(data, selectors) if selector)" msgstr "" -#: ../../library/itertools.rst:328 +#: ../../library/itertools.rst:323 msgid "" "Make an iterator that returns evenly spaced values beginning with *start*. " "Can be used with :func:`map` to generate consecutive data points or with :" @@ -776,7 +764,7 @@ msgstr "" "建立一個疊代器,回傳從 *start* 開始的等差的值。可以與 :func:`map` 一起使用來" "產生連續的資料點,或與 :func:`zip` 一起使用來增加序列號。大致等價於: ::" -#: ../../library/itertools.rst:333 +#: ../../library/itertools.rst:328 msgid "" "def count(start=0, step=1):\n" " # count(10) → 10 11 12 13 14 ...\n" @@ -794,7 +782,7 @@ msgstr "" " yield n\n" " n += step" -#: ../../library/itertools.rst:341 +#: ../../library/itertools.rst:336 msgid "" "When counting with floating-point numbers, better accuracy can sometimes be " "achieved by substituting multiplicative code such as: ``(start + step * i " @@ -803,11 +791,11 @@ msgstr "" "當用浮點數計數時,將上述程式碼替換為乘法有時可以獲得更好的精確度,例如:" "``(start + step * i for i in count())``。" -#: ../../library/itertools.rst:345 +#: ../../library/itertools.rst:340 msgid "Added *step* argument and allowed non-integer arguments." msgstr "新增 *step* 引數並允許非整數引數。" -#: ../../library/itertools.rst:351 +#: ../../library/itertools.rst:346 msgid "" "Make an iterator returning elements from the *iterable* and saving a copy of " "each. When the iterable is exhausted, return elements from the saved copy. " @@ -816,7 +804,7 @@ msgstr "" "建立一個疊代器,回傳 *iterable* 中的元素並保存每個元素的副本。當可疊代物件耗" "盡時,從保存的副本中回傳元素。會無限次的重複。大致等價於: ::" -#: ../../library/itertools.rst:355 +#: ../../library/itertools.rst:350 msgid "" "def cycle(iterable):\n" " # cycle('ABCD') → A B C D A B C D A B C D ...\n" @@ -842,13 +830,13 @@ msgstr "" " for element in saved:\n" " yield element" -#: ../../library/itertools.rst:367 +#: ../../library/itertools.rst:362 msgid "" "This itertool may require significant auxiliary storage (depending on the " "length of the iterable)." msgstr "此 itertool 可能需要大量的輔助儲存空間(取決於可疊代物件的長度)。" -#: ../../library/itertools.rst:373 +#: ../../library/itertools.rst:368 msgid "" "Make an iterator that drops elements from the *iterable* while the " "*predicate* is true and afterwards returns every element. Roughly " @@ -857,7 +845,7 @@ msgstr "" "建立一個疊代器,在 *predicate* 為 true 時丟棄 *iterable* 中的元素,之後回傳每" "個元素。大致等價於:" -#: ../../library/itertools.rst:377 +#: ../../library/itertools.rst:372 msgid "" "def dropwhile(predicate, iterable):\n" " # dropwhile(lambda x: x<5, [1,4,6,3,8]) → 6 3 8\n" @@ -883,7 +871,7 @@ msgstr "" " for x in iterator:\n" " yield x" -#: ../../library/itertools.rst:389 +#: ../../library/itertools.rst:384 msgid "" "Note this does not produce *any* output until the predicate first becomes " "false, so this itertool may have a lengthy start-up time." @@ -891,7 +879,7 @@ msgstr "" "注意,在 predicate 首次變為 False 之前,這不會產生\\ *任何*\\ 輸出,所以此 " "itertool 可能會有較長的啟動時間。" -#: ../../library/itertools.rst:395 +#: ../../library/itertools.rst:390 msgid "" "Make an iterator that filters elements from the *iterable* returning only " "those for which the *predicate* returns a false value. If *predicate* is " @@ -900,7 +888,7 @@ msgstr "" "建立一個疊代器,過濾 *iterable* 中的元素,僅回傳 *predicate* 為 False 值的元" "素。如果 *predicate* 是 ``None``,則回傳為 False 的項目。大致等價於: ::" -#: ../../library/itertools.rst:400 +#: ../../library/itertools.rst:395 msgid "" "def filterfalse(predicate, iterable):\n" " # filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8\n" @@ -922,7 +910,7 @@ msgstr "" " if not predicate(x):\n" " yield x" -#: ../../library/itertools.rst:413 +#: ../../library/itertools.rst:408 msgid "" "Make an iterator that returns consecutive keys and groups from the " "*iterable*. The *key* is a function computing a key value for each element. " @@ -935,7 +923,7 @@ msgstr "" "(identity function),並回傳未被更改的元素。一般來說,可疊代物件需要已經用相同" "的鍵函式進行排序。" -#: ../../library/itertools.rst:419 +#: ../../library/itertools.rst:414 msgid "" "The operation of :func:`groupby` is similar to the ``uniq`` filter in Unix. " "It generates a break or new group every time the value of the key function " @@ -948,7 +936,7 @@ msgstr "" "料進行排序)。這種行為不同於 SQL 的 GROUP BY,其無論輸入順序如何都會聚合相同" "的元素。" -#: ../../library/itertools.rst:425 +#: ../../library/itertools.rst:420 msgid "" "The returned group is itself an iterator that shares the underlying iterable " "with :func:`groupby`. Because the source is shared, when the :func:" @@ -959,7 +947,7 @@ msgstr "" "共享的,當 :func:`groupby` 物件前進時,前一個群組將不再可見。因此,如果之後需" "要該資料,應將其儲存為串列: ::" -#: ../../library/itertools.rst:430 +#: ../../library/itertools.rst:425 msgid "" "groups = []\n" "uniquekeys = []\n" @@ -969,11 +957,11 @@ msgid "" " uniquekeys.append(k)" msgstr "" -#: ../../library/itertools.rst:437 +#: ../../library/itertools.rst:432 msgid ":func:`groupby` is roughly equivalent to::" msgstr ":func:`groupby` 大致等價於: ::" -#: ../../library/itertools.rst:439 +#: ../../library/itertools.rst:434 msgid "" "def groupby(iterable, key=None):\n" " # [k for k, g in groupby('AAAABBBCCDAABBB')] → A B C D A B\n" @@ -1039,7 +1027,7 @@ msgstr "" " for _ in curr_group:\n" " pass" -#: ../../library/itertools.rst:475 +#: ../../library/itertools.rst:470 msgid "" "Make an iterator that returns selected elements from the iterable. Works " "like sequence slicing but does not support negative values for *start*, " @@ -1048,7 +1036,7 @@ msgstr "" "建立一個疊代器,回傳從 iterable 中選取的元素。其作用類似於序列切片 (sequence " "slicing),但不支援負數的 *start*、*stop* 或 *step* 的值。" -#: ../../library/itertools.rst:479 +#: ../../library/itertools.rst:474 msgid "" "If *start* is zero or ``None``, iteration starts at zero. Otherwise, " "elements from the iterable are skipped until *start* is reached." @@ -1056,7 +1044,7 @@ msgstr "" "如果 *start* 為零或 ``None``,則從零開始疊代。否則在達到 *start* 之前,會跳" "過 iterable 中的元素。" -#: ../../library/itertools.rst:482 +#: ../../library/itertools.rst:477 msgid "" "If *stop* is ``None``, iteration continues until the input is exhausted, if " "at all. Otherwise, it stops at the specified position." @@ -1064,7 +1052,7 @@ msgstr "" "如果 *stop* 為 ``None``,則疊代將繼續前進直到輸入耗盡。如果指定了 *stop*,則" "在達到指定位置時停止。" -#: ../../library/itertools.rst:485 +#: ../../library/itertools.rst:480 msgid "" "If *step* is ``None``, the step defaults to one. Elements are returned " "consecutively unless *step* is set higher than one which results in items " @@ -1073,7 +1061,7 @@ msgstr "" "如果 *step* 為 ``None``,則步長 (step) 預設為一。元素會連續回傳,除非將 " "*step* 設定為大於一,這會導致一些項目被跳過。" -#: ../../library/itertools.rst:491 +#: ../../library/itertools.rst:486 msgid "" "def islice(iterable, *args):\n" " # islice('ABCDEFG', 2) → A B\n" @@ -1115,17 +1103,17 @@ msgstr "" " yield element\n" " next_i += step" -#: ../../library/itertools.rst:511 +#: ../../library/itertools.rst:506 msgid "" "If the input is an iterator, then fully consuming the *islice* advances the " "input iterator by ``max(start, stop)`` steps regardless of the *step* value." msgstr "" -#: ../../library/itertools.rst:518 +#: ../../library/itertools.rst:513 msgid "Return successive overlapping pairs taken from the input *iterable*." msgstr "回傳從輸入的 *iterable* 中提取的連續重疊對。" -#: ../../library/itertools.rst:520 +#: ../../library/itertools.rst:515 msgid "" "The number of 2-tuples in the output iterator will be one fewer than the " "number of inputs. It will be empty if the input iterable has fewer than two " @@ -1134,7 +1122,7 @@ msgstr "" "輸出疊代器中的 2 元組數量將比輸入少一個。如果輸入的可疊代物件中的值少於兩個," "則輸出將為空值。" -#: ../../library/itertools.rst:526 +#: ../../library/itertools.rst:521 msgid "" "def pairwise(iterable):\n" " # pairwise('ABCDEFG') → AB BC CD DE EF FG\n" @@ -1156,7 +1144,7 @@ msgstr "" " yield a, b\n" " a = b" -#: ../../library/itertools.rst:541 +#: ../../library/itertools.rst:536 msgid "" "Return successive *r* length `permutations of elements <https://www." "britannica.com/science/permutation>`_ from the *iterable*." @@ -1164,7 +1152,7 @@ msgstr "" "回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 <https://www.britannica." "com/science/permutation>`_ 。" -#: ../../library/itertools.rst:544 +#: ../../library/itertools.rst:539 msgid "" "If *r* is not specified or is ``None``, then *r* defaults to the length of " "the *iterable* and all possible full-length permutations are generated." @@ -1172,7 +1160,7 @@ msgstr "" "如果未指定 *r* 或其值為 ``None``,則 *r* 預設為 *iterable* 的長度,並產生所有" "可能的完整長度的排列。" -#: ../../library/itertools.rst:548 +#: ../../library/itertools.rst:543 msgid "" "The output is a subsequence of :func:`product` where entries with repeated " "elements have been filtered out. The length of the output is given by :func:" @@ -1183,7 +1171,7 @@ msgstr "" "func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 ``r " "> n`` 時為零。" -#: ../../library/itertools.rst:553 +#: ../../library/itertools.rst:548 msgid "" "The permutation tuples are emitted in lexicographic order according to the " "order of the input *iterable*. If the input *iterable* is sorted, the " @@ -1192,7 +1180,7 @@ msgstr "" "根據輸入值 *iterable* 的順序,排列的元組會按照字典順序輸出。如果輸入的 " "*iterable* 已排序,則輸出的元組也將按排序的順序產生。" -#: ../../library/itertools.rst:557 +#: ../../library/itertools.rst:552 msgid "" "Elements are treated as unique based on their position, not on their value. " "If the input elements are unique, there will be no repeated values within a " @@ -1201,7 +1189,7 @@ msgstr "" "元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,則排" "列中將不會有重複的值。" -#: ../../library/itertools.rst:563 +#: ../../library/itertools.rst:558 msgid "" "def permutations(iterable, r=None):\n" " # permutations('ABCD', 2) → AB AC AD BA BC BD CA CB CD DA DB DC\n" @@ -1259,13 +1247,13 @@ msgstr "" " else:\n" " return" -#: ../../library/itertools.rst:594 +#: ../../library/itertools.rst:589 msgid "" "`Cartesian product <https://en.wikipedia.org/wiki/Cartesian_product>`_ of " "the input iterables." msgstr "" -#: ../../library/itertools.rst:597 +#: ../../library/itertools.rst:592 msgid "" "Roughly equivalent to nested for-loops in a generator expression. For " "example, ``product(A, B)`` returns the same as ``((x,y) for x in A for y in " @@ -1274,7 +1262,7 @@ msgstr "" "大致等價於產生器運算式中的巢狀 for 迴圈。例如,``product(A, B)`` 的回傳結果" "與 ``((x,y) for x in A for y in B)`` 相同。" -#: ../../library/itertools.rst:600 +#: ../../library/itertools.rst:595 msgid "" "The nested loops cycle like an odometer with the rightmost element advancing " "on every iteration. This pattern creates a lexicographic ordering so that " @@ -1284,7 +1272,7 @@ msgstr "" "巢狀迴圈的循環類似於里程表,最右邊的元素在每次疊代時前進。這種模式會建立字典" "順序,因此如果輸入的 iterables 已排序,則輸出的乘積元組也將按排序的順序產生。" -#: ../../library/itertools.rst:605 +#: ../../library/itertools.rst:600 msgid "" "To compute the product of an iterable with itself, specify the number of " "repetitions with the optional *repeat* keyword argument. For example, " @@ -1293,7 +1281,7 @@ msgstr "" "要計算可疊代物件自身的乘積,可以使用可選的 *repeat* 關鍵字引數來指定重複次" "數。例如,``product(A, repeat=4)`` 與 ``product(A, A, A, A)`` 相同。" -#: ../../library/itertools.rst:609 +#: ../../library/itertools.rst:604 msgid "" "This function is roughly equivalent to the following code, except that the " "actual implementation does not build up intermediate results in memory::" @@ -1301,7 +1289,7 @@ msgstr "" "此函式大致等價於以下的程式碼,不同之處在於真正的實作不會在記憶體中建立中間結" "果: ::" -#: ../../library/itertools.rst:612 +#: ../../library/itertools.rst:607 msgid "" "def product(*iterables, repeat=1):\n" " # product('ABCD', 'xy') → Ax Ay Bx By Cx Cy Dx Dy\n" @@ -1333,7 +1321,7 @@ msgstr "" " for prod in result:\n" " yield tuple(prod)" -#: ../../library/itertools.rst:627 +#: ../../library/itertools.rst:622 msgid "" "Before :func:`product` runs, it completely consumes the input iterables, " "keeping pools of values in memory to generate the products. Accordingly, it " @@ -1342,7 +1330,7 @@ msgstr "" "在 :func:`product` 執行之前,它會完全消耗輸入的 iterables,並將值的池 (pools " "of values) 保存在記憶體中以產生乘積。因此,它僅對有限的輸入有用。" -#: ../../library/itertools.rst:634 +#: ../../library/itertools.rst:629 msgid "" "Make an iterator that returns *object* over and over again. Runs " "indefinitely unless the *times* argument is specified." @@ -1350,7 +1338,7 @@ msgstr "" "建立一個疊代器,反覆回傳 *object*。除非指定了 *times* 引數,否則會執行無限" "次。" -#: ../../library/itertools.rst:639 +#: ../../library/itertools.rst:634 msgid "" "def repeat(object, times=None):\n" " # repeat(10, 3) → 10 10 10\n" @@ -1370,13 +1358,13 @@ msgstr "" " for i in range(times):\n" " yield object" -#: ../../library/itertools.rst:648 +#: ../../library/itertools.rst:643 msgid "" "A common use for *repeat* is to supply a stream of constant values to *map* " "or *zip*:" msgstr "*repeat* 的常見用途是為 *map* 或 *zip* 提供定值的串流:" -#: ../../library/itertools.rst:651 +#: ../../library/itertools.rst:646 msgid "" ">>> list(map(pow, range(10), repeat(2)))\n" "[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]" @@ -1384,7 +1372,7 @@ msgstr "" ">>> list(map(pow, range(10), repeat(2)))\n" "[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]" -#: ../../library/itertools.rst:659 +#: ../../library/itertools.rst:654 msgid "" "Make an iterator that computes the *function* using arguments obtained from " "the *iterable*. Used instead of :func:`map` when argument parameters have " @@ -1393,7 +1381,7 @@ msgstr "" "建立一個疊代器,使用從 *iterable* 獲取的引數計算 *function* 。當引數參數已經" "被「預先壓縮 (pre-zipped)」成元組時,使用此方法代替 :func:`map`。" -#: ../../library/itertools.rst:663 +#: ../../library/itertools.rst:658 msgid "" "The difference between :func:`map` and :func:`starmap` parallels the " "distinction between ``function(a,b)`` and ``function(*c)``. Roughly " @@ -1402,7 +1390,7 @@ msgstr "" ":func:`map` 和 :func:`starmap` 之間的區別類似於 ``function(a,b)`` 和 " "``function(*c)`` 之間的區別。大致等價於:" -#: ../../library/itertools.rst:667 +#: ../../library/itertools.rst:662 msgid "" "def starmap(function, iterable):\n" " # starmap(pow, [(2,5), (3,2), (10,3)]) → 32 9 1000\n" @@ -1414,7 +1402,7 @@ msgstr "" " for args in iterable:\n" " yield function(*args)" -#: ../../library/itertools.rst:675 +#: ../../library/itertools.rst:670 msgid "" "Make an iterator that returns elements from the *iterable* as long as the " "*predicate* is true. Roughly equivalent to::" @@ -1422,7 +1410,7 @@ msgstr "" "建立一個疊代器,只在 *predicate* 為 true 時回傳 *iterable* 中的元素。大致等價" "於:" -#: ../../library/itertools.rst:678 +#: ../../library/itertools.rst:673 msgid "" "def takewhile(predicate, iterable):\n" " # takewhile(lambda x: x<5, [1,4,6,3,8]) → 1 4\n" @@ -1438,13 +1426,13 @@ msgstr "" " break\n" " yield x" -#: ../../library/itertools.rst:685 +#: ../../library/itertools.rst:680 msgid "" "Note, the element that first fails the predicate condition is consumed from " "the input iterator and there is no way to access it. This could be an issue " "if an application wants to further consume the input iterator after " "*takewhile* has been run to exhaustion. To work around this problem, " -"consider using `more-iterools before_and_after() <https://more-itertools." +"consider using `more-itertools before_and_after() <https://more-itertools." "readthedocs.io/en/stable/api.html#more_itertools.before_and_after>`_ instead." msgstr "" "注意,第一個不符合條件判斷的元素將從輸入疊代器中被消耗,且無法再存取它。如果" @@ -1453,11 +1441,11 @@ msgstr "" "more-itertools.readthedocs.io/en/stable/api.html#more_itertools." "before_and_after>`_ 作為替代。" -#: ../../library/itertools.rst:696 +#: ../../library/itertools.rst:691 msgid "Return *n* independent iterators from a single iterable." msgstr "從一個 iterable 中回傳 *n* 個獨立的疊代器。" -#: ../../library/itertools.rst:700 +#: ../../library/itertools.rst:695 msgid "" "def tee(iterable, n=2):\n" " if n < 0:\n" @@ -1493,7 +1481,7 @@ msgid "" " return value" msgstr "" -#: ../../library/itertools.rst:733 +#: ../../library/itertools.rst:728 msgid "" "When the input *iterable* is already a tee iterator object, all members of " "the return tuple are constructed as if they had been produced by the " @@ -1502,11 +1490,11 @@ msgid "" "update step rather than a chain of calls." msgstr "" -#: ../../library/itertools.rst:739 +#: ../../library/itertools.rst:734 msgid "The flattening property makes tee iterators efficiently peekable:" msgstr "" -#: ../../library/itertools.rst:741 +#: ../../library/itertools.rst:736 msgid "" "def lookahead(tee_iterator):\n" " \"Return the next value without moving the input forward\"\n" @@ -1514,7 +1502,7 @@ msgid "" " return next(forked_iterator)" msgstr "" -#: ../../library/itertools.rst:748 +#: ../../library/itertools.rst:743 msgid "" ">>> iterator = iter('abcdef')\n" ">>> [iterator] = tee(iterator, 1) # Make the input peekable\n" @@ -1526,7 +1514,7 @@ msgid "" "'b'" msgstr "" -#: ../../library/itertools.rst:759 +#: ../../library/itertools.rst:754 msgid "" "``tee`` iterators are not threadsafe. A :exc:`RuntimeError` may be raised " "when simultaneously using iterators returned by the same :func:`tee` call, " @@ -1536,7 +1524,7 @@ msgstr "" "呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引發 :exc:" "`RuntimeError`。" -#: ../../library/itertools.rst:763 +#: ../../library/itertools.rst:758 msgid "" "This itertool may require significant auxiliary storage (depending on how " "much temporary data needs to be stored). In general, if one iterator uses " @@ -1547,11 +1535,11 @@ msgstr "" "果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使用 :func:" "`list` 會比 :func:`tee` 更快。" -#: ../../library/itertools.rst:771 +#: ../../library/itertools.rst:766 msgid "Make an iterator that aggregates elements from each of the *iterables*." msgstr "建立一個疊代器,聚合來自每個 *iterables* 中的元素。" -#: ../../library/itertools.rst:774 +#: ../../library/itertools.rst:769 msgid "" "If the iterables are of uneven length, missing values are filled-in with " "*fillvalue*. If not specified, *fillvalue* defaults to ``None``." @@ -1559,11 +1547,11 @@ msgstr "" "如果 iterables 的長度不一,則使用 *fillvalue* 填充缺少的值。如果未指定," "*fillvalue* 會預設為 ``None``。" -#: ../../library/itertools.rst:777 +#: ../../library/itertools.rst:772 msgid "Iteration continues until the longest iterable is exhausted." msgstr "疊代將持續直到最長的可疊代物件耗盡為止。" -#: ../../library/itertools.rst:781 +#: ../../library/itertools.rst:776 msgid "" "def zip_longest(*iterables, fillvalue=None):\n" " # zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-\n" @@ -1609,7 +1597,7 @@ msgstr "" " values.append(value)\n" " yield tuple(values)" -#: ../../library/itertools.rst:803 +#: ../../library/itertools.rst:798 msgid "" "If one of the iterables is potentially infinite, then the :func:" "`zip_longest` function should be wrapped with something that limits the " @@ -1618,18 +1606,18 @@ msgstr "" "如果其中一個 iterables 可能是無限的,那麼應該用別的可以限制呼叫次數的方法來包" "裝 :func:`zip_longest` 函式(例如 :func:`islice` 或 :func:`takewhile`)。" -#: ../../library/itertools.rst:811 +#: ../../library/itertools.rst:806 msgid "Itertools Recipes" msgstr "Itertools 應用技巧" -#: ../../library/itertools.rst:813 +#: ../../library/itertools.rst:808 msgid "" "This section shows recipes for creating an extended toolset using the " "existing itertools as building blocks." msgstr "" "此段落展示了使用現有的 itertools 作為構建塊來建立擴展工具集的應用技巧。" -#: ../../library/itertools.rst:816 +#: ../../library/itertools.rst:811 msgid "" "The primary purpose of the itertools recipes is educational. The recipes " "show various ways of thinking about individual tools — for example, that " @@ -1647,7 +1635,7 @@ msgstr "" "`collections` 模組一同使用以及與內建 itertools(如 ``map()``、``filter()``、" "``reversed()`` 和 ``enumerate()``)一同使用的模式。" -#: ../../library/itertools.rst:825 +#: ../../library/itertools.rst:820 msgid "" "A secondary purpose of the recipes is to serve as an incubator. The " "``accumulate()``, ``compress()``, and ``pairwise()`` itertools started out " @@ -1659,7 +1647,7 @@ msgstr "" "``sliding_window()``、``iter_index()`` 和 ``sieve()`` 的應用技巧正在被測試," "以確定它們是否有價值被收錄到內建的 itertools 中。" -#: ../../library/itertools.rst:830 +#: ../../library/itertools.rst:825 msgid "" "Substantially all of these recipes and many, many others can be installed " "from the :pypi:`more-itertools` project found on the Python Package Index::" @@ -1667,11 +1655,11 @@ msgstr "" "幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上的 :" "pypi:`more-itertools` 專案中安裝: ::" -#: ../../library/itertools.rst:834 +#: ../../library/itertools.rst:829 msgid "python -m pip install more-itertools" msgstr "python -m pip install more-itertools" -#: ../../library/itertools.rst:836 +#: ../../library/itertools.rst:831 msgid "" "Many of the recipes offer the same high performance as the underlying " "toolset. Superior memory performance is kept by processing elements one at a " @@ -1689,14 +1677,13 @@ msgstr "" "用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和\\ :" "term:`產生器 <generator>`,則能保持高速度。" -#: ../../library/itertools.rst:844 +#: ../../library/itertools.rst:839 msgid "" -"import collections\n" -"import contextlib\n" -"import functools\n" -"import math\n" -"import operator\n" -"import random\n" +"from collections import deque\n" +"from contextlib import suppress\n" +"from functools import reduce\n" +"from math import sumprod, isqrt\n" +"from operator import itemgetter, getitem, mul, neg\n" "\n" "def take(n, iterable):\n" " \"Return first n items of the iterable as a list.\"\n" @@ -1711,11 +1698,11 @@ msgid "" " \"Return function(0), function(1), ...\"\n" " return map(function, count(start))\n" "\n" -"def repeatfunc(func, times=None, *args):\n" -" \"Repeat calls to func with specified arguments.\"\n" +"def repeatfunc(function, times=None, *args):\n" +" \"Repeat calls to a function with specified arguments.\"\n" " if times is None:\n" -" return starmap(func, repeat(args))\n" -" return starmap(func, repeat(args, times))\n" +" return starmap(function, repeat(args))\n" +" return starmap(function, repeat(args, times))\n" "\n" "def flatten(list_of_lists):\n" " \"Flatten one level of nesting.\"\n" @@ -1733,13 +1720,13 @@ msgid "" "def tail(n, iterable):\n" " \"Return an iterator over the last n items.\"\n" " # tail(3, 'ABCDEFG') → E F G\n" -" return iter(collections.deque(iterable, maxlen=n))\n" +" return iter(deque(iterable, maxlen=n))\n" "\n" "def consume(iterator, n=None):\n" " \"Advance the iterator n-steps ahead. If n is None, consume entirely.\"\n" " # Use functions that consume iterators at C speed.\n" " if n is None:\n" -" collections.deque(iterator, maxlen=0)\n" +" deque(iterator, maxlen=0)\n" " else:\n" " next(islice(iterator, n, n), None)\n" "\n" @@ -1770,8 +1757,8 @@ msgid "" " # unique_justseen('AAAABBBCCDAABBB') → A B C D A B\n" " # unique_justseen('ABBcCAD', str.casefold) → A B c A D\n" " if key is None:\n" -" return map(operator.itemgetter(0), groupby(iterable))\n" -" return map(next, map(operator.itemgetter(1), groupby(iterable, key)))\n" +" return map(itemgetter(0), groupby(iterable))\n" +" return map(next, map(itemgetter(1), groupby(iterable, key)))\n" "\n" "def unique_everseen(iterable, key=None):\n" " \"Yield unique elements, preserving order. Remember all elements ever " @@ -1793,14 +1780,14 @@ msgid "" "def unique(iterable, key=None, reverse=False):\n" " \"Yield unique elements in sorted order. Supports unhashable inputs.\"\n" " # unique([[1, 2], [3, 4], [1, 2]]) → [1, 2] [3, 4]\n" -" return unique_justseen(sorted(iterable, key=key, reverse=reverse), " -"key=key)\n" +" sequenced = sorted(iterable, key=key, reverse=reverse)\n" +" return unique_justseen(sequenced, key=key)\n" "\n" "def sliding_window(iterable, n):\n" " \"Collect data into overlapping fixed-length chunks or blocks.\"\n" " # sliding_window('ABCDEFG', 4) → ABCD BCDE CDEF DEFG\n" " iterator = iter(iterable)\n" -" window = collections.deque(islice(iterator, n - 1), maxlen=n)\n" +" window = deque(islice(iterator, n - 1), maxlen=n)\n" " for x in iterator:\n" " window.append(x)\n" " yield tuple(window)\n" @@ -1834,7 +1821,7 @@ msgid "" " \"Return all contiguous non-empty subslices of a sequence.\"\n" " # subslices('ABCD') → A AB ABC ABCD B BC BCD C CD D\n" " slices = starmap(slice, combinations(range(len(seq) + 1), 2))\n" -" return map(operator.getitem, repeat(seq), slices)\n" +" return map(getitem, repeat(seq), slices)\n" "\n" "def iter_index(iterable, value, start=0, stop=None):\n" " \"Return indices where a value occurs in a sequence or iterable.\"\n" @@ -1848,41 +1835,42 @@ msgid "" " else:\n" " stop = len(iterable) if stop is None else stop\n" " i = start\n" -" with contextlib.suppress(ValueError):\n" +" with suppress(ValueError):\n" " while True:\n" " yield (i := seq_index(value, i, stop))\n" " i += 1\n" "\n" -"def iter_except(func, exception, first=None):\n" +"def iter_except(function, exception, first=None):\n" " \"Convert a call-until-exception interface to an iterator interface.\"\n" " # iter_except(d.popitem, KeyError) → non-blocking dictionary iterator\n" -" with contextlib.suppress(exception):\n" +" with suppress(exception):\n" " if first is not None:\n" " yield first()\n" " while True:\n" -" yield func()" +" yield function()" msgstr "" -#: ../../library/itertools.rst:1013 +#: ../../library/itertools.rst:1008 msgid "The following recipes have a more mathematical flavor:" msgstr "以下的應用技巧具有更多的數學風格:" -#: ../../library/itertools.rst:1015 +#: ../../library/itertools.rst:1010 msgid "" "def powerset(iterable):\n" -" \"powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)\"\n" +" \"Subsequences of the iterable from shortest to longest.\"\n" +" # powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)\n" " s = list(iterable)\n" " return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))\n" "\n" "def sum_of_squares(iterable):\n" " \"Add up the squares of the input values.\"\n" " # sum_of_squares([10, 20, 30]) → 1400\n" -" return math.sumprod(*tee(iterable))\n" +" return sumprod(*tee(iterable))\n" "\n" -"def reshape(matrix, cols):\n" +"def reshape(matrix, columns):\n" " \"Reshape a 2-D matrix to have a given number of columns.\"\n" " # reshape([(0, 1), (2, 3), (4, 5)], 3) → (0, 1, 2), (3, 4, 5)\n" -" return batched(chain.from_iterable(matrix), cols, strict=True)\n" +" return batched(chain.from_iterable(matrix), columns, strict=True)\n" "\n" "def transpose(matrix):\n" " \"Swap the rows and columns of a 2-D matrix.\"\n" @@ -1893,7 +1881,7 @@ msgid "" " \"Multiply two matrices.\"\n" " # matmul([(7, 5), (3, 5)], [(2, 5), (7, 9)]) → (49, 80), (41, 60)\n" " n = len(m2[0])\n" -" return batched(starmap(math.sumprod, product(m1, transpose(m2))), n)\n" +" return batched(starmap(sumprod, product(m1, transpose(m2))), n)\n" "\n" "def convolve(signal, kernel):\n" " \"\"\"Discrete linear convolution of two iterables.\n" @@ -1914,7 +1902,7 @@ msgid "" " n = len(kernel)\n" " padded_signal = chain(repeat(0, n-1), signal, repeat(0, n-1))\n" " windowed_signal = sliding_window(padded_signal, n)\n" -" return map(math.sumprod, repeat(kernel), windowed_signal)\n" +" return map(sumprod, repeat(kernel), windowed_signal)\n" "\n" "def polynomial_from_roots(roots):\n" " \"\"\"Compute a polynomial's coefficients from its roots.\n" @@ -1922,8 +1910,8 @@ msgid "" " (x - 5) (x + 4) (x - 3) expands to: x³ -4x² -17x + 60\n" " \"\"\"\n" " # polynomial_from_roots([5, -4, 3]) → [1, -4, -17, 60]\n" -" factors = zip(repeat(1), map(operator.neg, roots))\n" -" return list(functools.reduce(convolve, factors, [1]))\n" +" factors = zip(repeat(1), map(neg, roots))\n" +" return list(reduce(convolve, factors, [1]))\n" "\n" "def polynomial_eval(coefficients, x):\n" " \"\"\"Evaluate a polynomial at a specific value.\n" @@ -1936,7 +1924,7 @@ msgid "" " if not n:\n" " return type(x)(0)\n" " powers = map(pow, repeat(x), reversed(range(n)))\n" -" return math.sumprod(coefficients, powers)\n" +" return sumprod(coefficients, powers)\n" "\n" "def polynomial_derivative(coefficients):\n" " \"\"\"Compute the first derivative of a polynomial.\n" @@ -1947,7 +1935,7 @@ msgid "" " # polynomial_derivative([1, -4, -17, 60]) → [3, -8, -17]\n" " n = len(coefficients)\n" " powers = reversed(range(1, n))\n" -" return list(map(operator.mul, coefficients, powers))\n" +" return list(map(mul, coefficients, powers))\n" "\n" "def sieve(n):\n" " \"Primes less than n.\"\n" @@ -1955,21 +1943,16 @@ msgid "" " if n > 2:\n" " yield 2\n" " data = bytearray((0, 1)) * (n // 2)\n" -" for p in iter_index(data, 1, start=3, stop=math.isqrt(n) + 1):\n" +" for p in iter_index(data, 1, start=3, stop=isqrt(n) + 1):\n" " data[p*p : n : p+p] = bytes(len(range(p*p, n, p+p)))\n" " yield from iter_index(data, 1, start=3)\n" "\n" -"def is_prime(n):\n" -" \"Return True if n is prime.\"\n" -" # is_prime(1_000_000_000_000_403) → True\n" -" return n > 1 and all(n % p for p in sieve(math.isqrt(n) + 1))\n" -"\n" "def factor(n):\n" " \"Prime factors of n.\"\n" " # factor(99) → 3 3 11\n" " # factor(1_000_000_000_000_007) → 47 59 360620266859\n" " # factor(1_000_000_000_000_403) → 1000000000000403\n" -" for prime in sieve(math.isqrt(n) + 1):\n" +" for prime in sieve(isqrt(n) + 1):\n" " while not n % prime:\n" " yield prime\n" " n //= prime\n" @@ -1978,6 +1961,11 @@ msgid "" " if n > 1:\n" " yield n\n" "\n" +"def is_prime(n):\n" +" \"Return True if n is prime.\"\n" +" # is_prime(1_000_000_000_000_403) → True\n" +" return n > 1 and next(factor(n)) == n\n" +"\n" "def totient(n):\n" " \"Count of natural numbers up to n that are coprime to n.\"\n" " # https://mathworld.wolfram.com/TotientFunction.html\n" @@ -1986,3 +1974,14 @@ msgid "" " n -= n // prime\n" " return n" msgstr "" + +#~ msgid "" +#~ "These tools and their built-in counterparts also work well with the high-" +#~ "speed functions in the :mod:`operator` module. For example, the " +#~ "multiplication operator can be mapped across two vectors to form an " +#~ "efficient dot-product: ``sum(starmap(operator.mul, zip(vec1, vec2, " +#~ "strict=True)))``." +#~ msgstr "" +#~ "這些工具及其內建的對等部分 (counterpart) 也可以很好地與 :mod:`operator` 模" +#~ "組中的高速函式配合使用。例如,乘法運算子可以對映到兩個向量上以組成高效率的" +#~ "內積:``sum(starmap(operator.mul, zip(vec1, vec2, strict=True)))``。" diff --git a/library/json.po b/library/json.po index a910b316ff..76e792b8cb 100644 --- a/library/json.po +++ b/library/json.po @@ -1153,7 +1153,7 @@ msgid "" "The :mod:`json.tool` module provides a simple command line interface to " "validate and pretty-print JSON objects." msgstr "" -":mod:`json.tool` 模組提供了一個簡易的命令列界面以供校驗與美化呈現 JSON 物件。" +":mod:`json.tool` 模組提供了一個簡易的命令列介面以供校驗與美化呈現 JSON 物件。" #: ../../library/json.rst:694 msgid "" diff --git a/library/optparse.po b/library/optparse.po index 7f39b49f93..b23b142f75 100644 --- a/library/optparse.po +++ b/library/optparse.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,20 +21,222 @@ msgstr "" msgid ":mod:`!optparse` --- Parser for command line options" msgstr ":mod:`!optparse` --- 命令列選項剖析器" -#: ../../library/optparse.rst:11 +#: ../../library/optparse.rst:10 msgid "**Source code:** :source:`Lib/optparse.py`" msgstr "**原始碼:**\\ :source:`Lib/optparse.py`" -#: ../../library/optparse.rst:13 +#: ../../library/optparse.rst:17 +msgid "Choosing an argument parsing library" +msgstr "選擇一個命令列參數剖析函式庫" + +#: ../../library/optparse.rst:19 +msgid "The standard library includes three argument parsing libraries:" +msgstr "標準函式庫包含三個命令列引數剖析函式庫:" + +#: ../../library/optparse.rst:21 +msgid "" +":mod:`getopt`: a module that closely mirrors the procedural C ``getopt`` " +"API. Included in the standard library since before the initial Python 1.0 " +"release." +msgstr "" + +#: ../../library/optparse.rst:23 +msgid "" +":mod:`optparse`: a declarative replacement for ``getopt`` that provides " +"equivalent functionality without requiring each application to implement its " +"own procedural option parsing logic. Included in the standard library since " +"the Python 2.3 release." +msgstr "" + +#: ../../library/optparse.rst:27 +msgid "" +":mod:`argparse`: a more opinionated alternative to ``optparse`` that " +"provides more functionality by default, at the expense of reduced " +"application flexibility in controlling exactly how arguments are processed. " +"Included in the standard library since the Python 2.7 and Python 3.2 " +"releases." +msgstr "" + +#: ../../library/optparse.rst:32 +msgid "" +"In the absence of more specific argument parsing design constraints, :mod:" +"`argparse` is the recommended choice for implementing command line " +"applications, as it offers the highest level of baseline functionality with " +"the least application level code." +msgstr "" + +#: ../../library/optparse.rst:36 +msgid "" +":mod:`getopt` is retained almost entirely for backwards compatibility " +"reasons. However, it also serves a niche use case as a tool for prototyping " +"and testing command line argument handling in ``getopt``-based C " +"applications." +msgstr "" + +#: ../../library/optparse.rst:40 +msgid "" +":mod:`optparse` should be considered as an alternative to :mod:`argparse` in " +"the following cases:" +msgstr "" + +#: ../../library/optparse.rst:43 +msgid "" +"an application is already using :mod:`optparse` and doesn't want to risk the " +"subtle behavioural changes that may arise when migrating to :mod:`argparse`" +msgstr "" + +#: ../../library/optparse.rst:45 +msgid "" +"the application requires additional control over the way options and " +"positional parameters are interleaved on the command line (including the " +"ability to disable the interleaving feature completely)" +msgstr "" + +#: ../../library/optparse.rst:48 +msgid "" +"the application requires additional control over the incremental parsing of " +"command line elements (while ``argparse`` does support this, the exact way " +"it works in practice is undesirable for some use cases)" +msgstr "" + +#: ../../library/optparse.rst:51 +msgid "" +"the application requires additional control over the handling of options " +"which accept parameter values that may start with ``-`` (such as delegated " +"options to be passed to invoked subprocesses)" +msgstr "" + +#: ../../library/optparse.rst:54 +msgid "" +"the application requires some other command line parameter processing " +"behavior which ``argparse`` does not support, but which can be implemented " +"in terms of the lower level interface offered by ``optparse``" +msgstr "" + +#: ../../library/optparse.rst:58 +msgid "" +"These considerations also mean that :mod:`optparse` is likely to provide a " +"better foundation for library authors writing third party command line " +"argument processing libraries." +msgstr "" + +#: ../../library/optparse.rst:62 +msgid "" +"As a concrete example, consider the following two command line argument " +"parsing configurations, the first using ``optparse``, and the second using " +"``argparse``:" +msgstr "" + +#: ../../library/optparse.rst:66 +msgid "" +"import optparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = optparse.OptionParser()\n" +" parser.add_option('-o', '--output')\n" +" parser.add_option('-v', dest='verbose', action='http://github.com/store_true')\n" +" opts, args = parser.parse_args()\n" +" process(args, output=opts.output, verbose=opts.verbose)" +msgstr "" +"import optparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = optparse.OptionParser()\n" +" parser.add_option('-o', '--output')\n" +" parser.add_option('-v', dest='verbose', action='http://github.com/store_true')\n" +" opts, args = parser.parse_args()\n" +" process(args, output=opts.output, verbose=opts.verbose)" + +#: ../../library/optparse.rst:77 +msgid "" +"import argparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = argparse.ArgumentParser()\n" +" parser.add_argument('-o', '--output')\n" +" parser.add_argument('-v', dest='verbose', action='http://github.com/store_true')\n" +" parser.add_argument('rest', nargs='*')\n" +" args = parser.parse_args()\n" +" process(args.rest, output=args.output, verbose=args.verbose)" +msgstr "" +"import argparse\n" +"\n" +"if __name__ == '__main__':\n" +" parser = argparse.ArgumentParser()\n" +" parser.add_argument('-o', '--output')\n" +" parser.add_argument('-v', dest='verbose', action='http://github.com/store_true')\n" +" parser.add_argument('rest', nargs='*')\n" +" args = parser.parse_args()\n" +" process(args.rest, output=args.output, verbose=args.verbose)" + +#: ../../library/optparse.rst:89 +msgid "" +"The most obvious difference is that in the ``optparse`` version, the non-" +"option arguments are processed separately by the application after the " +"option processing is complete. In the ``argparse`` version, positional " +"arguments are declared and processed in the same way as the named options." +msgstr "" + +#: ../../library/optparse.rst:94 +msgid "" +"However, the ``argparse`` version will also handle some parameter " +"combination differently from the way the ``optparse`` version would handle " +"them. For example (amongst other differences):" +msgstr "" + +#: ../../library/optparse.rst:98 +msgid "" +"supplying ``-o -v`` gives ``output=\"-v\"`` and ``verbose=False`` when using " +"``optparse``, but a usage error with ``argparse`` (complaining that no value " +"has been supplied for ``-o/--output``, since ``-v`` is interpreted as " +"meaning the verbosity flag)" +msgstr "" + +#: ../../library/optparse.rst:102 +msgid "" +"similarly, supplying ``-o --`` gives ``output=\"--\"`` and ``args=()`` when " +"using ``optparse``, but a usage error with ``argparse`` (also complaining " +"that no value has been supplied for ``-o/--output``, since ``--`` is " +"interpreted as terminating the option processing and treating all remaining " +"values as positional arguments)" +msgstr "" + +#: ../../library/optparse.rst:107 msgid "" -"The :mod:`optparse` module is :term:`soft deprecated` and will not be " -"developed further; development will continue with the :mod:`argparse` module." +"supplying ``-o=foo`` gives ``output=\"=foo\"`` when using ``optparse``, but " +"gives ``output=\"foo\"`` with ``argparse`` (since ``=`` is special cased as " +"an alternative separator for option parameter values)" msgstr "" -#: ../../library/optparse.rst:20 +#: ../../library/optparse.rst:111 +msgid "" +"Whether these differing behaviors in the ``argparse`` version are considered " +"desirable or a problem will depend on the specific command line application " +"use case." +msgstr "" + +#: ../../library/optparse.rst:117 +msgid "" +":pypi:`click` is a third party argument processing library (originally based " +"on ``optparse``), which allows command line applications to be developed as " +"a set of decorated command implementation functions." +msgstr "" + +#: ../../library/optparse.rst:121 +msgid "" +"Other third party libraries, such as :pypi:`typer` or :pypi:`msgspec-click`, " +"allow command line interfaces to be specified in ways that more effectively " +"integrate with static checking of Python type annotations." +msgstr "" + +#: ../../library/optparse.rst:127 +msgid "Introduction" +msgstr "" + +#: ../../library/optparse.rst:129 msgid "" ":mod:`optparse` is a more convenient, flexible, and powerful library for " -"parsing command-line options than the old :mod:`getopt` module. :mod:" +"parsing command-line options than the minimalist :mod:`getopt` module. :mod:" "`optparse` uses a more declarative style of command-line parsing: you create " "an instance of :class:`OptionParser`, populate it with options, and parse " "the command line. :mod:`optparse` allows users to specify options in the " @@ -43,11 +244,11 @@ msgid "" "messages for you." msgstr "" -#: ../../library/optparse.rst:27 +#: ../../library/optparse.rst:137 msgid "Here's an example of using :mod:`optparse` in a simple script::" msgstr "" -#: ../../library/optparse.rst:29 +#: ../../library/optparse.rst:139 msgid "" "from optparse import OptionParser\n" "...\n" @@ -60,18 +261,28 @@ msgid "" "\n" "(options, args) = parser.parse_args()" msgstr "" +"from optparse import OptionParser\n" +"...\n" +"parser = OptionParser()\n" +"parser.add_option(\"-f\", \"--file\", dest=\"filename\",\n" +" help=\"write report to FILE\", metavar=\"FILE\")\n" +"parser.add_option(\"-q\", \"--quiet\",\n" +" action=\"store_false\", dest=\"verbose\", default=True,\n" +" help=\"don't print status messages to stdout\")\n" +"\n" +"(options, args) = parser.parse_args()" -#: ../../library/optparse.rst:40 +#: ../../library/optparse.rst:150 msgid "" "With these few lines of code, users of your script can now do the \"usual " "thing\" on the command-line, for example::" msgstr "" -#: ../../library/optparse.rst:43 +#: ../../library/optparse.rst:153 msgid "<yourscript> --file=outfile -q" -msgstr "" +msgstr "<yourscript> --file=outfile -q" -#: ../../library/optparse.rst:45 +#: ../../library/optparse.rst:155 msgid "" "As it parses the command line, :mod:`optparse` sets attributes of the " "``options`` object returned by :meth:`~OptionParser.parse_args` based on " @@ -84,7 +295,7 @@ msgid "" "the above example::" msgstr "" -#: ../../library/optparse.rst:54 +#: ../../library/optparse.rst:164 msgid "" "<yourscript> -f outfile --quiet\n" "<yourscript> --quiet --file outfile\n" @@ -92,22 +303,24 @@ msgid "" "<yourscript> -qfoutfile" msgstr "" -#: ../../library/optparse.rst:59 +#: ../../library/optparse.rst:169 msgid "Additionally, users can run one of the following ::" msgstr "" -#: ../../library/optparse.rst:61 +#: ../../library/optparse.rst:171 msgid "" "<yourscript> -h\n" "<yourscript> --help" msgstr "" +"<yourscript> -h\n" +"<yourscript> --help" -#: ../../library/optparse.rst:64 +#: ../../library/optparse.rst:174 msgid "" "and :mod:`optparse` will print out a brief summary of your script's options:" msgstr "" -#: ../../library/optparse.rst:66 +#: ../../library/optparse.rst:176 msgid "" "Usage: <yourscript> [options]\n" "\n" @@ -116,35 +329,43 @@ msgid "" " -f FILE, --file=FILE write report to FILE\n" " -q, --quiet don't print status messages to stdout" msgstr "" +"Usage: <yourscript> [options]\n" +"\n" +"Options:\n" +" -h, --help show this help message and exit\n" +" -f FILE, --file=FILE write report to FILE\n" +" -q, --quiet don't print status messages to stdout" -#: ../../library/optparse.rst:75 +#: ../../library/optparse.rst:185 msgid "" "where the value of *yourscript* is determined at runtime (normally from " "``sys.argv[0]``)." msgstr "" -#: ../../library/optparse.rst:82 +#: ../../library/optparse.rst:192 msgid "Background" msgstr "背景" -#: ../../library/optparse.rst:84 +#: ../../library/optparse.rst:194 msgid "" ":mod:`optparse` was explicitly designed to encourage the creation of " -"programs with straightforward, conventional command-line interfaces. To " -"that end, it supports only the most common command-line syntax and semantics " -"conventionally used under Unix. If you are unfamiliar with these " -"conventions, read this section to acquaint yourself with them." +"programs with straightforward command-line interfaces that follow the " +"conventions established by the :c:func:`!getopt` family of functions " +"available to C developers. To that end, it supports only the most common " +"command-line syntax and semantics conventionally used under Unix. If you " +"are unfamiliar with these conventions, reading this section will allow you " +"to acquaint yourself with them." msgstr "" -#: ../../library/optparse.rst:94 +#: ../../library/optparse.rst:205 msgid "Terminology" msgstr "術語" -#: ../../library/optparse.rst:96 +#: ../../library/optparse.rst:207 msgid "argument" -msgstr "" +msgstr "引數" -#: ../../library/optparse.rst:97 +#: ../../library/optparse.rst:208 msgid "" "a string entered on the command-line, and passed by the shell to ``execl()`` " "or ``execv()``. In Python, arguments are elements of ``sys.argv[1:]`` " @@ -152,7 +373,7 @@ msgid "" "also use the term \"word\"." msgstr "" -#: ../../library/optparse.rst:102 +#: ../../library/optparse.rst:213 msgid "" "It is occasionally desirable to substitute an argument list other than ``sys." "argv[1:]``, so you should read \"argument\" as \"an element of ``sys." @@ -160,11 +381,11 @@ msgid "" "argv[1:]``\"." msgstr "" -#: ../../library/optparse.rst:107 +#: ../../library/optparse.rst:218 msgid "option" -msgstr "" +msgstr "選項" -#: ../../library/optparse.rst:108 +#: ../../library/optparse.rst:219 msgid "" "an argument used to supply extra information to guide or customize the " "execution of a program. There are many different syntaxes for options; the " @@ -176,36 +397,36 @@ msgid "" "option syntaxes provided by :mod:`optparse`." msgstr "" -#: ../../library/optparse.rst:117 +#: ../../library/optparse.rst:228 msgid "Some other option syntaxes that the world has seen include:" msgstr "" -#: ../../library/optparse.rst:119 +#: ../../library/optparse.rst:230 msgid "" "a hyphen followed by a few letters, e.g. ``-pf`` (this is *not* the same as " "multiple options merged into a single argument)" msgstr "" -#: ../../library/optparse.rst:122 +#: ../../library/optparse.rst:233 msgid "" "a hyphen followed by a whole word, e.g. ``-file`` (this is technically " "equivalent to the previous syntax, but they aren't usually seen in the same " "program)" msgstr "" -#: ../../library/optparse.rst:126 +#: ../../library/optparse.rst:237 msgid "" "a plus sign followed by a single letter, or a few letters, or a word, e.g. " "``+f``, ``+rgb``" msgstr "" -#: ../../library/optparse.rst:129 +#: ../../library/optparse.rst:240 msgid "" "a slash followed by a letter, or a few letters, or a word, e.g. ``/f``, ``/" "file``" msgstr "" -#: ../../library/optparse.rst:132 +#: ../../library/optparse.rst:243 msgid "" "These option syntaxes are not supported by :mod:`optparse`, and they never " "will be. This is deliberate: the first three are non-standard on any " @@ -213,11 +434,11 @@ msgid "" "Windows or certain legacy platforms (e.g. VMS, MS-DOS)." msgstr "" -#: ../../library/optparse.rst:137 +#: ../../library/optparse.rst:248 msgid "option argument" -msgstr "" +msgstr "選項引數" -#: ../../library/optparse.rst:138 +#: ../../library/optparse.rst:249 msgid "" "an argument that follows an option, is closely associated with that option, " "and is consumed from the argument list when that option is. With :mod:" @@ -225,23 +446,27 @@ msgid "" "option:" msgstr "" -#: ../../library/optparse.rst:143 +#: ../../library/optparse.rst:254 msgid "" "-f foo\n" "--file foo" msgstr "" +"-f foo\n" +"--file foo" -#: ../../library/optparse.rst:148 +#: ../../library/optparse.rst:259 msgid "or included in the same argument:" msgstr "" -#: ../../library/optparse.rst:150 +#: ../../library/optparse.rst:261 msgid "" "-ffoo\n" "--file=foo" msgstr "" +"-ffoo\n" +"--file=foo" -#: ../../library/optparse.rst:155 +#: ../../library/optparse.rst:266 msgid "" "Typically, a given option either takes an argument or it doesn't. Lots of " "people want an \"optional option arguments\" feature, meaning that some " @@ -252,22 +477,22 @@ msgid "" "support this feature." msgstr "" -#: ../../library/optparse.rst:163 +#: ../../library/optparse.rst:274 msgid "positional argument" -msgstr "" +msgstr "位置引數" -#: ../../library/optparse.rst:164 +#: ../../library/optparse.rst:275 msgid "" "something leftover in the argument list after options have been parsed, i.e. " "after options and their arguments have been parsed and removed from the " "argument list." msgstr "" -#: ../../library/optparse.rst:168 +#: ../../library/optparse.rst:279 msgid "required option" msgstr "" -#: ../../library/optparse.rst:169 +#: ../../library/optparse.rst:280 msgid "" "an option that must be supplied on the command-line; note that the phrase " "\"required option\" is self-contradictory in English. :mod:`optparse` " @@ -275,26 +500,26 @@ msgid "" "much help at it either." msgstr "" -#: ../../library/optparse.rst:174 +#: ../../library/optparse.rst:285 msgid "For example, consider this hypothetical command-line::" msgstr "" -#: ../../library/optparse.rst:176 +#: ../../library/optparse.rst:287 msgid "prog -v --report report.txt foo bar" -msgstr "" +msgstr "prog -v --report report.txt foo bar" -#: ../../library/optparse.rst:178 +#: ../../library/optparse.rst:289 msgid "" "``-v`` and ``--report`` are both options. Assuming that ``--report`` takes " "one argument, ``report.txt`` is an option argument. ``foo`` and ``bar`` are " "positional arguments." msgstr "" -#: ../../library/optparse.rst:186 +#: ../../library/optparse.rst:297 msgid "What are options for?" msgstr "" -#: ../../library/optparse.rst:188 +#: ../../library/optparse.rst:299 msgid "" "Options are used to provide extra information to tune or customize the " "execution of a program. In case it wasn't clear, options are usually " @@ -306,7 +531,7 @@ msgid "" "interfaces.)" msgstr "" -#: ../../library/optparse.rst:196 +#: ../../library/optparse.rst:307 msgid "" "Lots of people want their programs to have \"required options\". Think " "about it. If it's required, then it's *not optional*! If there is a piece " @@ -314,7 +539,7 @@ msgid "" "successfully, that's what positional arguments are for." msgstr "" -#: ../../library/optparse.rst:201 +#: ../../library/optparse.rst:312 msgid "" "As an example of good command-line interface design, consider the humble " "``cp`` utility, for copying files. It doesn't make much sense to try to " @@ -323,13 +548,15 @@ msgid "" "useful syntax that does not require any options at all::" msgstr "" -#: ../../library/optparse.rst:207 +#: ../../library/optparse.rst:318 msgid "" "cp SOURCE DEST\n" "cp SOURCE ... DEST-DIR" msgstr "" +"cp SOURCE DEST\n" +"cp SOURCE ... DEST-DIR" -#: ../../library/optparse.rst:210 +#: ../../library/optparse.rst:321 msgid "" "You can get pretty far with just that. Most ``cp`` implementations provide " "a bunch of options to tweak exactly how the files are copied: you can " @@ -339,17 +566,17 @@ msgid "" "files to another directory." msgstr "" -#: ../../library/optparse.rst:221 +#: ../../library/optparse.rst:332 msgid "What are positional arguments for?" msgstr "" -#: ../../library/optparse.rst:223 +#: ../../library/optparse.rst:334 msgid "" "Positional arguments are for those pieces of information that your program " "absolutely, positively requires to run." msgstr "" -#: ../../library/optparse.rst:226 +#: ../../library/optparse.rst:337 msgid "" "A good user interface should have as few absolute requirements as possible. " "If your program requires 17 distinct pieces of information in order to run " @@ -360,7 +587,7 @@ msgid "" "most of them will simply give up." msgstr "" -#: ../../library/optparse.rst:234 +#: ../../library/optparse.rst:345 msgid "" "In short, try to minimize the amount of information that users are " "absolutely required to supply---use sensible defaults whenever possible. Of " @@ -373,65 +600,70 @@ msgid "" "make your code much harder to maintain." msgstr "" -#: ../../library/optparse.rst:247 +#: ../../library/optparse.rst:358 msgid "Tutorial" msgstr "教學" -#: ../../library/optparse.rst:249 +#: ../../library/optparse.rst:360 msgid "" "While :mod:`optparse` is quite flexible and powerful, it's also " "straightforward to use in most cases. This section covers the code patterns " "that are common to any :mod:`optparse`\\ -based program." msgstr "" -#: ../../library/optparse.rst:253 +#: ../../library/optparse.rst:364 msgid "" "First, you need to import the OptionParser class; then, early in the main " "program, create an OptionParser instance::" msgstr "" -#: ../../library/optparse.rst:256 +#: ../../library/optparse.rst:367 msgid "" "from optparse import OptionParser\n" "...\n" "parser = OptionParser()" msgstr "" +"from optparse import OptionParser\n" +"...\n" +"parser = OptionParser()" -#: ../../library/optparse.rst:260 +#: ../../library/optparse.rst:371 msgid "Then you can start defining options. The basic syntax is::" msgstr "" -#: ../../library/optparse.rst:262 +#: ../../library/optparse.rst:373 msgid "" "parser.add_option(opt_str, ...,\n" " attr=value, ...)" msgstr "" +"parser.add_option(opt_str, ...,\n" +" attr=value, ...)" -#: ../../library/optparse.rst:265 +#: ../../library/optparse.rst:376 msgid "" "Each option has one or more option strings, such as ``-f`` or ``--file``, " "and several option attributes that tell :mod:`optparse` what to expect and " "what to do when it encounters that option on the command line." msgstr "" -#: ../../library/optparse.rst:269 +#: ../../library/optparse.rst:380 msgid "" "Typically, each option will have one short option string and one long option " "string, e.g.::" msgstr "" -#: ../../library/optparse.rst:272 +#: ../../library/optparse.rst:383 msgid "parser.add_option(\"-f\", \"--file\", ...)" -msgstr "" +msgstr "parser.add_option(\"-f\", \"--file\", ...)" -#: ../../library/optparse.rst:274 +#: ../../library/optparse.rst:385 msgid "" "You're free to define as many short option strings and as many long option " "strings as you like (including zero), as long as there is at least one " "option string overall." msgstr "" -#: ../../library/optparse.rst:278 +#: ../../library/optparse.rst:389 msgid "" "The option strings passed to :meth:`OptionParser.add_option` are effectively " "labels for the option defined by that call. For brevity, we will frequently " @@ -439,28 +671,28 @@ msgid "" "`optparse` encounters *option strings* and looks up options from them." msgstr "" -#: ../../library/optparse.rst:284 +#: ../../library/optparse.rst:395 msgid "" "Once all of your options are defined, instruct :mod:`optparse` to parse your " "program's command line::" msgstr "" -#: ../../library/optparse.rst:287 +#: ../../library/optparse.rst:398 msgid "(options, args) = parser.parse_args()" -msgstr "" +msgstr "(options, args) = parser.parse_args()" -#: ../../library/optparse.rst:289 +#: ../../library/optparse.rst:400 msgid "" "(If you like, you can pass a custom argument list to :meth:`~OptionParser." "parse_args`, but that's rarely necessary: by default it uses ``sys." "argv[1:]``.)" msgstr "" -#: ../../library/optparse.rst:292 +#: ../../library/optparse.rst:403 msgid ":meth:`~OptionParser.parse_args` returns two values:" msgstr ":meth:`~OptionParser.parse_args` 回傳兩個值:" -#: ../../library/optparse.rst:294 +#: ../../library/optparse.rst:405 msgid "" "``options``, an object containing values for all of your options---e.g. if " "``--file`` takes a single string argument, then ``options.file`` will be the " @@ -468,12 +700,12 @@ msgid "" "option" msgstr "" -#: ../../library/optparse.rst:299 +#: ../../library/optparse.rst:410 msgid "" "``args``, the list of positional arguments leftover after parsing options" msgstr "" -#: ../../library/optparse.rst:301 +#: ../../library/optparse.rst:412 msgid "" "This tutorial section only covers the four most important option " "attributes: :attr:`~Option.action`, :attr:`~Option.type`, :attr:`~Option." @@ -481,11 +713,11 @@ msgid "" "action` is the most fundamental." msgstr "" -#: ../../library/optparse.rst:310 +#: ../../library/optparse.rst:421 msgid "Understanding option actions" msgstr "" -#: ../../library/optparse.rst:312 +#: ../../library/optparse.rst:423 msgid "" "Actions tell :mod:`optparse` what to do when it encounters an option on the " "command line. There is a fixed set of actions hard-coded into :mod:" @@ -495,44 +727,48 @@ msgid "" "and store it in an attribute of ``options``." msgstr "" -#: ../../library/optparse.rst:319 +#: ../../library/optparse.rst:430 msgid "" "If you don't specify an option action, :mod:`optparse` defaults to ``store``." msgstr "" -#: ../../library/optparse.rst:325 +#: ../../library/optparse.rst:436 msgid "The store action" msgstr "" -#: ../../library/optparse.rst:327 +#: ../../library/optparse.rst:438 msgid "" "The most common option action is ``store``, which tells :mod:`optparse` to " "take the next argument (or the remainder of the current argument), ensure " "that it is of the correct type, and store it to your chosen destination." msgstr "" -#: ../../library/optparse.rst:331 +#: ../../library/optparse.rst:442 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/optparse.rst:333 +#: ../../library/optparse.rst:444 msgid "" "parser.add_option(\"-f\", \"--file\",\n" " action=\"store\", type=\"string\", dest=\"filename\")" msgstr "" +"parser.add_option(\"-f\", \"--file\",\n" +" action=\"store\", type=\"string\", dest=\"filename\")" -#: ../../library/optparse.rst:336 +#: ../../library/optparse.rst:447 msgid "" "Now let's make up a fake command line and ask :mod:`optparse` to parse it::" msgstr "" -#: ../../library/optparse.rst:338 +#: ../../library/optparse.rst:449 msgid "" "args = [\"-f\", \"foo.txt\"]\n" "(options, args) = parser.parse_args(args)" msgstr "" +"args = [\"-f\", \"foo.txt\"]\n" +"(options, args) = parser.parse_args(args)" -#: ../../library/optparse.rst:341 +#: ../../library/optparse.rst:452 msgid "" "When :mod:`optparse` sees the option string ``-f``, it consumes the next " "argument, ``foo.txt``, and stores it in ``options.filename``. So, after " @@ -540,51 +776,53 @@ msgid "" "``\"foo.txt\"``." msgstr "" -#: ../../library/optparse.rst:345 +#: ../../library/optparse.rst:456 msgid "" "Some other option types supported by :mod:`optparse` are ``int`` and " "``float``. Here's an option that expects an integer argument::" msgstr "" -#: ../../library/optparse.rst:348 +#: ../../library/optparse.rst:459 msgid "parser.add_option(\"-n\", type=\"int\", dest=\"num\")" -msgstr "" +msgstr "parser.add_option(\"-n\", type=\"int\", dest=\"num\")" -#: ../../library/optparse.rst:350 +#: ../../library/optparse.rst:461 msgid "" "Note that this option has no long option string, which is perfectly " "acceptable. Also, there's no explicit action, since the default is ``store``." msgstr "" -#: ../../library/optparse.rst:353 +#: ../../library/optparse.rst:464 msgid "" "Let's parse another fake command-line. This time, we'll jam the option " "argument right up against the option: since ``-n42`` (one argument) is " "equivalent to ``-n 42`` (two arguments), the code ::" msgstr "" -#: ../../library/optparse.rst:357 +#: ../../library/optparse.rst:468 msgid "" "(options, args) = parser.parse_args([\"-n42\"])\n" "print(options.num)" msgstr "" +"(options, args) = parser.parse_args([\"-n42\"])\n" +"print(options.num)" -#: ../../library/optparse.rst:360 +#: ../../library/optparse.rst:471 msgid "will print ``42``." -msgstr "" +msgstr "會印出 ``42``。" -#: ../../library/optparse.rst:362 +#: ../../library/optparse.rst:473 msgid "" "If you don't specify a type, :mod:`optparse` assumes ``string``. Combined " "with the fact that the default action is ``store``, that means our first " "example can be a lot shorter::" msgstr "" -#: ../../library/optparse.rst:366 +#: ../../library/optparse.rst:477 msgid "parser.add_option(\"-f\", \"--file\", dest=\"filename\")" -msgstr "" +msgstr "parser.add_option(\"-f\", \"--file\", dest=\"filename\")" -#: ../../library/optparse.rst:368 +#: ../../library/optparse.rst:479 msgid "" "If you don't supply a destination, :mod:`optparse` figures out a sensible " "default from the option strings: if the first long option string is ``--foo-" @@ -593,17 +831,17 @@ msgid "" "default destination for ``-f`` is ``f``." msgstr "" -#: ../../library/optparse.rst:374 +#: ../../library/optparse.rst:485 msgid "" ":mod:`optparse` also includes the built-in ``complex`` type. Adding types " "is covered in section :ref:`optparse-extending-optparse`." msgstr "" -#: ../../library/optparse.rst:381 +#: ../../library/optparse.rst:492 msgid "Handling boolean (flag) options" msgstr "" -#: ../../library/optparse.rst:383 +#: ../../library/optparse.rst:494 msgid "" "Flag options---set a variable to true or false when a particular option is " "seen---are quite common. :mod:`optparse` supports them with two separate " @@ -611,77 +849,79 @@ msgid "" "``verbose`` flag that is turned on with ``-v`` and off with ``-q``::" msgstr "" -#: ../../library/optparse.rst:388 +#: ../../library/optparse.rst:499 msgid "" "parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\")\n" "parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\")" msgstr "" +"parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\")\n" +"parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\")" -#: ../../library/optparse.rst:391 +#: ../../library/optparse.rst:502 msgid "" "Here we have two different options with the same destination, which is " "perfectly OK. (It just means you have to be a bit careful when setting " "default values---see below.)" msgstr "" -#: ../../library/optparse.rst:395 +#: ../../library/optparse.rst:506 msgid "" "When :mod:`optparse` encounters ``-v`` on the command line, it sets " "``options.verbose`` to ``True``; when it encounters ``-q``, ``options." "verbose`` is set to ``False``." msgstr "" -#: ../../library/optparse.rst:403 +#: ../../library/optparse.rst:514 msgid "Other actions" msgstr "" -#: ../../library/optparse.rst:405 +#: ../../library/optparse.rst:516 msgid "Some other actions supported by :mod:`optparse` are:" msgstr "" -#: ../../library/optparse.rst:407 ../../library/optparse.rst:929 +#: ../../library/optparse.rst:518 ../../library/optparse.rst:1040 msgid "``\"store_const\"``" msgstr "``\"store_const\"``" -#: ../../library/optparse.rst:408 ../../library/optparse.rst:930 +#: ../../library/optparse.rst:519 ../../library/optparse.rst:1041 msgid "store a constant value, pre-set via :attr:`Option.const`" msgstr "" -#: ../../library/optparse.rst:410 ../../library/optparse.rst:938 +#: ../../library/optparse.rst:521 ../../library/optparse.rst:1049 msgid "``\"append\"``" msgstr "``\"append\"``" -#: ../../library/optparse.rst:411 ../../library/optparse.rst:939 +#: ../../library/optparse.rst:522 ../../library/optparse.rst:1050 msgid "append this option's argument to a list" msgstr "" -#: ../../library/optparse.rst:413 ../../library/optparse.rst:944 +#: ../../library/optparse.rst:524 ../../library/optparse.rst:1055 msgid "``\"count\"``" msgstr "``\"count\"``" -#: ../../library/optparse.rst:414 ../../library/optparse.rst:945 +#: ../../library/optparse.rst:525 ../../library/optparse.rst:1056 msgid "increment a counter by one" msgstr "" -#: ../../library/optparse.rst:416 ../../library/optparse.rst:947 +#: ../../library/optparse.rst:527 ../../library/optparse.rst:1058 msgid "``\"callback\"``" msgstr "``\"callback\"``" -#: ../../library/optparse.rst:417 ../../library/optparse.rst:948 +#: ../../library/optparse.rst:528 ../../library/optparse.rst:1059 msgid "call a specified function" msgstr "" -#: ../../library/optparse.rst:419 +#: ../../library/optparse.rst:530 msgid "" "These are covered in section :ref:`optparse-reference-guide`, and section :" "ref:`optparse-option-callbacks`." msgstr "" -#: ../../library/optparse.rst:426 +#: ../../library/optparse.rst:537 msgid "Default values" -msgstr "" +msgstr "預設值" -#: ../../library/optparse.rst:428 +#: ../../library/optparse.rst:539 msgid "" "All of the above examples involve setting some variable (the " "\"destination\") when certain command-line options are seen. What happens " @@ -691,77 +931,87 @@ msgid "" "destination, which is assigned before the command line is parsed." msgstr "" -#: ../../library/optparse.rst:435 +#: ../../library/optparse.rst:546 msgid "" "First, consider the verbose/quiet example. If we want :mod:`optparse` to " "set ``verbose`` to ``True`` unless ``-q`` is seen, then we can do this::" msgstr "" -#: ../../library/optparse.rst:438 +#: ../../library/optparse.rst:549 msgid "" "parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\", " "default=True)\n" "parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\")" msgstr "" +"parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\", " +"default=True)\n" +"parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\")" -#: ../../library/optparse.rst:441 +#: ../../library/optparse.rst:552 msgid "" "Since default values apply to the *destination* rather than to any " "particular option, and these two options happen to have the same " "destination, this is exactly equivalent::" msgstr "" -#: ../../library/optparse.rst:445 +#: ../../library/optparse.rst:556 msgid "" "parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\")\n" "parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\", " "default=True)" msgstr "" -#: ../../library/optparse.rst:448 +#: ../../library/optparse.rst:559 msgid "Consider this::" msgstr "" -#: ../../library/optparse.rst:450 +#: ../../library/optparse.rst:561 msgid "" "parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\", " "default=False)\n" "parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\", " "default=True)" msgstr "" +"parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\", " +"default=False)\n" +"parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\", " +"default=True)" -#: ../../library/optparse.rst:453 +#: ../../library/optparse.rst:564 msgid "" "Again, the default value for ``verbose`` will be ``True``: the last default " "value supplied for any particular destination is the one that counts." msgstr "" -#: ../../library/optparse.rst:456 +#: ../../library/optparse.rst:567 msgid "" "A clearer way to specify default values is the :meth:`set_defaults` method " "of OptionParser, which you can call at any time before calling :meth:" "`~OptionParser.parse_args`::" msgstr "" -#: ../../library/optparse.rst:460 +#: ../../library/optparse.rst:571 msgid "" "parser.set_defaults(verbose=True)\n" "parser.add_option(...)\n" "(options, args) = parser.parse_args()" msgstr "" +"parser.set_defaults(verbose=True)\n" +"parser.add_option(...)\n" +"(options, args) = parser.parse_args()" -#: ../../library/optparse.rst:464 +#: ../../library/optparse.rst:575 msgid "" "As before, the last value specified for a given option destination is the " "one that counts. For clarity, try to use one method or the other of setting " "default values, not both." msgstr "" -#: ../../library/optparse.rst:472 +#: ../../library/optparse.rst:583 msgid "Generating help" msgstr "" -#: ../../library/optparse.rst:474 +#: ../../library/optparse.rst:585 msgid "" ":mod:`optparse`'s ability to generate help and usage text automatically is " "useful for creating user-friendly command-line interfaces. All you have to " @@ -770,7 +1020,7 @@ msgid "" "populated with user-friendly (documented) options::" msgstr "" -#: ../../library/optparse.rst:480 +#: ../../library/optparse.rst:591 msgid "" "usage = \"usage: %prog [options] arg1 arg2\"\n" "parser = OptionParser(usage=usage)\n" @@ -787,15 +1037,29 @@ msgid "" " help=\"interaction mode: novice, intermediate, \"\n" " \"or expert [default: %default]\")" msgstr "" +"usage = \"usage: %prog [options] arg1 arg2\"\n" +"parser = OptionParser(usage=usage)\n" +"parser.add_option(\"-v\", \"--verbose\",\n" +" action=\"store_true\", dest=\"verbose\", default=True,\n" +" help=\"make lots of noise [default]\")\n" +"parser.add_option(\"-q\", \"--quiet\",\n" +" action=\"store_false\", dest=\"verbose\",\n" +" help=\"be vewwy quiet (I'm hunting wabbits)\")\n" +"parser.add_option(\"-f\", \"--filename\",\n" +" metavar=\"FILE\", help=\"write output to FILE\")\n" +"parser.add_option(\"-m\", \"--mode\",\n" +" default=\"intermediate\",\n" +" help=\"interaction mode: novice, intermediate, \"\n" +" \"or expert [default: %default]\")" -#: ../../library/optparse.rst:495 +#: ../../library/optparse.rst:606 msgid "" "If :mod:`optparse` encounters either ``-h`` or ``--help`` on the command-" "line, or if you just call :meth:`parser.print_help`, it prints the following " "to standard output:" msgstr "" -#: ../../library/optparse.rst:499 +#: ../../library/optparse.rst:610 msgid "" "Usage: <yourscript> [options] arg1 arg2\n" "\n" @@ -808,59 +1072,69 @@ msgid "" " -m MODE, --mode=MODE interaction mode: novice, intermediate, or\n" " expert [default: intermediate]" msgstr "" +"Usage: <yourscript> [options] arg1 arg2\n" +"\n" +"Options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbose make lots of noise [default]\n" +" -q, --quiet be vewwy quiet (I'm hunting wabbits)\n" +" -f FILE, --filename=FILE\n" +" write output to FILE\n" +" -m MODE, --mode=MODE interaction mode: novice, intermediate, or\n" +" expert [default: intermediate]" -#: ../../library/optparse.rst:512 +#: ../../library/optparse.rst:623 msgid "" "(If the help output is triggered by a help option, :mod:`optparse` exits " "after printing the help text.)" msgstr "" -#: ../../library/optparse.rst:515 +#: ../../library/optparse.rst:626 msgid "" "There's a lot going on here to help :mod:`optparse` generate the best " "possible help message:" msgstr "" -#: ../../library/optparse.rst:518 +#: ../../library/optparse.rst:629 msgid "the script defines its own usage message::" msgstr "" -#: ../../library/optparse.rst:520 +#: ../../library/optparse.rst:631 msgid "usage = \"usage: %prog [options] arg1 arg2\"" -msgstr "" +msgstr "usage = \"usage: %prog [options] arg1 arg2\"" -#: ../../library/optparse.rst:522 +#: ../../library/optparse.rst:633 msgid "" ":mod:`optparse` expands ``%prog`` in the usage string to the name of the " "current program, i.e. ``os.path.basename(sys.argv[0])``. The expanded " "string is then printed before the detailed option help." msgstr "" -#: ../../library/optparse.rst:526 +#: ../../library/optparse.rst:637 msgid "" "If you don't supply a usage string, :mod:`optparse` uses a bland but " "sensible default: ``\"Usage: %prog [options]\"``, which is fine if your " "script doesn't take any positional arguments." msgstr "" -#: ../../library/optparse.rst:530 +#: ../../library/optparse.rst:641 msgid "" "every option defines a help string, and doesn't worry about line-wrapping---" "\\ :mod:`optparse` takes care of wrapping lines and making the help output " "look good." msgstr "" -#: ../../library/optparse.rst:534 +#: ../../library/optparse.rst:645 msgid "" "options that take a value indicate this fact in their automatically " "generated help message, e.g. for the \"mode\" option::" msgstr "" -#: ../../library/optparse.rst:537 +#: ../../library/optparse.rst:648 msgid "-m MODE, --mode=MODE" -msgstr "" +msgstr "-m MODE, --mode=MODE" -#: ../../library/optparse.rst:539 +#: ../../library/optparse.rst:650 msgid "" "Here, \"MODE\" is called the meta-variable: it stands for the argument that " "the user is expected to supply to ``-m``/``--mode``. By default, :mod:" @@ -870,11 +1144,11 @@ msgid "" "this automatically generated option description::" msgstr "" -#: ../../library/optparse.rst:546 +#: ../../library/optparse.rst:657 msgid "-f FILE, --filename=FILE" -msgstr "" +msgstr "-f FILE, --filename=FILE" -#: ../../library/optparse.rst:548 +#: ../../library/optparse.rst:659 msgid "" "This is important for more than just saving space, though: the manually " "written help text uses the meta-variable ``FILE`` to clue the user in that " @@ -884,7 +1158,7 @@ msgid "" "users." msgstr "" -#: ../../library/optparse.rst:554 +#: ../../library/optparse.rst:665 msgid "" "options that have a default value can include ``%default`` in the help " "string---\\ :mod:`optparse` will replace it with :func:`str` of the option's " @@ -892,58 +1166,58 @@ msgid "" "``None``), ``%default`` expands to ``none``." msgstr "" -#: ../../library/optparse.rst:560 +#: ../../library/optparse.rst:671 msgid "Grouping Options" msgstr "" -#: ../../library/optparse.rst:562 +#: ../../library/optparse.rst:673 msgid "" "When dealing with many options, it is convenient to group these options for " "better help output. An :class:`OptionParser` can contain several option " "groups, each of which can contain several options." msgstr "" -#: ../../library/optparse.rst:566 +#: ../../library/optparse.rst:677 msgid "An option group is obtained using the class :class:`OptionGroup`:" msgstr "" -#: ../../library/optparse.rst:570 ../../library/optparse.rst:1641 +#: ../../library/optparse.rst:681 ../../library/optparse.rst:1752 msgid "where" msgstr "" -#: ../../library/optparse.rst:572 +#: ../../library/optparse.rst:683 msgid "" "parser is the :class:`OptionParser` instance the group will be inserted in to" msgstr "" -#: ../../library/optparse.rst:574 +#: ../../library/optparse.rst:685 msgid "title is the group title" msgstr "" -#: ../../library/optparse.rst:575 +#: ../../library/optparse.rst:686 msgid "description, optional, is a long description of the group" msgstr "" -#: ../../library/optparse.rst:577 +#: ../../library/optparse.rst:688 msgid "" ":class:`OptionGroup` inherits from :class:`OptionContainer` (like :class:" "`OptionParser`) and so the :meth:`add_option` method can be used to add an " "option to the group." msgstr "" -#: ../../library/optparse.rst:581 +#: ../../library/optparse.rst:692 msgid "" "Once all the options are declared, using the :class:`OptionParser` method :" "meth:`add_option_group` the group is added to the previously defined parser." msgstr "" -#: ../../library/optparse.rst:584 +#: ../../library/optparse.rst:695 msgid "" "Continuing with the parser defined in the previous section, adding an :class:" "`OptionGroup` to a parser is easy::" msgstr "" -#: ../../library/optparse.rst:587 +#: ../../library/optparse.rst:698 msgid "" "group = OptionGroup(parser, \"Dangerous Options\",\n" " \"Caution: use these options at your own risk. \"\n" @@ -951,12 +1225,17 @@ msgid "" "group.add_option(\"-g\", action=\"store_true\", help=\"Group option.\")\n" "parser.add_option_group(group)" msgstr "" +"group = OptionGroup(parser, \"Dangerous Options\",\n" +" \"Caution: use these options at your own risk. \"\n" +" \"It is believed that some of them bite.\")\n" +"group.add_option(\"-g\", action=\"store_true\", help=\"Group option.\")\n" +"parser.add_option_group(group)" -#: ../../library/optparse.rst:593 +#: ../../library/optparse.rst:704 msgid "This would result in the following help output:" msgstr "" -#: ../../library/optparse.rst:595 +#: ../../library/optparse.rst:706 msgid "" "Usage: <yourscript> [options] arg1 arg2\n" "\n" @@ -975,15 +1254,46 @@ msgid "" "\n" " -g Group option." msgstr "" +"Usage: <yourscript> [options] arg1 arg2\n" +"\n" +"Options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbose make lots of noise [default]\n" +" -q, --quiet be vewwy quiet (I'm hunting wabbits)\n" +" -f FILE, --filename=FILE\n" +" write output to FILE\n" +" -m MODE, --mode=MODE interaction mode: novice, intermediate, or\n" +" expert [default: intermediate]\n" +"\n" +" Dangerous Options:\n" +" Caution: use these options at your own risk. It is believed that some\n" +" of them bite.\n" +"\n" +" -g Group option." -#: ../../library/optparse.rst:614 +#: ../../library/optparse.rst:725 msgid "" "A bit more complete example might involve using more than one group: still " "extending the previous example::" msgstr "" - -#: ../../library/optparse.rst:617 -msgid "" + +#: ../../library/optparse.rst:728 +msgid "" +"group = OptionGroup(parser, \"Dangerous Options\",\n" +" \"Caution: use these options at your own risk. \"\n" +" \"It is believed that some of them bite.\")\n" +"group.add_option(\"-g\", action=\"store_true\", help=\"Group option.\")\n" +"parser.add_option_group(group)\n" +"\n" +"group = OptionGroup(parser, \"Debug Options\")\n" +"group.add_option(\"-d\", \"--debug\", action=\"store_true\",\n" +" help=\"Print debug information\")\n" +"group.add_option(\"-s\", \"--sql\", action=\"store_true\",\n" +" help=\"Print all SQL statements executed\")\n" +"group.add_option(\"-e\", action=\"store_true\", help=\"Print every action " +"done\")\n" +"parser.add_option_group(group)" +msgstr "" "group = OptionGroup(parser, \"Dangerous Options\",\n" " \"Caution: use these options at your own risk. \"\n" " \"It is believed that some of them bite.\")\n" @@ -998,13 +1308,12 @@ msgid "" "group.add_option(\"-e\", action=\"store_true\", help=\"Print every action " "done\")\n" "parser.add_option_group(group)" -msgstr "" -#: ../../library/optparse.rst:631 +#: ../../library/optparse.rst:742 msgid "that results in the following output:" msgstr "" -#: ../../library/optparse.rst:633 +#: ../../library/optparse.rst:744 msgid "" "Usage: <yourscript> [options] arg1 arg2\n" "\n" @@ -1028,36 +1337,58 @@ msgid "" " -s, --sql Print all SQL statements executed\n" " -e Print every action done" msgstr "" +"Usage: <yourscript> [options] arg1 arg2\n" +"\n" +"Options:\n" +" -h, --help show this help message and exit\n" +" -v, --verbose make lots of noise [default]\n" +" -q, --quiet be vewwy quiet (I'm hunting wabbits)\n" +" -f FILE, --filename=FILE\n" +" write output to FILE\n" +" -m MODE, --mode=MODE interaction mode: novice, intermediate, or expert\n" +" [default: intermediate]\n" +"\n" +" Dangerous Options:\n" +" Caution: use these options at your own risk. It is believed that some\n" +" of them bite.\n" +"\n" +" -g Group option.\n" +"\n" +" Debug Options:\n" +" -d, --debug Print debug information\n" +" -s, --sql Print all SQL statements executed\n" +" -e Print every action done" -#: ../../library/optparse.rst:657 +#: ../../library/optparse.rst:768 msgid "" "Another interesting method, in particular when working programmatically with " "option groups is:" msgstr "" -#: ../../library/optparse.rst:662 +#: ../../library/optparse.rst:773 msgid "" "Return the :class:`OptionGroup` to which the short or long option string " "*opt_str* (e.g. ``'-o'`` or ``'--option'``) belongs. If there's no such :" "class:`OptionGroup`, return ``None``." msgstr "" -#: ../../library/optparse.rst:669 +#: ../../library/optparse.rst:780 msgid "Printing a version string" msgstr "" -#: ../../library/optparse.rst:671 +#: ../../library/optparse.rst:782 msgid "" "Similar to the brief usage string, :mod:`optparse` can also print a version " "string for your program. You have to supply the string as the ``version`` " "argument to OptionParser::" msgstr "" -#: ../../library/optparse.rst:675 +#: ../../library/optparse.rst:786 msgid "parser = OptionParser(usage=\"%prog [-f] [-q]\", version=\"%prog 1.0\")" msgstr "" +"parser = OptionParser(usage=\"%prog [-f] [-q]\", version=\"%prog 1.0\")" -#: ../../library/optparse.rst:677 +#: ../../library/optparse.rst:788 msgid "" "``%prog`` is expanded just like it is in ``usage``. Apart from that, " "``version`` can contain anything you like. When you supply it, :mod:" @@ -1066,23 +1397,25 @@ msgid "" "string (by replacing ``%prog``), prints it to stdout, and exits." msgstr "" -#: ../../library/optparse.rst:683 +#: ../../library/optparse.rst:794 msgid "For example, if your script is called ``/usr/bin/foo``:" msgstr "" -#: ../../library/optparse.rst:685 +#: ../../library/optparse.rst:796 msgid "" "$ /usr/bin/foo --version\n" "foo 1.0" msgstr "" +"$ /usr/bin/foo --version\n" +"foo 1.0" -#: ../../library/optparse.rst:690 +#: ../../library/optparse.rst:801 msgid "" "The following two methods can be used to print and get the ``version`` " "string:" msgstr "" -#: ../../library/optparse.rst:694 +#: ../../library/optparse.rst:805 msgid "" "Print the version message for the current program (``self.version``) to " "*file* (default stdout). As with :meth:`print_usage`, any occurrence of " @@ -1090,17 +1423,17 @@ msgid "" "program. Does nothing if ``self.version`` is empty or undefined." msgstr "" -#: ../../library/optparse.rst:701 +#: ../../library/optparse.rst:812 msgid "" "Same as :meth:`print_version` but returns the version string instead of " "printing it." msgstr "" -#: ../../library/optparse.rst:708 +#: ../../library/optparse.rst:819 msgid "How :mod:`optparse` handles errors" msgstr "" -#: ../../library/optparse.rst:710 +#: ../../library/optparse.rst:821 msgid "" "There are two broad classes of errors that :mod:`optparse` has to worry " "about: programmer errors and user errors. Programmer errors are usually " @@ -1110,7 +1443,7 @@ msgid "" "OptionError` or :exc:`TypeError`) and let the program crash." msgstr "" -#: ../../library/optparse.rst:717 +#: ../../library/optparse.rst:828 msgid "" "Handling user errors is much more important, since they are guaranteed to " "happen no matter how stable your code is. :mod:`optparse` can automatically " @@ -1121,70 +1454,82 @@ msgid "" "error condition::" msgstr "" -#: ../../library/optparse.rst:725 +#: ../../library/optparse.rst:836 msgid "" "(options, args) = parser.parse_args()\n" "...\n" "if options.a and options.b:\n" " parser.error(\"options -a and -b are mutually exclusive\")" msgstr "" +"(options, args) = parser.parse_args()\n" +"...\n" +"if options.a and options.b:\n" +" parser.error(\"options -a and -b are mutually exclusive\")" -#: ../../library/optparse.rst:730 +#: ../../library/optparse.rst:841 msgid "" "In either case, :mod:`optparse` handles the error the same way: it prints " "the program's usage message and an error message to standard error and exits " "with error status 2." msgstr "" -#: ../../library/optparse.rst:734 +#: ../../library/optparse.rst:845 msgid "" "Consider the first example above, where the user passes ``4x`` to an option " "that takes an integer:" msgstr "" -#: ../../library/optparse.rst:737 +#: ../../library/optparse.rst:848 msgid "" "$ /usr/bin/foo -n 4x\n" "Usage: foo [options]\n" "\n" "foo: error: option -n: invalid integer value: '4x'" msgstr "" +"$ /usr/bin/foo -n 4x\n" +"Usage: foo [options]\n" +"\n" +"foo: error: option -n: invalid integer value: '4x'" -#: ../../library/optparse.rst:744 +#: ../../library/optparse.rst:855 msgid "Or, where the user fails to pass a value at all:" msgstr "" -#: ../../library/optparse.rst:746 +#: ../../library/optparse.rst:857 msgid "" "$ /usr/bin/foo -n\n" "Usage: foo [options]\n" "\n" "foo: error: -n option requires an argument" msgstr "" +"$ /usr/bin/foo -n\n" +"Usage: foo [options]\n" +"\n" +"foo: error: -n option requires an argument" -#: ../../library/optparse.rst:753 +#: ../../library/optparse.rst:864 msgid "" ":mod:`optparse`\\ -generated error messages take care always to mention the " "option involved in the error; be sure to do the same when calling :func:" "`OptionParser.error` from your application code." msgstr "" -#: ../../library/optparse.rst:757 +#: ../../library/optparse.rst:868 msgid "" "If :mod:`optparse`'s default error-handling behaviour does not suit your " "needs, you'll need to subclass OptionParser and override its :meth:" "`~OptionParser.exit` and/or :meth:`~OptionParser.error` methods." msgstr "" -#: ../../library/optparse.rst:765 +#: ../../library/optparse.rst:876 msgid "Putting it all together" msgstr "" -#: ../../library/optparse.rst:767 +#: ../../library/optparse.rst:878 msgid "Here's what :mod:`optparse`\\ -based scripts usually look like::" msgstr "" -#: ../../library/optparse.rst:769 +#: ../../library/optparse.rst:880 msgid "" "from optparse import OptionParser\n" "...\n" @@ -1208,33 +1553,54 @@ msgid "" "if __name__ == \"__main__\":\n" " main()" msgstr "" +"from optparse import OptionParser\n" +"...\n" +"def main():\n" +" usage = \"usage: %prog [options] arg\"\n" +" parser = OptionParser(usage)\n" +" parser.add_option(\"-f\", \"--file\", dest=\"filename\",\n" +" help=\"read data from FILENAME\")\n" +" parser.add_option(\"-v\", \"--verbose\",\n" +" action=\"store_true\", dest=\"verbose\")\n" +" parser.add_option(\"-q\", \"--quiet\",\n" +" action=\"store_false\", dest=\"verbose\")\n" +" ...\n" +" (options, args) = parser.parse_args()\n" +" if len(args) != 1:\n" +" parser.error(\"incorrect number of arguments\")\n" +" if options.verbose:\n" +" print(\"reading %s...\" % options.filename)\n" +" ...\n" +"\n" +"if __name__ == \"__main__\":\n" +" main()" -#: ../../library/optparse.rst:795 +#: ../../library/optparse.rst:906 msgid "Reference Guide" msgstr "" -#: ../../library/optparse.rst:801 +#: ../../library/optparse.rst:912 msgid "Creating the parser" msgstr "" -#: ../../library/optparse.rst:803 +#: ../../library/optparse.rst:914 msgid "" "The first step in using :mod:`optparse` is to create an OptionParser " "instance." msgstr "" -#: ../../library/optparse.rst:807 +#: ../../library/optparse.rst:918 msgid "" "The OptionParser constructor has no required arguments, but a number of " "optional keyword arguments. You should always pass them as keyword " "arguments, i.e. do not rely on the order in which the arguments are declared." msgstr "" -#: ../../library/optparse.rst:811 +#: ../../library/optparse.rst:922 msgid "``usage`` (default: ``\"%prog [options]\"``)" msgstr "" -#: ../../library/optparse.rst:812 +#: ../../library/optparse.rst:923 msgid "" "The usage summary to print when your program is run incorrectly or with a " "help option. When :mod:`optparse` prints the usage string, it expands " @@ -1243,11 +1609,11 @@ msgid "" "value :const:`optparse.SUPPRESS_USAGE`." msgstr "" -#: ../../library/optparse.rst:818 +#: ../../library/optparse.rst:929 msgid "``option_list`` (default: ``[]``)" msgstr "" -#: ../../library/optparse.rst:819 +#: ../../library/optparse.rst:930 msgid "" "A list of Option objects to populate the parser with. The options in " "``option_list`` are added after any options in ``standard_option_list`` (a " @@ -1256,19 +1622,19 @@ msgid "" "the parser instead." msgstr "" -#: ../../library/optparse.rst:825 +#: ../../library/optparse.rst:936 msgid "``option_class`` (default: optparse.Option)" msgstr "" -#: ../../library/optparse.rst:826 +#: ../../library/optparse.rst:937 msgid "Class to use when adding options to the parser in :meth:`add_option`." msgstr "" -#: ../../library/optparse.rst:828 +#: ../../library/optparse.rst:939 msgid "``version`` (default: ``None``)" msgstr "" -#: ../../library/optparse.rst:829 +#: ../../library/optparse.rst:940 msgid "" "A version string to print when the user supplies a version option. If you " "supply a true value for ``version``, :mod:`optparse` automatically adds a " @@ -1276,21 +1642,21 @@ msgid "" "``%prog`` is expanded the same as for ``usage``." msgstr "" -#: ../../library/optparse.rst:834 +#: ../../library/optparse.rst:945 msgid "``conflict_handler`` (default: ``\"error\"``)" msgstr "" -#: ../../library/optparse.rst:835 +#: ../../library/optparse.rst:946 msgid "" "Specifies what to do when options with conflicting option strings are added " "to the parser; see section :ref:`optparse-conflicts-between-options`." msgstr "" -#: ../../library/optparse.rst:839 +#: ../../library/optparse.rst:950 msgid "``description`` (default: ``None``)" msgstr "" -#: ../../library/optparse.rst:840 +#: ../../library/optparse.rst:951 msgid "" "A paragraph of text giving a brief overview of your program. :mod:`optparse` " "reformats this paragraph to fit the current terminal width and prints it " @@ -1298,74 +1664,74 @@ msgid "" "options)." msgstr "" -#: ../../library/optparse.rst:845 +#: ../../library/optparse.rst:956 msgid "``formatter`` (default: a new :class:`IndentedHelpFormatter`)" msgstr "" -#: ../../library/optparse.rst:846 +#: ../../library/optparse.rst:957 msgid "" "An instance of optparse.HelpFormatter that will be used for printing help " "text. :mod:`optparse` provides two concrete classes for this purpose: " "IndentedHelpFormatter and TitledHelpFormatter." msgstr "" -#: ../../library/optparse.rst:850 +#: ../../library/optparse.rst:961 msgid "``add_help_option`` (default: ``True``)" msgstr "" -#: ../../library/optparse.rst:851 +#: ../../library/optparse.rst:962 msgid "" "If true, :mod:`optparse` will add a help option (with option strings ``-h`` " "and ``--help``) to the parser." msgstr "" -#: ../../library/optparse.rst:854 +#: ../../library/optparse.rst:965 msgid "``prog``" msgstr "``prog``" -#: ../../library/optparse.rst:855 +#: ../../library/optparse.rst:966 msgid "" "The string to use when expanding ``%prog`` in ``usage`` and ``version`` " "instead of ``os.path.basename(sys.argv[0])``." msgstr "" -#: ../../library/optparse.rst:858 +#: ../../library/optparse.rst:969 msgid "``epilog`` (default: ``None``)" msgstr "" -#: ../../library/optparse.rst:859 +#: ../../library/optparse.rst:970 msgid "A paragraph of help text to print after the option help." msgstr "" -#: ../../library/optparse.rst:864 +#: ../../library/optparse.rst:975 msgid "Populating the parser" msgstr "" -#: ../../library/optparse.rst:866 +#: ../../library/optparse.rst:977 msgid "" "There are several ways to populate the parser with options. The preferred " "way is by using :meth:`OptionParser.add_option`, as shown in section :ref:" "`optparse-tutorial`. :meth:`add_option` can be called in one of two ways:" msgstr "" -#: ../../library/optparse.rst:870 +#: ../../library/optparse.rst:981 msgid "pass it an Option instance (as returned by :func:`make_option`)" msgstr "" -#: ../../library/optparse.rst:872 +#: ../../library/optparse.rst:983 msgid "" "pass it any combination of positional and keyword arguments that are " "acceptable to :func:`make_option` (i.e., to the Option constructor), and it " "will create the Option instance for you" msgstr "" -#: ../../library/optparse.rst:876 +#: ../../library/optparse.rst:987 msgid "" "The other alternative is to pass a list of pre-constructed Option instances " "to the OptionParser constructor, as in::" msgstr "" -#: ../../library/optparse.rst:879 +#: ../../library/optparse.rst:990 msgid "" "option_list = [\n" " make_option(\"-f\", \"--filename\",\n" @@ -1375,8 +1741,15 @@ msgid "" " ]\n" "parser = OptionParser(option_list=option_list)" msgstr "" +"option_list = [\n" +" make_option(\"-f\", \"--filename\",\n" +" action=\"store\", type=\"string\", dest=\"filename\"),\n" +" make_option(\"-q\", \"--quiet\",\n" +" action=\"store_false\", dest=\"verbose\"),\n" +" ]\n" +"parser = OptionParser(option_list=option_list)" -#: ../../library/optparse.rst:887 +#: ../../library/optparse.rst:998 msgid "" "(:func:`make_option` is a factory function for creating Option instances; " "currently it is an alias for the Option constructor. A future version of :" @@ -1385,40 +1758,40 @@ msgid "" "Option directly.)" msgstr "" -#: ../../library/optparse.rst:896 +#: ../../library/optparse.rst:1007 msgid "Defining options" -msgstr "" +msgstr "定義選項" -#: ../../library/optparse.rst:898 +#: ../../library/optparse.rst:1009 msgid "" "Each Option instance represents a set of synonymous command-line option " "strings, e.g. ``-f`` and ``--file``. You can specify any number of short or " "long option strings, but you must specify at least one overall option string." msgstr "" -#: ../../library/optparse.rst:902 +#: ../../library/optparse.rst:1013 msgid "" "The canonical way to create an :class:`Option` instance is with the :meth:" "`add_option` method of :class:`OptionParser`." msgstr "" -#: ../../library/optparse.rst:908 +#: ../../library/optparse.rst:1019 msgid "To define an option with only a short option string::" msgstr "" -#: ../../library/optparse.rst:910 +#: ../../library/optparse.rst:1021 msgid "parser.add_option(\"-f\", attr=value, ...)" -msgstr "" +msgstr "parser.add_option(\"-f\", attr=value, ...)" -#: ../../library/optparse.rst:912 +#: ../../library/optparse.rst:1023 msgid "And to define an option with only a long option string::" msgstr "" -#: ../../library/optparse.rst:914 +#: ../../library/optparse.rst:1025 msgid "parser.add_option(\"--foo\", attr=value, ...)" -msgstr "" +msgstr "parser.add_option(\"--foo\", attr=value, ...)" -#: ../../library/optparse.rst:916 +#: ../../library/optparse.rst:1027 msgid "" "The keyword arguments define attributes of the new Option object. The most " "important option attribute is :attr:`~Option.action`, and it largely " @@ -1427,69 +1800,69 @@ msgid "" "raises an :exc:`OptionError` exception explaining your mistake." msgstr "" -#: ../../library/optparse.rst:922 +#: ../../library/optparse.rst:1033 msgid "" "An option's *action* determines what :mod:`optparse` does when it encounters " "this option on the command-line. The standard option actions hard-coded " "into :mod:`optparse` are:" msgstr "" -#: ../../library/optparse.rst:926 +#: ../../library/optparse.rst:1037 msgid "``\"store\"``" msgstr "``\"store\"``" -#: ../../library/optparse.rst:927 +#: ../../library/optparse.rst:1038 msgid "store this option's argument (default)" msgstr "" -#: ../../library/optparse.rst:932 +#: ../../library/optparse.rst:1043 msgid "``\"store_true\"``" msgstr "``\"store_true\"``" -#: ../../library/optparse.rst:933 +#: ../../library/optparse.rst:1044 msgid "store ``True``" msgstr "" -#: ../../library/optparse.rst:935 +#: ../../library/optparse.rst:1046 msgid "``\"store_false\"``" msgstr "``\"store_false\"``" -#: ../../library/optparse.rst:936 +#: ../../library/optparse.rst:1047 msgid "store ``False``" msgstr "" -#: ../../library/optparse.rst:941 +#: ../../library/optparse.rst:1052 msgid "``\"append_const\"``" msgstr "``\"append_const\"``" -#: ../../library/optparse.rst:942 +#: ../../library/optparse.rst:1053 msgid "append a constant value to a list, pre-set via :attr:`Option.const`" msgstr "" -#: ../../library/optparse.rst:950 ../../library/optparse.rst:1245 +#: ../../library/optparse.rst:1061 ../../library/optparse.rst:1356 msgid "``\"help\"``" msgstr "``\"help\"``" -#: ../../library/optparse.rst:951 +#: ../../library/optparse.rst:1062 msgid "" "print a usage message including all options and the documentation for them" msgstr "" -#: ../../library/optparse.rst:953 +#: ../../library/optparse.rst:1064 msgid "" "(If you don't supply an action, the default is ``\"store\"``. For this " "action, you may also supply :attr:`~Option.type` and :attr:`~Option.dest` " "option attributes; see :ref:`optparse-standard-option-actions`.)" msgstr "" -#: ../../library/optparse.rst:957 +#: ../../library/optparse.rst:1068 msgid "" "As you can see, most actions involve storing or updating a value somewhere. :" "mod:`optparse` always creates a special object for this, conventionally " "called ``options``, which is an instance of :class:`optparse.Values`." msgstr "" -#: ../../library/optparse.rst:963 +#: ../../library/optparse.rst:1074 msgid "" "An object holding parsed argument names and values as attributes. Normally " "created by calling when calling :meth:`OptionParser.parse_args`, and can be " @@ -1498,35 +1871,35 @@ msgid "" "arguments`)." msgstr "" -#: ../../library/optparse.rst:968 +#: ../../library/optparse.rst:1079 msgid "" "Option arguments (and various other values) are stored as attributes of this " "object, according to the :attr:`~Option.dest` (destination) option attribute." msgstr "" -#: ../../library/optparse.rst:972 +#: ../../library/optparse.rst:1083 msgid "For example, when you call ::" msgstr "例如說,當你呼叫: ::" -#: ../../library/optparse.rst:974 +#: ../../library/optparse.rst:1085 msgid "parser.parse_args()" msgstr "parser.parse_args()" -#: ../../library/optparse.rst:976 +#: ../../library/optparse.rst:1087 msgid "" "one of the first things :mod:`optparse` does is create the ``options`` " "object::" msgstr "" -#: ../../library/optparse.rst:978 +#: ../../library/optparse.rst:1089 msgid "options = Values()" msgstr "options = Values()" -#: ../../library/optparse.rst:980 +#: ../../library/optparse.rst:1091 msgid "If one of the options in this parser is defined with ::" msgstr "" -#: ../../library/optparse.rst:982 +#: ../../library/optparse.rst:1093 msgid "" "parser.add_option(\"-f\", \"--file\", action=\"store\", type=\"string\", " "dest=\"filename\")" @@ -1534,11 +1907,11 @@ msgstr "" "parser.add_option(\"-f\", \"--file\", action=\"store\", type=\"string\", " "dest=\"filename\")" -#: ../../library/optparse.rst:984 +#: ../../library/optparse.rst:1095 msgid "and the command-line being parsed includes any of the following::" msgstr "" -#: ../../library/optparse.rst:986 +#: ../../library/optparse.rst:1097 msgid "" "-ffoo\n" "-f foo\n" @@ -1550,27 +1923,27 @@ msgstr "" "--file=foo\n" "--file foo" -#: ../../library/optparse.rst:991 +#: ../../library/optparse.rst:1102 msgid "" "then :mod:`optparse`, on seeing this option, will do the equivalent of ::" msgstr "" -#: ../../library/optparse.rst:993 +#: ../../library/optparse.rst:1104 msgid "options.filename = \"foo\"" msgstr "options.filename = \"foo\"" -#: ../../library/optparse.rst:995 +#: ../../library/optparse.rst:1106 msgid "" "The :attr:`~Option.type` and :attr:`~Option.dest` option attributes are " "almost as important as :attr:`~Option.action`, but :attr:`~Option.action` is " "the only one that makes sense for *all* options." msgstr "" -#: ../../library/optparse.rst:1003 +#: ../../library/optparse.rst:1114 msgid "Option attributes" -msgstr "" +msgstr "選項屬性" -#: ../../library/optparse.rst:1007 +#: ../../library/optparse.rst:1118 msgid "" "A single command line argument, with various attributes passed by keyword to " "the constructor. Normally created with :meth:`OptionParser.add_option` " @@ -1578,7 +1951,7 @@ msgid "" "*option_class* argument to :class:`OptionParser`." msgstr "" -#: ../../library/optparse.rst:1013 +#: ../../library/optparse.rst:1124 msgid "" "The following option attributes may be passed as keyword arguments to :meth:" "`OptionParser.add_option`. If you pass an option attribute that is not " @@ -1586,33 +1959,33 @@ msgid "" "attribute, :mod:`optparse` raises :exc:`OptionError`." msgstr "" -#: ../../library/optparse.rst:1020 +#: ../../library/optparse.rst:1131 msgid "(default: ``\"store\"``)" msgstr "(預設值: ``\"store\"`` )" -#: ../../library/optparse.rst:1022 +#: ../../library/optparse.rst:1133 msgid "" "Determines :mod:`optparse`'s behaviour when this option is seen on the " "command line; the available options are documented :ref:`here <optparse-" "standard-option-actions>`." msgstr "" -#: ../../library/optparse.rst:1028 +#: ../../library/optparse.rst:1139 msgid "(default: ``\"string\"``)" msgstr "(預設值: ``\"string\"`` )" -#: ../../library/optparse.rst:1030 +#: ../../library/optparse.rst:1141 msgid "" "The argument type expected by this option (e.g., ``\"string\"`` or " "``\"int\"``); the available option types are documented :ref:`here <optparse-" "standard-option-types>`." msgstr "" -#: ../../library/optparse.rst:1036 ../../library/optparse.rst:1086 +#: ../../library/optparse.rst:1147 ../../library/optparse.rst:1197 msgid "(default: derived from option strings)" msgstr "" -#: ../../library/optparse.rst:1038 +#: ../../library/optparse.rst:1149 msgid "" "If the option's action implies writing or modifying a value somewhere, this " "tells :mod:`optparse` where to write it: :attr:`~Option.dest` names an " @@ -1620,47 +1993,47 @@ msgid "" "the command line." msgstr "" -#: ../../library/optparse.rst:1045 +#: ../../library/optparse.rst:1156 msgid "" "The value to use for this option's destination if the option is not seen on " "the command line. See also :meth:`OptionParser.set_defaults`." msgstr "" -#: ../../library/optparse.rst:1050 +#: ../../library/optparse.rst:1161 msgid "(default: 1)" msgstr "(預設值:1)" -#: ../../library/optparse.rst:1052 +#: ../../library/optparse.rst:1163 msgid "" "How many arguments of type :attr:`~Option.type` should be consumed when this " "option is seen. If > 1, :mod:`optparse` will store a tuple of values to :" "attr:`~Option.dest`." msgstr "" -#: ../../library/optparse.rst:1058 +#: ../../library/optparse.rst:1169 msgid "For actions that store a constant value, the constant value to store." msgstr "" -#: ../../library/optparse.rst:1062 +#: ../../library/optparse.rst:1173 msgid "" "For options of type ``\"choice\"``, the list of strings the user may choose " "from." msgstr "" -#: ../../library/optparse.rst:1067 +#: ../../library/optparse.rst:1178 msgid "" "For options with action ``\"callback\"``, the callable to call when this " "option is seen. See section :ref:`optparse-option-callbacks` for detail on " "the arguments passed to the callable." msgstr "" -#: ../../library/optparse.rst:1074 +#: ../../library/optparse.rst:1185 msgid "" "Additional positional and keyword arguments to pass to ``callback`` after " "the four standard callback arguments." msgstr "" -#: ../../library/optparse.rst:1079 +#: ../../library/optparse.rst:1190 msgid "" "Help text to print for this option when listing all available options after " "the user supplies a :attr:`~Option.help` option (such as ``--help``). If no " @@ -1668,17 +2041,17 @@ msgid "" "this option, use the special value :const:`optparse.SUPPRESS_HELP`." msgstr "" -#: ../../library/optparse.rst:1088 +#: ../../library/optparse.rst:1199 msgid "" "Stand-in for the option argument(s) to use when printing help text. See " "section :ref:`optparse-tutorial` for an example." msgstr "" -#: ../../library/optparse.rst:1095 +#: ../../library/optparse.rst:1206 msgid "Standard option actions" msgstr "" -#: ../../library/optparse.rst:1097 +#: ../../library/optparse.rst:1208 msgid "" "The various option actions all have slightly different requirements and " "effects. Most actions have several relevant option attributes which you may " @@ -1686,13 +2059,13 @@ msgid "" "attributes, which you must specify for any option using that action." msgstr "" -#: ../../library/optparse.rst:1102 +#: ../../library/optparse.rst:1213 msgid "" "``\"store\"`` [relevant: :attr:`~Option.type`, :attr:`~Option.dest`, :attr:" "`~Option.nargs`, :attr:`~Option.choices`]" msgstr "" -#: ../../library/optparse.rst:1105 +#: ../../library/optparse.rst:1216 msgid "" "The option must be followed by an argument, which is converted to a value " "according to :attr:`~Option.type` and stored in :attr:`~Option.dest`. If :" @@ -1702,17 +2075,17 @@ msgid "" "option-types` section." msgstr "" -#: ../../library/optparse.rst:1112 +#: ../../library/optparse.rst:1223 msgid "" "If :attr:`~Option.choices` is supplied (a list or tuple of strings), the " "type defaults to ``\"choice\"``." msgstr "" -#: ../../library/optparse.rst:1115 +#: ../../library/optparse.rst:1226 msgid "If :attr:`~Option.type` is not supplied, it defaults to ``\"string\"``." msgstr "" -#: ../../library/optparse.rst:1117 +#: ../../library/optparse.rst:1228 msgid "" "If :attr:`~Option.dest` is not supplied, :mod:`optparse` derives a " "destination from the first long option string (e.g., ``--foo-bar`` implies " @@ -1720,13 +2093,13 @@ msgid "" "destination from the first short option string (e.g., ``-f`` implies ``f``)." msgstr "" -#: ../../library/optparse.rst:1122 ../../library/optparse.rst:1142 -#: ../../library/optparse.rst:1164 ../../library/optparse.rst:1182 -#: ../../library/optparse.rst:1221 ../../library/optparse.rst:1259 +#: ../../library/optparse.rst:1233 ../../library/optparse.rst:1253 +#: ../../library/optparse.rst:1275 ../../library/optparse.rst:1293 +#: ../../library/optparse.rst:1332 ../../library/optparse.rst:1370 msgid "Example::" msgstr "範例: ::" -#: ../../library/optparse.rst:1124 +#: ../../library/optparse.rst:1235 msgid "" "parser.add_option(\"-f\")\n" "parser.add_option(\"-p\", type=\"float\", nargs=3, dest=\"point\")" @@ -1734,19 +2107,19 @@ msgstr "" "parser.add_option(\"-f\")\n" "parser.add_option(\"-p\", type=\"float\", nargs=3, dest=\"point\")" -#: ../../library/optparse.rst:1127 +#: ../../library/optparse.rst:1238 msgid "As it parses the command line ::" msgstr "" -#: ../../library/optparse.rst:1129 +#: ../../library/optparse.rst:1240 msgid "-f foo.txt -p 1 -3.5 4 -fbar.txt" msgstr "-f foo.txt -p 1 -3.5 4 -fbar.txt" -#: ../../library/optparse.rst:1131 +#: ../../library/optparse.rst:1242 msgid ":mod:`optparse` will set ::" msgstr "" -#: ../../library/optparse.rst:1133 +#: ../../library/optparse.rst:1244 msgid "" "options.f = \"foo.txt\"\n" "options.point = (1.0, -3.5, 4.0)\n" @@ -1756,17 +2129,17 @@ msgstr "" "options.point = (1.0, -3.5, 4.0)\n" "options.f = \"bar.txt\"" -#: ../../library/optparse.rst:1137 +#: ../../library/optparse.rst:1248 msgid "" "``\"store_const\"`` [required: :attr:`~Option.const`; relevant: :attr:" "`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1140 +#: ../../library/optparse.rst:1251 msgid "The value :attr:`~Option.const` is stored in :attr:`~Option.dest`." msgstr "" -#: ../../library/optparse.rst:1144 +#: ../../library/optparse.rst:1255 msgid "" "parser.add_option(\"-q\", \"--quiet\",\n" " action=\"store_const\", const=0, dest=\"verbose\")\n" @@ -1782,33 +2155,33 @@ msgstr "" "parser.add_option(\"--noisy\",\n" " action=\"store_const\", const=2, dest=\"verbose\")" -#: ../../library/optparse.rst:1151 +#: ../../library/optparse.rst:1262 msgid "If ``--noisy`` is seen, :mod:`optparse` will set ::" msgstr "" -#: ../../library/optparse.rst:1153 +#: ../../library/optparse.rst:1264 msgid "options.verbose = 2" msgstr "options.verbose = 2" -#: ../../library/optparse.rst:1155 +#: ../../library/optparse.rst:1266 msgid "``\"store_true\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1157 +#: ../../library/optparse.rst:1268 msgid "" "A special case of ``\"store_const\"`` that stores ``True`` to :attr:`~Option." "dest`." msgstr "" -#: ../../library/optparse.rst:1160 +#: ../../library/optparse.rst:1271 msgid "``\"store_false\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1162 +#: ../../library/optparse.rst:1273 msgid "Like ``\"store_true\"``, but stores ``False``." msgstr "" -#: ../../library/optparse.rst:1166 +#: ../../library/optparse.rst:1277 msgid "" "parser.add_option(\"--clobber\", action=\"store_true\", dest=\"clobber\")\n" "parser.add_option(\"--no-clobber\", action=\"store_false\", dest=\"clobber\")" @@ -1816,13 +2189,13 @@ msgstr "" "parser.add_option(\"--clobber\", action=\"store_true\", dest=\"clobber\")\n" "parser.add_option(\"--no-clobber\", action=\"store_false\", dest=\"clobber\")" -#: ../../library/optparse.rst:1169 +#: ../../library/optparse.rst:1280 msgid "" "``\"append\"`` [relevant: :attr:`~Option.type`, :attr:`~Option.dest`, :attr:" "`~Option.nargs`, :attr:`~Option.choices`]" msgstr "" -#: ../../library/optparse.rst:1172 +#: ../../library/optparse.rst:1283 msgid "" "The option must be followed by an argument, which is appended to the list " "in :attr:`~Option.dest`. If no default value for :attr:`~Option.dest` is " @@ -1832,25 +2205,25 @@ msgid "" "is appended to :attr:`~Option.dest`." msgstr "" -#: ../../library/optparse.rst:1179 +#: ../../library/optparse.rst:1290 msgid "" "The defaults for :attr:`~Option.type` and :attr:`~Option.dest` are the same " "as for the ``\"store\"`` action." msgstr "" -#: ../../library/optparse.rst:1184 +#: ../../library/optparse.rst:1295 msgid "" "parser.add_option(\"-t\", \"--tracks\", action=\"append\", type=\"int\")" msgstr "" "parser.add_option(\"-t\", \"--tracks\", action=\"append\", type=\"int\")" -#: ../../library/optparse.rst:1186 +#: ../../library/optparse.rst:1297 msgid "" "If ``-t3`` is seen on the command-line, :mod:`optparse` does the equivalent " "of::" msgstr "" -#: ../../library/optparse.rst:1189 +#: ../../library/optparse.rst:1300 msgid "" "options.tracks = []\n" "options.tracks.append(int(\"3\"))" @@ -1858,15 +2231,15 @@ msgstr "" "options.tracks = []\n" "options.tracks.append(int(\"3\"))" -#: ../../library/optparse.rst:1192 +#: ../../library/optparse.rst:1303 msgid "If, a little later on, ``--tracks=4`` is seen, it does::" msgstr "" -#: ../../library/optparse.rst:1194 +#: ../../library/optparse.rst:1305 msgid "options.tracks.append(int(\"4\"))" msgstr "options.tracks.append(int(\"4\"))" -#: ../../library/optparse.rst:1196 +#: ../../library/optparse.rst:1307 msgid "" "The ``append`` action calls the ``append`` method on the current value of " "the option. This means that any default value specified must have an " @@ -1875,7 +2248,7 @@ msgid "" "with any values from the command line appended after those default values::" msgstr "" -#: ../../library/optparse.rst:1202 +#: ../../library/optparse.rst:1313 msgid "" ">>> parser.add_option(\"--files\", action=\"append\", default=['~/.mypkg/" "defaults'])\n" @@ -1889,13 +2262,13 @@ msgstr "" ">>> opts.files\n" "['~/.mypkg/defaults', 'overrides.mypkg']" -#: ../../library/optparse.rst:1207 +#: ../../library/optparse.rst:1318 msgid "" "``\"append_const\"`` [required: :attr:`~Option.const`; relevant: :attr:" "`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1210 +#: ../../library/optparse.rst:1321 msgid "" "Like ``\"store_const\"``, but the value :attr:`~Option.const` is appended " "to :attr:`~Option.dest`; as with ``\"append\"``, :attr:`~Option.dest` " @@ -1903,28 +2276,28 @@ msgid "" "time the option is encountered." msgstr "" -#: ../../library/optparse.rst:1215 +#: ../../library/optparse.rst:1326 msgid "``\"count\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1217 +#: ../../library/optparse.rst:1328 msgid "" "Increment the integer stored at :attr:`~Option.dest`. If no default value " "is supplied, :attr:`~Option.dest` is set to zero before being incremented " "the first time." msgstr "" -#: ../../library/optparse.rst:1223 +#: ../../library/optparse.rst:1334 msgid "parser.add_option(\"-v\", action=\"count\", dest=\"verbosity\")" msgstr "parser.add_option(\"-v\", action=\"count\", dest=\"verbosity\")" -#: ../../library/optparse.rst:1225 +#: ../../library/optparse.rst:1336 msgid "" "The first time ``-v`` is seen on the command line, :mod:`optparse` does the " "equivalent of::" msgstr "" -#: ../../library/optparse.rst:1228 +#: ../../library/optparse.rst:1339 msgid "" "options.verbosity = 0\n" "options.verbosity += 1" @@ -1932,36 +2305,36 @@ msgstr "" "options.verbosity = 0\n" "options.verbosity += 1" -#: ../../library/optparse.rst:1231 +#: ../../library/optparse.rst:1342 msgid "Every subsequent occurrence of ``-v`` results in ::" msgstr "" -#: ../../library/optparse.rst:1233 +#: ../../library/optparse.rst:1344 msgid "options.verbosity += 1" msgstr "options.verbosity += 1" -#: ../../library/optparse.rst:1235 +#: ../../library/optparse.rst:1346 msgid "" "``\"callback\"`` [required: :attr:`~Option.callback`; relevant: :attr:" "`~Option.type`, :attr:`~Option.nargs`, :attr:`~Option.callback_args`, :attr:" "`~Option.callback_kwargs`]" msgstr "" -#: ../../library/optparse.rst:1239 +#: ../../library/optparse.rst:1350 msgid "" "Call the function specified by :attr:`~Option.callback`, which is called " "as ::" msgstr "" -#: ../../library/optparse.rst:1241 ../../library/optparse.rst:1639 +#: ../../library/optparse.rst:1352 ../../library/optparse.rst:1750 msgid "func(option, opt_str, value, parser, *args, **kwargs)" msgstr "func(option, opt_str, value, parser, *args, **kwargs)" -#: ../../library/optparse.rst:1243 +#: ../../library/optparse.rst:1354 msgid "See section :ref:`optparse-option-callbacks` for more detail." msgstr "更多細節請見 :ref:`optparse-option-callbacks`。" -#: ../../library/optparse.rst:1247 +#: ../../library/optparse.rst:1358 msgid "" "Prints a complete help message for all the options in the current option " "parser. The help message is constructed from the ``usage`` string passed to " @@ -1969,20 +2342,20 @@ msgid "" "every option." msgstr "" -#: ../../library/optparse.rst:1252 +#: ../../library/optparse.rst:1363 msgid "" "If no :attr:`~Option.help` string is supplied for an option, it will still " "be listed in the help message. To omit an option entirely, use the special " "value :const:`optparse.SUPPRESS_HELP`." msgstr "" -#: ../../library/optparse.rst:1256 +#: ../../library/optparse.rst:1367 msgid "" ":mod:`optparse` automatically adds a :attr:`~Option.help` option to all " "OptionParsers, so you do not normally need to create one." msgstr "" -#: ../../library/optparse.rst:1261 +#: ../../library/optparse.rst:1372 msgid "" "from optparse import OptionParser, SUPPRESS_HELP\n" "\n" @@ -1998,14 +2371,14 @@ msgid "" "parser.add_option(\"--secret\", help=SUPPRESS_HELP)" msgstr "" -#: ../../library/optparse.rst:1274 +#: ../../library/optparse.rst:1385 msgid "" "If :mod:`optparse` sees either ``-h`` or ``--help`` on the command line, it " "will print something like the following help message to stdout (assuming " "``sys.argv[0]`` is ``\"foo.py\"``):" msgstr "" -#: ../../library/optparse.rst:1278 +#: ../../library/optparse.rst:1389 msgid "" "Usage: foo.py [options]\n" "\n" @@ -2021,17 +2394,17 @@ msgstr "" " -v Be moderately verbose\n" " --file=FILENAME Input file to read data from" -#: ../../library/optparse.rst:1287 +#: ../../library/optparse.rst:1398 msgid "" "After printing the help message, :mod:`optparse` terminates your process " "with ``sys.exit(0)``." msgstr "" -#: ../../library/optparse.rst:1290 +#: ../../library/optparse.rst:1401 msgid "``\"version\"``" msgstr "``\"version\"``" -#: ../../library/optparse.rst:1292 +#: ../../library/optparse.rst:1403 msgid "" "Prints the version number supplied to the OptionParser to stdout and exits. " "The version number is actually formatted and printed by the " @@ -2041,58 +2414,58 @@ msgid "" "since :mod:`optparse` automatically adds them when needed." msgstr "" -#: ../../library/optparse.rst:1303 +#: ../../library/optparse.rst:1414 msgid "Standard option types" msgstr "" -#: ../../library/optparse.rst:1305 +#: ../../library/optparse.rst:1416 msgid "" ":mod:`optparse` has five built-in option types: ``\"string\"``, ``\"int\"``, " "``\"choice\"``, ``\"float\"`` and ``\"complex\"``. If you need to add new " "option types, see section :ref:`optparse-extending-optparse`." msgstr "" -#: ../../library/optparse.rst:1309 +#: ../../library/optparse.rst:1420 msgid "" "Arguments to string options are not checked or converted in any way: the " "text on the command line is stored in the destination (or passed to the " "callback) as-is." msgstr "" -#: ../../library/optparse.rst:1312 +#: ../../library/optparse.rst:1423 msgid "Integer arguments (type ``\"int\"``) are parsed as follows:" msgstr "" -#: ../../library/optparse.rst:1314 +#: ../../library/optparse.rst:1425 msgid "if the number starts with ``0x``, it is parsed as a hexadecimal number" msgstr "" -#: ../../library/optparse.rst:1316 +#: ../../library/optparse.rst:1427 msgid "if the number starts with ``0``, it is parsed as an octal number" msgstr "" -#: ../../library/optparse.rst:1318 +#: ../../library/optparse.rst:1429 msgid "if the number starts with ``0b``, it is parsed as a binary number" msgstr "" -#: ../../library/optparse.rst:1320 +#: ../../library/optparse.rst:1431 msgid "otherwise, the number is parsed as a decimal number" msgstr "" -#: ../../library/optparse.rst:1323 +#: ../../library/optparse.rst:1434 msgid "" "The conversion is done by calling :func:`int` with the appropriate base (2, " "8, 10, or 16). If this fails, so will :mod:`optparse`, although with a more " "useful error message." msgstr "" -#: ../../library/optparse.rst:1327 +#: ../../library/optparse.rst:1438 msgid "" "``\"float\"`` and ``\"complex\"`` option arguments are converted directly " "with :func:`float` and :func:`complex`, with similar error-handling." msgstr "" -#: ../../library/optparse.rst:1330 +#: ../../library/optparse.rst:1441 msgid "" "``\"choice\"`` options are a subtype of ``\"string\"`` options. The :attr:" "`~Option.choices` option attribute (a sequence of strings) defines the set " @@ -2101,63 +2474,63 @@ msgid "" "`OptionValueError` if an invalid string is given." msgstr "" -#: ../../library/optparse.rst:1340 +#: ../../library/optparse.rst:1451 msgid "Parsing arguments" msgstr "剖析引數" -#: ../../library/optparse.rst:1342 +#: ../../library/optparse.rst:1453 msgid "" "The whole point of creating and populating an OptionParser is to call its :" "meth:`~OptionParser.parse_args` method." msgstr "" -#: ../../library/optparse.rst:1347 +#: ../../library/optparse.rst:1458 msgid "Parse the command-line options found in *args*." msgstr "" -#: ../../library/optparse.rst:1349 +#: ../../library/optparse.rst:1460 msgid "The input parameters are" msgstr "" -#: ../../library/optparse.rst:1351 ../../library/optparse.rst:1365 -#: ../../library/optparse.rst:1683 +#: ../../library/optparse.rst:1462 ../../library/optparse.rst:1476 +#: ../../library/optparse.rst:1794 msgid "``args``" msgstr "``args``" -#: ../../library/optparse.rst:1352 +#: ../../library/optparse.rst:1463 msgid "the list of arguments to process (default: ``sys.argv[1:]``)" msgstr "" -#: ../../library/optparse.rst:1354 +#: ../../library/optparse.rst:1465 msgid "``values``" msgstr "``values``" -#: ../../library/optparse.rst:1355 +#: ../../library/optparse.rst:1466 msgid "" "a :class:`Values` object to store option arguments in (default: a new " "instance of :class:`Values`) -- if you give an existing object, the option " "defaults will not be initialized on it" msgstr "" -#: ../../library/optparse.rst:1359 +#: ../../library/optparse.rst:1470 msgid "and the return value is a pair ``(options, args)`` where" msgstr "" -#: ../../library/optparse.rst:1361 +#: ../../library/optparse.rst:1472 msgid "``options``" msgstr "``options``" -#: ../../library/optparse.rst:1362 +#: ../../library/optparse.rst:1473 msgid "" "the same object that was passed in as *values*, or the ``optparse.Values`` " "instance created by :mod:`optparse`" msgstr "" -#: ../../library/optparse.rst:1366 +#: ../../library/optparse.rst:1477 msgid "the leftover positional arguments after all options have been processed" msgstr "" -#: ../../library/optparse.rst:1368 +#: ../../library/optparse.rst:1479 msgid "" "The most common usage is to supply neither keyword argument. If you supply " "``values``, it will be modified with repeated :func:`setattr` calls (roughly " @@ -2165,7 +2538,7 @@ msgid "" "by :meth:`~OptionParser.parse_args`." msgstr "" -#: ../../library/optparse.rst:1373 +#: ../../library/optparse.rst:1484 msgid "" "If :meth:`~OptionParser.parse_args` encounters any errors in the argument " "list, it calls the OptionParser's :meth:`error` method with an appropriate " @@ -2173,69 +2546,69 @@ msgid "" "status of 2 (the traditional Unix exit status for command-line errors)." msgstr "" -#: ../../library/optparse.rst:1382 +#: ../../library/optparse.rst:1493 msgid "Querying and manipulating your option parser" msgstr "" -#: ../../library/optparse.rst:1384 +#: ../../library/optparse.rst:1495 msgid "" "The default behavior of the option parser can be customized slightly, and " "you can also poke around your option parser and see what's there. " "OptionParser provides several methods to help you out:" msgstr "" -#: ../../library/optparse.rst:1390 +#: ../../library/optparse.rst:1501 msgid "" "Set parsing to stop on the first non-option. For example, if ``-a`` and ``-" "b`` are both simple options that take no arguments, :mod:`optparse` normally " "accepts this syntax::" msgstr "" -#: ../../library/optparse.rst:1394 +#: ../../library/optparse.rst:1505 msgid "prog -a arg1 -b arg2" msgstr "prog -a arg1 -b arg2" -#: ../../library/optparse.rst:1396 +#: ../../library/optparse.rst:1507 msgid "and treats it as equivalent to ::" msgstr "" -#: ../../library/optparse.rst:1398 +#: ../../library/optparse.rst:1509 msgid "prog -a -b arg1 arg2" msgstr "prog -a -b arg1 arg2" -#: ../../library/optparse.rst:1400 +#: ../../library/optparse.rst:1511 msgid "" "To disable this feature, call :meth:`disable_interspersed_args`. This " "restores traditional Unix syntax, where option parsing stops with the first " "non-option argument." msgstr "" -#: ../../library/optparse.rst:1404 +#: ../../library/optparse.rst:1515 msgid "" "Use this if you have a command processor which runs another command which " "has options of its own and you want to make sure these options don't get " "confused. For example, each command might have a different set of options." msgstr "" -#: ../../library/optparse.rst:1410 +#: ../../library/optparse.rst:1521 msgid "" "Set parsing to not stop on the first non-option, allowing interspersing " "switches with command arguments. This is the default behavior." msgstr "" -#: ../../library/optparse.rst:1415 +#: ../../library/optparse.rst:1526 msgid "" "Returns the Option instance with the option string *opt_str*, or ``None`` if " "no options have that option string." msgstr "" -#: ../../library/optparse.rst:1420 +#: ../../library/optparse.rst:1531 msgid "" "Return ``True`` if the OptionParser has an option with option string " "*opt_str* (e.g., ``-q`` or ``--verbose``)." msgstr "" -#: ../../library/optparse.rst:1425 +#: ../../library/optparse.rst:1536 msgid "" "If the :class:`OptionParser` has an option corresponding to *opt_str*, that " "option is removed. If that option provided any other option strings, all of " @@ -2243,17 +2616,17 @@ msgid "" "option belonging to this :class:`OptionParser`, raises :exc:`ValueError`." msgstr "" -#: ../../library/optparse.rst:1434 +#: ../../library/optparse.rst:1545 msgid "Conflicts between options" msgstr "" -#: ../../library/optparse.rst:1436 +#: ../../library/optparse.rst:1547 msgid "" "If you're not careful, it's easy to define options with conflicting option " "strings::" msgstr "" -#: ../../library/optparse.rst:1439 +#: ../../library/optparse.rst:1550 msgid "" "parser.add_option(\"-n\", \"--dry-run\", ...)\n" "...\n" @@ -2263,13 +2636,13 @@ msgstr "" "...\n" "parser.add_option(\"-n\", \"--noisy\", ...)" -#: ../../library/optparse.rst:1443 +#: ../../library/optparse.rst:1554 msgid "" "(This is particularly true if you've defined your own OptionParser subclass " "with some standard options.)" msgstr "" -#: ../../library/optparse.rst:1446 +#: ../../library/optparse.rst:1557 msgid "" "Every time you add an option, :mod:`optparse` checks for conflicts with " "existing options. If it finds any, it invokes the current conflict-handling " @@ -2277,47 +2650,47 @@ msgid "" "constructor::" msgstr "" -#: ../../library/optparse.rst:1450 +#: ../../library/optparse.rst:1561 msgid "parser = OptionParser(..., conflict_handler=handler)" msgstr "parser = OptionParser(..., conflict_handler=handler)" -#: ../../library/optparse.rst:1452 +#: ../../library/optparse.rst:1563 msgid "or with a separate call::" msgstr "" -#: ../../library/optparse.rst:1454 +#: ../../library/optparse.rst:1565 msgid "parser.set_conflict_handler(handler)" msgstr "parser.set_conflict_handler(handler)" -#: ../../library/optparse.rst:1456 +#: ../../library/optparse.rst:1567 msgid "The available conflict handlers are:" msgstr "" -#: ../../library/optparse.rst:1458 +#: ../../library/optparse.rst:1569 msgid "``\"error\"`` (default)" msgstr "" -#: ../../library/optparse.rst:1459 +#: ../../library/optparse.rst:1570 msgid "" "assume option conflicts are a programming error and raise :exc:" "`OptionConflictError`" msgstr "" -#: ../../library/optparse.rst:1462 +#: ../../library/optparse.rst:1573 msgid "``\"resolve\"``" msgstr "``\"resolve\"``" -#: ../../library/optparse.rst:1463 +#: ../../library/optparse.rst:1574 msgid "resolve option conflicts intelligently (see below)" msgstr "" -#: ../../library/optparse.rst:1466 +#: ../../library/optparse.rst:1577 msgid "" "As an example, let's define an :class:`OptionParser` that resolves conflicts " "intelligently and add conflicting options to it::" msgstr "" -#: ../../library/optparse.rst:1469 +#: ../../library/optparse.rst:1580 msgid "" "parser = OptionParser(conflict_handler=\"resolve\")\n" "parser.add_option(\"-n\", \"--dry-run\", ..., help=\"do no harm\")\n" @@ -2327,7 +2700,7 @@ msgstr "" "parser.add_option(\"-n\", \"--dry-run\", ..., help=\"do no harm\")\n" "parser.add_option(\"-n\", \"--noisy\", ..., help=\"be noisy\")" -#: ../../library/optparse.rst:1473 +#: ../../library/optparse.rst:1584 msgid "" "At this point, :mod:`optparse` detects that a previously added option is " "already using the ``-n`` option string. Since ``conflict_handler`` is " @@ -2337,7 +2710,7 @@ msgid "" "message will reflect that::" msgstr "" -#: ../../library/optparse.rst:1479 +#: ../../library/optparse.rst:1590 msgid "" "Options:\n" " --dry-run do no harm\n" @@ -2345,7 +2718,7 @@ msgid "" " -n, --noisy be noisy" msgstr "" -#: ../../library/optparse.rst:1484 +#: ../../library/optparse.rst:1595 msgid "" "It's possible to whittle away the option strings for a previously added " "option until there are none left, and the user has no way of invoking that " @@ -2354,17 +2727,17 @@ msgid "" "Carrying on with our existing OptionParser::" msgstr "" -#: ../../library/optparse.rst:1490 +#: ../../library/optparse.rst:1601 msgid "parser.add_option(\"--dry-run\", ..., help=\"new dry-run option\")" msgstr "parser.add_option(\"--dry-run\", ..., help=\"new dry-run option\")" -#: ../../library/optparse.rst:1492 +#: ../../library/optparse.rst:1603 msgid "" "At this point, the original ``-n``/``--dry-run`` option is no longer " "accessible, so :mod:`optparse` removes it, leaving this help text::" msgstr "" -#: ../../library/optparse.rst:1495 +#: ../../library/optparse.rst:1606 msgid "" "Options:\n" " ...\n" @@ -2376,11 +2749,11 @@ msgstr "" " -n, --noisy be noisy\n" " --dry-run new dry-run option" -#: ../../library/optparse.rst:1504 +#: ../../library/optparse.rst:1615 msgid "Cleanup" msgstr "" -#: ../../library/optparse.rst:1506 +#: ../../library/optparse.rst:1617 msgid "" "OptionParser instances have several cyclic references. This should not be a " "problem for Python's garbage collector, but you may wish to break the cyclic " @@ -2390,15 +2763,15 @@ msgid "" "OptionParser." msgstr "" -#: ../../library/optparse.rst:1517 +#: ../../library/optparse.rst:1628 msgid "Other methods" msgstr "其他方法" -#: ../../library/optparse.rst:1519 +#: ../../library/optparse.rst:1630 msgid "OptionParser supports several other public methods:" msgstr "" -#: ../../library/optparse.rst:1523 +#: ../../library/optparse.rst:1634 msgid "" "Set the usage string according to the rules described above for the " "``usage`` constructor keyword argument. Passing ``None`` sets the default " @@ -2406,7 +2779,7 @@ msgid "" "message." msgstr "" -#: ../../library/optparse.rst:1529 +#: ../../library/optparse.rst:1640 msgid "" "Print the usage message for the current program (``self.usage``) to *file* " "(default stdout). Any occurrence of the string ``%prog`` in ``self.usage`` " @@ -2414,13 +2787,13 @@ msgid "" "usage`` is empty or not defined." msgstr "" -#: ../../library/optparse.rst:1536 +#: ../../library/optparse.rst:1647 msgid "" "Same as :meth:`print_usage` but returns the usage string instead of printing " "it." msgstr "" -#: ../../library/optparse.rst:1541 +#: ../../library/optparse.rst:1652 msgid "" "Set default values for several option destinations at once. Using :meth:" "`set_defaults` is the preferred way to set default values for options, since " @@ -2429,7 +2802,7 @@ msgid "" "default, and the last one wins::" msgstr "" -#: ../../library/optparse.rst:1547 +#: ../../library/optparse.rst:1658 msgid "" "parser.add_option(\"--advanced\", action=\"store_const\",\n" " dest=\"mode\", const=\"advanced\",\n" @@ -2439,11 +2812,11 @@ msgid "" " default=\"advanced\") # overrides above setting" msgstr "" -#: ../../library/optparse.rst:1554 +#: ../../library/optparse.rst:1665 msgid "To avoid this confusion, use :meth:`set_defaults`::" msgstr "" -#: ../../library/optparse.rst:1556 +#: ../../library/optparse.rst:1667 msgid "" "parser.set_defaults(mode=\"advanced\")\n" "parser.add_option(\"--advanced\", action=\"store_const\",\n" @@ -2457,11 +2830,11 @@ msgstr "" "parser.add_option(\"--novice\", action=\"store_const\",\n" " dest=\"mode\", const=\"novice\")" -#: ../../library/optparse.rst:1566 +#: ../../library/optparse.rst:1677 msgid "Option Callbacks" msgstr "" -#: ../../library/optparse.rst:1568 +#: ../../library/optparse.rst:1679 msgid "" "When :mod:`optparse`'s built-in actions and types aren't quite enough for " "your needs, you have two choices: extend :mod:`optparse` or define a " @@ -2469,25 +2842,25 @@ msgid "" "a lot of simple cases. Quite often a simple callback is all you need." msgstr "" -#: ../../library/optparse.rst:1573 +#: ../../library/optparse.rst:1684 msgid "There are two steps to defining a callback option:" msgstr "" -#: ../../library/optparse.rst:1575 +#: ../../library/optparse.rst:1686 msgid "define the option itself using the ``\"callback\"`` action" msgstr "" -#: ../../library/optparse.rst:1577 +#: ../../library/optparse.rst:1688 msgid "" "write the callback; this is a function (or method) that takes at least four " "arguments, as described below" msgstr "" -#: ../../library/optparse.rst:1584 +#: ../../library/optparse.rst:1695 msgid "Defining a callback option" msgstr "" -#: ../../library/optparse.rst:1586 +#: ../../library/optparse.rst:1697 msgid "" "As always, the easiest way to define a callback option is by using the :meth:" "`OptionParser.add_option` method. Apart from :attr:`~Option.action`, the " @@ -2495,11 +2868,11 @@ msgid "" "call::" msgstr "" -#: ../../library/optparse.rst:1590 +#: ../../library/optparse.rst:1701 msgid "parser.add_option(\"-c\", action=\"callback\", callback=my_callback)" msgstr "parser.add_option(\"-c\", action=\"callback\", callback=my_callback)" -#: ../../library/optparse.rst:1592 +#: ../../library/optparse.rst:1703 msgid "" "``callback`` is a function (or other callable object), so you must have " "already defined ``my_callback()`` when you create this callback option. In " @@ -2511,7 +2884,7 @@ msgid "" "tricky; it's covered later in this section." msgstr "" -#: ../../library/optparse.rst:1601 +#: ../../library/optparse.rst:1712 msgid "" ":mod:`optparse` always passes four particular arguments to your callback, " "and it will only pass additional arguments if you specify them via :attr:" @@ -2519,25 +2892,25 @@ msgid "" "minimal callback function signature is::" msgstr "" -#: ../../library/optparse.rst:1606 +#: ../../library/optparse.rst:1717 msgid "def my_callback(option, opt, value, parser):" msgstr "def my_callback(option, opt, value, parser):" -#: ../../library/optparse.rst:1608 +#: ../../library/optparse.rst:1719 msgid "The four arguments to a callback are described below." msgstr "" -#: ../../library/optparse.rst:1610 +#: ../../library/optparse.rst:1721 msgid "" "There are several other option attributes that you can supply when you " "define a callback option:" msgstr "" -#: ../../library/optparse.rst:1613 +#: ../../library/optparse.rst:1724 msgid ":attr:`~Option.type`" msgstr ":attr:`~Option.type`" -#: ../../library/optparse.rst:1614 +#: ../../library/optparse.rst:1725 msgid "" "has its usual meaning: as with the ``\"store\"`` or ``\"append\"`` actions, " "it instructs :mod:`optparse` to consume one argument and convert it to :attr:" @@ -2545,11 +2918,11 @@ msgid "" "though, :mod:`optparse` passes it to your callback function." msgstr "" -#: ../../library/optparse.rst:1619 +#: ../../library/optparse.rst:1730 msgid ":attr:`~Option.nargs`" msgstr ":attr:`~Option.nargs`" -#: ../../library/optparse.rst:1620 +#: ../../library/optparse.rst:1731 msgid "" "also has its usual meaning: if it is supplied and > 1, :mod:`optparse` will " "consume :attr:`~Option.nargs` arguments, each of which must be convertible " @@ -2557,43 +2930,43 @@ msgid "" "callback." msgstr "" -#: ../../library/optparse.rst:1625 +#: ../../library/optparse.rst:1736 msgid ":attr:`~Option.callback_args`" msgstr ":attr:`~Option.callback_args`" -#: ../../library/optparse.rst:1626 +#: ../../library/optparse.rst:1737 msgid "a tuple of extra positional arguments to pass to the callback" msgstr "" -#: ../../library/optparse.rst:1628 +#: ../../library/optparse.rst:1739 msgid ":attr:`~Option.callback_kwargs`" msgstr ":attr:`~Option.callback_kwargs`" -#: ../../library/optparse.rst:1629 +#: ../../library/optparse.rst:1740 msgid "a dictionary of extra keyword arguments to pass to the callback" msgstr "" -#: ../../library/optparse.rst:1635 +#: ../../library/optparse.rst:1746 msgid "How callbacks are called" msgstr "" -#: ../../library/optparse.rst:1637 +#: ../../library/optparse.rst:1748 msgid "All callbacks are called as follows::" msgstr "" -#: ../../library/optparse.rst:1643 +#: ../../library/optparse.rst:1754 msgid "``option``" msgstr "``option``" -#: ../../library/optparse.rst:1644 +#: ../../library/optparse.rst:1755 msgid "is the Option instance that's calling the callback" msgstr "" -#: ../../library/optparse.rst:1646 +#: ../../library/optparse.rst:1757 msgid "``opt_str``" msgstr "``opt_str``" -#: ../../library/optparse.rst:1647 +#: ../../library/optparse.rst:1758 msgid "" "is the option string seen on the command-line that's triggering the " "callback. (If an abbreviated long option was used, ``opt_str`` will be the " @@ -2602,11 +2975,11 @@ msgid "" "``\"--foobar\"``.)" msgstr "" -#: ../../library/optparse.rst:1653 +#: ../../library/optparse.rst:1764 msgid "``value``" msgstr "``value``" -#: ../../library/optparse.rst:1654 +#: ../../library/optparse.rst:1765 msgid "" "is the argument to this option seen on the command-line. :mod:`optparse` " "will only expect an argument if :attr:`~Option.type` is set; the type of " @@ -2616,21 +2989,21 @@ msgid "" "of values of the appropriate type." msgstr "" -#: ../../library/optparse.rst:1660 +#: ../../library/optparse.rst:1771 msgid "``parser``" msgstr "``parser``" -#: ../../library/optparse.rst:1661 +#: ../../library/optparse.rst:1772 msgid "" "is the OptionParser instance driving the whole thing, mainly useful because " "you can access some other interesting data through its instance attributes:" msgstr "" -#: ../../library/optparse.rst:1664 +#: ../../library/optparse.rst:1775 msgid "``parser.largs``" msgstr "``parser.largs``" -#: ../../library/optparse.rst:1665 +#: ../../library/optparse.rst:1776 msgid "" "the current list of leftover arguments, ie. arguments that have been " "consumed but are neither options nor option arguments. Feel free to modify " @@ -2639,22 +3012,22 @@ msgid "" "parse_args`.)" msgstr "" -#: ../../library/optparse.rst:1670 +#: ../../library/optparse.rst:1781 msgid "``parser.rargs``" msgstr "``parser.rargs``" -#: ../../library/optparse.rst:1671 +#: ../../library/optparse.rst:1782 msgid "" "the current list of remaining arguments, ie. with ``opt_str`` and ``value`` " "(if applicable) removed, and only the arguments following them still there. " "Feel free to modify ``parser.rargs``, e.g. by consuming more arguments." msgstr "" -#: ../../library/optparse.rst:1676 +#: ../../library/optparse.rst:1787 msgid "``parser.values``" msgstr "``parser.values``" -#: ../../library/optparse.rst:1677 +#: ../../library/optparse.rst:1788 msgid "" "the object where option values are by default stored (an instance of " "optparse.OptionValues). This lets callbacks use the same mechanism as the " @@ -2663,27 +3036,27 @@ msgid "" "of any options already encountered on the command-line." msgstr "" -#: ../../library/optparse.rst:1684 +#: ../../library/optparse.rst:1795 msgid "" "is a tuple of arbitrary positional arguments supplied via the :attr:`~Option." "callback_args` option attribute." msgstr "" -#: ../../library/optparse.rst:1687 +#: ../../library/optparse.rst:1798 msgid "``kwargs``" msgstr "``kwargs``" -#: ../../library/optparse.rst:1688 +#: ../../library/optparse.rst:1799 msgid "" "is a dictionary of arbitrary keyword arguments supplied via :attr:`~Option." "callback_kwargs`." msgstr "" -#: ../../library/optparse.rst:1695 +#: ../../library/optparse.rst:1806 msgid "Raising errors in a callback" msgstr "" -#: ../../library/optparse.rst:1697 +#: ../../library/optparse.rst:1808 msgid "" "The callback function should raise :exc:`OptionValueError` if there are any " "problems with the option or its argument(s). :mod:`optparse` catches this " @@ -2693,17 +3066,17 @@ msgid "" "they did wrong." msgstr "" -#: ../../library/optparse.rst:1707 +#: ../../library/optparse.rst:1818 msgid "Callback example 1: trivial callback" msgstr "" -#: ../../library/optparse.rst:1709 +#: ../../library/optparse.rst:1820 msgid "" "Here's an example of a callback option that takes no arguments, and simply " "records that the option was seen::" msgstr "" -#: ../../library/optparse.rst:1712 +#: ../../library/optparse.rst:1823 msgid "" "def record_foo_seen(option, opt_str, value, parser):\n" " parser.values.saw_foo = True\n" @@ -2715,21 +3088,21 @@ msgstr "" "\n" "parser.add_option(\"--foo\", action=\"callback\", callback=record_foo_seen)" -#: ../../library/optparse.rst:1717 +#: ../../library/optparse.rst:1828 msgid "Of course, you could do that with the ``\"store_true\"`` action." msgstr "" -#: ../../library/optparse.rst:1723 +#: ../../library/optparse.rst:1834 msgid "Callback example 2: check option order" msgstr "" -#: ../../library/optparse.rst:1725 +#: ../../library/optparse.rst:1836 msgid "" "Here's a slightly more interesting example: record the fact that ``-a`` is " "seen, but blow up if it comes after ``-b`` in the command-line. ::" msgstr "" -#: ../../library/optparse.rst:1728 +#: ../../library/optparse.rst:1839 msgid "" "def check_order(option, opt_str, value, parser):\n" " if parser.values.b:\n" @@ -2747,18 +3120,18 @@ msgstr "" "parser.add_option(\"-a\", action=\"callback\", callback=check_order)\n" "parser.add_option(\"-b\", action=\"store_true\", dest=\"b\")" -#: ../../library/optparse.rst:1740 +#: ../../library/optparse.rst:1851 msgid "Callback example 3: check option order (generalized)" msgstr "" -#: ../../library/optparse.rst:1742 +#: ../../library/optparse.rst:1853 msgid "" "If you want to reuse this callback for several similar options (set a flag, " "but blow up if ``-b`` has already been seen), it needs a bit of work: the " "error message and the flag that it sets must be generalized. ::" msgstr "" -#: ../../library/optparse.rst:1746 +#: ../../library/optparse.rst:1857 msgid "" "def check_order(option, opt_str, value, parser):\n" " if parser.values.b:\n" @@ -2782,11 +3155,11 @@ msgstr "" "parser.add_option(\"-c\", action=\"callback\", callback=check_order, " "dest='c')" -#: ../../library/optparse.rst:1759 +#: ../../library/optparse.rst:1870 msgid "Callback example 4: check arbitrary condition" msgstr "" -#: ../../library/optparse.rst:1761 +#: ../../library/optparse.rst:1872 msgid "" "Of course, you could put any condition in there---you're not limited to " "checking the values of already-defined options. For example, if you have " @@ -2794,7 +3167,7 @@ msgid "" "is this::" msgstr "" -#: ../../library/optparse.rst:1765 +#: ../../library/optparse.rst:1876 msgid "" "def check_moon(option, opt_str, value, parser):\n" " if is_moon_full():\n" @@ -2814,16 +3187,16 @@ msgstr "" "parser.add_option(\"--foo\",\n" " action=\"callback\", callback=check_moon, dest=\"foo\")" -#: ../../library/optparse.rst:1774 +#: ../../library/optparse.rst:1885 msgid "" "(The definition of ``is_moon_full()`` is left as an exercise for the reader.)" msgstr "" -#: ../../library/optparse.rst:1780 +#: ../../library/optparse.rst:1891 msgid "Callback example 5: fixed arguments" msgstr "" -#: ../../library/optparse.rst:1782 +#: ../../library/optparse.rst:1893 msgid "" "Things get slightly more interesting when you define callback options that " "take a fixed number of arguments. Specifying that a callback option takes " @@ -2833,12 +3206,12 @@ msgid "" "nargs`, then the option takes :attr:`~Option.nargs` arguments." msgstr "" -#: ../../library/optparse.rst:1789 +#: ../../library/optparse.rst:1900 msgid "" "Here's an example that just emulates the standard ``\"store\"`` action::" msgstr "" -#: ../../library/optparse.rst:1791 +#: ../../library/optparse.rst:1902 msgid "" "def store_value(option, opt_str, value, parser):\n" " setattr(parser.values, option.dest, value)\n" @@ -2854,18 +3227,18 @@ msgstr "" " action=\"callback\", callback=store_value,\n" " type=\"int\", nargs=3, dest=\"foo\")" -#: ../../library/optparse.rst:1798 +#: ../../library/optparse.rst:1909 msgid "" "Note that :mod:`optparse` takes care of consuming 3 arguments and converting " "them to integers for you; all you have to do is store them. (Or whatever; " "obviously you don't need a callback for this example.)" msgstr "" -#: ../../library/optparse.rst:1806 +#: ../../library/optparse.rst:1917 msgid "Callback example 6: variable arguments" msgstr "" -#: ../../library/optparse.rst:1808 +#: ../../library/optparse.rst:1919 msgid "" "Things get hairy when you want an option to take a variable number of " "arguments. For this case, you must write a callback, as :mod:`optparse` " @@ -2875,23 +3248,23 @@ msgid "" "implement the conventional rules for bare ``--`` and ``-`` arguments:" msgstr "" -#: ../../library/optparse.rst:1815 +#: ../../library/optparse.rst:1926 msgid "either ``--`` or ``-`` can be option arguments" msgstr "" -#: ../../library/optparse.rst:1817 +#: ../../library/optparse.rst:1928 msgid "" "bare ``--`` (if not the argument to some option): halt command-line " "processing and discard the ``--``" msgstr "" -#: ../../library/optparse.rst:1820 +#: ../../library/optparse.rst:1931 msgid "" "bare ``-`` (if not the argument to some option): halt command-line " "processing but keep the ``-`` (append it to ``parser.largs``)" msgstr "" -#: ../../library/optparse.rst:1823 +#: ../../library/optparse.rst:1934 msgid "" "If you want an option that takes a variable number of arguments, there are " "several subtle, tricky issues to worry about. The exact implementation you " @@ -2900,13 +3273,13 @@ msgid "" "directly)." msgstr "" -#: ../../library/optparse.rst:1829 +#: ../../library/optparse.rst:1940 msgid "" "Nevertheless, here's a stab at a callback for an option with variable " "arguments::" msgstr "" -#: ../../library/optparse.rst:1832 +#: ../../library/optparse.rst:1943 msgid "" "def vararg_callback(option, opt_str, value, parser):\n" " assert value is None\n" @@ -2936,22 +3309,22 @@ msgid "" " action=\"callback\", callback=vararg_callback)" msgstr "" -#: ../../library/optparse.rst:1863 +#: ../../library/optparse.rst:1974 msgid "Extending :mod:`optparse`" msgstr "" -#: ../../library/optparse.rst:1865 +#: ../../library/optparse.rst:1976 msgid "" "Since the two major controlling factors in how :mod:`optparse` interprets " "command-line options are the action and type of each option, the most likely " "direction of extension is to add new actions and new types." msgstr "" -#: ../../library/optparse.rst:1873 +#: ../../library/optparse.rst:1984 msgid "Adding new types" msgstr "" -#: ../../library/optparse.rst:1875 +#: ../../library/optparse.rst:1986 msgid "" "To add new types, you need to define your own subclass of :mod:`optparse`'s :" "class:`Option` class. This class has a couple of attributes that define :" @@ -2959,23 +3332,23 @@ msgid "" "TYPE_CHECKER`." msgstr "" -#: ../../library/optparse.rst:1881 +#: ../../library/optparse.rst:1992 msgid "" "A tuple of type names; in your subclass, simply define a new tuple :attr:" "`TYPES` that builds on the standard one." msgstr "" -#: ../../library/optparse.rst:1886 +#: ../../library/optparse.rst:1997 msgid "" "A dictionary mapping type names to type-checking functions. A type-checking " "function has the following signature::" msgstr "" -#: ../../library/optparse.rst:1889 +#: ../../library/optparse.rst:2000 msgid "def check_mytype(option, opt, value)" msgstr "def check_mytype(option, opt, value)" -#: ../../library/optparse.rst:1891 +#: ../../library/optparse.rst:2002 msgid "" "where ``option`` is an :class:`Option` instance, ``opt`` is an option string " "(e.g., ``-f``), and ``value`` is the string from the command line that must " @@ -2986,7 +3359,7 @@ msgid "" "``value`` parameter." msgstr "" -#: ../../library/optparse.rst:1899 +#: ../../library/optparse.rst:2010 msgid "" "Your type-checking function should raise :exc:`OptionValueError` if it " "encounters any problems. :exc:`OptionValueError` takes a single string " @@ -2995,7 +3368,7 @@ msgid "" "\"`` and prints everything to stderr before terminating the process." msgstr "" -#: ../../library/optparse.rst:1905 +#: ../../library/optparse.rst:2016 msgid "" "Here's a silly example that demonstrates adding a ``\"complex\"`` option " "type to parse Python-style complex numbers on the command line. (This is " @@ -3003,11 +3376,11 @@ msgid "" "support for complex numbers, but never mind.)" msgstr "" -#: ../../library/optparse.rst:1910 +#: ../../library/optparse.rst:2021 msgid "First, the necessary imports::" msgstr "" -#: ../../library/optparse.rst:1912 +#: ../../library/optparse.rst:2023 msgid "" "from copy import copy\n" "from optparse import Option, OptionValueError" @@ -3015,13 +3388,13 @@ msgstr "" "from copy import copy\n" "from optparse import Option, OptionValueError" -#: ../../library/optparse.rst:1915 +#: ../../library/optparse.rst:2026 msgid "" "You need to define your type-checker first, since it's referred to later (in " "the :attr:`~Option.TYPE_CHECKER` class attribute of your Option subclass)::" msgstr "" -#: ../../library/optparse.rst:1918 +#: ../../library/optparse.rst:2029 msgid "" "def check_complex(option, opt, value):\n" " try:\n" @@ -3037,11 +3410,11 @@ msgstr "" " raise OptionValueError(\n" " \"option %s: invalid complex value: %r\" % (opt, value))" -#: ../../library/optparse.rst:1925 +#: ../../library/optparse.rst:2036 msgid "Finally, the Option subclass::" msgstr "" -#: ../../library/optparse.rst:1927 +#: ../../library/optparse.rst:2038 msgid "" "class MyOption (Option):\n" " TYPES = Option.TYPES + (\"complex\",)\n" @@ -3053,7 +3426,7 @@ msgstr "" " TYPE_CHECKER = copy(Option.TYPE_CHECKER)\n" " TYPE_CHECKER[\"complex\"] = check_complex" -#: ../../library/optparse.rst:1932 +#: ../../library/optparse.rst:2043 msgid "" "(If we didn't make a :func:`copy` of :attr:`Option.TYPE_CHECKER`, we would " "end up modifying the :attr:`~Option.TYPE_CHECKER` attribute of :mod:" @@ -3061,14 +3434,14 @@ msgid "" "that except good manners and common sense.)" msgstr "" -#: ../../library/optparse.rst:1937 +#: ../../library/optparse.rst:2048 msgid "" "That's it! Now you can write a script that uses the new option type just " "like any other :mod:`optparse`\\ -based script, except you have to instruct " "your OptionParser to use MyOption instead of Option::" msgstr "" -#: ../../library/optparse.rst:1941 +#: ../../library/optparse.rst:2052 msgid "" "parser = OptionParser(option_class=MyOption)\n" "parser.add_option(\"-c\", type=\"complex\")" @@ -3076,14 +3449,14 @@ msgstr "" "parser = OptionParser(option_class=MyOption)\n" "parser.add_option(\"-c\", type=\"complex\")" -#: ../../library/optparse.rst:1944 +#: ../../library/optparse.rst:2055 msgid "" "Alternately, you can build your own option list and pass it to OptionParser; " "if you don't use :meth:`add_option` in the above way, you don't need to tell " "OptionParser which option class to use::" msgstr "" -#: ../../library/optparse.rst:1948 +#: ../../library/optparse.rst:2059 msgid "" "option_list = [MyOption(\"-c\", action=\"store\", type=\"complex\", " "dest=\"c\")]\n" @@ -3093,32 +3466,32 @@ msgstr "" "dest=\"c\")]\n" "parser = OptionParser(option_list=option_list)" -#: ../../library/optparse.rst:1955 +#: ../../library/optparse.rst:2066 msgid "Adding new actions" msgstr "" -#: ../../library/optparse.rst:1957 +#: ../../library/optparse.rst:2068 msgid "" "Adding new actions is a bit trickier, because you have to understand that :" "mod:`optparse` has a couple of classifications for actions:" msgstr "" -#: ../../library/optparse.rst:1960 +#: ../../library/optparse.rst:2071 msgid "\"store\" actions" msgstr "" -#: ../../library/optparse.rst:1961 +#: ../../library/optparse.rst:2072 msgid "" "actions that result in :mod:`optparse` storing a value to an attribute of " "the current OptionValues instance; these options require a :attr:`~Option." "dest` attribute to be supplied to the Option constructor." msgstr "" -#: ../../library/optparse.rst:1965 +#: ../../library/optparse.rst:2076 msgid "\"typed\" actions" msgstr "" -#: ../../library/optparse.rst:1966 +#: ../../library/optparse.rst:2077 msgid "" "actions that take a value from the command line and expect it to be of a " "certain type; or rather, a string that can be converted to a certain type. " @@ -3126,7 +3499,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/optparse.rst:1971 +#: ../../library/optparse.rst:2082 msgid "" "These are overlapping sets: some default \"store\" actions are " "``\"store\"``, ``\"store_const\"``, ``\"append\"``, and ``\"count\"``, while " @@ -3134,25 +3507,25 @@ msgid "" "``\"callback\"``." msgstr "" -#: ../../library/optparse.rst:1975 +#: ../../library/optparse.rst:2086 msgid "" "When you add an action, you need to categorize it by listing it in at least " "one of the following class attributes of Option (all are lists of strings):" msgstr "" -#: ../../library/optparse.rst:1980 +#: ../../library/optparse.rst:2091 msgid "All actions must be listed in ACTIONS." msgstr "" -#: ../../library/optparse.rst:1984 +#: ../../library/optparse.rst:2095 msgid "\"store\" actions are additionally listed here." msgstr "" -#: ../../library/optparse.rst:1988 +#: ../../library/optparse.rst:2099 msgid "\"typed\" actions are additionally listed here." msgstr "" -#: ../../library/optparse.rst:1992 +#: ../../library/optparse.rst:2103 msgid "" "Actions that always take a type (i.e. whose options always take a value) are " "additionally listed here. The only effect of this is that :mod:`optparse` " @@ -3160,13 +3533,13 @@ msgid "" "whose action is listed in :attr:`ALWAYS_TYPED_ACTIONS`." msgstr "" -#: ../../library/optparse.rst:1997 +#: ../../library/optparse.rst:2108 msgid "" "In order to actually implement your new action, you must override Option's :" "meth:`take_action` method and add a case that recognizes your action." msgstr "" -#: ../../library/optparse.rst:2000 +#: ../../library/optparse.rst:2111 msgid "" "For example, let's add an ``\"extend\"`` action. This is similar to the " "standard ``\"append\"`` action, but instead of taking a single value from " @@ -3176,23 +3549,23 @@ msgid "" "option of type ``\"string\"``, the command line ::" msgstr "" -#: ../../library/optparse.rst:2007 +#: ../../library/optparse.rst:2118 msgid "--names=foo,bar --names blah --names ding,dong" msgstr "--names=foo,bar --names blah --names ding,dong" -#: ../../library/optparse.rst:2009 +#: ../../library/optparse.rst:2120 msgid "would result in a list ::" msgstr "" -#: ../../library/optparse.rst:2011 +#: ../../library/optparse.rst:2122 msgid "[\"foo\", \"bar\", \"blah\", \"ding\", \"dong\"]" msgstr "[\"foo\", \"bar\", \"blah\", \"ding\", \"dong\"]" -#: ../../library/optparse.rst:2013 +#: ../../library/optparse.rst:2124 msgid "Again we define a subclass of Option::" msgstr "" -#: ../../library/optparse.rst:2015 +#: ../../library/optparse.rst:2126 msgid "" "class MyOption(Option):\n" "\n" @@ -3224,43 +3597,43 @@ msgstr "" " Option.take_action(\n" " self, action, dest, opt, value, values, parser)" -#: ../../library/optparse.rst:2030 +#: ../../library/optparse.rst:2141 msgid "Features of note:" msgstr "" -#: ../../library/optparse.rst:2032 +#: ../../library/optparse.rst:2143 msgid "" "``\"extend\"`` both expects a value on the command-line and stores that " "value somewhere, so it goes in both :attr:`~Option.STORE_ACTIONS` and :attr:" "`~Option.TYPED_ACTIONS`." msgstr "" -#: ../../library/optparse.rst:2036 +#: ../../library/optparse.rst:2147 msgid "" "to ensure that :mod:`optparse` assigns the default type of ``\"string\"`` to " "``\"extend\"`` actions, we put the ``\"extend\"`` action in :attr:`~Option." "ALWAYS_TYPED_ACTIONS` as well." msgstr "" -#: ../../library/optparse.rst:2040 +#: ../../library/optparse.rst:2151 msgid "" ":meth:`MyOption.take_action` implements just this one new action, and passes " "control back to :meth:`Option.take_action` for the standard :mod:`optparse` " "actions." msgstr "" -#: ../../library/optparse.rst:2044 +#: ../../library/optparse.rst:2155 msgid "" "``values`` is an instance of the optparse_parser.Values class, which " "provides the very useful :meth:`ensure_value` method. :meth:`ensure_value` " "is essentially :func:`getattr` with a safety valve; it is called as ::" msgstr "" -#: ../../library/optparse.rst:2048 +#: ../../library/optparse.rst:2159 msgid "values.ensure_value(attr, value)" msgstr "values.ensure_value(attr, value)" -#: ../../library/optparse.rst:2050 +#: ../../library/optparse.rst:2161 msgid "" "If the ``attr`` attribute of ``values`` doesn't exist or is ``None``, then " "ensure_value() first sets it to ``value``, and then returns ``value``. This " @@ -3273,28 +3646,28 @@ msgid "" "meth:`ensure_value` will take care of getting it right when it's needed." msgstr "" -#: ../../library/optparse.rst:2061 +#: ../../library/optparse.rst:2172 msgid "Exceptions" msgstr "例外" -#: ../../library/optparse.rst:2065 +#: ../../library/optparse.rst:2176 msgid "" "Raised if an :class:`Option` instance is created with invalid or " "inconsistent arguments." msgstr "" -#: ../../library/optparse.rst:2070 +#: ../../library/optparse.rst:2181 msgid "Raised if conflicting options are added to an :class:`OptionParser`." msgstr "" -#: ../../library/optparse.rst:2074 +#: ../../library/optparse.rst:2185 msgid "Raised if an invalid option value is encountered on the command line." msgstr "" -#: ../../library/optparse.rst:2078 +#: ../../library/optparse.rst:2189 msgid "Raised if an invalid option is passed on the command line." msgstr "" -#: ../../library/optparse.rst:2082 +#: ../../library/optparse.rst:2193 msgid "Raised if an ambiguous option is passed on the command line." msgstr "" diff --git a/library/os.path.po b/library/os.path.po index 2019487b8c..9518aa11e3 100644 --- a/library/os.path.po +++ b/library/os.path.po @@ -38,7 +38,7 @@ msgid "" "object implementing the :class:`os.PathLike` protocol." msgstr "" "該模組實現了一些有用的路徑名操作函式。若要讀取或寫入檔案,請參閱 :func:" -"`open` 函數,要存取檔案系統,請參閱 :mod:`os` 模組。路徑參數可以以字串、位元" +"`open` 函式,要存取檔案系統,請參閱 :mod:`os` 模組。路徑參數可以以字串、位元" "組或任何依照 :class:`os.PathLike` 協議實作的物件傳遞。" #: ../../library/os.path.rst:19 @@ -62,7 +62,7 @@ msgid "" "their parameters. The result is an object of the same type, if a path or " "file name is returned." msgstr "" -"所有這些函數都只接受位元組或字串物件作為參數。如果回傳的是路徑或檔案名稱,結" +"所有這些函式都只接受位元組或字串物件作為參數。如果回傳的是路徑或檔案名稱,結" "果將是相同型別的物件。" #: ../../library/os.path.rst:37 diff --git a/library/pickle.po b/library/pickle.po index 4846877e33..111cb91b47 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -562,9 +562,9 @@ msgid "" "class:`io.BytesIO` instance, or any other custom object that meets this " "interface." msgstr "" -"傳予引數 *file* 的物件必須支援可寫入單一位元組的 write() 方法。只要滿足此條" -"件,傳入的物件可以是一個硬碟上二進位檔案、一個 :class:`io.BytesIO` 實例或任何" -"其他滿足這個介面要求的物件。" +"引數 *file* 必須支援可寫入單一位元組引數的 write() 方法。只要滿足此條件,傳入" +"的物件可以是一個硬碟上二進位檔案、一個 :class:`io.BytesIO` 實例或任何其他滿足" +"這個介面要求的物件。" #: ../../library/pickle.rst:313 msgid "" @@ -585,8 +585,8 @@ msgid "" "If *buffer_callback* is ``None`` (the default), buffer views are serialized " "into *file* as part of the pickle stream." msgstr "" -"如果 *buffer_callback* 是 ``None`` (預設值),緩衝區的視圖會作為 pickle 封裝" -"串流的一部分被序列化進 *file* 中。" +"如果 *buffer_callback* 是 ``None``\\ (預設值),緩衝區的視圖會作為 pickle 封" +"裝串流的一部分被序列化進 *file* 中。" #: ../../library/pickle.rst:320 msgid "" @@ -658,10 +658,10 @@ msgid "" "reduction function takes a single argument of the associated class and " "should conform to the same interface as a :meth:`~object.__reduce__` method." msgstr "" -"封裝器(pickler)物件含有的的調度表是一個 *縮減函式* (reduction function)的" -"註冊表,可以使用 :func:`copyreg.pickle` 來宣告這類縮減函式。它是一個以類別為" -"鍵、還原函式為值的映射表。縮減函式應準備接收一個對應類別的引數,並應遵循與 :" -"meth:`~object.__reduce__` 方法相同的介面。" +"封裝器(pickler)物件含有的的調度表是一個\\ *縮減函式*\\ (reduction " +"function)的註冊表,可以使用 :func:`copyreg.pickle` 來宣告這類縮減函式。它是" +"一個以類別為鍵、還原函式為值的映射表。縮減函式應準備接收一個對應類別的引數," +"並應遵循與 :meth:`~object.__reduce__` 方法相同的介面。" #: ../../library/pickle.rst:362 msgid "" @@ -693,7 +693,7 @@ msgid "" msgstr "" "一個可以在 :class:`Pickler` 子類別中被定義的縮減器(reducer)。這個方法的優先" "度高於任何其他 :attr:`分派表 <dispatch_table>` 中的縮減器。他應該要有和 :" -"meth:`~object.__reduce__` 方法相同的函數界面,且可以可選地回傳 :data:" +"meth:`~object.__reduce__` 方法相同的函式介面,且可以可選地回傳 :data:" "`NotImplemented` 以退回(fallback)使用 :attr:`分派表 <dispatch_table>` 中登" "錄的縮減方法來封裝 ``obj``。" @@ -782,7 +782,7 @@ msgid "" msgstr "" "如果 *buffers* 不是 ``None``,則其應該是一個可疊代物件,內含數個支援緩衝區的" "物件,並且每當 pickle 串流引用一個\\ :ref:`帶外 <pickle-oob>`\\ 緩衝區視圖時" -"將會被照順序消耗。這些緩衝資料當初建立時應已按照順序給定予 Pickler 物件中的 " +"將會被照順序消耗。這些緩衝資料當初建立時應已按照順序給定於 Pickler 物件中的 " "*buffer_callback*。" #: ../../library/pickle.rst:438 @@ -796,7 +796,7 @@ msgstr "" #: ../../library/pickle.rst:445 msgid "Raise an :exc:`UnpicklingError` by default." -msgstr "預設會拋出 :exc:`UnpicklingError` 例外。" +msgstr "預設會引發 :exc:`UnpicklingError` 例外。" #: ../../library/pickle.rst:447 msgid "" @@ -820,7 +820,7 @@ msgid "" "unlike its name suggests, :meth:`find_class` is also used for finding " "functions." msgstr "" -"如有需要將引入 *module* ,並從中返回名為 *name* 的物件,這裡的 *module* 和 " +"如有需要將引入 *module* ,並從中回傳名為 *name* 的物件,這裡的 *module* 和 " "*name* 引數接受的輸入是 :class:`str` 物件。注意,雖然名稱上看起來不像,但 :" "meth:`find_class` 亦可被用於尋找其他函式。" @@ -850,7 +850,7 @@ msgid "" "`buffer-providing <bufferobjects>` object, such as a :term:`bytes-like " "object` or a N-dimensional array." msgstr "" -"一個表示了含有可封裝數據緩衝區的包裝函數(wrapper function)。*buffer* 必須是" +"一個表示了含有可封裝資料緩衝區的包裝函式(wrapper function)。*buffer* 必須是" "一個 :ref:`提供緩衝區 <bufferobjects>` 的物件,例如一個 :term:`類位元組物件 " "<bytes-like object>` 或 N 維陣列。" @@ -883,7 +883,7 @@ msgid "" "``B`` (unsigned bytes). :exc:`BufferError` is raised if the buffer is " "neither C- nor Fortran-contiguous." msgstr "" -"返回此緩衝區底層記憶體區域的 :class:`memoryview`。被返回的物件是一個(在 C 語" +"回傳此緩衝區底層記憶體區域的 :class:`memoryview`。被回傳的物件是一個(在 C 語" "言的 formatter 格式中)以 ``B`` (unsigned bytes) 二進位格式儲存、一維且列連續" "(C-contiguous)的 memoryview。如果緩衝區既不是列連續(C-contiguous)也不是行" "連續(Fortran-contiguous)的,則會引發 :exc:`BufferError`。" @@ -1016,7 +1016,7 @@ msgid "" msgstr "" "同樣地,當類別實例被封裝時,它所屬類別具有的程式碼和資料不會被一起封裝。只有" "實例資料本身會被封裝。這是有意而為的,因為如此你才可以在類別中修正錯誤或新增" -"其他方法,且於此同時仍能夠載入使用較早期版本的類別所建立的物件實例。如果您預" +"其他方法,且於此同時仍能夠載入使用較早期版本的類別所建立的物件實例。如果你預" "計將有長期存在的物件、且該物件將經歷許多版本的更替,你可以在物件中存放一個版" "本號,以便未來能透過 :meth:`~object.__setstate__` 方法來進行適當的版本轉換。" @@ -1131,7 +1131,7 @@ msgid "" "are several cases:" msgstr "" "目標類別可以透過覆寫方法 :meth:`__getstate__` 進一步影響其實例被封裝的方式。" -"封裝時,呼叫該方法所返回的物件將作為該實例的內容被封裝、而非一個預設狀態。以" +"封裝時,呼叫該方法所回傳的物件將作為該實例的內容被封裝、而非一個預設狀態。以" "下列出幾種預設狀態:" #: ../../library/pickle.rst:625 @@ -1195,7 +1195,7 @@ msgid "" "If :meth:`__reduce__` returns a state with value ``None`` at pickling, the :" "meth:`__setstate__` method will not be called upon unpickling." msgstr "" -"如果 :meth:`__reduce__` 在封裝時返回了 ``None`` 狀態,則拆封時就不會去呼叫 :" +"如果 :meth:`__reduce__` 在封裝時回傳了 ``None`` 狀態,則拆封時就不會去呼叫 :" "meth:`__setstate__`。" #: ../../library/pickle.rst:660 @@ -1274,14 +1274,14 @@ msgid "" "Optional items can either be omitted, or ``None`` can be provided as their " "value. The semantics of each item are in order:" msgstr "" -"當返回一個元組時,其長度必須介於兩至六項元素之間。可選項可以被省略,或者其值" +"當回傳一個元組時,其長度必須介於兩至六項元素之間。可選項可以被省略,或者其值" "可以被設為 ``None``。各項物件的語意依序為:" #: ../../library/pickle.rst:704 msgid "" "A callable object that will be called to create the initial version of the " "object." -msgstr "一個將會被呼叫來創建初始版本物件的可呼叫物件。" +msgstr "一個將會被呼叫來建立初始版本物件的可呼叫物件。" #: ../../library/pickle.rst:707 msgid "" @@ -1539,7 +1539,7 @@ msgstr "" "庫中的特定紀錄。\n" " return (\"MemoRecord\", obj.key)\n" " else:\n" -" # 如果 obj 沒有持久 ID,則返回 None。這表示 obj 像平常那樣封裝即" +" # 如果 obj 沒有持久 ID,則回傳 None。這表示 obj 像平常那樣封裝即" "可。\n" " return None\n" "\n" @@ -1556,13 +1556,13 @@ msgstr "" " cursor = self.connection.cursor()\n" " type_tag, key_id = pid\n" " if type_tag == \"MemoRecord\":\n" -" # 從資料庫中抓取所引用的紀錄並返回。\n" +" # 從資料庫中抓取所引用的紀錄並回傳。\n" " cursor.execute(\"SELECT * FROM memos WHERE key=?\", " "(str(key_id),))\n" " key, task = cursor.fetchone()\n" " return MemoRecord(key, task)\n" " else:\n" -" # 如果無法返回正確的物件,則必須拋出錯誤。\n" +" # 如果無法回傳正確的物件,則必須引發錯誤。\n" " # 否則 unpickler 會誤認為 None 是持久 ID 所引用的物件。\n" " raise pickle.UnpicklingError(\"unsupported persistent object\")\n" "\n" @@ -1628,7 +1628,7 @@ msgid "" "modified copy of :data:`!copyreg.dispatch_table` as a private dispatch table." msgstr "" "由 :mod:`copyreg` 模組管理的全域調度表可以 :data:`!copyreg.dispatch_table` 呼" -"叫。你可以透過這個方式來基於原始 :data:`!copyreg.dispatch_table` 創建一個修改" +"叫。你可以透過這個方式來基於原始 :data:`!copyreg.dispatch_table` 建立一個修改" "過的版本,作為你的專屬用途的調度表。" #: ../../library/pickle.rst:801 @@ -1816,7 +1816,7 @@ msgstr "" #: ../../library/pickle.rst:896 msgid "Custom Reduction for Types, Functions, and Other Objects" -msgstr "針對型別、函數或特定物件定製縮減函數" +msgstr "針對型別、函式或特定物件定製縮減函式" #: ../../library/pickle.rst:900 msgid "" @@ -1907,7 +1907,7 @@ msgstr "" "\n" "class MyPickler(pickle.Pickler):\n" " def reducer_override(self, obj):\n" -" \"\"\"MyClass 的自訂縮減函數。\"\"\"\n" +" \"\"\"MyClass 的自訂縮減函式。\"\"\"\n" " if getattr(obj, \"__name__\", None) == \"MyClass\":\n" " return type, (obj.__name__, obj.__bases__,\n" " {'my_attribute': obj.my_attribute})\n" @@ -1967,8 +1967,8 @@ msgid "" "for any large data." msgstr "" "要封裝的大型資料物件,則必須實作一個針對 5 版協定及以上的 :meth:`~object." -"__reduce_ex__` 方法,該方法應返回一個 :class:`PickleBuffer` 實例來處理任何大" -"型資料(而非返回如 :class:`bytes` 物件)。" +"__reduce_ex__` 方法,該方法應回傳一個 :class:`PickleBuffer` 實例來處理任何大" +"型資料(而非回傳如 :class:`bytes` 物件)。" #: ../../library/pickle.rst:980 msgid "" @@ -2002,8 +2002,8 @@ msgid "" "graph. Buffers accumulated by the *buffer_callback* will not see their data " "copied into the pickle stream, only a cheap marker will be inserted." msgstr "" -"傳送端需要傳遞一個調用緩衝區的回呼函數給 :class:`Pickler`\\ (或 :func:" -"`dump` 或 :func:`dumps` 函數)的 *buffer_callback* 引數,使每次生成 :class:" +"傳送端需要傳遞一個調用緩衝區的回呼函式給 :class:`Pickler`\\ (或 :func:" +"`dump` 或 :func:`dumps` 函式)的 *buffer_callback* 引數,使每次生成 :class:" "`PickleBuffer` 時,該物件在處理物件圖時能被呼叫。除了一個簡易標記以外,由 " "*buffer_callback* 累積的緩衝區資料不會被複製到 pickle 串流中。" @@ -2095,7 +2095,7 @@ msgid "" "providing object if it has the right type. This is an easy way to simulate " "zero-copy behaviour on this toy example." msgstr "" -"如果型別正確,重建器(``_reconstruct`` 類別方法)會返回當時提供緩衝區的物件。" +"如果型別正確,重建器(``_reconstruct`` 類別方法)會回傳當時提供緩衝區的物件。" "這個簡易實作可以模擬一個無複製行為的重建器。" #: ../../library/pickle.rst:1043 @@ -2125,7 +2125,7 @@ msgid "" "But if we pass a *buffer_callback* and then give back the accumulated " "buffers when unserializing, we are able to get back the original object::" msgstr "" -"但如果我們傳一個 *buffer_callback* 並在去序列化時正確返回積累的緩衝資料,我們" +"但如果我們傳一個 *buffer_callback* 並在去序列化時正確回傳積累的緩衝資料,我們" "就能拿回原始的物件:::" #: ../../library/pickle.rst:1055 @@ -2153,7 +2153,7 @@ msgid "" "making as few copies as possible) when transferring between distinct " "processes or systems." msgstr "" -"此範例是因為受限於 :class:`bytearray` 會自行分配記憶體:您無法創建以其他物件" +"此範例是因為受限於 :class:`bytearray` 會自行分配記憶體:你無法建立以其他物件" "的記憶體為基礎的 :class:`bytearray` 實例。不過第三方資料型態(如 NumPy 陣列)" "則可能沒有這個限制,而允許在不同程序或系統之間傳輸資料時使用零拷貝封裝(或儘" "可能地減少拷貝次數)。" @@ -2208,7 +2208,7 @@ msgid "" "requested. Thus it is possible to either completely forbid globals or " "restrict them to a safe subset." msgstr "" -"基於以上原因,您可能會希望透過自訂 :meth:`Unpickler.find_class` 來控制哪些是" +"基於以上原因,你可能會希望透過自訂 :meth:`Unpickler.find_class` 來控制哪些是" "能夠被拆封的內容。與其名稱字面意義暗示的不同,實際上每當你請求一個全域物件" "(例如,類別或函式)時,就會調用 :meth:`Unpickler.find_class`。因此,可以透過" "這個方法完全禁止全域物件或將其限制在安全的子集合。" @@ -2272,7 +2272,7 @@ msgstr "" " (module, name))\n" "\n" "def restricted_loads(s):\n" -" \"\"\"一個模擬 pickle.loads() 的輔助函數\"\"\"\n" +" \"\"\"一個模擬 pickle.loads() 的輔助函式\"\"\"\n" " return RestrictedUnpickler(io.BytesIO(s)).load()" #: ../../library/pickle.rst:1129 @@ -2314,8 +2314,8 @@ msgid "" "alternatives such as the marshalling API in :mod:`xmlrpc.client` or third-" "party solutions." msgstr "" -"正如我們的範例所示,必須謹慎審視能被拆封的內容。因此,如果您的應用場景非常關" -"心安全性,您可能需要考慮其他選擇,例如 :mod:`xmlrpc.client` 中的 marshalling " +"正如我們的範例所示,必須謹慎審視能被拆封的內容。因此,如果你的應用場景非常關" +"心安全性,你可能需要考慮其他選擇,例如 :mod:`xmlrpc.client` 中的 marshalling " "API 或其他第三方解決方案。" #: ../../library/pickle.rst:1155 @@ -2449,7 +2449,7 @@ msgid "" "The exception raised will likely be an :exc:`ImportError` or an :exc:" "`AttributeError` but it could be something else." msgstr "" -"拋出的例外應該是 :exc:`ImportError` 或 :exc:`AttributeError`,但也可能是其他" +"引發的例外應該是 :exc:`ImportError` 或 :exc:`AttributeError`,但也可能是其他" "例外。" #: ../../library/pickle.rst:1225 diff --git a/library/random.po b/library/random.po index 08679f4e90..a2417c7d11 100644 --- a/library/random.po +++ b/library/random.po @@ -41,7 +41,7 @@ msgid "" "replacement." msgstr "" "對於整數,可以從範圍中進行均勻選擇。對於序列,有一個隨機元素的均勻選擇,一個" -"用來原地 (in-place) 產生隨機排列清單的函式,以及一個用來隨機採樣不替換的函" +"用來原地 (in-place) 產生隨機排列清單的函式,以及一個用來隨機取樣不替換的函" "式。" #: ../../library/random.rst:19 diff --git a/library/ssl.po b/library/ssl.po index a00c5acbd3..6fa89a6402 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2024-12-20 00:13+0000\n" "PO-Revision-Date: 2024-08-28 00:43+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -3542,10 +3542,11 @@ msgstr "" #: ../../library/ssl.rst:2510 msgid "" "The :mod:`asyncio` module supports :ref:`non-blocking SSL sockets <ssl-" -"nonblocking>` and provides a higher level API. It polls for events using " -"the :mod:`selectors` module and handles :exc:`SSLWantWriteError`, :exc:" -"`SSLWantReadError` and :exc:`BlockingIOError` exceptions. It runs the SSL " -"handshake asynchronously as well." +"nonblocking>` and provides a higher level :ref:`Streams API <asyncio-" +"streams>`. It polls for events using the :mod:`selectors` module and " +"handles :exc:`SSLWantWriteError`, :exc:`SSLWantReadError` and :exc:" +"`BlockingIOError` exceptions. It runs the SSL handshake asynchronously as " +"well." msgstr "" #: ../../library/ssl.rst:2519 diff --git a/library/superseded.po b/library/superseded.po index 179f3bcb8a..c9dd877050 100644 --- a/library/superseded.po +++ b/library/superseded.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2022-02-15 20:45+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -24,11 +24,29 @@ msgid "Superseded Modules" msgstr "已被取代的模組" #: ../../library/superseded.rst:7 -#, fuzzy msgid "" -"The modules described in this chapter are deprecated or :term:`soft " -"deprecated` and only kept for backwards compatibility. They have been " -"superseded by other modules." +"The modules described in this chapter have been superseded by other modules " +"for most use cases, and are retained primarily to preserve backwards " +"compatibility." +msgstr "" +"此章節所描述的模組在大多數使用情況下已被其他模組取代,僅為了向後相容性而被保" +"留下來。" + +#: ../../library/superseded.rst:10 +msgid "" +"Modules may appear in this chapter because they only cover a limited subset " +"of a problem space, and a more generally applicable solution is available " +"elsewhere in the standard library (for example, :mod:`getopt` covers the " +"very specific task of \"mimic the C :c:func:`!getopt` API in Python\", " +"rather than the broader command line option parsing and argument parsing " +"capabilities offered by :mod:`optparse` and :mod:`argparse`)." +msgstr "" + +#: ../../library/superseded.rst:17 +msgid "" +"Alternatively, modules may appear in this chapter because they are " +"deprecated outright, and awaiting removal in a future release, or they are :" +"term:`soft deprecated` and their use is actively discouraged in new " +"projects. With the removal of various obsolete modules through :pep:`594`, " +"there are currently no modules in this latter category." msgstr "" -"此章節所描述的模組 (modules) 均已被棄用,僅為了向後相容性而被保留下來。它們已" -"經被其他模組所取代。" diff --git a/library/timeit.po b/library/timeit.po index b7a9d153b8..4b5e7eb49d 100644 --- a/library/timeit.po +++ b/library/timeit.po @@ -110,7 +110,7 @@ msgid "" "repetitions only when the command-line interface is used. In the :ref:" "`timeit-examples` section you can find more advanced examples." msgstr "" -"但請注意,僅當使用命令列界面時 :func:`.timeit` 才會自動確定重複次數。在\\ :" +"但請注意,僅當使用命令列介面時 :func:`.timeit` 才會自動確定重複次數。在\\ :" "ref:`timeit-examples`\\ 章節中有更進階的範例。" #: ../../library/timeit.rst:60 diff --git a/library/tty.po b/library/tty.po index 86b6a46e29..6b2b0efbc6 100644 --- a/library/tty.po +++ b/library/tty.po @@ -81,7 +81,7 @@ msgid "" msgstr "" "將檔案描述器 *fd* 的模式更改為 raw。如果 *when* 被省略,則預設為 :const:" "`termios.TCSAFLUSH`,並傳遞給 :func:`termios.tcsetattr`。:func:`termios." -"tcgetattr` 的回傳值會在設定 *fd* 模式為 raw 之前先儲存起來。此函數回傳這個" +"tcgetattr` 的回傳值會在設定 *fd* 模式為 raw 之前先儲存起來。此函式回傳這個" "值。" #: ../../library/tty.rst:55 ../../library/tty.rst:69 @@ -98,7 +98,7 @@ msgid "" msgstr "" "將檔案描述器 *fd* 的模式更改為 cbreak。如果 *when* 被省略,則預設為 :const:" "`termios.TCSAFLUSH`,並傳遞給 :func:`termios.tcsetattr`。:func:`termios." -"tcgetattr` 的回傳值會在設定 *fd* 模式為 raw 之前先儲存起來。此函數回傳這個" +"tcgetattr` 的回傳值會在設定 *fd* 模式為 raw 之前先儲存起來。此函式回傳這個" "值。" #: ../../library/tty.rst:66 diff --git a/library/unittest.po b/library/unittest.po index bd134aa24b..9b00ef635a 100644 --- a/library/unittest.po +++ b/library/unittest.po @@ -548,11 +548,11 @@ msgstr "" #: ../../library/unittest.rst:291 msgid "The ``discover`` sub-command has the following options:" -msgstr "``discover`` 子指令有以下幾個選項:" +msgstr "``discover`` 子命令有以下幾個選項:" #: ../../library/unittest.rst:297 msgid "Verbose output" -msgstr "詳細(verbose)輸出" +msgstr "詳細 (verbose) 輸出" #: ../../library/unittest.rst:301 msgid "Directory to start discovery (``.`` default)" @@ -564,7 +564,7 @@ msgstr "匹配測試檔案的模式(預設為 ``test*.py``\\ )" #: ../../library/unittest.rst:309 msgid "Top level directory of project (defaults to start directory)" -msgstr "專案的最高階層目錄 (defaults to start directory)" +msgstr "專案的最高階層目錄(預設為開始的資料夾)" #: ../../library/unittest.rst:311 msgid "" @@ -1186,6 +1186,35 @@ msgid "" " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" "AssertionError: 1 != 0" msgstr "" +"======================================================================\n" +"FAIL: test_even (__main__.NumbersTest.test_even) (i=1)\n" +"Test that numbers between 0 and 5 are all even.\n" +"----------------------------------------------------------------------\n" +"Traceback (most recent call last):\n" +" File \"subtests.py\", line 11, in test_even\n" +" self.assertEqual(i % 2, 0)\n" +" ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +"AssertionError: 1 != 0\n" +"\n" +"======================================================================\n" +"FAIL: test_even (__main__.NumbersTest.test_even) (i=3)\n" +"Test that numbers between 0 and 5 are all even.\n" +"----------------------------------------------------------------------\n" +"Traceback (most recent call last):\n" +" File \"subtests.py\", line 11, in test_even\n" +" self.assertEqual(i % 2, 0)\n" +" ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +"AssertionError: 1 != 0\n" +"\n" +"======================================================================\n" +"FAIL: test_even (__main__.NumbersTest.test_even) (i=5)\n" +"Test that numbers between 0 and 5 are all even.\n" +"----------------------------------------------------------------------\n" +"Traceback (most recent call last):\n" +" File \"subtests.py\", line 11, in test_even\n" +" self.assertEqual(i % 2, 0)\n" +" ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +"AssertionError: 1 != 0" #: ../../library/unittest.rst:699 msgid "" @@ -1214,7 +1243,7 @@ msgstr "" #: ../../library/unittest.rst:715 msgid "Classes and functions" -msgstr "" +msgstr "類別與函式" #: ../../library/unittest.rst:717 msgid "This section describes in depth the API of :mod:`unittest`." @@ -1378,7 +1407,7 @@ msgstr "" #: ../../library/unittest.rst:853 ../../library/unittest.rst:974 #: ../../library/unittest.rst:1188 ../../library/unittest.rst:1312 msgid "Method" -msgstr "" +msgstr "方法" #: ../../library/unittest.rst:853 ../../library/unittest.rst:974 #: ../../library/unittest.rst:1188 @@ -1589,13 +1618,15 @@ msgstr ":meth:`assertRaises(exc, fun, *args, **kwds) <TestCase.assertRaises>`" #: ../../library/unittest.rst:976 msgid "``fun(*args, **kwds)`` raises *exc*" -msgstr "" +msgstr "``fun(*args, **kwds)`` 會引發 *exc*" #: ../../library/unittest.rst:979 msgid "" ":meth:`assertRaisesRegex(exc, r, fun, *args, **kwds) <TestCase." "assertRaisesRegex>`" msgstr "" +":meth:`assertRaisesRegex(exc, r, fun, *args, **kwds) <TestCase." +"assertRaisesRegex>`" #: ../../library/unittest.rst:979 msgid "``fun(*args, **kwds)`` raises *exc* and the message matches regex *r*" @@ -1607,7 +1638,7 @@ msgstr ":meth:`assertWarns(warn, fun, *args, **kwds) <TestCase.assertWarns>`" #: ../../library/unittest.rst:982 msgid "``fun(*args, **kwds)`` raises *warn*" -msgstr "" +msgstr "``fun(*args, **kwds)`` 會引發 *warn*" #: ../../library/unittest.rst:985 msgid "" @@ -1725,6 +1756,8 @@ msgid "" "self.assertRaisesRegex(ValueError, \"invalid literal for.*XYZ'$\",\n" " int, 'XYZ')" msgstr "" +"self.assertRaisesRegex(ValueError, \"invalid literal for.*XYZ'$\",\n" +" int, 'XYZ')" #: ../../library/unittest.rst:1046 ../../library/unittest.rst:1114 msgid "or::" @@ -1818,12 +1851,17 @@ msgid "" " r'legacy_function\\(\\) is deprecated',\n" " legacy_function, 'XYZ')" msgstr "" +"self.assertWarnsRegex(DeprecationWarning,\n" +" r'legacy_function\\(\\) is deprecated',\n" +" legacy_function, 'XYZ')" #: ../../library/unittest.rst:1116 msgid "" "with self.assertWarnsRegex(RuntimeWarning, 'unsafe frobnicating'):\n" " frobnicate('/etc/passwd')" msgstr "" +"with self.assertWarnsRegex(RuntimeWarning, 'unsafe frobnicating'):\n" +" frobnicate('/etc/passwd')" #: ../../library/unittest.rst:1126 msgid "" @@ -1881,6 +1919,11 @@ msgid "" "self.assertEqual(cm.output, ['INFO:foo:first message',\n" " 'ERROR:foo.bar:second message'])" msgstr "" +"with self.assertLogs('foo', level='INFO') as cm:\n" +" logging.getLogger('foo').info('first message')\n" +" logging.getLogger('foo.bar').error('second message')\n" +"self.assertEqual(cm.output, ['INFO:foo:first message',\n" +" 'ERROR:foo.bar:second message'])" #: ../../library/unittest.rst:1168 msgid "" @@ -2016,6 +2059,8 @@ msgid "" ">>> self.assertGreaterEqual(3, 4)\n" "AssertionError: \"3\" unexpectedly not greater than or equal to \"4\"" msgstr "" +">>> self.assertGreaterEqual(3, 4)\n" +"AssertionError: \"3\" unexpectedly not greater than or equal to \"4\"" #: ../../library/unittest.rst:1257 msgid "" @@ -2034,7 +2079,7 @@ msgstr "以 ``assertRegexpMatches`` 為名新增。" msgid "" "The method ``assertRegexpMatches()`` has been renamed to :meth:`." "assertRegex`." -msgstr "" +msgstr "``assertRegexpMatches()`` 方法已重新命名為 :meth:`.assertRegex`。" #: ../../library/unittest.rst:1268 msgid ":meth:`.assertNotRegex`." @@ -2091,7 +2136,7 @@ msgstr ":meth:`assertMultiLineEqual(a, b) <TestCase.assertMultiLineEqual>`" #: ../../library/unittest.rst:1314 msgid "strings" -msgstr "" +msgstr "字串" #: ../../library/unittest.rst:1317 msgid ":meth:`assertSequenceEqual(a, b) <TestCase.assertSequenceEqual>`" @@ -2099,7 +2144,7 @@ msgstr ":meth:`assertSequenceEqual(a, b) <TestCase.assertSequenceEqual>`" #: ../../library/unittest.rst:1317 msgid "sequences" -msgstr "" +msgstr "序列" #: ../../library/unittest.rst:1320 msgid ":meth:`assertListEqual(a, b) <TestCase.assertListEqual>`" @@ -2107,7 +2152,7 @@ msgstr ":meth:`assertListEqual(a, b) <TestCase.assertListEqual>`" #: ../../library/unittest.rst:1320 msgid "lists" -msgstr "" +msgstr "串列" #: ../../library/unittest.rst:1323 msgid ":meth:`assertTupleEqual(a, b) <TestCase.assertTupleEqual>`" @@ -2115,7 +2160,7 @@ msgstr ":meth:`assertTupleEqual(a, b) <TestCase.assertTupleEqual>`" #: ../../library/unittest.rst:1323 msgid "tuples" -msgstr "" +msgstr "元組" #: ../../library/unittest.rst:1326 msgid ":meth:`assertSetEqual(a, b) <TestCase.assertSetEqual>`" @@ -2123,7 +2168,7 @@ msgstr ":meth:`assertSetEqual(a, b) <TestCase.assertSetEqual>`" #: ../../library/unittest.rst:1326 msgid "sets or frozensets" -msgstr "" +msgstr "集合或凍結集合" #: ../../library/unittest.rst:1329 msgid ":meth:`assertDictEqual(a, b) <TestCase.assertDictEqual>`" @@ -2131,7 +2176,7 @@ msgstr ":meth:`assertDictEqual(a, b) <TestCase.assertDictEqual>`" #: ../../library/unittest.rst:1329 msgid "dicts" -msgstr "" +msgstr "字典" #: ../../library/unittest.rst:1337 msgid "" @@ -3332,7 +3377,7 @@ msgstr "" #: ../../library/unittest.rst:2337 msgid "load_tests Protocol" -msgstr "" +msgstr "load_tests 協定" #: ../../library/unittest.rst:2341 msgid "" @@ -3359,7 +3404,7 @@ msgstr "" #: ../../library/unittest.rst:2352 msgid "It should return a :class:`TestSuite`." -msgstr "" +msgstr "它應該回傳一個 :class:`TestSuite`。" #: ../../library/unittest.rst:2354 msgid "" @@ -3497,7 +3542,7 @@ msgstr "" #: ../../library/unittest.rst:2440 msgid "setUpClass and tearDownClass" -msgstr "" +msgstr "setUpClass 和 tearDownClass" #: ../../library/unittest.rst:2442 msgid "These must be implemented as class methods::" @@ -3545,7 +3590,7 @@ msgstr "" #: ../../library/unittest.rst:2467 msgid "setUpModule and tearDownModule" -msgstr "" +msgstr "setUpModule 和 tearDownModule" #: ../../library/unittest.rst:2469 msgid "These should be implemented as functions::" diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index 6c12ef1f85..d5a74fad17 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-12 00:13+0000\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -610,8 +610,8 @@ msgid "" msgstr "" #: ../../reference/compound_stmts.rst:526 -#: ../../reference/compound_stmts.rst:1544 -#: ../../reference/compound_stmts.rst:1585 +#: ../../reference/compound_stmts.rst:1547 +#: ../../reference/compound_stmts.rst:1588 msgid "The following code::" msgstr "以下程式碼: ::" @@ -624,8 +624,8 @@ msgstr "" " SUITE" #: ../../reference/compound_stmts.rst:531 -#: ../../reference/compound_stmts.rst:553 -#: ../../reference/compound_stmts.rst:1590 +#: ../../reference/compound_stmts.rst:556 +#: ../../reference/compound_stmts.rst:1593 msgid "is semantically equivalent to::" msgstr "在語義上等同於: ::" @@ -635,37 +635,43 @@ msgid "" "enter = type(manager).__enter__\n" "exit = type(manager).__exit__\n" "value = enter(manager)\n" +"hit_except = False\n" "\n" "try:\n" " TARGET = value\n" " SUITE\n" "except:\n" +" hit_except = True\n" " if not exit(manager, *sys.exc_info()):\n" " raise\n" -"else:\n" -" exit(manager, None, None, None)" +"finally:\n" +" if not hit_except:\n" +" exit(manager, None, None, None)" msgstr "" "manager = (EXPRESSION)\n" "enter = type(manager).__enter__\n" "exit = type(manager).__exit__\n" "value = enter(manager)\n" +"hit_except = False\n" "\n" "try:\n" " TARGET = value\n" " SUITE\n" "except:\n" +" hit_except = True\n" " if not exit(manager, *sys.exc_info()):\n" " raise\n" -"else:\n" -" exit(manager, None, None, None)" +"finally:\n" +" if not hit_except:\n" +" exit(manager, None, None, None)" -#: ../../reference/compound_stmts.rst:547 +#: ../../reference/compound_stmts.rst:550 msgid "" "With more than one item, the context managers are processed as if multiple :" "keyword:`with` statements were nested::" msgstr "" -#: ../../reference/compound_stmts.rst:550 +#: ../../reference/compound_stmts.rst:553 msgid "" "with A() as a, B() as b:\n" " SUITE" @@ -673,7 +679,7 @@ msgstr "" "with A() as a, B() as b:\n" " SUITE" -#: ../../reference/compound_stmts.rst:555 +#: ../../reference/compound_stmts.rst:558 msgid "" "with A() as a:\n" " with B() as b:\n" @@ -683,13 +689,13 @@ msgstr "" " with B() as b:\n" " SUITE" -#: ../../reference/compound_stmts.rst:559 +#: ../../reference/compound_stmts.rst:562 msgid "" "You can also write multi-item context managers in multiple lines if the " "items are surrounded by parentheses. For example::" msgstr "" -#: ../../reference/compound_stmts.rst:562 +#: ../../reference/compound_stmts.rst:565 msgid "" "with (\n" " A() as a,\n" @@ -703,88 +709,88 @@ msgstr "" "):\n" " SUITE" -#: ../../reference/compound_stmts.rst:568 +#: ../../reference/compound_stmts.rst:571 msgid "Support for multiple context expressions." msgstr "" -#: ../../reference/compound_stmts.rst:571 +#: ../../reference/compound_stmts.rst:574 msgid "" "Support for using grouping parentheses to break the statement in multiple " "lines." msgstr "" -#: ../../reference/compound_stmts.rst:576 +#: ../../reference/compound_stmts.rst:579 msgid ":pep:`343` - The \"with\" statement" msgstr "" -#: ../../reference/compound_stmts.rst:577 +#: ../../reference/compound_stmts.rst:580 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/compound_stmts.rst:583 +#: ../../reference/compound_stmts.rst:586 msgid "The :keyword:`!match` statement" msgstr ":keyword:`!match` 陳述式" -#: ../../reference/compound_stmts.rst:597 +#: ../../reference/compound_stmts.rst:600 msgid "The match statement is used for pattern matching. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:606 +#: ../../reference/compound_stmts.rst:609 msgid "" "This section uses single quotes to denote :ref:`soft keywords <soft-" "keywords>`." msgstr "" -#: ../../reference/compound_stmts.rst:609 +#: ../../reference/compound_stmts.rst:612 msgid "" "Pattern matching takes a pattern as input (following ``case``) and a subject " "value (following ``match``). The pattern (which may contain subpatterns) is " "matched against the subject value. The outcomes are:" msgstr "" -#: ../../reference/compound_stmts.rst:613 +#: ../../reference/compound_stmts.rst:616 msgid "A match success or failure (also termed a pattern success or failure)." msgstr "" -#: ../../reference/compound_stmts.rst:615 +#: ../../reference/compound_stmts.rst:618 msgid "" "Possible binding of matched values to a name. The prerequisites for this " "are further discussed below." msgstr "" -#: ../../reference/compound_stmts.rst:618 +#: ../../reference/compound_stmts.rst:621 msgid "" "The ``match`` and ``case`` keywords are :ref:`soft keywords <soft-keywords>`." msgstr "" -#: ../../reference/compound_stmts.rst:622 -#: ../../reference/compound_stmts.rst:1179 +#: ../../reference/compound_stmts.rst:625 +#: ../../reference/compound_stmts.rst:1182 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: ../../reference/compound_stmts.rst:623 -#: ../../reference/compound_stmts.rst:1180 +#: ../../reference/compound_stmts.rst:626 +#: ../../reference/compound_stmts.rst:1183 msgid ":pep:`636` -- Structural Pattern Matching: Tutorial" msgstr "" -#: ../../reference/compound_stmts.rst:627 +#: ../../reference/compound_stmts.rst:630 msgid "Overview" msgstr "" -#: ../../reference/compound_stmts.rst:629 +#: ../../reference/compound_stmts.rst:632 msgid "Here's an overview of the logical flow of a match statement:" msgstr "" -#: ../../reference/compound_stmts.rst:632 +#: ../../reference/compound_stmts.rst:635 msgid "" "The subject expression ``subject_expr`` is evaluated and a resulting subject " "value obtained. If the subject expression contains a comma, a tuple is " "constructed using :ref:`the standard rules <typesseq-tuple>`." msgstr "" -#: ../../reference/compound_stmts.rst:636 +#: ../../reference/compound_stmts.rst:639 msgid "" "Each pattern in a ``case_block`` is attempted to match with the subject " "value. The specific rules for success or failure are described below. The " @@ -794,7 +800,7 @@ msgid "" "outlive the executed block and can be used after the match statement**." msgstr "" -#: ../../reference/compound_stmts.rst:645 +#: ../../reference/compound_stmts.rst:648 msgid "" "During failed pattern matches, some subpatterns may succeed. Do not rely on " "bindings being made for a failed match. Conversely, do not rely on " @@ -803,38 +809,38 @@ msgid "" "made to allow different implementations to add optimizations." msgstr "" -#: ../../reference/compound_stmts.rst:652 +#: ../../reference/compound_stmts.rst:655 msgid "" "If the pattern succeeds, the corresponding guard (if present) is evaluated. " "In this case all name bindings are guaranteed to have happened." msgstr "" -#: ../../reference/compound_stmts.rst:655 +#: ../../reference/compound_stmts.rst:658 msgid "" "If the guard evaluates as true or is missing, the ``block`` inside " "``case_block`` is executed." msgstr "" -#: ../../reference/compound_stmts.rst:658 +#: ../../reference/compound_stmts.rst:661 msgid "Otherwise, the next ``case_block`` is attempted as described above." msgstr "" -#: ../../reference/compound_stmts.rst:660 +#: ../../reference/compound_stmts.rst:663 msgid "If there are no further case blocks, the match statement is completed." msgstr "" -#: ../../reference/compound_stmts.rst:664 +#: ../../reference/compound_stmts.rst:667 msgid "" "Users should generally never rely on a pattern being evaluated. Depending " "on implementation, the interpreter may cache values or use other " "optimizations which skip repeated evaluations." msgstr "" -#: ../../reference/compound_stmts.rst:668 +#: ../../reference/compound_stmts.rst:671 msgid "A sample match statement::" msgstr "" -#: ../../reference/compound_stmts.rst:670 +#: ../../reference/compound_stmts.rst:673 msgid "" ">>> flag = False\n" ">>> match (100, 200):\n" @@ -850,56 +856,56 @@ msgid "" "Case 3, y: 200" msgstr "" -#: ../../reference/compound_stmts.rst:684 +#: ../../reference/compound_stmts.rst:687 msgid "" "In this case, ``if flag`` is a guard. Read more about that in the next " "section." msgstr "" -#: ../../reference/compound_stmts.rst:687 +#: ../../reference/compound_stmts.rst:690 msgid "Guards" msgstr "" -#: ../../reference/compound_stmts.rst:694 +#: ../../reference/compound_stmts.rst:697 msgid "" "A ``guard`` (which is part of the ``case``) must succeed for code inside the " "``case`` block to execute. It takes the form: :keyword:`if` followed by an " "expression." msgstr "" -#: ../../reference/compound_stmts.rst:699 +#: ../../reference/compound_stmts.rst:702 msgid "The logical flow of a ``case`` block with a ``guard`` follows:" msgstr "" -#: ../../reference/compound_stmts.rst:701 +#: ../../reference/compound_stmts.rst:704 msgid "" "Check that the pattern in the ``case`` block succeeded. If the pattern " "failed, the ``guard`` is not evaluated and the next ``case`` block is " "checked." msgstr "" -#: ../../reference/compound_stmts.rst:705 +#: ../../reference/compound_stmts.rst:708 msgid "If the pattern succeeded, evaluate the ``guard``." msgstr "" -#: ../../reference/compound_stmts.rst:707 +#: ../../reference/compound_stmts.rst:710 msgid "" "If the ``guard`` condition evaluates as true, the case block is selected." msgstr "" -#: ../../reference/compound_stmts.rst:710 +#: ../../reference/compound_stmts.rst:713 msgid "" "If the ``guard`` condition evaluates as false, the case block is not " "selected." msgstr "" -#: ../../reference/compound_stmts.rst:713 +#: ../../reference/compound_stmts.rst:716 msgid "" "If the ``guard`` raises an exception during evaluation, the exception " "bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:716 +#: ../../reference/compound_stmts.rst:719 msgid "" "Guards are allowed to have side effects as they are expressions. Guard " "evaluation must proceed from the first to the last case block, one at a " @@ -908,17 +914,17 @@ msgid "" "block is selected." msgstr "" -#: ../../reference/compound_stmts.rst:726 +#: ../../reference/compound_stmts.rst:729 msgid "Irrefutable Case Blocks" msgstr "" -#: ../../reference/compound_stmts.rst:730 +#: ../../reference/compound_stmts.rst:733 msgid "" "An irrefutable case block is a match-all case block. A match statement may " "have at most one irrefutable case block, and it must be last." msgstr "" -#: ../../reference/compound_stmts.rst:733 +#: ../../reference/compound_stmts.rst:736 msgid "" "A case block is considered irrefutable if it has no guard and its pattern is " "irrefutable. A pattern is considered irrefutable if we can prove from its " @@ -926,47 +932,47 @@ msgid "" "irrefutable:" msgstr "" -#: ../../reference/compound_stmts.rst:738 +#: ../../reference/compound_stmts.rst:741 msgid ":ref:`as-patterns` whose left-hand side is irrefutable" msgstr "" -#: ../../reference/compound_stmts.rst:740 +#: ../../reference/compound_stmts.rst:743 msgid ":ref:`or-patterns` containing at least one irrefutable pattern" msgstr "" -#: ../../reference/compound_stmts.rst:742 +#: ../../reference/compound_stmts.rst:745 msgid ":ref:`capture-patterns`" msgstr ":ref:`capture-patterns`" -#: ../../reference/compound_stmts.rst:744 +#: ../../reference/compound_stmts.rst:747 msgid ":ref:`wildcard-patterns`" msgstr ":ref:`wildcard-patterns`" -#: ../../reference/compound_stmts.rst:746 +#: ../../reference/compound_stmts.rst:749 msgid "parenthesized irrefutable patterns" msgstr "" -#: ../../reference/compound_stmts.rst:750 +#: ../../reference/compound_stmts.rst:753 msgid "Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:757 +#: ../../reference/compound_stmts.rst:760 msgid "This section uses grammar notations beyond standard EBNF:" msgstr "" -#: ../../reference/compound_stmts.rst:759 +#: ../../reference/compound_stmts.rst:762 msgid "the notation ``SEP.RULE+`` is shorthand for ``RULE (SEP RULE)*``" msgstr "" -#: ../../reference/compound_stmts.rst:761 +#: ../../reference/compound_stmts.rst:764 msgid "the notation ``!RULE`` is shorthand for a negative lookahead assertion" msgstr "" -#: ../../reference/compound_stmts.rst:764 +#: ../../reference/compound_stmts.rst:767 msgid "The top-level syntax for ``patterns`` is:" msgstr "" -#: ../../reference/compound_stmts.rst:778 +#: ../../reference/compound_stmts.rst:781 msgid "" "The descriptions below will include a description \"in simple terms\" of " "what a pattern does for illustration purposes (credits to Raymond Hettinger " @@ -976,70 +982,70 @@ msgid "" "forms." msgstr "" -#: ../../reference/compound_stmts.rst:788 +#: ../../reference/compound_stmts.rst:791 msgid "OR Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:790 +#: ../../reference/compound_stmts.rst:793 msgid "" "An OR pattern is two or more patterns separated by vertical bars ``|``. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:796 +#: ../../reference/compound_stmts.rst:799 msgid "" "Only the final subpattern may be :ref:`irrefutable <irrefutable_case>`, and " "each subpattern must bind the same set of names to avoid ambiguity." msgstr "" -#: ../../reference/compound_stmts.rst:799 +#: ../../reference/compound_stmts.rst:802 msgid "" "An OR pattern matches each of its subpatterns in turn to the subject value, " "until one succeeds. The OR pattern is then considered successful. " "Otherwise, if none of the subpatterns succeed, the OR pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:803 +#: ../../reference/compound_stmts.rst:806 msgid "" "In simple terms, ``P1 | P2 | ...`` will try to match ``P1``, if it fails it " "will try to match ``P2``, succeeding immediately if any succeeds, failing " "otherwise." msgstr "" -#: ../../reference/compound_stmts.rst:809 +#: ../../reference/compound_stmts.rst:812 msgid "AS Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:811 +#: ../../reference/compound_stmts.rst:814 msgid "" "An AS pattern matches an OR pattern on the left of the :keyword:`as` keyword " "against a subject. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:817 +#: ../../reference/compound_stmts.rst:820 msgid "" "If the OR pattern fails, the AS pattern fails. Otherwise, the AS pattern " "binds the subject to the name on the right of the as keyword and succeeds. " "``capture_pattern`` cannot be a ``_``." msgstr "" -#: ../../reference/compound_stmts.rst:821 +#: ../../reference/compound_stmts.rst:824 msgid "" "In simple terms ``P as NAME`` will match with ``P``, and on success it will " "set ``NAME = <subject>``." msgstr "" -#: ../../reference/compound_stmts.rst:828 +#: ../../reference/compound_stmts.rst:831 msgid "Literal Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:830 +#: ../../reference/compound_stmts.rst:833 msgid "" "A literal pattern corresponds to most :ref:`literals <literals>` in Python. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:843 +#: ../../reference/compound_stmts.rst:846 msgid "" "The rule ``strings`` and the token ``NUMBER`` are defined in the :doc:" "`standard Python grammar <./grammar>`. Triple-quoted strings are " @@ -1047,42 +1053,42 @@ msgid "" "are not supported." msgstr "" -#: ../../reference/compound_stmts.rst:848 +#: ../../reference/compound_stmts.rst:851 msgid "" "The forms ``signed_number '+' NUMBER`` and ``signed_number '-' NUMBER`` are " "for expressing :ref:`complex numbers <imaginary>`; they require a real " "number on the left and an imaginary number on the right. E.g. ``3 + 4j``." msgstr "" -#: ../../reference/compound_stmts.rst:852 +#: ../../reference/compound_stmts.rst:855 msgid "" "In simple terms, ``LITERAL`` will succeed only if ``<subject> == LITERAL``. " "For the singletons ``None``, ``True`` and ``False``, the :keyword:`is` " "operator is used." msgstr "" -#: ../../reference/compound_stmts.rst:858 +#: ../../reference/compound_stmts.rst:861 msgid "Capture Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:860 +#: ../../reference/compound_stmts.rst:863 msgid "A capture pattern binds the subject value to a name. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:866 +#: ../../reference/compound_stmts.rst:869 msgid "" "A single underscore ``_`` is not a capture pattern (this is what ``!'_'`` " "expresses). It is instead treated as a :token:`~python-grammar:" "wildcard_pattern`." msgstr "" -#: ../../reference/compound_stmts.rst:870 +#: ../../reference/compound_stmts.rst:873 msgid "" "In a given pattern, a given name can only be bound once. E.g. ``case x, " "x: ...`` is invalid while ``case [x] | x: ...`` is allowed." msgstr "" -#: ../../reference/compound_stmts.rst:873 +#: ../../reference/compound_stmts.rst:876 msgid "" "Capture patterns always succeed. The binding follows scoping rules " "established by the assignment expression operator in :pep:`572`; the name " @@ -1090,55 +1096,55 @@ msgid "" "there's an applicable :keyword:`global` or :keyword:`nonlocal` statement." msgstr "" -#: ../../reference/compound_stmts.rst:878 +#: ../../reference/compound_stmts.rst:881 msgid "" "In simple terms ``NAME`` will always succeed and it will set ``NAME = " "<subject>``." msgstr "" -#: ../../reference/compound_stmts.rst:883 +#: ../../reference/compound_stmts.rst:886 msgid "Wildcard Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:885 +#: ../../reference/compound_stmts.rst:888 msgid "" "A wildcard pattern always succeeds (matches anything) and binds no name. " "Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:891 +#: ../../reference/compound_stmts.rst:894 msgid "" "``_`` is a :ref:`soft keyword <soft-keywords>` within any pattern, but only " "within patterns. It is an identifier, as usual, even within ``match`` " "subject expressions, ``guard``\\ s, and ``case`` blocks." msgstr "" -#: ../../reference/compound_stmts.rst:895 +#: ../../reference/compound_stmts.rst:898 msgid "In simple terms, ``_`` will always succeed." msgstr "" -#: ../../reference/compound_stmts.rst:900 +#: ../../reference/compound_stmts.rst:903 msgid "Value Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:902 +#: ../../reference/compound_stmts.rst:905 msgid "A value pattern represents a named value in Python. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:910 +#: ../../reference/compound_stmts.rst:913 msgid "" "The dotted name in the pattern is looked up using standard Python :ref:`name " "resolution rules <resolve_names>`. The pattern succeeds if the value found " "compares equal to the subject value (using the ``==`` equality operator)." msgstr "" -#: ../../reference/compound_stmts.rst:915 +#: ../../reference/compound_stmts.rst:918 msgid "" "In simple terms ``NAME1.NAME2`` will succeed only if ``<subject> == NAME1." "NAME2``" msgstr "" -#: ../../reference/compound_stmts.rst:919 +#: ../../reference/compound_stmts.rst:922 msgid "" "If the same value occurs multiple times in the same match statement, the " "interpreter may cache the first value found and reuse it rather than repeat " @@ -1146,44 +1152,44 @@ msgid "" "given match statement." msgstr "" -#: ../../reference/compound_stmts.rst:927 +#: ../../reference/compound_stmts.rst:930 msgid "Group Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:929 +#: ../../reference/compound_stmts.rst:932 msgid "" "A group pattern allows users to add parentheses around patterns to emphasize " "the intended grouping. Otherwise, it has no additional syntax. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:936 +#: ../../reference/compound_stmts.rst:939 msgid "In simple terms ``(P)`` has the same effect as ``P``." msgstr "" -#: ../../reference/compound_stmts.rst:941 +#: ../../reference/compound_stmts.rst:944 msgid "Sequence Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:943 +#: ../../reference/compound_stmts.rst:946 msgid "" "A sequence pattern contains several subpatterns to be matched against " "sequence elements. The syntax is similar to the unpacking of a list or tuple." msgstr "" -#: ../../reference/compound_stmts.rst:954 +#: ../../reference/compound_stmts.rst:957 msgid "" "There is no difference if parentheses or square brackets are used for " "sequence patterns (i.e. ``(...)`` vs ``[...]`` )." msgstr "" -#: ../../reference/compound_stmts.rst:958 +#: ../../reference/compound_stmts.rst:961 msgid "" "A single pattern enclosed in parentheses without a trailing comma (e.g. ``(3 " "| 4)``) is a :ref:`group pattern <group-patterns>`. While a single pattern " "enclosed in square brackets (e.g. ``[3 | 4]``) is still a sequence pattern." msgstr "" -#: ../../reference/compound_stmts.rst:963 +#: ../../reference/compound_stmts.rst:966 msgid "" "At most one star subpattern may be in a sequence pattern. The star " "subpattern may occur in any position. If no star subpattern is present, the " @@ -1191,40 +1197,40 @@ msgid "" "variable-length sequence pattern." msgstr "" -#: ../../reference/compound_stmts.rst:968 +#: ../../reference/compound_stmts.rst:971 msgid "" "The following is the logical flow for matching a sequence pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:971 +#: ../../reference/compound_stmts.rst:974 msgid "" "If the subject value is not a sequence [#]_, the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:974 +#: ../../reference/compound_stmts.rst:977 msgid "" "If the subject value is an instance of ``str``, ``bytes`` or ``bytearray`` " "the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:977 +#: ../../reference/compound_stmts.rst:980 msgid "" "The subsequent steps depend on whether the sequence pattern is fixed or " "variable-length." msgstr "" -#: ../../reference/compound_stmts.rst:980 +#: ../../reference/compound_stmts.rst:983 msgid "If the sequence pattern is fixed-length:" msgstr "" -#: ../../reference/compound_stmts.rst:982 +#: ../../reference/compound_stmts.rst:985 msgid "" "If the length of the subject sequence is not equal to the number of " "subpatterns, the sequence pattern fails" msgstr "" -#: ../../reference/compound_stmts.rst:985 +#: ../../reference/compound_stmts.rst:988 msgid "" "Subpatterns in the sequence pattern are matched to their corresponding items " "in the subject sequence from left to right. Matching stops as soon as a " @@ -1232,118 +1238,118 @@ msgid "" "corresponding item, the sequence pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:990 +#: ../../reference/compound_stmts.rst:993 msgid "Otherwise, if the sequence pattern is variable-length:" msgstr "" -#: ../../reference/compound_stmts.rst:992 +#: ../../reference/compound_stmts.rst:995 msgid "" "If the length of the subject sequence is less than the number of non-star " "subpatterns, the sequence pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:995 +#: ../../reference/compound_stmts.rst:998 msgid "" "The leading non-star subpatterns are matched to their corresponding items as " "for fixed-length sequences." msgstr "" -#: ../../reference/compound_stmts.rst:998 +#: ../../reference/compound_stmts.rst:1001 msgid "" "If the previous step succeeds, the star subpattern matches a list formed of " "the remaining subject items, excluding the remaining items corresponding to " "non-star subpatterns following the star subpattern." msgstr "" -#: ../../reference/compound_stmts.rst:1002 +#: ../../reference/compound_stmts.rst:1005 msgid "" "Remaining non-star subpatterns are matched to their corresponding subject " "items, as for a fixed-length sequence." msgstr "" -#: ../../reference/compound_stmts.rst:1005 +#: ../../reference/compound_stmts.rst:1008 msgid "" "The length of the subject sequence is obtained via :func:`len` (i.e. via " "the :meth:`__len__` protocol). This length may be cached by the interpreter " "in a similar manner as :ref:`value patterns <value-patterns>`." msgstr "" -#: ../../reference/compound_stmts.rst:1011 +#: ../../reference/compound_stmts.rst:1014 msgid "" "In simple terms ``[P1, P2, P3,`` ... ``, P<N>]`` matches only if all the " "following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1014 +#: ../../reference/compound_stmts.rst:1017 msgid "check ``<subject>`` is a sequence" msgstr "" -#: ../../reference/compound_stmts.rst:1015 +#: ../../reference/compound_stmts.rst:1018 msgid "``len(subject) == <N>``" msgstr "``len(subject) == <N>``" -#: ../../reference/compound_stmts.rst:1016 +#: ../../reference/compound_stmts.rst:1019 msgid "" "``P1`` matches ``<subject>[0]`` (note that this match can also bind names)" msgstr "" -#: ../../reference/compound_stmts.rst:1017 +#: ../../reference/compound_stmts.rst:1020 msgid "" "``P2`` matches ``<subject>[1]`` (note that this match can also bind names)" msgstr "" -#: ../../reference/compound_stmts.rst:1018 +#: ../../reference/compound_stmts.rst:1021 msgid "... and so on for the corresponding pattern/element." msgstr "" -#: ../../reference/compound_stmts.rst:1023 +#: ../../reference/compound_stmts.rst:1026 msgid "Mapping Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:1025 +#: ../../reference/compound_stmts.rst:1028 msgid "" "A mapping pattern contains one or more key-value patterns. The syntax is " "similar to the construction of a dictionary. Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:1036 +#: ../../reference/compound_stmts.rst:1039 msgid "" "At most one double star pattern may be in a mapping pattern. The double " "star pattern must be the last subpattern in the mapping pattern." msgstr "" -#: ../../reference/compound_stmts.rst:1039 +#: ../../reference/compound_stmts.rst:1042 msgid "" "Duplicate keys in mapping patterns are disallowed. Duplicate literal keys " "will raise a :exc:`SyntaxError`. Two keys that otherwise have the same value " "will raise a :exc:`ValueError` at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1043 +#: ../../reference/compound_stmts.rst:1046 msgid "" "The following is the logical flow for matching a mapping pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:1046 +#: ../../reference/compound_stmts.rst:1049 msgid "If the subject value is not a mapping [#]_,the mapping pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:1048 +#: ../../reference/compound_stmts.rst:1051 msgid "" "If every key given in the mapping pattern is present in the subject mapping, " "and the pattern for each key matches the corresponding item of the subject " "mapping, the mapping pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:1052 +#: ../../reference/compound_stmts.rst:1055 msgid "" "If duplicate keys are detected in the mapping pattern, the pattern is " "considered invalid. A :exc:`SyntaxError` is raised for duplicate literal " "values; or a :exc:`ValueError` for named keys of the same value." msgstr "" -#: ../../reference/compound_stmts.rst:1056 +#: ../../reference/compound_stmts.rst:1059 msgid "" "Key-value pairs are matched using the two-argument form of the mapping " "subject's ``get()`` method. Matched key-value pairs must already be present " @@ -1351,256 +1357,256 @@ msgid "" "`~object.__getitem__`." msgstr "" -#: ../../reference/compound_stmts.rst:1061 +#: ../../reference/compound_stmts.rst:1064 msgid "" "In simple terms ``{KEY1: P1, KEY2: P2, ... }`` matches only if all the " "following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1064 +#: ../../reference/compound_stmts.rst:1067 msgid "check ``<subject>`` is a mapping" msgstr "" -#: ../../reference/compound_stmts.rst:1065 +#: ../../reference/compound_stmts.rst:1068 msgid "``KEY1 in <subject>``" msgstr "``KEY1 in <subject>``" -#: ../../reference/compound_stmts.rst:1066 +#: ../../reference/compound_stmts.rst:1069 msgid "``P1`` matches ``<subject>[KEY1]``" msgstr "" -#: ../../reference/compound_stmts.rst:1067 +#: ../../reference/compound_stmts.rst:1070 msgid "... and so on for the corresponding KEY/pattern pair." msgstr "" -#: ../../reference/compound_stmts.rst:1073 +#: ../../reference/compound_stmts.rst:1076 msgid "Class Patterns" msgstr "" -#: ../../reference/compound_stmts.rst:1075 +#: ../../reference/compound_stmts.rst:1078 msgid "" "A class pattern represents a class and its positional and keyword arguments " "(if any). Syntax:" msgstr "" -#: ../../reference/compound_stmts.rst:1086 +#: ../../reference/compound_stmts.rst:1089 msgid "The same keyword should not be repeated in class patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1088 +#: ../../reference/compound_stmts.rst:1091 msgid "" "The following is the logical flow for matching a class pattern against a " "subject value:" msgstr "" -#: ../../reference/compound_stmts.rst:1091 +#: ../../reference/compound_stmts.rst:1094 msgid "" "If ``name_or_attr`` is not an instance of the builtin :class:`type` , raise :" "exc:`TypeError`." msgstr "" -#: ../../reference/compound_stmts.rst:1094 +#: ../../reference/compound_stmts.rst:1097 msgid "" "If the subject value is not an instance of ``name_or_attr`` (tested via :" "func:`isinstance`), the class pattern fails." msgstr "" -#: ../../reference/compound_stmts.rst:1097 +#: ../../reference/compound_stmts.rst:1100 msgid "" "If no pattern arguments are present, the pattern succeeds. Otherwise, the " "subsequent steps depend on whether keyword or positional argument patterns " "are present." msgstr "" -#: ../../reference/compound_stmts.rst:1101 +#: ../../reference/compound_stmts.rst:1104 msgid "" "For a number of built-in types (specified below), a single positional " "subpattern is accepted which will match the entire subject; for these types " "keyword patterns also work as for other types." msgstr "" -#: ../../reference/compound_stmts.rst:1105 +#: ../../reference/compound_stmts.rst:1108 msgid "" "If only keyword patterns are present, they are processed as follows, one by " "one:" msgstr "" -#: ../../reference/compound_stmts.rst:1108 +#: ../../reference/compound_stmts.rst:1111 msgid "I. The keyword is looked up as an attribute on the subject." msgstr "" -#: ../../reference/compound_stmts.rst:1110 +#: ../../reference/compound_stmts.rst:1113 msgid "" "If this raises an exception other than :exc:`AttributeError`, the exception " "bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:1113 +#: ../../reference/compound_stmts.rst:1116 msgid "If this raises :exc:`AttributeError`, the class pattern has failed." msgstr "" -#: ../../reference/compound_stmts.rst:1115 +#: ../../reference/compound_stmts.rst:1118 msgid "" "Else, the subpattern associated with the keyword pattern is matched against " "the subject's attribute value. If this fails, the class pattern fails; if " "this succeeds, the match proceeds to the next keyword." msgstr "" -#: ../../reference/compound_stmts.rst:1120 +#: ../../reference/compound_stmts.rst:1123 msgid "II. If all keyword patterns succeed, the class pattern succeeds." msgstr "" -#: ../../reference/compound_stmts.rst:1122 +#: ../../reference/compound_stmts.rst:1125 msgid "" "If any positional patterns are present, they are converted to keyword " "patterns using the :data:`~object.__match_args__` attribute on the class " "``name_or_attr`` before matching:" msgstr "" -#: ../../reference/compound_stmts.rst:1126 +#: ../../reference/compound_stmts.rst:1129 msgid "" "I. The equivalent of ``getattr(cls, \"__match_args__\", ())`` is called." msgstr "" -#: ../../reference/compound_stmts.rst:1128 +#: ../../reference/compound_stmts.rst:1131 msgid "If this raises an exception, the exception bubbles up." msgstr "" -#: ../../reference/compound_stmts.rst:1130 +#: ../../reference/compound_stmts.rst:1133 msgid "" "If the returned value is not a tuple, the conversion fails and :exc:" "`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1133 +#: ../../reference/compound_stmts.rst:1136 msgid "" "If there are more positional patterns than ``len(cls.__match_args__)``, :exc:" "`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1136 +#: ../../reference/compound_stmts.rst:1139 msgid "" "Otherwise, positional pattern ``i`` is converted to a keyword pattern using " "``__match_args__[i]`` as the keyword. ``__match_args__[i]`` must be a " "string; if not :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1140 +#: ../../reference/compound_stmts.rst:1143 msgid "If there are duplicate keywords, :exc:`TypeError` is raised." msgstr "" -#: ../../reference/compound_stmts.rst:1142 +#: ../../reference/compound_stmts.rst:1145 msgid ":ref:`class-pattern-matching`" msgstr ":ref:`class-pattern-matching`" -#: ../../reference/compound_stmts.rst:1144 +#: ../../reference/compound_stmts.rst:1147 msgid "" "II. Once all positional patterns have been converted to keyword patterns," msgstr "" -#: ../../reference/compound_stmts.rst:1145 +#: ../../reference/compound_stmts.rst:1148 msgid "the match proceeds as if there were only keyword patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1147 +#: ../../reference/compound_stmts.rst:1150 msgid "" "For the following built-in types the handling of positional subpatterns is " "different:" msgstr "" -#: ../../reference/compound_stmts.rst:1150 +#: ../../reference/compound_stmts.rst:1153 msgid ":class:`bool`" msgstr ":class:`bool`" -#: ../../reference/compound_stmts.rst:1151 +#: ../../reference/compound_stmts.rst:1154 msgid ":class:`bytearray`" msgstr ":class:`bytearray`" -#: ../../reference/compound_stmts.rst:1152 +#: ../../reference/compound_stmts.rst:1155 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../reference/compound_stmts.rst:1153 +#: ../../reference/compound_stmts.rst:1156 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../reference/compound_stmts.rst:1154 +#: ../../reference/compound_stmts.rst:1157 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../reference/compound_stmts.rst:1155 +#: ../../reference/compound_stmts.rst:1158 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../reference/compound_stmts.rst:1156 +#: ../../reference/compound_stmts.rst:1159 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../reference/compound_stmts.rst:1157 -#: ../../reference/compound_stmts.rst:1875 +#: ../../reference/compound_stmts.rst:1160 +#: ../../reference/compound_stmts.rst:1878 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../reference/compound_stmts.rst:1158 +#: ../../reference/compound_stmts.rst:1161 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../reference/compound_stmts.rst:1159 +#: ../../reference/compound_stmts.rst:1162 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../reference/compound_stmts.rst:1160 -#: ../../reference/compound_stmts.rst:1878 +#: ../../reference/compound_stmts.rst:1163 +#: ../../reference/compound_stmts.rst:1881 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../reference/compound_stmts.rst:1162 +#: ../../reference/compound_stmts.rst:1165 msgid "" "These classes accept a single positional argument, and the pattern there is " "matched against the whole object rather than an attribute. For example " "``int(0|1)`` matches the value ``0``, but not the value ``0.0``." msgstr "" -#: ../../reference/compound_stmts.rst:1166 +#: ../../reference/compound_stmts.rst:1169 msgid "" "In simple terms ``CLS(P1, attr=P2)`` matches only if the following happens:" msgstr "" -#: ../../reference/compound_stmts.rst:1168 +#: ../../reference/compound_stmts.rst:1171 msgid "``isinstance(<subject>, CLS)``" msgstr "``isinstance(<subject>, CLS)``" -#: ../../reference/compound_stmts.rst:1169 +#: ../../reference/compound_stmts.rst:1172 msgid "convert ``P1`` to a keyword pattern using ``CLS.__match_args__``" msgstr "" -#: ../../reference/compound_stmts.rst:1170 +#: ../../reference/compound_stmts.rst:1173 msgid "For each keyword argument ``attr=P2``:" msgstr "" -#: ../../reference/compound_stmts.rst:1172 +#: ../../reference/compound_stmts.rst:1175 msgid "``hasattr(<subject>, \"attr\")``" msgstr "``hasattr(<subject>, \"attr\")``" -#: ../../reference/compound_stmts.rst:1173 +#: ../../reference/compound_stmts.rst:1176 msgid "``P2`` matches ``<subject>.attr``" msgstr "" -#: ../../reference/compound_stmts.rst:1175 +#: ../../reference/compound_stmts.rst:1178 msgid "... and so on for the corresponding keyword argument/pattern pair." msgstr "" -#: ../../reference/compound_stmts.rst:1190 +#: ../../reference/compound_stmts.rst:1193 msgid "Function definitions" msgstr "函式定義" -#: ../../reference/compound_stmts.rst:1205 +#: ../../reference/compound_stmts.rst:1208 msgid "" "A function definition defines a user-defined function object (see section :" "ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1225 +#: ../../reference/compound_stmts.rst:1228 msgid "" "A function definition is an executable statement. Its execution binds the " "function name in the current local namespace to a function object (a wrapper " @@ -1609,13 +1615,13 @@ msgid "" "used when the function is called." msgstr "" -#: ../../reference/compound_stmts.rst:1231 +#: ../../reference/compound_stmts.rst:1234 msgid "" "The function definition does not execute the function body; this gets " "executed only when the function is called. [#]_" msgstr "" -#: ../../reference/compound_stmts.rst:1237 +#: ../../reference/compound_stmts.rst:1240 msgid "" "A function definition may be wrapped by one or more :term:`decorator` " "expressions. Decorator expressions are evaluated when the function is " @@ -1626,7 +1632,7 @@ msgid "" "example, the following code ::" msgstr "" -#: ../../reference/compound_stmts.rst:1244 +#: ../../reference/compound_stmts.rst:1247 msgid "" "@f1(arg)\n" "@f2\n" @@ -1636,12 +1642,12 @@ msgstr "" "@f2\n" "def func(): pass" -#: ../../reference/compound_stmts.rst:1248 -#: ../../reference/compound_stmts.rst:1443 +#: ../../reference/compound_stmts.rst:1251 +#: ../../reference/compound_stmts.rst:1446 msgid "is roughly equivalent to ::" msgstr "大致等價於: ::" -#: ../../reference/compound_stmts.rst:1250 +#: ../../reference/compound_stmts.rst:1253 msgid "" "def func(): pass\n" "func = f1(arg)(f2(func))" @@ -1649,20 +1655,20 @@ msgstr "" "def func(): pass\n" "func = f1(arg)(f2(func))" -#: ../../reference/compound_stmts.rst:1253 +#: ../../reference/compound_stmts.rst:1256 msgid "" "except that the original function is not temporarily bound to the name " "``func``." msgstr "" -#: ../../reference/compound_stmts.rst:1255 +#: ../../reference/compound_stmts.rst:1258 msgid "" "Functions may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1260 +#: ../../reference/compound_stmts.rst:1263 msgid "" "A list of :ref:`type parameters <type-params>` may be given in square " "brackets between the function's name and the opening parenthesis for its " @@ -1672,12 +1678,12 @@ msgid "" "functions` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1267 -#: ../../reference/compound_stmts.rst:1462 +#: ../../reference/compound_stmts.rst:1270 +#: ../../reference/compound_stmts.rst:1465 msgid "Type parameter lists are new in Python 3.12." msgstr "" -#: ../../reference/compound_stmts.rst:1275 +#: ../../reference/compound_stmts.rst:1278 msgid "" "When one or more :term:`parameters <parameter>` have the form *parameter* " "``=`` *expression*, the function is said to have \"default parameter values." @@ -1688,7 +1694,7 @@ msgid "" "syntactic restriction that is not expressed by the grammar." msgstr "" -#: ../../reference/compound_stmts.rst:1283 +#: ../../reference/compound_stmts.rst:1286 msgid "" "**Default parameter values are evaluated from left to right when the " "function definition is executed.** This means that the expression is " @@ -1701,7 +1707,7 @@ msgid "" "the default, and explicitly test for it in the body of the function, e.g.::" msgstr "" -#: ../../reference/compound_stmts.rst:1293 +#: ../../reference/compound_stmts.rst:1296 msgid "" "def whats_on_the_telly(penguin=None):\n" " if penguin is None:\n" @@ -1710,7 +1716,7 @@ msgid "" " return penguin" msgstr "" -#: ../../reference/compound_stmts.rst:1304 +#: ../../reference/compound_stmts.rst:1307 msgid "" "Function call semantics are described in more detail in section :ref:" "`calls`. A function call always assigns values to all parameters mentioned " @@ -1726,13 +1732,13 @@ msgid "" "positional arguments." msgstr "" -#: ../../reference/compound_stmts.rst:1316 +#: ../../reference/compound_stmts.rst:1319 msgid "" "The ``/`` function parameter syntax may be used to indicate positional-only " "parameters. See :pep:`570` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1325 +#: ../../reference/compound_stmts.rst:1328 msgid "" "Parameters may have an :term:`annotation <function annotation>` of the form " "\"``: expression``\" following the parameter name. Any parameter may have " @@ -1751,13 +1757,13 @@ msgid "" "in the source code." msgstr "" -#: ../../reference/compound_stmts.rst:1339 +#: ../../reference/compound_stmts.rst:1342 msgid "" "Parameters of the form \"``*identifier``\" may have an annotation \"``: " "*expression``\". See :pep:`646`." msgstr "" -#: ../../reference/compound_stmts.rst:1345 +#: ../../reference/compound_stmts.rst:1348 msgid "" "It is also possible to create anonymous functions (functions not bound to a " "name), for immediate use in expressions. This uses lambda expressions, " @@ -1769,7 +1775,7 @@ msgid "" "execution of multiple statements and annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1353 +#: ../../reference/compound_stmts.rst:1356 msgid "" "**Programmer's note:** Functions are first-class objects. A \"``def``\" " "statement executed inside a function definition defines a local function " @@ -1778,61 +1784,61 @@ msgid "" "See section :ref:`naming` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1361 +#: ../../reference/compound_stmts.rst:1364 msgid ":pep:`3107` - Function Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1362 +#: ../../reference/compound_stmts.rst:1365 msgid "The original specification for function annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1364 +#: ../../reference/compound_stmts.rst:1367 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/compound_stmts.rst:1365 +#: ../../reference/compound_stmts.rst:1368 msgid "Definition of a standard meaning for annotations: type hints." msgstr "" -#: ../../reference/compound_stmts.rst:1367 +#: ../../reference/compound_stmts.rst:1370 msgid ":pep:`526` - Syntax for Variable Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1368 +#: ../../reference/compound_stmts.rst:1371 msgid "" "Ability to type hint variable declarations, including class variables and " "instance variables." msgstr "" -#: ../../reference/compound_stmts.rst:1371 +#: ../../reference/compound_stmts.rst:1374 msgid ":pep:`563` - Postponed Evaluation of Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1372 +#: ../../reference/compound_stmts.rst:1375 msgid "" "Support for forward references within annotations by preserving annotations " "in a string form at runtime instead of eager evaluation." msgstr "" -#: ../../reference/compound_stmts.rst:1375 +#: ../../reference/compound_stmts.rst:1378 msgid ":pep:`318` - Decorators for Functions and Methods" msgstr "" -#: ../../reference/compound_stmts.rst:1376 +#: ../../reference/compound_stmts.rst:1379 msgid "" "Function and method decorators were introduced. Class decorators were " "introduced in :pep:`3129`." msgstr "" -#: ../../reference/compound_stmts.rst:1382 +#: ../../reference/compound_stmts.rst:1385 msgid "Class definitions" msgstr "類別定義" -#: ../../reference/compound_stmts.rst:1397 +#: ../../reference/compound_stmts.rst:1400 msgid "A class definition defines a class object (see section :ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1404 +#: ../../reference/compound_stmts.rst:1407 msgid "" "A class definition is an executable statement. The inheritance list usually " "gives a list of base classes (see :ref:`metaclasses` for more advanced " @@ -1841,7 +1847,7 @@ msgid "" "default, from the base class :class:`object`; hence, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1410 +#: ../../reference/compound_stmts.rst:1413 msgid "" "class Foo:\n" " pass" @@ -1849,11 +1855,11 @@ msgstr "" "class Foo:\n" " pass" -#: ../../reference/compound_stmts.rst:1413 +#: ../../reference/compound_stmts.rst:1416 msgid "is equivalent to ::" msgstr "" -#: ../../reference/compound_stmts.rst:1415 +#: ../../reference/compound_stmts.rst:1418 msgid "" "class Foo(object):\n" " pass" @@ -1861,7 +1867,7 @@ msgstr "" "class Foo(object):\n" " pass" -#: ../../reference/compound_stmts.rst:1418 +#: ../../reference/compound_stmts.rst:1421 msgid "" "The class's suite is then executed in a new execution frame (see :ref:" "`naming`), using a newly created local namespace and the original global " @@ -1873,7 +1879,7 @@ msgid "" "original local namespace." msgstr "" -#: ../../reference/compound_stmts.rst:1427 +#: ../../reference/compound_stmts.rst:1430 msgid "" "The order in which attributes are defined in the class body is preserved in " "the new class's :attr:`~type.__dict__`. Note that this is reliable only " @@ -1881,17 +1887,17 @@ msgid "" "using the definition syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1432 +#: ../../reference/compound_stmts.rst:1435 msgid "" "Class creation can be customized heavily using :ref:`metaclasses " "<metaclasses>`." msgstr "" -#: ../../reference/compound_stmts.rst:1437 +#: ../../reference/compound_stmts.rst:1440 msgid "Classes can also be decorated: just like when decorating functions, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1439 +#: ../../reference/compound_stmts.rst:1442 msgid "" "@f1(arg)\n" "@f2\n" @@ -1901,7 +1907,7 @@ msgstr "" "@f2\n" "class Foo: pass" -#: ../../reference/compound_stmts.rst:1445 +#: ../../reference/compound_stmts.rst:1448 msgid "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" @@ -1909,20 +1915,20 @@ msgstr "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" -#: ../../reference/compound_stmts.rst:1448 +#: ../../reference/compound_stmts.rst:1451 msgid "" "The evaluation rules for the decorator expressions are the same as for " "function decorators. The result is then bound to the class name." msgstr "" -#: ../../reference/compound_stmts.rst:1451 +#: ../../reference/compound_stmts.rst:1454 msgid "" "Classes may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1456 +#: ../../reference/compound_stmts.rst:1459 msgid "" "A list of :ref:`type parameters <type-params>` may be given in square " "brackets immediately after the class's name. This indicates to static type " @@ -1931,7 +1937,7 @@ msgid "" "`generic-classes` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1465 +#: ../../reference/compound_stmts.rst:1468 msgid "" "**Programmer's note:** Variables defined in the class definition are class " "attributes; they are shared by instances. Instance attributes can be set in " @@ -1944,35 +1950,35 @@ msgid "" "implementation details." msgstr "" -#: ../../reference/compound_stmts.rst:1477 +#: ../../reference/compound_stmts.rst:1480 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/compound_stmts.rst:1478 +#: ../../reference/compound_stmts.rst:1481 msgid "" "The proposal that changed the declaration of metaclasses to the current " "syntax, and the semantics for how classes with metaclasses are constructed." msgstr "" -#: ../../reference/compound_stmts.rst:1482 +#: ../../reference/compound_stmts.rst:1485 msgid ":pep:`3129` - Class Decorators" msgstr ":pep:`3129` - 類別裝飾器" -#: ../../reference/compound_stmts.rst:1483 +#: ../../reference/compound_stmts.rst:1486 msgid "" "The proposal that added class decorators. Function and method decorators " "were introduced in :pep:`318`." msgstr "" -#: ../../reference/compound_stmts.rst:1490 +#: ../../reference/compound_stmts.rst:1493 msgid "Coroutines" msgstr "協程" -#: ../../reference/compound_stmts.rst:1498 +#: ../../reference/compound_stmts.rst:1501 msgid "Coroutine function definition" msgstr "協程函式定義" -#: ../../reference/compound_stmts.rst:1508 +#: ../../reference/compound_stmts.rst:1511 msgid "" "Execution of Python coroutines can be suspended and resumed at many points " "(see :term:`coroutine`). :keyword:`await` expressions, :keyword:`async for` " @@ -1980,23 +1986,23 @@ msgid "" "function." msgstr "" -#: ../../reference/compound_stmts.rst:1512 +#: ../../reference/compound_stmts.rst:1515 msgid "" "Functions defined with ``async def`` syntax are always coroutine functions, " "even if they do not contain ``await`` or ``async`` keywords." msgstr "" -#: ../../reference/compound_stmts.rst:1515 +#: ../../reference/compound_stmts.rst:1518 msgid "" "It is a :exc:`SyntaxError` to use a ``yield from`` expression inside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1518 +#: ../../reference/compound_stmts.rst:1521 msgid "An example of a coroutine function::" msgstr "一個協程函式範例: ::" -#: ../../reference/compound_stmts.rst:1520 +#: ../../reference/compound_stmts.rst:1523 msgid "" "async def func(param1, param2):\n" " do_stuff()\n" @@ -2006,30 +2012,30 @@ msgstr "" " do_stuff()\n" " await some_coroutine()" -#: ../../reference/compound_stmts.rst:1524 +#: ../../reference/compound_stmts.rst:1527 msgid "" "``await`` and ``async`` are now keywords; previously they were only treated " "as such inside the body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1532 +#: ../../reference/compound_stmts.rst:1535 msgid "The :keyword:`!async for` statement" msgstr ":keyword:`!async for` 陳述式" -#: ../../reference/compound_stmts.rst:1537 +#: ../../reference/compound_stmts.rst:1540 msgid "" "An :term:`asynchronous iterable` provides an ``__aiter__`` method that " "directly returns an :term:`asynchronous iterator`, which can call " "asynchronous code in its ``__anext__`` method." msgstr "" -#: ../../reference/compound_stmts.rst:1541 +#: ../../reference/compound_stmts.rst:1544 msgid "" "The ``async for`` statement allows convenient iteration over asynchronous " "iterables." msgstr "" -#: ../../reference/compound_stmts.rst:1546 +#: ../../reference/compound_stmts.rst:1549 msgid "" "async for TARGET in ITER:\n" " SUITE\n" @@ -2041,11 +2047,11 @@ msgstr "" "else:\n" " SUITE2" -#: ../../reference/compound_stmts.rst:1551 +#: ../../reference/compound_stmts.rst:1554 msgid "Is semantically equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1553 +#: ../../reference/compound_stmts.rst:1556 msgid "" "iter = (ITER)\n" "iter = type(iter).__aiter__(iter)\n" @@ -2075,28 +2081,28 @@ msgstr "" "else:\n" " SUITE2" -#: ../../reference/compound_stmts.rst:1567 +#: ../../reference/compound_stmts.rst:1570 msgid "" "See also :meth:`~object.__aiter__` and :meth:`~object.__anext__` for details." msgstr "更多細節請見 :meth:`~object.__aiter__` 與 :meth:`~object.__anext__`。" -#: ../../reference/compound_stmts.rst:1569 +#: ../../reference/compound_stmts.rst:1572 msgid "" "It is a :exc:`SyntaxError` to use an ``async for`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1577 +#: ../../reference/compound_stmts.rst:1580 msgid "The :keyword:`!async with` statement" msgstr ":keyword:`!async with` 陳述式" -#: ../../reference/compound_stmts.rst:1582 +#: ../../reference/compound_stmts.rst:1585 msgid "" "An :term:`asynchronous context manager` is a :term:`context manager` that is " "able to suspend execution in its *enter* and *exit* methods." msgstr "" -#: ../../reference/compound_stmts.rst:1587 +#: ../../reference/compound_stmts.rst:1590 msgid "" "async with EXPRESSION as TARGET:\n" " SUITE" @@ -2104,7 +2110,7 @@ msgstr "" "async with EXPRESSION as TARGET:\n" " SUITE" -#: ../../reference/compound_stmts.rst:1592 +#: ../../reference/compound_stmts.rst:1595 msgid "" "manager = (EXPRESSION)\n" "aenter = type(manager).__aenter__\n" @@ -2140,44 +2146,44 @@ msgstr "" " if not hit_except:\n" " await aexit(manager, None, None, None)" -#: ../../reference/compound_stmts.rst:1609 +#: ../../reference/compound_stmts.rst:1612 msgid "" "See also :meth:`~object.__aenter__` and :meth:`~object.__aexit__` for " "details." msgstr "更多細節請見 :meth:`~object.__aenter__` 與 :meth:`~object.__aexit__`。" -#: ../../reference/compound_stmts.rst:1611 +#: ../../reference/compound_stmts.rst:1614 msgid "" "It is a :exc:`SyntaxError` to use an ``async with`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1616 +#: ../../reference/compound_stmts.rst:1619 msgid ":pep:`492` - Coroutines with async and await syntax" msgstr "" -#: ../../reference/compound_stmts.rst:1617 +#: ../../reference/compound_stmts.rst:1620 msgid "" "The proposal that made coroutines a proper standalone concept in Python, and " "added supporting syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1623 +#: ../../reference/compound_stmts.rst:1626 msgid "Type parameter lists" msgstr "" -#: ../../reference/compound_stmts.rst:1627 +#: ../../reference/compound_stmts.rst:1630 msgid "Support for default values was added (see :pep:`696`)." msgstr "" -#: ../../reference/compound_stmts.rst:1640 +#: ../../reference/compound_stmts.rst:1643 msgid "" ":ref:`Functions <def>` (including :ref:`coroutines <async def>`), :ref:" "`classes <class>` and :ref:`type aliases <type>` may contain a type " "parameter list::" msgstr "" -#: ../../reference/compound_stmts.rst:1644 +#: ../../reference/compound_stmts.rst:1647 msgid "" "def max[T](args: list[T]) -> T:\n" " ...\n" @@ -2209,7 +2215,7 @@ msgstr "" "\n" "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1659 +#: ../../reference/compound_stmts.rst:1662 msgid "" "Semantically, this indicates that the function, class, or type alias is " "generic over a type variable. This information is primarily used by static " @@ -2217,7 +2223,7 @@ msgid "" "generic counterparts." msgstr "" -#: ../../reference/compound_stmts.rst:1664 +#: ../../reference/compound_stmts.rst:1667 msgid "" "Type parameters are declared in square brackets (``[]``) immediately after " "the name of the function, class, or type alias. The type parameters are " @@ -2229,36 +2235,36 @@ msgid "" "wraps the creation of the generic object." msgstr "" -#: ../../reference/compound_stmts.rst:1673 +#: ../../reference/compound_stmts.rst:1676 msgid "" "Generic functions, classes, and type aliases have a :attr:`~definition." "__type_params__` attribute listing their type parameters." msgstr "" -#: ../../reference/compound_stmts.rst:1676 +#: ../../reference/compound_stmts.rst:1679 msgid "Type parameters come in three kinds:" msgstr "" -#: ../../reference/compound_stmts.rst:1678 +#: ../../reference/compound_stmts.rst:1681 msgid "" ":data:`typing.TypeVar`, introduced by a plain name (e.g., ``T``). " "Semantically, this represents a single type to a type checker." msgstr "" -#: ../../reference/compound_stmts.rst:1680 +#: ../../reference/compound_stmts.rst:1683 msgid "" ":data:`typing.TypeVarTuple`, introduced by a name prefixed with a single " "asterisk (e.g., ``*Ts``). Semantically, this stands for a tuple of any " "number of types." msgstr "" -#: ../../reference/compound_stmts.rst:1683 +#: ../../reference/compound_stmts.rst:1686 msgid "" ":data:`typing.ParamSpec`, introduced by a name prefixed with two asterisks " "(e.g., ``**P``). Semantically, this stands for the parameters of a callable." msgstr "" -#: ../../reference/compound_stmts.rst:1686 +#: ../../reference/compound_stmts.rst:1689 msgid "" ":data:`typing.TypeVar` declarations can define *bounds* and *constraints* " "with a colon (``:``) followed by an expression. A single expression after " @@ -2270,7 +2276,7 @@ msgid "" "variables can only take on one of the types in the list of constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1695 +#: ../../reference/compound_stmts.rst:1698 msgid "" "For :data:`!typing.TypeVar`\\ s declared using the type parameter list " "syntax, the bound and constraints are not evaluated when the generic object " @@ -2280,13 +2286,13 @@ msgid "" "<annotation-scopes>`." msgstr "" -#: ../../reference/compound_stmts.rst:1701 +#: ../../reference/compound_stmts.rst:1704 msgid "" ":data:`typing.TypeVarTuple`\\ s and :data:`typing.ParamSpec`\\ s cannot have " "bounds or constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1704 +#: ../../reference/compound_stmts.rst:1707 msgid "" "All three flavors of type parameters can also have a *default value*, which " "is used when the type parameter is not explicitly provided. This is added by " @@ -2299,13 +2305,13 @@ msgid "" "attribute is set to the special sentinel object :data:`typing.NoDefault`." msgstr "" -#: ../../reference/compound_stmts.rst:1714 +#: ../../reference/compound_stmts.rst:1717 msgid "" "The following example indicates the full set of allowed type parameter " "declarations::" msgstr "" -#: ../../reference/compound_stmts.rst:1716 +#: ../../reference/compound_stmts.rst:1719 msgid "" "def overly_generic[\n" " SimpleTypeVar,\n" @@ -2337,24 +2343,24 @@ msgstr "" " *e: SimpleTypeVarTuple,\n" "): ..." -#: ../../reference/compound_stmts.rst:1734 +#: ../../reference/compound_stmts.rst:1737 msgid "Generic functions" msgstr "" -#: ../../reference/compound_stmts.rst:1736 +#: ../../reference/compound_stmts.rst:1739 msgid "Generic functions are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1738 +#: ../../reference/compound_stmts.rst:1741 msgid "def func[T](arg: T): ..." msgstr "def func[T](arg: T): ..." -#: ../../reference/compound_stmts.rst:1740 -#: ../../reference/compound_stmts.rst:1800 +#: ../../reference/compound_stmts.rst:1743 +#: ../../reference/compound_stmts.rst:1803 msgid "This syntax is equivalent to::" msgstr "語法大致等價於: ::" -#: ../../reference/compound_stmts.rst:1742 +#: ../../reference/compound_stmts.rst:1745 msgid "" "annotation-def TYPE_PARAMS_OF_func():\n" " T = typing.TypeVar(\"T\")\n" @@ -2370,7 +2376,7 @@ msgstr "" " return func\n" "func = TYPE_PARAMS_OF_func()" -#: ../../reference/compound_stmts.rst:1749 +#: ../../reference/compound_stmts.rst:1752 msgid "" "Here ``annotation-def`` indicates an :ref:`annotation scope <annotation-" "scopes>`, which is not actually bound to any name at runtime. (One other " @@ -2379,20 +2385,20 @@ msgid "" "data:`typing.TypeVar` directly.)" msgstr "" -#: ../../reference/compound_stmts.rst:1755 +#: ../../reference/compound_stmts.rst:1758 msgid "" "The annotations of generic functions are evaluated within the annotation " "scope used for declaring the type parameters, but the function's defaults " "and decorators are not." msgstr "" -#: ../../reference/compound_stmts.rst:1759 +#: ../../reference/compound_stmts.rst:1762 msgid "" "The following example illustrates the scoping rules for these cases, as well " "as for additional flavors of type parameters::" msgstr "" -#: ../../reference/compound_stmts.rst:1762 +#: ../../reference/compound_stmts.rst:1765 msgid "" "@decorator\n" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" @@ -2402,13 +2408,13 @@ msgstr "" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" " ..." -#: ../../reference/compound_stmts.rst:1766 +#: ../../reference/compound_stmts.rst:1769 msgid "" "Except for the :ref:`lazy evaluation <lazy-evaluation>` of the :class:" "`~typing.TypeVar` bound, this is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1769 +#: ../../reference/compound_stmts.rst:1772 msgid "" "DEFAULT_OF_arg = some_default\n" "\n" @@ -2430,25 +2436,25 @@ msgid "" "func = decorator(TYPE_PARAMS_OF_func())" msgstr "" -#: ../../reference/compound_stmts.rst:1788 +#: ../../reference/compound_stmts.rst:1791 msgid "" "The capitalized names like ``DEFAULT_OF_arg`` are not actually bound at " "runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1794 +#: ../../reference/compound_stmts.rst:1797 msgid "Generic classes" msgstr "" -#: ../../reference/compound_stmts.rst:1796 +#: ../../reference/compound_stmts.rst:1799 msgid "Generic classes are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1798 +#: ../../reference/compound_stmts.rst:1801 msgid "class Bag[T]: ..." msgstr "class Bag[T]: ..." -#: ../../reference/compound_stmts.rst:1802 +#: ../../reference/compound_stmts.rst:1805 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2466,14 +2472,14 @@ msgstr "" " return Bag\n" "Bag = TYPE_PARAMS_OF_Bag()" -#: ../../reference/compound_stmts.rst:1810 +#: ../../reference/compound_stmts.rst:1813 msgid "" "Here again ``annotation-def`` (not a real keyword) indicates an :ref:" "`annotation scope <annotation-scopes>`, and the name ``TYPE_PARAMS_OF_Bag`` " "is not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1814 +#: ../../reference/compound_stmts.rst:1817 msgid "" "Generic classes implicitly inherit from :data:`typing.Generic`. The base " "classes and keyword arguments of generic classes are evaluated within the " @@ -2481,7 +2487,7 @@ msgid "" "that scope. This is illustrated by this example::" msgstr "" -#: ../../reference/compound_stmts.rst:1820 +#: ../../reference/compound_stmts.rst:1823 msgid "" "@decorator\n" "class Bag(Base[T], arg=T): ..." @@ -2489,11 +2495,11 @@ msgstr "" "@decorator\n" "class Bag(Base[T], arg=T): ..." -#: ../../reference/compound_stmts.rst:1823 +#: ../../reference/compound_stmts.rst:1826 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../reference/compound_stmts.rst:1825 +#: ../../reference/compound_stmts.rst:1828 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2511,27 +2517,27 @@ msgstr "" " return Bag\n" "Bag = decorator(TYPE_PARAMS_OF_Bag())" -#: ../../reference/compound_stmts.rst:1836 +#: ../../reference/compound_stmts.rst:1839 msgid "Generic type aliases" msgstr "" -#: ../../reference/compound_stmts.rst:1838 +#: ../../reference/compound_stmts.rst:1841 msgid "" "The :keyword:`type` statement can also be used to create a generic type " "alias::" msgstr "" -#: ../../reference/compound_stmts.rst:1840 +#: ../../reference/compound_stmts.rst:1843 msgid "type ListOrSet[T] = list[T] | set[T]" msgstr "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1842 +#: ../../reference/compound_stmts.rst:1845 msgid "" "Except for the :ref:`lazy evaluation <lazy-evaluation>` of the value, this " "is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1845 +#: ../../reference/compound_stmts.rst:1848 msgid "" "annotation-def TYPE_PARAMS_OF_ListOrSet():\n" " T = typing.TypeVar(\"T\")\n" @@ -2544,105 +2550,105 @@ msgid "" "ListOrSet = TYPE_PARAMS_OF_ListOrSet()" msgstr "" -#: ../../reference/compound_stmts.rst:1854 +#: ../../reference/compound_stmts.rst:1857 msgid "" "Here, ``annotation-def`` (not a real keyword) indicates an :ref:`annotation " "scope <annotation-scopes>`. The capitalized names like " "``TYPE_PARAMS_OF_ListOrSet`` are not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1859 +#: ../../reference/compound_stmts.rst:1862 msgid "Footnotes" msgstr "註解" -#: ../../reference/compound_stmts.rst:1860 +#: ../../reference/compound_stmts.rst:1863 msgid "" "The exception is propagated to the invocation stack unless there is a :" "keyword:`finally` clause which happens to raise another exception. That new " "exception causes the old one to be lost." msgstr "" -#: ../../reference/compound_stmts.rst:1864 +#: ../../reference/compound_stmts.rst:1867 msgid "In pattern matching, a sequence is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1866 +#: ../../reference/compound_stmts.rst:1869 msgid "a class that inherits from :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1867 +#: ../../reference/compound_stmts.rst:1870 msgid "" "a Python class that has been registered as :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1868 +#: ../../reference/compound_stmts.rst:1871 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_SEQUENCE` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1869 -#: ../../reference/compound_stmts.rst:1888 +#: ../../reference/compound_stmts.rst:1872 +#: ../../reference/compound_stmts.rst:1891 msgid "a class that inherits from any of the above" msgstr "" -#: ../../reference/compound_stmts.rst:1871 +#: ../../reference/compound_stmts.rst:1874 msgid "The following standard library classes are sequences:" msgstr "" -#: ../../reference/compound_stmts.rst:1873 +#: ../../reference/compound_stmts.rst:1876 msgid ":class:`array.array`" msgstr ":class:`array.array`" -#: ../../reference/compound_stmts.rst:1874 +#: ../../reference/compound_stmts.rst:1877 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../reference/compound_stmts.rst:1876 +#: ../../reference/compound_stmts.rst:1879 msgid ":class:`memoryview`" msgstr ":class:`memoryview`" -#: ../../reference/compound_stmts.rst:1877 +#: ../../reference/compound_stmts.rst:1880 msgid ":class:`range`" msgstr ":class:`range`" -#: ../../reference/compound_stmts.rst:1880 +#: ../../reference/compound_stmts.rst:1883 msgid "" "Subject values of type ``str``, ``bytes``, and ``bytearray`` do not match " "sequence patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1883 +#: ../../reference/compound_stmts.rst:1886 msgid "In pattern matching, a mapping is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1885 +#: ../../reference/compound_stmts.rst:1888 msgid "a class that inherits from :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1886 +#: ../../reference/compound_stmts.rst:1889 msgid "" "a Python class that has been registered as :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1887 +#: ../../reference/compound_stmts.rst:1890 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_MAPPING` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1890 +#: ../../reference/compound_stmts.rst:1893 msgid "" "The standard library classes :class:`dict` and :class:`types." "MappingProxyType` are mappings." msgstr "" -#: ../../reference/compound_stmts.rst:1893 +#: ../../reference/compound_stmts.rst:1896 msgid "" "A string literal appearing as the first statement in the function body is " "transformed into the function's :attr:`~function.__doc__` attribute and " "therefore the function's :term:`docstring`." msgstr "" -#: ../../reference/compound_stmts.rst:1897 +#: ../../reference/compound_stmts.rst:1900 msgid "" "A string literal appearing as the first statement in the class body is " "transformed into the namespace's :attr:`~type.__doc__` item and therefore " @@ -2662,12 +2668,12 @@ msgstr "compound(複合)" #: ../../reference/compound_stmts.rst:390 #: ../../reference/compound_stmts.rst:437 #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:585 -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1384 -#: ../../reference/compound_stmts.rst:1494 -#: ../../reference/compound_stmts.rst:1528 -#: ../../reference/compound_stmts.rst:1573 +#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1497 +#: ../../reference/compound_stmts.rst:1531 +#: ../../reference/compound_stmts.rst:1576 msgid "statement" msgstr "statement(陳述式)" @@ -2703,7 +2709,7 @@ msgstr "" msgid "else" msgstr "else" -#: ../../reference/compound_stmts.rst:86 ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:86 ../../reference/compound_stmts.rst:588 msgid "if" msgstr "if" @@ -2714,8 +2720,8 @@ msgstr "if" #: ../../reference/compound_stmts.rst:390 #: ../../reference/compound_stmts.rst:408 #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:585 -#: ../../reference/compound_stmts.rst:1504 +#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:1507 msgid "keyword" msgstr "keyword(關鍵字)" @@ -2727,10 +2733,10 @@ msgstr "elif" #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:207 #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:585 -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1320 -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1323 +#: ../../reference/compound_stmts.rst:1387 msgid ": (colon)" msgstr ": (冒號)" @@ -2738,9 +2744,9 @@ msgstr ": (冒號)" #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:207 #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:585 -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:588 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1387 msgid "compound statement" msgstr "compound statement(複合陳述式)" @@ -2785,8 +2791,8 @@ msgstr "list(串列)" #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:298 -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1387 msgid "object" msgstr "object(物件)" @@ -2818,7 +2824,7 @@ msgstr "finally" #: ../../reference/compound_stmts.rst:207 #: ../../reference/compound_stmts.rst:265 #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:588 msgid "as" msgstr "as" @@ -2856,199 +2862,199 @@ msgid "with statement" msgstr "with statement(with 陳述式)" #: ../../reference/compound_stmts.rst:471 -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1387 msgid ", (comma)" msgstr ", (逗號)" -#: ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:588 msgid "match" msgstr "match" -#: ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:588 msgid "case" msgstr "case" -#: ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:588 msgid "pattern matching" msgstr "pattern matching(模式匹配)" -#: ../../reference/compound_stmts.rst:585 +#: ../../reference/compound_stmts.rst:588 msgid "match statement" msgstr "match statement(匹配陳述式)" -#: ../../reference/compound_stmts.rst:689 +#: ../../reference/compound_stmts.rst:692 msgid "guard" msgstr "guard" -#: ../../reference/compound_stmts.rst:728 +#: ../../reference/compound_stmts.rst:731 msgid "irrefutable case block" msgstr "" -#: ../../reference/compound_stmts.rst:728 +#: ../../reference/compound_stmts.rst:731 msgid "case block" msgstr "" -#: ../../reference/compound_stmts.rst:752 +#: ../../reference/compound_stmts.rst:755 msgid "! patterns" msgstr "" -#: ../../reference/compound_stmts.rst:752 +#: ../../reference/compound_stmts.rst:755 msgid "AS pattern, OR pattern, capture pattern, wildcard pattern" msgstr "" -#: ../../reference/compound_stmts.rst:1183 -#: ../../reference/compound_stmts.rst:1270 +#: ../../reference/compound_stmts.rst:1186 +#: ../../reference/compound_stmts.rst:1273 msgid "parameter" msgstr "parameter(參數)" -#: ../../reference/compound_stmts.rst:1183 -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1234 -#: ../../reference/compound_stmts.rst:1270 -#: ../../reference/compound_stmts.rst:1299 +#: ../../reference/compound_stmts.rst:1186 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1237 +#: ../../reference/compound_stmts.rst:1273 +#: ../../reference/compound_stmts.rst:1302 msgid "function definition" msgstr "function definition(函式定義)" -#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1195 msgid "def" msgstr "def" -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1320 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1323 msgid "function" msgstr "function (函式)" -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1387 msgid "definition" msgstr "definition(定義)" -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1387 msgid "name" msgstr "name(名稱)" -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1387 msgid "binding" msgstr "binding(綁定)" -#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1195 msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" -#: ../../reference/compound_stmts.rst:1192 -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1195 +#: ../../reference/compound_stmts.rst:1387 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../reference/compound_stmts.rst:1192 +#: ../../reference/compound_stmts.rst:1195 msgid "parameter list" msgstr "parameter list(參數列表)" -#: ../../reference/compound_stmts.rst:1234 -#: ../../reference/compound_stmts.rst:1434 +#: ../../reference/compound_stmts.rst:1237 +#: ../../reference/compound_stmts.rst:1437 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/compound_stmts.rst:1270 +#: ../../reference/compound_stmts.rst:1273 msgid "default" msgstr "default(預設)" -#: ../../reference/compound_stmts.rst:1270 +#: ../../reference/compound_stmts.rst:1273 msgid "value" msgstr "value(值)" -#: ../../reference/compound_stmts.rst:1270 +#: ../../reference/compound_stmts.rst:1273 msgid "argument" msgstr "argument(引數)" -#: ../../reference/compound_stmts.rst:1270 +#: ../../reference/compound_stmts.rst:1273 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/compound_stmts.rst:1299 +#: ../../reference/compound_stmts.rst:1302 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/compound_stmts.rst:1299 +#: ../../reference/compound_stmts.rst:1302 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/compound_stmts.rst:1299 +#: ../../reference/compound_stmts.rst:1302 msgid "**" msgstr "**" -#: ../../reference/compound_stmts.rst:1320 +#: ../../reference/compound_stmts.rst:1323 msgid "annotations" msgstr "annotations(註釋)" -#: ../../reference/compound_stmts.rst:1320 +#: ../../reference/compound_stmts.rst:1323 msgid "->" msgstr "->" -#: ../../reference/compound_stmts.rst:1320 +#: ../../reference/compound_stmts.rst:1323 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../reference/compound_stmts.rst:1343 +#: ../../reference/compound_stmts.rst:1346 msgid "lambda" msgstr "lambda" -#: ../../reference/compound_stmts.rst:1343 +#: ../../reference/compound_stmts.rst:1346 msgid "expression" msgstr "expression(運算式)" -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1387 msgid "class" msgstr "class(類別)" -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1387 msgid "execution" msgstr "execution(執行)" -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1387 msgid "frame" msgstr "frame" -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1387 msgid "inheritance" msgstr "inheritance(繼承)" -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1387 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../reference/compound_stmts.rst:1384 -#: ../../reference/compound_stmts.rst:1434 +#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1437 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/compound_stmts.rst:1384 +#: ../../reference/compound_stmts.rst:1387 msgid "expression list" msgstr "expression list(表達式列表)" -#: ../../reference/compound_stmts.rst:1494 +#: ../../reference/compound_stmts.rst:1497 msgid "async def" msgstr "async def" -#: ../../reference/compound_stmts.rst:1504 +#: ../../reference/compound_stmts.rst:1507 msgid "async" msgstr "async" -#: ../../reference/compound_stmts.rst:1504 +#: ../../reference/compound_stmts.rst:1507 msgid "await" msgstr "await" -#: ../../reference/compound_stmts.rst:1528 +#: ../../reference/compound_stmts.rst:1531 msgid "async for" msgstr "async for" -#: ../../reference/compound_stmts.rst:1573 +#: ../../reference/compound_stmts.rst:1576 msgid "async with" msgstr "async with" -#: ../../reference/compound_stmts.rst:1630 +#: ../../reference/compound_stmts.rst:1633 msgid "type parameters" msgstr "type parameter(型別參數)" diff --git a/tutorial/index.po b/tutorial/index.po index 47eb0a648b..1ed8787fa7 100644 --- a/tutorial/index.po +++ b/tutorial/index.po @@ -59,7 +59,7 @@ msgid "" msgstr "" "使用 C 或 C++(或其他可被 C 呼叫的程式語言),可以很容易在 Python 直譯器內新" "增功能函式及資料型別。同時,對可讓使用者自製功能的應用程式來說,Python 也適合" -"作為其擴充用界面語言 (extension language)。" +"作為其擴充用介面語言 (extension language)。" #: ../../tutorial/index.rst:23 msgid "" diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index ee2fe63fc7..44170c01ff 100644 --- a/whatsnew/3.10.po +++ b/whatsnew/3.10.po @@ -849,7 +849,7 @@ msgid "" "of the subject's type and shape." msgstr "" "雖然使用巢狀 \"if\" 陳述式的「命令式 (imperative)」指令系列可用於完成類似於結" -"構模式匹配的操作,但它不如「聲明式 (declarative)」方法清晰。相反地,「聲明" +"構模式匹配的操作,但它不如「宣告式 (declarative)」方法清晰。相反地,「聲明" "式」方法規定了匹配所需滿足的條件,並且因其明確表達模式而更具可讀性。雖然結構" "模式匹配可以用其最簡單的形式達成,將變數與 case 陳述式中的字面值進行比較,但" "它對 Python 的真正價值在於它對主語的型態和特徵的處理。" @@ -2486,7 +2486,7 @@ msgid "" "Add ``--quiet`` option to command-line interface of :mod:`py_compile`. " "(Contributed by Gregory Schevchenko in :issue:`38731`.)" msgstr "" -"將 ``--quiet`` 選項新增到 :mod:`py_compile` 的命令列界面。(由 Gregory " +"將 ``--quiet`` 選項新增到 :mod:`py_compile` 的命令列介面。(由 Gregory " "Schevchenko 在 :issue:`38731` 中貢獻。)" #: ../../whatsnew/3.10.rst:1316 diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index 3202bc30a7..8bddce6733 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -521,6 +521,16 @@ msgid "" "}\n" "/* The new interpreter is now active in the current thread. */" msgstr "" +"PyInterpreterConfig config = {\n" +" .check_multi_interp_extensions = 1,\n" +" .gil = PyInterpreterConfig_OWN_GIL,\n" +"};\n" +"PyThreadState *tstate = NULL;\n" +"PyStatus status = Py_NewInterpreterFromConfig(&tstate, &config);\n" +"if (PyStatus_Exception(status)) {\n" +" return -1;\n" +"}\n" +"/* 新的直譯器現在會在當前執行緒中啟用。 */" #: ../../whatsnew/3.12.rst:361 msgid "" @@ -1021,12 +1031,16 @@ msgid "" ":func:`importlib.resources.as_file` now supports resource directories. " "(Contributed by Jason R. Coombs in :gh:`97930`.)" msgstr "" +":func:`importlib.resources.as_file` 現在支援資源目錄。(由 Jason R. Coombs " +"於 :gh:`97930` 中貢獻。)" #: ../../whatsnew/3.12.rst:721 msgid "" "Rename first parameter of :func:`importlib.resources.files` to *anchor*. " "(Contributed by Jason R. Coombs in :gh:`100598`.)" msgstr "" +"將 :func:`importlib.resources.files` 的第一個參數重新命名為 *anchor*。(由 " +"Jason R. Coombs 於 :gh:`100598` 中貢獻。)" #: ../../whatsnew/3.12.rst:725 msgid "inspect" @@ -1038,6 +1052,9 @@ msgid "" "a :term:`coroutine` for use with :func:`inspect.iscoroutinefunction`. " "(Contributed by Carlton Gibson in :gh:`99247`.)" msgstr "" +"新增 :func:`inspect.markcoroutinefunction` 以標記會回傳 :term:`coroutine` 的" +"同步函式,以供 :func:`inspect.iscoroutinefunction` 使用。(由 Carlton Gibson " +"於 :gh:`99247` 中貢獻。)" #: ../../whatsnew/3.12.rst:731 msgid "" @@ -1045,6 +1062,9 @@ msgid "" "for determining the current state of asynchronous generators. (Contributed " "by Thomas Krennwallner in :gh:`79940`.)" msgstr "" +"新增 :func:`inspect.getasyncgenstate` 和 :func:`inspect.getasyncgenlocals` 以" +"確定非同步產生器的當前狀態。(由 Thomas Krennwallner 於 :gh:`79940` 中貢" +"獻。)" #: ../../whatsnew/3.12.rst:735 msgid "" @@ -1052,6 +1072,8 @@ msgid "" "improved. Most calls to the function should be at least 2x faster than they " "were in Python 3.11. (Contributed by Alex Waygood in :gh:`103193`.)" msgstr "" +":func:`inspect.getattr_static` 的效能已大幅改善。大多數對該函式的呼叫應該比 " +"Python 3.11 中快至少 2 倍。(由 Alex Waygood 於 :gh:`103193` 中貢獻。)" #: ../../whatsnew/3.12.rst:740 msgid "itertools" @@ -1063,6 +1085,8 @@ msgid "" "the last batch may be shorter than the rest. (Contributed by Raymond " "Hettinger in :gh:`98363`.)" msgstr "" +"新增 :func:`itertools.batched` 以將元素收集到大小均等的元組中,其中最後一批次" +"可能比其他的少。(由 Raymond Hettinger 於 :gh:`98363` 中貢獻。)" #: ../../whatsnew/3.12.rst:747 msgid "math" @@ -1130,12 +1154,16 @@ msgid "" "Add :func:`os.path.isjunction` to check if a given path is a junction. " "(Contributed by Charles Machalow in :gh:`99547`.)" msgstr "" +"新增 :func:`os.path.isjunction` 以檢查給定路徑是否為連結點 (junction)。(由 " +"Charles Machalow 於 :gh:`99547` 中貢獻。)" #: ../../whatsnew/3.12.rst:787 msgid "" "Add :func:`os.path.splitroot` to split a path into a triad ``(drive, root, " "tail)``. (Contributed by Barney Gale in :gh:`101000`.)" msgstr "" +"新增 :func:`os.path.splitroot` 以將路徑分割為三元組 ``(drive, root, tail)``。" +"(由 Barney Gale 於 :gh:`101000` 中貢獻。)" #: ../../whatsnew/3.12.rst:791 msgid "pathlib" @@ -1455,6 +1483,22 @@ msgid "" "attribute\n" "True" msgstr "" +">>> from typing import Protocol, runtime_checkable\n" +">>> @runtime_checkable\n" +"... class HasX(Protocol):\n" +"... x = 1\n" +"...\n" +">>> class Foo: ...\n" +"...\n" +">>> f = Foo()\n" +">>> isinstance(f, HasX)\n" +"False\n" +">>> f.x = 1\n" +">>> isinstance(f, HasX)\n" +"True\n" +">>> HasX.y = 2\n" +">>> isinstance(f, HasX) # 沒有改變,即便 HasX 現在有 \"y\" 屬性\n" +"True" #: ../../whatsnew/3.12.rst:1001 msgid "" @@ -1584,6 +1628,8 @@ msgid "" "Speed up :class:`asyncio.Task` creation by deferring expensive string " "formatting. (Contributed by Itamar Oren in :gh:`103793`.)" msgstr "" +"透過延遲運算較繁重的字串格式化來加速 :class:`asyncio.Task` 的建立。(由 " +"Itamar Oren 於 :gh:`103793` 中貢獻。)" #: ../../whatsnew/3.12.rst:1072 msgid "" @@ -1611,6 +1657,9 @@ msgid "" "`!LOAD_METHOD` instruction if the low bit of its oparg is set. (Contributed " "by Ken Jin in :gh:`93429`.)" msgstr "" +"移除 :opcode:`!LOAD_METHOD` 指令。它已經合併至 :opcode:`LOAD_ATTR`。:opcode:" +"`LOAD_ATTR` 現在會像舊的 :opcode:`!LOAD_METHOD` 指令一樣行為,如果其 oparg 的" +"低位元 (low bit) 有被設定。(由 Ken Jin 於 :gh:`93429` 中貢獻。)" #: ../../whatsnew/3.12.rst:1090 msgid "" @@ -1618,54 +1667,70 @@ msgid "" "JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel in :gh:" "`102859`.)" msgstr "" +"移除 :opcode:`!JUMP_IF_FALSE_OR_POP` 和 :opcode:`!JUMP_IF_TRUE_OR_POP` 指令。" +"(由 Irit Katriel 於 :gh:`102859` 中貢獻。)" #: ../../whatsnew/3.12.rst:1093 msgid "" "Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon in :" "gh:`92925`.)" msgstr "" +"移除 :opcode:`!PRECALL` 指令。(由 Mark Shannon 於 :gh:`92925` 中貢獻。)" #: ../../whatsnew/3.12.rst:1096 msgid "" "Add the :opcode:`BINARY_SLICE` and :opcode:`STORE_SLICE` instructions. " "(Contributed by Mark Shannon in :gh:`94163`.)" msgstr "" +"新增 :opcode:`BINARY_SLICE` 和 :opcode:`STORE_SLICE` 指令。(由 Mark Shannon " +"於 :gh:`94163` 中貢獻。)" #: ../../whatsnew/3.12.rst:1099 msgid "" "Add the :opcode:`CALL_INTRINSIC_1` instructions. (Contributed by Mark " "Shannon in :gh:`99005`.)" msgstr "" +"新增 :opcode:`CALL_INTRINSIC_1` 指令。(由 Mark Shannon 於 :gh:`99005` 中貢" +"獻。)" #: ../../whatsnew/3.12.rst:1102 msgid "" "Add the :opcode:`CALL_INTRINSIC_2` instruction. (Contributed by Irit Katriel " "in :gh:`101799`.)" msgstr "" +"新增 :opcode:`CALL_INTRINSIC_2` 指令。(由 Irit Katriel 於 :gh:`101799` 中貢" +"獻。)" #: ../../whatsnew/3.12.rst:1105 msgid "" "Add the :opcode:`CLEANUP_THROW` instruction. (Contributed by Brandt Bucher " "in :gh:`90997`.)" msgstr "" +"新增 :opcode:`CLEANUP_THROW` 指令。(由 Brandt Bucher 於 :gh:`90997` 中貢" +"獻。)" #: ../../whatsnew/3.12.rst:1108 msgid "" "Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon in :gh:" "`103082`.)" msgstr "" +"新增 :opcode:`!END_SEND` 指令。(由 Mark Shannon 於 :gh:`103082` 中貢獻。)" #: ../../whatsnew/3.12.rst:1111 msgid "" "Add the :opcode:`LOAD_FAST_AND_CLEAR` instruction as part of the " "implementation of :pep:`709`. (Contributed by Carl Meyer in :gh:`101441`.)" msgstr "" +"新增 :opcode:`LOAD_FAST_AND_CLEAR` 指令作為 :pep:`709` 實作的一部分。(由 " +"Carl Meyer 於 :gh:`101441` 中貢獻。)" #: ../../whatsnew/3.12.rst:1114 msgid "" "Add the :opcode:`LOAD_FAST_CHECK` instruction. (Contributed by Dennis " "Sweeney in :gh:`93143`.)" msgstr "" +"新增 :opcode:`LOAD_FAST_CHECK` 指令。(由 Dennis Sweeney 於 :gh:`93143` 中貢" +"獻。)" #: ../../whatsnew/3.12.rst:1117 msgid "" @@ -1675,18 +1740,27 @@ msgid "" "opcode, which can be replaced with :opcode:`LOAD_LOCALS` plus :opcode:" "`LOAD_FROM_DICT_OR_DEREF`. (Contributed by Jelle Zijlstra in :gh:`103764`.)" msgstr "" +"新增 :opcode:`LOAD_FROM_DICT_OR_DEREF`、:opcode:`LOAD_FROM_DICT_OR_GLOBALS` " +"和 :opcode:`LOAD_LOCALS` 操作碼作為 :pep:`695` 實作的一部分。移除 :opcode:`!" +"LOAD_CLASSDEREF` 操作碼,可以用 :opcode:`LOAD_LOCALS` 加上 :opcode:" +"`LOAD_FROM_DICT_OR_DEREF` 來取代。(由 Jelle Zijlstra 於 :gh:`103764` 中貢" +"獻。)" #: ../../whatsnew/3.12.rst:1123 msgid "" "Add the :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer " "and Vladimir Matveev in :gh:`103497`.)" msgstr "" +"新增 :opcode:`LOAD_SUPER_ATTR` 指令。(由 Carl Meyer 和 Vladimir Matveev 於 :" +"gh:`103497` 中貢獻。)" #: ../../whatsnew/3.12.rst:1126 msgid "" "Add the :opcode:`RETURN_CONST` instruction. (Contributed by Wenyang Wang in :" "gh:`101632`.)" msgstr "" +"新增 :opcode:`RETURN_CONST` 指令。(由 Wenyang Wang 於 :gh:`101632` 中貢" +"獻。)" #: ../../whatsnew/3.12.rst:1129 msgid "Demos and Tools" @@ -1728,6 +1802,9 @@ msgid "" "emitted at runtime when they are accessed or used, and will be removed in " "Python 3.14:" msgstr "" +":mod:`ast`:以下 :mod:`ast` 功能自 Python 3.8 起已在文件中被棄用,現在在存取" +"或使用時會在 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移" +"除:" #: ../../whatsnew/3.12.rst:1154 #: ../../deprecations/pending-removal-in-3.14.rst:13 @@ -3096,6 +3173,7 @@ msgid "" "Several names deprecated in the :mod:`configparser` way back in 3.2 have " "been removed per :gh:`89336`:" msgstr "" +"根據 :gh:`89336`,已移除了在 3.2 中被 :mod:`configparser` 棄用的幾個名稱:" #: ../../whatsnew/3.12.rst:1364 msgid "" @@ -3110,12 +3188,16 @@ msgid "" ":mod:`configparser` no longer has a ``SafeConfigParser`` class. Use the " "shorter :class:`~configparser.ConfigParser` name instead." msgstr "" +":mod:`configparser` 不再具有 ``SafeConfigParser`` 類別。請改用較短的 :class:" +"`~configparser.ConfigParser` 名稱。" #: ../../whatsnew/3.12.rst:1368 msgid "" ":class:`configparser.ConfigParser` no longer has a ``readfp`` method. Use :" "meth:`~configparser.ConfigParser.read_file` instead." msgstr "" +":class:`configparser.ConfigParser` 不再具有 ``readfp`` 方法。請改用 :meth:" +"`~configparser.ConfigParser.read_file`。" #: ../../whatsnew/3.12.rst:1374 msgid "distutils" @@ -3171,6 +3253,8 @@ msgid "" "Remove :mod:`enum`'s ``EnumMeta.__getattr__``, which is no longer needed for " "enum attribute access. (Contributed by Ethan Furman in :gh:`95083`.)" msgstr "" +"移除 :mod:`enum` 的 ``EnumMeta.__getattr__``,對於列舉屬性的訪問不再會需要" +"它。" #: ../../whatsnew/3.12.rst:1411 msgid "ftplib" @@ -3255,11 +3339,11 @@ msgstr "imp" msgid "" "The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in :" "gh:`98040`.)" -msgstr "" +msgstr ":mod:`!imp` 模組已被移除。(由 Barry Warsaw 在 :gh:`98040` 中貢獻。)" #: ../../whatsnew/3.12.rst:1462 msgid "To migrate, consult the following correspondence table:" -msgstr "" +msgstr "要遷移的話請參考以下對應表:" #: ../../whatsnew/3.12.rst:1467 msgid "``imp.NullImporter``" @@ -3302,6 +3386,8 @@ msgid "" ":attr:`importlib.machinery.SOURCE_SUFFIXES`, :attr:`importlib.machinery." "EXTENSION_SUFFIXES`, and :attr:`importlib.machinery.BYTECODE_SUFFIXES`" msgstr "" +":attr:`importlib.machinery.SOURCE_SUFFIXES`、:attr:`importlib.machinery." +"EXTENSION_SUFFIXES` 和 :attr:`importlib.machinery.BYTECODE_SUFFIXES`" #: ../../whatsnew/3.12.rst:1472 msgid "``imp.get_tag()``" @@ -3371,6 +3457,19 @@ msgid "" " loader.exec_module(module)\n" " return module" msgstr "" +"import importlib.util\n" +"import importlib.machinery\n" +"\n" +"def load_source(modname, filename):\n" +" loader = importlib.machinery.SourceFileLoader(modname, filename)\n" +" spec = importlib.util.spec_from_file_location(modname, filename, " +"loader=loader)\n" +" module = importlib.util.module_from_spec(spec)\n" +" # 此模組都會被執行且不會被快取於 sys.modules。\n" +" # 要快取模組的話可以把下面一行取消註解\n" +" # sys.modules[module.__name__] = module\n" +" loader.exec_module(module)\n" +" return module" #: ../../whatsnew/3.12.rst:1495 msgid "Remove :mod:`!imp` functions and attributes with no replacements:" @@ -3672,6 +3771,8 @@ msgid "" "An alias of the :class:`~unittest.TextTestResult` class: ``_TextTestResult`` " "(deprecated in Python 3.2)." msgstr "" +"對 :class:`~unittest.TextTestResult` 類別的別名:``_TextTestResult``\\ (自 " +"Python 3.2 起已棄用)。" #: ../../whatsnew/3.12.rst:1617 msgid "(Contributed by Serhiy Storchaka in :gh:`89325`.)" @@ -4802,6 +4903,9 @@ msgid "" "func:`PyType_FromModuleAndSpec` to create a class whose metaclass overrides :" "c:member:`~PyTypeObject.tp_new` is deprecated. Call the metaclass instead." msgstr "" +"使用 :c:func:`PyType_FromSpec`、:c:func:`PyType_FromSpecWithBases` 或 :c:" +"func:`PyType_FromModuleAndSpec` 建立一個其元類別覆寫 :c:member:" +"`~PyTypeObject.tp_new` 的類別已被棄用。請改為呼叫元類別。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 msgid "" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index ea9bec402b..8515c9a886 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-15 00:14+0000\n" +"POT-Creation-Date: 2024-12-29 11:18+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -345,7 +345,7 @@ msgid "" "years of security fixes." msgstr "" -#: ../../whatsnew/3.13.rst:208 ../../whatsnew/3.13.rst:1970 +#: ../../whatsnew/3.13.rst:208 ../../whatsnew/3.13.rst:1985 msgid "New Features" msgstr "新增功能" @@ -1163,7 +1163,7 @@ msgid "compileall" msgstr "compileall" #: ../../whatsnew/3.13.rst:757 ../../whatsnew/3.13.rst:765 -#: ../../whatsnew/3.13.rst:1017 +#: ../../whatsnew/3.13.rst:1024 msgid "" "The default number of worker threads and processes is now selected using :" "func:`os.process_cpu_count` instead of :func:`os.cpu_count`. (Contributed by " @@ -1174,7 +1174,7 @@ msgstr "" msgid "concurrent.futures" msgstr "concurrent.futures" -#: ../../whatsnew/3.13.rst:771 ../../whatsnew/3.13.rst:1614 +#: ../../whatsnew/3.13.rst:771 ../../whatsnew/3.13.rst:1621 msgid "configparser" msgstr "configparser" @@ -1356,10 +1356,21 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:893 +msgid "enum" +msgstr "enum" + +#: ../../whatsnew/3.13.rst:895 +msgid "" +":class:`~enum.EnumDict` has been made public to better support subclassing :" +"class:`~enum.EnumType`." +msgstr "" +"公開 :class:`~enum.EnumDict` 以更好地支援 :class:`~enum.EnumType` 的子類別。" + +#: ../../whatsnew/3.13.rst:900 msgid "fractions" msgstr "fractions" -#: ../../whatsnew/3.13.rst:895 +#: ../../whatsnew/3.13.rst:902 msgid "" ":class:`~fractions.Fraction` objects now support the standard :ref:`format " "specification mini-language <formatspec>` rules for fill, alignment, sign " @@ -1367,22 +1378,22 @@ msgid "" "`111320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:902 +#: ../../whatsnew/3.13.rst:909 msgid "glob" msgstr "glob" -#: ../../whatsnew/3.13.rst:904 +#: ../../whatsnew/3.13.rst:911 msgid "" "Add :func:`~glob.translate`, a function to convert a path specification with " "shell-style wildcards to a regular expression. (Contributed by Barney Gale " "in :gh:`72904`.)" msgstr "" -#: ../../whatsnew/3.13.rst:910 +#: ../../whatsnew/3.13.rst:917 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.13.rst:912 +#: ../../whatsnew/3.13.rst:919 msgid "" "The following functions in :mod:`importlib.resources` now allow accessing a " "directory (or tree) of resources, using multiple positional arguments (the " @@ -1390,37 +1401,37 @@ msgid "" "keyword-only):" msgstr "" -#: ../../whatsnew/3.13.rst:917 +#: ../../whatsnew/3.13.rst:924 msgid ":func:`~importlib.resources.is_resource`" msgstr ":func:`~importlib.resources.is_resource`" -#: ../../whatsnew/3.13.rst:918 +#: ../../whatsnew/3.13.rst:925 msgid ":func:`~importlib.resources.open_binary`" msgstr ":func:`~importlib.resources.open_binary`" -#: ../../whatsnew/3.13.rst:919 +#: ../../whatsnew/3.13.rst:926 msgid ":func:`~importlib.resources.open_text`" msgstr ":func:`~importlib.resources.open_text`" -#: ../../whatsnew/3.13.rst:920 +#: ../../whatsnew/3.13.rst:927 msgid ":func:`~importlib.resources.path`" msgstr ":func:`~importlib.resources.path`" -#: ../../whatsnew/3.13.rst:921 +#: ../../whatsnew/3.13.rst:928 msgid ":func:`~importlib.resources.read_binary`" msgstr ":func:`~importlib.resources.read_binary`" -#: ../../whatsnew/3.13.rst:922 +#: ../../whatsnew/3.13.rst:929 msgid ":func:`~importlib.resources.read_text`" msgstr ":func:`~importlib.resources.read_text`" -#: ../../whatsnew/3.13.rst:924 +#: ../../whatsnew/3.13.rst:931 msgid "" "These functions are no longer deprecated and are not scheduled for removal. " "(Contributed by Petr Viktorin in :gh:`116608`.)" msgstr "" -#: ../../whatsnew/3.13.rst:927 +#: ../../whatsnew/3.13.rst:934 msgid "" ":func:`~importlib.resources.contents` remains deprecated in favor of the " "fully-featured :class:`~importlib.resources.abc.Traversable` API. However, " @@ -1428,11 +1439,11 @@ msgid "" "`116608`.)" msgstr "" -#: ../../whatsnew/3.13.rst:934 +#: ../../whatsnew/3.13.rst:941 msgid "io" msgstr "io" -#: ../../whatsnew/3.13.rst:936 +#: ../../whatsnew/3.13.rst:943 msgid "" "The :class:`~io.IOBase` finalizer now logs any errors raised by the :meth:" "`~io.IOBase.close` method with :data:`sys.unraisablehook`. Previously, " @@ -1441,17 +1452,17 @@ msgid "" "build>`. (Contributed by Victor Stinner in :gh:`62948`.)" msgstr "" -#: ../../whatsnew/3.13.rst:945 +#: ../../whatsnew/3.13.rst:952 msgid "ipaddress" msgstr "ipaddress" -#: ../../whatsnew/3.13.rst:947 +#: ../../whatsnew/3.13.rst:954 msgid "" "Add the :attr:`.IPv4Address.ipv6_mapped` property, which returns the IPv4-" "mapped IPv6 address. (Contributed by Charles Machalow in :gh:`109466`.)" msgstr "" -#: ../../whatsnew/3.13.rst:951 +#: ../../whatsnew/3.13.rst:958 msgid "" "Fix ``is_global`` and ``is_private`` behavior in :class:`~ipaddress." "IPv4Address`, :class:`~ipaddress.IPv6Address`, :class:`~ipaddress." @@ -1459,22 +1470,22 @@ msgid "" "Stasiak in :gh:`113171`.)" msgstr "" -#: ../../whatsnew/3.13.rst:958 +#: ../../whatsnew/3.13.rst:965 msgid "itertools" msgstr "itertools" -#: ../../whatsnew/3.13.rst:960 +#: ../../whatsnew/3.13.rst:967 msgid "" ":func:`~itertools.batched` has a new *strict* parameter, which raises a :exc:" "`ValueError` if the final batch is shorter than the specified batch size. " "(Contributed by Raymond Hettinger in :gh:`113202`.)" msgstr "" -#: ../../whatsnew/3.13.rst:967 +#: ../../whatsnew/3.13.rst:974 msgid "marshal" msgstr "marshal" -#: ../../whatsnew/3.13.rst:969 +#: ../../whatsnew/3.13.rst:976 msgid "" "Add the *allow_code* parameter in module functions. Passing " "``allow_code=False`` prevents serialization and de-serialization of code " @@ -1482,11 +1493,11 @@ msgid "" "Serhiy Storchaka in :gh:`113626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:976 +#: ../../whatsnew/3.13.rst:983 msgid "math" msgstr "math" -#: ../../whatsnew/3.13.rst:978 +#: ../../whatsnew/3.13.rst:985 msgid "" "The new function :func:`~math.fma` performs fused multiply-add operations. " "This computes ``x * y + z`` with only a single round, and so avoids any " @@ -1496,11 +1507,11 @@ msgid "" "Stinner in :gh:`73468`.)" msgstr "" -#: ../../whatsnew/3.13.rst:988 +#: ../../whatsnew/3.13.rst:995 msgid "mimetypes" msgstr "mimetypes" -#: ../../whatsnew/3.13.rst:990 +#: ../../whatsnew/3.13.rst:997 msgid "" "Add the :func:`~mimetypes.guess_file_type` function to guess a MIME type " "from a filesystem path. Using paths with :func:`~mimetypes.guess_type` is " @@ -1508,18 +1519,18 @@ msgid "" "`66543`.)" msgstr "" -#: ../../whatsnew/3.13.rst:997 +#: ../../whatsnew/3.13.rst:1004 msgid "mmap" msgstr "mmap" -#: ../../whatsnew/3.13.rst:999 +#: ../../whatsnew/3.13.rst:1006 msgid "" ":class:`~mmap.mmap` is now protected from crashing on Windows when the " "mapped memory is inaccessible due to file system errors or access " "violations. (Contributed by Jannis Weigend in :gh:`118209`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1003 +#: ../../whatsnew/3.13.rst:1010 msgid "" ":class:`~mmap.mmap` has a new :meth:`~mmap.mmap.seekable` method that can be " "used when a seekable file-like object is required. The :meth:`~mmap.mmap." @@ -1527,7 +1538,7 @@ msgid "" "Na and Sylvie Liberman in :gh:`111835`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1008 +#: ../../whatsnew/3.13.rst:1015 msgid "" "The new UNIX-only *trackfd* parameter for :class:`~mmap.mmap` controls file " "descriptor duplication; if false, the file descriptor specified by *fileno* " @@ -1535,22 +1546,22 @@ msgid "" "gh:`78502`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1015 +#: ../../whatsnew/3.13.rst:1022 msgid "multiprocessing" msgstr "multiprocessing" -#: ../../whatsnew/3.13.rst:1023 +#: ../../whatsnew/3.13.rst:1030 msgid "os" msgstr "os" -#: ../../whatsnew/3.13.rst:1025 +#: ../../whatsnew/3.13.rst:1032 msgid "" "Add :func:`~os.process_cpu_count` function to get the number of logical CPU " "cores usable by the calling thread of the current process. (Contributed by " "Victor Stinner in :gh:`109649`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1029 +#: ../../whatsnew/3.13.rst:1036 msgid "" ":func:`~os.cpu_count` and :func:`~os.process_cpu_count` can be overridden " "through the new environment variable :envvar:`PYTHON_CPU_COUNT` or the new " @@ -1560,7 +1571,7 @@ msgid "" "Na in :gh:`109595`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1037 +#: ../../whatsnew/3.13.rst:1044 msgid "" "Add a :ref:`low level interface <os-timerfd>` to Linux's :manpage:`timer " "file descriptors <timerfd_create(2)>` via :func:`~os.timerfd_create`, :func:" @@ -1571,7 +1582,7 @@ msgid "" "in :gh:`108277`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1046 +#: ../../whatsnew/3.13.rst:1053 msgid "" ":func:`~os.lchmod` and the *follow_symlinks* argument of :func:`~os.chmod` " "are both now available on Windows. Note that the default value of " @@ -1579,14 +1590,14 @@ msgid "" "by Serhiy Storchaka in :gh:`59616`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1052 +#: ../../whatsnew/3.13.rst:1059 msgid "" ":func:`~os.fchmod` and support for file descriptors in :func:`~os.chmod` are " "both now available on Windows. (Contributed by Serhiy Storchaka in :gh:" "`113191`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1056 +#: ../../whatsnew/3.13.rst:1063 msgid "" "On Windows, :func:`~os.mkdir` and :func:`~os.makedirs` now support passing a " "*mode* value of ``0o700`` to apply access control to the new directory. This " @@ -1595,14 +1606,14 @@ msgid "" "Steve Dower in :gh:`118486`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1063 +#: ../../whatsnew/3.13.rst:1070 msgid "" ":func:`~os.posix_spawn` now accepts ``None`` for the *env* argument, which " "makes the newly spawned process use the current process environment. " "(Contributed by Jakub Kulik in :gh:`113119`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1067 +#: ../../whatsnew/3.13.rst:1074 msgid "" ":func:`~os.posix_spawn` can now use the :attr:`~os.POSIX_SPAWN_CLOSEFROM` " "attribute in the *file_actions* parameter on platforms that support :c:func:" @@ -1610,76 +1621,76 @@ msgid "" "gh:`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1074 +#: ../../whatsnew/3.13.rst:1081 msgid "os.path" msgstr "os.path" -#: ../../whatsnew/3.13.rst:1076 +#: ../../whatsnew/3.13.rst:1083 msgid "" "Add :func:`~os.path.isreserved` to check if a path is reserved on the " "current system. This function is only available on Windows. (Contributed by " "Barney Gale in :gh:`88569`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1081 +#: ../../whatsnew/3.13.rst:1088 msgid "" "On Windows, :func:`~os.path.isabs` no longer considers paths starting with " "exactly one slash (``\\`` or ``/``) to be absolute. (Contributed by Barney " "Gale and Jon Foster in :gh:`44626`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1085 +#: ../../whatsnew/3.13.rst:1092 msgid "" ":func:`~os.path.realpath` now resolves MS-DOS style file names even if the " "file is not accessible. (Contributed by Moonsik Park in :gh:`82367`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1091 ../../whatsnew/3.13.rst:1654 +#: ../../whatsnew/3.13.rst:1098 ../../whatsnew/3.13.rst:1677 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.13.rst:1093 +#: ../../whatsnew/3.13.rst:1100 msgid "" "Add :exc:`~pathlib.UnsupportedOperation`, which is raised instead of :exc:" "`NotImplementedError` when a path operation isn't supported. (Contributed by " "Barney Gale in :gh:`89812`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1097 +#: ../../whatsnew/3.13.rst:1104 msgid "" "Add a new constructor for creating :class:`~pathlib.Path` objects from " "'file' URIs (``file:///``), :meth:`.Path.from_uri`. (Contributed by Barney " "Gale in :gh:`107465`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1101 +#: ../../whatsnew/3.13.rst:1108 msgid "" "Add :meth:`.PurePath.full_match` for matching paths with shell-style " "wildcards, including the recursive wildcard \"``**``\". (Contributed by " "Barney Gale in :gh:`73435`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1105 +#: ../../whatsnew/3.13.rst:1112 msgid "" "Add the :attr:`.PurePath.parser` class attribute to store the implementation " "of :mod:`os.path` used for low-level path parsing and joining. This will be " "either :mod:`!posixpath` or :mod:`!ntpath`." msgstr "" -#: ../../whatsnew/3.13.rst:1110 +#: ../../whatsnew/3.13.rst:1117 msgid "" "Add *recurse_symlinks* keyword-only argument to :meth:`.Path.glob` and :meth:" "`~pathlib.Path.rglob`. (Contributed by Barney Gale in :gh:`77609`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1114 +#: ../../whatsnew/3.13.rst:1121 msgid "" ":meth:`.Path.glob` and :meth:`~pathlib.Path.rglob` now return files and " "directories when given a pattern that ends with \"``**``\". Previously, only " "directories were returned. (Contributed by Barney Gale in :gh:`70303`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1119 +#: ../../whatsnew/3.13.rst:1126 msgid "" "Add the *follow_symlinks* keyword-only argument to :meth:`Path.is_file " "<pathlib.Path.is_file>`, :meth:`Path.is_dir <pathlib.Path.is_dir>`, :meth:`." @@ -1687,11 +1698,11 @@ msgid "" "`105793` and Kamil Turek in :gh:`107962`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1127 +#: ../../whatsnew/3.13.rst:1134 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.13.rst:1129 +#: ../../whatsnew/3.13.rst:1136 msgid "" ":func:`breakpoint` and :func:`~pdb.set_trace` now enter the debugger " "immediately rather than on the next line of code to be executed. This change " @@ -1700,20 +1711,20 @@ msgid "" "Gao in :gh:`118579`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1135 +#: ../../whatsnew/3.13.rst:1142 msgid "" "``sys.path[0]`` is no longer replaced by the directory of the script being " "debugged when :attr:`sys.flags.safe_path` is set. (Contributed by Tian Gao " "and Christian Walther in :gh:`111762`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1139 +#: ../../whatsnew/3.13.rst:1146 msgid "" ":mod:`zipapp` is now supported as a debugging target. (Contributed by Tian " "Gao in :gh:`118501`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1142 +#: ../../whatsnew/3.13.rst:1149 msgid "" "Add ability to move between chained exceptions during post-mortem debugging " "in :func:`~pdb.pm` using the new :pdbcmd:`exceptions [exc_number] " @@ -1721,101 +1732,101 @@ msgid "" "`106676`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1147 +#: ../../whatsnew/3.13.rst:1154 msgid "" "Expressions and statements whose prefix is a pdb command are now correctly " "identified and executed. (Contributed by Tian Gao in :gh:`108464`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1153 +#: ../../whatsnew/3.13.rst:1160 msgid "queue" msgstr "queue" -#: ../../whatsnew/3.13.rst:1155 +#: ../../whatsnew/3.13.rst:1162 msgid "" "Add :meth:`Queue.shutdown <queue.Queue.shutdown>` and :exc:`~queue.ShutDown` " "to manage queue termination. (Contributed by Laurie Opperman and Yves Duprat " "in :gh:`104750`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1161 +#: ../../whatsnew/3.13.rst:1168 msgid "random" msgstr "random" -#: ../../whatsnew/3.13.rst:1163 +#: ../../whatsnew/3.13.rst:1170 msgid "" "Add a :ref:`command-line interface <random-cli>`. (Contributed by Hugo van " "Kemenade in :gh:`118131`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1168 ../../whatsnew/3.13.rst:1662 +#: ../../whatsnew/3.13.rst:1175 ../../whatsnew/3.13.rst:1685 msgid "re" msgstr "re" -#: ../../whatsnew/3.13.rst:1170 +#: ../../whatsnew/3.13.rst:1177 msgid "" "Rename :exc:`!re.error` to :exc:`~re.PatternError` for improved clarity. :" "exc:`!re.error` is kept for backward compatibility." msgstr "" -#: ../../whatsnew/3.13.rst:1175 +#: ../../whatsnew/3.13.rst:1182 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.13.rst:1177 +#: ../../whatsnew/3.13.rst:1184 msgid "" "Support the *dir_fd* and *follow_symlinks* keyword arguments in :func:" "`~shutil.chown`. (Contributed by Berker Peksag and Tahia K in :gh:`62308`)" msgstr "" -#: ../../whatsnew/3.13.rst:1183 +#: ../../whatsnew/3.13.rst:1190 msgid "site" msgstr "site" -#: ../../whatsnew/3.13.rst:1185 +#: ../../whatsnew/3.13.rst:1192 msgid "" ":file:`.pth` files are now decoded using UTF-8 first, and then with the :" "term:`locale encoding` if UTF-8 decoding fails. (Contributed by Inada Naoki " "in :gh:`117802`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1191 +#: ../../whatsnew/3.13.rst:1198 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.13.rst:1193 +#: ../../whatsnew/3.13.rst:1200 msgid "" "A :exc:`ResourceWarning` is now emitted if a :class:`~sqlite3.Connection` " "object is not :meth:`closed <sqlite3.Connection.close>` explicitly. " "(Contributed by Erlend E. Aasland in :gh:`105539`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1197 +#: ../../whatsnew/3.13.rst:1204 msgid "" "Add the *filter* keyword-only parameter to :meth:`.Connection.iterdump` for " "filtering database objects to dump. (Contributed by Mariusz Felisiak in :gh:" "`91602`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1203 +#: ../../whatsnew/3.13.rst:1210 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.13.rst:1205 +#: ../../whatsnew/3.13.rst:1212 msgid "" "The :func:`~ssl.create_default_context` API now includes :data:`~ssl." "VERIFY_X509_PARTIAL_CHAIN` and :data:`~ssl.VERIFY_X509_STRICT` in its " "default flags." msgstr "" -#: ../../whatsnew/3.13.rst:1211 +#: ../../whatsnew/3.13.rst:1218 msgid "" ":data:`~ssl.VERIFY_X509_STRICT` may reject pre-:rfc:`5280` or malformed " "certificates that the underlying OpenSSL implementation might otherwise " "accept. Whilst disabling this is not recommended, you can do so using:" msgstr "" -#: ../../whatsnew/3.13.rst:1216 +#: ../../whatsnew/3.13.rst:1223 msgid "" "import ssl\n" "\n" @@ -1827,15 +1838,15 @@ msgstr "" "ctx = ssl.create_default_context()\n" "ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" -#: ../../whatsnew/3.13.rst:1223 +#: ../../whatsnew/3.13.rst:1230 msgid "(Contributed by William Woodruff in :gh:`112389`.)" msgstr "(由 William Woodruff 在 :gh:`112389` 中貢獻。)" -#: ../../whatsnew/3.13.rst:1227 +#: ../../whatsnew/3.13.rst:1234 msgid "statistics" msgstr "statistics" -#: ../../whatsnew/3.13.rst:1229 +#: ../../whatsnew/3.13.rst:1236 msgid "" "Add :func:`~statistics.kde` for kernel density estimation. This makes it " "possible to estimate a continuous probability density function from a fixed " @@ -1843,24 +1854,24 @@ msgid "" "`115863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1234 +#: ../../whatsnew/3.13.rst:1241 msgid "" "Add :func:`~statistics.kde_random` for sampling from an estimated " "probability density function created by :func:`~statistics.kde`. " "(Contributed by Raymond Hettinger in :gh:`115863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1242 +#: ../../whatsnew/3.13.rst:1249 msgid "subprocess" msgstr "subprocess" -#: ../../whatsnew/3.13.rst:1244 +#: ../../whatsnew/3.13.rst:1251 msgid "" "The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " "in more situations." msgstr "" -#: ../../whatsnew/3.13.rst:1247 +#: ../../whatsnew/3.13.rst:1254 msgid "" "Notably, when *close_fds* is ``True`` (the default), :func:`~os.posix_spawn` " "will be used when the C library provides :c:func:`!" @@ -1869,7 +1880,7 @@ msgid "" "existing Linux :c:func:`!vfork` based code." msgstr "" -#: ../../whatsnew/3.13.rst:1254 +#: ../../whatsnew/3.13.rst:1261 msgid "" "A private control knob :attr:`!subprocess._USE_POSIX_SPAWN` can be set to " "``False`` if you need to force :mod:`subprocess` to never use :func:`~os." @@ -1879,22 +1890,22 @@ msgid "" "`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1264 ../../whatsnew/3.13.rst:2717 +#: ../../whatsnew/3.13.rst:1271 ../../whatsnew/3.13.rst:2732 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.13.rst:1266 +#: ../../whatsnew/3.13.rst:1273 msgid "" "Add the :func:`~sys._is_interned` function to test if a string was interned. " "This function is not guaranteed to exist in all implementations of Python. " "(Contributed by Serhiy Storchaka in :gh:`78573`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1272 +#: ../../whatsnew/3.13.rst:1279 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.13.rst:1274 +#: ../../whatsnew/3.13.rst:1281 msgid "" "On Windows, the default mode ``0o700`` used by :func:`tempfile.mkdtemp` now " "limits access to the new directory due to changes to :func:`os.mkdir`. This " @@ -1902,11 +1913,11 @@ msgid "" "`118486`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1281 +#: ../../whatsnew/3.13.rst:1288 msgid "time" msgstr "time" -#: ../../whatsnew/3.13.rst:1283 +#: ../../whatsnew/3.13.rst:1290 msgid "" "On Windows, :func:`~time.monotonic` now uses the " "``QueryPerformanceCounter()`` clock for a resolution of 1 microsecond, " @@ -1914,7 +1925,7 @@ msgid "" "milliseconds. (Contributed by Victor Stinner in :gh:`88494`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1289 +#: ../../whatsnew/3.13.rst:1296 msgid "" "On Windows, :func:`~time.time` now uses the " "``GetSystemTimePreciseAsFileTime()`` clock for a resolution of 1 " @@ -1923,11 +1934,11 @@ msgid "" "`63207`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1297 +#: ../../whatsnew/3.13.rst:1304 msgid "tkinter" msgstr "tkinter" -#: ../../whatsnew/3.13.rst:1299 +#: ../../whatsnew/3.13.rst:1306 msgid "" "Add :mod:`tkinter` widget methods: :meth:`!tk_busy_hold`, :meth:`!" "tk_busy_configure`, :meth:`!tk_busy_cget`, :meth:`!tk_busy_forget`, :meth:`!" @@ -1935,7 +1946,7 @@ msgid "" "klappnase and Serhiy Storchaka in :gh:`72684`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1305 +#: ../../whatsnew/3.13.rst:1312 msgid "" "The :mod:`tkinter` widget method :meth:`!wm_attributes` now accepts the " "attribute name without the minus prefix to get window attributes, for " @@ -1944,14 +1955,14 @@ msgid "" "wm_attributes(alpha=0.5)``. (Contributed by Serhiy Storchaka in :gh:`43457`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1312 +#: ../../whatsnew/3.13.rst:1319 msgid "" ":meth:`!wm_attributes` can now return attributes as a :class:`dict`, by " "using the new optional keyword-only parameter *return_python_dict*. " "(Contributed by Serhiy Storchaka in :gh:`43457`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1316 +#: ../../whatsnew/3.13.rst:1323 msgid "" ":meth:`!Text.count` can now return a simple :class:`int` when the new " "optional keyword-only parameter *return_ints* is used. Otherwise, the single " @@ -1959,27 +1970,27 @@ msgid "" "in :gh:`97928`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1321 +#: ../../whatsnew/3.13.rst:1328 msgid "" "Support the \"vsapi\" element type in the :meth:`~tkinter.ttk.Style." "element_create` method of :class:`tkinter.ttk.Style`. (Contributed by Serhiy " "Storchaka in :gh:`68166`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1326 +#: ../../whatsnew/3.13.rst:1333 msgid "" "Add the :meth:`!after_info` method for Tkinter widgets. (Contributed by " "Cheryl Sabella in :gh:`77020`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1329 +#: ../../whatsnew/3.13.rst:1336 msgid "" "Add a new :meth:`!copy_replace` method to :class:`!PhotoImage` to copy a " "region from one image to another, possibly with pixel zooming, subsampling, " "or both. (Contributed by Serhiy Storchaka in :gh:`118225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1334 +#: ../../whatsnew/3.13.rst:1341 msgid "" "Add *from_coords* parameter to the :class:`!PhotoImage` methods :meth:`!" "copy`, :meth:`!zoom` and :meth:`!subsample`. Add *zoom* and *subsample* " @@ -1987,7 +1998,7 @@ msgid "" "Serhiy Storchaka in :gh:`118225`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1340 +#: ../../whatsnew/3.13.rst:1347 msgid "" "Add the :class:`!PhotoImage` methods :meth:`!read` to read an image from a " "file and :meth:`!data` to get the image data. Add *background* and " @@ -1995,11 +2006,11 @@ msgid "" "Storchaka in :gh:`118271`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1348 +#: ../../whatsnew/3.13.rst:1355 msgid "traceback" msgstr "traceback" -#: ../../whatsnew/3.13.rst:1350 +#: ../../whatsnew/3.13.rst:1357 msgid "" "Add the :attr:`~traceback.TracebackException.exc_type_str` attribute to :" "class:`~traceback.TracebackException`, which holds a string display of the " @@ -2009,7 +2020,7 @@ msgid "" "(Contributed by Irit Katriel in :gh:`112332`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1359 +#: ../../whatsnew/3.13.rst:1366 msgid "" "Add a new *show_group* keyword-only parameter to :meth:`.TracebackException." "format_exception_only` to (recursively) format the nested exceptions of a :" @@ -2017,11 +2028,11 @@ msgid "" "`105292`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1366 +#: ../../whatsnew/3.13.rst:1373 msgid "types" msgstr "types" -#: ../../whatsnew/3.13.rst:1368 +#: ../../whatsnew/3.13.rst:1375 msgid "" ":class:`~types.SimpleNamespace` can now take a single positional argument to " "initialise the namespace's arguments. This argument must either be a mapping " @@ -2029,63 +2040,63 @@ msgid "" "`108191`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1375 ../../whatsnew/3.13.rst:1687 +#: ../../whatsnew/3.13.rst:1382 ../../whatsnew/3.13.rst:1710 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.13.rst:1377 +#: ../../whatsnew/3.13.rst:1384 msgid "" ":pep:`705`: Add :data:`~typing.ReadOnly`, a special typing construct to mark " "a :class:`~typing.TypedDict` item as read-only for type checkers." msgstr "" -#: ../../whatsnew/3.13.rst:1380 +#: ../../whatsnew/3.13.rst:1387 msgid "" ":pep:`742`: Add :data:`~typing.TypeIs`, a typing construct that can be used " "to instruct a type checker how to narrow a type." msgstr "" -#: ../../whatsnew/3.13.rst:1383 +#: ../../whatsnew/3.13.rst:1390 msgid "" "Add :data:`~typing.NoDefault`, a sentinel object used to represent the " "defaults of some parameters in the :mod:`typing` module. (Contributed by " "Jelle Zijlstra in :gh:`116126`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1387 +#: ../../whatsnew/3.13.rst:1394 msgid "" "Add :func:`~typing.get_protocol_members` to return the set of members " "defining a :class:`typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:" "`104873`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1391 +#: ../../whatsnew/3.13.rst:1398 msgid "" "Add :func:`~typing.is_protocol` to check whether a class is a :class:" "`~typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:`104873`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1395 +#: ../../whatsnew/3.13.rst:1402 msgid "" ":data:`~typing.ClassVar` can now be nested in :data:`~typing.Final`, and " "vice versa. (Contributed by Mehdi Drissi in :gh:`89547`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1401 +#: ../../whatsnew/3.13.rst:1408 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.13.rst:1403 +#: ../../whatsnew/3.13.rst:1410 msgid "" "Update the Unicode database to `version 15.1.0`__. (Contributed by James " "Gerity in :gh:`109559`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1410 +#: ../../whatsnew/3.13.rst:1417 msgid "venv" msgstr "venv" -#: ../../whatsnew/3.13.rst:1412 +#: ../../whatsnew/3.13.rst:1419 msgid "" "Add support for creating source control management (SCM) ignore files in a " "virtual environment's directory. By default, Git is supported. This is " @@ -2095,11 +2106,11 @@ msgid "" "Cannon in :gh:`108125`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1423 +#: ../../whatsnew/3.13.rst:1430 msgid "warnings" msgstr "warnings" -#: ../../whatsnew/3.13.rst:1425 +#: ../../whatsnew/3.13.rst:1432 msgid "" ":pep:`702`: The new :func:`warnings.deprecated` decorator provides a way to " "communicate deprecations to a :term:`static type checker` and to warn on " @@ -2108,62 +2119,62 @@ msgid "" "(Contributed by Jelle Zijlstra in :gh:`104003`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1434 +#: ../../whatsnew/3.13.rst:1441 msgid "xml" msgstr "xml" -#: ../../whatsnew/3.13.rst:1436 +#: ../../whatsnew/3.13.rst:1443 msgid "" "Allow controlling Expat >=2.6.0 reparse deferral (:cve:`2023-52425`) by " "adding five new methods:" msgstr "" -#: ../../whatsnew/3.13.rst:1439 +#: ../../whatsnew/3.13.rst:1446 msgid ":meth:`xml.etree.ElementTree.XMLParser.flush`" msgstr ":meth:`xml.etree.ElementTree.XMLParser.flush`" -#: ../../whatsnew/3.13.rst:1440 +#: ../../whatsnew/3.13.rst:1447 msgid ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" msgstr ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" -#: ../../whatsnew/3.13.rst:1441 +#: ../../whatsnew/3.13.rst:1448 msgid ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" msgstr ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" -#: ../../whatsnew/3.13.rst:1442 +#: ../../whatsnew/3.13.rst:1449 msgid ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" msgstr ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" -#: ../../whatsnew/3.13.rst:1443 +#: ../../whatsnew/3.13.rst:1450 msgid ":meth:`!xml.sax.expatreader.ExpatParser.flush`" msgstr ":meth:`!xml.sax.expatreader.ExpatParser.flush`" -#: ../../whatsnew/3.13.rst:1445 +#: ../../whatsnew/3.13.rst:1452 msgid "(Contributed by Sebastian Pipping in :gh:`115623`.)" msgstr "(由 Sebastian Pipping 在 :gh:`115623` 中貢獻。)" -#: ../../whatsnew/3.13.rst:1447 +#: ../../whatsnew/3.13.rst:1454 msgid "" "Add the :meth:`!close` method for the iterator returned by :func:`~xml.etree." "ElementTree.iterparse` for explicit cleanup. (Contributed by Serhiy " "Storchaka in :gh:`69893`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1453 +#: ../../whatsnew/3.13.rst:1460 msgid "zipimport" msgstr "zipimport" -#: ../../whatsnew/3.13.rst:1455 +#: ../../whatsnew/3.13.rst:1462 msgid "" "Add support for ZIP64_ format files. Everybody loves huge data, right? " "(Contributed by Tim Hatch in :gh:`94146`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1463 +#: ../../whatsnew/3.13.rst:1470 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.13.rst:1465 +#: ../../whatsnew/3.13.rst:1472 msgid "" "Several standard library modules have had their import times significantly " "improved. For example, the import time of the :mod:`typing` module has been " @@ -2174,13 +2185,13 @@ msgid "" "Turner, Daniel Hollas, and others in :gh:`109653`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1476 +#: ../../whatsnew/3.13.rst:1483 msgid "" ":func:`textwrap.indent` is now around 30% faster than before for large " "input. (Contributed by Inada Naoki in :gh:`107369`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1479 +#: ../../whatsnew/3.13.rst:1486 msgid "" "The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " "in more situations, including when *close_fds* is ``True`` (the default) on " @@ -2190,15 +2201,15 @@ msgid "" "Kulik in :gh:`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1489 +#: ../../whatsnew/3.13.rst:1496 msgid "Removed Modules And APIs" msgstr "" -#: ../../whatsnew/3.13.rst:1495 +#: ../../whatsnew/3.13.rst:1502 msgid "PEP 594: Remove \"dead batteries\" from the standard library" msgstr "" -#: ../../whatsnew/3.13.rst:1497 +#: ../../whatsnew/3.13.rst:1504 msgid "" ":pep:`594` proposed removing 19 modules from the standard library, " "colloquially referred to as 'dead batteries' due to their historic, " @@ -2206,23 +2217,23 @@ msgid "" "in Python 3.11, and are now removed:" msgstr "" -#: ../../whatsnew/3.13.rst:1503 +#: ../../whatsnew/3.13.rst:1510 msgid ":mod:`!aifc`" msgstr ":mod:`!aifc`" -#: ../../whatsnew/3.13.rst:1504 +#: ../../whatsnew/3.13.rst:1511 msgid ":mod:`!audioop`" msgstr ":mod:`!audioop`" -#: ../../whatsnew/3.13.rst:1505 +#: ../../whatsnew/3.13.rst:1512 msgid ":mod:`!chunk`" msgstr ":mod:`!chunk`" -#: ../../whatsnew/3.13.rst:1506 +#: ../../whatsnew/3.13.rst:1513 msgid ":mod:`!cgi` and :mod:`!cgitb`" msgstr ":mod:`!cgi` 和 :mod:`!cgitb`" -#: ../../whatsnew/3.13.rst:1508 +#: ../../whatsnew/3.13.rst:1515 msgid "" ":class:`!cgi.FieldStorage` can typically be replaced with :func:`urllib." "parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." @@ -2230,7 +2241,7 @@ msgid "" "requests." msgstr "" -#: ../../whatsnew/3.13.rst:1513 +#: ../../whatsnew/3.13.rst:1520 msgid "" ":func:`!cgi.parse` can be replaced by calling :func:`urllib.parse.parse_qs` " "directly on the desired query string, unless the input is ``multipart/form-" @@ -2238,14 +2249,14 @@ msgid "" "parse_multipart`." msgstr "" -#: ../../whatsnew/3.13.rst:1518 +#: ../../whatsnew/3.13.rst:1525 msgid "" ":func:`!cgi.parse_header` can be replaced with the functionality in the :mod:" "`email` package, which implements the same MIME RFCs. For example, with :" "class:`email.message.EmailMessage`:" msgstr "" -#: ../../whatsnew/3.13.rst:1522 +#: ../../whatsnew/3.13.rst:1529 msgid "" "from email.message import EmailMessage\n" "\n" @@ -2254,7 +2265,7 @@ msgid "" "main, params = msg.get_content_type(), msg['content-type'].params" msgstr "" -#: ../../whatsnew/3.13.rst:1530 +#: ../../whatsnew/3.13.rst:1537 msgid "" ":func:`!cgi.parse_multipart` can be replaced with the functionality in the :" "mod:`email` package, which implements the same MIME RFCs, or with the :pypi:" @@ -2262,41 +2273,41 @@ msgid "" "and :class:`email.message.Message` classes." msgstr "" -#: ../../whatsnew/3.13.rst:1536 +#: ../../whatsnew/3.13.rst:1543 msgid "" ":mod:`!crypt` and the private :mod:`!_crypt` extension. The :mod:`hashlib` " "module may be an appropriate replacement when simply hashing a value is " "required. Otherwise, various third-party libraries on PyPI are available:" msgstr "" -#: ../../whatsnew/3.13.rst:1541 +#: ../../whatsnew/3.13.rst:1548 msgid "" ":pypi:`bcrypt`: Modern password hashing for your software and your servers." msgstr "" -#: ../../whatsnew/3.13.rst:1543 +#: ../../whatsnew/3.13.rst:1550 msgid "" ":pypi:`passlib`: Comprehensive password hashing framework supporting over 30 " "schemes." msgstr "" -#: ../../whatsnew/3.13.rst:1545 +#: ../../whatsnew/3.13.rst:1552 msgid ":pypi:`argon2-cffi`: The secure Argon2 password hashing algorithm." msgstr "" -#: ../../whatsnew/3.13.rst:1547 +#: ../../whatsnew/3.13.rst:1554 msgid "" ":pypi:`legacycrypt`: :mod:`ctypes` wrapper to the POSIX crypt library call " "and associated functionality." msgstr "" -#: ../../whatsnew/3.13.rst:1550 +#: ../../whatsnew/3.13.rst:1557 msgid "" ":pypi:`crypt_r`: Fork of the :mod:`!crypt` module, wrapper to the :manpage:" "`crypt_r(3)` library call and associated functionality." msgstr "" -#: ../../whatsnew/3.13.rst:1555 +#: ../../whatsnew/3.13.rst:1562 msgid "" ":mod:`!imghdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements. For example, the :func:`!" @@ -2304,85 +2315,87 @@ msgid "" "function for all file formats that were supported by :mod:`!imghdr`." msgstr "" -#: ../../whatsnew/3.13.rst:1561 +#: ../../whatsnew/3.13.rst:1568 msgid ":mod:`!mailcap`: Use the :mod:`mimetypes` module instead." msgstr "" -#: ../../whatsnew/3.13.rst:1563 +#: ../../whatsnew/3.13.rst:1570 msgid ":mod:`!msilib`" msgstr ":mod:`!msilib`" -#: ../../whatsnew/3.13.rst:1564 +#: ../../whatsnew/3.13.rst:1571 msgid ":mod:`!nis`" msgstr ":mod:`!nis`" -#: ../../whatsnew/3.13.rst:1565 +#: ../../whatsnew/3.13.rst:1572 msgid ":mod:`!nntplib`: Use the :pypi:`pynntp` library from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1567 +#: ../../whatsnew/3.13.rst:1574 msgid "" ":mod:`!ossaudiodev`: For audio playback, use the :pypi:`pygame` library from " "PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1569 +#: ../../whatsnew/3.13.rst:1576 msgid "" ":mod:`!pipes`: Use the :mod:`subprocess` module instead. Use :func:`shlex." "quote` to replace the undocumented ``pipes.quote`` function." msgstr "" -#: ../../whatsnew/3.13.rst:1573 +#: ../../whatsnew/3.13.rst:1580 msgid "" ":mod:`!sndhdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements." msgstr "" -#: ../../whatsnew/3.13.rst:1576 +#: ../../whatsnew/3.13.rst:1583 msgid ":mod:`!spwd`: Use the :pypi:`python-pam` library from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1578 +#: ../../whatsnew/3.13.rst:1585 msgid ":mod:`!sunau`" msgstr ":mod:`!sunau`" -#: ../../whatsnew/3.13.rst:1579 +#: ../../whatsnew/3.13.rst:1586 msgid "" ":mod:`!telnetlib`, Use the :pypi:`telnetlib3` or :pypi:`Exscript` libraries " "from PyPI instead." msgstr "" -#: ../../whatsnew/3.13.rst:1581 +#: ../../whatsnew/3.13.rst:1588 msgid "" ":mod:`!uu`: Use the :mod:`base64` module instead, as a modern alternative." msgstr "" -#: ../../whatsnew/3.13.rst:1583 +#: ../../whatsnew/3.13.rst:1590 msgid ":mod:`!xdrlib`" msgstr ":mod:`!xdrlib`" -#: ../../whatsnew/3.13.rst:1585 +#: ../../whatsnew/3.13.rst:1592 msgid "" "(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` and :gh:" "`104780`.)" msgstr "" +"(由 Victor Stinner 和 Zachary Ware 在 :gh:`104773` 和 :gh:`104780` 中貢" +"獻。)" -#: ../../whatsnew/3.13.rst:1589 +#: ../../whatsnew/3.13.rst:1596 msgid "2to3" msgstr "2to3" -#: ../../whatsnew/3.13.rst:1591 +#: ../../whatsnew/3.13.rst:1598 msgid "" "Remove the :program:`2to3` program and the :mod:`!lib2to3` module, " "previously deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:" "`104780`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1597 +#: ../../whatsnew/3.13.rst:1604 msgid "builtins" msgstr "builtins" -#: ../../whatsnew/3.13.rst:1599 +#: ../../whatsnew/3.13.rst:1606 msgid "" "Remove support for chained :class:`classmethod` descriptors (introduced in :" "gh:`63272`). These can no longer be used to wrap other descriptors, such as :" @@ -2392,47 +2405,47 @@ msgid "" "(Contributed by Raymond Hettinger in :gh:`89519`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1608 +#: ../../whatsnew/3.13.rst:1615 msgid "" "Raise a :exc:`RuntimeError` when calling :meth:`frame.clear` on a suspended " "frame (as has always been the case for an executing frame). (Contributed by " "Irit Katriel in :gh:`79932`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1616 +#: ../../whatsnew/3.13.rst:1623 msgid "" "Remove the undocumented :class:`!LegacyInterpolation` class, deprecated in " "the docstring since Python 3.2, and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104886`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1623 +#: ../../whatsnew/3.13.rst:1630 msgid "importlib.metadata" msgstr "importlib.metadata" -#: ../../whatsnew/3.13.rst:1625 +#: ../../whatsnew/3.13.rst:1632 msgid "" "Remove deprecated subscript (:meth:`~object.__getitem__`) access for :ref:" "`EntryPoint <entry-points>` objects. (Contributed by Jason R. Coombs in :gh:" "`113175`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1631 +#: ../../whatsnew/3.13.rst:1638 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.13.rst:1633 +#: ../../whatsnew/3.13.rst:1640 msgid "" "Remove the :func:`!locale.resetlocale` function, deprecated in Python 3.11. " "Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. (Contributed by " "Victor Stinner in :gh:`104783`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1639 +#: ../../whatsnew/3.13.rst:1646 msgid "opcode" msgstr "opcode" -#: ../../whatsnew/3.13.rst:1641 +#: ../../whatsnew/3.13.rst:1648 msgid "" "Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!_opcode." "ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " @@ -2440,7 +2453,7 @@ msgid "" "Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1646 +#: ../../whatsnew/3.13.rst:1653 msgid "" "Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, and :" "attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but were " @@ -2448,43 +2461,60 @@ msgid "" "be used externally. (Contributed by Irit Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1656 +#: ../../whatsnew/3.13.rst:1661 +msgid "optparse" +msgstr "optparse" + +#: ../../whatsnew/3.13.rst:1663 +msgid "" +"This module is no longer considered :term:`soft deprecated`. While :mod:" +"`argparse` remains preferred for new projects that aren't using a third " +"party command line argument processing library, there are aspects of the way " +"``argparse`` works that mean the lower level ``optparse`` module may provide " +"a better foundation for *writing* argument processing libraries, and for " +"implementing command line applications which adhere more strictly than " +"``argparse`` does to various Unix command line processing conventions that " +"originate in the behaviour of the C :c:func:`!getopt` function . " +"(Contributed by Alyssa Coghlan and Serhiy Storchaka in :gh:`126180`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1679 msgid "" "Remove the ability to use :class:`~pathlib.Path` objects as context " "managers. This functionality was deprecated and has had no effect since " "Python 3.9. (Contributed by Barney Gale in :gh:`83863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1664 +#: ../../whatsnew/3.13.rst:1687 msgid "" "Remove the undocumented, deprecated, and broken :func:`!re.template` " "function and :attr:`!re.TEMPLATE` / :attr:`!re.T` flag. (Contributed by " "Serhiy Storchaka and Nikita Sobolev in :gh:`105687`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1670 +#: ../../whatsnew/3.13.rst:1693 msgid "tkinter.tix" msgstr "tkinter.tix" -#: ../../whatsnew/3.13.rst:1672 +#: ../../whatsnew/3.13.rst:1695 msgid "" "Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6. The third-" "party Tix library which the module wrapped is unmaintained. (Contributed by " "Zachary Ware in :gh:`75552`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1678 +#: ../../whatsnew/3.13.rst:1701 msgid "turtle" msgstr "turtle" -#: ../../whatsnew/3.13.rst:1680 +#: ../../whatsnew/3.13.rst:1703 msgid "" "Remove the :meth:`!RawTurtle.settiltangle` method, deprecated in the " "documentation since Python 3.1 and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104876`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1689 +#: ../../whatsnew/3.13.rst:1712 msgid "" "Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces, deprecated " "since Python 3.8. The items in those namespaces can be imported directly " @@ -2492,66 +2522,66 @@ msgid "" "`92871`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1695 +#: ../../whatsnew/3.13.rst:1718 msgid "" "Remove the keyword-argument method of creating :class:`~typing.TypedDict` " "types, deprecated in Python 3.11. (Contributed by Tomas Roun in :gh:" "`104786`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1701 +#: ../../whatsnew/3.13.rst:1724 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.13.rst:1703 +#: ../../whatsnew/3.13.rst:1726 msgid "" "Remove the following :mod:`unittest` functions, deprecated in Python 3.11:" -msgstr "" +msgstr "移除以下在 Python 3.11 中已被棄用的 :mod:`unittest` 函式:" -#: ../../whatsnew/3.13.rst:1705 +#: ../../whatsnew/3.13.rst:1728 msgid ":func:`!unittest.findTestCases`" msgstr ":func:`!unittest.findTestCases`" -#: ../../whatsnew/3.13.rst:1706 +#: ../../whatsnew/3.13.rst:1729 msgid ":func:`!unittest.makeSuite`" msgstr ":func:`!unittest.makeSuite`" -#: ../../whatsnew/3.13.rst:1707 +#: ../../whatsnew/3.13.rst:1730 msgid ":func:`!unittest.getTestCaseNames`" msgstr ":func:`!unittest.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1709 +#: ../../whatsnew/3.13.rst:1732 msgid "Use :class:`~unittest.TestLoader` methods instead:" msgstr "" -#: ../../whatsnew/3.13.rst:1711 +#: ../../whatsnew/3.13.rst:1734 msgid ":meth:`~unittest.TestLoader.loadTestsFromModule`" msgstr ":meth:`~unittest.TestLoader.loadTestsFromModule`" -#: ../../whatsnew/3.13.rst:1712 +#: ../../whatsnew/3.13.rst:1735 msgid ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" msgstr ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" -#: ../../whatsnew/3.13.rst:1713 +#: ../../whatsnew/3.13.rst:1736 msgid ":meth:`~unittest.TestLoader.getTestCaseNames`" msgstr ":meth:`~unittest.TestLoader.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1715 +#: ../../whatsnew/3.13.rst:1738 msgid "(Contributed by Hugo van Kemenade in :gh:`104835`.)" msgstr "(由 Hugo van Kemenade 在 :gh:`104835` 中貢獻。)" -#: ../../whatsnew/3.13.rst:1717 +#: ../../whatsnew/3.13.rst:1740 msgid "" "Remove the untested and undocumented :meth:`!TestProgram.usageExit` method, " "deprecated in Python 3.11. (Contributed by Hugo van Kemenade in :gh:" "`104992`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1723 +#: ../../whatsnew/3.13.rst:1746 msgid "urllib" msgstr "urllib" -#: ../../whatsnew/3.13.rst:1725 +#: ../../whatsnew/3.13.rst:1748 msgid "" "Remove the *cafile*, *capath*, and *cadefault* parameters of the :func:" "`urllib.request.urlopen` function, deprecated in Python 3.6. Use the " @@ -2562,33 +2592,33 @@ msgid "" "Victor Stinner in :gh:`105382`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1736 +#: ../../whatsnew/3.13.rst:1759 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.13.rst:1738 +#: ../../whatsnew/3.13.rst:1761 msgid "" "Remove the untested and undocumented :class:`!MacOSX` class, deprecated in " "Python 3.11. Use the :class:`!MacOSXOSAScript` class (introduced in Python " "3.2) instead. (Contributed by Hugo van Kemenade in :gh:`104804`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1743 +#: ../../whatsnew/3.13.rst:1766 msgid "" "Remove the deprecated :attr:`!MacOSXOSAScript._name` attribute. Use the :" "attr:`MacOSXOSAScript.name <webbrowser.controller.name>` attribute instead. " "(Contributed by Nikita Sobolev in :gh:`105546`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1750 +#: ../../whatsnew/3.13.rst:1773 msgid "New Deprecations" msgstr "" -#: ../../whatsnew/3.13.rst:1752 +#: ../../whatsnew/3.13.rst:1775 msgid ":ref:`User-defined functions <user-defined-funcs>`:" msgstr "" -#: ../../whatsnew/3.13.rst:1754 +#: ../../whatsnew/3.13.rst:1777 msgid "" "Deprecate assignment to a function's :attr:`~function.__code__` attribute, " "where the new code object's type does not match the function's type. The " @@ -2596,12 +2626,12 @@ msgid "" "coroutine. (Contributed by Irit Katriel in :gh:`81137`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1760 +#: ../../whatsnew/3.13.rst:1783 #: ../../deprecations/pending-removal-in-3.16.rst:11 msgid ":mod:`array`:" msgstr ":mod:`array`:" -#: ../../whatsnew/3.13.rst:1762 +#: ../../whatsnew/3.13.rst:1785 msgid "" "Deprecate the ``'u'`` format code (:c:type:`wchar_t`) at runtime. This " "format code has been deprecated in documentation since Python 3.3, and will " @@ -2610,73 +2640,61 @@ msgid "" "`80480`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1769 +#: ../../whatsnew/3.13.rst:1792 #: ../../deprecations/pending-removal-in-3.15.rst:16 msgid ":mod:`ctypes`:" msgstr ":mod:`ctypes`:" -#: ../../whatsnew/3.13.rst:1771 +#: ../../whatsnew/3.13.rst:1794 msgid "" "Deprecate the undocumented :func:`!SetPointerType` function, to be removed " "in Python 3.15. (Contributed by Victor Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1775 +#: ../../whatsnew/3.13.rst:1798 msgid "" ":term:`Soft-deprecate <soft deprecated>` the :func:`~ctypes.ARRAY` function " "in favour of ``type * length`` multiplication. (Contributed by Victor " "Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1779 +#: ../../whatsnew/3.13.rst:1802 msgid ":mod:`decimal`:" msgstr ":mod:`decimal`:" -#: ../../whatsnew/3.13.rst:1781 +#: ../../whatsnew/3.13.rst:1804 msgid "" "Deprecate the non-standard and undocumented :class:`~decimal.Decimal` format " "specifier ``'N'``, which is only supported in the :mod:`!decimal` module's C " "implementation. (Contributed by Serhiy Storchaka in :gh:`89902`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1786 +#: ../../whatsnew/3.13.rst:1809 msgid ":mod:`dis`:" msgstr ":mod:`dis`:" -#: ../../whatsnew/3.13.rst:1788 +#: ../../whatsnew/3.13.rst:1811 msgid "" "Deprecate the :attr:`!HAVE_ARGUMENT` separator. Check membership in :data:" "`~dis.hasarg` instead. (Contributed by Irit Katriel in :gh:`109319`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1792 -msgid ":mod:`getopt` and :mod:`optparse`:" -msgstr ":mod:`getopt` 和 :mod:`optparse`:" - -#: ../../whatsnew/3.13.rst:1794 -msgid "" -"Both modules are now :term:`soft deprecated`, with :mod:`argparse` preferred " -"for new projects. This is a new soft-deprecation for the :mod:`!getopt` " -"module, whereas the :mod:`!optparse` module was already *de facto* soft " -"deprecated. (Contributed by Victor Stinner in :gh:`106535`.)" -msgstr "" - -#: ../../whatsnew/3.13.rst:1800 +#: ../../whatsnew/3.13.rst:1815 msgid ":mod:`gettext`:" msgstr ":mod:`gettext`:" -#: ../../whatsnew/3.13.rst:1802 +#: ../../whatsnew/3.13.rst:1817 msgid "" "Deprecate non-integer numbers as arguments to functions and methods that " "consider plural forms in the :mod:`!gettext` module, even if no translation " "was found. (Contributed by Serhiy Storchaka in :gh:`88434`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1807 +#: ../../whatsnew/3.13.rst:1822 msgid ":mod:`glob`:" msgstr ":mod:`glob`:" -#: ../../whatsnew/3.13.rst:1809 +#: ../../whatsnew/3.13.rst:1824 msgid "" "Deprecate the undocumented :func:`!glob0` and :func:`!glob1` functions. Use :" "func:`~glob.glob` and pass a :term:`path-like object` specifying the root " @@ -2684,12 +2702,12 @@ msgid "" "in :gh:`117337`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1814 +#: ../../whatsnew/3.13.rst:1829 #: ../../deprecations/pending-removal-in-3.15.rst:21 msgid ":mod:`http.server`:" msgstr ":mod:`http.server`:" -#: ../../whatsnew/3.13.rst:1816 +#: ../../whatsnew/3.13.rst:1831 msgid "" "Deprecate :class:`~http.server.CGIHTTPRequestHandler`, to be removed in " "Python 3.15. Process-based CGI HTTP servers have been out of favor for a " @@ -2698,29 +2716,29 @@ msgid "" "by Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1823 +#: ../../whatsnew/3.13.rst:1838 msgid "" "Deprecate the :option:`!--cgi` flag to the :program:`python -m http.server` " "command-line interface, to be removed in Python 3.15. (Contributed by " "Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1828 +#: ../../whatsnew/3.13.rst:1843 msgid ":mod:`mimetypes`:" msgstr ":mod:`mimetypes`:" -#: ../../whatsnew/3.13.rst:1830 +#: ../../whatsnew/3.13.rst:1845 msgid "" ":term:`Soft-deprecate <soft deprecated>` file path arguments to :func:" "`~mimetypes.guess_type`, use :func:`~mimetypes.guess_file_type` instead. " "(Contributed by Serhiy Storchaka in :gh:`66543`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1835 +#: ../../whatsnew/3.13.rst:1850 msgid ":mod:`re`:" msgstr ":mod:`re`:" -#: ../../whatsnew/3.13.rst:1837 +#: ../../whatsnew/3.13.rst:1852 msgid "" "Deprecate passing the optional *maxsplit*, *count*, or *flags* arguments as " "positional arguments to the module-level :func:`~re.split`, :func:`~re.sub`, " @@ -2729,46 +2747,46 @@ msgid "" "by Serhiy Storchaka in :gh:`56166`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1844 +#: ../../whatsnew/3.13.rst:1859 #: ../../deprecations/pending-removal-in-3.15.rst:42 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../whatsnew/3.13.rst:1846 +#: ../../whatsnew/3.13.rst:1861 msgid "" "Deprecate :meth:`.PurePath.is_reserved`, to be removed in Python 3.15. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows. (Contributed " "by Barney Gale in :gh:`88569`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1851 +#: ../../whatsnew/3.13.rst:1866 #: ../../deprecations/pending-removal-in-3.15.rst:48 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../whatsnew/3.13.rst:1853 +#: ../../whatsnew/3.13.rst:1868 msgid "" "Deprecate :func:`~platform.java_ver`, to be removed in Python 3.15. This " "function is only useful for Jython support, has a confusing API, and is " "largely untested. (Contributed by Nikita Sobolev in :gh:`116349`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1859 +#: ../../whatsnew/3.13.rst:1874 msgid ":mod:`pydoc`:" msgstr ":mod:`pydoc`:" -#: ../../whatsnew/3.13.rst:1861 +#: ../../whatsnew/3.13.rst:1876 msgid "" "Deprecate the undocumented :func:`!ispackage` function. (Contributed by " "Zackery Spytz in :gh:`64020`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1864 +#: ../../whatsnew/3.13.rst:1879 #: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../whatsnew/3.13.rst:1866 +#: ../../whatsnew/3.13.rst:1881 msgid "" "Deprecate passing more than one positional argument to the :func:`~sqlite3." "connect` function and the :class:`~sqlite3.Connection` constructor. The " @@ -2776,7 +2794,7 @@ msgid "" "by Erlend E. Aasland in :gh:`107948`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1872 +#: ../../whatsnew/3.13.rst:1887 msgid "" "Deprecate passing name, number of arguments, and the callable as keyword " "arguments for :meth:`.Connection.create_function` and :meth:`.Connection." @@ -2784,7 +2802,7 @@ msgid "" "3.15. (Contributed by Erlend E. Aasland in :gh:`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1878 +#: ../../whatsnew/3.13.rst:1893 msgid "" "Deprecate passing the callback callable by keyword for the :meth:`~sqlite3." "Connection.set_authorizer`, :meth:`~sqlite3.Connection." @@ -2794,46 +2812,46 @@ msgid "" "`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1886 +#: ../../whatsnew/3.13.rst:1901 #: ../../deprecations/pending-removal-in-3.16.rst:47 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" -#: ../../whatsnew/3.13.rst:1888 +#: ../../whatsnew/3.13.rst:1903 msgid "" "Deprecate the :func:`~sys._enablelegacywindowsfsencoding` function, to be " "removed in Python 3.16. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable instead. (Contributed by Inada Naoki in :gh:`73427`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1893 +#: ../../whatsnew/3.13.rst:1908 #: ../../deprecations/pending-removal-in-3.16.rst:53 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" -#: ../../whatsnew/3.13.rst:1895 +#: ../../whatsnew/3.13.rst:1910 msgid "" "Deprecate the undocumented and unused :attr:`!TarFile.tarfile` attribute, to " "be removed in Python 3.16. (Contributed in :gh:`115256`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1899 +#: ../../whatsnew/3.13.rst:1914 msgid ":mod:`traceback`:" msgstr ":mod:`traceback`:" -#: ../../whatsnew/3.13.rst:1901 +#: ../../whatsnew/3.13.rst:1916 msgid "" "Deprecate the :attr:`.TracebackException.exc_type` attribute. Use :attr:`." "TracebackException.exc_type_str` instead. (Contributed by Irit Katriel in :" "gh:`112332`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1905 +#: ../../whatsnew/3.13.rst:1920 #: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../whatsnew/3.13.rst:1907 +#: ../../whatsnew/3.13.rst:1922 msgid "" "Deprecate the undocumented keyword argument syntax for creating :class:" "`~typing.NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, " @@ -2841,7 +2859,7 @@ msgid "" "functional syntax instead. (Contributed by Alex Waygood in :gh:`105566`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1914 +#: ../../whatsnew/3.13.rst:1929 msgid "" "Deprecate omitting the *fields* parameter when creating a :class:`~typing." "NamedTuple` or :class:`typing.TypedDict` class, and deprecate passing " @@ -2853,7 +2871,7 @@ msgid "" "Alex Waygood in :gh:`105566` and :gh:`105570`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1924 +#: ../../whatsnew/3.13.rst:1939 msgid "" "Deprecate the :func:`typing.no_type_check_decorator` decorator function, to " "be removed in in Python 3.15. After eight years in the :mod:`typing` module, " @@ -2861,7 +2879,7 @@ msgid "" "Waygood in :gh:`106309`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1930 +#: ../../whatsnew/3.13.rst:1945 msgid "" "Deprecate :data:`typing.AnyStr`. In Python 3.16, it will be removed from " "``typing.__all__``, and a :exc:`DeprecationWarning` will be emitted at " @@ -2870,12 +2888,12 @@ msgid "" "(Contributed by Michael The in :gh:`107116`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1938 +#: ../../whatsnew/3.13.rst:1953 #: ../../deprecations/pending-removal-in-3.15.rst:84 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../whatsnew/3.13.rst:1940 +#: ../../whatsnew/3.13.rst:1955 msgid "" "Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:" "`~wave.Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :" @@ -3780,11 +3798,11 @@ msgstr "" ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." "zipimporter.exec_module`。" -#: ../../whatsnew/3.13.rst:1957 +#: ../../whatsnew/3.13.rst:1972 msgid "CPython Bytecode Changes" msgstr "" -#: ../../whatsnew/3.13.rst:1959 +#: ../../whatsnew/3.13.rst:1974 msgid "" "The oparg of :opcode:`YIELD_VALUE` is now ``1`` if the yield is part of a " "yield-from or await, and ``0`` otherwise. The oparg of :opcode:`RESUME` was " @@ -3793,97 +3811,97 @@ msgid "" "`111354`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1967 +#: ../../whatsnew/3.13.rst:1982 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.13.rst:1972 +#: ../../whatsnew/3.13.rst:1987 msgid "" "Add the :ref:`PyMonitoring C API <c-api-monitoring>` for generating :pep:" "`669` monitoring events:" msgstr "" -#: ../../whatsnew/3.13.rst:1975 +#: ../../whatsnew/3.13.rst:1990 msgid ":c:type:`PyMonitoringState`" msgstr ":c:type:`PyMonitoringState`" -#: ../../whatsnew/3.13.rst:1976 +#: ../../whatsnew/3.13.rst:1991 msgid ":c:func:`PyMonitoring_FirePyStartEvent`" msgstr ":c:func:`PyMonitoring_FirePyStartEvent`" -#: ../../whatsnew/3.13.rst:1977 +#: ../../whatsnew/3.13.rst:1992 msgid ":c:func:`PyMonitoring_FirePyResumeEvent`" msgstr ":c:func:`PyMonitoring_FirePyResumeEvent`" -#: ../../whatsnew/3.13.rst:1978 +#: ../../whatsnew/3.13.rst:1993 msgid ":c:func:`PyMonitoring_FirePyReturnEvent`" msgstr ":c:func:`PyMonitoring_FirePyReturnEvent`" -#: ../../whatsnew/3.13.rst:1979 +#: ../../whatsnew/3.13.rst:1994 msgid ":c:func:`PyMonitoring_FirePyYieldEvent`" msgstr ":c:func:`PyMonitoring_FirePyYieldEvent`" -#: ../../whatsnew/3.13.rst:1980 +#: ../../whatsnew/3.13.rst:1995 msgid ":c:func:`PyMonitoring_FireCallEvent`" msgstr ":c:func:`PyMonitoring_FireCallEvent`" -#: ../../whatsnew/3.13.rst:1981 +#: ../../whatsnew/3.13.rst:1996 msgid ":c:func:`PyMonitoring_FireLineEvent`" msgstr ":c:func:`PyMonitoring_FireLineEvent`" -#: ../../whatsnew/3.13.rst:1982 +#: ../../whatsnew/3.13.rst:1997 msgid ":c:func:`PyMonitoring_FireJumpEvent`" msgstr ":c:func:`PyMonitoring_FireJumpEvent`" -#: ../../whatsnew/3.13.rst:1983 +#: ../../whatsnew/3.13.rst:1998 msgid ":c:func:`PyMonitoring_FireBranchEvent`" msgstr ":c:func:`PyMonitoring_FireBranchEvent`" -#: ../../whatsnew/3.13.rst:1984 +#: ../../whatsnew/3.13.rst:1999 msgid ":c:func:`PyMonitoring_FireCReturnEvent`" msgstr ":c:func:`PyMonitoring_FireCReturnEvent`" -#: ../../whatsnew/3.13.rst:1985 +#: ../../whatsnew/3.13.rst:2000 msgid ":c:func:`PyMonitoring_FirePyThrowEvent`" msgstr ":c:func:`PyMonitoring_FirePyThrowEvent`" -#: ../../whatsnew/3.13.rst:1986 +#: ../../whatsnew/3.13.rst:2001 msgid ":c:func:`PyMonitoring_FireRaiseEvent`" msgstr ":c:func:`PyMonitoring_FireRaiseEvent`" -#: ../../whatsnew/3.13.rst:1987 +#: ../../whatsnew/3.13.rst:2002 msgid ":c:func:`PyMonitoring_FireCRaiseEvent`" msgstr ":c:func:`PyMonitoring_FireCRaiseEvent`" -#: ../../whatsnew/3.13.rst:1988 +#: ../../whatsnew/3.13.rst:2003 msgid ":c:func:`PyMonitoring_FireReraiseEvent`" msgstr ":c:func:`PyMonitoring_FireReraiseEvent`" -#: ../../whatsnew/3.13.rst:1989 +#: ../../whatsnew/3.13.rst:2004 msgid ":c:func:`PyMonitoring_FireExceptionHandledEvent`" msgstr ":c:func:`PyMonitoring_FireExceptionHandledEvent`" -#: ../../whatsnew/3.13.rst:1990 +#: ../../whatsnew/3.13.rst:2005 msgid ":c:func:`PyMonitoring_FirePyUnwindEvent`" msgstr ":c:func:`PyMonitoring_FirePyUnwindEvent`" -#: ../../whatsnew/3.13.rst:1991 +#: ../../whatsnew/3.13.rst:2006 msgid ":c:func:`PyMonitoring_FireStopIterationEvent`" msgstr ":c:func:`PyMonitoring_FireStopIterationEvent`" -#: ../../whatsnew/3.13.rst:1992 +#: ../../whatsnew/3.13.rst:2007 msgid ":c:func:`PyMonitoring_EnterScope`" msgstr ":c:func:`PyMonitoring_EnterScope`" -#: ../../whatsnew/3.13.rst:1993 +#: ../../whatsnew/3.13.rst:2008 msgid ":c:func:`PyMonitoring_ExitScope`" msgstr ":c:func:`PyMonitoring_ExitScope`" -#: ../../whatsnew/3.13.rst:1995 +#: ../../whatsnew/3.13.rst:2010 msgid "(Contributed by Irit Katriel in :gh:`111997`)." -msgstr "" +msgstr "(由 Irit Katriel 在 :gh:`111997` 中貢獻。)" -#: ../../whatsnew/3.13.rst:1997 +#: ../../whatsnew/3.13.rst:2012 msgid "" "Add :c:type:`PyMutex`, a lightweight mutex that occupies a single byte, and " "the new :c:func:`PyMutex_Lock` and :c:func:`PyMutex_Unlock` functions. :c:" @@ -3891,52 +3909,52 @@ msgid "" "operation needs to block. (Contributed by Sam Gross in :gh:`108724`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2003 +#: ../../whatsnew/3.13.rst:2018 msgid "" "Add the :ref:`PyTime C API <c-api-time>` to provide access to system clocks:" msgstr "" -#: ../../whatsnew/3.13.rst:2005 +#: ../../whatsnew/3.13.rst:2020 msgid ":c:type:`PyTime_t`." msgstr ":c:type:`PyTime_t`。" -#: ../../whatsnew/3.13.rst:2006 +#: ../../whatsnew/3.13.rst:2021 msgid ":c:var:`PyTime_MIN` and :c:var:`PyTime_MAX`." msgstr "" -#: ../../whatsnew/3.13.rst:2007 +#: ../../whatsnew/3.13.rst:2022 msgid ":c:func:`PyTime_AsSecondsDouble`." msgstr ":c:func:`PyTime_AsSecondsDouble`。" -#: ../../whatsnew/3.13.rst:2008 +#: ../../whatsnew/3.13.rst:2023 msgid ":c:func:`PyTime_Monotonic`." msgstr ":c:func:`PyTime_Monotonic`。" -#: ../../whatsnew/3.13.rst:2009 +#: ../../whatsnew/3.13.rst:2024 msgid ":c:func:`PyTime_MonotonicRaw`." msgstr ":c:func:`PyTime_MonotonicRaw`。" -#: ../../whatsnew/3.13.rst:2010 +#: ../../whatsnew/3.13.rst:2025 msgid ":c:func:`PyTime_PerfCounter`." msgstr ":c:func:`PyTime_PerfCounter`。" -#: ../../whatsnew/3.13.rst:2011 +#: ../../whatsnew/3.13.rst:2026 msgid ":c:func:`PyTime_PerfCounterRaw`." msgstr ":c:func:`PyTime_PerfCounterRaw`。" -#: ../../whatsnew/3.13.rst:2012 +#: ../../whatsnew/3.13.rst:2027 msgid ":c:func:`PyTime_Time`." msgstr ":c:func:`PyTime_Time`。" -#: ../../whatsnew/3.13.rst:2013 +#: ../../whatsnew/3.13.rst:2028 msgid ":c:func:`PyTime_TimeRaw`." msgstr ":c:func:`PyTime_TimeRaw`。" -#: ../../whatsnew/3.13.rst:2015 +#: ../../whatsnew/3.13.rst:2030 msgid "(Contributed by Victor Stinner and Petr Viktorin in :gh:`110850`.)" msgstr "(由 Victor Stinner 和 Petr Viktorin 在 :gh:`110850` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2017 +#: ../../whatsnew/3.13.rst:2032 msgid "" "Add the :c:func:`PyDict_ContainsString` function with the same behavior as :" "c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const char*` " @@ -3944,7 +3962,7 @@ msgid "" "by Victor Stinner in :gh:`108314`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2023 +#: ../../whatsnew/3.13.rst:2038 msgid "" "Add the :c:func:`PyDict_GetItemRef` and :c:func:`PyDict_GetItemStringRef` " "functions, which behave similarly to :c:func:`PyDict_GetItemWithError`, but " @@ -3954,7 +3972,7 @@ msgid "" "`106004`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2031 +#: ../../whatsnew/3.13.rst:2046 msgid "" "Add the :c:func:`PyDict_SetDefaultRef` function, which behaves similarly to :" "c:func:`PyDict_SetDefault`, but returns a :term:`strong reference` instead " @@ -3963,7 +3981,7 @@ msgid "" "dictionary. (Contributed by Sam Gross in :gh:`112066`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2039 +#: ../../whatsnew/3.13.rst:2054 msgid "" "Add the :c:func:`PyDict_Pop` and :c:func:`PyDict_PopString` functions to " "remove a key from a dictionary and optionally return the removed value. This " @@ -3972,7 +3990,7 @@ msgid "" "Victor Stinner in :gh:`111262`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2046 +#: ../../whatsnew/3.13.rst:2061 msgid "" "Add the :c:func:`PyMapping_GetOptionalItem` and :c:func:" "`PyMapping_GetOptionalItemString` functions as alternatives to :c:func:" @@ -3983,7 +4001,7 @@ msgid "" "gh:`106307`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2056 +#: ../../whatsnew/3.13.rst:2071 msgid "" "Add the :c:func:`PyObject_GetOptionalAttr` and :c:func:" "`PyObject_GetOptionalAttrString` functions as alternatives to :c:func:" @@ -3994,37 +4012,37 @@ msgid "" "Serhiy Storchaka in :gh:`106521`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2066 +#: ../../whatsnew/3.13.rst:2081 msgid "" "Add the :c:func:`PyErr_FormatUnraisable` function as an extension to :c:func:" "`PyErr_WriteUnraisable` that allows customizing the warning message. " "(Contributed by Serhiy Storchaka in :gh:`108082`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2071 +#: ../../whatsnew/3.13.rst:2086 msgid "" "Add new functions that return a :term:`strong reference` instead of a :term:" "`borrowed reference` for frame locals, globals, and builtins, as part of :" "ref:`PEP 667 <whatsnew313-locals-semantics>`:" msgstr "" -#: ../../whatsnew/3.13.rst:2075 +#: ../../whatsnew/3.13.rst:2090 msgid ":c:func:`PyEval_GetFrameBuiltins` replaces :c:func:`PyEval_GetBuiltins`" msgstr ":c:func:`PyEval_GetFrameBuiltins` 取代 :c:func:`PyEval_GetBuiltins`" -#: ../../whatsnew/3.13.rst:2076 +#: ../../whatsnew/3.13.rst:2091 msgid ":c:func:`PyEval_GetFrameGlobals` replaces :c:func:`PyEval_GetGlobals`" msgstr ":c:func:`PyEval_GetFrameGlobals` 取代 :c:func:`PyEval_GetGlobals`" -#: ../../whatsnew/3.13.rst:2077 +#: ../../whatsnew/3.13.rst:2092 msgid ":c:func:`PyEval_GetFrameLocals` replaces :c:func:`PyEval_GetLocals`" msgstr ":c:func:`PyEval_GetFrameLocals` 取代 :c:func:`PyEval_GetLocals`" -#: ../../whatsnew/3.13.rst:2079 +#: ../../whatsnew/3.13.rst:2094 msgid "(Contributed by Mark Shannon and Tian Gao in :gh:`74929`.)" msgstr "(由 Mark Shannon 和 Tian Gao 在 :gh:`74929` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2081 +#: ../../whatsnew/3.13.rst:2096 msgid "" "Add the :c:func:`Py_GetConstant` and :c:func:`Py_GetConstantBorrowed` " "functions to get :term:`strong <strong reference>` or :term:`borrowed " @@ -4033,7 +4051,7 @@ msgid "" "constant zero. (Contributed by Victor Stinner in :gh:`115754`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2088 +#: ../../whatsnew/3.13.rst:2103 msgid "" "Add the :c:func:`PyImport_AddModuleRef` function as a replacement for :c:" "func:`PyImport_AddModule` that returns a :term:`strong reference` instead of " @@ -4041,35 +4059,35 @@ msgid "" "`105922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2093 +#: ../../whatsnew/3.13.rst:2108 msgid "" "Add the :c:func:`Py_IsFinalizing` function to check whether the main Python " "interpreter is :term:`shutting down <interpreter shutdown>`. (Contributed by " "Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2098 +#: ../../whatsnew/3.13.rst:2113 msgid "" "Add the :c:func:`PyList_GetItemRef` function as a replacement for :c:func:" "`PyList_GetItem` that returns a :term:`strong reference` instead of a :term:" "`borrowed reference`. (Contributed by Sam Gross in :gh:`114329`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2103 +#: ../../whatsnew/3.13.rst:2118 msgid "" "Add the :c:func:`PyList_Extend` and :c:func:`PyList_Clear` functions, " "mirroring the Python :meth:`!list.extend` and :meth:`!list.clear` methods. " "(Contributed by Victor Stinner in :gh:`111138`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2107 +#: ../../whatsnew/3.13.rst:2122 msgid "" "Add the :c:func:`PyLong_AsInt` function. It behaves similarly to :c:func:" "`PyLong_AsLong`, but stores the result in a C :c:expr:`int` instead of a C :" "c:expr:`long`. (Contributed by Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2112 +#: ../../whatsnew/3.13.rst:2127 msgid "" "Add the :c:func:`PyLong_AsNativeBytes`, :c:func:`PyLong_FromNativeBytes`, " "and :c:func:`PyLong_FromUnsignedNativeBytes` functions to simplify " @@ -4077,27 +4095,27 @@ msgid "" "(Contributed by Steve Dower in :gh:`111140`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2118 +#: ../../whatsnew/3.13.rst:2133 msgid "" "Add :c:func:`PyModule_Add` function, which is similar to :c:func:" "`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but always steals " "a reference to the value. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2123 +#: ../../whatsnew/3.13.rst:2138 msgid "" "Add the :c:func:`PyObject_GenericHash` function that implements the default " "hashing function of a Python object. (Contributed by Serhiy Storchaka in :gh:" "`113024`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2127 +#: ../../whatsnew/3.13.rst:2142 msgid "" "Add the :c:func:`Py_HashPointer` function to hash a raw pointer. " "(Contributed by Victor Stinner in :gh:`111545`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2130 +#: ../../whatsnew/3.13.rst:2145 msgid "" "Add the :c:func:`PyObject_VisitManagedDict` and :c:func:" "`PyObject_ClearManagedDict` functions. which must be called by the traverse " @@ -4106,7 +4124,7 @@ msgid "" "with Python 3.11 and 3.12. (Contributed by Victor Stinner in :gh:`107073`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2138 +#: ../../whatsnew/3.13.rst:2153 msgid "" "Add the :c:func:`PyRefTracer_SetTracer` and :c:func:`PyRefTracer_GetTracer` " "functions, which enable tracking object creation and destruction in the same " @@ -4114,14 +4132,14 @@ msgid "" "in :gh:`93502`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2144 +#: ../../whatsnew/3.13.rst:2159 msgid "" "Add the :c:func:`PySys_AuditTuple` function as an alternative to :c:func:" "`PySys_Audit` that takes event arguments as a Python :class:`tuple` object. " "(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2149 +#: ../../whatsnew/3.13.rst:2164 msgid "" "Add the :c:func:`PyThreadState_GetUnchecked()` function as an alternative " "to :c:func:`PyThreadState_Get()` that doesn't kill the process with a fatal " @@ -4129,7 +4147,7 @@ msgid "" "result is ``NULL``. (Contributed by Victor Stinner in :gh:`108867`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2155 +#: ../../whatsnew/3.13.rst:2170 msgid "" "Add the :c:func:`PyType_GetFullyQualifiedName` function to get the type's " "fully qualified name. The module name is prepended if :attr:`type." @@ -4137,14 +4155,14 @@ msgid "" "``'__main__'``. (Contributed by Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2161 +#: ../../whatsnew/3.13.rst:2176 msgid "" "Add the :c:func:`PyType_GetModuleName` function to get the type's module " "name. This is equivalent to getting the :attr:`type.__module__` attribute. " "(Contributed by Eric Snow and Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2166 +#: ../../whatsnew/3.13.rst:2181 msgid "" "Add the :c:func:`PyUnicode_EqualToUTF8AndSize` and :c:func:" "`PyUnicode_EqualToUTF8` functions to compare a Unicode object with a :c:expr:" @@ -4153,7 +4171,7 @@ msgid "" "Storchaka in :gh:`110289`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2173 +#: ../../whatsnew/3.13.rst:2188 msgid "" "Add the :c:func:`PyWeakref_GetRef` function as an alternative to :c:func:" "`PyWeakref_GetObject` that returns a :term:`strong reference` or ``NULL`` if " @@ -4161,47 +4179,51 @@ msgid "" "`105927`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2179 +#: ../../whatsnew/3.13.rst:2194 msgid "Add fixed variants of functions which silently ignore errors:" msgstr "" -#: ../../whatsnew/3.13.rst:2181 +#: ../../whatsnew/3.13.rst:2196 msgid "" ":c:func:`PyObject_HasAttrWithError` replaces :c:func:`PyObject_HasAttr`." -msgstr "" +msgstr ":c:func:`PyObject_HasAttrWithError` 取代 :c:func:`PyObject_HasAttr`。" -#: ../../whatsnew/3.13.rst:2182 +#: ../../whatsnew/3.13.rst:2197 msgid "" ":c:func:`PyObject_HasAttrStringWithError` replaces :c:func:" "`PyObject_HasAttrString`." msgstr "" +":c:func:`PyObject_HasAttrStringWithError` 取代 :c:func:" +"`PyObject_HasAttrString`。" -#: ../../whatsnew/3.13.rst:2184 +#: ../../whatsnew/3.13.rst:2199 msgid "" ":c:func:`PyMapping_HasKeyWithError` replaces :c:func:`PyMapping_HasKey`." -msgstr "" +msgstr ":c:func:`PyMapping_HasKeyWithError` 取代 :c:func:`PyMapping_HasKey`。" -#: ../../whatsnew/3.13.rst:2185 +#: ../../whatsnew/3.13.rst:2200 msgid "" ":c:func:`PyMapping_HasKeyStringWithError` replaces :c:func:" "`PyMapping_HasKeyString`." msgstr "" +":c:func:`PyMapping_HasKeyStringWithError` 取代 :c:func:" +"`PyMapping_HasKeyString`。" -#: ../../whatsnew/3.13.rst:2188 +#: ../../whatsnew/3.13.rst:2203 msgid "" "The new functions return ``-1`` for errors and the standard ``1`` for true " "and ``0`` for false." msgstr "" -#: ../../whatsnew/3.13.rst:2191 +#: ../../whatsnew/3.13.rst:2206 msgid "(Contributed by Serhiy Storchaka in :gh:`108511`.)" msgstr "(由 Serhiy Storchaka 在 :gh:`108511` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2195 +#: ../../whatsnew/3.13.rst:2210 msgid "Changed C APIs" msgstr "" -#: ../../whatsnew/3.13.rst:2197 +#: ../../whatsnew/3.13.rst:2212 msgid "" "The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and :c:" "func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * const *` " @@ -4214,20 +4236,20 @@ msgid "" "`65210`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2209 +#: ../../whatsnew/3.13.rst:2224 msgid "" ":c:func:`PyArg_ParseTupleAndKeywords` now supports non-ASCII keyword " "parameter names. (Contributed by Serhiy Storchaka in :gh:`110815`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2213 +#: ../../whatsnew/3.13.rst:2228 msgid "" "The :c:func:`!PyCode_GetFirstFree` function is now unstable API and is now " "named :c:func:`PyUnstable_Code_GetFirstFree`. (Contributed by Bogdan " "Romanyuk in :gh:`115781`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2217 +#: ../../whatsnew/3.13.rst:2232 msgid "" "The :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:" "`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:" @@ -4238,35 +4260,35 @@ msgid "" "documentation. (Contributed by Serhiy Storchaka in :gh:`106672`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2226 +#: ../../whatsnew/3.13.rst:2241 msgid "" "Add support for the ``%T``, ``%#T``, ``%N`` and ``%#N`` formats to :c:func:" "`PyUnicode_FromFormat`:" msgstr "" -#: ../../whatsnew/3.13.rst:2229 +#: ../../whatsnew/3.13.rst:2244 msgid "``%T``: Get the fully qualified name of an object type" msgstr "" -#: ../../whatsnew/3.13.rst:2230 +#: ../../whatsnew/3.13.rst:2245 msgid "``%#T``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2231 +#: ../../whatsnew/3.13.rst:2246 msgid "``%N``: Get the fully qualified name of a type" msgstr "" -#: ../../whatsnew/3.13.rst:2232 +#: ../../whatsnew/3.13.rst:2247 msgid "``%#N``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2234 +#: ../../whatsnew/3.13.rst:2249 msgid "" "See :pep:`737` for more information. (Contributed by Victor Stinner in :gh:" "`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2237 +#: ../../whatsnew/3.13.rst:2252 msgid "" "You no longer have to define the ``PY_SSIZE_T_CLEAN`` macro before " "including :file:`Python.h` when using ``#`` formats in :ref:`format codes " @@ -4275,7 +4297,7 @@ msgid "" "`104922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2243 +#: ../../whatsnew/3.13.rst:2258 msgid "" "If Python is built in :ref:`debug mode <debug-build>` or :option:`with " "assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and :c:func:" @@ -4283,61 +4305,61 @@ msgid "" "(Contributed by Victor Stinner in :gh:`106168`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2251 +#: ../../whatsnew/3.13.rst:2266 msgid "Limited C API Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2253 +#: ../../whatsnew/3.13.rst:2268 msgid "The following functions are now included in the Limited C API:" msgstr "" -#: ../../whatsnew/3.13.rst:2255 +#: ../../whatsnew/3.13.rst:2270 msgid ":c:func:`PyMem_RawMalloc`" msgstr ":c:func:`PyMem_RawMalloc`" -#: ../../whatsnew/3.13.rst:2256 +#: ../../whatsnew/3.13.rst:2271 msgid ":c:func:`PyMem_RawCalloc`" msgstr ":c:func:`PyMem_RawCalloc`" -#: ../../whatsnew/3.13.rst:2257 +#: ../../whatsnew/3.13.rst:2272 msgid ":c:func:`PyMem_RawRealloc`" msgstr ":c:func:`PyMem_RawRealloc`" -#: ../../whatsnew/3.13.rst:2258 +#: ../../whatsnew/3.13.rst:2273 msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" -#: ../../whatsnew/3.13.rst:2259 +#: ../../whatsnew/3.13.rst:2274 msgid ":c:func:`PySys_Audit`" msgstr ":c:func:`PySys_Audit`" -#: ../../whatsnew/3.13.rst:2260 +#: ../../whatsnew/3.13.rst:2275 msgid ":c:func:`PySys_AuditTuple`" msgstr ":c:func:`PySys_AuditTuple`" -#: ../../whatsnew/3.13.rst:2261 +#: ../../whatsnew/3.13.rst:2276 msgid ":c:func:`PyType_GetModuleByDef`" msgstr ":c:func:`PyType_GetModuleByDef`" -#: ../../whatsnew/3.13.rst:2263 +#: ../../whatsnew/3.13.rst:2278 msgid "" "(Contributed by Victor Stinner in :gh:`85283`, :gh:`85283`, and :gh:" "`116936`.)" msgstr "" "(由 Victor Stinner 貢獻於 :gh:`85283`、:gh:`85283` 和 :gh:`116936`。)" -#: ../../whatsnew/3.13.rst:2265 +#: ../../whatsnew/3.13.rst:2280 msgid "" "Python built with :option:`--with-trace-refs` (tracing references) now " "supports the :ref:`Limited API <limited-c-api>`. (Contributed by Victor " "Stinner in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2271 +#: ../../whatsnew/3.13.rst:2286 msgid "Removed C APIs" msgstr "移除的 C API" -#: ../../whatsnew/3.13.rst:2273 +#: ../../whatsnew/3.13.rst:2288 msgid "" "Remove several functions, macros, variables, etc with names prefixed by " "``_Py`` or ``_PY`` (which are considered private). If your project is " @@ -4347,13 +4369,13 @@ msgid "" "Victor Stinner. (Contributed by Victor Stinner in :gh:`106320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2281 +#: ../../whatsnew/3.13.rst:2296 msgid "" "Remove old buffer protocols deprecated in Python 3.0. Use :ref:" "`bufferobjects` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2284 +#: ../../whatsnew/3.13.rst:2299 msgid "" ":c:func:`!PyObject_CheckReadBuffer`: Use :c:func:`PyObject_CheckBuffer` to " "test whether the object supports the buffer protocol. Note that :c:func:" @@ -4362,7 +4384,7 @@ msgid "" "example of :c:func:`PyObject_GetBuffer`." msgstr "" -#: ../../whatsnew/3.13.rst:2292 +#: ../../whatsnew/3.13.rst:2307 msgid "" ":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: Use :c:" "func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" @@ -4370,7 +4392,7 @@ msgstr "" ":c:func:`!PyObject_AsCharBuffer`、:c:func:`!PyObject_AsReadBuffer`:請改用 :" "c:func:`PyObject_GetBuffer` 和 :c:func:`PyBuffer_Release`。" -#: ../../whatsnew/3.13.rst:2295 +#: ../../whatsnew/3.13.rst:2310 msgid "" "Py_buffer view;\n" "if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) < 0) {\n" @@ -4381,7 +4403,7 @@ msgid "" "PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2305 +#: ../../whatsnew/3.13.rst:2320 msgid "" ":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` and :c:" "func:`PyBuffer_Release` instead:" @@ -4389,7 +4411,7 @@ msgstr "" ":c:func:`!PyObject_AsWriteBuffer`:請改用 :c:func:`PyObject_GetBuffer` 和 :c:" "func:`PyBuffer_Release`。" -#: ../../whatsnew/3.13.rst:2308 +#: ../../whatsnew/3.13.rst:2323 msgid "" "Py_buffer view;\n" "if (PyObject_GetBuffer(obj, &view, PyBUF_WRITABLE) < 0) {\n" @@ -4399,15 +4421,15 @@ msgid "" "PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2317 +#: ../../whatsnew/3.13.rst:2332 msgid "(Contributed by Inada Naoki in :gh:`85275`.)" msgstr "(由 Inada Naoki 貢獻於 :gh:`85275`。)" -#: ../../whatsnew/3.13.rst:2319 +#: ../../whatsnew/3.13.rst:2334 msgid "Remove various functions deprecated in Python 3.9:" msgstr "" -#: ../../whatsnew/3.13.rst:2321 +#: ../../whatsnew/3.13.rst:2336 msgid "" ":c:func:`!PyEval_CallObject`, :c:func:`!PyEval_CallObjectWithKeywords`: Use :" "c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead." @@ -4415,7 +4437,7 @@ msgstr "" ":c:func:`!PyEval_CallObject`、:c:func:`!PyEval_CallObjectWithKeywords`:請改" "用 :c:func:`PyObject_CallNoArgs` 或 :c:func:`PyObject_Call`。" -#: ../../whatsnew/3.13.rst:2326 +#: ../../whatsnew/3.13.rst:2341 msgid "" "In :c:func:`PyObject_Call`, positional arguments must be a :class:`tuple` " "and must not be ``NULL``, and keyword arguments must be a :class:`dict` or " @@ -4426,32 +4448,32 @@ msgid "" "`PyTuple_New(0) <PyTuple_New>`." msgstr "" -#: ../../whatsnew/3.13.rst:2336 +#: ../../whatsnew/3.13.rst:2351 msgid "" ":c:func:`!PyEval_CallFunction`: Use :c:func:`PyObject_CallFunction` instead." msgstr "" ":c:func:`!PyEval_CallFunction`:請改用 :c:func:`PyObject_CallFunction`。" -#: ../../whatsnew/3.13.rst:2338 +#: ../../whatsnew/3.13.rst:2353 msgid "" ":c:func:`!PyEval_CallMethod`: Use :c:func:`PyObject_CallMethod` instead." msgstr ":c:func:`!PyEval_CallMethod`:請改用 :c:func:`PyObject_CallMethod`。" -#: ../../whatsnew/3.13.rst:2340 +#: ../../whatsnew/3.13.rst:2355 msgid ":c:func:`!PyCFunction_Call`: Use :c:func:`PyObject_Call` instead." msgstr ":c:func:`!PyCFunction_Call`:請改用 :c:func:`PyCFunction_Call`。" -#: ../../whatsnew/3.13.rst:2343 +#: ../../whatsnew/3.13.rst:2358 msgid "(Contributed by Victor Stinner in :gh:`105107`.)" msgstr "(由 Victor Stinner 貢獻於 :gh:`105107`。)" -#: ../../whatsnew/3.13.rst:2345 +#: ../../whatsnew/3.13.rst:2360 msgid "" "Remove the following old functions to configure the Python initialization, " "deprecated in Python 3.11:" msgstr "" -#: ../../whatsnew/3.13.rst:2348 +#: ../../whatsnew/3.13.rst:2363 msgid "" ":c:func:`!PySys_AddWarnOptionUnicode`: Use :c:member:`PyConfig.warnoptions` " "instead." @@ -4459,36 +4481,36 @@ msgstr "" ":c:func:`!PySys_AddWarnOptionUnicode`:請改用 :c:member:`PyConfig." "warnoptions`。" -#: ../../whatsnew/3.13.rst:2350 +#: ../../whatsnew/3.13.rst:2365 msgid "" ":c:func:`!PySys_AddWarnOption`: Use :c:member:`PyConfig.warnoptions` instead." msgstr "" ":c:func:`!PySys_AddWarnOption`:請改用 :c:member:`PyConfig.warnoptions`。" -#: ../../whatsnew/3.13.rst:2352 +#: ../../whatsnew/3.13.rst:2367 msgid ":c:func:`!PySys_AddXOption`: Use :c:member:`PyConfig.xoptions` instead." msgstr ":c:func:`!PySys_AddXOption`:請改用 :c:member:`PyConfig.xoptions`。" -#: ../../whatsnew/3.13.rst:2354 +#: ../../whatsnew/3.13.rst:2369 msgid "" ":c:func:`!PySys_HasWarnOptions`: Use :c:member:`PyConfig.xoptions` instead." msgstr "" ":c:func:`!PySys_HasWarnOptions`:請改用 :c:member:`PyConfig.xoptions`。" -#: ../../whatsnew/3.13.rst:2356 +#: ../../whatsnew/3.13.rst:2371 msgid "" ":c:func:`!PySys_SetPath`: Set :c:member:`PyConfig.module_search_paths` " "instead." msgstr "" ":c:func:`!PySys_SetPath`:請改用 :c:member:`PyConfig.module_search_paths`。" -#: ../../whatsnew/3.13.rst:2358 +#: ../../whatsnew/3.13.rst:2373 msgid "" ":c:func:`!Py_SetPath`: Set :c:member:`PyConfig.module_search_paths` instead." msgstr "" ":c:func:`!Py_SetPath`:請改用 :c:member:`PyConfig.module_search_paths`。" -#: ../../whatsnew/3.13.rst:2360 +#: ../../whatsnew/3.13.rst:2375 msgid "" ":c:func:`!Py_SetStandardStreamEncoding`: Set :c:member:`PyConfig." "stdio_encoding` instead, and set also maybe :c:member:`PyConfig." @@ -4498,14 +4520,14 @@ msgstr "" "stdio_encoding` 並設定可能的 :c:member:`PyConfig.legacy_windows_stdio`\\ " "(在 Windows 上)。" -#: ../../whatsnew/3.13.rst:2363 +#: ../../whatsnew/3.13.rst:2378 msgid "" ":c:func:`!_Py_SetProgramFullPath`: Set :c:member:`PyConfig.executable` " "instead." msgstr "" ":c:func:`!_Py_SetProgramFullPath`:請改用 :c:member:`PyConfig.executable`。" -#: ../../whatsnew/3.13.rst:2366 +#: ../../whatsnew/3.13.rst:2381 msgid "" "Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " "Configuration <init-config>` instead (:pep:`587`), added to Python 3.8. " @@ -4515,7 +4537,7 @@ msgstr "" "(:pep:`587`),這是在 Python 3.8 中新增的。(由 Victor Stinner 於 :gh:" "`105145` 貢獻。)" -#: ../../whatsnew/3.13.rst:2370 +#: ../../whatsnew/3.13.rst:2385 msgid "" "Remove :c:func:`!PyEval_AcquireLock` and :c:func:`!PyEval_ReleaseLock` " "functions, deprecated in Python 3.2. They didn't update the current thread " @@ -4525,25 +4547,25 @@ msgstr "" "些函式在 Python 3.2 中已被廢棄。它們不會更新目前的執行緒狀態。可以用以下函式" "取代:" -#: ../../whatsnew/3.13.rst:2375 +#: ../../whatsnew/3.13.rst:2390 msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`;" msgstr ":c:func:`PyEval_SaveThread` 和 :c:func:`PyEval_RestoreThread`;" -#: ../../whatsnew/3.13.rst:2376 +#: ../../whatsnew/3.13.rst:2391 msgid "" "low-level :c:func:`PyEval_AcquireThread` and :c:func:`PyEval_RestoreThread`;" msgstr "" "低階的 :c:func:`PyEval_AcquireThread` 和 :c:func:`PyEval_RestoreThread`;" -#: ../../whatsnew/3.13.rst:2377 +#: ../../whatsnew/3.13.rst:2392 msgid "or :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`." msgstr "或 :c:func:`PyGILState_Ensure` 與 :c:func:`PyGILState_Release`。" -#: ../../whatsnew/3.13.rst:2379 +#: ../../whatsnew/3.13.rst:2394 msgid "(Contributed by Victor Stinner in :gh:`105182`.)" msgstr "(由 Victor Stinner 貢獻於 :gh:`105182`。)" -#: ../../whatsnew/3.13.rst:2381 +#: ../../whatsnew/3.13.rst:2396 msgid "" "Remove the :c:func:`!PyEval_ThreadsInitialized` function, deprecated in " "Python 3.9. Since Python 3.7, :c:func:`!Py_Initialize` always creates the " @@ -4552,7 +4574,7 @@ msgid "" "Stinner in :gh:`105182`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2388 +#: ../../whatsnew/3.13.rst:2403 msgid "" "Remove the :c:func:`!_PyInterpreterState_Get` alias to :c:func:" "`PyInterpreterState_Get()` which was kept for backward compatibility with " @@ -4561,14 +4583,14 @@ msgid "" "Stinner in :gh:`106320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2395 +#: ../../whatsnew/3.13.rst:2410 msgid "" "Remove the private :c:func:`!_PyObject_FastCall` function: use :c:func:`!" "PyObject_Vectorcall` which is available since Python 3.8 (:pep:`590`). " "(Contributed by Victor Stinner in :gh:`106023`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2400 +#: ../../whatsnew/3.13.rst:2415 msgid "" "Remove the ``cpython/pytime.h`` header file, which only contained private " "functions. (Contributed by Victor Stinner in :gh:`106316`.)" @@ -4576,13 +4598,13 @@ msgstr "" "移除只包含私有函式的 ``cpython/pytime.h`` 標頭檔。(由 Victor Stinner 於 :gh:" "`106316` 貢獻。)" -#: ../../whatsnew/3.13.rst:2404 +#: ../../whatsnew/3.13.rst:2419 msgid "" "Remove the undocumented ``PY_TIMEOUT_MAX`` constant from the limited C API. " "(Contributed by Victor Stinner in :gh:`110014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2407 +#: ../../whatsnew/3.13.rst:2422 msgid "" "Remove the old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " "``Py_TRASHCAN_SAFE_END``. Replace both with the new macros " @@ -4590,15 +4612,15 @@ msgid "" "in :gh:`105111`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2414 +#: ../../whatsnew/3.13.rst:2429 msgid "Deprecated C APIs" msgstr "器用的 C API" -#: ../../whatsnew/3.13.rst:2416 +#: ../../whatsnew/3.13.rst:2431 msgid "Deprecate old Python initialization functions:" msgstr "" -#: ../../whatsnew/3.13.rst:2418 +#: ../../whatsnew/3.13.rst:2433 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" @@ -4607,30 +4629,30 @@ msgstr "" ":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" "data:`!warnings.filters`。" -#: ../../whatsnew/3.13.rst:2420 +#: ../../whatsnew/3.13.rst:2435 msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" -#: ../../whatsnew/3.13.rst:2422 +#: ../../whatsnew/3.13.rst:2437 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" -#: ../../whatsnew/3.13.rst:2424 +#: ../../whatsnew/3.13.rst:2439 msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" -#: ../../whatsnew/3.13.rst:2426 +#: ../../whatsnew/3.13.rst:2441 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" -#: ../../whatsnew/3.13.rst:2428 +#: ../../whatsnew/3.13.rst:2443 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:23 msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" -#: ../../whatsnew/3.13.rst:2430 +#: ../../whatsnew/3.13.rst:2445 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" ":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" @@ -4639,32 +4661,32 @@ msgstr "" ":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" "`PYTHONHOME` 環境變數。" -#: ../../whatsnew/3.13.rst:2434 +#: ../../whatsnew/3.13.rst:2449 msgid "(Contributed by Victor Stinner in :gh:`105145`.)" msgstr "(由 Victor Stinner 在 :gh:`105145` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2436 +#: ../../whatsnew/3.13.rst:2451 msgid "" ":term:`Soft deprecate <soft deprecated>` the :c:func:`PyEval_GetBuiltins`, :" "c:func:`PyEval_GetGlobals`, and :c:func:`PyEval_GetLocals` functions, which " "return a :term:`borrowed reference`. (Soft deprecated as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2442 +#: ../../whatsnew/3.13.rst:2457 msgid "" "Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function, which is just " "an alias to :c:func:`PyImport_ImportModule` since Python 3.3. (Contributed " "by Victor Stinner in :gh:`105396`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2446 +#: ../../whatsnew/3.13.rst:2461 msgid "" ":term:`Soft deprecate <soft deprecated>` the :c:func:`PyModule_AddObject` " "function. It should be replaced with :c:func:`PyModule_Add` or :c:func:" "`PyModule_AddObjectRef`. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2452 +#: ../../whatsnew/3.13.rst:2467 msgid "" "Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types and the :c:" "macro:`!Py_UNICODE_WIDE` define. Use the :c:type:`wchar_t` type directly " @@ -4673,7 +4695,7 @@ msgid "" "`105156`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2459 +#: ../../whatsnew/3.13.rst:2474 msgid "" "Deprecate the :c:func:`PyWeakref_GetObject` and :c:func:" "`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed reference`. " @@ -5050,56 +5072,56 @@ msgstr "" msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.13.rst:2479 +#: ../../whatsnew/3.13.rst:2494 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.13.rst:2481 +#: ../../whatsnew/3.13.rst:2496 msgid "" "``arm64-apple-ios`` and ``arm64-apple-ios-simulator`` are both now :pep:`11` " "tier 3 platforms. (:ref:`PEP 730 <whatsnew313-platform-support>` written and " "implementation contributed by Russell Keith-Magee in :gh:`114099`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2486 +#: ../../whatsnew/3.13.rst:2501 msgid "" "``aarch64-linux-android`` and ``x86_64-linux-android`` are both now :pep:" "`11` tier 3 platforms. (:ref:`PEP 738 <whatsnew313-platform-support>` " "written and implementation contributed by Malcolm Smith in :gh:`116622`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2491 +#: ../../whatsnew/3.13.rst:2506 msgid "" "``wasm32-wasi`` is now a :pep:`11` tier 2 platform. (Contributed by Brett " "Cannon in :gh:`115192`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2494 +#: ../../whatsnew/3.13.rst:2509 msgid "" "``wasm32-emscripten`` is no longer a :pep:`11` supported platform. " "(Contributed by Brett Cannon in :gh:`115192`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2497 +#: ../../whatsnew/3.13.rst:2512 msgid "" "Building CPython now requires a compiler with support for the C11 atomic " "library, GCC built-in atomic functions, or MSVC interlocked intrinsics." msgstr "" -#: ../../whatsnew/3.13.rst:2500 +#: ../../whatsnew/3.13.rst:2515 msgid "" "Autoconf 2.71 and aclocal 1.16.5 are now required to regenerate the :file:" "`configure` script. (Contributed by Christian Heimes in :gh:`89886` and by " "Victor Stinner in :gh:`112090`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2504 +#: ../../whatsnew/3.13.rst:2519 msgid "" "SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension " "module. (Contributed by Erlend Aasland in :gh:`105875`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2508 +#: ../../whatsnew/3.13.rst:2523 msgid "" "CPython now bundles the `mimalloc library`_ by default. It is licensed under " "the MIT license; see :ref:`mimalloc license <mimalloc-license>`. The bundled " @@ -5107,28 +5129,28 @@ msgid "" "Dino Viehland in :gh:`109914`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2516 +#: ../../whatsnew/3.13.rst:2531 msgid "" "The :file:`configure` option :option:`--with-system-libmpdec` now defaults " "to ``yes``. The bundled copy of ``libmpdecimal`` will be removed in Python " "3.15." msgstr "" -#: ../../whatsnew/3.13.rst:2520 +#: ../../whatsnew/3.13.rst:2535 msgid "" "Python built with :file:`configure` :option:`--with-trace-refs` (tracing " "references) is now ABI compatible with the Python release build and :ref:" "`debug build <debug-build>`. (Contributed by Victor Stinner in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2525 +#: ../../whatsnew/3.13.rst:2540 msgid "" "On POSIX systems, the pkg-config (``.pc``) filenames now include the ABI " "flags. For example, the free-threaded build generates ``python-3.13t.pc`` " "and the debug build generates ``python-3.13d.pc``." msgstr "" -#: ../../whatsnew/3.13.rst:2529 +#: ../../whatsnew/3.13.rst:2544 msgid "" "The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``, " "``termios``, ``winsound``, ``_ctypes_test``, ``_multiprocessing." @@ -5138,27 +5160,27 @@ msgid "" "`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2538 +#: ../../whatsnew/3.13.rst:2553 msgid "Porting to Python 3.13" msgstr "移植至 Python 3.13" -#: ../../whatsnew/3.13.rst:2540 +#: ../../whatsnew/3.13.rst:2555 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.13.rst:2544 +#: ../../whatsnew/3.13.rst:2559 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.13.rst:2548 +#: ../../whatsnew/3.13.rst:2563 msgid "" ":ref:`PEP 667 <whatsnew313-locals-semantics>` introduces several changes to " "the semantics of :func:`locals` and :attr:`f_locals <frame.f_locals>`:" msgstr "" -#: ../../whatsnew/3.13.rst:2551 +#: ../../whatsnew/3.13.rst:2566 msgid "" "Calling :func:`locals` in an :term:`optimized scope` now produces an " "independent snapshot on each call, and hence no longer implicitly updates " @@ -5170,7 +5192,7 @@ msgid "" "scope. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2560 +#: ../../whatsnew/3.13.rst:2575 msgid "" "Calling :func:`locals` from a comprehension at module or class scope " "(including via ``exec`` or ``eval``) once more behaves as if the " @@ -5180,7 +5202,7 @@ msgid "" "implementing :pep:`709`. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2567 +#: ../../whatsnew/3.13.rst:2582 msgid "" "Accessing :attr:`FrameType.f_locals <frame.f_locals>` in an :term:`optimized " "scope` now returns a write-through proxy rather than a snapshot that gets " @@ -5189,7 +5211,7 @@ msgid "" "of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2573 +#: ../../whatsnew/3.13.rst:2588 msgid "" ":class:`functools.partial` now emits a :exc:`FutureWarning` when used as a " "method. The behavior will change in future Python versions. Wrap it in :func:" @@ -5197,14 +5219,14 @@ msgid "" "Serhiy Storchaka in :gh:`121027`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2579 +#: ../../whatsnew/3.13.rst:2594 msgid "" "An :exc:`OSError` is now raised by :func:`getpass.getuser` for any failure " "to retrieve a username, instead of :exc:`ImportError` on non-Unix platforms " "or :exc:`KeyError` on Unix platforms where the password database is empty." msgstr "" -#: ../../whatsnew/3.13.rst:2584 +#: ../../whatsnew/3.13.rst:2599 msgid "" "The value of the :attr:`!mode` attribute of :class:`gzip.GzipFile` is now a " "string (``'rb'`` or ``'wb'``) instead of an integer (``1`` or ``2``). The " @@ -5213,13 +5235,13 @@ msgid "" "(Contributed by Serhiy Storchaka in :gh:`115961`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2590 +#: ../../whatsnew/3.13.rst:2605 msgid "" ":class:`mailbox.Maildir` now ignores files with a leading dot (``.``). " "(Contributed by Zackery Spytz in :gh:`65559`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2593 +#: ../../whatsnew/3.13.rst:2608 msgid "" ":meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` now return both " "files and directories if a pattern that ends with \"``**``\" is given, " @@ -5227,25 +5249,25 @@ msgid "" "behavior and only match directories." msgstr "" -#: ../../whatsnew/3.13.rst:2598 +#: ../../whatsnew/3.13.rst:2613 msgid "" "The :mod:`threading` module now expects the :mod:`!_thread` module to have " "an :func:`!_is_main_interpreter` function. This function takes no arguments " "and returns ``True`` if the current interpreter is the main interpreter." msgstr "" -#: ../../whatsnew/3.13.rst:2603 +#: ../../whatsnew/3.13.rst:2618 msgid "" "Any library or application that provides a custom :mod:`!_thread` module " "must provide :func:`!_is_main_interpreter`, just like the module's other " "\"private\" attributes. (:gh:`112826`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2610 +#: ../../whatsnew/3.13.rst:2625 msgid "Changes in the C API" msgstr "C API 中的改動" -#: ../../whatsnew/3.13.rst:2612 +#: ../../whatsnew/3.13.rst:2627 msgid "" "``Python.h`` no longer includes the ``<ieeefp.h>`` standard header. It was " "included for the :c:func:`!finite` function which is now provided by the " @@ -5254,7 +5276,7 @@ msgid "" "`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2618 +#: ../../whatsnew/3.13.rst:2633 msgid "" "``Python.h`` no longer includes these standard header files: ``<time.h>``, " "``<sys/select.h>`` and ``<sys/time.h>``. If needed, they should now be " @@ -5265,7 +5287,7 @@ msgid "" "Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2626 +#: ../../whatsnew/3.13.rst:2641 msgid "" "On Windows, ``Python.h`` no longer includes the ``<stddef.h>`` standard " "header file. If needed, it should now be included explicitly. For example, " @@ -5275,7 +5297,7 @@ msgid "" "(Contributed by Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2633 +#: ../../whatsnew/3.13.rst:2648 msgid "" "If the :c:macro:`Py_LIMITED_API` macro is defined, :c:macro:`!" "Py_BUILD_CORE`, :c:macro:`!Py_BUILD_CORE_BUILTIN` and :c:macro:`!" @@ -5283,18 +5305,18 @@ msgid "" "(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2638 +#: ../../whatsnew/3.13.rst:2653 msgid "" "The old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " "``Py_TRASHCAN_SAFE_END`` were removed. They should be replaced by the new " "macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``." msgstr "" -#: ../../whatsnew/3.13.rst:2642 +#: ../../whatsnew/3.13.rst:2657 msgid "A ``tp_dealloc`` function that has the old macros, such as::" msgstr "有舊巨集的 ``tp_dealloc`` 函式,例如: ::" -#: ../../whatsnew/3.13.rst:2644 +#: ../../whatsnew/3.13.rst:2659 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -5314,11 +5336,11 @@ msgstr "" " Py_TRASHCAN_SAFE_END\n" "}" -#: ../../whatsnew/3.13.rst:2653 +#: ../../whatsnew/3.13.rst:2668 msgid "should migrate to the new macros as follows::" msgstr "應該改為使用新的巨集,如下所示: ::" -#: ../../whatsnew/3.13.rst:2655 +#: ../../whatsnew/3.13.rst:2670 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -5338,7 +5360,7 @@ msgstr "" " Py_TRASHCAN_END\n" "}" -#: ../../whatsnew/3.13.rst:2664 +#: ../../whatsnew/3.13.rst:2679 msgid "" "Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " "deallocation function it is in. The new macros were added in Python 3.8 and " @@ -5346,13 +5368,13 @@ msgid "" "in :gh:`105111`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2671 +#: ../../whatsnew/3.13.rst:2686 msgid "" ":ref:`PEP 667 <whatsnew313-locals-semantics>` introduces several changes to " "frame-related functions:" msgstr "" -#: ../../whatsnew/3.13.rst:2674 +#: ../../whatsnew/3.13.rst:2689 msgid "" "The effects of mutating the dictionary returned from :c:func:" "`PyEval_GetLocals` in an :term:`optimized scope` have changed. New dict " @@ -5366,7 +5388,7 @@ msgid "" "being used, so refer to the deprecation notice on the function for details." msgstr "" -#: ../../whatsnew/3.13.rst:2687 +#: ../../whatsnew/3.13.rst:2702 msgid "" "Calling :c:func:`PyFrame_GetLocals` in an :term:`optimized scope` now " "returns a write-through proxy rather than a snapshot that gets updated at " @@ -5375,25 +5397,25 @@ msgid "" "`PyEval_GetFrameLocals` API." msgstr "" -#: ../../whatsnew/3.13.rst:2694 +#: ../../whatsnew/3.13.rst:2709 msgid "" ":c:func:`!PyFrame_FastToLocals` and :c:func:`!PyFrame_FastToLocalsWithError` " "no longer have any effect. Calling these functions has been redundant since " "Python 3.11, when :c:func:`PyFrame_GetLocals` was first introduced." msgstr "" -#: ../../whatsnew/3.13.rst:2699 +#: ../../whatsnew/3.13.rst:2714 msgid "" ":c:func:`!PyFrame_LocalsToFast` no longer has any effect. Calling this " "function is redundant now that :c:func:`PyFrame_GetLocals` returns a write-" "through proxy for :term:`optimized scopes <optimized scope>`." msgstr "" -#: ../../whatsnew/3.13.rst:2704 +#: ../../whatsnew/3.13.rst:2719 msgid "Regression Test Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2706 +#: ../../whatsnew/3.13.rst:2721 msgid "" "Python built with :file:`configure` :option:`--with-pydebug` now supports a :" "option:`-X presite=package.module <-X>` command-line option. If used, it " @@ -5402,11 +5424,11 @@ msgid "" "in :gh:`110769`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2714 +#: ../../whatsnew/3.13.rst:2729 msgid "Notable changes in 3.13.1" msgstr "Python 3.13.1 中顯著的變更" -#: ../../whatsnew/3.13.rst:2719 +#: ../../whatsnew/3.13.rst:2734 msgid "" "The previously undocumented special function :func:`sys.getobjects`, which " "only exists in specialized builds of Python, may now return objects from " diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index d928fca84e..8bdcc0eaaf 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -95,7 +95,7 @@ msgstr "" #: ../../whatsnew/3.4.rst:98 msgid "New library modules:" -msgstr "" +msgstr "新的函式庫模組:" #: ../../whatsnew/3.4.rst:100 msgid "" diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index 9de8d2caae..36ad7689e8 100644 --- a/whatsnew/3.5.po +++ b/whatsnew/3.5.po @@ -71,7 +71,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:67 msgid "New library modules:" -msgstr "" +msgstr "新的函式庫模組:" #: ../../whatsnew/3.5.rst:69 msgid ":mod:`typing`: :ref:`PEP 484 -- Type Hints <whatsnew-pep-484>`." diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index d4e6ccd8c2..2b7dfedd6b 100644 --- a/whatsnew/3.6.po +++ b/whatsnew/3.6.po @@ -70,7 +70,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:73 msgid "New library modules:" -msgstr "" +msgstr "新的函式庫模組:" #: ../../whatsnew/3.6.rst:75 msgid "" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index b2c04d4e21..9416588394 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -58,7 +58,7 @@ msgstr ":keyword:`async` 和 :keyword:`await` 現為保留關鍵字。" #: ../../whatsnew/3.7.rst:66 msgid "New library modules:" -msgstr "" +msgstr "新的函式庫模組:" #: ../../whatsnew/3.7.rst:68 msgid "" diff --git a/whatsnew/3.9.po b/whatsnew/3.9.po index 4c88343623..c85271fcb3 100644 --- a/whatsnew/3.9.po +++ b/whatsnew/3.9.po @@ -126,7 +126,7 @@ msgstr "" #: ../../whatsnew/3.9.rst:94 msgid "New library modules:" -msgstr "" +msgstr "新的函式庫模組:" #: ../../whatsnew/3.9.rst:96 msgid "" From cb35f7ebc443604db9ebb08b805a46dd06343ffe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 19:57:39 +0800 Subject: [PATCH 66/89] build(deps): bump JamesIves/github-pages-deploy-action (#1016) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/deploy-gh-page.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-gh-page.yml b/.github/workflows/deploy-gh-page.yml index ed99a444c7..f969970078 100644 --- a/.github/workflows/deploy-gh-page.yml +++ b/.github/workflows/deploy-gh-page.yml @@ -18,7 +18,7 @@ jobs: run: JOBS=4 MODE=html make all - name: Deploy to gh page - uses: JamesIves/github-pages-deploy-action@v4.7.1 + uses: JamesIves/github-pages-deploy-action@v4.7.2 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BRANCH: gh-pages From 55c563ac42f044ff38ce382d41e61927f7d16356 Mon Sep 17 00:00:00 2001 From: weijay <weijay0804@gmail.com> Date: Fri, 1 Dec 2023 14:42:34 +0800 Subject: [PATCH 67/89] feat: translate library/socket.po intro section gh-611 --- library/socket.po | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/library/socket.po b/library/socket.po index c7e95f09c9..f7e19412b6 100644 --- a/library/socket.po +++ b/library/socket.po @@ -6,9 +6,9 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-23 00:14+0000\n" -"PO-Revision-Date: 2018-05-23 16:10+0000\n" -"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" +"POT-Creation-Date: 2023-10-30 00:03+0000\n" +"PO-Revision-Date: 2023-12-01 14:10+0800\n" +"Last-Translator: Jay <weijay0804@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -16,10 +16,11 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.4.1\n" #: ../../library/socket.rst:2 -msgid ":mod:`!socket` --- Low-level networking interface" -msgstr ":mod:`!socket` --- 低階網路介面" +msgid ":mod:`socket` --- Low-level networking interface" +msgstr ":mod:`socket` — 網路底層介面" #: ../../library/socket.rst:7 msgid "**Source code:** :source:`Lib/socket.py`" @@ -31,12 +32,14 @@ msgid "" "on all modern Unix systems, Windows, MacOS, and probably additional " "platforms." msgstr "" +"這個模組提供了操作 BSD *socket* 的介面。這在所有現代Unix系統、Windows、" +"MacOS,以及一些其他平台上都可用。" #: ../../library/socket.rst:16 msgid "" "Some behavior may be platform dependent, since calls are made to the " "operating system socket APIs." -msgstr "" +msgstr "由於是呼叫作業系統的 socket API,某些行為可能會因平台而有所差異。" #: ../../library/socket.rst:171 ../../library/socket.rst:181 #: ../../library/socket.rst:209 ../../library/socket.rst:216 @@ -88,6 +91,11 @@ msgid "" "meth:`write` operations on Python files, buffer allocation on receive " "operations is automatic, and buffer length is implicit on send operations." msgstr "" +"Python 介面是 Unix 系統呼叫和 socket 模組介面直譯成 Python 物件導向風格的簡單" +"轉換::func:`.socket` 函數回傳一個 :dfn:`socket object`,其中實現了各種 " +"socket 系統呼叫。參數類型相對於 C 語言的介面略為高層次:與 Python 文件操作中" +"的 :meth:`read` 和 :meth:`write` 一樣,接收操作的緩衝區是自動分配的,而在發送" +"操作的緩衝區長度是隱式的。" #: ../../library/socket.rst:35 msgid "Module :mod:`socketserver`" @@ -95,7 +103,7 @@ msgstr ":mod:`socketserver` 模組" #: ../../library/socket.rst:36 msgid "Classes that simplify writing network servers." -msgstr "" +msgstr "簡化編寫網路伺服器的類別。" #: ../../library/socket.rst:38 msgid "Module :mod:`ssl`" @@ -103,7 +111,7 @@ msgstr ":mod:`ssl` 模組" #: ../../library/socket.rst:39 msgid "A TLS/SSL wrapper for socket objects." -msgstr "" +msgstr "對 socket 物件的 TLS/SSL 的封裝。" #: ../../library/socket.rst:43 msgid "Socket families" From c9b1c2fb7b6b8a164586687f697988402928b3b9 Mon Sep 17 00:00:00 2001 From: weijay <weijay0804@gmail.com> Date: Mon, 26 Feb 2024 22:11:58 +0800 Subject: [PATCH 68/89] feat: update with reviewer's suggestions --- library/socket.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/socket.po b/library/socket.po index f7e19412b6..1fb53b63f6 100644 --- a/library/socket.po +++ b/library/socket.po @@ -91,8 +91,8 @@ msgid "" "meth:`write` operations on Python files, buffer allocation on receive " "operations is automatic, and buffer length is implicit on send operations." msgstr "" -"Python 介面是 Unix 系統呼叫和 socket 模組介面直譯成 Python 物件導向風格的簡單" -"轉換::func:`.socket` 函數回傳一個 :dfn:`socket object`,其中實現了各種 " +"這個 Python 介面是將 Unix 系統呼叫和 socket 模組介面轉變成 Python 物件導向風格" +"::func:`.socket` 函數回傳一個 :dfn:`socket object`,其方法實現了各種 " "socket 系統呼叫。參數類型相對於 C 語言的介面略為高層次:與 Python 文件操作中" "的 :meth:`read` 和 :meth:`write` 一樣,接收操作的緩衝區是自動分配的,而在發送" "操作的緩衝區長度是隱式的。" @@ -111,7 +111,7 @@ msgstr ":mod:`ssl` 模組" #: ../../library/socket.rst:39 msgid "A TLS/SSL wrapper for socket objects." -msgstr "對 socket 物件的 TLS/SSL 的封裝。" +msgstr "對 socket 物件的 TLS/SSL 的包裝器 (wrapper)。" #: ../../library/socket.rst:43 msgid "Socket families" From 88d1d5464c3239b6cf6a62460dba7582c0a855a8 Mon Sep 17 00:00:00 2001 From: weijay <weijay0804@gmail.com> Date: Mon, 30 Dec 2024 23:54:37 +0800 Subject: [PATCH 69/89] feat: update with reviewer's suggestions --- library/socket.po | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/library/socket.po b/library/socket.po index 1fb53b63f6..ad5802ce9e 100644 --- a/library/socket.po +++ b/library/socket.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-10-30 00:03+0000\n" -"PO-Revision-Date: 2023-12-01 14:10+0800\n" +"PO-Revision-Date: 2024-12-30 23:45+0800\n" "Last-Translator: Jay <weijay0804@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.4.1\n" +"X-Generator: Poedit 3.5\n" #: ../../library/socket.rst:2 msgid ":mod:`socket` --- Low-level networking interface" @@ -32,7 +32,7 @@ msgid "" "on all modern Unix systems, Windows, MacOS, and probably additional " "platforms." msgstr "" -"這個模組提供了操作 BSD *socket* 的介面。這在所有現代Unix系統、Windows、" +"這個模組提供了操作 BSD *socket* 的介面。這在所有現代 Unix 系統、Windows、" "MacOS,以及一些其他平台上都可用。" #: ../../library/socket.rst:16 @@ -91,11 +91,11 @@ msgid "" "meth:`write` operations on Python files, buffer allocation on receive " "operations is automatic, and buffer length is implicit on send operations." msgstr "" -"這個 Python 介面是將 Unix 系統呼叫和 socket 模組介面轉變成 Python 物件導向風格" -"::func:`.socket` 函數回傳一個 :dfn:`socket object`,其方法實現了各種 " -"socket 系統呼叫。參數類型相對於 C 語言的介面略為高層次:與 Python 文件操作中" -"的 :meth:`read` 和 :meth:`write` 一樣,接收操作的緩衝區是自動分配的,而在發送" -"操作的緩衝區長度是隱式的。" +"Python 的介面是將 Unix 的系統呼叫和 socket 函式庫介面直接轉換成 Python 的物件" +"導向風格::func:`.socket` 函數會回傳一個 :dfn:`socket 物件`,這個物件的方法實" +"作了各種 socket 系統呼叫。與 C 語言介面相比,參數型別較為高階:就像 Python 文" +"件操作中的 :meth:`read` 和 :meth:`write` 一樣,接收操作時會自動分配緩衝區,而" +"發送操作時的緩衝區長度則是隱含的。" #: ../../library/socket.rst:35 msgid "Module :mod:`socketserver`" From 27ee90faf7a4552353395d022794a2e738ee13f3 Mon Sep 17 00:00:00 2001 From: weijay <weijay0804@gmail.com> Date: Mon, 6 Jan 2025 15:07:54 +0800 Subject: [PATCH 70/89] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=20socket.po=20?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=87=BD=E6=95=B8=E5=90=8D=E7=A8=B1=E9=8C=AF?= =?UTF-8?q?=E8=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/socket.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/socket.po b/library/socket.po index ad5802ce9e..4b6ff2fe44 100644 --- a/library/socket.po +++ b/library/socket.po @@ -92,7 +92,7 @@ msgid "" "operations is automatic, and buffer length is implicit on send operations." msgstr "" "Python 的介面是將 Unix 的系統呼叫和 socket 函式庫介面直接轉換成 Python 的物件" -"導向風格::func:`.socket` 函數會回傳一個 :dfn:`socket 物件`,這個物件的方法實" +"導向風格::func:`.socket` 函式會回傳一個 :dfn:`socket 物件`,這個物件的方法實" "作了各種 socket 系統呼叫。與 C 語言介面相比,參數型別較為高階:就像 Python 文" "件操作中的 :meth:`read` 和 :meth:`write` 一樣,接收操作時會自動分配緩衝區,而" "發送操作時的緩衝區長度則是隱含的。" From 241ff06a02bb48d5a7514edd5c67dcf2792e3459 Mon Sep 17 00:00:00 2001 From: "W. H. Wang" <mattwang44@gmail.com> Date: Wed, 15 Jan 2025 13:35:11 +0800 Subject: [PATCH 71/89] fix(glossary): typo --- glossary.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glossary.po b/glossary.po index 428ab89521..8c54be9e05 100644 --- a/glossary.po +++ b/glossary.po @@ -1478,7 +1478,7 @@ msgstr "" #: ../../glossary.rst:642 msgid "immortal" -msgstr "immportal(不滅)" +msgstr "immortal(不滅)" #: ../../glossary.rst:644 msgid "" From e2bf6ceee2b8f936a34fcfcef437a900dd9cf376 Mon Sep 17 00:00:00 2001 From: "pydoc-zh-tw[bot]" <90344106+pydoc-zh-tw[bot]@users.noreply.github.com> Date: Fri, 7 Feb 2025 15:51:56 +0800 Subject: [PATCH 72/89] Sync with CPython 3.13 (#1015) --- about.po | 42 +- c-api/arg.po | 504 ++++--- c-api/init.po | 1005 ++++++------- c-api/module.po | 81 +- c-api/object.po | 39 +- c-api/unicode.po | 612 ++++---- c-api/veryhigh.po | 14 +- faq/programming.po | 711 ++++----- glossary.po | 1252 ++++++++-------- howto/free-threading-python.po | 4 +- howto/mro.po | 4 +- library/asyncio-eventloop.po | 1472 ++++++++++--------- library/asyncio-queue.po | 57 +- library/calendar.po | 398 ++--- library/collections.abc.po | 277 ++-- library/datetime.po | 6 +- library/decimal.po | 4 +- library/email.contentmanager.po | 31 +- library/email.policy.po | 6 +- library/errno.po | 116 +- library/exceptions.po | 728 +++++----- library/fnmatch.po | 42 +- library/importlib.metadata.po | 4 +- library/importlib.po | 456 +++--- library/index.po | 4 +- library/itertools.po | 111 +- library/json.po | 759 +++++----- library/logging.po | 4 +- library/math.po | 339 ++--- library/os.po | 171 +-- library/pdb.po | 363 ++--- library/plistlib.po | 4 +- library/site.po | 4 +- library/socket.po | 653 ++++----- library/socketserver.po | 210 +-- library/ssl.po | 8 +- library/string.po | 594 ++++---- library/sys.po | 5 +- library/sysconfig.po | 97 +- library/time.po | 687 ++++----- library/tokenize.po | 75 +- library/turtle.po | 6 +- license.po | 381 ++--- reference/compound_stmts.po | 388 ++--- sphinx.po | 100 +- using/cmdline.po | 6 +- using/configure.po | 841 +++++------ whatsnew/2.3.po | 4 +- whatsnew/2.7.po | 20 +- whatsnew/3.12.po | 1362 +++++++++--------- whatsnew/3.13.po | 2398 +++++++++++++++++-------------- whatsnew/3.3.po | 6 +- whatsnew/3.4.po | 4 +- whatsnew/changelog.po | 4 +- 54 files changed, 9227 insertions(+), 8246 deletions(-) diff --git a/about.po b/about.po index 34c5041570..a95b16de88 100644 --- a/about.po +++ b/about.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -14,7 +13,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-08-05 00:19+0000\n" +"POT-Creation-Date: 2025-01-01 00:15+0000\n" "PO-Revision-Date: 2022-05-12 00:11+0800\n" "Last-Translator: hsiao yi <hsiaoyi0504@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,18 +26,19 @@ msgstr "" "X-Generator: Poedit 3.0.1\n" #: ../../about.rst:3 -msgid "About these documents" -msgstr "關於這些說明文件" +msgid "About this documentation" +msgstr "關於這份說明文件" #: ../../about.rst:6 msgid "" -"These documents are generated from `reStructuredText`_ sources by `Sphinx`_, " -"a document processor specifically written for the Python documentation." +"Python's documentation is generated from `reStructuredText`_ sources using " +"`Sphinx`_, a documentation generator originally created for Python and now " +"maintained as an independent project." msgstr "" -"這些說明文件是透過 `Sphinx`_ (一個專為 Python 說明文件所撰寫的文件處理器)將" -"使用 `reStructuredText`_ 撰寫的原始檔轉換而成。" +"Python 說明文件是透過使用 `Sphinx`_\\ (一個原為 Python 而生的文件產生器、目" +"前是以獨立專案形式來維護)將使用 `reStructuredText`_ 撰寫的原始檔轉換而成。" -#: ../../about.rst:15 +#: ../../about.rst:16 msgid "" "Development of the documentation and its toolchain is an entirely volunteer " "effort, just like Python itself. If you want to contribute, please take a " @@ -49,26 +49,26 @@ msgstr "" "報臭蟲,請見 :ref:`reporting-bugs` 頁面,內含相關資訊。我們永遠歡迎新的自願者" "加入!" -#: ../../about.rst:20 +#: ../../about.rst:21 msgid "Many thanks go to:" msgstr "致謝:" -#: ../../about.rst:22 +#: ../../about.rst:23 msgid "" "Fred L. Drake, Jr., the creator of the original Python documentation toolset " -"and writer of much of the content;" +"and author of much of the content;" msgstr "" "Fred L. Drake, Jr.,原始 Python 文件工具集的創造者以及一大部份內容的作者;" -#: ../../about.rst:24 +#: ../../about.rst:25 msgid "" "the `Docutils <https://docutils.sourceforge.io/>`_ project for creating " "reStructuredText and the Docutils suite;" msgstr "" -"創造 reStructuredText 和 Docutils 工具組的 `Docutils <https://docutils." -"sourceforge.io/>`_ 專案;" +"創造 reStructuredText 和 Docutils 工具組的 `Docutils <https://" +"docutils.sourceforge.io/>`_ 專案;" -#: ../../about.rst:26 +#: ../../about.rst:27 msgid "" "Fredrik Lundh for his Alternative Python Reference project from which Sphinx " "got many good ideas." @@ -76,11 +76,11 @@ msgstr "" "Fredrik Lundh 先生,Sphinx 從他的 Alternative Python Reference 計劃中獲得許多" "的好主意。" -#: ../../about.rst:31 -msgid "Contributors to the Python Documentation" +#: ../../about.rst:32 +msgid "Contributors to the Python documentation" msgstr "Python 文件的貢獻者們" -#: ../../about.rst:33 +#: ../../about.rst:34 msgid "" "Many people have contributed to the Python language, the Python standard " "library, and the Python documentation. See :source:`Misc/ACKS` in the " @@ -89,7 +89,7 @@ msgstr "" "許多人都曾為 Python 這門語言、Python 標準函式庫和 Python 說明文件貢獻過。" "Python 所發佈的原始碼中含有部份貢獻者的清單,請見 :source:`Misc/ACKS` 。" -#: ../../about.rst:37 +#: ../../about.rst:38 msgid "" "It is only with the input and contributions of the Python community that " "Python has such wonderful documentation -- Thank You!" diff --git a/c-api/arg.po b/c-api/arg.po index 6e8339452f..7d0ae25460 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-01-07 00:14+0000\n" "PO-Revision-Date: 2022-10-16 03:21+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -26,22 +25,22 @@ msgstr "剖析引數與建置數值" #: ../../c-api/arg.rst:8 msgid "" "These functions are useful when creating your own extensions functions and " -"methods. Additional information and examples are available in :ref:" -"`extending-index`." +"methods. Additional information and examples are available " +"in :ref:`extending-index`." msgstr "" #: ../../c-api/arg.rst:12 msgid "" -"The first three of these functions described, :c:func:`PyArg_ParseTuple`, :c:" -"func:`PyArg_ParseTupleAndKeywords`, and :c:func:`PyArg_Parse`, all use " -"*format strings* which are used to tell the function about the expected " -"arguments. The format strings use the same syntax for each of these " -"functions." +"The first three of these functions " +"described, :c:func:`PyArg_ParseTuple`, :c:func:`PyArg_ParseTupleAndKeywords`, " +"and :c:func:`PyArg_Parse`, all use *format strings* which are used to tell " +"the function about the expected arguments. The format strings use the same " +"syntax for each of these functions." msgstr "" #: ../../c-api/arg.rst:19 msgid "Parsing arguments" -msgstr "" +msgstr "剖析引數" #: ../../c-api/arg.rst:21 msgid "" @@ -109,10 +108,10 @@ msgstr "" #: ../../c-api/arg.rst:70 msgid "" -"To ensure that the underlying buffer may be safely borrowed, the object's :c:" -"member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. This " -"disallows common mutable objects such as :class:`bytearray`, but also some " -"read-only objects such as :class:`memoryview` of :class:`bytes`." +"To ensure that the underlying buffer may be safely borrowed, the " +"object's :c:member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. " +"This disallows common mutable objects such as :class:`bytearray`, but also " +"some read-only objects such as :class:`memoryview` of :class:`bytes`." msgstr "" #: ../../c-api/arg.rst:76 @@ -140,8 +139,8 @@ msgstr "" msgid "" "This format does not accept :term:`bytes-like objects <bytes-like object>`. " "If you want to accept filesystem paths and convert them to C character " -"strings, it is preferable to use the ``O&`` format with :c:func:" -"`PyUnicode_FSConverter` as *converter*." +"strings, it is preferable to use the ``O&`` format " +"with :c:func:`PyUnicode_FSConverter` as *converter*." msgstr "" #: ../../c-api/arg.rst:96 @@ -152,7 +151,7 @@ msgstr "" #: ../../c-api/arg.rst:100 msgid "``s*`` (:class:`str` or :term:`bytes-like object`) [Py_buffer]" -msgstr "``s*``\\ (:class:`str` 或 :term:`bytes-like object`)[Py_buffer]" +msgstr "``s*`` (:class:`str` 或 :term:`bytes-like object`) [Py_buffer]" #: ../../c-api/arg.rst:101 msgid "" @@ -164,9 +163,11 @@ msgstr "" #: ../../c-api/arg.rst:106 msgid "" -"``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char \\*, :" -"c:type:`Py_ssize_t`]" +"``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char " +"\\*, :c:type:`Py_ssize_t`]" msgstr "" +"``s#`` (:class:`str`、唯讀的 :term:`bytes-like object`) [const char " +"\\*, :c:type:`Py_ssize_t`]" #: ../../c-api/arg.rst:107 msgid "" @@ -177,9 +178,9 @@ msgid "" "encoding." msgstr "" -#: ../../c-api/arg.rst:113 ../../c-api/arg.rst:581 +#: ../../c-api/arg.rst:113 ../../c-api/arg.rst:593 msgid "``z`` (:class:`str` or ``None``) [const char \\*]" -msgstr "``z``\\ (:class:`str` 或 ``None``)[const char \\*]" +msgstr "``z`` (:class:`str` 或 ``None``) [const char \\*]" #: ../../c-api/arg.rst:114 msgid "" @@ -191,7 +192,7 @@ msgstr "" msgid "" "``z*`` (:class:`str`, :term:`bytes-like object` or ``None``) [Py_buffer]" msgstr "" -"``z*``\\ (:class:`str`、:term:`bytes-like object` 或 ``None``)[Py_buffer]" +"``z*`` (:class:`str`、:term:`bytes-like object` 或 ``None``) [Py_buffer]" #: ../../c-api/arg.rst:118 msgid "" @@ -204,6 +205,8 @@ msgid "" "``z#`` (:class:`str`, read-only :term:`bytes-like object` or ``None``) " "[const char \\*, :c:type:`Py_ssize_t`]" msgstr "" +"``z#`` (:class:`str`、唯讀的 :term:`bytes-like object` 或 ``None``) [const " +"char \\*, :c:type:`Py_ssize_t`]" #: ../../c-api/arg.rst:122 msgid "" @@ -213,7 +216,7 @@ msgstr "" #: ../../c-api/arg.rst:125 msgid "``y`` (read-only :term:`bytes-like object`) [const char \\*]" -msgstr "``y``\\ (唯讀 :term:`bytes-like object`)[const char \\*]" +msgstr "``y`` (唯讀的 :term:`bytes-like object`) [const char \\*]" #: ../../c-api/arg.rst:126 msgid "" @@ -241,9 +244,11 @@ msgstr "" #: ../../c-api/arg.rst:141 msgid "" -"``y#`` (read-only :term:`bytes-like object`) [const char \\*, :c:type:" -"`Py_ssize_t`]" +"``y#`` (read-only :term:`bytes-like object`) [const char " +"\\*, :c:type:`Py_ssize_t`]" msgstr "" +"``y#`` (唯讀的 :term:`bytes-like object`) [const char " +"\\*, :c:type:`Py_ssize_t`]" #: ../../c-api/arg.rst:142 msgid "" @@ -269,9 +274,9 @@ msgstr "``Y`` (:class:`bytearray`) [PyByteArrayObject \\*]" #: ../../c-api/arg.rst:151 msgid "" "Requires that the Python object is a :class:`bytearray` object, without " -"attempting any conversion. Raises :exc:`TypeError` if the object is not a :" -"class:`bytearray` object. The C variable may also be declared as :c:expr:" -"`PyObject*`." +"attempting any conversion. Raises :exc:`TypeError` if the object is not " +"a :class:`bytearray` object. The C variable may also be declared " +"as :c:expr:`PyObject*`." msgstr "" #: ../../c-api/arg.rst:155 @@ -287,14 +292,14 @@ msgstr "" #: ../../c-api/arg.rst:160 msgid "``w*`` (read-write :term:`bytes-like object`) [Py_buffer]" -msgstr "``w*`` (可讀寫 :term:`bytes-like object`) [Py_buffer]" +msgstr "``w*`` (可讀寫 :term:`bytes-like object`) [Py_buffer]" #: ../../c-api/arg.rst:161 msgid "" "This format accepts any object which implements the read-write buffer " "interface. It fills a :c:type:`Py_buffer` structure provided by the caller. " -"The buffer may contain embedded null bytes. The caller have to call :c:func:" -"`PyBuffer_Release` when it is done with the buffer." +"The buffer may contain embedded null bytes. The caller have to " +"call :c:func:`PyBuffer_Release` when it is done with the buffer." msgstr "" #: ../../c-api/arg.rst:166 @@ -322,8 +327,8 @@ msgstr "" msgid "" ":c:func:`PyArg_ParseTuple` will allocate a buffer of the needed size, copy " "the encoded data into this buffer and adjust *\\*buffer* to reference the " -"newly allocated storage. The caller is responsible for calling :c:func:" -"`PyMem_Free` to free the allocated buffer after use." +"newly allocated storage. The caller is responsible for " +"calling :c:func:`PyMem_Free` to free the allocated buffer after use." msgstr "" #: ../../c-api/arg.rst:183 @@ -331,6 +336,8 @@ msgid "" "``et`` (:class:`str`, :class:`bytes` or :class:`bytearray`) [const char " "\\*encoding, char \\*\\*buffer]" msgstr "" +"``et`` (:class:`str`、:class:`bytes` 或 :class:`bytearray`) [const char " +"\\*encoding, char \\*\\*buffer]" #: ../../c-api/arg.rst:184 msgid "" @@ -341,9 +348,11 @@ msgstr "" #: ../../c-api/arg.rst:188 msgid "" -"``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:" -"`Py_ssize_t` \\*buffer_length]" +"``es#`` (:class:`str`) [const char \\*encoding, char " +"\\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" msgstr "" +"``es#`` (:class:`str`) [const char \\*encoding, char " +"\\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" #: ../../c-api/arg.rst:189 msgid "" @@ -367,7 +376,7 @@ msgstr "" #: ../../c-api/arg.rst:203 msgid "There are two modes of operation:" -msgstr "" +msgstr "有兩個操作模式:" #: ../../c-api/arg.rst:205 msgid "" @@ -417,38 +426,60 @@ msgid "Numbers" msgstr "數字" #: ../../c-api/arg.rst:232 +msgid "" +"These formats allow representing Python numbers or single characters as C " +"numbers. Formats that require :class:`int`, :class:`float` " +"or :class:`complex` can also use the corresponding special " +"methods :meth:`~object.__index__`, :meth:`~object.__float__` " +"or :meth:`~object.__complex__` to convert the Python object to the required " +"type." +msgstr "" + +#: ../../c-api/arg.rst:238 +msgid "" +"For signed integer formats, :exc:`OverflowError` is raised if the value is " +"out of range for the C type. For unsigned integer formats, no range checking " +"is done --- the most significant bits are silently truncated when the " +"receiving field is too small to receive the value." +msgstr "" + +#: ../../c-api/arg.rst:244 msgid "``b`` (:class:`int`) [unsigned char]" msgstr "``b`` (:class:`int`) [unsigned char]" -#: ../../c-api/arg.rst:233 +#: ../../c-api/arg.rst:245 msgid "" -"Convert a nonnegative Python integer to an unsigned tiny int, stored in a C :" -"c:expr:`unsigned char`." +"Convert a nonnegative Python integer to an unsigned tiny integer, stored in " +"a C :c:expr:`unsigned char`." msgstr "" +"將一個 Python 非負整數轉換成無符號 tiny integer(小整數),儲存在 C " +"的 :c:expr:`unsigned`" -#: ../../c-api/arg.rst:236 ../../c-api/arg.rst:615 +#: ../../c-api/arg.rst:248 ../../c-api/arg.rst:627 msgid "``B`` (:class:`int`) [unsigned char]" msgstr "``B`` (:class:`int`) [unsigned char]" -#: ../../c-api/arg.rst:237 +#: ../../c-api/arg.rst:249 msgid "" -"Convert a Python integer to a tiny int without overflow checking, stored in " -"a C :c:expr:`unsigned char`." +"Convert a Python integer to a tiny integer without overflow checking, stored " +"in a C :c:expr:`unsigned char`." msgstr "" +"將一個 Python 整數轉換成 tiny integer,轉換過程無溢位檢查,儲存在 C " +"的 :c:expr:`unsigned char`。" -#: ../../c-api/arg.rst:240 ../../c-api/arg.rst:609 +#: ../../c-api/arg.rst:252 ../../c-api/arg.rst:621 msgid "``h`` (:class:`int`) [short int]" msgstr "``h`` (:class:`int`) [short int]" -#: ../../c-api/arg.rst:241 +#: ../../c-api/arg.rst:253 msgid "Convert a Python integer to a C :c:expr:`short int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`short int`。" -#: ../../c-api/arg.rst:243 ../../c-api/arg.rst:618 +#: ../../c-api/arg.rst:255 ../../c-api/arg.rst:630 msgid "``H`` (:class:`int`) [unsigned short int]" msgstr "``H`` (:class:`int`) [unsigned short int]" -#: ../../c-api/arg.rst:244 +#: ../../c-api/arg.rst:256 msgid "" "Convert a Python integer to a C :c:expr:`unsigned short int`, without " "overflow checking." @@ -456,57 +487,57 @@ msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned short int`,轉換過程無溢位檢" "查。" -#: ../../c-api/arg.rst:247 ../../c-api/arg.rst:603 +#: ../../c-api/arg.rst:259 ../../c-api/arg.rst:615 msgid "``i`` (:class:`int`) [int]" msgstr "``i`` (:class:`int`) [int]" -#: ../../c-api/arg.rst:248 +#: ../../c-api/arg.rst:260 msgid "Convert a Python integer to a plain C :c:expr:`int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`int`。" -#: ../../c-api/arg.rst:250 ../../c-api/arg.rst:621 +#: ../../c-api/arg.rst:262 ../../c-api/arg.rst:633 msgid "``I`` (:class:`int`) [unsigned int]" msgstr "``I`` (:class:`int`) [unsigned int]" -#: ../../c-api/arg.rst:251 +#: ../../c-api/arg.rst:263 msgid "" "Convert a Python integer to a C :c:expr:`unsigned int`, without overflow " "checking." msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned int`,轉換過程無溢位檢查。" -#: ../../c-api/arg.rst:254 ../../c-api/arg.rst:612 +#: ../../c-api/arg.rst:266 ../../c-api/arg.rst:624 msgid "``l`` (:class:`int`) [long int]" msgstr "``l`` (:class:`int`) [long int]" -#: ../../c-api/arg.rst:255 +#: ../../c-api/arg.rst:267 msgid "Convert a Python integer to a C :c:expr:`long int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`long int`。" -#: ../../c-api/arg.rst:257 ../../c-api/arg.rst:624 +#: ../../c-api/arg.rst:269 ../../c-api/arg.rst:636 msgid "``k`` (:class:`int`) [unsigned long]" msgstr "``k`` (:class:`int`) [unsigned long]" -#: ../../c-api/arg.rst:258 +#: ../../c-api/arg.rst:270 msgid "" "Convert a Python integer to a C :c:expr:`unsigned long` without overflow " "checking." msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned long`,轉換過程無溢位檢查。" -#: ../../c-api/arg.rst:261 ../../c-api/arg.rst:627 +#: ../../c-api/arg.rst:273 ../../c-api/arg.rst:639 msgid "``L`` (:class:`int`) [long long]" msgstr "``L`` (:class:`int`) [long long]" -#: ../../c-api/arg.rst:262 +#: ../../c-api/arg.rst:274 msgid "Convert a Python integer to a C :c:expr:`long long`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`long long`。" -#: ../../c-api/arg.rst:264 ../../c-api/arg.rst:630 +#: ../../c-api/arg.rst:276 ../../c-api/arg.rst:642 msgid "``K`` (:class:`int`) [unsigned long long]" msgstr "``K`` (:class:`int`) [unsigned long long]" -#: ../../c-api/arg.rst:265 +#: ../../c-api/arg.rst:277 msgid "" "Convert a Python integer to a C :c:expr:`unsigned long long` without " "overflow checking." @@ -514,83 +545,83 @@ msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned long long`,轉換過程無溢位檢" "查。" -#: ../../c-api/arg.rst:268 ../../c-api/arg.rst:633 +#: ../../c-api/arg.rst:280 ../../c-api/arg.rst:645 msgid "``n`` (:class:`int`) [:c:type:`Py_ssize_t`]" msgstr "``n`` (:class:`int`) [:c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:269 +#: ../../c-api/arg.rst:281 msgid "Convert a Python integer to a C :c:type:`Py_ssize_t`." msgstr "將一個 Python 整數轉換成 C 的 :c:type:`Py_ssize_t`。" -#: ../../c-api/arg.rst:271 +#: ../../c-api/arg.rst:283 msgid "``c`` (:class:`bytes` or :class:`bytearray` of length 1) [char]" -msgstr "``c``\\ (:class:`bytes` 或長度為 1 的 :class:`bytearray`)[char]" +msgstr "``c`` (:class:`bytes` 或長度為 1 的 :class:`bytearray`) [char]" -#: ../../c-api/arg.rst:272 +#: ../../c-api/arg.rst:284 msgid "" "Convert a Python byte, represented as a :class:`bytes` or :class:`bytearray` " "object of length 1, to a C :c:expr:`char`." msgstr "" -#: ../../c-api/arg.rst:275 +#: ../../c-api/arg.rst:287 msgid "Allow :class:`bytearray` objects." msgstr "允許 :class:`bytearray` 物件。" -#: ../../c-api/arg.rst:278 ../../c-api/arg.rst:640 +#: ../../c-api/arg.rst:290 ../../c-api/arg.rst:652 msgid "``C`` (:class:`str` of length 1) [int]" -msgstr "``C``\\ (長度為 1 的 :class:`str`)[int]" +msgstr "``C`` (長度為 1 的 :class:`str`) [int]" -#: ../../c-api/arg.rst:279 +#: ../../c-api/arg.rst:291 msgid "" "Convert a Python character, represented as a :class:`str` object of length " "1, to a C :c:expr:`int`." msgstr "" -#: ../../c-api/arg.rst:282 ../../c-api/arg.rst:647 +#: ../../c-api/arg.rst:294 ../../c-api/arg.rst:659 msgid "``f`` (:class:`float`) [float]" msgstr "``f`` (:class:`float`) [float]" -#: ../../c-api/arg.rst:283 +#: ../../c-api/arg.rst:295 msgid "Convert a Python floating-point number to a C :c:expr:`float`." msgstr "將一個 Python 浮點數轉換成 C 的 :c:type::c:expr:`float`。" -#: ../../c-api/arg.rst:285 ../../c-api/arg.rst:644 +#: ../../c-api/arg.rst:297 ../../c-api/arg.rst:656 msgid "``d`` (:class:`float`) [double]" msgstr "``d`` (:class:`float`) [double]" -#: ../../c-api/arg.rst:286 +#: ../../c-api/arg.rst:298 msgid "Convert a Python floating-point number to a C :c:expr:`double`." msgstr "將一個 Python 浮點數轉換成 C 的 :c:type::c:expr:`double`。" -#: ../../c-api/arg.rst:288 +#: ../../c-api/arg.rst:300 msgid "``D`` (:class:`complex`) [Py_complex]" msgstr "``D`` (:class:`complex`) [Py_complex]" -#: ../../c-api/arg.rst:289 +#: ../../c-api/arg.rst:301 msgid "Convert a Python complex number to a C :c:type:`Py_complex` structure." msgstr "將一個 Python 複數轉換成 C 的 :c:type:`Py_complex` 結構。" -#: ../../c-api/arg.rst:292 +#: ../../c-api/arg.rst:304 msgid "Other objects" msgstr "其他物件" -#: ../../c-api/arg.rst:294 ../../c-api/arg.rst:653 +#: ../../c-api/arg.rst:306 ../../c-api/arg.rst:665 msgid "``O`` (object) [PyObject \\*]" -msgstr "``O``\\ (物件)[PyObject \\*]" +msgstr "``O`` (object) [PyObject \\*]" -#: ../../c-api/arg.rst:295 +#: ../../c-api/arg.rst:307 msgid "" "Store a Python object (without any conversion) in a C object pointer. The C " -"program thus receives the actual object that was passed. A new :term:" -"`strong reference` to the object is not created (i.e. its reference count is " -"not increased). The pointer stored is not ``NULL``." +"program thus receives the actual object that was passed. A " +"new :term:`strong reference` to the object is not created (i.e. its " +"reference count is not increased). The pointer stored is not ``NULL``." msgstr "" -#: ../../c-api/arg.rst:301 +#: ../../c-api/arg.rst:313 msgid "``O!`` (object) [*typeobject*, PyObject \\*]" -msgstr "``O!``\\ (物件)[*typeobject*, PyObject \\*]" +msgstr "``O!`` (object) [*typeobject*, PyObject \\*]" -#: ../../c-api/arg.rst:302 +#: ../../c-api/arg.rst:314 msgid "" "Store a Python object in a C object pointer. This is similar to ``O``, but " "takes two C arguments: the first is the address of a Python type object, the " @@ -599,11 +630,11 @@ msgid "" "required type, :exc:`TypeError` is raised." msgstr "" -#: ../../c-api/arg.rst:310 ../../c-api/arg.rst:671 -msgid "``O&`` (object) [*converter*, *anything*]" -msgstr "``O&``\\ (物件)[*converter*, *anything*]" +#: ../../c-api/arg.rst:322 +msgid "``O&`` (object) [*converter*, *address*]" +msgstr "``O&`` (object) [*converter*, *address*]" -#: ../../c-api/arg.rst:311 +#: ../../c-api/arg.rst:323 msgid "" "Convert a Python object to a C variable through a *converter* function. " "This takes two arguments: the first is a function, the second is the address " @@ -611,38 +642,44 @@ msgid "" "*converter* function in turn is called as follows::" msgstr "" -#: ../../c-api/arg.rst:316 +#: ../../c-api/arg.rst:328 msgid "status = converter(object, address);" msgstr "status = converter(object, address);" -#: ../../c-api/arg.rst:318 +#: ../../c-api/arg.rst:330 msgid "" -"where *object* is the Python object to be converted and *address* is the :c:" -"expr:`void*` argument that was passed to the ``PyArg_Parse*`` function. The " -"returned *status* should be ``1`` for a successful conversion and ``0`` if " -"the conversion has failed. When the conversion fails, the *converter* " -"function should raise an exception and leave the content of *address* " -"unmodified." +"where *object* is the Python object to be converted and *address* is " +"the :c:expr:`void*` argument that was passed to the ``PyArg_Parse*`` " +"function. The returned *status* should be ``1`` for a successful conversion " +"and ``0`` if the conversion has failed. When the conversion fails, the " +"*converter* function should raise an exception and leave the content of " +"*address* unmodified." msgstr "" -#: ../../c-api/arg.rst:324 +#: ../../c-api/arg.rst:339 msgid "" -"If the *converter* returns ``Py_CLEANUP_SUPPORTED``, it may get called a " -"second time if the argument parsing eventually fails, giving the converter a " -"chance to release any memory that it had already allocated. In this second " -"call, the *object* parameter will be ``NULL``; *address* will have the same " -"value as in the original call." +"If the *converter* returns :c:macro:`!Py_CLEANUP_SUPPORTED`, it may get " +"called a second time if the argument parsing eventually fails, giving the " +"converter a chance to release any memory that it had already allocated. In " +"this second call, the *object* parameter will be ``NULL``; *address* will " +"have the same value as in the original call." msgstr "" -#: ../../c-api/arg.rst:330 -msgid "``Py_CLEANUP_SUPPORTED`` was added." -msgstr "加入 ``Py_CLEANUP_SUPPORTED``。" +#: ../../c-api/arg.rst:345 +msgid "" +"Examples of converters: :c:func:`PyUnicode_FSConverter` " +"and :c:func:`PyUnicode_FSDecoder`." +msgstr "" + +#: ../../c-api/arg.rst:348 +msgid ":c:macro:`!Py_CLEANUP_SUPPORTED` was added." +msgstr "新增 :c:macro:`!Py_CLEANUP_SUPPORTED`。" -#: ../../c-api/arg.rst:333 +#: ../../c-api/arg.rst:351 msgid "``p`` (:class:`bool`) [int]" msgstr "``p`` (:class:`bool`) [int]" -#: ../../c-api/arg.rst:334 +#: ../../c-api/arg.rst:352 msgid "" "Tests the value passed in for truth (a boolean **p**\\ redicate) and " "converts the result to its equivalent C true/false integer value. Sets the " @@ -651,37 +688,28 @@ msgid "" "how Python tests values for truth." msgstr "" -#: ../../c-api/arg.rst:342 ../../c-api/arg.rst:677 +#: ../../c-api/arg.rst:360 ../../c-api/arg.rst:689 msgid "``(items)`` (:class:`tuple`) [*matching-items*]" msgstr "``(items)`` (:class:`tuple`) [*matching-items*]" -#: ../../c-api/arg.rst:343 +#: ../../c-api/arg.rst:361 msgid "" "The object must be a Python sequence whose length is the number of format " "units in *items*. The C arguments must correspond to the individual format " "units in *items*. Format units for sequences may be nested." msgstr "" -#: ../../c-api/arg.rst:347 -msgid "" -"It is possible to pass \"long\" integers (integers whose value exceeds the " -"platform's :c:macro:`LONG_MAX`) however no proper range checking is done --- " -"the most significant bits are silently truncated when the receiving field is " -"too small to receive the value (actually, the semantics are inherited from " -"downcasts in C --- your mileage may vary)." -msgstr "" - -#: ../../c-api/arg.rst:353 +#: ../../c-api/arg.rst:365 msgid "" "A few other characters have a meaning in a format string. These may not " "occur inside nested parentheses. They are:" msgstr "" -#: ../../c-api/arg.rst:356 +#: ../../c-api/arg.rst:368 msgid "``|``" msgstr "``|``" -#: ../../c-api/arg.rst:357 +#: ../../c-api/arg.rst:369 msgid "" "Indicates that the remaining arguments in the Python argument list are " "optional. The C variables corresponding to optional arguments should be " @@ -690,11 +718,11 @@ msgid "" "corresponding C variable(s)." msgstr "" -#: ../../c-api/arg.rst:363 +#: ../../c-api/arg.rst:375 msgid "``$``" msgstr "``$``" -#: ../../c-api/arg.rst:364 +#: ../../c-api/arg.rst:376 msgid "" ":c:func:`PyArg_ParseTupleAndKeywords` only: Indicates that the remaining " "arguments in the Python argument list are keyword-only. Currently, all " @@ -702,36 +730,36 @@ msgid "" "be specified before ``$`` in the format string." msgstr "" -#: ../../c-api/arg.rst:372 +#: ../../c-api/arg.rst:384 msgid "``:``" msgstr "``:``" -#: ../../c-api/arg.rst:373 +#: ../../c-api/arg.rst:385 msgid "" "The list of format units ends here; the string after the colon is used as " "the function name in error messages (the \"associated value\" of the " "exception that :c:func:`PyArg_ParseTuple` raises)." msgstr "" -#: ../../c-api/arg.rst:377 +#: ../../c-api/arg.rst:389 msgid "``;``" msgstr "``;``" -#: ../../c-api/arg.rst:378 +#: ../../c-api/arg.rst:390 msgid "" "The list of format units ends here; the string after the semicolon is used " -"as the error message *instead* of the default error message. ``:`` and ``;" -"`` mutually exclude each other." +"as the error message *instead* of the default error message. ``:`` and " +"``;`` mutually exclude each other." msgstr "" -#: ../../c-api/arg.rst:382 +#: ../../c-api/arg.rst:394 msgid "" "Note that any Python object references which are provided to the caller are " "*borrowed* references; do not release them (i.e. do not decrement their " "reference count)!" msgstr "" -#: ../../c-api/arg.rst:386 +#: ../../c-api/arg.rst:398 msgid "" "Additional arguments passed to these functions must be addresses of " "variables whose type is determined by the format string; these are used to " @@ -741,7 +769,7 @@ msgid "" "unit in that case." msgstr "" -#: ../../c-api/arg.rst:392 +#: ../../c-api/arg.rst:404 msgid "" "For the conversion to succeed, the *arg* object must match the format and " "the format must be exhausted. On success, the ``PyArg_Parse*`` functions " @@ -751,24 +779,24 @@ msgid "" "the following format units are left untouched." msgstr "" -#: ../../c-api/arg.rst:401 +#: ../../c-api/arg.rst:413 msgid "API Functions" msgstr "API 函式" -#: ../../c-api/arg.rst:405 +#: ../../c-api/arg.rst:417 msgid "" "Parse the parameters of a function that takes only positional parameters " "into local variables. Returns true on success; on failure, it returns false " "and raises the appropriate exception." msgstr "" -#: ../../c-api/arg.rst:412 +#: ../../c-api/arg.rst:424 msgid "" "Identical to :c:func:`PyArg_ParseTuple`, except that it accepts a va_list " "rather than a variable number of arguments." msgstr "" -#: ../../c-api/arg.rst:418 +#: ../../c-api/arg.rst:430 msgid "" "Parse the parameters of a function that takes both positional and keyword " "parameters into local variables. The *keywords* argument is a ``NULL``-" @@ -778,51 +806,51 @@ msgid "" "failure, it returns false and raises the appropriate exception." msgstr "" -#: ../../c-api/arg.rst:429 +#: ../../c-api/arg.rst:441 msgid "" -"The *keywords* parameter declaration is :c:expr:`char * const *` in C and :c:" -"expr:`const char * const *` in C++. This can be overridden with the :c:macro:" -"`PY_CXX_CONST` macro." +"The *keywords* parameter declaration is :c:expr:`char * const *` in C " +"and :c:expr:`const char * const *` in C++. This can be overridden with " +"the :c:macro:`PY_CXX_CONST` macro." msgstr "" -#: ../../c-api/arg.rst:433 +#: ../../c-api/arg.rst:445 msgid "" "Added support for :ref:`positional-only parameters <positional-" "only_parameter>`." -msgstr "" +msgstr "新增對\\ :ref:`僅限位置參數 <positional-only_parameter>`\\ 的支援。" -#: ../../c-api/arg.rst:437 +#: ../../c-api/arg.rst:449 msgid "" -"The *keywords* parameter has now type :c:expr:`char * const *` in C and :c:" -"expr:`const char * const *` in C++, instead of :c:expr:`char **`. Added " -"support for non-ASCII keyword parameter names." +"The *keywords* parameter has now type :c:expr:`char * const *` in C " +"and :c:expr:`const char * const *` in C++, instead of :c:expr:`char **`. " +"Added support for non-ASCII keyword parameter names." msgstr "" -#: ../../c-api/arg.rst:446 +#: ../../c-api/arg.rst:458 msgid "" "Identical to :c:func:`PyArg_ParseTupleAndKeywords`, except that it accepts a " "va_list rather than a variable number of arguments." msgstr "" -#: ../../c-api/arg.rst:452 +#: ../../c-api/arg.rst:464 msgid "" "Ensure that the keys in the keywords argument dictionary are strings. This " "is only needed if :c:func:`PyArg_ParseTupleAndKeywords` is not used, since " "the latter already does this check." msgstr "" -#: ../../c-api/arg.rst:461 +#: ../../c-api/arg.rst:473 msgid "" "Parse the parameter of a function that takes a single positional parameter " "into a local variable. Returns true on success; on failure, it returns " "false and raises the appropriate exception." msgstr "" -#: ../../c-api/arg.rst:465 +#: ../../c-api/arg.rst:477 msgid "Example::" msgstr "舉例來說: ::" -#: ../../c-api/arg.rst:467 +#: ../../c-api/arg.rst:479 msgid "" "// Function using METH_O calling convention\n" "static PyObject*\n" @@ -836,7 +864,7 @@ msgid "" "}" msgstr "" -#: ../../c-api/arg.rst:481 +#: ../../c-api/arg.rst:493 msgid "" "A simpler form of parameter retrieval which does not use a format string to " "specify the types of the arguments. Functions which use this method to " @@ -854,13 +882,13 @@ msgid "" "if there was a failure." msgstr "" -#: ../../c-api/arg.rst:496 +#: ../../c-api/arg.rst:508 msgid "" "This is an example of the use of this function, taken from the sources for " "the :mod:`!_weakref` helper module for weak references::" msgstr "" -#: ../../c-api/arg.rst:499 +#: ../../c-api/arg.rst:511 msgid "" "static PyObject *\n" "weakref_ref(PyObject *self, PyObject *args)\n" @@ -888,17 +916,17 @@ msgstr "" " return result;\n" "}" -#: ../../c-api/arg.rst:512 +#: ../../c-api/arg.rst:524 msgid "" "The call to :c:func:`PyArg_UnpackTuple` in this example is entirely " "equivalent to this call to :c:func:`PyArg_ParseTuple`::" msgstr "" -#: ../../c-api/arg.rst:515 +#: ../../c-api/arg.rst:527 msgid "PyArg_ParseTuple(args, \"O|O:ref\", &object, &callback)" msgstr "PyArg_ParseTuple(args, \"O|O:ref\", &object, &callback)" -#: ../../c-api/arg.rst:519 +#: ../../c-api/arg.rst:531 msgid "" "The value to be inserted, if any, before :c:expr:`char * const *` in the " "*keywords* parameter declaration of :c:func:`PyArg_ParseTupleAndKeywords` " @@ -907,11 +935,11 @@ msgid "" "to the desired value before including :file:`Python.h`." msgstr "" -#: ../../c-api/arg.rst:533 +#: ../../c-api/arg.rst:545 msgid "Building values" -msgstr "" +msgstr "建置數值" -#: ../../c-api/arg.rst:537 +#: ../../c-api/arg.rst:549 msgid "" "Create a new value based on a format string similar to those accepted by the " "``PyArg_Parse*`` family of functions and a sequence of values. Returns the " @@ -919,7 +947,7 @@ msgid "" "``NULL`` is returned." msgstr "" -#: ../../c-api/arg.rst:542 +#: ../../c-api/arg.rst:554 msgid "" ":c:func:`Py_BuildValue` does not always build a tuple. It builds a tuple " "only if its format string contains two or more format units. If the format " @@ -928,18 +956,18 @@ msgid "" "it to return a tuple of size 0 or one, parenthesize the format string." msgstr "" -#: ../../c-api/arg.rst:548 +#: ../../c-api/arg.rst:560 msgid "" "When memory buffers are passed as parameters to supply data to build " "objects, as for the ``s`` and ``s#`` formats, the required data is copied. " "Buffers provided by the caller are never referenced by the objects created " -"by :c:func:`Py_BuildValue`. In other words, if your code invokes :c:func:" -"`malloc` and passes the allocated memory to :c:func:`Py_BuildValue`, your " -"code is responsible for calling :c:func:`free` for that memory once :c:func:" -"`Py_BuildValue` returns." +"by :c:func:`Py_BuildValue`. In other words, if your code " +"invokes :c:func:`malloc` and passes the allocated memory " +"to :c:func:`Py_BuildValue`, your code is responsible for " +"calling :c:func:`free` for that memory once :c:func:`Py_BuildValue` returns." msgstr "" -#: ../../c-api/arg.rst:556 +#: ../../c-api/arg.rst:568 msgid "" "In the following description, the quoted form is the format unit; the entry " "in (round) parentheses is the Python object type that the format unit will " @@ -947,257 +975,261 @@ msgid "" "be passed." msgstr "" -#: ../../c-api/arg.rst:560 +#: ../../c-api/arg.rst:572 msgid "" "The characters space, tab, colon and comma are ignored in format strings " "(but not within format units such as ``s#``). This can be used to make long " "format strings a tad more readable." msgstr "" -#: ../../c-api/arg.rst:564 +#: ../../c-api/arg.rst:576 msgid "``s`` (:class:`str` or ``None``) [const char \\*]" -msgstr "``s``\\ (:class:`str` 或 ``None``)[const char \\*]" +msgstr "``s`` (:class:`str` 或 ``None``) [const char \\*]" -#: ../../c-api/arg.rst:565 +#: ../../c-api/arg.rst:577 msgid "" "Convert a null-terminated C string to a Python :class:`str` object using " "``'utf-8'`` encoding. If the C string pointer is ``NULL``, ``None`` is used." msgstr "" -#: ../../c-api/arg.rst:568 +#: ../../c-api/arg.rst:580 msgid "" "``s#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" -"``s#``\\ (:class:`str` 或 ``None``)[const char \\*, :c:type:`Py_ssize_t`]" +"``s#`` (:class:`str` 或 ``None``) [const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:569 +#: ../../c-api/arg.rst:581 msgid "" "Convert a C string and its length to a Python :class:`str` object using " "``'utf-8'`` encoding. If the C string pointer is ``NULL``, the length is " "ignored and ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:573 +#: ../../c-api/arg.rst:585 msgid "``y`` (:class:`bytes`) [const char \\*]" msgstr "``y`` (:class:`bytes`) [const char \\*]" -#: ../../c-api/arg.rst:574 +#: ../../c-api/arg.rst:586 msgid "" "This converts a C string to a Python :class:`bytes` object. If the C string " "pointer is ``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:577 +#: ../../c-api/arg.rst:589 msgid "``y#`` (:class:`bytes`) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "``y#`` (:class:`bytes`) [const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:578 +#: ../../c-api/arg.rst:590 msgid "" "This converts a C string and its lengths to a Python object. If the C " "string pointer is ``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:582 ../../c-api/arg.rst:598 +#: ../../c-api/arg.rst:594 ../../c-api/arg.rst:610 msgid "Same as ``s``." msgstr "和 ``s`` 相同。" -#: ../../c-api/arg.rst:584 +#: ../../c-api/arg.rst:596 msgid "" "``z#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" -"``z#``\\ (:class:`str` 或 ``None``)[const char \\*, :c:type:`Py_ssize_t`]" +"``z#`` (:class:`str` 或 ``None``) [const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:585 ../../c-api/arg.rst:601 +#: ../../c-api/arg.rst:597 ../../c-api/arg.rst:613 msgid "Same as ``s#``." msgstr "和 ``s#`` 相同。" -#: ../../c-api/arg.rst:587 +#: ../../c-api/arg.rst:599 msgid "``u`` (:class:`str`) [const wchar_t \\*]" msgstr "``u`` (:class:`str`) [const wchar_t \\*]" -#: ../../c-api/arg.rst:588 +#: ../../c-api/arg.rst:600 msgid "" "Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or " "UCS-4) data to a Python Unicode object. If the Unicode buffer pointer is " "``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:592 +#: ../../c-api/arg.rst:604 msgid "``u#`` (:class:`str`) [const wchar_t \\*, :c:type:`Py_ssize_t`]" msgstr "``u#`` (:class:`str`) [const wchar_t \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:593 +#: ../../c-api/arg.rst:605 msgid "" "Convert a Unicode (UTF-16 or UCS-4) data buffer and its length to a Python " "Unicode object. If the Unicode buffer pointer is ``NULL``, the length is " "ignored and ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:597 +#: ../../c-api/arg.rst:609 msgid "``U`` (:class:`str` or ``None``) [const char \\*]" -msgstr "``U``\\ (:class:`str` 或 ``None``)[const char \\*]" +msgstr "``U`` (:class:`str` 或 ``None``) [const char \\*]" -#: ../../c-api/arg.rst:600 +#: ../../c-api/arg.rst:612 msgid "" "``U#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" -"``U#``\\ (:class:`str` 或 ``None``)[const char \\*, :c:type:`Py_ssize_t`]" +"``U#`` (:class:`str` 或 ``None``) [const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:604 +#: ../../c-api/arg.rst:616 msgid "Convert a plain C :c:expr:`int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:606 +#: ../../c-api/arg.rst:618 msgid "``b`` (:class:`int`) [char]" msgstr "``b`` (:class:`int`) [char]" -#: ../../c-api/arg.rst:607 +#: ../../c-api/arg.rst:619 msgid "Convert a plain C :c:expr:`char` to a Python integer object." msgstr "將一個 C 的 :c:expr:`char` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:610 +#: ../../c-api/arg.rst:622 msgid "Convert a plain C :c:expr:`short int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`short int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:613 +#: ../../c-api/arg.rst:625 msgid "Convert a C :c:expr:`long int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`long int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:616 +#: ../../c-api/arg.rst:628 msgid "Convert a C :c:expr:`unsigned char` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned char` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:619 +#: ../../c-api/arg.rst:631 msgid "Convert a C :c:expr:`unsigned short int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned short int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:622 +#: ../../c-api/arg.rst:634 msgid "Convert a C :c:expr:`unsigned int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:625 +#: ../../c-api/arg.rst:637 msgid "Convert a C :c:expr:`unsigned long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:628 +#: ../../c-api/arg.rst:640 msgid "Convert a C :c:expr:`long long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`long long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:631 +#: ../../c-api/arg.rst:643 msgid "Convert a C :c:expr:`unsigned long long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned long long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:634 +#: ../../c-api/arg.rst:646 msgid "Convert a C :c:type:`Py_ssize_t` to a Python integer." msgstr "將一個 C 的 :c:type:`Py_ssize_t` 轉換成 Python 整數。" -#: ../../c-api/arg.rst:636 +#: ../../c-api/arg.rst:648 msgid "``c`` (:class:`bytes` of length 1) [char]" -msgstr "``c``\\ (長度為 1 的 :class:`bytes`)[char]" +msgstr "``c`` (長度為 1 的 :class:`bytes`) [char]" -#: ../../c-api/arg.rst:637 +#: ../../c-api/arg.rst:649 msgid "" "Convert a C :c:expr:`int` representing a byte to a Python :class:`bytes` " "object of length 1." msgstr "" -"將一個 C 中代表一個位元組的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" -"`bytes`。" +"將一個 C 中代表一個位元組的 :c:expr:`int` 轉換成 Python 中長度為一" +"的 :class:`bytes`。" -#: ../../c-api/arg.rst:641 +#: ../../c-api/arg.rst:653 msgid "" "Convert a C :c:expr:`int` representing a character to Python :class:`str` " "object of length 1." msgstr "" -"將一個 C 中代表一個字元的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" -"`str`。" +"將一個 C 中代表一個字元的 :c:expr:`int` 轉換成 Python 中長度為一" +"的 :class:`str`。" -#: ../../c-api/arg.rst:645 +#: ../../c-api/arg.rst:657 msgid "Convert a C :c:expr:`double` to a Python floating-point number." msgstr "將一個 C 的 :c:expr:`double` 轉換成 Python 浮點數。" -#: ../../c-api/arg.rst:648 +#: ../../c-api/arg.rst:660 msgid "Convert a C :c:expr:`float` to a Python floating-point number." msgstr "將一個 C 的 :c:expr:`float` 轉換成 Python 浮點數。" -#: ../../c-api/arg.rst:650 +#: ../../c-api/arg.rst:662 msgid "``D`` (:class:`complex`) [Py_complex \\*]" msgstr "``D`` (:class:`complex`) [Py_complex \\*]" -#: ../../c-api/arg.rst:651 +#: ../../c-api/arg.rst:663 msgid "Convert a C :c:type:`Py_complex` structure to a Python complex number." msgstr "將一個 C 的 :c:type:`Py_complex` 結構轉換成 Python 複數。" -#: ../../c-api/arg.rst:654 +#: ../../c-api/arg.rst:666 msgid "" "Pass a Python object untouched but create a new :term:`strong reference` to " "it (i.e. its reference count is incremented by one). If the object passed in " "is a ``NULL`` pointer, it is assumed that this was caused because the call " -"producing the argument found an error and set an exception. Therefore, :c:" -"func:`Py_BuildValue` will return ``NULL`` but won't raise an exception. If " -"no exception has been raised yet, :exc:`SystemError` is set." +"producing the argument found an error and set an exception. " +"Therefore, :c:func:`Py_BuildValue` will return ``NULL`` but won't raise an " +"exception. If no exception has been raised yet, :exc:`SystemError` is set." msgstr "" -#: ../../c-api/arg.rst:663 +#: ../../c-api/arg.rst:675 msgid "``S`` (object) [PyObject \\*]" -msgstr "``S``\\ (物件)[PyObject \\*]" +msgstr "``S`` (object) [PyObject \\*]" -#: ../../c-api/arg.rst:664 +#: ../../c-api/arg.rst:676 msgid "Same as ``O``." msgstr "和 ``O`` 相同。" -#: ../../c-api/arg.rst:666 +#: ../../c-api/arg.rst:678 msgid "``N`` (object) [PyObject \\*]" -msgstr "``N``\\ (物件)[PyObject \\*]" +msgstr "``N`` (object) [PyObject \\*]" -#: ../../c-api/arg.rst:667 +#: ../../c-api/arg.rst:679 msgid "" "Same as ``O``, except it doesn't create a new :term:`strong reference`. " "Useful when the object is created by a call to an object constructor in the " "argument list." msgstr "" -#: ../../c-api/arg.rst:672 +#: ../../c-api/arg.rst:683 +msgid "``O&`` (object) [*converter*, *anything*]" +msgstr "``O&`` (object) [*converter*, *anything*]" + +#: ../../c-api/arg.rst:684 msgid "" "Convert *anything* to a Python object through a *converter* function. The " -"function is called with *anything* (which should be compatible with :c:expr:" -"`void*`) as its argument and should return a \"new\" Python object, or " -"``NULL`` if an error occurred." +"function is called with *anything* (which should be compatible " +"with :c:expr:`void*`) as its argument and should return a \"new\" Python " +"object, or ``NULL`` if an error occurred." msgstr "" -#: ../../c-api/arg.rst:678 +#: ../../c-api/arg.rst:690 msgid "" "Convert a sequence of C values to a Python tuple with the same number of " "items." msgstr "" -#: ../../c-api/arg.rst:680 +#: ../../c-api/arg.rst:692 msgid "``[items]`` (:class:`list`) [*matching-items*]" msgstr "``[items]`` (:class:`list`) [*matching-items*]" -#: ../../c-api/arg.rst:681 +#: ../../c-api/arg.rst:693 msgid "" "Convert a sequence of C values to a Python list with the same number of " "items." msgstr "" -#: ../../c-api/arg.rst:683 +#: ../../c-api/arg.rst:695 msgid "``{items}`` (:class:`dict`) [*matching-items*]" msgstr "``{items}`` (:class:`dict`) [*matching-items*]" -#: ../../c-api/arg.rst:684 +#: ../../c-api/arg.rst:696 msgid "" "Convert a sequence of C values to a Python dictionary. Each pair of " "consecutive C values adds one item to the dictionary, serving as key and " "value, respectively." msgstr "" -#: ../../c-api/arg.rst:688 +#: ../../c-api/arg.rst:700 msgid "" "If there is an error in the format string, the :exc:`SystemError` exception " "is set and ``NULL`` returned." msgstr "" -#: ../../c-api/arg.rst:693 +#: ../../c-api/arg.rst:705 msgid "" "Identical to :c:func:`Py_BuildValue`, except that it accepts a va_list " "rather than a variable number of arguments." diff --git a/c-api/init.po b/c-api/init.po index e1c8407423..a4bc79d1a8 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-12 00:15+0000\n" +"POT-Creation-Date: 2025-02-07 00:13+0000\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -205,10 +205,8 @@ msgstr ":c:func:`PyMutex_Unlock`" msgid "" "Despite their apparent similarity to some of the functions listed above, the " "following functions **should not be called** before the interpreter has been " -"initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:" -"`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:" -"`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, :c:func:" -"`Py_GetProgramName`, :c:func:`PyEval_InitThreads`, and :c:func:`Py_RunMain`." +"initialized: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome`, :c:func:`Py_GetProgramName`, :c:func:`PyEval_InitThreads`, " +"and :c:func:`Py_RunMain`." msgstr "" #: ../../c-api/init.rst:90 @@ -218,30 +216,30 @@ msgstr "" #: ../../c-api/init.rst:92 msgid "" "Python has variables for the global configuration to control different " -"features and options. By default, these flags are controlled by :ref:" -"`command line options <using-on-interface-options>`." +"features and options. By default, these flags are controlled " +"by :ref:`command line options <using-on-interface-options>`." msgstr "" #: ../../c-api/init.rst:96 msgid "" "When a flag is set by an option, the value of the flag is the number of " -"times that the option was set. For example, ``-b`` sets :c:data:" -"`Py_BytesWarningFlag` to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to " -"2." +"times that the option was set. For example, ``-b`` " +"sets :c:data:`Py_BytesWarningFlag` to 1 and ``-bb`` " +"sets :c:data:`Py_BytesWarningFlag` to 2." msgstr "" #: ../../c-api/init.rst:102 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"bytes_warning` should be used instead, see :ref:`Python Initialization " -"Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.bytes_warning` should be used instead, " +"see :ref:`Python Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:106 msgid "" -"Issue a warning when comparing :class:`bytes` or :class:`bytearray` with :" -"class:`str` or :class:`bytes` with :class:`int`. Issue an error if greater " -"or equal to ``2``." +"Issue a warning when comparing :class:`bytes` or :class:`bytearray` " +"with :class:`str` or :class:`bytes` with :class:`int`. Issue an error if " +"greater or equal to ``2``." msgstr "" #: ../../c-api/init.rst:110 @@ -250,9 +248,9 @@ msgstr "由 :option:`-b` 選項設定。" #: ../../c-api/init.rst:116 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"parser_debug` should be used instead, see :ref:`Python Initialization " -"Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.parser_debug` should be used instead, " +"see :ref:`Python Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:120 @@ -269,9 +267,9 @@ msgstr "由 :option:`-d` 選項與 :envvar:`PYTHONDEBUG` 環境變數設定。" #: ../../c-api/init.rst:130 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"write_bytecode` should be used instead, see :ref:`Python Initialization " -"Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.write_bytecode` should be used instead, " +"see :ref:`Python Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:134 @@ -289,15 +287,15 @@ msgstr "" #: ../../c-api/init.rst:144 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"pathconfig_warnings` should be used instead, see :ref:`Python Initialization " -"Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.pathconfig_warnings` should be used instead, " +"see :ref:`Python Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:148 msgid "" -"Suppress error messages when calculating the module search path in :c:func:" -"`Py_GetPath`." +"Suppress error messages when calculating the module search path " +"in :c:func:`Py_GetPath`." msgstr "" #: ../../c-api/init.rst:151 @@ -306,8 +304,9 @@ msgstr "" #: ../../c-api/init.rst:157 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"hash_seed` and :c:member:`PyConfig.use_hash_seed` should be used instead, " +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.hash_seed` " +"and :c:member:`PyConfig.use_hash_seed` should be used instead, " "see :ref:`Python Initialization Configuration <init-config>`." msgstr "" @@ -326,15 +325,15 @@ msgstr "" #: ../../c-api/init.rst:172 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"use_environment` should be used instead, see :ref:`Python Initialization " -"Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.use_environment` should be used instead, " +"see :ref:`Python Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:176 msgid "" -"Ignore all :envvar:`!PYTHON*` environment variables, e.g. :envvar:" -"`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." +"Ignore all :envvar:`!PYTHON*` environment variables, " +"e.g. :envvar:`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." msgstr "" "忽略所有可能被設定的 :envvar:`!PYTHON*` 環境變數,例如 :envvar:`PYTHONPATH` " "與 :envvar:`PYTHONHOME`。" @@ -345,9 +344,9 @@ msgstr "由 :option:`-E` 與 :option:`-I` 選項設定。" #: ../../c-api/init.rst:185 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"inspect` should be used instead, see :ref:`Python Initialization " -"Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.inspect` should be used instead, " +"see :ref:`Python Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:189 @@ -365,9 +364,9 @@ msgstr "由 :option:`-i` 選項與 :envvar:`PYTHONINSPECT` 環境變數設定。 #: ../../c-api/init.rst:200 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"interactive` should be used instead, see :ref:`Python Initialization " -"Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.interactive` should be used instead, " +"see :ref:`Python Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:204 @@ -376,9 +375,9 @@ msgstr "由 :option:`-i` 選項設定。" #: ../../c-api/init.rst:210 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"isolated` should be used instead, see :ref:`Python Initialization " -"Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.isolated` should be used instead, " +"see :ref:`Python Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:214 @@ -393,9 +392,9 @@ msgstr "由 :option:`-i` 選項設定。" #: ../../c-api/init.rst:225 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyPreConfig." -"legacy_windows_fs_encoding` should be used instead, see :ref:`Python " -"Initialization Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyPreConfig.legacy_windows_fs_encoding` should be used " +"instead, see :ref:`Python Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:229 @@ -423,15 +422,15 @@ msgstr "" #: ../../c-api/init.rst:244 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"legacy_windows_stdio` should be used instead, see :ref:`Python " -"Initialization Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.legacy_windows_stdio` should be used instead, " +"see :ref:`Python Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:248 msgid "" -"If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!io." -"_WindowsConsoleIO` for :mod:`sys` standard streams." +"If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!" +"io._WindowsConsoleIO` for :mod:`sys` standard streams." msgstr "" #: ../../c-api/init.rst:251 @@ -446,17 +445,17 @@ msgstr "更多詳情請見 :pep:`528`。" #: ../../c-api/init.rst:262 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"site_import` should be used instead, see :ref:`Python Initialization " -"Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.site_import` should be used instead, " +"see :ref:`Python Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:266 msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " -"manipulations if :mod:`site` is explicitly imported later (call :func:`site." -"main` if you want them to be triggered)." +"manipulations if :mod:`site` is explicitly imported later " +"(call :func:`site.main` if you want them to be triggered)." msgstr "" #: ../../c-api/init.rst:271 @@ -465,30 +464,30 @@ msgstr "由 :option:`-S` 選項設定。" #: ../../c-api/init.rst:277 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"user_site_directory` should be used instead, see :ref:`Python Initialization " -"Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.user_site_directory` should be used instead, " +"see :ref:`Python Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:281 msgid "" -"Don't add the :data:`user site-packages directory <site.USER_SITE>` to :data:" -"`sys.path`." +"Don't add the :data:`user site-packages directory <site.USER_SITE>` " +"to :data:`sys.path`." msgstr "" #: ../../c-api/init.rst:284 msgid "" -"Set by the :option:`-s` and :option:`-I` options, and the :envvar:" -"`PYTHONNOUSERSITE` environment variable." +"Set by the :option:`-s` and :option:`-I` options, and " +"the :envvar:`PYTHONNOUSERSITE` environment variable." msgstr "" "由 :option:`-s` 選項、:option:`-I` 選項與 :envvar:`PYTHONNOUSERSITE` 環境變數" "設定。" #: ../../c-api/init.rst:291 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"optimization_level` should be used instead, see :ref:`Python Initialization " -"Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.optimization_level` should be used instead, " +"see :ref:`Python Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:295 @@ -499,9 +498,9 @@ msgstr "由 :option:`-O` 選項與 :envvar:`PYTHONOPTIMIZE` 環境變數設定 #: ../../c-api/init.rst:302 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"quiet` should be used instead, see :ref:`Python Initialization Configuration " -"<init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.quiet` should be used instead, see :ref:`Python " +"Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:306 @@ -515,9 +514,9 @@ msgstr "由 :option:`-q` 選項設定。" #: ../../c-api/init.rst:316 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"buffered_stdio` should be used instead, see :ref:`Python Initialization " -"Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.buffered_stdio` should be used instead, " +"see :ref:`Python Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:320 @@ -532,9 +531,9 @@ msgstr "由 :option:`-u` 選項與 :envvar:`PYTHONUNBUFFERED` 環境變數設定 #: ../../c-api/init.rst:329 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"verbose` should be used instead, see :ref:`Python Initialization " -"Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.verbose` should be used instead, " +"see :ref:`Python Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:333 @@ -558,8 +557,9 @@ msgstr "" #: ../../c-api/init.rst:360 msgid "" "Initialize the Python interpreter. In an application embedding Python, " -"this should be called before using any other Python/C API functions; see :" -"ref:`Before Python Initialization <pre-init-safe>` for the few exceptions." +"this should be called before using any other Python/C API functions; " +"see :ref:`Before Python Initialization <pre-init-safe>` for the few " +"exceptions." msgstr "" #: ../../c-api/init.rst:364 @@ -622,19 +622,20 @@ msgstr "" #: ../../c-api/init.rst:417 msgid "" "Undo all initializations made by :c:func:`Py_Initialize` and subsequent use " -"of Python/C API functions, and destroy all sub-interpreters (see :c:func:" -"`Py_NewInterpreter` below) that were created and not yet destroyed since the " -"last call to :c:func:`Py_Initialize`. Ideally, this frees all memory " -"allocated by the Python interpreter. This is a no-op when called for a " -"second time (without calling :c:func:`Py_Initialize` again first)." +"of Python/C API functions, and destroy all sub-interpreters " +"(see :c:func:`Py_NewInterpreter` below) that were created and not yet " +"destroyed since the last call to :c:func:`Py_Initialize`. Ideally, this " +"frees all memory allocated by the Python interpreter. This is a no-op when " +"called for a second time (without calling :c:func:`Py_Initialize` again " +"first)." msgstr "" #: ../../c-api/init.rst:424 msgid "" "Since this is the reverse of :c:func:`Py_Initialize`, it should be called in " "the same thread with the same interpreter active. That means the main " -"thread and the main interpreter. This should never be called while :c:func:" -"`Py_RunMain` is running." +"thread and the main interpreter. This should never be called " +"while :c:func:`Py_RunMain` is running." msgstr "" #: ../../c-api/init.rst:429 @@ -671,11 +672,11 @@ msgstr "" #: ../../c-api/init.rst:452 msgid "" -"Raises an :ref:`auditing event <auditing>` ``cpython." -"_PySys_ClearAuditHooks`` with no arguments." +"Raises an :ref:`auditing event <auditing>` " +"``cpython._PySys_ClearAuditHooks`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 <auditing>` ``cpython." -"_PySys_ClearAuditHooks``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 <auditing>` " +"``cpython._PySys_ClearAuditHooks``。" #: ../../c-api/init.rst:459 msgid "" @@ -735,9 +736,9 @@ msgstr "" #: ../../c-api/init.rst:503 msgid "" -"In terms of the CPython runtime configuration APIs documented in the :ref:" -"`runtime configuration <init-config>` section (and without accounting for " -"error handling), ``Py_Main`` is approximately equivalent to::" +"In terms of the CPython runtime configuration APIs documented in " +"the :ref:`runtime configuration <init-config>` section (and without " +"accounting for error handling), ``Py_Main`` is approximately equivalent to::" msgstr "" #: ../../c-api/init.rst:507 @@ -754,14 +755,14 @@ msgstr "" #: ../../c-api/init.rst:515 msgid "" "In normal usage, an embedding application will call this function *instead* " -"of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` or :c:func:" -"`Py_InitializeFromConfig` directly, and all settings will be applied as " -"described elsewhere in this documentation. If this function is instead " -"called *after* a preceding runtime initialization API call, then exactly " -"which environmental and command line configuration settings will be updated " -"is version dependent (as it depends on which settings correctly support " -"being modified after they have already been set once when the runtime was " -"first initialized)." +"of calling :c:func:`Py_Initialize`, :c:func:`Py_InitializeEx` " +"or :c:func:`Py_InitializeFromConfig` directly, and all settings will be " +"applied as described elsewhere in this documentation. If this function is " +"instead called *after* a preceding runtime initialization API call, then " +"exactly which environmental and command line configuration settings will be " +"updated is version dependent (as it depends on which settings correctly " +"support being modified after they have already been set once when the " +"runtime was first initialized)." msgstr "" #: ../../c-api/init.rst:528 @@ -770,11 +771,11 @@ msgstr "" #: ../../c-api/init.rst:530 msgid "" -"Executes the command (:c:member:`PyConfig.run_command`), the script (:c:" -"member:`PyConfig.run_filename`) or the module (:c:member:`PyConfig." -"run_module`) specified on the command line or in the configuration. If none " -"of these values are set, runs the interactive Python prompt (REPL) using the " -"``__main__`` module's global namespace." +"Executes the command (:c:member:`PyConfig.run_command`), the script " +"(:c:member:`PyConfig.run_filename`) or the module " +"(:c:member:`PyConfig.run_module`) specified on the command line or in the " +"configuration. If none of these values are set, runs the interactive Python " +"prompt (REPL) using the ``__main__`` module's global namespace." msgstr "" #: ../../c-api/init.rst:536 @@ -802,15 +803,15 @@ msgstr "" #: ../../c-api/init.rst:552 msgid "" "This function always finalizes the Python interpreter regardless of whether " -"it returns a value or immediately exits the process due to an unhandled :exc:" -"`SystemExit` exception." +"it returns a value or immediately exits the process due to an " +"unhandled :exc:`SystemExit` exception." msgstr "" #: ../../c-api/init.rst:556 msgid "" "See :ref:`Python Configuration <init-python-config>` for an example of a " -"customized Python that always runs in isolated mode using :c:func:" -"`Py_RunMain`." +"customized Python that always runs in isolated mode " +"using :c:func:`Py_RunMain`." msgstr "" #: ../../c-api/init.rst:562 @@ -830,9 +831,9 @@ msgstr "" #: ../../c-api/init.rst:581 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"program_name` should be used instead, see :ref:`Python Initialization " -"Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.program_name` should be used instead, " +"see :ref:`Python Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:585 @@ -852,8 +853,8 @@ msgstr "" #: ../../c-api/init.rst:596 ../../c-api/init.rst:838 ../../c-api/init.rst:874 #: ../../c-api/init.rst:900 msgid "" -"Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" -"`wchar_*` string." +"Use :c:func:`Py_DecodeLocale` to decode a bytes string to get " +"a :c:expr:`wchar_*` string." msgstr "" #: ../../c-api/init.rst:604 @@ -906,11 +907,11 @@ msgid "" "with :c:member:`PyConfig.program_name` and some environment variables; for " "example, if the program name is ``'/usr/local/bin/python'``, the exec-prefix " "is ``'/usr/local'``. The returned string points into static storage; the " -"caller should not modify its value. This corresponds to the :makevar:" -"`exec_prefix` variable in the top-level :file:`Makefile` and the ``--exec-" -"prefix`` argument to the :program:`configure` script at build time. The " -"value is available to Python code as ``sys.base_exec_prefix``. It is only " -"useful on Unix." +"caller should not modify its value. This corresponds to " +"the :makevar:`exec_prefix` variable in the top-level :file:`Makefile` and " +"the ``--exec-prefix`` argument to the :program:`configure` script at build " +"time. The value is available to Python code as ``sys.base_exec_prefix``. " +"It is only useful on Unix." msgstr "" #: ../../c-api/init.rst:654 @@ -938,16 +939,16 @@ msgstr "" #: ../../c-api/init.rst:671 msgid "" -"System administrators will know how to configure the :program:`mount` or :" -"program:`automount` programs to share :file:`/usr/local` between platforms " -"while having :file:`/usr/local/plat` be a different filesystem for each " -"platform." +"System administrators will know how to configure the :program:`mount` " +"or :program:`automount` programs to share :file:`/usr/local` between " +"platforms while having :file:`/usr/local/plat` be a different filesystem for " +"each platform." msgstr "" #: ../../c-api/init.rst:682 msgid "" -"Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` if :ref:" -"`virtual environments <venv-def>` need to be handled." +"Get :data:`sys.base_exec_prefix` instead, or :data:`sys.exec_prefix` " +"if :ref:`virtual environments <venv-def>` need to be handled." msgstr "" #: ../../c-api/init.rst:692 @@ -991,8 +992,8 @@ msgid "" "The first word (up to the first space character) is the current Python " "version; the first characters are the major and minor version separated by a " "period. The returned string points into static storage; the caller should " -"not modify its value. The value is available to Python code as :data:`sys." -"version`." +"not modify its value. The value is available to Python code " +"as :data:`sys.version`." msgstr "" #: ../../c-api/init.rst:750 @@ -1055,10 +1056,10 @@ msgstr "\"#67, Aug 1 1997, 22:34:28\"" #: ../../c-api/init.rst:813 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` " -"should be used instead, see :ref:`Python Initialization Configuration <init-" -"config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.argv`, :c:member:`PyConfig.parse_argv` " +"and :c:member:`PyConfig.safe_path` should be used instead, see :ref:`Python " +"Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:818 @@ -1082,8 +1083,8 @@ msgstr "" #: ../../c-api/init.rst:830 msgid "" "If the name of an existing script is passed in ``argv[0]``, the absolute " -"path of the directory where the script is located is prepended to :data:`sys." -"path`." +"path of the directory where the script is located is prepended " +"to :data:`sys.path`." msgstr "" #: ../../c-api/init.rst:833 @@ -1109,8 +1110,8 @@ msgstr "" #: ../../c-api/init.rst:850 msgid "" "On versions before 3.1.3, you can achieve the same effect by manually " -"popping the first :data:`sys.path` element after having called :c:func:" -"`PySys_SetArgv`, for example using::" +"popping the first :data:`sys.path` element after having " +"called :c:func:`PySys_SetArgv`, for example using::" msgstr "" #: ../../c-api/init.rst:854 @@ -1119,16 +1120,17 @@ msgstr "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" #: ../../c-api/init.rst:866 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"argv` and :c:member:`PyConfig.parse_argv` should be used instead, see :ref:" -"`Python Initialization Configuration <init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` should " +"be used instead, see :ref:`Python Initialization Configuration <init-" +"config>`." msgstr "" #: ../../c-api/init.rst:870 msgid "" "This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to " -"``1`` unless the :program:`python` interpreter was started with the :option:" -"`-I`." +"``1`` unless the :program:`python` interpreter was started with " +"the :option:`-I`." msgstr "" #: ../../c-api/init.rst:880 @@ -1137,9 +1139,9 @@ msgstr "" #: ../../c-api/init.rst:887 msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"home` should be used instead, see :ref:`Python Initialization Configuration " -"<init-config>`." +"This API is kept for backward compatibility: " +"setting :c:member:`PyConfig.home` should be used instead, see :ref:`Python " +"Initialization Configuration <init-config>`." msgstr "" #: ../../c-api/init.rst:891 @@ -1159,9 +1161,9 @@ msgstr "" #: ../../c-api/init.rst:908 msgid "" -"Return the default \"home\", that is, the value set by :c:member:`PyConfig." -"home`, or the value of the :envvar:`PYTHONHOME` environment variable if it " -"is set." +"Return the default \"home\", that is, the value set " +"by :c:member:`PyConfig.home`, or the value of the :envvar:`PYTHONHOME` " +"environment variable if it is set." msgstr "" #: ../../c-api/init.rst:918 @@ -1188,12 +1190,13 @@ msgstr "" #: ../../c-api/init.rst:943 msgid "" -"Therefore, the rule exists that only the thread that has acquired the :term:" -"`GIL` may operate on Python objects or call Python/C API functions. In order " -"to emulate concurrency of execution, the interpreter regularly tries to " -"switch threads (see :func:`sys.setswitchinterval`). The lock is also " -"released around potentially blocking I/O operations like reading or writing " -"a file, so that other Python threads can run in the meantime." +"Therefore, the rule exists that only the thread that has acquired " +"the :term:`GIL` may operate on Python objects or call Python/C API " +"functions. In order to emulate concurrency of execution, the interpreter " +"regularly tries to switch threads (see :func:`sys.setswitchinterval`). The " +"lock is also released around potentially blocking I/O operations like " +"reading or writing a file, so that other Python threads can run in the " +"meantime." msgstr "" #: ../../c-api/init.rst:953 @@ -1281,10 +1284,10 @@ msgstr "" #: ../../c-api/init.rst:1018 msgid "" -"When threads are created using the dedicated Python APIs (such as the :mod:" -"`threading` module), a thread state is automatically associated to them and " -"the code showed above is therefore correct. However, when threads are " -"created from C (for example by a third-party library with its own thread " +"When threads are created using the dedicated Python APIs (such as " +"the :mod:`threading` module), a thread state is automatically associated to " +"them and the code showed above is therefore correct. However, when threads " +"are created from C (for example by a third-party library with its own thread " "management), they don't hold the GIL, nor is there a thread state structure " "for them." msgstr "" @@ -1324,9 +1327,9 @@ msgstr "" msgid "" "Note that the ``PyGILState_*`` functions assume there is only one global " "interpreter (created automatically by :c:func:`Py_Initialize`). Python " -"supports the creation of additional interpreters (using :c:func:" -"`Py_NewInterpreter`), but mixing multiple interpreters and the " -"``PyGILState_*`` API is unsupported." +"supports the creation of additional interpreters " +"(using :c:func:`Py_NewInterpreter`), but mixing multiple interpreters and " +"the ``PyGILState_*`` API is unsupported." msgstr "" #: ../../c-api/init.rst:1057 @@ -1352,11 +1355,11 @@ msgid "" "of additional (non-Python) locks that need to be acquired before or reset " "after a fork. OS facilities such as :c:func:`!pthread_atfork` would need to " "be used to accomplish the same thing. Additionally, when extending or " -"embedding Python, calling :c:func:`fork` directly rather than through :func:" -"`os.fork` (and returning to or calling into Python) may result in a deadlock " -"by one of Python's internal locks being held by a thread that is defunct " -"after the fork. :c:func:`PyOS_AfterFork_Child` tries to reset the necessary " -"locks, but is not always able to." +"embedding Python, calling :c:func:`fork` directly rather than " +"through :func:`os.fork` (and returning to or calling into Python) may result " +"in a deadlock by one of Python's internal locks being held by a thread that " +"is defunct after the fork. :c:func:`PyOS_AfterFork_Child` tries to reset the " +"necessary locks, but is not always able to." msgstr "" #: ../../c-api/init.rst:1080 @@ -1449,7 +1452,7 @@ msgid "" msgstr "" #: ../../c-api/init.rst:1164 ../../c-api/init.rst:1223 -#: ../../c-api/init.rst:1508 +#: ../../c-api/init.rst:1519 msgid "" "Calling this function from a thread when the runtime is finalizing will " "terminate the thread, even if the thread was not created by Python. You can " @@ -1501,21 +1504,21 @@ msgid "" "of the current state of Python, or of the global interpreter lock. This may " "be called as many times as desired by a thread as long as each call is " "matched with a call to :c:func:`PyGILState_Release`. In general, other " -"thread-related APIs may be used between :c:func:`PyGILState_Ensure` and :c:" -"func:`PyGILState_Release` calls as long as the thread state is restored to " -"its previous state before the Release(). For example, normal usage of the :" -"c:macro:`Py_BEGIN_ALLOW_THREADS` and :c:macro:`Py_END_ALLOW_THREADS` macros " -"is acceptable." +"thread-related APIs may be used between :c:func:`PyGILState_Ensure` " +"and :c:func:`PyGILState_Release` calls as long as the thread state is " +"restored to its previous state before the Release(). For example, normal " +"usage of the :c:macro:`Py_BEGIN_ALLOW_THREADS` " +"and :c:macro:`Py_END_ALLOW_THREADS` macros is acceptable." msgstr "" #: ../../c-api/init.rst:1212 msgid "" -"The return value is an opaque \"handle\" to the thread state when :c:func:" -"`PyGILState_Ensure` was called, and must be passed to :c:func:" -"`PyGILState_Release` to ensure Python is left in the same state. Even though " -"recursive calls are allowed, these handles *cannot* be shared - each unique " -"call to :c:func:`PyGILState_Ensure` must save the handle for its call to :c:" -"func:`PyGILState_Release`." +"The return value is an opaque \"handle\" to the thread state " +"when :c:func:`PyGILState_Ensure` was called, and must be passed " +"to :c:func:`PyGILState_Release` to ensure Python is left in the same state. " +"Even though recursive calls are allowed, these handles *cannot* be shared - " +"each unique call to :c:func:`PyGILState_Ensure` must save the handle for its " +"call to :c:func:`PyGILState_Release`." msgstr "" #: ../../c-api/init.rst:1219 @@ -1527,15 +1530,15 @@ msgstr "" #: ../../c-api/init.rst:1231 msgid "" "Release any resources previously acquired. After this call, Python's state " -"will be the same as it was prior to the corresponding :c:func:" -"`PyGILState_Ensure` call (but generally this state will be unknown to the " -"caller, hence the use of the GILState API)." +"will be the same as it was prior to the " +"corresponding :c:func:`PyGILState_Ensure` call (but generally this state " +"will be unknown to the caller, hence the use of the GILState API)." msgstr "" #: ../../c-api/init.rst:1236 msgid "" -"Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:" -"func:`PyGILState_Release` on the same thread." +"Every call to :c:func:`PyGILState_Ensure` must be matched by a call " +"to :c:func:`PyGILState_Release` on the same thread." msgstr "" #: ../../c-api/init.rst:1242 @@ -1565,30 +1568,30 @@ msgstr "" #: ../../c-api/init.rst:1268 msgid "" -"This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" -"``. Note that it contains an opening brace; it must be matched with a " -"following :c:macro:`Py_END_ALLOW_THREADS` macro. See above for further " -"discussion of this macro." +"This macro expands to ``{ PyThreadState *_save; _save = " +"PyEval_SaveThread();``. Note that it contains an opening brace; it must be " +"matched with a following :c:macro:`Py_END_ALLOW_THREADS` macro. See above " +"for further discussion of this macro." msgstr "" #: ../../c-api/init.rst:1276 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " -"contains a closing brace; it must be matched with an earlier :c:macro:" -"`Py_BEGIN_ALLOW_THREADS` macro. See above for further discussion of this " -"macro." +"contains a closing brace; it must be matched with an " +"earlier :c:macro:`Py_BEGIN_ALLOW_THREADS` macro. See above for further " +"discussion of this macro." msgstr "" #: ../../c-api/init.rst:1284 msgid "" -"This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :" -"c:macro:`Py_END_ALLOW_THREADS` without the closing brace." +"This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent " +"to :c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" #: ../../c-api/init.rst:1290 msgid "" -"This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :" -"c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " +"This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent " +"to :c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " "declaration." msgstr "" @@ -1614,11 +1617,11 @@ msgstr "" #: ../../c-api/init.rst:1310 msgid "" -"Raises an :ref:`auditing event <auditing>` ``cpython." -"PyInterpreterState_New`` with no arguments." +"Raises an :ref:`auditing event <auditing>` " +"``cpython.PyInterpreterState_New`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 <auditing>` ``cpython." -"PyInterpreterState_New``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 <auditing>` " +"``cpython.PyInterpreterState_New``。" #: ../../c-api/init.rst:1315 msgid "" @@ -1628,11 +1631,11 @@ msgstr "" #: ../../c-api/init.rst:1318 msgid "" -"Raises an :ref:`auditing event <auditing>` ``cpython." -"PyInterpreterState_Clear`` with no arguments." +"Raises an :ref:`auditing event <auditing>` " +"``cpython.PyInterpreterState_Clear`` with no arguments." msgstr "" -"引發一個不附帶引數的\\ :ref:`稽核事件 <auditing>` ``cpython." -"PyInterpreterState_Clear``。" +"引發一個不附帶引數的\\ :ref:`稽核事件 <auditing>` " +"``cpython.PyInterpreterState_Clear``。" #: ../../c-api/init.rst:1323 msgid "" @@ -1667,16 +1670,16 @@ msgstr ":c:member:`PyThreadState.on_delete` 回呼已被移除。" #: ../../c-api/init.rst:1350 msgid "" "Destroy a thread state object. The global interpreter lock need not be " -"held. The thread state must have been reset with a previous call to :c:func:" -"`PyThreadState_Clear`." +"held. The thread state must have been reset with a previous call " +"to :c:func:`PyThreadState_Clear`." msgstr "" #: ../../c-api/init.rst:1357 msgid "" "Destroy the current thread state and release the global interpreter lock. " "Like :c:func:`PyThreadState_Delete`, the global interpreter lock must be " -"held. The thread state must have been reset with a previous call to :c:func:" -"`PyThreadState_Clear`." +"held. The thread state must have been reset with a previous call " +"to :c:func:`PyThreadState_Clear`." msgstr "" #: ../../c-api/init.rst:1365 @@ -1737,6 +1740,7 @@ msgid "" msgstr "" #: ../../c-api/init.rst:1422 ../../c-api/init.rst:1432 +#: ../../c-api/init.rst:1454 msgid "The caller must hold the GIL." msgstr "" @@ -1759,39 +1763,45 @@ msgid "" "extensions should use to store interpreter-specific state information." msgstr "" -#: ../../c-api/init.rst:1450 +#: ../../c-api/init.rst:1451 +msgid "" +"Return a :term:`strong reference` to the ``__main__`` :ref:`module object " +"<moduleobjects>` for the given interpreter." +msgstr "" + +#: ../../c-api/init.rst:1461 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1452 +#: ../../c-api/init.rst:1463 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1455 +#: ../../c-api/init.rst:1466 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1458 +#: ../../c-api/init.rst:1469 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: ../../c-api/init.rst:1463 +#: ../../c-api/init.rst:1474 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1465 ../../c-api/init.rst:1473 +#: ../../c-api/init.rst:1476 ../../c-api/init.rst:1484 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1471 +#: ../../c-api/init.rst:1482 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1480 +#: ../../c-api/init.rst:1491 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " @@ -1800,7 +1810,7 @@ msgid "" "raised and the caller should assume no current thread state is available." msgstr "" -#: ../../c-api/init.rst:1489 +#: ../../c-api/init.rst:1500 msgid "" "Asynchronously raise an exception in a thread. The *id* argument is the " "thread id of the target thread; *exc* is the exception object to be raised. " @@ -1812,33 +1822,34 @@ msgid "" "raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1497 +#: ../../c-api/init.rst:1508 msgid "" -"The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" -"`unsigned long`." +"The type of the *id* parameter changed from :c:expr:`long` " +"to :c:expr:`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1503 +#: ../../c-api/init.rst:1514 msgid "" "Acquire the global interpreter lock and set the current thread state to " "*tstate*, which must not be ``NULL``. The lock must have been created " "earlier. If this thread already has the lock, deadlock ensues." msgstr "" -#: ../../c-api/init.rst:1514 +#: ../../c-api/init.rst:1525 msgid "" -"Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" -"`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " -"current thread if called while the interpreter is finalizing." +"Updated to be consistent " +"with :c:func:`PyEval_RestoreThread`, :c:func:`Py_END_ALLOW_THREADS`, " +"and :c:func:`PyGILState_Ensure`, and terminate the current thread if called " +"while the interpreter is finalizing." msgstr "" -#: ../../c-api/init.rst:1519 +#: ../../c-api/init.rst:1530 msgid "" ":c:func:`PyEval_RestoreThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1525 +#: ../../c-api/init.rst:1536 msgid "" "Reset the current thread state to ``NULL`` and release the global " "interpreter lock. The lock must have been created earlier and must be held " @@ -1847,17 +1858,17 @@ msgid "" "isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1531 +#: ../../c-api/init.rst:1542 msgid "" ":c:func:`PyEval_SaveThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1538 +#: ../../c-api/init.rst:1549 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1540 +#: ../../c-api/init.rst:1551 msgid "" "While in most uses, you will only embed a single Python interpreter, there " "are cases where you need to create several independent interpreters in the " @@ -1865,7 +1876,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1545 +#: ../../c-api/init.rst:1556 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -1876,134 +1887,134 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1552 +#: ../../c-api/init.rst:1563 msgid "" -"You can switch between sub-interpreters using the :c:func:" -"`PyThreadState_Swap` function. You can create and destroy them using the " -"following functions:" +"You can switch between sub-interpreters using " +"the :c:func:`PyThreadState_Swap` function. You can create and destroy them " +"using the following functions:" msgstr "" -#: ../../c-api/init.rst:1558 +#: ../../c-api/init.rst:1569 msgid "" "Structure containing most parameters to configure a sub-interpreter. Its " "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " "modified by the runtime." msgstr "" -#: ../../c-api/init.rst:1564 +#: ../../c-api/init.rst:1575 msgid "Structure fields:" msgstr "" -#: ../../c-api/init.rst:1568 +#: ../../c-api/init.rst:1579 msgid "" "If this is ``0`` then the sub-interpreter will use its own \"object\" " "allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" -#: ../../c-api/init.rst:1572 +#: ../../c-api/init.rst:1583 msgid "" -"If this is ``0`` then :c:member:`~PyInterpreterConfig." -"check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " -"then :c:member:`~PyInterpreterConfig.gil` must not be :c:macro:" -"`PyInterpreterConfig_OWN_GIL`." +"If this is ``0`` " +"then :c:member:`~PyInterpreterConfig.check_multi_interp_extensions` must be " +"``1`` (non-zero). If this is ``1`` then :c:member:`~PyInterpreterConfig.gil` " +"must not be :c:macro:`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: ../../c-api/init.rst:1580 +#: ../../c-api/init.rst:1591 msgid "" "If this is ``0`` then the runtime will not support forking the process in " "any thread where the sub-interpreter is currently active. Otherwise fork is " "unrestricted." msgstr "" -#: ../../c-api/init.rst:1584 +#: ../../c-api/init.rst:1595 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: ../../c-api/init.rst:1589 +#: ../../c-api/init.rst:1600 msgid "" "If this is ``0`` then the runtime will not support replacing the current " "process via exec (e.g. :func:`os.execv`) in any thread where the sub-" "interpreter is currently active. Otherwise exec is unrestricted." msgstr "" -#: ../../c-api/init.rst:1594 +#: ../../c-api/init.rst:1605 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: ../../c-api/init.rst:1599 +#: ../../c-api/init.rst:1610 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create threads. Otherwise threads are allowed." msgstr "" -#: ../../c-api/init.rst:1605 +#: ../../c-api/init.rst:1616 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " -"create daemon threads. Otherwise daemon threads are allowed (as long as :c:" -"member:`~PyInterpreterConfig.allow_threads` is non-zero)." +"create daemon threads. Otherwise daemon threads are allowed (as long " +"as :c:member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" -#: ../../c-api/init.rst:1612 +#: ../../c-api/init.rst:1623 msgid "" "If this is ``0`` then all extension modules may be imported, including " "legacy (single-phase init) modules, in any thread where the sub-interpreter " -"is currently active. Otherwise only multi-phase init extension modules (see :" -"pep:`489`) may be imported. (Also see :c:macro:" -"`Py_mod_multiple_interpreters`.)" +"is currently active. Otherwise only multi-phase init extension modules " +"(see :pep:`489`) may be imported. (Also " +"see :c:macro:`Py_mod_multiple_interpreters`.)" msgstr "" -#: ../../c-api/init.rst:1619 +#: ../../c-api/init.rst:1630 msgid "" -"This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." -"use_main_obmalloc` is ``0``." +"This must be ``1`` (non-zero) " +"if :c:member:`~PyInterpreterConfig.use_main_obmalloc` is ``0``." msgstr "" -#: ../../c-api/init.rst:1624 +#: ../../c-api/init.rst:1635 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: ../../c-api/init.rst:1631 +#: ../../c-api/init.rst:1642 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: ../../c-api/init.rst:1635 +#: ../../c-api/init.rst:1646 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: ../../c-api/init.rst:1639 +#: ../../c-api/init.rst:1650 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: ../../c-api/init.rst:1641 +#: ../../c-api/init.rst:1652 msgid "" -"If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" -"`PyInterpreterConfig.use_main_obmalloc` must be ``0``." +"If this is :c:macro:`PyInterpreterConfig_OWN_GIL` " +"then :c:member:`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: ../../c-api/init.rst:1655 +#: ../../c-api/init.rst:1666 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " "interpreter has separate, independent versions of all imported modules, " -"including the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:" -"`sys`. The table of loaded modules (``sys.modules``) and the module search " -"path (``sys.path``) are also separate. The new environment has no ``sys." -"argv`` variable. It has new standard I/O stream file objects ``sys.stdin``, " -"``sys.stdout`` and ``sys.stderr`` (however these refer to the same " -"underlying file descriptors)." +"including the fundamental modules :mod:`builtins`, :mod:`__main__` " +"and :mod:`sys`. The table of loaded modules (``sys.modules``) and the " +"module search path (``sys.path``) are also separate. The new environment " +"has no ``sys.argv`` variable. It has new standard I/O stream file objects " +"``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` (however these refer to the " +"same underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1665 +#: ../../c-api/init.rst:1676 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: ../../c-api/init.rst:1668 +#: ../../c-api/init.rst:1679 msgid "" "Upon success, *tstate_p* will be set to the first thread state created in " "the new sub-interpreter. This thread state is made in the current thread " @@ -2014,7 +2025,7 @@ msgid "" "state." msgstr "" -#: ../../c-api/init.rst:1677 +#: ../../c-api/init.rst:1688 msgid "" "Like all other Python/C API functions, the global interpreter lock must be " "held before calling this function and is still held when it returns. " @@ -2026,13 +2037,13 @@ msgid "" "released here." msgstr "" -#: ../../c-api/init.rst:1688 +#: ../../c-api/init.rst:1699 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: ../../c-api/init.rst:1691 +#: ../../c-api/init.rst:1702 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -2064,58 +2075,59 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init.rst:1706 +#: ../../c-api/init.rst:1717 msgid "" "Note that the config is used only briefly and does not get modified. During " -"initialization the config's values are converted into various :c:type:" -"`PyInterpreterState` values. A read-only copy of the config may be stored " -"internally on the :c:type:`PyInterpreterState`." +"initialization the config's values are converted into " +"various :c:type:`PyInterpreterState` values. A read-only copy of the config " +"may be stored internally on the :c:type:`PyInterpreterState`." msgstr "" -#: ../../c-api/init.rst:1715 +#: ../../c-api/init.rst:1726 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1717 +#: ../../c-api/init.rst:1728 msgid "" -"For modules using multi-phase initialization, e.g. :c:func:" -"`PyModule_FromDefAndSpec`, a separate module object is created and " -"initialized for each interpreter. Only C-level static and global variables " -"are shared between these module objects." +"For modules using multi-phase initialization, " +"e.g. :c:func:`PyModule_FromDefAndSpec`, a separate module object is created " +"and initialized for each interpreter. Only C-level static and global " +"variables are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1723 +#: ../../c-api/init.rst:1734 msgid "" -"For modules using single-phase initialization, e.g. :c:func:" -"`PyModule_Create`, the first time a particular extension is imported, it is " -"initialized normally, and a (shallow) copy of its module's dictionary is " -"squirreled away. When the same extension is imported by another " -"(sub-)interpreter, a new module is initialized and filled with the contents " -"of this copy; the extension's ``init`` function is not called. Objects in " -"the module's dictionary thus end up shared across (sub-)interpreters, which " -"might cause unwanted behavior (see `Bugs and caveats`_ below)." +"For modules using single-phase initialization, " +"e.g. :c:func:`PyModule_Create`, the first time a particular extension is " +"imported, it is initialized normally, and a (shallow) copy of its module's " +"dictionary is squirreled away. When the same extension is imported by " +"another (sub-)interpreter, a new module is initialized and filled with the " +"contents of this copy; the extension's ``init`` function is not called. " +"Objects in the module's dictionary thus end up shared across " +"(sub-)interpreters, which might cause unwanted behavior (see `Bugs and " +"caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1734 +#: ../../c-api/init.rst:1745 msgid "" "Note that this is different from what happens when an extension is imported " -"after the interpreter has been completely re-initialized by calling :c:func:" -"`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that case, the extension's " -"``initmodule`` function *is* called again. As with multi-phase " -"initialization, this means that only C-level static and global variables are " -"shared between these modules." +"after the interpreter has been completely re-initialized by " +"calling :c:func:`Py_FinalizeEx` and :c:func:`Py_Initialize`; in that case, " +"the extension's ``initmodule`` function *is* called again. As with multi-" +"phase initialization, this means that only C-level static and global " +"variables are shared between these modules." msgstr "" -#: ../../c-api/init.rst:1754 +#: ../../c-api/init.rst:1765 msgid "" -"Create a new sub-interpreter. This is essentially just a wrapper around :c:" -"func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " -"behavior. The result is an unisolated sub-interpreter that shares the main " -"interpreter's GIL, allows fork/exec, allows daemon threads, and allows " -"single-phase init modules." +"Create a new sub-interpreter. This is essentially just a wrapper " +"around :c:func:`Py_NewInterpreterFromConfig` with a config that preserves " +"the existing behavior. The result is an unisolated sub-interpreter that " +"shares the main interpreter's GIL, allows fork/exec, allows daemon threads, " +"and allows single-phase init modules." msgstr "" -#: ../../c-api/init.rst:1766 +#: ../../c-api/init.rst:1777 msgid "" "Destroy the (sub-)interpreter represented by the given thread state. The " "given thread state must be the current thread state. See the discussion of " @@ -2125,17 +2137,17 @@ msgid "" "be held before calling this function. No GIL is held when it returns." msgstr "" -#: ../../c-api/init.rst:1774 +#: ../../c-api/init.rst:1785 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: ../../c-api/init.rst:1779 +#: ../../c-api/init.rst:1790 msgid "A Per-Interpreter GIL" msgstr "" -#: ../../c-api/init.rst:1781 +#: ../../c-api/init.rst:1792 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -2147,7 +2159,7 @@ msgid "" "just using threads. (See :pep:`554`.)" msgstr "" -#: ../../c-api/init.rst:1791 +#: ../../c-api/init.rst:1802 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -2161,7 +2173,7 @@ msgid "" "builtin objects." msgstr "" -#: ../../c-api/init.rst:1802 +#: ../../c-api/init.rst:1813 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -2169,7 +2181,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: ../../c-api/init.rst:1807 +#: ../../c-api/init.rst:1818 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -2179,11 +2191,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: ../../c-api/init.rst:1818 +#: ../../c-api/init.rst:1829 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1820 +#: ../../c-api/init.rst:1831 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -2196,7 +2208,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1830 +#: ../../c-api/init.rst:1841 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -2205,37 +2217,37 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1836 +#: ../../c-api/init.rst:1847 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " "and OS-level threads, an assumption broken by the presence of sub-" "interpreters. It is highly recommended that you don't switch sub-" -"interpreters between a pair of matching :c:func:`PyGILState_Ensure` and :c:" -"func:`PyGILState_Release` calls. Furthermore, extensions (such as :mod:" -"`ctypes`) using these APIs to allow calling of Python code from non-Python " -"created threads will probably be broken when using sub-interpreters." +"interpreters between a pair of matching :c:func:`PyGILState_Ensure` " +"and :c:func:`PyGILState_Release` calls. Furthermore, extensions (such " +"as :mod:`ctypes`) using these APIs to allow calling of Python code from non-" +"Python created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1847 +#: ../../c-api/init.rst:1858 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1849 +#: ../../c-api/init.rst:1860 msgid "" "A mechanism is provided to make asynchronous notifications to the main " "interpreter thread. These notifications take the form of a function pointer " "and a void pointer argument." msgstr "" -#: ../../c-api/init.rst:1856 +#: ../../c-api/init.rst:1867 msgid "" "Schedule a function to be called from the main interpreter thread. On " "success, ``0`` is returned and *func* is queued for being called in the main " "thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -#: ../../c-api/init.rst:1860 +#: ../../c-api/init.rst:1871 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2243,17 +2255,17 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1865 +#: ../../c-api/init.rst:1876 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1866 +#: ../../c-api/init.rst:1877 msgid "" "with the main thread holding the :term:`global interpreter lock` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1869 +#: ../../c-api/init.rst:1880 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " @@ -2261,30 +2273,30 @@ msgid "" "if the global interpreter lock is released." msgstr "" -#: ../../c-api/init.rst:1874 +#: ../../c-api/init.rst:1885 msgid "" "This function doesn't need a current thread state to run, and it doesn't " "need the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:1877 +#: ../../c-api/init.rst:1888 msgid "" "To call this function in a subinterpreter, the caller must hold the GIL. " "Otherwise, the function *func* can be scheduled to be called from the wrong " "interpreter." msgstr "" -#: ../../c-api/init.rst:1882 +#: ../../c-api/init.rst:1893 msgid "" "This is a low-level function, only useful for very special cases. There is " "no guarantee that *func* will be called as quick as possible. If the main " "thread is busy executing a system call, *func* won't be called before the " "system call returns. This function is generally **not** suitable for " -"calling Python code from arbitrary C threads. Instead, use the :ref:" -"`PyGILState API<gilstate>`." +"calling Python code from arbitrary C threads. Instead, use " +"the :ref:`PyGILState API<gilstate>`." msgstr "" -#: ../../c-api/init.rst:1891 +#: ../../c-api/init.rst:1902 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " @@ -2292,18 +2304,18 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:1900 +#: ../../c-api/init.rst:1911 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:1905 +#: ../../c-api/init.rst:1916 msgid "" "The Python interpreter provides some low-level support for attaching " "profiling and execution tracing facilities. These are used for profiling, " "debugging, and coverage analysis tools." msgstr "" -#: ../../c-api/init.rst:1909 +#: ../../c-api/init.rst:1920 msgid "" "This C interface allows the profiling or tracing code to avoid the overhead " "of calling through Python-level callable objects, making a direct C function " @@ -2313,78 +2325,76 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:1919 +#: ../../c-api/init.rst:1930 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " "the registration function as *obj*, *frame* is the frame object to which the " -"event pertains, *what* is one of the constants :c:data:`PyTrace_CALL`, :c:" -"data:`PyTrace_EXCEPTION`, :c:data:`PyTrace_LINE`, :c:data:`PyTrace_RETURN`, :" -"c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION`, :c:data:" -"`PyTrace_C_RETURN`, or :c:data:`PyTrace_OPCODE`, and *arg* depends on the " -"value of *what*:" +"event pertains, *what* is one of the " +"constants :c:data:`PyTrace_CALL`, :c:data:`PyTrace_EXCEPTION`, :c:data:`PyTrace_LINE`, :c:data:`PyTrace_RETURN`, :c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION`, :c:data:`PyTrace_C_RETURN`, " +"or :c:data:`PyTrace_OPCODE`, and *arg* depends on the value of *what*:" msgstr "" -#: ../../c-api/init.rst:1928 +#: ../../c-api/init.rst:1939 msgid "Value of *what*" msgstr "" -#: ../../c-api/init.rst:1928 +#: ../../c-api/init.rst:1939 msgid "Meaning of *arg*" msgstr "*arg* 的含義" -#: ../../c-api/init.rst:1930 +#: ../../c-api/init.rst:1941 msgid ":c:data:`PyTrace_CALL`" msgstr ":c:data:`PyTrace_CALL`" -#: ../../c-api/init.rst:1930 ../../c-api/init.rst:1935 -#: ../../c-api/init.rst:1946 +#: ../../c-api/init.rst:1941 ../../c-api/init.rst:1946 +#: ../../c-api/init.rst:1957 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:1932 +#: ../../c-api/init.rst:1943 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr ":c:data:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:1932 +#: ../../c-api/init.rst:1943 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:1935 +#: ../../c-api/init.rst:1946 msgid ":c:data:`PyTrace_LINE`" msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:1937 +#: ../../c-api/init.rst:1948 msgid ":c:data:`PyTrace_RETURN`" msgstr ":c:data:`PyTrace_RETURN`" -#: ../../c-api/init.rst:1937 +#: ../../c-api/init.rst:1948 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:1940 +#: ../../c-api/init.rst:1951 msgid ":c:data:`PyTrace_C_CALL`" msgstr ":c:data:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:1940 ../../c-api/init.rst:1942 -#: ../../c-api/init.rst:1944 +#: ../../c-api/init.rst:1951 ../../c-api/init.rst:1953 +#: ../../c-api/init.rst:1955 msgid "Function object being called." msgstr "被呼叫的函式物件。" -#: ../../c-api/init.rst:1942 +#: ../../c-api/init.rst:1953 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:1944 +#: ../../c-api/init.rst:1955 msgid ":c:data:`PyTrace_C_RETURN`" msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:1946 +#: ../../c-api/init.rst:1957 msgid ":c:data:`PyTrace_OPCODE`" msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:1951 +#: ../../c-api/init.rst:1962 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -2393,7 +2403,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:1960 +#: ../../c-api/init.rst:1971 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "an exception has been raised. The callback function is called with this " @@ -2405,133 +2415,134 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:1971 +#: ../../c-api/init.rst:1982 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " -"reported. It may be disabled for a frame by setting :attr:`~frame." -"f_trace_lines` to *0* on that frame." +"reported. It may be disabled for a frame by " +"setting :attr:`~frame.f_trace_lines` to *0* on that frame." msgstr "" -#: ../../c-api/init.rst:1979 +#: ../../c-api/init.rst:1990 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a call is about to return." msgstr "" -#: ../../c-api/init.rst:1985 +#: ../../c-api/init.rst:1996 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function is about to be called." msgstr "" -#: ../../c-api/init.rst:1991 +#: ../../c-api/init.rst:2002 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has raised an exception." msgstr "" -#: ../../c-api/init.rst:1997 +#: ../../c-api/init.rst:2008 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:2003 +#: ../../c-api/init.rst:2014 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " -"event is not emitted by default: it must be explicitly requested by setting :" -"attr:`~frame.f_trace_opcodes` to *1* on the frame." +"event is not emitted by default: it must be explicitly requested by " +"setting :attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:2011 +#: ../../c-api/init.rst:2022 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " "If the profile function needs to maintain state, using a different value for " "*obj* for each thread provides a convenient and thread-safe place to store " -"it. The profile function is called for all monitored events except :c:data:" -"`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." +"it. The profile function is called for all monitored events " +"except :c:data:`PyTrace_LINE` :c:data:`PyTrace_OPCODE` " +"and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:2018 +#: ../../c-api/init.rst:2029 msgid "See also the :func:`sys.setprofile` function." msgstr "" -#: ../../c-api/init.rst:2020 ../../c-api/init.rst:2027 -#: ../../c-api/init.rst:2046 ../../c-api/init.rst:2053 +#: ../../c-api/init.rst:2031 ../../c-api/init.rst:2038 +#: ../../c-api/init.rst:2057 ../../c-api/init.rst:2064 msgid "The caller must hold the :term:`GIL`." msgstr "呼叫者必須持有 :term:`GIL`。" -#: ../../c-api/init.rst:2024 +#: ../../c-api/init.rst:2035 msgid "" "Like :c:func:`PyEval_SetProfile` but sets the profile function in all " "running threads belonging to the current interpreter instead of the setting " "it only on the current thread." msgstr "" -#: ../../c-api/init.rst:2029 +#: ../../c-api/init.rst:2040 msgid "" "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " "while setting the profile functions in all threads." msgstr "" -#: ../../c-api/init.rst:2037 +#: ../../c-api/init.rst:2048 msgid "" -"Set the tracing function to *func*. This is similar to :c:func:" -"`PyEval_SetProfile`, except the tracing function does receive line-number " -"events and per-opcode events, but does not receive any event related to C " -"function objects being called. Any trace function registered using :c:func:" -"`PyEval_SetTrace` will not receive :c:data:`PyTrace_C_CALL`, :c:data:" -"`PyTrace_C_EXCEPTION` or :c:data:`PyTrace_C_RETURN` as a value for the " -"*what* parameter." +"Set the tracing function to *func*. This is similar " +"to :c:func:`PyEval_SetProfile`, except the tracing function does receive " +"line-number events and per-opcode events, but does not receive any event " +"related to C function objects being called. Any trace function registered " +"using :c:func:`PyEval_SetTrace` will not " +"receive :c:data:`PyTrace_C_CALL`, :c:data:`PyTrace_C_EXCEPTION` " +"or :c:data:`PyTrace_C_RETURN` as a value for the *what* parameter." msgstr "" -#: ../../c-api/init.rst:2044 +#: ../../c-api/init.rst:2055 msgid "See also the :func:`sys.settrace` function." msgstr "也請見 :func:`sys.settrace` 函式。" -#: ../../c-api/init.rst:2050 +#: ../../c-api/init.rst:2061 msgid "" "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " "threads belonging to the current interpreter instead of the setting it only " "on the current thread." msgstr "" -#: ../../c-api/init.rst:2055 +#: ../../c-api/init.rst:2066 msgid "" "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " "while setting the trace functions in all threads." msgstr "" -#: ../../c-api/init.rst:2061 +#: ../../c-api/init.rst:2072 msgid "Reference tracing" msgstr "" -#: ../../c-api/init.rst:2067 +#: ../../c-api/init.rst:2078 msgid "" -"The type of the trace function registered using :c:func:" -"`PyRefTracer_SetTracer`. The first parameter is a Python object that has " -"been just created (when **event** is set to :c:data:`PyRefTracer_CREATE`) or " -"about to be destroyed (when **event** is set to :c:data:" -"`PyRefTracer_DESTROY`). The **data** argument is the opaque pointer that was " -"provided when :c:func:`PyRefTracer_SetTracer` was called." +"The type of the trace function registered " +"using :c:func:`PyRefTracer_SetTracer`. The first parameter is a Python " +"object that has been just created (when **event** is set " +"to :c:data:`PyRefTracer_CREATE`) or about to be destroyed (when **event** is " +"set to :c:data:`PyRefTracer_DESTROY`). The **data** argument is the opaque " +"pointer that was provided when :c:func:`PyRefTracer_SetTracer` was called." msgstr "" -#: ../../c-api/init.rst:2077 +#: ../../c-api/init.rst:2088 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been created." msgstr "" -#: ../../c-api/init.rst:2082 +#: ../../c-api/init.rst:2093 msgid "" "The value for the *event* parameter to :c:type:`PyRefTracer` functions when " "a Python object has been destroyed." msgstr "" -#: ../../c-api/init.rst:2087 +#: ../../c-api/init.rst:2098 msgid "" "Register a reference tracer function. The function will be called when a new " "Python has been created or when an object is going to be destroyed. If " @@ -2540,7 +2551,7 @@ msgid "" "return ``-1`` on error." msgstr "" -#: ../../c-api/init.rst:2093 +#: ../../c-api/init.rst:2104 msgid "" "Not that tracer functions **must not** create Python objects inside or " "otherwise the call will be re-entrant. The tracer also **must not** clear " @@ -2548,11 +2559,11 @@ msgid "" "the tracer function is called." msgstr "" -#: ../../c-api/init.rst:2098 ../../c-api/init.rst:2109 +#: ../../c-api/init.rst:2109 ../../c-api/init.rst:2120 msgid "The GIL must be held when calling this function." msgstr "" -#: ../../c-api/init.rst:2104 +#: ../../c-api/init.rst:2115 msgid "" "Get the registered reference tracer function and the value of the opaque " "data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " @@ -2560,48 +2571,48 @@ msgid "" "set the **data** pointer to NULL." msgstr "" -#: ../../c-api/init.rst:2116 +#: ../../c-api/init.rst:2127 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:2121 +#: ../../c-api/init.rst:2132 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:2126 +#: ../../c-api/init.rst:2137 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:2131 +#: ../../c-api/init.rst:2142 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:2136 +#: ../../c-api/init.rst:2147 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:2142 +#: ../../c-api/init.rst:2153 msgid "" "Return the pointer to the first :c:type:`PyThreadState` object in the list " "of threads associated with the interpreter *interp*." msgstr "" -#: ../../c-api/init.rst:2148 +#: ../../c-api/init.rst:2159 msgid "" "Return the next thread state object after *tstate* from the list of all such " "objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" -#: ../../c-api/init.rst:2155 +#: ../../c-api/init.rst:2166 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:2159 +#: ../../c-api/init.rst:2170 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2611,42 +2622,42 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:2166 +#: ../../c-api/init.rst:2177 msgid "" "The GIL does *not* need to be held when calling these functions; they supply " "their own locking." msgstr "" -#: ../../c-api/init.rst:2169 +#: ../../c-api/init.rst:2180 msgid "" "Note that :file:`Python.h` does not include the declaration of the TLS APIs, " "you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -#: ../../c-api/init.rst:2173 +#: ../../c-api/init.rst:2184 msgid "" -"None of these API functions handle memory management on behalf of the :c:" -"expr:`void*` values. You need to allocate and deallocate them yourself. If " -"the :c:expr:`void*` values happen to be :c:expr:`PyObject*`, these functions " -"don't do refcount operations on them either." +"None of these API functions handle memory management on behalf of " +"the :c:expr:`void*` values. You need to allocate and deallocate them " +"yourself. If the :c:expr:`void*` values happen to be :c:expr:`PyObject*`, " +"these functions don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:2181 +#: ../../c-api/init.rst:2192 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:2183 +#: ../../c-api/init.rst:2194 msgid "" "TSS API is introduced to supersede the use of the existing TLS API within " "the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` " "instead of :c:expr:`int` to represent thread keys." msgstr "" -#: ../../c-api/init.rst:2189 +#: ../../c-api/init.rst:2200 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:2194 +#: ../../c-api/init.rst:2205 msgid "" "This data structure represents the state of a thread key, the definition of " "which may depend on the underlying TLS implementation, and it has an " @@ -2654,66 +2665,67 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:2199 +#: ../../c-api/init.rst:2210 msgid "" "When :ref:`Py_LIMITED_API <stable>` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -#: ../../c-api/init.rst:2205 +#: ../../c-api/init.rst:2216 msgid "" "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " "that this macro won't be defined with :ref:`Py_LIMITED_API <stable>`." msgstr "" -#: ../../c-api/init.rst:2210 +#: ../../c-api/init.rst:2221 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:2212 +#: ../../c-api/init.rst:2223 msgid "" "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " "built with :ref:`Py_LIMITED_API <stable>`, where static allocation of this " "type is not possible due to its implementation being opaque at build time." msgstr "" -#: ../../c-api/init.rst:2219 +#: ../../c-api/init.rst:2230 msgid "" -"Return a value which is the same state as a value initialized with :c:macro:" -"`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." +"Return a value which is the same state as a value initialized " +"with :c:macro:`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic " +"allocation failure." msgstr "" -#: ../../c-api/init.rst:2226 +#: ../../c-api/init.rst:2237 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" -#: ../../c-api/init.rst:2232 +#: ../../c-api/init.rst:2243 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: ../../c-api/init.rst:2237 +#: ../../c-api/init.rst:2248 msgid "Methods" msgstr "方法" -#: ../../c-api/init.rst:2239 +#: ../../c-api/init.rst:2250 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " -"undefined if the given :c:type:`Py_tss_t` has not been initialized by :c:" -"func:`PyThread_tss_create`." +"undefined if the given :c:type:`Py_tss_t` has not been initialized " +"by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2247 +#: ../../c-api/init.rst:2258 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2253 +#: ../../c-api/init.rst:2264 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -2722,40 +2734,40 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:2262 +#: ../../c-api/init.rst:2273 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " -"destroyed key is able to be initialized again by :c:func:" -"`PyThread_tss_create`. This function can be called repeatedly on the same " -"key -- calling it on an already destroyed key is a no-op." +"destroyed key is able to be initialized again " +"by :c:func:`PyThread_tss_create`. This function can be called repeatedly on " +"the same key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:2271 +#: ../../c-api/init.rst:2282 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" -#: ../../c-api/init.rst:2278 +#: ../../c-api/init.rst:2289 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" -#: ../../c-api/init.rst:2286 +#: ../../c-api/init.rst:2297 msgid "Thread Local Storage (TLS) API" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../c-api/init.rst:2288 +#: ../../c-api/init.rst:2299 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API <thread-" "specific-storage-api>`." msgstr "" -#: ../../c-api/init.rst:2293 +#: ../../c-api/init.rst:2304 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -2764,62 +2776,62 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:2298 +#: ../../c-api/init.rst:2309 msgid "" "Due to the compatibility problem noted above, this version of the API should " "not be used in new code." msgstr "" -#: ../../c-api/init.rst:2309 +#: ../../c-api/init.rst:2320 msgid "Synchronization Primitives" msgstr "" -#: ../../c-api/init.rst:2311 +#: ../../c-api/init.rst:2322 msgid "The C-API provides a basic mutual exclusion lock." msgstr "" -#: ../../c-api/init.rst:2315 +#: ../../c-api/init.rst:2326 msgid "" "A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " "zero to represent the unlocked state. For example::" msgstr "" -#: ../../c-api/init.rst:2318 +#: ../../c-api/init.rst:2329 msgid "PyMutex mutex = {0};" msgstr "" -#: ../../c-api/init.rst:2320 +#: ../../c-api/init.rst:2331 msgid "" "Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " "contents and address of a :c:type:`!PyMutex` are meaningful, and it must " "remain at a fixed, writable location in memory." msgstr "" -#: ../../c-api/init.rst:2326 +#: ../../c-api/init.rst:2337 msgid "" "A :c:type:`!PyMutex` currently occupies one byte, but the size should be " "considered unstable. The size may change in future Python releases without " "a deprecation period." msgstr "" -#: ../../c-api/init.rst:2334 +#: ../../c-api/init.rst:2345 msgid "" "Lock mutex *m*. If another thread has already locked it, the calling thread " "will block until the mutex is unlocked. While blocked, the thread will " "temporarily release the :term:`GIL` if it is held." msgstr "" -#: ../../c-api/init.rst:2342 +#: ../../c-api/init.rst:2353 msgid "" "Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " "issue a fatal error." msgstr "" -#: ../../c-api/init.rst:2350 +#: ../../c-api/init.rst:2361 msgid "Python Critical Section API" msgstr "" -#: ../../c-api/init.rst:2352 +#: ../../c-api/init.rst:2363 msgid "" "The critical section API provides a deadlock avoidance layer on top of per-" "object locks for :term:`free-threaded <free threading>` CPython. They are " @@ -2827,17 +2839,18 @@ msgid "" "no-ops in versions of Python with the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:2357 +#: ../../c-api/init.rst:2368 msgid "" "Critical sections avoid deadlocks by implicitly suspending active critical " -"sections and releasing the locks during calls to :c:func:" -"`PyEval_SaveThread`. When :c:func:`PyEval_RestoreThread` is called, the most " -"recent critical section is resumed, and its locks reacquired. This means " -"the critical section API provides weaker guarantees than traditional locks " -"-- they are useful because their behavior is similar to the :term:`GIL`." +"sections and releasing the locks during calls " +"to :c:func:`PyEval_SaveThread`. When :c:func:`PyEval_RestoreThread` is " +"called, the most recent critical section is resumed, and its locks " +"reacquired. This means the critical section API provides weaker guarantees " +"than traditional locks -- they are useful because their behavior is similar " +"to the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:2364 +#: ../../c-api/init.rst:2375 msgid "" "The functions and structs used by the macros are exposed for cases where C " "macros are not available. They should only be used as in the given macro " @@ -2845,20 +2858,20 @@ msgid "" "future Python versions." msgstr "" -#: ../../c-api/init.rst:2371 +#: ../../c-api/init.rst:2382 msgid "" -"Operations that need to lock two objects at once must use :c:macro:" -"`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " -"lock more than one object at once, because the inner critical section may " -"suspend the outer critical sections. This API does not provide a way to " -"lock more than two objects at once." +"Operations that need to lock two objects at once must " +"use :c:macro:`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical " +"sections to lock more than one object at once, because the inner critical " +"section may suspend the outer critical sections. This API does not provide " +"a way to lock more than two objects at once." msgstr "" -#: ../../c-api/init.rst:2377 +#: ../../c-api/init.rst:2388 msgid "Example usage::" msgstr "" -#: ../../c-api/init.rst:2379 +#: ../../c-api/init.rst:2390 msgid "" "static PyObject *\n" "set_field(MyObject *self, PyObject *value)\n" @@ -2870,71 +2883,71 @@ msgid "" "}" msgstr "" -#: ../../c-api/init.rst:2388 +#: ../../c-api/init.rst:2399 msgid "" "In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " "can call arbitrary code through an object's deallocation function. The " "critical section API avoids potential deadlocks due to reentrancy and lock " "ordering by allowing the runtime to temporarily suspend the critical section " -"if the code triggered by the finalizer blocks and calls :c:func:" -"`PyEval_SaveThread`." +"if the code triggered by the finalizer blocks and " +"calls :c:func:`PyEval_SaveThread`." msgstr "" -#: ../../c-api/init.rst:2396 +#: ../../c-api/init.rst:2407 msgid "" "Acquires the per-object lock for the object *op* and begins a critical " "section." msgstr "" -#: ../../c-api/init.rst:2399 ../../c-api/init.rst:2413 -#: ../../c-api/init.rst:2428 ../../c-api/init.rst:2442 +#: ../../c-api/init.rst:2410 ../../c-api/init.rst:2424 +#: ../../c-api/init.rst:2439 ../../c-api/init.rst:2453 msgid "In the free-threaded build, this macro expands to::" msgstr "" -#: ../../c-api/init.rst:2401 +#: ../../c-api/init.rst:2412 msgid "" "{\n" " PyCriticalSection _py_cs;\n" " PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" msgstr "" -#: ../../c-api/init.rst:2405 ../../c-api/init.rst:2434 +#: ../../c-api/init.rst:2416 ../../c-api/init.rst:2445 msgid "In the default build, this macro expands to ``{``." msgstr "" -#: ../../c-api/init.rst:2411 +#: ../../c-api/init.rst:2422 msgid "Ends the critical section and releases the per-object lock." msgstr "" -#: ../../c-api/init.rst:2415 +#: ../../c-api/init.rst:2426 msgid "" " PyCriticalSection_End(&_py_cs);\n" "}" msgstr "" -#: ../../c-api/init.rst:2418 ../../c-api/init.rst:2447 +#: ../../c-api/init.rst:2429 ../../c-api/init.rst:2458 msgid "In the default build, this macro expands to ``}``." msgstr "" -#: ../../c-api/init.rst:2424 +#: ../../c-api/init.rst:2435 msgid "" "Acquires the per-objects locks for the objects *a* and *b* and begins a " "critical section. The locks are acquired in a consistent order (lowest " "address first) to avoid lock ordering deadlocks." msgstr "" -#: ../../c-api/init.rst:2430 +#: ../../c-api/init.rst:2441 msgid "" "{\n" " PyCriticalSection2 _py_cs2;\n" " PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" msgstr "" -#: ../../c-api/init.rst:2440 +#: ../../c-api/init.rst:2451 msgid "Ends the critical section and releases the per-object locks." msgstr "" -#: ../../c-api/init.rst:2444 +#: ../../c-api/init.rst:2455 msgid "" " PyCriticalSection2_End(&_py_cs2);\n" "}" @@ -2953,19 +2966,19 @@ msgid "path (in module sys)" msgstr "path(sys 模組中)" #: ../../c-api/init.rst:350 ../../c-api/init.rst:710 ../../c-api/init.rst:1145 -#: ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 +#: ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 msgid "module" msgstr "模組" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 msgid "__main__" msgstr "__main__" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 msgid "sys" msgstr "sys" @@ -2977,7 +2990,7 @@ msgstr "search(搜尋)" msgid "path" msgstr "path(路徑)" -#: ../../c-api/init.rst:350 ../../c-api/init.rst:1711 ../../c-api/init.rst:1764 +#: ../../c-api/init.rst:350 ../../c-api/init.rst:1722 ../../c-api/init.rst:1775 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" @@ -3073,22 +3086,22 @@ msgstr "PyEval_RestoreThread()" msgid "_thread" msgstr "_thread" -#: ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 +#: ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 msgid "stdout (in module sys)" msgstr "stdout(sys 模組中)" -#: ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 +#: ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 msgid "stderr (in module sys)" msgstr "stderr(sys 模組中)" -#: ../../c-api/init.rst:1647 ../../c-api/init.rst:1746 +#: ../../c-api/init.rst:1658 ../../c-api/init.rst:1757 msgid "stdin (in module sys)" msgstr "stdin(sys 模組中)" -#: ../../c-api/init.rst:1711 +#: ../../c-api/init.rst:1722 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/init.rst:1741 +#: ../../c-api/init.rst:1752 msgid "close (in module os)" msgstr "close(os 模組中)" diff --git a/c-api/module.po b/c-api/module.po index bfd8be22ed..7ebac731fe 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2025-02-04 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -584,18 +584,12 @@ msgid "" "On success, return ``0``. On error, raise an exception and return ``-1``." msgstr "" -#: ../../c-api/module.rst:526 -msgid "" -"Return ``-1`` if *value* is ``NULL``. It must be called with an exception " -"raised in this case." -msgstr "" - -#: ../../c-api/module.rst:529 ../../c-api/module.rst:576 -#: ../../c-api/module.rst:603 +#: ../../c-api/module.rst:526 ../../c-api/module.rst:577 +#: ../../c-api/module.rst:604 msgid "Example usage::" msgstr "用法範例: ::" -#: ../../c-api/module.rst:531 +#: ../../c-api/module.rst:528 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -621,13 +615,20 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:543 +#: ../../c-api/module.rst:540 +msgid "" +"To be convenient, the function accepts ``NULL`` *value* with an exception " +"set. In this case, return ``-1`` and just leave the raised exception " +"unchanged." +msgstr "" + +#: ../../c-api/module.rst:544 msgid "" "The example can also be written without checking explicitly if *obj* is " "``NULL``::" msgstr "" -#: ../../c-api/module.rst:546 +#: ../../c-api/module.rst:547 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -647,13 +648,13 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:555 +#: ../../c-api/module.rst:556 msgid "" "Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this " "case, since *obj* can be ``NULL``." msgstr "" -#: ../../c-api/module.rst:558 +#: ../../c-api/module.rst:559 msgid "" "The number of different *name* strings passed to this function should be " "kept small, usually by only using statically allocated strings as *name*. " @@ -663,7 +664,7 @@ msgid "" "internally to create a key object." msgstr "" -#: ../../c-api/module.rst:571 +#: ../../c-api/module.rst:572 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but \"steals\" a reference to " "*value*. It can be called with a result of function that returns a new " @@ -671,39 +672,39 @@ msgid "" "variable." msgstr "" -#: ../../c-api/module.rst:578 +#: ../../c-api/module.rst:579 msgid "" "if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n" " goto error;\n" "}" msgstr "" -#: ../../c-api/module.rst:587 +#: ../../c-api/module.rst:588 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to " "*value* on success (if it returns ``0``)." msgstr "" -#: ../../c-api/module.rst:590 +#: ../../c-api/module.rst:591 msgid "" "The new :c:func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions " "are recommended, since it is easy to introduce reference leaks by misusing " "the :c:func:`PyModule_AddObject` function." msgstr "" -#: ../../c-api/module.rst:597 +#: ../../c-api/module.rst:598 msgid "" "Unlike other functions that steal references, ``PyModule_AddObject()`` only " "releases the reference to *value* **on success**." msgstr "" -#: ../../c-api/module.rst:600 +#: ../../c-api/module.rst:601 msgid "" "This means that its return value must be checked, and calling code must :c:" "func:`Py_XDECREF` *value* manually on error." msgstr "" -#: ../../c-api/module.rst:605 +#: ../../c-api/module.rst:606 msgid "" "PyObject *obj = PyBytes_FromString(value);\n" "if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" @@ -717,24 +718,24 @@ msgid "" "// Py_XDECREF(obj) is not needed here." msgstr "" -#: ../../c-api/module.rst:618 +#: ../../c-api/module.rst:619 msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`." msgstr "" -#: ../../c-api/module.rst:623 +#: ../../c-api/module.rst:624 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:627 +#: ../../c-api/module.rst:628 msgid "" "This is a convenience function that calls :c:func:`PyLong_FromLong` and :c:" "func:`PyModule_AddObjectRef`; see their documentation for details." msgstr "" -#: ../../c-api/module.rst:633 +#: ../../c-api/module.rst:634 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 " @@ -742,14 +743,14 @@ msgid "" "on success." msgstr "" -#: ../../c-api/module.rst:638 +#: ../../c-api/module.rst:639 msgid "" "This is a convenience function that calls :c:func:" "`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; see their " "documentation for details." msgstr "" -#: ../../c-api/module.rst:645 +#: ../../c-api/module.rst:646 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 " @@ -757,11 +758,11 @@ msgid "" "with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:653 +#: ../../c-api/module.rst:654 msgid "Add a string constant to *module*." msgstr "" -#: ../../c-api/module.rst:657 +#: ../../c-api/module.rst:658 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 " @@ -769,7 +770,7 @@ msgid "" "``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:667 +#: ../../c-api/module.rst:668 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`. " @@ -780,25 +781,25 @@ msgid "" "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:680 +#: ../../c-api/module.rst:681 msgid "Module lookup" msgstr "模組查找" -#: ../../c-api/module.rst:682 +#: ../../c-api/module.rst:683 msgid "" "Single-phase initialization creates singleton modules that can be looked up " "in the context of the current interpreter. This allows the module object to " "be retrieved later with only a reference to the module definition." msgstr "" -#: ../../c-api/module.rst:686 +#: ../../c-api/module.rst:687 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:691 +#: ../../c-api/module.rst:692 msgid "" "Returns the module object that was created from *def* for the current " "interpreter. This method requires that the module object has been attached " @@ -807,18 +808,18 @@ msgid "" "to the interpreter state yet, it returns ``NULL``." msgstr "" -#: ../../c-api/module.rst:698 +#: ../../c-api/module.rst:699 msgid "" "Attaches the module object passed to the function to the interpreter state. " "This allows the module object to be accessible via :c:func:" "`PyState_FindModule`." msgstr "" -#: ../../c-api/module.rst:701 +#: ../../c-api/module.rst:702 msgid "Only effective on modules created using single-phase initialization." msgstr "" -#: ../../c-api/module.rst:703 +#: ../../c-api/module.rst:704 msgid "" "Python calls ``PyState_AddModule`` automatically after importing a module, " "so it is unnecessary (but harmless) to call it from module initialization " @@ -829,15 +830,15 @@ msgid "" "state updates)." msgstr "" -#: ../../c-api/module.rst:711 ../../c-api/module.rst:722 +#: ../../c-api/module.rst:712 ../../c-api/module.rst:723 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/module.rst:713 +#: ../../c-api/module.rst:714 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "成功時回傳 ``0``,在失敗時回傳 ``-1`` 並設定例外。" -#: ../../c-api/module.rst:719 +#: ../../c-api/module.rst:720 msgid "" "Removes the module object created from *def* from the interpreter state. " "Return ``-1`` with an exception set on error, ``0`` on success." diff --git a/c-api/object.po b/c-api/object.po index a2be5438c2..661f6905da 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-29 11:18+0000\n" +"POT-Creation-Date: 2025-01-05 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -606,6 +606,13 @@ msgstr "" #: ../../c-api/object.rst:498 msgid "" +"This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as a :" +"c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" +"`PyObject*`." +msgstr "" + +#: ../../c-api/object.rst:505 +msgid "" "This is equivalent to the Python expression ``dir(o)``, returning a " "(possibly empty) list of strings appropriate for the object argument, or " "``NULL`` if there was an error. If the argument is ``NULL``, this is like " @@ -614,7 +621,7 @@ msgid "" "`PyErr_Occurred` will return false." msgstr "" -#: ../../c-api/object.rst:507 +#: ../../c-api/object.rst:514 msgid "" "This is equivalent to the Python expression ``iter(o)``. It returns a new " "iterator for the object argument, or the object itself if the object is " @@ -622,14 +629,14 @@ msgid "" "object cannot be iterated." msgstr "" -#: ../../c-api/object.rst:515 +#: ../../c-api/object.rst:522 msgid "" "This is equivalent to the Python ``__iter__(self): return self`` method. It " "is intended for :term:`iterator` types, to be used in the :c:member:" "`PyTypeObject.tp_iter` slot." msgstr "" -#: ../../c-api/object.rst:521 +#: ../../c-api/object.rst:528 msgid "" "This is the equivalent to the Python expression ``aiter(o)``. Takes an :" "class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it. " @@ -638,67 +645,67 @@ msgid "" "``NULL`` if the object cannot be iterated." msgstr "" -#: ../../c-api/object.rst:531 +#: ../../c-api/object.rst:538 msgid "Get a pointer to subclass-specific data reserved for *cls*." msgstr "" -#: ../../c-api/object.rst:533 +#: ../../c-api/object.rst:540 msgid "" "The object *o* must be an instance of *cls*, and *cls* must have been " "created using negative :c:member:`PyType_Spec.basicsize`. Python does not " "check this." msgstr "" -#: ../../c-api/object.rst:537 +#: ../../c-api/object.rst:544 msgid "On error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/object.rst:543 +#: ../../c-api/object.rst:550 msgid "" "Return the size of the instance memory space reserved for *cls*, i.e. the " "size of the memory :c:func:`PyObject_GetTypeData` returns." msgstr "" -#: ../../c-api/object.rst:546 +#: ../../c-api/object.rst:553 msgid "" "This may be larger than requested using :c:member:`-PyType_Spec.basicsize " "<PyType_Spec.basicsize>`; it is safe to use this larger size (e.g. with :c:" "func:`!memset`)." msgstr "" -#: ../../c-api/object.rst:549 +#: ../../c-api/object.rst:556 msgid "" "The type *cls* **must** have been created using negative :c:member:" "`PyType_Spec.basicsize`. Python does not check this." msgstr "" -#: ../../c-api/object.rst:553 +#: ../../c-api/object.rst:560 msgid "On error, set an exception and return a negative value." msgstr "" -#: ../../c-api/object.rst:559 +#: ../../c-api/object.rst:566 msgid "" "Get a pointer to per-item data for a class with :c:macro:" "`Py_TPFLAGS_ITEMS_AT_END`." msgstr "" -#: ../../c-api/object.rst:562 +#: ../../c-api/object.rst:569 msgid "" "On error, set an exception and return ``NULL``. :py:exc:`TypeError` is " "raised if *o* does not have :c:macro:`Py_TPFLAGS_ITEMS_AT_END` set." msgstr "" -#: ../../c-api/object.rst:570 +#: ../../c-api/object.rst:577 msgid "Visit the managed dictionary of *obj*." msgstr "" -#: ../../c-api/object.rst:572 ../../c-api/object.rst:581 +#: ../../c-api/object.rst:579 ../../c-api/object.rst:588 msgid "" "This function must only be called in a traverse function of the type which " "has the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." msgstr "" -#: ../../c-api/object.rst:579 +#: ../../c-api/object.rst:586 msgid "Clear the managed dictionary of *obj*." msgstr "" diff --git a/c-api/unicode.po b/c-api/unicode.po index 8ebbcebe8f..6049c55176 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-28 00:13+0000\n" +"POT-Creation-Date: 2025-01-21 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -128,8 +128,8 @@ msgstr "" msgid "" "Return a pointer to the canonical representation cast to UCS1, UCS2 or UCS4 " "integer types for direct character access. No checks are performed if the " -"canonical representation has the correct character size; use :c:func:" -"`PyUnicode_KIND` to select the right function." +"canonical representation has the correct character size; " +"use :c:func:`PyUnicode_KIND` to select the right function." msgstr "" #: ../../c-api/unicode.rst:124 @@ -156,25 +156,25 @@ msgstr "" #: ../../c-api/unicode.rst:152 msgid "" -"Write into a canonical representation *data* (as obtained with :c:func:" -"`PyUnicode_DATA`). This function performs no sanity checks, and is intended " -"for usage in loops. The caller should cache the *kind* value and *data* " -"pointer as obtained from other calls. *index* is the index in the string " -"(starts at 0) and *value* is the new code point value which should be " -"written to that location." +"Write into a canonical representation *data* (as obtained " +"with :c:func:`PyUnicode_DATA`). This function performs no sanity checks, " +"and is intended for usage in loops. The caller should cache the *kind* " +"value and *data* pointer as obtained from other calls. *index* is the index " +"in the string (starts at 0) and *value* is the new code point value which " +"should be written to that location." msgstr "" #: ../../c-api/unicode.rst:165 msgid "" -"Read a code point from a canonical representation *data* (as obtained with :" -"c:func:`PyUnicode_DATA`). No checks or ready calls are performed." +"Read a code point from a canonical representation *data* (as obtained " +"with :c:func:`PyUnicode_DATA`). No checks or ready calls are performed." msgstr "" #: ../../c-api/unicode.rst:173 msgid "" "Read a character from a Unicode object *unicode*, which must be in the " -"\"canonical\" representation. This is less efficient than :c:func:" -"`PyUnicode_READ` if you do multiple consecutive reads." +"\"canonical\" representation. This is less efficient " +"than :c:func:`PyUnicode_READ` if you do multiple consecutive reads." msgstr "" #: ../../c-api/unicode.rst:182 @@ -210,49 +210,49 @@ msgstr "" #: ../../c-api/unicode.rst:209 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a whitespace character." -msgstr "" +msgstr "根據 *ch* 是否為空白字元來回傳 ``1`` 或 ``0``。" #: ../../c-api/unicode.rst:214 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a lowercase character." -msgstr "" +msgstr "根據 *ch* 是否為小寫字元來回傳 ``1`` 或 ``0``。" #: ../../c-api/unicode.rst:219 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an uppercase character." -msgstr "" +msgstr "根據 *ch* 是否為大寫字元來回傳 ``1`` 或 ``0``。" #: ../../c-api/unicode.rst:224 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a titlecase character." -msgstr "" +msgstr "根據 *ch* 是否為首字大寫字元來回傳 ``1`` 或 ``0``。" #: ../../c-api/unicode.rst:229 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a linebreak character." -msgstr "" +msgstr "根據 *ch* 是否為換行字元來回傳 ``1`` 或 ``0``。" #: ../../c-api/unicode.rst:234 msgid "Return ``1`` or ``0`` depending on whether *ch* is a decimal character." -msgstr "" +msgstr "根據 *ch* 是否為十進位字元來回傳 ``1`` 或 ``0``。" #: ../../c-api/unicode.rst:239 msgid "Return ``1`` or ``0`` depending on whether *ch* is a digit character." -msgstr "" +msgstr "根據 *ch* 是否為數字 (digit) 字元來回傳 ``1`` 或 ``0``。" #: ../../c-api/unicode.rst:244 msgid "Return ``1`` or ``0`` depending on whether *ch* is a numeric character." -msgstr "" +msgstr "根據 *ch* 是否為數值 (numeric) 字元來回傳 ``1`` 或 ``0``。" #: ../../c-api/unicode.rst:249 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphabetic character." -msgstr "" +msgstr "根據 *ch* 是否為字母字元來回傳 ``1`` 或 ``0``。" #: ../../c-api/unicode.rst:254 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphanumeric character." -msgstr "" +msgstr "根據 *ch* 是否為字母數字 (alphanumeric) 字元來回傳 ``1`` 或 ``0``。" #: ../../c-api/unicode.rst:259 msgid "" @@ -271,49 +271,57 @@ msgstr "" #: ../../c-api/unicode.rst:273 msgid "Return the character *ch* converted to lower case." -msgstr "" +msgstr "回傳轉換為小寫的 *ch* 字元。" #: ../../c-api/unicode.rst:278 msgid "Return the character *ch* converted to upper case." -msgstr "" +msgstr "回傳轉換為大寫的 *ch* 字元。" #: ../../c-api/unicode.rst:283 msgid "Return the character *ch* converted to title case." -msgstr "" +msgstr "回傳轉換為首字大寫的 *ch* 字元。" #: ../../c-api/unicode.rst:288 msgid "" "Return the character *ch* converted to a decimal positive integer. Return " "``-1`` if this is not possible. This function does not raise exceptions." msgstr "" +"回傳轉換為十進位正整數的 *ch* 字元,若無法轉換則回傳 ``-1``。此函式不會引發例" +"外。" #: ../../c-api/unicode.rst:294 msgid "" "Return the character *ch* converted to a single digit integer. Return ``-1`` " "if this is not possible. This function does not raise exceptions." msgstr "" +"回傳轉換為單一數字整數的 *ch* 字元,若無法轉換則回傳 ``-1``。此函式不會引發例" +"外。" #: ../../c-api/unicode.rst:300 msgid "" "Return the character *ch* converted to a double. Return ``-1.0`` if this is " "not possible. This function does not raise exceptions." msgstr "" +"回傳轉換為雙精度浮點數 (double) 的 *ch* 字元,若無法轉換則回傳 ``-1.0``。此函" +"式不會引發例外。" #: ../../c-api/unicode.rst:304 msgid "These APIs can be used to work with surrogates:" -msgstr "" +msgstr "這些 API 可用於處理代理字元:" #: ../../c-api/unicode.rst:308 msgid "Check if *ch* is a surrogate (``0xD800 <= ch <= 0xDFFF``)." -msgstr "" +msgstr "檢查 *ch* 是否為代理字元 (surrogate, ``0xD800 <= ch <= 0xDFFF``)。" #: ../../c-api/unicode.rst:312 msgid "Check if *ch* is a high surrogate (``0xD800 <= ch <= 0xDBFF``)." msgstr "" +"檢查 *ch* 是否為高代理字元 (high surrogate, ``0xD800 <= ch <= 0xDBFF``)。" #: ../../c-api/unicode.rst:316 msgid "Check if *ch* is a low surrogate (``0xDC00 <= ch <= 0xDFFF``)." msgstr "" +"檢查 *ch* 是否為低代理字元 (low surrogate, ``0xDC00 <= ch <= 0xDFFF``)。" #: ../../c-api/unicode.rst:320 msgid "" @@ -352,18 +360,19 @@ msgstr "" #: ../../c-api/unicode.rst:349 msgid "" -"Create a new Unicode object with the given *kind* (possible values are :c:" -"macro:`PyUnicode_1BYTE_KIND` etc., as returned by :c:func:" -"`PyUnicode_KIND`). The *buffer* must point to an array of *size* units of " -"1, 2 or 4 bytes per character, as given by the kind." +"Create a new Unicode object with the given *kind* (possible values " +"are :c:macro:`PyUnicode_1BYTE_KIND` etc., as returned " +"by :c:func:`PyUnicode_KIND`). The *buffer* must point to an array of *size* " +"units of 1, 2 or 4 bytes per character, as given by the kind." msgstr "" #: ../../c-api/unicode.rst:354 msgid "" "If necessary, the input *buffer* is copied and transformed into the " -"canonical representation. For example, if the *buffer* is a UCS4 string (:c:" -"macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in the UCS1 " -"range, it will be transformed into UCS1 (:c:macro:`PyUnicode_1BYTE_KIND`)." +"canonical representation. For example, if the *buffer* is a UCS4 string " +"(:c:macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in the " +"UCS1 range, it will be transformed into UCS1 " +"(:c:macro:`PyUnicode_1BYTE_KIND`)." msgstr "" #: ../../c-api/unicode.rst:365 @@ -424,9 +433,9 @@ msgstr "" #: ../../c-api/unicode.rst:402 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " -"actual width is given in the next argument, which must be of type :c:expr:" -"`int`, and the object to convert comes after the minimum field width and " -"optional precision." +"actual width is given in the next argument, which must be of " +"type :c:expr:`int`, and the object to convert comes after the minimum field " +"width and optional precision." msgstr "" #: ../../c-api/unicode.rst:407 @@ -562,7 +571,7 @@ msgstr "*n/a*" #: ../../c-api/unicode.rst:464 msgid "The literal ``%`` character." -msgstr "" +msgstr "字面 ``%`` 字元。" #: ../../c-api/unicode.rst:466 msgid "``d``, ``i``" @@ -576,7 +585,7 @@ msgstr "" #: ../../c-api/unicode.rst:468 msgid "The decimal representation of a signed C integer." -msgstr "" +msgstr "一個有符號 C 整數的十進位表示法。" #: ../../c-api/unicode.rst:470 msgid "``u``" @@ -584,7 +593,7 @@ msgstr "``u``" #: ../../c-api/unicode.rst:472 msgid "The decimal representation of an unsigned C integer." -msgstr "" +msgstr "一個無符號 C 整數的十進位表示法。" #: ../../c-api/unicode.rst:474 msgid "``o``" @@ -592,7 +601,7 @@ msgstr "``o``" #: ../../c-api/unicode.rst:476 msgid "The octal representation of an unsigned C integer." -msgstr "" +msgstr "一個無符號 C 整數的八進位表示法。" #: ../../c-api/unicode.rst:478 msgid "``x``" @@ -600,7 +609,7 @@ msgstr "``x``" #: ../../c-api/unicode.rst:480 msgid "The hexadecimal representation of an unsigned C integer (lowercase)." -msgstr "" +msgstr "一個無符號 C 整數的十六進位表示法(小寫)。" #: ../../c-api/unicode.rst:482 msgid "``X``" @@ -608,7 +617,7 @@ msgstr "``X``" #: ../../c-api/unicode.rst:484 msgid "The hexadecimal representation of an unsigned C integer (uppercase)." -msgstr "" +msgstr "一個無符號 C 整數的十六進位表示法(大寫)。" #: ../../c-api/unicode.rst:486 msgid "``c``" @@ -620,7 +629,7 @@ msgstr ":c:expr:`int`" #: ../../c-api/unicode.rst:488 msgid "A single character." -msgstr "" +msgstr "一個單一字元。" #: ../../c-api/unicode.rst:490 msgid "``s``" @@ -632,7 +641,7 @@ msgstr ":c:expr:`const char*` 或 :c:expr:`const wchar_t*`" #: ../../c-api/unicode.rst:492 msgid "A null-terminated C character array." -msgstr "" +msgstr "一個以 null 結尾的 C 字元陣列。" #: ../../c-api/unicode.rst:494 msgid "``p``" @@ -661,7 +670,7 @@ msgstr ":c:expr:`PyObject*`" #: ../../c-api/unicode.rst:503 msgid "The result of calling :func:`ascii`." -msgstr "" +msgstr "呼叫 :func:`ascii` 的結果。" #: ../../c-api/unicode.rst:505 msgid "``U``" @@ -669,7 +678,7 @@ msgstr "``U``" #: ../../c-api/unicode.rst:507 msgid "A Unicode object." -msgstr "一 Unicode 物件。" +msgstr "一個 Unicode 物件。" #: ../../c-api/unicode.rst:509 msgid "``V``" @@ -692,7 +701,7 @@ msgstr "``S``" #: ../../c-api/unicode.rst:517 msgid "The result of calling :c:func:`PyObject_Str`." -msgstr "" +msgstr "呼叫 :c:func:`PyObject_Str` 的結果。" #: ../../c-api/unicode.rst:519 msgid "``R``" @@ -700,7 +709,7 @@ msgstr "``R``" #: ../../c-api/unicode.rst:521 msgid "The result of calling :c:func:`PyObject_Repr`." -msgstr "" +msgstr "呼叫 :c:func:`PyObject_Repr` 的結果。" #: ../../c-api/unicode.rst:523 msgid "``T``" @@ -708,8 +717,8 @@ msgstr "``T``" #: ../../c-api/unicode.rst:525 msgid "" -"Get the fully qualified name of an object type; call :c:func:" -"`PyType_GetFullyQualifiedName`." +"Get the fully qualified name of an object type; " +"call :c:func:`PyType_GetFullyQualifiedName`." msgstr "" #: ../../c-api/unicode.rst:528 @@ -732,8 +741,8 @@ msgstr ":c:expr:`PyTypeObject*`" #: ../../c-api/unicode.rst:535 msgid "" -"Get the fully qualified name of a type; call :c:func:" -"`PyType_GetFullyQualifiedName`." +"Get the fully qualified name of a type; " +"call :c:func:`PyType_GetFullyQualifiedName`." msgstr "" #: ../../c-api/unicode.rst:538 @@ -765,17 +774,19 @@ msgstr "" #: ../../c-api/unicode.rst:556 msgid "Support for ``\"%lld\"`` and ``\"%llu\"`` added." -msgstr "" +msgstr "新增對 ``\"%lld\"`` 和 ``\"%llu\"`` 的支援。" #: ../../c-api/unicode.rst:559 msgid "Support for ``\"%li\"``, ``\"%lli\"`` and ``\"%zi\"`` added." -msgstr "" +msgstr "新增對 ``\"%li\"``、``\"%lli\"`` 和 ``\"%zi\"`` 的支援。" #: ../../c-api/unicode.rst:562 msgid "" "Support width and precision formatter for ``\"%s\"``, ``\"%A\"``, " "``\"%U\"``, ``\"%V\"``, ``\"%S\"``, ``\"%R\"`` added." msgstr "" +"新增對 ``\"%s\"``、``\"%A\"``、``\"%U\"``、``\"%V\"``、``\"%S\"``、" +"``\"%R\"`` 的寬度和精確度格式化支援。" #: ../../c-api/unicode.rst:566 msgid "" @@ -795,7 +806,7 @@ msgstr "" #: ../../c-api/unicode.rst:578 msgid "Support for ``%T``, ``%#T``, ``%N`` and ``%#N`` formats added." -msgstr "" +msgstr "新增對 ``%T``、``%#T``、``%N`` 和 ``%#N`` 格式的支援。" #: ../../c-api/unicode.rst:584 msgid "" @@ -845,7 +856,7 @@ msgstr "" #: ../../c-api/unicode.rst:619 msgid "On error, set an exception and return ``-1``." -msgstr "" +msgstr "發生錯誤時,設定例外並回傳 ``-1``。" #: ../../c-api/unicode.rst:630 msgid "" @@ -857,8 +868,8 @@ msgstr "" #: ../../c-api/unicode.rst:641 msgid "" -"Fill a string with a character: write *fill_char* into ``unicode[start:" -"start+length]``." +"Fill a string with a character: write *fill_char* into " +"``unicode[start:start+length]``." msgstr "" #: ../../c-api/unicode.rst:644 @@ -875,9 +886,9 @@ msgstr "" #: ../../c-api/unicode.rst:656 msgid "" -"Write a character to a string. The string must have been created through :c:" -"func:`PyUnicode_New`. Since Unicode strings are supposed to be immutable, " -"the string must not be shared, or have been hashed yet." +"Write a character to a string. The string must have been created " +"through :c:func:`PyUnicode_New`. Since Unicode strings are supposed to be " +"immutable, the string must not be shared, or have been hashed yet." msgstr "" #: ../../c-api/unicode.rst:660 @@ -889,18 +900,18 @@ msgstr "" #: ../../c-api/unicode.rst:664 msgid "Return ``0`` on success, ``-1`` on error with an exception set." -msgstr "" +msgstr "成功時回傳 ``0``,發生錯誤時設定例外並回傳 ``-1``。" #: ../../c-api/unicode.rst:671 msgid "" "Read a character from a string. This function checks that *unicode* is a " -"Unicode object and the index is not out of bounds, in contrast to :c:func:" -"`PyUnicode_READ_CHAR`, which performs no error checking." +"Unicode object and the index is not out of bounds, in contrast " +"to :c:func:`PyUnicode_READ_CHAR`, which performs no error checking." msgstr "" #: ../../c-api/unicode.rst:675 msgid "Return character on success, ``-1`` on error with an exception set." -msgstr "" +msgstr "成功時回傳字元,發生錯誤時設定例外並回傳 ``-1``。" #: ../../c-api/unicode.rst:683 msgid "" @@ -919,10 +930,10 @@ msgstr "" #: ../../c-api/unicode.rst:703 msgid "" -"Copy the string *unicode* into a new UCS4 buffer that is allocated using :c:" -"func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:" -"`MemoryError` set. The returned buffer always has an extra null code point " -"appended." +"Copy the string *unicode* into a new UCS4 buffer that is allocated " +"using :c:func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with " +"a :exc:`MemoryError` set. The returned buffer always has an extra null code " +"point appended." msgstr "" #: ../../c-api/unicode.rst:712 @@ -946,24 +957,24 @@ msgstr "" #: ../../c-api/unicode.rst:728 msgid "" -"Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from the :" -"term:`filesystem encoding and error handler`." +"Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from " +"the :term:`filesystem encoding and error handler`." msgstr "" #: ../../c-api/unicode.rst:731 ../../c-api/unicode.rst:766 msgid "This function ignores the :ref:`Python UTF-8 Mode <utf8-mode>`." -msgstr "" +msgstr "此函式會忽略 :ref:`Python UTF-8 模式 <utf8-mode>`。" -#: ../../c-api/unicode.rst:735 ../../c-api/unicode.rst:832 +#: ../../c-api/unicode.rst:735 ../../c-api/unicode.rst:851 msgid "The :c:func:`Py_DecodeLocale` function." msgstr ":c:func:`Py_DecodeLocale` 函式。" #: ../../c-api/unicode.rst:739 msgid "" "The function now also uses the current locale encoding for the " -"``surrogateescape`` error handler, except on Android. Previously, :c:func:" -"`Py_DecodeLocale` was used for the ``surrogateescape``, and the current " -"locale encoding was used for ``strict``." +"``surrogateescape`` error handler, except on Android. " +"Previously, :c:func:`Py_DecodeLocale` was used for the ``surrogateescape``, " +"and the current locale encoding was used for ``strict``." msgstr "" #: ../../c-api/unicode.rst:748 @@ -971,37 +982,39 @@ msgid "" "Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string " "length using :c:func:`!strlen`." msgstr "" +"類似於 :c:func:`PyUnicode_DecodeLocaleAndSize`,但使用 :c:func:`!strlen` 計算" +"字串長度。" #: ../../c-api/unicode.rst:756 msgid "" "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " "locale encoding on other platforms. The supported error handlers are " "``\"strict\"`` and ``\"surrogateescape\"`` (:pep:`383`). The encoder uses " -"``\"strict\"`` error handler if *errors* is ``NULL``. Return a :class:" -"`bytes` object. *unicode* cannot contain embedded null characters." +"``\"strict\"`` error handler if *errors* is ``NULL``. Return " +"a :class:`bytes` object. *unicode* cannot contain embedded null characters." msgstr "" #: ../../c-api/unicode.rst:763 msgid "" -"Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to the :term:" -"`filesystem encoding and error handler`." +"Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to " +"the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:770 ../../c-api/unicode.rst:863 +#: ../../c-api/unicode.rst:770 ../../c-api/unicode.rst:882 msgid "The :c:func:`Py_EncodeLocale` function." msgstr ":c:func:`Py_EncodeLocale` 函式。" #: ../../c-api/unicode.rst:774 msgid "" "The function now also uses the current locale encoding for the " -"``surrogateescape`` error handler, except on Android. Previously, :c:func:" -"`Py_EncodeLocale` was used for the ``surrogateescape``, and the current " -"locale encoding was used for ``strict``." +"``surrogateescape`` error handler, except on Android. " +"Previously, :c:func:`Py_EncodeLocale` was used for the ``surrogateescape``, " +"and the current locale encoding was used for ``strict``." msgstr "" #: ../../c-api/unicode.rst:783 msgid "File System Encoding" -msgstr "" +msgstr "檔案系統編碼" #: ../../c-api/unicode.rst:785 msgid "" @@ -1012,90 +1025,112 @@ msgstr "" #: ../../c-api/unicode.rst:788 msgid "" "To encode file names to :class:`bytes` during argument parsing, the " -"``\"O&\"`` converter should be used, passing :c:func:`PyUnicode_FSConverter` " -"as the conversion function:" +"``\"O&\"`` converter should be used, passing :c:func:`!" +"PyUnicode_FSConverter` as the conversion function:" msgstr "" #: ../../c-api/unicode.rst:794 msgid "" -"ParseTuple converter: encode :class:`str` objects -- obtained directly or " -"through the :class:`os.PathLike` interface -- to :class:`bytes` using :c:" -"func:`PyUnicode_EncodeFSDefault`; :class:`bytes` objects are output as-is. " -"*result* must be a :c:expr:`PyBytesObject*` which must be released when it " -"is no longer used." +":ref:`PyArg_Parse\\* converter <arg-parsing>`: encode :class:`str` objects " +"-- obtained directly or through the :class:`os.PathLike` interface -- " +"to :class:`bytes` using :c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` " +"objects are output as-is. *result* must be an address of a C variable of " +"type :c:expr:`PyObject*` (or :c:expr:`PyBytesObject*`). On success, set the " +"variable to a new :term:`strong reference` to a :ref:`bytes object " +"<bytesobjects>` which must be released when it is no longer used and return " +"a non-zero value (:c:macro:`Py_CLEANUP_SUPPORTED`). Embedded null bytes are " +"not allowed in the result. On failure, return ``0`` with an exception set." msgstr "" -#: ../../c-api/unicode.rst:802 ../../c-api/unicode.rst:819 -msgid "Accepts a :term:`path-like object`." +#: ../../c-api/unicode.rst:806 +msgid "" +"If *obj* is ``NULL``, the function releases a strong reference stored in the " +"variable referred by *result* and returns ``1``." msgstr "" -#: ../../c-api/unicode.rst:805 +#: ../../c-api/unicode.rst:811 ../../c-api/unicode.rst:838 +msgid "Accepts a :term:`path-like object`." +msgstr "接受一個 :term:`path-like object`。" + +#: ../../c-api/unicode.rst:814 msgid "" "To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` " -"converter should be used, passing :c:func:`PyUnicode_FSDecoder` as the " +"converter should be used, passing :c:func:`!PyUnicode_FSDecoder` as the " "conversion function:" msgstr "" -#: ../../c-api/unicode.rst:811 +#: ../../c-api/unicode.rst:820 msgid "" -"ParseTuple converter: decode :class:`bytes` objects -- obtained either " -"directly or indirectly through the :class:`os.PathLike` interface -- to :" -"class:`str` using :c:func:`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` " -"objects are output as-is. *result* must be a :c:expr:`PyUnicodeObject*` " -"which must be released when it is no longer used." +":ref:`PyArg_Parse\\* converter <arg-parsing>`: decode :class:`bytes` objects " +"-- obtained either directly or indirectly through the :class:`os.PathLike` " +"interface -- to :class:`str` " +"using :c:func:`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are " +"output as-is. *result* must be an address of a C variable of " +"type :c:expr:`PyObject*` (or :c:expr:`PyUnicodeObject*`). On success, set " +"the variable to a new :term:`strong reference` to a :ref:`Unicode object " +"<unicodeobjects>` which must be released when it is no longer used and " +"return a non-zero value (:c:macro:`Py_CLEANUP_SUPPORTED`). Embedded null " +"characters are not allowed in the result. On failure, return ``0`` with an " +"exception set." msgstr "" -#: ../../c-api/unicode.rst:825 +#: ../../c-api/unicode.rst:833 +msgid "" +"If *obj* is ``NULL``, release the strong reference to the object referred to " +"by *result* and return ``1``." +msgstr "" + +#: ../../c-api/unicode.rst:844 msgid "Decode a string from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:827 +#: ../../c-api/unicode.rst:846 msgid "" -"If you need to decode a string from the current locale encoding, use :c:func:" -"`PyUnicode_DecodeLocaleAndSize`." +"If you need to decode a string from the current locale encoding, " +"use :c:func:`PyUnicode_DecodeLocaleAndSize`." msgstr "" -#: ../../c-api/unicode.rst:834 ../../c-api/unicode.rst:847 -#: ../../c-api/unicode.rst:867 +#: ../../c-api/unicode.rst:853 ../../c-api/unicode.rst:866 +#: ../../c-api/unicode.rst:886 msgid "" "The :term:`filesystem error handler <filesystem encoding and error handler>` " "is now used." msgstr "" -#: ../../c-api/unicode.rst:841 +#: ../../c-api/unicode.rst:860 msgid "" "Decode a null-terminated string from the :term:`filesystem encoding and " "error handler`." msgstr "" -#: ../../c-api/unicode.rst:844 +#: ../../c-api/unicode.rst:863 msgid "" -"If the string length is known, use :c:func:" -"`PyUnicode_DecodeFSDefaultAndSize`." -msgstr "" +"If the string length is known, " +"use :c:func:`PyUnicode_DecodeFSDefaultAndSize`." +msgstr "如果字串長度已知,請使用 :c:func:`PyUnicode_DecodeFSDefaultAndSize`。" -#: ../../c-api/unicode.rst:854 +#: ../../c-api/unicode.rst:873 msgid "" "Encode a Unicode object to the :term:`filesystem encoding and error " "handler`, and return :class:`bytes`. Note that the resulting :class:`bytes` " "object can contain null bytes." msgstr "" -#: ../../c-api/unicode.rst:858 +#: ../../c-api/unicode.rst:877 msgid "" -"If you need to encode a string to the current locale encoding, use :c:func:" -"`PyUnicode_EncodeLocale`." +"If you need to encode a string to the current locale encoding, " +"use :c:func:`PyUnicode_EncodeLocale`." msgstr "" -#: ../../c-api/unicode.rst:872 +#: ../../c-api/unicode.rst:891 msgid "wchar_t Support" msgstr "wchar_t 支援" -#: ../../c-api/unicode.rst:874 +#: ../../c-api/unicode.rst:893 msgid ":c:type:`wchar_t` support for platforms which support it:" -msgstr "" +msgstr "對支援 :c:type:`wchar_t` 的平台提供支援:" -#: ../../c-api/unicode.rst:878 +#: ../../c-api/unicode.rst:897 msgid "" "Create a Unicode object from the :c:type:`wchar_t` buffer *wstr* of the " "given *size*. Passing ``-1`` as the *size* indicates that the function must " @@ -1103,72 +1138,73 @@ msgid "" "failure." msgstr "" -#: ../../c-api/unicode.rst:886 +#: ../../c-api/unicode.rst:905 msgid "" "Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. " "At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly " -"trailing null termination character). Return the number of :c:type:" -"`wchar_t` characters copied or ``-1`` in case of an error." +"trailing null termination character). Return the number " +"of :c:type:`wchar_t` characters copied or ``-1`` in case of an error." msgstr "" -#: ../../c-api/unicode.rst:891 +#: ../../c-api/unicode.rst:910 msgid "" "When *wstr* is ``NULL``, instead return the *size* that would be required to " "store all of *unicode* including a terminating null." msgstr "" -#: ../../c-api/unicode.rst:894 +#: ../../c-api/unicode.rst:913 msgid "" "Note that the resulting :c:expr:`wchar_t*` string may or may not be null-" -"terminated. It is the responsibility of the caller to make sure that the :c:" -"expr:`wchar_t*` string is null-terminated in case this is required by the " -"application. Also, note that the :c:expr:`wchar_t*` string might contain " +"terminated. It is the responsibility of the caller to make sure that " +"the :c:expr:`wchar_t*` string is null-terminated in case this is required by " +"the application. Also, note that the :c:expr:`wchar_t*` string might contain " "null characters, which would cause the string to be truncated when used with " "most C functions." msgstr "" -#: ../../c-api/unicode.rst:904 +#: ../../c-api/unicode.rst:923 msgid "" "Convert the Unicode object to a wide character string. The output string " "always ends with a null character. If *size* is not ``NULL``, write the " "number of wide characters (excluding the trailing null termination " "character) into *\\*size*. Note that the resulting :c:type:`wchar_t` string " "might contain null characters, which would cause the string to be truncated " -"when used with most C functions. If *size* is ``NULL`` and the :c:expr:" -"`wchar_t*` string contains null characters a :exc:`ValueError` is raised." +"when used with most C functions. If *size* is ``NULL`` and " +"the :c:expr:`wchar_t*` string contains null characters a :exc:`ValueError` " +"is raised." msgstr "" -#: ../../c-api/unicode.rst:912 +#: ../../c-api/unicode.rst:931 msgid "" "Returns a buffer allocated by :c:macro:`PyMem_New` (use :c:func:`PyMem_Free` " "to free it) on success. On error, returns ``NULL`` and *\\*size* is " "undefined. Raises a :exc:`MemoryError` if memory allocation is failed." msgstr "" -#: ../../c-api/unicode.rst:919 +#: ../../c-api/unicode.rst:938 msgid "" "Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` " "string contains null characters." msgstr "" -#: ../../c-api/unicode.rst:927 +#: ../../c-api/unicode.rst:946 msgid "Built-in Codecs" -msgstr "" +msgstr "內建編解碼器" -#: ../../c-api/unicode.rst:929 +#: ../../c-api/unicode.rst:948 msgid "" "Python provides a set of built-in codecs which are written in C for speed. " "All of these codecs are directly usable via the following functions." msgstr "" -#: ../../c-api/unicode.rst:932 +#: ../../c-api/unicode.rst:951 msgid "" "Many of the following APIs take two arguments encoding and errors, and they " "have the same semantics as the ones of the built-in :func:`str` string " "object constructor." msgstr "" -#: ../../c-api/unicode.rst:936 +#: ../../c-api/unicode.rst:955 msgid "" "Setting encoding to ``NULL`` causes the default encoding to be used which is " "UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for " @@ -1176,28 +1212,28 @@ msgid "" "handler` internally." msgstr "" -#: ../../c-api/unicode.rst:941 +#: ../../c-api/unicode.rst:960 msgid "" "Error handling is set by errors which may also be set to ``NULL`` meaning to " "use the default handling defined for the codec. Default error handling for " "all built-in codecs is \"strict\" (:exc:`ValueError` is raised)." msgstr "" -#: ../../c-api/unicode.rst:945 +#: ../../c-api/unicode.rst:964 msgid "" "The codecs all use a similar interface. Only deviations from the following " "generic ones are documented for simplicity." msgstr "" -#: ../../c-api/unicode.rst:950 +#: ../../c-api/unicode.rst:969 msgid "Generic Codecs" -msgstr "" +msgstr "泛用編解碼器" -#: ../../c-api/unicode.rst:952 +#: ../../c-api/unicode.rst:971 msgid "These are the generic codec APIs:" -msgstr "" +msgstr "這些是泛用編解碼器的 API:" -#: ../../c-api/unicode.rst:958 +#: ../../c-api/unicode.rst:977 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string " "*str*. *encoding* and *errors* have the same meaning as the parameters of " @@ -1206,7 +1242,7 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:968 +#: ../../c-api/unicode.rst:987 msgid "" "Encode a Unicode object and return the result as Python bytes object. " "*encoding* and *errors* have the same meaning as the parameters of the same " @@ -1215,21 +1251,21 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:976 +#: ../../c-api/unicode.rst:995 msgid "UTF-8 Codecs" msgstr "UTF-8 編解碼器" -#: ../../c-api/unicode.rst:978 +#: ../../c-api/unicode.rst:997 msgid "These are the UTF-8 codec APIs:" -msgstr "" +msgstr "這些是 UTF-8 編解碼器的 API:" -#: ../../c-api/unicode.rst:983 +#: ../../c-api/unicode.rst:1002 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:990 +#: ../../c-api/unicode.rst:1009 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF8`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-8 byte sequences will " @@ -1237,20 +1273,20 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:998 +#: ../../c-api/unicode.rst:1017 msgid "" "Encode a Unicode object using UTF-8 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1002 ../../c-api/unicode.rst:1017 +#: ../../c-api/unicode.rst:1021 ../../c-api/unicode.rst:1036 msgid "" "The function fails if the string contains surrogate code points (``U+D800`` " "- ``U+DFFF``)." msgstr "" -#: ../../c-api/unicode.rst:1008 +#: ../../c-api/unicode.rst:1027 msgid "" "Return a pointer to the UTF-8 encoding of the Unicode object, and store the " "size of the encoded representation (in bytes) in *size*. The *size* " @@ -1259,13 +1295,15 @@ msgid "" "regardless of whether there are any other null code points." msgstr "" -#: ../../c-api/unicode.rst:1014 +#: ../../c-api/unicode.rst:1033 msgid "" "On error, set an exception, set *size* to ``-1`` (if it's not NULL) and " "return ``NULL``." msgstr "" +"發生錯誤時,設定例外並將 *size* 設為 ``-1``\\ (如果不是 NULL),並回傳 " +"``NULL``。" -#: ../../c-api/unicode.rst:1020 +#: ../../c-api/unicode.rst:1039 msgid "" "This caches the UTF-8 representation of the string in the Unicode object, " "and subsequent calls will return a pointer to the same buffer. The caller " @@ -1274,47 +1312,57 @@ msgid "" "collected." msgstr "" -#: ../../c-api/unicode.rst:1027 ../../c-api/unicode.rst:1040 +#: ../../c-api/unicode.rst:1046 ../../c-api/unicode.rst:1068 msgid "The return type is now ``const char *`` rather of ``char *``." -msgstr "" +msgstr "回傳型別現在是 ``const char *`` 而不是 ``char *``。" -#: ../../c-api/unicode.rst:1030 +#: ../../c-api/unicode.rst:1049 msgid "This function is a part of the :ref:`limited API <limited-c-api>`." msgstr "" -#: ../../c-api/unicode.rst:1036 +#: ../../c-api/unicode.rst:1055 msgid "As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size." +msgstr "與 :c:func:`PyUnicode_AsUTF8AndSize` 類似,但不儲存大小。" + +#: ../../c-api/unicode.rst:1059 +msgid "" +"This function does not have any special behavior for `null characters " +"<https://en.wikipedia.org/wiki/Null_character>`_ embedded within *unicode*. " +"As a result, strings containing null characters will remain in the returned " +"string, which some C functions might interpret as the end of the string, " +"leading to truncation. If truncation is an issue, it is recommended to " +"use :c:func:`PyUnicode_AsUTF8AndSize` instead." msgstr "" -#: ../../c-api/unicode.rst:1045 +#: ../../c-api/unicode.rst:1073 msgid "UTF-32 Codecs" msgstr "UTF-32 編解碼器" -#: ../../c-api/unicode.rst:1047 +#: ../../c-api/unicode.rst:1075 msgid "These are the UTF-32 codec APIs:" -msgstr "" +msgstr "這些是 UTF-32 編解碼器的 API:" -#: ../../c-api/unicode.rst:1053 +#: ../../c-api/unicode.rst:1081 msgid "" "Decode *size* bytes from a UTF-32 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1057 ../../c-api/unicode.rst:1107 +#: ../../c-api/unicode.rst:1085 ../../c-api/unicode.rst:1135 msgid "" "If *byteorder* is non-``NULL``, the decoder starts decoding using the given " "byte order::" msgstr "" -#: ../../c-api/unicode.rst:1060 ../../c-api/unicode.rst:1110 +#: ../../c-api/unicode.rst:1088 ../../c-api/unicode.rst:1138 msgid "" "*byteorder == -1: little endian\n" "*byteorder == 0: native order\n" "*byteorder == 1: big endian" msgstr "" -#: ../../c-api/unicode.rst:1064 +#: ../../c-api/unicode.rst:1092 msgid "" "If ``*byteorder`` is zero, and the first four bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1322,21 +1370,21 @@ msgid "" "``-1`` or ``1``, any byte order mark is copied to the output." msgstr "" -#: ../../c-api/unicode.rst:1069 +#: ../../c-api/unicode.rst:1097 msgid "" "After completion, *\\*byteorder* is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1072 ../../c-api/unicode.rst:1123 +#: ../../c-api/unicode.rst:1100 ../../c-api/unicode.rst:1151 msgid "If *byteorder* is ``NULL``, the codec starts in native order mode." msgstr "" -#: ../../c-api/unicode.rst:1074 ../../c-api/unicode.rst:1125 +#: ../../c-api/unicode.rst:1102 ../../c-api/unicode.rst:1153 msgid "Return ``NULL`` if an exception was raised by the codec." -msgstr "" +msgstr "如果編解碼器引發例外則回傳 ``NULL``。" -#: ../../c-api/unicode.rst:1080 +#: ../../c-api/unicode.rst:1108 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF32`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF32Stateful` will not " @@ -1345,29 +1393,29 @@ msgid "" "number of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1089 +#: ../../c-api/unicode.rst:1117 msgid "" "Return a Python byte string using the UTF-32 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1095 +#: ../../c-api/unicode.rst:1123 msgid "UTF-16 Codecs" msgstr "UTF-16 編解碼器" -#: ../../c-api/unicode.rst:1097 +#: ../../c-api/unicode.rst:1125 msgid "These are the UTF-16 codec APIs:" -msgstr "" +msgstr "這些是 UTF-16 編解碼器的 API:" -#: ../../c-api/unicode.rst:1103 +#: ../../c-api/unicode.rst:1131 msgid "" "Decode *size* bytes from a UTF-16 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1114 +#: ../../c-api/unicode.rst:1142 msgid "" "If ``*byteorder`` is zero, and the first two bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1376,13 +1424,13 @@ msgid "" "result in either a ``\\ufeff`` or a ``\\ufffe`` character)." msgstr "" -#: ../../c-api/unicode.rst:1120 +#: ../../c-api/unicode.rst:1148 msgid "" "After completion, ``*byteorder`` is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1131 +#: ../../c-api/unicode.rst:1159 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF16`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF16Stateful` will not " @@ -1392,28 +1440,28 @@ msgid "" "*consumed*." msgstr "" -#: ../../c-api/unicode.rst:1140 +#: ../../c-api/unicode.rst:1168 msgid "" "Return a Python byte string using the UTF-16 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1146 +#: ../../c-api/unicode.rst:1174 msgid "UTF-7 Codecs" msgstr "UTF-7 編解碼器" -#: ../../c-api/unicode.rst:1148 +#: ../../c-api/unicode.rst:1176 msgid "These are the UTF-7 codec APIs:" -msgstr "" +msgstr "這些是 UTF-7 編解碼器的 API:" -#: ../../c-api/unicode.rst:1153 +#: ../../c-api/unicode.rst:1181 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1160 +#: ../../c-api/unicode.rst:1188 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF7`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-7 base-64 sections will " @@ -1421,101 +1469,101 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1167 +#: ../../c-api/unicode.rst:1195 msgid "Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1169 +#: ../../c-api/unicode.rst:1197 msgid "These are the \"Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1175 +#: ../../c-api/unicode.rst:1203 msgid "" "Create a Unicode object by decoding *size* bytes of the Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1181 +#: ../../c-api/unicode.rst:1209 msgid "" "Encode a Unicode object using Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1187 +#: ../../c-api/unicode.rst:1215 msgid "Raw-Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1189 +#: ../../c-api/unicode.rst:1217 msgid "These are the \"Raw Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1195 +#: ../../c-api/unicode.rst:1223 msgid "" "Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1201 +#: ../../c-api/unicode.rst:1229 msgid "" "Encode a Unicode object using Raw-Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1207 +#: ../../c-api/unicode.rst:1235 msgid "Latin-1 Codecs" msgstr "Latin-1 編解碼器" -#: ../../c-api/unicode.rst:1209 +#: ../../c-api/unicode.rst:1237 msgid "" "These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 " "Unicode ordinals and only these are accepted by the codecs during encoding." msgstr "" -#: ../../c-api/unicode.rst:1215 +#: ../../c-api/unicode.rst:1243 msgid "" "Create a Unicode object by decoding *size* bytes of the Latin-1 encoded " "string *str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1221 +#: ../../c-api/unicode.rst:1249 msgid "" "Encode a Unicode object using Latin-1 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1227 +#: ../../c-api/unicode.rst:1255 msgid "ASCII Codecs" msgstr "ASCII 編解碼器" -#: ../../c-api/unicode.rst:1229 +#: ../../c-api/unicode.rst:1257 msgid "" "These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All " "other codes generate errors." msgstr "" -#: ../../c-api/unicode.rst:1235 +#: ../../c-api/unicode.rst:1263 msgid "" "Create a Unicode object by decoding *size* bytes of the ASCII encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1241 +#: ../../c-api/unicode.rst:1269 msgid "" "Encode a Unicode object using ASCII and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1247 +#: ../../c-api/unicode.rst:1275 msgid "Character Map Codecs" msgstr "" -#: ../../c-api/unicode.rst:1249 +#: ../../c-api/unicode.rst:1277 msgid "" "This codec is special in that it can be used to implement many different " "codecs (and this is in fact what was done to obtain most of the standard " @@ -1525,18 +1573,18 @@ msgid "" "sequences work well." msgstr "" -#: ../../c-api/unicode.rst:1255 +#: ../../c-api/unicode.rst:1283 msgid "These are the mapping codec APIs:" -msgstr "" +msgstr "這些是對映編解碼器的 API:" -#: ../../c-api/unicode.rst:1260 +#: ../../c-api/unicode.rst:1288 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string *str* " "using the given *mapping* object. Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1264 +#: ../../c-api/unicode.rst:1292 msgid "" "If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* " "must map bytes ordinals (integers in the range from 0 to 255) to Unicode " @@ -1546,14 +1594,14 @@ msgid "" "treated as undefined mappings and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1275 +#: ../../c-api/unicode.rst:1303 msgid "" "Encode a Unicode object using the given *mapping* object and return the " "result as a bytes object. Error handling is \"strict\". Return ``NULL`` if " "an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1279 +#: ../../c-api/unicode.rst:1307 msgid "" "The *mapping* object must map Unicode ordinal integers to bytes objects, " "integers in the range from 0 to 255 or ``None``. Unmapped character " @@ -1561,41 +1609,41 @@ msgid "" "``None`` are treated as \"undefined mapping\" and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1285 +#: ../../c-api/unicode.rst:1313 msgid "The following codec API is special in that maps Unicode to Unicode." msgstr "" -#: ../../c-api/unicode.rst:1289 +#: ../../c-api/unicode.rst:1317 msgid "" "Translate a string by applying a character mapping table to it and return " "the resulting Unicode object. Return ``NULL`` if an exception was raised by " "the codec." msgstr "" -#: ../../c-api/unicode.rst:1293 +#: ../../c-api/unicode.rst:1321 msgid "" "The mapping table must map Unicode ordinal integers to Unicode ordinal " "integers or ``None`` (causing deletion of the character)." msgstr "" -#: ../../c-api/unicode.rst:1296 +#: ../../c-api/unicode.rst:1324 msgid "" "Mapping tables need only provide the :meth:`~object.__getitem__` interface; " "dictionaries and sequences work well. Unmapped character ordinals (ones " "which cause a :exc:`LookupError`) are left untouched and are copied as-is." msgstr "" -#: ../../c-api/unicode.rst:1300 +#: ../../c-api/unicode.rst:1328 msgid "" "*errors* has the usual meaning for codecs. It may be ``NULL`` which " "indicates to use the default error handling." msgstr "" -#: ../../c-api/unicode.rst:1305 +#: ../../c-api/unicode.rst:1333 msgid "MBCS codecs for Windows" -msgstr "" +msgstr "Windows 的 MBCS 編解碼器" -#: ../../c-api/unicode.rst:1307 +#: ../../c-api/unicode.rst:1335 msgid "" "These are the MBCS codec APIs. They are currently only available on Windows " "and use the Win32 MBCS converters to implement the conversions. Note that " @@ -1603,13 +1651,13 @@ msgid "" "is defined by the user settings on the machine running the codec." msgstr "" -#: ../../c-api/unicode.rst:1314 +#: ../../c-api/unicode.rst:1342 msgid "" "Create a Unicode object by decoding *size* bytes of the MBCS encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1321 +#: ../../c-api/unicode.rst:1349 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeMBCS`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeMBCSStateful` will not " @@ -1617,44 +1665,44 @@ msgid "" "will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1329 +#: ../../c-api/unicode.rst:1357 msgid "" "Encode a Unicode object using MBCS and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1336 +#: ../../c-api/unicode.rst:1364 msgid "" "Encode the Unicode object using the specified code page and return a Python " -"bytes object. Return ``NULL`` if an exception was raised by the codec. Use :" -"c:macro:`!CP_ACP` code page to get the MBCS encoder." +"bytes object. Return ``NULL`` if an exception was raised by the codec. " +"Use :c:macro:`!CP_ACP` code page to get the MBCS encoder." msgstr "" -#: ../../c-api/unicode.rst:1344 +#: ../../c-api/unicode.rst:1372 msgid "Methods & Slots" msgstr "" -#: ../../c-api/unicode.rst:1350 +#: ../../c-api/unicode.rst:1378 msgid "Methods and Slot Functions" msgstr "" -#: ../../c-api/unicode.rst:1352 +#: ../../c-api/unicode.rst:1380 msgid "" "The following APIs are capable of handling Unicode objects and strings on " "input (we refer to them as strings in the descriptions) and return Unicode " "objects or integers as appropriate." msgstr "" -#: ../../c-api/unicode.rst:1356 +#: ../../c-api/unicode.rst:1384 msgid "They all return ``NULL`` or ``-1`` if an exception occurs." msgstr "" -#: ../../c-api/unicode.rst:1361 +#: ../../c-api/unicode.rst:1389 msgid "Concat two strings giving a new Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1366 +#: ../../c-api/unicode.rst:1394 msgid "" "Split a string giving a list of Unicode strings. If *sep* is ``NULL``, " "splitting will be done at all whitespace substrings. Otherwise, splits " @@ -1663,27 +1711,27 @@ msgid "" "list." msgstr "" -#: ../../c-api/unicode.rst:1374 +#: ../../c-api/unicode.rst:1402 msgid "" "Split a Unicode string at line breaks, returning a list of Unicode strings. " "CRLF is considered to be one line break. If *keepends* is ``0``, the Line " "break characters are not included in the resulting strings." msgstr "" -#: ../../c-api/unicode.rst:1381 +#: ../../c-api/unicode.rst:1409 msgid "" "Join a sequence of strings using the given *separator* and return the " "resulting Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1388 +#: ../../c-api/unicode.rst:1416 msgid "" "Return ``1`` if *substr* matches ``unicode[start:end]`` at the given tail " "end (*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` " "a suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1396 +#: ../../c-api/unicode.rst:1424 msgid "" "Return the first position of *substr* in ``unicode[start:end]`` using the " "given *direction* (*direction* == ``1`` means to do a forward search, " @@ -1692,7 +1740,7 @@ msgid "" "``-2`` indicates that an error occurred and an exception has been set." msgstr "" -#: ../../c-api/unicode.rst:1406 +#: ../../c-api/unicode.rst:1434 msgid "" "Return the first position of the character *ch* in ``unicode[start:end]`` " "using the given *direction* (*direction* == ``1`` means to do a forward " @@ -1702,37 +1750,37 @@ msgid "" "set." msgstr "" -#: ../../c-api/unicode.rst:1414 +#: ../../c-api/unicode.rst:1442 msgid "" "*start* and *end* are now adjusted to behave like ``unicode[start:end]``." msgstr "" -#: ../../c-api/unicode.rst:1421 +#: ../../c-api/unicode.rst:1449 msgid "" "Return the number of non-overlapping occurrences of *substr* in " "``unicode[start:end]``. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1428 +#: ../../c-api/unicode.rst:1456 msgid "" "Replace at most *maxcount* occurrences of *substr* in *unicode* with " "*replstr* and return the resulting Unicode object. *maxcount* == ``-1`` " "means replace all occurrences." msgstr "" -#: ../../c-api/unicode.rst:1435 +#: ../../c-api/unicode.rst:1463 msgid "" "Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, " "and greater than, respectively." msgstr "" -#: ../../c-api/unicode.rst:1438 +#: ../../c-api/unicode.rst:1466 msgid "" -"This function returns ``-1`` upon failure, so one should call :c:func:" -"`PyErr_Occurred` to check for errors." +"This function returns ``-1`` upon failure, so one should " +"call :c:func:`PyErr_Occurred` to check for errors." msgstr "" -#: ../../c-api/unicode.rst:1444 +#: ../../c-api/unicode.rst:1472 msgid "" "Compare a Unicode object with a char buffer which is interpreted as being " "UTF-8 or ASCII encoded and return true (``1``) if they are equal, or false " @@ -1741,18 +1789,18 @@ msgid "" "is returned." msgstr "" -#: ../../c-api/unicode.rst:1451 ../../c-api/unicode.rst:1472 +#: ../../c-api/unicode.rst:1479 ../../c-api/unicode.rst:1500 msgid "This function does not raise exceptions." -msgstr "" +msgstr "此函式不會引發例外。" -#: ../../c-api/unicode.rst:1458 +#: ../../c-api/unicode.rst:1486 msgid "" "Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string* " "length using :c:func:`!strlen`. If the Unicode object contains null " "characters, false (``0``) is returned." msgstr "" -#: ../../c-api/unicode.rst:1467 +#: ../../c-api/unicode.rst:1495 msgid "" "Compare a Unicode object, *unicode*, with *string* and return ``-1``, ``0``, " "``1`` for less than, equal, and greater than, respectively. It is best to " @@ -1760,58 +1808,59 @@ msgid "" "string as ISO-8859-1 if it contains non-ASCII characters." msgstr "" -#: ../../c-api/unicode.rst:1477 +#: ../../c-api/unicode.rst:1505 msgid "Rich compare two Unicode strings and return one of the following:" msgstr "" -#: ../../c-api/unicode.rst:1479 +#: ../../c-api/unicode.rst:1507 msgid "``NULL`` in case an exception was raised" msgstr "" -#: ../../c-api/unicode.rst:1480 +#: ../../c-api/unicode.rst:1508 msgid ":c:data:`Py_True` or :c:data:`Py_False` for successful comparisons" msgstr "" -#: ../../c-api/unicode.rst:1481 +#: ../../c-api/unicode.rst:1509 msgid ":c:data:`Py_NotImplemented` in case the type combination is unknown" msgstr "" -#: ../../c-api/unicode.rst:1483 +#: ../../c-api/unicode.rst:1511 msgid "" -"Possible values for *op* are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:" -"`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, and :c:macro:`Py_LE`." +"Possible values for *op* " +"are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, " +"and :c:macro:`Py_LE`." msgstr "" -#: ../../c-api/unicode.rst:1489 +#: ../../c-api/unicode.rst:1517 msgid "" "Return a new string object from *format* and *args*; this is analogous to " "``format % args``." msgstr "" -#: ../../c-api/unicode.rst:1495 +#: ../../c-api/unicode.rst:1523 msgid "" "Check whether *substr* is contained in *unicode* and return true or false " "accordingly." msgstr "" -#: ../../c-api/unicode.rst:1498 +#: ../../c-api/unicode.rst:1526 msgid "" "*substr* has to coerce to a one element Unicode string. ``-1`` is returned " "if there was an error." msgstr "" -#: ../../c-api/unicode.rst:1504 +#: ../../c-api/unicode.rst:1532 msgid "" "Intern the argument :c:expr:`*p_unicode` in place. The argument must be the " "address of a pointer variable pointing to a Python Unicode string object. " -"If there is an existing interned string that is the same as :c:expr:" -"`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the reference to " -"the old string object and creating a new :term:`strong reference` to the " -"interned string object), otherwise it leaves :c:expr:`*p_unicode` alone and " -"interns it." +"If there is an existing interned string that is the same " +"as :c:expr:`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the " +"reference to the old string object and creating a new :term:`strong " +"reference` to the interned string object), otherwise it " +"leaves :c:expr:`*p_unicode` alone and interns it." msgstr "" -#: ../../c-api/unicode.rst:1511 +#: ../../c-api/unicode.rst:1539 msgid "" "(Clarification: even though there is a lot of talk about references, think " "of this function as reference-neutral. You must own the object you pass in; " @@ -1819,47 +1868,48 @@ msgid "" "the result.)" msgstr "" -#: ../../c-api/unicode.rst:1516 +#: ../../c-api/unicode.rst:1544 msgid "" "This function never raises an exception. On error, it leaves its argument " "unchanged without interning it." msgstr "" -#: ../../c-api/unicode.rst:1519 +#: ../../c-api/unicode.rst:1547 msgid "" -"Instances of subclasses of :py:class:`str` may not be interned, that is, :c:" -"expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, then -- " -"as with any other error -- the argument is left unchanged." +"Instances of subclasses of :py:class:`str` may not be interned, that " +"is, :c:expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, " +"then -- as with any other error -- the argument is left unchanged." msgstr "" -#: ../../c-api/unicode.rst:1523 +#: ../../c-api/unicode.rst:1551 msgid "" "Note that interned strings are not “immortal”. You must keep a reference to " "the result to benefit from interning." msgstr "" -#: ../../c-api/unicode.rst:1529 +#: ../../c-api/unicode.rst:1557 msgid "" -"A combination of :c:func:`PyUnicode_FromString` and :c:func:" -"`PyUnicode_InternInPlace`, meant for statically allocated strings." +"A combination of :c:func:`PyUnicode_FromString` " +"and :c:func:`PyUnicode_InternInPlace`, meant for statically allocated " +"strings." msgstr "" -#: ../../c-api/unicode.rst:1532 +#: ../../c-api/unicode.rst:1560 msgid "" "Return a new (\"owned\") reference to either a new Unicode string object " "that has been interned, or an earlier interned string object with the same " "value." msgstr "" -#: ../../c-api/unicode.rst:1536 +#: ../../c-api/unicode.rst:1564 msgid "" "Python may keep a reference to the result, or make it :term:`immortal`, " "preventing it from being garbage-collected promptly. For interning an " "unbounded number of different strings, such as ones coming from user input, " -"prefer calling :c:func:`PyUnicode_FromString` and :c:func:" -"`PyUnicode_InternInPlace` directly." +"prefer calling :c:func:`PyUnicode_FromString` " +"and :c:func:`PyUnicode_InternInPlace` directly." msgstr "" -#: ../../c-api/unicode.rst:1544 +#: ../../c-api/unicode.rst:1572 msgid "Strings interned this way are made :term:`immortal`." msgstr "" diff --git a/c-api/veryhigh.po b/c-api/veryhigh.po index 468bb4f7bf..80cabb8b50 100644 --- a/c-api/veryhigh.po +++ b/c-api/veryhigh.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-09 00:13+0000\n" +"POT-Creation-Date: 2025-01-22 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -390,7 +390,17 @@ msgstr "" msgid "Added *cf_feature_version* field." msgstr "新增 *cf_feature_version* 欄位。" -#: ../../c-api/veryhigh.rst:354 +#: ../../c-api/veryhigh.rst:351 +msgid "The available compiler flags are accessible as macros:" +msgstr "" + +#: ../../c-api/veryhigh.rst:360 +msgid "" +"See :ref:`compiler flags <ast-compiler-flags>` in documentation of the :py:" +"mod:`!ast` Python module, which exports these constants under the same names." +msgstr "" + +#: ../../c-api/veryhigh.rst:366 msgid "" "This bit can be set in *flags* to cause division operator ``/`` to be " "interpreted as \"true division\" according to :pep:`238`." diff --git a/faq/programming.po b/faq/programming.po index 1d9f44ebb3..f2df420db1 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-01-19 00:15+0000\n" "PO-Revision-Date: 2024-04-25 14:17+0800\n" "Last-Translator: KNChiu <y9760210@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,8 +45,8 @@ msgstr "有的。" #: ../../faq/programming.rst:19 msgid "" -"Several debuggers for Python are described below, and the built-in function :" -"func:`breakpoint` allows you to drop into any of them." +"Several debuggers for Python are described below, and the built-in " +"function :func:`breakpoint` allows you to drop into any of them." msgstr "" "下面描述了幾個 Python 除錯器,內建函式 :func:`breakpoint` 允許你進入其中任何" "一個。" @@ -296,7 +296,7 @@ msgstr "" msgid "" "In the example above you can access the outer scope variable by declaring it " "global:" -msgstr "在上面的示例中,你可以透過將其聲明為全域變數來存取外部範圍變數:" +msgstr "在上面的範例中,你可以透過將其聲明為全域變數來存取外部範圍變數:" #: ../../faq/programming.rst:167 #, fuzzy @@ -309,11 +309,10 @@ msgstr "" "在外部範圍內修改變數的值:" #: ../../faq/programming.rst:174 -#, fuzzy msgid "" "You can do a similar thing in a nested scope using the :keyword:`nonlocal` " "keyword:" -msgstr "你可以使用 :keyword:`nonlocal` 關鍵字在嵌套範圍內做類似的事情:" +msgstr "你可以使用 :keyword:`nonlocal` 關鍵字在巢狀作用域內做類似的事情:" #: ../../faq/programming.rst:192 msgid "What are the rules for local and global variables in Python?" @@ -341,17 +340,17 @@ msgid "" "a component of an imported module. This clutter would defeat the usefulness " "of the ``global`` declaration for identifying side-effects." msgstr "" -"雖然起初有點令人驚訝,但稍加考慮就可以解釋這一點。一方面,要求 :keyword:" -"`global` 分配的變數可以防止意外的副作用。另一方面,如果所有全域參照都需要 " -"``global``,那麼你將一直使用 ``global``。你必須將對內建函式或引入模組的組件的" -"每個參照聲明為全域。這種混亂會破壞用於識別副作用的 ``global`` 聲明的有用性。" +"雖然起初有點令人驚訝,但稍加考慮就可以解釋這一點。一方面,要" +"求 :keyword:`global` 分配的變數可以防止意外的副作用。另一方面,如果所有全域參" +"照都需要 ``global``,那麼你將一直使用 ``global``。你必須將對內建函式或引入模" +"組的組件的每個參照聲明為全域。這種混亂會破壞用於識別副作用的 ``global`` 聲明" +"的有用性。" #: ../../faq/programming.rst:208 -#, fuzzy msgid "" "Why do lambdas defined in a loop with different values all return the same " "result?" -msgstr "為什麼在具有不同值的迴圈中定義的 lambda 都回傳相同的結果?" +msgstr "為什麼以不同的值在迴圈中定義的 lambda 都回傳相同的結果?" #: ../../faq/programming.rst:210 msgid "" @@ -371,16 +370,15 @@ msgstr "" "... squares.append(lambda: x**2)" #: ../../faq/programming.rst:217 -#, fuzzy msgid "" "This gives you a list that contains 5 lambdas that calculate ``x**2``. You " "might expect that, when called, they would return, respectively, ``0``, " "``1``, ``4``, ``9``, and ``16``. However, when you actually try you will " "see that they all return ``16``::" msgstr "" -"這為你提供了一個包含 5 個計算 ``x**2`` 的 lambda 的list。你可能期望,當被呼叫" -"時,它們會分別回傳 ``0``、``1``、``4``、``9`` 和 ``16``。然而,當你實際嘗試" -"時,你會發現它們都回傳 ``16``: ::" +"這會提供一個包含五個計算 ``x**2`` 的 lambda 串列。你可能會預期在呼叫它時,它" +"們會分別回傳 ``0``、``1``、``4``、``9`` 和 ``16``,然而當你實際嘗試你會發現它" +"們都回傳 ``16``: ::" #: ../../faq/programming.rst:222 msgid "" @@ -395,7 +393,6 @@ msgstr "" "16" #: ../../faq/programming.rst:227 -#, fuzzy msgid "" "This happens because ``x`` is not local to the lambdas, but is defined in " "the outer scope, and it is accessed when the lambda is called --- not when " @@ -403,9 +400,9 @@ msgid "" "the functions now return ``4**2``, i.e. ``16``. You can also verify this by " "changing the value of ``x`` and see how the results of the lambdas change::" msgstr "" -"發生這種情況是因為 ``x`` 不是 lambda 的局部變數,而是在外部作用域中定義的,並" -"且在呼叫 lambda 時存取它——而不是在定義時存取它。在迴圈結束時,``x`` 的值為 " -"``4``,因此所有函式現在都回傳 ``4**2``,即 ``16``。你還可以透過更改 ``x`` 的" +"發生這種情況是因為 ``x`` 不是 lambda 的局部變數,而是在外部作用域中定義的,且" +"是在呼叫 lambda 時才會存取它,並非於定義時就會存取。在迴圈結束時,``x`` 的值" +"為 ``4``,因此所有函式都回傳 ``4**2``,即為 ``16``。你還可以透過更改 ``x`` 的" "值來驗證這一點,並查看 lambda 運算式的結果如何變化: ::" #: ../../faq/programming.rst:233 @@ -419,7 +416,6 @@ msgstr "" "64" #: ../../faq/programming.rst:237 -#, fuzzy msgid "" "In order to avoid this, you need to save the values in variables local to " "the lambdas, so that they don't rely on the value of the global ``x``::" @@ -494,7 +490,7 @@ msgstr "config.py: ::" #: ../../faq/programming.rst:270 msgid "x = 0 # Default value of the 'x' configuration setting" -msgstr "" +msgstr "x = 0 # 'x' 配置設定的預設值" #: ../../faq/programming.rst:272 msgid "mod.py::" @@ -523,16 +519,14 @@ msgstr "" "print(config.x)" #: ../../faq/programming.rst:283 -#, fuzzy msgid "" "Note that using a module is also the basis for implementing the singleton " "design pattern, for the same reason." msgstr "請注意,出於同樣的原因,使用模組也是實作單例設計模式的基礎。" #: ../../faq/programming.rst:288 -#, fuzzy msgid "What are the \"best practices\" for using import in a module?" -msgstr "在模組中使用 import 的「最佳實踐」是什麼?" +msgstr "在模組中使用 import 的「最佳實踐」有哪些?" #: ../../faq/programming.rst:290 #, fuzzy @@ -563,8 +557,8 @@ msgstr "如果你按以下順序引入模組,這是一個很好的做法:" #: ../../faq/programming.rst:301 msgid "" -"standard library modules -- e.g. :mod:`sys`, :mod:`os`, :mod:`argparse`, :" -"mod:`re`" +"standard library modules -- " +"e.g. :mod:`sys`, :mod:`os`, :mod:`argparse`, :mod:`re`" msgstr "" "標準函式庫模組 —— 例如 :mod:`sys`、:mod:`os`、:mod:`argparse`、:mod:`re`" @@ -645,8 +639,8 @@ msgstr "" "入移動到局部範圍內,例如在函式定義內。如果根據程式的執行方式,許多引入是不必" "要的,則此技術特別有用。如果模組僅在該函式中使用,你可能還想將引入移動到該函" "式中。請注意,由於模組的一次性初始化,第一次載入模組可能很昂貴,但多次載入模" -"組實際上是免費的,只需幾次字典查詢。即使模組名稱超出範圍,該模組也可能在 :" -"data:`sys.modules` 中可用。" +"組實際上是免費的,只需幾次字典查詢。即使模組名稱超出範圍,該模組也可能" +"在 :data:`sys.modules` 中可用。" #: ../../faq/programming.rst:338 #, fuzzy @@ -731,6 +725,9 @@ msgid "" " if mydict is None:\n" " mydict = {} # create a new dict for local namespace" msgstr "" +"def foo(mydict=None):\n" +" if mydict is None:\n" +" mydict = {} # 為區域命名空間建立一個新字典" #: ../../faq/programming.rst:374 #, fuzzy @@ -760,11 +757,10 @@ msgid "" msgstr "" #: ../../faq/programming.rst:389 -#, fuzzy msgid "" "You could use a global variable containing a dictionary instead of the " "default value; it's a matter of taste." -msgstr "你可以使用包含字典的全域變數而不是預設值;這是一個品味問題。" +msgstr "你可以使用包含字典的全域變數而不是預設值;這取決於喜好。" #: ../../faq/programming.rst:394 #, fuzzy @@ -803,17 +799,16 @@ msgid "What is the difference between arguments and parameters?" msgstr "引數 (arguments) 和參數 (parameters) 有什麼區別?" #: ../../faq/programming.rst:417 -#, fuzzy msgid "" ":term:`Parameters <parameter>` are defined by the names that appear in a " "function definition, whereas :term:`arguments <argument>` are the values " -"actually passed to a function when calling it. Parameters define what :term:" -"`kind of arguments <parameter>` a function can accept. For example, given " -"the function definition::" +"actually passed to a function when calling it. Parameters define " +"what :term:`kind of arguments <parameter>` a function can accept. For " +"example, given the function definition::" msgstr "" ":term:`參數 <parameter>`\\ 由出現在函式定義中的名稱定義,而\\ :term:`引數 " -"<argument>`\\ 是呼叫函式時實際傳遞給函式的值。參數定義函式可以接受的\\ :term:" -"引數種類 <parameter>`。例如,給定函式定義: ::" +"<argument>`\\ 是呼叫函式時實際傳遞給函式的值。參數定義函式可以接受的" +"\\ :term:`引數種類 <parameter>`。例如,給定以下函式定義: ::" #: ../../faq/programming.rst:423 msgid "" @@ -828,7 +823,7 @@ msgid "" "*foo*, *bar* and *kwargs* are parameters of ``func``. However, when calling " "``func``, for example::" msgstr "" -"*foo*、*bar* 和 *kwargs* 是 ``func`` 的參數。然而,當呼叫 ``func`` 時,例" +"*foo*、*bar* 和 *kwargs* 是 ``func`` 的參數。然而當呼叫 ``func`` 時,例" "如: ::" #: ../../faq/programming.rst:429 @@ -837,7 +832,7 @@ msgstr "func(42, bar=314, extra=somevar)" #: ../../faq/programming.rst:431 msgid "the values ``42``, ``314``, and ``somevar`` are arguments." -msgstr "``42`` 、 ``314`` 和 ``somevar`` 是引數。" +msgstr "``42``、``314`` 和 ``somevar`` 是引數。" #: ../../faq/programming.rst:435 msgid "Why did changing list 'y' also change list 'x'?" @@ -892,19 +887,17 @@ msgid "" msgstr "list 是 :term:`mutable`,這意味著你可以變更它們的內容。" #: ../../faq/programming.rst:457 -#, fuzzy msgid "" "After the call to :meth:`!append`, the content of the mutable object has " "changed from ``[]`` to ``[10]``. Since both the variables refer to the same " "object, using either name accesses the modified value ``[10]``." msgstr "" "在呼叫 :meth:`!append` 之後,可變物件的內容從 ``[]`` 變成了 ``[10]``。由於這" -"兩個變數都參照同一個物件,因此使用任一名稱都可以存取修改後的值 ``[10]`` 。" +"兩個變數都參照同一個物件,因此使用任一名稱都可以存取修改後的值 ``[10]``。" #: ../../faq/programming.rst:461 -#, fuzzy msgid "If we instead assign an immutable object to ``x``::" -msgstr "如果我們改為將不可變物件分配給 ``x``: ::" +msgstr "如果我們改為賦予一個不可變物件給 ``x``: ::" #: ../../faq/programming.rst:463 msgid "" @@ -916,6 +909,13 @@ msgid "" ">>> y\n" "5" msgstr "" +">>> x = 5 # 整數為不可變的\n" +">>> y = x\n" +">>> x = x + 1 # 5 不可變,在這邊會建立一個新物件\n" +">>> x\n" +"6\n" +">>> y\n" +"5" #: ../../faq/programming.rst:471 #, fuzzy @@ -949,9 +949,9 @@ msgstr "" "一些操作(例如 ``y.append(10)`` 和 ``y.sort()``)會改變物件,而表面上相似的操" "作(例如 ``y = y + [10]`` 和: func:`sorted(y) <sorted>`) 建立一個新物件。通" "常在 Python 中(以及在標準函式庫中的所有情況下)改變物件的方法將回傳 " -"``None`` 以幫助避免混淆這兩種型別的操作。因此,如果你錯誤地編寫了 ``y." -"sort()``,認為它會為你提供 ``y`` 的排序副本,那麼你最終會得到 ``None``,這可" -"能會導致你的程式生成一個容易診斷的錯誤。" +"``None`` 以幫助避免混淆這兩種型別的操作。因此,如果你錯誤地編寫了 " +"``y.sort()``,認為它會為你提供 ``y`` 的排序副本,那麼你最終會得到 ``None``," +"這可能會導致你的程式生成一個容易診斷的錯誤。" #: ../../faq/programming.rst:488 #, fuzzy @@ -1004,12 +1004,10 @@ msgstr "" "置函式 :func:`id`。" #: ../../faq/programming.rst:510 -#, fuzzy msgid "How do I write a function with output parameters (call by reference)?" -msgstr "如何編寫帶有輸出參數的函式(透過參照呼叫)?" +msgstr "如何編寫帶有輸出參數的函式(透過傳參照呼叫 (call by reference))?" #: ../../faq/programming.rst:512 -#, fuzzy msgid "" "Remember that arguments are passed by assignment in Python. Since " "assignment just creates references to objects, there's no alias between an " @@ -1017,7 +1015,7 @@ msgid "" "You can achieve the desired effect in a number of ways." msgstr "" "請記住,在 Python 中引數是透過賦值傳遞的。由於賦值只是建立對物件的參照,因此" -"呼叫者和被呼叫者的引數名稱之間沒有別名,因此本身沒有按參照呼叫。你可以透過多" +"呼叫者和被呼叫者的引數名稱之間沒有別名,因此本身沒有傳參照呼叫。你可以透過多" "種方式實作所需的效果。" #: ../../faq/programming.rst:517 @@ -1035,11 +1033,18 @@ msgid "" ">>> func1(x, y)\n" "('new-value', 100)" msgstr "" +">>> def func1(a, b):\n" +"... a = 'new-value' # a 和 b 為區域名稱\n" +"... b = b + 1 # 賦值到新物件\n" +"... return a, b # 回傳新值\n" +"...\n" +">>> x, y = 'old-value', 99\n" +">>> func1(x, y)\n" +"('new-value', 100)" #: ../../faq/programming.rst:528 -#, fuzzy msgid "This is almost always the clearest solution." -msgstr "這幾乎總是最清晰的解決方案。" +msgstr "這幾乎都會是最清楚的方案。" #: ../../faq/programming.rst:530 #, fuzzy @@ -1048,9 +1053,8 @@ msgid "" msgstr "透過使用全域變數。這不是執行緒安全的,不推薦。" #: ../../faq/programming.rst:532 -#, fuzzy msgid "By passing a mutable (changeable in-place) object::" -msgstr "透過傳遞一個可變的(原地可變的)物件: ::" +msgstr "透過傳遞一個可變的(可於原地 (in-place) 改變的)物件: ::" #: ../../faq/programming.rst:534 msgid "" @@ -1063,6 +1067,14 @@ msgid "" ">>> args\n" "['new-value', 100]" msgstr "" +">>> def func2(a):\n" +"... a[0] = 'new-value' # 'a' 參照一個可變的串列\n" +"... a[1] = a[1] + 1 # 改變共享的物件\n" +"...\n" +">>> args = ['old-value', 99]\n" +">>> func2(args)\n" +">>> args\n" +"['new-value', 100]" #: ../../faq/programming.rst:543 #, fuzzy @@ -1164,7 +1176,6 @@ msgstr "" " return self.a * x + self.b" #: ../../faq/programming.rst:598 -#, fuzzy msgid "In both cases, ::" msgstr "在這兩種情況下: ::" @@ -1260,8 +1271,8 @@ msgstr "" #: ../../faq/programming.rst:641 #, fuzzy msgid "" -"Some objects can be copied more easily. Dictionaries have a :meth:`~dict." -"copy` method::" +"Some objects can be copied more easily. Dictionaries have " +"a :meth:`~dict.copy` method::" msgstr "可以更輕鬆地複製某些物件。字典有一個 :meth:`~dict.copy` 方法: ::" #: ../../faq/programming.rst:644 @@ -1379,9 +1390,8 @@ msgid "" msgstr "....如果你發現它有很多名字,或者根本沒有名字,請不要感到驚訝!" #: ../../faq/programming.rst:701 -#, fuzzy msgid "What's up with the comma operator's precedence?" -msgstr "逗號運算子的優先級是怎麼回事?" +msgstr "逗號運算子的優先級是什麼?" #: ../../faq/programming.rst:703 #, fuzzy @@ -1482,7 +1492,7 @@ msgid "" "Bartelt::" msgstr "" "是的。通常這是透過在 :keyword:`!lambda` 中嵌套 :keyword:`lambda` 來完成的。請" -"參閱以下三個示例,稍微改編自 Ulf Bartelt: ::" +"參閱以下三個範例,稍微改編自 Ulf Bartelt: ::" #: ../../faq/programming.rst:747 msgid "" @@ -1518,7 +1528,7 @@ msgstr "孩子們,不要在家裡嘗試這個!" #: ../../faq/programming.rst:777 msgid "What does the slash(/) in the parameter list of a function mean?" -msgstr "函式參數串列中的斜槓 (/) 是什麼意思?" +msgstr "函式參數串列中的斜線 (/) 是什麼意思?" #: ../../faq/programming.rst:779 #, fuzzy @@ -1530,9 +1540,9 @@ msgid "" "position. For example, :func:`divmod` is a function that accepts positional-" "only parameters. Its documentation looks like this::" msgstr "" -"函式引數list中的斜杠表示它前面的參數是位置參數。僅位置參數是沒有外部可用名稱" -"的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置對映到參數。例如,:" -"func:`divmod` 是一個只接受位置參數的函式。它的文件看起來像這樣: ::" +"函式引數list中的斜線表示它前面的參數是位置參數。僅位置參數是沒有外部可用名稱" +"的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置對映到參數。例" +"如,:func:`divmod` 是一個只接受位置參數的函式。它的文件看起來像這樣: ::" #: ../../faq/programming.rst:786 msgid "" @@ -1549,14 +1559,13 @@ msgstr "" " Return the tuple (x//y, x%y). Invariant: div*y + mod == x." #: ../../faq/programming.rst:792 -#, fuzzy msgid "" "The slash at the end of the parameter list means that both parameters are " "positional-only. Thus, calling :func:`divmod` with keyword arguments would " "lead to an error::" msgstr "" -"參數list末尾的斜杠表示兩個參數都是位置參數。因此,使用關鍵字引數呼叫 :func:" -"`divmod` 會導致錯誤: ::" +"參數串列最後的斜線表示兩個參數都是僅限位置參數。因此使用關鍵字引數呼" +"叫 :func:`divmod` 會導致錯誤: ::" #: ../../faq/programming.rst:796 msgid "" @@ -1670,13 +1679,12 @@ msgid "How do I get int literal attribute instead of SyntaxError?" msgstr "如何取得 int 文字屬性而不是 SyntaxError?" #: ../../faq/programming.rst:850 -#, fuzzy msgid "" -"Trying to lookup an ``int`` literal attribute in the normal manner gives a :" -"exc:`SyntaxError` because the period is seen as a decimal point::" +"Trying to lookup an ``int`` literal attribute in the normal manner gives " +"a :exc:`SyntaxError` because the period is seen as a decimal point::" msgstr "" -"嘗試以正常方式查詢 ``int`` 文字屬性會給出一個 SyntaxError ,因為句點被視為小" -"數點: ::" +"嘗試以正常方式查找 ``int`` 字面值屬性會給出一個 :exc:`SyntaxError`,因為句點" +"被視為小數點: ::" #: ../../faq/programming.rst:853 msgid "" @@ -1693,11 +1701,10 @@ msgstr "" "SyntaxError: invalid decimal literal" #: ../../faq/programming.rst:859 -#, fuzzy msgid "" "The solution is to separate the literal from the period with either a space " "or parentheses." -msgstr "解決方案是用空格或圓括號將文字與句點分開。" +msgstr "解決方式是用空格或圓括號將字面值與句點分開。" #: ../../faq/programming.rst:869 msgid "How do I convert a string to a number?" @@ -1710,8 +1717,8 @@ msgid "" "``int('144') == 144``. Similarly, :func:`float` converts to a floating-" "point number, e.g. ``float('144') == 144.0``." msgstr "" -"對於整數,使用內建的 int 型別構造函式,例如``int('144') == 144``。同樣,:" -"func:`float` 轉換為浮點數,例如``浮動('144')== 144.0``。" +"對於整數,使用內建的 int 型別建構函式,例如``int('144') == 144``。同" +"樣,:func:`float` 轉換為浮點數,例如``浮動('144')== 144.0``。" #: ../../faq/programming.rst:875 #, fuzzy @@ -1765,22 +1772,20 @@ msgid "" "in type constructor :func:`str`. If you want a hexadecimal or octal " "representation, use the built-in functions :func:`hex` or :func:`oct`. For " "fancy formatting, see the :ref:`f-strings` and :ref:`formatstrings` " -"sections, e.g. ``\"{:04d}\".format(144)`` yields ``'0144'`` and ``\"{:.3f}\"." -"format(1.0/3.0)`` yields ``'0.333'``." +"sections, e.g. ``\"{:04d}\".format(144)`` yields ``'0144'`` and ``\"{:.3f}" +"\".format(1.0/3.0)`` yields ``'0.333'``." msgstr "" -"例如,要將數字 ``144`` 轉換為字串 ``'144'``,請使用內建型別構造函式 :func:" -"`str`。如果你想要十六進製或八進製表示,請使用內建函式 :func:`hex` 或 :func:" -"`oct`。對於精美的格式,請參閱:ref:`f-strings` 和:ref:`formatstrings` 部分,例" -"如``\"{:04d}\".format(144)`` 產生 ``'0144'`` 和 ``\"{:.3f}\"." -"format(1.0/3.0)`` 產生 ``'0.333'`` ." +"例如,要將數字 ``144`` 轉換為字串 ``'144'``,請使用內建型別建構函" +"式 :func:`str`。如果你想要十六進製或八進製表示,請使用內建函式 :func:`hex` " +"或 :func:`oct`。對於精美的格式,請參閱:ref:`f-strings` " +"和:ref:`formatstrings` 部分,例如``\"{:04d}\".format(144)`` 產生 ``'0144'`` " +"和 ``\"{:.3f}\".format(1.0/3.0)`` 產生 ``'0.333'`` ." #: ../../faq/programming.rst:906 -#, fuzzy msgid "How do I modify a string in place?" msgstr "如何原地修改字串?" #: ../../faq/programming.rst:908 -#, fuzzy msgid "" "You can't, because strings are immutable. In most situations, you should " "simply construct a new string from the various parts you want to assemble it " @@ -1788,12 +1793,11 @@ msgid "" "unicode data, try using an :class:`io.StringIO` object or the :mod:`array` " "module::" msgstr "" -"你不能,因為字串是不可變的。在大多數情況下,你應該簡單地從要組裝的各個部分構" -"造一個新字串。但是,如果你需要一個能夠修改原地 unicode 資料的物件,請嘗試使" +"這沒辦法做到,因為字串是不可變的。在大多數情況下,你應以要拿來組裝的各個部分" +"建構出一個新字串。但是如果你需要一個能夠原地修改 unicode 資料的物件,請嘗試使" "用 :class:`io.StringIO` 物件或 :mod:`array` 模組: ::" #: ../../faq/programming.rst:914 -#, fuzzy msgid "" ">>> import io\n" ">>> s = \"Hello, world\"\n" @@ -1830,24 +1834,22 @@ msgstr "" "'Hello, there!'\n" "\n" ">>> import array\n" -">>> a = array.array('u', s)\n" +">>> a = array.array('w', s)\n" ">>> print(a)\n" -"array('u', 'Hello, world')\n" +"array('w', 'Hello, world')\n" ">>> a[0] = 'y'\n" ">>> print(a)\n" -"array('u', 'yello, world')\n" +"array('w', 'yello, world')\n" ">>> a.tounicode()\n" "'yello, world'" #: ../../faq/programming.rst:938 -#, fuzzy msgid "How do I use strings to call functions/methods?" msgstr "如何使用字串呼叫函式/方法?" #: ../../faq/programming.rst:940 -#, fuzzy msgid "There are various techniques." -msgstr "有各種各樣的技術。" +msgstr "有各式各樣的技法。" #: ../../faq/programming.rst:942 #, fuzzy @@ -1858,7 +1860,7 @@ msgid "" "a case construct::" msgstr "" "最好的方法是使用將字串對映到函式的字典。這種技術的主要優點是字串不需要與函式" -"名稱相匹配。這也是用於模擬案例構造的主要技術: ::" +"名稱相匹配。這也是用於模擬案例建構的主要技術: ::" #: ../../faq/programming.rst:947 msgid "" @@ -1886,7 +1888,6 @@ msgstr "" "getattr(foo, 'bar')()" #: ../../faq/programming.rst:962 -#, fuzzy msgid "" "Note that :func:`getattr` works on any object, including classes, class " "instances, modules, and so on." @@ -1942,11 +1943,11 @@ msgstr "" "f()" #: ../../faq/programming.rst:990 -#, fuzzy msgid "" "Is there an equivalent to Perl's chomp() for removing trailing newlines from " "strings?" -msgstr "是否有與 Perl 的 chomp() 等效的方法用於從字串中刪除尾隨換行符?" +msgstr "" +"是否有與 Perl 的 chomp() 等效的方法,能用於從字串中刪除後綴的換行符號?" #: ../../faq/programming.rst:992 msgid "" @@ -1981,9 +1982,8 @@ msgstr "" "很好。" #: ../../faq/programming.rst:1009 -#, fuzzy msgid "Is there a scanf() or sscanf() equivalent?" -msgstr "是否有 scanf() 或 sscanf() 等價物?" +msgstr "是否有 scanf() 或 sscanf() 的等效方法?" #: ../../faq/programming.rst:1011 #, fuzzy @@ -1995,15 +1995,15 @@ msgstr "不是這樣的。" msgid "" "For simple input parsing, the easiest approach is usually to split the line " "into whitespace-delimited words using the :meth:`~str.split` method of " -"string objects and then convert decimal strings to numeric values using :" -"func:`int` or :func:`float`. :meth:`!split` supports an optional \"sep\" " -"parameter which is useful if the line uses something other than whitespace " -"as a separator." +"string objects and then convert decimal strings to numeric values " +"using :func:`int` or :func:`float`. :meth:`!split` supports an optional " +"\"sep\" parameter which is useful if the line uses something other than " +"whitespace as a separator." msgstr "" "對於簡單的輸入解析,最簡單的方法通常是使用字串物件的 :meth:`~str.split` 方法" -"將行拆分為以空格分隔的單詞,然後使用 :func:`int` 或將十進製字串轉換為數值:" -"func:`浮動`。 :meth:`!split` 支援可選的 \"sep\" 參數,如果該行使用空格以外的" -"其他內容作為分隔符,該參數很有用。" +"將行拆分為以空格分隔的單詞,然後使用 :func:`int` 或將十進製字串轉換為數" +"值:func:`浮動`。 :meth:`!split` 支援可選的 \"sep\" 參數,如果該行使用空格以外" +"的其他內容作為分隔符,該參數很有用。" #: ../../faq/programming.rst:1019 #, fuzzy @@ -2024,14 +2024,14 @@ msgstr "請參閱 :ref:`unicode-howto`。" #: ../../faq/programming.rst:1032 #, fuzzy msgid "Can I end a raw string with an odd number of backslashes?" -msgstr "我可以用奇數個反斜杠結束原始字串嗎?" +msgstr "我可以用奇數個反斜線結束原始字串嗎?" #: ../../faq/programming.rst:1034 #, fuzzy msgid "" "A raw string ending with an odd number of backslashes will escape the " "string's quote::" -msgstr "以奇數個反斜杠結尾的原始字串將轉義字串的引號: ::" +msgstr "以奇數個反斜線結尾的原始字串將轉義字串的引號: ::" #: ../../faq/programming.rst:1036 msgid "" @@ -2052,7 +2052,7 @@ msgstr "" msgid "" "There are several workarounds for this. One is to use regular strings and " "double the backslashes::" -msgstr "有幾種解決方法。一種是使用常規字串並加倍反斜杠: ::" +msgstr "有幾種解決方法。一種是使用常規字串並加倍反斜線: ::" #: ../../faq/programming.rst:1045 msgid "" @@ -2067,7 +2067,7 @@ msgstr "" msgid "" "Another is to concatenate a regular string containing an escaped backslash " "to the raw string::" -msgstr "另一種方法是將包含轉義反斜杠的常規字串連接到原始字串: ::" +msgstr "另一種方法是將包含轉義反斜線的常規字串連接到原始字串: ::" #: ../../faq/programming.rst:1051 msgid "" @@ -2082,7 +2082,7 @@ msgstr "" msgid "" "It is also possible to use :func:`os.path.join` to append a backslash on " "Windows::" -msgstr "也可以使用 :func:`os.path.join` 在 Windows 上附加反斜杠: ::" +msgstr "也可以使用 :func:`os.path.join` 在 Windows 上附加反斜線: ::" #: ../../faq/programming.rst:1056 msgid "" @@ -2100,8 +2100,8 @@ msgid "" "the value of the raw string. That is, the backslash remains present in the " "value of the raw string::" msgstr "" -"請注意,雖然為了確定原始字串的結束位置而使用反斜杠「跳脫」引號,但在解釋原始" -"字串的值時不會發生轉義。也就是說,反斜杠仍然存在於原始字串的值中: ::" +"請注意,雖然為了確定原始字串的結束位置而使用反斜線「跳脫」引號,但在解釋原始" +"字串的值時不會發生轉義。也就是說,反斜線仍然存在於原始字串的值中: ::" #: ../../faq/programming.rst:1064 msgid "" @@ -2152,8 +2152,8 @@ msgid "" "You should always find the hot spots in your program *before* attempting to " "optimize any code (see the :mod:`profile` module)." msgstr "" -"在嘗試最佳化任何程式碼\\ *之前*,你應該始終找到程式中的熱點(請參閱 :mod:" -"`profile` 模組)。" +"在嘗試最佳化任何程式碼\\ *之前*,你應該始終找到程式中的熱點(請參" +"閱 :mod:`profile` 模組)。" #: ../../faq/programming.rst:1084 #, fuzzy @@ -2208,15 +2208,15 @@ msgid "" "When the standard library provides a primitive for doing something, it is " "likely (although not guaranteed) to be faster than any alternative you may " "come up with. This is doubly true for primitives written in C, such as " -"builtins and some extension types. For example, be sure to use either the :" -"meth:`list.sort` built-in method or the related :func:`sorted` function to " -"do sorting (and see the :ref:`sortinghowto` for examples of moderately " +"builtins and some extension types. For example, be sure to use either " +"the :meth:`list.sort` built-in method or the related :func:`sorted` function " +"to do sorting (and see the :ref:`sortinghowto` for examples of moderately " "advanced usage)." msgstr "" "當標準函式庫提供用於執行某些操作的原語時,它很可能(儘管不能保證)比你可能想" "出的任何替代方法都更快。對於用 C 編寫的原語,例如內建函式和一些擴充型別,情況" "更是如此。例如,請務必使用 :meth:`list.sort` 內建方法或相關的 :func:`sorted` " -"函式進行排序(有關高階用法的示例,請參閱 :ref:`sortinghowto` )." +"函式進行排序(有關高階用法的範例,請參閱 :ref:`sortinghowto` )." #: ../../faq/programming.rst:1109 #, fuzzy @@ -2280,8 +2280,8 @@ msgid "" "To accumulate many :class:`str` objects, the recommended idiom is to place " "them into a list and call :meth:`str.join` at the end::" msgstr "" -"要累積許多 :class:`str` 物件,推薦的習慣用法是將它們放入list中並在末尾呼叫 :" -"meth:`str.join`: ::" +"要累積許多 :class:`str` 物件,推薦的習慣用法是將它們放入list中並在末尾呼" +"叫 :meth:`str.join`: ::" #: ../../faq/programming.rst:1141 msgid "" @@ -2324,13 +2324,12 @@ msgid "How do I convert between tuples and lists?" msgstr "如何在元組和list之間進行轉換?" #: ../../faq/programming.rst:1162 -#, fuzzy msgid "" "The type constructor ``tuple(seq)`` converts any sequence (actually, any " "iterable) into a tuple with the same items in the same order." msgstr "" -"型別構造器 ``tuple(seq)`` 將任何序列(實際上是任何可疊代物件)轉換為具有相同" -"順序的相同項的元組。" +"型別建構函式 ``tuple(seq)`` 將任何序列(實際上是任何可疊代物件)轉換為具有相" +"同順序的相同項的元組。" #: ../../faq/programming.rst:1165 #, fuzzy @@ -2352,7 +2351,7 @@ msgid "" "3))`` yields ``[1, 2, 3]`` and ``list('abc')`` yields ``['a', 'b', 'c']``. " "If the argument is a list, it makes a copy just like ``seq[:]`` would." msgstr "" -"型別構造函式 ``list(seq)`` 將任何序列或可疊代物件轉換為具有相同順序的相同項目" +"型別建構函式 ``list(seq)`` 將任何序列或可疊代物件轉換為具有相同順序的相同項目" "的list。例如,``list((1, 2, 3))`` 產生``[1, 2, 3]`` 和``list('abc')`` 產生" "``['a', 'b ', 'c']``。如果引數是一個list,它會像 ``seq[:]`` 那樣製作一個副" "本。" @@ -2446,8 +2445,8 @@ msgstr "" #: ../../faq/programming.rst:1220 #, fuzzy msgid "" -"If all elements of the list may be used as set keys (i.e. they are all :term:" -"`hashable`) this is often faster ::" +"If all elements of the list may be used as set keys (i.e. they are " +"all :term:`hashable`) this is often faster ::" msgstr "" "如果list的所有元素都可以用作集合鍵(即它們都是 :term:`hashable`),這通常會更" "快: ::" @@ -2644,8 +2643,8 @@ msgstr "如何將方法或函式應用於一系列物件?" #: ../../faq/programming.rst:1327 #, fuzzy msgid "" -"To call a method or function and accumulate the return values is a list, a :" -"term:`list comprehension` is an elegant solution::" +"To call a method or function and accumulate the return values is a list, " +"a :term:`list comprehension` is an elegant solution::" msgstr "" "呼叫一個方法或函式並累積回傳值是一個list,一個 :term:`list comprehension` 是" "一個優雅的解決方案: ::" @@ -2697,7 +2696,7 @@ msgid "" "a ``list`` and ``+=`` as our exemplar." msgstr "" "當擴充賦值運算子應用於指向可變物件的元組元素時,此討論通常適用,但我們將使用 " -"``list`` 和 ``+=\" 作為示例。" +"``list`` 和 ``+=\" 作為範例。" #: ../../faq/programming.rst:1356 #, fuzzy @@ -2788,11 +2787,11 @@ msgid "" "to calling :meth:`!extend` on the list and returning the list. That's why " "we say that for lists, ``+=`` is a \"shorthand\" for :meth:`!list.extend`::" msgstr "" -"要了解為什麼會發生這種情況,你需要知道 (a) 如果一個物件實作了一個 :meth:" -"`~object.__iadd__` 魔術方法,它會在執行 ``+=`` 增廣賦值時被呼叫,並且它的回傳" -"value 是賦值陳述式中使用的值; (b) 對於list,:meth:`!__iadd__` 相當於在list上" -"呼叫 :meth:`!extend` 並回傳list。這就是為什麼我們說對於list,``+=`` 是 :meth:" -"`!list.extend` 的「簡寫」: ::" +"要了解為什麼會發生這種情況,你需要知道 (a) 如果一個物件實作了一" +"個 :meth:`~object.__iadd__` 魔術方法,它會在執行 ``+=`` 增廣賦值時被呼叫,並" +"且它的回傳value 是賦值陳述式中使用的值; (b) 對於list,:meth:`!__iadd__` 相當" +"於在list上呼叫 :meth:`!extend` 並回傳list。這就是為什麼我們說對於list," +"``+=`` 是 :meth:`!list.extend` 的「簡寫」: ::" #: ../../faq/programming.rst:1404 msgid "" @@ -2831,9 +2830,8 @@ msgstr "" "賦值仍然發生。" #: ../../faq/programming.rst:1419 -#, fuzzy msgid "Thus, in our tuple example what is happening is equivalent to::" -msgstr "因此,在我們的元組示例中,發生的事情等同於: ::" +msgstr "因此,在我們的元組範例中,發生的事情等同於: ::" #: ../../faq/programming.rst:1421 msgid "" @@ -2843,6 +2841,11 @@ msgid "" " ...\n" "TypeError: 'tuple' object does not support item assignment" msgstr "" +">>> result = a_tuple[0].__iadd__(['item'])\n" +">>> a_tuple[0] = result\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" #: ../../faq/programming.rst:1427 #, fuzzy @@ -2857,7 +2860,6 @@ msgstr "" "可變的。" #: ../../faq/programming.rst:1433 -#, fuzzy msgid "" "I want to do a complicated sort: can you do a Schwartzian Transform in " "Python?" @@ -2872,7 +2874,7 @@ msgid "" "method::" msgstr "" "該技術歸功於 Perl 社區的 Randal Schwartz,它透過將每個元素對映到其「排序值」" -"的度量對list的元素進行排序。在 Python 中,對 :meth:`list.sort` 方法使用 " +"的度量對串列的元素進行排序。在 Python 中,對 :meth:`list.sort` 方法使用 " "``key`` 引數: ::" #: ../../faq/programming.rst:1439 @@ -2884,18 +2886,16 @@ msgstr "" "Isorted.sort(key=lambda s: int(s[10:15]))" #: ../../faq/programming.rst:1444 -#, fuzzy msgid "How can I sort one list by values from another list?" -msgstr "如何根據另一個list中的值對一個list進行排序?" +msgstr "如何根據另一個串列中的值對一個串列進行排序?" #: ../../faq/programming.rst:1446 -#, fuzzy msgid "" "Merge them into an iterator of tuples, sort the resulting list, and then " "pick out the element you want. ::" msgstr "" -"將它們合併到一個元組疊代器中,對結果list進行排序,然後挑選出你想要的元" -"素。: ::" +"將它們合併到一個元組疊代器中,對結果的串列進行排序,然後挑選出你想要的元" +"素。 ::" #: ../../faq/programming.rst:1449 msgid "" @@ -2962,8 +2962,8 @@ msgstr "什麼是方法 (method)?" #: ../../faq/programming.rst:1481 #, fuzzy msgid "" -"A method is a function on some object ``x`` that you normally call as ``x." -"name(arguments...)``. Methods are defined as functions inside the class " +"A method is a function on some object ``x`` that you normally call as " +"``x.name(arguments...)``. Methods are defined as functions inside the class " "definition::" msgstr "" "方法是一些物件 ``x`` 上的函式,你通常將其稱為 ``x.name(arguments...)`` 。方法" @@ -2980,21 +2980,19 @@ msgstr "" " return arg * 2 + self.attribute" #: ../../faq/programming.rst:1491 -#, fuzzy msgid "What is self?" -msgstr "什麼是自我?" +msgstr "什麼是 self?" #: ../../faq/programming.rst:1493 -#, fuzzy msgid "" "Self is merely a conventional name for the first argument of a method. A " "method defined as ``meth(self, a, b, c)`` should be called as ``x.meth(a, b, " "c)`` for some instance ``x`` of the class in which the definition occurs; " "the called method will think it is called as ``meth(x, a, b, c)``." msgstr "" -"Self 只是方法第一個引數的約定名稱。一個定義為 ``meth(self, a, b, c)`` 的方法" -"應該被呼叫為 ``x.meth(a, b, c)`` 對於其中類別的某個實例 ``x``定義發生;被呼叫" -"的方法會認為它被稱為 ``meth(x, a, b, c)`` 。" +"Self 只是方法第一個引數的約定名稱。對於所定義類別的某個實例 ``x``,一個定義" +"為 ``meth(self, a, b, c)`` 的方法應該以 ``x.meth(a, b, c)`` 形式來呼叫;被呼" +"叫的方法會認為它是以 ``meth(x, a, b, c)`` 來呼叫的。" #: ../../faq/programming.rst:1498 msgid "See also :ref:`why-self`." @@ -3024,16 +3022,16 @@ msgstr "" "complex))``。" #: ../../faq/programming.rst:1511 -#, fuzzy msgid "" -"Note that :func:`isinstance` also checks for virtual inheritance from an :" -"term:`abstract base class`. So, the test will return ``True`` for a " +"Note that :func:`isinstance` also checks for virtual inheritance from " +"an :term:`abstract base class`. So, the test will return ``True`` for a " "registered class even if hasn't directly or indirectly inherited from it. " "To test for \"true inheritance\", scan the :term:`MRO` of the class:" msgstr "" -"請注意:func:`isinstance` 還檢查來自:term:`抽象基底類別` 的虛擬繼承。因此,測" -"試將為已註冊的類別回傳 ``True``,即使沒有直接或間接繼承自它。要測試「真正的繼" -"承」,請掃描該類別的 MRO:" +"請注意,:func:`isinstance` 還會檢查來自\\ :term:`抽象基底類別 (abstract base " +"class) <abstract base class>` 的虛擬繼承。因此對已註冊類別的檢驗會回傳 " +"``True``,即使沒有直接或間接繼承自它。要測試「真正繼承」,請掃描該類別" +"的 :term:`MRO`:" #: ../../faq/programming.rst:1516 msgid "" @@ -3075,6 +3073,21 @@ msgid "" ">>> Mapping in type(c).__mro__\n" "False" msgstr "" +">>> c = C()\n" +">>> isinstance(c, C) # 直接\n" +"True\n" +">>> isinstance(c, P) # 間接\n" +"True\n" +">>> isinstance(c, Mapping) # 虛擬\n" +"True\n" +"\n" +"# 實際的繼承鏈結\n" +">>> type(c).__mro__\n" +"(<class 'C'>, <class 'P'>, <class 'object'>)\n" +"\n" +"# 「真正繼承」的檢驗\n" +">>> Mapping in type(c).__mro__\n" +"False" #: ../../faq/programming.rst:1546 #, fuzzy @@ -3101,17 +3114,16 @@ msgid "" msgstr "" "def search(obj):\n" " if isinstance(obj, Mailbox):\n" -" ... # code to search a mailbox\n" +" ... # 搜尋信箱的程式碼\n" " elif isinstance(obj, Document):\n" -" ... # code to search a document\n" +" ... # 搜尋文件的程式碼\n" " elif ..." #: ../../faq/programming.rst:1560 -#, fuzzy msgid "" "A better approach is to define a ``search()`` method on all the classes and " "just call it::" -msgstr "更好的方法是在所有類別上定義一個 ``search()`` 方法,然後呼叫它: ::" +msgstr "更好的方法是在所有類別上定義一個 ``search()`` 方法然後呼叫它: ::" #: ../../faq/programming.rst:1563 msgid "" @@ -3125,6 +3137,15 @@ msgid "" "\n" "obj.search()" msgstr "" +"class Mailbox:\n" +" def search(self):\n" +" ... # 搜尋信箱的程式碼\n" +"\n" +"class Document:\n" +" def search(self):\n" +" ... # 搜尋文件的程式碼\n" +"\n" +"obj.search()" #: ../../faq/programming.rst:1575 #, fuzzy @@ -3151,8 +3172,8 @@ msgid "" "following class implements a class that behaves like a file but converts all " "written data to uppercase::" msgstr "" -"Python 程式員可以輕鬆實作委託。例如,下面的類別實作了一個行為類似於檔案但將所" -"有寫入資料轉換為大寫的類別: ::" +"Python 程式設計師可以輕鬆實作委託。例如,下面的類別實作了一個行為類似於檔案但" +"將所有寫入資料轉換為大寫的類別: ::" #: ../../faq/programming.rst:1587 msgid "" @@ -3182,29 +3203,29 @@ msgstr "" #, fuzzy msgid "" "Here the ``UpperOut`` class redefines the ``write()`` method to convert the " -"argument string to uppercase before calling the underlying ``self._outfile." -"write()`` method. All other methods are delegated to the underlying ``self." -"_outfile`` object. The delegation is accomplished via the :meth:`~object." -"__getattr__` method; consult :ref:`the language reference <attribute-" -"access>` for more information about controlling attribute access." +"argument string to uppercase before calling the underlying " +"``self._outfile.write()`` method. All other methods are delegated to the " +"underlying ``self._outfile`` object. The delegation is accomplished via " +"the :meth:`~object.__getattr__` method; consult :ref:`the language reference " +"<attribute-access>` for more information about controlling attribute access." msgstr "" -"這裡的 ``UpperOut`` 類別重新定義了``write()`` 方法,在呼叫底層的``self." -"_outfile.write()`` 方法之前將引數字串轉換為大寫。所有其他方法都委託給底層的 " -"``self._outfile`` 物件。委託是透過 :meth:`~object.__getattr__` 方法完成的;有" -"關控制屬性存取的更多資訊,請參閱語言參考 <attribute-access>。" +"這裡的 ``UpperOut`` 類別重新定義了``write()`` 方法,在呼叫底層的" +"``self._outfile.write()`` 方法之前將引數字串轉換為大寫。所有其他方法都委託給" +"底層的 ``self._outfile`` 物件。委託是透過 :meth:`~object.__getattr__` 方法完" +"成的;有關控制屬性存取的更多資訊,請參閱語言參考 <attribute-access>。" #: ../../faq/programming.rst:1605 #, fuzzy msgid "" "Note that for more general cases delegation can get trickier. When " -"attributes must be set as well as retrieved, the class must define a :meth:" -"`~object.__setattr__` method too, and it must do so carefully. The basic " -"implementation of :meth:`!__setattr__` is roughly equivalent to the " +"attributes must be set as well as retrieved, the class must define " +"a :meth:`~object.__setattr__` method too, and it must do so carefully. The " +"basic implementation of :meth:`!__setattr__` is roughly equivalent to the " "following::" msgstr "" "請注意,對於更一般的情況,委託可能會變得更加棘手。當必須設定和檢索屬性時,該" -"類別也必須定義一個 :meth:`~object.__setattr__` 方法,而且必須小心謹慎。 :" -"meth:`!__setattr__` 的基本實作大致等同於以下: ::" +"類別也必須定義一個 :meth:`~object.__setattr__` 方法,而且必須小心謹" +"慎。 :meth:`!__setattr__` 的基本實作大致等同於以下: ::" #: ../../faq/programming.rst:1610 msgid "" @@ -3221,16 +3242,15 @@ msgstr "" " ..." #: ../../faq/programming.rst:1616 -#, fuzzy msgid "" -"Many :meth:`~object.__setattr__` implementations call :meth:`!object." -"__setattr__` to set an attribute on self without causing infinite recursion::" +"Many :meth:`~object.__setattr__` implementations call :meth:`!" +"object.__setattr__` to set an attribute on self without causing infinite " +"recursion::" msgstr "" -"大多數 :meth:`!__setattr__` 實作必須修改 :meth:`self.__dict__ <object." -"__dict__>` 以存儲 self 的本地狀態,而不會導致無限遞迴。" +"許多 :meth:`~object.__setattr__` 的實作會呼叫 :meth:`!object.__setattr__` 以" +"設定 self 的屬性,而不會導致無限遞迴。" #: ../../faq/programming.rst:1619 -#, fuzzy msgid "" "class X:\n" " def __setattr__(self, name, value):\n" @@ -3238,15 +3258,14 @@ msgid "" " object.__setattr__(self, name, value)" msgstr "" "class X:\n" -" ...\n" " def __setattr__(self, name, value):\n" -" self.__dict__[name] = value\n" -" ..." +" # 自訂邏輯放在這裡...\n" +" object.__setattr__(self, name, value)" #: ../../faq/programming.rst:1624 msgid "" -"Alternatively, it is possible to set attributes by inserting entries into :" -"attr:`self.__dict__ <object.__dict__>` directly." +"Alternatively, it is possible to set attributes by inserting entries " +"into :attr:`self.__dict__ <object.__dict__>` directly." msgstr "" #: ../../faq/programming.rst:1629 @@ -3268,18 +3287,15 @@ msgid "" msgstr "" "class Derived(Base):\n" " def meth(self):\n" -" super().meth() # calls Base.meth" +" super().meth() # 呼叫 Base.meth" #: ../../faq/programming.rst:1637 -#, fuzzy msgid "" "In the example, :func:`super` will automatically determine the instance from " "which it was called (the ``self`` value), look up the :term:`method " "resolution order` (MRO) with ``type(self).__mro__``, and return the next in " "line after ``Derived`` in the MRO: ``Base``." msgstr "" -"在示例中,:func:`super` 將自動確定呼叫它的實例(``self`` 值),使用 " -"``type(self ).__mro__``,並回傳 MRO 中``Derived`` 之後的下一行:``Base``。" #: ../../faq/programming.rst:1644 #, fuzzy @@ -3348,6 +3364,14 @@ msgid "" " def getcount(self):\n" " return C.count # or return self.count" msgstr "" +"class C:\n" +" count = 0 # C.__init__ 被呼叫的次數\n" +"\n" +" def __init__(self):\n" +" C.count = C.count + 1\n" +"\n" +" def getcount(self):\n" +" return C.count # 或回傳 self.count" #: ../../faq/programming.rst:1678 #, fuzzy @@ -3422,15 +3446,14 @@ msgstr "" #: ../../faq/programming.rst:1708 #, fuzzy msgid "How can I overload constructors (or methods) in Python?" -msgstr "如何在 Python 中重載構造函式(或方法)?" +msgstr "如何在 Python 中重載建構函式(或方法)?" #: ../../faq/programming.rst:1710 -#, fuzzy msgid "" "This answer actually applies to all methods, but the question usually comes " "up first in the context of constructors." msgstr "" -"這個答案實際上適用於所有方法,但這個問題通常首先出現在構造函式的上下文中。" +"這個答案實際上適用於所有方法,但這個問題通常會先出現在建構函式的情境中。" #: ../../faq/programming.rst:1713 msgid "In C++ you'd write" @@ -3449,12 +3472,11 @@ msgstr "" "}" #: ../../faq/programming.rst:1722 -#, fuzzy msgid "" "In Python you have to write a single constructor that catches all cases " "using default arguments. For example::" msgstr "" -"在 Python 中,你必須編寫一個構造函式來捕獲所有使用預設引數的情況。例如: ::" +"在 Python 中,你必須編寫一個建構函式來捕獲所有使用預設引數的情況。例如: ::" #: ../../faq/programming.rst:1725 msgid "" @@ -3473,14 +3495,12 @@ msgstr "" " print(\"Argument is\", i)" #: ../../faq/programming.rst:1732 -#, fuzzy msgid "This is not entirely equivalent, but close enough in practice." -msgstr "這並不完全等價,但在實踐中足夠接近。" +msgstr "這並不完全等價,但在實際情況中已夠接近。" #: ../../faq/programming.rst:1734 -#, fuzzy msgid "You could also try a variable-length argument list, e.g. ::" -msgstr "你也可以嘗試可變長度引數 list,例如: ::" +msgstr "你也可以嘗試長度可變的引數串列,例如: ::" #: ../../faq/programming.rst:1736 msgid "" @@ -3491,12 +3511,10 @@ msgstr "" " ..." #: ../../faq/programming.rst:1739 -#, fuzzy msgid "The same approach works for all method definitions." -msgstr "相同的方法適用於所有方法定義。" +msgstr "相同的手段適用於所有方法的定義。" #: ../../faq/programming.rst:1743 -#, fuzzy msgid "I try to use __spam and I get an error about _SomeClassName__spam." msgstr "我嘗試使用 __spam,但收到有關 _SomeClassName__spam 的錯誤。" @@ -3564,21 +3582,19 @@ msgid "" msgstr "" #: ../../faq/programming.rst:1778 -#, fuzzy msgid "My class defines __del__ but it is not called when I delete the object." msgstr "我的類別定義了 __del__ 但是當我刪除物件時它沒有被呼叫。" #: ../../faq/programming.rst:1780 -#, fuzzy msgid "There are several possible reasons for this." msgstr "這有幾個可能的原因。" #: ../../faq/programming.rst:1782 #, fuzzy msgid "" -"The :keyword:`del` statement does not necessarily call :meth:`~object." -"__del__` -- it simply decrements the object's reference count, and if this " -"reaches zero :meth:`!__del__` is called." +"The :keyword:`del` statement does not necessarily " +"call :meth:`~object.__del__` -- it simply decrements the object's reference " +"count, and if this reaches zero :meth:`!__del__` is called." msgstr "" ":keyword:`del` 陳述式不一定呼叫 :meth:`~object.__del__` -- 它只是減少物件的引" "用計數,如果達到零,則呼叫 :meth:`!__del__`。" @@ -3637,8 +3653,8 @@ msgid "" "Finally, if your :meth:`!__del__` method raises an exception, a warning " "message is printed to :data:`sys.stderr`." msgstr "" -"最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告訊息印出到 :data:" -"`sys.stderr`。" +"最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告訊息印出" +"到 :data:`sys.stderr`。" #: ../../faq/programming.rst:1822 #, fuzzy @@ -3652,8 +3668,8 @@ msgid "" "type). You can program the class's constructor to keep track of all " "instances by keeping a list of weak references to each instance." msgstr "" -"Python 不會跟踪類別(或內建型別)的所有實例。你可以對類別的構造函式進行編程," -"以透過保留對每個實例的弱參照list來跟踪所有實例。" +"Python 不會追蹤類別(或內建型別)的所有實例。你可以對類別的建構函式進行編程," +"以透過保留對每個實例的弱參照串列來追蹤所有實例。" #: ../../faq/programming.rst:1830 msgid "Why does the result of ``id()`` appear to be not unique?" @@ -3801,25 +3817,24 @@ msgstr "在標準函式庫程式碼中,你將看到幾種正確使用識別性 #: ../../faq/programming.rst:1908 msgid "" -"1) As recommended by :pep:`8`, an identity test is the preferred way to " -"check for ``None``. This reads like plain English in code and avoids " -"confusion with other objects that may have boolean values that evaluate to " -"false." +"As recommended by :pep:`8`, an identity test is the preferred way to check " +"for ``None``. This reads like plain English in code and avoids confusion " +"with other objects that may have boolean values that evaluate to false." msgstr "" -"1) 正如 :pep:`8` 所推薦的,識別性測試是檢查 ``None`` 的首選方法。這在程式碼中" -"讀起來像簡單的英語,並避免與其他可能具有評估為 false 的布林值的物件混淆。" +"正如 :pep:`8` 所推薦的,識別性測試是檢查 ``None`` 的首選方法。這在程式碼中讀" +"起來像簡單的英語,並避免與其他可能具有評估為 false 的布林值的物件混淆。" #: ../../faq/programming.rst:1912 #, fuzzy msgid "" -"2) Detecting optional arguments can be tricky when ``None`` is a valid input " +"Detecting optional arguments can be tricky when ``None`` is a valid input " "value. In those situations, you can create a singleton sentinel object " "guaranteed to be distinct from other objects. For example, here is how to " -"implement a method that behaves like :meth:`dict.pop`::" +"implement a method that behaves like :meth:`dict.pop`:" msgstr "" -"2)當 ``None`` 是有效輸入值時,檢測可選引數可能會很棘手。在這些情況下,你可以" -"建立一個保證與其他物件不同的單例哨兵物件。例如,這裡是如何實作一個行為類似" -"於 :meth:`dict.pop` 的方法: ::" +"當 ``None`` 是有效輸入值時,檢測可選引數可能會很棘手。在這些情況下,你可以建" +"立一個保證與其他物件不同的單例哨兵物件。例如,這裡是如何實作一個行為類似" +"於 :meth:`dict.pop` 的方法:" #: ../../faq/programming.rst:1917 msgid "" @@ -3845,23 +3860,23 @@ msgstr "" " raise KeyError(key)\n" " return default" -#: ../../faq/programming.rst:1928 +#: ../../faq/programming.rst:1930 msgid "" -"3) Container implementations sometimes need to augment equality tests with " +"Container implementations sometimes need to augment equality tests with " "identity tests. This prevents the code from being confused by objects such " "as ``float('NaN')`` that are not equal to themselves." msgstr "" -"3) 容器實作有時需要透過識別性測試來增強相等性測試。這可以防止程式碼被諸如 " +"容器實作有時需要透過識別性測試來增強相等性測試。這可以防止程式碼被諸如 " "float('NaN') 之類的不等於自身的物件所混淆。" -#: ../../faq/programming.rst:1932 +#: ../../faq/programming.rst:1934 msgid "" -"For example, here is the implementation of :meth:`!collections.abc.Sequence." -"__contains__`::" +"For example, here is the implementation of :meth:`!" +"collections.abc.Sequence.__contains__`::" msgstr "" "例如,以下是 :meth:`!collections.abc.Sequence.__contains__` 的實作: ::" -#: ../../faq/programming.rst:1935 +#: ../../faq/programming.rst:1937 msgid "" "def __contains__(self, value):\n" " for v in self:\n" @@ -3875,12 +3890,12 @@ msgstr "" " return True\n" " return False" -#: ../../faq/programming.rst:1943 +#: ../../faq/programming.rst:1945 msgid "" "How can a subclass control what data is stored in an immutable instance?" msgstr "子類別如何控制不可變實例中存儲的資料?" -#: ../../faq/programming.rst:1945 +#: ../../faq/programming.rst:1947 #, fuzzy msgid "" "When subclassing an immutable type, override the :meth:`~object.__new__` " @@ -3888,18 +3903,17 @@ msgid "" "*after* an instance is created, which is too late to alter data in an " "immutable instance." msgstr "" -"當對不可變型別進行子類別化時,覆蓋 :meth:`~object.__new__` 方法而不是 :meth:" -"`~object.__init__` 方法。後者僅在*建立實例後*運行,這為時已晚,無法更改不可變" -"實例中的資料。" +"當對不可變型別進行子類別化時,覆蓋 :meth:`~object.__new__` 方法而不" +"是 :meth:`~object.__init__` 方法。後者僅在*建立實例後*運行,這為時已晚,無法" +"更改不可變實例中的資料。" -#: ../../faq/programming.rst:1950 -#, fuzzy +#: ../../faq/programming.rst:1952 msgid "" "All of these immutable classes have a different signature than their parent " "class:" msgstr "所有這些不可變類別都具有與其父類別不同的簽名:" -#: ../../faq/programming.rst:1953 +#: ../../faq/programming.rst:1955 msgid "" "from datetime import date\n" "\n" @@ -3922,12 +3936,32 @@ msgid "" " s = ''.join([c for c in s if c.isalnum() or c == '-'])\n" " return super().__new__(cls, s)" msgstr "" +"from datetime import date\n" +"\n" +"class FirstOfMonthDate(date):\n" +" \"總是選擇每個月的第一天\"\n" +" def __new__(cls, year, month, day):\n" +" return super().__new__(cls, year, month, 1)\n" +"\n" +"class NamedInt(int):\n" +" \"允許一些數字的文字名稱\"\n" +" xlat = {'zero': 0, 'one': 1, 'ten': 10}\n" +" def __new__(cls, value):\n" +" value = cls.xlat.get(value, value)\n" +" return super().__new__(cls, value)\n" +"\n" +"class TitleStr(str):\n" +" \"將 str 轉換成適合作為 URL 路徑的名稱\"\n" +" def __new__(cls, s):\n" +" s = s.lower().replace(' ', '-')\n" +" s = ''.join([c for c in s if c.isalnum() or c == '-'])\n" +" return super().__new__(cls, s)" -#: ../../faq/programming.rst:1976 +#: ../../faq/programming.rst:1978 msgid "The classes can be used like this:" msgstr "這些類別可以像這樣使用:" -#: ../../faq/programming.rst:1978 +#: ../../faq/programming.rst:1980 msgid "" ">>> FirstOfMonthDate(2012, 2, 14)\n" "FirstOfMonthDate(2012, 2, 1)\n" @@ -3947,31 +3981,33 @@ msgstr "" ">>> TitleStr('Blog: Why Python Rocks')\n" "'blog-why-python-rocks'" -#: ../../faq/programming.rst:1993 +#: ../../faq/programming.rst:1995 msgid "How do I cache method calls?" msgstr "如何快取方法呼叫?" -#: ../../faq/programming.rst:1995 +#: ../../faq/programming.rst:1997 #, fuzzy msgid "" -"The two principal tools for caching methods are :func:`functools." -"cached_property` and :func:`functools.lru_cache`. The former stores results " -"at the instance level and the latter at the class level." +"The two principal tools for caching methods " +"are :func:`functools.cached_property` and :func:`functools.lru_cache`. The " +"former stores results at the instance level and the latter at the class " +"level." msgstr "" -"快取方法的兩個主要工具是 func:`functools.cached_property` 和 :func:" -"`functools.lru_cache`。前者在實例級別存儲結果,後者在類別級別存儲結果。" +"快取方法的兩個主要工具是 func:`functools.cached_property` " +"和 :func:`functools.lru_cache`。前者在實例級別存儲結果,後者在類別級別存儲結" +"果。" -#: ../../faq/programming.rst:2000 +#: ../../faq/programming.rst:2002 #, fuzzy msgid "" "The *cached_property* approach only works with methods that do not take any " "arguments. It does not create a reference to the instance. The cached " "method result will be kept only as long as the instance is alive." msgstr "" -"*cached_property* 方法僅適用於不帶任何引數的方法。它不會建立對實例的參照。只" +"*cached_property* 方法僅適用於不帶任何引數的方法,它不會建立對實例的參照,只" "要實例還活著,快取的方法結果就會被保留。" -#: ../../faq/programming.rst:2004 +#: ../../faq/programming.rst:2006 #, fuzzy msgid "" "The advantage is that when an instance is no longer used, the cached method " @@ -3982,7 +4018,7 @@ msgstr "" "好處是當一個實例不再使用時,快取的方法結果會立即釋放。缺點是如果實例累積,累" "積的方法結果也會累積。他們可以不受限制地成長。" -#: ../../faq/programming.rst:2009 +#: ../../faq/programming.rst:2011 msgid "" "The *lru_cache* approach works with methods that have :term:`hashable` " "arguments. It creates a reference to the instance unless special efforts " @@ -3991,7 +4027,7 @@ msgstr "" "*lru_cache* 方法適用於具有\\ :term:`可雜湊 <hashable>`\\ 引數的方法。除非特別" "努力傳遞弱參照,否則它會建立對實例的參照。" -#: ../../faq/programming.rst:2013 +#: ../../faq/programming.rst:2015 #, fuzzy msgid "" "The advantage of the least recently used algorithm is that the cache is " @@ -4001,11 +4037,11 @@ msgstr "" "最近最少使用演算法的優點是快取受指定的 *maxsize* 限制。缺點是實例會一直保持活" "動狀態,直到它們從快取中老化或快取被清除。" -#: ../../faq/programming.rst:2018 +#: ../../faq/programming.rst:2020 msgid "This example shows the various techniques::" msgstr "這個例子展示了各種技術: ::" -#: ../../faq/programming.rst:2020 +#: ../../faq/programming.rst:2022 msgid "" "class Weather:\n" " \"Lookup weather information on a government website\"\n" @@ -4030,7 +4066,7 @@ msgid "" " # Depends on the station_id, date, and units." msgstr "" -#: ../../faq/programming.rst:2042 +#: ../../faq/programming.rst:2044 #, fuzzy msgid "" "The above example assumes that the *station_id* never changes. If the " @@ -4040,18 +4076,19 @@ msgstr "" "上面的例子假設 *station_id* 永遠不會改變。如果相關的實例屬性是可變的,則 " "*cached_property* 方法無法工作,因為它無法檢測到屬性的更改。" -#: ../../faq/programming.rst:2047 +#: ../../faq/programming.rst:2049 #, fuzzy msgid "" "To make the *lru_cache* approach work when the *station_id* is mutable, the " -"class needs to define the :meth:`~object.__eq__` and :meth:`~object." -"__hash__` methods so that the cache can detect relevant attribute updates::" +"class needs to define the :meth:`~object.__eq__` " +"and :meth:`~object.__hash__` methods so that the cache can detect relevant " +"attribute updates::" msgstr "" -"要在 *station_id* 可變時使 *lru_cache* 方法起作用,該類別需要定義 :meth:" -"`~object.__eq__` 和 :meth:`~object.__hash__` 方法,以便快取可以檢測相關屬性更" -"新: ::" +"要在 *station_id* 可變時使 *lru_cache* 方法起作用,該類別需要定" +"義 :meth:`~object.__eq__` 和 :meth:`~object.__hash__` 方法,以便快取可以檢測" +"相關屬性更新: ::" -#: ../../faq/programming.rst:2051 +#: ../../faq/programming.rst:2053 msgid "" "class Weather:\n" " \"Example with a mutable station identifier\"\n" @@ -4074,15 +4111,15 @@ msgid "" " # Depends on the station_id, date, and units." msgstr "" -#: ../../faq/programming.rst:2073 +#: ../../faq/programming.rst:2075 msgid "Modules" msgstr "模組" -#: ../../faq/programming.rst:2076 +#: ../../faq/programming.rst:2078 msgid "How do I create a .pyc file?" msgstr "如何建立 .pyc 檔案?" -#: ../../faq/programming.rst:2078 +#: ../../faq/programming.rst:2080 #, fuzzy msgid "" "When a module is imported for the first time (or when the source file has " @@ -4096,10 +4133,10 @@ msgstr "" "第一次引入模組時(或者源檔案自建立當前編譯檔案後發生更改時)應在 " "``__pycache__`` 的子目錄中建立包含編譯程式碼的 ``.pyc`` 檔案包含 .py 檔案的目" "錄。 ``.pyc`` 檔案的檔案名以與``.py`` 檔案相同的名稱開頭,以``.pyc`` 結尾,中" -"間部分依賴於特定的``python `` 建立它的二進製檔案。(有關詳細資訊,請參閱 :" -"pep:`3147`。)" +"間部分依賴於特定的``python `` 建立它的二進製檔案。(有關詳細資訊,請參" +"閱 :pep:`3147`。)" -#: ../../faq/programming.rst:2086 +#: ../../faq/programming.rst:2088 #, fuzzy msgid "" "One reason that a ``.pyc`` file may not be created is a permissions problem " @@ -4112,7 +4149,7 @@ msgstr "" "__pycache__ 子目錄。例如,如果你以一個使用者的身份開發但以另一個使用者的身份" "運行,例如你正在使用 Web 服務器進行測試,就會發生這種情況。" -#: ../../faq/programming.rst:2091 +#: ../../faq/programming.rst:2093 #, fuzzy msgid "" "Unless the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable is set, " @@ -4125,13 +4162,13 @@ msgstr "" "組並且 Python 有能力(權限、空閒空間等)建立一個 .pyc 檔案是自動的建立一個" "``__pycache__ `` 子目錄並將編譯後的模組寫入該子目錄。" -#: ../../faq/programming.rst:2096 +#: ../../faq/programming.rst:2098 #, fuzzy msgid "" -"Running Python on a top level script is not considered an import and no ``." -"pyc`` will be created. For example, if you have a top-level module ``foo." -"py`` that imports another module ``xyz.py``, when you run ``foo`` (by typing " -"``python foo.py`` as a shell command), a ``.pyc`` will be created for " +"Running Python on a top level script is not considered an import and no " +"``.pyc`` will be created. For example, if you have a top-level module " +"``foo.py`` that imports another module ``xyz.py``, when you run ``foo`` (by " +"typing ``python foo.py`` as a shell command), a ``.pyc`` will be created for " "``xyz`` because ``xyz`` is imported, but no ``.pyc`` file will be created " "for ``foo`` since ``foo.py`` isn't being imported." msgstr "" @@ -4140,17 +4177,17 @@ msgstr "" "入 ``python foo.py`` 作為一個 shell 命令),將為 xyz 建立一個 .pyc 因為引入" "了 xyz,但是不會為 foo 建立 .pyc 檔案,因為 ` `foo.py`` 沒有被引入。" -#: ../../faq/programming.rst:2103 +#: ../../faq/programming.rst:2105 msgid "" -"If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a ``." -"pyc`` file for a module that is not imported -- you can, using the :mod:" -"`py_compile` and :mod:`compileall` modules." +"If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a " +"``.pyc`` file for a module that is not imported -- you can, using " +"the :mod:`py_compile` and :mod:`compileall` modules." msgstr "" "如果你需要為 ``foo`` 建立一個 ``.pyc`` 檔案 —— 也就是說,要為一個未引入的模組" "建立一個 ``.pyc`` 檔案 —— 你可以使用 :mod:`py_compile` 和 :mod:`compileall` " "模組。" -#: ../../faq/programming.rst:2107 +#: ../../faq/programming.rst:2109 msgid "" "The :mod:`py_compile` module can manually compile any module. One way is to " "use the ``compile()`` function in that module interactively::" @@ -4158,7 +4195,7 @@ msgstr "" ":mod:`py_compile` 模組允許手動編譯任何模組。其中一種方法是在該模組中以交互方" "式使用 ``compile()`` 函式: ::" -#: ../../faq/programming.rst:2110 +#: ../../faq/programming.rst:2112 msgid "" ">>> import py_compile\n" ">>> py_compile.compile('foo.py') " @@ -4166,7 +4203,7 @@ msgstr "" ">>> import py_compile\n" ">>> py_compile.compile('foo.py') " -#: ../../faq/programming.rst:2113 +#: ../../faq/programming.rst:2115 msgid "" "This will write the ``.pyc`` to a ``__pycache__`` subdirectory in the same " "location as ``foo.py`` (or you can override that with the optional parameter " @@ -4175,7 +4212,7 @@ msgstr "" "這會將 ``.pyc`` 寫入與 ``foo.py`` 相同位置的 ``__pycache__`` 子目錄(或者你可" "以使用可選參數 ``cfile`` 覆蓋它)。" -#: ../../faq/programming.rst:2117 +#: ../../faq/programming.rst:2119 #, fuzzy msgid "" "You can also automatically compile all files in a directory or directories " @@ -4186,15 +4223,15 @@ msgstr "" "你還可以使用 :mod:`compileall` 模組自動編譯目錄中的所有檔案。你可以在 shell " "提示符下運行 ``compileall.py`` 並提供包含要編譯的 Python 檔案的目錄路徑: ::" -#: ../../faq/programming.rst:2122 +#: ../../faq/programming.rst:2124 msgid "python -m compileall ." msgstr "python -m compileall ." -#: ../../faq/programming.rst:2126 +#: ../../faq/programming.rst:2128 msgid "How do I find the current module name?" msgstr "如何找到當前模組名稱?" -#: ../../faq/programming.rst:2128 +#: ../../faq/programming.rst:2130 #, fuzzy msgid "" "A module can find out its own module name by looking at the predefined " @@ -4207,7 +4244,7 @@ msgstr "" "值為``'__main__'``,則該程式作為腳本運行。許多通常透過引入使用的模組還提供命" "令行介面或自檢,只有在檢查 ``__name__`` 後才執行此程式碼: ::" -#: ../../faq/programming.rst:2134 +#: ../../faq/programming.rst:2136 msgid "" "def main():\n" " print('Running test...')\n" @@ -4223,19 +4260,19 @@ msgstr "" "if __name__ == '__main__':\n" " main()" -#: ../../faq/programming.rst:2143 +#: ../../faq/programming.rst:2145 msgid "How can I have modules that mutually import each other?" msgstr "要怎樣才能擁有相互引入的模組?" -#: ../../faq/programming.rst:2145 +#: ../../faq/programming.rst:2147 msgid "Suppose you have the following modules:" msgstr "假設你有以下模組:" -#: ../../faq/programming.rst:2147 +#: ../../faq/programming.rst:2149 msgid ":file:`foo.py`::" msgstr ":file:`foo.py`: ::" -#: ../../faq/programming.rst:2149 +#: ../../faq/programming.rst:2151 msgid "" "from bar import bar_var\n" "foo_var = 1" @@ -4243,11 +4280,11 @@ msgstr "" "from bar import bar_var\n" "foo_var = 1" -#: ../../faq/programming.rst:2152 +#: ../../faq/programming.rst:2154 msgid ":file:`bar.py`::" msgstr ":file:`bar.py`: ::" -#: ../../faq/programming.rst:2154 +#: ../../faq/programming.rst:2156 msgid "" "from foo import foo_var\n" "bar_var = 2" @@ -4255,42 +4292,42 @@ msgstr "" "from foo import foo_var\n" "bar_var = 2" -#: ../../faq/programming.rst:2157 +#: ../../faq/programming.rst:2159 msgid "The problem is that the interpreter will perform the following steps:" msgstr "問題是直譯器將執行以下步驟:" -#: ../../faq/programming.rst:2159 +#: ../../faq/programming.rst:2161 msgid "main imports ``foo``" msgstr "主要引入 ``foo``" -#: ../../faq/programming.rst:2160 +#: ../../faq/programming.rst:2162 msgid "Empty globals for ``foo`` are created" msgstr "建立了 ``foo`` 的空全域變數" -#: ../../faq/programming.rst:2161 +#: ../../faq/programming.rst:2163 msgid "``foo`` is compiled and starts executing" msgstr "``foo`` 被編譯並開始執行" -#: ../../faq/programming.rst:2162 +#: ../../faq/programming.rst:2164 msgid "``foo`` imports ``bar``" msgstr "``foo`` 引入 ``bar``" -#: ../../faq/programming.rst:2163 +#: ../../faq/programming.rst:2165 msgid "Empty globals for ``bar`` are created" msgstr "建立了 ``bar`` 的空全域變數" -#: ../../faq/programming.rst:2164 +#: ../../faq/programming.rst:2166 msgid "``bar`` is compiled and starts executing" msgstr "``bar`` 已被編譯並開始執行" -#: ../../faq/programming.rst:2165 +#: ../../faq/programming.rst:2167 msgid "" "``bar`` imports ``foo`` (which is a no-op since there already is a module " "named ``foo``)" msgstr "" "``bar`` 引入 ``foo``\\ (這是一個空操作,因為已經有一個名為 ``foo`` 的模組)" -#: ../../faq/programming.rst:2166 +#: ../../faq/programming.rst:2168 msgid "" "The import mechanism tries to read ``foo_var`` from ``foo`` globals, to set " "``bar.foo_var = foo.foo_var``" @@ -4298,8 +4335,7 @@ msgstr "" "引入機制嘗試從 ``foo`` 全域變數中讀取 ``foo_var``,以設定 ``bar.foo_var = " "foo.foo_var``" -#: ../../faq/programming.rst:2168 -#, fuzzy +#: ../../faq/programming.rst:2170 msgid "" "The last step fails, because Python isn't done with interpreting ``foo`` yet " "and the global symbol dictionary for ``foo`` is still empty." @@ -4307,7 +4343,7 @@ msgstr "" "最後一步失敗了,因為 Python 還沒有完成對 ``foo`` 的直譯,而 ``foo`` 的全域符" "號字典仍然是空的。" -#: ../../faq/programming.rst:2171 +#: ../../faq/programming.rst:2173 #, fuzzy msgid "" "The same thing happens when you use ``import foo``, and then try to access " @@ -4316,52 +4352,52 @@ msgstr "" "當你使用 ``import foo``,然後嘗試在全域程式碼中存取 ``foo.foo_var`` 時,也會" "發生同樣的事情。" -#: ../../faq/programming.rst:2174 +#: ../../faq/programming.rst:2176 msgid "There are (at least) three possible workarounds for this problem." msgstr "此問題有(至少)三種可能的解決方法。" -#: ../../faq/programming.rst:2176 +#: ../../faq/programming.rst:2178 #, fuzzy msgid "" -"Guido van Rossum recommends avoiding all uses of ``from <module> import ..." -"``, and placing all code inside functions. Initializations of global " -"variables and class variables should use constants or built-in functions " -"only. This means everything from an imported module is referenced as " -"``<module>.<name>``." +"Guido van Rossum recommends avoiding all uses of ``from <module> " +"import ...``, and placing all code inside functions. Initializations of " +"global variables and class variables should use constants or built-in " +"functions only. This means everything from an imported module is referenced " +"as ``<module>.<name>``." msgstr "" "Guido van Rossum 建議避免使用``from <module> import ...``,並將所有程式碼放在" "函式中。全域變數和類別變數的初始化應該只使用常數或內建函式。這意味著來自引入" "模組的所有內容都被參照為 ``<module>.<name>``。" -#: ../../faq/programming.rst:2181 +#: ../../faq/programming.rst:2183 msgid "" "Jim Roskind suggests performing steps in the following order in each module:" msgstr "Jim Roskind 建議在每個模組中按以下順序執行各個步驟:" -#: ../../faq/programming.rst:2183 +#: ../../faq/programming.rst:2185 #, fuzzy msgid "" "exports (globals, functions, and classes that don't need imported base " "classes)" msgstr "匯出(不需要引入基底類別的全域變數、函式和類別)" -#: ../../faq/programming.rst:2185 +#: ../../faq/programming.rst:2187 msgid "``import`` statements" msgstr "``import`` 陳述式" -#: ../../faq/programming.rst:2186 +#: ../../faq/programming.rst:2188 msgid "" "active code (including globals that are initialized from imported values)." msgstr "活躍程式碼(包括從引入值初始化的全域變數)。" -#: ../../faq/programming.rst:2188 +#: ../../faq/programming.rst:2190 msgid "" "Van Rossum doesn't like this approach much because the imports appear in a " "strange place, but it does work." msgstr "" "Van Rossum 不太喜歡這種方法,因為引入出現在一個奇怪的地方,但它確實有效。" -#: ../../faq/programming.rst:2191 +#: ../../faq/programming.rst:2193 msgid "" "Matthias Urlichs recommends restructuring your code so that the recursive " "import is not necessary in the first place." @@ -4369,15 +4405,15 @@ msgstr "" "Matthias Urlichs 建議重組 (restructuring) 你的程式碼,以便打從一開始就不需要" "遞迴引入。" -#: ../../faq/programming.rst:2194 +#: ../../faq/programming.rst:2196 msgid "These solutions are not mutually exclusive." msgstr "這些方案並不衝突。" -#: ../../faq/programming.rst:2198 +#: ../../faq/programming.rst:2200 msgid "__import__('x.y.z') returns <module 'x'>; how do I get z?" msgstr "__import__('x.y.z') 回傳 <module 'x'>,那我怎麼得到 z?" -#: ../../faq/programming.rst:2200 +#: ../../faq/programming.rst:2202 #, fuzzy msgid "" "Consider using the convenience function :func:`~importlib.import_module` " @@ -4386,17 +4422,17 @@ msgstr "" "考慮使用來自 :mod:`importlib` 的便利函式 :func:`~importlib.import_module` 代" "替: ::" -#: ../../faq/programming.rst:2203 +#: ../../faq/programming.rst:2205 msgid "z = importlib.import_module('x.y.z')" msgstr "z = importlib.import_module('x.y.z')" -#: ../../faq/programming.rst:2207 +#: ../../faq/programming.rst:2209 msgid "" "When I edit an imported module and reimport it, the changes don't show up. " "Why does this happen?" msgstr "當我編輯需要引入的模組並重新引入它時,更動沒有反應出來。為什麼會這樣?" -#: ../../faq/programming.rst:2209 +#: ../../faq/programming.rst:2211 #, fuzzy msgid "" "For reasons of efficiency as well as consistency, Python only reads the " @@ -4409,7 +4445,7 @@ msgstr "" "一個由許多模組組成的程式中,每個模組都引入相同的基本模組,基本模組將被解析和" "重新解析很多次。要強制重新讀取已更改的模組,請執行以下操作: ::" -#: ../../faq/programming.rst:2215 +#: ../../faq/programming.rst:2217 msgid "" "import importlib\n" "import modname\n" @@ -4419,17 +4455,17 @@ msgstr "" "import modname\n" "importlib.reload(modname)" -#: ../../faq/programming.rst:2219 +#: ../../faq/programming.rst:2221 msgid "" "Warning: this technique is not 100% fool-proof. In particular, modules " "containing statements like ::" msgstr "警告:此技術並非 100% 萬無一失。尤其是包含像這樣陳述式的模組: ::" -#: ../../faq/programming.rst:2222 +#: ../../faq/programming.rst:2224 msgid "from modname import some_objects" msgstr "from modname import some_objects" -#: ../../faq/programming.rst:2224 +#: ../../faq/programming.rst:2226 #, fuzzy msgid "" "will continue to work with the old version of the imported objects. If the " @@ -4440,7 +4476,7 @@ msgstr "" "將繼續使用舊版本的引入物件。如果模組包含類別定義,現有的類別實例將*不會*更新" "為使用新的類別定義。這可能會導致以下自相矛盾的行為: ::" -#: ../../faq/programming.rst:2229 +#: ../../faq/programming.rst:2231 msgid "" ">>> import importlib\n" ">>> import cls\n" @@ -4450,14 +4486,21 @@ msgid "" ">>> isinstance(c, cls.C) # isinstance is false?!?\n" "False" msgstr "" +">>> import importlib\n" +">>> import cls\n" +">>> c = cls.C() # 建立一個 C 的實例\n" +">>> importlib.reload(cls)\n" +"<module 'cls' from 'cls.py'>\n" +">>> isinstance(c, cls.C) # isinstance 為 false?!?\n" +"False" -#: ../../faq/programming.rst:2237 +#: ../../faq/programming.rst:2239 msgid "" "The nature of the problem is made clear if you print out the \"identity\" of " "the class objects::" msgstr "如果印出類別物件的「識別性」,問題的本質就很清楚了: ::" -#: ../../faq/programming.rst:2240 +#: ../../faq/programming.rst:2242 msgid "" ">>> hex(id(c.__class__))\n" "'0x7352a0'\n" diff --git a/glossary.po b/glossary.po index 8c54be9e05..780dc58513 100644 --- a/glossary.po +++ b/glossary.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # Translators: # Steven Hsu <hsuhaochun@gmail.com>, 2021-2022 @@ -8,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-31 00:13+0000\n" +"POT-Creation-Date: 2025-01-21 00:13+0000\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -69,22 +68,23 @@ msgid "" "define interfaces when other techniques like :func:`hasattr` would be clumsy " "or subtly wrong (for example with :ref:`magic methods <special-lookup>`). " "ABCs introduce virtual subclasses, which are classes that don't inherit from " -"a class but are still recognized by :func:`isinstance` and :func:" -"`issubclass`; see the :mod:`abc` module documentation. Python comes with " -"many built-in ABCs for data structures (in the :mod:`collections.abc` " -"module), numbers (in the :mod:`numbers` module), streams (in the :mod:`io` " -"module), import finders and loaders (in the :mod:`importlib.abc` module). " -"You can create your own ABCs with the :mod:`abc` module." +"a class but are still recognized by :func:`isinstance` " +"and :func:`issubclass`; see the :mod:`abc` module documentation. Python " +"comes with many built-in ABCs for data structures (in " +"the :mod:`collections.abc` module), numbers (in the :mod:`numbers` module), " +"streams (in the :mod:`io` module), import finders and loaders (in " +"the :mod:`importlib.abc` module). You can create your own ABCs with " +"the :mod:`abc` module." msgstr "" "抽象基底類別(又稱為 ABC)提供了一種定義介面的方法,作為 :term:`duck-" "typing`\\ (鴨子型別)的補充。其他類似的技術,像是 :func:`hasattr`,則顯得笨" "拙或是帶有細微的錯誤(例如使用\\ :ref:`魔術方法 (magic method) <special-" "lookup>`\\ )。ABC 採用虛擬的 subclass(子類別),它們並不繼承自另一個 class" -"(類別),但仍可被 :func:`isinstance` 及 :func:`issubclass` 辨識;請參閱 :" -"mod:`abc` 模組的說明文件。Python 有許多內建的 ABC,用於資料結構(在 :mod:" -"`collections.abc` 模組)、數字(在 :mod:`numbers` 模組)、串流(在 :mod:`io` " -"模組)及 import 尋檢器和載入器(在 :mod:`importlib.abc` 模組)。你可以使用 :" -"mod:`abc` 模組建立自己的 ABC。" +"(類別),但仍可被 :func:`isinstance` 及 :func:`issubclass` 辨識;請參" +"閱 :mod:`abc` 模組的說明文件。Python 有許多內建的 ABC,用於資料結構" +"(在 :mod:`collections.abc` 模組)、數字(在 :mod:`numbers` 模組)、串流" +"(在 :mod:`io` 模組)及 import 尋檢器和載入器(在 :mod:`importlib.abc` 模" +"組)。你可以使用 :mod:`abc` 模組建立自己的 ABC。" #: ../../glossary.rst:38 msgid "annotation" @@ -112,12 +112,12 @@ msgstr "" #: ../../glossary.rst:50 msgid "" "See :term:`variable annotation`, :term:`function annotation`, :pep:`484` " -"and :pep:`526`, which describe this functionality. Also see :ref:" -"`annotations-howto` for best practices on working with annotations." +"and :pep:`526`, which describe this functionality. Also " +"see :ref:`annotations-howto` for best practices on working with annotations." msgstr "" "請參閱 :term:`variable annotation`、:term:`function annotation`、:pep:`484` " -"和 :pep:`526`,這些章節皆有此功能的說明。關於註釋的最佳實踐方法也請參閱 :ref:" -"`annotations-howto`。" +"和 :pep:`526`,這些章節皆有此功能的說明。關於註釋的最佳實踐方法也請參" +"閱 :ref:`annotations-howto`。" #: ../../glossary.rst:54 msgid "argument" @@ -197,12 +197,12 @@ msgstr "asynchronous context manager(非同步情境管理器)" #: ../../glossary.rst:86 msgid "" "An object which controls the environment seen in an :keyword:`async with` " -"statement by defining :meth:`~object.__aenter__` and :meth:`~object." -"__aexit__` methods. Introduced by :pep:`492`." +"statement by defining :meth:`~object.__aenter__` " +"and :meth:`~object.__aexit__` methods. Introduced by :pep:`492`." msgstr "" -"一個可以控制 :keyword:`async with` 陳述式中所見環境的物件,而它是透過定義 :" -"meth:`~object.__aenter__` 和 :meth:`~object.__aexit__` method(方法)來控制" -"的。由 :pep:`492` 引入。" +"一個可以控制 :keyword:`async with` 陳述式中所見環境的物件,而它是透過定" +"義 :meth:`~object.__aenter__` 和 :meth:`~object.__aexit__` method(方法)來控" +"制的。由 :pep:`492` 引入。" #: ../../glossary.rst:89 msgid "asynchronous generator" @@ -217,8 +217,8 @@ msgid "" msgstr "" "一個會回傳 :term:`asynchronous generator iterator`\\ (非同步產生器疊代器)的" "函式。它看起來像一個以 :keyword:`async def` 定義的協程函式 (coroutine " -"function),但不同的是它包含了 :keyword:`yield` 運算式,能生成一系列可用於 :" -"keyword:`async for` 迴圈的值。" +"function),但不同的是它包含了 :keyword:`yield` 運算式,能生成一系列可用" +"於 :keyword:`async for` 迴圈的值。" #: ../../glossary.rst:96 msgid "" @@ -249,28 +249,28 @@ msgstr "" #: ../../glossary.rst:107 msgid "" -"This is an :term:`asynchronous iterator` which when called using the :meth:" -"`~object.__anext__` method returns an awaitable object which will execute " -"the body of the asynchronous generator function until the next :keyword:" -"`yield` expression." +"This is an :term:`asynchronous iterator` which when called using " +"the :meth:`~object.__anext__` method returns an awaitable object which will " +"execute the body of the asynchronous generator function until the " +"next :keyword:`yield` expression." msgstr "" -"這是一個 :term:`asynchronous iterator`\\ (非同步疊代器),當它以 :meth:" -"`~object.__anext__` method 被呼叫時,會回傳一個可等待物件 (awaitable " -"object),該物件將執行非同步產生器的函式主體,直到遇到下一個 :keyword:`yield` " -"運算式。" +"這是一個 :term:`asynchronous iterator`\\ (非同步疊代器),當它" +"以 :meth:`~object.__anext__` method 被呼叫時,會回傳一個可等待物件 " +"(awaitable object),該物件將執行非同步產生器的函式主體,直到遇到下一" +"個 :keyword:`yield` 運算式。" #: ../../glossary.rst:112 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " -"location execution state (including local variables and pending try-" -"statements). When the *asynchronous generator iterator* effectively resumes " -"with another awaitable returned by :meth:`~object.__anext__`, it picks up " -"where it left off. See :pep:`492` and :pep:`525`." +"execution state (including local variables and pending try-statements). " +"When the *asynchronous generator iterator* effectively resumes with another " +"awaitable returned by :meth:`~object.__anext__`, it picks up where it left " +"off. See :pep:`492` and :pep:`525`." msgstr "" -"每個 :keyword:`yield` 會暫停處理程序,並記住位置執行狀態(包括區域變數及擱置" -"中的 try 陳述式)。當\\ *非同步產生器疊代器*\\ 以另一個被 :meth:`~object." -"__anext__` 回傳的可等待物件有效地回復時,它會從停止的地方繼續執行。請參閱 :" -"pep:`492` 和 :pep:`525`。" +"每個 :keyword:`yield` 會暫停處理程序,並記住執行狀態(包括區域變數及擱置中的 " +"try 陳述式)。當\\ *非同步產生器疊代器*\\ 以另一個" +"被 :meth:`~object.__anext__` 回傳的可等待物件有效地回復時,它會從停止的地方繼" +"續執行。請參閱 :pep:`492` 和 :pep:`525`。" #: ../../glossary.rst:117 msgid "asynchronous iterable" @@ -282,9 +282,9 @@ msgid "" "return an :term:`asynchronous iterator` from its :meth:`~object.__aiter__` " "method. Introduced by :pep:`492`." msgstr "" -"一個物件,它可以在 :keyword:`async for` 陳述式中被使用。必須從它的 :meth:" -"`~object.__aiter__` method 回傳一個 :term:`asynchronous iterator`\\ (非同步" -"疊代器)。由 :pep:`492` 引入。" +"一個物件,它可以在 :keyword:`async for` 陳述式中被使用。必須從它" +"的 :meth:`~object.__aiter__` method 回傳一個 :term:`asynchronous iterator`\\ " +"(非同步疊代器)。由 :pep:`492` 引入。" #: ../../glossary.rst:122 msgid "asynchronous iterator" @@ -292,17 +292,18 @@ msgstr "asynchronous iterator(非同步疊代器)" #: ../../glossary.rst:124 msgid "" -"An object that implements the :meth:`~object.__aiter__` and :meth:`~object." -"__anext__` methods. :meth:`~object.__anext__` must return an :term:" -"`awaitable` object. :keyword:`async for` resolves the awaitables returned by " -"an asynchronous iterator's :meth:`~object.__anext__` method until it raises " -"a :exc:`StopAsyncIteration` exception. Introduced by :pep:`492`." +"An object that implements the :meth:`~object.__aiter__` " +"and :meth:`~object.__anext__` methods. :meth:`~object.__anext__` must " +"return an :term:`awaitable` object. :keyword:`async for` resolves the " +"awaitables returned by an asynchronous iterator's :meth:`~object.__anext__` " +"method until it raises a :exc:`StopAsyncIteration` exception. Introduced " +"by :pep:`492`." msgstr "" "一個實作 :meth:`~object.__aiter__` 和 :meth:`~object.__anext__` method 的物" "件。:meth:`~object.__anext__` 必須回傳一個 :term:`awaitable`\\ (可等待物" "件)。:keyword:`async for` 會解析非同步疊代器的 :meth:`~object.__anext__` " -"method 所回傳的可等待物件,直到它引發 :exc:`StopAsyncIteration` 例外。由 :" -"pep:`492` 引入。" +"method 所回傳的可等待物件,直到它引發 :exc:`StopAsyncIteration` 例外。" +"由 :pep:`492` 引入。" #: ../../glossary.rst:129 msgid "attribute" @@ -320,10 +321,10 @@ msgstr "" #: ../../glossary.rst:136 msgid "" "It is possible to give an object an attribute whose name is not an " -"identifier as defined by :ref:`identifiers`, for example using :func:" -"`setattr`, if the object allows it. Such an attribute will not be accessible " -"using a dotted expression, and would instead need to be retrieved with :func:" -"`getattr`." +"identifier as defined by :ref:`identifiers`, for example " +"using :func:`setattr`, if the object allows it. Such an attribute will not " +"be accessible using a dotted expression, and would instead need to be " +"retrieved with :func:`getattr`." msgstr "" "如果一個物件允許,給予該物件一個名稱不是由\\ :ref:`identifiers`\\ 所定義之識" "別符 (identifier) 的屬性是有可能的,例如使用 :func:`setattr`。像這樣的屬性將" @@ -335,13 +336,13 @@ msgstr "awaitable(可等待物件)" #: ../../glossary.rst:143 msgid "" -"An object that can be used in an :keyword:`await` expression. Can be a :" -"term:`coroutine` or an object with an :meth:`~object.__await__` method. See " -"also :pep:`492`." +"An object that can be used in an :keyword:`await` expression. Can be " +"a :term:`coroutine` or an object with an :meth:`~object.__await__` method. " +"See also :pep:`492`." msgstr "" -"一個可以在 :keyword:`await` 運算式中被使用的物件。它可以是一個 :term:" -"`coroutine`\\ (協程),或是一個有 :meth:`~object.__await__` method 的物件。" -"另請參閱 :pep:`492`。" +"一個可以在 :keyword:`await` 運算式中被使用的物件。它可以是一" +"個 :term:`coroutine`\\ (協程),或是一個有 :meth:`~object.__await__` method " +"的物件。另請參閱 :pep:`492`。" #: ../../glossary.rst:146 msgid "BDFL" @@ -349,8 +350,8 @@ msgstr "BDFL" #: ../../glossary.rst:148 msgid "" -"Benevolent Dictator For Life, a.k.a. `Guido van Rossum <https://gvanrossum." -"github.io/>`_, Python's creator." +"Benevolent Dictator For Life, a.k.a. `Guido van Rossum <https://" +"gvanrossum.github.io/>`_, Python's creator." msgstr "" "Benevolent Dictator For Life(終身仁慈獨裁者),又名 `Guido van Rossum " "<https://gvanrossum.github.io/>`_,Python 的創造者。" @@ -363,23 +364,23 @@ msgstr "binary file(二進位檔案)" msgid "" "A :term:`file object` able to read and write :term:`bytes-like objects " "<bytes-like object>`. Examples of binary files are files opened in binary " -"mode (``'rb'``, ``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer <sys." -"stdin>`, :data:`sys.stdout.buffer <sys.stdout>`, and instances of :class:`io." -"BytesIO` and :class:`gzip.GzipFile`." +"mode (``'rb'``, ``'wb'`` or ``'rb+'``), :data:`sys.stdin.buffer " +"<sys.stdin>`, :data:`sys.stdout.buffer <sys.stdout>`, and instances " +"of :class:`io.BytesIO` and :class:`gzip.GzipFile`." msgstr "" "一個能夠讀取和寫入 :term:`bytes-like objects <bytes-like object>`\\ (類位元" "組串物件)的 :term:`file object`\\ (檔案物件)。二進位檔案的例子有:以二進位" "模式(``'rb'``、``'wb'`` 或 ``'rb+'``)開啟的檔案、:data:`sys.stdin.buffer " -"<sys.stdin>`、:data:`sys.stdout.buffer <sys.stdout>`,以及 :class:`io." -"BytesIO` 和 :class:`gzip.GzipFile` 實例。" +"<sys.stdin>`、:data:`sys.stdout.buffer <sys.stdout>`,以" +"及 :class:`io.BytesIO` 和 :class:`gzip.GzipFile` 實例。" #: ../../glossary.rst:159 msgid "" -"See also :term:`text file` for a file object able to read and write :class:" -"`str` objects." +"See also :term:`text file` for a file object able to read and " +"write :class:`str` objects." msgstr "" -"另請參閱 :term:`text file`\\ (文字檔案),它是一個能夠讀取和寫入 :class:" -"`str` 物件的檔案物件。" +"另請參閱 :term:`text file`\\ (文字檔案),它是一個能夠讀取和寫" +"入 :class:`str` 物件的檔案物件。" #: ../../glossary.rst:161 msgid "borrowed reference" @@ -401,8 +402,8 @@ msgstr "" msgid "" "Calling :c:func:`Py_INCREF` on the :term:`borrowed reference` is recommended " "to convert it to a :term:`strong reference` in-place, except when the object " -"cannot be destroyed before the last usage of the borrowed reference. The :c:" -"func:`Py_NewRef` function can be used to create a new :term:`strong " +"cannot be destroyed before the last usage of the borrowed reference. " +"The :c:func:`Py_NewRef` function can be used to create a new :term:`strong " "reference`." msgstr "" "對 :term:`borrowed reference` 呼叫 :c:func:`Py_INCREF` 以將它原地 (in-place) " @@ -416,12 +417,12 @@ msgstr "bytes-like object(類位元組串物件)" #: ../../glossary.rst:176 msgid "" -"An object that supports the :ref:`bufferobjects` and can export a C-:term:" -"`contiguous` buffer. This includes all :class:`bytes`, :class:`bytearray`, " -"and :class:`array.array` objects, as well as many common :class:`memoryview` " -"objects. Bytes-like objects can be used for various operations that work " -"with binary data; these include compression, saving to a binary file, and " -"sending over a socket." +"An object that supports the :ref:`bufferobjects` and can export a " +"C-:term:`contiguous` buffer. This includes " +"all :class:`bytes`, :class:`bytearray`, and :class:`array.array` objects, as " +"well as many common :class:`memoryview` objects. Bytes-like objects can be " +"used for various operations that work with binary data; these include " +"compression, saving to a binary file, and sending over a socket." msgstr "" "一個支援\\ :ref:`bufferobjects`\\ 且能夠匯出 C-:term:`contiguous` 緩衝區的物" "件。這包括所有的 :class:`bytes`、:class:`bytearray` 和 :class:`array.array` " @@ -432,9 +433,9 @@ msgstr "" msgid "" "Some operations need the binary data to be mutable. The documentation often " "refers to these as \"read-write bytes-like objects\". Example mutable " -"buffer objects include :class:`bytearray` and a :class:`memoryview` of a :" -"class:`bytearray`. Other operations require the binary data to be stored in " -"immutable objects (\"read-only bytes-like objects\"); examples of these " +"buffer objects include :class:`bytearray` and a :class:`memoryview` of " +"a :class:`bytearray`. Other operations require the binary data to be stored " +"in immutable objects (\"read-only bytes-like objects\"); examples of these " "include :class:`bytes` and a :class:`memoryview` of a :class:`bytes` object." msgstr "" "有些運算需要二進位資料是可變的。說明文件通常會將這些物件稱為「可讀寫的類位元" @@ -468,8 +469,8 @@ msgstr "" #: ../../glossary.rst:203 msgid "" -"A list of bytecode instructions can be found in the documentation for :ref:" -"`the dis module <bytecodes>`." +"A list of bytecode instructions can be found in the documentation " +"for :ref:`the dis module <bytecodes>`." msgstr "" "位元組碼的指令列表可以在 :ref:`dis 模組 <bytecodes>`\\ 的說明文件中找到。" @@ -482,8 +483,8 @@ msgid "" "A callable is an object that can be called, possibly with a set of arguments " "(see :term:`argument`), with the following syntax::" msgstr "" -"一個 callable 是可以被呼叫的物件,呼叫時可能以下列形式帶有一組引數(請見 :" -"term:`argument`): ::" +"一個 callable 是可以被呼叫的物件,呼叫時可能以下列形式帶有一組引數(請" +"見 :term:`argument`): ::" #: ../../glossary.rst:210 msgid "callable(argument1, argument2, argumentN)" @@ -495,8 +496,8 @@ msgid "" "instance of a class that implements the :meth:`~object.__call__` method is " "also a callable." msgstr "" -"一個 :term:`function` 與其延伸的 :term:`method` 都是 callable。一個有實作 :" -"meth:`~object.__call__` 方法的 class 之實例也是個 callable。" +"一個 :term:`function` 與其延伸的 :term:`method` 都是 callable。一個有實" +"作 :meth:`~object.__call__` 方法的 class 之實例也是個 callable。" #: ../../glossary.rst:215 msgid "callback" @@ -541,9 +542,9 @@ msgstr "closure variable(閉包變數)" msgid "" "A :term:`free variable` referenced from a :term:`nested scope` that is " "defined in an outer scope rather than being resolved at runtime from the " -"globals or builtin namespaces. May be explicitly defined with the :keyword:" -"`nonlocal` keyword to allow write access, or implicitly defined if the " -"variable is only being read." +"globals or builtin namespaces. May be explicitly defined with " +"the :keyword:`nonlocal` keyword to allow write access, or implicitly defined " +"if the variable is only being read." msgstr "" "從外部作用域中定義且從\\ :term:`巢狀作用域 <nested scope>`\\ 參照的\\ :term:`" "自由變數 <free variable>`,不是於 runtime 從全域或內建命名空間解析。可以使" @@ -608,10 +609,10 @@ msgstr "" "一個我們熟悉的實數系統的擴充,在此所有數字都會被表示為一個實部和一個虛部之" "和。虛數就是虛數單位(``-1`` 的平方根)的實數倍,此單位通常在數學中被寫為 " "``i``,在工程學中被寫為 ``j``。Python 內建了對複數的支援,它是用後者的記法來" -"表示複數;虛部會帶著一個後綴的 ``j`` 被編寫,例如 ``3+1j``。若要將 :mod:" -"`math` 模組內的工具等效地用於複數,請使用 :mod:`cmath` 模組。複數的使用是一個" -"相當進階的數學功能。如果你沒有察覺到對它們的需求,那麼幾乎能確定你可以安全地" -"忽略它們。" +"表示複數;虛部會帶著一個後綴的 ``j`` 被編寫,例如 ``3+1j``。若要" +"將 :mod:`math` 模組內的工具等效地用於複數,請使用 :mod:`cmath` 模組。複數的使" +"用是一個相當進階的數學功能。如果你沒有察覺到對它們的需求,那麼幾乎能確定你可" +"以安全地忽略它們。" #: ../../glossary.rst:262 msgid "context" @@ -631,9 +632,10 @@ msgstr "" #: ../../glossary.rst:269 msgid "" -"The collection of key­value bindings associated with a particular :class:" -"`contextvars.Context` object and accessed via :class:`~contextvars." -"ContextVar` objects. Also see :term:`context variable`." +"The collection of key­value bindings associated with a " +"particular :class:`contextvars.Context` object and accessed " +"via :class:`~contextvars.ContextVar` objects. Also see :term:`context " +"variable`." msgstr "" #: ../../glossary.rst:273 @@ -651,8 +653,8 @@ msgid "" "The :meth:`~object.__enter__` and :meth:`~object.__exit__` methods called by " "the :keyword:`with` statement. See :pep:`343`." msgstr "" -"由 :keyword:`with` 陳述式所呼叫的 :meth:`~object.__enter__` 和 :meth:" -"`~object.__exit__` 方法。另請參閱 :pep:`343`。" +"由 :keyword:`with` 陳述式所呼叫的 :meth:`~object.__enter__` " +"和 :meth:`~object.__exit__` 方法。另請參閱 :pep:`343`。" #: ../../glossary.rst:279 msgid "context manager" @@ -661,8 +663,8 @@ msgstr "context manager(情境管理器)" #: ../../glossary.rst:281 msgid "" "An object which implements the :term:`context management protocol` and " -"controls the environment seen in a :keyword:`with` statement. See :pep:" -"`343`." +"controls the environment seen in a :keyword:`with` statement. " +"See :pep:`343`." msgstr "" #: ../../glossary.rst:284 @@ -720,13 +722,14 @@ msgstr "coroutine function(協程函式)" #: ../../glossary.rst:311 msgid "" "A function which returns a :term:`coroutine` object. A coroutine function " -"may be defined with the :keyword:`async def` statement, and may contain :" -"keyword:`await`, :keyword:`async for`, and :keyword:`async with` keywords. " -"These were introduced by :pep:`492`." +"may be defined with the :keyword:`async def` statement, and may " +"contain :keyword:`await`, :keyword:`async for`, and :keyword:`async with` " +"keywords. These were introduced by :pep:`492`." msgstr "" -"一個回傳 :term:`coroutine`\\ (協程)物件的函式。一個協程函式能以 :keyword:" -"`async def` 陳述式被定義,並可能會包含 :keyword:`await`、:keyword:`async " -"for` 和 :keyword:`async with` 關鍵字。這些關鍵字由 :pep:`492` 引入。" +"一個回傳 :term:`coroutine`\\ (協程)物件的函式。一個協程函式能" +"以 :keyword:`async def` 陳述式被定義,並可能會包" +"含 :keyword:`await`、:keyword:`async for` 和 :keyword:`async with` 關鍵字。這" +"些關鍵字由 :pep:`492` 引入。" #: ../../glossary.rst:316 msgid "CPython" @@ -752,9 +755,9 @@ msgid "" "The :term:`context` (:class:`contextvars.Context` object) that is currently " "used by :class:`~contextvars.ContextVar` objects to access (get or set) the " "values of :term:`context variables <context variable>`. Each thread has its " -"own current context. Frameworks for executing asynchronous tasks (see :mod:" -"`asyncio`) associate each task with a context which becomes the current " -"context whenever the task starts or resumes execution." +"own current context. Frameworks for executing asynchronous tasks " +"(see :mod:`asyncio`) associate each task with a context which becomes the " +"current context whenever the task starts or resumes execution." msgstr "" #: ../../glossary.rst:330 @@ -801,8 +804,8 @@ msgid "" "the documentation for :ref:`function definitions <function>` and :ref:`class " "definitions <class>` for more about decorators." msgstr "" -"Class 也存在相同的概念,但在那裡比較不常用。關於裝飾器的更多內容,請參閱\\ :" -"ref:`函式定義 <function>`\\ 和 :ref:`class 定義 <class>`\\ 的說明文件。" +"Class 也存在相同的概念,但在那裡比較不常用。關於裝飾器的更多內容,請參閱" +"\\ :ref:`函式定義 <function>`\\ 和 :ref:`class 定義 <class>`\\ 的說明文件。" #: ../../glossary.rst:350 msgid "descriptor" @@ -810,23 +813,24 @@ msgstr "descriptor(描述器)" #: ../../glossary.rst:352 msgid "" -"Any object which defines the methods :meth:`~object.__get__`, :meth:`~object." -"__set__`, or :meth:`~object.__delete__`. When a class attribute is a " -"descriptor, its special binding behavior is triggered upon attribute " -"lookup. Normally, using *a.b* to get, set or delete an attribute looks up " -"the object named *b* in the class dictionary for *a*, but if *b* is a " -"descriptor, the respective descriptor method gets called. Understanding " -"descriptors is a key to a deep understanding of Python because they are the " -"basis for many features including functions, methods, properties, class " -"methods, static methods, and reference to super classes." -msgstr "" -"任何定義了 :meth:`~object.__get__`、:meth:`~object.__set__` 或 :meth:" -"`~object.__delete__` method 的物件。當一個 class 屬性是一個描述器時,它的特殊" -"連結行為會在屬性查找時被觸發。通常,使用 *a.b* 來取得、設定或刪除某個屬性時," -"會在 *a* 的 class 字典中查找名稱為 *b* 的物件,但如果 *b* 是一個描述器,則相" -"對應的描述器 method 會被呼叫。對描述器的理解是深入理解 Python 的關鍵,因為它" -"們是許多功能的基礎,這些功能包括函式、method、屬性 (property)、class method、" -"靜態 method,以及對 super class(父類別)的參照。" +"Any object which defines the " +"methods :meth:`~object.__get__`, :meth:`~object.__set__`, " +"or :meth:`~object.__delete__`. When a class attribute is a descriptor, its " +"special binding behavior is triggered upon attribute lookup. Normally, " +"using *a.b* to get, set or delete an attribute looks up the object named *b* " +"in the class dictionary for *a*, but if *b* is a descriptor, the respective " +"descriptor method gets called. Understanding descriptors is a key to a deep " +"understanding of Python because they are the basis for many features " +"including functions, methods, properties, class methods, static methods, and " +"reference to super classes." +msgstr "" +"任何定義了 :meth:`~object.__get__`、:meth:`~object.__set__` " +"或 :meth:`~object.__delete__` method 的物件。當一個 class 屬性是一個描述器" +"時,它的特殊連結行為會在屬性查找時被觸發。通常,使用 *a.b* 來取得、設定或刪除" +"某個屬性時,會在 *a* 的 class 字典中查找名稱為 *b* 的物件,但如果 *b* 是一個" +"描述器,則相對應的描述器 method 會被呼叫。對描述器的理解是深入理解 Python 的" +"關鍵,因為它們是許多功能的基礎,這些功能包括函式、method、屬性 (property)、" +"class method、靜態 method,以及對 super class(父類別)的參照。" #: ../../glossary.rst:363 msgid "" @@ -871,11 +875,11 @@ msgstr "dictionary view(字典檢視)" #: ../../glossary.rst:379 msgid "" -"The objects returned from :meth:`dict.keys`, :meth:`dict.values`, and :meth:" -"`dict.items` are called dictionary views. They provide a dynamic view on the " -"dictionary’s entries, which means that when the dictionary changes, the view " -"reflects these changes. To force the dictionary view to become a full list " -"use ``list(dictview)``. See :ref:`dict-views`." +"The objects returned from :meth:`dict.keys`, :meth:`dict.values`, " +"and :meth:`dict.items` are called dictionary views. They provide a dynamic " +"view on the dictionary’s entries, which means that when the dictionary " +"changes, the view reflects these changes. To force the dictionary view to " +"become a full list use ``list(dictview)``. See :ref:`dict-views`." msgstr "" "從 :meth:`dict.keys`、:meth:`dict.values` 及 :meth:`dict.items` 回傳的物件被" "稱為字典檢視。它們提供了字典中項目的動態檢視,這表示當字典有變動時,該檢視會" @@ -895,9 +899,9 @@ msgid "" "introspection, it is the canonical place for documentation of the object." msgstr "" "一個在 class、函式或模組中,作為第一個運算式出現的字串文本。雖然它在套件執行" -"時會被忽略,但它會被編譯器辨識,並被放入所屬 class、函式或模組的 :attr:" -"`~definition.__doc__` 屬性中。由於說明字串可以透過內省 (introspection) 來瀏" -"覽,因此它是物件的說明文件存放的標準位置。" +"時會被忽略,但它會被編譯器辨識,並被放入所屬 class、函式或模組" +"的 :attr:`~definition.__doc__` 屬性中。由於說明字串可以透過內省 " +"(introspection) 來瀏覽,因此它是物件的說明文件存放的標準位置。" #: ../../glossary.rst:393 msgid "duck-typing" @@ -910,10 +914,10 @@ msgid "" "called or used (\"If it looks like a duck and quacks like a duck, it must be " "a duck.\") By emphasizing interfaces rather than specific types, well-" "designed code improves its flexibility by allowing polymorphic " -"substitution. Duck-typing avoids tests using :func:`type` or :func:" -"`isinstance`. (Note, however, that duck-typing can be complemented with :" -"term:`abstract base classes <abstract base class>`.) Instead, it typically " -"employs :func:`hasattr` tests or :term:`EAFP` programming." +"substitution. Duck-typing avoids tests using :func:`type` " +"or :func:`isinstance`. (Note, however, that duck-typing can be complemented " +"with :term:`abstract base classes <abstract base class>`.) Instead, it " +"typically employs :func:`hasattr` tests or :term:`EAFP` programming." msgstr "" "一種程式設計風格,它不是藉由檢查一個物件的型別來確定它是否具有正確的介面;取" "而代之的是,method 或屬性會單純地被呼叫或使用。(「如果它看起來像一隻鴨子而且" @@ -939,9 +943,9 @@ msgid "" msgstr "" "Easier to ask for forgiveness than permission.(請求寬恕比請求許可更容易。)" "這種常見的 Python 編碼風格會先假設有效的鍵或屬性的存在,並在該假設被推翻時再" -"捕獲例外。這種乾淨且快速的風格,其特色是存在許多的 :keyword:`try` 和 :" -"keyword:`except` 陳述式。該技術與許多其他語言(例如 C)常見的 :term:`LBYL` 風" -"格形成了對比。" +"捕獲例外。這種乾淨且快速的風格,其特色是存在許多的 :keyword:`try` " +"和 :keyword:`except` 陳述式。該技術與許多其他語言(例如 C)常見" +"的 :term:`LBYL` 風格形成了對比。" #: ../../glossary.rst:412 msgid "expression" @@ -1015,9 +1019,10 @@ msgid "" "The canonical way to create a file object is by using the :func:`open` " "function." msgstr "" -"實際上,有三種檔案物件:原始的\\ :term:`二進位檔案 <binary file>`、緩衝的\\ :" -"term:`二進位檔案 <binary file>`\\ 和\\ :term:`文字檔案 <text file>`。它們的介" -"面在 :mod:`io` 模組中被定義。建立檔案物件的標準方法是使用 :func:`open` 函式。" +"實際上,有三種檔案物件:原始的\\ :term:`二進位檔案 <binary file>`、緩衝的" +"\\ :term:`二進位檔案 <binary file>`\\ 和\\ :term:`文字檔案 <text file>`。它們" +"的介面在 :mod:`io` 模組中被定義。建立檔案物件的標準方法是使用 :func:`open` 函" +"式。" #: ../../glossary.rst:445 msgid "file-like object" @@ -1050,9 +1055,9 @@ msgstr "" #: ../../glossary.rst:457 msgid "" -"The :func:`sys.getfilesystemencoding` and :func:`sys." -"getfilesystemencodeerrors` functions can be used to get the filesystem " -"encoding and error handler." +"The :func:`sys.getfilesystemencoding` " +"and :func:`sys.getfilesystemencodeerrors` functions can be used to get the " +"filesystem encoding and error handler." msgstr "" ":func:`sys.getfilesystemencoding` 和 :func:`sys.getfilesystemencodeerrors` 函" "式可用於取得檔案系統編碼和錯誤處理函式。" @@ -1060,14 +1065,14 @@ msgstr "" #: ../../glossary.rst:461 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " -"startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." -"filesystem_encoding` and :c:member:`~PyConfig.filesystem_errors` members of :" -"c:type:`PyConfig`." +"startup by the :c:func:`PyConfig_Read` function: " +"see :c:member:`~PyConfig.filesystem_encoding` " +"and :c:member:`~PyConfig.filesystem_errors` members of :c:type:`PyConfig`." msgstr "" ":term:`filesystem encoding and error handler`\\ (檔案系統編碼和錯誤處理函" -"式)會在 Python 啟動時由 :c:func:`PyConfig_Read` 函式來配置:請參閱 :c:" -"member:`~PyConfig.filesystem_encoding`,以及 :c:type:`PyConfig` 的成員 :c:" -"member:`~PyConfig.filesystem_errors`。" +"式)會在 Python 啟動時由 :c:func:`PyConfig_Read` 函式來配置:請參" +"閱 :c:member:`~PyConfig.filesystem_encoding`,以及 :c:type:`PyConfig` 的成" +"員 :c:member:`~PyConfig.filesystem_errors`。" #: ../../glossary.rst:466 msgid "See also the :term:`locale encoding`." @@ -1123,8 +1128,8 @@ msgstr "free threading(自由執行緒)" #: ../../glossary.rst:486 msgid "" "A threading model where multiple threads can run Python bytecode " -"simultaneously within the same interpreter. This is in contrast to the :" -"term:`global interpreter lock` which allows only one thread to execute " +"simultaneously within the same interpreter. This is in contrast to " +"the :term:`global interpreter lock` which allows only one thread to execute " "Python bytecode at a time. See :pep:`703`." msgstr "" "為一種執行緒模型,多個執行緒可以在同一直譯器中同時運行 Python 位元組碼。這與" @@ -1153,13 +1158,13 @@ msgstr "function(函式)" msgid "" "A series of statements which returns some value to a caller. It can also be " "passed zero or more :term:`arguments <argument>` which may be used in the " -"execution of the body. See also :term:`parameter`, :term:`method`, and the :" -"ref:`function` section." +"execution of the body. See also :term:`parameter`, :term:`method`, and " +"the :ref:`function` section." msgstr "" "一連串的陳述式,它能夠向呼叫者回傳一些值。它也可以被傳遞零個或多個\\ :term:`" -"引數 <argument>`,這些引數可被使用於函式本體的執行。另請參閱 :term:" -"`parameter`\\ (參數)、:term:`method`\\ (方法),以及\\ :ref:`function`\\ " -"章節。" +"引數 <argument>`,這些引數可被使用於函式本體的執行。另請參" +"閱 :term:`parameter`\\ (參數)、:term:`method`\\ (方法),以及" +"\\ :ref:`function`\\ 章節。" #: ../../glossary.rst:503 msgid "function annotation" @@ -1207,8 +1212,8 @@ msgstr "__future__" msgid "" "A :ref:`future statement <future>`, ``from __future__ import <feature>``, " "directs the compiler to compile the current module using syntax or semantics " -"that will become standard in a future release of Python. The :mod:" -"`__future__` module documents the possible values of *feature*. By " +"that will become standard in a future release of Python. " +"The :mod:`__future__` module documents the possible values of *feature*. By " "importing this module and evaluating its variables, you can see when a new " "feature was first added to the language and when it will (or did) become the " "default::" @@ -1280,13 +1285,13 @@ msgstr "一個由 :term:`generator`\\ (產生器)函式所建立的物件。 #: ../../glossary.rst:556 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " -"location execution state (including local variables and pending try-" -"statements). When the *generator iterator* resumes, it picks up where it " -"left off (in contrast to functions which start fresh on every invocation)." +"execution state (including local variables and pending try-statements). " +"When the *generator iterator* resumes, it picks up where it left off (in " +"contrast to functions which start fresh on every invocation)." msgstr "" -"每個 :keyword:`yield` 會暫停處理程序,並記住位置執行狀態(包括區域變數及擱置" -"中的 try 陳述式)。當\\ *產生器疊代器*\\ 回復時,它會從停止的地方繼續執行(與" -"那些每次調用時都要重新開始的函式有所不同)。" +"每個 :keyword:`yield` 會暫停處理程序,並記住執行狀態(包括區域變數及擱置中的 " +"try 陳述式)。當\\ *產生器疊代器*\\ 回復時,它會從停止的地方繼續執行(與那些" +"每次調用時都要重新開始的函式有所不同)。" #: ../../glossary.rst:562 ../../glossary.rst:563 msgid "generator expression" @@ -1327,11 +1332,11 @@ msgstr "" #: ../../glossary.rst:578 msgid "" -"See also the :term:`single dispatch` glossary entry, the :func:`functools." -"singledispatch` decorator, and :pep:`443`." +"See also the :term:`single dispatch` glossary entry, " +"the :func:`functools.singledispatch` decorator, and :pep:`443`." msgstr "" -"另請參閱 :term:`single dispatch`\\ (單一調度)術語表條目、:func:`functools." -"singledispatch` 裝飾器和 :pep:`443`。" +"另請參閱 :term:`single dispatch`\\ (單一調度)術語表條" +"目、:func:`functools.singledispatch` 裝飾器和 :pep:`443`。" #: ../../glossary.rst:580 msgid "generic type" @@ -1340,20 +1345,21 @@ msgstr "generic type(泛型型別)" #: ../../glossary.rst:582 msgid "" "A :term:`type` that can be parameterized; typically a :ref:`container " -"class<sequence-types>` such as :class:`list` or :class:`dict`. Used for :" -"term:`type hints <type hint>` and :term:`annotations <annotation>`." +"class<sequence-types>` such as :class:`list` or :class:`dict`. Used " +"for :term:`type hints <type hint>` and :term:`annotations <annotation>`." msgstr "" -"一個能夠被參數化 (parameterized) 的 :term:`type`\\ (型別);通常是一個 :ref:" -"`容器型別 <sequence-types>`,像是 :class:`list` 和 :class:`dict`。它被用於" -"\\ :term:`型別提示 <type hint>`\\ 和\\ :term:`註釋 <annotation>`。" +"一個能夠被參數化 (parameterized) 的 :term:`type`\\ (型別);通常是一" +"個 :ref:`容器型別 <sequence-types>`,像是 :class:`list` 和 :class:`dict`。它" +"被用於\\ :term:`型別提示 <type hint>`\\ 和\\ :term:`註釋 <annotation>`。" #: ../../glossary.rst:587 msgid "" -"For more details, see :ref:`generic alias types<types-genericalias>`, :pep:" -"`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` module." +"For more details, see :ref:`generic alias types<types-" +"genericalias>`, :pep:`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` " +"module." msgstr "" -"詳情請參閱\\ :ref:`泛型別名型別 <types-genericalias>`、:pep:`483`、:pep:" -"`484`、:pep:`585` 和 :mod:`typing` 模組。" +"詳情請參閱\\ :ref:`泛型別名型別 <types-" +"genericalias>`、:pep:`483`、:pep:`484`、:pep:`585` 和 :mod:`typing` 模組。" #: ../../glossary.rst:589 msgid "GIL" @@ -1434,10 +1440,10 @@ msgid "" "compared to other objects (it needs an :meth:`~object.__eq__` method). " "Hashable objects which compare equal must have the same hash value." msgstr "" -"如果一個物件有一個雜湊值,該值在其生命週期中永不改變(它需要一個 :meth:" -"`~object.__hash__` method),且可與其他物件互相比較(它需要一個 :meth:" -"`~object.__eq__` method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結果為相等的" -"多個可雜湊物件,它們必須擁有相同的雜湊值。" +"如果一個物件有一個雜湊值,該值在其生命週期中永不改變(它需要一" +"個 :meth:`~object.__hash__` method),且可與其他物件互相比較(它需要一" +"個 :meth:`~object.__eq__` method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結" +"果為相等的多個可雜湊物件,它們必須擁有相同的雜湊值。" #: ../../glossary.rst:627 msgid "" @@ -1482,8 +1488,8 @@ msgstr "immortal(不滅)" #: ../../glossary.rst:644 msgid "" -"*Immortal objects* are a CPython implementation detail introduced in :pep:" -"`683`." +"*Immortal objects* are a CPython implementation detail introduced " +"in :pep:`683`." msgstr "*不滅物件 (Immortal objects)* 是 :pep:`683` 引入的 CPython 實作細節。" #: ../../glossary.rst:647 @@ -1493,8 +1499,8 @@ msgid "" "example, :const:`True` and :const:`None` are immortal in CPython." msgstr "" "如果一個物件是不滅的,它的\\ :term:`參照計數 <reference count>`\\ 永遠不會被" -"修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` 和 :const:" -"`None` 在 CPython 中是不滅的。" +"修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` " +"和 :const:`None` 在 CPython 中是不滅的。" #: ../../glossary.rst:650 msgid "immutable" @@ -1546,11 +1552,11 @@ msgstr "importer(引入器)" #: ../../glossary.rst:670 msgid "" -"An object that both finds and loads a module; both a :term:`finder` and :" -"term:`loader` object." +"An object that both finds and loads a module; both a :term:`finder` " +"and :term:`loader` object." msgstr "" -"一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也是 :term:" -"`loader`\\ (載入器)物件。" +"一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也" +"是 :term:`loader`\\ (載入器)物件。" #: ../../glossary.rst:672 msgid "interactive" @@ -1596,12 +1602,12 @@ msgstr "interpreter shutdown(直譯器關閉)" msgid "" "When asked to shut down, the Python interpreter enters a special phase where " "it gradually releases all allocated resources, such as modules and various " -"critical internal structures. It also makes several calls to the :term:" -"`garbage collector <garbage collection>`. This can trigger the execution of " -"code in user-defined destructors or weakref callbacks. Code executed during " -"the shutdown phase can encounter various exceptions as the resources it " -"relies on may not function anymore (common examples are library modules or " -"the warnings machinery)." +"critical internal structures. It also makes several calls to " +"the :term:`garbage collector <garbage collection>`. This can trigger the " +"execution of code in user-defined destructors or weakref callbacks. Code " +"executed during the shutdown phase can encounter various exceptions as the " +"resources it relies on may not function anymore (common examples are library " +"modules or the warnings machinery)." msgstr "" "當 Python 直譯器被要求關閉時,它會進入一個特殊階段,在此它逐漸釋放所有被配置" "的資源,例如模組和各種關鍵內部結構。它也會多次呼叫\\ :term:`垃圾回收器 " @@ -1625,37 +1631,39 @@ msgstr "iterable(可疊代物件)" msgid "" "An object capable of returning its members one at a time. Examples of " "iterables include all sequence types (such as :class:`list`, :class:`str`, " -"and :class:`tuple`) and some non-sequence types like :class:`dict`, :term:" -"`file objects <file object>`, and objects of any classes you define with an :" -"meth:`~iterator.__iter__` method or with a :meth:`~object.__getitem__` " -"method that implements :term:`sequence` semantics." +"and :class:`tuple`) and some non-sequence types " +"like :class:`dict`, :term:`file objects <file object>`, and objects of any " +"classes you define with an :meth:`~iterator.__iter__` method or with " +"a :meth:`~object.__getitem__` method that implements :term:`sequence` " +"semantics." msgstr "" "一種能夠一次回傳一個其中成員的物件。可疊代物件的例子包括所有的序列型別(像" -"是 :class:`list`、:class:`str` 和 :class:`tuple`\\ )和某些非序列型別,像是 :" -"class:`dict`、:term:`檔案物件 <file object>`,以及你所定義的任何 class 物件," -"只要那些 class 有 :meth:`~iterator.__iter__` method 或是實作 :term:" -"`sequence`\\ (序列)語意的 :meth:`~object.__getitem__` method,該物件就是可" -"疊代物件。" +"是 :class:`list`、:class:`str` 和 :class:`tuple`\\ )和某些非序列型別,像" +"是 :class:`dict`、:term:`檔案物件 <file object>`,以及你所定義的任何 class 物" +"件,只要那些 class 有 :meth:`~iterator.__iter__` method 或是實" +"作 :term:`sequence`\\ (序列)語意的 :meth:`~object.__getitem__` method,該物" +"件就是可疊代物件。" #: ../../glossary.rst:713 msgid "" "Iterables can be used in a :keyword:`for` loop and in many other places " "where a sequence is needed (:func:`zip`, :func:`map`, ...). When an " -"iterable object is passed as an argument to the built-in function :func:" -"`iter`, it returns an iterator for the object. This iterator is good for " -"one pass over the set of values. When using iterables, it is usually not " -"necessary to call :func:`iter` or deal with iterator objects yourself. The :" -"keyword:`for` statement does that automatically for you, creating a " -"temporary unnamed variable to hold the iterator for the duration of the " -"loop. See also :term:`iterator`, :term:`sequence`, and :term:`generator`." -msgstr "" -"可疊代物件可用於 :keyword:`for` 迴圈和許多其他需要一個序列的地方 (:func:" -"`zip`、:func:`map`\\ ...)。當一個可疊代物件作為引數被傳遞給內建函式 :func:" -"`iter` 時,它會為該物件回傳一個疊代器。此疊代器適用於針對一組值進行一遍 (one " -"pass) 運算。使用疊代器時,通常不一定要呼叫 :func:`iter` 或自行處理疊代器物" -"件。:keyword:`for` 陳述式會自動地為你處理這些事,它會建立一個暫時性的未命名變" -"數,用於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代器)、:" -"term:`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" +"iterable object is passed as an argument to the built-in " +"function :func:`iter`, it returns an iterator for the object. This iterator " +"is good for one pass over the set of values. When using iterables, it is " +"usually not necessary to call :func:`iter` or deal with iterator objects " +"yourself. The :keyword:`for` statement does that automatically for you, " +"creating a temporary unnamed variable to hold the iterator for the duration " +"of the loop. See also :term:`iterator`, :term:`sequence`, " +"and :term:`generator`." +msgstr "" +"可疊代物件可用於 :keyword:`for` 迴圈和許多其他需要一個序列的地方 " +"(:func:`zip`、:func:`map`\\ ...)。當一個可疊代物件作為引數被傳遞給內建函" +"式 :func:`iter` 時,它會為該物件回傳一個疊代器。此疊代器適用於針對一組值進行" +"一遍 (one pass) 運算。使用疊代器時,通常不一定要呼叫 :func:`iter` 或自行處理" +"疊代器物件。:keyword:`for` 陳述式會自動地為你處理這些事,它會建立一個暫時性的" +"未命名變數,用於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代" +"器)、:term:`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" #: ../../glossary.rst:723 msgid "iterator" @@ -1663,32 +1671,33 @@ msgstr "iterator(疊代器)" #: ../../glossary.rst:725 msgid "" -"An object representing a stream of data. Repeated calls to the iterator's :" -"meth:`~iterator.__next__` method (or passing it to the built-in function :" -"func:`next`) return successive items in the stream. When no more data are " -"available a :exc:`StopIteration` exception is raised instead. At this " -"point, the iterator object is exhausted and any further calls to its :meth:`!" -"__next__` method just raise :exc:`StopIteration` again. Iterators are " -"required to have an :meth:`~iterator.__iter__` method that returns the " -"iterator object itself so every iterator is also iterable and may be used in " -"most places where other iterables are accepted. One notable exception is " -"code which attempts multiple iteration passes. A container object (such as " -"a :class:`list`) produces a fresh new iterator each time you pass it to the :" -"func:`iter` function or use it in a :keyword:`for` loop. Attempting this " -"with an iterator will just return the same exhausted iterator object used in " -"the previous iteration pass, making it appear like an empty container." +"An object representing a stream of data. Repeated calls to the " +"iterator's :meth:`~iterator.__next__` method (or passing it to the built-in " +"function :func:`next`) return successive items in the stream. When no more " +"data are available a :exc:`StopIteration` exception is raised instead. At " +"this point, the iterator object is exhausted and any further calls to " +"its :meth:`!__next__` method just raise :exc:`StopIteration` again. " +"Iterators are required to have an :meth:`~iterator.__iter__` method that " +"returns the iterator object itself so every iterator is also iterable and " +"may be used in most places where other iterables are accepted. One notable " +"exception is code which attempts multiple iteration passes. A container " +"object (such as a :class:`list`) produces a fresh new iterator each time you " +"pass it to the :func:`iter` function or use it in a :keyword:`for` loop. " +"Attempting this with an iterator will just return the same exhausted " +"iterator object used in the previous iteration pass, making it appear like " +"an empty container." msgstr "" "一個表示資料流的物件。重複地呼叫疊代器的 :meth:`~iterator.__next__` method" "(或是將它傳遞給內建函式 :func:`next`\\ )會依序回傳資料流中的各項目。當不再" "有資料時,則會引發 :exc:`StopIteration` 例外。此時,該疊代器物件已被用盡,而" -"任何對其 :meth:`!__next__` method 的進一步呼叫,都只會再次引發 :exc:" -"`StopIteration`。疊代器必須有一個 :meth:`~iterator.__iter__` method,它會回傳" -"疊代器物件本身,所以每個疊代器也都是可疊代物件,且可以用於大多數適用其他可疊" -"代物件的場合。一個明顯的例外,是嘗試多遍疊代 (multiple iteration passes) 的程" -"式碼。一個容器物件(像是 :class:`list`)在每次你將它傳遞給 :func:`iter` 函式" -"或在 :keyword:`for` 迴圈中使用它時,都會產生一個全新的疊代器。使用疊代器嘗試" -"此事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一個已被用盡的疊代器物" -"件,使其看起來就像一個空的容器。" +"任何對其 :meth:`!__next__` method 的進一步呼叫,都只會再次引" +"發 :exc:`StopIteration`。疊代器必須有一個 :meth:`~iterator.__iter__` method," +"它會回傳疊代器物件本身,所以每個疊代器也都是可疊代物件,且可以用於大多數適用" +"其他可疊代物件的場合。一個明顯的例外,是嘗試多遍疊代 (multiple iteration " +"passes) 的程式碼。一個容器物件(像是 :class:`list`)在每次你將它傳遞" +"給 :func:`iter` 函式或在 :keyword:`for` 迴圈中使用它時,都會產生一個全新的疊" +"代器。使用疊代器嘗試此事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一" +"個已被用盡的疊代器物件,使其看起來就像一個空的容器。" #: ../../glossary.rst:740 msgid "More information can be found in :ref:`typeiter`." @@ -1696,13 +1705,14 @@ msgstr "在\\ :ref:`typeiter`\\ 文中可以找到更多資訊。" #: ../../glossary.rst:744 msgid "" -"CPython does not consistently apply the requirement that an iterator define :" -"meth:`~iterator.__iter__`. And also please note that the free-threading " -"CPython does not guarantee the thread-safety of iterator operations." +"CPython does not consistently apply the requirement that an iterator " +"define :meth:`~iterator.__iter__`. And also please note that the free-" +"threading CPython does not guarantee the thread-safety of iterator " +"operations." msgstr "" -"CPython 並不是始終如一地都會檢查「疊代器有定義 :meth:`~iterator." -"__iter__`\\ 」這個規定。另請注意,free-threading(自由執行緒)CPython 不保證" -"疊代器操作的執行緒安全。" +"CPython 並不是始終如一地都會檢查「疊代器有定" +"義 :meth:`~iterator.__iter__`\\ 」這個規定。另請注意,free-threading(自由執" +"行緒)CPython 不保證疊代器操作的執行緒安全。" #: ../../glossary.rst:749 msgid "key function" @@ -1721,37 +1731,37 @@ msgstr "" #: ../../glossary.rst:756 msgid "" "A number of tools in Python accept key functions to control how elements are " -"ordered or grouped. They include :func:`min`, :func:`max`, :func:`sorted`, :" -"meth:`list.sort`, :func:`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq." -"nlargest`, and :func:`itertools.groupby`." +"ordered or grouped. They " +"include :func:`min`, :func:`max`, :func:`sorted`, :meth:`list.sort`, :func:`heapq.merge`, :func:`heapq.nsmallest`, :func:`heapq.nlargest`, " +"and :func:`itertools.groupby`." msgstr "" -"Python 中的許多工具,都接受以鍵函式來控制元素被定序或分組的方式。它們包括 :" -"func:`min`、:func:`max`、:func:`sorted`、:meth:`list.sort`、:func:`heapq." -"merge`、:func:`heapq.nsmallest`、:func:`heapq.nlargest` 和 :func:`itertools." -"groupby`。" +"Python 中的許多工具,都接受以鍵函式來控制元素被定序或分組的方式。它們包" +"括 :func:`min`、:func:`max`、:func:`sorted`、:meth:`list.sort`、:func:`heapq.merge`、:func:`heapq.nsmallest`、:func:`heapq.nlargest` " +"和 :func:`itertools.groupby`。" #: ../../glossary.rst:762 msgid "" -"There are several ways to create a key function. For example. the :meth:" -"`str.lower` method can serve as a key function for case insensitive sorts. " -"Alternatively, a key function can be built from a :keyword:`lambda` " -"expression such as ``lambda r: (r[0], r[2])``. Also, :func:`operator." -"attrgetter`, :func:`operator.itemgetter`, and :func:`operator.methodcaller` " -"are three key function constructors. See the :ref:`Sorting HOW TO " -"<sortinghowto>` for examples of how to create and use key functions." +"There are several ways to create a key function. For example. " +"the :meth:`str.lower` method can serve as a key function for case " +"insensitive sorts. Alternatively, a key function can be built from " +"a :keyword:`lambda` expression such as ``lambda r: (r[0], r[2])``. " +"Also, :func:`operator.attrgetter`, :func:`operator.itemgetter`, " +"and :func:`operator.methodcaller` are three key function constructors. See " +"the :ref:`Sorting HOW TO <sortinghowto>` for examples of how to create and " +"use key functions." msgstr "" "有幾種方法可以建立一個鍵函式。例如,:meth:`str.lower` method 可以作為不分大小" "寫排序的鍵函式。或者,一個鍵函式也可以從 :keyword:`lambda` 運算式被建造,例" -"如 ``lambda r: (r[0], r[2])``。另外,:func:`operator.attrgetter`、:func:" -"`operator.itemgetter` 和 :func:`operator.methodcaller` 為三個鍵函式的建構函" -"式 (constructor)。關於如何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排序 " -"<sortinghowto>`。" +"如 ``lambda r: (r[0], r[2])``。另" +"外,:func:`operator.attrgetter`、:func:`operator.itemgetter` " +"和 :func:`operator.methodcaller` 為三個鍵函式的建構函式 (constructor)。關於如" +"何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排序 <sortinghowto>`。" #: ../../glossary.rst:769 msgid "keyword argument" msgstr "keyword argument(關鍵字引數)" -#: ../../glossary.rst:771 ../../glossary.rst:1075 +#: ../../glossary.rst:771 ../../glossary.rst:1077 msgid "See :term:`argument`." msgstr "請參閱 :term:`argument`\\ (引數)。" @@ -1781,8 +1791,8 @@ msgid "" "statements." msgstr "" "Look before you leap.(三思而後行。)這種編碼風格會在進行呼叫或查找之前,明確" -"地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許多 :" -"keyword:`if` 陳述式的存在。" +"地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許" +"多 :keyword:`if` 陳述式的存在。" #: ../../glossary.rst:784 msgid "" @@ -1826,9 +1836,9 @@ msgid "" msgstr "" "一種用來處理一個序列中的全部或部分元素,並將處理結果以一個 list 回傳的簡要方" "法。``result = ['{:#04x}'.format(x) for x in range(256) if x % 2 == 0]`` 會產" -"生一個字串 list,其中包含 0 到 255 範圍內,所有偶數的十六進位數 (0x..)。:" -"keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有元素都會被" -"處理。" +"生一個字串 list,其中包含 0 到 255 範圍內,所有偶數的十六進位數 " +"(0x..)。:keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有" +"元素都會被處理。" #: ../../glossary.rst:802 msgid "loader" @@ -1836,85 +1846,91 @@ msgstr "loader(載入器)" #: ../../glossary.rst:804 msgid "" -"An object that loads a module. It must define a method named :meth:" -"`load_module`. A loader is typically returned by a :term:`finder`. See also:" +"An object that loads a module. It must define the :meth:`!exec_module` " +"and :meth:`!create_module` methods to implement " +"the :class:`~importlib.abc.Loader` interface. A loader is typically returned " +"by a :term:`finder`. See also:" msgstr "" -"一個能夠載入模組的物件。它必須定義一個名為 :meth:`load_module` 的 method(方" -"法)。載入器通常是被 :term:`finder`\\ (尋檢器)回傳。更多細節請參閱:" +"一個能夠載入模組的物件。它必須定義 :meth:`!exec_module` 和 :meth:`!" +"create_module` 方法以實作 :class:`~importlib.abc.Loader` 介面。載入器通常是" +"被 :term:`finder`\\ (尋檢器)回傳。更多細節請參閱:" -#: ../../glossary.rst:808 +#: ../../glossary.rst:810 msgid ":ref:`finders-and-loaders`" msgstr ":ref:`finders-and-loaders`" -#: ../../glossary.rst:809 +#: ../../glossary.rst:811 msgid ":class:`importlib.abc.Loader`" msgstr ":class:`importlib.abc.Loader`" -#: ../../glossary.rst:810 +#: ../../glossary.rst:812 msgid ":pep:`302`" msgstr ":pep:`302`" -#: ../../glossary.rst:811 +#: ../../glossary.rst:813 msgid "locale encoding" msgstr "locale encoding(區域編碼)" -#: ../../glossary.rst:813 +#: ../../glossary.rst:815 msgid "" -"On Unix, it is the encoding of the LC_CTYPE locale. It can be set with :func:" -"`locale.setlocale(locale.LC_CTYPE, new_locale) <locale.setlocale>`." +"On Unix, it is the encoding of the LC_CTYPE locale. It can be set " +"with :func:`locale.setlocale(locale.LC_CTYPE, new_locale) " +"<locale.setlocale>`." msgstr "" -"在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以用 :func:`locale." -"setlocale(locale.LC_CTYPE, new_locale) <locale.setlocale>` 來設定。" +"在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以" +"用 :func:`locale.setlocale(locale.LC_CTYPE, new_locale) <locale.setlocale>` " +"來設定。" -#: ../../glossary.rst:816 +#: ../../glossary.rst:818 msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." msgstr "在 Windows 上,它是 ANSI 代碼頁(code page,例如 ``\"cp1252\"``\\ )。" -#: ../../glossary.rst:818 +#: ../../glossary.rst:820 msgid "" "On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." msgstr "在 Android 和 VxWorks 上,Python 使用 ``\"utf-8\"`` 作為區域編碼。" -#: ../../glossary.rst:820 +#: ../../glossary.rst:822 msgid ":func:`locale.getencoding` can be used to get the locale encoding." msgstr ":func:`locale.getencoding` 可以用來取得區域編碼。" -#: ../../glossary.rst:822 +#: ../../glossary.rst:824 msgid "See also the :term:`filesystem encoding and error handler`." msgstr "也請參考 :term:`filesystem encoding and error handler`。" -#: ../../glossary.rst:823 +#: ../../glossary.rst:825 msgid "magic method" msgstr "magic method(魔術方法)" -#: ../../glossary.rst:827 +#: ../../glossary.rst:829 msgid "An informal synonym for :term:`special method`." msgstr ":term:`special method`\\ (特殊方法)的一個非正式同義詞。" -#: ../../glossary.rst:828 +#: ../../glossary.rst:830 msgid "mapping" msgstr "mapping(對映)" -#: ../../glossary.rst:830 +#: ../../glossary.rst:832 msgid "" "A container object that supports arbitrary key lookups and implements the " -"methods specified in the :class:`collections.abc.Mapping` or :class:" -"`collections.abc.MutableMapping` :ref:`abstract base classes <collections-" -"abstract-base-classes>`. Examples include :class:`dict`, :class:" -"`collections.defaultdict`, :class:`collections.OrderedDict` and :class:" -"`collections.Counter`." +"methods specified in the :class:`collections.abc.Mapping` " +"or :class:`collections.abc.MutableMapping` :ref:`abstract base classes " +"<collections-abstract-base-classes>`. Examples " +"include :class:`dict`, :class:`collections.defaultdict`, :class:`collections.OrderedDict` " +"and :class:`collections.Counter`." msgstr "" "一個容器物件,它支援任意鍵的查找,且能實作 :ref:`abstract base classes(抽象" -"基底類別) <collections-abstract-base-classes>`\\ 中,:class:`collections." -"abc.Mapping` 或 :class:`collections.abc.MutableMapping` 所指定的 method。範例" -"包括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections." -"OrderedDict` 和 :class:`collections.Counter`。" +"基底類別) <collections-abstract-base-classes>`\\ " +"中,:class:`collections.abc.Mapping` " +"或 :class:`collections.abc.MutableMapping` 所指定的 method。範例包" +"括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections.OrderedDict` " +"和 :class:`collections.Counter`。" -#: ../../glossary.rst:836 +#: ../../glossary.rst:838 msgid "meta path finder" msgstr "meta path finder(元路徑尋檢器)" -#: ../../glossary.rst:838 +#: ../../glossary.rst:840 msgid "" "A :term:`finder` returned by a search of :data:`sys.meta_path`. Meta path " "finders are related to, but different from :term:`path entry finders <path " @@ -1924,18 +1940,18 @@ msgstr "" "徑尋檢器與\\ :term:`路徑項目尋檢器 (path entry finder) <path entry finder>` " "相關但是不同。" -#: ../../glossary.rst:842 +#: ../../glossary.rst:844 msgid "" "See :class:`importlib.abc.MetaPathFinder` for the methods that meta path " "finders implement." msgstr "" "關於元路徑尋檢器實作的 method,請參閱 :class:`importlib.abc.MetaPathFinder`。" -#: ../../glossary.rst:844 +#: ../../glossary.rst:846 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../glossary.rst:846 +#: ../../glossary.rst:848 msgid "" "The class of a class. Class definitions create a class name, a class " "dictionary, and a list of base classes. The metaclass is responsible for " @@ -1955,31 +1971,31 @@ msgstr "" "性存取、增加執行緒安全性、追蹤物件建立、實作單例模式 (singleton),以及許多其" "他的任務。" -#: ../../glossary.rst:856 +#: ../../glossary.rst:858 msgid "More information can be found in :ref:`metaclasses`." msgstr "更多資訊可以在\\ :ref:`metaclasses`\\ 章節中找到。" -#: ../../glossary.rst:825 ../../glossary.rst:857 ../../glossary.rst:1220 +#: ../../glossary.rst:827 ../../glossary.rst:859 ../../glossary.rst:1222 msgid "method" msgstr "method(方法)" -#: ../../glossary.rst:859 +#: ../../glossary.rst:861 msgid "" "A function which is defined inside a class body. If called as an attribute " "of an instance of that class, the method will get the instance object as its " -"first :term:`argument` (which is usually called ``self``). See :term:" -"`function` and :term:`nested scope`." +"first :term:`argument` (which is usually called ``self``). " +"See :term:`function` and :term:`nested scope`." msgstr "" "一個在 class 本體內被定義的函式。如果 method 作為其 class 實例的一個屬性被呼" "叫,則它將會得到該實例物件成為它的第一個 :term:`argument`\\ (引數)(此引數" "通常被稱為 ``self``)。請參閱 :term:`function`\\ (函式)和 :term:`nested " "scope`\\ (巢狀作用域)。" -#: ../../glossary.rst:863 +#: ../../glossary.rst:865 msgid "method resolution order" msgstr "method resolution order(方法解析順序)" -#: ../../glossary.rst:865 +#: ../../glossary.rst:867 msgid "" "Method Resolution Order is the order in which base classes are searched for " "a member during lookup. See :ref:`python_2.3_mro` for details of the " @@ -1988,11 +2004,11 @@ msgstr "" "方法解析順序是在查找某個成員的過程中,base class(基底類別)被搜尋的順序。關" "於 Python 自 2.3 版直譯器所使用的演算法細節,請參閱 :ref:`python_2.3_mro`。" -#: ../../glossary.rst:868 +#: ../../glossary.rst:870 msgid "module" msgstr "module(模組)" -#: ../../glossary.rst:870 +#: ../../glossary.rst:872 msgid "" "An object that serves as an organizational unit of Python code. Modules " "have a namespace containing arbitrary Python objects. Modules are loaded " @@ -2002,51 +2018,51 @@ msgstr "" "空間,它包含任意的 Python 物件。模組是藉由 :term:`importing` 的過程,被載入" "至 Python。" -#: ../../glossary.rst:874 +#: ../../glossary.rst:876 msgid "See also :term:`package`." msgstr "另請參閱 :term:`package`\\ (套件)。" -#: ../../glossary.rst:875 +#: ../../glossary.rst:877 msgid "module spec" msgstr "module spec(模組規格)" -#: ../../glossary.rst:877 +#: ../../glossary.rst:879 msgid "" "A namespace containing the import-related information used to load a module. " "An instance of :class:`importlib.machinery.ModuleSpec`." msgstr "" -"一個命名空間,它包含用於載入模組的 import 相關資訊。它是 :class:`importlib." -"machinery.ModuleSpec` 的一個實例。" +"一個命名空間,它包含用於載入模組的 import 相關資訊。它" +"是 :class:`importlib.machinery.ModuleSpec` 的一個實例。" -#: ../../glossary.rst:880 +#: ../../glossary.rst:882 msgid "See also :ref:`module-specs`." msgstr "另請參閱 :ref:`module-specs`。" -#: ../../glossary.rst:881 +#: ../../glossary.rst:883 msgid "MRO" msgstr "MRO" -#: ../../glossary.rst:883 +#: ../../glossary.rst:885 msgid "See :term:`method resolution order`." msgstr "請參閱 :term:`method resolution order`\\ (方法解析順序)。" -#: ../../glossary.rst:884 +#: ../../glossary.rst:886 msgid "mutable" msgstr "mutable(可變物件)" -#: ../../glossary.rst:886 +#: ../../glossary.rst:888 msgid "" -"Mutable objects can change their value but keep their :func:`id`. See also :" -"term:`immutable`." +"Mutable objects can change their value but keep their :func:`id`. See " +"also :term:`immutable`." msgstr "" -"可變物件可以改變它們的值,但維持它們的 :func:`id`。另請參閱 :term:" -"`immutable`\\ (不可變物件)。" +"可變物件可以改變它們的值,但維持它們的 :func:`id`。另請參" +"閱 :term:`immutable`\\ (不可變物件)。" -#: ../../glossary.rst:888 +#: ../../glossary.rst:890 msgid "named tuple" msgstr "named tuple(附名元組)" -#: ../../glossary.rst:890 +#: ../../glossary.rst:892 msgid "" "The term \"named tuple\" applies to any type or class that inherits from " "tuple and whose indexable elements are also accessible using named " @@ -2056,16 +2072,16 @@ msgstr "" "索引 (indexable) 元素也可以用附名屬性來存取。這些型別或 class 也可以具有其他" "的特性。" -#: ../../glossary.rst:894 +#: ../../glossary.rst:896 msgid "" -"Several built-in types are named tuples, including the values returned by :" -"func:`time.localtime` and :func:`os.stat`. Another example is :data:`sys." -"float_info`::" +"Several built-in types are named tuples, including the values returned " +"by :func:`time.localtime` and :func:`os.stat`. Another example " +"is :data:`sys.float_info`::" msgstr "" "有些內建型別是 named tuple,包括由 :func:`time.localtime` 和 :func:`os.stat` " "回傳的值。另一個例子是 :data:`sys.float_info`: ::" -#: ../../glossary.rst:898 +#: ../../glossary.rst:900 msgid "" ">>> sys.float_info[1] # indexed access\n" "1024\n" @@ -2075,52 +2091,54 @@ msgid "" "True" msgstr "" -#: ../../glossary.rst:905 +#: ../../glossary.rst:907 msgid "" "Some named tuples are built-in types (such as the above examples). " "Alternatively, a named tuple can be created from a regular class definition " "that inherits from :class:`tuple` and that defines named fields. Such a " -"class can be written by hand, or it can be created by inheriting :class:" -"`typing.NamedTuple`, or with the factory function :func:`collections." -"namedtuple`. The latter techniques also add some extra methods that may not " -"be found in hand-written or built-in named tuples." +"class can be written by hand, or it can be created by " +"inheriting :class:`typing.NamedTuple`, or with the factory " +"function :func:`collections.namedtuple`. The latter techniques also add " +"some extra methods that may not be found in hand-written or built-in named " +"tuples." msgstr "" "有些 named tuple 是內建型別(如上例)。或者,一個 named tuple 也可以從一個正" "規的 class 定義來建立,只要該 class 是繼承自 :class:`tuple`,且定義了附名欄" -"位 (named field) 即可。這類的 class 可以手工編寫、可以繼承自 :class:`typing." -"NamedTuple` 來建立,也可以使用工廠函式 (factory function) :func:`collections." -"namedtuple` 來建立。後者技術也增加了一些額外的 method,這些 method 可能是在手" -"寫或內建的 named tuple 中,無法找到的。" +"位 (named field) 即可。這類的 class 可以手工編寫、可以繼承" +"自 :class:`typing.NamedTuple` 來建立,也可以使用工廠函式 (factory " +"function) :func:`collections.namedtuple` 來建立。後者技術也增加了一些額外的 " +"method,這些 method 可能是在手寫或內建的 named tuple 中,無法找到的。" -#: ../../glossary.rst:913 +#: ../../glossary.rst:915 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../glossary.rst:915 +#: ../../glossary.rst:917 msgid "" "The place where a variable is stored. Namespaces are implemented as " "dictionaries. There are the local, global and built-in namespaces as well " "as nested namespaces in objects (in methods). Namespaces support modularity " -"by preventing naming conflicts. For instance, the functions :func:`builtins." -"open <.open>` and :func:`os.open` are distinguished by their namespaces. " -"Namespaces also aid readability and maintainability by making it clear which " -"module implements a function. For instance, writing :func:`random.seed` or :" -"func:`itertools.islice` makes it clear that those functions are implemented " -"by the :mod:`random` and :mod:`itertools` modules, respectively." +"by preventing naming conflicts. For instance, the " +"functions :func:`builtins.open <.open>` and :func:`os.open` are " +"distinguished by their namespaces. Namespaces also aid readability and " +"maintainability by making it clear which module implements a function. For " +"instance, writing :func:`random.seed` or :func:`itertools.islice` makes it " +"clear that those functions are implemented by the :mod:`random` " +"and :mod:`itertools` modules, respectively." msgstr "" "變數被儲存的地方。命名空間是以 dictionary(字典)被實作。有區域的、全域的及內" "建的命名空間,而在物件中(在 method 中)也有巢狀的命名空間。命名空間藉由防止" -"命名衝突,來支援模組化。例如,函式 :func:`builtins.open <.open>` 和 :func:" -"`os.open` 是透過它們的命名空間來區分彼此。命名空間也藉由明確地區分是哪個模組" -"在實作一個函式,來增進可讀性及可維護性。例如,寫出 :func:`random.seed` 或 :" -"func:`itertools.islice` 明確地表示,這些函式分別是由 :mod:`random` 和 :mod:" -"`itertools` 模組在實作。" +"命名衝突,來支援模組化。例如,函式 :func:`builtins.open <.open>` " +"和 :func:`os.open` 是透過它們的命名空間來區分彼此。命名空間也藉由明確地區分是" +"哪個模組在實作一個函式,來增進可讀性及可維護性。例如,寫" +"出 :func:`random.seed` 或 :func:`itertools.islice` 明確地表示,這些函式分別是" +"由 :mod:`random` 和 :mod:`itertools` 模組在實作。" -#: ../../glossary.rst:925 +#: ../../glossary.rst:927 msgid "namespace package" msgstr "namespace package(命名空間套件)" -#: ../../glossary.rst:927 +#: ../../glossary.rst:929 msgid "" "A :pep:`420` :term:`package` which serves only as a container for " "subpackages. Namespace packages may have no physical representation, and " @@ -2128,18 +2146,19 @@ msgid "" "``__init__.py`` file." msgstr "" "一個 :pep:`420` :term:`package`\\ (套件),它只能作為子套件 (subpackage) 的" -"一個容器。命名空間套件可能沒有實體的表示法,而且具體來說它們不像是一個 :term:" -"`regular package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這個檔案。" +"一個容器。命名空間套件可能沒有實體的表示法,而且具體來說它們不像是一" +"個 :term:`regular package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這" +"個檔案。" -#: ../../glossary.rst:932 +#: ../../glossary.rst:934 msgid "See also :term:`module`." msgstr "另請參閱 :term:`module`\\ (模組)。" -#: ../../glossary.rst:933 +#: ../../glossary.rst:935 msgid "nested scope" msgstr "nested scope(巢狀作用域)" -#: ../../glossary.rst:935 +#: ../../glossary.rst:937 msgid "" "The ability to refer to a variable in an enclosing definition. For " "instance, a function defined inside another function can refer to variables " @@ -2154,39 +2173,41 @@ msgstr "" "寫入。同樣地,全域變數是在全域命名空間中讀取及寫入。:keyword:`nonlocal` 容許" "對外層作用域進行寫入。" -#: ../../glossary.rst:942 +#: ../../glossary.rst:944 msgid "new-style class" msgstr "new-style class(新式類別)" -#: ../../glossary.rst:944 +#: ../../glossary.rst:946 msgid "" "Old name for the flavor of classes now used for all class objects. In " "earlier Python versions, only new-style classes could use Python's newer, " -"versatile features like :attr:`~object.__slots__`, descriptors, properties, :" -"meth:`~object.__getattribute__`, class methods, and static methods." +"versatile features like :attr:`~object.__slots__`, descriptors, " +"properties, :meth:`~object.__getattribute__`, class methods, and static " +"methods." msgstr "" "一個舊名,它是指現在所有的 class 物件所使用的 class 風格。在早期的 Python 版" -"本中,只有新式 class 才能使用 Python 較新的、多樣的功能,像是 :attr:`~object." -"__slots__`、描述器 (descriptor)、屬性 (property)、:meth:`~object." -"__getattribute__`、class method(類別方法)和 static method(靜態方法)。" +"本中,只有新式 class 才能使用 Python 較新的、多樣的功能,像" +"是 :attr:`~object.__slots__`、描述器 (descriptor)、屬性 " +"(property)、:meth:`~object.__getattribute__`、class method(類別方法)和 " +"static method(靜態方法)。" -#: ../../glossary.rst:949 +#: ../../glossary.rst:951 msgid "object" msgstr "object(物件)" -#: ../../glossary.rst:951 +#: ../../glossary.rst:953 msgid "" "Any data with state (attributes or value) and defined behavior (methods). " "Also the ultimate base class of any :term:`new-style class`." msgstr "" -"具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任何 :term:" -"`new-style class`\\ (新式類別)的最終 base class(基底類別)。" +"具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任" +"何 :term:`new-style class`\\ (新式類別)的最終 base class(基底類別)。" -#: ../../glossary.rst:954 +#: ../../glossary.rst:956 msgid "optimized scope" msgstr "optimized scope(最佳化作用域)" -#: ../../glossary.rst:956 +#: ../../glossary.rst:958 msgid "" "A scope where target local variable names are reliably known to the compiler " "when the code is compiled, allowing optimization of read and write access to " @@ -2197,11 +2218,11 @@ msgid "" "to optimized scopes." msgstr "" -#: ../../glossary.rst:963 +#: ../../glossary.rst:965 msgid "package" msgstr "package(套件)" -#: ../../glossary.rst:965 +#: ../../glossary.rst:967 msgid "" "A Python :term:`module` which can contain submodules or recursively, " "subpackages. Technically, a package is a Python module with a ``__path__`` " @@ -2211,17 +2232,17 @@ msgstr "" "迴的子套件 (subpackage)。技術上而言,套件就是具有 ``__path__`` 屬性的一個 " "Python 模組。" -#: ../../glossary.rst:969 +#: ../../glossary.rst:971 msgid "See also :term:`regular package` and :term:`namespace package`." msgstr "" "另請參閱 :term:`regular package`\\ (正規套件)和 :term:`namespace " "package`\\ (命名空間套件)。" -#: ../../glossary.rst:970 +#: ../../glossary.rst:972 msgid "parameter" msgstr "parameter(參數)" -#: ../../glossary.rst:972 +#: ../../glossary.rst:974 msgid "" "A named entity in a :term:`function` (or method) definition that specifies " "an :term:`argument` (or in some cases, arguments) that the function can " @@ -2231,7 +2252,7 @@ msgstr "" "它指明該函式能夠接受的一個 :term:`argument`\\ (引數),或在某些情況下指示多" "個引數。共有有五種不同的參數類型:" -#: ../../glossary.rst:976 +#: ../../glossary.rst:978 msgid "" ":dfn:`positional-or-keyword`: specifies an argument that can be passed " "either :term:`positionally <argument>` or as a :term:`keyword argument " @@ -2242,11 +2263,11 @@ msgstr "" "置 <argument>`\\ 或是作為\\ :term:`關鍵字引數 <argument>`\\ 被傳遞的引數。這" "是參數的預設類型,例如以下的 *foo* 和 *bar*: ::" -#: ../../glossary.rst:981 +#: ../../glossary.rst:983 msgid "def func(foo, bar=None): ..." msgstr "def func(foo, bar=None): ..." -#: ../../glossary.rst:985 +#: ../../glossary.rst:987 msgid "" ":dfn:`positional-only`: specifies an argument that can be supplied only by " "position. Positional-only parameters can be defined by including a ``/`` " @@ -2257,11 +2278,11 @@ msgstr "" "式定義的參數列表中包含一個 ``/`` 字元,就可以在該字元前面定義僅限位置參數,例" "如以下的 *posonly1* 和 *posonly2*: ::" -#: ../../glossary.rst:990 +#: ../../glossary.rst:992 msgid "def func(posonly1, posonly2, /, positional_or_keyword): ..." msgstr "def func(posonly1, posonly2, /, positional_or_keyword): ..." -#: ../../glossary.rst:994 +#: ../../glossary.rst:996 msgid "" ":dfn:`keyword-only`: specifies an argument that can be supplied only by " "keyword. Keyword-only parameters can be defined by including a single var-" @@ -2274,11 +2295,11 @@ msgstr "" "單純的 ``*`` 字元,就可以在其後方定義僅限關鍵字參數,例如以下的 *kw_only1* " "和 *kw_only2*: ::" -#: ../../glossary.rst:1000 +#: ../../glossary.rst:1002 msgid "def func(arg, *, kw_only1, kw_only2): ..." msgstr "def func(arg, *, kw_only1, kw_only2): ..." -#: ../../glossary.rst:1002 +#: ../../glossary.rst:1004 msgid "" ":dfn:`var-positional`: specifies that an arbitrary sequence of positional " "arguments can be provided (in addition to any positional arguments already " @@ -2290,11 +2311,11 @@ msgstr "" "數(在已被其他參數接受的任何位置引數之外)。這類參數是透過在其參數名稱字首加" "上 ``*`` 來定義的,例如以下的 *args*: ::" -#: ../../glossary.rst:1008 +#: ../../glossary.rst:1010 msgid "def func(*args, **kwargs): ..." msgstr "def func(*args, **kwargs): ..." -#: ../../glossary.rst:1010 +#: ../../glossary.rst:1012 msgid "" ":dfn:`var-keyword`: specifies that arbitrarily many keyword arguments can be " "provided (in addition to any keyword arguments already accepted by other " @@ -2305,29 +2326,29 @@ msgstr "" "已被其他參數接受的任何關鍵字引數之外)。這類參數是透過在其參數名稱字首加上 " "``**`` 來定義的,例如上面範例中的 *kwargs*。" -#: ../../glossary.rst:1016 +#: ../../glossary.rst:1018 msgid "" "Parameters can specify both optional and required arguments, as well as " "default values for some optional arguments." msgstr "" "參數可以指明引數是選擇性的或必需的,也可以為一些選擇性的引數指定預設值。" -#: ../../glossary.rst:1019 +#: ../../glossary.rst:1021 msgid "" "See also the :term:`argument` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters <faq-argument-vs-parameter>`, " -"the :class:`inspect.Parameter` class, the :ref:`function` section, and :pep:" -"`362`." +"the :class:`inspect.Parameter` class, the :ref:`function` section, " +"and :pep:`362`." msgstr "" "另請參閱術語表的 :term:`argument`\\ (引數)條目、常見問題中的\\ :ref:`引數和" "參數之間的差異 <faq-argument-vs-parameter>`、:class:`inspect.Parameter` " "class、:ref:`function`\\ 章節,以及 :pep:`362`。" -#: ../../glossary.rst:1023 +#: ../../glossary.rst:1025 msgid "path entry" msgstr "path entry(路徑項目)" -#: ../../glossary.rst:1025 +#: ../../glossary.rst:1027 msgid "" "A single location on the :term:`import path` which the :term:`path based " "finder` consults to find modules for importing." @@ -2335,33 +2356,33 @@ msgstr "" "在 :term:`import path`\\ (引入路徑)中的一個位置,而 :term:`path based " "finder` (基於路徑的尋檢器)會參考該位置來尋找要 import 的模組。" -#: ../../glossary.rst:1027 +#: ../../glossary.rst:1029 msgid "path entry finder" msgstr "path entry finder(路徑項目尋檢器)" -#: ../../glossary.rst:1029 +#: ../../glossary.rst:1031 msgid "" -"A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. a :" -"term:`path entry hook`) which knows how to locate modules given a :term:" -"`path entry`." +"A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. " +"a :term:`path entry hook`) which knows how to locate modules given " +"a :term:`path entry`." msgstr "" -"被 :data:`sys.path_hooks` 中的一個可呼叫物件 (callable)(意即一個 :term:" -"`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一個 :term:" -"`path entry`\\ 定位模組。" +"被 :data:`sys.path_hooks` 中的一個可呼叫物件 (callable)(意即一" +"個 :term:`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一" +"個 :term:`path entry`\\ 定位模組。" -#: ../../glossary.rst:1033 +#: ../../glossary.rst:1035 msgid "" "See :class:`importlib.abc.PathEntryFinder` for the methods that path entry " "finders implement." msgstr "" -"關於路徑項目尋檢器實作的 method,請參閱 :class:`importlib.abc." -"PathEntryFinder`。" +"關於路徑項目尋檢器實作的 method,請參" +"閱 :class:`importlib.abc.PathEntryFinder`。" -#: ../../glossary.rst:1035 +#: ../../glossary.rst:1037 msgid "path entry hook" msgstr "path entry hook(路徑項目鉤)" -#: ../../glossary.rst:1037 +#: ../../glossary.rst:1039 msgid "" "A callable on the :data:`sys.path_hooks` list which returns a :term:`path " "entry finder` if it knows how to find modules on a specific :term:`path " @@ -2371,11 +2392,11 @@ msgstr "" "個特定的 :term:`path entry` 中尋找模組,則會回傳一個 :term:`path entry " "finder`\\ (路徑項目尋檢器)。" -#: ../../glossary.rst:1040 +#: ../../glossary.rst:1042 msgid "path based finder" msgstr "path based finder(基於路徑的尋檢器)" -#: ../../glossary.rst:1042 +#: ../../glossary.rst:1044 msgid "" "One of the default :term:`meta path finders <meta path finder>` which " "searches an :term:`import path` for modules." @@ -2383,33 +2404,33 @@ msgstr "" "預設的\\ :term:`元路徑尋檢器 (meta path finder) <meta path finder>` 之一,它" "會在一個 :term:`import path` 中搜尋模組。" -#: ../../glossary.rst:1044 +#: ../../glossary.rst:1046 msgid "path-like object" msgstr "path-like object(類路徑物件)" -#: ../../glossary.rst:1046 +#: ../../glossary.rst:1048 msgid "" -"An object representing a file system path. A path-like object is either a :" -"class:`str` or :class:`bytes` object representing a path, or an object " -"implementing the :class:`os.PathLike` protocol. An object that supports the :" -"class:`os.PathLike` protocol can be converted to a :class:`str` or :class:" -"`bytes` file system path by calling the :func:`os.fspath` function; :func:" -"`os.fsdecode` and :func:`os.fsencode` can be used to guarantee a :class:" -"`str` or :class:`bytes` result instead, respectively. Introduced by :pep:" -"`519`." -msgstr "" -"一個表示檔案系統路徑的物件。類路徑物件可以是一個表示路徑的 :class:`str` 或 :" -"class:`bytes` 物件,或是一個實作 :class:`os.PathLike` 協定的物件。透過呼叫 :" -"func:`os.fspath` 函式,一個支援 :class:`os.PathLike` 協定的物件可以被轉換為 :" -"class:`str` 或 :class:`bytes` 檔案系統路徑;而 :func:`os.fsdecode` 及 :func:" -"`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結果。由 :" -"pep:`519` 引入。" - -#: ../../glossary.rst:1054 +"An object representing a file system path. A path-like object is either " +"a :class:`str` or :class:`bytes` object representing a path, or an object " +"implementing the :class:`os.PathLike` protocol. An object that supports " +"the :class:`os.PathLike` protocol can be converted to a :class:`str` " +"or :class:`bytes` file system path by calling the :func:`os.fspath` " +"function; :func:`os.fsdecode` and :func:`os.fsencode` can be used to " +"guarantee a :class:`str` or :class:`bytes` result instead, respectively. " +"Introduced by :pep:`519`." +msgstr "" +"一個表示檔案系統路徑的物件。類路徑物件可以是一個表示路徑的 :class:`str` " +"或 :class:`bytes` 物件,或是一個實作 :class:`os.PathLike` 協定的物件。透過呼" +"叫 :func:`os.fspath` 函式,一個支援 :class:`os.PathLike` 協定的物件可以被轉換" +"為 :class:`str` 或 :class:`bytes` 檔案系統路徑;而 :func:`os.fsdecode` " +"及 :func:`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結" +"果。由 :pep:`519` 引入。" + +#: ../../glossary.rst:1056 msgid "PEP" msgstr "PEP" -#: ../../glossary.rst:1056 +#: ../../glossary.rst:1058 msgid "" "Python Enhancement Proposal. A PEP is a design document providing " "information to the Python community, or describing a new feature for Python " @@ -2420,7 +2441,7 @@ msgstr "" "為 Python 社群提供資訊,或是描述 Python 的一個新功能或該功能的程序和環境。" "PEP 應該要提供簡潔的技術規範以及被提案功能的運作原理。" -#: ../../glossary.rst:1062 +#: ../../glossary.rst:1064 msgid "" "PEPs are intended to be the primary mechanisms for proposing major new " "features, for collecting community input on an issue, and for documenting " @@ -2432,15 +2453,15 @@ msgstr "" "已納入 Python 的設計決策的記錄,這些過程的主要機制。PEP 的作者要負責在社群內" "建立共識並記錄反對意見。" -#: ../../glossary.rst:1068 +#: ../../glossary.rst:1070 msgid "See :pep:`1`." msgstr "請參閱 :pep:`1`。" -#: ../../glossary.rst:1069 +#: ../../glossary.rst:1071 msgid "portion" msgstr "portion(部分)" -#: ../../glossary.rst:1071 +#: ../../glossary.rst:1073 msgid "" "A set of files in a single directory (possibly stored in a zip file) that " "contribute to a namespace package, as defined in :pep:`420`." @@ -2448,15 +2469,15 @@ msgstr "" "在單一目錄中的一組檔案(也可能儲存在一個 zip 檔中),這些檔案能對一個命名空間" "套件 (namespace package) 有所貢獻,如同 :pep:`420` 中的定義。" -#: ../../glossary.rst:1073 +#: ../../glossary.rst:1075 msgid "positional argument" msgstr "positional argument(位置引數)" -#: ../../glossary.rst:1076 +#: ../../glossary.rst:1078 msgid "provisional API" msgstr "provisional API(暫行 API)" -#: ../../glossary.rst:1078 +#: ../../glossary.rst:1080 msgid "" "A provisional API is one which has been deliberately excluded from the " "standard library's backwards compatibility guarantees. While major changes " @@ -2472,7 +2493,7 @@ msgstr "" "該介面)。這種變更並不會無端地產生——只有 API 被納入之前未察覺的嚴重基本缺陷被" "揭露時,它們才會發生。" -#: ../../glossary.rst:1087 +#: ../../glossary.rst:1089 msgid "" "Even for provisional APIs, backwards incompatible changes are seen as a " "\"solution of last resort\" - every attempt will still be made to find a " @@ -2481,7 +2502,7 @@ msgstr "" "即使對於暫行 API,向後不相容的變更也會被視為「最後的解決方案」——對於任何被發" "現的問題,仍然會盡可能找出一個向後相容的解決方案。" -#: ../../glossary.rst:1091 +#: ../../glossary.rst:1093 msgid "" "This process allows the standard library to continue to evolve over time, " "without locking in problematic design errors for extended periods of time. " @@ -2490,19 +2511,19 @@ msgstr "" "這個過程使得標準函式庫能隨著時間不斷進化,而避免耗費過長的時間去鎖定有問題的" "設計錯誤。請參閱 :pep:`411` 了解更多細節。" -#: ../../glossary.rst:1094 +#: ../../glossary.rst:1096 msgid "provisional package" msgstr "provisional package(暫行套件)" -#: ../../glossary.rst:1096 +#: ../../glossary.rst:1098 msgid "See :term:`provisional API`." msgstr "請參閱 :term:`provisional API`\\ (暫行 API)。" -#: ../../glossary.rst:1097 +#: ../../glossary.rst:1099 msgid "Python 3000" msgstr "Python 3000" -#: ../../glossary.rst:1099 +#: ../../glossary.rst:1101 msgid "" "Nickname for the Python 3.x release line (coined long ago when the release " "of version 3 was something in the distant future.) This is also abbreviated " @@ -2511,11 +2532,11 @@ msgstr "" "Python 3.x 系列版本的暱稱(很久以前創造的,當時第 3 版的發布是在遙遠的未" "來。)也可以縮寫為「Py3k」。" -#: ../../glossary.rst:1102 +#: ../../glossary.rst:1104 msgid "Pythonic" msgstr "Pythonic(Python 風格的)" -#: ../../glossary.rst:1104 +#: ../../glossary.rst:1106 msgid "" "An idea or piece of code which closely follows the most common idioms of the " "Python language, rather than implementing code using concepts common to " @@ -2525,11 +2546,11 @@ msgid "" "Python sometimes use a numerical counter instead::" msgstr "" "一個想法或一段程式碼,它應用了 Python 語言最常見的慣用語,而不是使用其他語言" -"常見的概念來實作程式碼。例如,Python 中常見的一種習慣用法,是使用一個 :" -"keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並沒有" -"這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" +"常見的概念來實作程式碼。例如,Python 中常見的一種習慣用法,是使用一" +"個 :keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並" +"沒有這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" -#: ../../glossary.rst:1111 +#: ../../glossary.rst:1113 msgid "" "for i in range(len(food)):\n" " print(food[i])" @@ -2537,11 +2558,11 @@ msgstr "" "for i in range(len(food)):\n" " print(food[i])" -#: ../../glossary.rst:1114 +#: ../../glossary.rst:1116 msgid "As opposed to the cleaner, Pythonic method::" msgstr "相較之下,以下方法更簡潔、更具有 Python 風格: ::" -#: ../../glossary.rst:1116 +#: ../../glossary.rst:1118 msgid "" "for piece in food:\n" " print(piece)" @@ -2549,11 +2570,11 @@ msgstr "" "for piece in food:\n" " print(piece)" -#: ../../glossary.rst:1118 +#: ../../glossary.rst:1120 msgid "qualified name" msgstr "qualified name(限定名稱)" -#: ../../glossary.rst:1120 +#: ../../glossary.rst:1122 msgid "" "A dotted name showing the \"path\" from a module's global scope to a class, " "function or method defined in that module, as defined in :pep:`3155`. For " @@ -2564,7 +2585,7 @@ msgstr "" "或 method 的「路徑」,如 :pep:`3155` 中的定義。對於頂層的函式和 class 而言," "限定名稱與其物件名稱相同: ::" -#: ../../glossary.rst:1125 +#: ../../glossary.rst:1127 msgid "" ">>> class C:\n" "... class D:\n" @@ -2590,16 +2611,16 @@ msgstr "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" -#: ../../glossary.rst:1137 +#: ../../glossary.rst:1139 msgid "" "When used to refer to modules, the *fully qualified name* means the entire " -"dotted path to the module, including any parent packages, e.g. ``email.mime." -"text``::" +"dotted path to the module, including any parent packages, e.g. " +"``email.mime.text``::" msgstr "" "當用於引用模組時,*完全限定名稱 (fully qualified name)* 是表示該模組的完整點" "分隔路徑,包括任何的父套件,例如 ``email.mime.text``: ::" -#: ../../glossary.rst:1141 +#: ../../glossary.rst:1143 msgid "" ">>> import email.mime.text\n" ">>> email.mime.text.__name__\n" @@ -2609,11 +2630,11 @@ msgstr "" ">>> email.mime.text.__name__\n" "'email.mime.text'" -#: ../../glossary.rst:1144 +#: ../../glossary.rst:1146 msgid "reference count" msgstr "reference count(參照計數)" -#: ../../glossary.rst:1146 +#: ../../glossary.rst:1148 msgid "" "The number of references to an object. When the reference count of an " "object drops to zero, it is deallocated. Some objects are :term:`immortal` " @@ -2626,42 +2647,42 @@ msgstr "" "對於一個物件的參照次數。當一個物件的參照計數下降到零時,它會被解除配置 " "(deallocated)。有些物件是「\\ :term:`不滅的 <immortal>` (immortal)」並擁有不" "會被改變的參照計數,也因此永遠不會被解除配置。參照計數通常在 Python 程式碼中" -"看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :" -"func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" +"看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼" +"叫 :func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" -#: ../../glossary.rst:1154 +#: ../../glossary.rst:1156 msgid "regular package" msgstr "regular package(正規套件)" -#: ../../glossary.rst:1156 +#: ../../glossary.rst:1158 msgid "" -"A traditional :term:`package`, such as a directory containing an ``__init__." -"py`` file." +"A traditional :term:`package`, such as a directory containing an " +"``__init__.py`` file." msgstr "" "一個傳統的 :term:`package`\\ (套件),例如一個包含 ``__init__.py`` 檔案的目" "錄。" -#: ../../glossary.rst:1159 +#: ../../glossary.rst:1161 msgid "See also :term:`namespace package`." msgstr "另請參閱 :term:`namespace package`\\ (命名空間套件)。" -#: ../../glossary.rst:1160 +#: ../../glossary.rst:1162 msgid "REPL" msgstr "REPL" -#: ../../glossary.rst:1162 +#: ../../glossary.rst:1164 msgid "" -"An acronym for the \"read–eval–print loop\", another name for the :term:" -"`interactive` interpreter shell." +"An acronym for the \"read–eval–print loop\", another name for " +"the :term:`interactive` interpreter shell." msgstr "" "「read-eval-print 迴圈 (read–eval–print loop)」的縮寫,是\\ :term:`互動式 " "<interactive>`\\ 直譯器 shell 的另一個名稱。" -#: ../../glossary.rst:1164 +#: ../../glossary.rst:1166 msgid "__slots__" msgstr "__slots__" -#: ../../glossary.rst:1166 +#: ../../glossary.rst:1168 msgid "" "A declaration inside a class that saves memory by pre-declaring space for " "instance attributes and eliminating instance dictionaries. Though popular, " @@ -2674,66 +2695,66 @@ msgstr "" "最好保留給那種在一個記憶體關鍵 (memory-critical) 的應用程式中存在大量實例的罕" "見情況。" -#: ../../glossary.rst:1171 +#: ../../glossary.rst:1173 msgid "sequence" msgstr "sequence(序列)" -#: ../../glossary.rst:1173 +#: ../../glossary.rst:1175 msgid "" "An :term:`iterable` which supports efficient element access using integer " -"indices via the :meth:`~object.__getitem__` special method and defines a :" -"meth:`~object.__len__` method that returns the length of the sequence. Some " -"built-in sequence types are :class:`list`, :class:`str`, :class:`tuple`, " -"and :class:`bytes`. Note that :class:`dict` also supports :meth:`~object." -"__getitem__` and :meth:`!__len__`, but is considered a mapping rather than a " -"sequence because the lookups use arbitrary :term:`hashable` keys rather than " -"integers." +"indices via the :meth:`~object.__getitem__` special method and defines " +"a :meth:`~object.__len__` method that returns the length of the sequence. " +"Some built-in sequence types " +"are :class:`list`, :class:`str`, :class:`tuple`, and :class:`bytes`. Note " +"that :class:`dict` also supports :meth:`~object.__getitem__` and :meth:`!" +"__len__`, but is considered a mapping rather than a sequence because the " +"lookups use arbitrary :term:`hashable` keys rather than integers." msgstr "" "一個 :term:`iterable`\\ (可疊代物件),它透過 :meth:`~object.__getitem__` " "special method(特殊方法),使用整數索引來支援高效率的元素存取,並定義了一" -"個 :meth:`~object.__len__` method 來回傳該序列的長度。一些內建序列型別包括 :" -"class:`list`、:class:`str`、:class:`tuple` 和 :class:`bytes`。請注意,雖然 :" -"class:`dict` 也支援 :meth:`~object.__getitem__` 和 :meth:`!__len__`,但它被視" -"為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` 鍵," -"而不是整數。" +"個 :meth:`~object.__len__` method 來回傳該序列的長度。一些內建序列型別包" +"括 :class:`list`、:class:`str`、:class:`tuple` 和 :class:`bytes`。請注意,雖" +"然 :class:`dict` 也支援 :meth:`~object.__getitem__` 和 :meth:`!__len__`,但它" +"被視為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` " +"鍵,而不是整數。" -#: ../../glossary.rst:1182 +#: ../../glossary.rst:1184 msgid "" "The :class:`collections.abc.Sequence` abstract base class defines a much " -"richer interface that goes beyond just :meth:`~object.__getitem__` and :meth:" -"`~object.__len__`, adding :meth:`!count`, :meth:`!index`, :meth:`~object." -"__contains__`, and :meth:`~object.__reversed__`. Types that implement this " -"expanded interface can be registered explicitly using :func:`~abc.ABCMeta." -"register`. For more documentation on sequence methods generally, see :ref:" -"`Common Sequence Operations <typesseq-common>`." +"richer interface that goes beyond just :meth:`~object.__getitem__` " +"and :meth:`~object.__len__`, adding :meth:`!count`, :meth:`!" +"index`, :meth:`~object.__contains__`, and :meth:`~object.__reversed__`. " +"Types that implement this expanded interface can be registered explicitly " +"using :func:`~abc.ABCMeta.register`. For more documentation on sequence " +"methods generally, see :ref:`Common Sequence Operations <typesseq-common>`." msgstr "" "抽象基底類別 (abstract base class) :class:`collections.abc.Sequence` 定義了一" -"個更加豐富的介面,並不僅止於 :meth:`~object.__getitem__` 和 :meth:`~object." -"__len__`,還增加了 :meth:`!count`、:meth:`!index`、:meth:`~object." -"__contains__` 和 :meth:`~object.__reversed__`。實作此擴充介面的型別,可以使" -"用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於序列方法的文件,請見" -"\\ :ref:`常見序列操作 <typesseq-common>`。" +"個更加豐富的介面,並不僅止於 :meth:`~object.__getitem__` " +"和 :meth:`~object.__len__`,還增加了 :meth:`!count`、:meth:`!" +"index`、:meth:`~object.__contains__` 和 :meth:`~object.__reversed__`。實作此" +"擴充介面的型別,可以使用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於" +"序列方法的文件,請見\\ :ref:`常見序列操作 <typesseq-common>`。" -#: ../../glossary.rst:1191 +#: ../../glossary.rst:1193 msgid "set comprehension" msgstr "set comprehension(集合綜合運算)" -#: ../../glossary.rst:1193 +#: ../../glossary.rst:1195 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a set with the results. ``results = {c for c in 'abracadabra' if c " -"not in 'abc'}`` generates the set of strings ``{'r', 'd'}``. See :ref:" -"`comprehensions`." +"not in 'abc'}`` generates the set of strings ``{'r', 'd'}``. " +"See :ref:`comprehensions`." msgstr "" "一種緊密的方法,用來處理一個可疊代物件中的全部或部分元素,並將處理結果以一個 " "set 回傳。``results = {c for c in 'abracadabra' if c not in 'abc'}`` 會產生一" "個字串 set:``{'r', 'd'}``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:1197 +#: ../../glossary.rst:1199 msgid "single dispatch" msgstr "single dispatch(單一調度)" -#: ../../glossary.rst:1199 +#: ../../glossary.rst:1201 msgid "" "A form of :term:`generic function` dispatch where the implementation is " "chosen based on the type of a single argument." @@ -2741,11 +2762,11 @@ msgstr "" ":term:`generic function`\\ (泛型函式)調度的一種形式,在此,實作的選擇是基於" "單一引數的型別。" -#: ../../glossary.rst:1201 +#: ../../glossary.rst:1203 msgid "slice" msgstr "slice(切片)" -#: ../../glossary.rst:1203 +#: ../../glossary.rst:1205 msgid "" "An object usually containing a portion of a :term:`sequence`. A slice is " "created using the subscript notation, ``[]`` with colons between numbers " @@ -2757,11 +2778,11 @@ msgstr "" "之間使用冒號,例如 ``variable_name[1:3:5]``。在括號(下標)符號的內部,會使" "用 :class:`slice` 物件。" -#: ../../glossary.rst:1207 +#: ../../glossary.rst:1209 msgid "soft deprecated" msgstr "soft deprecated(軟性棄用)" -#: ../../glossary.rst:1209 +#: ../../glossary.rst:1211 msgid "" "A soft deprecated API should not be used in new code, but it is safe for " "already existing code to use it. The API remains documented and tested, but " @@ -2770,13 +2791,13 @@ msgstr "" "被軟性棄用的 API 代表不應再用於新程式碼中,但在現有程式碼中繼續使用它仍會是安" "全的。API 仍會以文件記錄並會被測試,但不會被繼續改進。" -#: ../../glossary.rst:1213 +#: ../../glossary.rst:1215 msgid "" "Soft deprecation, unlike normal deprecation, does not plan on removing the " "API and will not emit warnings." msgstr "與正常棄用不同,軟性棄用沒有刪除 API 的規劃,也不會發出警告。" -#: ../../glossary.rst:1216 +#: ../../glossary.rst:1218 msgid "" "See `PEP 387: Soft Deprecation <https://peps.python.org/pep-0387/#soft-" "deprecation>`_." @@ -2784,65 +2805,65 @@ msgstr "" "請參閱 `PEP 387:軟性棄用 <https://peps.python.org/pep-0387/#soft-" "deprecation>`_。" -#: ../../glossary.rst:1218 +#: ../../glossary.rst:1220 msgid "special method" msgstr "special method(特殊方法)" -#: ../../glossary.rst:1222 +#: ../../glossary.rst:1224 msgid "" "A method that is called implicitly by Python to execute a certain operation " "on a type, such as addition. Such methods have names starting and ending " -"with double underscores. Special methods are documented in :ref:" -"`specialnames`." +"with double underscores. Special methods are documented " +"in :ref:`specialnames`." msgstr "" "一種會被 Python 自動呼叫的 method,用於對某種型別執行某種運算,例如加法。這" -"種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在\\ :ref:" -"`specialnames`\\ 中有詳細說明。" +"種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在" +"\\ :ref:`specialnames`\\ 中有詳細說明。" -#: ../../glossary.rst:1226 +#: ../../glossary.rst:1228 msgid "statement" msgstr "statement(陳述式)" -#: ../../glossary.rst:1228 +#: ../../glossary.rst:1230 msgid "" "A statement is part of a suite (a \"block\" of code). A statement is either " -"an :term:`expression` or one of several constructs with a keyword, such as :" -"keyword:`if`, :keyword:`while` or :keyword:`for`." +"an :term:`expression` or one of several constructs with a keyword, such " +"as :keyword:`if`, :keyword:`while` or :keyword:`for`." msgstr "" -"陳述式是一個套組(suite,一個程式碼「區塊」)中的一部分。陳述式可以是一個 :" -"term:`expression`\\ (運算式),或是含有關鍵字(例如 :keyword:`if`、:keyword:" -"`while` 或 :keyword:`for`\\ )的多種結構之一。" +"陳述式是一個套組(suite,一個程式碼「區塊」)中的一部分。陳述式可以是一" +"個 :term:`expression`\\ (運算式),或是含有關鍵字(例" +"如 :keyword:`if`、:keyword:`while` 或 :keyword:`for`\\ )的多種結構之一。" -#: ../../glossary.rst:1231 +#: ../../glossary.rst:1233 msgid "static type checker" msgstr "static type checker(靜態型別檢查器)" -#: ../../glossary.rst:1233 +#: ../../glossary.rst:1235 msgid "" "An external tool that reads Python code and analyzes it, looking for issues " -"such as incorrect types. See also :term:`type hints <type hint>` and the :" -"mod:`typing` module." +"such as incorrect types. See also :term:`type hints <type hint>` and " +"the :mod:`typing` module." msgstr "" "會讀取 Python 程式碼並分析的外部工具,能夠找出錯誤,像是使用了不正確的型別。" "另請參閱\\ :term:`型別提示 (type hints) <type hint>` 以及 :mod:`typing` 模" "組。" -#: ../../glossary.rst:1236 +#: ../../glossary.rst:1238 msgid "strong reference" msgstr "strong reference(強參照)" -#: ../../glossary.rst:1238 +#: ../../glossary.rst:1240 msgid "" "In Python's C API, a strong reference is a reference to an object which is " "owned by the code holding the reference. The strong reference is taken by " -"calling :c:func:`Py_INCREF` when the reference is created and released with :" -"c:func:`Py_DECREF` when the reference is deleted." +"calling :c:func:`Py_INCREF` when the reference is created and released " +"with :c:func:`Py_DECREF` when the reference is deleted." msgstr "" "在 Python 的 C API 中,強參照是對物件的參照,該物件為持有該參照的程式碼所擁" -"有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透過 :c:" -"func:`Py_DECREF` 釋放強參照。" +"有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透" +"過 :c:func:`Py_DECREF` 釋放強參照。" -#: ../../glossary.rst:1244 +#: ../../glossary.rst:1246 msgid "" "The :c:func:`Py_NewRef` function can be used to create a strong reference to " "an object. Usually, the :c:func:`Py_DECREF` function must be called on the " @@ -2852,15 +2873,15 @@ msgstr "" ":c:func:`Py_NewRef` 函式可用於建立一個對物件的強參照。通常,在退出強參照的作" "用域之前,必須在該強參照上呼叫 :c:func:`Py_DECREF` 函式,以避免洩漏一個參照。" -#: ../../glossary.rst:1249 +#: ../../glossary.rst:1251 msgid "See also :term:`borrowed reference`." msgstr "另請參閱 :term:`borrowed reference`\\ (借用參照)。" -#: ../../glossary.rst:1250 +#: ../../glossary.rst:1252 msgid "text encoding" msgstr "text encoding(文字編碼)" -#: ../../glossary.rst:1252 +#: ../../glossary.rst:1254 msgid "" "A string in Python is a sequence of Unicode code points (in range " "``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be " @@ -2869,7 +2890,7 @@ msgstr "" "Python 中的字串是一個 Unicode 碼點 (code point) 的序列(範圍在 ``U+0000`` -- " "``U+10FFFF`` 之間)。若要儲存或傳送一個字串,它必須被序列化為一個位元組序列。" -#: ../../glossary.rst:1256 +#: ../../glossary.rst:1258 msgid "" "Serializing a string into a sequence of bytes is known as \"encoding\", and " "recreating the string from the sequence of bytes is known as \"decoding\"." @@ -2877,7 +2898,7 @@ msgstr "" "將一個字串序列化為位元組序列,稱為「編碼」,而從位元組序列重新建立該字串則稱" "為「解碼 (decoding)」。" -#: ../../glossary.rst:1259 +#: ../../glossary.rst:1261 msgid "" "There are a variety of different text serialization :ref:`codecs <standard-" "encodings>`, which are collectively referred to as \"text encodings\"." @@ -2885,37 +2906,39 @@ msgstr "" "有多種不同的文字序列化編解碼器 (:ref:`codecs <standard-encodings>`),它們被統" "稱為「文字編碼」。" -#: ../../glossary.rst:1262 +#: ../../glossary.rst:1264 msgid "text file" msgstr "text file(文字檔案)" -#: ../../glossary.rst:1264 +#: ../../glossary.rst:1266 msgid "" "A :term:`file object` able to read and write :class:`str` objects. Often, a " -"text file actually accesses a byte-oriented datastream and handles the :term:" -"`text encoding` automatically. Examples of text files are files opened in " -"text mode (``'r'`` or ``'w'``), :data:`sys.stdin`, :data:`sys.stdout`, and " -"instances of :class:`io.StringIO`." +"text file actually accesses a byte-oriented datastream and handles " +"the :term:`text encoding` automatically. Examples of text files are files " +"opened in text mode (``'r'`` or " +"``'w'``), :data:`sys.stdin`, :data:`sys.stdout`, and instances " +"of :class:`io.StringIO`." msgstr "" "一個能夠讀取和寫入 :class:`str` 物件的一個 :term:`file object`\\ (檔案物" "件)。通常,文字檔案實際上是存取位元組導向的資料流 (byte-oriented " "datastream) 並會自動處理 :term:`text encoding`\\ (文字編碼)。文字檔案的例子" -"有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔案、:data:`sys.stdin`、:data:" -"`sys.stdout` 以及 :class:`io.StringIO` 的實例。" +"有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔" +"案、:data:`sys.stdin`、:data:`sys.stdout` 以及 :class:`io.StringIO` 的實例。" -#: ../../glossary.rst:1271 +#: ../../glossary.rst:1273 msgid "" -"See also :term:`binary file` for a file object able to read and write :term:" -"`bytes-like objects <bytes-like object>`." +"See also :term:`binary file` for a file object able to read and " +"write :term:`bytes-like objects <bytes-like object>`." msgstr "" -"另請參閱 :term:`binary file`\\ (二進位檔案),它是一個能夠讀取和寫入\\ :" -"term:`類位元組串物件 (bytes-like object) <bytes-like object>` 的檔案物件。" +"另請參閱 :term:`binary file`\\ (二進位檔案),它是一個能夠讀取和寫入" +"\\ :term:`類位元組串物件 (bytes-like object) <bytes-like object>` 的檔案物" +"件。" -#: ../../glossary.rst:1273 +#: ../../glossary.rst:1275 msgid "triple-quoted string" msgstr "triple-quoted string(三引號內字串)" -#: ../../glossary.rst:1275 +#: ../../glossary.rst:1277 msgid "" "A string which is bound by three instances of either a quotation mark (\") " "or an apostrophe ('). While they don't provide any functionality not " @@ -2930,36 +2953,37 @@ msgstr "" "中包含未跳脫 (unescaped) 的單引號和雙引號,而且它們不需使用連續字元 " "(continuation character) 就可以跨越多行,這使得它們在編寫說明字串時特別有用。" -#: ../../glossary.rst:1282 +#: ../../glossary.rst:1284 msgid "type" msgstr "type(型別)" -#: ../../glossary.rst:1284 +#: ../../glossary.rst:1286 msgid "" "The type of a Python object determines what kind of object it is; every " -"object has a type. An object's type is accessible as its :attr:`~object." -"__class__` attribute or can be retrieved with ``type(obj)``." +"object has a type. An object's type is accessible as " +"its :attr:`~object.__class__` attribute or can be retrieved with " +"``type(obj)``." msgstr "" "一個 Python 物件的型別決定了它是什麼類型的物件;每個物件都有一個型別。一個物" "件的型別可以用它的 :attr:`~object.__class__` 屬性來存取,或以 ``type(obj)`` " "來檢索。" -#: ../../glossary.rst:1288 +#: ../../glossary.rst:1290 msgid "type alias" msgstr "type alias(型別別名)" -#: ../../glossary.rst:1290 +#: ../../glossary.rst:1292 msgid "A synonym for a type, created by assigning the type to an identifier." msgstr "一個型別的同義詞,透過將型別指定給一個識別符 (identifier) 來建立。" -#: ../../glossary.rst:1292 +#: ../../glossary.rst:1294 msgid "" "Type aliases are useful for simplifying :term:`type hints <type hint>`. For " "example::" msgstr "" "型別別名對於簡化\\ :term:`型別提示 (type hint) <type hint>` 很有用。例如: ::" -#: ../../glossary.rst:1295 +#: ../../glossary.rst:1297 msgid "" "def remove_gray_shades(\n" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" @@ -2969,11 +2993,11 @@ msgstr "" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" " pass" -#: ../../glossary.rst:1299 +#: ../../glossary.rst:1301 msgid "could be made more readable like this::" msgstr "可以寫成這樣,更具有可讀性: ::" -#: ../../glossary.rst:1301 +#: ../../glossary.rst:1303 msgid "" "Color = tuple[int, int, int]\n" "\n" @@ -2985,15 +3009,15 @@ msgstr "" "def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" " pass" -#: ../../glossary.rst:1306 ../../glossary.rst:1320 +#: ../../glossary.rst:1308 ../../glossary.rst:1322 msgid "See :mod:`typing` and :pep:`484`, which describe this functionality." msgstr "請參閱 :mod:`typing` 和 :pep:`484`,有此功能的描述。" -#: ../../glossary.rst:1307 +#: ../../glossary.rst:1309 msgid "type hint" msgstr "type hint(型別提示)" -#: ../../glossary.rst:1309 +#: ../../glossary.rst:1311 msgid "" "An :term:`annotation` that specifies the expected type for a variable, a " "class attribute, or a function parameter or return value." @@ -3001,7 +3025,7 @@ msgstr "" "一種 :term:`annotation`\\ (註釋),它指定一個變數、一個 class 屬性或一個函式" "的參數或回傳值的預期型別。" -#: ../../glossary.rst:1312 +#: ../../glossary.rst:1314 msgid "" "Type hints are optional and are not enforced by Python but they are useful " "to :term:`static type checkers <static type checker>`. They can also aid " @@ -3011,45 +3035,45 @@ msgstr "" "(static type checkers) <static type checker>`\\ 很有用,並能協助 IDE 完成程式" "碼的補全 (completion) 和重構 (refactoring)。" -#: ../../glossary.rst:1316 +#: ../../glossary.rst:1318 msgid "" "Type hints of global variables, class attributes, and functions, but not " "local variables, can be accessed using :func:`typing.get_type_hints`." msgstr "" -"全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使用 :func:" -"`typing.get_type_hints` 來存取。" +"全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使" +"用 :func:`typing.get_type_hints` 來存取。" -#: ../../glossary.rst:1321 +#: ../../glossary.rst:1323 msgid "universal newlines" msgstr "universal newlines(通用換行字元)" -#: ../../glossary.rst:1323 +#: ../../glossary.rst:1325 msgid "" "A manner of interpreting text streams in which all of the following are " "recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the " "Windows convention ``'\\r\\n'``, and the old Macintosh convention " -"``'\\r'``. See :pep:`278` and :pep:`3116`, as well as :func:`bytes." -"splitlines` for an additional use." +"``'\\r'``. See :pep:`278` and :pep:`3116`, as well " +"as :func:`bytes.splitlines` for an additional use." msgstr "" "一種解譯文字流 (text stream) 的方式,會將以下所有的情況識別為一行的結束:" "Unix 行尾慣例 ``'\\n'``、Windows 慣例 ``'\\r\\n'`` 和舊的 Macintosh 慣例 " -"``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用於 :func:`bytes." -"splitlines` 的附加用途。" +"``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用" +"於 :func:`bytes.splitlines` 的附加用途。" -#: ../../glossary.rst:1328 +#: ../../glossary.rst:1330 msgid "variable annotation" msgstr "variable annotation(變數註釋)" -#: ../../glossary.rst:1330 +#: ../../glossary.rst:1332 msgid "An :term:`annotation` of a variable or a class attribute." msgstr "一個變數或 class 屬性的 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:1332 +#: ../../glossary.rst:1334 msgid "" "When annotating a variable or a class attribute, assignment is optional::" msgstr "註釋變數或 class 屬性時,賦值是選擇性的: ::" -#: ../../glossary.rst:1334 +#: ../../glossary.rst:1336 msgid "" "class C:\n" " field: 'annotation'" @@ -3057,7 +3081,7 @@ msgstr "" "class C:\n" " field: 'annotation'" -#: ../../glossary.rst:1337 +#: ../../glossary.rst:1339 msgid "" "Variable annotations are usually used for :term:`type hints <type hint>`: " "for example this variable is expected to take :class:`int` values::" @@ -3065,15 +3089,15 @@ msgstr "" "變數註釋通常用於\\ :term:`型別提示 (type hint) <type hint>`:例如,這個變數預" "期會取得 :class:`int`\\ (整數)值: ::" -#: ../../glossary.rst:1341 +#: ../../glossary.rst:1343 msgid "count: int = 0" msgstr "count: int = 0" -#: ../../glossary.rst:1343 +#: ../../glossary.rst:1345 msgid "Variable annotation syntax is explained in section :ref:`annassign`." msgstr "變數註釋的語法在\\ :ref:`annassign`\\ 章節有詳細的解釋。" -#: ../../glossary.rst:1345 +#: ../../glossary.rst:1347 msgid "" "See :term:`function annotation`, :pep:`484` and :pep:`526`, which describe " "this functionality. Also see :ref:`annotations-howto` for best practices on " @@ -3082,11 +3106,11 @@ msgstr "" "請參閱 :term:`function annotation`\\ (函式註釋)、:pep:`484` 和 :pep:`526`," "皆有此功能的描述。關於註釋的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:1349 +#: ../../glossary.rst:1351 msgid "virtual environment" msgstr "virtual environment(虛擬環境)" -#: ../../glossary.rst:1351 +#: ../../glossary.rst:1353 msgid "" "A cooperatively isolated runtime environment that allows Python users and " "applications to install and upgrade Python distribution packages without " @@ -3097,27 +3121,27 @@ msgstr "" "程式得以安裝和升級 Python 發佈套件,而不會對同一個系統上運行的其他 Python 應" "用程式的行為產生干擾。" -#: ../../glossary.rst:1356 +#: ../../glossary.rst:1358 msgid "See also :mod:`venv`." msgstr "另請參閱 :mod:`venv`。" -#: ../../glossary.rst:1357 +#: ../../glossary.rst:1359 msgid "virtual machine" msgstr "virtual machine(虛擬機器)" -#: ../../glossary.rst:1359 +#: ../../glossary.rst:1361 msgid "" "A computer defined entirely in software. Python's virtual machine executes " "the :term:`bytecode` emitted by the bytecode compiler." msgstr "" -"一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行由 :term:" -"`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" +"一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行" +"由 :term:`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" -#: ../../glossary.rst:1361 +#: ../../glossary.rst:1363 msgid "Zen of Python" msgstr "Zen of Python(Python 之禪)" -#: ../../glossary.rst:1363 +#: ../../glossary.rst:1365 msgid "" "Listing of Python design principles and philosophies that are helpful in " "understanding and using the language. The listing can be found by typing " @@ -3134,22 +3158,22 @@ msgstr "C-contiguous(C 連續的)" msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" -#: ../../glossary.rst:825 +#: ../../glossary.rst:827 msgid "magic" msgstr "magic" -#: ../../glossary.rst:1220 +#: ../../glossary.rst:1222 msgid "special" msgstr "special" #~ msgid "" #~ "An object which controls the environment seen in a :keyword:`with` " -#~ "statement by defining :meth:`~object.__enter__` and :meth:`~object." -#~ "__exit__` methods. See :pep:`343`." +#~ "statement by defining :meth:`~object.__enter__` " +#~ "and :meth:`~object.__exit__` methods. See :pep:`343`." #~ msgstr "" -#~ "一個可以控制 :keyword:`with` 陳述式中所見環境的物件,而它是透過定義 :meth:" -#~ "`~object.__enter__` 和 :meth:`~object.__exit__` method 來控制的。請參閱 :" -#~ "pep:`343`。" +#~ "一個可以控制 :keyword:`with` 陳述式中所見環境的物件,而它是透過定" +#~ "義 :meth:`~object.__enter__` 和 :meth:`~object.__exit__` method 來控制的。" +#~ "請參閱 :pep:`343`。" #~ msgid "" #~ "A variable which can have different values depending on its context. This " diff --git a/howto/free-threading-python.po b/howto/free-threading-python.po index fe26e49d23..2d43d4ae62 100644 --- a/howto/free-threading-python.po +++ b/howto/free-threading-python.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-04 00:13+0000\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -82,7 +82,7 @@ msgstr "" #: ../../howto/free-threading-python.rst:45 msgid "" "To check if the current interpreter supports free-threading, :option:`python " -"-VV <-V>` and :attr:`sys.version` contain \"experimental free-threading " +"-VV <-V>` and :data:`sys.version` contain \"experimental free-threading " "build\". The new :func:`sys._is_gil_enabled` function can be used to check " "whether the GIL is actually disabled in the running process." msgstr "" diff --git a/howto/mro.po b/howto/mro.po index 4b1860b886..1f107b45fd 100644 --- a/howto/mro.po +++ b/howto/mro.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-01-22 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -615,7 +615,7 @@ msgstr "" msgid "" "We see that class G inherits from F and E, with F *before* E: therefore we " "would expect the attribute *G.remember2buy* to be inherited by *F." -"rembermer2buy* and not by *E.remember2buy*: nevertheless Python 2.2 gives" +"remember2buy* and not by *E.remember2buy*: nevertheless Python 2.2 gives" msgstr "" #: ../../howto/mro.rst:407 diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index d668319414..5008415a77 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-12 00:13+0000\n" +"POT-Creation-Date: 2025-01-10 00:14+0000\n" "PO-Revision-Date: 2022-02-20 12:36+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -95,8 +94,8 @@ msgid "" "If there is no running event loop set, the function will return the result " "of the ``get_event_loop_policy().get_event_loop()`` call." msgstr "" -"如果沒有設定正在運行的事件迴圈,該函式將回傳 ``get_event_loop_policy()." -"get_event_loop()`` 呼叫的結果。" +"如果沒有設定正在運行的事件迴圈,該函式將回傳 " +"``get_event_loop_policy().get_event_loop()`` 呼叫的結果。" #: ../../library/asyncio-eventloop.rst:53 msgid "" @@ -105,8 +104,8 @@ msgid "" "is preferred to :func:`get_event_loop` in coroutines and callbacks." msgstr "" "由於此函式具有相當複雜的行為(尤其是在使用自訂事件迴圈策略時),在協程和回呼" -"函式中,建議使用 :func:`get_running_loop` 函式,而不是 :func:" -"`get_event_loop`。" +"函式中,建議使用 :func:`get_running_loop` 函式,而不" +"是 :func:`get_event_loop`。" #: ../../library/asyncio-eventloop.rst:58 msgid "" @@ -139,9 +138,9 @@ msgid "" "and :func:`new_event_loop` functions can be altered by :ref:`setting a " "custom event loop policy <asyncio-policies>`." msgstr "" -"請注意 :func:`get_event_loop`、:func:`set_event_loop` 和 :func:" -"`new_event_loop` 函式的行為可以透過\\ :ref:`設定自訂事件迴圈策略 <asyncio-" -"policies>`\\ 進行調整。" +"請注意 :func:`get_event_loop`、:func:`set_event_loop` " +"和 :func:`new_event_loop` 函式的行為可以透過\\ :ref:`設定自訂事件迴圈策略 " +"<asyncio-policies>`\\ 進行調整。" #: ../../library/asyncio-eventloop.rst:80 msgid "Contents" @@ -160,29 +159,29 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:86 msgid "" -"The `Callback Handles`_ section documents the :class:`Handle` and :class:" -"`TimerHandle` instances which are returned from scheduling methods such as :" -"meth:`loop.call_soon` and :meth:`loop.call_later`;" +"The `Callback Handles`_ section documents the :class:`Handle` " +"and :class:`TimerHandle` instances which are returned from scheduling " +"methods such as :meth:`loop.call_soon` and :meth:`loop.call_later`;" msgstr "" -"`回呼處理 <Callback Handles_>`_\\ 章節記錄了從排程方法(如 :meth:`loop." -"call_soon` 和 :meth:`loop.call_later`)回傳的 :class:`Handle` 和 :class:" -"`TimerHandle` 實例;" +"`回呼處理 <Callback Handles_>`_\\ 章節記錄了從排程方法" +"(如 :meth:`loop.call_soon` 和 :meth:`loop.call_later`)回傳" +"的 :class:`Handle` 和 :class:`TimerHandle` 實例;" #: ../../library/asyncio-eventloop.rst:90 msgid "" "The `Server Objects`_ section documents types returned from event loop " "methods like :meth:`loop.create_server`;" msgstr "" -"`Server 物件 <Server Objects_>`_\\ 章節記錄了從事件迴圈方法(如 :meth:`loop." -"create_server`)回傳的資料型別;" +"`Server 物件 <Server Objects_>`_\\ 章節記錄了從事件迴圈方法" +"(如 :meth:`loop.create_server`)回傳的資料型別;" #: ../../library/asyncio-eventloop.rst:93 msgid "" -"The `Event Loop Implementations`_ section documents the :class:" -"`SelectorEventLoop` and :class:`ProactorEventLoop` classes;" +"The `Event Loop Implementations`_ section documents " +"the :class:`SelectorEventLoop` and :class:`ProactorEventLoop` classes;" msgstr "" -"`事件迴圈實作 <Event Loop Implementations_>`_\\ 章節記錄了 :class:" -"`SelectorEventLoop` 和 :class:`ProactorEventLoop` 類別;" +"`事件迴圈實作 <Event Loop Implementations_>`_\\ 章節記錄" +"了 :class:`SelectorEventLoop` 和 :class:`ProactorEventLoop` 類別;" #: ../../library/asyncio-eventloop.rst:96 msgid "" @@ -210,8 +209,8 @@ msgid "" "If the argument is a :ref:`coroutine object <coroutine>` it is implicitly " "scheduled to run as a :class:`asyncio.Task`." msgstr "" -"如果引數是\\ :ref:`協程物件 <coroutine>`,則它將被隱式排程為 :class:`asyncio." -"Task` 運行。" +"如果引數是\\ :ref:`協程物件 <coroutine>`,則它將被隱式排程" +"為 :class:`asyncio.Task` 運行。" #: ../../library/asyncio-eventloop.rst:123 msgid "Return the Future's result or raise its exception." @@ -296,8 +295,8 @@ msgid "" msgstr "請注意,使用 :func:`asyncio.run` 時不需要呼叫此函式。" #: ../../library/asyncio-eventloop.rst:176 -#: ../../library/asyncio-eventloop.rst:1269 -#: ../../library/asyncio-eventloop.rst:1712 +#: ../../library/asyncio-eventloop.rst:1278 +#: ../../library/asyncio-eventloop.rst:1721 msgid "Example::" msgstr "範例: ::" @@ -319,12 +318,13 @@ msgstr "" msgid "" "Schedule the closure of the default executor and wait for it to join all of " "the threads in the :class:`~concurrent.futures.ThreadPoolExecutor`. Once " -"this method has been called, using the default executor with :meth:`loop." -"run_in_executor` will raise a :exc:`RuntimeError`." +"this method has been called, using the default executor " +"with :meth:`loop.run_in_executor` will raise a :exc:`RuntimeError`." msgstr "" -"排程預設執行器的關閉,並等待它加入 :class:`~concurrent.futures." -"ThreadPoolExecutor` 中的所有執行緒。一旦呼叫了此方法,使用預設執行器與 :meth:" -"`loop.run_in_executor` 將引發 :exc:`RuntimeError`。" +"排程預設執行器的關閉,並等待它加" +"入 :class:`~concurrent.futures.ThreadPoolExecutor` 中的所有執行緒。一旦呼叫了" +"此方法,使用預設執行器與 :meth:`loop.run_in_executor` 將引" +"發 :exc:`RuntimeError`。" #: ../../library/asyncio-eventloop.rst:194 msgid "" @@ -381,12 +381,13 @@ msgstr "回呼函式按照其註冊的順序呼叫。每個回呼函式將被呼 #: ../../library/asyncio-eventloop.rst:227 msgid "" -"The optional keyword-only *context* argument specifies a custom :class:" -"`contextvars.Context` for the *callback* to run in. Callbacks use the " -"current context when no *context* is provided." +"The optional keyword-only *context* argument specifies a " +"custom :class:`contextvars.Context` for the *callback* to run in. Callbacks " +"use the current context when no *context* is provided." msgstr "" -"選用的僅限關鍵字引數 *context* 指定了要給 *callback* 執行的自定義 :class:" -"`contextvars.Context`。當未提供 *context* 時,回呼函式使用當前情境。" +"選用的僅限關鍵字引數 *context* 指定了要給 *callback* 執行的自定" +"義 :class:`contextvars.Context`。當未提供 *context* 時,回呼函式使用當前情" +"境。" #: ../../library/asyncio-eventloop.rst:231 msgid "Unlike :meth:`call_soon_threadsafe`, this method is not thread-safe." @@ -403,27 +404,34 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:239 msgid "" +"This function is safe to be called from a reentrant context or signal " +"handler, however, it is not safe or fruitful to use the returned handle in " +"such contexts." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:242 +msgid "" "Raises :exc:`RuntimeError` if called on a loop that's been closed. This can " "happen on a secondary thread when the main application is shutting down." msgstr "" "如果在已關閉的迴圈上呼叫,則引發 :exc:`RuntimeError`。在主應用程式關閉時,這" "可能發生在次要執行緒上。" -#: ../../library/asyncio-eventloop.rst:243 +#: ../../library/asyncio-eventloop.rst:246 msgid "" "See the :ref:`concurrency and multithreading <asyncio-multithreading>` " "section of the documentation." msgstr "請參閱文件的\\ :ref:`並行和多執行緒 <asyncio-multithreading>`\\ 部分。" -#: ../../library/asyncio-eventloop.rst:246 -#: ../../library/asyncio-eventloop.rst:296 -#: ../../library/asyncio-eventloop.rst:316 +#: ../../library/asyncio-eventloop.rst:249 +#: ../../library/asyncio-eventloop.rst:299 +#: ../../library/asyncio-eventloop.rst:319 msgid "" "The *context* keyword-only parameter was added. See :pep:`567` for more " "details." msgstr "新增了 *context* 僅限關鍵字參數。詳細資訊請參閱 :pep:`567`。" -#: ../../library/asyncio-eventloop.rst:254 +#: ../../library/asyncio-eventloop.rst:257 msgid "" "Most :mod:`asyncio` scheduling functions don't allow passing keyword " "arguments. To do that, use :func:`functools.partial`::" @@ -431,14 +439,17 @@ msgstr "" "大多數 :mod:`asyncio` 排程函式不允許傳遞關鍵字引數。要傳遞關鍵字引數,請使" "用 :func:`functools.partial`: ::" -#: ../../library/asyncio-eventloop.rst:257 +#: ../../library/asyncio-eventloop.rst:260 msgid "" "# will schedule \"print(\"Hello\", flush=True)\"\n" "loop.call_soon(\n" " functools.partial(print, \"Hello\", flush=True))" msgstr "" +"# 將會排程 \"print(\"Hello\", flush=True)\"\n" +"loop.call_soon(\n" +" functools.partial(print, \"Hello\", flush=True))" -#: ../../library/asyncio-eventloop.rst:261 +#: ../../library/asyncio-eventloop.rst:264 msgid "" "Using partial objects is usually more convenient than using lambdas, as " "asyncio can render partial objects better in debug and error messages." @@ -446,11 +457,11 @@ msgstr "" "通常使用 partial 物件比使用 lambda 更方便,因為 asyncio 可以在除錯和錯誤訊息" "中更好地呈現 partial 物件。" -#: ../../library/asyncio-eventloop.rst:269 +#: ../../library/asyncio-eventloop.rst:272 msgid "Scheduling delayed callbacks" msgstr "排程延遲的回呼函式" -#: ../../library/asyncio-eventloop.rst:271 +#: ../../library/asyncio-eventloop.rst:274 msgid "" "Event loop provides mechanisms to schedule callback functions to be called " "at some point in the future. Event loop uses monotonic clocks to track time." @@ -458,20 +469,20 @@ msgstr "" "事件迴圈提供為回呼函式排程在將來某個時間點才呼叫的機制。事件迴圈使用了單調時" "鐘來追蹤時間。" -#: ../../library/asyncio-eventloop.rst:278 +#: ../../library/asyncio-eventloop.rst:281 msgid "" "Schedule *callback* to be called after the given *delay* number of seconds " "(can be either an int or a float)." msgstr "排程 *callback* 在給定的 *delay* 秒數後呼叫(可以是整數或浮點數)。" -#: ../../library/asyncio-eventloop.rst:281 -#: ../../library/asyncio-eventloop.rst:313 +#: ../../library/asyncio-eventloop.rst:284 +#: ../../library/asyncio-eventloop.rst:316 msgid "" "An instance of :class:`asyncio.TimerHandle` is returned which can be used to " "cancel the callback." msgstr "回傳 :class:`asyncio.TimerHandle` 的實例,可用於取消回呼函式。" -#: ../../library/asyncio-eventloop.rst:284 +#: ../../library/asyncio-eventloop.rst:287 msgid "" "*callback* will be called exactly once. If two callbacks are scheduled for " "exactly the same time, the order in which they are called is undefined." @@ -479,25 +490,26 @@ msgstr "" "*callback* 將只被呼叫恰好一次。如果有兩個回呼函式被排程在完全相同的時間,則其" "呼叫順序是不定的。" -#: ../../library/asyncio-eventloop.rst:288 +#: ../../library/asyncio-eventloop.rst:291 msgid "" "The optional positional *args* will be passed to the callback when it is " -"called. If you want the callback to be called with keyword arguments use :" -"func:`functools.partial`." +"called. If you want the callback to be called with keyword arguments " +"use :func:`functools.partial`." msgstr "" "可選的位置引數 *args* 將在呼叫回呼函式時傳遞。如果要使用關鍵字引數呼叫回呼函" "數,請使用 :func:`functools.partial`。" -#: ../../library/asyncio-eventloop.rst:292 +#: ../../library/asyncio-eventloop.rst:295 msgid "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *callback* to run in. The current " -"context is used when no *context* is provided." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *callback* to run in. The " +"current context is used when no *context* is provided." msgstr "" -"可選的僅限關鍵字 *context* 引數允許為 *callback* 指定自定義的 :class:" -"`contextvars.Context` 以提供運行。當未提供 *context* 時,將使用當前情境。" +"可選的僅限關鍵字 *context* 引數允許為 *callback* 指定自定義" +"的 :class:`contextvars.Context` 以提供運行。當未提供 *context* 時,將使用當前" +"情境。" -#: ../../library/asyncio-eventloop.rst:300 +#: ../../library/asyncio-eventloop.rst:303 msgid "" "In Python 3.7 and earlier with the default event loop implementation, the " "*delay* could not exceed one day. This has been fixed in Python 3.8." @@ -505,19 +517,19 @@ msgstr "" "在 Python 3.7 及更早版本中,使用預設事件迴圈實作時,*delay* 不能超過一天。這" "在 Python 3.8 中已經修復。" -#: ../../library/asyncio-eventloop.rst:307 +#: ../../library/asyncio-eventloop.rst:310 msgid "" "Schedule *callback* to be called at the given absolute timestamp *when* (an " "int or a float), using the same time reference as :meth:`loop.time`." msgstr "" -"排程 *callback* 在給定的絕對時間戳 *when* (整數或浮點數)處呼叫,使用與 :" -"meth:`loop.time` 相同的時間參照。" +"排程 *callback* 在給定的絕對時間戳 *when* (整數或浮點數)處呼叫,使用" +"與 :meth:`loop.time` 相同的時間參照。" -#: ../../library/asyncio-eventloop.rst:311 +#: ../../library/asyncio-eventloop.rst:314 msgid "This method's behavior is the same as :meth:`call_later`." msgstr "此方法的行為與 :meth:`call_later` 相同。" -#: ../../library/asyncio-eventloop.rst:320 +#: ../../library/asyncio-eventloop.rst:323 msgid "" "In Python 3.7 and earlier with the default event loop implementation, the " "difference between *when* and the current time could not exceed one day. " @@ -526,13 +538,13 @@ msgstr "" "在 Python 3.7 及更早版本中,使用預設事件迴圈實作時,*when* 和當前時間之間的差" "值不能超過一天。這在 Python 3.8 中已經修復。" -#: ../../library/asyncio-eventloop.rst:327 +#: ../../library/asyncio-eventloop.rst:330 msgid "" "Return the current time, as a :class:`float` value, according to the event " "loop's internal monotonic clock." msgstr "根據事件迴圈的內部單調時鐘,回傳當前時間,以 :class:`float` 值表示。" -#: ../../library/asyncio-eventloop.rst:331 +#: ../../library/asyncio-eventloop.rst:334 msgid "" "In Python 3.7 and earlier timeouts (relative *delay* or absolute *when*) " "should not exceed one day. This has been fixed in Python 3.8." @@ -540,19 +552,19 @@ msgstr "" "在 Python 3.7 及更早版本中,超時(相對 *delay* 或絕對 *when*)不應超過一天。" "這在 Python 3.8 中已經修復。" -#: ../../library/asyncio-eventloop.rst:337 +#: ../../library/asyncio-eventloop.rst:340 msgid "The :func:`asyncio.sleep` function." msgstr "函式 :func:`asyncio.sleep`。" -#: ../../library/asyncio-eventloop.rst:341 +#: ../../library/asyncio-eventloop.rst:344 msgid "Creating Futures and Tasks" msgstr "建立 Futures 和 Tasks" -#: ../../library/asyncio-eventloop.rst:345 +#: ../../library/asyncio-eventloop.rst:348 msgid "Create an :class:`asyncio.Future` object attached to the event loop." msgstr "建立附加到事件迴圈的 :class:`asyncio.Future` 物件。" -#: ../../library/asyncio-eventloop.rst:347 +#: ../../library/asyncio-eventloop.rst:350 msgid "" "This is the preferred way to create Futures in asyncio. This lets third-" "party event loops provide alternative implementations of the Future object " @@ -561,94 +573,94 @@ msgstr "" "這是在 asyncio 中建立 Futures 的首選方式。這允許第三方事件迴圈提供 Future 物" "件的替代實作(具有更好的性能或儀器計測表現)。" -#: ../../library/asyncio-eventloop.rst:355 +#: ../../library/asyncio-eventloop.rst:358 msgid "" -"Schedule the execution of :ref:`coroutine <coroutine>` *coro*. Return a :" -"class:`Task` object." +"Schedule the execution of :ref:`coroutine <coroutine>` *coro*. Return " +"a :class:`Task` object." msgstr "排程執行\\ :ref:`協程 <coroutine>` *coro*。回傳 :class:`Task` 物件。" -#: ../../library/asyncio-eventloop.rst:358 +#: ../../library/asyncio-eventloop.rst:361 msgid "" "Third-party event loops can use their own subclass of :class:`Task` for " -"interoperability. In this case, the result type is a subclass of :class:" -"`Task`." +"interoperability. In this case, the result type is a subclass " +"of :class:`Task`." msgstr "" "第三方事件迴圈可以使用其自己的 :class:`Task` 子類別以實現互操作性" "(interoperability)。在這種情況下,結果類型是 :class:`Task` 的子類別。" -#: ../../library/asyncio-eventloop.rst:362 +#: ../../library/asyncio-eventloop.rst:365 msgid "" "If the *name* argument is provided and not ``None``, it is set as the name " "of the task using :meth:`Task.set_name`." msgstr "" -"如果提供了 *name* 引數且不為 ``None``,則將其設置為任務的名稱,使用 :meth:" -"`Task.set_name`。" +"如果提供了 *name* 引數且不為 ``None``,則將其設置為任務的名稱,使" +"用 :meth:`Task.set_name`。" -#: ../../library/asyncio-eventloop.rst:365 +#: ../../library/asyncio-eventloop.rst:368 msgid "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *coro* to run in. The current context " -"copy is created when no *context* is provided." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *coro* to run in. The current " +"context copy is created when no *context* is provided." msgstr "" -"可選的僅限關鍵字 *context* 引數允許為 *coro* 指定自定義的 :class:" -"`contextvars.Context` 以提供運行。當未提供 *context* 時,將建立當前情境的副" -"本。" +"可選的僅限關鍵字 *context* 引數允許為 *coro* 指定自定義" +"的 :class:`contextvars.Context` 以提供運行。當未提供 *context* 時,將建立當前" +"情境的副本。" -#: ../../library/asyncio-eventloop.rst:369 +#: ../../library/asyncio-eventloop.rst:372 msgid "Added the *name* parameter." msgstr "加入 *name* 參數。" -#: ../../library/asyncio-eventloop.rst:372 +#: ../../library/asyncio-eventloop.rst:375 msgid "Added the *context* parameter." msgstr "加入 *context* 參數。" -#: ../../library/asyncio-eventloop.rst:377 +#: ../../library/asyncio-eventloop.rst:380 msgid "Set a task factory that will be used by :meth:`loop.create_task`." msgstr "設置將由 :meth:`loop.create_task` 使用的任務工廠。" -#: ../../library/asyncio-eventloop.rst:380 +#: ../../library/asyncio-eventloop.rst:383 msgid "" "If *factory* is ``None`` the default task factory will be set. Otherwise, " "*factory* must be a *callable* with the signature matching ``(loop, coro, " "context=None)``, where *loop* is a reference to the active event loop, and " -"*coro* is a coroutine object. The callable must return a :class:`asyncio." -"Future`-compatible object." +"*coro* is a coroutine object. The callable must return " +"a :class:`asyncio.Future`-compatible object." msgstr "" "如果 *factory* 為 ``None``,將設置預設的任務工廠。否則,*factory* 必須是一個" "具有匹配簽名 ``(loop, coro, context=None)`` 的 *callable*,其中 *loop* 是有效" -"事件迴圈的參照,*coro* 是一個協程物件。該可呼叫物件必須回傳一個與 :class:" -"`asyncio.Future` 相容的物件。" +"事件迴圈的參照,*coro* 是一個協程物件。該可呼叫物件必須回傳一個" +"與 :class:`asyncio.Future` 相容的物件。" -#: ../../library/asyncio-eventloop.rst:388 +#: ../../library/asyncio-eventloop.rst:391 msgid "Return a task factory or ``None`` if the default one is in use." msgstr "回傳任務工廠,如果使用預設任務工廠則回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:392 +#: ../../library/asyncio-eventloop.rst:395 msgid "Opening network connections" msgstr "打開網路連線" -#: ../../library/asyncio-eventloop.rst:403 +#: ../../library/asyncio-eventloop.rst:406 msgid "" "Open a streaming transport connection to a given address specified by *host* " "and *port*." msgstr "打開以 *host* 和 *port* 指定之給定地址的串流傳輸連線。" -#: ../../library/asyncio-eventloop.rst:406 +#: ../../library/asyncio-eventloop.rst:409 msgid "" -"The socket family can be either :py:const:`~socket.AF_INET` or :py:const:" -"`~socket.AF_INET6` depending on *host* (or the *family* argument, if " -"provided)." +"The socket family can be either :py:const:`~socket.AF_INET` " +"or :py:const:`~socket.AF_INET6` depending on *host* (or the *family* " +"argument, if provided)." msgstr "" -"根據 *host*(或提供的 *family* 引數)的情況,socket 家族可以是 :py:const:" -"`~socket.AF_INET` 或 :py:const:`~socket.AF_INET6`。" +"根據 *host*(或提供的 *family* 引數)的情況,socket 家族可以" +"是 :py:const:`~socket.AF_INET` 或 :py:const:`~socket.AF_INET6`。" -#: ../../library/asyncio-eventloop.rst:410 +#: ../../library/asyncio-eventloop.rst:413 msgid "The socket type will be :py:const:`~socket.SOCK_STREAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_STREAM`。" -#: ../../library/asyncio-eventloop.rst:412 -#: ../../library/asyncio-eventloop.rst:1180 -#: ../../library/asyncio-eventloop.rst:1196 +#: ../../library/asyncio-eventloop.rst:415 +#: ../../library/asyncio-eventloop.rst:1189 +#: ../../library/asyncio-eventloop.rst:1205 msgid "" "*protocol_factory* must be a callable returning an :ref:`asyncio protocol " "<asyncio-protocol>` implementation." @@ -656,70 +668,70 @@ msgstr "" "*protocol_factory* 必須是一個回傳 :ref:`asyncio protocol <asyncio-protocol>` " "實作的可呼叫函式。" -#: ../../library/asyncio-eventloop.rst:415 +#: ../../library/asyncio-eventloop.rst:418 msgid "" "This method will try to establish the connection in the background. When " "successful, it returns a ``(transport, protocol)`` pair." msgstr "" "此方法將嘗試在背景建立連線。成功時,它將回傳一對 ``(transport, protocol)``。" -#: ../../library/asyncio-eventloop.rst:418 +#: ../../library/asyncio-eventloop.rst:421 msgid "The chronological synopsis of the underlying operation is as follows:" msgstr "底層操作的時間軸簡介如下:" -#: ../../library/asyncio-eventloop.rst:420 +#: ../../library/asyncio-eventloop.rst:423 msgid "" "The connection is established and a :ref:`transport <asyncio-transport>` is " "created for it." msgstr "建立連線並為其建立\\ :ref:`傳輸 <asyncio-transport>`。" -#: ../../library/asyncio-eventloop.rst:423 +#: ../../library/asyncio-eventloop.rst:426 msgid "" -"*protocol_factory* is called without arguments and is expected to return a :" -"ref:`protocol <asyncio-protocol>` instance." +"*protocol_factory* is called without arguments and is expected to return " +"a :ref:`protocol <asyncio-protocol>` instance." msgstr "" "*protocol_factory* 在無引數的情況下被呼叫,並且預計回傳一個 :ref:`協定 " "<asyncio-protocol>` 實例。" -#: ../../library/asyncio-eventloop.rst:426 +#: ../../library/asyncio-eventloop.rst:429 msgid "" -"The protocol instance is coupled with the transport by calling its :meth:" -"`~BaseProtocol.connection_made` method." +"The protocol instance is coupled with the transport by calling " +"its :meth:`~BaseProtocol.connection_made` method." msgstr "" "通過呼叫其 :meth:`~BaseProtocol.connection_made` 方法,將協議實例與傳輸連線在" "一起。" -#: ../../library/asyncio-eventloop.rst:429 +#: ../../library/asyncio-eventloop.rst:432 msgid "A ``(transport, protocol)`` tuple is returned on success." msgstr "成功時回傳一個 ``(transport, protocol)`` 元組。" -#: ../../library/asyncio-eventloop.rst:431 +#: ../../library/asyncio-eventloop.rst:434 msgid "" "The created transport is an implementation-dependent bidirectional stream." msgstr "建立的傳輸是一個依賴實作的雙向串流。" -#: ../../library/asyncio-eventloop.rst:434 -#: ../../library/asyncio-eventloop.rst:566 +#: ../../library/asyncio-eventloop.rst:437 +#: ../../library/asyncio-eventloop.rst:569 msgid "Other arguments:" msgstr "其他引數:" -#: ../../library/asyncio-eventloop.rst:436 +#: ../../library/asyncio-eventloop.rst:439 msgid "" "*ssl*: if given and not false, a SSL/TLS transport is created (by default a " "plain TCP transport is created). If *ssl* is a :class:`ssl.SSLContext` " -"object, this context is used to create the transport; if *ssl* is :const:" -"`True`, a default context returned from :func:`ssl.create_default_context` " -"is used." +"object, this context is used to create the transport; if *ssl* " +"is :const:`True`, a default context returned " +"from :func:`ssl.create_default_context` is used." msgstr "" "若有給定 *ssl* 且非 false,將建立 SSL/TLS 傳輸(預設建立普通 TCP 傳輸)。如" "果 *ssl* 為 :class:`ssl.SSLContext` 物件,則使用該情境來建立傳輸;如果 *ssl* " "為 :const:`True`,則使用 :func:`ssl.create_default_context` 回傳的預設情境。" -#: ../../library/asyncio-eventloop.rst:442 +#: ../../library/asyncio-eventloop.rst:445 msgid ":ref:`SSL/TLS security considerations <ssl-security>`" msgstr ":ref:`SSL/TLS 安全考量 <ssl-security>`" -#: ../../library/asyncio-eventloop.rst:444 +#: ../../library/asyncio-eventloop.rst:447 msgid "" "*server_hostname* sets or overrides the hostname that the target server's " "certificate will be matched against. Should only be passed if *ssl* is not " @@ -734,7 +746,7 @@ msgstr "" "預設值,必須傳遞 *server_hostname* 的值。若 *server_hostname* 為空字串,將停" "用主機名稱匹配(這是一個嚴重的安全風險,可能導致中間人攻擊)。" -#: ../../library/asyncio-eventloop.rst:452 +#: ../../library/asyncio-eventloop.rst:455 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to getaddrinfo() for *host* resolution. If given, " @@ -745,7 +757,7 @@ msgstr "" "getaddrinfo() 進行 *host* 解析。若有給定這些應該都是相應 :mod:`socket` 模組常" "數的整數。" -#: ../../library/asyncio-eventloop.rst:457 +#: ../../library/asyncio-eventloop.rst:460 msgid "" "*happy_eyeballs_delay*, if given, enables Happy Eyeballs for this " "connection. It should be a floating-point number representing the amount of " @@ -755,11 +767,11 @@ msgid "" "the RFC is ``0.25`` (250 milliseconds)." msgstr "" "若有給定,*happy_eyeballs_delay* 會啟用此連線的 Happy Eyeballs。它應該是一個" -"浮點數,表示等待連線嘗試完成的秒數,然後在並行啟動下一次嘗試。這是 :rfc:" -"`8305` 中定義的「連線嘗試延遲」。RFC 建議的合理預設值為 ``0.25`` 秒(250 毫" -"秒)。" +"浮點數,表示等待連線嘗試完成的秒數,然後在並行啟動下一次嘗試。這" +"是 :rfc:`8305` 中定義的「連線嘗試延遲」。RFC 建議的合理預設值為 ``0.25`` 秒" +"(250 毫秒)。" -#: ../../library/asyncio-eventloop.rst:465 +#: ../../library/asyncio-eventloop.rst:468 msgid "" "*interleave* controls address reordering when a host name resolves to " "multiple IP addresses. If ``0`` or unspecified, no reordering is done, and " @@ -775,29 +787,29 @@ msgstr "" "族計數」。如果未指定 *happy_eyeballs_delay*,則預設值為 ``0``,如果指定則為 " "``1``。" -#: ../../library/asyncio-eventloop.rst:474 +#: ../../library/asyncio-eventloop.rst:477 msgid "" -"*sock*, if given, should be an existing, already connected :class:`socket." -"socket` object to be used by the transport. If *sock* is given, none of " -"*host*, *port*, *family*, *proto*, *flags*, *happy_eyeballs_delay*, " -"*interleave* and *local_addr* should be specified." +"*sock*, if given, should be an existing, already " +"connected :class:`socket.socket` object to be used by the transport. If " +"*sock* is given, none of *host*, *port*, *family*, *proto*, *flags*, " +"*happy_eyeballs_delay*, *interleave* and *local_addr* should be specified." msgstr "" "若有給定 *sock* 則其應為已存在且已連線的 :class:`socket.socket` 物件,可供傳" "輸使用。如果提供了 *sock*,則不應指定 *host*、*port*、*family*、*proto*、" "*flags*、*happy_eyeballs_delay*、*interleave* 和 *local_addr* 中的任何一項。" -#: ../../library/asyncio-eventloop.rst:482 -#: ../../library/asyncio-eventloop.rst:597 -#: ../../library/asyncio-eventloop.rst:841 +#: ../../library/asyncio-eventloop.rst:485 +#: ../../library/asyncio-eventloop.rst:600 +#: ../../library/asyncio-eventloop.rst:844 msgid "" "The *sock* argument transfers ownership of the socket to the transport " -"created. To close the socket, call the transport's :meth:`~asyncio." -"BaseTransport.close` method." +"created. To close the socket, call the " +"transport's :meth:`~asyncio.BaseTransport.close` method." msgstr "" -"引數 *sock* 將 socket 所有權轉移給所建立的傳輸 socket,請呼叫傳輸的 :meth:" -"`~asyncio.BaseTransport.close` 方法。" +"引數 *sock* 將 socket 所有權轉移給所建立的傳輸 socket,請呼叫傳輸" +"的 :meth:`~asyncio.BaseTransport.close` 方法。" -#: ../../library/asyncio-eventloop.rst:486 +#: ../../library/asyncio-eventloop.rst:489 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " "the socket locally. The *local_host* and *local_port* are looked up using " @@ -807,8 +819,8 @@ msgstr "" "地綁定 socket。將使用 ``getaddrinfo()`` 查找 *local_host* 和 *local_port*,方" "式類似於 *host* 和 *port*。" -#: ../../library/asyncio-eventloop.rst:490 -#: ../../library/asyncio-eventloop.rst:935 +#: ../../library/asyncio-eventloop.rst:493 +#: ../../library/asyncio-eventloop.rst:938 msgid "" "*ssl_handshake_timeout* is (for a TLS connection) the time in seconds to " "wait for the TLS handshake to complete before aborting the connection. " @@ -818,10 +830,10 @@ msgstr "" "在那之前若未完成則會中斷連線。如果為 ``None`` (預設值),則會等待 ``60.0`` " "秒。" -#: ../../library/asyncio-eventloop.rst:494 -#: ../../library/asyncio-eventloop.rst:750 -#: ../../library/asyncio-eventloop.rst:852 -#: ../../library/asyncio-eventloop.rst:939 +#: ../../library/asyncio-eventloop.rst:497 +#: ../../library/asyncio-eventloop.rst:753 +#: ../../library/asyncio-eventloop.rst:855 +#: ../../library/asyncio-eventloop.rst:942 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " @@ -830,7 +842,7 @@ msgstr "" "*ssl_shutdown_timeout* 是等待 SSL 關閉完成以前中斷連線的時間,以秒為單位。如" "果為 ``None`` (預設值),則會等待 ``30.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:498 +#: ../../library/asyncio-eventloop.rst:501 msgid "" "*all_errors* determines what exceptions are raised when a connection cannot " "be created. By default, only a single ``Exception`` is raised: the first " @@ -844,12 +856,12 @@ msgstr "" "包含所有錯誤訊息的單一 ``OSError``。當 ``all_errors`` 為 ``True`` 時,將引發" "包含所有例外的 ``ExceptionGroup`` (即使只有一個例外)。" -#: ../../library/asyncio-eventloop.rst:508 -#: ../../library/asyncio-eventloop.rst:762 +#: ../../library/asyncio-eventloop.rst:511 +#: ../../library/asyncio-eventloop.rst:765 msgid "Added support for SSL/TLS in :class:`ProactorEventLoop`." msgstr "新增 :class:`ProactorEventLoop` 中的 SSL/TLS 支援。" -#: ../../library/asyncio-eventloop.rst:512 +#: ../../library/asyncio-eventloop.rst:515 msgid "" "The socket option :ref:`socket.TCP_NODELAY <socket-unix-constants>` is set " "by default for all TCP connections." @@ -857,16 +869,16 @@ msgstr "" "所有 TCP 連線都預設有 :ref:`socket.TCP_NODELAY <socket-unix-constants>` " "socket 選項。" -#: ../../library/asyncio-eventloop.rst:517 -#: ../../library/asyncio-eventloop.rst:862 +#: ../../library/asyncio-eventloop.rst:520 +#: ../../library/asyncio-eventloop.rst:865 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "增加 *ssl_handshake_timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:521 +#: ../../library/asyncio-eventloop.rst:524 msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." msgstr "加入 *happy_eyeballs_delay* 和 *interleave* 參數。" -#: ../../library/asyncio-eventloop.rst:523 +#: ../../library/asyncio-eventloop.rst:526 msgid "" "Happy Eyeballs Algorithm: Success with Dual-Stack Hosts. When a server's " "IPv4 path and protocol are working, but the server's IPv6 path and protocol " @@ -882,53 +894,55 @@ msgstr "" "用戶端的使用者體驗變差。本文件具體說明了減少此用戶可見延遲的演算法要求並提供" "了一種演算法。" -#: ../../library/asyncio-eventloop.rst:532 +#: ../../library/asyncio-eventloop.rst:535 msgid "For more information: https://datatracker.ietf.org/doc/html/rfc6555" msgstr "更多資訊請見: https://datatracker.ietf.org/doc/html/rfc6555" -#: ../../library/asyncio-eventloop.rst:536 -#: ../../library/asyncio-eventloop.rst:660 -#: ../../library/asyncio-eventloop.rst:776 -#: ../../library/asyncio-eventloop.rst:815 -#: ../../library/asyncio-eventloop.rst:866 -#: ../../library/asyncio-eventloop.rst:947 +#: ../../library/asyncio-eventloop.rst:539 +#: ../../library/asyncio-eventloop.rst:663 +#: ../../library/asyncio-eventloop.rst:779 +#: ../../library/asyncio-eventloop.rst:818 +#: ../../library/asyncio-eventloop.rst:869 +#: ../../library/asyncio-eventloop.rst:950 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "增加 *ssl_shutdown_timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:538 +#: ../../library/asyncio-eventloop.rst:541 msgid "*all_errors* was added." msgstr "已新增 *all_errors*。" -#: ../../library/asyncio-eventloop.rst:543 +#: ../../library/asyncio-eventloop.rst:546 msgid "" "The :func:`open_connection` function is a high-level alternative API. It " "returns a pair of (:class:`StreamReader`, :class:`StreamWriter`) that can be " "used directly in async/await code." msgstr "" -"函式 :func:`open_connection` 是高階的替代 API。它回傳一對 (:class:" -"`StreamReader`, :class:`StreamWriter`) 可直接在 async/await 程式碼中使用。" +"函式 :func:`open_connection` 是高階的替代 API。它回傳一對 " +"(:class:`StreamReader`, :class:`StreamWriter`) 可直接在 async/await 程式碼中" +"使用。" -#: ../../library/asyncio-eventloop.rst:553 +#: ../../library/asyncio-eventloop.rst:556 msgid "Create a datagram connection." msgstr "建立一個資料報連線。" -#: ../../library/asyncio-eventloop.rst:555 +#: ../../library/asyncio-eventloop.rst:558 msgid "" -"The socket family can be either :py:const:`~socket.AF_INET`, :py:const:" -"`~socket.AF_INET6`, or :py:const:`~socket.AF_UNIX`, depending on *host* (or " -"the *family* argument, if provided)." +"The socket family can be " +"either :py:const:`~socket.AF_INET`, :py:const:`~socket.AF_INET6`, " +"or :py:const:`~socket.AF_UNIX`, depending on *host* (or the *family* " +"argument, if provided)." msgstr "" "Socket 家族可以是 :py:const:`~socket.AF_INET`、:py:const:`~socket.AF_INET6` " "或 :py:const:`~socket.AF_UNIX`,視乎 *host*\\ (或提供的 *family* 引數)而" "定。" -#: ../../library/asyncio-eventloop.rst:559 +#: ../../library/asyncio-eventloop.rst:562 msgid "The socket type will be :py:const:`~socket.SOCK_DGRAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_DGRAM`。" -#: ../../library/asyncio-eventloop.rst:561 -#: ../../library/asyncio-eventloop.rst:686 -#: ../../library/asyncio-eventloop.rst:833 +#: ../../library/asyncio-eventloop.rst:564 +#: ../../library/asyncio-eventloop.rst:689 +#: ../../library/asyncio-eventloop.rst:836 msgid "" "*protocol_factory* must be a callable returning a :ref:`protocol <asyncio-" "protocol>` implementation." @@ -936,31 +950,31 @@ msgstr "" "*protocol_factory* 必須是可呼叫的函式,回傳 :ref:`protocol <asyncio-" "protocol>` 實作。" -#: ../../library/asyncio-eventloop.rst:564 -#: ../../library/asyncio-eventloop.rst:642 +#: ../../library/asyncio-eventloop.rst:567 +#: ../../library/asyncio-eventloop.rst:645 msgid "A tuple of ``(transport, protocol)`` is returned on success." msgstr "成功時回傳 ``(transport, protocol)`` 元組。" -#: ../../library/asyncio-eventloop.rst:568 +#: ../../library/asyncio-eventloop.rst:571 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " -"the socket locally. The *local_host* and *local_port* are looked up using :" -"meth:`getaddrinfo`." +"the socket locally. The *local_host* and *local_port* are looked up " +"using :meth:`getaddrinfo`." msgstr "" "*local_addr*,如果提供,是一個 ``(local_host, local_port)`` 元組,用於在本地" "綁定 socket。*local_host* 和 *local_port* 使用 :meth:`getaddrinfo` 來查找。" -#: ../../library/asyncio-eventloop.rst:572 +#: ../../library/asyncio-eventloop.rst:575 msgid "" "*remote_addr*, if given, is a ``(remote_host, remote_port)`` tuple used to " "connect the socket to a remote address. The *remote_host* and *remote_port* " "are looked up using :meth:`getaddrinfo`." msgstr "" "*remote_addr*,如果提供,是一個 ``(remote_host, remote_port)`` 元組,用於將 " -"socket 連線到遠端位址。 *remote_host* 和 *remote_port* 使用 :meth:" -"`getaddrinfo` 來查找。" +"socket 連線到遠端位址。 *remote_host* 和 *remote_port* 使" +"用 :meth:`getaddrinfo` 來查找。" -#: ../../library/asyncio-eventloop.rst:576 +#: ../../library/asyncio-eventloop.rst:579 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to :meth:`getaddrinfo` for *host* resolution. If " @@ -971,7 +985,7 @@ msgstr "" "的可選地址家族、協定和旗標。如果提供,這些應該都是來自相應的 :mod:`socket` 模" "組常數的整數。" -#: ../../library/asyncio-eventloop.rst:581 +#: ../../library/asyncio-eventloop.rst:584 msgid "" "*reuse_port* tells the kernel to allow this endpoint to be bound to the same " "port as other existing endpoints are bound to, so long as they all set this " @@ -980,35 +994,36 @@ msgid "" "is not defined then this capability is unsupported." msgstr "" "*reuse_port* 告訴核心允許將此端點綁定到與其他現有端點相同的埠,只要它們在建立" -"時都設定了此旗標。此選項不受 Windows 和某些 Unix 系統支援。如果未定義 :py:" -"const:`~socket.SO_REUSEPORT` 常數,則不支援此功能。" +"時都設定了此旗標。此選項不受 Windows 和某些 Unix 系統支援。如果未定" +"義 :py:const:`~socket.SO_REUSEPORT` 常數,則不支援此功能。" -#: ../../library/asyncio-eventloop.rst:587 +#: ../../library/asyncio-eventloop.rst:590 msgid "" "*allow_broadcast* tells the kernel to allow this endpoint to send messages " "to the broadcast address." msgstr "*allow_broadcast* 告訴核心允許此端點向廣播位址發送訊息。" -#: ../../library/asyncio-eventloop.rst:590 +#: ../../library/asyncio-eventloop.rst:593 msgid "" "*sock* can optionally be specified in order to use a preexisting, already " "connected, :class:`socket.socket` object to be used by the transport. If " -"specified, *local_addr* and *remote_addr* should be omitted (must be :const:" -"`None`)." +"specified, *local_addr* and *remote_addr* should be omitted (must " +"be :const:`None`)." msgstr "" "*sock* 可以選擇性地指定,以使用預先存在且已連線的 :class:`socket.socket` 物件" -"供傳輸使用。如果指定,*local_addr* 和 *remote_addr* 應省略(必須是 :const:" -"`None`\\ )。" +"供傳輸使用。如果指定,*local_addr* 和 *remote_addr* 應省略(必須" +"是 :const:`None`\\ )。" -#: ../../library/asyncio-eventloop.rst:601 +#: ../../library/asyncio-eventloop.rst:604 msgid "" -"See :ref:`UDP echo client protocol <asyncio-udp-echo-client-protocol>` and :" -"ref:`UDP echo server protocol <asyncio-udp-echo-server-protocol>` examples." +"See :ref:`UDP echo client protocol <asyncio-udp-echo-client-protocol>` " +"and :ref:`UDP echo server protocol <asyncio-udp-echo-server-protocol>` " +"examples." msgstr "" -"請參閱 :ref:`UDP 回應用戶端協議 <asyncio-udp-echo-client-protocol>` 和 :ref:" -"`UDP 回應伺服器協議 <asyncio-udp-echo-server-protocol>` 範例。" +"請參閱 :ref:`UDP 回應用戶端協議 <asyncio-udp-echo-client-protocol>` " +"和 :ref:`UDP 回應伺服器協議 <asyncio-udp-echo-server-protocol>` 範例。" -#: ../../library/asyncio-eventloop.rst:604 +#: ../../library/asyncio-eventloop.rst:607 msgid "" "The *family*, *proto*, *flags*, *reuse_address*, *reuse_port*, " "*allow_broadcast*, and *sock* parameters were added." @@ -1016,20 +1031,21 @@ msgstr "" "新增 *family*、*proto*、*flags*、*reuse_address*、*reuse_port*、" "*allow_broadcast* 和 *sock* 參數。" -#: ../../library/asyncio-eventloop.rst:608 +#: ../../library/asyncio-eventloop.rst:611 msgid "Added support for Windows." msgstr "新增對於 Windows 的支援。" -#: ../../library/asyncio-eventloop.rst:611 +#: ../../library/asyncio-eventloop.rst:614 msgid "" -"The *reuse_address* parameter is no longer supported, as using :ref:`socket." -"SO_REUSEADDR <socket-unix-constants>` poses a significant security concern " -"for UDP. Explicitly passing ``reuse_address=True`` will raise an exception." +"The *reuse_address* parameter is no longer supported, as " +"using :ref:`socket.SO_REUSEADDR <socket-unix-constants>` poses a significant " +"security concern for UDP. Explicitly passing ``reuse_address=True`` will " +"raise an exception." msgstr "" "不再支援 *reuse_address* 參數,因為使用 :py:const:`~sockets.SO_REUSEADDR` 對" "於 UDP 存有重大的安全疑慮。明確傳遞 ``reuse_address=True`` 將引發例外。" -#: ../../library/asyncio-eventloop.rst:617 +#: ../../library/asyncio-eventloop.rst:620 msgid "" "When multiple processes with differing UIDs assign sockets to an identical " "UDP socket address with ``SO_REUSEADDR``, incoming packets can become " @@ -1038,7 +1054,7 @@ msgstr "" "當具有不同 UID 的多個行程使用 ``SO_REUSEADDR`` 將 socket 分配給相同的 UDP " "socket 地址時,傳入的封包可能會在 socket 之間隨機分佈。" -#: ../../library/asyncio-eventloop.rst:621 +#: ../../library/asyncio-eventloop.rst:624 msgid "" "For supported platforms, *reuse_port* can be used as a replacement for " "similar functionality. With *reuse_port*, :ref:`socket.SO_REUSEPORT <socket-" @@ -1049,50 +1065,51 @@ msgstr "" "*reuse_port*,將改為使用 :py:const:`~sockets.SO_REUSEPORT`,該選項明確禁止具" "有不同 UID 的行程將 socket 分配給相同的 socket 地址。" -#: ../../library/asyncio-eventloop.rst:628 +#: ../../library/asyncio-eventloop.rst:631 msgid "" "The *reuse_address* parameter, disabled since Python 3.8.1, 3.7.6 and " "3.6.10, has been entirely removed." msgstr "" "自 Python 3.9.0、3.8.1、3.7.6 和 3.6.10 起,已完全移除 *reuse_address* 參數。" -#: ../../library/asyncio-eventloop.rst:637 +#: ../../library/asyncio-eventloop.rst:640 msgid "Create a Unix connection." msgstr "建立一個 Unix 連線。" -#: ../../library/asyncio-eventloop.rst:639 +#: ../../library/asyncio-eventloop.rst:642 msgid "" -"The socket family will be :py:const:`~socket.AF_UNIX`; socket type will be :" -"py:const:`~socket.SOCK_STREAM`." +"The socket family will be :py:const:`~socket.AF_UNIX`; socket type will " +"be :py:const:`~socket.SOCK_STREAM`." msgstr "" -"Socket 家族將為 :py:const:`~socket.AF_UNIX`;socket 類型將為 :py:const:" -"`~socket.SOCK_STREAM`。" +"Socket 家族將為 :py:const:`~socket.AF_UNIX`;socket 類型將" +"為 :py:const:`~socket.SOCK_STREAM`。" -#: ../../library/asyncio-eventloop.rst:644 +#: ../../library/asyncio-eventloop.rst:647 msgid "" "*path* is the name of a Unix domain socket and is required, unless a *sock* " -"parameter is specified. Abstract Unix sockets, :class:`str`, :class:" -"`bytes`, and :class:`~pathlib.Path` paths are supported." +"parameter is specified. Abstract Unix " +"sockets, :class:`str`, :class:`bytes`, and :class:`~pathlib.Path` paths are " +"supported." msgstr "" "*path* 是 Unix 域 socket 的名稱,除非指定 *sock* 參數,否則為必填。支援抽象 " "Unix sockets、:class:`str`、:class:`bytes` 和 :class:`~pathlib.Path` 路徑。" -#: ../../library/asyncio-eventloop.rst:649 +#: ../../library/asyncio-eventloop.rst:652 msgid "" "See the documentation of the :meth:`loop.create_connection` method for " "information about arguments to this method." msgstr "" "有關此方法的引數資訊,請參閱 :meth:`loop.create_connection` 方法的文件。" -#: ../../library/asyncio-eventloop.rst:652 -#: ../../library/asyncio-eventloop.rst:806 -#: ../../library/asyncio-eventloop.rst:1249 -#: ../../library/asyncio-eventloop.rst:1782 -#: ../../library/asyncio-eventloop.rst:1789 +#: ../../library/asyncio-eventloop.rst:655 +#: ../../library/asyncio-eventloop.rst:809 +#: ../../library/asyncio-eventloop.rst:1258 +#: ../../library/asyncio-eventloop.rst:1791 +#: ../../library/asyncio-eventloop.rst:1798 msgid "Availability" msgstr "" -#: ../../library/asyncio-eventloop.rst:654 +#: ../../library/asyncio-eventloop.rst:657 msgid "" "Added the *ssl_handshake_timeout* parameter. The *path* parameter can now be " "a :term:`path-like object`." @@ -1100,11 +1117,11 @@ msgstr "" "新增 *ssl_handshake_timeout* 參數。*path* 參數現在可以是 :term:`path-like " "object`。" -#: ../../library/asyncio-eventloop.rst:664 +#: ../../library/asyncio-eventloop.rst:667 msgid "Creating network servers" msgstr "建立網路伺服器" -#: ../../library/asyncio-eventloop.rst:679 +#: ../../library/asyncio-eventloop.rst:682 msgid "" "Create a TCP server (socket type :const:`~socket.SOCK_STREAM`) listening on " "*port* of the *host* address." @@ -1112,33 +1129,33 @@ msgstr "" "建立一個 TCP 伺服器(socket 類型 :const:`~socket.SOCK_STREAM`\\ ),監聽 " "*host* 位址的 *port*。" -#: ../../library/asyncio-eventloop.rst:682 +#: ../../library/asyncio-eventloop.rst:685 msgid "Returns a :class:`Server` object." msgstr "回傳一個 :class:`Server` 物件。" -#: ../../library/asyncio-eventloop.rst:684 +#: ../../library/asyncio-eventloop.rst:687 msgid "Arguments:" msgstr "引數:" -#: ../../library/asyncio-eventloop.rst:689 +#: ../../library/asyncio-eventloop.rst:692 msgid "" "The *host* parameter can be set to several types which determine where the " "server would be listening:" msgstr "可以將 *host* 參數設為幾種類型,以確定伺服器將監聽的位置:" -#: ../../library/asyncio-eventloop.rst:692 +#: ../../library/asyncio-eventloop.rst:695 msgid "" "If *host* is a string, the TCP server is bound to a single network interface " "specified by *host*." msgstr "如果 *host* 是字串,則 TCP 伺服器綁定到由 *host* 指定的單個網路介面。" -#: ../../library/asyncio-eventloop.rst:695 +#: ../../library/asyncio-eventloop.rst:698 msgid "" "If *host* is a sequence of strings, the TCP server is bound to all network " "interfaces specified by the sequence." msgstr "如果 *host* 是字串序列,則 TCP 伺服器綁定到序列指定的所有網路介面。" -#: ../../library/asyncio-eventloop.rst:698 +#: ../../library/asyncio-eventloop.rst:701 msgid "" "If *host* is an empty string or ``None``, all interfaces are assumed and a " "list of multiple sockets will be returned (most likely one for IPv4 and " @@ -1147,7 +1164,7 @@ msgstr "" "若 *host* 是空字串或 ``None``,則所有介面都被假定並回傳多個 socket 的清單(可" "能一個用於 IPv4,另一個用於 IPv6)。" -#: ../../library/asyncio-eventloop.rst:702 +#: ../../library/asyncio-eventloop.rst:705 msgid "" "The *port* parameter can be set to specify which port the server should " "listen on. If ``0`` or ``None`` (the default), a random unused port will be " @@ -1158,21 +1175,22 @@ msgstr "" "設值),將隨機選擇一個未使用的埠(請注意,如果 *host* 解析為多個網路介面,將" "為每個介面隨機選擇不同的隨機埠)。" -#: ../../library/asyncio-eventloop.rst:707 +#: ../../library/asyncio-eventloop.rst:710 msgid "" -"*family* can be set to either :const:`socket.AF_INET` or :const:`~socket." -"AF_INET6` to force the socket to use IPv4 or IPv6. If not set, the *family* " -"will be determined from host name (defaults to :const:`~socket.AF_UNSPEC`)." +"*family* can be set to either :const:`socket.AF_INET` " +"or :const:`~socket.AF_INET6` to force the socket to use IPv4 or IPv6. If not " +"set, the *family* will be determined from host name (defaults " +"to :const:`~socket.AF_UNSPEC`)." msgstr "" "*family* 可以設定為 :const:`socket.AF_INET` 或 :const:`~socket.AF_INET6` 以強" -"制使用 IPv4 或 IPv6。如果未設定,*family* 將從主機名稱決定(預設為 :const:" -"`~socket.AF_UNSPEC`\\ )。" +"制使用 IPv4 或 IPv6。如果未設定,*family* 將從主機名稱決定(預設" +"為 :const:`~socket.AF_UNSPEC`\\ )。" -#: ../../library/asyncio-eventloop.rst:712 +#: ../../library/asyncio-eventloop.rst:715 msgid "*flags* is a bitmask for :meth:`getaddrinfo`." msgstr "*flags* 是 :meth:`getaddrinfo` 的位元遮罩。" -#: ../../library/asyncio-eventloop.rst:714 +#: ../../library/asyncio-eventloop.rst:717 msgid "" "*sock* can optionally be specified in order to use a preexisting socket " "object. If specified, *host* and *port* must not be specified." @@ -1180,7 +1198,7 @@ msgstr "" "可以可選地指定 *sock* 以使用現有的 socket 物件。如果指定了,*host* 和 *port* " "不能指定。" -#: ../../library/asyncio-eventloop.rst:719 +#: ../../library/asyncio-eventloop.rst:722 msgid "" "The *sock* argument transfers ownership of the socket to the server created. " "To close the socket, call the server's :meth:`~asyncio.Server.close` method." @@ -1188,22 +1206,22 @@ msgstr "" "*sock* 引數將 socket 的所有權轉移給建立的伺服器。要關閉 socket,請呼叫伺服器" "的 :meth:`~asyncio.Server.close` 方法。" -#: ../../library/asyncio-eventloop.rst:723 +#: ../../library/asyncio-eventloop.rst:726 msgid "" -"*backlog* is the maximum number of queued connections passed to :meth:" -"`~socket.socket.listen` (defaults to 100)." +"*backlog* is the maximum number of queued connections passed " +"to :meth:`~socket.socket.listen` (defaults to 100)." msgstr "" "*backlog* 是傳遞給 :meth:`~socket.socket.listen` 的最大佇列連線數(預設為 " "100)。" -#: ../../library/asyncio-eventloop.rst:726 +#: ../../library/asyncio-eventloop.rst:729 msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` instance to enable TLS over " "the accepted connections." msgstr "" "*ssl* 可以設定為 :class:`~ssl.SSLContext` 實例以在接受的連線上啟用 TLS。" -#: ../../library/asyncio-eventloop.rst:729 +#: ../../library/asyncio-eventloop.rst:732 msgid "" "*reuse_address* tells the kernel to reuse a local socket in ``TIME_WAIT`` " "state, without waiting for its natural timeout to expire. If not specified " @@ -1212,7 +1230,7 @@ msgstr "" "*reuse_address* 告訴內核重用 ``TIME_WAIT`` 狀態下的本地 socket,而不等待其自" "然超時過期。如果未指定,在 Unix 上將自動設置為 ``True``。" -#: ../../library/asyncio-eventloop.rst:734 +#: ../../library/asyncio-eventloop.rst:737 msgid "" "*reuse_port* tells the kernel to allow this endpoint to be bound to the same " "port as other existing endpoints are bound to, so long as they all set this " @@ -1221,17 +1239,17 @@ msgstr "" "*reuse_port* 告訴內核允許此端點繫結到與其他現有端點繫結的相同埠,只要它們在建" "立時都設置了此旗標。此選項在旗標 Windows 上不受支援。" -#: ../../library/asyncio-eventloop.rst:739 +#: ../../library/asyncio-eventloop.rst:742 msgid "" "*keep_alive* set to ``True`` keeps connections active by enabling the " "periodic transmission of messages." -msgstr "" +msgstr "將 *keep_alive* 設為 ``True`` 透過啟用定期的訊息傳輸來保持連線活躍。" -#: ../../library/asyncio-eventloop.rst:744 +#: ../../library/asyncio-eventloop.rst:747 msgid "Added the *keep_alive* parameter." msgstr "加入 *keep_alive* 參數。" -#: ../../library/asyncio-eventloop.rst:746 +#: ../../library/asyncio-eventloop.rst:749 msgid "" "*ssl_handshake_timeout* is (for a TLS server) the time in seconds to wait " "for the TLS handshake to complete before aborting the connection. ``60.0`` " @@ -1240,7 +1258,7 @@ msgstr "" "(對於 TLS 伺服器)\\ *ssl_handshake_timeout* 是在中斷連線之前等待 TLS 握手完" "成的時間(以秒為單位)。如果為 ``None``\\ (預設),則為 ``60.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:754 +#: ../../library/asyncio-eventloop.rst:757 msgid "" "*start_serving* set to ``True`` (the default) causes the created server to " "start accepting connections immediately. When set to ``False``, the user " @@ -1248,40 +1266,41 @@ msgid "" "to make the server to start accepting connections." msgstr "" "將 *start_serving* 設置為 ``True``\\ (預設)將使建立的伺服器立即開始接受連" -"接。當設置為 ``False`` 時,用戶應該等待 :meth:`Server.start_serving` 或 :" -"meth:`Server.serve_forever` 來使伺服器開始接受連線。" +"接。當設置為 ``False`` 時,用戶應該等待 :meth:`Server.start_serving` " +"或 :meth:`Server.serve_forever` 來使伺服器開始接受連線。" -#: ../../library/asyncio-eventloop.rst:766 +#: ../../library/asyncio-eventloop.rst:769 msgid "The *host* parameter can be a sequence of strings." msgstr "*host* 參數可以是字串序列。" -#: ../../library/asyncio-eventloop.rst:770 +#: ../../library/asyncio-eventloop.rst:773 msgid "" "Added *ssl_handshake_timeout* and *start_serving* parameters. The socket " "option :ref:`socket.TCP_NODELAY <socket-unix-constants>` is set by default " "for all TCP connections." msgstr "" -"新增 *ssl_handshake_timeout* 與 *start_serving* 參數。所有 TCP 連線都預設有 :" -"ref:`socket.TCP_NODELAY <socket-unix-constants>` socket 選項。" +"新增 *ssl_handshake_timeout* 與 *start_serving* 參數。所有 TCP 連線都預設" +"有 :ref:`socket.TCP_NODELAY <socket-unix-constants>` socket 選項。" -#: ../../library/asyncio-eventloop.rst:780 +#: ../../library/asyncio-eventloop.rst:783 msgid "" "The :func:`start_server` function is a higher-level alternative API that " "returns a pair of :class:`StreamReader` and :class:`StreamWriter` that can " "be used in an async/await code." msgstr "" -":func:`start_server` 函式是一個更高階的替代 API,它回傳一對 :class:" -"`StreamReader` 和 :class:`StreamWriter`,可以在 async/await 程式碼中使用。" +":func:`start_server` 函式是一個更高階的替代 API,它回傳一" +"對 :class:`StreamReader` 和 :class:`StreamWriter`,可以在 async/await 程式碼" +"中使用。" -#: ../../library/asyncio-eventloop.rst:791 +#: ../../library/asyncio-eventloop.rst:794 msgid "" -"Similar to :meth:`loop.create_server` but works with the :py:const:`~socket." -"AF_UNIX` socket family." +"Similar to :meth:`loop.create_server` but works with " +"the :py:const:`~socket.AF_UNIX` socket family." msgstr "" "類似 :meth:`loop.create_server`,但適用於 :py:const:`~socket.AF_UNIX` socket " "家族。" -#: ../../library/asyncio-eventloop.rst:794 +#: ../../library/asyncio-eventloop.rst:797 msgid "" "*path* is the name of a Unix domain socket, and is required, unless a *sock* " "argument is provided. Abstract Unix sockets, :class:`str`, :class:`bytes`, " @@ -1291,20 +1310,22 @@ msgstr "" "象 Unix sockets、:class:`str`、:class:`bytes` 和 :class:`~pathlib.Path` 路" "徑。" -#: ../../library/asyncio-eventloop.rst:799 +#: ../../library/asyncio-eventloop.rst:802 msgid "" "If *cleanup_socket* is true then the Unix socket will automatically be " "removed from the filesystem when the server is closed, unless the socket has " "been replaced after the server has been created." msgstr "" +"如果 *cleanup_socket* 為真,則 Unix socket 將在伺服器關閉時自動從檔案系統中刪" +"除,除非在建立伺服器後替換了 socket。" -#: ../../library/asyncio-eventloop.rst:803 +#: ../../library/asyncio-eventloop.rst:806 msgid "" "See the documentation of the :meth:`loop.create_server` method for " "information about arguments to this method." msgstr "有關此方法的引數資訊,請參閱 :meth:`loop.create_server` 方法的文件。" -#: ../../library/asyncio-eventloop.rst:810 +#: ../../library/asyncio-eventloop.rst:813 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :class:`~pathlib.Path` object." @@ -1312,26 +1333,26 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。*path* 參數現在可為一" "個 :class:`~pathlib.Path` 物件。" -#: ../../library/asyncio-eventloop.rst:819 +#: ../../library/asyncio-eventloop.rst:822 msgid "Added the *cleanup_socket* parameter." msgstr "加入 *cleanup_socket* 參數。" -#: ../../library/asyncio-eventloop.rst:826 +#: ../../library/asyncio-eventloop.rst:829 msgid "Wrap an already accepted connection into a transport/protocol pair." msgstr "將已接受的連線包裝成傳輸層/協議對。" -#: ../../library/asyncio-eventloop.rst:828 +#: ../../library/asyncio-eventloop.rst:831 msgid "" "This method can be used by servers that accept connections outside of " "asyncio but that use asyncio to handle them." msgstr "此方法可以由在 asyncio 外接受連線但使用 asyncio 處理連線的伺服器使用。" -#: ../../library/asyncio-eventloop.rst:831 -#: ../../library/asyncio-eventloop.rst:921 +#: ../../library/asyncio-eventloop.rst:834 +#: ../../library/asyncio-eventloop.rst:924 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-eventloop.rst:836 +#: ../../library/asyncio-eventloop.rst:839 msgid "" "*sock* is a preexisting socket object returned from :meth:`socket.accept " "<socket.socket.accept>`." @@ -1339,13 +1360,13 @@ msgstr "" "*sock* 是從 :meth:`socket.accept <socket.socket.accept>` 回傳的預先存在的 " "socket 物件。" -#: ../../library/asyncio-eventloop.rst:845 +#: ../../library/asyncio-eventloop.rst:848 msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` to enable SSL over the " "accepted connections." msgstr "*ssl* 可以設置為 :class:`~ssl.SSLContext` 以在已接受的連線上啟用 SSL。" -#: ../../library/asyncio-eventloop.rst:848 +#: ../../library/asyncio-eventloop.rst:851 msgid "" "*ssl_handshake_timeout* is (for an SSL connection) the time in seconds to " "wait for the SSL handshake to complete before aborting the connection. " @@ -1354,29 +1375,29 @@ msgstr "" "(對於 SSL 連線)\\ *ssl_handshake_timeout* 是在中斷連線之前等待 SSL 握手完成" "的時間(以秒為單位)。如果為 ``None``\\ (預設),則為 ``60.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:856 +#: ../../library/asyncio-eventloop.rst:859 msgid "Returns a ``(transport, protocol)`` pair." msgstr "回傳 ``(transport, protocol)`` 對。" -#: ../../library/asyncio-eventloop.rst:870 +#: ../../library/asyncio-eventloop.rst:873 msgid "Transferring files" msgstr "傳輸檔案" -#: ../../library/asyncio-eventloop.rst:875 +#: ../../library/asyncio-eventloop.rst:878 msgid "" "Send a *file* over a *transport*. Return the total number of bytes sent." msgstr "通過 *transport* 發送 *file*。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:878 +#: ../../library/asyncio-eventloop.rst:881 msgid "The method uses high-performance :meth:`os.sendfile` if available." msgstr "如果可用,該方法使用高性能 :meth:`os.sendfile`。" -#: ../../library/asyncio-eventloop.rst:880 +#: ../../library/asyncio-eventloop.rst:883 msgid "*file* must be a regular file object opened in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:882 -#: ../../library/asyncio-eventloop.rst:1127 +#: ../../library/asyncio-eventloop.rst:885 +#: ../../library/asyncio-eventloop.rst:1136 msgid "" "*offset* tells from where to start reading the file. If specified, *count* " "is the total number of bytes to transmit as opposed to sending the file " @@ -1388,7 +1409,7 @@ msgstr "" "不是發送檔案直到達到 EOF。即使此方法引發錯誤時,檔案位置也始終更新,可以使" "用 :meth:`file.tell() <io.IOBase.tell>` 取得實際發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:889 +#: ../../library/asyncio-eventloop.rst:892 msgid "" "*fallback* set to ``True`` makes asyncio to manually read and send the file " "when the platform does not support the sendfile system call (e.g. Windows or " @@ -1397,23 +1418,23 @@ msgstr "" "將 *fallback* 設置為 ``True`` 會使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:893 +#: ../../library/asyncio-eventloop.rst:896 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support the " "*sendfile* syscall and *fallback* is ``False``." msgstr "" -"如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,則引發 :exc:" -"`SendfileNotAvailableError`。" +"如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,則引" +"發 :exc:`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:900 +#: ../../library/asyncio-eventloop.rst:903 msgid "TLS Upgrade" msgstr "TLS 升級" -#: ../../library/asyncio-eventloop.rst:907 +#: ../../library/asyncio-eventloop.rst:910 msgid "Upgrade an existing transport-based connection to TLS." msgstr "將基於傳輸的現有連線升級到 TLS。" -#: ../../library/asyncio-eventloop.rst:909 +#: ../../library/asyncio-eventloop.rst:912 msgid "" "Create a TLS coder/decoder instance and insert it between the *transport* " "and the *protocol*. The coder/decoder implements both *transport*-facing " @@ -1422,7 +1443,7 @@ msgstr "" "建立 TLS 編解碼器實例並在 *transport* 和 *protocol* 之間插入它。編解碼器既實" "作了對於 *transport* 的協議,也實作了對於 *protocol* 的傳輸。" -#: ../../library/asyncio-eventloop.rst:913 +#: ../../library/asyncio-eventloop.rst:916 msgid "" "Return the created two-interface instance. After *await*, the *protocol* " "must stop using the original *transport* and communicate with the returned " @@ -1433,25 +1454,25 @@ msgstr "" "*transport*,僅與回傳的物件通信,因為編碼器快取了 *protocol* 端的資料,並且" "與 *transport* 間歇性地交換額外的 TLS session 封包。" -#: ../../library/asyncio-eventloop.rst:918 +#: ../../library/asyncio-eventloop.rst:921 msgid "" "In some situations (e.g. when the passed transport is already closing) this " "may return ``None``." msgstr "在某些情況下(例如傳入的傳輸已經關閉),此函式可能回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:923 +#: ../../library/asyncio-eventloop.rst:926 msgid "" -"*transport* and *protocol* instances that methods like :meth:`~loop." -"create_server` and :meth:`~loop.create_connection` return." +"*transport* and *protocol* instances that methods " +"like :meth:`~loop.create_server` and :meth:`~loop.create_connection` return." msgstr "" -"*transport* 和 *protocol* 實例,由像 :meth:`~loop.create_server` 和 :meth:" -"`~loop.create_connection` 等方法回傳。" +"*transport* 和 *protocol* 實例,由像 :meth:`~loop.create_server` " +"和 :meth:`~loop.create_connection` 等方法回傳。" -#: ../../library/asyncio-eventloop.rst:927 +#: ../../library/asyncio-eventloop.rst:930 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "*sslcontext*:配置好的 :class:`~ssl.SSLContext` 實例。" -#: ../../library/asyncio-eventloop.rst:929 +#: ../../library/asyncio-eventloop.rst:932 msgid "" "*server_side* pass ``True`` when a server-side connection is being upgraded " "(like the one created by :meth:`~loop.create_server`)." @@ -1459,17 +1480,17 @@ msgstr "" "當升級伺服器端連線時(像由 :meth:`~loop.create_server` 建立的那樣)傳遞 " "``True``。" -#: ../../library/asyncio-eventloop.rst:932 +#: ../../library/asyncio-eventloop.rst:935 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "*server_hostname*:設置或覆蓋將用於匹配目標伺服器憑證的主機名。" -#: ../../library/asyncio-eventloop.rst:952 +#: ../../library/asyncio-eventloop.rst:955 msgid "Watching file descriptors" msgstr "監視檔案描述器" -#: ../../library/asyncio-eventloop.rst:956 +#: ../../library/asyncio-eventloop.rst:959 msgid "" "Start monitoring the *fd* file descriptor for read availability and invoke " "*callback* with the specified arguments once *fd* is available for reading." @@ -1477,7 +1498,14 @@ msgstr "" "開始監視 *fd* 檔案描述器的讀取可用性,一但 *fd* 可讀取,使用指定引數呼叫 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:962 +#: ../../library/asyncio-eventloop.rst:963 +#: ../../library/asyncio-eventloop.rst:977 +msgid "" +"Any preexisting callback registered for *fd* is cancelled and replaced by " +"*callback*." +msgstr "任何預先存在、為 *fd* 註冊的回呼函式將被取消並替換為 *callback*。" + +#: ../../library/asyncio-eventloop.rst:968 msgid "" "Stop monitoring the *fd* file descriptor for read availability. Returns " "``True`` if *fd* was previously being monitored for reads." @@ -1485,7 +1513,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的讀取可用性。如果 *fd* 之前正在監視讀取,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:967 +#: ../../library/asyncio-eventloop.rst:973 msgid "" "Start monitoring the *fd* file descriptor for write availability and invoke " "*callback* with the specified arguments once *fd* is available for writing." @@ -1493,8 +1521,8 @@ msgstr "" "開始監視 *fd* 檔案描述器的寫入可用性,一旦 *fd* 可寫入,使用指定引數呼叫 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:971 -#: ../../library/asyncio-eventloop.rst:1236 +#: ../../library/asyncio-eventloop.rst:980 +#: ../../library/asyncio-eventloop.rst:1245 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments <asyncio-pass-" "keywords>` to *callback*." @@ -1502,7 +1530,7 @@ msgstr "" "使用 :func:`functools.partial` 向 *callback* :ref:`傳送關鍵字引數 <asyncio-" "pass-keywords>`。" -#: ../../library/asyncio-eventloop.rst:976 +#: ../../library/asyncio-eventloop.rst:985 msgid "" "Stop monitoring the *fd* file descriptor for write availability. Returns " "``True`` if *fd* was previously being monitored for writes." @@ -1510,7 +1538,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的寫入可用性。如果 *fd* 之前正在監視寫入,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:979 +#: ../../library/asyncio-eventloop.rst:988 msgid "" "See also :ref:`Platform Support <asyncio-platform-support>` section for some " "limitations of these methods." @@ -1518,47 +1546,47 @@ msgstr "" "另請參閱\\ :ref:`平台支援 <asyncio-platform-support>`\\ 部分以了解這些方法的" "一些限制。" -#: ../../library/asyncio-eventloop.rst:984 +#: ../../library/asyncio-eventloop.rst:993 msgid "Working with socket objects directly" msgstr "直接使用 socket 物件" -#: ../../library/asyncio-eventloop.rst:986 +#: ../../library/asyncio-eventloop.rst:995 msgid "" -"In general, protocol implementations that use transport-based APIs such as :" -"meth:`loop.create_connection` and :meth:`loop.create_server` are faster than " -"implementations that work with sockets directly. However, there are some use " -"cases when performance is not critical, and working with :class:`~socket." -"socket` objects directly is more convenient." +"In general, protocol implementations that use transport-based APIs such " +"as :meth:`loop.create_connection` and :meth:`loop.create_server` are faster " +"than implementations that work with sockets directly. However, there are " +"some use cases when performance is not critical, and working " +"with :class:`~socket.socket` objects directly is more convenient." msgstr "" -"一般情況下,使用基於傳輸的 API(如 :meth:`loop.create_connection` 和 :meth:" -"`loop.create_server`\\ )的協議實作比直接使用 socket 的實作更快。然而在某些情" -"況下性能不是關鍵,直接使用 :class:`~socket.socket` 物件更方便。" +"一般情況下,使用基於傳輸的 API(如 :meth:`loop.create_connection` " +"和 :meth:`loop.create_server`\\ )的協議實作比直接使用 socket 的實作更快。然" +"而在某些情況下性能不是關鍵,直接使用 :class:`~socket.socket` 物件更方便。" -#: ../../library/asyncio-eventloop.rst:995 +#: ../../library/asyncio-eventloop.rst:1004 msgid "" -"Receive up to *nbytes* from *sock*. Asynchronous version of :meth:`socket." -"recv() <socket.socket.recv>`." +"Receive up to *nbytes* from *sock*. Asynchronous version " +"of :meth:`socket.recv() <socket.socket.recv>`." msgstr "" "從 *sock* 接收最多 *nbytes*。:meth:`socket.recv() <socket.socket.recv>` 的非" "同步版本。" -#: ../../library/asyncio-eventloop.rst:998 +#: ../../library/asyncio-eventloop.rst:1007 msgid "Return the received data as a bytes object." msgstr "將接收到的資料作為 bytes 物件回傳。" -#: ../../library/asyncio-eventloop.rst:1000 -#: ../../library/asyncio-eventloop.rst:1014 -#: ../../library/asyncio-eventloop.rst:1025 -#: ../../library/asyncio-eventloop.rst:1037 -#: ../../library/asyncio-eventloop.rst:1052 -#: ../../library/asyncio-eventloop.rst:1067 -#: ../../library/asyncio-eventloop.rst:1077 -#: ../../library/asyncio-eventloop.rst:1103 -#: ../../library/asyncio-eventloop.rst:1141 +#: ../../library/asyncio-eventloop.rst:1009 +#: ../../library/asyncio-eventloop.rst:1023 +#: ../../library/asyncio-eventloop.rst:1034 +#: ../../library/asyncio-eventloop.rst:1046 +#: ../../library/asyncio-eventloop.rst:1061 +#: ../../library/asyncio-eventloop.rst:1076 +#: ../../library/asyncio-eventloop.rst:1086 +#: ../../library/asyncio-eventloop.rst:1112 +#: ../../library/asyncio-eventloop.rst:1150 msgid "*sock* must be a non-blocking socket." msgstr "*sock* 必須是非阻塞 socket。" -#: ../../library/asyncio-eventloop.rst:1002 +#: ../../library/asyncio-eventloop.rst:1011 msgid "" "Even though this method was always documented as a coroutine method, " "releases before Python 3.7 returned a :class:`Future`. Since Python 3.7 this " @@ -1567,51 +1595,52 @@ msgstr "" "儘管此方法一直記錄為協程方法,但 Python 3.7 之前的版本回傳 :class:`Future`。" "自 Python 3.7 起,這是 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:1009 +#: ../../library/asyncio-eventloop.rst:1018 msgid "" -"Receive data from *sock* into the *buf* buffer. Modeled after the blocking :" -"meth:`socket.recv_into() <socket.socket.recv_into>` method." +"Receive data from *sock* into the *buf* buffer. Modeled after the " +"blocking :meth:`socket.recv_into() <socket.socket.recv_into>` method." msgstr "" "從 *sock* 接收資料到 *buf* 緩衝區。仿照阻塞 :meth:`socket.recv_into() " "<socket.socket.recv_into>` 方法。" -#: ../../library/asyncio-eventloop.rst:1012 +#: ../../library/asyncio-eventloop.rst:1021 msgid "Return the number of bytes written to the buffer." msgstr "回傳寫入緩衝區位元組的數目。" -#: ../../library/asyncio-eventloop.rst:1020 +#: ../../library/asyncio-eventloop.rst:1029 msgid "" -"Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of :" -"meth:`socket.recvfrom() <socket.socket.recvfrom>`." +"Receive a datagram of up to *bufsize* from *sock*. Asynchronous version " +"of :meth:`socket.recvfrom() <socket.socket.recvfrom>`." msgstr "" "從 *sock* 接收最多 *bufsize* 大小的資料單元。:meth:`socket.recvfrom() " "<socket.socket.recvfrom>` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1023 +#: ../../library/asyncio-eventloop.rst:1032 msgid "Return a tuple of (received data, remote address)." msgstr "回傳一個元組 (received data, remote address)。" -#: ../../library/asyncio-eventloop.rst:1031 +#: ../../library/asyncio-eventloop.rst:1040 msgid "" "Receive a datagram of up to *nbytes* from *sock* into *buf*. Asynchronous " "version of :meth:`socket.recvfrom_into() <socket.socket.recvfrom_into>`." msgstr "" -"從 *sock* 接收最多 *nbytes* 大小的資料單元到 *buf*。:meth:`socket." -"recvfrom_into() <socket.socket.recvfrom_into>` 的非同步版本。" +"從 *sock* 接收最多 *nbytes* 大小的資料單元到 " +"*buf*。:meth:`socket.recvfrom_into() <socket.socket.recvfrom_into>` 的非同步" +"版本。" -#: ../../library/asyncio-eventloop.rst:1035 +#: ../../library/asyncio-eventloop.rst:1044 msgid "Return a tuple of (number of bytes received, remote address)." msgstr "回傳一個元組 (number of bytes received, remote address)。" -#: ../../library/asyncio-eventloop.rst:1043 +#: ../../library/asyncio-eventloop.rst:1052 msgid "" -"Send *data* to the *sock* socket. Asynchronous version of :meth:`socket." -"sendall() <socket.socket.sendall>`." +"Send *data* to the *sock* socket. Asynchronous version " +"of :meth:`socket.sendall() <socket.socket.sendall>`." msgstr "" -"將 *data* 發送到 *sock* socket。:meth:`socket.sendall() <socket.socket." -"sendall>` 的非同步版本。" +"將 *data* 發送到 *sock* socket。:meth:`socket.sendall() " +"<socket.socket.sendall>` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1046 +#: ../../library/asyncio-eventloop.rst:1055 msgid "" "This method continues to send to the socket until either all data in *data* " "has been sent or an error occurs. ``None`` is returned on success. On " @@ -1623,8 +1652,8 @@ msgstr "" "回傳 ``None``。錯誤時引發例外。此外,沒有辦法確定接收端成功處理了多少資料(如" "果有的話)。" -#: ../../library/asyncio-eventloop.rst:1054 -#: ../../library/asyncio-eventloop.rst:1105 +#: ../../library/asyncio-eventloop.rst:1063 +#: ../../library/asyncio-eventloop.rst:1114 msgid "" "Even though the method was always documented as a coroutine method, before " "Python 3.7 it returned a :class:`Future`. Since Python 3.7, this is an " @@ -1633,39 +1662,39 @@ msgstr "" "儘管該方法一直被記錄為協程方法,但在 Python 3.7 之前它回傳 :class:`Future`。" "從 Python 3.7 開始,這是一個 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:1061 +#: ../../library/asyncio-eventloop.rst:1070 msgid "" -"Send a datagram from *sock* to *address*. Asynchronous version of :meth:" -"`socket.sendto() <socket.socket.sendto>`." +"Send a datagram from *sock* to *address*. Asynchronous version " +"of :meth:`socket.sendto() <socket.socket.sendto>`." msgstr "" -"從 *sock* 向 *address* 發送一個資料單元。:meth:`socket.sendto() <socket." -"socket.sendto>` 的非同步版本。" +"從 *sock* 向 *address* 發送一個資料單元。:meth:`socket.sendto() " +"<socket.socket.sendto>` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1065 +#: ../../library/asyncio-eventloop.rst:1074 msgid "Return the number of bytes sent." msgstr "回傳發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:1073 +#: ../../library/asyncio-eventloop.rst:1082 msgid "Connect *sock* to a remote socket at *address*." msgstr "將 *sock* 連線到位於 *address* 的遠端 socket。" -#: ../../library/asyncio-eventloop.rst:1075 +#: ../../library/asyncio-eventloop.rst:1084 msgid "" "Asynchronous version of :meth:`socket.connect() <socket.socket.connect>`." msgstr ":meth:`socket.connect() <socket.socket.connect>` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1079 +#: ../../library/asyncio-eventloop.rst:1088 msgid "" "``address`` no longer needs to be resolved. ``sock_connect`` will try to " -"check if the *address* is already resolved by calling :func:`socket." -"inet_pton`. If not, :meth:`loop.getaddrinfo` will be used to resolve the " -"*address*." +"check if the *address* is already resolved by " +"calling :func:`socket.inet_pton`. If not, :meth:`loop.getaddrinfo` will be " +"used to resolve the *address*." msgstr "" -"不再需要解析 ``address``。``sock_connect`` 將嘗試透過呼叫 :func:`socket." -"inet_pton` 檢查 *address* 是否已解析。如果沒有,將使用 :meth:`loop." -"getaddrinfo` 解析 *address*。" +"不再需要解析 ``address``。``sock_connect`` 將嘗試透過呼" +"叫 :func:`socket.inet_pton` 檢查 *address* 是否已解析。如果沒有,將使" +"用 :meth:`loop.getaddrinfo` 解析 *address*。" -#: ../../library/asyncio-eventloop.rst:1088 +#: ../../library/asyncio-eventloop.rst:1097 msgid "" ":meth:`loop.create_connection` and :func:`asyncio.open_connection() " "<open_connection>`." @@ -1673,7 +1702,7 @@ msgstr "" ":meth:`loop.create_connection` 和 :func:`asyncio.open_connection() " "<open_connection>`。" -#: ../../library/asyncio-eventloop.rst:1094 +#: ../../library/asyncio-eventloop.rst:1103 msgid "" "Accept a connection. Modeled after the blocking :meth:`socket.accept() " "<socket.socket.accept>` method." @@ -1681,7 +1710,7 @@ msgstr "" "接受一個連線。模擬阻塞的 :meth:`socket.accept() <socket.socket.accept>` 方" "法。" -#: ../../library/asyncio-eventloop.rst:1097 +#: ../../library/asyncio-eventloop.rst:1106 msgid "" "The socket must be bound to an address and listening for connections. The " "return value is a pair ``(conn, address)`` where *conn* is a *new* socket " @@ -1692,34 +1721,34 @@ msgstr "" "中 *conn* 是一個 *新* socket 物件,可在連線上發送和接收資料,*address* 是連接" "另一端對應的 socket 地址。" -#: ../../library/asyncio-eventloop.rst:1112 +#: ../../library/asyncio-eventloop.rst:1121 msgid ":meth:`loop.create_server` and :func:`start_server`." msgstr ":meth:`loop.create_server` 和 :func:`start_server`。" -#: ../../library/asyncio-eventloop.rst:1117 +#: ../../library/asyncio-eventloop.rst:1126 msgid "" "Send a file using high-performance :mod:`os.sendfile` if possible. Return " "the total number of bytes sent." msgstr "" "如果可行,使用高性能 :mod:`os.sendfile` 發送檔案。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:1120 +#: ../../library/asyncio-eventloop.rst:1129 msgid "" "Asynchronous version of :meth:`socket.sendfile() <socket.socket.sendfile>`." msgstr ":meth:`socket.sendfile() <socket.socket.sendfile>` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1122 +#: ../../library/asyncio-eventloop.rst:1131 msgid "" -"*sock* must be a non-blocking :const:`socket.SOCK_STREAM` :class:`~socket." -"socket`." +"*sock* must be a non-" +"blocking :const:`socket.SOCK_STREAM` :class:`~socket.socket`." msgstr "" "*sock* 必須是非阻塞的 :const:`socket.SOCK_STREAM` :class:`~socket.socket`。" -#: ../../library/asyncio-eventloop.rst:1125 +#: ../../library/asyncio-eventloop.rst:1134 msgid "*file* must be a regular file object open in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:1134 +#: ../../library/asyncio-eventloop.rst:1143 msgid "" "*fallback*, when set to ``True``, makes asyncio manually read and send the " "file when the platform does not support the sendfile syscall (e.g. Windows " @@ -1728,27 +1757,27 @@ msgstr "" "當設置為 ``True`` 時,*fallback* 使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:1138 +#: ../../library/asyncio-eventloop.rst:1147 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support " "*sendfile* syscall and *fallback* is ``False``." msgstr "" -"如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,引發 :exc:" -"`SendfileNotAvailableError`。" +"如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,引" +"發 :exc:`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:1147 +#: ../../library/asyncio-eventloop.rst:1156 msgid "DNS" msgstr "DNS" -#: ../../library/asyncio-eventloop.rst:1152 +#: ../../library/asyncio-eventloop.rst:1161 msgid "Asynchronous version of :meth:`socket.getaddrinfo`." msgstr ":meth:`socket.getaddrinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1156 +#: ../../library/asyncio-eventloop.rst:1165 msgid "Asynchronous version of :meth:`socket.getnameinfo`." msgstr ":meth:`socket.getnameinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1159 +#: ../../library/asyncio-eventloop.rst:1168 msgid "" "Both *getaddrinfo* and *getnameinfo* internally utilize their synchronous " "versions through the loop's default thread pool executor. When this executor " @@ -1758,84 +1787,86 @@ msgid "" "executor with a larger number of workers." msgstr "" -#: ../../library/asyncio-eventloop.rst:1166 +#: ../../library/asyncio-eventloop.rst:1175 msgid "" "Both *getaddrinfo* and *getnameinfo* methods were always documented to " -"return a coroutine, but prior to Python 3.7 they were, in fact, returning :" -"class:`asyncio.Future` objects. Starting with Python 3.7 both methods are " -"coroutines." +"return a coroutine, but prior to Python 3.7 they were, in fact, " +"returning :class:`asyncio.Future` objects. Starting with Python 3.7 both " +"methods are coroutines." msgstr "" "*getaddrinfo* 和 *getnameinfo* 方法一直被記錄為回傳協程,但在 Python 3.7 之前" "它們實際上回傳 :class:`asyncio.Future` 物件。從 Python 3.7 開始,兩個方法都是" "協程。" -#: ../../library/asyncio-eventloop.rst:1174 +#: ../../library/asyncio-eventloop.rst:1183 msgid "Working with pipes" msgstr "使用管道" -#: ../../library/asyncio-eventloop.rst:1178 +#: ../../library/asyncio-eventloop.rst:1187 msgid "Register the read end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的讀取端。" -#: ../../library/asyncio-eventloop.rst:1183 +#: ../../library/asyncio-eventloop.rst:1192 msgid "*pipe* is a :term:`file-like object <file object>`." msgstr "*pipe* 是 :term:`類檔案物件 <file object>`。" -#: ../../library/asyncio-eventloop.rst:1185 +#: ../../library/asyncio-eventloop.rst:1194 msgid "" -"Return pair ``(transport, protocol)``, where *transport* supports the :class:" -"`ReadTransport` interface and *protocol* is an object instantiated by the " -"*protocol_factory*." +"Return pair ``(transport, protocol)``, where *transport* supports " +"the :class:`ReadTransport` interface and *protocol* is an object " +"instantiated by the *protocol_factory*." msgstr "" -"回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" -"`ReadTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" +"回傳 ``(transport, protocol)`` 對,其中 *transport* 支" +"援 :class:`ReadTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物" +"件。" -#: ../../library/asyncio-eventloop.rst:1189 -#: ../../library/asyncio-eventloop.rst:1205 +#: ../../library/asyncio-eventloop.rst:1198 +#: ../../library/asyncio-eventloop.rst:1214 msgid "" "With :class:`SelectorEventLoop` event loop, the *pipe* is set to non-" "blocking mode." msgstr "使用 :class:`SelectorEventLoop` 事件迴圈時,*pipe* 設置為非阻塞模式。" -#: ../../library/asyncio-eventloop.rst:1194 +#: ../../library/asyncio-eventloop.rst:1203 msgid "Register the write end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的寫入端。" -#: ../../library/asyncio-eventloop.rst:1199 +#: ../../library/asyncio-eventloop.rst:1208 msgid "*pipe* is :term:`file-like object <file object>`." msgstr "*pipe* 是 :term:`file-like object <file object>`。" -#: ../../library/asyncio-eventloop.rst:1201 +#: ../../library/asyncio-eventloop.rst:1210 msgid "" -"Return pair ``(transport, protocol)``, where *transport* supports :class:" -"`WriteTransport` interface and *protocol* is an object instantiated by the " -"*protocol_factory*." +"Return pair ``(transport, protocol)``, where *transport* " +"supports :class:`WriteTransport` interface and *protocol* is an object " +"instantiated by the *protocol_factory*." msgstr "" -"回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" -"`WriteTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" +"回傳 ``(transport, protocol)`` 對,其中 *transport* 支" +"援 :class:`WriteTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的" +"物件。" -#: ../../library/asyncio-eventloop.rst:1210 +#: ../../library/asyncio-eventloop.rst:1219 msgid "" ":class:`SelectorEventLoop` does not support the above methods on Windows. " "Use :class:`ProactorEventLoop` instead for Windows." msgstr "" -":class:`SelectorEventLoop` 在 Windows 上不支援上述方法。對於 Windows 請使用 :" -"class:`ProactorEventLoop`。" +":class:`SelectorEventLoop` 在 Windows 上不支援上述方法。對於 Windows 請使" +"用 :class:`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1215 +#: ../../library/asyncio-eventloop.rst:1224 msgid "" "The :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods." msgstr ":meth:`loop.subprocess_exec` 和 :meth:`loop.subprocess_shell` 方法。" -#: ../../library/asyncio-eventloop.rst:1220 +#: ../../library/asyncio-eventloop.rst:1229 msgid "Unix signals" msgstr "Unix 訊號" -#: ../../library/asyncio-eventloop.rst:1226 +#: ../../library/asyncio-eventloop.rst:1235 msgid "Set *callback* as the handler for the *signum* signal." msgstr "將 *callback* 設置為 *signum* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1228 +#: ../../library/asyncio-eventloop.rst:1237 msgid "" "The callback will be invoked by *loop*, along with other queued callbacks " "and runnable coroutines of that event loop. Unlike signal handlers " @@ -1846,7 +1877,7 @@ msgstr "" "用 :func:`signal.signal` 註冊的訊號處理程式不同,使用此函式註冊的回呼允許與事" "件迴圈進行互動。" -#: ../../library/asyncio-eventloop.rst:1233 +#: ../../library/asyncio-eventloop.rst:1242 msgid "" "Raise :exc:`ValueError` if the signal number is invalid or uncatchable. " "Raise :exc:`RuntimeError` if there is a problem setting up the handler." @@ -1854,16 +1885,16 @@ msgstr "" "如果訊號號無效或不可捕獲,引發 :exc:`ValueError`。如果設定處理程序有問題,拋" "出 :exc:`RuntimeError`。" -#: ../../library/asyncio-eventloop.rst:1239 +#: ../../library/asyncio-eventloop.rst:1248 msgid "" "Like :func:`signal.signal`, this function must be invoked in the main thread." msgstr "像 :func:`signal.signal` 一樣,此函式必須在主執行緒中呼叫。" -#: ../../library/asyncio-eventloop.rst:1244 +#: ../../library/asyncio-eventloop.rst:1253 msgid "Remove the handler for the *sig* signal." msgstr "移除 *sig* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1246 +#: ../../library/asyncio-eventloop.rst:1255 msgid "" "Return ``True`` if the signal handler was removed, or ``False`` if no " "handler was set for the given signal." @@ -1871,19 +1902,19 @@ msgstr "" "如果訊號處理程式被移除,回傳 ``True``;如果給定訊號沒有設置處理程式,回傳 " "``False``。" -#: ../../library/asyncio-eventloop.rst:1253 +#: ../../library/asyncio-eventloop.rst:1262 msgid "The :mod:`signal` module." msgstr ":mod:`signal` 模組。" -#: ../../library/asyncio-eventloop.rst:1257 +#: ../../library/asyncio-eventloop.rst:1266 msgid "Executing code in thread or process pools" msgstr "在執行緒池或行程池中執行程式碼" -#: ../../library/asyncio-eventloop.rst:1261 +#: ../../library/asyncio-eventloop.rst:1270 msgid "Arrange for *func* to be called in the specified executor." msgstr "安排在指定的執行器中呼叫 *func*。" -#: ../../library/asyncio-eventloop.rst:1263 +#: ../../library/asyncio-eventloop.rst:1272 msgid "" "The *executor* argument should be an :class:`concurrent.futures.Executor` " "instance. The default executor is used if *executor* is ``None``. The " @@ -1892,7 +1923,7 @@ msgid "" "and used by :func:`run_in_executor` if needed." msgstr "" -#: ../../library/asyncio-eventloop.rst:1271 +#: ../../library/asyncio-eventloop.rst:1280 msgid "" "import asyncio\n" "import concurrent.futures\n" @@ -1935,23 +1966,23 @@ msgid "" " asyncio.run(main())" msgstr "" -#: ../../library/asyncio-eventloop.rst:1311 +#: ../../library/asyncio-eventloop.rst:1320 msgid "" "Note that the entry point guard (``if __name__ == '__main__'``) is required " "for option 3 due to the peculiarities of :mod:`multiprocessing`, which is " "used by :class:`~concurrent.futures.ProcessPoolExecutor`. See :ref:`Safe " "importing of main module <multiprocessing-safe-main-import>`." msgstr "" -"請注意,由於 :mod:`multiprocessing`\\ (由 :class:`~concurrent.futures." -"ProcessPoolExecutor` 使用)的特殊性,選項 3 需要進入點保護(\\ ``if __name__ " -"== '__main__'``\\ )。請參閱\\ :ref:`主模組的安全引入 <multiprocessing-safe-" -"main-import>`。" +"請注意,由於 :mod:`multiprocessing`\\ " +"(由 :class:`~concurrent.futures.ProcessPoolExecutor` 使用)的特殊性,選項 3 " +"需要進入點保護(\\ ``if __name__ == '__main__'``\\ )。請參閱\\ :ref:`主模組" +"的安全引入 <multiprocessing-safe-main-import>`。" -#: ../../library/asyncio-eventloop.rst:1316 +#: ../../library/asyncio-eventloop.rst:1325 msgid "This method returns a :class:`asyncio.Future` object." msgstr "此方法回傳 :class:`asyncio.Future` 物件。" -#: ../../library/asyncio-eventloop.rst:1318 +#: ../../library/asyncio-eventloop.rst:1327 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments <asyncio-pass-" "keywords>` to *func*." @@ -1959,7 +1990,7 @@ msgstr "" "使用 :func:`functools.partial` 將來\\ :ref:`關鍵字引數傳遞 <asyncio-pass-" "keywords>`\\ 給 *func*。" -#: ../../library/asyncio-eventloop.rst:1321 +#: ../../library/asyncio-eventloop.rst:1330 msgid "" ":meth:`loop.run_in_executor` no longer configures the ``max_workers`` of the " "thread pool executor it creates, instead leaving it up to the thread pool " @@ -1967,38 +1998,38 @@ msgid "" "default." msgstr "" ":meth:`loop.run_in_executor` 不再配置它建立的執行緒池執行器的 " -"``max_workers``,而是讓執行緒池執行器(\\ :class:`~concurrent.futures." -"ThreadPoolExecutor`)設定預設值。" +"``max_workers``,而是讓執行緒池執行器" +"(\\ :class:`~concurrent.futures.ThreadPoolExecutor`)設定預設值。" -#: ../../library/asyncio-eventloop.rst:1330 +#: ../../library/asyncio-eventloop.rst:1339 msgid "" "Set *executor* as the default executor used by :meth:`run_in_executor`. " -"*executor* must be an instance of :class:`~concurrent.futures." -"ThreadPoolExecutor`." +"*executor* must be an instance " +"of :class:`~concurrent.futures.ThreadPoolExecutor`." msgstr "" "將 *executor* 設置為 :meth:`run_in_executor` 使用的預設執行器。*executor* 必" "須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1334 +#: ../../library/asyncio-eventloop.rst:1343 msgid "" -"*executor* must be an instance of :class:`~concurrent.futures." -"ThreadPoolExecutor`." +"*executor* must be an instance " +"of :class:`~concurrent.futures.ThreadPoolExecutor`." msgstr "" "*executor* 必須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1340 +#: ../../library/asyncio-eventloop.rst:1349 msgid "Error Handling API" msgstr "錯誤處理 API" -#: ../../library/asyncio-eventloop.rst:1342 +#: ../../library/asyncio-eventloop.rst:1351 msgid "Allows customizing how exceptions are handled in the event loop." msgstr "允許自定義事件迴圈中的例外處理方式。" -#: ../../library/asyncio-eventloop.rst:1346 +#: ../../library/asyncio-eventloop.rst:1355 msgid "Set *handler* as the new event loop exception handler." msgstr "將 *handler* 設定為新的事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1348 +#: ../../library/asyncio-eventloop.rst:1357 msgid "" "If *handler* is ``None``, the default exception handler will be set. " "Otherwise, *handler* must be a callable with the signature matching ``(loop, " @@ -2011,16 +2042,16 @@ msgstr "" "圈的,``context`` 是包含例外詳細資訊的 ``dict`` 物件(有關情境的詳細資訊,請" "參閱 :meth:`call_exception_handler` 文件)。" -#: ../../library/asyncio-eventloop.rst:1356 +#: ../../library/asyncio-eventloop.rst:1365 msgid "" -"If the handler is called on behalf of a :class:`~asyncio.Task` or :class:" -"`~asyncio.Handle`, it is run in the :class:`contextvars.Context` of that " -"task or callback handle." +"If the handler is called on behalf of a :class:`~asyncio.Task` " +"or :class:`~asyncio.Handle`, it is run in the :class:`contextvars.Context` " +"of that task or callback handle." msgstr "" "如果代表 :class:`~asyncio.Task` 或 :class:`~asyncio.Handle` 呼叫處理程式,它" "將在該任務或回呼處理程式的 :class:`contextvars.Context` 中運行。" -#: ../../library/asyncio-eventloop.rst:1362 +#: ../../library/asyncio-eventloop.rst:1371 msgid "" "The handler may be called in the :class:`~contextvars.Context` of the task " "or handle where the exception originated." @@ -2028,18 +2059,18 @@ msgstr "" "處理程式可能在引發例外的任務或處理程式的 :class:`~contextvars.Context` 中被呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1367 +#: ../../library/asyncio-eventloop.rst:1376 msgid "" "Return the current exception handler, or ``None`` if no custom exception " "handler was set." msgstr "" "回傳當前的例外處理程式,如果未設置自定義例外處理程式,則回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:1374 +#: ../../library/asyncio-eventloop.rst:1383 msgid "Default exception handler." msgstr "預設例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1376 +#: ../../library/asyncio-eventloop.rst:1385 msgid "" "This is called when an exception occurs and no exception handler is set. " "This can be called by a custom exception handler that wants to defer to the " @@ -2048,17 +2079,17 @@ msgstr "" "當發生例外且未設置例外處理程式時呼叫此函式。自定義例外處理程式可以呼叫此函式" "以轉由預設處理程式處理。" -#: ../../library/asyncio-eventloop.rst:1380 +#: ../../library/asyncio-eventloop.rst:1389 msgid "" -"*context* parameter has the same meaning as in :meth:" -"`call_exception_handler`." +"*context* parameter has the same meaning as " +"in :meth:`call_exception_handler`." msgstr "*context* 參數與 :meth:`call_exception_handler` 中的意思相同。" -#: ../../library/asyncio-eventloop.rst:1385 +#: ../../library/asyncio-eventloop.rst:1394 msgid "Call the current event loop exception handler." msgstr "呼叫當前事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1387 +#: ../../library/asyncio-eventloop.rst:1396 msgid "" "*context* is a ``dict`` object containing the following keys (new keys may " "be introduced in future Python versions):" @@ -2066,141 +2097,143 @@ msgstr "" "*context* 是一個包含以下鍵的 ``dict`` 物件(未來的 Python 版本中可能會引入新" "的鍵):" -#: ../../library/asyncio-eventloop.rst:1390 +#: ../../library/asyncio-eventloop.rst:1399 msgid "'message': Error message;" msgstr "'message':錯誤訊息;" -#: ../../library/asyncio-eventloop.rst:1391 +#: ../../library/asyncio-eventloop.rst:1400 msgid "'exception' (optional): Exception object;" msgstr "'exception'(可選):例外物件;" -#: ../../library/asyncio-eventloop.rst:1392 +#: ../../library/asyncio-eventloop.rst:1401 msgid "'future' (optional): :class:`asyncio.Future` instance;" msgstr "'future'(可選): :class:`asyncio.Future` 實例;" -#: ../../library/asyncio-eventloop.rst:1393 +#: ../../library/asyncio-eventloop.rst:1402 msgid "'task' (optional): :class:`asyncio.Task` instance;" msgstr "'task'(可選): :class:`asyncio.Task` 實例;" -#: ../../library/asyncio-eventloop.rst:1394 +#: ../../library/asyncio-eventloop.rst:1403 msgid "'handle' (optional): :class:`asyncio.Handle` instance;" msgstr "'handle'(可選): :class:`asyncio.Handle` 實例;" -#: ../../library/asyncio-eventloop.rst:1395 +#: ../../library/asyncio-eventloop.rst:1404 msgid "'protocol' (optional): :ref:`Protocol <asyncio-protocol>` instance;" msgstr "'protocol'(可選): :ref:`Protocol <asyncio-protocol>` 實例;" -#: ../../library/asyncio-eventloop.rst:1396 +#: ../../library/asyncio-eventloop.rst:1405 msgid "'transport' (optional): :ref:`Transport <asyncio-transport>` instance;" msgstr "'transport'(可選): :ref:`Transport <asyncio-transport>` 實例;" -#: ../../library/asyncio-eventloop.rst:1397 +#: ../../library/asyncio-eventloop.rst:1406 msgid "'socket' (optional): :class:`socket.socket` instance;" msgstr "'socket'(可選): :class:`socket.socket` 實例;" -#: ../../library/asyncio-eventloop.rst:1398 +#: ../../library/asyncio-eventloop.rst:1407 msgid "'asyncgen' (optional): Asynchronous generator that caused" msgstr "'asyncgen'(可選): 非同步產生器引發" -#: ../../library/asyncio-eventloop.rst:1399 +#: ../../library/asyncio-eventloop.rst:1408 msgid "the exception." msgstr "例外。" -#: ../../library/asyncio-eventloop.rst:1403 +#: ../../library/asyncio-eventloop.rst:1412 msgid "" "This method should not be overloaded in subclassed event loops. For custom " "exception handling, use the :meth:`set_exception_handler` method." msgstr "" -"此方法不應在子類別事件迴圈中被覆寫。為了自定義例外處理,請使用 :meth:" -"`set_exception_handler` 方法。" +"此方法不應在子類別事件迴圈中被覆寫。為了自定義例外處理,請使" +"用 :meth:`set_exception_handler` 方法。" -#: ../../library/asyncio-eventloop.rst:1408 +#: ../../library/asyncio-eventloop.rst:1417 msgid "Enabling debug mode" msgstr "啟用除錯模式" -#: ../../library/asyncio-eventloop.rst:1412 +#: ../../library/asyncio-eventloop.rst:1421 msgid "Get the debug mode (:class:`bool`) of the event loop." msgstr "取得事件迴圈的除錯模式(\\ :class:`bool`\\ )。" -#: ../../library/asyncio-eventloop.rst:1414 +#: ../../library/asyncio-eventloop.rst:1423 msgid "" -"The default value is ``True`` if the environment variable :envvar:" -"`PYTHONASYNCIODEBUG` is set to a non-empty string, ``False`` otherwise." +"The default value is ``True`` if the environment " +"variable :envvar:`PYTHONASYNCIODEBUG` is set to a non-empty string, " +"``False`` otherwise." msgstr "" "如果環境變數 :envvar:`PYTHONASYNCIODEBUG` 被設定為非空字串,則預設值為 " "``True``,否則為 ``False``。" -#: ../../library/asyncio-eventloop.rst:1420 +#: ../../library/asyncio-eventloop.rst:1429 msgid "Set the debug mode of the event loop." msgstr "設定事件迴圈的除錯模式。" -#: ../../library/asyncio-eventloop.rst:1424 +#: ../../library/asyncio-eventloop.rst:1433 msgid "" "The new :ref:`Python Development Mode <devmode>` can now also be used to " "enable the debug mode." msgstr "現在也可以使用新的 :ref:`Python 開發模式 <devmode>` 啟用除錯模式。" -#: ../../library/asyncio-eventloop.rst:1429 +#: ../../library/asyncio-eventloop.rst:1438 msgid "" "This attribute can be used to set the minimum execution duration in seconds " "that is considered \"slow\". When debug mode is enabled, \"slow\" callbacks " "are logged." msgstr "" -"此屬性可用於設定被視為\"慢\"的最短執行時間(以秒為單位)。啟用偵錯模式" -"後,\"慢\"回呼將被記錄。" +"此屬性可用於設定被視為\"慢\"的最短執行時間(以秒為單位)。啟用偵錯模式後," +"\"慢\"回呼將被記錄。" -#: ../../library/asyncio-eventloop.rst:1433 +#: ../../library/asyncio-eventloop.rst:1442 msgid "Default value is 100 milliseconds." msgstr "預設值為 100 毫秒" -#: ../../library/asyncio-eventloop.rst:1437 +#: ../../library/asyncio-eventloop.rst:1446 msgid "The :ref:`debug mode of asyncio <asyncio-debug-mode>`." msgstr ":ref:`asyncio 的除錯模式 <asyncio-debug-mode>`。" -#: ../../library/asyncio-eventloop.rst:1441 +#: ../../library/asyncio-eventloop.rst:1450 msgid "Running Subprocesses" msgstr "運行子行程" -#: ../../library/asyncio-eventloop.rst:1443 +#: ../../library/asyncio-eventloop.rst:1452 msgid "" "Methods described in this subsections are low-level. In regular async/await " "code consider using the high-level :func:`asyncio.create_subprocess_shell` " "and :func:`asyncio.create_subprocess_exec` convenience functions instead." msgstr "" -"本小節描述的方法是低階的。在常規的 async/await 程式碼中,請考慮使用高階 :" -"func:`asyncio.create_subprocess_shell` 和 :func:`asyncio." -"create_subprocess_exec` 輔助功能而不是。" +"本小節描述的方法是低階的。在常規的 async/await 程式碼中,請考慮使用高" +"階 :func:`asyncio.create_subprocess_shell` " +"和 :func:`asyncio.create_subprocess_exec` 輔助功能而不是。" -#: ../../library/asyncio-eventloop.rst:1450 +#: ../../library/asyncio-eventloop.rst:1459 msgid "" "On Windows, the default event loop :class:`ProactorEventLoop` supports " -"subprocesses, whereas :class:`SelectorEventLoop` does not. See :ref:" -"`Subprocess Support on Windows <asyncio-windows-subprocess>` for details." +"subprocesses, whereas :class:`SelectorEventLoop` does not. " +"See :ref:`Subprocess Support on Windows <asyncio-windows-subprocess>` for " +"details." msgstr "" -"在 Windows 上,預設事件迴圈 :class:`ProactorEventLoop` 支援子行程,而 :class:" -"`SelectorEventLoop` 不支援。詳細資訊請參見 :ref:`Windows 上對於子行程的支援 " -"<asyncio-windows-subprocess>`。" +"在 Windows 上,預設事件迴圈 :class:`ProactorEventLoop` 支援子行程," +"而 :class:`SelectorEventLoop` 不支援。詳細資訊請參見 :ref:`Windows 上對於子行" +"程的支援 <asyncio-windows-subprocess>`。" -#: ../../library/asyncio-eventloop.rst:1461 +#: ../../library/asyncio-eventloop.rst:1470 msgid "" "Create a subprocess from one or more string arguments specified by *args*." msgstr "從 *args* 指定的一個或多個字串引數建立子行程。" -#: ../../library/asyncio-eventloop.rst:1464 +#: ../../library/asyncio-eventloop.rst:1473 msgid "*args* must be a list of strings represented by:" msgstr "*args* 必須是由以下項表示的字串串列:" -#: ../../library/asyncio-eventloop.rst:1466 +#: ../../library/asyncio-eventloop.rst:1475 msgid ":class:`str`;" msgstr ":class:`str`;" -#: ../../library/asyncio-eventloop.rst:1467 +#: ../../library/asyncio-eventloop.rst:1476 msgid "" "or :class:`bytes`, encoded to the :ref:`filesystem encoding <filesystem-" "encoding>`." msgstr "或 :class:`bytes`,編碼為 :ref:`檔案系統編碼 <filesystem-encoding>`。" -#: ../../library/asyncio-eventloop.rst:1470 +#: ../../library/asyncio-eventloop.rst:1479 msgid "" "The first string specifies the program executable, and the remaining strings " "specify the arguments. Together, string arguments form the ``argv`` of the " @@ -2209,7 +2242,7 @@ msgstr "" "第一個字串指定程序可執行檔案,其餘字串指定引數。字串引數一起組成程序的 " "``argv``。" -#: ../../library/asyncio-eventloop.rst:1474 +#: ../../library/asyncio-eventloop.rst:1483 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=False`` and the list of strings passed as the first " @@ -2220,75 +2253,75 @@ msgstr "" "字串串列作為第一個引數傳遞;然而,:class:`~subprocess.Popen` 接受單個字串串列" "引數,*subprocess_exec* 接受多個字串引數。" -#: ../../library/asyncio-eventloop.rst:1480 +#: ../../library/asyncio-eventloop.rst:1489 msgid "" -"The *protocol_factory* must be a callable returning a subclass of the :class:" -"`asyncio.SubprocessProtocol` class." +"The *protocol_factory* must be a callable returning a subclass of " +"the :class:`asyncio.SubprocessProtocol` class." msgstr "" "*protocol_factory* 必須是回傳 :class:`asyncio.SubprocessProtocol` 子類別的可" "呼叫物件。" -#: ../../library/asyncio-eventloop.rst:1483 +#: ../../library/asyncio-eventloop.rst:1492 msgid "Other parameters:" msgstr "其他參數:" -#: ../../library/asyncio-eventloop.rst:1485 +#: ../../library/asyncio-eventloop.rst:1494 msgid "*stdin* can be any of these:" msgstr "*stdin* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1487 -#: ../../library/asyncio-eventloop.rst:1498 -#: ../../library/asyncio-eventloop.rst:1508 +#: ../../library/asyncio-eventloop.rst:1496 +#: ../../library/asyncio-eventloop.rst:1507 +#: ../../library/asyncio-eventloop.rst:1517 msgid "a file-like object" msgstr "類檔案物件" -#: ../../library/asyncio-eventloop.rst:1488 +#: ../../library/asyncio-eventloop.rst:1497 msgid "" "an existing file descriptor (a positive integer), for example those created " "with :meth:`os.pipe`" msgstr "現有的檔案描述器(正整數),例如用 :meth:`os.pipe` 建立的" -#: ../../library/asyncio-eventloop.rst:1489 -#: ../../library/asyncio-eventloop.rst:1499 -#: ../../library/asyncio-eventloop.rst:1509 +#: ../../library/asyncio-eventloop.rst:1498 +#: ../../library/asyncio-eventloop.rst:1508 +#: ../../library/asyncio-eventloop.rst:1518 msgid "" "the :const:`subprocess.PIPE` constant (default) which will create a new pipe " "and connect it," msgstr ":const:`subprocess.PIPE` 常數(預設),它將建立一個新的管道並連線," -#: ../../library/asyncio-eventloop.rst:1491 -#: ../../library/asyncio-eventloop.rst:1501 -#: ../../library/asyncio-eventloop.rst:1511 +#: ../../library/asyncio-eventloop.rst:1500 +#: ../../library/asyncio-eventloop.rst:1510 +#: ../../library/asyncio-eventloop.rst:1520 msgid "" "the value ``None`` which will make the subprocess inherit the file " "descriptor from this process" msgstr "值 ``None`` 將使子行程從此行程繼承檔案描述器" -#: ../../library/asyncio-eventloop.rst:1493 -#: ../../library/asyncio-eventloop.rst:1503 -#: ../../library/asyncio-eventloop.rst:1513 +#: ../../library/asyncio-eventloop.rst:1502 +#: ../../library/asyncio-eventloop.rst:1512 +#: ../../library/asyncio-eventloop.rst:1522 msgid "" -"the :const:`subprocess.DEVNULL` constant which indicates that the special :" -"data:`os.devnull` file will be used" +"the :const:`subprocess.DEVNULL` constant which indicates that the " +"special :data:`os.devnull` file will be used" msgstr "" ":const:`subprocess.DEVNULL` 常數,表示將使用特殊的 :data:`os.devnull` 檔案" -#: ../../library/asyncio-eventloop.rst:1496 +#: ../../library/asyncio-eventloop.rst:1505 msgid "*stdout* can be any of these:" msgstr "*stdout* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1506 +#: ../../library/asyncio-eventloop.rst:1515 msgid "*stderr* can be any of these:" msgstr "*stderr* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1515 +#: ../../library/asyncio-eventloop.rst:1524 msgid "" "the :const:`subprocess.STDOUT` constant which will connect the standard " "error stream to the process' standard output stream" msgstr "" ":const:`subprocess.STDOUT` 常數,它將標準錯誤串流連線到行程的標準輸出串流" -#: ../../library/asyncio-eventloop.rst:1518 +#: ../../library/asyncio-eventloop.rst:1527 msgid "" "All other keyword arguments are passed to :class:`subprocess.Popen` without " "interpretation, except for *bufsize*, *universal_newlines*, *shell*, *text*, " @@ -2298,7 +2331,7 @@ msgstr "" "*bufsize*、*universal_newlines*、*shell*、*text*、*encoding* 和 *errors* 除" "外,這些不應該指定。" -#: ../../library/asyncio-eventloop.rst:1523 +#: ../../library/asyncio-eventloop.rst:1532 msgid "" "The ``asyncio`` subprocess API does not support decoding the streams as " "text. :func:`bytes.decode` can be used to convert the bytes returned from " @@ -2307,43 +2340,43 @@ msgstr "" "``asyncio`` 子行程 API 不支援將串流解碼為文本。可以使用 :func:`bytes.decode` " "將從串流回傳的位元組轉換為文本。" -#: ../../library/asyncio-eventloop.rst:1527 +#: ../../library/asyncio-eventloop.rst:1536 msgid "" "If a file-like object passed as *stdin*, *stdout* or *stderr* represents a " -"pipe, then the other side of this pipe should be registered with :meth:" -"`~loop.connect_write_pipe` or :meth:`~loop.connect_read_pipe` for use with " -"the event loop." +"pipe, then the other side of this pipe should be registered " +"with :meth:`~loop.connect_write_pipe` or :meth:`~loop.connect_read_pipe` for " +"use with the event loop." msgstr "" "如果傳遞給 *stdin*、*stdout* 或 *stderr* 的類檔案物件表示管道,則該管道的另一" -"端應該使用 :meth:`~loop.connect_write_pipe` 或 :meth:`~loop." -"connect_read_pipe` 註冊到事件迴圈中。" +"端應該使用 :meth:`~loop.connect_write_pipe` " +"或 :meth:`~loop.connect_read_pipe` 註冊到事件迴圈中。" -#: ../../library/asyncio-eventloop.rst:1532 +#: ../../library/asyncio-eventloop.rst:1541 msgid "" "See the constructor of the :class:`subprocess.Popen` class for documentation " "on other arguments." msgstr "有關其他引數的文件,請參閱 :class:`subprocess.Popen` 類別的建構函式。" -#: ../../library/asyncio-eventloop.rst:1535 +#: ../../library/asyncio-eventloop.rst:1544 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`asyncio.SubprocessTransport` base class and *protocol* is an " "object instantiated by the *protocol_factory*." msgstr "" -"回傳 ``(transport, protocol)`` 對,其中 *transport* 符合 :class:`asyncio." -"SubprocessTransport` 基底類別,*protocol* 是由 *protocol_factory* 實例化的物" -"件。" +"回傳 ``(transport, protocol)`` 對,其中 *transport* 符" +"合 :class:`asyncio.SubprocessTransport` 基底類別,*protocol* 是由 " +"*protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1543 +#: ../../library/asyncio-eventloop.rst:1552 msgid "" -"Create a subprocess from *cmd*, which can be a :class:`str` or a :class:" -"`bytes` string encoded to the :ref:`filesystem encoding <filesystem-" +"Create a subprocess from *cmd*, which can be a :class:`str` or " +"a :class:`bytes` string encoded to the :ref:`filesystem encoding <filesystem-" "encoding>`, using the platform's \"shell\" syntax." msgstr "" "使用平台的 “shell” 語法從 *cmd* 建立子行程,*cmd* 可以是 :class:`str` 或編碼" "為 :ref:`檔案系統編碼 <filesystem-encoding>` 的 :class:`bytes` 字串。" -#: ../../library/asyncio-eventloop.rst:1548 +#: ../../library/asyncio-eventloop.rst:1557 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=True``." @@ -2351,31 +2384,31 @@ msgstr "" "這類似於標準函式庫中的 :class:`subprocess.Popen` 類別,使用 ``shell=True`` 呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1551 +#: ../../library/asyncio-eventloop.rst:1560 msgid "" -"The *protocol_factory* must be a callable returning a subclass of the :class:" -"`SubprocessProtocol` class." +"The *protocol_factory* must be a callable returning a subclass of " +"the :class:`SubprocessProtocol` class." msgstr "" "*protocol_factory* 必須是回傳 :class:`SubprocessProtocol` 子類別的可呼叫物" "件。" -#: ../../library/asyncio-eventloop.rst:1554 +#: ../../library/asyncio-eventloop.rst:1563 msgid "" "See :meth:`~loop.subprocess_exec` for more details about the remaining " "arguments." msgstr "有關其餘引數的更多詳細資訊,請參閱 :meth:`~loop.subprocess_exec`。" -#: ../../library/asyncio-eventloop.rst:1557 +#: ../../library/asyncio-eventloop.rst:1566 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`SubprocessTransport` base class and *protocol* is an object " "instantiated by the *protocol_factory*." msgstr "" -"回傳一對 ``(transport, protocol)``,其中 *transport* 符合 :class:" -"`SubprocessTransport` 基底類別,而 *protocol* 是由 *protocol_factory* 實例化" -"的物件。" +"回傳一對 ``(transport, protocol)``,其中 *transport* 符" +"合 :class:`SubprocessTransport` 基底類別,而 *protocol* 是由 " +"*protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1562 +#: ../../library/asyncio-eventloop.rst:1571 msgid "" "It is the application's responsibility to ensure that all whitespace and " "special characters are quoted appropriately to avoid `shell injection " @@ -2384,76 +2417,77 @@ msgid "" "escape whitespace and special characters in strings that are going to be " "used to construct shell commands." msgstr "" -"由應用程式負責確保適當引用所有空白和特殊字元,以避免 `shell 注入 <https://en." -"wikipedia.org/wiki/Shell_injection#Shell_injection>`_\\ 風險。可以使用 :func:" -"`shlex.quote` 函式來正確跳脫用於構建 shell 命令的字串中的空白和特殊字元。" +"由應用程式負責確保適當引用所有空白和特殊字元,以避免 `shell 注入 <https://" +"en.wikipedia.org/wiki/Shell_injection#Shell_injection>`_\\ 風險。可以使" +"用 :func:`shlex.quote` 函式來正確跳脫用於構建 shell 命令的字串中的空白和特殊" +"字元。" -#: ../../library/asyncio-eventloop.rst:1571 +#: ../../library/asyncio-eventloop.rst:1580 msgid "Callback Handles" msgstr "回呼處理" -#: ../../library/asyncio-eventloop.rst:1575 +#: ../../library/asyncio-eventloop.rst:1584 msgid "" -"A callback wrapper object returned by :meth:`loop.call_soon`, :meth:`loop." -"call_soon_threadsafe`." +"A callback wrapper object returned " +"by :meth:`loop.call_soon`, :meth:`loop.call_soon_threadsafe`." msgstr "" "由 :meth:`loop.call_soon` 和 :meth:`loop.call_soon_threadsafe` 回傳的回呼包裝" "器。" -#: ../../library/asyncio-eventloop.rst:1580 +#: ../../library/asyncio-eventloop.rst:1589 msgid "" "Return the :class:`contextvars.Context` object associated with the handle." msgstr "回傳與處理相關聯的 :class:`contextvars.Context` 物件。" -#: ../../library/asyncio-eventloop.rst:1587 +#: ../../library/asyncio-eventloop.rst:1596 msgid "" "Cancel the callback. If the callback has already been canceled or executed, " "this method has no effect." msgstr "取消回呼。如果回呼已被取消或執行,此方法將不起作用。" -#: ../../library/asyncio-eventloop.rst:1592 +#: ../../library/asyncio-eventloop.rst:1601 msgid "Return ``True`` if the callback was cancelled." msgstr "如果回呼已被取消,回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1598 +#: ../../library/asyncio-eventloop.rst:1607 msgid "" -"A callback wrapper object returned by :meth:`loop.call_later`, and :meth:" -"`loop.call_at`." +"A callback wrapper object returned by :meth:`loop.call_later`, " +"and :meth:`loop.call_at`." msgstr "由 :meth:`loop.call_later` 和 :meth:`loop.call_at` 回傳的回呼包裝器。" -#: ../../library/asyncio-eventloop.rst:1601 +#: ../../library/asyncio-eventloop.rst:1610 msgid "This class is a subclass of :class:`Handle`." msgstr "這個類別是 :class:`Handle` 的子類別。" -#: ../../library/asyncio-eventloop.rst:1605 +#: ../../library/asyncio-eventloop.rst:1614 msgid "Return a scheduled callback time as :class:`float` seconds." msgstr "回傳預定的回呼時間,以 :class:`float` 秒為單位。" -#: ../../library/asyncio-eventloop.rst:1607 +#: ../../library/asyncio-eventloop.rst:1616 msgid "" -"The time is an absolute timestamp, using the same time reference as :meth:" -"`loop.time`." +"The time is an absolute timestamp, using the same time reference " +"as :meth:`loop.time`." msgstr "時間是一個絕對的時間戳,使用與 :meth:`loop.time` 相同的時間參照。" -#: ../../library/asyncio-eventloop.rst:1614 +#: ../../library/asyncio-eventloop.rst:1623 msgid "Server Objects" msgstr "Server 物件" -#: ../../library/asyncio-eventloop.rst:1616 +#: ../../library/asyncio-eventloop.rst:1625 msgid "" -"Server objects are created by :meth:`loop.create_server`, :meth:`loop." -"create_unix_server`, :func:`start_server`, and :func:`start_unix_server` " -"functions." +"Server objects are created " +"by :meth:`loop.create_server`, :meth:`loop.create_unix_server`, :func:`start_server`, " +"and :func:`start_unix_server` functions." msgstr "" -"Server 物件是由 :meth:`loop.create_server`、:meth:`loop." -"create_unix_server`、:func:`start_server` 和 :func:`start_unix_server` 函式所" -"建立。" +"Server 物件是" +"由 :meth:`loop.create_server`、:meth:`loop.create_unix_server`、:func:`start_server` " +"和 :func:`start_unix_server` 函式所建立。" -#: ../../library/asyncio-eventloop.rst:1620 +#: ../../library/asyncio-eventloop.rst:1629 msgid "Do not instantiate the :class:`Server` class directly." msgstr "請勿直接實例化 :class:`Server` 類別。" -#: ../../library/asyncio-eventloop.rst:1624 +#: ../../library/asyncio-eventloop.rst:1633 msgid "" "*Server* objects are asynchronous context managers. When used in an ``async " "with`` statement, it's guaranteed that the Server object is closed and not " @@ -2462,7 +2496,7 @@ msgstr "" "*Server* 物件是非同步情境管理器。當在 ``async with`` 陳述中使用時,可以保證在" "完成 ``async with`` 陳述時,Server 物件將會關閉並停止接受新的連線: ::" -#: ../../library/asyncio-eventloop.rst:1629 +#: ../../library/asyncio-eventloop.rst:1638 msgid "" "srv = await loop.create_server(...)\n" "\n" @@ -2471,31 +2505,37 @@ msgid "" "\n" "# At this point, srv is closed and no longer accepts new connections." msgstr "" +"srv = await loop.create_server(...)\n" +"\n" +"async with srv:\n" +" # 一些程式碼\n" +"\n" +"# 此時 srv 已關閉,不再接受新的連線。" -#: ../../library/asyncio-eventloop.rst:1637 +#: ../../library/asyncio-eventloop.rst:1646 msgid "Server object is an asynchronous context manager since Python 3.7." msgstr "自 Python 3.7 起,Server 物件是非同步情境管理器。" -#: ../../library/asyncio-eventloop.rst:1640 +#: ../../library/asyncio-eventloop.rst:1649 msgid "" "This class was exposed publicly as ``asyncio.Server`` in Python 3.9.11, " "3.10.3 and 3.11." msgstr "" "此類別在 Python 3.9.11、3.10.3 和 3.11 中以 ``asyncio.Server`` 的形式被公開。" -#: ../../library/asyncio-eventloop.rst:1645 +#: ../../library/asyncio-eventloop.rst:1654 msgid "" "Stop serving: close listening sockets and set the :attr:`sockets` attribute " "to ``None``." msgstr "停止服務:關閉監聽的 sockets 並將 :attr:`sockets` 屬性設為 ``None``。" -#: ../../library/asyncio-eventloop.rst:1648 +#: ../../library/asyncio-eventloop.rst:1657 msgid "" "The sockets that represent existing incoming client connections are left " "open." msgstr "代表現有傳入用戶端連線的 sockets 仍然保持開啟。" -#: ../../library/asyncio-eventloop.rst:1651 +#: ../../library/asyncio-eventloop.rst:1660 msgid "" "The server is closed asynchronously; use the :meth:`wait_closed` coroutine " "to wait until the server is closed (and no more connections are active)." @@ -2503,53 +2543,53 @@ msgstr "" "伺服器以非同步方式關閉;使用 :meth:`wait_close` 協程等待伺服器關閉(不再有活" "躍連線)。" -#: ../../library/asyncio-eventloop.rst:1657 +#: ../../library/asyncio-eventloop.rst:1666 msgid "Close all existing incoming client connections." msgstr "關閉所有現有的傳入客戶端連線。" -#: ../../library/asyncio-eventloop.rst:1659 +#: ../../library/asyncio-eventloop.rst:1668 msgid "" "Calls :meth:`~asyncio.BaseTransport.close` on all associated transports." -msgstr "" +msgstr "在所有關聯的傳輸上呼叫 :meth:`~asyncio.BaseTransport.close`。" -#: ../../library/asyncio-eventloop.rst:1662 +#: ../../library/asyncio-eventloop.rst:1671 msgid "" ":meth:`close` should be called before :meth:`close_clients` when closing the " "server to avoid races with new clients connecting." msgstr "" -#: ../../library/asyncio-eventloop.rst:1669 +#: ../../library/asyncio-eventloop.rst:1678 msgid "" "Close all existing incoming client connections immediately, without waiting " "for pending operations to complete." -msgstr "" +msgstr "立即關閉所有現有的傳入客戶端連線,而不等待待定操作完成。" -#: ../../library/asyncio-eventloop.rst:1672 +#: ../../library/asyncio-eventloop.rst:1681 msgid "" "Calls :meth:`~asyncio.WriteTransport.abort` on all associated transports." -msgstr "" +msgstr "在所有關聯的傳輸上呼叫 :meth:`~asyncio.BaseTransport.close`。" -#: ../../library/asyncio-eventloop.rst:1675 +#: ../../library/asyncio-eventloop.rst:1684 msgid "" ":meth:`close` should be called before :meth:`abort_clients` when closing the " "server to avoid races with new clients connecting." msgstr "" -#: ../../library/asyncio-eventloop.rst:1682 +#: ../../library/asyncio-eventloop.rst:1691 msgid "Return the event loop associated with the server object." msgstr "回傳與伺服器物件關聯的事件迴圈。" -#: ../../library/asyncio-eventloop.rst:1688 +#: ../../library/asyncio-eventloop.rst:1697 msgid "Start accepting connections." msgstr "開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1690 +#: ../../library/asyncio-eventloop.rst:1699 msgid "" "This method is idempotent, so it can be called when the server is already " "serving." msgstr "此方法是幂等的,因此可以在伺服器已經運行時呼叫。" -#: ../../library/asyncio-eventloop.rst:1693 +#: ../../library/asyncio-eventloop.rst:1702 msgid "" "The *start_serving* keyword-only parameter to :meth:`loop.create_server` " "and :meth:`asyncio.start_server` allows creating a Server object that is not " @@ -2557,19 +2597,19 @@ msgid "" "or :meth:`Server.serve_forever` can be used to make the Server start " "accepting connections." msgstr "" -"*start_serving* 僅限關鍵字參數只能在 :meth:`loop.create_server` 和 :meth:" -"`asyncio.start_server` 中使用,允許建立一個最初不接受連線的 Server 物件。在這" -"種情況下,可以使用 ``Server.start_serving()`` 或 :meth:`Server." -"serve_forever` 來使 Server 開始接受連線。" +"*start_serving* 僅限關鍵字參數只能在 :meth:`loop.create_server` " +"和 :meth:`asyncio.start_server` 中使用,允許建立一個最初不接受連線的 Server " +"物件。在這種情況下,可以使用 ``Server.start_serving()`` " +"或 :meth:`Server.serve_forever` 來使 Server 開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1704 +#: ../../library/asyncio-eventloop.rst:1713 msgid "" "Start accepting connections until the coroutine is cancelled. Cancellation " "of ``serve_forever`` task causes the server to be closed." msgstr "" "開始接受連線,直到協程被取消。取消 ``serve_forever`` 任務會導致伺服器關閉。" -#: ../../library/asyncio-eventloop.rst:1708 +#: ../../library/asyncio-eventloop.rst:1717 msgid "" "This method can be called if the server is already accepting connections. " "Only one ``serve_forever`` task can exist per one *Server* object." @@ -2577,7 +2617,7 @@ msgstr "" "如果伺服器已經接受連線,則可以呼叫此方法。每個 *Server* 物件只能存在一個 " "``serve_forever`` 任務。" -#: ../../library/asyncio-eventloop.rst:1714 +#: ../../library/asyncio-eventloop.rst:1723 msgid "" "async def client_connected(reader, writer):\n" " # Communicate with the client with\n" @@ -2591,25 +2631,36 @@ msgid "" "\n" "asyncio.run(main('127.0.0.1', 0))" msgstr "" +"async def client_connected(reader, writer):\n" +" # 透過讀取器/寫入器串流\n" +" # 與客戶端溝通。例如:\n" +" await reader.readline()\n" +"\n" +"async def main(host, port):\n" +" srv = await asyncio.start_server(\n" +" client_connected, host, port)\n" +" await srv.serve_forever()\n" +"\n" +"asyncio.run(main('127.0.0.1', 0))" -#: ../../library/asyncio-eventloop.rst:1730 +#: ../../library/asyncio-eventloop.rst:1739 msgid "Return ``True`` if the server is accepting new connections." msgstr "如果伺服器正在接受新連線,則回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1736 +#: ../../library/asyncio-eventloop.rst:1745 msgid "" "Wait until the :meth:`close` method completes and all active connections " "have finished." msgstr "等待 :meth:`close` 方法完成且所有活動連線都已結束。" -#: ../../library/asyncio-eventloop.rst:1741 +#: ../../library/asyncio-eventloop.rst:1750 msgid "" "List of socket-like objects, ``asyncio.trsock.TransportSocket``, which the " "server is listening on." msgstr "" "伺服器正在監聽的類似 socket 的物件串列,``asyncio.trsock.TransportSocket``。" -#: ../../library/asyncio-eventloop.rst:1744 +#: ../../library/asyncio-eventloop.rst:1753 msgid "" "Prior to Python 3.7 ``Server.sockets`` used to return an internal list of " "server sockets directly. In 3.7 a copy of that list is returned." @@ -2617,29 +2668,29 @@ msgstr "" "在 Python 3.7 之前,``Server.sockets`` 曾經直接回傳內部伺服器 sockets 的串" "列。在 3.7 中回傳了該串列的副本。" -#: ../../library/asyncio-eventloop.rst:1754 +#: ../../library/asyncio-eventloop.rst:1763 msgid "Event Loop Implementations" msgstr "事件迴圈實作" -#: ../../library/asyncio-eventloop.rst:1756 +#: ../../library/asyncio-eventloop.rst:1765 msgid "" -"asyncio ships with two different event loop implementations: :class:" -"`SelectorEventLoop` and :class:`ProactorEventLoop`." +"asyncio ships with two different event loop " +"implementations: :class:`SelectorEventLoop` and :class:`ProactorEventLoop`." msgstr "" -"asyncio 內附兩個不同的事件迴圈實作::class:`SelectorEventLoop` 和 :class:" -"`ProactorEventLoop`。" +"asyncio 內附兩個不同的事件迴圈實作::class:`SelectorEventLoop` " +"和 :class:`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1759 +#: ../../library/asyncio-eventloop.rst:1768 msgid "By default asyncio is configured to use :class:`EventLoop`." msgstr "預設情況下,asyncio 被配置為要使用 :class:`EventLoop`。" -#: ../../library/asyncio-eventloop.rst:1764 +#: ../../library/asyncio-eventloop.rst:1773 msgid "" "A subclass of :class:`AbstractEventLoop` based on the :mod:`selectors` " "module." msgstr "基於 :mod:`selectors` 模組的一個 :class:`AbstractEventLoop` 子類別。" -#: ../../library/asyncio-eventloop.rst:1767 +#: ../../library/asyncio-eventloop.rst:1776 msgid "" "Uses the most efficient *selector* available for the given platform. It is " "also possible to manually configure the exact selector implementation to be " @@ -2648,7 +2699,7 @@ msgstr "" "使用特定平台上最有效的 *selector*。也可以手動配置要使用的確切 selector 實" "作: ::" -#: ../../library/asyncio-eventloop.rst:1771 +#: ../../library/asyncio-eventloop.rst:1780 msgid "" "import asyncio\n" "import selectors\n" @@ -2670,7 +2721,7 @@ msgstr "" "\n" "asyncio.set_event_loop_policy(MyPolicy())" -#: ../../library/asyncio-eventloop.rst:1787 +#: ../../library/asyncio-eventloop.rst:1796 msgid "" "A subclass of :class:`AbstractEventLoop` for Windows that uses \"I/O " "Completion Ports\" (IOCP)." @@ -2678,7 +2729,7 @@ msgstr "" "用於 Windows 的 :class:`AbstractEventLoop` 子類別,使用「I/O 完成埠 (IOCP, I/" "O Completion Ports)」。" -#: ../../library/asyncio-eventloop.rst:1793 +#: ../../library/asyncio-eventloop.rst:1802 msgid "" "`MSDN documentation on I/O Completion Ports <https://learn.microsoft.com/" "windows/win32/fileio/i-o-completion-ports>`_." @@ -2686,25 +2737,25 @@ msgstr "" "`I/O 完成埠的 MSDN 文件 <https://learn.microsoft.com/windows/win32/fileio/i-" "o-completion-ports>`_。" -#: ../../library/asyncio-eventloop.rst:1798 +#: ../../library/asyncio-eventloop.rst:1807 msgid "" -"An alias to the most efficient available subclass of :class:" -"`AbstractEventLoop` for the given platform." +"An alias to the most efficient available subclass " +"of :class:`AbstractEventLoop` for the given platform." msgstr "" -#: ../../library/asyncio-eventloop.rst:1801 +#: ../../library/asyncio-eventloop.rst:1810 msgid "" -"It is an alias to :class:`SelectorEventLoop` on Unix and :class:" -"`ProactorEventLoop` on Windows." +"It is an alias to :class:`SelectorEventLoop` on Unix " +"and :class:`ProactorEventLoop` on Windows." msgstr "" -"在 Unix 上是 :class:`SelectorEventLoop` 的別名,在 Windows 上是 :class:" -"`ProactorEventLoop` 的別名。" +"在 Unix 上是 :class:`SelectorEventLoop` 的別名,在 Windows 上" +"是 :class:`ProactorEventLoop` 的別名。" -#: ../../library/asyncio-eventloop.rst:1807 +#: ../../library/asyncio-eventloop.rst:1816 msgid "Abstract base class for asyncio-compliant event loops." msgstr "為符合 asyncio 標準的事件迴圈的抽象基礎類別。" -#: ../../library/asyncio-eventloop.rst:1809 +#: ../../library/asyncio-eventloop.rst:1818 msgid "" "The :ref:`asyncio-event-loop-methods` section lists all methods that an " "alternative implementation of ``AbstractEventLoop`` should have defined." @@ -2712,26 +2763,27 @@ msgstr "" ":ref:`asyncio-event-loop-methods` 部分列出了替代 ``AbstractEventLoop`` 實作應" "該定義的所有方法。" -#: ../../library/asyncio-eventloop.rst:1815 +#: ../../library/asyncio-eventloop.rst:1824 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-eventloop.rst:1817 +#: ../../library/asyncio-eventloop.rst:1826 msgid "" "Note that all examples in this section **purposefully** show how to use the " -"low-level event loop APIs, such as :meth:`loop.run_forever` and :meth:`loop." -"call_soon`. Modern asyncio applications rarely need to be written this way; " -"consider using the high-level functions like :func:`asyncio.run`." +"low-level event loop APIs, such as :meth:`loop.run_forever` " +"and :meth:`loop.call_soon`. Modern asyncio applications rarely need to be " +"written this way; consider using the high-level functions " +"like :func:`asyncio.run`." msgstr "" -"請注意,本節中的所有範例都 **故意** 展示如何使用低階事件迴圈 API,如 :meth:" -"`loop.run_forever` 和 :meth:`loop.call_soon`。現代 asyncio 應用程式很少需要這" -"種方式撰寫;請考慮使用高階的函式,如 :func:`asyncio.run`。" +"請注意,本節中的所有範例都 **故意** 展示如何使用低階事件迴圈 API," +"如 :meth:`loop.run_forever` 和 :meth:`loop.call_soon`。現代 asyncio 應用程式" +"很少需要這種方式撰寫;請考慮使用高階的函式,如 :func:`asyncio.run`。" -#: ../../library/asyncio-eventloop.rst:1827 +#: ../../library/asyncio-eventloop.rst:1836 msgid "Hello World with call_soon()" msgstr "使用 call_soon() 的 Hello World 範例" -#: ../../library/asyncio-eventloop.rst:1829 +#: ../../library/asyncio-eventloop.rst:1838 msgid "" "An example using the :meth:`loop.call_soon` method to schedule a callback. " "The callback displays ``\"Hello World\"`` and then stops the event loop::" @@ -2739,7 +2791,7 @@ msgstr "" "使用 :meth:`loop.call_soon` 方法排程回呼的範例。回呼會顯示 ``\"Hello " "World\"``,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1833 +#: ../../library/asyncio-eventloop.rst:1842 msgid "" "import asyncio\n" "\n" @@ -2759,19 +2811,36 @@ msgid "" "finally:\n" " loop.close()" msgstr "" +"import asyncio\n" +"\n" +"def hello_world(loop):\n" +" \"\"\"列印 'Hello World' 並停止事件迴圈的回呼\"\"\"\n" +" print('Hello World')\n" +" loop.stop()\n" +"\n" +"loop = asyncio.new_event_loop()\n" +"\n" +"# 排程對 hello_world() 的呼叫\n" +"loop.call_soon(hello_world, loop)\n" +"\n" +"# 阻塞呼叫被 loop.stop() 中斷\n" +"try:\n" +" loop.run_forever()\n" +"finally:\n" +" loop.close()" -#: ../../library/asyncio-eventloop.rst:1853 +#: ../../library/asyncio-eventloop.rst:1862 msgid "" "A similar :ref:`Hello World <coroutine>` example created with a coroutine " "and the :func:`run` function." msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`Hello World <coroutine>` 範例。" -#: ../../library/asyncio-eventloop.rst:1860 +#: ../../library/asyncio-eventloop.rst:1869 msgid "Display the current date with call_later()" msgstr "使用 call_later() 顯示目前日期" -#: ../../library/asyncio-eventloop.rst:1862 +#: ../../library/asyncio-eventloop.rst:1871 msgid "" "An example of a callback displaying the current date every second. The " "callback uses the :meth:`loop.call_later` method to reschedule itself after " @@ -2780,7 +2849,7 @@ msgstr "" "一個回呼的範例,每秒顯示目前日期。回呼使用 :meth:`loop.call_later` 方法在 5 " "秒後重新排程自己,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1866 +#: ../../library/asyncio-eventloop.rst:1875 msgid "" "import asyncio\n" "import datetime\n" @@ -2804,8 +2873,29 @@ msgid "" "finally:\n" " loop.close()" msgstr "" +"import asyncio\n" +"import datetime\n" +"\n" +"def display_date(end_time, loop):\n" +" print(datetime.datetime.now())\n" +" if (loop.time() + 1.0) < end_time:\n" +" loop.call_later(1, display_date, end_time, loop)\n" +" else:\n" +" loop.stop()\n" +"\n" +"loop = asyncio.new_event_loop()\n" +"\n" +"# 排程 display_date() 的第一次呼叫\n" +"end_time = loop.time() + 5.0\n" +"loop.call_soon(display_date, end_time, loop)\n" +"\n" +"# 阻塞呼叫被 loop.stop() 中斷\n" +"try:\n" +" loop.run_forever()\n" +"finally:\n" +" loop.close()" -#: ../../library/asyncio-eventloop.rst:1890 +#: ../../library/asyncio-eventloop.rst:1899 msgid "" "A similar :ref:`current date <asyncio_example_sleep>` example created with a " "coroutine and the :func:`run` function." @@ -2813,19 +2903,19 @@ msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`current date " "<asyncio_example_sleep>` 範例。" -#: ../../library/asyncio-eventloop.rst:1897 +#: ../../library/asyncio-eventloop.rst:1906 msgid "Watch a file descriptor for read events" msgstr "監聽檔案描述器以進行讀取事件" -#: ../../library/asyncio-eventloop.rst:1899 +#: ../../library/asyncio-eventloop.rst:1908 msgid "" -"Wait until a file descriptor received some data using the :meth:`loop." -"add_reader` method and then close the event loop::" +"Wait until a file descriptor received some data using " +"the :meth:`loop.add_reader` method and then close the event loop::" msgstr "" "使用 :meth:`loop.add_reader` 方法等待檔案描述器接收到某些資料,然後關閉事件迴" "圈: ::" -#: ../../library/asyncio-eventloop.rst:1902 +#: ../../library/asyncio-eventloop.rst:1911 msgid "" "import asyncio\n" "from socket import socketpair\n" @@ -2860,8 +2950,40 @@ msgid "" " wsock.close()\n" " loop.close()" msgstr "" +"import asyncio\n" +"from socket import socketpair\n" +"\n" +"# 建立一對連接的檔案描述器\n" +"rsock, wsock = socketpair()\n" +"\n" +"loop = asyncio.new_event_loop()\n" +"\n" +"def reader():\n" +" data = rsock.recv(100)\n" +" print(\"Received:\", data.decode())\n" +"\n" +" # 我們完成了:註銷檔案描述器\n" +" loop.remove_reader(rsock)\n" +"\n" +" # 停止事件迴圈\n" +" loop.stop()\n" +"\n" +"# 為讀取事件註冊檔案描述器\n" +"loop.add_reader(rsock, reader)\n" +"\n" +"# 模擬從網路接收資料\n" +"loop.call_soon(wsock.send, 'abc'.encode())\n" +"\n" +"try:\n" +" # 運行事件迴圈\n" +" loop.run_forever()\n" +"finally:\n" +" # 我們完成了。關閉 socket 和事件迴圈。\n" +" rsock.close()\n" +" wsock.close()\n" +" loop.close()" -#: ../../library/asyncio-eventloop.rst:1937 +#: ../../library/asyncio-eventloop.rst:1946 msgid "" "A similar :ref:`example <asyncio_example_create_connection>` using " "transports, protocols, and the :meth:`loop.create_connection` method." @@ -2869,7 +2991,7 @@ msgstr "" "使用傳輸、協定和 :meth:`loop.create_connection` 方法的類似 :ref:`範例 " "<asyncio_example_create_connection>`。" -#: ../../library/asyncio-eventloop.rst:1941 +#: ../../library/asyncio-eventloop.rst:1950 msgid "" "Another similar :ref:`example <asyncio_example_create_connection-streams>` " "using the high-level :func:`asyncio.open_connection` function and streams." @@ -2877,23 +2999,24 @@ msgstr "" "另一個使用高階 :func:`asyncio.open_connection` 函式和串流的類似 :ref:`範例 " "<asyncio_example_create_connection-streams>`。" -#: ../../library/asyncio-eventloop.rst:1949 +#: ../../library/asyncio-eventloop.rst:1958 msgid "Set signal handlers for SIGINT and SIGTERM" msgstr "設定 SIGINT 和 SIGTERM 的訊號處理程式" -#: ../../library/asyncio-eventloop.rst:1951 +#: ../../library/asyncio-eventloop.rst:1960 msgid "(This ``signals`` example only works on Unix.)" msgstr "(此 ``signals`` 範例僅在 Unix 上運作。)" -#: ../../library/asyncio-eventloop.rst:1953 +#: ../../library/asyncio-eventloop.rst:1962 msgid "" -"Register handlers for signals :const:`~signal.SIGINT` and :const:`~signal." -"SIGTERM` using the :meth:`loop.add_signal_handler` method::" +"Register handlers for signals :const:`~signal.SIGINT` " +"and :const:`~signal.SIGTERM` using the :meth:`loop.add_signal_handler` " +"method::" msgstr "" -"使用 :meth:`loop.add_signal_handler` 方法註冊訊號 :py:data:`SIGINT` 和 :py:" -"data:`SIGTERM` 的處理程式: ::" +"使用 :meth:`loop.add_signal_handler` 方法註冊訊號 :py:data:`SIGINT` " +"和 :py:data:`SIGTERM` 的處理程式: ::" -#: ../../library/asyncio-eventloop.rst:1956 +#: ../../library/asyncio-eventloop.rst:1965 msgid "" "import asyncio\n" "import functools\n" @@ -2919,3 +3042,26 @@ msgid "" "\n" "asyncio.run(main())" msgstr "" +"import asyncio\n" +"import functools\n" +"import os\n" +"import signal\n" +"\n" +"def ask_exit(signame, loop):\n" +" print(\"got signal %s: exit\" % signame)\n" +" loop.stop()\n" +"\n" +"async def main():\n" +" loop = asyncio.get_running_loop()\n" +"\n" +" for signame in {'SIGINT', 'SIGTERM'}:\n" +" loop.add_signal_handler(\n" +" getattr(signal, signame),\n" +" functools.partial(ask_exit, signame, loop))\n" +"\n" +" await asyncio.sleep(3600)\n" +"\n" +"print(\"Event loop running for 1 hour, press Ctrl+C to interrupt.\")\n" +"print(f\"pid {os.getpid()}: send SIGINT or SIGTERM to exit.\")\n" +"\n" +"asyncio.run(main())" diff --git a/library/asyncio-queue.po b/library/asyncio-queue.po index 088dea0967..effaeebec4 100644 --- a/library/asyncio-queue.po +++ b/library/asyncio-queue.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-01-10 00:14+0000\n" "PO-Revision-Date: 2022-02-20 18:34+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -39,8 +39,8 @@ msgstr "" #: ../../library/asyncio-queue.rst:17 msgid "" -"Note that methods of asyncio queues don't have a *timeout* parameter; use :" -"func:`asyncio.wait_for` function to do queue operations with a timeout." +"Note that methods of asyncio queues don't have a *timeout* parameter; " +"use :func:`asyncio.wait_for` function to do queue operations with a timeout." msgstr "" "注意 asyncio 的佇列沒有 *timeout* 參數;請使用 :func:`asyncio.wait_for` 函式" "來為佇列新增具有超時 (timeout) 設定的操作。" @@ -63,16 +63,16 @@ msgid "" "it is an integer greater than ``0``, then ``await put()`` blocks when the " "queue reaches *maxsize* until an item is removed by :meth:`get`." msgstr "" -"如果 *maxsize* 小於或等於零,則佇列尺寸是無限制的。如果是大於 ``0`` 的整數," -"則當佇列達到 *maxsize* 時,``await put()`` 將會阻塞 (block),直到某個元素被 :" -"meth:`get` 取出。" +"如果 *maxsize* 小於或等於零,則佇列大小是無限制的。如果是大於 ``0`` 的整數," +"則當佇列達到 *maxsize* 時,``await put()`` 將會阻塞 (block),直到某個元素" +"被 :meth:`get` 取出。" #: ../../library/asyncio-queue.rst:35 msgid "" "Unlike the standard library threading :mod:`queue`, the size of the queue is " "always known and can be returned by calling the :meth:`qsize` method." msgstr "" -"不像標準函式庫中執行緒類型的 :mod:`queue`,佇列的尺寸一直是已知的,可以透過呼" +"不像標準函式庫中執行緒類型的 :mod:`queue`,佇列的大小一直是已知的,可以透過呼" "叫 :meth:`qsize` 方法回傳。" #: ../../library/asyncio-queue.rst:39 @@ -97,8 +97,8 @@ msgstr "如果有 :attr:`maxsize` 個條目在佇列中,則回傳 ``True``。" #: ../../library/asyncio-queue.rst:57 msgid "" -"If the queue was initialized with ``maxsize=0`` (the default), then :meth:" -"`full` never returns ``True``." +"If the queue was initialized with ``maxsize=0`` (the default), " +"then :meth:`full` never returns ``True``." msgstr "" "如果佇列用 ``maxsize=0`` (預設)初始化,則 :meth:`full` 永遠不會回傳 " "``True``。" @@ -127,10 +127,10 @@ msgstr "持續阻塞直到佇列中所有的元素都被接收和處理完畢。 #: ../../library/asyncio-queue.rst:77 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " -"queue. The count goes down whenever a consumer coroutine calls :meth:" -"`task_done` to indicate that the item was retrieved and all work on it is " -"complete. When the count of unfinished tasks drops to zero, :meth:`join` " -"unblocks." +"queue. The count goes down whenever a consumer coroutine " +"calls :meth:`task_done` to indicate that the item was retrieved and all work " +"on it is complete. When the count of unfinished tasks drops to " +"zero, :meth:`join` unblocks." msgstr "" "當條目新增到佇列的時候,未完成任務的計數就會增加。每當一個消耗者 (consumer) " "協程呼叫 :meth:`task_done`,表示這個條目已經被取回且被它包含的所有工作都已完" @@ -147,7 +147,7 @@ msgstr "" #: ../../library/asyncio-queue.rst:88 msgid "Raises :exc:`QueueShutDown` if the queue has been shut down." -msgstr "" +msgstr "如果佇列已經被關閉,則引發 :exc:`QueueShutDown`。" #: ../../library/asyncio-queue.rst:92 msgid "Put an item into the queue without blocking." @@ -163,8 +163,8 @@ msgstr "回傳佇列中的元素數量。" #: ../../library/asyncio-queue.rst:102 msgid "" -"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` raise :" -"exc:`QueueShutDown`." +"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` " +"raise :exc:`QueueShutDown`." msgstr "" #: ../../library/asyncio-queue.rst:105 @@ -178,22 +178,22 @@ msgstr "" msgid "" "All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be " "unblocked. If *immediate* is true, a task will be marked as done for each " -"remaining item in the queue, which may unblock callers of :meth:`~Queue." -"join`." +"remaining item in the queue, which may unblock callers " +"of :meth:`~Queue.join`." msgstr "" #: ../../library/asyncio-queue.rst:118 -msgid "Indicate that a formerly enqueued task is complete." -msgstr "表示前面一個排隊的任務已經完成。" +msgid "Indicate that a formerly enqueued work item is complete." +msgstr "表示前面一個排隊的工作項目已經完成。" #: ../../library/asyncio-queue.rst:120 msgid "" -"Used by queue consumers. For each :meth:`~Queue.get` used to fetch a task, a " -"subsequent call to :meth:`task_done` tells the queue that the processing on " -"the task is complete." +"Used by queue consumers. For each :meth:`~Queue.get` used to fetch a work " +"item, a subsequent call to :meth:`task_done` tells the queue that the " +"processing on the work item is complete." msgstr "" -"由佇列消耗者使用。對於每個用於獲取一個任務的 :meth:`~Queue.get`,接續的 :" -"meth:`task_done` 呼叫會告訴佇列這個任務的處理已經完成。" +"由佇列消耗者使用。對於每個用於獲取一個工作項目的 :meth:`~Queue.get`,接續" +"的 :meth:`task_done` 呼叫會告訴佇列這個工作項目的處理已經完成。" #: ../../library/asyncio-queue.rst:124 msgid "" @@ -202,7 +202,7 @@ msgid "" "item that had been :meth:`~Queue.put` into the queue)." msgstr "" "如果 :meth:`join` 當前正在阻塞,在所有項目都被處理後會解除阻塞(意味著每個" -"以 :meth:`~Queue.put` 放進佇列的條目都會收到一個 :meth:`task_done`\\ )。" +"以 :meth:`~Queue.put` 放進佇列的條目都會收到一個 :meth:`task_done`)。" #: ../../library/asyncio-queue.rst:129 msgid "" @@ -259,13 +259,10 @@ msgstr "" "法會引發這個例外。" #: ../../library/asyncio-queue.rst:174 -#, fuzzy msgid "" "Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on " "a queue which has been shut down." msgstr "" -"當佇列中條目數量已經達到它的 *maxsize* 時,呼叫 :meth:`~Queue.put_nowait` 方" -"法會引發這個例外。" #: ../../library/asyncio-queue.rst:181 msgid "Examples" diff --git a/library/calendar.po b/library/calendar.po index 564f71a8d6..02ae510536 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-26 00:13+0000\n" +"POT-Creation-Date: 2025-01-08 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -38,8 +38,8 @@ msgstr "" "這個模組讓你可以像 Unix 的 :program:`cal` 程式一樣輸出日曆,並額外提供有用的" "日曆相關函式。這些日曆預設把週一當作一週的第一天,而週日當作最後一天(歐洲的" "慣例)。可以使用 :func:`setfirstweekday` 設定一週的第一天為週日 (6) 或一週的" -"其它任一天,其中指定日期的參數是整數。相關功能參考 :mod:`datetime` 和 :mod:" -"`time` 模組。" +"其它任一天,其中指定日期的參數是整數。相關功能參考 :mod:`datetime` " +"和 :mod:`time` 模組。" #: ../../library/calendar.rst:22 msgid "" @@ -60,11 +60,11 @@ msgstr "" #: ../../library/calendar.rst:33 msgid "" "Creates a :class:`Calendar` object. *firstweekday* is an integer specifying " -"the first day of the week. :const:`MONDAY` is ``0`` (the default), :const:" -"`SUNDAY` is ``6``." +"the first day of the week. :const:`MONDAY` is ``0`` (the " +"default), :const:`SUNDAY` is ``6``." msgstr "" -"建立 :class:`Calendar` 物件。*firstweekday* 是一個指定一週第一天的整數,:" -"const:`MONDAY` 是 ``0``\\ (預設值),:const:`SUNDAY` 是 ``6``。" +"建立 :class:`Calendar` 物件。*firstweekday* 是一個指定一週第一天的整" +"數,:const:`MONDAY` 是 ``0``\\ (預設值),:const:`SUNDAY` 是 ``6``。" #: ../../library/calendar.rst:36 msgid "" @@ -76,19 +76,47 @@ msgstr "" "做任何格式化,這是子類別的工作。" #: ../../library/calendar.rst:41 -msgid ":class:`Calendar` instances have the following methods:" -msgstr ":class:`Calendar` 實例有以下方法:" +msgid ":class:`Calendar` instances have the following methods and attributes:" +msgstr ":class:`Calendar` 實例有以下方法與屬性:" #: ../../library/calendar.rst:45 +msgid "The first weekday as an integer (0--6)." +msgstr "" + +#: ../../library/calendar.rst:47 +msgid "" +"This property can also be set and read " +"using :meth:`~Calendar.setfirstweekday` " +"and :meth:`~Calendar.getfirstweekday` respectively." +msgstr "" + +#: ../../library/calendar.rst:53 +msgid "Return an :class:`int` for the current first weekday (0--6)." +msgstr "" + +#: ../../library/calendar.rst:55 +msgid "Identical to reading the :attr:`~Calendar.firstweekday` property." +msgstr "" + +#: ../../library/calendar.rst:59 +msgid "" +"Set the first weekday to *firstweekday*, passed as an :class:`int` (0--6)" +msgstr "" + +#: ../../library/calendar.rst:61 +msgid "Identical to setting the :attr:`~Calendar.firstweekday` property." +msgstr "" + +#: ../../library/calendar.rst:65 msgid "" "Return an iterator for the week day numbers that will be used for one week. " -"The first value from the iterator will be the same as the value of the :attr:" -"`firstweekday` property." +"The first value from the iterator will be the same as the value of " +"the :attr:`~Calendar.firstweekday` property." msgstr "" -"回傳一個以數字代表一週的每一天的疊代器 (iterator)。疊代器的第一個值和 :attr:" -"`firstweekday` 屬性的值一樣。" +"回傳一個以數字代表一週的每一天的疊代器 (iterator)。疊代器的第一個值" +"和 :attr:`~Calendar.firstweekday` 屬性的值一樣。" -#: ../../library/calendar.rst:52 +#: ../../library/calendar.rst:72 msgid "" "Return an iterator for the month *month* (1--12) in the year *year*. This " "iterator will return all days (as :class:`datetime.date` objects) for the " @@ -98,59 +126,59 @@ msgstr "" "回傳一個在 *year* 年 *month* (1--12) 月的疊代器。這個疊代器會回傳該月的所有日" "期(:class:`datetime.date` 物件)以及在該月之前及之後用來組成完整一週的日期。" -#: ../../library/calendar.rst:60 +#: ../../library/calendar.rst:80 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 simply be day of the month numbers. For the days outside " -"of the specified month, the day number is ``0``." +"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 simply be day of the month numbers. For the days " +"outside of the specified month, the day number is ``0``." msgstr "" "類似 :meth:`itermonthdates`,回傳一個在 *year* 年 *month* 月的疊代器,但不受" "限於 :class:`datetime.date` 的範圍。回傳的日期單純是該月當日的數字,對於該月" "之外的日期數字會是 ``0``。" -#: ../../library/calendar.rst:68 +#: ../../library/calendar.rst:88 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." +"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." msgstr "" "類似 :meth:`itermonthdates`,回傳一個在 *year* 年 *month* 月的疊代器,但不受" "限於 :class:`datetime.date` 的範圍。回傳的日期是一個由該月當日的數字及代表週" "幾的數字組成的元組。" -#: ../../library/calendar.rst:76 +#: ../../library/calendar.rst:96 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 year, a month and a day of the " -"month numbers." +"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 year, a month and a day " +"of the month numbers." msgstr "" "類似 :meth:`itermonthdates`,回傳一個在 *year* 年 *month* 月的疊代器,但不受" "限於 :class:`datetime.date` 的範圍。回傳的日期是一個由年、月、日的數字組成的" "元組。" -#: ../../library/calendar.rst:86 +#: ../../library/calendar.rst:106 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 year, a month, a day of the " -"month, and a day of the week numbers." +"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 year, a month, a day of " +"the month, and a day of the week numbers." msgstr "" "類似 :meth:`itermonthdates`,回傳一個在 *year* 年 *month* 月的疊代器,但不受" "限於 :class:`datetime.date` 的範圍。回傳的日期是一個由年、月、日及代表週幾的" "數字組成的元組。" -#: ../../library/calendar.rst:96 +#: ../../library/calendar.rst:116 msgid "" "Return a list of the weeks in the month *month* of the *year* as full " "weeks. Weeks are lists of seven :class:`datetime.date` objects." msgstr "" -"回傳一個在 *year* 年 *month* 月每一週組成的串列。每一週是一個串列,包含七個 :" -"class:`datetime.date` 物件。" +"回傳一個在 *year* 年 *month* 月每一週組成的串列。每一週是一個串列,包含七" +"個 :class:`datetime.date` 物件。" -#: ../../library/calendar.rst:102 +#: ../../library/calendar.rst:122 msgid "" "Return a list of the weeks in the month *month* of the *year* as full " "weeks. Weeks are lists of seven tuples of day numbers and weekday numbers." @@ -158,7 +186,7 @@ msgstr "" "回傳一個在 *year* 年 *month* 月每一週組成的串列。每一週是一個串列,包含七個該" "月當日的數字及代表週幾的數字組成的元組。" -#: ../../library/calendar.rst:109 +#: ../../library/calendar.rst:129 msgid "" "Return a list of the weeks in the month *month* of the *year* as full " "weeks. Weeks are lists of seven day numbers." @@ -166,7 +194,7 @@ msgstr "" "回傳一個在 *year* 年 *month* 月每一週組成的串列。每一週是一個串列,包含七個該" "月當日的數字。" -#: ../../library/calendar.rst:115 +#: ../../library/calendar.rst:135 msgid "" "Return the data for the specified year ready for formatting. The return " "value is a list of month rows. Each month row contains up to *width* months " @@ -177,76 +205,113 @@ msgstr "" "*width* 個月份組成(預設為 3)。每個月份包含四到六週,每一週包含一到七天,每" "一天則是一個 :class:`datetime.date` 物件。" -#: ../../library/calendar.rst:123 +#: ../../library/calendar.rst:143 msgid "" -"Return the data for the specified year ready for formatting (similar to :" -"meth:`yeardatescalendar`). Entries in the week lists are tuples of day " +"Return the data for the specified year ready for formatting (similar " +"to :meth:`yeardatescalendar`). Entries in the week lists are tuples of day " "numbers and weekday numbers. Day numbers outside this month are zero." msgstr "" "回傳用來格式化的指定年份的資料(類似 :meth:`yeardatescalendar`)。每一天是一" "個該月當日的數字及代表週幾的數字組成的元組,該月外的日期的該月當日數字為 0。" -#: ../../library/calendar.rst:130 +#: ../../library/calendar.rst:150 msgid "" -"Return the data for the specified year ready for formatting (similar to :" -"meth:`yeardatescalendar`). Entries in the week lists are day numbers. Day " -"numbers outside this month are zero." +"Return the data for the specified year ready for formatting (similar " +"to :meth:`yeardatescalendar`). Entries in the week lists are day numbers. " +"Day numbers outside this month are zero." msgstr "" "回傳用來格式化的指定年份的資料(類似 :meth:`yeardatescalendar`)。每一天是一" "個該月當日的數字,該月外的日期的該月當日數字為 0。" -#: ../../library/calendar.rst:137 +#: ../../library/calendar.rst:157 msgid "This class can be used to generate plain text calendars." msgstr "這個類別用來產生純文字的日曆。" -#: ../../library/calendar.rst:139 +#: ../../library/calendar.rst:159 msgid ":class:`TextCalendar` instances have the following methods:" msgstr ":class:`TextCalendar` 實例有以下方法:" -#: ../../library/calendar.rst:143 +#: ../../library/calendar.rst:164 +msgid "" +"Return a string representing a single day formatted with the given *width*. " +"If *theday* is ``0``, return a string of spaces of the specified width, " +"representing an empty day. The *weekday* parameter is unused." +msgstr "" + +#: ../../library/calendar.rst:171 +msgid "" +"Return a single week in a string with no newline. If *w* is provided, it " +"specifies the width of the date columns, which are centered. Depends on the " +"first weekday as specified in the constructor or set by " +"the :meth:`setfirstweekday` method." +msgstr "" + +#: ../../library/calendar.rst:178 +msgid "" +"Return a string representing the name of a single weekday formatted to the " +"specified *width*. The *weekday* parameter is an integer representing the " +"day of the week, where ``0`` is Monday and ``6`` is Sunday." +msgstr "" + +#: ../../library/calendar.rst:184 +msgid "" +"Return a string containing the header row of weekday names, formatted with " +"the given *width* for each column. The names depend on the locale settings " +"and are padded to the specified width." +msgstr "" + +#: ../../library/calendar.rst:190 msgid "" "Return a month's calendar in a multi-line string. If *w* is provided, it " "specifies the width of the date columns, which are centered. If *l* is " "given, it specifies the number of lines that each week will use. Depends on " -"the first weekday as specified in the constructor or set by the :meth:" -"`setfirstweekday` method." +"the first weekday as specified in the constructor or set by " +"the :meth:`setfirstweekday` method." msgstr "" "以多行字串的形式回傳一個月份的日曆。如果給定 *w*,它會指定置中的日期欄的寬" "度。如果給定 *l*,它會指定每一週使用的行數。這個日曆會依據在建構函式中指定或" "者透過 :meth:`setfirstweekday` 方法設定的一週的第一天來輸出。" -#: ../../library/calendar.rst:152 +#: ../../library/calendar.rst:198 +msgid "" +"Return a string representing the month's name centered within the specified " +"*width*. If *withyear* is ``True``, include the year in the output. The " +"*theyear* and *themonth* parameters specify the year and month for the name " +"to be formatted respectively." +msgstr "" + +#: ../../library/calendar.rst:205 msgid "Print a month's calendar as returned by :meth:`formatmonth`." msgstr "印出一個月份的日曆,內容和 :meth:`formatmonth` 回傳的一樣。" -#: ../../library/calendar.rst:157 +#: ../../library/calendar.rst:210 msgid "" "Return a *m*-column calendar for an entire year as a multi-line string. " "Optional parameters *w*, *l*, and *c* are for date column width, lines per " "week, and number of spaces between month columns, respectively. Depends on " -"the first weekday as specified in the constructor or set by the :meth:" -"`setfirstweekday` method. The earliest year for which a calendar can be " -"generated is platform-dependent." +"the first weekday as specified in the constructor or set by " +"the :meth:`setfirstweekday` method. The earliest year for which a calendar " +"can be generated is platform-dependent." msgstr "" "以多行字串的形式回傳有 *m* 欄的一整年的日曆。可選的參數 *w*、*l* 及 *c* 分別" "是日期欄寬度、每週行數及月份欄中間的空白數。這個日曆會依據在建構函式中指定或" "者透過 :meth:`setfirstweekday` 方法設定的一週的第一天來輸出。最早可以產生日曆" "的年份會依據平台而不同。" -#: ../../library/calendar.rst:167 +#: ../../library/calendar.rst:220 msgid "" "Print the calendar for an entire year as returned by :meth:`formatyear`." msgstr "印出一整年的日曆,內容和 :meth:`formatyear` 回傳的一樣。" -#: ../../library/calendar.rst:172 +#: ../../library/calendar.rst:225 msgid "This class can be used to generate HTML calendars." msgstr "這個類別用來產生 HTML 日曆。" -#: ../../library/calendar.rst:175 +#: ../../library/calendar.rst:228 msgid ":class:`!HTMLCalendar` instances have the following methods:" msgstr ":class:`!HTMLCalendar` 實例有以下方法:" -#: ../../library/calendar.rst:179 +#: ../../library/calendar.rst:232 msgid "" "Return a month's calendar as an HTML table. If *withyear* is true the year " "will be included in the header, otherwise just the month name will be used." @@ -254,14 +319,14 @@ msgstr "" "以 HTML 表格的形式回傳一個月份的日曆。如果 *withyear* 是 true 則標題會包含年" "份,否則只會有月份名稱。" -#: ../../library/calendar.rst:186 +#: ../../library/calendar.rst:239 msgid "" "Return a year's calendar as an HTML table. *width* (defaulting to 3) " "specifies the number of months per row." msgstr "" "以 HTML 表格的形式回傳一整年的日曆。*width*\\ (預設為 3)指定一列有幾個月。" -#: ../../library/calendar.rst:192 +#: ../../library/calendar.rst:245 msgid "" "Return a year's calendar as a complete HTML page. *width* (defaulting to 3) " "specifies the number of months per row. *css* is the name for the cascading " @@ -273,7 +338,7 @@ msgstr "" "月。*css* 是要使用的 CSS (cascading style sheet) 名稱,可以給 :const:`None` " "表示不使用任何 CSS。*encoding* 指定輸出使用的編碼(預設使用系統預設編碼)。" -#: ../../library/calendar.rst:201 +#: ../../library/calendar.rst:254 msgid "" "Return a month name as an HTML table row. If *withyear* is true the year " "will be included in the row, otherwise just the month name will be used." @@ -281,28 +346,28 @@ msgstr "" "以 HTML 表列的形式回傳一個月份的名稱。如果 *withyear* 是 true 則該列會包含年" "份,否則只會有月份名稱。" -#: ../../library/calendar.rst:206 +#: ../../library/calendar.rst:259 msgid "" ":class:`!HTMLCalendar` has the following attributes you can override to " "customize the CSS classes used by the calendar:" msgstr ":class:`!HTMLCalendar` 可以覆寫以下屬性來客製日曆所使用的 CSS 類別:" -#: ../../library/calendar.rst:211 +#: ../../library/calendar.rst:264 msgid "" "A list of CSS classes used for each weekday. The default class list is::" msgstr "對應一週每一天 CSS 類別的串列。預設的串列內容為: ::" -#: ../../library/calendar.rst:213 +#: ../../library/calendar.rst:266 msgid "" "cssclasses = [\"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun\"]" msgstr "" "cssclasses = [\"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\", \"sun\"]" -#: ../../library/calendar.rst:215 +#: ../../library/calendar.rst:268 msgid "more styles can be added for each day::" msgstr "可以針對每一天增加更多樣式: ::" -#: ../../library/calendar.rst:217 +#: ../../library/calendar.rst:270 msgid "" "cssclasses = [\"mon text-bold\", \"tue\", \"wed\", \"thu\", \"fri\", " "\"sat\", \"sun red\"]" @@ -310,15 +375,15 @@ msgstr "" "cssclasses = [\"mon text-bold\", \"tue\", \"wed\", \"thu\", \"fri\", " "\"sat\", \"sun red\"]" -#: ../../library/calendar.rst:219 +#: ../../library/calendar.rst:272 msgid "Note that the length of this list must be seven items." msgstr "注意這個串列的長度必須是七個項目。" -#: ../../library/calendar.rst:224 +#: ../../library/calendar.rst:277 msgid "The CSS class for a weekday occurring in the previous or coming month." msgstr "跟當月為同一週且屬於前一個或下一個月份的日期使用的 CSS 類別。" -#: ../../library/calendar.rst:231 +#: ../../library/calendar.rst:284 msgid "" "A list of CSS classes used for weekday names in the header row. The default " "is the same as :attr:`cssclasses`." @@ -326,7 +391,7 @@ msgstr "" "在標題列中一週每一天名稱的 CSS 類別的串列。預設內容和 :attr:`cssclasses` 相" "同。" -#: ../../library/calendar.rst:239 +#: ../../library/calendar.rst:292 msgid "" "The month's head CSS class (used by :meth:`formatmonthname`). The default " "value is ``\"month\"``." @@ -334,7 +399,7 @@ msgstr "" "月份標題的 CSS 類別(由 :meth:`formatmonthname` 所使用),預設值是 " "``\"month\"``。" -#: ../../library/calendar.rst:247 +#: ../../library/calendar.rst:300 msgid "" "The CSS class for the whole month's table (used by :meth:`formatmonth`). The " "default value is ``\"month\"``." @@ -342,22 +407,22 @@ msgstr "" "整個月份表格的 CSS 類別(由 :meth:`formatmonth` 所使用),預設值是 " "``\"month\"``。" -#: ../../library/calendar.rst:255 +#: ../../library/calendar.rst:308 msgid "" -"The CSS class for the whole year's table of tables (used by :meth:" -"`formatyear`). The default value is ``\"year\"``." +"The CSS class for the whole year's table of tables (used " +"by :meth:`formatyear`). The default value is ``\"year\"``." msgstr "" "整年表格的 CSS 類別(由 :meth:`formatyear` 所使用),預設值是 ``\"year\"``。" -#: ../../library/calendar.rst:263 +#: ../../library/calendar.rst:316 msgid "" -"The CSS class for the table head for the whole year (used by :meth:" -"`formatyear`). The default value is ``\"year\"``." +"The CSS class for the table head for the whole year (used " +"by :meth:`formatyear`). The default value is ``\"year\"``." msgstr "" "整年表格標題的 CSS 類別(由 :meth:`formatyear` 所使用),預設值是 " "``\"year\"``。" -#: ../../library/calendar.rst:269 +#: ../../library/calendar.rst:322 msgid "" "Note that although the naming for the above described class attributes is " "singular (e.g. ``cssclass_month`` ``cssclass_noday``), one can replace the " @@ -367,15 +432,15 @@ msgstr "" "``cssclass_noday``),你可以使用多個以空格隔開的 CSS 類別取代單一 CSS 類別," "例如: ::" -#: ../../library/calendar.rst:273 +#: ../../library/calendar.rst:326 msgid "\"text-bold text-red\"" msgstr "\"text-bold text-red\"" -#: ../../library/calendar.rst:275 +#: ../../library/calendar.rst:328 msgid "Here is an example how :class:`!HTMLCalendar` can be customized::" msgstr "以下是客製化 :class:`!HTMLCalendar` 的範例: ::" -#: ../../library/calendar.rst:277 +#: ../../library/calendar.rst:330 msgid "" "class CustomHTMLCal(calendar.HTMLCalendar):\n" " cssclasses = [style + \" text-nowrap\" for style in\n" @@ -391,7 +456,7 @@ msgstr "" " cssclass_month = \"text-center month\"\n" " cssclass_year = \"text-italic lead\"" -#: ../../library/calendar.rst:287 +#: ../../library/calendar.rst:340 msgid "" "This subclass of :class:`TextCalendar` can be passed a locale name in the " "constructor and will return month and weekday names in the specified locale." @@ -399,7 +464,7 @@ msgstr "" ":class:`TextCalendar` 的子類別,可以在建構函式傳入語系名稱,它會回傳指定語系" "的月份及一週每一天的名稱。" -#: ../../library/calendar.rst:293 +#: ../../library/calendar.rst:346 msgid "" "This subclass of :class:`HTMLCalendar` can be passed a locale name in the " "constructor and will return month and weekday names in the specified locale." @@ -407,7 +472,7 @@ msgstr "" ":class:`HTMLCalendar` 的子類別,可以在建構函式傳入語系名稱,它會回傳指定語系" "的月份及一週每一天的名稱。" -#: ../../library/calendar.rst:299 +#: ../../library/calendar.rst:352 msgid "" "The constructor, :meth:`!formatweekday` and :meth:`!formatmonthname` methods " "of these two classes temporarily change the ``LC_TIME`` locale to the given " @@ -418,22 +483,22 @@ msgstr "" "會把 ``LC_TIME`` 語系暫時改成給定的 *locale*。因為目前的語系是屬於整個行程 " "(process-wide) 的設定,它們不是執行緒安全的。" -#: ../../library/calendar.rst:305 +#: ../../library/calendar.rst:358 msgid "For simple text calendars this module provides the following functions." msgstr "這個模組提供以下函式給單純的文字日曆使用。" -#: ../../library/calendar.rst:309 +#: ../../library/calendar.rst:362 msgid "" "Sets the weekday (``0`` is Monday, ``6`` is Sunday) to start each week. The " -"values :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:" -"`THURSDAY`, :const:`FRIDAY`, :const:`SATURDAY`, and :const:`SUNDAY` are " -"provided for convenience. For example, to set the first weekday to Sunday::" +"values :const:`MONDAY`, :const:`TUESDAY`, :const:`WEDNESDAY`, :const:`THURSDAY`, :const:`FRIDAY`, :const:`SATURDAY`, " +"and :const:`SUNDAY` are provided for convenience. For example, to set the " +"first weekday to Sunday::" msgstr "" -"設定一週的第一天(``0`` 是週一、``6`` 是週日)。提供 :const:`MONDAY`、:const:" -"`TUESDAY`、:const:`WEDNESDAY`、:const:`THURSDAY`、:const:`FRIDAY`、:const:" -"`SATURDAY` 及 :const:`SUNDAY` 可以方便設定。例如設定一週的第一天為週日: ::" +"設定一週的第一天(``0`` 是週一、``6`` 是週日)。提" +"供 :const:`MONDAY`、:const:`TUESDAY`、:const:`WEDNESDAY`、:const:`THURSDAY`、:const:`FRIDAY`、:const:`SATURDAY` " +"及 :const:`SUNDAY` 可以方便設定。例如設定一週的第一天為週日: ::" -#: ../../library/calendar.rst:314 +#: ../../library/calendar.rst:367 msgid "" "import calendar\n" "calendar.setfirstweekday(calendar.SUNDAY)" @@ -441,27 +506,27 @@ msgstr "" "import calendar\n" "calendar.setfirstweekday(calendar.SUNDAY)" -#: ../../library/calendar.rst:320 +#: ../../library/calendar.rst:373 msgid "Returns the current setting for the weekday to start each week." msgstr "回傳目前設定的一週的第一天。" -#: ../../library/calendar.rst:325 +#: ../../library/calendar.rst:378 msgid "" "Returns :const:`True` if *year* is a leap year, otherwise :const:`False`." msgstr "如果 *year* 是閏年回傳 :const:`True`,否則回傳 :const:`False`。" -#: ../../library/calendar.rst:330 +#: ../../library/calendar.rst:383 msgid "" "Returns the number of leap years in the range from *y1* to *y2* (exclusive), " "where *y1* and *y2* are years." msgstr "" "回傳從 *y1* 到 *y2*\\ (不包含)間有幾個閏年,其中 *y1* 和 *y2* 是年份。" -#: ../../library/calendar.rst:333 +#: ../../library/calendar.rst:386 msgid "This function works for ranges spanning a century change." msgstr "這個函式也適用在跨越世紀的時間範圍。" -#: ../../library/calendar.rst:338 +#: ../../library/calendar.rst:391 msgid "" "Returns the day of the week (``0`` is Monday) for *year* (``1970``--...), " "*month* (``1``--``12``), *day* (``1``--``31``)." @@ -469,19 +534,19 @@ msgstr "" "回傳 *year* 年 (``1970``--...) *month* 月 (``1``--``12``) *day* 日 (``1``--" "``31``) 是週幾(``0`` 是星期一)。" -#: ../../library/calendar.rst:344 +#: ../../library/calendar.rst:397 msgid "" "Return a header containing abbreviated weekday names. *n* specifies the " "width in characters for one weekday." msgstr "回傳包含一週每一天的名稱縮寫的標題。*n* 指定每一天的字元寬度。" -#: ../../library/calendar.rst:350 +#: ../../library/calendar.rst:403 msgid "" "Returns weekday of first day of the month and number of days in month, for " "the specified *year* and *month*." msgstr "回傳指定 *year* 年 *month* 月該月第一天代表週幾的數字及該月有多少天。" -#: ../../library/calendar.rst:356 +#: ../../library/calendar.rst:409 msgid "" "Returns a matrix representing a month's calendar. Each row represents a " "week; days outside of the month are represented by zeros. Each week begins " @@ -490,32 +555,32 @@ msgstr "" "回傳代表一個月份日曆的矩陣。每一列為一週;該月以外的日期以 0 表示。每一週以週" "一開始,除非有使用 :func:`setfirstweekday` 改變設定。" -#: ../../library/calendar.rst:363 +#: ../../library/calendar.rst:416 msgid "Prints a month's calendar as returned by :func:`month`." msgstr "印出一個月份的日曆,跟 :func:`month` 回傳的內容一樣。" -#: ../../library/calendar.rst:368 +#: ../../library/calendar.rst:421 msgid "" -"Returns a month's calendar in a multi-line string using the :meth:" -"`~TextCalendar.formatmonth` of the :class:`TextCalendar` class." +"Returns a month's calendar in a multi-line string using " +"the :meth:`~TextCalendar.formatmonth` of the :class:`TextCalendar` class." msgstr "" -"以多行字串的形式回傳一個月的日曆,使用 :class:`TextCalendar` 類別的 :meth:" -"`~TextCalendar.formatmonth`。" +"以多行字串的形式回傳一個月的日曆,使用 :class:`TextCalendar` 類別" +"的 :meth:`~TextCalendar.formatmonth`。" -#: ../../library/calendar.rst:374 +#: ../../library/calendar.rst:427 msgid "" "Prints the calendar for an entire year as returned by :func:`calendar`." msgstr "印出一整年的日曆,跟 :func:`calendar` 回傳的內容一樣。" -#: ../../library/calendar.rst:379 +#: ../../library/calendar.rst:432 msgid "" "Returns a 3-column calendar for an entire year as a multi-line string using " "the :meth:`~TextCalendar.formatyear` of the :class:`TextCalendar` class." msgstr "" -"以多行字串回傳三欄形式的一整年日曆,使用 :class:`TextCalendar` 類別的 :meth:" -"`~TextCalendar.formatyear`。" +"以多行字串回傳三欄形式的一整年日曆,使用 :class:`TextCalendar` 類別" +"的 :meth:`~TextCalendar.formatyear`。" -#: ../../library/calendar.rst:385 +#: ../../library/calendar.rst:438 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 " @@ -523,51 +588,52 @@ msgid "" "encoding. In fact, :func:`time.gmtime` and :func:`timegm` are each others' " "inverse." msgstr "" -"一個跟日曆無關但方便的函式,它接受一個像 :mod:`time` 模組裡的 :func:`~time." -"gmtime` 函式回傳的元組,並回傳對應的 Unix 時間戳,假設從 1970 開始及 POSIX 編" -"碼。事實上,:func:`time.gmtime` 和 :func:`timegm` 是彼此相反的。" +"一個跟日曆無關但方便的函式,它接受一個像 :mod:`time` 模組裡" +"的 :func:`~time.gmtime` 函式回傳的元組,並回傳對應的 Unix 時間戳,假設從 " +"1970 開始及 POSIX 編碼。事實上,:func:`time.gmtime` 和 :func:`timegm` 是彼此" +"相反的。" -#: ../../library/calendar.rst:392 +#: ../../library/calendar.rst:445 msgid "The :mod:`calendar` module exports the following data attributes:" msgstr ":mod:`calendar` 模組匯出以下資料屬性:" -#: ../../library/calendar.rst:396 +#: ../../library/calendar.rst:449 msgid "" "A sequence that represents the days of the week in the current locale, where " "Monday is day number 0." msgstr "以目前語系來表示的一週每一天名稱的序列,其中週一是第 0 天。" -#: ../../library/calendar.rst:406 +#: ../../library/calendar.rst:459 msgid "" "A sequence that represents the abbreviated days of the week in the current " "locale, where Mon is day number 0." msgstr "以目前語系來表示的一週每一天縮寫名稱的序列,其中 Mon 是第 0 天。" -#: ../../library/calendar.rst:421 +#: ../../library/calendar.rst:474 msgid "" "Aliases for the days of the week, where ``MONDAY`` is ``0`` and ``SUNDAY`` " "is ``6``." msgstr "一週每一天的別名,其中 ``MONDAY`` 是 ``0`` 而 ``SUNDAY`` 是 ``6``。" -#: ../../library/calendar.rst:429 +#: ../../library/calendar.rst:482 msgid "" "Enumeration defining days of the week as integer constants. The members of " -"this enumeration are exported to the module scope as :data:`MONDAY` through :" -"data:`SUNDAY`." +"this enumeration are exported to the module scope as :data:`MONDAY` " +"through :data:`SUNDAY`." msgstr "" -"將一週中的幾天定義為整數常數的列舉。此列舉的成員將作為 :data:`MONDAY` 到 :" -"data:`SUNDAY` 匯出到模組作用域。" +"將一週中的幾天定義為整數常數的列舉。此列舉的成員將作為 :data:`MONDAY` " +"到 :data:`SUNDAY` 匯出到模組作用域。" -#: ../../library/calendar.rst:438 +#: ../../library/calendar.rst:491 msgid "" "A sequence that represents the months of the year in the current locale. " "This follows normal convention of January being month number 1, so it has a " -"length of 13 and ``month_name[0]`` is the empty string." +"length of 13 and ``month_name[0]`` is the empty string." msgstr "" "以目前語系來表示的一年每個月份名稱的序列。它按照一般慣例以數字 1 代表一月,因" "此它的長度為 13,而 ``month_name[0]`` 是空字串。" -#: ../../library/calendar.rst:449 +#: ../../library/calendar.rst:502 msgid "" "A sequence that represents the abbreviated months of the year in the current " "locale. This follows normal convention of January being month number 1, so " @@ -576,77 +642,77 @@ msgstr "" "以目前語系來表示的一年每個月份縮寫名稱的序列。它按照一般慣例以數字 1 代表一" "月,因此它的長度為 13,而 ``month_abbr[0]`` 是空字串。" -#: ../../library/calendar.rst:470 +#: ../../library/calendar.rst:523 msgid "" "Aliases for the months of the year, where ``JANUARY`` is ``1`` and " "``DECEMBER`` is ``12``." msgstr "" "一年內每個月的別名,其中 ``JANUARY`` 是 ``ㄅ`` 而 ``DECEMBER`` 是 ``12``。" -#: ../../library/calendar.rst:478 +#: ../../library/calendar.rst:531 msgid "" "Enumeration defining months of the year as integer constants. The members of " "this enumeration are exported to the module scope as :data:`JANUARY` " "through :data:`DECEMBER`." msgstr "" -"將一年中的月份定義為整數常數的列舉。此列舉的成員將作為 :data:`JANUARY` 到 :" -"data:`DECEMBER` 匯出到模組作用域。" +"將一年中的月份定義為整數常數的列舉。此列舉的成員將作為 :data:`JANUARY` " +"到 :data:`DECEMBER` 匯出到模組作用域。" -#: ../../library/calendar.rst:485 +#: ../../library/calendar.rst:538 msgid "The :mod:`calendar` module defines the following exceptions:" msgstr ":mod:`calendar` 模組定義了以下例外:" -#: ../../library/calendar.rst:489 +#: ../../library/calendar.rst:542 msgid "" "A subclass of :exc:`ValueError`, raised when the given month number is " "outside of the range 1-12 (inclusive)." msgstr "" ":exc:`ValueError` 的子類別,當給定的月份數字超出 1-12 範圍(含)時引發。" -#: ../../library/calendar.rst:494 +#: ../../library/calendar.rst:547 msgid "The invalid month number." msgstr "無效的月份號。" -#: ../../library/calendar.rst:499 +#: ../../library/calendar.rst:552 msgid "" "A subclass of :exc:`ValueError`, raised when the given weekday number is " "outside of the range 0-6 (inclusive)." msgstr "" ":exc:`ValueError` 的子類別,當給定的週幾的數字超出 0-6(含)範圍時引發。" -#: ../../library/calendar.rst:504 +#: ../../library/calendar.rst:557 msgid "The invalid weekday number." msgstr "無效的週幾編號。" -#: ../../library/calendar.rst:509 +#: ../../library/calendar.rst:562 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/calendar.rst:510 +#: ../../library/calendar.rst:563 msgid "" "Object-oriented interface to dates and times with similar functionality to " "the :mod:`time` module." msgstr "日期與時間的物件導向介面,和 :mod:`time` 模組有相似的功能。" -#: ../../library/calendar.rst:513 +#: ../../library/calendar.rst:566 msgid "Module :mod:`time`" msgstr ":mod:`time` 模組" -#: ../../library/calendar.rst:514 +#: ../../library/calendar.rst:567 msgid "Low-level time related functions." msgstr "底層的時間相關函式。" -#: ../../library/calendar.rst:520 +#: ../../library/calendar.rst:573 msgid "Command-Line Usage" msgstr "命令列用法" -#: ../../library/calendar.rst:524 +#: ../../library/calendar.rst:577 msgid "" "The :mod:`calendar` module can be executed as a script from the command line " "to interactively print a calendar." msgstr ":mod:`calendar` 模組可以作為腳本從命令列執行,並以互動方式列印日曆。" -#: ../../library/calendar.rst:527 +#: ../../library/calendar.rst:580 msgid "" "python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" @@ -656,11 +722,11 @@ msgstr "" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" " [-f FIRST_WEEKDAY] [year] [month]" -#: ../../library/calendar.rst:534 +#: ../../library/calendar.rst:587 msgid "For example, to print a calendar for the year 2000:" msgstr "例如,要列印 2000 年的日曆:" -#: ../../library/calendar.rst:536 +#: ../../library/calendar.rst:589 msgid "" "$ python -m calendar 2000\n" " 2000\n" @@ -738,40 +804,40 @@ msgstr "" "23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31\n" "30 31" -#: ../../library/calendar.rst:577 +#: ../../library/calendar.rst:630 msgid "The following options are accepted:" msgstr "接受以下選項:" -#: ../../library/calendar.rst:584 +#: ../../library/calendar.rst:637 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/calendar.rst:589 +#: ../../library/calendar.rst:642 msgid "The locale to use for month and weekday names. Defaults to English." msgstr "用於月份和週幾名稱的語系。預設為英語。" -#: ../../library/calendar.rst:595 +#: ../../library/calendar.rst:648 msgid "" -"The encoding to use for output. :option:`--encoding` is required if :option:" -"`--locale` is set." +"The encoding to use for output. :option:`--encoding` is required " +"if :option:`--locale` is set." msgstr "" "用於輸出的編碼。如有設定 :option:`--locale` 則必須給定 :option:`--encoding`。" -#: ../../library/calendar.rst:601 +#: ../../library/calendar.rst:654 msgid "Print the calendar to the terminal as text, or as an HTML document." msgstr "將日曆以文字或 HTML 文件的形式印出到終端機。" -#: ../../library/calendar.rst:607 +#: ../../library/calendar.rst:660 msgid "" "The weekday to start each week. Must be a number between 0 (Monday) and 6 " "(Sunday). Defaults to 0." msgstr "一週起始的日子。必須是 0(週一)到 6(週日)之間的數字。預設為 0。" -#: ../../library/calendar.rst:615 +#: ../../library/calendar.rst:668 msgid "The year to print the calendar for. Defaults to the current year." msgstr "印出日曆的年份。預設為當前年份。" -#: ../../library/calendar.rst:621 +#: ../../library/calendar.rst:674 msgid "" "The month of the specified :option:`year` to print the calendar for. Must be " "a number between 1 and 12, and may only be used in text mode. Defaults to " @@ -780,11 +846,11 @@ msgstr "" "要列印日曆的指定 :option:`year` 的月份。必須是 1 到 12 之間的數字,並且只能在" "文字模式下使用。預設列印全年日曆。" -#: ../../library/calendar.rst:627 +#: ../../library/calendar.rst:680 msgid "*Text-mode options:*" msgstr "*文字模式選項:*" -#: ../../library/calendar.rst:631 +#: ../../library/calendar.rst:684 msgid "" "The width of the date column in terminal columns. The date is printed " "centred in the column. Any value lower than 2 is ignored. Defaults to 2." @@ -792,7 +858,7 @@ msgstr "" "終端機行中日期行的寬度。日期印出在行的中央。任何小於 2 的值都會被忽略。預設" "為 2。" -#: ../../library/calendar.rst:639 +#: ../../library/calendar.rst:692 msgid "" "The number of lines for each week in terminal rows. The date is printed top-" "aligned. Any value lower than 1 is ignored. Defaults to 1." @@ -800,21 +866,21 @@ msgstr "" "終端機列中每週的列數。日期印出時頂部會對齊。任何小於 1 的值都會被忽略。預設" "為 1。" -#: ../../library/calendar.rst:647 +#: ../../library/calendar.rst:700 msgid "" "The space between months in columns. Any value lower than 2 is ignored. " "Defaults to 6." msgstr "行中月份之間的間距。任何小於 2 的值都會被忽略。預設為 6。" -#: ../../library/calendar.rst:654 +#: ../../library/calendar.rst:707 msgid "The number of months printed per row. Defaults to 3." msgstr "每列印出的月份數量。預設為 3。" -#: ../../library/calendar.rst:658 +#: ../../library/calendar.rst:711 msgid "*HTML-mode options:*" msgstr "*HTML 模式選項:*" -#: ../../library/calendar.rst:662 +#: ../../library/calendar.rst:715 msgid "" "The path of a CSS stylesheet to use for the calendar. This must either be " "relative to the generated HTML, or an absolute HTTP or ``file:///`` URL." diff --git a/library/collections.abc.po b/library/collections.abc.po index 0012205941..1edc583b3e 100644 --- a/library/collections.abc.po +++ b/library/collections.abc.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2025-01-07 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,8 +33,8 @@ msgstr "**原始碼:**\\ :source:`Lib/_collections_abc.py`" msgid "" "This module provides :term:`abstract base classes <abstract base class>` " "that can be used to test whether a class provides a particular interface; " -"for example, whether it is :term:`hashable` or whether it is a :term:" -"`mapping`." +"for example, whether it is :term:`hashable` or whether it is " +"a :term:`mapping`." msgstr "" #: ../../library/collections.abc.rst:27 @@ -105,9 +104,9 @@ msgstr "" msgid "" "In this example, class :class:`!D` does not need to define ``__contains__``, " "``__iter__``, and ``__reversed__`` because the :ref:`in-operator " -"<comparisons>`, the :term:`iteration <iterable>` logic, and the :func:" -"`reversed` function automatically fall back to using ``__getitem__`` and " -"``__len__``." +"<comparisons>`, the :term:`iteration <iterable>` logic, and " +"the :func:`reversed` function automatically fall back to using " +"``__getitem__`` and ``__len__``." msgstr "" #: ../../library/collections.abc.rst:82 @@ -232,7 +231,7 @@ msgstr ":class:`Generator` [1]_" msgid ":class:`Iterator`" msgstr ":class:`Iterator`" -#: ../../library/collections.abc.rst:128 ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:128 ../../library/collections.abc.rst:177 msgid "``send``, ``throw``" msgstr "``send``、``throw``" @@ -244,7 +243,7 @@ msgstr "``close``、``__iter__``、``__next__``" msgid ":class:`Sized` [1]_" msgstr ":class:`Sized` [1]_" -#: ../../library/collections.abc.rst:129 ../../library/collections.abc.rst:168 +#: ../../library/collections.abc.rst:129 msgid "``__len__``" msgstr "``__len__``" @@ -311,45 +310,47 @@ msgstr ":class:`ByteString`" msgid "Inherited :class:`Sequence` methods" msgstr "" -#: ../../library/collections.abc.rst:147 ../../library/collections.abc.rst:151 +#: ../../library/collections.abc.rst:147 ../../library/collections.abc.rst:152 msgid ":class:`Set`" msgstr ":class:`Set`" -#: ../../library/collections.abc.rst:147 ../../library/collections.abc.rst:157 +#: ../../library/collections.abc.rst:147 ../../library/collections.abc.rst:158 msgid ":class:`Collection`" msgstr ":class:`Collection`" #: ../../library/collections.abc.rst:147 msgid "" "``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, ``__gt__``, ``__ge__``, " -"``__and__``, ``__or__``, ``__sub__``, ``__xor__``, and ``isdisjoint``" +"``__and__``, ``__or__``, ``__sub__``, ``__rsub__``, ``__xor__``, " +"``__rxor__`` and ``isdisjoint``" msgstr "" "``__le__``、``__lt__``、``__eq__``、``__ne__``、``__gt__``、``__ge__``、" -"``__and__``、``__or__``、``__sub__``、``__xor__`` 與 ``isdisjoint``" +"``__and__``、``__or__``、``__sub__``、``__rsub__``、``__xor__``、" +"``__rxor__`` 和 ``isdisjoint``" -#: ../../library/collections.abc.rst:151 +#: ../../library/collections.abc.rst:152 msgid ":class:`MutableSet`" msgstr ":class:`MutableSet`" -#: ../../library/collections.abc.rst:151 +#: ../../library/collections.abc.rst:152 msgid "``__contains__``, ``__iter__``, ``__len__``, ``add``, ``discard``" msgstr "``__contains__``、``__iter__``、``__len__``、``add``、``discard``" -#: ../../library/collections.abc.rst:151 +#: ../../library/collections.abc.rst:152 msgid "" "Inherited :class:`Set` methods and ``clear``, ``pop``, ``remove``, " "``__ior__``, ``__iand__``, ``__ixor__``, and ``__isub__``" msgstr "" -#: ../../library/collections.abc.rst:157 ../../library/collections.abc.rst:161 +#: ../../library/collections.abc.rst:158 ../../library/collections.abc.rst:162 msgid ":class:`Mapping`" msgstr ":class:`Mapping`" -#: ../../library/collections.abc.rst:157 +#: ../../library/collections.abc.rst:158 msgid "``__getitem__``, ``__iter__``, ``__len__``" msgstr "``__getitem__``、``__iter__``、``__len__``" -#: ../../library/collections.abc.rst:157 +#: ../../library/collections.abc.rst:158 msgid "" "``__contains__``, ``keys``, ``items``, ``values``, ``get``, ``__eq__``, and " "``__ne__``" @@ -357,124 +358,128 @@ msgstr "" "``__contains__``、``keys``、``items``、``values``、``get``、``__eq__`` 和 " "``__ne__``" -#: ../../library/collections.abc.rst:161 +#: ../../library/collections.abc.rst:162 msgid ":class:`MutableMapping`" msgstr ":class:`MutableMapping`" -#: ../../library/collections.abc.rst:161 +#: ../../library/collections.abc.rst:162 msgid "" "``__getitem__``, ``__setitem__``, ``__delitem__``, ``__iter__``, ``__len__``" msgstr "" "``__getitem__``、``__setitem__``、``__delitem__``、``__iter__``、``__len__``" -#: ../../library/collections.abc.rst:161 +#: ../../library/collections.abc.rst:162 msgid "" "Inherited :class:`Mapping` methods and ``pop``, ``popitem``, ``clear``, " "``update``, and ``setdefault``" msgstr "" -#: ../../library/collections.abc.rst:168 +#: ../../library/collections.abc.rst:169 msgid ":class:`MappingView`" msgstr ":class:`MappingView`" -#: ../../library/collections.abc.rst:168 +#: ../../library/collections.abc.rst:169 msgid ":class:`Sized`" msgstr ":class:`Sized`" #: ../../library/collections.abc.rst:169 +msgid "``__init__``, ``__len__`` and ``__repr__``" +msgstr "``__init__``、``__len__`` 和 ``__repr__``" + +#: ../../library/collections.abc.rst:170 msgid ":class:`ItemsView`" msgstr ":class:`ItemsView`" -#: ../../library/collections.abc.rst:169 ../../library/collections.abc.rst:171 +#: ../../library/collections.abc.rst:170 ../../library/collections.abc.rst:172 msgid ":class:`MappingView`, :class:`Set`" msgstr ":class:`MappingView`、:class:`Set`" -#: ../../library/collections.abc.rst:169 ../../library/collections.abc.rst:171 -#: ../../library/collections.abc.rst:173 +#: ../../library/collections.abc.rst:170 ../../library/collections.abc.rst:172 +#: ../../library/collections.abc.rst:174 msgid "``__contains__``, ``__iter__``" msgstr "``__contains__``、``__iter__``" -#: ../../library/collections.abc.rst:171 +#: ../../library/collections.abc.rst:172 msgid ":class:`KeysView`" msgstr ":class:`KeysView`" -#: ../../library/collections.abc.rst:173 +#: ../../library/collections.abc.rst:174 msgid ":class:`ValuesView`" msgstr ":class:`ValuesView`" -#: ../../library/collections.abc.rst:173 +#: ../../library/collections.abc.rst:174 msgid ":class:`MappingView`, :class:`Collection`" msgstr ":class:`MappingView`、:class:`Collection`" -#: ../../library/collections.abc.rst:175 +#: ../../library/collections.abc.rst:176 msgid ":class:`Awaitable` [1]_" msgstr ":class:`Awaitable` [1]_" -#: ../../library/collections.abc.rst:175 +#: ../../library/collections.abc.rst:176 msgid "``__await__``" msgstr "``__await__``" -#: ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:177 msgid ":class:`Coroutine` [1]_" msgstr ":class:`Coroutine` [1]_" -#: ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:177 msgid ":class:`Awaitable`" msgstr ":class:`Awaitable`" -#: ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:177 msgid "``close``" msgstr "``close``" -#: ../../library/collections.abc.rst:177 +#: ../../library/collections.abc.rst:178 msgid ":class:`AsyncIterable` [1]_" msgstr ":class:`AsyncIterable` [1]_" -#: ../../library/collections.abc.rst:177 ../../library/collections.abc.rst:178 +#: ../../library/collections.abc.rst:178 ../../library/collections.abc.rst:179 msgid "``__aiter__``" msgstr "``__aiter__``" -#: ../../library/collections.abc.rst:178 +#: ../../library/collections.abc.rst:179 msgid ":class:`AsyncIterator` [1]_" msgstr ":class:`AsyncIterator` [1]_" -#: ../../library/collections.abc.rst:178 +#: ../../library/collections.abc.rst:179 msgid ":class:`AsyncIterable`" msgstr ":class:`AsyncIterable`" -#: ../../library/collections.abc.rst:178 +#: ../../library/collections.abc.rst:179 msgid "``__anext__``" msgstr "``__anext__``" -#: ../../library/collections.abc.rst:179 +#: ../../library/collections.abc.rst:180 msgid ":class:`AsyncGenerator` [1]_" msgstr ":class:`AsyncGenerator` [1]_" -#: ../../library/collections.abc.rst:179 +#: ../../library/collections.abc.rst:180 msgid ":class:`AsyncIterator`" msgstr ":class:`AsyncIterator`" -#: ../../library/collections.abc.rst:179 +#: ../../library/collections.abc.rst:180 msgid "``asend``, ``athrow``" msgstr "``asend``、``athrow``" -#: ../../library/collections.abc.rst:179 +#: ../../library/collections.abc.rst:180 msgid "``aclose``, ``__aiter__``, ``__anext__``" msgstr "``aclose``、``__aiter__``、``__anext__``" -#: ../../library/collections.abc.rst:180 +#: ../../library/collections.abc.rst:181 msgid ":class:`Buffer` [1]_" msgstr ":class:`Buffer` [1]_" -#: ../../library/collections.abc.rst:180 +#: ../../library/collections.abc.rst:181 msgid "``__buffer__``" msgstr "``__buffer__``" -#: ../../library/collections.abc.rst:185 +#: ../../library/collections.abc.rst:186 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" -#: ../../library/collections.abc.rst:186 +#: ../../library/collections.abc.rst:187 msgid "" "These ABCs override :meth:`~abc.ABCMeta.__subclasshook__` to support testing " "an interface by verifying the required methods are present and have not been " @@ -482,211 +487,214 @@ msgid "" "interfaces require registration or direct subclassing." msgstr "" -#: ../../library/collections.abc.rst:192 +#: ../../library/collections.abc.rst:193 msgid "" "Checking ``isinstance(obj, Iterable)`` detects classes that are registered " "as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but " "it does not detect classes that iterate with the :meth:`~object.__getitem__` " -"method. The only reliable way to determine whether an object is :term:" -"`iterable` is to call ``iter(obj)``." +"method. The only reliable way to determine whether an object " +"is :term:`iterable` is to call ``iter(obj)``." msgstr "" -#: ../../library/collections.abc.rst:200 +#: ../../library/collections.abc.rst:201 msgid "Collections Abstract Base Classes -- Detailed Descriptions" msgstr "" -#: ../../library/collections.abc.rst:205 +#: ../../library/collections.abc.rst:206 msgid "ABC for classes that provide the :meth:`~object.__contains__` method." msgstr "" -#: ../../library/collections.abc.rst:209 +#: ../../library/collections.abc.rst:210 msgid "ABC for classes that provide the :meth:`~object.__hash__` method." msgstr "" -#: ../../library/collections.abc.rst:213 +#: ../../library/collections.abc.rst:214 msgid "ABC for classes that provide the :meth:`~object.__len__` method." msgstr "" -#: ../../library/collections.abc.rst:217 +#: ../../library/collections.abc.rst:218 msgid "ABC for classes that provide the :meth:`~object.__call__` method." msgstr "" -#: ../../library/collections.abc.rst:219 +#: ../../library/collections.abc.rst:220 msgid "" "See :ref:`annotating-callables` for details on how to use :class:`!Callable` " "in type annotations." msgstr "" -#: ../../library/collections.abc.rst:224 +#: ../../library/collections.abc.rst:225 msgid "ABC for classes that provide the :meth:`~container.__iter__` method." msgstr "" -#: ../../library/collections.abc.rst:226 +#: ../../library/collections.abc.rst:227 msgid "" "Checking ``isinstance(obj, Iterable)`` detects classes that are registered " "as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but " "it does not detect classes that iterate with the :meth:`~object.__getitem__` " -"method. The only reliable way to determine whether an object is :term:" -"`iterable` is to call ``iter(obj)``." +"method. The only reliable way to determine whether an object " +"is :term:`iterable` is to call ``iter(obj)``." msgstr "" -#: ../../library/collections.abc.rst:235 +#: ../../library/collections.abc.rst:236 msgid "ABC for sized iterable container classes." msgstr "" -#: ../../library/collections.abc.rst:241 +#: ../../library/collections.abc.rst:242 msgid "" -"ABC for classes that provide the :meth:`~iterator.__iter__` and :meth:" -"`~iterator.__next__` methods. See also the definition of :term:`iterator`." +"ABC for classes that provide the :meth:`~iterator.__iter__` " +"and :meth:`~iterator.__next__` methods. See also the definition " +"of :term:`iterator`." msgstr "" -#: ../../library/collections.abc.rst:247 +#: ../../library/collections.abc.rst:248 msgid "" "ABC for iterable classes that also provide the :meth:`~object.__reversed__` " "method." msgstr "" -#: ../../library/collections.abc.rst:254 +#: ../../library/collections.abc.rst:255 msgid "" -"ABC for :term:`generator` classes that implement the protocol defined in :" -"pep:`342` that extends :term:`iterators <iterator>` with the :meth:" -"`~generator.send`, :meth:`~generator.throw` and :meth:`~generator.close` " -"methods." +"ABC for :term:`generator` classes that implement the protocol defined " +"in :pep:`342` that extends :term:`iterators <iterator>` with " +"the :meth:`~generator.send`, :meth:`~generator.throw` " +"and :meth:`~generator.close` methods." msgstr "" -#: ../../library/collections.abc.rst:259 +#: ../../library/collections.abc.rst:260 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`!Generator` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`!Generator` in type annotations." msgstr "" -#: ../../library/collections.abc.rst:268 +#: ../../library/collections.abc.rst:269 msgid "ABCs for read-only and mutable :term:`sequences <sequence>`." msgstr "" -#: ../../library/collections.abc.rst:270 +#: ../../library/collections.abc.rst:271 msgid "" -"Implementation note: Some of the mixin methods, such as :meth:`~container." -"__iter__`, :meth:`~object.__reversed__` and :meth:`index`, make repeated " -"calls to the underlying :meth:`~object.__getitem__` method. Consequently, " +"Implementation note: Some of the mixin methods, such " +"as :meth:`~container.__iter__`, :meth:`~object.__reversed__` " +"and :meth:`index`, make repeated calls to the " +"underlying :meth:`~object.__getitem__` method. Consequently, " "if :meth:`~object.__getitem__` is implemented with constant access speed, " "the mixin methods will have linear performance; however, if the underlying " "method is linear (as it would be with a linked list), the mixins will have " "quadratic performance and will likely need to be overridden." msgstr "" -#: ../../library/collections.abc.rst:279 +#: ../../library/collections.abc.rst:280 msgid "The index() method added support for *stop* and *start* arguments." msgstr "" -#: ../../library/collections.abc.rst:283 +#: ../../library/collections.abc.rst:284 msgid "" "The :class:`ByteString` ABC has been deprecated. For use in typing, prefer a " "union, like ``bytes | bytearray``, or :class:`collections.abc.Buffer`. For " "use as an ABC, prefer :class:`Sequence` or :class:`collections.abc.Buffer`." msgstr "" -#: ../../library/collections.abc.rst:292 +#: ../../library/collections.abc.rst:293 msgid "ABCs for read-only and mutable :ref:`sets <types-set>`." msgstr "" -#: ../../library/collections.abc.rst:297 +#: ../../library/collections.abc.rst:298 msgid "ABCs for read-only and mutable :term:`mappings <mapping>`." msgstr "" -#: ../../library/collections.abc.rst:304 +#: ../../library/collections.abc.rst:305 msgid "" "ABCs for mapping, items, keys, and values :term:`views <dictionary view>`." msgstr "" -#: ../../library/collections.abc.rst:308 +#: ../../library/collections.abc.rst:309 msgid "" "ABC for :term:`awaitable` objects, which can be used in :keyword:`await` " -"expressions. Custom implementations must provide the :meth:`~object." -"__await__` method." +"expressions. Custom implementations must provide " +"the :meth:`~object.__await__` method." msgstr "" -#: ../../library/collections.abc.rst:312 +#: ../../library/collections.abc.rst:313 msgid "" -":term:`Coroutine <coroutine>` objects and instances of the :class:" -"`~collections.abc.Coroutine` ABC are all instances of this ABC." +":term:`Coroutine <coroutine>` objects and instances of " +"the :class:`~collections.abc.Coroutine` ABC are all instances of this ABC." msgstr "" -#: ../../library/collections.abc.rst:316 +#: ../../library/collections.abc.rst:317 msgid "" "In CPython, generator-based coroutines (:term:`generators <generator>` " "decorated with :func:`@types.coroutine <types.coroutine>`) are *awaitables*, " "even though they do not have an :meth:`~object.__await__` method. Using " -"``isinstance(gencoro, Awaitable)`` for them will return ``False``. Use :func:" -"`inspect.isawaitable` to detect them." +"``isinstance(gencoro, Awaitable)`` for them will return ``False``. " +"Use :func:`inspect.isawaitable` to detect them." msgstr "" -#: ../../library/collections.abc.rst:326 +#: ../../library/collections.abc.rst:327 msgid "" "ABC for :term:`coroutine` compatible classes. These implement the following " -"methods, defined in :ref:`coroutine-objects`: :meth:`~coroutine.send`, :meth:" -"`~coroutine.throw`, and :meth:`~coroutine.close`. Custom implementations " -"must also implement :meth:`~object.__await__`. All :class:`Coroutine` " -"instances are also instances of :class:`Awaitable`." +"methods, defined in :ref:`coroutine-" +"objects`: :meth:`~coroutine.send`, :meth:`~coroutine.throw`, " +"and :meth:`~coroutine.close`. Custom implementations must also " +"implement :meth:`~object.__await__`. All :class:`Coroutine` instances are " +"also instances of :class:`Awaitable`." msgstr "" -#: ../../library/collections.abc.rst:334 +#: ../../library/collections.abc.rst:335 msgid "" "In CPython, generator-based coroutines (:term:`generators <generator>` " "decorated with :func:`@types.coroutine <types.coroutine>`) are *awaitables*, " "even though they do not have an :meth:`~object.__await__` method. Using " -"``isinstance(gencoro, Coroutine)`` for them will return ``False``. Use :func:" -"`inspect.isawaitable` to detect them." +"``isinstance(gencoro, Coroutine)`` for them will return ``False``. " +"Use :func:`inspect.isawaitable` to detect them." msgstr "" -#: ../../library/collections.abc.rst:340 +#: ../../library/collections.abc.rst:341 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`!Coroutine` in type annotations. The variance and order of type parameters " -"correspond to those of :class:`Generator`." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`!Coroutine` in type annotations. The variance and order of " +"type parameters correspond to those of :class:`Generator`." msgstr "" -#: ../../library/collections.abc.rst:349 +#: ../../library/collections.abc.rst:350 msgid "" "ABC for classes that provide an ``__aiter__`` method. See also the " "definition of :term:`asynchronous iterable`." msgstr "" -#: ../../library/collections.abc.rst:356 +#: ../../library/collections.abc.rst:357 msgid "" "ABC for classes that provide ``__aiter__`` and ``__anext__`` methods. See " "also the definition of :term:`asynchronous iterator`." msgstr "" -#: ../../library/collections.abc.rst:363 +#: ../../library/collections.abc.rst:364 msgid "" "ABC for :term:`asynchronous generator` classes that implement the protocol " "defined in :pep:`525` and :pep:`492`." msgstr "" -#: ../../library/collections.abc.rst:366 +#: ../../library/collections.abc.rst:367 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`!AsyncGenerator` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`!AsyncGenerator` in type annotations." msgstr "" -#: ../../library/collections.abc.rst:373 +#: ../../library/collections.abc.rst:374 msgid "" "ABC for classes that provide the :meth:`~object.__buffer__` method, " "implementing the :ref:`buffer protocol <bufferobjects>`. See :pep:`688`." msgstr "" -#: ../../library/collections.abc.rst:379 +#: ../../library/collections.abc.rst:380 msgid "Examples and Recipes" msgstr "" -#: ../../library/collections.abc.rst:381 +#: ../../library/collections.abc.rst:382 msgid "" "ABCs allow us to ask classes or instances if they provide particular " "functionality, for example::" msgstr "" -#: ../../library/collections.abc.rst:384 +#: ../../library/collections.abc.rst:385 msgid "" "size = None\n" "if isinstance(myvar, collections.abc.Sized):\n" @@ -696,17 +704,18 @@ msgstr "" "if isinstance(myvar, collections.abc.Sized):\n" " size = len(myvar)" -#: ../../library/collections.abc.rst:388 +#: ../../library/collections.abc.rst:389 msgid "" "Several of the ABCs are also useful as mixins that make it easier to develop " "classes supporting container APIs. For example, to write a class supporting " "the full :class:`Set` API, it is only necessary to supply the three " -"underlying abstract methods: :meth:`~object.__contains__`, :meth:`~container." -"__iter__`, and :meth:`~object.__len__`. The ABC supplies the remaining " -"methods such as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" +"underlying abstract " +"methods: :meth:`~object.__contains__`, :meth:`~container.__iter__`, " +"and :meth:`~object.__len__`. The ABC supplies the remaining methods such " +"as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" msgstr "" -#: ../../library/collections.abc.rst:395 +#: ../../library/collections.abc.rst:396 msgid "" "class ListBasedSet(collections.abc.Set):\n" " ''' Alternate set implementation favoring space over speed\n" @@ -732,31 +741,31 @@ msgid "" "automatically" msgstr "" -#: ../../library/collections.abc.rst:417 +#: ../../library/collections.abc.rst:418 msgid "Notes on using :class:`Set` and :class:`MutableSet` as a mixin:" msgstr "" -#: ../../library/collections.abc.rst:420 +#: ../../library/collections.abc.rst:421 msgid "" "Since some set operations create new sets, the default mixin methods need a " "way to create new instances from an :term:`iterable`. The class constructor " "is assumed to have a signature in the form ``ClassName(iterable)``. That " -"assumption is factored-out to an internal :class:`classmethod` called :meth:" -"`!_from_iterable` which calls ``cls(iterable)`` to produce a new set. If " -"the :class:`Set` mixin is being used in a class with a different constructor " -"signature, you will need to override :meth:`!_from_iterable` with a " -"classmethod or regular method that can construct new instances from an " -"iterable argument." +"assumption is factored-out to an internal :class:`classmethod` " +"called :meth:`!_from_iterable` which calls ``cls(iterable)`` to produce a " +"new set. If the :class:`Set` mixin is being used in a class with a different " +"constructor signature, you will need to override :meth:`!_from_iterable` " +"with a classmethod or regular method that can construct new instances from " +"an iterable argument." msgstr "" -#: ../../library/collections.abc.rst:431 +#: ../../library/collections.abc.rst:432 msgid "" "To override the comparisons (presumably for speed, as the semantics are " "fixed), redefine :meth:`~object.__le__` and :meth:`~object.__ge__`, then the " "other operations will automatically follow suit." msgstr "" -#: ../../library/collections.abc.rst:437 +#: ../../library/collections.abc.rst:438 msgid "" "The :class:`Set` mixin provides a :meth:`!_hash` method to compute a hash " "value for the set; however, :meth:`~object.__hash__` is not defined because " @@ -765,12 +774,12 @@ msgid "" "define ``__hash__ = Set._hash``." msgstr "" -#: ../../library/collections.abc.rst:445 +#: ../../library/collections.abc.rst:446 msgid "" "`OrderedSet recipe <https://code.activestate.com/recipes/576694/>`_ for an " "example built on :class:`MutableSet`." msgstr "" -#: ../../library/collections.abc.rst:448 +#: ../../library/collections.abc.rst:449 msgid "For more about ABCs, see the :mod:`abc` module and :pep:`3119`." msgstr "關於 ABC 的更多資訊請見 :mod:`abc` module 和 :pep:`3119`。" diff --git a/library/datetime.po b/library/datetime.po index 5fcda8bc81..d1b39481c8 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-15 00:14+0000\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: 2023-08-07 10:20+0800\n" "Last-Translator: Griiid <gridwing@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1493,7 +1493,7 @@ msgid "" msgstr "" #: ../../library/datetime.rst:940 -msgid "Use :meth:`datetime.now` with :attr:`UTC` instead." +msgid "Use :meth:`datetime.now` with :const:`UTC` instead." msgstr "" #: ../../library/datetime.rst:945 @@ -1593,7 +1593,7 @@ msgid "" msgstr "" #: ../../library/datetime.rst:1012 -msgid "Use :meth:`datetime.fromtimestamp` with :attr:`UTC` instead." +msgid "Use :meth:`datetime.fromtimestamp` with :const:`UTC` instead." msgstr "" #: ../../library/datetime.rst:1017 diff --git a/library/decimal.po b/library/decimal.po index 0ab719a400..0563622d36 100644 --- a/library/decimal.po +++ b/library/decimal.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2810,7 +2810,7 @@ msgstr "" #: ../../library/decimal.rst:2248 msgid "" -"For inexact results, :attr:`MAX_PREC` is far too large on 64-bit platforms " +"For inexact results, :const:`MAX_PREC` is far too large on 64-bit platforms " "and the available memory will be insufficient::" msgstr "" diff --git a/library/email.contentmanager.po b/library/email.contentmanager.po index a03eead9b1..3ecae14486 100644 --- a/library/email.contentmanager.po +++ b/library/email.contentmanager.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-01-19 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -218,10 +218,19 @@ msgstr "" #: ../../library/email.contentmanager.rst:159 msgid "" "For ``str`` objects, if *cte* is not set use heuristics to determine the " -"most compact encoding." +"most compact encoding. Prior to encoding, :meth:`str.splitlines` is used to " +"normalize all line boundaries, ensuring that each line of the payload is " +"terminated by the current policy's :data:`~email.policy.Policy.linesep` " +"property (even if the original string did not end with one)." msgstr "" -#: ../../library/email.contentmanager.rst:161 +#: ../../library/email.contentmanager.rst:165 +msgid "" +"For ``bytes`` objects, *cte* is taken to be base64 if not set, and the " +"aforementioned newline translation is not performed." +msgstr "" + +#: ../../library/email.contentmanager.rst:167 msgid "" "For :class:`~email.message.EmailMessage`, per :rfc:`2046`, raise an error if " "a *cte* of ``quoted-printable`` or ``base64`` is requested for *subtype* " @@ -230,14 +239,14 @@ msgid "" "For all other values of *subtype*, use ``7bit``." msgstr "" -#: ../../library/email.contentmanager.rst:168 +#: ../../library/email.contentmanager.rst:174 msgid "" "A *cte* of ``binary`` does not actually work correctly yet. The " "``EmailMessage`` object as modified by ``set_content`` is correct, but :" "class:`~email.generator.BytesGenerator` does not serialize it correctly." msgstr "" -#: ../../library/email.contentmanager.rst:173 +#: ../../library/email.contentmanager.rst:179 msgid "" "If *disposition* is set, use it as the value of the :mailheader:`Content-" "Disposition` header. If not specified, and *filename* is specified, add the " @@ -246,37 +255,37 @@ msgid "" "values for *disposition* are ``attachment`` and ``inline``." msgstr "" -#: ../../library/email.contentmanager.rst:180 +#: ../../library/email.contentmanager.rst:186 msgid "" "If *filename* is specified, use it as the value of the ``filename`` " "parameter of the :mailheader:`Content-Disposition` header." msgstr "" -#: ../../library/email.contentmanager.rst:183 +#: ../../library/email.contentmanager.rst:189 msgid "" "If *cid* is specified, add a :mailheader:`Content-ID` header with *cid* as " "its value." msgstr "" -#: ../../library/email.contentmanager.rst:186 +#: ../../library/email.contentmanager.rst:192 msgid "" "If *params* is specified, iterate its ``items`` method and use the resulting " "``(key, value)`` pairs to set additional parameters on the :mailheader:" "`Content-Type` header." msgstr "" -#: ../../library/email.contentmanager.rst:190 +#: ../../library/email.contentmanager.rst:196 msgid "" "If *headers* is specified and is a list of strings of the form ``headername: " "headervalue`` or a list of ``header`` objects (distinguished from strings by " "having a ``name`` attribute), add the headers to *msg*." msgstr "" -#: ../../library/email.contentmanager.rst:197 +#: ../../library/email.contentmanager.rst:203 msgid "Footnotes" msgstr "註解" -#: ../../library/email.contentmanager.rst:198 +#: ../../library/email.contentmanager.rst:204 msgid "" "Originally added in 3.4 as a :term:`provisional module <provisional package>`" msgstr "" diff --git a/library/email.policy.po b/library/email.policy.po index 20f6c5e82b..526811754f 100644 --- a/library/email.policy.po +++ b/library/email.policy.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-01-06 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -355,7 +355,7 @@ msgstr "" #: ../../library/email.policy.rst:268 msgid "" "Handle a *defect* found on *obj*. When the email package calls this method, " -"*defect* will always be a subclass of :class:`~email.errors.Defect`." +"*defect* will always be a subclass of :class:`~email.errors.MessageDefect`." msgstr "" #: ../../library/email.policy.rst:272 @@ -368,7 +368,7 @@ msgstr "" #: ../../library/email.policy.rst:279 msgid "" "Register a *defect* on *obj*. In the email package, *defect* will always be " -"a subclass of :class:`~email.errors.Defect`." +"a subclass of :class:`~email.errors.MessageDefect`." msgstr "" #: ../../library/email.policy.rst:282 diff --git a/library/errno.po b/library/errno.po index 0d41f0a9c6..8da2253e03 100644 --- a/library/errno.po +++ b/library/errno.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-01-29 00:13+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -581,24 +581,128 @@ msgstr "" msgid "Interface output queue is full" msgstr "" -#: ../../library/errno.rst:670 +#: ../../library/errno.rst:671 +msgid "No medium found" +msgstr "" + +#: ../../library/errno.rst:676 +msgid "Wrong medium type" +msgstr "" + +#: ../../library/errno.rst:681 +msgid "Required key not available" +msgstr "" + +#: ../../library/errno.rst:686 +msgid "Key has expired" +msgstr "" + +#: ../../library/errno.rst:691 +msgid "Key has been revoked" +msgstr "" + +#: ../../library/errno.rst:696 +msgid "Key was rejected by service" +msgstr "" + +#: ../../library/errno.rst:701 +msgid "Operation not possible due to RF-kill" +msgstr "" + +#: ../../library/errno.rst:706 +msgid "Locked lock was unmapped" +msgstr "" + +#: ../../library/errno.rst:711 +msgid "Facility is not active" +msgstr "" + +#: ../../library/errno.rst:716 +msgid "Authentication error" +msgstr "" + +#: ../../library/errno.rst:723 +msgid "Bad CPU type in executable" +msgstr "" + +#: ../../library/errno.rst:730 +msgid "Bad executable (or shared library)" +msgstr "" + +#: ../../library/errno.rst:737 +msgid "Malformed Mach-o file" +msgstr "" + +#: ../../library/errno.rst:744 +msgid "Device error" +msgstr "" + +#: ../../library/errno.rst:751 +msgid "Inappropriate file type or format" +msgstr "" + +#: ../../library/errno.rst:758 +msgid "Need authenticator" +msgstr "" + +#: ../../library/errno.rst:765 +msgid "Attribute not found" +msgstr "" + +#: ../../library/errno.rst:772 +msgid "Policy not found" +msgstr "" + +#: ../../library/errno.rst:779 +msgid "Too many processes" +msgstr "" + +#: ../../library/errno.rst:786 +msgid "Bad procedure for program" +msgstr "" + +#: ../../library/errno.rst:793 +msgid "Program version wrong" +msgstr "" + +#: ../../library/errno.rst:800 +msgid "RPC prog. not avail" +msgstr "" + +#: ../../library/errno.rst:807 +msgid "Device power is off" +msgstr "" + +#: ../../library/errno.rst:814 +msgid "RPC struct is bad" +msgstr "" + +#: ../../library/errno.rst:821 +msgid "RPC version wrong" +msgstr "" + +#: ../../library/errno.rst:828 +msgid "Shared library version mismatch" +msgstr "" + +#: ../../library/errno.rst:835 msgid "" "Capabilities insufficient. This error is mapped to the exception :exc:" "`PermissionError`." msgstr "" -#: ../../library/errno.rst:673 +#: ../../library/errno.rst:838 msgid "Availability" msgstr "" -#: ../../library/errno.rst:680 +#: ../../library/errno.rst:845 msgid "Operation canceled" msgstr "" -#: ../../library/errno.rst:687 +#: ../../library/errno.rst:852 msgid "Owner died" msgstr "" -#: ../../library/errno.rst:694 +#: ../../library/errno.rst:859 msgid "State not recoverable" msgstr "" diff --git a/library/exceptions.po b/library/exceptions.po index b413eabffe..c3f246ac87 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-04 00:13+0000\n" "PO-Revision-Date: 2024-12-20 16:57+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,12 +24,13 @@ msgstr "內建的例外" #: ../../library/exceptions.rst:10 msgid "" -"In Python, all exceptions must be instances of a class that derives from :" -"class:`BaseException`. In a :keyword:`try` statement with an :keyword:" -"`except` clause that mentions a particular class, that clause also handles " -"any exception classes derived from that class (but not exception classes " -"from which *it* is derived). Two exception classes that are not related via " -"subclassing are never equivalent, even if they have the same name." +"In Python, all exceptions must be instances of a class that derives " +"from :class:`BaseException`. In a :keyword:`try` statement with " +"an :keyword:`except` clause that mentions a particular class, that clause " +"also handles any exception classes derived from that class (but not " +"exception classes from which *it* is derived). Two exception classes that " +"are not related via subclassing are never equivalent, even if they have the " +"same name." msgstr "" "在 Python 中,所有例外必須是從 :class:`BaseException` 衍生的類別的實例。在陳" "述式 :keyword:`try` 搭配 :keyword:`except` 子句裡提到一個特定的類別時,那個子" @@ -67,10 +67,10 @@ msgstr "" #: ../../library/exceptions.rst:31 msgid "" "The built-in exception classes can be subclassed to define new exceptions; " -"programmers are encouraged to derive new exceptions from the :exc:" -"`Exception` class or one of its subclasses, and not from :exc:" -"`BaseException`. More information on defining exceptions is available in " -"the Python Tutorial under :ref:`tut-userexceptions`." +"programmers are encouraged to derive new exceptions from " +"the :exc:`Exception` class or one of its subclasses, and not " +"from :exc:`BaseException`. More information on defining exceptions is " +"available in the Python Tutorial under :ref:`tut-userexceptions`." msgstr "" "可以從內建的例外類別定義新的例外子類別;程式設計師被鼓勵從 :exc:`Exception` " "類別或其子類別衍生新的例外,而不是從 :exc:`BaseException` 來衍生。更多關於定" @@ -90,13 +90,13 @@ msgstr "三個例外物件上的屬性提供關於引發此例外的情境的資 msgid "" "When raising a new exception while another exception is already being " "handled, the new exception's :attr:`!__context__` attribute is automatically " -"set to the handled exception. An exception may be handled when an :keyword:" -"`except` or :keyword:`finally` clause, or a :keyword:`with` statement, is " -"used." +"set to the handled exception. An exception may be handled when " +"an :keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` " +"statement, is used." msgstr "" "當引發一個新的例外而同時有另一個例外已經正在被處理時,這個新例外的 :attr:`!" -"__context__` 屬性會自動被設成那個已處理的例外。當使用 :keyword:`except` 或 :" -"keyword:`finally` 子句或 :keyword:`with` 陳述式的時候例外會被處理。" +"__context__` 屬性會自動被設成那個已處理的例外。當使用 :keyword:`except` " +"或 :keyword:`finally` 子句或 :keyword:`with` 陳述式的時候例外會被處理。" #: ../../library/exceptions.rst:59 msgid "" @@ -122,11 +122,11 @@ msgid "" "introspection when debugging." msgstr "" "在 :keyword:`from<raise>` 後面的運算式必須是一個例外或 ``None``。它將會被設定" -"成所引發例外的 :attr:`!__cause__`。設定 :attr:`!__cause__` 也隱含地設定 :" -"attr:`!__suppress_context__` 屬性為 ``True``,因此使用 ``raise new_exc from " -"None`` 實際上會以新的例外取代舊的例外以利於顯示(例如轉換 :exc:`KeyError` " -"為 :exc:`AttributeError`),同時保持舊的例外可以透過 :attr:`!__context__` 取" -"得以方便 debug 的時候檢查。" +"成所引發例外的 :attr:`!__cause__`。設定 :attr:`!__cause__` 也隱含地設" +"定 :attr:`!__suppress_context__` 屬性為 ``True``,因此使用 ``raise new_exc " +"from None`` 實際上會以新的例外取代舊的例外以利於顯示(例如轉" +"換 :exc:`KeyError` 為 :exc:`AttributeError`),同時保持舊的例外可以透" +"過 :attr:`!__context__` 取得以方便 debug 的時候檢查。" #: ../../library/exceptions.rst:74 msgid "" @@ -168,17 +168,18 @@ msgstr "" #: ../../library/exceptions.rst:95 msgid "" -"Most built-in exceptions are implemented in C for efficiency, see: :source:" -"`Objects/exceptions.c`. Some have custom memory layouts which makes it " -"impossible to create a subclass that inherits from multiple exception types. " -"The memory layout of a type is an implementation detail and might change " -"between Python versions, leading to new conflicts in the future. Therefore, " -"it's recommended to avoid subclassing multiple exception types altogether." +"Most built-in exceptions are implemented in C for efficiency, " +"see: :source:`Objects/exceptions.c`. Some have custom memory layouts which " +"makes it impossible to create a subclass that inherits from multiple " +"exception types. The memory layout of a type is an implementation detail and " +"might change between Python versions, leading to new conflicts in the " +"future. Therefore, it's recommended to avoid subclassing multiple exception " +"types altogether." msgstr "" -"為了效率,大部分的內建例外使用 C 來實作,參考 :source:`Objects/exceptions." -"c`。一些例外有客製化的記憶體佈局,使其不可能建立一個繼承多種例外型別的子類" -"別。型別的記憶體佈局是實作細節且可能會在不同 Python 版本間改變,造成未來新的" -"衝突。因此,總之建議避免繼承多種例外型別。" +"為了效率,大部分的內建例外使用 C 來實作,參考 :source:`Objects/" +"exceptions.c`。一些例外有客製化的記憶體佈局,使其不可能建立一個繼承多種例外型" +"別的子類別。型別的記憶體佈局是實作細節且可能會在不同 Python 版本間改變,造成" +"未來新的衝突。因此,總之建議避免繼承多種例外型別。" #: ../../library/exceptions.rst:105 msgid "Base classes" @@ -193,14 +194,14 @@ msgstr "以下的例外大部分被用在當作其他例外的基底類別。" #: ../../library/exceptions.rst:111 msgid "" "The base class for all built-in exceptions. It is not meant to be directly " -"inherited by user-defined classes (for that, use :exc:`Exception`). If :" -"func:`str` is called on an instance of this class, the representation of the " -"argument(s) to the instance are returned, or the empty string when there " +"inherited by user-defined classes (for that, use :exc:`Exception`). " +"If :func:`str` is called on an instance of this class, the representation of " +"the argument(s) to the instance are returned, or the empty string when there " "were no arguments." msgstr "" -"所有內建例外的基底類別。這不是為了讓使用者定義的類別直接繼承(可以使用 :exc:" -"`Exception`)。如果在這個類別的實例上呼叫 :func:`str`,會回傳實例的引數的表" -"示,或者沒有引數的時候會回傳空字串。" +"所有內建例外的基底類別。這不是為了讓使用者定義的類別直接繼承(可以使" +"用 :exc:`Exception`)。如果在這個類別的實例上呼叫 :func:`str`,會回傳實例的引" +"數的表示,或者沒有引數的時候會回傳空字串。" #: ../../library/exceptions.rst:119 msgid "" @@ -263,8 +264,9 @@ msgstr "" #: ../../library/exceptions.rst:157 msgid "" -"A list of the notes of this exception, which were added with :meth:" -"`add_note`. This attribute is created when :meth:`add_note` is called." +"A list of the notes of this exception, which were added " +"with :meth:`add_note`. This attribute is created when :meth:`add_note` is " +"called." msgstr "" "該例外的備註串列,使用 :meth:`add_note` 來新增。此屬性在 :meth:`add_note` 被" "呼叫的時候建立。" @@ -280,11 +282,12 @@ msgstr "" #: ../../library/exceptions.rst:171 msgid "" "The base class for those built-in exceptions that are raised for various " -"arithmetic errors: :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:" -"`FloatingPointError`." +"arithmetic " +"errors: :exc:`OverflowError`, :exc:`ZeroDivisionError`, :exc:`FloatingPointError`." msgstr "" -"各種運算錯誤所引發的那些內建例外::exc:`OverflowError`、:exc:" -"`ZeroDivisionError`、:exc:`FloatingPointError` 的基底類別。" +"各種運算錯誤所引發的那些內建例" +"外::exc:`OverflowError`、:exc:`ZeroDivisionError`、:exc:`FloatingPointError` " +"的基底類別。" #: ../../library/exceptions.rst:178 msgid "" @@ -300,8 +303,9 @@ msgid "" "on a mapping or sequence is invalid: :exc:`IndexError`, :exc:`KeyError`. " "This can be raised directly by :func:`codecs.lookup`." msgstr "" -"當使用在對映或序列上的鍵或索引是無效的時候所引發的例外::exc:`IndexError`、:" -"exc:`KeyError` 的基底類別。這可以被 :func:`codecs.lookup` 直接引發。" +"當使用在對映或序列上的鍵或索引是無效的時候所引發的例" +"外::exc:`IndexError`、:exc:`KeyError` 的基底類別。這可以" +"被 :func:`codecs.lookup` 直接引發。" #: ../../library/exceptions.rst:190 msgid "Concrete exceptions" @@ -342,8 +346,9 @@ msgstr "新增 :attr:`name` 與 :attr:`obj` 屬性。" #: ../../library/exceptions.rst:217 msgid "" "Raised when the :func:`input` function hits an end-of-file condition (EOF) " -"without reading any data. (N.B.: the :meth:`io.IOBase.read` and :meth:`io." -"IOBase.readline` methods return an empty string when they hit EOF.)" +"without reading any data. (N.B.: the :meth:`io.IOBase.read` " +"and :meth:`io.IOBase.readline` methods return an empty string when they hit " +"EOF.)" msgstr "" "當 :func:`input` 函式在沒有讀到任何資料而到達檔案結尾 (end-of-file, EOF) 條件" "的時候被引發。(注意::meth:`io.IOBase.read` 和 :meth:`io.IOBase.readline` 方" @@ -355,14 +360,15 @@ msgstr "目前沒有被使用。" #: ../../library/exceptions.rst:229 msgid "" -"Raised when a :term:`generator` or :term:`coroutine` is closed; see :meth:" -"`generator.close` and :meth:`coroutine.close`. It directly inherits from :" -"exc:`BaseException` instead of :exc:`Exception` since it is technically not " -"an error." +"Raised when a :term:`generator` or :term:`coroutine` is closed; " +"see :meth:`generator.close` and :meth:`coroutine.close`. It directly " +"inherits from :exc:`BaseException` instead of :exc:`Exception` since it is " +"technically not an error." msgstr "" -"當 :term:`generator` 或 :term:`coroutine` 被關閉的時候被引發;參考 :meth:" -"`generator.close` 和 :meth:`coroutine.close`。此例外直接繼承自 :exc:" -"`BaseException` 而不是 :exc:`Exception`,因為技術上來說這不是一個錯誤。" +"當 :term:`generator` 或 :term:`coroutine` 被關閉的時候被引發;參" +"考 :meth:`generator.close` 和 :meth:`coroutine.close`。此例外直接繼承" +"自 :exc:`BaseException` 而不是 :exc:`Exception`,因為技術上來說這不是一個錯" +"誤。" #: ../../library/exceptions.rst:237 msgid "" @@ -394,8 +400,8 @@ msgstr "新增 :attr:`name` 與 :attr:`path` 屬性。" #: ../../library/exceptions.rst:257 msgid "" "A subclass of :exc:`ImportError` which is raised by :keyword:`import` when a " -"module could not be located. It is also raised when ``None`` is found in :" -"data:`sys.modules`." +"module could not be located. It is also raised when ``None`` is found " +"in :data:`sys.modules`." msgstr "" ":exc:`ImportError` 的子類別,當模組不能被定位的時候會被 :keyword:`import` 所" "引發。當在 :data:`sys.modules` 裡找到 ``None`` 時也會被引發。" @@ -417,16 +423,16 @@ msgstr "當對映(字典)的鍵無法在已存在的鍵的集合中被找到 #: ../../library/exceptions.rst:282 msgid "" -"Raised when the user hits the interrupt key (normally :kbd:`Control-C` or :" -"kbd:`Delete`). During execution, a check for interrupts is made regularly. " -"The exception inherits from :exc:`BaseException` so as to not be " +"Raised when the user hits the interrupt key (normally :kbd:`Control-C` " +"or :kbd:`Delete`). During execution, a check for interrupts is made " +"regularly. The exception inherits from :exc:`BaseException` so as to not be " "accidentally caught by code that catches :exc:`Exception` and thus prevent " "the interpreter from exiting." msgstr "" -"當使用者輸入中斷鍵 (interrupt key)(一般來說是 :kbd:`Control-C` 或 :kbd:" -"`Delete`)時會被引發。在執行過程中,會定期檢查是否產生中斷。此例外繼承自 :" -"exc:`BaseException` 以防止意外地被捕捉 :exc:`Exception` 的程式碼所捕捉,而因" -"此讓直譯器無法結束。" +"當使用者輸入中斷鍵 (interrupt key)(一般來說是 :kbd:`Control-C` " +"或 :kbd:`Delete`)時會被引發。在執行過程中,會定期檢查是否產生中斷。此例外繼" +"承自 :exc:`BaseException` 以防止意外地被捕捉 :exc:`Exception` 的程式碼所捕" +"捉,而因此讓直譯器無法結束。" #: ../../library/exceptions.rst:290 msgid "" @@ -437,19 +443,20 @@ msgid "" "avoid raising it entirely. (See :ref:`handlers-and-exceptions`.)" msgstr "" "捕捉 :exc:`KeyboardInterrupt` 需要特殊的考量。因為它可以在無法預期的時間點被" -"引發,可能在某些情況下讓正在跑的程式處在一個不一致的狀態。一般來說最好讓 :" -"exc:`KeyboardInterrupt` 越快結束程式越好,或者完全避免引發它。(參考 :ref:" -"`handlers-and-exceptions`。)" +"引發,可能在某些情況下讓正在跑的程式處在一個不一致的狀態。一般來說最好" +"讓 :exc:`KeyboardInterrupt` 越快結束程式越好,或者完全避免引發它。(參" +"考 :ref:`handlers-and-exceptions`。)" #: ../../library/exceptions.rst:300 msgid "" "Raised when an operation runs out of memory but the situation may still be " "rescued (by deleting some objects). The associated value is a string " "indicating what kind of (internal) operation ran out of memory. Note that " -"because of the underlying memory management architecture (C's :c:func:" -"`malloc` function), the interpreter may not always be able to completely " -"recover from this situation; it nevertheless raises an exception so that a " -"stack traceback can be printed, in case a run-away program was the cause." +"because of the underlying memory management architecture " +"(C's :c:func:`malloc` function), the interpreter may not always be able to " +"completely recover from this situation; it nevertheless raises an exception " +"so that a stack traceback can be printed, in case a run-away program was the " +"cause." msgstr "" "當一個操作用光了記憶體但情況還可能被修復 (rescued)(透過刪除一些物件)的時候" "被引發。關聯值是一個字串,表示什麼類型的(內部)操作用光了記憶體。需注意的是" @@ -521,21 +528,22 @@ msgstr "" msgid "" "The second form of the constructor sets the corresponding attributes, " "described below. The attributes default to :const:`None` if not specified. " -"For backwards compatibility, if three arguments are passed, the :attr:" -"`~BaseException.args` attribute contains only a 2-tuple of the first two " -"constructor arguments." +"For backwards compatibility, if three arguments are passed, " +"the :attr:`~BaseException.args` attribute contains only a 2-tuple of the " +"first two constructor arguments." msgstr "" -"建構函式的第二種形式會設定以下描述的相對應屬性。如果沒有給定則屬性預設為 :" -"const:`None`。為了向後相容,如果傳入三個引數,:attr:`~BaseException.args` 屬" -"性只會是包含建構函式前兩個引數的雙元素元組。" +"建構函式的第二種形式會設定以下描述的相對應屬性。如果沒有給定則屬性預設" +"為 :const:`None`。為了向後相容,如果傳入三個引" +"數,:attr:`~BaseException.args` 屬性只會是包含建構函式前兩個引數的雙元素元" +"組。" #: ../../library/exceptions.rst:357 msgid "" "The constructor often actually returns a subclass of :exc:`OSError`, as " "described in `OS exceptions`_ below. The particular subclass depends on the " -"final :attr:`.errno` value. This behaviour only occurs when constructing :" -"exc:`OSError` directly or via an alias, and is not inherited when " -"subclassing." +"final :attr:`.errno` value. This behaviour only occurs when " +"constructing :exc:`OSError` directly or via an alias, and is not inherited " +"when subclassing." msgstr "" "如同下面的\\ `作業系統例外 <OS exceptions_>`_\\ 所描述,實際上建構函式通常回" "傳 :exc:`OSError` 的子類別。會依據最後 :attr:`.errno` 的值決定特定子類別。這" @@ -548,19 +556,19 @@ msgstr "從 C 變數 :c:data:`errno` 而來的數值錯誤代碼。" #: ../../library/exceptions.rst:369 msgid "" -"Under Windows, this gives you the native Windows error code. The :attr:`." -"errno` attribute is then an approximate translation, in POSIX terms, of that " -"native error code." +"Under Windows, this gives you the native Windows error code. " +"The :attr:`.errno` attribute is then an approximate translation, in POSIX " +"terms, of that native error code." msgstr "" "在 Windows 下,這會提供你原生的 Windows 錯誤代碼。而 :attr:`.errno` 屬性是一" "個該原生錯誤代碼對於 POSIX 來說的近似翻譯。" #: ../../library/exceptions.rst:373 msgid "" -"Under Windows, if the *winerror* constructor argument is an integer, the :" -"attr:`.errno` attribute is determined from the Windows error code, and the " -"*errno* argument is ignored. On other platforms, the *winerror* argument is " -"ignored, and the :attr:`winerror` attribute does not exist." +"Under Windows, if the *winerror* constructor argument is an integer, " +"the :attr:`.errno` attribute is determined from the Windows error code, and " +"the *errno* argument is ignored. On other platforms, the *winerror* " +"argument is ignored, and the :attr:`winerror` attribute does not exist." msgstr "" "在 Windows 下,如果建構函式引數 *winerror* 是整數,則 :attr:`.errno` 屬性會根" "據該 Windows 錯誤代碼來決定,且 *errno* 引數會被忽略。在其他平台上," @@ -569,40 +577,40 @@ msgstr "" #: ../../library/exceptions.rst:381 msgid "" "The corresponding error message, as provided by the operating system. It is " -"formatted by the C functions :c:func:`perror` under POSIX, and :c:func:" -"`FormatMessage` under Windows." +"formatted by the C functions :c:func:`perror` under POSIX, " +"and :c:func:`FormatMessage` under Windows." msgstr "" "作業系統提供的對應錯誤訊息。在 POSIX 下會使用 C 函式 :c:func:`perror` 做格式" "化,而在 Windows 下會使用 :c:func:`FormatMessage`。" #: ../../library/exceptions.rst:389 msgid "" -"For exceptions that involve a file system path (such as :func:`open` or :" -"func:`os.unlink`), :attr:`filename` is the file name passed to the function. " -"For functions that involve two file system paths (such as :func:`os." -"rename`), :attr:`filename2` corresponds to the second file name passed to " -"the function." +"For exceptions that involve a file system path (such as :func:`open` " +"or :func:`os.unlink`), :attr:`filename` is the file name passed to the " +"function. For functions that involve two file system paths (such " +"as :func:`os.rename`), :attr:`filename2` corresponds to the second file name " +"passed to the function." msgstr "" -"對於包含檔案系統路徑的例外(像是 :func:`open` 或 :func:`os.unlink`),:attr:" -"`filename` 是傳入函式的檔案名稱。對於包含兩個檔案系統路徑的函式(像是 :func:" -"`os.rename`),:attr:`filename2` 對應到傳入函式的第二個檔案名稱。" +"對於包含檔案系統路徑的例外(像是 :func:`open` " +"或 :func:`os.unlink`),:attr:`filename` 是傳入函式的檔案名稱。對於包含兩個檔" +"案系統路徑的函式(像是 :func:`os.rename`),:attr:`filename2` 對應到傳入函式" +"的第二個檔案名稱。" #: ../../library/exceptions.rst:396 msgid "" -":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket." -"error`, :exc:`select.error` and :exc:`mmap.error` have been merged into :exc:" -"`OSError`, and the constructor may return a subclass." +":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket.error`, :exc:`select.error` " +"and :exc:`mmap.error` have been merged into :exc:`OSError`, and the " +"constructor may return a subclass." msgstr "" -":exc:`EnvironmentError`、:exc:`IOError`、:exc:`WindowsError`、:exc:`socket." -"error`、:exc:`select.error` 及 :exc:`mmap.error` 已合併進 :exc:`OSError`,而" -"建構函式可能會回傳子類別。" +":exc:`EnvironmentError`、:exc:`IOError`、:exc:`WindowsError`、:exc:`socket.error`、:exc:`select.error` " +"及 :exc:`mmap.error` 已合併進 :exc:`OSError`,而建構函式可能會回傳子類別。" #: ../../library/exceptions.rst:402 msgid "" "The :attr:`filename` attribute is now the original file name passed to the " -"function, instead of the name encoded to or decoded from the :term:" -"`filesystem encoding and error handler`. Also, the *filename2* constructor " -"argument and attribute was added." +"function, instead of the name encoded to or decoded from " +"the :term:`filesystem encoding and error handler`. Also, the *filename2* " +"constructor argument and attribute was added." msgstr "" ":attr:`filename` 屬性現在是傳入函式的原始檔名,而不是從\\ :term:`檔案系統編碼" "和錯誤處理函式 <filesystem encoding and error handler>`\\ 編碼或解碼過的名" @@ -611,11 +619,11 @@ msgstr "" #: ../../library/exceptions.rst:411 msgid "" "Raised when the result of an arithmetic operation is too large to be " -"represented. This cannot occur for integers (which would rather raise :exc:" -"`MemoryError` than give up). However, for historical reasons, OverflowError " -"is sometimes raised for integers that are outside a required range. " -"Because of the lack of standardization of floating-point exception handling " -"in C, most floating-point operations are not checked." +"represented. This cannot occur for integers (which would rather " +"raise :exc:`MemoryError` than give up). However, for historical reasons, " +"OverflowError is sometimes raised for integers that are outside a required " +"range. Because of the lack of standardization of floating-point exception " +"handling in C, most floating-point operations are not checked." msgstr "" "當運算操作的結果太大而無法表示的時候會引發此例外。這不會發生在整數上(會改成" "引發 :exc:`MemoryError` 而不是放棄)。然而,因為一些歷史因素,OverflowError " @@ -628,14 +636,14 @@ msgid "" "operation is blocked during interpreter shutdown also known as :term:`Python " "finalization <interpreter shutdown>`." msgstr "" -"此例外衍生自 :exc:`RuntimeError`。當一個操作在直譯器關閉(也稱作 :term:" -"`Python 最終化 (Python finalization) <interpreter shutdown>`)期間被阻塞會引" -"發此例外。" +"此例外衍生自 :exc:`RuntimeError`。當一個操作在直譯器關閉(也稱" +"作 :term:`Python 最終化 (Python finalization) <interpreter shutdown>`)期間" +"被阻塞會引發此例外。" #: ../../library/exceptions.rst:425 msgid "" -"Examples of operations which can be blocked with a :exc:" -"`PythonFinalizationError` during the Python finalization:" +"Examples of operations which can be blocked with " +"a :exc:`PythonFinalizationError` during the Python finalization:" msgstr "" "在 Python 最終化期間,能夠以 :exc:`PythonFinalizationError` 被阻塞的操作範" "例:" @@ -659,17 +667,17 @@ msgstr "在之前,會引發一般的 :exc:`RuntimeError`。" #: ../../library/exceptions.rst:439 msgid "" "This exception is derived from :exc:`RuntimeError`. It is raised when the " -"interpreter detects that the maximum recursion depth (see :func:`sys." -"getrecursionlimit`) is exceeded." +"interpreter detects that the maximum recursion depth " +"(see :func:`sys.getrecursionlimit`) is exceeded." msgstr "" -"此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參考 :" -"func:`sys.getrecursionlimit`)時會引發此例外。" +"此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參" +"考 :func:`sys.getrecursionlimit`)時會引發此例外。" #: ../../library/exceptions.rst:449 msgid "" -"This exception is raised when a weak reference proxy, created by the :func:" -"`weakref.proxy` function, is used to access an attribute of the referent " -"after it has been garbage collected. For more information on weak " +"This exception is raised when a weak reference proxy, created by " +"the :func:`weakref.proxy` function, is used to access an attribute of the " +"referent after it has been garbage collected. For more information on weak " "references, see the :mod:`weakref` module." msgstr "" "當一個被 :func:`weakref.proxy` 函式建立的弱參照代理 (weak reference proxy) 被" @@ -687,9 +695,9 @@ msgstr "" #: ../../library/exceptions.rst:464 msgid "" -"Raised by built-in function :func:`next` and an :term:`iterator`\\'s :meth:" -"`~iterator.__next__` method to signal that there are no further items " -"produced by the iterator." +"Raised by built-in function :func:`next` and " +"an :term:`iterator`\\'s :meth:`~iterator.__next__` method to signal that " +"there are no further items produced by the iterator." msgstr "" "會被內建函式 :func:`next` 及 :term:`iterator` 的 :meth:`~iterator.__next__` " "方法引發,用來表示疊代器沒有更多項目可以產生。" @@ -697,21 +705,22 @@ msgstr "" #: ../../library/exceptions.rst:470 msgid "" "The exception object has a single attribute :attr:`!value`, which is given " -"as an argument when constructing the exception, and defaults to :const:" -"`None`." +"as an argument when constructing the exception, and defaults " +"to :const:`None`." msgstr "" -"此例外物件有單一屬性 :attr:`!value`,當建構此例外時會以引數給定,預設為 :" -"const:`None`。" +"此例外物件有單一屬性 :attr:`!value`,當建構此例外時會以引數給定,預設" +"為 :const:`None`。" #: ../../library/exceptions.rst:474 msgid "" -"When a :term:`generator` or :term:`coroutine` function returns, a new :exc:" -"`StopIteration` instance is raised, and the value returned by the function " -"is used as the :attr:`value` parameter to the constructor of the exception." +"When a :term:`generator` or :term:`coroutine` function returns, a " +"new :exc:`StopIteration` instance is raised, and the value returned by the " +"function is used as the :attr:`value` parameter to the constructor of the " +"exception." msgstr "" -"當 :term:`generator` 或 :term:`coroutine` 函式回傳時,新的 :exc:" -"`StopIteration` 實例會被引發,而該函式的回傳值會被用來當作此例外建構函式的 :" -"attr:`value` 參數。" +"當 :term:`generator` 或 :term:`coroutine` 函式回傳時,新" +"的 :exc:`StopIteration` 實例會被引發,而該函式的回傳值會被用來當作此例外建構" +"函式的 :attr:`value` 參數。" #: ../../library/exceptions.rst:479 msgid "" @@ -719,8 +728,8 @@ msgid "" "is converted into a :exc:`RuntimeError` (retaining the :exc:`StopIteration` " "as the new exception's cause)." msgstr "" -"如果產生器程式直接或間接引發 :exc:`StopIteration`,則其會被轉換成 :exc:" -"`RuntimeError`\\ (保留 :exc:`StopIteration` 作為新例外的成因)。" +"如果產生器程式直接或間接引發 :exc:`StopIteration`,則其會被轉換" +"成 :exc:`RuntimeError`\\ (保留 :exc:`StopIteration` 作為新例外的成因)。" #: ../../library/exceptions.rst:483 msgid "" @@ -754,10 +763,10 @@ msgstr "" #: ../../library/exceptions.rst:504 msgid "" -"Raised when the parser encounters a syntax error. This may occur in an :" -"keyword:`import` statement, in a call to the built-in functions :func:" -"`compile`, :func:`exec`, or :func:`eval`, or when reading the initial script " -"or standard input (also interactively)." +"Raised when the parser encounters a syntax error. This may occur in " +"an :keyword:`import` statement, in a call to the built-in " +"functions :func:`compile`, :func:`exec`, or :func:`eval`, or when reading " +"the initial script or standard input (also interactively)." msgstr "" "當剖析器遇到語法錯誤時會引發此例外。這可能發生在 :keyword:`import` 陳述式、在" "呼叫內建函式 :func:`compile`、:func:`exec` 或 :func:`eval` 的時候,或者在讀取" @@ -837,52 +846,59 @@ msgid "" "Raised when indentation contains an inconsistent use of tabs and spaces. " "This is a subclass of :exc:`IndentationError`." msgstr "" -"當縮排包含製表符號 (tab) 和空白的不一致用法時會引發此例外。這是 :exc:" -"`IndentationError` 的子類別。" +"當縮排包含製表符號 (tab) 和空白的不一致用法時會引發此例外。這" +"是 :exc:`IndentationError` 的子類別。" #: ../../library/exceptions.rst:563 msgid "" "Raised when the interpreter finds an internal error, but the situation does " "not look so serious to cause it to abandon all hope. The associated value is " -"a string indicating what went wrong (in low-level terms)." +"a string indicating what went wrong (in low-level terms). " +"In :term:`CPython`, this could be raised by incorrectly using Python's C " +"API, such as returning a ``NULL`` value without an exception set." msgstr "" "當直譯器找到一個內部錯誤,但該情況看起來沒有嚴重到要讓它放棄所有的希望時會引" "發此例外。關聯值是一個表示什麼地方出錯的字串(以低階的方式表達)。" +"在 :term:`CPython` 中,這可能是因為錯誤地使用 Python 的 C API,例如回傳一個 " +"``NULL`` 值而沒有設定例外。" -#: ../../library/exceptions.rst:567 +#: ../../library/exceptions.rst:569 msgid "" -"You should report this to the author or maintainer of your Python " -"interpreter. Be sure to report the version of the Python interpreter (``sys." -"version``; it is also printed at the start of an interactive Python " -"session), the exact error message (the exception's associated value) and if " -"possible the source of the program that triggered the error." +"If you're confident that this exception wasn't your fault, or the fault of a " +"package you're using, you should report this to the author or maintainer of " +"your Python interpreter. Be sure to report the version of the Python " +"interpreter (``sys.version``; it is also printed at the start of an " +"interactive Python session), the exact error message (the exception's " +"associated value) and if possible the source of the program that triggered " +"the error." msgstr "" -"你應該向你的 Python 直譯器作者或維護者回報此錯誤。務必要回報該 Python 直譯器" -"的版本(``sys.version``;這也會在互動式 Python 會話的開頭被印出)、確切的錯誤" -"訊息(該例外的關聯值)及如果可能的話,觸發此錯誤的程式來源。" +"如果你確定這個例外不是你的或者所用套件的錯,你應該向你的 Python 直譯器作者或" +"維護者回報此錯誤。務必要回報該 Python 直譯器的版本(``sys.version``;這也會在" +"互動式 Python 會話的開頭被印出)、確切的錯誤訊息(該例外的關聯值)及如果可能" +"的話,觸發此錯誤的程式來源。" -#: ../../library/exceptions.rst:576 +#: ../../library/exceptions.rst:580 msgid "" "This exception is raised by the :func:`sys.exit` function. It inherits " "from :exc:`BaseException` instead of :exc:`Exception` so that it is not " "accidentally caught by code that catches :exc:`Exception`. This allows the " "exception to properly propagate up and cause the interpreter to exit. When " "it is not handled, the Python interpreter exits; no stack traceback is " -"printed. The constructor accepts the same optional argument passed to :func:" -"`sys.exit`. If the value is an integer, it specifies the system exit status " -"(passed to C's :c:func:`exit` function); if it is ``None``, the exit status " -"is zero; if it has another type (such as a string), the object's value is " -"printed and the exit status is one." -msgstr "" -"此例外會被 :func:`sys.exit` 函式引發。它繼承自 :exc:`BaseException` 而不是 :" -"exc:`Exception` 因此不會被捕捉 :exc:`Exception` 的程式意外地捕捉。這允許例外" -"可以正確地向上傳遞並導致直譯器結束。當它未被處理時,Python 直譯器會結束;不會" -"印出堆疊回溯。建構函式接受跟傳入 :func:`sys.exit` 一樣的可選引數。如果該值是" -"整數,它會指定系統的結束狀態(傳入 C 的 :c:func:`exit` 函式 );如果它是 " +"printed. The constructor accepts the same optional argument passed " +"to :func:`sys.exit`. If the value is an integer, it specifies the system " +"exit status (passed to C's :c:func:`exit` function); if it is ``None``, the " +"exit status is zero; if it has another type (such as a string), the object's " +"value is printed and the exit status is one." +msgstr "" +"此例外會被 :func:`sys.exit` 函式引發。它繼承自 :exc:`BaseException` 而不" +"是 :exc:`Exception` 因此不會被捕捉 :exc:`Exception` 的程式意外地捕捉。這允許" +"例外可以正確地向上傳遞並導致直譯器結束。當它未被處理時,Python 直譯器會結束;" +"不會印出堆疊回溯。建構函式接受跟傳入 :func:`sys.exit` 一樣的可選引數。如果該" +"值是整數,它會指定系統的結束狀態(傳入 C 的 :c:func:`exit` 函式 );如果它是 " "``None``,結束狀態會是 0;如果它是其他型別(例如字串),則物件的值會被印出而" "結束狀態是 1。" -#: ../../library/exceptions.rst:587 +#: ../../library/exceptions.rst:591 msgid "" "A call to :func:`sys.exit` is translated into an exception so that clean-up " "handlers (:keyword:`finally` clauses of :keyword:`try` statements) can be " @@ -893,16 +909,16 @@ msgid "" msgstr "" "對 :func:`sys.exit` 的呼叫會轉譯成例外讓負責清理的處理函式(:keyword:`try` 陳" "述式的 :keyword:`finally` 子句)可以被執行,且讓除錯器可以在不冒著失去控制的" -"風險下執行腳本。如果在絕對有必要立即結束的情況(例如在子行程呼叫完 :func:`os." -"fork` 之後 )可以使用 :func:`os._exit` 函式。" +"風險下執行腳本。如果在絕對有必要立即結束的情況(例如在子行程呼叫" +"完 :func:`os.fork` 之後 )可以使用 :func:`os._exit` 函式。" -#: ../../library/exceptions.rst:596 +#: ../../library/exceptions.rst:600 msgid "" "The exit status or error message that is passed to the constructor. " "(Defaults to ``None``.)" msgstr "傳入建構函式的結束狀態或錯誤訊息。(預設是 ``None``。 )" -#: ../../library/exceptions.rst:602 +#: ../../library/exceptions.rst:606 msgid "" "Raised when an operation or function is applied to an object of " "inappropriate type. The associated value is a string giving details about " @@ -911,7 +927,7 @@ msgstr "" "當一個操作或函式被用在不適合的型別的物件時會引發此例外。關聯值是一個字串,提" "供關於不相符型別的細節。" -#: ../../library/exceptions.rst:605 +#: ../../library/exceptions.rst:609 msgid "" "This exception may be raised by user code to indicate that an attempted " "operation on an object is not supported, and is not meant to be. If an " @@ -922,27 +938,27 @@ msgstr "" "這樣做。如果一個物件有意要支援某個給定的操作但尚未提供實作,該引發的正確例外" "是 :exc:`NotImplementedError`。" -#: ../../library/exceptions.rst:610 +#: ../../library/exceptions.rst:614 msgid "" -"Passing arguments of the wrong type (e.g. passing a :class:`list` when an :" -"class:`int` is expected) should result in a :exc:`TypeError`, but passing " -"arguments with the wrong value (e.g. a number outside expected boundaries) " -"should result in a :exc:`ValueError`." +"Passing arguments of the wrong type (e.g. passing a :class:`list` when " +"an :class:`int` is expected) should result in a :exc:`TypeError`, but " +"passing arguments with the wrong value (e.g. a number outside expected " +"boundaries) should result in a :exc:`ValueError`." msgstr "" "傳入錯誤型別的引數(例如當預期傳入 :class:`int` 卻傳入 :class:`list`)應該要" "導致 :exc:`TypeError`,但傳入帶有錯誤值的引數(例如超出預期範圍的數值)應該要" "導致 :exc:`ValueError`。" -#: ../../library/exceptions.rst:617 +#: ../../library/exceptions.rst:621 msgid "" "Raised when a reference is made to a local variable in a function or method, " -"but no value has been bound to that variable. This is a subclass of :exc:" -"`NameError`." +"but no value has been bound to that variable. This is a subclass " +"of :exc:`NameError`." msgstr "" "當在函式或方法裡引用某個區域變數,但該變數尚未被繫結到任何值的時候會引發此例" "外。這是 :exc:`NameError` 的子類別。" -#: ../../library/exceptions.rst:624 +#: ../../library/exceptions.rst:628 msgid "" "Raised when a Unicode-related encoding or decoding error occurs. It is a " "subclass of :exc:`ValueError`." @@ -950,36 +966,36 @@ msgstr "" "當 Unicode 相關的編碼或解碼錯誤發生時會引發此例外。這是 :exc:`ValueError` 的" "子類別。" -#: ../../library/exceptions.rst:627 +#: ../../library/exceptions.rst:631 msgid "" ":exc:`UnicodeError` has attributes that describe the encoding or decoding " "error. For example, ``err.object[err.start:err.end]`` gives the particular " "invalid input that the codec failed on." msgstr "" -":exc:`UnicodeError` 有屬性描述編碼或解碼錯誤。例如 ``err.object[err.start:" -"err.end]`` 會提供讓編解碼器失敗的具體無效輸入。" +":exc:`UnicodeError` 有屬性描述編碼或解碼錯誤。例如 " +"``err.object[err.start:err.end]`` 會提供讓編解碼器失敗的具體無效輸入。" -#: ../../library/exceptions.rst:633 +#: ../../library/exceptions.rst:637 msgid "The name of the encoding that raised the error." msgstr "引發錯誤的編碼名稱。" -#: ../../library/exceptions.rst:637 +#: ../../library/exceptions.rst:641 msgid "A string describing the specific codec error." msgstr "描述特定編解碼器錯誤的字串。" -#: ../../library/exceptions.rst:641 +#: ../../library/exceptions.rst:645 msgid "The object the codec was attempting to encode or decode." msgstr "編解碼器嘗試編碼或解碼的物件。" -#: ../../library/exceptions.rst:645 +#: ../../library/exceptions.rst:649 msgid "The first index of invalid data in :attr:`object`." msgstr "在 :attr:`object` 中無效資料的開始索引。" -#: ../../library/exceptions.rst:649 +#: ../../library/exceptions.rst:653 msgid "The index after the last invalid data in :attr:`object`." msgstr "在 :attr:`object` 中最後的無效資料後的索引。" -#: ../../library/exceptions.rst:654 +#: ../../library/exceptions.rst:658 msgid "" "Raised when a Unicode-related error occurs during encoding. It is a " "subclass of :exc:`UnicodeError`." @@ -987,7 +1003,7 @@ msgstr "" "在編碼當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:660 +#: ../../library/exceptions.rst:664 msgid "" "Raised when a Unicode-related error occurs during decoding. It is a " "subclass of :exc:`UnicodeError`." @@ -995,7 +1011,7 @@ msgstr "" "在解碼當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:666 +#: ../../library/exceptions.rst:670 msgid "" "Raised when a Unicode-related error occurs during translating. It is a " "subclass of :exc:`UnicodeError`." @@ -1003,7 +1019,7 @@ msgstr "" "在轉譯當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:672 +#: ../../library/exceptions.rst:676 msgid "" "Raised when an operation or function receives an argument that has the right " "type but an inappropriate value, and the situation is not described by a " @@ -1012,7 +1028,7 @@ msgstr "" "當一個操作或函式收到引數是正確型別但是不適合的值,且該情況無法被更精確的例外" "例如 :exc:`IndexError` 所描述時會引發此例外。" -#: ../../library/exceptions.rst:679 +#: ../../library/exceptions.rst:683 msgid "" "Raised when the second argument of a division or modulo operation is zero. " "The associated value is a string indicating the type of the operands and the " @@ -1021,47 +1037,47 @@ msgstr "" "當除法或模數運算 (modulo operation) 的第二個引數是 0 的時候會引發此例外。關聯" "值是一個字串,表示運算元及運算的類型。" -#: ../../library/exceptions.rst:684 +#: ../../library/exceptions.rst:688 msgid "" "The following exceptions are kept for compatibility with previous versions; " "starting from Python 3.3, they are aliases of :exc:`OSError`." msgstr "" -"以下例外是為了相容於之前版本而保留;從 Python 3.3 開始,它們是 :exc:" -"`OSError` 的別名。" +"以下例外是為了相容於之前版本而保留;從 Python 3.3 開始,它們" +"是 :exc:`OSError` 的別名。" -#: ../../library/exceptions.rst:693 +#: ../../library/exceptions.rst:697 msgid "Only available on Windows." msgstr "僅限於在 Windows 中使用。" -#: ../../library/exceptions.rst:697 +#: ../../library/exceptions.rst:701 msgid "OS exceptions" msgstr "作業系統例外" -#: ../../library/exceptions.rst:699 +#: ../../library/exceptions.rst:703 msgid "" "The following exceptions are subclasses of :exc:`OSError`, they get raised " "depending on the system error code." msgstr "以下的例外是 :exc:`OSError` 的子類別,它們根據系統錯誤代碼來引發。" -#: ../../library/exceptions.rst:704 +#: ../../library/exceptions.rst:708 msgid "" "Raised when an operation would block on an object (e.g. socket) set for non-" -"blocking operation. Corresponds to :c:data:`errno` :py:const:`~errno." -"EAGAIN`, :py:const:`~errno.EALREADY`, :py:const:`~errno.EWOULDBLOCK` and :py:" -"const:`~errno.EINPROGRESS`." +"blocking operation. Corresponds " +"to :c:data:`errno` :py:const:`~errno.EAGAIN`, :py:const:`~errno.EALREADY`, :py:const:`~errno.EWOULDBLOCK` " +"and :py:const:`~errno.EINPROGRESS`." msgstr "" "當設置為非阻塞操作的物件(例如 socket)上的操作將要阻塞時會引發此例外。對應" -"到 :c:data:`errno` :py:const:`~errno.EAGAIN`、:py:const:`~errno.EALREADY`、:" -"py:const:`~errno.EWOULDBLOCK` 及 :py:const:`~errno.EINPROGRESS`。" +"到 :c:data:`errno` :py:const:`~errno.EAGAIN`、:py:const:`~errno.EALREADY`、:py:const:`~errno.EWOULDBLOCK` " +"及 :py:const:`~errno.EINPROGRESS`。" -#: ../../library/exceptions.rst:709 +#: ../../library/exceptions.rst:713 msgid "" "In addition to those of :exc:`OSError`, :exc:`BlockingIOError` can have one " "more attribute:" msgstr "" "除了 :exc:`OSError` 的那些屬性之外,:exc:`BlockingIOError` 有多一個屬性:" -#: ../../library/exceptions.rst:714 +#: ../../library/exceptions.rst:718 msgid "" "An integer containing the number of characters written to the stream before " "it blocked. This attribute is available when using the buffered I/O classes " @@ -1070,56 +1086,58 @@ msgstr "" "一個整數,內容為在其阻塞之前,已寫進串流的字元數。當使用 :mod:`io` 模組裡的緩" "衝 I/O 類別時這個屬性是可用的。" -#: ../../library/exceptions.rst:720 +#: ../../library/exceptions.rst:724 msgid "" -"Raised when an operation on a child process failed. Corresponds to :c:data:" -"`errno` :py:const:`~errno.ECHILD`." +"Raised when an operation on a child process failed. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ECHILD`." msgstr "" -"當子行程上的操作失敗時會引發此例外。對應到 :c:data:`errno` :py:const:`~errno." -"ECHILD`。" +"當子行程上的操作失敗時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.ECHILD`。" -#: ../../library/exceptions.rst:725 +#: ../../library/exceptions.rst:729 msgid "A base class for connection-related issues." msgstr "連線相關問題的基礎類別。" -#: ../../library/exceptions.rst:727 +#: ../../library/exceptions.rst:731 msgid "" -"Subclasses are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:" -"`ConnectionRefusedError` and :exc:`ConnectionResetError`." +"Subclasses " +"are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:`ConnectionRefusedError` " +"and :exc:`ConnectionResetError`." msgstr "" -"子類別有 :exc:`BrokenPipeError`、:exc:`ConnectionAbortedError`、:exc:" -"`ConnectionRefusedError` 及 :exc:`ConnectionResetError`。" +"子類別" +"有 :exc:`BrokenPipeError`、:exc:`ConnectionAbortedError`、:exc:`ConnectionRefusedError` " +"及 :exc:`ConnectionResetError`。" -#: ../../library/exceptions.rst:732 +#: ../../library/exceptions.rst:736 msgid "" "A subclass of :exc:`ConnectionError`, raised when trying to write on a pipe " "while the other end has been closed, or trying to write on a socket which " -"has been shutdown for writing. Corresponds to :c:data:`errno` :py:const:" -"`~errno.EPIPE` and :py:const:`~errno.ESHUTDOWN`." +"has been shutdown for writing. Corresponds " +"to :c:data:`errno` :py:const:`~errno.EPIPE` and :py:const:`~errno.ESHUTDOWN`." msgstr "" ":exc:`ConnectionError` 的子類別,當嘗試寫入管道 (pipe) 同時另一端已經被關閉時" -"會引發此例外,或者當嘗試寫入已關閉寫入的 socket 時也會引發。對應到 :c:data:" -"`errno` :py:const:`~errno.EPIPE` 及 :py:const:`~errno.ESHUTDOWN`。" +"會引發此例外,或者當嘗試寫入已關閉寫入的 socket 時也會引發。對應" +"到 :c:data:`errno` :py:const:`~errno.EPIPE` 及 :py:const:`~errno.ESHUTDOWN`。" -#: ../../library/exceptions.rst:739 +#: ../../library/exceptions.rst:743 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " -"aborted by the peer. Corresponds to :c:data:`errno` :py:const:`~errno." -"ECONNABORTED`." +"aborted by the peer. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ECONNABORTED`." msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線的嘗試被對等端點 (peer) 中斷時會引" "發此例外。對應到 :c:data:`errno` :py:const:`~errno.ECONNABORTED`。" -#: ../../library/exceptions.rst:745 +#: ../../library/exceptions.rst:749 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " -"refused by the peer. Corresponds to :c:data:`errno` :py:const:`~errno." -"ECONNREFUSED`." +"refused by the peer. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ECONNREFUSED`." msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線的嘗試被對等端點拒絕時會引發此例" "外。對應到 :c:data:`errno` :py:const:`~errno.ECONNREFUSED`。" -#: ../../library/exceptions.rst:751 +#: ../../library/exceptions.rst:755 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection is reset by " "the peer. Corresponds to :c:data:`errno` :py:const:`~errno.ECONNRESET`." @@ -1127,146 +1145,146 @@ msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線被對等端點重置時會引發此例外。對應" "到 :c:data:`errno` :py:const:`~errno.ECONNRESET`。" -#: ../../library/exceptions.rst:757 +#: ../../library/exceptions.rst:761 msgid "" "Raised when trying to create a file or directory which already exists. " "Corresponds to :c:data:`errno` :py:const:`~errno.EEXIST`." msgstr "" -"當嘗試建立已存在的檔案或目錄時會引發此例外。對應到 :c:data:`errno` :py:const:" -"`~errno.EEXIST`。" +"當嘗試建立已存在的檔案或目錄時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.EEXIST`。" -#: ../../library/exceptions.rst:762 +#: ../../library/exceptions.rst:766 msgid "" "Raised when a file or directory is requested but doesn't exist. Corresponds " "to :c:data:`errno` :py:const:`~errno.ENOENT`." msgstr "" -"當請求不存在的檔案或目錄時會引發此例外。對應到 :c:data:`errno` :py:const:" -"`~errno.ENOENT`。" +"當請求不存在的檔案或目錄時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.ENOENT`。" -#: ../../library/exceptions.rst:767 +#: ../../library/exceptions.rst:771 msgid "" "Raised when a system call is interrupted by an incoming signal. Corresponds " "to :c:data:`errno` :py:const:`~errno.EINTR`." msgstr "" -"當系統呼叫被傳入的信號中斷時會引發此例外。對應到 :c:data:`errno` :py:const:" -"`~errno.EINTR`。" +"當系統呼叫被傳入的信號中斷時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.EINTR`。" -#: ../../library/exceptions.rst:770 +#: ../../library/exceptions.rst:774 msgid "" "Python now retries system calls when a syscall is interrupted by a signal, " "except if the signal handler raises an exception (see :pep:`475` for the " "rationale), instead of raising :exc:`InterruptedError`." msgstr "" -"現在當 syscall 被信號中斷時 Python 會重試系統呼叫而不會引發 :exc:" -"`InterruptedError`,除非信號處理器引發例外(理由可參考 :pep:`475`)。" +"現在當 syscall 被信號中斷時 Python 會重試系統呼叫而不會引" +"發 :exc:`InterruptedError`,除非信號處理器引發例外(理由可參考 :pep:`475`)。" -#: ../../library/exceptions.rst:777 +#: ../../library/exceptions.rst:781 msgid "" "Raised when a file operation (such as :func:`os.remove`) is requested on a " "directory. Corresponds to :c:data:`errno` :py:const:`~errno.EISDIR`." msgstr "" -"當在目錄上請求檔案操作(例如 :func:`os.remove`)時會引發此例外。對應到 :c:" -"data:`errno` :py:const:`~errno.EISDIR`。" +"當在目錄上請求檔案操作(例如 :func:`os.remove`)時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.EISDIR`。" -#: ../../library/exceptions.rst:783 +#: ../../library/exceptions.rst:787 msgid "" "Raised when a directory operation (such as :func:`os.listdir`) is requested " "on something which is not a directory. On most POSIX platforms, it may also " "be raised if an operation attempts to open or traverse a non-directory file " -"as if it were a directory. Corresponds to :c:data:`errno` :py:const:`~errno." -"ENOTDIR`." +"as if it were a directory. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ENOTDIR`." msgstr "" "當在某個不是目錄的東西上請求目錄操作(例如 :func:`os.listdir`)時會引發此例" "外。在大多數的 POSIX 平台上,如果嘗試操作開啟或遍歷一個當作目錄的非目錄檔案也" "會引發此例外。對應到 :c:data:`errno` :py:const:`~errno.ENOTDIR`。" -#: ../../library/exceptions.rst:791 +#: ../../library/exceptions.rst:795 msgid "" "Raised when trying to run an operation without the adequate access rights - " -"for example filesystem permissions. Corresponds to :c:data:`errno` :py:const:" -"`~errno.EACCES`, :py:const:`~errno.EPERM`, and :py:const:`~errno." -"ENOTCAPABLE`." +"for example filesystem permissions. Corresponds " +"to :c:data:`errno` :py:const:`~errno.EACCES`, :py:const:`~errno.EPERM`, " +"and :py:const:`~errno.ENOTCAPABLE`." msgstr "" "當嘗試執行一個沒有合乎存取權限的操作時會引發此例外 — 例如檔案系統權限。對應" -"到 :c:data:`errno` :py:const:`~errno.EACCES`、:py:const:`~errno.EPERM` 及 :" -"py:const:`~errno.ENOTCAPABLE`。" +"到 :c:data:`errno` :py:const:`~errno.EACCES`、:py:const:`~errno.EPERM` " +"及 :py:const:`~errno.ENOTCAPABLE`。" -#: ../../library/exceptions.rst:796 +#: ../../library/exceptions.rst:800 msgid "" -"WASI's :py:const:`~errno.ENOTCAPABLE` is now mapped to :exc:" -"`PermissionError`." +"WASI's :py:const:`~errno.ENOTCAPABLE` is now mapped " +"to :exc:`PermissionError`." msgstr "" "WASI 的 :py:const:`~errno.ENOTCAPABLE` 現在對應到 :exc:`PermissionError`。" -#: ../../library/exceptions.rst:802 +#: ../../library/exceptions.rst:806 msgid "" -"Raised when a given process doesn't exist. Corresponds to :c:data:`errno` :" -"py:const:`~errno.ESRCH`." +"Raised when a given process doesn't exist. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ESRCH`." msgstr "" -"當給定的行程不存在時會引發此例外。對應到 :c:data:`errno` :py:const:`~errno." -"ESRCH`。" +"當給定的行程不存在時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.ESRCH`。" -#: ../../library/exceptions.rst:807 +#: ../../library/exceptions.rst:811 msgid "" -"Raised when a system function timed out at the system level. Corresponds to :" -"c:data:`errno` :py:const:`~errno.ETIMEDOUT`." +"Raised when a system function timed out at the system level. Corresponds " +"to :c:data:`errno` :py:const:`~errno.ETIMEDOUT`." msgstr "" -"當系統函式在系統層級超時會引發此例外。對應到 :c:data:`errno` :py:const:" -"`~errno.ETIMEDOUT`。" +"當系統函式在系統層級超時會引發此例外。對應" +"到 :c:data:`errno` :py:const:`~errno.ETIMEDOUT`。" -#: ../../library/exceptions.rst:810 +#: ../../library/exceptions.rst:814 msgid "All the above :exc:`OSError` subclasses were added." msgstr "加入以上所有的 :exc:`OSError` 子類別。" -#: ../../library/exceptions.rst:816 +#: ../../library/exceptions.rst:820 msgid ":pep:`3151` - Reworking the OS and IO exception hierarchy" msgstr ":pep:`3151` — 改寫作業系統與 IO 例外階層" -#: ../../library/exceptions.rst:822 +#: ../../library/exceptions.rst:826 msgid "Warnings" msgstr "警告" -#: ../../library/exceptions.rst:824 +#: ../../library/exceptions.rst:828 msgid "" -"The following exceptions are used as warning categories; see the :ref:" -"`warning-categories` documentation for more details." +"The following exceptions are used as warning categories; see " +"the :ref:`warning-categories` documentation for more details." msgstr "" "以下的例外是當作警告的種類使用;更多細節參考 :ref:`warning-categories` 文件。" -#: ../../library/exceptions.rst:829 +#: ../../library/exceptions.rst:833 msgid "Base class for warning categories." msgstr "警告種類的基礎類別。" -#: ../../library/exceptions.rst:834 +#: ../../library/exceptions.rst:838 msgid "Base class for warnings generated by user code." msgstr "使用者程式碼產生的警告的基礎類別。" -#: ../../library/exceptions.rst:839 +#: ../../library/exceptions.rst:843 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for other Python developers." msgstr "關於已棄用功能的警告的基礎類別,且當那些警告是針對其他 Python 開發者。" -#: ../../library/exceptions.rst:842 +#: ../../library/exceptions.rst:846 msgid "" -"Ignored by the default warning filters, except in the ``__main__`` module (:" -"pep:`565`). Enabling the :ref:`Python Development Mode <devmode>` shows this " -"warning." +"Ignored by the default warning filters, except in the ``__main__`` module " +"(:pep:`565`). Enabling the :ref:`Python Development Mode <devmode>` shows " +"this warning." msgstr "" -"會被預設的警告過濾器忽略,在 ``__main__`` 模組裡除外 (:pep:`565`)。啟用 :ref:" -"`Python 開發模式 <devmode>`\\ 會顯示此警告。" +"會被預設的警告過濾器忽略,在 ``__main__`` 模組裡除外 (:pep:`565`)。啟" +"用 :ref:`Python 開發模式 <devmode>`\\ 會顯示此警告。" -#: ../../library/exceptions.rst:846 ../../library/exceptions.rst:862 +#: ../../library/exceptions.rst:850 ../../library/exceptions.rst:866 msgid "The deprecation policy is described in :pep:`387`." msgstr "棄用原則描述在 :pep:`387` 裡。" -#: ../../library/exceptions.rst:851 +#: ../../library/exceptions.rst:855 msgid "" "Base class for warnings about features which are obsolete and expected to be " "deprecated in the future, but are not deprecated at the moment." msgstr "關於過時且預期未來要被棄用,但目前尚未被棄用的功能的警告的基礎類別。" -#: ../../library/exceptions.rst:855 +#: ../../library/exceptions.rst:859 msgid "" "This class is rarely used as emitting a warning about a possible upcoming " "deprecation is unusual, and :exc:`DeprecationWarning` is preferred for " @@ -1275,8 +1293,8 @@ msgstr "" "因為發出關於可能即將被棄用的警告是不尋常的,此類別很少被使用,而對已經被棄用" "的情況會優先使用 :exc:`DeprecationWarning`。" -#: ../../library/exceptions.rst:859 ../../library/exceptions.rst:885 -#: ../../library/exceptions.rst:912 +#: ../../library/exceptions.rst:863 ../../library/exceptions.rst:889 +#: ../../library/exceptions.rst:916 msgid "" "Ignored by the default warning filters. Enabling the :ref:`Python " "Development Mode <devmode>` shows this warning." @@ -1284,15 +1302,15 @@ msgstr "" "會被預設的警告過濾器忽略。啟用 :ref:`Python 開發模式 <devmode>`\\ 會顯示此警" "告。" -#: ../../library/exceptions.rst:867 +#: ../../library/exceptions.rst:871 msgid "Base class for warnings about dubious syntax." msgstr "關於可疑語法的警告的基礎類別。" -#: ../../library/exceptions.rst:872 +#: ../../library/exceptions.rst:876 msgid "Base class for warnings about dubious runtime behavior." msgstr "關於可疑執行環境行為的警告的基礎類別。" -#: ../../library/exceptions.rst:877 +#: ../../library/exceptions.rst:881 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for end users of applications that are written in Python." @@ -1300,36 +1318,36 @@ msgstr "" "關於已棄用功能的警告的基礎類別,且當那些警告是針對以 Python 寫的應用程式的終" "端使用者。" -#: ../../library/exceptions.rst:883 +#: ../../library/exceptions.rst:887 msgid "Base class for warnings about probable mistakes in module imports." msgstr "關於在模組引入的可能錯誤的警告的基礎類別。" -#: ../../library/exceptions.rst:891 +#: ../../library/exceptions.rst:895 msgid "Base class for warnings related to Unicode." msgstr "Unicode 相關警告的基礎類別。" -#: ../../library/exceptions.rst:896 +#: ../../library/exceptions.rst:900 msgid "Base class for warnings related to encodings." msgstr "編碼相關警告的基礎類別。" -#: ../../library/exceptions.rst:898 +#: ../../library/exceptions.rst:902 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節參考\\ :ref:`io-encoding-warning`。" -#: ../../library/exceptions.rst:905 +#: ../../library/exceptions.rst:909 msgid "" "Base class for warnings related to :class:`bytes` and :class:`bytearray`." msgstr ":class:`bytes` 及 :class:`bytearray` 相關警告的基礎類別。" -#: ../../library/exceptions.rst:910 +#: ../../library/exceptions.rst:914 msgid "Base class for warnings related to resource usage." msgstr "資源用法相關警告的基礎類別。" -#: ../../library/exceptions.rst:921 +#: ../../library/exceptions.rst:925 msgid "Exception groups" msgstr "例外群組" -#: ../../library/exceptions.rst:923 +#: ../../library/exceptions.rst:927 msgid "" "The following are used when it is necessary to raise multiple unrelated " "exceptions. They are part of the exception hierarchy so they can be handled " @@ -1341,46 +1359,48 @@ msgstr "" "所有其他例外一樣使用 :keyword:`except` 來處理。此外,它們會以包含的例外型別為" "基礎來比對其子群組而被 :keyword:`except*<except_star>` 辨認出來。" -#: ../../library/exceptions.rst:932 +#: ../../library/exceptions.rst:936 msgid "" "Both of these exception types wrap the exceptions in the sequence ``excs``. " "The ``msg`` parameter must be a string. The difference between the two " "classes is that :exc:`BaseExceptionGroup` extends :exc:`BaseException` and " -"it can wrap any exception, while :exc:`ExceptionGroup` extends :exc:" -"`Exception` and it can only wrap subclasses of :exc:`Exception`. This design " -"is so that ``except Exception`` catches an :exc:`ExceptionGroup` but not :" -"exc:`BaseExceptionGroup`." +"it can wrap any exception, while :exc:`ExceptionGroup` " +"extends :exc:`Exception` and it can only wrap subclasses " +"of :exc:`Exception`. This design is so that ``except Exception`` catches " +"an :exc:`ExceptionGroup` but not :exc:`BaseExceptionGroup`." msgstr "" "這兩個例外型別都將例外包裝在序列 ``excs`` 中。``msg`` 參數必須是字串。這兩個" "類別的差異是 :exc:`BaseExceptionGroup` 擴充了 :exc:`BaseException` 且可以包裝" -"任何例外,而 :exc:`ExceptionGroup` 擴充了 :exc:`Exception` 且只能包裝 :exc:" -"`Exception` 的子類別。這個設計使得 ``except Exception`` 可以捕捉 :exc:" -"`ExceptionGroup` 但不能捕捉 :exc:`BaseExceptionGroup`。" +"任何例外,而 :exc:`ExceptionGroup` 擴充了 :exc:`Exception` 且只能包" +"裝 :exc:`Exception` 的子類別。這個設計使得 ``except Exception`` 可以捕" +"捉 :exc:`ExceptionGroup` 但不能捕捉 :exc:`BaseExceptionGroup`。" -#: ../../library/exceptions.rst:940 +#: ../../library/exceptions.rst:944 msgid "" "The :exc:`BaseExceptionGroup` constructor returns an :exc:`ExceptionGroup` " -"rather than a :exc:`BaseExceptionGroup` if all contained exceptions are :exc:" -"`Exception` instances, so it can be used to make the selection automatic. " -"The :exc:`ExceptionGroup` constructor, on the other hand, raises a :exc:" -"`TypeError` if any contained exception is not an :exc:`Exception` subclass." +"rather than a :exc:`BaseExceptionGroup` if all contained exceptions " +"are :exc:`Exception` instances, so it can be used to make the selection " +"automatic. The :exc:`ExceptionGroup` constructor, on the other hand, raises " +"a :exc:`TypeError` if any contained exception is not an :exc:`Exception` " +"subclass." msgstr "" "如果所有包含的例外都是 :exc:`Exception` 實例,:exc:`BaseExceptionGroup` 建構" "函式會回傳 :exc:`ExceptionGroup` 而不是 :exc:`BaseExceptionGroup`,因此可以被" -"使用來讓這樣的選擇自動化。另一方面來說,如果任何包含的例外不是 :exc:" -"`Exception` 的子類別,:exc:`ExceptionGroup` 建構函式會引發 :exc:`TypeError`。" +"使用來讓這樣的選擇自動化。另一方面來說,如果任何包含的例外不" +"是 :exc:`Exception` 的子類別,:exc:`ExceptionGroup` 建構函式會引" +"發 :exc:`TypeError`。" -#: ../../library/exceptions.rst:949 +#: ../../library/exceptions.rst:953 msgid "The ``msg`` argument to the constructor. This is a read-only attribute." msgstr "建構函式的 ``msg`` 引數。這是一個唯讀的屬性。" -#: ../../library/exceptions.rst:953 +#: ../../library/exceptions.rst:957 msgid "" "A tuple of the exceptions in the ``excs`` sequence given to the constructor. " "This is a read-only attribute." msgstr "指定給建構函式 ``excs`` 序列中的例外組成的元組。這是一個唯讀的屬性。" -#: ../../library/exceptions.rst:958 +#: ../../library/exceptions.rst:962 msgid "" "Returns an exception group that contains only the exceptions from the " "current group that match *condition*, or ``None`` if the result is empty." @@ -1388,7 +1408,7 @@ msgstr "" "回傳只包含從現有群組比對到 *condition* 的例外的例外群組,或者當結果為空時回" "傳 ``None``。" -#: ../../library/exceptions.rst:961 +#: ../../library/exceptions.rst:965 msgid "" "The condition can be an exception type or tuple of exception types, in which " "case each exception is checked for a match using the same check that is used " @@ -1401,20 +1421,20 @@ msgstr "" "物件(除了型別物件之外),其接受一個例外作為單一引數,而如果該例外應該在子群" "組中就回傳 true。" -#: ../../library/exceptions.rst:967 +#: ../../library/exceptions.rst:971 msgid "" "The nesting structure of the current exception is preserved in the result, " -"as are the values of its :attr:`message`, :attr:`~BaseException." -"__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException." -"__context__` and :attr:`~BaseException.__notes__` fields. Empty nested " -"groups are omitted from the result." +"as are the values of " +"its :attr:`message`, :attr:`~BaseException.__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException.__context__` " +"and :attr:`~BaseException.__notes__` fields. Empty nested groups are omitted " +"from the result." msgstr "" -"現有例外的巢狀結構會保留在結果裡,其 :attr:`message`、:attr:`~BaseException." -"__traceback__`、:attr:`~BaseException.__cause__`、:attr:`~BaseException." -"__context__` 及 :attr:`~BaseException.__notes__` 欄位的值也一樣。空的巢狀群組" -"會從結果裡排除。" +"現有例外的巢狀結構會保留在結果裡," +"其 :attr:`message`、:attr:`~BaseException.__traceback__`、:attr:`~BaseException.__cause__`、:attr:`~BaseException.__context__` " +"及 :attr:`~BaseException.__notes__` 欄位的值也一樣。空的巢狀群組會從結果裡排" +"除。" -#: ../../library/exceptions.rst:974 +#: ../../library/exceptions.rst:978 msgid "" "The condition is checked for all exceptions in the nested exception group, " "including the top-level and any nested exception groups. If the condition is " @@ -1423,11 +1443,11 @@ msgstr "" "條件會對巢狀例外群組裡的所有例外做檢查,包括頂層及任何巢狀的例外群組。如果條" "件對這樣的例外群組為 true,它會被完整包含在結果裡。" -#: ../../library/exceptions.rst:978 +#: ../../library/exceptions.rst:982 msgid "``condition`` can be any callable which is not a type object." msgstr "``condition`` 可以是任何不是型別物件的可呼叫物件。" -#: ../../library/exceptions.rst:983 +#: ../../library/exceptions.rst:987 msgid "" "Like :meth:`subgroup`, but returns the pair ``(match, rest)`` where " "``match`` is ``subgroup(condition)`` and ``rest`` is the remaining non-" @@ -1436,13 +1456,13 @@ msgstr "" "像 :meth:`subgroup` 一樣,但回傳一對 ``(match, rest)``,其中 ``match`` 是 " "``subgroup(condition)`` 而 ``rest`` 是剩下沒有比對到的部分。" -#: ../../library/exceptions.rst:989 +#: ../../library/exceptions.rst:993 msgid "" "Returns an exception group with the same :attr:`message`, but which wraps " "the exceptions in ``excs``." msgstr "回傳有相同 :attr:`message` 但將例外包裝在 ``excs`` 的例外群組。" -#: ../../library/exceptions.rst:992 +#: ../../library/exceptions.rst:996 msgid "" "This method is used by :meth:`subgroup` and :meth:`split`, which are used in " "various contexts to break up an exception group. A subclass needs to " @@ -1450,23 +1470,23 @@ msgid "" "instances of the subclass rather than :exc:`ExceptionGroup`." msgstr "" "此方法被 :meth:`subgroup` 及 :meth:`split` 使用,被用來在各種情境下拆分例外群" -"組。子類別需要覆寫它來讓 :meth:`subgroup` 及 :meth:`split` 回傳子類別而不是 :" -"exc:`ExceptionGroup` 的實例。" +"組。子類別需要覆寫它來讓 :meth:`subgroup` 及 :meth:`split` 回傳子類別而不" +"是 :exc:`ExceptionGroup` 的實例。" -#: ../../library/exceptions.rst:998 +#: ../../library/exceptions.rst:1002 msgid "" -":meth:`subgroup` and :meth:`split` copy the :attr:`~BaseException." -"__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException." -"__context__` and :attr:`~BaseException.__notes__` fields from the original " -"exception group to the one returned by :meth:`derive`, so these fields do " -"not need to be updated by :meth:`derive`." +":meth:`subgroup` and :meth:`split` copy " +"the :attr:`~BaseException.__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException.__context__` " +"and :attr:`~BaseException.__notes__` fields from the original exception " +"group to the one returned by :meth:`derive`, so these fields do not need to " +"be updated by :meth:`derive`." msgstr "" -":meth:`subgroup` 及 :meth:`split` 會從原始的例外群組複製 :attr:" -"`~BaseException.__traceback__`、:attr:`~BaseException.__cause__`、:attr:" -"`~BaseException.__context__` 和 :attr:`~BaseException.__notes__` 欄位到 :" -"meth:`derive` 所回傳的例外群組上,因此這些欄位不需要被 :meth:`derive` 更新。" +":meth:`subgroup` 及 :meth:`split` 會從原始的例外群組複" +"製 :attr:`~BaseException.__traceback__`、:attr:`~BaseException.__cause__`、:attr:`~BaseException.__context__` " +"和 :attr:`~BaseException.__notes__` 欄位到 :meth:`derive` 所回傳的例外群組" +"上,因此這些欄位不需要被 :meth:`derive` 更新。" -#: ../../library/exceptions.rst:1005 +#: ../../library/exceptions.rst:1009 msgid "" ">>> class MyGroup(ExceptionGroup):\n" "... def derive(self, excs):\n" @@ -1520,7 +1540,7 @@ msgstr "" ">>> exc.__traceback__ is match.__traceback__ is rest.__traceback__\n" "True" -#: ../../library/exceptions.rst:1031 +#: ../../library/exceptions.rst:1035 msgid "" "Note that :exc:`BaseExceptionGroup` defines :meth:`~object.__new__`, so " "subclasses that need a different constructor signature need to override that " @@ -1532,7 +1552,7 @@ msgstr "" "建構函式簽名的子類別需要覆寫它而不是 :meth:`~object.__init__`。例如下面定義了" "一個例外群組子類別接受 exit_code 並從中建構群組的訊息。: ::" -#: ../../library/exceptions.rst:1037 +#: ../../library/exceptions.rst:1041 msgid "" "class Errors(ExceptionGroup):\n" " def __new__(cls, errors, exit_code):\n" @@ -1552,24 +1572,24 @@ msgstr "" " def derive(self, excs):\n" " return Errors(excs, self.exit_code)" -#: ../../library/exceptions.rst:1046 +#: ../../library/exceptions.rst:1050 msgid "" "Like :exc:`ExceptionGroup`, any subclass of :exc:`BaseExceptionGroup` which " -"is also a subclass of :exc:`Exception` can only wrap instances of :exc:" -"`Exception`." +"is also a subclass of :exc:`Exception` can only wrap instances " +"of :exc:`Exception`." msgstr "" "像 :exc:`ExceptionGroup` 一樣,任何 :exc:`BaseExceptionGroup` 的子類別且也" "是 :exc:`Exception` 的子類別只能包裝 :exc:`Exception` 的實例。" -#: ../../library/exceptions.rst:1054 +#: ../../library/exceptions.rst:1058 msgid "Exception hierarchy" msgstr "例外階層" -#: ../../library/exceptions.rst:1056 +#: ../../library/exceptions.rst:1060 msgid "The class hierarchy for built-in exceptions is:" msgstr "內建例外的類別階層如下:" -#: ../../library/exceptions.rst:1058 +#: ../../library/exceptions.rst:1062 msgid "" "BaseException\n" " ├── BaseExceptionGroup\n" diff --git a/library/fnmatch.po b/library/fnmatch.po index 345fd99a0a..75dd730a60 100644 --- a/library/fnmatch.po +++ b/library/fnmatch.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-01-15 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -90,12 +90,20 @@ msgstr "" #: ../../library/fnmatch.rst:49 msgid "" -"Also note that :func:`functools.lru_cache` with the *maxsize* of 32768 is " -"used to cache the compiled regex patterns in the following functions: :func:" -"`fnmatch`, :func:`fnmatchcase`, :func:`.filter`." +"Unless stated otherwise, \"filename string\" and \"pattern string\" either " +"refer to :class:`str` or ``ISO-8859-1`` encoded :class:`bytes` objects. Note " +"that the functions documented below do not allow to mix a :class:`!bytes` " +"pattern with a :class:`!str` filename, and vice-versa." msgstr "" -#: ../../library/fnmatch.rst:55 +#: ../../library/fnmatch.rst:54 +msgid "" +"Finally, note that :func:`functools.lru_cache` with a *maxsize* of 32768 is " +"used to cache the (typed) compiled regex patterns in the following " +"functions: :func:`fnmatch`, :func:`fnmatchcase`, :func:`.filter`." +msgstr "" + +#: ../../library/fnmatch.rst:61 msgid "" "Test whether the filename string *name* matches the pattern string *pat*, " "returning ``True`` or ``False``. Both parameters are case-normalized using :" @@ -104,13 +112,13 @@ msgid "" "operating system." msgstr "" -#: ../../library/fnmatch.rst:61 +#: ../../library/fnmatch.rst:67 msgid "" "This example will print all file names in the current directory with the " "extension ``.txt``::" msgstr "" -#: ../../library/fnmatch.rst:64 +#: ../../library/fnmatch.rst:70 msgid "" "import fnmatch\n" "import os\n" @@ -126,35 +134,35 @@ msgstr "" " if fnmatch.fnmatch(file, '*.txt'):\n" " print(file)" -#: ../../library/fnmatch.rst:74 +#: ../../library/fnmatch.rst:80 msgid "" "Test whether the filename string *name* matches the pattern string *pat*, " "returning ``True`` or ``False``; the comparison is case-sensitive and does " "not apply :func:`os.path.normcase`." msgstr "" -#: ../../library/fnmatch.rst:81 +#: ../../library/fnmatch.rst:87 msgid "" -"Construct a list from those elements of the :term:`iterable` *names* that " -"match pattern *pat*. It is the same as ``[n for n in names if fnmatch(n, " -"pat)]``, but implemented more efficiently." +"Construct a list from those elements of the :term:`iterable` of filename " +"strings *names* that match the pattern string *pat*. It is the same as ``[n " +"for n in names if fnmatch(n, pat)]``, but implemented more efficiently." msgstr "" -#: ../../library/fnmatch.rst:89 +#: ../../library/fnmatch.rst:95 msgid "" "Return the shell-style pattern *pat* converted to a regular expression for " -"using with :func:`re.match`." +"using with :func:`re.match`. The pattern is expected to be a :class:`str`." msgstr "" -#: ../../library/fnmatch.rst:92 +#: ../../library/fnmatch.rst:98 msgid "Example:" msgstr "範例:" -#: ../../library/fnmatch.rst:106 +#: ../../library/fnmatch.rst:112 msgid "Module :mod:`glob`" msgstr ":mod:`glob` 模組" -#: ../../library/fnmatch.rst:107 +#: ../../library/fnmatch.rst:113 msgid "Unix shell-style path expansion." msgstr "" diff --git a/library/importlib.metadata.po b/library/importlib.metadata.po index 3f925524cf..16d9154e59 100644 --- a/library/importlib.metadata.po +++ b/library/importlib.metadata.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-23 00:14+0000\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -595,7 +595,7 @@ msgstr "" #: ../../library/importlib.metadata.rst:377 msgid "" "Return a mapping from the top level module and import package names found " -"via :attr:`sys.meta_path` to the names of the distribution packages (if any) " +"via :data:`sys.meta_path` to the names of the distribution packages (if any) " "that provide the corresponding files." msgstr "" diff --git a/library/importlib.po b/library/importlib.po index abe935981e..bdfc300dcf 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -574,19 +574,23 @@ msgid "" "implemented." msgstr "" -#: ../../library/importlib.rst:383 +#: ../../library/importlib.rst:383 ../../library/importlib.rst:631 +msgid "*Superseded by TraversableResources*" +msgstr "" + +#: ../../library/importlib.rst:385 msgid "" "An abstract base class for a :term:`loader` which implements the optional :" "pep:`302` protocol for loading arbitrary resources from the storage back-end." msgstr "" -#: ../../library/importlib.rst:387 +#: ../../library/importlib.rst:389 msgid "" "This ABC is deprecated in favour of supporting resource loading through :" -"class:`importlib.resources.abc.ResourceReader`." +"class:`importlib.resources.abc.TraversableResources`." msgstr "" -#: ../../library/importlib.rst:393 +#: ../../library/importlib.rst:395 msgid "" "An abstract method to return the bytes for the data located at *path*. " "Loaders that have a file-like storage back-end that allows storing arbitrary " @@ -596,34 +600,34 @@ msgid "" "__file__` attribute or an item from a package's :attr:`~module.__path__`." msgstr "" -#: ../../library/importlib.rst:402 +#: ../../library/importlib.rst:404 msgid "Raises :exc:`OSError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:408 +#: ../../library/importlib.rst:410 msgid "" "An abstract base class for a :term:`loader` which implements the optional :" "pep:`302` protocol for loaders that inspect modules." msgstr "" -#: ../../library/importlib.rst:413 +#: ../../library/importlib.rst:415 msgid "" "Return the code object for a module, or ``None`` if the module does not have " "a code object (as would be the case, for example, for a built-in module). " "Raise an :exc:`ImportError` if loader cannot find the requested module." msgstr "" -#: ../../library/importlib.rst:419 +#: ../../library/importlib.rst:421 msgid "" "While the method has a default implementation, it is suggested that it be " "overridden if possible for performance." msgstr "" -#: ../../library/importlib.rst:425 +#: ../../library/importlib.rst:427 msgid "No longer abstract and a concrete implementation is provided." msgstr "" -#: ../../library/importlib.rst:430 +#: ../../library/importlib.rst:432 msgid "" "An abstract method to return the source of a module. It is returned as a " "text string using :term:`universal newlines`, translating all recognized " @@ -632,23 +636,23 @@ msgid "" "cannot find the module specified." msgstr "" -#: ../../library/importlib.rst:436 ../../library/importlib.rst:445 -#: ../../library/importlib.rst:495 +#: ../../library/importlib.rst:438 ../../library/importlib.rst:447 +#: ../../library/importlib.rst:497 msgid "Raises :exc:`ImportError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:441 +#: ../../library/importlib.rst:443 msgid "" "An optional method to return a true value if the module is a package, a " "false value otherwise. :exc:`ImportError` is raised if the :term:`loader` " "cannot find the module." msgstr "" -#: ../../library/importlib.rst:450 +#: ../../library/importlib.rst:452 msgid "Create a code object from Python source." msgstr "" -#: ../../library/importlib.rst:452 +#: ../../library/importlib.rst:454 msgid "" "The *data* argument can be whatever the :func:`compile` function supports (i." "e. string or bytes). The *path* argument should be the \"path\" to where the " @@ -656,107 +660,107 @@ msgid "" "in a zip file)." msgstr "" -#: ../../library/importlib.rst:457 +#: ../../library/importlib.rst:459 msgid "" "With the subsequent code object one can execute it in a module by running " "``exec(code, module.__dict__)``." msgstr "" -#: ../../library/importlib.rst:462 +#: ../../library/importlib.rst:464 msgid "Made the method static." msgstr "" -#: ../../library/importlib.rst:467 +#: ../../library/importlib.rst:469 msgid "Implementation of :meth:`Loader.exec_module`." msgstr ":meth:`Loader.exec_module` 的實作。" -#: ../../library/importlib.rst:473 +#: ../../library/importlib.rst:475 msgid "Implementation of :meth:`Loader.load_module`." msgstr ":meth:`Loader.load_module` 的實作。" -#: ../../library/importlib.rst:475 +#: ../../library/importlib.rst:477 msgid "use :meth:`exec_module` instead." msgstr "請改用 :meth:`exec_module`。" -#: ../../library/importlib.rst:481 +#: ../../library/importlib.rst:483 msgid "" "An abstract base class which inherits from :class:`InspectLoader` that, when " "implemented, helps a module to be executed as a script. The ABC represents " "an optional :pep:`302` protocol." msgstr "" -#: ../../library/importlib.rst:487 +#: ../../library/importlib.rst:489 msgid "" "An abstract method that is to return the value of :attr:`~module.__file__` " "for the specified module. If no path is available, :exc:`ImportError` is " "raised." msgstr "" -#: ../../library/importlib.rst:491 +#: ../../library/importlib.rst:493 msgid "" "If source code is available, then the method should return the path to the " "source file, regardless of whether a bytecode was used to load the module." msgstr "" -#: ../../library/importlib.rst:501 +#: ../../library/importlib.rst:503 msgid "" "An abstract base class which inherits from :class:`ResourceLoader` and :" "class:`ExecutionLoader`, providing concrete implementations of :meth:" "`ResourceLoader.get_data` and :meth:`ExecutionLoader.get_filename`." msgstr "" -#: ../../library/importlib.rst:505 +#: ../../library/importlib.rst:507 msgid "" "The *fullname* argument is a fully resolved name of the module the loader is " "to handle. The *path* argument is the path to the file for the module." msgstr "" -#: ../../library/importlib.rst:512 +#: ../../library/importlib.rst:514 msgid "The name of the module the loader can handle." msgstr "" -#: ../../library/importlib.rst:516 +#: ../../library/importlib.rst:518 msgid "Path to the file of the module." msgstr "" -#: ../../library/importlib.rst:520 +#: ../../library/importlib.rst:522 msgid "Calls super's ``load_module()``." msgstr "" -#: ../../library/importlib.rst:522 +#: ../../library/importlib.rst:524 msgid "Use :meth:`Loader.exec_module` instead." msgstr "" -#: ../../library/importlib.rst:527 ../../library/importlib.rst:1122 +#: ../../library/importlib.rst:529 ../../library/importlib.rst:1124 msgid "Returns :attr:`path`." msgstr "" -#: ../../library/importlib.rst:531 +#: ../../library/importlib.rst:533 msgid "Reads *path* as a binary file and returns the bytes from it." msgstr "" -#: ../../library/importlib.rst:536 +#: ../../library/importlib.rst:538 msgid "" "An abstract base class for implementing source (and optionally bytecode) " "file loading. The class inherits from both :class:`ResourceLoader` and :" "class:`ExecutionLoader`, requiring the implementation of:" msgstr "" -#: ../../library/importlib.rst:540 +#: ../../library/importlib.rst:542 msgid ":meth:`ResourceLoader.get_data`" msgstr ":meth:`ResourceLoader.get_data`" -#: ../../library/importlib.rst:541 +#: ../../library/importlib.rst:543 msgid ":meth:`ExecutionLoader.get_filename`" msgstr ":meth:`ExecutionLoader.get_filename`" -#: ../../library/importlib.rst:542 +#: ../../library/importlib.rst:544 msgid "" "Should only return the path to the source file; sourceless loading is not " "supported." msgstr "" -#: ../../library/importlib.rst:545 +#: ../../library/importlib.rst:547 msgid "" "The abstract methods defined by this class are to add optional bytecode file " "support. Not implementing these optional methods (or causing them to raise :" @@ -768,83 +772,83 @@ msgid "" "bytecode-specific API is exposed." msgstr "" -#: ../../library/importlib.rst:556 +#: ../../library/importlib.rst:558 msgid "" "Optional abstract method which returns a :class:`dict` containing metadata " "about the specified path. Supported dictionary keys are:" msgstr "" -#: ../../library/importlib.rst:559 +#: ../../library/importlib.rst:561 msgid "" "``'mtime'`` (mandatory): an integer or floating-point number representing " "the modification time of the source code;" msgstr "" -#: ../../library/importlib.rst:561 +#: ../../library/importlib.rst:563 msgid "``'size'`` (optional): the size in bytes of the source code." msgstr "" -#: ../../library/importlib.rst:563 +#: ../../library/importlib.rst:565 msgid "" "Any other keys in the dictionary are ignored, to allow for future " "extensions. If the path cannot be handled, :exc:`OSError` is raised." msgstr "" -#: ../../library/importlib.rst:568 ../../library/importlib.rst:581 +#: ../../library/importlib.rst:570 ../../library/importlib.rst:583 msgid "Raise :exc:`OSError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:573 +#: ../../library/importlib.rst:575 msgid "" "Optional abstract method which returns the modification time for the " "specified path." msgstr "" -#: ../../library/importlib.rst:576 +#: ../../library/importlib.rst:578 msgid "" "This method is deprecated in favour of :meth:`path_stats`. You don't have " "to implement it, but it is still available for compatibility purposes. " "Raise :exc:`OSError` if the path cannot be handled." msgstr "" -#: ../../library/importlib.rst:586 +#: ../../library/importlib.rst:588 msgid "" "Optional abstract method which writes the specified bytes to a file path. " "Any intermediate directories which do not exist are to be created " "automatically." msgstr "" -#: ../../library/importlib.rst:590 +#: ../../library/importlib.rst:592 msgid "" "When writing to the path fails because the path is read-only (:const:`errno." "EACCES`/:exc:`PermissionError`), do not propagate the exception." msgstr "" -#: ../../library/importlib.rst:594 +#: ../../library/importlib.rst:596 msgid "No longer raises :exc:`NotImplementedError` when called." msgstr "" -#: ../../library/importlib.rst:599 +#: ../../library/importlib.rst:601 msgid "Concrete implementation of :meth:`InspectLoader.get_code`." msgstr "" -#: ../../library/importlib.rst:603 +#: ../../library/importlib.rst:605 msgid "Concrete implementation of :meth:`Loader.exec_module`." msgstr "" -#: ../../library/importlib.rst:609 +#: ../../library/importlib.rst:611 msgid "Concrete implementation of :meth:`Loader.load_module`." msgstr "" -#: ../../library/importlib.rst:611 +#: ../../library/importlib.rst:613 msgid "Use :meth:`exec_module` instead." msgstr "" -#: ../../library/importlib.rst:616 +#: ../../library/importlib.rst:618 msgid "Concrete implementation of :meth:`InspectLoader.get_source`." msgstr "" -#: ../../library/importlib.rst:620 +#: ../../library/importlib.rst:622 msgid "" "Concrete implementation of :meth:`InspectLoader.is_package`. A module is " "determined to be a package if its file path (as provided by :meth:" @@ -853,16 +857,12 @@ msgid "" "``__init__``." msgstr "" -#: ../../library/importlib.rst:629 -msgid "*Superseded by TraversableResources*" -msgstr "" - -#: ../../library/importlib.rst:631 +#: ../../library/importlib.rst:633 msgid "" "An :term:`abstract base class` to provide the ability to read *resources*." msgstr "" -#: ../../library/importlib.rst:634 +#: ../../library/importlib.rst:636 msgid "" "From the perspective of this ABC, a *resource* is a binary artifact that is " "shipped within a package. Typically this is something like a data file that " @@ -872,7 +872,7 @@ msgid "" "file versus on the file system." msgstr "" -#: ../../library/importlib.rst:642 +#: ../../library/importlib.rst:644 msgid "" "For any of methods of this class, a *resource* argument is expected to be a :" "term:`path-like object` which represents conceptually just a file name. This " @@ -884,7 +884,7 @@ msgid "" "potentially representing multiple packages or a module)." msgstr "" -#: ../../library/importlib.rst:653 +#: ../../library/importlib.rst:655 msgid "" "Loaders that wish to support resource reading are expected to provide a " "method called ``get_resource_reader(fullname)`` which returns an object " @@ -893,37 +893,37 @@ msgid "" "with this ABC should only be returned when the specified module is a package." msgstr "" -#: ../../library/importlib.rst:662 ../../library/importlib.rst:772 +#: ../../library/importlib.rst:664 ../../library/importlib.rst:774 msgid "Use :class:`importlib.resources.abc.TraversableResources` instead." msgstr "" -#: ../../library/importlib.rst:667 +#: ../../library/importlib.rst:669 msgid "" "Returns an opened, :term:`file-like object` for binary reading of the " "*resource*." msgstr "" -#: ../../library/importlib.rst:670 +#: ../../library/importlib.rst:672 msgid "If the resource cannot be found, :exc:`FileNotFoundError` is raised." msgstr "" -#: ../../library/importlib.rst:675 +#: ../../library/importlib.rst:677 msgid "Returns the file system path to the *resource*." msgstr "" -#: ../../library/importlib.rst:677 +#: ../../library/importlib.rst:679 msgid "" "If the resource does not concretely exist on the file system, raise :exc:" "`FileNotFoundError`." msgstr "" -#: ../../library/importlib.rst:682 +#: ../../library/importlib.rst:684 msgid "" "Returns ``True`` if the named *name* is considered a resource. :exc:" "`FileNotFoundError` is raised if *name* does not exist." msgstr "" -#: ../../library/importlib.rst:687 +#: ../../library/importlib.rst:689 msgid "" "Returns an :term:`iterable` of strings over the contents of the package. Do " "note that it is not required that all names returned by the iterator be " @@ -931,7 +931,7 @@ msgid "" "`is_resource` would be false." msgstr "" -#: ../../library/importlib.rst:693 +#: ../../library/importlib.rst:695 msgid "" "Allowing non-resource names to be returned is to allow for situations where " "how a package and its resources are stored are known a priori and the non-" @@ -940,71 +940,71 @@ msgid "" "stored on the file system then those subdirectory names can be used directly." msgstr "" -#: ../../library/importlib.rst:701 +#: ../../library/importlib.rst:703 msgid "The abstract method returns an iterable of no items." msgstr "" -#: ../../library/importlib.rst:706 +#: ../../library/importlib.rst:708 msgid "" "An object with a subset of :class:`pathlib.Path` methods suitable for " "traversing directories and opening files." msgstr "" -#: ../../library/importlib.rst:709 +#: ../../library/importlib.rst:711 msgid "" "For a representation of the object on the file-system, use :meth:`importlib." "resources.as_file`." msgstr "" -#: ../../library/importlib.rst:714 +#: ../../library/importlib.rst:716 msgid "Use :class:`importlib.resources.abc.Traversable` instead." msgstr "" -#: ../../library/importlib.rst:719 +#: ../../library/importlib.rst:721 msgid "Abstract. The base name of this object without any parent references." msgstr "" -#: ../../library/importlib.rst:723 +#: ../../library/importlib.rst:725 msgid "Yield ``Traversable`` objects in ``self``." msgstr "" -#: ../../library/importlib.rst:727 +#: ../../library/importlib.rst:729 msgid "Return ``True`` if ``self`` is a directory." msgstr "" -#: ../../library/importlib.rst:731 +#: ../../library/importlib.rst:733 msgid "Return ``True`` if ``self`` is a file." msgstr "" -#: ../../library/importlib.rst:735 +#: ../../library/importlib.rst:737 msgid "Return Traversable child in ``self``." msgstr "" -#: ../../library/importlib.rst:739 +#: ../../library/importlib.rst:741 msgid "Return ``Traversable`` child in ``self``." msgstr "" -#: ../../library/importlib.rst:743 +#: ../../library/importlib.rst:745 msgid "" "*mode* may be 'r' or 'rb' to open as text or binary. Return a handle " "suitable for reading (same as :attr:`pathlib.Path.open`)." msgstr "" -#: ../../library/importlib.rst:746 +#: ../../library/importlib.rst:748 msgid "" "When opening as text, accepts encoding parameters such as those accepted by :" -"attr:`io.TextIOWrapper`." +"class:`io.TextIOWrapper`." msgstr "" -#: ../../library/importlib.rst:751 +#: ../../library/importlib.rst:753 msgid "Read contents of ``self`` as bytes." msgstr "" -#: ../../library/importlib.rst:755 +#: ../../library/importlib.rst:757 msgid "Read contents of ``self`` as text." msgstr "" -#: ../../library/importlib.rst:760 +#: ../../library/importlib.rst:762 msgid "" "An abstract base class for resource readers capable of serving the :meth:" "`importlib.resources.files` interface. Subclasses :class:`importlib." @@ -1014,71 +1014,71 @@ msgid "" "also supplies ResourceReader." msgstr "" -#: ../../library/importlib.rst:767 +#: ../../library/importlib.rst:769 msgid "" "Loaders that wish to support resource reading are expected to implement this " "interface." msgstr "" -#: ../../library/importlib.rst:777 +#: ../../library/importlib.rst:779 msgid "" "Returns a :class:`importlib.resources.abc.Traversable` object for the loaded " "package." msgstr "" -#: ../../library/importlib.rst:783 +#: ../../library/importlib.rst:785 msgid ":mod:`importlib.machinery` -- Importers and path hooks" msgstr "" -#: ../../library/importlib.rst:788 +#: ../../library/importlib.rst:790 msgid "**Source code:** :source:`Lib/importlib/machinery.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/machinery.py`" -#: ../../library/importlib.rst:792 +#: ../../library/importlib.rst:794 msgid "" "This module contains the various objects that help :keyword:`import` find " "and load modules." msgstr "" -#: ../../library/importlib.rst:797 +#: ../../library/importlib.rst:799 msgid "" "A list of strings representing the recognized file suffixes for source " "modules." msgstr "" -#: ../../library/importlib.rst:804 +#: ../../library/importlib.rst:806 msgid "" "A list of strings representing the file suffixes for non-optimized bytecode " "modules." msgstr "" -#: ../../library/importlib.rst:809 ../../library/importlib.rst:819 -msgid "Use :attr:`BYTECODE_SUFFIXES` instead." +#: ../../library/importlib.rst:811 ../../library/importlib.rst:821 +msgid "Use :const:`BYTECODE_SUFFIXES` instead." msgstr "" -#: ../../library/importlib.rst:814 +#: ../../library/importlib.rst:816 msgid "" "A list of strings representing the file suffixes for optimized bytecode " "modules." msgstr "" -#: ../../library/importlib.rst:824 +#: ../../library/importlib.rst:826 msgid "" "A list of strings representing the recognized file suffixes for bytecode " "modules (including the leading dot)." msgstr "" -#: ../../library/importlib.rst:829 +#: ../../library/importlib.rst:831 msgid "The value is no longer dependent on ``__debug__``." msgstr "" -#: ../../library/importlib.rst:834 +#: ../../library/importlib.rst:836 msgid "" "A list of strings representing the recognized file suffixes for extension " "modules." msgstr "" -#: ../../library/importlib.rst:841 +#: ../../library/importlib.rst:843 msgid "" "Returns a combined list of strings representing all file suffixes for " "modules recognized by the standard import machinery. This is a helper for " @@ -1087,57 +1087,57 @@ msgid "" "`inspect.getmodulename`)." msgstr "" -#: ../../library/importlib.rst:852 +#: ../../library/importlib.rst:854 msgid "" "An :term:`importer` for built-in modules. All known built-in modules are " "listed in :data:`sys.builtin_module_names`. This class implements the :class:" "`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" -#: ../../library/importlib.rst:857 ../../library/importlib.rst:871 -#: ../../library/importlib.rst:884 ../../library/importlib.rst:899 +#: ../../library/importlib.rst:859 ../../library/importlib.rst:873 +#: ../../library/importlib.rst:886 ../../library/importlib.rst:901 msgid "" "Only class methods are defined by this class to alleviate the need for " "instantiation." msgstr "" -#: ../../library/importlib.rst:860 +#: ../../library/importlib.rst:862 msgid "" "As part of :pep:`489`, the builtin importer now implements :meth:`Loader." "create_module` and :meth:`Loader.exec_module`" msgstr "" -#: ../../library/importlib.rst:867 +#: ../../library/importlib.rst:869 msgid "" "An :term:`importer` for frozen modules. This class implements the :class:" "`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" -#: ../../library/importlib.rst:874 +#: ../../library/importlib.rst:876 msgid "" "Gained :meth:`~Loader.create_module` and :meth:`~Loader.exec_module` methods." msgstr "" -#: ../../library/importlib.rst:881 +#: ../../library/importlib.rst:883 msgid "" ":term:`Finder <finder>` for modules declared in the Windows registry. This " "class implements the :class:`importlib.abc.MetaPathFinder` ABC." msgstr "" -#: ../../library/importlib.rst:889 +#: ../../library/importlib.rst:891 msgid "" "Use :mod:`site` configuration instead. Future versions of Python may not " "enable this finder by default." msgstr "" -#: ../../library/importlib.rst:896 +#: ../../library/importlib.rst:898 msgid "" "A :term:`Finder <finder>` for :data:`sys.path` and package ``__path__`` " "attributes. This class implements the :class:`importlib.abc.MetaPathFinder` " "ABC." msgstr "" -#: ../../library/importlib.rst:904 +#: ../../library/importlib.rst:906 msgid "" "Class method that attempts to find a :term:`spec <module spec>` for the " "module specified by *fullname* on :data:`sys.path` or, if defined, on " @@ -1151,43 +1151,43 @@ msgid "" "cache and returned." msgstr "" -#: ../../library/importlib.rst:918 +#: ../../library/importlib.rst:920 msgid "" "If the current working directory -- represented by an empty string -- is no " "longer valid then ``None`` is returned but no value is cached in :data:`sys." "path_importer_cache`." msgstr "" -#: ../../library/importlib.rst:925 +#: ../../library/importlib.rst:927 msgid "" "Calls :meth:`importlib.abc.PathEntryFinder.invalidate_caches` on all finders " "stored in :data:`sys.path_importer_cache` that define the method. Otherwise " "entries in :data:`sys.path_importer_cache` set to ``None`` are deleted." msgstr "" -#: ../../library/importlib.rst:930 +#: ../../library/importlib.rst:932 msgid "Entries of ``None`` in :data:`sys.path_importer_cache` are deleted." msgstr "" -#: ../../library/importlib.rst:933 +#: ../../library/importlib.rst:935 msgid "" "Calls objects in :data:`sys.path_hooks` with the current working directory " "for ``''`` (i.e. the empty string)." msgstr "" -#: ../../library/importlib.rst:940 +#: ../../library/importlib.rst:942 msgid "" "A concrete implementation of :class:`importlib.abc.PathEntryFinder` which " "caches results from the file system." msgstr "" -#: ../../library/importlib.rst:943 +#: ../../library/importlib.rst:945 msgid "" "The *path* argument is the directory for which the finder is in charge of " "searching." msgstr "" -#: ../../library/importlib.rst:946 +#: ../../library/importlib.rst:948 msgid "" "The *loader_details* argument is a variable number of 2-item tuples each " "containing a loader and a sequence of file suffixes the loader recognizes. " @@ -1195,7 +1195,7 @@ msgid "" "module's name and the path to the file found." msgstr "" -#: ../../library/importlib.rst:951 +#: ../../library/importlib.rst:953 msgid "" "The finder will cache the directory contents as necessary, making stat calls " "for each module search to verify the cache is not outdated. Because cache " @@ -1208,166 +1208,166 @@ msgid "" "to call :func:`importlib.invalidate_caches`." msgstr "" -#: ../../library/importlib.rst:965 +#: ../../library/importlib.rst:967 msgid "The path the finder will search in." msgstr "" -#: ../../library/importlib.rst:969 +#: ../../library/importlib.rst:971 msgid "Attempt to find the spec to handle *fullname* within :attr:`path`." msgstr "" -#: ../../library/importlib.rst:975 +#: ../../library/importlib.rst:977 msgid "Clear out the internal cache." msgstr "" -#: ../../library/importlib.rst:979 +#: ../../library/importlib.rst:981 msgid "" "A class method which returns a closure for use on :data:`sys.path_hooks`. An " "instance of :class:`FileFinder` is returned by the closure using the path " "argument given to the closure directly and *loader_details* indirectly." msgstr "" -#: ../../library/importlib.rst:984 +#: ../../library/importlib.rst:986 msgid "" "If the argument to the closure is not an existing directory, :exc:" "`ImportError` is raised." msgstr "" -#: ../../library/importlib.rst:990 +#: ../../library/importlib.rst:992 msgid "" "A concrete implementation of :class:`importlib.abc.SourceLoader` by " "subclassing :class:`importlib.abc.FileLoader` and providing some concrete " "implementations of other methods." msgstr "" -#: ../../library/importlib.rst:998 +#: ../../library/importlib.rst:1000 msgid "The name of the module that this loader will handle." msgstr "" -#: ../../library/importlib.rst:1002 +#: ../../library/importlib.rst:1004 msgid "The path to the source file." msgstr "" -#: ../../library/importlib.rst:1006 +#: ../../library/importlib.rst:1008 msgid "Return ``True`` if :attr:`path` appears to be for a package." msgstr "" -#: ../../library/importlib.rst:1010 +#: ../../library/importlib.rst:1012 msgid "" "Concrete implementation of :meth:`importlib.abc.SourceLoader.path_stats`." msgstr "" -#: ../../library/importlib.rst:1014 +#: ../../library/importlib.rst:1016 msgid "Concrete implementation of :meth:`importlib.abc.SourceLoader.set_data`." msgstr "" -#: ../../library/importlib.rst:1018 ../../library/importlib.rst:1061 +#: ../../library/importlib.rst:1020 ../../library/importlib.rst:1063 msgid "" "Concrete implementation of :meth:`importlib.abc.Loader.load_module` where " "specifying the name of the module to load is optional." msgstr "" -#: ../../library/importlib.rst:1023 ../../library/importlib.rst:1066 +#: ../../library/importlib.rst:1025 ../../library/importlib.rst:1068 msgid "Use :meth:`importlib.abc.Loader.exec_module` instead." msgstr "" -#: ../../library/importlib.rst:1028 +#: ../../library/importlib.rst:1030 msgid "" "A concrete implementation of :class:`importlib.abc.FileLoader` which can " "import bytecode files (i.e. no source code files exist)." msgstr "" -#: ../../library/importlib.rst:1031 +#: ../../library/importlib.rst:1033 msgid "" "Please note that direct use of bytecode files (and thus not source code " "files) inhibits your modules from being usable by all Python implementations " "or new versions of Python which change the bytecode format." msgstr "" -#: ../../library/importlib.rst:1040 +#: ../../library/importlib.rst:1042 msgid "The name of the module the loader will handle." msgstr "" -#: ../../library/importlib.rst:1044 +#: ../../library/importlib.rst:1046 msgid "The path to the bytecode file." msgstr "" -#: ../../library/importlib.rst:1048 +#: ../../library/importlib.rst:1050 msgid "Determines if the module is a package based on :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1052 +#: ../../library/importlib.rst:1054 msgid "Returns the code object for :attr:`name` created from :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1056 +#: ../../library/importlib.rst:1058 msgid "" "Returns ``None`` as bytecode files have no source when this loader is used." msgstr "" -#: ../../library/importlib.rst:1071 +#: ../../library/importlib.rst:1073 msgid "" "A concrete implementation of :class:`importlib.abc.ExecutionLoader` for " "extension modules." msgstr "" -#: ../../library/importlib.rst:1074 +#: ../../library/importlib.rst:1076 msgid "" "The *fullname* argument specifies the name of the module the loader is to " "support. The *path* argument is the path to the extension module's file." msgstr "" -#: ../../library/importlib.rst:1077 +#: ../../library/importlib.rst:1079 msgid "" "Note that, by default, importing an extension module will fail in " "subinterpreters if it doesn't implement multi-phase init (see :pep:`489`), " "even if it would otherwise import successfully." msgstr "" -#: ../../library/importlib.rst:1083 +#: ../../library/importlib.rst:1085 msgid "Multi-phase init is now required for use in subinterpreters." msgstr "" -#: ../../library/importlib.rst:1088 ../../library/importlib.rst:1274 +#: ../../library/importlib.rst:1090 ../../library/importlib.rst:1276 msgid "Name of the module the loader supports." msgstr "" -#: ../../library/importlib.rst:1092 +#: ../../library/importlib.rst:1094 msgid "Path to the extension module." msgstr "" -#: ../../library/importlib.rst:1096 +#: ../../library/importlib.rst:1098 msgid "" "Creates the module object from the given specification in accordance with :" "pep:`489`." msgstr "" -#: ../../library/importlib.rst:1103 +#: ../../library/importlib.rst:1105 msgid "Initializes the given module object in accordance with :pep:`489`." msgstr "" -#: ../../library/importlib.rst:1109 +#: ../../library/importlib.rst:1111 msgid "" "Returns ``True`` if the file path points to a package's ``__init__`` module " -"based on :attr:`EXTENSION_SUFFIXES`." +"based on :const:`EXTENSION_SUFFIXES`." msgstr "" -#: ../../library/importlib.rst:1114 +#: ../../library/importlib.rst:1116 msgid "Returns ``None`` as extension modules lack a code object." msgstr "" -#: ../../library/importlib.rst:1118 +#: ../../library/importlib.rst:1120 msgid "Returns ``None`` as extension modules do not have source code." msgstr "" -#: ../../library/importlib.rst:1129 +#: ../../library/importlib.rst:1131 msgid "" "A concrete implementation of :class:`importlib.abc.InspectLoader` for " "namespace packages. This is an alias for a private class and is only made " "public for introspecting the ``__loader__`` attribute on namespace packages::" msgstr "" -#: ../../library/importlib.rst:1134 +#: ../../library/importlib.rst:1136 msgid "" ">>> from importlib.machinery import NamespaceLoader\n" ">>> import my_namespace\n" @@ -1385,7 +1385,7 @@ msgstr "" ">>> isinstance(my_namespace.__loader__, importlib.abc.Loader)\n" "True" -#: ../../library/importlib.rst:1147 +#: ../../library/importlib.rst:1149 msgid "" "A specification for a module's import-system-related state. This is " "typically exposed as the module's :attr:`~module.__spec__` attribute. Many " @@ -1398,19 +1398,19 @@ msgid "" "origin>`, and vice versa." msgstr "" -#: ../../library/importlib.rst:1161 +#: ../../library/importlib.rst:1163 msgid "" "The module's fully qualified name (see :attr:`module.__name__`). The :term:" "`finder` should always set this attribute to a non-empty string." msgstr "" -#: ../../library/importlib.rst:1166 +#: ../../library/importlib.rst:1168 msgid "" "The :term:`loader` used to load the module (see :attr:`module.__loader__`). " "The :term:`finder` should always set this attribute." msgstr "" -#: ../../library/importlib.rst:1171 +#: ../../library/importlib.rst:1173 msgid "" "The location the :term:`loader` should use to load the module (see :attr:" "`module.__file__`). For example, for modules loaded from a ``.py`` file this " @@ -1419,14 +1419,14 @@ msgid "" "there is not one (like for namespace packages), it should be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1180 +#: ../../library/importlib.rst:1182 msgid "" "A (possibly empty) :term:`sequence` of strings enumerating the locations in " "which a package's submodules will be found (see :attr:`module.__path__`). " "Most of the time there will only be a single directory in this list." msgstr "" -#: ../../library/importlib.rst:1185 +#: ../../library/importlib.rst:1187 msgid "" "The :term:`finder` should set this attribute to a sequence, even an empty " "one, to indicate to the import system that the module is a package. It " @@ -1434,41 +1434,41 @@ msgid "" "later to a special object for namespace packages." msgstr "" -#: ../../library/importlib.rst:1193 +#: ../../library/importlib.rst:1195 msgid "" "The :term:`finder` may set this attribute to an object containing " "additional, module-specific data to use when loading the module. Otherwise " "it should be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1199 +#: ../../library/importlib.rst:1201 msgid "" "The filename of a compiled version of the module's code (see :attr:`module." "__cached__`). The :term:`finder` should always set this attribute but it may " "be ``None`` for modules that do not need compiled code stored." msgstr "" -#: ../../library/importlib.rst:1206 +#: ../../library/importlib.rst:1208 msgid "" "(Read-only) The fully qualified name of the package the module is in (or the " "empty string for a top-level module). See :attr:`module.__package__`. If the " "module is a package then this is the same as :attr:`name`." msgstr "" -#: ../../library/importlib.rst:1213 +#: ../../library/importlib.rst:1215 msgid "" "``True`` if the spec's :attr:`origin` refers to a loadable location, " "``False`` otherwise. This value impacts how :attr:`!origin` is interpreted " "and how the module's :attr:`~module.__file__` is populated." msgstr "" -#: ../../library/importlib.rst:1220 +#: ../../library/importlib.rst:1222 msgid "" "A specialization of :class:`importlib.machinery.ExtensionFileLoader` that is " "able to load extension modules in Framework format." msgstr "" -#: ../../library/importlib.rst:1223 +#: ../../library/importlib.rst:1225 msgid "" "For compatibility with the iOS App Store, *all* binary modules in an iOS app " "must be dynamic libraries, contained in a framework with appropriate " @@ -1477,7 +1477,7 @@ msgid "" "material outside the Frameworks folder." msgstr "" -#: ../../library/importlib.rst:1229 +#: ../../library/importlib.rst:1231 msgid "" "To accommodate this requirement, when running on iOS, extension module " "binaries are *not* packaged as ``.so`` files on ``sys.path``, but as " @@ -1491,7 +1491,7 @@ msgid "" "fwork`` file, relative to the app bundle." msgstr "" -#: ../../library/importlib.rst:1240 +#: ../../library/importlib.rst:1242 msgid "" "For example, consider the case of an import ``from foo.bar import _whiz``, " "where ``_whiz`` is implemented with the binary module ``sources/foo/bar/" @@ -1507,7 +1507,7 @@ msgid "" "_whiz.origin``, containing the path to the ``.fwork`` file." msgstr "" -#: ../../library/importlib.rst:1254 +#: ../../library/importlib.rst:1256 msgid "" "When a module is loaded with this loader, the ``__file__`` for the module " "will report as the location of the ``.fwork`` file. This allows code to use " @@ -1516,7 +1516,7 @@ msgid "" "in the ``.framework`` folder." msgstr "" -#: ../../library/importlib.rst:1260 +#: ../../library/importlib.rst:1262 msgid "" "The Xcode project building the app is responsible for converting any ``.so`` " "files from wherever they exist in the ``PYTHONPATH`` into frameworks in the " @@ -1527,35 +1527,35 @@ msgid "" "details on how to construct this build step." msgstr "" -#: ../../library/importlib.rst:1270 +#: ../../library/importlib.rst:1272 msgid "Availability" msgstr "" -#: ../../library/importlib.rst:1278 +#: ../../library/importlib.rst:1280 msgid "Path to the ``.fwork`` file for the extension module." msgstr "" -#: ../../library/importlib.rst:1282 +#: ../../library/importlib.rst:1284 msgid ":mod:`importlib.util` -- Utility code for importers" msgstr "" -#: ../../library/importlib.rst:1288 +#: ../../library/importlib.rst:1290 msgid "**Source code:** :source:`Lib/importlib/util.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/util.py`" -#: ../../library/importlib.rst:1292 +#: ../../library/importlib.rst:1294 msgid "" "This module contains the various objects that help in the construction of " "an :term:`importer`." msgstr "" -#: ../../library/importlib.rst:1297 +#: ../../library/importlib.rst:1299 msgid "" "The bytes which represent the bytecode version number. If you need help with " "loading/writing bytecode then consider :class:`importlib.abc.SourceLoader`." msgstr "" -#: ../../library/importlib.rst:1304 +#: ../../library/importlib.rst:1306 msgid "" "Return the :pep:`3147`/:pep:`488` path to the byte-compiled file associated " "with the source *path*. For example, if *path* is ``/foo/bar/baz.py`` the " @@ -1565,7 +1565,7 @@ msgid "" "`NotImplementedError` will be raised)." msgstr "" -#: ../../library/importlib.rst:1311 +#: ../../library/importlib.rst:1313 msgid "" "The *optimization* parameter is used to specify the optimization level of " "the bytecode file. An empty string represents no optimization, so ``/foo/bar/" @@ -1578,7 +1578,7 @@ msgid "" "be alphanumeric, else :exc:`ValueError` is raised." msgstr "" -#: ../../library/importlib.rst:1321 +#: ../../library/importlib.rst:1323 msgid "" "The *debug_override* parameter is deprecated and can be used to override the " "system's value for ``__debug__``. A ``True`` value is the equivalent of " @@ -1587,18 +1587,18 @@ msgid "" "are not ``None`` then :exc:`TypeError` is raised." msgstr "" -#: ../../library/importlib.rst:1329 +#: ../../library/importlib.rst:1331 msgid "" "The *optimization* parameter was added and the *debug_override* parameter " "was deprecated." msgstr "" -#: ../../library/importlib.rst:1333 ../../library/importlib.rst:1349 -#: ../../library/importlib.rst:1438 +#: ../../library/importlib.rst:1335 ../../library/importlib.rst:1351 +#: ../../library/importlib.rst:1440 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/importlib.rst:1339 +#: ../../library/importlib.rst:1341 msgid "" "Given the *path* to a :pep:`3147` file name, return the associated source " "code file path. For example, if *path* is ``/foo/bar/__pycache__/baz." @@ -1608,25 +1608,25 @@ msgid "" "cache_tag` is not defined, :exc:`NotImplementedError` is raised." msgstr "" -#: ../../library/importlib.rst:1354 +#: ../../library/importlib.rst:1356 msgid "" "Decode the given bytes representing source code and return it as a string " "with universal newlines (as required by :meth:`importlib.abc.InspectLoader." "get_source`)." msgstr "" -#: ../../library/importlib.rst:1362 +#: ../../library/importlib.rst:1364 msgid "Resolve a relative module name to an absolute one." msgstr "" -#: ../../library/importlib.rst:1364 +#: ../../library/importlib.rst:1366 msgid "" "If **name** has no leading dots, then **name** is simply returned. This " "allows for usage such as ``importlib.util.resolve_name('sys', __spec__." "parent)`` without doing a check to see if the **package** argument is needed." msgstr "" -#: ../../library/importlib.rst:1369 +#: ../../library/importlib.rst:1371 msgid "" ":exc:`ImportError` is raised if **name** is a relative module name but " "**package** is a false value (e.g. ``None`` or the empty string). :exc:" @@ -1634,13 +1634,13 @@ msgid "" "package (e.g. requesting ``..bacon`` from within the ``spam`` package)." msgstr "" -#: ../../library/importlib.rst:1377 +#: ../../library/importlib.rst:1379 msgid "" "To improve consistency with import statements, raise :exc:`ImportError` " "instead of :exc:`ValueError` for invalid relative import attempts." msgstr "" -#: ../../library/importlib.rst:1384 +#: ../../library/importlib.rst:1386 msgid "" "Find the :term:`spec <module spec>` for a module, optionally relative to the " "specified **package** name. If the module is in :data:`sys.modules`, then " @@ -1650,30 +1650,30 @@ msgid "" "if no spec is found." msgstr "" -#: ../../library/importlib.rst:1391 +#: ../../library/importlib.rst:1393 msgid "" "If **name** is for a submodule (contains a dot), the parent module is " "automatically imported." msgstr "" -#: ../../library/importlib.rst:1394 +#: ../../library/importlib.rst:1396 msgid "**name** and **package** work the same as for :func:`import_module`." msgstr "" -#: ../../library/importlib.rst:1398 +#: ../../library/importlib.rst:1400 msgid "" "Raises :exc:`ModuleNotFoundError` instead of :exc:`AttributeError` if " "**package** is in fact not a package (i.e. lacks a :attr:`~module.__path__` " "attribute)." msgstr "" -#: ../../library/importlib.rst:1405 +#: ../../library/importlib.rst:1407 msgid "" "Create a new module based on **spec** and :meth:`spec.loader.create_module " "<importlib.abc.Loader.create_module>`." msgstr "" -#: ../../library/importlib.rst:1408 +#: ../../library/importlib.rst:1410 msgid "" "If :meth:`spec.loader.create_module <importlib.abc.Loader.create_module>` " "does not return ``None``, then any pre-existing attributes will not be " @@ -1681,14 +1681,14 @@ msgid "" "accessing **spec** or setting an attribute on the module." msgstr "" -#: ../../library/importlib.rst:1413 +#: ../../library/importlib.rst:1415 msgid "" "This function is preferred over using :class:`types.ModuleType` to create a " "new module as **spec** is used to set as many import-controlled attributes " "on the module as possible." msgstr "" -#: ../../library/importlib.rst:1421 +#: ../../library/importlib.rst:1423 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on a loader. The parameters have the same meaning as they do " @@ -1697,7 +1697,7 @@ msgid "" "spec." msgstr "" -#: ../../library/importlib.rst:1431 +#: ../../library/importlib.rst:1433 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on the path to a file. Missing information will be filled in " @@ -1705,14 +1705,14 @@ msgid "" "module will be file-based." msgstr "" -#: ../../library/importlib.rst:1443 +#: ../../library/importlib.rst:1445 msgid "" "Return the hash of *source_bytes* as bytes. A hash-based ``.pyc`` file " "embeds the :func:`source_hash` of the corresponding source file's contents " "in its header." msgstr "" -#: ../../library/importlib.rst:1451 +#: ../../library/importlib.rst:1453 msgid "" "A context manager that can temporarily skip the compatibility check for " "extension modules. By default the check is enabled and will fail when a " @@ -1721,33 +1721,33 @@ msgid "" "interpreter GIL, when imported in an interpreter with its own GIL." msgstr "" -#: ../../library/importlib.rst:1458 +#: ../../library/importlib.rst:1460 msgid "" "Note that this function is meant to accommodate an unusual case; one which " "is likely to eventually go away. There's is a pretty good chance this is " "not what you were looking for." msgstr "" -#: ../../library/importlib.rst:1462 +#: ../../library/importlib.rst:1464 msgid "" "You can get the same effect as this function by implementing the basic " "interface of multi-phase init (:pep:`489`) and lying about support for " "multiple interpreters (or per-interpreter GIL)." msgstr "" -#: ../../library/importlib.rst:1467 +#: ../../library/importlib.rst:1469 msgid "" "Using this function to disable the check can lead to unexpected behavior and " "even crashes. It should only be used during extension module development." msgstr "" -#: ../../library/importlib.rst:1475 +#: ../../library/importlib.rst:1477 msgid "" "A class which postpones the execution of the loader of a module until the " "module has an attribute accessed." msgstr "" -#: ../../library/importlib.rst:1478 +#: ../../library/importlib.rst:1480 msgid "" "This class **only** works with loaders that define :meth:`~importlib.abc." "Loader.exec_module` as control over what module type is used for the module " @@ -1760,7 +1760,7 @@ msgid "" "raised if such a substitution is detected." msgstr "" -#: ../../library/importlib.rst:1489 +#: ../../library/importlib.rst:1491 msgid "" "For projects where startup time is critical, this class allows for " "potentially minimizing the cost of loading a module if it is never used. For " @@ -1769,21 +1769,21 @@ msgid "" "postponed and thus occurring out of context." msgstr "" -#: ../../library/importlib.rst:1497 +#: ../../library/importlib.rst:1499 msgid "" "Began calling :meth:`~importlib.abc.Loader.create_module`, removing the " "compatibility warning for :class:`importlib.machinery.BuiltinImporter` and :" "class:`importlib.machinery.ExtensionFileLoader`." msgstr "" -#: ../../library/importlib.rst:1504 +#: ../../library/importlib.rst:1506 msgid "" "A class method which returns a callable that creates a lazy loader. This is " "meant to be used in situations where the loader is passed by class instead " "of by instance. ::" msgstr "" -#: ../../library/importlib.rst:1509 +#: ../../library/importlib.rst:1511 msgid "" "suffixes = importlib.machinery.SOURCE_SUFFIXES\n" "loader = importlib.machinery.SourceFileLoader\n" @@ -1795,20 +1795,20 @@ msgstr "" "lazy_loader = importlib.util.LazyLoader.factory(loader)\n" "finder = importlib.machinery.FileFinder(path, (lazy_loader, suffixes))" -#: ../../library/importlib.rst:1517 +#: ../../library/importlib.rst:1519 msgid "Examples" msgstr "範例" -#: ../../library/importlib.rst:1520 +#: ../../library/importlib.rst:1522 msgid "Importing programmatically" msgstr "" -#: ../../library/importlib.rst:1522 +#: ../../library/importlib.rst:1524 msgid "" "To programmatically import a module, use :func:`importlib.import_module`. ::" msgstr "" -#: ../../library/importlib.rst:1525 +#: ../../library/importlib.rst:1527 msgid "" "import importlib\n" "\n" @@ -1818,23 +1818,23 @@ msgstr "" "\n" "itertools = importlib.import_module('itertools')" -#: ../../library/importlib.rst:1531 +#: ../../library/importlib.rst:1533 msgid "Checking if a module can be imported" msgstr "" -#: ../../library/importlib.rst:1533 +#: ../../library/importlib.rst:1535 msgid "" "If you need to find out if a module can be imported without actually doing " "the import, then you should use :func:`importlib.util.find_spec`." msgstr "" -#: ../../library/importlib.rst:1536 +#: ../../library/importlib.rst:1538 msgid "" "Note that if ``name`` is a submodule (contains a dot), :func:`importlib.util." "find_spec` will import the parent module. ::" msgstr "" -#: ../../library/importlib.rst:1540 +#: ../../library/importlib.rst:1542 msgid "" "import importlib.util\n" "import sys\n" @@ -1854,11 +1854,11 @@ msgid "" " print(f\"can't find the {name!r} module\")" msgstr "" -#: ../../library/importlib.rst:1559 +#: ../../library/importlib.rst:1561 msgid "Importing a source file directly" msgstr "" -#: ../../library/importlib.rst:1561 +#: ../../library/importlib.rst:1563 msgid "" "This recipe should be used with caution: it is an approximation of an import " "statement where the file path is specified directly, rather than :data:`sys." @@ -1868,13 +1868,13 @@ msgid "" "file is appropriate." msgstr "" -#: ../../library/importlib.rst:1568 +#: ../../library/importlib.rst:1570 msgid "" "To import a Python source file directly from a path, use the following " "recipe::" msgstr "" -#: ../../library/importlib.rst:1570 +#: ../../library/importlib.rst:1572 msgid "" "import importlib.util\n" "import sys\n" @@ -1897,15 +1897,15 @@ msgid "" "json = import_from_path(module_name, file_path)" msgstr "" -#: ../../library/importlib.rst:1592 +#: ../../library/importlib.rst:1594 msgid "Implementing lazy imports" msgstr "" -#: ../../library/importlib.rst:1594 +#: ../../library/importlib.rst:1596 msgid "The example below shows how to implement lazy imports::" msgstr "" -#: ../../library/importlib.rst:1596 +#: ../../library/importlib.rst:1598 msgid "" ">>> import importlib.util\n" ">>> import sys\n" @@ -1925,11 +1925,11 @@ msgid "" "False" msgstr "" -#: ../../library/importlib.rst:1615 +#: ../../library/importlib.rst:1617 msgid "Setting up an importer" msgstr "" -#: ../../library/importlib.rst:1617 +#: ../../library/importlib.rst:1619 msgid "" "For deep customizations of import, you typically want to implement an :term:" "`importer`. This means managing both the :term:`finder` and :term:`loader` " @@ -1943,7 +1943,7 @@ msgid "" "for the appropriate classes defined within this package)::" msgstr "" -#: ../../library/importlib.rst:1628 +#: ../../library/importlib.rst:1630 msgid "" "import importlib.machinery\n" "import sys\n" @@ -1967,11 +1967,11 @@ msgid "" "sys.path_hooks.append(SpamPathEntryFinder.path_hook(loader_details))" msgstr "" -#: ../../library/importlib.rst:1649 +#: ../../library/importlib.rst:1651 msgid "Approximating :func:`importlib.import_module`" msgstr "" -#: ../../library/importlib.rst:1651 +#: ../../library/importlib.rst:1653 msgid "" "Import itself is implemented in Python code, making it possible to expose " "most of the import machinery through importlib. The following helps " @@ -1979,7 +1979,7 @@ msgid "" "approximate implementation of :func:`importlib.import_module`::" msgstr "" -#: ../../library/importlib.rst:1657 +#: ../../library/importlib.rst:1659 msgid "" "import importlib.util\n" "import sys\n" @@ -2012,11 +2012,11 @@ msgid "" " return module" msgstr "" -#: ../../library/importlib.rst:422 +#: ../../library/importlib.rst:424 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/importlib.rst:422 +#: ../../library/importlib.rst:424 msgid "importlib.abc.InspectLoader.get_source method" msgstr "importlib.abc.InspectLoader.get_source 方法" diff --git a/library/index.po b/library/index.po index 35406943a5..45c84d8fd6 100644 --- a/library/index.po +++ b/library/index.po @@ -1,10 +1,8 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Liang-Bo Wang <me@liang2.tw>, 2015-2016 -# Liang-Bo Wang <me@liang2.tw>, 2016 # Frank Jheng <M157q.tw@gmail.com>, 2015 # Steven Hsu <hsuhaochun@gmail.com>, 2021 msgid "" diff --git a/library/itertools.po b/library/itertools.po index 48da6e992c..9da2ed2ccd 100644 --- a/library/itertools.po +++ b/library/itertools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-17 00:14+0000\n" +"POT-Creation-Date: 2025-02-07 15:02+0800\n" "PO-Revision-Date: 2024-08-16 15:01+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -488,10 +488,10 @@ msgid "" "www.ramseysolutions.com/real-estate/amortization-schedule>`_, accumulate the " "interest and apply payments:" msgstr "" -"*function* 引數可以被設定為 :func:`min` 以得到連續的最小值,設定為 :func:" -"`max` 以得到連續的最大值,或者設定為 :func:`operator.mul` 以得到連續的乘積。" -"也可以透過累積利息和付款來建立\\ `攤銷表 (Amortization tables) <https://www." -"ramseysolutions.com/real-estate/amortization-schedule>`_ :" +"*function* 引數可以被設定為 :func:`min` 以得到連續的最小值,設定" +"為 :func:`max` 以得到連續的最大值,或者設定為 :func:`operator.mul` 以得到連續" +"的乘積。也可以透過累積利息和付款來建立\\ `攤銷表 (Amortization tables) " +"<https://www.ramseysolutions.com/real-estate/amortization-schedule>`_ :" #: ../../library/itertools.rst:136 msgid "" @@ -630,9 +630,9 @@ msgstr "從輸入 *iterable* 中回傳長度為 *r* 的元素的子序列。" #: ../../library/itertools.rst:227 msgid "" "The output is a subsequence of :func:`product` keeping only entries that are " -"subsequences of the *iterable*. The length of the output is given by :func:" -"`math.comb` which computes ``n! / r! / (n - r)!`` when ``0 ≤ r ≤ n`` or zero " -"when ``r > n``." +"subsequences of the *iterable*. The length of the output is given " +"by :func:`math.comb` which computes ``n! / r! / (n - r)!`` when ``0 ≤ r ≤ " +"n`` or zero when ``r > n``." msgstr "" "輸出是 :func:`product` 的子序列,僅保留作為 *iterable* 子序列的條目。輸出的長" "度由 :func:`math.comb` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / r! / (n - r)!" @@ -758,8 +758,8 @@ msgstr "" #: ../../library/itertools.rst:323 msgid "" "Make an iterator that returns evenly spaced values beginning with *start*. " -"Can be used with :func:`map` to generate consecutive data points or with :" -"func:`zip` to add sequence numbers. Roughly equivalent to::" +"Can be used with :func:`map` to generate consecutive data points or " +"with :func:`zip` to add sequence numbers. Roughly equivalent to::" msgstr "" "建立一個疊代器,回傳從 *start* 開始的等差的值。可以與 :func:`map` 一起使用來" "產生連續的資料點,或與 :func:`zip` 一起使用來增加序列號。大致等價於: ::" @@ -939,9 +939,9 @@ msgstr "" #: ../../library/itertools.rst:420 msgid "" "The returned group is itself an iterator that shares the underlying iterable " -"with :func:`groupby`. Because the source is shared, when the :func:" -"`groupby` object is advanced, the previous group is no longer visible. So, " -"if that data is needed later, it should be stored as a list::" +"with :func:`groupby`. Because the source is shared, when " +"the :func:`groupby` object is advanced, the previous group is no longer " +"visible. So, if that data is needed later, it should be stored as a list::" msgstr "" "回傳的群組本身是一個與 :func:`groupby` 共享底層可疊代物件的疊代器。由於來源是" "共享的,當 :func:`groupby` 物件前進時,前一個群組將不再可見。因此,如果之後需" @@ -1146,11 +1146,11 @@ msgstr "" #: ../../library/itertools.rst:536 msgid "" -"Return successive *r* length `permutations of elements <https://www." -"britannica.com/science/permutation>`_ from the *iterable*." +"Return successive *r* length `permutations of elements <https://" +"www.britannica.com/science/permutation>`_ from the *iterable*." msgstr "" -"回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 <https://www.britannica." -"com/science/permutation>`_ 。" +"回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 <https://" +"www.britannica.com/science/permutation>`_ 。" #: ../../library/itertools.rst:539 msgid "" @@ -1163,13 +1163,13 @@ msgstr "" #: ../../library/itertools.rst:543 msgid "" "The output is a subsequence of :func:`product` where entries with repeated " -"elements have been filtered out. The length of the output is given by :func:" -"`math.perm` which computes ``n! / (n - r)!`` when ``0 ≤ r ≤ n`` or zero when " -"``r > n``." +"elements have been filtered out. The length of the output is given " +"by :func:`math.perm` which computes ``n! / (n - r)!`` when ``0 ≤ r ≤ n`` or " +"zero when ``r > n``." msgstr "" -"輸出是 :func:`product` 的子序列,其中重複元素的條目已被濾除。輸出的長度由 :" -"func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 ``r " -"> n`` 時為零。" +"輸出是 :func:`product` 的子序列,其中重複元素的條目已被濾除。輸出的長度" +"由 :func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 " +"``r > n`` 時為零。" #: ../../library/itertools.rst:548 msgid "" @@ -1432,14 +1432,15 @@ msgid "" "the input iterator and there is no way to access it. This could be an issue " "if an application wants to further consume the input iterator after " "*takewhile* has been run to exhaustion. To work around this problem, " -"consider using `more-itertools before_and_after() <https://more-itertools." -"readthedocs.io/en/stable/api.html#more_itertools.before_and_after>`_ instead." +"consider using `more-itertools before_and_after() <https://more-" +"itertools.readthedocs.io/en/stable/" +"api.html#more_itertools.before_and_after>`_ instead." msgstr "" "注意,第一個不符合條件判斷的元素將從輸入疊代器中被消耗,且無法再存取它。如果" "應用程式希望在 *takewhile* 耗盡後進一步消耗輸入疊代器,這可能會是個問題。為了" "解決這個問題,可以考慮使用 `more-itertools 中的 before_and_after() <https://" -"more-itertools.readthedocs.io/en/stable/api.html#more_itertools." -"before_and_after>`_ 作為替代。" +"more-itertools.readthedocs.io/en/stable/" +"api.html#more_itertools.before_and_after>`_ 作為替代。" #: ../../library/itertools.rst:691 msgid "Return *n* independent iterators from a single iterable." @@ -1485,9 +1486,9 @@ msgstr "" msgid "" "When the input *iterable* is already a tee iterator object, all members of " "the return tuple are constructed as if they had been produced by the " -"upstream :func:`tee` call. This \"flattening step\" allows nested :func:" -"`tee` calls to share the same underlying data chain and to have a single " -"update step rather than a chain of calls." +"upstream :func:`tee` call. This \"flattening step\" allows " +"nested :func:`tee` calls to share the same underlying data chain and to have " +"a single update step rather than a chain of calls." msgstr "" #: ../../library/itertools.rst:734 @@ -1521,19 +1522,19 @@ msgid "" "even if the original *iterable* is threadsafe." msgstr "" "``tee`` 疊代器不是執行緒安全 (threadsafe) 的。當同時使用由同一個 :func:`tee` " -"呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引發 :exc:" -"`RuntimeError`。" +"呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引" +"發 :exc:`RuntimeError`。" #: ../../library/itertools.rst:758 msgid "" "This itertool may require significant auxiliary storage (depending on how " "much temporary data needs to be stored). In general, if one iterator uses " -"most or all of the data before another iterator starts, it is faster to use :" -"func:`list` instead of :func:`tee`." +"most or all of the data before another iterator starts, it is faster to " +"use :func:`list` instead of :func:`tee`." msgstr "" "此 itertool 可能需要大量的輔助儲存空間(取決於需要儲存多少臨時資料)。通常如" -"果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使用 :func:" -"`list` 會比 :func:`tee` 更快。" +"果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使" +"用 :func:`list` 會比 :func:`tee` 更快。" #: ../../library/itertools.rst:766 msgid "Make an iterator that aggregates elements from each of the *iterables*." @@ -1599,9 +1600,9 @@ msgstr "" #: ../../library/itertools.rst:798 msgid "" -"If one of the iterables is potentially infinite, then the :func:" -"`zip_longest` function should be wrapped with something that limits the " -"number of calls (for example :func:`islice` or :func:`takewhile`)." +"If one of the iterables is potentially infinite, then " +"the :func:`zip_longest` function should be wrapped with something that " +"limits the number of calls (for example :func:`islice` or :func:`takewhile`)." msgstr "" "如果其中一個 iterables 可能是無限的,那麼應該用別的可以限制呼叫次數的方法來包" "裝 :func:`zip_longest` 函式(例如 :func:`islice` 或 :func:`takewhile`)。" @@ -1624,16 +1625,16 @@ msgid "" "``chain.from_iterable`` is related to the concept of flattening. The " "recipes also give ideas about ways that the tools can be combined — for " "example, how ``starmap()`` and ``repeat()`` can work together. The recipes " -"also show patterns for using itertools with the :mod:`operator` and :mod:" -"`collections` modules as well as with the built-in itertools such as " -"``map()``, ``filter()``, ``reversed()``, and ``enumerate()``." +"also show patterns for using itertools with the :mod:`operator` " +"and :mod:`collections` modules as well as with the built-in itertools such " +"as ``map()``, ``filter()``, ``reversed()``, and ``enumerate()``." msgstr "" "itertools 應用技巧的主要目的是教學。這些應用技巧展示了對單個工具進行思考的各" "種方式 —— 例如,``chain.from_iterable`` 與攤平 (flattening) 的概念相關。這些" "應用技巧還提供了組合使用工具的想法 —— 例如,``starmap()`` 和 ``repeat()`` 如" -"何一起工作。另外還展示了將 itertools 與 :mod:`operator` 和 :mod:" -"`collections` 模組一同使用以及與內建 itertools(如 ``map()``、``filter()``、" -"``reversed()`` 和 ``enumerate()``)一同使用的模式。" +"何一起工作。另外還展示了將 itertools 與 :mod:`operator` " +"和 :mod:`collections` 模組一同使用以及與內建 itertools(如 ``map()``、" +"``filter()``、``reversed()`` 和 ``enumerate()``)一同使用的模式。" #: ../../library/itertools.rst:820 msgid "" @@ -1652,8 +1653,8 @@ msgid "" "Substantially all of these recipes and many, many others can be installed " "from the :pypi:`more-itertools` project found on the Python Package Index::" msgstr "" -"幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上的 :" -"pypi:`more-itertools` 專案中安裝: ::" +"幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上" +"的 :pypi:`more-itertools` 專案中安裝: ::" #: ../../library/itertools.rst:829 msgid "python -m pip install more-itertools" @@ -1674,15 +1675,15 @@ msgstr "" "可疊代物件一次性引入記憶體,能保持優異的記憶體性能。以\\ `函式風格 " "(functional style) <https://www.cs.kent.ac.uk/people/staff/dat/miranda/" "whyfp90.pdf>`_ 將工具連接在一起,能將程式碼的數量維持在較少的情況。透過優先使" -"用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和\\ :" -"term:`產生器 <generator>`,則能保持高速度。" +"用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和" +"\\ :term:`產生器 <generator>`,則能保持高速度。" #: ../../library/itertools.rst:839 msgid "" -"from collections import deque\n" +"from collections import Counter, deque\n" "from contextlib import suppress\n" "from functools import reduce\n" -"from math import sumprod, isqrt\n" +"from math import comb, prod, sumprod, isqrt\n" "from operator import itemgetter, getitem, mul, neg\n" "\n" "def take(n, iterable):\n" @@ -1972,7 +1973,13 @@ msgid "" " # totient(12) → 4 because len([1, 5, 7, 11]) == 4\n" " for prime in set(factor(n)):\n" " n -= n // prime\n" -" return n" +" return n\n" +"\n" +"def multinomial(*counts):\n" +" \"Number of distinct arrangements of a multiset.\"\n" +" # Counter('abracadabra').values() -> 5 2 1 1 2\n" +" # multinomial(5, 2, 1, 1, 2) → 83160\n" +" return prod(map(comb, accumulate(counts), counts))" msgstr "" #~ msgid "" diff --git a/library/json.po b/library/json.po index 76e792b8cb..5c7cb4ed9f 100644 --- a/library/json.po +++ b/library/json.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-01-09 00:13+0000\n" "PO-Revision-Date: 2023-08-05 15:25+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,12 +30,12 @@ msgstr "**原始碼:**\\ :source:`Lib/json/__init__.py`" #: ../../library/json.rst:14 msgid "" -"`JSON (JavaScript Object Notation) <https://json.org>`_, specified by :rfc:" -"`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 <https://ecma-" +"`JSON (JavaScript Object Notation) <https://json.org>`_, specified " +"by :rfc:`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 <https://ecma-" "international.org/publications-and-standards/standards/ecma-404/>`_, is a " -"lightweight data interchange format inspired by `JavaScript <https://en." -"wikipedia.org/wiki/JavaScript>`_ object literal syntax (although it is not a " -"strict subset of JavaScript [#rfc-errata]_ )." +"lightweight data interchange format inspired by `JavaScript <https://" +"en.wikipedia.org/wiki/JavaScript>`_ object literal syntax (although it is " +"not a strict subset of JavaScript [#rfc-errata]_ )." msgstr "" "`JSON (JavaScript Object Notation) <https://json.org>`_ 是一個輕量化的資料交" "換格式,在 :rfc:`7159`\\ (其廢棄了 :rfc:`4627`\\ )及 `ECMA-404 <https://" @@ -55,8 +55,8 @@ msgstr "" #: ../../library/json.rst:26 msgid "" -":mod:`json` exposes an API familiar to users of the standard library :mod:" -"`marshal` and :mod:`pickle` modules." +":mod:`json` exposes an API familiar to users of the standard " +"library :mod:`marshal` and :mod:`pickle` modules." msgstr "" ":mod:`json` 為習慣標準函式庫 :mod:`marshal` 與 :mod:`pickle` 模組的使用者提供" "熟悉的 API。" @@ -141,8 +141,8 @@ msgid "" ">>> import json\n" ">>> def custom_json(obj):\n" "... if isinstance(obj, complex):\n" -"... return {'__complex__': True, 'real': obj.real, 'imag': obj." -"imag}\n" +"... return {'__complex__': True, 'real': obj.real, 'imag': " +"obj.imag}\n" "... raise TypeError(f'Cannot serialize object of {type(obj)}')\n" "...\n" ">>> json.dumps(1 + 2j, default=custom_json)\n" @@ -280,153 +280,139 @@ msgstr "基本用法" #: ../../library/json.rst:153 msgid "" "Serialize *obj* as a JSON formatted stream to *fp* (a ``.write()``-" -"supporting :term:`file-like object`) using this :ref:`conversion table <py-" -"to-json-table>`." +"supporting :term:`file-like object`) using this :ref:`Python-to-JSON " +"conversion table <py-to-json-table>`." msgstr "" -"參考這個\\ :ref:`轉換表 <py-to-json-table>`\\ 將 *obj* 序列化為符合 JSON 格式" -"的串流,並寫入到 *fp* (一個支援 ``.write()`` 方法的 :term:`file-like " -"object`)" +"參考這個 :ref:`Python-to-JSON 轉換表 <py-to-json-table>`\\ 將 *obj* 序列化為" +"符合 JSON 格式的串流,並寫入到 *fp* (一個支援 ``.write()`` 方法" +"的 :term:`file-like object`)" -#: ../../library/json.rst:157 +# SkyLull: 我想這裡的 "framed protocol" 指的是 +# https://peps.python.org/pep-3154/#framing +#: ../../library/json.rst:159 msgid "" -"If *skipkeys* is true (default: ``False``), then dict keys that are not of a " -"basic type (:class:`str`, :class:`int`, :class:`float`, :class:`bool`, " -"``None``) will be skipped instead of raising a :exc:`TypeError`." +"Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol, so " +"trying to serialize multiple objects with repeated calls to :func:`dump` " +"using the same *fp* will result in an invalid JSON file." msgstr "" -"如果 *skipkeys* 被設為 true(預設值:``False``),那麼非基本型別(:class:" -"`str`、:class:`int`、:class:`float`、:class:`bool`、``None``)的 dictionary" -"(字典)鍵值將被略過而不會引發 :exc:`TypeError`。" +"與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 不具有二進位分框(binary " +"framed)的協定,因此嘗試重複呼叫 :func:`dump` 來序列化多個物件到同一個 *fp* " +"裡將導致無效的 JSON 檔案。" -#: ../../library/json.rst:161 +#: ../../library/json.rst:0 +msgid "Parameters" +msgstr "參數" + +#: ../../library/json.rst:163 +msgid "The Python object to be serialized." +msgstr "要被序列化的 Python 物件。" + +#: ../../library/json.rst:166 msgid "" -"The :mod:`json` module always produces :class:`str` objects, not :class:" -"`bytes` objects. Therefore, ``fp.write()`` must support :class:`str` input." +"The file-like object *obj* will be serialized to. The :mod:`!json` module " +"always produces :class:`str` objects, not :class:`bytes` objects, therefore " +"``fp.write()`` must support :class:`str` input." msgstr "" -":mod:`json` 模組總是產生 :class:`str` 物件,而非 :class:`bytes` 物件。因此," -"``fp.write()`` 必須支援 :class:`str` 輸入。" -#: ../../library/json.rst:165 ../../library/json.rst:442 +#: ../../library/json.rst:173 msgid "" -"If *ensure_ascii* is true (the default), the output is guaranteed to have " -"all incoming non-ASCII characters escaped. If *ensure_ascii* is false, " -"these characters will be output as-is." +"If ``True``, keys that are not of a basic type " +"(:class:`str`, :class:`int`, :class:`float`, :class:`bool`, ``None``) will " +"be skipped instead of raising a :exc:`TypeError`. Default ``False``." msgstr "" -"如果 *ensure_ascii* 被設為 true(預設值),則輸出時將確保所有輸入的非 ASCII " -"字元都會被轉義。若 *ensure_ascii* 為 false,則這些字元將照原樣輸出。" -#: ../../library/json.rst:169 +#: ../../library/json.rst:179 msgid "" -"If *check_circular* is false (default: ``True``), then the circular " -"reference check for container types will be skipped and a circular reference " -"will result in a :exc:`RecursionError` (or worse)." +"If ``True`` (the default), the output is guaranteed to have all incoming non-" +"ASCII characters escaped. If ``False``, these characters will be outputted " +"as-is." msgstr "" -"如果 *check_circular* 設為 false(預設是 ``True``),則針對不同容器型別的循環" -"參照 (circular reference) 檢查將會被跳過,若有循環參照則最後將引發 :exc:" -"`RecursionError` (或其他更糟的錯誤)。" -#: ../../library/json.rst:173 +#: ../../library/json.rst:184 msgid "" -"If *allow_nan* is false (default: ``True``), then it will be a :exc:" -"`ValueError` to serialize out of range :class:`float` values (``nan``, " -"``inf``, ``-inf``) in strict compliance of the JSON specification. If " -"*allow_nan* is true, their JavaScript equivalents (``NaN``, ``Infinity``, ``-" -"Infinity``) will be used." +"If ``False``, the circular reference check for container types is skipped " +"and a circular reference will result in a :exc:`RecursionError` (or worse). " +"Default ``True``." msgstr "" -"如果 *allow_nan* 為 false(預設值:``True``\\ ),則序列化不符合嚴格 JSON 規" -"範的 :class:`float` 值 (``nan``, ``inf``, ``-inf``) 會引發 :exc:" -"`ValueError`。如果 *allow_nan* 為 true,則將使用它們的 JavaScript 等效表示 " -"(``NaN``, ``Infinity``, ``-Infinity``)。" +"如為 ``False``,則針對不同容器型別的循環參照 (circular reference) 檢查將會被" +"跳過,若有循環參照則最後將引發 :exc:`RecursionError`\\ (或其他更糟的錯誤)。" +"預設為 ``True``。" -#: ../../library/json.rst:179 ../../library/json.rst:461 +#: ../../library/json.rst:189 msgid "" -"If *indent* is a non-negative integer or string, then JSON array elements " -"and object members will be pretty-printed with that indent level. An indent " -"level of 0, negative, or ``\"\"`` will only insert newlines. ``None`` (the " -"default) selects the most compact representation. Using a positive integer " -"indent indents that many spaces per level. If *indent* is a string (such as " -"``\"\\t\"``), that string is used to indent each level." +"If ``False``, serialization of out-of-range :class:`float` values (``nan``, " +"``inf``, ``-inf``) will result in a :exc:`ValueError`, in strict compliance " +"with the JSON specification. If ``True`` (the default), their JavaScript " +"equivalents (``NaN``, ``Infinity``, ``-Infinity``) are used." msgstr "" -"如果 *indent* 是非負整數或字串,則 JSON 陣列元素和物件成員將使用該縮排等級進" -"行格式美化。縮排等級 0、負數或 ``\"\"`` 只會插入換行符號。``None``\\ (預設" -"值)等於是選擇最緊湊的表示法。使用正整數縮排可以在每層縮排數量相同的空格。如" -"果 *indent* 是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個層級。" - -#: ../../library/json.rst:186 ../../library/json.rst:468 -msgid "Allow strings for *indent* in addition to integers." -msgstr "除了整數之外,*indent* 還允許使用字串作為輸入。" +"如為 ``False``,則序列化不符合嚴格 JSON 規範的超出範圍 :class:`float` 值 " +"(``nan``, ``inf``, ``-inf``) 會引發 :exc:`ValueError`。如為 ``True``\\ (預設" +"值),則將使用它們的 JavaScript 等效表示 (``NaN``, ``Infinity``, ``-" +"Infinity``)。" -#: ../../library/json.rst:189 ../../library/json.rst:471 +#: ../../library/json.rst:196 msgid "" -"If specified, *separators* should be an ``(item_separator, key_separator)`` " -"tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', " -"': ')`` otherwise. To get the most compact JSON representation, you should " -"specify ``(',', ':')`` to eliminate whitespace." +"If set, a custom JSON encoder with the :meth:`~JSONEncoder.default` method " +"overridden, for serializing into custom datatypes. If ``None`` (the " +"default), :class:`!JSONEncoder` is used." msgstr "" -"如果有指定本引數內容,*separators* 應該是一個 ``(item_separator, " -"key_separator)`` 二元組。如果 *indent* 為 ``None`` 則預設為 ``(', ', ': " -"')``,否則預設為 ``(',', ': ')``。想要獲得最緊湊的 JSON 表示形式,你可以改成" -"指定 ``(',', ':')`` 來消除空格。" -#: ../../library/json.rst:194 ../../library/json.rst:476 -msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``." -msgstr "如果 *indent* 不是 ``None``,則使用 ``(',', ': ')`` 作為預設值" - -#: ../../library/json.rst:197 ../../library/json.rst:479 +#: ../../library/json.rst:203 msgid "" -"If specified, *default* should be a function that gets called for objects " -"that can't otherwise be serialized. It should return a JSON encodable " -"version of the object or raise a :exc:`TypeError`. If not specified, :exc:" -"`TypeError` is raised." +"If a positive integer or string, JSON array elements and object members will " +"be pretty-printed with that indent level. A positive integer indents that " +"many spaces per level; a string (such as ``\"\\t\"``) is used to indent each " +"level. If zero, negative, or ``\"\"`` (the empty string), only newlines are " +"inserted. If ``None`` (the default), the most compact representation is used." msgstr "" -"如果有指定本參數,*default* 會是一個遭遇無法序列化的物件時會被呼叫的函式。它" -"應該回傳該物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會直接" -"引發 :exc:`TypeError`。" -#: ../../library/json.rst:202 +#: ../../library/json.rst:213 msgid "" -"If *sort_keys* is true (default: ``False``), then the output of dictionaries " -"will be sorted by key." +"A two-tuple: ``(item_separator, key_separator)``. If ``None`` (the default), " +"*separators* defaults to ``(', ', ': ')`` if *indent* is ``None``, and " +"``(',', ': ')`` otherwise. For the most compact JSON, specify ``(',', ':')`` " +"to eliminate whitespace." msgstr "" -"如果 *sort_keys* 為 true(預設值:``False``),則字典的輸出將按鍵值排序。" +"一個二元組:``(item_separator, key_separator)``。如為 ``None``\\ (預設值)" +"則 *separators* 被預設為 ``(', ', ': ')``,否則預設為 ``(',', ': ')``。想要獲" +"得最緊湊的 JSON 表示形式,你可以指定 ``(',', ':')`` 來消除空格。" -#: ../../library/json.rst:205 +#: ../../library/json.rst:222 msgid "" -"To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the :" -"meth:`~JSONEncoder.default` method to serialize additional types), specify " -"it with the *cls* kwarg; otherwise :class:`JSONEncoder` is used." +"A function that is called for objects that can't otherwise be serialized. It " +"should return a JSON encodable version of the object or raise " +"a :exc:`TypeError`. If ``None`` (the default), :exc:`!TypeError` is raised." msgstr "" -"若要使用繼承自 :class:`JSONEncoder` 的自訂子類別(例如覆寫 :meth:" -"`~JSONEncoder.default` 方法來序列化其他型別的一個子類別物件),請使用關鍵字引" -"數 *cls* 指定該類別物件;否則預設使用 :class:`JSONEncoder`。" -#: ../../library/json.rst:209 ../../library/json.rst:287 +#: ../../library/json.rst:229 msgid "" -"All optional parameters are now :ref:`keyword-only <keyword-only_parameter>`." +"If ``True``, dictionaries will be outputted sorted by key. Default ``False``." msgstr "" -"所有可選參數現在都是\\ :ref:`僅限關鍵字 <keyword-only_parameter>`\\ 參數了。" -# SkyLull: 我想這裡的 "framed protocol" 指的是 -# https://peps.python.org/pep-3154/#framing -#: ../../library/json.rst:214 +#: ../../library/json.rst:233 ../../library/json.rst:518 +msgid "Allow strings for *indent* in addition to integers." +msgstr "除了整數之外,*indent* 還允許使用字串作為輸入。" + +#: ../../library/json.rst:236 ../../library/json.rst:526 +msgid "Use ``(',', ': ')`` as default if *indent* is not ``None``." +msgstr "如果 *indent* 不是 ``None``,則使用 ``(',', ': ')`` 作為預設值" + +#: ../../library/json.rst:239 ../../library/json.rst:338 msgid "" -"Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol, so " -"trying to serialize multiple objects with repeated calls to :func:`dump` " -"using the same *fp* will result in an invalid JSON file." +"All optional parameters are now :ref:`keyword-only <keyword-only_parameter>`." msgstr "" -"與 :mod:`pickle` 和 :mod:`marshal` 不同,JSON 不具有二進位分框(binary " -"framed)的協定,因此嘗試重複呼叫 :func:`dump` 來序列化多個物件到同一個 *fp* " -"裡將導致無效的 JSON 檔案。" +"所有可選參數現在都是\\ :ref:`僅限關鍵字 <keyword-only_parameter>`\\ 參數了。" -#: ../../library/json.rst:223 +#: ../../library/json.rst:248 msgid "" "Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion " -"table <py-to-json-table>`. The arguments have the same meaning as in :func:" -"`dump`." +"table <py-to-json-table>`. The arguments have the same meaning as " +"in :func:`dump`." msgstr "" -"使用此\\ :ref:`轉換表 <json-to-py-table>`\\ 來將 *obj* 序列化為 JSON 格式 :" -"class:`str`。這個引數的作用與 :func:`dump` 中的同名引數意義相同。" +"使用此\\ :ref:`轉換表 <json-to-py-table>`\\ 來將 *obj* 序列化為 JSON 格" +"式 :class:`str`。這個引數的作用與 :func:`dump` 中的同名引數意義相同。" -#: ../../library/json.rst:229 +#: ../../library/json.rst:254 msgid "" "Keys in key/value pairs of JSON are always of the type :class:`str`. When a " "dictionary is converted into JSON, all the keys of the dictionary are " @@ -439,113 +425,120 @@ msgstr "" "轉換回字典,則該字典可能不等於原始字典。也就是說,如果字典 x 含有非字串鍵值," "則 ``loads(dumps(x)) != x``。" -#: ../../library/json.rst:238 +#: ../../library/json.rst:265 msgid "" -"Deserialize *fp* (a ``.read()``-supporting :term:`text file` or :term:" -"`binary file` containing a JSON document) to a Python object using this :ref:" -"`conversion table <json-to-py-table>`." +"Deserialize *fp* to a Python object using the :ref:`JSON-to-Python " +"conversion table <json-to-py-table>`." msgstr "" -"使用此\\ :ref:`轉換表 <json-to-py-table>`\\ 來將 *fp*\\ (一個支援 ``." -"read()``、包含 JSON 文件的\\ :term:`文字檔案 <text file>`\\ 或\\ :term:`二進" -"位檔案 <binary file>`\\ )去序列化為 Python 物件。" +"使用此 :ref:`JSON-to-Python 轉換表 <json-to-py-table>`\\ 將 *fp* 解碼為 " +"Python 物件。" -#: ../../library/json.rst:242 +#: ../../library/json.rst:268 msgid "" -"*object_hook* is an optional function that will be called with the result of " -"any object literal decoded (a :class:`dict`). The return value of " -"*object_hook* will be used instead of the :class:`dict`. This feature can " -"be used to implement custom decoders (e.g. `JSON-RPC <https://www.jsonrpc." -"org>`_ class hinting)." +"A ``.read()``-supporting :term:`text file` or :term:`binary file` containing " +"the JSON document to be deserialized." +msgstr "" + +#: ../../library/json.rst:273 +msgid "" +"If set, a custom JSON decoder. Additional keyword arguments to :func:`!load` " +"will be passed to the constructor of *cls*. If ``None`` (the " +"default), :class:`!JSONDecoder` is used." +msgstr "" + +#: ../../library/json.rst:280 +#, fuzzy +msgid "" +"If set, a function that is called with the result of any object literal " +"decoded (a :class:`dict`). The return value of this function will be used " +"instead of the :class:`dict`. This feature can be used to implement custom " +"decoders, for example `JSON-RPC <https://www.jsonrpc.org>`_ class hinting. " +"Default ``None``." msgstr "" "*object_hook* 是一個可選引數,其接受一個函式作為輸入。原始的字串解碼結果(一" "個 :class:`dict`\\ )將被傳入這個函式、並使用 *object_hook* 的回傳值來取代原" "先的 :class:`dict` 輸出。此功能可用於實作自訂解碼器(例如 `JSON-RPC <https://" "www.jsonrpc.org>`_ 類別提示)。" -#: ../../library/json.rst:248 +#: ../../library/json.rst:290 +#, fuzzy msgid "" -"*object_pairs_hook* is an optional function that will be called with the " -"result of any object literal decoded with an ordered list of pairs. The " -"return value of *object_pairs_hook* will be used instead of the :class:" -"`dict`. This feature can be used to implement custom decoders. If " -"*object_hook* is also defined, the *object_pairs_hook* takes priority." +"If set, a function that is called with the result of any object literal " +"decoded with an ordered list of pairs. The return value of this function " +"will be used instead of the :class:`dict`. This feature can be used to " +"implement custom decoders. If *object_hook* is also set, *object_pairs_hook* " +"takes priority. Default ``None``." msgstr "" "*object_pairs_hook* 是一個可選引數,其接受一個函式作為輸入。原始的有序對串列" "(ordered list of pairs)解碼結果將被傳入這個函式、並使用 " "*object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功能可用於實作" "自訂解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優先。" -#: ../../library/json.rst:254 ../../library/json.rst:358 -msgid "Added support for *object_pairs_hook*." -msgstr "新增對於 *object_pairs_hook* 的支援。" - -#: ../../library/json.rst:257 ../../library/json.rst:361 +#: ../../library/json.rst:300 +#, fuzzy msgid "" -"*parse_float* is an optional function that will be called with the string of " -"every JSON float to be decoded. By default, this is equivalent to " -"``float(num_str)``. This can be used to use another datatype or parser for " -"JSON floats (e.g. :class:`decimal.Decimal`)." +"If set, a function that is called with the string of every JSON float to be " +"decoded. If ``None`` (the default), it is equivalent to ``float(num_str)``. " +"This can be used to parse JSON floats into custom datatypes, for " +"example :class:`decimal.Decimal`." msgstr "" "*parse_float* 為可選函式,每個要被解碼的 JSON 浮點數字串都會改用這個參數給定" "的函式來進行解碼。預設情況這等效於 ``float(num_str)``。這個參數可用於將 JSON " "中的浮點數解碼或剖析為另一種資料型別(例如 :class:`decimal.Decimal`\\ )。" -#: ../../library/json.rst:262 ../../library/json.rst:366 +#: ../../library/json.rst:308 +#, fuzzy msgid "" -"*parse_int* is an optional function that will be called with the string of " -"every JSON int to be decoded. By default, this is equivalent to " -"``int(num_str)``. This can be used to use another datatype or parser for " -"JSON integers (e.g. :class:`float`)." +"If set, a function that is called with the string of every JSON int to be " +"decoded. If ``None`` (the default), it is equivalent to ``int(num_str)``. " +"This can be used to parse JSON integers into custom datatypes, for " +"example :class:`float`." msgstr "" "*parse_int* 為可選函式,當解碼 JSON 整數字串時會被呼叫。預設情況等效於 " "``int(num_str)``。這個參數可用於將 JSON 中的整數解碼或剖析為另一種資料型別" "(例如 :class:`float`)。" -#: ../../library/json.rst:267 +#: ../../library/json.rst:316 +#, fuzzy msgid "" -"The default *parse_int* of :func:`int` now limits the maximum length of the " -"integer string via the interpreter's :ref:`integer string conversion length " -"limitation <int_max_str_digits>` to help avoid denial of service attacks." -msgstr "" -"預設 *parse_int* 使用的 :func:`int` 函式現在有限制整數字串的長度上限了,限制" -"由直譯器的\\ :ref:`整數字串轉換長度限制 <int_max_str_digits>`\\ 機制來達成," -"這能防止阻斷服務攻擊 (Denial of Service attacks)。" - -#: ../../library/json.rst:273 ../../library/json.rst:371 -msgid "" -"*parse_constant* is an optional function that will be called with one of the " -"following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be " -"used to raise an exception if invalid JSON numbers are encountered." +"If set, a function that is called with one of the following strings: ``'-" +"Infinity'``, ``'Infinity'``, or ``'NaN'``. This can be used to raise an " +"exception if invalid JSON numbers are encountered. Default ``None``." msgstr "" "*parse_constant* 為可選函式,在解碼時若遭遇字串 ``'-Infinity'``、" "``'Infinity'`` 或 ``'NaN'`` 其中之一則會改用這個參數給定的函式來進行解碼。這" "也可用於使解碼過程中遇到無效的 JSON 數字時引發一個例外。" -#: ../../library/json.rst:277 -msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore." +#: ../../library/json.rst:0 +msgid "Raises" msgstr "" -"遭遇 'null'、'true' 或 'false' 時不再以 *parse_constant* 給定的函式來處理了。" -#: ../../library/json.rst:280 -msgid "" -"To use a custom :class:`JSONDecoder` subclass, specify it with the ``cls`` " -"kwarg; otherwise :class:`JSONDecoder` is used. Additional keyword arguments " -"will be passed to the constructor of the class." +#: ../../library/json.rst:324 +#, fuzzy +msgid "When the data being deserialized is not a valid JSON document." msgstr "" -"若想要使用自訂的 :class:`JSONDecoder` 子類別物件,請以 ``cls`` 關鍵字引數指定" -"之,否則將使用預設的 :class:`JSONDecoder`。其他未使用到的關鍵字引數將繼續傳入" -"給 JSONDecoder 的建構函式使用。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" +"發 :exc:`JSONDecodeError` 例外。" -#: ../../library/json.rst:284 ../../library/json.rst:302 -#: ../../library/json.rst:380 +#: ../../library/json.rst:327 +#, fuzzy msgid "" -"If the data being deserialized is not a valid JSON document, a :exc:" -"`JSONDecodeError` will be raised." +"When the data being deserialized does not contain UTF-8, UTF-16 or UTF-32 " +"encoded data." msgstr "" -"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" -"`JSONDecodeError` 例外。" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" +"發 :exc:`JSONDecodeError` 例外。" -#: ../../library/json.rst:290 +#: ../../library/json.rst:333 +msgid "Added the optional *object_pairs_hook* parameter." +msgstr "新增可選的 *object_pairs_hook* 參數。" + +#: ../../library/json.rst:334 +msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore." +msgstr "" +"遭遇 'null'、'true' 或 'false' 時不再以 *parse_constant* 給定的函式來處理了。" + +#: ../../library/json.rst:339 msgid "" "*fp* can now be a :term:`binary file`. The input encoding should be UTF-8, " "UTF-16 or UTF-32." @@ -553,21 +546,29 @@ msgstr "" "現在,*fp* 可以是一個\\ :term:`二進位檔案 <binary file>`,前提是其編碼格式為 " "UTF-8、UTF-16 或 UTF-32。" -#: ../../library/json.rst:296 +#: ../../library/json.rst:342 msgid "" -"Deserialize *s* (a :class:`str`, :class:`bytes` or :class:`bytearray` " -"instance containing a JSON document) to a Python object using this :ref:" -"`conversion table <json-to-py-table>`." +"The default *parse_int* of :func:`int` now limits the maximum length of the " +"integer string via the interpreter's :ref:`integer string conversion length " +"limitation <int_max_str_digits>` to help avoid denial of service attacks." msgstr "" -"使用\\ :ref:`轉換表 <json-to-py-table>`\\ 將 *s* (一個含有 JSON 文件的 :" -"class:`str`、:class:`bytes` 或 :class:`bytearray` 的實例(instance))去序列" -"化(deserialize)為一個 Python 物件" +"預設 *parse_int* 使用的 :func:`int` 函式現在有限制整數字串的長度上限了,限制" +"由直譯器的\\ :ref:`整數字串轉換長度限制 <int_max_str_digits>`\\ 機制來達成," +"這能防止阻斷服務攻擊 (Denial of Service attacks)。" -#: ../../library/json.rst:300 -msgid "The other arguments have the same meaning as in :func:`load`." -msgstr "其餘引數的使用方式與意義和 :func:`load` 的相同。" +#: ../../library/json.rst:350 +#, fuzzy +msgid "" +"Identical to :func:`load`, but instead of a file-like object, deserialize " +"*s* (a :class:`str`, :class:`bytes` or :class:`bytearray` instance " +"containing a JSON document) to a Python object using this :ref:`conversion " +"table <json-to-py-table>`." +msgstr "" +"使用\\ :ref:`轉換表 <json-to-py-table>`\\ 將 *s* (一個含有 JSON 文件" +"的 :class:`str`、:class:`bytes` 或 :class:`bytearray` 的實例(instance))去" +"序列化(deserialize)為一個 Python 物件" -#: ../../library/json.rst:305 +#: ../../library/json.rst:355 msgid "" "*s* can now be of type :class:`bytes` or :class:`bytearray`. The input " "encoding should be UTF-8, UTF-16 or UTF-32." @@ -575,95 +576,95 @@ msgstr "" "現在,*s* 可以是一個二進位檔案如 :class:`bytes` 或 :class:`bytearray`,前提是" "其編碼格式為 UTF-8、UTF-16 或 UTF-32。" -#: ../../library/json.rst:309 +#: ../../library/json.rst:359 msgid "The keyword argument *encoding* has been removed." msgstr "刪除關鍵字引數 *encoding*。" -#: ../../library/json.rst:314 +#: ../../library/json.rst:364 msgid "Encoders and Decoders" msgstr "編碼器與解碼器" -#: ../../library/json.rst:318 +#: ../../library/json.rst:368 msgid "Simple JSON decoder." msgstr "簡易 JSON 解碼器" -#: ../../library/json.rst:320 +#: ../../library/json.rst:370 msgid "Performs the following translations in decoding by default:" msgstr "預設將執行下列資料型別轉換:" -#: ../../library/json.rst:325 ../../library/json.rst:413 +#: ../../library/json.rst:375 ../../library/json.rst:463 msgid "JSON" msgstr "JSON" -#: ../../library/json.rst:325 ../../library/json.rst:413 +#: ../../library/json.rst:375 ../../library/json.rst:463 msgid "Python" msgstr "Python" -#: ../../library/json.rst:327 ../../library/json.rst:415 +#: ../../library/json.rst:377 ../../library/json.rst:465 msgid "object" msgstr "object" -#: ../../library/json.rst:327 ../../library/json.rst:415 +#: ../../library/json.rst:377 ../../library/json.rst:465 msgid "dict" msgstr "dict" -#: ../../library/json.rst:329 ../../library/json.rst:417 +#: ../../library/json.rst:379 ../../library/json.rst:467 msgid "array" msgstr "array" -#: ../../library/json.rst:329 +#: ../../library/json.rst:379 msgid "list" msgstr "list" -#: ../../library/json.rst:331 ../../library/json.rst:419 +#: ../../library/json.rst:381 ../../library/json.rst:469 msgid "string" msgstr "string" -#: ../../library/json.rst:331 ../../library/json.rst:419 +#: ../../library/json.rst:381 ../../library/json.rst:469 msgid "str" msgstr "str" -#: ../../library/json.rst:333 +#: ../../library/json.rst:383 msgid "number (int)" msgstr "number (整數)" -#: ../../library/json.rst:333 +#: ../../library/json.rst:383 msgid "int" msgstr "int" -#: ../../library/json.rst:335 +#: ../../library/json.rst:385 msgid "number (real)" msgstr "number (實數)" -#: ../../library/json.rst:335 +#: ../../library/json.rst:385 msgid "float" msgstr "float" -#: ../../library/json.rst:337 ../../library/json.rst:423 +#: ../../library/json.rst:387 ../../library/json.rst:473 msgid "true" msgstr "true" -#: ../../library/json.rst:337 ../../library/json.rst:423 +#: ../../library/json.rst:387 ../../library/json.rst:473 msgid "True" msgstr "True" -#: ../../library/json.rst:339 ../../library/json.rst:425 +#: ../../library/json.rst:389 ../../library/json.rst:475 msgid "false" msgstr "false" -#: ../../library/json.rst:339 ../../library/json.rst:425 +#: ../../library/json.rst:389 ../../library/json.rst:475 msgid "False" msgstr "False" -#: ../../library/json.rst:341 ../../library/json.rst:427 +#: ../../library/json.rst:391 ../../library/json.rst:477 msgid "null" msgstr "null" -#: ../../library/json.rst:341 ../../library/json.rst:427 +#: ../../library/json.rst:391 ../../library/json.rst:477 msgid "None" msgstr "None" -#: ../../library/json.rst:344 +#: ../../library/json.rst:394 msgid "" "It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their " "corresponding ``float`` values, which is outside the JSON spec." @@ -671,27 +672,63 @@ msgstr "" "雖然 ``NaN``、``Infinity`` 和 ``-Infinity`` 並不符合 JSON 規範,但解碼器依然" "能正確地將其轉換到相應的 Python ``float`` 值。" -#: ../../library/json.rst:347 +#: ../../library/json.rst:397 msgid "" "*object_hook* is an optional function that will be called with the result of " "every JSON object decoded and its return value will be used in place of the " -"given :class:`dict`. This can be used to provide custom deserializations (e." -"g. to support `JSON-RPC <https://www.jsonrpc.org>`_ class hinting)." +"given :class:`dict`. This can be used to provide custom deserializations " +"(e.g. to support `JSON-RPC <https://www.jsonrpc.org>`_ class hinting)." msgstr "" "*object_hook* 是一個可選函式,其接受一個解碼後的 JSON 物件作為輸入,並使用其" "回傳值來取代原先的 :class:`dict`。這個功能可用於提供自訂的去序列化(例如支援 " "`JSON-RPC <https://www.jsonrpc.org>`_ 類別提示)。" -#: ../../library/json.rst:352 +#: ../../library/json.rst:402 msgid "" "*object_pairs_hook* is an optional function that will be called with the " "result of every JSON object decoded with an ordered list of pairs. The " -"return value of *object_pairs_hook* will be used instead of the :class:" -"`dict`. This feature can be used to implement custom decoders. If " -"*object_hook* is also defined, the *object_pairs_hook* takes priority." +"return value of *object_pairs_hook* will be used instead of " +"the :class:`dict`. This feature can be used to implement custom decoders. " +"If *object_hook* is also defined, the *object_pairs_hook* takes priority." +msgstr "" + +#: ../../library/json.rst:408 +msgid "Added support for *object_pairs_hook*." +msgstr "新增對於 *object_pairs_hook* 的支援。" + +#: ../../library/json.rst:411 +msgid "" +"*parse_float* is an optional function that will be called with the string of " +"every JSON float to be decoded. By default, this is equivalent to " +"``float(num_str)``. This can be used to use another datatype or parser for " +"JSON floats (e.g. :class:`decimal.Decimal`)." msgstr "" +"*parse_float* 為可選函式,每個要被解碼的 JSON 浮點數字串都會改用這個參數給定" +"的函式來進行解碼。預設情況這等效於 ``float(num_str)``。這個參數可用於將 JSON " +"中的浮點數解碼或剖析為另一種資料型別(例如 :class:`decimal.Decimal`\\ )。" -#: ../../library/json.rst:375 +#: ../../library/json.rst:416 +msgid "" +"*parse_int* is an optional function that will be called with the string of " +"every JSON int to be decoded. By default, this is equivalent to " +"``int(num_str)``. This can be used to use another datatype or parser for " +"JSON integers (e.g. :class:`float`)." +msgstr "" +"*parse_int* 為可選函式,當解碼 JSON 整數字串時會被呼叫。預設情況等效於 " +"``int(num_str)``。這個參數可用於將 JSON 中的整數解碼或剖析為另一種資料型別" +"(例如 :class:`float`)。" + +#: ../../library/json.rst:421 +msgid "" +"*parse_constant* is an optional function that will be called with one of the " +"following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be " +"used to raise an exception if invalid JSON numbers are encountered." +msgstr "" +"*parse_constant* 為可選函式,在解碼時若遭遇字串 ``'-Infinity'``、" +"``'Infinity'`` 或 ``'NaN'`` 其中之一則會改用這個參數給定的函式來進行解碼。這" +"也可用於使解碼過程中遇到無效的 JSON 數字時引發一個例外。" + +#: ../../library/json.rst:425 msgid "" "If *strict* is false (``True`` is the default), then control characters will " "be allowed inside strings. Control characters in this context are those " @@ -702,25 +739,33 @@ msgstr "" "語境中的控制字元指的是 ASCII 字元編碼在 0~31 範圍內的字元,包括 ``'\\t'``" "(tab)、``'\\n'``、``'\\r'`` 和 ``'\\0'``。" -#: ../../library/json.rst:383 ../../library/json.rst:484 +#: ../../library/json.rst:430 +msgid "" +"If the data being deserialized is not a valid JSON document, " +"a :exc:`JSONDecodeError` will be raised." +msgstr "" +"如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引" +"發 :exc:`JSONDecodeError` 例外。" + +#: ../../library/json.rst:433 ../../library/json.rst:534 msgid "All parameters are now :ref:`keyword-only <keyword-only_parameter>`." msgstr "" "所有參數現在都是\\ :ref:`僅限關鍵字參數 <keyword-only_parameter>`\\ 了。" -#: ../../library/json.rst:388 +#: ../../library/json.rst:438 msgid "" "Return the Python representation of *s* (a :class:`str` instance containing " "a JSON document)." msgstr "" "回傳用 Python 型式表達的 *s* (一個含有 JSON 文件的 :class:`str` 實例)。" -#: ../../library/json.rst:391 +#: ../../library/json.rst:441 msgid "" ":exc:`JSONDecodeError` will be raised if the given JSON document is not " "valid." msgstr "若給定的輸入不符合 JSON 格式會引發 :exc:`JSONDecodeError` 例外。" -#: ../../library/json.rst:396 +#: ../../library/json.rst:446 msgid "" "Decode a JSON document from *s* (a :class:`str` beginning with a JSON " "document) and return a 2-tuple of the Python representation and the index in " @@ -729,43 +774,43 @@ msgstr "" "將 *s* (一個開頭部分含有合格 JSON 文件的 :class:`str`) 解碼,並將 JSON 文件" "結束點的索引值(index)和解碼結果合併為一個二元組(2-tuple)後回傳。" -#: ../../library/json.rst:400 +#: ../../library/json.rst:450 msgid "" "This can be used to decode a JSON document from a string that may have " "extraneous data at the end." msgstr "這個方法可以用來解碼尾段可能帶有 JSON 以外資料的文字。" -#: ../../library/json.rst:406 +#: ../../library/json.rst:456 msgid "Extensible JSON encoder for Python data structures." msgstr "可擴充的 Python 資料結構 JSON 編碼器。" -#: ../../library/json.rst:408 +#: ../../library/json.rst:458 msgid "Supports the following objects and types by default:" msgstr "預設可支援下列物件及型別:" -#: ../../library/json.rst:417 +#: ../../library/json.rst:467 msgid "list, tuple" msgstr "list, tuple" -#: ../../library/json.rst:421 +#: ../../library/json.rst:471 msgid "int, float, int- & float-derived Enums" msgstr "" "int、float 或可作為整數或浮點數運算的衍生列舉(int- or float-derived Enums)" -#: ../../library/json.rst:421 +#: ../../library/json.rst:471 msgid "number" msgstr "number" -#: ../../library/json.rst:430 +#: ../../library/json.rst:480 msgid "Added support for int- and float-derived Enum classes." msgstr "" "增加對整數(int)、浮點數(float)或可作為整數或浮點數運算的衍生列舉(int- " "or float-derived Enums)類別的支援性。" -#: ../../library/json.rst:433 +#: ../../library/json.rst:483 msgid "" -"To extend this to recognize other objects, subclass and implement a :meth:" -"`~JSONEncoder.default` method with another method that returns a " +"To extend this to recognize other objects, subclass and implement " +"a :meth:`~JSONEncoder.default` method with another method that returns a " "serializable object for ``o`` if possible, otherwise it should call the " "superclass implementation (to raise :exc:`TypeError`)." msgstr "" @@ -773,17 +818,27 @@ msgstr "" "方法。此方法應回傳一個可序列化的 ``o`` 物件,否則此方法應呼叫父類別的 " "JSONEncoder.default 方法(以引發 :exc:`TypeError` 例外)。" -#: ../../library/json.rst:438 +#: ../../library/json.rst:488 msgid "" "If *skipkeys* is false (the default), a :exc:`TypeError` will be raised when " -"trying to encode keys that are not :class:`str`, :class:`int`, :class:" -"`float` or ``None``. If *skipkeys* is true, such items are simply skipped." +"trying to encode keys that are " +"not :class:`str`, :class:`int`, :class:`float` or ``None``. If *skipkeys* " +"is true, such items are simply skipped." msgstr "" -"若 *skipkeys* 為 false(預設值),則當在編碼不是 :class:`str`、:class:" -"`int`、:class:`float` 或 ``None`` 的鍵值時,將引發 :exc:`TypeError`。如果 " -"*skipkeys* 為 true,這些項目將直接被跳過。" +"若 *skipkeys* 為 false(預設值),則當在編碼不" +"是 :class:`str`、:class:`int`、:class:`float` 或 ``None`` 的鍵值時,將引" +"發 :exc:`TypeError`。如果 *skipkeys* 為 true,這些項目將直接被跳過。" -#: ../../library/json.rst:446 +#: ../../library/json.rst:492 +msgid "" +"If *ensure_ascii* is true (the default), the output is guaranteed to have " +"all incoming non-ASCII characters escaped. If *ensure_ascii* is false, " +"these characters will be output as-is." +msgstr "" +"如果 *ensure_ascii* 被設為 true(預設值),則輸出時將確保所有輸入的非 ASCII " +"字元都會被轉義。若 *ensure_ascii* 為 false,則這些字元將照原樣輸出。" + +#: ../../library/json.rst:496 msgid "" "If *check_circular* is true (the default), then lists, dicts, and custom " "encoded objects will be checked for circular references during encoding to " @@ -791,10 +846,10 @@ msgid "" "Otherwise, no such check takes place." msgstr "" "如果 *check_circular* 為 true(預設值),則會在編碼期間檢查串列(list)、字典" -"(dict)和自訂編碼物件的循環參照,以防止無限遞迴(一個會導致 :exc:" -"`RecursionError` 例外的問題)。否則不會進行此類檢查。" +"(dict)和自訂編碼物件的循環參照,以防止無限遞迴(一個會導" +"致 :exc:`RecursionError` 例外的問題)。否則不會進行此類檢查。" -#: ../../library/json.rst:451 +#: ../../library/json.rst:501 msgid "" "If *allow_nan* is true (the default), then ``NaN``, ``Infinity``, and ``-" "Infinity`` will be encoded as such. This behavior is not JSON specification " @@ -806,7 +861,7 @@ msgstr "" "數基於 JavaScript 的編碼器和解碼器一致。否則若設為 false,嘗試對這些浮點數進" "行編碼將引發 :exc:`ValueError` 例外。" -#: ../../library/json.rst:457 +#: ../../library/json.rst:507 msgid "" "If *sort_keys* is true (default: ``False``), then the output of dictionaries " "will be sorted by key; this is useful for regression tests to ensure that " @@ -816,24 +871,61 @@ msgstr "" "按鍵值排序。這項功能可確保 JSON 序列化的結果能被互相比較,能讓日常的回歸測試" "檢查變得方便一些。" -#: ../../library/json.rst:490 +#: ../../library/json.rst:511 +msgid "" +"If *indent* is a non-negative integer or string, then JSON array elements " +"and object members will be pretty-printed with that indent level. An indent " +"level of 0, negative, or ``\"\"`` will only insert newlines. ``None`` (the " +"default) selects the most compact representation. Using a positive integer " +"indent indents that many spaces per level. If *indent* is a string (such as " +"``\"\\t\"``), that string is used to indent each level." +msgstr "" +"如果 *indent* 是非負整數或字串,則 JSON 陣列元素和物件成員將使用該縮排等級進" +"行格式美化。縮排等級 0、負數或 ``\"\"`` 只會插入換行符號。``None``\\ (預設" +"值)等於是選擇最緊湊的表示法。使用正整數縮排可以在每層縮排數量相同的空格。如" +"果 *indent* 是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個層級。" + +#: ../../library/json.rst:521 +msgid "" +"If specified, *separators* should be an ``(item_separator, key_separator)`` " +"tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', " +"': ')`` otherwise. To get the most compact JSON representation, you should " +"specify ``(',', ':')`` to eliminate whitespace." +msgstr "" +"如果有指定本引數內容,*separators* 應該是一個 ``(item_separator, " +"key_separator)`` 二元組。如果 *indent* 為 ``None`` 則預設為 ``(', ', ': " +"')``,否則預設為 ``(',', ': ')``。想要獲得最緊湊的 JSON 表示形式,你可以改成" +"指定 ``(',', ':')`` 來消除空格。" + +#: ../../library/json.rst:529 +msgid "" +"If specified, *default* should be a function that gets called for objects " +"that can't otherwise be serialized. It should return a JSON encodable " +"version of the object or raise a :exc:`TypeError`. If not " +"specified, :exc:`TypeError` is raised." +msgstr "" +"如果有指定本參數,*default* 會是一個遭遇無法序列化的物件時會被呼叫的函式。它" +"應該回傳該物件的 JSON 可編碼版本或引發 :exc:`TypeError`。如果未指定,則會直接" +"引發 :exc:`TypeError`。" + +#: ../../library/json.rst:540 msgid "" "Implement this method in a subclass such that it returns a serializable " -"object for *o*, or calls the base implementation (to raise a :exc:" -"`TypeError`)." +"object for *o*, or calls the base implementation (to raise " +"a :exc:`TypeError`)." msgstr "" "在任意一個子類別裡實作這個方法時須讓其回傳一個可序列化的物件 *o* ,或呼叫原始" "的實作以引發 :exc:`TypeError` 例外。" -#: ../../library/json.rst:494 +#: ../../library/json.rst:544 msgid "" -"For example, to support arbitrary iterators, you could implement :meth:" -"`~JSONEncoder.default` like this::" +"For example, to support arbitrary iterators, you could " +"implement :meth:`~JSONEncoder.default` like this::" msgstr "" -"舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子的 :meth:" -"`~JSONEncoder.default`: ::" +"舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子" +"的 :meth:`~JSONEncoder.default`: ::" -#: ../../library/json.rst:497 +#: ../../library/json.rst:547 msgid "" "def default(self, o):\n" " try:\n" @@ -846,13 +938,13 @@ msgid "" " return super().default(o)" msgstr "" -#: ../../library/json.rst:510 +#: ../../library/json.rst:560 msgid "" "Return a JSON string representation of a Python data structure, *o*. For " "example::" msgstr "回傳一個 Python 資料結構物件 *o* 的 JSON 的字串表示。例如: ::" -#: ../../library/json.rst:513 +#: ../../library/json.rst:563 msgid "" ">>> json.JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n" "'{\"foo\": [\"bar\", \"baz\"]}'" @@ -860,7 +952,7 @@ msgstr "" ">>> json.JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n" "'{\"foo\": [\"bar\", \"baz\"]}'" -#: ../../library/json.rst:519 +#: ../../library/json.rst:569 msgid "" "Encode the given object, *o*, and yield each string representation as " "available. For example::" @@ -868,7 +960,7 @@ msgstr "" "將物件 *o* 編碼,並將結果統整為一個能依序產生(yield)各結果字串的物件。如下" "例: ::" -#: ../../library/json.rst:522 +#: ../../library/json.rst:572 msgid "" "for chunk in json.JSONEncoder().iterencode(bigobject):\n" " mysocket.write(chunk)" @@ -876,39 +968,39 @@ msgstr "" "for chunk in json.JSONEncoder().iterencode(bigobject):\n" " mysocket.write(chunk)" -#: ../../library/json.rst:527 +#: ../../library/json.rst:577 msgid "Exceptions" msgstr "例外" -#: ../../library/json.rst:531 +#: ../../library/json.rst:581 msgid "Subclass of :exc:`ValueError` with the following additional attributes:" msgstr ":exc:`ValueError` 的子類別具有下列額外屬性:" -#: ../../library/json.rst:535 +#: ../../library/json.rst:585 msgid "The unformatted error message." msgstr "未受格式化的錯誤訊息。" -#: ../../library/json.rst:539 +#: ../../library/json.rst:589 msgid "The JSON document being parsed." msgstr "正在被剖析的 JSON 文件。" -#: ../../library/json.rst:543 +#: ../../library/json.rst:593 msgid "The start index of *doc* where parsing failed." msgstr "*doc* 剖析失敗處的起始點的索引值。" -#: ../../library/json.rst:547 +#: ../../library/json.rst:597 msgid "The line corresponding to *pos*." msgstr "*pos* 所在的列(line)數。" -#: ../../library/json.rst:551 +#: ../../library/json.rst:601 msgid "The column corresponding to *pos*." msgstr "*pos* 所在的行(column)數。" -#: ../../library/json.rst:557 +#: ../../library/json.rst:607 msgid "Standard Compliance and Interoperability" msgstr "合規性與互通性(Interoperability)" -#: ../../library/json.rst:559 +#: ../../library/json.rst:609 msgid "" "The JSON format is specified by :rfc:`7159` and by `ECMA-404 <https://ecma-" "international.org/publications-and-standards/standards/ecma-404/>`_. This " @@ -921,7 +1013,7 @@ msgstr "" "組對 RFC 的遵循程度。簡單起見,:class:`JSONEncoder` 和 :class:`JSONDecoder` " "子類別以及未明確提及的參數將不予討論。" -#: ../../library/json.rst:565 +#: ../../library/json.rst:615 msgid "" "This module does not comply with the RFC in a strict fashion, implementing " "some extensions that are valid JavaScript but not valid JSON. In particular:" @@ -929,17 +1021,17 @@ msgstr "" "這個模組的部份實作並未非常嚴格地遵循 RFC 規範。準確來說,下列實際實作符合 " "JavaScript 語法格式,但並不符合 JSON 格式:" -#: ../../library/json.rst:568 +#: ../../library/json.rst:618 msgid "Infinite and NaN number values are accepted and output;" msgstr "無限(Infinite)和非數字(NaN)值會被接受。" -#: ../../library/json.rst:569 +#: ../../library/json.rst:619 msgid "" "Repeated names within an object are accepted, and only the value of the last " "name-value pair is used." msgstr "同一個物件內可以有重複的名稱,但只有最後一個同名物件是有效的。" -#: ../../library/json.rst:572 +#: ../../library/json.rst:622 msgid "" "Since the RFC permits RFC-compliant parsers to accept input texts that are " "not RFC-compliant, this module's deserializer is technically RFC-compliant " @@ -948,11 +1040,11 @@ msgstr "" "不過 RFC 准許遵循 RFC 的剖析器接受不合規的文字輸入,所以技術上來說若以預設設" "定運作,本模組的去序列化器(deserializer)是符合 RFC 規範的。" -#: ../../library/json.rst:577 +#: ../../library/json.rst:627 msgid "Character Encodings" msgstr "字元編碼格式" -#: ../../library/json.rst:579 +#: ../../library/json.rst:629 msgid "" "The RFC requires that JSON be represented using either UTF-8, UTF-16, or " "UTF-32, with UTF-8 being the recommended default for maximum " @@ -961,7 +1053,7 @@ msgstr "" "RFC 要求 JSON 必須以 UTF-8、UTF-16 或 UTF-32 格式編碼。並推薦以 UTF-8 編碼以" "達成最佳的互通性。" -#: ../../library/json.rst:582 +#: ../../library/json.rst:632 msgid "" "As permitted, though not required, by the RFC, this module's serializer sets " "*ensure_ascii=True* by default, thus escaping the output so that the " @@ -970,17 +1062,18 @@ msgstr "" "RFC 准許但並不強制編碼器的 *ensure_ascii=True* 行為是預設值,但本模組依然實作" "了此一選項作為預設,因此本模組預設會轉義所有非 ASCII 字元。" -#: ../../library/json.rst:586 +#: ../../library/json.rst:636 msgid "" "Other than the *ensure_ascii* parameter, this module is defined strictly in " "terms of conversion between Python objects and :class:`Unicode strings " "<str>`, and thus does not otherwise directly address the issue of character " "encodings." msgstr "" -"除了 *ensure_ascii* 選項參數之外,本模組嚴格遵循 Python 物件與 :class:" -"`Unicode strings <str>` 之間的轉換規範,因此並不另外處理字元編碼的問題。" +"除了 *ensure_ascii* 選項參數之外,本模組嚴格遵循 Python 物件" +"與 :class:`Unicode strings <str>` 之間的轉換規範,因此並不另外處理字元編碼的" +"問題。" -#: ../../library/json.rst:591 +#: ../../library/json.rst:641 msgid "" "The RFC prohibits adding a byte order mark (BOM) to the start of a JSON " "text, and this module's serializer does not add a BOM to its output. The RFC " @@ -993,24 +1086,24 @@ msgstr "" "(deserializer)忽略文件初始的端序記號,因此本模組的去序列化器將在遭遇位於文" "件開頭的端序記號時引發 :exc:`ValueError` 例外。" -#: ../../library/json.rst:597 +#: ../../library/json.rst:647 msgid "" "The RFC does not explicitly forbid JSON strings which contain byte sequences " "that don't correspond to valid Unicode characters (e.g. unpaired UTF-16 " "surrogates), but it does note that they may cause interoperability problems. " -"By default, this module accepts and outputs (when present in the original :" -"class:`str`) code points for such sequences." +"By default, this module accepts and outputs (when present in the " +"original :class:`str`) code points for such sequences." msgstr "" "RFC 並未明確禁止 JSON 文件包含無法對應有效 Unicode 字元的位元組序列(例如未配" "對的 UTF-16 代理對(surrogate pairs)),但這個特性的確可能會引起相容性問題。" "預設情況下,當原始輸入的 :class:`str` 中存在此類序列時,該模組將接受並輸出這" "些序列的編碼位置(code points)。" -#: ../../library/json.rst:605 +#: ../../library/json.rst:655 msgid "Infinite and NaN Number Values" msgstr "正負無限與非數值" -#: ../../library/json.rst:607 +#: ../../library/json.rst:657 msgid "" "The RFC does not permit the representation of infinite or NaN number values. " "Despite that, by default, this module accepts and outputs ``Infinity``, ``-" @@ -1019,7 +1112,7 @@ msgstr "" "RFC 不允許表現無限大或非數值(NaN)。但預設情況下,這個模組仍接受並輸出 " "``Infinity``、``-Infinity`` 和 ``NaN``,如同它們是有效的 JSON 數值字面值: ::" -#: ../../library/json.rst:611 +#: ../../library/json.rst:661 msgid "" ">>> # Neither of these calls raises an exception, but the results are not " "valid JSON\n" @@ -1034,7 +1127,7 @@ msgid "" "nan" msgstr "" -#: ../../library/json.rst:622 +#: ../../library/json.rst:672 msgid "" "In the serializer, the *allow_nan* parameter can be used to alter this " "behavior. In the deserializer, the *parse_constant* parameter can be used " @@ -1043,11 +1136,11 @@ msgstr "" "在序列化器中,*allow_nan* 參數可以改變這個行為。在去序列化器中," "*parse_constant* 參數可以改變這個行為。" -#: ../../library/json.rst:628 +#: ../../library/json.rst:678 msgid "Repeated Names Within an Object" msgstr "物件內重複的名稱" -#: ../../library/json.rst:630 +#: ../../library/json.rst:680 msgid "" "The RFC specifies that the names within a JSON object should be unique, but " "does not mandate how repeated names in JSON objects should be handled. By " @@ -1058,22 +1151,22 @@ msgstr "" "字。預設情況下,本模組不會因此引發例外;相反的,它會忽略該名字的所有重複鍵值" "對,並只保留最後一個: ::" -#: ../../library/json.rst:635 +#: ../../library/json.rst:685 msgid "" ">>> weird_json = '{\"x\": 1, \"x\": 2, \"x\": 3}'\n" ">>> json.loads(weird_json)\n" "{'x': 3}" msgstr "" -#: ../../library/json.rst:639 +#: ../../library/json.rst:689 msgid "The *object_pairs_hook* parameter can be used to alter this behavior." msgstr "*object_parts_hook* 參數可以改變這個行為。" -#: ../../library/json.rst:643 +#: ../../library/json.rst:693 msgid "Top-level Non-Object, Non-Array Values" msgstr "位於頂層的非物件及非列表值" -#: ../../library/json.rst:645 +#: ../../library/json.rst:695 msgid "" "The old version of JSON specified by the obsolete :rfc:`4627` required that " "the top-level value of a JSON text must be either a JSON object or array " @@ -1087,37 +1180,37 @@ msgstr "" "boolean、數字或字串值。 :rfc:`7159` 移除了這個限制,而本模組的序列化器或去串" "列化器中未曾實施過該限制。" -#: ../../library/json.rst:652 +#: ../../library/json.rst:702 msgid "" "Regardless, for maximum interoperability, you may wish to voluntarily adhere " "to the restriction yourself." msgstr "如果想要最大限度地保留互通性,你可能還是會想要自行施加這個限制。" -#: ../../library/json.rst:657 +#: ../../library/json.rst:707 msgid "Implementation Limitations" msgstr "實作限制" -#: ../../library/json.rst:659 +#: ../../library/json.rst:709 msgid "Some JSON deserializer implementations may set limits on:" msgstr "某些 JSON 去序列化器的實作可能會造成下列限制:" -#: ../../library/json.rst:661 +#: ../../library/json.rst:711 msgid "the size of accepted JSON texts" msgstr "JSON 文件長度上限" -#: ../../library/json.rst:662 +#: ../../library/json.rst:712 msgid "the maximum level of nesting of JSON objects and arrays" msgstr "JSON 物件或陣列的最大巢狀層數(level of nesting)限制" -#: ../../library/json.rst:663 +#: ../../library/json.rst:713 msgid "the range and precision of JSON numbers" msgstr "數字的精準度或範圍" -#: ../../library/json.rst:664 +#: ../../library/json.rst:714 msgid "the content and maximum length of JSON strings" msgstr "JSON 字串長度上限" -#: ../../library/json.rst:666 +#: ../../library/json.rst:716 msgid "" "This module does not impose any such limits beyond those of the relevant " "Python datatypes themselves or the Python interpreter itself." @@ -1125,7 +1218,7 @@ msgstr "" "本模組除了 Python 資料型態本身或 Python 直譯器本身的限制以外,不會設定任何此" "類限制。" -#: ../../library/json.rst:669 +#: ../../library/json.rst:719 msgid "" "When serializing to JSON, beware any such limitations in applications that " "may consume your JSON. In particular, it is common for JSON numbers to be " @@ -1140,30 +1233,31 @@ msgstr "" "因而受到其表示範圍和精度限制的影響。這在序列化極大的 Python :class:`int` 數" "值、或是序列化特殊數字型別的實例時(例如 :class:`decimal.Decimal`)尤其重要。" -#: ../../library/json.rst:682 +#: ../../library/json.rst:732 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/json.rst:687 +#: ../../library/json.rst:737 msgid "**Source code:** :source:`Lib/json/tool.py`" msgstr "**原始碼:**\\ :source:`Lib/json/tool.py`" -#: ../../library/json.rst:691 +#: ../../library/json.rst:741 msgid "" "The :mod:`json.tool` module provides a simple command line interface to " "validate and pretty-print JSON objects." msgstr "" ":mod:`json.tool` 模組提供了一個簡易的命令列介面以供校驗與美化呈現 JSON 物件。" -#: ../../library/json.rst:694 +#: ../../library/json.rst:744 msgid "" -"If the optional ``infile`` and ``outfile`` arguments are not specified, :" -"data:`sys.stdin` and :data:`sys.stdout` will be used respectively:" +"If the optional ``infile`` and ``outfile`` arguments are not " +"specified, :data:`sys.stdin` and :data:`sys.stdout` will be used " +"respectively:" msgstr "" -"如果沒有指定可選引數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` 和 :" -"data:`sys.stdout` 將各自做為輸入和輸出的預設值。" +"如果沒有指定可選引數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` " +"和 :data:`sys.stdout` 將各自做為輸入和輸出的預設值。" -#: ../../library/json.rst:697 +#: ../../library/json.rst:747 msgid "" "$ echo '{\"json\": \"obj\"}' | python -m json.tool\n" "{\n" @@ -1173,7 +1267,7 @@ msgid "" "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" msgstr "" -#: ../../library/json.rst:706 +#: ../../library/json.rst:756 msgid "" "The output is now in the same order as the input. Use the :option:`--sort-" "keys` option to sort the output of dictionaries alphabetically by key." @@ -1181,15 +1275,15 @@ msgstr "" "現在開始輸出和輸入的資料順序會是相同的。傳入 :option:`--sort-keys` 引數以按照" "鍵值的字母順序對輸出進行排序。" -#: ../../library/json.rst:713 +#: ../../library/json.rst:763 msgid "Command line options" msgstr "命令列選項" -#: ../../library/json.rst:717 +#: ../../library/json.rst:767 msgid "The JSON file to be validated or pretty-printed:" msgstr "將被用於校驗或美化呈現的 JSON 文件:" -#: ../../library/json.rst:719 +#: ../../library/json.rst:769 msgid "" "$ python -m json.tool mp_films.json\n" "[\n" @@ -1215,45 +1309,45 @@ msgstr "" " }\n" "]" -#: ../../library/json.rst:733 +#: ../../library/json.rst:783 msgid "If *infile* is not specified, read from :data:`sys.stdin`." msgstr "如果沒有指定 *infile* 則會從 :data:`sys.stdin` 讀取輸入。" -#: ../../library/json.rst:737 +#: ../../library/json.rst:787 msgid "" "Write the output of the *infile* to the given *outfile*. Otherwise, write it " "to :data:`sys.stdout`." msgstr "" -"將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入到 :data:`sys." -"stdout`。" +"將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入" +"到 :data:`sys.stdout`。" -#: ../../library/json.rst:742 +#: ../../library/json.rst:792 msgid "Sort the output of dictionaries alphabetically by key." msgstr "按照鍵值的字母順序對輸出字典進行排序。" -#: ../../library/json.rst:748 +#: ../../library/json.rst:798 msgid "" "Disable escaping of non-ascii characters, see :func:`json.dumps` for more " "information." msgstr "關閉非 ASCII 字元的自動轉義功能。詳情請參照 :func:`json.dumps`。" -#: ../../library/json.rst:754 +#: ../../library/json.rst:804 msgid "Parse every input line as separate JSON object." msgstr "將每一行輸入都單獨輸出為一個 JSON 物件。" -#: ../../library/json.rst:760 +#: ../../library/json.rst:810 msgid "Mutually exclusive options for whitespace control." msgstr "互斥的空白字元控制選項。" -#: ../../library/json.rst:766 +#: ../../library/json.rst:816 msgid "Show the help message." msgstr "顯示說明訊息。" -#: ../../library/json.rst:770 +#: ../../library/json.rst:820 msgid "Footnotes" msgstr "註解" -#: ../../library/json.rst:771 +#: ../../library/json.rst:821 msgid "" "As noted in `the errata for RFC 7159 <https://www.rfc-editor.org/" "errata_search.php?rfc=7159>`_, JSON permits literal U+2028 (LINE SEPARATOR) " @@ -1263,16 +1357,3 @@ msgstr "" "如 `RFC 7159 更正 <https://www.rfc-editor.org/errata_search.php?rfc=7159>`_ " "所述,JSON 允許字串中出現 U+2028(列分隔符)和 U+2029(段落分隔符)字元,而 " "JavaScript(截至 ECMAScript 5.1 版)則不允許。" - -#~ msgid "" -#~ "*object_pairs_hook*, if specified will be called with the result of every " -#~ "JSON object decoded with an ordered list of pairs. The return value of " -#~ "*object_pairs_hook* will be used instead of the :class:`dict`. This " -#~ "feature can be used to implement custom decoders. If *object_hook* is " -#~ "also defined, the *object_pairs_hook* takes priority." -#~ msgstr "" -#~ "*object_pairs_hook* 是一個可選引數,其接受一個函式作為輸入。原始的有序對串" -#~ "列(ordered list of pairs)解碼結果將被傳入這個函式、並使用 " -#~ "*object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功能可用於" -#~ "實作自訂解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優" -#~ "先。" diff --git a/library/logging.po b/library/logging.po index 8bfdaea17d..c11c77e048 100644 --- a/library/logging.po +++ b/library/logging.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: 2024-03-28 22:40+0800\n" "Last-Translator: RockLeon <therockleona@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -527,7 +527,7 @@ msgstr "" msgid "" "If no handler is attached to this logger (or any of its ancestors, taking " "into account the relevant :attr:`Logger.propagate` attributes), the message " -"will be sent to the handler set on :attr:`lastResort`." +"will be sent to the handler set on :data:`lastResort`." msgstr "" #: ../../library/logging.rst:347 diff --git a/library/math.po b/library/math.po index 8280532b1a..c6ffeda216 100644 --- a/library/math.po +++ b/library/math.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-20 00:14+0000\n" +"POT-Creation-Date: 2025-01-05 00:15+0000\n" "PO-Revision-Date: 2024-04-26 15:15+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -548,8 +548,8 @@ msgstr ":func:`lgamma(x) <lgamma>`" #: ../../library/math.rst:112 msgid "" -"Natural logarithm of the absolute value of the `Gamma function <https://en." -"wikipedia.org/wiki/Gamma_function>`_ at *x*" +"Natural logarithm of the absolute value of the `Gamma function <https://" +"en.wikipedia.org/wiki/Gamma_function>`_ at *x*" msgstr "" #: ../../library/math.rst:114 @@ -622,11 +622,11 @@ msgstr "" #: ../../library/math.rst:139 ../../library/math.rst:205 msgid "" -"Raises :exc:`TypeError` if either of the arguments are not integers. Raises :" -"exc:`ValueError` if either of the arguments are negative." +"Raises :exc:`TypeError` if either of the arguments are not integers. " +"Raises :exc:`ValueError` if either of the arguments are negative." msgstr "" -"當任一參數非整數型別時會引發 :exc:`TypeError`。當任一參數為負數時會引發 :exc:" -"`ValueError`。" +"當任一參數非整數型別時會引發 :exc:`TypeError`。當任一參數為負數時會引" +"發 :exc:`ValueError`。" #: ../../library/math.rst:147 msgid "" @@ -714,12 +714,12 @@ msgstr "" #: ../../library/math.rst:216 msgid "" "Return the ceiling of *x*, the smallest integer greater than or equal to " -"*x*. If *x* is not a float, delegates to :meth:`x.__ceil__ <object." -"__ceil__>`, which should return an :class:`~numbers.Integral` value." +"*x*. If *x* is not a float, delegates to :meth:`x.__ceil__ " +"<object.__ceil__>`, which should return an :class:`~numbers.Integral` value." msgstr "" "回傳 *x* 經上取整的值,即大於或等於 *x* 的最小整數。若 *x* 並非浮點數,此函式" -"將委派給 :meth:`x.__ceil__ <object.__ceil__>`,並回傳 :class:`~numbers." -"Integral` 型別的值。" +"將委派給 :meth:`x.__ceil__ <object.__ceil__>`,並回" +"傳 :class:`~numbers.Integral` 型別的值。" #: ../../library/math.rst:223 msgid "Return the absolute value of *x*." @@ -732,8 +732,8 @@ msgid "" "which should return an :class:`~numbers.Integral` value." msgstr "" "回傳 *x* 經下取整的值,即小於或等於 *x* 的最大整數。若 *x* 並非浮點數,此函式" -"將委派給 :meth:`x.__floor__ <object.__floor__>`,並回傳 :class:`~numbers." -"Integral` 型別的值。" +"將委派給 :meth:`x.__floor__ <object.__floor__>`,並回" +"傳 :class:`~numbers.Integral` 型別的值。" #: ../../library/math.rst:235 msgid "" @@ -754,35 +754,36 @@ msgstr "" #: ../../library/math.rst:251 msgid "" -"Return ``fmod(x, y)``, as defined by the platform C library. Note that the " -"Python expression ``x % y`` may not return the same result. The intent of " -"the C standard is that ``fmod(x, y)`` be exactly (mathematically; to " -"infinite precision) equal to ``x - n*y`` for some integer *n* such that the " -"result has the same sign as *x* and magnitude less than ``abs(y)``. " -"Python's ``x % y`` returns a result with the sign of *y* instead, and may " -"not be exactly computable for float arguments. For example, ``fmod(-1e-100, " -"1e100)`` is ``-1e-100``, but the result of Python's ``-1e-100 % 1e100`` is " -"``1e100-1e-100``, which cannot be represented exactly as a float, and rounds " -"to the surprising ``1e100``. For this reason, function :func:`fmod` is " -"generally preferred when working with floats, while Python's ``x % y`` is " -"preferred when working with integers." -msgstr "" -"回傳 C 函式庫所定義的 ``fmod(x, y)`` 函式值。請注意此函式與 Python 運算式 " -"``x % y`` 可能會回傳不同結果。C 標準要求 ``fmod(x, y)`` 的回傳值完全等同(數" -"學定義上,即無限精度)於 ``x - n*y``,*n* 為可使回傳值與 *x* 同號且長度小於 " -"``abs(y)`` 的整數。Python 運算式 ``x % y`` 的回傳值則與 *y* 同號,且可能無法" -"精確地計算浮點數引數。例如:``fmod(-1e-100, 1e100)`` 的值為 ``-1e-100``,但 " -"Python 運算式 ``-1e-100 % 1e100`` 的結果為 ``1e100-1e-100``,此值無法準確地表" -"示成浮點數,並會四捨五入為出乎意料的 ``1e100``。因此,處理浮點數時通常會選擇" -"函式 :func:`fmod`,而處理整數時會選擇 Python 運算式 ``x % y``。" - -#: ../../library/math.rst:266 +"Return the floating-point remainder of ``x / y``, as defined by the platform " +"C library function ``fmod(x, y)``. Note that the Python expression ``x % y`` " +"may not return the same result. The intent of the C standard is that " +"``fmod(x, y)`` be exactly (mathematically; to infinite precision) equal to " +"``x - n*y`` for some integer *n* such that the result has the same sign as " +"*x* and magnitude less than ``abs(y)``. Python's ``x % y`` returns a result " +"with the sign of *y* instead, and may not be exactly computable for float " +"arguments. For example, ``fmod(-1e-100, 1e100)`` is ``-1e-100``, but the " +"result of Python's ``-1e-100 % 1e100`` is ``1e100-1e-100``, which cannot be " +"represented exactly as a float, and rounds to the surprising ``1e100``. For " +"this reason, function :func:`fmod` is generally preferred when working with " +"floats, while Python's ``x % y`` is preferred when working with integers." +msgstr "" +"回傳 ``x / y`` 的浮點數餘數,其以平臺上的 C 函式庫 ``fmod(x, y)`` 函式定義。" +"請注意此函式與 Python 運算式 ``x % y`` 可能不會回傳相同結果。C 標準要求 " +"``fmod(x, y)`` 的回傳值完全等同(數學定義上,即無限精度)於 ``x - n*y``,*n* " +"為可使回傳值與 *x* 同號且長度小於 ``abs(y)`` 的整數。Python 運算式 ``x % y`` " +"的回傳值則與 *y* 同號,且可能無法精確地計算浮點數引數。例如:``fmod(-1e-100, " +"1e100)`` 的值為 ``-1e-100``,但 Python 運算式 ``-1e-100 % 1e100`` 的結果為 " +"``1e100-1e-100``,此值無法準確地表示成浮點數,並會四捨五入為出乎意料的 " +"``1e100``。因此,處理浮點數時通常會選擇函式 :func:`fmod`,而處理整數時會選擇 " +"Python 運算式 ``x % y``。" + +#: ../../library/math.rst:267 msgid "" "Return the fractional and integer parts of *x*. Both results carry the sign " "of *x* and are floats." msgstr "" -#: ../../library/math.rst:269 +#: ../../library/math.rst:270 msgid "" "Note that :func:`modf` has a different call/return pattern than its C " "equivalents: it takes a single argument and return a pair of values, rather " @@ -790,7 +791,7 @@ msgid "" "is no such thing in Python)." msgstr "" -#: ../../library/math.rst:277 +#: ../../library/math.rst:278 msgid "" "Return the IEEE 754-style remainder of *x* with respect to *y*. For finite " "*x* and finite nonzero *y*, this is the difference ``x - n*y``, where ``n`` " @@ -800,7 +801,7 @@ msgid "" "thus always satisfies ``abs(r) <= 0.5 * abs(y)``." msgstr "" -#: ../../library/math.rst:284 +#: ../../library/math.rst:285 msgid "" "Special cases follow IEEE 754: in particular, ``remainder(x, math.inf)`` is " "*x* for any finite *x*, and ``remainder(x, 0)`` and ``remainder(math.inf, " @@ -808,22 +809,22 @@ msgid "" "remainder operation is zero, that zero will have the same sign as *x*." msgstr "" -#: ../../library/math.rst:290 +#: ../../library/math.rst:291 msgid "" "On platforms using IEEE 754 binary floating point, the result of this " "operation is always exactly representable: no rounding error is introduced." msgstr "" -#: ../../library/math.rst:298 +#: ../../library/math.rst:299 msgid "" "Return *x* with the fractional part removed, leaving the integer part. This " "rounds toward 0: ``trunc()`` is equivalent to :func:`floor` for positive " "*x*, and equivalent to :func:`ceil` for negative *x*. If *x* is not a float, " -"delegates to :meth:`x.__trunc__ <object.__trunc__>`, which should return an :" -"class:`~numbers.Integral` value." +"delegates to :meth:`x.__trunc__ <object.__trunc__>`, which should return " +"an :class:`~numbers.Integral` value." msgstr "" -#: ../../library/math.rst:305 +#: ../../library/math.rst:306 msgid "" "For the :func:`ceil`, :func:`floor`, and :func:`modf` functions, note that " "*all* floating-point numbers of sufficiently large magnitude are exact " @@ -832,11 +833,11 @@ msgid "" "``abs(x) >= 2**52`` necessarily has no fractional bits." msgstr "" -#: ../../library/math.rst:313 +#: ../../library/math.rst:314 msgid "Floating point manipulation functions" msgstr "" -#: ../../library/math.rst:317 +#: ../../library/math.rst:318 msgid "" "Return a float with the magnitude (absolute value) of *x* but the sign of " "*y*. On platforms that support signed zeros, ``copysign(1.0, -0.0)`` " @@ -845,7 +846,7 @@ msgstr "" "回傳與 *x* 相同長度(絕對值)且與 *y* 同號的浮點數。在支援帶符號零的平臺上," "``copysign(1.0, -0.0)`` 回傳 *-1.0*。" -#: ../../library/math.rst:324 +#: ../../library/math.rst:325 msgid "" "Return the mantissa and exponent of *x* as the pair ``(m, e)``. *m* is a " "float and *e* is an integer such that ``x == m * 2**e`` exactly. If *x* is " @@ -856,7 +857,7 @@ msgstr "" "數,且兩者精確地使 ``x == m * 2**e``。若 *x* 為零,回傳 ``(0.0, 0)``,否則令 " "``0.5 <= abs(m) < 1``。此函式用於以可攜的方式「分割」浮點數內部表示法。" -#: ../../library/math.rst:329 +#: ../../library/math.rst:330 msgid "" "Note that :func:`frexp` has a different call/return pattern than its C " "equivalents: it takes a single argument and return a pair of values, rather " @@ -864,13 +865,13 @@ msgid "" "is no such thing in Python)." msgstr "" -#: ../../library/math.rst:336 +#: ../../library/math.rst:337 msgid "" "Return ``True`` if the values *a* and *b* are close to each other and " "``False`` otherwise." msgstr "若 *a* 及 *b* 兩值足夠接近便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:339 +#: ../../library/math.rst:340 msgid "" "Whether or not two values are considered close is determined according to " "given absolute and relative tolerances. If no errors occur, the result will " @@ -879,7 +880,7 @@ msgstr "" "兩數是否足夠接近取決於給定的絕對及相對容許偏差 (tolerance)。如果沒有錯誤發" "生,結果將為:``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``。" -#: ../../library/math.rst:343 +#: ../../library/math.rst:344 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " @@ -893,7 +894,7 @@ msgstr "" "設值為 ``1e-09``,該值可確保兩數於大約 9 個十進數位內相同。*rel_tol* 須不為負" "且小於 ``1.0``。" -#: ../../library/math.rst:350 +#: ../../library/math.rst:351 msgid "" "*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " "nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " @@ -902,7 +903,7 @@ msgid "" "to the call." msgstr "" -#: ../../library/math.rst:356 +#: ../../library/math.rst:357 msgid "" "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " "handled according to IEEE rules. Specifically, ``NaN`` is not considered " @@ -913,11 +914,11 @@ msgstr "" "處理。更明確地說,``NaN`` 不會與包含自身在內的任何數字足夠接近,而 ``inf`` " "及 ``-inf`` 皆只與自身接近。" -#: ../../library/math.rst:365 +#: ../../library/math.rst:366 msgid ":pep:`485` -- A function for testing approximate equality" msgstr ":pep:`485` ── 用於測試近似相等的函式" -#: ../../library/math.rst:370 +#: ../../library/math.rst:371 msgid "" "Return ``True`` if *x* is neither an infinity nor a NaN, and ``False`` " "otherwise. (Note that ``0.0`` *is* considered finite.)" @@ -925,128 +926,128 @@ msgstr "" "若 *x* 不是無限值或 ``NaN`` 便回傳 ``True``,否則回傳 ``False``。(注意 " "``0.0`` 被視為有限數。)" -#: ../../library/math.rst:378 +#: ../../library/math.rst:379 msgid "" "Return ``True`` if *x* is a positive or negative infinity, and ``False`` " "otherwise." msgstr "若 *x* 是正無限值或負無限值便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:384 +#: ../../library/math.rst:385 msgid "" "Return ``True`` if *x* is a NaN (not a number), and ``False`` otherwise." msgstr "" "若 *x* 是 ``NaN`` ── 即非數字(NaN, not a number)── 便回傳 ``True``,否則回" "傳 ``False``。" -#: ../../library/math.rst:389 +#: ../../library/math.rst:390 msgid "" -"Return ``x * (2**i)``. This is essentially the inverse of function :func:" -"`frexp`." +"Return ``x * (2**i)``. This is essentially the inverse of " +"function :func:`frexp`." msgstr "回傳 ``x * (2**i)``。此函式本質上為 :func:`frexp` 的反函式。" -#: ../../library/math.rst:395 +#: ../../library/math.rst:396 msgid "Return the floating-point value *steps* steps after *x* towards *y*." msgstr "" -#: ../../library/math.rst:397 +#: ../../library/math.rst:398 msgid "If *x* is equal to *y*, return *y*, unless *steps* is zero." msgstr "" -#: ../../library/math.rst:399 +#: ../../library/math.rst:400 msgid "Examples:" msgstr "範例:" -#: ../../library/math.rst:401 +#: ../../library/math.rst:402 msgid "``math.nextafter(x, math.inf)`` goes up: towards positive infinity." msgstr "" -#: ../../library/math.rst:402 +#: ../../library/math.rst:403 msgid "``math.nextafter(x, -math.inf)`` goes down: towards minus infinity." msgstr "" -#: ../../library/math.rst:403 +#: ../../library/math.rst:404 msgid "``math.nextafter(x, 0.0)`` goes towards zero." msgstr "" -#: ../../library/math.rst:404 +#: ../../library/math.rst:405 msgid "``math.nextafter(x, math.copysign(math.inf, x))`` goes away from zero." msgstr "" -#: ../../library/math.rst:406 +#: ../../library/math.rst:407 msgid "See also :func:`math.ulp`." msgstr "另請參閱 :func:`math.ulp`。" -#: ../../library/math.rst:410 +#: ../../library/math.rst:411 msgid "Added the *steps* argument." msgstr "新增 *steps* 引數。" -#: ../../library/math.rst:416 +#: ../../library/math.rst:417 msgid "Return the value of the least significant bit of the float *x*:" msgstr "" -#: ../../library/math.rst:418 +#: ../../library/math.rst:419 msgid "If *x* is a NaN (not a number), return *x*." msgstr "" -#: ../../library/math.rst:419 +#: ../../library/math.rst:420 msgid "If *x* is negative, return ``ulp(-x)``." msgstr "若 *x* 為負值,回傳 ``ulp(-x)``。" -#: ../../library/math.rst:420 +#: ../../library/math.rst:421 msgid "If *x* is a positive infinity, return *x*." msgstr "若 *x* 為正無限值,回傳 *x*。" -#: ../../library/math.rst:421 +#: ../../library/math.rst:422 msgid "" "If *x* is equal to zero, return the smallest positive *denormalized* " -"representable float (smaller than the minimum positive *normalized* float, :" -"data:`sys.float_info.min <sys.float_info>`)." +"representable float (smaller than the minimum positive *normalized* " +"float, :data:`sys.float_info.min <sys.float_info>`)." msgstr "" -#: ../../library/math.rst:424 +#: ../../library/math.rst:425 msgid "" "If *x* is equal to the largest positive representable float, return the " "value of the least significant bit of *x*, such that the first float smaller " "than *x* is ``x - ulp(x)``." msgstr "" -#: ../../library/math.rst:427 +#: ../../library/math.rst:428 msgid "" "Otherwise (*x* is a positive finite number), return the value of the least " "significant bit of *x*, such that the first float bigger than *x* is ``x + " "ulp(x)``." msgstr "" -#: ../../library/math.rst:431 +#: ../../library/math.rst:432 msgid "ULP stands for \"Unit in the Last Place\"." msgstr "" -#: ../../library/math.rst:433 +#: ../../library/math.rst:434 msgid "" -"See also :func:`math.nextafter` and :data:`sys.float_info.epsilon <sys." -"float_info>`." +"See also :func:`math.nextafter` and :data:`sys.float_info.epsilon " +"<sys.float_info>`." msgstr "" -#: ../../library/math.rst:440 +#: ../../library/math.rst:441 msgid "Power, exponential and logarithmic functions" msgstr "" -#: ../../library/math.rst:444 +#: ../../library/math.rst:445 msgid "Return the cube root of *x*." msgstr "" -#: ../../library/math.rst:451 +#: ../../library/math.rst:452 msgid "" "Return *e* raised to the power *x*, where *e* = 2.718281... is the base of " "natural logarithms. This is usually more accurate than ``math.e ** x`` or " "``pow(math.e, x)``." msgstr "" -#: ../../library/math.rst:458 +#: ../../library/math.rst:459 msgid "Return *2* raised to the power *x*." msgstr "" -#: ../../library/math.rst:465 +#: ../../library/math.rst:466 msgid "" "Return *e* raised to the power *x*, minus 1. Here *e* is the base of " "natural logarithms. For small floats *x*, the subtraction in ``exp(x) - 1`` " @@ -1055,41 +1056,41 @@ msgid "" "compute this quantity to full precision:" msgstr "" -#: ../../library/math.rst:482 +#: ../../library/math.rst:483 msgid "With one argument, return the natural logarithm of *x* (to base *e*)." msgstr "" -#: ../../library/math.rst:484 +#: ../../library/math.rst:485 msgid "" "With two arguments, return the logarithm of *x* to the given *base*, " "calculated as ``log(x)/log(base)``." msgstr "" -#: ../../library/math.rst:490 +#: ../../library/math.rst:491 msgid "" "Return the natural logarithm of *1+x* (base *e*). The result is calculated " "in a way which is accurate for *x* near zero." msgstr "" -#: ../../library/math.rst:496 +#: ../../library/math.rst:497 msgid "" "Return the base-2 logarithm of *x*. This is usually more accurate than " "``log(x, 2)``." msgstr "" -#: ../../library/math.rst:503 +#: ../../library/math.rst:504 msgid "" ":meth:`int.bit_length` returns the number of bits necessary to represent an " "integer in binary, excluding the sign and leading zeros." msgstr "" -#: ../../library/math.rst:509 +#: ../../library/math.rst:510 msgid "" "Return the base-10 logarithm of *x*. This is usually more accurate than " "``log(x, 10)``." msgstr "" -#: ../../library/math.rst:515 +#: ../../library/math.rst:516 msgid "" "Return *x* raised to the power *y*. Exceptional cases follow the IEEE 754 " "standard as far as possible. In particular, ``pow(1.0, x)`` and ``pow(x, " @@ -1098,44 +1099,44 @@ msgid "" "y)`` is undefined, and raises :exc:`ValueError`." msgstr "" -#: ../../library/math.rst:522 +#: ../../library/math.rst:523 msgid "" "Unlike the built-in ``**`` operator, :func:`math.pow` converts both its " "arguments to type :class:`float`. Use ``**`` or the built-in :func:`pow` " "function for computing exact integer powers." msgstr "" -#: ../../library/math.rst:526 +#: ../../library/math.rst:527 msgid "" "The special cases ``pow(0.0, -inf)`` and ``pow(-0.0, -inf)`` were changed to " "return ``inf`` instead of raising :exc:`ValueError`, for consistency with " "IEEE 754." msgstr "" -#: ../../library/math.rst:534 +#: ../../library/math.rst:535 msgid "Return the square root of *x*." msgstr "" -#: ../../library/math.rst:538 +#: ../../library/math.rst:539 msgid "Summation and product functions" msgstr "" -#: ../../library/math.rst:542 +#: ../../library/math.rst:543 msgid "" "Return the Euclidean distance between two points *p* and *q*, each given as " "a sequence (or iterable) of coordinates. The two points must have the same " "dimension." msgstr "" -#: ../../library/math.rst:546 ../../library/math.rst:607 +#: ../../library/math.rst:547 ../../library/math.rst:608 msgid "Roughly equivalent to::" msgstr "" -#: ../../library/math.rst:548 +#: ../../library/math.rst:549 msgid "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" msgstr "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" -#: ../../library/math.rst:555 +#: ../../library/math.rst:556 msgid "" "Return an accurate floating-point sum of values in the iterable. Avoids " "loss of precision by tracking multiple intermediate partial sums." @@ -1143,7 +1144,7 @@ msgstr "" "回傳可疊代物件(iterable)中所有值的精確浮點數和。透過追蹤過程中多個部分和" "(partial sum)以避免精確度損失。" -#: ../../library/math.rst:558 +#: ../../library/math.rst:559 msgid "" "The algorithm's accuracy depends on IEEE-754 arithmetic guarantees and the " "typical case where the rounding mode is half-even. On some non-Windows " @@ -1155,190 +1156,190 @@ msgstr "" "有些非 Windows 平台建置時,底層 C 函式庫使用延伸精度加法運算,而可能導致對過" "程中同一部分和重複捨入,並使其最低有效位不如預期。" -#: ../../library/math.rst:564 +#: ../../library/math.rst:565 msgid "" "For further discussion and two alternative approaches, see the `ASPN " -"cookbook recipes for accurate floating-point summation <https://code." -"activestate.com/recipes/393090-binary-floating-point-summation-accurate-to-" -"full-p/>`_\\." +"cookbook recipes for accurate floating-point summation <https://" +"code.activestate.com/recipes/393090-binary-floating-point-summation-accurate-" +"to-full-p/>`_\\." msgstr "" "更深入的討論及兩種替代做法請參閱 `ASPN cookbook recipes 精準的浮點數總和 " "<https://code.activestate.com/recipes/393090/>`_。" -#: ../../library/math.rst:571 +#: ../../library/math.rst:572 msgid "" "Return the Euclidean norm, ``sqrt(sum(x**2 for x in coordinates))``. This is " "the length of the vector from the origin to the point given by the " "coordinates." msgstr "" -#: ../../library/math.rst:575 +#: ../../library/math.rst:576 msgid "" "For a two dimensional point ``(x, y)``, this is equivalent to computing the " "hypotenuse of a right triangle using the Pythagorean theorem, ``sqrt(x*x + " "y*y)``." msgstr "" -#: ../../library/math.rst:579 +#: ../../library/math.rst:580 msgid "" "Added support for n-dimensional points. Formerly, only the two dimensional " "case was supported." msgstr "" -#: ../../library/math.rst:583 +#: ../../library/math.rst:584 msgid "" "Improved the algorithm's accuracy so that the maximum error is under 1 ulp " "(unit in the last place). More typically, the result is almost always " "correctly rounded to within 1/2 ulp." msgstr "" -#: ../../library/math.rst:591 +#: ../../library/math.rst:592 msgid "" "Calculate the product of all the elements in the input *iterable*. The " "default *start* value for the product is ``1``." msgstr "" -#: ../../library/math.rst:594 +#: ../../library/math.rst:595 msgid "" "When the iterable is empty, return the start value. This function is " "intended specifically for use with numeric values and may reject non-numeric " "types." msgstr "" -#: ../../library/math.rst:603 +#: ../../library/math.rst:604 msgid "Return the sum of products of values from two iterables *p* and *q*." msgstr "" -#: ../../library/math.rst:605 +#: ../../library/math.rst:606 msgid "Raises :exc:`ValueError` if the inputs do not have the same length." msgstr "" -#: ../../library/math.rst:609 +#: ../../library/math.rst:610 msgid "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" msgstr "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" -#: ../../library/math.rst:611 +#: ../../library/math.rst:612 msgid "" "For float and mixed int/float inputs, the intermediate products and sums are " "computed with extended precision." msgstr "" -#: ../../library/math.rst:618 +#: ../../library/math.rst:619 msgid "Angular conversion" msgstr "" -#: ../../library/math.rst:622 +#: ../../library/math.rst:623 msgid "Convert angle *x* from radians to degrees." msgstr "" -#: ../../library/math.rst:627 +#: ../../library/math.rst:628 msgid "Convert angle *x* from degrees to radians." msgstr "" -#: ../../library/math.rst:631 +#: ../../library/math.rst:632 msgid "Trigonometric functions" msgstr "" -#: ../../library/math.rst:635 +#: ../../library/math.rst:636 msgid "" "Return the arc cosine of *x*, in radians. The result is between ``0`` and " "``pi``." msgstr "" -#: ../../library/math.rst:641 +#: ../../library/math.rst:642 msgid "" "Return the arc sine of *x*, in radians. The result is between ``-pi/2`` and " "``pi/2``." msgstr "" -#: ../../library/math.rst:647 +#: ../../library/math.rst:648 msgid "" "Return the arc tangent of *x*, in radians. The result is between ``-pi/2`` " "and ``pi/2``." msgstr "" -#: ../../library/math.rst:653 +#: ../../library/math.rst:654 msgid "" "Return ``atan(y / x)``, in radians. The result is between ``-pi`` and " "``pi``. The vector in the plane from the origin to point ``(x, y)`` makes " "this angle with the positive X axis. The point of :func:`atan2` is that the " "signs of both inputs are known to it, so it can compute the correct quadrant " -"for the angle. For example, ``atan(1)`` and ``atan2(1, 1)`` are both " -"``pi/4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." +"for the angle. For example, ``atan(1)`` and ``atan2(1, 1)`` are both ``pi/" +"4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." msgstr "" -#: ../../library/math.rst:663 +#: ../../library/math.rst:664 msgid "Return the cosine of *x* radians." msgstr "" -#: ../../library/math.rst:668 +#: ../../library/math.rst:669 msgid "Return the sine of *x* radians." msgstr "" -#: ../../library/math.rst:673 +#: ../../library/math.rst:674 msgid "Return the tangent of *x* radians." msgstr "" -#: ../../library/math.rst:677 +#: ../../library/math.rst:678 msgid "Hyperbolic functions" msgstr "" -#: ../../library/math.rst:679 +#: ../../library/math.rst:680 msgid "" "`Hyperbolic functions <https://en.wikipedia.org/wiki/Hyperbolic_functions>`_ " "are analogs of trigonometric functions that are based on hyperbolas instead " "of circles." msgstr "" -#: ../../library/math.rst:685 +#: ../../library/math.rst:686 msgid "Return the inverse hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:690 +#: ../../library/math.rst:691 msgid "Return the inverse hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:695 +#: ../../library/math.rst:696 msgid "Return the inverse hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:700 +#: ../../library/math.rst:701 msgid "Return the hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:705 +#: ../../library/math.rst:706 msgid "Return the hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:710 +#: ../../library/math.rst:711 msgid "Return the hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:714 +#: ../../library/math.rst:715 msgid "Special functions" msgstr "特殊函式" -#: ../../library/math.rst:718 +#: ../../library/math.rst:719 msgid "" "Return the `error function <https://en.wikipedia.org/wiki/Error_function>`_ " "at *x*." msgstr "" -#: ../../library/math.rst:721 +#: ../../library/math.rst:722 msgid "" "The :func:`erf` function can be used to compute traditional statistical " -"functions such as the `cumulative standard normal distribution <https://en." -"wikipedia.org/wiki/Cumulative_distribution_function>`_::" +"functions such as the `cumulative standard normal distribution <https://" +"en.wikipedia.org/wiki/Cumulative_distribution_function>`_::" msgstr "" -#: ../../library/math.rst:725 +#: ../../library/math.rst:726 msgid "" "def phi(x):\n" " 'Cumulative distribution function for the standard normal distribution'\n" " return (1.0 + erf(x / sqrt(2.0))) / 2.0" msgstr "" -#: ../../library/math.rst:734 +#: ../../library/math.rst:735 msgid "" "Return the complementary error function at *x*. The `complementary error " "function <https://en.wikipedia.org/wiki/Error_function>`_ is defined as " @@ -1347,31 +1348,31 @@ msgid "" "Loss_of_significance>`_\\." msgstr "" -#: ../../library/math.rst:745 +#: ../../library/math.rst:746 msgid "" "Return the `Gamma function <https://en.wikipedia.org/wiki/Gamma_function>`_ " "at *x*." msgstr "" -#: ../../library/math.rst:753 +#: ../../library/math.rst:754 msgid "" "Return the natural logarithm of the absolute value of the Gamma function at " "*x*." msgstr "" -#: ../../library/math.rst:760 +#: ../../library/math.rst:761 msgid "Constants" msgstr "常數" -#: ../../library/math.rst:764 +#: ../../library/math.rst:765 msgid "The mathematical constant *π* = 3.141592..., to available precision." msgstr "" -#: ../../library/math.rst:769 +#: ../../library/math.rst:770 msgid "The mathematical constant *e* = 2.718281..., to available precision." msgstr "" -#: ../../library/math.rst:774 +#: ../../library/math.rst:775 msgid "" "The mathematical constant *τ* = 6.283185..., to available precision. Tau is " "a circle constant equal to 2\\ *π*, the ratio of a circle's circumference to " @@ -1380,13 +1381,13 @@ msgid "" "celebrating `Tau day <https://tauday.com/>`_ by eating twice as much pie!" msgstr "" -#: ../../library/math.rst:785 +#: ../../library/math.rst:786 msgid "" -"A floating-point positive infinity. (For negative infinity, use ``-math." -"inf``.) Equivalent to the output of ``float('inf')``." +"A floating-point positive infinity. (For negative infinity, use ``-" +"math.inf``.) Equivalent to the output of ``float('inf')``." msgstr "" -#: ../../library/math.rst:793 +#: ../../library/math.rst:794 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to the output of " "``float('nan')``. Due to the requirements of the `IEEE-754 standard <https://" @@ -1396,36 +1397,36 @@ msgid "" "NaNs instead of ``is`` or ``==``. Example:" msgstr "" -#: ../../library/math.rst:813 +#: ../../library/math.rst:814 msgid "It is now always available." msgstr "" -#: ../../library/math.rst:819 +#: ../../library/math.rst:820 msgid "" "The :mod:`math` module consists mostly of thin wrappers around the platform " "C math library functions. Behavior in exceptional cases follows Annex F of " -"the C99 standard where appropriate. The current implementation will raise :" -"exc:`ValueError` for invalid operations like ``sqrt(-1.0)`` or ``log(0.0)`` " -"(where C99 Annex F recommends signaling invalid operation or divide-by-" -"zero), and :exc:`OverflowError` for results that overflow (for example, " -"``exp(1000.0)``). A NaN will not be returned from any of the functions " -"above unless one or more of the input arguments was a NaN; in that case, " -"most functions will return a NaN, but (again following C99 Annex F) there " -"are some exceptions to this rule, for example ``pow(float('nan'), 0.0)`` or " -"``hypot(float('nan'), float('inf'))``." +"the C99 standard where appropriate. The current implementation will " +"raise :exc:`ValueError` for invalid operations like ``sqrt(-1.0)`` or " +"``log(0.0)`` (where C99 Annex F recommends signaling invalid operation or " +"divide-by-zero), and :exc:`OverflowError` for results that overflow (for " +"example, ``exp(1000.0)``). A NaN will not be returned from any of the " +"functions above unless one or more of the input arguments was a NaN; in that " +"case, most functions will return a NaN, but (again following C99 Annex F) " +"there are some exceptions to this rule, for example ``pow(float('nan'), " +"0.0)`` or ``hypot(float('nan'), float('inf'))``." msgstr "" -#: ../../library/math.rst:831 +#: ../../library/math.rst:832 msgid "" "Note that Python makes no effort to distinguish signaling NaNs from quiet " "NaNs, and behavior for signaling NaNs remains unspecified. Typical behavior " "is to treat all NaNs as though they were quiet." msgstr "" -#: ../../library/math.rst:838 +#: ../../library/math.rst:839 msgid "Module :mod:`cmath`" msgstr ":mod:`cmath` 模組" -#: ../../library/math.rst:839 +#: ../../library/math.rst:840 msgid "Complex number versions of many of these functions." msgstr "" diff --git a/library/os.po b/library/os.po index fadaf5b8a3..7369950f4b 100644 --- a/library/os.po +++ b/library/os.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-09 00:13+0000\n" +"POT-Creation-Date: 2025-01-19 00:15+0000\n" "PO-Revision-Date: 2024-04-29 15:24+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -389,9 +389,9 @@ msgstr "" #: ../../library/os.rst:5303 ../../library/os.rst:5310 #: ../../library/os.rst:5319 ../../library/os.rst:5328 #: ../../library/os.rst:5337 ../../library/os.rst:5346 -#: ../../library/os.rst:5496 ../../library/os.rst:5505 -#: ../../library/os.rst:5529 ../../library/os.rst:5556 -#: ../../library/os.rst:5565 ../../library/os.rst:5688 +#: ../../library/os.rst:5498 ../../library/os.rst:5507 +#: ../../library/os.rst:5531 ../../library/os.rst:5558 +#: ../../library/os.rst:5567 ../../library/os.rst:5690 msgid "Availability" msgstr "" @@ -6078,128 +6078,129 @@ msgid "" "operating system." msgstr "" -#: ../../library/os.rst:5363 +#: ../../library/os.rst:5365 msgid "The default scheduling policy." msgstr "" -#: ../../library/os.rst:5367 +#: ../../library/os.rst:5369 msgid "" "Scheduling policy for CPU-intensive processes that tries to preserve " "interactivity on the rest of the computer." msgstr "" -#: ../../library/os.rst:5372 +#: ../../library/os.rst:5374 msgid "Scheduling policy for extremely low priority background tasks." msgstr "" -#: ../../library/os.rst:5376 +#: ../../library/os.rst:5378 msgid "Scheduling policy for sporadic server programs." msgstr "" -#: ../../library/os.rst:5380 +#: ../../library/os.rst:5382 msgid "A First In First Out scheduling policy." msgstr "" -#: ../../library/os.rst:5384 +#: ../../library/os.rst:5386 msgid "A round-robin scheduling policy." msgstr "" -#: ../../library/os.rst:5388 +#: ../../library/os.rst:5390 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:5395 +#: ../../library/os.rst:5397 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:5399 +#: ../../library/os.rst:5401 msgid "At the moment, there is only one possible parameter:" msgstr "" -#: ../../library/os.rst:5403 +#: ../../library/os.rst:5405 msgid "The scheduling priority for a scheduling policy." msgstr "" -#: ../../library/os.rst:5408 +#: ../../library/os.rst:5410 msgid "" "Get the minimum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5414 +#: ../../library/os.rst:5416 msgid "" "Get the maximum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5420 +#: ../../library/os.rst:5422 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:5427 +#: ../../library/os.rst:5429 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:5434 +#: ../../library/os.rst:5436 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:5440 +#: ../../library/os.rst:5442 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:5446 +#: ../../library/os.rst:5448 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:5452 -msgid "Voluntarily relinquish the CPU." +#: ../../library/os.rst:5454 +msgid "" +"Voluntarily relinquish the CPU. See :manpage:`sched_yield(2)` for details." msgstr "" -#: ../../library/os.rst:5457 +#: ../../library/os.rst:5459 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:5464 +#: ../../library/os.rst:5466 msgid "Return the set of CPUs the process with PID *pid* is restricted to." msgstr "" -#: ../../library/os.rst:5466 +#: ../../library/os.rst:5468 msgid "" "If *pid* is zero, return the set of CPUs the calling thread of the current " "process is restricted to." msgstr "" -#: ../../library/os.rst:5469 +#: ../../library/os.rst:5471 msgid "See also the :func:`process_cpu_count` function." msgstr "也請見 :func:`process_cpu_count` 函式。" -#: ../../library/os.rst:5475 +#: ../../library/os.rst:5477 msgid "Miscellaneous System Information" msgstr "" -#: ../../library/os.rst:5480 +#: ../../library/os.rst:5482 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 " @@ -6210,13 +6211,13 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:5488 +#: ../../library/os.rst:5490 msgid "" "If the configuration value specified by *name* isn't defined, ``None`` is " "returned." msgstr "" -#: ../../library/os.rst:5491 +#: ../../library/os.rst:5493 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 " @@ -6224,62 +6225,62 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:5501 +#: ../../library/os.rst:5503 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:5510 +#: ../../library/os.rst:5512 msgid "" "Return the number of logical CPUs in the **system**. Returns ``None`` if " "undetermined." msgstr "" -#: ../../library/os.rst:5513 +#: ../../library/os.rst:5515 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:5518 +#: ../../library/os.rst:5520 msgid "" "If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " "set, :func:`cpu_count` returns the overridden value *n*." msgstr "" -#: ../../library/os.rst:5525 +#: ../../library/os.rst:5527 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:5534 +#: ../../library/os.rst:5536 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:5538 +#: ../../library/os.rst:5540 msgid "" "The :func:`cpu_count` function can be used to get the number of logical CPUs " "in the **system**." msgstr "" -#: ../../library/os.rst:5541 +#: ../../library/os.rst:5543 msgid "" "If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " "set, :func:`process_cpu_count` returns the overridden value *n*." msgstr "" -#: ../../library/os.rst:5544 +#: ../../library/os.rst:5546 msgid "See also the :func:`sched_getaffinity` function." msgstr "也請見 :func:`sched_getaffinity` 函式。" -#: ../../library/os.rst:5551 +#: ../../library/os.rst:5553 msgid "" "Return integer-valued system configuration values. If the configuration " "value specified by *name* isn't defined, ``-1`` is returned. The comments " @@ -6288,44 +6289,44 @@ msgid "" "``sysconf_names``." msgstr "" -#: ../../library/os.rst:5561 +#: ../../library/os.rst:5563 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:5567 +#: ../../library/os.rst:5569 msgid "Add ``'SC_MINSIGSTKSZ'`` name." msgstr "" -#: ../../library/os.rst:5570 +#: ../../library/os.rst:5572 msgid "" "The following data values are used to support path manipulation operations. " "These are defined for all platforms." msgstr "" -#: ../../library/os.rst:5573 +#: ../../library/os.rst:5575 msgid "" "Higher-level operations on pathnames are defined in the :mod:`os.path` " "module." msgstr "" -#: ../../library/os.rst:5579 +#: ../../library/os.rst:5581 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:5587 +#: ../../library/os.rst:5589 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:5596 +#: ../../library/os.rst:5598 msgid "" "The character used by the operating system to separate pathname components. " "This is ``'/'`` for POSIX and ``'\\\\'`` for Windows. Note that knowing " @@ -6334,7 +6335,7 @@ msgid "" "useful. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5606 +#: ../../library/os.rst:5608 msgid "" "An alternative character used by the operating system to separate pathname " "components, or ``None`` if only one separator character exists. This is set " @@ -6342,27 +6343,27 @@ msgid "" "via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5615 +#: ../../library/os.rst:5617 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:5623 +#: ../../library/os.rst:5625 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:5630 +#: ../../library/os.rst:5632 msgid "" "The default search path used by :func:`exec\\*p\\* <execl>` and :func:" "`spawn\\*p\\* <spawnl>` if the environment doesn't have a ``'PATH'`` key. " "Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5637 +#: ../../library/os.rst:5639 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 " @@ -6371,36 +6372,36 @@ msgid "" "default); use a single ``'\\n'`` instead, on all platforms." msgstr "" -#: ../../library/os.rst:5646 +#: ../../library/os.rst:5648 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:5657 +#: ../../library/os.rst:5659 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:5665 +#: ../../library/os.rst:5667 msgid "Random numbers" msgstr "" -#: ../../library/os.rst:5670 +#: ../../library/os.rst:5672 msgid "" "Get up to *size* random bytes. The function can return less bytes than " "requested." msgstr "" -#: ../../library/os.rst:5673 +#: ../../library/os.rst:5675 msgid "" "These bytes can be used to seed user-space random number generators or for " "cryptographic purposes." msgstr "" -#: ../../library/os.rst:5676 +#: ../../library/os.rst:5678 msgid "" "``getrandom()`` relies on entropy gathered from device drivers and other " "sources of environmental noise. Unnecessarily reading large quantities of " @@ -6408,32 +6409,32 @@ msgid "" "``/dev/urandom`` devices." msgstr "" -#: ../../library/os.rst:5681 +#: ../../library/os.rst:5683 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:5685 +#: ../../library/os.rst:5687 msgid "" "See also the `Linux getrandom() manual page <https://man7.org/linux/man-" "pages/man2/getrandom.2.html>`_." msgstr "" -#: ../../library/os.rst:5694 +#: ../../library/os.rst:5696 msgid "" "Return a bytestring of *size* random bytes suitable for cryptographic use." msgstr "" -#: ../../library/os.rst:5696 +#: ../../library/os.rst:5698 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:5700 +#: ../../library/os.rst:5702 msgid "" "On Linux, if the ``getrandom()`` syscall is available, it is used in " "blocking mode: block until the system urandom entropy pool is initialized " @@ -6443,63 +6444,63 @@ msgid "" "to poll until the system urandom entropy pool is initialized." msgstr "" -#: ../../library/os.rst:5707 +#: ../../library/os.rst:5709 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:5711 +#: ../../library/os.rst:5713 msgid "On Windows, it will use ``BCryptGenRandom()``." msgstr "" -#: ../../library/os.rst:5714 +#: ../../library/os.rst:5716 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:5718 +#: ../../library/os.rst:5720 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:5724 +#: ../../library/os.rst:5726 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:5728 +#: ../../library/os.rst:5730 msgid "" "On Linux, ``getrandom()`` is now used in blocking mode to increase the " "security." msgstr "" -#: ../../library/os.rst:5732 +#: ../../library/os.rst:5734 msgid "" "On Windows, ``BCryptGenRandom()`` is used instead of ``CryptGenRandom()`` " "which is deprecated." msgstr "" -#: ../../library/os.rst:5738 +#: ../../library/os.rst:5740 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:5742 +#: ../../library/os.rst:5744 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:5749 +#: ../../library/os.rst:5751 msgid "" "If this bit is set, then random bytes are drawn from the ``/dev/" "random`` pool instead of the ``/dev/urandom`` pool." @@ -6609,40 +6610,40 @@ msgstr "" msgid "signalling" msgstr "signalling(信號)" -#: ../../library/os.rst:5576 ../../library/os.rst:5612 +#: ../../library/os.rst:5578 ../../library/os.rst:5614 msgid ". (dot)" msgstr ". (點)" -#: ../../library/os.rst:5576 ../../library/os.rst:5584 -#: ../../library/os.rst:5592 ../../library/os.rst:5603 -#: ../../library/os.rst:5612 +#: ../../library/os.rst:5578 ../../library/os.rst:5586 +#: ../../library/os.rst:5594 ../../library/os.rst:5605 +#: ../../library/os.rst:5614 msgid "in pathnames" msgstr "於 pathnames(路徑名稱)中" -#: ../../library/os.rst:5584 +#: ../../library/os.rst:5586 msgid ".." msgstr ".." -#: ../../library/os.rst:5592 ../../library/os.rst:5603 +#: ../../library/os.rst:5594 ../../library/os.rst:5605 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../library/os.rst:5593 +#: ../../library/os.rst:5595 msgid "\\ (backslash)" msgstr "\\ (反斜線)" -#: ../../library/os.rst:5593 +#: ../../library/os.rst:5595 msgid "in pathnames (Windows)" msgstr "in pathnames (Windows)(在路徑名稱中 (Windows))" -#: ../../library/os.rst:5619 +#: ../../library/os.rst:5621 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/os.rst:5619 +#: ../../library/os.rst:5621 msgid "path separator (POSIX)" msgstr "path separator (POSIX)(路徑分隔器 (POSIX))" -#: ../../library/os.rst:5619 +#: ../../library/os.rst:5621 msgid "; (semicolon)" msgstr "; (分號)" diff --git a/library/pdb.po b/library/pdb.po index 82e3ec7697..7740a944de 100644 --- a/library/pdb.po +++ b/library/pdb.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-19 01:58+0800\n" +"POT-Creation-Date: 2025-01-15 00:13+0000\n" "PO-Revision-Date: 2024-10-19 17:39+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,13 +43,14 @@ msgstr "" #: ../../library/pdb.rst:26 msgid "" -"The debugger is extensible -- it is actually defined as the class :class:" -"`Pdb`. This is currently undocumented but easily understood by reading the " -"source. The extension interface uses the modules :mod:`bdb` and :mod:`cmd`." +"The debugger is extensible -- it is actually defined as the " +"class :class:`Pdb`. This is currently undocumented but easily understood by " +"reading the source. The extension interface uses the modules :mod:`bdb` " +"and :mod:`cmd`." msgstr "" "偵錯器是可擴充的 —— 偵錯器實際被定義為 :class:`Pdb` 類別。該類別目前沒有文" -"件,但可以很容易地透過閱讀原始碼來理解它。擴充套件介面使用了 :mod:`bdb` 和 :" -"mod:`cmd` 模組。" +"件,但可以很容易地透過閱讀原始碼來理解它。擴充套件介面使用了 :mod:`bdb` " +"和 :mod:`cmd` 模組。" #: ../../library/pdb.rst:32 msgid "Module :mod:`faulthandler`" @@ -274,15 +275,15 @@ msgid "" "statement using :pdbcmd:`step` or :pdbcmd:`next` (all these commands are " "explained below). The optional *globals* and *locals* arguments specify the " "environment in which the code is executed; by default the dictionary of the " -"module :mod:`__main__` is used. (See the explanation of the built-in :func:" -"`exec` or :func:`eval` functions.)" +"module :mod:`__main__` is used. (See the explanation of the built-" +"in :func:`exec` or :func:`eval` functions.)" msgstr "" "在偵錯器控制下執行 *statement*\\ (以字串或程式碼物件形式給定)。偵錯提示字元" "會在執行任何程式碼前出現;你可以設定斷點並輸入 :pdbcmd:`continue`,或也可以使" "用 :pdbcmd:`step` 或 :pdbcmd:`next` 逐步執行陳述式(這些命令在下面都有說" -"明)。可選引數 *globals* 和 *locals* 指定程式碼執行的環境;預設使用 :mod:" -"`__main__` 模組的字典。(請參閱內建函式 :func:`exec` 或 :func:`eval` 的說" -"明。)" +"明)。可選引數 *globals* 和 *locals* 指定程式碼執行的環境;預設使" +"用 :mod:`__main__` 模組的字典。(請參閱內建函式 :func:`exec` 或 :func:`eval` " +"的說明。)" #: ../../library/pdb.rst:149 msgid "" @@ -290,9 +291,9 @@ msgid "" "debugger control. When :func:`runeval` returns, it returns the value of the " "*expression*. Otherwise this function is similar to :func:`run`." msgstr "" -"在偵錯器控制下為 *expression* 求值(以字串或程式碼物件形式給定)。當 :func:" -"`runeval` 回傳時,它回傳 *expression* 的值。除此之外,該函式與 :func:`run` 類" -"似。" +"在偵錯器控制下為 *expression* 求值(以字串或程式碼物件形式給定)。" +"當 :func:`runeval` 回傳時,它回傳 *expression* 的值。除此之外,該函式" +"與 :func:`run` 類似。" #: ../../library/pdb.rst:156 msgid "" @@ -301,9 +302,9 @@ msgid "" "function call returned. The debugger prompt appears as soon as the function " "is entered." msgstr "" -"使用給定的引數呼叫 *function*\\ (只可以是函式或方法物件,不能是字串)。:" -"func:`runcall` 回傳的是所呼叫函式的回傳值。偵錯器提示字元將在進入函式後立即出" -"現。" +"使用給定的引數呼叫 *function*\\ (只可以是函式或方法物件,不能是字" +"串)。:func:`runcall` 回傳的是所呼叫函式的回傳值。偵錯器提示字元將在進入函式" +"後立即出現。" #: ../../library/pdb.rst:164 msgid "" @@ -328,33 +329,37 @@ msgstr ":func:`set_trace` 將立即進入偵錯器,而不是在下一列要執 #: ../../library/pdb.rst:178 msgid "" -"Enter post-mortem debugging of the given *traceback* object. If no " -"*traceback* is given, it uses the one of the exception that is currently " -"being handled (an exception must be being handled if the default is to be " -"used)." +"Enter post-mortem debugging of the given exception or :ref:`traceback object " +"<traceback-objects>`. If no value is given, it uses the exception that is " +"currently being handled, or raises ``ValueError`` if there isn’t one." msgstr "" -"進入所給定 *traceback* 物件的事後偵錯。如果沒有給定 *traceback*,預設使用當前" -"正在處理的例外之一(使用預設情況時,必須要有正在處理的例外存在)。" +"進入所給定例外或\\ :ref:`回溯物件 <traceback-objects>`\\ 的事後偵錯。如果沒有" +"給定,預設使用當前正在處理的例外,或如果沒有例外則會引發 ``ValueError``。" -#: ../../library/pdb.rst:186 +#: ../../library/pdb.rst:183 +msgid "Support for exception objects was added." +msgstr "新增對例外物件的支援。" + +#: ../../library/pdb.rst:188 msgid "" "Enter post-mortem debugging of the exception found in :data:`sys.last_exc`." msgstr "進入在 :data:`sys.last_exc` 中發現的例外的事後偵錯。" -#: ../../library/pdb.rst:190 +#: ../../library/pdb.rst:192 msgid "" "The ``run*`` functions and :func:`set_trace` are aliases for instantiating " "the :class:`Pdb` class and calling the method of the same name. If you want " "to access further features, you have to do this yourself:" msgstr "" -"``run*`` 函式和 :func:`set_trace` 都是別名,用於實例化 (instantiate) :class:" -"`Pdb` 類別並呼叫同名方法。如果要使用更多功能,則必須自己執行以下操作:" +"``run*`` 函式和 :func:`set_trace` 都是別名,用於實例化 " +"(instantiate) :class:`Pdb` 類別並呼叫同名方法。如果要使用更多功能,則必須自己" +"執行以下操作:" -#: ../../library/pdb.rst:197 +#: ../../library/pdb.rst:199 msgid ":class:`Pdb` is the debugger class." msgstr ":class:`Pdb` 是偵錯器類別。" -#: ../../library/pdb.rst:199 +#: ../../library/pdb.rst:201 msgid "" "The *completekey*, *stdin* and *stdout* arguments are passed to the " "underlying :class:`cmd.Cmd` class; see the description there." @@ -362,7 +367,7 @@ msgstr "" "*completekey*、*stdin* 與 *stdout* 引數會被傳到底層的 :class:`cmd.Cmd` 類別;" "請於該文件閱讀相關敘述。" -#: ../../library/pdb.rst:202 +#: ../../library/pdb.rst:204 msgid "" "The *skip* argument, if given, must be an iterable of glob-style module name " "patterns. The debugger will not step into frames that originate in a module " @@ -371,63 +376,63 @@ msgstr "" "如果給定 *skip* 引數,則它必須是一個給出 glob 樣式之模組名稱的疊代器。如果遇" "到匹配這些樣式的模組,偵錯器將不會進入來自該模組的 frame。 [1]_" -#: ../../library/pdb.rst:206 +#: ../../library/pdb.rst:208 msgid "" "By default, Pdb sets a handler for the SIGINT signal (which is sent when the " -"user presses :kbd:`Ctrl-C` on the console) when you give a :pdbcmd:" -"`continue` command. This allows you to break into the debugger again by " -"pressing :kbd:`Ctrl-C`. If you want Pdb not to touch the SIGINT handler, " -"set *nosigint* to true." +"user presses :kbd:`Ctrl-C` on the console) when you give " +"a :pdbcmd:`continue` command. This allows you to break into the debugger " +"again by pressing :kbd:`Ctrl-C`. If you want Pdb not to touch the SIGINT " +"handler, set *nosigint* to true." msgstr "" "預設情況下,當你發出 :pdbcmd:`continue` 命令時,Pdb 會為 SIGINT 訊號(即使用" "者在控制台上按下 :kbd:`Ctrl-C` 時會發送的訊號)設定一個處理程式 (handler),這" "允許你透過按下 :kbd:`Ctrl-C` 再次切入偵錯器。如果你希望 Pdb 不影響到 SIGINT " "處理程式,請將 *nosigint* 設定為 true。" -#: ../../library/pdb.rst:211 +#: ../../library/pdb.rst:213 msgid "" -"The *readrc* argument defaults to true and controls whether Pdb will load ." -"pdbrc files from the filesystem." +"The *readrc* argument defaults to true and controls whether Pdb will " +"load .pdbrc files from the filesystem." msgstr "*readrc* 引數預設為 true,它控制 Pdb 是否從檔案系統載入 .pdbrc 檔案。" -#: ../../library/pdb.rst:214 +#: ../../library/pdb.rst:216 msgid "Example call to enable tracing with *skip*::" msgstr "啟用追蹤 (tracing) 且帶有 *skip* 引數的呼叫示範: ::" -#: ../../library/pdb.rst:216 +#: ../../library/pdb.rst:218 msgid "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" msgstr "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" -#: ../../library/pdb.rst:218 +#: ../../library/pdb.rst:220 msgid "" "Raises an :ref:`auditing event <auditing>` ``pdb.Pdb`` with no arguments." msgstr "" -"不帶引數地引發一個\\ :ref:`稽核事件 (auditing event) <auditing>` ``pdb." -"Pdb``。" +"不帶引數地引發一個\\ :ref:`稽核事件 (auditing event) <auditing>` " +"``pdb.Pdb``。" -#: ../../library/pdb.rst:220 +#: ../../library/pdb.rst:222 msgid "Added the *skip* parameter." msgstr "新增了 *skip* 參數。" -#: ../../library/pdb.rst:223 +#: ../../library/pdb.rst:225 msgid "" "Added the *nosigint* parameter. Previously, a SIGINT handler was never set " "by Pdb." msgstr "新增了 *nosigint* 參數。以前 SIGINT 處理程式從未被 Pdb 設定過。" -#: ../../library/pdb.rst:227 +#: ../../library/pdb.rst:229 msgid "The *readrc* argument." msgstr "*readrc* 引數。" -#: ../../library/pdb.rst:235 +#: ../../library/pdb.rst:237 msgid "See the documentation for the functions explained above." msgstr "請見上面關於這些函式的文件說明。" -#: ../../library/pdb.rst:241 +#: ../../library/pdb.rst:243 msgid "Debugger Commands" msgstr "偵錯器命令" -#: ../../library/pdb.rst:243 +#: ../../library/pdb.rst:245 msgid "" "The commands recognized by the debugger are listed below. Most commands can " "be abbreviated to one or two letters as indicated; e.g. ``h(elp)`` means " @@ -444,15 +449,15 @@ msgstr "" "空格(空格符 (spaces) 或製表符 (tabs))分隔。在命令語法中,可選引數被括在方括" "號 (``[]``) 中;使用時請勿輸入方括號。命令語法中的選擇項由豎線 (``|``) 分隔。" -#: ../../library/pdb.rst:252 +#: ../../library/pdb.rst:254 msgid "" "Entering a blank line repeats the last command entered. Exception: if the " "last command was a :pdbcmd:`list` command, the next 11 lines are listed." msgstr "" -"輸入一個空白列 (blank line) 將重複上次輸入的命令。例外:如果上一個命令是 :" -"pdbcmd:`list` 命令,則會列出接下來的 11 列。" +"輸入一個空白列 (blank line) 將重複上次輸入的命令。例外:如果上一個命令" +"是 :pdbcmd:`list` 命令,則會列出接下來的 11 列。" -#: ../../library/pdb.rst:255 +#: ../../library/pdb.rst:257 msgid "" "Commands that the debugger doesn't recognize are assumed to be Python " "statements and are executed in the context of the program being debugged. " @@ -467,13 +472,13 @@ msgstr "" "大方法,甚至可以修改變數或呼叫函式。當此類陳述式發生例外,將印出例外名稱,但" "偵錯器的狀態不會改變。" -#: ../../library/pdb.rst:263 +#: ../../library/pdb.rst:265 msgid "" "Expressions/Statements whose prefix is a pdb command are now correctly " "identified and executed." msgstr "現在可以正確辨識並執行前綴為 pdb 命令的運算式/陳述式。" -#: ../../library/pdb.rst:267 +#: ../../library/pdb.rst:269 msgid "" "The debugger supports :ref:`aliases <debugger-aliases>`. Aliases can have " "parameters which allows one a certain level of adaptability to the context " @@ -482,7 +487,7 @@ msgstr "" "偵錯器有支援設定\\ :ref:`別名 <debugger-aliases>`。別名可以有參數,使得偵錯器" "對被檢查的情境有一定程度的適應性。" -#: ../../library/pdb.rst:271 +#: ../../library/pdb.rst:273 msgid "" "Multiple commands may be entered on a single line, separated by ``;;``. (A " "single ``;`` is not used as it is the separator for multiple commands in a " @@ -497,7 +502,7 @@ msgstr "" "總是在第一處 ``;;`` 被切分開,即使它位於引號內的字串之中。對於具有雙分號字串" "的一個變通解法,是使用隱式字串連接 ``';'';'`` 或 ``\";\"\";\"``。" -#: ../../library/pdb.rst:278 +#: ../../library/pdb.rst:280 msgid "" "To set a temporary global variable, use a *convenience variable*. A " "*convenience variable* is a variable whose name starts with ``$``. For " @@ -511,27 +516,27 @@ msgstr "" "可以在偵錯器會話 (debugger session) 中使用它。當程式恢復執行時,*便利變數*\\ " "將被清除,因此與使用 ``foo = 1`` 等普通變數相比,它不太會去干擾你的程式。" -#: ../../library/pdb.rst:285 +#: ../../library/pdb.rst:287 msgid "There are three preset *convenience variables*:" msgstr "共有三個預先設定的\\ *便利變數*:" -#: ../../library/pdb.rst:287 +#: ../../library/pdb.rst:289 msgid "``$_frame``: the current frame you are debugging" msgstr "``$_frame``:當前正在偵錯的 frame" -#: ../../library/pdb.rst:288 +#: ../../library/pdb.rst:290 msgid "``$_retval``: the return value if the frame is returning" msgstr "``$_retval``:frame 回傳時的回傳值" -#: ../../library/pdb.rst:289 +#: ../../library/pdb.rst:291 msgid "``$_exception``: the exception if the frame is raising an exception" msgstr "``$_exception``:frame 引發例外時的例外" -#: ../../library/pdb.rst:293 +#: ../../library/pdb.rst:295 msgid "Added the *convenience variable* feature." msgstr "新增了\\ *便利變數*\\ 功能。" -#: ../../library/pdb.rst:299 +#: ../../library/pdb.rst:301 msgid "" "If a file :file:`.pdbrc` exists in the user's home directory or in the " "current directory, it is read with ``'utf-8'`` encoding and executed as if " @@ -545,16 +550,16 @@ msgstr "" "空列和以 ``#`` 開頭的列會被忽略之外。這對於別名設定特別有用。如果兩個檔案都存" "在,則先讀取家目錄中的檔案,且定義於其中的別名可以被本地檔案覆蓋。" -#: ../../library/pdb.rst:306 +#: ../../library/pdb.rst:308 msgid "" -":file:`.pdbrc` can now contain commands that continue debugging, such as :" -"pdbcmd:`continue` or :pdbcmd:`next`. Previously, these commands had no " +":file:`.pdbrc` can now contain commands that continue debugging, such " +"as :pdbcmd:`continue` or :pdbcmd:`next`. Previously, these commands had no " "effect." msgstr "" -":file:`.pdbrc` 現在可以包含繼續偵錯的命令,如 :pdbcmd:`continue` 或 :pdbcmd:" -"`next`。以前檔案中的這些命令是無效的。" +":file:`.pdbrc` 現在可以包含繼續偵錯的命令,如 :pdbcmd:`continue` " +"或 :pdbcmd:`next`。以前檔案中的這些命令是無效的。" -#: ../../library/pdb.rst:311 +#: ../../library/pdb.rst:313 msgid "" ":file:`.pdbrc` is now read with ``'utf-8'`` encoding. Previously, it was " "read with the system locale encoding." @@ -562,7 +567,7 @@ msgstr "" ":file:`.pdbrc` 現在使用 ``'utf-8'`` 編碼讀取。以前它是使用系統區域設定編碼讀" "取的。" -#: ../../library/pdb.rst:318 +#: ../../library/pdb.rst:320 msgid "" "Without argument, print the list of available commands. With a *command* as " "argument, print help about that command. ``help pdb`` displays the full " @@ -575,7 +580,7 @@ msgstr "" "由於 *command* 引數必須是一個識別字 (identifier),若要獲取 ``!`` 命令的幫助訊" "息則必須輸入 ``help exec``。" -#: ../../library/pdb.rst:326 +#: ../../library/pdb.rst:328 msgid "" "Print a stack trace, with the most recent frame at the bottom. An arrow " "(``>``) indicates the current frame, which determines the context of most " @@ -584,7 +589,7 @@ msgstr "" "印出 stack trace,最新的 frame 會位於底部。箭頭(``>``)表示當前的 frame,它" "也決定了大多數命令的情境。" -#: ../../library/pdb.rst:331 +#: ../../library/pdb.rst:333 msgid "" "Move the current frame *count* (default one) levels down in the stack trace " "(to a newer frame)." @@ -592,7 +597,7 @@ msgstr "" "在 stack trace 中,將當前 frame 向下移動 *count* 級(預設為 1 級,移往較新的 " "frame)。" -#: ../../library/pdb.rst:336 +#: ../../library/pdb.rst:338 msgid "" "Move the current frame *count* (default one) levels up in the stack trace " "(to an older frame)." @@ -600,21 +605,21 @@ msgstr "" "在 stack trace 中,將當前 frame 向上移動 *count* 級(預設為 1 級,移向較舊的 " "frame)。" -#: ../../library/pdb.rst:341 +#: ../../library/pdb.rst:343 msgid "" "With a *lineno* argument, set a break at line *lineno* in the current file. " "The line number may be prefixed with a *filename* and a colon, to specify a " "breakpoint in another file (possibly one that hasn't been loaded yet). The " "file is searched on :data:`sys.path`. Accepatable forms of *filename* are " -"``/abspath/to/file.py``, ``relpath/file.py``, ``module`` and ``package." -"module``." +"``/abspath/to/file.py``, ``relpath/file.py``, ``module`` and " +"``package.module``." msgstr "" "如帶有 *lineno* 引數,則在目前檔案中的 *lineno* 列處設定中斷。列號可以以 " "*filename* 和冒號為前綴,以指定另一個檔案(可能是尚未載入的檔案)中的斷點。該" "檔案會在 :data:`sys.path` 上搜尋。可接受的 *filename* 形式為 ``/abspath/to/" "file.py``、``relpath/file.py``、``module`` 和 ``package.module``。" -#: ../../library/pdb.rst:348 +#: ../../library/pdb.rst:350 msgid "" "With a *function* argument, set a break at the first executable statement " "within that function. *function* can be any expression that evaluates to a " @@ -623,13 +628,13 @@ msgstr "" "如帶有 *function* 引數,在該函式內的第一個可執行陳述式處設定中斷。*function* " "可以是任何其求值結果為目前命名空間中函式的運算式。" -#: ../../library/pdb.rst:352 +#: ../../library/pdb.rst:354 msgid "" "If a second argument is present, it is an expression which must evaluate to " "true before the breakpoint is honored." msgstr "如果第二個引數存在,它是一個運算式,在斷點生效前其必須求值為 true" -#: ../../library/pdb.rst:355 +#: ../../library/pdb.rst:357 msgid "" "Without argument, list all breaks, including for each breakpoint, the number " "of times that breakpoint has been hit, the current ignore count, and the " @@ -638,20 +643,20 @@ msgstr "" "如果不帶引數執行會列出所有斷點資訊,包括每個斷點、命中該斷點的次數、當前的忽" "略次數以及關聯的條件(如存在)。" -#: ../../library/pdb.rst:359 +#: ../../library/pdb.rst:361 msgid "" "Each breakpoint is assigned a number to which all the other breakpoint " "commands refer." msgstr "每個斷點都有賦予一個編號,所有其他斷點命令都參照該編號。" -#: ../../library/pdb.rst:364 +#: ../../library/pdb.rst:366 msgid "" "Temporary breakpoint, which is removed automatically when it is first hit. " "The arguments are the same as for :pdbcmd:`break`." msgstr "" "臨時斷點,在第一次遇見時會自動被刪除。它的引數與 :pdbcmd:`break` 相同。" -#: ../../library/pdb.rst:369 +#: ../../library/pdb.rst:371 msgid "" "With a *filename:lineno* argument, clear all the breakpoints at this line. " "With a space separated list of breakpoint numbers, clear those breakpoints. " @@ -660,7 +665,7 @@ msgstr "" "如帶有 *filename:lineno* 引數,則清除此列上的所有斷點。如果引數是空格分隔的斷" "點編號列表,則清除這些斷點。如果不帶引數則清除所有斷點(但會先提示確認)。" -#: ../../library/pdb.rst:375 +#: ../../library/pdb.rst:377 msgid "" "Disable the breakpoints given as a space separated list of breakpoint " "numbers. Disabling a breakpoint means it cannot cause the program to stop " @@ -670,11 +675,11 @@ msgstr "" "停用斷點,斷點以空格分隔的斷點編號列表來給定。停用斷點表示它不會導致程式停止" "執行,但是與清除斷點不同,停用的斷點將保留在斷點列表中並且可以(重新)啟用。" -#: ../../library/pdb.rst:382 +#: ../../library/pdb.rst:384 msgid "Enable the breakpoints specified." msgstr "啟用指定的斷點。" -#: ../../library/pdb.rst:386 +#: ../../library/pdb.rst:388 msgid "" "Set the ignore count for the given breakpoint number. If *count* is " "omitted, the ignore count is set to 0. A breakpoint becomes active when the " @@ -686,7 +691,7 @@ msgstr "" "為 0 時,斷點將變為有效狀態。當非 0 時,每次到達斷點,且斷點沒有被禁用,且任" "何關聯的條件被求值為 true,則 *count* 就會遞減。" -#: ../../library/pdb.rst:394 +#: ../../library/pdb.rst:396 msgid "" "Set a new *condition* for the breakpoint, an expression which must evaluate " "to true before the breakpoint is honored. If *condition* is absent, any " @@ -695,7 +700,7 @@ msgstr "" "為斷點設定一個新 *condition*,為一個運算式,且其求值結果為 true 時斷點才會起" "作用。如果沒有給定 *condition*,則刪除任何現有條件,也就是不為斷點設定條件。" -#: ../../library/pdb.rst:400 +#: ../../library/pdb.rst:402 msgid "" "Specify a list of commands for breakpoint number *bpnumber*. The commands " "themselves appear on the following lines. Type a line containing just " @@ -704,7 +709,7 @@ msgstr "" "為編號是 *bpnumber* 的斷點指定一系列命令。命令內容出現在後續的幾列中。輸入僅" "包含 ``end`` 的一列來結束命令列表。例如: ::" -#: ../../library/pdb.rst:404 +#: ../../library/pdb.rst:406 msgid "" "(Pdb) commands 1\n" "(com) p some_variable\n" @@ -716,7 +721,7 @@ msgstr "" "(com) end\n" "(Pdb)" -#: ../../library/pdb.rst:409 +#: ../../library/pdb.rst:411 msgid "" "To remove all commands from a breakpoint, type ``commands`` and follow it " "immediately with ``end``; that is, give no commands." @@ -724,37 +729,37 @@ msgstr "" "要刪除斷點上的所有命令,請輸入 ``commands`` 並立即以 ``end`` 結尾,也就是不指" "定任何命令。" -#: ../../library/pdb.rst:412 +#: ../../library/pdb.rst:414 msgid "" "With no *bpnumber* argument, ``commands`` refers to the last breakpoint set." msgstr "不帶有 *bpnumber* 引數則 ``commands`` 會關聯到上一個設定的斷點。" -#: ../../library/pdb.rst:414 +#: ../../library/pdb.rst:416 msgid "" "You can use breakpoint commands to start your program up again. Simply use " "the :pdbcmd:`continue` command, or :pdbcmd:`step`, or any other command that " "resumes execution." msgstr "" -"可以使用斷點命令來重新啟動程式,只需使用 :pdbcmd:`continue` 或 :pdbcmd:" -"`step` 命令,或其他可以繼續執行程式的命令。" +"可以使用斷點命令來重新啟動程式,只需使用 :pdbcmd:`continue` " +"或 :pdbcmd:`step` 命令,或其他可以繼續執行程式的命令。" -#: ../../library/pdb.rst:418 +#: ../../library/pdb.rst:420 msgid "" -"Specifying any command resuming execution (currently :pdbcmd:`continue`, :" -"pdbcmd:`step`, :pdbcmd:`next`, :pdbcmd:`return`, :pdbcmd:`jump`, :pdbcmd:" -"`quit` and their abbreviations) terminates the command list (as if that " -"command was immediately followed by end). This is because any time you " -"resume execution (even with a simple next or step), you may encounter " -"another breakpoint—which could have its own command list, leading to " -"ambiguities about which list to execute." +"Specifying any command resuming execution " +"(currently :pdbcmd:`continue`, :pdbcmd:`step`, :pdbcmd:`next`, :pdbcmd:`return`, :pdbcmd:`jump`, :pdbcmd:`quit` " +"and their abbreviations) terminates the command list (as if that command was " +"immediately followed by end). This is because any time you resume execution " +"(even with a simple next or step), you may encounter another breakpoint—" +"which could have its own command list, leading to ambiguities about which " +"list to execute." msgstr "" -"如果指定了某個繼續執行程式的命令(目前包括 :pdbcmd:`continue`、:pdbcmd:" -"`step`、:pdbcmd:`next`、:pdbcmd:`return`、:pdbcmd:`jump`、:pdbcmd:`quit` 及它" -"們的縮寫)將終止命令列表(就像該命令後馬上跟著 end)。因為在任何時候繼續執行" -"下去(即使是簡單的 next 或 step),都可能會遇到另一個斷點,該斷點可能具有自己" -"的命令列表,這會導致無法確定要執行哪個列表。" +"如果指定了某個繼續執行程式的命令(目前包" +"括 :pdbcmd:`continue`、:pdbcmd:`step`、:pdbcmd:`next`、:pdbcmd:`return`、:pdbcmd:`jump`、:pdbcmd:`quit` " +"及它們的縮寫)將終止命令列表(就像該命令後馬上跟著 end)。因為在任何時候繼續" +"執行下去(即使是簡單的 next 或 step),都可能會遇到另一個斷點,該斷點可能具有" +"自己的命令列表,這會導致無法確定要執行哪個列表。" -#: ../../library/pdb.rst:427 +#: ../../library/pdb.rst:429 msgid "" "If you use the ``silent`` command in the command list, the usual message " "about stopping at a breakpoint is not printed. This may be desirable for " @@ -766,7 +771,7 @@ msgstr "" "息就不會印出。對於要印出特定訊息再繼續的斷點來說,這可能會是需要的功能。如果" "其他命令都沒有印出任何內容,那你就看不到已到達斷點的跡象。" -#: ../../library/pdb.rst:434 +#: ../../library/pdb.rst:436 msgid "" "Execute the current line, stop at the first possible occasion (either in a " "function that is called or on the next line in the current function)." @@ -774,7 +779,7 @@ msgstr "" "執行當前列,在第一個可以停止的位置(在被呼叫的函式內部或在當前函式的下一列)" "停止。" -#: ../../library/pdb.rst:439 +#: ../../library/pdb.rst:441 msgid "" "Continue execution until the next line in the current function is reached or " "it returns. (The difference between :pdbcmd:`next` and :pdbcmd:`step` is " @@ -787,13 +792,13 @@ msgstr "" "而 :pdbcmd:`next`\\ (幾乎)全速執行被呼叫的函式,並僅在當前函式的下一列停" "止。)" -#: ../../library/pdb.rst:447 +#: ../../library/pdb.rst:449 msgid "" "Without argument, continue execution until the line with a number greater " "than the current one is reached." msgstr "如果不帶引數則繼續執行,直到列號比當前的列大時停止。" -#: ../../library/pdb.rst:450 +#: ../../library/pdb.rst:452 msgid "" "With *lineno*, continue execution until a line with a number greater or " "equal to *lineno* is reached. In both cases, also stop when the current " @@ -802,19 +807,19 @@ msgstr "" "如帶有 *lineno* 則繼續執行,直到到達列號大於或等於 *lineno* 的那一列。在這兩" "種情況下,當前 frame 回傳時也會停止。" -#: ../../library/pdb.rst:454 +#: ../../library/pdb.rst:456 msgid "Allow giving an explicit line number." msgstr "允許明確給定一個列號。" -#: ../../library/pdb.rst:459 +#: ../../library/pdb.rst:461 msgid "Continue execution until the current function returns." msgstr "繼續執行,直到目前的函式回傳。" -#: ../../library/pdb.rst:463 +#: ../../library/pdb.rst:465 msgid "Continue execution, only stop when a breakpoint is encountered." msgstr "繼續執行,除非遇到斷點才停下來。" -#: ../../library/pdb.rst:467 +#: ../../library/pdb.rst:469 msgid "" "Set the next line that will be executed. Only available in the bottom-most " "frame. This lets you jump back and execute code again, or jump forward to " @@ -823,16 +828,16 @@ msgstr "" "設定即將執行的下一列,僅可用於堆疊中最底部的 frame。這讓你可以跳回去並再次執" "行程式碼,或者往前跳以跳過不想執行的程式碼。" -#: ../../library/pdb.rst:471 +#: ../../library/pdb.rst:473 msgid "" "It should be noted that not all jumps are allowed -- for instance it is not " -"possible to jump into the middle of a :keyword:`for` loop or out of a :" -"keyword:`finally` clause." +"possible to jump into the middle of a :keyword:`for` loop or out of " +"a :keyword:`finally` clause." msgstr "" "需要注意的是,不是所有的跳轉都是被允許的 -- 例如不能跳轉到 :keyword:`for` 迴" "圈的中間或跳出 :keyword:`finally` 子句。" -#: ../../library/pdb.rst:477 +#: ../../library/pdb.rst:479 msgid "" "List source code for the current file. Without arguments, list 11 lines " "around the current line or continue the previous listing. With ``.`` as " @@ -845,7 +850,7 @@ msgstr "" "列出那一列周圍的 11 列。如果帶有兩個引數,則列出給定範圍中的程式碼;如果第二" "個引數小於第一個引數,則將其直譯為要列出的列數。" -#: ../../library/pdb.rst:483 +#: ../../library/pdb.rst:485 msgid "" "The current line in the current frame is indicated by ``->``. If an " "exception is being debugged, the line where the exception was originally " @@ -855,34 +860,34 @@ msgstr "" "當前 frame 中的當前列會用 ``->`` 標記出來。如果正在偵錯一個例外,且引發或傳遞" "該例外的那一列不是當前列,則會用 ``>>`` 來標記該列。" -#: ../../library/pdb.rst:488 +#: ../../library/pdb.rst:490 msgid "Added the ``>>`` marker." msgstr "新增了 ``>>`` 標記。" -#: ../../library/pdb.rst:493 +#: ../../library/pdb.rst:495 msgid "" "List all source code for the current function or frame. Interesting lines " "are marked as for :pdbcmd:`list`." msgstr "" "列出當前函式或 frame 的所有原始碼。相關列的標記方式與 :pdbcmd:`list` 相同。" -#: ../../library/pdb.rst:500 +#: ../../library/pdb.rst:502 msgid "Print the arguments of the current function and their current values." msgstr "印出當前函式的引數及它們當前的值。" -#: ../../library/pdb.rst:504 +#: ../../library/pdb.rst:506 msgid "Evaluate *expression* in the current context and print its value." msgstr "在當前情境中為 *expression* 求值並印出其值。" -#: ../../library/pdb.rst:508 +#: ../../library/pdb.rst:510 msgid "" "``print()`` can also be used, but is not a debugger command --- this " "executes the Python :func:`print` function." msgstr "" -"也可以使用 ``print()``,但它不是一個偵錯器命令 --- 它會執行 Python :func:" -"`print` 函式。" +"也可以使用 ``print()``,但它不是一個偵錯器命令 --- 它會執行 " +"Python :func:`print` 函式。" -#: ../../library/pdb.rst:514 +#: ../../library/pdb.rst:516 msgid "" "Like the :pdbcmd:`p` command, except the value of *expression* is pretty-" "printed using the :mod:`pprint` module." @@ -890,26 +895,26 @@ msgstr "" "與 :pdbcmd:`p` 命令類似,除了 *expression* 的值是使用 :mod:`pprint` 模組美化" "後印出來的。" -#: ../../library/pdb.rst:519 +#: ../../library/pdb.rst:521 msgid "Print the type of *expression*." msgstr "印出 *expression* 的型別。" -#: ../../library/pdb.rst:523 +#: ../../library/pdb.rst:525 msgid "Try to get source code of *expression* and display it." msgstr "嘗試獲取 *expression* 的原始碼並顯示它。" -#: ../../library/pdb.rst:529 +#: ../../library/pdb.rst:531 msgid "" "Display the value of *expression* if it changed, each time execution stops " "in the current frame." msgstr "每次在當前 frame 中停止執行時,顯示 *expression* 的值(如果有變更)。" -#: ../../library/pdb.rst:532 +#: ../../library/pdb.rst:534 msgid "" "Without *expression*, list all display expressions for the current frame." msgstr "如果不帶有 *expression*,則列出當前 frame 的所有運算式。" -#: ../../library/pdb.rst:536 +#: ../../library/pdb.rst:538 msgid "" "Display evaluates *expression* and compares to the result of the previous " "evaluation of *expression*, so when the result is mutable, display may not " @@ -918,11 +923,11 @@ msgstr "" "display 會對 *expression* 求值並將結果與之前 *expression* 的求值結果進行比" "較,因此當結果可變時,display 可能無法獲取其變更。" -#: ../../library/pdb.rst:540 ../../library/pdb.rst:690 +#: ../../library/pdb.rst:542 ../../library/pdb.rst:692 msgid "Example::" msgstr "範例如下: ::" -#: ../../library/pdb.rst:542 +#: ../../library/pdb.rst:544 msgid "" "lst = []\n" "breakpoint()\n" @@ -936,15 +941,15 @@ msgstr "" "lst.append(1)\n" "print(lst)" -#: ../../library/pdb.rst:548 +#: ../../library/pdb.rst:550 msgid "" "Display won't realize ``lst`` has been changed because the result of " "evaluation is modified in place by ``lst.append(1)`` before being compared::" msgstr "" -"display 不會意識到 ``lst`` 已更改,因為其求值結果在比較之前已被 ``lst." -"append(1)`` 原地 (in place) 修改: ::" +"display 不會意識到 ``lst`` 已更改,因為其求值結果在比較之前已被 " +"``lst.append(1)`` 原地 (in place) 修改: ::" -#: ../../library/pdb.rst:551 +#: ../../library/pdb.rst:553 msgid "" "> example.py(3)<module>()\n" "-> pass\n" @@ -970,11 +975,11 @@ msgstr "" "-> print(lst)\n" "(Pdb)" -#: ../../library/pdb.rst:563 +#: ../../library/pdb.rst:565 msgid "You can do some tricks with copy mechanism to make it work::" msgstr "你可以運用複製機制的一些技巧來使其能夠運作: ::" -#: ../../library/pdb.rst:565 +#: ../../library/pdb.rst:567 msgid "" "> example.py(3)<module>()\n" "-> pass\n" @@ -1002,7 +1007,7 @@ msgstr "" "display lst[:]: [1] [old: []]\n" "(Pdb)" -#: ../../library/pdb.rst:582 +#: ../../library/pdb.rst:584 msgid "" "Do not display *expression* anymore in the current frame. Without " "*expression*, clear all display expressions for the current frame." @@ -1010,7 +1015,7 @@ msgstr "" "不再顯示當前 frame 中的 *expression*。如果不帶有 *expression*,則清除當前 " "frame 的所有顯示運算式。" -#: ../../library/pdb.rst:589 +#: ../../library/pdb.rst:591 msgid "" "Start an interactive interpreter (using the :mod:`code` module) in a new " "global namespace initialised from the local and global namespaces for the " @@ -1021,7 +1026,7 @@ msgstr "" "(使用 :mod:`code` 模組)。可使用 ``exit()`` 或 ``quit()`` 退出直譯器並回到偵" "錯器。" -#: ../../library/pdb.rst:596 +#: ../../library/pdb.rst:598 msgid "" "As ``interact`` creates a new dedicated namespace for code execution, " "assignments to variables will not affect the original namespaces. However, " @@ -1032,20 +1037,20 @@ msgstr "" "影響原始命名空間,但是對任何被參照的可變物件的修改將像往常一樣反映在原始命名" "空間中。" -#: ../../library/pdb.rst:603 +#: ../../library/pdb.rst:605 msgid "" "``exit()`` and ``quit()`` can be used to exit the :pdbcmd:`interact` command." msgstr "``exit()`` 和 ``quit()`` 可用來退出 :pdbcmd:`interact` 命令。" -#: ../../library/pdb.rst:607 +#: ../../library/pdb.rst:609 msgid "" ":pdbcmd:`interact` directs its output to the debugger's output channel " "rather than :data:`sys.stderr`." msgstr "" -":pdbcmd:`interact` 將其輸出導向到偵錯器的輸出通道 (output channel),而不是 :" -"data:`sys.stderr`。" +":pdbcmd:`interact` 將其輸出導向到偵錯器的輸出通道 (output channel),而不" +"是 :data:`sys.stderr`。" -#: ../../library/pdb.rst:615 +#: ../../library/pdb.rst:617 msgid "" "Create an alias called *name* that executes *command*. The *command* must " "*not* be enclosed in quotes. Replaceable parameters can be indicated by " @@ -1058,7 +1063,7 @@ msgstr "" "有參數替換。如果省略 *command*,則顯示 *name* 的目前別名。如果未給定引數,則" "列出所有別名。" -#: ../../library/pdb.rst:621 +#: ../../library/pdb.rst:623 msgid "" "Aliases may be nested and can contain anything that can be legally typed at " "the pdb prompt. Note that internal pdb commands *can* be overridden by " @@ -1070,14 +1075,14 @@ msgstr "" "部 pdb 命令\\ *可以*\\ 被別名所覆蓋。這樣的命令在別名被移除前都將被隱藏。別名" "會遞迴地應用到命令列的第一個單詞;該列內的其他單詞則不會受影響。" -#: ../../library/pdb.rst:627 +#: ../../library/pdb.rst:629 msgid "" -"As an example, here are two useful aliases (especially when placed in the :" -"file:`.pdbrc` file)::" +"As an example, here are two useful aliases (especially when placed in " +"the :file:`.pdbrc` file)::" msgstr "" "作為範例,這裡列出了兩個有用的別名(特別是放在 :file:`.pdbrc` 檔案中時): ::" -#: ../../library/pdb.rst:630 +#: ../../library/pdb.rst:632 msgid "" "# Print instance variables (usage \"pi classInst\")\n" "alias pi for k in %1.__dict__.keys(): print(f\"%1.{k} = {%1.__dict__[k]}\")\n" @@ -1089,11 +1094,11 @@ msgstr "" "# 印出 self 中的實例變數\n" "alias ps pi self" -#: ../../library/pdb.rst:637 +#: ../../library/pdb.rst:639 msgid "Delete the specified alias *name*." msgstr "刪除指定的別名 *name*。" -#: ../../library/pdb.rst:641 +#: ../../library/pdb.rst:643 msgid "" "Execute the (one-line) *statement* in the context of the current stack " "frame. The exclamation point can be omitted unless the first word of the " @@ -1102,7 +1107,7 @@ msgstr "" "在當前 stack frame 的情境中執行(單列)\\ *statement*。除非陳述式的第一個單詞" "類似於偵錯器命令,否則可以省略驚嘆號,例如:" -#: ../../library/pdb.rst:645 +#: ../../library/pdb.rst:647 msgid "" "(Pdb) ! n=42\n" "(Pdb)" @@ -1110,15 +1115,15 @@ msgstr "" "(Pdb) ! n=42\n" "(Pdb)" -#: ../../library/pdb.rst:650 +#: ../../library/pdb.rst:652 msgid "" -"To set a global variable, you can prefix the assignment command with a :" -"keyword:`global` statement on the same line, e.g.:" +"To set a global variable, you can prefix the assignment command with " +"a :keyword:`global` statement on the same line, e.g.:" msgstr "" "要設定全域變數,你可以在同一列的賦值命令前面加上 :keyword:`global` 陳述式,例" "如:" -#: ../../library/pdb.rst:653 +#: ../../library/pdb.rst:655 msgid "" "(Pdb) global list_options; list_options = ['-l']\n" "(Pdb)" @@ -1126,22 +1131,22 @@ msgstr "" "(Pdb) global list_options; list_options = ['-l']\n" "(Pdb)" -#: ../../library/pdb.rst:661 +#: ../../library/pdb.rst:663 msgid "" "Restart the debugged Python program. If *args* is supplied, it is split " "with :mod:`shlex` and the result is used as the new :data:`sys.argv`. " -"History, breakpoints, actions and debugger options are preserved. :pdbcmd:" -"`restart` is an alias for :pdbcmd:`run`." +"History, breakpoints, actions and debugger options are " +"preserved. :pdbcmd:`restart` is an alias for :pdbcmd:`run`." msgstr "" "重新啟動已偵錯完畢的 Python 程式。如果提供了 *args*,它將以 :mod:`shlex` 分" "割,並將結果用作新的 :data:`sys.argv`。歷史記錄、斷點、操作和偵錯器選項均會被" "保留。:pdbcmd:`restart` 是 :pdbcmd:`run` 的別名。" -#: ../../library/pdb.rst:668 +#: ../../library/pdb.rst:670 msgid "Quit from the debugger. The program being executed is aborted." msgstr "離開偵錯器,執行中的程式會被中止。" -#: ../../library/pdb.rst:672 +#: ../../library/pdb.rst:674 msgid "" "Enter a recursive debugger that steps through *code* (which is an arbitrary " "expression or statement to be executed in the current environment)." @@ -1149,15 +1154,15 @@ msgstr "" "進入一個遞迴偵錯器,逐步執行 *code*\\ (這是要在當前環境中執行的任意運算式或" "陳述式)。" -#: ../../library/pdb.rst:678 +#: ../../library/pdb.rst:680 msgid "Print the return value for the last return of the current function." msgstr "印出當前函式最後一次回傳的回傳值。" -#: ../../library/pdb.rst:682 +#: ../../library/pdb.rst:684 msgid "List or jump between chained exceptions." msgstr "列出鏈接例外 (chained exceptions),或在其間跳轉。" -#: ../../library/pdb.rst:684 +#: ../../library/pdb.rst:686 msgid "" "When using ``pdb.pm()`` or ``Pdb.post_mortem(...)`` with a chained " "exception instead of a traceback, it allows the user to move between the " @@ -1168,7 +1173,7 @@ msgstr "" "許使用者在鏈接例外之間移動,使用 ``exceptions`` 命令以列出例外,並使用 " "``exception <number>`` 切換到該例外。" -#: ../../library/pdb.rst:692 +#: ../../library/pdb.rst:694 msgid "" "def out():\n" " try:\n" @@ -1204,11 +1209,11 @@ msgstr "" "\n" " out()" -#: ../../library/pdb.rst:709 +#: ../../library/pdb.rst:711 msgid "calling ``pdb.pm()`` will allow to move between exceptions::" msgstr "呼叫 ``pdb.pm()`` 將允許在例外之間移動: ::" -#: ../../library/pdb.rst:711 +#: ../../library/pdb.rst:713 msgid "" "> example.py(5)out()\n" "-> raise ValueError(\"reraise middle() error\") from e\n" @@ -1242,11 +1247,11 @@ msgstr "" "> example.py(10)middle()\n" "-> return inner(0)" -#: ../../library/pdb.rst:730 +#: ../../library/pdb.rst:732 msgid "Footnotes" msgstr "註腳" -#: ../../library/pdb.rst:731 +#: ../../library/pdb.rst:733 msgid "" "Whether a frame is considered to originate in a certain module is determined " "by the ``__name__`` in the frame globals." @@ -1274,18 +1279,18 @@ msgstr "bdb" msgid "cmd" msgstr "cmd" -#: ../../library/pdb.rst:295 +#: ../../library/pdb.rst:297 msgid ".pdbrc" msgstr ".pdbrc" -#: ../../library/pdb.rst:295 +#: ../../library/pdb.rst:297 msgid "file" msgstr "file(檔案)" -#: ../../library/pdb.rst:295 +#: ../../library/pdb.rst:297 msgid "debugger" msgstr "debugger(偵錯器)" -#: ../../library/pdb.rst:295 +#: ../../library/pdb.rst:297 msgid "configuration" msgstr "configuration(設定)" diff --git a/library/plistlib.po b/library/plistlib.po index 282baf27aa..8e0a57dc70 100644 --- a/library/plistlib.po +++ b/library/plistlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: 2016-01-31 07:27+0000\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -119,7 +119,7 @@ msgstr "" msgid "" "When *aware_datetime* is true, fields with type ``datetime.datetime`` will " "be created as :ref:`aware object <datetime-naive-aware>`, with :attr:`!" -"tzinfo` as :attr:`datetime.UTC`." +"tzinfo` as :const:`datetime.UTC`." msgstr "" #: ../../library/plistlib.rst:76 diff --git a/library/site.po b/library/site.po index 89fbfeb209..9108089b60 100644 --- a/library/site.po +++ b/library/site.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -58,7 +58,7 @@ msgid "" "then :file:`lib/site-packages` (on Windows) or :file:`lib/python{X.Y[t]}/" "site-packages` (on Unix and macOS). (The optional suffix \"t\" indicates " "the :term:`free threading` build, and is appended if ``\"t\"`` is present in " -"the :attr:`sys.abiflags` constant.) For each of the distinct head-tail " +"the :data:`sys.abiflags` constant.) For each of the distinct head-tail " "combinations, it sees if it refers to an existing directory, and if so, adds " "it to ``sys.path`` and also inspects the newly added path for configuration " "files." diff --git a/library/socket.po b/library/socket.po index 4b6ff2fe44..67135fe667 100644 --- a/library/socket.po +++ b/library/socket.po @@ -66,10 +66,10 @@ msgstr "由於是呼叫作業系統的 socket API,某些行為可能會因平 #: ../../library/socket.rst:1441 ../../library/socket.rst:1488 #: ../../library/socket.rst:1502 ../../library/socket.rst:1522 #: ../../library/socket.rst:1569 ../../library/socket.rst:1614 -#: ../../library/socket.rst:1744 ../../library/socket.rst:1788 -#: ../../library/socket.rst:1896 ../../library/socket.rst:1914 -#: ../../library/socket.rst:1998 ../../library/socket.rst:2008 -#: ../../library/socket.rst:2020 ../../includes/wasm-notavail.rst:3 +#: ../../library/socket.rst:1739 ../../library/socket.rst:1783 +#: ../../library/socket.rst:1891 ../../library/socket.rst:1909 +#: ../../library/socket.rst:1993 ../../library/socket.rst:2003 +#: ../../library/socket.rst:2015 ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "" @@ -87,8 +87,8 @@ msgid "" "call and library interface for sockets to Python's object-oriented style: " "the :func:`~socket.socket` function returns a :dfn:`socket object` whose " "methods implement the various socket system calls. Parameter types are " -"somewhat higher-level than in the C interface: as with :meth:`read` and :" -"meth:`write` operations on Python files, buffer allocation on receive " +"somewhat higher-level than in the C interface: as with :meth:`read` " +"and :meth:`write` operations on Python files, buffer allocation on receive " "operations is automatic, and buffer length is implicit on send operations." msgstr "" "Python 的介面是將 Unix 的系統呼叫和 socket 函式庫介面直接轉換成 Python 的物件" @@ -148,7 +148,7 @@ msgid "" msgstr "" #: ../../library/socket.rst:66 ../../library/socket.rst:1189 -#: ../../library/socket.rst:1231 ../../library/socket.rst:1992 +#: ../../library/socket.rst:1231 ../../library/socket.rst:1987 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" @@ -164,10 +164,10 @@ msgstr "" msgid "" "For IPv4 addresses, two special forms are accepted instead of a host " "address: ``''`` represents :const:`INADDR_ANY`, which is used to bind to all " -"interfaces, and the string ``'<broadcast>'`` represents :const:" -"`INADDR_BROADCAST`. This behavior is not compatible with IPv6, therefore, " -"you may want to avoid these if you intend to support IPv6 with your Python " -"programs." +"interfaces, and the string ``'<broadcast>'`` " +"represents :const:`INADDR_BROADCAST`. This behavior is not compatible with " +"IPv6, therefore, you may want to avoid these if you intend to support IPv6 " +"with your Python programs." msgstr "" #: ../../library/socket.rst:83 @@ -490,8 +490,8 @@ msgstr "" #: ../../library/socket.rst:272 msgid "" "Non-blocking mode is supported through :meth:`~socket.setblocking`. A " -"generalization of this based on timeouts is supported through :meth:`~socket." -"settimeout`." +"generalization of this based on timeouts is supported " +"through :meth:`~socket.settimeout`." msgstr "" #: ../../library/socket.rst:278 @@ -517,11 +517,12 @@ msgstr "" #: ../../library/socket.rst:296 msgid "" "A subclass of :exc:`OSError`, this exception is raised for address-related " -"errors, i.e. for functions that use *h_errno* in the POSIX C API, including :" -"func:`gethostbyname_ex` and :func:`gethostbyaddr`. The accompanying value is " -"a pair ``(h_errno, string)`` representing an error returned by a library " -"call. *h_errno* is a numeric value, while *string* represents the " -"description of *h_errno*, as returned by the :c:func:`hstrerror` C function." +"errors, i.e. for functions that use *h_errno* in the POSIX C API, " +"including :func:`gethostbyname_ex` and :func:`gethostbyaddr`. The " +"accompanying value is a pair ``(h_errno, string)`` representing an error " +"returned by a library call. *h_errno* is a numeric value, while *string* " +"represents the description of *h_errno*, as returned by " +"the :c:func:`hstrerror` C function." msgstr "" #: ../../library/socket.rst:304 ../../library/socket.rst:317 @@ -546,10 +547,10 @@ msgstr "" #: ../../library/socket.rst:324 msgid "" "A subclass of :exc:`OSError`, this exception is raised when a timeout occurs " -"on a socket which has had timeouts enabled via a prior call to :meth:" -"`~socket.settimeout` (or implicitly through :func:`~socket." -"setdefaulttimeout`). The accompanying value is a string whose value is " -"currently always \"timed out\"." +"on a socket which has had timeouts enabled via a prior call " +"to :meth:`~socket.settimeout` (or implicitly " +"through :func:`~socket.setdefaulttimeout`). The accompanying value is a " +"string whose value is currently always \"timed out\"." msgstr "" #: ../../library/socket.rst:333 @@ -562,8 +563,8 @@ msgstr "常數" #: ../../library/socket.rst:340 msgid "" -"The AF_* and SOCK_* constants are now :class:`AddressFamily` and :class:" -"`SocketKind` :class:`.IntEnum` collections." +"The AF_* and SOCK_* constants are now :class:`AddressFamily` " +"and :class:`SocketKind` :class:`.IntEnum` collections." msgstr "" #: ../../library/socket.rst:349 @@ -583,8 +584,8 @@ msgstr "" #: ../../library/socket.rst:366 msgid "" -"These constants represent the socket types, used for the second argument to :" -"func:`~socket.socket`. More constants may be available depending on the " +"These constants represent the socket types, used for the second argument " +"to :func:`~socket.socket`. More constants may be available depending on the " "system. (Only :const:`SOCK_STREAM` and :const:`SOCK_DGRAM` appear to be " "generally useful.)" msgstr "" @@ -598,18 +599,18 @@ msgstr "" #: ../../library/socket.rst:380 msgid "" -"`Secure File Descriptor Handling <https://udrepper.livejournal.com/20407." -"html>`_ for a more thorough explanation." +"`Secure File Descriptor Handling <https://udrepper.livejournal.com/" +"20407.html>`_ for a more thorough explanation." msgstr "" #: ../../library/socket.rst:404 msgid "" "Many constants of these forms, documented in the Unix documentation on " "sockets and/or the IP protocol, are also defined in the socket module. They " -"are generally used in arguments to the :meth:`~socket.setsockopt` and :meth:" -"`~socket.getsockopt` methods of socket objects. In most cases, only those " -"symbols that are defined in the Unix header files are defined; for a few " -"symbols, default values are provided." +"are generally used in arguments to the :meth:`~socket.setsockopt` " +"and :meth:`~socket.getsockopt` methods of socket objects. In most cases, " +"only those symbols that are defined in the Unix header files are defined; " +"for a few symbols, default values are provided." msgstr "" #: ../../library/socket.rst:411 @@ -799,8 +800,8 @@ msgstr "" #: ../../library/socket.rst:662 msgid "" -"Constant to optimize CPU locality, to be used in conjunction with :data:" -"`SO_REUSEPORT`." +"Constant to optimize CPU locality, to be used in conjunction " +"with :data:`SO_REUSEPORT`." msgstr "" #: ../../library/socket.rst:682 @@ -835,14 +836,14 @@ msgstr "" #: ../../library/socket.rst:722 msgid "" "Create a new socket using the given address family, socket type and protocol " -"number. The address family should be :const:`AF_INET` (the default), :const:" -"`AF_INET6`, :const:`AF_UNIX`, :const:`AF_CAN`, :const:`AF_PACKET`, or :const:" -"`AF_RDS`. The socket type should be :const:`SOCK_STREAM` (the default), :" -"const:`SOCK_DGRAM`, :const:`SOCK_RAW` or perhaps one of the other ``SOCK_`` " -"constants. The protocol number is usually zero and may be omitted or in the " -"case where the address family is :const:`AF_CAN` the protocol should be one " -"of :const:`CAN_RAW`, :const:`CAN_BCM`, :const:`CAN_ISOTP` or :const:" -"`CAN_J1939`." +"number. The address family should be :const:`AF_INET` (the " +"default), :const:`AF_INET6`, :const:`AF_UNIX`, :const:`AF_CAN`, :const:`AF_PACKET`, " +"or :const:`AF_RDS`. The socket type should be :const:`SOCK_STREAM` (the " +"default), :const:`SOCK_DGRAM`, :const:`SOCK_RAW` or perhaps one of the other " +"``SOCK_`` constants. The protocol number is usually zero and may be omitted " +"or in the case where the address family is :const:`AF_CAN` the protocol " +"should be one of :const:`CAN_RAW`, :const:`CAN_BCM`, :const:`CAN_ISOTP` " +"or :const:`CAN_J1939`." msgstr "" #: ../../library/socket.rst:732 @@ -851,9 +852,9 @@ msgid "" "auto-detected from the specified file descriptor. Auto-detection can be " "overruled by calling the function with explicit *family*, *type*, or *proto* " "arguments. This only affects how Python represents e.g. the return value " -"of :meth:`socket.getpeername` but not the actual OS resource. Unlike :func:" -"`socket.fromfd`, *fileno* will return the same socket and not a duplicate. " -"This may help close a detached socket using :meth:`socket.close`." +"of :meth:`socket.getpeername` but not the actual OS resource. " +"Unlike :func:`socket.fromfd`, *fileno* will return the same socket and not a " +"duplicate. This may help close a detached socket using :meth:`socket.close`." msgstr "" #: ../../library/socket.rst:741 ../../library/socket.rst:887 @@ -994,21 +995,21 @@ msgstr "" msgid "" "*family* should be either :data:`AF_INET` or :data:`AF_INET6`. *backlog* is " "the queue size passed to :meth:`socket.listen`; if not specified , a default " -"reasonable value is chosen. *reuse_port* dictates whether to set the :data:" -"`SO_REUSEPORT` socket option." +"reasonable value is chosen. *reuse_port* dictates whether to set " +"the :data:`SO_REUSEPORT` socket option." msgstr "" #: ../../library/socket.rst:841 msgid "" "If *dualstack_ipv6* is true and the platform supports it the socket will be " -"able to accept both IPv4 and IPv6 connections, else it will raise :exc:" -"`ValueError`. Most POSIX platforms and Windows are supposed to support this " -"functionality. When this functionality is enabled the address returned by :" -"meth:`socket.getpeername` when an IPv4 connection occurs will be an IPv6 " -"address represented as an IPv4-mapped IPv6 address. If *dualstack_ipv6* is " -"false it will explicitly disable this functionality on platforms that enable " -"it by default (e.g. Linux). This parameter can be used in conjunction with :" -"func:`has_dualstack_ipv6`:" +"able to accept both IPv4 and IPv6 connections, else it will " +"raise :exc:`ValueError`. Most POSIX platforms and Windows are supposed to " +"support this functionality. When this functionality is enabled the address " +"returned by :meth:`socket.getpeername` when an IPv4 connection occurs will " +"be an IPv6 address represented as an IPv4-mapped IPv6 address. If " +"*dualstack_ipv6* is false it will explicitly disable this functionality on " +"platforms that enable it by default (e.g. Linux). This parameter can be used " +"in conjunction with :func:`has_dualstack_ipv6`:" msgstr "" #: ../../library/socket.rst:854 @@ -1048,12 +1049,12 @@ msgstr "" msgid "" "Duplicate the file descriptor *fd* (an integer as returned by a file " "object's :meth:`~io.IOBase.fileno` method) and build a socket object from " -"the result. Address family, socket type and protocol number are as for the :" -"func:`~socket.socket` function above. The file descriptor should refer to a " -"socket, but this is not checked --- subsequent operations on the object may " -"fail if the file descriptor is invalid. This function is rarely needed, but " -"can be used to get or set socket options on a socket passed to a program as " -"standard input or output (such as a server started by the Unix inet " +"the result. Address family, socket type and protocol number are as for " +"the :func:`~socket.socket` function above. The file descriptor should refer " +"to a socket, but this is not checked --- subsequent operations on the object " +"may fail if the file descriptor is invalid. This function is rarely needed, " +"but can be used to get or set socket options on a socket passed to a program " +"as standard input or output (such as a server started by the Unix inet " "daemon). The socket is assumed to be in blocking mode." msgstr "" @@ -1110,9 +1111,9 @@ msgstr "" #: ../../library/socket.rst:939 msgid "" "The *flags* argument can be one or several of the ``AI_*`` constants, and " -"will influence how results are computed and returned. For example, :const:" -"`AI_NUMERICHOST` will disable domain name resolution and will raise an error " -"if *host* is a domain name." +"will influence how results are computed and returned. For " +"example, :const:`AI_NUMERICHOST` will disable domain name resolution and " +"will raise an error if *host* is a domain name." msgstr "" #: ../../library/socket.rst:944 @@ -1127,12 +1128,13 @@ msgstr "``(family, type, proto, canonname, sockaddr)``" msgid "" "In these tuples, *family*, *type*, *proto* are all integers and are meant to " "be passed to the :func:`~socket.socket` function. *canonname* will be a " -"string representing the canonical name of the *host* if :const:" -"`AI_CANONNAME` is part of the *flags* argument; else *canonname* will be " -"empty. *sockaddr* is a tuple describing a socket address, whose format " -"depends on the returned *family* (a ``(address, port)`` 2-tuple for :const:" -"`AF_INET`, a ``(address, port, flowinfo, scope_id)`` 4-tuple for :const:" -"`AF_INET6`), and is meant to be passed to the :meth:`socket.connect` method." +"string representing the canonical name of the *host* " +"if :const:`AI_CANONNAME` is part of the *flags* argument; else *canonname* " +"will be empty. *sockaddr* is a tuple describing a socket address, whose " +"format depends on the returned *family* (a ``(address, port)`` 2-tuple " +"for :const:`AF_INET`, a ``(address, port, flowinfo, scope_id)`` 4-tuple " +"for :const:`AF_INET6`), and is meant to be passed to " +"the :meth:`socket.connect` method." msgstr "" #: ../../library/socket.rst:960 @@ -1232,8 +1234,8 @@ msgid "" "Raises an :ref:`auditing event <auditing>` ``socket.gethostbyname`` with " "argument ``hostname``." msgstr "" -"引發一個附帶引數 ``hostname`` 的\\ :ref:`稽核事件 <auditing>` ``socket." -"gethostbyname``。" +"引發一個附帶引數 ``hostname`` 的\\ :ref:`稽核事件 <auditing>` " +"``socket.gethostbyname``。" #: ../../library/socket.rst:1028 msgid "" @@ -1273,8 +1275,8 @@ msgid "" "(possibly empty) list of alternative host names for the same address, and " "*ipaddrlist* is a list of IPv4/v6 addresses for the same interface on the " "same host (most likely containing only a single address). To find the fully " -"qualified domain name, use the function :func:`getfqdn`. :func:" -"`gethostbyaddr` supports both IPv4 and IPv6." +"qualified domain name, use the " +"function :func:`getfqdn`. :func:`gethostbyaddr` supports both IPv4 and IPv6." msgstr "" #: ../../library/socket.rst:1065 @@ -1282,8 +1284,8 @@ msgid "" "Raises an :ref:`auditing event <auditing>` ``socket.gethostbyaddr`` with " "argument ``ip_address``." msgstr "" -"引發一個附帶引數 ``ip_address`` 的\\ :ref:`稽核事件 <auditing>` ``socket." -"gethostbyaddr``。" +"引發一個附帶引數 ``ip_address`` 的\\ :ref:`稽核事件 <auditing>` " +"``socket.gethostbyaddr``。" #: ../../library/socket.rst:1072 msgid "" @@ -1309,16 +1311,17 @@ msgid "" "Raises an :ref:`auditing event <auditing>` ``socket.getnameinfo`` with " "argument ``sockaddr``." msgstr "" -"引發一個附帶引數 ``sockaddr`` 的\\ :ref:`稽核事件 <auditing>` ``socket." -"getnameinfo``。" +"引發一個附帶引數 ``sockaddr`` 的\\ :ref:`稽核事件 <auditing>` " +"``socket.getnameinfo``。" #: ../../library/socket.rst:1089 msgid "" "Translate an internet protocol name (for example, ``'icmp'``) to a constant " -"suitable for passing as the (optional) third argument to the :func:`~socket." -"socket` function. This is usually only needed for sockets opened in \"raw\" " -"mode (:const:`SOCK_RAW`); for the normal socket modes, the correct protocol " -"is chosen automatically if the protocol is omitted or zero." +"suitable for passing as the (optional) third argument to " +"the :func:`~socket.socket` function. This is usually only needed for " +"sockets opened in \"raw\" mode (:const:`SOCK_RAW`); for the normal socket " +"modes, the correct protocol is chosen automatically if the protocol is " +"omitted or zero." msgstr "" #: ../../library/socket.rst:1100 @@ -1401,9 +1404,9 @@ msgstr "" #: ../../library/socket.rst:1167 msgid "" -"If the IPv4 address string passed to this function is invalid, :exc:" -"`OSError` will be raised. Note that exactly what is valid depends on the " -"underlying C implementation of :c:func:`inet_aton`." +"If the IPv4 address string passed to this function is " +"invalid, :exc:`OSError` will be raised. Note that exactly what is valid " +"depends on the underlying C implementation of :c:func:`inet_aton`." msgstr "" #: ../../library/socket.rst:1171 @@ -1434,17 +1437,17 @@ msgstr "" msgid "" "Convert an IP address from its family-specific string format to a packed, " "binary format. :func:`inet_pton` is useful when a library or network " -"protocol calls for an object of type :c:struct:`in_addr` (similar to :func:" -"`inet_aton`) or :c:struct:`in6_addr`." +"protocol calls for an object of type :c:struct:`in_addr` (similar " +"to :func:`inet_aton`) or :c:struct:`in6_addr`." msgstr "" #: ../../library/socket.rst:1200 msgid "" -"Supported values for *address_family* are currently :const:`AF_INET` and :" -"const:`AF_INET6`. If the IP address string *ip_string* is invalid, :exc:" -"`OSError` will be raised. Note that exactly what is valid depends on both " -"the value of *address_family* and the underlying implementation of :c:func:" -"`inet_pton`." +"Supported values for *address_family* are currently :const:`AF_INET` " +"and :const:`AF_INET6`. If the IP address string *ip_string* is " +"invalid, :exc:`OSError` will be raised. Note that exactly what is valid " +"depends on both the value of *address_family* and the underlying " +"implementation of :c:func:`inet_pton`." msgstr "" #: ../../library/socket.rst:1208 ../../library/socket.rst:1228 @@ -1462,10 +1465,11 @@ msgstr "" #: ../../library/socket.rst:1221 msgid "" -"Supported values for *address_family* are currently :const:`AF_INET` and :" -"const:`AF_INET6`. If the bytes object *packed_ip* is not the correct length " -"for the specified address family, :exc:`ValueError` will be raised. :exc:" -"`OSError` is raised for errors from the call to :func:`inet_ntop`." +"Supported values for *address_family* are currently :const:`AF_INET` " +"and :const:`AF_INET6`. If the bytes object *packed_ip* is not the correct " +"length for the specified address family, :exc:`ValueError` will be " +"raised. :exc:`OSError` is raised for errors from the call " +"to :func:`inet_ntop`." msgstr "" #: ../../library/socket.rst:1243 @@ -1473,14 +1477,14 @@ msgid "" "Return the total length, without trailing padding, of an ancillary data item " "with associated data of the given *length*. This value can often be used as " "the buffer size for :meth:`~socket.recvmsg` to receive a single item of " -"ancillary data, but :rfc:`3542` requires portable applications to use :func:" -"`CMSG_SPACE` and thus include space for padding, even when the item will be " -"the last in the buffer. Raises :exc:`OverflowError` if *length* is outside " -"the permissible range of values." +"ancillary data, but :rfc:`3542` requires portable applications to " +"use :func:`CMSG_SPACE` and thus include space for padding, even when the " +"item will be the last in the buffer. Raises :exc:`OverflowError` if " +"*length* is outside the permissible range of values." msgstr "" -#: ../../library/socket.rst:1254 ../../library/socket.rst:1746 -#: ../../library/socket.rst:1790 ../../library/socket.rst:1898 +#: ../../library/socket.rst:1254 ../../library/socket.rst:1741 +#: ../../library/socket.rst:1785 ../../library/socket.rst:1893 msgid "Most Unix platforms." msgstr "" @@ -1516,8 +1520,9 @@ msgstr "" #: ../../library/socket.rst:1291 msgid "" "Set the default timeout in seconds (float) for new socket objects. When the " -"socket module is first imported, the default is ``None``. See :meth:" -"`~socket.settimeout` for possible values and their respective meanings." +"socket module is first imported, the default is ``None``. " +"See :meth:`~socket.settimeout` for possible values and their respective " +"meanings." msgstr "" #: ../../library/socket.rst:1299 @@ -1531,8 +1536,8 @@ msgid "" "Raises an :ref:`auditing event <auditing>` ``socket.sethostname`` with " "argument ``name``." msgstr "" -"引發一個附帶引數 ``name`` 的\\ :ref:`稽核事件 <auditing>` ``socket." -"sethostname``。" +"引發一個附帶引數 ``name`` 的\\ :ref:`稽核事件 <auditing>` " +"``socket.sethostname``。" #: ../../library/socket.rst:1311 msgid "" @@ -1575,8 +1580,8 @@ msgstr "" #: ../../library/socket.rst:1338 msgid "" -"Return a network interface index number corresponding to an interface name. :" -"exc:`OSError` if no interface with the given name exists." +"Return a network interface index number corresponding to an interface " +"name. :exc:`OSError` if no interface with the given name exists." msgstr "" #: ../../library/socket.rst:1350 ../../library/socket.rst:1367 @@ -1585,15 +1590,15 @@ msgstr "" #: ../../library/socket.rst:1355 msgid "" -"Return a network interface name corresponding to an interface index number. :" -"exc:`OSError` if no interface with the given index exists." +"Return a network interface name corresponding to an interface index " +"number. :exc:`OSError` if no interface with the given index exists." msgstr "" #: ../../library/socket.rst:1372 msgid "" "Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket " -"*sock*. The *fds* parameter is a sequence of file descriptors. Consult :meth:" -"`~socket.sendmsg` for the documentation of these parameters." +"*sock*. The *fds* parameter is a sequence of file descriptors. " +"Consult :meth:`~socket.sendmsg` for the documentation of these parameters." msgstr "" #: ../../library/socket.rst:1378 ../../library/socket.rst:1392 @@ -1605,8 +1610,8 @@ msgstr "" #: ../../library/socket.rst:1386 msgid "" "Receive up to *maxfds* file descriptors from an :const:`AF_UNIX` socket " -"*sock*. Return ``(msg, list(fds), flags, addr)``. Consult :meth:`~socket." -"recvmsg` for the documentation of these parameters." +"*sock*. Return ``(msg, list(fds), flags, addr)``. " +"Consult :meth:`~socket.recvmsg` for the documentation of these parameters." msgstr "" #: ../../library/socket.rst:1399 @@ -1619,8 +1624,9 @@ msgstr "Socket 物件" #: ../../library/socket.rst:1407 msgid "" -"Socket objects have the following methods. Except for :meth:`~socket." -"makefile`, these correspond to Unix system calls applicable to sockets." +"Socket objects have the following methods. Except " +"for :meth:`~socket.makefile`, these correspond to Unix system calls " +"applicable to sockets." msgstr "" #: ../../library/socket.rst:1411 @@ -1642,14 +1648,14 @@ msgstr "" msgid "The socket is now non-inheritable." msgstr "" -#: ../../library/socket.rst:1428 ../../library/socket.rst:1659 -#: ../../library/socket.rst:1673 ../../library/socket.rst:1750 -#: ../../library/socket.rst:1823 ../../library/socket.rst:1842 -#: ../../library/socket.rst:1859 ../../library/socket.rst:1904 +#: ../../library/socket.rst:1428 ../../library/socket.rst:1654 +#: ../../library/socket.rst:1668 ../../library/socket.rst:1745 +#: ../../library/socket.rst:1818 ../../library/socket.rst:1837 +#: ../../library/socket.rst:1854 ../../library/socket.rst:1899 msgid "" "If the system call is interrupted and the signal handler does not raise an " -"exception, the method now retries the system call instead of raising an :exc:" -"`InterruptedError` exception (see :pep:`475` for the rationale)." +"exception, the method now retries the system call instead of raising " +"an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" #: ../../library/socket.rst:1436 @@ -1684,8 +1690,8 @@ msgstr "" #: ../../library/socket.rst:1456 msgid "" -":exc:`OSError` is now raised if an error occurs when the underlying :c:func:" -"`close` call is made." +":exc:`OSError` is now raised if an error occurs when the " +"underlying :c:func:`close` call is made." msgstr "" #: ../../library/socket.rst:1462 @@ -1706,9 +1712,9 @@ msgid "" "If the connection is interrupted by a signal, the method waits until the " "connection completes, or raise a :exc:`TimeoutError` on timeout, if the " "signal handler doesn't raise an exception and the socket is blocking or has " -"a timeout. For non-blocking sockets, the method raises an :exc:" -"`InterruptedError` exception if the connection is interrupted by a signal " -"(or the exception raised by the signal handler)." +"a timeout. For non-blocking sockets, the method raises " +"an :exc:`InterruptedError` exception if the connection is interrupted by a " +"signal (or the exception raised by the signal handler)." msgstr "" #: ../../library/socket.rst:1480 ../../library/socket.rst:1500 @@ -1721,8 +1727,8 @@ msgstr "" #: ../../library/socket.rst:1482 msgid "" -"The method now waits until the connection completes instead of raising an :" -"exc:`InterruptedError` exception if the connection is interrupted by a " +"The method now waits until the connection completes instead of raising " +"an :exc:`InterruptedError` exception if the connection is interrupted by a " "signal, the signal handler doesn't raise an exception and the socket is " "blocking or has a timeout (see the :pep:`475` for the rationale)." msgstr "" @@ -1785,15 +1791,15 @@ msgstr "" #: ../../library/socket.rst:1560 msgid "" -"Return the value of the given socket option (see the Unix man page :manpage:" -"`getsockopt(2)`). The needed symbolic constants (:ref:`SO_\\* etc. <socket-" -"unix-constants>`) are defined in this module. If *buflen* is absent, an " -"integer option is assumed and its integer value is returned by the " -"function. If *buflen* is present, it specifies the maximum length of the " -"buffer used to receive the option in, and this buffer is returned as a bytes " -"object. It is up to the caller to decode the contents of the buffer (see " -"the optional built-in module :mod:`struct` for a way to decode C structures " -"encoded as byte strings)." +"Return the value of the given socket option (see the Unix man " +"page :manpage:`getsockopt(2)`). The needed symbolic constants (:ref:`SO_\\* " +"etc. <socket-unix-constants>`) are defined in this module. If *buflen* is " +"absent, an integer option is assumed and its integer value is returned by " +"the function. If *buflen* is present, it specifies the maximum length of " +"the buffer used to receive the option in, and this buffer is returned as a " +"bytes object. It is up to the caller to decode the contents of the buffer " +"(see the optional built-in module :mod:`struct` for a way to decode C " +"structures encoded as byte strings)." msgstr "" #: ../../library/socket.rst:1574 @@ -1808,8 +1814,8 @@ msgstr "這等同於檢查 ``socket.gettimeout() != 0``。" #: ../../library/socket.rst:1584 msgid "" "Return the timeout in seconds (float) associated with socket operations, or " -"``None`` if no timeout is set. This reflects the last call to :meth:" -"`setblocking` or :meth:`settimeout`." +"``None`` if no timeout is set. This reflects the last call " +"to :meth:`setblocking` or :meth:`settimeout`." msgstr "" #: ../../library/socket.rst:0 @@ -1823,8 +1829,9 @@ msgstr "Windows" #: ../../library/socket.rst:1593 msgid "" "The :meth:`ioctl` method is a limited interface to the WSAIoctl system " -"interface. Please refer to the `Win32 documentation <https://msdn.microsoft." -"com/en-us/library/ms741621%28VS.85%29.aspx>`_ for more information." +"interface. Please refer to the `Win32 documentation <https://" +"msdn.microsoft.com/en-us/library/ms741621%28VS.85%29.aspx>`_ for more " +"information." msgstr "" #: ../../library/socket.rst:1598 @@ -1870,8 +1877,8 @@ msgstr "" #: ../../library/socket.rst:1635 msgid "" "Closing the file object returned by :meth:`makefile` won't close the " -"original socket unless all other file objects have been closed and :meth:" -"`socket.close` has been called on the socket object." +"original socket unless all other file objects have been closed " +"and :meth:`socket.close` has been called on the socket object." msgstr "" #: ../../library/socket.rst:1641 @@ -1886,18 +1893,12 @@ msgid "" "Receive data from the socket. The return value is a bytes object " "representing the data received. The maximum amount of data to be received " "at once is specified by *bufsize*. A returned empty bytes object indicates " -"that the client has disconnected. See the Unix manual page :manpage:" -"`recv(2)` for the meaning of the optional argument *flags*; it defaults to " -"zero." +"that the client has disconnected. See the Unix manual " +"page :manpage:`recv(2)` for the meaning of the optional argument *flags*; it " +"defaults to zero." msgstr "" -#: ../../library/socket.rst:1656 -msgid "" -"For best match with hardware and network realities, the value of *bufsize* " -"should be a relatively small power of 2, for example, 4096." -msgstr "" - -#: ../../library/socket.rst:1667 +#: ../../library/socket.rst:1662 msgid "" "Receive data from the socket. The return value is a pair ``(bytes, " "address)`` where *bytes* is a bytes object representing the data received " @@ -1907,14 +1908,14 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1678 +#: ../../library/socket.rst:1673 msgid "" "For multicast IPv6 address, first item of *address* does not contain " -"``%scope_id`` part anymore. In order to get full IPv6 address use :func:" -"`getnameinfo`." +"``%scope_id`` part anymore. In order to get full IPv6 address " +"use :func:`getnameinfo`." msgstr "" -#: ../../library/socket.rst:1685 +#: ../../library/socket.rst:1680 msgid "" "Receive normal data (up to *bufsize* bytes) and ancillary data from the " "socket. The *ancbufsize* argument sets the size in bytes of the internal " @@ -1925,7 +1926,7 @@ msgid "" "*flags* argument defaults to 0 and has the same meaning as for :meth:`recv`." msgstr "" -#: ../../library/socket.rst:1695 +#: ../../library/socket.rst:1690 msgid "" "The return value is a 4-tuple: ``(data, ancdata, msg_flags, address)``. The " "*data* item is a :class:`bytes` object holding the non-ancillary data " @@ -1940,38 +1941,39 @@ msgid "" "socket, if available; otherwise, its value is unspecified." msgstr "" -#: ../../library/socket.rst:1709 +#: ../../library/socket.rst:1704 msgid "" "On some systems, :meth:`sendmsg` and :meth:`recvmsg` can be used to pass " "file descriptors between processes over an :const:`AF_UNIX` socket. When " "this facility is used (it is often restricted to :const:`SOCK_STREAM` " "sockets), :meth:`recvmsg` will return, in its ancillary data, items of the " -"form ``(socket.SOL_SOCKET, socket.SCM_RIGHTS, fds)``, where *fds* is a :" -"class:`bytes` object representing the new file descriptors as a binary array " -"of the native C :c:expr:`int` type. If :meth:`recvmsg` raises an exception " -"after the system call returns, it will first attempt to close any file " -"descriptors received via this mechanism." +"form ``(socket.SOL_SOCKET, socket.SCM_RIGHTS, fds)``, where *fds* is " +"a :class:`bytes` object representing the new file descriptors as a binary " +"array of the native C :c:expr:`int` type. If :meth:`recvmsg` raises an " +"exception after the system call returns, it will first attempt to close any " +"file descriptors received via this mechanism." msgstr "" -#: ../../library/socket.rst:1720 +#: ../../library/socket.rst:1715 msgid "" "Some systems do not indicate the truncated length of ancillary data items " "which have been only partially received. If an item appears to extend " -"beyond the end of the buffer, :meth:`recvmsg` will issue a :exc:" -"`RuntimeWarning`, and will return the part of it which is inside the buffer " -"provided it has not been truncated before the start of its associated data." +"beyond the end of the buffer, :meth:`recvmsg` will issue " +"a :exc:`RuntimeWarning`, and will return the part of it which is inside the " +"buffer provided it has not been truncated before the start of its associated " +"data." msgstr "" -#: ../../library/socket.rst:1727 +#: ../../library/socket.rst:1722 msgid "" "On systems which support the :const:`SCM_RIGHTS` mechanism, the following " "function will receive up to *maxfds* file descriptors, returning the message " "data and a list containing the descriptors (while ignoring unexpected " -"conditions such as unrelated control messages being received). See also :" -"meth:`sendmsg`. ::" +"conditions such as unrelated control messages being received). See " +"also :meth:`sendmsg`. ::" msgstr "" -#: ../../library/socket.rst:1733 +#: ../../library/socket.rst:1728 msgid "" "import socket, array\n" "\n" @@ -1980,28 +1982,29 @@ msgid "" " msg, ancdata, flags, addr = sock.recvmsg(msglen, socket.CMSG_LEN(maxfds " "* fds.itemsize))\n" " for cmsg_level, cmsg_type, cmsg_data in ancdata:\n" -" if cmsg_level == socket.SOL_SOCKET and cmsg_type == socket." -"SCM_RIGHTS:\n" +" if cmsg_level == socket.SOL_SOCKET and cmsg_type == " +"socket.SCM_RIGHTS:\n" " # Append data, ignoring any truncated integers at the end.\n" -" fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % fds." -"itemsize)])\n" +" fds.frombytes(cmsg_data[:len(cmsg_data) - (len(cmsg_data) % " +"fds.itemsize)])\n" " return msg, list(fds)" msgstr "" -#: ../../library/socket.rst:1758 +#: ../../library/socket.rst:1753 msgid "" -"Receive normal data and ancillary data from the socket, behaving as :meth:" -"`recvmsg` would, but scatter the non-ancillary data into a series of buffers " -"instead of returning a new bytes object. The *buffers* argument must be an " -"iterable of objects that export writable buffers (e.g. :class:`bytearray` " -"objects); these will be filled with successive chunks of the non-ancillary " -"data until it has all been written or there are no more buffers. The " -"operating system may set a limit (:func:`~os.sysconf` value ``SC_IOV_MAX``) " -"on the number of buffers that can be used. The *ancbufsize* and *flags* " -"arguments have the same meaning as for :meth:`recvmsg`." +"Receive normal data and ancillary data from the socket, behaving " +"as :meth:`recvmsg` would, but scatter the non-ancillary data into a series " +"of buffers instead of returning a new bytes object. The *buffers* argument " +"must be an iterable of objects that export writable buffers " +"(e.g. :class:`bytearray` objects); these will be filled with successive " +"chunks of the non-ancillary data until it has all been written or there are " +"no more buffers. The operating system may set a limit (:func:`~os.sysconf` " +"value ``SC_IOV_MAX``) on the number of buffers that can be used. The " +"*ancbufsize* and *flags* arguments have the same meaning as " +"for :meth:`recvmsg`." msgstr "" -#: ../../library/socket.rst:1769 +#: ../../library/socket.rst:1764 msgid "" "The return value is a 4-tuple: ``(nbytes, ancdata, msg_flags, address)``, " "where *nbytes* is the total number of bytes of non-ancillary data written " @@ -2009,11 +2012,11 @@ msgid "" "for :meth:`recvmsg`." msgstr "" -#: ../../library/socket.rst:1774 +#: ../../library/socket.rst:1769 msgid "Example::" msgstr "範例: ::" -#: ../../library/socket.rst:1776 +#: ../../library/socket.rst:1771 msgid "" ">>> import socket\n" ">>> s1, s2 = socket.socketpair()\n" @@ -2039,7 +2042,7 @@ msgstr "" ">>> [b1, b2, b3]\n" "[bytearray(b'Mary'), bytearray(b'01 had a 9'), bytearray(b'little lamb---')]" -#: ../../library/socket.rst:1797 +#: ../../library/socket.rst:1792 msgid "" "Receive data from the socket, writing it into *buffer* instead of creating a " "new bytestring. The return value is a pair ``(nbytes, address)`` where " @@ -2049,7 +2052,7 @@ msgid "" "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1807 +#: ../../library/socket.rst:1802 msgid "" "Receive up to *nbytes* bytes from the socket, storing the data into a buffer " "rather than creating a new bytestring. If *nbytes* is not specified (or 0), " @@ -2058,7 +2061,7 @@ msgid "" "of the optional argument *flags*; it defaults to zero." msgstr "" -#: ../../library/socket.rst:1816 +#: ../../library/socket.rst:1811 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -2068,7 +2071,7 @@ msgid "" "data. For further information on this topic, consult the :ref:`socket-howto`." msgstr "" -#: ../../library/socket.rst:1831 +#: ../../library/socket.rst:1826 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -2078,13 +2081,13 @@ msgid "" "to determine how much data, if any, was successfully sent." msgstr "" -#: ../../library/socket.rst:1838 +#: ../../library/socket.rst:1833 msgid "" "The socket timeout is no longer reset each time data is sent successfully. " "The socket timeout is now the maximum total duration to send all data." msgstr "" -#: ../../library/socket.rst:1851 +#: ../../library/socket.rst:1846 msgid "" "Send data to the socket. The socket should not be connected to a remote " "socket, since the destination socket is specified by *address*. The " @@ -2093,7 +2096,7 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1857 +#: ../../library/socket.rst:1852 msgid "" "Raises an :ref:`auditing event <auditing>` ``socket.sendto`` with arguments " "``self``, ``address``." @@ -2101,13 +2104,13 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 <auditing>` " "``socket.sendto``。" -#: ../../library/socket.rst:1867 +#: ../../library/socket.rst:1862 msgid "" "Send normal and ancillary data to the socket, gathering the non-ancillary " "data from a series of buffers and concatenating it into a single message. " -"The *buffers* argument specifies the non-ancillary data as an iterable of :" -"term:`bytes-like objects <bytes-like object>` (e.g. :class:`bytes` objects); " -"the operating system may set a limit (:func:`~os.sysconf` value " +"The *buffers* argument specifies the non-ancillary data as an iterable " +"of :term:`bytes-like objects <bytes-like object>` (e.g. :class:`bytes` " +"objects); the operating system may set a limit (:func:`~os.sysconf` value " "``SC_IOV_MAX``) on the number of buffers that can be used. The *ancdata* " "argument specifies the ancillary data (control messages) as an iterable of " "zero or more tuples ``(cmsg_level, cmsg_type, cmsg_data)``, where " @@ -2121,28 +2124,28 @@ msgid "" "bytes of non-ancillary data sent." msgstr "" -#: ../../library/socket.rst:1887 +#: ../../library/socket.rst:1882 msgid "" -"The following function sends the list of file descriptors *fds* over an :" -"const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` " +"The following function sends the list of file descriptors *fds* over " +"an :const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` " "mechanism. See also :meth:`recvmsg`. ::" msgstr "" -#: ../../library/socket.rst:1891 +#: ../../library/socket.rst:1886 msgid "" "import socket, array\n" "\n" "def send_fds(sock, msg, fds):\n" -" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array." -"array(\"i\", fds))])" +" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, " +"array.array(\"i\", fds))])" msgstr "" "import socket, array\n" "\n" "def send_fds(sock, msg, fds):\n" -" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array." -"array(\"i\", fds))])" +" return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, " +"array.array(\"i\", fds))])" -#: ../../library/socket.rst:1900 +#: ../../library/socket.rst:1895 msgid "" "Raises an :ref:`auditing event <auditing>` ``socket.sendmsg`` with arguments " "``self``, ``address``." @@ -2150,158 +2153,161 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 <auditing>` " "``socket.sendmsg``。" -#: ../../library/socket.rst:1911 +#: ../../library/socket.rst:1906 msgid "" "Specialized version of :meth:`~socket.sendmsg` for :const:`AF_ALG` socket. " "Set mode, IV, AEAD associated data length and flags for :const:`AF_ALG` " "socket." msgstr "" -#: ../../library/socket.rst:1920 +#: ../../library/socket.rst:1915 msgid "" -"Send a file until EOF is reached by using high-performance :mod:`os." -"sendfile` and return the total number of bytes which were sent. *file* must " -"be a regular file object opened in binary mode. If :mod:`os.sendfile` is not " -"available (e.g. Windows) or *file* is not a regular file :meth:`send` will " -"be used instead. *offset* tells from where to start reading the file. If " -"specified, *count* is the total number of bytes to transmit as opposed to " -"sending the file until EOF is reached. File position is updated on return or " -"also in case of error in which case :meth:`file.tell() <io.IOBase.tell>` can " -"be used to figure out the number of bytes which were sent. The socket must " -"be of :const:`SOCK_STREAM` type. Non-blocking sockets are not supported." +"Send a file until EOF is reached by using high-" +"performance :mod:`os.sendfile` and return the total number of bytes which " +"were sent. *file* must be a regular file object opened in binary mode. " +"If :mod:`os.sendfile` is not available (e.g. Windows) or *file* is not a " +"regular file :meth:`send` will be used instead. *offset* tells from where to " +"start reading the file. If specified, *count* is the total number of bytes " +"to transmit as opposed to sending the file until EOF is reached. File " +"position is updated on return or also in case of error in which " +"case :meth:`file.tell() <io.IOBase.tell>` can be used to figure out the " +"number of bytes which were sent. The socket must be of :const:`SOCK_STREAM` " +"type. Non-blocking sockets are not supported." msgstr "" -#: ../../library/socket.rst:1936 +#: ../../library/socket.rst:1931 msgid "" "Set the :ref:`inheritable flag <fd_inheritance>` of the socket's file " "descriptor or socket's handle." msgstr "" -#: ../../library/socket.rst:1944 +#: ../../library/socket.rst:1939 msgid "" "Set blocking or non-blocking mode of the socket: if *flag* is false, the " "socket is set to non-blocking, else to blocking mode." msgstr "" -#: ../../library/socket.rst:1947 +#: ../../library/socket.rst:1942 msgid "" "This method is a shorthand for certain :meth:`~socket.settimeout` calls:" msgstr "" -#: ../../library/socket.rst:1949 +#: ../../library/socket.rst:1944 msgid "``sock.setblocking(True)`` is equivalent to ``sock.settimeout(None)``" msgstr "``sock.setblocking(True)`` 等價於 ``sock.settimeout(None)``" -#: ../../library/socket.rst:1951 +#: ../../library/socket.rst:1946 msgid "``sock.setblocking(False)`` is equivalent to ``sock.settimeout(0.0)``" msgstr "``sock.setblocking(False)`` 等價於 ``sock.settimeout(0.0)``" -#: ../../library/socket.rst:1953 +#: ../../library/socket.rst:1948 msgid "" -"The method no longer applies :const:`SOCK_NONBLOCK` flag on :attr:`socket." -"type`." +"The method no longer applies :const:`SOCK_NONBLOCK` flag " +"on :attr:`socket.type`." msgstr "" -#: ../../library/socket.rst:1960 +#: ../../library/socket.rst:1955 msgid "" "Set a timeout on blocking socket operations. The *value* argument can be a " "nonnegative floating-point number expressing seconds, or ``None``. If a non-" -"zero value is given, subsequent socket operations will raise a :exc:" -"`timeout` exception if the timeout period *value* has elapsed before the " -"operation has completed. If zero is given, the socket is put in non-" +"zero value is given, subsequent socket operations will raise " +"a :exc:`timeout` exception if the timeout period *value* has elapsed before " +"the operation has completed. If zero is given, the socket is put in non-" "blocking mode. If ``None`` is given, the socket is put in blocking mode." msgstr "" -#: ../../library/socket.rst:1967 +#: ../../library/socket.rst:1962 msgid "" "For further information, please consult the :ref:`notes on socket timeouts " "<socket-timeouts>`." msgstr "" -#: ../../library/socket.rst:1969 +#: ../../library/socket.rst:1964 msgid "" -"The method no longer toggles :const:`SOCK_NONBLOCK` flag on :attr:`socket." -"type`." +"The method no longer toggles :const:`SOCK_NONBLOCK` flag " +"on :attr:`socket.type`." msgstr "" -#: ../../library/socket.rst:1982 +#: ../../library/socket.rst:1977 msgid "" -"Set the value of the given socket option (see the Unix manual page :manpage:" -"`setsockopt(2)`). The needed symbolic constants are defined in this module " -"(:ref:`!SO_\\* etc. <socket-unix-constants>`). The value can be an integer, " -"``None`` or a :term:`bytes-like object` representing a buffer. In the later " -"case it is up to the caller to ensure that the bytestring contains the " -"proper bits (see the optional built-in module :mod:`struct` for a way to " -"encode C structures as bytestrings). When *value* is set to ``None``, " -"*optlen* argument is required. It's equivalent to call :c:func:`setsockopt` " -"C function with ``optval=NULL`` and ``optlen=optlen``." +"Set the value of the given socket option (see the Unix manual " +"page :manpage:`setsockopt(2)`). The needed symbolic constants are defined " +"in this module (:ref:`!SO_\\* etc. <socket-unix-constants>`). The value can " +"be an integer, ``None`` or a :term:`bytes-like object` representing a " +"buffer. In the later case it is up to the caller to ensure that the " +"bytestring contains the proper bits (see the optional built-in " +"module :mod:`struct` for a way to encode C structures as bytestrings). When " +"*value* is set to ``None``, *optlen* argument is required. It's equivalent " +"to call :c:func:`setsockopt` C function with ``optval=NULL`` and " +"``optlen=optlen``." msgstr "" -#: ../../library/socket.rst:1995 +#: ../../library/socket.rst:1990 msgid "setsockopt(level, optname, None, optlen: int) form added." msgstr "" -#: ../../library/socket.rst:2003 +#: ../../library/socket.rst:1998 msgid "" -"Shut down one or both halves of the connection. If *how* is :const:" -"`SHUT_RD`, further receives are disallowed. If *how* is :const:`SHUT_WR`, " -"further sends are disallowed. If *how* is :const:`SHUT_RDWR`, further sends " -"and receives are disallowed." +"Shut down one or both halves of the connection. If *how* " +"is :const:`SHUT_RD`, further receives are disallowed. If *how* " +"is :const:`SHUT_WR`, further sends are disallowed. If *how* " +"is :const:`SHUT_RDWR`, further sends and receives are disallowed." msgstr "" -#: ../../library/socket.rst:2013 +#: ../../library/socket.rst:2008 msgid "" "Duplicate a socket and prepare it for sharing with a target process. The " "target process must be provided with *process_id*. The resulting bytes " "object can then be passed to the target process using some form of " -"interprocess communication and the socket can be recreated there using :func:" -"`fromshare`. Once this method has been called, it is safe to close the " -"socket since the operating system has already duplicated it for the target " -"process." +"interprocess communication and the socket can be recreated there " +"using :func:`fromshare`. Once this method has been called, it is safe to " +"close the socket since the operating system has already duplicated it for " +"the target process." msgstr "" -#: ../../library/socket.rst:2025 +#: ../../library/socket.rst:2020 msgid "" -"Note that there are no methods :meth:`read` or :meth:`write`; use :meth:" -"`~socket.recv` and :meth:`~socket.send` without *flags* argument instead." +"Note that there are no methods :meth:`read` or :meth:`write`; " +"use :meth:`~socket.recv` and :meth:`~socket.send` without *flags* argument " +"instead." msgstr "" -#: ../../library/socket.rst:2028 +#: ../../library/socket.rst:2023 msgid "" "Socket objects also have these (read-only) attributes that correspond to the " "values given to the :class:`~socket.socket` constructor." msgstr "" -#: ../../library/socket.rst:2034 +#: ../../library/socket.rst:2029 msgid "The socket family." msgstr "" -#: ../../library/socket.rst:2039 +#: ../../library/socket.rst:2034 msgid "The socket type." msgstr "" -#: ../../library/socket.rst:2044 +#: ../../library/socket.rst:2039 msgid "The socket protocol." msgstr "" -#: ../../library/socket.rst:2051 +#: ../../library/socket.rst:2046 msgid "Notes on socket timeouts" msgstr "" -#: ../../library/socket.rst:2053 +#: ../../library/socket.rst:2048 msgid "" "A socket object can be in one of three modes: blocking, non-blocking, or " "timeout. Sockets are by default always created in blocking mode, but this " "can be changed by calling :func:`setdefaulttimeout`." msgstr "" -#: ../../library/socket.rst:2057 +#: ../../library/socket.rst:2052 msgid "" "In *blocking mode*, operations block until complete or the system returns an " "error (such as connection timed out)." msgstr "" -#: ../../library/socket.rst:2060 +#: ../../library/socket.rst:2055 msgid "" "In *non-blocking mode*, operations fail (with an error that is unfortunately " "system-dependent) if they cannot be completed immediately: functions from " @@ -2309,14 +2315,14 @@ msgid "" "available for reading or writing." msgstr "" -#: ../../library/socket.rst:2065 +#: ../../library/socket.rst:2060 msgid "" "In *timeout mode*, operations fail if they cannot be completed within the " "timeout specified for the socket (they raise a :exc:`timeout` exception) or " "if the system returns an error." msgstr "" -#: ../../library/socket.rst:2070 +#: ../../library/socket.rst:2065 msgid "" "At the operating system level, sockets in *timeout mode* are internally set " "in non-blocking mode. Also, the blocking and timeout modes are shared " @@ -2325,38 +2331,38 @@ msgid "" "you decide to use the :meth:`~socket.fileno` of a socket." msgstr "" -#: ../../library/socket.rst:2077 +#: ../../library/socket.rst:2072 msgid "Timeouts and the ``connect`` method" msgstr "" -#: ../../library/socket.rst:2079 +#: ../../library/socket.rst:2074 msgid "" "The :meth:`~socket.connect` operation is also subject to the timeout " "setting, and in general it is recommended to call :meth:`~socket.settimeout` " -"before calling :meth:`~socket.connect` or pass a timeout parameter to :meth:" -"`create_connection`. However, the system network stack may also return a " -"connection timeout error of its own regardless of any Python socket timeout " -"setting." +"before calling :meth:`~socket.connect` or pass a timeout parameter " +"to :meth:`create_connection`. However, the system network stack may also " +"return a connection timeout error of its own regardless of any Python socket " +"timeout setting." msgstr "" -#: ../../library/socket.rst:2087 +#: ../../library/socket.rst:2082 msgid "Timeouts and the ``accept`` method" msgstr "" -#: ../../library/socket.rst:2089 +#: ../../library/socket.rst:2084 msgid "" -"If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by the :" -"meth:`~socket.accept` method inherit that timeout. Otherwise, the behaviour " -"depends on settings of the listening socket:" +"If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by " +"the :meth:`~socket.accept` method inherit that timeout. Otherwise, the " +"behaviour depends on settings of the listening socket:" msgstr "" -#: ../../library/socket.rst:2093 +#: ../../library/socket.rst:2088 msgid "" "if the listening socket is in *blocking mode* or in *timeout mode*, the " "socket returned by :meth:`~socket.accept` is in *blocking mode*;" msgstr "" -#: ../../library/socket.rst:2096 +#: ../../library/socket.rst:2091 msgid "" "if the listening socket is in *non-blocking mode*, whether the socket " "returned by :meth:`~socket.accept` is in blocking or non-blocking mode is " @@ -2364,28 +2370,29 @@ msgid "" "it is recommended you manually override this setting." msgstr "" -#: ../../library/socket.rst:2105 +#: ../../library/socket.rst:2100 msgid "Example" msgstr "範例" -#: ../../library/socket.rst:2107 +#: ../../library/socket.rst:2102 msgid "" "Here are four minimal example programs using the TCP/IP protocol: a server " "that echoes all data that it receives back (servicing only one client), and " -"a client using it. Note that a server must perform the sequence :func:" -"`~socket.socket`, :meth:`~socket.bind`, :meth:`~socket.listen`, :meth:" -"`~socket.accept` (possibly repeating the :meth:`~socket.accept` to service " -"more than one client), while a client only needs the sequence :func:`~socket." -"socket`, :meth:`~socket.connect`. Also note that the server does not :meth:" -"`~socket.sendall`/:meth:`~socket.recv` on the socket it is listening on but " -"on the new socket returned by :meth:`~socket.accept`." +"a client using it. Note that a server must perform the " +"sequence :func:`~socket.socket`, :meth:`~socket.bind`, :meth:`~socket.listen`, :meth:`~socket.accept` " +"(possibly repeating the :meth:`~socket.accept` to service more than one " +"client), while a client only needs the " +"sequence :func:`~socket.socket`, :meth:`~socket.connect`. Also note that " +"the server does not :meth:`~socket.sendall`/:meth:`~socket.recv` on the " +"socket it is listening on but on the new socket returned " +"by :meth:`~socket.accept`." msgstr "" -#: ../../library/socket.rst:2117 +#: ../../library/socket.rst:2112 msgid "The first two examples support IPv4 only. ::" msgstr "前兩個範例只支援 IPv4: ::" -#: ../../library/socket.rst:2119 +#: ../../library/socket.rst:2114 msgid "" "# Echo server program\n" "import socket\n" @@ -2404,7 +2411,7 @@ msgid "" " conn.sendall(data)" msgstr "" -#: ../../library/socket.rst:2137 +#: ../../library/socket.rst:2132 msgid "" "# Echo client program\n" "import socket\n" @@ -2418,7 +2425,7 @@ msgid "" "print('Received', repr(data))" msgstr "" -#: ../../library/socket.rst:2148 +#: ../../library/socket.rst:2143 msgid "" "The next two examples are identical to the above two, but support both IPv4 " "and IPv6. The server side will listen to the first address family available " @@ -2428,7 +2435,7 @@ msgid "" "resolution, and sends traffic to the first one connected successfully. ::" msgstr "" -#: ../../library/socket.rst:2155 +#: ../../library/socket.rst:2150 msgid "" "# Echo server program\n" "import socket\n" @@ -2465,7 +2472,7 @@ msgid "" " conn.send(data)" msgstr "" -#: ../../library/socket.rst:2191 +#: ../../library/socket.rst:2186 msgid "" "# Echo client program\n" "import socket\n" @@ -2474,8 +2481,8 @@ msgid "" "HOST = 'daring.cwi.nl' # The remote host\n" "PORT = 50007 # The same port as used by the server\n" "s = None\n" -"for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket." -"SOCK_STREAM):\n" +"for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, " +"socket.SOCK_STREAM):\n" " af, socktype, proto, canonname, sa = res\n" " try:\n" " s = socket.socket(af, socktype, proto)\n" @@ -2498,14 +2505,14 @@ msgid "" "print('Received', repr(data))" msgstr "" -#: ../../library/socket.rst:2220 +#: ../../library/socket.rst:2215 msgid "" "The next example shows how to write a very simple network sniffer with raw " "sockets on Windows. The example requires administrator privileges to modify " "the interface::" msgstr "" -#: ../../library/socket.rst:2224 +#: ../../library/socket.rst:2219 msgid "" "import socket\n" "\n" @@ -2529,29 +2536,29 @@ msgid "" "s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)" msgstr "" -#: ../../library/socket.rst:2245 +#: ../../library/socket.rst:2240 msgid "" "The next example shows how to use the socket interface to communicate to a " "CAN network using the raw socket protocol. To use CAN with the broadcast " "manager protocol instead, open a socket with::" msgstr "" -#: ../../library/socket.rst:2249 +#: ../../library/socket.rst:2244 msgid "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" msgstr "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" -#: ../../library/socket.rst:2251 +#: ../../library/socket.rst:2246 msgid "" "After binding (:const:`CAN_RAW`) or connecting (:const:`CAN_BCM`) the " "socket, you can use the :meth:`socket.send` and :meth:`socket.recv` " "operations (and their counterparts) on the socket object as usual." msgstr "" -#: ../../library/socket.rst:2255 +#: ../../library/socket.rst:2250 msgid "This last example might require special privileges::" msgstr "" -#: ../../library/socket.rst:2257 +#: ../../library/socket.rst:2252 msgid "" "import socket\n" "import struct\n" @@ -2593,29 +2600,29 @@ msgid "" " print('Error sending CAN frame')" msgstr "" -#: ../../library/socket.rst:2295 +#: ../../library/socket.rst:2290 msgid "" "Running an example several times with too small delay between executions, " "could lead to this error::" msgstr "" -#: ../../library/socket.rst:2298 +#: ../../library/socket.rst:2293 msgid "OSError: [Errno 98] Address already in use" msgstr "OSError: [Errno 98] Address already in use" -#: ../../library/socket.rst:2300 +#: ../../library/socket.rst:2295 msgid "" "This is because the previous execution has left the socket in a " "``TIME_WAIT`` state, and can't be immediately reused." msgstr "" -#: ../../library/socket.rst:2303 +#: ../../library/socket.rst:2298 msgid "" -"There is a :mod:`socket` flag to set, in order to prevent this, :const:" -"`socket.SO_REUSEADDR`::" +"There is a :mod:`socket` flag to set, in order to prevent " +"this, :const:`socket.SO_REUSEADDR`::" msgstr "" -#: ../../library/socket.rst:2306 +#: ../../library/socket.rst:2301 msgid "" "s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" @@ -2625,30 +2632,30 @@ msgstr "" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" "s.bind((HOST, PORT))" -#: ../../library/socket.rst:2310 +#: ../../library/socket.rst:2305 msgid "" "the :data:`SO_REUSEADDR` flag tells the kernel to reuse a local socket in " "``TIME_WAIT`` state, without waiting for its natural timeout to expire." msgstr "" -#: ../../library/socket.rst:2316 +#: ../../library/socket.rst:2311 msgid "" "For an introduction to socket programming (in C), see the following papers:" msgstr "" -#: ../../library/socket.rst:2318 +#: ../../library/socket.rst:2313 msgid "" "*An Introductory 4.3BSD Interprocess Communication Tutorial*, by Stuart " "Sechrest" msgstr "" -#: ../../library/socket.rst:2320 +#: ../../library/socket.rst:2315 msgid "" "*An Advanced 4.3BSD Interprocess Communication Tutorial*, by Samuel J. " "Leffler et al," msgstr "" -#: ../../library/socket.rst:2323 +#: ../../library/socket.rst:2318 msgid "" "both in the UNIX Programmer's Manual, Supplementary Documents 1 (sections " "PS1:7 and PS1:8). The platform-specific reference material for the various " @@ -2675,10 +2682,10 @@ msgstr "I/O control(I/O 控制)" msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/socket.rst:1980 +#: ../../library/socket.rst:1975 msgid "module" msgstr "module(模組)" -#: ../../library/socket.rst:1980 +#: ../../library/socket.rst:1975 msgid "struct" msgstr "struct" diff --git a/library/socketserver.po b/library/socketserver.po index 4373fe8002..d87251dc5d 100644 --- a/library/socketserver.po +++ b/library/socketserver.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-07 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -90,9 +90,9 @@ msgid "" "classes, passing it the server's address and the request handler class. It " "is recommended to use the server in a :keyword:`with` statement. Then call " "the :meth:`~BaseServer.handle_request` or :meth:`~BaseServer.serve_forever` " -"method of the server object to process one or many requests. Finally, call :" -"meth:`~BaseServer.server_close` to close the socket (unless you used a :" -"keyword:`!with` statement)." +"method of the server object to process one or many requests. Finally, " +"call :meth:`~BaseServer.server_close` to close the socket (unless you used " +"a :keyword:`!with` statement)." msgstr "" #: ../../library/socketserver.rst:64 @@ -103,8 +103,8 @@ msgid "" "attribute *daemon_threads*, which indicates whether or not the server should " "wait for thread termination. You should set the flag explicitly if you " "would like threads to behave autonomously; the default is :const:`False`, " -"meaning that Python will not exit until all threads created by :class:" -"`ThreadingMixIn` have exited." +"meaning that Python will not exit until all threads created " +"by :class:`ThreadingMixIn` have exited." msgstr "" #: ../../library/socketserver.rst:73 @@ -177,9 +177,9 @@ msgstr "" #: ../../library/socketserver.rst:112 msgid "" -"The mix-in class comes first, since it overrides a method defined in :class:" -"`UDPServer`. Setting the various attributes also changes the behavior of " -"the underlying server mechanism." +"The mix-in class comes first, since it overrides a method defined " +"in :class:`UDPServer`. Setting the various attributes also changes the " +"behavior of the underlying server mechanism." msgstr "" #: ../../library/socketserver.rst:116 @@ -204,18 +204,18 @@ msgstr "" #: ../../library/socketserver.rst:131 msgid "" -"For :class:`ThreadingMixIn` use daemonic threads by setting :data:" -"`ThreadingMixIn.daemon_threads <daemon_threads>` to ``True`` to not wait " -"until threads complete." +"For :class:`ThreadingMixIn` use daemonic threads by " +"setting :data:`ThreadingMixIn.daemon_threads <daemon_threads>` to ``True`` " +"to not wait until threads complete." msgstr "" #: ../../library/socketserver.rst:137 msgid "" -":meth:`ForkingMixIn.server_close <BaseServer.server_close>` and :meth:" -"`ThreadingMixIn.server_close <BaseServer.server_close>` now waits until all " -"child processes and non-daemonic threads complete. Add a new :attr:" -"`ForkingMixIn.block_on_close <block_on_close>` class attribute to opt-in for " -"the pre-3.7 behaviour." +":meth:`ForkingMixIn.server_close <BaseServer.server_close>` " +"and :meth:`ThreadingMixIn.server_close <BaseServer.server_close>` now waits " +"until all child processes and non-daemonic threads complete. Add a " +"new :attr:`ForkingMixIn.block_on_close <block_on_close>` class attribute to " +"opt-in for the pre-3.7 behaviour." msgstr "" #: ../../library/socketserver.rst:153 @@ -230,13 +230,13 @@ msgstr "" #: ../../library/socketserver.rst:159 msgid "" -"To implement a service, you must derive a class from :class:" -"`BaseRequestHandler` and redefine its :meth:`~BaseRequestHandler.handle` " -"method. You can then run various versions of the service by combining one of " -"the server classes with your request handler class. The request handler " -"class must be different for datagram or stream services. This can be hidden " -"by using the handler subclasses :class:`StreamRequestHandler` or :class:" -"`DatagramRequestHandler`." +"To implement a service, you must derive a class " +"from :class:`BaseRequestHandler` and redefine " +"its :meth:`~BaseRequestHandler.handle` method. You can then run various " +"versions of the service by combining one of the server classes with your " +"request handler class. The request handler class must be different for " +"datagram or stream services. This can be hidden by using the handler " +"subclasses :class:`StreamRequestHandler` or :class:`DatagramRequestHandler`." msgstr "" #: ../../library/socketserver.rst:167 @@ -264,8 +264,8 @@ msgid "" "In some cases, it may be appropriate to process part of a request " "synchronously, but to finish processing in a forked child depending on the " "request data. This can be implemented by using a synchronous server and " -"doing an explicit fork in the request handler class :meth:" -"`~BaseRequestHandler.handle` method." +"doing an explicit fork in the request handler " +"class :meth:`~BaseRequestHandler.handle` method." msgstr "" #: ../../library/socketserver.rst:185 @@ -288,8 +288,8 @@ msgstr "" msgid "" "This is the superclass of all Server objects in the module. It defines the " "interface, given below, but does not implement most of the methods, which is " -"done in subclasses. The two parameters are stored in the respective :attr:" -"`server_address` and :attr:`RequestHandlerClass` attributes." +"done in subclasses. The two parameters are stored in the " +"respective :attr:`server_address` and :attr:`RequestHandlerClass` attributes." msgstr "" #: ../../library/socketserver.rst:210 @@ -302,12 +302,13 @@ msgstr "" #: ../../library/socketserver.rst:217 msgid "" "Process a single request. This function calls the following methods in " -"order: :meth:`get_request`, :meth:`verify_request`, and :meth:" -"`process_request`. If the user-provided :meth:`~BaseRequestHandler.handle` " -"method of the handler class raises an exception, the server's :meth:" -"`handle_error` method will be called. If no request is received within :" -"attr:`timeout` seconds, :meth:`handle_timeout` will be called and :meth:" -"`handle_request` will return." +"order: :meth:`get_request`, :meth:`verify_request`, " +"and :meth:`process_request`. If the user-" +"provided :meth:`~BaseRequestHandler.handle` method of the handler class " +"raises an exception, the server's :meth:`handle_error` method will be " +"called. If no request is received within :attr:`timeout` " +"seconds, :meth:`handle_timeout` will be called and :meth:`handle_request` " +"will return." msgstr "" #: ../../library/socketserver.rst:229 @@ -333,9 +334,9 @@ msgstr "" #: ../../library/socketserver.rst:251 msgid "" -"Tell the :meth:`serve_forever` loop to stop and wait until it does. :meth:" -"`shutdown` must be called while :meth:`serve_forever` is running in a " -"different thread otherwise it will deadlock." +"Tell the :meth:`serve_forever` loop to stop and wait until it " +"does. :meth:`shutdown` must be called while :meth:`serve_forever` is running " +"in a different thread otherwise it will deadlock." msgstr "" #: ../../library/socketserver.rst:258 @@ -357,9 +358,9 @@ msgstr "" #: ../../library/socketserver.rst:275 msgid "" "The address on which the server is listening. The format of addresses " -"varies depending on the protocol family; see the documentation for the :mod:" -"`socket` module for details. For internet protocols, this is a tuple " -"containing a string giving the address, and an integer port number: " +"varies depending on the protocol family; see the documentation for " +"the :mod:`socket` module for details. For internet protocols, this is a " +"tuple containing a string giving the address, and an integer port number: " "``('127.0.0.1', 80)``, for example." msgstr "" @@ -374,8 +375,8 @@ msgstr "" #: ../../library/socketserver.rst:293 msgid "" -"Whether the server will allow the reuse of an address. This defaults to :" -"const:`False`, and can be set in subclasses to change the policy." +"Whether the server will allow the reuse of an address. This defaults " +"to :const:`False`, and can be set in subclasses to change the policy." msgstr "" #: ../../library/socketserver.rst:299 @@ -389,8 +390,8 @@ msgstr "" #: ../../library/socketserver.rst:308 msgid "" -"The type of socket used by the server; :const:`socket.SOCK_STREAM` and :" -"const:`socket.SOCK_DGRAM` are two common values." +"The type of socket used by the server; :const:`socket.SOCK_STREAM` " +"and :const:`socket.SOCK_DGRAM` are two common values." msgstr "" #: ../../library/socketserver.rst:314 @@ -443,10 +444,10 @@ msgstr "" #: ../../library/socketserver.rst:362 msgid "" -"Calls :meth:`finish_request` to create an instance of the :attr:" -"`RequestHandlerClass`. If desired, this function can create a new process " -"or thread to handle the request; the :class:`ForkingMixIn` and :class:" -"`ThreadingMixIn` classes do this." +"Calls :meth:`finish_request` to create an instance of " +"the :attr:`RequestHandlerClass`. If desired, this function can create a new " +"process or thread to handle the request; the :class:`ForkingMixIn` " +"and :class:`ThreadingMixIn` classes do this." msgstr "" #: ../../library/socketserver.rst:374 @@ -499,8 +500,8 @@ msgid "" "This function must do all the work required to service a request. The " "default implementation does nothing. Several instance attributes are " "available to it; the request is available as :attr:`request`; the client " -"address as :attr:`client_address`; and the server instance as :attr:" -"`server`, in case it needs access to per-server information." +"address as :attr:`client_address`; and the server instance " +"as :attr:`server`, in case it needs access to per-server information." msgstr "" #: ../../library/socketserver.rst:424 @@ -533,21 +534,21 @@ msgstr "" #: ../../library/socketserver.rst:455 msgid "" -"These :class:`BaseRequestHandler` subclasses override the :meth:" -"`~BaseRequestHandler.setup` and :meth:`~BaseRequestHandler.finish` methods, " -"and provide :attr:`rfile` and :attr:`wfile` attributes." +"These :class:`BaseRequestHandler` subclasses override " +"the :meth:`~BaseRequestHandler.setup` and :meth:`~BaseRequestHandler.finish` " +"methods, and provide :attr:`rfile` and :attr:`wfile` attributes." msgstr "" #: ../../library/socketserver.rst:461 msgid "" -"A file object from which receives the request is read. Support the :class:" -"`io.BufferedIOBase` readable interface." +"A file object from which receives the request is read. Support " +"the :class:`io.BufferedIOBase` readable interface." msgstr "" #: ../../library/socketserver.rst:466 msgid "" -"A file object to which the reply is written. Support the :class:`io." -"BufferedIOBase` writable interface" +"A file object to which the reply is written. Support " +"the :class:`io.BufferedIOBase` writable interface" msgstr "" #: ../../library/socketserver.rst:470 @@ -564,7 +565,7 @@ msgstr "範例" msgid ":class:`socketserver.TCPServer` Example" msgstr ":class:`socketserver.TCPServer` 範例" -#: ../../library/socketserver.rst:481 ../../library/socketserver.rst:581 +#: ../../library/socketserver.rst:481 ../../library/socketserver.rst:592 msgid "This is the server side::" msgstr "" @@ -583,11 +584,17 @@ msgid "" "\n" " def handle(self):\n" " # self.request is the TCP socket connected to the client\n" -" self.data = self.request.recv(1024).strip()\n" -" print(\"Received from {}:\".format(self.client_address[0]))\n" -" print(self.data)\n" +" pieces = [b'']\n" +" total = 0\n" +" while b'\\n' not in pieces[-1] and total < 10_000:\n" +" pieces.append(self.request.recv(2000))\n" +" total += len(pieces[-1])\n" +" self.data = b''.join(pieces)\n" +" print(f\"Received from {self.client_address[0]}:\")\n" +" print(self.data.decode(\"utf-8\"))\n" " # just send back the same data, but upper-cased\n" " self.request.sendall(self.data.upper())\n" +" # after we return, the socket will be closed.\n" "\n" "if __name__ == \"__main__\":\n" " HOST, PORT = \"localhost\", 9999\n" @@ -599,42 +606,46 @@ msgid "" " server.serve_forever()" msgstr "" -#: ../../library/socketserver.rst:511 +#: ../../library/socketserver.rst:517 msgid "" "An alternative request handler class that makes use of streams (file-like " "objects that simplify communication by providing the standard file " "interface)::" msgstr "" -#: ../../library/socketserver.rst:514 +#: ../../library/socketserver.rst:520 msgid "" "class MyTCPHandler(socketserver.StreamRequestHandler):\n" "\n" " def handle(self):\n" -" # self.rfile is a file-like object created by the handler;\n" -" # we can now use e.g. readline() instead of raw recv() calls\n" -" self.data = self.rfile.readline().strip()\n" -" print(\"{} wrote:\".format(self.client_address[0]))\n" -" print(self.data)\n" +" # self.rfile is a file-like object created by the handler.\n" +" # We can now use e.g. readline() instead of raw recv() calls.\n" +" # We limit ourselves to 10000 bytes to avoid abuse by the sender.\n" +" self.data = self.rfile.readline(10000).rstrip()\n" +" print(f\"{self.client_address[0]} wrote:\")\n" +" print(self.data.decode(\"utf-8\"))\n" " # Likewise, self.wfile is a file-like object used to write back\n" " # to the client\n" " self.wfile.write(self.data.upper())" msgstr "" -#: ../../library/socketserver.rst:526 +#: ../../library/socketserver.rst:533 msgid "" "The difference is that the ``readline()`` call in the second handler will " "call ``recv()`` multiple times until it encounters a newline character, " -"while the single ``recv()`` call in the first handler will just return what " -"has been received so far from the client's ``sendall()`` call (typically all " -"of it, but this is not guaranteed by the TCP protocol)." +"while the the first handler had to use a ``recv()`` loop to accumulate data " +"until a newline itself. If it had just used a single ``recv()`` without the " +"loop it would just have returned what has been received so far from the " +"client. TCP is stream based: data arrives in the order it was sent, but " +"there no correlation between client ``send()`` or ``sendall()`` calls and " +"the number of ``recv()`` calls on the server required to receive it." msgstr "" -#: ../../library/socketserver.rst:533 ../../library/socketserver.rst:605 +#: ../../library/socketserver.rst:543 ../../library/socketserver.rst:616 msgid "This is the client side::" msgstr "" -#: ../../library/socketserver.rst:535 +#: ../../library/socketserver.rst:545 msgid "" "import socket\n" "import sys\n" @@ -646,24 +657,25 @@ msgid "" "with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:\n" " # Connect to server and send data\n" " sock.connect((HOST, PORT))\n" -" sock.sendall(bytes(data + \"\\n\", \"utf-8\"))\n" +" sock.sendall(bytes(data, \"utf-8\"))\n" +" sock.sendall(b\"\\n\")\n" "\n" " # Receive data from the server and shut down\n" " received = str(sock.recv(1024), \"utf-8\")\n" "\n" -"print(\"Sent: {}\".format(data))\n" -"print(\"Received: {}\".format(received))" +"print(\"Sent: \", data)\n" +"print(\"Received:\", received)" msgstr "" -#: ../../library/socketserver.rst:554 ../../library/socketserver.rst:680 +#: ../../library/socketserver.rst:565 ../../library/socketserver.rst:691 msgid "The output of the example should look something like this:" msgstr "" -#: ../../library/socketserver.rst:556 +#: ../../library/socketserver.rst:567 msgid "Server:" msgstr "" -#: ../../library/socketserver.rst:558 +#: ../../library/socketserver.rst:569 msgid "" "$ python TCPServer.py\n" "127.0.0.1 wrote:\n" @@ -677,11 +689,11 @@ msgstr "" "127.0.0.1 wrote:\n" "b'python is nice'" -#: ../../library/socketserver.rst:566 +#: ../../library/socketserver.rst:577 msgid "Client:" msgstr "" -#: ../../library/socketserver.rst:568 +#: ../../library/socketserver.rst:579 msgid "" "$ python TCPClient.py hello world with TCP\n" "Sent: hello world with TCP\n" @@ -697,11 +709,11 @@ msgstr "" "Sent: python is nice\n" "Received: PYTHON IS NICE" -#: ../../library/socketserver.rst:579 +#: ../../library/socketserver.rst:590 msgid ":class:`socketserver.UDPServer` Example" msgstr ":class:`socketserver.UDPServer` 範例" -#: ../../library/socketserver.rst:583 +#: ../../library/socketserver.rst:594 msgid "" "import socketserver\n" "\n" @@ -716,7 +728,7 @@ msgid "" " def handle(self):\n" " data = self.request[0].strip()\n" " socket = self.request[1]\n" -" print(\"{} wrote:\".format(self.client_address[0]))\n" +" print(f\"{self.client_address[0]} wrote:\")\n" " print(data)\n" " socket.sendto(data.upper(), self.client_address)\n" "\n" @@ -726,7 +738,7 @@ msgid "" " server.serve_forever()" msgstr "" -#: ../../library/socketserver.rst:607 +#: ../../library/socketserver.rst:618 msgid "" "import socket\n" "import sys\n" @@ -742,31 +754,31 @@ msgid "" "sock.sendto(bytes(data + \"\\n\", \"utf-8\"), (HOST, PORT))\n" "received = str(sock.recv(1024), \"utf-8\")\n" "\n" -"print(\"Sent: {}\".format(data))\n" -"print(\"Received: {}\".format(received))" +"print(\"Sent: \", data)\n" +"print(\"Received:\", received)" msgstr "" -#: ../../library/socketserver.rst:624 +#: ../../library/socketserver.rst:635 msgid "" "The output of the example should look exactly like for the TCP server " "example." msgstr "" -#: ../../library/socketserver.rst:628 +#: ../../library/socketserver.rst:639 msgid "Asynchronous Mixins" msgstr "" -#: ../../library/socketserver.rst:630 +#: ../../library/socketserver.rst:641 msgid "" -"To build asynchronous handlers, use the :class:`ThreadingMixIn` and :class:" -"`ForkingMixIn` classes." +"To build asynchronous handlers, use the :class:`ThreadingMixIn` " +"and :class:`ForkingMixIn` classes." msgstr "" -#: ../../library/socketserver.rst:633 +#: ../../library/socketserver.rst:644 msgid "An example for the :class:`ThreadingMixIn` class::" msgstr "" -#: ../../library/socketserver.rst:635 +#: ../../library/socketserver.rst:646 msgid "" "import socket\n" "import threading\n" @@ -780,8 +792,8 @@ msgid "" " response = bytes(\"{}: {}\".format(cur_thread.name, data), 'ascii')\n" " self.request.sendall(response)\n" "\n" -"class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver." -"TCPServer):\n" +"class ThreadedTCPServer(socketserver.ThreadingMixIn, " +"socketserver.TCPServer):\n" " pass\n" "\n" "def client(ip, port, message):\n" @@ -814,7 +826,7 @@ msgid "" " server.shutdown()" msgstr "" -#: ../../library/socketserver.rst:682 +#: ../../library/socketserver.rst:693 msgid "" "$ python ThreadedTCPServer.py\n" "Server loop running in thread: Thread-1\n" @@ -828,7 +840,7 @@ msgstr "" "Received: Thread-3: Hello World 2\n" "Received: Thread-4: Hello World 3" -#: ../../library/socketserver.rst:691 +#: ../../library/socketserver.rst:702 msgid "" "The :class:`ForkingMixIn` class is used in the same way, except that the " "server will spawn a new process for each request. Available only on POSIX " diff --git a/library/ssl.po b/library/ssl.po index 6fa89a6402..15a4f1f037 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-20 00:13+0000\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: 2024-08-28 00:43+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2707,8 +2707,8 @@ msgstr "" msgid "" "A :class:`TLSVersion` enum member representing the highest supported TLS " "version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`. The " -"attribute is read-only for protocols other than :attr:`PROTOCOL_TLS`, :attr:" -"`PROTOCOL_TLS_CLIENT`, and :attr:`PROTOCOL_TLS_SERVER`." +"attribute is read-only for protocols other than :const:`PROTOCOL_TLS`, :" +"const:`PROTOCOL_TLS_CLIENT`, and :const:`PROTOCOL_TLS_SERVER`." msgstr "" #: ../../library/ssl.rst:1937 @@ -2729,7 +2729,7 @@ msgstr "" #: ../../library/ssl.rst:1957 msgid "" -"Control the number of TLS 1.3 session tickets of a :attr:" +"Control the number of TLS 1.3 session tickets of a :const:" "`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 to 1.2 " "connections." msgstr "" diff --git a/library/string.po b/library/string.po index 5537df8ef6..ceb98aace6 100644 --- a/library/string.po +++ b/library/string.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-15 00:17+0000\n" +"POT-Creation-Date: 2025-01-16 00:13+0000\n" "PO-Revision-Date: 2024-03-10 15:57+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -44,9 +44,9 @@ msgstr "此模組中定義的常數為:" #: ../../library/string.rst:26 msgid "" -"The concatenation of the :const:`ascii_lowercase` and :const:" -"`ascii_uppercase` constants described below. This value is not locale-" -"dependent." +"The concatenation of the :const:`ascii_lowercase` " +"and :const:`ascii_uppercase` constants described below. This value is not " +"locale-dependent." msgstr "" "下文描述的 :const:`ascii_lowercase` 和 :const:`ascii_uppercase` 常數的串接," "該值不依賴於區域設定。" @@ -85,17 +85,26 @@ msgstr "" "在 ``C`` 語言中被視為標點符號的 ASCII 字元的字串:``!\"#$%&'()*+,-./:;<=>?" "@[\\]^_`{|}~``。" -#: ../../library/string.rst:64 +#: ../../library/string.rst:65 msgid "" -"String of ASCII characters which are considered printable. This is a " -"combination of :const:`digits`, :const:`ascii_letters`, :const:" -"`punctuation`, and :const:`whitespace`." +"String of ASCII characters which are considered printable by Python. This is " +"a combination " +"of :const:`digits`, :const:`ascii_letters`, :const:`punctuation`, " +"and :const:`whitespace`." msgstr "" -"ASCII 字元的字串是可被列印輸出的。 這是 :const:`digits`、:const:" -"`ascii_letters`、:const:`punctuation` 和 :const:`whitespace` 的組合。" +"ASCII 字元的字串被 Python 是為可被列印輸出的。這" +"是 :const:`digits`、:const:`ascii_letters`、:const:`punctuation` " +"和 :const:`whitespace` 的組合。" #: ../../library/string.rst:71 msgid "" +"By design, :meth:`string.printable.isprintable() <str.isprintable>` " +"returns :const:`False`. In particular, ``string.printable`` is not printable " +"in the POSIX sense (see :manpage:`LC_CTYPE <locale(5)>`)." +msgstr "" + +#: ../../library/string.rst:78 +msgid "" "A string containing all ASCII characters that are considered whitespace. " "This includes the characters space, tab, linefeed, return, formfeed, and " "vertical tab." @@ -104,11 +113,11 @@ msgstr "" "符號 (tab)、換行符號 (linefeed)、return、換頁符號 (formfeed) 和垂直製表符號 " "(vertical tab) 這些字元。" -#: ../../library/string.rst:79 +#: ../../library/string.rst:86 msgid "Custom String Formatting" msgstr "自訂字串格式" -#: ../../library/string.rst:81 +#: ../../library/string.rst:88 msgid "" "The built-in string class provides the ability to do complex variable " "substitutions and value formatting via the :meth:`~str.format` method " @@ -122,42 +131,43 @@ msgstr "" "模組可讓你使用與內建 :meth:`~str.format` 方法相同的實作來建立和自訂你自己的字" "串格式化行為。" -#: ../../library/string.rst:90 +#: ../../library/string.rst:97 msgid "The :class:`Formatter` class has the following public methods:" msgstr ":class:`Formatter` 類別有以下的公開方法:" -#: ../../library/string.rst:94 +#: ../../library/string.rst:101 msgid "" "The primary API method. It takes a format string and an arbitrary set of " -"positional and keyword arguments. It is just a wrapper that calls :meth:" -"`vformat`." +"positional and keyword arguments. It is just a wrapper that " +"calls :meth:`vformat`." msgstr "" -"主要的 API 方法。它接收一個格式字串及一組任意的位置引數與關鍵字引數,是呼叫 :" -"meth:`vformat` 的包裝器 (wrapper)。" +"主要的 API 方法。它接收一個格式字串及一組任意的位置引數與關鍵字引數,是呼" +"叫 :meth:`vformat` 的包裝器 (wrapper)。" -#: ../../library/string.rst:98 +#: ../../library/string.rst:105 msgid "" "A format string argument is now :ref:`positional-only <positional-" "only_parameter>`." msgstr "現在格式字串引數是\\ :ref:`僅限位置參數 <positional-only_parameter>`。" -#: ../../library/string.rst:104 +#: ../../library/string.rst:111 msgid "" "This function does the actual work of formatting. It is exposed as a " "separate function for cases where you want to pass in a predefined " "dictionary of arguments, rather than unpacking and repacking the dictionary " -"as individual arguments using the ``*args`` and ``**kwargs`` syntax. :meth:" -"`vformat` does the work of breaking up the format string into character data " -"and replacement fields. It calls the various methods described below." +"as individual arguments using the ``*args`` and ``**kwargs`` " +"syntax. :meth:`vformat` does the work of breaking up the format string into " +"character data and replacement fields. It calls the various methods " +"described below." msgstr "" -#: ../../library/string.rst:112 +#: ../../library/string.rst:119 msgid "" "In addition, the :class:`Formatter` defines a number of methods that are " "intended to be replaced by subclasses:" msgstr "" -#: ../../library/string.rst:117 +#: ../../library/string.rst:124 msgid "" "Loop over the format_string and return an iterable of tuples " "(*literal_text*, *field_name*, *format_spec*, *conversion*). This is used " @@ -168,7 +178,7 @@ msgstr "" "*field_name*, *format_spec*, *conversion*)。這會被 :meth:`vformat` 用於將字串" "裁切為字面文本或替換欄位。" -#: ../../library/string.rst:122 +#: ../../library/string.rst:129 msgid "" "The values in the tuple conceptually represent a span of literal text " "followed by a single replacement field. If there is no literal text (which " @@ -178,17 +188,17 @@ msgid "" "be ``None``." msgstr "" -#: ../../library/string.rst:131 +#: ../../library/string.rst:138 msgid "" "Given *field_name* as returned by :meth:`parse` (see above), convert it to " "an object to be formatted. Returns a tuple (obj, used_key). The default " -"version takes strings of the form defined in :pep:`3101`, such as " -"\"0[name]\" or \"label.title\". *args* and *kwargs* are as passed in to :" -"meth:`vformat`. The return value *used_key* has the same meaning as the " +"version takes strings of the form defined in :pep:`3101`, such as \"0[name]" +"\" or \"label.title\". *args* and *kwargs* are as passed in " +"to :meth:`vformat`. The return value *used_key* has the same meaning as the " "*key* parameter to :meth:`get_value`." msgstr "" -#: ../../library/string.rst:140 +#: ../../library/string.rst:147 msgid "" "Retrieve a given field value. The *key* argument will be either an integer " "or a string. If it is an integer, it represents the index of the positional " @@ -196,62 +206,63 @@ msgid "" "in *kwargs*." msgstr "" -#: ../../library/string.rst:145 +#: ../../library/string.rst:152 msgid "" -"The *args* parameter is set to the list of positional arguments to :meth:" -"`vformat`, and the *kwargs* parameter is set to the dictionary of keyword " -"arguments." +"The *args* parameter is set to the list of positional arguments " +"to :meth:`vformat`, and the *kwargs* parameter is set to the dictionary of " +"keyword arguments." msgstr "" -#: ../../library/string.rst:149 +#: ../../library/string.rst:156 msgid "" "For compound field names, these functions are only called for the first " "component of the field name; subsequent components are handled through " "normal attribute and indexing operations." msgstr "" -#: ../../library/string.rst:153 +#: ../../library/string.rst:160 msgid "" "So for example, the field expression '0.name' would cause :meth:`get_value` " "to be called with a *key* argument of 0. The ``name`` attribute will be " -"looked up after :meth:`get_value` returns by calling the built-in :func:" -"`getattr` function." +"looked up after :meth:`get_value` returns by calling the built-" +"in :func:`getattr` function." msgstr "" -#: ../../library/string.rst:158 +#: ../../library/string.rst:165 msgid "" -"If the index or keyword refers to an item that does not exist, then an :exc:" -"`IndexError` or :exc:`KeyError` should be raised." +"If the index or keyword refers to an item that does not exist, then " +"an :exc:`IndexError` or :exc:`KeyError` should be raised." msgstr "" -#: ../../library/string.rst:163 +#: ../../library/string.rst:170 msgid "" "Implement checking for unused arguments if desired. The arguments to this " "function is the set of all argument keys that were actually referred to in " "the format string (integers for positional arguments, and strings for named " "arguments), and a reference to the *args* and *kwargs* that was passed to " -"vformat. The set of unused args can be calculated from these parameters. :" -"meth:`check_unused_args` is assumed to raise an exception if the check fails." +"vformat. The set of unused args can be calculated from these " +"parameters. :meth:`check_unused_args` is assumed to raise an exception if " +"the check fails." msgstr "" -#: ../../library/string.rst:173 +#: ../../library/string.rst:180 msgid "" ":meth:`format_field` simply calls the global :func:`format` built-in. The " "method is provided so that subclasses can override it." msgstr "" -#: ../../library/string.rst:178 +#: ../../library/string.rst:185 msgid "" "Converts the value (returned by :meth:`get_field`) given a conversion type " "(as in the tuple returned by the :meth:`parse` method). The default version " "understands 's' (str), 'r' (repr) and 'a' (ascii) conversion types." msgstr "" -#: ../../library/string.rst:187 +#: ../../library/string.rst:194 msgid "Format String Syntax" msgstr "格式化文字語法" -#: ../../library/string.rst:189 +#: ../../library/string.rst:196 msgid "" "The :meth:`str.format` method and the :class:`Formatter` class share the " "same syntax for format strings (although in the case of :class:`Formatter`, " @@ -261,7 +272,7 @@ msgid "" "expressions." msgstr "" -#: ../../library/string.rst:202 +#: ../../library/string.rst:209 msgid "" "Format strings contain \"replacement fields\" surrounded by curly braces ``{}" "``. Anything that is not contained in braces is considered literal text, " @@ -270,11 +281,11 @@ msgid "" "``." msgstr "" -#: ../../library/string.rst:207 +#: ../../library/string.rst:214 msgid "The grammar for a replacement field is as follows:" msgstr "" -#: ../../library/string.rst:219 +#: ../../library/string.rst:226 msgid "" "In less formal terms, the replacement field can start with a *field_name* " "that specifies the object whose value is to be formatted and inserted into " @@ -284,11 +295,11 @@ msgid "" "specify a non-default format for the replacement value." msgstr "" -#: ../../library/string.rst:226 +#: ../../library/string.rst:233 msgid "See also the :ref:`formatspec` section." msgstr "另請參閱 :ref:`formatspec` 部份。" -#: ../../library/string.rst:228 +#: ../../library/string.rst:235 msgid "" "The *field_name* itself begins with an *arg_name* that is either a number or " "a keyword. If it's a number, it refers to a positional argument, and if " @@ -300,27 +311,27 @@ msgid "" "not quote-delimited, it is not possible to specify arbitrary dictionary keys " "(e.g., the strings ``'10'`` or ``':-]'``) within a format string. The " "*arg_name* can be followed by any number of index or attribute expressions. " -"An expression of the form ``'.name'`` selects the named attribute using :" -"func:`getattr`, while an expression of the form ``'[index]'`` does an index " -"lookup using :meth:`~object.__getitem__`." +"An expression of the form ``'.name'`` selects the named attribute " +"using :func:`getattr`, while an expression of the form ``'[index]'`` does an " +"index lookup using :meth:`~object.__getitem__`." msgstr "" -#: ../../library/string.rst:242 +#: ../../library/string.rst:249 msgid "" "The positional argument specifiers can be omitted for :meth:`str.format`, so " "``'{} {}'.format(a, b)`` is equivalent to ``'{0} {1}'.format(a, b)``." msgstr "" -#: ../../library/string.rst:246 +#: ../../library/string.rst:253 msgid "" "The positional argument specifiers can be omitted for :class:`Formatter`." msgstr "" -#: ../../library/string.rst:249 +#: ../../library/string.rst:256 msgid "Some simple format string examples::" msgstr "" -#: ../../library/string.rst:251 +#: ../../library/string.rst:258 msgid "" "\"First, thou shalt count to {0}\" # References first positional argument\n" "\"Bring me a {}\" # Implicitly references the first " @@ -333,37 +344,37 @@ msgid "" "'players'." msgstr "" -#: ../../library/string.rst:258 +#: ../../library/string.rst:265 msgid "" "The *conversion* field causes a type coercion before formatting. Normally, " "the job of formatting a value is done by the :meth:`~object.__format__` " "method of the value itself. However, in some cases it is desirable to force " "a type to be formatted as a string, overriding its own definition of " -"formatting. By converting the value to a string before calling :meth:" -"`~object.__format__`, the normal formatting logic is bypassed." +"formatting. By converting the value to a string before " +"calling :meth:`~object.__format__`, the normal formatting logic is bypassed." msgstr "" -#: ../../library/string.rst:265 +#: ../../library/string.rst:272 msgid "" -"Three conversion flags are currently supported: ``'!s'`` which calls :func:" -"`str` on the value, ``'!r'`` which calls :func:`repr` and ``'!a'`` which " -"calls :func:`ascii`." +"Three conversion flags are currently supported: ``'!s'`` which " +"calls :func:`str` on the value, ``'!r'`` which calls :func:`repr` and ``'!" +"a'`` which calls :func:`ascii`." msgstr "" "目前支援三種轉換旗標:``'!s'`` 會對該值呼叫 :func:`str`,``'!r'`` 會對該值呼" "叫 :func:`repr`,而 ``'!a'`` 則會對該值呼叫 :func:`ascii`。" -#: ../../library/string.rst:269 +#: ../../library/string.rst:276 msgid "Some examples::" msgstr "一些範例: ::" -#: ../../library/string.rst:271 +#: ../../library/string.rst:278 msgid "" "\"Harold's a clever {0!s}\" # Calls str() on the argument first\n" "\"Bring out the holy {name!r}\" # Calls repr() on the argument first\n" "\"More {!a}\" # Calls ascii() on the argument first" msgstr "" -#: ../../library/string.rst:275 +#: ../../library/string.rst:282 msgid "" "The *format_spec* field contains a specification of how the value should be " "presented, including such details as field width, alignment, padding, " @@ -374,13 +385,13 @@ msgstr "" "數精度等細節資訊。每種值類型都可以定義自己的「格式化迷你語言 (formatting " "mini-language)」或對 *format_spec* 的解釋。" -#: ../../library/string.rst:280 +#: ../../library/string.rst:287 msgid "" "Most built-in types support a common formatting mini-language, which is " "described in the next section." msgstr "大多數內建型別都支援常見的格式化迷你語言,下一節將會詳細說明。" -#: ../../library/string.rst:283 +#: ../../library/string.rst:290 msgid "" "A *format_spec* field can also include nested replacement fields within it. " "These nested replacement fields may contain a field name, conversion flag " @@ -394,28 +405,28 @@ msgstr "" "format_spec 内部的替換欄位會在 *format_spec* 字串被直譯前被替換。這讓數值的格" "式能夠被動態地指定。" -#: ../../library/string.rst:290 +#: ../../library/string.rst:297 msgid "See the :ref:`formatexamples` section for some examples." msgstr "範例請見 :ref:`formatexamples`。" -#: ../../library/string.rst:296 +#: ../../library/string.rst:303 msgid "Format Specification Mini-Language" msgstr "格式規格 (Format Specification) 迷你語言" -#: ../../library/string.rst:298 +#: ../../library/string.rst:305 msgid "" "\"Format specifications\" are used within replacement fields contained " -"within a format string to define how individual values are presented (see :" -"ref:`formatstrings` and :ref:`f-strings`). They can also be passed directly " -"to the built-in :func:`format` function. Each formattable type may define " -"how the format specification is to be interpreted." +"within a format string to define how individual values are presented " +"(see :ref:`formatstrings` and :ref:`f-strings`). They can also be passed " +"directly to the built-in :func:`format` function. Each formattable type may " +"define how the format specification is to be interpreted." msgstr "" "「格式規格」在格式字串 (format string) 中包含的替換欄位中使用,以定義各個值如" "何被呈現(請參考 :ref:`formatstrings` 和 :ref:`f-strings`\\ )。它們也能夠直" "接傳遞給內建的 :func:`format` 函式。每個可格式化型別 (formattable type) 可以" "定義格式規格如何被直譯。" -#: ../../library/string.rst:305 +#: ../../library/string.rst:312 msgid "" "Most built-in types implement the following options for format " "specifications, although some of the formatting options are only supported " @@ -423,7 +434,7 @@ msgid "" msgstr "" "大部分內建型別為了格式規格實作了下列選項,不過有些選項只被數值型別支援。" -#: ../../library/string.rst:308 +#: ../../library/string.rst:315 msgid "" "A general convention is that an empty format specification produces the same " "result as if you had called :func:`str` on the value. A non-empty format " @@ -432,11 +443,11 @@ msgstr "" "一般來說,輸入空格式規格會產生和對值呼叫 :func:`str` 函式相同的結果,非空的格" "式規格才會修改結果。" -#: ../../library/string.rst:312 +#: ../../library/string.rst:319 msgid "The general form of a *standard format specifier* is:" msgstr "*標準格式說明符號 (standard format specifier)* 的一般型式如下:" -#: ../../library/string.rst:324 +#: ../../library/string.rst:331 msgid "" "If a valid *align* value is specified, it can be preceded by a *fill* " "character that can be any character and defaults to a space if omitted. It " @@ -447,67 +458,67 @@ msgid "" "the :func:`format` function." msgstr "" "如果給定了一個有效的 *align* 值,則可以在它之前加一個 *fill* 字元,且該字元可" -"為任意字元,若不加的話預設為空格。使用\\ :ref:`格式字串 <f-strings>`\\ 或 :" -"meth:`str.format` 時是無法在其中使用大括號(\"``{``\" 或 \"``}``\")作為 " -"*fill* 字元的,但仍可透過巢狀替換欄位的方式插入大括號。此限制不影響 :func:" -"`format` 函式。" +"為任意字元,若不加的話預設為空格。使用\\ :ref:`格式字串 <f-strings>`\\ " +"或 :meth:`str.format` 時是無法在其中使用大括號(\"``{``\" 或 \"``}``\")作為 " +"*fill* 字元的,但仍可透過巢狀替換欄位的方式插入大括號。此限制不影" +"響 :func:`format` 函式。" -#: ../../library/string.rst:333 +#: ../../library/string.rst:340 msgid "The meaning of the various alignment options is as follows:" msgstr "" -#: ../../library/string.rst:342 ../../library/string.rst:374 +#: ../../library/string.rst:349 ../../library/string.rst:381 msgid "Option" msgstr "選項" -#: ../../library/string.rst:342 ../../library/string.rst:374 -#: ../../library/string.rst:459 ../../library/string.rst:470 -#: ../../library/string.rst:505 +#: ../../library/string.rst:349 ../../library/string.rst:381 +#: ../../library/string.rst:466 ../../library/string.rst:477 +#: ../../library/string.rst:512 msgid "Meaning" msgstr "含義" -#: ../../library/string.rst:344 +#: ../../library/string.rst:351 msgid "``'<'``" msgstr "``'<'``" -#: ../../library/string.rst:344 +#: ../../library/string.rst:351 msgid "" "Forces the field to be left-aligned within the available space (this is the " "default for most objects)." msgstr "強制欄位在可用空間內靠左對齊(這是大多數物件的預設值)。" -#: ../../library/string.rst:347 +#: ../../library/string.rst:354 msgid "``'>'``" msgstr "``'>'``" -#: ../../library/string.rst:347 +#: ../../library/string.rst:354 msgid "" "Forces the field to be right-aligned within the available space (this is the " "default for numbers)." msgstr "強制欄位在可用空間內靠右對齊(這是數字的預設值)。" -#: ../../library/string.rst:350 +#: ../../library/string.rst:357 msgid "``'='``" msgstr "``'='``" -#: ../../library/string.rst:350 +#: ../../library/string.rst:357 msgid "" "Forces the padding to be placed after the sign (if any) but before the " "digits. This is used for printing fields in the form '+000000120'. This " -"alignment option is only valid for numeric types, excluding :class:" -"`complex`. It becomes the default for numbers when '0' immediately precedes " -"the field width." +"alignment option is only valid for numeric types, " +"excluding :class:`complex`. It becomes the default for numbers when '0' " +"immediately precedes the field width." msgstr "" -#: ../../library/string.rst:357 +#: ../../library/string.rst:364 msgid "``'^'``" msgstr "``'^'``" -#: ../../library/string.rst:357 +#: ../../library/string.rst:364 msgid "Forces the field to be centered within the available space." msgstr "強制欄位在可用空間內置中。" -#: ../../library/string.rst:361 +#: ../../library/string.rst:368 msgid "" "Note that unless a minimum field width is defined, the field width will " "always be the same size as the data to fill it, so that the alignment option " @@ -516,54 +527,54 @@ msgstr "" "請注意,除非有定義了最小欄位寬度,否則欄位寬度將始終與填充它的資料大小相同," "故在該情況下的對齊選項是沒有意義的。" -#: ../../library/string.rst:365 +#: ../../library/string.rst:372 msgid "" "The *sign* option is only valid for number types, and can be one of the " "following:" msgstr "*sign* 選項只適用於數字型別,並可為以下之一:" -#: ../../library/string.rst:376 +#: ../../library/string.rst:383 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/string.rst:376 +#: ../../library/string.rst:383 msgid "" "indicates that a sign should be used for both positive as well as negative " "numbers." msgstr "表示正數與負數均需使用符號。" -#: ../../library/string.rst:379 +#: ../../library/string.rst:386 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/string.rst:379 +#: ../../library/string.rst:386 msgid "" "indicates that a sign should be used only for negative numbers (this is the " "default behavior)." msgstr "" -#: ../../library/string.rst:368 ../../library/string.rst:382 +#: ../../library/string.rst:375 ../../library/string.rst:389 msgid "space" msgstr "空格" -#: ../../library/string.rst:382 +#: ../../library/string.rst:389 msgid "" "indicates that a leading space should be used on positive numbers, and a " "minus sign on negative numbers." msgstr "表示正數應使用前導空格,負數應使用減號。" -#: ../../library/string.rst:389 +#: ../../library/string.rst:396 msgid "" "The ``'z'`` option coerces negative zero floating-point values to positive " "zero after rounding to the format precision. This option is only valid for " "floating-point presentation types." msgstr "" -#: ../../library/string.rst:393 +#: ../../library/string.rst:400 msgid "Added the ``'z'`` option (see also :pep:`682`)." msgstr "新增 ``'z'`` 選項(請見 :pep:`682`\\ )。" -#: ../../library/string.rst:398 +#: ../../library/string.rst:405 msgid "" "The ``'#'`` option causes the \"alternate form\" to be used for the " "conversion. The alternate form is defined differently for different types. " @@ -577,7 +588,7 @@ msgid "" "and ``'G'`` conversions, trailing zeros are not removed from the result." msgstr "" -#: ../../library/string.rst:412 +#: ../../library/string.rst:419 msgid "" "The ``','`` option signals the use of a comma for a thousands separator for " "floating-point presentation types and for integer presentation type ``'d'``. " @@ -585,11 +596,11 @@ msgid "" "separator, use the ``'n'`` integer presentation type instead." msgstr "" -#: ../../library/string.rst:418 +#: ../../library/string.rst:425 msgid "Added the ``','`` option (see also :pep:`378`)." msgstr "新增 ``','`` 選項(請見 :pep:`378`\\ )。" -#: ../../library/string.rst:423 +#: ../../library/string.rst:430 msgid "" "The ``'_'`` option signals the use of an underscore for a thousands " "separator for floating-point presentation types and for integer presentation " @@ -601,11 +612,11 @@ msgstr "" "號。對於整數表示型別 ``'b'``,``'o'``,``'x'`` 和 ``'X'``,每 4 位數字會插入" "底線。對於其他表示型別,指定此選項會出錯。" -#: ../../library/string.rst:430 +#: ../../library/string.rst:437 msgid "Added the ``'_'`` option (see also :pep:`515`)." msgstr "新增 ``'_'`` 選項(請見 :pep:`515`\\ )。" -#: ../../library/string.rst:433 +#: ../../library/string.rst:440 msgid "" "*width* is a decimal integer defining the minimum total field width, " "including any prefixes, separators, and other formatting characters. If not " @@ -614,24 +625,24 @@ msgstr "" "*width* 是一個十進位整數,定義了最小總欄位寬度,包括任何前綴、分隔符號和其他" "格式字元。如果未指定,則欄位寬度將由內容決定。" -#: ../../library/string.rst:437 +#: ../../library/string.rst:444 msgid "" "When no explicit alignment is given, preceding the *width* field by a zero " "(``'0'``) character enables sign-aware zero-padding for numeric types, " "excluding :class:`complex`. This is equivalent to a *fill* character of " "``'0'`` with an *alignment* type of ``'='``." msgstr "" -"當未給予明確的對齊指示,在 *width* 欄位前面填入零 (``'0'``) 字元將會為 :" -"class:`complex` 以外的數值型別啟用有符號察覺的零填充 (sign-aware zero-" +"當未給予明確的對齊指示,在 *width* 欄位前面填入零 (``'0'``) 字元將會" +"為 :class:`complex` 以外的數值型別啟用有符號察覺的零填充 (sign-aware zero-" "padding)。這相當於使用 ``'0'`` 為 *fill* 字元且對齊類型為 ``'='``。" -#: ../../library/string.rst:442 +#: ../../library/string.rst:449 msgid "" "Preceding the *width* field by ``'0'`` no longer affects the default " "alignment for strings." msgstr "在 *width* 欄位前面加上 ``'0'`` 不再影響字串的預設對齊方式。" -#: ../../library/string.rst:446 +#: ../../library/string.rst:453 msgid "" "The *precision* is a decimal integer indicating how many digits should be " "displayed after the decimal point for presentation types ``'f'`` and " @@ -646,89 +657,89 @@ msgstr "" "示類型,該欄位指定最大欄位大小 - 換言之,將使用欄位中的多少字元。整數表示類型" "不允許使用 *precision*。" -#: ../../library/string.rst:454 +#: ../../library/string.rst:461 msgid "Finally, the *type* determines how the data should be presented." msgstr "最終,型別決定了資料將會如何呈現" -#: ../../library/string.rst:456 +#: ../../library/string.rst:463 msgid "The available string presentation types are:" msgstr "可用的字串表示型別有:" -#: ../../library/string.rst:459 ../../library/string.rst:470 -#: ../../library/string.rst:505 +#: ../../library/string.rst:466 ../../library/string.rst:477 +#: ../../library/string.rst:512 msgid "Type" msgstr "型別" -#: ../../library/string.rst:461 +#: ../../library/string.rst:468 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/string.rst:461 +#: ../../library/string.rst:468 msgid "String format. This is the default type for strings and may be omitted." msgstr "" -#: ../../library/string.rst:464 ../../library/string.rst:493 -#: ../../library/string.rst:578 +#: ../../library/string.rst:471 ../../library/string.rst:500 +#: ../../library/string.rst:585 msgid "None" msgstr "None" -#: ../../library/string.rst:464 +#: ../../library/string.rst:471 msgid "The same as ``'s'``." msgstr "與 ``'s'`` 相同。" -#: ../../library/string.rst:467 +#: ../../library/string.rst:474 msgid "The available integer presentation types are:" msgstr "" -#: ../../library/string.rst:472 +#: ../../library/string.rst:479 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/string.rst:472 +#: ../../library/string.rst:479 msgid "Binary format. Outputs the number in base 2." msgstr "" -#: ../../library/string.rst:474 +#: ../../library/string.rst:481 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/string.rst:474 +#: ../../library/string.rst:481 msgid "" "Character. Converts the integer to the corresponding unicode character " "before printing." msgstr "" -#: ../../library/string.rst:477 +#: ../../library/string.rst:484 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/string.rst:477 +#: ../../library/string.rst:484 msgid "Decimal Integer. Outputs the number in base 10." msgstr "" -#: ../../library/string.rst:479 +#: ../../library/string.rst:486 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/string.rst:479 +#: ../../library/string.rst:486 msgid "Octal format. Outputs the number in base 8." msgstr "" -#: ../../library/string.rst:481 +#: ../../library/string.rst:488 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/string.rst:481 +#: ../../library/string.rst:488 msgid "" "Hex format. Outputs the number in base 16, using lower-case letters for the " "digits above 9." msgstr "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用小寫字母。" -#: ../../library/string.rst:484 +#: ../../library/string.rst:491 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/string.rst:484 +#: ../../library/string.rst:491 msgid "" "Hex format. Outputs the number in base 16, using upper-case letters for the " "digits above 9. In case ``'#'`` is specified, the prefix ``'0x'`` will be " @@ -737,21 +748,21 @@ msgstr "" "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用大寫字母。如果指定了 " "``'#'``,則前綴 ``'0x'`` 也會被轉成大寫的 ``'0X'``。" -#: ../../library/string.rst:489 ../../library/string.rst:571 +#: ../../library/string.rst:496 ../../library/string.rst:578 msgid "``'n'``" msgstr "``'n'``" -#: ../../library/string.rst:489 +#: ../../library/string.rst:496 msgid "" "Number. This is the same as ``'d'``, except that it uses the current locale " "setting to insert the appropriate number separator characters." msgstr "" -#: ../../library/string.rst:493 +#: ../../library/string.rst:500 msgid "The same as ``'d'``." msgstr "與 ``'d'`` 相同。" -#: ../../library/string.rst:496 +#: ../../library/string.rst:503 msgid "" "In addition to the above presentation types, integers can be formatted with " "the floating-point presentation types listed below (except ``'n'`` and " @@ -759,43 +770,43 @@ msgid "" "floating-point number before formatting." msgstr "" -#: ../../library/string.rst:501 +#: ../../library/string.rst:508 msgid "" -"The available presentation types for :class:`float` and :class:`~decimal." -"Decimal` values are:" +"The available presentation types for :class:`float` " +"and :class:`~decimal.Decimal` values are:" msgstr "" -#: ../../library/string.rst:507 +#: ../../library/string.rst:514 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/string.rst:507 +#: ../../library/string.rst:514 msgid "" "Scientific notation. For a given precision ``p``, formats the number in " "scientific notation with the letter 'e' separating the coefficient from the " "exponent. The coefficient has one digit before and ``p`` digits after the " "decimal point, for a total of ``p + 1`` significant digits. With no " "precision given, uses a precision of ``6`` digits after the decimal point " -"for :class:`float`, and shows all coefficient digits for :class:`~decimal." -"Decimal`. If ``p=0``, the decimal point is omitted unless the ``#`` option " -"is used." +"for :class:`float`, and shows all coefficient digits " +"for :class:`~decimal.Decimal`. If ``p=0``, the decimal point is omitted " +"unless the ``#`` option is used." msgstr "" -#: ../../library/string.rst:518 +#: ../../library/string.rst:525 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/string.rst:518 +#: ../../library/string.rst:525 msgid "" "Scientific notation. Same as ``'e'`` except it uses an upper case 'E' as the " "separator character." msgstr "" -#: ../../library/string.rst:521 +#: ../../library/string.rst:528 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/string.rst:521 +#: ../../library/string.rst:528 msgid "" "Fixed-point notation. For a given precision ``p``, formats the number as a " "decimal number with exactly ``p`` digits following the decimal point. With " @@ -805,21 +816,21 @@ msgid "" "point is omitted unless the ``#`` option is used." msgstr "" -#: ../../library/string.rst:530 +#: ../../library/string.rst:537 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/string.rst:530 +#: ../../library/string.rst:537 msgid "" "Fixed-point notation. Same as ``'f'``, but converts ``nan`` to ``NAN`` and " "``inf`` to ``INF``." msgstr "" -#: ../../library/string.rst:533 +#: ../../library/string.rst:540 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/string.rst:533 +#: ../../library/string.rst:540 msgid "" "General format. For a given precision ``p >= 1``, this rounds the number to " "``p`` significant digits and then formats the result in either fixed-point " @@ -827,7 +838,7 @@ msgid "" "``0`` is treated as equivalent to a precision of ``1``." msgstr "" -#: ../../library/string.rst:540 +#: ../../library/string.rst:547 msgid "" "The precise rules are as follows: suppose that the result formatted with " "presentation type ``'e'`` and precision ``p-1`` would have exponent " @@ -840,50 +851,50 @@ msgid "" "unless the ``'#'`` option is used." msgstr "" -#: ../../library/string.rst:553 +#: ../../library/string.rst:560 msgid "" -"With no precision given, uses a precision of ``6`` significant digits for :" -"class:`float`. For :class:`~decimal.Decimal`, the coefficient of the result " -"is formed from the coefficient digits of the value; scientific notation is " -"used for values smaller than ``1e-6`` in absolute value and values where the " -"place value of the least significant digit is larger than 1, and fixed-point " -"notation is used otherwise." +"With no precision given, uses a precision of ``6`` significant digits " +"for :class:`float`. For :class:`~decimal.Decimal`, the coefficient of the " +"result is formed from the coefficient digits of the value; scientific " +"notation is used for values smaller than ``1e-6`` in absolute value and " +"values where the place value of the least significant digit is larger than " +"1, and fixed-point notation is used otherwise." msgstr "" -#: ../../library/string.rst:562 +#: ../../library/string.rst:569 msgid "" "Positive and negative infinity, positive and negative zero, and nans, are " "formatted as ``inf``, ``-inf``, ``0``, ``-0`` and ``nan`` respectively, " "regardless of the precision." msgstr "" -#: ../../library/string.rst:567 +#: ../../library/string.rst:574 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/string.rst:567 +#: ../../library/string.rst:574 msgid "" "General format. Same as ``'g'`` except switches to ``'E'`` if the number " "gets too large. The representations of infinity and NaN are uppercased, too." msgstr "" -#: ../../library/string.rst:571 +#: ../../library/string.rst:578 msgid "" "Number. This is the same as ``'g'``, except that it uses the current locale " "setting to insert the appropriate number separator characters." msgstr "" -#: ../../library/string.rst:575 +#: ../../library/string.rst:582 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/string.rst:575 +#: ../../library/string.rst:582 msgid "" "Percentage. Multiplies the number by 100 and displays in fixed (``'f'``) " "format, followed by a percent sign." msgstr "" -#: ../../library/string.rst:578 +#: ../../library/string.rst:585 msgid "" "For :class:`float` this is like the ``'g'`` type, except that when fixed-" "point notation is used to format the result, it always includes at least one " @@ -892,20 +903,20 @@ msgid "" "as large as needed to represent the given value faithfully." msgstr "" -#: ../../library/string.rst:586 +#: ../../library/string.rst:593 msgid "" "For :class:`~decimal.Decimal`, this is the same as either ``'g'`` or ``'G'`` " "depending on the value of ``context.capitals`` for the current decimal " "context." msgstr "" -#: ../../library/string.rst:590 +#: ../../library/string.rst:597 msgid "" "The overall effect is to match the output of :func:`str` as altered by the " "other format modifiers." msgstr "" -#: ../../library/string.rst:594 +#: ../../library/string.rst:601 msgid "" "The result should be correctly rounded to a given precision ``p`` of digits " "after the decimal point. The rounding mode for :class:`float` matches that " @@ -913,7 +924,7 @@ msgid "" "mode of the current :ref:`context <decimal-context>` will be used." msgstr "" -#: ../../library/string.rst:599 +#: ../../library/string.rst:606 msgid "" "The available presentation types for :class:`complex` are the same as those " "for :class:`float` (``'%'`` is not allowed). Both the real and imaginary " @@ -925,17 +936,17 @@ msgid "" "surrounded by parentheses), possibly altered by other format modifiers." msgstr "" -#: ../../library/string.rst:612 +#: ../../library/string.rst:619 msgid "Format examples" msgstr "格式範例" -#: ../../library/string.rst:614 +#: ../../library/string.rst:621 msgid "" "This section contains examples of the :meth:`str.format` syntax and " "comparison with the old ``%``-formatting." msgstr "本節包含 :meth:`str.format` 語法以及與舊式 ``%`` 格式的比較。" -#: ../../library/string.rst:617 +#: ../../library/string.rst:624 msgid "" "In most of the cases the syntax is similar to the old ``%``-formatting, with " "the addition of the ``{}`` and with ``:`` used instead of ``%``. For " @@ -944,17 +955,17 @@ msgstr "" "此語法在大多情況下與舊式的 ``%`` 格式類似,只是增加了 ``{}`` 和 ``:`` 來取代 " "``%``。例如,``'%03.2f'`` 可以改寫為 ``'{:03.2f}'``。" -#: ../../library/string.rst:621 +#: ../../library/string.rst:628 msgid "" "The new format syntax also supports new and different options, shown in the " "following examples." msgstr "新的語法還支援新的選項,將在以下的範例中說明。" -#: ../../library/string.rst:624 +#: ../../library/string.rst:631 msgid "Accessing arguments by position::" msgstr "按位置存取引數: ::" -#: ../../library/string.rst:626 +#: ../../library/string.rst:633 msgid "" ">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" "'a, b, c'\n" @@ -979,11 +990,11 @@ msgstr "" ">>> '{0}{1}{0}'.format('abra', 'cad') # 引數索引可以重複\n" "'abracadabra'" -#: ../../library/string.rst:637 +#: ../../library/string.rst:644 msgid "Accessing arguments by name::" msgstr "按名稱存取引數: ::" -#: ../../library/string.rst:639 +#: ../../library/string.rst:646 msgid "" ">>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', " "longitude='-115.81W')\n" @@ -993,11 +1004,11 @@ msgid "" "'Coordinates: 37.24N, -115.81W'" msgstr "" -#: ../../library/string.rst:645 +#: ../../library/string.rst:652 msgid "Accessing arguments' attributes::" msgstr "存取引數的屬性: ::" -#: ../../library/string.rst:647 +#: ../../library/string.rst:654 msgid "" ">>> c = 3-5j\n" ">>> ('The complex number {0} is formed from the real part {0.real} '\n" @@ -1014,11 +1025,11 @@ msgid "" "'Point(4, 2)'" msgstr "" -#: ../../library/string.rst:660 +#: ../../library/string.rst:667 msgid "Accessing arguments' items::" msgstr "存取引數的內容: ::" -#: ../../library/string.rst:662 +#: ../../library/string.rst:669 msgid "" ">>> coord = (3, 5)\n" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" @@ -1028,11 +1039,11 @@ msgstr "" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" "'X: 3; Y: 5'" -#: ../../library/string.rst:666 +#: ../../library/string.rst:673 msgid "Replacing ``%s`` and ``%r``::" msgstr "替換 ``%s`` 和 ``%r``: ::" -#: ../../library/string.rst:668 +#: ../../library/string.rst:675 msgid "" ">>> \"repr() shows quotes: {!r}; str() doesn't: {!s}\".format('test1', " "'test2')\n" @@ -1042,11 +1053,11 @@ msgstr "" "'test2')\n" "\"repr() shows quotes: 'test1'; str() doesn't: test2\"" -#: ../../library/string.rst:671 +#: ../../library/string.rst:678 msgid "Aligning the text and specifying a width::" msgstr "對齊文字以及指定寬度: ::" -#: ../../library/string.rst:673 +#: ../../library/string.rst:680 msgid "" ">>> '{:<30}'.format('left aligned')\n" "'left aligned '\n" @@ -1058,18 +1069,18 @@ msgid "" "'***********centered***********'" msgstr "" -#: ../../library/string.rst:682 +#: ../../library/string.rst:689 msgid "Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::" msgstr "替換 ``%+f``、``%-f`` 和 ``% f`` 以及指定正負號: ::" -#: ../../library/string.rst:684 +#: ../../library/string.rst:691 msgid "" ">>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always\n" "'+3.140000; -3.140000'\n" ">>> '{: f}; {: f}'.format(3.14, -3.14) # show a space for positive numbers\n" "' 3.140000; -3.140000'\n" -">>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as '{:" -"f}; {:f}'\n" +">>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as " +"'{:f}; {:f}'\n" "'3.140000; -3.140000'" msgstr "" ">>> '{:+f}; {:+f}'.format(3.14, -3.14) # 總會顯示\n" @@ -1080,12 +1091,12 @@ msgstr "" "同\n" "'3.140000; -3.140000'" -#: ../../library/string.rst:691 +#: ../../library/string.rst:698 msgid "" "Replacing ``%x`` and ``%o`` and converting the value to different bases::" msgstr "替換 ``%x`` 和 ``%o`` 並將其值轉換為不同的進位制: ::" -#: ../../library/string.rst:693 +#: ../../library/string.rst:700 msgid "" ">>> # format also supports binary numbers\n" ">>> \"int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}\".format(42)\n" @@ -1095,11 +1106,11 @@ msgid "" "'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'" msgstr "" -#: ../../library/string.rst:700 +#: ../../library/string.rst:707 msgid "Using the comma as a thousands separator::" msgstr "使用逗號作為千位分隔符: ::" -#: ../../library/string.rst:702 +#: ../../library/string.rst:709 msgid "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" @@ -1107,11 +1118,11 @@ msgstr "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" -#: ../../library/string.rst:705 +#: ../../library/string.rst:712 msgid "Expressing a percentage::" msgstr "表示為百分比: ::" -#: ../../library/string.rst:707 +#: ../../library/string.rst:714 msgid "" ">>> points = 19\n" ">>> total = 22\n" @@ -1123,11 +1134,11 @@ msgstr "" ">>> 'Correct answers: {:.2%}'.format(points/total)\n" "'Correct answers: 86.36%'" -#: ../../library/string.rst:712 +#: ../../library/string.rst:719 msgid "Using type-specific formatting::" msgstr "作為特定型別格式: ::" -#: ../../library/string.rst:714 +#: ../../library/string.rst:721 msgid "" ">>> import datetime\n" ">>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n" @@ -1139,11 +1150,11 @@ msgstr "" ">>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" "'2010-07-04 12:15:58'" -#: ../../library/string.rst:719 +#: ../../library/string.rst:726 msgid "Nesting arguments and more complex examples::" msgstr "巢狀引數及更多複雜範例: ::" -#: ../../library/string.rst:721 +#: ../../library/string.rst:728 msgid "" ">>> for align, text in zip('<^>', ['left', 'center', 'right']):\n" "... '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n" @@ -1201,35 +1212,36 @@ msgstr "" " 10 A 12 1010\n" " 11 B 13 1011" -#: ../../library/string.rst:753 +#: ../../library/string.rst:760 msgid "Template strings" msgstr "模板字串" -#: ../../library/string.rst:755 +#: ../../library/string.rst:762 msgid "" -"Template strings provide simpler string substitutions as described in :pep:" -"`292`. A primary use case for template strings is for internationalization " -"(i18n) since in that context, the simpler syntax and functionality makes it " -"easier to translate than other built-in string formatting facilities in " -"Python. As an example of a library built on template strings for i18n, see " -"the `flufl.i18n <https://flufli18n.readthedocs.io/en/latest/>`_ package." +"Template strings provide simpler string substitutions as described " +"in :pep:`292`. A primary use case for template strings is for " +"internationalization (i18n) since in that context, the simpler syntax and " +"functionality makes it easier to translate than other built-in string " +"formatting facilities in Python. As an example of a library built on " +"template strings for i18n, see the `flufl.i18n <https://" +"flufli18n.readthedocs.io/en/latest/>`_ package." msgstr "" "模板字串提供如 :pep:`292` 所述更簡單的字串替換。模板字串的主要用例是國際化 " "(i18n),因為在這種情況下,更簡單的語法和功能使得它比其他 Python 內建字串格式" "化工具更容易翻譯。基於模板字串建構的 i18n 函式庫範例,請參閱 `flufl.i18n " "<https://flufli18n.readthedocs.io/en/latest/>`_ 套件。" -#: ../../library/string.rst:765 +#: ../../library/string.rst:772 msgid "" "Template strings support ``$``-based substitutions, using the following " "rules:" msgstr "" -#: ../../library/string.rst:767 +#: ../../library/string.rst:774 msgid "``$$`` is an escape; it is replaced with a single ``$``." msgstr "" -#: ../../library/string.rst:769 +#: ../../library/string.rst:776 msgid "" "``$identifier`` names a substitution placeholder matching a mapping key of " "``\"identifier\"``. By default, ``\"identifier\"`` is restricted to any " @@ -1239,30 +1251,30 @@ msgid "" "specification." msgstr "" -#: ../../library/string.rst:776 +#: ../../library/string.rst:783 msgid "" "``${identifier}`` is equivalent to ``$identifier``. It is required when " "valid identifier characters follow the placeholder but are not part of the " "placeholder, such as ``\"${noun}ification\"``." msgstr "" -#: ../../library/string.rst:780 +#: ../../library/string.rst:787 msgid "" -"Any other appearance of ``$`` in the string will result in a :exc:" -"`ValueError` being raised." +"Any other appearance of ``$`` in the string will result in " +"a :exc:`ValueError` being raised." msgstr "" -#: ../../library/string.rst:783 +#: ../../library/string.rst:790 msgid "" "The :mod:`string` module provides a :class:`Template` class that implements " "these rules. The methods of :class:`Template` are:" msgstr "" -#: ../../library/string.rst:789 +#: ../../library/string.rst:796 msgid "The constructor takes a single argument which is the template string." msgstr "" -#: ../../library/string.rst:794 +#: ../../library/string.rst:801 msgid "" "Performs the template substitution, returning a new string. *mapping* is " "any dictionary-like object with keys that match the placeholders in the " @@ -1274,7 +1286,7 @@ msgstr "" "的字典型物件。或者如果關鍵字就是佔位符號時,你也可以改提供關鍵字引數。當 " "*mapping* 跟 *kwds* 同時給定並存在重複時,*kwds* 的佔位符號會被優先使用。" -#: ../../library/string.rst:803 +#: ../../library/string.rst:810 msgid "" "Like :meth:`substitute`, except that if placeholders are missing from " "*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the " @@ -1287,7 +1299,7 @@ msgstr "" "與 :meth:`substitute` 不同的是,任何包含 ``$`` 的字句會直接回傳 ``$`` 而非引" "發 :exc:`ValueError`。" -#: ../../library/string.rst:809 +#: ../../library/string.rst:816 msgid "" "While other exceptions may still occur, this method is called \"safe\" " "because it always tries to return a usable string instead of raising an " @@ -1301,26 +1313,26 @@ msgstr "" "完全安全,因為它會默默忽略格式錯誤的模板,這些模板包含了多餘的左右定界符、不" "匹配的括號,或者不是有效的 Python 識別字的佔位符號。" -#: ../../library/string.rst:819 +#: ../../library/string.rst:826 msgid "" -"Returns false if the template has invalid placeholders that will cause :meth:" -"`substitute` to raise :exc:`ValueError`." +"Returns false if the template has invalid placeholders that will " +"cause :meth:`substitute` to raise :exc:`ValueError`." msgstr "" "如果模板有將導致 :meth:`substitute` 引發 :exc:`ValueError` 的無效佔位符號,就" "會回傳 false。" -#: ../../library/string.rst:827 +#: ../../library/string.rst:834 msgid "" "Returns a list of the valid identifiers in the template, in the order they " "first appear, ignoring any invalid identifiers." msgstr "" "回傳模板中有效識別字的串列,按照它們首次出現的順序,並忽略任何無效的識別字。" -#: ../../library/string.rst:832 +#: ../../library/string.rst:839 msgid ":class:`Template` instances also provide one public data attribute:" msgstr ":class:`Template` 實例也提供一個公開的資料屬性:" -#: ../../library/string.rst:836 +#: ../../library/string.rst:843 msgid "" "This is the object passed to the constructor's *template* argument. In " "general, you shouldn't change it, but read-only access is not enforced." @@ -1328,11 +1340,11 @@ msgstr "" "這是傳遞給建構函式 *template* 引數的物件。一般來說,你不應該改變它,但並沒有" "強制設定成唯讀。" -#: ../../library/string.rst:839 +#: ../../library/string.rst:846 msgid "Here is an example of how to use a Template::" msgstr "以下是如何使用 Template 的一個範例: ::" -#: ../../library/string.rst:841 +#: ../../library/string.rst:848 msgid "" ">>> from string import Template\n" ">>> s = Template('$who likes $what')\n" @@ -1366,7 +1378,7 @@ msgstr "" ">>> Template('$who likes $what').safe_substitute(d)\n" "'tim likes $what'" -#: ../../library/string.rst:857 +#: ../../library/string.rst:864 msgid "" "Advanced usage: you can derive subclasses of :class:`Template` to customize " "the placeholder syntax, delimiter character, or the entire regular " @@ -1376,21 +1388,21 @@ msgstr "" "進階用法:你可以衍生 :class:`Template` 類別來自定義佔位符號語法、左右定界符字" "元,或者用於剖析模板字串的正規表示式。你可以透過覆寫這些類別屬性來達成:" -#: ../../library/string.rst:862 +#: ../../library/string.rst:869 msgid "" "*delimiter* -- This is the literal string describing a placeholder " "introducing delimiter. The default value is ``$``. Note that this should " -"*not* be a regular expression, as the implementation will call :meth:`re." -"escape` on this string as needed. Note further that you cannot change the " -"delimiter after class creation (i.e. a different delimiter must be set in " -"the subclass's class namespace)." +"*not* be a regular expression, as the implementation will " +"call :meth:`re.escape` on this string as needed. Note further that you " +"cannot change the delimiter after class creation (i.e. a different delimiter " +"must be set in the subclass's class namespace)." msgstr "" "*delimiter* -- 這是描述引入左右定界符的文字字串。預設值是 ``$``。請注意這\\ *" "不是*\\ 正規表示式,因為實作會在需要時對這個字串呼叫 :meth:`re.escape`。也請" "注意你不能在建立類別後修改左右定界符。(意即在子類別的命名空間中必須設置不同" "的左右定界符)" -#: ../../library/string.rst:869 +#: ../../library/string.rst:876 msgid "" "*idpattern* -- This is the regular expression describing the pattern for non-" "braced placeholders. The default value is the regular expression ``(?a:[_a-" @@ -1398,19 +1410,19 @@ msgid "" "pattern will also apply to braced placeholders." msgstr "" -#: ../../library/string.rst:876 +#: ../../library/string.rst:883 msgid "" "Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with " "some non-ASCII characters. That's why we use the local ``a`` flag here." msgstr "" -#: ../../library/string.rst:880 +#: ../../library/string.rst:887 msgid "" "*braceidpattern* can be used to define separate patterns used inside and " "outside the braces." msgstr "" -#: ../../library/string.rst:884 +#: ../../library/string.rst:891 msgid "" "*braceidpattern* -- This is like *idpattern* but describes the pattern for " "braced placeholders. Defaults to ``None`` which means to fall back to " @@ -1419,7 +1431,7 @@ msgid "" "unbraced placeholders." msgstr "" -#: ../../library/string.rst:892 +#: ../../library/string.rst:899 msgid "" "*flags* -- The regular expression flags that will be applied when compiling " "the regular expression used for recognizing substitutions. The default " @@ -1428,7 +1440,7 @@ msgid "" "regular expressions." msgstr "" -#: ../../library/string.rst:900 +#: ../../library/string.rst:907 msgid "" "Alternatively, you can provide the entire regular expression pattern by " "overriding the class attribute *pattern*. If you do this, the value must be " @@ -1437,13 +1449,13 @@ msgid "" "placeholder rule:" msgstr "" -#: ../../library/string.rst:906 +#: ../../library/string.rst:913 msgid "" "*escaped* -- This group matches the escape sequence, e.g. ``$$``, in the " "default pattern." msgstr "*escaped* -- 此群組與跳脫序列匹配,例如在預設模式下為 ``$$``。" -#: ../../library/string.rst:909 +#: ../../library/string.rst:916 msgid "" "*named* -- This group matches the unbraced placeholder name; it should not " "include the delimiter in capturing group." @@ -1451,7 +1463,7 @@ msgstr "" "*named* -- 此群組與不帶大括號的佔位符號名稱匹配;它不應包含擷取群組中的左右定" "界符號。" -#: ../../library/string.rst:912 +#: ../../library/string.rst:919 msgid "" "*braced* -- This group matches the brace enclosed placeholder name; it " "should not include either the delimiter or braces in the capturing group." @@ -1459,7 +1471,7 @@ msgstr "" "*braced* -- 此群組與大括號括起來的佔位符號名稱匹配;它不應在擷取群組中包含左" "右定界符或大括號。" -#: ../../library/string.rst:915 +#: ../../library/string.rst:922 msgid "" "*invalid* -- This group matches any other delimiter pattern (usually a " "single delimiter), and it should appear last in the regular expression." @@ -1467,103 +1479,103 @@ msgstr "" "*invalid* -- 此群組與任何其他左右定界符模式(通常是單一左右定界符)匹配,且它" "應該出現在正規表示式的最後。" -#: ../../library/string.rst:918 +#: ../../library/string.rst:925 msgid "" "The methods on this class will raise :exc:`ValueError` if the pattern " "matches the template without one of these named groups matching." msgstr "" -"當此模式有匹配於模板但這些命名組中卻有任一個不匹配,此類別的方法將引發 :exc:" -"`ValueError`。" +"當此模式有匹配於模板但這些命名組中卻有任一個不匹配,此類別的方法將引" +"發 :exc:`ValueError`。" -#: ../../library/string.rst:923 +#: ../../library/string.rst:930 msgid "Helper functions" msgstr "輔助函式" -#: ../../library/string.rst:927 +#: ../../library/string.rst:934 msgid "" "Split the argument into words using :meth:`str.split`, capitalize each word " -"using :meth:`str.capitalize`, and join the capitalized words using :meth:" -"`str.join`. If the optional second argument *sep* is absent or ``None``, " -"runs of whitespace characters are replaced by a single space and leading and " -"trailing whitespace are removed, otherwise *sep* is used to split and join " -"the words." +"using :meth:`str.capitalize`, and join the capitalized words " +"using :meth:`str.join`. If the optional second argument *sep* is absent or " +"``None``, runs of whitespace characters are replaced by a single space and " +"leading and trailing whitespace are removed, otherwise *sep* is used to " +"split and join the words." msgstr "" "使用 :meth:`str.split` 將引數分割為字詞,使用 :meth:`str.capitalize` 將每個單" "字大寫,並使用 :meth:`str.join` 將大寫字詞連接起來。如果可選的第二引數 *sep* " "不存在或為 ``None``,則連續的空白字元將替換為單一空格,並且刪除前導和尾隨空" "白;在其他情況下則使用 *sep* 來分割和連接單字。" -#: ../../library/string.rst:195 +#: ../../library/string.rst:202 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/string.rst:195 ../../library/string.rst:335 -#: ../../library/string.rst:368 ../../library/string.rst:387 -#: ../../library/string.rst:396 ../../library/string.rst:410 -#: ../../library/string.rst:421 +#: ../../library/string.rst:202 ../../library/string.rst:342 +#: ../../library/string.rst:375 ../../library/string.rst:394 +#: ../../library/string.rst:403 ../../library/string.rst:417 +#: ../../library/string.rst:428 msgid "in string formatting" msgstr "於字串格式化" -#: ../../library/string.rst:195 +#: ../../library/string.rst:202 msgid ". (dot)" msgstr ". (點)" -#: ../../library/string.rst:195 +#: ../../library/string.rst:202 msgid "[] (square brackets)" msgstr "[] (方括號)" -#: ../../library/string.rst:195 +#: ../../library/string.rst:202 msgid "! (exclamation)" msgstr "! (驚嘆號)" -#: ../../library/string.rst:195 +#: ../../library/string.rst:202 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/string.rst:335 +#: ../../library/string.rst:342 msgid "< (less)" msgstr "< (小於)" -#: ../../library/string.rst:335 +#: ../../library/string.rst:342 msgid "> (greater)" msgstr "> (大於)" -#: ../../library/string.rst:335 +#: ../../library/string.rst:342 msgid "= (equals)" msgstr "= (等於)" -#: ../../library/string.rst:335 +#: ../../library/string.rst:342 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../library/string.rst:368 +#: ../../library/string.rst:375 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../library/string.rst:368 +#: ../../library/string.rst:375 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/string.rst:387 +#: ../../library/string.rst:394 msgid "z" msgstr "z" -#: ../../library/string.rst:396 +#: ../../library/string.rst:403 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/string.rst:410 +#: ../../library/string.rst:417 msgid ", (comma)" msgstr ", (逗號)" -#: ../../library/string.rst:421 +#: ../../library/string.rst:428 msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../library/string.rst:763 +#: ../../library/string.rst:770 msgid "$ (dollar)" msgstr "$ (金錢符號)" -#: ../../library/string.rst:763 +#: ../../library/string.rst:770 msgid "in template strings" msgstr "於 template strings(模板字串)" diff --git a/library/sys.po b/library/sys.po index 0cafa0cde7..99a0ab456f 100644 --- a/library/sys.po +++ b/library/sys.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-13 00:13+0000\n" +"POT-Creation-Date: 2025-01-18 00:13+0000\n" "PO-Revision-Date: 2023-04-26 02:54+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,7 +27,8 @@ msgstr ":mod:`!sys` --- 系統特定的參數與函式" msgid "" "This module provides access to some variables used or maintained by the " "interpreter and to functions that interact strongly with the interpreter. It " -"is always available." +"is always available. Unless explicitly noted otherwise, all variables are " +"read-only." msgstr "" #: ../../library/sys.rst:16 diff --git a/library/sysconfig.po b/library/sysconfig.po index 7a2c3ec0df..7323abb9ea 100644 --- a/library/sysconfig.po +++ b/library/sysconfig.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-04 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,9 +23,8 @@ msgid "" msgstr ":mod:`!sysconfig` --- 提供 Python 設定資訊的存取" #: ../../library/sysconfig.rst:12 -#, fuzzy msgid "**Source code:** :source:`Lib/sysconfig`" -msgstr "**原始碼:**\\ :source:`Lib/sysconfig.py`" +msgstr "**原始碼:**\\ :source:`Lib/sysconfig`" #: ../../library/sysconfig.rst:19 msgid "" @@ -110,10 +109,10 @@ msgstr "" #: ../../library/sysconfig.rst:70 msgid "" "Python uses an installation scheme that differs depending on the platform " -"and on the installation options. These schemes are stored in :mod:" -"`sysconfig` under unique identifiers based on the value returned by :const:" -"`os.name`. The schemes are used by package installers to determine where to " -"copy files to." +"and on the installation options. These schemes are stored " +"in :mod:`sysconfig` under unique identifiers based on the value returned " +"by :const:`os.name`. The schemes are used by package installers to determine " +"where to copy files to." msgstr "" #: ../../library/sysconfig.rst:75 @@ -135,8 +134,8 @@ msgstr "" #: ../../library/sysconfig.rst:81 msgid "" "*posix_user*: scheme for POSIX platforms, when the *user* option is used. " -"This scheme defines paths located under the user's home directory (:const:" -"`site.USER_BASE`)." +"This scheme defines paths located under the user's home directory " +"(:const:`site.USER_BASE`)." msgstr "" #: ../../library/sysconfig.rst:84 @@ -234,8 +233,8 @@ msgstr "" msgid "" "Files will be installed into subdirectories of :const:`site.USER_BASE` " "(written as :file:`{userbase}` hereafter). This scheme installs pure Python " -"modules and extension modules in the same location (also known as :const:" -"`site.USER_SITE`)." +"modules and extension modules in the same location (also known " +"as :const:`site.USER_SITE`)." msgstr "" #: ../../library/sysconfig.rst:126 @@ -358,8 +357,8 @@ msgid "" "The idea behind the \"home scheme\" is that you build and maintain a " "personal stash of Python modules. This scheme's name is derived from the " "idea of a \"home\" directory on Unix, since it's not unusual for a Unix user " -"to make their home directory have a layout similar to :file:`/usr/` or :file:" -"`/usr/local/`. This scheme can be used by anyone, regardless of the " +"to make their home directory have a layout similar to :file:`/usr/` " +"or :file:`/usr/local/`. This scheme can be used by anyone, regardless of the " "operating system they are installing for." msgstr "" @@ -480,8 +479,8 @@ msgstr "" #: ../../library/sysconfig.rst:265 msgid "" -"Return a tuple containing all schemes currently supported in :mod:" -"`sysconfig`." +"Return a tuple containing all schemes currently supported " +"in :mod:`sysconfig`." msgstr "" #: ../../library/sysconfig.rst:271 @@ -533,14 +532,14 @@ msgstr "" #: ../../library/sysconfig.rst:307 msgid "" -"End users should not use this function, but :func:`get_default_scheme` and :" -"func:`get_preferred_scheme` instead." +"End users should not use this function, but :func:`get_default_scheme` " +"and :func:`get_preferred_scheme` instead." msgstr "" #: ../../library/sysconfig.rst:315 msgid "" -"Return a tuple containing all path names currently supported in :mod:" -"`sysconfig`." +"Return a tuple containing all path names currently supported " +"in :mod:`sysconfig`." msgstr "" #: ../../library/sysconfig.rst:321 @@ -570,9 +569,9 @@ msgstr "" #: ../../library/sysconfig.rst:334 msgid "" -"If *scheme* is provided, it must be a value from the list returned by :func:" -"`get_scheme_names`. Otherwise, the default scheme for the current platform " -"is used." +"If *scheme* is provided, it must be a value from the list returned " +"by :func:`get_scheme_names`. Otherwise, the default scheme for the current " +"platform is used." msgstr "" #: ../../library/sysconfig.rst:338 @@ -615,8 +614,8 @@ msgstr "" #: ../../library/sysconfig.rst:360 msgid "" -"If *scheme* is not an existing scheme, :func:`get_paths` will raise a :exc:" -"`KeyError`." +"If *scheme* is not an existing scheme, :func:`get_paths` will raise " +"a :exc:`KeyError`." msgstr "" #: ../../library/sysconfig.rst:365 @@ -628,8 +627,8 @@ msgid "" "Return the ``MAJOR.MINOR`` Python version number as a string. Similar to " "``'%d.%d' % sys.version_info[:2]``." msgstr "" -"回傳 ``MAJOR.MINOR`` Python 版本號碼字串。類似於 ``'%d.%d' % sys." -"version_info[:2]``。" +"回傳 ``MAJOR.MINOR`` Python 版本號碼字串。類似於 ``'%d.%d' % " +"sys.version_info[:2]``。" #: ../../library/sysconfig.rst:375 msgid "Return a string that identifies the current platform." @@ -665,78 +664,82 @@ msgid "Windows will return one of:" msgstr "" #: ../../library/sysconfig.rst:391 -msgid "win-amd64 (64bit Windows on AMD64, aka x86_64, Intel64, and EM64T)" +msgid "win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)" msgstr "" #: ../../library/sysconfig.rst:392 +msgid "win-arm64 (64-bit Windows on ARM64, aka AArch64)" +msgstr "" + +#: ../../library/sysconfig.rst:393 msgid "win32 (all others - specifically, sys.platform is returned)" msgstr "" -#: ../../library/sysconfig.rst:394 +#: ../../library/sysconfig.rst:395 msgid "macOS can return:" msgstr "" -#: ../../library/sysconfig.rst:396 +#: ../../library/sysconfig.rst:397 msgid "macosx-10.6-ppc" msgstr "macosx-10.6-ppc" -#: ../../library/sysconfig.rst:397 +#: ../../library/sysconfig.rst:398 msgid "macosx-10.4-ppc64" msgstr "macosx-10.4-ppc64" -#: ../../library/sysconfig.rst:398 +#: ../../library/sysconfig.rst:399 msgid "macosx-10.3-i386" msgstr "macosx-10.3-i386" -#: ../../library/sysconfig.rst:399 +#: ../../library/sysconfig.rst:400 msgid "macosx-10.4-fat" msgstr "macosx-10.4-fat" -#: ../../library/sysconfig.rst:401 +#: ../../library/sysconfig.rst:402 msgid "" "For other non-POSIX platforms, currently just returns :data:`sys.platform`." msgstr "" -#: ../../library/sysconfig.rst:406 +#: ../../library/sysconfig.rst:407 msgid "" "Return ``True`` if the running Python interpreter was built from source and " "is being run from its built location, and not from a location resulting from " "e.g. running ``make install`` or installing via a binary installer." msgstr "" -#: ../../library/sysconfig.rst:413 +#: ../../library/sysconfig.rst:414 msgid "Parse a :file:`config.h`\\-style file." msgstr "" -#: ../../library/sysconfig.rst:415 +#: ../../library/sysconfig.rst:416 msgid "" "*fp* is a file-like object pointing to the :file:`config.h`\\-like file." msgstr "" -#: ../../library/sysconfig.rst:417 +#: ../../library/sysconfig.rst:418 msgid "" "A dictionary containing name/value pairs is returned. If an optional " "dictionary is passed in as the second argument, it is used instead of a new " "dictionary, and updated with the values read in the file." msgstr "" -#: ../../library/sysconfig.rst:424 +#: ../../library/sysconfig.rst:425 msgid "Return the path of :file:`pyconfig.h`." msgstr "回傳 :file:`pyconfig.h` 的路徑。" -#: ../../library/sysconfig.rst:428 +#: ../../library/sysconfig.rst:429 msgid "Return the path of :file:`Makefile`." msgstr "回傳 :file:`Makefile` 的路徑。" -#: ../../library/sysconfig.rst:433 +#: ../../library/sysconfig.rst:434 msgid "Using :mod:`sysconfig` as a script" msgstr "將 :mod:`sysconfig` 作為腳本使用" -#: ../../library/sysconfig.rst:435 +#: ../../library/sysconfig.rst:436 msgid "You can use :mod:`sysconfig` as a script with Python's *-m* option:" msgstr "" -#: ../../library/sysconfig.rst:437 +#: ../../library/sysconfig.rst:438 msgid "" "$ python -m sysconfig\n" "Platform: \"macosx-10.4-i386\"\n" @@ -782,11 +785,11 @@ msgstr "" " ARFLAGS = \"rc\"\n" " ..." -#: ../../library/sysconfig.rst:461 +#: ../../library/sysconfig.rst:462 msgid "" -"This call will print in the standard output the information returned by :" -"func:`get_platform`, :func:`get_python_version`, :func:`get_path` and :func:" -"`get_config_vars`." +"This call will print in the standard output the information returned " +"by :func:`get_platform`, :func:`get_python_version`, :func:`get_path` " +"and :func:`get_config_vars`." msgstr "" #: ../../library/sysconfig.rst:14 diff --git a/library/time.po b/library/time.po index db6badd4c8..52833ec856 100644 --- a/library/time.po +++ b/library/time.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-12 00:13+0000\n" +"POT-Creation-Date: 2025-01-19 00:15+0000\n" "PO-Revision-Date: 2024-11-20 15:25+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -120,9 +119,9 @@ msgstr "" msgid "" "On the other hand, the precision of :func:`.time` and :func:`sleep` is " "better than their Unix equivalents: times are expressed as floating-point " -"numbers, :func:`.time` returns the most accurate time available (using Unix :" -"c:func:`!gettimeofday` where available), and :func:`sleep` will accept a " -"time with a nonzero fraction (Unix :c:func:`!select` is used to implement " +"numbers, :func:`.time` returns the most accurate time available (using " +"Unix :c:func:`!gettimeofday` where available), and :func:`sleep` will accept " +"a time with a nonzero fraction (Unix :c:func:`!select` is used to implement " "this, where available)." msgstr "" "另一方面,:func:`.time` 和 :func:`sleep` 的精確度比它們的在 Unix 的等效函式更" @@ -132,16 +131,16 @@ msgstr "" #: ../../library/time.rst:78 msgid "" -"The time value as returned by :func:`gmtime`, :func:`localtime`, and :func:" -"`strptime`, and accepted by :func:`asctime`, :func:`mktime` and :func:" -"`strftime`, is a sequence of 9 integers. The return values of :func:" -"`gmtime`, :func:`localtime`, and :func:`strptime` also offer attribute names " -"for individual fields." +"The time value as returned by :func:`gmtime`, :func:`localtime`, " +"and :func:`strptime`, and accepted by :func:`asctime`, :func:`mktime` " +"and :func:`strftime`, is a sequence of 9 integers. The return values " +"of :func:`gmtime`, :func:`localtime`, and :func:`strptime` also offer " +"attribute names for individual fields." msgstr "" -"由 :func:`gmtime`、:func:`localtime` 和 :func:`strptime` 回傳,並由 :func:" -"`asctime`、:func:`mktime` 和 :func:`strftime` 接受的時間值,是一個 9 個整數的" -"序列。:func:`gmtime`、:func:`localtime` 和 :func:`strptime` 的回傳值也為各個" -"欄位提供屬性名稱。" +"由 :func:`gmtime`、:func:`localtime` 和 :func:`strptime` 回傳,並" +"由 :func:`asctime`、:func:`mktime` 和 :func:`strftime` 接受的時間值,是一個 " +"9 個整數的序列。:func:`gmtime`、:func:`localtime` 和 :func:`strptime` 的回傳" +"值也為各個欄位提供屬性名稱。" #: ../../library/time.rst:84 msgid "See :class:`struct_time` for a description of these objects." @@ -149,20 +148,20 @@ msgstr "關於這些物件的敘述請見 :class:`struct_time`。" #: ../../library/time.rst:86 msgid "" -"The :class:`struct_time` type was extended to provide the :attr:" -"`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` attributes when " -"platform supports corresponding ``struct tm`` members." +"The :class:`struct_time` type was extended to provide " +"the :attr:`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` " +"attributes when platform supports corresponding ``struct tm`` members." msgstr "" "當平台支援對應的 ``struct tm`` 成員時,:class:`struct_time` 型別被擴展以提" "供 :attr:`~struct_time.tm_gmtoff` 和 :attr:`~struct_time.tm_zone` 屬性。" #: ../../library/time.rst:92 msgid "" -"The :class:`struct_time` attributes :attr:`~struct_time.tm_gmtoff` and :attr:" -"`~struct_time.tm_zone` are now available on all platforms." +"The :class:`struct_time` attributes :attr:`~struct_time.tm_gmtoff` " +"and :attr:`~struct_time.tm_zone` are now available on all platforms." msgstr "" -":class:`struct_time` 的屬性 :attr:`~struct_time.tm_gmtoff` 和 :attr:" -"`~struct_time.tm_zone` 現在在所有平台上都可用。" +":class:`struct_time` 的屬性 :attr:`~struct_time.tm_gmtoff` " +"和 :attr:`~struct_time.tm_zone` 現在在所有平台上都可用。" #: ../../library/time.rst:97 msgid "Use the following functions to convert between time representations:" @@ -216,10 +215,11 @@ msgstr "函式" #: ../../library/time.rst:123 msgid "" -"Convert a tuple or :class:`struct_time` representing a time as returned by :" -"func:`gmtime` or :func:`localtime` to a string of the following form: ``'Sun " -"Jun 20 23:21:05 1993'``. The day field is two characters long and is space " -"padded if the day is a single digit, e.g.: ``'Wed Jun 9 04:26:40 1993'``." +"Convert a tuple or :class:`struct_time` representing a time as returned " +"by :func:`gmtime` or :func:`localtime` to a string of the following form: " +"``'Sun Jun 20 23:21:05 1993'``. The day field is two characters long and is " +"space padded if the day is a single digit, e.g.: ``'Wed Jun 9 04:26:40 " +"1993'``." msgstr "" "將由 :func:`gmtime` 或 :func:`localtime` 回傳的元組或 :class:`struct_time` 表" "示的時間轉換為以下格式的字串:``'Sun Jun 20 23:21:05 1993'``。日期欄位為兩個" @@ -252,8 +252,8 @@ msgid "" "attribute of :class:`threading.Thread` objects to get a suitable value for " "*thread_id*." msgstr "" -"使用 :func:`threading.get_ident` 或 :class:`threading.Thread` 物件的 :attr:" -"`~threading.Thread.ident` 屬性來獲取適用於 *thread_id* 的值。" +"使用 :func:`threading.get_ident` 或 :class:`threading.Thread` 物件" +"的 :attr:`~threading.Thread.ident` 屬性來獲取適用於 *thread_id* 的值。" #: ../../library/time.rst:146 msgid "" @@ -266,14 +266,14 @@ msgstr "" #: ../../library/time.rst:149 ../../library/time.rst:161 #: ../../library/time.rst:174 ../../library/time.rst:183 #: ../../library/time.rst:196 ../../library/time.rst:205 -#: ../../library/time.rst:734 ../../library/time.rst:758 -#: ../../library/time.rst:854 ../../library/time.rst:865 -#: ../../library/time.rst:875 ../../library/time.rst:885 -#: ../../library/time.rst:894 ../../library/time.rst:903 -#: ../../library/time.rst:912 ../../library/time.rst:923 -#: ../../library/time.rst:931 ../../library/time.rst:942 -#: ../../library/time.rst:953 ../../library/time.rst:962 -#: ../../library/time.rst:975 +#: ../../library/time.rst:743 ../../library/time.rst:767 +#: ../../library/time.rst:863 ../../library/time.rst:874 +#: ../../library/time.rst:884 ../../library/time.rst:894 +#: ../../library/time.rst:903 ../../library/time.rst:912 +#: ../../library/time.rst:921 ../../library/time.rst:932 +#: ../../library/time.rst:940 ../../library/time.rst:951 +#: ../../library/time.rst:962 ../../library/time.rst:971 +#: ../../library/time.rst:984 msgid "Availability" msgstr "" @@ -296,13 +296,13 @@ msgid "" "Return the time of the specified clock *clk_id*. Refer to :ref:`time-clock-" "id-constants` for a list of accepted values for *clk_id*." msgstr "" -"回傳指定時鐘 *clk_id* 的時間。有關 *clk_id* 可接受的值的串列,請參閱 :ref:" -"`time-clock-id-constants`。" +"回傳指定時鐘 *clk_id* 的時間。有關 *clk_id* 可接受的值的串列,請參" +"閱 :ref:`time-clock-id-constants`。" #: ../../library/time.rst:171 msgid "" -"Use :func:`clock_gettime_ns` to avoid the precision loss caused by the :" -"class:`float` type." +"Use :func:`clock_gettime_ns` to avoid the precision loss caused by " +"the :class:`float` type." msgstr "" "使用 :func:`clock_gettime_ns` 以避免 :class:`float` 型別造成的精確度損失。" @@ -313,16 +313,16 @@ msgstr "" #: ../../library/time.rst:190 msgid "" -"Set the time of the specified clock *clk_id*. Currently, :data:" -"`CLOCK_REALTIME` is the only accepted value for *clk_id*." +"Set the time of the specified clock *clk_id*. " +"Currently, :data:`CLOCK_REALTIME` is the only accepted value for *clk_id*." msgstr "" "設定指定時鐘 *clk_id* 的時間。目前,:data:`CLOCK_REALTIME` 是 *clk_id* 唯一可" "以接受的值。" #: ../../library/time.rst:193 msgid "" -"Use :func:`clock_settime_ns` to avoid the precision loss caused by the :" -"class:`float` type." +"Use :func:`clock_settime_ns` to avoid the precision loss caused by " +"the :class:`float` type." msgstr "" "使用 :func:`clock_settime_ns` 以避免 :class:`float` 型別造成的精確度損失。" @@ -343,10 +343,10 @@ msgstr "" #: ../../library/time.rst:217 msgid "" -"If *secs* is not provided or :const:`None`, the current time as returned by :" -"func:`.time` is used. ``ctime(secs)`` is equivalent to " -"``asctime(localtime(secs))``. Locale information is not used by :func:" -"`ctime`." +"If *secs* is not provided or :const:`None`, the current time as returned " +"by :func:`.time` is used. ``ctime(secs)`` is equivalent to " +"``asctime(localtime(secs))``. Locale information is not used " +"by :func:`ctime`." msgstr "" "如果未提供 *secs* 或其為 :const:`None`,則使用由 :func:`.time` 回傳的當前時" "間。``ctime(secs)`` 等同於 ``asctime(localtime(secs))``。:func:`ctime` 不使用" @@ -397,8 +397,8 @@ msgid "" "*implementation*: The name of the underlying C function used to get the " "clock value. Refer to :ref:`time-clock-id-constants` for possible values." msgstr "" -"*implementation*: 用於獲取時鐘的值的底層 C 函式名稱。有關可能的值,請參閱 :" -"ref:`time-clock-id-constants`。" +"*implementation*: 用於獲取時鐘的值的底層 C 函式名稱。有關可能的值,請參" +"閱 :ref:`time-clock-id-constants`。" #: ../../library/time.rst:241 msgid "" @@ -411,12 +411,12 @@ msgstr "*resolution*: 以秒 (:class:`float`) 為單位的時鐘的解析度" #: ../../library/time.rst:250 msgid "" -"Convert a time expressed in seconds since the epoch_ to a :class:" -"`struct_time` in UTC in which the dst flag is always zero. If *secs* is not " -"provided or :const:`None`, the current time as returned by :func:`.time` is " -"used. Fractions of a second are ignored. See above for a description of " -"the :class:`struct_time` object. See :func:`calendar.timegm` for the inverse " -"of this function." +"Convert a time expressed in seconds since the epoch_ to " +"a :class:`struct_time` in UTC in which the dst flag is always zero. If " +"*secs* is not provided or :const:`None`, the current time as returned " +"by :func:`.time` is used. Fractions of a second are ignored. See above for " +"a description of the :class:`struct_time` object. " +"See :func:`calendar.timegm` for the inverse of this function." msgstr "" "將自 epoch_ 起以秒表示的時間轉換為 UTC 中的 :class:`struct_time`,其中 dst 旗" "標始終為零。如果未提供 *secs* 或其為 :const:`None`,則使用由 :func:`.time` 回" @@ -429,41 +429,41 @@ msgid "" "or :const:`None`, the current time as returned by :func:`.time` is used. " "The dst flag is set to ``1`` when DST applies to the given time." msgstr "" -"類似於 :func:`gmtime`,但轉換為當地時間。如果未提供 *secs* 或其為 :const:" -"`None`,則使用由 :func:`.time` 回傳的當前時間。當 DST 適用於給定時間時,dst " -"旗標會被設定為 ``1``。" +"類似於 :func:`gmtime`,但轉換為當地時間。如果未提供 *secs* 或其" +"為 :const:`None`,則使用由 :func:`.time` 回傳的當前時間。當 DST 適用於給定時" +"間時,dst 旗標會被設定為 ``1``。" #: ../../library/time.rst:264 msgid "" ":func:`localtime` may raise :exc:`OverflowError`, if the timestamp is " "outside the range of values supported by the platform C :c:func:`localtime` " -"or :c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` or :" -"c:func:`gmtime` failure. It's common for this to be restricted to years " +"or :c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` " +"or :c:func:`gmtime` failure. It's common for this to be restricted to years " "between 1970 and 2038." msgstr "" "如果時間戳超出 C 平台的 :c:func:`localtime` 或 :c:func:`gmtime` 函式支援的範" -"圍,:func:`localtime` 可能會引發 :exc:`OverflowError`;在 :c:func:" -"`localtime` 或 :c:func:`gmtime` 失敗時,會引發 :exc:`OSError`。通常會把年份限" -"制在 1970 年到 2038 年之間。" +"圍,:func:`localtime` 可能會引發 :exc:`OverflowError`;" +"在 :c:func:`localtime` 或 :c:func:`gmtime` 失敗時,會引發 :exc:`OSError`。通" +"常會把年份限制在 1970 年到 2038 年之間。" #: ../../library/time.rst:273 msgid "" -"This is the inverse function of :func:`localtime`. Its argument is the :" -"class:`struct_time` or full 9-tuple (since the dst flag is needed; use " +"This is the inverse function of :func:`localtime`. Its argument is " +"the :class:`struct_time` or full 9-tuple (since the dst flag is needed; use " "``-1`` as the dst flag if it is unknown) which expresses the time in *local* " -"time, not UTC. It returns a floating-point number, for compatibility with :" -"func:`.time`. If the input value cannot be represented as a valid time, " -"either :exc:`OverflowError` or :exc:`ValueError` will be raised (which " +"time, not UTC. It returns a floating-point number, for compatibility " +"with :func:`.time`. If the input value cannot be represented as a valid " +"time, either :exc:`OverflowError` or :exc:`ValueError` will be raised (which " "depends on whether the invalid value is caught by Python or the underlying C " "libraries). The earliest date for which it can generate a time is platform-" "dependent." msgstr "" -"這是 :func:`localtime` 的反函式。其引數是表示\\ *當地*\\ 時間(不是 UTC)的 :" -"class:`struct_time` 或完整的 9 元組(因為需要 dst 旗標;如果 dst 為未知,則使" -"用 ``-1`` 作為 dst 旗標)。它回傳一個浮點數,以與 :func:`.time` 相容。如果輸" -"入值不能表示為有效時間,將引發 :exc:`OverflowError` 或 :exc:`ValueError`\\ " -"(取決於無效值是被 Python 還是底層 C 函式庫捕獲)。它能生成時間的最早日期根據" -"平台而有所不同。" +"這是 :func:`localtime` 的反函式。其引數是表示\\ *當地*\\ 時間(不是 UTC)" +"的 :class:`struct_time` 或完整的 9 元組(因為需要 dst 旗標;如果 dst 為未知," +"則使用 ``-1`` 作為 dst 旗標)。它回傳一個浮點數,以與 :func:`.time` 相容。如" +"果輸入值不能表示為有效時間,將引發 :exc:`OverflowError` " +"或 :exc:`ValueError`\\ (取決於無效值是被 Python 還是底層 C 函式庫捕獲)。它" +"能生成時間的最早日期根據平台而有所不同。" #: ../../library/time.rst:285 msgid "" @@ -476,7 +476,7 @@ msgstr "" "示)。該時鐘不受系統時鐘更新的影響。回傳值的參考點沒有定義,因此只有兩次呼叫" "結果之間的差異才是有效的。" -#: ../../library/time.rst:290 ../../library/time.rst:700 +#: ../../library/time.rst:290 ../../library/time.rst:709 msgid "Clock:" msgstr "時鐘:" @@ -507,8 +507,8 @@ msgstr "否則,呼叫 ``clock_gettime(CLOCK_MONOTONIC)``。" #: ../../library/time.rst:299 msgid "" -"Use :func:`monotonic_ns` to avoid the precision loss caused by the :class:" -"`float` type." +"Use :func:`monotonic_ns` to avoid the precision loss caused by " +"the :class:`float` type." msgstr "使用 :func:`monotonic_ns` 以避免 :class:`float` 型別造成的精確度損失。" #: ../../library/time.rst:304 @@ -545,8 +545,8 @@ msgstr "" #: ../../library/time.rst:333 msgid "" -"Use :func:`perf_counter_ns` to avoid the precision loss caused by the :class:" -"`float` type." +"Use :func:`perf_counter_ns` to avoid the precision loss caused by " +"the :class:`float` type." msgstr "" "使用 :func:`perf_counter_ns` 以避免 :class:`float` 型別造成的精確度損失。" @@ -576,8 +576,8 @@ msgstr "" #: ../../library/time.rst:365 msgid "" -"Use :func:`process_time_ns` to avoid the precision loss caused by the :class:" -"`float` type." +"Use :func:`process_time_ns` to avoid the precision loss caused by " +"the :class:`float` type." msgstr "" "使用 :func:`process_time_ns` 以避免 :class:`float` 型別造成的精確度損失。" @@ -608,7 +608,11 @@ msgid "" "because of the scheduling of other activity in the system." msgstr "由於系統中其他活動的調度,暫停時間可能會比請求的時間長任意的量。" -#: ../../library/time.rst:388 +#: ../../library/time.rst:389 +msgid "Windows implementation" +msgstr "Windows 實作" + +#: ../../library/time.rst:390 msgid "" "On Windows, if *secs* is zero, the thread relinquishes the remainder of its " "time slice to any other thread that is ready to run. If there are no other " @@ -624,23 +628,34 @@ msgstr "" "learn.microsoft.com/windows-hardware/drivers/kernel/high-resolution-" "timers>`_,其解析度為 100 奈秒。如果 *secs* 為零,則使用 ``Sleep(0)``。" -#: ../../library/time.rst:396 -msgid "Unix implementation:" -msgstr "Unix 實作:" +#: ../../library/time.rst:399 +msgid "Unix implementation" +msgstr "Unix 實作" -#: ../../library/time.rst:398 +#: ../../library/time.rst:400 msgid "Use ``clock_nanosleep()`` if available (resolution: 1 nanosecond);" msgstr "如果可以,使用 ``clock_nanosleep()``\\ (解析度:1 奈秒);" -#: ../../library/time.rst:399 +#: ../../library/time.rst:401 msgid "Or use ``nanosleep()`` if available (resolution: 1 nanosecond);" msgstr "或者使用 ``nanosleep()``\\ (解析度:1 奈秒);" -#: ../../library/time.rst:400 +#: ../../library/time.rst:402 msgid "Or use ``select()`` (resolution: 1 microsecond)." msgstr "或使用 ``select()``\\ (解析度:1 微秒)。" -#: ../../library/time.rst:402 +#: ../../library/time.rst:406 +msgid "" +"To emulate a \"no-op\", use :keyword:`pass` instead of ``time.sleep(0)``." +msgstr "" + +#: ../../library/time.rst:408 +msgid "" +"To voluntarily relinquish the CPU, specify a real-time :ref:`scheduling " +"policy <os-scheduling-policy>` and use :func:`os.sched_yield` instead." +msgstr "" + +#: ../../library/time.rst:411 msgid "" "Raises an :ref:`auditing event <auditing>` ``time.sleep`` with argument " "``secs``." @@ -648,7 +663,7 @@ msgstr "" "引發一個帶有引數 ``secs`` 的\\ :ref:`稽核事件 (auditing event) <auditing>` " "``time.sleep``。" -#: ../../library/time.rst:404 +#: ../../library/time.rst:413 msgid "" "The function now sleeps at least *secs* even if the sleep is interrupted by " "a signal, except if the signal handler raises an exception (see :pep:`475` " @@ -657,7 +672,7 @@ msgstr "" "即使睡眠被訊號中斷,此函式現在至少還是會睡眠 *secs*,除非訊號處理器引發例外" "(理由請參閱 :pep:`475`)。" -#: ../../library/time.rst:409 +#: ../../library/time.rst:418 msgid "" "On Unix, the ``clock_nanosleep()`` and ``nanosleep()`` functions are now " "used if available. On Windows, a waitable timer is now used." @@ -665,24 +680,24 @@ msgstr "" "在 Unix 上,如果可以的話現在會使用 ``clock_nanosleep()`` 和 ``nanosleep()`` " "函式。在 Windows 上,現在使用可等待的計時器。" -#: ../../library/time.rst:413 +#: ../../library/time.rst:422 msgid "Raises an auditing event." msgstr "引發一個稽核事件。" -#: ../../library/time.rst:421 +#: ../../library/time.rst:430 msgid "" -"Convert a tuple or :class:`struct_time` representing a time as returned by :" -"func:`gmtime` or :func:`localtime` to a string as specified by the *format* " -"argument. If *t* is not provided, the current time as returned by :func:" -"`localtime` is used. *format* must be a string. :exc:`ValueError` is " -"raised if any field in *t* is outside of the allowed range." +"Convert a tuple or :class:`struct_time` representing a time as returned " +"by :func:`gmtime` or :func:`localtime` to a string as specified by the " +"*format* argument. If *t* is not provided, the current time as returned " +"by :func:`localtime` is used. *format* must be a string. :exc:`ValueError` " +"is raised if any field in *t* is outside of the allowed range." msgstr "" -"將由 :func:`gmtime` 或 :func:`localtime` 回傳代表時間的一個元組或 :class:" -"`struct_time` 轉換為由 *format* 引數指定的字串。如果未提供 *t*,則使用由 :" -"func:`localtime` 回傳的當前時間。*format* 必須是一個字串。如果 *t* 中的任何欄" -"位超出允許範圍,將會引發 :exc:`ValueError`。" +"將由 :func:`gmtime` 或 :func:`localtime` 回傳代表時間的一個元組" +"或 :class:`struct_time` 轉換為由 *format* 引數指定的字串。如果未提供 *t*,則" +"使用由 :func:`localtime` 回傳的當前時間。*format* 必須是一個字串。如果 *t* 中" +"的任何欄位超出允許範圍,將會引發 :exc:`ValueError`。" -#: ../../library/time.rst:427 +#: ../../library/time.rst:436 msgid "" "0 is a legal argument for any position in the time tuple; if it is normally " "illegal the value is forced to a correct one." @@ -690,7 +705,7 @@ msgstr "" "0 在時間元組中的任何位置都是合法引數;如果元組中出現常見的錯誤,該值將被強制" "更改為正確的值。" -#: ../../library/time.rst:430 +#: ../../library/time.rst:439 msgid "" "The following directives can be embedded in the *format* string. They are " "shown without the optional field width and precision specification, and are " @@ -699,151 +714,151 @@ msgstr "" "以下指令可以嵌入在 *format* 字串中。它們顯示時不帶可選的欄位寬度和精度規範," "並在 :func:`strftime` 的結果中被標示的字元替換:" -#: ../../library/time.rst:435 +#: ../../library/time.rst:444 msgid "Directive" msgstr "指令" -#: ../../library/time.rst:435 +#: ../../library/time.rst:444 msgid "Meaning" msgstr "意義" -#: ../../library/time.rst:435 +#: ../../library/time.rst:444 msgid "Notes" msgstr "註解" -#: ../../library/time.rst:437 +#: ../../library/time.rst:446 msgid "``%a``" msgstr "``%a``" -#: ../../library/time.rst:437 +#: ../../library/time.rst:446 msgid "Locale's abbreviated weekday name." msgstr "區域設定的週間日 (weekday) 縮寫名稱。" -#: ../../library/time.rst:440 +#: ../../library/time.rst:449 msgid "``%A``" msgstr "``%A``" -#: ../../library/time.rst:440 +#: ../../library/time.rst:449 msgid "Locale's full weekday name." msgstr "區域設定的完整週間日名稱。" -#: ../../library/time.rst:442 +#: ../../library/time.rst:451 msgid "``%b``" msgstr "``%b``" -#: ../../library/time.rst:442 +#: ../../library/time.rst:451 msgid "Locale's abbreviated month name." msgstr "區域設定的縮寫月份名稱。" -#: ../../library/time.rst:445 +#: ../../library/time.rst:454 msgid "``%B``" msgstr "``%B``" -#: ../../library/time.rst:445 +#: ../../library/time.rst:454 msgid "Locale's full month name." msgstr "區域設定的完整月份名稱。" -#: ../../library/time.rst:447 +#: ../../library/time.rst:456 msgid "``%c``" msgstr "``%c``" -#: ../../library/time.rst:447 +#: ../../library/time.rst:456 msgid "Locale's appropriate date and time representation." msgstr "區域設定的合適的日期和時間的表示法。" -#: ../../library/time.rst:450 +#: ../../library/time.rst:459 msgid "``%d``" msgstr "``%d``" -#: ../../library/time.rst:450 +#: ../../library/time.rst:459 msgid "Day of the month as a decimal number [01,31]." msgstr "月份中的日期,表示為十進位數 [01,31]。" -#: ../../library/time.rst:453 +#: ../../library/time.rst:462 msgid "``%f``" msgstr "``%f``" -#: ../../library/time.rst:453 +#: ../../library/time.rst:462 msgid "Microseconds as a decimal number" msgstr "微秒,表示為十進位數" -#: ../../library/time.rst:454 +#: ../../library/time.rst:463 msgid "[000000,999999]." msgstr "[000000,999999]。" -#: ../../library/time.rst:453 +#: ../../library/time.rst:462 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/time.rst:457 +#: ../../library/time.rst:466 msgid "``%H``" msgstr "``%H``" -#: ../../library/time.rst:457 +#: ../../library/time.rst:466 msgid "Hour (24-hour clock) as a decimal number [00,23]." msgstr "小時(24 小時制),表示為十進位數 [00,23]。" -#: ../../library/time.rst:460 +#: ../../library/time.rst:469 msgid "``%I``" msgstr "``%I``" -#: ../../library/time.rst:460 +#: ../../library/time.rst:469 msgid "Hour (12-hour clock) as a decimal number [01,12]." msgstr "小時(12 小時制),表示為十進位數 [01,12]。" -#: ../../library/time.rst:463 +#: ../../library/time.rst:472 msgid "``%j``" msgstr "``%j``" -#: ../../library/time.rst:463 +#: ../../library/time.rst:472 msgid "Day of the year as a decimal number [001,366]." msgstr "一年中的第幾天,表示為十進位數 [001,366]。" -#: ../../library/time.rst:466 +#: ../../library/time.rst:475 msgid "``%m``" msgstr "``%m``" -#: ../../library/time.rst:466 +#: ../../library/time.rst:475 msgid "Month as a decimal number [01,12]." msgstr "月份,表示為十進位數 [01,12]。" -#: ../../library/time.rst:469 +#: ../../library/time.rst:478 msgid "``%M``" msgstr "``%M``" -#: ../../library/time.rst:469 +#: ../../library/time.rst:478 msgid "Minute as a decimal number [00,59]." msgstr "分鐘,表示為十進位數 [00,59]。" -#: ../../library/time.rst:472 +#: ../../library/time.rst:481 msgid "``%p``" msgstr "``%p``" -#: ../../library/time.rst:472 +#: ../../library/time.rst:481 msgid "Locale's equivalent of either AM or PM." msgstr "區域設定中相當於 AM 或 PM 的表示。" -#: ../../library/time.rst:472 +#: ../../library/time.rst:481 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/time.rst:475 +#: ../../library/time.rst:484 msgid "``%S``" msgstr "``%S``" -#: ../../library/time.rst:475 +#: ../../library/time.rst:484 msgid "Second as a decimal number [00,61]." msgstr "秒,表示為十進位數 [00,61]。" -#: ../../library/time.rst:475 +#: ../../library/time.rst:484 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/time.rst:478 +#: ../../library/time.rst:487 msgid "``%U``" msgstr "``%U``" -#: ../../library/time.rst:478 +#: ../../library/time.rst:487 msgid "" "Week number of the year (Sunday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Sunday are " @@ -852,31 +867,31 @@ msgstr "" "一年中的週數(星期天作為一週的第一天),表示為十進位數 [00,53]。新的一年中," "在第一個星期天之前的所有日子都被認定為第 0 週。" -#: ../../library/time.rst:478 ../../library/time.rst:492 +#: ../../library/time.rst:487 ../../library/time.rst:501 msgid "\\(4)" msgstr "\\(4)" -#: ../../library/time.rst:486 +#: ../../library/time.rst:495 msgid "``%u``" msgstr "``%u``" -#: ../../library/time.rst:486 +#: ../../library/time.rst:495 msgid "Day of the week (Monday is 1; Sunday is 7) as a decimal number [1, 7]." msgstr "一週中的日期(周一為 1;週日為 7),表示為十進位數 [1,7]。" -#: ../../library/time.rst:489 +#: ../../library/time.rst:498 msgid "``%w``" msgstr "``%w``" -#: ../../library/time.rst:489 +#: ../../library/time.rst:498 msgid "Weekday as a decimal number [0(Sunday),6]." msgstr "週間日,表示為十進位數 [0(星期天),6]。" -#: ../../library/time.rst:492 +#: ../../library/time.rst:501 msgid "``%W``" msgstr "``%W``" -#: ../../library/time.rst:492 +#: ../../library/time.rst:501 msgid "" "Week number of the year (Monday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Monday are " @@ -885,43 +900,43 @@ msgstr "" "一年中的週數(星期一作為一週的第一天),表示為十進位數 [00,53]。新的一年中," "在第一個星期一之前的所有日子都被認定為第 0 週。" -#: ../../library/time.rst:500 +#: ../../library/time.rst:509 msgid "``%x``" msgstr "``%x``" -#: ../../library/time.rst:500 +#: ../../library/time.rst:509 msgid "Locale's appropriate date representation." msgstr "區域設定的合適的日期表示法。" -#: ../../library/time.rst:503 +#: ../../library/time.rst:512 msgid "``%X``" msgstr "``%X``" -#: ../../library/time.rst:503 +#: ../../library/time.rst:512 msgid "Locale's appropriate time representation." msgstr "區域設定的合適的時間表示法。" -#: ../../library/time.rst:506 +#: ../../library/time.rst:515 msgid "``%y``" msgstr "``%y``" -#: ../../library/time.rst:506 +#: ../../library/time.rst:515 msgid "Year without century as a decimal number [00,99]." msgstr "去掉世紀的年份,表示為十進位數 [00,99]。" -#: ../../library/time.rst:509 +#: ../../library/time.rst:518 msgid "``%Y``" msgstr "``%Y``" -#: ../../library/time.rst:509 +#: ../../library/time.rst:518 msgid "Year with century as a decimal number." msgstr "帶世紀的年份,表示為十進位數。" -#: ../../library/time.rst:512 +#: ../../library/time.rst:521 msgid "``%z``" msgstr "``%z``" -#: ../../library/time.rst:512 +#: ../../library/time.rst:521 msgid "" "Time zone offset indicating a positive or negative time difference from UTC/" "GMT of the form +HHMM or -HHMM, where H represents decimal hour digits and M " @@ -930,19 +945,19 @@ msgstr "" "時區偏移量,表示與 UTC/GMT 的正或負時間差,形式為 +HHMM 或 -HHMM,其中 H 代表" "十進位的小時數碼 (digits),M 代表十進位的分鐘數碼 [-23:59, +23:59]。 [1]_" -#: ../../library/time.rst:518 +#: ../../library/time.rst:527 msgid "``%Z``" msgstr "``%Z``" -#: ../../library/time.rst:518 +#: ../../library/time.rst:527 msgid "Time zone name (no characters if no time zone exists). Deprecated. [1]_" msgstr "時區名稱(如果不存在時區,則無字元)。已被棄用。 [1]_" -#: ../../library/time.rst:521 +#: ../../library/time.rst:530 msgid "``%G``" msgstr "``%G``" -#: ../../library/time.rst:521 +#: ../../library/time.rst:530 msgid "" "ISO 8601 year (similar to ``%Y`` but follows the rules for the ISO 8601 " "calendar year). The year starts with the week that contains the first " @@ -951,11 +966,11 @@ msgstr "" "ISO 8601 年(類似於 ``%Y``,但遵循 ISO 8601 日曆年的規則)。年份從包含該日曆" "年第一個星期四的那一週開始。" -#: ../../library/time.rst:526 +#: ../../library/time.rst:535 msgid "``%V``" msgstr "``%V``" -#: ../../library/time.rst:526 +#: ../../library/time.rst:535 msgid "" "ISO 8601 week number (as a decimal number [01,53]). The first week of the " "year is the one that contains the first Thursday of the year. Weeks start on " @@ -964,30 +979,30 @@ msgstr "" "ISO 8601 週數(以十進位數表示 [01,53])。年份的第一週是包含該年第一個星期四的" "那一週。每週從星期一開始。" -#: ../../library/time.rst:531 +#: ../../library/time.rst:540 msgid "``%%``" msgstr "``%%``" -#: ../../library/time.rst:531 +#: ../../library/time.rst:540 msgid "A literal ``'%'`` character." msgstr "字面意義上的 ``'%'`` 字元。" -#: ../../library/time.rst:534 +#: ../../library/time.rst:543 msgid "Notes:" msgstr "註解:" -#: ../../library/time.rst:537 +#: ../../library/time.rst:546 msgid "" -"The ``%f`` format directive only applies to :func:`strptime`, not to :func:" -"`strftime`. However, see also :meth:`datetime.datetime.strptime` and :meth:" -"`datetime.datetime.strftime` where the ``%f`` format directive :ref:`applies " -"to microseconds <format-codes>`." +"The ``%f`` format directive only applies to :func:`strptime`, not " +"to :func:`strftime`. However, see also :meth:`datetime.datetime.strptime` " +"and :meth:`datetime.datetime.strftime` where the ``%f`` format " +"directive :ref:`applies to microseconds <format-codes>`." msgstr "" "``%f`` 格式的指令僅適用於 :func:`strptime`,不適用於 :func:`strftime`。然而," "在 :meth:`datetime.datetime.strptime` 和 :meth:`datetime.datetime.strftime` " "其中的 ``%f`` 格式的指令\\ :ref:`適用於微秒 <format-codes>`。" -#: ../../library/time.rst:543 +#: ../../library/time.rst:552 msgid "" "When used with the :func:`strptime` function, the ``%p`` directive only " "affects the output hour field if the ``%I`` directive is used to parse the " @@ -996,7 +1011,7 @@ msgstr "" "當與 :func:`strptime` 函式一起使用時,``%p`` 指令僅在使用 ``%I`` 指令剖析小時" "時影響輸出小時的欄位。" -#: ../../library/time.rst:549 +#: ../../library/time.rst:558 msgid "" "The range really is ``0`` to ``61``; value ``60`` is valid in timestamps " "representing `leap seconds`_ and value ``61`` is supported for historical " @@ -1005,7 +1020,7 @@ msgstr "" "範圍確實是從 ``0`` 到 ``61``;數值 ``60`` 在表示 `leap seconds`_ 的時間戳中是" "有效的,而數值 ``61`` 是出於歷史因素而被支援。" -#: ../../library/time.rst:554 +#: ../../library/time.rst:563 msgid "" "When used with the :func:`strptime` function, ``%U`` and ``%W`` are only " "used in calculations when the day of the week and the year are specified." @@ -1013,7 +1028,7 @@ msgstr "" "當與 :func:`strptime` 函式一起使用時,``%U`` 和 ``%W`` 僅在指定週間的某天和年" "份時用於計算中。" -#: ../../library/time.rst:557 +#: ../../library/time.rst:566 msgid "" "Here is an example, a format for dates compatible with that specified in " "the :rfc:`2822` Internet email standard. [1]_ ::" @@ -1021,7 +1036,7 @@ msgstr "" "以下是一個範例,其為一種與 :rfc:`2822` 網際網路電子郵件標準中指定的日期格式兼" "容的格式。 [1]_: ::" -#: ../../library/time.rst:560 +#: ../../library/time.rst:569 msgid "" ">>> from time import gmtime, strftime\n" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" @@ -1031,17 +1046,17 @@ msgstr "" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" "'Thu, 28 Jun 2001 14:17:15 +0000'" -#: ../../library/time.rst:564 +#: ../../library/time.rst:573 msgid "" "Additional directives may be supported on certain platforms, but only the " "ones listed here have a meaning standardized by ANSI C. To see the full set " -"of format codes supported on your platform, consult the :manpage:" -"`strftime(3)` documentation." +"of format codes supported on your platform, consult " +"the :manpage:`strftime(3)` documentation." msgstr "" "某些平台可能支援額外的指令,但只有這裡列出的指令具有 ANSI C 標準化的意義。要" "查看你的平台上支援的完整格式碼集,請參閱 :manpage:`strftime(3)` 文件。" -#: ../../library/time.rst:569 +#: ../../library/time.rst:578 msgid "" "On some platforms, an optional field width and precision specification can " "immediately follow the initial ``'%'`` of a directive in the following " @@ -1051,23 +1066,23 @@ msgstr "" "在某些平台上,可選的欄位寬度和精度規範可以以此順序緊跟在指令初始的 ``'%'`` 之" "後;這也是不可攜 (portable) 的。欄位寬度通常為 2,除了 ``%j`` 為 3。" -#: ../../library/time.rst:580 +#: ../../library/time.rst:589 msgid "" "Parse a string representing a time according to a format. The return value " "is a :class:`struct_time` as returned by :func:`gmtime` or :func:`localtime`." msgstr "" -"根據格式剖析表示時間的字串。回傳值是 :class:`struct_time`,如同由 :func:" -"`gmtime` 或 :func:`localtime` 回傳的一樣。" +"根據格式剖析表示時間的字串。回傳值是 :class:`struct_time`,如同" +"由 :func:`gmtime` 或 :func:`localtime` 回傳的一樣。" -#: ../../library/time.rst:584 +#: ../../library/time.rst:593 msgid "" -"The *format* parameter uses the same directives as those used by :func:" -"`strftime`; it defaults to ``\"%a %b %d %H:%M:%S %Y\"`` which matches the " -"formatting returned by :func:`ctime`. If *string* cannot be parsed according " -"to *format*, or if it has excess data after parsing, :exc:`ValueError` is " -"raised. The default values used to fill in any missing data when more " -"accurate values cannot be inferred are ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)``. " -"Both *string* and *format* must be strings." +"The *format* parameter uses the same directives as those used " +"by :func:`strftime`; it defaults to ``\"%a %b %d %H:%M:%S %Y\"`` which " +"matches the formatting returned by :func:`ctime`. If *string* cannot be " +"parsed according to *format*, or if it has excess data after " +"parsing, :exc:`ValueError` is raised. The default values used to fill in any " +"missing data when more accurate values cannot be inferred are ``(1900, 1, 1, " +"0, 0, 0, 0, 1, -1)``. Both *string* and *format* must be strings." msgstr "" "*format* 參數使用與 :func:`strftime` 相同的指令;預設為 ``\"%a %b %d %H:%M:" "%S %Y\"``,與 :func:`ctime` 回傳的格式匹配。如果 *string* 無法根據 *format* " @@ -1075,11 +1090,11 @@ msgstr "" "時,用來填充任何缺失資料的預設值為 ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)``。" "*string* 和 *format* 都必須是字串。" -#: ../../library/time.rst:592 +#: ../../library/time.rst:601 msgid "For example:" msgstr "例如:" -#: ../../library/time.rst:599 +#: ../../library/time.rst:608 msgid "" "Support for the ``%Z`` directive is based on the values contained in " "``tzname`` and whether ``daylight`` is true. Because of this, it is " @@ -1090,7 +1105,7 @@ msgstr "" "因此,除了識別始終已知的 UTC 和 GMT(且被考慮為非日光節約時區)外,這是特定於" "平台的。" -#: ../../library/time.rst:604 +#: ../../library/time.rst:613 msgid "" "Only the directives specified in the documentation are supported. Because " "``strftime()`` is implemented per platform it can sometimes offer more " @@ -1102,121 +1117,121 @@ msgstr "" "提供比列出的還要更多的指令。但是 ``strptime()`` 與任何平台無關,因此不一定支" "援所有未記載為支援的指令。" -#: ../../library/time.rst:613 +#: ../../library/time.rst:622 msgid "" -"The type of the time value sequence returned by :func:`gmtime`, :func:" -"`localtime`, and :func:`strptime`. It is an object with a :term:`named " -"tuple` interface: values can be accessed by index and by attribute name. " -"The following values are present:" +"The type of the time value sequence returned " +"by :func:`gmtime`, :func:`localtime`, and :func:`strptime`. It is an object " +"with a :term:`named tuple` interface: values can be accessed by index and by " +"attribute name. The following values are present:" msgstr "" "由 :func:`gmtime`、:func:`localtime` 和 :func:`strptime` 回傳的時間值序列的型" "別。它是一個具有 :term:`named tuple` 介面的物件:值可以通過索引和屬性名稱存" "取。包含以下值:" -#: ../../library/time.rst:620 +#: ../../library/time.rst:629 msgid "Index" msgstr "索引" -#: ../../library/time.rst:621 +#: ../../library/time.rst:630 msgid "Attribute" msgstr "屬性" -#: ../../library/time.rst:622 +#: ../../library/time.rst:631 msgid "Values" msgstr "值" -#: ../../library/time.rst:624 +#: ../../library/time.rst:633 msgid "0" msgstr "0" -#: ../../library/time.rst:626 +#: ../../library/time.rst:635 msgid "(for example, 1993)" msgstr "(例如 1993)" -#: ../../library/time.rst:628 +#: ../../library/time.rst:637 msgid "1" msgstr "1" -#: ../../library/time.rst:630 +#: ../../library/time.rst:639 msgid "range [1, 12]" msgstr "範圍 [1, 12]" -#: ../../library/time.rst:632 +#: ../../library/time.rst:641 msgid "2" msgstr "2" -#: ../../library/time.rst:634 +#: ../../library/time.rst:643 msgid "range [1, 31]" msgstr "範圍 [1, 31]" -#: ../../library/time.rst:636 +#: ../../library/time.rst:645 msgid "3" msgstr "3" -#: ../../library/time.rst:638 +#: ../../library/time.rst:647 msgid "range [0, 23]" msgstr "範圍 [0, 23]" -#: ../../library/time.rst:640 +#: ../../library/time.rst:649 msgid "4" msgstr "4" -#: ../../library/time.rst:642 +#: ../../library/time.rst:651 msgid "range [0, 59]" msgstr "範圍 [0, 59]" -#: ../../library/time.rst:644 +#: ../../library/time.rst:653 msgid "5" msgstr "5" -#: ../../library/time.rst:646 +#: ../../library/time.rst:655 msgid "range [0, 61]; see :ref:`Note (2) <leap-second>` in :func:`strftime`" msgstr "" "範圍 [0, 61];參見 :func:`strftime` 中的\\ :ref:`註釋 (2) <leap-second>`" -#: ../../library/time.rst:648 +#: ../../library/time.rst:657 msgid "6" msgstr "6" -#: ../../library/time.rst:650 +#: ../../library/time.rst:659 msgid "range [0, 6]; Monday is 0" msgstr "範圍 [0, 6];星期一是 0" -#: ../../library/time.rst:652 +#: ../../library/time.rst:661 msgid "7" msgstr "7" -#: ../../library/time.rst:654 +#: ../../library/time.rst:663 msgid "range [1, 366]" msgstr "範圍 [1, 366]" -#: ../../library/time.rst:656 +#: ../../library/time.rst:665 msgid "8" msgstr "8" -#: ../../library/time.rst:658 +#: ../../library/time.rst:667 msgid "0, 1 or -1; see below" msgstr "0、1 或 -1;見下文" -#: ../../library/time.rst:660 ../../library/time.rst:664 +#: ../../library/time.rst:669 ../../library/time.rst:673 msgid "N/A" msgstr "N/A" -#: ../../library/time.rst:662 +#: ../../library/time.rst:671 msgid "abbreviation of timezone name" msgstr "時區名稱的縮寫" -#: ../../library/time.rst:666 +#: ../../library/time.rst:675 msgid "offset east of UTC in seconds" msgstr "UTC 向東的偏移量(以秒為單位)" -#: ../../library/time.rst:668 +#: ../../library/time.rst:677 msgid "" "Note that unlike the C structure, the month value is a range of [1, 12], not " "[0, 11]." msgstr "請注意,與 C 結構不同,月份值的範圍是 [1, 12],而不是 [0, 11]。" -#: ../../library/time.rst:671 +#: ../../library/time.rst:680 msgid "" "In calls to :func:`mktime`, :attr:`tm_isdst` may be set to 1 when daylight " "savings time is in effect, and 0 when it is not. A value of -1 indicates " @@ -1226,28 +1241,28 @@ msgstr "" "在呼叫 :func:`mktime` 時,當日光節約時間生效的時候,:attr:`tm_isdst` 可以設定" "為 1,不生效時設定為 0。值 -1 表示未知是否生效,通常結果會填入正確的狀態。" -#: ../../library/time.rst:675 +#: ../../library/time.rst:684 msgid "" -"When a tuple with an incorrect length is passed to a function expecting a :" -"class:`struct_time`, or having elements of the wrong type, a :exc:" -"`TypeError` is raised." +"When a tuple with an incorrect length is passed to a function expecting " +"a :class:`struct_time`, or having elements of the wrong type, " +"a :exc:`TypeError` is raised." msgstr "" "當一個長度不正確的元組被傳遞給預期得到 :class:`struct_time` 的函式時,或者其" "中有元素型別錯誤時,將引發 :exc:`TypeError`。" -#: ../../library/time.rst:681 +#: ../../library/time.rst:690 msgid "" "Return the time in seconds since the epoch_ as a floating-point number. The " "handling of `leap seconds`_ is platform dependent. On Windows and most Unix " "systems, the leap seconds are not counted towards the time in seconds since " -"the epoch_. This is commonly referred to as `Unix time <https://en.wikipedia." -"org/wiki/Unix_time>`_." +"the epoch_. This is commonly referred to as `Unix time <https://" +"en.wikipedia.org/wiki/Unix_time>`_." msgstr "" "回傳自 epoch_ 起的時間(秒)至今的浮點數。對 `leap seconds`_ 的處理是與平台有" "關的。在 Windows 和大多數 Unix 系統上,閏秒不計入自 epoch_ 起的秒數中。這通常" "被稱為 `Unix 時間 <https://en.wikipedia.org/wiki/Unix_time>`_。" -#: ../../library/time.rst:687 +#: ../../library/time.rst:696 msgid "" "Note that even though the time is always returned as a floating-point " "number, not all systems provide time with a better precision than 1 second. " @@ -1259,45 +1274,45 @@ msgstr "" "間。雖然此函式通常回傳非遞減的值,但如果在兩次呼叫之間系統時鐘被回調,則它可" "能回傳比之前呼叫更小的值。" -#: ../../library/time.rst:693 +#: ../../library/time.rst:702 msgid "" "The number returned by :func:`.time` may be converted into a more common " -"time format (i.e. year, month, day, hour, etc...) in UTC by passing it to :" -"func:`gmtime` function or in local time by passing it to the :func:" -"`localtime` function. In both cases a :class:`struct_time` object is " -"returned, from which the components of the calendar date may be accessed as " -"attributes." +"time format (i.e. year, month, day, hour, etc...) in UTC by passing it " +"to :func:`gmtime` function or in local time by passing it to " +"the :func:`localtime` function. In both cases a :class:`struct_time` object " +"is returned, from which the components of the calendar date may be accessed " +"as attributes." msgstr "" "由 :func:`.time` 回傳的數字可以通過傳遞給 :func:`gmtime` 函式轉換為 UTC 內更" "常見的時間格式(即年、月、日、小時等)或通過傳遞給 :func:`localtime` 函式轉換" "為當地時間。在這兩種情況下都會回傳一個 :class:`struct_time` 物件,從中可以作" "為屬性存取日曆日期的組成部分。" -#: ../../library/time.rst:702 +#: ../../library/time.rst:711 msgid "On Windows, call ``GetSystemTimeAsFileTime()``." msgstr "在 Windows 上,呼叫 ``GetSystemTimeAsFileTime()``。" -#: ../../library/time.rst:703 +#: ../../library/time.rst:712 msgid "Call ``clock_gettime(CLOCK_REALTIME)`` if available." msgstr "如果可以的話,呼叫 ``clock_gettime(CLOCK_REALTIME)``。" -#: ../../library/time.rst:704 +#: ../../library/time.rst:713 msgid "Otherwise, call ``gettimeofday()``." msgstr "否則,呼叫 ``gettimeofday()``。" -#: ../../library/time.rst:706 +#: ../../library/time.rst:715 msgid "" "Use :func:`time_ns` to avoid the precision loss caused by the :class:`float` " "type." msgstr "使用 :func:`time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:712 +#: ../../library/time.rst:721 msgid "" "Similar to :func:`~time.time` but returns time as an integer number of " "nanoseconds since the epoch_." msgstr "類似於 :func:`~time.time`,但回傳自 epoch_ 起的以奈秒為單位的整數。" -#: ../../library/time.rst:725 +#: ../../library/time.rst:734 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current thread. It does not include time elapsed during " @@ -1309,22 +1324,22 @@ msgstr "" "期間經過的時間。根據定義,這是執行緒特定 (thread-specific) 的。回傳值的參照點" "未定義,因此只有同一執行緒中兩次呼叫結果之間的差異才是有效的。" -#: ../../library/time.rst:731 +#: ../../library/time.rst:740 msgid "" -"Use :func:`thread_time_ns` to avoid the precision loss caused by the :class:" -"`float` type." +"Use :func:`thread_time_ns` to avoid the precision loss caused by " +"the :class:`float` type." msgstr "" "使用 :func:`thread_time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:736 +#: ../../library/time.rst:745 msgid "Unix systems supporting ``CLOCK_THREAD_CPUTIME_ID``." msgstr "有支援 ``CLOCK_THREAD_CPUTIME_ID`` 的 Unix 系統。" -#: ../../library/time.rst:743 +#: ../../library/time.rst:752 msgid "Similar to :func:`thread_time` but return time as nanoseconds." msgstr "類似於 :func:`thread_time`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:750 +#: ../../library/time.rst:759 msgid "" "Reset the time conversion rules used by the library routines. The " "environment variable :envvar:`TZ` specifies how this is done. It will also " @@ -1341,51 +1356,51 @@ msgstr "" "``daylight``\\ (如果該時區沒有日光節約時間規則,則設定為 0;如果在過去、現在" "或未來的某個時間有日光節約時間規則,則設置為非零的值)。" -#: ../../library/time.rst:762 +#: ../../library/time.rst:771 msgid "" "Although in many cases, changing the :envvar:`TZ` environment variable may " -"affect the output of functions like :func:`localtime` without calling :func:" -"`tzset`, this behavior should not be relied on." +"affect the output of functions like :func:`localtime` without " +"calling :func:`tzset`, this behavior should not be relied on." msgstr "" "雖然在許多情況下,更改 :envvar:`TZ` 環境變數可能會在沒有呼叫 :func:`tzset` 的" "情況下影響 :func:`localtime` 等函式的輸出,但是這種行為是不該被依賴的。" -#: ../../library/time.rst:766 +#: ../../library/time.rst:775 msgid "The :envvar:`TZ` environment variable should contain no whitespace." msgstr ":envvar:`TZ` 環境變數不應包含空格字元。" -#: ../../library/time.rst:768 +#: ../../library/time.rst:777 msgid "" "The standard format of the :envvar:`TZ` environment variable is (whitespace " "added for clarity)::" msgstr "" ":envvar:`TZ` 環境變數的標準格式為(為了清楚表達,中間增加了空格字元): ::" -#: ../../library/time.rst:771 +#: ../../library/time.rst:780 msgid "std offset [dst [offset [,start[/time], end[/time]]]]" msgstr "std offset [dst [offset [,start[/time], end[/time]]]]" -#: ../../library/time.rst:773 +#: ../../library/time.rst:782 msgid "Where the components are:" msgstr "其中各個組成部分為:" -#: ../../library/time.rst:775 +#: ../../library/time.rst:784 msgid "``std`` and ``dst``" msgstr "``std`` 和 ``dst``" -#: ../../library/time.rst:776 +#: ../../library/time.rst:785 msgid "" "Three or more alphanumerics giving the timezone abbreviations. These will be " "propagated into time.tzname" msgstr "" -"三個或更多字母與數字 (alphanumerics) 組成的時區縮寫。這些縮寫會被傳播到 time." -"tzname 中。" +"三個或更多字母與數字 (alphanumerics) 組成的時區縮寫。這些縮寫會被傳播到 " +"time.tzname 中。" -#: ../../library/time.rst:779 +#: ../../library/time.rst:788 msgid "``offset``" msgstr "``offset``" -#: ../../library/time.rst:780 +#: ../../library/time.rst:789 msgid "" "The offset has the form: ``± hh[:mm[:ss]]``. This indicates the value added " "the local time to arrive at UTC. If preceded by a '-', the timezone is east " @@ -1396,22 +1411,22 @@ msgstr "" "果以 '-' 開頭,則表示該時區位於本初子午線以東;否則,位於其西。如果 dst 之後" "沒有偏移量,則假定日光時間比標準時間快一小時。" -#: ../../library/time.rst:785 +#: ../../library/time.rst:794 msgid "``start[/time], end[/time]``" msgstr "``start[/time], end[/time]``" -#: ../../library/time.rst:786 +#: ../../library/time.rst:795 msgid "" "Indicates when to change to and back from DST. The format of the start and " "end dates are one of the following:" msgstr "" "表示何時切換至日光節約時間及何時切換回來。開始和結束日期的格式如以下其一:" -#: ../../library/time.rst:789 +#: ../../library/time.rst:798 msgid ":samp:`J{n}`" msgstr ":samp:`J{n}`" -#: ../../library/time.rst:790 +#: ../../library/time.rst:799 msgid "" "The Julian day *n* (1 <= *n* <= 365). Leap days are not counted, so in all " "years February 28 is day 59 and March 1 is day 60." @@ -1419,22 +1434,22 @@ msgstr "" "儒略日 (Julian day) *n*(1 <= *n* <= 365)。閏日不計算,因此在所有年份中,2 " "月 28 日是第 59 天,3 月 1 日是第 60 天。" -#: ../../library/time.rst:793 +#: ../../library/time.rst:802 msgid ":samp:`{n}`" msgstr ":samp:`{n}`" -#: ../../library/time.rst:794 +#: ../../library/time.rst:803 msgid "" "The zero-based Julian day (0 <= *n* <= 365). Leap days are counted, and it " "is possible to refer to February 29." msgstr "" "從 0 開始的儒略日 (0 <= *n* <= 365)。閏日會計算,因此可以適用至 2 月 29 日。" -#: ../../library/time.rst:797 +#: ../../library/time.rst:806 msgid ":samp:`M{m}.{n}.{d}`" msgstr ":samp:`M{m}.{n}.{d}`" -#: ../../library/time.rst:798 +#: ../../library/time.rst:807 msgid "" "The *d*'th day (0 <= *d* <= 6) of week *n* of month *m* of the year (1 <= " "*n* <= 5, 1 <= *m* <= 12, where week 5 means \"the last *d* day in month " @@ -1445,7 +1460,7 @@ msgstr "" "*m* <= 12,其中 *n* 為 5 表示「該月的最後一個第 *d* 天」,這可能出現在第四或" "第五週)。第 1 週是 *d* 天首次出現的那一週。第零天為星期天。" -#: ../../library/time.rst:804 +#: ../../library/time.rst:813 msgid "" "``time`` has the same format as ``offset`` except that no leading sign ('-' " "or '+') is allowed. The default, if time is not given, is 02:00:00." @@ -1453,7 +1468,7 @@ msgstr "" "``time`` 的格式與 ``offset`` 相同,但不允許出現前導符號('-' 或 '+')。如果未" "指定時間,則預設為 02:00:00。" -#: ../../library/time.rst:809 +#: ../../library/time.rst:818 msgid "" ">>> os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0'\n" ">>> time.tzset()\n" @@ -1473,7 +1488,7 @@ msgstr "" ">>> time.strftime('%X %x %Z')\n" "'16:08:12 05/08/03 AEST'" -#: ../../library/time.rst:818 +#: ../../library/time.rst:827 msgid "" "On many Unix systems (including \\*BSD, Linux, Solaris, and Darwin), it is " "more convenient to use the system's zoneinfo (:manpage:`tzfile(5)`) " @@ -1490,7 +1505,7 @@ msgstr "" "Eastern'``、``'Australia/Melbourne'``、``'Egypt'`` 或 ``'Europe/" "Amsterdam'``。 ::" -#: ../../library/time.rst:826 +#: ../../library/time.rst:835 msgid "" ">>> os.environ['TZ'] = 'US/Eastern'\n" ">>> time.tzset()\n" @@ -1510,35 +1525,35 @@ msgstr "" ">>> time.tzname\n" "('EET', 'EEST')" -#: ../../library/time.rst:839 +#: ../../library/time.rst:848 msgid "Clock ID Constants" msgstr "時鐘 ID 常數" -#: ../../library/time.rst:841 +#: ../../library/time.rst:850 msgid "" -"These constants are used as parameters for :func:`clock_getres` and :func:" -"`clock_gettime`." +"These constants are used as parameters for :func:`clock_getres` " +"and :func:`clock_gettime`." msgstr "這些常數用作 :func:`clock_getres` 和 :func:`clock_gettime` 的參數。" -#: ../../library/time.rst:846 +#: ../../library/time.rst:855 msgid "" "Identical to :data:`CLOCK_MONOTONIC`, except it also includes any time that " "the system is suspended." msgstr "" "與 :data:`CLOCK_MONOTONIC` 基本相同,不同之處在於它還包括系統暫停的任何時間。" -#: ../../library/time.rst:849 +#: ../../library/time.rst:858 msgid "" "This allows applications to get a suspend-aware monotonic clock without " "having to deal with the complications of :data:`CLOCK_REALTIME`, which may " "have discontinuities if the time is changed using ``settimeofday()`` or " "similar." msgstr "" -"這允許應用程式獲取一個能夠感知暫停的單調時鐘,而無需處理 :data:" -"`CLOCK_REALTIME` 的複雜情況,後者在使用 ``settimeofday()`` 或類似函式更改時間" -"時可能會出現不連續的情況。" +"這允許應用程式獲取一個能夠感知暫停的單調時鐘,而無需處" +"理 :data:`CLOCK_REALTIME` 的複雜情況,後者在使用 ``settimeofday()`` 或類似函" +"式更改時間時可能會出現不連續的情況。" -#: ../../library/time.rst:861 +#: ../../library/time.rst:870 msgid "" "The Solaris OS has a ``CLOCK_HIGHRES`` timer that attempts to use an optimal " "hardware source, and may give close to nanosecond resolution. " @@ -1547,13 +1562,13 @@ msgstr "" "Solaris 作業系統具有 ``CLOCK_HIGHRES`` 計時器,它嘗試使用最佳的硬體資源,並可" "能提供接近奈秒的解析度。``CLOCK_HIGHRES`` 是不可調整且高解析度的時鐘。" -#: ../../library/time.rst:872 +#: ../../library/time.rst:881 msgid "" "Clock that cannot be set and represents monotonic time since some " "unspecified starting point." msgstr "該時鐘無法被設定,其表示自某個未指定起點以來的單調時間。" -#: ../../library/time.rst:882 +#: ../../library/time.rst:891 msgid "" "Similar to :data:`CLOCK_MONOTONIC`, but provides access to a raw hardware-" "based time that is not subject to NTP adjustments." @@ -1561,7 +1576,7 @@ msgstr "" "類似於 :data:`CLOCK_MONOTONIC`,但提供對基於硬體的原始時間的存取,此時間不受 " "NTP 調整的影響。" -#: ../../library/time.rst:891 +#: ../../library/time.rst:900 msgid "" "Similar to :data:`CLOCK_MONOTONIC_RAW`, but reads a value cached by the " "system at context switch and hence has less accuracy." @@ -1569,11 +1584,11 @@ msgstr "" "類似於 :data:`CLOCK_MONOTONIC_RAW`,但讀取的是系統在情境切換時快取的值,因此" "精準度較低。" -#: ../../library/time.rst:901 ../../library/time.rst:910 +#: ../../library/time.rst:910 ../../library/time.rst:919 msgid "High-resolution per-process timer from the CPU." msgstr "來自 CPU 的高解析度每個行程的計時器。" -#: ../../library/time.rst:918 +#: ../../library/time.rst:927 msgid "" "`International Atomic Time <https://www.nist.gov/pml/time-and-frequency-" "division/nist-time-frequently-asked-questions-faq#tai>`_" @@ -1581,18 +1596,18 @@ msgstr "" "`國際原子時間 <https://www.nist.gov/pml/time-and-frequency-division/nist-" "time-frequently-asked-questions-faq#tai>`_" -#: ../../library/time.rst:920 +#: ../../library/time.rst:929 msgid "" "The system must have a current leap second table in order for this to give " "the correct answer. PTP or NTP software can maintain a leap second table." msgstr "" "系統必須擁有當前的閏秒表才能給出正確答案。PTP 或 NTP 軟體可以維護閏秒表。" -#: ../../library/time.rst:929 +#: ../../library/time.rst:938 msgid "Thread-specific CPU-time clock." msgstr "執行緒相關的 CPU 時間時鐘。" -#: ../../library/time.rst:938 +#: ../../library/time.rst:947 msgid "" "Time whose absolute value is the time the system has been running and not " "suspended, providing accurate uptime measurement, both absolute and interval." @@ -1600,7 +1615,7 @@ msgstr "" "表示系統運作且無暫停的絕對時間,提供包括絕對時間 (absolute) 和時間區間 " "(interval) 的精確的正常上線時間 (uptime) 測量。" -#: ../../library/time.rst:949 +#: ../../library/time.rst:958 msgid "" "Clock that increments monotonically, tracking the time since an arbitrary " "point, unaffected by frequency or time adjustments and not incremented while " @@ -1609,7 +1624,7 @@ msgstr "" "單調增量的時鐘,從某個任意點開始計時,不受頻率或時間調整影響,並且在系統休眠" "時不增量。" -#: ../../library/time.rst:959 +#: ../../library/time.rst:968 msgid "" "Like :data:`CLOCK_UPTIME_RAW`, but the value is cached by the system at " "context switches and therefore has less accuracy." @@ -1617,23 +1632,23 @@ msgstr "" "類似於 :data:`CLOCK_UPTIME_RAW`,但該值在情境切換時由系統快取,因此精準度較" "低。" -#: ../../library/time.rst:966 +#: ../../library/time.rst:975 msgid "" -"The following constant is the only parameter that can be sent to :func:" -"`clock_settime`." +"The following constant is the only parameter that can be sent " +"to :func:`clock_settime`." msgstr "以下常數是唯一可以傳遞給 :func:`clock_settime` 的參數。" -#: ../../library/time.rst:972 +#: ../../library/time.rst:981 msgid "" "System-wide real-time clock. Setting this clock requires appropriate " "privileges." msgstr "涵蓋整個系統的即時時鐘。設定此時鐘需要適當的權限。" -#: ../../library/time.rst:983 +#: ../../library/time.rst:992 msgid "Timezone Constants" msgstr "時區常數" -#: ../../library/time.rst:987 +#: ../../library/time.rst:996 msgid "" "The offset of the local DST timezone, in seconds west of UTC, if one is " "defined. This is negative if the local DST timezone is east of UTC (as in " @@ -1644,11 +1659,11 @@ msgstr "" "為單位)。若本地 DST 時區位於 UTC 以東(例如包括英國在內的西歐),則此值為負" "值。僅在 ``daylight`` 為非零時使用此值。詳情請參見下方註釋。" -#: ../../library/time.rst:993 +#: ../../library/time.rst:1002 msgid "Nonzero if a DST timezone is defined. See note below." msgstr "如果定義了 DST 時區,則為非零值。詳情請參見下方註釋。" -#: ../../library/time.rst:997 +#: ../../library/time.rst:1006 msgid "" "The offset of the local (non-DST) timezone, in seconds west of UTC (negative " "in most of Western Europe, positive in the US, zero in the UK). See note " @@ -1657,7 +1672,7 @@ msgstr "" "本地(非 DST)時區相對於 UTC 以西的偏移量(以秒為單位),西歐大多數地區為負," "美國為正,英國為零。詳情請參見下方註釋。" -#: ../../library/time.rst:1002 +#: ../../library/time.rst:1011 msgid "" "A tuple of two strings: the first is the name of the local non-DST timezone, " "the second is the name of the local DST timezone. If no DST timezone is " @@ -1666,46 +1681,48 @@ msgstr "" "一個包含兩個字串的元組:第一個是本地非 DST 時區的名稱,第二個是本地 DST 時區" "的名稱。如果沒有定義 DST 時區,則不應使用第二個字串。詳情請參見下方註釋。" -#: ../../library/time.rst:1008 -msgid "" -"For the above Timezone constants (:data:`altzone`, :data:`daylight`, :data:" -"`timezone`, and :data:`tzname`), the value is determined by the timezone " -"rules in effect at module load time or the last time :func:`tzset` is called " -"and may be incorrect for times in the past. It is recommended to use the :" -"attr:`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` results from :" -"func:`localtime` to obtain timezone information." -msgstr "" -"對於上述時區常數(:data:`altzone`、:data:`daylight`、:data:`timezone` 和 :" -"data:`tzname`),其值由模組載入時或 :func:`tzset` 最後一次被呼叫時的時區規則" -"決定,且過去的時間可能會不準確。建議使用 :func:`localtime` 回傳的 :attr:" -"`~struct_time.tm_gmtoff` 和 :attr:`~struct_time.tm_zone` 來獲取時區資訊。" - #: ../../library/time.rst:1017 +msgid "" +"For the above Timezone constants " +"(:data:`altzone`, :data:`daylight`, :data:`timezone`, and :data:`tzname`), " +"the value is determined by the timezone rules in effect at module load time " +"or the last time :func:`tzset` is called and may be incorrect for times in " +"the past. It is recommended to use the :attr:`~struct_time.tm_gmtoff` " +"and :attr:`~struct_time.tm_zone` results from :func:`localtime` to obtain " +"timezone information." +msgstr "" +"對於上述時區常數(:data:`altzone`、:data:`daylight`、:data:`timezone` " +"和 :data:`tzname`),其值由模組載入時或 :func:`tzset` 最後一次被呼叫時的時區" +"規則決定,且過去的時間可能會不準確。建議使用 :func:`localtime` 回傳" +"的 :attr:`~struct_time.tm_gmtoff` 和 :attr:`~struct_time.tm_zone` 來獲取時區" +"資訊。" + +#: ../../library/time.rst:1026 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/time.rst:1018 +#: ../../library/time.rst:1027 msgid "More object-oriented interface to dates and times." msgstr "更多物件導向的日期和時間介面。" -#: ../../library/time.rst:1020 +#: ../../library/time.rst:1029 msgid "Module :mod:`locale`" msgstr ":mod:`locale` 模組" -#: ../../library/time.rst:1021 +#: ../../library/time.rst:1030 msgid "" "Internationalization services. The locale setting affects the " -"interpretation of many format specifiers in :func:`strftime` and :func:" -"`strptime`." +"interpretation of many format specifiers in :func:`strftime` " +"and :func:`strptime`." msgstr "" "國際化服務。區域設定會影響 :func:`strftime` 和 :func:`strptime` 中許多格式指" "定符號 (format specifiers) 的解譯。" -#: ../../library/time.rst:1024 +#: ../../library/time.rst:1033 msgid "Module :mod:`calendar`" msgstr ":mod:`calendar` 模組" -#: ../../library/time.rst:1025 +#: ../../library/time.rst:1034 msgid "" "General calendar-related functions. :func:`~calendar.timegm` is the " "inverse of :func:`gmtime` from this module." @@ -1713,11 +1730,11 @@ msgstr "" "通用的日曆相關函式。:func:`~calendar.timegm` 是本模組中 :func:`gmtime` 的反函" "式。" -#: ../../library/time.rst:1029 +#: ../../library/time.rst:1038 msgid "Footnotes" msgstr "註解" -#: ../../library/time.rst:1030 +#: ../../library/time.rst:1039 msgid "" "The use of ``%Z`` is now deprecated, but the ``%z`` escape that expands to " "the preferred hour/minute offset is not supported by all ANSI C libraries. " @@ -1762,22 +1779,22 @@ msgid "Daylight Saving Time" msgstr "Daylight Saving Time(日光節約時間)" #: ../../library/time.rst:319 ../../library/time.rst:354 -#: ../../library/time.rst:720 +#: ../../library/time.rst:729 msgid "benchmarking" msgstr "benchmarking(基準測試)" -#: ../../library/time.rst:354 ../../library/time.rst:720 +#: ../../library/time.rst:354 ../../library/time.rst:729 msgid "CPU time" msgstr "CPU time(CPU 時間)" -#: ../../library/time.rst:354 ../../library/time.rst:720 +#: ../../library/time.rst:354 ../../library/time.rst:729 msgid "processor time" msgstr "processor time(處理器時間)" -#: ../../library/time.rst:416 ../../library/time.rst:575 +#: ../../library/time.rst:425 ../../library/time.rst:584 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/time.rst:416 ../../library/time.rst:575 +#: ../../library/time.rst:425 ../../library/time.rst:584 msgid "datetime format" msgstr "datetime format(日期時間格式)" diff --git a/library/tokenize.po b/library/tokenize.po index 32d1dd0754..eed97f5d0f 100644 --- a/library/tokenize.po +++ b/library/tokenize.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-01-20 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -140,40 +140,39 @@ msgstr "" #: ../../library/tokenize.rst:94 msgid "" -"The reconstructed script is returned as a single string. The result is " -"guaranteed to tokenize back to match the input so that the conversion is " -"lossless and round-trips are assured. The guarantee applies only to the " -"token type and token string as the spacing between tokens (column positions) " -"may change." +"The result is guaranteed to tokenize back to match the input so that the " +"conversion is lossless and round-trips are assured. The guarantee applies " +"only to the token type and token string as the spacing between tokens " +"(column positions) may change." msgstr "" -#: ../../library/tokenize.rst:100 +#: ../../library/tokenize.rst:99 msgid "" "It returns bytes, encoded using the :data:`~token.ENCODING` token, which is " "the first token sequence output by :func:`.tokenize`. If there is no " "encoding token in the input, it returns a str instead." msgstr "" -#: ../../library/tokenize.rst:105 +#: ../../library/tokenize.rst:104 msgid "" ":func:`.tokenize` needs to detect the encoding of source files it tokenizes. " "The function it uses to do this is available:" msgstr "" -#: ../../library/tokenize.rst:110 +#: ../../library/tokenize.rst:109 msgid "" "The :func:`detect_encoding` function is used to detect the encoding that " "should be used to decode a Python source file. It requires one argument, " "readline, in the same way as the :func:`.tokenize` generator." msgstr "" -#: ../../library/tokenize.rst:114 +#: ../../library/tokenize.rst:113 msgid "" "It will call readline a maximum of twice, and return the encoding used (as a " "string) and a list of any lines (not decoded from bytes) it has read in." msgstr "" -#: ../../library/tokenize.rst:118 +#: ../../library/tokenize.rst:117 msgid "" "It detects the encoding from the presence of a UTF-8 BOM or an encoding " "cookie as specified in :pep:`263`. If both a BOM and a cookie are present, " @@ -181,31 +180,31 @@ msgid "" "found, ``'utf-8-sig'`` will be returned as an encoding." msgstr "" -#: ../../library/tokenize.rst:123 +#: ../../library/tokenize.rst:122 msgid "" "If no encoding is specified, then the default of ``'utf-8'`` will be " "returned." msgstr "" -#: ../../library/tokenize.rst:126 +#: ../../library/tokenize.rst:125 msgid "" "Use :func:`.open` to open Python source files: it uses :func:" "`detect_encoding` to detect the file encoding." msgstr "" -#: ../../library/tokenize.rst:132 +#: ../../library/tokenize.rst:131 msgid "" "Open a file in read only mode using the encoding detected by :func:" "`detect_encoding`." msgstr "" -#: ../../library/tokenize.rst:139 +#: ../../library/tokenize.rst:138 msgid "" "Raised when either a docstring or expression that may be split over several " "lines is not completed anywhere in the file, for example::" msgstr "" -#: ../../library/tokenize.rst:142 +#: ../../library/tokenize.rst:141 msgid "" "\"\"\"Beginning of\n" "docstring" @@ -213,11 +212,11 @@ msgstr "" "\"\"\"Beginning of\n" "docstring" -#: ../../library/tokenize.rst:145 +#: ../../library/tokenize.rst:144 msgid "or::" msgstr "或是: ::" -#: ../../library/tokenize.rst:147 +#: ../../library/tokenize.rst:146 msgid "" "[1,\n" " 2,\n" @@ -227,49 +226,49 @@ msgstr "" " 2,\n" " 3" -#: ../../library/tokenize.rst:154 +#: ../../library/tokenize.rst:153 msgid "Command-Line Usage" msgstr "" -#: ../../library/tokenize.rst:158 +#: ../../library/tokenize.rst:157 msgid "" "The :mod:`tokenize` module can be executed as a script from the command " "line. It is as simple as:" msgstr "" -#: ../../library/tokenize.rst:161 +#: ../../library/tokenize.rst:160 msgid "python -m tokenize [-e] [filename.py]" msgstr "python -m tokenize [-e] [filename.py]" -#: ../../library/tokenize.rst:165 +#: ../../library/tokenize.rst:164 msgid "The following options are accepted:" msgstr "" -#: ../../library/tokenize.rst:171 +#: ../../library/tokenize.rst:170 msgid "show this help message and exit" msgstr "" -#: ../../library/tokenize.rst:175 +#: ../../library/tokenize.rst:174 msgid "display token names using the exact type" msgstr "" -#: ../../library/tokenize.rst:177 +#: ../../library/tokenize.rst:176 msgid "" "If :file:`filename.py` is specified its contents are tokenized to stdout. " "Otherwise, tokenization is performed on stdin." msgstr "" -#: ../../library/tokenize.rst:181 +#: ../../library/tokenize.rst:180 msgid "Examples" msgstr "範例" -#: ../../library/tokenize.rst:183 +#: ../../library/tokenize.rst:182 msgid "" "Example of a script rewriter that transforms float literals into Decimal " "objects::" msgstr "" -#: ../../library/tokenize.rst:186 +#: ../../library/tokenize.rst:185 msgid "" "from tokenize import tokenize, untokenize, NUMBER, STRING, NAME, OP\n" "from io import BytesIO\n" @@ -312,11 +311,11 @@ msgid "" " return untokenize(result).decode('utf-8')" msgstr "" -#: ../../library/tokenize.rst:225 +#: ../../library/tokenize.rst:224 msgid "Example of tokenizing from the command line. The script::" msgstr "" -#: ../../library/tokenize.rst:227 +#: ../../library/tokenize.rst:226 msgid "" "def say_hello():\n" " print(\"Hello, World!\")\n" @@ -328,7 +327,7 @@ msgstr "" "\n" "say_hello()" -#: ../../library/tokenize.rst:232 +#: ../../library/tokenize.rst:231 msgid "" "will be tokenized to the following output where the first column is the " "range of the line/column coordinates where the token is found, the second " @@ -336,7 +335,7 @@ msgid "" "token (if any)" msgstr "" -#: ../../library/tokenize.rst:236 +#: ../../library/tokenize.rst:235 msgid "" "$ python -m tokenize hello.py\n" "0,0-0,0: ENCODING 'utf-8'\n" @@ -382,12 +381,12 @@ msgstr "" "4,11-4,12: NEWLINE '\\n'\n" "5,0-5,0: ENDMARKER ''" -#: ../../library/tokenize.rst:260 +#: ../../library/tokenize.rst:259 msgid "" "The exact token type names can be displayed using the :option:`-e` option:" msgstr "" -#: ../../library/tokenize.rst:262 +#: ../../library/tokenize.rst:261 msgid "" "$ python -m tokenize -e hello.py\n" "0,0-0,0: ENCODING 'utf-8'\n" @@ -433,13 +432,13 @@ msgstr "" "4,11-4,12: NEWLINE '\\n'\n" "5,0-5,0: ENDMARKER ''" -#: ../../library/tokenize.rst:286 +#: ../../library/tokenize.rst:285 msgid "" "Example of tokenizing a file programmatically, reading unicode strings " "instead of bytes with :func:`generate_tokens`::" msgstr "" -#: ../../library/tokenize.rst:289 +#: ../../library/tokenize.rst:288 msgid "" "import tokenize\n" "\n" @@ -455,11 +454,11 @@ msgstr "" " for token in tokens:\n" " print(token)" -#: ../../library/tokenize.rst:296 +#: ../../library/tokenize.rst:295 msgid "Or reading bytes directly with :func:`.tokenize`::" msgstr "" -#: ../../library/tokenize.rst:298 +#: ../../library/tokenize.rst:297 msgid "" "import tokenize\n" "\n" diff --git a/library/turtle.po b/library/turtle.po index 3a6d1eb7aa..1c8a60bcbc 100644 --- a/library/turtle.po +++ b/library/turtle.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-01-15 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1644,8 +1644,8 @@ msgid "" ">>> turtle.heading()\n" "90.0\n" "\n" -"Change angle measurement unit to grad (also known as gon,\n" -"grade, or gradian and equals 1/100-th of the right angle.)\n" +">>> # Change angle measurement unit to grad (also known as gon,\n" +">>> # grade, or gradian and equals 1/100-th of the right angle.)\n" ">>> turtle.degrees(400.0)\n" ">>> turtle.heading()\n" "100.0\n" diff --git a/license.po b/license.po index f56bcc5556..f233a27c8c 100644 --- a/license.po +++ b/license.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-02 00:14+0000\n" "PO-Revision-Date: 2022-06-27 09:40+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,49 +31,49 @@ msgstr "軟體沿革" #: ../../license.rst:13 msgid "" "Python was created in the early 1990s by Guido van Rossum at Stichting " -"Mathematisch Centrum (CWI, see https://www.cwi.nl/) in the Netherlands as a " +"Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands as a " "successor of a language called ABC. Guido remains Python's principal " "author, although it includes many contributions from others." msgstr "" -"Python 是由荷蘭數學和計算機科學研究學會(CWI,見 https://www.cwi.nl/)的 " +"Python 是由荷蘭數學和計算機科學研究學會(CWI,見 https://www.cwi.nl)的 " "Guido van Rossum 於 1990 年代早期所創造,目的是作為一種稱為 ABC 語言的後繼" "者。儘管 Python 包含了許多來自其他人的貢獻,Guido 仍是其主要作者。" #: ../../license.rst:18 msgid "" "In 1995, Guido continued his work on Python at the Corporation for National " -"Research Initiatives (CNRI, see https://www.cnri.reston.va.us/) in Reston, " +"Research Initiatives (CNRI, see https://www.cnri.reston.va.us) in Reston, " "Virginia where he released several versions of the software." msgstr "" -"1995 年,Guido 在維吉尼亞州雷斯頓的國家創新研究公司(CNRI,見 https://www." -"cnri.reston.va.us/)繼續他在 Python 的工作,並在那裡發佈了該軟體的多個版本。" +"1995 年,Guido 在維吉尼亞州雷斯頓的國家創新研究公司(CNRI,見 https://" +"www.cnri.reston.va.us)繼續他在 Python 的工作,並在那裡發佈了該軟體的多個版" +"本。" #: ../../license.rst:22 msgid "" "In May 2000, Guido and the Python core development team moved to BeOpen.com " "to form the BeOpen PythonLabs team. In October of the same year, the " -"PythonLabs team moved to Digital Creations (now Zope Corporation; see " -"https://www.zope.org/).%20%20In%202001,%20the%20Python%20Software%20Foundation%20(PSF,%20see" -"https://www.python.org/psf/)%20was%20formed,%20a%20non-profit%20organization%20created" -"specifically to own Python-related Intellectual Property. Zope Corporation " -"is a sponsoring member of the PSF." +"PythonLabs team moved to Digital Creations, which became Zope Corporation. " +"In 2001, the Python Software Foundation (PSF, see https://www.python.org/" +"psf/) was formed, a non-profit organization created specifically to own " +"Python-related Intellectual Property. Zope Corporation was a sponsoring " +"member of the PSF." msgstr "" "2000 年五月,Guido 和 Python 核心開發團隊轉移到 BeOpen.com 並成立了 BeOpen " -"PythonLabs 團隊。同年十月,PythonLabs 團隊轉移到 Digital Creations(現為 " -"Zope Corporation;見 https://www.zope.org/)。2001 年,Python 軟體基金會" -"(PSF,見 https://www.python.org/psf/)成立,這是一個專為擁有 Python 相關的智" -"慧財產權而創立的非營利組織。Zope Corporation 是 PSF 的一個贊助會員。" +"PythonLabs 團隊。同年十月,PythonLabs 團隊轉移到 Digital Creations,後來成為 " +"Zope Corporation。2001 年,Python 軟體基金會(PSF,見 https://www.python.org/" +"psf/)成立,這是一個專為擁有 Python 相關的智慧財產權而創立的非營利組織。Zope " +"Corporation 過去是 PSF 的一個贊助會員。" #: ../../license.rst:30 msgid "" -"All Python releases are Open Source (see https://opensource.org/ for the " -"Open Source Definition). Historically, most, but not all, Python releases " -"have also been GPL-compatible; the table below summarizes the various " -"releases." +"All Python releases are Open Source (see https://opensource.org for the Open " +"Source Definition). Historically, most, but not all, Python releases have " +"also been GPL-compatible; the table below summarizes the various releases." msgstr "" -"所有的 Python 版本都是開源的(有關開源的定義,參閱 https://opensource." -"org/)。歷史上,大多數但非全部的 Python 版本,也是 GPL 相容的;以下表格總結各" -"個版本的差異。" +"所有的 Python 版本都是開源的(有關開源的定義,參閱 https://opensource.org)。" +"歷史上,大多數但非全部的 Python 版本,也是 GPL 相容的;以下表格總結各個版本的" +"差異。" #: ../../license.rst:35 msgid "Release" @@ -92,8 +92,8 @@ msgid "Owner" msgstr "擁有者" #: ../../license.rst:35 -msgid "GPL compatible?" -msgstr "GPL 相容性?" +msgid "GPL-compatible? (1)" +msgstr "GPL 相容性? (1)" #: ../../license.rst:37 msgid "0.9.0 thru 1.2" @@ -145,8 +145,7 @@ msgstr "1.5.2" msgid "2000" msgstr "2000" -#: ../../license.rst:41 ../../license.rst:43 ../../license.rst:45 -#: ../../license.rst:47 +#: ../../license.rst:41 ../../license.rst:43 ../../license.rst:47 msgid "no" msgstr "否" @@ -167,6 +166,10 @@ msgstr "1.6.1" msgid "2001" msgstr "2001" +#: ../../license.rst:45 +msgid "yes (2)" +msgstr "是 (2)" + #: ../../license.rst:47 msgid "2.1" msgstr "2.1" @@ -214,7 +217,7 @@ msgstr "2001 至今" #: ../../license.rst:62 msgid "" -"GPL-compatible doesn't mean that we're distributing Python under the GPL. " +"GPL-compatible doesn't mean that we're distributing Python under the GPL. " "All Python licenses, unlike the GPL, let you distribute a modified version " "without making your changes open source. The GPL-compatible licenses make it " "possible to combine Python with other software that is released under the " @@ -226,50 +229,63 @@ msgstr "" #: ../../license.rst:68 msgid "" +"According to Richard Stallman, 1.6.1 is not GPL-compatible, because its " +"license has a choice of law clause. According to CNRI, however, Stallman's " +"lawyer has told CNRI's lawyer that 1.6.1 is \"not incompatible\" with the " +"GPL." +msgstr "" +"根據 Richard Stallman 的說法,1.6.1 不是 GPL 相容的,因為其授權有一個法律選擇" +"條款。然而根據 CNRI 的說法,Stallman 的律師告訴 CNRI 的律師,1.6.1 與 GPL「不" +"相容」。" + +#: ../../license.rst:72 +msgid "" "Thanks to the many outside volunteers who have worked under Guido's " "direction to make these releases possible." msgstr "" "感謝許多的外部志工,在 Guido 指導下的付出,使得這些版本的發佈成為可能。" -#: ../../license.rst:73 +#: ../../license.rst:77 msgid "Terms and conditions for accessing or otherwise using Python" msgstr "關於存取或以其他方式使用 Python 的合約條款" -#: ../../license.rst:75 +#: ../../license.rst:79 msgid "" -"Python software and documentation are licensed under the :ref:`PSF License " -"Agreement <PSF-license>`." -msgstr "Python 軟體和說明文件的授權是基於 :ref:`PSF 授權合約 <PSF-license>`。" +"Python software and documentation are licensed under the Python Software " +"Foundation License Version 2." +msgstr "" +"Python 軟體和說明文件的授權是基於 Python 軟體基金會授權第二版 (Python " +"Software Foundation License Version 2)。" -#: ../../license.rst:78 +#: ../../license.rst:82 msgid "" "Starting with Python 3.8.6, examples, recipes, and other code in the " -"documentation are dual licensed under the PSF License Agreement and the :ref:" -"`Zero-Clause BSD license <BSD0>`." +"documentation are dual licensed under the PSF License Version 2 and " +"the :ref:`Zero-Clause BSD license <BSD0>`." msgstr "" "從 Python 3.8.6 開始,說明文件中的範例、程式庫和其他程式碼,是被雙重授權 " -"(dual licensed) 於 PSF 授權合約以及 :ref:`Zero-Clause BSD 授權 <BSD0>`。" +"(dual licensed) 於 PSF 授權第二版以及 :ref:`Zero-Clause BSD 授權 <BSD0>`。" -#: ../../license.rst:82 +#: ../../license.rst:86 msgid "" "Some software incorporated into Python is under different licenses. The " -"licenses are listed with code falling under that license. See :ref:" -"`OtherLicenses` for an incomplete list of these licenses." +"licenses are listed with code falling under that license. " +"See :ref:`OtherLicenses` for an incomplete list of these licenses." msgstr "" "有些被納入 Python 中的軟體是基於不同的授權。這些授權將會與其授權之程式碼一起" "被列出。關於這些授權的不完整清單,請參閱\\ :ref:`OtherLicenses`。" -#: ../../license.rst:90 -msgid "PSF LICENSE AGREEMENT FOR PYTHON |release|" -msgstr "用於 PYTHON |release| 的 PSF 授權合約" - #: ../../license.rst:94 +msgid "PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2" +msgstr "PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2" + +#: ../../license.rst:98 msgid "" "1. This LICENSE AGREEMENT is between the Python Software Foundation " "(\"PSF\"), and\n" " the Individual or Organization (\"Licensee\") accessing and otherwise " -"using Python\n" -" |release| software in source or binary form and its associated " +"using this\n" +" software (\"Python\") in source or binary form and its associated " "documentation.\n" "\n" "2. Subject to the terms and conditions of this License Agreement, PSF " @@ -278,40 +294,34 @@ msgid "" "reproduce,\n" " analyze, test, perform and/or display publicly, prepare derivative " "works,\n" -" distribute, and otherwise use Python |release| alone or in any " -"derivative\n" +" distribute, and otherwise use Python alone or in any derivative\n" " version, provided, however, that PSF's License Agreement and PSF's notice " "of\n" " copyright, i.e., \"Copyright © 2001-2024 Python Software Foundation; All " "Rights\n" -" Reserved\" are retained in Python |release| alone or in any derivative " -"version\n" +" Reserved\" are retained in Python alone or in any derivative version\n" " prepared by Licensee.\n" "\n" "3. In the event Licensee prepares a derivative work that is based on or\n" -" incorporates Python |release| or any part thereof, and wants to make the\n" +" incorporates Python or any part thereof, and wants to make the\n" " derivative work available to others as provided herein, then Licensee " "hereby\n" " agrees to include in any such work a brief summary of the changes made to " -"Python\n" -" |release|.\n" +"Python.\n" "\n" -"4. PSF is making Python |release| available to Licensee on an \"AS IS\" " -"basis.\n" +"4. PSF is making Python available to Licensee on an \"AS IS\" basis.\n" " PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY " "OF\n" " EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY " "REPRESENTATION OR\n" " WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT " "THE\n" -" USE OF PYTHON |release| WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n" +" USE OF PYTHON WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n" "\n" -"5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON |" -"release|\n" +"5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON\n" " FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT " "OF\n" -" MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON |release|, OR ANY " -"DERIVATIVE\n" +" MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY DERIVATIVE\n" " THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.\n" "\n" "6. This License Agreement will automatically terminate upon a material " @@ -328,15 +338,14 @@ msgid "" "or any\n" " third party.\n" "\n" -"8. By copying, installing or otherwise using Python |release|, Licensee " -"agrees\n" +"8. By copying, installing or otherwise using Python, Licensee agrees\n" " to be bound by the terms and conditions of this License Agreement." msgstr "" "1. This LICENSE AGREEMENT is between the Python Software Foundation " "(\"PSF\"), and\n" " the Individual or Organization (\"Licensee\") accessing and otherwise " -"using Python\n" -" |release| software in source or binary form and its associated " +"using this\n" +" software (\"Python\") in source or binary form and its associated " "documentation.\n" "\n" "2. Subject to the terms and conditions of this License Agreement, PSF " @@ -345,40 +354,34 @@ msgstr "" "reproduce,\n" " analyze, test, perform and/or display publicly, prepare derivative " "works,\n" -" distribute, and otherwise use Python |release| alone or in any " -"derivative\n" +" distribute, and otherwise use Python alone or in any derivative\n" " version, provided, however, that PSF's License Agreement and PSF's notice " "of\n" " copyright, i.e., \"Copyright © 2001-2024 Python Software Foundation; All " "Rights\n" -" Reserved\" are retained in Python |release| alone or in any derivative " -"version\n" +" Reserved\" are retained in Python alone or in any derivative version\n" " prepared by Licensee.\n" "\n" "3. In the event Licensee prepares a derivative work that is based on or\n" -" incorporates Python |release| or any part thereof, and wants to make the\n" +" incorporates Python or any part thereof, and wants to make the\n" " derivative work available to others as provided herein, then Licensee " "hereby\n" " agrees to include in any such work a brief summary of the changes made to " -"Python\n" -" |release|.\n" +"Python.\n" "\n" -"4. PSF is making Python |release| available to Licensee on an \"AS IS\" " -"basis.\n" +"4. PSF is making Python available to Licensee on an \"AS IS\" basis.\n" " PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY " "OF\n" " EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY " "REPRESENTATION OR\n" " WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT " "THE\n" -" USE OF PYTHON |release| WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n" +" USE OF PYTHON WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.\n" "\n" -"5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON |" -"release|\n" +"5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON\n" " FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT " "OF\n" -" MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON |release|, OR ANY " -"DERIVATIVE\n" +" MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR ANY DERIVATIVE\n" " THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.\n" "\n" "6. This License Agreement will automatically terminate upon a material " @@ -395,19 +398,18 @@ msgstr "" "or any\n" " third party.\n" "\n" -"8. By copying, installing or otherwise using Python |release|, Licensee " -"agrees\n" +"8. By copying, installing or otherwise using Python, Licensee agrees\n" " to be bound by the terms and conditions of this License Agreement." -#: ../../license.rst:138 +#: ../../license.rst:141 msgid "BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0" -msgstr "用於 PYTHON 2.0 的 BEOPEN.COM 授權合約" +msgstr "BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0" -#: ../../license.rst:140 +#: ../../license.rst:143 msgid "BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1" -msgstr "BEOPEN PYTHON 開源授權合約第 1 版" +msgstr "BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1" -#: ../../license.rst:144 +#: ../../license.rst:147 msgid "" "1. This LICENSE AGREEMENT is between BeOpen.com (\"BeOpen\"), having an " "office at\n" @@ -535,11 +537,11 @@ msgstr "" "to be\n" " bound by the terms and conditions of this License Agreement." -#: ../../license.rst:185 +#: ../../license.rst:188 msgid "CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1" -msgstr "用於 PYTHON 1.6.1 的 CNRI 授權合約" +msgstr "CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1" -#: ../../license.rst:189 +#: ../../license.rst:192 msgid "" "1. This LICENSE AGREEMENT is between the Corporation for National Research\n" " Initiatives, having an office at 1895 Preston White Drive, Reston, VA " @@ -573,7 +575,7 @@ msgid "" "handle):\n" " 1895.22/1013. This Agreement may also be obtained from a proxy server on " "the\n" -" internet using the following URL: http://hdl.handle.net/1895.22/1013.\"\n" +" internet using the following URL: http://hdl.handle.net/1895.22/1013\".\n" "\n" "3. In the event Licensee prepares a derivative work that is based on or\n" " incorporates Python 1.6.1 or any part thereof, and wants to make the " @@ -670,7 +672,7 @@ msgstr "" "handle):\n" " 1895.22/1013. This Agreement may also be obtained from a proxy server on " "the\n" -" internet using the following URL: http://hdl.handle.net/1895.22/1013.\"\n" +" internet using the following URL: http://hdl.handle.net/1895.22/1013\".\n" "\n" "3. In the event Licensee prepares a derivative work that is based on or\n" " incorporates Python 1.6.1 or any part thereof, and wants to make the " @@ -735,11 +737,11 @@ msgstr "" "and\n" " conditions of this License Agreement." -#: ../../license.rst:250 +#: ../../license.rst:253 msgid "CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2" -msgstr "用於 PYTHON 0.9.0 至 1.2 的 CWI 授權合約" +msgstr "CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2" -#: ../../license.rst:254 +#: ../../license.rst:257 msgid "" "Copyright © 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, The\n" "Netherlands. All rights reserved.\n" @@ -797,11 +799,11 @@ msgstr "" "ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\n" "SOFTWARE." -#: ../../license.rst:277 -msgid "ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON |release| DOCUMENTATION" -msgstr "用於 PYTHON |release| 說明文件內程式碼的 ZERO-CLAUSE BSD 授權" +#: ../../license.rst:280 +msgid "ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION" +msgstr "ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION" -#: ../../license.rst:281 +#: ../../license.rst:284 msgid "" "Permission to use, copy, modify, and/or distribute this software for any\n" "purpose with or without fee is hereby granted.\n" @@ -831,11 +833,11 @@ msgstr "" "OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n" "PERFORMANCE OF THIS SOFTWARE." -#: ../../license.rst:296 +#: ../../license.rst:299 msgid "Licenses and Acknowledgements for Incorporated Software" msgstr "被收錄軟體的授權與致謝" -#: ../../license.rst:298 +#: ../../license.rst:301 msgid "" "This section is an incomplete, but growing list of licenses and " "acknowledgements for third-party software incorporated in the Python " @@ -844,22 +846,22 @@ msgstr "" "本節是一個不完整但持續增加的授權與致謝清單,對象是在 Python 發佈版本中所收錄" "的第三方軟體。" -#: ../../license.rst:303 +#: ../../license.rst:306 msgid "Mersenne Twister" msgstr "Mersenne Twister" -#: ../../license.rst:305 +#: ../../license.rst:308 msgid "" "The :mod:`!_random` C extension underlying the :mod:`random` module includes " "code based on a download from http://www.math.sci.hiroshima-u.ac.jp/~m-mat/" "MT/MT2002/emt19937ar.html. The following are the verbatim comments from the " "original code::" msgstr "" -":mod:`random` 模組底下的 :mod:`!_random` C 擴充程式包含了以 http://www.math." -"sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html 的下載內容為基礎的程式" -"碼。以下是原始程式碼的完整聲明: ::" +":mod:`random` 模組底下的 :mod:`!_random` C 擴充程式包含了以 http://" +"www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html 的下載內容為" +"基礎的程式碼。以下是原始程式碼的完整聲明: ::" -#: ../../license.rst:310 +#: ../../license.rst:313 msgid "" "A C-program for MT19937, with initialization improved 2002/1/26.\n" "Coded by Takuji Nishimura and Makoto Matsumoto.\n" @@ -945,21 +947,21 @@ msgstr "" "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html/n" "email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)" -#: ../../license.rst:353 +#: ../../license.rst:356 msgid "Sockets" msgstr "Sockets" -#: ../../license.rst:355 +#: ../../license.rst:358 msgid "" -"The :mod:`socket` module uses the functions, :c:func:`!getaddrinfo`, and :c:" -"func:`!getnameinfo`, which are coded in separate source files from the WIDE " -"Project, https://www.wide.ad.jp/. ::" +"The :mod:`socket` module uses the functions, :c:func:`!getaddrinfo`, " +"and :c:func:`!getnameinfo`, which are coded in separate source files from " +"the WIDE Project, https://www.wide.ad.jp/. ::" msgstr "" ":mod:`socket` 模組使用 :c:func:`!getaddrinfo` 和 :c:func:`!getnameinfo` 函" "式,它們在 WIDE 專案(https://www.wide.ad.jp/)內,於不同的原始檔案中被編" "碼: ::" -#: ../../license.rst:359 +#: ../../license.rst:362 msgid "" "Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n" "All rights reserved.\n" @@ -976,7 +978,7 @@ msgid "" " may be used to endorse or promote products derived from this software\n" " without specific prior written permission.\n" "\n" -"THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n" +"THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS \"AS IS\" AND\n" "ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" "ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n" @@ -1003,7 +1005,7 @@ msgstr "" " may be used to endorse or promote products derived from this software\n" " without specific prior written permission.\n" "\n" -"THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n" +"THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS \"AS IS\" AND\n" "ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" "ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n" @@ -1015,11 +1017,11 @@ msgstr "" "OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" "SUCH DAMAGE." -#: ../../license.rst:388 +#: ../../license.rst:391 msgid "Asynchronous socket services" msgstr "非同步 socket 服務" -#: ../../license.rst:390 +#: ../../license.rst:393 msgid "" "The :mod:`!test.support.asynchat` and :mod:`!test.support.asyncore` modules " "contain the following notice::" @@ -1027,7 +1029,7 @@ msgstr "" ":mod:`!test.support.asynchat` 和 :mod:`!test.support.asyncore` 模組包含以下聲" "明: ::" -#: ../../license.rst:393 +#: ../../license.rst:396 msgid "" "Copyright 1996 by Sam Rushing\n" "\n" @@ -1071,15 +1073,15 @@ msgstr "" "NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN\n" "CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE." -#: ../../license.rst:416 +#: ../../license.rst:419 msgid "Cookie management" msgstr "Cookie 管理" -#: ../../license.rst:418 +#: ../../license.rst:421 msgid "The :mod:`http.cookies` module contains the following notice::" msgstr ":mod:`http.cookies` 模組包含以下聲明: ::" -#: ../../license.rst:420 +#: ../../license.rst:423 msgid "" "Copyright 2000 by Timothy O'Malley <timo@alum.mit.edu>\n" "\n" @@ -1125,15 +1127,15 @@ msgstr "" "ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n" "PERFORMANCE OF THIS SOFTWARE." -#: ../../license.rst:444 +#: ../../license.rst:447 msgid "Execution tracing" msgstr "執行追蹤" -#: ../../license.rst:446 +#: ../../license.rst:449 msgid "The :mod:`trace` module contains the following notice::" msgstr ":mod:`trace` 模組包含以下聲明: ::" -#: ../../license.rst:448 +#: ../../license.rst:451 msgid "" "portions copyright 2001, Autonomous Zones Industries, Inc., all rights...\n" "err... reserved and offered to the public under the terms of the\n" @@ -1189,15 +1191,15 @@ msgstr "" "Bioreason or Mojam Media be used in advertising or publicity pertaining to\n" "distribution of the software without specific, written prior permission." -#: ../../license.rst:477 +#: ../../license.rst:480 msgid "UUencode and UUdecode functions" msgstr "UUencode 與 UUdecode 函式" -#: ../../license.rst:479 +#: ../../license.rst:482 msgid "The ``uu`` codec contains the following notice::" msgstr "``uu`` 編解碼器包含以下聲明: ::" -#: ../../license.rst:481 +#: ../../license.rst:484 msgid "" "Copyright 1994 by Lance Ellinghouse\n" "Cathedral City, California Republic, United States of America.\n" @@ -1247,15 +1249,15 @@ msgstr "" " version is still 5 times faster, though.\n" "- Arguments more compliant with Python standard" -#: ../../license.rst:507 +#: ../../license.rst:510 msgid "XML Remote Procedure Calls" msgstr "XML 遠端程序呼叫" -#: ../../license.rst:509 +#: ../../license.rst:512 msgid "The :mod:`xmlrpc.client` module contains the following notice::" msgstr ":mod:`xmlrpc.client` 模組包含以下聲明: ::" -#: ../../license.rst:511 +#: ../../license.rst:514 msgid "" " The XML-RPC client interface is\n" "\n" @@ -1311,15 +1313,15 @@ msgstr "" "ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE\n" "OF THIS SOFTWARE." -#: ../../license.rst:540 +#: ../../license.rst:543 msgid "test_epoll" msgstr "test_epoll" -#: ../../license.rst:542 +#: ../../license.rst:545 msgid "The :mod:`!test.test_epoll` module contains the following notice::" msgstr ":mod:`!test.test_epoll` 模組包含以下聲明: ::" -#: ../../license.rst:544 +#: ../../license.rst:547 msgid "" "Copyright (c) 2001-2006 Twisted Matrix Laboratories.\n" "\n" @@ -1363,17 +1365,17 @@ msgstr "" "OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" "WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." -#: ../../license.rst:566 +#: ../../license.rst:569 msgid "Select kqueue" msgstr "Select kqueue" -#: ../../license.rst:568 +#: ../../license.rst:571 msgid "" "The :mod:`select` module contains the following notice for the kqueue " "interface::" msgstr ":mod:`select` 模組對於 kqueue 介面包含以下聲明: ::" -#: ../../license.rst:571 +#: ../../license.rst:574 msgid "" "Copyright (c) 2000 Doug White, 2006 James Knight, 2007 Christian Heimes\n" "All rights reserved.\n" @@ -1387,7 +1389,7 @@ msgid "" " notice, this list of conditions and the following disclaimer in the\n" " documentation and/or other materials provided with the distribution.\n" "\n" -"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS \"AS IS\" AND\n" "ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" "ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n" @@ -1411,7 +1413,7 @@ msgstr "" " notice, this list of conditions and the following disclaimer in the\n" " documentation and/or other materials provided with the distribution.\n" "\n" -"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS \"AS IS\" AND\n" "ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" "ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n" @@ -1423,11 +1425,11 @@ msgstr "" "OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" "SUCH DAMAGE." -#: ../../license.rst:597 +#: ../../license.rst:600 msgid "SipHash24" msgstr "SipHash24" -#: ../../license.rst:599 +#: ../../license.rst:602 msgid "" "The file :file:`Python/pyhash.c` contains Marek Majkowski' implementation of " "Dan Bernstein's SipHash24 algorithm. It contains the following note::" @@ -1435,7 +1437,7 @@ msgstr "" ":file:`Python/pyhash.c` 檔案包含 Marek Majkowski' 基於 Dan Bernstein 的 " "SipHash24 演算法的實作。它包含以下聲明: ::" -#: ../../license.rst:602 +#: ../../license.rst:605 msgid "" "<MIT License>\n" "Copyright (c) 2013 Marek Majkowski <marek@popcount.org>\n" @@ -1487,25 +1489,25 @@ msgstr "" " djb (supercop/crypto_auth/siphash24/little2)\n" " Jean-Philippe Aumasson (https://131002.net/siphash/siphash24.c)" -#: ../../license.rst:626 +#: ../../license.rst:629 msgid "strtod and dtoa" msgstr "strtod 與 dtoa" -#: ../../license.rst:628 +#: ../../license.rst:631 msgid "" "The file :file:`Python/dtoa.c`, which supplies C functions dtoa and strtod " "for conversion of C doubles to and from strings, is derived from the file of " -"the same name by David M. Gay, currently available from https://web.archive." -"org/web/20220517033456/http://www.netlib.org/fp/dtoa.c. The original file, " -"as retrieved on March 16, 2009, contains the following copyright and " -"licensing notice::" +"the same name by David M. Gay, currently available from https://" +"web.archive.org/web/20220517033456/http://www.netlib.org/fp/dtoa.c. The " +"original file, as retrieved on March 16, 2009, contains the following " +"copyright and licensing notice::" msgstr "" ":file:`Python/dtoa.c` 檔案提供了 C 的 dtoa 和 strtod 函式,用於將 C 的雙精度" "浮點數和字串互相轉換。該檔案是衍生自 David M. Gay 建立的同名檔案,後者現在可" "以從 https://web.archive.org/web/20220517033456/http://www.netlib.org/fp/" "dtoa.c 下載。於 2009 年 3 月 16 日所檢索的原始檔案包含以下版權與授權聲明: ::" -#: ../../license.rst:635 +#: ../../license.rst:638 msgid "" "/****************************************************************\n" " *\n" @@ -1547,12 +1549,11 @@ msgstr "" " *\n" " ***************************************************************/" -#: ../../license.rst:656 +#: ../../license.rst:659 msgid "OpenSSL" msgstr "OpenSSL" -#: ../../license.rst:658 -#, fuzzy +#: ../../license.rst:661 msgid "" "The modules :mod:`hashlib`, :mod:`posix` and :mod:`ssl` use the OpenSSL " "library for added performance if made available by the operating system. " @@ -1561,13 +1562,13 @@ msgid "" "For the OpenSSL 3.0 release, and later releases derived from that, the " "Apache License v2 applies::" msgstr "" -"如果 OpenSSL 函式庫可被作業系統使用,則 :mod:`hashlib`、:mod:`posix`、:mod:" -"`ssl`、:mod:`crypt` 模組會使用它來提升效能。此外,因為 Windows 和 macOS 的 " -"Python 安裝程式可能包含 OpenSSL 函式庫的副本,所以我們也在此收錄 OpenSSL 授權" -"的副本。對於 OpenSSL 3.0 版本以及由此衍生的更新版本則適用 Apache 許可證 " -"v2: ::" +"如果 OpenSSL 函式庫可被作業系統使用," +"則 :mod:`hashlib`、:mod:`posix`、:mod:`ssl` 模組會使用它來提升效能。此外,因" +"為 Windows 和 macOS 的 Python 安裝程式可能包含 OpenSSL 函式庫的副本,所以我們" +"也在此收錄 OpenSSL 授權的副本。對於 OpenSSL 3.0 版本以及由此衍生的更新版本則" +"適用 Apache 許可證 v2: ::" -#: ../../license.rst:666 +#: ../../license.rst:669 msgid "" " Apache License\n" " Version 2.0, January 2004\n" @@ -1923,11 +1924,11 @@ msgstr "" "\n" "END OF TERMS AND CONDITIONS" -#: ../../license.rst:845 +#: ../../license.rst:848 msgid "expat" msgstr "expat" -#: ../../license.rst:847 +#: ../../license.rst:850 msgid "" "The :mod:`pyexpat <xml.parsers.expat>` extension is built using an included " "copy of the expat sources unless the build is configured ``--with-system-" @@ -1936,7 +1937,7 @@ msgstr "" "除非在建置 :mod:`pyexpat <xml.parsers.expat>` 擴充時設定為 ``--with-system-" "expat``,否則該擴充會用一個內含 expat 原始碼的副本來建置: ::" -#: ../../license.rst:850 +#: ../../license.rst:853 msgid "" "Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd\n" " and Clark Cooper\n" @@ -1982,11 +1983,11 @@ msgstr "" "TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n" "SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." -#: ../../license.rst:874 +#: ../../license.rst:877 msgid "libffi" msgstr "libffi" -#: ../../license.rst:876 +#: ../../license.rst:879 msgid "" "The :mod:`!_ctypes` C extension underlying the :mod:`ctypes` module is built " "using an included copy of the libffi sources unless the build is configured " @@ -1995,13 +1996,13 @@ msgstr "" "除非在建置 :mod:`_ctypes` 模組底下 :mod:`!_ctypes` 擴充程式時設定為 ``--with-" "system-libffi``,否則該擴充會用一個內含 libffi 原始碼的副本來建置: ::" -#: ../../license.rst:880 +#: ../../license.rst:883 msgid "" "Copyright (c) 1996-2008 Red Hat, Inc and others.\n" "\n" "Permission is hereby granted, free of charge, to any person obtaining\n" "a copy of this software and associated documentation files (the\n" -"``Software''), to deal in the Software without restriction, including\n" +"\"Software\"), to deal in the Software without restriction, including\n" "without limitation the rights to use, copy, modify, merge, publish,\n" "distribute, sublicense, and/or sell copies of the Software, and to\n" "permit persons to whom the Software is furnished to do so, subject to\n" @@ -2010,7 +2011,7 @@ msgid "" "The above copyright notice and this permission notice shall be included\n" "in all copies or substantial portions of the Software.\n" "\n" -"THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" "MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" "NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n" @@ -2023,7 +2024,7 @@ msgstr "" "\n" "Permission is hereby granted, free of charge, to any person obtaining\n" "a copy of this software and associated documentation files (the\n" -"``Software''), to deal in the Software without restriction, including\n" +"\"Software\"), to deal in the Software without restriction, including\n" "without limitation the rights to use, copy, modify, merge, publish,\n" "distribute, sublicense, and/or sell copies of the Software, and to\n" "permit persons to whom the Software is furnished to do so, subject to\n" @@ -2032,7 +2033,7 @@ msgstr "" "The above copyright notice and this permission notice shall be included\n" "in all copies or substantial portions of the Software.\n" "\n" -"THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" "MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" "NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n" @@ -2041,11 +2042,11 @@ msgstr "" "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n" "DEALINGS IN THE SOFTWARE." -#: ../../license.rst:904 +#: ../../license.rst:907 msgid "zlib" msgstr "zlib" -#: ../../license.rst:906 +#: ../../license.rst:909 msgid "" "The :mod:`zlib` extension is built using an included copy of the zlib " "sources if the zlib version found on the system is too old to be used for " @@ -2054,7 +2055,7 @@ msgstr "" "如果在系統上找到的 zlib 版本太舊以致於無法用於建置 :mod:`zlib` 擴充,則該擴充" "會用一個內含 zlib 原始碼的副本來建置: ::" -#: ../../license.rst:910 +#: ../../license.rst:913 msgid "" "Copyright (C) 1995-2011 Jean-loup Gailly and Mark Adler\n" "\n" @@ -2102,11 +2103,11 @@ msgstr "" "Jean-loup Gailly Mark Adler\n" "jloup@gzip.org madler@alumni.caltech.edu" -#: ../../license.rst:935 +#: ../../license.rst:938 msgid "cfuhash" msgstr "cfuhash" -#: ../../license.rst:937 +#: ../../license.rst:940 msgid "" "The implementation of the hash table used by the :mod:`tracemalloc` is based " "on the cfuhash project::" @@ -2114,7 +2115,7 @@ msgstr "" ":mod:`tracemalloc` 使用的雜湊表 (hash table) 實作,是以 cfuhash 專案為基" "礎: ::" -#: ../../license.rst:940 +#: ../../license.rst:943 msgid "" "Copyright (c) 2005 Don Owens\n" "All rights reserved.\n" @@ -2184,11 +2185,11 @@ msgstr "" "ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n" "OF THE POSSIBILITY OF SUCH DAMAGE." -#: ../../license.rst:976 +#: ../../license.rst:979 msgid "libmpdec" msgstr "libmpdec" -#: ../../license.rst:978 +#: ../../license.rst:981 msgid "" "The :mod:`!_decimal` C extension underlying the :mod:`decimal` module is " "built using an included copy of the libmpdec library unless the build is " @@ -2198,7 +2199,7 @@ msgstr "" "with-system-libmpdec``,否則該模組會用一個內含 libmpdec 函式庫的副本來建" "置: ::" -#: ../../license.rst:982 +#: ../../license.rst:985 msgid "" "Copyright (c) 2008-2020 Stefan Krah. All rights reserved.\n" "\n" @@ -2250,11 +2251,11 @@ msgstr "" "OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" "SUCH DAMAGE." -#: ../../license.rst:1009 +#: ../../license.rst:1012 msgid "W3C C14N test suite" msgstr "W3C C14N 測試套件" -#: ../../license.rst:1011 +#: ../../license.rst:1014 msgid "" "The C14N 2.0 test suite in the :mod:`test` package (``Lib/test/xmltestdata/" "c14n-20/``) was retrieved from the W3C website at https://www.w3.org/TR/xml-" @@ -2264,7 +2265,7 @@ msgstr "" "是從 W3C 網站 https://www.w3.org/TR/xml-c14n2-testcases/ 被檢索,且是基於 3-" "clause BSD 授權被發佈: ::" -#: ../../license.rst:1016 +#: ../../license.rst:1019 msgid "" "Copyright (c) 2013 W3C(R) (MIT, ERCIM, Keio, Beihang),\n" "All Rights Reserved.\n" @@ -2322,15 +2323,15 @@ msgstr "" "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n" "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -#: ../../license.rst:1048 +#: ../../license.rst:1051 msgid "mimalloc" msgstr "mimalloc" -#: ../../license.rst:1050 +#: ../../license.rst:1053 msgid "MIT License::" -msgstr "" +msgstr "MIT 授權: ::" -#: ../../license.rst:1052 +#: ../../license.rst:1055 msgid "" "Copyright (c) 2018-2021 Microsoft Corporation, Daan Leijen\n" "\n" @@ -2386,11 +2387,11 @@ msgstr "" "THE\n" "SOFTWARE." -#: ../../license.rst:1074 +#: ../../license.rst:1077 msgid "asyncio" msgstr "asyncio" -#: ../../license.rst:1076 +#: ../../license.rst:1079 msgid "" "Parts of the :mod:`asyncio` module are incorporated from `uvloop 0.16 " "<https://github.com/MagicStack/uvloop/tree/v0.16.0>`_, which is distributed " @@ -2399,7 +2400,7 @@ msgstr "" ":mod:`asyncio` 模組的部分內容是從 `uvloop 0.16 <https://github.com/" "MagicStack/uvloop/tree/v0.16.0>`_ 中收錄過來,其基於 MIT 授權來發佈: ::" -#: ../../license.rst:1080 +#: ../../license.rst:1083 msgid "" "Copyright (c) 2015-2021 MagicStack Inc. http://magic.io\n" "\n" @@ -2443,19 +2444,19 @@ msgstr "" "OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" "WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." -#: ../../license.rst:1103 +#: ../../license.rst:1106 msgid "Global Unbounded Sequences (GUS)" msgstr "" -#: ../../license.rst:1105 +#: ../../license.rst:1108 msgid "" "The file :file:`Python/qsbr.c` is adapted from FreeBSD's \"Global Unbounded " -"Sequences\" safe memory reclamation scheme in `subr_smr.c <https://github." -"com/freebsd/freebsd-src/blob/main/sys/kern/subr_smr.c>`_. The file is " +"Sequences\" safe memory reclamation scheme in `subr_smr.c <https://" +"github.com/freebsd/freebsd-src/blob/main/sys/kern/subr_smr.c>`_. The file is " "distributed under the 2-Clause BSD License::" msgstr "" -#: ../../license.rst:1110 +#: ../../license.rst:1113 msgid "" "Copyright (c) 2019,2020 Jeffrey Roberson <jeff@FreeBSD.org>\n" "\n" @@ -2469,7 +2470,7 @@ msgid "" " notice, this list of conditions and the following disclaimer in the\n" " documentation and/or other materials provided with the distribution.\n" "\n" -"THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR \"AS IS\" AND ANY EXPRESS OR\n" "IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n" "OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n" "IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n" @@ -2492,7 +2493,7 @@ msgstr "" " notice, this list of conditions and the following disclaimer in the\n" " documentation and/or other materials provided with the distribution.\n" "\n" -"THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR \"AS IS\" AND ANY EXPRESS OR\n" "IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n" "OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n" "IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n" diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index d5a74fad17..d887991a95 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-29 11:18+0000\n" +"POT-Creation-Date: 2025-01-22 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -610,8 +610,8 @@ msgid "" msgstr "" #: ../../reference/compound_stmts.rst:526 -#: ../../reference/compound_stmts.rst:1547 -#: ../../reference/compound_stmts.rst:1588 +#: ../../reference/compound_stmts.rst:1549 +#: ../../reference/compound_stmts.rst:1590 msgid "The following code::" msgstr "以下程式碼: ::" @@ -625,7 +625,7 @@ msgstr "" #: ../../reference/compound_stmts.rst:531 #: ../../reference/compound_stmts.rst:556 -#: ../../reference/compound_stmts.rst:1593 +#: ../../reference/compound_stmts.rst:1595 msgid "is semantically equivalent to::" msgstr "在語義上等同於: ::" @@ -1543,7 +1543,7 @@ msgid ":class:`int`" msgstr ":class:`int`" #: ../../reference/compound_stmts.rst:1160 -#: ../../reference/compound_stmts.rst:1878 +#: ../../reference/compound_stmts.rst:1880 msgid ":class:`list`" msgstr ":class:`list`" @@ -1556,7 +1556,7 @@ msgid ":class:`str`" msgstr ":class:`str`" #: ../../reference/compound_stmts.rst:1163 -#: ../../reference/compound_stmts.rst:1881 +#: ../../reference/compound_stmts.rst:1883 msgid ":class:`tuple`" msgstr ":class:`tuple`" @@ -1606,7 +1606,7 @@ msgid "" "ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1228 +#: ../../reference/compound_stmts.rst:1230 msgid "" "A function definition is an executable statement. Its execution binds the " "function name in the current local namespace to a function object (a wrapper " @@ -1615,13 +1615,13 @@ msgid "" "used when the function is called." msgstr "" -#: ../../reference/compound_stmts.rst:1234 +#: ../../reference/compound_stmts.rst:1236 msgid "" "The function definition does not execute the function body; this gets " "executed only when the function is called. [#]_" msgstr "" -#: ../../reference/compound_stmts.rst:1240 +#: ../../reference/compound_stmts.rst:1242 msgid "" "A function definition may be wrapped by one or more :term:`decorator` " "expressions. Decorator expressions are evaluated when the function is " @@ -1632,7 +1632,7 @@ msgid "" "example, the following code ::" msgstr "" -#: ../../reference/compound_stmts.rst:1247 +#: ../../reference/compound_stmts.rst:1249 msgid "" "@f1(arg)\n" "@f2\n" @@ -1642,12 +1642,12 @@ msgstr "" "@f2\n" "def func(): pass" -#: ../../reference/compound_stmts.rst:1251 -#: ../../reference/compound_stmts.rst:1446 +#: ../../reference/compound_stmts.rst:1253 +#: ../../reference/compound_stmts.rst:1448 msgid "is roughly equivalent to ::" msgstr "大致等價於: ::" -#: ../../reference/compound_stmts.rst:1253 +#: ../../reference/compound_stmts.rst:1255 msgid "" "def func(): pass\n" "func = f1(arg)(f2(func))" @@ -1655,20 +1655,20 @@ msgstr "" "def func(): pass\n" "func = f1(arg)(f2(func))" -#: ../../reference/compound_stmts.rst:1256 +#: ../../reference/compound_stmts.rst:1258 msgid "" "except that the original function is not temporarily bound to the name " "``func``." msgstr "" -#: ../../reference/compound_stmts.rst:1258 +#: ../../reference/compound_stmts.rst:1260 msgid "" "Functions may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1263 +#: ../../reference/compound_stmts.rst:1265 msgid "" "A list of :ref:`type parameters <type-params>` may be given in square " "brackets between the function's name and the opening parenthesis for its " @@ -1678,12 +1678,12 @@ msgid "" "functions` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1270 -#: ../../reference/compound_stmts.rst:1465 +#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1467 msgid "Type parameter lists are new in Python 3.12." msgstr "" -#: ../../reference/compound_stmts.rst:1278 +#: ../../reference/compound_stmts.rst:1280 msgid "" "When one or more :term:`parameters <parameter>` have the form *parameter* " "``=`` *expression*, the function is said to have \"default parameter values." @@ -1694,7 +1694,7 @@ msgid "" "syntactic restriction that is not expressed by the grammar." msgstr "" -#: ../../reference/compound_stmts.rst:1286 +#: ../../reference/compound_stmts.rst:1288 msgid "" "**Default parameter values are evaluated from left to right when the " "function definition is executed.** This means that the expression is " @@ -1707,7 +1707,7 @@ msgid "" "the default, and explicitly test for it in the body of the function, e.g.::" msgstr "" -#: ../../reference/compound_stmts.rst:1296 +#: ../../reference/compound_stmts.rst:1298 msgid "" "def whats_on_the_telly(penguin=None):\n" " if penguin is None:\n" @@ -1716,7 +1716,7 @@ msgid "" " return penguin" msgstr "" -#: ../../reference/compound_stmts.rst:1307 +#: ../../reference/compound_stmts.rst:1309 msgid "" "Function call semantics are described in more detail in section :ref:" "`calls`. A function call always assigns values to all parameters mentioned " @@ -1732,13 +1732,13 @@ msgid "" "positional arguments." msgstr "" -#: ../../reference/compound_stmts.rst:1319 +#: ../../reference/compound_stmts.rst:1321 msgid "" "The ``/`` function parameter syntax may be used to indicate positional-only " "parameters. See :pep:`570` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1328 +#: ../../reference/compound_stmts.rst:1330 msgid "" "Parameters may have an :term:`annotation <function annotation>` of the form " "\"``: expression``\" following the parameter name. Any parameter may have " @@ -1757,13 +1757,13 @@ msgid "" "in the source code." msgstr "" -#: ../../reference/compound_stmts.rst:1342 +#: ../../reference/compound_stmts.rst:1344 msgid "" "Parameters of the form \"``*identifier``\" may have an annotation \"``: " "*expression``\". See :pep:`646`." msgstr "" -#: ../../reference/compound_stmts.rst:1348 +#: ../../reference/compound_stmts.rst:1350 msgid "" "It is also possible to create anonymous functions (functions not bound to a " "name), for immediate use in expressions. This uses lambda expressions, " @@ -1775,7 +1775,7 @@ msgid "" "execution of multiple statements and annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1356 +#: ../../reference/compound_stmts.rst:1358 msgid "" "**Programmer's note:** Functions are first-class objects. A \"``def``\" " "statement executed inside a function definition defines a local function " @@ -1784,61 +1784,61 @@ msgid "" "See section :ref:`naming` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1364 +#: ../../reference/compound_stmts.rst:1366 msgid ":pep:`3107` - Function Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1365 +#: ../../reference/compound_stmts.rst:1367 msgid "The original specification for function annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1367 +#: ../../reference/compound_stmts.rst:1369 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/compound_stmts.rst:1368 +#: ../../reference/compound_stmts.rst:1370 msgid "Definition of a standard meaning for annotations: type hints." msgstr "" -#: ../../reference/compound_stmts.rst:1370 +#: ../../reference/compound_stmts.rst:1372 msgid ":pep:`526` - Syntax for Variable Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1371 +#: ../../reference/compound_stmts.rst:1373 msgid "" "Ability to type hint variable declarations, including class variables and " "instance variables." msgstr "" -#: ../../reference/compound_stmts.rst:1374 +#: ../../reference/compound_stmts.rst:1376 msgid ":pep:`563` - Postponed Evaluation of Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1375 +#: ../../reference/compound_stmts.rst:1377 msgid "" "Support for forward references within annotations by preserving annotations " "in a string form at runtime instead of eager evaluation." msgstr "" -#: ../../reference/compound_stmts.rst:1378 +#: ../../reference/compound_stmts.rst:1380 msgid ":pep:`318` - Decorators for Functions and Methods" msgstr "" -#: ../../reference/compound_stmts.rst:1379 +#: ../../reference/compound_stmts.rst:1381 msgid "" "Function and method decorators were introduced. Class decorators were " "introduced in :pep:`3129`." msgstr "" -#: ../../reference/compound_stmts.rst:1385 +#: ../../reference/compound_stmts.rst:1387 msgid "Class definitions" msgstr "類別定義" -#: ../../reference/compound_stmts.rst:1400 +#: ../../reference/compound_stmts.rst:1402 msgid "A class definition defines a class object (see section :ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1407 +#: ../../reference/compound_stmts.rst:1409 msgid "" "A class definition is an executable statement. The inheritance list usually " "gives a list of base classes (see :ref:`metaclasses` for more advanced " @@ -1847,7 +1847,7 @@ msgid "" "default, from the base class :class:`object`; hence, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1413 +#: ../../reference/compound_stmts.rst:1415 msgid "" "class Foo:\n" " pass" @@ -1855,11 +1855,11 @@ msgstr "" "class Foo:\n" " pass" -#: ../../reference/compound_stmts.rst:1416 +#: ../../reference/compound_stmts.rst:1418 msgid "is equivalent to ::" msgstr "" -#: ../../reference/compound_stmts.rst:1418 +#: ../../reference/compound_stmts.rst:1420 msgid "" "class Foo(object):\n" " pass" @@ -1867,7 +1867,7 @@ msgstr "" "class Foo(object):\n" " pass" -#: ../../reference/compound_stmts.rst:1421 +#: ../../reference/compound_stmts.rst:1423 msgid "" "The class's suite is then executed in a new execution frame (see :ref:" "`naming`), using a newly created local namespace and the original global " @@ -1879,7 +1879,7 @@ msgid "" "original local namespace." msgstr "" -#: ../../reference/compound_stmts.rst:1430 +#: ../../reference/compound_stmts.rst:1432 msgid "" "The order in which attributes are defined in the class body is preserved in " "the new class's :attr:`~type.__dict__`. Note that this is reliable only " @@ -1887,17 +1887,17 @@ msgid "" "using the definition syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1435 +#: ../../reference/compound_stmts.rst:1437 msgid "" "Class creation can be customized heavily using :ref:`metaclasses " "<metaclasses>`." msgstr "" -#: ../../reference/compound_stmts.rst:1440 +#: ../../reference/compound_stmts.rst:1442 msgid "Classes can also be decorated: just like when decorating functions, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1442 +#: ../../reference/compound_stmts.rst:1444 msgid "" "@f1(arg)\n" "@f2\n" @@ -1907,7 +1907,7 @@ msgstr "" "@f2\n" "class Foo: pass" -#: ../../reference/compound_stmts.rst:1448 +#: ../../reference/compound_stmts.rst:1450 msgid "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" @@ -1915,20 +1915,20 @@ msgstr "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" -#: ../../reference/compound_stmts.rst:1451 +#: ../../reference/compound_stmts.rst:1453 msgid "" "The evaluation rules for the decorator expressions are the same as for " "function decorators. The result is then bound to the class name." msgstr "" -#: ../../reference/compound_stmts.rst:1454 +#: ../../reference/compound_stmts.rst:1456 msgid "" "Classes may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1459 +#: ../../reference/compound_stmts.rst:1461 msgid "" "A list of :ref:`type parameters <type-params>` may be given in square " "brackets immediately after the class's name. This indicates to static type " @@ -1937,7 +1937,7 @@ msgid "" "`generic-classes` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1468 +#: ../../reference/compound_stmts.rst:1470 msgid "" "**Programmer's note:** Variables defined in the class definition are class " "attributes; they are shared by instances. Instance attributes can be set in " @@ -1950,35 +1950,35 @@ msgid "" "implementation details." msgstr "" -#: ../../reference/compound_stmts.rst:1480 +#: ../../reference/compound_stmts.rst:1482 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/compound_stmts.rst:1481 +#: ../../reference/compound_stmts.rst:1483 msgid "" "The proposal that changed the declaration of metaclasses to the current " "syntax, and the semantics for how classes with metaclasses are constructed." msgstr "" -#: ../../reference/compound_stmts.rst:1485 +#: ../../reference/compound_stmts.rst:1487 msgid ":pep:`3129` - Class Decorators" msgstr ":pep:`3129` - 類別裝飾器" -#: ../../reference/compound_stmts.rst:1486 +#: ../../reference/compound_stmts.rst:1488 msgid "" "The proposal that added class decorators. Function and method decorators " "were introduced in :pep:`318`." msgstr "" -#: ../../reference/compound_stmts.rst:1493 +#: ../../reference/compound_stmts.rst:1495 msgid "Coroutines" msgstr "協程" -#: ../../reference/compound_stmts.rst:1501 +#: ../../reference/compound_stmts.rst:1503 msgid "Coroutine function definition" msgstr "協程函式定義" -#: ../../reference/compound_stmts.rst:1511 +#: ../../reference/compound_stmts.rst:1513 msgid "" "Execution of Python coroutines can be suspended and resumed at many points " "(see :term:`coroutine`). :keyword:`await` expressions, :keyword:`async for` " @@ -1986,23 +1986,23 @@ msgid "" "function." msgstr "" -#: ../../reference/compound_stmts.rst:1515 +#: ../../reference/compound_stmts.rst:1517 msgid "" "Functions defined with ``async def`` syntax are always coroutine functions, " "even if they do not contain ``await`` or ``async`` keywords." msgstr "" -#: ../../reference/compound_stmts.rst:1518 +#: ../../reference/compound_stmts.rst:1520 msgid "" "It is a :exc:`SyntaxError` to use a ``yield from`` expression inside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1521 +#: ../../reference/compound_stmts.rst:1523 msgid "An example of a coroutine function::" msgstr "一個協程函式範例: ::" -#: ../../reference/compound_stmts.rst:1523 +#: ../../reference/compound_stmts.rst:1525 msgid "" "async def func(param1, param2):\n" " do_stuff()\n" @@ -2012,30 +2012,30 @@ msgstr "" " do_stuff()\n" " await some_coroutine()" -#: ../../reference/compound_stmts.rst:1527 +#: ../../reference/compound_stmts.rst:1529 msgid "" "``await`` and ``async`` are now keywords; previously they were only treated " "as such inside the body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1535 +#: ../../reference/compound_stmts.rst:1537 msgid "The :keyword:`!async for` statement" msgstr ":keyword:`!async for` 陳述式" -#: ../../reference/compound_stmts.rst:1540 +#: ../../reference/compound_stmts.rst:1542 msgid "" "An :term:`asynchronous iterable` provides an ``__aiter__`` method that " "directly returns an :term:`asynchronous iterator`, which can call " "asynchronous code in its ``__anext__`` method." msgstr "" -#: ../../reference/compound_stmts.rst:1544 +#: ../../reference/compound_stmts.rst:1546 msgid "" "The ``async for`` statement allows convenient iteration over asynchronous " "iterables." msgstr "" -#: ../../reference/compound_stmts.rst:1549 +#: ../../reference/compound_stmts.rst:1551 msgid "" "async for TARGET in ITER:\n" " SUITE\n" @@ -2047,11 +2047,11 @@ msgstr "" "else:\n" " SUITE2" -#: ../../reference/compound_stmts.rst:1554 +#: ../../reference/compound_stmts.rst:1556 msgid "Is semantically equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1556 +#: ../../reference/compound_stmts.rst:1558 msgid "" "iter = (ITER)\n" "iter = type(iter).__aiter__(iter)\n" @@ -2081,28 +2081,28 @@ msgstr "" "else:\n" " SUITE2" -#: ../../reference/compound_stmts.rst:1570 +#: ../../reference/compound_stmts.rst:1572 msgid "" "See also :meth:`~object.__aiter__` and :meth:`~object.__anext__` for details." msgstr "更多細節請見 :meth:`~object.__aiter__` 與 :meth:`~object.__anext__`。" -#: ../../reference/compound_stmts.rst:1572 +#: ../../reference/compound_stmts.rst:1574 msgid "" "It is a :exc:`SyntaxError` to use an ``async for`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1580 +#: ../../reference/compound_stmts.rst:1582 msgid "The :keyword:`!async with` statement" msgstr ":keyword:`!async with` 陳述式" -#: ../../reference/compound_stmts.rst:1585 +#: ../../reference/compound_stmts.rst:1587 msgid "" "An :term:`asynchronous context manager` is a :term:`context manager` that is " "able to suspend execution in its *enter* and *exit* methods." msgstr "" -#: ../../reference/compound_stmts.rst:1590 +#: ../../reference/compound_stmts.rst:1592 msgid "" "async with EXPRESSION as TARGET:\n" " SUITE" @@ -2110,7 +2110,7 @@ msgstr "" "async with EXPRESSION as TARGET:\n" " SUITE" -#: ../../reference/compound_stmts.rst:1595 +#: ../../reference/compound_stmts.rst:1597 msgid "" "manager = (EXPRESSION)\n" "aenter = type(manager).__aenter__\n" @@ -2146,44 +2146,44 @@ msgstr "" " if not hit_except:\n" " await aexit(manager, None, None, None)" -#: ../../reference/compound_stmts.rst:1612 +#: ../../reference/compound_stmts.rst:1614 msgid "" "See also :meth:`~object.__aenter__` and :meth:`~object.__aexit__` for " "details." msgstr "更多細節請見 :meth:`~object.__aenter__` 與 :meth:`~object.__aexit__`。" -#: ../../reference/compound_stmts.rst:1614 +#: ../../reference/compound_stmts.rst:1616 msgid "" "It is a :exc:`SyntaxError` to use an ``async with`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1619 +#: ../../reference/compound_stmts.rst:1621 msgid ":pep:`492` - Coroutines with async and await syntax" msgstr "" -#: ../../reference/compound_stmts.rst:1620 +#: ../../reference/compound_stmts.rst:1622 msgid "" "The proposal that made coroutines a proper standalone concept in Python, and " "added supporting syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1626 +#: ../../reference/compound_stmts.rst:1628 msgid "Type parameter lists" msgstr "" -#: ../../reference/compound_stmts.rst:1630 +#: ../../reference/compound_stmts.rst:1632 msgid "Support for default values was added (see :pep:`696`)." msgstr "" -#: ../../reference/compound_stmts.rst:1643 +#: ../../reference/compound_stmts.rst:1645 msgid "" ":ref:`Functions <def>` (including :ref:`coroutines <async def>`), :ref:" "`classes <class>` and :ref:`type aliases <type>` may contain a type " "parameter list::" msgstr "" -#: ../../reference/compound_stmts.rst:1647 +#: ../../reference/compound_stmts.rst:1649 msgid "" "def max[T](args: list[T]) -> T:\n" " ...\n" @@ -2215,7 +2215,7 @@ msgstr "" "\n" "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1662 +#: ../../reference/compound_stmts.rst:1664 msgid "" "Semantically, this indicates that the function, class, or type alias is " "generic over a type variable. This information is primarily used by static " @@ -2223,7 +2223,7 @@ msgid "" "generic counterparts." msgstr "" -#: ../../reference/compound_stmts.rst:1667 +#: ../../reference/compound_stmts.rst:1669 msgid "" "Type parameters are declared in square brackets (``[]``) immediately after " "the name of the function, class, or type alias. The type parameters are " @@ -2235,36 +2235,36 @@ msgid "" "wraps the creation of the generic object." msgstr "" -#: ../../reference/compound_stmts.rst:1676 +#: ../../reference/compound_stmts.rst:1678 msgid "" "Generic functions, classes, and type aliases have a :attr:`~definition." "__type_params__` attribute listing their type parameters." msgstr "" -#: ../../reference/compound_stmts.rst:1679 +#: ../../reference/compound_stmts.rst:1681 msgid "Type parameters come in three kinds:" msgstr "" -#: ../../reference/compound_stmts.rst:1681 +#: ../../reference/compound_stmts.rst:1683 msgid "" ":data:`typing.TypeVar`, introduced by a plain name (e.g., ``T``). " "Semantically, this represents a single type to a type checker." msgstr "" -#: ../../reference/compound_stmts.rst:1683 +#: ../../reference/compound_stmts.rst:1685 msgid "" ":data:`typing.TypeVarTuple`, introduced by a name prefixed with a single " "asterisk (e.g., ``*Ts``). Semantically, this stands for a tuple of any " "number of types." msgstr "" -#: ../../reference/compound_stmts.rst:1686 +#: ../../reference/compound_stmts.rst:1688 msgid "" ":data:`typing.ParamSpec`, introduced by a name prefixed with two asterisks " "(e.g., ``**P``). Semantically, this stands for the parameters of a callable." msgstr "" -#: ../../reference/compound_stmts.rst:1689 +#: ../../reference/compound_stmts.rst:1691 msgid "" ":data:`typing.TypeVar` declarations can define *bounds* and *constraints* " "with a colon (``:``) followed by an expression. A single expression after " @@ -2276,7 +2276,7 @@ msgid "" "variables can only take on one of the types in the list of constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1698 +#: ../../reference/compound_stmts.rst:1700 msgid "" "For :data:`!typing.TypeVar`\\ s declared using the type parameter list " "syntax, the bound and constraints are not evaluated when the generic object " @@ -2286,13 +2286,13 @@ msgid "" "<annotation-scopes>`." msgstr "" -#: ../../reference/compound_stmts.rst:1704 +#: ../../reference/compound_stmts.rst:1706 msgid "" ":data:`typing.TypeVarTuple`\\ s and :data:`typing.ParamSpec`\\ s cannot have " "bounds or constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1707 +#: ../../reference/compound_stmts.rst:1709 msgid "" "All three flavors of type parameters can also have a *default value*, which " "is used when the type parameter is not explicitly provided. This is added by " @@ -2305,13 +2305,13 @@ msgid "" "attribute is set to the special sentinel object :data:`typing.NoDefault`." msgstr "" -#: ../../reference/compound_stmts.rst:1717 +#: ../../reference/compound_stmts.rst:1719 msgid "" "The following example indicates the full set of allowed type parameter " "declarations::" msgstr "" -#: ../../reference/compound_stmts.rst:1719 +#: ../../reference/compound_stmts.rst:1721 msgid "" "def overly_generic[\n" " SimpleTypeVar,\n" @@ -2343,24 +2343,24 @@ msgstr "" " *e: SimpleTypeVarTuple,\n" "): ..." -#: ../../reference/compound_stmts.rst:1737 +#: ../../reference/compound_stmts.rst:1739 msgid "Generic functions" msgstr "" -#: ../../reference/compound_stmts.rst:1739 +#: ../../reference/compound_stmts.rst:1741 msgid "Generic functions are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1741 +#: ../../reference/compound_stmts.rst:1743 msgid "def func[T](arg: T): ..." msgstr "def func[T](arg: T): ..." -#: ../../reference/compound_stmts.rst:1743 -#: ../../reference/compound_stmts.rst:1803 +#: ../../reference/compound_stmts.rst:1745 +#: ../../reference/compound_stmts.rst:1805 msgid "This syntax is equivalent to::" msgstr "語法大致等價於: ::" -#: ../../reference/compound_stmts.rst:1745 +#: ../../reference/compound_stmts.rst:1747 msgid "" "annotation-def TYPE_PARAMS_OF_func():\n" " T = typing.TypeVar(\"T\")\n" @@ -2376,7 +2376,7 @@ msgstr "" " return func\n" "func = TYPE_PARAMS_OF_func()" -#: ../../reference/compound_stmts.rst:1752 +#: ../../reference/compound_stmts.rst:1754 msgid "" "Here ``annotation-def`` indicates an :ref:`annotation scope <annotation-" "scopes>`, which is not actually bound to any name at runtime. (One other " @@ -2385,20 +2385,20 @@ msgid "" "data:`typing.TypeVar` directly.)" msgstr "" -#: ../../reference/compound_stmts.rst:1758 +#: ../../reference/compound_stmts.rst:1760 msgid "" "The annotations of generic functions are evaluated within the annotation " "scope used for declaring the type parameters, but the function's defaults " "and decorators are not." msgstr "" -#: ../../reference/compound_stmts.rst:1762 +#: ../../reference/compound_stmts.rst:1764 msgid "" "The following example illustrates the scoping rules for these cases, as well " "as for additional flavors of type parameters::" msgstr "" -#: ../../reference/compound_stmts.rst:1765 +#: ../../reference/compound_stmts.rst:1767 msgid "" "@decorator\n" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" @@ -2408,13 +2408,13 @@ msgstr "" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" " ..." -#: ../../reference/compound_stmts.rst:1769 +#: ../../reference/compound_stmts.rst:1771 msgid "" "Except for the :ref:`lazy evaluation <lazy-evaluation>` of the :class:" "`~typing.TypeVar` bound, this is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1772 +#: ../../reference/compound_stmts.rst:1774 msgid "" "DEFAULT_OF_arg = some_default\n" "\n" @@ -2436,25 +2436,25 @@ msgid "" "func = decorator(TYPE_PARAMS_OF_func())" msgstr "" -#: ../../reference/compound_stmts.rst:1791 +#: ../../reference/compound_stmts.rst:1793 msgid "" "The capitalized names like ``DEFAULT_OF_arg`` are not actually bound at " "runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1797 +#: ../../reference/compound_stmts.rst:1799 msgid "Generic classes" msgstr "" -#: ../../reference/compound_stmts.rst:1799 +#: ../../reference/compound_stmts.rst:1801 msgid "Generic classes are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1801 +#: ../../reference/compound_stmts.rst:1803 msgid "class Bag[T]: ..." msgstr "class Bag[T]: ..." -#: ../../reference/compound_stmts.rst:1805 +#: ../../reference/compound_stmts.rst:1807 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2472,14 +2472,14 @@ msgstr "" " return Bag\n" "Bag = TYPE_PARAMS_OF_Bag()" -#: ../../reference/compound_stmts.rst:1813 +#: ../../reference/compound_stmts.rst:1815 msgid "" "Here again ``annotation-def`` (not a real keyword) indicates an :ref:" "`annotation scope <annotation-scopes>`, and the name ``TYPE_PARAMS_OF_Bag`` " "is not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1817 +#: ../../reference/compound_stmts.rst:1819 msgid "" "Generic classes implicitly inherit from :data:`typing.Generic`. The base " "classes and keyword arguments of generic classes are evaluated within the " @@ -2487,7 +2487,7 @@ msgid "" "that scope. This is illustrated by this example::" msgstr "" -#: ../../reference/compound_stmts.rst:1823 +#: ../../reference/compound_stmts.rst:1825 msgid "" "@decorator\n" "class Bag(Base[T], arg=T): ..." @@ -2495,11 +2495,11 @@ msgstr "" "@decorator\n" "class Bag(Base[T], arg=T): ..." -#: ../../reference/compound_stmts.rst:1826 +#: ../../reference/compound_stmts.rst:1828 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../reference/compound_stmts.rst:1828 +#: ../../reference/compound_stmts.rst:1830 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2517,27 +2517,27 @@ msgstr "" " return Bag\n" "Bag = decorator(TYPE_PARAMS_OF_Bag())" -#: ../../reference/compound_stmts.rst:1839 +#: ../../reference/compound_stmts.rst:1841 msgid "Generic type aliases" msgstr "" -#: ../../reference/compound_stmts.rst:1841 +#: ../../reference/compound_stmts.rst:1843 msgid "" "The :keyword:`type` statement can also be used to create a generic type " "alias::" msgstr "" -#: ../../reference/compound_stmts.rst:1843 +#: ../../reference/compound_stmts.rst:1845 msgid "type ListOrSet[T] = list[T] | set[T]" msgstr "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1845 +#: ../../reference/compound_stmts.rst:1847 msgid "" "Except for the :ref:`lazy evaluation <lazy-evaluation>` of the value, this " "is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1848 +#: ../../reference/compound_stmts.rst:1850 msgid "" "annotation-def TYPE_PARAMS_OF_ListOrSet():\n" " T = typing.TypeVar(\"T\")\n" @@ -2550,105 +2550,105 @@ msgid "" "ListOrSet = TYPE_PARAMS_OF_ListOrSet()" msgstr "" -#: ../../reference/compound_stmts.rst:1857 +#: ../../reference/compound_stmts.rst:1859 msgid "" "Here, ``annotation-def`` (not a real keyword) indicates an :ref:`annotation " "scope <annotation-scopes>`. The capitalized names like " "``TYPE_PARAMS_OF_ListOrSet`` are not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1862 +#: ../../reference/compound_stmts.rst:1864 msgid "Footnotes" msgstr "註解" -#: ../../reference/compound_stmts.rst:1863 +#: ../../reference/compound_stmts.rst:1865 msgid "" "The exception is propagated to the invocation stack unless there is a :" "keyword:`finally` clause which happens to raise another exception. That new " "exception causes the old one to be lost." msgstr "" -#: ../../reference/compound_stmts.rst:1867 +#: ../../reference/compound_stmts.rst:1869 msgid "In pattern matching, a sequence is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1869 +#: ../../reference/compound_stmts.rst:1871 msgid "a class that inherits from :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1870 +#: ../../reference/compound_stmts.rst:1872 msgid "" "a Python class that has been registered as :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1871 +#: ../../reference/compound_stmts.rst:1873 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_SEQUENCE` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1872 -#: ../../reference/compound_stmts.rst:1891 +#: ../../reference/compound_stmts.rst:1874 +#: ../../reference/compound_stmts.rst:1893 msgid "a class that inherits from any of the above" msgstr "" -#: ../../reference/compound_stmts.rst:1874 +#: ../../reference/compound_stmts.rst:1876 msgid "The following standard library classes are sequences:" msgstr "" -#: ../../reference/compound_stmts.rst:1876 +#: ../../reference/compound_stmts.rst:1878 msgid ":class:`array.array`" msgstr ":class:`array.array`" -#: ../../reference/compound_stmts.rst:1877 +#: ../../reference/compound_stmts.rst:1879 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../reference/compound_stmts.rst:1879 +#: ../../reference/compound_stmts.rst:1881 msgid ":class:`memoryview`" msgstr ":class:`memoryview`" -#: ../../reference/compound_stmts.rst:1880 +#: ../../reference/compound_stmts.rst:1882 msgid ":class:`range`" msgstr ":class:`range`" -#: ../../reference/compound_stmts.rst:1883 +#: ../../reference/compound_stmts.rst:1885 msgid "" "Subject values of type ``str``, ``bytes``, and ``bytearray`` do not match " "sequence patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1886 +#: ../../reference/compound_stmts.rst:1888 msgid "In pattern matching, a mapping is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1888 +#: ../../reference/compound_stmts.rst:1890 msgid "a class that inherits from :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1889 +#: ../../reference/compound_stmts.rst:1891 msgid "" "a Python class that has been registered as :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1890 +#: ../../reference/compound_stmts.rst:1892 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_MAPPING` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1893 +#: ../../reference/compound_stmts.rst:1895 msgid "" "The standard library classes :class:`dict` and :class:`types." "MappingProxyType` are mappings." msgstr "" -#: ../../reference/compound_stmts.rst:1896 +#: ../../reference/compound_stmts.rst:1898 msgid "" "A string literal appearing as the first statement in the function body is " "transformed into the function's :attr:`~function.__doc__` attribute and " "therefore the function's :term:`docstring`." msgstr "" -#: ../../reference/compound_stmts.rst:1900 +#: ../../reference/compound_stmts.rst:1902 msgid "" "A string literal appearing as the first statement in the class body is " "transformed into the namespace's :attr:`~type.__doc__` item and therefore " @@ -2670,10 +2670,10 @@ msgstr "compound(複合)" #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:588 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1387 -#: ../../reference/compound_stmts.rst:1497 -#: ../../reference/compound_stmts.rst:1531 -#: ../../reference/compound_stmts.rst:1576 +#: ../../reference/compound_stmts.rst:1389 +#: ../../reference/compound_stmts.rst:1499 +#: ../../reference/compound_stmts.rst:1533 +#: ../../reference/compound_stmts.rst:1578 msgid "statement" msgstr "statement(陳述式)" @@ -2721,7 +2721,7 @@ msgstr "if" #: ../../reference/compound_stmts.rst:408 #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:588 -#: ../../reference/compound_stmts.rst:1507 +#: ../../reference/compound_stmts.rst:1509 msgid "keyword" msgstr "keyword(關鍵字)" @@ -2735,8 +2735,8 @@ msgstr "elif" #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:588 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1323 -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1325 +#: ../../reference/compound_stmts.rst:1389 msgid ": (colon)" msgstr ": (冒號)" @@ -2746,7 +2746,7 @@ msgstr ": (冒號)" #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:588 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1389 msgid "compound statement" msgstr "compound statement(複合陳述式)" @@ -2792,7 +2792,7 @@ msgstr "list(串列)" #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:298 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1389 msgid "object" msgstr "object(物件)" @@ -2863,7 +2863,7 @@ msgstr "with statement(with 陳述式)" #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1389 msgid ", (comma)" msgstr ", (逗號)" @@ -2904,15 +2904,15 @@ msgid "AS pattern, OR pattern, capture pattern, wildcard pattern" msgstr "" #: ../../reference/compound_stmts.rst:1186 -#: ../../reference/compound_stmts.rst:1273 +#: ../../reference/compound_stmts.rst:1275 msgid "parameter" msgstr "parameter(參數)" #: ../../reference/compound_stmts.rst:1186 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1237 -#: ../../reference/compound_stmts.rst:1273 -#: ../../reference/compound_stmts.rst:1302 +#: ../../reference/compound_stmts.rst:1239 +#: ../../reference/compound_stmts.rst:1275 +#: ../../reference/compound_stmts.rst:1304 msgid "function definition" msgstr "function definition(函式定義)" @@ -2921,22 +2921,22 @@ msgid "def" msgstr "def" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1323 +#: ../../reference/compound_stmts.rst:1325 msgid "function" msgstr "function (函式)" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1389 msgid "definition" msgstr "definition(定義)" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1389 msgid "name" msgstr "name(名稱)" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1389 msgid "binding" msgstr "binding(綁定)" @@ -2945,7 +2945,7 @@ msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1389 msgid "() (parentheses)" msgstr "() (圓括號)" @@ -2953,108 +2953,108 @@ msgstr "() (圓括號)" msgid "parameter list" msgstr "parameter list(參數列表)" -#: ../../reference/compound_stmts.rst:1237 -#: ../../reference/compound_stmts.rst:1437 +#: ../../reference/compound_stmts.rst:1239 +#: ../../reference/compound_stmts.rst:1439 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/compound_stmts.rst:1273 +#: ../../reference/compound_stmts.rst:1275 msgid "default" msgstr "default(預設)" -#: ../../reference/compound_stmts.rst:1273 +#: ../../reference/compound_stmts.rst:1275 msgid "value" msgstr "value(值)" -#: ../../reference/compound_stmts.rst:1273 +#: ../../reference/compound_stmts.rst:1275 msgid "argument" msgstr "argument(引數)" -#: ../../reference/compound_stmts.rst:1273 +#: ../../reference/compound_stmts.rst:1275 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/compound_stmts.rst:1302 +#: ../../reference/compound_stmts.rst:1304 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/compound_stmts.rst:1302 +#: ../../reference/compound_stmts.rst:1304 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/compound_stmts.rst:1302 +#: ../../reference/compound_stmts.rst:1304 msgid "**" msgstr "**" -#: ../../reference/compound_stmts.rst:1323 +#: ../../reference/compound_stmts.rst:1325 msgid "annotations" msgstr "annotations(註釋)" -#: ../../reference/compound_stmts.rst:1323 +#: ../../reference/compound_stmts.rst:1325 msgid "->" msgstr "->" -#: ../../reference/compound_stmts.rst:1323 +#: ../../reference/compound_stmts.rst:1325 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../reference/compound_stmts.rst:1346 +#: ../../reference/compound_stmts.rst:1348 msgid "lambda" msgstr "lambda" -#: ../../reference/compound_stmts.rst:1346 +#: ../../reference/compound_stmts.rst:1348 msgid "expression" msgstr "expression(運算式)" -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1389 msgid "class" msgstr "class(類別)" -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1389 msgid "execution" msgstr "execution(執行)" -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1389 msgid "frame" msgstr "frame" -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1389 msgid "inheritance" msgstr "inheritance(繼承)" -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1389 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../reference/compound_stmts.rst:1387 -#: ../../reference/compound_stmts.rst:1437 +#: ../../reference/compound_stmts.rst:1389 +#: ../../reference/compound_stmts.rst:1439 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1389 msgid "expression list" msgstr "expression list(表達式列表)" -#: ../../reference/compound_stmts.rst:1497 +#: ../../reference/compound_stmts.rst:1499 msgid "async def" msgstr "async def" -#: ../../reference/compound_stmts.rst:1507 +#: ../../reference/compound_stmts.rst:1509 msgid "async" msgstr "async" -#: ../../reference/compound_stmts.rst:1507 +#: ../../reference/compound_stmts.rst:1509 msgid "await" msgstr "await" -#: ../../reference/compound_stmts.rst:1531 +#: ../../reference/compound_stmts.rst:1533 msgid "async for" msgstr "async for" -#: ../../reference/compound_stmts.rst:1576 +#: ../../reference/compound_stmts.rst:1578 msgid "async with" msgstr "async with" -#: ../../reference/compound_stmts.rst:1633 +#: ../../reference/compound_stmts.rst:1635 msgid "type parameters" msgstr "type parameter(型別參數)" diff --git a/sphinx.po b/sphinx.po index f044d5a9c6..58dbb67f14 100644 --- a/sphinx.po +++ b/sphinx.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-02-07 15:02+0800\n" "PO-Revision-Date: 2023-03-15 10:19+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -74,8 +74,8 @@ msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.zip\">Download</a> " "(ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.zip\">下載</a> (ca. " -"%(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.zip\">下載</a> (ca. %" +"(download_size)s MiB)" #: ../../tools/templates/download.html:32 msgid "" @@ -94,8 +94,8 @@ msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.zip\">Download</a> " "(ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.zip\">下載</a> (ca. " -"%(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.zip\">下載</a> (ca. %" +"(download_size)s MiB)" #: ../../tools/templates/download.html:37 msgid "" @@ -114,8 +114,8 @@ msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.zip\">Download</a> " "(ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.zip\">下載</a> (ca. " -"%(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.zip\">下載</a> (ca. %" +"(download_size)s MiB)" #: ../../tools/templates/download.html:42 msgid "" @@ -151,11 +151,11 @@ msgstr "EPUB" #: ../../tools/templates/download.html:51 msgid "" -"<a href=\"%(dl_base)s/python-%(dl_version)s-docs.epub\">Download</a> (ca. " -"%(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs.epub\">Download</a> (ca. %" +"(download_size)s MiB)" msgstr "" -"<a href=\"%(dl_base)s/python-%(dl_version)s-docs.epub\">下載</a> (ca. " -"%(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs.epub\">下載</a> (ca. %" +"(download_size)s MiB)" #: ../../tools/templates/download.html:56 msgid "These archives contain all the content in the documentation." @@ -176,9 +176,9 @@ msgid "" "best compression and fastest download times." msgstr "" "Unix 使用者應該下載 .tar.bz2 歸檔;這些是 bzipped tar 歸檔,可以使用 tar 和 " -"bzip2 來處理。如果需要的話,可以使用 <a href=\"https://infozip.sourceforge./" -"net\">Info-ZIP</a> 解壓縮程式來處理 ZIP 歸檔。.tar.bz2 歸檔提供最佳壓縮率和最" -"快的下載時間。" +"bzip2 來處理。如果需要的話,可以使用 <a href=\"https://" +"infozip.sourceforge.net\">Info-ZIP</a> 解壓縮程式來處理 ZIP 歸檔。.tar.bz2 歸" +"檔提供最佳壓縮率和最快的下載時間。" #: ../../tools/templates/download.html:67 msgid "" @@ -198,91 +198,95 @@ msgid "" "send\n" "email to <a href=\"mailto:docs@python.org\">docs@python.org</a>." msgstr "" -"如果你對 Python 說明文件有任何意見或建議,請寄電子郵件至 <a href=\"mailto:" -"docs@python.org\">docs@python.org</a>。" +"如果你對 Python 說明文件有任何意見或建議,請寄電子郵件至 <a " +"href=\"mailto:docs@python.org\">docs@python.org</a>。" #: ../../tools/templates/dummy.html:6 -msgid "CPython implementation detail:" -msgstr "CPython 實作細節:" +msgid "Availability" +msgstr "適用" -#: ../../tools/templates/dummy.html:7 -msgid "" -"Deprecated since version {deprecated}, will be removed in version {removed}" -msgstr "自從版本 {deprecated} 後不推薦使用,將會自版本 {removed} 中移除。" - -#: ../../tools/templates/dummy.html:8 -msgid "Deprecated since version {deprecated}, removed in version {removed}" -msgstr "自從版本 {deprecated} 後不推薦使用,已從版本 {removed} 中移除。" - -#: ../../tools/templates/dummy.html:12 +#: ../../tools/templates/dummy.html:10 msgid "Part of the" msgstr "為" -#: ../../tools/templates/dummy.html:13 +#: ../../tools/templates/dummy.html:11 msgid "Limited API" msgstr "受限 API 的一部分" -#: ../../tools/templates/dummy.html:14 +#: ../../tools/templates/dummy.html:12 msgid "Stable ABI" msgstr "穩定 ABI 的一部分" -#: ../../tools/templates/dummy.html:15 +#: ../../tools/templates/dummy.html:13 msgid "(as an opaque struct)" msgstr "(做為一個不透明結構 (opaque struct))" -#: ../../tools/templates/dummy.html:16 +#: ../../tools/templates/dummy.html:14 msgid "(including all members)" msgstr "(包含所有成員)" -#: ../../tools/templates/dummy.html:17 +#: ../../tools/templates/dummy.html:15 msgid "since version %s" msgstr "自 %s 版本開始" -#: ../../tools/templates/dummy.html:18 +#: ../../tools/templates/dummy.html:16 msgid "(Only some members are part of the stable ABI.)" msgstr "(只有部分成員是穩定 ABI 的一部分。)" -#: ../../tools/templates/dummy.html:19 +#: ../../tools/templates/dummy.html:17 msgid "This is" msgstr "這是" -#: ../../tools/templates/dummy.html:20 +#: ../../tools/templates/dummy.html:18 msgid "Unstable API" msgstr "不穩定 API" -#: ../../tools/templates/dummy.html:21 +#: ../../tools/templates/dummy.html:19 msgid ". It may change without warning in minor releases." msgstr ",它可能在小版本發布中沒有任何警告地被變更。" -#: ../../tools/templates/dummy.html:22 +#: ../../tools/templates/dummy.html:20 msgid "Return value: Always NULL." msgstr "回傳值:總是為 NULL。" -#: ../../tools/templates/dummy.html:23 +#: ../../tools/templates/dummy.html:21 msgid "Return value: New reference." msgstr "回傳值:新的參照。" -#: ../../tools/templates/dummy.html:24 +#: ../../tools/templates/dummy.html:22 msgid "Return value: Borrowed reference." msgstr "回傳值:借用參照。" -#: ../../tools/templates/dummy.html:28 +#: ../../tools/templates/dummy.html:26 +msgid "CPython implementation detail:" +msgstr "CPython 實作細節:" + +#: ../../tools/templates/dummy.html:30 +msgid "" +"Deprecated since version {deprecated}, will be removed in version {removed}" +msgstr "自從版本 {deprecated} 後不推薦使用,將會自版本 {removed} 中移除。" + +#: ../../tools/templates/dummy.html:31 +msgid "Deprecated since version {deprecated}, removed in version {removed}" +msgstr "自從版本 {deprecated} 後不推薦使用,已從版本 {removed} 中移除。" + +#: ../../tools/templates/dummy.html:35 msgid "in development" msgstr "開發中" -#: ../../tools/templates/dummy.html:29 +#: ../../tools/templates/dummy.html:36 msgid "pre-release" msgstr "預發行" -#: ../../tools/templates/dummy.html:30 +#: ../../tools/templates/dummy.html:37 msgid "stable" msgstr "穩定版本" -#: ../../tools/templates/dummy.html:31 +#: ../../tools/templates/dummy.html:38 msgid "security-fixes" msgstr "安全性修護" -#: ../../tools/templates/dummy.html:32 +#: ../../tools/templates/dummy.html:39 msgid "EOL" msgstr "停止維護" @@ -521,8 +525,8 @@ msgstr "當前穩定發行的 Python 版本說明文件" #: ../../tools/templates/layout.html:14 msgid "" -"This is a deploy preview created from a <a href=\"%(repository_url)s/pull/" -"%(pr_id)s\">pull request</a>.\n" +"This is a deploy preview created from a <a href=\"%(repository_url)s/pull/%" +"(pr_id)s\">pull request</a>.\n" " For authoritative documentation, see" msgstr "" "這是從 <a href=\"%(repository_url)s/pull/%(pr_id)s\">pull request(拉取請求)" diff --git a/using/cmdline.po b/using/cmdline.po index 83a4704e76..ee77384f74 100644 --- a/using/cmdline.po +++ b/using/cmdline.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-01-24 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1494,8 +1494,8 @@ msgstr "" #: ../../using/cmdline.rst:1200 msgid "" -"If this variable is set to ``1``, the interpreter will not attempt to load " -"the Python-based :term:`REPL` that requires :mod:`curses` and :mod:" +"If this variable is set to any value, the interpreter will not attempt to " +"load the Python-based :term:`REPL` that requires :mod:`curses` and :mod:" "`readline`, and will instead use the traditional parser-based :term:`REPL`." msgstr "" diff --git a/using/configure.po b/using/configure.po index caaba60971..edacd303ff 100644 --- a/using/configure.po +++ b/using/configure.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # @@ -8,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-13 00:13+0000\n" +"POT-Creation-Date: 2025-01-31 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,9 +26,8 @@ msgid "Build Requirements" msgstr "建置需求" #: ../../using/configure.rst:10 -#, fuzzy msgid "Features and minimum versions required to build CPython:" -msgstr "建置 CPython 所需的功能:" +msgstr "建置 CPython 所需的功能與最小版本:" #: ../../using/configure.rst:12 msgid "" @@ -45,8 +43,8 @@ msgstr "在 Windows 上需要 Microsoft Visual Studio 2017 或更新版本。" #: ../../using/configure.rst:19 msgid "" "Support for `IEEE 754 <https://en.wikipedia.org/wiki/IEEE_754>`_ floating-" -"point numbers and `floating-point Not-a-Number (NaN) <https://en.wikipedia." -"org/wiki/NaN#Floating_point>`_." +"point numbers and `floating-point Not-a-Number (NaN) <https://" +"en.wikipedia.org/wiki/NaN#Floating_point>`_." msgstr "" #: ../../using/configure.rst:23 @@ -60,9 +58,8 @@ msgid "" msgstr "" #: ../../using/configure.rst:28 -#, fuzzy msgid "SQLite 3.15.2 for the :mod:`sqlite3` extension module." -msgstr "請見 :mod:`ssl` 模組。" +msgstr "" #: ../../using/configure.rst:30 msgid "Tcl/Tk 8.5.12 for the :mod:`tkinter` module." @@ -70,21 +67,21 @@ msgstr "" #: ../../using/configure.rst:32 msgid "" -"Autoconf 2.71 and aclocal 1.16.5 are required to regenerate the :file:" -"`configure` script." +"Autoconf 2.71 and aclocal 1.16.5 are required to regenerate " +"the :file:`configure` script." msgstr "" #: ../../using/configure.rst:35 -#, fuzzy msgid "Tcl/Tk version 8.3.1 is now required." -msgstr "OpenSSL 1.1.1 現在是必要的。" +msgstr "Tcl/Tk version 8.3.1 現在是必要的。" #: ../../using/configure.rst:38 -#, fuzzy msgid "" "On Windows, Visual Studio 2015 or later is now required. Tcl/Tk version 8.4 " "is now required." -msgstr "在 Windows 上需要 Visual Studio 2015 或更新版本。" +msgstr "" +"在 Windows 上,Visual Studio 2015 或更新版本與 Tcl/Tk version 8.4 現在是必要" +"的。" #: ../../using/configure.rst:42 msgid "" @@ -97,9 +94,8 @@ msgid "Thread support and OpenSSL 1.0.2 are now required." msgstr "對執行緒與 OpenSSL 1.0.2 的支援現在是必要的。" #: ../../using/configure.rst:49 -#, fuzzy msgid "OpenSSL 1.1.1 is now required. Require SQLite 3.7.15." -msgstr "OpenSSL 1.1.1 現在是必要的。" +msgstr "OpenSSL 1.1.1 現在是必要的。需要 SQLite 3.7.15。" #: ../../using/configure.rst:53 msgid "" @@ -178,12 +174,11 @@ msgstr "設定選項" #: ../../using/configure.rst:100 msgid "List all :file:`configure` script options using::" -msgstr "" +msgstr "使用以下命令列出所有 :file:`configure` 腳本選項: ::" #: ../../using/configure.rst:102 -#, fuzzy msgid "./configure --help" -msgstr "設定腳本" +msgstr "./configure --help" #: ../../using/configure.rst:104 msgid "" @@ -203,16 +198,16 @@ msgstr "" #: ../../using/configure.rst:114 msgid "" -"See the :meth:`sqlite3.Connection.enable_load_extension` method of the :mod:" -"`sqlite3` module." +"See the :meth:`sqlite3.Connection.enable_load_extension` method of " +"the :mod:`sqlite3` module." msgstr "" "請見 :mod:`sqlite3` 模組的 :meth:`sqlite3.Connection.enable_load_extension` " "方法。" #: ../../using/configure.rst:121 msgid "" -"Disable IPv6 support (enabled by default if supported), see the :mod:" -"`socket` module." +"Disable IPv6 support (enabled by default if supported), see " +"the :mod:`socket` module." msgstr "停用 IPv6 支援(如果支援的話預設是啟用的),請見 :mod:`socket` 模組。" #: ../../using/configure.rst:126 @@ -238,8 +233,8 @@ msgstr "將 Python 執行檔的後綴設定為 *SUFFIX*。" #: ../../using/configure.rst:138 msgid "" "The default suffix is ``.exe`` on Windows and macOS (``python.exe`` " -"executable), ``.js`` on Emscripten node, ``.html`` on Emscripten browser, ``." -"wasm`` on WASI, and an empty string on other platforms (``python`` " +"executable), ``.js`` on Emscripten node, ``.html`` on Emscripten browser, " +"``.wasm`` on WASI, and an empty string on other platforms (``python`` " "executable)." msgstr "" "在 Windows 和 macOS 上預設的後綴是 ``.exe`` (``python.exe`` 執行檔)、在 " @@ -248,8 +243,8 @@ msgstr "" #: ../../using/configure.rst:143 msgid "" -"The default suffix on WASM platform is one of ``.js``, ``.html`` or ``." -"wasm``." +"The default suffix on WASM platform is one of ``.js``, ``.html`` or " +"``.wasm``." msgstr "在 WASM 平台上預設的後綴是 ``.js``、``.html`` 或 ``.wasm`` 中的一個。" #: ../../using/configure.rst:149 @@ -340,8 +335,8 @@ msgstr "" msgid "" "Some Linux distribution packaging policies recommend against bundling " "dependencies. For example, Fedora installs wheel packages in the ``/usr/" -"share/python-wheels/`` directory and don't install the :mod:`!ensurepip." -"_bundled` package." +"share/python-wheels/`` directory and don't install the :mod:`!" +"ensurepip._bundled` package." msgstr "" #: ../../using/configure.rst:216 @@ -352,7 +347,7 @@ msgstr "" #: ../../using/configure.rst:219 msgid "``check`` (default): :program:`pkg-config` is optional" -msgstr "``check`` (預設)::program:`pkg-config` 是可選的" +msgstr "``check``\\ (預設)::program:`pkg-config` 是可選的" #: ../../using/configure.rst:220 msgid "``yes``: :program:`pkg-config` is mandatory" @@ -379,46 +374,42 @@ msgid "" "cleared." msgstr "" -#: ../../using/configure.rst:236 ../../using/configure.rst:721 +#: ../../using/configure.rst:236 ../../using/configure.rst:725 msgid "Effects:" msgstr "效果:" #: ../../using/configure.rst:238 -#, fuzzy msgid "Add :option:`-X pystats <-X>` command line option." -msgstr "新增 :option:`-X showrefcount <-X>` 命令列選項。" +msgstr "新增 :option:`-X pystats <-X>` 命令列選項。" #: ../../using/configure.rst:239 -#, fuzzy msgid "Add :envvar:`!PYTHONSTATS` environment variable." -msgstr "新增 :envvar:`PYTHONDUMPREFS` 環境變數。" +msgstr "新增 :envvar:`!PYTHONSTATS` 環境變數。" #: ../../using/configure.rst:240 -#, fuzzy msgid "Define the ``Py_STATS`` macro." -msgstr "定義 ``Py_TRACE_REFS`` 巨集。" +msgstr "定義 ``Py_STATS`` 巨集。" #: ../../using/configure.rst:241 -#, fuzzy msgid "Add functions to the :mod:`sys` module:" -msgstr "請見 :mod:`ssl` 模組。" +msgstr "新增函式到 :mod:`sys` 模組。" #: ../../using/configure.rst:243 msgid ":func:`!sys._stats_on`: Turns on statistics gathering." -msgstr "" +msgstr ":func:`!sys._stats_on`:啟用統計資料收集。" #: ../../using/configure.rst:244 msgid ":func:`!sys._stats_off`: Turns off statistics gathering." -msgstr "" +msgstr ":func:`!sys._stats_off`:關閉統計資料收集。" #: ../../using/configure.rst:245 msgid ":func:`!sys._stats_clear`: Clears the statistics." -msgstr "" +msgstr ":func:`!sys._stats_clear`:清除統計資料。" #: ../../using/configure.rst:246 msgid "" ":func:`!sys._stats_dump`: Dump statistics to file, and clears the statistics." -msgstr "" +msgstr ":func:`!sys._stats_dump`:將統計資料轉儲到檔案,並清除統計資料。" #: ../../using/configure.rst:248 msgid "" @@ -426,6 +417,9 @@ msgid "" "tmp/py_stats/`` (Unix) or ``C:\\temp\\py_stats\\`` (Windows). If that " "directory does not exist, results will be printed on stderr." msgstr "" +"統計資料將被轉儲到 ``/tmp/py_stats/`` (Unix) 或 ``C:\\temp\\py_stats\\`` " +"(Windows) 中的任意(可能是唯一的)檔案。如果該目錄不存在,結果將被列印到 " +"stderr。" #: ../../using/configure.rst:252 msgid "Use ``Tools/scripts/summarize_stats.py`` to read the stats." @@ -510,9 +504,8 @@ msgid "type cache;" msgstr "" #: ../../using/configure.rst:280 -#, fuzzy msgid "optimization attempts;" -msgstr "最佳化旗標。" +msgstr "最佳化嘗試;" #: ../../using/configure.rst:281 msgid "optimization traces created/executed;" @@ -540,14 +533,14 @@ msgstr "" #: ../../using/configure.rst:296 msgid "" -"Enables **experimental** support for running Python without the :term:" -"`global interpreter lock` (GIL): free threading build." +"Enables **experimental** support for running Python without " +"the :term:`global interpreter lock` (GIL): free threading build." msgstr "" #: ../../using/configure.rst:299 msgid "" -"Defines the ``Py_GIL_DISABLED`` macro and adds ``\"t\"`` to :data:`sys." -"abiflags`." +"Defines the ``Py_GIL_DISABLED`` macro and adds ``\"t\"`` " +"to :data:`sys.abiflags`." msgstr "" #: ../../using/configure.rst:302 @@ -584,218 +577,221 @@ msgid "" "experimental-jit=yes``." msgstr "" -#: ../../using/configure.rst:321 +#: ../../using/configure.rst:319 +msgid "" +"When building CPython with JIT enabled, ensure that your system has Python " +"3.11 or later installed." +msgstr "" + +#: ../../using/configure.rst:325 msgid "Path to ``pkg-config`` utility." msgstr "" -#: ../../using/configure.rst:326 -#, fuzzy +#: ../../using/configure.rst:330 msgid "``pkg-config`` options." -msgstr "設定選項" +msgstr "``pkg-config`` 選項。" -#: ../../using/configure.rst:330 -#, fuzzy +#: ../../using/configure.rst:334 msgid "C compiler options" -msgstr "C 編譯器指令。" +msgstr "C 編譯器選項。" -#: ../../using/configure.rst:334 ../../using/configure.rst:1241 +#: ../../using/configure.rst:338 ../../using/configure.rst:1245 msgid "C compiler command." msgstr "C 編譯器指令。" -#: ../../using/configure.rst:338 ../../using/configure.rst:1253 +#: ../../using/configure.rst:342 ../../using/configure.rst:1257 msgid "C compiler flags." msgstr "C 編譯器旗標。" -#: ../../using/configure.rst:342 -#, fuzzy +#: ../../using/configure.rst:346 msgid "C preprocessor command." -msgstr "C 編譯器指令。" +msgstr "C 預處理器指令。" -#: ../../using/configure.rst:346 +#: ../../using/configure.rst:350 msgid "C preprocessor flags, e.g. :samp:`-I{include_dir}`." -msgstr "" +msgstr "C 預處理器旗標,例如::samp:`-I{include_dir}`。" -#: ../../using/configure.rst:350 ../../using/configure.rst:792 +#: ../../using/configure.rst:354 ../../using/configure.rst:796 msgid "Linker options" msgstr "" -#: ../../using/configure.rst:354 +#: ../../using/configure.rst:358 msgid "Linker flags, e.g. :samp:`-L{library_directory}`." msgstr "" -#: ../../using/configure.rst:358 +#: ../../using/configure.rst:362 msgid "Libraries to pass to the linker, e.g. :samp:`-l{library}`." msgstr "" -#: ../../using/configure.rst:362 +#: ../../using/configure.rst:366 msgid "Name for machine-dependent library files." msgstr "" -#: ../../using/configure.rst:366 +#: ../../using/configure.rst:370 msgid "Options for third-party dependencies" msgstr "" -#: ../../using/configure.rst:373 +#: ../../using/configure.rst:377 msgid "" "C compiler and linker flags to link Python to ``libbz2``, used by :mod:`bz2` " "module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:379 +#: ../../using/configure.rst:383 msgid "" -"C compiler and linker flags for ``libncurses`` or ``libncursesw``, used by :" -"mod:`curses` module, overriding ``pkg-config``." +"C compiler and linker flags for ``libncurses`` or ``libncursesw``, used " +"by :mod:`curses` module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:385 +#: ../../using/configure.rst:389 msgid "C compiler and linker flags for ``gdbm``." msgstr "" -#: ../../using/configure.rst:390 +#: ../../using/configure.rst:394 msgid "" "C compiler and linker flags for ``libb2`` (:ref:`BLAKE2 <hashlib-blake2>`), " "used by :mod:`hashlib` module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:396 +#: ../../using/configure.rst:400 msgid "" "C compiler and linker flags for ``libedit``, used by :mod:`readline` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:402 +#: ../../using/configure.rst:406 msgid "" "C compiler and linker flags for ``libffi``, used by :mod:`ctypes` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:408 +#: ../../using/configure.rst:412 msgid "" "C compiler and linker flags for ``libmpdec``, used by :mod:`decimal` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:413 +#: ../../using/configure.rst:417 msgid "" "These environment variables have no effect unless :option:`--with-system-" "libmpdec` is specified." msgstr "" -#: ../../using/configure.rst:419 +#: ../../using/configure.rst:423 msgid "" "C compiler and linker flags for ``liblzma``, used by :mod:`lzma` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:425 +#: ../../using/configure.rst:429 msgid "" "C compiler and linker flags for ``libreadline``, used by :mod:`readline` " "module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:431 +#: ../../using/configure.rst:435 msgid "" "C compiler and linker flags for ``libsqlite3``, used by :mod:`sqlite3` " "module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:437 +#: ../../using/configure.rst:441 msgid "" "C compiler and linker flags for ``libuuid``, used by :mod:`uuid` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:443 +#: ../../using/configure.rst:447 msgid "C compiler and linker flags for PANEL, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:445 +#: ../../using/configure.rst:449 msgid "" -"C compiler and linker flags for ``libpanel`` or ``libpanelw``, used by :mod:" -"`curses.panel` module, overriding ``pkg-config``." +"C compiler and linker flags for ``libpanel`` or ``libpanelw``, used " +"by :mod:`curses.panel` module, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:451 +#: ../../using/configure.rst:455 msgid "C compiler and linker flags for TCLTK, overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:456 +#: ../../using/configure.rst:460 msgid "" "C compiler and linker flags for ``libzlib``, used by :mod:`gzip` module, " "overriding ``pkg-config``." msgstr "" -#: ../../using/configure.rst:461 +#: ../../using/configure.rst:465 msgid "WebAssembly Options" msgstr "WebAssembly 選項" -#: ../../using/configure.rst:465 +#: ../../using/configure.rst:469 msgid "Set build flavor for ``wasm32-emscripten``." msgstr "" -#: ../../using/configure.rst:467 +#: ../../using/configure.rst:471 msgid "``browser`` (default): preload minimal stdlib, default MEMFS." msgstr "" -#: ../../using/configure.rst:468 +#: ../../using/configure.rst:472 msgid "``node``: NODERAWFS and pthread support." msgstr "``node``:對 NODERAWFS 和 pthread 支援。" -#: ../../using/configure.rst:474 +#: ../../using/configure.rst:478 msgid "Turn on dynamic linking support for WASM." msgstr "" -#: ../../using/configure.rst:476 +#: ../../using/configure.rst:480 msgid "" "Dynamic linking enables ``dlopen``. File size of the executable increases " "due to limited dead code elimination and additional features." msgstr "" -#: ../../using/configure.rst:483 +#: ../../using/configure.rst:487 msgid "Turn on pthreads support for WASM." msgstr "" -#: ../../using/configure.rst:489 +#: ../../using/configure.rst:493 msgid "Install Options" msgstr "安裝選項" -#: ../../using/configure.rst:493 +#: ../../using/configure.rst:497 msgid "" -"Install architecture-independent files in PREFIX. On Unix, it defaults to :" -"file:`/usr/local`." +"Install architecture-independent files in PREFIX. On Unix, it defaults " +"to :file:`/usr/local`." msgstr "" -#: ../../using/configure.rst:496 +#: ../../using/configure.rst:500 msgid "This value can be retrieved at runtime using :data:`sys.prefix`." msgstr "這個值可以在 runtime 使用 :data:`sys.prefix` 取得。" -#: ../../using/configure.rst:498 +#: ../../using/configure.rst:502 msgid "" "As an example, one can use ``--prefix=\"$HOME/.local/\"`` to install a " "Python in its home directory." msgstr "" -#: ../../using/configure.rst:503 +#: ../../using/configure.rst:507 msgid "" "Install architecture-dependent files in EPREFIX, defaults to :option:`--" "prefix`." msgstr "" -#: ../../using/configure.rst:505 +#: ../../using/configure.rst:509 msgid "This value can be retrieved at runtime using :data:`sys.exec_prefix`." msgstr "這個值可以在 runtime 使用 :data:`sys.exec_prefix` 取得" -#: ../../using/configure.rst:509 +#: ../../using/configure.rst:513 msgid "" -"Don't build nor install test modules, like the :mod:`test` package or the :" -"mod:`!_testcapi` extension module (built and installed by default)." +"Don't build nor install test modules, like the :mod:`test` package or " +"the :mod:`!_testcapi` extension module (built and installed by default)." msgstr "" -#: ../../using/configure.rst:516 +#: ../../using/configure.rst:520 msgid "Select the :mod:`ensurepip` command run on Python installation:" msgstr "選擇在 Python 安裝時執行的 :mod:`ensurepip` 命令:" -#: ../../using/configure.rst:518 +#: ../../using/configure.rst:522 msgid "" "``upgrade`` (default): run ``python -m ensurepip --altinstall --upgrade`` " "command." @@ -803,45 +799,45 @@ msgstr "" "``upgrade`` (預設):執行 ``python -m ensurepip --altinstall --upgrade`` 命" "令。" -#: ../../using/configure.rst:520 +#: ../../using/configure.rst:524 msgid "``install``: run ``python -m ensurepip --altinstall`` command;" msgstr "``install``:執行 ``python -m ensurepip --altinstall`` 命令;" -#: ../../using/configure.rst:521 +#: ../../using/configure.rst:525 msgid "``no``: don't run ensurepip;" msgstr "``no``:不要執行 ensurepip;" -#: ../../using/configure.rst:527 +#: ../../using/configure.rst:531 msgid "Performance options" msgstr "" -#: ../../using/configure.rst:529 +#: ../../using/configure.rst:533 msgid "" "Configuring Python using ``--enable-optimizations --with-lto`` (PGO + LTO) " "is recommended for best performance. The experimental ``--enable-bolt`` flag " "can also be used to improve performance." msgstr "" -#: ../../using/configure.rst:535 +#: ../../using/configure.rst:539 msgid "" "Enable Profile Guided Optimization (PGO) using :envvar:`PROFILE_TASK` " "(disabled by default)." msgstr "" -#: ../../using/configure.rst:538 +#: ../../using/configure.rst:542 msgid "" "The C compiler Clang requires ``llvm-profdata`` program for PGO. On macOS, " "GCC also requires it: GCC is just an alias to Clang on macOS." msgstr "" -#: ../../using/configure.rst:541 +#: ../../using/configure.rst:545 msgid "" "Disable also semantic interposition in libpython if ``--enable-shared`` and " "GCC is used: add ``-fno-semantic-interposition`` to the compiler and linker " "flags." msgstr "" -#: ../../using/configure.rst:547 +#: ../../using/configure.rst:551 msgid "" "During the build, you may encounter compiler warnings about profile data not " "being available for some source files. These warnings are harmless, as only " @@ -850,58 +846,58 @@ msgid "" "profile-instr-unprofiled`` to :envvar:`CFLAGS`." msgstr "" -#: ../../using/configure.rst:556 +#: ../../using/configure.rst:560 msgid "Use ``-fno-semantic-interposition`` on GCC." msgstr "在 GCC 上使用 ``-fno-semantic-interposition``。" -#: ../../using/configure.rst:561 +#: ../../using/configure.rst:565 msgid "" "Environment variable used in the Makefile: Python command line arguments for " "the PGO generation task." msgstr "" -#: ../../using/configure.rst:564 +#: ../../using/configure.rst:568 msgid "Default: ``-m test --pgo --timeout=$(TESTTIMEOUT)``." msgstr "預設值:``-m test --pgo --timeout=$(TESTTIMEOUT)``。" -#: ../../using/configure.rst:568 +#: ../../using/configure.rst:572 msgid "Task failure is no longer ignored silently." msgstr "" -#: ../../using/configure.rst:573 +#: ../../using/configure.rst:577 msgid "Enable Link Time Optimization (LTO) in any build (disabled by default)." msgstr "" -#: ../../using/configure.rst:575 +#: ../../using/configure.rst:579 msgid "" "The C compiler Clang requires ``llvm-ar`` for LTO (``ar`` on macOS), as well " "as an LTO-aware linker (``ld.gold`` or ``lld``)." msgstr "" -#: ../../using/configure.rst:580 +#: ../../using/configure.rst:584 msgid "To use ThinLTO feature, use ``--with-lto=thin`` on Clang." msgstr "" -#: ../../using/configure.rst:583 +#: ../../using/configure.rst:587 msgid "" "Use ThinLTO as the default optimization policy on Clang if the compiler " "accepts the flag." msgstr "" -#: ../../using/configure.rst:588 +#: ../../using/configure.rst:592 msgid "" "Enable usage of the `BOLT post-link binary optimizer <https://github.com/" "llvm/llvm-project/tree/main/bolt>`_ (disabled by default)." msgstr "" -#: ../../using/configure.rst:592 +#: ../../using/configure.rst:596 msgid "" "BOLT is part of the LLVM project but is not always included in their binary " "distributions. This flag requires that ``llvm-bolt`` and ``merge-fdata`` are " "available." msgstr "" -#: ../../using/configure.rst:596 +#: ../../using/configure.rst:600 msgid "" "BOLT is still a fairly new project so this flag should be considered " "experimental for now. Because this tool operates on machine code its success " @@ -912,124 +908,124 @@ msgid "" "encouraged." msgstr "" -#: ../../using/configure.rst:604 +#: ../../using/configure.rst:608 msgid "" -"The :envvar:`!BOLT_INSTRUMENT_FLAGS` and :envvar:`!BOLT_APPLY_FLAGS` :" -"program:`configure` variables can be defined to override the default set of " -"arguments for :program:`llvm-bolt` to instrument and apply BOLT data to " -"binaries, respectively." +"The :envvar:`!BOLT_INSTRUMENT_FLAGS` and :envvar:`!" +"BOLT_APPLY_FLAGS` :program:`configure` variables can be defined to override " +"the default set of arguments for :program:`llvm-bolt` to instrument and " +"apply BOLT data to binaries, respectively." msgstr "" -#: ../../using/configure.rst:613 +#: ../../using/configure.rst:617 msgid "" "Arguments to ``llvm-bolt`` when creating a `BOLT optimized binary <https://" "github.com/facebookarchive/BOLT>`_." msgstr "" -#: ../../using/configure.rst:620 +#: ../../using/configure.rst:624 msgid "Arguments to ``llvm-bolt`` when instrumenting binaries." msgstr "" -#: ../../using/configure.rst:626 +#: ../../using/configure.rst:630 msgid "" "Enable computed gotos in evaluation loop (enabled by default on supported " "compilers)." msgstr "" -#: ../../using/configure.rst:631 +#: ../../using/configure.rst:635 msgid "" "Disable the fast :ref:`mimalloc <mimalloc>` allocator (enabled by default)." msgstr "" -#: ../../using/configure.rst:634 ../../using/configure.rst:641 +#: ../../using/configure.rst:638 ../../using/configure.rst:645 msgid "See also :envvar:`PYTHONMALLOC` environment variable." msgstr "另請參閱 :envvar:`PYTHONMALLOC` 環境變數。" -#: ../../using/configure.rst:638 +#: ../../using/configure.rst:642 msgid "" "Disable the specialized Python memory allocator :ref:`pymalloc <pymalloc>` " "(enabled by default)." msgstr "" -#: ../../using/configure.rst:645 +#: ../../using/configure.rst:649 msgid "" "Disable static documentation strings to reduce the memory footprint (enabled " "by default). Documentation strings defined in Python are not affected." msgstr "" -#: ../../using/configure.rst:648 +#: ../../using/configure.rst:652 msgid "Don't define the ``WITH_DOC_STRINGS`` macro." msgstr "不要定義 ``WITH_DOC_STRINGS`` 巨集。" -#: ../../using/configure.rst:650 +#: ../../using/configure.rst:654 msgid "See the ``PyDoc_STRVAR()`` macro." msgstr "請見 ``PyDoc_STRVAR()`` 巨集。" -#: ../../using/configure.rst:654 +#: ../../using/configure.rst:658 msgid "Enable C-level code profiling with ``gprof`` (disabled by default)." msgstr "" -#: ../../using/configure.rst:658 +#: ../../using/configure.rst:662 msgid "" "Add ``-fstrict-overflow`` to the C compiler flags (by default we add ``-fno-" "strict-overflow`` instead)." msgstr "" -#: ../../using/configure.rst:665 +#: ../../using/configure.rst:669 msgid "Python Debug Build" msgstr "" -#: ../../using/configure.rst:667 +#: ../../using/configure.rst:671 msgid "" "A debug build is Python built with the :option:`--with-pydebug` configure " "option." msgstr "" -#: ../../using/configure.rst:670 +#: ../../using/configure.rst:674 msgid "Effects of a debug build:" msgstr "" -#: ../../using/configure.rst:672 +#: ../../using/configure.rst:676 msgid "" "Display all warnings by default: the list of default warning filters is " "empty in the :mod:`warnings` module." msgstr "" -#: ../../using/configure.rst:674 +#: ../../using/configure.rst:678 msgid "Add ``d`` to :data:`sys.abiflags`." msgstr "新增 ``d`` 到 :data:`sys.abiflags`。" -#: ../../using/configure.rst:675 +#: ../../using/configure.rst:679 msgid "Add :func:`!sys.gettotalrefcount` function." msgstr "新增 :func:`!sys.gettotalrefcount` 函式。" -#: ../../using/configure.rst:676 +#: ../../using/configure.rst:680 msgid "Add :option:`-X showrefcount <-X>` command line option." msgstr "新增 :option:`-X showrefcount <-X>` 命令列選項。" -#: ../../using/configure.rst:677 +#: ../../using/configure.rst:681 msgid "" "Add :option:`-d` command line option and :envvar:`PYTHONDEBUG` environment " "variable to debug the parser." msgstr "" -#: ../../using/configure.rst:679 +#: ../../using/configure.rst:683 msgid "" "Add support for the ``__lltrace__`` variable: enable low-level tracing in " "the bytecode evaluation loop if the variable is defined." msgstr "" -#: ../../using/configure.rst:681 +#: ../../using/configure.rst:685 msgid "" "Install :ref:`debug hooks on memory allocators <default-memory-allocators>` " "to detect buffer overflow and other memory errors." msgstr "" -#: ../../using/configure.rst:683 +#: ../../using/configure.rst:687 msgid "Define ``Py_DEBUG`` and ``Py_REF_DEBUG`` macros." msgstr "定義 ``Py_DEBUG`` 和 ``Py_REF_DEBUG`` 巨集。" -#: ../../using/configure.rst:684 +#: ../../using/configure.rst:688 msgid "" "Add runtime checks: code surrounded by ``#ifdef Py_DEBUG`` and ``#endif``. " "Enable ``assert(...)`` and ``_PyObject_ASSERT(...)`` assertions: don't set " @@ -1037,388 +1033,385 @@ msgid "" "option). Main runtime checks:" msgstr "" -#: ../../using/configure.rst:689 +#: ../../using/configure.rst:693 msgid "Add sanity checks on the function arguments." msgstr "" -#: ../../using/configure.rst:690 +#: ../../using/configure.rst:694 msgid "" "Unicode and int objects are created with their memory filled with a pattern " "to detect usage of uninitialized objects." msgstr "" -#: ../../using/configure.rst:692 +#: ../../using/configure.rst:696 msgid "" "Ensure that functions which can clear or replace the current exception are " "not called with an exception raised." msgstr "" -#: ../../using/configure.rst:694 +#: ../../using/configure.rst:698 msgid "Check that deallocator functions don't change the current exception." msgstr "" -#: ../../using/configure.rst:695 +#: ../../using/configure.rst:699 msgid "" "The garbage collector (:func:`gc.collect` function) runs some basic checks " "on objects consistency." msgstr "" -#: ../../using/configure.rst:697 +#: ../../using/configure.rst:701 msgid "" "The :c:macro:`!Py_SAFE_DOWNCAST()` macro checks for integer underflow and " "overflow when downcasting from wide types to narrow types." msgstr "" -#: ../../using/configure.rst:700 +#: ../../using/configure.rst:704 msgid "" "See also the :ref:`Python Development Mode <devmode>` and the :option:`--" "with-trace-refs` configure option." msgstr "" -#: ../../using/configure.rst:703 +#: ../../using/configure.rst:707 msgid "" "Release builds and debug builds are now ABI compatible: defining the " -"``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` macro (see the :" -"option:`--with-trace-refs` option)." +"``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` macro (see " +"the :option:`--with-trace-refs` option)." msgstr "" -#: ../../using/configure.rst:710 +#: ../../using/configure.rst:714 msgid "Debug options" msgstr "" -#: ../../using/configure.rst:714 +#: ../../using/configure.rst:718 msgid "" ":ref:`Build Python in debug mode <debug-build>`: define the ``Py_DEBUG`` " "macro (disabled by default)." msgstr "" -#: ../../using/configure.rst:719 +#: ../../using/configure.rst:723 msgid "Enable tracing references for debugging purpose (disabled by default)." msgstr "" -#: ../../using/configure.rst:723 +#: ../../using/configure.rst:727 msgid "Define the ``Py_TRACE_REFS`` macro." msgstr "定義 ``Py_TRACE_REFS`` 巨集。" -#: ../../using/configure.rst:724 -#, fuzzy +#: ../../using/configure.rst:728 msgid "Add :func:`sys.getobjects` function." -msgstr "新增 :func:`!sys.getobjects` 函式。" +msgstr "新增 :func:`sys.getobjects` 函式。" -#: ../../using/configure.rst:725 +#: ../../using/configure.rst:729 msgid "Add :envvar:`PYTHONDUMPREFS` environment variable." msgstr "新增 :envvar:`PYTHONDUMPREFS` 環境變數。" -#: ../../using/configure.rst:727 +#: ../../using/configure.rst:731 msgid "" "The :envvar:`PYTHONDUMPREFS` environment variable can be used to dump " "objects and reference counts still alive at Python exit." msgstr "" -#: ../../using/configure.rst:730 +#: ../../using/configure.rst:734 msgid ":ref:`Statically allocated objects <static-types>` are not traced." msgstr "" -#: ../../using/configure.rst:734 +#: ../../using/configure.rst:738 msgid "" "This build is now ABI compatible with release build and :ref:`debug build " "<debug-build>`." msgstr "" -#: ../../using/configure.rst:740 +#: ../../using/configure.rst:744 msgid "" "Build with C assertions enabled (default is no): ``assert(...);`` and " "``_PyObject_ASSERT(...);``." msgstr "" -#: ../../using/configure.rst:743 +#: ../../using/configure.rst:747 msgid "" "If set, the ``NDEBUG`` macro is not defined in the :envvar:`OPT` compiler " "variable." msgstr "" -#: ../../using/configure.rst:746 +#: ../../using/configure.rst:750 msgid "" "See also the :option:`--with-pydebug` option (:ref:`debug build <debug-" "build>`) which also enables assertions." msgstr "" -#: ../../using/configure.rst:753 +#: ../../using/configure.rst:757 msgid "Enable Valgrind support (default is no)." msgstr "啟用 Valgrind 支援(預設不啟用)。" -#: ../../using/configure.rst:757 +#: ../../using/configure.rst:761 msgid "Enable DTrace support (default is no)." msgstr "啟用 DTrace 支援(預設不啟用)。" -#: ../../using/configure.rst:759 +#: ../../using/configure.rst:763 msgid "" "See :ref:`Instrumenting CPython with DTrace and SystemTap <instrumentation>`." msgstr "" -#: ../../using/configure.rst:766 +#: ../../using/configure.rst:770 msgid "" "Enable AddressSanitizer memory error detector, ``asan`` (default is no)." msgstr "" -#: ../../using/configure.rst:772 +#: ../../using/configure.rst:776 msgid "" "Enable MemorySanitizer allocation error detector, ``msan`` (default is no)." msgstr "" -#: ../../using/configure.rst:778 +#: ../../using/configure.rst:782 msgid "" "Enable UndefinedBehaviorSanitizer undefined behaviour detector, ``ubsan`` " "(default is no)." msgstr "" -#: ../../using/configure.rst:785 -#, fuzzy +#: ../../using/configure.rst:789 msgid "Enable ThreadSanitizer data race detector, ``tsan`` (default is no)." -msgstr "啟用 DTrace 支援(預設不啟用)。" +msgstr "啟用 ThreadSanitizer 資料競爭偵測器 ``tsan``\\ (預設不啟用)。" -#: ../../using/configure.rst:796 +#: ../../using/configure.rst:800 msgid "Enable building a shared Python library: ``libpython`` (default is no)." msgstr "" -#: ../../using/configure.rst:800 +#: ../../using/configure.rst:804 msgid "" "Do not build ``libpythonMAJOR.MINOR.a`` and do not install ``python.o`` " "(built and enabled by default)." msgstr "" -#: ../../using/configure.rst:807 +#: ../../using/configure.rst:811 msgid "Libraries options" msgstr "函式庫選項" -#: ../../using/configure.rst:811 +#: ../../using/configure.rst:815 msgid "Link against additional libraries (default is no)." msgstr "" -#: ../../using/configure.rst:815 +#: ../../using/configure.rst:819 msgid "" "Build the :mod:`!pyexpat` module using an installed ``expat`` library " "(default is no)." msgstr "" -#: ../../using/configure.rst:820 +#: ../../using/configure.rst:824 msgid "" "Build the ``_decimal`` extension module using an installed ``mpdecimal`` " "library, see the :mod:`decimal` module (default is yes)." msgstr "" -#: ../../using/configure.rst:825 +#: ../../using/configure.rst:829 msgid "Default to using the installed ``mpdecimal`` library." msgstr "" -#: ../../using/configure.rst:828 +#: ../../using/configure.rst:832 msgid "" "A copy of the ``mpdecimal`` library sources will no longer be distributed " "with Python 3.15." msgstr "" -#: ../../using/configure.rst:832 +#: ../../using/configure.rst:836 msgid ":option:`LIBMPDEC_CFLAGS` and :option:`LIBMPDEC_LIBS`." -msgstr "" +msgstr ":option:`LIBMPDEC_CFLAGS` 和 :option:`LIBMPDEC_LIBS`。" -#: ../../using/configure.rst:836 +#: ../../using/configure.rst:840 msgid "Designate a backend library for the :mod:`readline` module." msgstr "" -#: ../../using/configure.rst:838 +#: ../../using/configure.rst:842 msgid "readline: Use readline as the backend." msgstr "" -#: ../../using/configure.rst:839 +#: ../../using/configure.rst:843 msgid "editline: Use editline as the backend." msgstr "" -#: ../../using/configure.rst:845 +#: ../../using/configure.rst:849 msgid "Don't build the :mod:`readline` module (built by default)." -msgstr "" +msgstr "不要建置 :mod:`readline` 模組(預設會建置)。" -#: ../../using/configure.rst:847 +#: ../../using/configure.rst:851 msgid "Don't define the ``HAVE_LIBREADLINE`` macro." msgstr "不要定義 ``HAVE_LIBREADLINE`` 巨集。" -#: ../../using/configure.rst:853 +#: ../../using/configure.rst:857 msgid "" "Override ``libm`` math library to *STRING* (default is system-dependent)." msgstr "" -#: ../../using/configure.rst:857 +#: ../../using/configure.rst:861 msgid "Override ``libc`` C library to *STRING* (default is system-dependent)." msgstr "" -#: ../../using/configure.rst:861 +#: ../../using/configure.rst:865 msgid "Root of the OpenSSL directory." -msgstr "" +msgstr "OpenSSL 目錄的根目錄。" -#: ../../using/configure.rst:867 +#: ../../using/configure.rst:871 msgid "Set runtime library directory (rpath) for OpenSSL libraries:" msgstr "" -#: ../../using/configure.rst:869 +#: ../../using/configure.rst:873 msgid "``no`` (default): don't set rpath;" msgstr "" -#: ../../using/configure.rst:870 +#: ../../using/configure.rst:874 msgid "" "``auto``: auto-detect rpath from :option:`--with-openssl` and ``pkg-config``;" msgstr "" -#: ../../using/configure.rst:872 +#: ../../using/configure.rst:876 msgid "*DIR*: set an explicit rpath." msgstr "" -#: ../../using/configure.rst:878 +#: ../../using/configure.rst:882 msgid "Security Options" -msgstr "" +msgstr "安全性選項" -#: ../../using/configure.rst:882 +#: ../../using/configure.rst:886 msgid "Select hash algorithm for use in ``Python/pyhash.c``:" msgstr "" -#: ../../using/configure.rst:884 +#: ../../using/configure.rst:888 msgid "``siphash13`` (default);" -msgstr "" +msgstr "``siphash13``\\ (預設);" -#: ../../using/configure.rst:885 +#: ../../using/configure.rst:889 msgid "``siphash24``;" msgstr "``siphash24``;" -#: ../../using/configure.rst:886 +#: ../../using/configure.rst:890 msgid "``fnv``." msgstr "``fnv``。" -#: ../../using/configure.rst:890 +#: ../../using/configure.rst:894 msgid "``siphash13`` is added and it is the new default." msgstr "" -#: ../../using/configure.rst:895 +#: ../../using/configure.rst:899 msgid "Built-in hash modules:" msgstr "內建雜湊模組:" -#: ../../using/configure.rst:897 +#: ../../using/configure.rst:901 msgid "``md5``;" msgstr "``md5``;" -#: ../../using/configure.rst:898 +#: ../../using/configure.rst:902 msgid "``sha1``;" msgstr "``sha1``;" -#: ../../using/configure.rst:899 +#: ../../using/configure.rst:903 msgid "``sha256``;" msgstr "``sha256``;" -#: ../../using/configure.rst:900 +#: ../../using/configure.rst:904 msgid "``sha512``;" msgstr "``sha512``;" -#: ../../using/configure.rst:901 +#: ../../using/configure.rst:905 msgid "``sha3`` (with shake);" msgstr "" -#: ../../using/configure.rst:902 +#: ../../using/configure.rst:906 msgid "``blake2``." msgstr "``blake2``。" -#: ../../using/configure.rst:908 +#: ../../using/configure.rst:912 msgid "Override the OpenSSL default cipher suites string:" msgstr "" -#: ../../using/configure.rst:910 +#: ../../using/configure.rst:914 msgid "``python`` (default): use Python's preferred selection;" msgstr "" -#: ../../using/configure.rst:911 +#: ../../using/configure.rst:915 msgid "``openssl``: leave OpenSSL's defaults untouched;" msgstr "" -#: ../../using/configure.rst:912 +#: ../../using/configure.rst:916 msgid "*STRING*: use a custom string" msgstr "" -#: ../../using/configure.rst:914 +#: ../../using/configure.rst:918 msgid "See the :mod:`ssl` module." msgstr "請見 :mod:`ssl` 模組。" -#: ../../using/configure.rst:920 +#: ../../using/configure.rst:924 msgid "" "The settings ``python`` and *STRING* also set TLS 1.2 as minimum protocol " "version." msgstr "" -#: ../../using/configure.rst:924 +#: ../../using/configure.rst:928 msgid "macOS Options" msgstr "macOS 選項" -#: ../../using/configure.rst:926 -#, fuzzy +#: ../../using/configure.rst:930 msgid "See :source:`Mac/README.rst`." -msgstr "參閱 ``Mac/README.rst``。" +msgstr "參閱 :source:`Mac/README.rst`。" -#: ../../using/configure.rst:931 +#: ../../using/configure.rst:935 msgid "" "Create a universal binary build. *SDKDIR* specifies which macOS SDK should " "be used to perform the build (default is no)." msgstr "" -#: ../../using/configure.rst:937 +#: ../../using/configure.rst:941 msgid "" "Create a Python.framework rather than a traditional Unix install. Optional " "*INSTALLDIR* specifies the installation path (default is no)." msgstr "" -#: ../../using/configure.rst:942 +#: ../../using/configure.rst:946 msgid "" "Specify the kind of universal binary that should be created. This option is " "only valid when :option:`--enable-universalsdk` is set." msgstr "" -#: ../../using/configure.rst:945 +#: ../../using/configure.rst:949 msgid "Options:" msgstr "選項:" -#: ../../using/configure.rst:947 +#: ../../using/configure.rst:951 msgid "``universal2``;" msgstr "``universal2``;" -#: ../../using/configure.rst:948 +#: ../../using/configure.rst:952 msgid "``32-bit``;" msgstr "``32-bit``;" -#: ../../using/configure.rst:949 +#: ../../using/configure.rst:953 msgid "``64-bit``;" msgstr "``64-bit``;" -#: ../../using/configure.rst:950 +#: ../../using/configure.rst:954 msgid "``3-way``;" msgstr "``3-way``;" -#: ../../using/configure.rst:951 +#: ../../using/configure.rst:955 msgid "``intel``;" msgstr "``intel``;" -#: ../../using/configure.rst:952 +#: ../../using/configure.rst:956 msgid "``intel-32``;" msgstr "``intel-32``;" -#: ../../using/configure.rst:953 +#: ../../using/configure.rst:957 msgid "``intel-64``;" msgstr "``intel-64``;" -#: ../../using/configure.rst:954 +#: ../../using/configure.rst:958 msgid "``all``." msgstr "``all``。" -#: ../../using/configure.rst:958 +#: ../../using/configure.rst:962 msgid "" -"Specify the name for the python framework on macOS only valid when :option:" -"`--enable-framework` is set (default: ``Python``)." +"Specify the name for the python framework on macOS only valid " +"when :option:`--enable-framework` is set (default: ``Python``)." msgstr "" -#: ../../using/configure.rst:964 +#: ../../using/configure.rst:968 msgid "" "The Python standard library contains strings that are known to trigger " "automated inspection tool errors when submitted for distribution by the " @@ -1427,31 +1420,29 @@ msgid "" "can also be specified. This option is disabled by default." msgstr "" -#: ../../using/configure.rst:973 -#, fuzzy +#: ../../using/configure.rst:977 msgid "iOS Options" -msgstr "macOS 選項" +msgstr "iOS 選項" -#: ../../using/configure.rst:975 -#, fuzzy +#: ../../using/configure.rst:979 msgid "See :source:`iOS/README.rst`." -msgstr "參閱 ``Mac/README.rst``。" +msgstr "參閱 :source:`iOS/README.rst`。" -#: ../../using/configure.rst:979 +#: ../../using/configure.rst:983 msgid "" "Create a Python.framework. Unlike macOS, the *INSTALLDIR* argument " "specifying the installation path is mandatory." msgstr "" -#: ../../using/configure.rst:984 +#: ../../using/configure.rst:988 msgid "Specify the name for the framework (default: ``Python``)." -msgstr "" +msgstr "指定框架的名稱(預設值:``Python``)。" -#: ../../using/configure.rst:988 +#: ../../using/configure.rst:992 msgid "Cross Compiling Options" msgstr "" -#: ../../using/configure.rst:990 +#: ../../using/configure.rst:994 msgid "" "Cross compiling, also known as cross building, can be used to build Python " "for another CPU architecture or platform. Cross compiling requires a Python " @@ -1459,28 +1450,28 @@ msgid "" "match the version of the cross compiled host Python." msgstr "" -#: ../../using/configure.rst:997 +#: ../../using/configure.rst:1001 msgid "" "configure for building on BUILD, usually guessed by :program:`config.guess`." msgstr "" -#: ../../using/configure.rst:1001 +#: ../../using/configure.rst:1005 msgid "cross-compile to build programs to run on HOST (target platform)" msgstr "" -#: ../../using/configure.rst:1005 +#: ../../using/configure.rst:1009 msgid "path to build ``python`` binary for cross compiling" msgstr "" -#: ../../using/configure.rst:1011 +#: ../../using/configure.rst:1015 msgid "An environment variable that points to a file with configure overrides." msgstr "" -#: ../../using/configure.rst:1013 +#: ../../using/configure.rst:1017 msgid "Example *config.site* file:" msgstr "" -#: ../../using/configure.rst:1015 +#: ../../using/configure.rst:1019 msgid "" "# config.site-aarch64\n" "ac_cv_buggy_getaddrinfo=no\n" @@ -1492,15 +1483,15 @@ msgstr "" "ac_cv_file__dev_ptmx=yes\n" "ac_cv_file__dev_ptc=no" -#: ../../using/configure.rst:1024 +#: ../../using/configure.rst:1028 msgid "Program to run CPython for the host platform for cross-compilation." msgstr "" -#: ../../using/configure.rst:1029 +#: ../../using/configure.rst:1033 msgid "Cross compiling example::" msgstr "" -#: ../../using/configure.rst:1031 +#: ../../using/configure.rst:1035 msgid "" "CONFIG_SITE=config.site-aarch64 ../configure \\\n" " --build=x86_64-pc-linux-gnu \\\n" @@ -1512,64 +1503,65 @@ msgstr "" " --host=aarch64-unknown-linux-gnu \\\n" " --with-build-python=../x86_64/python" -#: ../../using/configure.rst:1038 +#: ../../using/configure.rst:1042 msgid "Python Build System" -msgstr "" +msgstr "Python 建置系統" -#: ../../using/configure.rst:1041 +#: ../../using/configure.rst:1045 msgid "Main files of the build system" -msgstr "" +msgstr "建置系統的主要檔案" -#: ../../using/configure.rst:1043 +#: ../../using/configure.rst:1047 msgid ":file:`configure.ac` => :file:`configure`;" -msgstr ":file:`configure.ac` => :file:`configure`\\ ;" +msgstr ":file:`configure.ac` => :file:`configure`;" -#: ../../using/configure.rst:1044 +#: ../../using/configure.rst:1048 msgid "" ":file:`Makefile.pre.in` => :file:`Makefile` (created by :file:`configure`);" msgstr "" +":file:`Makefile.pre.in` => :file:`Makefile`\\ (由 :file:`configure` 建立);" -#: ../../using/configure.rst:1045 +#: ../../using/configure.rst:1049 msgid ":file:`pyconfig.h` (created by :file:`configure`);" -msgstr ":file:`pyconfig.h` (created by :file:`configure`)\\ ;" +msgstr ":file:`pyconfig.h`\\ (由 :file:`configure` 建立);" -#: ../../using/configure.rst:1046 +#: ../../using/configure.rst:1050 msgid "" -":file:`Modules/Setup`: C extensions built by the Makefile using :file:" -"`Module/makesetup` shell script;" +":file:`Modules/Setup`: C extensions built by the Makefile " +"using :file:`Module/makesetup` shell script;" msgstr "" -#: ../../using/configure.rst:1050 +#: ../../using/configure.rst:1054 msgid "Main build steps" msgstr "主要建置步驟" -#: ../../using/configure.rst:1052 +#: ../../using/configure.rst:1056 msgid "C files (``.c``) are built as object files (``.o``)." msgstr "" -#: ../../using/configure.rst:1053 +#: ../../using/configure.rst:1057 msgid "A static ``libpython`` library (``.a``) is created from objects files." msgstr "" -#: ../../using/configure.rst:1054 +#: ../../using/configure.rst:1058 msgid "" "``python.o`` and the static ``libpython`` library are linked into the final " "``python`` program." msgstr "" -#: ../../using/configure.rst:1056 +#: ../../using/configure.rst:1060 msgid "C extensions are built by the Makefile (see :file:`Modules/Setup`)." msgstr "" -#: ../../using/configure.rst:1059 +#: ../../using/configure.rst:1063 msgid "Main Makefile targets" msgstr "主要 Makefile 目標" -#: ../../using/configure.rst:1062 +#: ../../using/configure.rst:1066 msgid "make" -msgstr "" +msgstr "make" -#: ../../using/configure.rst:1064 +#: ../../using/configure.rst:1068 msgid "" "For the most part, when rebuilding after editing some code or refreshing " "your checkout from upstream, all you need to do is execute ``make``, which " @@ -1580,20 +1572,20 @@ msgid "" "all`` will build. The three choices are:" msgstr "" -#: ../../using/configure.rst:1073 +#: ../../using/configure.rst:1077 msgid "``profile-opt`` (configured with ``--enable-optimizations``)" msgstr "" -#: ../../using/configure.rst:1074 +#: ../../using/configure.rst:1078 msgid "``build_wasm`` (configured with ``--with-emscripten-target``)" msgstr "" -#: ../../using/configure.rst:1075 +#: ../../using/configure.rst:1079 msgid "" "``build_all`` (configured without explicitly using either of the others)" msgstr "" -#: ../../using/configure.rst:1077 +#: ../../using/configure.rst:1081 msgid "" "Depending on the most recent source file changes, Make will rebuild any " "targets (object files and executables) deemed out-of-date, including running " @@ -1606,11 +1598,11 @@ msgid "" "problems, at the expense of longer build times." msgstr "" -#: ../../using/configure.rst:1090 +#: ../../using/configure.rst:1094 msgid "make platform" -msgstr "" +msgstr "make platform" -#: ../../using/configure.rst:1092 +#: ../../using/configure.rst:1096 msgid "" "Build the ``python`` program, but don't build the standard library extension " "modules. This generates a file named ``platform`` which contains a single " @@ -1618,82 +1610,81 @@ msgid "" "arm64-3.12`` or ``linux-x86_64-3.13``." msgstr "" -#: ../../using/configure.rst:1099 +#: ../../using/configure.rst:1103 msgid "make profile-opt" -msgstr "" +msgstr "make profile-opt" -#: ../../using/configure.rst:1101 +#: ../../using/configure.rst:1105 msgid "" "Build Python using profile-guided optimization (PGO). You can use the " "configure :option:`--enable-optimizations` option to make this the default " "target of the ``make`` command (``make all`` or just ``make``)." msgstr "" -#: ../../using/configure.rst:1109 +#: ../../using/configure.rst:1113 msgid "make clean" -msgstr "" +msgstr "make clean" -#: ../../using/configure.rst:1111 +#: ../../using/configure.rst:1115 msgid "Remove built files." -msgstr "" +msgstr "移除建置的檔案。" -#: ../../using/configure.rst:1115 +#: ../../using/configure.rst:1119 msgid "make distclean" -msgstr "" +msgstr "make distclean" -#: ../../using/configure.rst:1117 +#: ../../using/configure.rst:1121 msgid "" "In addition to the work done by ``make clean``, remove files created by the " "configure script. ``configure`` will have to be run before building again. " "[#]_" msgstr "" -#: ../../using/configure.rst:1123 +#: ../../using/configure.rst:1127 msgid "make install" -msgstr "" +msgstr "make install" -#: ../../using/configure.rst:1125 +#: ../../using/configure.rst:1129 msgid "Build the ``all`` target and install Python." -msgstr "" +msgstr "建置 ``all`` 目標並安裝 Python。" -#: ../../using/configure.rst:1129 +#: ../../using/configure.rst:1133 msgid "make test" -msgstr "" +msgstr "make test" -#: ../../using/configure.rst:1131 +#: ../../using/configure.rst:1135 msgid "" "Build the ``all`` target and run the Python test suite with the ``--fast-" "ci`` option. Variables:" msgstr "" -#: ../../using/configure.rst:1134 +#: ../../using/configure.rst:1138 msgid "``TESTOPTS``: additional regrtest command-line options." msgstr "" -#: ../../using/configure.rst:1135 +#: ../../using/configure.rst:1139 msgid "``TESTPYTHONOPTS``: additional Python command-line options." msgstr "" -#: ../../using/configure.rst:1136 +#: ../../using/configure.rst:1140 msgid "``TESTTIMEOUT``: timeout in seconds (default: 10 minutes)." msgstr "" -#: ../../using/configure.rst:1140 -#, fuzzy +#: ../../using/configure.rst:1144 msgid "make buildbottest" -msgstr "主要建置步驟" +msgstr "make buildbottest" -#: ../../using/configure.rst:1142 +#: ../../using/configure.rst:1146 msgid "" "This is similar to ``make test``, but uses the ``--slow-ci`` option and " "default timeout of 20 minutes, instead of ``--fast-ci`` option." msgstr "" -#: ../../using/configure.rst:1147 +#: ../../using/configure.rst:1151 msgid "make regen-all" -msgstr "" +msgstr "make regen-all" -#: ../../using/configure.rst:1149 +#: ../../using/configure.rst:1153 msgid "" "Regenerate (almost) all generated files. These include (but are not limited " "to) bytecode cases, and parser generator file. ``make regen-stdlib-module-" @@ -1701,18 +1692,18 @@ msgid "" "files <#generated-files>`_." msgstr "" -#: ../../using/configure.rst:1156 +#: ../../using/configure.rst:1160 msgid "C extensions" msgstr "C 擴充模組" -#: ../../using/configure.rst:1158 +#: ../../using/configure.rst:1162 msgid "" "Some C extensions are built as built-in modules, like the ``sys`` module. " "They are built with the ``Py_BUILD_CORE_BUILTIN`` macro defined. Built-in " "modules have no ``__file__`` attribute:" msgstr "" -#: ../../using/configure.rst:1162 +#: ../../using/configure.rst:1166 msgid "" ">>> import sys\n" ">>> sys\n" @@ -1722,31 +1713,38 @@ msgid "" " File \"<stdin>\", line 1, in <module>\n" "AttributeError: module 'sys' has no attribute '__file__'" msgstr "" +">>> import sys\n" +">>> sys\n" +"<module 'sys' (built-in)>\n" +">>> sys.__file__\n" +"Traceback (most recent call last):\n" +" File \"<stdin>\", line 1, in <module>\n" +"AttributeError: module 'sys' has no attribute '__file__'" -#: ../../using/configure.rst:1172 +#: ../../using/configure.rst:1176 msgid "" "Other C extensions are built as dynamic libraries, like the ``_asyncio`` " "module. They are built with the ``Py_BUILD_CORE_MODULE`` macro defined. " "Example on Linux x86-64:" msgstr "" -#: ../../using/configure.rst:1176 +#: ../../using/configure.rst:1180 msgid "" ">>> import _asyncio\n" ">>> _asyncio\n" -"<module '_asyncio' from '/usr/lib64/python3.9/lib-dynload/_asyncio." -"cpython-39-x86_64-linux-gnu.so'>\n" +"<module '_asyncio' from '/usr/lib64/python3.9/lib-dynload/" +"_asyncio.cpython-39-x86_64-linux-gnu.so'>\n" ">>> _asyncio.__file__\n" "'/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'" msgstr "" ">>> import _asyncio\n" ">>> _asyncio\n" -"<module '_asyncio' from '/usr/lib64/python3.9/lib-dynload/_asyncio." -"cpython-39-x86_64-linux-gnu.so'>\n" +"<module '_asyncio' from '/usr/lib64/python3.9/lib-dynload/" +"_asyncio.cpython-39-x86_64-linux-gnu.so'>\n" ">>> _asyncio.__file__\n" "'/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'" -#: ../../using/configure.rst:1184 +#: ../../using/configure.rst:1188 msgid "" ":file:`Modules/Setup` is used to generate Makefile targets to build C " "extensions. At the beginning of the files, C extensions are built as built-" @@ -1754,304 +1752,307 @@ msgid "" "dynamic libraries." msgstr "" -#: ../../using/configure.rst:1188 +#: ../../using/configure.rst:1192 msgid "" -"The :c:macro:`!PyAPI_FUNC()`, :c:macro:`!PyAPI_DATA()` and :c:macro:" -"`PyMODINIT_FUNC` macros of :file:`Include/exports.h` are defined differently " -"depending if the ``Py_BUILD_CORE_MODULE`` macro is defined:" +"The :c:macro:`!PyAPI_FUNC()`, :c:macro:`!PyAPI_DATA()` " +"and :c:macro:`PyMODINIT_FUNC` macros of :file:`Include/exports.h` are " +"defined differently depending if the ``Py_BUILD_CORE_MODULE`` macro is " +"defined:" msgstr "" -#: ../../using/configure.rst:1192 +#: ../../using/configure.rst:1196 msgid "Use ``Py_EXPORTED_SYMBOL`` if the ``Py_BUILD_CORE_MODULE`` is defined" msgstr "如果定義了 ``Py_BUILD_CORE_MODULE``,則使用 ``Py_EXPORTED_SYMBOL``" -#: ../../using/configure.rst:1193 +#: ../../using/configure.rst:1197 msgid "Use ``Py_IMPORTED_SYMBOL`` otherwise." msgstr "否則使用 ``Py_IMPORTED_SYMBOL``。" -#: ../../using/configure.rst:1195 +#: ../../using/configure.rst:1199 msgid "" "If the ``Py_BUILD_CORE_BUILTIN`` macro is used by mistake on a C extension " "built as a shared library, its :samp:`PyInit_{xxx}()` function is not " "exported, causing an :exc:`ImportError` on import." msgstr "" -#: ../../using/configure.rst:1201 +#: ../../using/configure.rst:1205 msgid "Compiler and linker flags" msgstr "" -#: ../../using/configure.rst:1203 +#: ../../using/configure.rst:1207 msgid "" "Options set by the ``./configure`` script and environment variables and used " "by ``Makefile``." msgstr "" -#: ../../using/configure.rst:1207 +#: ../../using/configure.rst:1211 msgid "Preprocessor flags" -msgstr "" +msgstr "預處理器旗標" -#: ../../using/configure.rst:1211 +#: ../../using/configure.rst:1215 msgid "" "Value of :envvar:`CPPFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:1217 +#: ../../using/configure.rst:1221 msgid "" "(Objective) C/C++ preprocessor flags, e.g. :samp:`-I{include_dir}` if you " "have headers in a nonstandard directory *include_dir*." msgstr "" -#: ../../using/configure.rst:1220 ../../using/configure.rst:1410 +#: ../../using/configure.rst:1224 ../../using/configure.rst:1414 msgid "" "Both :envvar:`CPPFLAGS` and :envvar:`LDFLAGS` need to contain the shell's " "value to be able to build extension modules using the directories specified " "in the environment variables." msgstr "" -#: ../../using/configure.rst:1230 +#: ../../using/configure.rst:1234 msgid "" "Extra preprocessor flags added for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:1232 +#: ../../using/configure.rst:1236 msgid "" -"Default: ``$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) " -"$(CPPFLAGS)``." +"Default: ``$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $" +"(CPPFLAGS)``." msgstr "" -#: ../../using/configure.rst:1237 +#: ../../using/configure.rst:1241 msgid "Compiler flags" msgstr "編譯器旗標" -#: ../../using/configure.rst:1243 +#: ../../using/configure.rst:1247 msgid "Example: ``gcc -pthread``." -msgstr "" +msgstr "範例:``gcc -pthread``。" -#: ../../using/configure.rst:1247 +#: ../../using/configure.rst:1251 msgid "C++ compiler command." msgstr "C++ 編譯器指令。" -#: ../../using/configure.rst:1249 +#: ../../using/configure.rst:1253 msgid "Example: ``g++ -pthread``." msgstr "範例:``g++ -pthread``。" -#: ../../using/configure.rst:1257 +#: ../../using/configure.rst:1261 msgid "" ":envvar:`CFLAGS_NODIST` is used for building the interpreter and stdlib C " -"extensions. Use it when a compiler flag should *not* be part of :envvar:" -"`CFLAGS` once Python is installed (:gh:`65320`)." +"extensions. Use it when a compiler flag should *not* be part " +"of :envvar:`CFLAGS` once Python is installed (:gh:`65320`)." msgstr "" -#: ../../using/configure.rst:1261 +#: ../../using/configure.rst:1265 msgid "In particular, :envvar:`CFLAGS` should not contain:" msgstr "" -#: ../../using/configure.rst:1263 +#: ../../using/configure.rst:1267 msgid "" "the compiler flag ``-I`` (for setting the search path for include files). " -"The ``-I`` flags are processed from left to right, and any flags in :envvar:" -"`CFLAGS` would take precedence over user- and package-supplied ``-I`` flags." +"The ``-I`` flags are processed from left to right, and any flags " +"in :envvar:`CFLAGS` would take precedence over user- and package-supplied ``-" +"I`` flags." msgstr "" -#: ../../using/configure.rst:1268 +#: ../../using/configure.rst:1272 msgid "" "hardening flags such as ``-Werror`` because distributions cannot control " "whether packages installed by users conform to such heightened standards." msgstr "" -#: ../../using/configure.rst:1276 +#: ../../using/configure.rst:1280 msgid "" "Options passed to the :mod:`compileall` command line when building PYC files " "in ``make install``. Default: ``-j0``." msgstr "" -#: ../../using/configure.rst:1283 +#: ../../using/configure.rst:1287 msgid "Extra C compiler flags." msgstr "額外的 C 編譯器旗標。" -#: ../../using/configure.rst:1287 +#: ../../using/configure.rst:1291 msgid "" "Value of :envvar:`CFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:1294 +#: ../../using/configure.rst:1298 msgid "" "Value of :envvar:`CFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: ../../using/configure.rst:1301 +#: ../../using/configure.rst:1305 msgid "Base compiler flags." msgstr "基本編譯器旗標。" -#: ../../using/configure.rst:1305 +#: ../../using/configure.rst:1309 msgid "Optimization flags." msgstr "最佳化旗標。" -#: ../../using/configure.rst:1309 +#: ../../using/configure.rst:1313 msgid "Strict or non-strict aliasing flags used to compile ``Python/dtoa.c``." msgstr "" -#: ../../using/configure.rst:1315 +#: ../../using/configure.rst:1319 msgid "Compiler flags used to build a shared library." msgstr "" -#: ../../using/configure.rst:1317 +#: ../../using/configure.rst:1321 msgid "For example, ``-fPIC`` is used on Linux and on BSD." msgstr "例如說 ``-fPIC`` 被使用於 Linux 與 BSD 上。" -#: ../../using/configure.rst:1321 +#: ../../using/configure.rst:1325 msgid "Extra C flags added for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:1323 +#: ../../using/configure.rst:1327 msgid "" "Default: ``$(CCSHARED)`` when :option:`--enable-shared` is used, or an empty " "string otherwise." msgstr "" -#: ../../using/configure.rst:1328 +#: ../../using/configure.rst:1332 msgid "" -"Default: ``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) " -"$(EXTRA_CFLAGS)``." +"Default: ``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $" +"(EXTRA_CFLAGS)``." msgstr "" -#: ../../using/configure.rst:1332 +#: ../../using/configure.rst:1336 msgid "" "Default: ``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/" "internal``." msgstr "" -#: ../../using/configure.rst:1338 +#: ../../using/configure.rst:1342 msgid "C flags used for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:1340 +#: ../../using/configure.rst:1344 msgid "" -"Default: ``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) " -"$(CFLAGSFORSHARED)``." +"Default: ``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $" +"(CFLAGSFORSHARED)``." msgstr "" -#: ../../using/configure.rst:1346 +#: ../../using/configure.rst:1350 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``." msgstr "" -#: ../../using/configure.rst:1352 +#: ../../using/configure.rst:1356 msgid "" "Compiler flags to build a standard library extension module as a built-in " "module, like the :mod:`posix` module." msgstr "" -#: ../../using/configure.rst:1355 +#: ../../using/configure.rst:1359 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``." msgstr "" -#: ../../using/configure.rst:1361 +#: ../../using/configure.rst:1365 msgid "Purify command. Purify is a memory debugger program." msgstr "" -#: ../../using/configure.rst:1363 +#: ../../using/configure.rst:1367 msgid "Default: empty string (not used)." msgstr "" -#: ../../using/configure.rst:1367 +#: ../../using/configure.rst:1371 msgid "Linker flags" msgstr "" -#: ../../using/configure.rst:1371 +#: ../../using/configure.rst:1375 msgid "" "Linker command used to build programs like ``python`` and ``_testembed``." msgstr "" -#: ../../using/configure.rst:1373 +#: ../../using/configure.rst:1377 msgid "Default: ``$(PURIFY) $(CC)``." msgstr "" -#: ../../using/configure.rst:1377 +#: ../../using/configure.rst:1381 msgid "" "Value of :envvar:`LDFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:1379 +#: ../../using/configure.rst:1383 msgid "" "Avoid assigning :envvar:`CFLAGS`, :envvar:`LDFLAGS`, etc. so users can use " "them on the command line to append to these values without stomping the pre-" "set values." msgstr "" -#: ../../using/configure.rst:1387 +#: ../../using/configure.rst:1391 msgid "" -":envvar:`LDFLAGS_NODIST` is used in the same manner as :envvar:" -"`CFLAGS_NODIST`. Use it when a linker flag should *not* be part of :envvar:" -"`LDFLAGS` once Python is installed (:gh:`65320`)." +":envvar:`LDFLAGS_NODIST` is used in the same manner " +"as :envvar:`CFLAGS_NODIST`. Use it when a linker flag should *not* be part " +"of :envvar:`LDFLAGS` once Python is installed (:gh:`65320`)." msgstr "" -#: ../../using/configure.rst:1391 +#: ../../using/configure.rst:1395 msgid "In particular, :envvar:`LDFLAGS` should not contain:" msgstr "" -#: ../../using/configure.rst:1393 +#: ../../using/configure.rst:1397 msgid "" "the compiler flag ``-L`` (for setting the search path for libraries). The ``-" -"L`` flags are processed from left to right, and any flags in :envvar:" -"`LDFLAGS` would take precedence over user- and package-supplied ``-L`` flags." +"L`` flags are processed from left to right, and any flags " +"in :envvar:`LDFLAGS` would take precedence over user- and package-supplied " +"``-L`` flags." msgstr "" -#: ../../using/configure.rst:1400 +#: ../../using/configure.rst:1404 msgid "" "Value of :envvar:`LDFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: ../../using/configure.rst:1407 +#: ../../using/configure.rst:1411 msgid "" "Linker flags, e.g. :samp:`-L{lib_dir}` if you have libraries in a " "nonstandard directory *lib_dir*." msgstr "" -#: ../../using/configure.rst:1416 +#: ../../using/configure.rst:1420 msgid "" "Linker flags to pass libraries to the linker when linking the Python " "executable." msgstr "" -#: ../../using/configure.rst:1419 +#: ../../using/configure.rst:1423 msgid "Example: ``-lrt``." msgstr "範例:``-lrt``。" -#: ../../using/configure.rst:1423 +#: ../../using/configure.rst:1427 msgid "Command to build a shared library." msgstr "" -#: ../../using/configure.rst:1425 +#: ../../using/configure.rst:1429 msgid "Default: ``@LDSHARED@ $(PY_LDFLAGS)``." msgstr "預設值:``@LDSHARED@ $(PY_LDFLAGS)``。" -#: ../../using/configure.rst:1429 +#: ../../using/configure.rst:1433 msgid "Command to build ``libpython`` shared library." msgstr "" -#: ../../using/configure.rst:1431 +#: ../../using/configure.rst:1435 msgid "Default: ``@BLDSHARED@ $(PY_CORE_LDFLAGS)``." msgstr "預設值:``@BLDSHARED@ $(PY_CORE_LDFLAGS)``。" -#: ../../using/configure.rst:1435 +#: ../../using/configure.rst:1439 msgid "Default: ``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``." msgstr "預設值:``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``。" -#: ../../using/configure.rst:1439 +#: ../../using/configure.rst:1443 msgid "Default: ``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``." msgstr "預設值:``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``。" -#: ../../using/configure.rst:1445 +#: ../../using/configure.rst:1449 msgid "Linker flags used for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:1451 +#: ../../using/configure.rst:1455 msgid "Footnotes" msgstr "註腳" -#: ../../using/configure.rst:1452 +#: ../../using/configure.rst:1456 msgid "" "``git clean -fdx`` is an even more extreme way to \"clean\" your checkout. " "It removes all files not known to Git. When bug hunting using ``git " diff --git a/whatsnew/2.3.po b/whatsnew/2.3.po index 3173149b94..d2be7edf2d 100644 --- a/whatsnew/2.3.po +++ b/whatsnew/2.3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -501,7 +501,7 @@ msgid "" "Other systems also allow Unicode strings as file names but convert them to " "byte strings before passing them to the system, which can cause a :exc:" "`UnicodeError` to be raised. Applications can test whether arbitrary Unicode " -"strings are supported as file names by checking :attr:`os.path." +"strings are supported as file names by checking :const:`os.path." "supports_unicode_filenames`, a Boolean value." msgstr "" diff --git a/whatsnew/2.7.po b/whatsnew/2.7.po index 969d821d8b..cc574ea59c 100644 --- a/whatsnew/2.7.po +++ b/whatsnew/2.7.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2345,7 +2345,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:1605 msgid "" -"The :attr:`sys.version_info` value is now a named tuple, with attributes " +"The :data:`sys.version_info` value is now a named tuple, with attributes " "named :attr:`!major`, :attr:`!minor`, :attr:`!micro`, :attr:`!releaselevel`, " "and :attr:`!serial`. (Contributed by Ross Light; :issue:`4285`.)" msgstr "" @@ -2980,14 +2980,14 @@ msgid "" "ElementTree's code for converting trees to a string has been significantly " "reworked, making it roughly twice as fast in many cases. The :meth:" "`ElementTree.write() <xml.etree.ElementTree.ElementTree.write>` and :meth:" -"`Element.write` methods now have a *method* parameter that can be \"xml\" " -"(the default), \"html\", or \"text\". HTML mode will output empty elements " -"as ``<empty></empty>`` instead of ``<empty/>``, and text mode will skip over " -"elements and only output the text chunks. If you set the :attr:`~xml.etree." -"ElementTree.Element.tag` attribute of an element to ``None`` but leave its " -"children in place, the element will be omitted when the tree is written out, " -"so you don't need to do more extensive rearrangement to remove a single " -"element." +"`Element.write` methods now have a *method* parameter that can be " +"\"xml\" (the default), \"html\", or \"text\". HTML mode will output empty " +"elements as ``<empty></empty>`` instead of ``<empty/>``, and text mode will " +"skip over elements and only output the text chunks. If you set the :attr:" +"`~xml.etree.ElementTree.Element.tag` attribute of an element to ``None`` but " +"leave its children in place, the element will be omitted when the tree is " +"written out, so you don't need to do more extensive rearrangement to remove " +"a single element." msgstr "" #: ../../whatsnew/2.7.rst:2044 diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index 8bddce6733..4f0abbe638 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-18 00:15+0000\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,8 +31,8 @@ msgstr "Adam Turner" #: ../../whatsnew/3.12.rst:48 msgid "" "This article explains the new features in Python 3.12, compared to 3.11. " -"Python 3.12 was released on October 2, 2023. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.12 was released on October 2, 2023. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.12 與 3.11 相比多了哪些新功能。 Python 3.12 於 2023 年 " "10 月 2 日發布。完整詳情請見 :ref:`changelog <changelog>`。" @@ -60,9 +60,9 @@ msgid "" "The language changes focus on usability, as :term:`f-strings <f-string>` " "have had many limitations removed and 'Did you mean ...' suggestions " "continue to improve. The new :ref:`type parameter syntax <whatsnew312-" -"pep695>` and :keyword:`type` statement improve ergonomics for using :term:" -"`generic types <generic type>` and :term:`type aliases <type alias>` with " -"static type checkers." +"pep695>` and :keyword:`type` statement improve ergonomics for " +"using :term:`generic types <generic type>` and :term:`type aliases <type " +"alias>` with static type checkers." msgstr "" #: ../../whatsnew/3.12.rst:76 @@ -82,8 +82,8 @@ msgstr "新增語法特性:" #: ../../whatsnew/3.12.rst:92 msgid "" -":ref:`PEP 695 <whatsnew312-pep695>`, type parameter syntax and the :keyword:" -"`type` statement" +":ref:`PEP 695 <whatsnew312-pep695>`, type parameter syntax and " +"the :keyword:`type` statement" msgstr "" ":ref:`PEP 695 <whatsnew312-pep695>`,型別參數語法和 :keyword:`type` 陳述式" @@ -113,8 +113,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:103 msgid "" -"`Improved 'Did you mean ...' suggestions <improved error messages_>`_ for :" -"exc:`NameError`, :exc:`ImportError`, and :exc:`SyntaxError` exceptions" +"`Improved 'Did you mean ...' suggestions <improved error messages_>`_ " +"for :exc:`NameError`, :exc:`ImportError`, and :exc:`SyntaxError` exceptions" msgstr "" #: ../../whatsnew/3.12.rst:106 @@ -141,15 +141,15 @@ msgstr "" #: ../../whatsnew/3.12.rst:115 msgid "" -"A :ref:`command-line interface <sqlite3-cli>` has been added to the :mod:" -"`sqlite3` module" +"A :ref:`command-line interface <sqlite3-cli>` has been added to " +"the :mod:`sqlite3` module" msgstr "" "一個\\ :ref:`命令列介面 <sqlite3-cli>`\\ 已被加入 :mod:`sqlite3` 模組中" #: ../../whatsnew/3.12.rst:117 msgid "" -":func:`isinstance` checks against :func:`runtime-checkable protocols <typing." -"runtime_checkable>` enjoy a speed up of between two and 20 times" +":func:`isinstance` checks against :func:`runtime-checkable protocols " +"<typing.runtime_checkable>` enjoy a speed up of between two and 20 times" msgstr "" #: ../../whatsnew/3.12.rst:119 @@ -220,8 +220,8 @@ msgid "" ":ref:`PEP 692 <whatsnew312-pep692>`, using :class:`~typing.TypedDict` to " "annotate :term:`**kwargs <argument>`" msgstr "" -":ref:`PEP 692 <whatsnew312-pep692>`、使用 :class:`~typing.TypedDict` 來標註 :" -"term:`**kwargs <argument>`" +":ref:`PEP 692 <whatsnew312-pep692>`、使用 :class:`~typing.TypedDict` 來標" +"註 :term:`**kwargs <argument>`" #: ../../whatsnew/3.12.rst:149 msgid ":ref:`PEP 698 <whatsnew312-pep698>`, :func:`typing.override` decorator" @@ -261,9 +261,9 @@ msgid "" "removed, along with several :class:`unittest.TestCase` `method aliases " "<unittest-TestCase-removed-aliases_>`_." msgstr "" -":mod:`!asynchat`、:mod:`!asyncore` 和 :mod:`!imp` 模組以及幾個 :class:" -"`unittest.TestCase` 的\\ `方法別名 <unittest-TestCase-removed-aliases_>`_\\ " -"已被刪除。" +":mod:`!asynchat`、:mod:`!asyncore` 和 :mod:`!imp` 模組以及幾" +"個 :class:`unittest.TestCase` 的\\ `方法別名 <unittest-TestCase-removed-" +"aliases_>`_\\ 已被刪除。" #: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1832 msgid "New Features" @@ -282,8 +282,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:187 msgid "" -":pep:`695` introduces a new, more compact and explicit way to create :ref:" -"`generic classes <generic-classes>` and :ref:`functions <generic-" +":pep:`695` introduces a new, more compact and explicit way to " +"create :ref:`generic classes <generic-classes>` and :ref:`functions <generic-" "functions>`::" msgstr "" @@ -330,9 +330,9 @@ msgstr "type Point[T] = tuple[T, T]" #: ../../whatsnew/3.12.rst:210 msgid "" -"The new syntax allows declaring :class:`~typing.TypeVarTuple` and :class:" -"`~typing.ParamSpec` parameters, as well as :class:`~typing.TypeVar` " -"parameters with bounds or constraints::" +"The new syntax allows declaring :class:`~typing.TypeVarTuple` " +"and :class:`~typing.ParamSpec` parameters, as well " +"as :class:`~typing.TypeVar` parameters with bounds or constraints::" msgstr "" #: ../../whatsnew/3.12.rst:214 @@ -428,10 +428,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:290 msgid "" "Backslashes and unicode characters: before Python 3.12 f-string expressions " -"couldn't contain any ``\\`` character. This also affected unicode :ref:" -"`escape sequences <escape-sequences>` (such as ``\\N{snowman}``) as these " -"contain the ``\\N`` part that previously could not be part of expression " -"components of f-strings. Now, you can define expressions like this:" +"couldn't contain any ``\\`` character. This also affected " +"unicode :ref:`escape sequences <escape-sequences>` (such as ``\\N{snowman}" +"``) as these contain the ``\\N`` part that previously could not be part of " +"expression components of f-strings. Now, you can define expressions like " +"this:" msgstr "" #: ../../whatsnew/3.12.rst:303 @@ -567,16 +568,17 @@ msgstr "" #: ../../whatsnew/3.12.rst:386 msgid "" ":pep:`688` introduces a way to use the :ref:`buffer protocol " -"<bufferobjects>` from Python code. Classes that implement the :meth:`~object." -"__buffer__` method are now usable as buffer types." +"<bufferobjects>` from Python code. Classes that implement " +"the :meth:`~object.__buffer__` method are now usable as buffer types." msgstr "" #: ../../whatsnew/3.12.rst:390 msgid "" "The new :class:`collections.abc.Buffer` ABC provides a standard way to " -"represent buffer objects, for example in type annotations. The new :class:" -"`inspect.BufferFlags` enum represents the flags that can be used to " -"customize buffer creation. (Contributed by Jelle Zijlstra in :gh:`102500`.)" +"represent buffer objects, for example in type annotations. The " +"new :class:`inspect.BufferFlags` enum represents the flags that can be used " +"to customize buffer creation. (Contributed by Jelle Zijlstra " +"in :gh:`102500`.)" msgstr "" #: ../../whatsnew/3.12.rst:399 @@ -655,8 +657,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:459 msgid "" "Improve the :exc:`SyntaxError` error message when the user types ``import x " -"from y`` instead of ``from y import x``. (Contributed by Pablo Galindo in :" -"gh:`98931`.)" +"from y`` instead of ``from y import x``. (Contributed by Pablo Galindo " +"in :gh:`98931`.)" msgstr "" #: ../../whatsnew/3.12.rst:469 @@ -673,8 +675,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:482 msgid "" -"This section covers major changes affecting :pep:`type hints <484>` and the :" -"mod:`typing` module." +"This section covers major changes affecting :pep:`type hints <484>` and " +"the :mod:`typing` module." msgstr "" #: ../../whatsnew/3.12.rst:488 @@ -780,17 +782,18 @@ msgid "" "a :exc:`SyntaxWarning`, instead of :exc:`DeprecationWarning`. For example, " "``re.compile(\"\\d+\\.\\d+\")`` now emits a :exc:`SyntaxWarning` " "(``\"\\d\"`` is an invalid escape sequence, use raw strings for regular " -"expression: ``re.compile(r\"\\d+\\.\\d+\")``). In a future Python version, :" -"exc:`SyntaxError` will eventually be raised, instead of :exc:" -"`SyntaxWarning`. (Contributed by Victor Stinner in :gh:`98401`.)" +"expression: ``re.compile(r\"\\d+\\.\\d+\")``). In a future Python " +"version, :exc:`SyntaxError` will eventually be raised, instead " +"of :exc:`SyntaxWarning`. (Contributed by Victor Stinner in :gh:`98401`.)" msgstr "" #: ../../whatsnew/3.12.rst:557 msgid "" "Octal escapes with value larger than ``0o377`` (ex: ``\"\\477\"``), " -"deprecated in Python 3.11, now produce a :exc:`SyntaxWarning`, instead of :" -"exc:`DeprecationWarning`. In a future Python version they will be eventually " -"a :exc:`SyntaxError`. (Contributed by Victor Stinner in :gh:`98401`.)" +"deprecated in Python 3.11, now produce a :exc:`SyntaxWarning`, instead " +"of :exc:`DeprecationWarning`. In a future Python version they will be " +"eventually a :exc:`SyntaxError`. (Contributed by Victor Stinner " +"in :gh:`98401`.)" msgstr "" #: ../../whatsnew/3.12.rst:563 @@ -813,9 +816,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:574 msgid "" "When a ``try-except*`` construct handles the entire :exc:`ExceptionGroup` " -"and raises one other exception, that exception is no longer wrapped in an :" -"exc:`ExceptionGroup`. Also changed in version 3.11.4. (Contributed by Irit " -"Katriel in :gh:`103590`.)" +"and raises one other exception, that exception is no longer wrapped in " +"an :exc:`ExceptionGroup`. Also changed in version 3.11.4. (Contributed by " +"Irit Katriel in :gh:`103590`.)" msgstr "" #: ../../whatsnew/3.12.rst:579 @@ -824,8 +827,8 @@ msgid "" "Python bytecode evaluation loop instead of object allocations. The GC can " "also run when :c:func:`PyErr_CheckSignals` is called so C extensions that " "need to run for a long time without executing any Python code also have a " -"chance to execute the GC periodically. (Contributed by Pablo Galindo in :gh:" -"`97922`.)" +"chance to execute the GC periodically. (Contributed by Pablo Galindo " +"in :gh:`97922`.)" msgstr "" #: ../../whatsnew/3.12.rst:586 @@ -881,12 +884,13 @@ msgstr "" #: ../../whatsnew/3.12.rst:616 msgid "" "Add :ref:`support for the perf profiler <perf_profiling>` through the new " -"environment variable :envvar:`PYTHONPERFSUPPORT` and command-line option :" -"option:`-X perf <-X>`, as well as the new :func:`sys." -"activate_stack_trampoline`, :func:`sys.deactivate_stack_trampoline`, and :" -"func:`sys.is_stack_trampoline_active` functions. (Design by Pablo Galindo. " -"Contributed by Pablo Galindo and Christian Heimes with contributions from " -"Gregory P. Smith [Google] and Mark Shannon in :gh:`96123`.)" +"environment variable :envvar:`PYTHONPERFSUPPORT` and command-line " +"option :option:`-X perf <-X>`, as well as the " +"new :func:`sys.activate_stack_trampoline`, :func:`sys.deactivate_stack_trampoline`, " +"and :func:`sys.is_stack_trampoline_active` functions. (Design by Pablo " +"Galindo. Contributed by Pablo Galindo and Christian Heimes with " +"contributions from Gregory P. Smith [Google] and Mark Shannon " +"in :gh:`96123`.)" msgstr "" #: ../../whatsnew/3.12.rst:628 @@ -907,8 +911,8 @@ msgstr "array" #: ../../whatsnew/3.12.rst:639 msgid "" -"The :class:`array.array` class now supports subscripting, making it a :term:" -"`generic type`. (Contributed by Jelle Zijlstra in :gh:`98658`.)" +"The :class:`array.array` class now supports subscripting, making it " +"a :term:`generic type`. (Contributed by Jelle Zijlstra in :gh:`98658`.)" msgstr "" #: ../../whatsnew/3.12.rst:643 @@ -925,25 +929,28 @@ msgstr "" #: ../../whatsnew/3.12.rst:650 msgid "" -"Add :func:`asyncio.eager_task_factory` and :func:`asyncio." -"create_eager_task_factory` functions to allow opting an event loop in to " -"eager task execution, making some use-cases 2x to 5x faster. (Contributed by " -"Jacob Bower & Itamar Oren in :gh:`102853`, :gh:`104140`, and :gh:`104138`)" +"Add :func:`asyncio.eager_task_factory` " +"and :func:`asyncio.create_eager_task_factory` functions to allow opting an " +"event loop in to eager task execution, making some use-cases 2x to 5x " +"faster. (Contributed by Jacob Bower & Itamar Oren " +"in :gh:`102853`, :gh:`104140`, and :gh:`104138`)" msgstr "" #: ../../whatsnew/3.12.rst:655 msgid "" "On Linux, :mod:`asyncio` uses :class:`asyncio.PidfdChildWatcher` by default " -"if :func:`os.pidfd_open` is available and functional instead of :class:" -"`asyncio.ThreadedChildWatcher`. (Contributed by Kumar Aditya in :gh:`98024`.)" +"if :func:`os.pidfd_open` is available and functional instead " +"of :class:`asyncio.ThreadedChildWatcher`. (Contributed by Kumar Aditya " +"in :gh:`98024`.)" msgstr "" #: ../../whatsnew/3.12.rst:660 msgid "" -"The event loop now uses the best available child watcher for each platform (:" -"class:`asyncio.PidfdChildWatcher` if supported and :class:`asyncio." -"ThreadedChildWatcher` otherwise), so manually configuring a child watcher is " -"not recommended. (Contributed by Kumar Aditya in :gh:`94597`.)" +"The event loop now uses the best available child watcher for each platform " +"(:class:`asyncio.PidfdChildWatcher` if supported " +"and :class:`asyncio.ThreadedChildWatcher` otherwise), so manually " +"configuring a child watcher is not recommended. (Contributed by Kumar Aditya " +"in :gh:`94597`.)" msgstr "" #: ../../whatsnew/3.12.rst:666 @@ -960,9 +967,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:673 msgid "" -":func:`asyncio.iscoroutine` now returns ``False`` for generators as :mod:" -"`asyncio` does not support legacy generator-based coroutines. (Contributed " -"by Kumar Aditya in :gh:`102748`.)" +":func:`asyncio.iscoroutine` now returns ``False`` for generators " +"as :mod:`asyncio` does not support legacy generator-based coroutines. " +"(Contributed by Kumar Aditya in :gh:`102748`.)" msgstr "" #: ../../whatsnew/3.12.rst:677 @@ -978,8 +985,8 @@ msgstr "calendar" #: ../../whatsnew/3.12.rst:684 msgid "" "Add enums :data:`calendar.Month` and :data:`calendar.Day` defining months of " -"the year and days of the week. (Contributed by Prince Roshan in :gh:" -"`103636`.)" +"the year and days of the week. (Contributed by Prince Roshan " +"in :gh:`103636`.)" msgstr "" #: ../../whatsnew/3.12.rst:689 @@ -989,8 +996,8 @@ msgstr "csv" #: ../../whatsnew/3.12.rst:691 msgid "" "Add :const:`csv.QUOTE_NOTNULL` and :const:`csv.QUOTE_STRINGS` flags to " -"provide finer grained control of ``None`` and empty strings by :class:`~csv." -"reader` and :class:`~csv.writer` objects." +"provide finer grained control of ``None`` and empty strings " +"by :class:`~csv.reader` and :class:`~csv.writer` objects." msgstr "" #: ../../whatsnew/3.12.rst:696 @@ -1000,10 +1007,10 @@ msgstr "dis" #: ../../whatsnew/3.12.rst:698 msgid "" "Pseudo instruction opcodes (which are used by the compiler but do not appear " -"in executable bytecode) are now exposed in the :mod:`dis` module. :opcode:" -"`HAVE_ARGUMENT` is still relevant to real opcodes, but it is not useful for " -"pseudo instructions. Use the new :data:`dis.hasarg` collection instead. " -"(Contributed by Irit Katriel in :gh:`94216`.)" +"in executable bytecode) are now exposed in the :mod:`dis` " +"module. :opcode:`HAVE_ARGUMENT` is still relevant to real opcodes, but it is " +"not useful for pseudo instructions. Use the new :data:`dis.hasarg` " +"collection instead. (Contributed by Irit Katriel in :gh:`94216`.)" msgstr "" #: ../../whatsnew/3.12.rst:706 @@ -1097,8 +1104,8 @@ msgid "" "Add :func:`math.sumprod` for computing a sum of products. (Contributed by " "Raymond Hettinger in :gh:`100485`.)" msgstr "" -"新增 :func:`math.sumprod` 以計算乘積總和。(由 Raymond Hettinger 於 :gh:" -"`100485` 中貢獻。)" +"新增 :func:`math.sumprod` 以計算乘積總和。(由 Raymond Hettinger " +"於 :gh:`100485` 中貢獻。)" #: ../../whatsnew/3.12.rst:752 msgid "" @@ -1113,16 +1120,16 @@ msgstr "os" #: ../../whatsnew/3.12.rst:759 msgid "" -"Add :const:`os.PIDFD_NONBLOCK` to open a file descriptor for a process with :" -"func:`os.pidfd_open` in non-blocking mode. (Contributed by Kumar Aditya in :" -"gh:`93312`.)" +"Add :const:`os.PIDFD_NONBLOCK` to open a file descriptor for a process " +"with :func:`os.pidfd_open` in non-blocking mode. (Contributed by Kumar " +"Aditya in :gh:`93312`.)" msgstr "" #: ../../whatsnew/3.12.rst:763 msgid "" ":class:`os.DirEntry` now includes an :meth:`os.DirEntry.is_junction` method " -"to check if the entry is a junction. (Contributed by Charles Machalow in :gh:" -"`99547`.)" +"to check if the entry is a junction. (Contributed by Charles Machalow " +"in :gh:`99547`.)" msgstr "" #: ../../whatsnew/3.12.rst:767 @@ -1141,8 +1148,8 @@ msgid "" "with other platforms). ``st_dev`` may be up to 64 bits and ``st_ino`` up to " "128 bits depending on your file system, and ``st_rdev`` is always set to " "zero rather than incorrect values. Both functions may be significantly " -"faster on newer releases of Windows. (Contributed by Steve Dower in :gh:" -"`99726`.)" +"faster on newer releases of Windows. (Contributed by Steve Dower " +"in :gh:`99726`.)" msgstr "" #: ../../whatsnew/3.12.rst:782 @@ -1171,10 +1178,10 @@ msgstr "pathlib" #: ../../whatsnew/3.12.rst:793 msgid "" -"Add support for subclassing :class:`pathlib.PurePath` and :class:`pathlib." -"Path`, plus their Posix- and Windows-specific variants. Subclasses may " -"override the :meth:`pathlib.PurePath.with_segments` method to pass " -"information between path instances." +"Add support for subclassing :class:`pathlib.PurePath` " +"and :class:`pathlib.Path`, plus their Posix- and Windows-specific variants. " +"Subclasses may override the :meth:`pathlib.PurePath.with_segments` method to " +"pass information between path instances." msgstr "" #: ../../whatsnew/3.12.rst:798 @@ -1188,22 +1195,23 @@ msgstr "" msgid "" "Add *walk_up* optional parameter to :meth:`pathlib.PurePath.relative_to` to " "allow the insertion of ``..`` entries in the result; this behavior is more " -"consistent with :func:`os.path.relpath`. (Contributed by Domenico Ragusa in :" -"gh:`84538`.)" +"consistent with :func:`os.path.relpath`. (Contributed by Domenico Ragusa " +"in :gh:`84538`.)" msgstr "" #: ../../whatsnew/3.12.rst:807 msgid "" -"Add :meth:`pathlib.Path.is_junction` as a proxy to :func:`os.path." -"isjunction`. (Contributed by Charles Machalow in :gh:`99547`.)" +"Add :meth:`pathlib.Path.is_junction` as a proxy " +"to :func:`os.path.isjunction`. (Contributed by Charles Machalow " +"in :gh:`99547`.)" msgstr "" #: ../../whatsnew/3.12.rst:810 msgid "" -"Add *case_sensitive* optional parameter to :meth:`pathlib.Path.glob`, :meth:" -"`pathlib.Path.rglob` and :meth:`pathlib.PurePath.match` for matching the " -"path's case sensitivity, allowing for more precise control over the matching " -"process." +"Add *case_sensitive* optional parameter " +"to :meth:`pathlib.Path.glob`, :meth:`pathlib.Path.rglob` " +"and :meth:`pathlib.PurePath.match` for matching the path's case sensitivity, " +"allowing for more precise control over the matching process." msgstr "" #: ../../whatsnew/3.12.rst:815 @@ -1223,8 +1231,8 @@ msgstr "random" #: ../../whatsnew/3.12.rst:825 msgid "" -"Add :func:`random.binomialvariate`. (Contributed by Raymond Hettinger in :gh:" -"`81620`.)" +"Add :func:`random.binomialvariate`. (Contributed by Raymond Hettinger " +"in :gh:`81620`.)" msgstr "" "新增 :func:`random.binomialvariate`。(由 Raymond Hettinger 於 :gh:`81620` 中" "貢獻。)" @@ -1288,29 +1296,31 @@ msgid "" "Add a :ref:`command-line interface <sqlite3-cli>`. (Contributed by Erlend E. " "Aasland in :gh:`77617`.)" msgstr "" -"新增\\ :ref:`命令列介面 <sqlite3-cli>`。(由 Erlend E. Aasland 於 :gh:" -"`77617` 中貢獻。)" +"新增\\ :ref:`命令列介面 <sqlite3-cli>`。(由 Erlend E. Aasland " +"於 :gh:`77617` 中貢獻。)" #: ../../whatsnew/3.12.rst:866 msgid "" -"Add the :attr:`sqlite3.Connection.autocommit` attribute to :class:`sqlite3." -"Connection` and the *autocommit* parameter to :func:`sqlite3.connect` to " -"control :pep:`249`-compliant :ref:`transaction handling <sqlite3-transaction-" -"control-autocommit>`. (Contributed by Erlend E. Aasland in :gh:`83638`.)" +"Add the :attr:`sqlite3.Connection.autocommit` attribute " +"to :class:`sqlite3.Connection` and the *autocommit* parameter " +"to :func:`sqlite3.connect` to control :pep:`249`-compliant :ref:`transaction " +"handling <sqlite3-transaction-control-autocommit>`. (Contributed by Erlend " +"E. Aasland in :gh:`83638`.)" msgstr "" #: ../../whatsnew/3.12.rst:873 msgid "" -"Add *entrypoint* keyword-only parameter to :meth:`sqlite3.Connection." -"load_extension`, for overriding the SQLite extension entry point. " -"(Contributed by Erlend E. Aasland in :gh:`103015`.)" +"Add *entrypoint* keyword-only parameter " +"to :meth:`sqlite3.Connection.load_extension`, for overriding the SQLite " +"extension entry point. (Contributed by Erlend E. Aasland in :gh:`103015`.)" msgstr "" #: ../../whatsnew/3.12.rst:878 msgid "" -"Add :meth:`sqlite3.Connection.getconfig` and :meth:`sqlite3.Connection." -"setconfig` to :class:`sqlite3.Connection` to make configuration changes to a " -"database connection. (Contributed by Erlend E. Aasland in :gh:`103489`.)" +"Add :meth:`sqlite3.Connection.getconfig` " +"and :meth:`sqlite3.Connection.setconfig` to :class:`sqlite3.Connection` to " +"make configuration changes to a database connection. (Contributed by Erlend " +"E. Aasland in :gh:`103489`.)" msgstr "" #: ../../whatsnew/3.12.rst:884 @@ -1331,27 +1341,28 @@ msgstr "sys" #: ../../whatsnew/3.12.rst:893 msgid "" "Add the :mod:`sys.monitoring` namespace to expose the new :ref:`PEP 669 " -"<whatsnew312-pep669>` monitoring API. (Contributed by Mark Shannon in :gh:" -"`103082`.)" +"<whatsnew312-pep669>` monitoring API. (Contributed by Mark Shannon " +"in :gh:`103082`.)" msgstr "" #: ../../whatsnew/3.12.rst:897 msgid "" -"Add :func:`sys.activate_stack_trampoline` and :func:`sys." -"deactivate_stack_trampoline` for activating and deactivating stack profiler " -"trampolines, and :func:`sys.is_stack_trampoline_active` for querying if " -"stack profiler trampolines are active. (Contributed by Pablo Galindo and " -"Christian Heimes with contributions from Gregory P. Smith [Google] and Mark " -"Shannon in :gh:`96123`.)" +"Add :func:`sys.activate_stack_trampoline` " +"and :func:`sys.deactivate_stack_trampoline` for activating and deactivating " +"stack profiler trampolines, and :func:`sys.is_stack_trampoline_active` for " +"querying if stack profiler trampolines are active. (Contributed by Pablo " +"Galindo and Christian Heimes with contributions from Gregory P. Smith " +"[Google] and Mark Shannon in :gh:`96123`.)" msgstr "" #: ../../whatsnew/3.12.rst:906 msgid "" "Add :data:`sys.last_exc` which holds the last unhandled exception that was " "raised (for post-mortem debugging use cases). Deprecate the three fields " -"that have the same information in its legacy form: :data:`sys.last_type`, :" -"data:`sys.last_value` and :data:`sys.last_traceback`. (Contributed by Irit " -"Katriel in :gh:`102778`.)" +"that have the same information in its legacy " +"form: :data:`sys.last_type`, :data:`sys.last_value` " +"and :data:`sys.last_traceback`. (Contributed by Irit Katriel " +"in :gh:`102778`.)" msgstr "" #: ../../whatsnew/3.12.rst:912 ../../whatsnew/3.12.rst:1731 @@ -1395,10 +1406,10 @@ msgstr "threading" #: ../../whatsnew/3.12.rst:932 msgid "" -"Add :func:`threading.settrace_all_threads` and :func:`threading." -"setprofile_all_threads` that allow to set tracing and profiling functions in " -"all running threads in addition to the calling one. (Contributed by Pablo " -"Galindo in :gh:`93503`.)" +"Add :func:`threading.settrace_all_threads` " +"and :func:`threading.setprofile_all_threads` that allow to set tracing and " +"profiling functions in all running threads in addition to the calling one. " +"(Contributed by Pablo Galindo in :gh:`93503`.)" msgstr "" #: ../../whatsnew/3.12.rst:938 @@ -1422,9 +1433,9 @@ msgstr "tokenize" #: ../../whatsnew/3.12.rst:951 msgid "" "The :mod:`tokenize` module includes the changes introduced in :pep:`701`. " -"(Contributed by Marta Gómez Macías and Pablo Galindo in :gh:`102856`.) See :" -"ref:`whatsnew312-porting-to-python312` for more information on the changes " -"to the :mod:`tokenize` module." +"(Contributed by Marta Gómez Macías and Pablo Galindo in :gh:`102856`.) " +"See :ref:`whatsnew312-porting-to-python312` for more information on the " +"changes to the :mod:`tokenize` module." msgstr "" #: ../../whatsnew/3.12.rst:957 @@ -1433,9 +1444,9 @@ msgstr "types" #: ../../whatsnew/3.12.rst:959 msgid "" -"Add :func:`types.get_original_bases` to allow for further introspection of :" -"ref:`user-defined-generics` when subclassed. (Contributed by James Hilton-" -"Balfe and Alex Waygood in :gh:`101827`.)" +"Add :func:`types.get_original_bases` to allow for further introspection " +"of :ref:`user-defined-generics` when subclassed. (Contributed by James " +"Hilton-Balfe and Alex Waygood in :gh:`101827`.)" msgstr "" #: ../../whatsnew/3.12.rst:966 @@ -1444,15 +1455,16 @@ msgstr "typing" #: ../../whatsnew/3.12.rst:968 msgid "" -":func:`isinstance` checks against :func:`runtime-checkable protocols <typing." -"runtime_checkable>` now use :func:`inspect.getattr_static` rather than :func:" -"`hasattr` to lookup whether attributes exist. This means that descriptors " -"and :meth:`~object.__getattr__` methods are no longer unexpectedly evaluated " -"during ``isinstance()`` checks against runtime-checkable protocols. However, " -"it may also mean that some objects which used to be considered instances of " -"a runtime-checkable protocol may no longer be considered instances of that " -"protocol on Python 3.12+, and vice versa. Most users are unlikely to be " -"affected by this change. (Contributed by Alex Waygood in :gh:`102433`.)" +":func:`isinstance` checks against :func:`runtime-checkable protocols " +"<typing.runtime_checkable>` now use :func:`inspect.getattr_static` rather " +"than :func:`hasattr` to lookup whether attributes exist. This means that " +"descriptors and :meth:`~object.__getattr__` methods are no longer " +"unexpectedly evaluated during ``isinstance()`` checks against runtime-" +"checkable protocols. However, it may also mean that some objects which used " +"to be considered instances of a runtime-checkable protocol may no longer be " +"considered instances of that protocol on Python 3.12+, and vice versa. Most " +"users are unlikely to be affected by this change. (Contributed by Alex " +"Waygood in :gh:`102433`.)" msgstr "" #: ../../whatsnew/3.12.rst:979 @@ -1513,8 +1525,8 @@ msgid "" "Most ``isinstance()`` checks against protocols with only a few members " "should be at least 2x faster than in 3.11, and some may be 20x faster or " "more. However, ``isinstance()`` checks against protocols with many members " -"may be slower than in Python 3.11. (Contributed by Alex Waygood in :gh:" -"`74690` and :gh:`103193`.)" +"may be slower than in Python 3.11. (Contributed by Alex Waygood " +"in :gh:`74690` and :gh:`103193`.)" msgstr "" #: ../../whatsnew/3.12.rst:1012 @@ -1617,8 +1629,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1064 msgid "" -"Speed up the regular expression substitution (functions :func:`re.sub` and :" -"func:`re.subn` and corresponding :class:`!re.Pattern` methods) for " +"Speed up the regular expression substitution (functions :func:`re.sub` " +"and :func:`re.subn` and corresponding :class:`!re.Pattern` methods) for " "replacement strings containing group references by 2--3 times. (Contributed " "by Serhiy Storchaka in :gh:`91524`.)" msgstr "" @@ -1634,16 +1646,16 @@ msgstr "" #: ../../whatsnew/3.12.rst:1072 msgid "" "The :func:`tokenize.tokenize` and :func:`tokenize.generate_tokens` functions " -"are up to 64% faster as a side effect of the changes required to cover :pep:" -"`701` in the :mod:`tokenize` module. (Contributed by Marta Gómez Macías and " -"Pablo Galindo in :gh:`102856`.)" +"are up to 64% faster as a side effect of the changes required to " +"cover :pep:`701` in the :mod:`tokenize` module. (Contributed by Marta Gómez " +"Macías and Pablo Galindo in :gh:`102856`.)" msgstr "" #: ../../whatsnew/3.12.rst:1077 msgid "" -"Speed up :func:`super` method calls and attribute loads via the new :opcode:" -"`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and Vladimir " -"Matveev in :gh:`103497`.)" +"Speed up :func:`super` method calls and attribute loads via the " +"new :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and " +"Vladimir Matveev in :gh:`103497`.)" msgstr "" #: ../../whatsnew/3.12.rst:1083 @@ -1652,28 +1664,29 @@ msgstr "CPython 位元組碼變更" #: ../../whatsnew/3.12.rst:1085 msgid "" -"Remove the :opcode:`!LOAD_METHOD` instruction. It has been merged into :" -"opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the old :opcode:" -"`!LOAD_METHOD` instruction if the low bit of its oparg is set. (Contributed " -"by Ken Jin in :gh:`93429`.)" +"Remove the :opcode:`!LOAD_METHOD` instruction. It has been merged " +"into :opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the " +"old :opcode:`!LOAD_METHOD` instruction if the low bit of its oparg is set. " +"(Contributed by Ken Jin in :gh:`93429`.)" msgstr "" -"移除 :opcode:`!LOAD_METHOD` 指令。它已經合併至 :opcode:`LOAD_ATTR`。:opcode:" -"`LOAD_ATTR` 現在會像舊的 :opcode:`!LOAD_METHOD` 指令一樣行為,如果其 oparg 的" -"低位元 (low bit) 有被設定。(由 Ken Jin 於 :gh:`93429` 中貢獻。)" +"移除 :opcode:`!LOAD_METHOD` 指令。它已經合併" +"至 :opcode:`LOAD_ATTR`。:opcode:`LOAD_ATTR` 現在會像舊的 :opcode:`!" +"LOAD_METHOD` 指令一樣行為,如果其 oparg 的低位元 (low bit) 有被設定。(由 " +"Ken Jin 於 :gh:`93429` 中貢獻。)" #: ../../whatsnew/3.12.rst:1090 msgid "" "Remove the :opcode:`!JUMP_IF_FALSE_OR_POP` and :opcode:`!" -"JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel in :gh:" -"`102859`.)" +"JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel " +"in :gh:`102859`.)" msgstr "" "移除 :opcode:`!JUMP_IF_FALSE_OR_POP` 和 :opcode:`!JUMP_IF_TRUE_OR_POP` 指令。" "(由 Irit Katriel 於 :gh:`102859` 中貢獻。)" #: ../../whatsnew/3.12.rst:1093 msgid "" -"Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon in :" -"gh:`92925`.)" +"Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon " +"in :gh:`92925`.)" msgstr "" "移除 :opcode:`!PRECALL` 指令。(由 Mark Shannon 於 :gh:`92925` 中貢獻。)" @@ -1711,8 +1724,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1108 msgid "" -"Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon in :gh:" -"`103082`.)" +"Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon " +"in :gh:`103082`.)" msgstr "" "新增 :opcode:`!END_SEND` 指令。(由 Mark Shannon 於 :gh:`103082` 中貢獻。)" @@ -1734,30 +1747,31 @@ msgstr "" #: ../../whatsnew/3.12.rst:1117 msgid "" -"Add the :opcode:`LOAD_FROM_DICT_OR_DEREF`, :opcode:" -"`LOAD_FROM_DICT_OR_GLOBALS`, and :opcode:`LOAD_LOCALS` opcodes as part of " -"the implementation of :pep:`695`. Remove the :opcode:`!LOAD_CLASSDEREF` " -"opcode, which can be replaced with :opcode:`LOAD_LOCALS` plus :opcode:" -"`LOAD_FROM_DICT_OR_DEREF`. (Contributed by Jelle Zijlstra in :gh:`103764`.)" +"Add " +"the :opcode:`LOAD_FROM_DICT_OR_DEREF`, :opcode:`LOAD_FROM_DICT_OR_GLOBALS`, " +"and :opcode:`LOAD_LOCALS` opcodes as part of the implementation " +"of :pep:`695`. Remove the :opcode:`!LOAD_CLASSDEREF` opcode, which can be " +"replaced with :opcode:`LOAD_LOCALS` plus :opcode:`LOAD_FROM_DICT_OR_DEREF`. " +"(Contributed by Jelle Zijlstra in :gh:`103764`.)" msgstr "" "新增 :opcode:`LOAD_FROM_DICT_OR_DEREF`、:opcode:`LOAD_FROM_DICT_OR_GLOBALS` " "和 :opcode:`LOAD_LOCALS` 操作碼作為 :pep:`695` 實作的一部分。移除 :opcode:`!" -"LOAD_CLASSDEREF` 操作碼,可以用 :opcode:`LOAD_LOCALS` 加上 :opcode:" -"`LOAD_FROM_DICT_OR_DEREF` 來取代。(由 Jelle Zijlstra 於 :gh:`103764` 中貢" -"獻。)" +"LOAD_CLASSDEREF` 操作碼,可以用 :opcode:`LOAD_LOCALS` 加" +"上 :opcode:`LOAD_FROM_DICT_OR_DEREF` 來取代。(由 Jelle Zijlstra " +"於 :gh:`103764` 中貢獻。)" #: ../../whatsnew/3.12.rst:1123 msgid "" "Add the :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer " "and Vladimir Matveev in :gh:`103497`.)" msgstr "" -"新增 :opcode:`LOAD_SUPER_ATTR` 指令。(由 Carl Meyer 和 Vladimir Matveev 於 :" -"gh:`103497` 中貢獻。)" +"新增 :opcode:`LOAD_SUPER_ATTR` 指令。(由 Carl Meyer 和 Vladimir Matveev " +"於 :gh:`103497` 中貢獻。)" #: ../../whatsnew/3.12.rst:1126 msgid "" -"Add the :opcode:`RETURN_CONST` instruction. (Contributed by Wenyang Wang in :" -"gh:`101632`.)" +"Add the :opcode:`RETURN_CONST` instruction. (Contributed by Wenyang Wang " +"in :gh:`101632`.)" msgstr "" "新增 :opcode:`RETURN_CONST` 指令。(由 Wenyang Wang 於 :gh:`101632` 中貢" "獻。)" @@ -1834,8 +1848,8 @@ msgstr ":class:`!ast.Ellipsis`" #: ../../whatsnew/3.12.rst:1160 #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" -"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" -"`90953`.)" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka " +"in :gh:`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" @@ -1847,24 +1861,23 @@ msgstr ":mod:`asyncio`:" #: ../../whatsnew/3.12.rst:1165 msgid "" -"The child watcher classes :class:`asyncio.MultiLoopChildWatcher`, :class:" -"`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher` and :class:" -"`asyncio.SafeChildWatcher` are deprecated and will be removed in Python " -"3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +"The child watcher " +"classes :class:`asyncio.MultiLoopChildWatcher`, :class:`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher` " +"and :class:`asyncio.SafeChildWatcher` are deprecated and will be removed in " +"Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" #: ../../whatsnew/3.12.rst:1171 #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" -":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" -"`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." -"AbstractEventLoopPolicy.get_child_watcher` are deprecated and will be " -"removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " +"and :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated " +"and will be removed in Python 3.14. (Contributed by Kumar Aditya " +"in :gh:`94597`.)" msgstr "" -":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:" -"`asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`asyncio." -"AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" -"除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" +":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " +"和 :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 " +"Python 3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../whatsnew/3.12.rst:1177 #: ../../deprecations/pending-removal-in-3.14.rst:36 @@ -1882,8 +1895,9 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:41 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " -"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." -"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" +"are deprecated and replaced by :data:`calendar.JANUARY` " +"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " +"in :gh:`103636`.)" msgstr "" ":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " @@ -1893,24 +1907,27 @@ msgstr "" msgid "" ":mod:`collections.abc`: Deprecated :class:`collections.abc.ByteString`. " "Prefer :class:`Sequence` or :class:`collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." -"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" +"typing, prefer a union, like ``bytes | bytearray``, " +"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " +"in :gh:`91896`.)" msgstr "" #: ../../whatsnew/3.12.rst:1191 msgid "" -":mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime." -"utcnow` and :meth:`~datetime.datetime.utcfromtimestamp` are deprecated and " -"will be removed in a future version. Instead, use timezone-aware objects to " -"represent datetimes in UTC: respectively, call :meth:`~datetime.datetime." -"now` and :meth:`~datetime.datetime.fromtimestamp` with the *tz* parameter " -"set to :const:`datetime.UTC`. (Contributed by Paul Ganssle in :gh:`103857`.)" +":mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime.utcnow` " +"and :meth:`~datetime.datetime.utcfromtimestamp` are deprecated and will be " +"removed in a future version. Instead, use timezone-aware objects to " +"represent datetimes in UTC: respectively, " +"call :meth:`~datetime.datetime.now` " +"and :meth:`~datetime.datetime.fromtimestamp` with the *tz* parameter set " +"to :const:`datetime.UTC`. (Contributed by Paul Ganssle in :gh:`103857`.)" msgstr "" #: ../../whatsnew/3.12.rst:1199 msgid "" -":mod:`email`: Deprecate the *isdst* parameter in :func:`email.utils." -"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" +":mod:`email`: Deprecate the *isdst* parameter " +"in :func:`email.utils.localtime`. (Contributed by Alan Williams " +"in :gh:`72346`.)" msgstr "" ":mod:`email`:棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 中貢獻。)" @@ -1961,8 +1978,8 @@ msgid "" ":mod:`itertools`: Deprecate the support for copy, deepcopy, and pickle " "operations, which is undocumented, inefficient, historically buggy, and " "inconsistent. This will be removed in 3.14 for a significant reduction in " -"code volume and maintenance burden. (Contributed by Raymond Hettinger in :gh:" -"`101588`.)" +"code volume and maintenance burden. (Contributed by Raymond Hettinger " +"in :gh:`101588`.)" msgstr "" #: ../../whatsnew/3.12.rst:1222 @@ -1971,17 +1988,19 @@ msgid "" "start method will change to a safer one on Linux, BSDs, and other non-macOS " "POSIX platforms where ``'fork'`` is currently the default (:gh:`84559`). " "Adding a runtime warning about this was deemed too disruptive as the " -"majority of code is not expected to care. Use the :func:`~multiprocessing." -"get_context` or :func:`~multiprocessing.set_start_method` APIs to explicitly " -"specify when your code *requires* ``'fork'``. See :ref:`contexts and start " -"methods <multiprocessing-start-methods>`." +"majority of code is not expected to care. Use " +"the :func:`~multiprocessing.get_context` " +"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " +"your code *requires* ``'fork'``. See :ref:`contexts and start methods " +"<multiprocessing-start-methods>`." msgstr "" #: ../../whatsnew/3.12.rst:1232 msgid "" ":mod:`pkgutil`: :func:`pkgutil.find_loader` and :func:`pkgutil.get_loader` " -"are deprecated and will be removed in Python 3.14; use :func:`importlib.util." -"find_spec` instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" +"are deprecated and will be removed in Python 3.14; " +"use :func:`importlib.util.find_spec` instead. (Contributed by Nikita Sobolev " +"in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`pkgutil.find_loader` 和 :func:`pkgutil.get_loader` 已" "被棄用並將在 Python 3.14 中移除;請改用 :func:`importlib.util.find_spec`。" @@ -2010,30 +2029,31 @@ msgstr "" #: ../../whatsnew/3.12.rst:1250 msgid "" -"On POSIX platforms, :func:`os.fork` can now raise a :exc:" -"`DeprecationWarning` when it can detect being called from a multithreaded " -"process. There has always been a fundamental incompatibility with the POSIX " -"platform when doing so. Even if such code *appeared* to work. We added the " -"warning to raise awareness as issues encountered by code doing this are " -"becoming more frequent. See the :func:`os.fork` documentation for more " -"details along with `this discussion on fork being incompatible with threads " -"<https://discuss.python.org/t/concerns-regarding-deprecation-of-fork-with-" -"alive-threads/33555>`_ for *why* we're now surfacing this longstanding " +"On POSIX platforms, :func:`os.fork` can now raise " +"a :exc:`DeprecationWarning` when it can detect being called from a " +"multithreaded process. There has always been a fundamental incompatibility " +"with the POSIX platform when doing so. Even if such code *appeared* to work. " +"We added the warning to raise awareness as issues encountered by code doing " +"this are becoming more frequent. See the :func:`os.fork` documentation for " +"more details along with `this discussion on fork being incompatible with " +"threads <https://discuss.python.org/t/concerns-regarding-deprecation-of-fork-" +"with-alive-threads/33555>`_ for *why* we're now surfacing this longstanding " "platform compatibility problem to developers." msgstr "" #: ../../whatsnew/3.12.rst:1260 msgid "" -"When this warning appears due to usage of :mod:`multiprocessing` or :mod:" -"`concurrent.futures` the fix is to use a different :mod:`multiprocessing` " -"start method such as ``\"spawn\"`` or ``\"forkserver\"``." +"When this warning appears due to usage of :mod:`multiprocessing` " +"or :mod:`concurrent.futures` the fix is to use a " +"different :mod:`multiprocessing` start method such as ``\"spawn\"`` or " +"``\"forkserver\"``." msgstr "" #: ../../whatsnew/3.12.rst:1264 msgid "" ":mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree` is " -"deprecated; use *onexc* instead. (Contributed by Irit Katriel in :gh:" -"`102828`.)" +"deprecated; use *onexc* instead. (Contributed by Irit Katriel " +"in :gh:`102828`.)" msgstr "" ":mod:`shutil`::func:`shutil.rmtree` 的 *onerror* 引數已被棄用,請改用 " "*onexc*。(由 Irit Katriel 於 :gh:`102828` 中貢獻。)" @@ -2062,13 +2082,14 @@ msgstr "" #: ../../whatsnew/3.12.rst:1282 msgid "" -":mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` and :data:`sys." -"last_traceback` fields are deprecated. Use :data:`sys.last_exc` instead. " -"(Contributed by Irit Katriel in :gh:`102778`.)" +":mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` " +"and :data:`sys.last_traceback` fields are deprecated. " +"Use :data:`sys.last_exc` instead. (Contributed by Irit Katriel " +"in :gh:`102778`.)" msgstr "" -":mod:`sys`::data:`sys.last_type`、:data:`sys.last_value` 和 :data:`sys." -"last_traceback` 欄位已被棄用。請改用 :data:`sys.last_exc`。(由 Irit Katriel " -"於 :gh:`102778` 中貢獻。)" +":mod:`sys`::data:`sys.last_type`、:data:`sys.last_value` " +"和 :data:`sys.last_traceback` 欄位已被棄用。請改用 :data:`sys.last_exc`。" +"(由 Irit Katriel 於 :gh:`102778` 中貢獻。)" #: ../../whatsnew/3.12.rst:1286 msgid "" @@ -2084,16 +2105,16 @@ msgstr ":mod:`typing`:" #: ../../whatsnew/3.12.rst:1292 msgid "" -":class:`typing.Hashable` and :class:`typing.Sized`, aliases for :class:" -"`collections.abc.Hashable` and :class:`collections.abc.Sized` respectively, " -"are deprecated. (:gh:`94309`.)" +":class:`typing.Hashable` and :class:`typing.Sized`, aliases " +"for :class:`collections.abc.Hashable` and :class:`collections.abc.Sized` " +"respectively, are deprecated. (:gh:`94309`.)" msgstr "" #: ../../whatsnew/3.12.rst:1296 msgid "" -":class:`typing.ByteString`, deprecated since Python 3.9, now causes a :exc:" -"`DeprecationWarning` to be emitted when it is used. (Contributed by Alex " -"Waygood in :gh:`91896`.)" +":class:`typing.ByteString`, deprecated since Python 3.9, now causes " +"a :exc:`DeprecationWarning` to be emitted when it is used. (Contributed by " +"Alex Waygood in :gh:`91896`.)" msgstr "" #: ../../whatsnew/3.12.rst:1300 @@ -2107,26 +2128,26 @@ msgstr "" #: ../../whatsnew/3.12.rst:1306 msgid "" "The 3-arg signatures (type, value, traceback) of :meth:`coroutine throw() " -"<coroutine.throw>`, :meth:`generator throw() <generator.throw>` and :meth:" -"`async generator throw() <agen.athrow>` are deprecated and may be removed in " -"a future version of Python. Use the single-arg versions of these functions " -"instead. (Contributed by Ofey Chan in :gh:`89874`.)" +"<coroutine.throw>`, :meth:`generator throw() <generator.throw>` " +"and :meth:`async generator throw() <agen.athrow>` are deprecated and may be " +"removed in a future version of Python. Use the single-arg versions of these " +"functions instead. (Contributed by Ofey Chan in :gh:`89874`.)" msgstr "" #: ../../whatsnew/3.12.rst:1312 msgid "" ":exc:`DeprecationWarning` is now raised when :attr:`~module.__package__` on " -"a module differs from :attr:`__spec__.parent <importlib.machinery.ModuleSpec." -"parent>` (previously it was :exc:`ImportWarning`). (Contributed by Brett " -"Cannon in :gh:`65961`.)" +"a module differs from :attr:`__spec__.parent " +"<importlib.machinery.ModuleSpec.parent>` (previously it " +"was :exc:`ImportWarning`). (Contributed by Brett Cannon in :gh:`65961`.)" msgstr "" #: ../../whatsnew/3.12.rst:1318 msgid "" "Setting :attr:`~module.__package__` or :attr:`~module.__cached__` on a " "module is deprecated, and will cease to be set or taken into consideration " -"by the import system in Python 3.14. (Contributed by Brett Cannon in :gh:" -"`65961`.)" +"by the import system in Python 3.14. (Contributed by Brett Cannon " +"in :gh:`65961`.)" msgstr "" #: ../../whatsnew/3.12.rst:1322 @@ -2141,13 +2162,13 @@ msgstr "" #: ../../whatsnew/3.12.rst:1328 msgid "" "Accessing :attr:`~codeobject.co_lnotab` on code objects was deprecated in " -"Python 3.10 via :pep:`626`, but it only got a proper :exc:" -"`DeprecationWarning` in 3.12. May be removed in 3.15. (Contributed by Nikita " -"Sobolev in :gh:`101866`.)" +"Python 3.10 via :pep:`626`, but it only got a " +"proper :exc:`DeprecationWarning` in 3.12. May be removed in 3.15. " +"(Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" -"自 3.10 起,於程式碼物件存取 :attr:`~codeobject.co_lnotab` 的功能已在 :pep:" -"`626` 中被棄用,但只在 3.12 中於適時發出 :exc:`DeprecationWarning`。可能在 " -"3.15 中移除。(由 Nikita Sobolev 於 :gh:`101866` 貢獻。)" +"自 3.10 起,於程式碼物件存取 :attr:`~codeobject.co_lnotab` 的功能已" +"在 :pep:`626` 中被棄用,但只在 3.12 中於適時發出 :exc:`DeprecationWarning`。" +"可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.13.rst:2 msgid "Pending Removal in Python 3.13" @@ -2339,32 +2360,35 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" -"The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" -"`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" -"class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " +"The child watcher " +"classes :class:`~asyncio.MultiLoopChildWatcher`, :class:`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` " +"and :class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " "Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`~asyncio." -"MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio." -"AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " -"Aditya 於 :gh:`94597` 貢獻。)" +"已棄用並將在 Python 3.14 中移除的 child watcher 類" +"別::class:`~asyncio.MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio.AbstractChildWatcher` " +"和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar Aditya 於 :gh:`94597` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." -"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" -msgstr "" -":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改用 :" -"class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用時,請" -"改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " -"Shantanu Jain 於 :gh:`91896` 貢獻。)" +"typing, prefer a union, like ``bytes | bytearray``, " +"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " +"in :gh:`91896`.)" +msgstr "" +":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改" +"用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" +"時,請改用聯集,如 ``bytes | bytearray``," +"或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" -":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." -"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" +":mod:`email`: Deprecated the *isdst* parameter " +"in :func:`email.utils.localtime`. (Contributed by Alan Williams " +"in :gh:`72346`.)" msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" @@ -2390,24 +2414,25 @@ msgid "" "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " "currently the default (:gh:`84559`). Adding a runtime warning about this was " "deemed too disruptive as the majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." -"set_start_method` APIs to explicitly specify when your code *requires* " -"``'fork'``. See :ref:`multiprocessing-start-methods`." +"the :func:`~multiprocessing.get_context` " +"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " +"your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`." msgstr "" ":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平" "台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。對此增加一" -"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用 :func:" -"`~multiprocessing.get_context` 或 :func:`~multiprocessing.set_start_method` " -"API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" -"`multiprocessing-start-methods`。" +"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使" +"用 :func:`~multiprocessing.get_context` " +"或 :func:`~multiprocessing.set_start_method` API 來明確指定你的程式碼何時\\ *" +"需要* ``'fork'``。請參閱 :ref:`multiprocessing-start-methods`。" #: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" -":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." -"PurePath.relative_to`: passing additional arguments is deprecated." +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` " +"and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments is " +"deprecated." msgstr "" -":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" -"`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" +":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` " +"和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" #: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" @@ -2416,8 +2441,9 @@ msgid "" "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`~pkgutil.find_loader` 和 :func:`~pkgutil.get_loader` " -"現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." -"find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" +"現在會引發 :exc:`DeprecationWarning`;請改" +"用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" @@ -2437,9 +2463,9 @@ msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" #: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" -":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" -"ref:`named placeholders <sqlite3-placeholders>` are used and *parameters* is " -"a sequence instead of a :class:`dict`." +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` " +"if :ref:`named placeholders <sqlite3-placeholders>` are used and " +"*parameters* is a sequence instead of a :class:`dict`." msgstr "" ":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如果" "使用 :ref:`named placeholders <sqlite3-placeholders>` 且 *parameters* 是序列" @@ -2456,8 +2482,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " -"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" -"`88168`.)" +"intended to be a public API. (Contributed by Gregory P. Smith " +"in :gh:`88168`.)" msgstr "" ":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 API。" "(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" @@ -2474,10 +2500,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" -"`__spec__.cached <importlib.machinery.ModuleSpec.cached>` is deprecated. In " -"Python 3.15, :attr:`!__cached__` will cease to be set or take into " -"consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to " +"set :attr:`__spec__.cached <importlib.machinery.ModuleSpec.cached>` is " +"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " +"into consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "<importlib.machinery.ModuleSpec.cached>` 的做法已被棄用。在 Python 3.15 中," @@ -2485,10 +2511,11 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to set :attr:" -"`__spec__.parent <importlib.machinery.ModuleSpec.parent>` is deprecated. In " -"Python 3.15, :attr:`!__package__` will cease to be set or take into " -"consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to " +"set :attr:`__spec__.parent <importlib.machinery.ModuleSpec.parent>` is " +"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " +"take into consideration by the import system or standard library. " +"(:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "<importlib.machinery.ModuleSpec.parent>` 的做法已被棄用。在 Python 3.15 中," @@ -2534,15 +2561,17 @@ msgstr ":class:`locale`:" #: ../../deprecations/pending-removal-in-3.15.rst:34 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" -"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." -"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " -"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 " +"(:gh:`90817`), but has been postponed to Python 3.15. " +"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " +"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " +"in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" -"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." -"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" +"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " +"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:42 msgid ":mod:`pathlib`:" @@ -2550,11 +2579,11 @@ msgstr ":mod:`pathlib`:" #: ../../deprecations/pending-removal-in-3.15.rst:44 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" -"func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " +"Use :func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." -"isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" +"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:48 msgid ":mod:`platform`:" @@ -2596,16 +2625,16 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" -"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" -"`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" +"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " +"於 :gh:`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" -"The undocumented keyword argument syntax for creating :class:`~typing." -"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " -"has been deprecated since Python 3.13. Use the class-based syntax or the " -"functional syntax instead." +"The undocumented keyword argument syntax for " +"creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " +"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " +"3.13. Use the class-based syntax or the functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" @@ -2627,13 +2656,14 @@ msgstr ":mod:`wave`:" #: ../../deprecations/pending-removal-in-3.15.rst:86 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." -"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" -"`~wave.Wave_write` classes have been deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " +"and :meth:`~wave.Wave_read.getmarkers` methods of " +"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " +"deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" -"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." -"getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" +"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " +"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending removal in Python 3.16" @@ -2641,10 +2671,10 @@ msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" -"`__spec__.loader <importlib.machinery.ModuleSpec.loader>` is deprecated. In " -"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " -"consideration by the import system or the standard library." +"Setting :attr:`~module.__loader__` on a module while failing to " +"set :attr:`__spec__.loader <importlib.machinery.ModuleSpec.loader>` is " +"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " +"taken into consideration by the import system or the standard library." msgstr "" "在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " "<importlib.machinery.ModuleSpec.loader>` 的做法將於 Python 3.16 被棄用。在 " @@ -2671,8 +2701,8 @@ msgid "" "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" ":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" -"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" -"gh:`122875` 貢獻。)" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " +"於 :gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 #: ../../deprecations/pending-removal-in-future.rst:12 @@ -2782,17 +2812,17 @@ msgid "" "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " -"if the numeric literal is immediately followed by one of keywords :keyword:" -"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" -"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " -"syntax error. (:gh:`87999`)" +"if the numeric literal is immediately followed by one of " +"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " +"and :keyword:`or`. In a future release it will be changed to a syntax " +"error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " "1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " -"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" -"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" -"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" -"本中,它將被更改為語法錯誤。(:gh:`87999`)" +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" +"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " +"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" +"法錯誤。(:gh:`87999`)" #: ../../deprecations/pending-removal-in-future.rst:26 msgid "" @@ -2805,18 +2835,18 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:29 msgid "" -"Support for ``__float__()`` method returning a strict subclass of :class:" -"`float`: these methods will be required to return an instance of :class:" -"`float`." +"Support for ``__float__()`` method returning a strict subclass " +"of :class:`float`: these methods will be required to return an instance " +"of :class:`float`." msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" #: ../../deprecations/pending-removal-in-future.rst:32 msgid "" -"Support for ``__complex__()`` method returning a strict subclass of :class:" -"`complex`: these methods will be required to return an instance of :class:" -"`complex`." +"Support for ``__complex__()`` method returning a strict subclass " +"of :class:`complex`: these methods will be required to return an instance " +"of :class:`complex`." msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" @@ -2827,10 +2857,10 @@ msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" #: ../../deprecations/pending-removal-in-future.rst:36 msgid "" -"Passing a complex number as the *real* or *imag* argument in the :func:" -"`complex` constructor is now deprecated; it should only be passed as a " -"single positional argument. (Contributed by Serhiy Storchaka in :gh:" -"`109218`.)" +"Passing a complex number as the *real* or *imag* argument in " +"the :func:`complex` constructor is now deprecated; it should only be passed " +"as a single positional argument. (Contributed by Serhiy Storchaka " +"in :gh:`109218`.)" msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" @@ -2848,19 +2878,19 @@ msgstr ":mod:`datetime`:" #: ../../deprecations/pending-removal-in-future.rst:51 msgid "" -":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." -"UTC)``." +":meth:`~datetime.datetime.utcnow`: use " +"``datetime.datetime.now(tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." -"now(tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcnow`:請改用 " +"``datetime.datetime.now(tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:53 msgid "" -":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." -"fromtimestamp(timestamp, tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcfromtimestamp`: use " +"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." -"fromtimestamp(timestamp, tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " +"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:56 msgid ":mod:`gettext`: Plural value must be an integer." @@ -2899,8 +2929,8 @@ msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" -":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" -"`~logging.warning`。" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" +"用 :meth:`~logging.warning`。" #: ../../deprecations/pending-removal-in-future.rst:72 msgid "" @@ -2957,11 +2987,11 @@ msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:95 msgid "" -":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" -"`!selected_npn_protocol` are deprecated: use ALPN instead." +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " +"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" -":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" -"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " +"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" #: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.OP_NO_SSL*`` options" @@ -3016,11 +3046,11 @@ msgstr ":mod:`threading` 方法:" #: ../../deprecations/pending-removal-in-future.rst:114 msgid "" -":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." -"notify_all`." +":meth:`!threading.Condition.notifyAll`: " +"use :meth:`~threading.Condition.notify_all`." msgstr "" -":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." -"notify_all`。" +":meth:`!threading.Condition.notifyAll`:請" +"用 :meth:`~threading.Condition.notify_all`。" #: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." @@ -3028,19 +3058,19 @@ msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set` #: ../../deprecations/pending-removal-in-future.rst:116 msgid "" -":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" -"attr:`threading.Thread.daemon` attribute." +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " +"use :attr:`threading.Thread.daemon` attribute." msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:118 msgid "" -":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" -"attr:`threading.Thread.name` attribute." +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " +"use :attr:`threading.Thread.name` attribute." msgstr "" -":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" -"attr:`threading.Thread.name` 屬性。" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" +"用 :attr:`threading.Thread.name` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:120 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." @@ -3116,13 +3146,13 @@ msgstr "``to_bytes()``" #: ../../deprecations/pending-removal-in-future.rst:142 msgid "" -":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" -"`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " -"Use newer :func:`~urllib.request.urlopen` functions and methods." +":mod:`urllib.request`: :class:`~urllib.request.URLopener` " +"and :class:`~urllib.request.FancyURLopener` style of invoking requests is " +"deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods." msgstr "" -":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` 和 :" -"class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" -"`~urllib.request.urlopen` 函式和方法。" +":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` " +"和 :class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新" +"的 :func:`~urllib.request.urlopen` 函式和方法。" #: ../../deprecations/pending-removal-in-future.rst:146 msgid "" @@ -3132,22 +3162,22 @@ msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分 #: ../../deprecations/pending-removal-in-future.rst:149 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." -"etree.ElementTree.Element` is deprecated. In a future release it will always " -"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " -"instead." +":mod:`xml.etree.ElementTree`: Testing the truth value of " +"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " +"release it will always return ``True``. Prefer explicit ``len(elem)`` or " +"``elem is not None`` tests instead." msgstr "" -":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." -"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " -"``len(elem)`` 或 ``elem is not None`` 測試。" +":mod:`xml.etree.ElementTree`:已棄用" +"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" +"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" #: ../../deprecations/pending-removal-in-future.rst:154 msgid "" -":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" -"`~zipimport.zipimporter.exec_module` instead." +":meth:`zipimport.zipimporter.load_module` is deprecated: " +"use :meth:`~zipimport.zipimporter.exec_module` instead." msgstr "" -":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." -"zipimporter.exec_module`。" +":meth:`zipimport.zipimporter.load_module` 已被棄用:請改" +"用 :meth:`~zipimport.zipimporter.exec_module`。" #: ../../whatsnew/3.12.rst:1347 ../../whatsnew/3.12.rst:2229 msgid "Removed" @@ -3188,16 +3218,16 @@ msgid "" ":mod:`configparser` no longer has a ``SafeConfigParser`` class. Use the " "shorter :class:`~configparser.ConfigParser` name instead." msgstr "" -":mod:`configparser` 不再具有 ``SafeConfigParser`` 類別。請改用較短的 :class:" -"`~configparser.ConfigParser` 名稱。" +":mod:`configparser` 不再具有 ``SafeConfigParser`` 類別。請改用較短" +"的 :class:`~configparser.ConfigParser` 名稱。" #: ../../whatsnew/3.12.rst:1368 msgid "" -":class:`configparser.ConfigParser` no longer has a ``readfp`` method. Use :" -"meth:`~configparser.ConfigParser.read_file` instead." +":class:`configparser.ConfigParser` no longer has a ``readfp`` method. " +"Use :meth:`~configparser.ConfigParser.read_file` instead." msgstr "" -":class:`configparser.ConfigParser` 不再具有 ``readfp`` 方法。請改用 :meth:" -"`~configparser.ConfigParser.read_file`。" +":class:`configparser.ConfigParser` 不再具有 ``readfp`` 方法。請改" +"用 :meth:`~configparser.ConfigParser.read_file`。" #: ../../whatsnew/3.12.rst:1374 msgid "distutils" @@ -3277,8 +3307,8 @@ msgid "" "Remove the ``filename`` attribute of :mod:`gzip`'s :class:`gzip.GzipFile`, " "deprecated since Python 2.6, use the :attr:`~gzip.GzipFile.name` attribute " "instead. In write mode, the ``filename`` attribute added ``'.gz'`` file " -"extension if it was not present. (Contributed by Victor Stinner in :gh:" -"`94196`.)" +"extension if it was not present. (Contributed by Victor Stinner " +"in :gh:`94196`.)" msgstr "" #: ../../whatsnew/3.12.rst:1427 @@ -3287,11 +3317,11 @@ msgstr "hashlib" #: ../../whatsnew/3.12.rst:1429 msgid "" -"Remove the pure Python implementation of :mod:`hashlib`'s :func:`hashlib." -"pbkdf2_hmac`, deprecated in Python 3.10. Python 3.10 and newer requires " -"OpenSSL 1.1.1 (:pep:`644`): this OpenSSL version provides a C implementation " -"of :func:`~hashlib.pbkdf2_hmac` which is faster. (Contributed by Victor " -"Stinner in :gh:`94199`.)" +"Remove the pure Python implementation " +"of :mod:`hashlib`'s :func:`hashlib.pbkdf2_hmac`, deprecated in Python 3.10. " +"Python 3.10 and newer requires OpenSSL 1.1.1 (:pep:`644`): this OpenSSL " +"version provides a C implementation of :func:`~hashlib.pbkdf2_hmac` which is " +"faster. (Contributed by Victor Stinner in :gh:`94199`.)" msgstr "" #: ../../whatsnew/3.12.rst:1436 ../../whatsnew/3.12.rst:1465 @@ -3337,8 +3367,8 @@ msgstr "imp" #: ../../whatsnew/3.12.rst:1459 msgid "" -"The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in :" -"gh:`98040`.)" +"The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw " +"in :gh:`98040`.)" msgstr ":mod:`!imp` 模組已被移除。(由 Barry Warsaw 在 :gh:`98040` 中貢獻。)" #: ../../whatsnew/3.12.rst:1462 @@ -3374,8 +3404,8 @@ msgid "``imp.get_magic()``" msgstr "``imp.get_magic()``" #: ../../whatsnew/3.12.rst:1470 -msgid ":attr:`importlib.util.MAGIC_NUMBER`" -msgstr ":attr:`importlib.util.MAGIC_NUMBER`" +msgid ":const:`importlib.util.MAGIC_NUMBER`" +msgstr ":const:`importlib.util.MAGIC_NUMBER`" #: ../../whatsnew/3.12.rst:1471 msgid "``imp.get_suffixes()``" @@ -3383,11 +3413,11 @@ msgstr "``imp.get_suffixes()``" #: ../../whatsnew/3.12.rst:1471 msgid "" -":attr:`importlib.machinery.SOURCE_SUFFIXES`, :attr:`importlib.machinery." -"EXTENSION_SUFFIXES`, and :attr:`importlib.machinery.BYTECODE_SUFFIXES`" +":const:`importlib.machinery.SOURCE_SUFFIXES`, :const:`importlib.machinery.EXTENSION_SUFFIXES`, " +"and :const:`importlib.machinery.BYTECODE_SUFFIXES`" msgstr "" -":attr:`importlib.machinery.SOURCE_SUFFIXES`、:attr:`importlib.machinery." -"EXTENSION_SUFFIXES` 和 :attr:`importlib.machinery.BYTECODE_SUFFIXES`" +":const:`importlib.machinery.SOURCE_SUFFIXES`、:const:`importlib.machinery.EXTENSION_SUFFIXES` " +"和 :const:`importlib.machinery.BYTECODE_SUFFIXES`" #: ../../whatsnew/3.12.rst:1472 msgid "``imp.get_tag()``" @@ -3518,10 +3548,10 @@ msgstr "io" #: ../../whatsnew/3.12.rst:1513 msgid "" "Remove :mod:`io`'s ``io.OpenWrapper`` and ``_pyio.OpenWrapper``, deprecated " -"in Python 3.10: just use :func:`open` instead. The :func:`open` (:func:`io." -"open`) function is a built-in function. Since Python 3.10, :func:`!_pyio." -"open` is also a static method. (Contributed by Victor Stinner in :gh:" -"`94169`.)" +"in Python 3.10: just use :func:`open` instead. The :func:`open` " +"(:func:`io.open`) function is a built-in function. Since Python " +"3.10, :func:`!_pyio.open` is also a static method. (Contributed by Victor " +"Stinner in :gh:`94169`.)" msgstr "" #: ../../whatsnew/3.12.rst:1520 @@ -3541,10 +3571,10 @@ msgstr "smtpd" #: ../../whatsnew/3.12.rst:1529 msgid "" -"The ``smtpd`` module has been removed according to the schedule in :pep:" -"`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use the :pypi:" -"`aiosmtpd` PyPI module or any other :mod:`asyncio`-based server instead. " -"(Contributed by Oleg Iarygin in :gh:`93243`.)" +"The ``smtpd`` module has been removed according to the schedule " +"in :pep:`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use " +"the :pypi:`aiosmtpd` PyPI module or any other :mod:`asyncio`-based server " +"instead. (Contributed by Oleg Iarygin in :gh:`93243`.)" msgstr "" #: ../../whatsnew/3.12.rst:1538 @@ -3569,9 +3599,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:1547 msgid "" -"The ``sqlite3.OptimizedUnicode`` text factory has been an alias for :class:" -"`str` since Python 3.3. Code that previously set the text factory to " -"``OptimizedUnicode`` can either use ``str`` explicitly, or rely on the " +"The ``sqlite3.OptimizedUnicode`` text factory has been an alias " +"for :class:`str` since Python 3.3. Code that previously set the text factory " +"to ``OptimizedUnicode`` can either use ``str`` explicitly, or rely on the " "default value which is also ``str``." msgstr "" @@ -3601,12 +3631,12 @@ msgstr "" #: ../../whatsnew/3.12.rst:1567 msgid "" "Remove the :func:`!ssl.wrap_socket` function, deprecated in Python 3.7: " -"instead, create a :class:`ssl.SSLContext` object and call its :class:`ssl." -"SSLContext.wrap_socket` method. Any package that still uses :func:`!ssl." -"wrap_socket` is broken and insecure. The function neither sends a SNI TLS " -"extension nor validates the server hostname. Code is subject to :cwe:`295` " -"(Improper Certificate Validation). (Contributed by Victor Stinner in :gh:" -"`94199`.)" +"instead, create a :class:`ssl.SSLContext` object and call " +"its :class:`ssl.SSLContext.wrap_socket` method. Any package that still " +"uses :func:`!ssl.wrap_socket` is broken and insecure. The function neither " +"sends a SNI TLS extension nor validates the server hostname. Code is subject " +"to :cwe:`295` (Improper Certificate Validation). (Contributed by Victor " +"Stinner in :gh:`94199`.)" msgstr "" #: ../../whatsnew/3.12.rst:1578 @@ -3761,9 +3791,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:1610 msgid "" -"Undocumented :meth:`TestLoader.loadTestsFromModule <unittest.TestLoader." -"loadTestsFromModule>` parameter *use_load_tests* (deprecated and ignored " -"since Python 3.5)." +"Undocumented :meth:`TestLoader.loadTestsFromModule " +"<unittest.TestLoader.loadTestsFromModule>` parameter *use_load_tests* " +"(deprecated and ignored since Python 3.5)." msgstr "" #: ../../whatsnew/3.12.rst:1614 @@ -3809,8 +3839,9 @@ msgstr "zipimport" #: ../../whatsnew/3.12.rst:1638 msgid "" "Remove :mod:`zipimport`'s ``find_loader()`` and ``find_module()`` methods, " -"deprecated in Python 3.10: use the ``find_spec()`` method instead. See :pep:" -"`451` for the rationale. (Contributed by Victor Stinner in :gh:`94379`.)" +"deprecated in Python 3.10: use the ``find_spec()`` method instead. " +"See :pep:`451` for the rationale. (Contributed by Victor Stinner " +"in :gh:`94379`.)" msgstr "" #: ../../whatsnew/3.12.rst:1644 @@ -3819,20 +3850,20 @@ msgstr "其他" #: ../../whatsnew/3.12.rst:1646 msgid "" -"Remove the ``suspicious`` rule from the documentation :file:`Makefile` and :" -"file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint <https://github." -"com/sphinx-contrib/sphinx-lint>`_. (Contributed by Julien Palard in :gh:" -"`98179`.)" +"Remove the ``suspicious`` rule from the documentation :file:`Makefile` " +"and :file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint <https://" +"github.com/sphinx-contrib/sphinx-lint>`_. (Contributed by Julien Palard " +"in :gh:`98179`.)" msgstr "" #: ../../whatsnew/3.12.rst:1651 msgid "" -"Remove the *keyfile* and *certfile* parameters from the :mod:`ftplib`, :mod:" -"`imaplib`, :mod:`poplib` and :mod:`smtplib` modules, and the *key_file*, " -"*cert_file* and *check_hostname* parameters from the :mod:`http.client` " -"module, all deprecated since Python 3.6. Use the *context* parameter " -"(*ssl_context* in :mod:`imaplib`) instead. (Contributed by Victor Stinner " -"in :gh:`94172`.)" +"Remove the *keyfile* and *certfile* parameters from " +"the :mod:`ftplib`, :mod:`imaplib`, :mod:`poplib` and :mod:`smtplib` modules, " +"and the *key_file*, *cert_file* and *check_hostname* parameters from " +"the :mod:`http.client` module, all deprecated since Python 3.6. Use the " +"*context* parameter (*ssl_context* in :mod:`imaplib`) instead. (Contributed " +"by Victor Stinner in :gh:`94172`.)" msgstr "" #: ../../whatsnew/3.12.rst:1659 @@ -3845,8 +3876,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1662 msgid "" -"Remove ``_use_broken_old_ctypes_structure_semantics_`` flag from :mod:" -"`ctypes` module. (Contributed by Nikita Sobolev in :gh:`99285`.)" +"Remove ``_use_broken_old_ctypes_structure_semantics_`` flag " +"from :mod:`ctypes` module. (Contributed by Nikita Sobolev in :gh:`99285`.)" msgstr "" "移除 :mod:`ctypes` 模組中的 ``_use_broken_old_ctypes_structure_semantics_`` " "旗標。(由 Nikita Sobolev 於 :gh:`99285` 中貢獻。)" @@ -3882,8 +3913,8 @@ msgid "" "integer values such as ``randrange(10.5)`` or ``randrange('10')`` has been " "changed from :exc:`ValueError` to :exc:`TypeError`. This also prevents bugs " "where ``randrange(1e25)`` would silently select from a larger range than " -"``randrange(10**25)``. (Originally suggested by Serhiy Storchaka :gh:" -"`86388`.)" +"``randrange(10**25)``. (Originally suggested by Serhiy " +"Storchaka :gh:`86388`.)" msgstr "" #: ../../whatsnew/3.12.rst:1693 @@ -3899,8 +3930,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1699 msgid "" "Remove the ``asyncore``-based ``smtpd`` module deprecated in Python 3.4.7 " -"and 3.5.4. A recommended replacement is the :mod:`asyncio`-based :pypi:" -"`aiosmtpd` PyPI module." +"and 3.5.4. A recommended replacement is the :mod:`asyncio`-" +"based :pypi:`aiosmtpd` PyPI module." msgstr "" #: ../../whatsnew/3.12.rst:1703 @@ -3912,10 +3943,10 @@ msgstr "" #: ../../whatsnew/3.12.rst:1708 msgid "" -"The :mod:`os` module no longer accepts bytes-like paths, like :class:" -"`bytearray` and :class:`memoryview` types: only the exact :class:`bytes` " -"type is accepted for bytes strings. (Contributed by Victor Stinner in :gh:" -"`98393`.)" +"The :mod:`os` module no longer accepts bytes-like paths, " +"like :class:`bytearray` and :class:`memoryview` types: only the " +"exact :class:`bytes` type is accepted for bytes strings. (Contributed by " +"Victor Stinner in :gh:`98393`.)" msgstr "" #: ../../whatsnew/3.12.rst:1713 @@ -3944,21 +3975,23 @@ msgstr "" #: ../../whatsnew/3.12.rst:1735 msgid "" -"When extracting tar files using :mod:`tarfile` or :func:`shutil." -"unpack_archive`, pass the *filter* argument to limit features that may be " -"surprising or dangerous. See :ref:`tarfile-extraction-filter` for details." +"When extracting tar files using :mod:`tarfile` " +"or :func:`shutil.unpack_archive`, pass the *filter* argument to limit " +"features that may be surprising or dangerous. See :ref:`tarfile-extraction-" +"filter` for details." msgstr "" #: ../../whatsnew/3.12.rst:1740 msgid "" -"The output of the :func:`tokenize.tokenize` and :func:`tokenize." -"generate_tokens` functions is now changed due to the changes introduced in :" -"pep:`701`. This means that ``STRING`` tokens are not emitted any more for f-" -"strings and the tokens described in :pep:`701` are now produced instead: " -"``FSTRING_START``, ``FSTRING_MIDDLE`` and ``FSTRING_END`` are now emitted " -"for f-string \"string\" parts in addition to the appropriate tokens for the " -"tokenization in the expression components. For example for the f-string " -"``f\"start {1+1} end\"`` the old version of the tokenizer emitted::" +"The output of the :func:`tokenize.tokenize` " +"and :func:`tokenize.generate_tokens` functions is now changed due to the " +"changes introduced in :pep:`701`. This means that ``STRING`` tokens are not " +"emitted any more for f-strings and the tokens described in :pep:`701` are " +"now produced instead: ``FSTRING_START``, ``FSTRING_MIDDLE`` and " +"``FSTRING_END`` are now emitted for f-string \"string\" parts in addition to " +"the appropriate tokens for the tokenization in the expression components. " +"For example for the f-string ``f\"start {1+1} end\"`` the old version of the " +"tokenizer emitted::" msgstr "" #: ../../whatsnew/3.12.rst:1749 @@ -4063,11 +4096,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:1805 msgid "" -"Add ``COMPILEALL_OPTS`` variable in :file:`Makefile` to override :mod:" -"`compileall` options (default: ``-j0``) in ``make install``. Also merged the " -"3 ``compileall`` commands into a single command to build .pyc files for all " -"optimization levels (0, 1, 2) at once. (Contributed by Victor Stinner in :gh:" -"`99289`.)" +"Add ``COMPILEALL_OPTS`` variable in :file:`Makefile` to " +"override :mod:`compileall` options (default: ``-j0``) in ``make install``. " +"Also merged the 3 ``compileall`` commands into a single command to " +"build .pyc files for all optimization levels (0, 1, 2) at once. (Contributed " +"by Victor Stinner in :gh:`99289`.)" msgstr "" #: ../../whatsnew/3.12.rst:1811 @@ -4186,8 +4219,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:1865 msgid "" ":c:macro:`Py_TPFLAGS_ITEMS_AT_END` and :c:func:`PyObject_GetItemData` added " -"to allow safely extending certain variable-sized types, including :c:var:" -"`PyType_Type`." +"to allow safely extending certain variable-sized types, " +"including :c:var:`PyType_Type`." msgstr "" #: ../../whatsnew/3.12.rst:1868 @@ -4202,10 +4235,10 @@ msgstr "(由 Petr Viktorin 於 :gh:`103509` 中貢獻。)" #: ../../whatsnew/3.12.rst:1873 msgid "" -"Add the new :ref:`limited C API <limited-c-api>` function :c:func:" -"`PyType_FromMetaclass`, which generalizes the existing :c:func:" -"`PyType_FromModuleAndSpec` using an additional metaclass argument. " -"(Contributed by Wenzel Jakob in :gh:`93012`.)" +"Add the new :ref:`limited C API <limited-c-api>` " +"function :c:func:`PyType_FromMetaclass`, which generalizes the " +"existing :c:func:`PyType_FromModuleAndSpec` using an additional metaclass " +"argument. (Contributed by Wenzel Jakob in :gh:`93012`.)" msgstr "" #: ../../whatsnew/3.12.rst:1878 @@ -4237,16 +4270,16 @@ msgid "" "makes vectorcall safe to use with mutable types (i.e. heap types without the " "immutable flag, :c:macro:`Py_TPFLAGS_IMMUTABLETYPE`). Mutable types that do " "not override :c:member:`~PyTypeObject.tp_call` now inherit the " -"``Py_TPFLAGS_HAVE_VECTORCALL`` flag. (Contributed by Petr Viktorin in :gh:" -"`93274`.)" +"``Py_TPFLAGS_HAVE_VECTORCALL`` flag. (Contributed by Petr Viktorin " +"in :gh:`93274`.)" msgstr "" #: ../../whatsnew/3.12.rst:1895 msgid "" -"The :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" -"`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows extensions " -"classes to support object :attr:`~object.__dict__` and weakrefs with less " -"bookkeeping, using less memory and with faster access." +"The :c:macro:`Py_TPFLAGS_MANAGED_DICT` " +"and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows " +"extensions classes to support object :attr:`~object.__dict__` and weakrefs " +"with less bookkeeping, using less memory and with faster access." msgstr "" #: ../../whatsnew/3.12.rst:1900 @@ -4276,9 +4309,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:1912 msgid "" -"Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` and :c:" -"func:`PyEval_SetTraceAllThreads`, that allow to set tracing and profiling " -"functions in all running threads in addition to the calling one. " +"Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` " +"and :c:func:`PyEval_SetTraceAllThreads`, that allow to set tracing and " +"profiling functions in all running threads in addition to the calling one. " "(Contributed by Pablo Galindo in :gh:`93503`.)" msgstr "" @@ -4291,11 +4324,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:1922 msgid "" -"The C API now permits registering callbacks via :c:func:" -"`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to be called " -"whenever a dictionary is modified. This is intended for use by optimizing " -"interpreters, JIT compilers, or debuggers. (Contributed by Carl Meyer in :gh:" -"`91052`.)" +"The C API now permits registering callbacks " +"via :c:func:`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to " +"be called whenever a dictionary is modified. This is intended for use by " +"optimizing interpreters, JIT compilers, or debuggers. (Contributed by Carl " +"Meyer in :gh:`91052`.)" msgstr "" #: ../../whatsnew/3.12.rst:1928 @@ -4315,18 +4348,18 @@ msgstr "" #: ../../whatsnew/3.12.rst:1937 msgid "" "Add :c:func:`PyFrame_GetVar` and :c:func:`PyFrame_GetVarString` functions to " -"get a frame variable by its name. (Contributed by Victor Stinner in :gh:" -"`91248`.)" +"get a frame variable by its name. (Contributed by Victor Stinner " +"in :gh:`91248`.)" msgstr "" #: ../../whatsnew/3.12.rst:1941 msgid "" -"Add :c:func:`PyErr_GetRaisedException` and :c:func:" -"`PyErr_SetRaisedException` for saving and restoring the current exception. " -"These functions return and accept a single exception object, rather than the " -"triple arguments of the now-deprecated :c:func:`PyErr_Fetch` and :c:func:" -"`PyErr_Restore`. This is less error prone and a bit more efficient. " -"(Contributed by Mark Shannon in :gh:`101578`.)" +"Add :c:func:`PyErr_GetRaisedException` " +"and :c:func:`PyErr_SetRaisedException` for saving and restoring the current " +"exception. These functions return and accept a single exception object, " +"rather than the triple arguments of the now-deprecated :c:func:`PyErr_Fetch` " +"and :c:func:`PyErr_Restore`. This is less error prone and a bit more " +"efficient. (Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" #: ../../whatsnew/3.12.rst:1949 @@ -4339,9 +4372,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:1953 msgid "" "Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs` as " -"convenience functions for retrieving and modifying the :attr:`~BaseException." -"args` passed to the exception's constructor. (Contributed by Mark Shannon " -"in :gh:`101578`.)" +"convenience functions for retrieving and modifying " +"the :attr:`~BaseException.args` passed to the exception's constructor. " +"(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" #: ../../whatsnew/3.12.rst:1958 @@ -4410,17 +4443,18 @@ msgstr "(由 Eddie Elizondo 於 :gh:`84436` 中貢獻。)" #: ../../whatsnew/3.12.rst:1982 msgid "" -":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function and :" -"c:type:`PyInterpreterConfig`, which may be used to create sub-interpreters " -"with their own GILs. (See :ref:`whatsnew312-pep684` for more info.) " -"(Contributed by Eric Snow in :gh:`104110`.)" +":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function " +"and :c:type:`PyInterpreterConfig`, which may be used to create sub-" +"interpreters with their own GILs. (See :ref:`whatsnew312-pep684` for more " +"info.) (Contributed by Eric Snow in :gh:`104110`.)" msgstr "" #: ../../whatsnew/3.12.rst:1988 msgid "" -"In the limited C API version 3.12, :c:func:`Py_INCREF` and :c:func:" -"`Py_DECREF` functions are now implemented as opaque function calls to hide " -"implementation details. (Contributed by Victor Stinner in :gh:`105387`.)" +"In the limited C API version 3.12, :c:func:`Py_INCREF` " +"and :c:func:`Py_DECREF` functions are now implemented as opaque function " +"calls to hide implementation details. (Contributed by Victor Stinner " +"in :gh:`105387`.)" msgstr "" #: ../../whatsnew/3.12.rst:1996 @@ -4455,8 +4489,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:2015 msgid "" -"To get a list of subclasses, call the Python method :py:meth:`~type." -"__subclasses__` (using :c:func:`PyObject_CallMethod`, for example)." +"To get a list of subclasses, call the Python " +"method :py:meth:`~type.__subclasses__` (using :c:func:`PyObject_CallMethod`, " +"for example)." msgstr "" #: ../../whatsnew/3.12.rst:2019 @@ -4464,37 +4499,38 @@ msgid "" "Add support of more formatting options (left aligning, octals, uppercase " "hexadecimals, :c:type:`intmax_t`, :c:type:`ptrdiff_t`, :c:type:`wchar_t` C " "strings, variable width and precision) in :c:func:`PyUnicode_FromFormat` " -"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Serhiy Storchaka in :gh:" -"`98836`.)" +"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Serhiy Storchaka " +"in :gh:`98836`.)" msgstr "" #: ../../whatsnew/3.12.rst:2025 msgid "" -"An unrecognized format character in :c:func:`PyUnicode_FromFormat` and :c:" -"func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In previous " -"versions it caused all the rest of the format string to be copied as-is to " -"the result string, and any extra arguments discarded. (Contributed by Serhiy " -"Storchaka in :gh:`95781`.)" +"An unrecognized format character in :c:func:`PyUnicode_FromFormat` " +"and :c:func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In " +"previous versions it caused all the rest of the format string to be copied " +"as-is to the result string, and any extra arguments discarded. (Contributed " +"by Serhiy Storchaka in :gh:`95781`.)" msgstr "" #: ../../whatsnew/3.12.rst:2031 msgid "" -"Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` and :c:func:" -"`PyUnicode_FromFormatV`. (Contributed by Philip Georgi in :gh:`95504`.)" +"Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` " +"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Philip Georgi " +"in :gh:`95504`.)" msgstr "" #: ../../whatsnew/3.12.rst:2035 msgid "" "Extension classes wanting to add a :attr:`~object.__dict__` or weak " -"reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" -"`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and " +"reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` " +"and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and " "``tp_weaklistoffset``, respectively. The use of ``tp_dictoffset`` and " "``tp_weaklistoffset`` is still supported, but does not fully support " "multiple inheritance (:gh:`95589`), and performance may be worse. Classes " "declaring :c:macro:`Py_TPFLAGS_MANAGED_DICT` must call :c:func:`!" "_PyObject_VisitManagedDict` and :c:func:`!_PyObject_ClearManagedDict` to " -"traverse and clear their instance's dictionaries. To clear weakrefs, call :c:" -"func:`PyObject_ClearWeakRefs`, as before." +"traverse and clear their instance's dictionaries. To clear weakrefs, " +"call :c:func:`PyObject_ClearWeakRefs`, as before." msgstr "" #: ../../whatsnew/3.12.rst:2047 @@ -4515,10 +4551,10 @@ msgstr "" #: ../../whatsnew/3.12.rst:2057 msgid "" -"The interpreter's error indicator is now always normalized. This means that :" -"c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other functions " -"that set the error indicator now normalize the exception before storing it. " -"(Contributed by Mark Shannon in :gh:`101578`.)" +"The interpreter's error indicator is now always normalized. This means " +"that :c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other " +"functions that set the error indicator now normalize the exception before " +"storing it. (Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" #: ../../whatsnew/3.12.rst:2062 @@ -4558,8 +4594,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:2079 msgid "" "Note that :c:func:`PyType_FromMetaclass` (added in Python 3.12) already " -"disallows creating classes whose metaclass overrides ``tp_new`` (:meth:" -"`~object.__new__` in Python)." +"disallows creating classes whose metaclass overrides ``tp_new`` " +"(:meth:`~object.__new__` in Python)." msgstr "" #: ../../whatsnew/3.12.rst:2083 @@ -4577,16 +4613,16 @@ msgstr "" #: ../../whatsnew/3.12.rst:2092 msgid "" -"If initialization can be skipped, it can be done in :c:member:`~PyTypeObject." -"tp_init` instead." +"If initialization can be skipped, it can be done " +"in :c:member:`~PyTypeObject.tp_init` instead." msgstr "" #: ../../whatsnew/3.12.rst:2094 msgid "" "If the metaclass doesn't need to be instantiated from Python, set its " -"``tp_new`` to ``NULL`` using the :c:macro:" -"`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag. This makes it acceptable for " -"``PyType_From*`` functions." +"``tp_new`` to ``NULL`` using " +"the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag. This makes it " +"acceptable for ``PyType_From*`` functions." msgstr "" #: ../../whatsnew/3.12.rst:2099 @@ -4622,10 +4658,10 @@ msgid "" ":c:struct:`PyLongObject` has had its internals changed for better " "performance. Although the internals of :c:struct:`PyLongObject` are private, " "they are used by some extension modules. The internal fields should no " -"longer be accessed directly, instead the API functions beginning ``PyLong_..." -"`` should be used instead. Two new *unstable* API functions are provided for " -"efficient access to the value of :c:struct:`PyLongObject`\\s which fit into " -"a single machine word:" +"longer be accessed directly, instead the API functions beginning " +"``PyLong_...`` should be used instead. Two new *unstable* API functions are " +"provided for efficient access to the value of :c:struct:`PyLongObject`\\s " +"which fit into a single machine word:" msgstr "" #: ../../whatsnew/3.12.rst:2123 @@ -4647,11 +4683,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:2136 msgid "" -"In accordance with :pep:`699`, the ``ma_version_tag`` field in :c:type:" -"`PyDictObject` is deprecated for extension modules. Accessing this field " -"will generate a compiler warning at compile time. This field will be removed " -"in Python 3.14. (Contributed by Ramvikrams and Kumar Aditya in :gh:`101193`. " -"PEP by Ken Jin.)" +"In accordance with :pep:`699`, the ``ma_version_tag`` field " +"in :c:type:`PyDictObject` is deprecated for extension modules. Accessing " +"this field will generate a compiler warning at compile time. This field will " +"be removed in Python 3.14. (Contributed by Ramvikrams and Kumar Aditya " +"in :gh:`101193`. PEP by Ken Jin.)" msgstr "" #: ../../whatsnew/3.12.rst:2141 @@ -4701,8 +4737,8 @@ msgstr "" msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment`" msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`: 請改用 :c:member:`PyConfig." -"use_environment`" +":c:var:`Py_IgnoreEnvironmentFlag`: 請改" +"用 :c:member:`PyConfig.use_environment`" #: ../../whatsnew/3.12.rst:2153 msgid "" @@ -4714,8 +4750,8 @@ msgstr "" msgid "" ":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig.user_site_directory`" msgstr "" -":c:var:`Py_NoUserSiteDirectory`: 請改用 :c:member:`PyConfig." -"user_site_directory`" +":c:var:`Py_NoUserSiteDirectory`: 請改" +"用 :c:member:`PyConfig.user_site_directory`" #: ../../whatsnew/3.12.rst:2155 msgid "" @@ -4737,56 +4773,57 @@ msgstr ":c:var:`Py_IsolatedFlag`: 請改用 :c:member:`PyConfig.isolated`" #: ../../whatsnew/3.12.rst:2159 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." -"legacy_windows_fs_encoding`" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: " +"use :c:member:`PyPreConfig.legacy_windows_fs_encoding`" msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: 請改用 :c:member:`PyPreConfig." -"legacy_windows_fs_encoding`" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: 請改" +"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`" #: ../../whatsnew/3.12.rst:2160 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." -"legacy_windows_stdio`" +":c:var:`Py_LegacyWindowsStdioFlag`: " +"use :c:member:`PyConfig.legacy_windows_stdio`" msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`: 請改用 :c:member:`PyConfig." -"legacy_windows_stdio`" +":c:var:`Py_LegacyWindowsStdioFlag`: 請改" +"用 :c:member:`PyConfig.legacy_windows_stdio`" #: ../../whatsnew/3.12.rst:2161 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." -"filesystem_encoding`" +":c:var:`!Py_FileSystemDefaultEncoding`: " +"use :c:member:`PyConfig.filesystem_encoding`" msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." -"filesystem_encoding`" +":c:var:`!Py_FileSystemDefaultEncoding`: 請改" +"用 :c:member:`PyConfig.filesystem_encoding`" #: ../../whatsnew/3.12.rst:2162 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." -"filesystem_encoding`" +":c:var:`!Py_HasFileSystemDefaultEncoding`: " +"use :c:member:`PyConfig.filesystem_encoding`" msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." -"filesystem_encoding`" +":c:var:`!Py_HasFileSystemDefaultEncoding`: 請改" +"用 :c:member:`PyConfig.filesystem_encoding`" #: ../../whatsnew/3.12.rst:2163 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." -"filesystem_errors`" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: " +"use :c:member:`PyConfig.filesystem_errors`" msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: 請改用 :c:member:`PyConfig." -"filesystem_errors`" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: 請改" +"用 :c:member:`PyConfig.filesystem_errors`" #: ../../whatsnew/3.12.rst:2164 msgid "" -":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:" -"`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` " +"(see :c:func:`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`: 請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參見 :c:" -"func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: 請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參" +"見 :c:func:`Py_PreInitialize`)" #: ../../whatsnew/3.12.rst:2166 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" -"`PyConfig` instead. (Contributed by Victor Stinner in :gh:`77782`.)" +"The :c:func:`Py_InitializeFromConfig` API should be used " +"with :c:type:`PyConfig` instead. (Contributed by Victor Stinner " +"in :gh:`77782`.)" msgstr "" ":c:func:`Py_InitializeFromConfig` API 應改為與 :c:type:`PyConfig` 一起使用。" "(由 Victor Stinner 於 :gh:`77782` 中貢獻。)" @@ -4811,11 +4848,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:2179 msgid "" -":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` and :c:func:" -"`PyMember_SetOne`" +":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` " +"and :c:func:`PyMember_SetOne`" msgstr "" -":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` 和 :c:func:" -"`PyMember_SetOne`" +":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` " +"和 :c:func:`PyMember_SetOne`" #: ../../whatsnew/3.12.rst:2181 msgid "" @@ -4825,11 +4862,11 @@ msgstr "" #: ../../whatsnew/3.12.rst:2183 msgid "" -"The flags :c:macro:`Py_READONLY` (previously ``READONLY``) and :c:macro:" -"`Py_AUDIT_READ` (previously all uppercase)" +"The flags :c:macro:`Py_READONLY` (previously ``READONLY``) " +"and :c:macro:`Py_AUDIT_READ` (previously all uppercase)" msgstr "" -":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)和 :c:macro:" -"`Py_AUDIT_READ`\\ (先前全大寫)旗標" +":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)" +"和 :c:macro:`Py_AUDIT_READ`\\ (先前全大寫)旗標" #: ../../whatsnew/3.12.rst:2186 msgid "Several items are not exposed from :file:`Python.h`:" @@ -4849,16 +4886,17 @@ msgstr "不做任何事的巨集 ``WRITE_RESTRICTED``。" #: ../../whatsnew/3.12.rst:2191 msgid "" -"The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of :c:macro:" -"`Py_AUDIT_READ`." +"The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents " +"of :c:macro:`Py_AUDIT_READ`." msgstr "" -"``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當於 :c:macro:" -"`Py_AUDIT_READ`。" +"``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當" +"於 :c:macro:`Py_AUDIT_READ`。" #: ../../whatsnew/3.12.rst:2193 msgid "" -"In some configurations, ``<stddef.h>`` is not included from :file:`Python." -"h`. It should be included manually when using ``offsetof()``." +"In some configurations, ``<stddef.h>`` is not included " +"from :file:`Python.h`. It should be included manually when using " +"``offsetof()``." msgstr "" #: ../../whatsnew/3.12.rst:2196 @@ -4876,9 +4914,10 @@ msgstr "" #: ../../whatsnew/3.12.rst:2204 msgid "" -":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. Use :c:" -"func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException` " -"instead. (Contributed by Mark Shannon in :gh:`101578`.)" +":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. " +"Use :c:func:`PyErr_GetRaisedException` " +"and :c:func:`PyErr_SetRaisedException` instead. (Contributed by Mark Shannon " +"in :gh:`101578`.)" msgstr "" #: ../../whatsnew/3.12.rst:2209 @@ -4899,29 +4938,30 @@ msgstr "" #: ../../whatsnew/3.12.rst:2215 msgid "" -"Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` or :c:" -"func:`PyType_FromModuleAndSpec` to create a class whose metaclass overrides :" -"c:member:`~PyTypeObject.tp_new` is deprecated. Call the metaclass instead." +"Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` " +"or :c:func:`PyType_FromModuleAndSpec` to create a class whose metaclass " +"overrides :c:member:`~PyTypeObject.tp_new` is deprecated. Call the metaclass " +"instead." msgstr "" -"使用 :c:func:`PyType_FromSpec`、:c:func:`PyType_FromSpecWithBases` 或 :c:" -"func:`PyType_FromModuleAndSpec` 建立一個其元類別覆寫 :c:member:" -"`~PyTypeObject.tp_new` 的類別已被棄用。請改為呼叫元類別。" +"使用 :c:func:`PyType_FromSpec`、:c:func:`PyType_FromSpecWithBases` " +"或 :c:func:`PyType_FromModuleAndSpec` 建立一個其元類別覆" +"寫 :c:member:`~PyTypeObject.tp_new` 的類別已被棄用。請改為呼叫元類別。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 msgid "" "The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " "(:pep:`699`; :gh:`101193`)." msgstr "" -":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 (:pep:" -"`699`;:gh:`101193`)。" +":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 " +"(:pep:`699`;:gh:`101193`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 msgid "" "Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable " "bases (:gh:`95388`)." msgstr "" -"使用可變基底建立\\ :c:data:`不可變型別 <Py_TPFLAGS_IMMUTABLETYPE>` (:gh:" -"`95388`)。" +"使用可變基底建立\\ :c:data:`不可變型別 <Py_TPFLAGS_IMMUTABLETYPE>` " +"(:gh:`95388`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:10 msgid "" @@ -4951,8 +4991,8 @@ msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" -"`PyConfig` instead." +"The :c:func:`Py_InitializeFromConfig` API should be used " +"with :c:type:`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" @@ -5009,24 +5049,24 @@ msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "instead." msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." -"use_environment`。" +":c:var:`Py_IgnoreEnvironmentFlag`:請改" +"用 :c:member:`PyConfig.use_environment`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "instead." msgstr "" -":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." -"write_bytecode`。" +":c:var:`Py_DontWriteBytecodeFlag`:請改" +"用 :c:member:`PyConfig.write_bytecode`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 msgid "" -":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." -"user_site_directory` instead." +":c:var:`Py_NoUserSiteDirectory`: " +"Use :c:member:`PyConfig.user_site_directory` instead." msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." -"user_site_directory`。" +":c:var:`Py_NoUserSiteDirectory`:請改" +"用 :c:member:`PyConfig.user_site_directory`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 msgid "" @@ -5049,51 +5089,51 @@ msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." -"legacy_windows_fs_encoding` instead." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: " +"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` instead." msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." -"legacy_windows_fs_encoding`。" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" +"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." -"legacy_windows_stdio` instead." +":c:var:`Py_LegacyWindowsStdioFlag`: " +"Use :c:member:`PyConfig.legacy_windows_stdio` instead." msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." -"legacy_windows_stdio`。" +":c:var:`Py_LegacyWindowsStdioFlag`:請改" +"用 :c:member:`PyConfig.legacy_windows_stdio`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." -"filesystem_encoding` instead." +":c:var:`!Py_FileSystemDefaultEncoding`: " +"Use :c:member:`PyConfig.filesystem_encoding` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." -"filesystem_encoding`。" +":c:var:`!Py_FileSystemDefaultEncoding`:請改" +"用 :c:member:`PyConfig.filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." -"filesystem_encoding` instead." +":c:var:`!Py_HasFileSystemDefaultEncoding`: " +"Use :c:member:`PyConfig.filesystem_encoding` instead." msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." -"filesystem_encoding`。" +":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" +"用 :c:member:`PyConfig.filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." -"filesystem_errors` instead." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: " +"Use :c:member:`PyConfig.filesystem_errors` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." -"filesystem_errors`。" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" +"用 :c:member:`PyConfig.filesystem_errors`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" -"c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. " +"(see :c:func:`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" -"func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" +"見 :c:func:`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 msgid "The bundled copy of ``libmpdecimal``." @@ -5101,27 +5141,27 @@ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" -"`PyImport_ImportModule` instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: " +"Use :c:func:`PyImport_ImportModule` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" -"`PyImport_ImportModule`。" +":c:func:`PyImport_ImportModuleNoBlock`:請改" +"用 :c:func:`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 msgid "" -":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" -"func:`PyWeakref_GetRef` instead." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " +"Use :c:func:`PyWeakref_GetRef` instead." msgstr "" -":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" -"func:`PyWeakref_GetRef`。" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" +"用 :c:func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 msgid "" -":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" -"type:`wchar_t` instead." +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " +"Use :c:type:`wchar_t` instead." msgstr "" -":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" -"`wchar_t`。" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" +"用 :c:type:`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 msgid "Python initialization functions:" @@ -5132,16 +5172,16 @@ msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" -":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" -"data:`!warnings.filters`。" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " +"和 :data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 msgid "" -":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." -"exec_prefix` instead." +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` " +"and :data:`sys.exec_prefix` instead." msgstr "" -":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" -"`sys.exec_prefix`。" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` " +"與 :data:`sys.exec_prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." @@ -5152,8 +5192,8 @@ msgid "" ":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " "instead." msgstr "" -":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." -"prefix`。" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` " +"與 :data:`sys.prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." @@ -5165,11 +5205,11 @@ msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" -"`PYTHONHOME` environment variable instead." +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or " +"the :envvar:`PYTHONHOME` environment variable instead." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" -"`PYTHONHOME` 環境變數。" +":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " +"或 :envvar:`PYTHONHOME` 環境變數。" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" @@ -5190,8 +5230,8 @@ msgid "" ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" -":c:func:`PyErr_NormalizeException`:請改用 :c:func:" -"`PyErr_GetRaisedException`。" +":c:func:`PyErr_NormalizeException`:請改" +"用 :c:func:`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" @@ -5211,11 +5251,11 @@ msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" -"`PySlice_AdjustIndices` instead." +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " +"and :c:func:`PySlice_AdjustIndices` instead." msgstr "" -":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" -"`PySlice_AdjustIndices`。" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` " +"和 :c:func:`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid "" @@ -5261,8 +5301,8 @@ msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." msgstr "" -":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" -"`PyObject_Hash`。" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" +"叫 :c:func:`PyObject_Hash`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid ":c:member:`!PyDictObject.ma_version_tag` member." @@ -5354,5 +5394,5 @@ msgid "" "Remove the ``PyUnicode_InternImmortal()`` function macro. (Contributed by " "Victor Stinner in :gh:`85858`.)" msgstr "" -"移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner 於 :gh:" -"`85858` 中貢獻。)" +"移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner " +"於 :gh:`85858` 中貢獻。)" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index 8515c9a886..fe2d9f58d6 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-29 11:18+0000\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,8 +31,8 @@ msgstr "Adam Turner 和 Thomas Wouters" #: ../../whatsnew/3.13.rst:48 msgid "" "This article explains the new features in Python 3.13, compared to 3.12. " -"Python 3.13 was released on October 7, 2024. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.13 was released on October 7, 2024. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.13 與 3.12 相比多了哪些新功能。Python 3.13 已於 2024 年 " "10 月 7 日發布。完整詳情請見 :ref:`changelog <changelog>`。" @@ -51,9 +51,9 @@ msgid "" "with a mix of changes to the language, the implementation and the standard " "library. The biggest changes include a new `interactive interpreter " "<whatsnew313-better-interactive-interpreter_>`_, experimental support for " -"running in a `free-threaded mode <whatsnew313-free-threaded-cpython_>`_ (:" -"pep:`703`), and a `Just-In-Time compiler <whatsnew313-jit-compiler_>`_ (:pep:" -"`744`)." +"running in a `free-threaded mode <whatsnew313-free-threaded-cpython_>`_ " +"(:pep:`703`), and a `Just-In-Time compiler <whatsnew313-jit-compiler_>`_ " +"(:pep:`744`)." msgstr "" #: ../../whatsnew/3.13.rst:72 @@ -76,8 +76,8 @@ msgstr "" msgid "" "This article doesn't attempt to provide a complete specification of all new " "features, but instead gives a convenient overview. For full details refer to " -"the documentation, such as the :ref:`Library Reference <library-index>` and :" -"ref:`Language Reference <reference-index>`. To understand the complete " +"the documentation, such as the :ref:`Library Reference <library-index>` " +"and :ref:`Language Reference <reference-index>`. To understand the complete " "implementation and design rationale for a change, refer to the PEP for a " "particular new feature; but note that PEPs usually are not kept up-to-date " "once a feature has been fully implemented. See `Porting to Python 3.13`_ for " @@ -105,9 +105,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:108 msgid "" -":pep:`703`: CPython 3.13 has experimental support for running with the :term:" -"`global interpreter lock` disabled. See :ref:`Free-threaded CPython " -"<whatsnew313-free-threaded-cpython>` for more details." +":pep:`703`: CPython 3.13 has experimental support for running with " +"the :term:`global interpreter lock` disabled. See :ref:`Free-threaded " +"CPython <whatsnew313-free-threaded-cpython>` for more details." msgstr "" #: ../../whatsnew/3.13.rst:111 @@ -168,8 +168,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:137 msgid "" "The :mod:`copy` module now has a :func:`copy.replace` function, with support " -"for many builtin types and any class defining the :func:`~object." -"__replace__` method." +"for many builtin types and any class defining " +"the :func:`~object.__replace__` method." msgstr "" #: ../../whatsnew/3.13.rst:140 @@ -195,9 +195,9 @@ msgstr "安全性改進:" #: ../../whatsnew/3.13.rst:147 msgid "" -":func:`ssl.create_default_context` sets :data:`ssl." -"VERIFY_X509_PARTIAL_CHAIN` and :data:`ssl.VERIFY_X509_STRICT` as default " -"flags." +":func:`ssl.create_default_context` " +"sets :data:`ssl.VERIFY_X509_PARTIAL_CHAIN` " +"and :data:`ssl.VERIFY_X509_STRICT` as default flags." msgstr "" #: ../../whatsnew/3.13.rst:150 @@ -223,8 +223,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:157 msgid "" -"There is a new :ref:`suite of functions <c-api-monitoring>` for generating :" -"pep:`669` monitoring events in the C API." +"There is a new :ref:`suite of functions <c-api-monitoring>` for " +"generating :pep:`669` monitoring events in the C API." msgstr "" #: ../../whatsnew/3.13.rst:160 @@ -233,8 +233,9 @@ msgstr "新增型別特性:" #: ../../whatsnew/3.13.rst:162 msgid "" -":pep:`696`: Type parameters (:data:`typing.TypeVar`, :data:`typing." -"ParamSpec`, and :data:`typing.TypeVarTuple`) now support defaults." +":pep:`696`: Type parameters " +"(:data:`typing.TypeVar`, :data:`typing.ParamSpec`, " +"and :data:`typing.TypeVarTuple`) now support defaults." msgstr "" #: ../../whatsnew/3.13.rst:164 @@ -245,8 +246,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:166 msgid "" -":pep:`705`: :data:`typing.ReadOnly` can be used to mark an item of a :class:" -"`typing.TypedDict` as read-only for type checkers." +":pep:`705`: :data:`typing.ReadOnly` can be used to mark an item of " +"a :class:`typing.TypedDict` as read-only for type checkers." msgstr "" #: ../../whatsnew/3.13.rst:168 @@ -290,15 +291,15 @@ msgid "" "(legacy stdlib modules) have been removed from the standard library: :mod:`!" "aifc`, :mod:`!audioop`, :mod:`!cgi`, :mod:`!cgitb`, :mod:`!chunk`, :mod:`!" "crypt`, :mod:`!imghdr`, :mod:`!mailcap`, :mod:`!msilib`, :mod:`!nis`, :mod:`!" -"nntplib`, :mod:`!ossaudiodev`, :mod:`!pipes`, :mod:`!sndhdr`, :mod:`!spwd`, :" -"mod:`!sunau`, :mod:`!telnetlib`, :mod:`!uu` and :mod:`!xdrlib`." +"nntplib`, :mod:`!ossaudiodev`, :mod:`!pipes`, :mod:`!sndhdr`, :mod:`!" +"spwd`, :mod:`!sunau`, :mod:`!telnetlib`, :mod:`!uu` and :mod:`!xdrlib`." msgstr "" ":ref:`PEP 594 <whatsnew313-pep594>`: 剩下的 19 個 \"dead batteries\" (遺留標" "準函式庫模組)已自標準函式庫中移除::mod:`!aifc`、:mod:`!audioop`、:mod:`!" "cgi`、:mod:`!cgitb`、:mod:`!chunk`、:mod:`!crypt`、:mod:`!imghdr`、:mod:`!" "mailcap`、:mod:`!msilib`、:mod:`!nis`、:mod:`!nntplib`、:mod:`!" -"ossaudiodev`、:mod:`!pipes`、:mod:`!sndhdr`、:mod:`!spwd`、:mod:`!sunau`、:" -"mod:`!telnetlib`、:mod:`!uu` 和 :mod:`!xdrlib`." +"ossaudiodev`、:mod:`!pipes`、:mod:`!sndhdr`、:mod:`!spwd`、:mod:`!" +"sunau`、:mod:`!telnetlib`、:mod:`!uu` 和 :mod:`!xdrlib`." #: ../../whatsnew/3.13.rst:188 msgid "" @@ -345,7 +346,7 @@ msgid "" "years of security fixes." msgstr "" -#: ../../whatsnew/3.13.rst:208 ../../whatsnew/3.13.rst:1985 +#: ../../whatsnew/3.13.rst:208 ../../whatsnew/3.13.rst:2037 msgid "New Features" msgstr "新增功能" @@ -383,8 +384,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:228 msgid "" -"History browsing using :kbd:`F2` that skips output as well as the :term:" -"`>>>` and :term:`...` prompts." +"History browsing using :kbd:`F2` that skips output as well as " +"the :term:`>>>` and :term:`...` prompts." msgstr "" #: ../../whatsnew/3.13.rst:230 @@ -548,7 +549,7 @@ msgstr "" #: ../../whatsnew/3.13.rst:336 msgid "" "To check if the current interpreter supports free-threading, :option:`python " -"-VV <-V>` and :attr:`sys.version` contain \"experimental free-threading " +"-VV <-V>` and :data:`sys.version` contain \"experimental free-threading " "build\". The new :func:`!sys._is_gil_enabled` function can be used to check " "whether the GIL is actually disabled in the running process." msgstr "" @@ -699,35 +700,35 @@ msgstr "" #: ../../whatsnew/3.13.rst:432 msgid "" -"Historically, the expected result of mutating the return value of :func:" -"`locals` has been left to individual Python implementations to define. " -"Starting from Python 3.13, :pep:`667` standardises the historical behavior " -"of CPython for most code execution scopes, but changes :term:`optimized " -"scopes <optimized scope>` (functions, generators, coroutines, " -"comprehensions, and generator expressions) to explicitly return independent " -"snapshots of the currently assigned local variables, including locally " -"referenced nonlocal variables captured in closures." +"Historically, the expected result of mutating the return value " +"of :func:`locals` has been left to individual Python implementations to " +"define. Starting from Python 3.13, :pep:`667` standardises the historical " +"behavior of CPython for most code execution scopes, but " +"changes :term:`optimized scopes <optimized scope>` (functions, generators, " +"coroutines, comprehensions, and generator expressions) to explicitly return " +"independent snapshots of the currently assigned local variables, including " +"locally referenced nonlocal variables captured in closures." msgstr "" #: ../../whatsnew/3.13.rst:441 msgid "" "This change to the semantics of :func:`locals` in optimized scopes also " "affects the default behavior of code execution functions that implicitly " -"target :func:`!locals` if no explicit namespace is provided (such as :func:" -"`exec` and :func:`eval`). In previous versions, whether or not changes could " -"be accessed by calling :func:`!locals` after calling the code execution " -"function was implementation-dependent. In CPython specifically, such code " -"would typically appear to work as desired, but could sometimes fail in " -"optimized scopes based on other code (including debuggers and code execution " -"tracing tools) potentially resetting the shared snapshot in that scope. Now, " -"the code will always run against an independent snapshot of the local " -"variables in optimized scopes, and hence the changes will never be visible " -"in subsequent calls to :func:`!locals`. To access the changes made in these " -"cases, an explicit namespace reference must now be passed to the relevant " -"function. Alternatively, it may make sense to update affected code to use a " -"higher level code execution API that returns the resulting code execution " -"namespace (e.g. :func:`runpy.run_path` when executing Python files from " -"disk)." +"target :func:`!locals` if no explicit namespace is provided (such " +"as :func:`exec` and :func:`eval`). In previous versions, whether or not " +"changes could be accessed by calling :func:`!locals` after calling the code " +"execution function was implementation-dependent. In CPython specifically, " +"such code would typically appear to work as desired, but could sometimes " +"fail in optimized scopes based on other code (including debuggers and code " +"execution tracing tools) potentially resetting the shared snapshot in that " +"scope. Now, the code will always run against an independent snapshot of the " +"local variables in optimized scopes, and hence the changes will never be " +"visible in subsequent calls to :func:`!locals`. To access the changes made " +"in these cases, an explicit namespace reference must now be passed to the " +"relevant function. Alternatively, it may make sense to update affected code " +"to use a higher level code execution API that returns the resulting code " +"execution namespace (e.g. :func:`runpy.run_path` when executing Python files " +"from disk)." msgstr "" #: ../../whatsnew/3.13.rst:460 @@ -743,16 +744,16 @@ msgstr "" #: ../../whatsnew/3.13.rst:466 msgid "" "See :pep:`667` for more details, including related C API changes and " -"deprecations. Porting notes are also provided below for the affected :ref:" -"`Python APIs <pep667-porting-notes-py>` and :ref:`C APIs <pep667-porting-" -"notes-c>`." +"deprecations. Porting notes are also provided below for the " +"affected :ref:`Python APIs <pep667-porting-notes-py>` and :ref:`C APIs " +"<pep667-porting-notes-c>`." msgstr "" #: ../../whatsnew/3.13.rst:471 msgid "" -"(PEP and implementation contributed by Mark Shannon and Tian Gao in :gh:" -"`74929`. Documentation updates provided by Guido van Rossum and Alyssa " -"Coghlan.)" +"(PEP and implementation contributed by Mark Shannon and Tian Gao " +"in :gh:`74929`. Documentation updates provided by Guido van Rossum and " +"Alyssa Coghlan.)" msgstr "" #: ../../whatsnew/3.13.rst:479 @@ -847,8 +848,8 @@ msgstr "" msgid "" ":keyword:`global` declarations are now permitted in :keyword:`except` blocks " "when that global is used in the :keyword:`else` block. Previously this " -"raised an erroneous :exc:`SyntaxError`. (Contributed by Irit Katriel in :gh:" -"`111123`.)" +"raised an erroneous :exc:`SyntaxError`. (Contributed by Irit Katriel " +"in :gh:`111123`.)" msgstr "" #: ../../whatsnew/3.13.rst:549 @@ -864,15 +865,15 @@ msgid "" "Add :ref:`support for the perf profiler <perf_profiling>` working without " "`frame pointers <https://en.wikipedia.org/wiki/Call_stack>`_ through the new " "environment variable :envvar:`PYTHON_PERF_JIT_SUPPORT` and command-line " -"option :option:`-X perf_jit <-X>`. (Contributed by Pablo Galindo in :gh:" -"`118518`.)" +"option :option:`-X perf_jit <-X>`. (Contributed by Pablo Galindo " +"in :gh:`118518`.)" msgstr "" #: ../../whatsnew/3.13.rst:560 msgid "" -"The location of a :file:`.python_history` file can be changed via the new :" -"envvar:`PYTHON_HISTORY` environment variable. (Contributed by Levi Sabah, " -"Zackery Spytz and Hugo van Kemenade in :gh:`73965`.)" +"The location of a :file:`.python_history` file can be changed via the " +"new :envvar:`PYTHON_HISTORY` environment variable. (Contributed by Levi " +"Sabah, Zackery Spytz and Hugo van Kemenade in :gh:`73965`.)" msgstr "" #: ../../whatsnew/3.13.rst:565 @@ -893,15 +894,15 @@ msgstr "" #: ../../whatsnew/3.13.rst:574 msgid "" "The :func:`exec` and :func:`eval` builtins now accept the *globals* and " -"*locals* arguments as keywords. (Contributed by Raphael Gaschignard in :gh:" -"`105879`)" +"*locals* arguments as keywords. (Contributed by Raphael Gaschignard " +"in :gh:`105879`)" msgstr "" #: ../../whatsnew/3.13.rst:578 msgid "" -"The :func:`compile` builtin now accepts a new flag, ``ast." -"PyCF_OPTIMIZED_AST``, which is similar to ``ast.PyCF_ONLY_AST`` except that " -"the returned AST is optimized according to the value of the *optimize* " +"The :func:`compile` builtin now accepts a new flag, " +"``ast.PyCF_OPTIMIZED_AST``, which is similar to ``ast.PyCF_ONLY_AST`` except " +"that the returned AST is optimized according to the value of the *optimize* " "argument. (Contributed by Irit Katriel in :gh:`108113`)." msgstr "" @@ -913,10 +914,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:587 msgid "" -"Add :exc:`PythonFinalizationError`, a new exception derived from :exc:" -"`RuntimeError` and used to signal when operations are blocked during :term:" -"`finalization <interpreter shutdown>`. The following callables now raise :" -"exc:`!PythonFinalizationError`, instead of :exc:`RuntimeError`:" +"Add :exc:`PythonFinalizationError`, a new exception derived " +"from :exc:`RuntimeError` and used to signal when operations are blocked " +"during :term:`finalization <interpreter shutdown>`. The following callables " +"now raise :exc:`!PythonFinalizationError`, instead of :exc:`RuntimeError`:" msgstr "" #: ../../whatsnew/3.13.rst:593 @@ -944,8 +945,8 @@ msgid "" "Allow the *count* argument of :meth:`str.replace` to be a keyword. " "(Contributed by Hugo van Kemenade in :gh:`106487`.)" msgstr "" -"允許 :meth:`str.replace` 的 *count* 引數為關鍵字。(由 Hugo van Kemenade 在 :" -"gh:`106487` 中貢獻。)" +"允許 :meth:`str.replace` 的 *count* 引數為關鍵字。(由 Hugo van Kemenade " +"在 :gh:`106487` 中貢獻。)" #: ../../whatsnew/3.13.rst:603 msgid "" @@ -957,8 +958,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:608 msgid "" "Added :attr:`!name` and :attr:`!mode` attributes for compressed and archived " -"file-like objects in the :mod:`bz2`, :mod:`lzma`, :mod:`tarfile`, and :mod:" -"`zipfile` modules. (Contributed by Serhiy Storchaka in :gh:`115961`.)" +"file-like objects in the :mod:`bz2`, :mod:`lzma`, :mod:`tarfile`, " +"and :mod:`zipfile` modules. (Contributed by Serhiy Storchaka " +"in :gh:`115961`.)" msgstr "" #: ../../whatsnew/3.13.rst:615 @@ -981,10 +983,10 @@ msgstr "argparse" #: ../../whatsnew/3.13.rst:628 msgid "" -"Add the *deprecated* parameter to the :meth:`~argparse.ArgumentParser." -"add_argument` and :meth:`!add_parser` methods, to enable deprecating command-" -"line options, positional arguments, and subcommands. (Contributed by Serhiy " -"Storchaka in :gh:`83648`.)" +"Add the *deprecated* parameter to " +"the :meth:`~argparse.ArgumentParser.add_argument` and :meth:`!add_parser` " +"methods, to enable deprecating command-line options, positional arguments, " +"and subcommands. (Contributed by Serhiy Storchaka in :gh:`83648`.)" msgstr "" #: ../../whatsnew/3.13.rst:636 @@ -1038,14 +1040,14 @@ msgstr "" #: ../../whatsnew/3.13.rst:669 msgid "" "These changes do not apply to user-defined subclasses of :class:`ast.AST` " -"unless the class opts in to the new behavior by defining the :attr:`.AST." -"_field_types` mapping." +"unless the class opts in to the new behavior by defining " +"the :attr:`.AST._field_types` mapping." msgstr "" #: ../../whatsnew/3.13.rst:673 msgid "" -"(Contributed by Jelle Zijlstra in :gh:`105858`, :gh:`117486`, and :gh:" -"`118851`.)" +"(Contributed by Jelle Zijlstra in :gh:`105858`, :gh:`117486`, " +"and :gh:`118851`.)" msgstr "" #: ../../whatsnew/3.13.rst:675 @@ -1061,19 +1063,19 @@ msgstr "asyncio" #: ../../whatsnew/3.13.rst:684 msgid "" -":func:`asyncio.as_completed` now returns an object that is both an :term:" -"`asynchronous iterator` and a plain :term:`iterator` of :term:`awaitables " -"<awaitable>`. The awaitables yielded by asynchronous iteration include " -"original task or future objects that were passed in, making it easier to " -"associate results with the tasks being completed. (Contributed by Justin " -"Arthur in :gh:`77714`.)" +":func:`asyncio.as_completed` now returns an object that is both " +"an :term:`asynchronous iterator` and a plain :term:`iterator` " +"of :term:`awaitables <awaitable>`. The awaitables yielded by asynchronous " +"iteration include original task or future objects that were passed in, " +"making it easier to associate results with the tasks being completed. " +"(Contributed by Justin Arthur in :gh:`77714`.)" msgstr "" #: ../../whatsnew/3.13.rst:692 msgid "" ":meth:`asyncio.loop.create_unix_server` will now automatically remove the " -"Unix socket when the server is closed. (Contributed by Pierre Ossman in :gh:" -"`111246`.)" +"Unix socket when the server is closed. (Contributed by Pierre Ossman " +"in :gh:`111246`.)" msgstr "" #: ../../whatsnew/3.13.rst:696 @@ -1086,9 +1088,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:702 msgid "" -"Add :meth:`Queue.shutdown <asyncio.Queue.shutdown>` and :exc:`~asyncio." -"QueueShutDown` to manage queue termination. (Contributed by Laurie Opperman " -"and Yves Duprat in :gh:`104228`.)" +"Add :meth:`Queue.shutdown <asyncio.Queue.shutdown>` " +"and :exc:`~asyncio.QueueShutDown` to manage queue termination. (Contributed " +"by Laurie Opperman and Yves Duprat in :gh:`104228`.)" msgstr "" #: ../../whatsnew/3.13.rst:706 @@ -1101,8 +1103,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:710 msgid "" "Accept a tuple of separators in :meth:`.StreamReader.readuntil`, stopping " -"when any one of them is encountered. (Contributed by Bruce Merry in :gh:" -"`81322`.)" +"when any one of them is encountered. (Contributed by Bruce Merry " +"in :gh:`81322`.)" msgstr "" #: ../../whatsnew/3.13.rst:714 @@ -1117,9 +1119,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:721 msgid "" "In the case where a task group is cancelled externally and also must raise " -"an :exc:`ExceptionGroup`, it will now call the parent task's :meth:`~asyncio." -"Task.cancel` method. This ensures that a :exc:`~asyncio.CancelledError` will " -"be raised at the next :keyword:`await`, so the cancellation is not lost." +"an :exc:`ExceptionGroup`, it will now call the parent " +"task's :meth:`~asyncio.Task.cancel` method. This ensures that " +"a :exc:`~asyncio.CancelledError` will be raised at the " +"next :keyword:`await`, so the cancellation is not lost." msgstr "" #: ../../whatsnew/3.13.rst:727 @@ -1141,10 +1144,11 @@ msgstr "" #: ../../whatsnew/3.13.rst:736 msgid "" -"When :meth:`.TaskGroup.create_task` is called on an inactive :class:" -"`~asyncio.TaskGroup`, the given coroutine will be closed (which prevents a :" -"exc:`RuntimeWarning` about the given coroutine being never awaited). " -"(Contributed by Arthur Tacca and Jason Zhang in :gh:`115957`.)" +"When :meth:`.TaskGroup.create_task` is called on an " +"inactive :class:`~asyncio.TaskGroup`, the given coroutine will be closed " +"(which prevents a :exc:`RuntimeWarning` about the given coroutine being " +"never awaited). (Contributed by Arthur Tacca and Jason Zhang " +"in :gh:`115957`.)" msgstr "" #: ../../whatsnew/3.13.rst:744 @@ -1154,8 +1158,8 @@ msgstr "base64" #: ../../whatsnew/3.13.rst:746 msgid "" "Add :func:`~base64.z85encode` and :func:`~base64.z85decode` functions for " -"encoding :class:`bytes` as `Z85 data`_ and decoding Z85-encoded data to :" -"class:`!bytes`. (Contributed by Matan Perelman in :gh:`75299`.)" +"encoding :class:`bytes` as `Z85 data`_ and decoding Z85-encoded data " +"to :class:`!bytes`. (Contributed by Matan Perelman in :gh:`75299`.)" msgstr "" #: ../../whatsnew/3.13.rst:755 @@ -1165,16 +1169,16 @@ msgstr "compileall" #: ../../whatsnew/3.13.rst:757 ../../whatsnew/3.13.rst:765 #: ../../whatsnew/3.13.rst:1024 msgid "" -"The default number of worker threads and processes is now selected using :" -"func:`os.process_cpu_count` instead of :func:`os.cpu_count`. (Contributed by " -"Victor Stinner in :gh:`109649`.)" +"The default number of worker threads and processes is now selected " +"using :func:`os.process_cpu_count` instead of :func:`os.cpu_count`. " +"(Contributed by Victor Stinner in :gh:`109649`.)" msgstr "" #: ../../whatsnew/3.13.rst:763 msgid "concurrent.futures" msgstr "concurrent.futures" -#: ../../whatsnew/3.13.rst:771 ../../whatsnew/3.13.rst:1621 +#: ../../whatsnew/3.13.rst:771 ../../whatsnew/3.13.rst:1673 msgid "configparser" msgstr "configparser" @@ -1182,8 +1186,8 @@ msgstr "configparser" msgid "" ":class:`~configparser.ConfigParser` now has support for unnamed sections, " "which allows for top-level key-value pairs. This can be enabled with the new " -"*allow_unnamed_section* parameter. (Contributed by Pedro Sousa Lacerda in :" -"gh:`66449`.)" +"*allow_unnamed_section* parameter. (Contributed by Pedro Sousa Lacerda " +"in :gh:`66449`.)" msgstr "" #: ../../whatsnew/3.13.rst:780 @@ -1208,10 +1212,8 @@ msgid ":class:`dataclasses.dataclass`" msgstr ":class:`dataclasses.dataclass`" #: ../../whatsnew/3.13.rst:790 -msgid "" -":class:`datetime.datetime`, :class:`datetime.date`, :class:`datetime.time`" -msgstr "" -":class:`datetime.datetime`、:class:`datetime.date`、:class:`datetime.time`" +msgid ":class:`datetime.datetime`, :class:`datetime.date`, :class:`datetime.time`" +msgstr ":class:`datetime.datetime`、:class:`datetime.date`、:class:`datetime.time`" #: ../../whatsnew/3.13.rst:791 msgid ":class:`inspect.Signature`, :class:`inspect.Parameter`" @@ -1228,8 +1230,8 @@ msgstr ":ref:`程式碼物件 <code-objects>`" #: ../../whatsnew/3.13.rst:795 msgid "" "Any user-defined class can also support :func:`copy.replace` by defining " -"the :meth:`~object.__replace__` method. (Contributed by Serhiy Storchaka in :" -"gh:`108751`.)" +"the :meth:`~object.__replace__` method. (Contributed by Serhiy Storchaka " +"in :gh:`108751`.)" msgstr "" #: ../../whatsnew/3.13.rst:801 @@ -1264,10 +1266,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:817 msgid "" -":class:`ctypes.Structure` objects have a new :attr:`~ctypes.Structure." -"_align_` attribute which allows the alignment of the structure being packed " -"to/from memory to be specified explicitly. (Contributed by Matt Sanderson " -"in :gh:`112433`)" +":class:`ctypes.Structure` objects have a " +"new :attr:`~ctypes.Structure._align_` attribute which allows the alignment " +"of the structure being packed to/from memory to be specified explicitly. " +"(Contributed by Matt Sanderson in :gh:`112433`)" msgstr "" #: ../../whatsnew/3.13.rst:823 @@ -1283,9 +1285,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:829 msgid "" -"Allow removing all items from the database through the new :meth:`.gdbm." -"clear` and :meth:`.ndbm.clear` methods. (Contributed by Donghee Na in :gh:" -"`107122`.)" +"Allow removing all items from the database through the " +"new :meth:`.gdbm.clear` and :meth:`.ndbm.clear` methods. (Contributed by " +"Donghee Na in :gh:`107122`.)" msgstr "" #: ../../whatsnew/3.13.rst:835 @@ -1303,10 +1305,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:844 msgid "" ":meth:`~dis.get_instructions` no longer represents cache entries as separate " -"instructions. Instead, it returns them as part of the :class:`~dis." -"Instruction`, in the new *cache_info* field. The *show_caches* argument to :" -"meth:`~dis.get_instructions` is deprecated and no longer has any effect. " -"(Contributed by Irit Katriel in :gh:`112962`.)" +"instructions. Instead, it returns them as part of " +"the :class:`~dis.Instruction`, in the new *cache_info* field. The " +"*show_caches* argument to :meth:`~dis.get_instructions` is deprecated and no " +"longer has any effect. (Contributed by Irit Katriel in :gh:`112962`.)" msgstr "" #: ../../whatsnew/3.13.rst:856 @@ -1317,9 +1319,9 @@ msgstr "doctest" msgid "" ":mod:`doctest` output is now colored by default. This can be controlled via " "the new :envvar:`PYTHON_COLORS` environment variable as well as the " -"canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment variables. See also :" -"ref:`using-on-controlling-color`. (Contributed by Hugo van Kemenade in :gh:" -"`117225`.)" +"canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment variables. See " +"also :ref:`using-on-controlling-color`. (Contributed by Hugo van Kemenade " +"in :gh:`117225`.)" msgstr "" #: ../../whatsnew/3.13.rst:865 @@ -1335,12 +1337,13 @@ msgstr "email" #: ../../whatsnew/3.13.rst:873 msgid "" -"Headers with embedded newlines are now quoted on output. The :mod:`~email." -"generator` will now refuse to serialize (write) headers that are improperly " -"folded or delimited, such that they would be parsed as multiple headers or " -"joined with adjacent data. If you need to turn this safety feature off, set :" -"attr:`~email.policy.Policy.verify_generated_headers`. (Contributed by Bas " -"Bloemsaat and Petr Viktorin in :gh:`121650`.)" +"Headers with embedded newlines are now quoted on output. " +"The :mod:`~email.generator` will now refuse to serialize (write) headers " +"that are improperly folded or delimited, such that they would be parsed as " +"multiple headers or joined with adjacent data. If you need to turn this " +"safety feature off, " +"set :attr:`~email.policy.Policy.verify_generated_headers`. (Contributed by " +"Bas Bloemsaat and Petr Viktorin in :gh:`121650`.)" msgstr "" #: ../../whatsnew/3.13.rst:881 @@ -1349,10 +1352,10 @@ msgid "" "return ``('', '')`` pairs in more situations where invalid email addresses " "are encountered instead of potentially inaccurate values. The two functions " "have a new optional *strict* parameter (default ``True``). To get the old " -"behavior (accepting malformed input), use ``strict=False``. ``getattr(email." -"utils, 'supports_strict_parsing', False)`` can be used to check if the " -"*strict* parameter is available. (Contributed by Thomas Dwyer and Victor " -"Stinner for :gh:`102988` to improve the :cve:`2023-27043` fix.)" +"behavior (accepting malformed input), use ``strict=False``. " +"``getattr(email.utils, 'supports_strict_parsing', False)`` can be used to " +"check if the *strict* parameter is available. (Contributed by Thomas Dwyer " +"and Victor Stinner for :gh:`102988` to improve the :cve:`2023-27043` fix.)" msgstr "" #: ../../whatsnew/3.13.rst:893 @@ -1361,8 +1364,8 @@ msgstr "enum" #: ../../whatsnew/3.13.rst:895 msgid "" -":class:`~enum.EnumDict` has been made public to better support subclassing :" -"class:`~enum.EnumType`." +":class:`~enum.EnumDict` has been made public to better support " +"subclassing :class:`~enum.EnumType`." msgstr "" "公開 :class:`~enum.EnumDict` 以更好地支援 :class:`~enum.EnumType` 的子類別。" @@ -1374,8 +1377,8 @@ msgstr "fractions" msgid "" ":class:`~fractions.Fraction` objects now support the standard :ref:`format " "specification mini-language <formatspec>` rules for fill, alignment, sign " -"handling, minimum width, and grouping. (Contributed by Mark Dickinson in :gh:" -"`111320`.)" +"handling, minimum width, and grouping. (Contributed by Mark Dickinson " +"in :gh:`111320`.)" msgstr "" #: ../../whatsnew/3.13.rst:909 @@ -1435,8 +1438,8 @@ msgstr "" msgid "" ":func:`~importlib.resources.contents` remains deprecated in favor of the " "fully-featured :class:`~importlib.resources.abc.Traversable` API. However, " -"there is now no plan to remove it. (Contributed by Petr Viktorin in :gh:" -"`116608`.)" +"there is now no plan to remove it. (Contributed by Petr Viktorin " +"in :gh:`116608`.)" msgstr "" #: ../../whatsnew/3.13.rst:941 @@ -1445,11 +1448,11 @@ msgstr "io" #: ../../whatsnew/3.13.rst:943 msgid "" -"The :class:`~io.IOBase` finalizer now logs any errors raised by the :meth:" -"`~io.IOBase.close` method with :data:`sys.unraisablehook`. Previously, " -"errors were ignored silently by default, and only logged in :ref:`Python " -"Development Mode <devmode>` or when using a :ref:`Python debug build <debug-" -"build>`. (Contributed by Victor Stinner in :gh:`62948`.)" +"The :class:`~io.IOBase` finalizer now logs any errors raised by " +"the :meth:`~io.IOBase.close` method with :data:`sys.unraisablehook`. " +"Previously, errors were ignored silently by default, and only logged " +"in :ref:`Python Development Mode <devmode>` or when using a :ref:`Python " +"debug build <debug-build>`. (Contributed by Victor Stinner in :gh:`62948`.)" msgstr "" #: ../../whatsnew/3.13.rst:952 @@ -1464,10 +1467,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:958 msgid "" -"Fix ``is_global`` and ``is_private`` behavior in :class:`~ipaddress." -"IPv4Address`, :class:`~ipaddress.IPv6Address`, :class:`~ipaddress." -"IPv4Network`, and :class:`~ipaddress.IPv6Network`. (Contributed by Jakub " -"Stasiak in :gh:`113171`.)" +"Fix ``is_global`` and ``is_private`` behavior " +"in :class:`~ipaddress.IPv4Address`, :class:`~ipaddress.IPv6Address`, :class:`~ipaddress.IPv4Network`, " +"and :class:`~ipaddress.IPv6Network`. (Contributed by Jakub Stasiak " +"in :gh:`113171`.)" msgstr "" #: ../../whatsnew/3.13.rst:965 @@ -1476,9 +1479,9 @@ msgstr "itertools" #: ../../whatsnew/3.13.rst:967 msgid "" -":func:`~itertools.batched` has a new *strict* parameter, which raises a :exc:" -"`ValueError` if the final batch is shorter than the specified batch size. " -"(Contributed by Raymond Hettinger in :gh:`113202`.)" +":func:`~itertools.batched` has a new *strict* parameter, which raises " +"a :exc:`ValueError` if the final batch is shorter than the specified batch " +"size. (Contributed by Raymond Hettinger in :gh:`113202`.)" msgstr "" #: ../../whatsnew/3.13.rst:974 @@ -1515,8 +1518,8 @@ msgstr "mimetypes" msgid "" "Add the :func:`~mimetypes.guess_file_type` function to guess a MIME type " "from a filesystem path. Using paths with :func:`~mimetypes.guess_type` is " -"now :term:`soft deprecated`. (Contributed by Serhiy Storchaka in :gh:" -"`66543`.)" +"now :term:`soft deprecated`. (Contributed by Serhiy Storchaka " +"in :gh:`66543`.)" msgstr "" #: ../../whatsnew/3.13.rst:1004 @@ -1533,17 +1536,17 @@ msgstr "" #: ../../whatsnew/3.13.rst:1010 msgid "" ":class:`~mmap.mmap` has a new :meth:`~mmap.mmap.seekable` method that can be " -"used when a seekable file-like object is required. The :meth:`~mmap.mmap." -"seek` method now returns the new absolute position. (Contributed by Donghee " -"Na and Sylvie Liberman in :gh:`111835`.)" +"used when a seekable file-like object is required. " +"The :meth:`~mmap.mmap.seek` method now returns the new absolute position. " +"(Contributed by Donghee Na and Sylvie Liberman in :gh:`111835`.)" msgstr "" #: ../../whatsnew/3.13.rst:1015 msgid "" "The new UNIX-only *trackfd* parameter for :class:`~mmap.mmap` controls file " "descriptor duplication; if false, the file descriptor specified by *fileno* " -"will not be duplicated. (Contributed by Zackery Spytz and Petr Viktorin in :" -"gh:`78502`.)" +"will not be duplicated. (Contributed by Zackery Spytz and Petr Viktorin " +"in :gh:`78502`.)" msgstr "" #: ../../whatsnew/3.13.rst:1022 @@ -1574,10 +1577,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:1044 msgid "" "Add a :ref:`low level interface <os-timerfd>` to Linux's :manpage:`timer " -"file descriptors <timerfd_create(2)>` via :func:`~os.timerfd_create`, :func:" -"`~os.timerfd_settime`, :func:`~os.timerfd_settime_ns`, :func:`~os." -"timerfd_gettime`, :func:`~os.timerfd_gettime_ns`, :const:`~os." -"TFD_NONBLOCK`, :const:`~os.TFD_CLOEXEC`, :const:`~os.TFD_TIMER_ABSTIME`, " +"file descriptors <timerfd_create(2)>` " +"via :func:`~os.timerfd_create`, :func:`~os.timerfd_settime`, :func:`~os.timerfd_settime_ns`, :func:`~os.timerfd_gettime`, :func:`~os.timerfd_gettime_ns`, :const:`~os.TFD_NONBLOCK`, :const:`~os.TFD_CLOEXEC`, :const:`~os.TFD_TIMER_ABSTIME`, " "and :const:`~os.TFD_TIMER_CANCEL_ON_SET` (Contributed by Masaru Tsuchiyama " "in :gh:`108277`.)" msgstr "" @@ -1593,17 +1594,17 @@ msgstr "" #: ../../whatsnew/3.13.rst:1059 msgid "" ":func:`~os.fchmod` and support for file descriptors in :func:`~os.chmod` are " -"both now available on Windows. (Contributed by Serhiy Storchaka in :gh:" -"`113191`.)" +"both now available on Windows. (Contributed by Serhiy Storchaka " +"in :gh:`113191`.)" msgstr "" #: ../../whatsnew/3.13.rst:1063 msgid "" "On Windows, :func:`~os.mkdir` and :func:`~os.makedirs` now support passing a " "*mode* value of ``0o700`` to apply access control to the new directory. This " -"implicitly affects :func:`tempfile.mkdtemp` and is a mitigation for :cve:" -"`2024-4030`. Other values for *mode* continue to be ignored. (Contributed by " -"Steve Dower in :gh:`118486`.)" +"implicitly affects :func:`tempfile.mkdtemp` and is a mitigation " +"for :cve:`2024-4030`. Other values for *mode* continue to be ignored. " +"(Contributed by Steve Dower in :gh:`118486`.)" msgstr "" #: ../../whatsnew/3.13.rst:1070 @@ -1615,10 +1616,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:1074 msgid "" -":func:`~os.posix_spawn` can now use the :attr:`~os.POSIX_SPAWN_CLOSEFROM` " -"attribute in the *file_actions* parameter on platforms that support :c:func:" -"`!posix_spawn_file_actions_addclosefrom_np`. (Contributed by Jakub Kulik in :" -"gh:`113117`.)" +":func:`~os.posix_spawn` can now use the :const:`~os.POSIX_SPAWN_CLOSEFROM` " +"attribute in the *file_actions* parameter on platforms that " +"support :c:func:`!posix_spawn_file_actions_addclosefrom_np`. (Contributed by " +"Jakub Kulik in :gh:`113117`.)" msgstr "" #: ../../whatsnew/3.13.rst:1081 @@ -1645,15 +1646,15 @@ msgid "" "file is not accessible. (Contributed by Moonsik Park in :gh:`82367`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1098 ../../whatsnew/3.13.rst:1677 +#: ../../whatsnew/3.13.rst:1098 ../../whatsnew/3.13.rst:1729 msgid "pathlib" msgstr "pathlib" #: ../../whatsnew/3.13.rst:1100 msgid "" -"Add :exc:`~pathlib.UnsupportedOperation`, which is raised instead of :exc:" -"`NotImplementedError` when a path operation isn't supported. (Contributed by " -"Barney Gale in :gh:`89812`.)" +"Add :exc:`~pathlib.UnsupportedOperation`, which is raised instead " +"of :exc:`NotImplementedError` when a path operation isn't supported. " +"(Contributed by Barney Gale in :gh:`89812`.)" msgstr "" #: ../../whatsnew/3.13.rst:1104 @@ -1679,8 +1680,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:1117 msgid "" -"Add *recurse_symlinks* keyword-only argument to :meth:`.Path.glob` and :meth:" -"`~pathlib.Path.rglob`. (Contributed by Barney Gale in :gh:`77609`.)" +"Add *recurse_symlinks* keyword-only argument to :meth:`.Path.glob` " +"and :meth:`~pathlib.Path.rglob`. (Contributed by Barney Gale in :gh:`77609`.)" msgstr "" #: ../../whatsnew/3.13.rst:1121 @@ -1693,9 +1694,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:1126 msgid "" "Add the *follow_symlinks* keyword-only argument to :meth:`Path.is_file " -"<pathlib.Path.is_file>`, :meth:`Path.is_dir <pathlib.Path.is_dir>`, :meth:`." -"Path.owner`, and :meth:`.Path.group`. (Contributed by Barney Gale in :gh:" -"`105793` and Kamil Turek in :gh:`107962`.)" +"<pathlib.Path.is_file>`, :meth:`Path.is_dir " +"<pathlib.Path.is_dir>`, :meth:`.Path.owner`, and :meth:`.Path.group`. " +"(Contributed by Barney Gale in :gh:`105793` and Kamil Turek in :gh:`107962`.)" msgstr "" #: ../../whatsnew/3.13.rst:1134 @@ -1728,8 +1729,8 @@ msgstr "" msgid "" "Add ability to move between chained exceptions during post-mortem debugging " "in :func:`~pdb.pm` using the new :pdbcmd:`exceptions [exc_number] " -"<exceptions>` command for Pdb. (Contributed by Matthias Bussonnier in :gh:" -"`106676`.)" +"<exceptions>` command for Pdb. (Contributed by Matthias Bussonnier " +"in :gh:`106676`.)" msgstr "" #: ../../whatsnew/3.13.rst:1154 @@ -1759,14 +1760,14 @@ msgid "" "Kemenade in :gh:`118131`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1175 ../../whatsnew/3.13.rst:1685 +#: ../../whatsnew/3.13.rst:1175 ../../whatsnew/3.13.rst:1737 msgid "re" msgstr "re" #: ../../whatsnew/3.13.rst:1177 msgid "" -"Rename :exc:`!re.error` to :exc:`~re.PatternError` for improved clarity. :" -"exc:`!re.error` is kept for backward compatibility." +"Rename :exc:`!re.error` to :exc:`~re.PatternError` for improved " +"clarity. :exc:`!re.error` is kept for backward compatibility." msgstr "" #: ../../whatsnew/3.13.rst:1182 @@ -1775,8 +1776,9 @@ msgstr "shutil" #: ../../whatsnew/3.13.rst:1184 msgid "" -"Support the *dir_fd* and *follow_symlinks* keyword arguments in :func:" -"`~shutil.chown`. (Contributed by Berker Peksag and Tahia K in :gh:`62308`)" +"Support the *dir_fd* and *follow_symlinks* keyword arguments " +"in :func:`~shutil.chown`. (Contributed by Berker Peksag and Tahia K " +"in :gh:`62308`)" msgstr "" #: ../../whatsnew/3.13.rst:1190 @@ -1785,9 +1787,9 @@ msgstr "site" #: ../../whatsnew/3.13.rst:1192 msgid "" -":file:`.pth` files are now decoded using UTF-8 first, and then with the :" -"term:`locale encoding` if UTF-8 decoding fails. (Contributed by Inada Naoki " -"in :gh:`117802`.)" +":file:`.pth` files are now decoded using UTF-8 first, and then with " +"the :term:`locale encoding` if UTF-8 decoding fails. (Contributed by Inada " +"Naoki in :gh:`117802`.)" msgstr "" #: ../../whatsnew/3.13.rst:1198 @@ -1804,8 +1806,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:1204 msgid "" "Add the *filter* keyword-only parameter to :meth:`.Connection.iterdump` for " -"filtering database objects to dump. (Contributed by Mariusz Felisiak in :gh:" -"`91602`.)" +"filtering database objects to dump. (Contributed by Mariusz Felisiak " +"in :gh:`91602`.)" msgstr "" #: ../../whatsnew/3.13.rst:1210 @@ -1814,9 +1816,9 @@ msgstr "ssl" #: ../../whatsnew/3.13.rst:1212 msgid "" -"The :func:`~ssl.create_default_context` API now includes :data:`~ssl." -"VERIFY_X509_PARTIAL_CHAIN` and :data:`~ssl.VERIFY_X509_STRICT` in its " -"default flags." +"The :func:`~ssl.create_default_context` API now " +"includes :data:`~ssl.VERIFY_X509_PARTIAL_CHAIN` " +"and :data:`~ssl.VERIFY_X509_STRICT` in its default flags." msgstr "" #: ../../whatsnew/3.13.rst:1218 @@ -1850,8 +1852,8 @@ msgstr "statistics" msgid "" "Add :func:`~statistics.kde` for kernel density estimation. This makes it " "possible to estimate a continuous probability density function from a fixed " -"number of discrete samples. (Contributed by Raymond Hettinger in :gh:" -"`115863`.)" +"number of discrete samples. (Contributed by Raymond Hettinger " +"in :gh:`115863`.)" msgstr "" #: ../../whatsnew/3.13.rst:1241 @@ -1883,14 +1885,14 @@ msgstr "" #: ../../whatsnew/3.13.rst:1261 msgid "" "A private control knob :attr:`!subprocess._USE_POSIX_SPAWN` can be set to " -"``False`` if you need to force :mod:`subprocess` to never use :func:`~os." -"posix_spawn`. Please report your reason and platform details in the :ref:" -"`issue tracker <using-the-tracker>` if you set this so that we can improve " -"our API selection logic for everyone. (Contributed by Jakub Kulik in :gh:" -"`113117`.)" +"``False`` if you need to force :mod:`subprocess` to never " +"use :func:`~os.posix_spawn`. Please report your reason and platform details " +"in the :ref:`issue tracker <using-the-tracker>` if you set this so that we " +"can improve our API selection logic for everyone. (Contributed by Jakub " +"Kulik in :gh:`113117`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1271 ../../whatsnew/3.13.rst:2732 +#: ../../whatsnew/3.13.rst:1271 ../../whatsnew/3.13.rst:2811 msgid "sys" msgstr "sys" @@ -1909,8 +1911,8 @@ msgstr "tempfile" msgid "" "On Windows, the default mode ``0o700`` used by :func:`tempfile.mkdtemp` now " "limits access to the new directory due to changes to :func:`os.mkdir`. This " -"is a mitigation for :cve:`2024-4030`. (Contributed by Steve Dower in :gh:" -"`118486`.)" +"is a mitigation for :cve:`2024-4030`. (Contributed by Steve Dower " +"in :gh:`118486`.)" msgstr "" #: ../../whatsnew/3.13.rst:1288 @@ -1930,8 +1932,8 @@ msgid "" "On Windows, :func:`~time.time` now uses the " "``GetSystemTimePreciseAsFileTime()`` clock for a resolution of 1 " "microsecond, instead of the ``GetSystemTimeAsFileTime()`` clock which has a " -"resolution of 15.6 milliseconds. (Contributed by Victor Stinner in :gh:" -"`63207`.)" +"resolution of 15.6 milliseconds. (Contributed by Victor Stinner " +"in :gh:`63207`.)" msgstr "" #: ../../whatsnew/3.13.rst:1304 @@ -1951,8 +1953,9 @@ msgid "" "The :mod:`tkinter` widget method :meth:`!wm_attributes` now accepts the " "attribute name without the minus prefix to get window attributes, for " "example ``w.wm_attributes('alpha')`` and allows specifying attributes and " -"values to set as keyword arguments, for example ``w." -"wm_attributes(alpha=0.5)``. (Contributed by Serhiy Storchaka in :gh:`43457`.)" +"values to set as keyword arguments, for example " +"``w.wm_attributes(alpha=0.5)``. (Contributed by Serhiy Storchaka " +"in :gh:`43457`.)" msgstr "" #: ../../whatsnew/3.13.rst:1319 @@ -1972,9 +1975,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:1328 msgid "" -"Support the \"vsapi\" element type in the :meth:`~tkinter.ttk.Style." -"element_create` method of :class:`tkinter.ttk.Style`. (Contributed by Serhiy " -"Storchaka in :gh:`68166`.)" +"Support the \"vsapi\" element type in " +"the :meth:`~tkinter.ttk.Style.element_create` method " +"of :class:`tkinter.ttk.Style`. (Contributed by Serhiy Storchaka " +"in :gh:`68166`.)" msgstr "" #: ../../whatsnew/3.13.rst:1333 @@ -2012,9 +2016,9 @@ msgstr "traceback" #: ../../whatsnew/3.13.rst:1357 msgid "" -"Add the :attr:`~traceback.TracebackException.exc_type_str` attribute to :" -"class:`~traceback.TracebackException`, which holds a string display of the " -"*exc_type*. Deprecate the :attr:`~traceback.TracebackException.exc_type` " +"Add the :attr:`~traceback.TracebackException.exc_type_str` attribute " +"to :class:`~traceback.TracebackException`, which holds a string display of " +"the *exc_type*. Deprecate the :attr:`~traceback.TracebackException.exc_type` " "attribute, which holds the type object itself. Add parameter *save_exc_type* " "(default ``True``) to indicate whether ``exc_type`` should be saved. " "(Contributed by Irit Katriel in :gh:`112332`.)" @@ -2022,10 +2026,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:1366 msgid "" -"Add a new *show_group* keyword-only parameter to :meth:`.TracebackException." -"format_exception_only` to (recursively) format the nested exceptions of a :" -"exc:`BaseExceptionGroup` instance. (Contributed by Irit Katriel in :gh:" -"`105292`.)" +"Add a new *show_group* keyword-only parameter " +"to :meth:`.TracebackException.format_exception_only` to (recursively) format " +"the nested exceptions of a :exc:`BaseExceptionGroup` instance. (Contributed " +"by Irit Katriel in :gh:`105292`.)" msgstr "" #: ../../whatsnew/3.13.rst:1373 @@ -2036,11 +2040,11 @@ msgstr "types" msgid "" ":class:`~types.SimpleNamespace` can now take a single positional argument to " "initialise the namespace's arguments. This argument must either be a mapping " -"or an iterable of key-value pairs. (Contributed by Serhiy Storchaka in :gh:" -"`108191`.)" +"or an iterable of key-value pairs. (Contributed by Serhiy Storchaka " +"in :gh:`108191`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1382 ../../whatsnew/3.13.rst:1710 +#: ../../whatsnew/3.13.rst:1382 ../../whatsnew/3.13.rst:1762 msgid "typing" msgstr "typing" @@ -2066,14 +2070,14 @@ msgstr "" #: ../../whatsnew/3.13.rst:1394 msgid "" "Add :func:`~typing.get_protocol_members` to return the set of members " -"defining a :class:`typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:" -"`104873`.)" +"defining a :class:`typing.Protocol`. (Contributed by Jelle Zijlstra " +"in :gh:`104873`.)" msgstr "" #: ../../whatsnew/3.13.rst:1398 msgid "" -"Add :func:`~typing.is_protocol` to check whether a class is a :class:" -"`~typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:`104873`.)" +"Add :func:`~typing.is_protocol` to check whether a class is " +"a :class:`~typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:`104873`.)" msgstr "" #: ../../whatsnew/3.13.rst:1402 @@ -2155,9 +2159,9 @@ msgstr "(由 Sebastian Pipping 在 :gh:`115623` 中貢獻。)" #: ../../whatsnew/3.13.rst:1454 msgid "" -"Add the :meth:`!close` method for the iterator returned by :func:`~xml.etree." -"ElementTree.iterparse` for explicit cleanup. (Contributed by Serhiy " -"Storchaka in :gh:`69893`.)" +"Add the :meth:`!close` method for the iterator returned " +"by :func:`~xml.etree.ElementTree.iterparse` for explicit cleanup. " +"(Contributed by Serhiy Storchaka in :gh:`69893`.)" msgstr "" #: ../../whatsnew/3.13.rst:1460 @@ -2178,9 +2182,9 @@ msgstr "最佳化" msgid "" "Several standard library modules have had their import times significantly " "improved. For example, the import time of the :mod:`typing` module has been " -"reduced by around a third by removing dependencies on :mod:`re` and :mod:" -"`contextlib`. Other modules to enjoy import-time speedups include :mod:" -"`email.utils`, :mod:`enum`, :mod:`functools`, :mod:`importlib.metadata`, " +"reduced by around a third by removing dependencies on :mod:`re` " +"and :mod:`contextlib`. Other modules to enjoy import-time speedups " +"include :mod:`email.utils`, :mod:`enum`, :mod:`functools`, :mod:`importlib.metadata`, " "and :mod:`threading`. (Contributed by Alex Waygood, Shantanu Jain, Adam " "Turner, Daniel Hollas, and others in :gh:`109653`.)" msgstr "" @@ -2203,11 +2207,11 @@ msgstr "" #: ../../whatsnew/3.13.rst:1496 msgid "Removed Modules And APIs" -msgstr "" +msgstr "被移除的模組和 API" #: ../../whatsnew/3.13.rst:1502 msgid "PEP 594: Remove \"dead batteries\" from the standard library" -msgstr "" +msgstr "PEP 594:從標準函式庫中移除「用完的電池」" #: ../../whatsnew/3.13.rst:1504 msgid "" @@ -2216,47 +2220,71 @@ msgid "" "obsolete, or insecure status. All of the following modules were deprecated " "in Python 3.11, and are now removed:" msgstr "" +":pep:`594` 提議從標準函式庫中移除因為歷史、過時或不安全狀態而被稱為「用完的電" +"池 (dead batteries)」的 19 個模組。以下所有模組在 Python 3.11 中已被棄用,現" +"在已被移除:" #: ../../whatsnew/3.13.rst:1510 msgid ":mod:`!aifc`" msgstr ":mod:`!aifc`" -#: ../../whatsnew/3.13.rst:1511 +#: ../../whatsnew/3.13.rst:1512 +msgid "" +":pypi:`standard-aifc`: Use the redistribution of ``aifc`` library from PyPI." +msgstr ":pypi:`standard-aifc`:PyPI 上的 ``aifc`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1515 msgid ":mod:`!audioop`" msgstr ":mod:`!audioop`" -#: ../../whatsnew/3.13.rst:1512 +#: ../../whatsnew/3.13.rst:1517 +msgid ":pypi:`audioop-lts`: Use ``audioop-lts`` library from PyPI." +msgstr ":pypi:`audioop-lts`:PyPI 上的 ``audioop-lts`` 函式庫。" + +#: ../../whatsnew/3.13.rst:1520 msgid ":mod:`!chunk`" msgstr ":mod:`!chunk`" -#: ../../whatsnew/3.13.rst:1513 +#: ../../whatsnew/3.13.rst:1522 +msgid "" +":pypi:`standard-chunk`: Use the redistribution of ``chunk`` library from " +"PyPI." +msgstr ":pypi:`standard-chunk`:PyPI 上的 ``chunk`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1525 msgid ":mod:`!cgi` and :mod:`!cgitb`" msgstr ":mod:`!cgi` 和 :mod:`!cgitb`" -#: ../../whatsnew/3.13.rst:1515 +#: ../../whatsnew/3.13.rst:1527 msgid "" -":class:`!cgi.FieldStorage` can typically be replaced with :func:`urllib." -"parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." -"message` module or the :pypi:`multipart` library for ``POST`` and ``PUT`` " -"requests." +":class:`!cgi.FieldStorage` can typically be replaced " +"with :func:`urllib.parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and " +"the :mod:`email.message` module or the :pypi:`multipart` library for " +"``POST`` and ``PUT`` requests." msgstr "" +":class:`!cgi.FieldStorage`,在於``GET`` 和 ``HEAD`` 請求中通常可以" +"被 :func:`urllib.parse.parse_qsl` 取代,而在於 ``POST`` 和 ``PUT`` 請求中可以" +"被 :mod:`email.message` 模組或 :pypi:`multipart` 函式庫取代。" -#: ../../whatsnew/3.13.rst:1520 +#: ../../whatsnew/3.13.rst:1532 msgid "" ":func:`!cgi.parse` can be replaced by calling :func:`urllib.parse.parse_qs` " "directly on the desired query string, unless the input is ``multipart/form-" -"data``, which should be replaced as described below for :func:`!cgi." -"parse_multipart`." +"data``, which should be replaced as described below for :func:`!" +"cgi.parse_multipart`." msgstr "" +":func:`!cgi.parse` 能夠以在所需的查詢字串上直接呼" +"叫 :func:`urllib.parse.parse_qs` 來取代,除非輸入為 ``multipart/form-data``," +"而這種情況則應該如下所述地將 :func:`!cgi.parse_multipart` 給替換掉。" -#: ../../whatsnew/3.13.rst:1525 +#: ../../whatsnew/3.13.rst:1537 msgid "" -":func:`!cgi.parse_header` can be replaced with the functionality in the :mod:" -"`email` package, which implements the same MIME RFCs. For example, with :" -"class:`email.message.EmailMessage`:" +":func:`!cgi.parse_header` can be replaced with the functionality in " +"the :mod:`email` package, which implements the same MIME RFCs. For example, " +"with :class:`email.message.EmailMessage`:" msgstr "" -#: ../../whatsnew/3.13.rst:1529 +#: ../../whatsnew/3.13.rst:1541 msgid "" "from email.message import EmailMessage\n" "\n" @@ -2264,361 +2292,456 @@ msgid "" "msg['content-type'] = 'application/json; charset=\"utf8\"'\n" "main, params = msg.get_content_type(), msg['content-type'].params" msgstr "" +"from email.message import EmailMessage\n" +"\n" +"msg = EmailMessage()\n" +"msg['content-type'] = 'application/json; charset=\"utf8\"'\n" +"main, params = msg.get_content_type(), msg['content-type'].params" + +#: ../../whatsnew/3.13.rst:1549 +msgid "" +":func:`!cgi.parse_multipart` can be replaced with the functionality in " +"the :mod:`email` package, which implements the same MIME RFCs, or with " +"the :pypi:`multipart` library. For example, " +"the :class:`email.message.EmailMessage` and :class:`email.message.Message` " +"classes." +msgstr "" +":func:`!cgi.parse_multipart` 可以被 :mod:`email` 函式庫中實作相同 MIME RFCs " +"的功能取代,或者可以被 :pypi:`multipart` 函式庫取代,例" +"如 :class:`email.message.EmailMessage` 和 :class:`email.message.Message` 類" +"別。" -#: ../../whatsnew/3.13.rst:1537 +#: ../../whatsnew/3.13.rst:1555 msgid "" -":func:`!cgi.parse_multipart` can be replaced with the functionality in the :" -"mod:`email` package, which implements the same MIME RFCs, or with the :pypi:" -"`multipart` library. For example, the :class:`email.message.EmailMessage` " -"and :class:`email.message.Message` classes." +":pypi:`standard-cgi`: and :pypi:`standard-cgitb`: Use the redistribution of " +"``cgi`` and ``cgitb`` library from PyPI." msgstr "" +":pypi:`standard-cgi` 和 :pypi:`standard-cgitb`:PyPI 上的 ``cgi`` 和 " +"``cgitb`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1543 +#: ../../whatsnew/3.13.rst:1558 msgid "" ":mod:`!crypt` and the private :mod:`!_crypt` extension. The :mod:`hashlib` " "module may be an appropriate replacement when simply hashing a value is " "required. Otherwise, various third-party libraries on PyPI are available:" msgstr "" -#: ../../whatsnew/3.13.rst:1548 +#: ../../whatsnew/3.13.rst:1563 msgid "" ":pypi:`bcrypt`: Modern password hashing for your software and your servers." -msgstr "" +msgstr ":pypi:`bcrypt`:適用於你的軟體與伺服器的現代密碼雜湊演算法。" -#: ../../whatsnew/3.13.rst:1550 +#: ../../whatsnew/3.13.rst:1565 msgid "" ":pypi:`passlib`: Comprehensive password hashing framework supporting over 30 " "schemes." -msgstr "" +msgstr ":pypi:`passlib`:支援超過 30 種方案的廣泛密碼雜湊框架。" -#: ../../whatsnew/3.13.rst:1552 +#: ../../whatsnew/3.13.rst:1567 msgid ":pypi:`argon2-cffi`: The secure Argon2 password hashing algorithm." -msgstr "" +msgstr ":pypi:`argon2-cffi`:安全的 Argon2 密碼雜湊演算法。" -#: ../../whatsnew/3.13.rst:1554 +#: ../../whatsnew/3.13.rst:1569 msgid "" ":pypi:`legacycrypt`: :mod:`ctypes` wrapper to the POSIX crypt library call " "and associated functionality." msgstr "" +":pypi:`legacycrypt`:對 POSIX crypt 函式庫呼叫及相關功能的 :mod:`ctypes` 包" +"裝。" -#: ../../whatsnew/3.13.rst:1557 +#: ../../whatsnew/3.13.rst:1572 +msgid "" +":pypi:`crypt_r`: Fork of the :mod:`!crypt` module, wrapper to " +"the :manpage:`crypt_r(3)` library call and associated functionality." +msgstr "" +":pypi:`crypt_r`:對 :mod:`!crypt` 模組的分支 (fork)," +"對 :manpage:`crypt_r(3)` 函式庫呼叫及相關功能的包裝。" + +#: ../../whatsnew/3.13.rst:1576 msgid "" -":pypi:`crypt_r`: Fork of the :mod:`!crypt` module, wrapper to the :manpage:" -"`crypt_r(3)` library call and associated functionality." +":pypi:`standard-crypt` and :pypi:`deprecated-crypt-alternative`: Use the " +"redistribution of ``crypt`` and reimplementation of ``_crypt`` libraries " +"from PyPI." msgstr "" +":pypi:`standard-crypt` 和 :pypi:`deprecated-crypt-alternative`:PyPI 上的 " +"``crypt`` 函式庫重新發布版和 ``_crypt`` 函式庫的重新實作。" -#: ../../whatsnew/3.13.rst:1562 +#: ../../whatsnew/3.13.rst:1579 msgid "" ":mod:`!imghdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements. For example, the :func:`!" "puremagic.what` function can be used to replace the :func:`!imghdr.what` " "function for all file formats that were supported by :mod:`!imghdr`." msgstr "" +":mod:`!imghdr`:請改用 :pypi:`filetype`、:pypi:`puremagic` 或 :pypi:`python-" +"magic` 函式庫。例如 :func:`!puremagic.what` 函式可以取代 :mod:`!imghdr` 過去" +"所支援所有文件格式的 :func:`!imghdr.what` 函式。" + +#: ../../whatsnew/3.13.rst:1586 +msgid "" +":pypi:`standard-imghdr`: Use the redistribution of ``imghdr`` library from " +"PyPI." +msgstr ":pypi:`standard-imghdr`:PyPI 上的 ``imghdr`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1568 +#: ../../whatsnew/3.13.rst:1589 msgid ":mod:`!mailcap`: Use the :mod:`mimetypes` module instead." -msgstr "" +msgstr ":mod:`!mailcap`:請改用 :mod:`mimetypes` 模組。" + +#: ../../whatsnew/3.13.rst:1592 +msgid "" +":pypi:`standard-mailcap`: Use the redistribution of ``mailcap`` library from " +"PyPI." +msgstr ":pypi:`standard-mailcap`:PyPI 上的 ``mailcap`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1570 +#: ../../whatsnew/3.13.rst:1595 msgid ":mod:`!msilib`" msgstr ":mod:`!msilib`" -#: ../../whatsnew/3.13.rst:1571 +#: ../../whatsnew/3.13.rst:1596 msgid ":mod:`!nis`" msgstr ":mod:`!nis`" -#: ../../whatsnew/3.13.rst:1572 +#: ../../whatsnew/3.13.rst:1597 msgid ":mod:`!nntplib`: Use the :pypi:`pynntp` library from PyPI instead." -msgstr "" +msgstr ":mod:`!nntplib`:請改用 PyPI 上的 :pypi:`pynntp` 函式庫。" -#: ../../whatsnew/3.13.rst:1574 +#: ../../whatsnew/3.13.rst:1600 +msgid "" +":pypi:`standard-nntplib`: Use the redistribution of ``nntplib`` library from " +"PyPI." +msgstr ":pypi:`standard-nntplib`:PyPI 上的 ``nntplib`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1603 msgid "" ":mod:`!ossaudiodev`: For audio playback, use the :pypi:`pygame` library from " "PyPI instead." msgstr "" +":mod:`!ossaudiodev`:音訊播放方面,請改用 PyPI 上的 :pypi:`pygame` 函式庫。" -#: ../../whatsnew/3.13.rst:1576 +#: ../../whatsnew/3.13.rst:1605 msgid "" -":mod:`!pipes`: Use the :mod:`subprocess` module instead. Use :func:`shlex." -"quote` to replace the undocumented ``pipes.quote`` function." +":mod:`!pipes`: Use the :mod:`subprocess` module instead. " +"Use :func:`shlex.quote` to replace the undocumented ``pipes.quote`` function." msgstr "" +":mod:`!pipes`:請改用 :mod:`subprocess` 模組。使用 :func:`shlex.quote` 來取代" +"未以文件紀錄的 ``pipes.quote`` 函式。" + +#: ../../whatsnew/3.13.rst:1610 +msgid "" +":pypi:`standard-pipes`: Use the redistribution of ``pipes`` library from " +"PyPI." +msgstr ":pypi:`standard-pipes`:PyPI 上的 ``pipes`` 函式庫重新發布版。" -#: ../../whatsnew/3.13.rst:1580 +#: ../../whatsnew/3.13.rst:1613 msgid "" ":mod:`!sndhdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" "magic` libraries should be used as replacements." msgstr "" +":mod:`!sndhdr`:請改用 :pypi:`filetype`、:pypi:`puremagic` 或 :pypi:`python-" +"magic` 函式庫。" -#: ../../whatsnew/3.13.rst:1583 +#: ../../whatsnew/3.13.rst:1617 +msgid "" +":pypi:`standard-sndhdr`: Use the redistribution of ``sndhdr`` library from " +"PyPI." +msgstr ":pypi:`standard-sndhdr`:PyPI 上的 ``sndhdr`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1620 msgid ":mod:`!spwd`: Use the :pypi:`python-pam` library from PyPI instead." -msgstr "" +msgstr ":mod:`!spwd`:請改用 PyPI 上的 :pypi:`python-pam` 函式庫。" -#: ../../whatsnew/3.13.rst:1585 +#: ../../whatsnew/3.13.rst:1622 msgid ":mod:`!sunau`" msgstr ":mod:`!sunau`" -#: ../../whatsnew/3.13.rst:1586 +#: ../../whatsnew/3.13.rst:1624 +msgid "" +":pypi:`standard-sunau`: Use the redistribution of ``sunau`` library from " +"PyPI." +msgstr ":pypi:`standard-sunau`:PyPI 上的 ``sunau`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1627 msgid "" ":mod:`!telnetlib`, Use the :pypi:`telnetlib3` or :pypi:`Exscript` libraries " "from PyPI instead." msgstr "" +":mod:`!telnetlib`:請改用 PyPI 上的 :pypi:`telnetlib3` 或 :pypi:`Exscript` 函" +"式庫。" -#: ../../whatsnew/3.13.rst:1588 +#: ../../whatsnew/3.13.rst:1630 +msgid "" +":pypi:`standard-telnetlib`: Use the redistribution of ``telnetlib`` library " +"from PyPI." +msgstr ":pypi:`standard-telnetlib`:PyPI 上的 ``telnetlib`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1633 msgid "" ":mod:`!uu`: Use the :mod:`base64` module instead, as a modern alternative." -msgstr "" +msgstr ":mod:`!uu`:請改用 :mod:`base64` 模組來作為當代的替代方案。" -#: ../../whatsnew/3.13.rst:1590 +#: ../../whatsnew/3.13.rst:1636 +msgid "" +":pypi:`standard-uu`: Use the redistribution of ``uu`` library from PyPI." +msgstr ":pypi:`standard-uu`:PyPI 上的 ``uu`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1639 msgid ":mod:`!xdrlib`" msgstr ":mod:`!xdrlib`" -#: ../../whatsnew/3.13.rst:1592 +#: ../../whatsnew/3.13.rst:1641 +msgid "" +":pypi:`standard-xdrlib`: Use the redistribution of ``xdrlib`` library from " +"PyPI." +msgstr ":pypi:`standard-xdrlib`:PyPI 上的 ``xdrlib`` 函式庫重新發布版。" + +#: ../../whatsnew/3.13.rst:1644 msgid "" -"(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` and :gh:" -"`104780`.)" +"(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` " +"and :gh:`104780`.)" msgstr "" "(由 Victor Stinner 和 Zachary Ware 在 :gh:`104773` 和 :gh:`104780` 中貢" "獻。)" -#: ../../whatsnew/3.13.rst:1596 +#: ../../whatsnew/3.13.rst:1648 msgid "2to3" msgstr "2to3" -#: ../../whatsnew/3.13.rst:1598 +#: ../../whatsnew/3.13.rst:1650 msgid "" "Remove the :program:`2to3` program and the :mod:`!lib2to3` module, " -"previously deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:" -"`104780`.)" +"previously deprecated in Python 3.11. (Contributed by Victor Stinner " +"in :gh:`104780`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1604 +#: ../../whatsnew/3.13.rst:1656 msgid "builtins" msgstr "builtins" -#: ../../whatsnew/3.13.rst:1606 +#: ../../whatsnew/3.13.rst:1658 msgid "" -"Remove support for chained :class:`classmethod` descriptors (introduced in :" -"gh:`63272`). These can no longer be used to wrap other descriptors, such as :" -"class:`property`. The core design of this feature was flawed and led to " +"Remove support for chained :class:`classmethod` descriptors (introduced " +"in :gh:`63272`). These can no longer be used to wrap other descriptors, such " +"as :class:`property`. The core design of this feature was flawed and led to " "several problems. To \"pass-through\" a :class:`classmethod`, consider using " "the :attr:`!__wrapped__` attribute that was added in Python 3.10. " "(Contributed by Raymond Hettinger in :gh:`89519`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1615 +#: ../../whatsnew/3.13.rst:1667 msgid "" "Raise a :exc:`RuntimeError` when calling :meth:`frame.clear` on a suspended " "frame (as has always been the case for an executing frame). (Contributed by " "Irit Katriel in :gh:`79932`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1623 +#: ../../whatsnew/3.13.rst:1675 msgid "" "Remove the undocumented :class:`!LegacyInterpolation` class, deprecated in " "the docstring since Python 3.2, and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104886`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1630 +#: ../../whatsnew/3.13.rst:1682 msgid "importlib.metadata" msgstr "importlib.metadata" -#: ../../whatsnew/3.13.rst:1632 +#: ../../whatsnew/3.13.rst:1684 msgid "" -"Remove deprecated subscript (:meth:`~object.__getitem__`) access for :ref:" -"`EntryPoint <entry-points>` objects. (Contributed by Jason R. Coombs in :gh:" -"`113175`.)" +"Remove deprecated subscript (:meth:`~object.__getitem__`) access " +"for :ref:`EntryPoint <entry-points>` objects. (Contributed by Jason R. " +"Coombs in :gh:`113175`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1638 +#: ../../whatsnew/3.13.rst:1690 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.13.rst:1640 +#: ../../whatsnew/3.13.rst:1692 msgid "" "Remove the :func:`!locale.resetlocale` function, deprecated in Python 3.11. " "Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. (Contributed by " "Victor Stinner in :gh:`104783`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1646 +#: ../../whatsnew/3.13.rst:1698 msgid "opcode" msgstr "opcode" -#: ../../whatsnew/3.13.rst:1648 +#: ../../whatsnew/3.13.rst:1700 msgid "" -"Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!_opcode." -"ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " +"Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!" +"_opcode.ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " "documented, and is not intended for external use. (Contributed by Irit " "Katriel in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1653 +#: ../../whatsnew/3.13.rst:1705 msgid "" -"Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, and :" -"attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but were " -"neither documented nor exposed through :mod:`dis`, and were not intended to " -"be used externally. (Contributed by Irit Katriel in :gh:`105481`.)" +"Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, " +"and :attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but " +"were neither documented nor exposed through :mod:`dis`, and were not " +"intended to be used externally. (Contributed by Irit Katriel " +"in :gh:`105481`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1661 +#: ../../whatsnew/3.13.rst:1713 msgid "optparse" msgstr "optparse" -#: ../../whatsnew/3.13.rst:1663 +#: ../../whatsnew/3.13.rst:1715 msgid "" -"This module is no longer considered :term:`soft deprecated`. While :mod:" -"`argparse` remains preferred for new projects that aren't using a third " -"party command line argument processing library, there are aspects of the way " -"``argparse`` works that mean the lower level ``optparse`` module may provide " -"a better foundation for *writing* argument processing libraries, and for " -"implementing command line applications which adhere more strictly than " +"This module is no longer considered :term:`soft deprecated`. " +"While :mod:`argparse` remains preferred for new projects that aren't using a " +"third party command line argument processing library, there are aspects of " +"the way ``argparse`` works that mean the lower level ``optparse`` module may " +"provide a better foundation for *writing* argument processing libraries, and " +"for implementing command line applications which adhere more strictly than " "``argparse`` does to various Unix command line processing conventions that " "originate in the behaviour of the C :c:func:`!getopt` function . " "(Contributed by Alyssa Coghlan and Serhiy Storchaka in :gh:`126180`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1679 +#: ../../whatsnew/3.13.rst:1731 msgid "" "Remove the ability to use :class:`~pathlib.Path` objects as context " "managers. This functionality was deprecated and has had no effect since " "Python 3.9. (Contributed by Barney Gale in :gh:`83863`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1687 +#: ../../whatsnew/3.13.rst:1739 msgid "" "Remove the undocumented, deprecated, and broken :func:`!re.template` " "function and :attr:`!re.TEMPLATE` / :attr:`!re.T` flag. (Contributed by " "Serhiy Storchaka and Nikita Sobolev in :gh:`105687`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1693 +#: ../../whatsnew/3.13.rst:1745 msgid "tkinter.tix" msgstr "tkinter.tix" -#: ../../whatsnew/3.13.rst:1695 +#: ../../whatsnew/3.13.rst:1747 msgid "" "Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6. The third-" "party Tix library which the module wrapped is unmaintained. (Contributed by " "Zachary Ware in :gh:`75552`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1701 +#: ../../whatsnew/3.13.rst:1753 msgid "turtle" msgstr "turtle" -#: ../../whatsnew/3.13.rst:1703 +#: ../../whatsnew/3.13.rst:1755 msgid "" "Remove the :meth:`!RawTurtle.settiltangle` method, deprecated in the " "documentation since Python 3.1 and at runtime since Python 3.11. " "(Contributed by Hugo van Kemenade in :gh:`104876`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1712 +#: ../../whatsnew/3.13.rst:1764 msgid "" "Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces, deprecated " "since Python 3.8. The items in those namespaces can be imported directly " -"from the :mod:`typing` module. (Contributed by Sebastian Rittau in :gh:" -"`92871`.)" +"from the :mod:`typing` module. (Contributed by Sebastian Rittau " +"in :gh:`92871`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1718 +#: ../../whatsnew/3.13.rst:1770 msgid "" "Remove the keyword-argument method of creating :class:`~typing.TypedDict` " -"types, deprecated in Python 3.11. (Contributed by Tomas Roun in :gh:" -"`104786`.)" +"types, deprecated in Python 3.11. (Contributed by Tomas Roun " +"in :gh:`104786`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1724 +#: ../../whatsnew/3.13.rst:1776 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.13.rst:1726 +#: ../../whatsnew/3.13.rst:1778 msgid "" "Remove the following :mod:`unittest` functions, deprecated in Python 3.11:" msgstr "移除以下在 Python 3.11 中已被棄用的 :mod:`unittest` 函式:" -#: ../../whatsnew/3.13.rst:1728 +#: ../../whatsnew/3.13.rst:1780 msgid ":func:`!unittest.findTestCases`" msgstr ":func:`!unittest.findTestCases`" -#: ../../whatsnew/3.13.rst:1729 +#: ../../whatsnew/3.13.rst:1781 msgid ":func:`!unittest.makeSuite`" msgstr ":func:`!unittest.makeSuite`" -#: ../../whatsnew/3.13.rst:1730 +#: ../../whatsnew/3.13.rst:1782 msgid ":func:`!unittest.getTestCaseNames`" msgstr ":func:`!unittest.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1732 +#: ../../whatsnew/3.13.rst:1784 msgid "Use :class:`~unittest.TestLoader` methods instead:" msgstr "" -#: ../../whatsnew/3.13.rst:1734 +#: ../../whatsnew/3.13.rst:1786 msgid ":meth:`~unittest.TestLoader.loadTestsFromModule`" msgstr ":meth:`~unittest.TestLoader.loadTestsFromModule`" -#: ../../whatsnew/3.13.rst:1735 +#: ../../whatsnew/3.13.rst:1787 msgid ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" msgstr ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" -#: ../../whatsnew/3.13.rst:1736 +#: ../../whatsnew/3.13.rst:1788 msgid ":meth:`~unittest.TestLoader.getTestCaseNames`" msgstr ":meth:`~unittest.TestLoader.getTestCaseNames`" -#: ../../whatsnew/3.13.rst:1738 +#: ../../whatsnew/3.13.rst:1790 msgid "(Contributed by Hugo van Kemenade in :gh:`104835`.)" msgstr "(由 Hugo van Kemenade 在 :gh:`104835` 中貢獻。)" -#: ../../whatsnew/3.13.rst:1740 +#: ../../whatsnew/3.13.rst:1792 msgid "" "Remove the untested and undocumented :meth:`!TestProgram.usageExit` method, " -"deprecated in Python 3.11. (Contributed by Hugo van Kemenade in :gh:" -"`104992`.)" +"deprecated in Python 3.11. (Contributed by Hugo van Kemenade " +"in :gh:`104992`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1746 +#: ../../whatsnew/3.13.rst:1798 msgid "urllib" msgstr "urllib" -#: ../../whatsnew/3.13.rst:1748 +#: ../../whatsnew/3.13.rst:1800 msgid "" -"Remove the *cafile*, *capath*, and *cadefault* parameters of the :func:" -"`urllib.request.urlopen` function, deprecated in Python 3.6. Use the " -"*context* parameter instead with an :class:`~ssl.SSLContext` instance. The :" -"meth:`ssl.SSLContext.load_cert_chain` function can be used to load specific " -"certificates, or let :func:`ssl.create_default_context` select the operating " -"system's trusted certificate authority (CA) certificates. (Contributed by " -"Victor Stinner in :gh:`105382`.)" +"Remove the *cafile*, *capath*, and *cadefault* parameters of " +"the :func:`urllib.request.urlopen` function, deprecated in Python 3.6. Use " +"the *context* parameter instead with an :class:`~ssl.SSLContext` instance. " +"The :meth:`ssl.SSLContext.load_cert_chain` function can be used to load " +"specific certificates, or let :func:`ssl.create_default_context` select the " +"operating system's trusted certificate authority (CA) certificates. " +"(Contributed by Victor Stinner in :gh:`105382`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1759 +#: ../../whatsnew/3.13.rst:1811 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.13.rst:1761 +#: ../../whatsnew/3.13.rst:1813 msgid "" "Remove the untested and undocumented :class:`!MacOSX` class, deprecated in " "Python 3.11. Use the :class:`!MacOSXOSAScript` class (introduced in Python " "3.2) instead. (Contributed by Hugo van Kemenade in :gh:`104804`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1766 +#: ../../whatsnew/3.13.rst:1818 msgid "" -"Remove the deprecated :attr:`!MacOSXOSAScript._name` attribute. Use the :" -"attr:`MacOSXOSAScript.name <webbrowser.controller.name>` attribute instead. " -"(Contributed by Nikita Sobolev in :gh:`105546`.)" +"Remove the deprecated :attr:`!MacOSXOSAScript._name` attribute. Use " +"the :attr:`MacOSXOSAScript.name <webbrowser.controller.name>` attribute " +"instead. (Contributed by Nikita Sobolev in :gh:`105546`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1773 +#: ../../whatsnew/3.13.rst:1825 msgid "New Deprecations" msgstr "" -#: ../../whatsnew/3.13.rst:1775 +#: ../../whatsnew/3.13.rst:1827 msgid ":ref:`User-defined functions <user-defined-funcs>`:" msgstr "" -#: ../../whatsnew/3.13.rst:1777 +#: ../../whatsnew/3.13.rst:1829 msgid "" "Deprecate assignment to a function's :attr:`~function.__code__` attribute, " "where the new code object's type does not match the function's type. The " @@ -2626,88 +2749,89 @@ msgid "" "coroutine. (Contributed by Irit Katriel in :gh:`81137`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1783 +#: ../../whatsnew/3.13.rst:1835 #: ../../deprecations/pending-removal-in-3.16.rst:11 msgid ":mod:`array`:" msgstr ":mod:`array`:" -#: ../../whatsnew/3.13.rst:1785 +#: ../../whatsnew/3.13.rst:1837 msgid "" "Deprecate the ``'u'`` format code (:c:type:`wchar_t`) at runtime. This " "format code has been deprecated in documentation since Python 3.3, and will " "be removed in Python 3.16. Use the ``'w'`` format code (:c:type:`Py_UCS4`) " -"for Unicode characters instead. (Contributed by Hugo van Kemenade in :gh:" -"`80480`.)" +"for Unicode characters instead. (Contributed by Hugo van Kemenade " +"in :gh:`80480`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1792 +#: ../../whatsnew/3.13.rst:1844 #: ../../deprecations/pending-removal-in-3.15.rst:16 msgid ":mod:`ctypes`:" msgstr ":mod:`ctypes`:" -#: ../../whatsnew/3.13.rst:1794 +#: ../../whatsnew/3.13.rst:1846 msgid "" "Deprecate the undocumented :func:`!SetPointerType` function, to be removed " "in Python 3.15. (Contributed by Victor Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1798 +#: ../../whatsnew/3.13.rst:1850 msgid "" ":term:`Soft-deprecate <soft deprecated>` the :func:`~ctypes.ARRAY` function " "in favour of ``type * length`` multiplication. (Contributed by Victor " "Stinner in :gh:`105733`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1802 +#: ../../whatsnew/3.13.rst:1854 msgid ":mod:`decimal`:" msgstr ":mod:`decimal`:" -#: ../../whatsnew/3.13.rst:1804 +#: ../../whatsnew/3.13.rst:1856 msgid "" "Deprecate the non-standard and undocumented :class:`~decimal.Decimal` format " "specifier ``'N'``, which is only supported in the :mod:`!decimal` module's C " "implementation. (Contributed by Serhiy Storchaka in :gh:`89902`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1809 +#: ../../whatsnew/3.13.rst:1861 msgid ":mod:`dis`:" msgstr ":mod:`dis`:" -#: ../../whatsnew/3.13.rst:1811 +#: ../../whatsnew/3.13.rst:1863 msgid "" -"Deprecate the :attr:`!HAVE_ARGUMENT` separator. Check membership in :data:" -"`~dis.hasarg` instead. (Contributed by Irit Katriel in :gh:`109319`.)" +"Deprecate the :attr:`!HAVE_ARGUMENT` separator. Check membership " +"in :data:`~dis.hasarg` instead. (Contributed by Irit Katriel " +"in :gh:`109319`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1815 +#: ../../whatsnew/3.13.rst:1867 msgid ":mod:`gettext`:" msgstr ":mod:`gettext`:" -#: ../../whatsnew/3.13.rst:1817 +#: ../../whatsnew/3.13.rst:1869 msgid "" "Deprecate non-integer numbers as arguments to functions and methods that " "consider plural forms in the :mod:`!gettext` module, even if no translation " "was found. (Contributed by Serhiy Storchaka in :gh:`88434`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1822 +#: ../../whatsnew/3.13.rst:1874 msgid ":mod:`glob`:" msgstr ":mod:`glob`:" -#: ../../whatsnew/3.13.rst:1824 +#: ../../whatsnew/3.13.rst:1876 msgid "" -"Deprecate the undocumented :func:`!glob0` and :func:`!glob1` functions. Use :" -"func:`~glob.glob` and pass a :term:`path-like object` specifying the root " -"directory to the *root_dir* parameter instead. (Contributed by Barney Gale " -"in :gh:`117337`.)" +"Deprecate the undocumented :func:`!glob0` and :func:`!glob1` functions. " +"Use :func:`~glob.glob` and pass a :term:`path-like object` specifying the " +"root directory to the *root_dir* parameter instead. (Contributed by Barney " +"Gale in :gh:`117337`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1829 +#: ../../whatsnew/3.13.rst:1881 #: ../../deprecations/pending-removal-in-3.15.rst:21 msgid ":mod:`http.server`:" msgstr ":mod:`http.server`:" -#: ../../whatsnew/3.13.rst:1831 +#: ../../whatsnew/3.13.rst:1883 msgid "" "Deprecate :class:`~http.server.CGIHTTPRequestHandler`, to be removed in " "Python 3.15. Process-based CGI HTTP servers have been out of favor for a " @@ -2716,29 +2840,29 @@ msgid "" "by Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1838 +#: ../../whatsnew/3.13.rst:1890 msgid "" "Deprecate the :option:`!--cgi` flag to the :program:`python -m http.server` " "command-line interface, to be removed in Python 3.15. (Contributed by " "Gregory P. Smith in :gh:`109096`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1843 +#: ../../whatsnew/3.13.rst:1895 msgid ":mod:`mimetypes`:" msgstr ":mod:`mimetypes`:" -#: ../../whatsnew/3.13.rst:1845 +#: ../../whatsnew/3.13.rst:1897 msgid "" -":term:`Soft-deprecate <soft deprecated>` file path arguments to :func:" -"`~mimetypes.guess_type`, use :func:`~mimetypes.guess_file_type` instead. " -"(Contributed by Serhiy Storchaka in :gh:`66543`.)" +":term:`Soft-deprecate <soft deprecated>` file path arguments " +"to :func:`~mimetypes.guess_type`, use :func:`~mimetypes.guess_file_type` " +"instead. (Contributed by Serhiy Storchaka in :gh:`66543`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1850 +#: ../../whatsnew/3.13.rst:1902 msgid ":mod:`re`:" msgstr ":mod:`re`:" -#: ../../whatsnew/3.13.rst:1852 +#: ../../whatsnew/3.13.rst:1904 msgid "" "Deprecate passing the optional *maxsplit*, *count*, or *flags* arguments as " "positional arguments to the module-level :func:`~re.split`, :func:`~re.sub`, " @@ -2747,131 +2871,132 @@ msgid "" "by Serhiy Storchaka in :gh:`56166`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1859 +#: ../../whatsnew/3.13.rst:1911 #: ../../deprecations/pending-removal-in-3.15.rst:42 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../whatsnew/3.13.rst:1861 +#: ../../whatsnew/3.13.rst:1913 msgid "" -"Deprecate :meth:`.PurePath.is_reserved`, to be removed in Python 3.15. Use :" -"func:`os.path.isreserved` to detect reserved paths on Windows. (Contributed " -"by Barney Gale in :gh:`88569`.)" +"Deprecate :meth:`.PurePath.is_reserved`, to be removed in Python 3.15. " +"Use :func:`os.path.isreserved` to detect reserved paths on Windows. " +"(Contributed by Barney Gale in :gh:`88569`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1866 +#: ../../whatsnew/3.13.rst:1918 #: ../../deprecations/pending-removal-in-3.15.rst:48 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../whatsnew/3.13.rst:1868 +#: ../../whatsnew/3.13.rst:1920 msgid "" "Deprecate :func:`~platform.java_ver`, to be removed in Python 3.15. This " "function is only useful for Jython support, has a confusing API, and is " "largely untested. (Contributed by Nikita Sobolev in :gh:`116349`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1874 +#: ../../whatsnew/3.13.rst:1926 msgid ":mod:`pydoc`:" msgstr ":mod:`pydoc`:" -#: ../../whatsnew/3.13.rst:1876 +#: ../../whatsnew/3.13.rst:1928 msgid "" "Deprecate the undocumented :func:`!ispackage` function. (Contributed by " "Zackery Spytz in :gh:`64020`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1879 +#: ../../whatsnew/3.13.rst:1931 #: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../whatsnew/3.13.rst:1881 +#: ../../whatsnew/3.13.rst:1933 msgid "" -"Deprecate passing more than one positional argument to the :func:`~sqlite3." -"connect` function and the :class:`~sqlite3.Connection` constructor. The " -"remaining parameters will become keyword-only in Python 3.15. (Contributed " -"by Erlend E. Aasland in :gh:`107948`.)" +"Deprecate passing more than one positional argument to " +"the :func:`~sqlite3.connect` function and the :class:`~sqlite3.Connection` " +"constructor. The remaining parameters will become keyword-only in Python " +"3.15. (Contributed by Erlend E. Aasland in :gh:`107948`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1887 +#: ../../whatsnew/3.13.rst:1939 msgid "" "Deprecate passing name, number of arguments, and the callable as keyword " -"arguments for :meth:`.Connection.create_function` and :meth:`.Connection." -"create_aggregate` These parameters will become positional-only in Python " -"3.15. (Contributed by Erlend E. Aasland in :gh:`108278`.)" +"arguments for :meth:`.Connection.create_function` " +"and :meth:`.Connection.create_aggregate` These parameters will become " +"positional-only in Python 3.15. (Contributed by Erlend E. Aasland " +"in :gh:`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1893 +#: ../../whatsnew/3.13.rst:1945 msgid "" -"Deprecate passing the callback callable by keyword for the :meth:`~sqlite3." -"Connection.set_authorizer`, :meth:`~sqlite3.Connection." -"set_progress_handler`, and :meth:`~sqlite3.Connection.set_trace_callback` :" -"class:`~sqlite3.Connection` methods. The callback callables will become " -"positional-only in Python 3.15. (Contributed by Erlend E. Aasland in :gh:" -"`108278`.)" +"Deprecate passing the callback callable by keyword for " +"the :meth:`~sqlite3.Connection.set_authorizer`, :meth:`~sqlite3.Connection.set_progress_handler`, " +"and :meth:`~sqlite3.Connection.set_trace_callback` :class:`~sqlite3.Connection` " +"methods. The callback callables will become positional-only in Python 3.15. " +"(Contributed by Erlend E. Aasland in :gh:`108278`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1901 +#: ../../whatsnew/3.13.rst:1953 #: ../../deprecations/pending-removal-in-3.16.rst:47 msgid ":mod:`sys`:" msgstr ":mod:`sys`:" -#: ../../whatsnew/3.13.rst:1903 +#: ../../whatsnew/3.13.rst:1955 msgid "" "Deprecate the :func:`~sys._enablelegacywindowsfsencoding` function, to be " "removed in Python 3.16. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable instead. (Contributed by Inada Naoki in :gh:`73427`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1908 +#: ../../whatsnew/3.13.rst:1960 #: ../../deprecations/pending-removal-in-3.16.rst:53 msgid ":mod:`tarfile`:" msgstr ":mod:`tarfile`:" -#: ../../whatsnew/3.13.rst:1910 +#: ../../whatsnew/3.13.rst:1962 msgid "" "Deprecate the undocumented and unused :attr:`!TarFile.tarfile` attribute, to " "be removed in Python 3.16. (Contributed in :gh:`115256`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1914 +#: ../../whatsnew/3.13.rst:1966 msgid ":mod:`traceback`:" msgstr ":mod:`traceback`:" -#: ../../whatsnew/3.13.rst:1916 +#: ../../whatsnew/3.13.rst:1968 msgid "" -"Deprecate the :attr:`.TracebackException.exc_type` attribute. Use :attr:`." -"TracebackException.exc_type_str` instead. (Contributed by Irit Katriel in :" -"gh:`112332`.)" +"Deprecate the :attr:`.TracebackException.exc_type` attribute. " +"Use :attr:`.TracebackException.exc_type_str` instead. (Contributed by Irit " +"Katriel in :gh:`112332`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1920 +#: ../../whatsnew/3.13.rst:1972 #: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../whatsnew/3.13.rst:1922 +#: ../../whatsnew/3.13.rst:1974 msgid "" -"Deprecate the undocumented keyword argument syntax for creating :class:" -"`~typing.NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, " -"y=int)``), to be removed in Python 3.15. Use the class-based syntax or the " -"functional syntax instead. (Contributed by Alex Waygood in :gh:`105566`.)" +"Deprecate the undocumented keyword argument syntax for " +"creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " +"NamedTuple(\"Point\", x=int, y=int)``), to be removed in Python 3.15. Use " +"the class-based syntax or the functional syntax instead. (Contributed by " +"Alex Waygood in :gh:`105566`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1929 +#: ../../whatsnew/3.13.rst:1981 msgid "" -"Deprecate omitting the *fields* parameter when creating a :class:`~typing." -"NamedTuple` or :class:`typing.TypedDict` class, and deprecate passing " -"``None`` to the *fields* parameter of both types. Python 3.15 will require a " -"valid sequence for the *fields* parameter. To create a NamedTuple class with " -"zero fields, use ``class NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", " -"())``. To create a TypedDict class with zero fields, use ``class " -"TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``. (Contributed by " -"Alex Waygood in :gh:`105566` and :gh:`105570`.)" +"Deprecate omitting the *fields* parameter when creating " +"a :class:`~typing.NamedTuple` or :class:`typing.TypedDict` class, and " +"deprecate passing ``None`` to the *fields* parameter of both types. Python " +"3.15 will require a valid sequence for the *fields* parameter. To create a " +"NamedTuple class with zero fields, use ``class NT(NamedTuple): pass`` or " +"``NT = NamedTuple(\"NT\", ())``. To create a TypedDict class with zero " +"fields, use ``class TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``. " +"(Contributed by Alex Waygood in :gh:`105566` and :gh:`105570`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1939 +#: ../../whatsnew/3.13.rst:1991 msgid "" "Deprecate the :func:`typing.no_type_check_decorator` decorator function, to " "be removed in in Python 3.15. After eight years in the :mod:`typing` module, " @@ -2879,7 +3004,7 @@ msgid "" "Waygood in :gh:`106309`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1945 +#: ../../whatsnew/3.13.rst:1997 msgid "" "Deprecate :data:`typing.AnyStr`. In Python 3.16, it will be removed from " "``typing.__all__``, and a :exc:`DeprecationWarning` will be emitted at " @@ -2888,17 +3013,17 @@ msgid "" "(Contributed by Michael The in :gh:`107116`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1953 +#: ../../whatsnew/3.13.rst:2005 #: ../../deprecations/pending-removal-in-3.15.rst:84 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../whatsnew/3.13.rst:1955 +#: ../../whatsnew/3.13.rst:2007 msgid "" -"Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:" -"`~wave.Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :" -"class:`~wave.Wave_write` classes, to be removed in Python 3.15. (Contributed " -"by Victor Stinner in :gh:`105096`.)" +"Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " +"and :meth:`~wave.Wave_read.getmarkers` methods of " +"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes, to be " +"removed in Python 3.15. (Contributed by Victor Stinner in :gh:`105096`.)" msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:2 @@ -2947,8 +3072,8 @@ msgstr ":class:`!ast.Ellipsis`" #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" -"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" -"`90953`.)" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka " +"in :gh:`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" @@ -2959,27 +3084,26 @@ msgstr ":mod:`asyncio`:" #: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" -"The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" -"`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" -"class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " +"The child watcher " +"classes :class:`~asyncio.MultiLoopChildWatcher`, :class:`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` " +"and :class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " "Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`~asyncio." -"MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio." -"AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " -"Aditya 於 :gh:`94597` 貢獻。)" +"已棄用並將在 Python 3.14 中移除的 child watcher 類" +"別::class:`~asyncio.MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio.AbstractChildWatcher` " +"和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar Aditya 於 :gh:`94597` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" -":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" -"`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." -"AbstractEventLoopPolicy.get_child_watcher` are deprecated and will be " -"removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " +"and :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated " +"and will be removed in Python 3.14. (Contributed by Kumar Aditya " +"in :gh:`94597`.)" msgstr "" -":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:" -"`asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`asyncio." -"AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" -"除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" +":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " +"和 :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 " +"Python 3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" @@ -2996,18 +3120,21 @@ msgstr "" msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." -"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" -msgstr "" -":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改用 :" -"class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用時,請" -"改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " -"Shantanu Jain 於 :gh:`91896` 貢獻。)" +"typing, prefer a union, like ``bytes | bytearray``, " +"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " +"in :gh:`91896`.)" +msgstr "" +":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改" +"用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" +"時,請改用聯集,如 ``bytes | bytearray``," +"或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" -":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." -"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" +":mod:`email`: Deprecated the *isdst* parameter " +"in :func:`email.utils.localtime`. (Contributed by Alan Williams " +"in :gh:`72346`.)" msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" @@ -3061,24 +3188,25 @@ msgid "" "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " "currently the default (:gh:`84559`). Adding a runtime warning about this was " "deemed too disruptive as the majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." -"set_start_method` APIs to explicitly specify when your code *requires* " -"``'fork'``. See :ref:`multiprocessing-start-methods`." +"the :func:`~multiprocessing.get_context` " +"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " +"your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`." msgstr "" ":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平" "台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。對此增加一" -"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用 :func:" -"`~multiprocessing.get_context` 或 :func:`~multiprocessing.set_start_method` " -"API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" -"`multiprocessing-start-methods`。" +"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使" +"用 :func:`~multiprocessing.get_context` " +"或 :func:`~multiprocessing.set_start_method` API 來明確指定你的程式碼何時\\ *" +"需要* ``'fork'``。請參閱 :ref:`multiprocessing-start-methods`。" #: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" -":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." -"PurePath.relative_to`: passing additional arguments is deprecated." +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` " +"and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments is " +"deprecated." msgstr "" -":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" -"`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" +":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` " +"和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" #: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" @@ -3087,8 +3215,9 @@ msgid "" "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`~pkgutil.find_loader` 和 :func:`~pkgutil.get_loader` " -"現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." -"find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" +"現在會引發 :exc:`DeprecationWarning`;請改" +"用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" @@ -3108,9 +3237,9 @@ msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" #: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" -":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" -"ref:`named placeholders <sqlite3-placeholders>` are used and *parameters* is " -"a sequence instead of a :class:`dict`." +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` " +"if :ref:`named placeholders <sqlite3-placeholders>` are used and " +"*parameters* is a sequence instead of a :class:`dict`." msgstr "" ":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如果" "使用 :ref:`named placeholders <sqlite3-placeholders>` 且 *parameters* 是序列" @@ -3127,8 +3256,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " -"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" -"`88168`.)" +"intended to be a public API. (Contributed by Gregory P. Smith " +"in :gh:`88168`.)" msgstr "" ":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 API。" "(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" @@ -3145,10 +3274,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" -"`__spec__.cached <importlib.machinery.ModuleSpec.cached>` is deprecated. In " -"Python 3.15, :attr:`!__cached__` will cease to be set or take into " -"consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to " +"set :attr:`__spec__.cached <importlib.machinery.ModuleSpec.cached>` is " +"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " +"into consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "<importlib.machinery.ModuleSpec.cached>` 的做法已被棄用。在 Python 3.15 中," @@ -3156,10 +3285,11 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to set :attr:" -"`__spec__.parent <importlib.machinery.ModuleSpec.parent>` is deprecated. In " -"Python 3.15, :attr:`!__package__` will cease to be set or take into " -"consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to " +"set :attr:`__spec__.parent <importlib.machinery.ModuleSpec.parent>` is " +"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " +"take into consideration by the import system or standard library. " +"(:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "<importlib.machinery.ModuleSpec.parent>` 的做法已被棄用。在 Python 3.15 中," @@ -3197,23 +3327,25 @@ msgstr ":class:`locale`:" #: ../../deprecations/pending-removal-in-3.15.rst:34 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" -"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." -"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " -"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 " +"(:gh:`90817`), but has been postponed to Python 3.15. " +"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " +"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " +"in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" -"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." -"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" +"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " +"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:44 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" -"func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " +"Use :func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." -"isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" +"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" #: ../../deprecations/pending-removal-in-3.15.rst:50 msgid "" @@ -3251,16 +3383,16 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" -"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" -"`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" +"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " +"於 :gh:`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" -"The undocumented keyword argument syntax for creating :class:`~typing." -"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " -"has been deprecated since Python 3.13. Use the class-based syntax or the " -"functional syntax instead." +"The undocumented keyword argument syntax for " +"creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " +"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " +"3.13. Use the class-based syntax or the functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" @@ -3278,13 +3410,14 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:86 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." -"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" -"`~wave.Wave_write` classes have been deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " +"and :meth:`~wave.Wave_read.getmarkers` methods of " +"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " +"deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" -"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." -"getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" +"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " +"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending removal in Python 3.16" @@ -3292,10 +3425,10 @@ msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" -"`__spec__.loader <importlib.machinery.ModuleSpec.loader>` is deprecated. In " -"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " -"consideration by the import system or the standard library." +"Setting :attr:`~module.__loader__` on a module while failing to " +"set :attr:`__spec__.loader <importlib.machinery.ModuleSpec.loader>` is " +"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " +"taken into consideration by the import system or the standard library." msgstr "" "在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " "<importlib.machinery.ModuleSpec.loader>` 的做法將於 Python 3.16 被棄用。在 " @@ -3318,8 +3451,8 @@ msgid "" "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" ":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" -"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" -"gh:`122875` 貢獻。)" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " +"於 :gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 #: ../../deprecations/pending-removal-in-future.rst:12 @@ -3421,17 +3554,17 @@ msgid "" "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " -"if the numeric literal is immediately followed by one of keywords :keyword:" -"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" -"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " -"syntax error. (:gh:`87999`)" +"if the numeric literal is immediately followed by one of " +"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " +"and :keyword:`or`. In a future release it will be changed to a syntax " +"error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " "1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " -"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" -"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" -"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" -"本中,它將被更改為語法錯誤。(:gh:`87999`)" +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" +"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " +"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" +"法錯誤。(:gh:`87999`)" #: ../../deprecations/pending-removal-in-future.rst:26 msgid "" @@ -3444,18 +3577,18 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:29 msgid "" -"Support for ``__float__()`` method returning a strict subclass of :class:" -"`float`: these methods will be required to return an instance of :class:" -"`float`." +"Support for ``__float__()`` method returning a strict subclass " +"of :class:`float`: these methods will be required to return an instance " +"of :class:`float`." msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" #: ../../deprecations/pending-removal-in-future.rst:32 msgid "" -"Support for ``__complex__()`` method returning a strict subclass of :class:" -"`complex`: these methods will be required to return an instance of :class:" -"`complex`." +"Support for ``__complex__()`` method returning a strict subclass " +"of :class:`complex`: these methods will be required to return an instance " +"of :class:`complex`." msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" @@ -3466,10 +3599,10 @@ msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" #: ../../deprecations/pending-removal-in-future.rst:36 msgid "" -"Passing a complex number as the *real* or *imag* argument in the :func:" -"`complex` constructor is now deprecated; it should only be passed as a " -"single positional argument. (Contributed by Serhiy Storchaka in :gh:" -"`109218`.)" +"Passing a complex number as the *real* or *imag* argument in " +"the :func:`complex` constructor is now deprecated; it should only be passed " +"as a single positional argument. (Contributed by Serhiy Storchaka " +"in :gh:`109218`.)" msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" @@ -3477,8 +3610,9 @@ msgstr "" #: ../../deprecations/pending-removal-in-future.rst:41 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " -"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." -"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" +"are deprecated and replaced by :data:`calendar.JANUARY` " +"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " +"in :gh:`103636`.)" msgstr "" ":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " @@ -3497,19 +3631,19 @@ msgstr ":mod:`datetime`:" #: ../../deprecations/pending-removal-in-future.rst:51 msgid "" -":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." -"UTC)``." +":meth:`~datetime.datetime.utcnow`: use " +"``datetime.datetime.now(tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." -"now(tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcnow`:請改用 " +"``datetime.datetime.now(tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:53 msgid "" -":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." -"fromtimestamp(timestamp, tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcfromtimestamp`: use " +"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." -"fromtimestamp(timestamp, tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " +"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" #: ../../deprecations/pending-removal-in-future.rst:56 msgid ":mod:`gettext`: Plural value must be an integer." @@ -3548,8 +3682,8 @@ msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" -":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" -"`~logging.warning`。" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" +"用 :meth:`~logging.warning`。" #: ../../deprecations/pending-removal-in-future.rst:72 msgid "" @@ -3606,11 +3740,11 @@ msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" #: ../../deprecations/pending-removal-in-future.rst:95 msgid "" -":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" -"`!selected_npn_protocol` are deprecated: use ALPN instead." +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " +"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" -":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" -"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " +"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" #: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.OP_NO_SSL*`` options" @@ -3665,11 +3799,11 @@ msgstr ":mod:`threading` 方法:" #: ../../deprecations/pending-removal-in-future.rst:114 msgid "" -":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." -"notify_all`." +":meth:`!threading.Condition.notifyAll`: " +"use :meth:`~threading.Condition.notify_all`." msgstr "" -":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." -"notify_all`。" +":meth:`!threading.Condition.notifyAll`:請" +"用 :meth:`~threading.Condition.notify_all`。" #: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." @@ -3677,19 +3811,19 @@ msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set` #: ../../deprecations/pending-removal-in-future.rst:116 msgid "" -":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" -"attr:`threading.Thread.daemon` attribute." +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " +"use :attr:`threading.Thread.daemon` attribute." msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:118 msgid "" -":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" -"attr:`threading.Thread.name` attribute." +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " +"use :attr:`threading.Thread.name` attribute." msgstr "" -":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" -"attr:`threading.Thread.name` 屬性。" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" +"用 :attr:`threading.Thread.name` 屬性。" #: ../../deprecations/pending-removal-in-future.rst:120 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." @@ -3765,13 +3899,13 @@ msgstr "``to_bytes()``" #: ../../deprecations/pending-removal-in-future.rst:142 msgid "" -":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" -"`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " -"Use newer :func:`~urllib.request.urlopen` functions and methods." +":mod:`urllib.request`: :class:`~urllib.request.URLopener` " +"and :class:`~urllib.request.FancyURLopener` style of invoking requests is " +"deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods." msgstr "" -":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` 和 :" -"class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" -"`~urllib.request.urlopen` 函式和方法。" +":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` " +"和 :class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新" +"的 :func:`~urllib.request.urlopen` 函式和方法。" #: ../../deprecations/pending-removal-in-future.rst:146 msgid "" @@ -3781,268 +3915,269 @@ msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分 #: ../../deprecations/pending-removal-in-future.rst:149 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." -"etree.ElementTree.Element` is deprecated. In a future release it will always " -"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " -"instead." +":mod:`xml.etree.ElementTree`: Testing the truth value of " +"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " +"release it will always return ``True``. Prefer explicit ``len(elem)`` or " +"``elem is not None`` tests instead." msgstr "" -":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." -"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " -"``len(elem)`` 或 ``elem is not None`` 測試。" +":mod:`xml.etree.ElementTree`:已棄用" +"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" +"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" #: ../../deprecations/pending-removal-in-future.rst:154 msgid "" -":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" -"`~zipimport.zipimporter.exec_module` instead." +":meth:`zipimport.zipimporter.load_module` is deprecated: " +"use :meth:`~zipimport.zipimporter.exec_module` instead." msgstr "" -":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." -"zipimporter.exec_module`。" +":meth:`zipimport.zipimporter.load_module` 已被棄用:請改" +"用 :meth:`~zipimport.zipimporter.exec_module`。" -#: ../../whatsnew/3.13.rst:1972 +#: ../../whatsnew/3.13.rst:2024 msgid "CPython Bytecode Changes" msgstr "" -#: ../../whatsnew/3.13.rst:1974 +#: ../../whatsnew/3.13.rst:2026 msgid "" "The oparg of :opcode:`YIELD_VALUE` is now ``1`` if the yield is part of a " "yield-from or await, and ``0`` otherwise. The oparg of :opcode:`RESUME` was " "changed to add a bit indicating if the except-depth is 1, which is needed to " -"optimize closing of generators. (Contributed by Irit Katriel in :gh:" -"`111354`.)" +"optimize closing of generators. (Contributed by Irit Katriel " +"in :gh:`111354`.)" msgstr "" -#: ../../whatsnew/3.13.rst:1982 +#: ../../whatsnew/3.13.rst:2034 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.13.rst:1987 +#: ../../whatsnew/3.13.rst:2039 msgid "" -"Add the :ref:`PyMonitoring C API <c-api-monitoring>` for generating :pep:" -"`669` monitoring events:" +"Add the :ref:`PyMonitoring C API <c-api-monitoring>` for " +"generating :pep:`669` monitoring events:" msgstr "" -#: ../../whatsnew/3.13.rst:1990 +#: ../../whatsnew/3.13.rst:2042 msgid ":c:type:`PyMonitoringState`" msgstr ":c:type:`PyMonitoringState`" -#: ../../whatsnew/3.13.rst:1991 +#: ../../whatsnew/3.13.rst:2043 msgid ":c:func:`PyMonitoring_FirePyStartEvent`" msgstr ":c:func:`PyMonitoring_FirePyStartEvent`" -#: ../../whatsnew/3.13.rst:1992 +#: ../../whatsnew/3.13.rst:2044 msgid ":c:func:`PyMonitoring_FirePyResumeEvent`" msgstr ":c:func:`PyMonitoring_FirePyResumeEvent`" -#: ../../whatsnew/3.13.rst:1993 +#: ../../whatsnew/3.13.rst:2045 msgid ":c:func:`PyMonitoring_FirePyReturnEvent`" msgstr ":c:func:`PyMonitoring_FirePyReturnEvent`" -#: ../../whatsnew/3.13.rst:1994 +#: ../../whatsnew/3.13.rst:2046 msgid ":c:func:`PyMonitoring_FirePyYieldEvent`" msgstr ":c:func:`PyMonitoring_FirePyYieldEvent`" -#: ../../whatsnew/3.13.rst:1995 +#: ../../whatsnew/3.13.rst:2047 msgid ":c:func:`PyMonitoring_FireCallEvent`" msgstr ":c:func:`PyMonitoring_FireCallEvent`" -#: ../../whatsnew/3.13.rst:1996 +#: ../../whatsnew/3.13.rst:2048 msgid ":c:func:`PyMonitoring_FireLineEvent`" msgstr ":c:func:`PyMonitoring_FireLineEvent`" -#: ../../whatsnew/3.13.rst:1997 +#: ../../whatsnew/3.13.rst:2049 msgid ":c:func:`PyMonitoring_FireJumpEvent`" msgstr ":c:func:`PyMonitoring_FireJumpEvent`" -#: ../../whatsnew/3.13.rst:1998 +#: ../../whatsnew/3.13.rst:2050 msgid ":c:func:`PyMonitoring_FireBranchEvent`" msgstr ":c:func:`PyMonitoring_FireBranchEvent`" -#: ../../whatsnew/3.13.rst:1999 +#: ../../whatsnew/3.13.rst:2051 msgid ":c:func:`PyMonitoring_FireCReturnEvent`" msgstr ":c:func:`PyMonitoring_FireCReturnEvent`" -#: ../../whatsnew/3.13.rst:2000 +#: ../../whatsnew/3.13.rst:2052 msgid ":c:func:`PyMonitoring_FirePyThrowEvent`" msgstr ":c:func:`PyMonitoring_FirePyThrowEvent`" -#: ../../whatsnew/3.13.rst:2001 +#: ../../whatsnew/3.13.rst:2053 msgid ":c:func:`PyMonitoring_FireRaiseEvent`" msgstr ":c:func:`PyMonitoring_FireRaiseEvent`" -#: ../../whatsnew/3.13.rst:2002 +#: ../../whatsnew/3.13.rst:2054 msgid ":c:func:`PyMonitoring_FireCRaiseEvent`" msgstr ":c:func:`PyMonitoring_FireCRaiseEvent`" -#: ../../whatsnew/3.13.rst:2003 +#: ../../whatsnew/3.13.rst:2055 msgid ":c:func:`PyMonitoring_FireReraiseEvent`" msgstr ":c:func:`PyMonitoring_FireReraiseEvent`" -#: ../../whatsnew/3.13.rst:2004 +#: ../../whatsnew/3.13.rst:2056 msgid ":c:func:`PyMonitoring_FireExceptionHandledEvent`" msgstr ":c:func:`PyMonitoring_FireExceptionHandledEvent`" -#: ../../whatsnew/3.13.rst:2005 +#: ../../whatsnew/3.13.rst:2057 msgid ":c:func:`PyMonitoring_FirePyUnwindEvent`" msgstr ":c:func:`PyMonitoring_FirePyUnwindEvent`" -#: ../../whatsnew/3.13.rst:2006 +#: ../../whatsnew/3.13.rst:2058 msgid ":c:func:`PyMonitoring_FireStopIterationEvent`" msgstr ":c:func:`PyMonitoring_FireStopIterationEvent`" -#: ../../whatsnew/3.13.rst:2007 +#: ../../whatsnew/3.13.rst:2059 msgid ":c:func:`PyMonitoring_EnterScope`" msgstr ":c:func:`PyMonitoring_EnterScope`" -#: ../../whatsnew/3.13.rst:2008 +#: ../../whatsnew/3.13.rst:2060 msgid ":c:func:`PyMonitoring_ExitScope`" msgstr ":c:func:`PyMonitoring_ExitScope`" -#: ../../whatsnew/3.13.rst:2010 +#: ../../whatsnew/3.13.rst:2062 msgid "(Contributed by Irit Katriel in :gh:`111997`)." msgstr "(由 Irit Katriel 在 :gh:`111997` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2012 +#: ../../whatsnew/3.13.rst:2064 msgid "" "Add :c:type:`PyMutex`, a lightweight mutex that occupies a single byte, and " -"the new :c:func:`PyMutex_Lock` and :c:func:`PyMutex_Unlock` functions. :c:" -"func:`!PyMutex_Lock` will release the :term:`GIL` (if currently held) if the " -"operation needs to block. (Contributed by Sam Gross in :gh:`108724`.)" +"the new :c:func:`PyMutex_Lock` and :c:func:`PyMutex_Unlock` " +"functions. :c:func:`!PyMutex_Lock` will release the :term:`GIL` (if " +"currently held) if the operation needs to block. (Contributed by Sam Gross " +"in :gh:`108724`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2018 +#: ../../whatsnew/3.13.rst:2070 msgid "" "Add the :ref:`PyTime C API <c-api-time>` to provide access to system clocks:" msgstr "" -#: ../../whatsnew/3.13.rst:2020 +#: ../../whatsnew/3.13.rst:2072 msgid ":c:type:`PyTime_t`." msgstr ":c:type:`PyTime_t`。" -#: ../../whatsnew/3.13.rst:2021 +#: ../../whatsnew/3.13.rst:2073 msgid ":c:var:`PyTime_MIN` and :c:var:`PyTime_MAX`." msgstr "" -#: ../../whatsnew/3.13.rst:2022 +#: ../../whatsnew/3.13.rst:2074 msgid ":c:func:`PyTime_AsSecondsDouble`." msgstr ":c:func:`PyTime_AsSecondsDouble`。" -#: ../../whatsnew/3.13.rst:2023 +#: ../../whatsnew/3.13.rst:2075 msgid ":c:func:`PyTime_Monotonic`." msgstr ":c:func:`PyTime_Monotonic`。" -#: ../../whatsnew/3.13.rst:2024 +#: ../../whatsnew/3.13.rst:2076 msgid ":c:func:`PyTime_MonotonicRaw`." msgstr ":c:func:`PyTime_MonotonicRaw`。" -#: ../../whatsnew/3.13.rst:2025 +#: ../../whatsnew/3.13.rst:2077 msgid ":c:func:`PyTime_PerfCounter`." msgstr ":c:func:`PyTime_PerfCounter`。" -#: ../../whatsnew/3.13.rst:2026 +#: ../../whatsnew/3.13.rst:2078 msgid ":c:func:`PyTime_PerfCounterRaw`." msgstr ":c:func:`PyTime_PerfCounterRaw`。" -#: ../../whatsnew/3.13.rst:2027 +#: ../../whatsnew/3.13.rst:2079 msgid ":c:func:`PyTime_Time`." msgstr ":c:func:`PyTime_Time`。" -#: ../../whatsnew/3.13.rst:2028 +#: ../../whatsnew/3.13.rst:2080 msgid ":c:func:`PyTime_TimeRaw`." msgstr ":c:func:`PyTime_TimeRaw`。" -#: ../../whatsnew/3.13.rst:2030 +#: ../../whatsnew/3.13.rst:2082 msgid "(Contributed by Victor Stinner and Petr Viktorin in :gh:`110850`.)" msgstr "(由 Victor Stinner 和 Petr Viktorin 在 :gh:`110850` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2032 +#: ../../whatsnew/3.13.rst:2084 msgid "" -"Add the :c:func:`PyDict_ContainsString` function with the same behavior as :" -"c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const char*` " -"UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`. (Contributed " -"by Victor Stinner in :gh:`108314`.)" +"Add the :c:func:`PyDict_ContainsString` function with the same behavior " +"as :c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const " +"char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`. " +"(Contributed by Victor Stinner in :gh:`108314`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2038 +#: ../../whatsnew/3.13.rst:2090 msgid "" "Add the :c:func:`PyDict_GetItemRef` and :c:func:`PyDict_GetItemStringRef` " "functions, which behave similarly to :c:func:`PyDict_GetItemWithError`, but " "return a :term:`strong reference` instead of a :term:`borrowed reference`. " "Moreover, these functions return ``-1`` on error, removing the need to " -"check :c:func:`!PyErr_Occurred`. (Contributed by Victor Stinner in :gh:" -"`106004`.)" +"check :c:func:`!PyErr_Occurred`. (Contributed by Victor Stinner " +"in :gh:`106004`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2046 +#: ../../whatsnew/3.13.rst:2098 msgid "" -"Add the :c:func:`PyDict_SetDefaultRef` function, which behaves similarly to :" -"c:func:`PyDict_SetDefault`, but returns a :term:`strong reference` instead " -"of a :term:`borrowed reference`. This function returns ``-1`` on error, " -"``0`` on insertion, and ``1`` if the key was already present in the " +"Add the :c:func:`PyDict_SetDefaultRef` function, which behaves similarly " +"to :c:func:`PyDict_SetDefault`, but returns a :term:`strong reference` " +"instead of a :term:`borrowed reference`. This function returns ``-1`` on " +"error, ``0`` on insertion, and ``1`` if the key was already present in the " "dictionary. (Contributed by Sam Gross in :gh:`112066`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2054 +#: ../../whatsnew/3.13.rst:2106 msgid "" "Add the :c:func:`PyDict_Pop` and :c:func:`PyDict_PopString` functions to " "remove a key from a dictionary and optionally return the removed value. This " -"is similar to :meth:`dict.pop`, though there is no default value, and :exc:" -"`KeyError` is not raised for missing keys. (Contributed by Stefan Behnel and " -"Victor Stinner in :gh:`111262`.)" +"is similar to :meth:`dict.pop`, though there is no default value, " +"and :exc:`KeyError` is not raised for missing keys. (Contributed by Stefan " +"Behnel and Victor Stinner in :gh:`111262`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2061 +#: ../../whatsnew/3.13.rst:2113 msgid "" -"Add the :c:func:`PyMapping_GetOptionalItem` and :c:func:" -"`PyMapping_GetOptionalItemString` functions as alternatives to :c:func:" -"`PyObject_GetItem` and :c:func:`PyMapping_GetItemString` respectively. The " -"new functions do not raise :exc:`KeyError` if the requested key is missing " -"from the mapping. These variants are more convenient and faster if a missing " -"key should not be treated as a failure. (Contributed by Serhiy Storchaka in :" -"gh:`106307`.)" +"Add the :c:func:`PyMapping_GetOptionalItem` " +"and :c:func:`PyMapping_GetOptionalItemString` functions as alternatives " +"to :c:func:`PyObject_GetItem` and :c:func:`PyMapping_GetItemString` " +"respectively. The new functions do not raise :exc:`KeyError` if the " +"requested key is missing from the mapping. These variants are more " +"convenient and faster if a missing key should not be treated as a failure. " +"(Contributed by Serhiy Storchaka in :gh:`106307`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2071 +#: ../../whatsnew/3.13.rst:2123 msgid "" -"Add the :c:func:`PyObject_GetOptionalAttr` and :c:func:" -"`PyObject_GetOptionalAttrString` functions as alternatives to :c:func:" -"`PyObject_GetAttr` and :c:func:`PyObject_GetAttrString` respectively. The " -"new functions do not raise :exc:`AttributeError` if the requested attribute " -"is not found on the object. These variants are more convenient and faster if " -"the missing attribute should not be treated as a failure. (Contributed by " -"Serhiy Storchaka in :gh:`106521`.)" +"Add the :c:func:`PyObject_GetOptionalAttr` " +"and :c:func:`PyObject_GetOptionalAttrString` functions as alternatives " +"to :c:func:`PyObject_GetAttr` and :c:func:`PyObject_GetAttrString` " +"respectively. The new functions do not raise :exc:`AttributeError` if the " +"requested attribute is not found on the object. These variants are more " +"convenient and faster if the missing attribute should not be treated as a " +"failure. (Contributed by Serhiy Storchaka in :gh:`106521`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2081 +#: ../../whatsnew/3.13.rst:2133 msgid "" -"Add the :c:func:`PyErr_FormatUnraisable` function as an extension to :c:func:" -"`PyErr_WriteUnraisable` that allows customizing the warning message. " -"(Contributed by Serhiy Storchaka in :gh:`108082`.)" +"Add the :c:func:`PyErr_FormatUnraisable` function as an extension " +"to :c:func:`PyErr_WriteUnraisable` that allows customizing the warning " +"message. (Contributed by Serhiy Storchaka in :gh:`108082`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2086 +#: ../../whatsnew/3.13.rst:2138 msgid "" -"Add new functions that return a :term:`strong reference` instead of a :term:" -"`borrowed reference` for frame locals, globals, and builtins, as part of :" -"ref:`PEP 667 <whatsnew313-locals-semantics>`:" +"Add new functions that return a :term:`strong reference` instead of " +"a :term:`borrowed reference` for frame locals, globals, and builtins, as " +"part of :ref:`PEP 667 <whatsnew313-locals-semantics>`:" msgstr "" -#: ../../whatsnew/3.13.rst:2090 +#: ../../whatsnew/3.13.rst:2142 msgid ":c:func:`PyEval_GetFrameBuiltins` replaces :c:func:`PyEval_GetBuiltins`" msgstr ":c:func:`PyEval_GetFrameBuiltins` 取代 :c:func:`PyEval_GetBuiltins`" -#: ../../whatsnew/3.13.rst:2091 +#: ../../whatsnew/3.13.rst:2143 msgid ":c:func:`PyEval_GetFrameGlobals` replaces :c:func:`PyEval_GetGlobals`" msgstr ":c:func:`PyEval_GetFrameGlobals` 取代 :c:func:`PyEval_GetGlobals`" -#: ../../whatsnew/3.13.rst:2092 +#: ../../whatsnew/3.13.rst:2144 msgid ":c:func:`PyEval_GetFrameLocals` replaces :c:func:`PyEval_GetLocals`" msgstr ":c:func:`PyEval_GetFrameLocals` 取代 :c:func:`PyEval_GetLocals`" -#: ../../whatsnew/3.13.rst:2094 +#: ../../whatsnew/3.13.rst:2146 msgid "(Contributed by Mark Shannon and Tian Gao in :gh:`74929`.)" msgstr "(由 Mark Shannon 和 Tian Gao 在 :gh:`74929` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2096 +#: ../../whatsnew/3.13.rst:2148 msgid "" "Add the :c:func:`Py_GetConstant` and :c:func:`Py_GetConstantBorrowed` " "functions to get :term:`strong <strong reference>` or :term:`borrowed " @@ -4051,43 +4186,44 @@ msgid "" "constant zero. (Contributed by Victor Stinner in :gh:`115754`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2103 +#: ../../whatsnew/3.13.rst:2155 msgid "" -"Add the :c:func:`PyImport_AddModuleRef` function as a replacement for :c:" -"func:`PyImport_AddModule` that returns a :term:`strong reference` instead of " -"a :term:`borrowed reference`. (Contributed by Victor Stinner in :gh:" -"`105922`.)" +"Add the :c:func:`PyImport_AddModuleRef` function as a replacement " +"for :c:func:`PyImport_AddModule` that returns a :term:`strong reference` " +"instead of a :term:`borrowed reference`. (Contributed by Victor Stinner " +"in :gh:`105922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2108 +#: ../../whatsnew/3.13.rst:2160 msgid "" "Add the :c:func:`Py_IsFinalizing` function to check whether the main Python " "interpreter is :term:`shutting down <interpreter shutdown>`. (Contributed by " "Victor Stinner in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2113 +#: ../../whatsnew/3.13.rst:2165 msgid "" -"Add the :c:func:`PyList_GetItemRef` function as a replacement for :c:func:" -"`PyList_GetItem` that returns a :term:`strong reference` instead of a :term:" -"`borrowed reference`. (Contributed by Sam Gross in :gh:`114329`.)" +"Add the :c:func:`PyList_GetItemRef` function as a replacement " +"for :c:func:`PyList_GetItem` that returns a :term:`strong reference` instead " +"of a :term:`borrowed reference`. (Contributed by Sam Gross in :gh:`114329`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2118 +#: ../../whatsnew/3.13.rst:2170 msgid "" "Add the :c:func:`PyList_Extend` and :c:func:`PyList_Clear` functions, " "mirroring the Python :meth:`!list.extend` and :meth:`!list.clear` methods. " "(Contributed by Victor Stinner in :gh:`111138`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2122 +#: ../../whatsnew/3.13.rst:2174 msgid "" -"Add the :c:func:`PyLong_AsInt` function. It behaves similarly to :c:func:" -"`PyLong_AsLong`, but stores the result in a C :c:expr:`int` instead of a C :" -"c:expr:`long`. (Contributed by Victor Stinner in :gh:`108014`.)" +"Add the :c:func:`PyLong_AsInt` function. It behaves similarly " +"to :c:func:`PyLong_AsLong`, but stores the result in a C :c:expr:`int` " +"instead of a C :c:expr:`long`. (Contributed by Victor Stinner " +"in :gh:`108014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2127 +#: ../../whatsnew/3.13.rst:2179 msgid "" "Add the :c:func:`PyLong_AsNativeBytes`, :c:func:`PyLong_FromNativeBytes`, " "and :c:func:`PyLong_FromUnsignedNativeBytes` functions to simplify " @@ -4095,36 +4231,38 @@ msgid "" "(Contributed by Steve Dower in :gh:`111140`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2133 +#: ../../whatsnew/3.13.rst:2185 msgid "" -"Add :c:func:`PyModule_Add` function, which is similar to :c:func:" -"`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but always steals " -"a reference to the value. (Contributed by Serhiy Storchaka in :gh:`86493`.)" +"Add :c:func:`PyModule_Add` function, which is similar " +"to :c:func:`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but " +"always steals a reference to the value. (Contributed by Serhiy Storchaka " +"in :gh:`86493`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2138 +#: ../../whatsnew/3.13.rst:2190 msgid "" "Add the :c:func:`PyObject_GenericHash` function that implements the default " -"hashing function of a Python object. (Contributed by Serhiy Storchaka in :gh:" -"`113024`.)" +"hashing function of a Python object. (Contributed by Serhiy Storchaka " +"in :gh:`113024`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2142 +#: ../../whatsnew/3.13.rst:2194 msgid "" "Add the :c:func:`Py_HashPointer` function to hash a raw pointer. " "(Contributed by Victor Stinner in :gh:`111545`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2145 +#: ../../whatsnew/3.13.rst:2197 msgid "" -"Add the :c:func:`PyObject_VisitManagedDict` and :c:func:" -"`PyObject_ClearManagedDict` functions. which must be called by the traverse " -"and clear functions of a type using the :c:macro:`Py_TPFLAGS_MANAGED_DICT` " -"flag. The `pythoncapi-compat project`_ can be used to use these functions " -"with Python 3.11 and 3.12. (Contributed by Victor Stinner in :gh:`107073`.)" +"Add the :c:func:`PyObject_VisitManagedDict` " +"and :c:func:`PyObject_ClearManagedDict` functions. which must be called by " +"the traverse and clear functions of a type using " +"the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag. The `pythoncapi-compat " +"project`_ can be used to use these functions with Python 3.11 and 3.12. " +"(Contributed by Victor Stinner in :gh:`107073`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2153 +#: ../../whatsnew/3.13.rst:2205 msgid "" "Add the :c:func:`PyRefTracer_SetTracer` and :c:func:`PyRefTracer_GetTracer` " "functions, which enable tracking object creation and destruction in the same " @@ -4132,14 +4270,14 @@ msgid "" "in :gh:`93502`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2159 +#: ../../whatsnew/3.13.rst:2211 msgid "" -"Add the :c:func:`PySys_AuditTuple` function as an alternative to :c:func:" -"`PySys_Audit` that takes event arguments as a Python :class:`tuple` object. " -"(Contributed by Victor Stinner in :gh:`85283`.)" +"Add the :c:func:`PySys_AuditTuple` function as an alternative " +"to :c:func:`PySys_Audit` that takes event arguments as a " +"Python :class:`tuple` object. (Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2164 +#: ../../whatsnew/3.13.rst:2216 msgid "" "Add the :c:func:`PyThreadState_GetUnchecked()` function as an alternative " "to :c:func:`PyThreadState_Get()` that doesn't kill the process with a fatal " @@ -4147,219 +4285,219 @@ msgid "" "result is ``NULL``. (Contributed by Victor Stinner in :gh:`108867`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2170 +#: ../../whatsnew/3.13.rst:2222 msgid "" "Add the :c:func:`PyType_GetFullyQualifiedName` function to get the type's " -"fully qualified name. The module name is prepended if :attr:`type." -"__module__` is a string and is not equal to either ``'builtins'`` or " -"``'__main__'``. (Contributed by Victor Stinner in :gh:`111696`.)" +"fully qualified name. The module name is prepended " +"if :attr:`type.__module__` is a string and is not equal to either " +"``'builtins'`` or ``'__main__'``. (Contributed by Victor Stinner " +"in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2176 +#: ../../whatsnew/3.13.rst:2228 msgid "" "Add the :c:func:`PyType_GetModuleName` function to get the type's module " "name. This is equivalent to getting the :attr:`type.__module__` attribute. " "(Contributed by Eric Snow and Victor Stinner in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2181 +#: ../../whatsnew/3.13.rst:2233 msgid "" -"Add the :c:func:`PyUnicode_EqualToUTF8AndSize` and :c:func:" -"`PyUnicode_EqualToUTF8` functions to compare a Unicode object with a :c:expr:" -"`const char*` UTF-8 encoded string and ``1`` if they are equal or ``0`` " -"otherwise. These functions do not raise exceptions. (Contributed by Serhiy " -"Storchaka in :gh:`110289`.)" +"Add the :c:func:`PyUnicode_EqualToUTF8AndSize` " +"and :c:func:`PyUnicode_EqualToUTF8` functions to compare a Unicode object " +"with a :c:expr:`const char*` UTF-8 encoded string and ``1`` if they are " +"equal or ``0`` otherwise. These functions do not raise exceptions. " +"(Contributed by Serhiy Storchaka in :gh:`110289`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2188 +#: ../../whatsnew/3.13.rst:2240 msgid "" -"Add the :c:func:`PyWeakref_GetRef` function as an alternative to :c:func:" -"`PyWeakref_GetObject` that returns a :term:`strong reference` or ``NULL`` if " -"the referent is no longer live. (Contributed by Victor Stinner in :gh:" -"`105927`.)" +"Add the :c:func:`PyWeakref_GetRef` function as an alternative " +"to :c:func:`PyWeakref_GetObject` that returns a :term:`strong reference` or " +"``NULL`` if the referent is no longer live. (Contributed by Victor Stinner " +"in :gh:`105927`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2194 +#: ../../whatsnew/3.13.rst:2246 msgid "Add fixed variants of functions which silently ignore errors:" msgstr "" -#: ../../whatsnew/3.13.rst:2196 +#: ../../whatsnew/3.13.rst:2248 msgid "" ":c:func:`PyObject_HasAttrWithError` replaces :c:func:`PyObject_HasAttr`." msgstr ":c:func:`PyObject_HasAttrWithError` 取代 :c:func:`PyObject_HasAttr`。" -#: ../../whatsnew/3.13.rst:2197 +#: ../../whatsnew/3.13.rst:2249 msgid "" -":c:func:`PyObject_HasAttrStringWithError` replaces :c:func:" -"`PyObject_HasAttrString`." +":c:func:`PyObject_HasAttrStringWithError` " +"replaces :c:func:`PyObject_HasAttrString`." msgstr "" -":c:func:`PyObject_HasAttrStringWithError` 取代 :c:func:" -"`PyObject_HasAttrString`。" +":c:func:`PyObject_HasAttrStringWithError` 取" +"代 :c:func:`PyObject_HasAttrString`。" -#: ../../whatsnew/3.13.rst:2199 +#: ../../whatsnew/3.13.rst:2251 msgid "" ":c:func:`PyMapping_HasKeyWithError` replaces :c:func:`PyMapping_HasKey`." msgstr ":c:func:`PyMapping_HasKeyWithError` 取代 :c:func:`PyMapping_HasKey`。" -#: ../../whatsnew/3.13.rst:2200 +#: ../../whatsnew/3.13.rst:2252 msgid "" -":c:func:`PyMapping_HasKeyStringWithError` replaces :c:func:" -"`PyMapping_HasKeyString`." +":c:func:`PyMapping_HasKeyStringWithError` " +"replaces :c:func:`PyMapping_HasKeyString`." msgstr "" -":c:func:`PyMapping_HasKeyStringWithError` 取代 :c:func:" -"`PyMapping_HasKeyString`。" +":c:func:`PyMapping_HasKeyStringWithError` 取" +"代 :c:func:`PyMapping_HasKeyString`。" -#: ../../whatsnew/3.13.rst:2203 +#: ../../whatsnew/3.13.rst:2255 msgid "" "The new functions return ``-1`` for errors and the standard ``1`` for true " "and ``0`` for false." msgstr "" -#: ../../whatsnew/3.13.rst:2206 +#: ../../whatsnew/3.13.rst:2258 msgid "(Contributed by Serhiy Storchaka in :gh:`108511`.)" msgstr "(由 Serhiy Storchaka 在 :gh:`108511` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2210 +#: ../../whatsnew/3.13.rst:2262 msgid "Changed C APIs" msgstr "" -#: ../../whatsnew/3.13.rst:2212 +#: ../../whatsnew/3.13.rst:2264 msgid "" -"The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and :c:" -"func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * const *` " -"in C and :c:expr:`const char * const *` in C++, instead of :c:expr:`char " -"**`. In C++, this makes these functions compatible with arguments of type :c:" -"expr:`const char * const *`, :c:expr:`const char **`, or :c:expr:`char * " -"const *` without an explicit type cast. In C, the functions only support " -"arguments of type :c:expr:`char * const *`. This can be overridden with the :" -"c:macro:`PY_CXX_CONST` macro. (Contributed by Serhiy Storchaka in :gh:" -"`65210`.)" +"The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` " +"and :c:func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * " +"const *` in C and :c:expr:`const char * const *` in C++, instead " +"of :c:expr:`char **`. In C++, this makes these functions compatible with " +"arguments of type :c:expr:`const char * const *`, :c:expr:`const char **`, " +"or :c:expr:`char * const *` without an explicit type cast. In C, the " +"functions only support arguments of type :c:expr:`char * const *`. This can " +"be overridden with the :c:macro:`PY_CXX_CONST` macro. (Contributed by Serhiy " +"Storchaka in :gh:`65210`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2224 +#: ../../whatsnew/3.13.rst:2276 msgid "" ":c:func:`PyArg_ParseTupleAndKeywords` now supports non-ASCII keyword " "parameter names. (Contributed by Serhiy Storchaka in :gh:`110815`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2228 +#: ../../whatsnew/3.13.rst:2280 msgid "" "The :c:func:`!PyCode_GetFirstFree` function is now unstable API and is now " "named :c:func:`PyUnstable_Code_GetFirstFree`. (Contributed by Bogdan " "Romanyuk in :gh:`115781`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2232 +#: ../../whatsnew/3.13.rst:2284 msgid "" -"The :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:" -"`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:" -"`PyObject_HasAttr`, :c:func:`PyObject_HasAttrString`, and :c:func:" -"`PySys_GetObject` functions, each of which clears all errors which occurred " -"when calling them now reports these errors using :func:`sys.unraisablehook`. " -"You may replace them with other functions as recommended in the " -"documentation. (Contributed by Serhiy Storchaka in :gh:`106672`.)" +"The :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:`PyObject_HasAttr`, :c:func:`PyObject_HasAttrString`, " +"and :c:func:`PySys_GetObject` functions, each of which clears all errors " +"which occurred when calling them now reports these errors " +"using :func:`sys.unraisablehook`. You may replace them with other functions " +"as recommended in the documentation. (Contributed by Serhiy Storchaka " +"in :gh:`106672`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2241 +#: ../../whatsnew/3.13.rst:2293 msgid "" -"Add support for the ``%T``, ``%#T``, ``%N`` and ``%#N`` formats to :c:func:" -"`PyUnicode_FromFormat`:" +"Add support for the ``%T``, ``%#T``, ``%N`` and ``%#N`` formats " +"to :c:func:`PyUnicode_FromFormat`:" msgstr "" -#: ../../whatsnew/3.13.rst:2244 +#: ../../whatsnew/3.13.rst:2296 msgid "``%T``: Get the fully qualified name of an object type" msgstr "" -#: ../../whatsnew/3.13.rst:2245 +#: ../../whatsnew/3.13.rst:2297 msgid "``%#T``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2246 +#: ../../whatsnew/3.13.rst:2298 msgid "``%N``: Get the fully qualified name of a type" msgstr "" -#: ../../whatsnew/3.13.rst:2247 +#: ../../whatsnew/3.13.rst:2299 msgid "``%#N``: As above, but use a colon as the separator" msgstr "" -#: ../../whatsnew/3.13.rst:2249 +#: ../../whatsnew/3.13.rst:2301 msgid "" -"See :pep:`737` for more information. (Contributed by Victor Stinner in :gh:" -"`111696`.)" +"See :pep:`737` for more information. (Contributed by Victor Stinner " +"in :gh:`111696`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2252 +#: ../../whatsnew/3.13.rst:2304 msgid "" "You no longer have to define the ``PY_SSIZE_T_CLEAN`` macro before " "including :file:`Python.h` when using ``#`` formats in :ref:`format codes " "<arg-parsing-string-and-buffers>`. APIs accepting the format codes always " -"use ``Py_ssize_t`` for ``#`` formats. (Contributed by Inada Naoki in :gh:" -"`104922`.)" +"use ``Py_ssize_t`` for ``#`` formats. (Contributed by Inada Naoki " +"in :gh:`104922`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2258 +#: ../../whatsnew/3.13.rst:2310 msgid "" "If Python is built in :ref:`debug mode <debug-build>` or :option:`with " -"assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and :c:func:" -"`PyList_SET_ITEM` now check the index argument with an assertion. " -"(Contributed by Victor Stinner in :gh:`106168`.)" +"assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` " +"and :c:func:`PyList_SET_ITEM` now check the index argument with an " +"assertion. (Contributed by Victor Stinner in :gh:`106168`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2266 +#: ../../whatsnew/3.13.rst:2318 msgid "Limited C API Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2268 +#: ../../whatsnew/3.13.rst:2320 msgid "The following functions are now included in the Limited C API:" msgstr "" -#: ../../whatsnew/3.13.rst:2270 +#: ../../whatsnew/3.13.rst:2322 msgid ":c:func:`PyMem_RawMalloc`" msgstr ":c:func:`PyMem_RawMalloc`" -#: ../../whatsnew/3.13.rst:2271 +#: ../../whatsnew/3.13.rst:2323 msgid ":c:func:`PyMem_RawCalloc`" msgstr ":c:func:`PyMem_RawCalloc`" -#: ../../whatsnew/3.13.rst:2272 +#: ../../whatsnew/3.13.rst:2324 msgid ":c:func:`PyMem_RawRealloc`" msgstr ":c:func:`PyMem_RawRealloc`" -#: ../../whatsnew/3.13.rst:2273 +#: ../../whatsnew/3.13.rst:2325 msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" -#: ../../whatsnew/3.13.rst:2274 +#: ../../whatsnew/3.13.rst:2326 msgid ":c:func:`PySys_Audit`" msgstr ":c:func:`PySys_Audit`" -#: ../../whatsnew/3.13.rst:2275 +#: ../../whatsnew/3.13.rst:2327 msgid ":c:func:`PySys_AuditTuple`" msgstr ":c:func:`PySys_AuditTuple`" -#: ../../whatsnew/3.13.rst:2276 +#: ../../whatsnew/3.13.rst:2328 msgid ":c:func:`PyType_GetModuleByDef`" msgstr ":c:func:`PyType_GetModuleByDef`" -#: ../../whatsnew/3.13.rst:2278 +#: ../../whatsnew/3.13.rst:2330 msgid "" -"(Contributed by Victor Stinner in :gh:`85283`, :gh:`85283`, and :gh:" -"`116936`.)" +"(Contributed by Victor Stinner in :gh:`85283`, :gh:`85283`, " +"and :gh:`116936`.)" msgstr "" "(由 Victor Stinner 貢獻於 :gh:`85283`、:gh:`85283` 和 :gh:`116936`。)" -#: ../../whatsnew/3.13.rst:2280 +#: ../../whatsnew/3.13.rst:2332 msgid "" "Python built with :option:`--with-trace-refs` (tracing references) now " "supports the :ref:`Limited API <limited-c-api>`. (Contributed by Victor " "Stinner in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2286 +#: ../../whatsnew/3.13.rst:2338 msgid "Removed C APIs" msgstr "移除的 C API" -#: ../../whatsnew/3.13.rst:2288 +#: ../../whatsnew/3.13.rst:2340 msgid "" "Remove several functions, macros, variables, etc with names prefixed by " "``_Py`` or ``_PY`` (which are considered private). If your project is " @@ -4369,30 +4507,30 @@ msgid "" "Victor Stinner. (Contributed by Victor Stinner in :gh:`106320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2296 +#: ../../whatsnew/3.13.rst:2348 msgid "" -"Remove old buffer protocols deprecated in Python 3.0. Use :ref:" -"`bufferobjects` instead." +"Remove old buffer protocols deprecated in Python 3.0. " +"Use :ref:`bufferobjects` instead." msgstr "" -#: ../../whatsnew/3.13.rst:2299 +#: ../../whatsnew/3.13.rst:2351 msgid "" ":c:func:`!PyObject_CheckReadBuffer`: Use :c:func:`PyObject_CheckBuffer` to " -"test whether the object supports the buffer protocol. Note that :c:func:" -"`PyObject_CheckBuffer` doesn't guarantee that :c:func:`PyObject_GetBuffer` " -"will succeed. To test if the object is actually readable, see the next " -"example of :c:func:`PyObject_GetBuffer`." +"test whether the object supports the buffer protocol. Note " +"that :c:func:`PyObject_CheckBuffer` doesn't guarantee " +"that :c:func:`PyObject_GetBuffer` will succeed. To test if the object is " +"actually readable, see the next example of :c:func:`PyObject_GetBuffer`." msgstr "" -#: ../../whatsnew/3.13.rst:2307 +#: ../../whatsnew/3.13.rst:2359 msgid "" -":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: Use :c:" -"func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" +":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: " +"Use :c:func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" msgstr "" -":c:func:`!PyObject_AsCharBuffer`、:c:func:`!PyObject_AsReadBuffer`:請改用 :" -"c:func:`PyObject_GetBuffer` 和 :c:func:`PyBuffer_Release`。" +":c:func:`!PyObject_AsCharBuffer`、:c:func:`!PyObject_AsReadBuffer`:請改" +"用 :c:func:`PyObject_GetBuffer` 和 :c:func:`PyBuffer_Release`。" -#: ../../whatsnew/3.13.rst:2310 +#: ../../whatsnew/3.13.rst:2362 msgid "" "Py_buffer view;\n" "if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) < 0) {\n" @@ -4403,15 +4541,15 @@ msgid "" "PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2320 +#: ../../whatsnew/3.13.rst:2372 msgid "" -":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` and :c:" -"func:`PyBuffer_Release` instead:" +":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` " +"and :c:func:`PyBuffer_Release` instead:" msgstr "" -":c:func:`!PyObject_AsWriteBuffer`:請改用 :c:func:`PyObject_GetBuffer` 和 :c:" -"func:`PyBuffer_Release`。" +":c:func:`!PyObject_AsWriteBuffer`:請改用 :c:func:`PyObject_GetBuffer` " +"和 :c:func:`PyBuffer_Release`。" -#: ../../whatsnew/3.13.rst:2323 +#: ../../whatsnew/3.13.rst:2375 msgid "" "Py_buffer view;\n" "if (PyObject_GetBuffer(obj, &view, PyBUF_WRITABLE) < 0) {\n" @@ -4421,123 +4559,123 @@ msgid "" "PyBuffer_Release(&view);" msgstr "" -#: ../../whatsnew/3.13.rst:2332 +#: ../../whatsnew/3.13.rst:2384 msgid "(Contributed by Inada Naoki in :gh:`85275`.)" msgstr "(由 Inada Naoki 貢獻於 :gh:`85275`。)" -#: ../../whatsnew/3.13.rst:2334 +#: ../../whatsnew/3.13.rst:2386 msgid "Remove various functions deprecated in Python 3.9:" msgstr "" -#: ../../whatsnew/3.13.rst:2336 +#: ../../whatsnew/3.13.rst:2388 msgid "" -":c:func:`!PyEval_CallObject`, :c:func:`!PyEval_CallObjectWithKeywords`: Use :" -"c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead." +":c:func:`!PyEval_CallObject`, :c:func:`!PyEval_CallObjectWithKeywords`: " +"Use :c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead." msgstr "" ":c:func:`!PyEval_CallObject`、:c:func:`!PyEval_CallObjectWithKeywords`:請改" "用 :c:func:`PyObject_CallNoArgs` 或 :c:func:`PyObject_Call`。" -#: ../../whatsnew/3.13.rst:2341 +#: ../../whatsnew/3.13.rst:2393 msgid "" "In :c:func:`PyObject_Call`, positional arguments must be a :class:`tuple` " "and must not be ``NULL``, and keyword arguments must be a :class:`dict` or " "``NULL``, whereas the removed functions checked argument types and accepted " "``NULL`` positional and keyword arguments. To replace " -"``PyEval_CallObjectWithKeywords(func, NULL, kwargs)`` with :c:func:" -"`PyObject_Call`, pass an empty tuple as positional arguments using :c:func:" -"`PyTuple_New(0) <PyTuple_New>`." +"``PyEval_CallObjectWithKeywords(func, NULL, kwargs)`` " +"with :c:func:`PyObject_Call`, pass an empty tuple as positional arguments " +"using :c:func:`PyTuple_New(0) <PyTuple_New>`." msgstr "" -#: ../../whatsnew/3.13.rst:2351 +#: ../../whatsnew/3.13.rst:2403 msgid "" ":c:func:`!PyEval_CallFunction`: Use :c:func:`PyObject_CallFunction` instead." msgstr "" ":c:func:`!PyEval_CallFunction`:請改用 :c:func:`PyObject_CallFunction`。" -#: ../../whatsnew/3.13.rst:2353 +#: ../../whatsnew/3.13.rst:2405 msgid "" ":c:func:`!PyEval_CallMethod`: Use :c:func:`PyObject_CallMethod` instead." msgstr ":c:func:`!PyEval_CallMethod`:請改用 :c:func:`PyObject_CallMethod`。" -#: ../../whatsnew/3.13.rst:2355 +#: ../../whatsnew/3.13.rst:2407 msgid ":c:func:`!PyCFunction_Call`: Use :c:func:`PyObject_Call` instead." msgstr ":c:func:`!PyCFunction_Call`:請改用 :c:func:`PyCFunction_Call`。" -#: ../../whatsnew/3.13.rst:2358 +#: ../../whatsnew/3.13.rst:2410 msgid "(Contributed by Victor Stinner in :gh:`105107`.)" msgstr "(由 Victor Stinner 貢獻於 :gh:`105107`。)" -#: ../../whatsnew/3.13.rst:2360 +#: ../../whatsnew/3.13.rst:2412 msgid "" "Remove the following old functions to configure the Python initialization, " "deprecated in Python 3.11:" msgstr "" -#: ../../whatsnew/3.13.rst:2363 +#: ../../whatsnew/3.13.rst:2415 msgid "" ":c:func:`!PySys_AddWarnOptionUnicode`: Use :c:member:`PyConfig.warnoptions` " "instead." msgstr "" -":c:func:`!PySys_AddWarnOptionUnicode`:請改用 :c:member:`PyConfig." -"warnoptions`。" +":c:func:`!PySys_AddWarnOptionUnicode`:請改" +"用 :c:member:`PyConfig.warnoptions`。" -#: ../../whatsnew/3.13.rst:2365 +#: ../../whatsnew/3.13.rst:2417 msgid "" ":c:func:`!PySys_AddWarnOption`: Use :c:member:`PyConfig.warnoptions` instead." msgstr "" ":c:func:`!PySys_AddWarnOption`:請改用 :c:member:`PyConfig.warnoptions`。" -#: ../../whatsnew/3.13.rst:2367 +#: ../../whatsnew/3.13.rst:2419 msgid ":c:func:`!PySys_AddXOption`: Use :c:member:`PyConfig.xoptions` instead." msgstr ":c:func:`!PySys_AddXOption`:請改用 :c:member:`PyConfig.xoptions`。" -#: ../../whatsnew/3.13.rst:2369 +#: ../../whatsnew/3.13.rst:2421 msgid "" ":c:func:`!PySys_HasWarnOptions`: Use :c:member:`PyConfig.xoptions` instead." msgstr "" ":c:func:`!PySys_HasWarnOptions`:請改用 :c:member:`PyConfig.xoptions`。" -#: ../../whatsnew/3.13.rst:2371 +#: ../../whatsnew/3.13.rst:2423 msgid "" ":c:func:`!PySys_SetPath`: Set :c:member:`PyConfig.module_search_paths` " "instead." msgstr "" ":c:func:`!PySys_SetPath`:請改用 :c:member:`PyConfig.module_search_paths`。" -#: ../../whatsnew/3.13.rst:2373 +#: ../../whatsnew/3.13.rst:2425 msgid "" ":c:func:`!Py_SetPath`: Set :c:member:`PyConfig.module_search_paths` instead." msgstr "" ":c:func:`!Py_SetPath`:請改用 :c:member:`PyConfig.module_search_paths`。" -#: ../../whatsnew/3.13.rst:2375 +#: ../../whatsnew/3.13.rst:2427 msgid "" -":c:func:`!Py_SetStandardStreamEncoding`: Set :c:member:`PyConfig." -"stdio_encoding` instead, and set also maybe :c:member:`PyConfig." -"legacy_windows_stdio` (on Windows)." +":c:func:`!Py_SetStandardStreamEncoding`: " +"Set :c:member:`PyConfig.stdio_encoding` instead, and set also " +"maybe :c:member:`PyConfig.legacy_windows_stdio` (on Windows)." msgstr "" -":c:func:`!Py_SetStandardStreamEncoding`:請改用 :c:member:`PyConfig." -"stdio_encoding` 並設定可能的 :c:member:`PyConfig.legacy_windows_stdio`\\ " -"(在 Windows 上)。" +":c:func:`!Py_SetStandardStreamEncoding`:請改" +"用 :c:member:`PyConfig.stdio_encoding` 並設定可能" +"的 :c:member:`PyConfig.legacy_windows_stdio`\\ (在 Windows 上)。" -#: ../../whatsnew/3.13.rst:2378 +#: ../../whatsnew/3.13.rst:2430 msgid "" ":c:func:`!_Py_SetProgramFullPath`: Set :c:member:`PyConfig.executable` " "instead." msgstr "" ":c:func:`!_Py_SetProgramFullPath`:請改用 :c:member:`PyConfig.executable`。" -#: ../../whatsnew/3.13.rst:2381 +#: ../../whatsnew/3.13.rst:2433 msgid "" "Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " "Configuration <init-config>` instead (:pep:`587`), added to Python 3.8. " "(Contributed by Victor Stinner in :gh:`105145`.)" msgstr "" "請改用 :ref:`Python 初始化設定 <init-config>`\\ 的新 :c:type:`PyConfig` API " -"(:pep:`587`),這是在 Python 3.8 中新增的。(由 Victor Stinner 於 :gh:" -"`105145` 貢獻。)" +"(:pep:`587`),這是在 Python 3.8 中新增的。(由 Victor Stinner " +"於 :gh:`105145` 貢獻。)" -#: ../../whatsnew/3.13.rst:2385 +#: ../../whatsnew/3.13.rst:2437 msgid "" "Remove :c:func:`!PyEval_AcquireLock` and :c:func:`!PyEval_ReleaseLock` " "functions, deprecated in Python 3.2. They didn't update the current thread " @@ -4547,25 +4685,25 @@ msgstr "" "些函式在 Python 3.2 中已被廢棄。它們不會更新目前的執行緒狀態。可以用以下函式" "取代:" -#: ../../whatsnew/3.13.rst:2390 +#: ../../whatsnew/3.13.rst:2442 msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`;" msgstr ":c:func:`PyEval_SaveThread` 和 :c:func:`PyEval_RestoreThread`;" -#: ../../whatsnew/3.13.rst:2391 +#: ../../whatsnew/3.13.rst:2443 msgid "" "low-level :c:func:`PyEval_AcquireThread` and :c:func:`PyEval_RestoreThread`;" msgstr "" "低階的 :c:func:`PyEval_AcquireThread` 和 :c:func:`PyEval_RestoreThread`;" -#: ../../whatsnew/3.13.rst:2392 +#: ../../whatsnew/3.13.rst:2444 msgid "or :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`." msgstr "或 :c:func:`PyGILState_Ensure` 與 :c:func:`PyGILState_Release`。" -#: ../../whatsnew/3.13.rst:2394 +#: ../../whatsnew/3.13.rst:2446 msgid "(Contributed by Victor Stinner in :gh:`105182`.)" msgstr "(由 Victor Stinner 貢獻於 :gh:`105182`。)" -#: ../../whatsnew/3.13.rst:2396 +#: ../../whatsnew/3.13.rst:2448 msgid "" "Remove the :c:func:`!PyEval_ThreadsInitialized` function, deprecated in " "Python 3.9. Since Python 3.7, :c:func:`!Py_Initialize` always creates the " @@ -4574,37 +4712,37 @@ msgid "" "Stinner in :gh:`105182`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2403 +#: ../../whatsnew/3.13.rst:2455 msgid "" -"Remove the :c:func:`!_PyInterpreterState_Get` alias to :c:func:" -"`PyInterpreterState_Get()` which was kept for backward compatibility with " -"Python 3.8. The `pythoncapi-compat project`_ can be used to get :c:func:" -"`PyInterpreterState_Get()` on Python 3.8 and older. (Contributed by Victor " -"Stinner in :gh:`106320`.)" +"Remove the :c:func:`!_PyInterpreterState_Get` alias " +"to :c:func:`PyInterpreterState_Get()` which was kept for backward " +"compatibility with Python 3.8. The `pythoncapi-compat project`_ can be used " +"to get :c:func:`PyInterpreterState_Get()` on Python 3.8 and older. " +"(Contributed by Victor Stinner in :gh:`106320`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2410 +#: ../../whatsnew/3.13.rst:2462 msgid "" "Remove the private :c:func:`!_PyObject_FastCall` function: use :c:func:`!" "PyObject_Vectorcall` which is available since Python 3.8 (:pep:`590`). " "(Contributed by Victor Stinner in :gh:`106023`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2415 +#: ../../whatsnew/3.13.rst:2467 msgid "" "Remove the ``cpython/pytime.h`` header file, which only contained private " "functions. (Contributed by Victor Stinner in :gh:`106316`.)" msgstr "" -"移除只包含私有函式的 ``cpython/pytime.h`` 標頭檔。(由 Victor Stinner 於 :gh:" -"`106316` 貢獻。)" +"移除只包含私有函式的 ``cpython/pytime.h`` 標頭檔。(由 Victor Stinner " +"於 :gh:`106316` 貢獻。)" -#: ../../whatsnew/3.13.rst:2419 +#: ../../whatsnew/3.13.rst:2471 msgid "" "Remove the undocumented ``PY_TIMEOUT_MAX`` constant from the limited C API. " "(Contributed by Victor Stinner in :gh:`110014`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2422 +#: ../../whatsnew/3.13.rst:2474 msgid "" "Remove the old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " "``Py_TRASHCAN_SAFE_END``. Replace both with the new macros " @@ -4612,97 +4750,99 @@ msgid "" "in :gh:`105111`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2429 +#: ../../whatsnew/3.13.rst:2481 msgid "Deprecated C APIs" msgstr "器用的 C API" -#: ../../whatsnew/3.13.rst:2431 +#: ../../whatsnew/3.13.rst:2483 msgid "Deprecate old Python initialization functions:" msgstr "" -#: ../../whatsnew/3.13.rst:2433 +#: ../../whatsnew/3.13.rst:2485 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" -":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" -"data:`!warnings.filters`。" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " +"和 :data:`!warnings.filters`。" -#: ../../whatsnew/3.13.rst:2435 +#: ../../whatsnew/3.13.rst:2487 msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" -#: ../../whatsnew/3.13.rst:2437 +#: ../../whatsnew/3.13.rst:2489 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" -#: ../../whatsnew/3.13.rst:2439 +#: ../../whatsnew/3.13.rst:2491 msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" -#: ../../whatsnew/3.13.rst:2441 +#: ../../whatsnew/3.13.rst:2493 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" -#: ../../whatsnew/3.13.rst:2443 +#: ../../whatsnew/3.13.rst:2495 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:23 msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" -#: ../../whatsnew/3.13.rst:2445 +#: ../../whatsnew/3.13.rst:2497 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" -"`PYTHONHOME` environment variable instead." +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or " +"the :envvar:`PYTHONHOME` environment variable instead." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" -"`PYTHONHOME` 環境變數。" +":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " +"或 :envvar:`PYTHONHOME` 環境變數。" -#: ../../whatsnew/3.13.rst:2449 +#: ../../whatsnew/3.13.rst:2501 msgid "(Contributed by Victor Stinner in :gh:`105145`.)" msgstr "(由 Victor Stinner 在 :gh:`105145` 中貢獻。)" -#: ../../whatsnew/3.13.rst:2451 +#: ../../whatsnew/3.13.rst:2503 msgid "" -":term:`Soft deprecate <soft deprecated>` the :c:func:`PyEval_GetBuiltins`, :" -"c:func:`PyEval_GetGlobals`, and :c:func:`PyEval_GetLocals` functions, which " -"return a :term:`borrowed reference`. (Soft deprecated as part of :pep:`667`.)" +":term:`Soft deprecate <soft deprecated>` " +"the :c:func:`PyEval_GetBuiltins`, :c:func:`PyEval_GetGlobals`, " +"and :c:func:`PyEval_GetLocals` functions, which return a :term:`borrowed " +"reference`. (Soft deprecated as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2457 +#: ../../whatsnew/3.13.rst:2509 msgid "" "Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function, which is just " "an alias to :c:func:`PyImport_ImportModule` since Python 3.3. (Contributed " "by Victor Stinner in :gh:`105396`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2461 +#: ../../whatsnew/3.13.rst:2513 msgid "" ":term:`Soft deprecate <soft deprecated>` the :c:func:`PyModule_AddObject` " -"function. It should be replaced with :c:func:`PyModule_Add` or :c:func:" -"`PyModule_AddObjectRef`. (Contributed by Serhiy Storchaka in :gh:`86493`.)" +"function. It should be replaced with :c:func:`PyModule_Add` " +"or :c:func:`PyModule_AddObjectRef`. (Contributed by Serhiy Storchaka " +"in :gh:`86493`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2467 +#: ../../whatsnew/3.13.rst:2519 msgid "" -"Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types and the :c:" -"macro:`!Py_UNICODE_WIDE` define. Use the :c:type:`wchar_t` type directly " -"instead. Since Python 3.3, ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` are just " -"aliases to :c:type:`!wchar_t`. (Contributed by Victor Stinner in :gh:" -"`105156`.)" +"Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types and " +"the :c:macro:`!Py_UNICODE_WIDE` define. Use the :c:type:`wchar_t` type " +"directly instead. Since Python 3.3, ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` " +"are just aliases to :c:type:`!wchar_t`. (Contributed by Victor Stinner " +"in :gh:`105156`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2474 +#: ../../whatsnew/3.13.rst:2526 msgid "" -"Deprecate the :c:func:`PyWeakref_GetObject` and :c:func:" -"`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed reference`. " -"Replace them with the new :c:func:`PyWeakref_GetRef` function, which returns " -"a :term:`strong reference`. The `pythoncapi-compat project`_ can be used to " -"get :c:func:`PyWeakref_GetRef` on Python 3.12 and older. (Contributed by " -"Victor Stinner in :gh:`105927`.)" +"Deprecate the :c:func:`PyWeakref_GetObject` " +"and :c:func:`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed " +"reference`. Replace them with the new :c:func:`PyWeakref_GetRef` function, " +"which returns a :term:`strong reference`. The `pythoncapi-compat project`_ " +"can be used to get :c:func:`PyWeakref_GetRef` on Python 3.12 and older. " +"(Contributed by Victor Stinner in :gh:`105927`.)" msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 @@ -4710,16 +4850,16 @@ msgid "" "The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " "(:pep:`699`; :gh:`101193`)." msgstr "" -":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 (:pep:" -"`699`;:gh:`101193`)。" +":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 " +"(:pep:`699`;:gh:`101193`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 msgid "" "Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable " "bases (:gh:`95388`)." msgstr "" -"使用可變基底建立\\ :c:data:`不可變型別 <Py_TPFLAGS_IMMUTABLETYPE>` (:gh:" -"`95388`)。" +"使用可變基底建立\\ :c:data:`不可變型別 <Py_TPFLAGS_IMMUTABLETYPE>` " +"(:gh:`95388`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:10 msgid "" @@ -4749,8 +4889,8 @@ msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" -"`PyConfig` instead." +"The :c:func:`Py_InitializeFromConfig` API should be used " +"with :c:type:`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" @@ -4807,24 +4947,24 @@ msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "instead." msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." -"use_environment`。" +":c:var:`Py_IgnoreEnvironmentFlag`:請改" +"用 :c:member:`PyConfig.use_environment`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "instead." msgstr "" -":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." -"write_bytecode`。" +":c:var:`Py_DontWriteBytecodeFlag`:請改" +"用 :c:member:`PyConfig.write_bytecode`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 msgid "" -":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." -"user_site_directory` instead." +":c:var:`Py_NoUserSiteDirectory`: " +"Use :c:member:`PyConfig.user_site_directory` instead." msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." -"user_site_directory`。" +":c:var:`Py_NoUserSiteDirectory`:請改" +"用 :c:member:`PyConfig.user_site_directory`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 msgid "" @@ -4847,51 +4987,51 @@ msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." -"legacy_windows_fs_encoding` instead." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: " +"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` instead." msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." -"legacy_windows_fs_encoding`。" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" +"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." -"legacy_windows_stdio` instead." +":c:var:`Py_LegacyWindowsStdioFlag`: " +"Use :c:member:`PyConfig.legacy_windows_stdio` instead." msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." -"legacy_windows_stdio`。" +":c:var:`Py_LegacyWindowsStdioFlag`:請改" +"用 :c:member:`PyConfig.legacy_windows_stdio`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." -"filesystem_encoding` instead." +":c:var:`!Py_FileSystemDefaultEncoding`: " +"Use :c:member:`PyConfig.filesystem_encoding` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." -"filesystem_encoding`。" +":c:var:`!Py_FileSystemDefaultEncoding`:請改" +"用 :c:member:`PyConfig.filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." -"filesystem_encoding` instead." +":c:var:`!Py_HasFileSystemDefaultEncoding`: " +"Use :c:member:`PyConfig.filesystem_encoding` instead." msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." -"filesystem_encoding`。" +":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" +"用 :c:member:`PyConfig.filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." -"filesystem_errors` instead." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: " +"Use :c:member:`PyConfig.filesystem_errors` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." -"filesystem_errors`。" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" +"用 :c:member:`PyConfig.filesystem_errors`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" -"c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. " +"(see :c:func:`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" -"func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" +"見 :c:func:`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 msgid "The bundled copy of ``libmpdecimal``." @@ -4899,27 +5039,27 @@ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" -"`PyImport_ImportModule` instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: " +"Use :c:func:`PyImport_ImportModule` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" -"`PyImport_ImportModule`。" +":c:func:`PyImport_ImportModuleNoBlock`:請改" +"用 :c:func:`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 msgid "" -":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" -"func:`PyWeakref_GetRef` instead." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " +"Use :c:func:`PyWeakref_GetRef` instead." msgstr "" -":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" -"func:`PyWeakref_GetRef`。" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" +"用 :c:func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 msgid "" -":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" -"type:`wchar_t` instead." +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " +"Use :c:type:`wchar_t` instead." msgstr "" -":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" -"`wchar_t`。" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" +"用 :c:type:`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 msgid "Python initialization functions:" @@ -4927,19 +5067,19 @@ msgstr "Python 初始化函式:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 msgid "" -":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." -"exec_prefix` instead." +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` " +"and :data:`sys.exec_prefix` instead." msgstr "" -":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" -"`sys.exec_prefix`。" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` " +"與 :data:`sys.exec_prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 msgid "" ":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " "instead." msgstr "" -":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." -"prefix`。" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` " +"與 :data:`sys.prefix`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" @@ -4960,8 +5100,8 @@ msgid "" ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" -":c:func:`PyErr_NormalizeException`:請改用 :c:func:" -"`PyErr_GetRaisedException`。" +":c:func:`PyErr_NormalizeException`:請改" +"用 :c:func:`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" @@ -4981,11 +5121,11 @@ msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" -"`PySlice_AdjustIndices` instead." +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " +"and :c:func:`PySlice_AdjustIndices` instead." msgstr "" -":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" -"`PySlice_AdjustIndices`。" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` " +"和 :c:func:`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid "" @@ -5031,8 +5171,8 @@ msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." msgstr "" -":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" -"`PyObject_Hash`。" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" +"叫 :c:func:`PyObject_Hash`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid ":c:member:`!PyDictObject.ma_version_tag` member." @@ -5072,56 +5212,57 @@ msgstr "" msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.13.rst:2494 +#: ../../whatsnew/3.13.rst:2546 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.13.rst:2496 +#: ../../whatsnew/3.13.rst:2548 msgid "" "``arm64-apple-ios`` and ``arm64-apple-ios-simulator`` are both now :pep:`11` " "tier 3 platforms. (:ref:`PEP 730 <whatsnew313-platform-support>` written and " "implementation contributed by Russell Keith-Magee in :gh:`114099`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2501 +#: ../../whatsnew/3.13.rst:2553 msgid "" -"``aarch64-linux-android`` and ``x86_64-linux-android`` are both now :pep:" -"`11` tier 3 platforms. (:ref:`PEP 738 <whatsnew313-platform-support>` " -"written and implementation contributed by Malcolm Smith in :gh:`116622`.)" +"``aarch64-linux-android`` and ``x86_64-linux-android`` are both " +"now :pep:`11` tier 3 platforms. (:ref:`PEP 738 <whatsnew313-platform-" +"support>` written and implementation contributed by Malcolm Smith " +"in :gh:`116622`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2506 +#: ../../whatsnew/3.13.rst:2558 msgid "" "``wasm32-wasi`` is now a :pep:`11` tier 2 platform. (Contributed by Brett " "Cannon in :gh:`115192`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2509 +#: ../../whatsnew/3.13.rst:2561 msgid "" "``wasm32-emscripten`` is no longer a :pep:`11` supported platform. " "(Contributed by Brett Cannon in :gh:`115192`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2512 +#: ../../whatsnew/3.13.rst:2564 msgid "" "Building CPython now requires a compiler with support for the C11 atomic " "library, GCC built-in atomic functions, or MSVC interlocked intrinsics." msgstr "" -#: ../../whatsnew/3.13.rst:2515 +#: ../../whatsnew/3.13.rst:2567 msgid "" -"Autoconf 2.71 and aclocal 1.16.5 are now required to regenerate the :file:" -"`configure` script. (Contributed by Christian Heimes in :gh:`89886` and by " -"Victor Stinner in :gh:`112090`.)" +"Autoconf 2.71 and aclocal 1.16.5 are now required to regenerate " +"the :file:`configure` script. (Contributed by Christian Heimes " +"in :gh:`89886` and by Victor Stinner in :gh:`112090`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2519 +#: ../../whatsnew/3.13.rst:2571 msgid "" "SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension " "module. (Contributed by Erlend Aasland in :gh:`105875`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2523 +#: ../../whatsnew/3.13.rst:2575 msgid "" "CPython now bundles the `mimalloc library`_ by default. It is licensed under " "the MIT license; see :ref:`mimalloc license <mimalloc-license>`. The bundled " @@ -5129,58 +5270,59 @@ msgid "" "Dino Viehland in :gh:`109914`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2531 +#: ../../whatsnew/3.13.rst:2583 msgid "" "The :file:`configure` option :option:`--with-system-libmpdec` now defaults " "to ``yes``. The bundled copy of ``libmpdecimal`` will be removed in Python " "3.15." msgstr "" -#: ../../whatsnew/3.13.rst:2535 +#: ../../whatsnew/3.13.rst:2587 msgid "" "Python built with :file:`configure` :option:`--with-trace-refs` (tracing " -"references) is now ABI compatible with the Python release build and :ref:" -"`debug build <debug-build>`. (Contributed by Victor Stinner in :gh:`108634`.)" +"references) is now ABI compatible with the Python release build " +"and :ref:`debug build <debug-build>`. (Contributed by Victor Stinner " +"in :gh:`108634`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2540 +#: ../../whatsnew/3.13.rst:2592 msgid "" "On POSIX systems, the pkg-config (``.pc``) filenames now include the ABI " "flags. For example, the free-threaded build generates ``python-3.13t.pc`` " "and the debug build generates ``python-3.13d.pc``." msgstr "" -#: ../../whatsnew/3.13.rst:2544 +#: ../../whatsnew/3.13.rst:2596 msgid "" "The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``, " -"``termios``, ``winsound``, ``_ctypes_test``, ``_multiprocessing." -"posixshmem``, ``_scproxy``, ``_stat``, ``_statistics``, ``_testconsole``, " -"``_testimportmultiple`` and ``_uuid`` C extensions are now built with the :" -"ref:`limited C API <limited-c-api>`. (Contributed by Victor Stinner in :gh:" -"`85283`.)" +"``termios``, ``winsound``, ``_ctypes_test``, " +"``_multiprocessing.posixshmem``, ``_scproxy``, ``_stat``, ``_statistics``, " +"``_testconsole``, ``_testimportmultiple`` and ``_uuid`` C extensions are now " +"built with the :ref:`limited C API <limited-c-api>`. (Contributed by Victor " +"Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2553 +#: ../../whatsnew/3.13.rst:2605 msgid "Porting to Python 3.13" msgstr "移植至 Python 3.13" -#: ../../whatsnew/3.13.rst:2555 +#: ../../whatsnew/3.13.rst:2607 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.13.rst:2559 +#: ../../whatsnew/3.13.rst:2611 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.13.rst:2563 +#: ../../whatsnew/3.13.rst:2615 msgid "" ":ref:`PEP 667 <whatsnew313-locals-semantics>` introduces several changes to " "the semantics of :func:`locals` and :attr:`f_locals <frame.f_locals>`:" msgstr "" -#: ../../whatsnew/3.13.rst:2566 +#: ../../whatsnew/3.13.rst:2618 msgid "" "Calling :func:`locals` in an :term:`optimized scope` now produces an " "independent snapshot on each call, and hence no longer implicitly updates " @@ -5192,7 +5334,7 @@ msgid "" "scope. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2575 +#: ../../whatsnew/3.13.rst:2627 msgid "" "Calling :func:`locals` from a comprehension at module or class scope " "(including via ``exec`` or ``eval``) once more behaves as if the " @@ -5202,7 +5344,7 @@ msgid "" "implementing :pep:`709`. (Changed as part of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2582 +#: ../../whatsnew/3.13.rst:2634 msgid "" "Accessing :attr:`FrameType.f_locals <frame.f_locals>` in an :term:`optimized " "scope` now returns a write-through proxy rather than a snapshot that gets " @@ -5211,22 +5353,22 @@ msgid "" "of :pep:`667`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2588 +#: ../../whatsnew/3.13.rst:2640 msgid "" ":class:`functools.partial` now emits a :exc:`FutureWarning` when used as a " -"method. The behavior will change in future Python versions. Wrap it in :func:" -"`staticmethod` if you want to preserve the old behavior. (Contributed by " -"Serhiy Storchaka in :gh:`121027`.)" +"method. The behavior will change in future Python versions. Wrap it " +"in :func:`staticmethod` if you want to preserve the old behavior. " +"(Contributed by Serhiy Storchaka in :gh:`121027`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2594 +#: ../../whatsnew/3.13.rst:2646 msgid "" "An :exc:`OSError` is now raised by :func:`getpass.getuser` for any failure " "to retrieve a username, instead of :exc:`ImportError` on non-Unix platforms " "or :exc:`KeyError` on Unix platforms where the password database is empty." msgstr "" -#: ../../whatsnew/3.13.rst:2599 +#: ../../whatsnew/3.13.rst:2651 msgid "" "The value of the :attr:`!mode` attribute of :class:`gzip.GzipFile` is now a " "string (``'rb'`` or ``'wb'``) instead of an integer (``1`` or ``2``). The " @@ -5235,13 +5377,13 @@ msgid "" "(Contributed by Serhiy Storchaka in :gh:`115961`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2605 +#: ../../whatsnew/3.13.rst:2657 msgid "" ":class:`mailbox.Maildir` now ignores files with a leading dot (``.``). " "(Contributed by Zackery Spytz in :gh:`65559`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2608 +#: ../../whatsnew/3.13.rst:2660 msgid "" ":meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` now return both " "files and directories if a pattern that ends with \"``**``\" is given, " @@ -5249,45 +5391,45 @@ msgid "" "behavior and only match directories." msgstr "" -#: ../../whatsnew/3.13.rst:2613 +#: ../../whatsnew/3.13.rst:2665 msgid "" "The :mod:`threading` module now expects the :mod:`!_thread` module to have " "an :func:`!_is_main_interpreter` function. This function takes no arguments " "and returns ``True`` if the current interpreter is the main interpreter." msgstr "" -#: ../../whatsnew/3.13.rst:2618 +#: ../../whatsnew/3.13.rst:2670 msgid "" "Any library or application that provides a custom :mod:`!_thread` module " "must provide :func:`!_is_main_interpreter`, just like the module's other " "\"private\" attributes. (:gh:`112826`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2625 +#: ../../whatsnew/3.13.rst:2677 msgid "Changes in the C API" msgstr "C API 中的改動" -#: ../../whatsnew/3.13.rst:2627 +#: ../../whatsnew/3.13.rst:2679 msgid "" "``Python.h`` no longer includes the ``<ieeefp.h>`` standard header. It was " "included for the :c:func:`!finite` function which is now provided by the " "``<math.h>`` header. It should now be included explicitly if needed. Remove " -"also the ``HAVE_IEEEFP_H`` macro. (Contributed by Victor Stinner in :gh:" -"`108765`.)" +"also the ``HAVE_IEEEFP_H`` macro. (Contributed by Victor Stinner " +"in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2633 +#: ../../whatsnew/3.13.rst:2685 msgid "" "``Python.h`` no longer includes these standard header files: ``<time.h>``, " "``<sys/select.h>`` and ``<sys/time.h>``. If needed, they should now be " "included explicitly. For example, ``<time.h>`` provides the :c:func:`!clock` " "and :c:func:`!gmtime` functions, ``<sys/select.h>`` provides the :c:func:`!" -"select` function, and ``<sys/time.h>`` provides the :c:func:`!futimes`, :c:" -"func:`!gettimeofday` and :c:func:`!setitimer` functions. (Contributed by " -"Victor Stinner in :gh:`108765`.)" +"select` function, and ``<sys/time.h>`` provides the :c:func:`!" +"futimes`, :c:func:`!gettimeofday` and :c:func:`!setitimer` functions. " +"(Contributed by Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2641 +#: ../../whatsnew/3.13.rst:2693 msgid "" "On Windows, ``Python.h`` no longer includes the ``<stddef.h>`` standard " "header file. If needed, it should now be included explicitly. For example, " @@ -5297,7 +5439,7 @@ msgid "" "(Contributed by Victor Stinner in :gh:`108765`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2648 +#: ../../whatsnew/3.13.rst:2700 msgid "" "If the :c:macro:`Py_LIMITED_API` macro is defined, :c:macro:`!" "Py_BUILD_CORE`, :c:macro:`!Py_BUILD_CORE_BUILTIN` and :c:macro:`!" @@ -5305,18 +5447,18 @@ msgid "" "(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2653 +#: ../../whatsnew/3.13.rst:2705 msgid "" "The old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " "``Py_TRASHCAN_SAFE_END`` were removed. They should be replaced by the new " "macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``." msgstr "" -#: ../../whatsnew/3.13.rst:2657 +#: ../../whatsnew/3.13.rst:2709 msgid "A ``tp_dealloc`` function that has the old macros, such as::" msgstr "有舊巨集的 ``tp_dealloc`` 函式,例如: ::" -#: ../../whatsnew/3.13.rst:2659 +#: ../../whatsnew/3.13.rst:2711 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -5336,11 +5478,11 @@ msgstr "" " Py_TRASHCAN_SAFE_END\n" "}" -#: ../../whatsnew/3.13.rst:2668 +#: ../../whatsnew/3.13.rst:2720 msgid "should migrate to the new macros as follows::" msgstr "應該改為使用新的巨集,如下所示: ::" -#: ../../whatsnew/3.13.rst:2670 +#: ../../whatsnew/3.13.rst:2722 msgid "" "static void\n" "mytype_dealloc(mytype *p)\n" @@ -5360,7 +5502,7 @@ msgstr "" " Py_TRASHCAN_END\n" "}" -#: ../../whatsnew/3.13.rst:2679 +#: ../../whatsnew/3.13.rst:2731 msgid "" "Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " "deallocation function it is in. The new macros were added in Python 3.8 and " @@ -5368,67 +5510,177 @@ msgid "" "in :gh:`105111`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2686 +#: ../../whatsnew/3.13.rst:2738 msgid "" ":ref:`PEP 667 <whatsnew313-locals-semantics>` introduces several changes to " "frame-related functions:" msgstr "" -#: ../../whatsnew/3.13.rst:2689 +#: ../../whatsnew/3.13.rst:2741 msgid "" -"The effects of mutating the dictionary returned from :c:func:" -"`PyEval_GetLocals` in an :term:`optimized scope` have changed. New dict " -"entries added this way will now *only* be visible to subsequent :c:func:" -"`PyEval_GetLocals` calls in that frame, as :c:func:`PyFrame_GetLocals`, :" -"func:`locals`, and :attr:`FrameType.f_locals <frame.f_locals>` no longer " -"access the same underlying cached dictionary. Changes made to entries for " -"actual variable names and names added via the write-through proxy interfaces " -"will be overwritten on subsequent calls to :c:func:`PyEval_GetLocals` in " -"that frame. The recommended code update depends on how the function was " -"being used, so refer to the deprecation notice on the function for details." +"The effects of mutating the dictionary returned " +"from :c:func:`PyEval_GetLocals` in an :term:`optimized scope` have changed. " +"New dict entries added this way will now *only* be visible to " +"subsequent :c:func:`PyEval_GetLocals` calls in that frame, " +"as :c:func:`PyFrame_GetLocals`, :func:`locals`, " +"and :attr:`FrameType.f_locals <frame.f_locals>` no longer access the same " +"underlying cached dictionary. Changes made to entries for actual variable " +"names and names added via the write-through proxy interfaces will be " +"overwritten on subsequent calls to :c:func:`PyEval_GetLocals` in that frame. " +"The recommended code update depends on how the function was being used, so " +"refer to the deprecation notice on the function for details." msgstr "" -#: ../../whatsnew/3.13.rst:2702 +#: ../../whatsnew/3.13.rst:2754 msgid "" "Calling :c:func:`PyFrame_GetLocals` in an :term:`optimized scope` now " "returns a write-through proxy rather than a snapshot that gets updated at " "ill-specified times. If a snapshot is desired, it must be created explicitly " -"(e.g. with :c:func:`PyDict_Copy`), or by calling the new :c:func:" -"`PyEval_GetFrameLocals` API." +"(e.g. with :c:func:`PyDict_Copy`), or by calling the " +"new :c:func:`PyEval_GetFrameLocals` API." msgstr "" -#: ../../whatsnew/3.13.rst:2709 +#: ../../whatsnew/3.13.rst:2761 msgid "" ":c:func:`!PyFrame_FastToLocals` and :c:func:`!PyFrame_FastToLocalsWithError` " "no longer have any effect. Calling these functions has been redundant since " "Python 3.11, when :c:func:`PyFrame_GetLocals` was first introduced." msgstr "" -#: ../../whatsnew/3.13.rst:2714 +#: ../../whatsnew/3.13.rst:2766 msgid "" ":c:func:`!PyFrame_LocalsToFast` no longer has any effect. Calling this " "function is redundant now that :c:func:`PyFrame_GetLocals` returns a write-" "through proxy for :term:`optimized scopes <optimized scope>`." msgstr "" -#: ../../whatsnew/3.13.rst:2719 +#: ../../whatsnew/3.13.rst:2770 +msgid "" +"Python 3.13 removed many private functions. Some of them can be replaced " +"using these alternatives:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2773 +msgid "``_PyDict_Pop()``: :c:func:`PyDict_Pop` or :c:func:`PyDict_PopString`;" +msgstr "" +"``_PyDict_Pop()``::c:func:`PyDict_Pop` 或 :c:func:`PyDict_PopString`;" + +#: ../../whatsnew/3.13.rst:2774 +msgid "``_PyDict_GetItemWithError()``: :c:func:`PyDict_GetItemRef`;" +msgstr "``_PyDict_GetItemWithError()``::c:func:`PyDict_GetItemRef`;" + +#: ../../whatsnew/3.13.rst:2775 +msgid "``_PyErr_WriteUnraisableMsg()``: :c:func:`PyErr_FormatUnraisable`;" +msgstr "``_PyErr_WriteUnraisableMsg()``::c:func:`PyErr_FormatUnraisable`;" + +#: ../../whatsnew/3.13.rst:2776 +msgid "" +"``_PyEval_SetTrace()``: :c:func:`PyEval_SetTrace` " +"or :c:func:`PyEval_SetTraceAllThreads`;" +msgstr "" +"``_PyEval_SetTrace()``::c:func:`PyEval_SetTrace` " +"或 :c:func:`PyEval_SetTraceAllThreads`;" + +#: ../../whatsnew/3.13.rst:2777 +msgid "``_PyList_Extend()``: :c:func:`PyList_Extend`;" +msgstr "``_PyList_Extend()``::c:func:`PyList_Extend`;" + +#: ../../whatsnew/3.13.rst:2778 +msgid "``_PyLong_AsInt()``: :c:func:`PyLong_AsInt`;" +msgstr "``_PyLong_AsInt()``::c:func:`PyLong_AsInt`;" + +#: ../../whatsnew/3.13.rst:2779 +msgid "``_PyMem_RawStrdup()``: ``strdup()``;" +msgstr "``_PyMem_RawStrdup()``:``strdup()``;" + +#: ../../whatsnew/3.13.rst:2780 +msgid "``_PyMem_Strdup()``: ``strdup()``;" +msgstr "``_PyMem_Strdup()``:``strdup()``;" + +#: ../../whatsnew/3.13.rst:2781 +msgid "``_PyObject_ClearManagedDict()``: :c:func:`PyObject_ClearManagedDict`;" +msgstr "``_PyObject_ClearManagedDict()``::c:func:`PyObject_ClearManagedDict`;" + +#: ../../whatsnew/3.13.rst:2782 +msgid "``_PyObject_VisitManagedDict()``: :c:func:`PyObject_VisitManagedDict`;" +msgstr "``_PyObject_VisitManagedDict()``::c:func:`PyObject_VisitManagedDict`;" + +#: ../../whatsnew/3.13.rst:2783 +msgid "``_PyThreadState_UncheckedGet()``: :c:func:`PyThreadState_GetUnchecked()`;" +msgstr "``_PyThreadState_UncheckedGet()``::c:func:`PyThreadState_GetUnchecked()`;" + +#: ../../whatsnew/3.13.rst:2784 +msgid "``_PyTime_AsSecondsDouble()``: :c:func:`PyTime_AsSecondsDouble`;" +msgstr "``_PyTime_AsSecondsDouble()``::c:func:`PyTime_AsSecondsDouble`;" + +#: ../../whatsnew/3.13.rst:2785 +msgid "" +"``_PyTime_GetMonotonicClock()``: :c:func:`PyTime_Monotonic` " +"or :c:func:`PyTime_MonotonicRaw`;" +msgstr "" +"``_PyTime_GetMonotonicClock()``::c:func:`PyTime_Monotonic` " +"或 :c:func:`PyTime_MonotonicRaw`;" + +#: ../../whatsnew/3.13.rst:2786 +msgid "" +"``_PyTime_GetPerfCounter()``: :c:func:`PyTime_PerfCounter` " +"or :c:func:`PyTime_PerfCounterRaw`;" +msgstr "" +"``_PyTime_GetPerfCounter()``::c:func:`PyTime_PerfCounter` " +"或 :c:func:`PyTime_PerfCounterRaw`;" + +#: ../../whatsnew/3.13.rst:2787 +msgid "" +"``_PyTime_GetSystemClock()``: :c:func:`PyTime_Time` " +"or :c:func:`PyTime_TimeRaw`;" +msgstr "" +"``_PyTime_GetSystemClock()``::c:func:`PyTime_Time` " +"或 :c:func:`PyTime_TimeRaw`;" + +#: ../../whatsnew/3.13.rst:2788 +msgid "``_PyTime_MAX``: :c:var:`PyTime_MAX`;" +msgstr "``_PyTime_MAX``::c:var:`PyTime_MAX`;" + +#: ../../whatsnew/3.13.rst:2789 +msgid "``_PyTime_MIN``: :c:var:`PyTime_MIN`;" +msgstr "``_PyTime_MIN``::c:var:`PyTime_MIN`;" + +#: ../../whatsnew/3.13.rst:2790 +msgid "``_PyTime_t``: :c:type:`PyTime_t`;" +msgstr "``_PyTime_t``::c:type:`PyTime_t`;" + +#: ../../whatsnew/3.13.rst:2791 +msgid "``_Py_HashPointer()``: :c:func:`Py_HashPointer`;" +msgstr "``_Py_HashPointer()``::c:func:`Py_HashPointer`;" + +#: ../../whatsnew/3.13.rst:2792 +msgid "``_Py_IsFinalizing()``: :c:func:`Py_IsFinalizing`." +msgstr "``_Py_IsFinalizing()``::c:func:`Py_IsFinalizing`。" + +#: ../../whatsnew/3.13.rst:2794 +msgid "" +"The `pythoncapi-compat project`_ can be used to get most of these new " +"functions on Python 3.12 and older." +msgstr "" + +#: ../../whatsnew/3.13.rst:2798 msgid "Regression Test Changes" msgstr "" -#: ../../whatsnew/3.13.rst:2721 +#: ../../whatsnew/3.13.rst:2800 msgid "" -"Python built with :file:`configure` :option:`--with-pydebug` now supports a :" -"option:`-X presite=package.module <-X>` command-line option. If used, it " +"Python built with :file:`configure` :option:`--with-pydebug` now supports " +"a :option:`-X presite=package.module <-X>` command-line option. If used, it " "specifies a module that should be imported early in the lifecycle of the " "interpreter, before ``site.py`` is executed. (Contributed by Łukasz Langa " "in :gh:`110769`.)" msgstr "" -#: ../../whatsnew/3.13.rst:2729 +#: ../../whatsnew/3.13.rst:2808 msgid "Notable changes in 3.13.1" msgstr "Python 3.13.1 中顯著的變更" -#: ../../whatsnew/3.13.rst:2734 +#: ../../whatsnew/3.13.rst:2813 msgid "" "The previously undocumented special function :func:`sys.getobjects`, which " "only exists in specialized builds of Python, may now return objects from " diff --git a/whatsnew/3.3.po b/whatsnew/3.3.po index bd3546dee4..32c61f5ff3 100644 --- a/whatsnew/3.3.po +++ b/whatsnew/3.3.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-01-03 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1942,8 +1942,8 @@ msgstr "``-999999999999999999``" #: ../../whatsnew/3.3.rst:1150 msgid "" -"In the context templates (:class:`~decimal.DefaultContext`, :class:`~decimal." -"BasicContext` and :class:`~decimal.ExtendedContext`) the magnitude of :attr:" +"In the context templates (:const:`~decimal.DefaultContext`, :const:`~decimal." +"BasicContext` and :const:`~decimal.ExtendedContext`) the magnitude of :attr:" "`~decimal.Context.Emax` and :attr:`~decimal.Context.Emin` has changed to " "``999999``." msgstr "" diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index 8bdcc0eaaf..2d40afa84d 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-26 00:14+0000\n" +"POT-Creation-Date: 2025-02-05 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1461,7 +1461,7 @@ msgstr "" #: ../../whatsnew/3.4.rst:997 msgid "" -":mod:`importlib.util` now has a :data:`~importlib.util.MAGIC_NUMBER` " +":mod:`importlib.util` now has a :const:`~importlib.util.MAGIC_NUMBER` " "attribute providing access to the bytecode version number. This replaces " "the :func:`!get_magic` function in the deprecated :mod:`!imp` module. " "(Contributed by Brett Cannon in :issue:`18192`.)" diff --git a/whatsnew/changelog.po b/whatsnew/changelog.po index 62347d8849..bbbdb4ce13 100644 --- a/whatsnew/changelog.po +++ b/whatsnew/changelog.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-26 18:54+0800\n" +"POT-Creation-Date: 2025-02-03 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:21+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -20,6 +20,6 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: ../../whatsnew/changelog.rst:5 +#: ../../whatsnew/changelog.rst:7 msgid "Changelog" msgstr "Changelog(更動日誌)" From 5864e8f90f2ef52b01a38aff35de038febbb2c58 Mon Sep 17 00:00:00 2001 From: "W. H. Wang" <mattwang44@gmail.com> Date: Fri, 7 Feb 2025 16:43:21 +0800 Subject: [PATCH 73/89] translate the second half of `library/signal.po` (#995) --- library/signal.po | 187 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 175 insertions(+), 12 deletions(-) diff --git a/library/signal.po b/library/signal.po index 6119c47a3f..2f85ac971d 100644 --- a/library/signal.po +++ b/library/signal.po @@ -657,6 +657,11 @@ msgid "" "interval timer specified by *which* can be cleared by setting *seconds* to " "zero." msgstr "" +"設定由 *which* 指定的間隔計時器(:const:`signal.ITIMER_REAL`、:const:`signal." +"ITIMER_VIRTUAL` 或 :const:`signal.ITIMER_PROF` 之一)並在*seconds*\\ (接受浮" +"點數,與 :func:`alarm` 不同)之後啟動,在之後的每 *interval* 秒啟動一次(如" +"果 *interval* 非零)。*which* 指定的間隔計時器可透過將 *seconds* 設定為零來清" +"除它。" #: ../../library/signal.rst:490 msgid "" @@ -665,20 +670,24 @@ msgid "" "deliver :const:`SIGALRM`, :const:`signal.ITIMER_VIRTUAL` sends :const:" "`SIGVTALRM`, and :const:`signal.ITIMER_PROF` will deliver :const:`SIGPROF`." msgstr "" +"當間隔計時器啟動時,一個訊號會被傳送給行程。傳送的訊號取決於使用的計時器;:" +"const:`signal.ITIMER_REAL` 會傳送 :const:`SIGALRM`,:const:`signal." +"ITIMER_VIRTUAL` 會傳送 :const:`SIGVTALRM`,而 :const:`signal.ITIMER_PROF` 會" +"傳送 :const:`SIGPROF`。" #: ../../library/signal.rst:496 msgid "The old values are returned as a tuple: (delay, interval)." -msgstr "" +msgstr "舊值會以一個元組回傳:(delay, interval)。" #: ../../library/signal.rst:498 msgid "" "Attempting to pass an invalid interval timer will cause an :exc:" "`ItimerError`." -msgstr "" +msgstr "嘗試傳入無效的間隔計時器會導致 :exc:`ItimerError`。" #: ../../library/signal.rst:506 msgid "Returns current value of a given interval timer specified by *which*." -msgstr "" +msgstr "回傳由 *which* 指定之間隔計時器的當前值。" #: ../../library/signal.rst:513 msgid "" @@ -687,6 +696,8 @@ msgid "" "a library to wakeup a poll or select call, allowing the signal to be fully " "processed." msgstr "" +"設定喚醒檔案描述器為 *fd*。當接收到訊號時,訊號編號會以單一位元組寫入 fd。這" +"可被函式庫用來喚醒輪詢 (wakeup a poll) 或 select 呼叫,讓訊號得以完全處理。" #: ../../library/signal.rst:518 msgid "" @@ -695,6 +706,9 @@ msgid "" "*fd* must be non-blocking. It is up to the library to remove any bytes from " "*fd* before calling poll or select again." msgstr "" +"回傳舊的喚醒 fd(如果檔案描述器喚醒未啟用,則回傳 -1)。如果 *fd* 為 -1,則會" +"停用檔案描述器喚醒。如果不是 -1,*fd* 必須是非阻塞的。在再次呼叫輪詢或 " +"select 之前,由函式庫來決定是否移除 *fd* 中的任何位元組。" #: ../../library/signal.rst:523 ../../library/signal.rst:578 msgid "" @@ -703,6 +717,8 @@ msgid "" "call it from other threads will cause a :exc:`ValueError` exception to be " "raised." msgstr "" +"當啟用執行緒時,這個函式只能從\\ :ref:`主直譯器 <signals-and-threads>`\\ 的主" +"執行緒來呼叫;嘗試從其他執行緒呼叫它將會引發 :exc:`ValueError` 例外。" #: ../../library/signal.rst:528 msgid "" @@ -710,6 +726,8 @@ msgid "" "the fd to wake up when a signal arrives, but then they differ in how they " "determine *which* signal or signals have arrived." msgstr "" +"使用這個函式有兩種常見的方式。在這兩種方法中,當訊號抵達時,你都要使用 fd 來" +"喚醒,但它們的不同之處在於如何判斷\\ *哪個或哪些*\\ 訊號有抵達。" #: ../../library/signal.rst:533 msgid "" @@ -721,6 +739,11 @@ msgid "" "you should set ``warn_on_full_buffer=True``, which will at least cause a " "warning to be printed to stderr when signals are lost." msgstr "" +"在第一種方法中,我們從 fd 的緩衝區中讀取資料,而位元組值則提供訊號編號。這個" +"方法很簡單,但在少數情況下可能會遇到問題:一般來說,fd 的緩衝區空間有限,如果" +"太多訊號來得太快,那麼緩衝區可能會滿,而有些訊號可能會遺失。如果你使用這種方" +"法,那麼你應該設定 ``warn_on_full_buffer=True``,這至少會在訊號丟失時將警告印" +"出到 stderr。" #: ../../library/signal.rst:542 msgid "" @@ -731,10 +754,14 @@ msgid "" "``warn_on_full_buffer=False``, so that your users are not confused by " "spurious warning messages." msgstr "" +"在第二種方法中,我們\\ *只會*\\ 將喚醒 fd 用於喚醒,而忽略實際的位元組值。在" +"這種情況下,我們只在乎 fd 的緩衝區是空或非空;即便緩衝區滿了也不代表有問題。" +"如果你使用這種方法,那麼你應該設定 ``warn_on_full_buffer=False``,這樣你的使" +"用者就不會被虛假的警告訊息所混淆。" #: ../../library/signal.rst:549 msgid "On Windows, the function now also supports socket handles." -msgstr "" +msgstr "在 Windows 上,此功能現在也支援 socket 處理程式。" #: ../../library/signal.rst:552 msgid "Added ``warn_on_full_buffer`` parameter." @@ -746,10 +773,12 @@ msgid "" "calls will be restarted when interrupted by signal *signalnum*, otherwise " "system calls will be interrupted. Returns nothing." msgstr "" +"改變系統呼叫重新啟動的行為:如果 *flag* 是 :const:`False`,系統呼叫會在被訊" +"號 *signalnum* 中斷時重新啟動,否則系統呼叫會被中斷。不會回傳任何東西。" #: ../../library/signal.rst:563 msgid "See the man page :manpage:`siginterrupt(3)` for further information." -msgstr "更多資訊請見 :manpage:`siginterrupt(3)` 手冊頁。" +msgstr "更多資訊請見 :manpage:`siginterrupt(3)` 線上手冊。" #: ../../library/signal.rst:565 msgid "" @@ -757,6 +786,8 @@ msgid "" "restart behaviour to interruptible by implicitly calling :c:func:`!" "siginterrupt` with a true *flag* value for the given signal." msgstr "" +"請注意,使用 :func:`signal` 安裝訊號處理程式,會透過隱式呼叫 :c:func:`!" +"siginterrupt` 來將重新啟動的行為重設為可中斷,且指定訊號的 *flag* 值為 true。" #: ../../library/signal.rst:572 msgid "" @@ -767,6 +798,10 @@ msgid "" "`getsignal` above). (See the Unix man page :manpage:`signal(2)` for further " "information.)" msgstr "" +"將訊號 *signalnum* 的處理程式設定為函式 *handler*。*handler* 可以是帶兩個引數" +"的可呼叫 Python 物件(見下面),或是特殊值 :const:`signal.SIG_IGN` 或 :const:" +"`signal.SIG_DFL` 之一。先前的訊號處理程式將會被回傳(請參閱上面 :func:" +"`getsignal` 的說明)。(更多資訊請參閱 Unix 線上手冊 :`signal(2)`)。" #: ../../library/signal.rst:583 msgid "" @@ -775,6 +810,9 @@ msgid "" "objects, see the :ref:`description in the type hierarchy <frame-objects>` or " "see the attribute descriptions in the :mod:`inspect` module)." msgstr "" +"*handler* 被呼叫時有兩個引數:訊號編號和目前的堆疊 frame(``None`` 或一個 " +"frame 物件;關於 frame 物件的描述,請參閱\\ :ref:`型別階層中的描述 <frame-" +"objects>`\\ 或 :mod:`inspect` 模組中的屬性描述)。" #: ../../library/signal.rst:588 msgid "" @@ -785,6 +823,11 @@ msgid "" "an :exc:`AttributeError` will be raised if a signal name is not defined as " "``SIG*`` module level constant." msgstr "" +"在 Windows 上,:func:`signal` 只能在使用 :const:`SIGABRT`、:const:`SIGFPE`、:" +"const:`SIGILL`、:const:`SIGINT`、:const:`SIGSEGV`、:const:`SIGTERM` 或 :" +"const:`SIGBREAK` 時呼叫。在其他情況下會引發 :exc:`ValueError`。請注意,並非所" +"有系統都定義相同的訊號名稱;如果訊號名稱沒有被定義為 ``SIG*`` 模組層級常數," +"則會引發 :exc:`AttributeError` 錯誤。" #: ../../library/signal.rst:599 msgid "" @@ -792,10 +835,12 @@ msgid "" "thread (i.e., the signals which have been raised while blocked). Return the " "set of the pending signals." msgstr "" +"檢查待傳送至呼叫執行緒的訊號集合(即阻檔時已被提出的訊號)。回傳待定訊號的集" +"合。" #: ../../library/signal.rst:605 msgid "See the man page :manpage:`sigpending(2)` for further information." -msgstr "更多資訊請見 :manpage:`sigpending(2)` 手冊頁。" +msgstr "更多資訊請見 :manpage:`sigpending(2)` 線上手冊。" #: ../../library/signal.rst:607 msgid "See also :func:`pause`, :func:`pthread_sigmask` and :func:`sigwait`." @@ -808,16 +853,20 @@ msgid "" "signal (removes it from the pending list of signals), and returns the signal " "number." msgstr "" +"暫停呼叫執行緒的執行,直到送出訊號集合 *sigset* 中指定的一個訊號。函式接受訊" +"號(將其從待定訊號清單中移除),並回傳訊號編號。" #: ../../library/signal.rst:620 msgid "See the man page :manpage:`sigwait(3)` for further information." -msgstr "更多資訊請見 :manpage:`sigwait(3)` 手冊頁。" +msgstr "更多資訊請見 :manpage:`sigwait(3)` 線上手冊。" #: ../../library/signal.rst:622 msgid "" "See also :func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:" "`sigwaitinfo` and :func:`sigtimedwait`." msgstr "" +"另也請見 :func:`pause`、:func:`pthread_sigmask`、:func:`sigpending`、:func:" +"`sigwaitinfo` 和 :func:`sigtimedwait`。" #: ../../library/signal.rst:630 msgid "" @@ -829,6 +878,11 @@ msgid "" "handler is not called for the delivered signal. The function raises an :exc:" "`InterruptedError` if it is interrupted by a signal that is not in *sigset*." msgstr "" +"暫停呼叫執行緒的執行,直到送出訊號集合 *sigset* 中指定的一個訊號。該函式接受" +"訊號,並將其從待定訊號清單中移除。如果 *sigset* 中的一個訊號已經是呼叫執行緒" +"的待定訊號,函式會立即回傳該訊號的相關資訊。對於已傳送的訊號,訊號處理程式不" +"會被呼叫。如果被不在 *sigset* 中的訊號中斷,函式會引發 :exc:" +"`InterruptedError`。" #: ../../library/signal.rst:639 msgid "" @@ -837,10 +891,13 @@ msgid "" "`si_errno`, :attr:`si_pid`, :attr:`si_uid`, :attr:`si_status`, :attr:" "`si_band`." msgstr "" +"回傳值是一個物件,代表 :c:type:`siginfo_t` 結構所包含的資料,即 :attr:" +"`si_signo`、:attr:`si_code`、:attr:`si_errno`、:attr:`si_pid`、:attr:" +"`si_uid`、:attr:`si_status`、:attr:`si_band`。" #: ../../library/signal.rst:646 msgid "See the man page :manpage:`sigwaitinfo(2)` for further information." -msgstr "更多資訊請見 :manpage:`sigwaitinfo(2)` 手冊頁。" +msgstr "更多資訊請見 :manpage:`sigwaitinfo(2)` 線上手冊。" #: ../../library/signal.rst:648 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigtimedwait`." @@ -852,6 +909,8 @@ msgid "" "the signal handler does not raise an exception (see :pep:`475` for the " "rationale)." msgstr "" +"現在如果被不在 *sigset* 中的訊號中斷,且訊號處理程式沒有引發例外,則會重試函" +"式(理由請參閱 :pep:`475`)。" #: ../../library/signal.rst:660 msgid "" @@ -859,10 +918,12 @@ msgid "" "specifying a timeout. If *timeout* is specified as ``0``, a poll is " "performed. Returns :const:`None` if a timeout occurs." msgstr "" +"類似 :func:`sigwaitinfo`,但需要額外的 *timeout* 引數指定逾時時間。如果 " +"*timeout* 指定為 ``0``,會執行輪詢。如果發生逾時則會回傳 :const:`None`。" #: ../../library/signal.rst:666 msgid "See the man page :manpage:`sigtimedwait(2)` for further information." -msgstr "更多資訊請見 :manpage:`sigtimedwait(2)` 手冊頁。" +msgstr "更多資訊請見 :manpage:`sigtimedwait(2)` 線上手冊。" #: ../../library/signal.rst:668 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigwaitinfo`." @@ -874,6 +935,8 @@ msgid "" "a signal not in *sigset* and the signal handler does not raise an exception " "(see :pep:`475` for the rationale)." msgstr "" +"現在如果被不在 *sigset* 中的訊號中斷,且訊號處理程式沒有引發例外,則會使用重" +"新計算的 *timeout* 重試函式(理由請參閱 :pep:`475`)。" #: ../../library/signal.rst:681 msgid "Examples" @@ -888,6 +951,10 @@ msgid "" "alarm before opening the file; if the operation takes too long, the alarm " "signal will be sent, and the handler raises an exception. ::" msgstr "" +"這是一個最小範例程式。它使用 :func:`alarm` 函式來限制等待開啟檔案的時間;如果" +"檔案是用於可能未開啟的序列裝置,這會很有用,因為這通常會導致 :func:`os.open` " +"無限期地被擱置。解決方法是在開啟檔案前設定一個 5 秒的警報;如果操作時間過長," +"警報訊號就會被送出,而處理程式會產生例外。 ::" #: ../../library/signal.rst:690 msgid "" @@ -907,10 +974,25 @@ msgid "" "\n" "signal.alarm(0) # Disable the alarm" msgstr "" +"import signal, os\n" +"\n" +"def handler(signum, frame):\n" +" signame = signal.Signals(signum).name\n" +" print(f'Signal handler called with signal {signame} ({signum})')\n" +" raise OSError(\"Couldn't open device!\")\n" +"\n" +"# 設定訊號處理程式與五秒警報\n" +"signal.signal(signal.SIGALRM, handler)\n" +"signal.alarm(5)\n" +"\n" +"# 這個 open() 可能無限期地被擱置\n" +"fd = os.open('/dev/ttyS0', os.O_RDWR)\n" +"\n" +"signal.alarm(0) # 停用警報" #: ../../library/signal.rst:707 msgid "Note on SIGPIPE" -msgstr "" +msgstr "關於 SIGPIPE 的說明" #: ../../library/signal.rst:709 msgid "" @@ -920,6 +1002,10 @@ msgid "" "`BrokenPipeError: [Errno 32] Broken pipe`. To handle this case, wrap your " "entry point to catch this exception as follows::" msgstr "" +"將程式的輸出管道化到 :manpage:`head(1)` 之類的工具,會在你的行程的標準輸出接" +"收器提早關閉時,導致 :const:`SIGPIPE` 訊號傳送給你的行程。這會導致類似 :code:" +"`BrokenPipeError: [Errno 32] Broken pipe` 的例外。要處理這種情況,請將你的進" +"入點包裝成如下的樣子來捕捉這個例外: ::" #: ../../library/signal.rst:715 msgid "" @@ -945,6 +1031,26 @@ msgid "" "if __name__ == '__main__':\n" " main()" msgstr "" +"import os\n" +"import sys\n" +"\n" +"def main():\n" +" try:\n" +" # 模擬大量輸出(你的程式取代此迴圈)\n" +" for x in range(10000):\n" +" print(\"y\")\n" +" # 在這裡清除輸出以強制 SIGPIPE 在這個 try 區塊\n" +" # 中被觸發\n" +" sys.stdout.flush()\n" +" except BrokenPipeError:\n" +" # Python 在退出時清除標準串流;為剩下的輸出重新導向\n" +" # 至 devnull 來避免關閉時的 BrokenPipeError\n" +" devnull = os.open(os.devnull, os.O_WRONLY)\n" +" os.dup2(devnull, sys.stdout.fileno())\n" +" sys.exit(1) # Python 在 EPIPE 時以錯誤碼 1 退出\n" +"\n" +"if __name__ == '__main__':\n" +" main()" #: ../../library/signal.rst:736 msgid "" @@ -953,10 +1059,13 @@ msgid "" "unexpectedly whenever any socket connection is interrupted while your " "program is still writing to it." msgstr "" +"不要為了避免 :exc:`BrokenPipeError` 而將 :const:`SIGPIPE` 之處置 " +"(disposition) 設定為 :const:`SIG_DFL`。這樣做會導致你的程式在寫入任何 socket " +"連線時被中斷而意外退出。" #: ../../library/signal.rst:745 msgid "Note on Signal Handlers and Exceptions" -msgstr "" +msgstr "訊號處理程式與例外的說明" #: ../../library/signal.rst:747 msgid "" @@ -968,10 +1077,15 @@ msgid "" "exception resulting from a signal handler) may on rare occasions put the " "program in an unexpected state." msgstr "" +"如果訊號處理程式產生例外,例外會傳送到主執行緒並可能在任何 :term:`bytecode` " +"指令之後發生。最值得注意的是,:exc:`KeyboardInterrupt` 可能在執行過程中的任何" +"時候出現。大多數 Python 程式碼,包括標準函式庫,都無法避免這種情況,因此 :" +"exc:`KeyboardInterrupt`\\ (或任何其他由訊號處理程式產生的例外)可能會在罕見" +"的情況下使程式處於預期之外的狀態。" #: ../../library/signal.rst:754 msgid "To illustrate this issue, consider the following code::" -msgstr "" +msgstr "為了說明這個問題,請參考以下程式碼: ::" #: ../../library/signal.rst:756 msgid "" @@ -990,6 +1104,20 @@ msgid "" " ...\n" " self.lock.release()" msgstr "" +"class SpamContext:\n" +" def __init__(self):\n" +" self.lock = threading.Lock()\n" +"\n" +" def __enter__(self):\n" +" # 如果 KeyboardInterrupt 在此發生則一切正常\n" +" self.lock.acquire()\n" +" # 如果 KeyboardInterrupt 在此發生,__exit__ 將不會被呼叫\n" +" ...\n" +" # KeyboardInterrupt 可能在函式回傳之前發生\n" +"\n" +" def __exit__(self, exc_type, exc_val, exc_tb):\n" +" ...\n" +" self.lock.release()" #: ../../library/signal.rst:771 msgid "" @@ -1001,6 +1129,12 @@ msgid "" "own :const:`SIGINT` handler. Below is an example of an HTTP server that " "avoids :exc:`KeyboardInterrupt`::" msgstr "" +"對許多程式來說,尤其是那些只想在 :exc:`KeyboardInterrupt` 時退出的程式,這並" +"不是問題,但是對於複雜或需要高可靠性的應用程式來說,應該避免從訊號處理程式產" +"生例外。它們也應該避免將捕獲 :exc:`KeyboardInterrupt` 作為一種優雅關閉 " +"(gracefully shutting down) 的方式。相反地,它們應該安裝自己的 :const:" +"`SIGINT` 處理程式。以下是 HTTP 伺服器避免 :exc:`KeyboardInterrupt` 的範" +"例: ::" #: ../../library/signal.rst:779 msgid "" @@ -1034,3 +1168,32 @@ msgid "" "serve_forever(httpd)\n" "print(\"Shutdown...\")" msgstr "" +"import signal\n" +"import socket\n" +"from selectors import DefaultSelector, EVENT_READ\n" +"from http.server import HTTPServer, SimpleHTTPRequestHandler\n" +"\n" +"interrupt_read, interrupt_write = socket.socketpair()\n" +"\n" +"def handler(signum, frame):\n" +" print('Signal handler called with signal', signum)\n" +" interrupt_write.send(b'\\0')\n" +"signal.signal(signal.SIGINT, handler)\n" +"\n" +"def serve_forever(httpd):\n" +" sel = DefaultSelector()\n" +" sel.register(interrupt_read, EVENT_READ)\n" +" sel.register(httpd, EVENT_READ)\n" +"\n" +" while True:\n" +" for key, _ in sel.select():\n" +" if key.fileobj == interrupt_read:\n" +" interrupt_read.recv(1)\n" +" return\n" +" if key.fileobj == httpd:\n" +" httpd.handle_request()\n" +"\n" +"print(\"Serving on port 8000\")\n" +"httpd = HTTPServer(('', 8000), SimpleHTTPRequestHandler)\n" +"serve_forever(httpd)\n" +"print(\"Shutdown...\")" From e6a23493d2c1beed1ab883fb64f277068108ebbb Mon Sep 17 00:00:00 2001 From: Matt Wang <mattwang44@gmail.com> Date: Fri, 7 Feb 2025 17:18:09 +0800 Subject: [PATCH 74/89] translate `extending/building.po` --- extending/building.po | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/extending/building.po b/extending/building.po index 1e0c34fe84..46539b1e5e 100644 --- a/extending/building.po +++ b/extending/building.po @@ -1,15 +1,16 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Adrian Liaw <adrianliaw2000@gmail.com>, 2018 +# Matt Wang <mattwang44@gmail.com>, 2025 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" -"PO-Revision-Date: 2018-05-23 14:09+0000\n" -"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" +"PO-Revision-Date: 2025-02-07 14:09+0000\n" +"Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -32,21 +33,25 @@ msgstr "" #: ../../extending/building.rst:12 msgid "" -"To be importable, the shared library must be available on :envvar:" -"`PYTHONPATH`, and must be named after the module name, with an appropriate " -"extension. When using setuptools, the correct filename is generated " -"automatically." +"To be importable, the shared library must be available " +"on :envvar:`PYTHONPATH`, and must be named after the module name, with an " +"appropriate extension. When using setuptools, the correct filename is " +"generated automatically." msgstr "" +"要能夠被引入,共用函式庫必須在 :envvar:`PYTHONPATH` 上可用,並且必須以模組名" +"稱命名,並且必須有適當的副檔名。使用 setuptools 時,正確的檔名會自動產生。" #: ../../extending/building.rst:16 msgid "The initialization function has the signature:" -msgstr "" +msgstr "初始化函式具有簽名:" #: ../../extending/building.rst:20 msgid "" "It returns either a fully initialized module, or a :c:type:`PyModuleDef` " "instance. See :ref:`initializing-modules` for details." msgstr "" +"它回傳一個完全初始化的模組,或一個 :c:type:`PyModuleDef` 實例。詳細資訊請參" +"見 :ref:`initializing-modules`。" #: ../../extending/building.rst:25 msgid "" @@ -57,6 +62,11 @@ msgid "" "``PyInitU_<modulename>``, with ``<modulename>`` encoded using Python's " "*punycode* encoding with hyphens replaced by underscores. In Python::" msgstr "" +"對於僅包含 ASCII 名稱的模組,函式必須以 ``PyInit_<modulename>`` 命名,其中 " +"``<modulename>`` 要替換為模組的名稱。當使用 :ref:`multi-phase-" +"initialization` 時,允許非 ASCII 模組名稱。在這種情況下,初始化函式名稱是 " +"``PyInitU_<modulename>``,其中 ``<modulename>`` 使用 Python 的 *punycode* 編" +"碼,並將連字符號替換為底線。在 Python 中: ::" #: ../../extending/building.rst:32 msgid "" @@ -82,10 +92,13 @@ msgid "" "function corresponding to the filename is found. See the *\"Multiple modules " "in one library\"* section in :pep:`489` for details." msgstr "" +"可以透過定義多個初始化函式,來從單一共用函式庫中匯出多個模組。然而要引入它們" +"需要使用符號連結或自訂引入器,因為預設只會找到對應於檔名的函式。詳細資訊請參" +"見 :pep:`489` 中的 *\"Multiple modules in one library\"* 部分。" #: ../../extending/building.rst:52 msgid "Building C and C++ Extensions with setuptools" -msgstr "" +msgstr "用 setuptools 建置 C 與 C++ 擴充套件" #: ../../extending/building.rst:54 msgid "" @@ -94,3 +107,6 @@ msgid "" "setuptools.html to learn more about how build and distribute C/C++ " "extensions with setuptools." msgstr "" +"Python 3.12 與之後的版本不再帶有 distutils。請在 https://" +"setuptools.readthedocs.io/en/latest/setuptools.html 上參閱 ``setuptools`` 文" +"件,以了解如何使用 setuptools 建置和發佈 C/C++ 擴充套件。" From 06b05d9eb8ae964bb682cdd81707bc7098b352a7 Mon Sep 17 00:00:00 2001 From: mindihx <ymhuang.ymh@gmail.com> Date: Sun, 16 Feb 2025 00:35:59 +0800 Subject: [PATCH 75/89] Update translation for library/pathlib.po (#1013) * Update translation for library/pathlib.po * Refine translation for library/pathlib.po * Update translation of `pattern` in library/pathlib.po --- library/pathlib.po | 303 ++++++++++++++++++++++++--------------------- 1 file changed, 165 insertions(+), 138 deletions(-) diff --git a/library/pathlib.po b/library/pathlib.po index 4db35f669b..1089de4563 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-23 07:52+0800\n" -"PO-Revision-Date: 2024-02-29 20:49+0800\n" +"PO-Revision-Date: 2024-12-23 19:15+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -48,6 +48,12 @@ msgid "" "PosixPath subclasses PurePosixPath and Path, and WindowsPath\n" "subclasses PureWindowsPath and Path." msgstr "" +"顯示 pathlib 中可用類別的繼承圖。\n" +"最基礎的類別是 PurePath,它有三個直接子類別:\n" +"PurePosixPath、PureWindowsPath 和 Path。除了這四個類別之外,\n" +"還有兩個類別使用多重繼承:\n" +"PosixPath 繼承自 PurePosixPath 和 Path,而 WindowsPath 繼承自 " +"PureWindowsPath 和 Path。" #: ../../library/pathlib.rst:31 msgid "" @@ -195,6 +201,8 @@ msgid "" "An exception inheriting :exc:`NotImplementedError` that is raised when an " "unsupported operation is called on a path object." msgstr "" +"繼承自 :exc:`NotImplementedError` 的例外,當在路徑物件上呼叫不支援的操作時會" +"被引發。" #: ../../library/pathlib.rst:110 msgid "Pure paths" @@ -222,6 +230,8 @@ msgid "" ">>> PurePath('setup.py') # Running on a Unix machine\n" "PurePosixPath('setup.py')" msgstr "" +">>> PurePath('setup.py') # 執行在 Unix 機器上\n" +"PurePosixPath('setup.py')" #: ../../library/pathlib.rst:124 msgid "" @@ -609,6 +619,8 @@ msgid "" "The implementation of the :mod:`os.path` module used for low-level path " "parsing and joining: either :mod:`posixpath` or :mod:`ntpath`." msgstr "" +"用於底層路徑剖析和結合的 :mod:`os.path` 模組的實作:可能是 :mod:`posixpath` " +"或 :mod:`ntpath`。" #: ../../library/pathlib.rst:320 msgid "A string representing the drive letter or name, if any::" @@ -1015,12 +1027,16 @@ msgid "" "Windows path names that contain a colon, or end with a dot or a space, are " "considered reserved. UNC paths may be reserved." msgstr "" +"Windows 路徑名稱中包含冒號或結尾為點或空格會被視為保留。UNC 路徑可能被視為保" +"留。" #: ../../library/pathlib.rst:547 msgid "" "This method is deprecated; use :func:`os.path.isreserved` to detect reserved " "paths on Windows." msgstr "" +"此方法已被棄用;請使用 :func:`os.path.isreserved` 來檢測 Windows 上的保留路" +"徑。" #: ../../library/pathlib.rst:553 msgid "" @@ -1053,7 +1069,7 @@ msgid "" "Match this path against the provided glob-style pattern. Return ``True`` if " "matching is successful, ``False`` otherwise. For example::" msgstr "" -"將路徑與 glob 形式的樣式 (glob-style pattern) 做比對。如果比對成功則回傳 " +"將路徑與 glob 形式的模式 (glob-style pattern) 做比對。如果比對成功則回傳 " "``True``,否則回傳 ``False``,例如: ::" #: ../../library/pathlib.rst:571 @@ -1078,7 +1094,7 @@ msgstr "" #: ../../library/pathlib.rst:581 ../../library/pathlib.rst:1291 msgid ":ref:`pathlib-pattern-language` documentation." -msgstr "" +msgstr ":ref:`pathlib-pattern-language` 文件。" #: ../../library/pathlib.rst:583 msgid "As with other methods, case-sensitivity follows platform defaults::" @@ -1106,7 +1122,7 @@ msgid "" "Match this path against the provided non-recursive glob-style pattern. " "Return ``True`` if matching is successful, ``False`` otherwise." msgstr "" -"將路徑與非遞迴 glob 形式的樣式 (glob-style pattern) 做比對。如果比對成功則回" +"將路徑與非遞迴 glob 形式的模式 (glob-style pattern) 做比對。如果比對成功則回" "傳 ``True``,否則回傳 ``False``。" #: ../../library/pathlib.rst:600 @@ -1116,6 +1132,9 @@ msgid "" "\"``**``\" isn't supported (it acts like non-recursive \"``*``\"), and if a " "relative pattern is provided, then matching is done from the right::" msgstr "" +"此方法類似於 :meth:`~PurePath.full_match`,但不允許空白模式(會引發 :exc:" +"`ValueError`)、不支援遞迴萬用字元 \"``**``\"(它會像非遞迴的 \"``*``\" 一" +"樣),且如果提供相對模式,則會從右邊進行比對: ::" #: ../../library/pathlib.rst:605 msgid "" @@ -1136,7 +1155,7 @@ msgstr "" #: ../../library/pathlib.rst:612 ../../library/pathlib.rst:1310 #: ../../library/pathlib.rst:1335 msgid "The *pattern* parameter accepts a :term:`path-like object`." -msgstr "" +msgstr "*pattern* 參數接受\\ :term:`類路徑物件 <path-like object>`。" #: ../../library/pathlib.rst:615 ../../library/pathlib.rst:1304 #: ../../library/pathlib.rst:1329 @@ -1353,7 +1372,7 @@ msgid "" "such as from :attr:`parent` and :meth:`relative_to`. Subclasses may override " "this method to pass information to derivative paths, for example::" msgstr "" -"透過結合給定的 *pathsegments* 建立一個相同類型的新路徑物件,當一個衍生路徑被" +"透過結合給定的 *pathsegments* 建立一個相同型別的新路徑物件,當一個衍生路徑被" "建立的時候會呼叫這個方法,例如從 :attr:`parent` 和 :meth:`relative_to` 建立衍" "生路徑。子類別可以覆寫此方法來傳遞資訊給衍生路徑,例如: ::" @@ -1438,6 +1457,8 @@ msgid "" "Raises :exc:`UnsupportedOperation` on Windows. In previous versions, :exc:" "`NotImplementedError` was raised instead." msgstr "" +"在 Windows 上會引發 :exc:`UnsupportedOperation`。在先前版本中,則是引發 :exc:" +"`NotImplementedError`。" #: ../../library/pathlib.rst:785 msgid "" @@ -1460,6 +1481,8 @@ msgid "" "Raises :exc:`UnsupportedOperation` on non-Windows platforms. In previous " "versions, :exc:`NotImplementedError` was raised instead." msgstr "" +"在非 Windows 平台上會引發 :exc:`UnsupportedOperation`。在先前版本中,則是引" +"發 :exc:`NotImplementedError`。" #: ../../library/pathlib.rst:798 msgid "" @@ -1505,27 +1528,31 @@ msgid "" "Some concrete path methods can raise an :exc:`OSError` if a system call " "fails (for example because the path doesn't exist)." msgstr "" -"有些實體路徑方法會在系統呼叫失敗(例如因為路徑不存在)時引發 :exc:`OSError`" +"有些實體路徑方法會在系統呼叫失敗(例如因為路徑不存在)時引發 :exc:`OSError`。" #: ../../library/pathlib.rst:821 msgid "Parsing and generating URIs" -msgstr "" +msgstr "剖析和產生 URI" #: ../../library/pathlib.rst:823 msgid "" "Concrete path objects can be created from, and represented as, 'file' URIs " "conforming to :rfc:`8089`." msgstr "" +"實體路徑物件可以從符合 :rfc:`8089` 中的 'file' URI 建立,也可以以該形式來表" +"示。" #: ../../library/pathlib.rst:828 msgid "" "File URIs are not portable across machines with different :ref:`filesystem " "encodings <filesystem-encoding>`." msgstr "" +"檔案 URI 在跨不同\\ :ref:`檔案系統編碼 <filesystem-encoding>`\\ 的機器上是無" +"法移植的。" #: ../../library/pathlib.rst:833 msgid "Return a new path object from parsing a 'file' URI. For example::" -msgstr "" +msgstr "從剖析 'file' URI 回傳新的路徑物件。例如: ::" #: ../../library/pathlib.rst:835 msgid "" @@ -1537,7 +1564,7 @@ msgstr "" #: ../../library/pathlib.rst:838 msgid "On Windows, DOS device and UNC paths may be parsed from URIs::" -msgstr "" +msgstr "在 Windows 上,從 URI 可以剖析 DOS 裝置和 UNC 路徑: ::" #: ../../library/pathlib.rst:840 msgid "" @@ -1553,7 +1580,7 @@ msgstr "" #: ../../library/pathlib.rst:845 msgid "Several variant forms are supported::" -msgstr "" +msgstr "支援多種變形: ::" #: ../../library/pathlib.rst:847 msgid "" @@ -1566,20 +1593,29 @@ msgid "" ">>> p = Path.from_uri('file:/c|/windows')\n" "WindowsPath('c:/windows')" msgstr "" +">>> p = Path.from_uri('file:////server/share')\n" +"WindowsPath('//server/share')\n" +">>> p = Path.from_uri('file://///server/share')\n" +"WindowsPath('//server/share')\n" +">>> p = Path.from_uri('file:c:/windows')\n" +"WindowsPath('c:/windows')\n" +">>> p = Path.from_uri('file:/c|/windows')\n" +"WindowsPath('c:/windows')" #: ../../library/pathlib.rst:856 msgid "" ":exc:`ValueError` is raised if the URI does not start with ``file:``, or the " "parsed path isn't absolute." msgstr "" +"如果 URI 不是 ``file:`` 開頭,或是剖析後的路徑不是絕對路徑,則會引發 :exc:" +"`ValueError`。" #: ../../library/pathlib.rst:864 msgid "" "Represent the path as a 'file' URI. :exc:`ValueError` is raised if the path " "isn't absolute." msgstr "" -"以 ``file`` URI 來表示一個路徑。如果路徑不是絕對的則會引發 :exc:" -"`ValueError`。" +"以 'file' URI 來表示路徑。如果路徑不是絕對的則會引發 :exc:`ValueError`。" #: ../../library/pathlib.rst:867 msgid "" @@ -1602,10 +1638,12 @@ msgid "" "For historical reasons, this method is also available from :class:`PurePath` " "objects. However, its use of :func:`os.fsencode` makes it strictly impure." msgstr "" +"因為歷史上的原因,此方法也可以從 :class:`PurePath` 物件上使用。然而,它使用 :" +"func:`os.fsencode` 而讓它完全不純粹。" #: ../../library/pathlib.rst:882 msgid "Expanding and resolving paths" -msgstr "" +msgstr "擴展和解析路徑" #: ../../library/pathlib.rst:886 msgid "" @@ -1736,6 +1774,9 @@ msgid "" "strict mode, and no exception is raised in non-strict mode. In previous " "versions, :exc:`RuntimeError` is raised no matter the value of *strict*." msgstr "" +"在嚴格模式下,符號連結迴圈會像其他錯誤一樣來處理::exc:`OSError` 會被引發,而" +"在非嚴格模式下,不會引發任何例外。在先前版本中,不管 *strict* 的值是什麼,都" +"會引發 :exc:`RuntimeError`。" #: ../../library/pathlib.rst:967 msgid "" @@ -1760,10 +1801,12 @@ msgid "" "Raises :exc:`UnsupportedOperation` if :func:`os.readlink` is not available. " "In previous versions, :exc:`NotImplementedError` was raised." msgstr "" +"如果 :func:`os.readlink` 不可用,會引發 :exc:`UnsupportedOperation`。在先前版" +"本中,則是引發 :exc:`NotImplementedError`。" #: ../../library/pathlib.rst:983 msgid "Querying file type and status" -msgstr "" +msgstr "查詢檔案類型和狀態" #: ../../library/pathlib.rst:987 msgid "" @@ -2007,7 +2050,7 @@ msgstr "" #: ../../library/pathlib.rst:1164 msgid "Reading and writing files" -msgstr "" +msgstr "讀取和寫入檔案" #: ../../library/pathlib.rst:1169 msgid "" @@ -2147,7 +2190,7 @@ msgstr "" msgid "" "If the path is not a directory or otherwise inaccessible, :exc:`OSError` is " "raised." -msgstr "" +msgstr "如果路徑不是目錄或無法存取,則會引發 :exc:`OSError`。" #: ../../library/pathlib.rst:1276 msgid "" @@ -2201,6 +2244,9 @@ msgid "" "``False``, this method follows symlinks except when expanding \"``**``\" " "wildcards. Set *recurse_symlinks* to ``True`` to always follow symlinks." msgstr "" +"預設情況下,或者當 *recurse_symlinks* 僅限關鍵字引數被設定為 ``False`` 的時" +"候,此方法會跟隨符號連結,除非在擴展 \"``**``\" 萬用字元時。將 " +"*recurse_symlinks* 設成 ``True`` 以總是跟隨符號連結。" #: ../../library/pathlib.rst:1302 msgid "" @@ -2220,6 +2266,8 @@ msgid "" "suppressed. In previous versions, such exceptions are suppressed in many " "cases, but not all." msgstr "" +"從掃描檔案系統引發的任何 :exc:`OSError` 例外都會被抑制。在先前版本中,在許多" +"情況下這種例外都會被抑制,但不是所有情況。" #: ../../library/pathlib.rst:1321 msgid "" @@ -2421,10 +2469,18 @@ msgid "" " for name in dirs:\n" " (root / name).rmdir()" msgstr "" +"# 刪除可從 \"top\" 目錄到達的所有東西。\n" +"# 注意:這是危險的!例如,如果 top == Path('/'),\n" +"# 它可能會刪除你所有的檔案。\n" +"for root, dirs, files in top.walk(top_down=False):\n" +" for name in files:\n" +" (root / name).unlink()\n" +" for name in dirs:\n" +" (root / name).rmdir()" #: ../../library/pathlib.rst:1436 msgid "Creating files and directories" -msgstr "建立檔案與目錄" +msgstr "建立檔案和目錄" #: ../../library/pathlib.rst:1440 msgid "" @@ -2443,6 +2499,8 @@ msgid "" "The :meth:`~Path.open`, :meth:`~Path.write_text` and :meth:`~Path." "write_bytes` methods are often used to create files." msgstr "" +":meth:`~Path.open`、:meth:`~Path.write_text` 和 :meth:`~Path.write_bytes` 方" +"法通常用於建立檔案。" #: ../../library/pathlib.rst:1453 msgid "" @@ -2539,6 +2597,8 @@ msgid "" "Raises :exc:`UnsupportedOperation` if :func:`os.symlink` is not available. " "In previous versions, :exc:`NotImplementedError` was raised." msgstr "" +"如果 :func:`os.symlink` 不可用,會引發 :exc:`UnsupportedOperation`。在先前版" +"本中,則是引發 :exc:`NotImplementedError`。" #: ../../library/pathlib.rst:1508 msgid "Make this path a hard link to the same file as *target*." @@ -2554,10 +2614,12 @@ msgid "" "Raises :exc:`UnsupportedOperation` if :func:`os.link` is not available. In " "previous versions, :exc:`NotImplementedError` was raised." msgstr "" +"如果 :func:`os.link` 不可用,會引發 :exc:`UnsupportedOperation`。在先前版本" +"中,則是引發 :exc:`NotImplementedError`。" #: ../../library/pathlib.rst:1522 msgid "Renaming and deleting" -msgstr "" +msgstr "重新命名和刪除" #: ../../library/pathlib.rst:1526 msgid "" @@ -2652,7 +2714,7 @@ msgstr "移除此目錄。該目錄必須為空。" #: ../../library/pathlib.rst:1586 msgid "Permissions and ownership" -msgstr "" +msgstr "權限和所有權" #: ../../library/pathlib.rst:1590 msgid "" @@ -2675,6 +2737,8 @@ msgid "" "Raises :exc:`UnsupportedOperation` if the :mod:`pwd` module is not " "available. In earlier versions, :exc:`NotImplementedError` was raised." msgstr "" +"如果 :mod:`pwd` 模組不可用,會引發 :exc:`UnsupportedOperation`。在先前版本" +"中,則是引發 :exc:`NotImplementedError`。" #: ../../library/pathlib.rst:1606 msgid "" @@ -2697,6 +2761,8 @@ msgid "" "Raises :exc:`UnsupportedOperation` if the :mod:`grp` module is not " "available. In earlier versions, :exc:`NotImplementedError` was raised." msgstr "" +"如果 :mod:`grp` 模組不可用,會引發 :exc:`UnsupportedOperation`。在先前版本" +"中,則是引發 :exc:`NotImplementedError`。" #: ../../library/pathlib.rst:1622 msgid "Change the file mode and permissions, like :func:`os.chmod`." @@ -2737,37 +2803,39 @@ msgstr "" #: ../../library/pathlib.rst:1650 msgid "Pattern language" -msgstr "" +msgstr "模式語言 (pattern language)" #: ../../library/pathlib.rst:1652 msgid "" "The following wildcards are supported in patterns for :meth:`~PurePath." "full_match`, :meth:`~Path.glob` and :meth:`~Path.rglob`:" msgstr "" +"以下的萬用字元在 :meth:`~PurePath.full_match`、:meth:`~Path.glob` 和 :meth:" +"`~Path.rglob` 的模式中被支援:" #: ../../library/pathlib.rst:1655 msgid "``**`` (entire segment)" -msgstr "" +msgstr "``**``\\(整個片段)" #: ../../library/pathlib.rst:1656 msgid "Matches any number of file or directory segments, including zero." -msgstr "" +msgstr "匹配任何數量的檔案或目錄片段,包括零個。" #: ../../library/pathlib.rst:1657 msgid "``*`` (entire segment)" -msgstr "" +msgstr "``*``\\(整個片段)" #: ../../library/pathlib.rst:1658 msgid "Matches one file or directory segment." -msgstr "" +msgstr "匹配一個檔案或目錄的片段。" #: ../../library/pathlib.rst:1659 msgid "``*`` (part of a segment)" -msgstr "" +msgstr "``*``\\(片段的一部分)" #: ../../library/pathlib.rst:1660 msgid "Matches any number of non-separator characters, including zero." -msgstr "" +msgstr "匹配任意數量的非分隔字元,包括零個。" #: ../../library/pathlib.rst:1661 msgid "``?``" @@ -2775,7 +2843,7 @@ msgstr "``?``" #: ../../library/pathlib.rst:1662 msgid "Matches one non-separator character." -msgstr "" +msgstr "匹配一個非分隔字元。" #: ../../library/pathlib.rst:1663 msgid "``[seq]``" @@ -2783,7 +2851,7 @@ msgstr "``[seq]``" #: ../../library/pathlib.rst:1664 msgid "Matches one character in *seq*." -msgstr "" +msgstr "匹配一個在 *seq* 中的字元。" #: ../../library/pathlib.rst:1665 msgid "``[!seq]``" @@ -2791,21 +2859,23 @@ msgstr "``[!seq]``" #: ../../library/pathlib.rst:1666 msgid "Matches one character not in *seq*." -msgstr "" +msgstr "匹配一個不在 *seq* 中的字元。" #: ../../library/pathlib.rst:1668 msgid "" "For a literal match, wrap the meta-characters in brackets. For example, " "``\"[?]\"`` matches the character ``\"?\"``." msgstr "" +"對於文本 (literal) 匹配,可以用方括號包裝元字元 (meta-characters)。例如," +"``\"[?]\"`` 會匹配字元 ``\"?\"``。" #: ../../library/pathlib.rst:1671 msgid "The \"``**``\" wildcard enables recursive globbing. A few examples:" -msgstr "" +msgstr "\"``**``\" 萬用字元讓它可以做遞迴 glob。例如:" #: ../../library/pathlib.rst:1674 msgid "Pattern" -msgstr "" +msgstr "模式" #: ../../library/pathlib.rst:1674 msgid "Meaning" @@ -2817,7 +2887,7 @@ msgstr "\"``**/*``\"" #: ../../library/pathlib.rst:1676 msgid "Any path with at least one segment." -msgstr "" +msgstr "至少有一個片段的路徑。" #: ../../library/pathlib.rst:1677 msgid "\"``**/*.py``\"" @@ -2825,7 +2895,7 @@ msgstr "\"``**/*.py``\"" #: ../../library/pathlib.rst:1677 msgid "Any path with a final segment ending \"``.py``\"." -msgstr "" +msgstr "最後一個片段以 \"``.py``\" 結尾的任何路徑。" #: ../../library/pathlib.rst:1678 msgid "\"``assets/**``\"" @@ -2833,7 +2903,7 @@ msgstr "\"``assets/**``\"" #: ../../library/pathlib.rst:1678 msgid "Any path starting with \"``assets/``\"." -msgstr "" +msgstr "任何以 \"``assets/``\" 開頭的路徑。" #: ../../library/pathlib.rst:1679 msgid "\"``assets/**/*``\"" @@ -2842,33 +2912,39 @@ msgstr "\"``assets/**/*``\"" #: ../../library/pathlib.rst:1679 msgid "" "Any path starting with \"``assets/``\", excluding \"``assets/``\" itself." -msgstr "" +msgstr "任何以 \"``assets/``\" 開頭的路徑,不包括 \"``assets/``\" 本身。" #: ../../library/pathlib.rst:1683 msgid "" "Globbing with the \"``**``\" wildcard visits every directory in the tree. " "Large directory trees may take a long time to search." msgstr "" +"Glob 使用 ``**`` 萬用字元會訪問目錄樹中的每個目錄。對於大型的目錄樹,搜尋可能" +"需要花費很長的時間。" #: ../../library/pathlib.rst:1686 msgid "" "Globbing with a pattern that ends with \"``**``\" returns both files and " "directories. In previous versions, only directories were returned." msgstr "" +"Glob 使用結尾為 ``**`` 的模式會同時回傳檔案和目錄。在先前版本中,只會回傳目" +"錄。" #: ../../library/pathlib.rst:1690 msgid "" "In :meth:`Path.glob` and :meth:`~Path.rglob`, a trailing slash may be added " "to the pattern to match only directories." msgstr "" +"在 :meth:`Path.glob` 和 :meth:`~Path.rglob` 中,可以在模式後面加上斜線以只匹" +"配目錄。" #: ../../library/pathlib.rst:1693 msgid "" "Globbing with a pattern that ends with a pathname components separator (:" "data:`~os.sep` or :data:`~os.altsep`) returns only directories." msgstr "" -"如果 *pattern* 以路徑名稱組成的分隔符號(:data:`~os.sep` 或 :data:`~os." -"altsep`)作結尾來 glob 則只會回傳目錄。" +"Glob 使用以路徑名稱組成的分隔符號(:data:`~os.sep` 或 :data:`~os.altsep`)作" +"結尾的模式則只會回傳目錄。" #: ../../library/pathlib.rst:1699 msgid "Comparison to the :mod:`glob` module" @@ -2879,18 +2955,24 @@ msgid "" "The patterns accepted and results generated by :meth:`Path.glob` and :meth:" "`Path.rglob` differ slightly from those by the :mod:`glob` module:" msgstr "" +":meth:`Path.glob` 和 :meth:`Path.rglob` 接受的模式和產生的結果與 :mod:`glob` " +"模組略有不同:" #: ../../library/pathlib.rst:1704 msgid "" "Files beginning with a dot are not special in pathlib. This is like passing " "``include_hidden=True`` to :func:`glob.glob`." msgstr "" +"pathlib 中以點開頭的檔案並不特別。這和將 ``include_hidden=True`` 傳遞給 :" +"func:`glob.glob` 相同。" #: ../../library/pathlib.rst:1706 msgid "" "\"``**``\" pattern components are always recursive in pathlib. This is like " "passing ``recursive=True`` to :func:`glob.glob`." msgstr "" +"``**`` 模式組成在 pathlib 中總是遞迴的。這與將 ``recursive=True`` 傳遞給 :" +"func:`glob.glob` 相同。" #: ../../library/pathlib.rst:1708 msgid "" @@ -2898,12 +2980,17 @@ msgid "" "This behaviour has no equivalent in :func:`glob.glob`, but you can pass " "``recurse_symlinks=True`` to :meth:`Path.glob` for compatible behaviour." msgstr "" +"在 pathlib 中,``**`` 模式組成預設不跟隨符號連結。這在 :func:`glob.glob` 中沒" +"有等效的行為,但你可以將 ``recurse_symlinks=True`` 傳遞給 :meth:`Path.glob` " +"以獲得相容的行為。" #: ../../library/pathlib.rst:1711 msgid "" "Like all :class:`PurePath` and :class:`Path` objects, the values returned " "from :meth:`Path.glob` and :meth:`Path.rglob` don't include trailing slashes." msgstr "" +"與所有 :class:`PurePath` 和 :class:`Path` 物件一樣,從 :meth:`Path.glob` 和 :" +"meth:`Path.rglob` 回傳的值不包含結尾斜線。" #: ../../library/pathlib.rst:1714 msgid "" @@ -2911,6 +2998,8 @@ msgid "" "include the *path* as a prefix, unlike the results of ``glob." "glob(root_dir=path)``." msgstr "" +"pathlib 的 ``path.glob()`` 和 ``path.rglob()`` 回傳的值包含了 *path* 作為前" +"綴,而 ``glob.glob(root_dir=path)`` 的結果則不會如此。" #: ../../library/pathlib.rst:1717 msgid "" @@ -2919,6 +3008,9 @@ msgid "" "results of ``glob.glob(root_dir=path)`` never include an empty string that " "would correspond to *path*." msgstr "" +"pathlib 的 ``path.glob()`` 和 ``path.rglob()`` 回傳的值可能包含 *path* 本身," +"例如當使用 \"``**``\" 做 glob 的時候,然而 ``glob.glob(root_dir=path)`` 的結" +"果則永遠不會包含一個對應到 *path* 的空字串。" #: ../../library/pathlib.rst:1724 msgid "Comparison to the :mod:`os` and :mod:`os.path` modules" @@ -2932,6 +3024,10 @@ msgid "" "level ``str`` and ``bytes`` objects, which is a more *procedural* approach. " "Some users consider the object-oriented style to be more readable." msgstr "" +"pathlib 使用 :class:`PurePath` 和 :class:`Path` 物件來實作路徑操作,因此它被" +"稱為是\\ *物件導向*\\ 的。另一方面,:mod:`os` 和 :mod:`os.path` 模組提供能夠" +"與底層 ``str`` 和 ``bytes`` 物件互動的函式,這是一種更\\ *程序式*\\ 的方法。" +"有些使用者認為物件導向的風格更易讀。" #: ../../library/pathlib.rst:1732 msgid "" @@ -2939,6 +3035,9 @@ msgid "" "ref:`paths relative to directory descriptors <dir_fd>`. These features " "aren't available in pathlib." msgstr "" +":mod:`os` 和 :mod:`os.path` 中的許多函式支援 ``bytes`` 路徑和\\ :ref:`相對路" +"徑的目錄描述器 (paths relative to directory descriptors) <dir_fd>`。這些功能" +"在 pathlib 中不可用。" #: ../../library/pathlib.rst:1736 msgid "" @@ -2946,6 +3045,9 @@ msgid "" "`os.path` modules, are written in C and are very speedy. pathlib is written " "in pure Python and is often slower, but rarely slow enough to matter." msgstr "" +"Python 的 ``str`` 和 ``bytes`` 型別,以及 :mod:`os` 和 :mod:`os.path` 模組的" +"一些部分,是用 C 寫的且非常快速。pathlib 是用純 Python 寫的且通常比較慢,但很" +"少會慢到足以產生影響。" #: ../../library/pathlib.rst:1740 msgid "" @@ -2955,11 +3057,14 @@ msgid "" "are involved, :meth:`Path.absolute` preserves these segments for greater " "safety." msgstr "" +"pathlib 的路徑正規化略比 :mod:`os.path` 更武斷和一致。例如,儘管 :func:`os." +"path.abspath` 會從路徑中移除 \"``..``\" 片段,如果包含符號連結的話這可能會改" +"變其意義,而 :meth:`Path.absolute` 則會保留這些片段以增加安全性。" #: ../../library/pathlib.rst:1745 msgid "" "pathlib's path normalization may render it unsuitable for some applications:" -msgstr "" +msgstr "pathlib 的路徑正規化可能會使它不適合某些應用程式:" #: ../../library/pathlib.rst:1747 msgid "" @@ -2969,6 +3074,9 @@ msgid "" "separator may allow the path to be resolved as either a file or directory, " "rather than a directory only." msgstr "" +"pathlib 將 ``Path(\"my_folder/\")`` 正規化為 ``Path(\"my_folder\")``,這會在" +"提供給各種操作系統 API 和命令列工具時改變路徑的意義。具體來說,缺少結尾分隔符" +"號可能會允許該路徑被解析為檔案或目錄,而不只是目錄。" #: ../../library/pathlib.rst:1752 msgid "" @@ -2978,16 +3086,20 @@ msgid "" "a separator in the path may force it to be looked up in :envvar:`PATH` " "rather than the current directory." msgstr "" +"pathlib 將 ``Path(\"./my_program\")`` 正規化為 ``Path(\"my_program\")``,這會" +"在作為執行檔搜尋路徑使用時改變路徑的意義,例如在 shell 或在衍生 (spawn) 子行" +"程時。具體來說,在路徑中缺少分隔符號可能會使其強制在 :envvar:`PATH` 中尋找," +"而不是當前目錄。" #: ../../library/pathlib.rst:1758 msgid "" "As a consequence of these differences, pathlib is not a drop-in replacement " "for :mod:`os.path`." -msgstr "" +msgstr "因為這些差異,pathlib 不是 :mod:`os.path` 的直接替代品。" #: ../../library/pathlib.rst:1763 msgid "Corresponding tools" -msgstr "" +msgstr "對應工具" #: ../../library/pathlib.rst:1765 msgid "" @@ -3255,7 +3367,7 @@ msgstr ":meth:`Path.lchmod`" #: ../../library/pathlib.rst:1805 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../library/pathlib.rst:1806 msgid "" @@ -3264,6 +3376,10 @@ msgid "" "is a lexical operation that raises :exc:`ValueError` when its inputs' " "anchors differ (e.g. if one path is absolute and the other relative.)" msgstr "" +":func:`os.path.relpath` 會呼叫 :func:`~os.path.abspath` 來將路徑變成絕對路徑" +"並移除 \"``..``\" 部分,而 :meth:`PurePath.relative_to` 是一個文本上的操作," +"當它輸入的錨點不同時(例如一個是絕對路徑,另一個則是相對路徑)會引發 :exc:" +"`ValueError`。" #: ../../library/pathlib.rst:1810 msgid "" @@ -3271,6 +3387,8 @@ msgid "" "can't be resolved, whereas :meth:`Path.expanduser` raises :exc:" "`RuntimeError`." msgstr "" +":func:`os.path.expanduser` 會在無法解析家目錄時回傳原始路徑,而 :meth:`Path." +"expanduser` 則會引發 :exc:`RuntimeError`。" #: ../../library/pathlib.rst:1813 msgid "" @@ -3278,6 +3396,8 @@ msgid "" "symlinks, which may change the meaning of the path, whereas :meth:`Path." "absolute` leaves any \"``..``\" components in the path." msgstr "" +":func:`os.path.abspath` 將 \"``..``\" 組成移除而不解析符號連結,這可能會改變" +"路徑的意義,而 :meth:`Path.absolute` 則會保留路徑中任何 \"``..``\" 組成。" #: ../../library/pathlib.rst:1816 msgid "" @@ -3285,6 +3405,9 @@ msgid "" "*dirnames* and *filenames*, whereas :meth:`Path.walk` categorizes all " "symlinks into *filenames* when *follow_symlinks* is false (the default.)" msgstr "" +"當分類路徑成 *dirnames* 和 *filenames* 時 :func:`os.walk` 總是跟隨符號連結," +"而 :meth:`Path.walk` 在 *follow_symlinks* 為 false(預設值)時,會將所有符號" +"連結都分類為 *filenames*。" #: ../../library/pathlib.rst:11 msgid "path" @@ -3293,99 +3416,3 @@ msgstr "path(路徑)" #: ../../library/pathlib.rst:11 msgid "operations" msgstr "operations(操作)" - -#~ msgid "" -#~ "File system calls on reserved paths can fail mysteriously or have " -#~ "unintended effects." -#~ msgstr "在保留路徑上的檔案系統呼叫會神秘地失敗或有意外的效果。" - -#~ msgid "" -#~ "If *pattern* is relative, the path can be either relative or absolute, " -#~ "and matching is done from the right::" -#~ msgstr "" -#~ "如果 *pattern* 是相對的,則路徑可以是相對或絕對的,而且會從右邊來完成比" -#~ "對: ::" - -#~ msgid "" -#~ "If *pattern* is absolute, the path must be absolute, and the whole path " -#~ "must match::" -#~ msgstr "" -#~ "如果 *pattern* 是絕對的,則路徑必須是絕對的,且整個路徑都要比對到: ::" - -#~ msgid "" -#~ ">>> PurePath('/a.py').match('/*.py')\n" -#~ "True\n" -#~ ">>> PurePath('a/b.py').match('/*.py')\n" -#~ "False" -#~ msgstr "" -#~ ">>> PurePath('/a.py').match('/*.py')\n" -#~ "True\n" -#~ ">>> PurePath('a/b.py').match('/*.py')\n" -#~ "False" - -#~ msgid "" -#~ "The *pattern* may be another path object; this speeds up matching the " -#~ "same pattern against multiple files::" -#~ msgstr "" -#~ "*pattern* 可以是另一個路徑物件;這會加速對多個檔案比對相同的樣式: ::" - -#~ msgid "" -#~ ">>> pattern = PurePath('*.py')\n" -#~ ">>> PurePath('a/b.py').match(pattern)\n" -#~ "True" -#~ msgstr "" -#~ ">>> pattern = PurePath('*.py')\n" -#~ ">>> PurePath('a/b.py').match(pattern)\n" -#~ "True" - -#~ msgid "Accepts an object implementing the :class:`os.PathLike` interface." -#~ msgstr "接受一個有實作 :class:`os.PathLike` 介面的物件。" - -#~ msgid "" -#~ ">>> sorted(Path('.').glob('*.py'))\n" -#~ "[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." -#~ "py')]\n" -#~ ">>> sorted(Path('.').glob('*/*.py'))\n" -#~ "[PosixPath('docs/conf.py')]" -#~ msgstr "" -#~ ">>> sorted(Path('.').glob('*.py'))\n" -#~ "[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." -#~ "py')]\n" -#~ ">>> sorted(Path('.').glob('*/*.py'))\n" -#~ "[PosixPath('docs/conf.py')]" - -#~ msgid "" -#~ "Patterns are the same as for :mod:`fnmatch`, with the addition of " -#~ "\"``**``\" which means \"this directory and all subdirectories, " -#~ "recursively\". In other words, it enables recursive globbing::" -#~ msgstr "" -#~ "模式 (pattern) 和給 :mod:`fnmatch` 的一樣,加上 \"``**``\" 代表「目前目錄" -#~ "及所有遞迴的子目錄」。也就是說它能夠做遞迴的 glob 比對: ::" - -#~ msgid "" -#~ "This method calls :meth:`Path.is_dir` on the top-level directory and " -#~ "propagates any :exc:`OSError` exception that is raised. Subsequent :exc:" -#~ "`OSError` exceptions from scanning directories are suppressed." -#~ msgstr "" -#~ "此方法在頂層目錄上呼叫 :meth:`Path.is_dir` 並傳遞引發的任何 :exc:" -#~ "`OSError` 例外。將會抑制在目錄對於 :exc:`OSError` 例外的後續掃描。" - -#~ msgid "" -#~ "Using the \"``**``\" pattern in large directory trees may consume an " -#~ "inordinate amount of time." -#~ msgstr "在很大的目錄樹裡使用 \"``**``\" 可能會耗費過多的時間。" - -#~ msgid "" -#~ ">>> sorted(Path().rglob(\"*.py\"))\n" -#~ "[PosixPath('build/lib/pathlib.py'),\n" -#~ " PosixPath('docs/conf.py'),\n" -#~ " PosixPath('pathlib.py'),\n" -#~ " PosixPath('setup.py'),\n" -#~ " PosixPath('test_pathlib.py')]" -#~ msgstr "" -#~ ">>> sorted(Path().rglob(\"*.py\"))\n" -#~ "[PosixPath('build/lib/pathlib.py'),\n" -#~ " PosixPath('docs/conf.py'),\n" -#~ " PosixPath('pathlib.py'),\n" -#~ " PosixPath('setup.py'),\n" -#~ " PosixPath('test_pathlib.py')]" From cc8bdcc8a2e0b2b91f509abfa60d23c157429ce5 Mon Sep 17 00:00:00 2001 From: "W. H. Wang" <mattwang44@gmail.com> Date: Sun, 23 Feb 2025 17:46:47 +0800 Subject: [PATCH 76/89] Translate "Function" and "Exception" part of `library/re.po` (#996) Co-authored-by: Becca <61359625+beccalzh@users.noreply.github.com> --- library/re.po | 103 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 87 insertions(+), 16 deletions(-) diff --git a/library/re.po b/library/re.po index c5ceb995d2..dee9f2cecd 100644 --- a/library/re.po +++ b/library/re.po @@ -1221,7 +1221,7 @@ msgstr "" #: ../../library/re.rst:878 msgid "Functions" -msgstr "" +msgstr "函式" #: ../../library/re.rst:882 msgid "" @@ -1229,6 +1229,8 @@ msgid "" "<re-objects>`, which can be used for matching using its :func:`~Pattern." "match`, :func:`~Pattern.search` and other methods, described below." msgstr "" +"將正規表示式模式編譯成\\ :ref:`正規表示式物件 <re-objects>`,可以使用它的 :" +"func:`~Pattern.match`、:func:`~Pattern.search` 等方法來匹配,如下所述。" #: ../../library/re.rst:887 ../../library/re.rst:919 ../../library/re.rst:937 #: ../../library/re.rst:948 ../../library/re.rst:994 ../../library/re.rst:1028 @@ -1239,16 +1241,20 @@ msgid "" "Values can be any of the `flags`_ variables, combined using bitwise OR (the " "``|`` operator)." msgstr "" +"可以透過指定 *flags* 值來修改運算式的行為,值可以是任何 `flags`_ 變數,使用位" +"元 OR(bitwise OR、``|`` 運算子)組合。" #: ../../library/re.rst:891 msgid "The sequence ::" -msgstr "" +msgstr "順序為: ::" #: ../../library/re.rst:893 msgid "" "prog = re.compile(pattern)\n" "result = prog.match(string)" msgstr "" +"prog = re.compile(pattern)\n" +"result = prog.match(string)" #: ../../library/re.rst:896 msgid "is equivalent to ::" @@ -1256,7 +1262,7 @@ msgstr "等價於: ::" #: ../../library/re.rst:898 msgid "result = re.match(pattern, string)" -msgstr "" +msgstr "result = re.match(pattern, string)" #: ../../library/re.rst:900 msgid "" @@ -1264,6 +1270,8 @@ msgid "" "object for reuse is more efficient when the expression will be used several " "times in a single program." msgstr "" +"但是當表示式在單一程式中多次使用時,使用 :func:`re.compile` 並保存產生的正規" +"表示式物件以供重複使用會更有效率。" #: ../../library/re.rst:906 msgid "" @@ -1272,6 +1280,8 @@ msgid "" "that use only a few regular expressions at a time needn't worry about " "compiling regular expressions." msgstr "" +"傳遞給 :func:`re.compile` 之最新模式的編譯版本和模組層級匹配函式都會被快取," +"因此一次僅使用幾個正規表示式的程式不必去擔心編譯正規表示式。" #: ../../library/re.rst:914 msgid "" @@ -1281,6 +1291,9 @@ msgid "" "pattern; note that this is different from finding a zero-length match at " "some point in the string." msgstr "" +"掃描 *string* 以尋找正規表示式 *pattern* 產生匹配的第一個位置,並回傳對應的 :" +"class:`~re.Match`。如果字串中沒有與模式匹配的位置則回傳 ``None``;請注意,這" +"與在字串中的某個點查找零長度匹配不同。" #: ../../library/re.rst:926 msgid "" @@ -1289,18 +1302,25 @@ msgid "" "``None`` if the string does not match the pattern; note that this is " "different from a zero-length match." msgstr "" +"如果 *string* 開頭的零個或多個字元與正規表示式 *pattern* 匹配,則回傳對應的 :" +"class:`~re.Match`。如果字串與模式不匹配,則回傳 ``None``;請注意,這與零長度" +"匹配不同。" #: ../../library/re.rst:931 msgid "" "Note that even in :const:`MULTILINE` mode, :func:`re.match` will only match " "at the beginning of the string and not at the beginning of each line." msgstr "" +"請注意,即使在 :const:`MULTILINE` 模式 (mode) 下,:func:`re.match` 只會於字串" +"的開頭匹配,而非每行的開頭。" #: ../../library/re.rst:934 msgid "" "If you want to locate a match anywhere in *string*, use :func:`search` " "instead (see also :ref:`search-vs-match`)." msgstr "" +"如果你想在 *string* 中的任何位置找到匹配項,請使用 :func:`search`\\ (另請參" +"閱 :ref:`search-vs-match`)。" #: ../../library/re.rst:944 msgid "" @@ -1308,6 +1328,8 @@ msgid "" "corresponding :class:`~re.Match`. Return ``None`` if the string does not " "match the pattern; note that this is different from a zero-length match." msgstr "" +"如果整個 *string* 與正規表示式 *pattern* 匹配,則回傳對應的 :class:`~re." +"Match`。如果字串與模式不匹配,則回傳 ``None``;請注意,這與零長度匹配不同。" #: ../../library/re.rst:957 msgid "" @@ -1317,6 +1339,9 @@ msgid "" "*maxsplit* splits occur, and the remainder of the string is returned as the " "final element of the list. ::" msgstr "" +"依 *pattern* 的出現次數拆分 *string*。如果在 *pattern* 中使用捕獲括號,則模式" +"中所有群組的文字也會作為結果串列的一部分回傳。如果 *maxsplit* 非零,則最多發" +"生 *maxsplit* 次拆分,並且字串的其餘部分會作為串列的最終元素回傳。 ::" #: ../../library/re.rst:963 msgid "" @@ -1344,6 +1369,8 @@ msgid "" "of the string, the result will start with an empty string. The same holds " "for the end of the string::" msgstr "" +"如果分隔符號中有捕獲群組並且它在字串的開頭匹配,則結果將以空字串開頭。這同樣" +"適用於字串的結尾: ::" #: ../../library/re.rst:976 msgid "" @@ -1357,13 +1384,13 @@ msgstr "" msgid "" "That way, separator components are always found at the same relative indices " "within the result list." -msgstr "" +msgstr "如此一來,分隔符號元件始終可以在結果串列中的相同相對索引處找到。" #: ../../library/re.rst:982 msgid "" "Empty matches for the pattern split the string only when not adjacent to a " "previous empty match." -msgstr "" +msgstr "只有當與先前的空匹配不相鄰時,模式的空匹配才會拆分字串。" #: ../../library/re.rst:985 msgid "" @@ -1390,7 +1417,7 @@ msgstr "新增可選的旗標引數。" #: ../../library/re.rst:1001 msgid "" "Added support of splitting on a pattern that could match an empty string." -msgstr "" +msgstr "新增了對可以匹配空字串之模式進行拆分的支援。" #: ../../library/re.rst:1004 msgid "" @@ -1398,6 +1425,8 @@ msgid "" "future Python versions they will be :ref:`keyword-only parameters <keyword-" "only_parameter>`." msgstr "" +"將 *maxsplit* 和 *flags* 作為位置引數傳遞的用法已被棄用。在未來的 Python 版本" +"中,它們將會是\\ :ref:`僅限關鍵字參數 <keyword-only_parameter>`。" #: ../../library/re.rst:1012 msgid "" @@ -1405,6 +1434,8 @@ msgid "" "strings or tuples. The *string* is scanned left-to-right, and matches are " "returned in the order found. Empty matches are included in the result." msgstr "" +"以字串或元組串列的形式回傳 *string* 中 *pattern* 的所有非重疊匹配項。從左到右" +"掃描 *string*,並按找到的順序回傳符合項目。結果中會包含空匹配項。" #: ../../library/re.rst:1016 msgid "" @@ -1415,10 +1446,13 @@ msgid "" "matching the groups. Non-capturing groups do not affect the form of the " "result." msgstr "" +"結果取決於模式中捕獲群組的數量。如果沒有群組,則回傳與整個模式匹配的字串串" +"列。如果恰好存在一個群組,則回傳與該群組匹配的字串串列。如果存在多個群組,則" +"回傳與群組匹配的字串元組串列。非捕獲群組則不影響結果的形式。" #: ../../library/re.rst:1032 ../../library/re.rst:1047 msgid "Non-empty matches can now start just after a previous empty match." -msgstr "" +msgstr "非空匹配現在可以剛好在前一個空匹配的後面開始。" #: ../../library/re.rst:1038 msgid "" @@ -1427,6 +1461,9 @@ msgid "" "scanned left-to-right, and matches are returned in the order found. Empty " "matches are included in the result." msgstr "" +"回傳一個 :term:`iterator`,在 *string* 中的 RE *pattern* 的所有非重疊匹配上 " +"yield :class:`~re.Match` 物件。從左到右掃描 *string*,並按找到的順序回傳匹配" +"項目。結果中包含空匹配項。" #: ../../library/re.rst:1053 msgid "" @@ -1441,6 +1478,12 @@ msgid "" "``\\6``, are replaced with the substring matched by group 6 in the pattern. " "For example::" msgstr "" +"回傳透過以替換 *repl* 取代 *string* 中最左邊不重疊出現的 *pattern* 所獲得的字" +"串。如果未找到該模式,則不改變 *string* 並回傳。*repl* 可以是字串或函式;如果" +"它是字串,則處理其中的任何反斜線轉義。也就是說 ``\\n`` 會被轉換為單一換行符、" +"``\\r`` 會被轉換為回車符 (carriage return) 等等。ASCII 字母的未知轉義符會被保" +"留以供將來使用並被視為錯誤。其他未知轉義符例如 ``\\&`` 會被單獨保留。例如 " +"``\\6`` 的反向參照將被替換為模式中第 6 組匹配的子字串。例如: ::" #: ../../library/re.rst:1064 msgid "" @@ -1460,6 +1503,8 @@ msgid "" "of *pattern*. The function takes a single :class:`~re.Match` argument, and " "returns the replacement string. For example::" msgstr "" +"如果 *repl* 是一個函式,則 *pattern* 的每個不重疊出現之處都會呼叫它。此函式接" +"收單一 :class:`~re.Match` 引數,並回傳替換字串。例如: ::" #: ../../library/re.rst:1073 msgid "" @@ -1485,7 +1530,7 @@ msgstr "" #: ../../library/re.rst:1082 msgid "The pattern may be a string or a :class:`~re.Pattern`." -msgstr "" +msgstr "此模式可以是字串或 :class:`~re.Pattern`。" #: ../../library/re.rst:1084 msgid "" @@ -1495,6 +1540,9 @@ msgid "" "only when not adjacent to a previous empty match, so ``sub('x*', '-', " "'abxd')`` returns ``'-a-b--d-'``." msgstr "" +"可選引數 *count* 是要替換的模式出現的最大次數;*count* 必須是非負整數。如果省" +"略或為零,則所有出現的內容都將被替換。只有當與先前的空匹配不相鄰時,模式的空" +"匹配才會被替換,因此 ``sub('x*', '-', 'abxd')`` 會回傳 ``'-a-b--d -'``。" #: ../../library/re.rst:1092 msgid "" @@ -1508,16 +1556,23 @@ msgid "" "backreference ``\\g<0>`` substitutes in the entire substring matched by the " "RE." msgstr "" +"在字串型別 *repl* 引數中,除了上述字元轉義和反向參照之外,``\\g<name>`` 將使" +"用名為 ``name`` 的群組所匹配到的子字串,如 ``(?P<name>...)`` 所定義的語法。" +"``\\g<number>`` 使用對應的群組編號;因此 ``\\g<2>`` 等價於 ``\\2``,但在諸如 " +"``\\g<2>0`` 之類的替換中並非模糊不清 (isn't ambiguous)。``\\20`` 將被直譯為對" +"群組 20 的參照,而不是對後面跟著字面字元 ``'0'`` 的群組 2 的參照。反向參照 " +"``\\g<0>`` 會取代以 RE 所匹配到的整個子字串。" #: ../../library/re.rst:1109 ../../library/re.rst:1387 msgid "Unmatched groups are replaced with an empty string." -msgstr "" +msgstr "不匹配的群組將被替換為空字串。" #: ../../library/re.rst:1112 msgid "" "Unknown escapes in *pattern* consisting of ``'\\'`` and an ASCII letter now " "are errors." msgstr "" +"在由 ``'\\'`` 和一個 ASCII 字母組成之 *pattern* 中的未知轉義符現在為錯誤。" #: ../../library/re.rst:1116 msgid "" @@ -1525,6 +1580,8 @@ msgid "" "errors. Empty matches for the pattern are replaced when adjacent to a " "previous non-empty match." msgstr "" +"由 ``'\\'`` 和一個 ASCII 字母組成之 *repl* 中的未知轉義符現在為錯誤。當與先前" +"的非空匹配相鄰時,模式的空匹配將被替換。" #: ../../library/re.rst:1122 msgid "" @@ -1532,6 +1589,8 @@ msgid "" "strings, group *name* can only contain bytes in the ASCII range " "(``b'\\x00'``-``b'\\x7f'``)." msgstr "" +"群組 *id* 只能包含 ASCII 數字。在 :class:`bytes` 替換字串中,群組 *name* 只能" +"包含 ASCII 範圍內的位元組 (``b'\\x00'``-``b'\\x7f'``)。" #: ../../library/re.rst:1127 msgid "" @@ -1539,12 +1598,16 @@ msgid "" "Python versions they will be :ref:`keyword-only parameters <keyword-" "only_parameter>`." msgstr "" +"將 *count* 和 *flags* 作為位置引數傳遞的用法已被棄用。在未來的 Python 版本" +"中,它們將會是\\ :ref:`僅限關鍵字參數 <keyword-only_parameter>`。" #: ../../library/re.rst:1135 msgid "" "Perform the same operation as :func:`sub`, but return a tuple ``(new_string, " "number_of_subs_made)``." msgstr "" +"執行與 :func:`sub` 相同的操作,但回傳一個元組 ``(new_string, " +"number_of_subs_made)``。" #: ../../library/re.rst:1145 msgid "" @@ -1552,6 +1615,8 @@ msgid "" "an arbitrary literal string that may have regular expression metacharacters " "in it. For example::" msgstr "" +"對 *pattern* 中的特殊字元進行轉義。如果你想要匹配其中可能包含正規表示式元字" +"元 (metacharacter) 的任意文本字串,這會非常有用。例如: ::" #: ../../library/re.rst:1149 msgid "" @@ -1584,6 +1649,8 @@ msgid "" "This function must not be used for the replacement string in :func:`sub` " "and :func:`subn`, only backslashes should be escaped. For example::" msgstr "" +"此函式不得用於 :func:`sub` 和 :func:`subn` 中的替換字串,僅應轉義反斜線。例" +"如: ::" #: ../../library/re.rst:1163 msgid "" @@ -1599,7 +1666,7 @@ msgstr "" #: ../../library/re.rst:1168 msgid "The ``'_'`` character is no longer escaped." -msgstr "" +msgstr "``'_'`` 字元不再被轉義。" #: ../../library/re.rst:1171 msgid "" @@ -1611,7 +1678,7 @@ msgstr "" #: ../../library/re.rst:1180 msgid "Clear the regular expression cache." -msgstr "" +msgstr "清除正規表示式快取。" #: ../../library/re.rst:1184 msgid "Exceptions" @@ -1626,26 +1693,29 @@ msgid "" "pattern. The ``PatternError`` instance has the following additional " "attributes:" msgstr "" +"當傳遞給此處函式之一的字串不是有效的正規表示式(例如它可能包含不匹配的括號)" +"或在編譯或匹配期間發生某些其他錯誤時,將引發例外。如果字串不包含模式匹配項,則" +"絕不是錯誤。``PatternError`` 實例具有以下附加屬性:" #: ../../library/re.rst:1196 msgid "The unformatted error message." -msgstr "" +msgstr "未格式化的錯誤訊息。" #: ../../library/re.rst:1200 msgid "The regular expression pattern." -msgstr "" +msgstr "正規表示式模式。" #: ../../library/re.rst:1204 msgid "The index in *pattern* where compilation failed (may be ``None``)." -msgstr "" +msgstr "*pattern* 中編譯失敗的索引(可能是 ``None``)。" #: ../../library/re.rst:1208 msgid "The line corresponding to *pos* (may be ``None``)." -msgstr "" +msgstr "對應 *pos* 的列(可能是 ``None``)。" #: ../../library/re.rst:1212 msgid "The column corresponding to *pos* (may be ``None``)." -msgstr "" +msgstr "對應 *pos* 的欄(可能是 ``None``)。" #: ../../library/re.rst:1214 msgid "Added additional attributes." @@ -1656,6 +1726,7 @@ msgid "" "``PatternError`` was originally named ``error``; the latter is kept as an " "alias for backward compatibility." msgstr "" +"``PatternError`` 最初被命名為 ``error``;後者為了向後相容性而被保留為別名。" #: ../../library/re.rst:1224 msgid "Regular Expression Objects" From ef944ec11b993fe48406f655ec694832136a30a9 Mon Sep 17 00:00:00 2001 From: "W. H. Wang" <mattwang44@gmail.com> Date: Sun, 23 Feb 2025 17:47:05 +0800 Subject: [PATCH 77/89] translate extending/extending.po - part 1 (#1023) --- extending/extending.po | 263 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 245 insertions(+), 18 deletions(-) diff --git a/extending/extending.po b/extending/extending.po index 6ff3917736..2daee5badc 100644 --- a/extending/extending.po +++ b/extending/extending.po @@ -1,16 +1,17 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-202DESCRIPTIVE TITLE., Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Leon H., 2017 +# Adrian Liaw <adrianliaw2000@gmail.com>, 2018 +# Matt Wang <mattwang44@gmail.com>, 2025 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" -"PO-Revision-Date: 2018-05-23 14:34+0000\n" -"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" +"POT-Creation-Date: 2025-02-07 15:02+0800\n" +"PO-Revision-Date: 2025-02-17 14:34+0000\n" +"Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -30,6 +31,9 @@ msgid "" "done directly in Python: they can implement new built-in object types, and " "they can call C library functions and system calls." msgstr "" +"如果你會撰寫 C 程式語言,那要向 Python 新增內建模組就不困難。這種\\ :dfn:`擴" +"充模組 (extension modules)` 可以做兩件在 Python 中無法直接完成的事:它們可以" +"實作新的內建物件型別,並且可以呼叫 C 的函式庫函式和系統呼叫。" #: ../../extending/extending.rst:15 msgid "" @@ -38,12 +42,17 @@ msgid "" "aspects of the Python run-time system. The Python API is incorporated in a " "C source file by including the header ``\"Python.h\"``." msgstr "" +"為了支援擴充,Python API (Application Programmers Interface) 定義了一組函式、" +"巨集和變數,提供對 Python run-time 系統大部分面向的存取。Python API 是透過引" +"入標頭檔 ``\"Python.h\"`` 來被納入到一個 C 原始碼檔案中。" #: ../../extending/extending.rst:20 msgid "" "The compilation of an extension module depends on its intended use as well " "as on your system setup; details are given in later chapters." msgstr "" +"擴充模組的編譯取決於其預期用途以及你的系統設定;詳細資訊將在後面的章節中提" +"供。" #: ../../extending/extending.rst:25 msgid "" @@ -57,6 +66,12 @@ msgid "" "with C code and are more portable between implementations of Python than " "writing and compiling a C extension module." msgstr "" +"C 擴充介面是 CPython 所特有的,擴充模組在其他 Python 實作上無法運作。在許多情" +"況下,可以避免撰寫 C 擴充並保留對其他實作的可移植性。例如,如果你的用例是呼" +"叫 C 函式庫函式或系統呼叫,你應該考慮使用 :mod:`ctypes` 模組或 `cffi " +"<https://cffi.readthedocs.io/>`_ 函式庫,而不是編寫自定義的 C 程式碼。這些模" +"組讓你可以撰寫 Python 程式碼來與 C 程式碼介接,而且比起撰寫和編譯 C 擴充模" +"組,這些模組在 Python 實作之間更容易移植。" #: ../../extending/extending.rst:40 msgid "A Simple Example" @@ -70,6 +85,10 @@ msgid "" "terminated character string as argument and returns an integer. We want " "this function to be callable from Python as follows:" msgstr "" +"讓我們來建立一個叫做 ``spam``\\ (Monty Python 粉絲最愛的食物...)的擴充模" +"組。假設我們要建立一個 Python 介面給 C 函式庫的函式 :c:func:`system` [#]_ 使" +"用,這個函式接受一個以 null 終止的 (null-terminated) 字元字串做為引數,並回傳" +"一個整數。我們希望這個函式可以在 Python 中被呼叫,如下所示:" #: ../../extending/extending.rst:48 msgid "" @@ -86,10 +105,13 @@ msgid "" "`spammodule.c`; if the module name is very long, like ``spammify``, the " "module name can be just :file:`spammify.c`.)" msgstr "" +"首先建立一個檔案 :file:`spammodule.c`。(從過去歷史來看,如果一個模組叫做 " +"``spam``,包含其實作的 C 檔案就會叫做 :file:`spammodule.c`;如果模組名稱很" +"長,像是 ``spammify``,模組名稱也可以只是 :file:`spammify.c`)。" #: ../../extending/extending.rst:58 msgid "The first two lines of our file can be::" -msgstr "" +msgstr "我們檔案的前兩列可以為: ::" #: ../../extending/extending.rst:60 ../../extending/extending.rst:663 msgid "" @@ -104,6 +126,8 @@ msgid "" "which pulls in the Python API (you can add a comment describing the purpose " "of the module and a copyright notice if you like)." msgstr "" +"這會將 Python API 拉進來(你可以加入註解來說明模組的目的,也可以加入版權聲" +"明)。" #: ../../extending/extending.rst:68 msgid "" @@ -111,6 +135,8 @@ msgid "" "standard headers on some systems, you *must* include :file:`Python.h` before " "any standard headers are included." msgstr "" +"由於 Python 可能定義一些影響系統上某些標準標頭檔的預處理器定義,你\\ *必須" +"*\\ 在引入任何標準標頭檔之前引入 :file:`Python.h`。" #: ../../extending/extending.rst:72 msgid "" @@ -119,6 +145,9 @@ msgid "" "3.13, but we keep it here for backward compatibility. See :ref:`arg-parsing-" "string-and-buffers` for a description of this macro." msgstr "" +"``#define PY_SSIZE_T_CLEAN`` 被用來表示在某些 API 中應該使用 ``Py_ssize_t`` " +"而不是 ``int``。自 Python 3.13 起,它就不再是必要的了,但我們在此保留它以便向" +"後相容。關於這個巨集的描述請參閱 :ref:`arg-parsing-string-and-buffers`。" #: ../../extending/extending.rst:77 msgid "" @@ -130,6 +159,12 @@ msgid "" "on your system, it declares the functions :c:func:`malloc`, :c:func:`free` " "and :c:func:`realloc` directly." msgstr "" +"除了那些在標準標頭檔中定義的符號以外,所有由 :file:`Python.h` 定義的使用者可" +"見符號 (user-visible symbols) 的前綴都是 ``Py`` 或 ``PY``。為了方便,也因為 " +"Python 直譯器的大量使用,``\"Python.h\"`` 也引入了一些標準的標頭檔:" +"``<stdio.h>``、``<string.h>``、``<errno.h>`` 和 ``<stdlib.h>``。如果 " +"``<stdlib.h>`` 在你的系統上不存在,它會直接宣" +"告 :c:func:`malloc`、:c:func:`free` 和 :c:func:`realloc` 函式。" #: ../../extending/extending.rst:85 msgid "" @@ -137,6 +172,9 @@ msgid "" "called when the Python expression ``spam.system(string)`` is evaluated " "(we'll see shortly how it ends up being called)::" msgstr "" +"接下來我們要加入到模組檔案的是 C 函式,當 Python 運算式 " +"``spam.system(string)`` 要被求值 (evaluated) 時就會被呼叫(我們很快就會看到它" +"最後是如何被呼叫的): ::" #: ../../extending/extending.rst:89 msgid "" @@ -171,12 +209,16 @@ msgid "" "C function. The C function always has two arguments, conventionally named " "*self* and *args*." msgstr "" +"可以很直觀地從 Python 的引數串列(例如單一的運算式 ``\"ls -l\"``)直接轉換成" +"傳給 C 函式的引數。C 函式總是有兩個引數,習慣上會命名為 *self* 和 *args*。" #: ../../extending/extending.rst:106 msgid "" "The *self* argument points to the module object for module-level functions; " "for a method it would point to the object instance." msgstr "" +"對於模組層級的函式,*self* 引數會指向模組物件;而對於方法來說則是指向物件的實" +"例。" #: ../../extending/extending.rst:109 msgid "" @@ -189,6 +231,11 @@ msgid "" "determine the required types of the arguments as well as the types of the C " "variables into which to store the converted values. More about this later." msgstr "" +"*args* 引數會是一個指向包含引數的 Python 元組物件的指標。元組中的每一項都對應" +"於呼叫的引數串列中的一個引數。引數是 Python 物件 --- 為了在我們的 C 函式中對" +"它們做任何事情,我們必須先將它們轉換成 C 值。Python API 中" +"的 :c:func:`PyArg_ParseTuple` 函式能夠檢查引數型別並將他們轉換為 C 值。它使用" +"模板字串來決定所需的引數型別以及儲存轉換值的 C 變數型別。稍後會再詳細說明。" #: ../../extending/extending.rst:118 msgid "" @@ -199,10 +246,14 @@ msgid "" "the calling function can return ``NULL`` immediately (as we saw in the " "example)." msgstr "" +"如果所有的引數都有正確的型別,且其元件已儲存在傳入位址的變數中," +"則 :c:func:`PyArg_ParseTuple` 會回傳 true(非零)。如果傳入的是無效引數串列則" +"回傳 false(零)。在後者情況下,它也會產生適當的例外,因此呼叫函式可以立即回" +"傳 ``NULL``\\ (就像我們在範例中所看到的)。" #: ../../extending/extending.rst:128 msgid "Intermezzo: Errors and Exceptions" -msgstr "" +msgstr "插曲:錯誤與例外" #: ../../extending/extending.rst:130 msgid "" @@ -215,12 +266,17 @@ msgid "" "the exception type, exception instance, and a traceback object. It is " "important to know about them to understand how errors are passed around." msgstr "" +"在整個 Python 直譯器中的一個重要慣例為:當一個函式失敗時,它就應該設定一個例" +"外條件,並回傳一個錯誤值(通常是 ``-1`` 或一個 ``NULL`` 指標)。例外資訊會儲" +"存在直譯器執行緒狀態的三個成員中。如果沒有例外,它們就會是 ``NULL``。否則,它" +"們是由 :meth:`sys.exc_info` 所回傳的 Python 元組中的 C 等效元組。它們是例外型" +"別、例外實例和回溯物件。了解它們對於理解錯誤是如何傳遞是很重要的。" #: ../../extending/extending.rst:139 msgid "" "The Python API defines a number of functions to set various types of " "exceptions." -msgstr "" +msgstr "Python API 定義了許多能夠設定各種類型例外的函式。" #: ../../extending/extending.rst:141 msgid "" @@ -230,6 +286,10 @@ msgid "" "indicates the cause of the error and is converted to a Python string object " "and stored as the \"associated value\" of the exception." msgstr "" +"最常見的是 :c:func:`PyErr_SetString`。它的引數是一個例外物件和一個 C 字串。例" +"外物件通常是預先定義的物件,例如 :c:data:`PyExc_ZeroDivisionError`。C 字串則" +"指出錯誤的原因,並被轉換為 Python 字串物件且被儲存為例外的「關聯值 " +"(associated value)」。" #: ../../extending/extending.rst:147 msgid "" @@ -240,6 +300,10 @@ msgid "" "associated value. You don't need to :c:func:`Py_INCREF` the objects passed " "to any of these functions." msgstr "" +"另一個有用的函式是 :c:func:`PyErr_SetFromErrno`,它只接受一個例外引數,並透過" +"檢查全域變數 :c:data:`errno` 來建立關聯值。最一般的函式" +"是 :c:func:`PyErr_SetObject`,它接受兩個物件引數,即例外和它的關聯值。你不需" +"要對傳給任何這些函式的物件呼叫 :c:func:`Py_INCREF`。" #: ../../extending/extending.rst:154 msgid "" @@ -249,6 +313,10 @@ msgid "" "func:`PyErr_Occurred` to see whether an error occurred in a function call, " "since you should be able to tell from the return value." msgstr "" +"你可以使用 :c:func:`PyErr_Occurred` 來不具破壞性地測試例外是否已被設定。這會" +"回傳當前的例外物件,如果沒有例外發生則回傳 ``NULL``。你通常不需要呼" +"叫 :c:func:`PyErr_Occurred` 來查看函式呼叫是否發生錯誤,因為你應可從回傳值就" +"得知。" #: ../../extending/extending.rst:160 msgid "" @@ -262,6 +330,12 @@ msgid "" "interpreter's main loop, this aborts the currently executing Python code and " "tries to find an exception handler specified by the Python programmer." msgstr "" +"當函式 *f* 呼叫另一個函式 *g* 時檢測到後者失敗,*f* 本身應該回傳一個錯誤值" +"(通常是 ``NULL`` 或 ``-1``)。它\\ *不*\\ 應該呼叫 ``PyErr_*`` 函式的其中一" +"個,這會已被 *g* 呼叫過。*f* 的呼叫者然後也應該回傳一個錯誤指示給\\ *它的*\\ " +"呼叫者,同樣\\ *不會*\\ 呼叫 ``PyErr_*``,依此類推 --- 最詳細的錯誤原因已經被" +"首先檢測到它的函式回報了。一旦錯誤到達 Python 直譯器的主要迴圈,這會中止目前" +"執行的 Python 程式碼,並嘗試尋找 Python 程式設計者指定的例外處理程式。" #: ../../extending/extending.rst:170 msgid "" @@ -271,6 +345,9 @@ msgid "" "cause information about the cause of the error to be lost: most operations " "can fail for a variety of reasons.)" msgstr "" +"(在某些情況下,模組可以透過呼叫另一個 ``PyErr_*`` 函式來提供更詳細的錯誤訊" +"息,在這種情況下這樣做是沒問題的。然而這一般來說並非必要,而且可能會導致錯誤" +"原因資訊的遺失:大多數的操作都可能因為各種原因而失敗。)" #: ../../extending/extending.rst:176 msgid "" @@ -280,6 +357,10 @@ msgid "" "pass the error on to the interpreter but wants to handle it completely by " "itself (possibly by trying something else, or pretending nothing went wrong)." msgstr "" +"要忽略由函式呼叫失敗所設定的例外,必須明確地呼叫 :c:func:`PyErr_Clear` 來清除" +"例外條件。C 程式碼唯一要呼叫 :c:func:`PyErr_Clear` 的情況為當它不想將錯誤傳遞" +"給直譯器而想要完全是自己來處理它時(可能是要再嘗試其他東西,或者假裝什麼都沒" +"出錯)。" #: ../../extending/extending.rst:182 msgid "" @@ -289,6 +370,11 @@ msgid "" "creating functions (for example, :c:func:`PyLong_FromLong`) already do this, " "so this note is only relevant to those who call :c:func:`malloc` directly." msgstr "" +"每個失敗的 :c:func:`malloc` 呼叫都必須被轉換成一個例外 " +"--- :c:func:`malloc`\\ (或 :c:func:`realloc`)的直接呼叫者必須呼" +"叫 :c:func:`PyErr_NoMemory` 並回傳一個失敗指示器。所有建立物件的函式(例" +"如 :c:func:`PyLong_FromLong`)都已經這麼做了,所以這個注意事項只和那些直接呼" +"叫 :c:func:`malloc` 的函式有關。" #: ../../extending/extending.rst:188 msgid "" @@ -297,6 +383,9 @@ msgid "" "positive value or zero for success and ``-1`` for failure, like Unix system " "calls." msgstr "" +"還要注意的是,有 :c:func:`PyArg_ParseTuple` 及同系列函式的這些重要例外,回傳" +"整數狀態的函式通常會回傳一個正值或 0 表示成功、回傳 ``-1`` 表示失敗,就像 " +"Unix 系統呼叫一樣。" #: ../../extending/extending.rst:192 msgid "" @@ -304,6 +393,8 @@ msgid "" "c:func:`Py_DECREF` calls for objects you have already created) when you " "return an error indicator!" msgstr "" +"最後,在回傳錯誤指示器時要注意垃圾清理(透過對你已經建立的物件呼" +"叫 :c:func:`Py_XDECREF` 或 :c:func:`Py_DECREF`)!" #: ../../extending/extending.rst:196 msgid "" @@ -317,12 +408,21 @@ msgid "" "you have an argument whose value must be in a particular range or must " "satisfy other conditions, :c:data:`PyExc_ValueError` is appropriate." msgstr "" +"你完全可以自行選擇要產生的例外。有一些預先宣告的 C 物件會對應到所有內建的 " +"Python 例外,例如 :c:data:`PyExc_ZeroDivisionError`,你可以直接使用它們。當" +"然,你應該明智地選擇例外,像是不要使用 :c:data:`PyExc_TypeError` 來表示檔案無" +"法打開(應該是 :c:data:`PyExc_OSError`)。如果引數串列有問" +"題,:c:func:`PyArg_ParseTuple` 函式通常會引發 :c:data:`PyExc_TypeError`。如果" +"你有一個引數的值必須在一個特定的範圍內或必須滿足其他條件,則可以使" +"用 :c:data:`PyExc_ValueError`。" #: ../../extending/extending.rst:206 msgid "" "You can also define a new exception that is unique to your module. For this, " "you usually declare a static object variable at the beginning of your file::" msgstr "" +"你也可以定義一個你的模組特有的新例外。為此你通常會在檔案開頭宣告一個靜態物件" +"變數: ::" #: ../../extending/extending.rst:209 msgid "static PyObject *SpamError;" @@ -333,9 +433,10 @@ msgid "" "and initialize it in your module's initialization function (:c:func:`!" "PyInit_spam`) with an exception object::" msgstr "" +"並在你的模組初始化函式中使用一個例外物件來初始化它 (:c:func:`!" +"PyInit_spam`): ::" #: ../../extending/extending.rst:214 -#, fuzzy msgid "" "PyMODINIT_FUNC\n" "PyInit_spam(void)\n" @@ -366,9 +467,7 @@ msgstr "" " return NULL;\n" "\n" " SpamError = PyErr_NewException(\"spam.error\", NULL, NULL);\n" -" Py_XINCREF(SpamError);\n" -" if (PyModule_AddObject(m, \"error\", SpamError) < 0) {\n" -" Py_XDECREF(SpamError);\n" +" if (PyModule_AddObjectRef(m, \"error\", SpamError) < 0) {\n" " Py_CLEAR(SpamError);\n" " Py_DECREF(m);\n" " return NULL;\n" @@ -384,6 +483,9 @@ msgid "" "class being :exc:`Exception` (unless another class is passed in instead of " "``NULL``), described in :ref:`bltin-exceptions`." msgstr "" +"請注意,例外物件的 Python 名稱是 :exc:`!spam.error`。如同\\ :ref:`bltin-" +"exceptions`\\ 所述,:c:func:`PyErr_NewException` 函式可能會建立一個基底類別" +"為 :exc:`Exception` 的類別(除非傳入另一個類別來代替 ``NULL``)。" #: ../../extending/extending.rst:238 msgid "" @@ -395,18 +497,25 @@ msgid "" "pointer, C code which raises the exception could cause a core dump or other " "unintended side effects." msgstr "" +"請注意,:c:data:`!SpamError` 變數保留了對新建立的例外類別的參照;這是故意的!" +"因為外部程式碼可能會從模組中移除這個例外,所以需要一個對這個類別的參照來確保" +"它不會被丟棄而導致 :c:data:`!SpamError` 變成一個迷途指標 (dangling pointer)。" +"如果它變成迷途指標,那產生例外的 C 程式碼可能會導致核心轉儲 (core dump) 或其" +"他不預期的 side effect。" #: ../../extending/extending.rst:245 msgid "" "We discuss the use of :c:macro:`PyMODINIT_FUNC` as a function return type " "later in this sample." -msgstr "" +msgstr "我們稍後會討論 :c:macro:`PyMODINIT_FUNC` 作為函式回傳型別的用法。" #: ../../extending/extending.rst:248 msgid "" "The :exc:`!spam.error` exception can be raised in your extension module " "using a call to :c:func:`PyErr_SetString` as shown below::" msgstr "" +"可以在你的擴充模組中呼叫 :c:func:`PyErr_SetString` 來引發 :exc:`!spam.error` " +"例外,如下所示: ::" #: ../../extending/extending.rst:251 msgid "" @@ -450,7 +559,7 @@ msgstr "回到範例" msgid "" "Going back to our example function, you should now be able to understand " "this statement::" -msgstr "" +msgstr "回到我們的範例函式,現在你應該可以理解這個陳述式了: ::" #: ../../extending/extending.rst:276 msgid "" @@ -470,12 +579,19 @@ msgid "" "which it points (so in Standard C, the variable :c:data:`!command` should " "properly be declared as ``const char *command``)." msgstr "" +"如果在引數串列中檢測到錯誤則會回傳 ``NULL``\\ (回傳物件指標之函式的錯誤指示" +"器),其依賴於 :c:func:`PyArg_ParseTuple` 設定的例外,否則引數的字串值會已被" +"複製到區域變數 :c:data:`!command` 中。這是一個指標賦值,你不應該修改它所指向" +"的字串(所以在標準 C 中,:c:data:`!command` 變數應該正確地被宣告為 ``const " +"char *command``)。" #: ../../extending/extending.rst:287 msgid "" "The next statement is a call to the Unix function :c:func:`system`, passing " "it the string we just got from :c:func:`PyArg_ParseTuple`::" msgstr "" +"接下來的陳述式會呼叫 Unix 函式 :c:func:`system`,並將剛才" +"從 :c:func:`PyArg_ParseTuple` 得到的字串傳給它:" #: ../../extending/extending.rst:290 msgid "sts = system(command);" @@ -487,6 +603,8 @@ msgid "" "a Python object. This is done using the function :c:func:" "`PyLong_FromLong`. ::" msgstr "" +"我們的 :func:`!spam.system` 函式必須以 Python 物件的形式來回傳 :c:data:`!" +"sts` 的值。這是透過 :c:func:`PyLong_FromLong` 函式來達成。 ::" #: ../../extending/extending.rst:295 msgid "return PyLong_FromLong(sts);" @@ -497,6 +615,8 @@ msgid "" "In this case, it will return an integer object. (Yes, even integers are " "objects on the heap in Python!)" msgstr "" +"在這種情況下它會回傳一個整數物件。(是的,在 Python 中連整數也是堆積 (heap) 上" +"的物件!)" #: ../../extending/extending.rst:300 msgid "" @@ -505,6 +625,9 @@ msgid "" "``None``. You need this idiom to do so (which is implemented by the :c:" "macro:`Py_RETURN_NONE` macro)::" msgstr "" +"如果你有一個不回傳任何有用引數的 C 函式(一個回傳 :c:expr:`void` 的函式),對" +"應的 Python 函式必須回傳 ``None``。你需要以下這個慣例來達成" +"(由 :c:macro:`Py_RETURN_NONE` 巨集實作): ::" #: ../../extending/extending.rst:305 msgid "" @@ -520,16 +643,21 @@ msgid "" "is a genuine Python object rather than a ``NULL`` pointer, which means " "\"error\" in most contexts, as we have seen." msgstr "" +":c:data:`Py_None` 是特殊 Python 物件 ``None`` 的 C 名稱。它是一個真正的 " +"Python 物件而不是一個 ``NULL`` 指標,在大多數的情況下它的意思是「錯誤」,如我" +"們所見過的那樣。" #: ../../extending/extending.rst:316 msgid "The Module's Method Table and Initialization Function" -msgstr "" +msgstr "模組的方法表和初始化函式" #: ../../extending/extending.rst:318 msgid "" "I promised to show how :c:func:`!spam_system` is called from Python " "programs. First, we need to list its name and address in a \"method table\"::" msgstr "" +"我承諾過要展示 :c:func:`!spam_system` 是如何從 Python 程式中呼叫的。首先,我" +"們需要在「方法表」中列出它的名稱和位址: ::" #: ../../extending/extending.rst:321 msgid "" @@ -541,6 +669,13 @@ msgid "" " {NULL, NULL, 0, NULL} /* Sentinel */\n" "};" msgstr "" +"static PyMethodDef SpamMethods[] = {\n" +" ...\n" +" {\"system\", spam_system, METH_VARARGS,\n" +" \"Execute a shell command.\"},\n" +" ...\n" +" {NULL, NULL, 0, NULL} /* Sentinel */\n" +"};" #: ../../extending/extending.rst:329 msgid "" @@ -550,6 +685,9 @@ msgid "" "value of ``0`` means that an obsolete variant of :c:func:`PyArg_ParseTuple` " "is used." msgstr "" +"請注意第三個項目 (``METH_VARARGS``)。這是一個告訴直譯器 C 函式之呼叫方式的旗" +"標。通常應該是 ``METH_VARARGS`` 或 ``METH_VARARGS | METH_KEYWORDS``;``0`` 表" +"示是使用 :c:func:`PyArg_ParseTuple` 的一個過時變體。" #: ../../extending/extending.rst:334 msgid "" @@ -557,6 +695,9 @@ msgid "" "level parameters to be passed in as a tuple acceptable for parsing via :c:" "func:`PyArg_ParseTuple`; more information on this function is provided below." msgstr "" +"當只使用 ``METH_VARARGS`` 時,函式應預期 Python 層級的參數是以元組形式傳入且" +"能夠接受以 :c:func:`PyArg_ParseTuple` 進行剖析;有關此函式的更多資訊將在下面" +"提供。" #: ../../extending/extending.rst:338 msgid "" @@ -566,11 +707,15 @@ msgid "" "keywords. Use :c:func:`PyArg_ParseTupleAndKeywords` to parse the arguments " "to such a function." msgstr "" +"如果要將關鍵字引數傳給函式,可以在第三個欄位設定 :c:macro:`METH_KEYWORDS` 位" +"元。在這種情況下,C 函式應該要能接受第三個 ``PyObject *`` 參數,這個參數將會" +"是關鍵字的字典。可使用 :c:func:`PyArg_ParseTupleAndKeywords` 來剖析這種函式的" +"引數。" #: ../../extending/extending.rst:344 msgid "" "The method table must be referenced in the module definition structure::" -msgstr "" +msgstr "方法表必須在模組定義結構中被參照: ::" #: ../../extending/extending.rst:346 msgid "" @@ -583,6 +728,14 @@ msgid "" " SpamMethods\n" "};" msgstr "" +"static struct PyModuleDef spammodule = {\n" +" PyModuleDef_HEAD_INIT,\n" +" \"spam\", /* 模組名稱 */\n" +" spam_doc, /* 模組文件,可能為 NULL */\n" +" -1, /* 模組的個別直譯器狀態的大小,\n" +" 如果模組將狀態保存在全域變數中則為 -1 */\n" +" SpamMethods\n" +"};" #: ../../extending/extending.rst:355 msgid "" @@ -591,6 +744,9 @@ msgid "" "`!PyInit_name`, where *name* is the name of the module, and should be the " "only non-\\ ``static`` item defined in the module file::" msgstr "" +"反過來說,這個結構必須在模組的初始化函式中被傳給直譯器。初始化函式必須被命名" +"為 :c:func:`!PyInit_name`,其中 *name* 是模組的名稱,且應該是模組檔案中唯一定" +"義的非「靜態 (``static``)」項目: ::" #: ../../extending/extending.rst:360 msgid "" @@ -612,6 +768,8 @@ msgid "" "return type, declares any special linkage declarations required by the " "platform, and for C++ declares the function as ``extern \"C\"``." msgstr "" +"請注意,:c:macro:`PyMODINIT_FUNC` 宣告函式的回傳型別為 `PyObject *``、宣告平" +"台所需的任何特殊連結宣告、並針對 C++ 宣告函式為 ``extern \"C\"``。" #: ../../extending/extending.rst:370 msgid "" @@ -626,6 +784,14 @@ msgid "" "The init function must return the module object to its caller, so that it " "then gets inserted into ``sys.modules``." msgstr "" +"當 Python 程式第一次引入模組 :mod:`!spam` 時,:c:func:`!PyInit_spam` 會被呼" +"叫。(有關嵌入 Python 的註解請參見下文。)它會呼叫回傳一個模組物件" +"的 :c:func:`PyModule_Create`,並根據在模組定義中所找到的表(一" +"個 :c:type:`PyMethodDef` 結構的陣列)將內建的函式物件插入到新建立的模組" +"中。:c:func:`PyModule_Create` 會回傳一個指向它建立之模組物件的指標。對於某些" +"錯誤情況,它可能會以嚴重錯誤的形式來中止;如果模組無法令人滿意地被初始化,它" +"也會回傳 ``NULL``。初始化函式必須把模組物件回傳給它的呼叫者,這樣它才會被插入" +"到 ``sys.modules`` 中。" #: ../../extending/extending.rst:381 msgid "" @@ -634,6 +800,9 @@ msgid "" "table. To add the module to the initialization table, use :c:func:" "`PyImport_AppendInittab`, optionally followed by an import of the module::" msgstr "" +"嵌入 Python 時,除非在 :c:data:`PyImport_Inittab` 表中有相關條目,否則不會自" +"動呼叫 :c:func:`!PyInit_spam` 函式。要將模組加入初始化表,請使" +"用 :c:func:`PyImport_AppendInittab` 並在隨後選擇性地將該模組引入: ::" #: ../../extending/extending.rst:386 msgid "" @@ -687,6 +856,55 @@ msgid "" " Py_ExitStatusException(status);\n" "}" msgstr "" +"#define PY_SSIZE_T_CLEAN\n" +"#include <Python.h>\n" +"\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" PyStatus status;\n" +" PyConfig config;\n" +" PyConfig_InitPythonConfig(&config);\n" +"\n" +" /* 在 Py_Initialize 之前加入內建模組 */\n" +" if (PyImport_AppendInittab(\"spam\", PyInit_spam) == -1) {\n" +" fprintf(stderr, \"Error: could not extend in-built modules " +"table\\n\");\n" +" exit(1);\n" +" }\n" +"\n" +" /* 將 argv[0] 傳給 Python 直譯器 */\n" +" status = PyConfig_SetBytesString(&config, &config.program_name, " +"argv[0]);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +"\n" +" /* 初始化 Python 直譯器。這會是必要的。\n" +" 如果此步驟失敗就會導致嚴重錯誤。*/\n" +" status = Py_InitializeFromConfig(&config);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +" PyConfig_Clear(&config);\n" +"\n" +" /* 可選擇引入模組;或者\n" +" 可以延遲引入,直至嵌入式腳本\n" +" 將其引入。*/\n" +" PyObject *pmodule = PyImport_ImportModule(\"spam\");\n" +" if (!pmodule) {\n" +" PyErr_Print();\n" +" fprintf(stderr, \"Error: could not import module 'spam'\\n\");\n" +" }\n" +"\n" +" // ... 在此使用 Python C API ...\n" +"\n" +" return 0;\n" +"\n" +" exception:\n" +" PyConfig_Clear(&config);\n" +" Py_ExitStatusException(status);\n" +"}" #: ../../extending/extending.rst:436 msgid "" @@ -696,6 +914,9 @@ msgid "" "extension modules. Extension module authors should exercise caution when " "initializing internal data structures." msgstr "" +"從 ``sys.modules`` 中移除項目,或在一個行程中將已編譯模組引入到多個直譯器中" +"(或在沒有 :c:func:`exec` 介入的情況下使用 :c:func:`fork`)可能會對某些擴充模" +"組造成問題。擴充模組作者在初始化內部資料結構時應特別小心。" #: ../../extending/extending.rst:442 msgid "" @@ -703,6 +924,8 @@ msgid "" "distribution as :file:`Modules/xxmodule.c`. This file may be used as a " "template or simply read as an example." msgstr "" +"Python 原始碼發行版本中包含了一個更實質的範例模組 :file:`Modules/" +"xxmodule.c`。這個檔案可以當作模板使用,也可以簡單地當作範例來閱讀。" #: ../../extending/extending.rst:448 msgid "" @@ -711,6 +934,10 @@ msgid "" "``PyInit_spam``, and creation of the module is left to the import machinery. " "For details on multi-phase initialization, see :PEP:`489`." msgstr "" +"不像我們的 ``spam`` 範例,``xxmodule`` 使用了\\ *多階段初始化 (multi-phase " +"initialization)*\\ (Python 3.5 新增),其中的 PyModuleDef 結構會從 " +"``PyInit_spam`` 回傳,而模組的建立則交由引入機制來完成。關於多階段初始化的詳" +"細資訊請參閱 :PEP:`489`。" #: ../../extending/extending.rst:457 msgid "Compilation and Linkage" @@ -1078,14 +1305,14 @@ msgid "" msgstr "" #: ../../extending/extending.rst:737 -#, fuzzy msgid "" "int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,\n" " const char *format, char * const " "*kwlist, ...);" msgstr "" "int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,\n" -" const char *format, char *kwlist[], ...);" +" const char *format, char * const " +"*kwlist, ...);" #: ../../extending/extending.rst:740 msgid "" From 1cc7e8df861c5d86254d92c2b6954ef416830a98 Mon Sep 17 00:00:00 2001 From: "W. H. Wang" <mattwang44@gmail.com> Date: Sun, 23 Feb 2025 17:47:47 +0800 Subject: [PATCH 78/89] translate `library/stringprep.po` (#1024) --- library/stringprep.po | 74 ++++++++++++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 26 deletions(-) diff --git a/library/stringprep.po b/library/stringprep.po index 7999df6a59..5abe72f6a6 100644 --- a/library/stringprep.po +++ b/library/stringprep.po @@ -1,15 +1,16 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Liang-Bo Wang <me@liang2.tw>, 2016 +# Matt Wang <mattwang44@gmail.com>, 2025 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" -"PO-Revision-Date: 2016-11-19 00:34+0000\n" -"Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" +"PO-Revision-Date: 2025-02-17 00:34+0000\n" +"Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -20,7 +21,7 @@ msgstr "" #: ../../library/stringprep.rst:2 msgid ":mod:`!stringprep` --- Internet String Preparation" -msgstr ":mod:`!stringprep` --- 網際網路字串準備" +msgstr ":mod:`!stringprep` --- 網際網路字串的準備" #: ../../library/stringprep.rst:10 msgid "**Source code:** :source:`Lib/stringprep.py`" @@ -35,6 +36,10 @@ msgid "" "possible identifications, to allow only identifications consisting of " "\"printable\" characters." msgstr "" +"在網際網路上識別事物(例如主機名稱)時,通常需要比較這些識別器的「相等性 " +"(equality)」。比較的具體執行方式可能取決於應用程式領域,例如是否應該不區分大" +"小寫。也可能有必要限制可能的識別器,只允許由「可列印 (printable)」字元組成的" +"識別器。" #: ../../library/stringprep.rst:21 msgid "" @@ -47,6 +52,11 @@ msgid "" "``stringprep`` profile is ``nameprep``, which is used for internationalized " "domain names." msgstr "" +":rfc:`3454` 定義了在網際網路通訊協定中「準備」Unicode 字串的程序。在傳送字串" +"到網路之前,先使用準備程序處理字串,之後字串就具有特定的規範化 (normalized) " +"形式。RFC 定義了一系列的表,這些表可以組合成設定檔 (profile)。每個設定檔必須" +"定義它使用哪些表以及 ``stringprep`` 程序的哪些其他可選部分是設定檔的一部分。" +"``stringprep`` 配置文件的一個例子是 ``nameprep``,它被用於國際化網域名稱。" #: ../../library/stringprep.rst:29 msgid "" @@ -55,110 +65,122 @@ msgid "" "module uses the Unicode character database internally. The module source " "code itself was generated using the ``mkstringprep.py`` utility." msgstr "" +":mod:`stringprep` 模組只開放 :rfc:`3454` 中的表。由於這些表如果以字典或串列的" +"方式來表示的話會非常大,因此模組內部使用 Unicode 字元資料庫。模組原始碼本身是" +"使用 ``mkstringprep.py`` 工具來產生的。" #: ../../library/stringprep.rst:34 msgid "" "As a result, these tables are exposed as functions, not as data structures. " -"There are two kinds of tables in the RFC: sets and mappings. For a set, :mod:" -"`stringprep` provides the \"characteristic function\", i.e. a function that " -"returns ``True`` if the parameter is part of the set. For mappings, it " -"provides the mapping function: given the key, it returns the associated " -"value. Below is a list of all functions available in the module." +"There are two kinds of tables in the RFC: sets and mappings. For a " +"set, :mod:`stringprep` provides the \"characteristic function\", i.e. a " +"function that returns ``True`` if the parameter is part of the set. For " +"mappings, it provides the mapping function: given the key, it returns the " +"associated value. Below is a list of all functions available in the module." msgstr "" +"因此,這些表是以函式而非資料結構的形式呈現。RFC 中有兩種表:集合 (sets) 和對" +"映 (mappings)。對於集合,:mod:`stringprep` 提供了「特徵函式 (characteristic " +"function)」,也就是如果參數是集合的一部分就回傳 ``True`` 的函式。對於對映,它" +"提供了對映函式:給定鍵,它會回傳相關的值。以下是模組中所有可用函式的清單。" #: ../../library/stringprep.rst:44 msgid "" "Determine whether *code* is in tableA.1 (Unassigned code points in Unicode " "3.2)." msgstr "" +"判斷 *code* 是否在 tableA.1(Unicode 3.2 中未指定的碼位 (code point))中。" #: ../../library/stringprep.rst:49 msgid "Determine whether *code* is in tableB.1 (Commonly mapped to nothing)." -msgstr "" +msgstr "判斷 *code* 是否在 tableB.1(通常沒有對映到任何東西)中。" #: ../../library/stringprep.rst:54 msgid "" "Return the mapped value for *code* according to tableB.2 (Mapping for case-" "folding used with NFKC)." msgstr "" +"根據 tableB.2(使用 NFKC 形式的大小寫折疊 (case-folding) 對映)回傳 *code* 的" +"對映值。" #: ../../library/stringprep.rst:60 msgid "" "Return the mapped value for *code* according to tableB.3 (Mapping for case-" "folding used with no normalization)." -msgstr "" +msgstr "根據 tableB.3(使用沒有規範化的大小寫折疊對映)回傳 *code* 的對映值。" #: ../../library/stringprep.rst:66 msgid "Determine whether *code* is in tableC.1.1 (ASCII space characters)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.1.1(ASCII 空格字元)中。" #: ../../library/stringprep.rst:71 msgid "" "Determine whether *code* is in tableC.1.2 (Non-ASCII space characters)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.1.2(非 ASCII 空格字元)中。" #: ../../library/stringprep.rst:76 msgid "" "Determine whether *code* is in tableC.1 (Space characters, union of C.1.1 " "and C.1.2)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.1(空格字元,為 C.1.1 和 C.1.2 的聯集)中。" #: ../../library/stringprep.rst:82 msgid "Determine whether *code* is in tableC.2.1 (ASCII control characters)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.2.1(ASCII 控制字元)中。" #: ../../library/stringprep.rst:87 msgid "" "Determine whether *code* is in tableC.2.2 (Non-ASCII control characters)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.2.2(非 ASCII 控制字元)中。" #: ../../library/stringprep.rst:92 msgid "" "Determine whether *code* is in tableC.2 (Control characters, union of C.2.1 " "and C.2.2)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.2(控制字元,為 C.2.1 和 C.2.2 的聯集)中。" #: ../../library/stringprep.rst:98 msgid "Determine whether *code* is in tableC.3 (Private use)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.3(私有使用)中。" #: ../../library/stringprep.rst:103 msgid "Determine whether *code* is in tableC.4 (Non-character code points)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.4(非字元碼位)中。" #: ../../library/stringprep.rst:108 msgid "Determine whether *code* is in tableC.5 (Surrogate codes)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.5(代理碼)中。" #: ../../library/stringprep.rst:113 msgid "" "Determine whether *code* is in tableC.6 (Inappropriate for plain text)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.6(不適用於純文字)中。" #: ../../library/stringprep.rst:118 msgid "" "Determine whether *code* is in tableC.7 (Inappropriate for canonical " "representation)." msgstr "" +"判斷 *code* 是否在 tableC.7(不適用於規範表示法 (canonical representation))" +"中。" #: ../../library/stringprep.rst:124 msgid "" "Determine whether *code* is in tableC.8 (Change display properties or are " "deprecated)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.8(變更顯示屬性或已棄用)中。" #: ../../library/stringprep.rst:130 msgid "Determine whether *code* is in tableC.9 (Tagging characters)." -msgstr "" +msgstr "判斷 *code* 是否在 tableC.9(標記字元 (tagging characters))中。" #: ../../library/stringprep.rst:135 msgid "" "Determine whether *code* is in tableD.1 (Characters with bidirectional " "property \"R\" or \"AL\")." -msgstr "" +msgstr "判斷 *code* 是否在 tableD.1(具有雙向屬性 \"R\" 或 \"AL\" 的字元)中。" #: ../../library/stringprep.rst:141 msgid "" "Determine whether *code* is in tableD.2 (Characters with bidirectional " "property \"L\")." -msgstr "" +msgstr "判斷 *code* 是否在 tableD.2(具有雙向屬性 \"L\" 的字元)中。" From aa8e180e79b830c7a6f8e2f43f9b7c9fba53e055 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Mar 2025 15:54:41 +0800 Subject: [PATCH 79/89] build(deps): bump JamesIves/github-pages-deploy-action (#1025) Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.7.2 to 4.7.3. - [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases) - [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.7.2...v4.7.3) --- updated-dependencies: - dependency-name: JamesIves/github-pages-deploy-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/deploy-gh-page.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-gh-page.yml b/.github/workflows/deploy-gh-page.yml index f969970078..25b8da243a 100644 --- a/.github/workflows/deploy-gh-page.yml +++ b/.github/workflows/deploy-gh-page.yml @@ -18,7 +18,7 @@ jobs: run: JOBS=4 MODE=html make all - name: Deploy to gh page - uses: JamesIves/github-pages-deploy-action@v4.7.2 + uses: JamesIves/github-pages-deploy-action@v4.7.3 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BRANCH: gh-pages From 6f11b03c92be43c6c4eaca2455bba18f539d3237 Mon Sep 17 00:00:00 2001 From: "W. H. Wang" <mattwang44@gmail.com> Date: Fri, 7 Mar 2025 23:47:34 +0800 Subject: [PATCH 80/89] deps: assign python version in ci (#1028) --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dae76878a3..7776b25fcf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,10 @@ jobs: steps: - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.13" + - name: Install Dependencies run: sudo apt-get install gettext From e0c216cecb21c627dc799030a668353c3786b160 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Mar 2025 23:54:11 +0800 Subject: [PATCH 81/89] build(deps): bump abatilo/actions-poetry from 3 to 4 (#1018) Bumps [abatilo/actions-poetry](https://github.com/abatilo/actions-poetry) from 3 to 4. - [Release notes](https://github.com/abatilo/actions-poetry/releases) - [Changelog](https://github.com/abatilo/actions-poetry/blob/master/.releaserc) - [Commits](https://github.com/abatilo/actions-poetry/compare/v3...v4) --- updated-dependencies: - dependency-name: abatilo/actions-poetry dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/summarize_progress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/summarize_progress.yml b/.github/workflows/summarize_progress.yml index 3ffccb41a9..c13a205ad5 100644 --- a/.github/workflows/summarize_progress.yml +++ b/.github/workflows/summarize_progress.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v4 - name: Install poetry - uses: abatilo/actions-poetry@v3 + uses: abatilo/actions-poetry@v4 - name: Execute Check Process run: | From fa64c7650b0d4fcb6e7beced79583a35c93a1c2e Mon Sep 17 00:00:00 2001 From: "Dr.XYZ" <dr.xyz.tw@gmail.com> Date: Sat, 8 Mar 2025 13:46:32 +0800 Subject: [PATCH 82/89] translate library/random.po (#1027) * translate * Apply suggestions from code review Co-authored-by: W. H. Wang <mattwang44@gmail.com> * Unified "replacement" --------- Co-authored-by: W. H. Wang <mattwang44@gmail.com> --- library/random.po | 193 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 171 insertions(+), 22 deletions(-) diff --git a/library/random.po b/library/random.po index a2417c7d11..41ff2b3422 100644 --- a/library/random.po +++ b/library/random.po @@ -3,13 +3,14 @@ # # Translators: # Allen Wu <allen91.wu@gmail.com>, 2021 +# Dr.XYZ <dr.xyz.tw@gmail.com>, 2025 msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-27 00:14+0000\n" -"PO-Revision-Date: 2023-01-23 22:47+0800\n" -"Last-Translator: Allen Wu <allen91.wu@gmail.com>\n" +"PO-Revision-Date: 2025-03-07 19:17+0800\n" +"Last-Translator: Dr.XYZ <dr.xyz.tw@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -17,11 +18,11 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.2.2\n" +"X-Generator: Poedit 3.5\n" #: ../../library/random.rst:2 msgid ":mod:`!random` --- Generate pseudo-random numbers" -msgstr ":mod:`!random` --- 生成偽隨機數" +msgstr ":mod:`!random` --- 產生偽隨機數" #: ../../library/random.rst:7 msgid "**Source code:** :source:`Lib/random.py`" @@ -41,7 +42,7 @@ msgid "" "replacement." msgstr "" "對於整數,可以從範圍中進行均勻選擇。對於序列,有一個隨機元素的均勻選擇,一個" -"用來原地 (in-place) 產生隨機排列清單的函式,以及一個用來隨機取樣不替換的函" +"用來原地 (in-place) 產生隨機排列清單的函式,以及一個用來隨機取樣不重置的函" "式。" #: ../../library/random.rst:19 @@ -51,7 +52,7 @@ msgid "" "generating distributions of angles, the von Mises distribution is available." msgstr "" "在實數線上,有一些函式用於處理均勻分佈、常態分佈(高斯分佈)、對數常態分佈、" -"負指數分佈、gamma 分佈和 Beta 分佈。對於生成角度分佈,可以使用馮·米塞斯分佈 " +"負指數分佈、gamma 分佈和 Beta 分佈。對於產生角度分佈,可以使用馮·米塞斯分佈 " "(von Mises distribution)。" #: ../../library/random.rst:23 @@ -66,7 +67,7 @@ msgid "" "purposes, and is completely unsuitable for cryptographic purposes." msgstr "" "幾乎所有 module 函式都相依於基本函式 :func:`.random`,此函式在半開放範圍 " -"``0.0 <= X < 1.0`` 內均勻地生成一個隨機 float(浮點數)。Python 使用 " +"``0.0 <= X < 1.0`` 內均勻地產生一個隨機 float(浮點數)。Python 使用 " "Mersenne Twister(梅森旋轉演算法)作為核心的產生器,它產生 53 位元精度 " "float,其週期為 2\\*\\*19937-1,透過 C 語言進行底層的實作既快速又支援執行緒安" "全 (threadsafe)。Mersenne Twister 是現存最廣泛被驗證的隨機數產生器之一,但是" @@ -137,6 +138,9 @@ msgid "" "contention and poor performance. Consider using separate instances of :class:" "`Random` per thread instead." msgstr "" +"全域隨機數產生器和 :class:`Random` 的實例是執行緒安全的。然而,在自由執行緒構" +"建中,對全域產生器或同一 :class:`Random` 實例的並行呼叫可能會遇到爭用和性能不" +"佳。請考慮改為每個執行緒使用單獨的 :class:`Random` 實例。" #: ../../library/random.rst:70 msgid "Bookkeeping functions" @@ -177,7 +181,7 @@ msgid "" "generates a narrower range of seeds." msgstr "" "若使用版本 1(為復現於舊版本 Python 中產生隨機序列而提供),:class:`str` 和 :" -"class:`bytes` 的演算法會生成範圍更窄的種子 (seed)。" +"class:`bytes` 的演算法會產生範圍更窄的種子 (seed)。" #: ../../library/random.rst:90 msgid "" @@ -816,6 +820,31 @@ msgid "" ">>> sample([10, 20, 30, 40, 50], k=4) # Four samples without replacement\n" "[40, 10, 50, 30]" msgstr "" +">>> random() # 隨機浮點數:0.0 <= x < 1.0\n" +"0.37444887175646646\n" +"\n" +">>> uniform(2.5, 10.0) # 隨機浮點數:2.5 <= x <= 10.0\n" +"3.1800146073117523\n" +"\n" +">>> expovariate(1 / 5) # 到達間隔平均為 5 秒\n" +"5.148957571865031\n" +"\n" +">>> randrange(10) # 0 到 9(含)的整數\n" +"7\\n\n" +"\n" +">>> randrange(0, 101, 2) # 0 到 100(含)的偶數整數\n" +"26\\n\n" +"\n" +">>> choice(['win', 'lose', 'draw']) # 從序列中隨機選取單一元素\n" +"'draw'\n" +"\n" +">>> deck = 'ace two three four'.split()\n" +">>> shuffle(deck) # 打亂串列\n" +">>> deck\n" +"['four', 'two', 'ace', 'three']\n" +"\n" +">>> sample([10, 20, 30, 40, 50], k=4) # 四個無重置的樣本\n" +"[40, 10, 50, 30]" #: ../../library/random.rst:510 msgid "Simulations::" @@ -846,6 +875,27 @@ msgid "" ">>> sum(trial() for i in range(10_000)) / 10_000\n" "0.7958" msgstr "" +">>> # 六次輪盤旋轉(有重置的加權抽樣)\n" +">>> choices(['red', 'black', 'green'], [18, 18, 2], k=6)\n" +"['red', 'green', 'black', 'black', 'red', 'black']\n" +"\n" +">>> # 從一副 52 張撲克牌中無重置發 20 張牌\n" +">>> # 並確定具有十點值的牌的比例:十、傑克、王后或國王\n" +">>> deal = sample(['tens', 'low cards'], counts=[16, 36], k=20)\n" +">>> deal.count('tens') / 20\n" +"0.15\n" +"\n" +">>> # 估計從 7 次旋轉中得到 5 次或更多正面的概率\n" +">>> # 使用一枚 60% 概率為正面的偏幣\n" +">>> sum(binomialvariate(n=7, p=0.6) >= 5 for i in range(10_000)) / 10_000\n" +"0.4169\n" +"\n" +">>> # 計算 5 個樣本的中位數位於中間兩個四分位數的概率\n" +">>> def trial():\n" +"... return 2_500 <= sorted(choices(range(10_000), k=5))[2] < 7_500\n" +"...\n" +">>> sum(trial() for i in range(10_000)) / 10_000\n" +"0.7958" #: ../../library/random.rst:535 msgid "" @@ -916,6 +966,26 @@ msgid "" "print(f'hypothesis that there is no difference between the drug and the " "placebo.')" msgstr "" +"# 範例來自 Dennis Shasha 和 Manda Wilson 的 \"Statistics is Easy\"\n" +"from statistics import fmean as mean\n" +"from random import shuffle\n" +"\n" +"drug = [54, 73, 53, 70, 73, 68, 52, 65, 65]\n" +"placebo = [54, 51, 58, 44, 55, 52, 42, 47, 58, 46]\n" +"observed_diff = mean(drug) - mean(placebo)\n" +"\n" +"n = 10_000\n" +"count = 0\n" +"combined = drug + placebo\n" +"for i in range(n):\n" +" shuffle(combined)\n" +" new_diff = mean(combined[:len(drug)]) - mean(combined[len(drug):])\n" +" count += (new_diff >= observed_diff)\n" +"\n" +"print(f'{n} 次標籤重新洗牌僅產生 {count} 個差異實例')\n" +"print(f'至少與觀察到的差異 {observed_diff:.1f} 一樣極端。')\n" +"print(f'單邊 p 值 {count / n:.4f} 使我們拒絕無效假設')\n" +"print(f'即藥物與安慰劑之間沒有差異。')" #: ../../library/random.rst:575 msgid "" @@ -950,6 +1020,31 @@ msgid "" "print(f'Mean wait: {mean(waits):.1f} Max wait: {max(waits):.1f}')\n" "print('Quartiles:', [round(q, 1) for q in quantiles(waits)])" msgstr "" +"from heapq import heapify, heapreplace\n" +"from random import expovariate, gauss\n" +"from statistics import mean, quantiles\n" +"\n" +"average_arrival_interval = 5.6\n" +"average_service_time = 15.0\n" +"stdev_service_time = 3.5\n" +"num_servers = 3\n" +"\n" +"waits = []\n" +"arrival_time = 0.0\n" +"servers = [0.0] * num_servers # 每個伺服器可用的時間\n" +"heapify(servers)\n" +"for i in range(1_000_000):\n" +" arrival_time += expovariate(1.0 / average_arrival_interval)\n" +" next_server_available = servers[0]\n" +" wait = max(0.0, next_server_available - arrival_time)\n" +" waits.append(wait)\n" +" service_duration = max(0.0, gauss(average_service_time, " +"stdev_service_time))\n" +" service_completed = arrival_time + wait + service_duration\n" +" heapreplace(servers, service_completed)\n" +"\n" +"print(f'平均等待時間:{mean(waits):.1f} 最大等待時間:{max(waits):.1f}')\n" +"print('四分位數:', [round(q, 1) for q in quantiles(waits)])" #: ../../library/random.rst:604 msgid "" @@ -1028,6 +1123,31 @@ msgid "" " indices = sorted(random.choices(range(n), k=r))\n" " return tuple(pool[i] for i in indices)" msgstr "" +"def random_product(*args, repeat=1):\n" +" \"從 itertools.product(*args, **kwds) 中隨機選擇\"\n" +" pools = [tuple(pool) for pool in args] * repeat\n" +" return tuple(map(random.choice, pools))\n" +"\n" +"def random_permutation(iterable, r=None):\n" +" \"從 itertools.permutations(iterable, r) 中隨機選擇\"\n" +" pool = tuple(iterable)\n" +" r = len(pool) if r is None else r\n" +" return tuple(random.sample(pool, r))\n" +"\n" +"def random_combination(iterable, r):\n" +" \"從 itertools.combinations(iterable, r) 中隨機選擇\"\n" +" pool = tuple(iterable)\n" +" n = len(pool)\n" +" indices = sorted(random.sample(range(n), r))\n" +" return tuple(pool[i] for i in indices)\n" +"\n" +"def random_combination_with_replacement(iterable, r):\n" +" \"有重置地選擇 r 個元素。結果按可疊代物件排序。\"\n" +" # 結果將在 set(itertools.combinations_with_replacement(iterable, r)) 中\n" +" pool = tuple(iterable)\n" +" n = len(pool)\n" +" indices = sorted(random.choices(range(n), k=r))\n" +" return tuple(pool[i] for i in indices)" #: ../../library/random.rst:659 msgid "" @@ -1131,64 +1251,64 @@ msgstr "" #: ../../library/random.rst:713 msgid "Command-line usage" -msgstr "" +msgstr "命令列用法" #: ../../library/random.rst:717 msgid "The :mod:`!random` module can be executed from the command line." -msgstr "" +msgstr ":mod:`!random` 模組可以從命令列執行。" #: ../../library/random.rst:719 msgid "" "python -m random [-h] [-c CHOICE [CHOICE ...] | -i N | -f N] [input ...]" msgstr "" +"python -m random [-h] [-c CHOICE [CHOICE ...] | -i N | -f N] [input ...]" #: ../../library/random.rst:723 -#, fuzzy msgid "The following options are accepted:" -msgstr "以下函式產生離散分佈。" +msgstr "接受以下選項:" #: ../../library/random.rst:729 msgid "Show the help message and exit." -msgstr "" +msgstr "顯示幫助訊息並退出。" #: ../../library/random.rst:734 msgid "Print a random choice, using :meth:`choice`." -msgstr "" +msgstr "列印一個隨機選擇,使用 :meth:`choice`。" #: ../../library/random.rst:739 msgid "" "Print a random integer between 1 and N inclusive, using :meth:`randint`." -msgstr "" +msgstr "列印 1 到 N(含)之間的隨機整數,使用 :meth:`randint`。" #: ../../library/random.rst:744 msgid "" "Print a random floating-point number between 0 and N inclusive, using :meth:" "`uniform`." -msgstr "" +msgstr "列印 0 到 N(含)之間的隨機浮點數,使用 :meth:`uniform`。" #: ../../library/random.rst:747 msgid "If no options are given, the output depends on the input:" -msgstr "" +msgstr "如果未給定選項,則輸出取決於輸入:" #: ../../library/random.rst:749 msgid "String or multiple: same as :option:`--choice`." -msgstr "" +msgstr "字串或多個:與 :option:`--choice` 相同。" #: ../../library/random.rst:750 msgid "Integer: same as :option:`--integer`." -msgstr "" +msgstr "整數:與 :option:`--integer` 相同。" #: ../../library/random.rst:751 msgid "Float: same as :option:`--float`." -msgstr "" +msgstr "浮點數:與 :option:`--float` 相同。" #: ../../library/random.rst:756 msgid "Command-line example" -msgstr "" +msgstr "命令列範例" #: ../../library/random.rst:758 msgid "Here are some examples of the :mod:`!random` command-line interface:" -msgstr "" +msgstr "以下是 :mod:`!random` 命令列介面的一些範例:" #: ../../library/random.rst:760 msgid "" @@ -1222,3 +1342,32 @@ msgid "" "$ python -m random --float 6\n" "3.1942323316565915" msgstr "" +"$ # 隨機選擇一個\n" +"$ python -m random egg bacon sausage spam \"Lobster Thermidor aux " +"crevettes with a Mornay sauce\"\n" +"Lobster Thermidor aux crevettes with a Mornay sauce\n" +"\n" +"$ # 隨機整數\n" +"$ python -m random 6\n" +"6\n" +"\n" +"$ # 隨機浮點數\n" +"$ python -m random 1.8\n" +"1.7080016272295635\n" +"\n" +"$ # 使用明確的引數\n" +"$ python -m random --choice egg bacon sausage spam \"Lobster Thermidor " +"aux crevettes with a Mornay sauce\"\n" +"egg\n" +"\n" +"$ python -m random --integer 6\n" +"3\n" +"\n" +"$ python -m random --float 1.8\n" +"1.5666339105010318\n" +"\n" +"$ python -m random --integer 6\n" +"5\n" +"\n" +"$ python -m random --float 6\n" +"3.1942323316565915" From 2851e6898d07a2b2d6159ec6080f909d2c5055a9 Mon Sep 17 00:00:00 2001 From: Super <chuangsuper@gmail.com> Date: Tue, 11 Mar 2025 11:26:11 +0800 Subject: [PATCH 83/89] translate library/os (#1029) * translate library/os rst:117,124,127,134,136,211,571 * update library/os rst:117,124,127,134,136,211,571 * Update library/os.po Co-authored-by: W. H. Wang <mattwang44@gmail.com> * Update library/os.po Co-authored-by: W. H. Wang <mattwang44@gmail.com> * Update library/os.po Co-authored-by: W. H. Wang <mattwang44@gmail.com> * Update library/os.po Co-authored-by: W. H. Wang <mattwang44@gmail.com> * Update library/os.po Co-authored-by: W. H. Wang <mattwang44@gmail.com> * Update library/os.po Co-authored-by: W. H. Wang <mattwang44@gmail.com> * Update library/os.po Co-authored-by: W. H. Wang <mattwang44@gmail.com> * update library/os * update os.rst:127 --------- Co-authored-by: W. H. Wang <mattwang44@gmail.com> --- library/os.po | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/os.po b/library/os.po index 7369950f4b..8e5e0369c7 100644 --- a/library/os.po +++ b/library/os.po @@ -200,6 +200,8 @@ msgid "" ":func:`locale.getpreferredencoding` returns ``'utf-8'`` (the *do_setlocale* " "argument has no effect)." msgstr "" +":func:`locale.getpreferredencoding` 回傳 ``'utf-8'``\\ (*do_setlocale* " +"引數並無任何效果)。" #: ../../library/os.rst:119 msgid "" @@ -215,6 +217,8 @@ msgid "" "On Unix, :func:`os.device_encoding` returns ``'utf-8'`` rather than the " "device encoding." msgstr "" +"在 Unix 中,:func:`os.device_encoding` 回傳 ``'utf-8'`` 而非" +"裝置編碼。" #: ../../library/os.rst:127 msgid "" @@ -222,6 +226,9 @@ msgid "" "envvar:`PYTHONIOENCODING` (just as they can be in the default locale-aware " "mode)." msgstr "" +"請注意,在 UTF-8 模式中,標準的串流設定會被 " +":envvar:`PYTHONIOENCODING` 覆蓋(如同在預設在地化覺察 " +"模式一樣)。" #: ../../library/os.rst:131 msgid "" @@ -234,10 +241,12 @@ msgid "" "Command line arguments, environment variables and filenames are decoded to " "text using the UTF-8 encoding." msgstr "" +"命令列引數、環境變數及檔案名稱會以 UTF-8 編碼形式來被解碼成文字。" #: ../../library/os.rst:136 msgid ":func:`os.fsdecode` and :func:`os.fsencode` use the UTF-8 encoding." msgstr "" +":func:`os.fsdecode` 和 :func:`os.fsencode` 使用 UTF-8 編碼。" #: ../../library/os.rst:137 msgid "" @@ -438,6 +447,8 @@ msgid "" "Calling :func:`putenv` directly does not change :data:`os.environ`, so it's " "better to modify :data:`os.environ`." msgstr "" +"呼叫 :func:`putenv` 並不會改變 :data:`os.environ`," +"所以建議直接修改 :data:`os.environ`。" #: ../../library/os.rst:216 msgid "" @@ -727,6 +738,7 @@ msgstr "" #: ../../library/os.rst:571 msgid "The function is now always available." msgstr "" +"此函式現在都會是可用的。" #: ../../library/os.rst:577 msgid "Set the current process's effective group id." From bc8c692a146b1e4752679de33dd51c7b9a84c284 Mon Sep 17 00:00:00 2001 From: josix <josixwang@gmail.com> Date: Sat, 15 Mar 2025 15:46:37 +0800 Subject: [PATCH 84/89] chore: Replace python3 -m venv and pip with uv for virtual environment management --- .github/workflows/ci.yml | 3 +++ Makefile | 10 +++++----- README.rst | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7776b25fcf..ad4c154682 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,5 +16,8 @@ jobs: - name: Install Dependencies run: sudo apt-get install gettext + - name: Install uv + uses: astral-sh/setup-uv@v5 + - name: Validate run: VERSION=${{ github.event.repository.default_branch }} JOBS=4 MODE=html make all diff --git a/Makefile b/Makefile index f255eb901d..cd141e9dd6 100644 --- a/Makefile +++ b/Makefile @@ -89,21 +89,21 @@ prepare_cpython: ## Prepare CPython clone at `../cpython/`. $(VENV)/bin/activate: - python3 -m venv $(VENV) + uv venv $(VENV) $(VENV)/bin/sphinx-build: $(VENV)/bin/activate - . $(VENV)/bin/activate; python3 -m pip install sphinx python-docs-theme + . $(VENV)/bin/activate; uv pip install sphinx python-docs-theme $(VENV)/bin/sphinx-lint: $(VENV)/bin/activate - . $(VENV)/bin/activate; python3 -m pip install sphinx-lint + . $(VENV)/bin/activate; uv pip install sphinx-lint $(VENV)/bin/blurb: $(VENV)/bin/activate - . $(VENV)/bin/activate; python3 -m pip install blurb + . $(VENV)/bin/activate; uv pip install blurb .PHONY: upgrade_venv upgrade_venv: $(VENV)/bin/activate ## Upgrade the venv that compiles the doc - @. $(VENV)/bin/activate; python3 -m pip install -q --upgrade sphinx python-docs-theme blurb sphinx-lint + @. $(VENV)/bin/activate; uv pip install -q --upgrade sphinx python-docs-theme blurb sphinx-lint .PHONY: progress diff --git a/README.rst b/README.rst index c239b4a89a..afef5bd09f 100644 --- a/README.rst +++ b/README.rst @@ -84,6 +84,7 @@ the PSF for inclusion in the documentation. - `安裝好 git <https://help.github.com/articles/set-up-git/>`_\ (Windows 上請參考 https://gitforwindows.org/) - 一個 ``.po`` 檔的編輯器。推薦使用 `Poedit <https://poedit.net>`_,若熟悉 po 檔用一般文字編輯器亦可。 +- 參考 `uv Installation <https://docs.astral.sh/uv/getting-started/installation/>`_ 安裝 uv,以便在本機端預覽翻譯成果。 - macOS 的使用者還需要先利用 `homebrew <https://brew.sh/index_zh-tw>`_ 安裝 gettext,屆時 Sphinx 會使用到。 .. code-block:: bash From 2fe27812fc1ed3c57e565b6b681ec7d3fc36d5c4 Mon Sep 17 00:00:00 2001 From: josix <josixwang@gmail.com> Date: Sat, 15 Mar 2025 20:43:11 +0800 Subject: [PATCH 85/89] fix: add uv to gh-page ci --- .github/workflows/deploy-gh-page.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/deploy-gh-page.yml b/.github/workflows/deploy-gh-page.yml index 25b8da243a..b3d8b25466 100644 --- a/.github/workflows/deploy-gh-page.yml +++ b/.github/workflows/deploy-gh-page.yml @@ -14,6 +14,9 @@ jobs: - name: Install Dependencies run: sudo apt-get install gettext + - name: Install uv + uses: astral-sh/setup-uv@v5 + - name: Build run: JOBS=4 MODE=html make all From 1a480de8d9ca4f7d30dbc3ed1f9e901e70b1b8a9 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello <hsu@peterdavehello.org> Date: Sun, 20 Apr 2025 22:59:04 -0700 Subject: [PATCH 86/89] =?UTF-8?q?=E6=9B=BF=E6=8F=9B=EF=BC=9A=E8=AA=BF?= =?UTF-8?q?=E7=94=A8/=E8=A8=AA=E5=95=8F/=E7=95=B6=E5=89=8D/=E9=A1=9E?= =?UTF-8?q?=E5=88=A5=E5=90=8D/=E6=90=9C=E7=B4=A2/=E6=A8=A1=E5=A1=8A/?= =?UTF-8?q?=E5=86=85/=E7=BB=84/=E7=8D=B2=E5=8F=96/=E6=95=B0/=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B/=E6=96=87=E6=AA=94/=E6=93=8D=E4=BD=9C=E7=B3=BB?= =?UTF-8?q?=E7=B5=B1=20(#1022)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.rst | 2 +- c-api/cell.po | 2 +- c-api/codec.po | 6 +-- c-api/datetime.po | 2 +- c-api/file.po | 6 +-- c-api/intro.po | 20 ++++---- c-api/long.po | 6 +-- c-api/perfmaps.po | 2 +- c-api/refcounting.po | 4 +- c-api/sequence.po | 4 +- faq/extending.po | 2 +- faq/library.po | 28 +++++------ faq/programming.po | 20 ++++---- glossary.po | 8 +-- howto/gdb_helpers.po | 8 +-- howto/logging.po | 2 +- howto/perf_profiling.po | 4 +- library/_thread.po | 20 ++++---- library/abc.po | 6 +-- library/array.po | 2 +- library/ast.po | 30 ++++++------ library/asyncio-api-index.po | 2 +- library/asyncio-dev.po | 2 +- library/asyncio-eventloop.po | 34 ++++++------- library/asyncio-future.po | 2 +- library/asyncio-llapi-index.po | 26 +++++----- library/asyncio-queue.po | 4 +- library/asyncio-stream.po | 4 +- library/asyncio-sync.po | 20 ++++---- library/bisect.po | 20 ++++---- library/calendar.po | 2 +- library/collections.po | 12 ++--- library/concurrent.futures.po | 10 ++-- library/copy.po | 2 +- library/csv.po | 14 +++--- library/dataclasses.po | 8 +-- library/ensurepip.po | 26 +++++----- library/ftplib.po | 10 ++-- library/functions.po | 34 ++++++------- library/gc.po | 14 +++--- library/glob.po | 6 +-- library/hashlib.po | 6 +-- library/heapq.po | 4 +- library/hmac.po | 6 +-- library/html.parser.po | 2 +- library/http.po | 2 +- library/io.po | 4 +- library/itertools.po | 2 +- library/marshal.po | 4 +- library/multiprocessing.shared_memory.po | 4 +- library/operator.po | 4 +- library/os.path.po | 14 +++--- library/pathlib.po | 10 ++-- library/pdb.po | 62 ++++++++++++------------ library/pickle.po | 14 +++--- library/platform.po | 14 +++--- library/queue.po | 2 +- library/random.po | 4 +- library/re.po | 2 +- library/secrets.po | 2 +- library/security_warnings.po | 2 +- library/signal.po | 2 +- library/ssl.po | 10 ++-- library/stdtypes.po | 4 +- library/string.po | 2 +- library/sys.monitoring.po | 2 +- library/tempfile.po | 2 +- library/threading.po | 16 +++--- library/time.po | 28 +++++------ library/timeit.po | 2 +- library/typing.po | 2 +- library/unittest.mock.po | 12 ++--- library/urllib.robotparser.po | 2 +- library/uuid.po | 8 +-- library/venv.po | 8 +-- library/weakref.po | 6 +-- library/wsgiref.po | 30 ++++++------ library/xmlrpc.po | 2 +- library/zlib.po | 2 +- reference/datamodel.po | 2 +- reference/import.po | 12 ++--- reference/toplevel_components.po | 6 +-- sphinx.po | 4 +- tutorial/appendix.po | 2 +- tutorial/classes.po | 18 +++---- tutorial/controlflow.po | 8 +-- tutorial/inputoutput.po | 4 +- tutorial/interactive.po | 6 +-- tutorial/interpreter.po | 2 +- tutorial/modules.po | 10 ++-- tutorial/whatnow.po | 2 +- using/unix.po | 6 +-- whatsnew/3.10.po | 26 +++++----- whatsnew/3.11.po | 24 ++++----- whatsnew/3.12.po | 6 +-- whatsnew/3.3.po | 4 +- 96 files changed, 441 insertions(+), 441 deletions(-) diff --git a/README.rst b/README.rst index afef5bd09f..4a5fcd7f1e 100644 --- a/README.rst +++ b/README.rst @@ -233,7 +233,7 @@ the PSF for inclusion in the documentation. 其中最簡單的貢獻方式就是更新 *fuzzy entries*,讓曾經翻譯的內容保持與最新版本的文件 同步。請參考\ `尋找有翻譯過但需校閱的 fuzzy entries`_ 段落。 -此外,當前的目標為完成 **Tutorial** 的翻譯,因此在 ``tutorial/`` 底下的所有 +此外,目前的目標為完成 **Tutorial** 的翻譯,因此在 ``tutorial/`` 底下的所有 po 檔皆為首要的翻譯對象。你也可以幫忙校對已經翻譯過的內容。 diff --git a/c-api/cell.po b/c-api/cell.po index 26beccfb9a..1b56cd0661 100644 --- a/c-api/cell.po +++ b/c-api/cell.po @@ -89,7 +89,7 @@ msgid "" "reference to any current content of the cell. *value* may be ``NULL``. " "*cell* must be non-``NULL``." msgstr "" -"將 cell 物件 *cell* 的內容設為 *value*。這將釋放任何對 cell 物件當前內容的參" +"將 cell 物件 *cell* 的內容設為 *value*。這將釋放任何對 cell 物件目前內容的參" "照。*value* 可以為 ``NULL``。*cell* 必須不為 ``NULL``。" #: ../../c-api/cell.rst:58 diff --git a/c-api/codec.po b/c-api/codec.po index 3cd05b00bc..6fd7c61a7f 100644 --- a/c-api/codec.po +++ b/c-api/codec.po @@ -24,7 +24,7 @@ msgstr "編解碼器註冊表和支援函式" #: ../../c-api/codec.rst:8 msgid "Register a new codec search function." -msgstr "註冊一個新的編解碼器搜索函式。" +msgstr "註冊一個新的編解碼器搜尋函式。" #: ../../c-api/codec.rst:10 msgid "" @@ -32,7 +32,7 @@ msgid "" "done, to make sure that it is always first in the list of search functions." msgstr "" "作為副作用 (side effect),這會嘗試載入 :mod:`!encodings`\\ (如果尚未完成)," -"以確保它始終位於搜索函式列表中的第一個。" +"以確保它始終位於搜尋函式列表中的第一個。" #: ../../c-api/codec.rst:15 msgid "" @@ -40,7 +40,7 @@ msgid "" "search function is not registered, do nothing. Return 0 on success. Raise an " "exception and return -1 on error." msgstr "" -"取消註冊編解碼器搜索函式並清除註冊表 (registry) 的快取。如果搜索函式並未被註" +"取消註冊編解碼器搜尋函式並清除註冊表 (registry) 的快取。如果搜尋函式並未被註" "冊,則不執行任何操作。成功回傳 0,發生錯誤時會引發例外並回傳 -1。" #: ../../c-api/codec.rst:23 diff --git a/c-api/datetime.po b/c-api/datetime.po index aca575f97c..60f4918fdc 100644 --- a/c-api/datetime.po +++ b/c-api/datetime.po @@ -38,7 +38,7 @@ msgid "" msgstr "" ":mod:`datetime` 模組提供各種日期和時間物件。在使用任何這些函式之前,必須將標" "頭檔 :file:`datetime.h` 引入於原始碼中(請注意,:file:`Python.h` 並無引入該標" -"頭檔),且巨集 :c:macro:`!PyDateTime_IMPORT` 必須被調用,而這通常作為模組初始" +"頭檔),且巨集 :c:macro:`!PyDateTime_IMPORT` 必須被叫用,而這通常作為模組初始" "化函式的一部分。該巨集將指向 C 結構的指標放入靜態變數 :c:data:`!" "PyDateTimeAPI` 中,該變數會被以下巨集使用。" diff --git a/c-api/file.po b/c-api/file.po index ccf0d607eb..cb40f45c72 100644 --- a/c-api/file.po +++ b/c-api/file.po @@ -38,7 +38,7 @@ msgid "" msgstr "" "這些 API 是用於內建檔案物件的 Python 2 C API 的最小模擬 (minimal emulation)," "它過去依賴於 C 標準函式庫對於緩衝 I/O (:c:expr:`FILE*`) 的支援。在 Python 3 " -"中,檔案和串流使用新的 :mod:`io` 模組,它在操作系統的低階無緩衝 I/O 上定義了" +"中,檔案和串流使用新的 :mod:`io` 模組,它在作業系統的低階無緩衝 I/O 上定義了" "多個層級。下面描述的函式是這些新 API 的便捷 C 包裝器,主要用於直譯器中的內部" "錯誤報告;建議第三方程式碼改為存取 :mod:`io` API。" @@ -55,7 +55,7 @@ msgstr "" "從已打開檔案 *fd* 的檔案描述器建立一個 Python 檔案物件。引數 *name*、" "*encoding*、*errors* 和 *newline* 可以為 ``NULL`` 以使用預設值; *buffering* " "可以是 *-1* 以使用預設值。 *name* 被忽略並保留以實作向後相容性。失敗時回傳 " -"``NULL``。有關引數的更全面描述,請參閱 :func:`io.open` 函式文檔。" +"``NULL``。有關引數的更全面描述,請參閱 :func:`io.open` 函式文件。" #: ../../c-api/file.rst:31 msgid "" @@ -63,7 +63,7 @@ msgid "" "level file descriptors can produce various issues (such as unexpected " "ordering of data)." msgstr "" -"由於 Python 串流有自己的緩衝層,將它們與操作系統層級檔案描述器混合使用會產生" +"由於 Python 串流有自己的緩衝層,將它們與作業系統層級檔案描述器混合使用會產生" "各種問題(例如資料的排序不符合預期)。" #: ../../c-api/file.rst:35 diff --git a/c-api/intro.po b/c-api/intro.po index 9854c7f4d0..cb7472c40b 100644 --- a/c-api/intro.po +++ b/c-api/intro.po @@ -179,8 +179,8 @@ msgid "" "option:`prefix <--prefix>` include the platform specific headers from :" "option:`exec_prefix <--exec-prefix>`." msgstr "" -"要引入標頭,請將兩個(如果不同)目錄放在編譯器的引入搜索路徑 (search path) " -"中。*不要*\\ 將父目錄放在搜索路徑上,然後使用 ``#include <pythonX.Y/Python." +"要引入標頭,請將兩個(如果不同)目錄放在編譯器的引入搜尋路徑 (search path) " +"中。*不要*\\ 將父目錄放在搜尋路徑上,然後使用 ``#include <pythonX.Y/Python." "h>``;這會在多平台建置上壞掉,因為 :option:`prefix <--prefix>` 下獨立於平台的" "標頭包括來自 :option:`exec_prefix <--exec-prefix>` 的平台特定標頭。" @@ -600,7 +600,7 @@ msgid "" msgstr "" "然而,一個常見的陷阱是從一個 list 中提取一個物件並保留它一段時間而不取得其參" "照。某些其他操作可能會從列表中刪除該物件,減少其參照計數並可能取消分配它。真" -"正的危險是看似無害的操作可能會呼叫可以執行此操作的任意 Python 程式碼;有一個" +"正的危險是看似無害的操作可能會叫用可以執行此操作的任意 Python 程式碼;有一個" "程式碼路徑允許控制權從 :c:func:`Py_DECREF` 回歸使用者,因此幾乎任何操作都有潛" "在危險。" @@ -702,7 +702,7 @@ msgid "" msgstr "" "這裡 :c:func:`PyLong_FromLong` 會回傳一個新的參照,它立即被 :c:func:" "`PyTuple_SetItem` 竊取。如果你想繼續使用一個物件,儘管對它的參照將被竊取,請" -"在呼叫參照竊取函式之前使用 :c:func:`Py_INCREF` 來獲取另一個參照。" +"在呼叫參照竊取函式之前使用 :c:func:`Py_INCREF` 來取得另一個參照。" #: ../../c-api/intro.rst:427 msgid "" @@ -839,7 +839,7 @@ msgstr "" "重要的是要意識到你是否擁有一個函式回傳的參照只取決於你呼叫哪個函式 --- *羽毛 " "(plumage)*(作為引數傳遞給函式的物件之型別)\\ *不會進入它!*\\ 因此,如果你" "使用 :c:func:`PyList_GetItem` 從 list 中提取一個項目,你不會擁有其參照 --- 但" -"如果你使用 :c:func:`PySequence_GetItem` 從同一 list 中獲取相同的項目(且恰好" +"如果你使用 :c:func:`PySequence_GetItem` 從同一 list 中取得相同的項目(且恰好" "使用完全相同的引數),你確實會擁有對回傳物件的參照。" #: ../../c-api/intro.rst:497 @@ -1189,8 +1189,8 @@ msgid "" msgstr "" "在大多數系統上(特別是在 Unix 和 Windows 上,儘管細節略有不同),:c:func:" "`Py_Initialize` 會假設Python 函式庫相對於 Python 直譯器可執行檔案的位置固定," -"並根據其對標準 Python 直譯器可執行檔案位置的最佳猜測來計算模組搜索路徑。或者" -"更詳細地說,它會在 shell 命令搜索路徑(環境變數 :envvar:`PATH`)中找到名為 :" +"並根據其對標準 Python 直譯器可執行檔案位置的最佳猜測來計算模組搜尋路徑。或者" +"更詳細地說,它會在 shell 命令搜尋路徑(環境變數 :envvar:`PATH`)中找到名為 :" "file:`python` 的可執行檔案,並在其父目錄中查找一個名為 :file:`lib/python{X.Y}" "` 的目錄的相對位置。" @@ -1223,7 +1223,7 @@ msgid "" "func:`Py_GetProgramFullPath` (all defined in :file:`Modules/getpath.c`)." msgstr "" "嵌入的應用程式可以透過在呼叫 :c:func:`Py_Initialize` *之前*\\ 呼叫 " -"``Py_SetProgramName(file)`` 來引導搜索。請注意 :envvar:`PYTHONHOME` 仍然覆蓋" +"``Py_SetProgramName(file)`` 來引導搜尋。請注意 :envvar:`PYTHONHOME` 仍然覆蓋" "它並且 :envvar:`PYTHONPATH` 仍然插入在標準路徑的前面。需要完全控制權的應用程" "式必須實作自己的 :c:func:`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:func:" "`Py_GetExecPrefix` 和 :c:func:`Py_GetProgramFullPath`\\(全部定義在 :file:" @@ -1245,7 +1245,7 @@ msgstr "" "有時會希望能夠「取消初始化 (uninitialize)」Python。例如,應用程式可能想要重新" "開始(再次呼叫 :c:func:`Py_Initialize`)或者應用程式簡單地完成了對 Python 的" "使用並想要釋放 Python 分配的記憶體。這可以透過呼叫 :c:func:`Py_FinalizeEx` 來" -"完成。如果 Python 當前處於初始化狀態,函式 :c:func:`Py_IsInitialized` 會回傳 " +"完成。如果 Python 目前處於初始化狀態,函式 :c:func:`Py_IsInitialized` 會回傳 " "true。有關這些功能的更多資訊將在後面的章節中給出。請注意 :c:func:" "`Py_FinalizeEx` *不會*\\ 釋放由 Python 直譯器分配的所有記憶體,例如目前無法釋" "放被擴充模組所分配的記憶體。" @@ -1309,7 +1309,7 @@ msgid "" "well. Upon exit, all existing references are printed. (In interactive mode " "this happens after every statement run by the interpreter.)" msgstr "" -"定義 :c:macro:`Py_TRACE_REFS` 來啟用參照追蹤(參見\\ :option:`調用 --with-" +"定義 :c:macro:`Py_TRACE_REFS` 來啟用參照追蹤(參見\\ :option:`設定 --with-" "trace-refs 選項 <--with-trace-refs>`)。當有定義時,透過向每個 :c:type:" "`PyObject` 新增兩個額外欄位來維護有效物件的循環雙向鍊表 (circular doubly " "linked list)。全體分配也有被追蹤。退出時將印出所有現行參照。(在交互模式下," diff --git a/c-api/long.po b/c-api/long.po index db11da07a8..0df0341414 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -640,11 +640,11 @@ msgstr "object(物件)" #: ../../c-api/long.rst:8 msgid "long integer" -msgstr "long integer(長整数)" +msgstr "long integer(長整數)" #: ../../c-api/long.rst:8 msgid "integer" -msgstr "integer(整数)" +msgstr "integer(整數)" #: ../../c-api/long.rst:144 msgid "LONG_MAX (C macro)" @@ -653,7 +653,7 @@ msgstr "LONG_MAX(C 巨集)" #: ../../c-api/long.rst:144 ../../c-api/long.rst:204 ../../c-api/long.rst:247 #: ../../c-api/long.rst:262 ../../c-api/long.rst:278 ../../c-api/long.rst:294 msgid "OverflowError (built-in exception)" -msgstr "OverflowError(内建例外)" +msgstr "OverflowError(內建例外)" #: ../../c-api/long.rst:247 msgid "PY_SSIZE_T_MAX (C macro)" diff --git a/c-api/perfmaps.po b/c-api/perfmaps.po index 6c8314aa43..09e683c2bb 100644 --- a/c-api/perfmaps.po +++ b/c-api/perfmaps.po @@ -75,7 +75,7 @@ msgid "" "information about the cause of a failure." msgstr "" "建立/打開 perf map 檔案成功時回傳 ``0``,失敗時回傳 ``-1``,建立鎖時失敗則回" -"傳 ``-2``。檢查 ``errno`` 以獲取更多造成失敗的資訊。" +"傳 ``-2``。檢查 ``errno`` 以取得更多造成失敗的資訊。" #: ../../c-api/perfmaps.rst:35 msgid "" diff --git a/c-api/refcounting.po b/c-api/refcounting.po index d5cacea802..fa04ff0352 100644 --- a/c-api/refcounting.po +++ b/c-api/refcounting.po @@ -238,9 +238,9 @@ msgid "" "object in a temporary variable, update the list data structure, and then " "call :c:func:`Py_DECREF` for the temporary variable." msgstr "" -"釋放函式可以導致任意 Python 程式碼被調用(例如,當釋放具有 :meth:`~object." +"釋放函式可以導致任意 Python 程式碼被叫用(例如,當釋放具有 :meth:`~object." "__del__` 方法的類別實例時)。雖然此類程式碼中的例外不會被傳遞出來,但​​執行的程" -"式碼可以自由存取所有 Python 全域變數。這意味著在調用 :c:func:`Py_DECREF` 之" +"式碼可以自由存取所有 Python 全域變數。這意味著在叫用 :c:func:`Py_DECREF` 之" "前,可從全域變數存取的任何物件都應處於一致狀態。例如,從 list 中刪除物件的程" "式碼應將已刪除物件的參照複製到臨時變數中,更新 list 資料結構,然後為臨時變數" "呼叫 :c:func:`Py_DECREF`。" diff --git a/c-api/sequence.po b/c-api/sequence.po index edb70e4c6f..88d5a0d4fa 100644 --- a/c-api/sequence.po +++ b/c-api/sequence.po @@ -202,7 +202,7 @@ msgstr "" #: ../../c-api/sequence.rst:21 ../../c-api/sequence.rst:123 msgid "built-in function" -msgstr "built-in function(内建函式)" +msgstr "built-in function(內建函式)" #: ../../c-api/sequence.rst:21 msgid "len" @@ -210,4 +210,4 @@ msgstr "len" #: ../../c-api/sequence.rst:123 msgid "tuple" -msgstr "tuple(元组)" +msgstr "tuple(元組)" diff --git a/faq/extending.po b/faq/extending.po index 720d5e9fe3..3235118126 100644 --- a/faq/extending.po +++ b/faq/extending.po @@ -95,7 +95,7 @@ msgid "" "<https://github.com/scipy/weave>`_ are also alternatives for wrapping C++ " "libraries." msgstr "" -"如果你需要連接到當前不存在 Python 擴充的某些 C 或 C++ 函式庫,你可以嘗試使用 " +"如果你需要連接到目前不存在 Python 擴充的某些 C 或 C++ 函式庫,你可以嘗試使用 " "`SWIG <https://www.swig.org>`_ 等工具包裝函式庫的資料型別和函式。`SIP " "<https://github.com/Python-SIP/sip>`__、`CXX <https://cxx.sourceforge.net/" ">`_ `Boost <https://www.boost.org/libs /python/doc/index.html>`_ 或 `Weave " diff --git a/faq/library.po b/faq/library.po index 648029c94e..696efce18f 100644 --- a/faq/library.po +++ b/faq/library.po @@ -54,8 +54,8 @@ msgid "" "engine. Searching for \"Python\" plus a keyword or two for your topic of " "interest will usually find something helpful." msgstr "" -"對於第三方包,搜索`Python 包索引<https://pypi.org>`_ 或嘗試`Google <https://" -"www.google.com>`_ 或其他網路搜索引擎。搜索 \"Python\" 加上你感興趣的主題的一" +"對於第三方包,搜尋`Python 包索引<https://pypi.org>`_ 或嘗試`Google <https://" +"www.google.com>`_ 或其他網路搜尋引擎。搜尋 \"Python\" 加上你感興趣的主題的一" "兩個關鍵字通常會找到有用的東西。" #: ../../faq/library.rst:28 @@ -230,7 +230,7 @@ msgid "" msgstr "" ":mod:`curses` 模組支援基本的 curses 功能以及 ncurses 和 SYSV curses 的許多附" "加功能,例如顏色、替代字元集支援、鍵盤和鼠標支援。這意味著該模組與僅具有 BSD " -"curses 的作業系統不相容,但似乎沒有任何當前維護的作業系統屬於此類型。" +"curses 的作業系統不相容,但似乎沒有任何目前維護的作業系統屬於此類型。" #: ../../faq/library.rst:111 msgid "Is there an equivalent to C's onexit() in Python?" @@ -286,8 +286,8 @@ msgid "" "examples in the docstrings for a module and runs them, comparing the output " "with the expected output given in the docstring." msgstr "" -"Python 帶有兩個測試框架。 :mod:`doctest` 模組在模組的文檔字串中查詢示例並運行" -"它們,將輸出與文檔字串中給出的預期輸出進行比較。" +"Python 帶有兩個測試框架。 :mod:`doctest` 模組在模組的文件字串中查詢示例並運行" +"它們,將輸出與文件字串中給出的預期輸出進行比較。" #: ../../faq/library.rst:141 #, fuzzy @@ -374,7 +374,7 @@ msgstr "" #: ../../faq/library.rst:179 #, fuzzy msgid "How do I create documentation from doc strings?" -msgstr "如何從文檔字串建立文檔?" +msgstr "如何從文件字串建立文件?" #: ../../faq/library.rst:181 #, fuzzy @@ -384,9 +384,9 @@ msgid "" "docstrings is `epydoc <https://epydoc.sourceforge.net/>`_. `Sphinx <https://" "www.sphinx-doc.org>`_ can also include docstring content." msgstr "" -":mod:`pydoc` 模組可以從 Python 源程式碼中的文檔字串建立 HTML。純粹從文檔字串" -"建立 API 文檔的另一種方法是 `epydoc <https://epydoc.sourceforge.net/>`_。 " -"`Sphinx <https://www.sphinx-doc.org>`_ 也可以包含文檔字串內容。" +":mod:`pydoc` 模組可以從 Python 源程式碼中的文件字串建立 HTML。純粹從文件字串" +"建立 API 文件的另一種方法是 `epydoc <https://epydoc.sourceforge.net/>`_。 " +"`Sphinx <https://www.sphinx-doc.org>`_ 也可以包含文件字串內容。" #: ../../faq/library.rst:188 #, fuzzy @@ -613,7 +613,7 @@ msgid "" "Consult the module's documentation for more details; the :class:`~queue." "Queue` class provides a featureful interface." msgstr "" -"有關更多詳細資訊,請參閱模組的文檔; :class:`~queue.Queue` 類別提供了一個功能" +"有關更多詳細資訊,請參閱模組的文件; :class:`~queue.Queue` 類別提供了一個功能" "強大的介面。" #: ../../faq/library.rst:363 @@ -708,7 +708,7 @@ msgid "" "can affect things. This is especially true for the mass updates to " "dictionaries and lists. When in doubt, use a mutex!" msgstr "" -"替換其他物件的操作可能會在引用計數達到零時呼叫其他物件的 :meth:`__del__` 方" +"替換其他物件的操作可能會在引用計數達到零時叫用其他物件的 :meth:`__del__` 方" "法,這可能會影響事情。對於字典和列表的大量更新尤其如此。如有疑問,請使用互斥" "體!" @@ -817,7 +817,7 @@ msgid "" "see the :mod:`os` module. The two functions are identical; :func:`~os." "unlink` is simply the name of the Unix system call for this function." msgstr "" -"使用 ``os.remove(filename)`` 或 ``os.unlink(filename)``;有關文檔,請參閱 :" +"使用 ``os.remove(filename)`` 或 ``os.unlink(filename)``;有關文件,請參閱 :" "mod:`os` 模組。這兩個功能是相同的; :func:`~os.unlink` 只是這個函式的 Unix 系" "統呼叫的名稱。" @@ -848,7 +848,7 @@ msgid "" "open`, where *fd* is the file descriptor (a small integer)." msgstr "" "要截斷一個檔案,使用``f = open(filename, \"rb+\")``打開它,然後使用``f." -"truncate(offset)``;偏移量預設為當前搜索位置。對於使用 :func:`os.open` 打開的" +"truncate(offset)``;偏移量預設為目前搜尋位置。對於使用 :func:`os.open` 打開的" "檔案,還有 ``os.ftruncate(fd, offset)``,其中 *fd* 是檔案描述器(一個小整" "數)。" @@ -895,7 +895,7 @@ msgid "" "`struct` module. It allows you to take a string containing binary data " "(usually numbers) and convert it to Python objects; and vice versa." msgstr "" -"要讀取或寫入複雜的二進制資料格式,最好使用 :mod:`struct` 模組。它允許你獲取包" +"要讀取或寫入複雜的二進制資料格式,最好使用 :mod:`struct` 模組。它允許你取得包" "含二進制資料(通常是數字)的字串並將其轉換為 Python 物件;反之亦然。" #: ../../faq/library.rst:509 diff --git a/faq/programming.po b/faq/programming.po index f2df420db1..9a735d13bb 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -593,7 +593,7 @@ msgid "" "module is busy importing the 2nd." msgstr "" "在兩個模組都使用 \"import <module>\" 引入形式的情況下,循環引入很好。當第二個" -"模組想要從第一個模組中獲取一個名稱( \"from module import name\" )並且引入位" +"模組想要從第一個模組中取得一個名稱( \"from module import name\" )並且引入位" "於頂層時,它們會失敗。那是因為 1st 中的名稱尚不可用,因為第一個模組正忙於導" "入 2nd。" @@ -1350,7 +1350,7 @@ msgid "" "instance's name is ``a`` or ``b``, since both names are bound to the same " "value." msgstr "" -"可以說該類別有一個名稱:即使它綁定到兩個名稱並透過名稱 ``B`` 呼叫,建立的實例" +"可以說該類別有一個名稱:即使它綁定到兩個名稱並透過名稱 ``B`` 叫用,建立的實例" "仍然被報告為類別 ``A`` 的實例。但是,無法確定實例的名稱是 ``a`` 還是 ``b`` ," "因為這兩個名稱都綁定到相同的值。" @@ -2161,7 +2161,7 @@ msgid "" "Writing benchmark scripts will allow you to iterate quickly when searching " "for improvements (see the :mod:`timeit` module)." msgstr "" -"編寫基準測試腳本將允許你在搜索改進時快速疊代(請參閱 :mod:`timeit` 模組)。" +"編寫基準測試腳本將允許你在搜尋改進時快速疊代(請參閱 :mod:`timeit` 模組)。" #: ../../faq/programming.rst:1086 #, fuzzy @@ -2415,7 +2415,7 @@ msgstr "如何從list中刪除重複項?" #: ../../faq/programming.rst:1204 #, fuzzy msgid "See the Python Cookbook for a long discussion of many ways to do this:" -msgstr "請參閱 Python Cookbook 以獲取有關執行此操作的多種方法的詳細討論:" +msgstr "請參閱 Python Cookbook 以取得有關執行此操作的多種方法的詳細討論:" #: ../../faq/programming.rst:1206 msgid "https://code.activestate.com/recipes/52560/" @@ -3351,7 +3351,7 @@ msgid "" "the attribute, you have to explicitly use the class name in the assignment::" msgstr "" "對於靜態資料,只需定義一個類別屬性即可。要為屬性分配新值,你必須在分配中顯式" -"使用類別名: ::" +"使用類別名稱: ::" #: ../../faq/programming.rst:1669 msgid "" @@ -3381,7 +3381,7 @@ msgid "" "class on the base-class search path from ``c.__class__`` back to ``C``." msgstr "" "``c.count`` 還指代任何 ``c`` 的 ``C.count`` 使得 ``isinstance(c, C)`` 成立," -"除非被 ``c`` 本身或某些人覆蓋從 ``c.__class__`` 回到 ``C`` 的基底類別搜索路徑" +"除非被 ``c`` 本身或某些人覆蓋從 ``c.__class__`` 回到 ``C`` 的基底類別搜尋路徑" "上的類別。" #: ../../faq/programming.rst:1682 @@ -3530,7 +3530,7 @@ msgid "" msgstr "" "帶有雙前導底線的變數名被「破壞」以提供一種簡單但有效的方法來定義類別私有變" "數。 ``__spam`` 形式的任何標識器(至少兩個前導底線,最多一個尾隨底線)在文本" -"上替換為 ``_classname__spam``,其中 ``classname`` 是當前類別名,所有前導底線" +"上替換為 ``_classname__spam``,其中 ``classname`` 是目前類別名稱,所有前導底線" "被去除。" #: ../../faq/programming.rst:1751 @@ -3659,7 +3659,7 @@ msgstr "" #: ../../faq/programming.rst:1822 #, fuzzy msgid "How do I get a list of all instances of a given class?" -msgstr "如何獲取給定類別的所有實例的 list?" +msgstr "如何取得給定類別的所有實例的 list?" #: ../../faq/programming.rst:1824 #, fuzzy @@ -4130,7 +4130,7 @@ msgid "" "file, and ends with ``.pyc``, with a middle component that depends on the " "particular ``python`` binary that created it. (See :pep:`3147` for details.)" msgstr "" -"第一次引入模組時(或者源檔案自建立當前編譯檔案後發生更改時)應在 " +"第一次引入模組時(或者源檔案自建立目前編譯檔案後發生更改時)應在 " "``__pycache__`` 的子目錄中建立包含編譯程式碼的 ``.pyc`` 檔案包含 .py 檔案的目" "錄。 ``.pyc`` 檔案的檔案名以與``.py`` 檔案相同的名稱開頭,以``.pyc`` 結尾,中" "間部分依賴於特定的``python `` 建立它的二進製檔案。(有關詳細資訊,請參" @@ -4229,7 +4229,7 @@ msgstr "python -m compileall ." #: ../../faq/programming.rst:2128 msgid "How do I find the current module name?" -msgstr "如何找到當前模組名稱?" +msgstr "如何找到目前模組名稱?" #: ../../faq/programming.rst:2130 #, fuzzy diff --git a/glossary.po b/glossary.po index 780dc58513..b32a80087a 100644 --- a/glossary.po +++ b/glossary.po @@ -697,7 +697,7 @@ msgstr "" "是連續的。零維 (zero-dimensional) 的緩衝區都是 C 及 Fortran contiguous。在一" "維 (one-dimensional) 陣列中,各項目必須在記憶體中彼此相鄰地排列,而其索引順序" "是從零開始遞增。在多維的 (multidimensional) C-contiguous 陣列中,按記憶體位址" -"的順序訪問各個項目時,最後一個索引的變化最快。然而,在 Fortran contiguous 陣" +"的順序瀏覽各個項目時,最後一個索引的變化最快。然而,在 Fortran contiguous 陣" "列中,第一個索引的變化最快。" #: ../../glossary.rst:302 @@ -1219,7 +1219,7 @@ msgid "" "default::" msgstr "" ":ref:`future 陳述式 <future>`:``from __future__ import <feature>``,會指示編" -"譯器使用那些在 Python 未來的發布版本中將成為標準的語法或語義,來編譯當前的模" +"譯器使用那些在 Python 未來的發布版本中將成為標準的語法或語義,來編譯目前的模" "組。而 :mod:`__future__` 模組則記錄了 *feature(功能)*\\ 可能的值。透過 " "import 此模組並對其變數求值,你可以看見一個新的功能是何時首次被新增到此語言" "中,以及它何時將會(或已經)成為預設的功能: ::" @@ -1291,7 +1291,7 @@ msgid "" msgstr "" "每個 :keyword:`yield` 會暫停處理程序,並記住執行狀態(包括區域變數及擱置中的 " "try 陳述式)。當\\ *產生器疊代器*\\ 回復時,它會從停止的地方繼續執行(與那些" -"每次調用時都要重新開始的函式有所不同)。" +"每次呼叫時都要重新開始的函式有所不同)。" #: ../../glossary.rst:562 ../../glossary.rst:563 msgid "generator expression" @@ -1573,7 +1573,7 @@ msgid "" msgstr "" "Python 有一個互動式直譯器,這表示你可以在直譯器的提示字元輸入陳述式和運算式," "立即執行它們並且看到它們的結果。只要啟動 ``python``,不需要任何引數(可能藉由" -"從你的電腦的主選單選擇它)。這是測試新想法或檢查模塊和包的非常強大的方法(請" +"從你的電腦的主選單選擇它)。這是測試新想法或檢查模組和包的非常強大的方法(請" "記住help(x))。更多互動式模式相關資訊請見 :ref:`tut-interac`。" #: ../../glossary.rst:681 diff --git a/howto/gdb_helpers.po b/howto/gdb_helpers.po index 4dae44f916..3208fed349 100644 --- a/howto/gdb_helpers.po +++ b/howto/gdb_helpers.po @@ -465,8 +465,8 @@ msgid "" "(if any) for the current frame in the selected thread. The current line is " "marked with a \">\"::" msgstr "" -"該擴充功能新增了一個 ``py-list`` 命令,該命令列出了所選執行緒中當前 frame 的 " -"Python 原始程式碼(如果有)。當前的列會標有 \">\": ::" +"該擴充功能新增了一個 ``py-list`` 命令,該命令列出了所選執行緒中目前 frame 的 " +"Python 原始程式碼(如果有)。目前的列會標有 \">\": ::" #: ../../howto/gdb_helpers.rst:216 msgid "" @@ -807,7 +807,7 @@ msgid "" "looks in locals within the current thread, then globals, then finally " "builtins::" msgstr "" -"``py-print`` 命令查找 Python 名稱並嘗試列印它。它在當前執行緒中尋找局部變數," +"``py-print`` 命令查找 Python 名稱並嘗試列印它。它在目前執行緒中尋找局部變數," "然後是全域變數,最後是內建變數: ::" #: ../../howto/gdb_helpers.rst:346 @@ -847,7 +847,7 @@ msgid "" "The ``py-locals`` command looks up all Python locals within the current " "Python frame in the selected thread, and prints their representations::" msgstr "" -"``py-locals`` 命令尋找所選執行緒中當前 Python frame 內的所有 Python 局部變" +"``py-locals`` 命令尋找所選執行緒中目前 Python frame 內的所有 Python 局部變" "數,並列印它們的表示: ::" #: ../../howto/gdb_helpers.rst:365 diff --git a/howto/logging.po b/howto/logging.po index fa2c5628aa..4a1f511a6c 100644 --- a/howto/logging.po +++ b/howto/logging.po @@ -1653,7 +1653,7 @@ msgstr "將 ``logging.logThreads`` 設為 ``False``。" #: ../../howto/logging.rst:1113 msgid "Current process ID (:func:`os.getpid`)" -msgstr "當前的行程 ID (:func:`os.getpid`)" +msgstr "目前的行程 ID (:func:`os.getpid`)" #: ../../howto/logging.rst:1113 msgid "Set ``logging.logProcesses`` to ``False``." diff --git a/howto/perf_profiling.po b/howto/perf_profiling.po index 0274ff095f..ae86e12830 100644 --- a/howto/perf_profiling.po +++ b/howto/perf_profiling.po @@ -37,7 +37,7 @@ msgid "" "that aid with the analysis of the data that it produces." msgstr "" "`Linux 性能分析器 (Linux perf profiler) <https://perf.wiki.kernel.org>`_ 是一" -"個非常強大的工具,可讓你分析並獲取有關應用程式的性能資訊。``perf`` 還擁有一個" +"個非常強大的工具,可讓你分析並取得有關應用程式的性能資訊。``perf`` 還擁有一個" "非常活躍的工具生態系統,有助於分析其生成的資料。" #: ../../howto/perf_profiling.rst:17 @@ -48,7 +48,7 @@ msgid "" "and file names of Python functions in your code will not appear in the " "output of ``perf``." msgstr "" -"在 Python 應用程式中使用 ``perf`` 分析器的主要問題是 ``perf`` 僅獲取有關原生" +"在 Python 應用程式中使用 ``perf`` 分析器的主要問題是 ``perf`` 僅取得有關原生" "符號的資訊,即用 C 編寫的函式和程式的名稱。這表示程式碼中的 Python 函式名稱和" "檔案名稱不會出現在 ``perf`` 的輸出中。" diff --git a/library/_thread.po b/library/_thread.po index 1dbd585c96..17e592407e 100644 --- a/library/_thread.po +++ b/library/_thread.po @@ -156,7 +156,7 @@ msgid "" "identifiers may be recycled when a thread exits and another thread is " "created." msgstr "" -"回傳當前執行緒的「執行緒識別字」。這是一個非零的整數。它的值沒有直接的含義;" +"回傳目前執行緒的「執行緒識別字」。這是一個非零的整數。它的值沒有直接的含義;" "它被用作一個 magic cookie,例如用於索引特定於執行緒的資料的字典。當執行緒退出" "並建立另一個執行緒時,執行緒識別字可能會被重複使用。" @@ -167,7 +167,7 @@ msgid "" "identify this particular thread system-wide (until the thread terminates, " "after which the value may be recycled by the OS)." msgstr "" -"回傳由核心 (kernel) 分配的當前執行緒的原生整數執行緒 ID。這是一個非負整數。它" +"回傳由核心 (kernel) 分配的目前執行緒的原生整數執行緒 ID。這是一個非負整數。它" "的值可用於在整個系統中唯一標識此特定執行緒(直到執行緒終止後,該值可能被操作" "系統重新使用)。" @@ -204,7 +204,7 @@ msgstr "" "`ValueError` 錯誤,並且堆疊大小不會被修改。目前,32 KiB 是保證解譯器本身具有" "足夠堆疊空間所支持的最小堆疊大小值。請注意,某些平台對於堆疊大小的值可能有特" "定的限制,例如要求最小堆疊大小 > 32 KiB,或要求按系統記憶體頁面大小的倍數進行" -"分配。應參考平台文檔以獲取更多訊息(4 KiB 頁面是比較普遍的;在缺乏更具體訊息" +"分配。應參考平台文件以取得更多訊息(4 KiB 頁面是比較普遍的;在缺乏更具體訊息" "的情況下,建議使用 4096 的倍數作為堆疊大小)。" #: ../../library/_thread.rst:150 @@ -231,8 +231,8 @@ msgid "" "(only one thread at a time can acquire a lock --- that's their reason for " "existence)." msgstr "" -"沒有任何可選引數時,此方法無條件地獲取鎖,必要時會等待直到被另一個執行緒釋放" -"(一次只能有一個執行緒獲取鎖 --- 這正是鎖存在的原因)。" +"沒有任何可選引數時,此方法無條件地取得鎖,必要時會等待直到被另一個執行緒釋放" +"(一次只能有一個執行緒取得鎖 --- 這正是鎖存在的原因)。" #: ../../library/_thread.rst:171 msgid "" @@ -242,7 +242,7 @@ msgid "" "as above." msgstr "" "如果存在 *blocking* 引數,則根據其值執行操作:如果為 False,只有在可以立即獲" -"取鎖而無需等待的情況下才獲取鎖,而如果為 True,則像上面一樣無條件地獲取鎖。" +"取鎖而無需等待的情況下才取得鎖,而如果為 True,則像上面一樣無條件地取得鎖。" #: ../../library/_thread.rst:176 msgid "" @@ -259,7 +259,7 @@ msgstr "" msgid "" "The return value is ``True`` if the lock is acquired successfully, ``False`` " "if not." -msgstr "如果成功獲取鎖,回傳值為 ``True``,否則為 ``False``。" +msgstr "如果成功取得鎖,回傳值為 ``True``,否則為 ``False``。" #: ../../library/_thread.rst:184 msgid "The *timeout* parameter is new." @@ -267,20 +267,20 @@ msgstr "新增的 *timeout* 參數。" #: ../../library/_thread.rst:187 msgid "Lock acquires can now be interrupted by signals on POSIX." -msgstr "現在獲取鎖的操作可以被 POSIX 訊號中斷。" +msgstr "現在取得鎖的操作可以被 POSIX 訊號中斷。" #: ../../library/_thread.rst:193 msgid "" "Releases the lock. The lock must have been acquired earlier, but not " "necessarily by the same thread." -msgstr "釋放鎖。鎖必須先前被獲取,但不一定是由同一個執行緒獲取的。" +msgstr "釋放鎖。鎖必須先前被取得,但不一定是由同一個執行緒取得的。" #: ../../library/_thread.rst:199 msgid "" "Return the status of the lock: ``True`` if it has been acquired by some " "thread, ``False`` if not." msgstr "" -"回傳鎖的狀態:如果鎖已被某個執行緒獲取,則回傳 ``True``,否則回傳 ``False``。" +"回傳鎖的狀態:如果鎖已被某個執行緒取得,則回傳 ``True``,否則回傳 ``False``。" #: ../../library/_thread.rst:202 msgid "" diff --git a/library/abc.po b/library/abc.po index 5d5dde6b3b..10dc2f9958 100644 --- a/library/abc.po +++ b/library/abc.po @@ -289,7 +289,7 @@ msgid "" "`~type.__mro__` list) is considered a ``MyIterable`` too." msgstr "" "這裡定義的 :meth:`__subclasshook__` 類別方法說明任何在其 :attr:`~object." -"__dict__` (或在其透過 :attr:`~type.__mro__` 列表訪問的基底類別) 中具有 :meth:" +"__dict__` (或在其透過 :attr:`~type.__mro__` 列表存取的基底類別) 中具有 :meth:" "`~iterator.__iter__` 方法的類別也都會被視為 ``MyIterable``。" #: ../../library/abc.rst:154 @@ -627,7 +627,7 @@ msgstr ":mod:`!abc` 模組也提供了這些函式:" #: ../../library/abc.rst:330 msgid "Returns the current abstract base class cache token." -msgstr "回傳當前 ABC 快取令牌 (cache token)。" +msgstr "回傳目前 ABC 快取令牌 (cache token)。" #: ../../library/abc.rst:332 msgid "" @@ -636,7 +636,7 @@ msgid "" "The token changes with every call to :meth:`ABCMeta.register` on any ABC." msgstr "" "此令牌是一個(支援相等性測試的)不透明物件 (opaque object),用於為虛擬子類別" -"標識抽象基底類別快取的當前版本。此令牌會在任何 ABC 上每次呼叫 :meth:`ABCMeta." +"標識抽象基底類別快取的目前版本。此令牌會在任何 ABC 上每次呼叫 :meth:`ABCMeta." "register` 時發生更改。" #: ../../library/abc.rst:340 diff --git a/library/array.po b/library/array.po index 8d66dac4e6..1c05103624 100644 --- a/library/array.po +++ b/library/array.po @@ -321,7 +321,7 @@ msgid "" "as long as the array exists and no length-changing operations are applied to " "it." msgstr "" -"回傳一個 tuple ``(address, length)`` 表示當前的記憶體位置和陣列儲存元素的緩衝" +"回傳一個 tuple ``(address, length)`` 表示目前的記憶體位置和陣列儲存元素的緩衝" "區記憶體長度。緩衝區的長度單位是位元組,並可以用 ``array.buffer_info()[1] * " "array.itemsize`` 計算得到。這偶爾會在底層操作需要記憶體位置的輸出輸入時很有" "用,例如 :c:func:`!ioctl` 指令。只要陣列存在且沒有使用任何更改長度的操作時," diff --git a/library/ast.po b/library/ast.po index a117a57e5a..84159d0c12 100644 --- a/library/ast.po +++ b/library/ast.po @@ -34,7 +34,7 @@ msgid "" msgstr "" ":mod:`ast` 模組可以幫助 Python 應用程式處理 Python 抽象語法文法 (abstract " "syntax grammar) 樹狀資料結構。抽象語法本身可能會隨著每個 Python 版本發布而改" -"變;此模組有助於以程式化的方式來得知當前文法的面貌。" +"變;此模組有助於以程式化的方式來得知目前文法的面貌。" #: ../../library/ast.rst:23 msgid "" @@ -335,7 +335,7 @@ msgid "" msgstr "" "請注意,編譯器並不需要結束位置,因此其為可選的。結束偏移量在最後一個符號\\ *" "之後*,例如可以使用 ``source_line[node.col_offset : node.end_col_offset]`` 來" -"獲取單列運算式節點 (expression node) 的原始片段。" +"取得單列運算式節點 (expression node) 的原始片段。" #: ../../library/ast.rst:108 msgid "" @@ -3593,7 +3593,7 @@ msgstr "一個類別定義。" #: ../../library/ast.rst:2033 msgid "``name`` is a raw string for the class name" -msgstr "``name`` 是類別名的原始字串" +msgstr "``name`` 是類別名稱的原始字串" #: ../../library/ast.rst:2034 msgid "``bases`` is a list of nodes for explicitly specified base classes." @@ -3803,7 +3803,7 @@ msgid "" "``feature_version``." msgstr "" "將 ``feature_version`` 設定為元組 ``(major, minor)`` 將「盡可能」嘗試使用該 " -"Python 版本的文法進行剖析。當前 ``major`` 必須等於 ``3``。例如,設定 " +"Python 版本的文法進行剖析。目前 ``major`` 必須等於 ``3``。例如,設定 " "``feature_version=(3, 9)`` 將嘗試禁止剖析 :keyword:`match` 陳述式。目前 " "``major`` 必須為 ``3``、支援的最低版本為 ``(3, 7)``\\ (這在未來的 Python 版" "本中可能會增加);最高的是 ``sys.version_info[0:2]``。「盡可能」嘗試意味著不" @@ -3966,7 +3966,7 @@ msgid "" "attr:`~ast.AST.col_offset`, or :attr:`~ast.AST.end_col_offset`) is missing, " "return ``None``." msgstr "" -"獲取生成 *node* 的 *source* 的原始碼片段。如果某些位置資訊(:attr:`~ast.AST." +"取得生成 *node* 的 *source* 的原始碼片段。如果某些位置資訊(:attr:`~ast.AST." "lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST.col_offset` 或 :attr:" "`~ast.AST.end_col_offset`\\ )遺漏,則回傳 ``None``。" @@ -4042,14 +4042,14 @@ msgid "" "visitor function for every node found. This function may return a value " "which is forwarded by the :meth:`visit` method." msgstr "" -"節點訪問者基底類別,它遍歷抽象語法樹並為找到的每個節點呼叫訪問者函式。該函式" +"節點瀏覽者基底類別,它遍歷抽象語法樹並為找到的每個節點呼叫瀏覽者函式。該函式" "可能會回傳一個由 :meth:`visit` 方法轉發的值。" #: ../../library/ast.rst:2312 msgid "" "This class is meant to be subclassed, with the subclass adding visitor " "methods." -msgstr "這個類別應該被子類別化,子類別新增訪問者方法。" +msgstr "這個類別應該被子類別化,子類別新增瀏覽者方法。" #: ../../library/ast.rst:2317 msgid "" @@ -4057,21 +4057,21 @@ msgid "" "`self.visit_{classname}` where *classname* is the name of the node class, " "or :meth:`generic_visit` if that method doesn't exist." msgstr "" -"訪問一個節點。預設實作呼叫名為 :samp:`self.visit_{classname}` 的方法,其中 " +"瀏覽一個節點。預設實作呼叫名為 :samp:`self.visit_{classname}` 的方法,其中 " "*classname* 是節點類別的名稱,或者在該方法不存在時呼叫 :meth:" "`generic_visit`。" #: ../../library/ast.rst:2323 msgid "This visitor calls :meth:`visit` on all children of the node." -msgstr "該訪問者對該節點的所有子節點呼叫 :meth:`visit`。" +msgstr "該瀏覽者對該節點的所有子節點呼叫 :meth:`visit`。" #: ../../library/ast.rst:2325 msgid "" "Note that child nodes of nodes that have a custom visitor method won't be " "visited unless the visitor calls :meth:`generic_visit` or visits them itself." msgstr "" -"請注意,除非訪問者呼叫 :meth:`generic_visit` 或訪問它們本身,否則不會訪問具有" -"自定義訪問者方法的節點之子節點。" +"請注意,除非瀏覽者呼叫 :meth:`generic_visit` 或瀏覽它們本身,否則不會瀏覽具有" +"自定義瀏覽者方法的節點之子節點。" #: ../../library/ast.rst:2331 msgid "Handles all constant nodes." @@ -4084,7 +4084,7 @@ msgid "" "`NodeTransformer`) that allows modifications." msgstr "" "如果你想在遍歷期間將變更應用 (apply) 於節點,請不要使用 :class:" -"`NodeVisitor`。為此,有個允許修改的特殊遍歷訪問者工具 :class:" +"`NodeVisitor`。為此,有個允許修改的特殊遍歷瀏覽者工具 :class:" "`NodeTransformer`。" #: ../../library/ast.rst:2339 @@ -4112,8 +4112,8 @@ msgid "" "location, otherwise it is replaced with the return value. The return value " "may be the original node in which case no replacement takes place." msgstr "" -":class:`NodeTransformer` 將遍歷 AST 並使用訪問者方法的回傳值來替換或刪除舊節" -"點。如果訪問者方法的回傳值為 ``None``,則該節點將從其位置中刪除,否則將被替換" +":class:`NodeTransformer` 將遍歷 AST 並使用瀏覽者方法的回傳值來替換或刪除舊節" +"點。如果瀏覽者方法的回傳值為 ``None``,則該節點將從其位置中刪除,否則將被替換" "為回傳值。回傳值可能是原始節點,在這種情況下不會發生替換。" #: ../../library/ast.rst:2356 @@ -4159,7 +4159,7 @@ msgid "" "statement nodes), the visitor may also return a list of nodes rather than " "just a single node." msgstr "" -"對於屬於陳述式總集 (collection) 一部分的節點(適用於所有陳述式節點),訪問者" +"對於屬於陳述式總集 (collection) 一部分的節點(適用於所有陳述式節點),瀏覽者" "還可以回傳節點串列,而不僅僅是單個節點。" #: ../../library/ast.rst:2376 diff --git a/library/asyncio-api-index.po b/library/asyncio-api-index.po index 1530baa6c8..dba5a76c2a 100644 --- a/library/asyncio-api-index.po +++ b/library/asyncio-api-index.po @@ -87,7 +87,7 @@ msgstr ":func:`current_task`" #: ../../library/asyncio-api-index.rst:39 msgid "Return the current Task." -msgstr "回傳當前 Task 物件。" +msgstr "回傳目前 Task 物件。" #: ../../library/asyncio-api-index.rst:41 msgid ":func:`all_tasks`" diff --git a/library/asyncio-dev.po b/library/asyncio-dev.po index 7362cbb454..ad5c2a8c28 100644 --- a/library/asyncio-dev.po +++ b/library/asyncio-dev.po @@ -375,7 +375,7 @@ msgstr "" #: ../../library/asyncio-dev.rst:202 msgid "Detect never-retrieved exceptions" -msgstr "偵測從未被獲取的 (never-retrieved) 例外" +msgstr "偵測從未被取得的 (never-retrieved) 例外" #: ../../library/asyncio-dev.rst:204 msgid "" diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index 5008415a77..e90baed76d 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -67,7 +67,7 @@ msgstr "以下的低階函式可用於取得、設置或建立事件迴圈:" #: ../../library/asyncio-eventloop.rst:34 msgid "Return the running event loop in the current OS thread." -msgstr "在當前作業系統執行緒中回傳正在運行的事件迴圈。" +msgstr "在目前作業系統執行緒中回傳正在運行的事件迴圈。" #: ../../library/asyncio-eventloop.rst:36 msgid "Raise a :exc:`RuntimeError` if there is no running event loop." @@ -121,12 +121,12 @@ msgid "" "Deprecation warning is emitted if there is no current event loop. In some " "future Python release this will become an error." msgstr "" -"如果沒有當前事件迴圈,則會發出棄用警告。在未來的某個 Python 發行版中,這將變" +"如果沒有目前事件迴圈,則會發出棄用警告。在未來的某個 Python 發行版中,這將變" "成錯誤。" #: ../../library/asyncio-eventloop.rst:68 msgid "Set *loop* as the current event loop for the current OS thread." -msgstr "將 *loop* 設置為當前 OS 執行緒的當前事件迴圈。" +msgstr "將 *loop* 設置為目前 OS 執行緒的目前事件迴圈。" #: ../../library/asyncio-eventloop.rst:72 msgid "Create and return a new event loop object." @@ -239,7 +239,7 @@ msgid "" "will run the next time :meth:`run_forever` or :meth:`run_until_complete` is " "called." msgstr "" -"如果在 :meth:`run_forever` 運行時呼叫 :meth:`stop`,則迴圈將運行當前批次的回" +"如果在 :meth:`run_forever` 運行時呼叫 :meth:`stop`,則迴圈將運行目前批次的回" "呼函式,然後退出。請注意,由回呼函式排程的新回呼在此情況下不會運行;而是在下" "次呼叫 :meth:`run_forever` 或 :meth:`run_until_complete` 時運行。" @@ -249,7 +249,7 @@ msgstr "停止事件迴圈。" #: ../../library/asyncio-eventloop.rst:146 msgid "Return ``True`` if the event loop is currently running." -msgstr "如果事件迴圈當前正在運行,則回傳 ``True``。" +msgstr "如果事件迴圈目前正在運行,則回傳 ``True``。" #: ../../library/asyncio-eventloop.rst:150 msgid "Return ``True`` if the event loop was closed." @@ -284,7 +284,7 @@ msgid "" "loop will issue a warning if a new asynchronous generator is iterated. This " "should be used to reliably finalize all scheduled asynchronous generators." msgstr "" -"排程所有當前打開的\\ :term:`非同步產生器 <asynchronous generator>`\\ 物件使" +"排程所有目前打開的\\ :term:`非同步產生器 <asynchronous generator>`\\ 物件使" "用 :meth:`~agen.aclose` 呼叫來關閉。呼叫此方法後,如果疊代新的非同步產生器," "事件迴圈將發出警告。應該使用此方法可靠地完成所有已排程的非同步產生器。" @@ -386,7 +386,7 @@ msgid "" "use the current context when no *context* is provided." msgstr "" "選用的僅限關鍵字引數 *context* 指定了要給 *callback* 執行的自定" -"義 :class:`contextvars.Context`。當未提供 *context* 時,回呼函式使用當前情" +"義 :class:`contextvars.Context`。當未提供 *context* 時,回呼函式使用目前情" "境。" #: ../../library/asyncio-eventloop.rst:231 @@ -506,7 +506,7 @@ msgid "" "current context is used when no *context* is provided." msgstr "" "可選的僅限關鍵字 *context* 引數允許為 *callback* 指定自定義" -"的 :class:`contextvars.Context` 以提供運行。當未提供 *context* 時,將使用當前" +"的 :class:`contextvars.Context` 以提供運行。當未提供 *context* 時,將使用目前" "情境。" #: ../../library/asyncio-eventloop.rst:303 @@ -535,14 +535,14 @@ msgid "" "difference between *when* and the current time could not exceed one day. " "This has been fixed in Python 3.8." msgstr "" -"在 Python 3.7 及更早版本中,使用預設事件迴圈實作時,*when* 和當前時間之間的差" +"在 Python 3.7 及更早版本中,使用預設事件迴圈實作時,*when* 和目前時間之間的差" "值不能超過一天。這在 Python 3.8 中已經修復。" #: ../../library/asyncio-eventloop.rst:330 msgid "" "Return the current time, as a :class:`float` value, according to the event " "loop's internal monotonic clock." -msgstr "根據事件迴圈的內部單調時鐘,回傳當前時間,以 :class:`float` 值表示。" +msgstr "根據事件迴圈的內部單調時鐘,回傳目前時間,以 :class:`float` 值表示。" #: ../../library/asyncio-eventloop.rst:334 msgid "" @@ -603,7 +603,7 @@ msgid "" "context copy is created when no *context* is provided." msgstr "" "可選的僅限關鍵字 *context* 引數允許為 *coro* 指定自定義" -"的 :class:`contextvars.Context` 以提供運行。當未提供 *context* 時,將建立當前" +"的 :class:`contextvars.Context` 以提供運行。當未提供 *context* 時,將建立目前" "情境的副本。" #: ../../library/asyncio-eventloop.rst:372 @@ -1495,7 +1495,7 @@ msgid "" "Start monitoring the *fd* file descriptor for read availability and invoke " "*callback* with the specified arguments once *fd* is available for reading." msgstr "" -"開始監視 *fd* 檔案描述器的讀取可用性,一但 *fd* 可讀取,使用指定引數呼叫 " +"開始監視 *fd* 檔案描述器的讀取可用性,一但 *fd* 可讀取,使用指定引數叫用 " "*callback*。" #: ../../library/asyncio-eventloop.rst:963 @@ -1518,7 +1518,7 @@ msgid "" "Start monitoring the *fd* file descriptor for write availability and invoke " "*callback* with the specified arguments once *fd* is available for writing." msgstr "" -"開始監視 *fd* 檔案描述器的寫入可用性,一旦 *fd* 可寫入,使用指定引數呼叫 " +"開始監視 *fd* 檔案描述器的寫入可用性,一旦 *fd* 可寫入,使用指定引數叫用 " "*callback*。" #: ../../library/asyncio-eventloop.rst:980 @@ -1873,7 +1873,7 @@ msgid "" "registered using :func:`signal.signal`, a callback registered with this " "function is allowed to interact with the event loop." msgstr "" -"該回呼將由 *loop* 呼叫,與該事件迴圈的其他排隊回呼和可運行的協程一起。與使" +"該回呼將由 *loop* 叫用,與該事件迴圈的其他排隊回呼和可運行的協程一起。與使" "用 :func:`signal.signal` 註冊的訊號處理程式不同,使用此函式註冊的回呼允許與事" "件迴圈進行互動。" @@ -1888,7 +1888,7 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:1248 msgid "" "Like :func:`signal.signal`, this function must be invoked in the main thread." -msgstr "像 :func:`signal.signal` 一樣,此函式必須在主執行緒中呼叫。" +msgstr "像 :func:`signal.signal` 一樣,此函式必須在主執行緒中叫用。" #: ../../library/asyncio-eventloop.rst:1253 msgid "Remove the handler for the *sig* signal." @@ -2064,7 +2064,7 @@ msgid "" "Return the current exception handler, or ``None`` if no custom exception " "handler was set." msgstr "" -"回傳當前的例外處理程式,如果未設置自定義例外處理程式,則回傳 ``None``。" +"回傳目前的例外處理程式,如果未設置自定義例外處理程式,則回傳 ``None``。" #: ../../library/asyncio-eventloop.rst:1383 msgid "Default exception handler." @@ -2087,7 +2087,7 @@ msgstr "*context* 參數與 :meth:`call_exception_handler` 中的意思相同。 #: ../../library/asyncio-eventloop.rst:1394 msgid "Call the current event loop exception handler." -msgstr "呼叫當前事件迴圈例外處理程式。" +msgstr "呼叫目前事件迴圈例外處理程式。" #: ../../library/asyncio-eventloop.rst:1396 msgid "" diff --git a/library/asyncio-future.po b/library/asyncio-future.po index b208eeee6a..94e7426522 100644 --- a/library/asyncio-future.po +++ b/library/asyncio-future.po @@ -285,7 +285,7 @@ msgid "" "context is used when no *context* is provided." msgstr "" "可選僅限關鍵字引數 *context* 用來指定一個讓 *callback* 執行於其中的客製化 :" -"class:`contextvars.Context` 物件。如果沒有提供 *context*,則使用當前情境。" +"class:`contextvars.Context` 物件。如果沒有提供 *context*,則使用目前情境。" #: ../../library/asyncio-future.rst:171 msgid "" diff --git a/library/asyncio-llapi-index.po b/library/asyncio-llapi-index.po index ad64842802..53e8482029 100644 --- a/library/asyncio-llapi-index.po +++ b/library/asyncio-llapi-index.po @@ -29,7 +29,7 @@ msgstr "本頁列出所有低階 asyncio APIs。" #: ../../library/asyncio-llapi-index.rst:12 msgid "Obtaining the Event Loop" -msgstr "獲取事件迴圈" +msgstr "取得事件迴圈" #: ../../library/asyncio-llapi-index.rst:18 msgid ":func:`asyncio.get_running_loop`" @@ -37,7 +37,7 @@ msgstr ":func:`asyncio.get_running_loop`" #: ../../library/asyncio-llapi-index.rst:19 msgid "The **preferred** function to get the running event loop." -msgstr "**推薦使用**\\ 於獲取當前運行事件迴圈 (event loop) 的函式。" +msgstr "**推薦使用**\\ 於取得目前運行事件迴圈 (event loop) 的函式。" #: ../../library/asyncio-llapi-index.rst:21 msgid ":func:`asyncio.get_event_loop`" @@ -45,7 +45,7 @@ msgstr ":func:`asyncio.get_event_loop`" #: ../../library/asyncio-llapi-index.rst:22 msgid "Get an event loop instance (running or current via the current policy)." -msgstr "獲得一個(正在運行的或透過當前 policy 建立的)事件迴圈實例。" +msgstr "獲得一個(正在運行的或透過目前 policy 建立的)事件迴圈實例。" #: ../../library/asyncio-llapi-index.rst:24 msgid ":func:`asyncio.set_event_loop`" @@ -53,7 +53,7 @@ msgstr ":func:`asyncio.set_event_loop`" #: ../../library/asyncio-llapi-index.rst:25 msgid "Set the event loop as current via the current policy." -msgstr "透過當前 policy 來設定當前事件迴圈。" +msgstr "透過目前 policy 來設定目前事件迴圈。" #: ../../library/asyncio-llapi-index.rst:27 msgid ":func:`asyncio.new_event_loop`" @@ -160,7 +160,7 @@ msgstr ":meth:`loop.get_debug`" #: ../../library/asyncio-llapi-index.rst:78 msgid "Get the current debug mode." -msgstr "獲取當前除錯模式。" +msgstr "取得目前除錯模式。" #: ../../library/asyncio-llapi-index.rst:81 msgid "Scheduling Callbacks" @@ -172,7 +172,7 @@ msgstr ":meth:`loop.call_soon`" #: ../../library/asyncio-llapi-index.rst:87 msgid "Invoke a callback soon." -msgstr "儘快調用回呼函式 (callback)。" +msgstr "儘快呼叫回呼函式 (callback)。" #: ../../library/asyncio-llapi-index.rst:89 msgid ":meth:`loop.call_soon_threadsafe`" @@ -188,7 +188,7 @@ msgstr ":meth:`loop.call_later`" #: ../../library/asyncio-llapi-index.rst:93 msgid "Invoke a callback *after* the given time." -msgstr "在給定時間\\ *之後*\\ 調用回呼函式。" +msgstr "在給定時間\\ *之後*\\ 呼叫回呼函式。" #: ../../library/asyncio-llapi-index.rst:95 msgid ":meth:`loop.call_at`" @@ -196,7 +196,7 @@ msgstr ":meth:`loop.call_at`" #: ../../library/asyncio-llapi-index.rst:96 msgid "Invoke a callback *at* the given time." -msgstr "在給定時間\\ *當下*\\ 調用回呼函式。" +msgstr "在給定時間\\ *當下*\\ 呼叫回呼函式。" #: ../../library/asyncio-llapi-index.rst:99 msgid "Thread/Process Pool" @@ -263,7 +263,7 @@ msgid "" "Get the factory :meth:`loop.create_task` uses to create :class:`Tasks " "<Task>`." msgstr "" -"獲取被 :meth:`loop.create_task` 用來建立 :class:`Tasks <Task>` 的工廠函式。" +"取得被 :meth:`loop.create_task` 用來建立 :class:`Tasks <Task>` 的工廠函式。" #: ../../library/asyncio-llapi-index.rst:132 msgid "DNS" @@ -544,7 +544,7 @@ msgstr ":meth:`loop.get_exception_handler`" #: ../../library/asyncio-llapi-index.rst:262 msgid "Get the current exception handler." -msgstr "獲取當前例外處理函式。" +msgstr "取得目前例外處理函式。" #: ../../library/asyncio-llapi-index.rst:264 msgid ":meth:`loop.default_exception_handler`" @@ -644,7 +644,7 @@ msgstr ":meth:`transport.get_protocol() <BaseTransport.get_protocol>`" #: ../../library/asyncio-llapi-index.rst:311 msgid "Return the current protocol." -msgstr "回傳當前協定。" +msgstr "回傳目前協定。" #: ../../library/asyncio-llapi-index.rst:314 msgid "" @@ -749,7 +749,7 @@ msgstr "" #: ../../library/asyncio-llapi-index.rst:361 msgid "Return the current size of the output buffer." -msgstr "回傳當前輸出緩衝區的大小。" +msgstr "回傳目前輸出緩衝區的大小。" #: ../../library/asyncio-llapi-index.rst:363 msgid "" @@ -1042,7 +1042,7 @@ msgstr ":meth:`asyncio.get_event_loop_policy`" #: ../../library/asyncio-llapi-index.rst:517 msgid "Return the current process-wide policy." -msgstr "回傳當前整個行程中的 Policy。" +msgstr "回傳目前整個行程中的 Policy。" #: ../../library/asyncio-llapi-index.rst:519 msgid ":meth:`asyncio.set_event_loop_policy`" diff --git a/library/asyncio-queue.po b/library/asyncio-queue.po index effaeebec4..17149ee2f2 100644 --- a/library/asyncio-queue.po +++ b/library/asyncio-queue.po @@ -192,7 +192,7 @@ msgid "" "item, a subsequent call to :meth:`task_done` tells the queue that the " "processing on the work item is complete." msgstr "" -"由佇列消耗者使用。對於每個用於獲取一個工作項目的 :meth:`~Queue.get`,接續" +"由佇列消耗者使用。對於每個用於取得一個工作項目的 :meth:`~Queue.get`,接續" "的 :meth:`task_done` 呼叫會告訴佇列這個工作項目的處理已經完成。" #: ../../library/asyncio-queue.rst:124 @@ -201,7 +201,7 @@ msgid "" "been processed (meaning that a :meth:`task_done` call was received for every " "item that had been :meth:`~Queue.put` into the queue)." msgstr "" -"如果 :meth:`join` 當前正在阻塞,在所有項目都被處理後會解除阻塞(意味著每個" +"如果 :meth:`join` 目前正在阻塞,在所有項目都被處理後會解除阻塞(意味著每個" "以 :meth:`~Queue.put` 放進佇列的條目都會收到一個 :meth:`task_done`)。" #: ../../library/asyncio-queue.rst:129 diff --git a/library/asyncio-stream.po b/library/asyncio-stream.po index f4ca808ca4..2b809cf126 100644 --- a/library/asyncio-stream.po +++ b/library/asyncio-stream.po @@ -321,7 +321,7 @@ msgid "" "partially read data." msgstr "" "如果在讀取完 *n* 個位元組之前讀取到 EOF,則會引發 :exc:" -"`IncompleteReadError`。使用 :attr:`IncompleteReadError.partial` 屬性來獲取串" +"`IncompleteReadError`。使用 :attr:`IncompleteReadError.partial` 屬性來取得串" "流結束前已讀取的部分資料。" #: ../../library/asyncio-stream.rst:252 @@ -642,7 +642,7 @@ msgstr "" #: ../../library/asyncio-stream.rst:489 msgid "Get HTTP headers" -msgstr "獲取 HTTP 標頭" +msgstr "取得 HTTP 標頭" #: ../../library/asyncio-stream.rst:491 msgid "" diff --git a/library/asyncio-sync.po b/library/asyncio-sync.po index f7068e20fe..b87d208824 100644 --- a/library/asyncio-sync.po +++ b/library/asyncio-sync.po @@ -155,7 +155,7 @@ msgid "" "Acquiring a lock is *fair*: the coroutine that proceeds will be the first " "coroutine that started waiting on the lock." msgstr "" -"鎖的獲取方式是\\ *公平*\\ 的:被處理的協程會是最早開始等待解鎖的那一個。" +"鎖的取得方式是\\ *公平*\\ 的:被處理的協程會是最早開始等待解鎖的那一個。" #: ../../library/asyncio-sync.rst:86 msgid "Release the lock." @@ -290,7 +290,7 @@ msgid "" msgstr "" "本質上,一個 Condition 物件會結合 :class:`Event` 和 :class:`Lock` 的功能。多" "個 Condition 物件共享一個 Lock 是有可能發生的,這能夠協調關注同一共享資源的不" -"同狀態以獲取其獨佔存取權的多個任務。" +"同狀態以取得其獨佔存取權的多個任務。" #: ../../library/asyncio-sync.rst:183 msgid "" @@ -328,7 +328,7 @@ msgstr "" #: ../../library/asyncio-sync.rst:212 msgid "Acquire the underlying lock." -msgstr "獲取底層的鎖。" +msgstr "取得底層的鎖。" #: ../../library/asyncio-sync.rst:214 msgid "" @@ -357,7 +357,7 @@ msgstr "" #: ../../library/asyncio-sync.rst:228 msgid "Return ``True`` if the underlying lock is acquired." -msgstr "如果已獲取底層的鎖則回傳 ``True``。" +msgstr "如果已取得底層的鎖則回傳 ``True``。" #: ../../library/asyncio-sync.rst:232 msgid "Wake up all tasks waiting on this condition." @@ -373,7 +373,7 @@ msgstr "釋放底層的鎖。" #: ../../library/asyncio-sync.rst:245 msgid "When invoked on an unlocked lock, a :exc:`RuntimeError` is raised." -msgstr "當調用於一個未被解開的鎖之上時,會引發一個 :exc:`RuntimeError`。" +msgstr "當叫用於一個未被解開的鎖之上時,會引發一個 :exc:`RuntimeError`。" #: ../../library/asyncio-sync.rst:250 msgid "Wait until notified." @@ -384,7 +384,7 @@ msgid "" "If the calling task has not acquired the lock when this method is called, a :" "exc:`RuntimeError` is raised." msgstr "" -"當此方法被呼叫時,如果呼叫它的任務還沒有獲取鎖的話,:exc:`RuntimeError` 會被" +"當此方法被呼叫時,如果呼叫它的任務還沒有取得鎖的話,:exc:`RuntimeError` 會被" "引發。" #: ../../library/asyncio-sync.rst:255 @@ -394,7 +394,7 @@ msgid "" "Condition re-acquires its lock and this method returns ``True``." msgstr "" "此方法會釋放底層的鎖,然後持續阻塞直到被 :meth:`notify` 或 :meth:" -"`notify_all` 的呼叫所喚醒。一但被喚醒,Condition 會重新獲取該鎖且此方法會回" +"`notify_all` 的呼叫所喚醒。一但被喚醒,Condition 會重新取得該鎖且此方法會回" "傳 ``True``。" #: ../../library/asyncio-sync.rst:260 @@ -475,7 +475,7 @@ msgstr "" #: ../../library/asyncio-sync.rst:317 msgid "Acquire a semaphore." -msgstr "獲取一個旗號。" +msgstr "取得一個旗號。" #: ../../library/asyncio-sync.rst:319 msgid "" @@ -495,7 +495,7 @@ msgid "" "Release a semaphore, incrementing the internal counter by one. Can wake up a " "task waiting to acquire the semaphore." msgstr "" -"釋放一個旗號,並為其內部的計數器數值增加一。可以把一個正在等待獲取旗號的任務" +"釋放一個旗號,並為其內部的計數器數值增加一。可以把一個正在等待取得旗號的任務" "叫醒。" #: ../../library/asyncio-sync.rst:332 @@ -672,5 +672,5 @@ msgid "" "removed. Use ``async with lock`` instead." msgstr "" "透過 ``await lock`` 或 ``yield from lock`` 和/或 :keyword:`with` 陳述式 " -"(``with await lock``, ``with (yield from lock)``) 來獲取鎖的方式已被移除。請" +"(``with await lock``, ``with (yield from lock)``) 來取得鎖的方式已被移除。請" "改用 ``async with lock``。" diff --git a/library/bisect.po b/library/bisect.po index 6e3bcf9931..c423cc4f89 100644 --- a/library/bisect.po +++ b/library/bisect.po @@ -38,7 +38,7 @@ msgid "" "searches or frequent resorting." msgstr "" "這個模組維護一個已經排序過的 list ,當我們每次做完插入後不需要再次排序整個 " -"list 。一個很長的 list 的比較操作很花費時間,可以透過線性搜索或頻繁地詢問來改" +"list 。一個很長的 list 的比較操作很花費時間,可以透過線性搜尋或頻繁地詢問來改" "善。" #: ../../library/bisect.rst:19 @@ -135,21 +135,21 @@ msgid "" "insertion point. Next, it runs the :meth:`!insert` method on *a* to insert " "*x* at the appropriate position to maintain sort order." msgstr "" -"此函式先使用 :py:func:`~bisect.bisect_left` 搜索插入位置,接著用 :meth:`!" +"此函式先使用 :py:func:`~bisect.bisect_left` 搜尋插入位置,接著用 :meth:`!" "insert` 於 *a* 以將 *x* 插入,並維持添加元素後的順序。" #: ../../library/bisect.rst:79 ../../library/bisect.rst:99 msgid "" "To support inserting records in a table, the *key* function (if any) is " "applied to *x* for the search step but not for the insertion step." -msgstr "此函式只有在搜索時會使用 *key* 函式,插入時不會。" +msgstr "此函式只有在搜尋時會使用 *key* 函式,插入時不會。" #: ../../library/bisect.rst:82 ../../library/bisect.rst:102 msgid "" "Keep in mind that the *O*\\ (log *n*) search is dominated by the slow *O*\\ " "(*n*) insertion step." msgstr "" -"注意雖然搜索是 *O*\\ (log *n*),但插入是 *O*\\ (*n*),因此此函式整體時間複雜" +"注意雖然搜尋是 *O*\\ (log *n*),但插入是 *O*\\ (*n*),因此此函式整體時間複雜" "度是 *O*\\ (*n*)。" #: ../../library/bisect.rst:92 @@ -166,7 +166,7 @@ msgid "" "insertion point. Next, it runs the :meth:`!insert` method on *a* to insert " "*x* at the appropriate position to maintain sort order." msgstr "" -"此函式先使用 :py:func:`~bisect.bisect_right` 搜索插入位置,接著用 :meth:`!" +"此函式先使用 :py:func:`~bisect.bisect_right` 搜尋插入位置,接著用 :meth:`!" "insert` 於 *a* 以將 *x* 插入,並維持添加元素後的順序。" #: ../../library/bisect.rst:110 @@ -186,7 +186,7 @@ msgid "" "Bisection is effective for searching ranges of values. For locating specific " "values, dictionaries are more performant." msgstr "" -"二分法在一段範圍的數值中做搜索的效率較佳,但若是要存取特定數值,使用字典的表" +"二分法在一段範圍的數值中做搜尋的效率較佳,但若是要存取特定數值,使用字典的表" "現還是比較好。" #: ../../library/bisect.rst:118 @@ -207,7 +207,7 @@ msgid "" "searching an array of precomputed keys to locate the insertion point (as " "shown in the examples section below)." msgstr "" -"搜索函式為無狀態的 (stateless),且鍵函式會在使用過後被丟棄。因此,如果搜索函" +"搜尋函式為無狀態的 (stateless),且鍵函式會在使用過後被丟棄。因此,如果搜尋函" "式被使用於迴圈當中,鍵函式會不斷被重複呼叫於相同的 list 元素。如果鍵函式執行" "速度不快,請考慮將其以 :py:func:`functools.cache` 包裝起來以減少重複的計算。" "另外,也可以透過搜尋預先計算好的鍵列表 (array of precomputed keys) 來定位插入" @@ -232,8 +232,8 @@ msgid "" msgstr "" "`SortedCollection recipe <https://code.activestate.com/recipes/577197-" "sortedcollection/>`_ 使用二分法來建立一個功能完整的集合類別 (collection " -"class) 並帶有符合直覺的搜索方法 (search methods) 與支援鍵函式。鍵會預先被計算" -"好,以減少搜索過程中多餘的鍵函式呼叫。" +"class) 並帶有符合直覺的搜尋方法 (search methods) 與支援鍵函式。鍵會預先被計算" +"好,以減少搜尋過程中多餘的鍵函式呼叫。" #: ../../library/bisect.rst:143 msgid "Searching Sorted Lists" @@ -366,7 +366,7 @@ msgid "" "If the key function is expensive, it is possible to avoid repeated function " "calls by searching a list of precomputed keys to find the index of a record::" msgstr "" -"如果鍵函式會消耗較多運算資源,那可以在預先計算好的鍵列表中搜索該紀錄的索引" +"如果鍵函式會消耗較多運算資源,那可以在預先計算好的鍵列表中搜尋該紀錄的索引" "值,以減少重複的函式呼叫: ::" #: ../../library/bisect.rst:240 diff --git a/library/calendar.po b/library/calendar.po index 02ae510536..906c87d523 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -835,7 +835,7 @@ msgstr "一週起始的日子。必須是 0(週一)到 6(週日)之間 #: ../../library/calendar.rst:668 msgid "The year to print the calendar for. Defaults to the current year." -msgstr "印出日曆的年份。預設為當前年份。" +msgstr "印出日曆的年份。預設為目前年份。" #: ../../library/calendar.rst:674 msgid "" diff --git a/library/collections.po b/library/collections.po index abc99d12e2..89f959dbcb 100644 --- a/library/collections.po +++ b/library/collections.po @@ -188,8 +188,8 @@ msgid "" "which mappings are searched. The list should always contain at least one " "mapping." msgstr "" -"一個可被更新的對映列表,這個列表是按照被搜索的順序來排列,在 ChainMap 中它是" -"唯一被儲存的狀態,可被修改來變換搜索順序。回傳的列表都至少包含一個對映。" +"一個可被更新的對映列表,這個列表是按照被搜尋的順序來排列,在 ChainMap 中它是" +"唯一被儲存的狀態,可被修改來變換搜尋順序。回傳的列表都至少包含一個對映。" #: ../../library/collections.rst:77 msgid "" @@ -201,7 +201,7 @@ msgid "" "or new empty dict. This method is used for creating subcontexts that can be " "updated without altering values in any of the parent mappings." msgstr "" -"回傳包含一個新對映的 :class:`ChainMap`, 新對映後面接著當前實例的所有現存對" +"回傳包含一個新對映的 :class:`ChainMap`, 新對映後面接著目前實例的所有現存對" "映。如果有給定 ``m``,``m`` 會成為那個最前面的新對映;若沒有指定,則會加上一" "個空 dict,如此一來呼叫 ``d.new_child()`` 就等同於 ``ChainMap({}, *d." "maps)``。這個方法用於建立子上下文,而保持父對映的不變。" @@ -224,7 +224,7 @@ msgid "" "reference to ``d.parents`` is equivalent to: ``ChainMap(*d.maps[1:])``." msgstr "" "回傳一個包含除了第一個以外所有其他對映的新 :class:`ChainMap` 的特性,可用於需" -"要跳過第一個對映的搜索。使用情境類似於在\\ :term:`巢狀作用域 <nested " +"要跳過第一個對映的搜尋。使用情境類似於在\\ :term:`巢狀作用域 <nested " "scope>`\\ 當中使用 :keyword:`nonlocal` 關鍵字,也可與內建函式 :func:`super` " "做類比。引用 ``d.parents`` 等同於 ``ChainMap(*d.maps[1:])``。" @@ -1059,7 +1059,7 @@ msgid "" msgstr "" "一個\\ `輪詢調度器 <https://en.wikipedia.org/wiki/Round-" "robin_scheduling>`_\\ 可以透過在 :class:`deque` 中放入 iterator 來實現,值自" -"當前 iterator 的位置 0 取出,如果 iterator 已經消耗完畢就用 :meth:`~deque." +"目前 iterator 的位置 0 取出,如果 iterator 已經消耗完畢就用 :meth:`~deque." "popleft` 將其從佇列中移除,否則利用 :meth:`~deque.rotate` 來將其移至佇列尾" "端: ::" @@ -1304,7 +1304,7 @@ msgid "" msgstr "" "回傳一個名為 *typename* 的新 tuple 子類別。這個新的子類別被用於建立類似 " "tuple 的物件,可以透過屬性名稱來存取欄位,它同時也是可索引 (indexable) 和可疊" -"代的 (iterable)。子類別實例同樣有文件字串 (docstring)(有類別名 typename 和欄" +"代的 (iterable)。子類別實例同樣有文件字串 (docstring)(有類別名稱 typename 和欄" "位名 field_names)和一個好用的 :meth:`__repr__` 方法,可將 tuple 內容以 " "``name=value`` 格式列出。" diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index 8bec6881d5..74a22d8a80 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -154,7 +154,7 @@ msgid "" "submit` and :meth:`Executor.map` made after shutdown will raise :exc:" "`RuntimeError`." msgstr "" -"向 executor 發出訊號 (signal),表明它應該在當前未定 (pending) 的 future 完成" +"向 executor 發出訊號 (signal),表明它應該在目前未定 (pending) 的 future 完成" "執行時釋放它正在使用的任何資源。在關閉後呼叫 :meth:`Executor.submit` 和 :" "meth:`Executor.map` 將引發 :exc:`RuntimeError`。" @@ -311,7 +311,7 @@ msgid "" msgstr "" "*initializer* 是一個可選的可呼叫物件,在每個工作執行緒開始時呼叫; " "*initargs* 是傳遞給 initializer 的引數元組 (tuple)。如果 *initializer* 引發例" -"外,所有當前未定的作業以及任何向池中提交 (submit) 更多作業的嘗試都將引發 :" +"外,所有目前未定的作業以及任何向池中提交 (submit) 更多作業的嘗試都將引發 :" "exc:`~concurrent.futures.thread.BrokenThreadPool`。" #: ../../library/concurrent.futures.rst:166 @@ -473,7 +473,7 @@ msgid "" msgstr "" "*initializer* 是一個可選的可呼叫物件,在每個工作行程 (worker process) 開始時" "呼叫;*initargs* 是傳遞給 initializer 的引數元組。如果 *initializer* 引發例" -"外,所有當前未定的作業以及任何向池中提交更多作業的嘗試都將引發 :exc:" +"外,所有目前未定的作業以及任何向池中提交更多作業的嘗試都將引發 :exc:" "`~concurrent.futures.process.BrokenProcessPool`。" #: ../../library/concurrent.futures.rst:268 @@ -649,7 +649,7 @@ msgid "" "``False``, otherwise the call will be cancelled and the method will return " "``True``." msgstr "" -"嘗試取消呼叫。如果呼叫當前正在執行或已完成運行且無法取消,則該方法將回傳 " +"嘗試取消呼叫。如果呼叫目前正在執行或已完成運行且無法取消,則該方法將回傳 " "``False``,否則呼叫將被取消並且該方法將回傳 ``True``。" #: ../../library/concurrent.futures.rst:374 @@ -927,7 +927,7 @@ msgstr "" msgid "" "Raised when an operation is performed on a future that is not allowed in the " "current state." -msgstr "當前狀態下不允許的 future 操作被執行時而引發。" +msgstr "目前狀態下不允許的 future 操作被執行時而引發。" #: ../../library/concurrent.futures.rst:572 msgid "" diff --git a/library/copy.po b/library/copy.po index 71812c86b4..9a072ea439 100644 --- a/library/copy.po +++ b/library/copy.po @@ -118,7 +118,7 @@ msgstr ":func:`deepcopy` 函式用以下方式避免了這些問題:" msgid "" "keeping a ``memo`` dictionary of objects already copied during the current " "copying pass; and" -msgstr "保留在當前複製過程中已複製的物件的 ``memo`` 字典;以及" +msgstr "保留在目前複製過程中已複製的物件的 ``memo`` 字典;以及" #: ../../library/copy.rst:67 msgid "" diff --git a/library/csv.po b/library/csv.po index afc879deaf..106f364d77 100644 --- a/library/csv.po +++ b/library/csv.po @@ -233,7 +233,7 @@ msgid "" "Returns the current maximum field size allowed by the parser. If *new_limit* " "is given, this becomes the new limit." msgstr "" -"回傳當前的剖析器 (parser) 允許的最大字串大小。如果 *new_limit* 被給定,則會變" +"回傳目前的剖析器 (parser) 允許的最大字串大小。如果 *new_limit* 被給定,則會變" "成新的最大字串大小。" #: ../../library/csv.rst:148 @@ -549,8 +549,8 @@ msgid "" "character. If *escapechar* is not set, the writer will raise :exc:`Error` " "if any characters that require escaping are encountered." msgstr "" -"引導 :class:`writer` 物件不得引用欄位。當前的 *分隔符號* 出現在輸出資料時,在" -"他之前的字元是當前的\\*逸出字元 (escape character)*。如果沒有設定\\*逸出字元" +"引導 :class:`writer` 物件不得引用欄位。目前的 *分隔符號* 出現在輸出資料時,在" +"他之前的字元是目前的\\*逸出字元 (escape character)*。如果沒有設定\\*逸出字元" "*\\,若遇到任何字元需要逸出,寫入器則會引發 :exc:`Error` 。" #: ../../library/csv.rst:344 @@ -742,7 +742,7 @@ msgid "" "should call this as ``next(reader)``." msgstr "" "回傳一個列表為讀入器的可疊代物件的下一列內容(若該物件是由 :func:`reader` 回" -"傳)或是一個 dict(若為 :class:`DictReader` 實例),會依據當前的 :class:" +"傳)或是一個 dict(若為 :class:`DictReader` 實例),會依據目前的 :class:" "`Dialect` 進行剖析。通常會用 ``next(reader)`` 來進行呼叫。" #: ../../library/csv.rst:474 @@ -799,7 +799,7 @@ msgid "" "to the current :class:`Dialect`. Return the return value of the call to the " "*write* method of the underlying file object." msgstr "" -"將參數 *row* 寫入至寫入器的檔案物件中,並依照當前的 :class:`Dialect` 進行格式" +"將參數 *row* 寫入至寫入器的檔案物件中,並依照目前的 :class:`Dialect` 進行格式" "化。回傳下層檔案物件 *write* 方法的回傳值。" #: ../../library/csv.rst:515 @@ -813,7 +813,7 @@ msgid "" "dialect." msgstr "" "將 *rows* 中所有元素(為上述的一個可疊代的 *row* 物件)寫入至寫入器的檔案物件" -"中,並依照當前的 dialect 進行格式化。" +"中,並依照目前的 dialect 進行格式化。" #: ../../library/csv.rst:524 msgid "Writer objects have the following public attribute:" @@ -834,7 +834,7 @@ msgid "" "return value of the :meth:`csvwriter.writerow` call used internally." msgstr "" "將具欄位標題的一列(於建構函式 (constructor) 中指定的)寫入至寫入器的檔案物件" -"中,並依照當前的 dialect 進行格式化。回傳內部呼叫 :meth:`csvwriter.writerow` " +"中,並依照目前的 dialect 進行格式化。回傳內部呼叫 :meth:`csvwriter.writerow` " "的回傳值。" #: ../../library/csv.rst:542 diff --git a/library/dataclasses.po b/library/dataclasses.po index f6f692492e..8edd9a1fdb 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -267,7 +267,7 @@ msgid "" msgstr "" "預設情況下,``@dataclass`` 不會隱式新增 :meth:`~object.__hash__` 方法,除非這" "樣做是安全的。它也不會新增或更改現有的明確定義的 :meth:`!__hash__` 方法。設定" -"類屬性 ``__hash__ = None`` 對 Python 具有特定含義,如 :meth:`!__hash__` 文檔" +"類屬性 ``__hash__ = None`` 對 Python 具有特定含義,如 :meth:`!__hash__` 文件" "中所述。" #: ../../library/dataclasses.rst:140 @@ -1156,7 +1156,7 @@ msgstr "" "不可能建立真正不可變的 Python 物件。但是,通過將 ``frozen=True`` 傳遞給 :" "func:`@dataclass <dataclass>` 裝飾器,你可以模擬不變性。在這種情況下,資料類" "別將向類新增 :meth:`~object.__setattr__` 和 :meth:`~object.__delattr__` 方" -"法。這些方法在呼叫時會引發 :exc:`FrozenInstanceError`。" +"法。這些方法在叫用時會引發 :exc:`FrozenInstanceError`。" #: ../../library/dataclasses.rst:631 #, fuzzy @@ -1467,7 +1467,7 @@ msgid "" "`~object.__get__` or :meth:`!__set__` method is called rather than returning " "or overwriting the descriptor object." msgstr "" -"同樣,在獲取或設定欄位時,將呼叫描述器的 :meth:`~object.__get__` 或 :meth:`!" +"同樣,在取得或設定欄位時,將呼叫描述器的 :meth:`~object.__get__` 或 :meth:`!" "__set__` 方法,而不是回傳或覆蓋描述器物件。" #: ../../library/dataclasses.rst:800 @@ -1480,7 +1480,7 @@ msgid "" "default. On the other hand, if the descriptor raises :exc:`AttributeError` " "in this situation, no default value will be provided for the field." msgstr "" -"為了確定一個欄位是否包含預設值,:func:`@dataclass <dataclass>` 將使用其類訪問" +"為了確定一個欄位是否包含預設值,:func:`@dataclass <dataclass>` 將使用其類存取" "形式呼叫描述器的 :meth:`!__get__` 方法(即 ``descriptor.__get__(obj=None, " "type=cls)``。如果在這種情況下,描述器回傳一個值,它將用作欄位的預設值。另一方" "面,如果描述器在這種情況下引發 :exc:`AttributeError`,則不會為該欄位提供預設" diff --git a/library/ensurepip.po b/library/ensurepip.po index ada8cd86dc..04b427e687 100644 --- a/library/ensurepip.po +++ b/library/ensurepip.po @@ -47,7 +47,7 @@ msgid "" "needed if installing ``pip`` was skipped when installing Python (or when " "creating a virtual environment) or after explicitly uninstalling ``pip``." msgstr "" -"大多數情況下,Python 的終端使用者不需要直接調用此模組(因為 ``pip`` 預設應為" +"大多數情況下,Python 的終端使用者不需要直接叫用此模組(因為 ``pip`` 預設應為" "初始建置),但若安裝 Python 時 ``pip`` 被省略(或建立一虛擬環境時),又或是 " "``pip`` 被明確解除安裝時,則此模組的初始建置仍有可能用上。" @@ -94,11 +94,11 @@ msgstr "命令列介面" #: ../../library/ensurepip.rst:46 msgid "" "The command line interface is invoked using the interpreter's ``-m`` switch." -msgstr "使用直譯器 (interpreter) 的 ``-m`` 來調用命令列介面" +msgstr "使用直譯器 (interpreter) 的 ``-m`` 來叫用命令列介面" #: ../../library/ensurepip.rst:48 msgid "The simplest possible invocation is::" -msgstr "最簡單可行的調用: ::" +msgstr "最簡單可行的呼叫: ::" #: ../../library/ensurepip.rst:50 msgid "python -m ensurepip" @@ -111,8 +111,8 @@ msgid "" "least as recent as the one available in ``ensurepip``, pass the ``--" "upgrade`` option::" msgstr "" -"若 ``pip`` 未安裝,此調用會將其安裝;否則甚麼也不做。可透過傳入 ``--" -"upgrade`` 參數來確保 ``pip`` 的安裝版本至少為當前 ``ensurepip`` 中最新可用的" +"若 ``pip`` 未安裝,此呼叫會將其安裝;否則甚麼也不做。可透過傳入 ``--" +"upgrade`` 參數來確保 ``pip`` 的安裝版本至少為目前 ``ensurepip`` 中最新可用的" "版本: ::" #: ../../library/ensurepip.rst:57 @@ -126,7 +126,7 @@ msgid "" "virtual environment). The installation location can be controlled through " "two additional command line options:" msgstr "" -"預設上,``pip`` 會被安裝至當前虛擬環境(若已啟動虛擬環境)或系統端的套件(若" +"預設上,``pip`` 會被安裝至目前虛擬環境(若已啟動虛擬環境)或系統端的套件(若" "沒有啟動的虛擬環境)。安裝位置可透過兩個額外的命令列選項來控制:" #: ../../library/ensurepip.rst:64 @@ -136,7 +136,7 @@ msgid "" "the default root for the current Python installation." msgstr "" "``--root <dir>``:安裝 ``pip`` 到給定的根目錄 (root directory) 的相對路徑,而" -"不是當前虛擬環境(若存在)的根目錄,或當前 Python 安裝版所預設的根目錄。" +"不是目前虛擬環境(若存在)的根目錄,或目前 Python 安裝版所預設的根目錄。" #: ../../library/ensurepip.rst:67 msgid "" @@ -144,7 +144,7 @@ msgid "" "than globally for the current Python installation (this option is not " "permitted inside an active virtual environment)." msgstr "" -"``--user`` :安裝 ``pip`` 到使用者端的套件目錄,而不是全域安裝到當前的 " +"``--user`` :安裝 ``pip`` 到使用者端的套件目錄,而不是全域安裝到目前的 " "Python 安裝版(此選項不允許在一啟動的虛擬環境中使用)。" #: ../../library/ensurepip.rst:71 @@ -153,7 +153,7 @@ msgid "" "stands for the version of Python used to invoke ``ensurepip``). The scripts " "installed can be controlled through two additional command line options:" msgstr "" -"預設會安裝 ``pipX`` 和 ``pipX.Y`` 腳本(X.Y 代表用來調用 ``ensurepip`` 的 " +"預設會安裝 ``pipX`` 和 ``pipX.Y`` 腳本(X.Y 代表用來叫用 ``ensurepip`` 的 " "Python 之版本)。安裝的腳本可透過兩個額外的命令列選項來控制:" #: ../../library/ensurepip.rst:76 @@ -192,7 +192,7 @@ msgstr "回傳一個字串,用以標明初始建置時,安裝的 pip 的可 #: ../../library/ensurepip.rst:99 msgid "Bootstraps ``pip`` into the current or designated environment." -msgstr "在當前或指定的環境之中建立 ``pip``。" +msgstr "在目前或指定的環境之中建立 ``pip``。" #: ../../library/ensurepip.rst:101 msgid "" @@ -201,7 +201,7 @@ msgid "" "the current environment." msgstr "" "*root* 指定一個替代的根目錄,作為安裝的相對路徑。若 *root* 為 ``None``,則安" -"裝使用當前環境的預設安裝位置。" +"裝使用目前環境的預設安裝位置。" #: ../../library/ensurepip.rst:105 msgid "" @@ -219,7 +219,7 @@ msgstr "*user* 指出是否要使用使用者的安裝方案而不是全域安 msgid "" "By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where X.Y " "stands for the current version of Python)." -msgstr "預設會安裝 ``pipX`` 和 ``pipX.Y`` 腳本(X.Y 代表 Python 的當前版本)。" +msgstr "預設會安裝 ``pipX`` 和 ``pipX.Y`` 腳本(X.Y 代表 Python 的目前版本)。" #: ../../library/ensurepip.rst:114 msgid "If *altinstall* is set, then ``pipX`` will *not* be installed." @@ -258,7 +258,7 @@ msgid "" "allows these side effects to be avoided." msgstr "" "初始建置的過程對於 ``sys.path`` 及 ``os.environ`` 均有副作用。改為在一子行程 " -"(subprocess) 調用命令列介面可避免這些副作用。" +"(subprocess) 呼叫命令列介面可避免這些副作用。" #: ../../library/ensurepip.rst:135 msgid "" diff --git a/library/ftplib.po b/library/ftplib.po index 15641cfa55..ee1c0a319e 100644 --- a/library/ftplib.po +++ b/library/ftplib.po @@ -455,7 +455,7 @@ msgid "" "but server is not guaranteed to return all requested facts." msgstr "" "使用 ``MLSD`` 命令 (:rfc:`3659`) 列出標準格式的目錄。如果省略 *path* 則假定為" -"作用於當前目錄。*facts* 是表示所需資訊類型的字串列表(例如 ``[\"type\", " +"作用於目前目錄。*facts* 是表示所需資訊類型的字串列表(例如 ``[\"type\", " "\"size\", \"perm\"]`` )。會回傳一個產生器物件,為每個在路徑中找到的檔案生成" "一個包含兩個元素的元組,第一個元素是檔案名稱,第二個元素是包含有關檔案名稱 " "facts的字典。該字典的內容可能受 *facts* 引數限制,但不保證伺服器會回傳所有請" @@ -469,7 +469,7 @@ msgid "" "the ``NLST`` command." msgstr "" "回傳由 ``NLST`` 命令回傳的檔案名稱列表。可選的 *argument* 是要列出的目錄(預" -"設為當前伺服器目錄)。多個引數可用於將非標準選項傳遞給 ``NLST`` 命令。" +"設為目前伺服器目錄)。多個引數可用於將非標準選項傳遞給 ``NLST`` 命令。" #: ../../library/ftplib.rst:373 ../../library/ftplib.rst:385 msgid "If your server supports the command, :meth:`mlsd` offers a better API." @@ -485,7 +485,7 @@ msgid "" "default prints to :data:`sys.stdout`. This method returns ``None``." msgstr "" "生成由 ``LIST`` 命令回傳的目錄列表,並將其印出到標準輸出 (standard output)。" -"可選的 *argument* 是要列出的目錄(預設為當前伺服器目錄)。有多個引數可用於將" +"可選的 *argument* 是要列出的目錄(預設為目前伺服器目錄)。有多個引數可用於將" "非標準選項傳遞給 ``LIST`` 命令。如果最後一個引數是一個函式,它被用作 :meth:" "`retrlines` 的 *callback* 函式;預設印出到 :data:`sys.stdout`。此方法回傳 " "``None``。" @@ -505,7 +505,7 @@ msgstr "" #: ../../library/ftplib.rst:402 msgid "Set the current directory on the server." -msgstr "設定伺服器上的當前目錄。" +msgstr "設定伺服器上的目前目錄。" #: ../../library/ftplib.rst:407 msgid "Create a new directory on the server." @@ -513,7 +513,7 @@ msgstr "在伺服器上建立一個新目錄。" #: ../../library/ftplib.rst:412 msgid "Return the pathname of the current directory on the server." -msgstr "回傳伺服器上當前目錄的路徑名。" +msgstr "回傳伺服器上目前目錄的路徑名。" #: ../../library/ftplib.rst:417 msgid "Remove the directory named *dirname* on the server." diff --git a/library/functions.po b/library/functions.po index aec90b86d9..0ebf226880 100644 --- a/library/functions.po +++ b/library/functions.po @@ -517,7 +517,7 @@ msgstr "如果不一定需要 \"0b\" 前綴,還可以使用如下的方法。" #: ../../library/functions.rst:141 ../../library/functions.rst:942 #: ../../library/functions.rst:1323 msgid "See also :func:`format` for more information." -msgstr "可參考 :func:`format` 獲取更多資訊。" +msgstr "可參考 :func:`format` 取得更多資訊。" #: ../../library/functions.rst:146 msgid "" @@ -1070,7 +1070,7 @@ msgid "" "With an argument, attempt to return a list of valid attributes for that " "object." msgstr "" -"如果沒有引數,則回傳當前區域作用域 (local scope) 中的名稱列表。如果有引數,它" +"如果沒有引數,則回傳目前區域作用域 (local scope) 中的名稱列表。如果有引數,它" "會嘗試回傳該物件的有效屬性列表。" #: ../../library/functions.rst:483 @@ -1287,7 +1287,7 @@ msgid "" "pass around for use by :func:`eval` or :func:`exec`." msgstr "" "提示::func:`exec` 函式支援動態執行陳述式。:func:`globals` 和 :func:`locals` " -"函式分別回傳當前的全域性和局部性 dictionary,它們對於將引數傳遞給 :func:" +"函式分別回傳目前的全域性和局部性 dictionary,它們對於將引數傳遞給 :func:" "`eval` 或 :func:`exec` 可能會方便許多。" #: ../../library/functions.rst:628 @@ -1353,7 +1353,7 @@ msgid "" "any mapping object. Remember that at the module level, globals and locals " "are the same dictionary." msgstr "" -"無論哪種情況,如果省略了選擇性的部分,程式碼將在當前作用域內執行。如果只提供" +"無論哪種情況,如果省略了選擇性的部分,程式碼將在目前作用域內執行。如果只提供" "了 *globals* 引數,就必須是 dictionary 型別(且不能是 dictionary 的子類別)," "而且會被用作全域和區域變數。如果同時提供了 *globals* 和 *locals*,它們分別被" "用作全域和區域變數。如果提供了 *locals*,則它可以是任何對映物件。請記住在 " @@ -1399,7 +1399,7 @@ msgid "" "global and local namespace, respectively, which may be useful to pass around " "for use as the second and third argument to :func:`exec`." msgstr "" -"內建 :func:`globals` 和 :func:`locals` 函式各自回傳當前的全域和區域命名空間," +"內建 :func:`globals` 和 :func:`locals` 函式各自回傳目前的全域和區域命名空間," "因此可以將它們傳遞給 :func:`exec` 的第二個和第三個引數以供後續使用。" #: ../../library/functions.rst:709 @@ -1623,7 +1623,7 @@ msgid "" "within functions, this is set when the function is defined and remains the " "same regardless of where the function is called." msgstr "" -"回傳代表當前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義" +"回傳代表目前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義" "函式時設定且不論該函式是在何處呼叫都會保持相同。" #: ../../library/functions.rst:880 @@ -1667,7 +1667,7 @@ msgid "" msgstr "" "啟動內建的幫助系統(此函式主要以互動式使用)。如果沒有引數,直譯器控制台裡會" "啟動互動式幫助系統。如果引數是一個字串,則會在 module、函式、class、method、" -"關鍵字或說明文件主題中搜索該字串,並在控制台上列印幫助資訊。如果引數是其他任" +"關鍵字或說明文件主題中搜尋該字串,並在控制台上列印幫助資訊。如果引數是其他任" "意物件,則會生成該物件的幫助頁。" #: ../../library/functions.rst:909 @@ -1724,7 +1724,7 @@ msgid "" "To obtain a hexadecimal string representation for a float, use the :meth:" "`float.hex` method." msgstr "" -"如果要獲取浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" +"如果要取得浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" #: ../../library/functions.rst:955 msgid "" @@ -1888,7 +1888,7 @@ msgid "" "<object.__int__>` instead of :meth:`base.__index__ <object.__index__>`." msgstr "" "如果 *base* 不是 :class:`int` 的實例,但 *base* 物件有 :meth:`base.__index__ " -"<object.__index__>` method,則會呼叫該 method 來獲取此進位制所需的整數。以前" +"<object.__index__>` method,則會呼叫該 method 來取得此進位制所需的整數。以前" "的版本使用 :meth:`base.__int__ <object.__int__>` 而不是 :meth:`base." "__index__ <object.__index__>`。" @@ -2124,7 +2124,7 @@ msgid "" msgstr "" "產生一個將 *function* 應用於 *iterable* 中所有元素,並收集回傳結果的 " "iterator。如果傳遞了額外的 *iterables* 引數,則 *function* 必須接受相同個數的" -"引數,並使用所有從 iterables 中同時獲取的元素。當有多個 iterables 時,最短的 " +"引數,並使用所有從 iterables 中同時取得的元素。當有多個 iterables 時,最短的 " "iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經被編排為引數的 tuple," "請參閱 :func:`itertools.starmap`。" @@ -2215,7 +2215,7 @@ msgid "" "`~iterator.__next__` method. If *default* is given, it is returned if the " "iterator is exhausted, otherwise :exc:`StopIteration` is raised." msgstr "" -"透過呼叫 :term:`iterator` 的 :meth:`~iterator.__next__` method 獲取下一個元" +"透過呼叫 :term:`iterator` 的 :meth:`~iterator.__next__` method 取得下一個元" "素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引發 :" "exc:`StopIteration`。" @@ -2276,7 +2276,7 @@ msgid "" "is set to ``False``.)" msgstr "" "*file* 是一個\\ :term:`類路徑物件 <path-like object>`,是將被開啟之檔案的路徑" -"(絕對路徑或當前工作目錄的相對路徑),或是要被包裝 (wrap) 檔案的整數檔案描述" +"(絕對路徑或目前工作目錄的相對路徑),或是要被包裝 (wrap) 檔案的整數檔案描述" "器 (file descriptor)。(如果有給定檔案描述器,它會隨著回傳的 I/O 物件關閉而關" "閉,除非 *closefd* 被設為 ``False``。)" @@ -2296,9 +2296,9 @@ msgstr "" "*mode* 是一個選擇性字串,用於指定開啟檔案的模式。預設值是 ``'r'``,這意味著它" "以文字模式開啟並讀取。其他常見模式有:寫入 ``'w'``\\ (會捨去已經存在的檔" "案)、唯一性建立 ``'x'``、追加寫入 ``'a'``\\ (在\\ *一些* Unix 系統上,無論" -"當前的檔案指標在什麼位置,*所有* 寫入都會追加到檔案末尾)。在文字模式,如果沒" +"目前的檔案指標在什麼位置,*所有* 寫入都會追加到檔案末尾)。在文字模式,如果沒" "有指定 *encoding*,則根據電腦平臺來決定使用的編碼:呼叫 :func:`locale." -"getencoding` 來獲取當前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制模" +"getencoding` 來取得目前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制模" "式且不要指定 *encoding*。)可用的模式有:" #: ../../library/functions.rst:1357 @@ -2903,8 +2903,8 @@ msgid "" "If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = " "value`` will invoke the setter, and ``del c.x`` the deleter." msgstr "" -"如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會呼叫取得器 (getter),``c.x = " -"value`` 會呼叫設定器 (setter),而 ``del c.x`` 會呼叫刪除器 (deleter)。" +"如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會叫用取得器 (getter),``c.x = " +"value`` 會呼叫設定器 (setter),而 ``del c.x`` 會叫用刪除器 (deleter)。" #: ../../library/functions.rst:1656 msgid "" @@ -3929,7 +3929,7 @@ msgstr "builtins(內建)" #~ "function blocks, but not in class blocks. Note that at the module level, :" #~ "func:`locals` and :func:`globals` are the same dictionary." #~ msgstr "" -#~ "更新並回傳表示當前本地符號表的 dictionary。在函式區塊而不是 class 區塊中呼" +#~ "更新並回傳表示目前本地符號表的 dictionary。在函式區塊而不是 class 區塊中呼" #~ "叫 :func:`locals` 時會回傳自由變數。請注意,在 module 階層中,:func:" #~ "`locals` 和 :func:`globals` 是相同的 dictionary。" diff --git a/library/gc.po b/library/gc.po index dd5103866b..78ce3ab4e8 100644 --- a/library/gc.po +++ b/library/gc.po @@ -101,7 +101,7 @@ msgstr "" #: ../../library/gc.rst:66 msgid "Return the debugging flags currently set." -msgstr "回傳當前設置的除錯旗標。" +msgstr "回傳目前設置的除錯旗標。" #: ../../library/gc.rst:71 msgid "" @@ -191,14 +191,14 @@ msgstr "" msgid "" "Return the current collection counts as a tuple of ``(count0, count1, " "count2)``." -msgstr "將當前回收計數以 ``(count0, count1, count2)`` 形式的 tuple 回傳。" +msgstr "將目前回收計數以 ``(count0, count1, count2)`` 形式的 tuple 回傳。" #: ../../library/gc.rst:127 msgid "" "Return the current collection thresholds as a tuple of ``(threshold0, " "threshold1, threshold2)``." msgstr "" -"將當前回收閾值以 ``(threshold0, threshold1, threshold2)`` 形式的 tuple 回傳。" +"將目前回收閾值以 ``(threshold0, threshold1, threshold2)`` 形式的 tuple 回傳。" #: ../../library/gc.rst:133 msgid "" @@ -218,7 +218,7 @@ msgid "" "call :func:`collect` before calling :func:`get_referrers`." msgstr "" "需要注意的是,已經解除參照的物件,但仍存在於參照迴圈中未被回收時,該物件仍然" -"會被作為參照者出現在回傳的 list 中。若只要獲取當前正在參照的物件,需要在呼" +"會被作為參照者出現在回傳的 list 中。若只要取得目前正在參照的物件,需要在呼" "叫 :func:`get_referrers` 之前呼叫 :func:`collect`。" #: ../../library/gc.rst:144 @@ -252,9 +252,9 @@ msgid "" "object may or may not appear in the result list." msgstr "" "回傳包含被任意一個引數直接參照之物件的 list。回傳的被參照物件是有被引數的 C " -"語言級別 :c:member:`~PyTypeObject.tp_traverse` 方法(若存在)訪問到的物件,可" +"語言級別 :c:member:`~PyTypeObject.tp_traverse` 方法(若存在)瀏覽到的物件,可" "能不是所有的實際直接可達物件。只有支援垃圾回收的物件支援 :c:member:" -"`~PyTypeObject.tp_traverse` 方法,並且此方法只會訪問涉及參照迴圈的物件。因" +"`~PyTypeObject.tp_traverse` 方法,並且此方法只會瀏覽涉及參照迴圈的物件。因" "此,可以有以下例子:一個整數對於一個引數是直接可達的,這個整數物件有可能出現" "或不出現在結果的 list 當中。" @@ -429,7 +429,7 @@ msgid "" "after collection. The callbacks will be called with two arguments, *phase* " "and *info*." msgstr "" -"會被垃圾回收器在回收開始前和完成後呼叫的一系列回呼函式 (callback) 。這些回呼" +"會被垃圾回收器在回收開始前和完成後叫用的一系列回呼函式 (callback) 。這些回呼" "函式在被呼叫時附帶兩個引數:*phase* 和 *info*。" #: ../../library/gc.rst:271 diff --git a/library/glob.po b/library/glob.po index 287f0efe19..610ddefb58 100644 --- a/library/glob.po +++ b/library/glob.po @@ -39,7 +39,7 @@ msgstr "" ":mod:`glob` 模組根據 Unix shell 使用的規則查找與指定模式匹配的所有路徑名稱," "結果以任意順序回傳。沒有波浪號 (tilde) 擴展,但是 ``*``、``?`` 和用 ``[]`` 表" "示的字元範圍將被正確匹配。這是透過同時使用 :func:`os.scandir` 和 :func:" -"`fnmatch.fnmatch` 函式來完成的,而沒有實際調用 subshell。" +"`fnmatch.fnmatch` 函式來完成的,而沒有實際呼叫 subshell。" #: ../../library/glob.rst:28 msgid "" @@ -89,8 +89,8 @@ msgid "" "func:`glob` as changing the current directory before calling it. If " "*pathname* is relative, the result will contain paths relative to *root_dir*." msgstr "" -"如果 *root_dir* 不是 ``None``,它應該是一個指定搜索根目錄的 :term:`path-like " -"object`。它在呼叫它之前更改當前目錄的影響與 :func:`glob` 相同。如果 " +"如果 *root_dir* 不是 ``None``,它應該是一個指定搜尋根目錄的 :term:`path-like " +"object`。它在呼叫它之前更改目前目錄的影響與 :func:`glob` 相同。如果 " "*pathname* 是相對的,結果將包含相對於 *root_dir* 的路徑。" #: ../../library/glob.rst:58 diff --git a/library/hashlib.po b/library/hashlib.po index e7b2a5de94..a70a88e0dd 100644 --- a/library/hashlib.po +++ b/library/hashlib.po @@ -167,7 +167,7 @@ msgid "" "To obtain the digest of the byte string ``b\"Nobody inspects the spammish " "repetition\"``::" msgstr "" -"獲取位元組字串 ``b\"Nobody inspects the spammish repetition\"`` 的摘要: ::" +"取得位元組字串 ``b\"Nobody inspects the spammish repetition\"`` 的摘要: ::" #: ../../library/hashlib.rst:105 msgid "" @@ -830,7 +830,7 @@ msgid "" "This example shows how to get a (hex-encoded) 128-bit authentication code " "for message ``b'message data'`` with key ``b'pseudorandom key'``::" msgstr "" -"此範例示範了如何使用密鑰 ``b'pseudorandom key'`` 獲取訊息 ``b'message " +"此範例示範了如何使用密鑰 ``b'pseudorandom key'`` 取得訊息 ``b'message " "data'`` 的(十六進位編碼)128 位元驗證碼: ::" #: ../../library/hashlib.rst:585 @@ -968,7 +968,7 @@ msgstr "" "方(訊息簽名者)簽名。如果訊息準備者能夠發現加密雜湊函式發生碰撞(collision," "即兩條訊息產生相同的雜湊值),那麼他們可能會準備有意義的訊息版本,該版本將產" "生相同的雜湊值和數位簽章,但結果不同(例如,將 $1,000,000 轉入賬戶,而不是 " -"$10)。加密雜湊函式的設計以抗碰撞性為主要目標,但當前對加密雜湊函式攻擊的關注" +"$10)。加密雜湊函式的設計以抗碰撞性為主要目標,但目前對加密雜湊函式攻擊的關注" "可能會導致給定的加密雜湊函式所提供的抗碰撞性低於預期。隨機雜湊透過降低準備者" "在數位簽章生成過程中生成最終產生相同雜湊值的兩個或多個訊息的可能性,為簽名者" "提供額外的保護 —— 即便嘗試去找到雜湊函式碰撞的發生是實際可行的。然而,若訊息" diff --git a/library/heapq.po b/library/heapq.po index 859f7606c5..e475cd285a 100644 --- a/library/heapq.po +++ b/library/heapq.po @@ -566,7 +566,7 @@ msgstr "" "序涉及 \"runs\" 的產生(也就是預先排序的序列,其大小通常與 CPU 記憶體的大小有" "關),之後再對這些 run 合併,而這些合併的過程通常相當巧妙 [#]_。很重要的一點" "是,初始排序產生的 run 越長越好。錦標賽是達成這一點的好方法,若你用所有可用記" -"憶體來舉行一場錦標賽,並透過替換與向下交換來處理所有適配當前 run 的值,那麼對" +"憶體來舉行一場錦標賽,並透過替換與向下交換來處理所有適配目前 run 的值,那麼對" "於隨機產生的輸入,將可以產生長度兩倍於記憶體大小的 run。對於已模糊排序過的輸" "入,效果更好。" @@ -580,7 +580,7 @@ msgid "" "the first heap is melting. When the first heap completely vanishes, you " "switch heaps and start a new run. Clever and quite effective!" msgstr "" -"此外,若你將索引為 0 的項目輸出至磁碟,並取得一個無法適配當前錦標賽的輸入(因" +"此外,若你將索引為 0 的項目輸出至磁碟,並取得一個無法適配目前錦標賽的輸入(因" "為該值「勝過」最後的輸出值),則該輸入值就無法插入至 heap 當中,因此 heap 的" "大小會減小。釋放出來的記憶體可以巧妙地立即再被運用,逐步建構出第二個 heap,其" "大小增加的速度會與第一個 heap 減少的速度一致。當第一個 heap 完全消失時,你可" diff --git a/library/hmac.po b/library/hmac.po index 96c143d75c..cbad165573 100644 --- a/library/hmac.po +++ b/library/hmac.po @@ -109,7 +109,7 @@ msgid "" "given to the constructor. It may contain non-ASCII bytes, including NUL " "bytes." msgstr "" -"回傳當前已傳給 :meth:`update` 方法的 bytes 摘要。這個 bytes 物件的長度會與傳" +"回傳目前已傳給 :meth:`update` 方法的 bytes 摘要。這個 bytes 物件的長度會與傳" "給建構函式的摘要 *digest_size* 的長度相同。它可以包含 NUL bytes 以及 non-" "ASCII bytes。" @@ -200,8 +200,8 @@ msgid "" "attack could theoretically reveal information about the types and lengths of " "*a* and *b*—but not their values." msgstr "" -"如果 *a* 和 *b* 具有不同的長度,或者如果發生了錯誤,定時攻擊在理論上可以獲取" -"有關 *a* 和 *b* 的型別和長度的訊息 — 但不能獲取他們的值。" +"如果 *a* 和 *b* 具有不同的長度,或者如果發生了錯誤,定時攻擊在理論上可以取得" +"有關 *a* 和 *b* 的型別和長度的訊息 — 但不能取得他們的值。" #: ../../library/hmac.rst:140 msgid "" diff --git a/library/html.parser.po b/library/html.parser.po index f8c640799e..e557e6025b 100644 --- a/library/html.parser.po +++ b/library/html.parser.po @@ -192,7 +192,7 @@ msgstr "重置實例。丟棄所有未處理的資料。這在實例化時被會 #: ../../library/html.parser.rst:111 msgid "Return current line number and offset." -msgstr "回傳當前列號 (line number) 和偏移量 (offset)。" +msgstr "回傳目前列號 (line number) 和偏移量 (offset)。" #: ../../library/html.parser.rst:116 msgid "" diff --git a/library/http.po b/library/http.po index 96924cb5a1..06281fd946 100644 --- a/library/http.po +++ b/library/http.po @@ -40,7 +40,7 @@ msgid "" ":mod:`http.client` is a low-level HTTP protocol client; for high-level URL " "opening use :mod:`urllib.request`" msgstr "" -":mod:`http.client` 是一個低階的 HTTP 協定客戶端;對於高階的 URL 訪問請使用 :" +":mod:`http.client` 是一個低階的 HTTP 協定客戶端;對於高階的 URL 存取請使用 :" "mod:`urllib.request`" #: ../../library/http.rst:20 diff --git a/library/io.po b/library/io.po index 22a257e59f..15f657ad1c 100644 --- a/library/io.po +++ b/library/io.po @@ -812,7 +812,7 @@ msgid "" "additional bytes are zero-filled). The new file size is returned." msgstr "" "將串流的大小調整為指定的 *size* 位元組(如果沒有指定 *size*,則調整為目前位" -"置)。目前串流位置不會改變。這種調整可以擴展或縮減當前檔案大小。在擴展的情況" +"置)。目前串流位置不會改變。這種調整可以擴展或縮減目前檔案大小。在擴展的情況" "下,新檔案區域的內容取決於平台(在大多數系統上,額外的位元組會被填充為零)。" "回傳新的檔案大小。" @@ -1029,7 +1029,7 @@ msgid "" "A :exc:`BlockingIOError` is raised if the underlying raw stream is in non " "blocking-mode, and has no data available at the moment." msgstr "" -"如果底層原始串流處於非阻塞模式,且當前沒有可用資料,則會引發 :exc:" +"如果底層原始串流處於非阻塞模式,且目前沒有可用資料,則會引發 :exc:" "`BlockingIOError`。" #: ../../library/io.rst:580 diff --git a/library/itertools.po b/library/itertools.po index 9da2ed2ccd..ee5d1f4e0f 100644 --- a/library/itertools.po +++ b/library/itertools.po @@ -1378,7 +1378,7 @@ msgid "" "the *iterable*. Used instead of :func:`map` when argument parameters have " "already been \"pre-zipped\" into tuples." msgstr "" -"建立一個疊代器,使用從 *iterable* 獲取的引數計算 *function* 。當引數參數已經" +"建立一個疊代器,使用從 *iterable* 取得的引數計算 *function* 。當引數參數已經" "被「預先壓縮 (pre-zipped)」成元組時,使用此方法代替 :func:`map`。" #: ../../library/itertools.rst:658 diff --git a/library/marshal.po b/library/marshal.po index 03ab684ed4..d36682828d 100644 --- a/library/marshal.po +++ b/library/marshal.po @@ -23,7 +23,7 @@ msgstr "" #: ../../library/marshal.rst:2 msgid ":mod:`!marshal` --- Internal Python object serialization" -msgstr ":mod:`!marshal` --- 内部 Python 物件序列化" +msgstr ":mod:`!marshal` --- 內部 Python 物件序列化" #: ../../library/marshal.rst:10 msgid "" @@ -87,7 +87,7 @@ msgid "" "dictionaries cannot be written (see below)." msgstr "" "不是所有 Python 物件型別都有支援;一般來說,此 module 只能寫入和讀取不依賴於" -"特定 Python 調用 (invocation) 的物件。下列型別是有支援的:布林 (boolean)、整" +"特定 Python 呼叫 (invocation) 的物件。下列型別是有支援的:布林 (boolean)、整" "數、浮點數 (floating-point number)、複數、字串、位元組串 (bytes)、位元組陣列 " "(bytearray)、元組 (tuple)、list、集合 (set)、凍結集合 (frozenset)、" "dictionary 和程式碼物件(如 *allow_code* 為 true),需要了解的一點是元組、" diff --git a/library/multiprocessing.shared_memory.po b/library/multiprocessing.shared_memory.po index a9244ed858..86ded1a7f3 100644 --- a/library/multiprocessing.shared_memory.po +++ b/library/multiprocessing.shared_memory.po @@ -474,7 +474,7 @@ msgid "" "future. See :gh:`106939`." msgstr "" ":class:`bytes` 和 :class:`str` 值存在一個已知問題。如果它們以 ``\\x00`` nul " -"位元組或字元結尾,那麼當透過索引從 :class:`!ShareableList` 中獲取它們時,這些" +"位元組或字元結尾,那麼當透過索引從 :class:`!ShareableList` 中取得它們時,這些" "位元組或字元可能會被\\ *默默地剝離 (silently stripped)*。這種 ``." "rstrip(b'\\x00')`` 行為被認為是一個錯誤,將來可能會消失。請參閱 :gh:" "`106939`。" @@ -487,7 +487,7 @@ msgid "" msgstr "" "對於去除尾隨空值 (rstripping of trailing nulls) 會出問題的應用程式,變通解法 " "(workaround) 是始終無條件地在儲存時於此類值的末尾追加一個額外非 0 位元組,並" -"在獲取時也無條件地刪除它:" +"在取得時也無條件地刪除它:" #: ../../library/multiprocessing.shared_memory.rst:327 msgid "" diff --git a/library/operator.po b/library/operator.po index 3df309831a..fda2efbfbe 100644 --- a/library/operator.po +++ b/library/operator.po @@ -262,7 +262,7 @@ msgid "" "one attribute is requested, returns a tuple of attributes. The attribute " "names can also contain dots. For example:" msgstr "" -"回傳一個可從運算元中獲取 *attr* 的可呼叫 (callable) 物件。如果請求了一個以上" +"回傳一個可從運算元中取得 *attr* 的可呼叫 (callable) 物件。如果請求了一個以上" "的屬性,則回傳一個包含屬性的 tupple(元組)。屬性名稱還可包含點號。例如:" #: ../../library/operator.rst:277 @@ -316,7 +316,7 @@ msgid "" "operand's :meth:`~object.__getitem__` method. If multiple items are " "specified, returns a tuple of lookup values. For example:" msgstr "" -"回傳一個使用運算元的 :meth:`~object.__getitem__` 方法從運算元中獲取 *item* 的" +"回傳一個使用運算元的 :meth:`~object.__getitem__` 方法從運算元中取得 *item* 的" "可呼叫物件。如果指定了多個條目,則回傳一個查詢值的 tupple。例如:" #: ../../library/operator.rst:312 diff --git a/library/os.path.po b/library/os.path.po index 9518aa11e3..01916c12a2 100644 --- a/library/os.path.po +++ b/library/os.path.po @@ -49,7 +49,7 @@ msgid "" "the :mod:`glob` module.)" msgstr "" "與 Unix shell 不同,Python 不會\\ *自動*\\ 進行路徑展開 (path expansions)。當" -"應用程式需要進行類似 shell 的路徑展開時,可以明確地呼叫 :func:`expanduser` " +"應用程式需要進行類似 shell 的路徑展開時,可以明確地叫用 :func:`expanduser` " "和 :func:`expandvars` 等函式。(另請參閱 :mod:`glob` 模組。)" #: ../../library/os.path.rst:26 @@ -241,7 +241,7 @@ msgid "" "initial ``~user`` is looked up directly in the password directory." msgstr "" "在 Unix 上,如果環境變數 :envvar:`HOME` 有被設置,則將初始的 ``~`` 替換為該變" -"數的值;否則將使用內建模組 :mod:`pwd` 在密碼目錄中查找當前使用者的家目錄。對" +"數的值;否則將使用內建模組 :mod:`pwd` 在密碼目錄中查找目前使用者的家目錄。對" "於初始的 ``~user``,直接在密碼目錄中查找該使用者的家目錄。" #: ../../library/os.path.rst:170 @@ -254,7 +254,7 @@ msgid "" msgstr "" "在 Windows 上,如果 :envvar:`USERPROFILE` 有被設置,則使用該變數的值;否則將" "結合 :envvar:`HOMEPATH` 和 :envvar:`HOMEDRIVE`。對於初始的 ``~user``,會檢查" -"當前使用者的家目錄的最後一個目錄元件是否與 :envvar:`USERNAME` 相符,如果相符" +"目前使用者的家目錄的最後一個目錄元件是否與 :envvar:`USERNAME` 相符,如果相符" "則替換它。" #: ../../library/os.path.rst:175 @@ -485,8 +485,8 @@ msgid "" msgstr "" "在 Windows 上,當遇到根路徑段(例如,``r'\\foo'``)時,驅動機不會被重置。如果" "一個段位於不同的驅動機上,或者是絕對路徑,則將忽略所有之前的段並重置驅動機。" -"請注意,由於每個驅動機都有當前目錄,``os.path.join(\"c:\", \"foo\")`` 表示相" -"對於驅動機 :file:`C:` 的當前目錄的路徑(即 :file:`c:foo`),而不是 :file:`c:" +"請注意,由於每個驅動機都有目前目錄,``os.path.join(\"c:\", \"foo\")`` 表示相" +"對於驅動機 :file:`C:` 的目前目錄的路徑(即 :file:`c:foo`),而不是 :file:`c:" "\\\\foo`。" #: ../../library/os.path.rst:370 @@ -584,8 +584,8 @@ msgid "" "*start*. On Windows, :exc:`ValueError` is raised when *path* and *start* " "are on different drives." msgstr "" -"從當前目錄或可選的 *start* 目錄回傳到 *path* 的相對檔案路徑。這是一個路徑計" -"算:不會訪問檔案系統來確認 *path* 或 *start* 的存在或屬性。在 Windows 上,當 " +"從目前目錄或可選的 *start* 目錄回傳到 *path* 的相對檔案路徑。這是一個路徑計" +"算:不會存取檔案系統來確認 *path* 或 *start* 的存在或屬性。在 Windows 上,當 " "*path* 和 *start* 在不同的驅動機上時,會引發 :exc:`ValueError`。" #: ../../library/os.path.rst:441 diff --git a/library/pathlib.po b/library/pathlib.po index 1089de4563..b6108e93b9 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -128,7 +128,7 @@ msgstr "" #: ../../library/pathlib.rst:66 msgid "Listing Python source files in this directory tree::" -msgstr "在當前目錄樹下列出 Python 原始碼檔案: ::" +msgstr "在目前目錄樹下列出 Python 原始碼檔案: ::" #: ../../library/pathlib.rst:68 msgid "" @@ -2350,7 +2350,7 @@ msgstr "" "當 *top_down* 是 true,呼叫者可以原地 (in-place) 修改 *dirnames* 串列(例如使" "用 :keyword:`del` 或切片賦值 (slice assignment)),且 :meth:`Path.walk` 只會" "遞迴進名稱依然留在 *dirnames* 裡的子目錄。這可以用來修剪搜尋,或者強加特定順" -"序的訪問,或者甚至在繼續 :meth:`Path.walk` 之前,用來告訴 :meth:`Path.walk` " +"序的瀏覽,或者甚至在繼續 :meth:`Path.walk` 之前,用來告訴 :meth:`Path.walk` " "關於呼叫者建立或重新命名的目錄。當 *top_down* 是 false 的時候,修改 " "*dirnames* 對 :meth:`Path.walk` 的行為沒有影響,因為 *dirnames* 裡的目錄已經" "在 *dirnames* yield 給呼叫者之前被產生。" @@ -2378,7 +2378,7 @@ msgid "" msgstr "" "預設 :meth:`Path.walk` 不會跟隨符號連結,而是會把它們加到 *filenames* 串列。" "將 *follow_symlinks* 設定為 true 會解析符號連結,並將它們根據其指向的目標放在" -"適當的 *dirnames* 和 *filenames*,而因此訪問到符號連結指向的目錄(在有支援符" +"適當的 *dirnames* 和 *filenames*,而因此瀏覽到符號連結指向的目錄(在有支援符" "號連結的地方)。" #: ../../library/pathlib.rst:1387 @@ -2388,7 +2388,7 @@ msgid "" "walk` does not keep track of the directories it has already visited." msgstr "" "需要注意的是如果符號連結指向一個其本身的父目錄,則將 *follow_symlinks* 設定" -"為 true 會導致無窮的遞迴。:meth:`Path.walk` 不會紀錄其已經訪問過的目錄。" +"為 true 會導致無窮的遞迴。:meth:`Path.walk` 不會紀錄其已經瀏覽過的目錄。" #: ../../library/pathlib.rst:1392 msgid "" @@ -2660,7 +2660,7 @@ msgid "" "relative to the current working directory, *not* the directory of the :class:" "`!Path` object." msgstr "" -"目標路徑可以是絕對路徑或相對路徑。相對路徑會相對於當前的工作目錄進行解釋,*而" +"目標路徑可以是絕對路徑或相對路徑。相對路徑會相對於目前的工作目錄進行解釋,*而" "不是*\\ 相對於 :class:`!Path` 物件所在的目錄。" #: ../../library/pathlib.rst:1545 diff --git a/library/pdb.po b/library/pdb.po index 7740a944de..4dc66fd8de 100644 --- a/library/pdb.po +++ b/library/pdb.po @@ -150,13 +150,13 @@ msgid "" "arguments of the ``p`` command." msgstr "" "透過 :mod:`readline` 模組達成的 tab 補全可用於補全本模組的命令和命令的引數," -"例如會提供當前的全域和區域名稱以作為 ``p`` 命令的引數。" +"例如會提供目前的全域和區域名稱以作為 ``p`` 命令的引數。" #: ../../library/pdb.rst:78 msgid "" "You can also invoke :mod:`pdb` from the command line to debug other " "scripts. For example::" -msgstr "你還可以從命令列調用 :mod:`pdb` 來偵錯其他腳本。例如: ::" +msgstr "你還可以從命令列叫用 :mod:`pdb` 來偵錯其他腳本。例如: ::" #: ../../library/pdb.rst:81 msgid "python -m pdb myscript.py" @@ -170,7 +170,7 @@ msgid "" "Automatic restarting preserves pdb's state (such as breakpoints) and in most " "cases is more useful than quitting the debugger upon program's exit." msgstr "" -"當作為模組調用時,如果被偵錯的程序不正常地退出,pdb 將自動進入事後偵錯。事後" +"當作為模組叫用時,如果被偵錯的程序不正常地退出,pdb 將自動進入事後偵錯。事後" "偵錯後(或程式正常退出後),pdb 將重新啟動程式。自動重新啟動會保留 pdb 的狀態" "(例如斷點),並且在大多數情況下比在程式退出時退出偵錯器更有用。" @@ -334,7 +334,7 @@ msgid "" "currently being handled, or raises ``ValueError`` if there isn’t one." msgstr "" "進入所給定例外或\\ :ref:`回溯物件 <traceback-objects>`\\ 的事後偵錯。如果沒有" -"給定,預設使用當前正在處理的例外,或如果沒有例外則會引發 ``ValueError``。" +"給定,預設使用目前正在處理的例外,或如果沒有例外則會引發 ``ValueError``。" #: ../../library/pdb.rst:183 msgid "Support for exception objects was added." @@ -522,7 +522,7 @@ msgstr "共有三個預先設定的\\ *便利變數*:" #: ../../library/pdb.rst:289 msgid "``$_frame``: the current frame you are debugging" -msgstr "``$_frame``:當前正在偵錯的 frame" +msgstr "``$_frame``:目前正在偵錯的 frame" #: ../../library/pdb.rst:290 msgid "``$_retval``: the return value if the frame is returning" @@ -545,7 +545,7 @@ msgid "" "useful for aliases. If both files exist, the one in the home directory is " "read first and aliases defined there can be overridden by the local file." msgstr "" -"如果 :file:`.pdbrc` 檔案存在於使用者的家目錄或當前目錄中,則會使用 " +"如果 :file:`.pdbrc` 檔案存在於使用者的家目錄或目前目錄中,則會使用 " "``'utf-8'`` 編碼讀取並執行該檔案,就像在偵錯器提示字元下鍵入該檔案一樣,除了" "空列和以 ``#`` 開頭的列會被忽略之外。這對於別名設定特別有用。如果兩個檔案都存" "在,則先讀取家目錄中的檔案,且定義於其中的別名可以被本地檔案覆蓋。" @@ -577,7 +577,7 @@ msgid "" msgstr "" "如不帶引數,印出可用的命令列表。引數為 *command* 時,印出有關該命令的幫助訊" "息,``help pdb`` 會顯示完整文件(即 :mod:`pdb` 模組的說明字串 (docstring))。" -"由於 *command* 引數必須是一個識別字 (identifier),若要獲取 ``!`` 命令的幫助訊" +"由於 *command* 引數必須是一個識別字 (identifier),若要取得 ``!`` 命令的幫助訊" "息則必須輸入 ``help exec``。" #: ../../library/pdb.rst:328 @@ -586,7 +586,7 @@ msgid "" "(``>``) indicates the current frame, which determines the context of most " "commands." msgstr "" -"印出 stack trace,最新的 frame 會位於底部。箭頭(``>``)表示當前的 frame,它" +"印出 stack trace,最新的 frame 會位於底部。箭頭(``>``)表示目前的 frame,它" "也決定了大多數命令的情境。" #: ../../library/pdb.rst:333 @@ -594,7 +594,7 @@ msgid "" "Move the current frame *count* (default one) levels down in the stack trace " "(to a newer frame)." msgstr "" -"在 stack trace 中,將當前 frame 向下移動 *count* 級(預設為 1 級,移往較新的 " +"在 stack trace 中,將目前 frame 向下移動 *count* 級(預設為 1 級,移往較新的 " "frame)。" #: ../../library/pdb.rst:338 @@ -602,7 +602,7 @@ msgid "" "Move the current frame *count* (default one) levels up in the stack trace " "(to an older frame)." msgstr "" -"在 stack trace 中,將當前 frame 向上移動 *count* 級(預設為 1 級,移向較舊的 " +"在 stack trace 中,將目前 frame 向上移動 *count* 級(預設為 1 級,移向較舊的 " "frame)。" #: ../../library/pdb.rst:343 @@ -640,7 +640,7 @@ msgid "" "of times that breakpoint has been hit, the current ignore count, and the " "associated condition if any." msgstr "" -"如果不帶引數執行會列出所有斷點資訊,包括每個斷點、命中該斷點的次數、當前的忽" +"如果不帶引數執行會列出所有斷點資訊,包括每個斷點、命中該斷點的次數、目前的忽" "略次數以及關聯的條件(如存在)。" #: ../../library/pdb.rst:361 @@ -776,7 +776,7 @@ msgid "" "Execute the current line, stop at the first possible occasion (either in a " "function that is called or on the next line in the current function)." msgstr "" -"執行當前列,在第一個可以停止的位置(在被呼叫的函式內部或在當前函式的下一列)" +"執行目前列,在第一個可以停止的位置(在被呼叫的函式內部或在目前函式的下一列)" "停止。" #: ../../library/pdb.rst:441 @@ -787,16 +787,16 @@ msgid "" "executes called functions at (nearly) full speed, only stopping at the next " "line in the current function.)" msgstr "" -"繼續執行,直至執行到當前函式的下一列或者當前函式回傳為止。(:pdbcmd:`next` " +"繼續執行,直至執行到目前函式的下一列或者目前函式回傳為止。(:pdbcmd:`next` " "和 :pdbcmd:`step` 之間的區別在於 :pdbcmd:`step` 會在被呼叫函式的內部停止、" -"而 :pdbcmd:`next`\\ (幾乎)全速執行被呼叫的函式,並僅在當前函式的下一列停" +"而 :pdbcmd:`next`\\ (幾乎)全速執行被呼叫的函式,並僅在目前函式的下一列停" "止。)" #: ../../library/pdb.rst:449 msgid "" "Without argument, continue execution until the line with a number greater " "than the current one is reached." -msgstr "如果不帶引數則繼續執行,直到列號比當前的列大時停止。" +msgstr "如果不帶引數則繼續執行,直到列號比目前的列大時停止。" #: ../../library/pdb.rst:452 msgid "" @@ -805,7 +805,7 @@ msgid "" "frame returns." msgstr "" "如帶有 *lineno* 則繼續執行,直到到達列號大於或等於 *lineno* 的那一列。在這兩" -"種情況下,當前 frame 回傳時也會停止。" +"種情況下,目前 frame 回傳時也會停止。" #: ../../library/pdb.rst:456 msgid "Allow giving an explicit line number." @@ -845,8 +845,8 @@ msgid "" "lines around at that line. With two arguments, list the given range; if the " "second argument is less than the first, it is interpreted as a count." msgstr "" -"列出當前檔案的原始碼。如果不帶引數,則列出當前列周圍的 11 列,或繼續先前的列" -"表操作。如果用 ``.`` 作為引數,則列出當前列周圍的 11 列。如果帶有一個引數,則" +"列出目前檔案的原始碼。如果不帶引數,則列出目前列周圍的 11 列,或繼續先前的列" +"表操作。如果用 ``.`` 作為引數,則列出目前列周圍的 11 列。如果帶有一個引數,則" "列出那一列周圍的 11 列。如果帶有兩個引數,則列出給定範圍中的程式碼;如果第二" "個引數小於第一個引數,則將其直譯為要列出的列數。" @@ -857,8 +857,8 @@ msgid "" "raised or propagated is indicated by ``>>``, if it differs from the current " "line." msgstr "" -"當前 frame 中的當前列會用 ``->`` 標記出來。如果正在偵錯一個例外,且引發或傳遞" -"該例外的那一列不是當前列,則會用 ``>>`` 來標記該列。" +"目前 frame 中的目前列會用 ``->`` 標記出來。如果正在偵錯一個例外,且引發或傳遞" +"該例外的那一列不是目前列,則會用 ``>>`` 來標記該列。" #: ../../library/pdb.rst:490 msgid "Added the ``>>`` marker." @@ -869,15 +869,15 @@ msgid "" "List all source code for the current function or frame. Interesting lines " "are marked as for :pdbcmd:`list`." msgstr "" -"列出當前函式或 frame 的所有原始碼。相關列的標記方式與 :pdbcmd:`list` 相同。" +"列出目前函式或 frame 的所有原始碼。相關列的標記方式與 :pdbcmd:`list` 相同。" #: ../../library/pdb.rst:502 msgid "Print the arguments of the current function and their current values." -msgstr "印出當前函式的引數及它們當前的值。" +msgstr "印出目前函式的引數及它們目前的值。" #: ../../library/pdb.rst:506 msgid "Evaluate *expression* in the current context and print its value." -msgstr "在當前情境中為 *expression* 求值並印出其值。" +msgstr "在目前情境中為 *expression* 求值並印出其值。" #: ../../library/pdb.rst:510 msgid "" @@ -901,18 +901,18 @@ msgstr "印出 *expression* 的型別。" #: ../../library/pdb.rst:525 msgid "Try to get source code of *expression* and display it." -msgstr "嘗試獲取 *expression* 的原始碼並顯示它。" +msgstr "嘗試取得 *expression* 的原始碼並顯示它。" #: ../../library/pdb.rst:531 msgid "" "Display the value of *expression* if it changed, each time execution stops " "in the current frame." -msgstr "每次在當前 frame 中停止執行時,顯示 *expression* 的值(如果有變更)。" +msgstr "每次在目前 frame 中停止執行時,顯示 *expression* 的值(如果有變更)。" #: ../../library/pdb.rst:534 msgid "" "Without *expression*, list all display expressions for the current frame." -msgstr "如果不帶有 *expression*,則列出當前 frame 的所有運算式。" +msgstr "如果不帶有 *expression*,則列出目前 frame 的所有運算式。" #: ../../library/pdb.rst:538 msgid "" @@ -921,7 +921,7 @@ msgid "" "be able to pick up the changes." msgstr "" "display 會對 *expression* 求值並將結果與之前 *expression* 的求值結果進行比" -"較,因此當結果可變時,display 可能無法獲取其變更。" +"較,因此當結果可變時,display 可能無法取得其變更。" #: ../../library/pdb.rst:542 ../../library/pdb.rst:692 msgid "Example::" @@ -1012,7 +1012,7 @@ msgid "" "Do not display *expression* anymore in the current frame. Without " "*expression*, clear all display expressions for the current frame." msgstr "" -"不再顯示當前 frame 中的 *expression*。如果不帶有 *expression*,則清除當前 " +"不再顯示目前 frame 中的 *expression*。如果不帶有 *expression*,則清除目前 " "frame 的所有顯示運算式。" #: ../../library/pdb.rst:591 @@ -1104,7 +1104,7 @@ msgid "" "frame. The exclamation point can be omitted unless the first word of the " "statement resembles a debugger command, e.g.:" msgstr "" -"在當前 stack frame 的情境中執行(單列)\\ *statement*。除非陳述式的第一個單詞" +"在目前 stack frame 的情境中執行(單列)\\ *statement*。除非陳述式的第一個單詞" "類似於偵錯器命令,否則可以省略驚嘆號,例如:" #: ../../library/pdb.rst:647 @@ -1151,12 +1151,12 @@ msgid "" "Enter a recursive debugger that steps through *code* (which is an arbitrary " "expression or statement to be executed in the current environment)." msgstr "" -"進入一個遞迴偵錯器,逐步執行 *code*\\ (這是要在當前環境中執行的任意運算式或" +"進入一個遞迴偵錯器,逐步執行 *code*\\ (這是要在目前環境中執行的任意運算式或" "陳述式)。" #: ../../library/pdb.rst:680 msgid "Print the return value for the last return of the current function." -msgstr "印出當前函式最後一次回傳的回傳值。" +msgstr "印出目前函式最後一次回傳的回傳值。" #: ../../library/pdb.rst:684 msgid "List or jump between chained exceptions." diff --git a/library/pickle.po b/library/pickle.po index 111cb91b47..c9791e8e2a 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -1043,7 +1043,7 @@ msgid "" msgstr "" "大部分的實例不需要額外的程式碼就已經是可封裝的了。在這樣的預設狀況中,pickle " "模組透過自省機制來取得類別及其實例的屬性。當類別實例被拆封時,其 :meth:" -"`~object.__init__` 方法通常*不會*被呼叫。預設行為首先會建立一個未初始化的實" +"`~object.__init__` 方法通常*不會*被叫用。預設行為首先會建立一個未初始化的實" "例,然後還原紀錄中的屬性。以下程式碼的實作展示了前述行為::" #: ../../library/pickle.rst:575 @@ -1319,7 +1319,7 @@ msgstr "" "append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被附加到" "物件中。主要用於串列(list)子類別,但只要其他類別具有相應的 :ref:`append 和 " "extend 方法 <typesseq-common>`\\ 以及相同的函式簽章(signature)就也可以使" -"用。 (是否會調用 :meth:`!append` 或 :meth:`!extend` 方法將取決於所選用的 " +"用。 (是否會呼叫 :meth:`!append` 或 :meth:`!extend` 方法將取決於所選用的 " "pickle 協定版本以及要附加的項目數量,因此必須同時支援這兩種方法。)" #: ../../library/pickle.rst:725 @@ -1360,7 +1360,7 @@ msgid "" "provide backwards-compatible reduce values for older Python releases." msgstr "" "另外,你也可以定義一個 :meth:`__reduce_ex__` 方法。唯一的不同的地方是此方法只" -"接受協定版本(整數)作為參數。當有定義本方法時,pickle 會優先調用它而不是 :" +"接受協定版本(整數)作為參數。當有定義本方法時,pickle 會優先呼叫它而不是 :" "meth:`__reduce__` 。此外,呼叫 :meth:`__reduce__` 時也會自動變成呼叫這個變體" "版本。此方法主要是為了向後相容的舊的 Python 版本而存在。" @@ -1710,7 +1710,7 @@ msgid "" msgstr "" "以下的範例展示了如何修改針對特定類別封裝時的行為。下面的 :class:`!" "TextReader` 類別會開啟一個文字檔案,並在每次呼叫其 :meth:`!readline` 方法時返" -"回當前行編號與該行內容。如果 :class:`!TextReader` 實例被封裝,所有*除了檔案物" +"回目前行編號與該行內容。如果 :class:`!TextReader` 實例被封裝,所有*除了檔案物" "件之外*的屬性成員都會被保存。在該實例被拆封時,檔案將被重新開啟,並從上次的位" "置繼續讀取。這個行為的達成是透過 :meth:`!__setstate__` 和 :meth:`!" "__getstate__` 方法來實作的。::" @@ -2002,7 +2002,7 @@ msgid "" "graph. Buffers accumulated by the *buffer_callback* will not see their data " "copied into the pickle stream, only a cheap marker will be inserted." msgstr "" -"傳送端需要傳遞一個調用緩衝區的回呼函式給 :class:`Pickler`\\ (或 :func:" +"傳送端需要傳遞一個呼叫緩衝區的回呼函式給 :class:`Pickler`\\ (或 :func:" "`dump` 或 :func:`dumps` 函式)的 *buffer_callback* 引數,使每次生成 :class:" "`PickleBuffer` 時,該物件在處理物件圖時能被呼叫。除了一個簡易標記以外,由 " "*buffer_callback* 累積的緩衝區資料不會被複製到 pickle 串流中。" @@ -2210,7 +2210,7 @@ msgid "" msgstr "" "基於以上原因,你可能會希望透過自訂 :meth:`Unpickler.find_class` 來控制哪些是" "能夠被拆封的內容。與其名稱字面意義暗示的不同,實際上每當你請求一個全域物件" -"(例如,類別或函式)時,就會調用 :meth:`Unpickler.find_class`。因此,可以透過" +"(例如,類別或函式)時,就會呼叫 :meth:`Unpickler.find_class`。因此,可以透過" "這個方法完全禁止全域物件或將其限制在安全的子集合。" #: ../../library/pickle.rst:1100 @@ -2339,7 +2339,7 @@ msgstr "範例" #: ../../library/pickle.rst:1167 msgid "" "For the simplest code, use the :func:`dump` and :func:`load` functions. ::" -msgstr "最簡單的使用方式,調用 :func:`dump` 和 :func:`load` 函式。::" +msgstr "最簡單的使用方式,呼叫 :func:`dump` 和 :func:`load` 函式。::" #: ../../library/pickle.rst:1169 msgid "" diff --git a/library/platform.po b/library/platform.po index de5e532153..4132559a7c 100644 --- a/library/platform.po +++ b/library/platform.po @@ -43,7 +43,7 @@ msgid "" "Queries the given executable (defaults to the Python interpreter binary) for " "various architecture information." msgstr "" -"查詢給定的可執行檔案(預設為 Python 直譯器二進位制檔案)來獲取各種架構資訊。" +"查詢給定的可執行檔案(預設為 Python 直譯器二進位制檔案)來取得各種架構資訊。" #: ../../library/platform.rst:29 msgid "" @@ -88,7 +88,7 @@ msgid "" "To get at the \"64-bitness\" of the current interpreter, it is more reliable " "to query the :data:`sys.maxsize` attribute::" msgstr "" -"要獲取當前直譯器的 \"64 位元性 (64-bitness)\",更可靠的做法是查詢 :data:`sys." +"要取得目前直譯器的 \"64 位元性 (64-bitness)\",更可靠的做法是查詢 :data:`sys." "maxsize` 屬性: ::" #: ../../library/platform.rst:51 @@ -146,7 +146,7 @@ msgid "" "release string, to get the macOS version rather than the darwin version." msgstr "" "在 macOS 上,如果 :func:`mac_ver` 回傳的釋出版字串非空字串,此函式現在會使用" -"它以獲取 macOS 版本而非 darwin 版本。" +"它以取得 macOS 版本而非 darwin 版本。" #: ../../library/platform.rst:90 msgid "Returns the (real) processor name, e.g. ``'amdk6'``." @@ -333,7 +333,7 @@ msgid "" "Values which cannot be determined are set to the defaults given as " "parameters (which all default to an empty string)." msgstr "" -"從 Windows 登錄檔 (Window Registry) 獲取額外的版本資訊並回傳一個 tuple " +"從 Windows 登錄檔 (Window Registry) 取得額外的版本資訊並回傳一個 tuple " "``(release, version, csd, ptype)``,它代表 OS 發行版、版本號、CSD 級別 " "(service pack) 和 OS 類型(多個/單個處理器)。" @@ -357,7 +357,7 @@ msgid "" "to ``'Enterprise'``, ``'IoTUAP'``, ``'ServerStandard'``, and " "``'nanoserver'``." msgstr "" -"回傳一個代表當前 Windows 版本的字串。可能的值包括但不限於 ``'Enterprise'``、" +"回傳一個代表目前 Windows 版本的字串。可能的值包括但不限於 ``'Enterprise'``、" "``'IoTUAP'``、``'ServerStandard'`` 和 ``'nanoserver'``。" #: ../../library/platform.rst:237 @@ -378,7 +378,7 @@ msgid "" "versioninfo, machine)`` with *versioninfo* being a tuple ``(version, " "dev_stage, non_release_version)``." msgstr "" -"獲取 Mac OS 版本資訊並將其回傳為 tuple ``(release, versioninfo, machine)``," +"取得 Mac OS 版本資訊並將其回傳為 tuple ``(release, versioninfo, machine)``," "其中 *versioninfo* 是一個 tuple ``(version, dev_stage, " "non_release_version)``。" @@ -464,7 +464,7 @@ msgid "" "in most Linux distributions. A noticeable exception is Android and Android-" "based distributions." msgstr "" -"從 ``os-release`` 檔案獲取作業系統標識,並將其作為一個字典回傳。``os-" +"從 ``os-release`` 檔案取得作業系統標識,並將其作為一個字典回傳。``os-" "release`` 檔案為 `freedesktop.org 標準 <https://www.freedesktop.org/software/" "systemd/man/os-release.html>`_、並在大多數 Linux 發行版上可用。一個重要的例外" "是 Android 和基於 Android 的發行版。" diff --git a/library/queue.po b/library/queue.po index 489a62d536..601d813016 100644 --- a/library/queue.po +++ b/library/queue.po @@ -328,7 +328,7 @@ msgstr "如果呼叫次數超過佇列中放置的項目數量,則引發 :exc: #: ../../library/queue.rst:199 msgid "Blocks until all items in the queue have been gotten and processed." -msgstr "持續阻塞直到佇列中的所有項目都已被獲取並處理完畢。" +msgstr "持續阻塞直到佇列中的所有項目都已被取得並處理完畢。" #: ../../library/queue.rst:201 msgid "" diff --git a/library/random.po b/library/random.po index 41ff2b3422..b4196649ec 100644 --- a/library/random.po +++ b/library/random.po @@ -157,7 +157,7 @@ msgid "" "instead of the system time (see the :func:`os.urandom` function for details " "on availability)." msgstr "" -"如果 *a* 被省略或為 ``None``,則使用當前系統時間。如果隨機來源由作業系統提" +"如果 *a* 被省略或為 ``None``,則使用目前系統時間。如果隨機來源由作業系統提" "供,則使用它們而不是系統時間(有關可用性的詳細資訊,請參考 :func:`os." "urandom` 函式)。" @@ -201,7 +201,7 @@ msgid "" "Return an object capturing the current internal state of the generator. " "This object can be passed to :func:`setstate` to restore the state." msgstr "" -"回傳一個物件,捕獲產生器的當前內部狀態。此物件可以傳遞給 :func:`setstate` 以" +"回傳一個物件,捕獲產生器的目前內部狀態。此物件可以傳遞給 :func:`setstate` 以" "恢復狀態。" #: ../../library/random.rst:106 diff --git a/library/re.po b/library/re.po index dee9f2cecd..d6c4730895 100644 --- a/library/re.po +++ b/library/re.po @@ -62,7 +62,7 @@ msgid "" "future this will become a :exc:`SyntaxError`. This behaviour will happen " "even if it is a valid escape sequence for a regular expression." msgstr "" -"正規表示式使用反斜線字元 (``'\\'``) 表示特別的形式,或是使用特殊字元而不調用" +"正規表示式使用反斜線字元 (``'\\'``) 表示特別的形式,或是使用特殊字元而不呼叫" "它們的特殊意義。這與 Python 在字串文本 (literal) 中,為了一樣的目的使用同一個" "字元的目的相衝突;舉例來說,為了配對一個反斜線文字,一個人可能需要寫 ``'\\\\" "\\\\'`` 當作模式字串,因為正規表示式必須是 ``\\\\``,而且每個反斜線在一個普通" diff --git a/library/secrets.po b/library/secrets.po index d2bfde8612..009b340e6a 100644 --- a/library/secrets.po +++ b/library/secrets.po @@ -67,7 +67,7 @@ msgid "" "additional details." msgstr "" "一個用來產生亂數的類別,用的是作業系統提供的最高品質來源。 請參閱 :class:" -"`random.SystemRandom` 以獲取更多細節。" +"`random.SystemRandom` 以取得更多細節。" #: ../../library/secrets.rst:47 msgid "Return a randomly chosen element from a non-empty sequence." diff --git a/library/security_warnings.po b/library/security_warnings.po index 711aca08ae..243d024c02 100644 --- a/library/security_warnings.po +++ b/library/security_warnings.po @@ -123,7 +123,7 @@ msgid "" msgstr "" ":option:`-I` 命令列選項可用於在隔離模式下運行 Python。若其無法使用,可以改" "用 :option:`-P` 選項或 :envvar:`PYTHONSAFEPATH` 環境變數,避免 :data:`sys." -"path` 新增潛在的不安全路徑,例如當前目錄、腳本的目錄或空字串。" +"path` 新增潛在的不安全路徑,例如目前目錄、腳本的目錄或空字串。" #: ../../library/security_warnings.rst:3 msgid "security considerations" diff --git a/library/signal.po b/library/signal.po index 2f85ac971d..1ae764dd5d 100644 --- a/library/signal.po +++ b/library/signal.po @@ -687,7 +687,7 @@ msgstr "嘗試傳入無效的間隔計時器會導致 :exc:`ItimerError`。" #: ../../library/signal.rst:506 msgid "Returns current value of a given interval timer specified by *which*." -msgstr "回傳由 *which* 指定之間隔計時器的當前值。" +msgstr "回傳由 *which* 指定之間隔計時器的目前值。" #: ../../library/signal.rst:513 msgid "" diff --git a/library/ssl.po b/library/ssl.po index 15a4f1f037..0779b084a5 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -369,7 +369,7 @@ msgid "" "The context now uses :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER` protocol instead of generic :data:`PROTOCOL_TLS`." msgstr "" -"當前語境使用 :data:`PROTOCOL_TLS_CLIENT` 協定或 :data:`PROTOCOL_TLS_SERVER` " +"目前語境使用 :data:`PROTOCOL_TLS_CLIENT` 協定或 :data:`PROTOCOL_TLS_SERVER` " "協定而非通用的 :data:`PROTOCOL_TLS`。" #: ../../library/ssl.rst:214 @@ -605,7 +605,7 @@ msgid "" "parameter." msgstr "" "輸入使用 SSL 保護的伺服器的地址 ``addr``,輸入形式為一個 pair (*hostname*, " -"*port-number*),獲取該伺服器的憑證,並以 PEM 編碼字串的形式回傳。如果指定了 " +"*port-number*),取得該伺服器的憑證,並以 PEM 編碼字串的形式回傳。如果指定了 " "``ssl_version``,則使用指定的 SSL 協議來嘗試與伺服器連線。如果指定 " "*ca_certs*,則它應該是一個包含根憑證列表的檔案,並與 :meth:`SSLContext." "load_verify_locations` 中的參數 *cafile* 所使用的格式相同。此呼叫將嘗試使用該" @@ -816,7 +816,7 @@ msgid "" "attr:`~SSLContext.check_hostname` by default." msgstr "" ":attr:`SSLContext.verify_mode` 可能的值。在這個模式下,需要從 socket 連線的另" -"一端獲取憑證;如果未提供憑證或是驗證失敗,則將會導致 :class:`SSLError`。此模" +"一端取得憑證;如果未提供憑證或是驗證失敗,則將會導致 :class:`SSLError`。此模" "式 **不能** 在客戶端模式下對憑證進行驗證,因為它無法去配對主機名稱。:attr:" "`~SSLContext.check_hostname` 也必須被開起來來驗證憑證的真實性。:const:" "`PROTOCOL_TLS_CLIENT` 會使用 :const:`CERT_REQUIRED` 並預設開啟 :attr:" @@ -1329,7 +1329,7 @@ msgid "" "parameters-6>`_ contains this list and references to the RFCs where their " "meaning is defined." msgstr "" -"來自 :rfc:`5246` 和其他文檔的警報描述。`IANA TLS Alert Registry <https://www." +"來自 :rfc:`5246` 和其他文件的警報描述。`IANA TLS Alert Registry <https://www." "iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-6>`_ 包" "含了此列表以及其含義定義所在的 RFC 的引用。" @@ -1490,7 +1490,7 @@ msgid "" "on non-blocking sockets <ssl-nonblocking>`." msgstr "" "然而,由於 SSL(和 TLS)協定在 TCP 之上有自己的框架,因此在某些方面,SSL " -"sockets 的抽象可能會與普通操作系統級別的 sockets 規範有所不同。特別是請參閱" +"sockets 的抽象可能會與普通作業系統級別的 sockets 規範有所不同。特別是請參閱" "\\ :ref:`關於 non-blocking sockets 的說明 <ssl-nonblocking>`。" #: ../../library/ssl.rst:1077 diff --git a/library/stdtypes.po b/library/stdtypes.po index 332f14e2f5..1755b6f92f 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -29,7 +29,7 @@ msgstr "內建型別" msgid "" "The following sections describe the standard types that are built into the " "interpreter." -msgstr "以下章節描述了直譯器中内建的標準型別。" +msgstr "以下章節描述了直譯器中內建的標準型別。" #: ../../library/stdtypes.rst:15 msgid "" @@ -6749,7 +6749,7 @@ msgid "" msgstr "" "一個會回傳相關物件的情境管理器範例是由 :func:`decimal.localcontext` 回傳的管" "理器。這些管理器將有效的十進位情境設定為原始十進位情境的副本,然後回傳該副" -"本。這允許對 :keyword:`with` 陳述式主體中的當前十進位情境進行更改,而不會影" +"本。這允許對 :keyword:`with` 陳述式主體中的目前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" #: ../../library/stdtypes.rst:4861 diff --git a/library/string.po b/library/string.po index ceb98aace6..73accbfc38 100644 --- a/library/string.po +++ b/library/string.po @@ -402,7 +402,7 @@ msgid "" msgstr "" "*format_spec* 欄位還可以在其內部包含巢狀的替換欄位。這些巢狀的替換欄位可能包" "含欄位名稱、轉換旗標、格式規格描述,但是不允許再更深層的巢狀結構。" -"format_spec 内部的替換欄位會在 *format_spec* 字串被直譯前被替換。這讓數值的格" +"format_spec 內部的替換欄位會在 *format_spec* 字串被直譯前被替換。這讓數值的格" "式能夠被動態地指定。" #: ../../library/string.rst:297 diff --git a/library/sys.monitoring.po b/library/sys.monitoring.po index e09420449f..cd5f4ccbcc 100644 --- a/library/sys.monitoring.po +++ b/library/sys.monitoring.po @@ -496,7 +496,7 @@ msgstr "停用事件" msgid "" "A special value that can be returned from a callback function to disable " "events for the current code location." -msgstr "可以從回呼函式回傳的特殊值,以停用當前程式碼位置的事件。" +msgstr "可以從回呼函式回傳的特殊值,以停用目前程式碼位置的事件。" #: ../../library/sys.monitoring.rst:285 msgid "" diff --git a/library/tempfile.po b/library/tempfile.po index ea21fbf628..9dd531ec72 100644 --- a/library/tempfile.po +++ b/library/tempfile.po @@ -588,7 +588,7 @@ msgstr "" #: ../../library/tempfile.rst:328 msgid "As a last resort, the current working directory." -msgstr "不得已時,使用當前工作目錄。" +msgstr "不得已時,使用目前工作目錄。" #: ../../library/tempfile.rst:330 msgid "" diff --git a/library/threading.po b/library/threading.po index 4fc83a7965..bc6c0d5319 100644 --- a/library/threading.po +++ b/library/threading.po @@ -738,7 +738,7 @@ msgid "" "When invoked with the *blocking* argument set to ``True`` (the default), " "block until the lock is unlocked, then set it to locked and return ``True``." msgstr "" -"當以 *blocking* 引數設為 ``True``\\ (預設值)來調用,將會阻塞直到鎖被解鎖," +"當以 *blocking* 引數設為 ``True``\\ (預設值)來叫用,將會阻塞直到鎖被解鎖," "然後將其設為鎖定並回傳 ``True``。" #: ../../library/threading.rst:550 @@ -747,7 +747,7 @@ msgid "" "a call with *blocking* set to ``True`` would block, return ``False`` " "immediately; otherwise, set the lock to locked and return ``True``." msgstr "" -"當以 *blocking* 引數設為 ``False`` 調用則不會阻塞。如果 *blocking* 設定為 " +"當以 *blocking* 引數設為 ``False`` 叫用則不會阻塞。如果 *blocking* 設定為 " "``True`` 的呼叫會阻塞,則立即回傳 ``False``;否則將鎖設為鎖定並回傳 " "``True``。" @@ -759,7 +759,7 @@ msgid "" "specifies an unbounded wait. It is forbidden to specify a *timeout* when " "*blocking* is ``False``." msgstr "" -"當使用設定為正值的浮點 *timeout* 引數進行調用,只要持續無法取得鎖,最多會阻" +"當使用設定為正值的浮點 *timeout* 引數進行叫用,只要持續無法取得鎖,最多會阻" "塞 *timeout* 指定的秒數。``-1`` 的 *timeout* 引數代表指定為不會停止的等待。" "當 *blocking* 為 ``False`` 時禁止指定 *timeout*。" @@ -780,7 +780,7 @@ msgstr "新的 *timeout* 參數。" msgid "" "Lock acquisition can now be interrupted by signals on POSIX if the " "underlying threading implementation supports it." -msgstr "如果底層執行緒實作支援的話,鎖的獲取現在可以被 POSIX 上的訊號中斷。" +msgstr "如果底層執行緒實作支援的話,鎖的取得現在可以被 POSIX 上的訊號中斷。" #: ../../library/threading.rst:573 msgid "" @@ -799,7 +799,7 @@ msgstr "" #: ../../library/threading.rst:580 msgid "When invoked on an unlocked lock, a :exc:`RuntimeError` is raised." -msgstr "當在未鎖定的鎖上調用時,會引發 :exc:`RuntimeError`" +msgstr "當在未鎖定的鎖上叫用時,會引發 :exc:`RuntimeError`" #: ../../library/threading.rst:582 ../../library/threading.rst:690 msgid "There is no return value." @@ -866,7 +866,7 @@ msgid "" "deadlock." msgstr "" ":meth:`~RLock.acquire`/:meth:`~RLock.release` 必須成對使用:每次獲得都必須在" -"已獲得鎖的執行緒中有一個釋放。如果鎖釋放的次數不能和獲取的次數一樣的話,可能" +"已獲得鎖的執行緒中有一個釋放。如果鎖釋放的次數不能和取得的次數一樣的話,可能" "會導致死鎖 (deadlock)。" #: ../../library/threading.rst:624 @@ -904,7 +904,7 @@ msgstr "" #: ../../library/threading.rst:645 msgid "" "When invoked with the *blocking* argument set to ``True`` (the default):" -msgstr "當以 *blocking* 引數設為 ``True``\\ (預設值)來調用:" +msgstr "當以 *blocking* 引數設為 ``True``\\ (預設值)來呼叫:" #: ../../library/threading.rst:647 ../../library/threading.rst:659 msgid "If no thread owns the lock, acquire the lock and return immediately." @@ -931,7 +931,7 @@ msgstr "" #: ../../library/threading.rst:657 msgid "When invoked with the *blocking* argument set to ``False``:" -msgstr "當以 *blocking* 引數設為 ``False`` 來調用:" +msgstr "當以 *blocking* 引數設為 ``False`` 來呼叫:" #: ../../library/threading.rst:661 msgid "If another thread owns the lock, return immediately." diff --git a/library/time.po b/library/time.po index 52833ec856..f1ec859a7e 100644 --- a/library/time.po +++ b/library/time.po @@ -231,7 +231,7 @@ msgid "" "If *t* is not provided, the current time as returned by :func:`localtime` is " "used. Locale information is not used by :func:`asctime`." msgstr "" -"如果沒有提供 *t*,則使用由 :func:`localtime` 回傳的當前時間。:func:`asctime` " +"如果沒有提供 *t*,則使用由 :func:`localtime` 回傳的目前時間。:func:`asctime` " "不使用區域資訊。" #: ../../library/time.rst:134 @@ -253,7 +253,7 @@ msgid "" "*thread_id*." msgstr "" "使用 :func:`threading.get_ident` 或 :class:`threading.Thread` 物件" -"的 :attr:`~threading.Thread.ident` 屬性來獲取適用於 *thread_id* 的值。" +"的 :attr:`~threading.Thread.ident` 屬性來取得適用於 *thread_id* 的值。" #: ../../library/time.rst:146 msgid "" @@ -348,7 +348,7 @@ msgid "" "``asctime(localtime(secs))``. Locale information is not used " "by :func:`ctime`." msgstr "" -"如果未提供 *secs* 或其為 :const:`None`,則使用由 :func:`.time` 回傳的當前時" +"如果未提供 *secs* 或其為 :const:`None`,則使用由 :func:`.time` 回傳的目前時" "間。``ctime(secs)`` 等同於 ``asctime(localtime(secs))``。:func:`ctime` 不使用" "區域資訊。" @@ -357,7 +357,7 @@ msgid "" "Get information on the specified clock as a namespace object. Supported " "clock names and the corresponding functions to read their value are:" msgstr "" -"獲取指定時鐘的資訊作為命名空間物件。支援的時鐘名稱及讀取他們的值的對應函式如" +"取得指定時鐘的資訊作為命名空間物件。支援的時鐘名稱及讀取他們的值的對應函式如" "下:" #: ../../library/time.rst:229 @@ -397,7 +397,7 @@ msgid "" "*implementation*: The name of the underlying C function used to get the " "clock value. Refer to :ref:`time-clock-id-constants` for possible values." msgstr "" -"*implementation*: 用於獲取時鐘的值的底層 C 函式名稱。有關可能的值,請參" +"*implementation*: 用於取得時鐘的值的底層 C 函式名稱。有關可能的值,請參" "閱 :ref:`time-clock-id-constants`。" #: ../../library/time.rst:241 @@ -420,7 +420,7 @@ msgid "" msgstr "" "將自 epoch_ 起以秒表示的時間轉換為 UTC 中的 :class:`struct_time`,其中 dst 旗" "標始終為零。如果未提供 *secs* 或其為 :const:`None`,則使用由 :func:`.time` 回" -"傳的當前時間。忽略秒的分數部分。關於 :class:`struct_time` 物件的描述,請參閱" +"傳的目前時間。忽略秒的分數部分。關於 :class:`struct_time` 物件的描述,請參閱" "上文。此函式的反運算請參閱 :func:`calendar.timegm`。" #: ../../library/time.rst:260 @@ -430,7 +430,7 @@ msgid "" "The dst flag is set to ``1`` when DST applies to the given time." msgstr "" "類似於 :func:`gmtime`,但轉換為當地時間。如果未提供 *secs* 或其" -"為 :const:`None`,則使用由 :func:`.time` 回傳的當前時間。當 DST 適用於給定時" +"為 :const:`None`,則使用由 :func:`.time` 回傳的目前時間。當 DST 適用於給定時" "間時,dst 旗標會被設定為 ``1``。" #: ../../library/time.rst:264 @@ -570,7 +570,7 @@ msgid "" "returned value is undefined, so that only the difference between the results " "of two calls is valid." msgstr "" -"回傳當前行程的系統和用戶 CPU 時間之和(以帶有小數的秒數表示)。它不包括睡眠時" +"回傳目前行程的系統和用戶 CPU 時間之和(以帶有小數的秒數表示)。它不包括睡眠時" "經過的時間。根據定義,它涵蓋整個行程。回傳值的參考點沒有定義,因此只有兩次呼" "叫結果之間的差異才是有效的。" @@ -694,7 +694,7 @@ msgid "" msgstr "" "將由 :func:`gmtime` 或 :func:`localtime` 回傳代表時間的一個元組" "或 :class:`struct_time` 轉換為由 *format* 引數指定的字串。如果未提供 *t*,則" -"使用由 :func:`localtime` 回傳的當前時間。*format* 必須是一個字串。如果 *t* 中" +"使用由 :func:`localtime` 回傳的目前時間。*format* 必須是一個字串。如果 *t* 中" "的任何欄位超出允許範圍,將會引發 :exc:`ValueError`。" #: ../../library/time.rst:436 @@ -1113,7 +1113,7 @@ msgid "" "platform and thus does not necessarily support all directives available that " "are not documented as supported." msgstr "" -"僅支援文檔中指定的指令。由於 ``strftime()`` 是根據每個平台實作的,有時它可以" +"僅支援文件中指定的指令。由於 ``strftime()`` 是根據每個平台實作的,有時它可以" "提供比列出的還要更多的指令。但是 ``strptime()`` 與任何平台無關,因此不一定支" "援所有未記載為支援的指令。" @@ -1320,7 +1320,7 @@ msgid "" "returned value is undefined, so that only the difference between the results " "of two calls in the same thread is valid." msgstr "" -"回傳當前執行緒的系統和用戶 CPU 時間之和(以帶有小數的秒數表示)。它不包括睡眠" +"回傳目前執行緒的系統和用戶 CPU 時間之和(以帶有小數的秒數表示)。它不包括睡眠" "期間經過的時間。根據定義,這是執行緒特定 (thread-specific) 的。回傳值的參照點" "未定義,因此只有同一執行緒中兩次呼叫結果之間的差異才是有效的。" @@ -1549,7 +1549,7 @@ msgid "" "have discontinuities if the time is changed using ``settimeofday()`` or " "similar." msgstr "" -"這允許應用程式獲取一個能夠感知暫停的單調時鐘,而無需處" +"這允許應用程式取得一個能夠感知暫停的單調時鐘,而無需處" "理 :data:`CLOCK_REALTIME` 的複雜情況,後者在使用 ``settimeofday()`` 或類似函" "式更改時間時可能會出現不連續的情況。" @@ -1601,7 +1601,7 @@ msgid "" "The system must have a current leap second table in order for this to give " "the correct answer. PTP or NTP software can maintain a leap second table." msgstr "" -"系統必須擁有當前的閏秒表才能給出正確答案。PTP 或 NTP 軟體可以維護閏秒表。" +"系統必須擁有目前的閏秒表才能給出正確答案。PTP 或 NTP 軟體可以維護閏秒表。" #: ../../library/time.rst:938 msgid "Thread-specific CPU-time clock." @@ -1694,7 +1694,7 @@ msgstr "" "對於上述時區常數(:data:`altzone`、:data:`daylight`、:data:`timezone` " "和 :data:`tzname`),其值由模組載入時或 :func:`tzset` 最後一次被呼叫時的時區" "規則決定,且過去的時間可能會不準確。建議使用 :func:`localtime` 回傳" -"的 :attr:`~struct_time.tm_gmtoff` 和 :attr:`~struct_time.tm_zone` 來獲取時區" +"的 :attr:`~struct_time.tm_gmtoff` 和 :attr:`~struct_time.tm_zone` 來取得時區" "資訊。" #: ../../library/time.rst:1026 diff --git a/library/timeit.po b/library/timeit.po index 4b5e7eb49d..89f2f6c5da 100644 --- a/library/timeit.po +++ b/library/timeit.po @@ -621,7 +621,7 @@ msgid "" "will cause the code to be executed within your current global namespace. " "This can be more convenient than individually specifying imports::" msgstr "" -"另一種選擇是將 :func:`globals` 傳遞給 *globals* 參數,這將導致程式碼在當前的" +"另一種選擇是將 :func:`globals` 傳遞給 *globals* 參數,這將導致程式碼在目前的" "全域命名空間中執行,這比單獨指定 import 更方便: ::" #: ../../library/timeit.rst:373 diff --git a/library/typing.po b/library/typing.po index 909335de57..2c0ecd3181 100644 --- a/library/typing.po +++ b/library/typing.po @@ -1602,7 +1602,7 @@ msgstr "新增 :data:`Never`。" #: ../../library/typing.rst:984 msgid "Special type to represent the current enclosed class." -msgstr "特別型別,用來表示當前類別之內 (enclosed class)。" +msgstr "特別型別,用來表示目前類別之內 (enclosed class)。" #: ../../library/typing.rst:988 msgid "" diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 720ca6deba..b01f99b930 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -109,7 +109,7 @@ msgid "" "that don't exist on the spec will fail with an :exc:`AttributeError`." msgstr "" "Mock 有許多其他方法可以讓你配置與控制它的行為。例如,*spec* 引數可以配置 " -"mock ,讓其從另一個物件獲取規格。嘗試讀取 mock 中不存在於規格中的屬性或方法將" +"mock ,讓其從另一個物件取得規格。嘗試讀取 mock 中不存在於規格中的屬性或方法將" "會失敗,並出現 :exc:`AttributeError`。" #: ../../library/unittest.mock.rst:97 @@ -670,9 +670,9 @@ msgid "" "is any keyword arguments (or an empty dictionary)." msgstr "" "這會是 ``None``\\ (如果 mock 尚未被呼叫),或是 mock 上次被呼叫時使用的引" -"數。這將以元組的形式呈現:第一個成員 (member),其可以通過 ``args`` 屬性訪問," +"數。這將以元組的形式呈現:第一個成員 (member),其可以通過 ``args`` 屬性存取," "是 mock 被呼叫時傳遞的所有有序引數(或一個空元組)。第二個成員,其可以通過 " -"``kwargs`` 屬性訪問,是所有關鍵字引數(或一個空字典)。" +"``kwargs`` 屬性存取,是所有關鍵字引數(或一個空字典)。" #: ../../library/unittest.mock.rst:649 msgid "" @@ -683,7 +683,7 @@ msgid "" msgstr "" ":attr:`call_args`,以及串列 :attr:`call_args_list`、:attr:`method_calls` 和 :" "attr:`mock_calls` 的成員都是 :data:`call` 物件。這些都是元組,因此可以解包以" -"獲取各個引數並進行更複雜的斷言。參見 :ref:`calls as tuples <calls-as-" +"取得各個引數並進行更複雜的斷言。參見 :ref:`calls as tuples <calls-as-" "tuples>`。" #: ../../library/unittest.mock.rst:655 @@ -1975,7 +1975,7 @@ msgid "" "plus iterating over keys." msgstr "" "*in_dict* 可以是一個字典或一個類對映的容器。如果它是一個對映,那麼它至少必須" -"支援獲取、設定、刪除項目以及對鍵的疊代。" +"支援取得、設定、刪除項目以及對鍵的疊代。" #: ../../library/unittest.mock.rst:1647 msgid "" @@ -2058,7 +2058,7 @@ msgid "" "__iter__` or :meth:`~object.__contains__`." msgstr "" ":func:`patch.dict` 可以與實際上不是字典的類字典物件一起使用。最低限度它們必須" -"支援項目的獲取、設定、刪除以及疊代或隸屬資格檢測。這對應到魔術方法中的 :meth:" +"支援項目的取得、設定、刪除以及疊代或隸屬資格檢測。這對應到魔術方法中的 :meth:" "`~object.__getitem__`、:meth:`~object.__setitem__`、:meth:`~object." "__delitem__` 以及 :meth:`~container.__iter__` 或 :meth:`~object." "__contains__`。" diff --git a/library/urllib.robotparser.po b/library/urllib.robotparser.po index 0d17e17856..7f42925a3f 100644 --- a/library/urllib.robotparser.po +++ b/library/urllib.robotparser.po @@ -81,7 +81,7 @@ msgstr "" #: ../../library/urllib.robotparser.rst:57 msgid "" "Sets the time the ``robots.txt`` file was last fetched to the current time." -msgstr "將最近一次 fetch ``robots.txt`` 文件的時間設置為當前時間。" +msgstr "將最近一次 fetch ``robots.txt`` 文件的時間設置為目前時間。" #: ../../library/urllib.robotparser.rst:62 msgid "" diff --git a/library/uuid.po b/library/uuid.po index e3274d2fbf..b8dc932c93 100644 --- a/library/uuid.po +++ b/library/uuid.po @@ -58,7 +58,7 @@ msgid "" "enumeration:" msgstr "" "根據底層平台的支援情況,:func:`uuid1` 可能會也可能不會回傳一個「安全的」" -"UUID。安全的 UUID 是使用同步方法生成的,以確保不會有兩個行程獲取到相同的 " +"UUID。安全的 UUID 是使用同步方法生成的,以確保不會有兩個行程取得到相同的 " "UUID。所有 :class:`UUID` 的實例都有一個 :attr:`~UUID.is_safe` 屬性,該屬性使" "用下面這個列舉來傳遞有關 UUID 安全性的任何資訊:" @@ -256,7 +256,7 @@ msgid "" "locally administered MAC addresses, but with no other ordering guarantees." msgstr "" "取得 48 位元正整數形式的硬體位址。第一次執行時,有可能會啟動一個獨立的程式," -"這也許會相當耗時。如果所有獲取硬體位址的嘗試都失敗,我們會根據 :rfc:`4122` 中" +"這也許會相當耗時。如果所有取得硬體位址的嘗試都失敗,我們會根據 :rfc:`4122` 中" "的建議,使用一個 48 位元的隨機數,其中群播位元 (multicast bit)(第一個八位元" "組的最低有效位)設置為 1。「硬體位址」指的是網路介面 (network interface) 的 " "MAC 位址。在具有多個網路介面的機器上,將優先選擇通用管理 (universally " @@ -280,8 +280,8 @@ msgid "" "If *clock_seq* is given, it is used as the sequence number; otherwise a " "random 14-bit sequence number is chosen." msgstr "" -"從主機 ID、序列號和當前時間生成 UUID。如果未給定 *node*,將使用 :func:" -"`getnode` 獲取硬體位址。如果給定 *clock_seq*,會將其用作序列號;否則將使用一" +"從主機 ID、序列號和目前時間生成 UUID。如果未給定 *node*,將使用 :func:" +"`getnode` 取得硬體位址。如果給定 *clock_seq*,會將其用作序列號;否則將使用一" "個隨機 14 位元的序列號。" #: ../../library/uuid.rst:197 diff --git a/library/venv.po b/library/venv.po index 0ed5da76cd..d3bcb61ca0 100644 --- a/library/venv.po +++ b/library/venv.po @@ -316,7 +316,7 @@ msgid "" "Unless the ``--without-pip`` option is given, :mod:`ensurepip` will be " "invoked to bootstrap ``pip`` into the virtual environment." msgstr "" -"除非 ``--without-pip`` 選項被提供,否則將調用 :mod:`ensurepip` 來啟動 " +"除非 ``--without-pip`` 選項被提供,否則將叫用 :mod:`ensurepip` 來啟動 " "``pip`` 到虛擬環境中。" #: ../../library/venv.rst:182 @@ -358,7 +358,7 @@ msgid "" msgstr "" "虛擬環境可以透過位於二進位檔案目錄中的腳本「啟用」(在 POSIX 上為 ``bin``;" "在 Windows 上為 ``Scripts``)這會將該目錄加入到你的 :envvar:`PATH`,當你運" -"行 :program:`python` 時就會調用該環境的直譯器並且執行已安裝的腳本,而不需要使" +"行 :program:`python` 時就會叫用該環境的直譯器並且執行已安裝的腳本,而不需要使" "用完整的路徑。啟動腳本的方式因平台而異(:samp:`{<venv>}` 需要替換成包含虛擬環" "境的目錄路徑)" @@ -447,7 +447,7 @@ msgid "" "invoking Python. Furthermore, all scripts installed in the environment " "should be runnable without activating it." msgstr "" -"你不用特別開啟虛擬環境,你可以在調用 Python 時指定該環境下 Python 直譯器的完" +"你不用特別開啟虛擬環境,你可以在呼叫 Python 時指定該環境下 Python 直譯器的完" "整路徑。此外,所有安裝在環境裡的腳本都應該都可以在未啟用虛擬環境的情況下運" "行。" @@ -583,7 +583,7 @@ msgid "" "current directory is used as the prompt." msgstr "" "*prompt* -- 為一個 String(字串),該字串會在虛擬環境啟動時被使用。(預設為 " -"``None``,代表該環境的目錄名稱會被使用)倘若出現特殊字串 ``\".\"`` ,則當前目" +"``None``,代表該環境的目錄名稱會被使用)倘若出現特殊字串 ``\".\"`` ,則目前目" "錄的 basename 會做為提示路徑使用。" #: ../../library/venv.rst:313 diff --git a/library/weakref.po b/library/weakref.po index 3325dd9142..b1adbed3a3 100644 --- a/library/weakref.po +++ b/library/weakref.po @@ -507,7 +507,7 @@ msgid "" "replaced by :const:`None`." msgstr "" "當模組的 globals 可能被 :const:`None` 取代時,最終化器永遠不會在 :term:" -"`interpreter shutdown` 的後期調用(invoke)其回呼。" +"`interpreter shutdown` 的後期叫用(invoke)其回呼。" #: ../../library/weakref.rst:296 msgid "" @@ -598,7 +598,7 @@ msgid "" "if it still exists, by calling it:" msgstr "" "弱參照物件除了 :attr:`ref.__callback__` 之外沒有任何方法和屬性。弱參照物件允" -"許透過呼叫來獲取參照目標(如果它仍然存在):" +"許透過呼叫來取得參照目標(如果它仍然存在):" #: ../../library/weakref.rst:380 msgid "" @@ -741,7 +741,7 @@ msgstr "" msgid "" "The finalizer can be called directly as well. However the finalizer will " "invoke the callback at most once." -msgstr "最終化器也可以直接被呼叫。然而,最終化器最多會調用回呼一次。" +msgstr "最終化器也可以直接被呼叫。然而,最終化器最多會叫用回呼一次。" #: ../../library/weakref.rst:497 msgid "" diff --git a/library/wsgiref.po b/library/wsgiref.po index 240292a6a8..209ca691ff 100644 --- a/library/wsgiref.po +++ b/library/wsgiref.po @@ -86,8 +86,8 @@ msgid "" msgstr "" "這個模組提供許多用於處理 WSGI 環境運作的功能。WSGI 環境是一個包含 HTTP 請求變" "數的字典,如 :pep:`3333` 所述。所有接受 *environ* 的參數的函式都需要提供符合 " -"WSGI 標準的字典;請參閱 :pep:`3333` 獲取詳細規格,以及 :data:`~wsgiref.types." -"WSGIEnvironment` 獲取可用於使用型別註釋的型別別名。" +"WSGI 標準的字典;請參閱 :pep:`3333` 取得詳細規格,以及 :data:`~wsgiref.types." +"WSGIEnvironment` 取得可用於使用型別註釋的型別別名。" #: ../../library/wsgiref.rst:56 msgid "" @@ -273,7 +273,7 @@ msgid "" "`close` method when called." msgstr "" "如果 *filelike* 有 :meth:`close` 方法,則回傳的物件也會具有 :meth:`close` 方" -"法,並在呼叫時呼叫 *filelike* 物件的 :meth:`close` 方法。" +"法,並在呼叫時叫用 *filelike* 物件的 :meth:`close` 方法。" #: ../../library/wsgiref.rst:172 msgid "" @@ -451,7 +451,7 @@ msgstr "" "這個模組實作一個簡單的的 HTTP 伺服器(基於 :mod:`http.server`)用於提供 WSGI " "應用程式。每個伺服器執行個體在特定的主機與埠提供單一的 WSGI 應用程式。如果你" "想要在單一主機與埠上提供多個應用程式,你應該建立一個 WSGI 應用程式以剖析 " -"``PATH_INFO`` 去選擇為每個請求呼叫哪個應用程式。(例如,使用來自 :mod:" +"``PATH_INFO`` 去選擇為每個請求叫用哪個應用程式。(例如,使用來自 :mod:" "`wsgiref.util` 的 :func:`shift_path_info` 函式。)" #: ../../library/wsgiref.rst:288 @@ -720,7 +720,7 @@ msgid "" msgstr "" "這是基於 CGI 的呼叫方式並透過 ``sys.stdin``、``sys.stdout``、``sys.stderr`` " "和 ``os.environ``。當你擁有一個 WSGI 應用程式並希望將其作為 CGI 腳本運行時是" -"很有用的。只需呼叫 ``CGIHandler().run(app)``,其中 ``app`` 是你希望呼叫的 " +"很有用的。只需叫用 ``CGIHandler().run(app)``,其中 ``app`` 是你希望叫用的 " "WSGI 應用程式物件。" #: ../../library/wsgiref.rst:470 @@ -732,7 +732,7 @@ msgid "" msgstr "" "這個類別是 :class:`BaseCGIHandler` 的子類別將 ``wsgi.run_once`` 設置為 true," "``wsgi.multithread`` 設置為 false,並將 ``wsgi.multiprocess`` 設置為 true,並" -"且始終使用 :mod:`sys` 和 :mod:`os` 來獲取所需的 CGI 串流以及環境。" +"且始終使用 :mod:`sys` 和 :mod:`os` 來取得所需的 CGI 串流以及環境。" #: ../../library/wsgiref.rst:478 msgid "" @@ -779,7 +779,7 @@ msgid "" msgstr "" "CGI 程式碼無法知道是否已設置該選項,因此提供了一個獨立的處理程式(handler)類" "別。它的使用方式與 :class:`CGIHandler` 相同,即透過呼叫 ``IISCGIHandler()." -"run(app)`` 來使用,其中 ``app`` 是你希望呼叫的 WSGI 應用程式物件。" +"run(app)`` 來使用,其中 ``app`` 是你希望叫用的 WSGI 應用程式物件。" #: ../../library/wsgiref.rst:504 msgid "" @@ -865,7 +865,7 @@ msgid "" "the process of running the application, and thus exist primarily to allow " "customizing the process." msgstr "" -"此方法在運行應用程式的過程中呼叫了所有其他 :class:`BaseHandler` 的方法,因此" +"此方法在運行應用程式的過程中叫用了所有其他 :class:`BaseHandler` 的方法,因此" "這些方法主要存在是為了允許自定義整個過程。" #: ../../library/wsgiref.rst:553 @@ -897,7 +897,7 @@ msgid "" "suitable for use as the ``wsgi.input`` of the request currently being " "processed." msgstr "" -"回傳一個與 :class:`~wsgiref.types.InputStream` 相容的物件並適用於用作當前正在" +"回傳一個與 :class:`~wsgiref.types.InputStream` 相容的物件並適用於用作目前正在" "處理請求的 ``wsgi.input``。" #: ../../library/wsgiref.rst:579 @@ -906,14 +906,14 @@ msgid "" "suitable for use as the ``wsgi.errors`` of the request currently being " "processed." msgstr "" -"回傳一個與 :class:`~wsgiref.types.ErrorStream` 相容的物件並適用於用作當前正在" +"回傳一個與 :class:`~wsgiref.types.ErrorStream` 相容的物件並適用於用作目前正在" "處理請求的 ``wsgi.errors``。" #: ../../library/wsgiref.rst:586 msgid "" "Insert CGI variables for the current request into the :attr:`environ` " "attribute." -msgstr "將當前請求的 CGI 變數插入到 :attr:`environ` 屬性中。" +msgstr "將目前請求的 CGI 變數插入到 :attr:`environ` 屬性中。" #: ../../library/wsgiref.rst:588 msgid "" @@ -998,7 +998,7 @@ msgid "" "util` to guess whether the scheme should be \"http\" or \"https\", based on " "the current request's :attr:`environ` variables." msgstr "" -"回傳用於當前請求的 URL scheme。預設的實作使用 :mod:`wsgiref.util` 中的 :func:" +"回傳用於目前請求的 URL scheme。預設的實作使用 :mod:`wsgiref.util` 中的 :func:" "`guess_scheme` 函式去猜測 scheme 是 \"http\" 或是 \"https\",基於目前請求的 :" "attr:`environ` 變數。" @@ -1049,7 +1049,7 @@ msgid "" "It is only invoked if an error occurs before headers are sent to the client." msgstr "" "這個方法是一個為使用者去產生錯誤頁面的 WSGI 應用程式。只有在標頭傳送給用戶端" -"前如果發生錯誤才會被呼叫。" +"前如果發生錯誤才會被叫用。" #: ../../library/wsgiref.rst:680 msgid "" @@ -1057,7 +1057,7 @@ msgid "" "should pass that information to *start_response* when calling it (as " "described in the \"Error Handling\" section of :pep:`3333`)." msgstr "" -"此方法使用 ``sys.exception()`` 存取當前的錯誤,當呼叫它(如 :pep:`3333` 的 " +"此方法使用 ``sys.exception()`` 存取目前的錯誤,當呼叫它(如 :pep:`3333` 的 " "\"Error Handling\" 部分所描述)時應該傳遞資訊給 *start_response*。" #: ../../library/wsgiref.rst:684 @@ -1290,7 +1290,7 @@ msgid "" "Example of a WSGI application serving the current directory, accept optional " "directory and port number (default: 8000) on the command line::" msgstr "" -"提供當前目錄的 WSGI 應用程式範例,並接受命令列上的可選目錄和埠號(預設:" +"提供目前目錄的 WSGI 應用程式範例,並接受命令列上的可選目錄和埠號(預設:" "8000): ::" #: ../../library/wsgiref.rst:851 diff --git a/library/xmlrpc.po b/library/xmlrpc.po index 00defcf838..67ae4e4fe6 100644 --- a/library/xmlrpc.po +++ b/library/xmlrpc.po @@ -31,7 +31,7 @@ msgid "" msgstr "" "XML-RPC 是一種遠端程序呼叫 (Remote Procedure Call) 方法,它使用通過 HTTP 傳輸" "(transport)的 XML 來做傳遞。有了它,用戶端可以在遠端伺服器上呼叫帶有參數的" -"方法(伺服器以 URI 命名)並獲取結構化的資料。" +"方法(伺服器以 URI 命名)並取得結構化的資料。" #: ../../library/xmlrpc.rst:11 msgid "" diff --git a/library/zlib.po b/library/zlib.po index d2c292664d..e560901d86 100644 --- a/library/zlib.po +++ b/library/zlib.po @@ -508,7 +508,7 @@ msgid "" "up random seeks into the stream at a future point." msgstr "" "回傳解壓物件的副本,這可用於在資料串流中途保存解壓縮器的狀態,以便在未來某個" -"時間點加速對串流的隨機搜索 (random seek)。" +"時間點加速對串流的隨機搜尋 (random seek)。" #: ../../library/zlib.rst:310 msgid "" diff --git a/reference/datamodel.po b/reference/datamodel.po index ab96edc064..0e961eb661 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -4881,7 +4881,7 @@ msgstr "call(呼叫)" #: ../../reference/datamodel.rst:519 msgid "invocation" -msgstr "invocation(調用)" +msgstr "invocation(呼叫)" #: ../../reference/datamodel.rst:519 msgid "argument" diff --git a/reference/import.po b/reference/import.po index 54ab4c6fff..488f09805c 100644 --- a/reference/import.po +++ b/reference/import.po @@ -31,9 +31,9 @@ msgid "" "`__import__` can also be used to invoke the import machinery." msgstr "" "一個 :term:`module` 中的 Python 程式碼透過 :term:`importing` 的過程來存取另一" -"個模組中的程式碼。:keyword:`import` 陳述式是調用 (invoke) 引入機制最常見的方" +"個模組中的程式碼。:keyword:`import` 陳述式是叫用 (invoke) 引入機制最常見的方" "法,但這不是唯一的方法。函式如 :func:`importlib.import_module` 以及內建函式 :" -"func:`__import__` 也可以用來調用引入機制。" +"func:`__import__` 也可以用來叫用引入機制。" #: ../../reference/import.rst:16 msgid "" @@ -73,7 +73,7 @@ msgid "" "`__import__` and use their own solutions to implement import semantics." msgstr "" "當執行 :keyword:`import` 陳述式時,會呼叫內建的 :func:`__import__` 函式。其他" -"調用引入系統的機制(如 :func:`importlib.import_module`)可以選擇略過 :func:" +"叫用引入系統的機制(如 :func:`importlib.import_module`)可以選擇略過 :func:" "`__import__`,並使用它們自己的解決方案來實作引入語意。" #: ../../reference/import.rst:36 @@ -87,7 +87,7 @@ msgid "" msgstr "" "當模組首次被引入時,Python 會搜尋該模組,若找到則會建立一個模組物件 " "[#fnmo]_,並對其進行初始化。如果找不到指定的模組,則會引發 :exc:" -"`ModuleNotFoundError`。當引入機制被調用時,Python 會實作各種策略來搜尋指定的" +"`ModuleNotFoundError`。當引入機制被叫用時,Python 會實作各種策略來搜尋指定的" "模組。這些策略可以透過使用以下章節描述的各種 hook(掛鉤)來修改和擴展。" #: ../../reference/import.rst:43 @@ -115,7 +115,7 @@ msgid "" msgstr "" ":mod:`importlib` 模組提供了豐富的 API 來與引入系統互動。例如,:func:" "`importlib.import_module` 提供了一個比內建的 :func:`__import__` 更推薦且更簡" -"單的 API 來調用引入機制。更多詳細資訊請參閱 :mod:`importlib` 函式庫文件。" +"單的 API 來叫用引入機制。更多詳細資訊請參閱 :mod:`importlib` 函式庫文件。" #: ../../reference/import.rst:62 msgid "Packages" @@ -385,7 +385,7 @@ msgid "" "they return themselves when they find that they can load the requested " "module." msgstr "" -"如果在 :data:`sys.modules` 中找不到指定的模組,則會調用 Python 的引入協定來尋" +"如果在 :data:`sys.modules` 中找不到指定的模組,則會叫用 Python 的引入協定來尋" "找並載入該模組。這個協定由兩個概念性物件組成,:term:`尋檢器 <finder>` 和\\ :" "term:`載入器 <loader>`。尋檢器的任務是使用其已知的策略來確定是否能找到命名模" "組。實作這兩個介面的物件稱為\\ :term:`引入器 (importer) <importer>` ——當它們" diff --git a/reference/toplevel_components.po b/reference/toplevel_components.po index 11726a155b..6e725c7a03 100644 --- a/reference/toplevel_components.po +++ b/reference/toplevel_components.po @@ -50,7 +50,7 @@ msgid "" "`__main__`. The latter is used to provide the local and global namespace " "for execution of the complete program." msgstr "" -"雖然語言規範描述不必規定語言直譯器是如何被調用(invoke)的,但對完整的 " +"雖然語言規範描述不必規定語言直譯器是如何被叫用(invoke)的,但對完整的 " "Python 程式加以說明還是很有用的。一個完整的 Python 程式會在最小初始化環境中被" "執行:所有內建和標準模組均為可用,但均處於未初始化狀態,只有 :mod:`sys`\\ " "(各種系統服務)、:mod:`builtins`\\ (內建函式、例外和 ``None``)和 :mod:" @@ -71,7 +71,7 @@ msgid "" "identical to that of a complete program; each statement is executed in the " "namespace of :mod:`__main__`." msgstr "" -"直譯器也可以透過互動模式被調用;在此情況下,它並不讀取和執行一個完整程式,而" +"直譯器也可以透過互動模式被叫用;在此情況下,它並不讀取和執行一個完整程式,而" "是每讀取一條陳述式就執行一次(可能為複合陳述式)。此時的初始環境與一個完整程" "式的相同;每條陳述式會在 :mod:`__main__` 的命名空間中被執行。" @@ -109,7 +109,7 @@ msgstr "剖析一個模組時;" #: ../../reference/toplevel_components.rst:78 msgid "when parsing a string passed to the :func:`exec` function;" -msgstr "剖析一個傳遞给 :func:`exec` 函数的字串時;" +msgstr "剖析一個傳遞给 :func:`exec` 函數的字串時;" #: ../../reference/toplevel_components.rst:84 msgid "Interactive input" diff --git a/sphinx.po b/sphinx.po index 58dbb67f14..8faa0df8d2 100644 --- a/sphinx.po +++ b/sphinx.po @@ -521,7 +521,7 @@ msgstr "這份說明文件是寫給一個不再被支援的舊版 Python。你 #: ../../tools/templates/layout.html:8 msgid "Python documentation for the current stable release" -msgstr "當前穩定發行的 Python 版本說明文件" +msgstr "目前穩定發行的 Python 版本說明文件" #: ../../tools/templates/layout.html:14 msgid "" @@ -535,4 +535,4 @@ msgstr "" #: ../../tools/templates/layout.html:16 msgid "the current stable release" -msgstr "當前的穩定發行版" +msgstr "目前的穩定發行版" diff --git a/tutorial/appendix.po b/tutorial/appendix.po index e96743c902..d2261fcbfd 100644 --- a/tutorial/appendix.po +++ b/tutorial/appendix.po @@ -188,7 +188,7 @@ msgid "" "want to use the startup file in a script, you must do this explicitly in the " "script::" msgstr "" -"如果你想從當前目錄中讀取一個額外的啟動檔案,你可以在全域啟動檔案中使用類似 " +"如果你想從目前目錄中讀取一個額外的啟動檔案,你可以在全域啟動檔案中使用類似 " "``if os.path.isfile('.pythonrc.py'): exec(open('.pythonrc.py').read()`` 的程" "式碼設定這個行為。如果你想在一個腳本中使用啟動檔案,你必須在腳本中明確地這樣" "做: ::" diff --git a/tutorial/classes.po b/tutorial/classes.po index 491479937b..388fa0b934 100644 --- a/tutorial/classes.po +++ b/tutorial/classes.po @@ -159,7 +159,7 @@ msgstr "" "*命名空間*\\ 是從名稱到物件的對映。大部分的命名空間現在都是以 Python 的 " "dictionary 被實作,但通常不會以任何方式被察覺(除了性能),且它可能會在未來改" "變。命名空間的例子有:內建名稱的集合(包含如 :func:`abs` 的函式,和內建的例外" -"名稱);模組中的全域 (global) 名稱;和在函式調用中的區域 (local) 名稱。某種意" +"名稱);模組中的全域 (global) 名稱;和在函式呼叫中的區域 (local) 名稱。某種意" "義上,物件中的屬性集合也會形成一個命名空間。關於命名空間的重要一點是,不同命" "名空間中的名稱之間絕對沒有關係;舉例來說,兩個不一樣的模組都可以定義一個 " "``maximize`` 函式而不會混淆——模組的使用者必須為它加上前綴 (prefix) 模組名稱。" @@ -209,7 +209,7 @@ msgstr "" "命名空間在不同的時刻被建立,並且有不同的壽命。當 Python 直譯器啟動時,含有內" "建名稱的命名空間會被建立,並且永遠不會被刪除。當模組定義被讀入時,模組的全域" "命名空間會被建立;一般情況下,模組的命名空間也會持續到直譯器結束。被直譯器的" -"頂層調用 (top-level invocation) 執行的陳述式,不論是從腳本檔案讀取的或是互動" +"頂層呼叫 (top-level invocation) 執行的陳述式,不論是從腳本檔案讀取的或是互動" "模式中的,會被視為一個稱為 :mod:`__main__` 的模組的一部分,因此它們具有自己的" "全域命名空間。(內建名稱實際上也存在一個模組中,它被稱為 :mod:`builtins`。)" @@ -223,7 +223,7 @@ msgid "" msgstr "" "函式的區域命名空間是在呼叫函式時建立的,而當函式返回,或引發了未在函式中處理" "的例外時,此命名空間將會被刪除。(實際上,忘記是描述實際發生的事情的更好方" -"法。) 當然,每個遞迴調用 (recursive invocation) 都有自己的區域命名空間。" +"法。) 當然,每個遞迴呼叫 (recursive invocation) 都有自己的區域命名空間。" #: ../../tutorial/classes.rst:112 msgid "" @@ -258,7 +258,7 @@ msgstr "" #: ../../tutorial/classes.rst:123 msgid "the next-to-last scope contains the current module's global names" -msgstr "倒數第二個作用域,包含當前模組的全域名稱" +msgstr "倒數第二個作用域,包含目前模組的全域名稱" #: ../../tutorial/classes.rst:124 msgid "" @@ -289,7 +289,7 @@ msgid "" "namespace as the global scope: the module's namespace. Class definitions " "place yet another namespace in the local scope." msgstr "" -"通常,區域作用域會參照(文本的)當前函式的區域名稱。在函式外部,區域作用域與" +"通常,區域作用域會參照(文本的)目前函式的區域名稱。在函式外部,區域作用域與" "全域作用域參照相同的命名空間:模組的命名空間。然而,Class definition 會在區域" "作用域中放置另一個命名空間。" @@ -587,7 +587,7 @@ msgid "" "by::" msgstr "" "當 class 定義了 :meth:`~object.__init__` method,class 實例化會為新建的 " -"class 實例自動調用 :meth:`!__init__`。所以在這個範例中,一個新的、初始化的實" +"class 實例自動叫用 :meth:`!__init__`。所以在這個範例中,一個新的、初始化的實" "例可以如此獲得: ::" #: ../../tutorial/classes.rst:305 @@ -1324,7 +1324,7 @@ msgstr "" "突),這種機制也存在另一個有限的支援,稱為 :dfn:`name mangling`\\ (名稱修" "飾)。任何格式為 ``__spam``\\ (至少兩個前導下底線,最多一個尾隨下底線)的物" "件名稱 (identifier) 會被文本地被替換為 ``_classname__spam``,在此 " -"``classname`` 就是去掉前導下底線的當前 class 名稱。只要這個修飾是在 class 的" +"``classname`` 就是去掉前導下底線的目前 class 名稱。只要這個修飾是在 class 的" "定義之中發生,它就會在不考慮該物件名稱的語法位置的情況下完成。" #: ../../tutorial/classes.rst:693 @@ -1394,8 +1394,8 @@ msgid "" "applies to ``getattr()``, ``setattr()`` and ``delattr()``, as well as when " "referencing ``__dict__`` directly." msgstr "" -"另外也注意,傳遞給 ``exec()`` 或 ``eval()`` 的程式碼不會把調用 class 的名稱視" -"為當前的 class;這和 ``global`` 陳述式的效果類似,該效果同樣僅限於整體被位元" +"另外也注意,傳遞給 ``exec()`` 或 ``eval()`` 的程式碼不會把叫用 class 的名稱視" +"為目前的 class;這和 ``global`` 陳述式的效果類似,該效果同樣僅限於整體被位元" "組編譯後 (byte-compiled) 的程式碼。同樣的限制適用於 ``getattr()``," "``setattr()`` 和 ``delattr()``,以及直接參照 ``__dict__`` 時。" diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index b4bf143460..c7f1d387e4 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -119,7 +119,7 @@ msgid "" "can be tricky to get right. Instead, it is usually more straight-forward to " "loop over a copy of the collection or to create a new collection::" msgstr "" -"在疊代一個集合的同時修改該集合的內容,很難獲取想要的結果。比較直觀的替代方" +"在疊代一個集合的同時修改該集合的內容,很難取得想要的結果。比較直觀的替代方" "式,是疊代該集合的副本,或建立一個新的集合: ::" #: ../../tutorial/controlflow.rst:76 @@ -271,7 +271,7 @@ msgid "" "that takes an iterable is :func:`sum`::" msgstr "" "我們稱這樣的物件為 :term:`iterable`\\ (可疊代物件),意即能作為函式及架構中" -"可以一直獲取項目直到取盡的對象。我們已經了解 :keyword:`for` 陳述式就是如此的" +"可以一直取得項目直到取盡的對象。我們已經了解 :keyword:`for` 陳述式就是如此的" "架構,另一個使用 iterable 的函式範例是 :func:`sum`: ::" #: ../../tutorial/controlflow.rst:154 @@ -405,7 +405,7 @@ msgstr "" msgid "" "This is exemplified in the following :keyword:`!for` loop, which searches " "for prime numbers::" -msgstr "下面的 :keyword:`!for` 迴圈對此進行了舉例說明,該迴圈用以搜索質數: ::" +msgstr "下面的 :keyword:`!for` 迴圈對此進行了舉例說明,該迴圈用以搜尋質數: ::" #: ../../tutorial/controlflow.rst:221 msgid "" @@ -981,7 +981,7 @@ msgid "" "to by that name as a user-defined function. Other names can also point to " "that same function object and can also be used to access the function::" msgstr "" -"函式定義時,會把該函式名稱加入至當前的符號表。函式名稱的值帶有一個型別,並被" +"函式定義時,會把該函式名稱加入至目前的符號表。函式名稱的值帶有一個型別,並被" "直譯器辨識為使用者自定函式 (user-defined function)。該值可以被指定給別的變數" "名,使該變數名也可以被當作函式使用。這是常見的重新命名方式: ::" diff --git a/tutorial/inputoutput.po b/tutorial/inputoutput.po index 860e9deca2..229b4c9c4b 100644 --- a/tutorial/inputoutput.po +++ b/tutorial/inputoutput.po @@ -878,7 +878,7 @@ msgid "" "the file represented as number of bytes from the beginning of the file when " "in binary mode and an opaque number when in text mode." msgstr "" -"``f.tell()`` 回傳一個整數,它給出檔案物件在檔案中的當前位置,在二進制模式下表" +"``f.tell()`` 回傳一個整數,它給出檔案物件在檔案中的目前位置,在二進制模式下表" "示為檔案開始至今的位元組數,在文字模式下表示為一個意義不明的數字。" #: ../../tutorial/inputoutput.rst:455 @@ -893,7 +893,7 @@ msgid "" msgstr "" "使用 ``f.seek(offset, whence)`` 可以改變檔案物件的位置。位置計算方法是從一個" "參考點增加 *offset* 的偏移量;參考點則由引數 *whence* 來選擇。當 *whence* 值" -"為 0 時,表示使用檔案開頭,1 表示使用當前的檔案位置,2 表示使用檔案末端作為參" +"為 0 時,表示使用檔案開頭,1 表示使用目前的檔案位置,2 表示使用檔案末端作為參" "考點。*whence* 可省略,其預設值為 0,即以檔案開頭作為參考點。 ::" #: ../../tutorial/inputoutput.rst:462 diff --git a/tutorial/interactive.po b/tutorial/interactive.po index c7d64f4e81..87c287b2c8 100644 --- a/tutorial/interactive.po +++ b/tutorial/interactive.po @@ -32,7 +32,7 @@ msgid "" "library, which supports various styles of editing. This library has its own " "documentation which we won't duplicate here." msgstr "" -"有些版本的 Python 直譯器支援當前輸入內容的編輯和歷史記錄的替換 (history " +"有些版本的 Python 直譯器支援目前輸入內容的編輯和歷史記錄的替換 (history " "substitution),類似在 Korn shell 和 GNU Bash shell 中的功能。這個功能是用 " "`GNU Readline`_ 函式庫來實作,它支援多種編輯的風格。這個函式庫有它自己的說明" "文件,在這裡我們就不重複了。" @@ -56,8 +56,8 @@ msgid "" "during the next interactive interpreter session." msgstr "" "在直譯器啟動的時候,變數和模組名稱的自動完成功能會被\\ :ref:`自動啟用 " -"<rlcompleter-config>`,所以可以用 :kbd:`Tab` 鍵來呼叫自動完成函式;它會查看 " -"Python 的陳述式名稱、當前區域變數名稱和可用模組名稱。對於像是 ``string.a`` 的" +"<rlcompleter-config>`,所以可以用 :kbd:`Tab` 鍵來叫用自動完成函式;它會查看 " +"Python 的陳述式名稱、目前區域變數名稱和可用模組名稱。對於像是 ``string.a`` 的" "點分隔運算式 (dotted expression),它會對最後一個 ``'.'`` 之前的運算式求值,然" "後根據求值結果物件的屬性,給予自動完成的建議。請注意,如果一個物件有 :meth:" "`~object.__getattr__` method(方法),同時又是該運算式的一部份,這樣可能會執" diff --git a/tutorial/interpreter.po b/tutorial/interpreter.po index 24379ff4c5..6d744513bd 100644 --- a/tutorial/interpreter.po +++ b/tutorial/interpreter.po @@ -37,7 +37,7 @@ msgid "" "makes it possible to start it by typing the command:" msgstr "" "Python 直譯器一般安裝在 :file:`/usr/local/bin/python3.12` 路徑下;將 :file:`/" -"usr/local/bin` 加入Unix shell 的搜索路徑,輸入以下指令就可以啟動 Python:" +"usr/local/bin` 加入Unix shell 的搜尋路徑,輸入以下指令就可以啟動 Python:" #: ../../tutorial/interpreter.rst:17 #, fuzzy diff --git a/tutorial/modules.po b/tutorial/modules.po index 9a828e3f5e..840d18de5a 100644 --- a/tutorial/modules.po +++ b/tutorial/modules.po @@ -122,7 +122,7 @@ msgid "" "it only adds the module name ``fibo`` there. Using the module name you can " "access the functions::" msgstr "" -"這並不會將 ``fibo`` 中定義的函式名稱直接加入當前的 :term:`namespace` 中(詳情" +"這並不會將 ``fibo`` 中定義的函式名稱直接加入目前的 :term:`namespace` 中(詳情" "請見 :ref:`tut-scopes`);它只會加入 ``fibo`` 的模組名稱。使用此模組名稱,就" "可以存取函式: ::" @@ -404,7 +404,7 @@ msgstr "" msgid "" "The directory containing the input script (or the current directory when no " "file is specified)." -msgstr "輸入腳本所位在的資料夾(如未指定檔案時,則是當前資料夾)。" +msgstr "輸入腳本所位在的資料夾(如未指定檔案時,則是目前資料夾)。" #: ../../tutorial/modules.rst:194 msgid "" @@ -1056,7 +1056,7 @@ msgid "" "this code::" msgstr "" "如果 ``__all__`` 沒有被定義,``from sound.effects import *`` 陳述式\\ *並不會" -"*\\ 把 :mod:`!sound.effects` 套件中所有子模組都 import 到當前的命名空間;它只" +"*\\ 把 :mod:`!sound.effects` 套件中所有子模組都 import 到目前的命名空間;它只" "保證 :mod:`!sound.effects` 套件有被 import(可能會運行 :file:`__init__.py` 中" "的初始化程式碼),然後 import 套件中被定義的全部名稱。這包含 :file:`__init__." "py` 定義(以及被明確載入的子模組)的任何名稱。它也包括任何之前被 :keyword:" @@ -1080,7 +1080,7 @@ msgid "" "also works when ``__all__`` is defined.)" msgstr "" "此例中,當 ``from...import`` 陳述式被執行時,:mod:`!echo` 和 :mod:`!" -"surround` 模組被 import 進當前的命名空間,因為它們是在 :mod:`!sound.effects` " +"surround` 模組被 import 進目前的命名空間,因為它們是在 :mod:`!sound.effects` " "套件裡定義的。(當 ``__all__`` 有被定義時,這規則也有效。)" #: ../../tutorial/modules.rst:550 @@ -1127,7 +1127,7 @@ msgid "" "`!surround` module for example, you might use::" msgstr "" "你也可以用 ``from module import name`` 的 import 陳述式,編寫「相對 " -"(relative) import」。這些 import 使用前導句號指示相對 import 中的當前套件和母" +"(relative) import」。這些 import 使用前導句號指示相對 import 中的目前套件和母" "套件。例如,在 :mod:`!urround` 模組中,你可以使用: ::" #: ../../tutorial/modules.rst:576 diff --git a/tutorial/whatnow.po b/tutorial/whatnow.po index d963db60c2..fdb1401fbd 100644 --- a/tutorial/whatnow.po +++ b/tutorial/whatnow.po @@ -89,7 +89,7 @@ msgstr "" #: ../../tutorial/whatnow.rst:36 msgid "https://docs.python.org: Fast access to Python's documentation." -msgstr "https://docs.python.org:快速訪問 Python 的文件。" +msgstr "https://docs.python.org:快速存取 Python 的文件。" #: ../../tutorial/whatnow.rst:38 msgid "" diff --git a/using/unix.po b/using/unix.po index e787864dc8..b27a082f0f 100644 --- a/using/unix.po +++ b/using/unix.po @@ -117,7 +117,7 @@ msgstr "" #: ../../using/unix.rst:52 msgid "For example i386 users get the 2.5.1 version of Python using::" -msgstr "例如 i386 使用者要獲取 Python 2.5.1 的可用版本: ::" +msgstr "例如 i386 使用者要取得 Python 2.5.1 的可用版本: ::" #: ../../using/unix.rst:54 msgid "" @@ -139,7 +139,7 @@ msgid "" "devguide.python.org/setup/#get-the-source-code>`_. (If you want to " "contribute patches, you will need a clone.)" msgstr "" -"如果你想自己編譯 CPython,首先要做的是獲取\\ `原始碼 <https://www.python.org/" +"如果你想自己編譯 CPython,首先要做的是取得\\ `原始碼 <https://www.python.org/" "downloads/source/>`_。你可以下載最新版本的原始碼,也可以直接提取最新的 `clone" "(克隆) <https://devguide.python.org/setup/#getting-the-source-code>`_。(如" "果你想要貢獻修補程式碼,也會需要一份 clone。)" @@ -272,7 +272,7 @@ msgid "" "However, some Unices may not have the :program:`env` command, so you may " "need to hardcode ``/usr/bin/python3`` as the interpreter path." msgstr "" -"將在整個 :envvar:`PATH` 中搜索 Python 直譯器。然而某些 Unix 系統可能沒有 :" +"將在整個 :envvar:`PATH` 中搜尋 Python 直譯器。然而某些 Unix 系統可能沒有 :" "program:`env` 命令,因此你可能需要將 ``/usr/bin/python3`` 寫死 (hardcode) 成" "直譯器路徑。" diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index 44170c01ff..544e4f9a1f 100644 --- a/whatsnew/3.10.po +++ b/whatsnew/3.10.po @@ -1547,7 +1547,7 @@ msgid "" msgstr "" "函式有一個新的 ``__builtins__`` 屬性,用於在執行函式時查找內建符號,而不是查" "找 ``__globals__['__builtins__']`` 。如果 ``__globals__[\"__builtins__\"]`` " -"存在,則屬性會以此做初始化,否則從當前內建物件 (builtins) 初始化。(由 Mark " +"存在,則屬性會以此做初始化,否則從目前內建物件 (builtins) 初始化。(由 Mark " "Shannon 在 :issue:`42990` 中貢獻。)" #: ../../whatsnew/3.10.rst:844 @@ -1766,7 +1766,7 @@ msgid "" "Add a :func:`codecs.unregister` function to unregister a codec search " "function. (Contributed by Hai Shi in :issue:`41842`.)" msgstr "" -"新增 :func:`codecs.unregister` 函式來取消註冊 (unregister) 一個編解碼器的搜索" +"新增 :func:`codecs.unregister` 函式來取消註冊 (unregister) 一個編解碼器的搜尋" "功能。(Hai Shi 在 :issue:`41842` 中貢獻。)" #: ../../whatsnew/3.10.rst:951 @@ -2122,7 +2122,7 @@ msgid "" "(Contributed by Serhiy Storchaka in :issue:`38144`.)" msgstr "" "在 :func:`~glob.glob` 和 :func:`~glob.iglob` 中新增 *root_dir* 和 *dir_fd* 參" -"數,允許指定搜索的根目錄。(由 Serhiy Storchaka 在 :issue:`38144` 中貢獻。)" +"數,允許指定搜尋的根目錄。(由 Serhiy Storchaka 在 :issue:`38144` 中貢獻。)" #: ../../whatsnew/3.10.rst:1132 msgid "hashlib" @@ -2176,7 +2176,7 @@ msgid "" "hooks were previously ignored. (Contributed by Ken Hilton in :issue:" "`43008`.)" msgstr "" -"讓 IDLE 調用 :func:`sys.excepthook` (在沒有 ``-n`` 的情況下啟動時)。使用者" +"讓 IDLE 叫用 :func:`sys.excepthook` (在沒有 ``-n`` 的情況下啟動時)。使用者" "掛鉤 (user hooks) 在以前是被忽略的。(由 Ken Hilton 在 :issue:`43008` 中貢" "獻。)" @@ -3037,8 +3037,8 @@ msgid "" "algorithm to avoid quadratic behavior on long strings. (Contributed by " "Dennis Sweeney in :issue:`41972`)" msgstr "" -"像是 ``str1 in str2`` 和 ``str2.find(str1)`` 之類的子字串搜索函式現在有時會使" -"用 Crochemore & Perrin 的「雙向」字串搜索演算法來避免作用於長字串上時發生二次" +"像是 ``str1 in str2`` 和 ``str2.find(str1)`` 之類的子字串搜尋函式現在有時會使" +"用 Crochemore & Perrin 的「雙向」字串搜尋演算法來避免作用於長字串上時發生二次" "方行為 (quadratic behavior)。(由 Dennis Sweeney 在 :issue:`41972` 中貢獻)" #: ../../whatsnew/3.10.rst:1590 @@ -3135,7 +3135,7 @@ msgid "" "more information." msgstr "" "整個 ``distutils`` 命名空間已棄用,將在 Python 3.12 中刪除。請參閱\\ :ref:`模" -"組更改 <distutils-deprecated>` 以獲取更多資訊。" +"組更改 <distutils-deprecated>` 以取得更多資訊。" #: ../../whatsnew/3.10.rst:1640 msgid "" @@ -3174,7 +3174,7 @@ msgid "" "exec_module` is preferred. (Contributed by Brett Cannon in :issue:`26131`.)" msgstr "" "引入系統使用 :meth:`~importlib.abc.Loader.load_module` 現在會觸發 :exc:" -"`ImportWarning`,因為 :meth:`~importlib.abc.Loader.exec_module` 是當前首選。" +"`ImportWarning`,因為 :meth:`~importlib.abc.Loader.exec_module` 是目前首選。" "(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" #: ../../whatsnew/3.10.rst:1659 @@ -3560,7 +3560,7 @@ msgid "" "thread's running event loop since Python 3.7. There isn't a need to pass " "the event loop to the API in most normal use cases." msgstr "" -"自 Python 3.7 以來,高階 API 中的函式一直隱式獲取當前執行緒正在運行的事件循" +"自 Python 3.7 以來,高階 API 中的函式一直隱式取得目前執行緒正在運行的事件循" "環。在大多數正常用例中,不需要將事件循環傳遞給 API。" #: ../../whatsnew/3.10.rst:1849 @@ -3711,7 +3711,7 @@ msgid "" "running event loop (e.g. running in another thread's event loop), consider " "using :func:`asyncio.run_coroutine_threadsafe` instead." msgstr "" -"如果 ``foo()`` 被專門設計為 *不* 在當前執行緒的事件循環中運行(例如在另一個執" +"如果 ``foo()`` 被專門設計為 *不* 在目前執行緒的事件循環中運行(例如在另一個執" "行緒的事件循環中運行),請考慮改用 :func:`asyncio.run_coroutine_threadsafe`。" #: ../../whatsnew/3.10.rst:1930 @@ -3725,9 +3725,9 @@ msgid "" "`42990`.)" msgstr "" "如果 *globals* 字典沒有 ``\"__builtins__\"`` 鍵,則 :data:`types." -"FunctionType` 建構函式現在會繼承當前的內建物件,而不是使用 ``{\"None\": None}" +"FunctionType` 建構函式現在會繼承目前的內建物件,而不是使用 ``{\"None\": None}" "``:相同行為如 :func:`eval` 和 :func:`exec` 函式。在 Python 中使用 ``def " -"function(...): ...`` 定義函式不受影響,全域變數不能用此語法覆蓋:它也繼承當前" +"function(...): ...`` 定義函式不受影響,全域變數不能用此語法覆蓋:它也繼承目前" "的內建物件。(由 Victor Stinner 在 :issue:`42990` 中貢獻。)" #: ../../whatsnew/3.10.rst:1939 @@ -4010,7 +4010,7 @@ msgid "" "Add a :c:func:`PyCodec_Unregister` function to unregister a codec search " "function. (Contributed by Hai Shi in :issue:`41842`.)" msgstr "" -"新增 :c:func:`PyCodec_Unregister` 函式來取消註冊編解碼器搜索函式。(由 Hai " +"新增 :c:func:`PyCodec_Unregister` 函式來取消註冊編解碼器搜尋函式。(由 Hai " "Shi 在 :issue:`41842` 中貢獻。)" #: ../../whatsnew/3.10.rst:2074 diff --git a/whatsnew/3.11.po b/whatsnew/3.11.po index 0d18eb3a67..7d0c8517c7 100644 --- a/whatsnew/3.11.po +++ b/whatsnew/3.11.po @@ -364,7 +364,7 @@ msgid "" "\"best\" tag registered for ``OtherPython``, while ``-V:3.11`` or ``-" "V:/3.11`` will select the \"best\" distribution with tag ``3.11``." msgstr "" -"使用 ``-V:`` 選擇器時,可以省略公司或標籤,但會搜索所有安裝。例如,``-V:" +"使用 ``-V:`` 選擇器時,可以省略公司或標籤,但會搜尋所有安裝。例如,``-V:" "OtherPython/`` 將選擇 ``OtherPython`` 註冊的「最佳」標籤,而 ``-V:3.11`` 或 " "``-V:/3.11`` 將選擇帶有 ``3.11`` 標籤的「最佳」發行版。" @@ -773,7 +773,7 @@ msgid "" "`57684`.)" msgstr "" "新增了一個 :option:`-P` 命令列選項和一個 :envvar:`PYTHONSAFEPATH` 環境變數," -"它們禁用了當使用 :option:`-c` 和 :option:`-m` 以在運行腳本或當前目錄時自動添" +"它們禁用了當使用 :option:`-c` 和 :option:`-m` 以在運行腳本或目前目錄時自動添" "加到腳本目錄的 :data:`sys.path`。這確保只有 stdlib 和已安裝的模組會被 :" "keyword:`import` 取用,以避免不小心或被惡意地將模組與本地(通常是使用者可寫入" "的)目錄中的模組重疊。(由 Victor Stinner 在 :gh:`57684` 中貢獻。)" @@ -843,7 +843,7 @@ msgid "" msgstr "" "當一個仍有效的例外被 :keyword:`raise` 陳述式在沒有參數的情況下重新引發,被附" "於該例外的追蹤資訊現在都會是 ``sys.exc_info()[1].__traceback__``。這代表對於" -"當前 :keyword:`except` 子句的追蹤上做的改動會反映在被重複引發的例外上。(由 " +"目前 :keyword:`except` 子句的追蹤上做的改動會反映在被重複引發的例外上。(由 " "Irit Katriel 於 :issue:`45711` 中貢獻。)" #: ../../whatsnew/3.11.rst:519 @@ -1036,7 +1036,7 @@ msgid "" "the current working directory and then restore it on exit. Simple wrapper " "around :func:`~os.chdir`. (Contributed by Filipe Laíns in :issue:`25625`)" msgstr "" -"添加了非平行安全的 :func:`~contextlib.chdir` 情境管理器來更改當前工作目錄,然" +"添加了非平行安全的 :func:`~contextlib.chdir` 情境管理器來更改目前工作目錄,然" "後在退出時恢復它。:func:`~os.chdir` 的簡單包裝器。(由 Filipe Laíns 在 :" "issue:`25625` 中貢獻)" @@ -1417,7 +1417,7 @@ msgid "" "similar to ``locale.getpreferredencoding(False)`` but ignores the :ref:" "`Python UTF-8 Mode <utf8-mode>`." msgstr "" -"新增 :func:`locale.getencoding` 以取得當前的區域編碼 (locale encoding)。和 " +"新增 :func:`locale.getencoding` 以取得目前的區域編碼 (locale encoding)。和 " "``locale.getpreferredencoding(False)`` 類似但不考慮 :ref:`Python UTF-8 模式 " "<utf8-mode>`。" @@ -1764,7 +1764,7 @@ msgstr "" "新增了三個\\ :ref:`安裝方案 <installation_paths>`\\ (*posix_venv*、" "*nt_venv* 和 *venv*),它們在 Python 建立新的虛擬環境或在虛擬環境中執行環境使" "用。前兩個方案(*posix_venv* 和 *nt_venv*)是非 Windows 和 Windows 作業系統所" -"特有的,*venv* 本質上會根據 Python 運行的操作系統來做為其中之一的別名。這對修" +"特有的,*venv* 本質上會根據 Python 運行的作業系統來做為其中之一的別名。這對修" "改 :func:`sysconfig.get_preferred_scheme` 的下游發布者很有用。建立新虛擬環境" "的第三方程式碼應該使用新的 *venv* 安裝方案來確定路徑,就像 :mod:`venv` 一樣。" "(由 Miro Hrončok 在 :issue:`45413` 中貢獻。)" @@ -2426,7 +2426,7 @@ msgid "" "term:`bytecode`." msgstr "" "在執行環境,Python 將嘗試在執行中的程式碼內尋找常用模式和型別穩定,然後 " -"Python 將用更特化的操作替換當前操作。這種特化操作運用了僅適用於那些用例/型別" +"Python 將用更特化的操作替換目前操作。這種特化操作運用了僅適用於那些用例/型別" "的快速路徑,這通常優於它們的泛用對應 (generic counterparts)。這也引入了另一個" "稱為\\ *行內快取 (inline caching)*\\ 的概念,其中 Python 將繁重操作的結果直接" "快取在\\ :term:`位元組碼 <bytecode>`\\ 中。" @@ -2776,7 +2776,7 @@ msgstr "FAQ" #: ../../whatsnew/3.11.rst:1551 msgid "How should I write my code to utilize these speedups?" -msgstr "我該如何在程式碼中獲取這些加速?" +msgstr "我該如何在程式碼中取得這些加速?" #: ../../whatsnew/3.11.rst:1553 msgid "" @@ -3085,7 +3085,7 @@ msgid "" "now an offset from the current instruction rather than an absolute location." msgstr "" "所有跳位操作碼 (jump opcode) 現在都是相對的,包括現有的 :opcode:`!" -"JUMP_IF_TRUE_OR_POP` 和 :opcode:`!JUMP_IF_FALSE_OR_POP`。該引數現在是當前指" +"JUMP_IF_TRUE_OR_POP` 和 :opcode:`!JUMP_IF_FALSE_OR_POP`。該引數現在是目前指" "示 (instruction) 的偏移量而不是絕對位置。" #: ../../whatsnew/3.11.rst:1688 @@ -3342,7 +3342,7 @@ msgid "" "Kemenade in :issue:`46607`.)" msgstr "" ":class:`!configparser.LegacyInterpolation` 自 Python 3.2 起已在文件字串中棄" -"用,並且未在 :mod:`configparser` 文檔中列出。它現在會發出一個 :exc:" +"用,並且未在 :mod:`configparser` 文件中列出。它現在會發出一個 :exc:" "`DeprecationWarning` 並將在 Python 3.13 中刪除。請改用 :class:`configparser." "BasicInterpolation` 或 :class:`configparser.ExtendedInterpolation`。(由 " "Hugo van Kemenade 在 :issue:`46607` 中貢獻。)" @@ -4551,7 +4551,7 @@ msgid "" "method." msgstr "" ":c:func:`!PyCode_New` 和 :c:func:`!PyCode_NewWithPosOnlyArgs` 現在採用額外的 " -"``exception_table`` 引數。如果可能的話應該避免使用這些函式。要獲取自定義程式" +"``exception_table`` 引數。如果可能的話應該避免使用這些函式。要取得自定義程式" "碼物件,使用編譯器建立一個程式碼物件,然後使用 ``replace`` 方法來得到修改後的" "版本。" @@ -5163,7 +5163,7 @@ msgid "" "c:func:`PySys_GetObject` to retrieve :data:`sys.path` as a Python list " "object and modify it directly." msgstr "" -":c:func:`PyConfig_Read` 不再計算初始搜索路徑,並且不會將任何值填充到 :c:" +":c:func:`PyConfig_Read` 不再計算初始搜尋路徑,並且不會將任何值填充到 :c:" "member:`PyConfig.module_search_paths` 中。若要計算預設路徑然後修改它們,完成" "初始化並使用 :c:func:`PySys_GetObject` 以取得 :data:`sys.path` 作為 Python 列" "表物件並直接修改它。" diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index 4f0abbe638..a37bf789fd 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -531,7 +531,7 @@ msgstr "" "if (PyStatus_Exception(status)) {\n" " return -1;\n" "}\n" -"/* 新的直譯器現在會在當前執行緒中啟用。 */" +"/* 新的直譯器現在會在目前執行緒中啟用。 */" #: ../../whatsnew/3.12.rst:361 msgid "" @@ -1070,7 +1070,7 @@ msgid "" "by Thomas Krennwallner in :gh:`79940`.)" msgstr "" "新增 :func:`inspect.getasyncgenstate` 和 :func:`inspect.getasyncgenlocals` 以" -"確定非同步產生器的當前狀態。(由 Thomas Krennwallner 於 :gh:`79940` 中貢" +"確定非同步產生器的目前狀態。(由 Thomas Krennwallner 於 :gh:`79940` 中貢" "獻。)" #: ../../whatsnew/3.12.rst:735 @@ -3283,7 +3283,7 @@ msgid "" "Remove :mod:`enum`'s ``EnumMeta.__getattr__``, which is no longer needed for " "enum attribute access. (Contributed by Ethan Furman in :gh:`95083`.)" msgstr "" -"移除 :mod:`enum` 的 ``EnumMeta.__getattr__``,對於列舉屬性的訪問不再會需要" +"移除 :mod:`enum` 的 ``EnumMeta.__getattr__``,對於列舉屬性的存取不再會需要" "它。" #: ../../whatsnew/3.12.rst:1411 diff --git a/whatsnew/3.3.po b/whatsnew/3.3.po index 32c61f5ff3..0c9d3e31f7 100644 --- a/whatsnew/3.3.po +++ b/whatsnew/3.3.po @@ -3436,7 +3436,7 @@ msgstr ":pep:`418` 向 :mod:`time` 模組新增了新功能:" #: ../../whatsnew/3.3.rst:2061 msgid ":func:`~time.get_clock_info`: Get information on a clock." -msgstr ":func:`~time.get_clock_info`:獲取時鐘資訊。" +msgstr ":func:`~time.get_clock_info`:取得時鐘資訊。" #: ../../whatsnew/3.3.rst:2062 msgid "" @@ -3455,7 +3455,7 @@ msgstr "" msgid "" ":func:`~time.process_time`: Sum of the system and user CPU time of the " "current process." -msgstr ":func:`~time.process_time`:當前行程的系統和使用者 CPU 時間總和。" +msgstr ":func:`~time.process_time`:目前行程的系統和使用者 CPU 時間總和。" #: ../../whatsnew/3.3.rst:2069 msgid "Other new functions:" From b92374063c9b0b468d4e8a8db71ff6f339787501 Mon Sep 17 00:00:00 2001 From: "W. H. Wang" <mattwang44@gmail.com> Date: Thu, 24 Apr 2025 13:57:20 +0800 Subject: [PATCH 87/89] fix(ci): setup uv in sync workflow (#1032) --- .github/workflows/py313-sync-cpython.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/py313-sync-cpython.yml b/.github/workflows/py313-sync-cpython.yml index 9305dbc4b2..3905728edb 100644 --- a/.github/workflows/py313-sync-cpython.yml +++ b/.github/workflows/py313-sync-cpython.yml @@ -30,6 +30,9 @@ jobs: - name: Install Dependencies run: sudo apt-get install gettext + - name: Install uv + uses: astral-sh/setup-uv@v5 + - name: Sync with CPython run: make clone && make merge && make rm_cpython From 2df827a89510778b1c9281a7912334660951064b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 4 May 2025 14:43:25 +0800 Subject: [PATCH 88/89] build(deps): bump astral-sh/setup-uv from 5 to 6 (#1033) Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 5 to 6. - [Release notes](https://github.com/astral-sh/setup-uv/releases) - [Commits](https://github.com/astral-sh/setup-uv/compare/v5...v6) --- updated-dependencies: - dependency-name: astral-sh/setup-uv dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- .github/workflows/deploy-gh-page.yml | 2 +- .github/workflows/py313-sync-cpython.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad4c154682..a6bd32c1cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: run: sudo apt-get install gettext - name: Install uv - uses: astral-sh/setup-uv@v5 + uses: astral-sh/setup-uv@v6 - name: Validate run: VERSION=${{ github.event.repository.default_branch }} JOBS=4 MODE=html make all diff --git a/.github/workflows/deploy-gh-page.yml b/.github/workflows/deploy-gh-page.yml index b3d8b25466..2c7442c1a8 100644 --- a/.github/workflows/deploy-gh-page.yml +++ b/.github/workflows/deploy-gh-page.yml @@ -15,7 +15,7 @@ jobs: run: sudo apt-get install gettext - name: Install uv - uses: astral-sh/setup-uv@v5 + uses: astral-sh/setup-uv@v6 - name: Build run: JOBS=4 MODE=html make all diff --git a/.github/workflows/py313-sync-cpython.yml b/.github/workflows/py313-sync-cpython.yml index 3905728edb..5cf83520c5 100644 --- a/.github/workflows/py313-sync-cpython.yml +++ b/.github/workflows/py313-sync-cpython.yml @@ -31,7 +31,7 @@ jobs: run: sudo apt-get install gettext - name: Install uv - uses: astral-sh/setup-uv@v5 + uses: astral-sh/setup-uv@v6 - name: Sync with CPython run: make clone && make merge && make rm_cpython From 6ce1539f9afac8a6abd15e843f8a72a05aaa2fe7 Mon Sep 17 00:00:00 2001 From: "pydoc-zh-tw[bot]" <90344106+pydoc-zh-tw[bot]@users.noreply.github.com> Date: Sun, 4 May 2025 16:29:16 +0800 Subject: [PATCH 89/89] Sync with CPython 3.13 (#1019) --- c-api/allocation.po | 26 +- c-api/arg.po | 211 +- c-api/buffer.po | 276 +- c-api/complex.po | 75 +- c-api/dict.po | 133 +- c-api/function.po | 109 +- c-api/gcsupport.po | 6 +- c-api/hash.po | 3 +- c-api/init.po | 6 +- c-api/init_config.po | 227 +- c-api/intro.po | 441 +-- c-api/list.po | 47 +- c-api/module.po | 118 +- c-api/monitoring.po | 12 +- c-api/none.po | 3 +- c-api/object.po | 172 +- c-api/slice.po | 20 +- c-api/structures.po | 474 +-- c-api/tuple.po | 54 +- c-api/type.po | 184 +- c-api/typeobj.po | 1825 +++++----- c-api/unicode.po | 944 +++--- copyright.po | 3 +- deprecations/c-api-pending-removal-in-3.14.po | 76 +- deprecations/c-api-pending-removal-in-3.15.po | 48 +- .../c-api-pending-removal-in-future.po | 16 +- deprecations/index.po | 199 +- deprecations/pending-removal-in-3.14.po | 90 +- deprecations/pending-removal-in-3.15.po | 118 +- deprecations/pending-removal-in-3.16.po | 12 +- deprecations/pending-removal-in-future.po | 148 +- extending/embedding.po | 4 +- extending/extending.po | 269 +- extending/newtypes_tutorial.po | 223 +- faq/design.po | 133 +- faq/general.po | 102 +- faq/library.po | 271 +- faq/programming.po | 522 +-- faq/windows.po | 76 +- glossary.po | 427 +-- howto/curses.po | 6 +- howto/descriptor.po | 195 +- howto/enum.po | 266 +- howto/functional.po | 10 +- howto/ipaddress.po | 45 +- howto/logging-cookbook.po | 1081 +++--- howto/perf_profiling.po | 99 +- howto/regex.po | 201 +- howto/unicode.po | 65 +- howto/urllib2.po | 84 +- library/abc.po | 110 +- library/argparse.po | 262 +- library/array.po | 60 +- library/ast.po | 797 +++-- library/asyncio-eventloop.po | 1386 ++++---- library/asyncio-queue.po | 94 +- library/asyncio-runner.po | 43 +- library/asyncio-stream.po | 196 +- library/asyncio-subprocess.po | 186 +- library/asyncio-sync.po | 172 +- library/asyncio-task.po | 650 ++-- library/asyncio.po | 16 +- library/calendar.po | 2 +- library/cmath.po | 505 ++- library/cmdline.po | 12 +- library/code.po | 41 +- library/codecs.po | 4 +- library/collections.abc.po | 354 +- library/collections.po | 553 ++-- library/concurrent.futures.po | 241 +- library/configparser.po | 161 +- library/constants.po | 87 +- library/contextlib.po | 300 +- library/copy.po | 33 +- library/ctypes.po | 407 +-- library/dataclasses.po | 593 ++-- library/datetime.po | 48 +- library/dbm.po | 4 +- library/decimal.po | 672 ++-- library/dis.po | 917 +++--- library/doctest.po | 804 ++--- library/email.errors.po | 115 +- library/email.examples.po | 4 +- library/email.parser.po | 167 +- library/ensurepip.po | 99 +- library/exceptions.po | 276 +- library/fcntl.po | 162 +- library/filecmp.po | 20 +- library/fractions.po | 69 +- library/functional.po | 7 +- library/functions.po | 750 +++-- library/getpass.po | 20 +- library/gzip.po | 93 +- library/hashlib.po | 498 +-- library/heapq.po | 61 +- library/html.po | 12 +- library/http.cookiejar.po | 215 +- library/http.cookies.po | 60 +- library/http.po | 21 +- library/http.server.po | 273 +- library/idle.po | 731 ++-- library/importlib.metadata.po | 271 +- library/importlib.po | 796 ++--- library/importlib.resources.abc.po | 58 +- library/io.po | 126 +- library/itertools.po | 113 +- library/json.po | 11 +- library/language.po | 5 +- library/logging.handlers.po | 21 +- library/logging.po | 513 +-- library/mailbox.po | 583 ++-- library/markup.po | 9 +- library/marshal.po | 127 +- library/math.po | 84 +- library/modulefinder.po | 17 +- library/modules.po | 7 +- library/numbers.po | 64 +- library/operator.po | 70 +- library/os.path.po | 135 +- library/os.po | 2248 +++++++------ library/pathlib.po | 297 +- library/pdb.po | 294 +- library/persistence.po | 7 +- library/pickle.po | 583 ++-- library/pkgutil.po | 109 +- library/platform.po | 105 +- library/plistlib.po | 61 +- library/profile.po | 386 +-- library/pwd.po | 16 +- library/python.po | 5 +- library/re.po | 811 ++--- library/readline.po | 62 +- library/sched.po | 31 +- library/secrets.po | 30 +- library/selectors.po | 68 +- library/shutil.po | 148 +- library/signal.po | 405 +-- library/smtplib.po | 12 +- library/socket.po | 786 ++--- library/socketserver.po | 242 +- library/sqlite3.po | 1299 ++++---- library/ssl.po | 862 ++--- library/statistics.po | 216 +- library/stdtypes.po | 2929 +++++++++-------- library/string.po | 429 +-- library/struct.po | 44 +- library/sys.monitoring.po | 221 +- library/sys.po | 424 +-- library/sysconfig.po | 17 +- library/tempfile.po | 160 +- library/time.po | 842 ++--- library/timeit.po | 63 +- library/tk.po | 29 +- library/tkinter.ttk.po | 79 +- library/token.po | 414 ++- library/tokenize.po | 41 +- library/traceback.po | 74 +- library/turtle.po | 109 +- library/typing.po | 1905 ++++++----- library/unicodedata.po | 22 +- library/unittest.mock-examples.po | 267 +- library/unittest.mock.po | 1604 ++++----- library/unittest.po | 368 +-- library/urllib.parse.po | 137 +- library/urllib.request.po | 768 +++-- library/uuid.po | 181 +- library/warnings.po | 99 +- library/wave.po | 60 +- library/webbrowser.po | 238 +- library/winsound.po | 17 +- library/wsgiref.po | 616 ++-- library/xmlrpc.client.po | 20 +- library/zipfile.po | 245 +- library/zlib.po | 8 +- reference/compound_stmts.po | 292 +- reference/datamodel.po | 2057 ++++++------ reference/expressions.po | 1216 +++---- reference/grammar.po | 60 +- reference/import.po | 360 +- reference/lexical_analysis.po | 727 ++-- reference/simple_stmts.po | 129 +- sphinx.po | 204 +- tutorial/controlflow.po | 93 +- tutorial/errors.po | 346 +- tutorial/inputoutput.po | 144 +- tutorial/interactive.po | 33 +- tutorial/interpreter.po | 34 +- tutorial/introduction.po | 48 +- tutorial/modules.po | 148 +- tutorial/stdlib.po | 152 +- tutorial/stdlib2.po | 64 +- using/android.po | 26 +- using/cmdline.po | 685 ++-- using/configure.po | 378 ++- using/editors.po | 29 +- using/ios.po | 56 +- using/unix.po | 154 +- whatsnew/2.0.po | 246 +- whatsnew/2.1.po | 202 +- whatsnew/2.2.po | 262 +- whatsnew/2.3.po | 467 +-- whatsnew/2.4.po | 501 ++- whatsnew/2.5.po | 597 ++-- whatsnew/2.6.po | 786 ++--- whatsnew/2.7.po | 949 +++--- whatsnew/3.0.po | 291 +- whatsnew/3.1.po | 84 +- whatsnew/3.10.po | 1472 +++++---- whatsnew/3.11.po | 1561 ++++----- whatsnew/3.12.po | 2479 +++++++------- whatsnew/3.13.po | 1848 ++++++----- whatsnew/3.2.po | 820 ++--- whatsnew/3.3.po | 898 +++-- whatsnew/3.4.po | 1195 +++---- whatsnew/3.5.po | 991 +++--- whatsnew/3.6.po | 868 ++--- whatsnew/3.7.po | 1085 +++--- whatsnew/3.8.po | 833 ++--- whatsnew/3.9.po | 626 ++-- 219 files changed, 38954 insertions(+), 35583 deletions(-) diff --git a/c-api/allocation.po b/c-api/allocation.po index 2d4ce8e20a..28435d6916 100644 --- a/c-api/allocation.po +++ b/c-api/allocation.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-06 00:13+0000\n" +"POT-Creation-Date: 2025-03-18 00:14+0000\n" "PO-Revision-Date: 2022-10-16 15:35+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -56,7 +56,14 @@ msgstr "" "化;呼叫者會擁有那個對於物件的唯一參照(物件的參照計數為一)。記憶體分配大小" "由 type 物件的 :c:member:`~PyTypeObject.tp_basicsize` 欄位來指定。" -#: ../../c-api/allocation.rst:41 +#: ../../c-api/allocation.rst:38 +msgid "" +"Note that this function is unsuitable if *typeobj* has :c:macro:" +"`Py_TPFLAGS_HAVE_GC` set. For such objects, use :c:func:`PyObject_GC_New` " +"instead." +msgstr "" + +#: ../../c-api/allocation.rst:45 msgid "" "Allocate a new Python object using the C structure type *TYPE* and the " "Python type object *typeobj* (``PyTypeObject*``). Fields not defined by the " @@ -75,7 +82,14 @@ msgstr "" "於實現如 tuple 這種能夠在建立期間決定自己大小的物件是很實用的。將欄位的陣列嵌" "入到相同的記憶體分配中可以減少記憶體分配的次數,這提高了記憶體管理的效率。" -#: ../../c-api/allocation.rst:55 +#: ../../c-api/allocation.rst:56 +msgid "" +"Note that this function is unsuitable if *typeobj* has :c:macro:" +"`Py_TPFLAGS_HAVE_GC` set. For such objects, use :c:func:`PyObject_GC_NewVar` " +"instead." +msgstr "" + +#: ../../c-api/allocation.rst:63 msgid "" "Releases memory allocated to an object using :c:macro:`PyObject_New` or :c:" "macro:`PyObject_NewVar`. This is normally called from the :c:member:" @@ -88,7 +102,7 @@ msgstr "" "handler 中呼叫。呼叫這個函式以後,物件的各欄位都不可以被存取,因為原本分配的" "記憶體已不再是一個有效的 Python 物件。" -#: ../../c-api/allocation.rst:64 +#: ../../c-api/allocation.rst:72 msgid "" "Object which is visible in Python as ``None``. This should only be accessed " "using the :c:macro:`Py_None` macro, which evaluates to a pointer to this " @@ -97,10 +111,10 @@ msgstr "" "這個物件像是 Python 中的 ``None``。它只應該透過 :c:macro:`Py_None` 巨集來存" "取,該巨集的拿到指向該物件的指標。" -#: ../../c-api/allocation.rst:71 +#: ../../c-api/allocation.rst:79 msgid ":c:func:`PyModule_Create`" msgstr ":c:func:`PyModule_Create`" -#: ../../c-api/allocation.rst:72 +#: ../../c-api/allocation.rst:80 msgid "To allocate and create extension modules." msgstr "分配記憶體和建立擴充模組。" diff --git a/c-api/arg.po b/c-api/arg.po index 7d0ae25460..d0ee0ca15e 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-07 00:14+0000\n" +"POT-Creation-Date: 2025-04-26 00:14+0000\n" "PO-Revision-Date: 2022-10-16 03:21+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -24,18 +24,18 @@ msgstr "剖析引數與建置數值" #: ../../c-api/arg.rst:8 msgid "" -"These functions are useful when creating your own extensions functions and " -"methods. Additional information and examples are available " -"in :ref:`extending-index`." +"These functions are useful when creating your own extension functions and " +"methods. Additional information and examples are available in :ref:" +"`extending-index`." msgstr "" #: ../../c-api/arg.rst:12 msgid "" -"The first three of these functions " -"described, :c:func:`PyArg_ParseTuple`, :c:func:`PyArg_ParseTupleAndKeywords`, " -"and :c:func:`PyArg_Parse`, all use *format strings* which are used to tell " -"the function about the expected arguments. The format strings use the same " -"syntax for each of these functions." +"The first three of these functions described, :c:func:`PyArg_ParseTuple`, :c:" +"func:`PyArg_ParseTupleAndKeywords`, and :c:func:`PyArg_Parse`, all use " +"*format strings* which are used to tell the function about the expected " +"arguments. The format strings use the same syntax for each of these " +"functions." msgstr "" #: ../../c-api/arg.rst:19 @@ -108,10 +108,10 @@ msgstr "" #: ../../c-api/arg.rst:70 msgid "" -"To ensure that the underlying buffer may be safely borrowed, the " -"object's :c:member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. " -"This disallows common mutable objects such as :class:`bytearray`, but also " -"some read-only objects such as :class:`memoryview` of :class:`bytes`." +"To ensure that the underlying buffer may be safely borrowed, the object's :c:" +"member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. This " +"disallows common mutable objects such as :class:`bytearray`, but also some " +"read-only objects such as :class:`memoryview` of :class:`bytes`." msgstr "" #: ../../c-api/arg.rst:76 @@ -139,8 +139,8 @@ msgstr "" msgid "" "This format does not accept :term:`bytes-like objects <bytes-like object>`. " "If you want to accept filesystem paths and convert them to C character " -"strings, it is preferable to use the ``O&`` format " -"with :c:func:`PyUnicode_FSConverter` as *converter*." +"strings, it is preferable to use the ``O&`` format with :c:func:" +"`PyUnicode_FSConverter` as *converter*." msgstr "" #: ../../c-api/arg.rst:96 @@ -163,11 +163,11 @@ msgstr "" #: ../../c-api/arg.rst:106 msgid "" -"``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char " -"\\*, :c:type:`Py_ssize_t`]" +"``s#`` (:class:`str`, read-only :term:`bytes-like object`) [const char \\*, :" +"c:type:`Py_ssize_t`]" msgstr "" -"``s#`` (:class:`str`、唯讀的 :term:`bytes-like object`) [const char " -"\\*, :c:type:`Py_ssize_t`]" +"``s#`` (:class:`str`、唯讀的 :term:`bytes-like object`) [const char \\*, :c:" +"type:`Py_ssize_t`]" #: ../../c-api/arg.rst:107 msgid "" @@ -244,11 +244,11 @@ msgstr "" #: ../../c-api/arg.rst:141 msgid "" -"``y#`` (read-only :term:`bytes-like object`) [const char " -"\\*, :c:type:`Py_ssize_t`]" +"``y#`` (read-only :term:`bytes-like object`) [const char \\*, :c:type:" +"`Py_ssize_t`]" msgstr "" -"``y#`` (唯讀的 :term:`bytes-like object`) [const char " -"\\*, :c:type:`Py_ssize_t`]" +"``y#`` (唯讀的 :term:`bytes-like object`) [const char \\*, :c:type:" +"`Py_ssize_t`]" #: ../../c-api/arg.rst:142 msgid "" @@ -274,9 +274,9 @@ msgstr "``Y`` (:class:`bytearray`) [PyByteArrayObject \\*]" #: ../../c-api/arg.rst:151 msgid "" "Requires that the Python object is a :class:`bytearray` object, without " -"attempting any conversion. Raises :exc:`TypeError` if the object is not " -"a :class:`bytearray` object. The C variable may also be declared " -"as :c:expr:`PyObject*`." +"attempting any conversion. Raises :exc:`TypeError` if the object is not a :" +"class:`bytearray` object. The C variable may also be declared as :c:expr:" +"`PyObject*`." msgstr "" #: ../../c-api/arg.rst:155 @@ -298,8 +298,8 @@ msgstr "``w*`` (可讀寫 :term:`bytes-like object`) [Py_buffer]" msgid "" "This format accepts any object which implements the read-write buffer " "interface. It fills a :c:type:`Py_buffer` structure provided by the caller. " -"The buffer may contain embedded null bytes. The caller have to " -"call :c:func:`PyBuffer_Release` when it is done with the buffer." +"The buffer may contain embedded null bytes. The caller have to call :c:func:" +"`PyBuffer_Release` when it is done with the buffer." msgstr "" #: ../../c-api/arg.rst:166 @@ -327,8 +327,8 @@ msgstr "" msgid "" ":c:func:`PyArg_ParseTuple` will allocate a buffer of the needed size, copy " "the encoded data into this buffer and adjust *\\*buffer* to reference the " -"newly allocated storage. The caller is responsible for " -"calling :c:func:`PyMem_Free` to free the allocated buffer after use." +"newly allocated storage. The caller is responsible for calling :c:func:" +"`PyMem_Free` to free the allocated buffer after use." msgstr "" #: ../../c-api/arg.rst:183 @@ -348,11 +348,11 @@ msgstr "" #: ../../c-api/arg.rst:188 msgid "" -"``es#`` (:class:`str`) [const char \\*encoding, char " -"\\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" +"``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:" +"`Py_ssize_t` \\*buffer_length]" msgstr "" -"``es#`` (:class:`str`) [const char \\*encoding, char " -"\\*\\*buffer, :c:type:`Py_ssize_t` \\*buffer_length]" +"``es#`` (:class:`str`) [const char \\*encoding, char \\*\\*buffer, :c:type:" +"`Py_ssize_t` \\*buffer_length]" #: ../../c-api/arg.rst:189 msgid "" @@ -428,11 +428,10 @@ msgstr "數字" #: ../../c-api/arg.rst:232 msgid "" "These formats allow representing Python numbers or single characters as C " -"numbers. Formats that require :class:`int`, :class:`float` " -"or :class:`complex` can also use the corresponding special " -"methods :meth:`~object.__index__`, :meth:`~object.__float__` " -"or :meth:`~object.__complex__` to convert the Python object to the required " -"type." +"numbers. Formats that require :class:`int`, :class:`float` or :class:" +"`complex` can also use the corresponding special methods :meth:`~object." +"__index__`, :meth:`~object.__float__` or :meth:`~object.__complex__` to " +"convert the Python object to the required type." msgstr "" #: ../../c-api/arg.rst:238 @@ -452,8 +451,8 @@ msgid "" "Convert a nonnegative Python integer to an unsigned tiny integer, stored in " "a C :c:expr:`unsigned char`." msgstr "" -"將一個 Python 非負整數轉換成無符號 tiny integer(小整數),儲存在 C " -"的 :c:expr:`unsigned`" +"將一個 Python 非負整數轉換成無符號 tiny integer(小整數),儲存在 C 的 :c:" +"expr:`unsigned`" #: ../../c-api/arg.rst:248 ../../c-api/arg.rst:627 msgid "``B`` (:class:`int`) [unsigned char]" @@ -464,8 +463,8 @@ msgid "" "Convert a Python integer to a tiny integer without overflow checking, stored " "in a C :c:expr:`unsigned char`." msgstr "" -"將一個 Python 整數轉換成 tiny integer,轉換過程無溢位檢查,儲存在 C " -"的 :c:expr:`unsigned char`。" +"將一個 Python 整數轉換成 tiny integer,轉換過程無溢位檢查,儲存在 C 的 :c:" +"expr:`unsigned char`。" #: ../../c-api/arg.rst:252 ../../c-api/arg.rst:621 msgid "``h`` (:class:`int`) [short int]" @@ -533,7 +532,7 @@ msgstr "``L`` (:class:`int`) [long long]" msgid "Convert a Python integer to a C :c:expr:`long long`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`long long`。" -#: ../../c-api/arg.rst:276 ../../c-api/arg.rst:642 +#: ../../c-api/arg.rst:276 ../../c-api/arg.rst:644 msgid "``K`` (:class:`int`) [unsigned long long]" msgstr "``K`` (:class:`int`) [unsigned long long]" @@ -545,7 +544,7 @@ msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned long long`,轉換過程無溢位檢" "查。" -#: ../../c-api/arg.rst:280 ../../c-api/arg.rst:645 +#: ../../c-api/arg.rst:280 ../../c-api/arg.rst:647 msgid "``n`` (:class:`int`) [:c:type:`Py_ssize_t`]" msgstr "``n`` (:class:`int`) [:c:type:`Py_ssize_t`]" @@ -567,7 +566,7 @@ msgstr "" msgid "Allow :class:`bytearray` objects." msgstr "允許 :class:`bytearray` 物件。" -#: ../../c-api/arg.rst:290 ../../c-api/arg.rst:652 +#: ../../c-api/arg.rst:290 ../../c-api/arg.rst:654 msgid "``C`` (:class:`str` of length 1) [int]" msgstr "``C`` (長度為 1 的 :class:`str`) [int]" @@ -577,7 +576,7 @@ msgid "" "1, to a C :c:expr:`int`." msgstr "" -#: ../../c-api/arg.rst:294 ../../c-api/arg.rst:659 +#: ../../c-api/arg.rst:294 ../../c-api/arg.rst:661 msgid "``f`` (:class:`float`) [float]" msgstr "``f`` (:class:`float`) [float]" @@ -585,7 +584,7 @@ msgstr "``f`` (:class:`float`) [float]" msgid "Convert a Python floating-point number to a C :c:expr:`float`." msgstr "將一個 Python 浮點數轉換成 C 的 :c:type::c:expr:`float`。" -#: ../../c-api/arg.rst:297 ../../c-api/arg.rst:656 +#: ../../c-api/arg.rst:297 ../../c-api/arg.rst:658 msgid "``d`` (:class:`float`) [double]" msgstr "``d`` (:class:`float`) [double]" @@ -605,16 +604,16 @@ msgstr "將一個 Python 複數轉換成 C 的 :c:type:`Py_complex` 結構。" msgid "Other objects" msgstr "其他物件" -#: ../../c-api/arg.rst:306 ../../c-api/arg.rst:665 +#: ../../c-api/arg.rst:306 ../../c-api/arg.rst:667 msgid "``O`` (object) [PyObject \\*]" msgstr "``O`` (object) [PyObject \\*]" #: ../../c-api/arg.rst:307 msgid "" "Store a Python object (without any conversion) in a C object pointer. The C " -"program thus receives the actual object that was passed. A " -"new :term:`strong reference` to the object is not created (i.e. its " -"reference count is not increased). The pointer stored is not ``NULL``." +"program thus receives the actual object that was passed. A new :term:" +"`strong reference` to the object is not created (i.e. its reference count is " +"not increased). The pointer stored is not ``NULL``." msgstr "" #: ../../c-api/arg.rst:313 @@ -648,12 +647,12 @@ msgstr "status = converter(object, address);" #: ../../c-api/arg.rst:330 msgid "" -"where *object* is the Python object to be converted and *address* is " -"the :c:expr:`void*` argument that was passed to the ``PyArg_Parse*`` " -"function. The returned *status* should be ``1`` for a successful conversion " -"and ``0`` if the conversion has failed. When the conversion fails, the " -"*converter* function should raise an exception and leave the content of " -"*address* unmodified." +"where *object* is the Python object to be converted and *address* is the :c:" +"expr:`void*` argument that was passed to the ``PyArg_Parse*`` function. The " +"returned *status* should be ``1`` for a successful conversion and ``0`` if " +"the conversion has failed. When the conversion fails, the *converter* " +"function should raise an exception and leave the content of *address* " +"unmodified." msgstr "" #: ../../c-api/arg.rst:339 @@ -667,8 +666,8 @@ msgstr "" #: ../../c-api/arg.rst:345 msgid "" -"Examples of converters: :c:func:`PyUnicode_FSConverter` " -"and :c:func:`PyUnicode_FSDecoder`." +"Examples of converters: :c:func:`PyUnicode_FSConverter` and :c:func:" +"`PyUnicode_FSDecoder`." msgstr "" #: ../../c-api/arg.rst:348 @@ -688,7 +687,7 @@ msgid "" "how Python tests values for truth." msgstr "" -#: ../../c-api/arg.rst:360 ../../c-api/arg.rst:689 +#: ../../c-api/arg.rst:360 ../../c-api/arg.rst:691 msgid "``(items)`` (:class:`tuple`) [*matching-items*]" msgstr "``(items)`` (:class:`tuple`) [*matching-items*]" @@ -748,8 +747,8 @@ msgstr "``;``" #: ../../c-api/arg.rst:390 msgid "" "The list of format units ends here; the string after the semicolon is used " -"as the error message *instead* of the default error message. ``:`` and " -"``;`` mutually exclude each other." +"as the error message *instead* of the default error message. ``:`` and ``;" +"`` mutually exclude each other." msgstr "" #: ../../c-api/arg.rst:394 @@ -808,9 +807,9 @@ msgstr "" #: ../../c-api/arg.rst:441 msgid "" -"The *keywords* parameter declaration is :c:expr:`char * const *` in C " -"and :c:expr:`const char * const *` in C++. This can be overridden with " -"the :c:macro:`PY_CXX_CONST` macro." +"The *keywords* parameter declaration is :c:expr:`char * const *` in C and :c:" +"expr:`const char * const *` in C++. This can be overridden with the :c:macro:" +"`PY_CXX_CONST` macro." msgstr "" #: ../../c-api/arg.rst:445 @@ -821,9 +820,9 @@ msgstr "新增對\\ :ref:`僅限位置參數 <positional-only_parameter>`\\ 的 #: ../../c-api/arg.rst:449 msgid "" -"The *keywords* parameter has now type :c:expr:`char * const *` in C " -"and :c:expr:`const char * const *` in C++, instead of :c:expr:`char **`. " -"Added support for non-ASCII keyword parameter names." +"The *keywords* parameter has now type :c:expr:`char * const *` in C and :c:" +"expr:`const char * const *` in C++, instead of :c:expr:`char **`. Added " +"support for non-ASCII keyword parameter names." msgstr "" #: ../../c-api/arg.rst:458 @@ -961,10 +960,10 @@ msgid "" "When memory buffers are passed as parameters to supply data to build " "objects, as for the ``s`` and ``s#`` formats, the required data is copied. " "Buffers provided by the caller are never referenced by the objects created " -"by :c:func:`Py_BuildValue`. In other words, if your code " -"invokes :c:func:`malloc` and passes the allocated memory " -"to :c:func:`Py_BuildValue`, your code is responsible for " -"calling :c:func:`free` for that memory once :c:func:`Py_BuildValue` returns." +"by :c:func:`Py_BuildValue`. In other words, if your code invokes :c:func:" +"`malloc` and passes the allocated memory to :c:func:`Py_BuildValue`, your " +"code is responsible for calling :c:func:`free` for that memory once :c:func:" +"`Py_BuildValue` returns." msgstr "" #: ../../c-api/arg.rst:568 @@ -1111,125 +1110,125 @@ msgstr "將一個 C 的 :c:expr:`unsigned long` 轉換成 Python 整數物件。 msgid "Convert a C :c:expr:`long long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`long long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:643 +#: ../../c-api/arg.rst:645 msgid "Convert a C :c:expr:`unsigned long long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned long long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:646 +#: ../../c-api/arg.rst:648 msgid "Convert a C :c:type:`Py_ssize_t` to a Python integer." msgstr "將一個 C 的 :c:type:`Py_ssize_t` 轉換成 Python 整數。" -#: ../../c-api/arg.rst:648 +#: ../../c-api/arg.rst:650 msgid "``c`` (:class:`bytes` of length 1) [char]" msgstr "``c`` (長度為 1 的 :class:`bytes`) [char]" -#: ../../c-api/arg.rst:649 +#: ../../c-api/arg.rst:651 msgid "" "Convert a C :c:expr:`int` representing a byte to a Python :class:`bytes` " "object of length 1." msgstr "" -"將一個 C 中代表一個位元組的 :c:expr:`int` 轉換成 Python 中長度為一" -"的 :class:`bytes`。" +"將一個 C 中代表一個位元組的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" +"`bytes`。" -#: ../../c-api/arg.rst:653 +#: ../../c-api/arg.rst:655 msgid "" "Convert a C :c:expr:`int` representing a character to Python :class:`str` " "object of length 1." msgstr "" -"將一個 C 中代表一個字元的 :c:expr:`int` 轉換成 Python 中長度為一" -"的 :class:`str`。" +"將一個 C 中代表一個字元的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" +"`str`。" -#: ../../c-api/arg.rst:657 +#: ../../c-api/arg.rst:659 msgid "Convert a C :c:expr:`double` to a Python floating-point number." msgstr "將一個 C 的 :c:expr:`double` 轉換成 Python 浮點數。" -#: ../../c-api/arg.rst:660 +#: ../../c-api/arg.rst:662 msgid "Convert a C :c:expr:`float` to a Python floating-point number." msgstr "將一個 C 的 :c:expr:`float` 轉換成 Python 浮點數。" -#: ../../c-api/arg.rst:662 +#: ../../c-api/arg.rst:664 msgid "``D`` (:class:`complex`) [Py_complex \\*]" msgstr "``D`` (:class:`complex`) [Py_complex \\*]" -#: ../../c-api/arg.rst:663 +#: ../../c-api/arg.rst:665 msgid "Convert a C :c:type:`Py_complex` structure to a Python complex number." msgstr "將一個 C 的 :c:type:`Py_complex` 結構轉換成 Python 複數。" -#: ../../c-api/arg.rst:666 +#: ../../c-api/arg.rst:668 msgid "" "Pass a Python object untouched but create a new :term:`strong reference` to " "it (i.e. its reference count is incremented by one). If the object passed in " "is a ``NULL`` pointer, it is assumed that this was caused because the call " -"producing the argument found an error and set an exception. " -"Therefore, :c:func:`Py_BuildValue` will return ``NULL`` but won't raise an " -"exception. If no exception has been raised yet, :exc:`SystemError` is set." +"producing the argument found an error and set an exception. Therefore, :c:" +"func:`Py_BuildValue` will return ``NULL`` but won't raise an exception. If " +"no exception has been raised yet, :exc:`SystemError` is set." msgstr "" -#: ../../c-api/arg.rst:675 +#: ../../c-api/arg.rst:677 msgid "``S`` (object) [PyObject \\*]" msgstr "``S`` (object) [PyObject \\*]" -#: ../../c-api/arg.rst:676 +#: ../../c-api/arg.rst:678 msgid "Same as ``O``." msgstr "和 ``O`` 相同。" -#: ../../c-api/arg.rst:678 +#: ../../c-api/arg.rst:680 msgid "``N`` (object) [PyObject \\*]" msgstr "``N`` (object) [PyObject \\*]" -#: ../../c-api/arg.rst:679 +#: ../../c-api/arg.rst:681 msgid "" "Same as ``O``, except it doesn't create a new :term:`strong reference`. " "Useful when the object is created by a call to an object constructor in the " "argument list." msgstr "" -#: ../../c-api/arg.rst:683 +#: ../../c-api/arg.rst:685 msgid "``O&`` (object) [*converter*, *anything*]" msgstr "``O&`` (object) [*converter*, *anything*]" -#: ../../c-api/arg.rst:684 +#: ../../c-api/arg.rst:686 msgid "" "Convert *anything* to a Python object through a *converter* function. The " -"function is called with *anything* (which should be compatible " -"with :c:expr:`void*`) as its argument and should return a \"new\" Python " -"object, or ``NULL`` if an error occurred." +"function is called with *anything* (which should be compatible with :c:expr:" +"`void*`) as its argument and should return a \"new\" Python object, or " +"``NULL`` if an error occurred." msgstr "" -#: ../../c-api/arg.rst:690 +#: ../../c-api/arg.rst:692 msgid "" "Convert a sequence of C values to a Python tuple with the same number of " "items." msgstr "" -#: ../../c-api/arg.rst:692 +#: ../../c-api/arg.rst:694 msgid "``[items]`` (:class:`list`) [*matching-items*]" msgstr "``[items]`` (:class:`list`) [*matching-items*]" -#: ../../c-api/arg.rst:693 +#: ../../c-api/arg.rst:695 msgid "" "Convert a sequence of C values to a Python list with the same number of " "items." msgstr "" -#: ../../c-api/arg.rst:695 +#: ../../c-api/arg.rst:697 msgid "``{items}`` (:class:`dict`) [*matching-items*]" msgstr "``{items}`` (:class:`dict`) [*matching-items*]" -#: ../../c-api/arg.rst:696 +#: ../../c-api/arg.rst:698 msgid "" "Convert a sequence of C values to a Python dictionary. Each pair of " "consecutive C values adds one item to the dictionary, serving as key and " "value, respectively." msgstr "" -#: ../../c-api/arg.rst:700 +#: ../../c-api/arg.rst:702 msgid "" "If there is an error in the format string, the :exc:`SystemError` exception " "is set and ``NULL`` returned." msgstr "" -#: ../../c-api/arg.rst:705 +#: ../../c-api/arg.rst:707 msgid "" "Identical to :c:func:`Py_BuildValue`, except that it accepts a va_list " "rather than a variable number of arguments." diff --git a/c-api/buffer.po b/c-api/buffer.po index d183ac606f..5248994757 100644 --- a/c-api/buffer.po +++ b/c-api/buffer.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 23:08+0000\n" +"POT-Creation-Date: 2025-05-02 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:30+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,24 +41,26 @@ msgstr "" #: ../../c-api/buffer.rst:29 msgid "" -"Python provides such a facility at the C level in the form of the :ref:" -"`buffer protocol <bufferobjects>`. This protocol has two sides:" +"Python provides such a facility at the C and Python level in the form of " +"the :ref:`buffer protocol <bufferobjects>`. This protocol has two sides:" msgstr "" #: ../../c-api/buffer.rst:34 msgid "" "on the producer side, a type can export a \"buffer interface\" which allows " "objects of that type to expose information about their underlying buffer. " -"This interface is described in the section :ref:`buffer-structs`;" +"This interface is described in the section :ref:`buffer-structs`; for Python " +"see :ref:`python-buffer-protocol`." msgstr "" -#: ../../c-api/buffer.rst:38 +#: ../../c-api/buffer.rst:39 msgid "" "on the consumer side, several means are available to obtain a pointer to the " -"raw underlying data of an object (for example a method parameter)." +"raw underlying data of an object (for example a method parameter). For " +"Python see :class:`memoryview`." msgstr "" -#: ../../c-api/buffer.rst:41 +#: ../../c-api/buffer.rst:43 msgid "" "Simple objects such as :class:`bytes` and :class:`bytearray` expose their " "underlying buffer in byte-oriented form. Other forms are possible; for " @@ -66,7 +68,7 @@ msgid "" "values." msgstr "" -#: ../../c-api/buffer.rst:45 +#: ../../c-api/buffer.rst:47 msgid "" "An example consumer of the buffer interface is the :meth:`~io.BufferedIOBase." "write` method of file objects: any object that can export a series of bytes " @@ -78,23 +80,23 @@ msgid "" "buffers." msgstr "" -#: ../../c-api/buffer.rst:53 +#: ../../c-api/buffer.rst:55 msgid "" "There are two ways for a consumer of the buffer interface to acquire a " "buffer over a target object:" msgstr "" -#: ../../c-api/buffer.rst:56 +#: ../../c-api/buffer.rst:58 msgid "call :c:func:`PyObject_GetBuffer` with the right parameters;" msgstr "" -#: ../../c-api/buffer.rst:58 +#: ../../c-api/buffer.rst:60 msgid "" "call :c:func:`PyArg_ParseTuple` (or one of its siblings) with one of the " "``y*``, ``w*`` or ``s*`` :ref:`format codes <arg-parsing>`." msgstr "" -#: ../../c-api/buffer.rst:61 +#: ../../c-api/buffer.rst:63 msgid "" "In both cases, :c:func:`PyBuffer_Release` must be called when the buffer " "isn't needed anymore. Failure to do so could lead to various issues such as " @@ -102,10 +104,16 @@ msgid "" msgstr "" #: ../../c-api/buffer.rst:69 +msgid "" +"The buffer protocol is now accessible in Python, see :ref:`python-buffer-" +"protocol` and :class:`memoryview`." +msgstr "" + +#: ../../c-api/buffer.rst:75 msgid "Buffer structure" msgstr "" -#: ../../c-api/buffer.rst:71 +#: ../../c-api/buffer.rst:77 msgid "" "Buffer structures (or simply \"buffers\") are useful as a way to expose the " "binary data from another object to the Python programmer. They can also be " @@ -117,7 +125,7 @@ msgid "" "in its native, in-memory format." msgstr "" -#: ../../c-api/buffer.rst:80 +#: ../../c-api/buffer.rst:86 msgid "" "Contrary to most data types exposed by the Python interpreter, buffers are " "not :c:type:`PyObject` pointers but rather simple C structures. This allows " @@ -126,14 +134,14 @@ msgid "" "created." msgstr "" -#: ../../c-api/buffer.rst:86 +#: ../../c-api/buffer.rst:92 msgid "" "For short instructions how to write an exporting object, see :ref:`Buffer " "Object Structures <buffer-structs>`. For obtaining a buffer, see :c:func:" "`PyObject_GetBuffer`." msgstr "" -#: ../../c-api/buffer.rst:94 +#: ../../c-api/buffer.rst:100 msgid "" "A pointer to the start of the logical structure described by the buffer " "fields. This can be any location within the underlying physical memory block " @@ -141,13 +149,13 @@ msgid "" "the value may point to the end of the memory block." msgstr "" -#: ../../c-api/buffer.rst:99 +#: ../../c-api/buffer.rst:105 msgid "" "For :term:`contiguous` arrays, the value points to the beginning of the " "memory block." msgstr "" -#: ../../c-api/buffer.rst:104 +#: ../../c-api/buffer.rst:110 msgid "" "A new reference to the exporting object. The reference is owned by the " "consumer and automatically released (i.e. reference count decremented) and " @@ -155,14 +163,14 @@ msgid "" "of the return value of any standard C-API function." msgstr "" -#: ../../c-api/buffer.rst:111 +#: ../../c-api/buffer.rst:117 msgid "" "As a special case, for *temporary* buffers that are wrapped by :c:func:" "`PyMemoryView_FromBuffer` or :c:func:`PyBuffer_FillInfo` this field is " "``NULL``. In general, exporting objects MUST NOT use this scheme." msgstr "" -#: ../../c-api/buffer.rst:118 +#: ../../c-api/buffer.rst:124 msgid "" "``product(shape) * itemsize``. For contiguous arrays, this is the length of " "the underlying memory block. For non-contiguous arrays, it is the length " @@ -170,7 +178,7 @@ msgid "" "representation." msgstr "" -#: ../../c-api/buffer.rst:123 +#: ../../c-api/buffer.rst:129 msgid "" "Accessing ``((char *)buf)[0] up to ((char *)buf)[len-1]`` is only valid if " "the buffer has been obtained by a request that guarantees contiguity. In " @@ -178,19 +186,19 @@ msgid "" "`PyBUF_WRITABLE`." msgstr "" -#: ../../c-api/buffer.rst:129 +#: ../../c-api/buffer.rst:135 msgid "" "An indicator of whether the buffer is read-only. This field is controlled by " "the :c:macro:`PyBUF_WRITABLE` flag." msgstr "" -#: ../../c-api/buffer.rst:134 +#: ../../c-api/buffer.rst:140 msgid "" "Item size in bytes of a single element. Same as the value of :func:`struct." "calcsize` called on non-``NULL`` :c:member:`~Py_buffer.format` values." msgstr "" -#: ../../c-api/buffer.rst:137 +#: ../../c-api/buffer.rst:143 msgid "" "Important exception: If a consumer requests a buffer without the :c:macro:" "`PyBUF_FORMAT` flag, :c:member:`~Py_buffer.format` will be set to " @@ -198,32 +206,32 @@ msgid "" "original format." msgstr "" -#: ../../c-api/buffer.rst:142 +#: ../../c-api/buffer.rst:148 msgid "" "If :c:member:`~Py_buffer.shape` is present, the equality ``product(shape) * " "itemsize == len`` still holds and the consumer can use :c:member:`~Py_buffer." "itemsize` to navigate the buffer." msgstr "" -#: ../../c-api/buffer.rst:146 +#: ../../c-api/buffer.rst:152 msgid "" "If :c:member:`~Py_buffer.shape` is ``NULL`` as a result of a :c:macro:" "`PyBUF_SIMPLE` or a :c:macro:`PyBUF_WRITABLE` request, the consumer must " "disregard :c:member:`~Py_buffer.itemsize` and assume ``itemsize == 1``." msgstr "" -#: ../../c-api/buffer.rst:152 +#: ../../c-api/buffer.rst:158 msgid "" "A *NULL* terminated string in :mod:`struct` module style syntax describing " "the contents of a single item. If this is ``NULL``, ``\"B\"`` (unsigned " "bytes) is assumed." msgstr "" -#: ../../c-api/buffer.rst:156 +#: ../../c-api/buffer.rst:162 msgid "This field is controlled by the :c:macro:`PyBUF_FORMAT` flag." msgstr "" -#: ../../c-api/buffer.rst:160 +#: ../../c-api/buffer.rst:166 msgid "" "The number of dimensions the memory represents as an n-dimensional array. If " "it is ``0``, :c:member:`~Py_buffer.buf` points to a single item representing " @@ -232,7 +240,7 @@ msgid "" "number of dimensions is given by :c:macro:`PyBUF_MAX_NDIM`." msgstr "" -#: ../../c-api/buffer.rst:168 +#: ../../c-api/buffer.rst:174 msgid "" "An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim` " "indicating the shape of the memory as an n-dimensional array. Note that " @@ -240,34 +248,34 @@ msgid "" "`~Py_buffer.len`." msgstr "" -#: ../../c-api/buffer.rst:173 +#: ../../c-api/buffer.rst:179 msgid "" "Shape values are restricted to ``shape[n] >= 0``. The case ``shape[n] == 0`` " "requires special attention. See `complex arrays`_ for further information." msgstr "" -#: ../../c-api/buffer.rst:177 +#: ../../c-api/buffer.rst:183 msgid "The shape array is read-only for the consumer." msgstr "" -#: ../../c-api/buffer.rst:181 +#: ../../c-api/buffer.rst:187 msgid "" "An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim` " "giving the number of bytes to skip to get to a new element in each dimension." msgstr "" -#: ../../c-api/buffer.rst:185 +#: ../../c-api/buffer.rst:191 msgid "" "Stride values can be any integer. For regular arrays, strides are usually " "positive, but a consumer MUST be able to handle the case ``strides[n] <= " "0``. See `complex arrays`_ for further information." msgstr "" -#: ../../c-api/buffer.rst:189 +#: ../../c-api/buffer.rst:195 msgid "The strides array is read-only for the consumer." msgstr "" -#: ../../c-api/buffer.rst:193 +#: ../../c-api/buffer.rst:199 msgid "" "An array of :c:type:`Py_ssize_t` of length :c:member:`~Py_buffer.ndim`. If " "``suboffsets[n] >= 0``, the values stored along the nth dimension are " @@ -276,24 +284,24 @@ msgid "" "that no de-referencing should occur (striding in a contiguous memory block)." msgstr "" -#: ../../c-api/buffer.rst:200 +#: ../../c-api/buffer.rst:206 msgid "" "If all suboffsets are negative (i.e. no de-referencing is needed), then this " "field must be ``NULL`` (the default value)." msgstr "" -#: ../../c-api/buffer.rst:203 +#: ../../c-api/buffer.rst:209 msgid "" "This type of array representation is used by the Python Imaging Library " "(PIL). See `complex arrays`_ for further information how to access elements " "of such an array." msgstr "" -#: ../../c-api/buffer.rst:207 +#: ../../c-api/buffer.rst:213 msgid "The suboffsets array is read-only for the consumer." msgstr "" -#: ../../c-api/buffer.rst:211 +#: ../../c-api/buffer.rst:217 msgid "" "This is for use internally by the exporting object. For example, this might " "be re-cast as an integer by the exporter and used to store flags about " @@ -301,22 +309,22 @@ msgid "" "the buffer is released. The consumer MUST NOT alter this value." msgstr "" -#: ../../c-api/buffer.rst:218 +#: ../../c-api/buffer.rst:224 msgid "Constants:" msgstr "常數:" -#: ../../c-api/buffer.rst:222 +#: ../../c-api/buffer.rst:228 msgid "" "The maximum number of dimensions the memory represents. Exporters MUST " "respect this limit, consumers of multi-dimensional buffers SHOULD be able to " "handle up to :c:macro:`!PyBUF_MAX_NDIM` dimensions. Currently set to 64." msgstr "" -#: ../../c-api/buffer.rst:231 +#: ../../c-api/buffer.rst:237 msgid "Buffer request types" msgstr "" -#: ../../c-api/buffer.rst:233 +#: ../../c-api/buffer.rst:239 msgid "" "Buffers are usually obtained by sending a buffer request to an exporting " "object via :c:func:`PyObject_GetBuffer`. Since the complexity of the logical " @@ -324,16 +332,16 @@ msgid "" "argument to specify the exact buffer type it can handle." msgstr "" -#: ../../c-api/buffer.rst:238 +#: ../../c-api/buffer.rst:244 msgid "" "All :c:type:`Py_buffer` fields are unambiguously defined by the request type." msgstr "" -#: ../../c-api/buffer.rst:242 +#: ../../c-api/buffer.rst:248 msgid "request-independent fields" msgstr "" -#: ../../c-api/buffer.rst:243 +#: ../../c-api/buffer.rst:249 msgid "" "The following fields are not influenced by *flags* and must always be filled " "in with the correct values: :c:member:`~Py_buffer.obj`, :c:member:" @@ -341,11 +349,11 @@ msgid "" "itemsize`, :c:member:`~Py_buffer.ndim`." msgstr "" -#: ../../c-api/buffer.rst:248 +#: ../../c-api/buffer.rst:254 msgid "readonly, format" msgstr "" -#: ../../c-api/buffer.rst:252 +#: ../../c-api/buffer.rst:258 msgid "" "Controls the :c:member:`~Py_buffer.readonly` field. If set, the exporter " "MUST provide a writable buffer or else report failure. Otherwise, the " @@ -354,13 +362,13 @@ msgid "" "PyBUF_WRITABLE` can be used to request a simple writable buffer." msgstr "" -#: ../../c-api/buffer.rst:260 +#: ../../c-api/buffer.rst:266 msgid "" "Controls the :c:member:`~Py_buffer.format` field. If set, this field MUST be " "filled in correctly. Otherwise, this field MUST be ``NULL``." msgstr "" -#: ../../c-api/buffer.rst:264 +#: ../../c-api/buffer.rst:270 msgid "" ":c:macro:`PyBUF_WRITABLE` can be \\|'d to any of the flags in the next " "section. Since :c:macro:`PyBUF_SIMPLE` is defined as 0, :c:macro:" @@ -368,159 +376,159 @@ msgid "" "writable buffer." msgstr "" -#: ../../c-api/buffer.rst:268 +#: ../../c-api/buffer.rst:274 msgid "" ":c:macro:`PyBUF_FORMAT` must be \\|'d to any of the flags except :c:macro:" "`PyBUF_SIMPLE`, because the latter already implies format ``B`` (unsigned " "bytes). :c:macro:`!PyBUF_FORMAT` cannot be used on its own." msgstr "" -#: ../../c-api/buffer.rst:274 +#: ../../c-api/buffer.rst:280 msgid "shape, strides, suboffsets" msgstr "" -#: ../../c-api/buffer.rst:276 +#: ../../c-api/buffer.rst:282 msgid "" "The flags that control the logical structure of the memory are listed in " "decreasing order of complexity. Note that each flag contains all bits of the " "flags below it." msgstr "" -#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 -#: ../../c-api/buffer.rst:332 +#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:313 +#: ../../c-api/buffer.rst:338 msgid "Request" msgstr "" -#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 -#: ../../c-api/buffer.rst:332 +#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:313 +#: ../../c-api/buffer.rst:338 msgid "shape" msgstr "" -#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 -#: ../../c-api/buffer.rst:332 +#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:313 +#: ../../c-api/buffer.rst:338 msgid "strides" msgstr "" -#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 -#: ../../c-api/buffer.rst:332 +#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:313 +#: ../../c-api/buffer.rst:338 msgid "suboffsets" msgstr "" -#: ../../c-api/buffer.rst:285 ../../c-api/buffer.rst:287 -#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:309 -#: ../../c-api/buffer.rst:311 ../../c-api/buffer.rst:313 -#: ../../c-api/buffer.rst:315 ../../c-api/buffer.rst:334 -#: ../../c-api/buffer.rst:336 ../../c-api/buffer.rst:338 -#: ../../c-api/buffer.rst:340 ../../c-api/buffer.rst:342 -#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:346 -#: ../../c-api/buffer.rst:348 +#: ../../c-api/buffer.rst:291 ../../c-api/buffer.rst:293 +#: ../../c-api/buffer.rst:295 ../../c-api/buffer.rst:315 +#: ../../c-api/buffer.rst:317 ../../c-api/buffer.rst:319 +#: ../../c-api/buffer.rst:321 ../../c-api/buffer.rst:340 +#: ../../c-api/buffer.rst:342 ../../c-api/buffer.rst:344 +#: ../../c-api/buffer.rst:346 ../../c-api/buffer.rst:348 +#: ../../c-api/buffer.rst:350 ../../c-api/buffer.rst:352 +#: ../../c-api/buffer.rst:354 msgid "yes" msgstr "" -#: ../../c-api/buffer.rst:285 ../../c-api/buffer.rst:334 -#: ../../c-api/buffer.rst:336 +#: ../../c-api/buffer.rst:291 ../../c-api/buffer.rst:340 +#: ../../c-api/buffer.rst:342 msgid "if needed" msgstr "" -#: ../../c-api/buffer.rst:287 ../../c-api/buffer.rst:289 -#: ../../c-api/buffer.rst:291 ../../c-api/buffer.rst:309 -#: ../../c-api/buffer.rst:311 ../../c-api/buffer.rst:313 -#: ../../c-api/buffer.rst:315 ../../c-api/buffer.rst:338 -#: ../../c-api/buffer.rst:340 ../../c-api/buffer.rst:342 -#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:346 -#: ../../c-api/buffer.rst:348 +#: ../../c-api/buffer.rst:293 ../../c-api/buffer.rst:295 +#: ../../c-api/buffer.rst:297 ../../c-api/buffer.rst:315 +#: ../../c-api/buffer.rst:317 ../../c-api/buffer.rst:319 +#: ../../c-api/buffer.rst:321 ../../c-api/buffer.rst:344 +#: ../../c-api/buffer.rst:346 ../../c-api/buffer.rst:348 +#: ../../c-api/buffer.rst:350 ../../c-api/buffer.rst:352 +#: ../../c-api/buffer.rst:354 msgid "NULL" msgstr "NULL" -#: ../../c-api/buffer.rst:298 +#: ../../c-api/buffer.rst:304 msgid "contiguity requests" msgstr "" -#: ../../c-api/buffer.rst:300 +#: ../../c-api/buffer.rst:306 msgid "" "C or Fortran :term:`contiguity <contiguous>` can be explicitly requested, " "with and without stride information. Without stride information, the buffer " "must be C-contiguous." msgstr "" -#: ../../c-api/buffer.rst:307 ../../c-api/buffer.rst:332 +#: ../../c-api/buffer.rst:313 ../../c-api/buffer.rst:338 msgid "contig" msgstr "" -#: ../../c-api/buffer.rst:309 ../../c-api/buffer.rst:315 -#: ../../c-api/buffer.rst:346 ../../c-api/buffer.rst:348 +#: ../../c-api/buffer.rst:315 ../../c-api/buffer.rst:321 +#: ../../c-api/buffer.rst:352 ../../c-api/buffer.rst:354 msgid "C" msgstr "C" -#: ../../c-api/buffer.rst:311 +#: ../../c-api/buffer.rst:317 msgid "F" msgstr "F" -#: ../../c-api/buffer.rst:313 +#: ../../c-api/buffer.rst:319 msgid "C or F" msgstr "C 或 F" -#: ../../c-api/buffer.rst:315 +#: ../../c-api/buffer.rst:321 msgid ":c:macro:`PyBUF_ND`" msgstr ":c:macro:`PyBUF_ND`" -#: ../../c-api/buffer.rst:320 +#: ../../c-api/buffer.rst:326 msgid "compound requests" msgstr "" -#: ../../c-api/buffer.rst:322 +#: ../../c-api/buffer.rst:328 msgid "" "All possible requests are fully defined by some combination of the flags in " "the previous section. For convenience, the buffer protocol provides " "frequently used combinations as single flags." msgstr "" -#: ../../c-api/buffer.rst:326 +#: ../../c-api/buffer.rst:332 msgid "" "In the following table *U* stands for undefined contiguity. The consumer " "would have to call :c:func:`PyBuffer_IsContiguous` to determine contiguity." msgstr "" -#: ../../c-api/buffer.rst:332 +#: ../../c-api/buffer.rst:338 msgid "readonly" msgstr "" -#: ../../c-api/buffer.rst:332 +#: ../../c-api/buffer.rst:338 msgid "format" msgstr "" -#: ../../c-api/buffer.rst:334 ../../c-api/buffer.rst:336 -#: ../../c-api/buffer.rst:338 ../../c-api/buffer.rst:340 -#: ../../c-api/buffer.rst:342 ../../c-api/buffer.rst:344 +#: ../../c-api/buffer.rst:340 ../../c-api/buffer.rst:342 +#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:346 +#: ../../c-api/buffer.rst:348 ../../c-api/buffer.rst:350 msgid "U" msgstr "U" -#: ../../c-api/buffer.rst:334 ../../c-api/buffer.rst:338 -#: ../../c-api/buffer.rst:342 ../../c-api/buffer.rst:346 +#: ../../c-api/buffer.rst:340 ../../c-api/buffer.rst:344 +#: ../../c-api/buffer.rst:348 ../../c-api/buffer.rst:352 msgid "0" msgstr "0" -#: ../../c-api/buffer.rst:336 ../../c-api/buffer.rst:340 -#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:348 +#: ../../c-api/buffer.rst:342 ../../c-api/buffer.rst:346 +#: ../../c-api/buffer.rst:350 ../../c-api/buffer.rst:354 msgid "1 or 0" msgstr "1 或 0" -#: ../../c-api/buffer.rst:353 +#: ../../c-api/buffer.rst:359 msgid "Complex arrays" msgstr "" -#: ../../c-api/buffer.rst:356 +#: ../../c-api/buffer.rst:362 msgid "NumPy-style: shape and strides" msgstr "" -#: ../../c-api/buffer.rst:358 +#: ../../c-api/buffer.rst:364 msgid "" "The logical structure of NumPy-style arrays is defined by :c:member:" "`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`, :c:member:`~Py_buffer." "shape` and :c:member:`~Py_buffer.strides`." msgstr "" -#: ../../c-api/buffer.rst:361 +#: ../../c-api/buffer.rst:367 msgid "" "If ``ndim == 0``, the memory location pointed to by :c:member:`~Py_buffer." "buf` is interpreted as a scalar of size :c:member:`~Py_buffer.itemsize`. In " @@ -528,14 +536,14 @@ msgid "" "strides` are ``NULL``." msgstr "" -#: ../../c-api/buffer.rst:365 +#: ../../c-api/buffer.rst:371 msgid "" "If :c:member:`~Py_buffer.strides` is ``NULL``, the array is interpreted as a " "standard n-dimensional C-array. Otherwise, the consumer must access an n-" "dimensional array as follows:" msgstr "" -#: ../../c-api/buffer.rst:369 +#: ../../c-api/buffer.rst:375 msgid "" "ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * " "strides[n-1];\n" @@ -545,14 +553,14 @@ msgstr "" "strides[n-1];\n" "item = *((typeof(item) *)ptr);" -#: ../../c-api/buffer.rst:375 +#: ../../c-api/buffer.rst:381 msgid "" "As noted above, :c:member:`~Py_buffer.buf` can point to any location within " "the actual memory block. An exporter can check the validity of a buffer with " "this function:" msgstr "" -#: ../../c-api/buffer.rst:379 +#: ../../c-api/buffer.rst:385 msgid "" "def verify_structure(memlen, itemsize, ndim, shape, strides, offset):\n" " \"\"\"Verify that the parameters represent a valid array within\n" @@ -581,11 +589,11 @@ msgid "" " return 0 <= offset+imin and offset+imax+itemsize <= memlen" msgstr "" -#: ../../c-api/buffer.rst:409 +#: ../../c-api/buffer.rst:415 msgid "PIL-style: shape, strides and suboffsets" msgstr "" -#: ../../c-api/buffer.rst:411 +#: ../../c-api/buffer.rst:417 msgid "" "In addition to the regular items, PIL-style arrays can contain pointers that " "must be followed in order to get to the next element in a dimension. For " @@ -596,14 +604,14 @@ msgid "" "x[2][3]`` arrays that can be located anywhere in memory." msgstr "" -#: ../../c-api/buffer.rst:420 +#: ../../c-api/buffer.rst:426 msgid "" "Here is a function that returns a pointer to the element in an N-D array " "pointed to by an N-dimensional index when there are both non-``NULL`` " "strides and suboffsets::" msgstr "" -#: ../../c-api/buffer.rst:424 +#: ../../c-api/buffer.rst:430 msgid "" "void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n" " Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n" @@ -631,25 +639,25 @@ msgstr "" " return (void*)pointer;\n" "}" -#: ../../c-api/buffer.rst:439 +#: ../../c-api/buffer.rst:445 msgid "Buffer-related functions" msgstr "" -#: ../../c-api/buffer.rst:443 +#: ../../c-api/buffer.rst:449 msgid "" "Return ``1`` if *obj* supports the buffer interface otherwise ``0``. When " "``1`` is returned, it doesn't guarantee that :c:func:`PyObject_GetBuffer` " "will succeed. This function always succeeds." msgstr "" -#: ../../c-api/buffer.rst:450 +#: ../../c-api/buffer.rst:456 msgid "" "Send a request to *exporter* to fill in *view* as specified by *flags*. If " "the exporter cannot provide a buffer of the exact type, it MUST raise :exc:" "`BufferError`, set ``view->obj`` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/buffer.rst:455 +#: ../../c-api/buffer.rst:461 msgid "" "On success, fill in *view*, set ``view->obj`` to a new reference to " "*exporter* and return 0. In the case of chained buffer providers that " @@ -657,7 +665,7 @@ msgid "" "instead of *exporter* (See :ref:`Buffer Object Structures <buffer-structs>`)." msgstr "" -#: ../../c-api/buffer.rst:460 +#: ../../c-api/buffer.rst:466 msgid "" "Successful calls to :c:func:`PyObject_GetBuffer` must be paired with calls " "to :c:func:`PyBuffer_Release`, similar to :c:func:`malloc` and :c:func:" @@ -665,7 +673,7 @@ msgid "" "`PyBuffer_Release` must be called exactly once." msgstr "" -#: ../../c-api/buffer.rst:468 +#: ../../c-api/buffer.rst:474 msgid "" "Release the buffer *view* and release the :term:`strong reference` (i.e. " "decrement the reference count) to the view's supporting object, ``view-" @@ -673,19 +681,19 @@ msgid "" "used, otherwise reference leaks may occur." msgstr "" -#: ../../c-api/buffer.rst:473 +#: ../../c-api/buffer.rst:479 msgid "" "It is an error to call this function on a buffer that was not obtained via :" "c:func:`PyObject_GetBuffer`." msgstr "" -#: ../../c-api/buffer.rst:479 +#: ../../c-api/buffer.rst:485 msgid "" "Return the implied :c:member:`~Py_buffer.itemsize` from :c:member:" "`~Py_buffer.format`. On error, raise an exception and return -1." msgstr "" -#: ../../c-api/buffer.rst:487 +#: ../../c-api/buffer.rst:493 msgid "" "Return ``1`` if the memory defined by the *view* is C-style (*order* is " "``'C'``) or Fortran-style (*order* is ``'F'``) :term:`contiguous` or either " @@ -693,69 +701,69 @@ msgid "" "succeeds." msgstr "" -#: ../../c-api/buffer.rst:494 +#: ../../c-api/buffer.rst:500 msgid "" "Get the memory area pointed to by the *indices* inside the given *view*. " "*indices* must point to an array of ``view->ndim`` indices." msgstr "" -#: ../../c-api/buffer.rst:500 +#: ../../c-api/buffer.rst:506 msgid "" "Copy contiguous *len* bytes from *buf* to *view*. *fort* can be ``'C'`` or " "``'F'`` (for C-style or Fortran-style ordering). ``0`` is returned on " "success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:507 +#: ../../c-api/buffer.rst:513 msgid "" "Copy *len* bytes from *src* to its contiguous representation in *buf*. " "*order* can be ``'C'`` or ``'F'`` or ``'A'`` (for C-style or Fortran-style " "ordering or either one). ``0`` is returned on success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:511 +#: ../../c-api/buffer.rst:517 msgid "This function fails if *len* != *src->len*." msgstr "" -#: ../../c-api/buffer.rst:516 +#: ../../c-api/buffer.rst:522 msgid "" "Copy data from *src* to *dest* buffer. Can convert between C-style and or " "Fortran-style buffers." msgstr "" -#: ../../c-api/buffer.rst:519 +#: ../../c-api/buffer.rst:525 msgid "``0`` is returned on success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:523 +#: ../../c-api/buffer.rst:529 msgid "" "Fill the *strides* array with byte-strides of a :term:`contiguous` (C-style " "if *order* is ``'C'`` or Fortran-style if *order* is ``'F'``) array of the " "given shape with the given number of bytes per element." msgstr "" -#: ../../c-api/buffer.rst:530 +#: ../../c-api/buffer.rst:536 msgid "" "Handle buffer requests for an exporter that wants to expose *buf* of size " "*len* with writability set according to *readonly*. *buf* is interpreted as " "a sequence of unsigned bytes." msgstr "" -#: ../../c-api/buffer.rst:534 +#: ../../c-api/buffer.rst:540 msgid "" "The *flags* argument indicates the request type. This function always fills " "in *view* as specified by flags, unless *buf* has been designated as read-" "only and :c:macro:`PyBUF_WRITABLE` is set in *flags*." msgstr "" -#: ../../c-api/buffer.rst:538 +#: ../../c-api/buffer.rst:544 msgid "" "On success, set ``view->obj`` to a new reference to *exporter* and return 0. " "Otherwise, raise :exc:`BufferError`, set ``view->obj`` to ``NULL`` and " "return ``-1``;" msgstr "" -#: ../../c-api/buffer.rst:542 +#: ../../c-api/buffer.rst:548 msgid "" "If this function is used as part of a :ref:`getbufferproc <buffer-structs>`, " "*exporter* MUST be set to the exporting object and *flags* must be passed " @@ -782,14 +790,14 @@ msgstr "buffer object(緩衝物件)" msgid "PyBufferProcs (C type)" msgstr "PyBufferProcs(C 型別)" -#: ../../c-api/buffer.rst:295 +#: ../../c-api/buffer.rst:301 msgid "contiguous" msgstr "contiguous(連續的)" -#: ../../c-api/buffer.rst:295 +#: ../../c-api/buffer.rst:301 msgid "C-contiguous" msgstr "C-contiguous(C 連續的)" -#: ../../c-api/buffer.rst:295 +#: ../../c-api/buffer.rst:301 msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" diff --git a/c-api/complex.po b/c-api/complex.po index a6448fac77..a22103f9b4 100644 --- a/c-api/complex.po +++ b/c-api/complex.po @@ -81,14 +81,14 @@ msgstr "以 C 的 :c:type:`Py_complex` 表示形式來回傳兩個複數之和 #: ../../c-api/complex.rst:49 msgid "" -"Return the difference between two complex numbers, using the C :c:type:" -"`Py_complex` representation." +"Return the difference between two complex numbers, using the " +"C :c:type:`Py_complex` representation." msgstr "以 C 的 :c:type:`Py_complex` 表示形式來回傳兩個複數間的差。" #: ../../c-api/complex.rst:55 msgid "" -"Return the negation of the complex number *num*, using the C :c:type:" -"`Py_complex` representation." +"Return the negation of the complex number *num*, using the " +"C :c:type:`Py_complex` representation." msgstr "" "以 C 的 :c:type:`Py_complex` 表示形式來回傳複數 *num* 的相反數 (negation)。" @@ -106,16 +106,16 @@ msgstr "以 C 的 :c:type:`Py_complex` 表示形式來回傳兩個複數的商 #: ../../c-api/complex.rst:70 msgid "" -"If *divisor* is null, this method returns zero and sets :c:data:`errno` to :" -"c:macro:`!EDOM`." +"If *divisor* is null, this method returns zero and sets :c:data:`errno` " +"to :c:macro:`!EDOM`." msgstr "" -"如果 *divisor* 為 null,則此方法會回傳零並將 :c:data:`errno` 設定為 :c:macro:" -"`!EDOM`。" +"如果 *divisor* 為 null,則此方法會回傳零並將 :c:data:`errno` 設定" +"為 :c:macro:`!EDOM`。" #: ../../c-api/complex.rst:76 msgid "" -"Return the exponentiation of *num* by *exp*, using the C :c:type:" -"`Py_complex` representation." +"Return the exponentiation of *num* by *exp*, using the " +"C :c:type:`Py_complex` representation." msgstr "" "以 C 的 :c:type:`Py_complex` 表示形式來回傳 *num* 的 *exp* 次方的結果。" @@ -141,13 +141,13 @@ msgid "" "This instance of :c:type:`PyTypeObject` represents the Python complex number " "type. It is the same object as :class:`complex` in the Python layer." msgstr "" -"這個 :c:type:`PyTypeObject` 的實例代表 Python 複數型別。它與 Python 層中的 :" -"class:`complex` 是同一個物件。" +"這個 :c:type:`PyTypeObject` 的實例代表 Python 複數型別。它與 Python 層中" +"的 :class:`complex` 是同一個物件。" #: ../../c-api/complex.rst:100 msgid "" -"Return true if its argument is a :c:type:`PyComplexObject` or a subtype of :" -"c:type:`PyComplexObject`. This function always succeeds." +"Return true if its argument is a :c:type:`PyComplexObject` or a subtype " +"of :c:type:`PyComplexObject`. This function always succeeds." msgstr "" "如果其引數是一個 :c:type:`PyComplexObject` 或者是 :c:type:`PyComplexObject` " "的子型別,則會回傳 true。這個函式不會失敗。" @@ -181,25 +181,24 @@ msgid "Return the real part of *op* as a C :c:expr:`double`." msgstr "以 C 的 :c:expr:`double` 形式回傳 *op* 的實部。" #: ../../c-api/complex.rst:126 -#, fuzzy msgid "" -"If *op* is not a Python complex number object but has a :meth:`~object." -"__complex__` method, this method will first be called to convert *op* to a " -"Python complex number object. If :meth:`!__complex__` is not defined then " -"it falls back to call :c:func:`PyFloat_AsDouble` and returns its result." +"If *op* is not a Python complex number object but has " +"a :meth:`~object.__complex__` method, this method will first be called to " +"convert *op* to a Python complex number object. If :meth:`!__complex__` is " +"not defined then it falls back to call :c:func:`PyFloat_AsDouble` and " +"returns its result." msgstr "" "如果 *op* 不是 Python 複數物件,但有一個 :meth:`~object.__complex__` 方法,則" "首先會呼叫該方法將 *op* 轉換為 Python 複數物件。如果 :meth:`!__complex__` 並" -"未定義,那麼它會回退到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未" -"定義,則它將繼續回退為 :meth:`~object.__index__`。" +"未定義,那麼它會回退到呼叫 :func:`PyFloat_AsDouble` 並回傳其結果。" #: ../../c-api/complex.rst:132 ../../c-api/complex.rst:148 msgid "" "Upon failure, this method returns ``-1.0`` with an exception set, so one " "should call :c:func:`PyErr_Occurred` to check for errors." msgstr "" -"失敗時,此方法回傳 ``-1.0`` 並設定例外,因此應該呼叫 :c:func:" -"`PyErr_Occurred` 來檢查錯誤。" +"失敗時,此方法回傳 ``-1.0`` 並設定例外,因此應該呼" +"叫 :c:func:`PyErr_Occurred` 來檢查錯誤。" #: ../../c-api/complex.rst:135 ../../c-api/complex.rst:151 msgid "Use :meth:`~object.__complex__` if available." @@ -210,18 +209,16 @@ msgid "Return the imaginary part of *op* as a C :c:expr:`double`." msgstr "將 *op* 的虛部作為 C 的 :c:expr:`double` 回傳。" #: ../../c-api/complex.rst:142 -#, fuzzy msgid "" -"If *op* is not a Python complex number object but has a :meth:`~object." -"__complex__` method, this method will first be called to convert *op* to a " -"Python complex number object. If :meth:`!__complex__` is not defined then " -"it falls back to call :c:func:`PyFloat_AsDouble` and returns ``0.0`` on " -"success." +"If *op* is not a Python complex number object but has " +"a :meth:`~object.__complex__` method, this method will first be called to " +"convert *op* to a Python complex number object. If :meth:`!__complex__` is " +"not defined then it falls back to call :c:func:`PyFloat_AsDouble` and " +"returns ``0.0`` on success." msgstr "" "如果 *op* 不是 Python 複數物件,但有一個 :meth:`~object.__complex__` 方法,則" "首先會呼叫該方法將 *op* 轉換為 Python 複數物件。如果 :meth:`!__complex__` 並" -"未定義,那麼它會回退到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未" -"定義,則它將繼續回退為 :meth:`~object.__index__`。" +"未定義,那麼它會回退到呼叫 :func:`PyFloat_AsDouble` 並於成功時回傳 ``0.0``。" #: ../../c-api/complex.rst:156 msgid "Return the :c:type:`Py_complex` value of the complex number *op*." @@ -229,11 +226,11 @@ msgstr "回傳複數 *op* 的 :c:type:`Py_complex` 值。" #: ../../c-api/complex.rst:158 msgid "" -"If *op* is not a Python complex number object but has a :meth:`~object." -"__complex__` method, this method will first be called to convert *op* to a " -"Python complex number object. If :meth:`!__complex__` is not defined then " -"it falls back to :meth:`~object.__float__`. If :meth:`!__float__` is not " -"defined then it falls back to :meth:`~object.__index__`." +"If *op* is not a Python complex number object but has " +"a :meth:`~object.__complex__` method, this method will first be called to " +"convert *op* to a Python complex number object. If :meth:`!__complex__` is " +"not defined then it falls back to :meth:`~object.__float__`. If :meth:`!" +"__float__` is not defined then it falls back to :meth:`~object.__index__`." msgstr "" "如果 *op* 不是 Python 複數物件,但有一個 :meth:`~object.__complex__` 方法,則" "首先會呼叫該方法將 *op* 轉換為 Python 複數物件。如果 :meth:`!__complex__` 並" @@ -242,9 +239,9 @@ msgstr "" #: ../../c-api/complex.rst:164 msgid "" -"Upon failure, this method returns :c:type:`Py_complex` with :c:member:" -"`~Py_complex.real` set to ``-1.0`` and with an exception set, so one should " -"call :c:func:`PyErr_Occurred` to check for errors." +"Upon failure, this method returns :c:type:`Py_complex` " +"with :c:member:`~Py_complex.real` set to ``-1.0`` and with an exception set, " +"so one should call :c:func:`PyErr_Occurred` to check for errors." msgstr "" "失敗時,此方法回傳 :c:type:`Py_complex` 並將 :c:member:`~Py_complex.real` 設" "為 ``-1.0``,並設定例外,因此應該呼叫 :c:func:`PyErr_Occurred` 來檢查錯誤。" diff --git a/c-api/dict.po b/c-api/dict.po index 5a9c30db1f..b11b75f775 100644 --- a/c-api/dict.po +++ b/c-api/dict.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-21 00:13+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,8 +34,8 @@ msgid "" "This instance of :c:type:`PyTypeObject` represents the Python dictionary " "type. This is the same object as :class:`dict` in the Python layer." msgstr "" -":c:type:`PyTypeObject` 實例代表一個 Python 字典型態。此與 Python 層中的 :" -"class:`dict` 為同一個物件。" +":c:type:`PyTypeObject` 實例代表一個 Python 字典型態。此與 Python 層中" +"的 :class:`dict` 為同一個物件。" #: ../../c-api/dict.rst:24 msgid "" @@ -77,9 +77,9 @@ msgstr "" #: ../../c-api/dict.rst:60 msgid "" -"This is the same as :c:func:`PyDict_Contains`, but *key* is specified as a :" -"c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"This is the same as :c:func:`PyDict_Contains`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/dict.rst:69 @@ -88,32 +88,32 @@ msgstr "" #: ../../c-api/dict.rst:74 msgid "" -"Insert *val* into the dictionary *p* with a key of *key*. *key* must be :" -"term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return ``0`` " -"on success or ``-1`` on failure. This function *does not* steal a reference " -"to *val*." +"Insert *val* into the dictionary *p* with a key of *key*. *key* must " +"be :term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return " +"``0`` on success or ``-1`` on failure. This function *does not* steal a " +"reference to *val*." msgstr "" #: ../../c-api/dict.rst:82 msgid "" -"This is the same as :c:func:`PyDict_SetItem`, but *key* is specified as a :c:" -"expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"This is the same as :c:func:`PyDict_SetItem`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/dict.rst:89 msgid "" -"Remove the entry in dictionary *p* with key *key*. *key* must be :term:" -"`hashable`; if it isn't, :exc:`TypeError` is raised. If *key* is not in the " -"dictionary, :exc:`KeyError` is raised. Return ``0`` on success or ``-1`` on " -"failure." +"Remove the entry in dictionary *p* with key *key*. *key* must " +"be :term:`hashable`; if it isn't, :exc:`TypeError` is raised. If *key* is " +"not in the dictionary, :exc:`KeyError` is raised. Return ``0`` on success or " +"``-1`` on failure." msgstr "" #: ../../c-api/dict.rst:97 msgid "" -"This is the same as :c:func:`PyDict_DelItem`, but *key* is specified as a :c:" -"expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"This is the same as :c:func:`PyDict_DelItem`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/dict.rst:104 @@ -134,11 +134,11 @@ msgstr "" #: ../../c-api/dict.rst:110 ../../c-api/dict.rst:207 msgid "On error, raise an exception and return ``-1``." -msgstr "" +msgstr "錯誤發生時,引發一個例外並回傳 ``-1``。" #: ../../c-api/dict.rst:114 msgid "See also the :c:func:`PyObject_GetItem` function." -msgstr "" +msgstr "另見 :c:func:`PyObject_GetItem` 函式。" #: ../../c-api/dict.rst:119 msgid "" @@ -149,9 +149,9 @@ msgstr "" #: ../../c-api/dict.rst:125 msgid "" -"Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" -"`~object.__eq__` methods are silently ignored. Prefer the :c:func:" -"`PyDict_GetItemWithError` function instead." +"Exceptions that occur while this calls :meth:`~object.__hash__` " +"and :meth:`~object.__eq__` methods are silently ignored. Prefer " +"the :c:func:`PyDict_GetItemWithError` function instead." msgstr "" #: ../../c-api/dict.rst:129 @@ -169,24 +169,25 @@ msgstr "" #: ../../c-api/dict.rst:144 msgid "" -"This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a :c:" -"expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/dict.rst:150 msgid "" -"Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" -"`~object.__eq__` methods or while creating the temporary :class:`str` object " -"are silently ignored. Prefer using the :c:func:`PyDict_GetItemWithError` " -"function with your own :c:func:`PyUnicode_FromString` *key* instead." +"Exceptions that occur while this calls :meth:`~object.__hash__` " +"and :meth:`~object.__eq__` methods or while creating the " +"temporary :class:`str` object are silently ignored. Prefer using " +"the :c:func:`PyDict_GetItemWithError` function with your " +"own :c:func:`PyUnicode_FromString` *key* instead." msgstr "" #: ../../c-api/dict.rst:159 msgid "" -"Similar than :c:func:`PyDict_GetItemRef`, but *key* is specified as a :c:" -"expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"Similar to :c:func:`PyDict_GetItemRef`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/dict.rst:168 @@ -239,7 +240,7 @@ msgstr "" #: ../../c-api/dict.rst:209 msgid "" -"This is similar to :meth:`dict.pop`, but without the default value and not " +"Similar to :meth:`dict.pop`, but without the default value and not " "raising :exc:`KeyError` if the key missing." msgstr "" @@ -252,37 +253,37 @@ msgstr "" #: ../../c-api/dict.rst:226 msgid "" "Return a :c:type:`PyListObject` containing all the items from the dictionary." -msgstr "" +msgstr "回傳一個包含字典中所有項目的 :c:type:`PyListObject`。" #: ../../c-api/dict.rst:231 msgid "" "Return a :c:type:`PyListObject` containing all the keys from the dictionary." -msgstr "" +msgstr "回傳一個包含字典中所有鍵的 :c:type:`PyListObject`。" #: ../../c-api/dict.rst:236 msgid "" "Return a :c:type:`PyListObject` containing all the values from the " "dictionary *p*." -msgstr "" +msgstr "回傳一個包含字典 *p* 中所有值的 :c:type:`PyListObject`。" #: ../../c-api/dict.rst:244 msgid "" "Return the number of items in the dictionary. This is equivalent to " "``len(p)`` on a dictionary." -msgstr "" +msgstr "回傳字典中項目的數量。此與於字典呼叫 ``len(p)`` 等效。" #: ../../c-api/dict.rst:250 msgid "" -"Iterate over all key-value pairs in the dictionary *p*. The :c:type:" -"`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` prior to the " -"first call to this function to start the iteration; the function returns " -"true for each pair in the dictionary, and false once all pairs have been " -"reported. The parameters *pkey* and *pvalue* should either point to :c:expr:" -"`PyObject*` variables that will be filled in with each key and value, " -"respectively, or may be ``NULL``. Any references returned through them are " -"borrowed. *ppos* should not be altered during iteration. Its value " -"represents offsets within the internal dictionary structure, and since the " -"structure is sparse, the offsets are not consecutive." +"Iterate over all key-value pairs in the dictionary *p*. " +"The :c:type:`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` " +"prior to the first call to this function to start the iteration; the " +"function returns true for each pair in the dictionary, and false once all " +"pairs have been reported. The parameters *pkey* and *pvalue* should either " +"point to :c:expr:`PyObject*` variables that will be filled in with each key " +"and value, respectively, or may be ``NULL``. Any references returned " +"through them are borrowed. *ppos* should not be altered during iteration. " +"Its value represents offsets within the internal dictionary structure, and " +"since the structure is sparse, the offsets are not consecutive." msgstr "" #: ../../c-api/dict.rst:261 @@ -348,8 +349,9 @@ msgstr "" #: ../../c-api/dict.rst:293 msgid "" "The function is not thread-safe in the :term:`free-threaded <free " -"threading>` build without external synchronization. You can use :c:macro:" -"`Py_BEGIN_CRITICAL_SECTION` to lock the dictionary while iterating over it::" +"threading>` build without external synchronization. You can " +"use :c:macro:`Py_BEGIN_CRITICAL_SECTION` to lock the dictionary while " +"iterating over it::" msgstr "" #: ../../c-api/dict.rst:298 @@ -360,6 +362,11 @@ msgid "" "}\n" "Py_END_CRITICAL_SECTION();" msgstr "" +"Py_BEGIN_CRITICAL_SECTION(self->dict);\n" +"while (PyDict_Next(self->dict, &pos, &key, &value)) {\n" +" ...\n" +"}\n" +"Py_END_CRITICAL_SECTION();" #: ../../c-api/dict.rst:307 msgid "" @@ -373,10 +380,10 @@ msgstr "" #: ../../c-api/dict.rst:317 msgid "" -"This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to ``a." -"update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall back " -"to the iterating over a sequence of key value pairs if the second argument " -"has no \"keys\" attribute. Return ``0`` on success or ``-1`` if an " +"This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to " +"``a.update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall " +"back to the iterating over a sequence of key value pairs if the second " +"argument has no \"keys\" attribute. Return ``0`` on success or ``-1`` if an " "exception was raised." msgstr "" @@ -411,15 +418,15 @@ msgstr "" #: ../../c-api/dict.rst:349 msgid "" -"Clear watcher identified by *watcher_id* previously returned from :c:func:" -"`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error (e.g. if the " -"given *watcher_id* was never registered.)" +"Clear watcher identified by *watcher_id* previously returned " +"from :c:func:`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error " +"(e.g. if the given *watcher_id* was never registered.)" msgstr "" #: ../../c-api/dict.rst:357 msgid "" -"Mark dictionary *dict* as watched. The callback granted *watcher_id* by :c:" -"func:`PyDict_AddWatcher` will be called when *dict* is modified or " +"Mark dictionary *dict* as watched. The callback granted *watcher_id* " +"by :c:func:`PyDict_AddWatcher` will be called when *dict* is modified or " "deallocated. Return ``0`` on success or ``-1`` on error." msgstr "" @@ -485,8 +492,8 @@ msgstr "" #: ../../c-api/dict.rst:409 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " -"will be printed as an unraisable exception using :c:func:" -"`PyErr_WriteUnraisable`. Otherwise it should return ``0``." +"will be printed as an unraisable exception " +"using :c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" #: ../../c-api/dict.rst:413 diff --git a/c-api/function.po b/c-api/function.po index c9e9a6c79f..299c34cd6c 100644 --- a/c-api/function.po +++ b/c-api/function.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-12-13 00:03+0000\n" +"POT-Creation-Date: 2025-02-17 00:15+0000\n" "PO-Revision-Date: 2022-11-12 15:45+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,17 +37,17 @@ msgstr "用於函式的 C 結構。" #: ../../c-api/function.rst:22 msgid "" "This is an instance of :c:type:`PyTypeObject` and represents the Python " -"function type. It is exposed to Python programmers as ``types." -"FunctionType``." +"function type. It is exposed to Python programmers as " +"``types.FunctionType``." msgstr "" "這是個 :c:type:`PyTypeObject` 的實例,且代表了 Python 函式型別,Python 程式設" "計者可透過 ``types.FunctionType`` 使用它。" #: ../../c-api/function.rst:28 msgid "" -"Return true if *o* is a function object (has type :c:data:" -"`PyFunction_Type`). The parameter must not be ``NULL``. This function " -"always succeeds." +"Return true if *o* is a function object (has " +"type :c:data:`PyFunction_Type`). The parameter must not be ``NULL``. This " +"function always succeeds." msgstr "" "如果 *o* 是個函式物件(擁有 :c:data:`PyFunction_Type` 的型別)則回傳 true。參" "數必須不為 ``NULL``。此函式必能成功執行。" @@ -63,28 +63,30 @@ msgstr "" #: ../../c-api/function.rst:37 msgid "" -"The function's docstring and name are retrieved from the code object. :attr:" -"`~function.__module__` is retrieved from *globals*. The argument defaults, " -"annotations and closure are set to ``NULL``. :attr:`~function.__qualname__` " -"is set to the same value as the code object's :attr:`~codeobject." -"co_qualname` field." +"The function's docstring and name are retrieved from the code " +"object. :attr:`~function.__module__` is retrieved from *globals*. The " +"argument defaults, annotations and closure are set to " +"``NULL``. :attr:`~function.__qualname__` is set to the same value as the " +"code object's :attr:`~codeobject.co_qualname` field." msgstr "" -"函式的文件字串 (docstring) 和名稱是從程式碼物件所取得,:attr:`~function." -"__module__` 是自 *globals* 所取得。引數預設值、標註 (annotation) 和閉包 " -"(closure) 被設為 ``NULL``,:attr:`~function.__qualname__` 被設為和程式碼物" +"函式的文件字串 (docstring) 和名稱是從程式碼物件所取" +"得,:attr:`~function.__module__` 是自 *globals* 所取得。引數預設值、標註 " +"(annotation) 和閉包 (closure) 被設為 " +"``NULL``,:attr:`~function.__qualname__` 被設為和程式碼物" "件 :attr:`~codeobject.co_qualname` 欄位相同的值。" #: ../../c-api/function.rst:46 msgid "" -"As :c:func:`PyFunction_New`, but also allows setting the function object's :" -"attr:`~function.__qualname__` attribute. *qualname* should be a unicode " -"object or ``NULL``; if ``NULL``, the :attr:`!__qualname__` attribute is set " -"to the same value as the code object's :attr:`~codeobject.co_qualname` field." +"As :c:func:`PyFunction_New`, but also allows setting the function " +"object's :attr:`~function.__qualname__` attribute. *qualname* should be a " +"unicode object or ``NULL``; if ``NULL``, the :attr:`!__qualname__` attribute " +"is set to the same value as the code " +"object's :attr:`~codeobject.co_qualname` field." msgstr "" -"和 :c:func:`PyFunction_New` 相似,但也允許函式物件 :attr:`~function." -"__qualname__` 屬性的設定,*qualname* 應為一個 unicode 物件或是 ``NULL``;如" -"為 ``NULL``,:attr:`!__qualname__` 屬性會被設為與程式碼物件 :attr:" -"`~codeobject.co_qualname` 欄位相同的值。" +"和 :c:func:`PyFunction_New` 相似,但也允許函式物" +"件 :attr:`~function.__qualname__` 屬性的設定,*qualname* 應為一個 unicode 物" +"件或是 ``NULL``;如為 ``NULL``,:attr:`!__qualname__` 屬性會被設為與程式碼物" +"件 :attr:`~codeobject.co_qualname` 欄位相同的值。" #: ../../c-api/function.rst:57 msgid "Return the code object associated with the function object *op*." @@ -100,8 +102,9 @@ msgid "" "attribute of the :ref:`function object <user-defined-funcs>` *op*. It can be " "*NULL*." msgstr "" -"回傳一個\\ :ref:`函式物件 <user-defined-funcs>` *op* 之 :attr:`~function." -"__module__` 屬性的 :term:`borrowed reference`,它可以是 *NULL*。" +"回傳一個\\ :ref:`函式物件 <user-defined-funcs>` *op* " +"之 :attr:`~function.__module__` 屬性的 :term:`borrowed reference`,它可以是 " +"*NULL*。" #: ../../c-api/function.rst:71 msgid "" @@ -180,39 +183,55 @@ msgstr "" #: ../../c-api/function.rst:138 msgid "" -"Clear watcher identified by *watcher_id* previously returned from :c:func:" -"`PyFunction_AddWatcher` for the current interpreter. Return ``0`` on " -"success, or ``-1`` and set an exception on error (e.g. if the given " -"*watcher_id* was never registered.)" +"Clear watcher identified by *watcher_id* previously returned " +"from :c:func:`PyFunction_AddWatcher` for the current interpreter. Return " +"``0`` on success, or ``-1`` and set an exception on error (e.g. if the " +"given *watcher_id* was never registered.)" msgstr "" #: ../../c-api/function.rst:148 -msgid "" -"Enumeration of possible function watcher events: - " -"``PyFunction_EVENT_CREATE`` - ``PyFunction_EVENT_DESTROY`` - " -"``PyFunction_EVENT_MODIFY_CODE`` - ``PyFunction_EVENT_MODIFY_DEFAULTS`` - " -"``PyFunction_EVENT_MODIFY_KWDEFAULTS``" +msgid "Enumeration of possible function watcher events:" msgstr "" -#: ../../c-api/function.rst:160 +#: ../../c-api/function.rst:150 +msgid "``PyFunction_EVENT_CREATE``" +msgstr "``PyFunction_EVENT_CREATE``" + +#: ../../c-api/function.rst:151 +msgid "``PyFunction_EVENT_DESTROY``" +msgstr "``PyFunction_EVENT_DESTROY``" + +#: ../../c-api/function.rst:152 +msgid "``PyFunction_EVENT_MODIFY_CODE``" +msgstr "``PyFunction_EVENT_MODIFY_CODE``" + +#: ../../c-api/function.rst:153 +msgid "``PyFunction_EVENT_MODIFY_DEFAULTS``" +msgstr "``PyFunction_EVENT_MODIFY_DEFAULTS``" + +#: ../../c-api/function.rst:154 +msgid "``PyFunction_EVENT_MODIFY_KWDEFAULTS``" +msgstr "``PyFunction_EVENT_MODIFY_KWDEFAULTS``" + +#: ../../c-api/function.rst:161 msgid "Type of a function watcher callback function." msgstr "" -#: ../../c-api/function.rst:162 +#: ../../c-api/function.rst:163 msgid "" "If *event* is ``PyFunction_EVENT_CREATE`` or ``PyFunction_EVENT_DESTROY`` " -"then *new_value* will be ``NULL``. Otherwise, *new_value* will hold a :term:" -"`borrowed reference` to the new value that is about to be stored in *func* " -"for the attribute that is being modified." +"then *new_value* will be ``NULL``. Otherwise, *new_value* will hold " +"a :term:`borrowed reference` to the new value that is about to be stored in " +"*func* for the attribute that is being modified." msgstr "" -#: ../../c-api/function.rst:167 +#: ../../c-api/function.rst:168 msgid "" "The callback may inspect but must not modify *func*; doing so could have " "unpredictable effects, including infinite recursion." msgstr "" -#: ../../c-api/function.rst:170 +#: ../../c-api/function.rst:171 msgid "" "If *event* is ``PyFunction_EVENT_CREATE``, then the callback is invoked " "after `func` has been fully initialized. Otherwise, the callback is invoked " @@ -224,7 +243,7 @@ msgid "" "semantics of the Python code being executed." msgstr "" -#: ../../c-api/function.rst:179 +#: ../../c-api/function.rst:180 msgid "" "If *event* is ``PyFunction_EVENT_DESTROY``, Taking a reference in the " "callback to the about-to-be-destroyed function will resurrect it, preventing " @@ -232,14 +251,14 @@ msgid "" "later, any watcher callbacks active at that time will be called again." msgstr "" -#: ../../c-api/function.rst:184 +#: ../../c-api/function.rst:185 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " -"will be printed as an unraisable exception using :c:func:" -"`PyErr_WriteUnraisable`. Otherwise it should return ``0``." +"will be printed as an unraisable exception " +"using :c:func:`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" -#: ../../c-api/function.rst:188 +#: ../../c-api/function.rst:189 msgid "" "There may already be a pending exception set on entry to the callback. In " "this case, the callback should return ``0`` with the same exception still " diff --git a/c-api/gcsupport.po b/c-api/gcsupport.po index 51c11e9884..5fd35ae6f8 100644 --- a/c-api/gcsupport.po +++ b/c-api/gcsupport.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2025-04-13 00:40+0000\n" "PO-Revision-Date: 2018-05-23 14:31+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -369,7 +369,7 @@ msgstr "" msgid "" "Type of the visitor function to be passed to :c:func:" "`PyUnstable_GC_VisitObjects`. *arg* is the same as the *arg* passed to " -"``PyUnstable_GC_VisitObjects``. Return ``0`` to continue iteration, return " -"``1`` to stop iteration. Other return values are reserved for now so " +"``PyUnstable_GC_VisitObjects``. Return ``1`` to continue iteration, return " +"``0`` to stop iteration. Other return values are reserved for now so " "behavior on returning anything else is undefined." msgstr "" diff --git a/c-api/hash.po b/c-api/hash.po index 42324bd36d..01b52c5549 100644 --- a/c-api/hash.po +++ b/c-api/hash.po @@ -22,10 +22,9 @@ msgid "PyHash API" msgstr "PyHash API" #: ../../c-api/hash.rst:6 -#, fuzzy msgid "" "See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`." -msgstr "另請參閱 :c:member:`PyTypeObject.tp_hash` 成員。" +msgstr "另請參閱 :c:member:`PyTypeObject.tp_hash` 成員和 :ref:`numeric-hash`。" #: ../../c-api/hash.rst:10 msgid "Hash value type: signed integer." diff --git a/c-api/init.po b/c-api/init.po index a4bc79d1a8..0ce89e728e 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-07 00:13+0000\n" +"POT-Creation-Date: 2025-02-12 00:13+0000\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -854,7 +854,7 @@ msgstr "" #: ../../c-api/init.rst:900 msgid "" "Use :c:func:`Py_DecodeLocale` to decode a bytes string to get " -"a :c:expr:`wchar_*` string." +"a :c:expr:`wchar_t*` string." msgstr "" #: ../../c-api/init.rst:604 @@ -2145,7 +2145,7 @@ msgstr "" #: ../../c-api/init.rst:1790 msgid "A Per-Interpreter GIL" -msgstr "" +msgstr "直譯器各別持有的 GIL" #: ../../c-api/init.rst:1792 msgid "" diff --git a/c-api/init_config.po b/c-api/init_config.po index a8fedbc984..3397a5853b 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-11 00:14+0000\n" +"POT-Creation-Date: 2025-03-14 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -479,7 +479,7 @@ msgstr "" #: ../../c-api/init_config.rst:952 ../../c-api/init_config.rst:1012 #: ../../c-api/init_config.rst:1064 ../../c-api/init_config.rst:1126 #: ../../c-api/init_config.rst:1180 ../../c-api/init_config.rst:1209 -#: ../../c-api/init_config.rst:1309 +#: ../../c-api/init_config.rst:1298 msgid "Default: ``0``." msgstr "預設:``0``。" @@ -573,7 +573,7 @@ msgid "" "`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -#: ../../c-api/init_config.rst:401 ../../c-api/init_config.rst:1370 +#: ../../c-api/init_config.rst:401 ../../c-api/init_config.rst:1359 msgid "" "The caller is responsible to handle exceptions (error or exit) using :c:func:" "`PyStatus_Exception` and :c:func:`Py_ExitStatusException`." @@ -902,7 +902,7 @@ msgid "stdin is always opened in buffered mode." msgstr "" #: ../../c-api/init_config.rst:645 ../../c-api/init_config.rst:678 -#: ../../c-api/init_config.rst:1197 ../../c-api/init_config.rst:1341 +#: ../../c-api/init_config.rst:1197 ../../c-api/init_config.rst:1330 msgid "Default: ``1``." msgstr "預設值:``1``。" @@ -1215,7 +1215,7 @@ msgid "Install Python signal handlers?" msgstr "" #: ../../c-api/init_config.rst:863 ../../c-api/init_config.rst:1047 -#: ../../c-api/init_config.rst:1071 ../../c-api/init_config.rst:1293 +#: ../../c-api/init_config.rst:1071 ../../c-api/init_config.rst:1282 msgid "Default: ``1`` in Python mode, ``0`` in isolated mode." msgstr "" @@ -1434,8 +1434,8 @@ msgid "" "`Py_GetArgcArgv` function." msgstr "" -#: ../../c-api/init_config.rst:1029 ../../c-api/init_config.rst:1328 -#: ../../c-api/init_config.rst:1347 +#: ../../c-api/init_config.rst:1029 ../../c-api/init_config.rst:1317 +#: ../../c-api/init_config.rst:1336 msgid "Default: empty list." msgstr "" @@ -1740,101 +1740,88 @@ msgid "Set to ``0`` by the :option:`-E` environment variable." msgstr "" #: ../../c-api/init_config.rst:1276 -msgid "" -"If non-zero, ``stdout`` and ``stderr`` will be redirected to the system log." -msgstr "" - -#: ../../c-api/init_config.rst:1279 -msgid "Only available on macOS 10.12 and later, and on iOS." -msgstr "" - -#: ../../c-api/init_config.rst:1281 -msgid "Default: ``0`` (don't use system log)." -msgstr "" - -#: ../../c-api/init_config.rst:1287 msgid "If non-zero, add the user site directory to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1289 +#: ../../c-api/init_config.rst:1278 msgid "Set to ``0`` by the :option:`-s` and :option:`-I` command line options." msgstr "" -#: ../../c-api/init_config.rst:1291 +#: ../../c-api/init_config.rst:1280 msgid "Set to ``0`` by the :envvar:`PYTHONNOUSERSITE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1297 +#: ../../c-api/init_config.rst:1286 msgid "" "Verbose mode. If greater than ``0``, print a message each time a module is " "imported, showing the place (filename or built-in module) from which it is " "loaded." msgstr "" -#: ../../c-api/init_config.rst:1301 +#: ../../c-api/init_config.rst:1290 msgid "" "If greater than or equal to ``2``, print a message for each file that is " "checked for when searching for a module. Also provides information on module " "cleanup at exit." msgstr "" -#: ../../c-api/init_config.rst:1305 +#: ../../c-api/init_config.rst:1294 msgid "Incremented by the :option:`-v` command line option." msgstr "" -#: ../../c-api/init_config.rst:1307 +#: ../../c-api/init_config.rst:1296 msgid "Set by the :envvar:`PYTHONVERBOSE` environment variable value." msgstr "" -#: ../../c-api/init_config.rst:1313 +#: ../../c-api/init_config.rst:1302 msgid "" "Options of the :mod:`warnings` module to build warnings filters, lowest to " "highest priority: :data:`sys.warnoptions`." msgstr "" -#: ../../c-api/init_config.rst:1316 +#: ../../c-api/init_config.rst:1305 msgid "" "The :mod:`warnings` module adds :data:`sys.warnoptions` in the reverse " "order: the last :c:member:`PyConfig.warnoptions` item becomes the first item " "of :data:`warnings.filters` which is checked first (highest priority)." msgstr "" -#: ../../c-api/init_config.rst:1321 +#: ../../c-api/init_config.rst:1310 msgid "" "The :option:`-W` command line options adds its value to :c:member:`~PyConfig." "warnoptions`, it can be used multiple times." msgstr "" -#: ../../c-api/init_config.rst:1324 +#: ../../c-api/init_config.rst:1313 msgid "" "The :envvar:`PYTHONWARNINGS` environment variable can also be used to add " "warning options. Multiple options can be specified, separated by commas (``," "``)." msgstr "" -#: ../../c-api/init_config.rst:1332 +#: ../../c-api/init_config.rst:1321 msgid "" "If equal to ``0``, Python won't try to write ``.pyc`` files on the import of " "source modules." msgstr "" -#: ../../c-api/init_config.rst:1335 +#: ../../c-api/init_config.rst:1324 msgid "" "Set to ``0`` by the :option:`-B` command line option and the :envvar:" "`PYTHONDONTWRITEBYTECODE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1338 +#: ../../c-api/init_config.rst:1327 msgid "" ":data:`sys.dont_write_bytecode` is initialized to the inverted value of :c:" "member:`~PyConfig.write_bytecode`." msgstr "" -#: ../../c-api/init_config.rst:1345 +#: ../../c-api/init_config.rst:1334 msgid "Values of the :option:`-X` command line options: :data:`sys._xoptions`." msgstr "" -#: ../../c-api/init_config.rst:1349 +#: ../../c-api/init_config.rst:1338 msgid "" "If :c:member:`~PyConfig.parse_argv` is non-zero, :c:member:`~PyConfig.argv` " "arguments are parsed the same way the regular Python parses :ref:`command " @@ -1842,27 +1829,27 @@ msgid "" "c:member:`~PyConfig.argv`." msgstr "" -#: ../../c-api/init_config.rst:1354 +#: ../../c-api/init_config.rst:1343 msgid "" "The :c:member:`~PyConfig.xoptions` options are parsed to set other options: " "see the :option:`-X` command line option." msgstr "" -#: ../../c-api/init_config.rst:1359 +#: ../../c-api/init_config.rst:1348 msgid "The ``show_alloc_count`` field has been removed." msgstr "" -#: ../../c-api/init_config.rst:1365 +#: ../../c-api/init_config.rst:1354 msgid "Initialization with PyConfig" msgstr "" -#: ../../c-api/init_config.rst:1367 +#: ../../c-api/init_config.rst:1356 msgid "" "Initializing the interpreter from a populated configuration struct is " "handled by calling :c:func:`Py_InitializeFromConfig`." msgstr "" -#: ../../c-api/init_config.rst:1373 +#: ../../c-api/init_config.rst:1362 msgid "" "If :c:func:`PyImport_FrozenModules`, :c:func:`PyImport_AppendInittab` or :c:" "func:`PyImport_ExtendInittab` are used, they must be set or called after " @@ -1871,17 +1858,17 @@ msgid "" "`PyImport_ExtendInittab` must be called before each Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1380 +#: ../../c-api/init_config.rst:1369 msgid "" "The current configuration (``PyConfig`` type) is stored in " "``PyInterpreterState.config``." msgstr "" -#: ../../c-api/init_config.rst:1383 +#: ../../c-api/init_config.rst:1372 msgid "Example setting the program name::" msgstr "" -#: ../../c-api/init_config.rst:1385 +#: ../../c-api/init_config.rst:1374 msgid "" "void init_python(void)\n" "{\n" @@ -1935,7 +1922,7 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init_config.rst:1411 +#: ../../c-api/init_config.rst:1400 msgid "" "More complete example modifying the default configuration, read the " "configuration, and then override some parameters. Note that since 3.11, many " @@ -1944,7 +1931,7 @@ msgid "" "called will be left unchanged by initialization::" msgstr "" -#: ../../c-api/init_config.rst:1418 +#: ../../c-api/init_config.rst:1407 msgid "" "PyStatus init_python(const char *program_name)\n" "{\n" @@ -1999,18 +1986,18 @@ msgid "" "}" msgstr "" -#: ../../c-api/init_config.rst:1474 +#: ../../c-api/init_config.rst:1463 msgid "Isolated Configuration" msgstr "" -#: ../../c-api/init_config.rst:1476 +#: ../../c-api/init_config.rst:1465 msgid "" ":c:func:`PyPreConfig_InitIsolatedConfig` and :c:func:" "`PyConfig_InitIsolatedConfig` functions create a configuration to isolate " "Python from the system. For example, to embed Python into an application." msgstr "" -#: ../../c-api/init_config.rst:1481 +#: ../../c-api/init_config.rst:1470 msgid "" "This configuration ignores global configuration variables, environment " "variables, command line arguments (:c:member:`PyConfig.argv` is not parsed) " @@ -2018,115 +2005,115 @@ msgid "" "LC_CTYPE locale are left unchanged. Signal handlers are not installed." msgstr "" -#: ../../c-api/init_config.rst:1486 +#: ../../c-api/init_config.rst:1475 msgid "" "Configuration files are still used with this configuration to determine " "paths that are unspecified. Ensure :c:member:`PyConfig.home` is specified to " "avoid computing the default path configuration." msgstr "" -#: ../../c-api/init_config.rst:1494 +#: ../../c-api/init_config.rst:1483 msgid "Python Configuration" msgstr "" -#: ../../c-api/init_config.rst:1496 +#: ../../c-api/init_config.rst:1485 msgid "" ":c:func:`PyPreConfig_InitPythonConfig` and :c:func:" "`PyConfig_InitPythonConfig` functions create a configuration to build a " "customized Python which behaves as the regular Python." msgstr "" -#: ../../c-api/init_config.rst:1500 +#: ../../c-api/init_config.rst:1489 msgid "" "Environments variables and command line arguments are used to configure " "Python, whereas global configuration variables are ignored." msgstr "" -#: ../../c-api/init_config.rst:1503 +#: ../../c-api/init_config.rst:1492 msgid "" "This function enables C locale coercion (:pep:`538`) and :ref:`Python UTF-8 " "Mode <utf8-mode>` (:pep:`540`) depending on the LC_CTYPE locale, :envvar:" "`PYTHONUTF8` and :envvar:`PYTHONCOERCECLOCALE` environment variables." msgstr "" -#: ../../c-api/init_config.rst:1512 +#: ../../c-api/init_config.rst:1501 msgid "Python Path Configuration" msgstr "" -#: ../../c-api/init_config.rst:1514 +#: ../../c-api/init_config.rst:1503 msgid ":c:type:`PyConfig` contains multiple fields for the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1516 +#: ../../c-api/init_config.rst:1505 msgid "Path configuration inputs:" msgstr "" -#: ../../c-api/init_config.rst:1518 +#: ../../c-api/init_config.rst:1507 msgid ":c:member:`PyConfig.home`" msgstr ":c:member:`PyConfig.home`" -#: ../../c-api/init_config.rst:1519 +#: ../../c-api/init_config.rst:1508 msgid ":c:member:`PyConfig.platlibdir`" msgstr ":c:member:`PyConfig.platlibdir`" -#: ../../c-api/init_config.rst:1520 +#: ../../c-api/init_config.rst:1509 msgid ":c:member:`PyConfig.pathconfig_warnings`" msgstr ":c:member:`PyConfig.pathconfig_warnings`" -#: ../../c-api/init_config.rst:1521 +#: ../../c-api/init_config.rst:1510 msgid ":c:member:`PyConfig.program_name`" msgstr ":c:member:`PyConfig.program_name`" -#: ../../c-api/init_config.rst:1522 +#: ../../c-api/init_config.rst:1511 msgid ":c:member:`PyConfig.pythonpath_env`" msgstr ":c:member:`PyConfig.pythonpath_env`" -#: ../../c-api/init_config.rst:1523 +#: ../../c-api/init_config.rst:1512 msgid "current working directory: to get absolute paths" msgstr "" -#: ../../c-api/init_config.rst:1524 +#: ../../c-api/init_config.rst:1513 msgid "" "``PATH`` environment variable to get the program full path (from :c:member:" "`PyConfig.program_name`)" msgstr "" -#: ../../c-api/init_config.rst:1526 +#: ../../c-api/init_config.rst:1515 msgid "``__PYVENV_LAUNCHER__`` environment variable" msgstr "``__PYVENV_LAUNCHER__`` 環境變數" -#: ../../c-api/init_config.rst:1527 +#: ../../c-api/init_config.rst:1516 msgid "" "(Windows only) Application paths in the registry under " "\"Software\\Python\\PythonCore\\X.Y\\PythonPath\" of HKEY_CURRENT_USER and " "HKEY_LOCAL_MACHINE (where X.Y is the Python version)." msgstr "" -#: ../../c-api/init_config.rst:1531 +#: ../../c-api/init_config.rst:1520 msgid "Path configuration output fields:" msgstr "" -#: ../../c-api/init_config.rst:1533 +#: ../../c-api/init_config.rst:1522 msgid ":c:member:`PyConfig.base_exec_prefix`" msgstr ":c:member:`PyConfig.base_exec_prefix`" -#: ../../c-api/init_config.rst:1534 +#: ../../c-api/init_config.rst:1523 msgid ":c:member:`PyConfig.base_executable`" msgstr ":c:member:`PyConfig.base_executable`" -#: ../../c-api/init_config.rst:1535 +#: ../../c-api/init_config.rst:1524 msgid ":c:member:`PyConfig.base_prefix`" msgstr ":c:member:`PyConfig.base_prefix`" -#: ../../c-api/init_config.rst:1536 +#: ../../c-api/init_config.rst:1525 msgid ":c:member:`PyConfig.exec_prefix`" msgstr ":c:member:`PyConfig.exec_prefix`" -#: ../../c-api/init_config.rst:1537 +#: ../../c-api/init_config.rst:1526 msgid ":c:member:`PyConfig.executable`" msgstr ":c:member:`PyConfig.executable`" -#: ../../c-api/init_config.rst:1538 +#: ../../c-api/init_config.rst:1527 msgid "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" @@ -2134,11 +2121,11 @@ msgstr "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" -#: ../../c-api/init_config.rst:1540 +#: ../../c-api/init_config.rst:1529 msgid ":c:member:`PyConfig.prefix`" msgstr ":c:member:`PyConfig.prefix`" -#: ../../c-api/init_config.rst:1542 +#: ../../c-api/init_config.rst:1531 msgid "" "If at least one \"output field\" is not set, Python calculates the path " "configuration to fill unset fields. If :c:member:`~PyConfig." @@ -2147,7 +2134,7 @@ msgid "" "module_search_paths_set` is set to ``1``." msgstr "" -#: ../../c-api/init_config.rst:1548 +#: ../../c-api/init_config.rst:1537 msgid "" "It is possible to completely ignore the function calculating the default " "path configuration by setting explicitly all path configuration output " @@ -2157,52 +2144,52 @@ msgid "" "modification." msgstr "" -#: ../../c-api/init_config.rst:1555 +#: ../../c-api/init_config.rst:1544 msgid "" "Set :c:member:`~PyConfig.pathconfig_warnings` to ``0`` to suppress warnings " "when calculating the path configuration (Unix only, Windows does not log any " "warning)." msgstr "" -#: ../../c-api/init_config.rst:1558 +#: ../../c-api/init_config.rst:1547 msgid "" "If :c:member:`~PyConfig.base_prefix` or :c:member:`~PyConfig." "base_exec_prefix` fields are not set, they inherit their value from :c:" "member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` respectively." msgstr "" -#: ../../c-api/init_config.rst:1562 +#: ../../c-api/init_config.rst:1551 msgid ":c:func:`Py_RunMain` and :c:func:`Py_Main` modify :data:`sys.path`:" msgstr "" -#: ../../c-api/init_config.rst:1564 +#: ../../c-api/init_config.rst:1553 msgid "" "If :c:member:`~PyConfig.run_filename` is set and is a directory which " "contains a ``__main__.py`` script, prepend :c:member:`~PyConfig." "run_filename` to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1567 +#: ../../c-api/init_config.rst:1556 msgid "If :c:member:`~PyConfig.isolated` is zero:" msgstr "如果 :c:member:`~PyConfig.isolated` 為零:" -#: ../../c-api/init_config.rst:1569 +#: ../../c-api/init_config.rst:1558 msgid "" "If :c:member:`~PyConfig.run_module` is set, prepend the current directory " "to :data:`sys.path`. Do nothing if the current directory cannot be read." msgstr "" -#: ../../c-api/init_config.rst:1571 +#: ../../c-api/init_config.rst:1560 msgid "" "If :c:member:`~PyConfig.run_filename` is set, prepend the directory of the " "filename to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1573 +#: ../../c-api/init_config.rst:1562 msgid "Otherwise, prepend an empty string to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1575 +#: ../../c-api/init_config.rst:1564 msgid "" "If :c:member:`~PyConfig.site_import` is non-zero, :data:`sys.path` can be " "modified by the :mod:`site` module. If :c:member:`~PyConfig." @@ -2211,143 +2198,143 @@ msgid "" "data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1581 +#: ../../c-api/init_config.rst:1570 msgid "The following configuration files are used by the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1583 +#: ../../c-api/init_config.rst:1572 msgid "``pyvenv.cfg``" msgstr "``pyvenv.cfg``" -#: ../../c-api/init_config.rst:1584 +#: ../../c-api/init_config.rst:1573 msgid "``._pth`` file (ex: ``python._pth``)" msgstr "" -#: ../../c-api/init_config.rst:1585 +#: ../../c-api/init_config.rst:1574 msgid "``pybuilddir.txt`` (Unix only)" msgstr "``pybuilddir.txt``\\ (僅限 Unix)" -#: ../../c-api/init_config.rst:1587 +#: ../../c-api/init_config.rst:1576 msgid "If a ``._pth`` file is present:" msgstr "" -#: ../../c-api/init_config.rst:1589 +#: ../../c-api/init_config.rst:1578 msgid "Set :c:member:`~PyConfig.isolated` to ``1``." msgstr "將 :c:member:`~PyConfig.isolated` 設定為 ``1``。" -#: ../../c-api/init_config.rst:1590 +#: ../../c-api/init_config.rst:1579 msgid "Set :c:member:`~PyConfig.use_environment` to ``0``." msgstr "將 :c:member:`~PyConfig.use_environment` 設定為 ``0``。" -#: ../../c-api/init_config.rst:1591 +#: ../../c-api/init_config.rst:1580 msgid "Set :c:member:`~PyConfig.site_import` to ``0``." msgstr "將 :c:member:`~PyConfig.site_import` 設定為 ``0``。" -#: ../../c-api/init_config.rst:1592 +#: ../../c-api/init_config.rst:1581 msgid "Set :c:member:`~PyConfig.safe_path` to ``1``." msgstr "將 :c:member:`~PyConfig.safe_path` 設定為 ``1``。" -#: ../../c-api/init_config.rst:1594 +#: ../../c-api/init_config.rst:1583 msgid "" "The ``__PYVENV_LAUNCHER__`` environment variable is used to set :c:member:" "`PyConfig.base_executable`." msgstr "" -#: ../../c-api/init_config.rst:1599 +#: ../../c-api/init_config.rst:1588 msgid "Py_GetArgcArgv()" msgstr "Py_GetArgcArgv()" -#: ../../c-api/init_config.rst:1603 +#: ../../c-api/init_config.rst:1592 msgid "Get the original command line arguments, before Python modified them." msgstr "" -#: ../../c-api/init_config.rst:1605 +#: ../../c-api/init_config.rst:1594 msgid "See also :c:member:`PyConfig.orig_argv` member." msgstr "也請參與 :c:member:`PyConfig.orig_argv` 成員。" -#: ../../c-api/init_config.rst:1609 +#: ../../c-api/init_config.rst:1598 msgid "Multi-Phase Initialization Private Provisional API" msgstr "" -#: ../../c-api/init_config.rst:1611 +#: ../../c-api/init_config.rst:1600 msgid "" "This section is a private provisional API introducing multi-phase " "initialization, the core feature of :pep:`432`:" msgstr "" -#: ../../c-api/init_config.rst:1614 +#: ../../c-api/init_config.rst:1603 msgid "\"Core\" initialization phase, \"bare minimum Python\":" msgstr "" -#: ../../c-api/init_config.rst:1616 +#: ../../c-api/init_config.rst:1605 msgid "Builtin types;" msgstr "內建型別;" -#: ../../c-api/init_config.rst:1617 +#: ../../c-api/init_config.rst:1606 msgid "Builtin exceptions;" msgstr "內建例外;" -#: ../../c-api/init_config.rst:1618 +#: ../../c-api/init_config.rst:1607 msgid "Builtin and frozen modules;" msgstr "" -#: ../../c-api/init_config.rst:1619 +#: ../../c-api/init_config.rst:1608 msgid "" "The :mod:`sys` module is only partially initialized (ex: :data:`sys.path` " "doesn't exist yet)." msgstr "" -#: ../../c-api/init_config.rst:1622 +#: ../../c-api/init_config.rst:1611 msgid "\"Main\" initialization phase, Python is fully initialized:" msgstr "" -#: ../../c-api/init_config.rst:1624 +#: ../../c-api/init_config.rst:1613 msgid "Install and configure :mod:`importlib`;" msgstr "" -#: ../../c-api/init_config.rst:1625 +#: ../../c-api/init_config.rst:1614 msgid "Apply the :ref:`Path Configuration <init-path-config>`;" msgstr "" -#: ../../c-api/init_config.rst:1626 +#: ../../c-api/init_config.rst:1615 msgid "Install signal handlers;" msgstr "" -#: ../../c-api/init_config.rst:1627 +#: ../../c-api/init_config.rst:1616 msgid "" "Finish :mod:`sys` module initialization (ex: create :data:`sys.stdout` and :" "data:`sys.path`);" msgstr "" -#: ../../c-api/init_config.rst:1629 +#: ../../c-api/init_config.rst:1618 msgid "" "Enable optional features like :mod:`faulthandler` and :mod:`tracemalloc`;" msgstr "" -#: ../../c-api/init_config.rst:1630 +#: ../../c-api/init_config.rst:1619 msgid "Import the :mod:`site` module;" msgstr "引入 :mod:`site` 模組;" -#: ../../c-api/init_config.rst:1631 +#: ../../c-api/init_config.rst:1620 msgid "etc." msgstr "" -#: ../../c-api/init_config.rst:1633 +#: ../../c-api/init_config.rst:1622 msgid "Private provisional API:" msgstr "" -#: ../../c-api/init_config.rst:1635 +#: ../../c-api/init_config.rst:1624 msgid "" ":c:member:`PyConfig._init_main`: if set to ``0``, :c:func:" "`Py_InitializeFromConfig` stops at the \"Core\" initialization phase." msgstr "" -#: ../../c-api/init_config.rst:1640 +#: ../../c-api/init_config.rst:1629 msgid "" "Move to the \"Main\" initialization phase, finish the Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1642 +#: ../../c-api/init_config.rst:1631 msgid "" "No module is imported during the \"Core\" phase and the ``importlib`` module " "is not configured: the :ref:`Path Configuration <init-path-config>` is only " @@ -2356,14 +2343,14 @@ msgid "" "maybe install a custom :data:`sys.meta_path` importer or an import hook, etc." msgstr "" -#: ../../c-api/init_config.rst:1648 +#: ../../c-api/init_config.rst:1637 msgid "" "It may become possible to calculate the :ref:`Path Configuration <init-path-" "config>` in Python, after the Core phase and before the Main phase, which is " "one of the :pep:`432` motivation." msgstr "" -#: ../../c-api/init_config.rst:1652 +#: ../../c-api/init_config.rst:1641 msgid "" "The \"Core\" phase is not properly defined: what should be and what should " "not be available at this phase is not specified yet. The API is marked as " @@ -2371,13 +2358,13 @@ msgid "" "until a proper public API is designed." msgstr "" -#: ../../c-api/init_config.rst:1657 +#: ../../c-api/init_config.rst:1646 msgid "" "Example running Python code between \"Core\" and \"Main\" initialization " "phases::" msgstr "" -#: ../../c-api/init_config.rst:1660 +#: ../../c-api/init_config.rst:1649 msgid "" "void init_python(void)\n" "{\n" diff --git a/c-api/intro.po b/c-api/intro.po index cb7472c40b..f246ab03ee 100644 --- a/c-api/intro.po +++ b/c-api/intro.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-25 00:15+0000\n" "PO-Revision-Date: 2023-04-25 18:01+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,8 +32,8 @@ msgid "" "API. The first reason is to write *extension modules* for specific purposes; " "these are C modules that extend the Python interpreter. This is probably " "the most common use. The second reason is to use Python as a component in a " -"larger application; this technique is generally referred to as :dfn:" -"`embedding` Python in an application." +"larger application; this technique is generally referred to " +"as :dfn:`embedding` Python in an application." msgstr "" "對於 Python 的應用程式開發介面使得 C 和 C++ 開發者能夠在各種層級存取 Python " "直譯器。該 API 同樣可用於 C++,但為簡潔起見,通常將其稱為 Python/C API。使用 " @@ -106,8 +105,8 @@ msgstr "" #: ../../c-api/intro.rst:54 msgid "" "This implies inclusion of the following standard headers: ``<stdio.h>``, " -"``<string.h>``, ``<errno.h>``, ``<limits.h>``, ``<assert.h>`` and ``<stdlib." -"h>`` (if available)." +"``<string.h>``, ``<errno.h>``, ``<limits.h>``, ``<assert.h>`` and " +"``<stdlib.h>`` (if available)." msgstr "" "這意味著會引入以下標準標頭:``<stdio.h>``、``<string.h>``、``<errno.h>``、" "``<limits.h>``、``<assert.h>`` 和 ``<stdlib.h>``\\ (如果可用)。" @@ -155,17 +154,17 @@ msgstr "" #: ../../c-api/intro.rst:79 msgid "" "The header files are typically installed with Python. On Unix, these are " -"located in the directories :file:`{prefix}/include/pythonversion/` and :file:" -"`{exec_prefix}/include/pythonversion/`, where :option:`prefix <--prefix>` " -"and :option:`exec_prefix <--exec-prefix>` are defined by the corresponding " -"parameters to Python's :program:`configure` script and *version* is ``'%d." -"%d' % sys.version_info[:2]``. On Windows, the headers are installed in :" -"file:`{prefix}/include`, where ``prefix`` is the installation directory " -"specified to the installer." +"located in the directories :file:`{prefix}/include/pythonversion/` " +"and :file:`{exec_prefix}/include/pythonversion/`, where :option:`prefix <--" +"prefix>` and :option:`exec_prefix <--exec-prefix>` are defined by the " +"corresponding parameters to Python's :program:`configure` script and " +"*version* is ``'%d.%d' % sys.version_info[:2]``. On Windows, the headers " +"are installed in :file:`{prefix}/include`, where ``prefix`` is the " +"installation directory specified to the installer." msgstr "" "標頭檔通常隨 Python 一起安裝。在 Unix 上它們位於目錄 :file:`{prefix}/include/" -"pythonversion/` 和 :file:`{exec_prefix}/include/pythonversion/`,其中 :" -"option:`prefix <--prefix>` 和 :option:`exec_prefix <--exec-prefix>` 由 " +"pythonversion/` 和 :file:`{exec_prefix}/include/pythonversion/`,其" +"中 :option:`prefix <--prefix>` 和 :option:`exec_prefix <--exec-prefix>` 由 " "Python 的 :program:`configure` 腳本的相應參數定義,*version* 是 ``'%d.%d' % " "sys.version_info[:2]``。在 Windows 上,標頭安裝在 :file:`{prefix}/include` " "中,其中 ``prefix`` 是指定給安裝程式 (installer) 用的安裝目錄。" @@ -175,14 +174,14 @@ msgid "" "To include the headers, place both directories (if different) on your " "compiler's search path for includes. Do *not* place the parent directories " "on the search path and then use ``#include <pythonX.Y/Python.h>``; this will " -"break on multi-platform builds since the platform independent headers under :" -"option:`prefix <--prefix>` include the platform specific headers from :" -"option:`exec_prefix <--exec-prefix>`." +"break on multi-platform builds since the platform independent headers " +"under :option:`prefix <--prefix>` include the platform specific headers " +"from :option:`exec_prefix <--exec-prefix>`." msgstr "" "要引入標頭,請將兩個(如果不同)目錄放在編譯器的引入搜尋路徑 (search path) " -"中。*不要*\\ 將父目錄放在搜尋路徑上,然後使用 ``#include <pythonX.Y/Python." -"h>``;這會在多平台建置上壞掉,因為 :option:`prefix <--prefix>` 下獨立於平台的" -"標頭包括來自 :option:`exec_prefix <--exec-prefix>` 的平台特定標頭。" +"中。*不要*\\ 將父目錄放在搜尋路徑上,然後使用 ``#include <pythonX.Y/" +"Python.h>``;這會在多平台建置上壞掉,因為 :option:`prefix <--prefix>` 下獨立" +"於平台的標頭包括來自 :option:`exec_prefix <--exec-prefix>` 的平台特定標頭。" #: ../../c-api/intro.rst:95 msgid "" @@ -204,8 +203,9 @@ msgid "" "Others of a more general utility are defined here. This is not necessarily " "a complete listing." msgstr "" -"Python 標頭檔中定義了幾個有用的巨集,大多被定義在它們有用的地方附近(例如 :c:" -"macro:`Py_RETURN_NONE`),其他是更通用的工具程式。以下並不一定是完整的列表。" +"Python 標頭檔中定義了幾個有用的巨集,大多被定義在它們有用的地方附近(例" +"如 :c:macro:`Py_RETURN_NONE`),其他是更通用的工具程式。以下並不一定是完整的" +"列表。" #: ../../c-api/intro.rst:110 msgid "" @@ -255,7 +255,7 @@ msgstr "回傳 ``x`` 的絕對值。" #: ../../c-api/intro.rst:140 msgid "" "Ask the compiler to always inline a static inline function. The compiler can " -"ignore it and decides to not inline the function." +"ignore it and decide to not inline the function." msgstr "" "要求編譯器總是嵌入靜態行內函式 (static inline function),編譯器可以忽略它並決" "定不嵌入該函式。" @@ -280,12 +280,13 @@ msgstr "" #: ../../c-api/intro.rst:151 msgid "" -"If Python is :ref:`built in debug mode <debug-build>` (if the :c:macro:" -"`Py_DEBUG` macro is defined), the :c:macro:`Py_ALWAYS_INLINE` macro does " -"nothing." +"If Python is :ref:`built in debug mode <debug-build>` (if " +"the :c:macro:`Py_DEBUG` macro is defined), the :c:macro:`Py_ALWAYS_INLINE` " +"macro does nothing." msgstr "" -"如果 Python 是\\ :ref:`在除錯模式下建置 <debug-build>`\\ (如果 :c:macro:" -"`Py_DEBUG` 巨集有被定義),:c:macro:`Py_ALWAYS_INLINE` 巨集就什麼都不會做。" +"如果 Python 是\\ :ref:`在除錯模式下建置 <debug-build>`\\ (如" +"果 :c:macro:`Py_DEBUG` 巨集有被定義),:c:macro:`Py_ALWAYS_INLINE` 巨集就什麼" +"都不會做。" #: ../../c-api/intro.rst:154 msgid "It must be specified before the function return type. Usage::" @@ -345,8 +346,8 @@ msgstr "回傳 ``x`` 和 ``y`` 之間的最小值。" #: ../../c-api/intro.rst:202 msgid "" "Disable inlining on a function. For example, it reduces the C stack " -"consumption: useful on LTO+PGO builds which heavily inline code (see :issue:" -"`33720`)." +"consumption: useful on LTO+PGO builds which heavily inline code " +"(see :issue:`33720`)." msgstr "" "禁用函式的嵌入。例如,它減少了 C 堆疊的消耗:對大量嵌入程式碼的 LTO+PGO 建置" "很有用(請參閱 :issue:`33720`)。" @@ -391,8 +392,8 @@ msgid "" "A use for ``Py_UNREACHABLE()`` is following a call a function that never " "returns but that is not declared :c:macro:`_Py_NO_RETURN`." msgstr "" -"``Py_UNREACHABLE()`` 的一個用途是,在對一個永不回傳但並未聲明為 :c:macro:" -"`_Py_NO_RETURN` 的函式之呼叫後使用。" +"``Py_UNREACHABLE()`` 的一個用途是,在對一個永不回傳但並未聲明" +"為 :c:macro:`_Py_NO_RETURN` 的函式之呼叫後使用。" #: ../../c-api/intro.rst:233 msgid "" @@ -476,9 +477,9 @@ msgid "" "are treated the same way by the Python language in most situations (e.g., " "assignments, scope rules, and argument passing), it is only fitting that " "they should be represented by a single C type. Almost all Python objects " -"live on the heap: you never declare an automatic or static variable of type :" -"c:type:`PyObject`, only pointer variables of type :c:expr:`PyObject*` can " -"be declared. The sole exception are the type objects; since these must " +"live on the heap: you never declare an automatic or static variable of " +"type :c:type:`PyObject`, only pointer variables of type :c:expr:`PyObject*` " +"can be declared. The sole exception are the type objects; since these must " "never be deallocated, they are typically static :c:type:`PyTypeObject` " "objects." msgstr "" @@ -493,19 +494,20 @@ msgstr "" #: ../../c-api/intro.rst:301 msgid "" -"All Python objects (even Python integers) have a :dfn:`type` and a :dfn:" -"`reference count`. An object's type determines what kind of object it is (e." -"g., an integer, a list, or a user-defined function; there are many more as " -"explained in :ref:`types`). For each of the well-known types there is a " -"macro to check whether an object is of that type; for instance, " +"All Python objects (even Python integers) have a :dfn:`type` and " +"a :dfn:`reference count`. An object's type determines what kind of object " +"it is (e.g., an integer, a list, or a user-defined function; there are many " +"more as explained in :ref:`types`). For each of the well-known types there " +"is a macro to check whether an object is of that type; for instance, " "``PyList_Check(a)`` is true if (and only if) the object pointed to by *a* is " "a Python list." msgstr "" "所有 Python 物件(甚至是 Python 整數)都有一個型別 (:dfn:`type`) 和一個參照計" "數 (:dfn:`reference count`)。一個物件的型別決定了它是什麼種類的物件(例如一個" -"整數、一個 list 或一個使用者定義的函式;還有更多型別,請見\\ :ref:" -"`types`\\ )。對於每個眾所周知的型別,都有一個巨集來檢查物件是否屬於該型別;" -"例如,若(且唯若)*a* 指向的物件是 Python list 時,``PyList_Check(a)`` 為真。" +"整數、一個 list 或一個使用者定義的函式;還有更多型別,請見" +"\\ :ref:`types`\\ )。對於每個眾所周知的型別,都有一個巨集來檢查物件是否屬於" +"該型別;例如,若(且唯若)*a* 指向的物件是 Python list 時," +"``PyList_Check(a)`` 為真。" #: ../../c-api/intro.rst:312 msgid "Reference Counts" @@ -539,18 +541,18 @@ msgid "" "Reference counts are always manipulated explicitly. The normal way is to " "use the macro :c:func:`Py_INCREF` to take a new reference to an object (i.e. " "increment its reference count by one), and :c:func:`Py_DECREF` to release " -"that reference (i.e. decrement the reference count by one). The :c:func:" -"`Py_DECREF` macro is considerably more complex than the incref one, since it " -"must check whether the reference count becomes zero and then cause the " -"object's deallocator to be called. The deallocator is a function pointer " -"contained in the object's type structure. The type-specific deallocator " -"takes care of releasing references for other objects contained in the object " -"if this is a compound object type, such as a list, as well as performing any " -"additional finalization that's needed. There's no chance that the reference " -"count can overflow; at least as many bits are used to hold the reference " -"count as there are distinct memory locations in virtual memory (assuming " -"``sizeof(Py_ssize_t) >= sizeof(void*)``). Thus, the reference count " -"increment is a simple operation." +"that reference (i.e. decrement the reference count by one). " +"The :c:func:`Py_DECREF` macro is considerably more complex than the incref " +"one, since it must check whether the reference count becomes zero and then " +"cause the object's deallocator to be called. The deallocator is a function " +"pointer contained in the object's type structure. The type-specific " +"deallocator takes care of releasing references for other objects contained " +"in the object if this is a compound object type, such as a list, as well as " +"performing any additional finalization that's needed. There's no chance " +"that the reference count can overflow; at least as many bits are used to " +"hold the reference count as there are distinct memory locations in virtual " +"memory (assuming ``sizeof(Py_ssize_t) >= sizeof(void*)``). Thus, the " +"reference count increment is a simple operation." msgstr "" "參照計數總是被明確地操作。正常的方法是使用巨集 :c:func:`Py_INCREF` 來取得對於" "物件的參照(即參照計數加一),並使用巨集 :c:func:`Py_DECREF` 來釋放參照(即將" @@ -595,8 +597,8 @@ msgid "" "conceivably remove the object from the list, releasing that reference, and " "possibly deallocating it. The real danger is that innocent-looking " "operations may invoke arbitrary Python code which could do this; there is a " -"code path which allows control to flow back to the user from a :c:func:" -"`Py_DECREF`, so almost any operation is potentially dangerous." +"code path which allows control to flow back to the user from " +"a :c:func:`Py_DECREF`, so almost any operation is potentially dangerous." msgstr "" "然而,一個常見的陷阱是從一個 list 中提取一個物件並保留它一段時間而不取得其參" "照。某些其他操作可能會從列表中刪除該物件,減少其參照計數並可能取消分配它。真" @@ -631,22 +633,22 @@ msgid "" "shared). \"Owning a reference\" means being responsible for calling " "Py_DECREF on it when the reference is no longer needed. Ownership can also " "be transferred, meaning that the code that receives ownership of the " -"reference then becomes responsible for eventually releasing it by calling :c:" -"func:`Py_DECREF` or :c:func:`Py_XDECREF` when it's no longer needed---or " -"passing on this responsibility (usually to its caller). When a function " -"passes ownership of a reference on to its caller, the caller is said to " -"receive a *new* reference. When no ownership is transferred, the caller is " -"said to *borrow* the reference. Nothing needs to be done for a :term:" -"`borrowed reference`." +"reference then becomes responsible for eventually releasing it by " +"calling :c:func:`Py_DECREF` or :c:func:`Py_XDECREF` when it's no longer " +"needed---or passing on this responsibility (usually to its caller). When a " +"function passes ownership of a reference on to its caller, the caller is " +"said to receive a *new* reference. When no ownership is transferred, the " +"caller is said to *borrow* the reference. Nothing needs to be done for " +"a :term:`borrowed reference`." msgstr "" "Python/C API 中函式的參照計數行為最好用\\ *參照的所有權*\\ 來解釋。所有權附屬" "於參照而非物件(物件並非被擁有,它們總是共享的)。「擁有參照」意味著當不再需" "要該參照時,負責在其上呼叫 Py_DECREF。所有權也可以轉移,這意味著接收參照所有" -"權的程式碼最終會負責在不需要參照時透過呼叫 :c:func:`Py_DECREF` 或 :c:func:" -"`Py_XDECREF` 釋放參照 --- 或者將這個責任再傳遞出去(通常是給它的呼叫者)。當" -"一個函式將參照的所有權傳遞給它的呼叫者時,呼叫者被稱為接收到一個\\ *新*\\ 參" -"照。當沒有所有權轉移時,呼叫者被稱為\\ *借用*\\ 參照。如果是\\ :term:`借用參" -"照 <borrowed reference>`\\ 就不需要做任何事情。" +"權的程式碼最終會負責在不需要參照時透過呼叫 :c:func:`Py_DECREF` " +"或 :c:func:`Py_XDECREF` 釋放參照 --- 或者將這個責任再傳遞出去(通常是給它的呼" +"叫者)。當一個函式將參照的所有權傳遞給它的呼叫者時,呼叫者被稱為接收到一個\\ " +"*新*\\ 參照。當沒有所有權轉移時,呼叫者被稱為\\ *借用*\\ 參照。如果是" +"\\ :term:`借用參照 <borrowed reference>`\\ 就不需要做任何事情。" #: ../../c-api/intro.rst:397 msgid "" @@ -662,20 +664,20 @@ msgstr "" #: ../../c-api/intro.rst:407 msgid "" -"Few functions steal references; the two notable exceptions are :c:func:" -"`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a reference to " -"the item (but not to the tuple or list into which the item is put!). These " -"functions were designed to steal a reference because of a common idiom for " -"populating a tuple or list with newly created objects; for example, the code " -"to create the tuple ``(1, 2, \"three\")`` could look like this (forgetting " -"about error handling for the moment; a better way to code this is shown " -"below)::" -msgstr "" -"很少有函式會竊取參照;兩個值得注意的例外是 :c:func:`PyList_SetItem` 和 :c:" -"func:`PyTuple_SetItem`,它們竊取了對項目的參照(但不是對項目所在的 tuple 或 " -"list 的參照!)。因為有著使用新建立的物件來增加 (populate) tuple 或 list 的習" -"慣,這些函式旨在竊取參照;例如,建立 tuple ``(1, 2, \"three\")`` 的程式碼可以" -"如下所示(先暫時忘記錯誤處理;更好的編寫方式如下所示):" +"Few functions steal references; the two notable exceptions " +"are :c:func:`PyList_SetItem` and :c:func:`PyTuple_SetItem`, which steal a " +"reference to the item (but not to the tuple or list into which the item is " +"put!). These functions were designed to steal a reference because of a " +"common idiom for populating a tuple or list with newly created objects; for " +"example, the code to create the tuple ``(1, 2, \"three\")`` could look like " +"this (forgetting about error handling for the moment; a better way to code " +"this is shown below)::" +msgstr "" +"很少有函式會竊取參照;兩個值得注意的例外是 :c:func:`PyList_SetItem` " +"和 :c:func:`PyTuple_SetItem`,它們竊取了對項目的參照(但不是對項目所在的 " +"tuple 或 list 的參照!)。因為有著使用新建立的物件來增加 (populate) tuple 或 " +"list 的習慣,這些函式旨在竊取參照;例如,建立 tuple ``(1, 2, \"three\")`` 的" +"程式碼可以如下所示(先暫時忘記錯誤處理;更好的編寫方式如下所示):" #: ../../c-api/intro.rst:415 msgid "" @@ -700,26 +702,26 @@ msgid "" "although the reference to it will be stolen, use :c:func:`Py_INCREF` to grab " "another reference before calling the reference-stealing function." msgstr "" -"這裡 :c:func:`PyLong_FromLong` 會回傳一個新的參照,它立即被 :c:func:" -"`PyTuple_SetItem` 竊取。如果你想繼續使用一個物件,儘管對它的參照將被竊取,請" -"在呼叫參照竊取函式之前使用 :c:func:`Py_INCREF` 來取得另一個參照。" +"這裡 :c:func:`PyLong_FromLong` 會回傳一個新的參照,它立即" +"被 :c:func:`PyTuple_SetItem` 竊取。如果你想繼續使用一個物件,儘管對它的參照將" +"被竊取,請在呼叫參照竊取函式之前使用 :c:func:`Py_INCREF` 來取得另一個參照。" #: ../../c-api/intro.rst:427 msgid "" "Incidentally, :c:func:`PyTuple_SetItem` is the *only* way to set tuple " "items; :c:func:`PySequence_SetItem` and :c:func:`PyObject_SetItem` refuse to " -"do this since tuples are an immutable data type. You should only use :c:" -"func:`PyTuple_SetItem` for tuples that you are creating yourself." +"do this since tuples are an immutable data type. You should only " +"use :c:func:`PyTuple_SetItem` for tuples that you are creating yourself." msgstr "" -"附帶地說,:c:func:`PyTuple_SetItem` 是設定 tuple 項目的\\ *唯一*\\ 方法; :c:" -"func:`PySequence_SetItem` 和 :c:func:`PyObject_SetItem` 拒絕這樣做,因為 " -"tuple 是一種不可變 (immutable) 的資料型別。你應該只對你自己建立的 tuple 使" -"用 :c:func:`PyTuple_SetItem`。" +"附帶地說,:c:func:`PyTuple_SetItem` 是設定 tuple 項目的\\ *唯一*\\ 方" +"法; :c:func:`PySequence_SetItem` 和 :c:func:`PyObject_SetItem` 拒絕這樣做," +"因為 tuple 是一種不可變 (immutable) 的資料型別。你應該只對你自己建立的 tuple " +"使用 :c:func:`PyTuple_SetItem`。" #: ../../c-api/intro.rst:432 msgid "" -"Equivalent code for populating a list can be written using :c:func:" -"`PyList_New` and :c:func:`PyList_SetItem`." +"Equivalent code for populating a list can be written " +"using :c:func:`PyList_New` and :c:func:`PyList_SetItem`." msgstr "" "可以使用 :c:func:`PyList_New` 和 :c:func:`PyList_SetItem` 編寫用於填充列表的" "等效程式碼。" @@ -727,10 +729,11 @@ msgstr "" #: ../../c-api/intro.rst:435 msgid "" "However, in practice, you will rarely use these ways of creating and " -"populating a tuple or list. There's a generic function, :c:func:" -"`Py_BuildValue`, that can create most common objects from C values, directed " -"by a :dfn:`format string`. For example, the above two blocks of code could " -"be replaced by the following (which also takes care of the error checking)::" +"populating a tuple or list. There's a generic " +"function, :c:func:`Py_BuildValue`, that can create most common objects from " +"C values, directed by a :dfn:`format string`. For example, the above two " +"blocks of code could be replaced by the following (which also takes care of " +"the error checking)::" msgstr "" "但是在實際操作中你很少會使用這些方法來建立和增加 tuple 和 list。有一個通用函" "式 :c:func:`Py_BuildValue` 可以從 C 值建立最常見的物件,由 :dfn:`format " @@ -848,8 +851,8 @@ msgid "" "of the items in a list of integers; once using :c:func:`PyList_GetItem`, " "and once using :c:func:`PySequence_GetItem`. ::" msgstr "" -"以下是一個範例,說明如何編寫函式來計算一個整數 list 中項目的總和;一次使用 :" -"c:func:`PyList_GetItem`,一次使用 :c:func:`PySequence_GetItem`: ::" +"以下是一個範例,說明如何編寫函式來計算一個整數 list 中項目的總和;一次使" +"用 :c:func:`PyList_GetItem`,一次使用 :c:func:`PySequence_GetItem`: ::" #: ../../c-api/intro.rst:501 msgid "" @@ -914,12 +917,12 @@ msgstr "型別" #: ../../c-api/intro.rst:563 msgid "" "There are few other data types that play a significant role in the Python/C " -"API; most are simple C types such as :c:expr:`int`, :c:expr:`long`, :c:expr:" -"`double` and :c:expr:`char*`. A few structure types are used to describe " -"static tables used to list the functions exported by a module or the data " -"attributes of a new object type, and another is used to describe the value " -"of a complex number. These will be discussed together with the functions " -"that use them." +"API; most are simple C types such " +"as :c:expr:`int`, :c:expr:`long`, :c:expr:`double` and :c:expr:`char*`. A " +"few structure types are used to describe static tables used to list the " +"functions exported by a module or the data attributes of a new object type, " +"and another is used to describe the value of a complex number. These will " +"be discussed together with the functions that use them." msgstr "" "有少數幾個其他的資料型別在 Python/C API 中發揮重要作用;大多數是簡單的 C 型" "別,例如 :c:expr:`int`、:c:expr:`long`、:c:expr:`double` 和 :c:expr:`char*`。" @@ -934,8 +937,8 @@ msgid "" "positive value of type :c:type:`Py_ssize_t`." msgstr "" "一個帶符號的整數型別,使得 ``sizeof(Py_ssize_t) == sizeof(size_t)``。 C99 沒" -"有直接定義這樣的東西(size_t 是無符號整數型別)。有關詳細資訊,請參閱 :pep:" -"`353`。 ``PY_SSIZE_T_MAX`` 是 :c:type:`Py_ssize_t` 型別的最大正值。" +"有直接定義這樣的東西(size_t 是無符號整數型別)。有關詳細資訊,請參" +"閱 :pep:`353`。 ``PY_SSIZE_T_MAX`` 是 :c:type:`Py_ssize_t` 型別的最大正值。" #: ../../c-api/intro.rst:582 msgid "Exceptions" @@ -979,32 +982,32 @@ msgstr "" msgid "" "Exception state is maintained in per-thread storage (this is equivalent to " "using global storage in an unthreaded application). A thread can be in one " -"of two states: an exception has occurred, or not. The function :c:func:" -"`PyErr_Occurred` can be used to check for this: it returns a borrowed " -"reference to the exception type object when an exception has occurred, and " -"``NULL`` otherwise. There are a number of functions to set the exception " -"state: :c:func:`PyErr_SetString` is the most common (though not the most " -"general) function to set the exception state, and :c:func:`PyErr_Clear` " -"clears the exception state." +"of two states: an exception has occurred, or not. The " +"function :c:func:`PyErr_Occurred` can be used to check for this: it returns " +"a borrowed reference to the exception type object when an exception has " +"occurred, and ``NULL`` otherwise. There are a number of functions to set " +"the exception state: :c:func:`PyErr_SetString` is the most common (though " +"not the most general) function to set the exception state, " +"and :c:func:`PyErr_Clear` clears the exception state." msgstr "" "例外的狀態會在個別執行緒的存儲空間 (per-thread storage) 中維護(這相當於在非" "執行緒應用程式中使用全域存儲空間)。執行緒可以處於兩種狀態之一:發生例外或未" "發生例外。函式 :c:func:`PyErr_Occurred` 可用於檢查這一點:當例外發生時,它回" -"傳對例外型別物件的借用參照,否則回傳 ``NULL``。設定例外狀態的函式有很多::c:" -"func:`PyErr_SetString` 是最常見的(儘管不是最通用的)設定例外狀態的函式,而 :" -"c:func:`PyErr_Clear` 是用來清除例外狀態。" +"傳對例外型別物件的借用參照,否則回傳 ``NULL``。設定例外狀態的函式有很" +"多::c:func:`PyErr_SetString` 是最常見的(儘管不是最通用的)設定例外狀態的函" +"式,而 :c:func:`PyErr_Clear` 是用來清除例外狀態。" #: ../../c-api/intro.rst:617 msgid "" "The full exception state consists of three objects (all of which can be " "``NULL``): the exception type, the corresponding exception value, and the " -"traceback. These have the same meanings as the Python result of ``sys." -"exc_info()``; however, they are not the same: the Python objects represent " -"the last exception being handled by a Python :keyword:`try` ... :keyword:" -"`except` statement, while the C level exception state only exists while an " -"exception is being passed on between C functions until it reaches the Python " -"bytecode interpreter's main loop, which takes care of transferring it to " -"``sys.exc_info()`` and friends." +"traceback. These have the same meanings as the Python result of " +"``sys.exc_info()``; however, they are not the same: the Python objects " +"represent the last exception being handled by a " +"Python :keyword:`try` ... :keyword:`except` statement, while the C level " +"exception state only exists while an exception is being passed on between C " +"functions until it reaches the Python bytecode interpreter's main loop, " +"which takes care of transferring it to ``sys.exc_info()`` and friends." msgstr "" "完整的例外狀態由三個(都可以為 ``NULL`` 的)物件組成:例外型別、對應的例外值" "和回溯。這些與 ``sys.exc_info()`` 的 Python 結果具有相同的含義;但是它們並不" @@ -1016,15 +1019,15 @@ msgstr "" #: ../../c-api/intro.rst:629 msgid "" "Note that starting with Python 1.5, the preferred, thread-safe way to access " -"the exception state from Python code is to call the function :func:`sys." -"exc_info`, which returns the per-thread exception state for Python code. " -"Also, the semantics of both ways to access the exception state have changed " -"so that a function which catches an exception will save and restore its " -"thread's exception state so as to preserve the exception state of its " -"caller. This prevents common bugs in exception handling code caused by an " -"innocent-looking function overwriting the exception being handled; it also " -"reduces the often unwanted lifetime extension for objects that are " -"referenced by the stack frames in the traceback." +"the exception state from Python code is to call the " +"function :func:`sys.exc_info`, which returns the per-thread exception state " +"for Python code. Also, the semantics of both ways to access the exception " +"state have changed so that a function which catches an exception will save " +"and restore its thread's exception state so as to preserve the exception " +"state of its caller. This prevents common bugs in exception handling code " +"caused by an innocent-looking function overwriting the exception being " +"handled; it also reduces the often unwanted lifetime extension for objects " +"that are referenced by the stack frames in the traceback." msgstr "" "請注意,從 Python 1.5 開始,從 Python 程式碼存取例外狀態的首選且支援執行緒安" "全的方法是呼叫 :func:`sys.exc_info` 函式,它回傳 Python 程式碼的個別執行緒例" @@ -1123,21 +1126,22 @@ msgstr "" #: ../../c-api/intro.rst:716 msgid "" "This example represents an endorsed use of the ``goto`` statement in C! It " -"illustrates the use of :c:func:`PyErr_ExceptionMatches` and :c:func:" -"`PyErr_Clear` to handle specific exceptions, and the use of :c:func:" -"`Py_XDECREF` to dispose of owned references that may be ``NULL`` (note the " -"``'X'`` in the name; :c:func:`Py_DECREF` would crash when confronted with a " -"``NULL`` reference). It is important that the variables used to hold owned " -"references are initialized to ``NULL`` for this to work; likewise, the " -"proposed return value is initialized to ``-1`` (failure) and only set to " -"success after the final call made is successful." -msgstr "" -"這個例子代表了在 C 語言中對使用 ``goto`` 陳述句的認同!它闡述了以 :c:func:" -"`PyErr_ExceptionMatches` 和 :c:func:`PyErr_Clear` 來處理特定的例外,以及以 :" -"c:func:`Py_XDECREF` 來配置其所擁有且可能為 ``NULL`` 的參照(注意名稱中的 " -"``'X'``\\ ;:c:func:`Py_DECREF` 在遇到 ``NULL`` 參照時會崩潰)。重要的是,用" -"於保存擁有的參照的變數被初始化為 ``NULL`` 以使其能夠順利作用;同樣地,回傳值" -"被初始化為 ``-1``\\ (失敗),並且僅在最後一次呼叫成功後才設定為成功。" +"illustrates the use of :c:func:`PyErr_ExceptionMatches` " +"and :c:func:`PyErr_Clear` to handle specific exceptions, and the use " +"of :c:func:`Py_XDECREF` to dispose of owned references that may be ``NULL`` " +"(note the ``'X'`` in the name; :c:func:`Py_DECREF` would crash when " +"confronted with a ``NULL`` reference). It is important that the variables " +"used to hold owned references are initialized to ``NULL`` for this to work; " +"likewise, the proposed return value is initialized to ``-1`` (failure) and " +"only set to success after the final call made is successful." +msgstr "" +"這個例子代表了在 C 語言中對使用 ``goto`` 陳述句的認同!它闡述了" +"以 :c:func:`PyErr_ExceptionMatches` 和 :c:func:`PyErr_Clear` 來處理特定的例" +"外,以及以 :c:func:`Py_XDECREF` 來配置其所擁有且可能為 ``NULL`` 的參照(注意" +"名稱中的 ``'X'``\\ ;:c:func:`Py_DECREF` 在遇到 ``NULL`` 參照時會崩潰)。重要" +"的是,用於保存擁有的參照的變數被初始化為 ``NULL`` 以使其能夠順利作用;同樣" +"地,回傳值被初始化為 ``-1``\\ (失敗),並且僅在最後一次呼叫成功後才設定為成" +"功。" #: ../../c-api/intro.rst:730 msgid "Embedding Python" @@ -1166,15 +1170,16 @@ msgstr "" #: ../../c-api/intro.rst:750 msgid "" -":c:func:`Py_Initialize` does not set the \"script argument list\" (``sys." -"argv``). If this variable is needed by Python code that will be executed " -"later, setting :c:member:`PyConfig.argv` and :c:member:`PyConfig.parse_argv` " -"must be set: see :ref:`Python Initialization Configuration <init-config>`." +":c:func:`Py_Initialize` does not set the \"script argument list\" " +"(``sys.argv``). If this variable is needed by Python code that will be " +"executed later, setting :c:member:`PyConfig.argv` " +"and :c:member:`PyConfig.parse_argv` must be set: see :ref:`Python " +"Initialization Configuration <init-config>`." msgstr "" -":c:func:`Py_Initialize` 不設定「腳本引數列表 (script argument list)」 (``sys." -"argv``)。如果稍後將要執行的 Python 程式碼需要此變數,則必須設定 :c:member:" -"`PyConfig.argv` 和 :c:member:`PyConfig.parse_argv`,請見 :ref:`Python 初始化" -"配置 <init-config>`。" +":c:func:`Py_Initialize` 不設定「腳本引數列表 (script argument list)」 " +"(``sys.argv``)。如果稍後將要執行的 Python 程式碼需要此變數,則必須設" +"定 :c:member:`PyConfig.argv` 和 :c:member:`PyConfig.parse_argv`,請" +"見 :ref:`Python 初始化配置 <init-config>`。" #: ../../c-api/intro.rst:755 msgid "" @@ -1187,68 +1192,70 @@ msgid "" "to the parent directory where the executable named :file:`python` is found " "on the shell command search path (the environment variable :envvar:`PATH`)." msgstr "" -"在大多數系統上(特別是在 Unix 和 Windows 上,儘管細節略有不同),:c:func:" -"`Py_Initialize` 會假設Python 函式庫相對於 Python 直譯器可執行檔案的位置固定," -"並根據其對標準 Python 直譯器可執行檔案位置的最佳猜測來計算模組搜尋路徑。或者" -"更詳細地說,它會在 shell 命令搜尋路徑(環境變數 :envvar:`PATH`)中找到名為 :" -"file:`python` 的可執行檔案,並在其父目錄中查找一個名為 :file:`lib/python{X.Y}" -"` 的目錄的相對位置。" +"在大多數系統上(特別是在 Unix 和 Windows 上,儘管細節略有不" +"同),:c:func:`Py_Initialize` 會假設Python 函式庫相對於 Python 直譯器可執行檔" +"案的位置固定,並根據其對標準 Python 直譯器可執行檔案位置的最佳猜測來計算模組" +"搜尋路徑。或者更詳細地說,它會在 shell 命令搜尋路徑(環境變" +"數 :envvar:`PATH`)中找到名為 :file:`python` 的可執行檔案,並在其父目錄中查找" +"一個名為 :file:`lib/python{X.Y}` 的目錄的相對位置。" #: ../../c-api/intro.rst:764 msgid "" "For instance, if the Python executable is found in :file:`/usr/local/bin/" "python`, it will assume that the libraries are in :file:`/usr/local/lib/" "python{X.Y}`. (In fact, this particular path is also the \"fallback\" " -"location, used when no executable file named :file:`python` is found along :" -"envvar:`PATH`.) The user can override this behavior by setting the " +"location, used when no executable file named :file:`python` is found " +"along :envvar:`PATH`.) The user can override this behavior by setting the " "environment variable :envvar:`PYTHONHOME`, or insert additional directories " "in front of the standard path by setting :envvar:`PYTHONPATH`." msgstr "" "例如,如果在 :file:`/usr/local/bin/python` 中找到 Python 可執行檔案,它將假定" "函式庫位於 :file:`/usr/local/lib/python{X.Y}` 中。(事實上這個特定的路徑也是" "「後備 (fallback)」位置,當在 :envvar:`PATH` 中找不到名為 :file:`python` 的可" -"執行檔案時使用。)使用者可以透過設定環境變數來覆蓋此行為 :envvar:" -"`PYTHONHOME`,或者透過設定 :envvar:`PYTHONPATH` 在標準路徑前面插入額外的目" -"錄。" +"執行檔案時使用。)使用者可以透過設定環境變數來覆蓋此行" +"為 :envvar:`PYTHONHOME`,或者透過設定 :envvar:`PYTHONPATH` 在標準路徑前面插入" +"額外的目錄。" #: ../../c-api/intro.rst:778 #, fuzzy msgid "" -"The embedding application can steer the search by setting :c:member:" -"`PyConfig.program_name` *before* calling :c:func:`Py_InitializeFromConfig`. " -"Note that :envvar:`PYTHONHOME` still overrides this and :envvar:`PYTHONPATH` " -"is still inserted in front of the standard path. An application that " -"requires total control has to provide its own implementation of :c:func:" -"`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, and :c:" -"func:`Py_GetProgramFullPath` (all defined in :file:`Modules/getpath.c`)." +"The embedding application can steer the search by " +"setting :c:member:`PyConfig.program_name` *before* " +"calling :c:func:`Py_InitializeFromConfig`. Note that :envvar:`PYTHONHOME` " +"still overrides this and :envvar:`PYTHONPATH` is still inserted in front of " +"the standard path. An application that requires total control has to " +"provide its own implementation " +"of :c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, " +"and :c:func:`Py_GetProgramFullPath` (all defined in :file:`Modules/" +"getpath.c`)." msgstr "" "嵌入的應用程式可以透過在呼叫 :c:func:`Py_Initialize` *之前*\\ 呼叫 " "``Py_SetProgramName(file)`` 來引導搜尋。請注意 :envvar:`PYTHONHOME` 仍然覆蓋" "它並且 :envvar:`PYTHONPATH` 仍然插入在標準路徑的前面。需要完全控制權的應用程" -"式必須實作自己的 :c:func:`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:func:" -"`Py_GetExecPrefix` 和 :c:func:`Py_GetProgramFullPath`\\(全部定義在 :file:" -"`Modules/getpath.c`)。" +"式必須實作自己" +"的 :c:func:`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:func:`Py_GetExecPrefix` " +"和 :c:func:`Py_GetProgramFullPath`\\(全部定義在 :file:`Modules/getpath.c`)。" #: ../../c-api/intro.rst:789 msgid "" "Sometimes, it is desirable to \"uninitialize\" Python. For instance, the " -"application may want to start over (make another call to :c:func:" -"`Py_Initialize`) or the application is simply done with its use of Python " -"and wants to free memory allocated by Python. This can be accomplished by " -"calling :c:func:`Py_FinalizeEx`. The function :c:func:`Py_IsInitialized` " -"returns true if Python is currently in the initialized state. More " -"information about these functions is given in a later chapter. Notice that :" -"c:func:`Py_FinalizeEx` does *not* free all memory allocated by the Python " -"interpreter, e.g. memory allocated by extension modules currently cannot be " -"released." +"application may want to start over (make another call " +"to :c:func:`Py_Initialize`) or the application is simply done with its use " +"of Python and wants to free memory allocated by Python. This can be " +"accomplished by calling :c:func:`Py_FinalizeEx`. The " +"function :c:func:`Py_IsInitialized` returns true if Python is currently in " +"the initialized state. More information about these functions is given in a " +"later chapter. Notice that :c:func:`Py_FinalizeEx` does *not* free all " +"memory allocated by the Python interpreter, e.g. memory allocated by " +"extension modules currently cannot be released." msgstr "" "有時會希望能夠「取消初始化 (uninitialize)」Python。例如,應用程式可能想要重新" "開始(再次呼叫 :c:func:`Py_Initialize`)或者應用程式簡單地完成了對 Python 的" "使用並想要釋放 Python 分配的記憶體。這可以透過呼叫 :c:func:`Py_FinalizeEx` 來" "完成。如果 Python 目前處於初始化狀態,函式 :c:func:`Py_IsInitialized` 會回傳 " -"true。有關這些功能的更多資訊將在後面的章節中給出。請注意 :c:func:" -"`Py_FinalizeEx` *不會*\\ 釋放由 Python 直譯器分配的所有記憶體,例如目前無法釋" -"放被擴充模組所分配的記憶體。" +"true。有關這些功能的更多資訊將在後面的章節中給出。請注" +"意 :c:func:`Py_FinalizeEx` *不會*\\ 釋放由 Python 直譯器分配的所有記憶體,例" +"如目前無法釋放被擴充模組所分配的記憶體。" #: ../../c-api/intro.rst:803 msgid "Debugging Builds" @@ -1265,11 +1272,11 @@ msgstr "" #: ../../c-api/intro.rst:809 msgid "" -"A full list of the various types of debugging builds is in the file :file:" -"`Misc/SpecialBuilds.txt` in the Python source distribution. Builds are " -"available that support tracing of reference counts, debugging the memory " -"allocator, or low-level profiling of the main interpreter loop. Only the " -"most frequently used builds will be described in the remainder of this " +"A full list of the various types of debugging builds is in the " +"file :file:`Misc/SpecialBuilds.txt` in the Python source distribution. " +"Builds are available that support tracing of reference counts, debugging the " +"memory allocator, or low-level profiling of the main interpreter loop. Only " +"the most frequently used builds will be described in the remainder of this " "section." msgstr "" "Python 原始碼發佈版本中的 :file:`Misc/SpecialBuilds.txt` 檔案有一份包含多種除" @@ -1280,17 +1287,17 @@ msgstr "" msgid "" "Compiling the interpreter with the :c:macro:`!Py_DEBUG` macro defined " "produces what is generally meant by :ref:`a debug build of Python <debug-" -"build>`. :c:macro:`!Py_DEBUG` is enabled in the Unix build by adding :option:" -"`--with-pydebug` to the :file:`./configure` command. It is also implied by " -"the presence of the not-Python-specific :c:macro:`!_DEBUG` macro. When :c:" -"macro:`!Py_DEBUG` is enabled in the Unix build, compiler optimization is " -"disabled." +"build>`. :c:macro:`!Py_DEBUG` is enabled in the Unix build by " +"adding :option:`--with-pydebug` to the :file:`./configure` command. It is " +"also implied by the presence of the not-Python-specific :c:macro:`!_DEBUG` " +"macro. When :c:macro:`!Py_DEBUG` is enabled in the Unix build, compiler " +"optimization is disabled." msgstr "" "使用定義的 :c:macro:`!Py_DEBUG` 巨集編譯直譯器會生成 :ref:`Python 的除錯建置 " "<debug-build>`。 :c:macro:`!Py_DEBUG` 在 Unix 建置中要透過在 :file:`./" -"configure` 命令中加入 :option:`--with-pydebug` 來啟用。非 Python 限定的 :c:" -"macro:`!_DEBUG` 巨集的存在也暗示了這一點。當 :c:macro:`!Py_DEBUG` 在 Unix 建" -"置中啟用時,編譯器最佳化會被禁用。" +"configure` 命令中加入 :option:`--with-pydebug` 來啟用。非 Python 限定" +"的 :c:macro:`!_DEBUG` 巨集的存在也暗示了這一點。當 :c:macro:`!Py_DEBUG` 在 " +"Unix 建置中啟用時,編譯器最佳化會被禁用。" #: ../../c-api/intro.rst:825 msgid "" @@ -1302,26 +1309,26 @@ msgstr "" #: ../../c-api/intro.rst:828 msgid "" -"Defining :c:macro:`Py_TRACE_REFS` enables reference tracing (see the :option:" -"`configure --with-trace-refs option <--with-trace-refs>`). When defined, a " -"circular doubly linked list of active objects is maintained by adding two " -"extra fields to every :c:type:`PyObject`. Total allocations are tracked as " -"well. Upon exit, all existing references are printed. (In interactive mode " -"this happens after every statement run by the interpreter.)" +"Defining :c:macro:`Py_TRACE_REFS` enables reference tracing (see " +"the :option:`configure --with-trace-refs option <--with-trace-refs>`). When " +"defined, a circular doubly linked list of active objects is maintained by " +"adding two extra fields to every :c:type:`PyObject`. Total allocations are " +"tracked as well. Upon exit, all existing references are printed. (In " +"interactive mode this happens after every statement run by the interpreter.)" msgstr "" "定義 :c:macro:`Py_TRACE_REFS` 來啟用參照追蹤(參見\\ :option:`設定 --with-" -"trace-refs 選項 <--with-trace-refs>`)。當有定義時,透過向每個 :c:type:" -"`PyObject` 新增兩個額外欄位來維護有效物件的循環雙向鍊表 (circular doubly " -"linked list)。全體分配也有被追蹤。退出時將印出所有現行參照。(在交互模式下," -"這發生在直譯器運行的每個陳述句之後。)" +"trace-refs 選項 <--with-trace-refs>`)。當有定義時,透過向每" +"個 :c:type:`PyObject` 新增兩個額外欄位來維護有效物件的循環雙向鍊表 (circular " +"doubly linked list)。全體分配也有被追蹤。退出時將印出所有現行參照。(在交互模" +"式下,這發生在直譯器運行的每個陳述句之後。)" #: ../../c-api/intro.rst:835 msgid "" "Please refer to :file:`Misc/SpecialBuilds.txt` in the Python source " "distribution for more detailed information." msgstr "" -"有關更多詳細資訊,請參閱 Python 原始碼發布版中的 :file:`Misc/SpecialBuilds." -"txt`。" +"有關更多詳細資訊,請參閱 Python 原始碼發布版中的 :file:`Misc/" +"SpecialBuilds.txt`。" #: ../../c-api/intro.rst:288 msgid "object" diff --git a/c-api/list.po b/c-api/list.po index 8627316f79..5b7fb4a6e1 100644 --- a/c-api/list.po +++ b/c-api/list.po @@ -33,8 +33,8 @@ msgid "" "This instance of :c:type:`PyTypeObject` represents the Python list type. " "This is the same object as :class:`list` in the Python layer." msgstr "" -"此 :c:type:`PyTypeObject` 實例表示 Python 的 list 型別。這與 Python 層中的 :" -"class:`list` 是同一個物件。" +"此 :c:type:`PyTypeObject` 實例表示 Python 的 list 型別。這與 Python 層中" +"的 :class:`list` 是同一個物件。" #: ../../c-api/list.rst:24 msgid "" @@ -57,20 +57,20 @@ msgid "Return a new list of length *len* on success, or ``NULL`` on failure." msgstr "成功時回傳長度為 *len* 的新串列,失敗時回傳 ``NULL``。" #: ../../c-api/list.rst:40 -#, fuzzy msgid "" "If *len* is greater than zero, the returned list object's items are set to " -"``NULL``. Thus you cannot use abstract API functions such as :c:func:" -"`PySequence_SetItem` or expose the object to Python code before setting all " -"items to a real object with :c:func:`PyList_SetItem` or :c:func:" -"`PyList_SET_ITEM()`. The following APIs are safe APIs before the list is " -"fully initialized: :c:func:`PyList_SetItem()` and :c:func:" -"`PyList_SET_ITEM()`." +"``NULL``. Thus you cannot use abstract API functions such " +"as :c:func:`PySequence_SetItem` or expose the object to Python code before " +"setting all items to a real object with :c:func:`PyList_SetItem` " +"or :c:func:`PyList_SET_ITEM()`. The following APIs are safe APIs before the " +"list is fully initialized: :c:func:`PyList_SetItem()` " +"and :c:func:`PyList_SET_ITEM()`." msgstr "" -"如果 *len* 大於零,則回傳的串列物件之項目將被設定為 ``NULL``。因此,在使用 :" -"c:func:`PyList_SetItem` 來將所有項目設定為一個真實物件前,你無法使用像是 :c:" -"func:`PySequence_SetItem` 的使用抽象 API 函式,也不能將物件暴露 (expose) 給 " -"Python 程式碼。" +"如果 *len* 大於零,則回傳的串列物件之項目將被設定為 ``NULL``。因此,在使" +"用 :c:func:`PyList_SetItem` 或 :c:func:`PyList_SET_ITEM()` 來將所有項目設定為" +"一個真實物件前,你無法使用像是 :c:func:`PySequence_SetItem` 的抽象 API 函式," +"也不能將物件暴露 (expose) 給 Python 程式碼。以下 API 在串列完全初始化之前是安" +"全的::c:func:`PyList_SetItem()` 和 :c:func:`PyList_SET_ITEM()`。" #: ../../c-api/list.rst:53 msgid "" @@ -83,7 +83,6 @@ msgid "Similar to :c:func:`PyList_Size`, but without error checking." msgstr "與 :c:func:`PyList_Size` 類似,但沒有錯誤檢查。" #: ../../c-api/list.rst:64 -#, fuzzy msgid "" "Return the object at position *index* in the list pointed to by *list*. The " "position must be non-negative; indexing from the end of the list is not " @@ -91,8 +90,8 @@ msgid "" "``NULL`` and set an :exc:`IndexError` exception." msgstr "" "回傳 *list* 指向的串列中位於 *index* 位置的物件。該位置不可為負數;並不支援從" -"串列尾末開始索引。如果 *index* 超出邊界範圍(<0 或 >=len(list))則回傳 " -"``NULL`` 並設定 :exc:`IndexError` 例外。" +"串列尾末開始索引。如果 *index* 超出邊界範圍 (:code:`<0 or >=len(list)`) 則回" +"傳 ``NULL`` 並設定 :exc:`IndexError` 例外。" #: ../../c-api/list.rst:74 msgid "" @@ -130,15 +129,17 @@ msgstr "" #: ../../c-api/list.rst:100 msgid "" -"Bounds checking is performed as an assertion if Python is built in :ref:" -"`debug mode <debug-build>` or :option:`with assertions <--with-assertions>`." +"Bounds checking is performed as an assertion if Python is built " +"in :ref:`debug mode <debug-build>` or :option:`with assertions <--with-" +"assertions>`." msgstr "" #: ../../c-api/list.rst:106 msgid "" -"This macro \"steals\" a reference to *item*, and, unlike :c:func:" -"`PyList_SetItem`, does *not* discard a reference to any item that is being " -"replaced; any reference in *list* at position *i* will be leaked." +"This macro \"steals\" a reference to *item*, and, " +"unlike :c:func:`PyList_SetItem`, does *not* discard a reference to any item " +"that is being replaced; any reference in *list* at position *i* will be " +"leaked." msgstr "" "該巨集「竊取」對 *item* 的參照,並且與 :c:func:`PyList_SetItem` 不同的是,它" "\\ *不會*\\ 丟棄對任意被替換項目的參照;*list* 中位置 *i* 的任何參照都將被洩" @@ -226,8 +227,8 @@ msgid "" "Reverse the items of *list* in place. Return ``0`` on success, ``-1`` on " "failure. This is the equivalent of ``list.reverse()``." msgstr "" -"原地反轉 *list* 的項目。成功時回傳 ``0``,失敗時回傳 ``-1``。這相當於 ``list." -"reverse()``。" +"原地反轉 *list* 的項目。成功時回傳 ``0``,失敗時回傳 ``-1``。這相當於 " +"``list.reverse()``。" #: ../../c-api/list.rst:182 msgid "" diff --git a/c-api/module.po b/c-api/module.po index 7ebac731fe..8df6ee5240 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-04 00:13+0000\n" +"POT-Creation-Date: 2025-02-25 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,17 +36,18 @@ msgstr "" #: ../../c-api/module.rst:27 msgid "" -"Return true if *p* is a module object, but not a subtype of :c:data:" -"`PyModule_Type`. This function always succeeds." +"Return true if *p* is a module object, but not a subtype " +"of :c:data:`PyModule_Type`. This function always succeeds." msgstr "" #: ../../c-api/module.rst:40 msgid "" "Return a new module object with :attr:`module.__name__` set to *name*. The " -"module's :attr:`!__name__`, :attr:`~module.__doc__`, :attr:`~module." -"__package__` and :attr:`~module.__loader__` attributes are filled in (all " -"but :attr:`!__name__` are set to ``None``). The caller is responsible for " -"setting a :attr:`~module.__file__` attribute." +"module's :attr:`!" +"__name__`, :attr:`~module.__doc__`, :attr:`~module.__package__` " +"and :attr:`~module.__loader__` attributes are filled in (all but :attr:`!" +"__name__` are set to ``None``). The caller is responsible for setting " +"a :attr:`~module.__file__` attribute." msgstr "" #: ../../c-api/module.rst:46 ../../c-api/module.rst:272 @@ -79,8 +80,8 @@ msgstr "" #: ../../c-api/module.rst:70 msgid "" "It is recommended extensions use other ``PyModule_*`` and ``PyObject_*`` " -"functions rather than directly manipulate a module's :attr:`~object." -"__dict__`." +"functions rather than directly manipulate a " +"module's :attr:`~object.__dict__`." msgstr "" #: ../../c-api/module.rst:81 @@ -99,8 +100,8 @@ msgstr "" #: ../../c-api/module.rst:95 msgid "" "Return the \"state\" of the module, that is, a pointer to the block of " -"memory allocated at module creation time, or ``NULL``. See :c:member:" -"`PyModuleDef.m_size`." +"memory allocated at module creation time, or ``NULL``. " +"See :c:member:`PyModuleDef.m_size`." msgstr "" #: ../../c-api/module.rst:102 @@ -111,10 +112,10 @@ msgstr "" #: ../../c-api/module.rst:112 msgid "" -"Return the name of the file from which *module* was loaded using *module*'s :" -"attr:`~module.__file__` attribute. If this is not defined, or if it is not " -"a string, raise :exc:`SystemError` and return ``NULL``; otherwise return a " -"reference to a Unicode object." +"Return the name of the file from which *module* was loaded using " +"*module*'s :attr:`~module.__file__` attribute. If this is not defined, or " +"if it is not a string, raise :exc:`SystemError` and return ``NULL``; " +"otherwise return a reference to a Unicode object." msgstr "" #: ../../c-api/module.rst:122 @@ -143,9 +144,10 @@ msgstr "" #: ../../c-api/module.rst:140 msgid "" -"The initialization function can either pass a module definition instance to :" -"c:func:`PyModule_Create`, and return the resulting module object, or request " -"\"multi-phase initialization\" by returning the definition struct itself." +"The initialization function can either pass a module definition instance " +"to :c:func:`PyModule_Create`, and return the resulting module object, or " +"request \"multi-phase initialization\" by returning the definition struct " +"itself." msgstr "" #: ../../c-api/module.rst:146 @@ -165,8 +167,8 @@ msgstr "" #: ../../c-api/module.rst:160 msgid "" -"Docstring for the module; usually a docstring variable created with :c:macro:" -"`PyDoc_STRVAR` is used." +"Docstring for the module; usually a docstring variable created " +"with :c:macro:`PyDoc_STRVAR` is used." msgstr "" #: ../../c-api/module.rst:165 @@ -179,8 +181,8 @@ msgstr "" #: ../../c-api/module.rst:169 msgid "" "This memory area is allocated based on *m_size* on module creation, and " -"freed when the module object is deallocated, after the :c:member:" -"`~PyModuleDef.m_free` function has been called, if present." +"freed when the module object is deallocated, after " +"the :c:member:`~PyModuleDef.m_free` function has been called, if present." msgstr "" #: ../../c-api/module.rst:173 @@ -203,8 +205,9 @@ msgstr "更多詳情請見 :pep:`3121`。" #: ../../c-api/module.rst:185 msgid "" -"A pointer to a table of module-level functions, described by :c:type:" -"`PyMethodDef` values. Can be ``NULL`` if no functions are present." +"A pointer to a table of module-level functions, described " +"by :c:type:`PyMethodDef` values. Can be ``NULL`` if no functions are " +"present." msgstr "" #: ../../c-api/module.rst:190 @@ -233,8 +236,8 @@ msgid "" "allocated yet. This is the case immediately after the module is created and " "before the module is executed (:c:data:`Py_mod_exec` function). More " "precisely, this function is not called if :c:member:`~PyModuleDef.m_size` is " -"greater than 0 and the module state (as returned by :c:func:" -"`PyModule_GetState`) is ``NULL``." +"greater than 0 and the module state (as returned " +"by :c:func:`PyModule_GetState`) is ``NULL``." msgstr "" #: ../../c-api/module.rst:213 ../../c-api/module.rst:234 @@ -277,8 +280,8 @@ msgstr "" #: ../../c-api/module.rst:261 msgid "" "Create a new module object, given the definition in *def*. This behaves " -"like :c:func:`PyModule_Create2` with *module_api_version* set to :c:macro:" -"`PYTHON_API_VERSION`." +"like :c:func:`PyModule_Create2` with *module_api_version* set " +"to :c:macro:`PYTHON_API_VERSION`." msgstr "" #: ../../c-api/module.rst:268 @@ -297,8 +300,8 @@ msgstr "" #: ../../c-api/module.rst:279 msgid "" "Before it is returned from in the initialization function, the resulting " -"module object is typically populated using functions like :c:func:" -"`PyModule_AddObjectRef`." +"module object is typically populated using functions " +"like :c:func:`PyModule_AddObjectRef`." msgstr "" #: ../../c-api/module.rst:285 @@ -323,9 +326,10 @@ msgid "" "normal garbage collection -- as with Python modules. By default, multiple " "modules created from the same definition should be independent: changes to " "one should not affect the others. This means that all state should be " -"specific to the module object (using e.g. using :c:func:" -"`PyModule_GetState`), or its contents (such as the module's :attr:`~object." -"__dict__` or individual classes created with :c:func:`PyType_FromSpec`)." +"specific to the module object (using e.g. " +"using :c:func:`PyModule_GetState`), or its contents (such as the " +"module's :attr:`~object.__dict__` or individual classes created " +"with :c:func:`PyType_FromSpec`)." msgstr "" #: ../../c-api/module.rst:304 @@ -338,9 +342,9 @@ msgstr "" #: ../../c-api/module.rst:308 msgid "" "To request multi-phase initialization, the initialization function " -"(PyInit_modulename) returns a :c:type:`PyModuleDef` instance with non-empty :" -"c:member:`~PyModuleDef.m_slots`. Before it is returned, the ``PyModuleDef`` " -"instance must be initialized with the following function:" +"(PyInit_modulename) returns a :c:type:`PyModuleDef` instance with non-" +"empty :c:member:`~PyModuleDef.m_slots`. Before it is returned, the " +"``PyModuleDef`` instance must be initialized with the following function:" msgstr "" #: ../../c-api/module.rst:315 @@ -412,12 +416,12 @@ msgstr "" #: ../../c-api/module.rst:368 msgid "" -"There is no requirement for the returned object to be an instance of :c:type:" -"`PyModule_Type`. Any type can be used, as long as it supports setting and " -"getting import-related attributes. However, only ``PyModule_Type`` instances " -"may be returned if the ``PyModuleDef`` has non-``NULL`` ``m_traverse``, " -"``m_clear``, ``m_free``; non-zero ``m_size``; or slots other than " -"``Py_mod_create``." +"There is no requirement for the returned object to be an instance " +"of :c:type:`PyModule_Type`. Any type can be used, as long as it supports " +"setting and getting import-related attributes. However, only " +"``PyModule_Type`` instances may be returned if the ``PyModuleDef`` has non-" +"``NULL`` ``m_traverse``, ``m_clear``, ``m_free``; non-zero ``m_size``; or " +"slots other than ``Py_mod_create``." msgstr "" #: ../../c-api/module.rst:377 @@ -469,7 +473,7 @@ msgstr "" #: ../../c-api/module.rst:417 msgid "" "If ``Py_mod_multiple_interpreters`` is not specified, the import machinery " -"defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED``." +"defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED``." msgstr "" #: ../../c-api/module.rst:430 @@ -658,10 +662,10 @@ msgstr "" msgid "" "The number of different *name* strings passed to this function should be " "kept small, usually by only using statically allocated strings as *name*. " -"For names that aren't known at compile time, prefer calling :c:func:" -"`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For more " -"details, see :c:func:`PyUnicode_InternFromString`, which may be used " -"internally to create a key object." +"For names that aren't known at compile time, prefer " +"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` " +"directly. For more details, see :c:func:`PyUnicode_InternFromString`, which " +"may be used internally to create a key object." msgstr "" #: ../../c-api/module.rst:572 @@ -700,8 +704,8 @@ msgstr "" #: ../../c-api/module.rst:601 msgid "" -"This means that its return value must be checked, and calling code must :c:" -"func:`Py_XDECREF` *value* manually on error." +"This means that its return value must be checked, and calling code " +"must :c:func:`Py_XDECREF` *value* manually on error." msgstr "" #: ../../c-api/module.rst:606 @@ -731,8 +735,8 @@ msgstr "" #: ../../c-api/module.rst:628 msgid "" -"This is a convenience function that calls :c:func:`PyLong_FromLong` and :c:" -"func:`PyModule_AddObjectRef`; see their documentation for details." +"This is a convenience function that calls :c:func:`PyLong_FromLong` " +"and :c:func:`PyModule_AddObjectRef`; see their documentation for details." msgstr "" #: ../../c-api/module.rst:634 @@ -745,9 +749,9 @@ msgstr "" #: ../../c-api/module.rst:639 msgid "" -"This is a convenience function that calls :c:func:" -"`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; see their " -"documentation for details." +"This is a convenience function that " +"calls :c:func:`PyUnicode_InternFromString` " +"and :c:func:`PyModule_AddObjectRef`; see their documentation for details." msgstr "" #: ../../c-api/module.rst:646 @@ -760,7 +764,7 @@ msgstr "" #: ../../c-api/module.rst:654 msgid "Add a string constant to *module*." -msgstr "" +msgstr "將字串常數加入到 *module* 中。" #: ../../c-api/module.rst:658 msgid "" @@ -811,8 +815,8 @@ msgstr "" #: ../../c-api/module.rst:699 msgid "" "Attaches the module object passed to the function to the interpreter state. " -"This allows the module object to be accessible via :c:func:" -"`PyState_FindModule`." +"This allows the module object to be accessible " +"via :c:func:`PyState_FindModule`." msgstr "" #: ../../c-api/module.rst:702 diff --git a/c-api/monitoring.po b/c-api/monitoring.po index 67816dfd7a..ac7e58b853 100644 --- a/c-api/monitoring.po +++ b/c-api/monitoring.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-22 00:13+0000\n" +"POT-Creation-Date: 2025-03-20 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -282,3 +282,13 @@ msgstr ":monitoring-event:`STOP_ITERATION`" msgid "" "Exit the last scope that was entered with :c:func:`!PyMonitoring_EnterScope`." msgstr "" + +#: ../../c-api/monitoring.rst:197 +msgid "" +"Return true if the event corresponding to the event ID *ev* is a :ref:`local " +"event <monitoring-event-local>`." +msgstr "" + +#: ../../c-api/monitoring.rst:204 +msgid "This function is :term:`soft deprecated`." +msgstr "" diff --git a/c-api/none.po b/c-api/none.po index eb714cd111..2a360b0167 100644 --- a/c-api/none.po +++ b/c-api/none.po @@ -38,9 +38,8 @@ msgid "" msgstr "" #: ../../c-api/none.rst:21 -#, fuzzy msgid ":c:data:`Py_None` is :term:`immortal`." -msgstr ":c:data:`Py_None` 為不滅的 (immortal)。" +msgstr ":c:data:`Py_None` 為\\ :term:`不滅的 (immortal) <immortal>`。" #: ../../c-api/none.rst:26 msgid "Return :c:data:`Py_None` from a function." diff --git a/c-api/object.po b/c-api/object.po index 661f6905da..85e8adfd09 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -28,11 +28,11 @@ msgstr "" #: ../../c-api/object.rst:13 msgid "Set an exception and return ``NULL`` if *constant_id* is invalid." -msgstr "" +msgstr "如果 *constant_id* 無效,則設定一個例外並回傳 ``NULL``。" #: ../../c-api/object.rst:15 msgid "*constant_id* must be one of these constant identifiers:" -msgstr "" +msgstr "*constant_id* 必須是這些常數識別字之一:" #: ../../c-api/object.rst:20 msgid "Constant Identifier" @@ -135,8 +135,8 @@ msgstr "" #: ../../c-api/object.rst:50 msgid "" -"This function is primarily intended for backwards compatibility: using :c:" -"func:`Py_GetConstant` is recommended for new code." +"This function is primarily intended for backwards compatibility: " +"using :c:func:`Py_GetConstant` is recommended for new code." msgstr "" #: ../../c-api/object.rst:53 @@ -154,15 +154,16 @@ msgstr "" #: ../../c-api/object.rst:67 msgid "" "Properly handle returning :c:data:`Py_NotImplemented` from within a C " -"function (that is, create a new :term:`strong reference` to :const:" -"`NotImplemented` and return it)." +"function (that is, create a new :term:`strong reference` " +"to :const:`NotImplemented` and return it)." msgstr "" #: ../../c-api/object.rst:74 msgid "" -"Flag to be used with multiple functions that print the object (like :c:func:" -"`PyObject_Print` and :c:func:`PyFile_WriteObject`). If passed, these " -"function would use the :func:`str` of the object instead of the :func:`repr`." +"Flag to be used with multiple functions that print the object " +"(like :c:func:`PyObject_Print` and :c:func:`PyFile_WriteObject`). If passed, " +"these function would use the :func:`str` of the object instead of " +"the :func:`repr`." msgstr "" #: ../../c-api/object.rst:82 @@ -195,26 +196,27 @@ msgstr "" #: ../../c-api/object.rst:113 msgid "" -"Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" -"`~object.__getattribute__` methods aren't propagated, but instead given to :" -"func:`sys.unraisablehook`. For proper error handling, use :c:func:" -"`PyObject_HasAttrWithError`, :c:func:`PyObject_GetOptionalAttr` or :c:func:" -"`PyObject_GetAttr` instead." +"Exceptions that occur when this calls :meth:`~object.__getattr__` " +"and :meth:`~object.__getattribute__` methods aren't propagated, but instead " +"given to :func:`sys.unraisablehook`. For proper error handling, " +"use :c:func:`PyObject_HasAttrWithError`, :c:func:`PyObject_GetOptionalAttr` " +"or :c:func:`PyObject_GetAttr` instead." msgstr "" #: ../../c-api/object.rst:122 msgid "" "This is the same as :c:func:`PyObject_HasAttr`, but *attr_name* is specified " -"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/object.rst:128 msgid "" -"Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" -"`~object.__getattribute__` methods or while creating the temporary :class:" -"`str` object are silently ignored. For proper error handling, use :c:func:" -"`PyObject_HasAttrStringWithError`, :c:func:`PyObject_GetOptionalAttrString` " +"Exceptions that occur when this calls :meth:`~object.__getattr__` " +"and :meth:`~object.__getattribute__` methods or while creating the " +"temporary :class:`str` object are silently ignored. For proper error " +"handling, " +"use :c:func:`PyObject_HasAttrStringWithError`, :c:func:`PyObject_GetOptionalAttrString` " "or :c:func:`PyObject_GetAttrString` instead." msgstr "" @@ -227,36 +229,37 @@ msgstr "" #: ../../c-api/object.rst:142 msgid "" -"If the missing attribute should not be treated as a failure, you can use :c:" -"func:`PyObject_GetOptionalAttr` instead." +"If the missing attribute should not be treated as a failure, you can " +"use :c:func:`PyObject_GetOptionalAttr` instead." msgstr "" #: ../../c-api/object.rst:148 msgid "" "This is the same as :c:func:`PyObject_GetAttr`, but *attr_name* is specified " -"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/object.rst:152 msgid "" -"If the missing attribute should not be treated as a failure, you can use :c:" -"func:`PyObject_GetOptionalAttrString` instead." +"If the missing attribute should not be treated as a failure, you can " +"use :c:func:`PyObject_GetOptionalAttrString` instead." msgstr "" #: ../../c-api/object.rst:158 msgid "" -"Variant of :c:func:`PyObject_GetAttr` which doesn't raise :exc:" -"`AttributeError` if the attribute is not found." +"Variant of :c:func:`PyObject_GetAttr` which doesn't " +"raise :exc:`AttributeError` if the attribute is not found." msgstr "" #: ../../c-api/object.rst:161 msgid "" -"If the attribute is found, return ``1`` and set *\\*result* to a new :term:" -"`strong reference` to the attribute. If the attribute is not found, return " -"``0`` and set *\\*result* to ``NULL``; the :exc:`AttributeError` is " -"silenced. If an error other than :exc:`AttributeError` is raised, return " -"``-1`` and set *\\*result* to ``NULL``." +"If the attribute is found, return ``1`` and set *\\*result* to a " +"new :term:`strong reference` to the attribute. If the attribute is not " +"found, return ``0`` and set *\\*result* to ``NULL``; " +"the :exc:`AttributeError` is silenced. If an error other " +"than :exc:`AttributeError` is raised, return ``-1`` and set *\\*result* to " +"``NULL``." msgstr "" #: ../../c-api/object.rst:173 @@ -270,10 +273,11 @@ msgstr "" msgid "" "Generic attribute getter function that is meant to be put into a type " "object's ``tp_getattro`` slot. It looks for a descriptor in the dictionary " -"of classes in the object's MRO as well as an attribute in the object's :attr:" -"`~object.__dict__` (if present). As outlined in :ref:`descriptors`, data " -"descriptors take preference over instance attributes, while non-data " -"descriptors don't. Otherwise, an :exc:`AttributeError` is raised." +"of classes in the object's MRO as well as an attribute in the " +"object's :attr:`~object.__dict__` (if present). As outlined " +"in :ref:`descriptors`, data descriptors take preference over instance " +"attributes, while non-data descriptors don't. Otherwise, " +"an :exc:`AttributeError` is raised." msgstr "" #: ../../c-api/object.rst:191 @@ -293,8 +297,8 @@ msgstr "" #: ../../c-api/object.rst:203 msgid "" "This is the same as :c:func:`PyObject_SetAttr`, but *attr_name* is specified " -"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/object.rst:207 @@ -307,10 +311,10 @@ msgstr "" msgid "" "The number of different attribute names passed to this function should be " "kept small, usually by using a statically allocated string as *attr_name*. " -"For attribute names that aren't known at compile time, prefer calling :c:" -"func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For " -"more details, see :c:func:`PyUnicode_InternFromString`, which may be used " -"internally to create a key object." +"For attribute names that aren't known at compile time, prefer " +"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` " +"directly. For more details, see :c:func:`PyUnicode_InternFromString`, which " +"may be used internally to create a key object." msgstr "" #: ../../c-api/object.rst:220 @@ -334,18 +338,18 @@ msgstr "" #: ../../c-api/object.rst:238 msgid "" "This is the same as :c:func:`PyObject_DelAttr`, but *attr_name* is specified " -"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/object.rst:242 msgid "" "The number of different attribute names passed to this function should be " "kept small, usually by using a statically allocated string as *attr_name*. " -"For attribute names that aren't known at compile time, prefer calling :c:" -"func:`PyUnicode_FromString` and :c:func:`PyObject_DelAttr` directly. For " -"more details, see :c:func:`PyUnicode_InternFromString`, which may be used " -"internally to create a key object for lookup." +"For attribute names that aren't known at compile time, prefer " +"calling :c:func:`PyUnicode_FromString` and :c:func:`PyObject_DelAttr` " +"directly. For more details, see :c:func:`PyUnicode_InternFromString`, which " +"may be used internally to create a key object for lookup." msgstr "" #: ../../c-api/object.rst:253 @@ -389,12 +393,12 @@ msgstr "" #: ../../c-api/object.rst:287 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " -"which must be one of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`, :" -"c:macro:`Py_NE`, :c:macro:`Py_GT`, or :c:macro:`Py_GE`, corresponding to " -"``<``, ``<=``, ``==``, ``!=``, ``>``, or ``>=`` respectively. This is the " -"equivalent of the Python expression ``o1 op o2``, where ``op`` is the " -"operator corresponding to *opid*. Returns the value of the comparison on " -"success, or ``NULL`` on failure." +"which must be one " +"of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_GT`, " +"or :c:macro:`Py_GE`, corresponding to ``<``, ``<=``, ``==``, ``!=``, ``>``, " +"or ``>=`` respectively. This is the equivalent of the Python expression ``o1 " +"op o2``, where ``op`` is the operator corresponding to *opid*. Returns the " +"value of the comparison on success, or ``NULL`` on failure." msgstr "" #: ../../c-api/object.rst:297 @@ -440,10 +444,10 @@ msgstr "" #: ../../c-api/object.rst:330 msgid "" "As :c:func:`PyObject_Repr`, compute a string representation of object *o*, " -"but escape the non-ASCII characters in the string returned by :c:func:" -"`PyObject_Repr` with ``\\x``, ``\\u`` or ``\\U`` escapes. This generates a " -"string similar to that returned by :c:func:`PyObject_Repr` in Python 2. " -"Called by the :func:`ascii` built-in function." +"but escape the non-ASCII characters in the string returned " +"by :c:func:`PyObject_Repr` with ``\\x``, ``\\u`` or ``\\U`` escapes. This " +"generates a string similar to that returned by :c:func:`PyObject_Repr` in " +"Python 2. Called by the :func:`ascii` built-in function." msgstr "" #: ../../c-api/object.rst:341 @@ -480,8 +484,8 @@ msgstr "" msgid "" "If *cls* has a :meth:`~type.__subclasscheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " -"*derived* is a subclass of *cls* if it is a direct or indirect subclass, i." -"e. contained in :attr:`cls.__mro__ <type.__mro__>`." +"*derived* is a subclass of *cls* if it is a direct or indirect subclass, " +"i.e. contained in :attr:`cls.__mro__ <type.__mro__>`." msgstr "" #: ../../c-api/object.rst:376 @@ -506,8 +510,8 @@ msgstr "" #: ../../c-api/object.rst:394 msgid "" -"An instance *inst* can override what is considered its class by having a :" -"attr:`~object.__class__` attribute." +"An instance *inst* can override what is considered its class by having " +"a :attr:`~object.__class__` attribute." msgstr "" #: ../../c-api/object.rst:397 @@ -606,9 +610,9 @@ msgstr "" #: ../../c-api/object.rst:498 msgid "" -"This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as a :" -"c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" -"`PyObject*`." +"This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as " +"a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." msgstr "" #: ../../c-api/object.rst:505 @@ -617,8 +621,8 @@ msgid "" "(possibly empty) list of strings appropriate for the object argument, or " "``NULL`` if there was an error. If the argument is ``NULL``, this is like " "the Python ``dir()``, returning the names of the current locals; in this " -"case, if no execution frame is active then ``NULL`` is returned but :c:func:" -"`PyErr_Occurred` will return false." +"case, if no execution frame is active then ``NULL`` is returned " +"but :c:func:`PyErr_Occurred` will return false." msgstr "" #: ../../c-api/object.rst:514 @@ -632,17 +636,17 @@ msgstr "" #: ../../c-api/object.rst:522 msgid "" "This is equivalent to the Python ``__iter__(self): return self`` method. It " -"is intended for :term:`iterator` types, to be used in the :c:member:" -"`PyTypeObject.tp_iter` slot." +"is intended for :term:`iterator` types, to be used in " +"the :c:member:`PyTypeObject.tp_iter` slot." msgstr "" #: ../../c-api/object.rst:528 msgid "" -"This is the equivalent to the Python expression ``aiter(o)``. Takes an :" -"class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it. " -"This is typically a new iterator but if the argument is an :class:" -"`AsyncIterator`, this returns itself. Raises :exc:`TypeError` and returns " -"``NULL`` if the object cannot be iterated." +"This is the equivalent to the Python expression ``aiter(o)``. Takes " +"an :class:`AsyncIterable` object and returns an :class:`AsyncIterator` for " +"it. This is typically a new iterator but if the argument is " +"an :class:`AsyncIterator`, this returns itself. Raises :exc:`TypeError` and " +"returns ``NULL`` if the object cannot be iterated." msgstr "" #: ../../c-api/object.rst:538 @@ -658,7 +662,7 @@ msgstr "" #: ../../c-api/object.rst:544 msgid "On error, set an exception and return ``NULL``." -msgstr "" +msgstr "錯誤時設定一個例外並回傳 ``NULL``。" #: ../../c-api/object.rst:550 msgid "" @@ -669,24 +673,24 @@ msgstr "" #: ../../c-api/object.rst:553 msgid "" "This may be larger than requested using :c:member:`-PyType_Spec.basicsize " -"<PyType_Spec.basicsize>`; it is safe to use this larger size (e.g. with :c:" -"func:`!memset`)." +"<PyType_Spec.basicsize>`; it is safe to use this larger size (e.g. " +"with :c:func:`!memset`)." msgstr "" #: ../../c-api/object.rst:556 msgid "" -"The type *cls* **must** have been created using negative :c:member:" -"`PyType_Spec.basicsize`. Python does not check this." +"The type *cls* **must** have been created using " +"negative :c:member:`PyType_Spec.basicsize`. Python does not check this." msgstr "" #: ../../c-api/object.rst:560 msgid "On error, set an exception and return a negative value." -msgstr "" +msgstr "錯誤時設定一個例外並回傳一個負值。" #: ../../c-api/object.rst:566 msgid "" -"Get a pointer to per-item data for a class with :c:macro:" -"`Py_TPFLAGS_ITEMS_AT_END`." +"Get a pointer to per-item data for a class " +"with :c:macro:`Py_TPFLAGS_ITEMS_AT_END`." msgstr "" #: ../../c-api/object.rst:569 @@ -694,6 +698,8 @@ msgid "" "On error, set an exception and return ``NULL``. :py:exc:`TypeError` is " "raised if *o* does not have :c:macro:`Py_TPFLAGS_ITEMS_AT_END` set." msgstr "" +"錯誤時設定一個例外並回傳 ``NULL``。如果 *o* 沒有設" +"定 :c:macro:`Py_TPFLAGS_ITEMS_AT_END`,則會引發 :py:exc:`TypeError`。" #: ../../c-api/object.rst:577 msgid "Visit the managed dictionary of *obj*." diff --git a/c-api/slice.po b/c-api/slice.po index a2b3dbc7a7..fbac58a43a 100644 --- a/c-api/slice.po +++ b/c-api/slice.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-18 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -88,8 +88,8 @@ msgstr "成功時回傳 ``0`` ,在失敗時回傳 ``-1`` 並設定例外。" #: ../../c-api/slice.rst:60 msgid "" "This function is considered not safe for resizable sequences. Its invocation " -"should be replaced by a combination of :c:func:`PySlice_Unpack` and :c:func:" -"`PySlice_AdjustIndices` where ::" +"should be replaced by a combination of :c:func:`PySlice_Unpack` " +"and :c:func:`PySlice_AdjustIndices` where ::" msgstr "" #: ../../c-api/slice.rst:64 @@ -156,14 +156,20 @@ msgstr "" #: ../../c-api/slice.rst:118 msgid "Ellipsis Object" -msgstr "" +msgstr "Ellipsis 物件" #: ../../c-api/slice.rst:123 msgid "" -"The Python ``Ellipsis`` object. This object has no methods. Like :c:data:" -"`Py_None`, it is an :term:`immortal` singleton object." +"The type of Python :const:`Ellipsis` object. Same " +"as :class:`types.EllipsisType` in the Python layer." +msgstr "" + +#: ../../c-api/slice.rst:129 +msgid "" +"The Python ``Ellipsis`` object. This object has no methods. " +"Like :c:data:`Py_None`, it is an :term:`immortal` singleton object." msgstr "" -#: ../../c-api/slice.rst:126 +#: ../../c-api/slice.rst:132 msgid ":c:data:`Py_Ellipsis` is immortal." msgstr ":c:data:`Py_Ellipsis` 為不滅的 (immortal)。" diff --git a/c-api/structures.po b/c-api/structures.po index 76d856ee90..eacbf76707 100644 --- a/c-api/structures.po +++ b/c-api/structures.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-11 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -57,11 +57,11 @@ msgstr "" #: ../../c-api/structures.rst:38 msgid "" -"This is an extension of :c:type:`PyObject` that adds the :c:member:" -"`~PyVarObject.ob_size` field. This is only used for objects that have some " -"notion of *length*. This type does not often appear in the Python/C API. " -"Access to the members must be done by using the macros :c:macro:" -"`Py_REFCNT`, :c:macro:`Py_TYPE`, and :c:macro:`Py_SIZE`." +"This is an extension of :c:type:`PyObject` that adds " +"the :c:member:`~PyVarObject.ob_size` field. This is only used for objects " +"that have some notion of *length*. This type does not often appear in the " +"Python/C API. Access to the members must be done by using the " +"macros :c:macro:`Py_REFCNT`, :c:macro:`Py_TYPE`, and :c:macro:`Py_SIZE`." msgstr "" #: ../../c-api/structures.rst:47 @@ -95,80 +95,85 @@ msgstr "請見上面 :c:type:`PyVarObject` 的文件。" #: ../../c-api/structures.rst:68 msgid "" +"The base class of all other objects, the same as :class:`object` in Python." +msgstr "" + +#: ../../c-api/structures.rst:73 +msgid "" "Test if the *x* object is the *y* object, the same as ``x is y`` in Python." msgstr "" -#: ../../c-api/structures.rst:75 +#: ../../c-api/structures.rst:80 msgid "" "Test if an object is the ``None`` singleton, the same as ``x is None`` in " "Python." msgstr "" -#: ../../c-api/structures.rst:83 +#: ../../c-api/structures.rst:88 msgid "" "Test if an object is the ``True`` singleton, the same as ``x is True`` in " "Python." msgstr "" -#: ../../c-api/structures.rst:91 +#: ../../c-api/structures.rst:96 msgid "" "Test if an object is the ``False`` singleton, the same as ``x is False`` in " "Python." msgstr "" -#: ../../c-api/structures.rst:99 +#: ../../c-api/structures.rst:104 msgid "Get the type of the Python object *o*." msgstr "" -#: ../../c-api/structures.rst:101 +#: ../../c-api/structures.rst:106 msgid "Return a :term:`borrowed reference`." msgstr "" -#: ../../c-api/structures.rst:103 +#: ../../c-api/structures.rst:108 msgid "Use the :c:func:`Py_SET_TYPE` function to set an object type." msgstr "" -#: ../../c-api/structures.rst:105 +#: ../../c-api/structures.rst:110 msgid "" ":c:func:`Py_TYPE()` is changed to an inline static function. The parameter " "type is no longer :c:expr:`const PyObject*`." msgstr "" -#: ../../c-api/structures.rst:112 +#: ../../c-api/structures.rst:117 msgid "" "Return non-zero if the object *o* type is *type*. Return zero otherwise. " "Equivalent to: ``Py_TYPE(o) == type``." msgstr "" -#: ../../c-api/structures.rst:120 +#: ../../c-api/structures.rst:125 msgid "Set the object *o* type to *type*." msgstr "將物件 *o* 的型別設為 *type*。" -#: ../../c-api/structures.rst:127 +#: ../../c-api/structures.rst:132 msgid "Get the size of the Python object *o*." msgstr "取得 Python 物件 *o* 的大小。" -#: ../../c-api/structures.rst:129 +#: ../../c-api/structures.rst:134 msgid "Use the :c:func:`Py_SET_SIZE` function to set an object size." msgstr "" -#: ../../c-api/structures.rst:131 +#: ../../c-api/structures.rst:136 msgid "" ":c:func:`Py_SIZE()` is changed to an inline static function. The parameter " "type is no longer :c:expr:`const PyVarObject*`." msgstr "" -#: ../../c-api/structures.rst:138 +#: ../../c-api/structures.rst:143 msgid "Set the object *o* size to *size*." msgstr "將物件 *o* 的大小設為 *size*。" -#: ../../c-api/structures.rst:145 +#: ../../c-api/structures.rst:150 msgid "" -"This is a macro which expands to initialization values for a new :c:type:" -"`PyObject` type. This macro expands to::" +"This is a macro which expands to initialization values for a " +"new :c:type:`PyObject` type. This macro expands to::" msgstr "" -#: ../../c-api/structures.rst:148 +#: ../../c-api/structures.rst:153 msgid "" "_PyObject_EXTRA_INIT\n" "1, type," @@ -176,14 +181,14 @@ msgstr "" "_PyObject_EXTRA_INIT\n" "1, type," -#: ../../c-api/structures.rst:154 +#: ../../c-api/structures.rst:159 msgid "" -"This is a macro which expands to initialization values for a new :c:type:" -"`PyVarObject` type, including the :c:member:`~PyVarObject.ob_size` field. " -"This macro expands to::" +"This is a macro which expands to initialization values for a " +"new :c:type:`PyVarObject` type, including " +"the :c:member:`~PyVarObject.ob_size` field. This macro expands to::" msgstr "" -#: ../../c-api/structures.rst:158 +#: ../../c-api/structures.rst:163 msgid "" "_PyObject_EXTRA_INIT\n" "1, type, size," @@ -191,11 +196,11 @@ msgstr "" "_PyObject_EXTRA_INIT\n" "1, type, size," -#: ../../c-api/structures.rst:163 +#: ../../c-api/structures.rst:168 msgid "Implementing functions and methods" msgstr "實作函式與方法" -#: ../../c-api/structures.rst:167 +#: ../../c-api/structures.rst:172 msgid "" "Type of the functions used to implement most Python callables in C. " "Functions of this type take two :c:expr:`PyObject*` parameters and return " @@ -205,11 +210,11 @@ msgid "" "reference." msgstr "" -#: ../../c-api/structures.rst:174 +#: ../../c-api/structures.rst:179 msgid "The function signature is::" msgstr "" -#: ../../c-api/structures.rst:176 +#: ../../c-api/structures.rst:181 msgid "" "PyObject *PyCFunction(PyObject *self,\n" " PyObject *args);" @@ -217,14 +222,14 @@ msgstr "" "PyObject *PyCFunction(PyObject *self,\n" " PyObject *args);" -#: ../../c-api/structures.rst:181 +#: ../../c-api/structures.rst:186 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_VARARGS | METH_KEYWORDS <METH_VARARGS-METH_KEYWORDS>`. " "The function signature is::" msgstr "" -#: ../../c-api/structures.rst:185 +#: ../../c-api/structures.rst:190 msgid "" "PyObject *PyCFunctionWithKeywords(PyObject *self,\n" " PyObject *args,\n" @@ -234,51 +239,49 @@ msgstr "" " PyObject *args,\n" " PyObject *kwargs);" -#: ../../c-api/structures.rst:192 +#: ../../c-api/structures.rst:197 msgid "" "Type of the functions used to implement Python callables in C with " "signature :c:macro:`METH_FASTCALL`. The function signature is::" msgstr "" -#: ../../c-api/structures.rst:196 -#, fuzzy +#: ../../c-api/structures.rst:201 msgid "" "PyObject *PyCFunctionFast(PyObject *self,\n" " PyObject *const *args,\n" " Py_ssize_t nargs);" msgstr "" -"PyObject *_PyCFunctionFast(PyObject *self,\n" -" PyObject *const *args,\n" -" Py_ssize_t nargs);" +"PyObject *PyCFunctionFast(PyObject *self,\n" +" PyObject *const *args,\n" +" Py_ssize_t nargs);" -#: ../../c-api/structures.rst:202 +#: ../../c-api/structures.rst:207 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_FASTCALL | METH_KEYWORDS <METH_FASTCALL-" "METH_KEYWORDS>`. The function signature is::" msgstr "" -#: ../../c-api/structures.rst:206 -#, fuzzy +#: ../../c-api/structures.rst:211 msgid "" "PyObject *PyCFunctionFastWithKeywords(PyObject *self,\n" " PyObject *const *args,\n" " Py_ssize_t nargs,\n" " PyObject *kwnames);" msgstr "" -"PyObject *_PyCFunctionFastWithKeywords(PyObject *self,\n" -" PyObject *const *args,\n" -" Py_ssize_t nargs,\n" -" PyObject *kwnames);" +"PyObject *PyCFunctionFastWithKeywords(PyObject *self,\n" +" PyObject *const *args,\n" +" Py_ssize_t nargs,\n" +" PyObject *kwnames);" -#: ../../c-api/structures.rst:213 +#: ../../c-api/structures.rst:218 msgid "" "Type of the functions used to implement Python callables in C with " "signature :ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS <METH_METHOD-" "METH_FASTCALL-METH_KEYWORDS>`. The function signature is::" msgstr "" -#: ../../c-api/structures.rst:217 +#: ../../c-api/structures.rst:222 msgid "" "PyObject *PyCMethod(PyObject *self,\n" " PyTypeObject *defining_class,\n" @@ -292,29 +295,29 @@ msgstr "" " Py_ssize_t nargs,\n" " PyObject *kwnames)" -#: ../../c-api/structures.rst:228 +#: ../../c-api/structures.rst:233 msgid "" "Structure used to describe a method of an extension type. This structure " "has four fields:" msgstr "" -#: ../../c-api/structures.rst:233 +#: ../../c-api/structures.rst:238 msgid "Name of the method." msgstr "" -#: ../../c-api/structures.rst:237 +#: ../../c-api/structures.rst:242 msgid "Pointer to the C implementation." msgstr "" -#: ../../c-api/structures.rst:241 +#: ../../c-api/structures.rst:246 msgid "Flags bits indicating how the call should be constructed." msgstr "" -#: ../../c-api/structures.rst:245 +#: ../../c-api/structures.rst:250 msgid "Points to the contents of the docstring." msgstr "" -#: ../../c-api/structures.rst:247 +#: ../../c-api/structures.rst:252 msgid "" "The :c:member:`~PyMethodDef.ml_meth` is a C function pointer. The functions " "may be of different types, but they always return :c:expr:`PyObject*`. If " @@ -324,41 +327,42 @@ msgid "" "implementation uses the specific C type of the *self* object." msgstr "" -#: ../../c-api/structures.rst:255 +#: ../../c-api/structures.rst:260 msgid "" "The :c:member:`~PyMethodDef.ml_flags` field is a bitfield which can include " "the following flags. The individual flags indicate either a calling " "convention or a binding convention." msgstr "" -#: ../../c-api/structures.rst:260 +#: ../../c-api/structures.rst:265 msgid "There are these calling conventions:" msgstr "" -#: ../../c-api/structures.rst:264 +#: ../../c-api/structures.rst:269 msgid "" -"This is the typical calling convention, where the methods have the type :c:" -"type:`PyCFunction`. The function expects two :c:expr:`PyObject*` values. The " -"first one is the *self* object for methods; for module functions, it is the " -"module object. The second parameter (often called *args*) is a tuple object " -"representing all arguments. This parameter is typically processed using :c:" -"func:`PyArg_ParseTuple` or :c:func:`PyArg_UnpackTuple`." +"This is the typical calling convention, where the methods have the " +"type :c:type:`PyCFunction`. The function expects two :c:expr:`PyObject*` " +"values. The first one is the *self* object for methods; for module " +"functions, it is the module object. The second parameter (often called " +"*args*) is a tuple object representing all arguments. This parameter is " +"typically processed using :c:func:`PyArg_ParseTuple` " +"or :c:func:`PyArg_UnpackTuple`." msgstr "" -#: ../../c-api/structures.rst:274 +#: ../../c-api/structures.rst:279 msgid "" -"Can only be used in certain combinations with other flags: :ref:" -"`METH_VARARGS | METH_KEYWORDS <METH_VARARGS-METH_KEYWORDS>`, :ref:" -"`METH_FASTCALL | METH_KEYWORDS <METH_FASTCALL-METH_KEYWORDS>` and :ref:" -"`METH_METHOD | METH_FASTCALL | METH_KEYWORDS <METH_METHOD-METH_FASTCALL-" -"METH_KEYWORDS>`." +"Can only be used in certain combinations with other " +"flags: :ref:`METH_VARARGS | METH_KEYWORDS <METH_VARARGS-" +"METH_KEYWORDS>`, :ref:`METH_FASTCALL | METH_KEYWORDS <METH_FASTCALL-" +"METH_KEYWORDS>` and :ref:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS " +"<METH_METHOD-METH_FASTCALL-METH_KEYWORDS>`." msgstr "" -#: ../../c-api/structures.rst:282 +#: ../../c-api/structures.rst:287 msgid ":c:expr:`METH_VARARGS | METH_KEYWORDS`" msgstr ":c:expr:`METH_VARARGS | METH_KEYWORDS`" -#: ../../c-api/structures.rst:283 +#: ../../c-api/structures.rst:288 msgid "" "Methods with these flags must be of type :c:type:`PyCFunctionWithKeywords`. " "The function expects three parameters: *self*, *args*, *kwargs* where " @@ -367,7 +371,7 @@ msgid "" "using :c:func:`PyArg_ParseTupleAndKeywords`." msgstr "" -#: ../../c-api/structures.rst:292 +#: ../../c-api/structures.rst:297 msgid "" "Fast calling convention supporting only positional arguments. The methods " "have the type :c:type:`PyCFunctionFast`. The first parameter is *self*, the " @@ -376,15 +380,15 @@ msgid "" "the array)." msgstr "" -#: ../../c-api/structures.rst:302 +#: ../../c-api/structures.rst:307 msgid "``METH_FASTCALL`` is now part of the :ref:`stable ABI <stable-abi>`." msgstr "" -#: ../../c-api/structures.rst:307 +#: ../../c-api/structures.rst:312 msgid ":c:expr:`METH_FASTCALL | METH_KEYWORDS`" msgstr ":c:expr:`METH_FASTCALL | METH_KEYWORDS`" -#: ../../c-api/structures.rst:308 +#: ../../c-api/structures.rst:313 msgid "" "Extension of :c:macro:`METH_FASTCALL` supporting also keyword arguments, " "with methods of type :c:type:`PyCFunctionFastWithKeywords`. Keyword " @@ -396,17 +400,17 @@ msgid "" "the positional arguments." msgstr "" -#: ../../c-api/structures.rst:323 +#: ../../c-api/structures.rst:328 msgid "" "Can only be used in the combination with other flags: :ref:`METH_METHOD | " "METH_FASTCALL | METH_KEYWORDS <METH_METHOD-METH_FASTCALL-METH_KEYWORDS>`." msgstr "" -#: ../../c-api/structures.rst:329 +#: ../../c-api/structures.rst:334 msgid ":c:expr:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS`" msgstr ":c:expr:`METH_METHOD | METH_FASTCALL | METH_KEYWORDS`" -#: ../../c-api/structures.rst:330 +#: ../../c-api/structures.rst:335 msgid "" "Extension of :ref:`METH_FASTCALL | METH_KEYWORDS <METH_FASTCALL-" "METH_KEYWORDS>` supporting the *defining class*, that is, the class that " @@ -414,14 +418,14 @@ msgid "" "``Py_TYPE(self)``." msgstr "" -#: ../../c-api/structures.rst:335 +#: ../../c-api/structures.rst:340 msgid "" "The method needs to be of type :c:type:`PyCMethod`, the same as for " "``METH_FASTCALL | METH_KEYWORDS`` with ``defining_class`` argument added " "after ``self``." msgstr "" -#: ../../c-api/structures.rst:344 +#: ../../c-api/structures.rst:349 msgid "" "Methods without parameters don't need to check whether arguments are given " "if they are listed with the :c:macro:`METH_NOARGS` flag. They need to be of " @@ -430,22 +434,22 @@ msgid "" "the second parameter will be ``NULL``." msgstr "" -#: ../../c-api/structures.rst:350 +#: ../../c-api/structures.rst:355 msgid "" -"The function must have 2 parameters. Since the second parameter is unused, :" -"c:macro:`Py_UNUSED` can be used to prevent a compiler warning." +"The function must have 2 parameters. Since the second parameter is " +"unused, :c:macro:`Py_UNUSED` can be used to prevent a compiler warning." msgstr "" -#: ../../c-api/structures.rst:356 +#: ../../c-api/structures.rst:361 msgid "" -"Methods with a single object argument can be listed with the :c:macro:" -"`METH_O` flag, instead of invoking :c:func:`PyArg_ParseTuple` with a " -"``\"O\"`` argument. They have the type :c:type:`PyCFunction`, with the " -"*self* parameter, and a :c:expr:`PyObject*` parameter representing the " +"Methods with a single object argument can be listed with " +"the :c:macro:`METH_O` flag, instead of invoking :c:func:`PyArg_ParseTuple` " +"with a ``\"O\"`` argument. They have the type :c:type:`PyCFunction`, with " +"the *self* parameter, and a :c:expr:`PyObject*` parameter representing the " "single argument." msgstr "" -#: ../../c-api/structures.rst:362 +#: ../../c-api/structures.rst:367 msgid "" "These two constants are not used to indicate the calling convention but the " "binding when use with methods of classes. These may not be used for " @@ -453,53 +457,53 @@ msgid "" "any given method." msgstr "" -#: ../../c-api/structures.rst:372 +#: ../../c-api/structures.rst:377 msgid "" "The method will be passed the type object as the first parameter rather than " "an instance of the type. This is used to create *class methods*, similar to " "what is created when using the :func:`classmethod` built-in function." msgstr "" -#: ../../c-api/structures.rst:382 +#: ../../c-api/structures.rst:387 msgid "" "The method will be passed ``NULL`` as the first parameter rather than an " "instance of the type. This is used to create *static methods*, similar to " "what is created when using the :func:`staticmethod` built-in function." msgstr "" -#: ../../c-api/structures.rst:386 +#: ../../c-api/structures.rst:391 msgid "" "One other constant controls whether a method is loaded in place of another " "definition with the same method name." msgstr "" -#: ../../c-api/structures.rst:392 +#: ../../c-api/structures.rst:397 msgid "" "The method will be loaded in place of existing definitions. Without " "*METH_COEXIST*, the default is to skip repeated definitions. Since slot " "wrappers are loaded before the method table, the existence of a " -"*sq_contains* slot, for example, would generate a wrapped method named :meth:" -"`~object.__contains__` and preclude the loading of a corresponding " -"PyCFunction with the same name. With the flag defined, the PyCFunction will " -"be loaded in place of the wrapper object and will co-exist with the slot. " -"This is helpful because calls to PyCFunctions are optimized more than " -"wrapper object calls." +"*sq_contains* slot, for example, would generate a wrapped method " +"named :meth:`~object.__contains__` and preclude the loading of a " +"corresponding PyCFunction with the same name. With the flag defined, the " +"PyCFunction will be loaded in place of the wrapper object and will co-exist " +"with the slot. This is helpful because calls to PyCFunctions are optimized " +"more than wrapper object calls." msgstr "" -#: ../../c-api/structures.rst:404 +#: ../../c-api/structures.rst:409 msgid "" "Turn *ml* into a Python :term:`callable` object. The caller must ensure that " "*ml* outlives the :term:`callable`. Typically, *ml* is defined as a static " "variable." msgstr "" -#: ../../c-api/structures.rst:408 +#: ../../c-api/structures.rst:413 msgid "" "The *self* parameter will be passed as the *self* argument to the C function " "in ``ml->ml_meth`` when invoked. *self* can be ``NULL``." msgstr "" -#: ../../c-api/structures.rst:412 +#: ../../c-api/structures.rst:417 msgid "" "The :term:`callable` object's ``__module__`` attribute can be set from the " "given *module* argument. *module* should be a Python string, which will be " @@ -507,89 +511,89 @@ msgid "" "can be set to :const:`None` or ``NULL``." msgstr "" -#: ../../c-api/structures.rst:418 +#: ../../c-api/structures.rst:423 msgid ":attr:`function.__module__`" msgstr ":attr:`function.__module__`" -#: ../../c-api/structures.rst:420 +#: ../../c-api/structures.rst:425 msgid "" "The *cls* parameter will be passed as the *defining_class* argument to the C " "function. Must be set if :c:macro:`METH_METHOD` is set on ``ml->ml_flags``." msgstr "" -#: ../../c-api/structures.rst:429 +#: ../../c-api/structures.rst:434 msgid "Equivalent to ``PyCMethod_New(ml, self, module, NULL)``." msgstr "等價於 ``PyCMethod_New(ml, self, module, NULL)``。" -#: ../../c-api/structures.rst:434 +#: ../../c-api/structures.rst:439 msgid "Equivalent to ``PyCMethod_New(ml, self, NULL, NULL)``." msgstr "等價於 ``PyCMethod_New(ml, self, NULL, NULL)``。" -#: ../../c-api/structures.rst:438 +#: ../../c-api/structures.rst:443 msgid "Accessing attributes of extension types" msgstr "" -#: ../../c-api/structures.rst:442 +#: ../../c-api/structures.rst:447 msgid "" "Structure which describes an attribute of a type which corresponds to a C " "struct member. When defining a class, put a NULL-terminated array of these " "structures in the :c:member:`~PyTypeObject.tp_members` slot." msgstr "" -#: ../../c-api/structures.rst:447 +#: ../../c-api/structures.rst:452 msgid "Its fields are, in order:" msgstr "" -#: ../../c-api/structures.rst:451 +#: ../../c-api/structures.rst:456 msgid "" "Name of the member. A NULL value marks the end of a ``PyMemberDef[]`` array." msgstr "" -#: ../../c-api/structures.rst:454 +#: ../../c-api/structures.rst:459 msgid "The string should be static, no copy is made of it." msgstr "" -#: ../../c-api/structures.rst:458 +#: ../../c-api/structures.rst:463 msgid "" "The type of the member in the C struct. See :ref:`PyMemberDef-types` for the " "possible values." msgstr "" -#: ../../c-api/structures.rst:463 +#: ../../c-api/structures.rst:468 msgid "" "The offset in bytes that the member is located on the type’s object struct." msgstr "" -#: ../../c-api/structures.rst:467 +#: ../../c-api/structures.rst:472 msgid "" "Zero or more of the :ref:`PyMemberDef-flags`, combined using bitwise OR." msgstr "" -#: ../../c-api/structures.rst:471 +#: ../../c-api/structures.rst:476 msgid "" "The docstring, or NULL. The string should be static, no copy is made of it. " "Typically, it is defined using :c:macro:`PyDoc_STR`." msgstr "" -#: ../../c-api/structures.rst:475 +#: ../../c-api/structures.rst:480 msgid "" "By default (when :c:member:`~PyMemberDef.flags` is ``0``), members allow " "both read and write access. Use the :c:macro:`Py_READONLY` flag for read-" -"only access. Certain types, like :c:macro:`Py_T_STRING`, imply :c:macro:" -"`Py_READONLY`. Only :c:macro:`Py_T_OBJECT_EX` (and legacy :c:macro:" -"`T_OBJECT`) members can be deleted." +"only access. Certain types, like :c:macro:`Py_T_STRING`, " +"imply :c:macro:`Py_READONLY`. Only :c:macro:`Py_T_OBJECT_EX` (and " +"legacy :c:macro:`T_OBJECT`) members can be deleted." msgstr "" -#: ../../c-api/structures.rst:484 +#: ../../c-api/structures.rst:489 msgid "" "For heap-allocated types (created using :c:func:`PyType_FromSpec` or " "similar), ``PyMemberDef`` may contain a definition for the special member " -"``\"__vectorcalloffset__\"``, corresponding to :c:member:`~PyTypeObject." -"tp_vectorcall_offset` in type objects. These must be defined with " -"``Py_T_PYSSIZET`` and ``Py_READONLY``, for example::" +"``\"__vectorcalloffset__\"``, corresponding " +"to :c:member:`~PyTypeObject.tp_vectorcall_offset` in type objects. These " +"must be defined with ``Py_T_PYSSIZET`` and ``Py_READONLY``, for example::" msgstr "" -#: ../../c-api/structures.rst:490 +#: ../../c-api/structures.rst:495 msgid "" "static PyMemberDef spam_type_members[] = {\n" " {\"__vectorcalloffset__\", Py_T_PYSSIZET,\n" @@ -603,90 +607,92 @@ msgstr "" " {NULL} /* Sentinel */\n" "};" -#: ../../c-api/structures.rst:496 +#: ../../c-api/structures.rst:501 msgid "(You may need to ``#include <stddef.h>`` for :c:func:`!offsetof`.)" msgstr "" -#: ../../c-api/structures.rst:498 +#: ../../c-api/structures.rst:503 msgid "" -"The legacy offsets :c:member:`~PyTypeObject.tp_dictoffset` and :c:member:" -"`~PyTypeObject.tp_weaklistoffset` can be defined similarly using " -"``\"__dictoffset__\"`` and ``\"__weaklistoffset__\"`` members, but " +"The legacy offsets :c:member:`~PyTypeObject.tp_dictoffset` " +"and :c:member:`~PyTypeObject.tp_weaklistoffset` can be defined similarly " +"using ``\"__dictoffset__\"`` and ``\"__weaklistoffset__\"`` members, but " "extensions are strongly encouraged to use :c:macro:`Py_TPFLAGS_MANAGED_DICT` " "and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead." msgstr "" -#: ../../c-api/structures.rst:506 +#: ../../c-api/structures.rst:511 msgid "" "``PyMemberDef`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" -#: ../../c-api/structures.rst:511 +#: ../../c-api/structures.rst:516 msgid "" "Get an attribute belonging to the object at address *obj_addr*. The " "attribute is described by ``PyMemberDef`` *m*. Returns ``NULL`` on error." msgstr "" -#: ../../c-api/structures.rst:517 +#: ../../c-api/structures.rst:522 msgid "" "``PyMember_GetOne`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" -#: ../../c-api/structures.rst:522 +#: ../../c-api/structures.rst:527 msgid "" "Set an attribute belonging to the object at address *obj_addr* to object " "*o*. The attribute to set is described by ``PyMemberDef`` *m*. Returns " "``0`` if successful and a negative value on failure." msgstr "" -#: ../../c-api/structures.rst:528 +#: ../../c-api/structures.rst:533 msgid "" "``PyMember_SetOne`` is always available. Previously, it required including " "``\"structmember.h\"``." msgstr "" -#: ../../c-api/structures.rst:534 +#: ../../c-api/structures.rst:539 msgid "Member flags" msgstr "" -#: ../../c-api/structures.rst:536 +#: ../../c-api/structures.rst:541 msgid "The following flags can be used with :c:member:`PyMemberDef.flags`:" msgstr "" -#: ../../c-api/structures.rst:540 +#: ../../c-api/structures.rst:545 msgid "Not writable." msgstr "不可寫入。" -#: ../../c-api/structures.rst:544 +#: ../../c-api/structures.rst:549 msgid "" "Emit an ``object.__getattr__`` :ref:`audit event <audit-events>` before " "reading." msgstr "" -#: ../../c-api/structures.rst:549 +#: ../../c-api/structures.rst:554 msgid "" "Indicates that the :c:member:`~PyMemberDef.offset` of this ``PyMemberDef`` " "entry indicates an offset from the subclass-specific data, rather than from " "``PyObject``." msgstr "" -#: ../../c-api/structures.rst:553 +#: ../../c-api/structures.rst:558 msgid "" -"Can only be used as part of :c:member:`Py_tp_members <PyTypeObject." -"tp_members>` :c:type:`slot <PyType_Slot>` when creating a class using " -"negative :c:member:`~PyType_Spec.basicsize`. It is mandatory in that case." +"Can only be used as part of :c:member:`Py_tp_members " +"<PyTypeObject.tp_members>` :c:type:`slot <PyType_Slot>` when creating a " +"class using negative :c:member:`~PyType_Spec.basicsize`. It is mandatory in " +"that case." msgstr "" -#: ../../c-api/structures.rst:558 +#: ../../c-api/structures.rst:563 msgid "" -"This flag is only used in :c:type:`PyType_Slot`. When setting :c:member:" -"`~PyTypeObject.tp_members` during class creation, Python clears it and sets :" -"c:member:`PyMemberDef.offset` to the offset from the ``PyObject`` struct." +"This flag is only used in :c:type:`PyType_Slot`. When " +"setting :c:member:`~PyTypeObject.tp_members` during class creation, Python " +"clears it and sets :c:member:`PyMemberDef.offset` to the offset from the " +"``PyObject`` struct." msgstr "" -#: ../../c-api/structures.rst:570 +#: ../../c-api/structures.rst:575 msgid "" "The :c:macro:`!RESTRICTED`, :c:macro:`!READ_RESTRICTED` and :c:macro:`!" "WRITE_RESTRICTED` macros available with ``#include \"structmember.h\"`` are " @@ -695,20 +701,20 @@ msgid "" "nothing." msgstr "" -#: ../../c-api/structures.rst:581 +#: ../../c-api/structures.rst:586 msgid "" -"The :c:macro:`!READONLY` macro was renamed to :c:macro:`Py_READONLY`. The :c:" -"macro:`!PY_AUDIT_READ` macro was renamed with the ``Py_`` prefix. The new " -"names are now always available. Previously, these required ``#include " +"The :c:macro:`!READONLY` macro was renamed to :c:macro:`Py_READONLY`. " +"The :c:macro:`!PY_AUDIT_READ` macro was renamed with the ``Py_`` prefix. The " +"new names are now always available. Previously, these required ``#include " "\"structmember.h\"``. The header is still available and it provides the old " "names." msgstr "" -#: ../../c-api/structures.rst:590 +#: ../../c-api/structures.rst:595 msgid "Member types" msgstr "" -#: ../../c-api/structures.rst:592 +#: ../../c-api/structures.rst:597 msgid "" ":c:member:`PyMemberDef.type` can be one of the following macros " "corresponding to various C types. When the member is accessed in Python, it " @@ -717,147 +723,147 @@ msgid "" "exception such as :exc:`TypeError` or :exc:`ValueError` is raised." msgstr "" -#: ../../c-api/structures.rst:600 +#: ../../c-api/structures.rst:605 msgid "" -"Unless marked (D), attributes defined this way cannot be deleted using e.g. :" -"keyword:`del` or :py:func:`delattr`." +"Unless marked (D), attributes defined this way cannot be deleted using " +"e.g. :keyword:`del` or :py:func:`delattr`." msgstr "" -#: ../../c-api/structures.rst:604 +#: ../../c-api/structures.rst:609 msgid "Macro name" msgstr "巨集名稱" -#: ../../c-api/structures.rst:604 +#: ../../c-api/structures.rst:609 msgid "C type" msgstr "" -#: ../../c-api/structures.rst:604 +#: ../../c-api/structures.rst:609 msgid "Python type" msgstr "" -#: ../../c-api/structures.rst:606 +#: ../../c-api/structures.rst:611 msgid ":c:expr:`char`" msgstr ":c:expr:`char`" -#: ../../c-api/structures.rst:606 ../../c-api/structures.rst:607 -#: ../../c-api/structures.rst:608 ../../c-api/structures.rst:609 -#: ../../c-api/structures.rst:610 ../../c-api/structures.rst:611 -#: ../../c-api/structures.rst:612 ../../c-api/structures.rst:613 -#: ../../c-api/structures.rst:614 ../../c-api/structures.rst:615 -#: ../../c-api/structures.rst:616 +#: ../../c-api/structures.rst:611 ../../c-api/structures.rst:612 +#: ../../c-api/structures.rst:613 ../../c-api/structures.rst:614 +#: ../../c-api/structures.rst:615 ../../c-api/structures.rst:616 +#: ../../c-api/structures.rst:617 ../../c-api/structures.rst:618 +#: ../../c-api/structures.rst:619 ../../c-api/structures.rst:620 +#: ../../c-api/structures.rst:621 msgid ":py:class:`int`" msgstr ":py:class:`int`" -#: ../../c-api/structures.rst:607 +#: ../../c-api/structures.rst:612 msgid ":c:expr:`short`" msgstr ":c:expr:`short`" -#: ../../c-api/structures.rst:608 +#: ../../c-api/structures.rst:613 msgid ":c:expr:`int`" msgstr ":c:expr:`int`" -#: ../../c-api/structures.rst:609 +#: ../../c-api/structures.rst:614 msgid ":c:expr:`long`" msgstr ":c:expr:`long`" -#: ../../c-api/structures.rst:610 +#: ../../c-api/structures.rst:615 msgid ":c:expr:`long long`" msgstr ":c:expr:`long long`" -#: ../../c-api/structures.rst:611 +#: ../../c-api/structures.rst:616 msgid ":c:expr:`unsigned char`" msgstr ":c:expr:`unsigned char`" -#: ../../c-api/structures.rst:612 +#: ../../c-api/structures.rst:617 msgid ":c:expr:`unsigned int`" msgstr ":c:expr:`unsigned int`" -#: ../../c-api/structures.rst:613 +#: ../../c-api/structures.rst:618 msgid ":c:expr:`unsigned short`" msgstr ":c:expr:`unsigned short`" -#: ../../c-api/structures.rst:614 +#: ../../c-api/structures.rst:619 msgid ":c:expr:`unsigned long`" msgstr ":c:expr:`unsigned long`" -#: ../../c-api/structures.rst:615 +#: ../../c-api/structures.rst:620 msgid ":c:expr:`unsigned long long`" msgstr ":c:expr:`unsigned long long`" -#: ../../c-api/structures.rst:616 +#: ../../c-api/structures.rst:621 msgid ":c:expr:`Py_ssize_t`" msgstr ":c:expr:`Py_ssize_t`" -#: ../../c-api/structures.rst:617 +#: ../../c-api/structures.rst:622 msgid ":c:expr:`float`" msgstr ":c:expr:`float`" -#: ../../c-api/structures.rst:617 ../../c-api/structures.rst:618 +#: ../../c-api/structures.rst:622 ../../c-api/structures.rst:623 msgid ":py:class:`float`" msgstr ":py:class:`float`" -#: ../../c-api/structures.rst:618 +#: ../../c-api/structures.rst:623 msgid ":c:expr:`double`" msgstr ":c:expr:`double`" -#: ../../c-api/structures.rst:619 +#: ../../c-api/structures.rst:624 msgid ":c:expr:`char` (written as 0 or 1)" msgstr ":c:expr:`char` (寫成 0 或 1)" -#: ../../c-api/structures.rst:619 +#: ../../c-api/structures.rst:624 msgid ":py:class:`bool`" msgstr ":py:class:`bool`" -#: ../../c-api/structures.rst:621 +#: ../../c-api/structures.rst:626 msgid ":c:expr:`const char *` (*)" msgstr ":c:expr:`const char *` (*)" -#: ../../c-api/structures.rst:621 ../../c-api/structures.rst:622 +#: ../../c-api/structures.rst:626 ../../c-api/structures.rst:627 msgid ":py:class:`str` (RO)" msgstr ":py:class:`str` (RO)" -#: ../../c-api/structures.rst:622 +#: ../../c-api/structures.rst:627 msgid ":c:expr:`const char[]` (*)" msgstr ":c:expr:`const char[]` (*)" -#: ../../c-api/structures.rst:623 +#: ../../c-api/structures.rst:628 msgid ":c:expr:`char` (0-127)" msgstr ":c:expr:`char` (0-127)" -#: ../../c-api/structures.rst:623 +#: ../../c-api/structures.rst:628 msgid ":py:class:`str` (**)" msgstr ":py:class:`str` (**)" -#: ../../c-api/structures.rst:624 +#: ../../c-api/structures.rst:629 msgid ":c:expr:`PyObject *`" msgstr ":c:expr:`PyObject *`" -#: ../../c-api/structures.rst:624 +#: ../../c-api/structures.rst:629 msgid ":py:class:`object` (D)" msgstr ":py:class:`object` (D)" -#: ../../c-api/structures.rst:627 +#: ../../c-api/structures.rst:632 msgid "" "(*): Zero-terminated, UTF8-encoded C string. With :c:macro:`!Py_T_STRING` " "the C representation is a pointer; with :c:macro:`!Py_T_STRING_INPLACE` the " "string is stored directly in the structure." msgstr "" -#: ../../c-api/structures.rst:632 +#: ../../c-api/structures.rst:637 msgid "(**): String of length 1. Only ASCII is accepted." msgstr "" -#: ../../c-api/structures.rst:634 +#: ../../c-api/structures.rst:639 msgid "(RO): Implies :c:macro:`Py_READONLY`." msgstr "" -#: ../../c-api/structures.rst:636 +#: ../../c-api/structures.rst:641 msgid "" "(D): Can be deleted, in which case the pointer is set to ``NULL``. Reading a " "``NULL`` pointer raises :py:exc:`AttributeError`." msgstr "" -#: ../../c-api/structures.rst:662 +#: ../../c-api/structures.rst:667 msgid "" "In previous versions, the macros were only available with ``#include " "\"structmember.h\"`` and were named without the ``Py_`` prefix (e.g. as " @@ -865,174 +871,174 @@ msgid "" "with the following deprecated types:" msgstr "" -#: ../../c-api/structures.rst:670 +#: ../../c-api/structures.rst:675 msgid "" "Like ``Py_T_OBJECT_EX``, but ``NULL`` is converted to ``None``. This results " "in surprising behavior in Python: deleting the attribute effectively sets it " "to ``None``." msgstr "" -#: ../../c-api/structures.rst:676 +#: ../../c-api/structures.rst:681 msgid "Always ``None``. Must be used with :c:macro:`Py_READONLY`." msgstr "" -#: ../../c-api/structures.rst:679 +#: ../../c-api/structures.rst:684 msgid "Defining Getters and Setters" msgstr "" -#: ../../c-api/structures.rst:683 +#: ../../c-api/structures.rst:688 msgid "" "Structure to define property-like access for a type. See also description of " "the :c:member:`PyTypeObject.tp_getset` slot." msgstr "" -#: ../../c-api/structures.rst:688 +#: ../../c-api/structures.rst:693 msgid "attribute name" msgstr "屬性名稱" -#: ../../c-api/structures.rst:692 +#: ../../c-api/structures.rst:697 msgid "C function to get the attribute." msgstr "" -#: ../../c-api/structures.rst:696 +#: ../../c-api/structures.rst:701 msgid "" "Optional C function to set or delete the attribute. If ``NULL``, the " "attribute is read-only." msgstr "" -#: ../../c-api/structures.rst:701 +#: ../../c-api/structures.rst:706 msgid "optional docstring" msgstr "可選的文件字串" -#: ../../c-api/structures.rst:705 +#: ../../c-api/structures.rst:710 msgid "" "Optional user data pointer, providing additional data for getter and setter." msgstr "" -#: ../../c-api/structures.rst:709 +#: ../../c-api/structures.rst:714 msgid "" "The ``get`` function takes one :c:expr:`PyObject*` parameter (the instance) " "and a user data pointer (the associated ``closure``):" msgstr "" -#: ../../c-api/structures.rst:712 +#: ../../c-api/structures.rst:717 msgid "" "It should return a new reference on success or ``NULL`` with a set exception " "on failure." msgstr "" -#: ../../c-api/structures.rst:717 +#: ../../c-api/structures.rst:722 msgid "" "``set`` functions take two :c:expr:`PyObject*` parameters (the instance and " "the value to be set) and a user data pointer (the associated ``closure``):" msgstr "" -#: ../../c-api/structures.rst:720 +#: ../../c-api/structures.rst:725 msgid "" "In case the attribute should be deleted the second parameter is ``NULL``. " "Should return ``0`` on success or ``-1`` with a set exception on failure." msgstr "" -#: ../../c-api/structures.rst:370 ../../c-api/structures.rst:380 +#: ../../c-api/structures.rst:375 ../../c-api/structures.rst:385 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/structures.rst:370 +#: ../../c-api/structures.rst:375 msgid "classmethod" msgstr "classmethod" -#: ../../c-api/structures.rst:380 +#: ../../c-api/structures.rst:385 msgid "staticmethod" msgstr "staticmethod" -#: ../../c-api/structures.rst:563 +#: ../../c-api/structures.rst:568 msgid "READ_RESTRICTED (C macro)" msgstr "READ_RESTRICTED(C 巨集)" -#: ../../c-api/structures.rst:563 +#: ../../c-api/structures.rst:568 msgid "WRITE_RESTRICTED (C macro)" msgstr "WRITE_RESTRICTED(C 巨集)" -#: ../../c-api/structures.rst:563 +#: ../../c-api/structures.rst:568 msgid "RESTRICTED (C macro)" msgstr "RESTRICTED(C 巨集)" -#: ../../c-api/structures.rst:576 +#: ../../c-api/structures.rst:581 msgid "READONLY (C macro)" msgstr "READONLY(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_BYTE (C macro)" msgstr "T_BYTE(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_SHORT (C macro)" msgstr "T_SHORT(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_INT (C macro)" msgstr "T_INT(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_LONG (C macro)" msgstr "T_LONG(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_LONGLONG (C macro)" msgstr "T_LONGLONG(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_UBYTE (C macro)" msgstr "T_UBYTE(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_USHORT (C macro)" msgstr "T_USHORT(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_UINT (C macro)" msgstr "T_UINT(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_ULONG (C macro)" msgstr "T_ULONG(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_ULONGULONG (C macro)" msgstr "T_ULONGULONG(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_PYSSIZET (C macro)" msgstr "T_PYSSIZET(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_FLOAT (C macro)" msgstr "T_FLOAT(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_DOUBLE (C macro)" msgstr "T_DOUBLE(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_BOOL (C macro)" msgstr "T_BOOL(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_CHAR (C macro)" msgstr "T_CHAR(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_STRING (C macro)" msgstr "T_STRING(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_STRING_INPLACE (C macro)" msgstr "T_STRING_INPLACE(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "T_OBJECT_EX (C macro)" msgstr "T_OBJECT_EX(C 巨集)" -#: ../../c-api/structures.rst:639 +#: ../../c-api/structures.rst:644 msgid "structmember.h" msgstr "structmember.h" diff --git a/c-api/tuple.po b/c-api/tuple.po index 0392e13819..d70d49e967 100644 --- a/c-api/tuple.po +++ b/c-api/tuple.po @@ -72,16 +72,16 @@ msgstr "" #: ../../c-api/tuple.rst:61 msgid "" "Return the object at position *pos* in the tuple pointed to by *p*. If " -"*pos* is negative or out of bounds, return ``NULL`` and set an :exc:" -"`IndexError` exception." +"*pos* is negative or out of bounds, return ``NULL`` and set " +"an :exc:`IndexError` exception." msgstr "" #: ../../c-api/tuple.rst:64 msgid "" "The returned reference is borrowed from the tuple *p* (that is: it is only " "valid as long as you hold a reference to *p*). To get a :term:`strong " -"reference`, use :c:func:`Py_NewRef(PyTuple_GetItem(...)) <Py_NewRef>` or :c:" -"func:`PySequence_GetItem`." +"reference`, use :c:func:`Py_NewRef(PyTuple_GetItem(...)) <Py_NewRef>` " +"or :c:func:`PySequence_GetItem`." msgstr "" #: ../../c-api/tuple.rst:73 @@ -122,15 +122,17 @@ msgstr "" #: ../../c-api/tuple.rst:102 ../../c-api/tuple.rst:218 #: ../../c-api/tuple.rst:236 msgid "" -"Bounds checking is performed as an assertion if Python is built in :ref:" -"`debug mode <debug-build>` or :option:`with assertions <--with-assertions>`." +"Bounds checking is performed as an assertion if Python is built " +"in :ref:`debug mode <debug-build>` or :option:`with assertions <--with-" +"assertions>`." msgstr "" #: ../../c-api/tuple.rst:107 msgid "" -"This function \"steals\" a reference to *o*, and, unlike :c:func:" -"`PyTuple_SetItem`, does *not* discard a reference to any item that is being " -"replaced; any reference in the tuple at position *pos* will be leaked." +"This function \"steals\" a reference to *o*, and, " +"unlike :c:func:`PyTuple_SetItem`, does *not* discard a reference to any item " +"that is being replaced; any reference in the tuple at position *pos* will be " +"leaked." msgstr "" #: ../../c-api/tuple.rst:115 @@ -144,8 +146,8 @@ msgid "" "Client code should never assume that the resulting value of ``*p`` will be " "the same as before calling this function. If the object referenced by ``*p`` " "is replaced, the original ``*p`` is destroyed. On failure, returns ``-1`` " -"and sets ``*p`` to ``NULL``, and raises :exc:`MemoryError` or :exc:" -"`SystemError`." +"and sets ``*p`` to ``NULL``, and raises :exc:`MemoryError` " +"or :exc:`SystemError`." msgstr "" #: ../../c-api/tuple.rst:130 @@ -154,22 +156,22 @@ msgstr "" #: ../../c-api/tuple.rst:132 msgid "" -"Struct sequence objects are the C equivalent of :func:`~collections." -"namedtuple` objects, i.e. a sequence whose items can also be accessed " -"through attributes. To create a struct sequence, you first have to create a " -"specific struct sequence type." +"Struct sequence objects are the C equivalent " +"of :func:`~collections.namedtuple` objects, i.e. a sequence whose items can " +"also be accessed through attributes. To create a struct sequence, you first " +"have to create a specific struct sequence type." msgstr "" #: ../../c-api/tuple.rst:139 msgid "" "Create a new struct sequence type from the data in *desc*, described below. " -"Instances of the resulting type can be created with :c:func:" -"`PyStructSequence_New`." +"Instances of the resulting type can be created " +"with :c:func:`PyStructSequence_New`." msgstr "" #: ../../c-api/tuple.rst:142 ../../c-api/tuple.rst:211 msgid "Return ``NULL`` with an exception set on failure." -msgstr "" +msgstr "失敗時回傳 ``NULL`` 並設定例外。" #: ../../c-api/tuple.rst:147 msgid "Initializes a struct sequence type *type* from *desc* in place." @@ -206,16 +208,16 @@ msgstr "" #: ../../c-api/tuple.rst:182 msgid "" "Describes a field of a struct sequence. As a struct sequence is modeled as a " -"tuple, all fields are typed as :c:expr:`PyObject*`. The index in the :c:" -"member:`~PyStructSequence_Desc.fields` array of the :c:type:" -"`PyStructSequence_Desc` determines which field of the struct sequence is " -"described." +"tuple, all fields are typed as :c:expr:`PyObject*`. The index in " +"the :c:member:`~PyStructSequence_Desc.fields` array of " +"the :c:type:`PyStructSequence_Desc` determines which field of the struct " +"sequence is described." msgstr "" #: ../../c-api/tuple.rst:190 msgid "" -"Name for the field or ``NULL`` to end the list of named fields, set to :c:" -"data:`PyStructSequence_UnnamedField` to leave unnamed." +"Name for the field or ``NULL`` to end the list of named fields, set " +"to :c:data:`PyStructSequence_UnnamedField` to leave unnamed." msgstr "" #: ../../c-api/tuple.rst:195 @@ -232,8 +234,8 @@ msgstr "" #: ../../c-api/tuple.rst:208 msgid "" -"Creates an instance of *type*, which must have been created with :c:func:" -"`PyStructSequence_NewType`." +"Creates an instance of *type*, which must have been created " +"with :c:func:`PyStructSequence_NewType`." msgstr "" #: ../../c-api/tuple.rst:216 diff --git a/c-api/type.po b/c-api/type.po index 570d06ce19..0ff3fc423c 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-01 15:01+0000\n" +"POT-Creation-Date: 2025-04-03 00:14+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -98,21 +98,27 @@ msgid "" "exception." msgstr "" -#: ../../c-api/type.rst:90 +#: ../../c-api/type.rst:85 +msgid "" +"In free-threaded builds, :c:func:`PyType_AddWatcher` is not thread-safe, so " +"it must be called at start up (before spawning the first thread)." +msgstr "" + +#: ../../c-api/type.rst:93 msgid "" "Clear watcher identified by *watcher_id* (previously returned from :c:func:" "`PyType_AddWatcher`). Return ``0`` on success, ``-1`` on error (e.g. if " "*watcher_id* was never registered.)" msgstr "" -#: ../../c-api/type.rst:94 +#: ../../c-api/type.rst:97 msgid "" "An extension should never call ``PyType_ClearWatcher`` with a *watcher_id* " "that was not returned to it by a previous call to :c:func:" "`PyType_AddWatcher`." msgstr "" -#: ../../c-api/type.rst:103 +#: ../../c-api/type.rst:106 msgid "" "Mark *type* as watched. The callback granted *watcher_id* by :c:func:" "`PyType_AddWatcher` will be called whenever :c:func:`PyType_Modified` " @@ -122,61 +128,61 @@ msgid "" "detail and subject to change.)" msgstr "" -#: ../../c-api/type.rst:110 +#: ../../c-api/type.rst:113 msgid "" "An extension should never call ``PyType_Watch`` with a *watcher_id* that was " "not returned to it by a previous call to :c:func:`PyType_AddWatcher`." msgstr "" -#: ../../c-api/type.rst:118 +#: ../../c-api/type.rst:121 msgid "Type of a type-watcher callback function." msgstr "" -#: ../../c-api/type.rst:120 +#: ../../c-api/type.rst:123 msgid "" "The callback must not modify *type* or cause :c:func:`PyType_Modified` to be " "called on *type* or any type in its MRO; violating this rule could cause " "infinite recursion." msgstr "" -#: ../../c-api/type.rst:129 +#: ../../c-api/type.rst:132 msgid "" "Return non-zero if the type object *o* sets the feature *feature*. Type " "features are denoted by single bit flags." msgstr "" -#: ../../c-api/type.rst:135 +#: ../../c-api/type.rst:138 msgid "" "Return true if the type object includes support for the cycle detector; this " "tests the type flag :c:macro:`Py_TPFLAGS_HAVE_GC`." msgstr "" -#: ../../c-api/type.rst:141 +#: ../../c-api/type.rst:144 msgid "Return true if *a* is a subtype of *b*." msgstr "" -#: ../../c-api/type.rst:143 +#: ../../c-api/type.rst:146 msgid "" "This function only checks for actual subtypes, which means that :meth:`~type." "__subclasscheck__` is not called on *b*. Call :c:func:`PyObject_IsSubclass` " "to do the same check that :func:`issubclass` would do." msgstr "" -#: ../../c-api/type.rst:151 +#: ../../c-api/type.rst:154 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_alloc` slot of a type " "object. Use Python's default memory allocation mechanism to allocate a new " "instance and initialize all its contents to ``NULL``." msgstr "" -#: ../../c-api/type.rst:157 +#: ../../c-api/type.rst:160 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_new` slot of a type " "object. Create a new instance using the type's :c:member:`~PyTypeObject." "tp_alloc` slot." msgstr "" -#: ../../c-api/type.rst:162 +#: ../../c-api/type.rst:165 msgid "" "Finalize a type object. This should be called on all type objects to finish " "their initialization. This function is responsible for adding inherited " @@ -184,7 +190,7 @@ msgid "" "and sets an exception on error." msgstr "" -#: ../../c-api/type.rst:168 +#: ../../c-api/type.rst:171 msgid "" "If some of the base classes implements the GC protocol and the provided type " "does not include the :c:macro:`Py_TPFLAGS_HAVE_GC` in its flags, then the GC " @@ -195,32 +201,32 @@ msgid "" "handle." msgstr "" -#: ../../c-api/type.rst:178 +#: ../../c-api/type.rst:181 msgid "" "Return the type's name. Equivalent to getting the type's :attr:`~type." "__name__` attribute." msgstr "" -#: ../../c-api/type.rst:185 +#: ../../c-api/type.rst:188 msgid "" "Return the type's qualified name. Equivalent to getting the type's :attr:" "`~type.__qualname__` attribute." msgstr "" -#: ../../c-api/type.rst:192 +#: ../../c-api/type.rst:195 msgid "" "Return the type's fully qualified name. Equivalent to ``f\"{type.__module__}." "{type.__qualname__}\"``, or :attr:`type.__qualname__` if :attr:`type." "__module__` is not a string or is equal to ``\"builtins\"``." msgstr "" -#: ../../c-api/type.rst:200 +#: ../../c-api/type.rst:203 msgid "" "Return the type's module name. Equivalent to getting the :attr:`type." "__module__` attribute." msgstr "" -#: ../../c-api/type.rst:207 +#: ../../c-api/type.rst:210 msgid "" "Return the function pointer stored in the given slot. If the result is " "``NULL``, this indicates that either the slot is ``NULL``, or that the " @@ -228,30 +234,30 @@ msgid "" "result pointer into the appropriate function type." msgstr "" -#: ../../c-api/type.rst:213 +#: ../../c-api/type.rst:216 msgid "" "See :c:member:`PyType_Slot.slot` for possible values of the *slot* argument." msgstr "" -#: ../../c-api/type.rst:217 +#: ../../c-api/type.rst:220 msgid "" ":c:func:`PyType_GetSlot` can now accept all types. Previously, it was " "limited to :ref:`heap types <heap-types>`." msgstr "" -#: ../../c-api/type.rst:223 +#: ../../c-api/type.rst:226 msgid "" "Return the module object associated with the given type when the type was " "created using :c:func:`PyType_FromModuleAndSpec`." msgstr "" -#: ../../c-api/type.rst:226 ../../c-api/type.rst:246 +#: ../../c-api/type.rst:229 ../../c-api/type.rst:249 msgid "" "If no module is associated with the given type, sets :py:class:`TypeError` " "and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:229 +#: ../../c-api/type.rst:232 msgid "" "This function is usually used to get the module in which a method is " "defined. Note that in such a method, ``PyType_GetModule(Py_TYPE(self))`` may " @@ -262,31 +268,31 @@ msgid "" "type:`!PyCMethod` cannot be used." msgstr "" -#: ../../c-api/type.rst:242 +#: ../../c-api/type.rst:245 msgid "" "Return the state of the module object associated with the given type. This " "is a shortcut for calling :c:func:`PyModule_GetState()` on the result of :c:" "func:`PyType_GetModule`." msgstr "" -#: ../../c-api/type.rst:249 +#: ../../c-api/type.rst:252 msgid "" "If the *type* has an associated module but its state is ``NULL``, returns " "``NULL`` without setting an exception." msgstr "" -#: ../../c-api/type.rst:256 +#: ../../c-api/type.rst:259 msgid "" "Find the first superclass whose module was created from the given :c:type:" "`PyModuleDef` *def*, and return that module." msgstr "" -#: ../../c-api/type.rst:259 +#: ../../c-api/type.rst:262 msgid "" "If no module is found, raises a :py:class:`TypeError` and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:261 +#: ../../c-api/type.rst:264 msgid "" "This function is intended to be used together with :c:func:" "`PyModule_GetState()` to get module state from slot methods (such as :c:" @@ -295,40 +301,40 @@ msgid "" "type:`PyCMethod` calling convention." msgstr "" -#: ../../c-api/type.rst:271 +#: ../../c-api/type.rst:274 msgid "Attempt to assign a version tag to the given type." msgstr "" -#: ../../c-api/type.rst:273 +#: ../../c-api/type.rst:276 msgid "" "Returns 1 if the type already had a valid version tag or a new one was " "assigned, or 0 if a new tag could not be assigned." msgstr "" -#: ../../c-api/type.rst:280 +#: ../../c-api/type.rst:283 msgid "Creating Heap-Allocated Types" msgstr "" -#: ../../c-api/type.rst:282 +#: ../../c-api/type.rst:285 msgid "" "The following functions and structs are used to create :ref:`heap types " "<heap-types>`." msgstr "" -#: ../../c-api/type.rst:287 +#: ../../c-api/type.rst:290 msgid "" "Create and return a :ref:`heap type <heap-types>` from the *spec* (see :c:" "macro:`Py_TPFLAGS_HEAPTYPE`)." msgstr "" -#: ../../c-api/type.rst:290 +#: ../../c-api/type.rst:293 msgid "" "The metaclass *metaclass* is used to construct the resulting type object. " "When *metaclass* is ``NULL``, the metaclass is derived from *bases* (or " "*Py_tp_base[s]* slots if *bases* is ``NULL``, see below)." msgstr "" -#: ../../c-api/type.rst:294 +#: ../../c-api/type.rst:297 msgid "" "Metaclasses that override :c:member:`~PyTypeObject.tp_new` are not " "supported, except if ``tp_new`` is ``NULL``. (For backwards compatibility, " @@ -337,7 +343,7 @@ msgid "" "deprecated and in Python 3.14+ such metaclasses will not be supported.)" msgstr "" -#: ../../c-api/type.rst:301 +#: ../../c-api/type.rst:304 msgid "" "The *bases* argument can be used to specify base classes; it can either be " "only one class or a tuple of classes. If *bases* is ``NULL``, the " @@ -346,7 +352,7 @@ msgid "" "derives from :class:`object`." msgstr "" -#: ../../c-api/type.rst:307 +#: ../../c-api/type.rst:310 msgid "" "The *module* argument can be used to record the module in which the new " "class is defined. It must be a module object or ``NULL``. If not ``NULL``, " @@ -355,11 +361,11 @@ msgid "" "subclasses; it must be specified for each class individually." msgstr "" -#: ../../c-api/type.rst:314 +#: ../../c-api/type.rst:317 msgid "This function calls :c:func:`PyType_Ready` on the new type." msgstr "" -#: ../../c-api/type.rst:316 +#: ../../c-api/type.rst:319 msgid "" "Note that this function does *not* fully match the behavior of calling :py:" "class:`type() <type>` or using the :keyword:`class` statement. With user-" @@ -368,41 +374,41 @@ msgid "" "Specifically:" msgstr "" -#: ../../c-api/type.rst:323 +#: ../../c-api/type.rst:326 msgid "" ":py:meth:`~object.__new__` is not called on the new class (and it must be " "set to ``type.__new__``)." msgstr "" -#: ../../c-api/type.rst:325 +#: ../../c-api/type.rst:328 msgid ":py:meth:`~object.__init__` is not called on the new class." msgstr "" -#: ../../c-api/type.rst:326 +#: ../../c-api/type.rst:329 msgid ":py:meth:`~object.__init_subclass__` is not called on any bases." msgstr "" -#: ../../c-api/type.rst:327 +#: ../../c-api/type.rst:330 msgid ":py:meth:`~object.__set_name__` is not called on new descriptors." msgstr "" -#: ../../c-api/type.rst:333 +#: ../../c-api/type.rst:336 msgid "Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, module, spec, bases)``。" -#: ../../c-api/type.rst:339 +#: ../../c-api/type.rst:342 msgid "" "The function now accepts a single class as the *bases* argument and ``NULL`` " "as the ``tp_doc`` slot." msgstr "" -#: ../../c-api/type.rst:344 ../../c-api/type.rst:361 +#: ../../c-api/type.rst:347 ../../c-api/type.rst:364 msgid "" "The function now finds and uses a metaclass corresponding to the provided " "base classes. Previously, only :class:`type` instances were returned." msgstr "" -#: ../../c-api/type.rst:347 ../../c-api/type.rst:364 ../../c-api/type.rst:380 +#: ../../c-api/type.rst:350 ../../c-api/type.rst:367 ../../c-api/type.rst:383 msgid "" "The :c:member:`~PyTypeObject.tp_new` of the metaclass is *ignored*. which " "may result in incomplete initialization. Creating classes whose metaclass " @@ -410,60 +416,62 @@ msgid "" "it will be no longer allowed." msgstr "" -#: ../../c-api/type.rst:355 +#: ../../c-api/type.rst:358 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, bases)``。" -#: ../../c-api/type.rst:372 +#: ../../c-api/type.rst:375 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``。" -#: ../../c-api/type.rst:376 +#: ../../c-api/type.rst:379 msgid "" "The function now finds and uses a metaclass corresponding to the base " "classes provided in *Py_tp_base[s]* slots. Previously, only :class:`type` " "instances were returned." msgstr "" -#: ../../c-api/type.rst:397 +#: ../../c-api/type.rst:400 msgid "Structure defining a type's behavior." msgstr "" -#: ../../c-api/type.rst:401 +#: ../../c-api/type.rst:404 msgid "Name of the type, used to set :c:member:`PyTypeObject.tp_name`." msgstr "" -#: ../../c-api/type.rst:405 +#: ../../c-api/type.rst:408 msgid "" "If positive, specifies the size of the instance in bytes. It is used to set :" "c:member:`PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/type.rst:408 +#: ../../c-api/type.rst:411 msgid "" "If zero, specifies that :c:member:`~PyTypeObject.tp_basicsize` should be " "inherited." msgstr "" -#: ../../c-api/type.rst:411 +#: ../../c-api/type.rst:414 msgid "" "If negative, the absolute value specifies how much space instances of the " "class need *in addition* to the superclass. Use :c:func:" "`PyObject_GetTypeData` to get a pointer to subclass-specific memory reserved " -"this way." +"this way. For negative :c:member:`!basicsize`, Python will insert padding " +"when needed to meet :c:member:`~PyTypeObject.tp_basicsize`'s alignment " +"requirements." msgstr "" -#: ../../c-api/type.rst:418 +#: ../../c-api/type.rst:424 msgid "Previously, this field could not be negative." msgstr "" -#: ../../c-api/type.rst:422 +#: ../../c-api/type.rst:428 msgid "" "Size of one element of a variable-size type, in bytes. Used to set :c:member:" "`PyTypeObject.tp_itemsize`. See ``tp_itemsize`` documentation for caveats." msgstr "" -#: ../../c-api/type.rst:426 +#: ../../c-api/type.rst:432 msgid "" "If zero, :c:member:`~PyTypeObject.tp_itemsize` is inherited. Extending " "arbitrary variable-sized classes is dangerous, since some types use a fixed " @@ -472,58 +480,58 @@ msgid "" "only possible in the following situations:" msgstr "" -#: ../../c-api/type.rst:433 +#: ../../c-api/type.rst:439 msgid "" "The base is not variable-sized (its :c:member:`~PyTypeObject.tp_itemsize`)." msgstr "" -#: ../../c-api/type.rst:435 +#: ../../c-api/type.rst:441 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is positive, suggesting that " "the memory layout of the base class is known." msgstr "" -#: ../../c-api/type.rst:437 +#: ../../c-api/type.rst:443 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is zero, suggesting that the " "subclass does not access the instance's memory directly." msgstr "" -#: ../../c-api/type.rst:440 +#: ../../c-api/type.rst:446 msgid "With the :c:macro:`Py_TPFLAGS_ITEMS_AT_END` flag." msgstr "" -#: ../../c-api/type.rst:444 +#: ../../c-api/type.rst:450 msgid "Type flags, used to set :c:member:`PyTypeObject.tp_flags`." msgstr "" -#: ../../c-api/type.rst:446 +#: ../../c-api/type.rst:452 msgid "" "If the ``Py_TPFLAGS_HEAPTYPE`` flag is not set, :c:func:" "`PyType_FromSpecWithBases` sets it automatically." msgstr "" -#: ../../c-api/type.rst:451 +#: ../../c-api/type.rst:457 msgid "" "Array of :c:type:`PyType_Slot` structures. Terminated by the special slot " "value ``{0, NULL}``." msgstr "" -#: ../../c-api/type.rst:454 +#: ../../c-api/type.rst:460 msgid "Each slot ID should be specified at most once." msgstr "" -#: ../../c-api/type.rst:464 +#: ../../c-api/type.rst:470 msgid "" "Structure defining optional functionality of a type, containing a slot ID " "and a value pointer." msgstr "" -#: ../../c-api/type.rst:469 +#: ../../c-api/type.rst:475 msgid "A slot ID." msgstr "" -#: ../../c-api/type.rst:471 +#: ../../c-api/type.rst:477 msgid "" "Slot IDs are named like the field names of the structures :c:type:" "`PyTypeObject`, :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, :c:" @@ -531,30 +539,30 @@ msgid "" "prefix. For example, use:" msgstr "" -#: ../../c-api/type.rst:477 +#: ../../c-api/type.rst:483 msgid "``Py_tp_dealloc`` to set :c:member:`PyTypeObject.tp_dealloc`" msgstr "" -#: ../../c-api/type.rst:478 +#: ../../c-api/type.rst:484 msgid "``Py_nb_add`` to set :c:member:`PyNumberMethods.nb_add`" msgstr "" -#: ../../c-api/type.rst:479 +#: ../../c-api/type.rst:485 msgid "``Py_sq_length`` to set :c:member:`PySequenceMethods.sq_length`" msgstr "" -#: ../../c-api/type.rst:481 +#: ../../c-api/type.rst:487 msgid "" "The following “offset” fields cannot be set using :c:type:`PyType_Slot`:" msgstr "" -#: ../../c-api/type.rst:483 +#: ../../c-api/type.rst:489 msgid "" ":c:member:`~PyTypeObject.tp_weaklistoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)" msgstr "" -#: ../../c-api/type.rst:485 +#: ../../c-api/type.rst:491 msgid "" ":c:member:`~PyTypeObject.tp_dictoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_DICT` instead if possible)" @@ -562,7 +570,7 @@ msgstr "" ":c:member:`~PyTypeObject.tp_dictoffset`\\ (如果可能,請改用 :c:macro:" "`Py_TPFLAGS_MANAGED_DICT`)" -#: ../../c-api/type.rst:487 +#: ../../c-api/type.rst:493 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall_offset` (use " "``\"__vectorcalloffset__\"`` in :ref:`PyMemberDef <pymemberdef-offsets>`)" @@ -570,7 +578,7 @@ msgstr "" ":c:member:`~PyTypeObject.tp_vectorcall_offset`\\ (請用 :ref:`PyMemberDef " "<pymemberdef-offsets>` 中的 ``\"__vectorcalloffset__\"``)" -#: ../../c-api/type.rst:491 +#: ../../c-api/type.rst:497 msgid "" "If it is not possible to switch to a ``MANAGED`` flag (for example, for " "vectorcall or to support Python older than 3.12), specify the offset in :c:" @@ -578,48 +586,48 @@ msgid "" "documentation <pymemberdef-offsets>` for details." msgstr "" -#: ../../c-api/type.rst:497 +#: ../../c-api/type.rst:503 msgid "The following fields cannot be set at all when creating a heap type:" msgstr "" -#: ../../c-api/type.rst:499 +#: ../../c-api/type.rst:505 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall` (use :c:member:`~PyTypeObject." "tp_new` and/or :c:member:`~PyTypeObject.tp_init`)" msgstr "" -#: ../../c-api/type.rst:503 +#: ../../c-api/type.rst:509 msgid "" "Internal fields: :c:member:`~PyTypeObject.tp_dict`, :c:member:`~PyTypeObject." "tp_mro`, :c:member:`~PyTypeObject.tp_cache`, :c:member:`~PyTypeObject." "tp_subclasses`, and :c:member:`~PyTypeObject.tp_weaklist`." msgstr "" -#: ../../c-api/type.rst:510 +#: ../../c-api/type.rst:516 msgid "" "Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be problematic on " "some platforms. To avoid issues, use the *bases* argument of :c:func:" "`PyType_FromSpecWithBases` instead." msgstr "" -#: ../../c-api/type.rst:515 +#: ../../c-api/type.rst:521 msgid "Slots in :c:type:`PyBufferProcs` may be set in the unlimited API." msgstr "" -#: ../../c-api/type.rst:518 +#: ../../c-api/type.rst:524 msgid "" ":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." "bf_releasebuffer` are now available under the :ref:`limited API <limited-c-" "api>`." msgstr "" -#: ../../c-api/type.rst:525 +#: ../../c-api/type.rst:531 msgid "" "The desired value of the slot. In most cases, this is a pointer to a " "function." msgstr "" -#: ../../c-api/type.rst:528 +#: ../../c-api/type.rst:534 msgid "Slots other than ``Py_tp_doc`` may not be ``NULL``." msgstr "" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index 2b7e6341f3..3ffb4c871b 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-22 00:13+0000\n" +"POT-Creation-Date: 2025-04-14 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:33+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -18,8 +18,8 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../c-api/typeobj.rst:6 -msgid "Type Objects" -msgstr "型別物件" +msgid "Type Object Structures" +msgstr "型別物件結構" #: ../../c-api/typeobj.rst:8 msgid "" @@ -45,8 +45,8 @@ msgstr "" #: ../../c-api/typeobj.rst:23 msgid "" "In addition to the following quick reference, the :ref:`typedef-examples` " -"section provides at-a-glance insight into the meaning and use of :c:type:" -"`PyTypeObject`." +"section provides at-a-glance insight into the meaning and use " +"of :c:type:`PyTypeObject`." msgstr "" #: ../../c-api/typeobj.rst:29 @@ -1171,9 +1171,9 @@ msgstr "" #: ../../c-api/typeobj.rst:475 msgid "" -"The structure definition for :c:type:`PyTypeObject` can be found in :file:" -"`Include/object.h`. For convenience of reference, this repeats the " -"definition found there:" +"The structure definition for :c:type:`PyTypeObject` can be found " +"in :file:`Include/cpython/object.h`. For convenience of reference, this " +"repeats the definition found there:" msgstr "" #: ../../c-api/typeobj.rst:481 @@ -1272,11 +1272,12 @@ msgstr "" #: ../../c-api/typeobj.rst:487 msgid "" -"The type object structure extends the :c:type:`PyVarObject` structure. The :" -"c:member:`~PyVarObject.ob_size` field is used for dynamic types (created by :" -"c:func:`!type_new`, usually called from a class statement). Note that :c:" -"data:`PyType_Type` (the metatype) initializes :c:member:`~PyTypeObject." -"tp_itemsize`, which means that its instances (i.e. type objects) *must* have " +"The type object structure extends the :c:type:`PyVarObject` structure. " +"The :c:member:`~PyVarObject.ob_size` field is used for dynamic types " +"(created by :c:func:`!type_new`, usually called from a class statement). " +"Note that :c:data:`PyType_Type` (the metatype) " +"initializes :c:member:`~PyTypeObject.tp_itemsize`, which means that its " +"instances (i.e. type objects) *must* have " "the :c:member:`~PyVarObject.ob_size` field." msgstr "" @@ -1284,49 +1285,49 @@ msgstr "" msgid "" "This is the type object's reference count, initialized to ``1`` by the " "``PyObject_HEAD_INIT`` macro. Note that for :ref:`statically allocated type " -"objects <static-types>`, the type's instances (objects whose :c:member:" -"`~PyObject.ob_type` points back to the type) do *not* count as references. " -"But for :ref:`dynamically allocated type objects <heap-types>`, the " -"instances *do* count as references." +"objects <static-types>`, the type's instances (objects " +"whose :c:member:`~PyObject.ob_type` points back to the type) do *not* count " +"as references. But for :ref:`dynamically allocated type objects <heap-" +"types>`, the instances *do* count as references." msgstr "" #: ../../c-api/typeobj.rst:503 ../../c-api/typeobj.rst:526 -#: ../../c-api/typeobj.rst:540 ../../c-api/typeobj.rst:584 -#: ../../c-api/typeobj.rst:627 ../../c-api/typeobj.rst:699 -#: ../../c-api/typeobj.rst:740 ../../c-api/typeobj.rst:757 -#: ../../c-api/typeobj.rst:774 ../../c-api/typeobj.rst:792 -#: ../../c-api/typeobj.rst:816 ../../c-api/typeobj.rst:833 -#: ../../c-api/typeobj.rst:845 ../../c-api/typeobj.rst:857 -#: ../../c-api/typeobj.rst:890 ../../c-api/typeobj.rst:912 -#: ../../c-api/typeobj.rst:932 ../../c-api/typeobj.rst:953 -#: ../../c-api/typeobj.rst:979 ../../c-api/typeobj.rst:998 -#: ../../c-api/typeobj.rst:1014 ../../c-api/typeobj.rst:1053 -#: ../../c-api/typeobj.rst:1064 ../../c-api/typeobj.rst:1074 -#: ../../c-api/typeobj.rst:1084 ../../c-api/typeobj.rst:1098 -#: ../../c-api/typeobj.rst:1116 ../../c-api/typeobj.rst:1139 -#: ../../c-api/typeobj.rst:1157 ../../c-api/typeobj.rst:1170 -#: ../../c-api/typeobj.rst:1192 ../../c-api/typeobj.rst:1236 -#: ../../c-api/typeobj.rst:1257 ../../c-api/typeobj.rst:1276 -#: ../../c-api/typeobj.rst:1306 ../../c-api/typeobj.rst:1328 -#: ../../c-api/typeobj.rst:1354 ../../c-api/typeobj.rst:1439 -#: ../../c-api/typeobj.rst:1513 ../../c-api/typeobj.rst:1574 -#: ../../c-api/typeobj.rst:1610 ../../c-api/typeobj.rst:1635 -#: ../../c-api/typeobj.rst:1658 ../../c-api/typeobj.rst:1671 -#: ../../c-api/typeobj.rst:1686 ../../c-api/typeobj.rst:1700 -#: ../../c-api/typeobj.rst:1730 ../../c-api/typeobj.rst:1762 -#: ../../c-api/typeobj.rst:1788 ../../c-api/typeobj.rst:1806 -#: ../../c-api/typeobj.rst:1835 ../../c-api/typeobj.rst:1879 -#: ../../c-api/typeobj.rst:1896 ../../c-api/typeobj.rst:1937 -#: ../../c-api/typeobj.rst:1959 ../../c-api/typeobj.rst:1991 -#: ../../c-api/typeobj.rst:2019 ../../c-api/typeobj.rst:2032 -#: ../../c-api/typeobj.rst:2042 ../../c-api/typeobj.rst:2059 -#: ../../c-api/typeobj.rst:2076 ../../c-api/typeobj.rst:2090 -#: ../../c-api/typeobj.rst:2125 ../../c-api/typeobj.rst:2148 +#: ../../c-api/typeobj.rst:543 ../../c-api/typeobj.rst:587 +#: ../../c-api/typeobj.rst:665 ../../c-api/typeobj.rst:741 +#: ../../c-api/typeobj.rst:782 ../../c-api/typeobj.rst:799 +#: ../../c-api/typeobj.rst:816 ../../c-api/typeobj.rst:834 +#: ../../c-api/typeobj.rst:858 ../../c-api/typeobj.rst:875 +#: ../../c-api/typeobj.rst:887 ../../c-api/typeobj.rst:899 +#: ../../c-api/typeobj.rst:932 ../../c-api/typeobj.rst:954 +#: ../../c-api/typeobj.rst:974 ../../c-api/typeobj.rst:995 +#: ../../c-api/typeobj.rst:1021 ../../c-api/typeobj.rst:1040 +#: ../../c-api/typeobj.rst:1056 ../../c-api/typeobj.rst:1095 +#: ../../c-api/typeobj.rst:1106 ../../c-api/typeobj.rst:1116 +#: ../../c-api/typeobj.rst:1126 ../../c-api/typeobj.rst:1140 +#: ../../c-api/typeobj.rst:1158 ../../c-api/typeobj.rst:1181 +#: ../../c-api/typeobj.rst:1199 ../../c-api/typeobj.rst:1212 +#: ../../c-api/typeobj.rst:1234 ../../c-api/typeobj.rst:1278 +#: ../../c-api/typeobj.rst:1299 ../../c-api/typeobj.rst:1318 +#: ../../c-api/typeobj.rst:1348 ../../c-api/typeobj.rst:1370 +#: ../../c-api/typeobj.rst:1396 ../../c-api/typeobj.rst:1481 +#: ../../c-api/typeobj.rst:1555 ../../c-api/typeobj.rst:1616 +#: ../../c-api/typeobj.rst:1652 ../../c-api/typeobj.rst:1677 +#: ../../c-api/typeobj.rst:1700 ../../c-api/typeobj.rst:1713 +#: ../../c-api/typeobj.rst:1728 ../../c-api/typeobj.rst:1742 +#: ../../c-api/typeobj.rst:1772 ../../c-api/typeobj.rst:1804 +#: ../../c-api/typeobj.rst:1830 ../../c-api/typeobj.rst:1848 +#: ../../c-api/typeobj.rst:1877 ../../c-api/typeobj.rst:1921 +#: ../../c-api/typeobj.rst:1938 ../../c-api/typeobj.rst:1979 +#: ../../c-api/typeobj.rst:2001 ../../c-api/typeobj.rst:2033 +#: ../../c-api/typeobj.rst:2061 ../../c-api/typeobj.rst:2074 +#: ../../c-api/typeobj.rst:2084 ../../c-api/typeobj.rst:2101 +#: ../../c-api/typeobj.rst:2118 ../../c-api/typeobj.rst:2132 +#: ../../c-api/typeobj.rst:2165 ../../c-api/typeobj.rst:2188 msgid "**Inheritance:**" msgstr "" -#: ../../c-api/typeobj.rst:505 ../../c-api/typeobj.rst:542 -#: ../../c-api/typeobj.rst:586 +#: ../../c-api/typeobj.rst:505 ../../c-api/typeobj.rst:545 +#: ../../c-api/typeobj.rst:589 msgid "This field is not inherited by subtypes." msgstr "" @@ -1348,18 +1349,19 @@ msgstr "Foo_Type.ob_type = &PyType_Type;" #: ../../c-api/typeobj.rst:521 msgid "" -"This should be done before any instances of the type are created. :c:func:" -"`PyType_Ready` checks if :c:member:`~PyObject.ob_type` is ``NULL``, and if " -"so, initializes it to the :c:member:`~PyObject.ob_type` field of the base " -"class. :c:func:`PyType_Ready` will not change this field if it is non-zero." +"This should be done before any instances of the type are " +"created. :c:func:`PyType_Ready` checks if :c:member:`~PyObject.ob_type` is " +"``NULL``, and if so, initializes it to the :c:member:`~PyObject.ob_type` " +"field of the base class. :c:func:`PyType_Ready` will not change this field " +"if it is non-zero." msgstr "" -#: ../../c-api/typeobj.rst:528 ../../c-api/typeobj.rst:701 -#: ../../c-api/typeobj.rst:818 ../../c-api/typeobj.rst:914 -#: ../../c-api/typeobj.rst:934 ../../c-api/typeobj.rst:1637 -#: ../../c-api/typeobj.rst:1660 ../../c-api/typeobj.rst:1790 -#: ../../c-api/typeobj.rst:1808 ../../c-api/typeobj.rst:1881 -#: ../../c-api/typeobj.rst:1993 ../../c-api/typeobj.rst:2127 +#: ../../c-api/typeobj.rst:528 ../../c-api/typeobj.rst:743 +#: ../../c-api/typeobj.rst:860 ../../c-api/typeobj.rst:956 +#: ../../c-api/typeobj.rst:976 ../../c-api/typeobj.rst:1679 +#: ../../c-api/typeobj.rst:1702 ../../c-api/typeobj.rst:1832 +#: ../../c-api/typeobj.rst:1850 ../../c-api/typeobj.rst:1923 +#: ../../c-api/typeobj.rst:2035 ../../c-api/typeobj.rst:2167 msgid "This field is inherited by subtypes." msgstr "" @@ -1374,38 +1376,45 @@ msgid "" "types>`, this field has a special internal meaning." msgstr "" -#: ../../c-api/typeobj.rst:546 +#: ../../c-api/typeobj.rst:540 +msgid "" +"This field should be accessed using the :c:func:`Py_SIZE()` " +"and :c:func:`Py_SET_SIZE()` macros." +msgstr "" + +#: ../../c-api/typeobj.rst:549 msgid "PyTypeObject Slots" msgstr "" -#: ../../c-api/typeobj.rst:548 +#: ../../c-api/typeobj.rst:551 msgid "" "Each slot has a section describing inheritance. If :c:func:`PyType_Ready` " "may set a value when the field is set to ``NULL`` then there will also be a " -"\"Default\" section. (Note that many fields set on :c:data:" -"`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as defaults.)" +"\"Default\" section. (Note that many fields set " +"on :c:data:`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as " +"defaults.)" msgstr "" -#: ../../c-api/typeobj.rst:555 +#: ../../c-api/typeobj.rst:558 msgid "" "Pointer to a NUL-terminated string containing the name of the type. For " "types that are accessible as module globals, the string should be the full " "module name, followed by a dot, followed by the type name; for built-in " "types, it should be just the type name. If the module is a submodule of a " "package, the full package name is part of the full module name. For " -"example, a type named :class:`!T` defined in module :mod:`!M` in subpackage :" -"mod:`!Q` in package :mod:`!P` should have the :c:member:`~PyTypeObject." -"tp_name` initializer ``\"P.Q.M.T\"``." +"example, a type named :class:`!T` defined in module :mod:`!M` in " +"subpackage :mod:`!Q` in package :mod:`!P` should have " +"the :c:member:`~PyTypeObject.tp_name` initializer ``\"P.Q.M.T\"``." msgstr "" -#: ../../c-api/typeobj.rst:563 +#: ../../c-api/typeobj.rst:566 msgid "" "For :ref:`dynamically allocated type objects <heap-types>`, this should just " "be the type name, and the module name explicitly stored in the type dict as " "the value for key ``'__module__'``." msgstr "" -#: ../../c-api/typeobj.rst:568 +#: ../../c-api/typeobj.rst:571 msgid "" "For :ref:`statically allocated type objects <static-types>`, the *tp_name* " "field should contain a dot. Everything before the last dot is made " @@ -1413,90 +1422,147 @@ msgid "" "the last dot is made accessible as the :attr:`~type.__name__` attribute." msgstr "" -#: ../../c-api/typeobj.rst:574 +#: ../../c-api/typeobj.rst:577 msgid "" "If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is " -"made accessible as the :attr:`~type.__name__` attribute, and the :attr:" -"`~type.__module__` attribute is undefined (unless explicitly set in the " -"dictionary, as explained above). This means your type will be impossible to " -"pickle. Additionally, it will not be listed in module documentations " -"created with pydoc." +"made accessible as the :attr:`~type.__name__` attribute, and " +"the :attr:`~type.__module__` attribute is undefined (unless explicitly set " +"in the dictionary, as explained above). This means your type will be " +"impossible to pickle. Additionally, it will not be listed in module " +"documentations created with pydoc." msgstr "" -#: ../../c-api/typeobj.rst:580 +#: ../../c-api/typeobj.rst:583 msgid "" -"This field must not be ``NULL``. It is the only required field in :c:func:" -"`PyTypeObject` (other than potentially :c:member:`~PyTypeObject." -"tp_itemsize`)." +"This field must not be ``NULL``. It is the only required field " +"in :c:func:`PyTypeObject` (other than " +"potentially :c:member:`~PyTypeObject.tp_itemsize`)." msgstr "" -#: ../../c-api/typeobj.rst:592 +#: ../../c-api/typeobj.rst:595 msgid "" "These fields allow calculating the size in bytes of instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:594 +#: ../../c-api/typeobj.rst:597 msgid "" -"There are two kinds of types: types with fixed-length instances have a zero :" -"c:member:`~PyTypeObject.tp_itemsize` field, types with variable-length " -"instances have a non-zero :c:member:`~PyTypeObject.tp_itemsize` field. For " -"a type with fixed-length instances, all instances have the same size, given " -"in :c:member:`~PyTypeObject.tp_basicsize`." +"There are two kinds of types: types with fixed-length instances have a " +"zero :c:member:`!tp_itemsize` field, types with variable-length instances " +"have a non-zero :c:member:`!tp_itemsize` field. For a type with fixed-" +"length instances, all instances have the same size, given in :c:member:`!" +"tp_basicsize`. (Exceptions to this rule can be made " +"using :c:func:`PyUnstable_Object_GC_NewWithExtraData`.)" msgstr "" -#: ../../c-api/typeobj.rst:599 +#: ../../c-api/typeobj.rst:604 msgid "" -"For a type with variable-length instances, the instances must have an :c:" -"member:`~PyVarObject.ob_size` field, and the instance size is :c:member:" -"`~PyTypeObject.tp_basicsize` plus N times :c:member:`~PyTypeObject." -"tp_itemsize`, where N is the \"length\" of the object. The value of N is " -"typically stored in the instance's :c:member:`~PyVarObject.ob_size` field. " -"There are exceptions: for example, ints use a negative :c:member:" -"`~PyVarObject.ob_size` to indicate a negative number, and N is " -"``abs(ob_size)`` there. Also, the presence of an :c:member:`~PyVarObject." -"ob_size` field in the instance layout doesn't mean that the instance " -"structure is variable-length (for example, the structure for the list type " -"has fixed-length instances, yet those instances have a meaningful :c:member:" -"`~PyVarObject.ob_size` field)." +"For a type with variable-length instances, the instances must have " +"an :c:member:`~PyVarObject.ob_size` field, and the instance size " +"is :c:member:`!tp_basicsize` plus N times :c:member:`!tp_itemsize`, where N " +"is the \"length\" of the object." msgstr "" -#: ../../c-api/typeobj.rst:610 +#: ../../c-api/typeobj.rst:609 msgid "" -"The basic size includes the fields in the instance declared by the macro :c:" -"macro:`PyObject_HEAD` or :c:macro:`PyObject_VAR_HEAD` (whichever is used to " -"declare the instance struct) and this in turn includes the :c:member:" -"`~PyObject._ob_prev` and :c:member:`~PyObject._ob_next` fields if they are " -"present. This means that the only correct way to get an initializer for " -"the :c:member:`~PyTypeObject.tp_basicsize` is to use the ``sizeof`` operator " -"on the struct used to declare the instance layout. The basic size does not " -"include the GC header size." +"Functions like :c:func:`PyObject_NewVar` will take the value of N as an " +"argument, and store in the instance's :c:member:`~PyVarObject.ob_size` " +"field. Note that the :c:member:`~PyVarObject.ob_size` field may later be " +"used for other purposes. For example, :py:type:`int` instances use the bits " +"of :c:member:`~PyVarObject.ob_size` in an implementation-defined way; the " +"underlying storage and its size should be accessed " +"using :c:func:`PyLong_Export`." msgstr "" -#: ../../c-api/typeobj.rst:618 +#: ../../c-api/typeobj.rst:619 msgid "" -"A note about alignment: if the variable items require a particular " -"alignment, this should be taken care of by the value of :c:member:" -"`~PyTypeObject.tp_basicsize`. Example: suppose a type implements an array " -"of ``double``. :c:member:`~PyTypeObject.tp_itemsize` is ``sizeof(double)``. " -"It is the programmer's responsibility that :c:member:`~PyTypeObject." -"tp_basicsize` is a multiple of ``sizeof(double)`` (assuming this is the " -"alignment requirement for ``double``)." +"The :c:member:`~PyVarObject.ob_size` field should be accessed using " +"the :c:func:`Py_SIZE()` and :c:func:`Py_SET_SIZE()` macros." msgstr "" -#: ../../c-api/typeobj.rst:625 +#: ../../c-api/typeobj.rst:622 msgid "" -"For any type with variable-length instances, this field must not be ``NULL``." +"Also, the presence of an :c:member:`~PyVarObject.ob_size` field in the " +"instance layout doesn't mean that the instance structure is variable-length. " +"For example, the :py:type:`list` type has fixed-length instances, yet those " +"instances have a :c:member:`~PyVarObject.ob_size` field. (As " +"with :py:type:`int`, avoid reading lists' :c:member:`!ob_size` directly. " +"Call :c:func:`PyList_Size` instead.)" msgstr "" #: ../../c-api/typeobj.rst:629 msgid "" -"These fields are inherited separately by subtypes. If the base type has a " -"non-zero :c:member:`~PyTypeObject.tp_itemsize`, it is generally not safe to " -"set :c:member:`~PyTypeObject.tp_itemsize` to a different non-zero value in a " -"subtype (though this depends on the implementation of the base type)." +"The :c:member:`!tp_basicsize` includes size needed for data of the " +"type's :c:member:`~PyTypeObject.tp_base`, plus any extra data needed by each " +"instance." +msgstr "" + +#: ../../c-api/typeobj.rst:633 +msgid "" +"The correct way to set :c:member:`!tp_basicsize` is to use the ``sizeof`` " +"operator on the struct used to declare the instance layout. This struct must " +"include the struct used to declare the base type. In other " +"words, :c:member:`!tp_basicsize` must be greater than or equal to the " +"base's :c:member:`!tp_basicsize`." +msgstr "" + +#: ../../c-api/typeobj.rst:639 +msgid "" +"Since every type is a subtype of :py:type:`object`, this struct must " +"include :c:type:`PyObject` or :c:type:`PyVarObject` (depending on " +"whether :c:member:`~PyVarObject.ob_size` should be included). These are " +"usually defined by the macro :c:macro:`PyObject_HEAD` " +"or :c:macro:`PyObject_VAR_HEAD`, respectively." +msgstr "" + +#: ../../c-api/typeobj.rst:645 +msgid "" +"The basic size does not include the GC header size, as that header is not " +"part of :c:macro:`PyObject_HEAD`." +msgstr "" + +#: ../../c-api/typeobj.rst:648 +msgid "" +"For cases where struct used to declare the base type is unknown, " +"see :c:member:`PyType_Spec.basicsize` and :c:func:`PyType_FromMetaclass`." +msgstr "" + +#: ../../c-api/typeobj.rst:651 +msgid "Notes about alignment:" +msgstr "" + +#: ../../c-api/typeobj.rst:653 +msgid "" +":c:member:`!tp_basicsize` must be a multiple of ``_Alignof(PyObject)``. When " +"using ``sizeof`` on a ``struct`` that includes :c:macro:`PyObject_HEAD`, as " +"recommended, the compiler ensures this. When not using a C ``struct``, or " +"when using compiler extensions like ``__attribute__((packed))``, it is up to " +"you." +msgstr "" + +#: ../../c-api/typeobj.rst:658 +msgid "" +"If the variable items require a particular alignment, :c:member:`!" +"tp_basicsize` and :c:member:`!tp_itemsize` must each be a multiple of that " +"alignment. For example, if a type's variable part stores a ``double``, it is " +"your responsibility that both fields are a multiple of ``_Alignof(double)``." +msgstr "" + +#: ../../c-api/typeobj.rst:667 +msgid "" +"These fields are inherited separately by subtypes. (That is, if the field is " +"set to zero, :c:func:`PyType_Ready` will copy the value from the base type, " +"indicating that the instances do not need additional storage.)" msgstr "" -#: ../../c-api/typeobj.rst:637 +#: ../../c-api/typeobj.rst:672 +msgid "" +"If the base type has a non-zero :c:member:`~PyTypeObject.tp_itemsize`, it is " +"generally not safe to set :c:member:`~PyTypeObject.tp_itemsize` to a " +"different non-zero value in a subtype (though this depends on the " +"implementation of the base type)." +msgstr "" + +#: ../../c-api/typeobj.rst:679 msgid "" "A pointer to the instance destructor function. This function must be " "defined unless the type guarantees that its instances will never be " @@ -1504,36 +1570,38 @@ msgid "" "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:641 +#: ../../c-api/typeobj.rst:683 msgid "void tp_dealloc(PyObject *self);" msgstr "void tp_dealloc(PyObject *self);" -#: ../../c-api/typeobj.rst:643 -msgid "" -"The destructor function is called by the :c:func:`Py_DECREF` and :c:func:" -"`Py_XDECREF` macros when the new reference count is zero. At this point, " -"the instance is still in existence, but there are no references to it. The " -"destructor function should free all references which the instance owns, free " -"all memory buffers owned by the instance (using the freeing function " -"corresponding to the allocation function used to allocate the buffer), and " -"call the type's :c:member:`~PyTypeObject.tp_free` function. If the type is " -"not subtypable (doesn't have the :c:macro:`Py_TPFLAGS_BASETYPE` flag bit " -"set), it is permissible to call the object deallocator directly instead of " +#: ../../c-api/typeobj.rst:685 +msgid "" +"The destructor function is called by the :c:func:`Py_DECREF` " +"and :c:func:`Py_XDECREF` macros when the new reference count is zero. At " +"this point, the instance is still in existence, but there are no references " +"to it. The destructor function should free all references which the " +"instance owns, free all memory buffers owned by the instance (using the " +"freeing function corresponding to the allocation function used to allocate " +"the buffer), and call the type's :c:member:`~PyTypeObject.tp_free` " +"function. If the type is not subtypable (doesn't have " +"the :c:macro:`Py_TPFLAGS_BASETYPE` flag bit set), it is permissible to call " +"the object deallocator directly instead of " "via :c:member:`~PyTypeObject.tp_free`. The object deallocator should be the " "one used to allocate the instance; this is normally :c:func:`PyObject_Del` " -"if the instance was allocated using :c:macro:`PyObject_New` or :c:macro:" -"`PyObject_NewVar`, or :c:func:`PyObject_GC_Del` if the instance was " -"allocated using :c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar`." +"if the instance was allocated using :c:macro:`PyObject_New` " +"or :c:macro:`PyObject_NewVar`, or :c:func:`PyObject_GC_Del` if the instance " +"was allocated using :c:macro:`PyObject_GC_New` " +"or :c:macro:`PyObject_GC_NewVar`." msgstr "" -#: ../../c-api/typeobj.rst:658 +#: ../../c-api/typeobj.rst:700 msgid "" -"If the type supports garbage collection (has the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag bit set), the destructor should call :c:func:" -"`PyObject_GC_UnTrack` before clearing any member fields." +"If the type supports garbage collection (has " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit set), the destructor should " +"call :c:func:`PyObject_GC_UnTrack` before clearing any member fields." msgstr "" -#: ../../c-api/typeobj.rst:662 +#: ../../c-api/typeobj.rst:704 msgid "" "static void foo_dealloc(foo_object *self) {\n" " PyObject_GC_UnTrack(self);\n" @@ -1547,15 +1615,15 @@ msgstr "" " Py_TYPE(self)->tp_free((PyObject *)self);\n" "}" -#: ../../c-api/typeobj.rst:670 +#: ../../c-api/typeobj.rst:712 msgid "" "Finally, if the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the " -"deallocator should release the owned reference to its type object (via :c:" -"func:`Py_DECREF`) after calling the type deallocator. In order to avoid " -"dangling pointers, the recommended way to achieve this is:" +"deallocator should release the owned reference to its type object " +"(via :c:func:`Py_DECREF`) after calling the type deallocator. In order to " +"avoid dangling pointers, the recommended way to achieve this is:" msgstr "" -#: ../../c-api/typeobj.rst:676 +#: ../../c-api/typeobj.rst:718 msgid "" "static void foo_dealloc(foo_object *self) {\n" " PyTypeObject *tp = Py_TYPE(self);\n" @@ -1565,7 +1633,7 @@ msgid "" "}" msgstr "" -#: ../../c-api/typeobj.rst:687 +#: ../../c-api/typeobj.rst:729 msgid "" "In a garbage collected Python, :c:member:`!tp_dealloc` may be called from " "any Python thread, not just the thread which created the object (if the " @@ -1574,68 +1642,69 @@ msgid "" "calls, since the thread on which :c:member:`!tp_dealloc` is called will own " "the Global Interpreter Lock (GIL). However, if the object being destroyed " "in turn destroys objects from some other C or C++ library, care should be " -"taken to ensure that destroying those objects on the thread which called :c:" -"member:`!tp_dealloc` will not violate any assumptions of the library." +"taken to ensure that destroying those objects on the thread which " +"called :c:member:`!tp_dealloc` will not violate any assumptions of the " +"library." msgstr "" -#: ../../c-api/typeobj.rst:706 +#: ../../c-api/typeobj.rst:748 msgid "" "An optional offset to a per-instance function that implements calling the " "object using the :ref:`vectorcall protocol <vectorcall>`, a more efficient " "alternative of the simpler :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:711 +#: ../../c-api/typeobj.rst:753 msgid "" "This field is only used if the flag :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` is " "set. If so, this must be a positive integer containing the offset in the " "instance of a :c:type:`vectorcallfunc` pointer." msgstr "" -#: ../../c-api/typeobj.rst:715 +#: ../../c-api/typeobj.rst:757 msgid "" "The *vectorcallfunc* pointer may be ``NULL``, in which case the instance " "behaves as if :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` was not set: calling the " "instance falls back to :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:719 +#: ../../c-api/typeobj.rst:761 msgid "" -"Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also set :c:member:" -"`~PyTypeObject.tp_call` and make sure its behaviour is consistent with the " -"*vectorcallfunc* function. This can be done by setting *tp_call* to :c:func:" -"`PyVectorcall_Call`." +"Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also " +"set :c:member:`~PyTypeObject.tp_call` and make sure its behaviour is " +"consistent with the *vectorcallfunc* function. This can be done by setting " +"*tp_call* to :c:func:`PyVectorcall_Call`." msgstr "" -#: ../../c-api/typeobj.rst:726 +#: ../../c-api/typeobj.rst:768 msgid "" "Before version 3.8, this slot was named ``tp_print``. In Python 2.x, it was " "used for printing to a file. In Python 3.0 to 3.7, it was unused." msgstr "" -#: ../../c-api/typeobj.rst:732 +#: ../../c-api/typeobj.rst:774 msgid "" "Before version 3.12, it was not recommended for :ref:`mutable heap types " -"<heap-types>` to implement the vectorcall protocol. When a user sets :attr:" -"`~object.__call__` in Python code, only *tp_call* is updated, likely making " -"it inconsistent with the vectorcall function. Since 3.12, setting " -"``__call__`` will disable vectorcall optimization by clearing the :c:macro:" -"`Py_TPFLAGS_HAVE_VECTORCALL` flag." +"<heap-types>` to implement the vectorcall protocol. When a user " +"sets :attr:`~object.__call__` in Python code, only *tp_call* is updated, " +"likely making it inconsistent with the vectorcall function. Since 3.12, " +"setting ``__call__`` will disable vectorcall optimization by clearing " +"the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag." msgstr "" -#: ../../c-api/typeobj.rst:742 +#: ../../c-api/typeobj.rst:784 msgid "" -"This field is always inherited. However, the :c:macro:" -"`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If it's not set, " -"then the subclass won't use :ref:`vectorcall <vectorcall>`, except when :c:" -"func:`PyVectorcall_Call` is explicitly called." +"This field is always inherited. However, " +"the :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If " +"it's not set, then the subclass won't use :ref:`vectorcall <vectorcall>`, " +"except when :c:func:`PyVectorcall_Call` is explicitly called." msgstr "" -#: ../../c-api/typeobj.rst:751 +#: ../../c-api/typeobj.rst:793 msgid "An optional pointer to the get-attribute-string function." msgstr "" -#: ../../c-api/typeobj.rst:753 +#: ../../c-api/typeobj.rst:795 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, " @@ -1643,29 +1712,28 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:759 ../../c-api/typeobj.rst:955 -msgid "" -"Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject." -"tp_getattro`" +#: ../../c-api/typeobj.rst:801 ../../c-api/typeobj.rst:997 +msgid "Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject.tp_getattro`" msgstr "" -"群組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject." -"tp_getattro`" +"群" +"組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject.tp_getattro`" -#: ../../c-api/typeobj.rst:761 +#: ../../c-api/typeobj.rst:803 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_getattro`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_getattr` " "and :c:member:`~PyTypeObject.tp_getattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject." -"tp_getattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_getattr` " +"and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:768 ../../c-api/typeobj.rst:968 +#: ../../c-api/typeobj.rst:810 ../../c-api/typeobj.rst:1010 msgid "" "An optional pointer to the function for setting and deleting attributes." msgstr "" -#: ../../c-api/typeobj.rst:770 +#: ../../c-api/typeobj.rst:812 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, " @@ -1673,55 +1741,54 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:776 ../../c-api/typeobj.rst:981 -msgid "" -"Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject." -"tp_setattro`" +#: ../../c-api/typeobj.rst:818 ../../c-api/typeobj.rst:1023 +msgid "Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject.tp_setattro`" msgstr "" -"群組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject." -"tp_setattro`" +"群" +"組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject.tp_setattro`" -#: ../../c-api/typeobj.rst:778 +#: ../../c-api/typeobj.rst:820 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_setattro`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_setattr` " "and :c:member:`~PyTypeObject.tp_setattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject." -"tp_setattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_setattr` " +"and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:785 +#: ../../c-api/typeobj.rst:827 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement :term:`awaitable` and :term:`asynchronous iterator` " "protocols at the C-level. See :ref:`async-structs` for details." msgstr "" -#: ../../c-api/typeobj.rst:789 +#: ../../c-api/typeobj.rst:831 msgid "Formerly known as ``tp_compare`` and ``tp_reserved``." msgstr "" -#: ../../c-api/typeobj.rst:794 +#: ../../c-api/typeobj.rst:836 msgid "" "The :c:member:`~PyTypeObject.tp_as_async` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:802 +#: ../../c-api/typeobj.rst:844 msgid "" -"An optional pointer to a function that implements the built-in function :" -"func:`repr`." +"An optional pointer to a function that implements the built-in " +"function :func:`repr`." msgstr "" -#: ../../c-api/typeobj.rst:805 +#: ../../c-api/typeobj.rst:847 msgid "The signature is the same as for :c:func:`PyObject_Repr`::" msgstr "" -#: ../../c-api/typeobj.rst:807 +#: ../../c-api/typeobj.rst:849 msgid "PyObject *tp_repr(PyObject *self);" msgstr "PyObject *tp_repr(PyObject *self);" -#: ../../c-api/typeobj.rst:809 +#: ../../c-api/typeobj.rst:851 msgid "" "The function must return a string or a Unicode object. Ideally, this " "function should return a string that, when passed to :func:`eval`, given a " @@ -1730,153 +1797,152 @@ msgid "" "``'>'`` from which both the type and the value of the object can be deduced." msgstr "" -#: ../../c-api/typeobj.rst:820 ../../c-api/typeobj.rst:899 -#: ../../c-api/typeobj.rst:936 ../../c-api/typeobj.rst:961 -#: ../../c-api/typeobj.rst:987 ../../c-api/typeobj.rst:1028 -#: ../../c-api/typeobj.rst:1583 ../../c-api/typeobj.rst:1617 -#: ../../c-api/typeobj.rst:1734 ../../c-api/typeobj.rst:1767 -#: ../../c-api/typeobj.rst:1842 ../../c-api/typeobj.rst:1883 -#: ../../c-api/typeobj.rst:1901 ../../c-api/typeobj.rst:1943 -#: ../../c-api/typeobj.rst:1964 ../../c-api/typeobj.rst:1995 +#: ../../c-api/typeobj.rst:862 ../../c-api/typeobj.rst:941 +#: ../../c-api/typeobj.rst:978 ../../c-api/typeobj.rst:1003 +#: ../../c-api/typeobj.rst:1029 ../../c-api/typeobj.rst:1070 +#: ../../c-api/typeobj.rst:1625 ../../c-api/typeobj.rst:1659 +#: ../../c-api/typeobj.rst:1776 ../../c-api/typeobj.rst:1809 +#: ../../c-api/typeobj.rst:1884 ../../c-api/typeobj.rst:1925 +#: ../../c-api/typeobj.rst:1943 ../../c-api/typeobj.rst:1985 +#: ../../c-api/typeobj.rst:2006 ../../c-api/typeobj.rst:2037 msgid "**Default:**" msgstr "**預設:**" -#: ../../c-api/typeobj.rst:822 +#: ../../c-api/typeobj.rst:864 msgid "" "When this field is not set, a string of the form ``<%s object at %p>`` is " "returned, where ``%s`` is replaced by the type name, and ``%p`` by the " "object's memory address." msgstr "" -#: ../../c-api/typeobj.rst:829 +#: ../../c-api/typeobj.rst:871 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the number protocol. These fields are documented " "in :ref:`number-structs`." msgstr "" -#: ../../c-api/typeobj.rst:835 +#: ../../c-api/typeobj.rst:877 msgid "" "The :c:member:`~PyTypeObject.tp_as_number` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:841 +#: ../../c-api/typeobj.rst:883 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the sequence protocol. These fields are documented " "in :ref:`sequence-structs`." msgstr "" -#: ../../c-api/typeobj.rst:847 +#: ../../c-api/typeobj.rst:889 msgid "" "The :c:member:`~PyTypeObject.tp_as_sequence` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:853 +#: ../../c-api/typeobj.rst:895 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the mapping protocol. These fields are documented " "in :ref:`mapping-structs`." msgstr "" -#: ../../c-api/typeobj.rst:859 +#: ../../c-api/typeobj.rst:901 msgid "" "The :c:member:`~PyTypeObject.tp_as_mapping` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:867 +#: ../../c-api/typeobj.rst:909 msgid "" -"An optional pointer to a function that implements the built-in function :" -"func:`hash`." +"An optional pointer to a function that implements the built-in " +"function :func:`hash`." msgstr "" -#: ../../c-api/typeobj.rst:870 +#: ../../c-api/typeobj.rst:912 msgid "The signature is the same as for :c:func:`PyObject_Hash`::" msgstr "" -#: ../../c-api/typeobj.rst:872 +#: ../../c-api/typeobj.rst:914 msgid "Py_hash_t tp_hash(PyObject *);" msgstr "Py_hash_t tp_hash(PyObject *);" -#: ../../c-api/typeobj.rst:874 +#: ../../c-api/typeobj.rst:916 msgid "" "The value ``-1`` should not be returned as a normal return value; when an " "error occurs during the computation of the hash value, the function should " "set an exception and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:878 +#: ../../c-api/typeobj.rst:920 msgid "" "When this field is not set (*and* :c:member:`~PyTypeObject.tp_richcompare` " -"is not set), an attempt to take the hash of the object raises :exc:" -"`TypeError`. This is the same as setting it to :c:func:" -"`PyObject_HashNotImplemented`." +"is not set), an attempt to take the hash of the object " +"raises :exc:`TypeError`. This is the same as setting it " +"to :c:func:`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:882 +#: ../../c-api/typeobj.rst:924 msgid "" "This field can be set explicitly to :c:func:`PyObject_HashNotImplemented` to " "block inheritance of the hash method from a parent type. This is interpreted " "as the equivalent of ``__hash__ = None`` at the Python level, causing " "``isinstance(o, collections.Hashable)`` to correctly return ``False``. Note " "that the converse is also true - setting ``__hash__ = None`` on a class at " -"the Python level will result in the ``tp_hash`` slot being set to :c:func:" -"`PyObject_HashNotImplemented`." +"the Python level will result in the ``tp_hash`` slot being set " +"to :c:func:`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:892 ../../c-api/typeobj.rst:1576 -msgid "" -"Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject." -"tp_richcompare`" +#: ../../c-api/typeobj.rst:934 ../../c-api/typeobj.rst:1618 +msgid "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject.tp_richcompare`" msgstr "" -"群組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject." -"tp_richcompare`" +"群" +"組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject.tp_richcompare`" -#: ../../c-api/typeobj.rst:894 +#: ../../c-api/typeobj.rst:936 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_richcompare`: a subtype inherits both of :c:member:`~PyTypeObject." -"tp_richcompare` and :c:member:`~PyTypeObject.tp_hash`, when the subtype's :c:" -"member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` " -"are both ``NULL``." +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_richcompare`: a subtype inherits both " +"of :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash`, when the " +"subtype's :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:901 +#: ../../c-api/typeobj.rst:943 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericHash`." msgstr "" -#: ../../c-api/typeobj.rst:906 +#: ../../c-api/typeobj.rst:948 msgid "" "An optional pointer to a function that implements calling the object. This " "should be ``NULL`` if the object is not callable. The signature is the same " "as for :c:func:`PyObject_Call`::" msgstr "" -#: ../../c-api/typeobj.rst:910 +#: ../../c-api/typeobj.rst:952 msgid "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" msgstr "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" -#: ../../c-api/typeobj.rst:919 +#: ../../c-api/typeobj.rst:961 msgid "" -"An optional pointer to a function that implements the built-in operation :" -"func:`str`. (Note that :class:`str` is a type now, and :func:`str` calls " -"the constructor for that type. This constructor calls :c:func:" -"`PyObject_Str` to do the actual work, and :c:func:`PyObject_Str` will call " -"this handler.)" +"An optional pointer to a function that implements the built-in " +"operation :func:`str`. (Note that :class:`str` is a type now, " +"and :func:`str` calls the constructor for that type. This constructor " +"calls :c:func:`PyObject_Str` to do the actual work, " +"and :c:func:`PyObject_Str` will call this handler.)" msgstr "" -#: ../../c-api/typeobj.rst:924 +#: ../../c-api/typeobj.rst:966 msgid "The signature is the same as for :c:func:`PyObject_Str`::" msgstr "" -#: ../../c-api/typeobj.rst:926 +#: ../../c-api/typeobj.rst:968 msgid "PyObject *tp_str(PyObject *self);" msgstr "PyObject *tp_str(PyObject *self);" -#: ../../c-api/typeobj.rst:928 +#: ../../c-api/typeobj.rst:970 msgid "" "The function must return a string or a Unicode object. It should be a " "\"friendly\" string representation of the object, as this is the " @@ -1884,99 +1950,101 @@ msgid "" "function." msgstr "" -#: ../../c-api/typeobj.rst:938 +#: ../../c-api/typeobj.rst:980 msgid "" "When this field is not set, :c:func:`PyObject_Repr` is called to return a " "string representation." msgstr "" -#: ../../c-api/typeobj.rst:944 +#: ../../c-api/typeobj.rst:986 msgid "An optional pointer to the get-attribute function." msgstr "" -#: ../../c-api/typeobj.rst:946 +#: ../../c-api/typeobj.rst:988 msgid "The signature is the same as for :c:func:`PyObject_GetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:948 +#: ../../c-api/typeobj.rst:990 msgid "PyObject *tp_getattro(PyObject *self, PyObject *attr);" msgstr "PyObject *tp_getattro(PyObject *self, PyObject *attr);" -#: ../../c-api/typeobj.rst:950 +#: ../../c-api/typeobj.rst:992 msgid "" -"It is usually convenient to set this field to :c:func:" -"`PyObject_GenericGetAttr`, which implements the normal way of looking for " -"object attributes." +"It is usually convenient to set this field " +"to :c:func:`PyObject_GenericGetAttr`, which implements the normal way of " +"looking for object attributes." msgstr "" -#: ../../c-api/typeobj.rst:957 +#: ../../c-api/typeobj.rst:999 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_getattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_getattr`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_getattr` " "and :c:member:`~PyTypeObject.tp_getattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_getattr` and :c:member:`~PyTypeObject." -"tp_getattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_getattr` " +"and :c:member:`~PyTypeObject.tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:963 +#: ../../c-api/typeobj.rst:1005 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:970 +#: ../../c-api/typeobj.rst:1012 msgid "The signature is the same as for :c:func:`PyObject_SetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:972 +#: ../../c-api/typeobj.rst:1014 msgid "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" msgstr "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" -#: ../../c-api/typeobj.rst:974 +#: ../../c-api/typeobj.rst:1016 msgid "" "In addition, setting *value* to ``NULL`` to delete an attribute must be " -"supported. It is usually convenient to set this field to :c:func:" -"`PyObject_GenericSetAttr`, which implements the normal way of setting object " -"attributes." +"supported. It is usually convenient to set this field " +"to :c:func:`PyObject_GenericSetAttr`, which implements the normal way of " +"setting object attributes." msgstr "" -#: ../../c-api/typeobj.rst:983 +#: ../../c-api/typeobj.rst:1025 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_setattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_setattr`: a subtype inherits " +"both :c:member:`~PyTypeObject.tp_setattr` " "and :c:member:`~PyTypeObject.tp_setattro` from its base type when the " -"subtype's :c:member:`~PyTypeObject.tp_setattr` and :c:member:`~PyTypeObject." -"tp_setattro` are both ``NULL``." +"subtype's :c:member:`~PyTypeObject.tp_setattr` " +"and :c:member:`~PyTypeObject.tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:989 +#: ../../c-api/typeobj.rst:1031 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:994 +#: ../../c-api/typeobj.rst:1036 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the buffer interface. These fields are documented " "in :ref:`buffer-structs`." msgstr "" -#: ../../c-api/typeobj.rst:1000 +#: ../../c-api/typeobj.rst:1042 msgid "" "The :c:member:`~PyTypeObject.tp_as_buffer` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:1006 +#: ../../c-api/typeobj.rst:1048 msgid "" "This field is a bit mask of various flags. Some flags indicate variant " "semantics for certain situations; others are used to indicate that certain " -"fields in the type object (or in the extension structures referenced via :c:" -"member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject." -"tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, and :c:member:" -"`~PyTypeObject.tp_as_buffer`) that were historically not always present are " -"valid; if such a flag bit is clear, the type fields it guards must not be " -"accessed and must be considered to have a zero or ``NULL`` value instead." +"fields in the type object (or in the extension structures referenced " +"via :c:member:`~PyTypeObject.tp_as_number`, :c:member:`~PyTypeObject.tp_as_sequence`, :c:member:`~PyTypeObject.tp_as_mapping`, " +"and :c:member:`~PyTypeObject.tp_as_buffer`) that were historically not " +"always present are valid; if such a flag bit is clear, the type fields it " +"guards must not be accessed and must be considered to have a zero or " +"``NULL`` value instead." msgstr "" -#: ../../c-api/typeobj.rst:1016 +#: ../../c-api/typeobj.rst:1058 msgid "" "Inheritance of this field is complicated. Most flag bits are inherited " "individually, i.e. if the base type has a flag bit set, the subtype inherits " @@ -1985,14 +2053,14 @@ msgid "" "type's value of the flag bit is copied into the subtype together with a " "pointer to the extension structure. The :c:macro:`Py_TPFLAGS_HAVE_GC` flag " "bit is inherited together with the :c:member:`~PyTypeObject.tp_traverse` " -"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and the :c:member:" -"`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` fields in " -"the subtype exist and have ``NULL`` values. .. XXX are most flag bits " -"*really* inherited individually?" +"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and " +"the :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have " +"``NULL`` values. .. XXX are most flag bits *really* inherited individually?" msgstr "" -#: ../../c-api/typeobj.rst:1030 +#: ../../c-api/typeobj.rst:1072 msgid "" ":c:data:`PyBaseObject_Type` uses ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``." @@ -2000,20 +2068,20 @@ msgstr "" ":c:data:`PyBaseObject_Type` 使用 ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``。" -#: ../../c-api/typeobj.rst:1033 +#: ../../c-api/typeobj.rst:1075 msgid "**Bit Masks:**" msgstr "" -#: ../../c-api/typeobj.rst:1037 +#: ../../c-api/typeobj.rst:1079 msgid "" "The following bit masks are currently defined; these can be ORed together " -"using the ``|`` operator to form the value of the :c:member:`~PyTypeObject." -"tp_flags` field. The macro :c:func:`PyType_HasFeature` takes a type and a " -"flags value, *tp* and *f*, and checks whether ``tp->tp_flags & f`` is non-" -"zero." +"using the ``|`` operator to form the value of " +"the :c:member:`~PyTypeObject.tp_flags` field. The " +"macro :c:func:`PyType_HasFeature` takes a type and a flags value, *tp* and " +"*f*, and checks whether ``tp->tp_flags & f`` is non-zero." msgstr "" -#: ../../c-api/typeobj.rst:1044 +#: ../../c-api/typeobj.rst:1086 msgid "" "This bit is set when the type object itself is allocated on the heap, for " "example, types created dynamically using :c:func:`PyType_FromSpec`. In this " @@ -2021,255 +2089,257 @@ msgid "" "a reference to the type, and the type object is INCREF'ed when a new " "instance is created, and DECREF'ed when an instance is destroyed (this does " "not apply to instances of subtypes; only the type referenced by the " -"instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should also :ref:" -"`support garbage collection <supporting-cycle-detection>` as they can form a " -"reference cycle with their own module object." +"instance's ob_type gets INCREF'ed or DECREF'ed). Heap types should " +"also :ref:`support garbage collection <supporting-cycle-detection>` as they " +"can form a reference cycle with their own module object." msgstr "" -#: ../../c-api/typeobj.rst:1055 ../../c-api/typeobj.rst:1066 -#: ../../c-api/typeobj.rst:1076 ../../c-api/typeobj.rst:1086 -#: ../../c-api/typeobj.rst:1118 +#: ../../c-api/typeobj.rst:1097 ../../c-api/typeobj.rst:1108 +#: ../../c-api/typeobj.rst:1118 ../../c-api/typeobj.rst:1128 +#: ../../c-api/typeobj.rst:1160 msgid "???" msgstr "???" -#: ../../c-api/typeobj.rst:1060 +#: ../../c-api/typeobj.rst:1102 msgid "" "This bit is set when the type can be used as the base type of another type. " "If this bit is clear, the type cannot be subtyped (similar to a \"final\" " "class in Java)." msgstr "" -#: ../../c-api/typeobj.rst:1071 +#: ../../c-api/typeobj.rst:1113 msgid "" -"This bit is set when the type object has been fully initialized by :c:func:" -"`PyType_Ready`." +"This bit is set when the type object has been fully initialized " +"by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1081 +#: ../../c-api/typeobj.rst:1123 msgid "" "This bit is set while :c:func:`PyType_Ready` is in the process of " "initializing the type object." msgstr "" -#: ../../c-api/typeobj.rst:1091 +#: ../../c-api/typeobj.rst:1133 msgid "" "This bit is set when the object supports garbage collection. If this bit is " "set, instances must be created using :c:macro:`PyObject_GC_New` and " -"destroyed using :c:func:`PyObject_GC_Del`. More information in section :ref:" -"`supporting-cycle-detection`. This bit also implies that the GC-related " -"fields :c:member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject." -"tp_clear` are present in the type object." +"destroyed using :c:func:`PyObject_GC_Del`. More information in " +"section :ref:`supporting-cycle-detection`. This bit also implies that the " +"GC-related fields :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` are present in the type object." msgstr "" -#: ../../c-api/typeobj.rst:1100 ../../c-api/typeobj.rst:1441 -#: ../../c-api/typeobj.rst:1515 -msgid "" -"Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject." -"tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" +#: ../../c-api/typeobj.rst:1142 ../../c-api/typeobj.rst:1483 +#: ../../c-api/typeobj.rst:1557 +msgid "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject.tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" msgstr "" -#: ../../c-api/typeobj.rst:1102 +#: ../../c-api/typeobj.rst:1144 msgid "" -"The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with the :c:" -"member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` " -"fields, i.e. if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the " -"subtype and the :c:member:`~PyTypeObject.tp_traverse` and :c:member:" -"`~PyTypeObject.tp_clear` fields in the subtype exist and have ``NULL`` " -"values." +"The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with " +"the :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` fields, i.e. if " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is clear in the subtype and " +"the :c:member:`~PyTypeObject.tp_traverse` " +"and :c:member:`~PyTypeObject.tp_clear` fields in the subtype exist and have " +"``NULL`` values." msgstr "" -#: ../../c-api/typeobj.rst:1112 +#: ../../c-api/typeobj.rst:1154 msgid "" "This is a bitmask of all the bits that pertain to the existence of certain " "fields in the type object and its extension structures. Currently, it " "includes the following bits: :c:macro:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`." msgstr "" -#: ../../c-api/typeobj.rst:1123 +#: ../../c-api/typeobj.rst:1165 msgid "This bit indicates that objects behave like unbound methods." msgstr "" -#: ../../c-api/typeobj.rst:1125 +#: ../../c-api/typeobj.rst:1167 msgid "If this flag is set for ``type(meth)``, then:" msgstr "" -#: ../../c-api/typeobj.rst:1127 +#: ../../c-api/typeobj.rst:1169 msgid "" "``meth.__get__(obj, cls)(*args, **kwds)`` (with ``obj`` not None) must be " "equivalent to ``meth(obj, *args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1130 +#: ../../c-api/typeobj.rst:1172 msgid "" "``meth.__get__(None, cls)(*args, **kwds)`` must be equivalent to " "``meth(*args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1133 +#: ../../c-api/typeobj.rst:1175 msgid "" -"This flag enables an optimization for typical method calls like ``obj." -"meth()``: it avoids creating a temporary \"bound method\" object for ``obj." -"meth``." +"This flag enables an optimization for typical method calls like " +"``obj.meth()``: it avoids creating a temporary \"bound method\" object for " +"``obj.meth``." msgstr "" -#: ../../c-api/typeobj.rst:1141 +#: ../../c-api/typeobj.rst:1183 msgid "" -"This flag is never inherited by types without the :c:macro:" -"`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it is inherited " -"whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." +"This flag is never inherited by types without " +"the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it " +"is inherited whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1147 +#: ../../c-api/typeobj.rst:1189 msgid "" "This bit indicates that instances of the class have a `~object.__dict__` " "attribute, and that the space for the dictionary is managed by the VM." msgstr "" -#: ../../c-api/typeobj.rst:1150 +#: ../../c-api/typeobj.rst:1192 msgid "If this flag is set, :c:macro:`Py_TPFLAGS_HAVE_GC` should also be set." msgstr "" -#: ../../c-api/typeobj.rst:1152 +#: ../../c-api/typeobj.rst:1194 msgid "" "The type traverse function must call :c:func:`PyObject_VisitManagedDict` and " "its clear function must call :c:func:`PyObject_ClearManagedDict`." msgstr "" -#: ../../c-api/typeobj.rst:1159 +#: ../../c-api/typeobj.rst:1201 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject.tp_dictoffset` " "field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1165 +#: ../../c-api/typeobj.rst:1207 msgid "" "This bit indicates that instances of the class should be weakly " "referenceable." msgstr "" -#: ../../c-api/typeobj.rst:1172 +#: ../../c-api/typeobj.rst:1214 msgid "" -"This flag is inherited unless the :c:member:`~PyTypeObject." -"tp_weaklistoffset` field is set in a superclass." +"This flag is inherited unless " +"the :c:member:`~PyTypeObject.tp_weaklistoffset` field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1178 +#: ../../c-api/typeobj.rst:1220 msgid "" -"Only usable with variable-size types, i.e. ones with non-zero :c:member:" -"`~PyTypeObject.tp_itemsize`." +"Only usable with variable-size types, i.e. ones with non-" +"zero :c:member:`~PyTypeObject.tp_itemsize`." msgstr "" -#: ../../c-api/typeobj.rst:1181 +#: ../../c-api/typeobj.rst:1223 msgid "" "Indicates that the variable-sized portion of an instance of this type is at " "the end of the instance's memory area, at an offset of ``Py_TYPE(obj)-" ">tp_basicsize`` (which may be different in each subclass)." msgstr "" -#: ../../c-api/typeobj.rst:1186 +#: ../../c-api/typeobj.rst:1228 msgid "" "When setting this flag, be sure that all superclasses either use this memory " "layout, or are not variable-sized. Python does not check this." msgstr "" -#: ../../c-api/typeobj.rst:1194 +#: ../../c-api/typeobj.rst:1236 msgid "This flag is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1208 +#: ../../c-api/typeobj.rst:1250 msgid "" "These flags are used by functions such as :c:func:`PyLong_Check` to quickly " "determine if a type is a subclass of a built-in type; such specific checks " "are faster than a generic check, like :c:func:`PyObject_IsInstance`. Custom " -"types that inherit from built-ins should have their :c:member:`~PyTypeObject." -"tp_flags` set appropriately, or the code that interacts with such types will " -"behave differently depending on what kind of check is used." +"types that inherit from built-ins should have " +"their :c:member:`~PyTypeObject.tp_flags` set appropriately, or the code that " +"interacts with such types will behave differently depending on what kind of " +"check is used." msgstr "" -#: ../../c-api/typeobj.rst:1219 +#: ../../c-api/typeobj.rst:1261 msgid "" "This bit is set when the :c:member:`~PyTypeObject.tp_finalize` slot is " "present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1224 +#: ../../c-api/typeobj.rst:1266 msgid "" -"This flag isn't necessary anymore, as the interpreter assumes the :c:member:" -"`~PyTypeObject.tp_finalize` slot is always present in the type structure." +"This flag isn't necessary anymore, as the interpreter assumes " +"the :c:member:`~PyTypeObject.tp_finalize` slot is always present in the type " +"structure." msgstr "" -#: ../../c-api/typeobj.rst:1232 +#: ../../c-api/typeobj.rst:1274 msgid "" "This bit is set when the class implements the :ref:`vectorcall protocol " "<vectorcall>`. See :c:member:`~PyTypeObject.tp_vectorcall_offset` for " "details." msgstr "" -#: ../../c-api/typeobj.rst:1238 +#: ../../c-api/typeobj.rst:1280 msgid "" "This bit is inherited if :c:member:`~PyTypeObject.tp_call` is also inherited." msgstr "" -#: ../../c-api/typeobj.rst:1245 +#: ../../c-api/typeobj.rst:1287 msgid "" -"This flag is now removed from a class when the class's :py:meth:`~object." -"__call__` method is reassigned." +"This flag is now removed from a class when the " +"class's :py:meth:`~object.__call__` method is reassigned." msgstr "" -#: ../../c-api/typeobj.rst:1248 +#: ../../c-api/typeobj.rst:1290 msgid "This flag can now be inherited by mutable classes." msgstr "" -#: ../../c-api/typeobj.rst:1252 +#: ../../c-api/typeobj.rst:1294 msgid "" "This bit is set for type objects that are immutable: type attributes cannot " "be set nor deleted." msgstr "" -#: ../../c-api/typeobj.rst:1254 +#: ../../c-api/typeobj.rst:1296 msgid "" ":c:func:`PyType_Ready` automatically applies this flag to :ref:`static types " "<static-types>`." msgstr "" -#: ../../c-api/typeobj.rst:1259 +#: ../../c-api/typeobj.rst:1301 msgid "This flag is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:1265 +#: ../../c-api/typeobj.rst:1307 msgid "" -"Disallow creating instances of the type: set :c:member:`~PyTypeObject." -"tp_new` to NULL and don't create the ``__new__`` key in the type dictionary." +"Disallow creating instances of the type: " +"set :c:member:`~PyTypeObject.tp_new` to NULL and don't create the " +"``__new__`` key in the type dictionary." msgstr "" -#: ../../c-api/typeobj.rst:1269 +#: ../../c-api/typeobj.rst:1311 msgid "" "The flag must be set before creating the type, not after. For example, it " "must be set before :c:func:`PyType_Ready` is called on the type." msgstr "" -#: ../../c-api/typeobj.rst:1272 +#: ../../c-api/typeobj.rst:1314 msgid "" -"The flag is set automatically on :ref:`static types <static-types>` if :c:" -"member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` and :c:" -"member:`~PyTypeObject.tp_new` is NULL." +"The flag is set automatically on :ref:`static types <static-types>` " +"if :c:member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` " +"and :c:member:`~PyTypeObject.tp_new` is NULL." msgstr "" -#: ../../c-api/typeobj.rst:1278 +#: ../../c-api/typeobj.rst:1320 msgid "" "This flag is not inherited. However, subclasses will not be instantiable " "unless they provide a non-NULL :c:member:`~PyTypeObject.tp_new` (which is " "only possible via the C API)." msgstr "" -#: ../../c-api/typeobj.rst:1285 +#: ../../c-api/typeobj.rst:1327 msgid "" "To disallow instantiating a class directly but allow instantiating its " "subclasses (e.g. for an :term:`abstract base class`), do not use this flag. " "Instead, make :c:member:`~PyTypeObject.tp_new` only succeed for subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1296 +#: ../../c-api/typeobj.rst:1338 msgid "" "This bit indicates that instances of the class may match mapping patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2277,23 +2347,23 @@ msgid "" "unset when registering :class:`collections.abc.Sequence`." msgstr "" -#: ../../c-api/typeobj.rst:1303 ../../c-api/typeobj.rst:1325 +#: ../../c-api/typeobj.rst:1345 ../../c-api/typeobj.rst:1367 msgid "" ":c:macro:`Py_TPFLAGS_MAPPING` and :c:macro:`Py_TPFLAGS_SEQUENCE` are " "mutually exclusive; it is an error to enable both flags simultaneously." msgstr "" -#: ../../c-api/typeobj.rst:1308 +#: ../../c-api/typeobj.rst:1350 msgid "" -"This flag is inherited by types that do not already set :c:macro:" -"`Py_TPFLAGS_SEQUENCE`." +"This flag is inherited by types that do not already " +"set :c:macro:`Py_TPFLAGS_SEQUENCE`." msgstr "" -#: ../../c-api/typeobj.rst:1311 ../../c-api/typeobj.rst:1333 +#: ../../c-api/typeobj.rst:1353 ../../c-api/typeobj.rst:1375 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: ../../c-api/typeobj.rst:1318 +#: ../../c-api/typeobj.rst:1360 msgid "" "This bit indicates that instances of the class may match sequence patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2301,63 +2371,63 @@ msgid "" "unset when registering :class:`collections.abc.Mapping`." msgstr "" -#: ../../c-api/typeobj.rst:1330 +#: ../../c-api/typeobj.rst:1372 msgid "" -"This flag is inherited by types that do not already set :c:macro:" -"`Py_TPFLAGS_MAPPING`." +"This flag is inherited by types that do not already " +"set :c:macro:`Py_TPFLAGS_MAPPING`." msgstr "" -#: ../../c-api/typeobj.rst:1340 +#: ../../c-api/typeobj.rst:1382 msgid "" "Internal. Do not set or unset this flag. To indicate that a class has " "changed call :c:func:`PyType_Modified`" msgstr "" -#: ../../c-api/typeobj.rst:1344 +#: ../../c-api/typeobj.rst:1386 msgid "" "This flag is present in header files, but is not be used. It will be removed " "in a future version of CPython" msgstr "" -#: ../../c-api/typeobj.rst:1350 +#: ../../c-api/typeobj.rst:1392 msgid "" "An optional pointer to a NUL-terminated C string giving the docstring for " "this type object. This is exposed as the :attr:`~type.__doc__` attribute on " "the type and instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:1356 +#: ../../c-api/typeobj.rst:1398 msgid "This field is *not* inherited by subtypes." msgstr "" -#: ../../c-api/typeobj.rst:1361 +#: ../../c-api/typeobj.rst:1403 msgid "" "An optional pointer to a traversal function for the garbage collector. This " "is only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1364 +#: ../../c-api/typeobj.rst:1406 msgid "int tp_traverse(PyObject *self, visitproc visit, void *arg);" msgstr "int tp_traverse(PyObject *self, visitproc visit, void *arg);" -#: ../../c-api/typeobj.rst:1366 ../../c-api/typeobj.rst:1510 +#: ../../c-api/typeobj.rst:1408 ../../c-api/typeobj.rst:1552 msgid "" "More information about Python's garbage collection scheme can be found in " "section :ref:`supporting-cycle-detection`." msgstr "" -#: ../../c-api/typeobj.rst:1369 +#: ../../c-api/typeobj.rst:1411 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage " -"collector to detect reference cycles. A typical implementation of a :c:" -"member:`~PyTypeObject.tp_traverse` function simply calls :c:func:`Py_VISIT` " -"on each of the instance's members that are Python objects that the instance " -"owns. For example, this is function :c:func:`!local_traverse` from the :mod:" -"`!_thread` extension module::" +"collector to detect reference cycles. A typical implementation of " +"a :c:member:`~PyTypeObject.tp_traverse` function simply " +"calls :c:func:`Py_VISIT` on each of the instance's members that are Python " +"objects that the instance owns. For example, this is function :c:func:`!" +"local_traverse` from the :mod:`!_thread` extension module::" msgstr "" -#: ../../c-api/typeobj.rst:1375 +#: ../../c-api/typeobj.rst:1417 msgid "" "static int\n" "local_traverse(localobject *self, visitproc visit, void *arg)\n" @@ -2377,7 +2447,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1384 +#: ../../c-api/typeobj.rst:1426 msgid "" "Note that :c:func:`Py_VISIT` is called only on those members that can " "participate in reference cycles. Although there is also a ``self->key`` " @@ -2385,29 +2455,29 @@ msgid "" "part of a reference cycle." msgstr "" -#: ../../c-api/typeobj.rst:1388 +#: ../../c-api/typeobj.rst:1430 msgid "" "On the other hand, even if you know a member can never be part of a cycle, " "as a debugging aid you may want to visit it anyway just so the :mod:`gc` " "module's :func:`~gc.get_referents` function will include it." msgstr "" -#: ../../c-api/typeobj.rst:1392 +#: ../../c-api/typeobj.rst:1434 msgid "" "Heap types (:c:macro:`Py_TPFLAGS_HEAPTYPE`) must visit their type with::" msgstr "" -#: ../../c-api/typeobj.rst:1394 +#: ../../c-api/typeobj.rst:1436 msgid "Py_VISIT(Py_TYPE(self));" msgstr "Py_VISIT(Py_TYPE(self));" -#: ../../c-api/typeobj.rst:1396 +#: ../../c-api/typeobj.rst:1438 msgid "" "It is only needed since Python 3.9. To support Python 3.8 and older, this " "line must be conditional::" msgstr "" -#: ../../c-api/typeobj.rst:1399 +#: ../../c-api/typeobj.rst:1441 msgid "" "#if PY_VERSION_HEX >= 0x03090000\n" " Py_VISIT(Py_TYPE(self));\n" @@ -2417,18 +2487,18 @@ msgstr "" " Py_VISIT(Py_TYPE(self));\n" "#endif" -#: ../../c-api/typeobj.rst:1403 +#: ../../c-api/typeobj.rst:1445 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" -"`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" -"`PyObject_VisitManagedDict` like this::" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " +"the :c:member:`~PyTypeObject.tp_flags` field, the traverse function must " +"call :c:func:`PyObject_VisitManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1407 +#: ../../c-api/typeobj.rst:1449 msgid "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" msgstr "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" -#: ../../c-api/typeobj.rst:1410 +#: ../../c-api/typeobj.rst:1452 msgid "" "When implementing :c:member:`~PyTypeObject.tp_traverse`, only the members " "that the instance *owns* (by having :term:`strong references <strong " @@ -2441,49 +2511,52 @@ msgid "" "it, as they are allowed to be removed even if the instance is still alive)." msgstr "" -#: ../../c-api/typeobj.rst:1421 +#: ../../c-api/typeobj.rst:1463 msgid "" -"Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters to :c:" -"func:`!local_traverse` to have these specific names; don't name them just " -"anything." +"Note that :c:func:`Py_VISIT` requires the *visit* and *arg* parameters " +"to :c:func:`!local_traverse` to have these specific names; don't name them " +"just anything." msgstr "" -#: ../../c-api/typeobj.rst:1425 +#: ../../c-api/typeobj.rst:1467 msgid "" "Instances of :ref:`heap-allocated types <heap-types>` hold a reference to " -"their type. Their traversal function must therefore either visit :c:func:" -"`Py_TYPE(self) <Py_TYPE>`, or delegate this responsibility by calling " -"``tp_traverse`` of another heap-allocated type (such as a heap-allocated " -"superclass). If they do not, the type object may not be garbage-collected." +"their type. Their traversal function must therefore either " +"visit :c:func:`Py_TYPE(self) <Py_TYPE>`, or delegate this responsibility by " +"calling ``tp_traverse`` of another heap-allocated type (such as a heap-" +"allocated superclass). If they do not, the type object may not be garbage-" +"collected." msgstr "" -#: ../../c-api/typeobj.rst:1434 +#: ../../c-api/typeobj.rst:1476 msgid "" "Heap-allocated types are expected to visit ``Py_TYPE(self)`` in " "``tp_traverse``. In earlier versions of Python, due to `bug 40217 <https://" "bugs.python.org/issue40217>`_, doing this may lead to crashes in subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1443 +#: ../../c-api/typeobj.rst:1485 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_clear` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:" -"member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` " -"are all inherited from the base type if they are all zero in the subtype." +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_clear` and " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag " +"bit, :c:member:`~PyTypeObject.tp_traverse`, " +"and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type " +"if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1451 +#: ../../c-api/typeobj.rst:1493 msgid "" "An optional pointer to a clear function for the garbage collector. This is " "only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1454 +#: ../../c-api/typeobj.rst:1496 msgid "int tp_clear(PyObject *);" msgstr "int tp_clear(PyObject *);" -#: ../../c-api/typeobj.rst:1456 +#: ../../c-api/typeobj.rst:1498 msgid "" "The :c:member:`~PyTypeObject.tp_clear` member function is used to break " "reference cycles in cyclic garbage detected by the garbage collector. Taken " @@ -2492,13 +2565,14 @@ msgid "" "doubt supply a :c:member:`~PyTypeObject.tp_clear` function. For example, " "the tuple type does not implement a :c:member:`~PyTypeObject.tp_clear` " "function, because it's possible to prove that no reference cycle can be " -"composed entirely of tuples. Therefore the :c:member:`~PyTypeObject." -"tp_clear` functions of other types must be sufficient to break any cycle " -"containing a tuple. This isn't immediately obvious, and there's rarely a " -"good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." +"composed entirely of tuples. Therefore " +"the :c:member:`~PyTypeObject.tp_clear` functions of other types must be " +"sufficient to break any cycle containing a tuple. This isn't immediately " +"obvious, and there's rarely a good reason to avoid " +"implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1466 +#: ../../c-api/typeobj.rst:1508 msgid "" "Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the " "instance's references to those of its members that may be Python objects, " @@ -2506,7 +2580,7 @@ msgid "" "example::" msgstr "" -#: ../../c-api/typeobj.rst:1470 +#: ../../c-api/typeobj.rst:1512 msgid "" "static int\n" "local_clear(localobject *self)\n" @@ -2528,12 +2602,12 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1480 +#: ../../c-api/typeobj.rst:1522 msgid "" "The :c:func:`Py_CLEAR` macro should be used, because clearing references is " -"delicate: the reference to the contained object must not be released (via :" -"c:func:`Py_DECREF`) until after the pointer to the contained object is set " -"to ``NULL``. This is because releasing the reference may cause the " +"delicate: the reference to the contained object must not be released " +"(via :c:func:`Py_DECREF`) until after the pointer to the contained object is " +"set to ``NULL``. This is because releasing the reference may cause the " "contained object to become trash, triggering a chain of reclamation activity " "that may include invoking arbitrary Python code (due to finalizers, or " "weakref callbacks, associated with the contained object). If it's possible " @@ -2543,18 +2617,18 @@ msgid "" "performs the operations in a safe order." msgstr "" -#: ../../c-api/typeobj.rst:1492 +#: ../../c-api/typeobj.rst:1534 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" -"`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" -"`PyObject_ClearManagedDict` like this::" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " +"the :c:member:`~PyTypeObject.tp_flags` field, the traverse function must " +"call :c:func:`PyObject_ClearManagedDict` like this::" msgstr "" -#: ../../c-api/typeobj.rst:1496 +#: ../../c-api/typeobj.rst:1538 msgid "PyObject_ClearManagedDict((PyObject*)self);" msgstr "PyObject_ClearManagedDict((PyObject*)self);" -#: ../../c-api/typeobj.rst:1498 +#: ../../c-api/typeobj.rst:1540 msgid "" "Note that :c:member:`~PyTypeObject.tp_clear` is not *always* called before " "an instance is deallocated. For example, when reference counting is enough " @@ -2562,7 +2636,7 @@ msgid "" "is not involved and :c:member:`~PyTypeObject.tp_dealloc` is called directly." msgstr "" -#: ../../c-api/typeobj.rst:1504 +#: ../../c-api/typeobj.rst:1546 msgid "" "Because the goal of :c:member:`~PyTypeObject.tp_clear` functions is to break " "reference cycles, it's not necessary to clear contained objects like Python " @@ -2572,30 +2646,32 @@ msgid "" "invoke :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1517 +#: ../../c-api/typeobj.rst:1559 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_traverse` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :" -"c:member:`~PyTypeObject.tp_traverse`, and :c:member:`~PyTypeObject.tp_clear` " -"are all inherited from the base type if they are all zero in the subtype." +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_traverse` and " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag " +"bit, :c:member:`~PyTypeObject.tp_traverse`, " +"and :c:member:`~PyTypeObject.tp_clear` are all inherited from the base type " +"if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1525 +#: ../../c-api/typeobj.rst:1567 msgid "" "An optional pointer to the rich comparison function, whose signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1527 +#: ../../c-api/typeobj.rst:1569 msgid "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" msgstr "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" -#: ../../c-api/typeobj.rst:1529 +#: ../../c-api/typeobj.rst:1571 msgid "" "The first parameter is guaranteed to be an instance of the type that is " "defined by :c:type:`PyTypeObject`." msgstr "" -#: ../../c-api/typeobj.rst:1532 +#: ../../c-api/typeobj.rst:1574 msgid "" "The function should return the result of the comparison (usually ``Py_True`` " "or ``Py_False``). If the comparison is undefined, it must return " @@ -2603,50 +2679,51 @@ msgid "" "set an exception condition." msgstr "" -#: ../../c-api/typeobj.rst:1537 +#: ../../c-api/typeobj.rst:1579 msgid "" -"The following constants are defined to be used as the third argument for :c:" -"member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:" +"The following constants are defined to be used as the third argument " +"for :c:member:`~PyTypeObject.tp_richcompare` and " +"for :c:func:`PyObject_RichCompare`:" msgstr "" -#: ../../c-api/typeobj.rst:1543 +#: ../../c-api/typeobj.rst:1585 msgid "Constant" msgstr "常數" -#: ../../c-api/typeobj.rst:1543 +#: ../../c-api/typeobj.rst:1585 msgid "Comparison" msgstr "" -#: ../../c-api/typeobj.rst:1545 +#: ../../c-api/typeobj.rst:1587 msgid "``<``" msgstr "``<``" -#: ../../c-api/typeobj.rst:1547 +#: ../../c-api/typeobj.rst:1589 msgid "``<=``" msgstr "``<=``" -#: ../../c-api/typeobj.rst:1549 +#: ../../c-api/typeobj.rst:1591 msgid "``==``" msgstr "``==``" -#: ../../c-api/typeobj.rst:1551 +#: ../../c-api/typeobj.rst:1593 msgid "``!=``" msgstr "``!=``" -#: ../../c-api/typeobj.rst:1553 +#: ../../c-api/typeobj.rst:1595 msgid "``>``" msgstr "``>``" -#: ../../c-api/typeobj.rst:1555 +#: ../../c-api/typeobj.rst:1597 msgid "``>=``" msgstr "``>=``" -#: ../../c-api/typeobj.rst:1558 +#: ../../c-api/typeobj.rst:1600 msgid "" "The following macro is defined to ease writing rich comparison functions:" msgstr "" -#: ../../c-api/typeobj.rst:1562 +#: ../../c-api/typeobj.rst:1604 msgid "" "Return ``Py_True`` or ``Py_False`` from the function, depending on the " "result of a comparison. VAL_A and VAL_B must be orderable by C comparison " @@ -2654,60 +2731,62 @@ msgid "" "specifies the requested operation, as for :c:func:`PyObject_RichCompare`." msgstr "" -#: ../../c-api/typeobj.rst:1568 +#: ../../c-api/typeobj.rst:1610 msgid "The returned value is a new :term:`strong reference`." msgstr "" -#: ../../c-api/typeobj.rst:1570 +#: ../../c-api/typeobj.rst:1612 msgid "On error, sets an exception and returns ``NULL`` from the function." msgstr "" -#: ../../c-api/typeobj.rst:1578 +#: ../../c-api/typeobj.rst:1620 msgid "" -"This field is inherited by subtypes together with :c:member:`~PyTypeObject." -"tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" -"member:`~PyTypeObject.tp_hash` when the subtype's :c:member:`~PyTypeObject." -"tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." +"This field is inherited by subtypes together " +"with :c:member:`~PyTypeObject.tp_hash`: a subtype " +"inherits :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash` when the " +"subtype's :c:member:`~PyTypeObject.tp_richcompare` " +"and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1585 +#: ../../c-api/typeobj.rst:1627 msgid "" -":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject." -"tp_richcompare` implementation, which may be inherited. However, if only :c:" -"member:`~PyTypeObject.tp_hash` is defined, not even the inherited function " -"is used and instances of the type will not be able to participate in any " -"comparisons." +":c:data:`PyBaseObject_Type` provides " +"a :c:member:`~PyTypeObject.tp_richcompare` implementation, which may be " +"inherited. However, if only :c:member:`~PyTypeObject.tp_hash` is defined, " +"not even the inherited function is used and instances of the type will not " +"be able to participate in any comparisons." msgstr "" -#: ../../c-api/typeobj.rst:1594 +#: ../../c-api/typeobj.rst:1636 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1597 +#: ../../c-api/typeobj.rst:1639 msgid "" "If the instances of this type are weakly referenceable, this field is " "greater than zero and contains the offset in the instance structure of the " "weak reference list head (ignoring the GC header, if present); this offset " "is used by :c:func:`PyObject_ClearWeakRefs` and the ``PyWeakref_*`` " -"functions. The instance structure needs to include a field of type :c:expr:" -"`PyObject*` which is initialized to ``NULL``." +"functions. The instance structure needs to include a field of " +"type :c:expr:`PyObject*` which is initialized to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1604 +#: ../../c-api/typeobj.rst:1646 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_weaklist`; that " "is the list head for weak references to the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1607 +#: ../../c-api/typeobj.rst:1649 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " "and :c:member:`~PyTypeObject.tp_weaklistoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1612 +#: ../../c-api/typeobj.rst:1654 msgid "" "This field is inherited by subtypes, but see the rules listed below. A " "subtype may override this offset; this means that the subtype uses a " @@ -2716,115 +2795,116 @@ msgid "" "not be a problem." msgstr "" -#: ../../c-api/typeobj.rst:1619 +#: ../../c-api/typeobj.rst:1661 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" -"`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject." -"tp_weaklistoffset` will be set to a negative value, to indicate that it is " -"unsafe to use this field." +"If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in " +"the :c:member:`~PyTypeObject.tp_flags` field, " +"then :c:member:`~PyTypeObject.tp_weaklistoffset` will be set to a negative " +"value, to indicate that it is unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1627 +#: ../../c-api/typeobj.rst:1669 msgid "" "An optional pointer to a function that returns an :term:`iterator` for the " -"object. Its presence normally signals that the instances of this type are :" -"term:`iterable` (although sequences may be iterable without this function)." +"object. Its presence normally signals that the instances of this type " +"are :term:`iterable` (although sequences may be iterable without this " +"function)." msgstr "" -#: ../../c-api/typeobj.rst:1631 +#: ../../c-api/typeobj.rst:1673 msgid "This function has the same signature as :c:func:`PyObject_GetIter`::" msgstr "" -#: ../../c-api/typeobj.rst:1633 +#: ../../c-api/typeobj.rst:1675 msgid "PyObject *tp_iter(PyObject *self);" msgstr "PyObject *tp_iter(PyObject *self);" -#: ../../c-api/typeobj.rst:1642 +#: ../../c-api/typeobj.rst:1684 msgid "" -"An optional pointer to a function that returns the next item in an :term:" -"`iterator`. The signature is::" +"An optional pointer to a function that returns the next item in " +"an :term:`iterator`. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1645 +#: ../../c-api/typeobj.rst:1687 msgid "PyObject *tp_iternext(PyObject *self);" msgstr "PyObject *tp_iternext(PyObject *self);" -#: ../../c-api/typeobj.rst:1647 +#: ../../c-api/typeobj.rst:1689 msgid "" -"When the iterator is exhausted, it must return ``NULL``; a :exc:" -"`StopIteration` exception may or may not be set. When another error occurs, " -"it must return ``NULL`` too. Its presence signals that the instances of " -"this type are iterators." +"When the iterator is exhausted, it must return ``NULL``; " +"a :exc:`StopIteration` exception may or may not be set. When another error " +"occurs, it must return ``NULL`` too. Its presence signals that the " +"instances of this type are iterators." msgstr "" -#: ../../c-api/typeobj.rst:1652 +#: ../../c-api/typeobj.rst:1694 msgid "" "Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` " "function, and that function should return the iterator instance itself (not " "a new iterator instance)." msgstr "" -#: ../../c-api/typeobj.rst:1656 +#: ../../c-api/typeobj.rst:1698 msgid "This function has the same signature as :c:func:`PyIter_Next`." msgstr "" -#: ../../c-api/typeobj.rst:1665 +#: ../../c-api/typeobj.rst:1707 msgid "" -"An optional pointer to a static ``NULL``-terminated array of :c:type:" -"`PyMethodDef` structures, declaring regular methods of this type." +"An optional pointer to a static ``NULL``-terminated array " +"of :c:type:`PyMethodDef` structures, declaring regular methods of this type." msgstr "" -#: ../../c-api/typeobj.rst:1668 +#: ../../c-api/typeobj.rst:1710 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1673 +#: ../../c-api/typeobj.rst:1715 msgid "" "This field is not inherited by subtypes (methods are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1679 +#: ../../c-api/typeobj.rst:1721 msgid "" -"An optional pointer to a static ``NULL``-terminated array of :c:type:" -"`PyMemberDef` structures, declaring regular data members (fields or slots) " -"of instances of this type." +"An optional pointer to a static ``NULL``-terminated array " +"of :c:type:`PyMemberDef` structures, declaring regular data members (fields " +"or slots) of instances of this type." msgstr "" -#: ../../c-api/typeobj.rst:1683 +#: ../../c-api/typeobj.rst:1725 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1688 +#: ../../c-api/typeobj.rst:1730 msgid "" "This field is not inherited by subtypes (members are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1694 +#: ../../c-api/typeobj.rst:1736 msgid "" -"An optional pointer to a static ``NULL``-terminated array of :c:type:" -"`PyGetSetDef` structures, declaring computed attributes of instances of this " -"type." +"An optional pointer to a static ``NULL``-terminated array " +"of :c:type:`PyGetSetDef` structures, declaring computed attributes of " +"instances of this type." msgstr "" -#: ../../c-api/typeobj.rst:1697 +#: ../../c-api/typeobj.rst:1739 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a getset descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1702 +#: ../../c-api/typeobj.rst:1744 msgid "" "This field is not inherited by subtypes (computed attributes are inherited " "through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1708 +#: ../../c-api/typeobj.rst:1750 msgid "" "An optional pointer to a base type from which type properties are " "inherited. At this level, only single inheritance is supported; multiple " @@ -2832,7 +2912,7 @@ msgid "" "metatype." msgstr "" -#: ../../c-api/typeobj.rst:1716 +#: ../../c-api/typeobj.rst:1758 msgid "" "Slot initialization is subject to the rules of initializing globals. C99 " "requires the initializers to be \"address constants\". Function designators " @@ -2840,173 +2920,176 @@ msgid "" "valid C99 address constants." msgstr "" -#: ../../c-api/typeobj.rst:1721 +#: ../../c-api/typeobj.rst:1763 msgid "" -"However, the unary '&' operator applied to a non-static variable like :c:" -"data:`PyBaseObject_Type` is not required to produce an address constant. " -"Compilers may support this (gcc does), MSVC does not. Both compilers are " -"strictly standard conforming in this particular behavior." +"However, the unary '&' operator applied to a non-static variable " +"like :c:data:`PyBaseObject_Type` is not required to produce an address " +"constant. Compilers may support this (gcc does), MSVC does not. Both " +"compilers are strictly standard conforming in this particular behavior." msgstr "" -#: ../../c-api/typeobj.rst:1727 +#: ../../c-api/typeobj.rst:1769 msgid "" "Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the " "extension module's init function." msgstr "" -#: ../../c-api/typeobj.rst:1732 +#: ../../c-api/typeobj.rst:1774 msgid "This field is not inherited by subtypes (obviously)." msgstr "" -#: ../../c-api/typeobj.rst:1736 +#: ../../c-api/typeobj.rst:1778 msgid "" "This field defaults to ``&PyBaseObject_Type`` (which to Python programmers " "is known as the type :class:`object`)." msgstr "" -#: ../../c-api/typeobj.rst:1742 +#: ../../c-api/typeobj.rst:1784 msgid "The type's dictionary is stored here by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1744 +#: ../../c-api/typeobj.rst:1786 msgid "" "This field should normally be initialized to ``NULL`` before PyType_Ready is " "called; it may also be initialized to a dictionary containing initial " "attributes for the type. Once :c:func:`PyType_Ready` has initialized the " "type, extra attributes for the type may be added to this dictionary only if " -"they don't correspond to overloaded operations (like :meth:`~object." -"__add__`). Once initialization for the type has finished, this field should " -"be treated as read-only." +"they don't correspond to overloaded operations " +"(like :meth:`~object.__add__`). Once initialization for the type has " +"finished, this field should be treated as read-only." msgstr "" -#: ../../c-api/typeobj.rst:1752 +#: ../../c-api/typeobj.rst:1794 msgid "" -"Some types may not store their dictionary in this slot. Use :c:func:" -"`PyType_GetDict` to retrieve the dictionary for an arbitrary type." +"Some types may not store their dictionary in this slot. " +"Use :c:func:`PyType_GetDict` to retrieve the dictionary for an arbitrary " +"type." msgstr "" -#: ../../c-api/typeobj.rst:1758 +#: ../../c-api/typeobj.rst:1800 msgid "" "Internals detail: For static builtin types, this is always ``NULL``. " -"Instead, the dict for such types is stored on ``PyInterpreterState``. Use :c:" -"func:`PyType_GetDict` to get the dict for an arbitrary type." +"Instead, the dict for such types is stored on ``PyInterpreterState``. " +"Use :c:func:`PyType_GetDict` to get the dict for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1764 +#: ../../c-api/typeobj.rst:1806 msgid "" "This field is not inherited by subtypes (though the attributes defined in " "here are inherited through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1769 +#: ../../c-api/typeobj.rst:1811 msgid "" "If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new " "dictionary to it." msgstr "" -#: ../../c-api/typeobj.rst:1774 +#: ../../c-api/typeobj.rst:1816 msgid "" -"It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:" -"member:`~PyTypeObject.tp_dict` with the dictionary C-API." +"It is not safe to use :c:func:`PyDict_SetItem` on or otherwise " +"modify :c:member:`~PyTypeObject.tp_dict` with the dictionary C-API." msgstr "" -#: ../../c-api/typeobj.rst:1780 +#: ../../c-api/typeobj.rst:1822 msgid "An optional pointer to a \"descriptor get\" function." msgstr "" -#: ../../c-api/typeobj.rst:1782 ../../c-api/typeobj.rst:1798 -#: ../../c-api/typeobj.rst:1862 ../../c-api/typeobj.rst:1892 -#: ../../c-api/typeobj.rst:1916 +#: ../../c-api/typeobj.rst:1824 ../../c-api/typeobj.rst:1840 +#: ../../c-api/typeobj.rst:1904 ../../c-api/typeobj.rst:1934 +#: ../../c-api/typeobj.rst:1958 msgid "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1784 +#: ../../c-api/typeobj.rst:1826 msgid "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" msgstr "" "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" -#: ../../c-api/typeobj.rst:1795 +#: ../../c-api/typeobj.rst:1837 msgid "" "An optional pointer to a function for setting and deleting a descriptor's " "value." msgstr "" -#: ../../c-api/typeobj.rst:1800 +#: ../../c-api/typeobj.rst:1842 msgid "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" msgstr "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" -#: ../../c-api/typeobj.rst:1802 +#: ../../c-api/typeobj.rst:1844 msgid "The *value* argument is set to ``NULL`` to delete the value." msgstr "" -#: ../../c-api/typeobj.rst:1813 +#: ../../c-api/typeobj.rst:1855 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_DICT` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1816 +#: ../../c-api/typeobj.rst:1858 msgid "" "If the instances of this type have a dictionary containing instance " "variables, this field is non-zero and contains the offset in the instances " -"of the type of the instance variable dictionary; this offset is used by :c:" -"func:`PyObject_GenericGetAttr`." +"of the type of the instance variable dictionary; this offset is used " +"by :c:func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:1821 +#: ../../c-api/typeobj.rst:1863 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_dict`; that is " "the dictionary for attributes of the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1824 +#: ../../c-api/typeobj.rst:1866 msgid "" "The value specifies the offset of the dictionary from the start of the " "instance structure." msgstr "" -#: ../../c-api/typeobj.rst:1826 +#: ../../c-api/typeobj.rst:1868 msgid "" "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" -"only. To get the pointer to the dictionary call :c:func:" -"`PyObject_GenericGetDict`. Calling :c:func:`PyObject_GenericGetDict` may " -"need to allocate memory for the dictionary, so it is may be more efficient " -"to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." +"only. To get the pointer to the dictionary " +"call :c:func:`PyObject_GenericGetDict`. " +"Calling :c:func:`PyObject_GenericGetDict` may need to allocate memory for " +"the dictionary, so it is may be more efficient to " +"call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" -#: ../../c-api/typeobj.rst:1832 +#: ../../c-api/typeobj.rst:1874 msgid "" -"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " +"It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit " "and :c:member:`~PyTypeObject.tp_dictoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1837 +#: ../../c-api/typeobj.rst:1879 msgid "" "This field is inherited by subtypes. A subtype should not override this " "offset; doing so could be unsafe, if C code tries to access the dictionary " -"at the previous offset. To properly support inheritance, use :c:macro:" -"`Py_TPFLAGS_MANAGED_DICT`." +"at the previous offset. To properly support inheritance, " +"use :c:macro:`Py_TPFLAGS_MANAGED_DICT`." msgstr "" -#: ../../c-api/typeobj.rst:1844 +#: ../../c-api/typeobj.rst:1886 msgid "" "This slot has no default. For :ref:`static types <static-types>`, if the " "field is ``NULL`` then no :attr:`~object.__dict__` gets created for " "instances." msgstr "" -#: ../../c-api/typeobj.rst:1847 +#: ../../c-api/typeobj.rst:1889 msgid "" -"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" -"`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_dictoffset` " -"will be set to ``-1``, to indicate that it is unsafe to use this field." +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in " +"the :c:member:`~PyTypeObject.tp_flags` field, " +"then :c:member:`~PyTypeObject.tp_dictoffset` will be set to ``-1``, to " +"indicate that it is unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1855 +#: ../../c-api/typeobj.rst:1897 msgid "An optional pointer to an instance initialization function." msgstr "" -#: ../../c-api/typeobj.rst:1857 +#: ../../c-api/typeobj.rst:1899 msgid "" "This function corresponds to the :meth:`~object.__init__` method of " "classes. Like :meth:`!__init__`, it is possible to create an instance " @@ -3014,110 +3097,112 @@ msgid "" "instance by calling its :meth:`!__init__` method again." msgstr "" -#: ../../c-api/typeobj.rst:1864 +#: ../../c-api/typeobj.rst:1906 msgid "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" msgstr "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1866 +#: ../../c-api/typeobj.rst:1908 msgid "" "The self argument is the instance to be initialized; the *args* and *kwds* " -"arguments represent positional and keyword arguments of the call to :meth:" -"`~object.__init__`." +"arguments represent positional and keyword arguments of the call " +"to :meth:`~object.__init__`." msgstr "" -#: ../../c-api/typeobj.rst:1870 +#: ../../c-api/typeobj.rst:1912 msgid "" "The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called " -"when an instance is created normally by calling its type, after the type's :" -"c:member:`~PyTypeObject.tp_new` function has returned an instance of the " -"type. If the :c:member:`~PyTypeObject.tp_new` function returns an instance " -"of some other type that is not a subtype of the original type, no :c:member:" -"`~PyTypeObject.tp_init` function is called; if :c:member:`~PyTypeObject." -"tp_new` returns an instance of a subtype of the original type, the " -"subtype's :c:member:`~PyTypeObject.tp_init` is called." +"when an instance is created normally by calling its type, after the " +"type's :c:member:`~PyTypeObject.tp_new` function has returned an instance of " +"the type. If the :c:member:`~PyTypeObject.tp_new` function returns an " +"instance of some other type that is not a subtype of the original type, " +"no :c:member:`~PyTypeObject.tp_init` function is called; " +"if :c:member:`~PyTypeObject.tp_new` returns an instance of a subtype of the " +"original type, the subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" -#: ../../c-api/typeobj.rst:1877 +#: ../../c-api/typeobj.rst:1919 msgid "Returns ``0`` on success, ``-1`` and sets an exception on error." msgstr "" -#: ../../c-api/typeobj.rst:1885 +#: ../../c-api/typeobj.rst:1927 msgid "" "For :ref:`static types <static-types>` this field does not have a default." msgstr "" -#: ../../c-api/typeobj.rst:1890 +#: ../../c-api/typeobj.rst:1932 msgid "An optional pointer to an instance allocation function." msgstr "" -#: ../../c-api/typeobj.rst:1894 +#: ../../c-api/typeobj.rst:1936 msgid "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" msgstr "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" -#: ../../c-api/typeobj.rst:1898 +#: ../../c-api/typeobj.rst:1940 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)." msgstr "" -#: ../../c-api/typeobj.rst:1903 +#: ../../c-api/typeobj.rst:1945 msgid "" -"For dynamic subtypes, this field is always set to :c:func:" -"`PyType_GenericAlloc`, to force a standard heap allocation strategy." +"For dynamic subtypes, this field is always set " +"to :c:func:`PyType_GenericAlloc`, to force a standard heap allocation " +"strategy." msgstr "" -#: ../../c-api/typeobj.rst:1907 +#: ../../c-api/typeobj.rst:1949 msgid "" -"For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:" -"`PyType_GenericAlloc`. That is the recommended value for all statically " -"defined types." +"For static subtypes, :c:data:`PyBaseObject_Type` " +"uses :c:func:`PyType_GenericAlloc`. That is the recommended value for all " +"statically defined types." msgstr "" -#: ../../c-api/typeobj.rst:1914 +#: ../../c-api/typeobj.rst:1956 msgid "An optional pointer to an instance creation function." msgstr "" -#: ../../c-api/typeobj.rst:1918 +#: ../../c-api/typeobj.rst:1960 msgid "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" msgstr "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1920 +#: ../../c-api/typeobj.rst:1962 msgid "" "The *subtype* argument is the type of the object being created; the *args* " "and *kwds* arguments represent positional and keyword arguments of the call " -"to the type. Note that *subtype* doesn't have to equal the type whose :c:" -"member:`~PyTypeObject.tp_new` function is called; it may be a subtype of " -"that type (but not an unrelated type)." +"to the type. Note that *subtype* doesn't have to equal the type " +"whose :c:member:`~PyTypeObject.tp_new` function is called; it may be a " +"subtype of that type (but not an unrelated type)." msgstr "" -#: ../../c-api/typeobj.rst:1926 +#: ../../c-api/typeobj.rst:1968 msgid "" "The :c:member:`~PyTypeObject.tp_new` function should call ``subtype-" ">tp_alloc(subtype, nitems)`` to allocate space for the object, and then do " "only as much further initialization as is absolutely necessary. " "Initialization that can safely be ignored or repeated should be placed in " "the :c:member:`~PyTypeObject.tp_init` handler. A good rule of thumb is that " -"for immutable types, all initialization should take place in :c:member:" -"`~PyTypeObject.tp_new`, while for mutable types, most initialization should " -"be deferred to :c:member:`~PyTypeObject.tp_init`." +"for immutable types, all initialization should take place " +"in :c:member:`~PyTypeObject.tp_new`, while for mutable types, most " +"initialization should be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" -#: ../../c-api/typeobj.rst:1934 +#: ../../c-api/typeobj.rst:1976 msgid "" "Set the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow " "creating instances of the type in Python." msgstr "" -#: ../../c-api/typeobj.rst:1939 +#: ../../c-api/typeobj.rst:1981 msgid "" -"This field is inherited by subtypes, except it is not inherited by :ref:" -"`static types <static-types>` whose :c:member:`~PyTypeObject.tp_base` is " -"``NULL`` or ``&PyBaseObject_Type``." +"This field is inherited by subtypes, except it is not inherited " +"by :ref:`static types <static-types>` " +"whose :c:member:`~PyTypeObject.tp_base` is ``NULL`` or " +"``&PyBaseObject_Type``." msgstr "" -#: ../../c-api/typeobj.rst:1945 +#: ../../c-api/typeobj.rst:1987 msgid "" "For :ref:`static types <static-types>` this field has no default. This means " "if the slot is defined as ``NULL``, the type cannot be called to create new " @@ -3125,142 +3210,142 @@ msgid "" "factory function." msgstr "" -#: ../../c-api/typeobj.rst:1953 +#: ../../c-api/typeobj.rst:1995 msgid "" "An optional pointer to an instance deallocation function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1955 +#: ../../c-api/typeobj.rst:1997 msgid "void tp_free(void *self);" msgstr "void tp_free(void *self);" -#: ../../c-api/typeobj.rst:1957 +#: ../../c-api/typeobj.rst:1999 msgid "" -"An initializer that is compatible with this signature is :c:func:" -"`PyObject_Free`." +"An initializer that is compatible with this signature " +"is :c:func:`PyObject_Free`." msgstr "" -#: ../../c-api/typeobj.rst:1961 +#: ../../c-api/typeobj.rst:2003 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)" msgstr "" -#: ../../c-api/typeobj.rst:1966 +#: ../../c-api/typeobj.rst:2008 msgid "" -"In dynamic subtypes, this field is set to a deallocator suitable to match :c:" -"func:`PyType_GenericAlloc` and the value of the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag bit." +"In dynamic subtypes, this field is set to a deallocator suitable to " +"match :c:func:`PyType_GenericAlloc` and the value of " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit." msgstr "" -#: ../../c-api/typeobj.rst:1970 +#: ../../c-api/typeobj.rst:2012 msgid "" "For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:`PyObject_Del`." msgstr "" -#: ../../c-api/typeobj.rst:1975 +#: ../../c-api/typeobj.rst:2017 msgid "An optional pointer to a function called by the garbage collector." msgstr "" -#: ../../c-api/typeobj.rst:1977 +#: ../../c-api/typeobj.rst:2019 msgid "" "The garbage collector needs to know whether a particular object is " "collectible or not. Normally, it is sufficient to look at the object's " -"type's :c:member:`~PyTypeObject.tp_flags` field, and check the :c:macro:" -"`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture of statically " -"and dynamically allocated instances, and the statically allocated instances " -"are not collectible. Such types should define this function; it should " -"return ``1`` for a collectible instance, and ``0`` for a non-collectible " -"instance. The signature is::" +"type's :c:member:`~PyTypeObject.tp_flags` field, and check " +"the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit. But some types have a mixture " +"of statically and dynamically allocated instances, and the statically " +"allocated instances are not collectible. Such types should define this " +"function; it should return ``1`` for a collectible instance, and ``0`` for a " +"non-collectible instance. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1985 +#: ../../c-api/typeobj.rst:2027 msgid "int tp_is_gc(PyObject *self);" msgstr "int tp_is_gc(PyObject *self);" -#: ../../c-api/typeobj.rst:1987 +#: ../../c-api/typeobj.rst:2029 msgid "" -"(The only example of this are types themselves. The metatype, :c:data:" -"`PyType_Type`, defines this function to distinguish between statically and :" -"ref:`dynamically allocated types <heap-types>`.)" +"(The only example of this are types themselves. The " +"metatype, :c:data:`PyType_Type`, defines this function to distinguish " +"between statically and :ref:`dynamically allocated types <heap-types>`.)" msgstr "" -#: ../../c-api/typeobj.rst:1997 +#: ../../c-api/typeobj.rst:2039 msgid "" -"This slot has no default. If this field is ``NULL``, :c:macro:" -"`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." +"This slot has no default. If this field is " +"``NULL``, :c:macro:`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." msgstr "" -#: ../../c-api/typeobj.rst:2003 +#: ../../c-api/typeobj.rst:2045 msgid "Tuple of base types." msgstr "" -#: ../../c-api/typeobj.rst:2005 ../../c-api/typeobj.rst:2029 +#: ../../c-api/typeobj.rst:2047 ../../c-api/typeobj.rst:2071 msgid "" "This field should be set to ``NULL`` and treated as read-only. Python will " "fill it in when the type is :c:func:`initialized <PyType_Ready>`." msgstr "" -#: ../../c-api/typeobj.rst:2008 +#: ../../c-api/typeobj.rst:2050 msgid "" "For dynamically created classes, the ``Py_tp_bases`` :c:type:`slot " -"<PyType_Slot>` can be used instead of the *bases* argument of :c:func:" -"`PyType_FromSpecWithBases`. The argument form is preferred." +"<PyType_Slot>` can be used instead of the *bases* argument " +"of :c:func:`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" -#: ../../c-api/typeobj.rst:2015 +#: ../../c-api/typeobj.rst:2057 msgid "" "Multiple inheritance does not work well for statically defined types. If you " "set ``tp_bases`` to a tuple, Python will not raise an error, but some slots " "will only be inherited from the first base." msgstr "" -#: ../../c-api/typeobj.rst:2021 ../../c-api/typeobj.rst:2044 -#: ../../c-api/typeobj.rst:2061 ../../c-api/typeobj.rst:2078 -#: ../../c-api/typeobj.rst:2092 +#: ../../c-api/typeobj.rst:2063 ../../c-api/typeobj.rst:2086 +#: ../../c-api/typeobj.rst:2103 ../../c-api/typeobj.rst:2120 +#: ../../c-api/typeobj.rst:2134 msgid "This field is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:2026 +#: ../../c-api/typeobj.rst:2068 msgid "" "Tuple containing the expanded set of base types, starting with the type " "itself and ending with :class:`object`, in Method Resolution Order." msgstr "" -#: ../../c-api/typeobj.rst:2034 +#: ../../c-api/typeobj.rst:2076 msgid "" -"This field is not inherited; it is calculated fresh by :c:func:" -"`PyType_Ready`." +"This field is not inherited; it is calculated fresh " +"by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2040 +#: ../../c-api/typeobj.rst:2082 msgid "Unused. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2049 +#: ../../c-api/typeobj.rst:2091 msgid "" "A collection of subclasses. Internal use only. May be an invalid pointer." msgstr "" -#: ../../c-api/typeobj.rst:2051 +#: ../../c-api/typeobj.rst:2093 msgid "" -"To get a list of subclasses, call the Python method :py:meth:`~type." -"__subclasses__`." +"To get a list of subclasses, call the Python " +"method :py:meth:`~type.__subclasses__`." msgstr "" -#: ../../c-api/typeobj.rst:2056 +#: ../../c-api/typeobj.rst:2098 msgid "" "For some types, this field does not hold a valid :c:expr:`PyObject*`. The " "type was changed to :c:expr:`void*` to indicate this." msgstr "" -#: ../../c-api/typeobj.rst:2066 +#: ../../c-api/typeobj.rst:2108 msgid "" "Weak reference list head, for weak references to this type object. Not " "inherited. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2071 +#: ../../c-api/typeobj.rst:2113 msgid "" "Internals detail: For the static builtin types this is always ``NULL``, even " "if weakrefs are added. Instead, the weakrefs for each are stored on " @@ -3268,25 +3353,25 @@ msgid "" "``_PyObject_GET_WEAKREFS_LISTPTR()`` macro to avoid the distinction." msgstr "" -#: ../../c-api/typeobj.rst:2083 +#: ../../c-api/typeobj.rst:2125 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." msgstr "" -#: ../../c-api/typeobj.rst:2088 +#: ../../c-api/typeobj.rst:2130 msgid "Used to index into the method cache. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2097 +#: ../../c-api/typeobj.rst:2139 msgid "" "An optional pointer to an instance finalization function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2099 +#: ../../c-api/typeobj.rst:2141 msgid "void tp_finalize(PyObject *self);" msgstr "void tp_finalize(PyObject *self);" -#: ../../c-api/typeobj.rst:2101 +#: ../../c-api/typeobj.rst:2143 msgid "" "If :c:member:`~PyTypeObject.tp_finalize` is set, the interpreter calls it " "once when finalizing an instance. It is called either from the garbage " @@ -3296,138 +3381,136 @@ msgid "" "object in a sane state." msgstr "" -#: ../../c-api/typeobj.rst:2108 +#: ../../c-api/typeobj.rst:2150 msgid "" ":c:member:`~PyTypeObject.tp_finalize` should not mutate the current " "exception status; therefore, a recommended way to write a non-trivial " "finalizer is::" msgstr "" -#: ../../c-api/typeobj.rst:2111 +#: ../../c-api/typeobj.rst:2153 msgid "" "static void\n" "local_finalize(PyObject *self)\n" "{\n" -" PyObject *error_type, *error_value, *error_traceback;\n" -"\n" " /* Save the current exception, if any. */\n" -" PyErr_Fetch(&error_type, &error_value, &error_traceback);\n" +" PyObject *exc = PyErr_GetRaisedException();\n" "\n" " /* ... */\n" "\n" " /* Restore the saved exception. */\n" -" PyErr_Restore(error_type, error_value, error_traceback);\n" +" PyErr_SetRaisedException(exc);\n" "}" msgstr "" -#: ../../c-api/typeobj.rst:2133 +#: ../../c-api/typeobj.rst:2173 msgid "" -"Before version 3.8 it was necessary to set the :c:macro:" -"`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be used. " -"This is no longer required." +"Before version 3.8 it was necessary to set " +"the :c:macro:`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to " +"be used. This is no longer required." msgstr "" -#: ../../c-api/typeobj.rst:2137 +#: ../../c-api/typeobj.rst:2177 msgid "\"Safe object finalization\" (:pep:`442`)" msgstr "" -#: ../../c-api/typeobj.rst:2142 +#: ../../c-api/typeobj.rst:2182 msgid "" "Vectorcall function to use for calls of this type object. In other words, it " "is used to implement :ref:`vectorcall <vectorcall>` for ``type.__call__``. " -"If ``tp_vectorcall`` is ``NULL``, the default call implementation using :" -"meth:`~object.__new__` and :meth:`~object.__init__` is used." +"If ``tp_vectorcall`` is ``NULL``, the default call implementation " +"using :meth:`~object.__new__` and :meth:`~object.__init__` is used." msgstr "" -#: ../../c-api/typeobj.rst:2150 +#: ../../c-api/typeobj.rst:2190 msgid "This field is never inherited." msgstr "" -#: ../../c-api/typeobj.rst:2152 +#: ../../c-api/typeobj.rst:2192 msgid "(the field exists since 3.8 but it's only used since 3.9)" msgstr "" -#: ../../c-api/typeobj.rst:2157 +#: ../../c-api/typeobj.rst:2197 msgid "Internal. Do not use." msgstr "" -#: ../../c-api/typeobj.rst:2165 +#: ../../c-api/typeobj.rst:2205 msgid "Static Types" msgstr "" -#: ../../c-api/typeobj.rst:2167 +#: ../../c-api/typeobj.rst:2207 msgid "" -"Traditionally, types defined in C code are *static*, that is, a static :c:" -"type:`PyTypeObject` structure is defined directly in code and initialized " -"using :c:func:`PyType_Ready`." +"Traditionally, types defined in C code are *static*, that is, a " +"static :c:type:`PyTypeObject` structure is defined directly in code and " +"initialized using :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2171 +#: ../../c-api/typeobj.rst:2211 msgid "" "This results in types that are limited relative to types defined in Python:" msgstr "" -#: ../../c-api/typeobj.rst:2173 +#: ../../c-api/typeobj.rst:2213 msgid "" "Static types are limited to one base, i.e. they cannot use multiple " "inheritance." msgstr "" -#: ../../c-api/typeobj.rst:2175 +#: ../../c-api/typeobj.rst:2215 msgid "" "Static type objects (but not necessarily their instances) are immutable. It " "is not possible to add or modify the type object's attributes from Python." msgstr "" -#: ../../c-api/typeobj.rst:2177 +#: ../../c-api/typeobj.rst:2217 msgid "" "Static type objects are shared across :ref:`sub-interpreters <sub-" "interpreter-support>`, so they should not include any subinterpreter-" "specific state." msgstr "" -#: ../../c-api/typeobj.rst:2181 +#: ../../c-api/typeobj.rst:2221 msgid "" "Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API " "<limited-c-api>` as an opaque struct, any extension modules using static " "types must be compiled for a specific Python minor version." msgstr "" -#: ../../c-api/typeobj.rst:2189 +#: ../../c-api/typeobj.rst:2229 msgid "Heap Types" msgstr "" -#: ../../c-api/typeobj.rst:2191 +#: ../../c-api/typeobj.rst:2231 msgid "" "An alternative to :ref:`static types <static-types>` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " -"created by Python's ``class`` statement. Heap types have the :c:macro:" -"`Py_TPFLAGS_HEAPTYPE` flag set." +"created by Python's ``class`` statement. Heap types have " +"the :c:macro:`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" -#: ../../c-api/typeobj.rst:2196 +#: ../../c-api/typeobj.rst:2236 msgid "" -"This is done by filling a :c:type:`PyType_Spec` structure and calling :c:" -"func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:" -"`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`." +"This is done by filling a :c:type:`PyType_Spec` structure and " +"calling :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:`PyType_FromModuleAndSpec`, " +"or :c:func:`PyType_FromMetaclass`." msgstr "" -#: ../../c-api/typeobj.rst:2204 +#: ../../c-api/typeobj.rst:2244 msgid "Number Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2211 +#: ../../c-api/typeobj.rst:2251 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the number protocol. Each function is used by the function of " "similar name documented in the :ref:`number` section." msgstr "" -#: ../../c-api/typeobj.rst:2217 ../../c-api/typeobj.rst:2541 +#: ../../c-api/typeobj.rst:2257 ../../c-api/typeobj.rst:2581 msgid "Here is the structure definition::" msgstr "" -#: ../../c-api/typeobj.rst:2219 +#: ../../c-api/typeobj.rst:2259 msgid "" "typedef struct {\n" " binaryfunc nb_add;\n" @@ -3515,7 +3598,7 @@ msgstr "" " binaryfunc nb_inplace_matrix_multiply;\n" "} PyNumberMethods;" -#: ../../c-api/typeobj.rst:2264 +#: ../../c-api/typeobj.rst:2304 msgid "" "Binary and ternary functions must check the type of all their operands, and " "implement the necessary conversions (at least one of the operands is an " @@ -3525,81 +3608,82 @@ msgid "" "and set an exception." msgstr "" -#: ../../c-api/typeobj.rst:2273 +#: ../../c-api/typeobj.rst:2313 msgid "" "The :c:member:`~PyNumberMethods.nb_reserved` field should always be " "``NULL``. It was previously called :c:member:`!nb_long`, and was renamed in " "Python 3.0.1." msgstr "" -#: ../../c-api/typeobj.rst:2318 +#: ../../c-api/typeobj.rst:2358 msgid "Mapping Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2325 +#: ../../c-api/typeobj.rst:2365 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the mapping protocol. It has three members:" msgstr "" -#: ../../c-api/typeobj.rst:2330 +#: ../../c-api/typeobj.rst:2370 msgid "" -"This function is used by :c:func:`PyMapping_Size` and :c:func:" -"`PyObject_Size`, and has the same signature. This slot may be set to " -"``NULL`` if the object has no defined length." +"This function is used by :c:func:`PyMapping_Size` " +"and :c:func:`PyObject_Size`, and has the same signature. This slot may be " +"set to ``NULL`` if the object has no defined length." msgstr "" -#: ../../c-api/typeobj.rst:2336 +#: ../../c-api/typeobj.rst:2376 msgid "" -"This function is used by :c:func:`PyObject_GetItem` and :c:func:" -"`PySequence_GetSlice`, and has the same signature as :c:func:`!" -"PyObject_GetItem`. This slot must be filled for the :c:func:" -"`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." +"This function is used by :c:func:`PyObject_GetItem` " +"and :c:func:`PySequence_GetSlice`, and has the same signature as :c:func:`!" +"PyObject_GetItem`. This slot must be filled for " +"the :c:func:`PyMapping_Check` function to return ``1``, it can be ``NULL`` " +"otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2344 +#: ../../c-api/typeobj.rst:2384 msgid "" -"This function is used by :c:func:`PyObject_SetItem`, :c:func:" -"`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:" -"`PySequence_DelSlice`. It has the same signature as :c:func:`!" +"This function is used " +"by :c:func:`PyObject_SetItem`, :c:func:`PyObject_DelItem`, :c:func:`PySequence_SetSlice` " +"and :c:func:`PySequence_DelSlice`. It has the same signature as :c:func:`!" "PyObject_SetItem`, but *v* can also be set to ``NULL`` to delete an item. " "If this slot is ``NULL``, the object does not support item assignment and " "deletion." msgstr "" -#: ../../c-api/typeobj.rst:2355 +#: ../../c-api/typeobj.rst:2395 msgid "Sequence Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2362 +#: ../../c-api/typeobj.rst:2402 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the sequence protocol." msgstr "" -#: ../../c-api/typeobj.rst:2367 +#: ../../c-api/typeobj.rst:2407 msgid "" -"This function is used by :c:func:`PySequence_Size` and :c:func:" -"`PyObject_Size`, and has the same signature. It is also used for handling " -"negative indices via the :c:member:`~PySequenceMethods.sq_item` and the :c:" -"member:`~PySequenceMethods.sq_ass_item` slots." +"This function is used by :c:func:`PySequence_Size` " +"and :c:func:`PyObject_Size`, and has the same signature. It is also used " +"for handling negative indices via the :c:member:`~PySequenceMethods.sq_item` " +"and the :c:member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" -#: ../../c-api/typeobj.rst:2374 +#: ../../c-api/typeobj.rst:2414 msgid "" "This function is used by :c:func:`PySequence_Concat` and has the same " "signature. It is also used by the ``+`` operator, after trying the numeric " "addition via the :c:member:`~PyNumberMethods.nb_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2380 +#: ../../c-api/typeobj.rst:2420 msgid "" "This function is used by :c:func:`PySequence_Repeat` and has the same " "signature. It is also used by the ``*`` operator, after trying numeric " "multiplication via the :c:member:`~PyNumberMethods.nb_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2386 +#: ../../c-api/typeobj.rst:2426 msgid "" "This function is used by :c:func:`PySequence_GetItem` and has the same " "signature. It is also used by :c:func:`PyObject_GetItem`, after trying the " @@ -3608,42 +3692,43 @@ msgid "" "``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2392 +#: ../../c-api/typeobj.rst:2432 msgid "" -"Negative indexes are handled as follows: if the :c:member:" -"`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " -"length is used to compute a positive index which is passed to :c:member:" -"`~PySequenceMethods.sq_item`. If :c:member:`!sq_length` is ``NULL``, the " -"index is passed as is to the function." +"Negative indexes are handled as follows: if " +"the :c:member:`~PySequenceMethods.sq_length` slot is filled, it is called " +"and the sequence length is used to compute a positive index which is passed " +"to :c:member:`~PySequenceMethods.sq_item`. If :c:member:`!sq_length` is " +"``NULL``, the index is passed as is to the function." msgstr "" -#: ../../c-api/typeobj.rst:2399 +#: ../../c-api/typeobj.rst:2439 msgid "" "This function is used by :c:func:`PySequence_SetItem` and has the same " -"signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:" -"`PyObject_DelItem`, after trying the item assignment and deletion via the :c:" -"member:`~PyMappingMethods.mp_ass_subscript` slot. This slot may be left to " -"``NULL`` if the object does not support item assignment and deletion." +"signature. It is also used by :c:func:`PyObject_SetItem` " +"and :c:func:`PyObject_DelItem`, after trying the item assignment and " +"deletion via the :c:member:`~PyMappingMethods.mp_ass_subscript` slot. This " +"slot may be left to ``NULL`` if the object does not support item assignment " +"and deletion." msgstr "" -#: ../../c-api/typeobj.rst:2408 +#: ../../c-api/typeobj.rst:2448 msgid "" "This function may be used by :c:func:`PySequence_Contains` and has the same " "signature. This slot may be left to ``NULL``, in this case :c:func:`!" "PySequence_Contains` simply traverses the sequence until it finds a match." msgstr "" -#: ../../c-api/typeobj.rst:2415 +#: ../../c-api/typeobj.rst:2455 msgid "" "This function is used by :c:func:`PySequence_InPlaceConcat` and has the same " "signature. It should modify its first operand, and return it. This slot " "may be left to ``NULL``, in this case :c:func:`!PySequence_InPlaceConcat` " "will fall back to :c:func:`PySequence_Concat`. It is also used by the " -"augmented assignment ``+=``, after trying numeric in-place addition via the :" -"c:member:`~PyNumberMethods.nb_inplace_add` slot." +"augmented assignment ``+=``, after trying numeric in-place addition via " +"the :c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2424 +#: ../../c-api/typeobj.rst:2464 msgid "" "This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -3653,76 +3738,76 @@ msgid "" "via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2435 +#: ../../c-api/typeobj.rst:2475 msgid "Buffer Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2443 +#: ../../c-api/typeobj.rst:2483 msgid "" "This structure holds pointers to the functions required by the :ref:`Buffer " "protocol <bufferobjects>`. The protocol defines how an exporter object can " "expose its internal data to consumer objects." msgstr "" -#: ../../c-api/typeobj.rst:2449 ../../c-api/typeobj.rst:2498 -#: ../../c-api/typeobj.rst:2552 ../../c-api/typeobj.rst:2563 -#: ../../c-api/typeobj.rst:2575 ../../c-api/typeobj.rst:2585 +#: ../../c-api/typeobj.rst:2489 ../../c-api/typeobj.rst:2538 +#: ../../c-api/typeobj.rst:2592 ../../c-api/typeobj.rst:2603 +#: ../../c-api/typeobj.rst:2615 ../../c-api/typeobj.rst:2625 msgid "The signature of this function is::" msgstr "" -#: ../../c-api/typeobj.rst:2451 +#: ../../c-api/typeobj.rst:2491 msgid "int (PyObject *exporter, Py_buffer *view, int flags);" msgstr "int (PyObject *exporter, Py_buffer *view, int flags);" -#: ../../c-api/typeobj.rst:2453 +#: ../../c-api/typeobj.rst:2493 msgid "" "Handle a request to *exporter* to fill in *view* as specified by *flags*. " "Except for point (3), an implementation of this function MUST take these " "steps:" msgstr "" -#: ../../c-api/typeobj.rst:2457 +#: ../../c-api/typeobj.rst:2497 msgid "" -"Check if the request can be met. If not, raise :exc:`BufferError`, set :c:" -"expr:`view->obj` to ``NULL`` and return ``-1``." +"Check if the request can be met. If not, raise :exc:`BufferError`, " +"set :c:expr:`view->obj` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:2460 +#: ../../c-api/typeobj.rst:2500 msgid "Fill in the requested fields." msgstr "" -#: ../../c-api/typeobj.rst:2462 +#: ../../c-api/typeobj.rst:2502 msgid "Increment an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2464 +#: ../../c-api/typeobj.rst:2504 msgid "" "Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`." msgstr "" -#: ../../c-api/typeobj.rst:2466 +#: ../../c-api/typeobj.rst:2506 msgid "Return ``0``." msgstr "回傳 ``0``。" -#: ../../c-api/typeobj.rst:2468 +#: ../../c-api/typeobj.rst:2508 msgid "" "If *exporter* is part of a chain or tree of buffer providers, two main " "schemes can be used:" msgstr "" -#: ../../c-api/typeobj.rst:2471 +#: ../../c-api/typeobj.rst:2511 msgid "" -"Re-export: Each member of the tree acts as the exporting object and sets :c:" -"expr:`view->obj` to a new reference to itself." +"Re-export: Each member of the tree acts as the exporting object and " +"sets :c:expr:`view->obj` to a new reference to itself." msgstr "" -#: ../../c-api/typeobj.rst:2474 +#: ../../c-api/typeobj.rst:2514 msgid "" "Redirect: The buffer request is redirected to the root object of the tree. " "Here, :c:expr:`view->obj` will be a new reference to the root object." msgstr "" -#: ../../c-api/typeobj.rst:2478 +#: ../../c-api/typeobj.rst:2518 msgid "" "The individual fields of *view* are described in section :ref:`Buffer " "structure <buffer-structure>`, the rules how an exporter must react to " @@ -3730,32 +3815,31 @@ msgid "" "types>`." msgstr "" -#: ../../c-api/typeobj.rst:2483 +#: ../../c-api/typeobj.rst:2523 msgid "" "All memory pointed to in the :c:type:`Py_buffer` structure belongs to the " -"exporter and must remain valid until there are no consumers left. :c:member:" -"`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer." -"strides`, :c:member:`~Py_buffer.suboffsets` and :c:member:`~Py_buffer." -"internal` are read-only for the consumer." +"exporter and must remain valid until there are no consumers " +"left. :c:member:`~Py_buffer.format`, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer.strides`, :c:member:`~Py_buffer.suboffsets` " +"and :c:member:`~Py_buffer.internal` are read-only for the consumer." msgstr "" -#: ../../c-api/typeobj.rst:2490 +#: ../../c-api/typeobj.rst:2530 msgid "" ":c:func:`PyBuffer_FillInfo` provides an easy way of exposing a simple bytes " "buffer while dealing correctly with all request types." msgstr "" -#: ../../c-api/typeobj.rst:2493 +#: ../../c-api/typeobj.rst:2533 msgid "" ":c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps " "this function." msgstr "" -#: ../../c-api/typeobj.rst:2500 +#: ../../c-api/typeobj.rst:2540 msgid "void (PyObject *exporter, Py_buffer *view);" msgstr "void (PyObject *exporter, Py_buffer *view);" -#: ../../c-api/typeobj.rst:2502 +#: ../../c-api/typeobj.rst:2542 msgid "" "Handle a request to release the resources of the buffer. If no resources " "need to be released, :c:member:`PyBufferProcs.bf_releasebuffer` may be " @@ -3763,15 +3847,15 @@ msgid "" "these optional steps:" msgstr "" -#: ../../c-api/typeobj.rst:2507 +#: ../../c-api/typeobj.rst:2547 msgid "Decrement an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2509 +#: ../../c-api/typeobj.rst:2549 msgid "If the counter is ``0``, free all memory associated with *view*." msgstr "" -#: ../../c-api/typeobj.rst:2511 +#: ../../c-api/typeobj.rst:2551 msgid "" "The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep " "track of buffer-specific resources. This field is guaranteed to remain " @@ -3779,30 +3863,30 @@ msgid "" "*view* argument." msgstr "" -#: ../../c-api/typeobj.rst:2517 +#: ../../c-api/typeobj.rst:2557 msgid "" "This function MUST NOT decrement :c:expr:`view->obj`, since that is done " "automatically in :c:func:`PyBuffer_Release` (this scheme is useful for " "breaking reference cycles)." msgstr "" -#: ../../c-api/typeobj.rst:2522 +#: ../../c-api/typeobj.rst:2562 msgid "" ":c:func:`PyBuffer_Release` is the interface for the consumer that wraps this " "function." msgstr "" -#: ../../c-api/typeobj.rst:2530 +#: ../../c-api/typeobj.rst:2570 msgid "Async Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2538 +#: ../../c-api/typeobj.rst:2578 msgid "" -"This structure holds pointers to the functions required to implement :term:" -"`awaitable` and :term:`asynchronous iterator` objects." +"This structure holds pointers to the functions required to " +"implement :term:`awaitable` and :term:`asynchronous iterator` objects." msgstr "" -#: ../../c-api/typeobj.rst:2543 +#: ../../c-api/typeobj.rst:2583 msgid "" "typedef struct {\n" " unaryfunc am_await;\n" @@ -3818,149 +3902,150 @@ msgstr "" " sendfunc am_send;\n" "} PyAsyncMethods;" -#: ../../c-api/typeobj.rst:2554 +#: ../../c-api/typeobj.rst:2594 msgid "PyObject *am_await(PyObject *self);" msgstr "" -#: ../../c-api/typeobj.rst:2556 +#: ../../c-api/typeobj.rst:2596 msgid "" "The returned object must be an :term:`iterator`, i.e. :c:func:`PyIter_Check` " "must return ``1`` for it." msgstr "" -#: ../../c-api/typeobj.rst:2559 +#: ../../c-api/typeobj.rst:2599 msgid "" "This slot may be set to ``NULL`` if an object is not an :term:`awaitable`." msgstr "" -#: ../../c-api/typeobj.rst:2565 +#: ../../c-api/typeobj.rst:2605 msgid "PyObject *am_aiter(PyObject *self);" msgstr "PyObject *am_aiter(PyObject *self);" -#: ../../c-api/typeobj.rst:2567 +#: ../../c-api/typeobj.rst:2607 msgid "" -"Must return an :term:`asynchronous iterator` object. See :meth:`~object." -"__anext__` for details." +"Must return an :term:`asynchronous iterator` object. " +"See :meth:`~object.__anext__` for details." msgstr "" -#: ../../c-api/typeobj.rst:2570 +#: ../../c-api/typeobj.rst:2610 msgid "" "This slot may be set to ``NULL`` if an object does not implement " "asynchronous iteration protocol." msgstr "" -#: ../../c-api/typeobj.rst:2577 +#: ../../c-api/typeobj.rst:2617 msgid "PyObject *am_anext(PyObject *self);" msgstr "PyObject *am_anext(PyObject *self);" -#: ../../c-api/typeobj.rst:2579 +#: ../../c-api/typeobj.rst:2619 msgid "" "Must return an :term:`awaitable` object. See :meth:`~object.__anext__` for " "details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2587 +#: ../../c-api/typeobj.rst:2627 msgid "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" msgstr "" "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" -#: ../../c-api/typeobj.rst:2589 +#: ../../c-api/typeobj.rst:2629 msgid "" "See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2598 +#: ../../c-api/typeobj.rst:2638 msgid "Slot Type typedefs" msgstr "" -#: ../../c-api/typeobj.rst:2602 +#: ../../c-api/typeobj.rst:2642 msgid "" "The purpose of this function is to separate memory allocation from memory " "initialization. It should return a pointer to a block of memory of adequate " "length for the instance, suitably aligned, and initialized to zeros, but " -"with :c:member:`~PyObject.ob_refcnt` set to ``1`` and :c:member:`~PyObject." -"ob_type` set to the type argument. If the type's :c:member:`~PyTypeObject." -"tp_itemsize` is non-zero, the object's :c:member:`~PyVarObject.ob_size` " -"field should be initialized to *nitems* and the length of the allocated " -"memory block should be ``tp_basicsize + nitems*tp_itemsize``, rounded up to " -"a multiple of ``sizeof(void*)``; otherwise, *nitems* is not used and the " -"length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." +"with :c:member:`~PyObject.ob_refcnt` set to ``1`` " +"and :c:member:`~PyObject.ob_type` set to the type argument. If the " +"type's :c:member:`~PyTypeObject.tp_itemsize` is non-zero, the " +"object's :c:member:`~PyVarObject.ob_size` field should be initialized to " +"*nitems* and the length of the allocated memory block should be " +"``tp_basicsize + nitems*tp_itemsize``, rounded up to a multiple of " +"``sizeof(void*)``; otherwise, *nitems* is not used and the length of the " +"block should be :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:2612 +#: ../../c-api/typeobj.rst:2652 msgid "" "This function should not do any other instance initialization, not even to " -"allocate additional memory; that should be done by :c:member:`~PyTypeObject." -"tp_new`." +"allocate additional memory; that should be done " +"by :c:member:`~PyTypeObject.tp_new`." msgstr "" -#: ../../c-api/typeobj.rst:2619 +#: ../../c-api/typeobj.rst:2659 msgid "See :c:member:`~PyTypeObject.tp_free`." msgstr "請見 :c:member:`~PyTypeObject.tp_free`。" -#: ../../c-api/typeobj.rst:2623 +#: ../../c-api/typeobj.rst:2663 msgid "See :c:member:`~PyTypeObject.tp_new`." msgstr "請見 :c:member:`~PyTypeObject.tp_new`。" -#: ../../c-api/typeobj.rst:2627 +#: ../../c-api/typeobj.rst:2667 msgid "See :c:member:`~PyTypeObject.tp_init`." msgstr "請見 :c:member:`~PyTypeObject.tp_init`。" -#: ../../c-api/typeobj.rst:2631 +#: ../../c-api/typeobj.rst:2671 msgid "See :c:member:`~PyTypeObject.tp_repr`." msgstr "請見 :c:member:`~PyTypeObject.tp_repr`。" -#: ../../c-api/typeobj.rst:2635 ../../c-api/typeobj.rst:2644 +#: ../../c-api/typeobj.rst:2675 ../../c-api/typeobj.rst:2684 msgid "Return the value of the named attribute for the object." msgstr "" -#: ../../c-api/typeobj.rst:2639 ../../c-api/typeobj.rst:2650 +#: ../../c-api/typeobj.rst:2679 ../../c-api/typeobj.rst:2690 msgid "" "Set the value of the named attribute for the object. The value argument is " "set to ``NULL`` to delete the attribute." msgstr "" -#: ../../c-api/typeobj.rst:2646 +#: ../../c-api/typeobj.rst:2686 msgid "See :c:member:`~PyTypeObject.tp_getattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_getattro`。" -#: ../../c-api/typeobj.rst:2653 +#: ../../c-api/typeobj.rst:2693 msgid "See :c:member:`~PyTypeObject.tp_setattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_setattro`。" -#: ../../c-api/typeobj.rst:2657 +#: ../../c-api/typeobj.rst:2697 msgid "See :c:member:`~PyTypeObject.tp_descr_get`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_get`。" -#: ../../c-api/typeobj.rst:2661 +#: ../../c-api/typeobj.rst:2701 msgid "See :c:member:`~PyTypeObject.tp_descr_set`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_set`。" -#: ../../c-api/typeobj.rst:2665 +#: ../../c-api/typeobj.rst:2705 msgid "See :c:member:`~PyTypeObject.tp_hash`." msgstr "請見 :c:member:`~PyTypeObject.tp_hash`。" -#: ../../c-api/typeobj.rst:2669 +#: ../../c-api/typeobj.rst:2709 msgid "See :c:member:`~PyTypeObject.tp_richcompare`." msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" -#: ../../c-api/typeobj.rst:2673 +#: ../../c-api/typeobj.rst:2713 msgid "See :c:member:`~PyTypeObject.tp_iter`." msgstr "請見 :c:member:`~PyTypeObject.tp_iter`。" -#: ../../c-api/typeobj.rst:2677 +#: ../../c-api/typeobj.rst:2717 msgid "See :c:member:`~PyTypeObject.tp_iternext`." msgstr "請見 :c:member:`~PyTypeObject.tp_iternext`。" -#: ../../c-api/typeobj.rst:2691 +#: ../../c-api/typeobj.rst:2731 msgid "See :c:member:`~PyAsyncMethods.am_send`." msgstr "請見 :c:member:`~PyAsyncMethods.am_send`。" -#: ../../c-api/typeobj.rst:2707 +#: ../../c-api/typeobj.rst:2747 msgid "Examples" msgstr "範例" -#: ../../c-api/typeobj.rst:2709 +#: ../../c-api/typeobj.rst:2749 msgid "" "The following are simple examples of Python type definitions. They include " "common usage you may encounter. Some demonstrate tricky corner cases. For " @@ -3968,11 +4053,11 @@ msgid "" "and :ref:`new-types-topics`." msgstr "" -#: ../../c-api/typeobj.rst:2714 +#: ../../c-api/typeobj.rst:2754 msgid "A basic :ref:`static type <static-types>`::" msgstr "" -#: ../../c-api/typeobj.rst:2716 +#: ../../c-api/typeobj.rst:2756 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -3990,13 +4075,13 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2731 +#: ../../c-api/typeobj.rst:2771 msgid "" "You may also find older code (especially in the CPython code base) with a " "more verbose initializer::" msgstr "" -#: ../../c-api/typeobj.rst:2734 +#: ../../c-api/typeobj.rst:2774 msgid "" "static PyTypeObject MyObject_Type = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -4080,11 +4165,11 @@ msgstr "" " myobj_new, /* tp_new */\n" "};" -#: ../../c-api/typeobj.rst:2775 +#: ../../c-api/typeobj.rst:2815 msgid "A type that supports weakrefs, instance dicts, and hashing::" msgstr "" -#: ../../c-api/typeobj.rst:2777 +#: ../../c-api/typeobj.rst:2817 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4110,14 +4195,14 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2800 +#: ../../c-api/typeobj.rst:2840 msgid "" "A str subclass that cannot be subclassed and cannot be called to create " -"instances (e.g. uses a separate factory func) using :c:macro:" -"`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" +"instances (e.g. uses a separate factory func) " +"using :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" -#: ../../c-api/typeobj.rst:2804 +#: ../../c-api/typeobj.rst:2844 msgid "" "typedef struct {\n" " PyUnicodeObject raw;\n" @@ -4135,12 +4220,12 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2819 +#: ../../c-api/typeobj.rst:2859 msgid "" "The simplest :ref:`static type <static-types>` with fixed-length instances::" msgstr "" -#: ../../c-api/typeobj.rst:2821 +#: ../../c-api/typeobj.rst:2861 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4160,13 +4245,13 @@ msgstr "" " .tp_name = \"mymod.MyObject\",\n" "};" -#: ../../c-api/typeobj.rst:2830 +#: ../../c-api/typeobj.rst:2870 msgid "" "The simplest :ref:`static type <static-types>` with variable-length " "instances::" msgstr "" -#: ../../c-api/typeobj.rst:2832 +#: ../../c-api/typeobj.rst:2872 msgid "" "typedef struct {\n" " PyObject_VAR_HEAD\n" @@ -4192,14 +4277,14 @@ msgstr "" " .tp_itemsize = sizeof(char *),\n" "};" -#: ../../c-api/typeobj.rst:800 ../../c-api/typeobj.rst:865 +#: ../../c-api/typeobj.rst:842 ../../c-api/typeobj.rst:907 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/typeobj.rst:800 +#: ../../c-api/typeobj.rst:842 msgid "repr" msgstr "repr" -#: ../../c-api/typeobj.rst:865 +#: ../../c-api/typeobj.rst:907 msgid "hash" msgstr "hash(雜湊)" diff --git a/c-api/unicode.po b/c-api/unicode.po index 6049c55176..f29bafb0e6 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-21 00:13+0000\n" +"POT-Creation-Date: 2025-04-30 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,23 +41,25 @@ msgstr "" #: ../../c-api/unicode.rst:20 msgid "" "UTF-8 representation is created on demand and cached in the Unicode object." -msgstr "" +msgstr "UTF-8 表示法會在需要時建立並快取在 Unicode 物件中。" #: ../../c-api/unicode.rst:23 msgid "" "The :c:type:`Py_UNICODE` representation has been removed since Python 3.12 " "with deprecated APIs. See :pep:`623` for more information." msgstr "" +"自 Python 3.12 起,已移除 :c:type:`Py_UNICODE` 表示法,並標示為已棄用的 API。" +"更多資訊請參閱 :pep:`623`。" #: ../../c-api/unicode.rst:29 msgid "Unicode Type" -msgstr "" +msgstr "Unicode 型別" #: ../../c-api/unicode.rst:31 msgid "" "These are the basic Unicode object types used for the Unicode implementation " "in Python:" -msgstr "" +msgstr "這些是 Python 中用於 Unicode 實作的基本 Unicode 物件型別:" #: ../../c-api/unicode.rst:38 msgid "" @@ -88,59 +90,65 @@ msgstr "" #: ../../c-api/unicode.rst:71 msgid "" -"This instance of :c:type:`PyTypeObject` represents the Python Unicode type. " +"This instance of :c:type:`PyTypeObject` represents the Python Unicode type. " "It is exposed to Python code as ``str``." msgstr "" -#: ../../c-api/unicode.rst:75 +#: ../../c-api/unicode.rst:77 +msgid "" +"This instance of :c:type:`PyTypeObject` represents the Python Unicode " +"iterator type. It is used to iterate over Unicode string objects." +msgstr "" + +#: ../../c-api/unicode.rst:81 msgid "" "The following APIs are C macros and static inlined functions for fast checks " "and access to internal read-only data of Unicode objects:" msgstr "" -#: ../../c-api/unicode.rst:80 +#: ../../c-api/unicode.rst:86 msgid "" "Return true if the object *obj* is a Unicode object or an instance of a " "Unicode subtype. This function always succeeds." msgstr "" -#: ../../c-api/unicode.rst:86 +#: ../../c-api/unicode.rst:92 msgid "" "Return true if the object *obj* is a Unicode object, but not an instance of " "a subtype. This function always succeeds." msgstr "" -#: ../../c-api/unicode.rst:92 +#: ../../c-api/unicode.rst:98 msgid "Returns ``0``. This API is kept only for backward compatibility." -msgstr "" +msgstr "回傳 ``0``。此 API 僅保留以維持向後相容性。" -#: ../../c-api/unicode.rst:96 +#: ../../c-api/unicode.rst:102 msgid "This API does nothing since Python 3.12." -msgstr "" +msgstr "自 Python 3.12 起,此 API 不再執行任何動作。" -#: ../../c-api/unicode.rst:102 +#: ../../c-api/unicode.rst:108 msgid "" "Return the length of the Unicode string, in code points. *unicode* has to " "be a Unicode object in the \"canonical\" representation (not checked)." msgstr "" -#: ../../c-api/unicode.rst:112 +#: ../../c-api/unicode.rst:118 msgid "" "Return a pointer to the canonical representation cast to UCS1, UCS2 or UCS4 " "integer types for direct character access. No checks are performed if the " -"canonical representation has the correct character size; " -"use :c:func:`PyUnicode_KIND` to select the right function." +"canonical representation has the correct character size; use :c:func:" +"`PyUnicode_KIND` to select the right function." msgstr "" -#: ../../c-api/unicode.rst:124 +#: ../../c-api/unicode.rst:130 msgid "Return values of the :c:func:`PyUnicode_KIND` macro." msgstr "" -#: ../../c-api/unicode.rst:128 +#: ../../c-api/unicode.rst:134 msgid "``PyUnicode_WCHAR_KIND`` has been removed." msgstr "``PyUnicode_WCHAR_KIND`` 已被移除。" -#: ../../c-api/unicode.rst:134 +#: ../../c-api/unicode.rst:140 msgid "" "Return one of the PyUnicode kind constants (see above) that indicate how " "many bytes per character this Unicode object uses to store its data. " @@ -148,140 +156,137 @@ msgid "" "(not checked)." msgstr "" -#: ../../c-api/unicode.rst:143 +#: ../../c-api/unicode.rst:149 msgid "" "Return a void pointer to the raw Unicode buffer. *unicode* has to be a " "Unicode object in the \"canonical\" representation (not checked)." msgstr "" -#: ../../c-api/unicode.rst:152 +#: ../../c-api/unicode.rst:158 msgid "" -"Write into a canonical representation *data* (as obtained " -"with :c:func:`PyUnicode_DATA`). This function performs no sanity checks, " -"and is intended for usage in loops. The caller should cache the *kind* " -"value and *data* pointer as obtained from other calls. *index* is the index " -"in the string (starts at 0) and *value* is the new code point value which " -"should be written to that location." +"Write into a canonical representation *data* (as obtained with :c:func:" +"`PyUnicode_DATA`). This function performs no sanity checks, and is intended " +"for usage in loops. The caller should cache the *kind* value and *data* " +"pointer as obtained from other calls. *index* is the index in the string " +"(starts at 0) and *value* is the new code point value which should be " +"written to that location." msgstr "" -#: ../../c-api/unicode.rst:165 +#: ../../c-api/unicode.rst:171 msgid "" -"Read a code point from a canonical representation *data* (as obtained " -"with :c:func:`PyUnicode_DATA`). No checks or ready calls are performed." +"Read a code point from a canonical representation *data* (as obtained with :" +"c:func:`PyUnicode_DATA`). No checks or ready calls are performed." msgstr "" -#: ../../c-api/unicode.rst:173 +#: ../../c-api/unicode.rst:179 msgid "" "Read a character from a Unicode object *unicode*, which must be in the " -"\"canonical\" representation. This is less efficient " -"than :c:func:`PyUnicode_READ` if you do multiple consecutive reads." +"\"canonical\" representation. This is less efficient than :c:func:" +"`PyUnicode_READ` if you do multiple consecutive reads." msgstr "" -#: ../../c-api/unicode.rst:182 +#: ../../c-api/unicode.rst:188 msgid "" "Return the maximum code point that is suitable for creating another string " "based on *unicode*, which must be in the \"canonical\" representation. This " "is always an approximation but more efficient than iterating over the string." msgstr "" -#: ../../c-api/unicode.rst:191 +#: ../../c-api/unicode.rst:197 msgid "" "Return ``1`` if the string is a valid identifier according to the language " "definition, section :ref:`identifiers`. Return ``0`` otherwise." msgstr "" -#: ../../c-api/unicode.rst:194 +#: ../../c-api/unicode.rst:200 msgid "" "The function does not call :c:func:`Py_FatalError` anymore if the string is " "not ready." msgstr "" -#: ../../c-api/unicode.rst:200 +#: ../../c-api/unicode.rst:206 msgid "Unicode Character Properties" msgstr "" -#: ../../c-api/unicode.rst:202 +#: ../../c-api/unicode.rst:208 msgid "" "Unicode provides many different character properties. The most often needed " "ones are available through these macros which are mapped to C functions " "depending on the Python configuration." msgstr "" -#: ../../c-api/unicode.rst:209 +#: ../../c-api/unicode.rst:215 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a whitespace character." msgstr "根據 *ch* 是否為空白字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:214 +#: ../../c-api/unicode.rst:220 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a lowercase character." msgstr "根據 *ch* 是否為小寫字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:219 +#: ../../c-api/unicode.rst:225 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an uppercase character." msgstr "根據 *ch* 是否為大寫字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:224 +#: ../../c-api/unicode.rst:230 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a titlecase character." msgstr "根據 *ch* 是否為首字大寫字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:229 +#: ../../c-api/unicode.rst:235 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a linebreak character." msgstr "根據 *ch* 是否為換行字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:234 +#: ../../c-api/unicode.rst:240 msgid "Return ``1`` or ``0`` depending on whether *ch* is a decimal character." msgstr "根據 *ch* 是否為十進位字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:239 +#: ../../c-api/unicode.rst:245 msgid "Return ``1`` or ``0`` depending on whether *ch* is a digit character." msgstr "根據 *ch* 是否為數字 (digit) 字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:244 +#: ../../c-api/unicode.rst:250 msgid "Return ``1`` or ``0`` depending on whether *ch* is a numeric character." msgstr "根據 *ch* 是否為數值 (numeric) 字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:249 +#: ../../c-api/unicode.rst:255 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphabetic character." msgstr "根據 *ch* 是否為字母字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:254 +#: ../../c-api/unicode.rst:260 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphanumeric character." msgstr "根據 *ch* 是否為字母數字 (alphanumeric) 字元來回傳 ``1`` 或 ``0``。" -#: ../../c-api/unicode.rst:259 +#: ../../c-api/unicode.rst:265 msgid "" -"Return ``1`` or ``0`` depending on whether *ch* is a printable character. " -"Nonprintable characters are those characters defined in the Unicode " -"character database as \"Other\" or \"Separator\", excepting the ASCII space " -"(0x20) which is considered printable. (Note that printable characters in " -"this context are those which should not be escaped when :func:`repr` is " -"invoked on a string. It has no bearing on the handling of strings written " -"to :data:`sys.stdout` or :data:`sys.stderr`.)" +"Return ``1`` or ``0`` depending on whether *ch* is a printable character, in " +"the sense of :meth:`str.isprintable`." msgstr "" +"根據 *ch* 是否為可列印字元(如 :meth:`str.isprintable` 所定義)來回傳 ``1`` " +"或 ``0``。" -#: ../../c-api/unicode.rst:268 +#: ../../c-api/unicode.rst:269 msgid "These APIs can be used for fast direct character conversions:" -msgstr "" +msgstr "這些 API 可用於快速直接字元轉換:" -#: ../../c-api/unicode.rst:273 +#: ../../c-api/unicode.rst:274 msgid "Return the character *ch* converted to lower case." msgstr "回傳轉換為小寫的 *ch* 字元。" -#: ../../c-api/unicode.rst:278 +#: ../../c-api/unicode.rst:279 msgid "Return the character *ch* converted to upper case." msgstr "回傳轉換為大寫的 *ch* 字元。" -#: ../../c-api/unicode.rst:283 +#: ../../c-api/unicode.rst:284 msgid "Return the character *ch* converted to title case." msgstr "回傳轉換為首字大寫的 *ch* 字元。" -#: ../../c-api/unicode.rst:288 +#: ../../c-api/unicode.rst:289 msgid "" "Return the character *ch* converted to a decimal positive integer. Return " "``-1`` if this is not possible. This function does not raise exceptions." @@ -289,7 +294,7 @@ msgstr "" "回傳轉換為十進位正整數的 *ch* 字元,若無法轉換則回傳 ``-1``。此函式不會引發例" "外。" -#: ../../c-api/unicode.rst:294 +#: ../../c-api/unicode.rst:295 msgid "" "Return the character *ch* converted to a single digit integer. Return ``-1`` " "if this is not possible. This function does not raise exceptions." @@ -297,7 +302,7 @@ msgstr "" "回傳轉換為單一數字整數的 *ch* 字元,若無法轉換則回傳 ``-1``。此函式不會引發例" "外。" -#: ../../c-api/unicode.rst:300 +#: ../../c-api/unicode.rst:301 msgid "" "Return the character *ch* converted to a double. Return ``-1.0`` if this is " "not possible. This function does not raise exceptions." @@ -305,25 +310,25 @@ msgstr "" "回傳轉換為雙精度浮點數 (double) 的 *ch* 字元,若無法轉換則回傳 ``-1.0``。此函" "式不會引發例外。" -#: ../../c-api/unicode.rst:304 +#: ../../c-api/unicode.rst:305 msgid "These APIs can be used to work with surrogates:" msgstr "這些 API 可用於處理代理字元:" -#: ../../c-api/unicode.rst:308 +#: ../../c-api/unicode.rst:309 msgid "Check if *ch* is a surrogate (``0xD800 <= ch <= 0xDFFF``)." msgstr "檢查 *ch* 是否為代理字元 (surrogate, ``0xD800 <= ch <= 0xDFFF``)。" -#: ../../c-api/unicode.rst:312 +#: ../../c-api/unicode.rst:313 msgid "Check if *ch* is a high surrogate (``0xD800 <= ch <= 0xDBFF``)." msgstr "" "檢查 *ch* 是否為高代理字元 (high surrogate, ``0xD800 <= ch <= 0xDBFF``)。" -#: ../../c-api/unicode.rst:316 +#: ../../c-api/unicode.rst:317 msgid "Check if *ch* is a low surrogate (``0xDC00 <= ch <= 0xDFFF``)." msgstr "" "檢查 *ch* 是否為低代理字元 (low surrogate, ``0xDC00 <= ch <= 0xDFFF``)。" -#: ../../c-api/unicode.rst:320 +#: ../../c-api/unicode.rst:321 msgid "" "Join two surrogate code points and return a single :c:type:`Py_UCS4` value. " "*high* and *low* are respectively the leading and trailing surrogates in a " @@ -331,51 +336,50 @@ msgid "" "be in the range [0xDC00; 0xDFFF]." msgstr "" -#: ../../c-api/unicode.rst:327 +#: ../../c-api/unicode.rst:328 msgid "Creating and accessing Unicode strings" msgstr "" -#: ../../c-api/unicode.rst:329 +#: ../../c-api/unicode.rst:330 msgid "" "To create Unicode objects and access their basic sequence properties, use " "these APIs:" msgstr "" -#: ../../c-api/unicode.rst:334 +#: ../../c-api/unicode.rst:335 msgid "" "Create a new Unicode object. *maxchar* should be the true maximum code " "point to be placed in the string. As an approximation, it can be rounded up " "to the nearest value in the sequence 127, 255, 65535, 1114111." msgstr "" -#: ../../c-api/unicode.rst:338 +#: ../../c-api/unicode.rst:339 msgid "" "This is the recommended way to allocate a new Unicode object. Objects " "created using this function are not resizable." msgstr "" -#: ../../c-api/unicode.rst:341 +#: ../../c-api/unicode.rst:342 msgid "On error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:349 +#: ../../c-api/unicode.rst:350 msgid "" -"Create a new Unicode object with the given *kind* (possible values " -"are :c:macro:`PyUnicode_1BYTE_KIND` etc., as returned " -"by :c:func:`PyUnicode_KIND`). The *buffer* must point to an array of *size* " -"units of 1, 2 or 4 bytes per character, as given by the kind." +"Create a new Unicode object with the given *kind* (possible values are :c:" +"macro:`PyUnicode_1BYTE_KIND` etc., as returned by :c:func:" +"`PyUnicode_KIND`). The *buffer* must point to an array of *size* units of " +"1, 2 or 4 bytes per character, as given by the kind." msgstr "" -#: ../../c-api/unicode.rst:354 +#: ../../c-api/unicode.rst:355 msgid "" "If necessary, the input *buffer* is copied and transformed into the " -"canonical representation. For example, if the *buffer* is a UCS4 string " -"(:c:macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in the " -"UCS1 range, it will be transformed into UCS1 " -"(:c:macro:`PyUnicode_1BYTE_KIND`)." +"canonical representation. For example, if the *buffer* is a UCS4 string (:c:" +"macro:`PyUnicode_4BYTE_KIND`) and it consists only of codepoints in the UCS1 " +"range, it will be transformed into UCS1 (:c:macro:`PyUnicode_1BYTE_KIND`)." msgstr "" -#: ../../c-api/unicode.rst:365 +#: ../../c-api/unicode.rst:366 msgid "" "Create a Unicode object from the char buffer *str*. The bytes will be " "interpreted as being UTF-8 encoded. The buffer is copied into the new " @@ -383,29 +387,29 @@ msgid "" "data is not allowed." msgstr "" -#: ../../c-api/unicode.rst:371 +#: ../../c-api/unicode.rst:372 msgid "This function raises :exc:`SystemError` when:" -msgstr "" +msgstr "此函式在以下情況下會引發 :exc:`SystemError`:" -#: ../../c-api/unicode.rst:373 +#: ../../c-api/unicode.rst:374 msgid "*size* < 0," -msgstr "" +msgstr "*size* < 0," -#: ../../c-api/unicode.rst:374 +#: ../../c-api/unicode.rst:375 msgid "*str* is ``NULL`` and *size* > 0" -msgstr "" +msgstr "*str* 為 ``NULL`` 且 *size* > 0" -#: ../../c-api/unicode.rst:376 +#: ../../c-api/unicode.rst:377 msgid "*str* == ``NULL`` with *size* > 0 is not allowed anymore." -msgstr "" +msgstr "*str* == ``NULL`` 且 *size* > 0 不再被允許。" -#: ../../c-api/unicode.rst:382 +#: ../../c-api/unicode.rst:383 msgid "" "Create a Unicode object from a UTF-8 encoded null-terminated char buffer " "*str*." msgstr "" -#: ../../c-api/unicode.rst:388 +#: ../../c-api/unicode.rst:389 msgid "" "Take a C :c:func:`printf`\\ -style *format* string and a variable number of " "arguments, calculate the size of the resulting Python Unicode string and " @@ -414,31 +418,31 @@ msgid "" "*format* ASCII-encoded string." msgstr "" -#: ../../c-api/unicode.rst:394 +#: ../../c-api/unicode.rst:395 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../c-api/unicode.rst:397 +#: ../../c-api/unicode.rst:398 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../c-api/unicode.rst:399 +#: ../../c-api/unicode.rst:400 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../c-api/unicode.rst:402 +#: ../../c-api/unicode.rst:403 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " -"actual width is given in the next argument, which must be of " -"type :c:expr:`int`, and the object to convert comes after the minimum field " -"width and optional precision." +"actual width is given in the next argument, which must be of type :c:expr:" +"`int`, and the object to convert comes after the minimum field width and " +"optional precision." msgstr "" -#: ../../c-api/unicode.rst:407 +#: ../../c-api/unicode.rst:408 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. If " "specified as ``'*'`` (an asterisk), the actual precision is given in the " @@ -446,316 +450,316 @@ msgid "" "comes after the precision." msgstr "" -#: ../../c-api/unicode.rst:412 +#: ../../c-api/unicode.rst:413 msgid "Length modifier (optional)." msgstr "" -#: ../../c-api/unicode.rst:414 +#: ../../c-api/unicode.rst:415 msgid "Conversion type." msgstr "" -#: ../../c-api/unicode.rst:416 +#: ../../c-api/unicode.rst:417 msgid "The conversion flag characters are:" msgstr "" -#: ../../c-api/unicode.rst:421 +#: ../../c-api/unicode.rst:422 msgid "Flag" msgstr "旗標" -#: ../../c-api/unicode.rst:421 +#: ../../c-api/unicode.rst:422 msgid "Meaning" msgstr "含義" -#: ../../c-api/unicode.rst:423 +#: ../../c-api/unicode.rst:424 msgid "``0``" msgstr "``0``" -#: ../../c-api/unicode.rst:423 +#: ../../c-api/unicode.rst:424 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../c-api/unicode.rst:425 +#: ../../c-api/unicode.rst:426 msgid "``-``" msgstr "``-``" -#: ../../c-api/unicode.rst:425 +#: ../../c-api/unicode.rst:426 msgid "" "The converted value is left adjusted (overrides the ``0`` flag if both are " "given)." msgstr "" -#: ../../c-api/unicode.rst:429 +#: ../../c-api/unicode.rst:430 msgid "" "The length modifiers for following integer conversions (``d``, ``i``, ``o``, " "``u``, ``x``, or ``X``) specify the type of the argument (:c:expr:`int` by " "default):" msgstr "" -#: ../../c-api/unicode.rst:436 +#: ../../c-api/unicode.rst:437 msgid "Modifier" msgstr "" -#: ../../c-api/unicode.rst:436 +#: ../../c-api/unicode.rst:437 msgid "Types" msgstr "" -#: ../../c-api/unicode.rst:438 +#: ../../c-api/unicode.rst:439 msgid "``l``" msgstr "``l``" -#: ../../c-api/unicode.rst:438 +#: ../../c-api/unicode.rst:439 msgid ":c:expr:`long` or :c:expr:`unsigned long`" msgstr ":c:expr:`long` 或 :c:expr:`unsigned long`" -#: ../../c-api/unicode.rst:440 +#: ../../c-api/unicode.rst:441 msgid "``ll``" msgstr "``ll``" -#: ../../c-api/unicode.rst:440 +#: ../../c-api/unicode.rst:441 msgid ":c:expr:`long long` or :c:expr:`unsigned long long`" msgstr ":c:expr:`long long` 或 :c:expr:`unsigned long long`" -#: ../../c-api/unicode.rst:442 +#: ../../c-api/unicode.rst:443 msgid "``j``" msgstr "``j``" -#: ../../c-api/unicode.rst:442 +#: ../../c-api/unicode.rst:443 msgid ":c:type:`intmax_t` or :c:type:`uintmax_t`" msgstr ":c:type:`intmax_t` 或 :c:type:`uintmax_t`" -#: ../../c-api/unicode.rst:444 +#: ../../c-api/unicode.rst:445 msgid "``z``" msgstr "``z``" -#: ../../c-api/unicode.rst:444 +#: ../../c-api/unicode.rst:445 msgid ":c:type:`size_t` or :c:type:`ssize_t`" msgstr ":c:type:`size_t` 或 :c:type:`ssize_t`" -#: ../../c-api/unicode.rst:446 +#: ../../c-api/unicode.rst:447 msgid "``t``" msgstr "``t``" -#: ../../c-api/unicode.rst:446 +#: ../../c-api/unicode.rst:447 msgid ":c:type:`ptrdiff_t`" msgstr ":c:type:`ptrdiff_t`" -#: ../../c-api/unicode.rst:449 +#: ../../c-api/unicode.rst:450 msgid "" "The length modifier ``l`` for following conversions ``s`` or ``V`` specify " "that the type of the argument is :c:expr:`const wchar_t*`." msgstr "" -#: ../../c-api/unicode.rst:452 +#: ../../c-api/unicode.rst:453 msgid "The conversion specifiers are:" msgstr "" -#: ../../c-api/unicode.rst:458 +#: ../../c-api/unicode.rst:459 msgid "Conversion Specifier" msgstr "" -#: ../../c-api/unicode.rst:459 +#: ../../c-api/unicode.rst:460 msgid "Type" msgstr "" -#: ../../c-api/unicode.rst:460 +#: ../../c-api/unicode.rst:461 msgid "Comment" msgstr "" -#: ../../c-api/unicode.rst:462 +#: ../../c-api/unicode.rst:463 msgid "``%``" msgstr "``%``" -#: ../../c-api/unicode.rst:463 +#: ../../c-api/unicode.rst:464 msgid "*n/a*" msgstr "*n/a*" -#: ../../c-api/unicode.rst:464 +#: ../../c-api/unicode.rst:465 msgid "The literal ``%`` character." msgstr "字面 ``%`` 字元。" -#: ../../c-api/unicode.rst:466 +#: ../../c-api/unicode.rst:467 msgid "``d``, ``i``" msgstr "``d``, ``i``" -#: ../../c-api/unicode.rst:467 ../../c-api/unicode.rst:471 -#: ../../c-api/unicode.rst:475 ../../c-api/unicode.rst:479 -#: ../../c-api/unicode.rst:483 +#: ../../c-api/unicode.rst:468 ../../c-api/unicode.rst:472 +#: ../../c-api/unicode.rst:476 ../../c-api/unicode.rst:480 +#: ../../c-api/unicode.rst:484 msgid "Specified by the length modifier" msgstr "" -#: ../../c-api/unicode.rst:468 +#: ../../c-api/unicode.rst:469 msgid "The decimal representation of a signed C integer." msgstr "一個有符號 C 整數的十進位表示法。" -#: ../../c-api/unicode.rst:470 +#: ../../c-api/unicode.rst:471 msgid "``u``" msgstr "``u``" -#: ../../c-api/unicode.rst:472 +#: ../../c-api/unicode.rst:473 msgid "The decimal representation of an unsigned C integer." msgstr "一個無符號 C 整數的十進位表示法。" -#: ../../c-api/unicode.rst:474 +#: ../../c-api/unicode.rst:475 msgid "``o``" msgstr "``o``" -#: ../../c-api/unicode.rst:476 +#: ../../c-api/unicode.rst:477 msgid "The octal representation of an unsigned C integer." msgstr "一個無符號 C 整數的八進位表示法。" -#: ../../c-api/unicode.rst:478 +#: ../../c-api/unicode.rst:479 msgid "``x``" msgstr "``x``" -#: ../../c-api/unicode.rst:480 +#: ../../c-api/unicode.rst:481 msgid "The hexadecimal representation of an unsigned C integer (lowercase)." msgstr "一個無符號 C 整數的十六進位表示法(小寫)。" -#: ../../c-api/unicode.rst:482 +#: ../../c-api/unicode.rst:483 msgid "``X``" msgstr "``X``" -#: ../../c-api/unicode.rst:484 +#: ../../c-api/unicode.rst:485 msgid "The hexadecimal representation of an unsigned C integer (uppercase)." msgstr "一個無符號 C 整數的十六進位表示法(大寫)。" -#: ../../c-api/unicode.rst:486 +#: ../../c-api/unicode.rst:487 msgid "``c``" msgstr "``c``" -#: ../../c-api/unicode.rst:487 +#: ../../c-api/unicode.rst:488 msgid ":c:expr:`int`" msgstr ":c:expr:`int`" -#: ../../c-api/unicode.rst:488 +#: ../../c-api/unicode.rst:489 msgid "A single character." msgstr "一個單一字元。" -#: ../../c-api/unicode.rst:490 +#: ../../c-api/unicode.rst:491 msgid "``s``" msgstr "``s``" -#: ../../c-api/unicode.rst:491 +#: ../../c-api/unicode.rst:492 msgid ":c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`const char*` 或 :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:492 +#: ../../c-api/unicode.rst:493 msgid "A null-terminated C character array." msgstr "一個以 null 結尾的 C 字元陣列。" -#: ../../c-api/unicode.rst:494 +#: ../../c-api/unicode.rst:495 msgid "``p``" msgstr "``p``" -#: ../../c-api/unicode.rst:495 +#: ../../c-api/unicode.rst:496 msgid ":c:expr:`const void*`" msgstr ":c:expr:`const void*`" -#: ../../c-api/unicode.rst:496 +#: ../../c-api/unicode.rst:497 msgid "" "The hex representation of a C pointer. Mostly equivalent to " "``printf(\"%p\")`` except that it is guaranteed to start with the literal " "``0x`` regardless of what the platform's ``printf`` yields." msgstr "" -#: ../../c-api/unicode.rst:501 +#: ../../c-api/unicode.rst:502 msgid "``A``" msgstr "``A``" -#: ../../c-api/unicode.rst:502 ../../c-api/unicode.rst:506 -#: ../../c-api/unicode.rst:516 ../../c-api/unicode.rst:520 -#: ../../c-api/unicode.rst:524 ../../c-api/unicode.rst:529 +#: ../../c-api/unicode.rst:503 ../../c-api/unicode.rst:507 +#: ../../c-api/unicode.rst:517 ../../c-api/unicode.rst:521 +#: ../../c-api/unicode.rst:525 ../../c-api/unicode.rst:530 msgid ":c:expr:`PyObject*`" msgstr ":c:expr:`PyObject*`" -#: ../../c-api/unicode.rst:503 +#: ../../c-api/unicode.rst:504 msgid "The result of calling :func:`ascii`." msgstr "呼叫 :func:`ascii` 的結果。" -#: ../../c-api/unicode.rst:505 +#: ../../c-api/unicode.rst:506 msgid "``U``" msgstr "``U``" -#: ../../c-api/unicode.rst:507 +#: ../../c-api/unicode.rst:508 msgid "A Unicode object." msgstr "一個 Unicode 物件。" -#: ../../c-api/unicode.rst:509 +#: ../../c-api/unicode.rst:510 msgid "``V``" msgstr "``V``" -#: ../../c-api/unicode.rst:510 +#: ../../c-api/unicode.rst:511 msgid ":c:expr:`PyObject*`, :c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`PyObject*`、:c:expr:`const char*` 或 :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:511 +#: ../../c-api/unicode.rst:512 msgid "" "A Unicode object (which may be ``NULL``) and a null-terminated C character " "array as a second parameter (which will be used, if the first parameter is " "``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:515 +#: ../../c-api/unicode.rst:516 msgid "``S``" msgstr "``S``" -#: ../../c-api/unicode.rst:517 +#: ../../c-api/unicode.rst:518 msgid "The result of calling :c:func:`PyObject_Str`." msgstr "呼叫 :c:func:`PyObject_Str` 的結果。" -#: ../../c-api/unicode.rst:519 +#: ../../c-api/unicode.rst:520 msgid "``R``" msgstr "``R``" -#: ../../c-api/unicode.rst:521 +#: ../../c-api/unicode.rst:522 msgid "The result of calling :c:func:`PyObject_Repr`." msgstr "呼叫 :c:func:`PyObject_Repr` 的結果。" -#: ../../c-api/unicode.rst:523 +#: ../../c-api/unicode.rst:524 msgid "``T``" msgstr "``T``" -#: ../../c-api/unicode.rst:525 +#: ../../c-api/unicode.rst:526 msgid "" -"Get the fully qualified name of an object type; " -"call :c:func:`PyType_GetFullyQualifiedName`." +"Get the fully qualified name of an object type; call :c:func:" +"`PyType_GetFullyQualifiedName`." msgstr "" -#: ../../c-api/unicode.rst:528 +#: ../../c-api/unicode.rst:529 msgid "``#T``" msgstr "``#T``" -#: ../../c-api/unicode.rst:530 +#: ../../c-api/unicode.rst:531 msgid "" "Similar to ``T`` format, but use a colon (``:``) as separator between the " "module name and the qualified name." msgstr "" -#: ../../c-api/unicode.rst:533 +#: ../../c-api/unicode.rst:534 msgid "``N``" msgstr "``N``" -#: ../../c-api/unicode.rst:534 ../../c-api/unicode.rst:539 +#: ../../c-api/unicode.rst:535 ../../c-api/unicode.rst:540 msgid ":c:expr:`PyTypeObject*`" msgstr ":c:expr:`PyTypeObject*`" -#: ../../c-api/unicode.rst:535 +#: ../../c-api/unicode.rst:536 msgid "" -"Get the fully qualified name of a type; " -"call :c:func:`PyType_GetFullyQualifiedName`." +"Get the fully qualified name of a type; call :c:func:" +"`PyType_GetFullyQualifiedName`." msgstr "" -#: ../../c-api/unicode.rst:538 +#: ../../c-api/unicode.rst:539 msgid "``#N``" msgstr "``#N``" -#: ../../c-api/unicode.rst:540 +#: ../../c-api/unicode.rst:541 msgid "" "Similar to ``N`` format, but use a colon (``:``) as separator between the " "module name and the qualified name." msgstr "" -#: ../../c-api/unicode.rst:544 +#: ../../c-api/unicode.rst:545 msgid "" "The width formatter unit is number of characters rather than bytes. The " "precision formatter unit is number of bytes or :c:type:`wchar_t` items (if " @@ -765,22 +769,22 @@ msgid "" "``PyObject*`` argument is not ``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:552 +#: ../../c-api/unicode.rst:553 msgid "" "Unlike to C :c:func:`printf` the ``0`` flag has effect even when a precision " "is given for integer conversions (``d``, ``i``, ``u``, ``o``, ``x``, or " "``X``)." msgstr "" -#: ../../c-api/unicode.rst:556 +#: ../../c-api/unicode.rst:557 msgid "Support for ``\"%lld\"`` and ``\"%llu\"`` added." msgstr "新增對 ``\"%lld\"`` 和 ``\"%llu\"`` 的支援。" -#: ../../c-api/unicode.rst:559 +#: ../../c-api/unicode.rst:560 msgid "Support for ``\"%li\"``, ``\"%lli\"`` and ``\"%zi\"`` added." msgstr "新增對 ``\"%li\"``、``\"%lli\"`` 和 ``\"%zi\"`` 的支援。" -#: ../../c-api/unicode.rst:562 +#: ../../c-api/unicode.rst:563 msgid "" "Support width and precision formatter for ``\"%s\"``, ``\"%A\"``, " "``\"%U\"``, ``\"%V\"``, ``\"%S\"``, ``\"%R\"`` added." @@ -788,7 +792,7 @@ msgstr "" "新增對 ``\"%s\"``、``\"%A\"``、``\"%U\"``、``\"%V\"``、``\"%S\"``、" "``\"%R\"`` 的寬度和精確度格式化支援。" -#: ../../c-api/unicode.rst:566 +#: ../../c-api/unicode.rst:567 msgid "" "Support for conversion specifiers ``o`` and ``X``. Support for length " "modifiers ``j`` and ``t``. Length modifiers are now applied to all integer " @@ -797,68 +801,90 @@ msgid "" "flag ``-``." msgstr "" -#: ../../c-api/unicode.rst:574 +#: ../../c-api/unicode.rst:575 msgid "" "An unrecognized format character now sets a :exc:`SystemError`. In previous " "versions it caused all the rest of the format string to be copied as-is to " "the result string, and any extra arguments discarded." msgstr "" -#: ../../c-api/unicode.rst:578 +#: ../../c-api/unicode.rst:579 msgid "Support for ``%T``, ``%#T``, ``%N`` and ``%#N`` formats added." msgstr "新增對 ``%T``、``%#T``、``%N`` 和 ``%#N`` 格式的支援。" -#: ../../c-api/unicode.rst:584 +#: ../../c-api/unicode.rst:585 msgid "" "Identical to :c:func:`PyUnicode_FromFormat` except that it takes exactly two " "arguments." msgstr "" -#: ../../c-api/unicode.rst:590 +#: ../../c-api/unicode.rst:591 msgid "" "Copy an instance of a Unicode subtype to a new true Unicode object if " "necessary. If *obj* is already a true Unicode object (not a subtype), return " "a new :term:`strong reference` to the object." msgstr "" -#: ../../c-api/unicode.rst:594 +#: ../../c-api/unicode.rst:595 msgid "" "Objects other than Unicode or its subtypes will cause a :exc:`TypeError`." msgstr "" #: ../../c-api/unicode.rst:600 -msgid "Decode an encoded object *obj* to a Unicode object." +msgid "Create a Unicode Object from the given Unicode code point *ordinal*." msgstr "" #: ../../c-api/unicode.rst:602 msgid "" +"The ordinal must be in ``range(0x110000)``. A :exc:`ValueError` is raised in " +"the case it is not." +msgstr "" + +#: ../../c-api/unicode.rst:609 +msgid "Decode an encoded object *obj* to a Unicode object." +msgstr "" + +#: ../../c-api/unicode.rst:611 +msgid "" ":class:`bytes`, :class:`bytearray` and other :term:`bytes-like objects " "<bytes-like object>` are decoded according to the given *encoding* and using " "the error handling defined by *errors*. Both can be ``NULL`` to have the " "interface use the default values (see :ref:`builtincodecs` for details)." msgstr "" -#: ../../c-api/unicode.rst:608 +#: ../../c-api/unicode.rst:617 msgid "" "All other objects, including Unicode objects, cause a :exc:`TypeError` to be " "set." msgstr "" -#: ../../c-api/unicode.rst:611 +#: ../../c-api/unicode.rst:620 msgid "" "The API returns ``NULL`` if there was an error. The caller is responsible " "for decref'ing the returned objects." msgstr "" -#: ../../c-api/unicode.rst:617 +#: ../../c-api/unicode.rst:626 +msgid "" +"Return the name of the default string encoding, ``\"utf-8\"``. See :func:" +"`sys.getdefaultencoding`." +msgstr "" + +#: ../../c-api/unicode.rst:629 +msgid "" +"The returned string does not need to be freed, and is valid until " +"interpreter shutdown." +msgstr "" + +#: ../../c-api/unicode.rst:635 msgid "Return the length of the Unicode object, in code points." msgstr "" -#: ../../c-api/unicode.rst:619 +#: ../../c-api/unicode.rst:637 msgid "On error, set an exception and return ``-1``." msgstr "發生錯誤時,設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:630 +#: ../../c-api/unicode.rst:648 msgid "" "Copy characters from one Unicode object into another. This function " "performs character conversion when necessary and falls back to :c:func:`!" @@ -866,61 +892,61 @@ msgid "" "otherwise returns the number of copied characters." msgstr "" -#: ../../c-api/unicode.rst:641 +#: ../../c-api/unicode.rst:659 msgid "" -"Fill a string with a character: write *fill_char* into " -"``unicode[start:start+length]``." +"Fill a string with a character: write *fill_char* into ``unicode[start:" +"start+length]``." msgstr "" -#: ../../c-api/unicode.rst:644 +#: ../../c-api/unicode.rst:662 msgid "" "Fail if *fill_char* is bigger than the string maximum character, or if the " "string has more than 1 reference." msgstr "" -#: ../../c-api/unicode.rst:647 +#: ../../c-api/unicode.rst:665 msgid "" "Return the number of written character, or return ``-1`` and raise an " "exception on error." msgstr "" -#: ../../c-api/unicode.rst:656 +#: ../../c-api/unicode.rst:674 msgid "" -"Write a character to a string. The string must have been created " -"through :c:func:`PyUnicode_New`. Since Unicode strings are supposed to be " -"immutable, the string must not be shared, or have been hashed yet." +"Write a character to a string. The string must have been created through :c:" +"func:`PyUnicode_New`. Since Unicode strings are supposed to be immutable, " +"the string must not be shared, or have been hashed yet." msgstr "" -#: ../../c-api/unicode.rst:660 +#: ../../c-api/unicode.rst:678 msgid "" "This function checks that *unicode* is a Unicode object, that the index is " "not out of bounds, and that the object can be modified safely (i.e. that it " "its reference count is one)." msgstr "" -#: ../../c-api/unicode.rst:664 +#: ../../c-api/unicode.rst:682 msgid "Return ``0`` on success, ``-1`` on error with an exception set." msgstr "成功時回傳 ``0``,發生錯誤時設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:671 +#: ../../c-api/unicode.rst:689 msgid "" "Read a character from a string. This function checks that *unicode* is a " -"Unicode object and the index is not out of bounds, in contrast " -"to :c:func:`PyUnicode_READ_CHAR`, which performs no error checking." +"Unicode object and the index is not out of bounds, in contrast to :c:func:" +"`PyUnicode_READ_CHAR`, which performs no error checking." msgstr "" -#: ../../c-api/unicode.rst:675 +#: ../../c-api/unicode.rst:693 msgid "Return character on success, ``-1`` on error with an exception set." msgstr "成功時回傳字元,發生錯誤時設定例外並回傳 ``-1``。" -#: ../../c-api/unicode.rst:683 +#: ../../c-api/unicode.rst:701 msgid "" "Return a substring of *unicode*, from character index *start* (included) to " "character index *end* (excluded). Negative indices are not supported. On " "error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:693 +#: ../../c-api/unicode.rst:711 msgid "" "Copy the string *unicode* into a UCS4 buffer, including a null character, if " "*copy_null* is set. Returns ``NULL`` and sets an exception on error (in " @@ -928,25 +954,25 @@ msgid "" "*unicode*). *buffer* is returned on success." msgstr "" -#: ../../c-api/unicode.rst:703 +#: ../../c-api/unicode.rst:721 msgid "" -"Copy the string *unicode* into a new UCS4 buffer that is allocated " -"using :c:func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with " -"a :exc:`MemoryError` set. The returned buffer always has an extra null code " -"point appended." +"Copy the string *unicode* into a new UCS4 buffer that is allocated using :c:" +"func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:" +"`MemoryError` set. The returned buffer always has an extra null code point " +"appended." msgstr "" -#: ../../c-api/unicode.rst:712 +#: ../../c-api/unicode.rst:730 msgid "Locale Encoding" msgstr "" -#: ../../c-api/unicode.rst:714 +#: ../../c-api/unicode.rst:732 msgid "" "The current locale encoding can be used to decode text from the operating " "system." msgstr "" -#: ../../c-api/unicode.rst:721 +#: ../../c-api/unicode.rst:739 msgid "" "Decode a string from UTF-8 on Android and VxWorks, or from the current " "locale encoding on other platforms. The supported error handlers are " @@ -955,29 +981,29 @@ msgid "" "null character but cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:728 +#: ../../c-api/unicode.rst:746 msgid "" -"Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from " -"the :term:`filesystem encoding and error handler`." +"Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from the :" +"term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:731 ../../c-api/unicode.rst:766 +#: ../../c-api/unicode.rst:749 ../../c-api/unicode.rst:784 msgid "This function ignores the :ref:`Python UTF-8 Mode <utf8-mode>`." msgstr "此函式會忽略 :ref:`Python UTF-8 模式 <utf8-mode>`。" -#: ../../c-api/unicode.rst:735 ../../c-api/unicode.rst:851 +#: ../../c-api/unicode.rst:753 ../../c-api/unicode.rst:869 msgid "The :c:func:`Py_DecodeLocale` function." msgstr ":c:func:`Py_DecodeLocale` 函式。" -#: ../../c-api/unicode.rst:739 +#: ../../c-api/unicode.rst:757 msgid "" "The function now also uses the current locale encoding for the " -"``surrogateescape`` error handler, except on Android. " -"Previously, :c:func:`Py_DecodeLocale` was used for the ``surrogateescape``, " -"and the current locale encoding was used for ``strict``." +"``surrogateescape`` error handler, except on Android. Previously, :c:func:" +"`Py_DecodeLocale` was used for the ``surrogateescape``, and the current " +"locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:748 +#: ../../c-api/unicode.rst:766 msgid "" "Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string " "length using :c:func:`!strlen`." @@ -985,55 +1011,55 @@ msgstr "" "類似於 :c:func:`PyUnicode_DecodeLocaleAndSize`,但使用 :c:func:`!strlen` 計算" "字串長度。" -#: ../../c-api/unicode.rst:756 +#: ../../c-api/unicode.rst:774 msgid "" "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " "locale encoding on other platforms. The supported error handlers are " "``\"strict\"`` and ``\"surrogateescape\"`` (:pep:`383`). The encoder uses " -"``\"strict\"`` error handler if *errors* is ``NULL``. Return " -"a :class:`bytes` object. *unicode* cannot contain embedded null characters." +"``\"strict\"`` error handler if *errors* is ``NULL``. Return a :class:" +"`bytes` object. *unicode* cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:763 +#: ../../c-api/unicode.rst:781 msgid "" -"Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to " -"the :term:`filesystem encoding and error handler`." +"Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to the :term:" +"`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:770 ../../c-api/unicode.rst:882 +#: ../../c-api/unicode.rst:788 ../../c-api/unicode.rst:900 msgid "The :c:func:`Py_EncodeLocale` function." msgstr ":c:func:`Py_EncodeLocale` 函式。" -#: ../../c-api/unicode.rst:774 +#: ../../c-api/unicode.rst:792 msgid "" "The function now also uses the current locale encoding for the " -"``surrogateescape`` error handler, except on Android. " -"Previously, :c:func:`Py_EncodeLocale` was used for the ``surrogateescape``, " -"and the current locale encoding was used for ``strict``." +"``surrogateescape`` error handler, except on Android. Previously, :c:func:" +"`Py_EncodeLocale` was used for the ``surrogateescape``, and the current " +"locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:783 +#: ../../c-api/unicode.rst:801 msgid "File System Encoding" msgstr "檔案系統編碼" -#: ../../c-api/unicode.rst:785 +#: ../../c-api/unicode.rst:803 msgid "" "Functions encoding to and decoding from the :term:`filesystem encoding and " "error handler` (:pep:`383` and :pep:`529`)." msgstr "" -#: ../../c-api/unicode.rst:788 +#: ../../c-api/unicode.rst:806 msgid "" "To encode file names to :class:`bytes` during argument parsing, the " "``\"O&\"`` converter should be used, passing :c:func:`!" "PyUnicode_FSConverter` as the conversion function:" msgstr "" -#: ../../c-api/unicode.rst:794 +#: ../../c-api/unicode.rst:812 msgid "" ":ref:`PyArg_Parse\\* converter <arg-parsing>`: encode :class:`str` objects " -"-- obtained directly or through the :class:`os.PathLike` interface -- " -"to :class:`bytes` using :c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` " +"-- obtained directly or through the :class:`os.PathLike` interface -- to :" +"class:`bytes` using :c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` " "objects are output as-is. *result* must be an address of a C variable of " "type :c:expr:`PyObject*` (or :c:expr:`PyBytesObject*`). On success, set the " "variable to a new :term:`strong reference` to a :ref:`bytes object " @@ -1042,95 +1068,94 @@ msgid "" "not allowed in the result. On failure, return ``0`` with an exception set." msgstr "" -#: ../../c-api/unicode.rst:806 +#: ../../c-api/unicode.rst:824 msgid "" "If *obj* is ``NULL``, the function releases a strong reference stored in the " "variable referred by *result* and returns ``1``." msgstr "" -#: ../../c-api/unicode.rst:811 ../../c-api/unicode.rst:838 +#: ../../c-api/unicode.rst:829 ../../c-api/unicode.rst:856 msgid "Accepts a :term:`path-like object`." msgstr "接受一個 :term:`path-like object`。" -#: ../../c-api/unicode.rst:814 +#: ../../c-api/unicode.rst:832 msgid "" "To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` " "converter should be used, passing :c:func:`!PyUnicode_FSDecoder` as the " "conversion function:" msgstr "" -#: ../../c-api/unicode.rst:820 +#: ../../c-api/unicode.rst:838 msgid "" ":ref:`PyArg_Parse\\* converter <arg-parsing>`: decode :class:`bytes` objects " "-- obtained either directly or indirectly through the :class:`os.PathLike` " -"interface -- to :class:`str` " -"using :c:func:`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are " -"output as-is. *result* must be an address of a C variable of " -"type :c:expr:`PyObject*` (or :c:expr:`PyUnicodeObject*`). On success, set " -"the variable to a new :term:`strong reference` to a :ref:`Unicode object " -"<unicodeobjects>` which must be released when it is no longer used and " -"return a non-zero value (:c:macro:`Py_CLEANUP_SUPPORTED`). Embedded null " -"characters are not allowed in the result. On failure, return ``0`` with an " -"exception set." +"interface -- to :class:`str` using :c:func:" +"`PyUnicode_DecodeFSDefaultAndSize`; :class:`str` objects are output as-is. " +"*result* must be an address of a C variable of type :c:expr:`PyObject*` (or :" +"c:expr:`PyUnicodeObject*`). On success, set the variable to a new :term:" +"`strong reference` to a :ref:`Unicode object <unicodeobjects>` which must be " +"released when it is no longer used and return a non-zero value (:c:macro:" +"`Py_CLEANUP_SUPPORTED`). Embedded null characters are not allowed in the " +"result. On failure, return ``0`` with an exception set." msgstr "" -#: ../../c-api/unicode.rst:833 +#: ../../c-api/unicode.rst:851 msgid "" "If *obj* is ``NULL``, release the strong reference to the object referred to " "by *result* and return ``1``." msgstr "" -#: ../../c-api/unicode.rst:844 +#: ../../c-api/unicode.rst:862 msgid "Decode a string from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:846 +#: ../../c-api/unicode.rst:864 msgid "" -"If you need to decode a string from the current locale encoding, " -"use :c:func:`PyUnicode_DecodeLocaleAndSize`." +"If you need to decode a string from the current locale encoding, use :c:func:" +"`PyUnicode_DecodeLocaleAndSize`." msgstr "" -#: ../../c-api/unicode.rst:853 ../../c-api/unicode.rst:866 -#: ../../c-api/unicode.rst:886 +#: ../../c-api/unicode.rst:871 ../../c-api/unicode.rst:884 +#: ../../c-api/unicode.rst:904 msgid "" "The :term:`filesystem error handler <filesystem encoding and error handler>` " "is now used." msgstr "" -#: ../../c-api/unicode.rst:860 +#: ../../c-api/unicode.rst:878 msgid "" "Decode a null-terminated string from the :term:`filesystem encoding and " "error handler`." msgstr "" -#: ../../c-api/unicode.rst:863 +#: ../../c-api/unicode.rst:881 msgid "" -"If the string length is known, " -"use :c:func:`PyUnicode_DecodeFSDefaultAndSize`." +"If the string length is known, use :c:func:" +"`PyUnicode_DecodeFSDefaultAndSize`." msgstr "如果字串長度已知,請使用 :c:func:`PyUnicode_DecodeFSDefaultAndSize`。" -#: ../../c-api/unicode.rst:873 +#: ../../c-api/unicode.rst:891 msgid "" "Encode a Unicode object to the :term:`filesystem encoding and error " "handler`, and return :class:`bytes`. Note that the resulting :class:`bytes` " "object can contain null bytes." msgstr "" -#: ../../c-api/unicode.rst:877 +#: ../../c-api/unicode.rst:895 msgid "" -"If you need to encode a string to the current locale encoding, " -"use :c:func:`PyUnicode_EncodeLocale`." +"If you need to encode a string to the current locale encoding, use :c:func:" +"`PyUnicode_EncodeLocale`." msgstr "" -#: ../../c-api/unicode.rst:891 +#: ../../c-api/unicode.rst:909 msgid "wchar_t Support" msgstr "wchar_t 支援" -#: ../../c-api/unicode.rst:893 +#: ../../c-api/unicode.rst:911 msgid ":c:type:`wchar_t` support for platforms which support it:" msgstr "對支援 :c:type:`wchar_t` 的平台提供支援:" -#: ../../c-api/unicode.rst:897 +#: ../../c-api/unicode.rst:915 msgid "" "Create a Unicode object from the :c:type:`wchar_t` buffer *wstr* of the " "given *size*. Passing ``-1`` as the *size* indicates that the function must " @@ -1138,73 +1163,72 @@ msgid "" "failure." msgstr "" -#: ../../c-api/unicode.rst:905 +#: ../../c-api/unicode.rst:923 msgid "" "Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. " "At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly " -"trailing null termination character). Return the number " -"of :c:type:`wchar_t` characters copied or ``-1`` in case of an error." +"trailing null termination character). Return the number of :c:type:" +"`wchar_t` characters copied or ``-1`` in case of an error." msgstr "" -#: ../../c-api/unicode.rst:910 +#: ../../c-api/unicode.rst:928 msgid "" "When *wstr* is ``NULL``, instead return the *size* that would be required to " "store all of *unicode* including a terminating null." msgstr "" -#: ../../c-api/unicode.rst:913 +#: ../../c-api/unicode.rst:931 msgid "" "Note that the resulting :c:expr:`wchar_t*` string may or may not be null-" -"terminated. It is the responsibility of the caller to make sure that " -"the :c:expr:`wchar_t*` string is null-terminated in case this is required by " -"the application. Also, note that the :c:expr:`wchar_t*` string might contain " +"terminated. It is the responsibility of the caller to make sure that the :c:" +"expr:`wchar_t*` string is null-terminated in case this is required by the " +"application. Also, note that the :c:expr:`wchar_t*` string might contain " "null characters, which would cause the string to be truncated when used with " "most C functions." msgstr "" -#: ../../c-api/unicode.rst:923 +#: ../../c-api/unicode.rst:941 msgid "" "Convert the Unicode object to a wide character string. The output string " "always ends with a null character. If *size* is not ``NULL``, write the " "number of wide characters (excluding the trailing null termination " "character) into *\\*size*. Note that the resulting :c:type:`wchar_t` string " "might contain null characters, which would cause the string to be truncated " -"when used with most C functions. If *size* is ``NULL`` and " -"the :c:expr:`wchar_t*` string contains null characters a :exc:`ValueError` " -"is raised." +"when used with most C functions. If *size* is ``NULL`` and the :c:expr:" +"`wchar_t*` string contains null characters a :exc:`ValueError` is raised." msgstr "" -#: ../../c-api/unicode.rst:931 +#: ../../c-api/unicode.rst:949 msgid "" "Returns a buffer allocated by :c:macro:`PyMem_New` (use :c:func:`PyMem_Free` " "to free it) on success. On error, returns ``NULL`` and *\\*size* is " "undefined. Raises a :exc:`MemoryError` if memory allocation is failed." msgstr "" -#: ../../c-api/unicode.rst:938 +#: ../../c-api/unicode.rst:956 msgid "" "Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` " "string contains null characters." msgstr "" -#: ../../c-api/unicode.rst:946 +#: ../../c-api/unicode.rst:964 msgid "Built-in Codecs" msgstr "內建編解碼器" -#: ../../c-api/unicode.rst:948 +#: ../../c-api/unicode.rst:966 msgid "" "Python provides a set of built-in codecs which are written in C for speed. " "All of these codecs are directly usable via the following functions." msgstr "" -#: ../../c-api/unicode.rst:951 +#: ../../c-api/unicode.rst:969 msgid "" "Many of the following APIs take two arguments encoding and errors, and they " "have the same semantics as the ones of the built-in :func:`str` string " "object constructor." msgstr "" -#: ../../c-api/unicode.rst:955 +#: ../../c-api/unicode.rst:973 msgid "" "Setting encoding to ``NULL`` causes the default encoding to be used which is " "UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for " @@ -1212,28 +1236,28 @@ msgid "" "handler` internally." msgstr "" -#: ../../c-api/unicode.rst:960 +#: ../../c-api/unicode.rst:978 msgid "" "Error handling is set by errors which may also be set to ``NULL`` meaning to " "use the default handling defined for the codec. Default error handling for " "all built-in codecs is \"strict\" (:exc:`ValueError` is raised)." msgstr "" -#: ../../c-api/unicode.rst:964 +#: ../../c-api/unicode.rst:982 msgid "" "The codecs all use a similar interface. Only deviations from the following " "generic ones are documented for simplicity." msgstr "" -#: ../../c-api/unicode.rst:969 +#: ../../c-api/unicode.rst:987 msgid "Generic Codecs" msgstr "泛用編解碼器" -#: ../../c-api/unicode.rst:971 +#: ../../c-api/unicode.rst:989 msgid "These are the generic codec APIs:" msgstr "這些是泛用編解碼器的 API:" -#: ../../c-api/unicode.rst:977 +#: ../../c-api/unicode.rst:995 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string " "*str*. *encoding* and *errors* have the same meaning as the parameters of " @@ -1242,7 +1266,7 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:987 +#: ../../c-api/unicode.rst:1005 msgid "" "Encode a Unicode object and return the result as Python bytes object. " "*encoding* and *errors* have the same meaning as the parameters of the same " @@ -1251,21 +1275,21 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:995 +#: ../../c-api/unicode.rst:1013 msgid "UTF-8 Codecs" msgstr "UTF-8 編解碼器" -#: ../../c-api/unicode.rst:997 +#: ../../c-api/unicode.rst:1015 msgid "These are the UTF-8 codec APIs:" msgstr "這些是 UTF-8 編解碼器的 API:" -#: ../../c-api/unicode.rst:1002 +#: ../../c-api/unicode.rst:1020 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1009 +#: ../../c-api/unicode.rst:1027 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF8`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-8 byte sequences will " @@ -1273,20 +1297,20 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1017 +#: ../../c-api/unicode.rst:1035 msgid "" "Encode a Unicode object using UTF-8 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1021 ../../c-api/unicode.rst:1036 +#: ../../c-api/unicode.rst:1039 ../../c-api/unicode.rst:1054 msgid "" "The function fails if the string contains surrogate code points (``U+D800`` " "- ``U+DFFF``)." msgstr "" -#: ../../c-api/unicode.rst:1027 +#: ../../c-api/unicode.rst:1045 msgid "" "Return a pointer to the UTF-8 encoding of the Unicode object, and store the " "size of the encoded representation (in bytes) in *size*. The *size* " @@ -1295,7 +1319,7 @@ msgid "" "regardless of whether there are any other null code points." msgstr "" -#: ../../c-api/unicode.rst:1033 +#: ../../c-api/unicode.rst:1051 msgid "" "On error, set an exception, set *size* to ``-1`` (if it's not NULL) and " "return ``NULL``." @@ -1303,7 +1327,7 @@ msgstr "" "發生錯誤時,設定例外並將 *size* 設為 ``-1``\\ (如果不是 NULL),並回傳 " "``NULL``。" -#: ../../c-api/unicode.rst:1039 +#: ../../c-api/unicode.rst:1057 msgid "" "This caches the UTF-8 representation of the string in the Unicode object, " "and subsequent calls will return a pointer to the same buffer. The caller " @@ -1312,57 +1336,57 @@ msgid "" "collected." msgstr "" -#: ../../c-api/unicode.rst:1046 ../../c-api/unicode.rst:1068 +#: ../../c-api/unicode.rst:1064 ../../c-api/unicode.rst:1086 msgid "The return type is now ``const char *`` rather of ``char *``." msgstr "回傳型別現在是 ``const char *`` 而不是 ``char *``。" -#: ../../c-api/unicode.rst:1049 +#: ../../c-api/unicode.rst:1067 msgid "This function is a part of the :ref:`limited API <limited-c-api>`." msgstr "" -#: ../../c-api/unicode.rst:1055 +#: ../../c-api/unicode.rst:1073 msgid "As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size." msgstr "與 :c:func:`PyUnicode_AsUTF8AndSize` 類似,但不儲存大小。" -#: ../../c-api/unicode.rst:1059 +#: ../../c-api/unicode.rst:1077 msgid "" "This function does not have any special behavior for `null characters " "<https://en.wikipedia.org/wiki/Null_character>`_ embedded within *unicode*. " "As a result, strings containing null characters will remain in the returned " "string, which some C functions might interpret as the end of the string, " -"leading to truncation. If truncation is an issue, it is recommended to " -"use :c:func:`PyUnicode_AsUTF8AndSize` instead." +"leading to truncation. If truncation is an issue, it is recommended to use :" +"c:func:`PyUnicode_AsUTF8AndSize` instead." msgstr "" -#: ../../c-api/unicode.rst:1073 +#: ../../c-api/unicode.rst:1091 msgid "UTF-32 Codecs" msgstr "UTF-32 編解碼器" -#: ../../c-api/unicode.rst:1075 +#: ../../c-api/unicode.rst:1093 msgid "These are the UTF-32 codec APIs:" msgstr "這些是 UTF-32 編解碼器的 API:" -#: ../../c-api/unicode.rst:1081 +#: ../../c-api/unicode.rst:1099 msgid "" "Decode *size* bytes from a UTF-32 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1085 ../../c-api/unicode.rst:1135 +#: ../../c-api/unicode.rst:1103 ../../c-api/unicode.rst:1153 msgid "" "If *byteorder* is non-``NULL``, the decoder starts decoding using the given " "byte order::" msgstr "" -#: ../../c-api/unicode.rst:1088 ../../c-api/unicode.rst:1138 +#: ../../c-api/unicode.rst:1106 ../../c-api/unicode.rst:1156 msgid "" "*byteorder == -1: little endian\n" "*byteorder == 0: native order\n" "*byteorder == 1: big endian" msgstr "" -#: ../../c-api/unicode.rst:1092 +#: ../../c-api/unicode.rst:1110 msgid "" "If ``*byteorder`` is zero, and the first four bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1370,21 +1394,21 @@ msgid "" "``-1`` or ``1``, any byte order mark is copied to the output." msgstr "" -#: ../../c-api/unicode.rst:1097 +#: ../../c-api/unicode.rst:1115 msgid "" "After completion, *\\*byteorder* is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1100 ../../c-api/unicode.rst:1151 +#: ../../c-api/unicode.rst:1118 ../../c-api/unicode.rst:1169 msgid "If *byteorder* is ``NULL``, the codec starts in native order mode." msgstr "" -#: ../../c-api/unicode.rst:1102 ../../c-api/unicode.rst:1153 +#: ../../c-api/unicode.rst:1120 ../../c-api/unicode.rst:1171 msgid "Return ``NULL`` if an exception was raised by the codec." msgstr "如果編解碼器引發例外則回傳 ``NULL``。" -#: ../../c-api/unicode.rst:1108 +#: ../../c-api/unicode.rst:1126 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF32`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF32Stateful` will not " @@ -1393,29 +1417,29 @@ msgid "" "number of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1117 +#: ../../c-api/unicode.rst:1135 msgid "" "Return a Python byte string using the UTF-32 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1123 +#: ../../c-api/unicode.rst:1141 msgid "UTF-16 Codecs" msgstr "UTF-16 編解碼器" -#: ../../c-api/unicode.rst:1125 +#: ../../c-api/unicode.rst:1143 msgid "These are the UTF-16 codec APIs:" msgstr "這些是 UTF-16 編解碼器的 API:" -#: ../../c-api/unicode.rst:1131 +#: ../../c-api/unicode.rst:1149 msgid "" "Decode *size* bytes from a UTF-16 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1142 +#: ../../c-api/unicode.rst:1160 msgid "" "If ``*byteorder`` is zero, and the first two bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1424,13 +1448,13 @@ msgid "" "result in either a ``\\ufeff`` or a ``\\ufffe`` character)." msgstr "" -#: ../../c-api/unicode.rst:1148 +#: ../../c-api/unicode.rst:1166 msgid "" "After completion, ``*byteorder`` is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1159 +#: ../../c-api/unicode.rst:1177 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF16`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF16Stateful` will not " @@ -1440,28 +1464,28 @@ msgid "" "*consumed*." msgstr "" -#: ../../c-api/unicode.rst:1168 +#: ../../c-api/unicode.rst:1186 msgid "" "Return a Python byte string using the UTF-16 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1174 +#: ../../c-api/unicode.rst:1192 msgid "UTF-7 Codecs" msgstr "UTF-7 編解碼器" -#: ../../c-api/unicode.rst:1176 +#: ../../c-api/unicode.rst:1194 msgid "These are the UTF-7 codec APIs:" msgstr "這些是 UTF-7 編解碼器的 API:" -#: ../../c-api/unicode.rst:1181 +#: ../../c-api/unicode.rst:1199 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1188 +#: ../../c-api/unicode.rst:1206 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF7`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-7 base-64 sections will " @@ -1469,101 +1493,101 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1195 +#: ../../c-api/unicode.rst:1213 msgid "Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1197 +#: ../../c-api/unicode.rst:1215 msgid "These are the \"Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1203 +#: ../../c-api/unicode.rst:1221 msgid "" "Create a Unicode object by decoding *size* bytes of the Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1209 +#: ../../c-api/unicode.rst:1227 msgid "" "Encode a Unicode object using Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1215 +#: ../../c-api/unicode.rst:1233 msgid "Raw-Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1217 +#: ../../c-api/unicode.rst:1235 msgid "These are the \"Raw Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1223 +#: ../../c-api/unicode.rst:1241 msgid "" "Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1229 +#: ../../c-api/unicode.rst:1247 msgid "" "Encode a Unicode object using Raw-Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1235 +#: ../../c-api/unicode.rst:1253 msgid "Latin-1 Codecs" msgstr "Latin-1 編解碼器" -#: ../../c-api/unicode.rst:1237 +#: ../../c-api/unicode.rst:1255 msgid "" "These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 " "Unicode ordinals and only these are accepted by the codecs during encoding." msgstr "" -#: ../../c-api/unicode.rst:1243 +#: ../../c-api/unicode.rst:1261 msgid "" "Create a Unicode object by decoding *size* bytes of the Latin-1 encoded " "string *str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1249 +#: ../../c-api/unicode.rst:1267 msgid "" "Encode a Unicode object using Latin-1 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1255 +#: ../../c-api/unicode.rst:1273 msgid "ASCII Codecs" msgstr "ASCII 編解碼器" -#: ../../c-api/unicode.rst:1257 +#: ../../c-api/unicode.rst:1275 msgid "" "These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All " "other codes generate errors." msgstr "" -#: ../../c-api/unicode.rst:1263 +#: ../../c-api/unicode.rst:1281 msgid "" "Create a Unicode object by decoding *size* bytes of the ASCII encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1269 +#: ../../c-api/unicode.rst:1287 msgid "" "Encode a Unicode object using ASCII and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1275 +#: ../../c-api/unicode.rst:1293 msgid "Character Map Codecs" msgstr "" -#: ../../c-api/unicode.rst:1277 +#: ../../c-api/unicode.rst:1295 msgid "" "This codec is special in that it can be used to implement many different " "codecs (and this is in fact what was done to obtain most of the standard " @@ -1573,18 +1597,18 @@ msgid "" "sequences work well." msgstr "" -#: ../../c-api/unicode.rst:1283 +#: ../../c-api/unicode.rst:1301 msgid "These are the mapping codec APIs:" msgstr "這些是對映編解碼器的 API:" -#: ../../c-api/unicode.rst:1288 +#: ../../c-api/unicode.rst:1306 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string *str* " "using the given *mapping* object. Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1292 +#: ../../c-api/unicode.rst:1310 msgid "" "If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* " "must map bytes ordinals (integers in the range from 0 to 255) to Unicode " @@ -1594,14 +1618,14 @@ msgid "" "treated as undefined mappings and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1303 +#: ../../c-api/unicode.rst:1321 msgid "" "Encode a Unicode object using the given *mapping* object and return the " "result as a bytes object. Error handling is \"strict\". Return ``NULL`` if " "an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1307 +#: ../../c-api/unicode.rst:1325 msgid "" "The *mapping* object must map Unicode ordinal integers to bytes objects, " "integers in the range from 0 to 255 or ``None``. Unmapped character " @@ -1609,41 +1633,41 @@ msgid "" "``None`` are treated as \"undefined mapping\" and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1313 +#: ../../c-api/unicode.rst:1331 msgid "The following codec API is special in that maps Unicode to Unicode." msgstr "" -#: ../../c-api/unicode.rst:1317 +#: ../../c-api/unicode.rst:1335 msgid "" "Translate a string by applying a character mapping table to it and return " "the resulting Unicode object. Return ``NULL`` if an exception was raised by " "the codec." msgstr "" -#: ../../c-api/unicode.rst:1321 +#: ../../c-api/unicode.rst:1339 msgid "" "The mapping table must map Unicode ordinal integers to Unicode ordinal " "integers or ``None`` (causing deletion of the character)." msgstr "" -#: ../../c-api/unicode.rst:1324 +#: ../../c-api/unicode.rst:1342 msgid "" "Mapping tables need only provide the :meth:`~object.__getitem__` interface; " "dictionaries and sequences work well. Unmapped character ordinals (ones " "which cause a :exc:`LookupError`) are left untouched and are copied as-is." msgstr "" -#: ../../c-api/unicode.rst:1328 +#: ../../c-api/unicode.rst:1346 msgid "" "*errors* has the usual meaning for codecs. It may be ``NULL`` which " "indicates to use the default error handling." msgstr "" -#: ../../c-api/unicode.rst:1333 +#: ../../c-api/unicode.rst:1351 msgid "MBCS codecs for Windows" msgstr "Windows 的 MBCS 編解碼器" -#: ../../c-api/unicode.rst:1335 +#: ../../c-api/unicode.rst:1353 msgid "" "These are the MBCS codec APIs. They are currently only available on Windows " "and use the Win32 MBCS converters to implement the conversions. Note that " @@ -1651,13 +1675,13 @@ msgid "" "is defined by the user settings on the machine running the codec." msgstr "" -#: ../../c-api/unicode.rst:1342 +#: ../../c-api/unicode.rst:1360 msgid "" "Create a Unicode object by decoding *size* bytes of the MBCS encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1349 +#: ../../c-api/unicode.rst:1367 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeMBCS`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeMBCSStateful` will not " @@ -1665,44 +1689,50 @@ msgid "" "will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1357 +#: ../../c-api/unicode.rst:1376 +msgid "" +"Similar to :c:func:`PyUnicode_DecodeMBCSStateful`, except uses the code page " +"specified by *code_page*." +msgstr "" + +#: ../../c-api/unicode.rst:1382 msgid "" "Encode a Unicode object using MBCS and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1364 +#: ../../c-api/unicode.rst:1389 msgid "" "Encode the Unicode object using the specified code page and return a Python " -"bytes object. Return ``NULL`` if an exception was raised by the codec. " -"Use :c:macro:`!CP_ACP` code page to get the MBCS encoder." +"bytes object. Return ``NULL`` if an exception was raised by the codec. Use :" +"c:macro:`!CP_ACP` code page to get the MBCS encoder." msgstr "" -#: ../../c-api/unicode.rst:1372 +#: ../../c-api/unicode.rst:1397 msgid "Methods & Slots" msgstr "" -#: ../../c-api/unicode.rst:1378 +#: ../../c-api/unicode.rst:1403 msgid "Methods and Slot Functions" msgstr "" -#: ../../c-api/unicode.rst:1380 +#: ../../c-api/unicode.rst:1405 msgid "" "The following APIs are capable of handling Unicode objects and strings on " "input (we refer to them as strings in the descriptions) and return Unicode " "objects or integers as appropriate." msgstr "" -#: ../../c-api/unicode.rst:1384 +#: ../../c-api/unicode.rst:1409 msgid "They all return ``NULL`` or ``-1`` if an exception occurs." -msgstr "" +msgstr "如果發生例外,則回傳 ``NULL`` 或 ``-1``。" -#: ../../c-api/unicode.rst:1389 +#: ../../c-api/unicode.rst:1414 msgid "Concat two strings giving a new Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1394 +#: ../../c-api/unicode.rst:1419 msgid "" "Split a string giving a list of Unicode strings. If *sep* is ``NULL``, " "splitting will be done at all whitespace substrings. Otherwise, splits " @@ -1711,27 +1741,73 @@ msgid "" "list." msgstr "" -#: ../../c-api/unicode.rst:1402 +#: ../../c-api/unicode.rst:1424 ../../c-api/unicode.rst:1434 +#: ../../c-api/unicode.rst:1455 ../../c-api/unicode.rst:1468 +msgid "On error, return ``NULL`` with an exception set." +msgstr "於錯誤發生時回傳 ``NULL`` 並設定例外。" + +#: ../../c-api/unicode.rst:1426 +msgid "Equivalent to :py:meth:`str.split`." +msgstr "等價於 :py:meth:`str.split`。" + +#: ../../c-api/unicode.rst:1431 +msgid "" +"Similar to :c:func:`PyUnicode_Split`, but splitting will be done beginning " +"at the end of the string." +msgstr "" + +#: ../../c-api/unicode.rst:1436 +msgid "Equivalent to :py:meth:`str.rsplit`." +msgstr "等價於 :py:meth:`str.rsplit`。" + +#: ../../c-api/unicode.rst:1441 msgid "" "Split a Unicode string at line breaks, returning a list of Unicode strings. " "CRLF is considered to be one line break. If *keepends* is ``0``, the Line " "break characters are not included in the resulting strings." msgstr "" -#: ../../c-api/unicode.rst:1409 +#: ../../c-api/unicode.rst:1448 +msgid "" +"Split a Unicode string at the first occurrence of *sep*, and return a 3-" +"tuple containing the part before the separator, the separator itself, and " +"the part after the separator. If the separator is not found, return a 3-" +"tuple containing the string itself, followed by two empty strings." +msgstr "" + +#: ../../c-api/unicode.rst:1453 ../../c-api/unicode.rst:1466 +msgid "*sep* must not be empty." +msgstr "*sep* 不得為空。" + +#: ../../c-api/unicode.rst:1457 +msgid "Equivalent to :py:meth:`str.partition`." +msgstr "等價於 :py:meth:`str.partition`。" + +#: ../../c-api/unicode.rst:1462 +msgid "" +"Similar to :c:func:`PyUnicode_Partition`, but split a Unicode string at the " +"last occurrence of *sep*. If the separator is not found, return a 3-tuple " +"containing two empty strings, followed by the string itself." +msgstr "" + +#: ../../c-api/unicode.rst:1470 +msgid "Equivalent to :py:meth:`str.rpartition`." +msgstr "等價於 :py:meth:`str.rpartition`。" + +#: ../../c-api/unicode.rst:1475 msgid "" "Join a sequence of strings using the given *separator* and return the " "resulting Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1416 +#: ../../c-api/unicode.rst:1482 msgid "" "Return ``1`` if *substr* matches ``unicode[start:end]`` at the given tail " "end (*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` " "a suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1424 +#: ../../c-api/unicode.rst:1490 msgid "" "Return the first position of *substr* in ``unicode[start:end]`` using the " "given *direction* (*direction* == ``1`` means to do a forward search, " @@ -1740,7 +1816,7 @@ msgid "" "``-2`` indicates that an error occurred and an exception has been set." msgstr "" -#: ../../c-api/unicode.rst:1434 +#: ../../c-api/unicode.rst:1500 msgid "" "Return the first position of the character *ch* in ``unicode[start:end]`` " "using the given *direction* (*direction* == ``1`` means to do a forward " @@ -1750,37 +1826,37 @@ msgid "" "set." msgstr "" -#: ../../c-api/unicode.rst:1442 +#: ../../c-api/unicode.rst:1508 msgid "" "*start* and *end* are now adjusted to behave like ``unicode[start:end]``." msgstr "" -#: ../../c-api/unicode.rst:1449 +#: ../../c-api/unicode.rst:1515 msgid "" "Return the number of non-overlapping occurrences of *substr* in " "``unicode[start:end]``. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1456 +#: ../../c-api/unicode.rst:1522 msgid "" "Replace at most *maxcount* occurrences of *substr* in *unicode* with " "*replstr* and return the resulting Unicode object. *maxcount* == ``-1`` " "means replace all occurrences." msgstr "" -#: ../../c-api/unicode.rst:1463 +#: ../../c-api/unicode.rst:1529 msgid "" "Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, " "and greater than, respectively." msgstr "" -#: ../../c-api/unicode.rst:1466 +#: ../../c-api/unicode.rst:1532 msgid "" -"This function returns ``-1`` upon failure, so one should " -"call :c:func:`PyErr_Occurred` to check for errors." +"This function returns ``-1`` upon failure, so one should call :c:func:" +"`PyErr_Occurred` to check for errors." msgstr "" -#: ../../c-api/unicode.rst:1472 +#: ../../c-api/unicode.rst:1538 msgid "" "Compare a Unicode object with a char buffer which is interpreted as being " "UTF-8 or ASCII encoded and return true (``1``) if they are equal, or false " @@ -1789,18 +1865,18 @@ msgid "" "is returned." msgstr "" -#: ../../c-api/unicode.rst:1479 ../../c-api/unicode.rst:1500 +#: ../../c-api/unicode.rst:1545 ../../c-api/unicode.rst:1566 msgid "This function does not raise exceptions." msgstr "此函式不會引發例外。" -#: ../../c-api/unicode.rst:1486 +#: ../../c-api/unicode.rst:1552 msgid "" "Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string* " "length using :c:func:`!strlen`. If the Unicode object contains null " "characters, false (``0``) is returned." msgstr "" -#: ../../c-api/unicode.rst:1495 +#: ../../c-api/unicode.rst:1561 msgid "" "Compare a Unicode object, *unicode*, with *string* and return ``-1``, ``0``, " "``1`` for less than, equal, and greater than, respectively. It is best to " @@ -1808,59 +1884,58 @@ msgid "" "string as ISO-8859-1 if it contains non-ASCII characters." msgstr "" -#: ../../c-api/unicode.rst:1505 +#: ../../c-api/unicode.rst:1571 msgid "Rich compare two Unicode strings and return one of the following:" msgstr "" -#: ../../c-api/unicode.rst:1507 +#: ../../c-api/unicode.rst:1573 msgid "``NULL`` in case an exception was raised" msgstr "" -#: ../../c-api/unicode.rst:1508 +#: ../../c-api/unicode.rst:1574 msgid ":c:data:`Py_True` or :c:data:`Py_False` for successful comparisons" msgstr "" -#: ../../c-api/unicode.rst:1509 +#: ../../c-api/unicode.rst:1575 msgid ":c:data:`Py_NotImplemented` in case the type combination is unknown" msgstr "" -#: ../../c-api/unicode.rst:1511 +#: ../../c-api/unicode.rst:1577 msgid "" -"Possible values for *op* " -"are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, " -"and :c:macro:`Py_LE`." +"Possible values for *op* are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:" +"`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, and :c:macro:`Py_LE`." msgstr "" -#: ../../c-api/unicode.rst:1517 +#: ../../c-api/unicode.rst:1583 msgid "" "Return a new string object from *format* and *args*; this is analogous to " "``format % args``." msgstr "" -#: ../../c-api/unicode.rst:1523 +#: ../../c-api/unicode.rst:1589 msgid "" "Check whether *substr* is contained in *unicode* and return true or false " "accordingly." msgstr "" -#: ../../c-api/unicode.rst:1526 +#: ../../c-api/unicode.rst:1592 msgid "" "*substr* has to coerce to a one element Unicode string. ``-1`` is returned " "if there was an error." msgstr "" -#: ../../c-api/unicode.rst:1532 +#: ../../c-api/unicode.rst:1598 msgid "" "Intern the argument :c:expr:`*p_unicode` in place. The argument must be the " "address of a pointer variable pointing to a Python Unicode string object. " -"If there is an existing interned string that is the same " -"as :c:expr:`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the " -"reference to the old string object and creating a new :term:`strong " -"reference` to the interned string object), otherwise it " -"leaves :c:expr:`*p_unicode` alone and interns it." +"If there is an existing interned string that is the same as :c:expr:" +"`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the reference to " +"the old string object and creating a new :term:`strong reference` to the " +"interned string object), otherwise it leaves :c:expr:`*p_unicode` alone and " +"interns it." msgstr "" -#: ../../c-api/unicode.rst:1539 +#: ../../c-api/unicode.rst:1605 msgid "" "(Clarification: even though there is a lot of talk about references, think " "of this function as reference-neutral. You must own the object you pass in; " @@ -1868,48 +1943,47 @@ msgid "" "the result.)" msgstr "" -#: ../../c-api/unicode.rst:1544 +#: ../../c-api/unicode.rst:1610 msgid "" "This function never raises an exception. On error, it leaves its argument " "unchanged without interning it." msgstr "" -#: ../../c-api/unicode.rst:1547 +#: ../../c-api/unicode.rst:1613 msgid "" -"Instances of subclasses of :py:class:`str` may not be interned, that " -"is, :c:expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, " -"then -- as with any other error -- the argument is left unchanged." +"Instances of subclasses of :py:class:`str` may not be interned, that is, :c:" +"expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, then -- " +"as with any other error -- the argument is left unchanged." msgstr "" -#: ../../c-api/unicode.rst:1551 +#: ../../c-api/unicode.rst:1617 msgid "" "Note that interned strings are not “immortal”. You must keep a reference to " "the result to benefit from interning." msgstr "" -#: ../../c-api/unicode.rst:1557 +#: ../../c-api/unicode.rst:1623 msgid "" -"A combination of :c:func:`PyUnicode_FromString` " -"and :c:func:`PyUnicode_InternInPlace`, meant for statically allocated " -"strings." +"A combination of :c:func:`PyUnicode_FromString` and :c:func:" +"`PyUnicode_InternInPlace`, meant for statically allocated strings." msgstr "" -#: ../../c-api/unicode.rst:1560 +#: ../../c-api/unicode.rst:1626 msgid "" "Return a new (\"owned\") reference to either a new Unicode string object " "that has been interned, or an earlier interned string object with the same " "value." msgstr "" -#: ../../c-api/unicode.rst:1564 +#: ../../c-api/unicode.rst:1630 msgid "" "Python may keep a reference to the result, or make it :term:`immortal`, " "preventing it from being garbage-collected promptly. For interning an " "unbounded number of different strings, such as ones coming from user input, " -"prefer calling :c:func:`PyUnicode_FromString` " -"and :c:func:`PyUnicode_InternInPlace` directly." +"prefer calling :c:func:`PyUnicode_FromString` and :c:func:" +"`PyUnicode_InternInPlace` directly." msgstr "" -#: ../../c-api/unicode.rst:1572 +#: ../../c-api/unicode.rst:1638 msgid "Strings interned this way are made :term:`immortal`." msgstr "" diff --git a/copyright.po b/copyright.po index 63bcc2fbfa..50a39fdee2 100644 --- a/copyright.po +++ b/copyright.po @@ -32,9 +32,8 @@ msgid "Python and this documentation is:" msgstr "Python 和這份說明文件的版權:" #: ../../copyright.rst:7 -#, fuzzy msgid "Copyright © 2001-2024 Python Software Foundation. All rights reserved." -msgstr "Copyright © 2001-2023 Python Software Foundation 保留一切權利。" +msgstr "Copyright © 2001-2024 Python Software Foundation. All rights reserved." #: ../../copyright.rst:9 msgid "Copyright © 2000 BeOpen.com. All rights reserved." diff --git a/deprecations/c-api-pending-removal-in-3.14.po b/deprecations/c-api-pending-removal-in-3.14.po index ed8747f95e..8541753787 100644 --- a/deprecations/c-api-pending-removal-in-3.14.po +++ b/deprecations/c-api-pending-removal-in-3.14.po @@ -24,16 +24,16 @@ msgid "" "The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " "(:pep:`699`; :gh:`101193`)." msgstr "" -":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 (:pep:" -"`699`;:gh:`101193`)。" +":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 " +"(:pep:`699`;:gh:`101193`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 msgid "" "Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable " "bases (:gh:`95388`)." msgstr "" -"使用可變基底建立\\ :c:data:`不可變型別 <Py_TPFLAGS_IMMUTABLETYPE>` (:gh:" -"`95388`)。" +"使用可變基底建立\\ :c:data:`不可變型別 <Py_TPFLAGS_IMMUTABLETYPE>` " +"(:gh:`95388`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:10 msgid "" @@ -63,8 +63,8 @@ msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" -"`PyConfig` instead." +"The :c:func:`Py_InitializeFromConfig` API should be used " +"with :c:type:`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" @@ -121,24 +121,24 @@ msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "instead." msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." -"use_environment`。" +":c:var:`Py_IgnoreEnvironmentFlag`:請改" +"用 :c:member:`PyConfig.use_environment`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "instead." msgstr "" -":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." -"write_bytecode`。" +":c:var:`Py_DontWriteBytecodeFlag`:請改" +"用 :c:member:`PyConfig.write_bytecode`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 msgid "" -":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." -"user_site_directory` instead." +":c:var:`Py_NoUserSiteDirectory`: " +"Use :c:member:`PyConfig.user_site_directory` instead." msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." -"user_site_directory`。" +":c:var:`Py_NoUserSiteDirectory`:請改" +"用 :c:member:`PyConfig.user_site_directory`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 msgid "" @@ -161,48 +161,48 @@ msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." -"legacy_windows_fs_encoding` instead." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: " +"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` instead." msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." -"legacy_windows_fs_encoding`。" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" +"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." -"legacy_windows_stdio` instead." +":c:var:`Py_LegacyWindowsStdioFlag`: " +"Use :c:member:`PyConfig.legacy_windows_stdio` instead." msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." -"legacy_windows_stdio`。" +":c:var:`Py_LegacyWindowsStdioFlag`:請改" +"用 :c:member:`PyConfig.legacy_windows_stdio`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." -"filesystem_encoding` instead." +":c:var:`!Py_FileSystemDefaultEncoding`: " +"Use :c:member:`PyConfig.filesystem_encoding` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." -"filesystem_encoding`。" +":c:var:`!Py_FileSystemDefaultEncoding`:請改" +"用 :c:member:`PyConfig.filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." -"filesystem_encoding` instead." +":c:var:`!Py_HasFileSystemDefaultEncoding`: " +"Use :c:member:`PyConfig.filesystem_encoding` instead." msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." -"filesystem_encoding`。" +":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" +"用 :c:member:`PyConfig.filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." -"filesystem_errors` instead." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: " +"Use :c:member:`PyConfig.filesystem_errors` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." -"filesystem_errors`。" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" +"用 :c:member:`PyConfig.filesystem_errors`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" -"c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. " +"(see :c:func:`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" -"func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" +"見 :c:func:`Py_PreInitialize`)" diff --git a/deprecations/c-api-pending-removal-in-3.15.po b/deprecations/c-api-pending-removal-in-3.15.po index f828c57849..4faa829fa8 100644 --- a/deprecations/c-api-pending-removal-in-3.15.po +++ b/deprecations/c-api-pending-removal-in-3.15.po @@ -25,27 +25,27 @@ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" -"`PyImport_ImportModule` instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: " +"Use :c:func:`PyImport_ImportModule` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" -"`PyImport_ImportModule`。" +":c:func:`PyImport_ImportModuleNoBlock`:請改" +"用 :c:func:`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 msgid "" -":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" -"func:`PyWeakref_GetRef` instead." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " +"Use :c:func:`PyWeakref_GetRef` instead." msgstr "" -":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" -"func:`PyWeakref_GetRef`。" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" +"用 :c:func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 msgid "" -":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" -"type:`wchar_t` instead." +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " +"Use :c:type:`wchar_t` instead." msgstr "" -":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" -"`wchar_t`。" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" +"用 :c:type:`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 msgid "Python initialization functions:" @@ -56,16 +56,16 @@ msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" -":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" -"data:`!warnings.filters`。" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " +"和 :data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 msgid "" -":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." -"exec_prefix` instead." +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` " +"and :data:`sys.exec_prefix` instead." msgstr "" -":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" -"`sys.exec_prefix`。" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` " +"與 :data:`sys.exec_prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." @@ -76,8 +76,8 @@ msgid "" ":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " "instead." msgstr "" -":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." -"prefix`。" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` " +"與 :data:`sys.prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." @@ -89,8 +89,8 @@ msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" -"`PYTHONHOME` environment variable instead." +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or " +"the :envvar:`PYTHONHOME` environment variable instead." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" -"`PYTHONHOME` 環境變數。" +":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " +"或 :envvar:`PYTHONHOME` 環境變數。" diff --git a/deprecations/c-api-pending-removal-in-future.po b/deprecations/c-api-pending-removal-in-future.po index 49bec35846..a9930288d2 100644 --- a/deprecations/c-api-pending-removal-in-future.po +++ b/deprecations/c-api-pending-removal-in-future.po @@ -38,8 +38,8 @@ msgid "" ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" -":c:func:`PyErr_NormalizeException`:請改用 :c:func:" -"`PyErr_GetRaisedException`。" +":c:func:`PyErr_NormalizeException`:請改" +"用 :c:func:`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" @@ -59,11 +59,11 @@ msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" -"`PySlice_AdjustIndices` instead." +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " +"and :c:func:`PySlice_AdjustIndices` instead." msgstr "" -":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" -"`PySlice_AdjustIndices`。" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` " +"和 :c:func:`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid "" @@ -109,8 +109,8 @@ msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." msgstr "" -":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" -"`PyObject_Hash`。" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" +"叫 :c:func:`PyObject_Hash`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid ":c:member:`!PyDictObject.ma_version_tag` member." diff --git a/deprecations/index.po b/deprecations/index.po index b6c4ff73e5..05c5babe57 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-10 17:21+0000\n" +"POT-Creation-Date: 2025-04-30 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -321,10 +321,19 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:56 +msgid ":mod:`importlib`:" +msgstr ":mod:`importlib`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "``load_module()`` method:請改用 ``exec_module()``。" + +#: ../../deprecations/pending-removal-in-3.15.rst:36 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:34 +#: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " "Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" @@ -337,11 +346,11 @@ msgstr "" "`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." "getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" ":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" "func:`os.path.isreserved` to detect reserved paths on Windows." @@ -349,11 +358,11 @@ msgstr "" ":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." "isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:48 +#: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:54 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -362,11 +371,23 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:54 +#: ../../deprecations/pending-removal-in-3.15.rst:58 +msgid ":mod:`sysconfig`:" +msgstr ":mod:`sysconfig`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:60 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." +msgstr "" +":func:`sysconfig.is_python_build` 的 *check_home* 引數自 Python 3.12 起已被棄" +"用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:63 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:56 +#: ../../deprecations/pending-removal-in-3.15.rst:65 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -377,11 +398,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:62 +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`types`:" msgstr ":mod:`types`:" -#: ../../deprecations/pending-removal-in-3.15.rst:64 +#: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -393,11 +414,11 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:71 +#: ../../deprecations/pending-removal-in-3.15.rst:80 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.15.rst:73 +#: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" "The undocumented keyword argument syntax for creating :class:`~typing." "NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " @@ -408,7 +429,7 @@ msgstr "" "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:79 +#: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -418,11 +439,11 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:84 +#: ../../deprecations/pending-removal-in-3.15.rst:93 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:86 +#: ../../deprecations/pending-removal-in-3.15.rst:95 msgid "" "The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." "Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" @@ -472,7 +493,7 @@ msgstr "" "gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 -#: ../../deprecations/pending-removal-in-future.rst:12 +#: ../../deprecations/pending-removal-in-future.rst:10 msgid ":mod:`builtins`:" msgstr ":mod:`builtins`:" @@ -556,15 +577,11 @@ msgid "" "groups are deprecated." msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" -#: ../../deprecations/pending-removal-in-future.rst:10 -msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" -msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" - -#: ../../deprecations/pending-removal-in-future.rst:14 +#: ../../deprecations/pending-removal-in-future.rst:12 msgid "``bool(NotImplemented)``." msgstr "``bool(NotImplemented)``。" -#: ../../deprecations/pending-removal-in-future.rst:15 +#: ../../deprecations/pending-removal-in-future.rst:13 msgid "" "Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " "is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " @@ -573,7 +590,7 @@ msgstr "" "產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" "請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" -#: ../../deprecations/pending-removal-in-future.rst:18 +#: ../../deprecations/pending-removal-in-future.rst:16 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " @@ -591,7 +608,7 @@ msgstr "" "`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" "本中,它將被更改為語法錯誤。(:gh:`87999`)" -#: ../../deprecations/pending-removal-in-future.rst:26 +#: ../../deprecations/pending-removal-in-future.rst:24 msgid "" "Support for ``__index__()`` and ``__int__()`` method returning non-int type: " "these methods will be required to return an instance of a strict subclass " @@ -600,7 +617,7 @@ msgstr "" "``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" "傳 :class:`int` 的嚴格子類別實例。" -#: ../../deprecations/pending-removal-in-future.rst:29 +#: ../../deprecations/pending-removal-in-future.rst:27 msgid "" "Support for ``__float__()`` method returning a strict subclass of :class:" "`float`: these methods will be required to return an instance of :class:" @@ -609,7 +626,7 @@ msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:30 msgid "" "Support for ``__complex__()`` method returning a strict subclass of :class:" "`complex`: these methods will be required to return an instance of :class:" @@ -618,11 +635,11 @@ msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:35 +#: ../../deprecations/pending-removal-in-future.rst:33 msgid "Delegation of ``int()`` to ``__trunc__()`` method." msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:36 +#: ../../deprecations/pending-removal-in-future.rst:34 msgid "" "Passing a complex number as the *real* or *imag* argument in the :func:" "`complex` constructor is now deprecated; it should only be passed as a " @@ -632,7 +649,7 @@ msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:41 +#: ../../deprecations/pending-removal-in-future.rst:39 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " "are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." @@ -642,18 +659,18 @@ msgstr "" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " "Roshan 於 :gh:`103636` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:46 +#: ../../deprecations/pending-removal-in-future.rst:44 msgid "" ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " "instead." msgstr "" ":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:49 +#: ../../deprecations/pending-removal-in-future.rst:47 msgid ":mod:`datetime`:" msgstr ":mod:`datetime`:" -#: ../../deprecations/pending-removal-in-future.rst:51 +#: ../../deprecations/pending-removal-in-future.rst:49 msgid "" ":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." "UTC)``." @@ -661,7 +678,7 @@ msgstr "" ":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." "now(tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:53 +#: ../../deprecations/pending-removal-in-future.rst:51 msgid "" ":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``." @@ -669,19 +686,11 @@ msgstr "" ":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:56 +#: ../../deprecations/pending-removal-in-future.rst:54 msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" #: ../../deprecations/pending-removal-in-future.rst:58 -msgid ":mod:`importlib`:" -msgstr ":mod:`importlib`:" - -#: ../../deprecations/pending-removal-in-future.rst:60 -msgid "``load_module()`` method: use ``exec_module()`` instead." -msgstr "``load_module()`` method:請改用 ``exec_module()``。" - -#: ../../deprecations/pending-removal-in-future.rst:61 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -689,19 +698,19 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:61 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:63 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:67 +#: ../../deprecations/pending-removal-in-future.rst:64 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:66 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." @@ -709,19 +718,19 @@ msgstr "" ":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" "`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:69 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:75 +#: ../../deprecations/pending-removal-in-future.rst:72 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:74 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -729,7 +738,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:80 +#: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -741,12 +750,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:87 +#: ../../deprecations/pending-removal-in-future.rst:84 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:86 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -754,15 +763,15 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:89 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:94 +#: ../../deprecations/pending-removal-in-future.rst:91 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:92 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" "`!selected_npn_protocol` are deprecated: use ALPN instead." @@ -770,58 +779,51 @@ msgstr "" ":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" "`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:95 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:96 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:97 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:105 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:107 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:109 -msgid "" -":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " -"ignored." -msgstr "" -":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" - -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid "" ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." "notify_all`." @@ -829,11 +831,11 @@ msgstr "" ":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." "notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:116 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" "attr:`threading.Thread.daemon` attribute." @@ -841,7 +843,7 @@ msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" "attr:`threading.Thread.name` attribute." @@ -849,20 +851,20 @@ msgstr "" ":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" "attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:121 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:123 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:119 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -870,58 +872,58 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:122 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:124 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:125 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:126 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:127 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:129 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:138 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:142 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "" ":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" "`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " @@ -931,13 +933,13 @@ msgstr "" "class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" "`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:149 +#: ../../deprecations/pending-removal-in-future.rst:143 msgid "" ":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." "etree.ElementTree.Element` is deprecated. In a future release it will always " @@ -948,7 +950,7 @@ msgstr "" "Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " "``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:154 +#: ../../deprecations/pending-removal-in-future.rst:148 msgid "" ":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" "`~zipimport.zipimporter.exec_module` instead." @@ -1354,3 +1356,6 @@ msgstr "" #: ../../deprecations/c-api-pending-removal-in-future.rst:50 msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" + +#~ msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" +#~ msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" diff --git a/deprecations/pending-removal-in-3.14.po b/deprecations/pending-removal-in-3.14.po index f6e86c446f..bd8e164bd3 100644 --- a/deprecations/pending-removal-in-3.14.po +++ b/deprecations/pending-removal-in-3.14.po @@ -60,8 +60,8 @@ msgstr ":class:`!ast.Ellipsis`" #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" -"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" -"`90953`.)" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka " +"in :gh:`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" @@ -71,27 +71,26 @@ msgstr ":mod:`asyncio`:" #: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" -"The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" -"`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" -"class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " +"The child watcher " +"classes :class:`~asyncio.MultiLoopChildWatcher`, :class:`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` " +"and :class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " "Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`~asyncio." -"MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio." -"AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " -"Aditya 於 :gh:`94597` 貢獻。)" +"已棄用並將在 Python 3.14 中移除的 child watcher 類" +"別::class:`~asyncio.MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio.AbstractChildWatcher` " +"和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar Aditya 於 :gh:`94597` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" -":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" -"`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." -"AbstractEventLoopPolicy.get_child_watcher` are deprecated and will be " -"removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " +"and :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated " +"and will be removed in Python 3.14. (Contributed by Kumar Aditya " +"in :gh:`94597`.)" msgstr "" -":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:" -"`asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`asyncio." -"AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" -"除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" +":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " +"和 :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 " +"Python 3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" @@ -108,18 +107,21 @@ msgstr "" msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." -"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" +"typing, prefer a union, like ``bytes | bytearray``, " +"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " +"in :gh:`91896`.)" msgstr "" -":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改用 :" -"class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用時,請" -"改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " -"Shantanu Jain 於 :gh:`91896` 貢獻。)" +":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改" +"用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" +"時,請改用聯集,如 ``bytes | bytearray``," +"或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" -":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." -"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" +":mod:`email`: Deprecated the *isdst* parameter " +"in :func:`email.utils.localtime`. (Contributed by Alan Williams " +"in :gh:`72346`.)" msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" @@ -173,24 +175,25 @@ msgid "" "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " "currently the default (:gh:`84559`). Adding a runtime warning about this was " "deemed too disruptive as the majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." -"set_start_method` APIs to explicitly specify when your code *requires* " -"``'fork'``. See :ref:`multiprocessing-start-methods`." +"the :func:`~multiprocessing.get_context` " +"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " +"your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`." msgstr "" ":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平" "台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。對此增加一" -"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用 :func:" -"`~multiprocessing.get_context` 或 :func:`~multiprocessing.set_start_method` " -"API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" -"`multiprocessing-start-methods`。" +"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使" +"用 :func:`~multiprocessing.get_context` " +"或 :func:`~multiprocessing.set_start_method` API 來明確指定你的程式碼何時\\ *" +"需要* ``'fork'``。請參閱 :ref:`multiprocessing-start-methods`。" #: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" -":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." -"PurePath.relative_to`: passing additional arguments is deprecated." +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` " +"and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments is " +"deprecated." msgstr "" -":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" -"`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" +":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` " +"和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" #: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" @@ -199,8 +202,9 @@ msgid "" "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`~pkgutil.find_loader` 和 :func:`~pkgutil.get_loader` " -"現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." -"find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" +"現在會引發 :exc:`DeprecationWarning`;請改" +"用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" +"獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" @@ -224,9 +228,9 @@ msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" #: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" -":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" -"ref:`named placeholders <sqlite3-placeholders>` are used and *parameters* is " -"a sequence instead of a :class:`dict`." +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` " +"if :ref:`named placeholders <sqlite3-placeholders>` are used and " +"*parameters* is a sequence instead of a :class:`dict`." msgstr "" ":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如果" "使用 :ref:`named placeholders <sqlite3-placeholders>` 且 *parameters* 是序列" @@ -243,8 +247,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " -"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" -"`88168`.)" +"intended to be a public API. (Contributed by Gregory P. Smith " +"in :gh:`88168`.)" msgstr "" ":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 API。" "(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index 8c048042e0..726d403414 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-05 00:13+0000\n" +"POT-Creation-Date: 2025-02-28 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,10 +25,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" -"`__spec__.cached <importlib.machinery.ModuleSpec.cached>` is deprecated. In " -"Python 3.15, :attr:`!__cached__` will cease to be set or take into " -"consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to " +"set :attr:`__spec__.cached <importlib.machinery.ModuleSpec.cached>` is " +"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " +"into consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "<importlib.machinery.ModuleSpec.cached>` 的做法已被棄用。在 Python 3.15 中," @@ -36,10 +36,11 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to set :attr:" -"`__spec__.parent <importlib.machinery.ModuleSpec.parent>` is deprecated. In " -"Python 3.15, :attr:`!__package__` will cease to be set or take into " -"consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to " +"set :attr:`__spec__.parent <importlib.machinery.ModuleSpec.parent>` is " +"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " +"take into consideration by the import system or standard library. " +"(:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "<importlib.machinery.ModuleSpec.parent>` 的做法已被棄用。在 Python 3.15 中," @@ -79,39 +80,49 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:32 +msgid ":mod:`importlib`:" +msgstr ":mod:`importlib`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "``load_module()`` method:請改用 ``exec_module()``。" + +#: ../../deprecations/pending-removal-in-3.15.rst:36 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:34 +#: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" -"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." -"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " -"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 " +"(:gh:`90817`), but has been postponed to Python 3.15. " +"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " +"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " +"in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" -"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." -"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" +"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " +"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" +"獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" -"func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " +"Use :func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." -"isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" +"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:48 +#: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:54 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -120,11 +131,23 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:54 +#: ../../deprecations/pending-removal-in-3.15.rst:58 +msgid ":mod:`sysconfig`:" +msgstr ":mod:`sysconfig`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:60 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." +msgstr "" +":func:`sysconfig.is_python_build` 的 *check_home* 引數自 Python 3.12 起已被棄" +"用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:63 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:56 +#: ../../deprecations/pending-removal-in-3.15.rst:65 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -135,11 +158,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:62 +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`types`:" msgstr ":mod:`types`:" -#: ../../deprecations/pending-removal-in-3.15.rst:64 +#: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -147,26 +170,26 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" -"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" -"`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" +"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " +"於 :gh:`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:71 +#: ../../deprecations/pending-removal-in-3.15.rst:80 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../deprecations/pending-removal-in-3.15.rst:73 +#: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" -"The undocumented keyword argument syntax for creating :class:`~typing." -"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " -"has been deprecated since Python 3.13. Use the class-based syntax or the " -"functional syntax instead." +"The undocumented keyword argument syntax for " +"creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " +"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " +"3.13. Use the class-based syntax or the functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:79 +#: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -176,16 +199,17 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:84 +#: ../../deprecations/pending-removal-in-3.15.rst:93 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:86 +#: ../../deprecations/pending-removal-in-3.15.rst:95 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." -"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" -"`~wave.Wave_write` classes have been deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " +"and :meth:`~wave.Wave_read.getmarkers` methods of " +"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " +"deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" -"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." -"getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" +"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " +"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" diff --git a/deprecations/pending-removal-in-3.16.po b/deprecations/pending-removal-in-3.16.po index 785fc0e03f..168f04617f 100644 --- a/deprecations/pending-removal-in-3.16.po +++ b/deprecations/pending-removal-in-3.16.po @@ -25,10 +25,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" -"`__spec__.loader <importlib.machinery.ModuleSpec.loader>` is deprecated. In " -"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " -"consideration by the import system or the standard library." +"Setting :attr:`~module.__loader__` on a module while failing to " +"set :attr:`__spec__.loader <importlib.machinery.ModuleSpec.loader>` is " +"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " +"taken into consideration by the import system or the standard library." msgstr "" "在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " "<importlib.machinery.ModuleSpec.loader>` 的做法將於 Python 3.16 被棄用。在 " @@ -59,8 +59,8 @@ msgid "" "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" ":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" -"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" -"gh:`122875` 貢獻。)" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " +"於 :gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 msgid ":mod:`builtins`:" diff --git a/deprecations/pending-removal-in-future.po b/deprecations/pending-removal-in-future.po index 9649475ba7..230bd84669 100644 --- a/deprecations/pending-removal-in-future.po +++ b/deprecations/pending-removal-in-future.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-30 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,18 +33,14 @@ msgid "" msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" #: ../../deprecations/pending-removal-in-future.rst:10 -msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" -msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" - -#: ../../deprecations/pending-removal-in-future.rst:12 msgid ":mod:`builtins`:" msgstr ":mod:`builtins`:" -#: ../../deprecations/pending-removal-in-future.rst:14 +#: ../../deprecations/pending-removal-in-future.rst:12 msgid "``bool(NotImplemented)``." msgstr "``bool(NotImplemented)``。" -#: ../../deprecations/pending-removal-in-future.rst:15 +#: ../../deprecations/pending-removal-in-future.rst:13 msgid "" "Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " "is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " @@ -53,7 +49,7 @@ msgstr "" "產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" "請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" -#: ../../deprecations/pending-removal-in-future.rst:18 +#: ../../deprecations/pending-removal-in-future.rst:16 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " @@ -71,7 +67,7 @@ msgstr "" "`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" "本中,它將被更改為語法錯誤。(:gh:`87999`)" -#: ../../deprecations/pending-removal-in-future.rst:26 +#: ../../deprecations/pending-removal-in-future.rst:24 msgid "" "Support for ``__index__()`` and ``__int__()`` method returning non-int type: " "these methods will be required to return an instance of a strict subclass " @@ -80,7 +76,7 @@ msgstr "" "``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" "傳 :class:`int` 的嚴格子類別實例。" -#: ../../deprecations/pending-removal-in-future.rst:29 +#: ../../deprecations/pending-removal-in-future.rst:27 msgid "" "Support for ``__float__()`` method returning a strict subclass of :class:" "`float`: these methods will be required to return an instance of :class:" @@ -89,7 +85,7 @@ msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:30 msgid "" "Support for ``__complex__()`` method returning a strict subclass of :class:" "`complex`: these methods will be required to return an instance of :class:" @@ -98,11 +94,11 @@ msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:35 +#: ../../deprecations/pending-removal-in-future.rst:33 msgid "Delegation of ``int()`` to ``__trunc__()`` method." msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:36 +#: ../../deprecations/pending-removal-in-future.rst:34 msgid "" "Passing a complex number as the *real* or *imag* argument in the :func:" "`complex` constructor is now deprecated; it should only be passed as a " @@ -112,7 +108,7 @@ msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:41 +#: ../../deprecations/pending-removal-in-future.rst:39 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " "are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." @@ -122,18 +118,18 @@ msgstr "" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " "Roshan 於 :gh:`103636` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:46 +#: ../../deprecations/pending-removal-in-future.rst:44 msgid "" ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " "instead." msgstr "" ":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:49 +#: ../../deprecations/pending-removal-in-future.rst:47 msgid ":mod:`datetime`:" msgstr ":mod:`datetime`:" -#: ../../deprecations/pending-removal-in-future.rst:51 +#: ../../deprecations/pending-removal-in-future.rst:49 msgid "" ":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." "UTC)``." @@ -141,7 +137,7 @@ msgstr "" ":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." "now(tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:53 +#: ../../deprecations/pending-removal-in-future.rst:51 msgid "" ":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``." @@ -149,19 +145,15 @@ msgstr "" ":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." "fromtimestamp(timestamp, tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:56 +#: ../../deprecations/pending-removal-in-future.rst:54 msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" -#: ../../deprecations/pending-removal-in-future.rst:58 +#: ../../deprecations/pending-removal-in-future.rst:56 msgid ":mod:`importlib`:" msgstr ":mod:`importlib`:" -#: ../../deprecations/pending-removal-in-future.rst:60 -msgid "``load_module()`` method: use ``exec_module()`` instead." -msgstr "``load_module()`` method:請改用 ``exec_module()``。" - -#: ../../deprecations/pending-removal-in-future.rst:61 +#: ../../deprecations/pending-removal-in-future.rst:58 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -169,19 +161,19 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:61 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:63 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:67 +#: ../../deprecations/pending-removal-in-future.rst:64 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:66 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." @@ -189,19 +181,19 @@ msgstr "" ":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" "`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:69 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:75 +#: ../../deprecations/pending-removal-in-future.rst:72 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:74 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -209,7 +201,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:80 +#: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -221,12 +213,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:87 +#: ../../deprecations/pending-removal-in-future.rst:84 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:86 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -234,15 +226,15 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:89 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:94 +#: ../../deprecations/pending-removal-in-future.rst:91 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:92 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" "`!selected_npn_protocol` are deprecated: use ALPN instead." @@ -250,58 +242,51 @@ msgstr "" ":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" "`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:95 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:96 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:97 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:105 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:107 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:109 -msgid "" -":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " -"ignored." -msgstr "" -":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" - -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid "" ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." "notify_all`." @@ -309,11 +294,11 @@ msgstr "" ":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." "notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:116 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" "attr:`threading.Thread.daemon` attribute." @@ -321,7 +306,7 @@ msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" "attr:`threading.Thread.name` attribute." @@ -329,20 +314,20 @@ msgstr "" ":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" "attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:121 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:123 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:119 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -350,58 +335,58 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:122 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:124 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:125 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:126 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:127 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:129 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:138 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:142 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "" ":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" "`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " @@ -411,13 +396,13 @@ msgstr "" "class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" "`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:149 +#: ../../deprecations/pending-removal-in-future.rst:143 msgid "" ":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." "etree.ElementTree.Element` is deprecated. In a future release it will always " @@ -428,10 +413,13 @@ msgstr "" "Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " "``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:154 +#: ../../deprecations/pending-removal-in-future.rst:148 msgid "" ":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" "`~zipimport.zipimporter.exec_module` instead." msgstr "" ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." "zipimporter.exec_module`。" + +#~ msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" +#~ msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" diff --git a/extending/embedding.po b/extending/embedding.po index ac486c5aef..4f1244dc1c 100644 --- a/extending/embedding.po +++ b/extending/embedding.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-07 15:49+0000\n" "PO-Revision-Date: 2018-05-23 14:09+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -356,7 +356,7 @@ msgstr "" msgid "" "After initializing the interpreter, the script is loaded using :c:func:" "`PyImport_Import`. This routine needs a Python string as its argument, " -"which is constructed using the :c:func:`PyUnicode_FromString` data " +"which is constructed using the :c:func:`PyUnicode_DecodeFSDefault` data " "conversion routine. ::" msgstr "" diff --git a/extending/extending.po b/extending/extending.po index 2daee5badc..da956c0dc4 100644 --- a/extending/extending.po +++ b/extending/extending.po @@ -101,9 +101,9 @@ msgstr "" #: ../../extending/extending.rst:53 msgid "" "Begin by creating a file :file:`spammodule.c`. (Historically, if a module " -"is called ``spam``, the C file containing its implementation is called :file:" -"`spammodule.c`; if the module name is very long, like ``spammify``, the " -"module name can be just :file:`spammify.c`.)" +"is called ``spam``, the C file containing its implementation is " +"called :file:`spammodule.c`; if the module name is very long, like " +"``spammify``, the module name can be just :file:`spammify.c`.)" msgstr "" "首先建立一個檔案 :file:`spammodule.c`。(從過去歷史來看,如果一個模組叫做 " "``spam``,包含其實作的 C 檔案就會叫做 :file:`spammodule.c`;如果模組名稱很" @@ -153,11 +153,11 @@ msgstr "" msgid "" "All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` " "or ``PY``, except those defined in standard header files. For convenience, " -"and since they are used extensively by the Python interpreter, ``\"Python." -"h\"`` includes a few standard header files: ``<stdio.h>``, ``<string.h>``, " -"``<errno.h>``, and ``<stdlib.h>``. If the latter header file does not exist " -"on your system, it declares the functions :c:func:`malloc`, :c:func:`free` " -"and :c:func:`realloc` directly." +"and since they are used extensively by the Python interpreter, " +"``\"Python.h\"`` includes a few standard header files: ``<stdio.h>``, " +"``<string.h>``, ``<errno.h>``, and ``<stdlib.h>``. If the latter header " +"file does not exist on your system, it declares the " +"functions :c:func:`malloc`, :c:func:`free` and :c:func:`realloc` directly." msgstr "" "除了那些在標準標頭檔中定義的符號以外,所有由 :file:`Python.h` 定義的使用者可" "見符號 (user-visible symbols) 的前綴都是 ``Py`` 或 ``PY``。為了方便,也因為 " @@ -295,10 +295,10 @@ msgstr "" msgid "" "Another useful function is :c:func:`PyErr_SetFromErrno`, which only takes an " "exception argument and constructs the associated value by inspection of the " -"global variable :c:data:`errno`. The most general function is :c:func:" -"`PyErr_SetObject`, which takes two object arguments, the exception and its " -"associated value. You don't need to :c:func:`Py_INCREF` the objects passed " -"to any of these functions." +"global variable :c:data:`errno`. The most general function " +"is :c:func:`PyErr_SetObject`, which takes two object arguments, the " +"exception and its associated value. You don't need to :c:func:`Py_INCREF` " +"the objects passed to any of these functions." msgstr "" "另一個有用的函式是 :c:func:`PyErr_SetFromErrno`,它只接受一個例外引數,並透過" "檢查全域變數 :c:data:`errno` 來建立關聯值。最一般的函式" @@ -307,14 +307,14 @@ msgstr "" #: ../../extending/extending.rst:154 msgid "" -"You can test non-destructively whether an exception has been set with :c:" -"func:`PyErr_Occurred`. This returns the current exception object, or " -"``NULL`` if no exception has occurred. You normally don't need to call :c:" -"func:`PyErr_Occurred` to see whether an error occurred in a function call, " -"since you should be able to tell from the return value." +"You can test non-destructively whether an exception has been set " +"with :c:func:`PyErr_Occurred`. This returns the current exception object, " +"or ``NULL`` if no exception has occurred. You normally don't need to " +"call :c:func:`PyErr_Occurred` to see whether an error occurred in a function " +"call, since you should be able to tell from the return value." msgstr "" "你可以使用 :c:func:`PyErr_Occurred` 來不具破壞性地測試例外是否已被設定。這會" -"回傳當前的例外物件,如果沒有例外發生則回傳 ``NULL``。你通常不需要呼" +"回傳目前的例外物件,如果沒有例外發生則回傳 ``NULL``。你通常不需要呼" "叫 :c:func:`PyErr_Occurred` 來查看函式呼叫是否發生錯誤,因為你應可從回傳值就" "得知。" @@ -365,10 +365,11 @@ msgstr "" #: ../../extending/extending.rst:182 msgid "" "Every failing :c:func:`malloc` call must be turned into an exception --- the " -"direct caller of :c:func:`malloc` (or :c:func:`realloc`) must call :c:func:" -"`PyErr_NoMemory` and return a failure indicator itself. All the object-" -"creating functions (for example, :c:func:`PyLong_FromLong`) already do this, " -"so this note is only relevant to those who call :c:func:`malloc` directly." +"direct caller of :c:func:`malloc` (or :c:func:`realloc`) must " +"call :c:func:`PyErr_NoMemory` and return a failure indicator itself. All " +"the object-creating functions (for example, :c:func:`PyLong_FromLong`) " +"already do this, so this note is only relevant to those who " +"call :c:func:`malloc` directly." msgstr "" "每個失敗的 :c:func:`malloc` 呼叫都必須被轉換成一個例外 " "--- :c:func:`malloc`\\ (或 :c:func:`realloc`)的直接呼叫者必須呼" @@ -389,8 +390,8 @@ msgstr "" #: ../../extending/extending.rst:192 msgid "" -"Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` or :" -"c:func:`Py_DECREF` calls for objects you have already created) when you " +"Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` " +"or :c:func:`Py_DECREF` calls for objects you have already created) when you " "return an error indicator!" msgstr "" "最後,在回傳錯誤指示器時要注意垃圾清理(透過對你已經建立的物件呼" @@ -402,11 +403,12 @@ msgid "" "predeclared C objects corresponding to all built-in Python exceptions, such " "as :c:data:`PyExc_ZeroDivisionError`, which you can use directly. Of course, " "you should choose exceptions wisely --- don't use :c:data:`PyExc_TypeError` " -"to mean that a file couldn't be opened (that should probably be :c:data:" -"`PyExc_OSError`). If something's wrong with the argument list, the :c:func:" -"`PyArg_ParseTuple` function usually raises :c:data:`PyExc_TypeError`. If " -"you have an argument whose value must be in a particular range or must " -"satisfy other conditions, :c:data:`PyExc_ValueError` is appropriate." +"to mean that a file couldn't be opened (that should probably " +"be :c:data:`PyExc_OSError`). If something's wrong with the argument list, " +"the :c:func:`PyArg_ParseTuple` function usually " +"raises :c:data:`PyExc_TypeError`. If you have an argument whose value must " +"be in a particular range or must satisfy other " +"conditions, :c:data:`PyExc_ValueError` is appropriate." msgstr "" "你完全可以自行選擇要產生的例外。有一些預先宣告的 C 物件會對應到所有內建的 " "Python 例外,例如 :c:data:`PyExc_ZeroDivisionError`,你可以直接使用它們。當" @@ -600,8 +602,8 @@ msgstr "sts = system(command);" #: ../../extending/extending.rst:292 msgid "" "Our :func:`!spam.system` function must return the value of :c:data:`!sts` as " -"a Python object. This is done using the function :c:func:" -"`PyLong_FromLong`. ::" +"a Python object. This is done using the " +"function :c:func:`PyLong_FromLong`. ::" msgstr "" "我們的 :func:`!spam.system` 函式必須以 Python 物件的形式來回傳 :c:data:`!" "sts` 的值。這是透過 :c:func:`PyLong_FromLong` 函式來達成。 ::" @@ -622,8 +624,8 @@ msgstr "" msgid "" "If you have a C function that returns no useful argument (a function " "returning :c:expr:`void`), the corresponding Python function must return " -"``None``. You need this idiom to do so (which is implemented by the :c:" -"macro:`Py_RETURN_NONE` macro)::" +"``None``. You need this idiom to do so (which is implemented by " +"the :c:macro:`Py_RETURN_NONE` macro)::" msgstr "" "如果你有一個不回傳任何有用引數的 C 函式(一個回傳 :c:expr:`void` 的函式),對" "應的 Python 函式必須回傳 ``None``。你需要以下這個慣例來達成" @@ -692,8 +694,9 @@ msgstr "" #: ../../extending/extending.rst:334 msgid "" "When using only ``METH_VARARGS``, the function should expect the Python-" -"level parameters to be passed in as a tuple acceptable for parsing via :c:" -"func:`PyArg_ParseTuple`; more information on this function is provided below." +"level parameters to be passed in as a tuple acceptable for parsing " +"via :c:func:`PyArg_ParseTuple`; more information on this function is " +"provided below." msgstr "" "當只使用 ``METH_VARARGS`` 時,函式應預期 Python 層級的參數是以元組形式傳入且" "能夠接受以 :c:func:`PyArg_ParseTuple` 進行剖析;有關此函式的更多資訊將在下面" @@ -740,9 +743,9 @@ msgstr "" #: ../../extending/extending.rst:355 msgid "" "This structure, in turn, must be passed to the interpreter in the module's " -"initialization function. The initialization function must be named :c:func:" -"`!PyInit_name`, where *name* is the name of the module, and should be the " -"only non-\\ ``static`` item defined in the module file::" +"initialization function. The initialization function must be " +"named :c:func:`!PyInit_name`, where *name* is the name of the module, and " +"should be the only non-\\ ``static`` item defined in the module file::" msgstr "" "反過來說,這個結構必須在模組的初始化函式中被傳給直譯器。初始化函式必須被命名" "為 :c:func:`!PyInit_name`,其中 *name* 是模組的名稱,且應該是模組檔案中唯一定" @@ -768,21 +771,21 @@ msgid "" "return type, declares any special linkage declarations required by the " "platform, and for C++ declares the function as ``extern \"C\"``." msgstr "" -"請注意,:c:macro:`PyMODINIT_FUNC` 宣告函式的回傳型別為 `PyObject *``、宣告平" +"請注意,:c:macro:`PyMODINIT_FUNC` 宣告函式的回傳型別為 ``PyObject *``、宣告平" "台所需的任何特殊連結宣告、並針對 C++ 宣告函式為 ``extern \"C\"``。" #: ../../extending/extending.rst:370 msgid "" -"When the Python program imports module :mod:`!spam` for the first time, :c:" -"func:`!PyInit_spam` is called. (See below for comments about embedding " -"Python.) It calls :c:func:`PyModule_Create`, which returns a module object, " -"and inserts built-in function objects into the newly created module based " -"upon the table (an array of :c:type:`PyMethodDef` structures) found in the " -"module definition. :c:func:`PyModule_Create` returns a pointer to the module " -"object that it creates. It may abort with a fatal error for certain errors, " -"or return ``NULL`` if the module could not be initialized satisfactorily. " -"The init function must return the module object to its caller, so that it " -"then gets inserted into ``sys.modules``." +"When the Python program imports module :mod:`!spam` for the first " +"time, :c:func:`!PyInit_spam` is called. (See below for comments about " +"embedding Python.) It calls :c:func:`PyModule_Create`, which returns a " +"module object, and inserts built-in function objects into the newly created " +"module based upon the table (an array of :c:type:`PyMethodDef` structures) " +"found in the module definition. :c:func:`PyModule_Create` returns a pointer " +"to the module object that it creates. It may abort with a fatal error for " +"certain errors, or return ``NULL`` if the module could not be initialized " +"satisfactorily. The init function must return the module object to its " +"caller, so that it then gets inserted into ``sys.modules``." msgstr "" "當 Python 程式第一次引入模組 :mod:`!spam` 時,:c:func:`!PyInit_spam` 會被呼" "叫。(有關嵌入 Python 的註解請參見下文。)它會呼叫回傳一個模組物件" @@ -797,8 +800,9 @@ msgstr "" msgid "" "When embedding Python, the :c:func:`!PyInit_spam` function is not called " "automatically unless there's an entry in the :c:data:`PyImport_Inittab` " -"table. To add the module to the initialization table, use :c:func:" -"`PyImport_AppendInittab`, optionally followed by an import of the module::" +"table. To add the module to the initialization table, " +"use :c:func:`PyImport_AppendInittab`, optionally followed by an import of " +"the module::" msgstr "" "嵌入 Python 時,除非在 :c:data:`PyImport_Inittab` 表中有相關條目,否則不會自" "動呼叫 :c:func:`!PyInit_spam` 函式。要將模組加入初始化表,請使" @@ -948,9 +952,10 @@ msgid "" "There are two more things to do before you can use your new extension: " "compiling and linking it with the Python system. If you use dynamic " "loading, the details may depend on the style of dynamic loading your system " -"uses; see the chapters about building extension modules (chapter :ref:" -"`building`) and additional information that pertains only to building on " -"Windows (chapter :ref:`building-on-windows`) for more information about this." +"uses; see the chapters about building extension modules " +"(chapter :ref:`building`) and additional information that pertains only to " +"building on Windows (chapter :ref:`building-on-windows`) for more " +"information about this." msgstr "" #: ../../extending/extending.rst:466 @@ -1049,10 +1054,10 @@ msgstr "" #: ../../extending/extending.rst:540 msgid "" -"This function must be registered with the interpreter using the :c:macro:" -"`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The :" -"c:func:`PyArg_ParseTuple` function and its arguments are documented in " -"section :ref:`parsetuple`." +"This function must be registered with the interpreter using " +"the :c:macro:`METH_VARARGS` flag; this is described in " +"section :ref:`methodtable`. The :c:func:`PyArg_ParseTuple` function and its " +"arguments are documented in section :ref:`parsetuple`." msgstr "" #: ../../extending/extending.rst:545 @@ -1065,14 +1070,15 @@ msgstr "" #: ../../extending/extending.rst:552 msgid "" -"Later, when it is time to call the function, you call the C function :c:func:" -"`PyObject_CallObject`. This function has two arguments, both pointers to " -"arbitrary Python objects: the Python function, and the argument list. The " -"argument list must always be a tuple object, whose length is the number of " -"arguments. To call the Python function with no arguments, pass in ``NULL``, " -"or an empty tuple; to call it with one argument, pass a singleton tuple. :c:" -"func:`Py_BuildValue` returns a tuple when its format string consists of zero " -"or more format codes between parentheses. For example::" +"Later, when it is time to call the function, you call the C " +"function :c:func:`PyObject_CallObject`. This function has two arguments, " +"both pointers to arbitrary Python objects: the Python function, and the " +"argument list. The argument list must always be a tuple object, whose " +"length is the number of arguments. To call the Python function with no " +"arguments, pass in ``NULL``, or an empty tuple; to call it with one " +"argument, pass a singleton tuple. :c:func:`Py_BuildValue` returns a tuple " +"when its format string consists of zero or more format codes between " +"parentheses. For example::" msgstr "" #: ../../extending/extending.rst:561 @@ -1094,8 +1100,9 @@ msgid "" ":c:func:`PyObject_CallObject` returns a Python object pointer: this is the " "return value of the Python function. :c:func:`PyObject_CallObject` is " "\"reference-count-neutral\" with respect to its arguments. In the example a " -"new tuple was created to serve as the argument list, which is :c:func:" -"`Py_DECREF`\\ -ed immediately after the :c:func:`PyObject_CallObject` call." +"new tuple was created to serve as the argument list, which " +"is :c:func:`Py_DECREF`\\ -ed immediately after " +"the :c:func:`PyObject_CallObject` call." msgstr "" #: ../../extending/extending.rst:579 @@ -1161,9 +1168,10 @@ msgstr "" #: ../../extending/extending.rst:621 msgid "" -"You may also call a function with keyword arguments by using :c:func:" -"`PyObject_Call`, which supports arguments and keyword arguments. As in the " -"above example, we use :c:func:`Py_BuildValue` to construct the dictionary. ::" +"You may also call a function with keyword arguments by " +"using :c:func:`PyObject_Call`, which supports arguments and keyword " +"arguments. As in the above example, we use :c:func:`Py_BuildValue` to " +"construct the dictionary. ::" msgstr "" #: ../../extending/extending.rst:625 @@ -1316,21 +1324,21 @@ msgstr "" #: ../../extending/extending.rst:740 msgid "" -"The *arg* and *format* parameters are identical to those of the :c:func:" -"`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of " -"keywords received as the third parameter from the Python runtime. The " -"*kwlist* parameter is a ``NULL``-terminated list of strings which identify " -"the parameters; the names are matched with the type information from " -"*format* from left to right. On success, :c:func:" -"`PyArg_ParseTupleAndKeywords` returns true, otherwise it returns false and " -"raises an appropriate exception." +"The *arg* and *format* parameters are identical to those of " +"the :c:func:`PyArg_ParseTuple` function. The *kwdict* parameter is the " +"dictionary of keywords received as the third parameter from the Python " +"runtime. The *kwlist* parameter is a ``NULL``-terminated list of strings " +"which identify the parameters; the names are matched with the type " +"information from *format* from left to right. On " +"success, :c:func:`PyArg_ParseTupleAndKeywords` returns true, otherwise it " +"returns false and raises an appropriate exception." msgstr "" #: ../../extending/extending.rst:750 msgid "" "Nested tuples cannot be parsed when using keyword arguments! Keyword " -"parameters passed in which are not present in the *kwlist* will cause :exc:" -"`TypeError` to be raised." +"parameters passed in which are not present in the *kwlist* will " +"cause :exc:`TypeError` to be raised." msgstr "" #: ../../extending/extending.rst:756 @@ -1409,10 +1417,10 @@ msgstr "PyObject *Py_BuildValue(const char *format, ...);" #: ../../extending/extending.rst:818 msgid "" -"It recognizes a set of format units similar to the ones recognized by :c:" -"func:`PyArg_ParseTuple`, but the arguments (which are input to the function, " -"not output) must not be pointers, just values. It returns a new Python " -"object, suitable for returning from a C function called from Python." +"It recognizes a set of format units similar to the ones recognized " +"by :c:func:`PyArg_ParseTuple`, but the arguments (which are input to the " +"function, not output) must not be pointers, just values. It returns a new " +"Python object, suitable for returning from a C function called from Python." msgstr "" #: ../../extending/extending.rst:823 @@ -1486,16 +1494,16 @@ msgstr "" #: ../../extending/extending.rst:865 msgid "" "Every block of memory allocated with :c:func:`malloc` should eventually be " -"returned to the pool of available memory by exactly one call to :c:func:" -"`free`. It is important to call :c:func:`free` at the right time. If a " -"block's address is forgotten but :c:func:`free` is not called for it, the " -"memory it occupies cannot be reused until the program terminates. This is " -"called a :dfn:`memory leak`. On the other hand, if a program calls :c:func:" -"`free` for a block and then continues to use the block, it creates a " -"conflict with reuse of the block through another :c:func:`malloc` call. " -"This is called :dfn:`using freed memory`. It has the same bad consequences " -"as referencing uninitialized data --- core dumps, wrong results, mysterious " -"crashes." +"returned to the pool of available memory by exactly one call " +"to :c:func:`free`. It is important to call :c:func:`free` at the right " +"time. If a block's address is forgotten but :c:func:`free` is not called " +"for it, the memory it occupies cannot be reused until the program " +"terminates. This is called a :dfn:`memory leak`. On the other hand, if a " +"program calls :c:func:`free` for a block and then continues to use the " +"block, it creates a conflict with reuse of the block through " +"another :c:func:`malloc` call. This is called :dfn:`using freed memory`. It " +"has the same bad consequences as referencing uninitialized data --- core " +"dumps, wrong results, mysterious crashes." msgstr "" #: ../../extending/extending.rst:876 @@ -1559,9 +1567,9 @@ msgstr "" #: ../../extending/extending.rst:920 msgid "" "The cycle detector is able to detect garbage cycles and can reclaim them. " -"The :mod:`gc` module exposes a way to run the detector (the :func:`~gc." -"collect` function), as well as configuration interfaces and the ability to " -"disable the detector at runtime." +"The :mod:`gc` module exposes a way to run the detector " +"(the :func:`~gc.collect` function), as well as configuration interfaces and " +"the ability to disable the detector at runtime." msgstr "" #: ../../extending/extending.rst:929 @@ -1571,12 +1579,12 @@ msgstr "" #: ../../extending/extending.rst:931 msgid "" "There are two macros, ``Py_INCREF(x)`` and ``Py_DECREF(x)``, which handle " -"the incrementing and decrementing of the reference count. :c:func:" -"`Py_DECREF` also frees the object when the count reaches zero. For " -"flexibility, it doesn't call :c:func:`free` directly --- rather, it makes a " -"call through a function pointer in the object's :dfn:`type object`. For " -"this purpose (and others), every object also contains a pointer to its type " -"object." +"the incrementing and decrementing of the reference " +"count. :c:func:`Py_DECREF` also frees the object when the count reaches " +"zero. For flexibility, it doesn't call :c:func:`free` directly --- rather, " +"it makes a call through a function pointer in the object's :dfn:`type " +"object`. For this purpose (and others), every object also contains a " +"pointer to its type object." msgstr "" #: ../../extending/extending.rst:938 @@ -1614,11 +1622,11 @@ msgstr "" #: ../../extending/extending.rst:961 msgid "" -"A borrowed reference can be changed into an owned reference by calling :c:" -"func:`Py_INCREF`. This does not affect the status of the owner from which " -"the reference was borrowed --- it creates a new owned reference, and gives " -"full owner responsibilities (the new owner must dispose of the reference " -"properly, as well as the previous owner)." +"A borrowed reference can be changed into an owned reference by " +"calling :c:func:`Py_INCREF`. This does not affect the status of the owner " +"from which the reference was borrowed --- it creates a new owned reference, " +"and gives full owner responsibilities (the new owner must dispose of the " +"reference properly, as well as the previous owner)." msgstr "" #: ../../extending/extending.rst:971 @@ -1638,20 +1646,20 @@ msgid "" "the reference. In particular, all functions whose function it is to create " "a new object, such as :c:func:`PyLong_FromLong` and :c:func:`Py_BuildValue`, " "pass ownership to the receiver. Even if the object is not actually new, you " -"still receive ownership of a new reference to that object. For instance, :c:" -"func:`PyLong_FromLong` maintains a cache of popular values and can return a " -"reference to a cached item." +"still receive ownership of a new reference to that object. For " +"instance, :c:func:`PyLong_FromLong` maintains a cache of popular values and " +"can return a reference to a cached item." msgstr "" #: ../../extending/extending.rst:985 msgid "" "Many functions that extract objects from other objects also transfer " -"ownership with the reference, for instance :c:func:" -"`PyObject_GetAttrString`. The picture is less clear, here, however, since a " -"few common routines are exceptions: :c:func:`PyTuple_GetItem`, :c:func:" -"`PyList_GetItem`, :c:func:`PyDict_GetItem`, and :c:func:" -"`PyDict_GetItemString` all return references that you borrow from the tuple, " -"list or dictionary." +"ownership with the reference, for " +"instance :c:func:`PyObject_GetAttrString`. The picture is less clear, here, " +"however, since a few common routines are " +"exceptions: :c:func:`PyTuple_GetItem`, :c:func:`PyList_GetItem`, :c:func:`PyDict_GetItem`, " +"and :c:func:`PyDict_GetItemString` all return references that you borrow " +"from the tuple, list or dictionary." msgstr "" #: ../../extending/extending.rst:992 @@ -1666,10 +1674,11 @@ msgid "" "When you pass an object reference into another function, in general, the " "function borrows the reference from you --- if it needs to store it, it will " "use :c:func:`Py_INCREF` to become an independent owner. There are exactly " -"two important exceptions to this rule: :c:func:`PyTuple_SetItem` and :c:func:" -"`PyList_SetItem`. These functions take over ownership of the item passed to " -"them --- even if they fail! (Note that :c:func:`PyDict_SetItem` and friends " -"don't take over ownership --- they are \"normal.\")" +"two important exceptions to this rule: :c:func:`PyTuple_SetItem` " +"and :c:func:`PyList_SetItem`. These functions take over ownership of the " +"item passed to them --- even if they fail! (Note " +"that :c:func:`PyDict_SetItem` and friends don't take over ownership --- they " +"are \"normal.\")" msgstr "" #: ../../extending/extending.rst:1004 @@ -1844,8 +1853,8 @@ msgstr "" #: ../../extending/extending.rst:1110 msgid "" "The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for " -"``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` and :c:" -"func:`Py_XDECREF` do." +"``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` " +"and :c:func:`Py_XDECREF` do." msgstr "" #: ../../extending/extending.rst:1114 @@ -2173,9 +2182,9 @@ msgstr "" #: ../../extending/extending.rst:1344 msgid "" -"All that a client module must do in order to have access to the function :c:" -"func:`!PySpam_System` is to call the function (or rather macro) :c:func:`!" -"import_spam` in its initialization function::" +"All that a client module must do in order to have access to the " +"function :c:func:`!PySpam_System` is to call the function (or rather " +"macro) :c:func:`!import_spam` in its initialization function::" msgstr "" #: ../../extending/extending.rst:1348 @@ -2214,12 +2223,12 @@ msgstr "" #: ../../extending/extending.rst:1374 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../extending/extending.rst:1375 msgid "" -"An interface for this function already exists in the standard module :mod:" -"`os` --- it was chosen as a simple and straightforward example." +"An interface for this function already exists in the standard " +"module :mod:`os` --- it was chosen as a simple and straightforward example." msgstr "" #: ../../extending/extending.rst:1378 diff --git a/extending/newtypes_tutorial.po b/extending/newtypes_tutorial.po index d344eb253f..3481c835b2 100644 --- a/extending/newtypes_tutorial.po +++ b/extending/newtypes_tutorial.po @@ -33,14 +33,14 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:26 msgid "" -"The :term:`CPython` runtime sees all Python objects as variables of type :c:" -"expr:`PyObject*`, which serves as a \"base type\" for all Python objects. " -"The :c:type:`PyObject` structure itself only contains the object's :term:" -"`reference count` and a pointer to the object's \"type object\". This is " -"where the action is; the type object determines which (C) functions get " -"called by the interpreter when, for instance, an attribute gets looked up on " -"an object, a method called, or it is multiplied by another object. These C " -"functions are called \"type methods\"." +"The :term:`CPython` runtime sees all Python objects as variables of " +"type :c:expr:`PyObject*`, which serves as a \"base type\" for all Python " +"objects. The :c:type:`PyObject` structure itself only contains the " +"object's :term:`reference count` and a pointer to the object's \"type " +"object\". This is where the action is; the type object determines which (C) " +"functions get called by the interpreter when, for instance, an attribute " +"gets looked up on an object, a method called, or it is multiplied by another " +"object. These C functions are called \"type methods\"." msgstr "" #: ../../extending/newtypes_tutorial.rst:35 @@ -60,8 +60,8 @@ msgstr "" msgid "" "What we're showing here is the traditional way of defining *static* " "extension types. It should be adequate for most uses. The C API also " -"allows defining heap-allocated extension types using the :c:func:" -"`PyType_FromSpec` function, which isn't covered in this tutorial." +"allows defining heap-allocated extension types using " +"the :c:func:`PyType_FromSpec` function, which isn't covered in this tutorial." msgstr "" #: ../../extending/newtypes_tutorial.rst:48 @@ -264,9 +264,10 @@ msgstr "" msgid "" "Note that the name is a dotted name that includes both the module name and " "the name of the type within the module. The module in this case is :mod:`!" -"custom` and the type is :class:`!Custom`, so we set the type name to :class:" -"`!custom.Custom`. Using the real dotted import path is important to make " -"your type compatible with the :mod:`pydoc` and :mod:`pickle` modules. ::" +"custom` and the type is :class:`!Custom`, so we set the type name " +"to :class:`!custom.Custom`. Using the real dotted import path is important " +"to make your type compatible with the :mod:`pydoc` and :mod:`pickle` " +"modules. ::" msgstr "" #: ../../extending/newtypes_tutorial.rst:135 @@ -279,9 +280,9 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:138 msgid "" -"This is so that Python knows how much memory to allocate when creating new :" -"class:`!Custom` instances. :c:member:`~PyTypeObject.tp_itemsize` is only " -"used for variable-sized objects and should otherwise be zero." +"This is so that Python knows how much memory to allocate when creating " +"new :class:`!Custom` instances. :c:member:`~PyTypeObject.tp_itemsize` is " +"only used for variable-sized objects and should otherwise be zero." msgstr "" #: ../../extending/newtypes_tutorial.rst:144 @@ -324,11 +325,11 @@ msgstr ".tp_doc = PyDoc_STR(\"Custom objects\")," #: ../../extending/newtypes_tutorial.rst:166 msgid "" -"To enable object creation, we have to provide a :c:member:`~PyTypeObject." -"tp_new` handler. This is the equivalent of the Python method :meth:`~object." -"__new__`, but has to be specified explicitly. In this case, we can just use " -"the default implementation provided by the API function :c:func:" -"`PyType_GenericNew`. ::" +"To enable object creation, we have to provide " +"a :c:member:`~PyTypeObject.tp_new` handler. This is the equivalent of the " +"Python method :meth:`~object.__new__`, but has to be specified explicitly. " +"In this case, we can just use the default implementation provided by the API " +"function :c:func:`PyType_GenericNew`. ::" msgstr "" #: ../../extending/newtypes_tutorial.rst:171 @@ -337,8 +338,8 @@ msgstr ".tp_new = PyType_GenericNew," #: ../../extending/newtypes_tutorial.rst:173 msgid "" -"Everything else in the file should be familiar, except for some code in :c:" -"func:`!PyInit_custom`::" +"Everything else in the file should be familiar, except for some code " +"in :c:func:`!PyInit_custom`::" msgstr "" #: ../../extending/newtypes_tutorial.rst:176 @@ -357,24 +358,21 @@ msgid "" msgstr "" #: ../../extending/newtypes_tutorial.rst:183 -#, fuzzy msgid "" "if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" " Py_DECREF(m);\n" " return NULL;\n" "}" msgstr "" -"Py_INCREF(&CustomType);\n" -"if (PyModule_AddObject(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" -" Py_DECREF(&CustomType);\n" +"if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" " Py_DECREF(m);\n" " return NULL;\n" "}" #: ../../extending/newtypes_tutorial.rst:188 msgid "" -"This adds the type to the module dictionary. This allows us to create :" -"class:`!Custom` instances by calling the :class:`!Custom` class:" +"This adds the type to the module dictionary. This allows us to " +"create :class:`!Custom` instances by calling the :class:`!Custom` class:" msgstr "" #: ../../extending/newtypes_tutorial.rst:191 @@ -659,13 +657,13 @@ msgstr ".tp_dealloc = (destructor) Custom_dealloc," #: ../../extending/newtypes_tutorial.rst:264 msgid "" -"This method first clears the reference counts of the two Python attributes. :" -"c:func:`Py_XDECREF` correctly handles the case where its argument is " -"``NULL`` (which might happen here if ``tp_new`` failed midway). It then " -"calls the :c:member:`~PyTypeObject.tp_free` member of the object's type " -"(computed by ``Py_TYPE(self)``) to free the object's memory. Note that the " -"object's type might not be :class:`!CustomType`, because the object may be " -"an instance of a subclass." +"This method first clears the reference counts of the two Python " +"attributes. :c:func:`Py_XDECREF` correctly handles the case where its " +"argument is ``NULL`` (which might happen here if ``tp_new`` failed midway). " +"It then calls the :c:member:`~PyTypeObject.tp_free` member of the object's " +"type (computed by ``Py_TYPE(self)``) to free the object's memory. Note that " +"the object's type might not be :class:`!CustomType`, because the object may " +"be an instance of a subclass." msgstr "" #: ../../extending/newtypes_tutorial.rst:273 @@ -738,12 +736,13 @@ msgstr ".tp_new = Custom_new," #: ../../extending/newtypes_tutorial.rst:307 msgid "" "The ``tp_new`` handler is responsible for creating (as opposed to " -"initializing) objects of the type. It is exposed in Python as the :meth:" -"`~object.__new__` method. It is not required to define a ``tp_new`` member, " -"and indeed many extension types will simply reuse :c:func:" -"`PyType_GenericNew` as done in the first version of the :class:`!Custom` " -"type above. In this case, we use the ``tp_new`` handler to initialize the " -"``first`` and ``last`` attributes to non-``NULL`` default values." +"initializing) objects of the type. It is exposed in Python as " +"the :meth:`~object.__new__` method. It is not required to define a " +"``tp_new`` member, and indeed many extension types will simply " +"reuse :c:func:`PyType_GenericNew` as done in the first version of " +"the :class:`!Custom` type above. In this case, we use the ``tp_new`` " +"handler to initialize the ``first`` and ``last`` attributes to non-``NULL`` " +"default values." msgstr "" #: ../../extending/newtypes_tutorial.rst:315 @@ -752,8 +751,8 @@ msgid "" "``CustomType``, if a subclass is instantiated) and any arguments passed when " "the type was called, and is expected to return the instance created. " "``tp_new`` handlers always accept positional and keyword arguments, but they " -"often ignore the arguments, leaving the argument handling to initializer (a." -"k.a. ``tp_init`` in C or ``__init__`` in Python) methods." +"often ignore the arguments, leaving the argument handling to initializer " +"(a.k.a. ``tp_init`` in C or ``__init__`` in Python) methods." msgstr "" #: ../../extending/newtypes_tutorial.rst:323 @@ -774,8 +773,9 @@ msgstr "self = (CustomObject *) type->tp_alloc(type, 0);" #: ../../extending/newtypes_tutorial.rst:331 msgid "" -"Since memory allocation may fail, we must check the :c:member:`~PyTypeObject." -"tp_alloc` result against ``NULL`` before proceeding." +"Since memory allocation may fail, we must check " +"the :c:member:`~PyTypeObject.tp_alloc` result against ``NULL`` before " +"proceeding." msgstr "" #: ../../extending/newtypes_tutorial.rst:335 @@ -789,14 +789,15 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:341 msgid "" "If you are creating a co-operative :c:member:`~PyTypeObject.tp_new` (one " -"that calls a base type's :c:member:`~PyTypeObject.tp_new` or :meth:`~object." -"__new__`), you must *not* try to determine what method to call using method " -"resolution order at runtime. Always statically determine what type you are " -"going to call, and call its :c:member:`~PyTypeObject.tp_new` directly, or " -"via ``type->tp_base->tp_new``. If you do not do this, Python subclasses of " -"your type that also inherit from other Python-defined classes may not work " -"correctly. (Specifically, you may not be able to create instances of such " -"subclasses without getting a :exc:`TypeError`.)" +"that calls a base type's :c:member:`~PyTypeObject.tp_new` " +"or :meth:`~object.__new__`), you must *not* try to determine what method to " +"call using method resolution order at runtime. Always statically determine " +"what type you are going to call, and call " +"its :c:member:`~PyTypeObject.tp_new` directly, or via ``type->tp_base-" +">tp_new``. If you do not do this, Python subclasses of your type that also " +"inherit from other Python-defined classes may not work correctly. " +"(Specifically, you may not be able to create instances of such subclasses " +"without getting a :exc:`TypeError`.)" msgstr "" #: ../../extending/newtypes_tutorial.rst:351 @@ -869,10 +870,10 @@ msgstr ".tp_init = (initproc) Custom_init," #: ../../extending/newtypes_tutorial.rst:384 msgid "" -"The :c:member:`~PyTypeObject.tp_init` slot is exposed in Python as the :meth:" -"`~object.__init__` method. It is used to initialize an object after it's " -"created. Initializers always accept positional and keyword arguments, and " -"they should return either ``0`` on success or ``-1`` on error." +"The :c:member:`~PyTypeObject.tp_init` slot is exposed in Python as " +"the :meth:`~object.__init__` method. It is used to initialize an object " +"after it's created. Initializers always accept positional and keyword " +"arguments, and they should return either ``0`` on success or ``-1`` on error." msgstr "" #: ../../extending/newtypes_tutorial.rst:389 @@ -923,15 +924,15 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:416 msgid "" -"when we know that deallocation of the object [#]_ will neither release the :" -"term:`GIL` nor cause any calls back into our type's code;" +"when we know that deallocation of the object [#]_ will neither release " +"the :term:`GIL` nor cause any calls back into our type's code;" msgstr "" #: ../../extending/newtypes_tutorial.rst:419 msgid "" -"when decrementing a reference count in a :c:member:`~PyTypeObject." -"tp_dealloc` handler on a type which doesn't support cyclic garbage " -"collection [#]_." +"when decrementing a reference count in " +"a :c:member:`~PyTypeObject.tp_dealloc` handler on a type which doesn't " +"support cyclic garbage collection [#]_." msgstr "" #: ../../extending/newtypes_tutorial.rst:422 @@ -1018,12 +1019,12 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:467 msgid "" -"The method is implemented as a C function that takes a :class:`!Custom` (or :" -"class:`!Custom` subclass) instance as the first argument. Methods always " -"take an instance as the first argument. Methods often take positional and " -"keyword arguments as well, but in this case we don't take any and don't need " -"to accept a positional argument tuple or keyword argument dictionary. This " -"method is equivalent to the Python method:" +"The method is implemented as a C function that takes a :class:`!Custom` " +"(or :class:`!Custom` subclass) instance as the first argument. Methods " +"always take an instance as the first argument. Methods often take positional " +"and keyword arguments as well, but in this case we don't take any and don't " +"need to accept a positional argument tuple or keyword argument dictionary. " +"This method is equivalent to the Python method:" msgstr "" #: ../../extending/newtypes_tutorial.rst:474 @@ -1036,11 +1037,11 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:479 msgid "" -"Note that we have to check for the possibility that our :attr:`!first` and :" -"attr:`!last` members are ``NULL``. This is because they can be deleted, in " -"which case they are set to ``NULL``. It would be better to prevent deletion " -"of these attributes and to restrict the attribute values to be strings. " -"We'll see how to do that in the next section." +"Note that we have to check for the possibility that our :attr:`!first` " +"and :attr:`!last` members are ``NULL``. This is because they can be " +"deleted, in which case they are set to ``NULL``. It would be better to " +"prevent deletion of these attributes and to restrict the attribute values to " +"be strings. We'll see how to do that in the next section." msgstr "" #: ../../extending/newtypes_tutorial.rst:485 @@ -1122,9 +1123,9 @@ msgstr "" msgid "" "In this section, we'll provide finer control over how the :attr:`!first` " "and :attr:`!last` attributes are set in the :class:`!Custom` example. In the " -"previous version of our module, the instance variables :attr:`!first` and :" -"attr:`!last` could be set to non-string values or even deleted. We want to " -"make sure that these attributes always contain strings." +"previous version of our module, the instance variables :attr:`!first` " +"and :attr:`!last` could be set to non-string values or even deleted. We want " +"to make sure that these attributes always contain strings." msgstr "" #: ../../extending/newtypes_tutorial.rst:538 @@ -1489,9 +1490,10 @@ msgstr "" msgid "" "In the second version of the :class:`!Custom` example, we allowed any kind " "of object to be stored in the :attr:`!first` or :attr:`!last` attributes " -"[#]_. Besides, in the second and third versions, we allowed subclassing :" -"class:`!Custom`, and subclasses may add arbitrary attributes. For any of " -"those two reasons, :class:`!Custom` objects can participate in cycles:" +"[#]_. Besides, in the second and third versions, we allowed " +"subclassing :class:`!Custom`, and subclasses may add arbitrary attributes. " +"For any of those two reasons, :class:`!Custom` objects can participate in " +"cycles:" msgstr "" #: ../../extending/newtypes_tutorial.rst:673 @@ -1757,11 +1759,11 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:708 msgid "" -"For each subobject that can participate in cycles, we need to call the :c:" -"func:`!visit` function, which is passed to the traversal method. The :c:func:" -"`!visit` function takes as arguments the subobject and the extra argument " -"*arg* passed to the traversal method. It returns an integer value that must " -"be returned if it is non-zero." +"For each subobject that can participate in cycles, we need to call " +"the :c:func:`!visit` function, which is passed to the traversal method. " +"The :c:func:`!visit` function takes as arguments the subobject and the extra " +"argument *arg* passed to the traversal method. It returns an integer value " +"that must be returned if it is non-zero." msgstr "" #: ../../extending/newtypes_tutorial.rst:714 @@ -1847,9 +1849,9 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:756 msgid "" -"Nevertheless, it is much easier and less error-prone to always use :c:func:" -"`Py_CLEAR` when deleting an attribute. Don't try to micro-optimize at the " -"expense of robustness!" +"Nevertheless, it is much easier and less error-prone to always " +"use :c:func:`Py_CLEAR` when deleting an attribute. Don't try to micro-" +"optimize at the expense of robustness!" msgstr "" #: ../../extending/newtypes_tutorial.rst:760 @@ -1858,8 +1860,8 @@ msgid "" "attributes. It means the circular GC can be triggered inside the function. " "Since the GC assumes reference count is not zero, we need to untrack the " "object from the GC by calling :c:func:`PyObject_GC_UnTrack` before clearing " -"members. Here is our reimplemented deallocator using :c:func:" -"`PyObject_GC_UnTrack` and ``Custom_clear``::" +"members. Here is our reimplemented deallocator " +"using :c:func:`PyObject_GC_UnTrack` and ``Custom_clear``::" msgstr "" #: ../../extending/newtypes_tutorial.rst:767 @@ -1893,9 +1895,10 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:779 msgid "" -"That's pretty much it. If we had written custom :c:member:`~PyTypeObject." -"tp_alloc` or :c:member:`~PyTypeObject.tp_free` handlers, we'd need to modify " -"them for cyclic garbage collection. Most extensions will use the versions " +"That's pretty much it. If we had written " +"custom :c:member:`~PyTypeObject.tp_alloc` " +"or :c:member:`~PyTypeObject.tp_free` handlers, we'd need to modify them for " +"cyclic garbage collection. Most extensions will use the versions " "automatically provided." msgstr "" @@ -2074,8 +2077,9 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:839 msgid "" -"This pattern is important when writing a type with custom :c:member:" -"`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_dealloc` members. " +"This pattern is important when writing a type with " +"custom :c:member:`~PyTypeObject.tp_new` " +"and :c:member:`~PyTypeObject.tp_dealloc` members. " "The :c:member:`~PyTypeObject.tp_new` handler should not actually create the " "memory for the object with its :c:member:`~PyTypeObject.tp_alloc`, but let " "the base class handle it by calling its own :c:member:`~PyTypeObject.tp_new`." @@ -2083,15 +2087,14 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:845 msgid "" -"The :c:type:`PyTypeObject` struct supports a :c:member:`~PyTypeObject." -"tp_base` specifying the type's concrete base class. Due to cross-platform " -"compiler issues, you can't fill that field directly with a reference to :c:" -"type:`PyList_Type`; it should be done later in the module initialization " -"function::" +"The :c:type:`PyTypeObject` struct supports " +"a :c:member:`~PyTypeObject.tp_base` specifying the type's concrete base " +"class. Due to cross-platform compiler issues, you can't fill that field " +"directly with a reference to :c:type:`PyList_Type`; it should be done later " +"in the module initialization function::" msgstr "" #: ../../extending/newtypes_tutorial.rst:851 -#, fuzzy msgid "" "PyMODINIT_FUNC\n" "PyInit_sublist(void)\n" @@ -2126,10 +2129,8 @@ msgstr "" " if (m == NULL)\n" " return NULL;\n" "\n" -" Py_INCREF(&SubListType);\n" -" if (PyModule_AddObject(m, \"SubList\", (PyObject *) &SubListType) < 0) " -"{\n" -" Py_DECREF(&SubListType);\n" +" if (PyModule_AddObjectRef(m, \"SubList\", (PyObject *) &SubListType) < " +"0) {\n" " Py_DECREF(m);\n" " return NULL;\n" " }\n" @@ -2139,11 +2140,11 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:871 msgid "" -"Before calling :c:func:`PyType_Ready`, the type structure must have the :c:" -"member:`~PyTypeObject.tp_base` slot filled in. When we are deriving an " -"existing type, it is not necessary to fill out the :c:member:`~PyTypeObject." -"tp_alloc` slot with :c:func:`PyType_GenericNew` -- the allocation function " -"from the base type will be inherited." +"Before calling :c:func:`PyType_Ready`, the type structure must have " +"the :c:member:`~PyTypeObject.tp_base` slot filled in. When we are deriving " +"an existing type, it is not necessary to fill out " +"the :c:member:`~PyTypeObject.tp_alloc` slot with :c:func:`PyType_GenericNew` " +"-- the allocation function from the base type will be inherited." msgstr "" #: ../../extending/newtypes_tutorial.rst:877 @@ -2154,7 +2155,7 @@ msgstr "" #: ../../extending/newtypes_tutorial.rst:882 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../extending/newtypes_tutorial.rst:883 msgid "" diff --git a/faq/design.po b/faq/design.po index 8474f7dc97..91ee765253 100644 --- a/faq/design.po +++ b/faq/design.po @@ -138,17 +138,18 @@ msgstr "" #: ../../faq/design.rst:65 msgid "" -"The :class:`float` type in CPython uses a C ``double`` for storage. A :" -"class:`float` object's value is stored in binary floating-point with a fixed " -"precision (typically 53 bits) and Python uses C operations, which in turn " -"rely on the hardware implementation in the processor, to perform floating-" -"point operations. This means that as far as floating-point operations are " -"concerned, Python behaves like many popular languages including C and Java." -msgstr "" -"CPython 的 :class:`float` 型別使用了 C 的 ``double`` 型別來儲存。一個 :class:" -"`float` 物件的值會以固定的精度(通常為 53 位元)存為二進制浮點數,Python 使" -"用 C 來運算浮點數,而他的結果會依處理器中的硬體實作方式來決定。這表示就浮點數" -"運算來說,Python 和 C、Java 等很多受歡迎的語言有一樣的行為。" +"The :class:`float` type in CPython uses a C ``double`` for storage. " +"A :class:`float` object's value is stored in binary floating-point with a " +"fixed precision (typically 53 bits) and Python uses C operations, which in " +"turn rely on the hardware implementation in the processor, to perform " +"floating-point operations. This means that as far as floating-point " +"operations are concerned, Python behaves like many popular languages " +"including C and Java." +msgstr "" +"CPython 的 :class:`float` 型別使用了 C 的 ``double`` 型別來儲存。一" +"個 :class:`float` 物件的值會以固定的精度(通常為 53 位元)存為二進制浮點數," +"Python 使用 C 來運算浮點數,而他的結果會依處理器中的硬體實作方式來決定。這表" +"示就浮點數運算來說,Python 和 C、Java 等很多受歡迎的語言有一樣的行為。" #: ../../faq/design.rst:72 msgid "" @@ -249,11 +250,11 @@ msgid "" "``m_`` prefix, so this explicitness is still useful in those languages, too." msgstr "" "第一,這樣可以更明顯表現出你在用方法 (method) 或是實例 (instance) 的屬性,而" -"非一個區域變數。即使不知道類別 (class) 的定義,當看到 ``self.x`` 或 ``self." -"meth()``,就會很清楚地知道是正在使用實例的變數或是方法。在 C++ 裡,你可以藉由" -"沒有區域變數宣告來判斷這件事 ── 但在 Python 裡沒有區域變數宣告,所以你必須去" -"看類別的定義來確定。有些 C++ 和 Java 的程式碼規格要求要在實例屬性的名稱加上前" -"綴 ``m_``,所以這種明確性在那些語言也是很好用的。" +"非一個區域變數。即使不知道類別 (class) 的定義,當看到 ``self.x`` 或 " +"``self.meth()``,就會很清楚地知道是正在使用實例的變數或是方法。在 C++ 裡,你" +"可以藉由沒有區域變數宣告來判斷這件事 ── 但在 Python 裡沒有區域變數宣告,所以" +"你必須去看類別的定義來確定。有些 C++ 和 Java 的程式碼規格要求要在實例屬性的名" +"稱加上前綴 ``m_``,所以這種明確性在那些語言也是很好用的。" #: ../../faq/design.rst:127 msgid "" @@ -353,12 +354,12 @@ msgstr "" msgid "" "(b) When I read code that says len(x) I *know* that it is asking for the " "length of something. This tells me two things: the result is an integer, and " -"the argument is some kind of container. To the contrary, when I read x." -"len(), I have to already know that x is some kind of container implementing " -"an interface or inheriting from a class that has a standard len(). Witness " -"the confusion we occasionally have when a class that is not implementing a " -"mapping has a get() or keys() method, or something that isn't a file has a " -"write() method." +"the argument is some kind of container. To the contrary, when I read " +"x.len(), I have to already know that x is some kind of container " +"implementing an interface or inheriting from a class that has a standard " +"len(). Witness the confusion we occasionally have when a class that is not " +"implementing a mapping has a get() or keys() method, or something that isn't " +"a file has a write() method." msgstr "" "(二) 當我看到一段程式碼寫著 len(x),我\\ *知道*\\ 他要找某個東西的長度。這" "告訴了我兩件事:結果是一個整數、參數是某種容器。相對地,當我看到 x.len(),我" @@ -419,8 +420,9 @@ msgstr "" msgid "" "The second objection is typically cast as: \"I am really telling a sequence " "to join its members together with a string constant\". Sadly, you aren't. " -"For some reason there seems to be much less difficulty with having :meth:" -"`~str.split` as a string method, since in that case it is easy to see that ::" +"For some reason there seems to be much less difficulty with " +"having :meth:`~str.split` as a string method, since in that case it is easy " +"to see that ::" msgstr "" "第二個反對意見通常是:「我是在叫一個序列把它的成員用一個字串常數連接起來」。" "但很遺憾地,你並不是在這樣做。因為某種原因,把 :meth:`~str.split` 當成字串方" @@ -544,8 +546,8 @@ msgstr "" #: ../../faq/design.rst:279 msgid "" -"For calling methods on objects, you can simplify yet further by using the :" -"func:`getattr` built-in to retrieve methods with a particular name::" +"For calling methods on objects, you can simplify yet further by using " +"the :func:`getattr` built-in to retrieve methods with a particular name::" msgstr "" "對於呼叫物件裡的方法,你可以利用內建用來找尋特定方法的函式 :func:`getattr` 來" "做進一步的簡化: ::" @@ -818,10 +820,10 @@ msgstr "" msgid "" "Lists, on the other hand, are more like arrays in other languages. They " "tend to hold a varying number of objects all of which have the same type and " -"which are operated on one-by-one. For example, :func:`os.listdir('.') <os." -"listdir>` returns a list of strings representing the files in the current " -"directory. Functions which operate on this output would generally not break " -"if you added another file or two to the directory." +"which are operated on one-by-one. For example, :func:`os.listdir('.') " +"<os.listdir>` returns a list of strings representing the files in the " +"current directory. Functions which operate on this output would generally " +"not break if you added another file or two to the directory." msgstr "" "另一方面,串列更像是其他語言的陣列 (array)。他可以有不固定個同類別物件,且為" "逐項操作。舉例來說,:func:`os.listdir('.') <os.listdir>` 回傳當下目錄裡的檔" @@ -960,8 +962,8 @@ msgstr "" msgid "" "would raise a :exc:`KeyError` exception because the id of the ``[1, 2]`` " "used in the second line differs from that in the first line. In other " -"words, dictionary keys should be compared using ``==``, not using :keyword:" -"`is`." +"words, dictionary keys should be compared using ``==``, not " +"using :keyword:`is`." msgstr "" "這將會導致 :exc:`KeyError` 例外,因為 ``[1, 2]`` 的 id 在第一行和第二行是不同" "的。換句話說,字典的鍵應該要用 ``==`` 來做比較,而不是用 :keyword:`is`。" @@ -1011,9 +1013,7 @@ msgstr "" "如果你需要的話,這裡有個小技巧可以幫你,但請自己承擔風險:你可以把一個可變物" "件包裝進一個有 :meth:`~object.__eq__` 和 :meth:`~object.__hash__` 方法的類別" "實例。只要這種包裝物件還存在於字典(或其他類似結構)中,你就必須確定在字典" -"(或其他用雜湊為基底的結構)中他們的雜湊值會保持恆定。\n" -"\n" -"::" +"(或其他用雜湊為基底的結構)中他們的雜湊值會保持恆定。 ::" #: ../../faq/design.rst:513 msgid "" @@ -1062,16 +1062,16 @@ msgstr "" #: ../../faq/design.rst:534 msgid "" -"Furthermore it must always be the case that if ``o1 == o2`` (ie ``o1." -"__eq__(o2) is True``) then ``hash(o1) == hash(o2)`` (ie, ``o1.__hash__() == " -"o2.__hash__()``), regardless of whether the object is in a dictionary or " -"not. If you fail to meet these restrictions dictionaries and other hash " -"based structures will misbehave." +"Furthermore it must always be the case that if ``o1 == o2`` (ie " +"``o1.__eq__(o2) is True``) then ``hash(o1) == hash(o2)`` (ie, " +"``o1.__hash__() == o2.__hash__()``), regardless of whether the object is in " +"a dictionary or not. If you fail to meet these restrictions dictionaries " +"and other hash based structures will misbehave." msgstr "" "此外,不管物件是否在字典中,如果 ``o1 == o2``\\ (即 ``o1.__eq__(o2) is " -"True``),則 ``hash(o1) == hash(o2)``\\ (即 ``o1.__hash__() == o2." -"__hash__()``),這個事實必須要成立。如果無法滿足這項限制,那字典和其他用雜湊" -"為基底的結構會出現不正常的行為。" +"True``),則 ``hash(o1) == hash(o2)``\\ (即 ``o1.__hash__() == " +"o2.__hash__()``),這個事實必須要成立。如果無法滿足這項限制,那字典和其他用雜" +"湊為基底的結構會出現不正常的行為。" #: ../../faq/design.rst:539 msgid "" @@ -1136,16 +1136,17 @@ msgstr "" msgid "" "Python 2.6 adds an :mod:`abc` module that lets you define Abstract Base " "Classes (ABCs). You can then use :func:`isinstance` and :func:`issubclass` " -"to check whether an instance or a class implements a particular ABC. The :" -"mod:`collections.abc` module defines a set of useful ABCs such as :class:" -"`~collections.abc.Iterable`, :class:`~collections.abc.Container`, and :class:" -"`~collections.abc.MutableMapping`." +"to check whether an instance or a class implements a particular ABC. " +"The :mod:`collections.abc` module defines a set of useful ABCs such " +"as :class:`~collections.abc.Iterable`, :class:`~collections.abc.Container`, " +"and :class:`~collections.abc.MutableMapping`." msgstr "" "Python 2.6 加入了 :mod:`abc` 模組,讓你可以定義抽象基底類別 (Abstract Base " "Class, ABC)。你可以使用 :func:`isinstance` 和 :func:`issubclass` 來確認一個實" "例或是類別是否實作了某個抽象基底類別。而 :mod:`collections.abc` 模組定義了一" -"系列好用的抽象基底類別,像是 :class:`~collections.abc.Iterable`、:class:" -"`~collections.abc.Container` 和 :class:`~collections.abc.MutableMapping`。" +"系列好用的抽象基底類別,像" +"是 :class:`~collections.abc.Iterable`、:class:`~collections.abc.Container` " +"和 :class:`~collections.abc.MutableMapping`。" #: ../../faq/design.rst:578 msgid "" @@ -1159,12 +1160,12 @@ msgid "" "as a module interface specification and a set of examples. Many Python " "modules can be run as a script to provide a simple \"self test.\" Even " "modules which use complex external interfaces can often be tested in " -"isolation using trivial \"stub\" emulations of the external interface. The :" -"mod:`doctest` and :mod:`unittest` modules or third-party test frameworks can " -"be used to construct exhaustive test suites that exercise every line of code " -"in a module." +"isolation using trivial \"stub\" emulations of the external interface. " +"The :mod:`doctest` and :mod:`unittest` modules or third-party test " +"frameworks can be used to construct exhaustive test suites that exercise " +"every line of code in a module." msgstr "" -"一個針對模組的好測試套件提供了回歸測試 (regression testing),並作為模組介面規" +"一個針對模組的好測試套件提供了迴歸測試 (regression testing),並作為模組介面規" "範和一組範例。許多 Python 模組可以直接當成腳本執行,並提供簡單的「自我測" "試」。即便模組使用了複雜的外部介面,他依然可以用外部介面的簡單的「樁」(stub) " "模擬來獨立測試。:mod:`doctest` 和 :mod:`unittest` 模組或第三方的測試框架可以" @@ -1209,16 +1210,16 @@ msgid "" "\"spaghetti\" code that was hard to understand and revise. In a high-level " "language, it is also unneeded as long as there are ways to branch (in " "Python, with :keyword:`if` statements and :keyword:`or`, :keyword:`and`, " -"and :keyword:`if`/:keyword:`else` expressions) and loop (with :keyword:" -"`while` and :keyword:`for` statements, possibly containing :keyword:" -"`continue` and :keyword:`break`)." +"and :keyword:`if`/:keyword:`else` expressions) and loop " +"(with :keyword:`while` and :keyword:`for` statements, possibly " +"containing :keyword:`continue` and :keyword:`break`)." msgstr "" "在 1970 年代,人們了解到沒有限制的 goto 會導致混亂、難以理解和修改的「義大利" "麵」程式碼 (\"spaghetti\" code)。在高階語言裡,這也是不需要的,因為有方法可以" -"做邏輯分支(以 Python 來說,用 :keyword:`if` 陳述式和 :keyword:`or`、:" -"keyword:`and` 及 :keyword:`if`/:keyword:`else` 運算式)和迴圈(用 :keyword:" -"`while` 和 :keyword:`for` 陳述式,可能會有 :keyword:`continue` 和 :keyword:" -"`break`)。" +"做邏輯分支(以 Python 來說,用 :keyword:`if` 陳述式" +"和 :keyword:`or`、:keyword:`and` 及 :keyword:`if`/:keyword:`else` 運算式)和" +"迴圈(用 :keyword:`while` 和 :keyword:`for` 陳述式,可能會" +"有 :keyword:`continue` 和 :keyword:`break`)。" #: ../../faq/design.rst:614 msgid "" @@ -1437,14 +1438,14 @@ msgstr "為何產生器 (generator) 不支援 with 陳述式?" msgid "" "For technical reasons, a generator used directly as a context manager would " "not work correctly. When, as is most common, a generator is used as an " -"iterator run to completion, no closing is needed. When it is, wrap it as :" -"func:`contextlib.closing(generator) <contextlib.closing>` in the :keyword:" -"`with` statement." +"iterator run to completion, no closing is needed. When it is, wrap it " +"as :func:`contextlib.closing(generator) <contextlib.closing>` in " +"the :keyword:`with` statement." msgstr "" "出於技術原因,把產生器直接用作情境 (context) 管理器會無法正常運作。因為通常來" "說,產生器是被當成疊代器 (iterator),到最後完成時不需要被手動關閉。但如果你需" -"要的話,你可以在 :keyword:`with` 陳述式裡用 :func:`contextlib." -"closing(generator) <contextlib.closing>` 來包裝他。" +"要的話,你可以在 :keyword:`with` 陳述式裡" +"用 :func:`contextlib.closing(generator) <contextlib.closing>` 來包裝他。" #: ../../faq/design.rst:730 msgid "Why are colons required for the if/while/def/class statements?" diff --git a/faq/general.po b/faq/general.po index ac24b2276b..ac684d513b 100644 --- a/faq/general.po +++ b/faq/general.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2023-06-23 16:56+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -84,14 +84,14 @@ msgid "" msgstr "" "Python 軟體基金會 (Python Software Foundation) 是一個獨立的非營利性組織,它擁" "有 Python 2.1 版與之後各版本的版權。PSF 的使命在於推展 Python 程式設計語言相" -"關的開放原始碼技術,以及宣傳 Python 的使用。PSF 首頁的網址是 https://www." -"python.org/psf/。" +"關的開放原始碼技術,以及宣傳 Python 的使用。PSF 首頁的網址是 https://" +"www.python.org/psf/。" #: ../../faq/general.rst:42 msgid "" "Donations to the PSF are tax-exempt in the US. If you use Python and find " -"it helpful, please contribute via `the PSF donation page <https://www.python." -"org/psf/donations/>`_." +"it helpful, please contribute via `the PSF donation page <https://" +"www.python.org/psf/donations/>`_." msgstr "" "在美國捐款給 PSF 是免稅的。如果你使用了 Python 且發現它很有用,請至 `PSF 捐款" "頁面 <https://www.python.org/psf/donations/>`_\\ 為它做出貢獻。" @@ -333,6 +333,11 @@ msgid "" "See also the documentation for :data:`sys.version`, :data:`sys.hexversion`, " "and :data:`sys.version_info`." msgstr "" +"請參閱\\ `開發人員指南 <https://devguide.python.org/developer-workflow/" +"development-cycle/>`__\\ 以獲得更多關於開發週期的資訊,並參閱 :pep:`387` 以瞭" +"解更多關於 Python 的向後相容性政策。另外,也請查" +"看 :data:`sys.version`、:data:`sys.hexversion` 和 :data:`sys.version_info` 的" +"說明文件。" #: ../../faq/general.rst:169 msgid "How do I obtain a copy of the Python source?" @@ -344,9 +349,9 @@ msgid "" "at https://www.python.org/downloads/. The latest development sources can be " "obtained at https://github.com/python/cpython/." msgstr "" -"最新的 Python 原始碼發行版永遠可以從 python.org 取得,在 https://www.python." -"org/downloads/。最新的開發中原始碼可以在 https://github.com/python/cpython/ " -"取得。" +"最新的 Python 原始碼發行版永遠可以從 python.org 取得,在 https://" +"www.python.org/downloads/。最新的開發中原始碼可以在 https://github.com/" +"python/cpython/ 取得。" #: ../../faq/general.rst:175 msgid "" @@ -421,9 +426,10 @@ msgid "" "There is a newsgroup, :newsgroup:`comp.lang.python`, and a mailing list, " "`python-list <https://mail.python.org/mailman/listinfo/python-list>`_. The " "newsgroup and mailing list are gatewayed into each other -- if you can read " -"news it's unnecessary to subscribe to the mailing list. :newsgroup:`comp." -"lang.python` is high-traffic, receiving hundreds of postings every day, and " -"Usenet readers are often more able to cope with this volume." +"news it's unnecessary to subscribe to the mailing " +"list. :newsgroup:`comp.lang.python` is high-traffic, receiving hundreds of " +"postings every day, and Usenet readers are often more able to cope with this " +"volume." msgstr "" "有一個新聞群組 (newsgroup),:newsgroup:`comp.lang.python`,也有一個郵件討論" "群 (mailing list),`python-list <https://mail.python.org/mailman/listinfo/" @@ -433,9 +439,9 @@ msgstr "" #: ../../faq/general.rst:217 msgid "" -"Announcements of new software releases and events can be found in comp.lang." -"python.announce, a low-traffic moderated list that receives about five " -"postings per day. It's available as `the python-announce mailing list " +"Announcements of new software releases and events can be found in " +"comp.lang.python.announce, a low-traffic moderated list that receives about " +"five postings per day. It's available as `the python-announce mailing list " "<https://mail.python.org/mailman3/lists/python-announce-list.python.org/>`_." msgstr "" "新的軟體發布版本及事件的通知,可以在 comp.lang.python.announce 中找到,這是一" @@ -458,9 +464,9 @@ msgstr "如何取得 Python 的 beta 測試版本?" #: ../../faq/general.rst:229 msgid "" "Alpha and beta releases are available from https://www.python.org/" -"downloads/. All releases are announced on the comp.lang.python and comp." -"lang.python.announce newsgroups and on the Python home page at https://www." -"python.org/; an RSS feed of news is available." +"downloads/. All releases are announced on the comp.lang.python and " +"comp.lang.python.announce newsgroups and on the Python home page at https://" +"www.python.org/; an RSS feed of news is available." msgstr "" "Alpha 和 beta 發布版本可以從 https://www.python.org/downloads/ 取得。所有的發" "布版本都會在 comp.lang.python 和 comp.lang.python.announce 新聞群組上宣布,也" @@ -480,8 +486,8 @@ msgstr "如何提交 Python 的錯誤報告和修補程式?" #: ../../faq/general.rst:241 msgid "" -"To report a bug or submit a patch, use the issue tracker at https://github." -"com/python/cpython/issues." +"To report a bug or submit a patch, use the issue tracker at https://" +"github.com/python/cpython/issues." msgstr "" "要回報一個錯誤 (bug) 或提交一個修補程式 (patch),請使用於 https://github.com/" "python/cpython/issues 的問題追蹤系統。" @@ -547,8 +553,8 @@ msgstr "www.python.org 的真實位置在哪裡?" #: ../../faq/general.rst:274 msgid "" "The Python project's infrastructure is located all over the world and is " -"managed by the Python Infrastructure Team. Details `here <https://infra.psf." -"io>`__." +"managed by the Python Infrastructure Team. Details `here <https://" +"infra.psf.io>`__." msgstr "" "Python 專案的基礎建設遍佈世界各地,由 Python 基礎建設團隊管理。詳細資訊\\ `在" "此 <https://infra.psf.io>`__。" @@ -560,8 +566,8 @@ msgstr "為什麼要取名為 Python?" #: ../../faq/general.rst:281 msgid "" "When he began implementing Python, Guido van Rossum was also reading the " -"published scripts from `\"Monty Python's Flying Circus\" <https://en." -"wikipedia.org/wiki/Monty_Python>`__, a BBC comedy series from the 1970s. " +"published scripts from `\"Monty Python's Flying Circus\" <https://" +"en.wikipedia.org/wiki/Monty_Python>`__, a BBC comedy series from the 1970s. " "Van Rossum thought he needed a name that was short, unique, and slightly " "mysterious, so he decided to call the language Python." msgstr "" @@ -611,7 +617,6 @@ msgstr "" "且會保證介面在一系列的錯誤修正發布版本中維持不變。" #: ../../faq/general.rst:311 -#, fuzzy msgid "" "The latest stable releases can always be found on the `Python download page " "<https://www.python.org/downloads/>`_. Python 3.x is the recommended version " @@ -619,9 +624,8 @@ msgid "" "maintained anymore <373>`." msgstr "" "最新的穩定發布版本隨時都可以在 `Python 下載頁面 <https://www.python.org/" -"downloads/>`_\\ 上找到。Python 有兩個生產就緒 (production-ready) 的版本:2.x " -"和 3.x。推薦的版本是 3.x,此版本能被那些最為廣泛使用的函式庫所支援。雖然 2.x " -"仍然被廣泛使用,但\\ :pep:`它已不再被維護 <0373>`。" +"downloads/>`_\\ 上找到。Python 3.x 是推薦的版本,並且被大多數廣泛使用的函式庫" +"所支援。Python 2.x :pep:`已不再被維護 <0373>`。" #: ../../faq/general.rst:318 msgid "How many people are using Python?" @@ -657,8 +661,8 @@ msgstr "有沒有任何重要的專案使用 Python 完成開發?" #: ../../faq/general.rst:334 msgid "" "See https://www.python.org/about/success for a list of projects that use " -"Python. Consulting the proceedings for `past Python conferences <https://www." -"python.org/community/workshops/>`_ will reveal contributions from many " +"Python. Consulting the proceedings for `past Python conferences <https://" +"www.python.org/community/workshops/>`_ will reveal contributions from many " "different companies and organizations." msgstr "" "要查看使用 Python 的專案清單,請參閱 https://www.python.org/about/success。藉" @@ -668,17 +672,17 @@ msgstr "" #: ../../faq/general.rst:339 msgid "" "High-profile Python projects include `the Mailman mailing list manager " -"<https://www.list.org>`_ and `the Zope application server <https://www.zope." -"dev>`_. Several Linux distributions, most notably `Red Hat <https://www." -"redhat.com>`_, have written part or all of their installer and system " -"administration software in Python. Companies that use Python internally " -"include Google, Yahoo, and Lucasfilm Ltd." -msgstr "" -"備受矚目的 Python 專案包括 `Mailman 郵件討論群管理員 <https://www.list." -"org>`_\\ 和 `Zope 應用程式伺服器 <https://www.zope.dev>`_。有一些 Linux 發行" -"版,最著名的是 `Red Hat <https://www.redhat.com>`_,已經用 Python 編寫了部分" -"或全部的安裝程式及系統管理軟體。內部使用 Python 的公司包括 Google、Yahoo 和 " -"Lucasfilm Ltd。" +"<https://www.list.org>`_ and `the Zope application server <https://" +"www.zope.dev>`_. Several Linux distributions, most notably `Red Hat " +"<https://www.redhat.com>`_, have written part or all of their installer and " +"system administration software in Python. Companies that use Python " +"internally include Google, Yahoo, and Lucasfilm Ltd." +msgstr "" +"備受矚目的 Python 專案包括 `Mailman 郵件討論群管理員 <https://" +"www.list.org>`_\\ 和 `Zope 應用程式伺服器 <https://www.zope.dev>`_。有一些 " +"Linux 發行版,最著名的是 `Red Hat <https://www.redhat.com>`_,已經用 Python " +"編寫了部分或全部的安裝程式及系統管理軟體。內部使用 Python 的公司包括 Google、" +"Yahoo 和 Lucasfilm Ltd。" #: ../../faq/general.rst:348 msgid "What new developments are expected for Python in the future?" @@ -699,8 +703,8 @@ msgstr "" #: ../../faq/general.rst:356 msgid "" -"New development is discussed on `the python-dev mailing list <https://mail." -"python.org/mailman3/lists/python-dev.python.org/>`_." +"New development is discussed on `the python-dev mailing list <https://" +"mail.python.org/mailman3/lists/python-dev.python.org/>`_." msgstr "" "新的開發會在 `python-dev 郵件討論群 <https://mail.python.org/mailman3/lists/" "python-dev.python.org/>`_\\ 中討論。" @@ -810,7 +814,7 @@ msgstr "" #: ../../faq/general.rst:412 msgid "" ">>> L = []\n" -">>> dir(L) \n" +">>> dir(L)\n" "['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',\n" "'__dir__', '__doc__', '__eq__', '__format__', '__ge__',\n" "'__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__',\n" @@ -835,7 +839,7 @@ msgid "" "[1]" msgstr "" ">>> L = []\n" -">>> dir(L) \n" +">>> dir(L)\n" "['__add__', '__class__', '__contains__', '__delattr__', '__delitem__',\n" "'__dir__', '__doc__', '__eq__', '__format__', '__ge__',\n" "'__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__',\n" @@ -889,13 +893,3 @@ msgid "" msgstr "" "如果你想討論 Python 在教育領域中的使用,你可能會有興趣加入 `edu-sig 郵件討論" "群 <https://www.python.org/community/sigs/current/edu-sig>`_。" - -#~ msgid "See :pep:`6` for more information about bugfix releases." -#~ msgstr "更多關於錯誤修正發布的資訊請見 :pep:`6`。" - -#~ msgid "" -#~ "See also the documentation for :data:`sys.version`, :data:`sys." -#~ "hexversion`, and :data:`sys.version_info`." -#~ msgstr "" -#~ "另請參閱 :data:`sys.version`、:data:`sys.hexversion` 和 :data:`sys." -#~ "version_info` 的說明文件。" diff --git a/faq/library.po b/faq/library.po index 696efce18f..816e1e7b39 100644 --- a/faq/library.po +++ b/faq/library.po @@ -49,8 +49,8 @@ msgstr "" #: ../../faq/library.rst:21 #, fuzzy msgid "" -"For third-party packages, search the `Python Package Index <https://pypi." -"org>`_ or try `Google <https://www.google.com>`_ or another web search " +"For third-party packages, search the `Python Package Index <https://" +"pypi.org>`_ or try `Google <https://www.google.com>`_ or another web search " "engine. Searching for \"Python\" plus a keyword or two for your topic of " "interest will usually find something helpful." msgstr "" @@ -67,13 +67,13 @@ msgstr "哪裡可以找到 math.py (socket.py, regex.py, 等...) 來源檔案? msgid "" "If you can't find a source file for a module it may be a built-in or " "dynamically loaded module implemented in C, C++ or other compiled language. " -"In this case you may not have the source file or it may be something like :" -"file:`mathmodule.c`, somewhere in a C source directory (not on the Python " -"Path)." +"In this case you may not have the source file or it may be something " +"like :file:`mathmodule.c`, somewhere in a C source directory (not on the " +"Python Path)." msgstr "" "如果找不到模組的源檔案,它可能是用 C、C++ 或其他編譯語言實作的內置或動態載入" -"的模組。在這種情況下,你可能沒有源檔案,或者它可能類似於 :file:`mathmodule." -"c`,位於 C 源目錄中(不在 Python 路徑中)。" +"的模組。在這種情況下,你可能沒有源檔案,或者它可能類似" +"於 :file:`mathmodule.c`,位於 C 源目錄中(不在 Python 路徑中)。" #: ../../faq/library.rst:35 msgid "There are (at least) three kinds of modules in Python:" @@ -99,6 +99,8 @@ msgid "" "import sys\n" "print(sys.builtin_module_names)" msgstr "" +"import sys\n" +"print(sys.builtin_module_names)" #: ../../faq/library.rst:47 msgid "How do I make a Python script executable on Unix?" @@ -150,22 +152,21 @@ msgid "" "directory on the user's :envvar:`PATH`::" msgstr "" "如果你希望腳本獨立於 Python 直譯器所在的位置,你可以使用 :program:`env` 程" -"式。幾乎所有 Unix 變體都支援以下內容,假設 Python 直譯器位於使用者的 :envvar:" -"`PATH` 上的目錄中: ::" +"式。幾乎所有 Unix 變體都支援以下內容,假設 Python 直譯器位於使用者" +"的 :envvar:`PATH` 上的目錄中: ::" #: ../../faq/library.rst:69 msgid "#!/usr/bin/env python" msgstr "#!/usr/bin/env python" #: ../../faq/library.rst:71 -#, fuzzy msgid "" "*Don't* do this for CGI scripts. The :envvar:`PATH` variable for CGI " "scripts is often very minimal, so you need to use the actual absolute " "pathname of the interpreter." msgstr "" -"*不要*對 CGI 腳本執行此操作。 CGI 腳本的 :envvar:`PATH` 變數通常非常小,因此" -"你需要使用直譯器的實際絕對路徑名。" +"*不要*\\ 對 CGI 腳本執行此操作。CGI 腳本的 :envvar:`PATH` 變數通常非常小,因" +"此你需要使用直譯器的實際絕對路徑名稱。" #: ../../faq/library.rst:75 #, fuzzy @@ -200,7 +201,7 @@ msgstr "" #: ../../faq/library.rst:89 msgid "__doc__ = \"\"\"...Whatever...\"\"\"" -msgstr "" +msgstr "__doc__ = \"\"\"...Whatever...\"\"\"" #: ../../faq/library.rst:94 msgid "Is there a curses/termcap package for Python?" @@ -246,14 +247,14 @@ msgstr "" #: ../../faq/library.rst:118 msgid "Why don't my signal handlers work?" -msgstr "為什麼我的信號處理程式不起作用?" +msgstr "為什麼我的訊號處理程式不起作用?" #: ../../faq/library.rst:120 #, fuzzy msgid "" "The most common problem is that the signal handler is declared with the " "wrong argument list. It is called as ::" -msgstr "最常見的問題是信號處理程式是用錯誤的引數列表聲明的。它被稱為: ::" +msgstr "最常見的問題是訊號處理程式是用錯誤的引數列表聲明的。它被稱為: ::" #: ../../faq/library.rst:123 msgid "handler(signum, frame)" @@ -311,19 +312,21 @@ msgid "" msgstr "" "為了使測試更容易,你應該在程式中使用良好的模組化設計。你的程式應該將幾乎所有" "功能都封裝在函式或類別方法中——這有時會產生使程式運行得更快的令人驚訝和令人愉" -"快的效果(因為局部變數存取比全局存取更快)。此外,該程式應避免依賴於可變的全" +"快的效果(因為局部變數存取比全域存取更快)。此外,該程式應避免依賴於可變的全" "局變數,因為這會使測試變得更加困難。" #: ../../faq/library.rst:152 #, fuzzy msgid "The \"global main logic\" of your program may be as simple as ::" -msgstr "你程式的「全局主邏輯」可能像一樣簡單: ::" +msgstr "你程式的「全域主邏輯」可能像一樣簡單: ::" #: ../../faq/library.rst:154 msgid "" "if __name__ == \"__main__\":\n" " main_logic()" msgstr "" +"if __name__ == \"__main__\":\n" +" main_logic()" #: ../../faq/library.rst:157 #, fuzzy @@ -360,6 +363,8 @@ msgid "" "if __name__ == \"__main__\":\n" " self_test()" msgstr "" +"if __name__ == \"__main__\":\n" +" self_test()" #: ../../faq/library.rst:173 #, fuzzy @@ -417,8 +422,9 @@ msgid "" "module. The :mod:`threading` module builds convenient abstractions on top of " "the low-level primitives provided by the :mod:`_thread` module." msgstr "" -"請務必使用 :mod:`threading` 模組而不是 :mod:`_thread` 模組。 :mod:" -"`threading` 模組在 :mod:`_thread` 模組提供的低階原語之上構建方便的抽象。" +"請務必使用 :mod:`threading` 模組而不是 :mod:`_thread` 模" +"組。 :mod:`threading` 模組在 :mod:`_thread` 模組提供的低階原語之上構建方便的" +"抽象。" #: ../../faq/library.rst:245 msgid "None of my threads seem to run: why?" @@ -455,6 +461,17 @@ msgid "" "\n" "time.sleep(10) # <---------------------------!" msgstr "" +"import threading, time\n" +"\n" +"def thread_task(name, n):\n" +" for i in range(n):\n" +" print(name, i)\n" +"\n" +"for i in range(10):\n" +" T = threading.Thread(target=thread_task, args=(str(i), i))\n" +" T.start()\n" +"\n" +"time.sleep(10) # <---------------------------!" #: ../../faq/library.rst:265 #, fuzzy @@ -485,17 +502,27 @@ msgid "" "\n" "time.sleep(10)" msgstr "" +"def thread_task(name, n):\n" +" time.sleep(0.001) # <--------------------!\n" +" for i in range(n):\n" +" print(name, i)\n" +"\n" +"for i in range(10):\n" +" T = threading.Thread(target=thread_task, args=(str(i), i))\n" +" T.start()\n" +"\n" +"time.sleep(10)" #: ../../faq/library.rst:282 #, fuzzy msgid "" "Instead of trying to guess a good delay value for :func:`time.sleep`, it's " -"better to use some kind of semaphore mechanism. One idea is to use the :mod:" -"`queue` module to create a queue object, let each thread append a token to " -"the queue when it finishes, and let the main thread read as many tokens from " -"the queue as there are threads." +"better to use some kind of semaphore mechanism. One idea is to use " +"the :mod:`queue` module to create a queue object, let each thread append a " +"token to the queue when it finishes, and let the main thread read as many " +"tokens from the queue as there are threads." msgstr "" -"與其嘗試為 :func:`time.sleep` 猜測一個好的延遲值,不如使用某種信號量機制。一" +"與其嘗試為 :func:`time.sleep` 猜測一個好的延遲值,不如使用某種訊號量機制。一" "種想法是使用 :mod:`queue` 模組建立一個隊列物件,讓每個執行緒在完成時向隊列新" "增一個權杖,並讓主執行緒從隊列中讀取與執行緒數一樣多的權杖。" @@ -510,8 +537,8 @@ msgid "" "The easiest way is to use the :mod:`concurrent.futures` module, especially " "the :mod:`~concurrent.futures.ThreadPoolExecutor` class." msgstr "" -"最簡單的方法是使用 :mod:`concurrent.futures` 模組,尤其是 :mod:`~concurrent." -"futures.ThreadPoolExecutor` 類別。" +"最簡單的方法是使用 :mod:`concurrent.futures` 模組,尤其" +"是 :mod:`~concurrent.futures.ThreadPoolExecutor` 類別。" #: ../../faq/library.rst:295 #, fuzzy @@ -523,10 +550,10 @@ msgid "" "``.get()`` method to return them. The class will take care of the locking " "necessary to ensure that each job is handed out exactly once." msgstr "" -"或者,如果你想對調度演算法進行精細控制,你可以手動編寫自己的邏輯。使用 :mod:" -"`queue` 模組建立一個包含作業列表的隊列。 :class:`~queue.Queue` 類別維護一個物" -"件列表,並有一個 `.put(obj)`` 方法將項目新增到隊列和一個 ``.get()`` 方法回傳" -"它們。該類別將負責必要的鎖定,以確保每個作業都恰好分發一次。" +"或者,如果你想對調度演算法進行精細控制,你可以手動編寫自己的邏輯。使" +"用 :mod:`queue` 模組建立一個包含作業列表的隊列。 :class:`~queue.Queue` 類別維" +"護一個物件列表,並有一個 `.put(obj)`` 方法將項目新增到隊列和一個 ``.get()`` " +"方法回傳它們。該類別將負責必要的鎖定,以確保每個作業都恰好分發一次。" #: ../../faq/library.rst:302 #, fuzzy @@ -610,8 +637,8 @@ msgstr "" #: ../../faq/library.rst:358 #, fuzzy msgid "" -"Consult the module's documentation for more details; the :class:`~queue." -"Queue` class provides a featureful interface." +"Consult the module's documentation for more details; " +"the :class:`~queue.Queue` class provides a featureful interface." msgstr "" "有關更多詳細資訊,請參閱模組的文件; :class:`~queue.Queue` 類別提供了一個功能" "強大的介面。" @@ -619,7 +646,7 @@ msgstr "" #: ../../faq/library.rst:363 #, fuzzy msgid "What kinds of global value mutation are thread-safe?" -msgstr "什麼樣的全局值突變是執行緒安全的?" +msgstr "什麼樣的全域值突變是執行緒安全的?" #: ../../faq/library.rst:365 #, fuzzy @@ -631,7 +658,7 @@ msgid "" "instruction and therefore all the C implementation code reached from each " "instruction is therefore atomic from the point of view of a Python program." msgstr "" -"內部使用 :term:`全局直譯器鎖 (GIL, global interpreter lock)`\\ 來確保一次只有" +"內部使用 :term:`全域直譯器鎖 (GIL, global interpreter lock)`\\ 來確保一次只有" "一個執行緒在 Python VM 中運行。通常,Python 僅提供位元組碼指令之間的執行緒切" "換;可以通過 :func:`sys.setswitchinterval` 設定它切換的頻率。因此,從 Python " "程式的角度來看,每條位元組碼指令以及從每條指令到達的所有 C 實作程式碼都是原子" @@ -703,10 +730,10 @@ msgstr "" #: ../../faq/library.rst:399 #, fuzzy msgid "" -"Operations that replace other objects may invoke those other objects' :meth:" -"`~object.__del__` method when their reference count reaches zero, and that " -"can affect things. This is especially true for the mass updates to " -"dictionaries and lists. When in doubt, use a mutex!" +"Operations that replace other objects may invoke those other " +"objects' :meth:`~object.__del__` method when their reference count reaches " +"zero, and that can affect things. This is especially true for the mass " +"updates to dictionaries and lists. When in doubt, use a mutex!" msgstr "" "替換其他物件的操作可能會在引用計數達到零時叫用其他物件的 :meth:`__del__` 方" "法,這可能會影響事情。對於字典和列表的大量更新尤其如此。如有疑問,請使用互斥" @@ -714,7 +741,7 @@ msgstr "" #: ../../faq/library.rst:406 msgid "Can't we get rid of the Global Interpreter Lock?" -msgstr "不能擺脫全局直譯器鎖嗎?" +msgstr "不能擺脫全域直譯器鎖嗎?" #: ../../faq/library.rst:408 #, fuzzy @@ -773,10 +800,10 @@ msgid "" "case you want more control over dispatching of tasks." msgstr "" "這並不意味著你不能在多 CPU 機器上用好 Python!你只需要創造性地將工作分配給多" -"個*行程*而​​不是多個*執行緒*。新的 :mod:`concurrent.futures` 模組中的 :class:" -"`~concurrent.futures.ProcessPoolExecutor` 類別提供了一種簡單的方法; :mod:" -"`multiprocessing` 模組提供了一個較低階別的 API,以防你希望更好地控制任務的調" -"度。" +"個*行程*而​​不是多個*執行緒*。新的 :mod:`concurrent.futures` 模組中" +"的 :class:`~concurrent.futures.ProcessPoolExecutor` 類別提供了一種簡單的方" +"法; :mod:`multiprocessing` 模組提供了一個較低階別的 API,以防你希望更好地控" +"制任務的調度。" #: ../../faq/library.rst:446 #, fuzzy @@ -784,8 +811,8 @@ msgid "" "Judicious use of C extensions will also help; if you use a C extension to " "perform a time-consuming task, the extension can release the GIL while the " "thread of execution is in the C code and allow other threads to get some " -"work done. Some standard library modules such as :mod:`zlib` and :mod:" -"`hashlib` already do this." +"work done. Some standard library modules such as :mod:`zlib` " +"and :mod:`hashlib` already do this." msgstr "" "明智地使用 C 擴充也會有所幫助;如果你使用 C 擴充來執行耗時任務,則該擴充可以" "在執行執行緒在 C 程式碼中時釋放 GIL,並允許其他執行緒完成一些工作。一些標準函" @@ -801,6 +828,11 @@ msgid "" "since these must be written with multiple interpreters in mind in order to " "be usable, so many older extension modules will not be usable." msgstr "" +"減少 GIL 影響的另一種方法是將 GIL 設置為直譯器各自狀態的鎖 (per-interpreter-" +"state lock),而不是真正的全域鎖。這在 :ref:`Python 3.12 中首次實現 " +"<whatsnew312-pep684>`,並且可於 C API 中使用。預計 Python 3.13 將會提供其 " +"Python 介面。目前主要的限制可能是第三方擴充模組,因為實作時必須考慮到多個直譯" +"器才能使用,因此許多舊的擴充模組將無法使用。" #: ../../faq/library.rst:462 msgid "Input and Output" @@ -814,12 +846,13 @@ msgstr "如何刪除檔案?(以及其他檔案問題...)" #, fuzzy msgid "" "Use ``os.remove(filename)`` or ``os.unlink(filename)``; for documentation, " -"see the :mod:`os` module. The two functions are identical; :func:`~os." -"unlink` is simply the name of the Unix system call for this function." +"see the :mod:`os` module. The two functions are " +"identical; :func:`~os.unlink` is simply the name of the Unix system call for " +"this function." msgstr "" -"使用 ``os.remove(filename)`` 或 ``os.unlink(filename)``;有關文件,請參閱 :" -"mod:`os` 模組。這兩個功能是相同的; :func:`~os.unlink` 只是這個函式的 Unix 系" -"統呼叫的名稱。" +"使用 ``os.remove(filename)`` 或 ``os.unlink(filename)``;有關文件,請參" +"閱 :mod:`os` 模組。這兩個功能是相同的; :func:`~os.unlink` 只是這個函式的 " +"Unix 系統呼叫的名稱。" #: ../../faq/library.rst:471 #, fuzzy @@ -830,10 +863,10 @@ msgid "" "directories as long as they're empty; if you want to delete an entire " "directory tree and its contents, use :func:`shutil.rmtree`." msgstr "" -"要刪除目錄,請使用 :func:`os.rmdir`;使用 :func:`os.mkdir` 建立一個。 ``os." -"makedirs(path)`` 將在 ``path`` 中建立任何不存在的中間目錄。 ``os." -"removedirs(path)`` 將刪除中間目錄,只要它們是空的;如果要刪除整個目錄樹及其內" -"容,請使用 :func:`shutil.rmtree`。" +"要刪除目錄,請使用 :func:`os.rmdir`;使用 :func:`os.mkdir` 建立一個。 " +"``os.makedirs(path)`` 將在 ``path`` 中建立任何不存在的中間目錄。 " +"``os.removedirs(path)`` 將刪除中間目錄,只要它們是空的;如果要刪除整個目錄樹" +"及其內容,請使用 :func:`shutil.rmtree`。" #: ../../faq/library.rst:477 msgid "To rename a file, use ``os.rename(old_path, new_path)``." @@ -844,23 +877,24 @@ msgstr "要重新命名檔案,請使用 ``os.rename(old_path, new_path)``。" msgid "" "To truncate a file, open it using ``f = open(filename, \"rb+\")``, and use " "``f.truncate(offset)``; offset defaults to the current seek position. " -"There's also ``os.ftruncate(fd, offset)`` for files opened with :func:`os." -"open`, where *fd* is the file descriptor (a small integer)." +"There's also ``os.ftruncate(fd, offset)`` for files opened " +"with :func:`os.open`, where *fd* is the file descriptor (a small integer)." msgstr "" -"要截斷一個檔案,使用``f = open(filename, \"rb+\")``打開它,然後使用``f." -"truncate(offset)``;偏移量預設為目前搜尋位置。對於使用 :func:`os.open` 打開的" -"檔案,還有 ``os.ftruncate(fd, offset)``,其中 *fd* 是檔案描述器(一個小整" +"要截斷一個檔案,使用``f = open(filename, \"rb+\")``打開它,然後使用" +"``f.truncate(offset)``;偏移量預設為目前搜尋位置。對於使用 :func:`os.open` 打" +"開的檔案,還有 ``os.ftruncate(fd, offset)``,其中 *fd* 是檔案描述器(一個小整" "數)。" #: ../../faq/library.rst:484 #, fuzzy msgid "" "The :mod:`shutil` module also contains a number of functions to work on " -"files including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, and :" -"func:`~shutil.rmtree`." +"files including :func:`~shutil.copyfile`, :func:`~shutil.copytree`, " +"and :func:`~shutil.rmtree`." msgstr "" -":mod:`shutil` 模組還包含許多用於處理檔案的函式,包括:func:`~shutil." -"copyfile`、:func:`~shutil.copytree` 和:func:`~shutil.rmtree`。" +":mod:`shutil` 模組還包含許多用於處理檔案的函式,包" +"括:func:`~shutil.copyfile`、:func:`~shutil.copytree` " +"和:func:`~shutil.rmtree`。" #: ../../faq/library.rst:490 msgid "How do I copy a file?" @@ -879,10 +913,10 @@ msgid "" msgstr "" ":mod:`shutil` 模組包含一個 :func:`~shutil.copyfile` 函式。請注意,在 Windows " "NTFS 卷上,它不會複製 `alternate data streams <https://en.wikipedia.org/wiki/" -"NTFS#Alternate_data_stream_(ADS)>`_ 也不會複製 `resource forks <https://en." -"wikipedia. org/wiki/Resource_fork>`__ 在 macOS HFS+ 卷上,儘管現在兩者都很少" -"使用。它也不會複製檔案權限和元資料,儘管使用 :func:`shutil.copy2` 會保留其中" -"的大部分(儘管不是全部)。" +"NTFS#Alternate_data_stream_(ADS)>`_ 也不會複製 `resource forks <https://" +"en.wikipedia. org/wiki/Resource_fork>`__ 在 macOS HFS+ 卷上,儘管現在兩者都很" +"少使用。它也不會複製檔案權限和元資料,儘管使用 :func:`shutil.copy2` 會保留其" +"中的大部分(儘管不是全部)。" #: ../../faq/library.rst:503 msgid "How do I read (or write) binary data?" @@ -891,9 +925,9 @@ msgstr "如何讀取(或寫入)二進位制資料?" #: ../../faq/library.rst:505 #, fuzzy msgid "" -"To read or write complex binary data formats, it's best to use the :mod:" -"`struct` module. It allows you to take a string containing binary data " -"(usually numbers) and convert it to Python objects; and vice versa." +"To read or write complex binary data formats, it's best to use " +"the :mod:`struct` module. It allows you to take a string containing binary " +"data (usually numbers) and convert it to Python objects; and vice versa." msgstr "" "要讀取或寫入複雜的二進制資料格式,最好使用 :mod:`struct` 模組。它允許你取得包" "含二進制資料(通常是數字)的字串並將其轉換為 Python 物件;反之亦然。" @@ -948,14 +982,13 @@ msgid "" "instead (the default), the file will be open in text mode and ``f.read()`` " "will return :class:`str` objects rather than :class:`bytes` objects." msgstr "" -"要讀取和寫入二進制資料,必須以二進制模式打開檔案(這裡,將 ``\"rb\"`` 傳遞" +"要讀取和寫入二進位資料,必須以二進位模式打開檔案(這裡,將 ``\"rb\"`` 傳遞" "給 :func:`open`)。如果你改用 ``\"r\"``(預設設定),檔案將以文本模式打開,並" -"且 ``f.read()`` 將回傳 str 物件而不是 bytes ` 物件。" +"且 ``f.read()`` 將回傳 :class:`str` 物件而不是 :class:`bytes` 物件。" #: ../../faq/library.rst:535 -#, fuzzy msgid "I can't seem to use os.read() on a pipe created with os.popen(); why?" -msgstr "我似乎無法在用 os.popen() 建立的管道上使用 os.read();為什麼?" +msgstr "我似乎無法在用 os.popen() 建立的 pipe 上使用 os.read();為什麼?" #: ../../faq/library.rst:537 #, fuzzy @@ -963,8 +996,8 @@ msgid "" ":func:`os.read` is a low-level function which takes a file descriptor, a " "small integer representing the opened file. :func:`os.popen` creates a high-" "level file object, the same type returned by the built-in :func:`open` " -"function. Thus, to read *n* bytes from a pipe *p* created with :func:`os." -"popen`, you need to use ``p.read(n)``." +"function. Thus, to read *n* bytes from a pipe *p* created " +"with :func:`os.popen`, you need to use ``p.read(n)``." msgstr "" ":func:`os.read` 是一個低階函式,它接受一個檔案描述器,一個代表打開檔案的小整" "數。 :func:`os.popen` 建立一個高階檔案物件,與內置的 :func:`open` 函式回傳的" @@ -1011,9 +1044,9 @@ msgid "" "descriptor. This also happens automatically in ``f``'s destructor, when " "``f`` becomes garbage." msgstr "" -"對於你通過內置的 :func:`open` 函式在 Python 中建立的大多數檔案物件,``f." -"close()`` 從 Python 的角度將 Python 檔案物件標記為已關閉,並安排關閉底層 C 檔" -"案描述器。當 ``f`` 變成垃圾時,這也會自動發生在 ``f`` 的析構函式中。" +"對於你通過內置的 :func:`open` 函式在 Python 中建立的大多數檔案物件," +"``f.close()`` 從 Python 的角度將 Python 檔案物件標記為已關閉,並安排關閉底層 " +"C 檔案描述器。當 ``f`` 變成垃圾時,這也會自動發生在 ``f`` 的析構函式中。" #: ../../faq/library.rst:646 #, fuzzy @@ -1127,6 +1160,22 @@ msgid "" "server.sendmail(fromaddr, toaddrs, msg)\n" "server.quit()" msgstr "" +"import sys, smtplib\n" +"\n" +"fromaddr = input(\"From: \")\n" +"toaddrs = input(\"To: \").split(',')\n" +"print(\"Enter message, end with ^D:\")\n" +"msg = ''\n" +"while True:\n" +" line = sys.stdin.readline()\n" +" if not line:\n" +" break\n" +" msg += line\n" +"\n" +"# The actual mail send\n" +"server = smtplib.SMTP('localhost')\n" +"server.sendmail(fromaddr, toaddrs, msg)\n" +"server.quit()" #: ../../faq/library.rst:712 #, fuzzy @@ -1178,24 +1227,24 @@ msgid "" "return different values, so you're going to have to check what's returned on " "your system." msgstr "" -"為防止 TCP 連接阻塞,可以將 socket 設定為非阻塞模式。然後當你執行 :meth:" -"`socket.connect` 時,你要麼立即連接(不太可能),要麼得到一個例外,其中包含錯" -"誤號 ``.errno``。 ``errno.EINPROGRESS`` 表示連接正在進行中,但尚未完成。不同" -"的作業系統將回傳不同的值,因此你將不得不檢查系統回傳的內容。" +"為防止 TCP 連接阻塞,可以將 socket 設定為非阻塞模式。然後當你執" +"行 :meth:`socket.connect` 時,你要麼立即連接(不太可能),要麼得到一個例外," +"其中包含錯誤號 ``.errno``。 ``errno.EINPROGRESS`` 表示連接正在進行中,但尚未" +"完成。不同的作業系統將回傳不同的值,因此你將不得不檢查系統回傳的內容。" #: ../../faq/library.rst:745 #, fuzzy msgid "" "You can use the :meth:`~socket.socket.connect_ex` method to avoid creating " -"an exception. It will just return the errno value. To poll, you can call :" -"meth:`~socket.socket.connect_ex` again later -- ``0`` or ``errno.EISCONN`` " -"indicate that you're connected -- or you can pass this socket to :meth:" -"`select.select` to check if it's writable." +"an exception. It will just return the errno value. To poll, you can " +"call :meth:`~socket.socket.connect_ex` again later -- ``0`` or " +"``errno.EISCONN`` indicate that you're connected -- or you can pass this " +"socket to :meth:`select.select` to check if it's writable." msgstr "" "你可以使用 :meth:`socket.connect_ex` 方法來避免建立例外。它只會回傳 errno " -"值。要輪詢,你可以稍後再次呼叫 :meth:`socket.connect_ex` - ``0`` 或 ``errno." -"EISCONN`` 表示你已連接 - 或者你可以將此 socket 傳遞給 :meth:`select.select` " -"檢查它是否可寫。" +"值。要輪詢,你可以稍後再次呼叫 :meth:`socket.connect_ex` - ``0`` 或 " +"``errno.EISCONN`` 表示你已連接 - 或者你可以將此 socket 傳遞" +"給 :meth:`select.select` 檢查它是否可寫。" #: ../../faq/library.rst:753 msgid "" @@ -1224,9 +1273,9 @@ msgstr "有的。" #, fuzzy msgid "" "Interfaces to disk-based hashes such as :mod:`DBM <dbm.ndbm>` and :mod:`GDBM " -"<dbm.gnu>` are also included with standard Python. There is also the :mod:" -"`sqlite3` module, which provides a lightweight disk-based relational " -"database." +"<dbm.gnu>` are also included with standard Python. There is also " +"the :mod:`sqlite3` module, which provides a lightweight disk-based " +"relational database." msgstr "" "基於磁盤的雜湊介面,例如 :mod:`DBM <dbm.ndbm>` 和 :mod:`GDBM <dbm.gnu>` 也包" "含在標準 Python 中。還有 :mod:`sqlite3` 模組,它提供了一個輕量級的基於磁盤的" @@ -1243,16 +1292,15 @@ msgstr "" "<https://wiki.python.org/moin/DatabaseProgramming>`_。" #: ../../faq/library.rst:779 -#, fuzzy msgid "How do you implement persistent objects in Python?" -msgstr "你如何在 Python 中實作持久物件?" +msgstr "你如何在 Python 中實作持久性物件?" #: ../../faq/library.rst:781 #, fuzzy msgid "" "The :mod:`pickle` library module solves this in a very general way (though " -"you still can't store things like open files, sockets or windows), and the :" -"mod:`shelve` library module uses pickle and (g)dbm to create persistent " +"you still can't store things like open files, sockets or windows), and " +"the :mod:`shelve` library module uses pickle and (g)dbm to create persistent " "mappings containing arbitrary Python objects." msgstr "" ":mod:`pickle` 函式庫模組以一種非常通用的方式解決了這個問題(儘管你仍然不能存" @@ -1333,9 +1381,9 @@ msgstr "" #~ "interpreter state. Other object types have their own free list; these " #~ "free lists would have to be moved to the interpreter state. And so on." #~ msgstr "" -#~ "有人建議 GIL 應該是每個直譯器狀態鎖,而不是真正的全局鎖;口譯員將無法共享" +#~ "有人建議 GIL 應該是每個直譯器狀態鎖,而不是真正的全域鎖;口譯員將無法共享" #~ "物件。不幸的是,這也不太可能發生。這將是一項巨大的工作量,因為目前許多物件" -#~ "實作都具有全局狀態。例如,快取小整數和短字串;這些快取必須移至直譯器狀態。" +#~ "實作都具有全域狀態。例如,快取小整數和短字串;這些快取必須移至直譯器狀態。" #~ "其他物件型別有自己的空閒列表;這些空閒列表必須移至直譯器狀態。等等。" #, fuzzy @@ -1346,30 +1394,19 @@ msgstr "" #~ "to store all their global state in the interpreter state." #~ msgstr "" #~ "而且我懷疑它甚至可以在有限的時間內完成,因為第 3 方擴充存在同樣的問題。 " -#~ "3rd 方擴充的編寫速度可能比你轉換它們以將其所有全局狀態存儲在直譯器狀態中的" +#~ "3rd 方擴充的編寫速度可能比你轉換它們以將其所有全域狀態存儲在直譯器狀態中的" #~ "速度更快。" -#, fuzzy -#~ msgid "" -#~ "And finally, once you have multiple interpreters not sharing any state, " -#~ "what have you gained over running each interpreter in a separate process?" -#~ msgstr "" -#~ "最後,如果你有多個不共享任何狀態的直譯器,那麼在單獨的行程中運行每個直譯器" -#~ "有什麼好處呢?" - #, fuzzy #~ msgid "" #~ "Cameron Laird maintains a useful set of pages about Python web " -#~ "technologies at https://web.archive.org/web/20210224183619/http://phaseit." -#~ "net/claird/comp.lang.python/web_python." +#~ "technologies at https://web.archive.org/web/20210224183619/http://" +#~ "phaseit.net/claird/comp.lang.python/web_python." #~ msgstr "" #~ "Cameron Laird 在 https://web.archive.org/web/20210224183619/http://" #~ "phaseit.net/claird/comp.lang.python/web_python 維護著一組有用的關於 " #~ "Python 網路技術的頁面。" -#~ msgid "How can I mimic CGI form submission (METHOD=POST)?" -#~ msgstr "如何模擬 CGI 表單送出 (submission) (METHOD=POST)?" - #, fuzzy #~ msgid "" #~ "I would like to retrieve web pages that are the result of POSTing a form. " @@ -1387,8 +1424,9 @@ msgstr "" #~ "must be quoted using :func:`urllib.parse.urlencode`. For example, to " #~ "send ``name=Guy Steele, Jr.``::" #~ msgstr "" -#~ "請注意,通常對於百分比編碼的 POST 操作,查詢字串必須使用 :func:`urllib." -#~ "parse.urlencode` 引用。例如,發送 ``name=Guy Steele, Jr.``: ::" +#~ "請注意,通常對於百分比編碼的 POST 操作,查詢字串必須使" +#~ "用 :func:`urllib.parse.urlencode` 引用。例如,發送 ``name=Guy Steele, " +#~ "Jr.``: ::" #~ msgid "" #~ ">>> import urllib.parse\n" @@ -1398,6 +1436,3 @@ msgstr "" #~ ">>> import urllib.parse\n" #~ ">>> urllib.parse.urlencode({'name': 'Guy Steele, Jr.'})\n" #~ "'name=Guy+Steele%2C+Jr.'" - -#~ msgid ":ref:`urllib-howto` for extensive examples." -#~ msgstr ":ref:`urllib-howto` 內有大量範例。" diff --git a/faq/programming.po b/faq/programming.po index 9a735d13bb..3f46c08fa7 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-19 00:15+0000\n" +"POT-Creation-Date: 2025-04-06 00:16+0000\n" "PO-Revision-Date: 2024-04-25 14:17+0800\n" "Last-Translator: KNChiu <y9760210@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,8 +45,8 @@ msgstr "有的。" #: ../../faq/programming.rst:19 msgid "" -"Several debuggers for Python are described below, and the built-in " -"function :func:`breakpoint` allows you to drop into any of them." +"Several debuggers for Python are described below, and the built-in function :" +"func:`breakpoint` allows you to drop into any of them." msgstr "" "下面描述了幾個 Python 除錯器,內建函式 :func:`breakpoint` 允許你進入其中任何" "一個。" @@ -340,11 +340,10 @@ msgid "" "a component of an imported module. This clutter would defeat the usefulness " "of the ``global`` declaration for identifying side-effects." msgstr "" -"雖然起初有點令人驚訝,但稍加考慮就可以解釋這一點。一方面,要" -"求 :keyword:`global` 分配的變數可以防止意外的副作用。另一方面,如果所有全域參" -"照都需要 ``global``,那麼你將一直使用 ``global``。你必須將對內建函式或引入模" -"組的組件的每個參照聲明為全域。這種混亂會破壞用於識別副作用的 ``global`` 聲明" -"的有用性。" +"雖然起初有點令人驚訝,但稍加考慮就可以解釋這一點。一方面,要求 :keyword:" +"`global` 分配的變數可以防止意外的副作用。另一方面,如果所有全域參照都需要 " +"``global``,那麼你將一直使用 ``global``。你必須將對內建函式或引入模組的組件的" +"每個參照聲明為全域。這種混亂會破壞用於識別副作用的 ``global`` 聲明的有用性。" #: ../../faq/programming.rst:208 msgid "" @@ -557,8 +556,8 @@ msgstr "如果你按以下順序引入模組,這是一個很好的做法:" #: ../../faq/programming.rst:301 msgid "" -"standard library modules -- " -"e.g. :mod:`sys`, :mod:`os`, :mod:`argparse`, :mod:`re`" +"standard library modules -- e.g. :mod:`sys`, :mod:`os`, :mod:`argparse`, :" +"mod:`re`" msgstr "" "標準函式庫模組 —— 例如 :mod:`sys`、:mod:`os`、:mod:`argparse`、:mod:`re`" @@ -572,7 +571,6 @@ msgstr "" "dateutil`, :mod:`!requests`, :mod:`!PIL.Image`" #: ../../faq/programming.rst:304 -#, fuzzy msgid "locally developed modules" msgstr "本地開發的模組" @@ -639,20 +637,18 @@ msgstr "" "入移動到局部範圍內,例如在函式定義內。如果根據程式的執行方式,許多引入是不必" "要的,則此技術特別有用。如果模組僅在該函式中使用,你可能還想將引入移動到該函" "式中。請注意,由於模組的一次性初始化,第一次載入模組可能很昂貴,但多次載入模" -"組實際上是免費的,只需幾次字典查詢。即使模組名稱超出範圍,該模組也可能" -"在 :data:`sys.modules` 中可用。" +"組實際上是免費的,只需幾次字典查詢。即使模組名稱超出範圍,該模組也可能在 :" +"data:`sys.modules` 中可用。" #: ../../faq/programming.rst:338 -#, fuzzy msgid "Why are default values shared between objects?" msgstr "為什麼物件之間共享預設值?" #: ../../faq/programming.rst:340 -#, fuzzy msgid "" "This type of bug commonly bites neophyte programmers. Consider this " "function::" -msgstr "這種型別的錯誤通常會困擾新手程式員。考慮這個功能: ::" +msgstr "這種類型的錯誤通常會困擾新手程式員。像是這個函式: ::" #: ../../faq/programming.rst:342 msgid "" @@ -661,15 +657,18 @@ msgid "" " mydict[key] = value\n" " return mydict" msgstr "" +"def foo(mydict={}): # 危險:所有呼叫共享對字典的參照\n" +" ... 計算一些東西 ...\n" +" mydict[key] = value\n" +" return mydict" #: ../../faq/programming.rst:347 -#, fuzzy msgid "" "The first time you call this function, ``mydict`` contains a single item. " "The second time, ``mydict`` contains two items because when ``foo()`` begins " "executing, ``mydict`` starts out with an item already in it." msgstr "" -"第一次呼叫此函式時, ``mydict`` 包含一個項目。第二次,``mydict`` 包含兩個項" +"第一次呼叫此函式時, ``mydict`` 包含一個項目。第二次後 ``mydict`` 包含兩個項" "目,因為當 ``foo()`` 開始執行時,``mydict`` 以其中已有的項目開始。" #: ../../faq/programming.rst:351 @@ -693,19 +692,18 @@ msgid "" "dictionaries, lists, and class instances can lead to confusion." msgstr "" "根據定義,數字、字串、元組和 ``None`` 等不可變物件是安全的,不會發生變化。對" -"字典、list和類別實例等可變物件的更改可能會導致混淆。" +"字典、串列和類別實例等可變物件的更改可能會導致混淆。" #: ../../faq/programming.rst:360 -#, fuzzy msgid "" "Because of this feature, it is good programming practice to not use mutable " "objects as default values. Instead, use ``None`` as the default value and " "inside the function, check if the parameter is ``None`` and create a new " "list/dictionary/whatever if it is. For example, don't write::" msgstr "" -"由於這個特性,不使用可變物件作為預設值是一個很好的編程習慣。相反,使用 " -"``None`` 作為預設值並在函式內部檢查參數是否為 ``None`` 並建立一個新的list/字" -"典/無論是否是。例如,不要寫: ::" +"由於這個特性,不使用可變物件作為預設值是一個很好的程式設計習慣,而是應使用 " +"``None`` 作為預設值,並在函式內部檢查參數是否為 ``None``,再建立一個新的串列/" +"字典/或其他東西。例如,不要這樣寫: ::" #: ../../faq/programming.rst:365 msgid "" @@ -717,7 +715,7 @@ msgstr "" #: ../../faq/programming.rst:368 msgid "but::" -msgstr "但是: ::" +msgstr "而是寫成: ::" #: ../../faq/programming.rst:370 msgid "" @@ -755,6 +753,15 @@ msgid "" " _cache[(arg1, arg2)] = result # Store result in the cache\n" " return result" msgstr "" +"# 呼叫者只能提供兩個參數,並選擇性地透過關鍵字傳遞 _cache\n" +"def expensive(arg1, arg2, *, _cache={}):\n" +" if (arg1, arg2) in _cache:\n" +" return _cache[(arg1, arg2)]\n" +"\n" +" # Calculate the value\n" +" result = ... expensive computation ...\n" +" _cache[(arg1, arg2)] = result # 將結果存儲在快取中\n" +" return result" #: ../../faq/programming.rst:389 msgid "" @@ -802,13 +809,13 @@ msgstr "引數 (arguments) 和參數 (parameters) 有什麼區別?" msgid "" ":term:`Parameters <parameter>` are defined by the names that appear in a " "function definition, whereas :term:`arguments <argument>` are the values " -"actually passed to a function when calling it. Parameters define " -"what :term:`kind of arguments <parameter>` a function can accept. For " -"example, given the function definition::" +"actually passed to a function when calling it. Parameters define what :term:" +"`kind of arguments <parameter>` a function can accept. For example, given " +"the function definition::" msgstr "" ":term:`參數 <parameter>`\\ 由出現在函式定義中的名稱定義,而\\ :term:`引數 " -"<argument>`\\ 是呼叫函式時實際傳遞給函式的值。參數定義函式可以接受的" -"\\ :term:`引數種類 <parameter>`。例如,給定以下函式定義: ::" +"<argument>`\\ 是呼叫函式時實際傳遞給函式的值。參數定義函式可以接受的\\ :term:" +"`引數種類 <parameter>`。例如,給定以下函式定義: ::" #: ../../faq/programming.rst:423 msgid "" @@ -836,7 +843,7 @@ msgstr "``42``、``314`` 和 ``somevar`` 是引數。" #: ../../faq/programming.rst:435 msgid "Why did changing list 'y' also change list 'x'?" -msgstr "為什麼更改 list 'y' 也會更改 list 'x'?" +msgstr "為什麼更改串列 'y' 也會更改串列 'x'?" #: ../../faq/programming.rst:437 msgid "If you wrote code like::" @@ -949,9 +956,9 @@ msgstr "" "一些操作(例如 ``y.append(10)`` 和 ``y.sort()``)會改變物件,而表面上相似的操" "作(例如 ``y = y + [10]`` 和: func:`sorted(y) <sorted>`) 建立一個新物件。通" "常在 Python 中(以及在標準函式庫中的所有情況下)改變物件的方法將回傳 " -"``None`` 以幫助避免混淆這兩種型別的操作。因此,如果你錯誤地編寫了 " -"``y.sort()``,認為它會為你提供 ``y`` 的排序副本,那麼你最終會得到 ``None``," -"這可能會導致你的程式生成一個容易診斷的錯誤。" +"``None`` 以幫助避免混淆這兩種型別的操作。因此,如果你錯誤地編寫了 ``y." +"sort()``,認為它會為你提供 ``y`` 的排序副本,那麼你最終會得到 ``None``,這可" +"能會導致你的程式生成一個容易診斷的錯誤。" #: ../../faq/programming.rst:488 #, fuzzy @@ -1047,10 +1054,9 @@ msgid "This is almost always the clearest solution." msgstr "這幾乎都會是最清楚的方案。" #: ../../faq/programming.rst:530 -#, fuzzy msgid "" "By using global variables. This isn't thread-safe, and is not recommended." -msgstr "透過使用全域變數。這不是執行緒安全的,不推薦。" +msgstr "透過使用全域變數。這不是執行緒安全的,所以不推薦。" #: ../../faq/programming.rst:532 msgid "By passing a mutable (changeable in-place) object::" @@ -1077,9 +1083,8 @@ msgstr "" "['new-value', 100]" #: ../../faq/programming.rst:543 -#, fuzzy msgid "By passing in a dictionary that gets mutated::" -msgstr "透過傳入一個發生變異的字典: ::" +msgstr "透過傳入一個發生改變的字典: ::" #: ../../faq/programming.rst:545 msgid "" @@ -1092,9 +1097,16 @@ msgid "" ">>> args\n" "{'a': 'new-value', 'b': 100}" msgstr "" +">>> def func3(args):\n" +"... args['a'] = 'new-value' # args 是可變字典\n" +"... args['b'] = args['b'] + 1 # 原地改變它\n" +"...\n" +">>> args = {'a': 'old-value', 'b': 99}\n" +">>> func3(args)\n" +">>> args\n" +"{'a': 'new-value', 'b': 100}" #: ../../faq/programming.rst:554 -#, fuzzy msgid "Or bundle up values in a class instance::" msgstr "或者在類別實例中捆綁值: ::" @@ -1114,24 +1126,33 @@ msgid "" ">>> vars(args)\n" "{'a': 'new-value', 'b': 100}" msgstr "" +">>> class Namespace:\n" +"... def __init__(self, /, **args):\n" +"... for key, value in args.items():\n" +"... setattr(self, key, value)\n" +"...\n" +">>> def func4(args):\n" +"... args.a = 'new-value' # args 是可變命名空間\n" +"... args.b = args.b + 1 # 原地改變物件\n" +"...\n" +">>> args = Namespace(a='old-value', b=99)\n" +">>> func4(args)\n" +">>> vars(args)\n" +"{'a': 'new-value', 'b': 100}" #: ../../faq/programming.rst:571 -#, fuzzy msgid "There's almost never a good reason to get this complicated." -msgstr "幾乎沒有充分的理由讓事情變得如此復雜。" +msgstr "幾乎不會有要讓事情變得如此複雜的充分理由。" #: ../../faq/programming.rst:573 -#, fuzzy msgid "Your best choice is to return a tuple containing the multiple results." msgstr "你最好的選擇是回傳一個包含多個結果的元組。" #: ../../faq/programming.rst:577 -#, fuzzy msgid "How do you make a higher order function in Python?" msgstr "你如何在 Python 中建立高階函式?" #: ../../faq/programming.rst:579 -#, fuzzy msgid "" "You have two choices: you can use nested scopes or you can use callable " "objects. For example, suppose you wanted to define ``linear(a,b)`` which " @@ -1139,7 +1160,8 @@ msgid "" "scopes::" msgstr "" "你有兩種選擇:可以使用巢狀作用域,也可以使用可呼叫物件。例如,假設你想定義 " -"linear(a,b) ,它回傳一個計算值 a*x+b 的函式 f(x) 。使用嵌套範圍: ::" +"``linear(a,b)``,它會回傳 ``a*x+b`` 計算值的函式 ``f(x)``。使用巢狀作用" +"域: ::" #: ../../faq/programming.rst:583 msgid "" @@ -1184,9 +1206,8 @@ msgid "taxes = linear(0.3, 2)" msgstr "taxes = linear(0.3, 2)" #: ../../faq/programming.rst:602 -#, fuzzy msgid "gives a callable object where ``taxes(10e6) == 0.3 * 10e6 + 2``." -msgstr "給出一個可呼叫物件,其中 ``taxes(10e6) == 0.3 * 10e6 + 2``。" +msgstr "給定一個可呼叫物件,其中 ``taxes(10e6) == 0.3 * 10e6 + 2``。" #: ../../faq/programming.rst:604 #, fuzzy @@ -1271,8 +1292,8 @@ msgstr "" #: ../../faq/programming.rst:641 #, fuzzy msgid "" -"Some objects can be copied more easily. Dictionaries have " -"a :meth:`~dict.copy` method::" +"Some objects can be copied more easily. Dictionaries have a :meth:`~dict." +"copy` method::" msgstr "可以更輕鬆地複製某些物件。字典有一個 :meth:`~dict.copy` 方法: ::" #: ../../faq/programming.rst:644 @@ -1541,8 +1562,8 @@ msgid "" "only parameters. Its documentation looks like this::" msgstr "" "函式引數list中的斜線表示它前面的參數是位置參數。僅位置參數是沒有外部可用名稱" -"的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置對映到參數。例" -"如,:func:`divmod` 是一個只接受位置參數的函式。它的文件看起來像這樣: ::" +"的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置對映到參數。例如,:" +"func:`divmod` 是一個只接受位置參數的函式。它的文件看起來像這樣: ::" #: ../../faq/programming.rst:786 msgid "" @@ -1564,8 +1585,8 @@ msgid "" "positional-only. Thus, calling :func:`divmod` with keyword arguments would " "lead to an error::" msgstr "" -"參數串列最後的斜線表示兩個參數都是僅限位置參數。因此使用關鍵字引數呼" -"叫 :func:`divmod` 會導致錯誤: ::" +"參數串列最後的斜線表示兩個參數都是僅限位置參數。因此使用關鍵字引數呼叫 :func:" +"`divmod` 會導致錯誤: ::" #: ../../faq/programming.rst:796 msgid "" @@ -1680,8 +1701,8 @@ msgstr "如何取得 int 文字屬性而不是 SyntaxError?" #: ../../faq/programming.rst:850 msgid "" -"Trying to lookup an ``int`` literal attribute in the normal manner gives " -"a :exc:`SyntaxError` because the period is seen as a decimal point::" +"Trying to lookup an ``int`` literal attribute in the normal manner gives a :" +"exc:`SyntaxError` because the period is seen as a decimal point::" msgstr "" "嘗試以正常方式查找 ``int`` 字面值屬性會給出一個 :exc:`SyntaxError`,因為句點" "被視為小數點: ::" @@ -1717,8 +1738,8 @@ msgid "" "``int('144') == 144``. Similarly, :func:`float` converts to a floating-" "point number, e.g. ``float('144') == 144.0``." msgstr "" -"對於整數,使用內建的 int 型別建構函式,例如``int('144') == 144``。同" -"樣,:func:`float` 轉換為浮點數,例如``浮動('144')== 144.0``。" +"對於整數,使用內建的 int 型別建構函式,例如``int('144') == 144``。同樣,:" +"func:`float` 轉換為浮點數,例如``浮動('144')== 144.0``。" #: ../../faq/programming.rst:875 #, fuzzy @@ -1772,14 +1793,14 @@ msgid "" "in type constructor :func:`str`. If you want a hexadecimal or octal " "representation, use the built-in functions :func:`hex` or :func:`oct`. For " "fancy formatting, see the :ref:`f-strings` and :ref:`formatstrings` " -"sections, e.g. ``\"{:04d}\".format(144)`` yields ``'0144'`` and ``\"{:.3f}" -"\".format(1.0/3.0)`` yields ``'0.333'``." +"sections, e.g. ``\"{:04d}\".format(144)`` yields ``'0144'`` and ``\"{:.3f}\"." +"format(1.0/3.0)`` yields ``'0.333'``." msgstr "" -"例如,要將數字 ``144`` 轉換為字串 ``'144'``,請使用內建型別建構函" -"式 :func:`str`。如果你想要十六進製或八進製表示,請使用內建函式 :func:`hex` " -"或 :func:`oct`。對於精美的格式,請參閱:ref:`f-strings` " -"和:ref:`formatstrings` 部分,例如``\"{:04d}\".format(144)`` 產生 ``'0144'`` " -"和 ``\"{:.3f}\".format(1.0/3.0)`` 產生 ``'0.333'`` ." +"例如,要將數字 ``144`` 轉換為字串 ``'144'``,請使用內建型別建構函式 :func:" +"`str`。如果你想要十六進製或八進製表示,請使用內建函式 :func:`hex` 或 :func:" +"`oct`。對於精美的格式,請參閱:ref:`f-strings` 和:ref:`formatstrings` 部分,例" +"如``\"{:04d}\".format(144)`` 產生 ``'0144'`` 和 ``\"{:.3f}\"." +"format(1.0/3.0)`` 產生 ``'0.333'`` ." #: ../../faq/programming.rst:906 msgid "How do I modify a string in place?" @@ -1894,9 +1915,8 @@ msgid "" msgstr "請注意 :func:`getattr` 適用於任何物件,包括類別、類別實例、模組等。" #: ../../faq/programming.rst:965 -#, fuzzy msgid "This is used in several places in the standard library, like this::" -msgstr "這在標準函式庫中的幾個地方使用,如下所示: ::" +msgstr "這在標準函式庫中的幾個地方被使用,如: ::" #: ../../faq/programming.rst:967 msgid "" @@ -1943,9 +1963,10 @@ msgstr "" "f()" #: ../../faq/programming.rst:990 +#, fuzzy msgid "" -"Is there an equivalent to Perl's chomp() for removing trailing newlines from " -"strings?" +"Is there an equivalent to Perl's ``chomp()`` for removing trailing newlines " +"from strings?" msgstr "" "是否有與 Perl 的 chomp() 等效的方法,能用於從字串中刪除後綴的換行符號?" @@ -1982,7 +2003,8 @@ msgstr "" "很好。" #: ../../faq/programming.rst:1009 -msgid "Is there a scanf() or sscanf() equivalent?" +#, fuzzy +msgid "Is there a ``scanf()`` or ``sscanf()`` equivalent?" msgstr "是否有 scanf() 或 sscanf() 的等效方法?" #: ../../faq/programming.rst:1011 @@ -1995,15 +2017,15 @@ msgstr "不是這樣的。" msgid "" "For simple input parsing, the easiest approach is usually to split the line " "into whitespace-delimited words using the :meth:`~str.split` method of " -"string objects and then convert decimal strings to numeric values " -"using :func:`int` or :func:`float`. :meth:`!split` supports an optional " -"\"sep\" parameter which is useful if the line uses something other than " -"whitespace as a separator." +"string objects and then convert decimal strings to numeric values using :" +"func:`int` or :func:`float`. :meth:`!split` supports an optional \"sep\" " +"parameter which is useful if the line uses something other than whitespace " +"as a separator." msgstr "" "對於簡單的輸入解析,最簡單的方法通常是使用字串物件的 :meth:`~str.split` 方法" -"將行拆分為以空格分隔的單詞,然後使用 :func:`int` 或將十進製字串轉換為數" -"值:func:`浮動`。 :meth:`!split` 支援可選的 \"sep\" 參數,如果該行使用空格以外" -"的其他內容作為分隔符,該參數很有用。" +"將行拆分為以空格分隔的單詞,然後使用 :func:`int` 或將十進製字串轉換為數值:" +"func:`浮動`。 :meth:`!split` 支援可選的 \"sep\" 參數,如果該行使用空格以外的" +"其他內容作為分隔符,該參數很有用。" #: ../../faq/programming.rst:1019 #, fuzzy @@ -2014,7 +2036,8 @@ msgstr "" "對於更複雜的輸入解析,正則運算式比 C 的 ``sscanf`` 更強大,更適合這項任務。" #: ../../faq/programming.rst:1024 -msgid "What does 'UnicodeDecodeError' or 'UnicodeEncodeError' error mean?" +#, fuzzy +msgid "What does ``UnicodeDecodeError`` or ``UnicodeEncodeError`` error mean?" msgstr "'UnicodeDecodeError' 或 'UnicodeEncodeErro' 錯誤是什麼意思?" #: ../../faq/programming.rst:1026 @@ -2034,11 +2057,12 @@ msgid "" msgstr "以奇數個反斜線結尾的原始字串將轉義字串的引號: ::" #: ../../faq/programming.rst:1036 +#, fuzzy msgid "" ">>> r'C:\\this\\will\\not\\work\\'\n" " File \"<stdin>\", line 1\n" " r'C:\\this\\will\\not\\work\\'\n" -" ^\n" +" ^\n" "SyntaxError: unterminated string literal (detected at line 1)" msgstr "" ">>> r'C:\\this\\will\\not\\work\\'\n" @@ -2118,7 +2142,7 @@ msgstr "另請參閱 :ref:`語言參考 <strings>` 中的規範。" #: ../../faq/programming.rst:1070 msgid "Performance" -msgstr "" +msgstr "效能" #: ../../faq/programming.rst:1073 msgid "My program is too slow. How do I speed it up?" @@ -2152,8 +2176,8 @@ msgid "" "You should always find the hot spots in your program *before* attempting to " "optimize any code (see the :mod:`profile` module)." msgstr "" -"在嘗試最佳化任何程式碼\\ *之前*,你應該始終找到程式中的熱點(請參" -"閱 :mod:`profile` 模組)。" +"在嘗試最佳化任何程式碼\\ *之前*,你應該始終找到程式中的熱點(請參閱 :mod:" +"`profile` 模組)。" #: ../../faq/programming.rst:1084 #, fuzzy @@ -2208,9 +2232,9 @@ msgid "" "When the standard library provides a primitive for doing something, it is " "likely (although not guaranteed) to be faster than any alternative you may " "come up with. This is doubly true for primitives written in C, such as " -"builtins and some extension types. For example, be sure to use either " -"the :meth:`list.sort` built-in method or the related :func:`sorted` function " -"to do sorting (and see the :ref:`sortinghowto` for examples of moderately " +"builtins and some extension types. For example, be sure to use either the :" +"meth:`list.sort` built-in method or the related :func:`sorted` function to " +"do sorting (and see the :ref:`sortinghowto` for examples of moderately " "advanced usage)." msgstr "" "當標準函式庫提供用於執行某些操作的原語時,它很可能(儘管不能保證)比你可能想" @@ -2245,9 +2269,9 @@ msgid "" msgstr "" "如果你已經達到純 Python 所能允許的極限,可以使用一些工具讓你走得更遠。例如," "`Cython <https://cython.org>`_ 可以將稍微修改過的 Python 程式碼編譯成 C 擴" -"充,並且可以在許多不同的平台上使用。 Cython 可以利用編譯(和可選的型別註釋)" -"使你的程式碼比解釋時快得多。如果你對自己的 C 編程技能有信心,你也可以 :ref:`" -"自己編寫一個 C 擴充模組 <extending-index>`。" +"充,並且可以在許多不同的平台上使用。Cython 可以利用編譯(和可選的型別註釋)使" +"你的程式碼比解釋時快得多。如果你對自己的 C 程式設計技能有信心,你也可以\\ :" +"ref:`自己編寫一個 C 擴充模組 <extending-index>`。" #: ../../faq/programming.rst:1125 msgid "" @@ -2280,8 +2304,8 @@ msgid "" "To accumulate many :class:`str` objects, the recommended idiom is to place " "them into a list and call :meth:`str.join` at the end::" msgstr "" -"要累積許多 :class:`str` 物件,推薦的習慣用法是將它們放入list中並在末尾呼" -"叫 :meth:`str.join`: ::" +"要累積許多 :class:`str` 物件,推薦的習慣用法是將它們放入list中並在末尾呼叫 :" +"meth:`str.join`: ::" #: ../../faq/programming.rst:1141 msgid "" @@ -2290,6 +2314,10 @@ msgid "" " chunks.append(s)\n" "result = ''.join(chunks)" msgstr "" +"chunks = []\n" +"for s in my_strings:\n" +" chunks.append(s)\n" +"result = ''.join(chunks)" #: ../../faq/programming.rst:1146 #, fuzzy @@ -2312,16 +2340,17 @@ msgid "" "for b in my_bytes_objects:\n" " result += b" msgstr "" +"result = bytearray()\n" +"for b in my_bytes_objects:\n" +" result += b" #: ../../faq/programming.rst:1157 -#, fuzzy msgid "Sequences (Tuples/Lists)" -msgstr "序列(元組/list)" +msgstr "序列(元組/串列)" #: ../../faq/programming.rst:1160 -#, fuzzy msgid "How do I convert between tuples and lists?" -msgstr "如何在元組和list之間進行轉換?" +msgstr "如何在元組和串列之間進行轉換?" #: ../../faq/programming.rst:1162 msgid "" @@ -2357,9 +2386,8 @@ msgstr "" "本。" #: ../../faq/programming.rst:1177 -#, fuzzy msgid "What's a negative index?" -msgstr "什麼是負指數?" +msgstr "什麼是負索引?" #: ../../faq/programming.rst:1179 #, fuzzy @@ -2408,27 +2436,24 @@ msgid "" msgstr "這不會觸及你的原始序列,但會構建一個具有相反順序的新副本以進行疊代。" #: ../../faq/programming.rst:1202 -#, fuzzy msgid "How do you remove duplicates from a list?" -msgstr "如何從list中刪除重複項?" +msgstr "如何從串列中刪除重複項?" #: ../../faq/programming.rst:1204 -#, fuzzy msgid "See the Python Cookbook for a long discussion of many ways to do this:" -msgstr "請參閱 Python Cookbook 以取得有關執行此操作的多種方法的詳細討論:" +msgstr "請參閱 Python Cookbook 以得到有關執行此操作的各種方法的詳細討論:" #: ../../faq/programming.rst:1206 msgid "https://code.activestate.com/recipes/52560/" msgstr "https://code.activestate.com/recipes/52560/" #: ../../faq/programming.rst:1208 -#, fuzzy msgid "" "If you don't mind reordering the list, sort it and then scan from the end of " "the list, deleting duplicates as you go::" msgstr "" -"如果你不介意重新排序list,請對其進行排序,然後從list末尾開始掃描,同時刪除重" -"複項: ::" +"如果你不介意重新排序串列,可以對其進行排序,然後從串列末尾開始掃描,同時刪除" +"重複項: ::" #: ../../faq/programming.rst:1211 msgid "" @@ -2441,31 +2466,36 @@ msgid "" " else:\n" " last = mylist[i]" msgstr "" +"if mylist:\n" +" mylist.sort()\n" +" last = mylist[-1]\n" +" for i in range(len(mylist)-2, -1, -1):\n" +" if last == mylist[i]:\n" +" del mylist[i]\n" +" else:\n" +" last = mylist[i]" #: ../../faq/programming.rst:1220 -#, fuzzy msgid "" -"If all elements of the list may be used as set keys (i.e. they are " -"all :term:`hashable`) this is often faster ::" +"If all elements of the list may be used as set keys (i.e. they are all :term:" +"`hashable`) this is often faster ::" msgstr "" -"如果list的所有元素都可以用作集合鍵(即它們都是 :term:`hashable`),這通常會更" -"快: ::" +"如果串列的所有元素都可以做為集合的鍵(即它們都必須是 :term:`hashable`),那這" +"通常會更快: ::" #: ../../faq/programming.rst:1223 msgid "mylist = list(set(mylist))" -msgstr "" +msgstr "mylist = list(set(mylist))" #: ../../faq/programming.rst:1225 -#, fuzzy msgid "" "This converts the list into a set, thereby removing duplicates, and then " "back into a list." -msgstr "這會將list轉換為一個集合,從而刪除重複項,然後再轉換回list。" +msgstr "這會將串列轉換為一個集合,從而刪除重複項,然後再轉換回串列。" #: ../../faq/programming.rst:1230 -#, fuzzy msgid "How do you remove multiple items from a list" -msgstr "如何從list中刪除多個項目" +msgstr "如何從串列中刪除多個項目" #: ../../faq/programming.rst:1232 #, fuzzy @@ -2549,14 +2579,12 @@ msgstr "" "樣做,因為它通常比使用 Python list慢很多。" #: ../../faq/programming.rst:1273 -#, fuzzy msgid "How do I create a multidimensional list?" -msgstr "如何建立多維 list?" +msgstr "如何建立多維度串列?" #: ../../faq/programming.rst:1275 -#, fuzzy msgid "You probably tried to make a multidimensional array like this::" -msgstr "你可能嘗試製作這樣的多維數組: ::" +msgstr "你可能會這樣建立一個多維度陣列: ::" #: ../../faq/programming.rst:1277 msgid ">>> A = [[None] * 2] * 3" @@ -2575,9 +2603,8 @@ msgstr "" "[[None, None], [None, None], [None, None]]" #: ../../faq/programming.rst:1290 -#, fuzzy msgid "But when you assign a value, it shows up in multiple places:" -msgstr "但是當你分配一個值時,它會出現在多個地方:" +msgstr "但是當你賦予一個值時,它會出現在多個地方:" #: ../../faq/programming.rst:1296 msgid "" @@ -2585,25 +2612,26 @@ msgid "" ">>> A\n" "[[5, None], [5, None], [5, None]]" msgstr "" +">>> A[0][0] = 5\n" +">>> A\n" +"[[5, None], [5, None], [5, None]]" #: ../../faq/programming.rst:1302 -#, fuzzy msgid "" "The reason is that replicating a list with ``*`` doesn't create copies, it " "only creates references to the existing objects. The ``*3`` creates a list " "containing 3 references to the same list of length two. Changes to one row " "will show in all rows, which is almost certainly not what you want." msgstr "" -"原因是複製帶有 ``*`` 的list不會建立副本,它只會建立對現有物件的參照。 ``*3`` " -"建立一個list,其中包含 3 個對長度為 2 的相同list的參照。對一行的更改將顯示在" -"所有行中,這幾乎肯定不是你想要的。" +"原因是複製帶有 ``*`` 的串列不會建立副本,它只會建立對現有物件的參照。``*3`` " +"建立一個串列,其中包含 3 個對長度為 2 的相同串列的參照。對其中一列的變更也將" +"顯示在所有其他列中,而這幾乎不會是你想要的。" #: ../../faq/programming.rst:1307 -#, fuzzy msgid "" "The suggested approach is to create a list of the desired length first and " "then fill in each element with a newly created list::" -msgstr "建議的方法是先建立所需長度的list,然後用新建立的list填充每個元素: ::" +msgstr "建議的方法是先建立所需長度的串列,然後用新建立的串列填充每個元素: ::" #: ../../faq/programming.rst:1310 msgid "" @@ -2611,40 +2639,43 @@ msgid "" "for i in range(3):\n" " A[i] = [None] * 2" msgstr "" +"A = [None] * 3\n" +"for i in range(3):\n" +" A[i] = [None] * 2" #: ../../faq/programming.rst:1314 -#, fuzzy msgid "" "This generates a list containing 3 different lists of length two. You can " "also use a list comprehension::" msgstr "" -"這會生成一個包含 3 個長度為 2 的不同list的list。你還可以使用list推導: ::" +"這會產生一個包含 3 個長度為 2 的不同串列的串列。你也可以使用串列綜合運算" +"式: ::" #: ../../faq/programming.rst:1317 msgid "" "w, h = 2, 3\n" "A = [[None] * w for i in range(h)]" msgstr "" +"w, h = 2, 3\n" +"A = [[None] * w for i in range(h)]" #: ../../faq/programming.rst:1320 -#, fuzzy msgid "" "Or, you can use an extension that provides a matrix datatype; `NumPy " "<https://numpy.org/>`_ is the best known." msgstr "" -"或者,你可以使用提供矩陣資料型別的擴充; `NumPy <https://numpy.org/>`_ 是最著" -"名的。" +"或者你也可以使用提供矩陣資料型別的擴充套件;`NumPy <https://numpy.org/>`_ 是" +"其中最著名的一個。" #: ../../faq/programming.rst:1325 -#, fuzzy msgid "How do I apply a method or function to a sequence of objects?" -msgstr "如何將方法或函式應用於一系列物件?" +msgstr "如何將方法或函式應用於物件序列?" #: ../../faq/programming.rst:1327 #, fuzzy msgid "" -"To call a method or function and accumulate the return values is a list, " -"a :term:`list comprehension` is an elegant solution::" +"To call a method or function and accumulate the return values is a list, a :" +"term:`list comprehension` is an elegant solution::" msgstr "" "呼叫一個方法或函式並累積回傳值是一個list,一個 :term:`list comprehension` 是" "一個優雅的解決方案: ::" @@ -2655,6 +2686,9 @@ msgid "" "\n" "result = [function(obj) for obj in mylist]" msgstr "" +"result = [obj.method() for obj in mylist]\n" +"\n" +"result = [function(obj) for obj in mylist]" #: ../../faq/programming.rst:1334 #, fuzzy @@ -2671,12 +2705,16 @@ msgid "" "for obj in mylist:\n" " function(obj)" msgstr "" +"for obj in mylist:\n" +" obj.method()\n" +"\n" +"for obj in mylist:\n" +" function(obj)" #: ../../faq/programming.rst:1346 -#, fuzzy msgid "" "Why does a_tuple[i] += ['item'] raise an exception when the addition works?" -msgstr "為什麼 a_tuple[i] += ['item'] 在加法工作時引發例外?" +msgstr "為什麼 a_tuple[i] += ['item'] 做加法時會引發例外?" #: ../../faq/programming.rst:1348 #, fuzzy @@ -2699,7 +2737,6 @@ msgstr "" "``list`` 和 ``+=\" 作為範例。" #: ../../faq/programming.rst:1356 -#, fuzzy msgid "If you wrote::" msgstr "如果你寫了: ::" @@ -2711,6 +2748,11 @@ msgid "" " ...\n" "TypeError: 'tuple' object does not support item assignment" msgstr "" +">>> a_tuple = (1, 2)\n" +">>> a_tuple[0] += 1\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" #: ../../faq/programming.rst:1364 #, fuzzy @@ -2726,11 +2768,10 @@ msgstr "" "會得到一個錯誤,因為我們無法更改元組的元素指向的內容。" #: ../../faq/programming.rst:1370 -#, fuzzy msgid "" "Under the covers, what this augmented assignment statement is doing is " "approximately this::" -msgstr "在幕後,這個擴充賦值陳述式所做的大致是這樣的: ::" +msgstr "這個增強賦值陳述式在背後大致是做這些事情: ::" #: ../../faq/programming.rst:1373 msgid "" @@ -2740,6 +2781,11 @@ msgid "" " ...\n" "TypeError: 'tuple' object does not support item assignment" msgstr "" +">>> result = a_tuple[0] + 1\n" +">>> a_tuple[0] = result\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: 'tuple' object does not support item assignment" #: ../../faq/programming.rst:1379 #, fuzzy @@ -2787,11 +2833,11 @@ msgid "" "to calling :meth:`!extend` on the list and returning the list. That's why " "we say that for lists, ``+=`` is a \"shorthand\" for :meth:`!list.extend`::" msgstr "" -"要了解為什麼會發生這種情況,你需要知道 (a) 如果一個物件實作了一" -"個 :meth:`~object.__iadd__` 魔術方法,它會在執行 ``+=`` 增廣賦值時被呼叫,並" -"且它的回傳value 是賦值陳述式中使用的值; (b) 對於list,:meth:`!__iadd__` 相當" -"於在list上呼叫 :meth:`!extend` 並回傳list。這就是為什麼我們說對於list," -"``+=`` 是 :meth:`!list.extend` 的「簡寫」: ::" +"要了解為什麼會發生這種情況,你需要知道 (a) 如果一個物件實作了一個 :meth:" +"`~object.__iadd__` 魔術方法,它會在執行 ``+=`` 增廣賦值時被呼叫,並且它的回傳" +"value 是賦值陳述式中使用的值; (b) 對於list,:meth:`!__iadd__` 相當於在list上" +"呼叫 :meth:`!extend` 並回傳list。這就是為什麼我們說對於list,``+=`` 是 :meth:" +"`!list.extend` 的「簡寫」: ::" #: ../../faq/programming.rst:1404 msgid "" @@ -2962,8 +3008,8 @@ msgstr "什麼是方法 (method)?" #: ../../faq/programming.rst:1481 #, fuzzy msgid "" -"A method is a function on some object ``x`` that you normally call as " -"``x.name(arguments...)``. Methods are defined as functions inside the class " +"A method is a function on some object ``x`` that you normally call as ``x." +"name(arguments...)``. Methods are defined as functions inside the class " "definition::" msgstr "" "方法是一些物件 ``x`` 上的函式,你通常將其稱為 ``x.name(arguments...)`` 。方法" @@ -2999,11 +3045,10 @@ msgid "See also :ref:`why-self`." msgstr "另請參閱 :ref:`why-self`。" #: ../../faq/programming.rst:1502 -#, fuzzy msgid "" "How do I check if an object is an instance of a given class or of a subclass " "of it?" -msgstr "如何檢查一個物件是給定類別的實例還是它的子類別的實例?" +msgstr "如何檢查物件是否是給定類別的實例或其子類別的實例?" #: ../../faq/programming.rst:1504 #, fuzzy @@ -3023,15 +3068,15 @@ msgstr "" #: ../../faq/programming.rst:1511 msgid "" -"Note that :func:`isinstance` also checks for virtual inheritance from " -"an :term:`abstract base class`. So, the test will return ``True`` for a " +"Note that :func:`isinstance` also checks for virtual inheritance from an :" +"term:`abstract base class`. So, the test will return ``True`` for a " "registered class even if hasn't directly or indirectly inherited from it. " "To test for \"true inheritance\", scan the :term:`MRO` of the class:" msgstr "" "請注意,:func:`isinstance` 還會檢查來自\\ :term:`抽象基底類別 (abstract base " "class) <abstract base class>` 的虛擬繼承。因此對已註冊類別的檢驗會回傳 " -"``True``,即使沒有直接或間接繼承自它。要測試「真正繼承」,請掃描該類別" -"的 :term:`MRO`:" +"``True``,即使沒有直接或間接繼承自它。要測試「真正繼承」,請掃描該類別的 :" +"term:`MRO`:" #: ../../faq/programming.rst:1516 msgid "" @@ -3148,12 +3193,10 @@ msgstr "" "obj.search()" #: ../../faq/programming.rst:1575 -#, fuzzy msgid "What is delegation?" -msgstr "什麼是委派?" +msgstr "什麼是委派 (delegation)?" #: ../../faq/programming.rst:1577 -#, fuzzy msgid "" "Delegation is an object oriented technique (also called a design pattern). " "Let's say you have an object ``x`` and want to change the behaviour of just " @@ -3161,19 +3204,18 @@ msgid "" "implementation of the method you're interested in changing and delegates all " "other methods to the corresponding method of ``x``." msgstr "" -"委託是一種面向物件的技術(也稱為設計模式)。假設你有一個物件 ``x`` 並且只想更" -"改其中一個方法的行為。你可以建立一個新類別,它提供你感興趣的方法的新實作,並" -"將所有其他方法委託給 ``x`` 的相應方法。" +"委派是一種物件導向的技法(也稱為設計模式)。假設你有一個物件 ``x`` 並且只想更" +"改其中一個方法的行為。你可以建立一個新類別,它提供你想改變的那個方法的新實" +"作,並將所有其他方法委派給 ``x`` 的相應方法。" #: ../../faq/programming.rst:1583 -#, fuzzy msgid "" "Python programmers can easily implement delegation. For example, the " "following class implements a class that behaves like a file but converts all " "written data to uppercase::" msgstr "" -"Python 程式設計師可以輕鬆實作委託。例如,下面的類別實作了一個行為類似於檔案但" -"將所有寫入資料轉換為大寫的類別: ::" +"Python 程式設計師可以輕鬆地實作委派。舉例來說,以下類別實作了一個行為類似檔案" +"的類別,但將所有寫入的資料轉換為大寫:" #: ../../faq/programming.rst:1587 msgid "" @@ -3203,29 +3245,29 @@ msgstr "" #, fuzzy msgid "" "Here the ``UpperOut`` class redefines the ``write()`` method to convert the " -"argument string to uppercase before calling the underlying " -"``self._outfile.write()`` method. All other methods are delegated to the " -"underlying ``self._outfile`` object. The delegation is accomplished via " -"the :meth:`~object.__getattr__` method; consult :ref:`the language reference " -"<attribute-access>` for more information about controlling attribute access." +"argument string to uppercase before calling the underlying ``self._outfile." +"write()`` method. All other methods are delegated to the underlying ``self." +"_outfile`` object. The delegation is accomplished via the :meth:`~object." +"__getattr__` method; consult :ref:`the language reference <attribute-" +"access>` for more information about controlling attribute access." msgstr "" -"這裡的 ``UpperOut`` 類別重新定義了``write()`` 方法,在呼叫底層的" -"``self._outfile.write()`` 方法之前將引數字串轉換為大寫。所有其他方法都委託給" -"底層的 ``self._outfile`` 物件。委託是透過 :meth:`~object.__getattr__` 方法完" -"成的;有關控制屬性存取的更多資訊,請參閱語言參考 <attribute-access>。" +"這裡的 ``UpperOut`` 類別重新定義了``write()`` 方法,在呼叫底層的``self." +"_outfile.write()`` 方法之前將引數字串轉換為大寫。所有其他方法都委託給底層的 " +"``self._outfile`` 物件。委託是透過 :meth:`~object.__getattr__` 方法完成的;有" +"關控制屬性存取的更多資訊,請參閱語言參考 <attribute-access>。" #: ../../faq/programming.rst:1605 #, fuzzy msgid "" "Note that for more general cases delegation can get trickier. When " -"attributes must be set as well as retrieved, the class must define " -"a :meth:`~object.__setattr__` method too, and it must do so carefully. The " -"basic implementation of :meth:`!__setattr__` is roughly equivalent to the " +"attributes must be set as well as retrieved, the class must define a :meth:" +"`~object.__setattr__` method too, and it must do so carefully. The basic " +"implementation of :meth:`!__setattr__` is roughly equivalent to the " "following::" msgstr "" "請注意,對於更一般的情況,委託可能會變得更加棘手。當必須設定和檢索屬性時,該" -"類別也必須定義一個 :meth:`~object.__setattr__` 方法,而且必須小心謹" -"慎。 :meth:`!__setattr__` 的基本實作大致等同於以下: ::" +"類別也必須定義一個 :meth:`~object.__setattr__` 方法,而且必須小心謹慎。 :" +"meth:`!__setattr__` 的基本實作大致等同於以下: ::" #: ../../faq/programming.rst:1610 msgid "" @@ -3243,9 +3285,8 @@ msgstr "" #: ../../faq/programming.rst:1616 msgid "" -"Many :meth:`~object.__setattr__` implementations call :meth:`!" -"object.__setattr__` to set an attribute on self without causing infinite " -"recursion::" +"Many :meth:`~object.__setattr__` implementations call :meth:`!object." +"__setattr__` to set an attribute on self without causing infinite recursion::" msgstr "" "許多 :meth:`~object.__setattr__` 的實作會呼叫 :meth:`!object.__setattr__` 以" "設定 self 的屬性,而不會導致無限遞迴。" @@ -3264,8 +3305,8 @@ msgstr "" #: ../../faq/programming.rst:1624 msgid "" -"Alternatively, it is possible to set attributes by inserting entries " -"into :attr:`self.__dict__ <object.__dict__>` directly." +"Alternatively, it is possible to set attributes by inserting entries into :" +"attr:`self.__dict__ <object.__dict__>` directly." msgstr "" #: ../../faq/programming.rst:1629 @@ -3298,9 +3339,8 @@ msgid "" msgstr "" #: ../../faq/programming.rst:1644 -#, fuzzy msgid "How can I organize my code to make it easier to change the base class?" -msgstr "我如何組織我的程式碼以便更容易地更改基底類別?" +msgstr "我可以如何組織我的程式碼以使得更改基底類別變的更容易?" #: ../../faq/programming.rst:1646 #, fuzzy @@ -3333,19 +3373,16 @@ msgstr "" " ..." #: ../../faq/programming.rst:1661 -#, fuzzy msgid "How do I create static class data and static class methods?" msgstr "如何建立靜態類別資料和靜態類別方法?" #: ../../faq/programming.rst:1663 -#, fuzzy msgid "" "Both static data and static methods (in the sense of C++ or Java) are " "supported in Python." msgstr "Python 支援靜態資料和靜態方法(在 C++ 或 Java 的意義上)。" #: ../../faq/programming.rst:1666 -#, fuzzy msgid "" "For static data, simply define a class attribute. To assign a new value to " "the attribute, you have to explicitly use the class name in the assignment::" @@ -3374,7 +3411,6 @@ msgstr "" " return C.count # 或回傳 self.count" #: ../../faq/programming.rst:1678 -#, fuzzy msgid "" "``c.count`` also refers to ``C.count`` for any ``c`` such that " "``isinstance(c, C)`` holds, unless overridden by ``c`` itself or by some " @@ -3444,9 +3480,8 @@ msgstr "" "則這提供了所需的封裝。" #: ../../faq/programming.rst:1708 -#, fuzzy msgid "How can I overload constructors (or methods) in Python?" -msgstr "如何在 Python 中重載建構函式(或方法)?" +msgstr "如何在 Python 中多載 (overload) 建構函式(或方法)?" #: ../../faq/programming.rst:1710 msgid "" @@ -3519,7 +3554,6 @@ msgid "I try to use __spam and I get an error about _SomeClassName__spam." msgstr "我嘗試使用 __spam,但收到有關 _SomeClassName__spam 的錯誤。" #: ../../faq/programming.rst:1745 -#, fuzzy msgid "" "Variable names with double leading underscores are \"mangled\" to provide a " "simple but effective way to define class private variables. Any identifier " @@ -3528,10 +3562,10 @@ msgid "" "``classname`` is the current class name with any leading underscores " "stripped." msgstr "" -"帶有雙前導底線的變數名被「破壞」以提供一種簡單但有效的方法來定義類別私有變" -"數。 ``__spam`` 形式的任何標識器(至少兩個前導底線,最多一個尾隨底線)在文本" -"上替換為 ``_classname__spam``,其中 ``classname`` 是目前類別名稱,所有前導底線" -"被去除。" +"帶有雙前導底線的變數名會被「破壞 (mangled)」以做為提供定義類別私有變數的一個" +"簡單但有效的方法。``__spam`` 形式的任何識別字(至少兩個前導底線,最多一個尾隨" +"底線)在文字上會被替換為 ``_classname__spam``,其中 ``classname`` 是目前類別" +"之所有前導底線被去除的名稱。" #: ../../faq/programming.rst:1751 msgid "" @@ -3590,14 +3624,13 @@ msgid "There are several possible reasons for this." msgstr "這有幾個可能的原因。" #: ../../faq/programming.rst:1782 -#, fuzzy msgid "" -"The :keyword:`del` statement does not necessarily " -"call :meth:`~object.__del__` -- it simply decrements the object's reference " -"count, and if this reaches zero :meth:`!__del__` is called." +"The :keyword:`del` statement does not necessarily call :meth:`~object." +"__del__` -- it simply decrements the object's reference count, and if this " +"reaches zero :meth:`!__del__` is called." msgstr "" -":keyword:`del` 陳述式不一定呼叫 :meth:`~object.__del__` -- 它只是減少物件的引" -"用計數,如果達到零,則呼叫 :meth:`!__del__`。" +":keyword:`del` 陳述式不一定會呼叫 :meth:`~object.__del__` -- 它只是減少物件的" +"參照計數,如果達到零則呼叫 :meth:`!__del__`。" #: ../../faq/programming.rst:1786 #, fuzzy @@ -3653,23 +3686,21 @@ msgid "" "Finally, if your :meth:`!__del__` method raises an exception, a warning " "message is printed to :data:`sys.stderr`." msgstr "" -"最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告訊息印出" -"到 :data:`sys.stderr`。" +"最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告訊息印出到 :data:" +"`sys.stderr`。" #: ../../faq/programming.rst:1822 -#, fuzzy msgid "How do I get a list of all instances of a given class?" -msgstr "如何取得給定類別的所有實例的 list?" +msgstr "我該如何取得給定類別的所有實例的串列?" #: ../../faq/programming.rst:1824 -#, fuzzy msgid "" "Python does not keep track of all instances of a class (or of a built-in " "type). You can program the class's constructor to keep track of all " "instances by keeping a list of weak references to each instance." msgstr "" -"Python 不會追蹤類別(或內建型別)的所有實例。你可以對類別的建構函式進行編程," -"以透過保留對每個實例的弱參照串列來追蹤所有實例。" +"Python 不會追蹤類別(或內建型別)的所有實例。你可以將類別的建構函式進行改寫," +"以透過保留對每個實例之弱參照串列來追蹤所有實例。" #: ../../faq/programming.rst:1830 msgid "Why does the result of ``id()`` appear to be not unique?" @@ -3731,16 +3762,18 @@ msgstr "" "說,保證識別性的情況有以下三種:" #: ../../faq/programming.rst:1870 +#, fuzzy msgid "" -"1) Assignments create new names but do not change object identity. After " -"the assignment ``new = old``, it is guaranteed that ``new is old``." +"Assignments create new names but do not change object identity. After the " +"assignment ``new = old``, it is guaranteed that ``new is old``." msgstr "" "1) 賦值建立新名稱但不改變物件識別性。賦值 ``new = old`` 後,保證 ``new is " "old``。" #: ../../faq/programming.rst:1873 +#, fuzzy msgid "" -"2) Putting an object in a container that stores object references does not " +"Putting an object in a container that stores object references does not " "change object identity. After the list assignment ``s[0] = x``, it is " "guaranteed that ``s[0] is x``." msgstr "" @@ -3750,9 +3783,9 @@ msgstr "" #: ../../faq/programming.rst:1877 #, fuzzy msgid "" -"3) If an object is a singleton, it means that only one instance of that " -"object can exist. After the assignments ``a = None`` and ``b = None``, it " -"is guaranteed that ``a is b`` because ``None`` is a singleton." +"If an object is a singleton, it means that only one instance of that object " +"can exist. After the assignments ``a = None`` and ``b = None``, it is " +"guaranteed that ``a is b`` because ``None`` is a singleton." msgstr "" "3)如果一個物件是單例,則意味著該物件只能存在一個實例。在賦值 ``a = None`` " "和 ``b = None`` 之後,可以保證 ``a is b`` 因為 ``None`` 是單例。" @@ -3833,8 +3866,8 @@ msgid "" "implement a method that behaves like :meth:`dict.pop`:" msgstr "" "當 ``None`` 是有效輸入值時,檢測可選引數可能會很棘手。在這些情況下,你可以建" -"立一個保證與其他物件不同的單例哨兵物件。例如,這裡是如何實作一個行為類似" -"於 :meth:`dict.pop` 的方法:" +"立一個保證與其他物件不同的單例哨兵物件。例如,這裡是如何實作一個行為類似於 :" +"meth:`dict.pop` 的方法:" #: ../../faq/programming.rst:1917 msgid "" @@ -3871,8 +3904,8 @@ msgstr "" #: ../../faq/programming.rst:1934 msgid "" -"For example, here is the implementation of :meth:`!" -"collections.abc.Sequence.__contains__`::" +"For example, here is the implementation of :meth:`!collections.abc.Sequence." +"__contains__`::" msgstr "" "例如,以下是 :meth:`!collections.abc.Sequence.__contains__` 的實作: ::" @@ -3903,9 +3936,9 @@ msgid "" "*after* an instance is created, which is too late to alter data in an " "immutable instance." msgstr "" -"當對不可變型別進行子類別化時,覆蓋 :meth:`~object.__new__` 方法而不" -"是 :meth:`~object.__init__` 方法。後者僅在*建立實例後*運行,這為時已晚,無法" -"更改不可變實例中的資料。" +"當對不可變型別進行子類別化時,覆蓋 :meth:`~object.__new__` 方法而不是 :meth:" +"`~object.__init__` 方法。後者僅在*建立實例後*運行,這為時已晚,無法更改不可變" +"實例中的資料。" #: ../../faq/programming.rst:1952 msgid "" @@ -3988,14 +4021,12 @@ msgstr "如何快取方法呼叫?" #: ../../faq/programming.rst:1997 #, fuzzy msgid "" -"The two principal tools for caching methods " -"are :func:`functools.cached_property` and :func:`functools.lru_cache`. The " -"former stores results at the instance level and the latter at the class " -"level." +"The two principal tools for caching methods are :func:`functools." +"cached_property` and :func:`functools.lru_cache`. The former stores results " +"at the instance level and the latter at the class level." msgstr "" -"快取方法的兩個主要工具是 func:`functools.cached_property` " -"和 :func:`functools.lru_cache`。前者在實例級別存儲結果,後者在類別級別存儲結" -"果。" +"快取方法的兩個主要工具是 func:`functools.cached_property` 和 :func:" +"`functools.lru_cache`。前者在實例級別存儲結果,後者在類別級別存儲結果。" #: ../../faq/programming.rst:2002 #, fuzzy @@ -4080,13 +4111,12 @@ msgstr "" #, fuzzy msgid "" "To make the *lru_cache* approach work when the *station_id* is mutable, the " -"class needs to define the :meth:`~object.__eq__` " -"and :meth:`~object.__hash__` methods so that the cache can detect relevant " -"attribute updates::" +"class needs to define the :meth:`~object.__eq__` and :meth:`~object." +"__hash__` methods so that the cache can detect relevant attribute updates::" msgstr "" -"要在 *station_id* 可變時使 *lru_cache* 方法起作用,該類別需要定" -"義 :meth:`~object.__eq__` 和 :meth:`~object.__hash__` 方法,以便快取可以檢測" -"相關屬性更新: ::" +"要在 *station_id* 可變時使 *lru_cache* 方法起作用,該類別需要定義 :meth:" +"`~object.__eq__` 和 :meth:`~object.__hash__` 方法,以便快取可以檢測相關屬性更" +"新: ::" #: ../../faq/programming.rst:2053 msgid "" @@ -4133,8 +4163,8 @@ msgstr "" "第一次引入模組時(或者源檔案自建立目前編譯檔案後發生更改時)應在 " "``__pycache__`` 的子目錄中建立包含編譯程式碼的 ``.pyc`` 檔案包含 .py 檔案的目" "錄。 ``.pyc`` 檔案的檔案名以與``.py`` 檔案相同的名稱開頭,以``.pyc`` 結尾,中" -"間部分依賴於特定的``python `` 建立它的二進製檔案。(有關詳細資訊,請參" -"閱 :pep:`3147`。)" +"間部分依賴於特定的``python `` 建立它的二進製檔案。(有關詳細資訊,請參閱 :" +"pep:`3147`。)" #: ../../faq/programming.rst:2088 #, fuzzy @@ -4165,10 +4195,10 @@ msgstr "" #: ../../faq/programming.rst:2098 #, fuzzy msgid "" -"Running Python on a top level script is not considered an import and no " -"``.pyc`` will be created. For example, if you have a top-level module " -"``foo.py`` that imports another module ``xyz.py``, when you run ``foo`` (by " -"typing ``python foo.py`` as a shell command), a ``.pyc`` will be created for " +"Running Python on a top level script is not considered an import and no ``." +"pyc`` will be created. For example, if you have a top-level module ``foo." +"py`` that imports another module ``xyz.py``, when you run ``foo`` (by typing " +"``python foo.py`` as a shell command), a ``.pyc`` will be created for " "``xyz`` because ``xyz`` is imported, but no ``.pyc`` file will be created " "for ``foo`` since ``foo.py`` isn't being imported." msgstr "" @@ -4179,9 +4209,9 @@ msgstr "" #: ../../faq/programming.rst:2105 msgid "" -"If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a " -"``.pyc`` file for a module that is not imported -- you can, using " -"the :mod:`py_compile` and :mod:`compileall` modules." +"If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a ``." +"pyc`` file for a module that is not imported -- you can, using the :mod:" +"`py_compile` and :mod:`compileall` modules." msgstr "" "如果你需要為 ``foo`` 建立一個 ``.pyc`` 檔案 —— 也就是說,要為一個未引入的模組" "建立一個 ``.pyc`` 檔案 —— 你可以使用 :mod:`py_compile` 和 :mod:`compileall` " @@ -4198,10 +4228,10 @@ msgstr "" #: ../../faq/programming.rst:2112 msgid "" ">>> import py_compile\n" -">>> py_compile.compile('foo.py') " +">>> py_compile.compile('foo.py')" msgstr "" ">>> import py_compile\n" -">>> py_compile.compile('foo.py') " +">>> py_compile.compile('foo.py')" #: ../../faq/programming.rst:2115 msgid "" @@ -4359,11 +4389,11 @@ msgstr "此問題有(至少)三種可能的解決方法。" #: ../../faq/programming.rst:2178 #, fuzzy msgid "" -"Guido van Rossum recommends avoiding all uses of ``from <module> " -"import ...``, and placing all code inside functions. Initializations of " -"global variables and class variables should use constants or built-in " -"functions only. This means everything from an imported module is referenced " -"as ``<module>.<name>``." +"Guido van Rossum recommends avoiding all uses of ``from <module> import ..." +"``, and placing all code inside functions. Initializations of global " +"variables and class variables should use constants or built-in functions " +"only. This means everything from an imported module is referenced as " +"``<module>.<name>``." msgstr "" "Guido van Rossum 建議避免使用``from <module> import ...``,並將所有程式碼放在" "函式中。全域變數和類別變數的初始化應該只使用常數或內建函式。這意味著來自引入" diff --git a/faq/windows.po b/faq/windows.po index a0659bea13..b46fe34cdc 100644 --- a/faq/windows.po +++ b/faq/windows.po @@ -150,10 +150,10 @@ msgstr "" #: ../../faq/windows.rst:84 msgid "" "Many people use the interactive mode as a convenient yet highly programmable " -"calculator. When you want to end your interactive Python session, call the :" -"func:`exit` function or hold the :kbd:`Ctrl` key down while you enter a :kbd:" -"`Z`, then hit the \":kbd:`Enter`\" key to get back to your Windows command " -"prompt." +"calculator. When you want to end your interactive Python session, call " +"the :func:`exit` function or hold the :kbd:`Ctrl` key down while you enter " +"a :kbd:`Z`, then hit the \":kbd:`Enter`\" key to get back to your Windows " +"command prompt." msgstr "" "許多人將互動模式作為方便但可高度程式化的計算機。如果你要結束互動式 Python 對" "話,請呼叫 :func:`exit` 函式或是按住 :kbd:`Ctrl` 鍵再輸入 :kbd:`Z`,然後按下 " @@ -161,12 +161,12 @@ msgstr "" #: ../../faq/windows.rst:90 msgid "" -"You may also find that you have a Start-menu entry such as :menuselection:" -"`Start --> Programs --> Python 3.x --> Python (command line)` that results " -"in you seeing the ``>>>`` prompt in a new window. If so, the window will " -"disappear after you call the :func:`exit` function or enter the :kbd:`Ctrl-" -"Z` character; Windows is running a single \"python\" command in the window, " -"and closes it when you terminate the interpreter." +"You may also find that you have a Start-menu entry such " +"as :menuselection:`Start --> Programs --> Python 3.x --> Python (command " +"line)` that results in you seeing the ``>>>`` prompt in a new window. If " +"so, the window will disappear after you call the :func:`exit` function or " +"enter the :kbd:`Ctrl-Z` character; Windows is running a single \"python\" " +"command in the window, and closes it when you terminate the interpreter." msgstr "" "你可能還會發現你有一個開始功能表項目,像是::menuselection:`開始 --> 所有程" "式 --> Python 3.x --> Python(命令行)`,它會讓你在一個新視窗中看到 ``>>>`` " @@ -221,11 +221,11 @@ msgid "" "typing 'foo' with no extension you need to add .py to the PATHEXT " "environment variable." msgstr "" -"在 Windows 上,標準的 Python 安裝程式已將 .py 副檔名與一種檔案類型 (Python." -"File) 進行關聯,並為該檔案類型提供一個開啟命令來運行直譯器 (``D:\\Program " -"Files\\Python\\python.exe \"%1\" %*``)。這足以使腳本能以類似 'foo.py' 的形式" -"從命令提示字元被執行。如果你希望能夠簡單地輸入 'foo' 來執行腳本,而不用加上副" -"檔名,則需要將 .py 新增至 PATHEXT 環境變數中。" +"在 Windows 上,標準的 Python 安裝程式已將 .py 副檔名與一種檔案類型 " +"(Python.File) 進行關聯,並為該檔案類型提供一個開啟命令來運行直譯器 (``D:" +"\\Program Files\\Python\\python.exe \"%1\" %*``)。這足以使腳本能以類似 " +"'foo.py' 的形式從命令提示字元被執行。如果你希望能夠簡單地輸入 'foo' 來執行腳" +"本,而不用加上副檔名,則需要將 .py 新增至 PATHEXT 環境變數中。" #: ../../faq/windows.rst:124 msgid "Why does Python sometimes take so long to start?" @@ -285,8 +285,8 @@ msgstr "" "是的,.pyd 檔類似於 dll,但也有一些區別。如果你有一個名為 ``foo.pyd`` 的 " "DLL,則它必須具有函式 ``PyInit_foo()``。接著你可以將 \"import foo\" 寫入 " "Python 腳本,Python 將會搜尋 foo.pyd(以及 foo.py、foo.pyc),如果 Python 找" -"到它,將會嘗試呼叫 ``PyInit_foo()`` 來將它初始化。你並不會將你的 .exe 與 foo." -"lib 連結 (link),因為這會導致 Windows 要求 DLL 的存在。" +"到它,將會嘗試呼叫 ``PyInit_foo()`` 來將它初始化。你並不會將你的 .exe 與 " +"foo.lib 連結 (link),因為這會導致 Windows 要求 DLL 的存在。" #: ../../faq/windows.rst:157 msgid "" @@ -318,9 +318,10 @@ msgstr "在 Windows 應用程式中嵌入 Python 直譯器的過程可以總結 msgid "" "Do **not** build Python into your .exe file directly. On Windows, Python " "must be a DLL to handle importing modules that are themselves DLL's. (This " -"is the first key undocumented fact.) Instead, link to :file:`python{NN}." -"dll`; it is typically installed in ``C:\\Windows\\System``. *NN* is the " -"Python version, a number such as \"33\" for Python 3.3." +"is the first key undocumented fact.) Instead, link " +"to :file:`python{NN}.dll`; it is typically installed in ``C:" +"\\Windows\\System``. *NN* is the Python version, a number such as \"33\" " +"for Python 3.3." msgstr "" "**不要**\\ 直接將 Python 建置到你的 .exe 檔中。在 Windows 上,Python 必須是一" "個 DLL 來處理模組的 import,而那些模組本身也是 DLL。(這是第一個未正式記載的" @@ -337,8 +338,9 @@ msgid "" msgstr "" "你可以透過兩種不同的方式連結到 Python。載入時連結 (load-time linking) 表示要" "連結到 :file:`python{NN}.lib`,而執行環境連結 (run-time linking) 表示要連結" -"到 :file:`python{NN}.dll`。(一般註解::file:`python{NN}.lib` 是 :file:" -"`python{NN}.dll` 相對應的所謂 \"import lib\"。它只會為鏈接器定義符號。)" +"到 :file:`python{NN}.dll`。(一般註解::file:`python{NN}.lib` " +"是 :file:`python{NN}.dll` 相對應的所謂 \"import lib\"。它只會為鏈接器定義符" +"號。)" #: ../../faq/windows.rst:182 msgid "" @@ -352,9 +354,9 @@ msgid "" msgstr "" "執行環境連結大大簡化了連結選項;所有事情都會發生在執行環境。你的程式碼必須使" "用 Windows ``LoadLibraryEx()`` 常式 (routine) 來載入 :file:`python{NN}.dll`。" -"該程式碼也必須用 Windows ``GetProcAddress()`` 常式所取得的指標,來使用 :file:" -"`python{NN}.dll` 中的(即為 Python C API 的)存取常式和資料。對於任何呼叫 " -"Python C API 常式的 C 程式碼,巨集可以讓使用這些指標的過程透明化。" +"該程式碼也必須用 Windows ``GetProcAddress()`` 常式所取得的指標,來使" +"用 :file:`python{NN}.dll` 中的(即為 Python C API 的)存取常式和資料。對於任" +"何呼叫 Python C API 常式的 C 程式碼,巨集可以讓使用這些指標的過程透明化。" #: ../../faq/windows.rst:191 msgid "" @@ -498,10 +500,10 @@ msgstr "" #: ../../faq/windows.rst:262 msgid "" "Under any editor, mixing tabs and spaces is a bad idea. MSVC is no " -"different in this respect, and is easily configured to use spaces: Take :" -"menuselection:`Tools --> Options --> Tabs`, and for file type \"Default\" " -"set \"Tab size\" and \"Indent size\" to 4, and select the \"Insert spaces\" " -"radio button." +"different in this respect, and is easily configured to use spaces: " +"Take :menuselection:`Tools --> Options --> Tabs`, and for file type " +"\"Default\" set \"Tab size\" and \"Indent size\" to 4, and select the " +"\"Insert spaces\" radio button." msgstr "" "在任何編輯器下,將 tab 和空格混合都是一個壞主意。MSVC 在這方面也是一樣,且可" "以輕鬆配置為使用空格:選擇\\ :menuselection:`工具 --> 選項 --> Tabs`,然後對" @@ -511,12 +513,12 @@ msgstr "" #: ../../faq/windows.rst:267 msgid "" "Python raises :exc:`IndentationError` or :exc:`TabError` if mixed tabs and " -"spaces are causing problems in leading whitespace. You may also run the :mod:" -"`tabnanny` module to check a directory tree in batch mode." +"spaces are causing problems in leading whitespace. You may also run " +"the :mod:`tabnanny` module to check a directory tree in batch mode." msgstr "" -"如果混合 tab 和空格造成前導空白字元出現問題,則 Python 會引發 :exc:" -"`IndentationError` 或 :exc:`TabError`。你也可以運行 :mod:`tabnanny` 模組,在" -"批次模式下檢查目錄樹。" +"如果混合 tab 和空格造成前導空白字元出現問題,則 Python 會引" +"發 :exc:`IndentationError` 或 :exc:`TabError`。你也可以運行 :mod:`tabnanny` " +"模組,在批次模式下檢查目錄樹。" #: ../../faq/windows.rst:274 msgid "How do I check for a keypress without blocking?" @@ -549,12 +551,6 @@ msgstr "" "解決問題,請造訪 `Microsoft 支援頁面 <https://support.microsoft.com/en-us/" "help/3118401/>`_\\ 以取得關於手動安裝 C Runtime 更新的指南。" -#~ msgid "or::" -#~ msgstr "" -#~ "或是:\n" -#~ "\n" -#~ "::" - #~ msgid "" #~ "This series of screencasts aims to get you up and running with Python on " #~ "Windows XP. The knowledge is distilled into 1.5 hours and will get you " diff --git a/glossary.po b/glossary.po index b32a80087a..df20e8a0a7 100644 --- a/glossary.po +++ b/glossary.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-21 00:13+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1633,16 +1633,16 @@ msgid "" "iterables include all sequence types (such as :class:`list`, :class:`str`, " "and :class:`tuple`) and some non-sequence types " "like :class:`dict`, :term:`file objects <file object>`, and objects of any " -"classes you define with an :meth:`~iterator.__iter__` method or with " +"classes you define with an :meth:`~object.__iter__` method or with " "a :meth:`~object.__getitem__` method that implements :term:`sequence` " "semantics." msgstr "" "一種能夠一次回傳一個其中成員的物件。可疊代物件的例子包括所有的序列型別(像" "是 :class:`list`、:class:`str` 和 :class:`tuple`\\ )和某些非序列型別,像" "是 :class:`dict`、:term:`檔案物件 <file object>`,以及你所定義的任何 class 物" -"件,只要那些 class 有 :meth:`~iterator.__iter__` method 或是實" -"作 :term:`sequence`\\ (序列)語意的 :meth:`~object.__getitem__` method,該物" -"件就是可疊代物件。" +"件,只要那些 class 有實作 :term:`sequence`\\ (序列)語意" +"的 :meth:`~object.__iter__` 或是 :meth:`~object.__getitem__` method,該物件就" +"是可疊代物件。" #: ../../glossary.rst:713 msgid "" @@ -1761,7 +1761,7 @@ msgstr "" msgid "keyword argument" msgstr "keyword argument(關鍵字引數)" -#: ../../glossary.rst:771 ../../glossary.rst:1077 +#: ../../glossary.rst:771 ../../glossary.rst:1086 msgid "See :term:`argument`." msgstr "請參閱 :term:`argument`\\ (引數)。" @@ -1809,10 +1809,18 @@ msgstr "" "解決。" #: ../../glossary.rst:789 +msgid "lexical analyzer" +msgstr "" + +#: ../../glossary.rst:792 +msgid "Formal name for the *tokenizer*; see :term:`token`." +msgstr "" + +#: ../../glossary.rst:793 msgid "list" msgstr "list(串列)" -#: ../../glossary.rst:791 +#: ../../glossary.rst:795 msgid "" "A built-in Python :term:`sequence`. Despite its name it is more akin to an " "array in other languages than to a linked list since access to elements is " @@ -1822,11 +1830,11 @@ msgstr "" "似其他語言中的一個陣列 (array) 而較不像一個鏈結串列 (linked list),因為存取元" "素的時間複雜度是 *O*\\ (1)。" -#: ../../glossary.rst:794 +#: ../../glossary.rst:798 msgid "list comprehension" msgstr "list comprehension(串列綜合運算)" -#: ../../glossary.rst:796 +#: ../../glossary.rst:800 msgid "" "A compact way to process all or part of the elements in a sequence and " "return a list with the results. ``result = ['{:#04x}'.format(x) for x in " @@ -1840,11 +1848,11 @@ msgstr "" "(0x..)。:keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有" "元素都會被處理。" -#: ../../glossary.rst:802 +#: ../../glossary.rst:806 msgid "loader" msgstr "loader(載入器)" -#: ../../glossary.rst:804 +#: ../../glossary.rst:808 msgid "" "An object that loads a module. It must define the :meth:`!exec_module` " "and :meth:`!create_module` methods to implement " @@ -1855,23 +1863,23 @@ msgstr "" "create_module` 方法以實作 :class:`~importlib.abc.Loader` 介面。載入器通常是" "被 :term:`finder`\\ (尋檢器)回傳。更多細節請參閱:" -#: ../../glossary.rst:810 +#: ../../glossary.rst:814 msgid ":ref:`finders-and-loaders`" msgstr ":ref:`finders-and-loaders`" -#: ../../glossary.rst:811 +#: ../../glossary.rst:815 msgid ":class:`importlib.abc.Loader`" msgstr ":class:`importlib.abc.Loader`" -#: ../../glossary.rst:812 +#: ../../glossary.rst:816 msgid ":pep:`302`" msgstr ":pep:`302`" -#: ../../glossary.rst:813 +#: ../../glossary.rst:817 msgid "locale encoding" msgstr "locale encoding(區域編碼)" -#: ../../glossary.rst:815 +#: ../../glossary.rst:819 msgid "" "On Unix, it is the encoding of the LC_CTYPE locale. It can be set " "with :func:`locale.setlocale(locale.LC_CTYPE, new_locale) " @@ -1881,36 +1889,36 @@ msgstr "" "用 :func:`locale.setlocale(locale.LC_CTYPE, new_locale) <locale.setlocale>` " "來設定。" -#: ../../glossary.rst:818 +#: ../../glossary.rst:822 msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." msgstr "在 Windows 上,它是 ANSI 代碼頁(code page,例如 ``\"cp1252\"``\\ )。" -#: ../../glossary.rst:820 +#: ../../glossary.rst:824 msgid "" "On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." msgstr "在 Android 和 VxWorks 上,Python 使用 ``\"utf-8\"`` 作為區域編碼。" -#: ../../glossary.rst:822 +#: ../../glossary.rst:826 msgid ":func:`locale.getencoding` can be used to get the locale encoding." msgstr ":func:`locale.getencoding` 可以用來取得區域編碼。" -#: ../../glossary.rst:824 +#: ../../glossary.rst:828 msgid "See also the :term:`filesystem encoding and error handler`." msgstr "也請參考 :term:`filesystem encoding and error handler`。" -#: ../../glossary.rst:825 +#: ../../glossary.rst:829 msgid "magic method" msgstr "magic method(魔術方法)" -#: ../../glossary.rst:829 +#: ../../glossary.rst:833 msgid "An informal synonym for :term:`special method`." msgstr ":term:`special method`\\ (特殊方法)的一個非正式同義詞。" -#: ../../glossary.rst:830 +#: ../../glossary.rst:834 msgid "mapping" msgstr "mapping(對映)" -#: ../../glossary.rst:832 +#: ../../glossary.rst:836 msgid "" "A container object that supports arbitrary key lookups and implements the " "methods specified in the :class:`collections.abc.Mapping` " @@ -1926,11 +1934,11 @@ msgstr "" "括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections.OrderedDict` " "和 :class:`collections.Counter`。" -#: ../../glossary.rst:838 +#: ../../glossary.rst:842 msgid "meta path finder" msgstr "meta path finder(元路徑尋檢器)" -#: ../../glossary.rst:840 +#: ../../glossary.rst:844 msgid "" "A :term:`finder` returned by a search of :data:`sys.meta_path`. Meta path " "finders are related to, but different from :term:`path entry finders <path " @@ -1940,18 +1948,18 @@ msgstr "" "徑尋檢器與\\ :term:`路徑項目尋檢器 (path entry finder) <path entry finder>` " "相關但是不同。" -#: ../../glossary.rst:844 +#: ../../glossary.rst:848 msgid "" "See :class:`importlib.abc.MetaPathFinder` for the methods that meta path " "finders implement." msgstr "" "關於元路徑尋檢器實作的 method,請參閱 :class:`importlib.abc.MetaPathFinder`。" -#: ../../glossary.rst:846 +#: ../../glossary.rst:850 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../glossary.rst:848 +#: ../../glossary.rst:852 msgid "" "The class of a class. Class definitions create a class name, a class " "dictionary, and a list of base classes. The metaclass is responsible for " @@ -1971,15 +1979,15 @@ msgstr "" "性存取、增加執行緒安全性、追蹤物件建立、實作單例模式 (singleton),以及許多其" "他的任務。" -#: ../../glossary.rst:858 +#: ../../glossary.rst:862 msgid "More information can be found in :ref:`metaclasses`." msgstr "更多資訊可以在\\ :ref:`metaclasses`\\ 章節中找到。" -#: ../../glossary.rst:827 ../../glossary.rst:859 ../../glossary.rst:1222 +#: ../../glossary.rst:831 ../../glossary.rst:863 ../../glossary.rst:1231 msgid "method" msgstr "method(方法)" -#: ../../glossary.rst:861 +#: ../../glossary.rst:865 msgid "" "A function which is defined inside a class body. If called as an attribute " "of an instance of that class, the method will get the instance object as its " @@ -1991,11 +1999,11 @@ msgstr "" "通常被稱為 ``self``)。請參閱 :term:`function`\\ (函式)和 :term:`nested " "scope`\\ (巢狀作用域)。" -#: ../../glossary.rst:865 +#: ../../glossary.rst:869 msgid "method resolution order" msgstr "method resolution order(方法解析順序)" -#: ../../glossary.rst:867 +#: ../../glossary.rst:871 msgid "" "Method Resolution Order is the order in which base classes are searched for " "a member during lookup. See :ref:`python_2.3_mro` for details of the " @@ -2004,11 +2012,11 @@ msgstr "" "方法解析順序是在查找某個成員的過程中,base class(基底類別)被搜尋的順序。關" "於 Python 自 2.3 版直譯器所使用的演算法細節,請參閱 :ref:`python_2.3_mro`。" -#: ../../glossary.rst:870 +#: ../../glossary.rst:874 msgid "module" msgstr "module(模組)" -#: ../../glossary.rst:872 +#: ../../glossary.rst:876 msgid "" "An object that serves as an organizational unit of Python code. Modules " "have a namespace containing arbitrary Python objects. Modules are loaded " @@ -2018,15 +2026,15 @@ msgstr "" "空間,它包含任意的 Python 物件。模組是藉由 :term:`importing` 的過程,被載入" "至 Python。" -#: ../../glossary.rst:876 +#: ../../glossary.rst:880 msgid "See also :term:`package`." msgstr "另請參閱 :term:`package`\\ (套件)。" -#: ../../glossary.rst:877 +#: ../../glossary.rst:881 msgid "module spec" msgstr "module spec(模組規格)" -#: ../../glossary.rst:879 +#: ../../glossary.rst:883 msgid "" "A namespace containing the import-related information used to load a module. " "An instance of :class:`importlib.machinery.ModuleSpec`." @@ -2034,23 +2042,23 @@ msgstr "" "一個命名空間,它包含用於載入模組的 import 相關資訊。它" "是 :class:`importlib.machinery.ModuleSpec` 的一個實例。" -#: ../../glossary.rst:882 +#: ../../glossary.rst:886 msgid "See also :ref:`module-specs`." msgstr "另請參閱 :ref:`module-specs`。" -#: ../../glossary.rst:883 +#: ../../glossary.rst:887 msgid "MRO" msgstr "MRO" -#: ../../glossary.rst:885 +#: ../../glossary.rst:889 msgid "See :term:`method resolution order`." msgstr "請參閱 :term:`method resolution order`\\ (方法解析順序)。" -#: ../../glossary.rst:886 +#: ../../glossary.rst:890 msgid "mutable" msgstr "mutable(可變物件)" -#: ../../glossary.rst:888 +#: ../../glossary.rst:892 msgid "" "Mutable objects can change their value but keep their :func:`id`. See " "also :term:`immutable`." @@ -2058,11 +2066,11 @@ msgstr "" "可變物件可以改變它們的值,但維持它們的 :func:`id`。另請參" "閱 :term:`immutable`\\ (不可變物件)。" -#: ../../glossary.rst:890 +#: ../../glossary.rst:894 msgid "named tuple" msgstr "named tuple(附名元組)" -#: ../../glossary.rst:892 +#: ../../glossary.rst:896 msgid "" "The term \"named tuple\" applies to any type or class that inherits from " "tuple and whose indexable elements are also accessible using named " @@ -2072,7 +2080,7 @@ msgstr "" "索引 (indexable) 元素也可以用附名屬性來存取。這些型別或 class 也可以具有其他" "的特性。" -#: ../../glossary.rst:896 +#: ../../glossary.rst:900 msgid "" "Several built-in types are named tuples, including the values returned " "by :func:`time.localtime` and :func:`os.stat`. Another example " @@ -2081,7 +2089,7 @@ msgstr "" "有些內建型別是 named tuple,包括由 :func:`time.localtime` 和 :func:`os.stat` " "回傳的值。另一個例子是 :data:`sys.float_info`: ::" -#: ../../glossary.rst:900 +#: ../../glossary.rst:904 msgid "" ">>> sys.float_info[1] # indexed access\n" "1024\n" @@ -2091,7 +2099,7 @@ msgid "" "True" msgstr "" -#: ../../glossary.rst:907 +#: ../../glossary.rst:911 msgid "" "Some named tuples are built-in types (such as the above examples). " "Alternatively, a named tuple can be created from a regular class definition " @@ -2109,11 +2117,11 @@ msgstr "" "function) :func:`collections.namedtuple` 來建立。後者技術也增加了一些額外的 " "method,這些 method 可能是在手寫或內建的 named tuple 中,無法找到的。" -#: ../../glossary.rst:915 +#: ../../glossary.rst:919 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../glossary.rst:917 +#: ../../glossary.rst:921 msgid "" "The place where a variable is stored. Namespaces are implemented as " "dictionaries. There are the local, global and built-in namespaces as well " @@ -2134,31 +2142,43 @@ msgstr "" "出 :func:`random.seed` 或 :func:`itertools.islice` 明確地表示,這些函式分別是" "由 :mod:`random` 和 :mod:`itertools` 模組在實作。" -#: ../../glossary.rst:927 +#: ../../glossary.rst:931 msgid "namespace package" msgstr "namespace package(命名空間套件)" -#: ../../glossary.rst:929 +#: ../../glossary.rst:933 msgid "" -"A :pep:`420` :term:`package` which serves only as a container for " -"subpackages. Namespace packages may have no physical representation, and " -"specifically are not like a :term:`regular package` because they have no " -"``__init__.py`` file." +"A :term:`package` which serves only as a container for subpackages. " +"Namespace packages may have no physical representation, and specifically are " +"not like a :term:`regular package` because they have no ``__init__.py`` file." +msgstr "" +"一個 :term:`package`\\ (套件),它只能作為子套件 (subpackage) 的一個容器。命" +"名空間套件可能沒有實體的表示法,而且具體來說它們不像是一個 :term:`regular " +"package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這個檔案。" + +#: ../../glossary.rst:938 +msgid "" +"Namespace packages allow several individually installable packages to have a " +"common parent package. Otherwise, it is recommended to use a :term:`regular " +"package`." msgstr "" -"一個 :pep:`420` :term:`package`\\ (套件),它只能作為子套件 (subpackage) 的" -"一個容器。命名空間套件可能沒有實體的表示法,而且具體來說它們不像是一" -"個 :term:`regular package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這" -"個檔案。" +"命名空間套件允許數個可獨立安裝的套件擁有一個共同的父套件。除此之外,建議使" +"用 :term:`regular package`。" -#: ../../glossary.rst:934 +#: ../../glossary.rst:941 +msgid "" +"For more information, see :pep:`420` and :ref:`reference-namespace-package`." +msgstr "更多資訊,請參閱 :pep:`420` 和 :ref:`reference-namespace-package`。" + +#: ../../glossary.rst:943 msgid "See also :term:`module`." msgstr "另請參閱 :term:`module`\\ (模組)。" -#: ../../glossary.rst:935 +#: ../../glossary.rst:944 msgid "nested scope" msgstr "nested scope(巢狀作用域)" -#: ../../glossary.rst:937 +#: ../../glossary.rst:946 msgid "" "The ability to refer to a variable in an enclosing definition. For " "instance, a function defined inside another function can refer to variables " @@ -2173,11 +2193,11 @@ msgstr "" "寫入。同樣地,全域變數是在全域命名空間中讀取及寫入。:keyword:`nonlocal` 容許" "對外層作用域進行寫入。" -#: ../../glossary.rst:944 +#: ../../glossary.rst:953 msgid "new-style class" msgstr "new-style class(新式類別)" -#: ../../glossary.rst:946 +#: ../../glossary.rst:955 msgid "" "Old name for the flavor of classes now used for all class objects. In " "earlier Python versions, only new-style classes could use Python's newer, " @@ -2191,11 +2211,11 @@ msgstr "" "(property)、:meth:`~object.__getattribute__`、class method(類別方法)和 " "static method(靜態方法)。" -#: ../../glossary.rst:951 +#: ../../glossary.rst:960 msgid "object" msgstr "object(物件)" -#: ../../glossary.rst:953 +#: ../../glossary.rst:962 msgid "" "Any data with state (attributes or value) and defined behavior (methods). " "Also the ultimate base class of any :term:`new-style class`." @@ -2203,11 +2223,11 @@ msgstr "" "具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任" "何 :term:`new-style class`\\ (新式類別)的最終 base class(基底類別)。" -#: ../../glossary.rst:956 +#: ../../glossary.rst:965 msgid "optimized scope" msgstr "optimized scope(最佳化作用域)" -#: ../../glossary.rst:958 +#: ../../glossary.rst:967 msgid "" "A scope where target local variable names are reliably known to the compiler " "when the code is compiled, allowing optimization of read and write access to " @@ -2218,11 +2238,11 @@ msgid "" "to optimized scopes." msgstr "" -#: ../../glossary.rst:965 +#: ../../glossary.rst:974 msgid "package" msgstr "package(套件)" -#: ../../glossary.rst:967 +#: ../../glossary.rst:976 msgid "" "A Python :term:`module` which can contain submodules or recursively, " "subpackages. Technically, a package is a Python module with a ``__path__`` " @@ -2232,17 +2252,17 @@ msgstr "" "迴的子套件 (subpackage)。技術上而言,套件就是具有 ``__path__`` 屬性的一個 " "Python 模組。" -#: ../../glossary.rst:971 +#: ../../glossary.rst:980 msgid "See also :term:`regular package` and :term:`namespace package`." msgstr "" "另請參閱 :term:`regular package`\\ (正規套件)和 :term:`namespace " "package`\\ (命名空間套件)。" -#: ../../glossary.rst:972 +#: ../../glossary.rst:981 msgid "parameter" msgstr "parameter(參數)" -#: ../../glossary.rst:974 +#: ../../glossary.rst:983 msgid "" "A named entity in a :term:`function` (or method) definition that specifies " "an :term:`argument` (or in some cases, arguments) that the function can " @@ -2252,7 +2272,7 @@ msgstr "" "它指明該函式能夠接受的一個 :term:`argument`\\ (引數),或在某些情況下指示多" "個引數。共有有五種不同的參數類型:" -#: ../../glossary.rst:978 +#: ../../glossary.rst:987 msgid "" ":dfn:`positional-or-keyword`: specifies an argument that can be passed " "either :term:`positionally <argument>` or as a :term:`keyword argument " @@ -2263,11 +2283,11 @@ msgstr "" "置 <argument>`\\ 或是作為\\ :term:`關鍵字引數 <argument>`\\ 被傳遞的引數。這" "是參數的預設類型,例如以下的 *foo* 和 *bar*: ::" -#: ../../glossary.rst:983 +#: ../../glossary.rst:992 msgid "def func(foo, bar=None): ..." msgstr "def func(foo, bar=None): ..." -#: ../../glossary.rst:987 +#: ../../glossary.rst:996 msgid "" ":dfn:`positional-only`: specifies an argument that can be supplied only by " "position. Positional-only parameters can be defined by including a ``/`` " @@ -2278,11 +2298,11 @@ msgstr "" "式定義的參數列表中包含一個 ``/`` 字元,就可以在該字元前面定義僅限位置參數,例" "如以下的 *posonly1* 和 *posonly2*: ::" -#: ../../glossary.rst:992 +#: ../../glossary.rst:1001 msgid "def func(posonly1, posonly2, /, positional_or_keyword): ..." msgstr "def func(posonly1, posonly2, /, positional_or_keyword): ..." -#: ../../glossary.rst:996 +#: ../../glossary.rst:1005 msgid "" ":dfn:`keyword-only`: specifies an argument that can be supplied only by " "keyword. Keyword-only parameters can be defined by including a single var-" @@ -2295,11 +2315,11 @@ msgstr "" "單純的 ``*`` 字元,就可以在其後方定義僅限關鍵字參數,例如以下的 *kw_only1* " "和 *kw_only2*: ::" -#: ../../glossary.rst:1002 +#: ../../glossary.rst:1011 msgid "def func(arg, *, kw_only1, kw_only2): ..." msgstr "def func(arg, *, kw_only1, kw_only2): ..." -#: ../../glossary.rst:1004 +#: ../../glossary.rst:1013 msgid "" ":dfn:`var-positional`: specifies that an arbitrary sequence of positional " "arguments can be provided (in addition to any positional arguments already " @@ -2311,11 +2331,11 @@ msgstr "" "數(在已被其他參數接受的任何位置引數之外)。這類參數是透過在其參數名稱字首加" "上 ``*`` 來定義的,例如以下的 *args*: ::" -#: ../../glossary.rst:1010 +#: ../../glossary.rst:1019 msgid "def func(*args, **kwargs): ..." msgstr "def func(*args, **kwargs): ..." -#: ../../glossary.rst:1012 +#: ../../glossary.rst:1021 msgid "" ":dfn:`var-keyword`: specifies that arbitrarily many keyword arguments can be " "provided (in addition to any keyword arguments already accepted by other " @@ -2326,14 +2346,14 @@ msgstr "" "已被其他參數接受的任何關鍵字引數之外)。這類參數是透過在其參數名稱字首加上 " "``**`` 來定義的,例如上面範例中的 *kwargs*。" -#: ../../glossary.rst:1018 +#: ../../glossary.rst:1027 msgid "" "Parameters can specify both optional and required arguments, as well as " "default values for some optional arguments." msgstr "" "參數可以指明引數是選擇性的或必需的,也可以為一些選擇性的引數指定預設值。" -#: ../../glossary.rst:1021 +#: ../../glossary.rst:1030 msgid "" "See also the :term:`argument` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters <faq-argument-vs-parameter>`, " @@ -2344,11 +2364,11 @@ msgstr "" "參數之間的差異 <faq-argument-vs-parameter>`、:class:`inspect.Parameter` " "class、:ref:`function`\\ 章節,以及 :pep:`362`。" -#: ../../glossary.rst:1025 +#: ../../glossary.rst:1034 msgid "path entry" msgstr "path entry(路徑項目)" -#: ../../glossary.rst:1027 +#: ../../glossary.rst:1036 msgid "" "A single location on the :term:`import path` which the :term:`path based " "finder` consults to find modules for importing." @@ -2356,11 +2376,11 @@ msgstr "" "在 :term:`import path`\\ (引入路徑)中的一個位置,而 :term:`path based " "finder` (基於路徑的尋檢器)會參考該位置來尋找要 import 的模組。" -#: ../../glossary.rst:1029 +#: ../../glossary.rst:1038 msgid "path entry finder" msgstr "path entry finder(路徑項目尋檢器)" -#: ../../glossary.rst:1031 +#: ../../glossary.rst:1040 msgid "" "A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. " "a :term:`path entry hook`) which knows how to locate modules given " @@ -2370,7 +2390,7 @@ msgstr "" "個 :term:`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一" "個 :term:`path entry`\\ 定位模組。" -#: ../../glossary.rst:1035 +#: ../../glossary.rst:1044 msgid "" "See :class:`importlib.abc.PathEntryFinder` for the methods that path entry " "finders implement." @@ -2378,11 +2398,11 @@ msgstr "" "關於路徑項目尋檢器實作的 method,請參" "閱 :class:`importlib.abc.PathEntryFinder`。" -#: ../../glossary.rst:1037 +#: ../../glossary.rst:1046 msgid "path entry hook" msgstr "path entry hook(路徑項目鉤)" -#: ../../glossary.rst:1039 +#: ../../glossary.rst:1048 msgid "" "A callable on the :data:`sys.path_hooks` list which returns a :term:`path " "entry finder` if it knows how to find modules on a specific :term:`path " @@ -2392,11 +2412,11 @@ msgstr "" "個特定的 :term:`path entry` 中尋找模組,則會回傳一個 :term:`path entry " "finder`\\ (路徑項目尋檢器)。" -#: ../../glossary.rst:1042 +#: ../../glossary.rst:1051 msgid "path based finder" msgstr "path based finder(基於路徑的尋檢器)" -#: ../../glossary.rst:1044 +#: ../../glossary.rst:1053 msgid "" "One of the default :term:`meta path finders <meta path finder>` which " "searches an :term:`import path` for modules." @@ -2404,11 +2424,11 @@ msgstr "" "預設的\\ :term:`元路徑尋檢器 (meta path finder) <meta path finder>` 之一,它" "會在一個 :term:`import path` 中搜尋模組。" -#: ../../glossary.rst:1046 +#: ../../glossary.rst:1055 msgid "path-like object" msgstr "path-like object(類路徑物件)" -#: ../../glossary.rst:1048 +#: ../../glossary.rst:1057 msgid "" "An object representing a file system path. A path-like object is either " "a :class:`str` or :class:`bytes` object representing a path, or an object " @@ -2426,11 +2446,11 @@ msgstr "" "及 :func:`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結" "果。由 :pep:`519` 引入。" -#: ../../glossary.rst:1056 +#: ../../glossary.rst:1065 msgid "PEP" msgstr "PEP" -#: ../../glossary.rst:1058 +#: ../../glossary.rst:1067 msgid "" "Python Enhancement Proposal. A PEP is a design document providing " "information to the Python community, or describing a new feature for Python " @@ -2441,7 +2461,7 @@ msgstr "" "為 Python 社群提供資訊,或是描述 Python 的一個新功能或該功能的程序和環境。" "PEP 應該要提供簡潔的技術規範以及被提案功能的運作原理。" -#: ../../glossary.rst:1064 +#: ../../glossary.rst:1073 msgid "" "PEPs are intended to be the primary mechanisms for proposing major new " "features, for collecting community input on an issue, and for documenting " @@ -2453,15 +2473,15 @@ msgstr "" "已納入 Python 的設計決策的記錄,這些過程的主要機制。PEP 的作者要負責在社群內" "建立共識並記錄反對意見。" -#: ../../glossary.rst:1070 +#: ../../glossary.rst:1079 msgid "See :pep:`1`." msgstr "請參閱 :pep:`1`。" -#: ../../glossary.rst:1071 +#: ../../glossary.rst:1080 msgid "portion" msgstr "portion(部分)" -#: ../../glossary.rst:1073 +#: ../../glossary.rst:1082 msgid "" "A set of files in a single directory (possibly stored in a zip file) that " "contribute to a namespace package, as defined in :pep:`420`." @@ -2469,15 +2489,15 @@ msgstr "" "在單一目錄中的一組檔案(也可能儲存在一個 zip 檔中),這些檔案能對一個命名空間" "套件 (namespace package) 有所貢獻,如同 :pep:`420` 中的定義。" -#: ../../glossary.rst:1075 +#: ../../glossary.rst:1084 msgid "positional argument" msgstr "positional argument(位置引數)" -#: ../../glossary.rst:1078 +#: ../../glossary.rst:1087 msgid "provisional API" msgstr "provisional API(暫行 API)" -#: ../../glossary.rst:1080 +#: ../../glossary.rst:1089 msgid "" "A provisional API is one which has been deliberately excluded from the " "standard library's backwards compatibility guarantees. While major changes " @@ -2493,7 +2513,7 @@ msgstr "" "該介面)。這種變更並不會無端地產生——只有 API 被納入之前未察覺的嚴重基本缺陷被" "揭露時,它們才會發生。" -#: ../../glossary.rst:1089 +#: ../../glossary.rst:1098 msgid "" "Even for provisional APIs, backwards incompatible changes are seen as a " "\"solution of last resort\" - every attempt will still be made to find a " @@ -2502,7 +2522,7 @@ msgstr "" "即使對於暫行 API,向後不相容的變更也會被視為「最後的解決方案」——對於任何被發" "現的問題,仍然會盡可能找出一個向後相容的解決方案。" -#: ../../glossary.rst:1093 +#: ../../glossary.rst:1102 msgid "" "This process allows the standard library to continue to evolve over time, " "without locking in problematic design errors for extended periods of time. " @@ -2511,19 +2531,19 @@ msgstr "" "這個過程使得標準函式庫能隨著時間不斷進化,而避免耗費過長的時間去鎖定有問題的" "設計錯誤。請參閱 :pep:`411` 了解更多細節。" -#: ../../glossary.rst:1096 +#: ../../glossary.rst:1105 msgid "provisional package" msgstr "provisional package(暫行套件)" -#: ../../glossary.rst:1098 +#: ../../glossary.rst:1107 msgid "See :term:`provisional API`." msgstr "請參閱 :term:`provisional API`\\ (暫行 API)。" -#: ../../glossary.rst:1099 +#: ../../glossary.rst:1108 msgid "Python 3000" msgstr "Python 3000" -#: ../../glossary.rst:1101 +#: ../../glossary.rst:1110 msgid "" "Nickname for the Python 3.x release line (coined long ago when the release " "of version 3 was something in the distant future.) This is also abbreviated " @@ -2532,11 +2552,11 @@ msgstr "" "Python 3.x 系列版本的暱稱(很久以前創造的,當時第 3 版的發布是在遙遠的未" "來。)也可以縮寫為「Py3k」。" -#: ../../glossary.rst:1104 +#: ../../glossary.rst:1113 msgid "Pythonic" msgstr "Pythonic(Python 風格的)" -#: ../../glossary.rst:1106 +#: ../../glossary.rst:1115 msgid "" "An idea or piece of code which closely follows the most common idioms of the " "Python language, rather than implementing code using concepts common to " @@ -2550,7 +2570,7 @@ msgstr "" "個 :keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並" "沒有這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" -#: ../../glossary.rst:1113 +#: ../../glossary.rst:1122 msgid "" "for i in range(len(food)):\n" " print(food[i])" @@ -2558,11 +2578,11 @@ msgstr "" "for i in range(len(food)):\n" " print(food[i])" -#: ../../glossary.rst:1116 +#: ../../glossary.rst:1125 msgid "As opposed to the cleaner, Pythonic method::" msgstr "相較之下,以下方法更簡潔、更具有 Python 風格: ::" -#: ../../glossary.rst:1118 +#: ../../glossary.rst:1127 msgid "" "for piece in food:\n" " print(piece)" @@ -2570,11 +2590,11 @@ msgstr "" "for piece in food:\n" " print(piece)" -#: ../../glossary.rst:1120 +#: ../../glossary.rst:1129 msgid "qualified name" msgstr "qualified name(限定名稱)" -#: ../../glossary.rst:1122 +#: ../../glossary.rst:1131 msgid "" "A dotted name showing the \"path\" from a module's global scope to a class, " "function or method defined in that module, as defined in :pep:`3155`. For " @@ -2585,7 +2605,7 @@ msgstr "" "或 method 的「路徑」,如 :pep:`3155` 中的定義。對於頂層的函式和 class 而言," "限定名稱與其物件名稱相同: ::" -#: ../../glossary.rst:1127 +#: ../../glossary.rst:1136 msgid "" ">>> class C:\n" "... class D:\n" @@ -2611,7 +2631,7 @@ msgstr "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" -#: ../../glossary.rst:1139 +#: ../../glossary.rst:1148 msgid "" "When used to refer to modules, the *fully qualified name* means the entire " "dotted path to the module, including any parent packages, e.g. " @@ -2620,7 +2640,7 @@ msgstr "" "當用於引用模組時,*完全限定名稱 (fully qualified name)* 是表示該模組的完整點" "分隔路徑,包括任何的父套件,例如 ``email.mime.text``: ::" -#: ../../glossary.rst:1143 +#: ../../glossary.rst:1152 msgid "" ">>> import email.mime.text\n" ">>> email.mime.text.__name__\n" @@ -2630,11 +2650,11 @@ msgstr "" ">>> email.mime.text.__name__\n" "'email.mime.text'" -#: ../../glossary.rst:1146 +#: ../../glossary.rst:1155 msgid "reference count" msgstr "reference count(參照計數)" -#: ../../glossary.rst:1148 +#: ../../glossary.rst:1157 msgid "" "The number of references to an object. When the reference count of an " "object drops to zero, it is deallocated. Some objects are :term:`immortal` " @@ -2650,11 +2670,11 @@ msgstr "" "看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼" "叫 :func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" -#: ../../glossary.rst:1156 +#: ../../glossary.rst:1165 msgid "regular package" msgstr "regular package(正規套件)" -#: ../../glossary.rst:1158 +#: ../../glossary.rst:1167 msgid "" "A traditional :term:`package`, such as a directory containing an " "``__init__.py`` file." @@ -2662,15 +2682,15 @@ msgstr "" "一個傳統的 :term:`package`\\ (套件),例如一個包含 ``__init__.py`` 檔案的目" "錄。" -#: ../../glossary.rst:1161 +#: ../../glossary.rst:1170 msgid "See also :term:`namespace package`." msgstr "另請參閱 :term:`namespace package`\\ (命名空間套件)。" -#: ../../glossary.rst:1162 +#: ../../glossary.rst:1171 msgid "REPL" msgstr "REPL" -#: ../../glossary.rst:1164 +#: ../../glossary.rst:1173 msgid "" "An acronym for the \"read–eval–print loop\", another name for " "the :term:`interactive` interpreter shell." @@ -2678,11 +2698,11 @@ msgstr "" "「read-eval-print 迴圈 (read–eval–print loop)」的縮寫,是\\ :term:`互動式 " "<interactive>`\\ 直譯器 shell 的另一個名稱。" -#: ../../glossary.rst:1166 +#: ../../glossary.rst:1175 msgid "__slots__" msgstr "__slots__" -#: ../../glossary.rst:1168 +#: ../../glossary.rst:1177 msgid "" "A declaration inside a class that saves memory by pre-declaring space for " "instance attributes and eliminating instance dictionaries. Though popular, " @@ -2695,11 +2715,11 @@ msgstr "" "最好保留給那種在一個記憶體關鍵 (memory-critical) 的應用程式中存在大量實例的罕" "見情況。" -#: ../../glossary.rst:1173 +#: ../../glossary.rst:1182 msgid "sequence" msgstr "sequence(序列)" -#: ../../glossary.rst:1175 +#: ../../glossary.rst:1184 msgid "" "An :term:`iterable` which supports efficient element access using integer " "indices via the :meth:`~object.__getitem__` special method and defines " @@ -2718,7 +2738,7 @@ msgstr "" "被視為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` " "鍵,而不是整數。" -#: ../../glossary.rst:1184 +#: ../../glossary.rst:1193 msgid "" "The :class:`collections.abc.Sequence` abstract base class defines a much " "richer interface that goes beyond just :meth:`~object.__getitem__` " @@ -2735,11 +2755,11 @@ msgstr "" "擴充介面的型別,可以使用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於" "序列方法的文件,請見\\ :ref:`常見序列操作 <typesseq-common>`。" -#: ../../glossary.rst:1193 +#: ../../glossary.rst:1202 msgid "set comprehension" msgstr "set comprehension(集合綜合運算)" -#: ../../glossary.rst:1195 +#: ../../glossary.rst:1204 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a set with the results. ``results = {c for c in 'abracadabra' if c " @@ -2750,11 +2770,11 @@ msgstr "" "set 回傳。``results = {c for c in 'abracadabra' if c not in 'abc'}`` 會產生一" "個字串 set:``{'r', 'd'}``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:1199 +#: ../../glossary.rst:1208 msgid "single dispatch" msgstr "single dispatch(單一調度)" -#: ../../glossary.rst:1201 +#: ../../glossary.rst:1210 msgid "" "A form of :term:`generic function` dispatch where the implementation is " "chosen based on the type of a single argument." @@ -2762,11 +2782,11 @@ msgstr "" ":term:`generic function`\\ (泛型函式)調度的一種形式,在此,實作的選擇是基於" "單一引數的型別。" -#: ../../glossary.rst:1203 +#: ../../glossary.rst:1212 msgid "slice" msgstr "slice(切片)" -#: ../../glossary.rst:1205 +#: ../../glossary.rst:1214 msgid "" "An object usually containing a portion of a :term:`sequence`. A slice is " "created using the subscript notation, ``[]`` with colons between numbers " @@ -2778,11 +2798,11 @@ msgstr "" "之間使用冒號,例如 ``variable_name[1:3:5]``。在括號(下標)符號的內部,會使" "用 :class:`slice` 物件。" -#: ../../glossary.rst:1209 +#: ../../glossary.rst:1218 msgid "soft deprecated" msgstr "soft deprecated(軟性棄用)" -#: ../../glossary.rst:1211 +#: ../../glossary.rst:1220 msgid "" "A soft deprecated API should not be used in new code, but it is safe for " "already existing code to use it. The API remains documented and tested, but " @@ -2791,13 +2811,13 @@ msgstr "" "被軟性棄用的 API 代表不應再用於新程式碼中,但在現有程式碼中繼續使用它仍會是安" "全的。API 仍會以文件記錄並會被測試,但不會被繼續改進。" -#: ../../glossary.rst:1215 +#: ../../glossary.rst:1224 msgid "" "Soft deprecation, unlike normal deprecation, does not plan on removing the " "API and will not emit warnings." msgstr "與正常棄用不同,軟性棄用沒有刪除 API 的規劃,也不會發出警告。" -#: ../../glossary.rst:1218 +#: ../../glossary.rst:1227 msgid "" "See `PEP 387: Soft Deprecation <https://peps.python.org/pep-0387/#soft-" "deprecation>`_." @@ -2805,11 +2825,11 @@ msgstr "" "請參閱 `PEP 387:軟性棄用 <https://peps.python.org/pep-0387/#soft-" "deprecation>`_。" -#: ../../glossary.rst:1220 +#: ../../glossary.rst:1229 msgid "special method" msgstr "special method(特殊方法)" -#: ../../glossary.rst:1224 +#: ../../glossary.rst:1233 msgid "" "A method that is called implicitly by Python to execute a certain operation " "on a type, such as addition. Such methods have names starting and ending " @@ -2820,11 +2840,11 @@ msgstr "" "種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在" "\\ :ref:`specialnames`\\ 中有詳細說明。" -#: ../../glossary.rst:1228 +#: ../../glossary.rst:1237 msgid "statement" msgstr "statement(陳述式)" -#: ../../glossary.rst:1230 +#: ../../glossary.rst:1239 msgid "" "A statement is part of a suite (a \"block\" of code). A statement is either " "an :term:`expression` or one of several constructs with a keyword, such " @@ -2834,11 +2854,11 @@ msgstr "" "個 :term:`expression`\\ (運算式),或是含有關鍵字(例" "如 :keyword:`if`、:keyword:`while` 或 :keyword:`for`\\ )的多種結構之一。" -#: ../../glossary.rst:1233 +#: ../../glossary.rst:1242 msgid "static type checker" msgstr "static type checker(靜態型別檢查器)" -#: ../../glossary.rst:1235 +#: ../../glossary.rst:1244 msgid "" "An external tool that reads Python code and analyzes it, looking for issues " "such as incorrect types. See also :term:`type hints <type hint>` and " @@ -2848,11 +2868,11 @@ msgstr "" "另請參閱\\ :term:`型別提示 (type hints) <type hint>` 以及 :mod:`typing` 模" "組。" -#: ../../glossary.rst:1238 +#: ../../glossary.rst:1247 msgid "strong reference" msgstr "strong reference(強參照)" -#: ../../glossary.rst:1240 +#: ../../glossary.rst:1249 msgid "" "In Python's C API, a strong reference is a reference to an object which is " "owned by the code holding the reference. The strong reference is taken by " @@ -2863,7 +2883,7 @@ msgstr "" "有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透" "過 :c:func:`Py_DECREF` 釋放強參照。" -#: ../../glossary.rst:1246 +#: ../../glossary.rst:1255 msgid "" "The :c:func:`Py_NewRef` function can be used to create a strong reference to " "an object. Usually, the :c:func:`Py_DECREF` function must be called on the " @@ -2873,15 +2893,15 @@ msgstr "" ":c:func:`Py_NewRef` 函式可用於建立一個對物件的強參照。通常,在退出強參照的作" "用域之前,必須在該強參照上呼叫 :c:func:`Py_DECREF` 函式,以避免洩漏一個參照。" -#: ../../glossary.rst:1251 +#: ../../glossary.rst:1260 msgid "See also :term:`borrowed reference`." msgstr "另請參閱 :term:`borrowed reference`\\ (借用參照)。" -#: ../../glossary.rst:1252 +#: ../../glossary.rst:1261 msgid "text encoding" msgstr "text encoding(文字編碼)" -#: ../../glossary.rst:1254 +#: ../../glossary.rst:1263 msgid "" "A string in Python is a sequence of Unicode code points (in range " "``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be " @@ -2890,7 +2910,7 @@ msgstr "" "Python 中的字串是一個 Unicode 碼點 (code point) 的序列(範圍在 ``U+0000`` -- " "``U+10FFFF`` 之間)。若要儲存或傳送一個字串,它必須被序列化為一個位元組序列。" -#: ../../glossary.rst:1258 +#: ../../glossary.rst:1267 msgid "" "Serializing a string into a sequence of bytes is known as \"encoding\", and " "recreating the string from the sequence of bytes is known as \"decoding\"." @@ -2898,7 +2918,7 @@ msgstr "" "將一個字串序列化為位元組序列,稱為「編碼」,而從位元組序列重新建立該字串則稱" "為「解碼 (decoding)」。" -#: ../../glossary.rst:1261 +#: ../../glossary.rst:1270 msgid "" "There are a variety of different text serialization :ref:`codecs <standard-" "encodings>`, which are collectively referred to as \"text encodings\"." @@ -2906,11 +2926,11 @@ msgstr "" "有多種不同的文字序列化編解碼器 (:ref:`codecs <standard-encodings>`),它們被統" "稱為「文字編碼」。" -#: ../../glossary.rst:1264 +#: ../../glossary.rst:1273 msgid "text file" msgstr "text file(文字檔案)" -#: ../../glossary.rst:1266 +#: ../../glossary.rst:1275 msgid "" "A :term:`file object` able to read and write :class:`str` objects. Often, a " "text file actually accesses a byte-oriented datastream and handles " @@ -2925,7 +2945,7 @@ msgstr "" "有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔" "案、:data:`sys.stdin`、:data:`sys.stdout` 以及 :class:`io.StringIO` 的實例。" -#: ../../glossary.rst:1273 +#: ../../glossary.rst:1282 msgid "" "See also :term:`binary file` for a file object able to read and " "write :term:`bytes-like objects <bytes-like object>`." @@ -2934,11 +2954,28 @@ msgstr "" "\\ :term:`類位元組串物件 (bytes-like object) <bytes-like object>` 的檔案物" "件。" -#: ../../glossary.rst:1275 +#: ../../glossary.rst:1284 +msgid "token" +msgstr "" + +#: ../../glossary.rst:1287 +msgid "" +"A small unit of source code, generated by the :ref:`lexical analyzer " +"<lexical>` (also called the *tokenizer*). Names, numbers, strings, " +"operators, newlines and similar are represented by tokens." +msgstr "" + +#: ../../glossary.rst:1292 +msgid "" +"The :mod:`tokenize` module exposes Python's lexical analyzer. " +"The :mod:`token` module contains information on the various types of tokens." +msgstr "" + +#: ../../glossary.rst:1295 msgid "triple-quoted string" msgstr "triple-quoted string(三引號內字串)" -#: ../../glossary.rst:1277 +#: ../../glossary.rst:1297 msgid "" "A string which is bound by three instances of either a quotation mark (\") " "or an apostrophe ('). While they don't provide any functionality not " @@ -2953,11 +2990,11 @@ msgstr "" "中包含未跳脫 (unescaped) 的單引號和雙引號,而且它們不需使用連續字元 " "(continuation character) 就可以跨越多行,這使得它們在編寫說明字串時特別有用。" -#: ../../glossary.rst:1284 +#: ../../glossary.rst:1304 msgid "type" msgstr "type(型別)" -#: ../../glossary.rst:1286 +#: ../../glossary.rst:1306 msgid "" "The type of a Python object determines what kind of object it is; every " "object has a type. An object's type is accessible as " @@ -2968,22 +3005,22 @@ msgstr "" "件的型別可以用它的 :attr:`~object.__class__` 屬性來存取,或以 ``type(obj)`` " "來檢索。" -#: ../../glossary.rst:1290 +#: ../../glossary.rst:1310 msgid "type alias" msgstr "type alias(型別別名)" -#: ../../glossary.rst:1292 +#: ../../glossary.rst:1312 msgid "A synonym for a type, created by assigning the type to an identifier." msgstr "一個型別的同義詞,透過將型別指定給一個識別符 (identifier) 來建立。" -#: ../../glossary.rst:1294 +#: ../../glossary.rst:1314 msgid "" "Type aliases are useful for simplifying :term:`type hints <type hint>`. For " "example::" msgstr "" "型別別名對於簡化\\ :term:`型別提示 (type hint) <type hint>` 很有用。例如: ::" -#: ../../glossary.rst:1297 +#: ../../glossary.rst:1317 msgid "" "def remove_gray_shades(\n" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" @@ -2993,11 +3030,11 @@ msgstr "" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" " pass" -#: ../../glossary.rst:1301 +#: ../../glossary.rst:1321 msgid "could be made more readable like this::" msgstr "可以寫成這樣,更具有可讀性: ::" -#: ../../glossary.rst:1303 +#: ../../glossary.rst:1323 msgid "" "Color = tuple[int, int, int]\n" "\n" @@ -3009,15 +3046,15 @@ msgstr "" "def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" " pass" -#: ../../glossary.rst:1308 ../../glossary.rst:1322 +#: ../../glossary.rst:1328 ../../glossary.rst:1342 msgid "See :mod:`typing` and :pep:`484`, which describe this functionality." msgstr "請參閱 :mod:`typing` 和 :pep:`484`,有此功能的描述。" -#: ../../glossary.rst:1309 +#: ../../glossary.rst:1329 msgid "type hint" msgstr "type hint(型別提示)" -#: ../../glossary.rst:1311 +#: ../../glossary.rst:1331 msgid "" "An :term:`annotation` that specifies the expected type for a variable, a " "class attribute, or a function parameter or return value." @@ -3025,7 +3062,7 @@ msgstr "" "一種 :term:`annotation`\\ (註釋),它指定一個變數、一個 class 屬性或一個函式" "的參數或回傳值的預期型別。" -#: ../../glossary.rst:1314 +#: ../../glossary.rst:1334 msgid "" "Type hints are optional and are not enforced by Python but they are useful " "to :term:`static type checkers <static type checker>`. They can also aid " @@ -3035,7 +3072,7 @@ msgstr "" "(static type checkers) <static type checker>`\\ 很有用,並能協助 IDE 完成程式" "碼的補全 (completion) 和重構 (refactoring)。" -#: ../../glossary.rst:1318 +#: ../../glossary.rst:1338 msgid "" "Type hints of global variables, class attributes, and functions, but not " "local variables, can be accessed using :func:`typing.get_type_hints`." @@ -3043,11 +3080,11 @@ msgstr "" "全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使" "用 :func:`typing.get_type_hints` 來存取。" -#: ../../glossary.rst:1323 +#: ../../glossary.rst:1343 msgid "universal newlines" msgstr "universal newlines(通用換行字元)" -#: ../../glossary.rst:1325 +#: ../../glossary.rst:1345 msgid "" "A manner of interpreting text streams in which all of the following are " "recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the " @@ -3060,20 +3097,20 @@ msgstr "" "``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用" "於 :func:`bytes.splitlines` 的附加用途。" -#: ../../glossary.rst:1330 +#: ../../glossary.rst:1350 msgid "variable annotation" msgstr "variable annotation(變數註釋)" -#: ../../glossary.rst:1332 +#: ../../glossary.rst:1352 msgid "An :term:`annotation` of a variable or a class attribute." msgstr "一個變數或 class 屬性的 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:1334 +#: ../../glossary.rst:1354 msgid "" "When annotating a variable or a class attribute, assignment is optional::" msgstr "註釋變數或 class 屬性時,賦值是選擇性的: ::" -#: ../../glossary.rst:1336 +#: ../../glossary.rst:1356 msgid "" "class C:\n" " field: 'annotation'" @@ -3081,7 +3118,7 @@ msgstr "" "class C:\n" " field: 'annotation'" -#: ../../glossary.rst:1339 +#: ../../glossary.rst:1359 msgid "" "Variable annotations are usually used for :term:`type hints <type hint>`: " "for example this variable is expected to take :class:`int` values::" @@ -3089,15 +3126,15 @@ msgstr "" "變數註釋通常用於\\ :term:`型別提示 (type hint) <type hint>`:例如,這個變數預" "期會取得 :class:`int`\\ (整數)值: ::" -#: ../../glossary.rst:1343 +#: ../../glossary.rst:1363 msgid "count: int = 0" msgstr "count: int = 0" -#: ../../glossary.rst:1345 +#: ../../glossary.rst:1365 msgid "Variable annotation syntax is explained in section :ref:`annassign`." msgstr "變數註釋的語法在\\ :ref:`annassign`\\ 章節有詳細的解釋。" -#: ../../glossary.rst:1347 +#: ../../glossary.rst:1367 msgid "" "See :term:`function annotation`, :pep:`484` and :pep:`526`, which describe " "this functionality. Also see :ref:`annotations-howto` for best practices on " @@ -3106,11 +3143,11 @@ msgstr "" "請參閱 :term:`function annotation`\\ (函式註釋)、:pep:`484` 和 :pep:`526`," "皆有此功能的描述。關於註釋的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:1351 +#: ../../glossary.rst:1371 msgid "virtual environment" msgstr "virtual environment(虛擬環境)" -#: ../../glossary.rst:1353 +#: ../../glossary.rst:1373 msgid "" "A cooperatively isolated runtime environment that allows Python users and " "applications to install and upgrade Python distribution packages without " @@ -3121,15 +3158,15 @@ msgstr "" "程式得以安裝和升級 Python 發佈套件,而不會對同一個系統上運行的其他 Python 應" "用程式的行為產生干擾。" -#: ../../glossary.rst:1358 +#: ../../glossary.rst:1378 msgid "See also :mod:`venv`." msgstr "另請參閱 :mod:`venv`。" -#: ../../glossary.rst:1359 +#: ../../glossary.rst:1379 msgid "virtual machine" msgstr "virtual machine(虛擬機器)" -#: ../../glossary.rst:1361 +#: ../../glossary.rst:1381 msgid "" "A computer defined entirely in software. Python's virtual machine executes " "the :term:`bytecode` emitted by the bytecode compiler." @@ -3137,11 +3174,11 @@ msgstr "" "一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行" "由 :term:`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" -#: ../../glossary.rst:1363 +#: ../../glossary.rst:1383 msgid "Zen of Python" msgstr "Zen of Python(Python 之禪)" -#: ../../glossary.rst:1365 +#: ../../glossary.rst:1385 msgid "" "Listing of Python design principles and philosophies that are helpful in " "understanding and using the language. The listing can be found by typing " @@ -3158,11 +3195,11 @@ msgstr "C-contiguous(C 連續的)" msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" -#: ../../glossary.rst:827 +#: ../../glossary.rst:831 msgid "magic" msgstr "magic" -#: ../../glossary.rst:1222 +#: ../../glossary.rst:1231 msgid "special" msgstr "special" diff --git a/howto/curses.po b/howto/curses.po index d28b8e7fb1..5c22aaf379 100644 --- a/howto/curses.po +++ b/howto/curses.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-04-11 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -240,8 +240,8 @@ msgid "" " v = i-10\n" " stdscr.addstr(i, 0, '10 divided by {} is {}'.format(v, 10/v))\n" "\n" -" stdscr.refresh()\n" -" stdscr.getkey()\n" +" stdscr.refresh()\n" +" stdscr.getkey()\n" "\n" "wrapper(main)" msgstr "" diff --git a/howto/descriptor.po b/howto/descriptor.po index 4d1b659340..8a489fafc2 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -75,8 +75,9 @@ msgstr "" msgid "" "The last section has pure Python equivalents for built-in descriptors that " "are written in C. Read this if you're curious about how functions turn into " -"bound methods or about the implementation of common tools like :func:" -"`classmethod`, :func:`staticmethod`, :func:`property`, and :term:`__slots__`." +"bound methods or about the implementation of common tools " +"like :func:`classmethod`, :func:`staticmethod`, :func:`property`, " +"and :term:`__slots__`." msgstr "" #: ../../howto/descriptor.rst:36 @@ -230,8 +231,9 @@ msgid "" "A popular use for descriptors is managing access to instance data. The " "descriptor is assigned to a public attribute in the class dictionary while " "the actual data is stored as a private attribute in the instance " -"dictionary. The descriptor's :meth:`~object.__get__` and :meth:`~object." -"__set__` methods are triggered when the public attribute is accessed." +"dictionary. The descriptor's :meth:`~object.__get__` " +"and :meth:`~object.__set__` methods are triggered when the public attribute " +"is accessed." msgstr "" #: ../../howto/descriptor.rst:139 @@ -369,9 +371,10 @@ msgstr "" #: ../../howto/descriptor.rst:256 msgid "" -"An interactive session shows that the :class:`!Person` class has called :" -"meth:`~object.__set_name__` so that the field names would be recorded. Here " -"we call :func:`vars` to look up the descriptor without triggering it:" +"An interactive session shows that the :class:`!Person` class has " +"called :meth:`~object.__set_name__` so that the field names would be " +"recorded. Here we call :func:`vars` to look up the descriptor without " +"triggering it:" msgstr "" #: ../../howto/descriptor.rst:260 @@ -428,8 +431,9 @@ msgstr "" #: ../../howto/descriptor.rst:297 msgid "" -"A :term:`descriptor` is what we call any object that defines :meth:`~object." -"__get__`, :meth:`~object.__set__`, or :meth:`~object.__delete__`." +"A :term:`descriptor` is what we call any object that " +"defines :meth:`~object.__get__`, :meth:`~object.__set__`, " +"or :meth:`~object.__delete__`." msgstr "" #: ../../howto/descriptor.rst:300 @@ -469,9 +473,9 @@ msgstr "" #: ../../howto/descriptor.rst:319 msgid "" "Descriptors are used throughout the language. It is how functions turn into " -"bound methods. Common tools like :func:`classmethod`, :func:" -"`staticmethod`, :func:`property`, and :func:`functools.cached_property` are " -"all implemented as descriptors." +"bound methods. Common tools " +"like :func:`classmethod`, :func:`staticmethod`, :func:`property`, " +"and :func:`functools.cached_property` are all implemented as descriptors." msgstr "" #: ../../howto/descriptor.rst:326 @@ -561,9 +565,9 @@ msgstr "" #: ../../howto/descriptor.rst:374 msgid "" -":class:`!Number` verifies that a value is either an :class:`int` or :class:" -"`float`. Optionally, it verifies that a value is between a given minimum or " -"maximum." +":class:`!Number` verifies that a value is either an :class:`int` " +"or :class:`float`. Optionally, it verifies that a value is between a given " +"minimum or maximum." msgstr "" #: ../../howto/descriptor.rst:378 @@ -716,9 +720,10 @@ msgstr "" #: ../../howto/descriptor.rst:503 msgid "" "In general, a descriptor is an attribute value that has one of the methods " -"in the descriptor protocol. Those methods are :meth:`~object.__get__`, :" -"meth:`~object.__set__`, and :meth:`~object.__delete__`. If any of those " -"methods are defined for an attribute, it is said to be a :term:`descriptor`." +"in the descriptor protocol. Those methods " +"are :meth:`~object.__get__`, :meth:`~object.__set__`, " +"and :meth:`~object.__delete__`. If any of those methods are defined for an " +"attribute, it is said to be a :term:`descriptor`." msgstr "" #: ../../howto/descriptor.rst:508 @@ -736,10 +741,10 @@ msgstr "" #: ../../howto/descriptor.rst:517 msgid "" "Descriptors are a powerful, general purpose protocol. They are the " -"mechanism behind properties, methods, static methods, class methods, and :" -"func:`super`. They are used throughout Python itself. Descriptors simplify " -"the underlying C code and offer a flexible set of new tools for everyday " -"Python programs." +"mechanism behind properties, methods, static methods, class methods, " +"and :func:`super`. They are used throughout Python itself. Descriptors " +"simplify the underlying C code and offer a flexible set of new tools for " +"everyday Python programs." msgstr "" #: ../../howto/descriptor.rst:525 @@ -768,9 +773,9 @@ msgstr "" #: ../../howto/descriptor.rst:537 msgid "" "If an object defines :meth:`~object.__set__` or :meth:`~object.__delete__`, " -"it is considered a data descriptor. Descriptors that only define :meth:" -"`~object.__get__` are called non-data descriptors (they are often used for " -"methods but other uses are possible)." +"it is considered a data descriptor. Descriptors that only " +"define :meth:`~object.__get__` are called non-data descriptors (they are " +"often used for methods but other uses are possible)." msgstr "" #: ../../howto/descriptor.rst:542 @@ -785,9 +790,10 @@ msgstr "" #: ../../howto/descriptor.rst:548 msgid "" "To make a read-only data descriptor, define both :meth:`~object.__get__` " -"and :meth:`~object.__set__` with the :meth:`~object.__set__` raising an :exc:" -"`AttributeError` when called. Defining the :meth:`~object.__set__` method " -"with an exception raising placeholder is enough to make it a data descriptor." +"and :meth:`~object.__set__` with the :meth:`~object.__set__` raising " +"an :exc:`AttributeError` when called. Defining the :meth:`~object.__set__` " +"method with an exception raising placeholder is enough to make it a data " +"descriptor." msgstr "" #: ../../howto/descriptor.rst:555 @@ -796,8 +802,8 @@ msgstr "" #: ../../howto/descriptor.rst:557 msgid "" -"A descriptor can be called directly with ``desc.__get__(obj)`` or ``desc." -"__get__(None, cls)``." +"A descriptor can be called directly with ``desc.__get__(obj)`` or " +"``desc.__get__(None, cls)``." msgstr "" #: ../../howto/descriptor.rst:560 @@ -834,8 +840,8 @@ msgstr "" #: ../../howto/descriptor.rst:580 msgid "" -"If a descriptor is found for ``a.x``, then it is invoked with: ``desc." -"__get__(a, type(a))``." +"If a descriptor is found for ``a.x``, then it is invoked with: " +"``desc.__get__(a, type(a))``." msgstr "" #: ../../howto/descriptor.rst:583 @@ -875,18 +881,19 @@ msgstr "" #: ../../howto/descriptor.rst:722 msgid "" -"Note, there is no :meth:`~object.__getattr__` hook in the :meth:`~object." -"__getattribute__` code. That is why calling :meth:`~object." -"__getattribute__` directly or with ``super().__getattribute__`` will bypass :" -"meth:`~object.__getattr__` entirely." +"Note, there is no :meth:`~object.__getattr__` hook in " +"the :meth:`~object.__getattribute__` code. That is why " +"calling :meth:`~object.__getattribute__` directly or with " +"``super().__getattribute__`` will bypass :meth:`~object.__getattr__` " +"entirely." msgstr "" #: ../../howto/descriptor.rst:726 msgid "" "Instead, it is the dot operator and the :func:`getattr` function that are " -"responsible for invoking :meth:`~object.__getattr__` whenever :meth:`~object." -"__getattribute__` raises an :exc:`AttributeError`. Their logic is " -"encapsulated in a helper function:" +"responsible for invoking :meth:`~object.__getattr__` " +"whenever :meth:`~object.__getattribute__` raises an :exc:`AttributeError`. " +"Their logic is encapsulated in a helper function:" msgstr "" #: ../../howto/descriptor.rst:731 @@ -915,10 +922,10 @@ msgstr "" #: ../../howto/descriptor.rst:778 msgid "" -"The logic for a dotted lookup such as ``A.x`` is in :meth:`!type." -"__getattribute__`. The steps are similar to those for :meth:`!object." -"__getattribute__` but the instance dictionary lookup is replaced by a search " -"through the class's :term:`method resolution order`." +"The logic for a dotted lookup such as ``A.x`` is in :meth:`!" +"type.__getattribute__`. The steps are similar to those for :meth:`!" +"object.__getattribute__` but the instance dictionary lookup is replaced by a " +"search through the class's :term:`method resolution order`." msgstr "" #: ../../howto/descriptor.rst:783 @@ -927,8 +934,8 @@ msgstr "" #: ../../howto/descriptor.rst:785 msgid "" -"The full C implementation can be found in :c:func:`!type_getattro` and :c:" -"func:`!_PyType_Lookup` in :source:`Objects/typeobject.c`." +"The full C implementation can be found in :c:func:`!type_getattro` " +"and :c:func:`!_PyType_Lookup` in :source:`Objects/typeobject.c`." msgstr "" #: ../../howto/descriptor.rst:790 @@ -937,22 +944,23 @@ msgstr "" #: ../../howto/descriptor.rst:792 msgid "" -"The logic for super's dotted lookup is in the :meth:`~object." -"__getattribute__` method for object returned by :func:`super`." +"The logic for super's dotted lookup is in " +"the :meth:`~object.__getattribute__` method for object returned " +"by :func:`super`." msgstr "" #: ../../howto/descriptor.rst:795 msgid "" -"A dotted lookup such as ``super(A, obj).m`` searches ``obj.__class__." -"__mro__`` for the base class ``B`` immediately following ``A`` and then " -"returns ``B.__dict__['m'].__get__(obj, A)``. If not a descriptor, ``m`` is " -"returned unchanged." +"A dotted lookup such as ``super(A, obj).m`` searches " +"``obj.__class__.__mro__`` for the base class ``B`` immediately following " +"``A`` and then returns ``B.__dict__['m'].__get__(obj, A)``. If not a " +"descriptor, ``m`` is returned unchanged." msgstr "" #: ../../howto/descriptor.rst:800 msgid "" -"The full C implementation can be found in :c:func:`!super_getattro` in :" -"source:`Objects/typeobject.c`. A pure Python equivalent can be found in " +"The full C implementation can be found in :c:func:`!super_getattro` " +"in :source:`Objects/typeobject.c`. A pure Python equivalent can be found in " "`Guido's Tutorial <https://www.python.org/download/releases/2.2.3/descrintro/" "#cooperation>`_." msgstr "" @@ -963,9 +971,9 @@ msgstr "" #: ../../howto/descriptor.rst:809 msgid "" -"The mechanism for descriptors is embedded in the :meth:`~object." -"__getattribute__` methods for :class:`object`, :class:`type`, and :func:" -"`super`." +"The mechanism for descriptors is embedded in " +"the :meth:`~object.__getattribute__` methods " +"for :class:`object`, :class:`type`, and :func:`super`." msgstr "" #: ../../howto/descriptor.rst:812 @@ -978,8 +986,8 @@ msgstr "" #: ../../howto/descriptor.rst:816 msgid "" -"Classes inherit this machinery from :class:`object`, :class:`type`, or :func:" -"`super`." +"Classes inherit this machinery from :class:`object`, :class:`type`, " +"or :func:`super`." msgstr "" #: ../../howto/descriptor.rst:819 @@ -1038,8 +1046,8 @@ msgstr "ORM 範例" #: ../../howto/descriptor.rst:853 msgid "" "The following code is a simplified skeleton showing how data descriptors " -"could be used to implement an `object relational mapping <https://en." -"wikipedia.org/wiki/Object%E2%80%93relational_mapping>`_." +"could be used to implement an `object relational mapping <https://" +"en.wikipedia.org/wiki/Object%E2%80%93relational_mapping>`_." msgstr "" #: ../../howto/descriptor.rst:857 @@ -1083,9 +1091,9 @@ msgstr "" #: ../../howto/descriptor.rst:876 msgid "" -"We can use the :class:`!Field` class to define `models <https://en.wikipedia." -"org/wiki/Database_model>`_ that describe the schema for each table in a " -"database:" +"We can use the :class:`!Field` class to define `models <https://" +"en.wikipedia.org/wiki/Database_model>`_ that describe the schema for each " +"table in a database:" msgstr "" #: ../../howto/descriptor.rst:880 @@ -1342,10 +1350,10 @@ msgstr "" #: ../../howto/descriptor.rst:1189 msgid "" -"To support automatic creation of methods, functions include the :meth:" -"`~object.__get__` method for binding methods during attribute access. This " -"means that functions are non-data descriptors that return bound methods " -"during dotted lookup from an instance. Here's how it works:" +"To support automatic creation of methods, functions include " +"the :meth:`~object.__get__` method for binding methods during attribute " +"access. This means that functions are non-data descriptors that return " +"bound methods during dotted lookup from an instance. Here's how it works:" msgstr "" #: ../../howto/descriptor.rst:1194 @@ -1397,8 +1405,9 @@ msgstr "" #: ../../howto/descriptor.rst:1233 msgid "" -"Accessing the function through the class dictionary does not invoke :meth:" -"`~object.__get__`. Instead, it just returns the underlying function object::" +"Accessing the function through the class dictionary does not " +"invoke :meth:`~object.__get__`. Instead, it just returns the underlying " +"function object::" msgstr "" #: ../../howto/descriptor.rst:1236 @@ -1535,10 +1544,10 @@ msgstr "" #: ../../howto/descriptor.rst:1293 msgid "" "Static methods return the underlying function without changes. Calling " -"either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into ``object." -"__getattribute__(c, \"f\")`` or ``object.__getattribute__(C, \"f\")``. As a " -"result, the function becomes identically accessible from either an object or " -"a class." +"either ``c.f`` or ``C.f`` is the equivalent of a direct lookup into " +"``object.__getattribute__(c, \"f\")`` or ``object.__getattribute__(C, " +"\"f\")``. As a result, the function becomes identically accessible from " +"either an object or a class." msgstr "" #: ../../howto/descriptor.rst:1299 @@ -1591,8 +1600,8 @@ msgstr "" #: ../../howto/descriptor.rst:1328 msgid "" -"Using the non-data descriptor protocol, a pure Python version of :func:" -"`staticmethod` would look like this:" +"Using the non-data descriptor protocol, a pure Python version " +"of :func:`staticmethod` would look like this:" msgstr "" #: ../../howto/descriptor.rst:1331 @@ -1617,9 +1626,9 @@ msgstr "" msgid "" "The :func:`functools.update_wrapper` call adds a ``__wrapped__`` attribute " "that refers to the underlying function. Also it carries forward the " -"attributes necessary to make the wrapper look like the wrapped function: :" -"attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function." -"__doc__`, and :attr:`~function.__annotations__`." +"attributes necessary to make the wrapper look like the wrapped " +"function: :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__`, " +"and :attr:`~function.__annotations__`." msgstr "" #: ../../howto/descriptor.rst:1417 @@ -1698,8 +1707,8 @@ msgstr "" #: ../../howto/descriptor.rst:1464 msgid "" -"Using the non-data descriptor protocol, a pure Python version of :func:" -"`classmethod` would look like this:" +"Using the non-data descriptor protocol, a pure Python version " +"of :func:`classmethod` would look like this:" msgstr "" #: ../../howto/descriptor.rst:1467 @@ -1724,9 +1733,9 @@ msgid "" "The :func:`functools.update_wrapper` call in ``ClassMethod`` adds a " "``__wrapped__`` attribute that refers to the underlying function. Also it " "carries forward the attributes necessary to make the wrapper look like the " -"wrapped function: :attr:`~function.__name__`, :attr:`~function." -"__qualname__`, :attr:`~function.__doc__`, and :attr:`~function." -"__annotations__`." +"wrapped " +"function: :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__`, " +"and :attr:`~function.__annotations__`." msgstr "" #: ../../howto/descriptor.rst:1538 @@ -2053,23 +2062,3 @@ msgstr "" "Traceback (most recent call last):\n" " ...\n" "AttributeError: 'H' object has no attribute 'xz'" - -#~ msgid "" -#~ "class G:\n" -#~ " @classmethod\n" -#~ " @property\n" -#~ " def __doc__(cls):\n" -#~ " return f'A doc for {cls.__name__!r}'" -#~ msgstr "" -#~ "class G:\n" -#~ " @classmethod\n" -#~ " @property\n" -#~ " def __doc__(cls):\n" -#~ " return f'A doc for {cls.__name__!r}'" - -#~ msgid "" -#~ ">>> G.__doc__\n" -#~ "\"A doc for 'G'\"" -#~ msgstr "" -#~ ">>> G.__doc__\n" -#~ "\"A doc for 'G'\"" diff --git a/howto/enum.po b/howto/enum.po index eeeae58470..924ee16d8a 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # #, fuzzy @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-27 00:14+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -211,9 +211,12 @@ msgstr "" #: ../../howto/enum.rst:108 msgid "" ">>> from datetime import date\n" -">>> Weekday.from_date(date.today()) \n" +">>> Weekday.from_date(date.today())\n" "<Weekday.TUESDAY: 2>" msgstr "" +">>> from datetime import date\n" +">>> Weekday.from_date(date.today())\n" +"<Weekday.TUESDAY: 2>" #: ../../howto/enum.rst:112 msgid "" @@ -312,15 +315,15 @@ msgstr "" #: ../../howto/enum.rst:154 msgid "" ">>> chores_for_ethan = {\n" -"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday." -"FRIDAY,\n" +"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | " +"Weekday.FRIDAY,\n" "... 'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,\n" "... 'answer SO questions': Weekday.SATURDAY,\n" "... }" msgstr "" ">>> chores_for_ethan = {\n" -"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday." -"FRIDAY,\n" +"... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | " +"Weekday.FRIDAY,\n" "... 'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY,\n" "... 'answer SO questions': Weekday.SATURDAY,\n" "... }" @@ -383,8 +386,8 @@ msgstr "" #: ../../howto/enum.rst:191 msgid "" -"Sometimes it's useful to access members in enumerations programmatically (i." -"e. situations where ``Color.RED`` won't do because the exact color is not " +"Sometimes it's useful to access members in enumerations programmatically " +"(i.e. situations where ``Color.RED`` won't do because the exact color is not " "known at program-writing time). ``Enum`` allows such access::" msgstr "" @@ -624,16 +627,16 @@ msgid "" ">>> list(Shape)\n" "[<Shape.SQUARE: 2>, <Shape.DIAMOND: 1>, <Shape.CIRCLE: 3>]\n" ">>> list(Weekday)\n" -"[<Weekday.MONDAY: 1>, <Weekday.TUESDAY: 2>, <Weekday.WEDNESDAY: 4>, <Weekday." -"THURSDAY: 8>, <Weekday.FRIDAY: 16>, <Weekday.SATURDAY: 32>, <Weekday.SUNDAY: " -"64>]" +"[<Weekday.MONDAY: 1>, <Weekday.TUESDAY: 2>, <Weekday.WEDNESDAY: 4>, " +"<Weekday.THURSDAY: 8>, <Weekday.FRIDAY: 16>, <Weekday.SATURDAY: 32>, " +"<Weekday.SUNDAY: 64>]" msgstr "" ">>> list(Shape)\n" "[<Shape.SQUARE: 2>, <Shape.DIAMOND: 1>, <Shape.CIRCLE: 3>]\n" ">>> list(Weekday)\n" -"[<Weekday.MONDAY: 1>, <Weekday.TUESDAY: 2>, <Weekday.WEDNESDAY: 4>, <Weekday." -"THURSDAY: 8>, <Weekday.FRIDAY: 16>, <Weekday.SATURDAY: 32>, <Weekday.SUNDAY: " -"64>]" +"[<Weekday.MONDAY: 1>, <Weekday.TUESDAY: 2>, <Weekday.WEDNESDAY: 4>, " +"<Weekday.THURSDAY: 8>, <Weekday.FRIDAY: 16>, <Weekday.SATURDAY: 32>, " +"<Weekday.SUNDAY: 64>]" #: ../../howto/enum.rst:319 msgid "" @@ -836,24 +839,25 @@ msgid "" "The rules for what is allowed are as follows: names that start and end with " "a single underscore are reserved by enum and cannot be used; all other " "attributes defined within an enumeration will become members of this " -"enumeration, with the exception of special methods (:meth:`~object." -"__str__`, :meth:`~object.__add__`, etc.), descriptors (methods are also " -"descriptors), and variable names listed in :attr:`~Enum._ignore_`." +"enumeration, with the exception of special methods " +"(:meth:`~object.__str__`, :meth:`~object.__add__`, etc.), descriptors " +"(methods are also descriptors), and variable names listed " +"in :attr:`~Enum._ignore_`." msgstr "" #: ../../howto/enum.rst:432 msgid "" -"Note: if your enumeration defines :meth:`~object.__new__` and/or :meth:" -"`~object.__init__`, any value(s) given to the enum member will be passed " -"into those methods. See `Planet`_ for an example." +"Note: if your enumeration defines :meth:`~object.__new__` and/" +"or :meth:`~object.__init__`, any value(s) given to the enum member will be " +"passed into those methods. See `Planet`_ for an example." msgstr "" #: ../../howto/enum.rst:438 msgid "" "The :meth:`~object.__new__` method, if defined, is used during creation of " "the Enum members; it is then replaced by Enum's :meth:`~object.__new__` " -"which is used after class creation for lookup of existing members. See :ref:" -"`new-vs-init` for more details." +"which is used after class creation for lookup of existing members. " +"See :ref:`new-vs-init` for more details." msgstr "" #: ../../howto/enum.rst:445 @@ -935,8 +939,8 @@ msgstr "" #: ../../howto/enum.rst:486 msgid "" -"When inheriting from a :class:`~dataclasses.dataclass`, the :meth:`~Enum." -"__repr__` omits the inherited class' name. For example::" +"When inheriting from a :class:`~dataclasses.dataclass`, " +"the :meth:`~Enum.__repr__` omits the inherited class' name. For example::" msgstr "" #: ../../howto/enum.rst:489 @@ -1037,9 +1041,10 @@ msgstr "" #: ../../howto/enum.rst:547 msgid "" -"It is possible to modify how enum members are pickled/unpickled by defining :" -"meth:`~object.__reduce_ex__` in the enumeration class. The default method " -"is by-value, but enums with complicated values may want to use by-name::" +"It is possible to modify how enum members are pickled/unpickled by " +"defining :meth:`~object.__reduce_ex__` in the enumeration class. The " +"default method is by-value, but enums with complicated values may want to " +"use by-name::" msgstr "" #: ../../howto/enum.rst:551 @@ -1148,10 +1153,10 @@ msgstr "" #: ../../howto/enum.rst:611 msgid "" -"The new pickle protocol 4 also, in some circumstances, relies on :attr:" -"`~type.__qualname__` being set to the location where pickle will be able to " -"find the class. For example, if the class was made available in class " -"SomeData in the global scope::" +"The new pickle protocol 4 also, in some circumstances, relies " +"on :attr:`~type.__qualname__` being set to the location where pickle will be " +"able to find the class. For example, if the class was made available in " +"class SomeData in the global scope::" msgstr "" #: ../../howto/enum.rst:616 @@ -1254,10 +1259,10 @@ msgstr "IntEnum" #: ../../howto/enum.rst:667 msgid "" -"The first variation of :class:`Enum` that is provided is also a subclass of :" -"class:`int`. Members of an :class:`IntEnum` can be compared to integers; by " -"extension, integer enumerations of different types can also be compared to " -"each other::" +"The first variation of :class:`Enum` that is provided is also a subclass " +"of :class:`int`. Members of an :class:`IntEnum` can be compared to " +"integers; by extension, integer enumerations of different types can also be " +"compared to each other::" msgstr "" #: ../../howto/enum.rst:672 @@ -1366,9 +1371,9 @@ msgid "" "The next variation of :class:`Enum` provided, :class:`IntFlag`, is also " "based on :class:`int`. The difference being :class:`IntFlag` members can be " "combined using the bitwise operators (&, \\|, ^, ~) and the result is still " -"an :class:`IntFlag` member, if possible. Like :class:`IntEnum`, :class:" -"`IntFlag` members are also integers and can be used wherever an :class:`int` " -"is used." +"an :class:`IntFlag` member, if possible. " +"Like :class:`IntEnum`, :class:`IntFlag` members are also integers and can be " +"used wherever an :class:`int` is used." msgstr "" #: ../../howto/enum.rst:733 @@ -1458,8 +1463,8 @@ msgstr "" #: ../../howto/enum.rst:781 msgid "" "Another important difference between :class:`IntFlag` and :class:`Enum` is " -"that if no flags are set (the value is 0), its boolean evaluation is :data:" -"`False`::" +"that if no flags are set (the value is 0), its boolean evaluation " +"is :data:`False`::" msgstr "" #: ../../howto/enum.rst:784 @@ -1527,10 +1532,10 @@ msgstr "Flag" #: ../../howto/enum.rst:817 msgid "" "The last variation is :class:`Flag`. Like :class:`IntFlag`, :class:`Flag` " -"members can be combined using the bitwise operators (&, \\|, ^, ~). Unlike :" -"class:`IntFlag`, they cannot be combined with, nor compared against, any " -"other :class:`Flag` enumeration, nor :class:`int`. While it is possible to " -"specify the values directly it is recommended to use :class:`auto` as the " +"members can be combined using the bitwise operators (&, \\|, ^, ~). " +"Unlike :class:`IntFlag`, they cannot be combined with, nor compared against, " +"any other :class:`Flag` enumeration, nor :class:`int`. While it is possible " +"to specify the values directly it is recommended to use :class:`auto` as the " "value and let :class:`Flag` select an appropriate value." msgstr "" @@ -1639,10 +1644,10 @@ msgid "" "For the majority of new code, :class:`Enum` and :class:`Flag` are strongly " "recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic " "promises of an enumeration (by being comparable to integers, and thus by " -"transitivity to other unrelated enumerations). :class:`IntEnum` and :class:" -"`IntFlag` should be used only in cases where :class:`Enum` and :class:`Flag` " -"will not do; for example, when integer constants are replaced with " -"enumerations, or for interoperability with other systems." +"transitivity to other unrelated enumerations). :class:`IntEnum` " +"and :class:`IntFlag` should be used only in cases where :class:`Enum` " +"and :class:`Flag` will not do; for example, when integer constants are " +"replaced with enumerations, or for interoperability with other systems." msgstr "" #: ../../howto/enum.rst:886 @@ -1666,8 +1671,8 @@ msgstr "" #: ../../howto/enum.rst:894 msgid "" "This demonstrates how similar derived enumerations can be defined; for " -"example a :class:`!FloatEnum` that mixes in :class:`float` instead of :class:" -"`int`." +"example a :class:`!FloatEnum` that mixes in :class:`float` instead " +"of :class:`int`." msgstr "" #: ../../howto/enum.rst:897 @@ -1676,24 +1681,24 @@ msgstr "一些規則:" #: ../../howto/enum.rst:899 msgid "" -"When subclassing :class:`Enum`, mix-in types must appear before the :class:" -"`Enum` class itself in the sequence of bases, as in the :class:`IntEnum` " -"example above." +"When subclassing :class:`Enum`, mix-in types must appear before " +"the :class:`Enum` class itself in the sequence of bases, as in " +"the :class:`IntEnum` example above." msgstr "" #: ../../howto/enum.rst:902 msgid "" -"Mix-in types must be subclassable. For example, :class:`bool` and :class:" -"`range` are not subclassable and will throw an error during Enum creation if " -"used as the mix-in type." +"Mix-in types must be subclassable. For example, :class:`bool` " +"and :class:`range` are not subclassable and will throw an error during Enum " +"creation if used as the mix-in type." msgstr "" #: ../../howto/enum.rst:905 msgid "" "While :class:`Enum` can have members of any type, once you mix in an " -"additional type, all the members must have values of that type, e.g. :class:" -"`int` above. This restriction does not apply to mix-ins which only add " -"methods and don't specify another type." +"additional type, all the members must have values of that type, " +"e.g. :class:`int` above. This restriction does not apply to mix-ins which " +"only add methods and don't specify another type." msgstr "" #: ../../howto/enum.rst:909 @@ -1705,30 +1710,30 @@ msgstr "" #: ../../howto/enum.rst:912 msgid "" -"A ``data type`` is a mixin that defines :meth:`~object.__new__`, or a :class:" -"`~dataclasses.dataclass`" +"A ``data type`` is a mixin that defines :meth:`~object.__new__`, or " +"a :class:`~dataclasses.dataclass`" msgstr "" #: ../../howto/enum.rst:914 msgid "" -"%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` class's :meth:" -"`~object.__str__` and :meth:`~object.__repr__` respectively; other codes " -"(such as ``%i`` or ``%h`` for IntEnum) treat the enum member as its mixed-in " -"type." +"%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` " +"class's :meth:`~object.__str__` and :meth:`~object.__repr__` respectively; " +"other codes (such as ``%i`` or ``%h`` for IntEnum) treat the enum member as " +"its mixed-in type." msgstr "" #: ../../howto/enum.rst:917 msgid "" -":ref:`Formatted string literals <f-strings>`, :meth:`str.format`, and :func:" -"`format` will use the enum's :meth:`~object.__str__` method." +":ref:`Formatted string literals <f-strings>`, :meth:`str.format`, " +"and :func:`format` will use the enum's :meth:`~object.__str__` method." msgstr "" #: ../../howto/enum.rst:922 msgid "" "Because :class:`IntEnum`, :class:`IntFlag`, and :class:`StrEnum` are " -"designed to be drop-in replacements for existing constants, their :meth:" -"`~object.__str__` method has been reset to their data types' :meth:`~object." -"__str__` method." +"designed to be drop-in replacements for existing constants, " +"their :meth:`~object.__str__` method has been reset to their data " +"types' :meth:`~object.__str__` method." msgstr "" #: ../../howto/enum.rst:930 @@ -1739,8 +1744,8 @@ msgstr "" msgid "" ":meth:`~object.__new__` must be used whenever you want to customize the " "actual value of the :class:`Enum` member. Any other modifications may go in " -"either :meth:`~object.__new__` or :meth:`~object.__init__`, with :meth:" -"`~object.__init__` being preferred." +"either :meth:`~object.__new__` or :meth:`~object.__init__`, " +"with :meth:`~object.__init__` being preferred." msgstr "" #: ../../howto/enum.rst:936 @@ -1786,7 +1791,7 @@ msgstr "" #: ../../howto/enum.rst:971 msgid "Supported ``__dunder__`` names" -msgstr "" +msgstr "有支援的 ``__dunder__`` 名稱" #: ../../howto/enum.rst:973 msgid "" @@ -1797,14 +1802,14 @@ msgstr "" #: ../../howto/enum.rst:976 msgid "" ":meth:`~object.__new__`, if specified, must create and return the enum " -"members; it is also a very good idea to set the member's :attr:`~Enum." -"_value_` appropriately. Once all the members are created it is no longer " -"used." +"members; it is also a very good idea to set the " +"member's :attr:`~Enum._value_` appropriately. Once all the members are " +"created it is no longer used." msgstr "" #: ../../howto/enum.rst:982 msgid "Supported ``_sunder_`` names" -msgstr "" +msgstr "有支援的 ``_sunder_`` 名稱" #: ../../howto/enum.rst:984 msgid ":attr:`~Enum._name_` -- name of the member" @@ -1822,9 +1827,9 @@ msgstr "" #: ../../howto/enum.rst:988 msgid "" -":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" -"class:`str`, that will not be transformed into members, and will be removed " -"from the final class" +":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or " +"a :class:`str`, that will not be transformed into members, and will be " +"removed from the final class" msgstr "" #: ../../howto/enum.rst:991 @@ -1872,7 +1877,7 @@ msgstr "``_ignore_``" #: ../../howto/enum.rst:1011 msgid "``_add_alias_``, ``_add_value_alias_``" -msgstr "" +msgstr "``_add_alias_``、``_add_value_alias_``" #: ../../howto/enum.rst:1013 msgid "" @@ -1968,11 +1973,11 @@ msgstr "" #: ../../howto/enum.rst:1074 msgid "" -"Enum classes that are mixed with non-:class:`Enum` types (such as :class:" -"`int`, :class:`str`, etc.) are evaluated according to the mixed-in type's " -"rules; otherwise, all members evaluate as :data:`True`. To make your own " -"enum's boolean evaluation depend on the member's value add the following to " -"your class::" +"Enum classes that are mixed with non-:class:`Enum` types (such " +"as :class:`int`, :class:`str`, etc.) are evaluated according to the mixed-in " +"type's rules; otherwise, all members evaluate as :data:`True`. To make your " +"own enum's boolean evaluation depend on the member's value add the following " +"to your class::" msgstr "" #: ../../howto/enum.rst:1080 @@ -2000,23 +2005,23 @@ msgstr "" #: ../../howto/enum.rst:1093 msgid "" -">>> dir(Planet) \n" +">>> dir(Planet)\n" "['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', " "'VENUS', '__class__', '__doc__', '__members__', '__module__']\n" -">>> dir(Planet.EARTH) \n" +">>> dir(Planet.EARTH)\n" "['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', " "'surface_gravity', 'value']" msgstr "" -">>> dir(Planet) \n" +">>> dir(Planet)\n" "['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', " "'VENUS', '__class__', '__doc__', '__members__', '__module__']\n" -">>> dir(Planet.EARTH) \n" +">>> dir(Planet.EARTH)\n" "['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', " "'surface_gravity', 'value']" #: ../../howto/enum.rst:1100 msgid "Combining members of ``Flag``" -msgstr "" +msgstr "``Flag`` 的成員組合" #: ../../howto/enum.rst:1102 msgid "" @@ -2196,23 +2201,23 @@ msgstr "" #: ../../howto/enum.rst:1193 msgid "STRICT --> raises an exception when presented with invalid values" -msgstr "" +msgstr "STRICT --> 當遇到無效值時引發例外" #: ../../howto/enum.rst:1194 msgid "CONFORM --> discards any invalid bits" -msgstr "" +msgstr "CONFORM --> 捨棄任何無效位元" #: ../../howto/enum.rst:1195 msgid "EJECT --> lose Flag status and become a normal int with the given value" -msgstr "" +msgstr "EJECT --> 失去 Flag 狀態並成為具有給定值的普通 int" #: ../../howto/enum.rst:1196 msgid "KEEP --> keep the extra bits" -msgstr "" +msgstr "KEEP --> 保留額外位元" #: ../../howto/enum.rst:1198 msgid "keeps Flag status and extra bits" -msgstr "" +msgstr "保留 Flag 狀態和額外位元" #: ../../howto/enum.rst:1199 msgid "extra bits do not show up in iteration" @@ -2225,18 +2230,18 @@ msgstr "" #: ../../howto/enum.rst:1202 msgid "" "The default for Flag is ``STRICT``, the default for ``IntFlag`` is " -"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see ``ssl." -"Options`` for an example of when ``KEEP`` is needed)." +"``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see " +"``ssl.Options`` for an example of when ``KEEP`` is needed)." msgstr "" #: ../../howto/enum.rst:1210 msgid "How are Enums and Flags different?" -msgstr "" +msgstr "Enums 和 Flags 有何不同?" #: ../../howto/enum.rst:1212 msgid "" -"Enums have a custom metaclass that affects many aspects of both derived :" -"class:`Enum` classes and their instances (members)." +"Enums have a custom metaclass that affects many aspects of both " +"derived :class:`Enum` classes and their instances (members)." msgstr "" #: ../../howto/enum.rst:1217 @@ -2245,14 +2250,14 @@ msgstr "Enum 類別" #: ../../howto/enum.rst:1219 msgid "" -"The :class:`EnumType` metaclass is responsible for providing the :meth:" -"`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` " +"The :class:`EnumType` metaclass is responsible for providing " +"the :meth:`~object.__contains__`, :meth:`~object.__dir__`, :meth:`~object.__iter__` " "and other methods that allow one to do things with an :class:`Enum` class " "that fail on a typical class, such as ``list(Color)`` or ``some_enum_var in " "Color``. :class:`EnumType` is responsible for ensuring that various other " -"methods on the final :class:`Enum` class are correct (such as :meth:`~object." -"__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` and :meth:" -"`~object.__repr__`)." +"methods on the final :class:`Enum` class are correct (such " +"as :meth:`~object.__new__`, :meth:`~object.__getnewargs__`, :meth:`~object.__str__` " +"and :meth:`~object.__repr__`)." msgstr "" #: ../../howto/enum.rst:1228 @@ -2263,8 +2268,8 @@ msgstr "Flag 類別" msgid "" "Flags have an expanded view of aliasing: to be canonical, the value of a " "flag needs to be a power-of-two value, and not a duplicate name. So, in " -"addition to the :class:`Enum` definition of alias, a flag with no value (a.k." -"a. ``0``) or with more than one power-of-two value (e.g. ``3``) is " +"addition to the :class:`Enum` definition of alias, a flag with no value " +"(a.k.a. ``0``) or with more than one power-of-two value (e.g. ``3``) is " "considered an alias." msgstr "" @@ -2274,11 +2279,11 @@ msgstr "" #: ../../howto/enum.rst:1238 msgid "" -"The most interesting thing about enum members is that they are singletons. :" -"class:`EnumType` creates them all while it is creating the enum class " -"itself, and then puts a custom :meth:`~object.__new__` in place to ensure " -"that no new ones are ever instantiated by returning only the existing member " -"instances." +"The most interesting thing about enum members is that they are " +"singletons. :class:`EnumType` creates them all while it is creating the enum " +"class itself, and then puts a custom :meth:`~object.__new__` in place to " +"ensure that no new ones are ever instantiated by returning only the existing " +"member instances." msgstr "" #: ../../howto/enum.rst:1244 @@ -2337,15 +2342,16 @@ msgstr "" #: ../../howto/enum.rst:1273 msgid "" -"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, and :" -"class:`IntFlag` are expected to cover the majority of use-cases, they cannot " -"cover them all. Here are recipes for some different types of enumerations " -"that can be used directly, or as examples for creating one's own." +"While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, " +"and :class:`IntFlag` are expected to cover the majority of use-cases, they " +"cannot cover them all. Here are recipes for some different types of " +"enumerations that can be used directly, or as examples for creating one's " +"own." msgstr "" #: ../../howto/enum.rst:1280 msgid "Omitting values" -msgstr "" +msgstr "省略值" #: ../../howto/enum.rst:1282 msgid "" @@ -2384,7 +2390,7 @@ msgstr "使用 :class:`auto`" #: ../../howto/enum.rst:1299 msgid "Using :class:`auto` would look like::" -msgstr "" +msgstr "使用 :class:`auto` 會像這樣: ::" #: ../../howto/enum.rst:1301 msgid "" @@ -2410,7 +2416,7 @@ msgstr "使用 :class:`object`" #: ../../howto/enum.rst:1313 msgid "Using :class:`object` would look like::" -msgstr "" +msgstr "使用 :class:`object` 會像這樣: ::" #: ../../howto/enum.rst:1315 msgid "" @@ -2419,7 +2425,7 @@ msgid "" "... GREEN = object()\n" "... BLUE = object()\n" "...\n" -">>> Color.GREEN \n" +">>> Color.GREEN\n" "<Color.GREEN: <object object at 0x...>>" msgstr "" ">>> class Color(Enum):\n" @@ -2427,13 +2433,13 @@ msgstr "" "... GREEN = object()\n" "... BLUE = object()\n" "...\n" -">>> Color.GREEN \n" +">>> Color.GREEN\n" "<Color.GREEN: <object object at 0x...>>" #: ../../howto/enum.rst:1323 msgid "" -"This is also a good example of why you might want to write your own :meth:" -"`~object.__repr__`::" +"This is also a good example of why you might want to write your " +"own :meth:`~object.__repr__`::" msgstr "" #: ../../howto/enum.rst:1326 @@ -2486,7 +2492,7 @@ msgstr "" #: ../../howto/enum.rst:1353 msgid "Using a custom :meth:`~object.__new__`" -msgstr "" +msgstr "使用自訂的 :meth:`~object.__new__`" #: ../../howto/enum.rst:1355 msgid "Using an auto-numbering :meth:`~object.__new__` would look like::" @@ -2774,11 +2780,11 @@ msgid "" "... Period['day_%d' % i] = i\n" "...\n" ">>> list(Period)[:2]\n" -"[<Period.day_0: datetime.timedelta(0)>, <Period.day_1: datetime." -"timedelta(days=1)>]\n" +"[<Period.day_0: datetime.timedelta(0)>, <Period.day_1: " +"datetime.timedelta(days=1)>]\n" ">>> list(Period)[-2:]\n" -"[<Period.day_365: datetime.timedelta(days=365)>, <Period.day_366: datetime." -"timedelta(days=366)>]" +"[<Period.day_365: datetime.timedelta(days=365)>, <Period.day_366: " +"datetime.timedelta(days=366)>]" msgstr "" #: ../../howto/enum.rst:1558 diff --git a/howto/functional.po b/howto/functional.po index 15ccb13599..b41774276d 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -20,7 +20,7 @@ msgstr "" #: ../../howto/functional.rst:5 msgid "Functional Programming HOWTO" -msgstr "函式編程 HOWTO" +msgstr "函式程式設計 HOWTO" #: ../../howto/functional.rst:0 msgid "Author" @@ -1011,11 +1011,11 @@ msgid "" ">>> import random\n" ">>> # Generate 8 random numbers between [0, 10000)\n" ">>> rand_list = random.sample(range(10000), 8)\n" -">>> rand_list \n" +">>> rand_list\n" "[769, 7953, 9828, 6431, 8442, 9878, 6213, 2207]\n" -">>> sorted(rand_list) \n" +">>> sorted(rand_list)\n" "[769, 2207, 6213, 6431, 7953, 8442, 9828, 9878]\n" -">>> sorted(rand_list, reverse=True) \n" +">>> sorted(rand_list, reverse=True)\n" "[9878, 9828, 8442, 7953, 6431, 6213, 2207, 769]" msgstr "" diff --git a/howto/ipaddress.po b/howto/ipaddress.po index 69bef65056..b4124f004d 100644 --- a/howto/ipaddress.po +++ b/howto/ipaddress.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2024-07-20 16:09+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -54,7 +53,7 @@ msgstr "" #: ../../howto/ipaddress.rst:24 msgid "Creating Address/Network/Interface objects" -msgstr "" +msgstr "建立 Address/Network/Interface 物件" #: ../../howto/ipaddress.rst:26 msgid "" @@ -146,8 +145,8 @@ msgstr "定義網路" #: ../../howto/ipaddress.rst:84 msgid "" -"Host addresses are usually grouped together into IP networks, so :mod:" -"`ipaddress` provides a way to create, inspect and manipulate network " +"Host addresses are usually grouped together into IP networks, " +"so :mod:`ipaddress` provides a way to create, inspect and manipulate network " "definitions. IP network objects are constructed from strings that define the " "range of host addresses that are part of that network. The simplest form for " "that information is a \"network address/network prefix\" pair, where the " @@ -243,11 +242,11 @@ msgid "" "network, neither the address nor the network classes are sufficient. " "Notation like ``192.0.2.1/24`` is commonly used by network engineers and the " "people who write tools for firewalls and routers as shorthand for \"the host " -"``192.0.2.1`` on the network ``192.0.2.0/24``\", Accordingly, :mod:" -"`ipaddress` provides a set of hybrid classes that associate an address with " -"a particular network. The interface for creation is identical to that for " -"defining network objects, except that the address portion isn't constrained " -"to being a network address." +"``192.0.2.1`` on the network ``192.0.2.0/24``\", " +"Accordingly, :mod:`ipaddress` provides a set of hybrid classes that " +"associate an address with a particular network. The interface for creation " +"is identical to that for defining network objects, except that the address " +"portion isn't constrained to being a network address." msgstr "" #: ../../howto/ipaddress.rst:152 @@ -258,13 +257,13 @@ msgstr "" #: ../../howto/ipaddress.rst:157 msgid "Inspecting Address/Network/Interface Objects" -msgstr "" +msgstr "檢視 Address/Network/Interface 物件" #: ../../howto/ipaddress.rst:159 msgid "" "You've gone to the trouble of creating an IPv(4|6)(Address|Network|" -"Interface) object, so you probably want to get information about it. :mod:" -"`ipaddress` tries to make doing this easy and intuitive." +"Interface) object, so you probably want to get information about " +"it. :mod:`ipaddress` tries to make doing this easy and intuitive." msgstr "" #: ../../howto/ipaddress.rst:163 @@ -335,7 +334,7 @@ msgstr "" msgid "" ">>> net4 = ipaddress.ip_network('192.0.2.0/24')\n" ">>> for x in net4.hosts():\n" -"... print(x) \n" +"... print(x)\n" "192.0.2.1\n" "192.0.2.2\n" "192.0.2.3\n" @@ -347,7 +346,7 @@ msgid "" msgstr "" ">>> net4 = ipaddress.ip_network('192.0.2.0/24')\n" ">>> for x in net4.hosts():\n" -"... print(x) \n" +"... print(x)\n" "192.0.2.1\n" "192.0.2.2\n" "192.0.2.3\n" @@ -436,6 +435,8 @@ msgid "" "if address in network:\n" " # do something" msgstr "" +"if address in network:\n" +" # 做某些事情" #: ../../howto/ipaddress.rst:259 msgid "Containment testing is done efficiently based on the network prefix::" @@ -457,7 +458,7 @@ msgstr "" #: ../../howto/ipaddress.rst:269 msgid "Comparisons" -msgstr "" +msgstr "比較" #: ../../howto/ipaddress.rst:271 msgid "" @@ -521,9 +522,9 @@ msgstr "" #: ../../howto/ipaddress.rst:305 msgid "" "To support use cases where it is useful to have access to this additional " -"detail, the individual class constructors actually raise the :exc:" -"`ValueError` subclasses :exc:`ipaddress.AddressValueError` and :exc:" -"`ipaddress.NetmaskValueError` to indicate exactly which part of the " +"detail, the individual class constructors actually raise " +"the :exc:`ValueError` subclasses :exc:`ipaddress.AddressValueError` " +"and :exc:`ipaddress.NetmaskValueError` to indicate exactly which part of the " "definition failed to parse correctly." msgstr "" @@ -587,3 +588,7 @@ msgid "" "except ValueError:\n" " print('address/netmask is invalid for IPv4:', address)" msgstr "" +"try:\n" +" network = ipaddress.IPv4Network(address)\n" +"except ValueError:\n" +" print('address/netmask is invalid for IPv4:', address)" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index 340d2075f3..725f48933a 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-08 00:13+0000\n" +"POT-Creation-Date: 2025-02-21 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -68,8 +68,8 @@ msgid "" "ch = logging.StreamHandler()\n" "ch.setLevel(logging.ERROR)\n" "# create formatter and add it to the handlers\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " -"%(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" +"(message)s')\n" "fh.setFormatter(formatter)\n" "ch.setFormatter(formatter)\n" "# add the handlers to the logger\n" @@ -100,8 +100,8 @@ msgid "" "\n" "class Auxiliary:\n" " def __init__(self):\n" -" self.logger = logging.getLogger('spam_application.auxiliary." -"Auxiliary')\n" +" self.logger = " +"logging.getLogger('spam_application.auxiliary.Auxiliary')\n" " self.logger.info('creating an instance of Auxiliary')\n" "\n" " def do_something(self):\n" @@ -163,8 +163,8 @@ msgid "" " time.sleep(0.5)\n" "\n" "def main():\n" -" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d " -"%(threadName)s %(message)s')\n" +" logging.basicConfig(level=logging.DEBUG, format='%(relativeCreated)6d %" +"(threadName)s %(message)s')\n" " info = {'stop': False}\n" " thread = threading.Thread(target=worker, args=(info,))\n" " thread.start()\n" @@ -241,8 +241,8 @@ msgid "" "ch = logging.StreamHandler()\n" "ch.setLevel(logging.ERROR)\n" "# create formatter and add it to the handlers\n" -"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - " -"%(message)s')\n" +"formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %" +"(message)s')\n" "ch.setFormatter(formatter)\n" "fh.setFormatter(formatter)\n" "# add the handlers to logger\n" @@ -295,8 +295,8 @@ msgid "" "\n" "# set up logging to file - see previous section for more details\n" "logging.basicConfig(level=logging.DEBUG,\n" -" format='%(asctime)s %(name)-12s %(levelname)-8s " -"%(message)s',\n" +" format='%(asctime)s %(name)-12s %(levelname)-8s %" +"(message)s',\n" " datefmt='%m-%d %H:%M',\n" " filename='/tmp/myapp.log',\n" " filemode='w')\n" @@ -504,9 +504,9 @@ msgid "" "a function which only returns ``True`` if the level of the passed in record " "is at or below the specified level. Note that in this example I have defined " "the ``filter_maker`` in a test script ``main.py`` that I run from the " -"command line, so its module will be ``__main__`` - hence the ``__main__." -"filter_maker`` in the filter configuration. You will need to change that if " -"you define it in a different module." +"command line, so its module will be ``__main__`` - hence the " +"``__main__.filter_maker`` in the filter configuration. You will need to " +"change that if you define it in a different module." msgstr "" #: ../../howto/logging-cookbook.rst:387 @@ -683,6 +683,22 @@ msgid "" "s.close()\n" "print('complete')" msgstr "" +"#!/usr/bin/env python\n" +"import socket, sys, struct\n" +"\n" +"with open(sys.argv[1], 'rb') as f:\n" +" data_to_send = f.read()\n" +"\n" +"HOST = 'localhost'\n" +"PORT = 9999\n" +"s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"print('connecting...')\n" +"s.connect((HOST, PORT))\n" +"print('sending config...')\n" +"s.send(struct.pack('>L', len(data_to_send)))\n" +"s.send(data_to_send)\n" +"s.close()\n" +"print('complete')" #: ../../howto/logging-cookbook.rst:547 msgid "Dealing with handlers that block" @@ -697,13 +713,13 @@ msgstr "" #: ../../howto/logging-cookbook.rst:555 msgid "" -"A common culprit which demonstrates sluggish behaviour is the :class:" -"`SMTPHandler`: sending emails can take a long time, for a number of reasons " -"outside the developer's control (for example, a poorly performing mail or " -"network infrastructure). But almost any network-based handler can block: " -"Even a :class:`SocketHandler` operation may do a DNS query under the hood " -"which is too slow (and this query can be deep in the socket library code, " -"below the Python layer, and outside your control)." +"A common culprit which demonstrates sluggish behaviour is " +"the :class:`SMTPHandler`: sending emails can take a long time, for a number " +"of reasons outside the developer's control (for example, a poorly performing " +"mail or network infrastructure). But almost any network-based handler can " +"block: Even a :class:`SocketHandler` operation may do a DNS query under the " +"hood which is too slow (and this query can be deep in the socket library " +"code, below the Python layer, and outside your control)." msgstr "" #: ../../howto/logging-cookbook.rst:563 @@ -723,12 +739,12 @@ msgstr "" #: ../../howto/logging-cookbook.rst:574 msgid "" "The second part of the solution is :class:`QueueListener`, which has been " -"designed as the counterpart to :class:`QueueHandler`. A :class:" -"`QueueListener` is very simple: it's passed a queue and some handlers, and " -"it fires up an internal thread which listens to its queue for LogRecords " -"sent from ``QueueHandlers`` (or any other source of ``LogRecords``, for that " -"matter). The ``LogRecords`` are removed from the queue and passed to the " -"handlers for processing." +"designed as the counterpart to :class:`QueueHandler`. " +"A :class:`QueueListener` is very simple: it's passed a queue and some " +"handlers, and it fires up an internal thread which listens to its queue for " +"LogRecords sent from ``QueueHandlers`` (or any other source of " +"``LogRecords``, for that matter). The ``LogRecords`` are removed from the " +"queue and passed to the handlers for processing." msgstr "" #: ../../howto/logging-cookbook.rst:582 @@ -776,10 +792,10 @@ msgid "" "Although the earlier discussion wasn't specifically talking about async " "code, but rather about slow logging handlers, it should be noted that when " "logging from async code, network and even file handlers could lead to " -"problems (blocking the event loop) because some logging is done from :mod:" -"`asyncio` internals. It might be best, if any async code is used in an " -"application, to use the above approach for logging, so that any blocking " -"code runs only in the ``QueueListener`` thread." +"problems (blocking the event loop) because some logging is done " +"from :mod:`asyncio` internals. It might be best, if any async code is used " +"in an application, to use the above approach for logging, so that any " +"blocking code runs only in the ``QueueListener`` thread." msgstr "" #: ../../howto/logging-cookbook.rst:619 @@ -801,8 +817,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:634 msgid "" "Let's say you want to send logging events across a network, and handle them " -"at the receiving end. A simple way of doing this is attaching a :class:" -"`SocketHandler` instance to the root logger at the sending end::" +"at the receiving end. A simple way of doing this is attaching " +"a :class:`SocketHandler` instance to the root logger at the sending end::" msgstr "" #: ../../howto/logging-cookbook.rst:638 @@ -835,8 +851,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:662 msgid "" -"At the receiving end, you can set up a receiver using the :mod:" -"`socketserver` module. Here is a basic working example::" +"At the receiving end, you can set up a receiver using " +"the :mod:`socketserver` module. Here is a basic working example::" msgstr "" #: ../../howto/logging-cookbook.rst:665 @@ -920,8 +936,8 @@ msgid "" "\n" "def main():\n" " logging.basicConfig(\n" -" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s " -"%(message)s')\n" +" format='%(relativeCreated)5d %(name)-15s %(levelname)-8s %" +"(message)s')\n" " tcpserver = LogRecordSocketReceiver()\n" " print('About to start TCP server...')\n" " tcpserver.serve_until_stopped()\n" @@ -1054,8 +1070,8 @@ msgstr "" #: ../../howto/logging-cookbook.rst:811 msgid "" -"Download `the Gist <socket-listener-gist_>`__ as a ZIP archive using the :" -"guilabel:`Download ZIP` button." +"Download `the Gist <socket-listener-gist_>`__ as a ZIP archive using " +"the :guilabel:`Download ZIP` button." msgstr "" #: ../../howto/logging-cookbook.rst:814 @@ -1102,11 +1118,32 @@ msgid "" "configured ports clash with something else in your test environment." msgstr "" -#: ../../howto/logging-cookbook.rst:843 +#: ../../howto/logging-cookbook.rst:838 +msgid "" +"The default configuration uses a TCP socket on port 9020. You can use a Unix " +"Domain socket instead of a TCP socket by doing the following:" +msgstr "" + +#: ../../howto/logging-cookbook.rst:841 +msgid "" +"In :file:`listener.json`, add a ``socket`` key with the path to the domain " +"socket you want to use. If this key is present, the listener listens on the " +"corresponding domain socket and not on a TCP socket (the ``port`` key is " +"ignored)." +msgstr "" + +#: ../../howto/logging-cookbook.rst:846 +msgid "" +"In :file:`webapp.json`, change the socket handler configuration dictionary " +"so that the ``host`` value is the path to the domain socket, and set the " +"``port`` value to ``null``." +msgstr "" + +#: ../../howto/logging-cookbook.rst:856 msgid "Adding contextual information to your logging output" msgstr "" -#: ../../howto/logging-cookbook.rst:845 +#: ../../howto/logging-cookbook.rst:858 msgid "" "Sometimes you want logging output to contain contextual information in " "addition to the parameters passed to the logging call. For example, in a " @@ -1118,37 +1155,37 @@ msgid "" "is not a good idea because these instances are not garbage collected. While " "this is not a problem in practice, when the number of :class:`Logger` " "instances is dependent on the level of granularity you want to use in " -"logging an application, it could be hard to manage if the number of :class:" -"`Logger` instances becomes effectively unbounded." +"logging an application, it could be hard to manage if the number " +"of :class:`Logger` instances becomes effectively unbounded." msgstr "" -#: ../../howto/logging-cookbook.rst:860 +#: ../../howto/logging-cookbook.rst:873 msgid "Using LoggerAdapters to impart contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:862 +#: ../../howto/logging-cookbook.rst:875 msgid "" "An easy way in which you can pass contextual information to be output along " "with logging event information is to use the :class:`LoggerAdapter` class. " -"This class is designed to look like a :class:`Logger`, so that you can call :" -"meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:" -"`exception`, :meth:`critical` and :meth:`log`. These methods have the same " -"signatures as their counterparts in :class:`Logger`, so you can use the two " -"types of instances interchangeably." +"This class is designed to look like a :class:`Logger`, so that you can " +"call :meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`, :meth:`exception`, :meth:`critical` " +"and :meth:`log`. These methods have the same signatures as their " +"counterparts in :class:`Logger`, so you can use the two types of instances " +"interchangeably." msgstr "" -#: ../../howto/logging-cookbook.rst:870 +#: ../../howto/logging-cookbook.rst:883 msgid "" -"When you create an instance of :class:`LoggerAdapter`, you pass it a :class:" -"`Logger` instance and a dict-like object which contains your contextual " -"information. When you call one of the logging methods on an instance of :" -"class:`LoggerAdapter`, it delegates the call to the underlying instance of :" -"class:`Logger` passed to its constructor, and arranges to pass the " -"contextual information in the delegated call. Here's a snippet from the code " -"of :class:`LoggerAdapter`::" +"When you create an instance of :class:`LoggerAdapter`, you pass it " +"a :class:`Logger` instance and a dict-like object which contains your " +"contextual information. When you call one of the logging methods on an " +"instance of :class:`LoggerAdapter`, it delegates the call to the underlying " +"instance of :class:`Logger` passed to its constructor, and arranges to pass " +"the contextual information in the delegated call. Here's a snippet from the " +"code of :class:`LoggerAdapter`::" msgstr "" -#: ../../howto/logging-cookbook.rst:878 +#: ../../howto/logging-cookbook.rst:891 msgid "" "def debug(self, msg, /, *args, **kwargs):\n" " \"\"\"\n" @@ -1159,7 +1196,7 @@ msgid "" " self.logger.debug(msg, *args, **kwargs)" msgstr "" -#: ../../howto/logging-cookbook.rst:886 +#: ../../howto/logging-cookbook.rst:899 msgid "" "The :meth:`~LoggerAdapter.process` method of :class:`LoggerAdapter` is where " "the contextual information is added to the logging output. It's passed the " @@ -1172,18 +1209,19 @@ msgid "" "be silently overwritten." msgstr "" -#: ../../howto/logging-cookbook.rst:895 +#: ../../howto/logging-cookbook.rst:908 msgid "" "The advantage of using 'extra' is that the values in the dict-like object " "are merged into the :class:`LogRecord` instance's __dict__, allowing you to " "use customized strings with your :class:`Formatter` instances which know " "about the keys of the dict-like object. If you need a different method, e.g. " "if you want to prepend or append the contextual information to the message " -"string, you just need to subclass :class:`LoggerAdapter` and override :meth:" -"`~LoggerAdapter.process` to do what you need. Here is a simple example::" +"string, you just need to subclass :class:`LoggerAdapter` and " +"override :meth:`~LoggerAdapter.process` to do what you need. Here is a " +"simple example::" msgstr "" -#: ../../howto/logging-cookbook.rst:903 +#: ../../howto/logging-cookbook.rst:916 msgid "" "class CustomAdapter(logging.LoggerAdapter):\n" " \"\"\"\n" @@ -1194,27 +1232,27 @@ msgid "" " return '[%s] %s' % (self.extra['connid'], msg), kwargs" msgstr "" -#: ../../howto/logging-cookbook.rst:911 +#: ../../howto/logging-cookbook.rst:924 msgid "which you can use like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:913 +#: ../../howto/logging-cookbook.rst:926 msgid "" "logger = logging.getLogger(__name__)\n" "adapter = CustomAdapter(logger, {'connid': some_conn_id})" msgstr "" -#: ../../howto/logging-cookbook.rst:916 +#: ../../howto/logging-cookbook.rst:929 msgid "" "Then any events that you log to the adapter will have the value of " "``some_conn_id`` prepended to the log messages." msgstr "" -#: ../../howto/logging-cookbook.rst:920 +#: ../../howto/logging-cookbook.rst:933 msgid "Using objects other than dicts to pass contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:922 +#: ../../howto/logging-cookbook.rst:935 msgid "" "You don't need to pass an actual dict to a :class:`LoggerAdapter` - you " "could pass an instance of a class which implements ``__getitem__`` and " @@ -1223,32 +1261,32 @@ msgid "" "would be constant)." msgstr "" -#: ../../howto/logging-cookbook.rst:931 +#: ../../howto/logging-cookbook.rst:944 msgid "Using Filters to impart contextual information" msgstr "" -#: ../../howto/logging-cookbook.rst:933 +#: ../../howto/logging-cookbook.rst:946 msgid "" -"You can also add contextual information to log output using a user-defined :" -"class:`Filter`. ``Filter`` instances are allowed to modify the " +"You can also add contextual information to log output using a user-" +"defined :class:`Filter`. ``Filter`` instances are allowed to modify the " "``LogRecords`` passed to them, including adding additional attributes which " -"can then be output using a suitable format string, or if needed a custom :" -"class:`Formatter`." +"can then be output using a suitable format string, or if needed a " +"custom :class:`Formatter`." msgstr "" -#: ../../howto/logging-cookbook.rst:938 +#: ../../howto/logging-cookbook.rst:951 msgid "" "For example in a web application, the request being processed (or at least, " -"the interesting parts of it) can be stored in a threadlocal (:class:" -"`threading.local`) variable, and then accessed from a ``Filter`` to add, " -"say, information from the request - say, the remote IP address and remote " -"user's username - to the ``LogRecord``, using the attribute names 'ip' and " -"'user' as in the ``LoggerAdapter`` example above. In that case, the same " -"format string can be used to get similar output to that shown above. Here's " -"an example script::" +"the interesting parts of it) can be stored in a threadlocal " +"(:class:`threading.local`) variable, and then accessed from a ``Filter`` to " +"add, say, information from the request - say, the remote IP address and " +"remote user's username - to the ``LogRecord``, using the attribute names " +"'ip' and 'user' as in the ``LoggerAdapter`` example above. In that case, the " +"same format string can be used to get similar output to that shown above. " +"Here's an example script::" msgstr "" -#: ../../howto/logging-cookbook.rst:947 +#: ../../howto/logging-cookbook.rst:960 msgid "" "import logging\n" "from random import choice\n" @@ -1291,11 +1329,11 @@ msgid "" "'parameters')" msgstr "" -#: ../../howto/logging-cookbook.rst:984 +#: ../../howto/logging-cookbook.rst:997 msgid "which, when run, produces something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:986 +#: ../../howto/logging-cookbook.rst:999 msgid "" "2010-09-06 22:38:15,292 a.b.c DEBUG IP: 123.231.231.123 User: fred A " "debug message\n" @@ -1323,11 +1361,11 @@ msgid "" "message at INFO level with 2 parameters" msgstr "" -#: ../../howto/logging-cookbook.rst:1002 +#: ../../howto/logging-cookbook.rst:1015 msgid "Use of ``contextvars``" msgstr "" -#: ../../howto/logging-cookbook.rst:1004 +#: ../../howto/logging-cookbook.rst:1017 msgid "" "Since Python 3.7, the :mod:`contextvars` module has provided context-local " "storage which works for both :mod:`threading` and :mod:`asyncio` processing " @@ -1337,7 +1375,7 @@ msgid "" "attributes handled by web applications." msgstr "" -#: ../../howto/logging-cookbook.rst:1010 +#: ../../howto/logging-cookbook.rst:1023 msgid "" "For the purposes of illustration, say that you have different web " "applications, each independent of the other but running in the same Python " @@ -1348,11 +1386,11 @@ msgid "" "information such as client IP, HTTP request method and client username?" msgstr "" -#: ../../howto/logging-cookbook.rst:1017 +#: ../../howto/logging-cookbook.rst:1030 msgid "Let's assume that the library can be simulated by the following code:" msgstr "" -#: ../../howto/logging-cookbook.rst:1019 +#: ../../howto/logging-cookbook.rst:1032 msgid "" "# webapplib.py\n" "import logging\n" @@ -1367,14 +1405,14 @@ msgid "" " time.sleep(0.01)" msgstr "" -#: ../../howto/logging-cookbook.rst:1033 +#: ../../howto/logging-cookbook.rst:1046 msgid "" "We can simulate the multiple web applications by means of two simple " "classes, ``Request`` and ``WebApp``. These simulate how real threaded web " "applications work - each request is handled by a thread:" msgstr "" -#: ../../howto/logging-cookbook.rst:1037 +#: ../../howto/logging-cookbook.rst:1050 msgid "" "# main.py\n" "import argparse\n" @@ -1402,8 +1440,8 @@ msgid "" "\n" "# A dummy set of requests which will be used in the simulation - we'll just " "pick\n" -"# from this list randomly. Note that all GET requests are from 192.168.2." -"XXX\n" +"# from this list randomly. Note that all GET requests are from " +"192.168.2.XXX\n" "# addresses, whereas POST requests are from 192.16.3.XXX addresses. Three " "users\n" "# are represented in the sample requests.\n" @@ -1421,8 +1459,8 @@ msgid "" "information\n" "# such as HTTP method, client IP and username\n" "\n" -"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s " -"%(user)-6s %(ip)s %(method)-4s %(message)s')\n" +"formatter = logging.Formatter('%(threadName)-11s %(appName)s %(name)-9s %" +"(user)-6s %(ip)s %(method)-4s %(message)s')\n" "\n" "# Create our context variables. These will be filled at the start of " "request\n" @@ -1529,7 +1567,7 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1177 +#: ../../howto/logging-cookbook.rst:1190 msgid "" "If you run the above, you should find that roughly half the requests go " "into :file:`app1.log` and the rest into :file:`app2.log`, and the all the " @@ -1540,7 +1578,7 @@ msgid "" "illustrated by the following shell output:" msgstr "" -#: ../../howto/logging-cookbook.rst:1184 +#: ../../howto/logging-cookbook.rst:1197 msgid "" "~/logging-contextual-webapp$ python main.py\n" "app1 processed 51 requests\n" @@ -1595,11 +1633,11 @@ msgid "" "147" msgstr "" -#: ../../howto/logging-cookbook.rst:1224 +#: ../../howto/logging-cookbook.rst:1237 msgid "Imparting contextual information in handlers" msgstr "" -#: ../../howto/logging-cookbook.rst:1226 +#: ../../howto/logging-cookbook.rst:1239 msgid "" "Each :class:`~Handler` has its own chain of filters. If you want to add " "contextual information to a :class:`LogRecord` without leaking it to other " @@ -1607,7 +1645,7 @@ msgid "" "instead of modifying it in-place, as shown in the following script::" msgstr "" -#: ../../howto/logging-cookbook.rst:1231 +#: ../../howto/logging-cookbook.rst:1244 msgid "" "import copy\n" "import logging\n" @@ -1628,12 +1666,30 @@ msgid "" "\n" " logger.info('A log message')" msgstr "" +"import copy\n" +"import logging\n" +"\n" +"def filter(record: logging.LogRecord):\n" +" record = copy.copy(record)\n" +" record.user = 'jim'\n" +" return record\n" +"\n" +"if __name__ == '__main__':\n" +" logger = logging.getLogger()\n" +" logger.setLevel(logging.INFO)\n" +" handler = logging.StreamHandler()\n" +" formatter = logging.Formatter('%(message)s from %(user)-8s')\n" +" handler.setFormatter(formatter)\n" +" handler.addFilter(filter)\n" +" logger.addHandler(handler)\n" +"\n" +" logger.info('A log message')" -#: ../../howto/logging-cookbook.rst:1253 +#: ../../howto/logging-cookbook.rst:1266 msgid "Logging to a single file from multiple processes" msgstr "" -#: ../../howto/logging-cookbook.rst:1255 +#: ../../howto/logging-cookbook.rst:1268 msgid "" "Although logging is thread-safe, and logging to a single file from multiple " "threads in a single process *is* supported, logging to a single file from " @@ -1643,21 +1699,22 @@ msgid "" "this is to have all the processes log to a :class:`~handlers.SocketHandler`, " "and have a separate process which implements a socket server which reads " "from the socket and logs to file. (If you prefer, you can dedicate one " -"thread in one of the existing processes to perform this function.) :ref:" -"`This section <network-logging>` documents this approach in more detail and " -"includes a working socket receiver which can be used as a starting point for " -"you to adapt in your own applications." +"thread in one of the existing processes to perform this " +"function.) :ref:`This section <network-logging>` documents this approach in " +"more detail and includes a working socket receiver which can be used as a " +"starting point for you to adapt in your own applications." msgstr "" -#: ../../howto/logging-cookbook.rst:1268 +#: ../../howto/logging-cookbook.rst:1281 msgid "" -"You could also write your own handler which uses the :class:" -"`~multiprocessing.Lock` class from the :mod:`multiprocessing` module to " -"serialize access to the file from your processes. The stdlib :class:" -"`FileHandler` and subclasses do not make use of :mod:`multiprocessing`." +"You could also write your own handler which uses " +"the :class:`~multiprocessing.Lock` class from the :mod:`multiprocessing` " +"module to serialize access to the file from your processes. The " +"stdlib :class:`FileHandler` and subclasses do not make use " +"of :mod:`multiprocessing`." msgstr "" -#: ../../howto/logging-cookbook.rst:1275 +#: ../../howto/logging-cookbook.rst:1288 msgid "" "Alternatively, you can use a ``Queue`` and a :class:`QueueHandler` to send " "all logging events to one of the processes in your multi-process " @@ -1672,7 +1729,7 @@ msgid "" "requirements::" msgstr "" -#: ../../howto/logging-cookbook.rst:1286 +#: ../../howto/logging-cookbook.rst:1299 msgid "" "# You'll need these imports in your own code\n" "import logging\n" @@ -1705,8 +1762,8 @@ msgid "" "def listener_configurer():\n" " root = logging.getLogger()\n" " h = logging.handlers.RotatingFileHandler('mptest.log', 'a', 300, 10)\n" -" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s " -"%(levelname)-8s %(message)s')\n" +" f = logging.Formatter('%(asctime)s %(processName)-10s %(name)s %" +"(levelname)-8s %(message)s')\n" " h.setFormatter(f)\n" " root.addHandler(h)\n" "\n" @@ -1792,13 +1849,13 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1391 +#: ../../howto/logging-cookbook.rst:1404 msgid "" "A variant of the above script keeps the logging in the main process, in a " "separate thread::" msgstr "" -#: ../../howto/logging-cookbook.rst:1394 +#: ../../howto/logging-cookbook.rst:1407 msgid "" "import logging\n" "import logging.config\n" @@ -1838,8 +1895,8 @@ msgid "" " 'formatters': {\n" " 'detailed': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " -"%(processName)-10s %(message)s'\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %" +"(processName)-10s %(message)s'\n" " }\n" " },\n" " 'handlers': {\n" @@ -1895,7 +1952,7 @@ msgid "" " lp.join()" msgstr "" -#: ../../howto/logging-cookbook.rst:1486 +#: ../../howto/logging-cookbook.rst:1499 msgid "" "This variant shows how you can e.g. apply configuration for particular " "loggers - e.g. the ``foo`` logger has a special handler which stores all " @@ -1905,36 +1962,36 @@ msgid "" "appropriate destinations." msgstr "" -#: ../../howto/logging-cookbook.rst:1493 +#: ../../howto/logging-cookbook.rst:1506 msgid "Using concurrent.futures.ProcessPoolExecutor" msgstr "使用 concurrent.futures.ProcessPoolExecutor" -#: ../../howto/logging-cookbook.rst:1495 +#: ../../howto/logging-cookbook.rst:1508 msgid "" "If you want to use :class:`concurrent.futures.ProcessPoolExecutor` to start " "your worker processes, you need to create the queue slightly differently. " "Instead of" msgstr "" -#: ../../howto/logging-cookbook.rst:1499 +#: ../../howto/logging-cookbook.rst:1512 msgid "queue = multiprocessing.Queue(-1)" msgstr "queue = multiprocessing.Queue(-1)" -#: ../../howto/logging-cookbook.rst:1503 +#: ../../howto/logging-cookbook.rst:1516 msgid "you should use" msgstr "" -#: ../../howto/logging-cookbook.rst:1505 +#: ../../howto/logging-cookbook.rst:1518 msgid "" "queue = multiprocessing.Manager().Queue(-1) # also works with the examples " "above" msgstr "" -#: ../../howto/logging-cookbook.rst:1509 +#: ../../howto/logging-cookbook.rst:1522 msgid "and you can then replace the worker creation from this::" msgstr "" -#: ../../howto/logging-cookbook.rst:1511 +#: ../../howto/logging-cookbook.rst:1524 msgid "" "workers = []\n" "for i in range(10):\n" @@ -1946,22 +2003,22 @@ msgid "" " w.join()" msgstr "" -#: ../../howto/logging-cookbook.rst:1520 +#: ../../howto/logging-cookbook.rst:1533 msgid "to this (remembering to first import :mod:`concurrent.futures`)::" msgstr "" -#: ../../howto/logging-cookbook.rst:1522 +#: ../../howto/logging-cookbook.rst:1535 msgid "" "with concurrent.futures.ProcessPoolExecutor(max_workers=10) as executor:\n" " for i in range(10):\n" " executor.submit(worker_process, queue, worker_configurer)" msgstr "" -#: ../../howto/logging-cookbook.rst:1527 +#: ../../howto/logging-cookbook.rst:1540 msgid "Deploying Web applications using Gunicorn and uWSGI" msgstr "" -#: ../../howto/logging-cookbook.rst:1529 +#: ../../howto/logging-cookbook.rst:1542 msgid "" "When deploying Web applications using `Gunicorn <https://gunicorn.org/>`_ or " "`uWSGI <https://uwsgi-docs.readthedocs.io/en/latest/>`_ (or similar), " @@ -1973,11 +2030,11 @@ msgid "" "listener in production`_ for more details." msgstr "" -#: ../../howto/logging-cookbook.rst:1539 +#: ../../howto/logging-cookbook.rst:1552 msgid "Using file rotation" msgstr "" -#: ../../howto/logging-cookbook.rst:1544 +#: ../../howto/logging-cookbook.rst:1557 msgid "" "Sometimes you want to let a log file grow to a certain size, then open a new " "file and log to that. You may want to keep a certain number of these files, " @@ -1986,7 +2043,7 @@ msgid "" "usage pattern, the logging package provides a :class:`RotatingFileHandler`::" msgstr "" -#: ../../howto/logging-cookbook.rst:1550 +#: ../../howto/logging-cookbook.rst:1563 msgid "" "import glob\n" "import logging\n" @@ -2015,13 +2072,13 @@ msgid "" " print(filename)" msgstr "" -#: ../../howto/logging-cookbook.rst:1576 +#: ../../howto/logging-cookbook.rst:1589 msgid "" "The result should be 6 separate files, each with part of the log history for " "the application:" msgstr "" -#: ../../howto/logging-cookbook.rst:1579 +#: ../../howto/logging-cookbook.rst:1592 msgid "" "logging_rotatingfile_example.out\n" "logging_rotatingfile_example.out.1\n" @@ -2031,7 +2088,7 @@ msgid "" "logging_rotatingfile_example.out.5" msgstr "" -#: ../../howto/logging-cookbook.rst:1588 +#: ../../howto/logging-cookbook.rst:1601 msgid "" "The most current file is always :file:`logging_rotatingfile_example.out`, " "and each time it reaches the size limit it is renamed with the suffix " @@ -2039,26 +2096,26 @@ msgid "" "(``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased." msgstr "" -#: ../../howto/logging-cookbook.rst:1593 +#: ../../howto/logging-cookbook.rst:1606 msgid "" "Obviously this example sets the log length much too small as an extreme " "example. You would want to set *maxBytes* to an appropriate value." msgstr "" -#: ../../howto/logging-cookbook.rst:1601 +#: ../../howto/logging-cookbook.rst:1614 msgid "Use of alternative formatting styles" msgstr "" -#: ../../howto/logging-cookbook.rst:1603 +#: ../../howto/logging-cookbook.rst:1616 msgid "" "When logging was added to the Python standard library, the only way of " "formatting messages with variable content was to use the %-formatting " -"method. Since then, Python has gained two new formatting approaches: :class:" -"`string.Template` (added in Python 2.4) and :meth:`str.format` (added in " -"Python 2.6)." +"method. Since then, Python has gained two new formatting " +"approaches: :class:`string.Template` (added in Python 2.4) " +"and :meth:`str.format` (added in Python 2.6)." msgstr "" -#: ../../howto/logging-cookbook.rst:1609 +#: ../../howto/logging-cookbook.rst:1622 msgid "" "Logging (as of 3.2) provides improved support for these two additional " "formatting styles. The :class:`Formatter` class been enhanced to take an " @@ -2066,12 +2123,12 @@ msgid "" "``'%'``, but other possible values are ``'{'`` and ``'$'``, which correspond " "to the other two formatting styles. Backwards compatibility is maintained by " "default (as you would expect), but by explicitly specifying a style " -"parameter, you get the ability to specify format strings which work with :" -"meth:`str.format` or :class:`string.Template`. Here's an example console " -"session to show the possibilities:" +"parameter, you get the ability to specify format strings which work " +"with :meth:`str.format` or :class:`string.Template`. Here's an example " +"console session to show the possibilities:" msgstr "" -#: ../../howto/logging-cookbook.rst:1619 +#: ../../howto/logging-cookbook.rst:1632 msgid "" ">>> import logging\n" ">>> root = logging.getLogger()\n" @@ -2096,21 +2153,21 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1643 +#: ../../howto/logging-cookbook.rst:1656 msgid "" "Note that the formatting of logging messages for final output to logs is " "completely independent of how an individual logging message is constructed. " "That can still use %-formatting, as shown here::" msgstr "" -#: ../../howto/logging-cookbook.rst:1647 +#: ../../howto/logging-cookbook.rst:1660 msgid "" ">>> logger.error('This is an%s %s %s', 'other,', 'ERROR,', 'message')\n" "2010-10-28 15:19:29,833 foo.bar ERROR This is another, ERROR, message\n" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1651 +#: ../../howto/logging-cookbook.rst:1664 msgid "" "Logging calls (``logger.debug()``, ``logger.info()`` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -2118,15 +2175,15 @@ msgid "" "logging call (e.g. the ``exc_info`` keyword parameter to indicate that " "traceback information should be logged, or the ``extra`` keyword parameter " "to indicate additional contextual information to be added to the log). So " -"you cannot directly make logging calls using :meth:`str.format` or :class:" -"`string.Template` syntax, because internally the logging package uses %-" -"formatting to merge the format string and the variable arguments. There " -"would be no changing this while preserving backward compatibility, since all " -"logging calls which are out there in existing code will be using %-format " -"strings." +"you cannot directly make logging calls using :meth:`str.format` " +"or :class:`string.Template` syntax, because internally the logging package " +"uses %-formatting to merge the format string and the variable arguments. " +"There would be no changing this while preserving backward compatibility, " +"since all logging calls which are out there in existing code will be using %-" +"format strings." msgstr "" -#: ../../howto/logging-cookbook.rst:1664 +#: ../../howto/logging-cookbook.rst:1677 msgid "" "There is, however, a way that you can use {}- and $- formatting to construct " "your individual log messages. Recall that for a message you can use an " @@ -2135,7 +2192,7 @@ msgid "" "the following two classes::" msgstr "" -#: ../../howto/logging-cookbook.rst:1670 ../../howto/logging-cookbook.rst:2758 +#: ../../howto/logging-cookbook.rst:1683 ../../howto/logging-cookbook.rst:2771 msgid "" "class BraceMessage:\n" " def __init__(self, fmt, /, *args, **kwargs):\n" @@ -2173,7 +2230,7 @@ msgstr "" " from string import Template\n" " return Template(self.fmt).substitute(**self.kwargs)" -#: ../../howto/logging-cookbook.rst:1688 +#: ../../howto/logging-cookbook.rst:1701 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -2184,14 +2241,14 @@ msgid "" "used as a synonym/alias for :func:`gettext.gettext` or its brethren)." msgstr "" -#: ../../howto/logging-cookbook.rst:1696 +#: ../../howto/logging-cookbook.rst:1709 msgid "" "The above classes are not included in Python, though they're easy enough to " "copy and paste into your own code. They can be used as follows (assuming " "that they're declared in a module called ``wherever``):" msgstr "" -#: ../../howto/logging-cookbook.rst:1700 +#: ../../howto/logging-cookbook.rst:1713 msgid "" ">>> from wherever import BraceMessage as __\n" ">>> print(__('Message with {0} {name}', 2, name='placeholders'))\n" @@ -2210,14 +2267,14 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:1718 +#: ../../howto/logging-cookbook.rst:1731 msgid "" "While the above examples use ``print()`` to show how the formatting works, " "you would of course use ``logger.debug()`` or similar to actually log using " "this approach." msgstr "" -#: ../../howto/logging-cookbook.rst:1722 +#: ../../howto/logging-cookbook.rst:1735 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -2228,13 +2285,13 @@ msgid "" "sugar for a constructor call to one of the :samp:`{XXX}Message` classes." msgstr "" -#: ../../howto/logging-cookbook.rst:1730 +#: ../../howto/logging-cookbook.rst:1743 msgid "" "If you prefer, you can use a :class:`LoggerAdapter` to achieve a similar " "effect to the above, as in the following example::" msgstr "" -#: ../../howto/logging-cookbook.rst:1733 +#: ../../howto/logging-cookbook.rst:1746 msgid "" "import logging\n" "\n" @@ -2263,63 +2320,64 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:1759 +#: ../../howto/logging-cookbook.rst:1772 msgid "" "The above script should log the message ``Hello, world!`` when run with " "Python 3.8 or later." msgstr "" -#: ../../howto/logging-cookbook.rst:1768 +#: ../../howto/logging-cookbook.rst:1781 msgid "Customizing ``LogRecord``" msgstr "" -#: ../../howto/logging-cookbook.rst:1770 +#: ../../howto/logging-cookbook.rst:1783 msgid "" "Every logging event is represented by a :class:`LogRecord` instance. When an " -"event is logged and not filtered out by a logger's level, a :class:" -"`LogRecord` is created, populated with information about the event and then " -"passed to the handlers for that logger (and its ancestors, up to and " -"including the logger where further propagation up the hierarchy is " +"event is logged and not filtered out by a logger's level, " +"a :class:`LogRecord` is created, populated with information about the event " +"and then passed to the handlers for that logger (and its ancestors, up to " +"and including the logger where further propagation up the hierarchy is " "disabled). Before Python 3.2, there were only two places where this creation " "was done:" msgstr "" -#: ../../howto/logging-cookbook.rst:1777 +#: ../../howto/logging-cookbook.rst:1790 msgid "" ":meth:`Logger.makeRecord`, which is called in the normal process of logging " "an event. This invoked :class:`LogRecord` directly to create an instance." msgstr "" -#: ../../howto/logging-cookbook.rst:1780 +#: ../../howto/logging-cookbook.rst:1793 msgid "" ":func:`makeLogRecord`, which is called with a dictionary containing " "attributes to be added to the LogRecord. This is typically invoked when a " "suitable dictionary has been received over the network (e.g. in pickle form " -"via a :class:`~handlers.SocketHandler`, or in JSON form via an :class:" -"`~handlers.HTTPHandler`)." +"via a :class:`~handlers.SocketHandler`, or in JSON form via " +"an :class:`~handlers.HTTPHandler`)." msgstr "" -#: ../../howto/logging-cookbook.rst:1786 +#: ../../howto/logging-cookbook.rst:1799 msgid "" -"This has usually meant that if you need to do anything special with a :class:" -"`LogRecord`, you've had to do one of the following." +"This has usually meant that if you need to do anything special with " +"a :class:`LogRecord`, you've had to do one of the following." msgstr "" -#: ../../howto/logging-cookbook.rst:1789 +#: ../../howto/logging-cookbook.rst:1802 msgid "" -"Create your own :class:`Logger` subclass, which overrides :meth:`Logger." -"makeRecord`, and set it using :func:`~logging.setLoggerClass` before any " -"loggers that you care about are instantiated." +"Create your own :class:`Logger` subclass, which " +"overrides :meth:`Logger.makeRecord`, and set it " +"using :func:`~logging.setLoggerClass` before any loggers that you care about " +"are instantiated." msgstr "" -#: ../../howto/logging-cookbook.rst:1792 +#: ../../howto/logging-cookbook.rst:1805 msgid "" "Add a :class:`Filter` to a logger or handler, which does the necessary " "special manipulation you need when its :meth:`~Filter.filter` method is " "called." msgstr "" -#: ../../howto/logging-cookbook.rst:1796 +#: ../../howto/logging-cookbook.rst:1809 msgid "" "The first approach would be a little unwieldy in the scenario where (say) " "several different libraries wanted to do different things. Each would " @@ -2327,7 +2385,7 @@ msgid "" "last would win." msgstr "" -#: ../../howto/logging-cookbook.rst:1801 +#: ../../howto/logging-cookbook.rst:1814 msgid "" "The second approach works reasonably well for many cases, but does not allow " "you to e.g. use a specialized subclass of :class:`LogRecord`. Library " @@ -2336,11 +2394,11 @@ msgid "" "would do simply by adding new packages or modules and doing ::" msgstr "" -#: ../../howto/logging-cookbook.rst:1807 +#: ../../howto/logging-cookbook.rst:1820 msgid "logger = logging.getLogger(__name__)" msgstr "logger = logging.getLogger(__name__)" -#: ../../howto/logging-cookbook.rst:1809 +#: ../../howto/logging-cookbook.rst:1822 msgid "" "at module level). It's probably one too many things to think about. " "Developers could also add the filter to a :class:`~logging.NullHandler` " @@ -2350,17 +2408,17 @@ msgid "" "developer." msgstr "" -#: ../../howto/logging-cookbook.rst:1815 +#: ../../howto/logging-cookbook.rst:1828 msgid "" "In Python 3.2 and later, :class:`~logging.LogRecord` creation is done " "through a factory, which you can specify. The factory is just a callable you " -"can set with :func:`~logging.setLogRecordFactory`, and interrogate with :" -"func:`~logging.getLogRecordFactory`. The factory is invoked with the same " -"signature as the :class:`~logging.LogRecord` constructor, as :class:" -"`LogRecord` is the default setting for the factory." +"can set with :func:`~logging.setLogRecordFactory`, and interrogate " +"with :func:`~logging.getLogRecordFactory`. The factory is invoked with the " +"same signature as the :class:`~logging.LogRecord` constructor, " +"as :class:`LogRecord` is the default setting for the factory." msgstr "" -#: ../../howto/logging-cookbook.rst:1822 +#: ../../howto/logging-cookbook.rst:1835 msgid "" "This approach allows a custom factory to control all aspects of LogRecord " "creation. For example, you could return a subclass, or just add some " @@ -2368,7 +2426,7 @@ msgid "" "this::" msgstr "" -#: ../../howto/logging-cookbook.rst:1826 +#: ../../howto/logging-cookbook.rst:1839 msgid "" "old_factory = logging.getLogRecordFactory()\n" "\n" @@ -2380,7 +2438,7 @@ msgid "" "logging.setLogRecordFactory(record_factory)" msgstr "" -#: ../../howto/logging-cookbook.rst:1835 +#: ../../howto/logging-cookbook.rst:1848 msgid "" "This pattern allows different libraries to chain factories together, and as " "long as they don't overwrite each other's attributes or unintentionally " @@ -2390,22 +2448,22 @@ msgid "" "used when the use of a :class:`Filter` does not provide the desired result." msgstr "" -#: ../../howto/logging-cookbook.rst:1847 +#: ../../howto/logging-cookbook.rst:1860 msgid "Subclassing QueueHandler and QueueListener- a ZeroMQ example" msgstr "" -#: ../../howto/logging-cookbook.rst:1850 ../../howto/logging-cookbook.rst:1983 +#: ../../howto/logging-cookbook.rst:1863 ../../howto/logging-cookbook.rst:1996 msgid "Subclass ``QueueHandler``" msgstr "" -#: ../../howto/logging-cookbook.rst:1852 +#: ../../howto/logging-cookbook.rst:1865 msgid "" "You can use a :class:`QueueHandler` subclass to send messages to other kinds " "of queues, for example a ZeroMQ 'publish' socket. In the example below,the " "socket is created separately and passed to the handler (as its 'queue')::" msgstr "" -#: ../../howto/logging-cookbook.rst:1856 +#: ../../howto/logging-cookbook.rst:1869 msgid "" "import zmq # using pyzmq, the Python binding for ZeroMQ\n" "import json # for serializing records portably\n" @@ -2422,13 +2480,13 @@ msgid "" "handler = ZeroMQSocketHandler(sock)" msgstr "" -#: ../../howto/logging-cookbook.rst:1871 +#: ../../howto/logging-cookbook.rst:1884 msgid "" "Of course there are other ways of organizing this, for example passing in " "the data needed by the handler to create the socket::" msgstr "" -#: ../../howto/logging-cookbook.rst:1874 +#: ../../howto/logging-cookbook.rst:1887 msgid "" "class ZeroMQSocketHandler(QueueHandler):\n" " def __init__(self, uri, socktype=zmq.PUB, ctx=None):\n" @@ -2444,17 +2502,17 @@ msgid "" " self.queue.close()" msgstr "" -#: ../../howto/logging-cookbook.rst:1889 ../../howto/logging-cookbook.rst:1919 +#: ../../howto/logging-cookbook.rst:1902 ../../howto/logging-cookbook.rst:1932 msgid "Subclass ``QueueListener``" msgstr "" -#: ../../howto/logging-cookbook.rst:1891 +#: ../../howto/logging-cookbook.rst:1904 msgid "" "You can also subclass :class:`QueueListener` to get messages from other " "kinds of queues, for example a ZeroMQ 'subscribe' socket. Here's an example::" msgstr "" -#: ../../howto/logging-cookbook.rst:1894 +#: ../../howto/logging-cookbook.rst:1907 msgid "" "class ZeroMQSocketListener(QueueListener):\n" " def __init__(self, uri, /, *handlers, **kwargs):\n" @@ -2470,20 +2528,20 @@ msgid "" " return logging.makeLogRecord(msg)" msgstr "" -#: ../../howto/logging-cookbook.rst:1909 +#: ../../howto/logging-cookbook.rst:1922 msgid "Subclassing QueueHandler and QueueListener- a ``pynng`` example" msgstr "" -#: ../../howto/logging-cookbook.rst:1911 +#: ../../howto/logging-cookbook.rst:1924 msgid "" "In a similar way to the above section, we can implement a listener and " -"handler using :pypi:`pynng`, which is a Python binding to `NNG <https://nng." -"nanomsg.org/>`_, billed as a spiritual successor to ZeroMQ. The following " -"snippets illustrate -- you can test them in an environment which has " -"``pynng`` installed. Just for variety, we present the listener first." +"handler using :pypi:`pynng`, which is a Python binding to `NNG <https://" +"nng.nanomsg.org/>`_, billed as a spiritual successor to ZeroMQ. The " +"following snippets illustrate -- you can test them in an environment which " +"has ``pynng`` installed. Just for variety, we present the listener first." msgstr "" -#: ../../howto/logging-cookbook.rst:1921 +#: ../../howto/logging-cookbook.rst:1934 msgid "" "# listener.py\n" "import json\n" @@ -2545,7 +2603,7 @@ msgid "" " listener.stop()" msgstr "" -#: ../../howto/logging-cookbook.rst:1987 +#: ../../howto/logging-cookbook.rst:2000 msgid "" "# sender.py\n" "import json\n" @@ -2578,8 +2636,8 @@ msgid "" "# Make sure the process ID is in the output\n" "logging.basicConfig(level=logging.DEBUG,\n" " handlers=[logging.StreamHandler(), handler],\n" -" format='%(levelname)-8s %(name)10s %(process)6s " -"%(message)s')\n" +" format='%(levelname)-8s %(name)10s %(process)6s %" +"(message)s')\n" "levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR,\n" " logging.CRITICAL)\n" "logger_names = ('myapp', 'myapp.lib1', 'myapp.lib2')\n" @@ -2594,14 +2652,14 @@ msgid "" " time.sleep(delay)" msgstr "" -#: ../../howto/logging-cookbook.rst:2034 +#: ../../howto/logging-cookbook.rst:2047 msgid "" "You can run the above two snippets in separate command shells. If we run the " "listener in one shell and run the sender in two separate shells, we should " "see something like the following. In the first sender shell:" msgstr "" -#: ../../howto/logging-cookbook.rst:2038 +#: ../../howto/logging-cookbook.rst:2051 msgid "" "$ python sender.py\n" "DEBUG myapp 613 Message no. 1\n" @@ -2615,11 +2673,11 @@ msgid "" "(and so on)" msgstr "" -#: ../../howto/logging-cookbook.rst:2051 +#: ../../howto/logging-cookbook.rst:2064 msgid "In the second sender shell:" msgstr "" -#: ../../howto/logging-cookbook.rst:2053 +#: ../../howto/logging-cookbook.rst:2066 msgid "" "$ python sender.py\n" "INFO myapp.lib2 657 Message no. 1\n" @@ -2633,11 +2691,11 @@ msgid "" "(and so on)" msgstr "" -#: ../../howto/logging-cookbook.rst:2066 +#: ../../howto/logging-cookbook.rst:2079 msgid "In the listener shell:" msgstr "" -#: ../../howto/logging-cookbook.rst:2068 +#: ../../howto/logging-cookbook.rst:2081 msgid "" "$ python listener.py\n" "Press Ctrl-C to stop.\n" @@ -2660,25 +2718,25 @@ msgid "" "(and so on)" msgstr "" -#: ../../howto/logging-cookbook.rst:2090 +#: ../../howto/logging-cookbook.rst:2103 msgid "" "As you can see, the logging from the two sender processes is interleaved in " "the listener's output." msgstr "" -#: ../../howto/logging-cookbook.rst:2095 +#: ../../howto/logging-cookbook.rst:2108 msgid "An example dictionary-based configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:2097 +#: ../../howto/logging-cookbook.rst:2110 msgid "" "Below is an example of a logging configuration dictionary - it's taken from " "the `documentation on the Django project <https://docs.djangoproject.com/en/" -"stable/topics/logging/#configuring-logging>`_. This dictionary is passed to :" -"func:`~config.dictConfig` to put the configuration into effect::" +"stable/topics/logging/#configuring-logging>`_. This dictionary is passed " +"to :func:`~config.dictConfig` to put the configuration into effect::" msgstr "" -#: ../../howto/logging-cookbook.rst:2101 +#: ../../howto/logging-cookbook.rst:2114 msgid "" "LOGGING = {\n" " 'version': 1,\n" @@ -2780,24 +2838,24 @@ msgstr "" " }\n" "}" -#: ../../howto/logging-cookbook.rst:2150 +#: ../../howto/logging-cookbook.rst:2163 msgid "" "For more information about this configuration, you can see the `relevant " "section <https://docs.djangoproject.com/en/stable/topics/logging/" "#configuring-logging>`_ of the Django documentation." msgstr "" -#: ../../howto/logging-cookbook.rst:2157 +#: ../../howto/logging-cookbook.rst:2170 msgid "Using a rotator and namer to customize log rotation processing" msgstr "" -#: ../../howto/logging-cookbook.rst:2159 +#: ../../howto/logging-cookbook.rst:2172 msgid "" "An example of how you can define a namer and rotator is given in the " "following runnable script, which shows gzip compression of the log file::" msgstr "" -#: ../../howto/logging-cookbook.rst:2162 +#: ../../howto/logging-cookbook.rst:2175 msgid "" "import gzip\n" "import logging\n" @@ -2857,12 +2915,12 @@ msgstr "" "for i in range(1000):\n" " root.info(f'Message no. {i + 1}')" -#: ../../howto/logging-cookbook.rst:2190 +#: ../../howto/logging-cookbook.rst:2203 msgid "" "After running this, you will see six new files, five of which are compressed:" msgstr "" -#: ../../howto/logging-cookbook.rst:2192 +#: ../../howto/logging-cookbook.rst:2205 msgid "" "$ ls rotated.log*\n" "rotated.log rotated.log.2.gz rotated.log.4.gz\n" @@ -2880,11 +2938,11 @@ msgstr "" "2023-01-20 02:28:17,767 Message no. 997\n" "2023-01-20 02:28:17,767 Message no. 998" -#: ../../howto/logging-cookbook.rst:2203 +#: ../../howto/logging-cookbook.rst:2216 msgid "A more elaborate multiprocessing example" msgstr "" -#: ../../howto/logging-cookbook.rst:2205 +#: ../../howto/logging-cookbook.rst:2218 msgid "" "The following working example shows how logging can be used with " "multiprocessing using configuration files. The configurations are fairly " @@ -2892,7 +2950,7 @@ msgid "" "in a real multiprocessing scenario." msgstr "" -#: ../../howto/logging-cookbook.rst:2210 +#: ../../howto/logging-cookbook.rst:2223 msgid "" "In the example, the main process spawns a listener process and some worker " "processes. Each of the main process, the listener and the workers have three " @@ -2905,13 +2963,13 @@ msgid "" "own scenario." msgstr "" -#: ../../howto/logging-cookbook.rst:2220 +#: ../../howto/logging-cookbook.rst:2233 msgid "" "Here's the script - the docstrings and the comments hopefully explain how it " "works::" msgstr "" -#: ../../howto/logging-cookbook.rst:2223 +#: ../../howto/logging-cookbook.rst:2236 msgid "" "import logging\n" "import logging.config\n" @@ -3056,13 +3114,13 @@ msgid "" " 'formatters': {\n" " 'detailed': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(asctime)s %(name)-15s %(levelname)-8s " -"%(processName)-10s %(message)s'\n" +" 'format': '%(asctime)s %(name)-15s %(levelname)-8s %" +"(processName)-10s %(message)s'\n" " },\n" " 'simple': {\n" " 'class': 'logging.Formatter',\n" -" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s " -"%(message)s'\n" +" 'format': '%(name)-15s %(levelname)-8s %(processName)-10s %" +"(message)s'\n" " }\n" " },\n" " 'handlers': {\n" @@ -3134,11 +3192,11 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2432 +#: ../../howto/logging-cookbook.rst:2445 msgid "Inserting a BOM into messages sent to a SysLogHandler" msgstr "" -#: ../../howto/logging-cookbook.rst:2434 +#: ../../howto/logging-cookbook.rst:2447 msgid "" ":rfc:`5424` requires that a Unicode message be sent to a syslog daemon as a " "set of bytes which have the following structure: an optional pure-ASCII " @@ -3147,7 +3205,7 @@ msgid "" "<5424#section-6>`.)" msgstr "" -#: ../../howto/logging-cookbook.rst:2440 +#: ../../howto/logging-cookbook.rst:2453 msgid "" "In Python 3.1, code was added to :class:`~logging.handlers.SysLogHandler` to " "insert a BOM into the message, but unfortunately, it was implemented " @@ -3155,7 +3213,7 @@ msgid "" "hence not allowing any pure-ASCII component to appear before it." msgstr "" -#: ../../howto/logging-cookbook.rst:2446 +#: ../../howto/logging-cookbook.rst:2459 msgid "" "As this behaviour is broken, the incorrect BOM insertion code is being " "removed from Python 3.2.4 and later. However, it is not being replaced, and " @@ -3164,37 +3222,38 @@ msgid "" "encoded using UTF-8, then you need to do the following:" msgstr "" -#: ../../howto/logging-cookbook.rst:2452 +#: ../../howto/logging-cookbook.rst:2465 msgid "" -"Attach a :class:`~logging.Formatter` instance to your :class:`~logging." -"handlers.SysLogHandler` instance, with a format string such as::" +"Attach a :class:`~logging.Formatter` instance to " +"your :class:`~logging.handlers.SysLogHandler` instance, with a format string " +"such as::" msgstr "" -#: ../../howto/logging-cookbook.rst:2456 +#: ../../howto/logging-cookbook.rst:2469 msgid "'ASCII section\\ufeffUnicode section'" msgstr "" -#: ../../howto/logging-cookbook.rst:2458 +#: ../../howto/logging-cookbook.rst:2471 msgid "" "The Unicode code point U+FEFF, when encoded using UTF-8, will be encoded as " "a UTF-8 BOM -- the byte-string ``b'\\xef\\xbb\\xbf'``." msgstr "" -#: ../../howto/logging-cookbook.rst:2461 +#: ../../howto/logging-cookbook.rst:2474 msgid "" "Replace the ASCII section with whatever placeholders you like, but make sure " "that the data that appears in there after substitution is always ASCII (that " "way, it will remain unchanged after UTF-8 encoding)." msgstr "" -#: ../../howto/logging-cookbook.rst:2465 +#: ../../howto/logging-cookbook.rst:2478 msgid "" "Replace the Unicode section with whatever placeholders you like; if the data " "which appears there after substitution contains characters outside the ASCII " "range, that's fine -- it will be encoded using UTF-8." msgstr "" -#: ../../howto/logging-cookbook.rst:2469 +#: ../../howto/logging-cookbook.rst:2482 msgid "" "The formatted message *will* be encoded using UTF-8 encoding by " "``SysLogHandler``. If you follow the above rules, you should be able to " @@ -3203,11 +3262,11 @@ msgid "" "daemon may complain." msgstr "" -#: ../../howto/logging-cookbook.rst:2476 +#: ../../howto/logging-cookbook.rst:2489 msgid "Implementing structured logging" msgstr "" -#: ../../howto/logging-cookbook.rst:2478 +#: ../../howto/logging-cookbook.rst:2491 msgid "" "Although most logging messages are intended for reading by humans, and thus " "not readily machine-parseable, there might be circumstances where you want " @@ -3219,7 +3278,7 @@ msgid "" "machine-parseable manner::" msgstr "" -#: ../../howto/logging-cookbook.rst:2486 +#: ../../howto/logging-cookbook.rst:2499 msgid "" "import json\n" "import logging\n" @@ -3238,11 +3297,11 @@ msgid "" "logging.info(_('message 1', foo='bar', bar='baz', num=123, fnum=123.456))" msgstr "" -#: ../../howto/logging-cookbook.rst:2502 +#: ../../howto/logging-cookbook.rst:2515 msgid "If the above script is run, it prints:" msgstr "" -#: ../../howto/logging-cookbook.rst:2504 +#: ../../howto/logging-cookbook.rst:2517 msgid "" "message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": " "\"bar\"}" @@ -3250,19 +3309,19 @@ msgstr "" "message 1 >>> {\"fnum\": 123.456, \"num\": 123, \"bar\": \"baz\", \"foo\": " "\"bar\"}" -#: ../../howto/logging-cookbook.rst:2508 ../../howto/logging-cookbook.rst:2550 +#: ../../howto/logging-cookbook.rst:2521 ../../howto/logging-cookbook.rst:2563 msgid "" "Note that the order of items might be different according to the version of " "Python used." msgstr "" -#: ../../howto/logging-cookbook.rst:2511 +#: ../../howto/logging-cookbook.rst:2524 msgid "" "If you need more specialised processing, you can use a custom JSON encoder, " "as in the following complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2514 +#: ../../howto/logging-cookbook.rst:2527 msgid "" "import json\n" "import logging\n" @@ -3295,19 +3354,19 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2544 +#: ../../howto/logging-cookbook.rst:2557 msgid "When the above script is run, it prints:" msgstr "" -#: ../../howto/logging-cookbook.rst:2546 +#: ../../howto/logging-cookbook.rst:2559 msgid "message 1 >>> {\"snowman\": \"\\u2603\", \"set_value\": [1, 2, 3]}" msgstr "message 1 >>> {\"snowman\": \"\\u2603\", \"set_value\": [1, 2, 3]}" -#: ../../howto/logging-cookbook.rst:2559 +#: ../../howto/logging-cookbook.rst:2572 msgid "Customizing handlers with :func:`dictConfig`" msgstr "" -#: ../../howto/logging-cookbook.rst:2561 +#: ../../howto/logging-cookbook.rst:2574 msgid "" "There are times when you want to customize logging handlers in particular " "ways, and if you use :func:`dictConfig` you may be able to do this without " @@ -3317,7 +3376,7 @@ msgid "" "customize handler creation using a plain function such as::" msgstr "" -#: ../../howto/logging-cookbook.rst:2568 +#: ../../howto/logging-cookbook.rst:2581 msgid "" "def owned_file_handler(filename, mode='a', encoding=None, owner=None):\n" " if owner:\n" @@ -3333,13 +3392,14 @@ msgstr "" " shutil.chown(filename, *owner)\n" " return logging.FileHandler(filename, mode, encoding)" -#: ../../howto/logging-cookbook.rst:2575 +#: ../../howto/logging-cookbook.rst:2588 msgid "" -"You can then specify, in a logging configuration passed to :func:" -"`dictConfig`, that a logging handler be created by calling this function::" +"You can then specify, in a logging configuration passed " +"to :func:`dictConfig`, that a logging handler be created by calling this " +"function::" msgstr "" -#: ../../howto/logging-cookbook.rst:2578 +#: ../../howto/logging-cookbook.rst:2591 msgid "" "LOGGING = {\n" " 'version': 1,\n" @@ -3372,14 +3432,14 @@ msgid "" "}" msgstr "" -#: ../../howto/logging-cookbook.rst:2608 +#: ../../howto/logging-cookbook.rst:2621 msgid "" "In this example I am setting the ownership using the ``pulse`` user and " "group, just for the purposes of illustration. Putting it together into a " "working script, ``chowntest.py``::" msgstr "" -#: ../../howto/logging-cookbook.rst:2612 +#: ../../howto/logging-cookbook.rst:2625 msgid "" "import logging, logging.config, os, shutil\n" "\n" @@ -3425,11 +3485,11 @@ msgid "" "logger.debug('A debug message')" msgstr "" -#: ../../howto/logging-cookbook.rst:2655 +#: ../../howto/logging-cookbook.rst:2668 msgid "To run this, you will probably need to run as ``root``:" msgstr "" -#: ../../howto/logging-cookbook.rst:2657 +#: ../../howto/logging-cookbook.rst:2670 msgid "" "$ sudo python3.3 chowntest.py\n" "$ cat chowntest.log\n" @@ -3438,34 +3498,34 @@ msgid "" "-rw-r--r-- 1 pulse pulse 55 2013-11-05 09:34 chowntest.log" msgstr "" -#: ../../howto/logging-cookbook.rst:2665 +#: ../../howto/logging-cookbook.rst:2678 msgid "" -"Note that this example uses Python 3.3 because that's where :func:`shutil." -"chown` makes an appearance. This approach should work with any Python " -"version that supports :func:`dictConfig` - namely, Python 2.7, 3.2 or later. " -"With pre-3.3 versions, you would need to implement the actual ownership " -"change using e.g. :func:`os.chown`." +"Note that this example uses Python 3.3 because that's " +"where :func:`shutil.chown` makes an appearance. This approach should work " +"with any Python version that supports :func:`dictConfig` - namely, Python " +"2.7, 3.2 or later. With pre-3.3 versions, you would need to implement the " +"actual ownership change using e.g. :func:`os.chown`." msgstr "" -#: ../../howto/logging-cookbook.rst:2671 +#: ../../howto/logging-cookbook.rst:2684 msgid "" "In practice, the handler-creating function may be in a utility module " "somewhere in your project. Instead of the line in the configuration::" msgstr "" -#: ../../howto/logging-cookbook.rst:2674 +#: ../../howto/logging-cookbook.rst:2687 msgid "'()': owned_file_handler," msgstr "'()': owned_file_handler," -#: ../../howto/logging-cookbook.rst:2676 +#: ../../howto/logging-cookbook.rst:2689 msgid "you could use e.g.::" msgstr "" -#: ../../howto/logging-cookbook.rst:2678 +#: ../../howto/logging-cookbook.rst:2691 msgid "'()': 'ext://project.util.owned_file_handler'," msgstr "'()': 'ext://project.util.owned_file_handler'," -#: ../../howto/logging-cookbook.rst:2680 +#: ../../howto/logging-cookbook.rst:2693 msgid "" "where ``project.util`` can be replaced with the actual name of the package " "where the function resides. In the above working script, using ``'ext://" @@ -3473,25 +3533,25 @@ msgid "" "resolved by :func:`dictConfig` from the ``ext://`` specification." msgstr "" -#: ../../howto/logging-cookbook.rst:2685 +#: ../../howto/logging-cookbook.rst:2698 msgid "" "This example hopefully also points the way to how you could implement other " "types of file change - e.g. setting specific POSIX permission bits - in the " "same way, using :func:`os.chmod`." msgstr "" -#: ../../howto/logging-cookbook.rst:2689 +#: ../../howto/logging-cookbook.rst:2702 msgid "" "Of course, the approach could also be extended to types of handler other " "than a :class:`~logging.FileHandler` - for example, one of the rotating file " "handlers, or a different type of handler altogether." msgstr "" -#: ../../howto/logging-cookbook.rst:2699 +#: ../../howto/logging-cookbook.rst:2712 msgid "Using particular formatting styles throughout your application" msgstr "" -#: ../../howto/logging-cookbook.rst:2701 +#: ../../howto/logging-cookbook.rst:2714 msgid "" "In Python 3.2, the :class:`~logging.Formatter` gained a ``style`` keyword " "parameter which, while defaulting to ``%`` for backward compatibility, " @@ -3502,7 +3562,7 @@ msgid "" "is constructed." msgstr "" -#: ../../howto/logging-cookbook.rst:2708 +#: ../../howto/logging-cookbook.rst:2721 msgid "" "Logging calls (:meth:`~Logger.debug`, :meth:`~Logger.info` etc.) only take " "positional parameters for the actual logging message itself, with keyword " @@ -3510,14 +3570,15 @@ msgid "" "call (e.g. the ``exc_info`` keyword parameter to indicate that traceback " "information should be logged, or the ``extra`` keyword parameter to indicate " "additional contextual information to be added to the log). So you cannot " -"directly make logging calls using :meth:`str.format` or :class:`string." -"Template` syntax, because internally the logging package uses %-formatting " -"to merge the format string and the variable arguments. There would be no " -"changing this while preserving backward compatibility, since all logging " -"calls which are out there in existing code will be using %-format strings." +"directly make logging calls using :meth:`str.format` " +"or :class:`string.Template` syntax, because internally the logging package " +"uses %-formatting to merge the format string and the variable arguments. " +"There would be no changing this while preserving backward compatibility, " +"since all logging calls which are out there in existing code will be using %-" +"format strings." msgstr "" -#: ../../howto/logging-cookbook.rst:2720 +#: ../../howto/logging-cookbook.rst:2733 msgid "" "There have been suggestions to associate format styles with specific " "loggers, but that approach also runs into backward compatibility problems " @@ -3525,7 +3586,7 @@ msgid "" "formatting." msgstr "" -#: ../../howto/logging-cookbook.rst:2724 +#: ../../howto/logging-cookbook.rst:2737 msgid "" "For logging to work interoperably between any third-party libraries and your " "code, decisions about formatting need to be made at the level of the " @@ -3533,11 +3594,11 @@ msgid "" "formatting styles can be accommodated." msgstr "" -#: ../../howto/logging-cookbook.rst:2731 +#: ../../howto/logging-cookbook.rst:2744 msgid "Using LogRecord factories" msgstr "" -#: ../../howto/logging-cookbook.rst:2733 +#: ../../howto/logging-cookbook.rst:2746 msgid "" "In Python 3.2, along with the :class:`~logging.Formatter` changes mentioned " "above, the logging package gained the ability to allow users to set their " @@ -3552,27 +3613,27 @@ msgid "" "implementation does." msgstr "" -#: ../../howto/logging-cookbook.rst:2744 +#: ../../howto/logging-cookbook.rst:2757 msgid "" -"Refer to the reference documentation on :func:`setLogRecordFactory` and :" -"class:`LogRecord` for more information." +"Refer to the reference documentation on :func:`setLogRecordFactory` " +"and :class:`LogRecord` for more information." msgstr "" -#: ../../howto/logging-cookbook.rst:2749 +#: ../../howto/logging-cookbook.rst:2762 msgid "Using custom message objects" msgstr "" -#: ../../howto/logging-cookbook.rst:2751 +#: ../../howto/logging-cookbook.rst:2764 msgid "" "There is another, perhaps simpler way that you can use {}- and $- formatting " -"to construct your individual log messages. You may recall (from :ref:" -"`arbitrary-object-messages`) that when logging you can use an arbitrary " -"object as a message format string, and that the logging package will call :" -"func:`str` on that object to get the actual format string. Consider the " -"following two classes::" +"to construct your individual log messages. You may recall " +"(from :ref:`arbitrary-object-messages`) that when logging you can use an " +"arbitrary object as a message format string, and that the logging package " +"will call :func:`str` on that object to get the actual format string. " +"Consider the following two classes::" msgstr "" -#: ../../howto/logging-cookbook.rst:2776 +#: ../../howto/logging-cookbook.rst:2789 msgid "" "Either of these can be used in place of a format string, to allow {}- or $-" "formatting to be used to build the actual \"message\" part which appears in " @@ -3583,13 +3644,13 @@ msgid "" "using ``_`` for localization)." msgstr "" -#: ../../howto/logging-cookbook.rst:2784 +#: ../../howto/logging-cookbook.rst:2797 msgid "" -"Examples of this approach are given below. Firstly, formatting with :meth:" -"`str.format`::" +"Examples of this approach are given below. Firstly, formatting " +"with :meth:`str.format`::" msgstr "" -#: ../../howto/logging-cookbook.rst:2787 +#: ../../howto/logging-cookbook.rst:2800 msgid "" ">>> __ = BraceMessage\n" ">>> print(__('Message with {0} {1}', 2, 'placeholders'))\n" @@ -3604,11 +3665,11 @@ msgid "" "Message with coordinates: (0.50, 0.50)" msgstr "" -#: ../../howto/logging-cookbook.rst:2798 +#: ../../howto/logging-cookbook.rst:2811 msgid "Secondly, formatting with :class:`string.Template`::" msgstr "" -#: ../../howto/logging-cookbook.rst:2800 +#: ../../howto/logging-cookbook.rst:2813 msgid "" ">>> __ = DollarMessage\n" ">>> print(__('Message with $num $what', num=2, what='placeholders'))\n" @@ -3616,7 +3677,7 @@ msgid "" ">>>" msgstr "" -#: ../../howto/logging-cookbook.rst:2805 +#: ../../howto/logging-cookbook.rst:2818 msgid "" "One thing to note is that you pay no significant performance penalty with " "this approach: the actual formatting happens not when you make the logging " @@ -3628,26 +3689,26 @@ msgid "" "shown above." msgstr "" -#: ../../howto/logging-cookbook.rst:2819 +#: ../../howto/logging-cookbook.rst:2832 msgid "Configuring filters with :func:`dictConfig`" msgstr "" -#: ../../howto/logging-cookbook.rst:2821 +#: ../../howto/logging-cookbook.rst:2834 msgid "" "You *can* configure filters using :func:`~logging.config.dictConfig`, though " "it might not be obvious at first glance how to do it (hence this recipe). " "Since :class:`~logging.Filter` is the only filter class included in the " "standard library, and it is unlikely to cater to many requirements (it's " -"only there as a base class), you will typically need to define your own :" -"class:`~logging.Filter` subclass with an overridden :meth:`~logging.Filter." -"filter` method. To do this, specify the ``()`` key in the configuration " -"dictionary for the filter, specifying a callable which will be used to " -"create the filter (a class is the most obvious, but you can provide any " -"callable which returns a :class:`~logging.Filter` instance). Here is a " -"complete example::" +"only there as a base class), you will typically need to define your " +"own :class:`~logging.Filter` subclass with an " +"overridden :meth:`~logging.Filter.filter` method. To do this, specify the " +"``()`` key in the configuration dictionary for the filter, specifying a " +"callable which will be used to create the filter (a class is the most " +"obvious, but you can provide any callable which returns " +"a :class:`~logging.Filter` instance). Here is a complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2832 +#: ../../howto/logging-cookbook.rst:2845 msgid "" "import logging\n" "import logging.config\n" @@ -3733,26 +3794,26 @@ msgstr "" " logging.debug('hello')\n" " logging.debug('hello - noshow')" -#: ../../howto/logging-cookbook.rst:2874 +#: ../../howto/logging-cookbook.rst:2887 msgid "" "This example shows how you can pass configuration data to the callable which " "constructs the instance, in the form of keyword parameters. When run, the " "above script will print:" msgstr "" -#: ../../howto/logging-cookbook.rst:2878 +#: ../../howto/logging-cookbook.rst:2891 msgid "changed: hello" msgstr "changed: hello" -#: ../../howto/logging-cookbook.rst:2882 +#: ../../howto/logging-cookbook.rst:2895 msgid "which shows that the filter is working as configured." msgstr "" -#: ../../howto/logging-cookbook.rst:2884 +#: ../../howto/logging-cookbook.rst:2897 msgid "A couple of extra points to note:" msgstr "" -#: ../../howto/logging-cookbook.rst:2886 +#: ../../howto/logging-cookbook.rst:2899 msgid "" "If you can't refer to the callable directly in the configuration (e.g. if it " "lives in a different module, and you can't import it directly where the " @@ -3762,7 +3823,7 @@ msgid "" "the above example." msgstr "" -#: ../../howto/logging-cookbook.rst:2893 +#: ../../howto/logging-cookbook.rst:2906 msgid "" "As well as for filters, this technique can also be used to configure custom " "handlers and formatters. See :ref:`logging-config-dict-userdef` for more " @@ -3771,11 +3832,11 @@ msgid "" "above." msgstr "" -#: ../../howto/logging-cookbook.rst:2902 +#: ../../howto/logging-cookbook.rst:2915 msgid "Customized exception formatting" msgstr "" -#: ../../howto/logging-cookbook.rst:2904 +#: ../../howto/logging-cookbook.rst:2917 msgid "" "There might be times when you want to do customized exception formatting - " "for argument's sake, let's say you want exactly one line per logged event, " @@ -3783,7 +3844,7 @@ msgid "" "formatter class, as shown in the following example::" msgstr "" -#: ../../howto/logging-cookbook.rst:2909 +#: ../../howto/logging-cookbook.rst:2922 msgid "" "import logging\n" "\n" @@ -3822,11 +3883,11 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:2945 +#: ../../howto/logging-cookbook.rst:2958 msgid "When run, this produces a file with exactly two lines:" msgstr "" -#: ../../howto/logging-cookbook.rst:2947 +#: ../../howto/logging-cookbook.rst:2960 msgid "" "28/01/2015 07:21:23|INFO|Sample message|\n" "28/01/2015 07:21:23|ERROR|ZeroDivisionError: integer division or modulo by " @@ -3840,35 +3901,35 @@ msgstr "" "in main\\n x = 1 / 0\\nZeroDivisionError: integer division or modulo by " "zero'|" -#: ../../howto/logging-cookbook.rst:2952 +#: ../../howto/logging-cookbook.rst:2965 msgid "" "While the above treatment is simplistic, it points the way to how exception " "information can be formatted to your liking. The :mod:`traceback` module may " "be helpful for more specialized needs." msgstr "" -#: ../../howto/logging-cookbook.rst:2959 +#: ../../howto/logging-cookbook.rst:2972 msgid "Speaking logging messages" msgstr "" -#: ../../howto/logging-cookbook.rst:2961 +#: ../../howto/logging-cookbook.rst:2974 msgid "" "There might be situations when it is desirable to have logging messages " "rendered in an audible rather than a visible format. This is easy to do if " "you have text-to-speech (TTS) functionality available in your system, even " "if it doesn't have a Python binding. Most TTS systems have a command line " -"program you can run, and this can be invoked from a handler using :mod:" -"`subprocess`. It's assumed here that TTS command line programs won't expect " -"to interact with users or take a long time to complete, and that the " -"frequency of logged messages will be not so high as to swamp the user with " -"messages, and that it's acceptable to have the messages spoken one at a time " -"rather than concurrently, The example implementation below waits for one " -"message to be spoken before the next is processed, and this might cause " -"other handlers to be kept waiting. Here is a short example showing the " +"program you can run, and this can be invoked from a handler " +"using :mod:`subprocess`. It's assumed here that TTS command line programs " +"won't expect to interact with users or take a long time to complete, and " +"that the frequency of logged messages will be not so high as to swamp the " +"user with messages, and that it's acceptable to have the messages spoken one " +"at a time rather than concurrently, The example implementation below waits " +"for one message to be spoken before the next is processed, and this might " +"cause other handlers to be kept waiting. Here is a short example showing the " "approach, which assumes that the ``espeak`` TTS package is available::" msgstr "" -#: ../../howto/logging-cookbook.rst:2974 +#: ../../howto/logging-cookbook.rst:2987 msgid "" "import logging\n" "import subprocess\n" @@ -3900,24 +3961,24 @@ msgid "" " sys.exit(main())" msgstr "" -#: ../../howto/logging-cookbook.rst:3003 +#: ../../howto/logging-cookbook.rst:3016 msgid "" "When run, this script should say \"Hello\" and then \"Goodbye\" in a female " "voice." msgstr "" -#: ../../howto/logging-cookbook.rst:3005 +#: ../../howto/logging-cookbook.rst:3018 msgid "" "The above approach can, of course, be adapted to other TTS systems and even " "other systems altogether which can process messages via external programs " "run from a command line." msgstr "" -#: ../../howto/logging-cookbook.rst:3013 +#: ../../howto/logging-cookbook.rst:3026 msgid "Buffering logging messages and outputting them conditionally" msgstr "" -#: ../../howto/logging-cookbook.rst:3015 +#: ../../howto/logging-cookbook.rst:3028 msgid "" "There might be situations where you want to log messages in a temporary area " "and only output them if a certain condition occurs. For example, you may " @@ -3927,7 +3988,7 @@ msgid "" "debug information to be output as well as the error." msgstr "" -#: ../../howto/logging-cookbook.rst:3022 +#: ../../howto/logging-cookbook.rst:3035 msgid "" "Here is an example which shows how you could do this using a decorator for " "your functions where you want logging to behave this way. It makes use of " @@ -3940,7 +4001,7 @@ msgid "" "subclass of ``MemoryHandler`` if you want custom flushing behavior." msgstr "" -#: ../../howto/logging-cookbook.rst:3032 +#: ../../howto/logging-cookbook.rst:3045 msgid "" "The example script has a simple function, ``foo``, which just cycles through " "all the logging levels, writing to ``sys.stderr`` to say what level it's " @@ -3949,23 +4010,23 @@ msgid "" "levels - otherwise, it only logs at DEBUG, INFO and WARNING levels." msgstr "" -#: ../../howto/logging-cookbook.rst:3038 +#: ../../howto/logging-cookbook.rst:3051 msgid "" "The script just arranges to decorate ``foo`` with a decorator which will do " "the conditional logging that's required. The decorator takes a logger as a " "parameter and attaches a memory handler for the duration of the call to the " "decorated function. The decorator can be additionally parameterised using a " "target handler, a level at which flushing should occur, and a capacity for " -"the buffer (number of records buffered). These default to a :class:`~logging." -"StreamHandler` which writes to ``sys.stderr``, ``logging.ERROR`` and ``100`` " -"respectively." +"the buffer (number of records buffered). These default to " +"a :class:`~logging.StreamHandler` which writes to ``sys.stderr``, " +"``logging.ERROR`` and ``100`` respectively." msgstr "" -#: ../../howto/logging-cookbook.rst:3046 +#: ../../howto/logging-cookbook.rst:3059 msgid "Here's the script::" msgstr "" -#: ../../howto/logging-cookbook.rst:3048 +#: ../../howto/logging-cookbook.rst:3061 msgid "" "import logging\n" "from logging.handlers import MemoryHandler\n" @@ -4031,11 +4092,11 @@ msgid "" " assert decorated_foo(True)" msgstr "" -#: ../../howto/logging-cookbook.rst:3109 +#: ../../howto/logging-cookbook.rst:3122 msgid "When this script is run, the following output should be observed:" msgstr "" -#: ../../howto/logging-cookbook.rst:3111 +#: ../../howto/logging-cookbook.rst:3124 msgid "" "Calling undecorated foo with False\n" "about to log at DEBUG ...\n" @@ -4064,40 +4125,41 @@ msgid "" "Actually logged at CRITICAL" msgstr "" -#: ../../howto/logging-cookbook.rst:3139 +#: ../../howto/logging-cookbook.rst:3152 msgid "" "As you can see, actual logging output only occurs when an event is logged " "whose severity is ERROR or greater, but in that case, any previous events at " "lower severities are also logged." msgstr "" -#: ../../howto/logging-cookbook.rst:3143 +#: ../../howto/logging-cookbook.rst:3156 msgid "You can of course use the conventional means of decoration::" msgstr "" -#: ../../howto/logging-cookbook.rst:3145 +#: ../../howto/logging-cookbook.rst:3158 msgid "" "@log_if_errors(logger)\n" "def foo(fail=False):\n" " ..." msgstr "" -#: ../../howto/logging-cookbook.rst:3153 +#: ../../howto/logging-cookbook.rst:3166 msgid "Sending logging messages to email, with buffering" msgstr "" -#: ../../howto/logging-cookbook.rst:3155 +#: ../../howto/logging-cookbook.rst:3168 msgid "" "To illustrate how you can send log messages via email, so that a set number " -"of messages are sent per email, you can subclass :class:`~logging.handlers." -"BufferingHandler`. In the following example, which you can adapt to suit " -"your specific needs, a simple test harness is provided which allows you to " -"run the script with command line arguments specifying what you typically " -"need to send things via SMTP. (Run the downloaded script with the ``-h`` " -"argument to see the required and optional arguments.)" +"of messages are sent per email, you can " +"subclass :class:`~logging.handlers.BufferingHandler`. In the following " +"example, which you can adapt to suit your specific needs, a simple test " +"harness is provided which allows you to run the script with command line " +"arguments specifying what you typically need to send things via SMTP. (Run " +"the downloaded script with the ``-h`` argument to see the required and " +"optional arguments.)" msgstr "" -#: ../../howto/logging-cookbook.rst:3163 +#: ../../howto/logging-cookbook.rst:3176 msgid "" "import logging\n" "import logging.handlers\n" @@ -4117,8 +4179,8 @@ msgid "" " toaddrs = [toaddrs]\n" " self.toaddrs = toaddrs\n" " self.subject = subject\n" -" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s " -"%(message)s\"))\n" +" self.setFormatter(logging.Formatter(\"%(asctime)s %(levelname)-5s %" +"(message)s\"))\n" "\n" " def flush(self):\n" " if len(self.buffer) > 0:\n" @@ -4165,7 +4227,7 @@ msgid "" " h.close()" msgstr "" -#: ../../howto/logging-cookbook.rst:3227 +#: ../../howto/logging-cookbook.rst:3240 msgid "" "If you run this script and your SMTP server is correctly set up, you should " "find that it sends eleven emails to the addressee you specify. The first ten " @@ -4173,17 +4235,17 @@ msgid "" "messages. That makes up 102 messages as specified in the script." msgstr "" -#: ../../howto/logging-cookbook.rst:3235 +#: ../../howto/logging-cookbook.rst:3248 msgid "Formatting times using UTC (GMT) via configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:3237 +#: ../../howto/logging-cookbook.rst:3250 msgid "" "Sometimes you want to format times using UTC, which can be done using a " "class such as ``UTCFormatter``, shown below::" msgstr "" -#: ../../howto/logging-cookbook.rst:3240 +#: ../../howto/logging-cookbook.rst:3253 msgid "" "import logging\n" "import time\n" @@ -4192,15 +4254,15 @@ msgid "" " converter = time.gmtime" msgstr "" -#: ../../howto/logging-cookbook.rst:3246 +#: ../../howto/logging-cookbook.rst:3259 msgid "" -"and you can then use the ``UTCFormatter`` in your code instead of :class:" -"`~logging.Formatter`. If you want to do that via configuration, you can use " -"the :func:`~logging.config.dictConfig` API with an approach illustrated by " -"the following complete example::" +"and you can then use the ``UTCFormatter`` in your code instead " +"of :class:`~logging.Formatter`. If you want to do that via configuration, " +"you can use the :func:`~logging.config.dictConfig` API with an approach " +"illustrated by the following complete example::" msgstr "" -#: ../../howto/logging-cookbook.rst:3251 +#: ../../howto/logging-cookbook.rst:3264 msgid "" "import logging\n" "import logging.config\n" @@ -4241,11 +4303,11 @@ msgid "" " logging.warning('The local time is %s', time.asctime())" msgstr "" -#: ../../howto/logging-cookbook.rst:3289 +#: ../../howto/logging-cookbook.rst:3302 msgid "When this script is run, it should print something like:" msgstr "" -#: ../../howto/logging-cookbook.rst:3291 +#: ../../howto/logging-cookbook.rst:3304 msgid "" "2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n" "2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015" @@ -4253,17 +4315,17 @@ msgstr "" "2015-10-17 12:53:29,501 The local time is Sat Oct 17 13:53:29 2015\n" "2015-10-17 13:53:29,501 The local time is Sat Oct 17 13:53:29 2015" -#: ../../howto/logging-cookbook.rst:3296 +#: ../../howto/logging-cookbook.rst:3309 msgid "" "showing how the time is formatted both as local time and UTC, one for each " "handler." msgstr "" -#: ../../howto/logging-cookbook.rst:3303 +#: ../../howto/logging-cookbook.rst:3316 msgid "Using a context manager for selective logging" msgstr "" -#: ../../howto/logging-cookbook.rst:3305 +#: ../../howto/logging-cookbook.rst:3318 msgid "" "There are times when it would be useful to temporarily change the logging " "configuration and revert it back after doing something. For this, a context " @@ -4273,7 +4335,7 @@ msgid "" "scope of the context manager::" msgstr "" -#: ../../howto/logging-cookbook.rst:3312 +#: ../../howto/logging-cookbook.rst:3325 msgid "" "import logging\n" "import sys\n" @@ -4302,7 +4364,7 @@ msgid "" " # implicit return of None => don't swallow exceptions" msgstr "" -#: ../../howto/logging-cookbook.rst:3338 +#: ../../howto/logging-cookbook.rst:3351 msgid "" "If you specify a level value, the logger's level is set to that value in the " "scope of the with block covered by the context manager. If you specify a " @@ -4311,13 +4373,13 @@ msgid "" "block exit - you could do this if you don't need the handler any more." msgstr "" -#: ../../howto/logging-cookbook.rst:3344 +#: ../../howto/logging-cookbook.rst:3357 msgid "" "To illustrate how it works, we can add the following block of code to the " "above::" msgstr "" -#: ../../howto/logging-cookbook.rst:3347 +#: ../../howto/logging-cookbook.rst:3360 msgid "" "if __name__ == '__main__':\n" " logger = logging.getLogger('foo')\n" @@ -4337,7 +4399,7 @@ msgid "" " logger.debug('7. This should not appear.')" msgstr "" -#: ../../howto/logging-cookbook.rst:3362 +#: ../../howto/logging-cookbook.rst:3375 msgid "" "We initially set the logger's level to ``INFO``, so message #1 appears and " "message #2 doesn't. We then change the level to ``DEBUG`` temporarily in the " @@ -4350,11 +4412,11 @@ msgid "" "(like message #1) whereas message #7 doesn't (just like message #2)." msgstr "" -#: ../../howto/logging-cookbook.rst:3372 +#: ../../howto/logging-cookbook.rst:3385 msgid "If we run the resulting script, the result is as follows:" msgstr "" -#: ../../howto/logging-cookbook.rst:3374 +#: ../../howto/logging-cookbook.rst:3387 msgid "" "$ python logctx.py\n" "1. This should appear just once on stderr.\n" @@ -4364,23 +4426,23 @@ msgid "" "6. This should appear just once on stderr." msgstr "" -#: ../../howto/logging-cookbook.rst:3383 +#: ../../howto/logging-cookbook.rst:3396 msgid "" "If we run it again, but pipe ``stderr`` to ``/dev/null``, we see the " "following, which is the only message written to ``stdout``:" msgstr "" -#: ../../howto/logging-cookbook.rst:3386 +#: ../../howto/logging-cookbook.rst:3399 msgid "" "$ python logctx.py 2>/dev/null\n" "5. This should appear twice - once on stderr and once on stdout." msgstr "" -#: ../../howto/logging-cookbook.rst:3391 +#: ../../howto/logging-cookbook.rst:3404 msgid "Once again, but piping ``stdout`` to ``/dev/null``, we get:" msgstr "" -#: ../../howto/logging-cookbook.rst:3393 +#: ../../howto/logging-cookbook.rst:3406 msgid "" "$ python logctx.py >/dev/null\n" "1. This should appear just once on stderr.\n" @@ -4389,53 +4451,53 @@ msgid "" "6. This should appear just once on stderr." msgstr "" -#: ../../howto/logging-cookbook.rst:3401 +#: ../../howto/logging-cookbook.rst:3414 msgid "" "In this case, the message #5 printed to ``stdout`` doesn't appear, as " "expected." msgstr "" -#: ../../howto/logging-cookbook.rst:3403 +#: ../../howto/logging-cookbook.rst:3416 msgid "" "Of course, the approach described here can be generalised, for example to " "attach logging filters temporarily. Note that the above code works in Python " "2 as well as Python 3." msgstr "" -#: ../../howto/logging-cookbook.rst:3411 +#: ../../howto/logging-cookbook.rst:3424 msgid "A CLI application starter template" msgstr "" -#: ../../howto/logging-cookbook.rst:3413 +#: ../../howto/logging-cookbook.rst:3426 msgid "Here's an example which shows how you can:" msgstr "" -#: ../../howto/logging-cookbook.rst:3415 +#: ../../howto/logging-cookbook.rst:3428 msgid "Use a logging level based on command-line arguments" msgstr "" -#: ../../howto/logging-cookbook.rst:3416 +#: ../../howto/logging-cookbook.rst:3429 msgid "" "Dispatch to multiple subcommands in separate files, all logging at the same " "level in a consistent way" msgstr "" -#: ../../howto/logging-cookbook.rst:3418 +#: ../../howto/logging-cookbook.rst:3431 msgid "Make use of simple, minimal configuration" msgstr "" -#: ../../howto/logging-cookbook.rst:3420 +#: ../../howto/logging-cookbook.rst:3433 msgid "" "Suppose we have a command-line application whose job is to stop, start or " "restart some services. This could be organised for the purposes of " "illustration as a file ``app.py`` that is the main script for the " -"application, with individual commands implemented in ``start.py``, ``stop." -"py`` and ``restart.py``. Suppose further that we want to control the " +"application, with individual commands implemented in ``start.py``, " +"``stop.py`` and ``restart.py``. Suppose further that we want to control the " "verbosity of the application via a command-line argument, defaulting to " "``logging.INFO``. Here's one way that ``app.py`` could be written::" msgstr "" -#: ../../howto/logging-cookbook.rst:3428 +#: ../../howto/logging-cookbook.rst:3441 msgid "" "import argparse\n" "import importlib\n" @@ -4470,8 +4532,8 @@ msgid "" " mod = importlib.import_module(options.command)\n" " cmd = getattr(mod, 'command')\n" " except (ImportError, AttributeError):\n" -" print('Unable to find the code for command \\'%s\\'' % options." -"command)\n" +" print('Unable to find the code for command \\'%s\\'' % " +"options.command)\n" " return 1\n" " # Could get fancy here and load configuration from file or dictionary\n" " logging.basicConfig(level=options.log_level,\n" @@ -4482,13 +4544,13 @@ msgid "" " sys.exit(main())" msgstr "" -#: ../../howto/logging-cookbook.rst:3469 +#: ../../howto/logging-cookbook.rst:3482 msgid "" "And the ``start``, ``stop`` and ``restart`` commands can be implemented in " "separate modules, like so for starting::" msgstr "" -#: ../../howto/logging-cookbook.rst:3472 +#: ../../howto/logging-cookbook.rst:3485 msgid "" "# start.py\n" "import logging\n" @@ -4501,11 +4563,11 @@ msgid "" " logger.info('Started the \\'%s\\' service.', options.name)" msgstr "" -#: ../../howto/logging-cookbook.rst:3482 +#: ../../howto/logging-cookbook.rst:3495 msgid "and thus for stopping::" msgstr "" -#: ../../howto/logging-cookbook.rst:3484 +#: ../../howto/logging-cookbook.rst:3497 msgid "" "# stop.py\n" "import logging\n" @@ -4527,11 +4589,11 @@ msgid "" " logger.info('Stopped the %s service%s.', services, plural)" msgstr "" -#: ../../howto/logging-cookbook.rst:3503 +#: ../../howto/logging-cookbook.rst:3516 msgid "and similarly for restarting::" msgstr "" -#: ../../howto/logging-cookbook.rst:3505 +#: ../../howto/logging-cookbook.rst:3518 msgid "" "# restart.py\n" "import logging\n" @@ -4553,13 +4615,13 @@ msgid "" " logger.info('Restarted the %s service%s.', services, plural)" msgstr "" -#: ../../howto/logging-cookbook.rst:3524 +#: ../../howto/logging-cookbook.rst:3537 msgid "" "If we run this application with the default log level, we get output like " "this:" msgstr "" -#: ../../howto/logging-cookbook.rst:3526 +#: ../../howto/logging-cookbook.rst:3539 msgid "" "$ python app.py start foo\n" "INFO start Started the 'foo' service.\n" @@ -4571,19 +4633,19 @@ msgid "" "INFO restart Restarted the 'foo', 'bar' and 'baz' services." msgstr "" -#: ../../howto/logging-cookbook.rst:3537 +#: ../../howto/logging-cookbook.rst:3550 msgid "" "The first word is the logging level, and the second word is the module or " "package name of the place where the event was logged." msgstr "" -#: ../../howto/logging-cookbook.rst:3540 +#: ../../howto/logging-cookbook.rst:3553 msgid "" "If we change the logging level, then we can change the information sent to " "the log. For example, if we want more information:" msgstr "" -#: ../../howto/logging-cookbook.rst:3543 +#: ../../howto/logging-cookbook.rst:3556 msgid "" "$ python app.py --log-level DEBUG start foo\n" "DEBUG start About to start foo\n" @@ -4598,36 +4660,36 @@ msgid "" "INFO restart Restarted the 'foo', 'bar' and 'baz' services." msgstr "" -#: ../../howto/logging-cookbook.rst:3557 +#: ../../howto/logging-cookbook.rst:3570 msgid "And if we want less:" msgstr "" -#: ../../howto/logging-cookbook.rst:3559 +#: ../../howto/logging-cookbook.rst:3572 msgid "" "$ python app.py --log-level WARNING start foo\n" "$ python app.py --log-level WARNING stop foo bar\n" "$ python app.py --log-level WARNING restart foo bar baz" msgstr "" -#: ../../howto/logging-cookbook.rst:3565 +#: ../../howto/logging-cookbook.rst:3578 msgid "" "In this case, the commands don't print anything to the console, since " "nothing at ``WARNING`` level or above is logged by them." msgstr "" -#: ../../howto/logging-cookbook.rst:3571 +#: ../../howto/logging-cookbook.rst:3584 msgid "A Qt GUI for logging" msgstr "" -#: ../../howto/logging-cookbook.rst:3573 +#: ../../howto/logging-cookbook.rst:3586 msgid "" "A question that comes up from time to time is about how to log to a GUI " "application. The `Qt <https://www.qt.io/>`_ framework is a popular cross-" -"platform UI framework with Python bindings using :pypi:`PySide2` or :pypi:" -"`PyQt5` libraries." +"platform UI framework with Python bindings using :pypi:`PySide2` " +"or :pypi:`PyQt5` libraries." msgstr "" -#: ../../howto/logging-cookbook.rst:3578 +#: ../../howto/logging-cookbook.rst:3591 msgid "" "The following example shows how to log to a Qt GUI. This introduces a simple " "``QtHandler`` class which takes a callable, which should be a slot in the " @@ -4637,14 +4699,14 @@ msgid "" "logging messages at random levels with random short delays in between)." msgstr "" -#: ../../howto/logging-cookbook.rst:3585 +#: ../../howto/logging-cookbook.rst:3598 msgid "" "The worker thread is implemented using Qt's ``QThread`` class rather than " "the :mod:`threading` module, as there are circumstances where one has to use " "``QThread``, which offers better integration with other ``Qt`` components." msgstr "" -#: ../../howto/logging-cookbook.rst:3589 +#: ../../howto/logging-cookbook.rst:3602 msgid "" "The code should work with recent releases of any of ``PySide6``, ``PyQt6``, " "``PySide2`` or ``PyQt5``. You should be able to adapt the approach to " @@ -4652,7 +4714,7 @@ msgid "" "more detailed information." msgstr "" -#: ../../howto/logging-cookbook.rst:3594 +#: ../../howto/logging-cookbook.rst:3607 msgid "" "import datetime\n" "import logging\n" @@ -4835,8 +4897,8 @@ msgid "" " self.start_thread()\n" " self.work_button.clicked.connect(self.worker.start)\n" " # Once started, the button should be disabled\n" -" self.work_button.clicked.connect(lambda : self.work_button." -"setEnabled(False))\n" +" self.work_button.clicked.connect(lambda : " +"self.work_button.setEnabled(False))\n" "\n" " def start_thread(self):\n" " self.worker = Worker()\n" @@ -4903,28 +4965,29 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:3826 +#: ../../howto/logging-cookbook.rst:3839 msgid "Logging to syslog with RFC5424 support" msgstr "" -#: ../../howto/logging-cookbook.rst:3828 +#: ../../howto/logging-cookbook.rst:3841 msgid "" "Although :rfc:`5424` dates from 2009, most syslog servers are configured by " "default to use the older :rfc:`3164`, which hails from 2001. When " "``logging`` was added to Python in 2003, it supported the earlier (and only " "existing) protocol at the time. Since RFC5424 came out, as there has not " -"been widespread deployment of it in syslog servers, the :class:`~logging." -"handlers.SysLogHandler` functionality has not been updated." +"been widespread deployment of it in syslog servers, " +"the :class:`~logging.handlers.SysLogHandler` functionality has not been " +"updated." msgstr "" -#: ../../howto/logging-cookbook.rst:3835 +#: ../../howto/logging-cookbook.rst:3848 msgid "" "RFC 5424 contains some useful features such as support for structured data, " "and if you need to be able to log to a syslog server with support for it, " "you can do so with a subclassed handler which looks something like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:3839 +#: ../../howto/logging-cookbook.rst:3852 msgid "" "import datetime\n" "import logging.handlers\n" @@ -4944,8 +5007,8 @@ msgid "" "\n" " def format(self, record):\n" " version = 1\n" -" asctime = datetime.datetime.fromtimestamp(record.created)." -"isoformat()\n" +" asctime = " +"datetime.datetime.fromtimestamp(record.created).isoformat()\n" " m = self.tz_offset.match(time.strftime('%z'))\n" " has_offset = False\n" " if m and time.timezone:\n" @@ -4994,7 +5057,7 @@ msgid "" "{sdata} {msg}'" msgstr "" -#: ../../howto/logging-cookbook.rst:3901 +#: ../../howto/logging-cookbook.rst:3914 msgid "" "You'll need to be familiar with RFC 5424 to fully understand the above code, " "and it may be that you have slightly different needs (e.g. for how you pass " @@ -5003,7 +5066,7 @@ msgid "" "using something like this::" msgstr "" -#: ../../howto/logging-cookbook.rst:3906 +#: ../../howto/logging-cookbook.rst:3919 msgid "" "sd = {\n" " 'foo@12345': {'bar': 'baz', 'baz': 'bozz', 'fizz': r'buzz'},\n" @@ -5021,11 +5084,11 @@ msgstr "" "i = 1\n" "logger.debug('Message %d', i, extra=extra)" -#: ../../howto/logging-cookbook.rst:3915 +#: ../../howto/logging-cookbook.rst:3928 msgid "How to treat a logger like an output stream" msgstr "" -#: ../../howto/logging-cookbook.rst:3917 +#: ../../howto/logging-cookbook.rst:3930 msgid "" "Sometimes, you need to interface to a third-party API which expects a file-" "like object to write to, but you want to direct the API's output to a " @@ -5033,7 +5096,7 @@ msgid "" "API. Here's a short script illustrating such a class:" msgstr "" -#: ../../howto/logging-cookbook.rst:3922 +#: ../../howto/logging-cookbook.rst:3935 msgid "" "import logging\n" "\n" @@ -5071,39 +5134,43 @@ msgid "" " main()" msgstr "" -#: ../../howto/logging-cookbook.rst:3957 +#: ../../howto/logging-cookbook.rst:3970 msgid "When this script is run, it prints" msgstr "" -#: ../../howto/logging-cookbook.rst:3959 +#: ../../howto/logging-cookbook.rst:3972 msgid "" "INFO:demo:An INFO message\n" "DEBUG:demo:A DEBUG message" msgstr "" -#: ../../howto/logging-cookbook.rst:3964 +#: ../../howto/logging-cookbook.rst:3977 msgid "" -"You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and ``sys." -"stderr`` by doing something like this:" +"You could also use ``LoggerWriter`` to redirect ``sys.stdout`` and " +"``sys.stderr`` by doing something like this:" msgstr "" -#: ../../howto/logging-cookbook.rst:3967 +#: ../../howto/logging-cookbook.rst:3980 msgid "" "import sys\n" "\n" "sys.stdout = LoggerWriter(logger, logging.INFO)\n" "sys.stderr = LoggerWriter(logger, logging.WARNING)" msgstr "" +"import sys\n" +"\n" +"sys.stdout = LoggerWriter(logger, logging.INFO)\n" +"sys.stderr = LoggerWriter(logger, logging.WARNING)" -#: ../../howto/logging-cookbook.rst:3974 +#: ../../howto/logging-cookbook.rst:3987 msgid "" "You should do this *after* configuring logging for your needs. In the above " -"example, the :func:`~logging.basicConfig` call does this (using the ``sys." -"stderr`` value *before* it is overwritten by a ``LoggerWriter`` instance). " -"Then, you'd get this kind of result:" +"example, the :func:`~logging.basicConfig` call does this (using the " +"``sys.stderr`` value *before* it is overwritten by a ``LoggerWriter`` " +"instance). Then, you'd get this kind of result:" msgstr "" -#: ../../howto/logging-cookbook.rst:3979 +#: ../../howto/logging-cookbook.rst:3992 msgid "" ">>> print('Foo')\n" "INFO:demo:Foo\n" @@ -5117,31 +5184,31 @@ msgstr "" "WARNING:demo:Bar\n" ">>>" -#: ../../howto/logging-cookbook.rst:3987 +#: ../../howto/logging-cookbook.rst:4000 msgid "" -"Of course, the examples above show output according to the format used by :" -"func:`~logging.basicConfig`, but you can use a different formatter when you " -"configure logging." +"Of course, the examples above show output according to the format used " +"by :func:`~logging.basicConfig`, but you can use a different formatter when " +"you configure logging." msgstr "" -#: ../../howto/logging-cookbook.rst:3991 +#: ../../howto/logging-cookbook.rst:4004 msgid "" "Note that with the above scheme, you are somewhat at the mercy of buffering " "and the sequence of write calls which you are intercepting. For example, " "with the definition of ``LoggerWriter`` above, if you have the snippet" msgstr "" -#: ../../howto/logging-cookbook.rst:3995 +#: ../../howto/logging-cookbook.rst:4008 msgid "" "sys.stderr = LoggerWriter(logger, logging.WARNING)\n" "1 / 0" msgstr "" -#: ../../howto/logging-cookbook.rst:4000 +#: ../../howto/logging-cookbook.rst:4013 msgid "then running the script results in" msgstr "" -#: ../../howto/logging-cookbook.rst:4002 +#: ../../howto/logging-cookbook.rst:4015 msgid "" "WARNING:demo:Traceback (most recent call last):\n" "\n" @@ -5160,7 +5227,7 @@ msgid "" "WARNING:demo:division by zero" msgstr "" -#: ../../howto/logging-cookbook.rst:4018 +#: ../../howto/logging-cookbook.rst:4031 msgid "" "As you can see, this output isn't ideal. That's because the underlying code " "which writes to ``sys.stderr`` makes multiple writes, each of which results " @@ -5170,7 +5237,7 @@ msgid "" "``LoggerWriter``:" msgstr "" -#: ../../howto/logging-cookbook.rst:4024 +#: ../../howto/logging-cookbook.rst:4037 msgid "" "class BufferingLoggerWriter(LoggerWriter):\n" " def __init__(self, logger, level):\n" @@ -5206,13 +5273,13 @@ msgstr "" " for part in parts:\n" " self.logger.log(self.level, part)" -#: ../../howto/logging-cookbook.rst:4043 +#: ../../howto/logging-cookbook.rst:4056 msgid "" "This just buffers up stuff until a newline is seen, and then logs complete " "lines. With this approach, you get better output:" msgstr "" -#: ../../howto/logging-cookbook.rst:4046 +#: ../../howto/logging-cookbook.rst:4059 msgid "" "WARNING:demo:Traceback (most recent call last):\n" "WARNING:demo: File \"/home/runner/cookbook-loggerwriter/main.py\", line 55, " @@ -5232,11 +5299,11 @@ msgstr "" "WARNING:demo: 1/0\n" "WARNING:demo:ZeroDivisionError: division by zero" -#: ../../howto/logging-cookbook.rst:4059 +#: ../../howto/logging-cookbook.rst:4072 msgid "Patterns to avoid" msgstr "" -#: ../../howto/logging-cookbook.rst:4061 +#: ../../howto/logging-cookbook.rst:4074 msgid "" "Although the preceding sections have described ways of doing things you " "might need to do or deal with, it is worth mentioning some usage patterns " @@ -5244,11 +5311,11 @@ msgid "" "The following sections are in no particular order." msgstr "" -#: ../../howto/logging-cookbook.rst:4067 +#: ../../howto/logging-cookbook.rst:4080 msgid "Opening the same log file multiple times" msgstr "" -#: ../../howto/logging-cookbook.rst:4069 +#: ../../howto/logging-cookbook.rst:4082 msgid "" "On Windows, you will generally not be able to open the same file multiple " "times as this will lead to a \"file is in use by another process\" error. " @@ -5256,32 +5323,32 @@ msgid "" "file multiple times. This could be done accidentally, for example by:" msgstr "" -#: ../../howto/logging-cookbook.rst:4074 +#: ../../howto/logging-cookbook.rst:4087 msgid "" "Adding a file handler more than once which references the same file (e.g. by " "a copy/paste/forget-to-change error)." msgstr "" -#: ../../howto/logging-cookbook.rst:4077 +#: ../../howto/logging-cookbook.rst:4090 msgid "" "Opening two files that look different, as they have different names, but are " "the same because one is a symbolic link to the other." msgstr "" -#: ../../howto/logging-cookbook.rst:4080 +#: ../../howto/logging-cookbook.rst:4093 msgid "" "Forking a process, following which both parent and child have a reference to " "the same file. This might be through use of the :mod:`multiprocessing` " "module, for example." msgstr "" -#: ../../howto/logging-cookbook.rst:4084 +#: ../../howto/logging-cookbook.rst:4097 msgid "" "Opening a file multiple times might *appear* to work most of the time, but " "can lead to a number of problems in practice:" msgstr "" -#: ../../howto/logging-cookbook.rst:4087 +#: ../../howto/logging-cookbook.rst:4100 msgid "" "Logging output can be garbled because multiple threads or processes try to " "write to the same file. Although logging guards against concurrent use of " @@ -5290,7 +5357,7 @@ msgid "" "different handler instances which happen to point to the same file." msgstr "" -#: ../../howto/logging-cookbook.rst:4093 +#: ../../howto/logging-cookbook.rst:4106 msgid "" "An attempt to delete a file (e.g. during file rotation) silently fails, " "because there is another reference pointing to it. This can lead to " @@ -5300,17 +5367,17 @@ msgid "" "being supposedly in place." msgstr "" -#: ../../howto/logging-cookbook.rst:4100 +#: ../../howto/logging-cookbook.rst:4113 msgid "" "Use the techniques outlined in :ref:`multiple-processes` to circumvent such " "issues." msgstr "" -#: ../../howto/logging-cookbook.rst:4104 +#: ../../howto/logging-cookbook.rst:4117 msgid "Using loggers as attributes in a class or passing them as parameters" msgstr "" -#: ../../howto/logging-cookbook.rst:4106 +#: ../../howto/logging-cookbook.rst:4119 msgid "" "While there might be unusual cases where you'll need to do this, in general " "there is no point because loggers are singletons. Code can always access a " @@ -5321,13 +5388,13 @@ msgid "" "module (and not the class) is the unit of software decomposition." msgstr "" -#: ../../howto/logging-cookbook.rst:4115 +#: ../../howto/logging-cookbook.rst:4128 msgid "" "Adding handlers other than :class:`~logging.NullHandler` to a logger in a " "library" msgstr "" -#: ../../howto/logging-cookbook.rst:4117 +#: ../../howto/logging-cookbook.rst:4130 msgid "" "Configuring logging by adding handlers, formatters and filters is the " "responsibility of the application developer, not the library developer. If " @@ -5335,11 +5402,11 @@ msgid "" "your loggers other than a :class:`~logging.NullHandler` instance." msgstr "" -#: ../../howto/logging-cookbook.rst:4123 +#: ../../howto/logging-cookbook.rst:4136 msgid "Creating a lot of loggers" msgstr "" -#: ../../howto/logging-cookbook.rst:4125 +#: ../../howto/logging-cookbook.rst:4138 msgid "" "Loggers are singletons that are never freed during a script execution, and " "so creating lots of loggers will use up memory which can't then be freed. " @@ -5350,38 +5417,38 @@ msgid "" "occasionally slightly more fine-grained than that)." msgstr "" -#: ../../howto/logging-cookbook.rst:4136 +#: ../../howto/logging-cookbook.rst:4149 msgid "Other resources" msgstr "其他資源" -#: ../../howto/logging-cookbook.rst:4140 +#: ../../howto/logging-cookbook.rst:4153 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../howto/logging-cookbook.rst:4141 +#: ../../howto/logging-cookbook.rst:4154 msgid "API reference for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4143 +#: ../../howto/logging-cookbook.rst:4156 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../howto/logging-cookbook.rst:4144 +#: ../../howto/logging-cookbook.rst:4157 msgid "Configuration API for the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4146 +#: ../../howto/logging-cookbook.rst:4159 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../howto/logging-cookbook.rst:4147 +#: ../../howto/logging-cookbook.rst:4160 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../howto/logging-cookbook.rst:4149 +#: ../../howto/logging-cookbook.rst:4162 msgid ":ref:`Basic Tutorial <logging-basic-tutorial>`" msgstr ":ref:`基礎教學 <logging-basic-tutorial>`" -#: ../../howto/logging-cookbook.rst:4151 +#: ../../howto/logging-cookbook.rst:4164 msgid ":ref:`Advanced Tutorial <logging-advanced-tutorial>`" msgstr ":ref:`進階教學 <logging-advanced-tutorial>`" diff --git a/howto/perf_profiling.po b/howto/perf_profiling.po index ae86e12830..07ffef15b4 100644 --- a/howto/perf_profiling.po +++ b/howto/perf_profiling.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-19 00:14+0000\n" "PO-Revision-Date: 2023-12-09 17:39+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -382,13 +382,13 @@ msgstr "如何啟用 ``perf`` 分析支援" msgid "" "``perf`` profiling support can be enabled either from the start using the " "environment variable :envvar:`PYTHONPERFSUPPORT` or the :option:`-X perf <-" -"X>` option, or dynamically using :func:`sys.activate_stack_trampoline` and :" -"func:`sys.deactivate_stack_trampoline`." +"X>` option, or dynamically using :func:`sys.activate_stack_trampoline` " +"and :func:`sys.deactivate_stack_trampoline`." msgstr "" -"要啟用 ``perf`` 分析支援,可以在一開始就使用環境變數 :envvar:" -"`PYTHONPERFSUPPORT` 或使用 :option:`-X perf <-X>` 選項,也可以使用 :func:" -"`sys.activate_stack_trampoline` 和 :func:`sys.deactivate_stack_trampoline` 來" -"動態啟用。" +"要啟用 ``perf`` 分析支援,可以在一開始就使用環境變" +"數 :envvar:`PYTHONPERFSUPPORT` 或使用 :option:`-X perf <-X>` 選項,也可以使" +"用 :func:`sys.activate_stack_trampoline` " +"和 :func:`sys.deactivate_stack_trampoline` 來動態啟用。" #: ../../howto/perf_profiling.rst:160 msgid "" @@ -403,10 +403,12 @@ msgstr "例如,使用環境變數: ::" #: ../../howto/perf_profiling.rst:165 msgid "" -"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python script.py\n" +"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python " +"my_script.py\n" "$ perf report -g -i perf.data" msgstr "" -"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python script.py\n" +"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python " +"my_script.py\n" "$ perf report -g -i perf.data" #: ../../howto/perf_profiling.rst:168 @@ -415,10 +417,10 @@ msgstr "例如,使用 :option:`!-X` 選項: ::" #: ../../howto/perf_profiling.rst:170 msgid "" -"$ perf record -F 9999 -g -o perf.data python -X perf script.py\n" +"$ perf record -F 9999 -g -o perf.data python -X perf my_script.py\n" "$ perf report -g -i perf.data" msgstr "" -"$ perf record -F 9999 -g -o perf.data python -X perf script.py\n" +"$ perf record -F 9999 -g -o perf.data python -X perf my_script.py\n" "$ perf report -g -i perf.data" #: ../../howto/perf_profiling.rst:173 @@ -507,9 +509,9 @@ msgstr "" #: ../../howto/perf_profiling.rst:220 msgid "" -"To enable this mode, you can use the environment variable :envvar:" -"`PYTHON_PERF_JIT_SUPPORT` or the :option:`-X perf_jit <-X>` option, which " -"will enable the JIT mode for the ``perf`` profiler." +"To enable this mode, you can use the environment " +"variable :envvar:`PYTHON_PERF_JIT_SUPPORT` or the :option:`-X perf_jit <-X>` " +"option, which will enable the JIT mode for the ``perf`` profiler." msgstr "" #: ../../howto/perf_profiling.rst:226 @@ -536,13 +538,13 @@ msgstr "" #: ../../howto/perf_profiling.rst:239 msgid "" -"$ perf record -F 9999 -g --call-graph dwarf -o perf.data python -Xperf_jit " -"my_script.py\n" +"$ perf record -F 9999 -g -k 1 --call-graph dwarf -o perf.data python " +"-Xperf_jit my_script.py\n" "$ perf inject -i perf.data --jit --output perf.jit.data\n" "$ perf report -g -i perf.jit.data" msgstr "" -"$ perf record -F 9999 -g --call-graph dwarf -o perf.data python -Xperf_jit " -"my_script.py\n" +"$ perf record -F 9999 -g -k 1 --call-graph dwarf -o perf.data python " +"-Xperf_jit my_script.py\n" "$ perf inject -i perf.data --jit --output perf.jit.data\n" "$ perf report -g -i perf.jit.data" @@ -574,13 +576,56 @@ msgstr "" #: ../../howto/perf_profiling.rst:257 msgid "" -"Notice that when using ``--call-graph dwarf`` the ``perf`` tool will take " -"snapshots of the stack of the process being profiled and save the " -"information in the ``perf.data`` file. By default the size of the stack dump " -"is 8192 bytes but the user can change the size by passing the size after " -"comma like ``--call-graph dwarf,4096``. The size of the stack dump is " -"important because if the size is too small ``perf`` will not be able to " -"unwind the stack and the output will be incomplete. On the other hand, if " -"the size is too big, then ``perf`` won't be able to sample the process as " -"frequently as it would like as the overhead will be higher." +"When using ``--call-graph dwarf``, the ``perf`` tool will take snapshots of " +"the stack of the process being profiled and save the information in the " +"``perf.data`` file. By default, the size of the stack dump is 8192 bytes, " +"but you can change the size by passing it after a comma like ``--call-graph " +"dwarf,16384``." +msgstr "" + +#: ../../howto/perf_profiling.rst:263 +msgid "" +"The size of the stack dump is important because if the size is too small " +"``perf`` will not be able to unwind the stack and the output will be " +"incomplete. On the other hand, if the size is too big, then ``perf`` won't " +"be able to sample the process as frequently as it would like as the overhead " +"will be higher." +msgstr "" + +#: ../../howto/perf_profiling.rst:269 +msgid "" +"The stack size is particularly important when profiling Python code compiled " +"with low optimization levels (like ``-O0``), as these builds tend to have " +"larger stack frames. If you are compiling Python with ``-O0`` and not seeing " +"Python functions in your profiling output, try increasing the stack dump " +"size to 65528 bytes (the maximum)::" +msgstr "" + +#: ../../howto/perf_profiling.rst:275 +msgid "" +"$ perf record -F 9999 -g -k 1 --call-graph dwarf,65528 -o perf.data python " +"-Xperf_jit my_script.py" +msgstr "" +"$ perf record -F 9999 -g -k 1 --call-graph dwarf,65528 -o perf.data python " +"-Xperf_jit my_script.py" + +#: ../../howto/perf_profiling.rst:277 +msgid "Different compilation flags can significantly impact stack sizes:" +msgstr "" + +#: ../../howto/perf_profiling.rst:279 +msgid "" +"Builds with ``-O0`` typically have much larger stack frames than those with " +"``-O1`` or higher" +msgstr "" + +#: ../../howto/perf_profiling.rst:280 +msgid "" +"Adding optimizations (``-O1``, ``-O2``, etc.) typically reduces stack size" +msgstr "" + +#: ../../howto/perf_profiling.rst:281 +msgid "" +"Frame pointers (``-fno-omit-frame-pointer``) generally provide more reliable " +"stack unwinding" msgstr "" diff --git a/howto/regex.po b/howto/regex.po index 42467d34b9..b261243bd7 100644 --- a/howto/regex.po +++ b/howto/regex.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -120,12 +120,12 @@ msgstr "" #: ../../howto/regex.rst:70 msgid "" -"There are exceptions to this rule; some characters are special :dfn:" -"`metacharacters`, and don't match themselves. Instead, they signal that " -"some out-of-the-ordinary thing should be matched, or they affect other " -"portions of the RE by repeating them or changing their meaning. Much of " -"this document is devoted to discussing various metacharacters and what they " -"do." +"There are exceptions to this rule; some characters are " +"special :dfn:`metacharacters`, and don't match themselves. Instead, they " +"signal that some out-of-the-ordinary thing should be matched, or they affect " +"other portions of the RE by repeating them or changing their meaning. Much " +"of this document is devoted to discussing various metacharacters and what " +"they do." msgstr "" #: ../../howto/regex.rst:76 @@ -160,12 +160,12 @@ msgstr "" #: ../../howto/regex.rst:97 msgid "" -"You can match the characters not listed within the class by :dfn:" -"`complementing` the set. This is indicated by including a ``'^'`` as the " -"first character of the class. For example, ``[^5]`` will match any character " -"except ``'5'``. If the caret appears elsewhere in a character class, it " -"does not have special meaning. For example: ``[5^]`` will match either a " -"``'5'`` or a ``'^'``." +"You can match the characters not listed within the class " +"by :dfn:`complementing` the set. This is indicated by including a ``'^'`` " +"as the first character of the class. For example, ``[^5]`` will match any " +"character except ``'5'``. If the caret appears elsewhere in a character " +"class, it does not have special meaning. For example: ``[5^]`` will match " +"either a ``'5'`` or a ``'^'``." msgstr "" #: ../../howto/regex.rst:103 @@ -190,10 +190,10 @@ msgid "" "Let's take an example: ``\\w`` matches any alphanumeric character. If the " "regex pattern is expressed in bytes, this is equivalent to the class ``[a-zA-" "Z0-9_]``. If the regex pattern is a string, ``\\w`` will match all the " -"characters marked as letters in the Unicode database provided by the :mod:" -"`unicodedata` module. You can use the more restricted definition of ``\\w`` " -"in a string pattern by supplying the :const:`re.ASCII` flag when compiling " -"the regular expression." +"characters marked as letters in the Unicode database provided by " +"the :mod:`unicodedata` module. You can use the more restricted definition " +"of ``\\w`` in a string pattern by supplying the :const:`re.ASCII` flag when " +"compiling the regular expression." msgstr "" #: ../../howto/regex.rst:123 @@ -272,9 +272,9 @@ msgstr "" #: ../../howto/regex.rst:156 msgid "" "The final metacharacter in this section is ``.``. It matches anything " -"except a newline character, and there's an alternate mode (:const:`re." -"DOTALL`) where it will match even a newline. ``.`` is often used where you " -"want to match \"any character\"." +"except a newline character, and there's an alternate mode " +"(:const:`re.DOTALL`) where it will match even a newline. ``.`` is often " +"used where you want to match \"any character\"." msgstr "" #: ../../howto/regex.rst:163 @@ -524,8 +524,8 @@ msgid "" "and no special syntax was created for expressing them. (There are " "applications that don't need REs at all, so there's no need to bloat the " "language specification by including them.) Instead, the :mod:`re` module is " -"simply a C extension module included with Python, just like the :mod:" -"`socket` or :mod:`zlib` modules." +"simply a C extension module included with Python, just like " +"the :mod:`socket` or :mod:`zlib` modules." msgstr "" #: ../../howto/regex.rst:292 @@ -612,10 +612,10 @@ msgstr "" #: ../../howto/regex.rst:336 msgid "" "In addition, special escape sequences that are valid in regular expressions, " -"but not valid as Python string literals, now result in a :exc:" -"`DeprecationWarning` and will eventually become a :exc:`SyntaxError`, which " -"means the sequences will be invalid if raw string notation or escaping the " -"backslashes isn't used." +"but not valid as Python string literals, now result in " +"a :exc:`DeprecationWarning` and will eventually become a :exc:`SyntaxError`, " +"which means the sequences will be invalid if raw string notation or escaping " +"the backslashes isn't used." msgstr "" #: ../../howto/regex.rst:344 @@ -698,8 +698,8 @@ msgstr "``finditer()``" #: ../../howto/regex.rst:374 msgid "" -"Find all substrings where the RE matches, and returns them as an :term:" -"`iterator`." +"Find all substrings where the RE matches, and returns them as " +"an :term:`iterator`." msgstr "" #: ../../howto/regex.rst:378 @@ -831,11 +831,11 @@ msgstr "" #: ../../howto/regex.rst:438 msgid "" -":meth:`~re.Match.group` returns the substring that was matched by the RE. :" -"meth:`~re.Match.start` and :meth:`~re.Match.end` return the starting and " -"ending index of the match. :meth:`~re.Match.span` returns both start and end " -"indexes in a single tuple. Since the :meth:`~re.Pattern.match` method only " -"checks if the RE matches at the start of a string, :meth:`!start` will " +":meth:`~re.Match.group` returns the substring that was matched by the " +"RE. :meth:`~re.Match.start` and :meth:`~re.Match.end` return the starting " +"and ending index of the match. :meth:`~re.Match.span` returns both start and " +"end indexes in a single tuple. Since the :meth:`~re.Pattern.match` method " +"only checks if the RE matches at the start of a string, :meth:`!start` will " "always be zero. However, the :meth:`~re.Pattern.search` method of patterns " "scans through the string, so the match may not start at zero in that " "case. ::" @@ -886,8 +886,8 @@ msgstr "" #: ../../howto/regex.rst:466 msgid "" -"Two pattern methods return all of the matches for a pattern. :meth:`~re." -"Pattern.findall` returns a list of matching strings::" +"Two pattern methods return all of the matches for a " +"pattern. :meth:`~re.Pattern.findall` returns a list of matching strings::" msgstr "" #: ../../howto/regex.rst:469 @@ -905,22 +905,22 @@ msgid "" "The ``r`` prefix, making the literal a raw string literal, is needed in this " "example because escape sequences in a normal \"cooked\" string literal that " "are not recognized by Python, as opposed to regular expressions, now result " -"in a :exc:`DeprecationWarning` and will eventually become a :exc:" -"`SyntaxError`. See :ref:`the-backslash-plague`." +"in a :exc:`DeprecationWarning` and will eventually become " +"a :exc:`SyntaxError`. See :ref:`the-backslash-plague`." msgstr "" #: ../../howto/regex.rst:479 msgid "" ":meth:`~re.Pattern.findall` has to create the entire list before it can be " "returned as the result. The :meth:`~re.Pattern.finditer` method returns a " -"sequence of :ref:`match object <match-objects>` instances as an :term:" -"`iterator`::" +"sequence of :ref:`match object <match-objects>` instances as " +"an :term:`iterator`::" msgstr "" #: ../../howto/regex.rst:483 msgid "" ">>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')\n" -">>> iterator \n" +">>> iterator\n" "<callable_iterator object at 0x...>\n" ">>> for match in iterator:\n" "... print(match.span())\n" @@ -930,7 +930,7 @@ msgid "" "(29, 31)" msgstr "" ">>> iterator = p.finditer('12 drummers drumming, 11 ... 10 ...')\n" -">>> iterator \n" +">>> iterator\n" "<callable_iterator object at 0x...>\n" ">>> for match in iterator:\n" "... print(match.span())\n" @@ -941,28 +941,28 @@ msgstr "" #: ../../howto/regex.rst:495 msgid "Module-Level Functions" -msgstr "" +msgstr "模組層級函式" #: ../../howto/regex.rst:497 msgid "" -"You don't have to create a pattern object and call its methods; the :mod:" -"`re` module also provides top-level functions called :func:`~re.match`, :" -"func:`~re.search`, :func:`~re.findall`, :func:`~re.sub`, and so forth. " -"These functions take the same arguments as the corresponding pattern method " -"with the RE string added as the first argument, and still return either " -"``None`` or a :ref:`match object <match-objects>` instance. ::" +"You don't have to create a pattern object and call its methods; " +"the :mod:`re` module also provides top-level functions " +"called :func:`~re.match`, :func:`~re.search`, :func:`~re.findall`, :func:`~re.sub`, " +"and so forth. These functions take the same arguments as the corresponding " +"pattern method with the RE string added as the first argument, and still " +"return either ``None`` or a :ref:`match object <match-objects>` instance. ::" msgstr "" #: ../../howto/regex.rst:504 msgid "" ">>> print(re.match(r'From\\s+', 'Fromage amk'))\n" "None\n" -">>> re.match(r'From\\s+', 'From amk Thu May 14 19:12:10 1998') \n" +">>> re.match(r'From\\s+', 'From amk Thu May 14 19:12:10 1998')\n" "<re.Match object; span=(0, 5), match='From '>" msgstr "" ">>> print(re.match(r'From\\s+', 'Fromage amk'))\n" "None\n" -">>> re.match(r'From\\s+', 'From amk Thu May 14 19:12:10 1998') \n" +">>> re.match(r'From\\s+', 'From amk Thu May 14 19:12:10 1998')\n" "<re.Match object; span=(0, 5), match='From '>" #: ../../howto/regex.rst:509 @@ -989,12 +989,12 @@ msgstr "" msgid "" "Compilation flags let you modify some aspects of how regular expressions " "work. Flags are available in the :mod:`re` module under two names, a long " -"name such as :const:`IGNORECASE` and a short, one-letter form such as :const:" -"`I`. (If you're familiar with Perl's pattern modifiers, the one-letter " -"forms use the same letters; the short form of :const:`re.VERBOSE` is :const:" -"`re.X`, for example.) Multiple flags can be specified by bitwise OR-ing " -"them; ``re.I | re.M`` sets both the :const:`I` and :const:`M` flags, for " -"example." +"name such as :const:`IGNORECASE` and a short, one-letter form such " +"as :const:`I`. (If you're familiar with Perl's pattern modifiers, the one-" +"letter forms use the same letters; the short form of :const:`re.VERBOSE` " +"is :const:`re.X`, for example.) Multiple flags can be specified by bitwise " +"OR-ing them; ``re.I | re.M`` sets both the :const:`I` and :const:`M` flags, " +"for example." msgstr "" #: ../../howto/regex.rst:534 @@ -1074,8 +1074,8 @@ msgid "" "letter dotless i), 'ſ' (U+017F, Latin small letter long s) and 'K' (U+212A, " "Kelvin sign). ``Spam`` will match ``'Spam'``, ``'spam'``, ``'spAM'``, or " "``'ſpam'`` (the latter is matched only in Unicode mode). This lowercasing " -"doesn't take the current locale into account; it will if you also set the :" -"const:`LOCALE` flag." +"doesn't take the current locale into account; it will if you also set " +"the :const:`LOCALE` flag." msgstr "" #: ../../howto/regex.rst:581 @@ -1245,9 +1245,9 @@ msgstr "``^``" #: ../../howto/regex.rst:707 msgid "" "Matches at the beginning of lines. Unless the :const:`MULTILINE` flag has " -"been set, this will only match at the beginning of the string. In :const:" -"`MULTILINE` mode, this also matches immediately after each newline within " -"the string." +"been set, this will only match at the beginning of the string. " +"In :const:`MULTILINE` mode, this also matches immediately after each newline " +"within the string." msgstr "" #: ../../howto/regex.rst:711 @@ -1258,12 +1258,12 @@ msgstr "" #: ../../howto/regex.rst:714 msgid "" -">>> print(re.search('^From', 'From Here to Eternity')) \n" +">>> print(re.search('^From', 'From Here to Eternity'))\n" "<re.Match object; span=(0, 4), match='From'>\n" ">>> print(re.search('^From', 'Reciting From Memory'))\n" "None" msgstr "" -">>> print(re.search('^From', 'From Here to Eternity')) \n" +">>> print(re.search('^From', 'From Here to Eternity'))\n" "<re.Match object; span=(0, 4), match='From'>\n" ">>> print(re.search('^From', 'Reciting From Memory'))\n" "None" @@ -1284,18 +1284,18 @@ msgstr "" #: ../../howto/regex.rst:725 msgid "" -">>> print(re.search('}$', '{block}')) \n" +">>> print(re.search('}$', '{block}'))\n" "<re.Match object; span=(6, 7), match='}'>\n" ">>> print(re.search('}$', '{block} '))\n" "None\n" -">>> print(re.search('}$', '{block}\\n')) \n" +">>> print(re.search('}$', '{block}\\n'))\n" "<re.Match object; span=(6, 7), match='}'>" msgstr "" -">>> print(re.search('}$', '{block}')) \n" +">>> print(re.search('}$', '{block}'))\n" "<re.Match object; span=(6, 7), match='}'>\n" ">>> print(re.search('}$', '{block} '))\n" "None\n" -">>> print(re.search('}$', '{block}\\n')) \n" +">>> print(re.search('}$', '{block}\\n'))\n" "<re.Match object; span=(6, 7), match='}'>" #: ../../howto/regex.rst:732 @@ -1459,12 +1459,12 @@ msgstr "" msgid "" "Groups indicated with ``'('``, ``')'`` also capture the starting and ending " "index of the text that they match; this can be retrieved by passing an " -"argument to :meth:`~re.Match.group`, :meth:`~re.Match.start`, :meth:`~re." -"Match.end`, and :meth:`~re.Match.span`. Groups are numbered starting with " -"0. Group 0 is always present; it's the whole RE, so :ref:`match object " -"<match-objects>` methods all have group 0 as their default argument. Later " -"we'll see how to express groups that don't capture the span of text that " -"they match. ::" +"argument " +"to :meth:`~re.Match.group`, :meth:`~re.Match.start`, :meth:`~re.Match.end`, " +"and :meth:`~re.Match.span`. Groups are numbered starting with 0. Group 0 " +"is always present; it's the whole RE, so :ref:`match object <match-objects>` " +"methods all have group 0 as their default argument. Later we'll see how to " +"express groups that don't capture the span of text that they match. ::" msgstr "" #: ../../howto/regex.rst:824 @@ -1693,8 +1693,8 @@ msgstr "" #: ../../howto/regex.rst:946 msgid "" -"Additionally, you can retrieve named groups as a dictionary with :meth:`~re." -"Match.groupdict`::" +"Additionally, you can retrieve named groups as a dictionary " +"with :meth:`~re.Match.groupdict`::" msgstr "" #: ../../howto/regex.rst:949 @@ -1710,8 +1710,8 @@ msgstr "" #: ../../howto/regex.rst:953 msgid "" "Named groups are handy because they let you use easily remembered names, " -"instead of having to remember numbers. Here's an example RE from the :mod:" -"`imaplib` module::" +"instead of having to remember numbers. Here's an example RE from " +"the :mod:`imaplib` module::" msgstr "" #: ../../howto/regex.rst:957 @@ -1743,8 +1743,8 @@ msgid "" "name instead of the number. This is another Python extension: ``(?P=name)`` " "indicates that the contents of the group called *name* should again be " "matched at the current point. The regular expression for finding doubled " -"words, ``\\b(\\w+)\\s+\\1\\b`` can also be written as ``\\b(?" -"P<word>\\w+)\\s+(?P=word)\\b``::" +"words, ``\\b(\\w+)\\s+\\1\\b`` can also be written as ``\\b(?P<word>\\w+)\\s+" +"(?P=word)\\b``::" msgstr "" #: ../../howto/regex.rst:974 @@ -1840,10 +1840,10 @@ msgid "" "The expression gets messier when you try to patch up the first solution by " "requiring one of the following cases to match: the first character of the " "extension isn't ``b``; the second character isn't ``a``; or the third " -"character isn't ``t``. This accepts ``foo.bar`` and rejects ``autoexec." -"bat``, but it requires a three-letter extension and won't accept a filename " -"with a two-letter extension such as ``sendmail.cf``. We'll complicate the " -"pattern again in an effort to fix it." +"character isn't ``t``. This accepts ``foo.bar`` and rejects " +"``autoexec.bat``, but it requires a three-letter extension and won't accept " +"a filename with a two-letter extension such as ``sendmail.cf``. We'll " +"complicate the pattern again in an effort to fix it." msgstr "" #: ../../howto/regex.rst:1030 @@ -2216,13 +2216,13 @@ msgstr "" #: ../../howto/regex.rst:1243 msgid "" "Sometimes using the :mod:`re` module is a mistake. If you're matching a " -"fixed string, or a single character class, and you're not using any :mod:" -"`re` features such as the :const:`~re.IGNORECASE` flag, then the full power " -"of regular expressions may not be required. Strings have several methods for " -"performing operations with fixed strings and they're usually much faster, " -"because the implementation is a single small C loop that's been optimized " -"for the purpose, instead of the large, more generalized regular expression " -"engine." +"fixed string, or a single character class, and you're not using " +"any :mod:`re` features such as the :const:`~re.IGNORECASE` flag, then the " +"full power of regular expressions may not be required. Strings have several " +"methods for performing operations with fixed strings and they're usually " +"much faster, because the implementation is a single small C loop that's been " +"optimized for the purpose, instead of the large, more generalized regular " +"expression engine." msgstr "" #: ../../howto/regex.rst:1251 @@ -2234,8 +2234,8 @@ msgid "" "turning ``swordfish`` into ``sdeedfish``, but the naive RE ``word`` would " "have done that, too. (To avoid performing the substitution on parts of " "words, the pattern would have to be ``\\bword\\b``, in order to require that " -"``word`` have a word boundary on either side. This takes the job beyond :" -"meth:`!replace`'s abilities.)" +"``word`` have a word boundary on either side. This takes the job " +"beyond :meth:`!replace`'s abilities.)" msgstr "" #: ../../howto/regex.rst:1260 @@ -2299,14 +2299,15 @@ msgstr "" #: ../../howto/regex.rst:1292 msgid "" -"Sometimes you'll be tempted to keep using :func:`re.match`, and just add ``." -"*`` to the front of your RE. Resist this temptation and use :func:`re." -"search` instead. The regular expression compiler does some analysis of REs " -"in order to speed up the process of looking for a match. One such analysis " -"figures out what the first character of a match must be; for example, a " -"pattern starting with ``Crow`` must match starting with a ``'C'``. The " -"analysis lets the engine quickly scan through the string looking for the " -"starting character, only trying the full match if a ``'C'`` is found." +"Sometimes you'll be tempted to keep using :func:`re.match`, and just add " +"``.*`` to the front of your RE. Resist this temptation and " +"use :func:`re.search` instead. The regular expression compiler does some " +"analysis of REs in order to speed up the process of looking for a match. " +"One such analysis figures out what the first character of a match must be; " +"for example, a pattern starting with ``Crow`` must match starting with a " +"``'C'``. The analysis lets the engine quickly scan through the string " +"looking for the starting character, only trying the full match if a ``'C'`` " +"is found." msgstr "" #: ../../howto/regex.rst:1301 diff --git a/howto/unicode.po b/howto/unicode.po index b7b29e8cd1..66eab41171 100644 --- a/howto/unicode.po +++ b/howto/unicode.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -79,10 +79,10 @@ msgstr "" msgid "" "The Unicode standard describes how characters are represented by **code " "points**. A code point value is an integer in the range 0 to 0x10FFFF " -"(about 1.1 million values, the `actual number assigned <https://www.unicode." -"org/versions/latest/#Summary>`_ is less than that). In the standard and in " -"this document, a code point is written using the notation ``U+265E`` to mean " -"the character with value ``0x265e`` (9,822 in decimal)." +"(about 1.1 million values, the `actual number assigned <https://" +"www.unicode.org/versions/latest/#Summary>`_ is less than that). In the " +"standard and in this document, a code point is written using the notation " +"``U+265E`` to mean the character with value ``0x265e`` (9,822 in decimal)." msgstr "" #: ../../howto/unicode.rst:50 @@ -301,8 +301,8 @@ msgstr "" #: ../../howto/unicode.rst:173 msgid "" -"Another `good introductory article <https://www.joelonsoftware." -"com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-" +"Another `good introductory article <https://www.joelonsoftware.com/" +"2003/10/08/the-absolute-minimum-every-software-developer-absolutely-" "positively-must-know-about-unicode-and-character-sets-no-excuses/>`_ was " "written by Joel Spolsky. If this introduction didn't make things clear to " "you, you should try reading this alternate article before continuing." @@ -406,7 +406,7 @@ msgstr "" #: ../../howto/unicode.rst:236 msgid "" -">>> b'\\x80abc'.decode(\"utf-8\", \"strict\") \n" +">>> b'\\x80abc'.decode(\"utf-8\", \"strict\")\n" "Traceback (most recent call last):\n" " ...\n" "UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0:\n" @@ -418,7 +418,7 @@ msgid "" ">>> b'\\x80abc'.decode(\"utf-8\", \"ignore\")\n" "'abc'" msgstr "" -">>> b'\\x80abc'.decode(\"utf-8\", \"strict\") \n" +">>> b'\\x80abc'.decode(\"utf-8\", \"strict\")\n" "Traceback (most recent call last):\n" " ...\n" "UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0:\n" @@ -473,10 +473,10 @@ msgstr "" #: ../../howto/unicode.rst:272 msgid "" -"The *errors* parameter is the same as the parameter of the :meth:`~bytes." -"decode` method but supports a few more possible handlers. As well as " -"``'strict'``, ``'ignore'``, and ``'replace'`` (which in this case inserts a " -"question mark instead of the unencodable character), there is also " +"The *errors* parameter is the same as the parameter of " +"the :meth:`~bytes.decode` method but supports a few more possible handlers. " +"As well as ``'strict'``, ``'ignore'``, and ``'replace'`` (which in this case " +"inserts a question mark instead of the unencodable character), there is also " "``'xmlcharrefreplace'`` (inserts an XML character reference), " "``backslashreplace`` (inserts a ``\\uNNNN`` escape sequence) and " "``namereplace`` (inserts a ``\\N{...}`` escape sequence)." @@ -491,7 +491,7 @@ msgid "" ">>> u = chr(40960) + 'abcd' + chr(1972)\n" ">>> u.encode('utf-8')\n" "b'\\xea\\x80\\x80abcd\\xde\\xb4'\n" -">>> u.encode('ascii') \n" +">>> u.encode('ascii')\n" "Traceback (most recent call last):\n" " ...\n" "UnicodeEncodeError: 'ascii' codec can't encode character '\\ua000' in\n" @@ -510,7 +510,7 @@ msgstr "" ">>> u = chr(40960) + 'abcd' + chr(1972)\n" ">>> u.encode('utf-8')\n" "b'\\xea\\x80\\x80abcd\\xde\\xb4'\n" -">>> u.encode('ascii') \n" +">>> u.encode('ascii')\n" "Traceback (most recent call last):\n" " ...\n" "UnicodeEncodeError: 'ascii' codec can't encode character '\\ua000' in\n" @@ -674,9 +674,9 @@ msgid "" "subcategories. To take the codes from the above output, ``'Ll'`` means " "'Letter, lowercase', ``'No'`` means \"Number, other\", ``'Mn'`` is \"Mark, " "nonspacing\", and ``'So'`` is \"Symbol, other\". See `the General Category " -"Values section of the Unicode Character Database documentation <https://www." -"unicode.org/reports/tr44/#General_Category_Values>`_ for a list of category " -"codes." +"Values section of the Unicode Character Database documentation <https://" +"www.unicode.org/reports/tr44/#General_Category_Values>`_ for a list of " +"category codes." msgstr "" #: ../../howto/unicode.rst:402 @@ -714,12 +714,12 @@ msgstr "" #: ../../howto/unicode.rst:425 msgid "" -"A second tool is the :mod:`unicodedata` module's :func:`~unicodedata." -"normalize` function that converts strings to one of several normal forms, " -"where letters followed by a combining character are replaced with single " -"characters. :func:`~unicodedata.normalize` can be used to perform string " -"comparisons that won't falsely report inequality if two strings use " -"combining characters differently:" +"A second tool is the :mod:`unicodedata` " +"module's :func:`~unicodedata.normalize` function that converts strings to " +"one of several normal forms, where letters followed by a combining character " +"are replaced with single characters. :func:`~unicodedata.normalize` can be " +"used to perform string comparisons that won't falsely report inequality if " +"two strings use combining characters differently:" msgstr "" #: ../../howto/unicode.rst:434 @@ -863,8 +863,9 @@ msgstr "" #: ../../howto/unicode.rst:520 msgid "" -"`Processing Text Files in Python 3 <https://python-notes.curiousefficiency." -"org/en/latest/python3/text_file_processing.html>`_, by Nick Coghlan." +"`Processing Text Files in Python 3 <https://python-" +"notes.curiousefficiency.org/en/latest/python3/text_file_processing.html>`_, " +"by Nick Coghlan." msgstr "" #: ../../howto/unicode.rst:521 @@ -875,8 +876,8 @@ msgstr "" #: ../../howto/unicode.rst:523 msgid "" -"The :class:`str` type is described in the Python library reference at :ref:" -"`textseq`." +"The :class:`str` type is described in the Python library reference " +"at :ref:`textseq`." msgstr "" #: ../../howto/unicode.rst:526 @@ -947,8 +948,8 @@ msgid "" "object that assumes the file's contents are in a specified encoding and " "accepts Unicode parameters for methods such as :meth:`~io.TextIOBase.read` " "and :meth:`~io.TextIOBase.write`. This works through :func:`open`\\'s " -"*encoding* and *errors* parameters which are interpreted just like those in :" -"meth:`str.encode` and :meth:`bytes.decode`." +"*encoding* and *errors* parameters which are interpreted just like those " +"in :meth:`str.encode` and :meth:`bytes.decode`." msgstr "" #: ../../howto/unicode.rst:574 @@ -1217,8 +1218,8 @@ msgstr "" #: ../../howto/unicode.rst:737 msgid "" -"One section of `Mastering Python 3 Input/Output <https://pyvideo.org/" -"video/289/pycon-2010--mastering-python-3-i-o>`_, a PyCon 2010 talk by David " +"One section of `Mastering Python 3 Input/Output <https://pyvideo.org/video/" +"289/pycon-2010--mastering-python-3-i-o>`_, a PyCon 2010 talk by David " "Beazley, discusses text processing and binary data handling." msgstr "" diff --git a/howto/urllib2.po b/howto/urllib2.po index 4e79e88dd9..bff4e431ba 100644 --- a/howto/urllib2.po +++ b/howto/urllib2.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2022-06-27 09:36+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,11 +43,11 @@ msgstr "以下這些與 Python 有關的文章說不定能幫到你::" #: ../../howto/urllib2.rst:18 msgid "" -"`Basic Authentication <https://web.archive.org/web/20201215133350/http://www." -"voidspace.org.uk/python/articles/authentication.shtml>`_" +"`Basic Authentication <https://web.archive.org/web/20201215133350/http://" +"www.voidspace.org.uk/python/articles/authentication.shtml>`_" msgstr "" -"`Basic Authentication <https://web.archive.org/web/20201215133350/http://www." -"voidspace.org.uk/python/articles/authentication.shtml>`_" +"`Basic Authentication <https://web.archive.org/web/20201215133350/http://" +"www.voidspace.org.uk/python/articles/authentication.shtml>`_" #: ../../howto/urllib2.rst:20 msgid "A tutorial on *Basic Authentication*, with examples in Python." @@ -114,8 +114,8 @@ msgstr "" #: ../../howto/urllib2.rst:52 msgid "" "If you wish to retrieve a resource via URL and store it in a temporary " -"location, you can do so via the :func:`shutil.copyfileobj` and :func:" -"`tempfile.NamedTemporaryFile` functions::" +"location, you can do so via the :func:`shutil.copyfileobj` " +"and :func:`tempfile.NamedTemporaryFile` functions::" msgstr "" #: ../../howto/urllib2.rst:56 @@ -274,7 +274,7 @@ msgid "" ">>> data['location'] = 'Northampton'\n" ">>> data['language'] = 'Python'\n" ">>> url_values = urllib.parse.urlencode(data)\n" -">>> print(url_values) # The order may differ from below. \n" +">>> print(url_values) # The order may differ from below.\n" "name=Somebody+Here&language=Python&location=Northampton\n" ">>> url = 'http://www.example.com/example.cgi'\n" ">>> full_url = url + '?' + url_values\n" @@ -287,7 +287,7 @@ msgstr "" ">>> data['location'] = 'Northampton'\n" ">>> data['language'] = 'Python'\n" ">>> url_values = urllib.parse.urlencode(data)\n" -">>> print(url_values) # The order may differ from below. \n" +">>> print(url_values) # The order may differ from below.\n" "name=Somebody+Here&language=Python&location=Northampton\n" ">>> url = 'http://www.example.com/example.cgi'\n" ">>> full_url = url + '?' + url_values\n" @@ -370,14 +370,14 @@ msgstr "" #: ../../howto/urllib2.rst:197 msgid "" "*urlopen* raises :exc:`~urllib.error.URLError` when it cannot handle a " -"response (though as usual with Python APIs, built-in exceptions such as :exc:" -"`ValueError`, :exc:`TypeError` etc. may also be raised)." +"response (though as usual with Python APIs, built-in exceptions such " +"as :exc:`ValueError`, :exc:`TypeError` etc. may also be raised)." msgstr "" #: ../../howto/urllib2.rst:201 msgid "" -":exc:`~urllib.error.HTTPError` is the subclass of :exc:`~urllib.error." -"URLError` raised in the specific case of HTTP URLs." +":exc:`~urllib.error.HTTPError` is the subclass " +"of :exc:`~urllib.error.URLError` raised in the specific case of HTTP URLs." msgstr "" #: ../../howto/urllib2.rst:204 @@ -405,14 +405,14 @@ msgid "" ">>> req = urllib.request.Request('http://www.pretend_server.org/')\n" ">>> try: urllib.request.urlopen(req)\n" "... except urllib.error.URLError as e:\n" -"... print(e.reason) \n" +"... print(e.reason)\n" "...\n" "(4, 'getaddrinfo failed')" msgstr "" ">>> req = urllib.request.Request('http://www.pretend_server.org/')\n" ">>> try: urllib.request.urlopen(req)\n" "... except urllib.error.URLError as e:\n" -"... print(e.reason) \n" +"... print(e.reason)\n" "...\n" "(4, 'getaddrinfo failed')" @@ -427,9 +427,9 @@ msgid "" "request. The default handlers will handle some of these responses for you " "(for example, if the response is a \"redirection\" that requests the client " "fetch the document from a different URL, urllib will handle that for you). " -"For those it can't handle, urlopen will raise an :exc:`~urllib.error." -"HTTPError`. Typical errors include '404' (page not found), '403' (request " -"forbidden), and '401' (authentication required)." +"For those it can't handle, urlopen will raise " +"an :exc:`~urllib.error.HTTPError`. Typical errors include '404' (page not " +"found), '403' (request forbidden), and '401' (authentication required)." msgstr "" #: ../../howto/urllib2.rst:235 @@ -548,12 +548,12 @@ msgid "" "... urllib.request.urlopen(req)\n" "... except urllib.error.HTTPError as e:\n" "... print(e.code)\n" -"... print(e.read()) \n" +"... print(e.read())\n" "...\n" "404\n" "b'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" -" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional." -"dtd\">\\n\\n\\n<html\n" +" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-" +"transitional.dtd\">\\n\\n\\n<html\n" " ...\n" " <title>Page Not Found\\n\n" " ..." @@ -563,12 +563,12 @@ msgstr "" "... urllib.request.urlopen(req)\n" "... except urllib.error.HTTPError as e:\n" "... print(e.code)\n" -"... print(e.read()) \n" +"... print(e.read())\n" "...\n" "404\n" "b'\\n\\n\\n\\n\\n\\nPage Not Found\\n\n" " ..." @@ -579,9 +579,9 @@ msgstr "" #: ../../howto/urllib2.rst:341 msgid "" -"So if you want to be prepared for :exc:`~urllib.error.HTTPError` *or* :exc:" -"`~urllib.error.URLError` there are two basic approaches. I prefer the second " -"approach." +"So if you want to be prepared for :exc:`~urllib.error.HTTPError` " +"*or* :exc:`~urllib.error.URLError` there are two basic approaches. I prefer " +"the second approach." msgstr "" #: ../../howto/urllib2.rst:345 @@ -655,8 +655,8 @@ msgstr "" #: ../../howto/urllib2.rst:402 msgid "" "**info** - this returns a dictionary-like object that describes the page " -"fetched, particularly the headers sent by the server. It is currently an :" -"class:`http.client.HTTPMessage` instance." +"fetched, particularly the headers sent by the server. It is currently " +"an :class:`http.client.HTTPMessage` instance." msgstr "" #: ../../howto/urllib2.rst:406 @@ -691,8 +691,8 @@ msgstr "" #: ../../howto/urllib2.rst:427 msgid "" -"To create an opener, instantiate an ``OpenerDirector``, and then call ``." -"add_handler(some_handler_instance)`` repeatedly." +"To create an opener, instantiate an ``OpenerDirector``, and then call " +"``.add_handler(some_handler_instance)`` repeatedly." msgstr "" #: ../../howto/urllib2.rst:430 @@ -850,8 +850,8 @@ msgstr "" #: ../../howto/urllib2.rst:540 msgid "" "Currently ``urllib.request`` *does not* support fetching of ``https`` " -"locations through a proxy. However, this can be enabled by extending urllib." -"request as shown in the recipe [#]_." +"locations through a proxy. However, this can be enabled by extending " +"urllib.request as shown in the recipe [#]_." msgstr "" #: ../../howto/urllib2.rst:546 @@ -875,9 +875,9 @@ msgid "" "As of Python 2.3 you can specify how long a socket should wait for a " "response before timing out. This can be useful in applications which have to " "fetch web pages. By default the socket module has *no timeout* and can hang. " -"Currently, the socket timeout is not exposed at the http.client or urllib." -"request levels. However, you can set the default timeout globally for all " -"sockets using ::" +"Currently, the socket timeout is not exposed at the http.client or " +"urllib.request levels. However, you can set the default timeout globally for " +"all sockets using ::" msgstr "" #: ../../howto/urllib2.rst:562 @@ -897,7 +897,7 @@ msgstr "" #: ../../howto/urllib2.rst:579 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../howto/urllib2.rst:581 msgid "This document was reviewed and revised by John Lee." @@ -940,13 +940,3 @@ msgid "" "code.activestate.com/recipes/456195-urrlib2-opener-for-ssl-proxy-connect-" "method/>`_." msgstr "" - -#~ msgid "" -#~ "There is a French translation of an earlier revision of this HOWTO, " -#~ "available at `urllib2 - Le Manuel manquant `_." -#~ msgstr "" -#~ "這份指南出自於早期版本的法文翻譯 `urllib2 - Le Manuel manquant `_。" diff --git a/library/abc.po b/library/abc.po index 10dc2f9958..9a2d736b8d 100644 --- a/library/abc.po +++ b/library/abc.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-27 00:14+0000\n" +"POT-Creation-Date: 2025-02-27 00:15+0000\n" "PO-Revision-Date: 2022-11-16 03:29+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,8 +33,9 @@ msgstr "**原始碼:**\\ :source:`Lib/abc.py`" msgid "" "This module provides the infrastructure for defining :term:`abstract base " "classes ` (ABCs) in Python, as outlined in :pep:`3119`; " -"see the PEP for why this was added to Python. (See also :pep:`3141` and the :" -"mod:`numbers` module regarding a type hierarchy for numbers based on ABCs.)" +"see the PEP for why this was added to Python. (See also :pep:`3141` and " +"the :mod:`numbers` module regarding a type hierarchy for numbers based on " +"ABCs.)" msgstr "" "如同在 :pep:`3119` 中所述,該模組提供了在 Python 中定義\\ :term:`抽象基底類" "別 ` (ABC) 的基礎元件;若想瞭解為什麼需要在 Python 中增" @@ -44,10 +45,10 @@ msgstr "" #: ../../library/abc.rst:20 msgid "" "The :mod:`collections` module has some concrete classes that derive from " -"ABCs; these can, of course, be further derived. In addition, the :mod:" -"`collections.abc` submodule has some ABCs that can be used to test whether a " -"class or instance provides a particular interface, for example, if it is :" -"term:`hashable` or if it is a :term:`mapping`." +"ABCs; these can, of course, be further derived. In addition, " +"the :mod:`collections.abc` submodule has some ABCs that can be used to test " +"whether a class or instance provides a particular interface, for example, if " +"it is :term:`hashable` or if it is a :term:`mapping`." msgstr "" ":mod:`collections` 模組中有一些衍生自 ABC 的具體類別;當然這些類別還可以進一" "步衍生出其他類別。此外,:mod:`collections.abc` 子模組中有一些 ABC 可被用於測" @@ -68,9 +69,9 @@ msgid "" "an abstract base class can be created by simply deriving from :class:`!ABC` " "avoiding sometimes confusing metaclass usage, for example::" msgstr "" -"一個使用 :class:`ABCMeta` 作為元類別的工具類別。抽象基底類別可以透過自 :" -"class:`!ABC` 衍生而建立,這就避免了在某些情況下會令人混淆的元類別用法,用法如" -"以下範例: ::" +"一個使用 :class:`ABCMeta` 作為元類別的工具類別。抽象基底類別可以透過" +"自 :class:`!ABC` 衍生而建立,這就避免了在某些情況下會令人混淆的元類別用法,用" +"法如以下範例: ::" #: ../../library/abc.rst:36 msgid "" @@ -125,10 +126,10 @@ msgid "" msgstr "" "使用該元類別以建立一個 ABC。一個 ABC 可以像 mix-in 類別一樣直接被子類別繼承。" "你也可以將不相關的具體類別(甚至是內建類別)和 ABC 註冊為「虛擬子類別 " -"(virtual subclass)」 —— 這些類別以及它們的子類別會被內建函式 :func:" -"`issubclass` 識別為已註冊 ABC 的子類別,但是該 ABC 不會出現在其 MRO(Method " -"Resolution Order,方法解析順序)中,由該 ABC 所定義的方法實作也不可呼叫(即使" -"透過 :func:`super` 呼叫也不行)。[#]_" +"(virtual subclass)」 —— 這些類別以及它們的子類別會被內建函" +"式 :func:`issubclass` 識別為已註冊 ABC 的子類別,但是該 ABC 不會出現在其 MRO" +"(Method Resolution Order,方法解析順序)中,由該 ABC 所定義的方法實作也不可" +"呼叫(即使透過 :func:`super` 呼叫也不行)。[#]_" #: ../../library/abc.rst:68 msgid "" @@ -169,8 +170,8 @@ msgstr "回傳已註冊的子類別,使其能夠作為類別裝飾器。" #: ../../library/abc.rst:88 msgid "" -"To detect calls to :meth:`!register`, you can use the :func:" -"`get_cache_token` function." +"To detect calls to :meth:`!register`, you can use " +"the :func:`get_cache_token` function." msgstr "" "你可以使用 :func:`get_cache_token` 函式來檢測對 :meth:`!register` 的呼叫。" @@ -187,13 +188,13 @@ msgid "" "Check whether *subclass* is considered a subclass of this ABC. This means " "that you can customize the behavior of :func:`issubclass` further without " "the need to call :meth:`register` on every class you want to consider a " -"subclass of the ABC. (This class method is called from the :meth:`~type." -"__subclasscheck__` method of the ABC.)" +"subclass of the ABC. (This class method is called from " +"the :meth:`~type.__subclasscheck__` method of the ABC.)" msgstr "" -"檢查 *subclass* 是否該被認為是該 ABC 的子類別,也就是說你可以直接自訂 :func:" -"`issubclass` 的行為,而不用對於那些你希望定義為該 ABC 的子類別的類別都個別呼" -"叫 :meth:`register` 方法。(這個類別方法是在 ABC 的 :meth:`~type." -"__subclasscheck__` 方法中呼叫。)" +"檢查 *subclass* 是否該被認為是該 ABC 的子類別,也就是說你可以直接自" +"訂 :func:`issubclass` 的行為,而不用對於那些你希望定義為該 ABC 的子類別的類別" +"都個別呼叫 :meth:`register` 方法。(這個類別方法是在 ABC " +"的 :meth:`~type.__subclasscheck__` 方法中呼叫。)" #: ../../library/abc.rst:104 msgid "" @@ -205,8 +206,8 @@ msgid "" msgstr "" "此方法必須回傳 ``True``、``False`` 或是 :data:`NotImplemented`。如果回傳 " "``True``,*subclass* 就會被認為是這個 ABC 的子類別。如果回傳 ``False``," -"*subclass* 就會被判定並非該 ABC 的子類別,即便正常情況應如此。如果回傳 :data:" -"`!NotImplemented`,子類別檢查會按照正常機制繼續執行。" +"*subclass* 就會被判定並非該 ABC 的子類別,即便正常情況應如此。如果回" +"傳 :data:`!NotImplemented`,子類別檢查會按照正常機制繼續執行。" #: ../../library/abc.rst:114 msgid "" @@ -271,39 +272,40 @@ msgstr "" #: ../../library/abc.rst:143 msgid "" -"The ABC ``MyIterable`` defines the standard iterable method, :meth:" -"`~iterator.__iter__`, as an abstract method. The implementation given here " -"can still be called from subclasses. The :meth:`!get_iterator` method is " -"also part of the ``MyIterable`` abstract base class, but it does not have to " -"be overridden in non-abstract derived classes." +"The ABC ``MyIterable`` defines the standard iterable " +"method, :meth:`~object.__iter__`, as an abstract method. The implementation " +"given here can still be called from subclasses. The :meth:`!get_iterator` " +"method is also part of the ``MyIterable`` abstract base class, but it does " +"not have to be overridden in non-abstract derived classes." msgstr "" -"ABC ``MyIterable`` 定義了作為抽象方法的一個標準疊代方法 :meth:`~iterator." -"__iter__`。這裡給定的實作仍可在子類別中被呼叫。:meth:`!get_iterator` 方法也" -"是 ``MyIterable`` 抽象基底類別的一部分,但它不必被非抽象衍生類別覆寫。" +"ABC ``MyIterable`` 定義了作為抽象方法的一個標準疊代方" +"法 :meth:`~object.__iter__`。這裡給定的實作仍可在子類別中被呼叫。:meth:`!" +"get_iterator` 方法也是 ``MyIterable`` 抽象基底類別的一部分,但它不必被非抽象" +"衍生類別覆寫。" #: ../../library/abc.rst:149 msgid "" "The :meth:`__subclasshook__` class method defined here says that any class " -"that has an :meth:`~iterator.__iter__` method in its :attr:`~object." -"__dict__` (or in that of one of its base classes, accessed via the :attr:" -"`~type.__mro__` list) is considered a ``MyIterable`` too." +"that has an :meth:`~object.__iter__` method in its :attr:`~object.__dict__` " +"(or in that of one of its base classes, accessed via " +"the :attr:`~type.__mro__` list) is considered a ``MyIterable`` too." msgstr "" -"這裡定義的 :meth:`__subclasshook__` 類別方法說明任何在其 :attr:`~object." -"__dict__` (或在其透過 :attr:`~type.__mro__` 列表存取的基底類別) 中具有 :meth:" -"`~iterator.__iter__` 方法的類別也都會被視為 ``MyIterable``。" +"這裡定義的 :meth:`__subclasshook__` 類別方法說明任何在" +"其 :attr:`~object.__dict__` (或在其透過 :attr:`~type.__mro__` 列表存取的基底" +"類別) 中具有 :meth:`~object.__iter__` 方法的類別也都會被視為 ``MyIterable``。" #: ../../library/abc.rst:154 msgid "" "Finally, the last line makes ``Foo`` a virtual subclass of ``MyIterable``, " -"even though it does not define an :meth:`~iterator.__iter__` method (it uses " +"even though it does not define an :meth:`~object.__iter__` method (it uses " "the old-style iterable protocol, defined in terms of :meth:`~object.__len__` " "and :meth:`~object.__getitem__`). Note that this will not make " "``get_iterator`` available as a method of ``Foo``, so it is provided " "separately." msgstr "" -"最後,即使 ``Foo`` 沒有定義 :meth:`~iterator.__iter__` 方法(它使用了以 :" -"meth:`~object.__len__` 和 :meth:`~object.__getitem__` 所定義的舊式可疊代物件" -"協定),最末一行使其成為 ``MyIterable`` 的一個虛擬子類別。請注意這不會使 " +"最後,即使 ``Foo`` 沒有定義 :meth:`~object.__iter__` 方法(它使用了" +"以 :meth:`~object.__len__` 和 :meth:`~object.__getitem__` 所定義的舊式可疊代" +"物件協定),最末一行使其成為 ``MyIterable`` 的一個虛擬子類別。請注意這不會使 " "``get_iterator`` 成為 ``Foo`` 的一個可用方法,所以它是需要被另外提供的。" #: ../../library/abc.rst:163 @@ -423,8 +425,8 @@ msgid "" msgstr "" "為了能正確地與 ABC 機制實作相互操作,描述器必須使用 :attr:`!" "__isabstractmethod__` 將自身標識為抽象的。一般來說,如果被用於組成描述器的任" -"一方法是抽象的,則此屬性應當為 ``True``。 例如,Python 的內建 :class:" -"`property` 所做的就等價於: ::" +"一方法是抽象的,則此屬性應當為 ``True``。 例如,Python 的內" +"建 :class:`property` 所做的就等價於: ::" #: ../../library/abc.rst:223 msgid "" @@ -536,13 +538,15 @@ msgstr "" #: ../../library/abc.rst:285 msgid "" -"It is now possible to use :class:`property`, :meth:`property.getter`, :meth:" -"`property.setter` and :meth:`property.deleter` with :func:`abstractmethod`, " -"making this decorator redundant." +"It is now possible to " +"use :class:`property`, :meth:`property.getter`, :meth:`property.setter` " +"and :meth:`property.deleter` with :func:`abstractmethod`, making this " +"decorator redundant." msgstr "" -"現在可以讓 :class:`property`、:meth:`property.getter`、:meth:`property." -"setter` 和 :meth:`property.deleter` 配合 :func:`abstractmethod` 使用,使得此" -"裝飾器變得冗餘。" +"現在可以" +"讓 :class:`property`、:meth:`property.getter`、:meth:`property.setter` " +"和 :meth:`property.deleter` 配合 :func:`abstractmethod` 使用,使得此裝飾器變" +"得冗餘。" #: ../../library/abc.rst:290 msgid "" @@ -636,8 +640,8 @@ msgid "" "The token changes with every call to :meth:`ABCMeta.register` on any ABC." msgstr "" "此令牌是一個(支援相等性測試的)不透明物件 (opaque object),用於為虛擬子類別" -"標識抽象基底類別快取的目前版本。此令牌會在任何 ABC 上每次呼叫 :meth:`ABCMeta." -"register` 時發生更改。" +"標識抽象基底類別快取的目前版本。此令牌會在任何 ABC 上每次呼" +"叫 :meth:`ABCMeta.register` 時發生更改。" #: ../../library/abc.rst:340 msgid "" @@ -666,7 +670,7 @@ msgstr "" #: ../../library/abc.rst:357 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../library/abc.rst:358 msgid "" diff --git a/library/argparse.po b/library/argparse.po index b0188fae49..ba81a4c6d3 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-29 11:18+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -47,16 +47,16 @@ msgstr "教學" #: ../../library/argparse.rst:30 msgid "" "This page contains the API reference information. For a more gentle " -"introduction to Python command-line parsing, have a look at the :ref:" -"`argparse tutorial `." +"introduction to Python command-line parsing, have a look at " +"the :ref:`argparse tutorial `." msgstr "" #: ../../library/argparse.rst:34 msgid "" "The :mod:`!argparse` module makes it easy to write user-friendly command-" "line interfaces. The program defines what arguments it requires, and :mod:`!" -"argparse` will figure out how to parse those out of :data:`sys.argv`. The :" -"mod:`!argparse` module also automatically generates help and usage " +"argparse` will figure out how to parse those out of :data:`sys.argv`. " +"The :mod:`!argparse` module also automatically generates help and usage " "messages. The module will also issue errors when users give the program " "invalid arguments." msgstr "" @@ -116,8 +116,8 @@ msgstr "" #: ../../library/argparse.rst:65 msgid "" -"If you're looking for a guide about how to upgrade :mod:`optparse` code to :" -"mod:`!argparse`, see :ref:`Upgrading Optparse Code `." msgstr "" @@ -420,11 +420,11 @@ msgstr "parents" msgid "" "Sometimes, several parsers share a common set of arguments. Rather than " "repeating the definitions of these arguments, a single parser with all the " -"shared arguments and passed to ``parents=`` argument to :class:" -"`ArgumentParser` can be used. The ``parents=`` argument takes a list of :" -"class:`ArgumentParser` objects, collects all the positional and optional " -"actions from them, and adds these actions to the :class:`ArgumentParser` " -"object being constructed::" +"shared arguments and passed to ``parents=`` argument " +"to :class:`ArgumentParser` can be used. The ``parents=`` argument takes a " +"list of :class:`ArgumentParser` objects, collects all the positional and " +"optional actions from them, and adds these actions to " +"the :class:`ArgumentParser` object being constructed::" msgstr "" #: ../../library/argparse.rst:249 @@ -483,9 +483,9 @@ msgstr "" #: ../../library/argparse.rst:286 msgid "" ":class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give " -"more control over how textual descriptions are displayed. By default, :class:" -"`ArgumentParser` objects line-wrap the description_ and epilog_ texts in " -"command-line help messages::" +"more control over how textual descriptions are displayed. By " +"default, :class:`ArgumentParser` objects line-wrap the description_ and " +"epilog_ texts in command-line help messages::" msgstr "" #: ../../library/argparse.rst:291 @@ -717,9 +717,9 @@ msgstr "" #: ../../library/argparse.rst:418 msgid "" -"Arguments read from a file must by default be one per line (but see also :" -"meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they " -"were in the same place as the original file referencing argument on the " +"Arguments read from a file must by default be one per line (but see " +"also :meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if " +"they were in the same place as the original file referencing argument on the " "command line. So in the example above, the expression ``['-f', 'foo', " "'@args.txt']`` is considered equivalent to the expression ``['-f', 'foo', '-" "f', 'bar']``." @@ -740,10 +740,10 @@ msgstr "" #: ../../library/argparse.rst:430 msgid "" ":class:`ArgumentParser` changed encoding and errors to read arguments files " -"from default (e.g. :func:`locale.getpreferredencoding(False) ` and ``\"strict\"``) to the :term:`filesystem encoding " -"and error handler`. Arguments file should be encoded in UTF-8 instead of " -"ANSI Codepage on Windows." +"from default (e.g. :func:`locale.getpreferredencoding(False) " +"` and ``\"strict\"``) to the :term:`filesystem " +"encoding and error handler`. Arguments file should be encoded in UTF-8 " +"instead of ANSI Codepage on Windows." msgstr "" #: ../../library/argparse.rst:438 @@ -752,14 +752,15 @@ msgstr "argument_default" #: ../../library/argparse.rst:440 msgid "" -"Generally, argument defaults are specified either by passing a default to :" -"meth:`~ArgumentParser.add_argument` or by calling the :meth:`~ArgumentParser." -"set_defaults` methods with a specific set of name-value pairs. Sometimes " -"however, it may be useful to specify a single parser-wide default for " -"arguments. This can be accomplished by passing the ``argument_default=`` " -"keyword argument to :class:`ArgumentParser`. For example, to globally " -"suppress attribute creation on :meth:`~ArgumentParser.parse_args` calls, we " -"supply ``argument_default=SUPPRESS``::" +"Generally, argument defaults are specified either by passing a default " +"to :meth:`~ArgumentParser.add_argument` or by calling " +"the :meth:`~ArgumentParser.set_defaults` methods with a specific set of name-" +"value pairs. Sometimes however, it may be useful to specify a single parser-" +"wide default for arguments. This can be accomplished by passing the " +"``argument_default=`` keyword argument to :class:`ArgumentParser`. For " +"example, to globally suppress attribute creation " +"on :meth:`~ArgumentParser.parse_args` calls, we supply " +"``argument_default=SUPPRESS``::" msgstr "" #: ../../library/argparse.rst:449 @@ -786,9 +787,9 @@ msgstr "allow_abbrev" #: ../../library/argparse.rst:462 msgid "" -"Normally, when you pass an argument list to the :meth:`~ArgumentParser." -"parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes " -"abbreviations ` of long options." +"Normally, when you pass an argument list to " +"the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, " +"it :ref:`recognizes abbreviations ` of long options." msgstr "" #: ../../library/argparse.rst:466 @@ -895,8 +896,8 @@ msgstr "" #: ../../library/argparse.rst:522 msgid "" "Occasionally, it may be useful to disable the addition of this help option. " -"This can be achieved by passing ``False`` as the ``add_help=`` argument to :" -"class:`ArgumentParser`::" +"This can be achieved by passing ``False`` as the ``add_help=`` argument " +"to :class:`ArgumentParser`::" msgstr "" #: ../../library/argparse.rst:526 @@ -947,9 +948,10 @@ msgstr "exit_on_error" #: ../../library/argparse.rst:551 msgid "" -"Normally, when you pass an invalid argument list to the :meth:" -"`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will " -"print a *message* to :data:`sys.stderr` and exit with a status code of 2." +"Normally, when you pass an invalid argument list to " +"the :meth:`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, " +"it will print a *message* to :data:`sys.stderr` and exit with a status code " +"of 2." msgstr "" #: ../../library/argparse.rst:555 @@ -1046,8 +1048,8 @@ msgstr "" #: ../../library/argparse.rst:605 msgid "" -"dest_ - The name of the attribute to be added to the object returned by :" -"meth:`parse_args`." +"dest_ - The name of the attribute to be added to the object returned " +"by :meth:`parse_args`." msgstr "" #: ../../library/argparse.rst:608 @@ -1062,9 +1064,9 @@ msgstr "name or flags" msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " -"a list of filenames, is expected. The first arguments passed to :meth:" -"`~ArgumentParser.add_argument` must therefore be either a series of flags, " -"or a simple argument name." +"a list of filenames, is expected. The first arguments passed " +"to :meth:`~ArgumentParser.add_argument` must therefore be either a series of " +"flags, or a simple argument name." msgstr "" #: ../../library/argparse.rst:624 @@ -1279,9 +1281,9 @@ msgstr "" #: ../../library/argparse.rst:737 msgid "" -"``'version'`` - This expects a ``version=`` keyword argument in the :meth:" -"`~ArgumentParser.add_argument` call, and prints version information and " -"exits when invoked::" +"``'version'`` - This expects a ``version=`` keyword argument in " +"the :meth:`~ArgumentParser.add_argument` call, and prints version " +"information and exits when invoked::" msgstr "" #: ../../library/argparse.rst:741 @@ -1543,10 +1545,11 @@ msgstr "" msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='http://github.com/store_const'`` or ``action='http://github.com/append_const'``. These actions add " -"the ``const`` value to one of the attributes of the object returned by :meth:" -"`~ArgumentParser.parse_args`. See the action_ description for examples. If " -"``const`` is not provided to :meth:`~ArgumentParser.add_argument`, it will " -"receive a default value of ``None``." +"the ``const`` value to one of the attributes of the object returned " +"by :meth:`~ArgumentParser.parse_args`. See the action_ description for " +"examples. If ``const`` is not provided " +"to :meth:`~ArgumentParser.add_argument`, it will receive a default value of " +"``None``." msgstr "" #: ../../library/argparse.rst:901 @@ -1572,11 +1575,11 @@ msgstr "default" #: ../../library/argparse.rst:917 msgid "" "All optional arguments and some positional arguments may be omitted at the " -"command line. The ``default`` keyword argument of :meth:`~ArgumentParser." -"add_argument`, whose value defaults to ``None``, specifies what value should " -"be used if the command-line argument is not present. For optional arguments, " -"the ``default`` value is used when the option string was not present at the " -"command line::" +"command line. The ``default`` keyword argument " +"of :meth:`~ArgumentParser.add_argument`, whose value defaults to ``None``, " +"specifies what value should be used if the command-line argument is not " +"present. For optional arguments, the ``default`` value is used when the " +"option string was not present at the command line::" msgstr "" #: ../../library/argparse.rst:924 @@ -1617,8 +1620,9 @@ msgstr "" msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " -"conversion argument, if provided, before setting the attribute on the :class:" -"`Namespace` return value. Otherwise, the parser uses the value as is::" +"conversion argument, if provided, before setting the attribute on " +"the :class:`Namespace` return value. Otherwise, the parser uses the value " +"as is::" msgstr "" #: ../../library/argparse.rst:944 @@ -1709,9 +1713,9 @@ msgstr "" msgid "" "The argument to ``type`` can be a callable that accepts a single string or " "the name of a registered type (see :meth:`~ArgumentParser.register`) If the " -"function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" -"`ValueError`, the exception is caught and a nicely formatted error message " -"is displayed. Other exception types are not handled." +"function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, " +"or :exc:`ValueError`, the exception is caught and a nicely formatted error " +"message is displayed. Other exception types are not handled." msgstr "" #: ../../library/argparse.rst:995 @@ -1784,9 +1788,9 @@ msgstr "" #: ../../library/argparse.rst:1031 msgid "" "For example, JSON or YAML conversions have complex error cases that require " -"better reporting than can be given by the ``type`` keyword. A :exc:`~json." -"JSONDecodeError` would not be well formatted and a :exc:`FileNotFoundError` " -"exception would not be handled at all." +"better reporting than can be given by the ``type`` keyword. " +"A :exc:`~json.JSONDecodeError` would not be well formatted and " +"a :exc:`FileNotFoundError` exception would not be handled at all." msgstr "" #: ../../library/argparse.rst:1036 @@ -1897,9 +1901,9 @@ msgstr "" #: ../../library/argparse.rst:1101 msgid "" -"As the example shows, if an option is marked as ``required``, :meth:" -"`~ArgumentParser.parse_args` will report an error if that option is not " -"present at the command line." +"As the example shows, if an option is marked as " +"``required``, :meth:`~ArgumentParser.parse_args` will report an error if " +"that option is not present at the command line." msgstr "" #: ../../library/argparse.rst:1107 @@ -1925,8 +1929,8 @@ msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " "available specifiers include the program name, ``%(prog)s`` and most keyword " -"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, " -"``%(type)s``, etc.::" +"arguments to :meth:`~ArgumentParser.add_argument`, e.g. ``%(default)s``, ``%" +"(type)s``, etc.::" msgstr "" #: ../../library/argparse.rst:1126 @@ -2115,10 +2119,10 @@ msgstr "dest" msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " -"attribute is determined by the ``dest`` keyword argument of :meth:" -"`~ArgumentParser.add_argument`. For positional argument actions, ``dest`` " -"is normally supplied as the first argument to :meth:`~ArgumentParser." -"add_argument`::" +"attribute is determined by the ``dest`` keyword argument " +"of :meth:`~ArgumentParser.add_argument`. For positional argument actions, " +"``dest`` is normally supplied as the first argument " +"to :meth:`~ArgumentParser.add_argument`::" msgstr "" #: ../../library/argparse.rst:1231 @@ -2201,7 +2205,7 @@ msgid "" ">>> parser.add_argument('--legs', default=0, type=int, deprecated=True)\n" ">>> parser.parse_args([])\n" "Namespace(legs=0)\n" -">>> parser.parse_args(['--legs', '4']) \n" +">>> parser.parse_args(['--legs', '4'])\n" "snake.py: warning: option '--legs' is deprecated\n" "Namespace(legs=4)" msgstr "" @@ -2210,7 +2214,7 @@ msgstr "" ">>> parser.add_argument('--legs', default=0, type=int, deprecated=True)\n" ">>> parser.parse_args([])\n" "Namespace(legs=0)\n" -">>> parser.parse_args(['--legs', '4']) \n" +">>> parser.parse_args(['--legs', '4'])\n" "snake.py: warning: option '--legs' is deprecated\n" "Namespace(legs=4)" @@ -2222,8 +2226,8 @@ msgstr "Action 類別" msgid "" ":class:`!Action` classes implement the Action API, a callable which returns " "a callable which processes arguments from the command-line. Any object which " -"follows this API may be passed as the ``action`` parameter to :meth:" -"`~ArgumentParser.add_argument`." +"follows this API may be passed as the ``action`` parameter " +"to :meth:`~ArgumentParser.add_argument`." msgstr "" #: ../../library/argparse.rst:1300 @@ -2231,8 +2235,8 @@ msgid "" ":class:`!Action` objects are used by an :class:`ArgumentParser` to represent " "the information needed to parse a single argument from one or more strings " "from the command line. The :class:`!Action` class must accept the two " -"positional arguments plus any keyword arguments passed to :meth:" -"`ArgumentParser.add_argument` except for the ``action`` itself." +"positional arguments plus any keyword arguments passed " +"to :meth:`ArgumentParser.add_argument` except for the ``action`` itself." msgstr "" #: ../../library/argparse.rst:1306 @@ -2257,16 +2261,16 @@ msgstr "" #: ../../library/argparse.rst:1319 msgid "" -"*namespace* - The :class:`Namespace` object that will be returned by :meth:" -"`~ArgumentParser.parse_args`. Most actions add an attribute to this object " -"using :func:`setattr`." +"*namespace* - The :class:`Namespace` object that will be returned " +"by :meth:`~ArgumentParser.parse_args`. Most actions add an attribute to " +"this object using :func:`setattr`." msgstr "" #: ../../library/argparse.rst:1323 msgid "" "*values* - The associated command-line arguments, with any type conversions " -"applied. Type conversions are specified with the type_ keyword argument to :" -"meth:`~ArgumentParser.add_argument`." +"applied. Type conversions are specified with the type_ keyword argument " +"to :meth:`~ArgumentParser.add_argument`." msgstr "" #: ../../library/argparse.rst:1327 @@ -2310,14 +2314,14 @@ msgstr "" #: ../../library/argparse.rst:1353 msgid "" -"args_ - List of strings to parse. The default is taken from :data:`sys." -"argv`." +"args_ - List of strings to parse. The default is taken " +"from :data:`sys.argv`." msgstr "" #: ../../library/argparse.rst:1356 msgid "" -"namespace_ - An object to take the attributes. The default is a new empty :" -"class:`Namespace` object." +"namespace_ - An object to take the attributes. The default is a new " +"empty :class:`Namespace` object." msgstr "" #: ../../library/argparse.rst:1361 @@ -2676,13 +2680,14 @@ msgid "" "example, the ``svn`` program can invoke subcommands like ``svn checkout``, " "``svn update``, and ``svn commit``. Splitting up functionality this way can " "be a particularly good idea when a program performs several different " -"functions which require different kinds of command-line arguments. :class:" -"`ArgumentParser` supports the creation of such subcommands with the :meth:`!" -"add_subparsers` method. The :meth:`!add_subparsers` method is normally " -"called with no arguments and returns a special action object. This object " -"has a single method, :meth:`~_SubParsersAction.add_parser`, which takes a " -"command name and any :class:`!ArgumentParser` constructor arguments, and " -"returns an :class:`!ArgumentParser` object that can be modified as usual." +"functions which require different kinds of command-line " +"arguments. :class:`ArgumentParser` supports the creation of such subcommands " +"with the :meth:`!add_subparsers` method. The :meth:`!add_subparsers` method " +"is normally called with no arguments and returns a special action object. " +"This object has a single method, :meth:`~_SubParsersAction.add_parser`, " +"which takes a command name and any :class:`!ArgumentParser` constructor " +"arguments, and returns an :class:`!ArgumentParser` object that can be " +"modified as usual." msgstr "" #: ../../library/argparse.rst:1582 @@ -3004,10 +3009,10 @@ msgstr "FileType 物件" #: ../../library/argparse.rst:1785 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " -"argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" -"`FileType` objects as their type will open command-line arguments as files " -"with the requested modes, buffer sizes, encodings and error handling (see " -"the :func:`open` function for more details)::" +"argument of :meth:`ArgumentParser.add_argument`. Arguments that " +"have :class:`FileType` objects as their type will open command-line " +"arguments as files with the requested modes, buffer sizes, encodings and " +"error handling (see the :func:`open` function for more details)::" msgstr "" #: ../../library/argparse.rst:1791 @@ -3091,12 +3096,12 @@ msgstr "" #: ../../library/argparse.rst:1833 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " -"has an :meth:`~ArgumentParser.add_argument` method just like a regular :" -"class:`ArgumentParser`. When an argument is added to the group, the parser " -"treats it just like a normal argument, but displays the argument in a " -"separate group for help messages. The :meth:`!add_argument_group` method " -"accepts *title* and *description* arguments which can be used to customize " -"this display::" +"has an :meth:`~ArgumentParser.add_argument` method just like a " +"regular :class:`ArgumentParser`. When an argument is added to the group, " +"the parser treats it just like a normal argument, but displays the argument " +"in a separate group for help messages. The :meth:`!add_argument_group` " +"method accepts *title* and *description* arguments which can be used to " +"customize this display::" msgstr "" #: ../../library/argparse.rst:1841 @@ -3141,9 +3146,9 @@ msgstr "" msgid "" "The optional, keyword-only parameters argument_default_ and " "conflict_handler_ allow for finer-grained control of the behavior of the " -"argument group. These parameters have the same meaning as in the :class:" -"`ArgumentParser` constructor, but apply specifically to the argument group " -"rather than the entire parser." +"argument group. These parameters have the same meaning as in " +"the :class:`ArgumentParser` constructor, but apply specifically to the " +"argument group rather than the entire parser." msgstr "" #: ../../library/argparse.rst:1864 @@ -3225,9 +3230,10 @@ msgstr "" #: ../../library/argparse.rst:1907 msgid "" "Note that currently mutually exclusive argument groups do not support the " -"*title* and *description* arguments of :meth:`~ArgumentParser." -"add_argument_group`. However, a mutually exclusive group can be added to an " -"argument group that has a title and description. For example::" +"*title* and *description* arguments " +"of :meth:`~ArgumentParser.add_argument_group`. However, a mutually exclusive " +"group can be added to an argument group that has a title and description. " +"For example::" msgstr "" #: ../../library/argparse.rst:1913 @@ -3280,9 +3286,9 @@ msgstr "" #: ../../library/argparse.rst:1942 msgid "" -"Most of the time, the attributes of the object returned by :meth:" -"`parse_args` will be fully determined by inspecting the command-line " -"arguments and the argument actions. :meth:`set_defaults` allows some " +"Most of the time, the attributes of the object returned " +"by :meth:`parse_args` will be fully determined by inspecting the command-" +"line arguments and the argument actions. :meth:`set_defaults` allows some " "additional attributes that are determined without any inspection of the " "command line to be added::" msgstr "" @@ -3329,8 +3335,9 @@ msgstr "" #: ../../library/argparse.rst:1968 msgid "" -"Get the default value for a namespace attribute, as set by either :meth:" -"`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" +"Get the default value for a namespace attribute, as set by " +"either :meth:`~ArgumentParser.add_argument` or " +"by :meth:`~ArgumentParser.set_defaults`::" msgstr "" #: ../../library/argparse.rst:1972 @@ -3378,8 +3385,8 @@ msgstr "" #: ../../library/argparse.rst:2002 msgid "" -"Return a string containing a brief description of how the :class:" -"`ArgumentParser` should be invoked on the command line." +"Return a string containing a brief description of how " +"the :class:`ArgumentParser` should be invoked on the command line." msgstr "" #: ../../library/argparse.rst:2007 @@ -3419,10 +3426,10 @@ msgstr "" #: ../../library/argparse.rst:2032 msgid "" -":ref:`Prefix matching ` rules apply to :meth:" -"`~ArgumentParser.parse_known_args`. The parser may consume an option even if " -"it's just a prefix of one of its known options, instead of leaving it in the " -"remaining arguments list." +":ref:`Prefix matching ` rules apply " +"to :meth:`~ArgumentParser.parse_known_args`. The parser may consume an " +"option even if it's just a prefix of one of its known options, instead of " +"leaving it in the remaining arguments list." msgstr "" #: ../../library/argparse.rst:2039 @@ -3487,8 +3494,8 @@ msgstr "" #: ../../library/argparse.rst:2077 msgid "" -"This method prints a usage message, including the *message*, to :data:`sys." -"stderr` and terminates the program with a status code of 2." +"This method prints a usage message, including the *message*, " +"to :data:`sys.stderr` and terminates the program with a status code of 2." msgstr "" #: ../../library/argparse.rst:2082 @@ -3513,10 +3520,11 @@ msgstr "" #: ../../library/argparse.rst:2097 msgid "" -"The following example shows the difference between :meth:`~ArgumentParser." -"parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " -"former returns ``['2', '3']`` as unparsed arguments, while the latter " -"collects all the positionals into ``rest``. ::" +"The following example shows the difference " +"between :meth:`~ArgumentParser.parse_known_args` " +"and :meth:`~ArgumentParser.parse_intermixed_args`: the former returns " +"``['2', '3']`` as unparsed arguments, while the latter collects all the " +"positionals into ``rest``. ::" msgstr "" #: ../../library/argparse.rst:2103 diff --git a/library/array.po b/library/array.po index 1c05103624..d1ee4d39e6 100644 --- a/library/array.po +++ b/library/array.po @@ -254,9 +254,9 @@ msgstr "這個模組定義了下方的型別:" #: ../../library/array.rst:81 msgid "" "A new array whose items are restricted by *typecode*, and initialized from " -"the optional *initializer* value, which must be a :class:`bytes` or :class:" -"`bytearray` object, a Unicode string, or iterable over elements of the " -"appropriate type." +"the optional *initializer* value, which must be a :class:`bytes` " +"or :class:`bytearray` object, a Unicode string, or iterable over elements of " +"the appropriate type." msgstr "" "一個新的陣列中的元素被 *typecode* 限制,並由選用的 *initializer* 參數初始化," "*initializer* 必須是一個 :class:`bytes` 或 :class:`bytearray` 物件、一個 " @@ -342,9 +342,9 @@ msgstr "" #: ../../library/array.rst:138 msgid "" "\"Byteswap\" all items of the array. This is only supported for values " -"which are 1, 2, 4, or 8 bytes in size; for other types of values, :exc:" -"`RuntimeError` is raised. It is useful when reading data from a file " -"written on a machine with a different byte order." +"which are 1, 2, 4, or 8 bytes in size; for other types of " +"values, :exc:`RuntimeError` is raised. It is useful when reading data from " +"a file written on a machine with a different byte order." msgstr "" "\"Byteswap\" 所有陣列中的物件。這只有支援物件長度為 1、2、4 或 8 位元組的陣" "列,其他型別的值會導致 :exc:`RuntimeError`。這在從機器讀取位元順序不同的檔案" @@ -357,9 +357,10 @@ msgstr "回傳 *x* 在陣列中出現了幾次。" #: ../../library/array.rst:151 msgid "" "Append items from *iterable* to the end of the array. If *iterable* is " -"another array, it must have *exactly* the same type code; if not, :exc:" -"`TypeError` will be raised. If *iterable* is not an array, it must be " -"iterable and its elements must be the right type to be appended to the array." +"another array, it must have *exactly* the same type code; if " +"not, :exc:`TypeError` will be raised. If *iterable* is not an array, it " +"must be iterable and its elements must be the right type to be appended to " +"the array." msgstr "" "從 *iterable* 中新增元素到陣列的尾端,如果 *iterable* 是另一個陣列,它必須有" "完全相同的 type code,如果不同會導致 :exc:`TypeError`。如果 *iterable* 不是一" @@ -369,8 +370,8 @@ msgstr "" #: ../../library/array.rst:159 msgid "" "Appends items from the :term:`bytes-like object`, interpreting its content " -"as an array of machine values (as if it had been read from a file using the :" -"meth:`fromfile` method)." +"as an array of machine values (as if it had been read from a file using " +"the :meth:`fromfile` method)." msgstr "" "從 :term:`bytes-like object` 中新增元素。讀取時會將其內容當作一個機器數值組成" "的陣列(就像從檔案中使用 :meth:`fromfile` 方法讀出的資料)。" @@ -382,9 +383,9 @@ msgstr "將 :meth:`!fromstring` 更名為 :meth:`frombytes`,使其更加清晰 #: ../../library/array.rst:169 msgid "" "Read *n* items (as machine values) from the :term:`file object` *f* and " -"append them to the end of the array. If less than *n* items are available, :" -"exc:`EOFError` is raised, but the items that were available are still " -"inserted into the array." +"append them to the end of the array. If less than *n* items are " +"available, :exc:`EOFError` is raised, but the items that were available are " +"still inserted into the array." msgstr "" "從 :term:`file object` *f* 讀取 *n* 個元素(作為機器數值),接著將這些元素加" "入陣列的最尾端。如果只有少於 *n* 個有效的元素會導致 :exc:`EOFError`,但有效的" @@ -392,30 +393,30 @@ msgstr "" #: ../../library/array.rst:177 msgid "" -"Append items from the list. This is equivalent to ``for x in list: a." -"append(x)`` except that if there is a type error, the array is unchanged." +"Append items from the list. This is equivalent to ``for x in list: " +"a.append(x)`` except that if there is a type error, the array is unchanged." msgstr "" "從 list 中新增元素。這等價於 ``for x in list: a.append(x)``,除了有型別錯誤產" "生時,陣列會保持原狀不會被更改。" #: ../../library/array.rst:183 -#, fuzzy msgid "" "Extends this array with data from the given Unicode string. The array must " "have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. " "Use ``array.frombytes(unicodestring.encode(enc))`` to append Unicode data to " "an array of some other type." msgstr "" -"用給定的 Unicode 字串擴展這個陣列。陣列的 type code 必須是 ``u``;其他的型別" -"會導致 :exc:`ValueError` 被引發。使用 ``array.frombytes(unicodestring." -"encode(enc))`` 來新增 Unicode 資料到一個其他型別的陣列。" +"用給定的 Unicode 字串擴展這個陣列。陣列的 type code 必須是 ``u`` 或 ``'w'``;" +"其他的型別會導致 :exc:`ValueError` 被引發。使用 " +"``array.frombytes(unicodestring.encode(enc))`` 來新增 Unicode 資料到一個其他" +"型別的陣列。" #: ../../library/array.rst:191 msgid "" "Return the smallest *i* such that *i* is the index of the first occurrence " "of *x* in the array. The optional arguments *start* and *stop* can be " -"specified to search for *x* within a subsection of the array. Raise :exc:" -"`ValueError` if *x* is not found." +"specified to search for *x* within a subsection of the array. " +"Raise :exc:`ValueError` if *x* is not found." msgstr "" "回傳 *i* 的最小數值,使得 *i* 成為陣列之中第一次出現 *x* 的索引。選擇性的引" "數 *start* 及 *stop* 則可以被用來在指定的陣列空間中搜尋 *x*。如果 *x* 不存在" @@ -478,12 +479,13 @@ msgstr "不更改元素,將陣列轉為一般的 list。" #, fuzzy msgid "" "Convert the array to a Unicode string. The array must have a type ``'u'`` " -"or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.tobytes()." -"decode(enc)`` to obtain a Unicode string from an array of some other type." +"or ``'w'``; otherwise a :exc:`ValueError` is raised. Use " +"``array.tobytes().decode(enc)`` to obtain a Unicode string from an array of " +"some other type." msgstr "" -"將陣列轉為一個 Unicode 字串。陣列的型別必須為 ``u``。其他型別的陣列會導致 :" -"exc:`ValueError` 錯誤。請使用 ``array.tobytes().decode(enc)`` 來為其他型別的" -"陣列轉為 Unicode 字串。" +"將陣列轉為一個 Unicode 字串。陣列的型別必須為 ``u``。其他型別的陣列會導" +"致 :exc:`ValueError` 錯誤。請使用 ``array.tobytes().decode(enc)`` 來為其他型" +"別的陣列轉為 Unicode 字串。" #: ../../library/array.rst:257 #, fuzzy @@ -501,8 +503,8 @@ msgstr "" "陣列物件的字串表示形式為 ``array(typecode, initializer)``。若為空陣列則參數 " "*initializer* 被省略,若 *typecode* 是 ``'u'`` 將被表示為 Unicode 字串,其他" "情況則被表示為由數字組成的 list。只要 :class:`~array.array` class(類別)透" -"過 ``from array import array`` 的方式引入,便能確保該字串表示能透過 :func:" -"`eval` 轉換回一個擁有相同型別及數值的陣列。範例: ::" +"過 ``from array import array`` 的方式引入,便能確保該字串表示能透" +"過 :func:`eval` 轉換回一個擁有相同型別及數值的陣列。範例: ::" #: ../../library/array.rst:269 #, fuzzy diff --git a/library/ast.po b/library/ast.po index 84159d0c12..8e6a61b972 100644 --- a/library/ast.po +++ b/library/ast.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-15 17:05+0000\n" +"POT-Creation-Date: 2025-04-29 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -38,12 +38,12 @@ msgstr "" #: ../../library/ast.rst:23 msgid "" -"An abstract syntax tree can be generated by passing :data:`ast." -"PyCF_ONLY_AST` as a flag to the :func:`compile` built-in function, or using " -"the :func:`parse` helper provided in this module. The result will be a tree " -"of objects whose classes all inherit from :class:`ast.AST`. An abstract " -"syntax tree can be compiled into a Python code object using the built-in :" -"func:`compile` function." +"An abstract syntax tree can be generated by " +"passing :data:`ast.PyCF_ONLY_AST` as a flag to the :func:`compile` built-in " +"function, or using the :func:`parse` helper provided in this module. The " +"result will be a tree of objects whose classes all inherit " +"from :class:`ast.AST`. An abstract syntax tree can be compiled into a " +"Python code object using the built-in :func:`compile` function." msgstr "" "要生成抽象語法樹,可以透過將 :data:`ast.PyCF_ONLY_AST` 作為旗標傳遞給內建函" "式 :func:`compile` 或使用此模組所提供的 :func:`parse` 輔助函式。結果將會是一" @@ -239,13 +239,13 @@ msgstr "節點 (Node) 類別" #: ../../library/ast.rst:46 msgid "" "This is the base of all AST node classes. The actual node classes are " -"derived from the :file:`Parser/Python.asdl` file, which is reproduced :ref:" -"`above `. They are defined in the :mod:`!_ast` C module " -"and re-exported in :mod:`ast`." +"derived from the :file:`Parser/Python.asdl` file, which is " +"reproduced :ref:`above `. They are defined in the :mod:`!" +"_ast` C module and re-exported in :mod:`ast`." msgstr "" -"這是所有 AST 節點類別的基礎。實際的節點類別是衍生自 :file:`Parser/Python." -"asdl` 檔案,該檔案在\\ :ref:`上方 ` 重現。它們被定義於 :" -"mod:`!_ast` 的 C 模組中,並於 :mod:`ast` 中重新匯出。" +"這是所有 AST 節點類別的基礎。實際的節點類別是衍生自 :file:`Parser/" +"Python.asdl` 檔案,該檔案在\\ :ref:`上方 ` 重現。它們被定義" +"於 :mod:`!_ast` 的 C 模組中,並於 :mod:`ast` 中重新匯出。" #: ../../library/ast.rst:51 msgid "" @@ -257,11 +257,11 @@ msgid "" "rules with alternatives (aka \"sums\"), the left-hand side class is " "abstract: only instances of specific constructor nodes are ever created." msgstr "" -"抽象文法中為每個左側符號定義了一個類別(例如 :class:`ast.stmt` 或 :class:" -"`ast.expr`\\ )。此外,也為每個右側的建構函式 (constructor) 定義了一個類別;" -"這些類別繼承自左側樹的類別。例如,:class:`ast.BinOp` 繼承自 :class:`ast." -"expr`。對於具有替代方案(即為「和 (sums)」)的生產規則,左側類別是抽象的:僅" -"有特定建構函式節點的實例會被建立。" +"抽象文法中為每個左側符號定義了一個類別(例如 :class:`ast.stmt` " +"或 :class:`ast.expr`\\ )。此外,也為每個右側的建構函式 (constructor) 定義了" +"一個類別;這些類別繼承自左側樹的類別。例如,:class:`ast.BinOp` 繼承" +"自 :class:`ast.expr`。對於具有替代方案(即為「和 (sums)」)的生產規則,左側類" +"別是抽象的:僅有特定建構函式節點的實例會被建立。" #: ../../library/ast.rst:64 msgid "" @@ -275,8 +275,8 @@ msgid "" "the type as defined in the grammar. For example, :class:`ast.BinOp` " "instances have an attribute :attr:`left` of type :class:`ast.expr`." msgstr "" -"具體類別的每個實例對於每個子節點都有一個屬性,其型別如文法中所定義。例如,:" -"class:`ast.BinOp` 實例具有型別為 :class:`ast.expr` 的屬性 :attr:`left`。" +"具體類別的每個實例對於每個子節點都有一個屬性,其型別如文法中所定義。例" +"如,:class:`ast.BinOp` 實例具有型別為 :class:`ast.expr` 的屬性 :attr:`left`。" #: ../../library/ast.rst:71 msgid "" @@ -287,16 +287,16 @@ msgid "" "compiling an AST with :func:`compile`." msgstr "" "如果這些屬性在文法中被標記為可選(使用問號),則該值可能為 ``None``。如果屬性" -"可以有零個或多個值(用星號標記),則這些值將表示為 Python 串列。使用 :func:" -"`compile` 編譯 AST 時,所有可能的屬性都必須存在並且具有有效值。" +"可以有零個或多個值(用星號標記),則這些值將表示為 Python 串列。使" +"用 :func:`compile` 編譯 AST 時,所有可能的屬性都必須存在並且具有有效值。" #: ../../library/ast.rst:79 msgid "" "The :attr:`!_field_types` attribute on each concrete class is a dictionary " "mapping field names (as also listed in :attr:`_fields`) to their types." msgstr "" -"每個具體類別上的 :attr:`!_field_types` 屬性是將欄位名稱(也在 :attr:" -"`_fields` 中列出)對映到其型別的字典。" +"每個具體類別上的 :attr:`!_field_types` 屬性是將欄位名稱(也" +"在 :attr:`_fields` 中列出)對映到其型別的字典。" #: ../../library/ast.rst:82 msgid "" @@ -310,21 +310,22 @@ msgstr "" #: ../../library/ast.rst:94 msgid "" -"Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses have :attr:" -"`lineno`, :attr:`col_offset`, :attr:`end_lineno`, and :attr:`end_col_offset` " -"attributes. The :attr:`lineno` and :attr:`end_lineno` are the first and " -"last line numbers of source text span (1-indexed so the first line is line " -"1) and the :attr:`col_offset` and :attr:`end_col_offset` are the " -"corresponding UTF-8 byte offsets of the first and last tokens that generated " -"the node. The UTF-8 offset is recorded because the parser uses UTF-8 " -"internally." -msgstr "" -":class:`ast.expr` 和 :class:`ast.stmt` 子類別的實例具有 :attr:`lineno`、:" -"attr:`col_offset`、:attr:`end_lineno` 和 :attr:`end_col_offset` 屬性。:attr:" -"`lineno` 和 :attr:`end_lineno` 是原始文本跨度 (source text span) 的第一個和最" -"後一個列號(1-indexed,因此第一列號是 1)以及 :attr:`col_offset` 和 :attr:" -"`end_col_offset` 是生成節點的第一個和最後一個標記對應的 UTF-8 位元組偏移量。" -"會記錄 UTF-8 偏移量是因為剖析器 (parser) 內部使用 UTF-8。" +"Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses " +"have :attr:`lineno`, :attr:`col_offset`, :attr:`end_lineno`, " +"and :attr:`end_col_offset` attributes. The :attr:`lineno` " +"and :attr:`end_lineno` are the first and last line numbers of source text " +"span (1-indexed so the first line is line 1) and the :attr:`col_offset` " +"and :attr:`end_col_offset` are the corresponding UTF-8 byte offsets of the " +"first and last tokens that generated the node. The UTF-8 offset is recorded " +"because the parser uses UTF-8 internally." +msgstr "" +":class:`ast.expr` 和 :class:`ast.stmt` 子類別的實例具" +"有 :attr:`lineno`、:attr:`col_offset`、:attr:`end_lineno` " +"和 :attr:`end_col_offset` 屬性。:attr:`lineno` 和 :attr:`end_lineno` 是原始文" +"本跨度 (source text span) 的第一個和最後一個列號(1-indexed,因此第一列號是 " +"1)以及 :attr:`col_offset` 和 :attr:`end_col_offset` 是生成節點的第一個和最後" +"一個標記對應的 UTF-8 位元組偏移量。會記錄 UTF-8 偏移量是因為剖析器 (parser) " +"內部使用 UTF-8。" #: ../../library/ast.rst:103 msgid "" @@ -376,15 +377,15 @@ msgid "" "If a field that is optional in the grammar is omitted from the constructor, " "it defaults to ``None``. If a list field is omitted, it defaults to the " "empty list. If a field of type :class:`!ast.expr_context` is omitted, it " -"defaults to :class:`Load() `. If any other field is omitted, a :" -"exc:`DeprecationWarning` is raised and the AST node will not have this " +"defaults to :class:`Load() `. If any other field is omitted, " +"a :exc:`DeprecationWarning` is raised and the AST node will not have this " "field. In Python 3.15, this condition will raise an error." msgstr "" "如果建構函式中省略了文法中可選的欄位,則它預設為 ``None``。如果省略串列欄位," -"則預設為空串列。如果省略 :class:`!ast.expr_context` 型別的欄位,則預設為 :" -"class:`Load() `。如果省略任何其他欄位,則會引發 :exc:" -"`DeprecationWarning`,且 AST 節點將沒有此欄位。在 Python 3.15 中,這種情況會" -"引發錯誤。" +"則預設為空串列。如果省略 :class:`!ast.expr_context` 型別的欄位,則預設" +"為 :class:`Load() `。如果省略任何其他欄位,則會引" +"發 :exc:`DeprecationWarning`,且 AST 節點將沒有此欄位。在 Python 3.15 中,這" +"種情況會引發錯誤。" #: ../../library/ast.rst:130 msgid "Class :class:`ast.Constant` is now used for all constants." @@ -398,10 +399,10 @@ msgstr "以它們的值表示簡單索引,擴充切片 (slice) 則以元組 (t #: ../../library/ast.rst:139 msgid "" -"Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!ast.Bytes`, :" -"class:`!ast.NameConstant` and :class:`!ast.Ellipsis` are still available, " -"but they will be removed in future Python releases. In the meantime, " -"instantiating them will return an instance of a different class." +"Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!" +"ast.Bytes`, :class:`!ast.NameConstant` and :class:`!ast.Ellipsis` are still " +"available, but they will be removed in future Python releases. In the " +"meantime, instantiating them will return an instance of a different class." msgstr "" "舊的類別 :class:`!ast.Num`、:class:`!ast.Str`、:class:`!ast.Bytes`、:class:`!" "ast.NameConstant` 和 :class:`!ast.Ellipsis` 仍然可用,但它們將在未來的 " @@ -431,8 +432,9 @@ msgstr "" #: ../../library/ast.rst:160 msgid "" "The descriptions of the specific node classes displayed here were initially " -"adapted from the fantastic `Green Tree Snakes `__ project and all its contributors." +"adapted from the fantastic `Green Tree Snakes `__ project and all its " +"contributors." msgstr "" "這裡顯示的特定節點類別的描述最初是從出色的 `Green Tree Snakes `__ 專案和所有貢獻者那裡改編而來" @@ -447,8 +449,8 @@ msgid "" "A Python module, as with :ref:`file input `. Node type generated " "by :func:`ast.parse` in the default ``\"exec\"`` *mode*." msgstr "" -"一個 Python 模組,與\\ :ref:`檔案輸入 ` 一樣。由 :func:`ast." -"parse` 在預設的 ``\"exec\"`` *mode* 下生成的節點型別。" +"一個 Python 模組,與\\ :ref:`檔案輸入 ` 一樣。" +"由 :func:`ast.parse` 在預設的 ``\"exec\"`` *mode* 下生成的節點型別。" #: ../../library/ast.rst:176 msgid "``body`` is a :class:`list` of the module's :ref:`ast-statements`." @@ -516,8 +518,8 @@ msgstr "" #: ../../library/ast.rst:212 msgid "``body`` is a :class:`list` of :ref:`statement nodes `." msgstr "" -"``body`` 是\\ :ref:`陳述式節點 (statement nodes) ` 的 :class:" -"`list`。" +"``body`` 是\\ :ref:`陳述式節點 (statement nodes) ` " +"的 :class:`list`。" #: ../../library/ast.rst:214 msgid "" @@ -665,8 +667,8 @@ msgstr "" #: ../../library/ast.rst:299 msgid "" -"An f-string, comprising a series of :class:`FormattedValue` and :class:" -"`Constant` nodes." +"An f-string, comprising a series of :class:`FormattedValue` " +"and :class:`Constant` nodes." msgstr "" "一個 f 字串,包含一系列 :class:`FormattedValue` 和 :class:`Constant` 節點。" @@ -718,8 +720,8 @@ msgid "" "``ctx`` is :class:`Store` if the container is an assignment target (i.e. " "``(x,y)=something``), and :class:`Load` otherwise." msgstr "" -"串列或元組。``elts`` 保存表示元素的節點串列。如果容器是賦值目標(即 ``(x," -"y)=something`` ),則 ``ctx`` 是 :class:`Store`,否則是 :class:`Load`。" +"串列或元組。``elts`` 保存表示元素的節點串列。如果容器是賦值目標(即 " +"``(x,y)=something`` ),則 ``ctx`` 是 :class:`Store`,否則是 :class:`Load`。" #: ../../library/ast.rst:331 msgid "" @@ -885,9 +887,9 @@ msgstr "" #: ../../library/ast.rst:432 msgid "" -"A ``*var`` variable reference. ``value`` holds the variable, typically a :" -"class:`Name` node. This type must be used when building a :class:`Call` node " -"with ``*args``." +"A ``*var`` variable reference. ``value`` holds the variable, typically " +"a :class:`Name` node. This type must be used when building a :class:`Call` " +"node with ``*args``." msgstr "" "一個 ``*var`` 變數參照。``value`` 保存變數,通常是一個 :class:`Name` 節點。在" "使用 ``*args`` 建置 :class:`Call` 節點時必須使用此型別。" @@ -930,14 +932,14 @@ msgstr "運算式" msgid "" "When an expression, such as a function call, appears as a statement by " "itself with its return value not used or stored, it is wrapped in this " -"container. ``value`` holds one of the other nodes in this section, a :class:" -"`Constant`, a :class:`Name`, a :class:`Lambda`, a :class:`Yield` or :class:" -"`YieldFrom` node." +"container. ``value`` holds one of the other nodes in this section, " +"a :class:`Constant`, a :class:`Name`, a :class:`Lambda`, a :class:`Yield` " +"or :class:`YieldFrom` node." msgstr "" "當運算式(例如函式呼叫)本身作為陳述式出現且未使用或儲存其回傳值時,它將被包" -"裝在此容器中。``value`` 保存此區段 (section) 中的一個其他節點::class:" -"`Constant`、:class:`Name`、:class:`Lambda`、:class:`Yield` 或 :class:" -"`YieldFrom`" +"裝在此容器中。``value`` 保存此區段 (section) 中的一個其他節" +"點::class:`Constant`、:class:`Name`、:class:`Lambda`、:class:`Yield` " +"或 :class:`YieldFrom`" #: ../../library/ast.rst:465 msgid "" @@ -1090,11 +1092,11 @@ msgstr "比較運算子 token。" #: ../../library/ast.rst:593 msgid "" -"A function call. ``func`` is the function, which will often be a :class:" -"`Name` or :class:`Attribute` object. Of the arguments:" +"A function call. ``func`` is the function, which will often be " +"a :class:`Name` or :class:`Attribute` object. Of the arguments:" msgstr "" -"一個函式呼叫。``func`` 是該函式,通常是一個 :class:`Name` 或 :class:" -"`Attribute` 物件。而在引數中:" +"一個函式呼叫。``func`` 是該函式,通常是一個 :class:`Name` " +"或 :class:`Attribute` 物件。而在引數中:" #: ../../library/ast.rst:596 msgid "``args`` holds a list of the arguments passed by position." @@ -1183,14 +1185,14 @@ msgstr "" #: ../../library/ast.rst:644 msgid "" -"Attribute access, e.g. ``d.keys``. ``value`` is a node, typically a :class:" -"`Name`. ``attr`` is a bare string giving the name of the attribute, and " -"``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to how " -"the attribute is acted on." +"Attribute access, e.g. ``d.keys``. ``value`` is a node, typically " +"a :class:`Name`. ``attr`` is a bare string giving the name of the attribute, " +"and ``ctx`` is :class:`Load`, :class:`Store` or :class:`Del` according to " +"how the attribute is acted on." msgstr "" "屬性的存取,例如 ``d.keys``。``value`` 是一個節點,通常是一個 :class:`Name`。" -"``attr`` 是一個屬性名稱的字串,``ctx`` 根據屬性的作用方式可能是 :class:" -"`Load`、:class:`Store` 或 :class:`Del`。" +"``attr`` 是一個屬性名稱的字串,``ctx`` 根據屬性的作用方式可能" +"是 :class:`Load`、:class:`Store` 或 :class:`Del`。" #: ../../library/ast.rst:649 msgid "" @@ -1211,9 +1213,9 @@ msgstr "" #: ../../library/ast.rst:661 msgid "" "A named expression. This AST node is produced by the assignment expressions " -"operator (also known as the walrus operator). As opposed to the :class:" -"`Assign` node in which the first argument can be multiple nodes, in this " -"case both ``target`` and ``value`` must be single nodes." +"operator (also known as the walrus operator). As opposed to " +"the :class:`Assign` node in which the first argument can be multiple nodes, " +"in this case both ``target`` and ``value`` must be single nodes." msgstr "" "一個附名運算式 (named expression)。該 AST 節點由賦值運算式運算子(也稱為海象" "運算子)產生。相對於 :class:`Assign` 節點之第一個引數可為多個節點,在這種情況" @@ -1240,14 +1242,15 @@ msgstr "下標 (Subscripting)" #: ../../library/ast.rst:681 msgid "" "A subscript, such as ``l[1]``. ``value`` is the subscripted object (usually " -"sequence or mapping). ``slice`` is an index, slice or key. It can be a :" -"class:`Tuple` and contain a :class:`Slice`. ``ctx`` is :class:`Load`, :class:" -"`Store` or :class:`Del` according to the action performed with the subscript." +"sequence or mapping). ``slice`` is an index, slice or key. It can be " +"a :class:`Tuple` and contain a :class:`Slice`. ``ctx`` " +"is :class:`Load`, :class:`Store` or :class:`Del` according to the action " +"performed with the subscript." msgstr "" "一個下標,例如 ``l[1]``。``value`` 是下標物件(通常是序列或對映)。``slice`` " "是索引、切片或鍵。它可以是一個 :class:`Tuple` 並包含一個 :class:`Slice`。根據" -"下標執行的操作不同,``ctx`` 可以是 :class:`Load`、:class:`Store` 或 :class:" -"`Del`。" +"下標執行的操作不同,``ctx`` 可以是 :class:`Load`、:class:`Store` " +"或 :class:`Del`。" #: ../../library/ast.rst:687 msgid "" @@ -1414,9 +1417,9 @@ msgid "" "``iter`` is the object to iterate over. ``ifs`` is a list of test " "expressions: each ``for`` clause can have multiple ``ifs``." msgstr "" -"綜合運算中的一個 ``for`` 子句。``target`` 是用於每個元素的參照 - 通常是 :" -"class:`Name` 或 :class:`Tuple` 節點。``iter`` 是要疊代的物件。``ifs`` 是測試" -"運算式的串列:每個 ``for`` 子句可以有多個 ``ifs``。" +"綜合運算中的一個 ``for`` 子句。``target`` 是用於每個元素的參照 - 通常" +"是 :class:`Name` 或 :class:`Tuple` 節點。``iter`` 是要疊代的物件。``ifs`` 是" +"測試運算式的串列:每個 ``for`` 子句可以有多個 ``ifs``。" #: ../../library/ast.rst:786 msgid "" @@ -1564,7 +1567,7 @@ msgstr "" "中放置一個 :class:`Tuple` 或 :class:`List` 來表示的。" #: ../../library/ast.rst:863 ../../library/ast.rst:1158 -#: ../../library/ast.rst:1352 ../../library/ast.rst:1881 +#: ../../library/ast.rst:1352 ../../library/ast.rst:1918 msgid "" "``type_comment`` is an optional string with the type annotation as a comment." msgstr "``type_comment`` 是一個可選字串,其中的註解為型別註釋。" @@ -1617,25 +1620,26 @@ msgstr "" msgid "" "An assignment with a type annotation. ``target`` is a single node and can be " "a :class:`Name`, an :class:`Attribute` or a :class:`Subscript`. " -"``annotation`` is the annotation, such as a :class:`Constant` or :class:" -"`Name` node. ``value`` is a single optional node." +"``annotation`` is the annotation, such as a :class:`Constant` " +"or :class:`Name` node. ``value`` is a single optional node." msgstr "" -"帶有型別註釋的賦值。``target`` 是單個節點,可以是 :class:`Name`、:class:" -"`Attribute` 或 :class:`Subscript`。``annotation`` 是註釋,例如 :class:" -"`Constant` 或 :class:`Name` 節點。``value`` 是單個可選節點。" +"帶有型別註釋的賦值。``target`` 是單個節點,可以" +"是 :class:`Name`、:class:`Attribute` 或 :class:`Subscript`。``annotation`` 是" +"註釋,例如 :class:`Constant` 或 :class:`Name` 節點。``value`` 是單個可選節" +"點。" #: ../../library/ast.rst:896 msgid "" "``simple`` is always either 0 (indicating a \"complex\" target) or 1 " -"(indicating a \"simple\" target). A \"simple\" target consists solely of a :" -"class:`Name` node that does not appear between parentheses; all other " -"targets are considered complex. Only simple targets appear in the :attr:" -"`~object.__annotations__` dictionary of modules and classes." +"(indicating a \"simple\" target). A \"simple\" target consists solely of " +"a :class:`Name` node that does not appear between parentheses; all other " +"targets are considered complex. Only simple targets appear in " +"the :attr:`~object.__annotations__` dictionary of modules and classes." msgstr "" "``simple`` 總會是 0(表示一個「複雜」目標)或 1(表示一個「簡單」目標)。一個" "「簡單」目標僅包含一個 :class:`Name` 節點,且不出現在括號之間;所有其他目標都" -"被視為是複雜的。只有簡單目標會出現在模組和類別的 :attr:`~object." -"__annotations__` 字典中。" +"被視為是複雜的。只有簡單目標會出現在模組和類別" +"的 :attr:`~object.__annotations__` 字典中。" #: ../../library/ast.rst:902 msgid "" @@ -1729,16 +1733,16 @@ msgid "" "value for 1." msgstr "" "增加賦值 (augmented assignment),例如 ``a += 1``。在下面的範例中,``target`` " -"是 ``x`` 的 :class:`Name` 節點(帶有 :class:`Store` 情境),``op`` 是 :class:" -"`Add`,``value`` 是一個值為 1 的 :class:`Constant`。" +"是 ``x`` 的 :class:`Name` 節點(帶有 :class:`Store` 情境),``op`` " +"是 :class:`Add`,``value`` 是一個值為 1 的 :class:`Constant`。" #: ../../library/ast.rst:951 msgid "" "The ``target`` attribute cannot be of class :class:`Tuple` or :class:`List`, " "unlike the targets of :class:`Assign`." msgstr "" -"與 :class:`Assign` 的目標不同,``target`` 屬性不能屬於 :class:`Tuple` 或 :" -"class:`List` 類別。" +"與 :class:`Assign` 的目標不同,``target`` 屬性不能屬於 :class:`Tuple` " +"或 :class:`List` 類別。" #: ../../library/ast.rst:954 msgid "" @@ -1764,8 +1768,8 @@ msgid "" "normally a :class:`Call` or :class:`Name`, or ``None`` for a standalone " "``raise``. ``cause`` is the optional part for ``y`` in ``raise x from y``." msgstr "" -"一個 ``raise`` 陳述式。``exc`` 是要引發的例外物件,通常是 :class:`Call` 或 :" -"class:`Name`,若是獨立的 ``raise`` 則為 ``None``。``cause`` 是 ``raise x " +"一個 ``raise`` 陳述式。``exc`` 是要引發的例外物件,通常是 :class:`Call` " +"或 :class:`Name`,若是獨立的 ``raise`` 則為 ``None``。``cause`` 是 ``raise x " "from y`` 中的可選部分 ``y``。" #: ../../library/ast.rst:971 @@ -1810,11 +1814,11 @@ msgstr "" #: ../../library/ast.rst:998 msgid "" -"Represents a ``del`` statement. ``targets`` is a list of nodes, such as :" -"class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." +"Represents a ``del`` statement. ``targets`` is a list of nodes, such " +"as :class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." msgstr "" -"代表一個 ``del`` 陳述式。``targets`` 是節點串列,例如 :class:`Name`、:class:" -"`Attribute` 或 :class:`Subscript` 節點。" +"代表一個 ``del`` 陳述式。``targets`` 是節點串列,例" +"如 :class:`Name`、:class:`Attribute` 或 :class:`Subscript` 節點。" #: ../../library/ast.rst:1001 msgid "" @@ -1855,9 +1859,9 @@ msgstr "" #: ../../library/ast.rst:1027 msgid "" "A :ref:`type alias ` created through the :keyword:`type` " -"statement. ``name`` is the name of the alias, ``type_params`` is a list of :" -"ref:`type parameters `, and ``value`` is the value of the " -"type alias." +"statement. ``name`` is the name of the alias, ``type_params`` is a list " +"of :ref:`type parameters `, and ``value`` is the value of " +"the type alias." msgstr "" "透過 :keyword:`type` 陳述式建立的\\ :ref:`型別別名 (type alias) `。``name`` 是別名的名稱、``type_params`` 是\\ :ref:`型別參數 (type " @@ -1990,8 +1994,8 @@ msgstr "諸如 ``else`` 之類的可選子句如果不存在,則將被儲存 #: ../../library/ast.rst:1112 msgid "" -"An ``if`` statement. ``test`` holds a single node, such as a :class:" -"`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." +"An ``if`` statement. ``test`` holds a single node, such as " +"a :class:`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." msgstr "" "一個 ``if`` 陳述式。``test`` 保存單個節點,例如 :class:`Compare` 節點。" "``body`` 和 ``orelse`` 各自保存一個節點串列。" @@ -2060,17 +2064,17 @@ msgstr "" #: ../../library/ast.rst:1149 msgid "" "A ``for`` loop. ``target`` holds the variable(s) the loop assigns to, as a " -"single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` or :" -"class:`Subscript` node. ``iter`` holds the item to be looped over, again as " -"a single node. ``body`` and ``orelse`` contain lists of nodes to execute. " +"single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` " +"or :class:`Subscript` node. ``iter`` holds the item to be looped over, again " +"as a single node. ``body`` and ``orelse`` contain lists of nodes to execute. " "Those in ``orelse`` are executed if the loop finishes normally, rather than " "via a ``break`` statement." msgstr "" -"一個 ``for`` 迴圈。 ``target`` 保存迴圈賦予的變數,為單個 :class:`Name`、:" -"class:`Tuple`、:class:`List`、:class:`Attribute` 或 :class:`Subscript` 節點。" -"``iter`` 保存要迴圈跑過的項目,也為單個節點。``body`` 和 ``orelse`` 包含要執" -"行的節點串列。如果迴圈正常完成,則執行 ``orelse`` 中的內容,而不是透過 " -"``break`` 陳述式執行。" +"一個 ``for`` 迴圈。 ``target`` 保存迴圈賦予的變數,為單" +"個 :class:`Name`、:class:`Tuple`、:class:`List`、:class:`Attribute` " +"或 :class:`Subscript` 節點。``iter`` 保存要迴圈跑過的項目,也為單個節點。" +"``body`` 和 ``orelse`` 包含要執行的節點串列。如果迴圈正常完成,則執行 " +"``orelse`` 中的內容,而不是透過 ``break`` 陳述式執行。" #: ../../library/ast.rst:1160 msgid "" @@ -2118,7 +2122,7 @@ msgstr "一個 ``while`` 迴圈。``test`` 保存條件,例如 :class:`Compare #: ../../library/ast.rst:1186 msgid "" -">> print(ast.dump(ast.parse(\"\"\"\n" +">>> print(ast.dump(ast.parse(\"\"\"\n" "... while x:\n" "... ...\n" "... else:\n" @@ -2135,7 +2139,7 @@ msgid "" " Expr(\n" " value=Constant(value=Ellipsis))])])" msgstr "" -">> print(ast.dump(ast.parse(\"\"\"\n" +">>> print(ast.dump(ast.parse(\"\"\"\n" "... while x:\n" "... ...\n" "... else:\n" @@ -2351,10 +2355,10 @@ msgid "" "clause). ``name`` is a raw string for the name to hold the exception, or " "``None`` if the clause doesn't have ``as foo``. ``body`` is a list of nodes." msgstr "" -"單個 ``except`` 子句。``type`` 是會被匹配的例外型別,通常是一個 :class:" -"`Name` 節點(或者 ``None`` 表示會捕捉到所有例外的 ``except:`` 子句)。" -"``name`` 是用於保存例外的名稱之原始字串,如果子句沒有 ``as foo`` ,則為 " -"``None``。``body`` 是節點串列。" +"單個 ``except`` 子句。``type`` 是會被匹配的例外型別,通常是一" +"個 :class:`Name` 節點(或者 ``None`` 表示會捕捉到所有例外的 ``except:`` 子" +"句)。``name`` 是用於保存例外的名稱之原始字串,如果子句沒有 ``as foo`` ,則" +"為 ``None``。``body`` 是節點串列。" #: ../../library/ast.rst:1321 msgid "" @@ -2412,13 +2416,14 @@ msgstr "" #: ../../library/ast.rst:1357 msgid "" "A single context manager in a ``with`` block. ``context_expr`` is the " -"context manager, often a :class:`Call` node. ``optional_vars`` is a :class:" -"`Name`, :class:`Tuple` or :class:`List` for the ``as foo`` part, or ``None`` " -"if that isn't used." +"context manager, often a :class:`Call` node. ``optional_vars`` is " +"a :class:`Name`, :class:`Tuple` or :class:`List` for the ``as foo`` part, or " +"``None`` if that isn't used." msgstr "" -"``with`` 區塊中的單個情境管理器。``context_expr`` 是情境管理器,通常是一個 :" -"class:`Call` 節點。``Optional_vars`` 是 ``as foo`` 部分的 :class:`Name`、:" -"class:`Tuple` 或 :class:`List`,或者如果不使用則為 ``None`` 。" +"``with`` 區塊中的單個情境管理器。``context_expr`` 是情境管理器,通常是一" +"個 :class:`Call` 節點。``Optional_vars`` 是 ``as foo`` 部分" +"的 :class:`Name`、:class:`Tuple` 或 :class:`List`,或者如果不使用則為 " +"``None`` 。" #: ../../library/ast.rst:1362 msgid "" @@ -2482,8 +2487,8 @@ msgstr "" #: ../../library/ast.rst:1401 msgid "" "A single case pattern in a ``match`` statement. ``pattern`` contains the " -"match pattern that the subject will be matched against. Note that the :class:" -"`AST` nodes produced for patterns differ from those produced for " +"match pattern that the subject will be matched against. Note that " +"the :class:`AST` nodes produced for patterns differ from those produced for " "expressions, even when they share the same syntax." msgstr "" "``match`` 陳述式中的單個案例模式。``pattern`` 包含主題將與之匹配的匹配模式。" @@ -3121,30 +3126,93 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1762 +#: ../../library/ast.rst:1761 +msgid "Type annotations" +msgstr "" + +#: ../../library/ast.rst:1765 +msgid "" +"A ``# type: ignore`` comment located at *lineno*. *tag* is the optional tag " +"specified by the form ``# type: ignore ``." +msgstr "" + +#: ../../library/ast.rst:1768 +msgid "" +">>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), " +"indent=4))\n" +"Module(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Name(id='x', ctx=Store())],\n" +" value=Constant(value=1))],\n" +" type_ignores=[\n" +" TypeIgnore(lineno=1, tag='')])\n" +">>> print(ast.dump(ast.parse('x: bool = 1 # type: ignore[assignment]', " +"type_comments=True), indent=4))\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Name(id='x', ctx=Store()),\n" +" annotation=Name(id='bool', ctx=Load()),\n" +" value=Constant(value=1),\n" +" simple=1)],\n" +" type_ignores=[\n" +" TypeIgnore(lineno=1, tag='[assignment]')])" +msgstr "" +">>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), " +"indent=4))\n" +"Module(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Name(id='x', ctx=Store())],\n" +" value=Constant(value=1))],\n" +" type_ignores=[\n" +" TypeIgnore(lineno=1, tag='')])\n" +">>> print(ast.dump(ast.parse('x: bool = 1 # type: ignore[assignment]', " +"type_comments=True), indent=4))\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Name(id='x', ctx=Store()),\n" +" annotation=Name(id='bool', ctx=Load()),\n" +" value=Constant(value=1),\n" +" simple=1)],\n" +" type_ignores=[\n" +" TypeIgnore(lineno=1, tag='[assignment]')])" + +#: ../../library/ast.rst:1791 +msgid "" +":class:`!TypeIgnore` nodes are not generated when the *type_comments* " +"parameter is set to ``False`` (default). See :func:`ast.parse` for more " +"details." +msgstr "" + +#: ../../library/ast.rst:1799 msgid "Type parameters" msgstr "型別參數 (type parameters)" -#: ../../library/ast.rst:1764 +#: ../../library/ast.rst:1801 msgid "" ":ref:`Type parameters ` can exist on classes, functions, and " "type aliases." msgstr ":ref:`型別參數 `\\ 可以存在於類別、函式和型別別名上。" -#: ../../library/ast.rst:1769 +#: ../../library/ast.rst:1806 msgid "" "A :class:`typing.TypeVar`. ``name`` is the name of the type variable. " -"``bound`` is the bound or constraints, if any. If ``bound`` is a :class:" -"`Tuple`, it represents constraints; otherwise it represents the bound. " -"``default_value`` is the default value; if the :class:`!TypeVar` has no " -"default, this attribute will be set to ``None``." +"``bound`` is the bound or constraints, if any. If ``bound`` is " +"a :class:`Tuple`, it represents constraints; otherwise it represents the " +"bound. ``default_value`` is the default value; if the :class:`!TypeVar` has " +"no default, this attribute will be set to ``None``." msgstr "" "一個 :class:`typing.TypeVar`。``name`` 是型別變數的名稱。``bound`` 是(如果有" -"存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一個 :class:" -"`Tuple`,它代表約束;否則它代表界限。``default_value`` 為預設值;如果 :class:" -"`!TypeVar` 沒有預設值,那此屬性會被設為 ``None``。" +"存在的)界限 (bound) 或約束 (constraint)。如果 ``bound`` 是一" +"個 :class:`Tuple`,它代表約束;否則它代表界限。``default_value`` 為預設值;如" +"果 :class:`!TypeVar` 沒有預設值,那此屬性會被設為 ``None``。" -#: ../../library/ast.rst:1775 +#: ../../library/ast.rst:1812 msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[T: int = bool] = list[T]\"), " "indent=4))\n" @@ -3178,12 +3246,12 @@ msgstr "" " slice=Name(id='T', ctx=Load()),\n" " ctx=Load()))])" -#: ../../library/ast.rst:1794 ../../library/ast.rst:1829 -#: ../../library/ast.rst:1861 +#: ../../library/ast.rst:1831 ../../library/ast.rst:1866 +#: ../../library/ast.rst:1898 msgid "Added the *default_value* parameter." msgstr "新增 *default_value* 參數。" -#: ../../library/ast.rst:1799 +#: ../../library/ast.rst:1836 msgid "" "A :class:`typing.ParamSpec`. ``name`` is the name of the parameter " "specification. ``default_value`` is the default value; if the :class:`!" @@ -3192,7 +3260,7 @@ msgstr "" "一個 :class:`typing.ParamSpec`。``name`` 是參數規範的名稱。``default_value`` " "是預設值;如果 :class:`!ParamSpec` 沒有預設值,則該屬性將設定為 ``None``。" -#: ../../library/ast.rst:1803 +#: ../../library/ast.rst:1840 msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[**P = [int, str]] = Callable[P, " "int]\"), indent=4))\n" @@ -3240,7 +3308,7 @@ msgstr "" " ctx=Load()),\n" " ctx=Load()))])" -#: ../../library/ast.rst:1834 +#: ../../library/ast.rst:1871 msgid "" "A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable " "tuple. ``default_value`` is the default value; if the :class:`!TypeVarTuple` " @@ -3250,7 +3318,7 @@ msgstr "" "``default_value`` 為預設值;如果 :class:`!TypeVarTuple` 沒有預設值,那此屬性" "會被設為 ``None``。" -#: ../../library/ast.rst:1838 +#: ../../library/ast.rst:1875 msgid "" ">>> print(ast.dump(ast.parse(\"type Alias[*Ts = ()] = tuple[*Ts]\"), " "indent=4))\n" @@ -3292,27 +3360,27 @@ msgstr "" " ctx=Load()),\n" " ctx=Load()))])" -#: ../../library/ast.rst:1865 +#: ../../library/ast.rst:1902 msgid "Function and class definitions" msgstr "函式和類別定義" -#: ../../library/ast.rst:1869 +#: ../../library/ast.rst:1906 msgid "A function definition." msgstr "一個函式定義。" -#: ../../library/ast.rst:1871 +#: ../../library/ast.rst:1908 msgid "``name`` is a raw string of the function name." msgstr "``name`` 是函式名稱的原始字串。" -#: ../../library/ast.rst:1872 +#: ../../library/ast.rst:1909 msgid "``args`` is an :class:`arguments` node." msgstr "``args`` 是一個 :class:`arguments` 節點。" -#: ../../library/ast.rst:1873 +#: ../../library/ast.rst:1910 msgid "``body`` is the list of nodes inside the function." msgstr "``body`` 是函式內節點的串列。" -#: ../../library/ast.rst:1874 +#: ../../library/ast.rst:1911 msgid "" "``decorator_list`` is the list of decorators to be applied, stored outermost " "first (i.e. the first in the list will be applied last)." @@ -3320,20 +3388,20 @@ msgstr "" "``decorator_list`` 是要應用的裝飾器串列,在最外層者會被儲存在首位(即串列中首" "位將會是最後一個被應用的那個)。" -#: ../../library/ast.rst:1876 +#: ../../library/ast.rst:1913 msgid "``returns`` is the return annotation." msgstr "``returns`` 是回傳註釋。" -#: ../../library/ast.rst:1877 ../../library/ast.rst:2040 +#: ../../library/ast.rst:1914 ../../library/ast.rst:2077 msgid "``type_params`` is a list of :ref:`type parameters `." msgstr "``type_params`` 是\\ :ref:`型別參數 `\\ 的串列。" -#: ../../library/ast.rst:1883 ../../library/ast.rst:2067 -#: ../../library/ast.rst:2078 +#: ../../library/ast.rst:1920 ../../library/ast.rst:2104 +#: ../../library/ast.rst:2115 msgid "Added ``type_params``." msgstr "新增了 ``type_params``。" -#: ../../library/ast.rst:1889 +#: ../../library/ast.rst:1926 msgid "" "``lambda`` is a minimal function definition that can be used inside an " "expression. Unlike :class:`FunctionDef`, ``body`` holds a single node." @@ -3341,7 +3409,7 @@ msgstr "" "``lambda`` 是可以在運算式內使用的最小函式定義。與 :class:`FunctionDef` 不同," "``body`` 保存單個節點。" -#: ../../library/ast.rst:1892 +#: ../../library/ast.rst:1929 msgid "" ">>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\n" "Module(\n" @@ -3365,17 +3433,17 @@ msgstr "" " arg(arg='y')]),\n" " body=Constant(value=Ellipsis)))])" -#: ../../library/ast.rst:1908 +#: ../../library/ast.rst:1945 msgid "The arguments for a function." msgstr "函式的引數。" -#: ../../library/ast.rst:1910 +#: ../../library/ast.rst:1947 msgid "" "``posonlyargs``, ``args`` and ``kwonlyargs`` are lists of :class:`arg` nodes." msgstr "" "``posonlyargs``、``args`` 和 ``kwonlyargs`` 是 :class:`arg` 節點的串列。" -#: ../../library/ast.rst:1911 +#: ../../library/ast.rst:1948 msgid "" "``vararg`` and ``kwarg`` are single :class:`arg` nodes, referring to the " "``*args, **kwargs`` parameters." @@ -3383,7 +3451,7 @@ msgstr "" "``vararg`` 和 ``kwarg`` 是單個 :class:`arg` 節點,指的是 ``*args, **kwargs`` " "參數。" -#: ../../library/ast.rst:1913 +#: ../../library/ast.rst:1950 msgid "" "``kw_defaults`` is a list of default values for keyword-only arguments. If " "one is ``None``, the corresponding argument is required." @@ -3391,7 +3459,7 @@ msgstr "" "``kw_defaults`` 是僅限關鍵字引數的預設值串列。如果其中某個為 ``None``,則相應" "參數就會是必要的。" -#: ../../library/ast.rst:1915 +#: ../../library/ast.rst:1952 msgid "" "``defaults`` is a list of default values for arguments that can be passed " "positionally. If there are fewer defaults, they correspond to the last n " @@ -3400,7 +3468,7 @@ msgstr "" "``defaults`` 是可以按位置傳遞的引數的預設值串列。如果預設值較少,則它們對應於" "最後 n 個引數。" -#: ../../library/ast.rst:1922 +#: ../../library/ast.rst:1959 msgid "" "A single argument in a list. ``arg`` is a raw string of the argument name; " "``annotation`` is its annotation, such as a :class:`Name` node." @@ -3408,12 +3476,12 @@ msgstr "" "串列中的單個引數。``arg`` 是引數名稱的原始字串,``annotation`` 是它的註釋,例" "如 :class:`Name` 節點。" -#: ../../library/ast.rst:1927 +#: ../../library/ast.rst:1964 msgid "" "``type_comment`` is an optional string with the type annotation as a comment" msgstr "``type_comment`` 是一個可選字串,其註解為型別註釋" -#: ../../library/ast.rst:1929 +#: ../../library/ast.rst:1966 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3487,11 +3555,11 @@ msgstr "" " Name(id='decorator2', ctx=Load())],\n" " returns=Constant(value='return annotation'))])" -#: ../../library/ast.rst:1969 +#: ../../library/ast.rst:2006 msgid "A ``return`` statement." msgstr "一個 ``return`` 陳述式。" -#: ../../library/ast.rst:1971 +#: ../../library/ast.rst:2008 msgid "" ">>> print(ast.dump(ast.parse('return 4'), indent=4))\n" "Module(\n" @@ -3505,7 +3573,7 @@ msgstr "" " Return(\n" " value=Constant(value=4))])" -#: ../../library/ast.rst:1983 +#: ../../library/ast.rst:2020 msgid "" "A ``yield`` or ``yield from`` expression. Because these are expressions, " "they must be wrapped in an :class:`Expr` node if the value sent back is not " @@ -3514,7 +3582,7 @@ msgstr "" "一個 ``yield`` 或 ``yield from`` 運算式。因為這些是運算式,所以如果不使用發送" "回來的值,則必須將它們包裝在 :class:`Expr` 節點中。" -#: ../../library/ast.rst:1986 +#: ../../library/ast.rst:2023 msgid "" ">>> print(ast.dump(ast.parse('yield x'), indent=4))\n" "Module(\n" @@ -3544,12 +3612,12 @@ msgstr "" " value=YieldFrom(\n" " value=Name(id='x', ctx=Load())))])" -#: ../../library/ast.rst:2006 +#: ../../library/ast.rst:2043 msgid "" "``global`` and ``nonlocal`` statements. ``names`` is a list of raw strings." msgstr "``global`` 和 ``nonlocal`` 陳述式。``names`` 是原始字串的串列。" -#: ../../library/ast.rst:2008 +#: ../../library/ast.rst:2045 msgid "" ">>> print(ast.dump(ast.parse('global x,y,z'), indent=4))\n" "Module(\n" @@ -3587,38 +3655,38 @@ msgstr "" " 'y',\n" " 'z'])])" -#: ../../library/ast.rst:2031 +#: ../../library/ast.rst:2068 msgid "A class definition." msgstr "一個類別定義。" -#: ../../library/ast.rst:2033 +#: ../../library/ast.rst:2070 msgid "``name`` is a raw string for the class name" msgstr "``name`` 是類別名稱的原始字串" -#: ../../library/ast.rst:2034 +#: ../../library/ast.rst:2071 msgid "``bases`` is a list of nodes for explicitly specified base classes." msgstr "``bases`` 是被顯式指定的基底類別節點串列。" -#: ../../library/ast.rst:2035 +#: ../../library/ast.rst:2072 msgid "" "``keywords`` is a list of :class:`.keyword` nodes, principally for " -"'metaclass'. Other keywords will be passed to the metaclass, as per :pep:" -"`3115`." +"'metaclass'. Other keywords will be passed to the metaclass, as " +"per :pep:`3115`." msgstr "" "``keywords`` 是一個 :class:`.keyword` 節點的串列,主要用於 'metaclass'(元類" "別)。如 :pep:`3115` 所述,其他關鍵字將被傳遞到 metaclass。" -#: ../../library/ast.rst:2037 +#: ../../library/ast.rst:2074 msgid "" "``body`` is a list of nodes representing the code within the class " "definition." msgstr "``body`` 是表示類別定義中程式碼的節點串列。" -#: ../../library/ast.rst:2039 +#: ../../library/ast.rst:2076 msgid "``decorator_list`` is a list of nodes, as in :class:`FunctionDef`." msgstr "``decorator_list`` 是一個節點串列,如 :class:`FunctionDef` 中所示。" -#: ../../library/ast.rst:2042 +#: ../../library/ast.rst:2079 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3666,25 +3734,25 @@ msgstr "" " Name(id='decorator1', ctx=Load()),\n" " Name(id='decorator2', ctx=Load())])])" -#: ../../library/ast.rst:2071 +#: ../../library/ast.rst:2108 msgid "Async and await" msgstr "async 和 await" -#: ../../library/ast.rst:2075 +#: ../../library/ast.rst:2112 msgid "" -"An ``async def`` function definition. Has the same fields as :class:" -"`FunctionDef`." +"An ``async def`` function definition. Has the same fields " +"as :class:`FunctionDef`." msgstr "一個 ``async def`` 函式定義。與 :class:`FunctionDef` 具有相同的欄位。" -#: ../../library/ast.rst:2084 +#: ../../library/ast.rst:2121 msgid "" "An ``await`` expression. ``value`` is what it waits for. Only valid in the " "body of an :class:`AsyncFunctionDef`." msgstr "" -"一個 ``await`` 運算式。``value`` 是它等待的東西。僅在 :class:" -"`AsyncFunctionDef` 主體 (body) 中有效。" +"一個 ``await`` 運算式。``value`` 是它等待的東西。僅" +"在 :class:`AsyncFunctionDef` 主體 (body) 中有效。" -#: ../../library/ast.rst:2087 +#: ../../library/ast.rst:2124 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -3716,7 +3784,7 @@ msgstr "" " value=Call(\n" " func=Name(id='other_func', ctx=Load()))))])])" -#: ../../library/ast.rst:2108 +#: ../../library/ast.rst:2145 msgid "" "``async for`` loops and ``async with`` context managers. They have the same " "fields as :class:`For` and :class:`With`, respectively. Only valid in the " @@ -3725,24 +3793,24 @@ msgstr "" "``async for`` 迴圈和 ``async with`` 情境管理器。它們分別具有與 :class:`For` " "和 :class:`With` 相同的欄位。僅在 :class:`AsyncFunctionDef` 主體中有效。" -#: ../../library/ast.rst:2113 +#: ../../library/ast.rst:2150 msgid "" -"When a string is parsed by :func:`ast.parse`, operator nodes (subclasses of :" -"class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast." -"boolop` and :class:`ast.expr_context`) on the returned tree will be " -"singletons. Changes to one will be reflected in all other occurrences of the " -"same value (e.g. :class:`ast.Add`)." +"When a string is parsed by :func:`ast.parse`, operator nodes (subclasses " +"of :class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast.boolop` " +"and :class:`ast.expr_context`) on the returned tree will be singletons. " +"Changes to one will be reflected in all other occurrences of the same value " +"(e.g. :class:`ast.Add`)." msgstr "" -"當字串被 :func:`ast.parse` 剖析時,回傳樹的運算子節點(\\ :class:`ast." -"operator`、:class:`ast.unaryop`、:class:`ast.cmpop`、:class: :class:`ast." -"boolop` 和 :class:`ast.expr_context`\\ )將是單例。對其中之一的更改將反映在所" -"有其他出現的相同值中(例如 :class:`ast.Add`\\ )。" +"當字串被 :func:`ast.parse` 剖析時,回傳樹的運算子節點" +"(\\ :class:`ast.operator`、:class:`ast.unaryop`、:class:`ast.cmpop`、:class: :class:`ast.boolop` " +"和 :class:`ast.expr_context`\\ )將是單例。對其中之一的更改將反映在所有其他出" +"現的相同值中(例如 :class:`ast.Add`\\ )。" -#: ../../library/ast.rst:2121 +#: ../../library/ast.rst:2158 msgid ":mod:`ast` Helpers" msgstr ":mod:`ast` 輔助程式" -#: ../../library/ast.rst:2123 +#: ../../library/ast.rst:2160 msgid "" "Apart from the node classes, the :mod:`ast` module defines these utility " "functions and classes for traversing abstract syntax trees:" @@ -3750,37 +3818,37 @@ msgstr "" "除了節點類別之外,:mod:`ast` 模組還定義了這些用於遍歷 (traverse) 抽象語法樹的" "實用函式和類別:" -#: ../../library/ast.rst:2128 +#: ../../library/ast.rst:2165 msgid "" "Parse the source into an AST node. Equivalent to ``compile(source, " "filename, mode, flags=FLAGS_VALUE, optimize=optimize)``, where " -"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and ``ast." -"PyCF_OPTIMIZED_AST`` otherwise." +"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and " +"``ast.PyCF_OPTIMIZED_AST`` otherwise." msgstr "" "將原始碼剖析為 AST 節點,相當於 ``compile(source, filename, mode, " "flags=FLAGS_VALUE, optimize=optimize)``,其中 ``FLAGS_VALUE`` 在 ``optimize " "<= 0`` 時為 ``ast.PyCF_ONLY_AST``,否則為 ``ast.PyCF_OPTIMIZED_AST``。" -#: ../../library/ast.rst:2133 +#: ../../library/ast.rst:2170 msgid "" "If ``type_comments=True`` is given, the parser is modified to check and " "return type comments as specified by :pep:`484` and :pep:`526`. This is " -"equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the flags passed to :" -"func:`compile`. This will report syntax errors for misplaced type " +"equivalent to adding :data:`ast.PyCF_TYPE_COMMENTS` to the flags passed " +"to :func:`compile`. This will report syntax errors for misplaced type " "comments. Without this flag, type comments will be ignored, and the " "``type_comment`` field on selected AST nodes will always be ``None``. In " "addition, the locations of ``# type: ignore`` comments will be returned as " "the ``type_ignores`` attribute of :class:`Module` (otherwise it is always an " "empty list)." msgstr "" -"如果給定 ``type_comments=True``,剖析器將被修改為檢查並回傳 :pep:`484` 和 :" -"pep:`526` 指定的型別註釋。這相當於將 :data:`ast.PyCF_TYPE_COMMENTS` 新增到傳" -"遞給 :func:`compile` 的旗標中。這將報告錯誤型別註釋的語法錯誤。如果沒有此旗" -"標,型別註釋將被忽略,並且所選 AST 節點上的 ``type_comment`` 欄位將始終為 " +"如果給定 ``type_comments=True``,剖析器將被修改為檢查並回傳 :pep:`484` " +"和 :pep:`526` 指定的型別註釋。這相當於將 :data:`ast.PyCF_TYPE_COMMENTS` 新增" +"到傳遞給 :func:`compile` 的旗標中。這將報告錯誤型別註釋的語法錯誤。如果沒有此" +"旗標,型別註釋將被忽略,並且所選 AST 節點上的 ``type_comment`` 欄位將始終為 " "``None``。此外,``# type: ignore`` 註釋的位置將作為 :class:`Module` 的 " "``type_ignores`` 屬性回傳(否則它始終是一個空串列)。" -#: ../../library/ast.rst:2143 +#: ../../library/ast.rst:2180 msgid "" "In addition, if ``mode`` is ``'func_type'``, the input syntax is modified to " "correspond to :pep:`484` \"signature type comments\", e.g. ``(str, int) -> " @@ -3790,7 +3858,7 @@ msgstr "" "名型別註解 (signature type comments)」而被修改,例如 ``(str, int) -> " "List[str]``。" -#: ../../library/ast.rst:2147 +#: ../../library/ast.rst:2184 msgid "" "Setting ``feature_version`` to a tuple ``(major, minor)`` will result in a " "\"best-effort\" attempt to parse using that Python version's grammar. For " @@ -3810,12 +3878,12 @@ msgstr "" "能保證剖析(或剖析的成功)與在與 ``feature_version`` 對應的 Python 版本上運行" "時相同。" -#: ../../library/ast.rst:2157 +#: ../../library/ast.rst:2194 msgid "" "If source contains a null character (``\\0``), :exc:`ValueError` is raised." msgstr "如果來源包含 null 字元 (``\\0``),則會引發 :exc:`ValueError`。" -#: ../../library/ast.rst:2160 +#: ../../library/ast.rst:2197 msgid "" "Note that successfully parsing source code into an AST object doesn't " "guarantee that the source code provided is valid Python code that can be " @@ -3829,14 +3897,14 @@ msgstr "" "原始的 ``return 42`` 為 return 陳述式生成一個有效的 AST 節點,但它不能單獨編" "譯(它需要位於函式節點內)。" -#: ../../library/ast.rst:2167 +#: ../../library/ast.rst:2204 msgid "" "In particular, :func:`ast.parse` won't do any scoping checks, which the " "compilation step does." msgstr "" "特別是 :func:`ast.parse` 不會執行任何範圍檢查,而編譯步驟才會執行此操作。" -#: ../../library/ast.rst:2171 +#: ../../library/ast.rst:2208 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string due to stack depth limitations in Python's AST compiler." @@ -3844,11 +3912,11 @@ msgstr "" "由於 Python AST 編譯器中的堆疊 (stack) 深度限制,太大或太複雜的字串可能會導" "致 Python 直譯器崩潰。" -#: ../../library/ast.rst:2175 +#: ../../library/ast.rst:2212 msgid "Added ``type_comments``, ``mode='func_type'`` and ``feature_version``." msgstr "新增 ``type_comments``、``mode='func_type'`` 與 ``feature_version``。" -#: ../../library/ast.rst:2178 +#: ../../library/ast.rst:2215 msgid "" "The minimum supported version for ``feature_version`` is now ``(3, 7)``. The " "``optimize`` argument was added." @@ -3856,16 +3924,16 @@ msgstr "" "``feature_version`` 的最低支援版本現在是 ``(3, 7)``。新增了 ``optimize`` 引" "數。" -#: ../../library/ast.rst:2185 +#: ../../library/ast.rst:2222 msgid "" "Unparse an :class:`ast.AST` object and generate a string with code that " -"would produce an equivalent :class:`ast.AST` object if parsed back with :" -"func:`ast.parse`." +"would produce an equivalent :class:`ast.AST` object if parsed back " +"with :func:`ast.parse`." msgstr "" -"反剖析 :class:`ast.AST` 物件並生成一個帶有程式碼的字串,如果使用 :func:`ast." -"parse` 剖析回來,該程式碼將生成等效的 :class:`ast.AST` 物件。" +"反剖析 :class:`ast.AST` 物件並生成一個帶有程式碼的字串,如果使" +"用 :func:`ast.parse` 剖析回來,該程式碼將生成等效的 :class:`ast.AST` 物件。" -#: ../../library/ast.rst:2190 +#: ../../library/ast.rst:2227 msgid "" "The produced code string will not necessarily be equal to the original code " "that generated the :class:`ast.AST` object (without any compiler " @@ -3874,13 +3942,13 @@ msgstr "" "生成的程式碼字串不一定等於生成 :class:`ast.AST` 物件的原始程式碼(沒有任何編" "譯器最佳化,例如常數元組/凍結集合)。" -#: ../../library/ast.rst:2195 +#: ../../library/ast.rst:2232 msgid "" -"Trying to unparse a highly complex expression would result with :exc:" -"`RecursionError`." +"Trying to unparse a highly complex expression would result " +"with :exc:`RecursionError`." msgstr "嘗試剖析高度複雜的運算式會導致 :exc:`RecursionError`。" -#: ../../library/ast.rst:2203 +#: ../../library/ast.rst:2240 msgid "" "Evaluate an expression node or a string containing only a Python literal or " "container display. The string or node provided may only consist of the " @@ -3891,7 +3959,7 @@ msgstr "" "能包含以下 Python 文本結構:字串、位元組、數字、元組、串列、字典、集合、布林" "值、``None`` 和 ``Ellipsis``。" -#: ../../library/ast.rst:2208 +#: ../../library/ast.rst:2245 msgid "" "This can be used for evaluating strings containing Python values without the " "need to parse the values oneself. It is not capable of evaluating " @@ -3900,7 +3968,7 @@ msgstr "" "這可用於為包含 Python 值的字串求值,而無需自己剖析這些值。它無法計算任意複雜" "的運算式,例如涉及運算子或索引。" -#: ../../library/ast.rst:2213 +#: ../../library/ast.rst:2250 msgid "" "This function had been documented as \"safe\" in the past without defining " "what that meant. That was misleading. This is specifically designed not to " @@ -3917,60 +3985,62 @@ msgstr "" "盡或 C 堆疊耗盡,從而導致行程崩潰。某些輸入也可能會出現 CPU 消耗過多而導致拒" "絕服務的情況。因此不建議在不受信任的資料上呼叫它。" -#: ../../library/ast.rst:2223 +#: ../../library/ast.rst:2260 msgid "" "It is possible to crash the Python interpreter due to stack depth " "limitations in Python's AST compiler." msgstr "由於 Python AST 編譯器的堆疊深度限制,Python 直譯器可能會崩潰。" -#: ../../library/ast.rst:2226 +#: ../../library/ast.rst:2263 msgid "" -"It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:" -"`MemoryError` and :exc:`RecursionError` depending on the malformed input." +"It can " +"raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:`MemoryError` " +"and :exc:`RecursionError` depending on the malformed input." msgstr "" -"它可能會引發 :exc:`ValueError`、:exc:`TypeError`、:exc:`SyntaxError`、:exc:" -"`MemoryError` 和 :exc:`RecursionError`,具體取決於格式錯誤的輸入。" +"它可能會引" +"發 :exc:`ValueError`、:exc:`TypeError`、:exc:`SyntaxError`、:exc:`MemoryError` " +"和 :exc:`RecursionError`,具體取決於格式錯誤的輸入。" -#: ../../library/ast.rst:2230 +#: ../../library/ast.rst:2267 msgid "Now allows bytes and set literals." msgstr "現在允許位元組和集合文本 (set literal)。" -#: ../../library/ast.rst:2233 +#: ../../library/ast.rst:2270 msgid "Now supports creating empty sets with ``'set()'``." msgstr "現在支援使用 ``'set()'`` 建立空集合。" -#: ../../library/ast.rst:2236 +#: ../../library/ast.rst:2273 msgid "For string inputs, leading spaces and tabs are now stripped." msgstr "對於字串輸入,前導空格和定位字元 (tab) 現在已被去除。" -#: ../../library/ast.rst:2242 +#: ../../library/ast.rst:2279 msgid "" -"Return the docstring of the given *node* (which must be a :class:" -"`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, or :class:" -"`Module` node), or ``None`` if it has no docstring. If *clean* is true, " -"clean up the docstring's indentation with :func:`inspect.cleandoc`." +"Return the docstring of the given *node* (which must be " +"a :class:`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, " +"or :class:`Module` node), or ``None`` if it has no docstring. If *clean* is " +"true, clean up the docstring's indentation with :func:`inspect.cleandoc`." msgstr "" -"回傳給定 *node* 的文件字串 (docstring)(必須是 :class:`FunctionDef`、:class:" -"`AsyncFunctionDef`、:class:`ClassDef` 或 :class:`Module` 節點)或如果它沒有文" -"件字串則為 ``None``。如果 *clean* 為 true,則使用 :func:`inspect.cleandoc` 清" -"理文件字串的縮排。" +"回傳給定 *node* 的文件字串 (docstring)(必須" +"是 :class:`FunctionDef`、:class:`AsyncFunctionDef`、:class:`ClassDef` " +"或 :class:`Module` 節點)或如果它沒有文件字串則為 ``None``。如果 *clean* 為 " +"true,則使用 :func:`inspect.cleandoc` 清理文件字串的縮排。" -#: ../../library/ast.rst:2248 +#: ../../library/ast.rst:2285 msgid ":class:`AsyncFunctionDef` is now supported." msgstr "目前已支援 :class:`AsyncFunctionDef`。" -#: ../../library/ast.rst:2254 +#: ../../library/ast.rst:2291 msgid "" "Get source code segment of the *source* that generated *node*. If some " -"location information (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :" -"attr:`~ast.AST.col_offset`, or :attr:`~ast.AST.end_col_offset`) is missing, " -"return ``None``." +"location information " +"(:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :attr:`~ast.AST.col_offset`, " +"or :attr:`~ast.AST.end_col_offset`) is missing, return ``None``." msgstr "" -"取得生成 *node* 的 *source* 的原始碼片段。如果某些位置資訊(:attr:`~ast.AST." -"lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST.col_offset` 或 :attr:" -"`~ast.AST.end_col_offset`\\ )遺漏,則回傳 ``None``。" +"取得生成 *node* 的 *source* 的原始碼片段。如果某些位置資訊" +"(:attr:`~ast.AST.lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST.col_offset` " +"或 :attr:`~ast.AST.end_col_offset`\\ )遺漏,則回傳 ``None``。" -#: ../../library/ast.rst:2258 +#: ../../library/ast.rst:2295 msgid "" "If *padded* is ``True``, the first line of a multi-line statement will be " "padded with spaces to match its original position." @@ -3978,21 +4048,22 @@ msgstr "" "如果 *padded* 為 ``True``,則多列陳述式的第一列將用空格填充 (padded) 以匹配其" "原始位置。" -#: ../../library/ast.rst:2266 +#: ../../library/ast.rst:2303 msgid "" -"When you compile a node tree with :func:`compile`, the compiler expects :" -"attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes for every " -"node that supports them. This is rather tedious to fill in for generated " -"nodes, so this helper adds these attributes recursively where not already " -"set, by setting them to the values of the parent node. It works recursively " -"starting at *node*." +"When you compile a node tree with :func:`compile`, the compiler " +"expects :attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes " +"for every node that supports them. This is rather tedious to fill in for " +"generated nodes, so this helper adds these attributes recursively where not " +"already set, by setting them to the values of the parent node. It works " +"recursively starting at *node*." msgstr "" -"當你使用 :func:`compile` 編譯節點樹時,對於每個有支援 :attr:`~ast.AST." -"lineno` 和 :attr:`~ast.AST.col_offset` 屬性之節點,編譯器預期他們的這些屬性都" -"要存在。填入生成的節點相當繁瑣,因此該輔助工具透過將這些屬性設定為父節點的" -"值,在尚未設定的地方遞迴地新增這些屬性。它從 *node* 開始遞迴地作用。" +"當你使用 :func:`compile` 編譯節點樹時,對於每個有支" +"援 :attr:`~ast.AST.lineno` 和 :attr:`~ast.AST.col_offset` 屬性之節點,編譯器" +"預期他們的這些屬性都要存在。填入生成的節點相當繁瑣,因此該輔助工具透過將這些" +"屬性設定為父節點的值,在尚未設定的地方遞迴地新增這些屬性。它從 *node* 開始遞" +"迴地作用。" -#: ../../library/ast.rst:2275 +#: ../../library/ast.rst:2312 msgid "" "Increment the line number and end line number of each node in the tree " "starting at *node* by *n*. This is useful to \"move code\" to a different " @@ -4001,17 +4072,19 @@ msgstr "" "將樹中從 *node* 開始的每個節點的列號和結束列號增加 *n*。這對於「移動程式碼」" "到檔案中的不同位置很有用。" -#: ../../library/ast.rst:2282 +#: ../../library/ast.rst:2319 msgid "" -"Copy source location (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :" -"attr:`~ast.AST.end_lineno`, and :attr:`~ast.AST.end_col_offset`) from " -"*old_node* to *new_node* if possible, and return *new_node*." +"Copy source location " +"(:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :attr:`~ast.AST.end_lineno`, " +"and :attr:`~ast.AST.end_col_offset`) from *old_node* to *new_node* if " +"possible, and return *new_node*." msgstr "" -"如果可行,將原始位置(:attr:`~ast.AST.lineno`、:attr:`~ast.AST.col_offset`、:" -"attr:`~ast.AST.end_lineno` 和 :attr:`~ast.AST.end_col_offset` )從 " -"*old_node* 複製到 *new_node*,並回傳 *new_node* 。" +"如果可行,將原始位置" +"(:attr:`~ast.AST.lineno`、:attr:`~ast.AST.col_offset`、:attr:`~ast.AST.end_lineno` " +"和 :attr:`~ast.AST.end_col_offset` )從 *old_node* 複製到 *new_node*,並回傳 " +"*new_node* 。" -#: ../../library/ast.rst:2289 +#: ../../library/ast.rst:2326 msgid "" "Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` " "that is present on *node*." @@ -4019,7 +4092,7 @@ msgstr "" "為 *node* 上存在的 ``node._fields`` 中的每個欄位生成一個 ``(fieldname, " "value)`` 元組。" -#: ../../library/ast.rst:2295 +#: ../../library/ast.rst:2332 msgid "" "Yield all direct child nodes of *node*, that is, all fields that are nodes " "and all items of fields that are lists of nodes." @@ -4027,7 +4100,7 @@ msgstr "" "生成 *node* 的所有直接子節點,即作為節點的所有欄位以及作為節點串列欄位的所有" "項目。" -#: ../../library/ast.rst:2301 +#: ../../library/ast.rst:2338 msgid "" "Recursively yield all descendant nodes in the tree starting at *node* " "(including *node* itself), in no specified order. This is useful if you " @@ -4036,7 +4109,7 @@ msgstr "" "遞迴地生成樹中從 *node* 開始的所有後代節點(包括 *node* 本身),不按指定順" "序。如果你只想就地修改節點而不關心情境,這非常有用。" -#: ../../library/ast.rst:2308 +#: ../../library/ast.rst:2345 msgid "" "A node visitor base class that walks the abstract syntax tree and calls a " "visitor function for every node found. This function may return a value " @@ -4045,27 +4118,27 @@ msgstr "" "節點瀏覽者基底類別,它遍歷抽象語法樹並為找到的每個節點呼叫瀏覽者函式。該函式" "可能會回傳一個由 :meth:`visit` 方法轉發的值。" -#: ../../library/ast.rst:2312 +#: ../../library/ast.rst:2349 msgid "" "This class is meant to be subclassed, with the subclass adding visitor " "methods." msgstr "這個類別應該被子類別化,子類別新增瀏覽者方法。" -#: ../../library/ast.rst:2317 +#: ../../library/ast.rst:2354 msgid "" -"Visit a node. The default implementation calls the method called :samp:" -"`self.visit_{classname}` where *classname* is the name of the node class, " -"or :meth:`generic_visit` if that method doesn't exist." +"Visit a node. The default implementation calls the method " +"called :samp:`self.visit_{classname}` where *classname* is the name of the " +"node class, or :meth:`generic_visit` if that method doesn't exist." msgstr "" "瀏覽一個節點。預設實作呼叫名為 :samp:`self.visit_{classname}` 的方法,其中 " -"*classname* 是節點類別的名稱,或者在該方法不存在時呼叫 :meth:" -"`generic_visit`。" +"*classname* 是節點類別的名稱,或者在該方法不存在時呼" +"叫 :meth:`generic_visit`。" -#: ../../library/ast.rst:2323 +#: ../../library/ast.rst:2360 msgid "This visitor calls :meth:`visit` on all children of the node." msgstr "該瀏覽者對該節點的所有子節點呼叫 :meth:`visit`。" -#: ../../library/ast.rst:2325 +#: ../../library/ast.rst:2362 msgid "" "Note that child nodes of nodes that have a custom visitor method won't be " "visited unless the visitor calls :meth:`generic_visit` or visits them itself." @@ -4073,38 +4146,38 @@ msgstr "" "請注意,除非瀏覽者呼叫 :meth:`generic_visit` 或瀏覽它們本身,否則不會瀏覽具有" "自定義瀏覽者方法的節點之子節點。" -#: ../../library/ast.rst:2331 +#: ../../library/ast.rst:2368 msgid "Handles all constant nodes." msgstr "處理所有常數節點。" -#: ../../library/ast.rst:2333 +#: ../../library/ast.rst:2370 msgid "" "Don't use the :class:`NodeVisitor` if you want to apply changes to nodes " -"during traversal. For this a special visitor exists (:class:" -"`NodeTransformer`) that allows modifications." +"during traversal. For this a special visitor exists " +"(:class:`NodeTransformer`) that allows modifications." msgstr "" -"如果你想在遍歷期間將變更應用 (apply) 於節點,請不要使用 :class:" -"`NodeVisitor`。為此,有個允許修改的特殊遍歷瀏覽者工具 :class:" -"`NodeTransformer`。" +"如果你想在遍歷期間將變更應用 (apply) 於節點,請不要使" +"用 :class:`NodeVisitor`。為此,有個允許修改的特殊遍歷瀏覽者工" +"具 :class:`NodeTransformer`。" -#: ../../library/ast.rst:2339 +#: ../../library/ast.rst:2376 msgid "" -"Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!visit_Bytes`, :meth:" -"`!visit_NameConstant` and :meth:`!visit_Ellipsis` are deprecated now and " -"will not be called in future Python versions. Add the :meth:" -"`visit_Constant` method to handle all constant nodes." +"Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!" +"visit_Bytes`, :meth:`!visit_NameConstant` and :meth:`!visit_Ellipsis` are " +"deprecated now and will not be called in future Python versions. Add " +"the :meth:`visit_Constant` method to handle all constant nodes." msgstr "" ":meth:`!visit_Num`、:meth:`!visit_Str`、:meth:`!visit_Bytes`、:meth:`!" "visit_NameConstant` 和 :meth:`!visit_Ellipsis` 方法現已棄用,並且不會在未來的" "Python 版本中被呼叫。新增 :meth:`visit_Constant` 方法來處理所有常數節點。" -#: ../../library/ast.rst:2347 +#: ../../library/ast.rst:2384 msgid "" "A :class:`NodeVisitor` subclass that walks the abstract syntax tree and " "allows modification of nodes." msgstr "一個 :class:`NodeVisitor` 子類別,它會遍歷抽象語法樹並允許修改節點。" -#: ../../library/ast.rst:2350 +#: ../../library/ast.rst:2387 msgid "" "The :class:`NodeTransformer` will walk the AST and use the return value of " "the visitor methods to replace or remove the old node. If the return value " @@ -4116,7 +4189,7 @@ msgstr "" "點。如果瀏覽者方法的回傳值為 ``None``,則該節點將從其位置中刪除,否則將被替換" "為回傳值。回傳值可能是原始節點,在這種情況下不會發生替換。" -#: ../../library/ast.rst:2356 +#: ../../library/ast.rst:2393 msgid "" "Here is an example transformer that rewrites all occurrences of name lookups " "(``foo``) to ``data['foo']``::" @@ -4124,7 +4197,7 @@ msgstr "" "下面是一個示範用的 transformer,它將查找所有出現名稱 (``foo``) 並改寫為 " "``data['foo']``: ::" -#: ../../library/ast.rst:2359 +#: ../../library/ast.rst:2396 msgid "" "class RewriteName(NodeTransformer):\n" "\n" @@ -4144,16 +4217,16 @@ msgstr "" " ctx=node.ctx\n" " )" -#: ../../library/ast.rst:2368 +#: ../../library/ast.rst:2405 msgid "" "Keep in mind that if the node you're operating on has child nodes you must " -"either transform the child nodes yourself or call the :meth:`~ast." -"NodeVisitor.generic_visit` method for the node first." +"either transform the child nodes yourself or call " +"the :meth:`~ast.NodeVisitor.generic_visit` method for the node first." msgstr "" -"請記住,如果你正在操作的節點有子節點,你必須自己轉換子節點或先呼叫該節點的 :" -"meth:`~ast.NodeVisitor.generic_visit` 方法。" +"請記住,如果你正在操作的節點有子節點,你必須自己轉換子節點或先呼叫該節點" +"的 :meth:`~ast.NodeVisitor.generic_visit` 方法。" -#: ../../library/ast.rst:2372 +#: ../../library/ast.rst:2409 msgid "" "For nodes that were part of a collection of statements (that applies to all " "statement nodes), the visitor may also return a list of nodes rather than " @@ -4162,18 +4235,18 @@ msgstr "" "對於屬於陳述式總集 (collection) 一部分的節點(適用於所有陳述式節點),瀏覽者" "還可以回傳節點串列,而不僅僅是單個節點。" -#: ../../library/ast.rst:2376 +#: ../../library/ast.rst:2413 msgid "" "If :class:`NodeTransformer` introduces new nodes (that weren't part of " -"original tree) without giving them location information (such as :attr:`~ast." -"AST.lineno`), :func:`fix_missing_locations` should be called with the new " -"sub-tree to recalculate the location information::" +"original tree) without giving them location information (such " +"as :attr:`~ast.AST.lineno`), :func:`fix_missing_locations` should be called " +"with the new sub-tree to recalculate the location information::" msgstr "" "如果 :class:`NodeTransformer` 引進了新節點(不屬於原始樹的一部分),但沒有給" -"它們提供位置資訊(例如 :attr:`~ast.AST.lineno`\\ ),則應使用新的子樹呼叫 :" -"func:`fix_missing_locations` 以重新計算位置資訊: ::" +"它們提供位置資訊(例如 :attr:`~ast.AST.lineno`\\ ),則應使用新的子樹呼" +"叫 :func:`fix_missing_locations` 以重新計算位置資訊: ::" -#: ../../library/ast.rst:2381 +#: ../../library/ast.rst:2418 msgid "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" @@ -4181,15 +4254,15 @@ msgstr "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" -#: ../../library/ast.rst:2384 +#: ../../library/ast.rst:2421 msgid "Usually you use the transformer like this::" msgstr "你通常會像這樣使用 transformer: ::" -#: ../../library/ast.rst:2386 +#: ../../library/ast.rst:2423 msgid "node = YourTransformer().visit(node)" msgstr "node = YourTransformer().visit(node)" -#: ../../library/ast.rst:2391 +#: ../../library/ast.rst:2428 msgid "" "Return a formatted dump of the tree in *node*. This is mainly useful for " "debugging purposes. If *annotate_fields* is true (by default), the returned " @@ -4205,7 +4278,7 @@ msgstr "" "潔。預設情況下,不會傾印列號和行偏移量等屬性。如果需要,可以設定 " "*include_attributes* 為 true。" -#: ../../library/ast.rst:2399 +#: ../../library/ast.rst:2436 msgid "" "If *indent* is a non-negative integer or string, then the tree will be " "pretty-printed with that indent level. An indent level of 0, negative, or " @@ -4219,7 +4292,7 @@ msgstr "" "(預設值)代表選擇單列表示。使用正整數縮排可以在每個級別縮排相同數量的空格。" "如果 *indent* 是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個級別。" -#: ../../library/ast.rst:2406 +#: ../../library/ast.rst:2443 msgid "" "If *show_empty* is ``False`` (the default), empty lists and fields that are " "``None`` will be omitted from the output." @@ -4227,15 +4300,15 @@ msgstr "" "如果 *show_empty* 為 ``False`` (預設值),則輸出中將省略 ``False`` 的空串列" "和欄位。" -#: ../../library/ast.rst:2409 +#: ../../library/ast.rst:2446 msgid "Added the *indent* option." msgstr "新增 *indent* 選項。" -#: ../../library/ast.rst:2412 +#: ../../library/ast.rst:2449 msgid "Added the *show_empty* option." msgstr "新增 *show_empty* 選項。" -#: ../../library/ast.rst:2415 +#: ../../library/ast.rst:2452 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -4287,17 +4360,17 @@ msgstr "" " type_params=[])],\n" " type_ignores=[])" -#: ../../library/ast.rst:2446 +#: ../../library/ast.rst:2483 msgid "Compiler Flags" msgstr "編譯器旗標" -#: ../../library/ast.rst:2448 +#: ../../library/ast.rst:2485 msgid "" "The following flags may be passed to :func:`compile` in order to change " "effects on the compilation of a program:" msgstr "可以將以下旗標傳遞給 :func:`compile` 以變更對程式的編譯效果:" -#: ../../library/ast.rst:2453 +#: ../../library/ast.rst:2490 msgid "" "Enables support for top-level ``await``, ``async for``, ``async with`` and " "async comprehensions." @@ -4305,21 +4378,21 @@ msgstr "" "啟用對最高階 ``await``、``async for``、``async with`` 和非同步綜合運算的支" "援。" -#: ../../library/ast.rst:2460 +#: ../../library/ast.rst:2497 msgid "" "Generates and returns an abstract syntax tree instead of returning a " "compiled code object." msgstr "生成並回傳抽象語法樹,而不是回傳已編譯的程式碼物件。" -#: ../../library/ast.rst:2465 +#: ../../library/ast.rst:2502 msgid "" -"The returned AST is optimized according to the *optimize* argument in :func:" -"`compile` or :func:`ast.parse`." +"The returned AST is optimized according to the *optimize* argument " +"in :func:`compile` or :func:`ast.parse`." msgstr "" "回傳的 AST 會根據 :func:`compile` 或 :func:`ast.parse` 中的 *optimize* 引數進" "行最佳化。" -#: ../../library/ast.rst:2472 +#: ../../library/ast.rst:2509 msgid "" "Enables support for :pep:`484` and :pep:`526` style type comments (``# type: " "``, ``# type: ignore ``)." @@ -4327,47 +4400,47 @@ msgstr "" "啟用對 :pep:`484` 和 :pep:`526` 樣式型別註釋的支援 (``# type: ``, ``# " "type: ignore ``)。" -#: ../../library/ast.rst:2481 +#: ../../library/ast.rst:2518 msgid "Command-Line Usage" msgstr "命令列用法" -#: ../../library/ast.rst:2485 +#: ../../library/ast.rst:2522 msgid "" "The :mod:`ast` module can be executed as a script from the command line. It " "is as simple as:" msgstr ":mod:`ast` 模組可以作為腳本從命令列執行,可以像這樣簡單地做到:" -#: ../../library/ast.rst:2488 +#: ../../library/ast.rst:2525 msgid "python -m ast [-m ] [-a] [infile]" msgstr "python -m ast [-m ] [-a] [infile]" -#: ../../library/ast.rst:2492 +#: ../../library/ast.rst:2529 msgid "The following options are accepted:" msgstr "以下選項可被接受:" -#: ../../library/ast.rst:2498 +#: ../../library/ast.rst:2535 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/ast.rst:2503 +#: ../../library/ast.rst:2540 msgid "" -"Specify what kind of code must be compiled, like the *mode* argument in :" -"func:`parse`." +"Specify what kind of code must be compiled, like the *mode* argument " +"in :func:`parse`." msgstr "指定必須編譯哪種類型的程式碼,像是 :func:`parse` 中的 *mode* 引數。" -#: ../../library/ast.rst:2508 +#: ../../library/ast.rst:2545 msgid "Don't parse type comments." msgstr "不要剖析型別註解。" -#: ../../library/ast.rst:2512 +#: ../../library/ast.rst:2549 msgid "Include attributes such as line numbers and column offsets." msgstr "包括列號和行偏移量等屬性。" -#: ../../library/ast.rst:2517 +#: ../../library/ast.rst:2554 msgid "Indentation of nodes in AST (number of spaces)." msgstr "AST 中節點的縮進(空格數)。" -#: ../../library/ast.rst:2519 +#: ../../library/ast.rst:2556 msgid "" "If :file:`infile` is specified its contents are parsed to AST and dumped to " "stdout. Otherwise, the content is read from stdin." @@ -4375,7 +4448,7 @@ msgstr "" "如果指定了 :file:`infile`,則其內容將被剖析為 AST 並傾印 (dump) 到 stdout。否" "則會從 stdin 讀取內容。" -#: ../../library/ast.rst:2525 +#: ../../library/ast.rst:2562 msgid "" "`Green Tree Snakes `_, an external " "documentation resource, has good details on working with Python ASTs." @@ -4383,7 +4456,7 @@ msgstr "" "`Green Tree Snakes `_ 是一個外部文件" "資源,提供了有關使用 Python AST 的詳細資訊。" -#: ../../library/ast.rst:2528 +#: ../../library/ast.rst:2565 msgid "" "`ASTTokens `_ " "annotates Python ASTs with the positions of tokens and text in the source " @@ -4394,7 +4467,7 @@ msgstr "" "用生成它們的原始碼中的標記和文本的位置來註釋 Python AST。這對於進行原始碼轉換" "的工具很有幫助。" -#: ../../library/ast.rst:2533 +#: ../../library/ast.rst:2570 msgid "" "`leoAst.py `_ unifies the token-based and parse-tree-based views of python programs " @@ -4404,7 +4477,7 @@ msgstr "" "py>`_ 透過在 token 和 ast 節點之間插入雙向鏈結,統一了 python 程式的基於 " "token 和基於剖析樹的視圖。" -#: ../../library/ast.rst:2538 +#: ../../library/ast.rst:2575 msgid "" "`LibCST `_ parses code as a Concrete Syntax " "Tree that looks like an ast tree and keeps all formatting details. It's " @@ -4414,7 +4487,7 @@ msgstr "" "(Concrete Syntax Tree),看起來像 ast 樹並保留所有格式詳細資訊。它對於建置自動" "重構 (codemod) 應用程式和 linter 非常有用。" -#: ../../library/ast.rst:2543 +#: ../../library/ast.rst:2580 msgid "" "`Parso `_ is a Python parser that supports " "error recovery and round-trip parsing for different Python versions (in " diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index e90baed76d..fe2e0e3861 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-10 00:14+0000\n" +"POT-Creation-Date: 2025-04-15 00:15+0000\n" "PO-Revision-Date: 2022-02-20 12:36+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -94,8 +94,8 @@ msgid "" "If there is no running event loop set, the function will return the result " "of the ``get_event_loop_policy().get_event_loop()`` call." msgstr "" -"如果沒有設定正在運行的事件迴圈,該函式將回傳 " -"``get_event_loop_policy().get_event_loop()`` 呼叫的結果。" +"如果沒有設定正在運行的事件迴圈,該函式將回傳 ``get_event_loop_policy()." +"get_event_loop()`` 呼叫的結果。" #: ../../library/asyncio-eventloop.rst:53 msgid "" @@ -104,8 +104,8 @@ msgid "" "is preferred to :func:`get_event_loop` in coroutines and callbacks." msgstr "" "由於此函式具有相當複雜的行為(尤其是在使用自訂事件迴圈策略時),在協程和回呼" -"函式中,建議使用 :func:`get_running_loop` 函式,而不" -"是 :func:`get_event_loop`。" +"函式中,建議使用 :func:`get_running_loop` 函式,而不是 :func:" +"`get_event_loop`。" #: ../../library/asyncio-eventloop.rst:58 msgid "" @@ -138,9 +138,9 @@ msgid "" "and :func:`new_event_loop` functions can be altered by :ref:`setting a " "custom event loop policy `." msgstr "" -"請注意 :func:`get_event_loop`、:func:`set_event_loop` " -"和 :func:`new_event_loop` 函式的行為可以透過\\ :ref:`設定自訂事件迴圈策略 " -"`\\ 進行調整。" +"請注意 :func:`get_event_loop`、:func:`set_event_loop` 和 :func:" +"`new_event_loop` 函式的行為可以透過\\ :ref:`設定自訂事件迴圈策略 `\\ 進行調整。" #: ../../library/asyncio-eventloop.rst:80 msgid "Contents" @@ -159,29 +159,29 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:86 msgid "" -"The `Callback Handles`_ section documents the :class:`Handle` " -"and :class:`TimerHandle` instances which are returned from scheduling " -"methods such as :meth:`loop.call_soon` and :meth:`loop.call_later`;" +"The `Callback Handles`_ section documents the :class:`Handle` and :class:" +"`TimerHandle` instances which are returned from scheduling methods such as :" +"meth:`loop.call_soon` and :meth:`loop.call_later`;" msgstr "" -"`回呼處理 `_\\ 章節記錄了從排程方法" -"(如 :meth:`loop.call_soon` 和 :meth:`loop.call_later`)回傳" -"的 :class:`Handle` 和 :class:`TimerHandle` 實例;" +"`回呼處理 `_\\ 章節記錄了從排程方法(如 :meth:`loop." +"call_soon` 和 :meth:`loop.call_later`)回傳的 :class:`Handle` 和 :class:" +"`TimerHandle` 實例;" #: ../../library/asyncio-eventloop.rst:90 msgid "" "The `Server Objects`_ section documents types returned from event loop " "methods like :meth:`loop.create_server`;" msgstr "" -"`Server 物件 `_\\ 章節記錄了從事件迴圈方法" -"(如 :meth:`loop.create_server`)回傳的資料型別;" +"`Server 物件 `_\\ 章節記錄了從事件迴圈方法(如 :meth:`loop." +"create_server`)回傳的資料型別;" #: ../../library/asyncio-eventloop.rst:93 msgid "" -"The `Event Loop Implementations`_ section documents " -"the :class:`SelectorEventLoop` and :class:`ProactorEventLoop` classes;" +"The `Event Loop Implementations`_ section documents the :class:" +"`SelectorEventLoop` and :class:`ProactorEventLoop` classes;" msgstr "" -"`事件迴圈實作 `_\\ 章節記錄" -"了 :class:`SelectorEventLoop` 和 :class:`ProactorEventLoop` 類別;" +"`事件迴圈實作 `_\\ 章節記錄了 :class:" +"`SelectorEventLoop` 和 :class:`ProactorEventLoop` 類別;" #: ../../library/asyncio-eventloop.rst:96 msgid "" @@ -209,8 +209,8 @@ msgid "" "If the argument is a :ref:`coroutine object ` it is implicitly " "scheduled to run as a :class:`asyncio.Task`." msgstr "" -"如果引數是\\ :ref:`協程物件 `,則它將被隱式排程" -"為 :class:`asyncio.Task` 運行。" +"如果引數是\\ :ref:`協程物件 `,則它將被隱式排程為 :class:`asyncio." +"Task` 運行。" #: ../../library/asyncio-eventloop.rst:123 msgid "Return the Future's result or raise its exception." @@ -277,7 +277,7 @@ msgid "" "called after the event loop is closed." msgstr "此方法是冪等且不可逆的。在事件迴圈關閉後不應呼叫其他方法。" -#: ../../library/asyncio-eventloop.rst:167 +#: ../../library/asyncio-eventloop.rst:168 msgid "" "Schedule all currently open :term:`asynchronous generator` objects to close " "with an :meth:`~agen.aclose` call. After calling this method, the event " @@ -288,19 +288,19 @@ msgstr "" "用 :meth:`~agen.aclose` 呼叫來關閉。呼叫此方法後,如果疊代新的非同步產生器," "事件迴圈將發出警告。應該使用此方法可靠地完成所有已排程的非同步產生器。" -#: ../../library/asyncio-eventloop.rst:173 +#: ../../library/asyncio-eventloop.rst:174 msgid "" "Note that there is no need to call this function when :func:`asyncio.run` is " "used." msgstr "請注意,使用 :func:`asyncio.run` 時不需要呼叫此函式。" -#: ../../library/asyncio-eventloop.rst:176 -#: ../../library/asyncio-eventloop.rst:1278 -#: ../../library/asyncio-eventloop.rst:1721 +#: ../../library/asyncio-eventloop.rst:177 +#: ../../library/asyncio-eventloop.rst:1301 +#: ../../library/asyncio-eventloop.rst:1750 msgid "Example::" msgstr "範例: ::" -#: ../../library/asyncio-eventloop.rst:178 +#: ../../library/asyncio-eventloop.rst:179 msgid "" "try:\n" " loop.run_forever()\n" @@ -314,19 +314,18 @@ msgstr "" " loop.run_until_complete(loop.shutdown_asyncgens())\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:188 +#: ../../library/asyncio-eventloop.rst:190 msgid "" "Schedule the closure of the default executor and wait for it to join all of " "the threads in the :class:`~concurrent.futures.ThreadPoolExecutor`. Once " -"this method has been called, using the default executor " -"with :meth:`loop.run_in_executor` will raise a :exc:`RuntimeError`." +"this method has been called, using the default executor with :meth:`loop." +"run_in_executor` will raise a :exc:`RuntimeError`." msgstr "" -"排程預設執行器的關閉,並等待它加" -"入 :class:`~concurrent.futures.ThreadPoolExecutor` 中的所有執行緒。一旦呼叫了" -"此方法,使用預設執行器與 :meth:`loop.run_in_executor` 將引" -"發 :exc:`RuntimeError`。" +"排程預設執行器的關閉,並等待它加入 :class:`~concurrent.futures." +"ThreadPoolExecutor` 中的所有執行緒。一旦呼叫了此方法,使用預設執行器與 :meth:" +"`loop.run_in_executor` 將引發 :exc:`RuntimeError`。" -#: ../../library/asyncio-eventloop.rst:194 +#: ../../library/asyncio-eventloop.rst:196 msgid "" "The *timeout* parameter specifies the amount of time (in :class:`float` " "seconds) the executor will be given to finish joining. With the default, " @@ -335,7 +334,7 @@ msgstr "" "*timeout* 參數指定執行器完成加入所需的時間(以 :class:`float` 秒為單位)。預" "設情況下為 ``None``,不會限制執行器所花費的時間。" -#: ../../library/asyncio-eventloop.rst:199 +#: ../../library/asyncio-eventloop.rst:201 msgid "" "If the *timeout* is reached, a :exc:`RuntimeWarning` is emitted and the " "default executor is terminated without waiting for its threads to finish " @@ -344,7 +343,7 @@ msgstr "" "如果達到 *timeout*,將發出 :exc:`RuntimeWarning` 警告,預設執行器將立即終止," "不等待其執行緒完成加入。" -#: ../../library/asyncio-eventloop.rst:205 +#: ../../library/asyncio-eventloop.rst:207 msgid "" "Do not call this method when using :func:`asyncio.run`, as the latter " "handles default executor shutdown automatically." @@ -352,48 +351,47 @@ msgstr "" "使用 :func:`asyncio.run` 時請勿呼叫此方法,因為後者會自動處理預設執行器的關" "閉。" -#: ../../library/asyncio-eventloop.rst:210 +#: ../../library/asyncio-eventloop.rst:212 msgid "Added the *timeout* parameter." msgstr "加入 *timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:214 +#: ../../library/asyncio-eventloop.rst:216 msgid "Scheduling callbacks" msgstr "排程回呼函式" -#: ../../library/asyncio-eventloop.rst:218 +#: ../../library/asyncio-eventloop.rst:220 msgid "" "Schedule the *callback* :term:`callback` to be called with *args* arguments " "at the next iteration of the event loop." msgstr "" "在事件迴圈的下一次疊代中排程以 *args* 引數呼叫 *callback* :term:`callback`。" -#: ../../library/asyncio-eventloop.rst:221 +#: ../../library/asyncio-eventloop.rst:223 msgid "" "Return an instance of :class:`asyncio.Handle`, which can be used later to " "cancel the callback." msgstr "回傳 :class:`asyncio.Handle` 的實例,稍後可以用於取消回呼函式。" -#: ../../library/asyncio-eventloop.rst:224 +#: ../../library/asyncio-eventloop.rst:226 msgid "" "Callbacks are called in the order in which they are registered. Each " "callback will be called exactly once." msgstr "回呼函式按照其註冊的順序呼叫。每個回呼函式將被呼叫恰好一次。" -#: ../../library/asyncio-eventloop.rst:227 +#: ../../library/asyncio-eventloop.rst:229 msgid "" -"The optional keyword-only *context* argument specifies a " -"custom :class:`contextvars.Context` for the *callback* to run in. Callbacks " -"use the current context when no *context* is provided." +"The optional keyword-only *context* argument specifies a custom :class:" +"`contextvars.Context` for the *callback* to run in. Callbacks use the " +"current context when no *context* is provided." msgstr "" -"選用的僅限關鍵字引數 *context* 指定了要給 *callback* 執行的自定" -"義 :class:`contextvars.Context`。當未提供 *context* 時,回呼函式使用目前情" -"境。" +"選用的僅限關鍵字引數 *context* 指定了要給 *callback* 執行的自定義 :class:" +"`contextvars.Context`。當未提供 *context* 時,回呼函式使用目前情境。" -#: ../../library/asyncio-eventloop.rst:231 +#: ../../library/asyncio-eventloop.rst:233 msgid "Unlike :meth:`call_soon_threadsafe`, this method is not thread-safe." msgstr "與 :meth:`call_soon_threadsafe` 不同,此方法不是執行緒安全的。" -#: ../../library/asyncio-eventloop.rst:235 +#: ../../library/asyncio-eventloop.rst:237 msgid "" "A thread-safe variant of :meth:`call_soon`. When scheduling callbacks from " "another thread, this function *must* be used, since :meth:`call_soon` is not " @@ -402,14 +400,14 @@ msgstr "" "這是 :meth:`call_soon` 的執行緒安全變體。當從另一個執行緒排程回呼函式時,*必" "須*\\ 使用此函式,因為 :meth:`call_soon` 不是執行緒安全的。" -#: ../../library/asyncio-eventloop.rst:239 +#: ../../library/asyncio-eventloop.rst:241 msgid "" "This function is safe to be called from a reentrant context or signal " "handler, however, it is not safe or fruitful to use the returned handle in " "such contexts." msgstr "" -#: ../../library/asyncio-eventloop.rst:242 +#: ../../library/asyncio-eventloop.rst:244 msgid "" "Raises :exc:`RuntimeError` if called on a loop that's been closed. This can " "happen on a secondary thread when the main application is shutting down." @@ -417,21 +415,21 @@ msgstr "" "如果在已關閉的迴圈上呼叫,則引發 :exc:`RuntimeError`。在主應用程式關閉時,這" "可能發生在次要執行緒上。" -#: ../../library/asyncio-eventloop.rst:246 +#: ../../library/asyncio-eventloop.rst:248 msgid "" "See the :ref:`concurrency and multithreading ` " "section of the documentation." msgstr "請參閱文件的\\ :ref:`並行和多執行緒 `\\ 部分。" -#: ../../library/asyncio-eventloop.rst:249 -#: ../../library/asyncio-eventloop.rst:299 -#: ../../library/asyncio-eventloop.rst:319 +#: ../../library/asyncio-eventloop.rst:251 +#: ../../library/asyncio-eventloop.rst:301 +#: ../../library/asyncio-eventloop.rst:321 msgid "" "The *context* keyword-only parameter was added. See :pep:`567` for more " "details." msgstr "新增了 *context* 僅限關鍵字參數。詳細資訊請參閱 :pep:`567`。" -#: ../../library/asyncio-eventloop.rst:257 +#: ../../library/asyncio-eventloop.rst:259 msgid "" "Most :mod:`asyncio` scheduling functions don't allow passing keyword " "arguments. To do that, use :func:`functools.partial`::" @@ -439,7 +437,7 @@ msgstr "" "大多數 :mod:`asyncio` 排程函式不允許傳遞關鍵字引數。要傳遞關鍵字引數,請使" "用 :func:`functools.partial`: ::" -#: ../../library/asyncio-eventloop.rst:260 +#: ../../library/asyncio-eventloop.rst:262 msgid "" "# will schedule \"print(\"Hello\", flush=True)\"\n" "loop.call_soon(\n" @@ -449,7 +447,7 @@ msgstr "" "loop.call_soon(\n" " functools.partial(print, \"Hello\", flush=True))" -#: ../../library/asyncio-eventloop.rst:264 +#: ../../library/asyncio-eventloop.rst:266 msgid "" "Using partial objects is usually more convenient than using lambdas, as " "asyncio can render partial objects better in debug and error messages." @@ -457,11 +455,11 @@ msgstr "" "通常使用 partial 物件比使用 lambda 更方便,因為 asyncio 可以在除錯和錯誤訊息" "中更好地呈現 partial 物件。" -#: ../../library/asyncio-eventloop.rst:272 +#: ../../library/asyncio-eventloop.rst:274 msgid "Scheduling delayed callbacks" msgstr "排程延遲的回呼函式" -#: ../../library/asyncio-eventloop.rst:274 +#: ../../library/asyncio-eventloop.rst:276 msgid "" "Event loop provides mechanisms to schedule callback functions to be called " "at some point in the future. Event loop uses monotonic clocks to track time." @@ -469,20 +467,20 @@ msgstr "" "事件迴圈提供為回呼函式排程在將來某個時間點才呼叫的機制。事件迴圈使用了單調時" "鐘來追蹤時間。" -#: ../../library/asyncio-eventloop.rst:281 +#: ../../library/asyncio-eventloop.rst:283 msgid "" "Schedule *callback* to be called after the given *delay* number of seconds " "(can be either an int or a float)." msgstr "排程 *callback* 在給定的 *delay* 秒數後呼叫(可以是整數或浮點數)。" -#: ../../library/asyncio-eventloop.rst:284 -#: ../../library/asyncio-eventloop.rst:316 +#: ../../library/asyncio-eventloop.rst:286 +#: ../../library/asyncio-eventloop.rst:318 msgid "" "An instance of :class:`asyncio.TimerHandle` is returned which can be used to " "cancel the callback." msgstr "回傳 :class:`asyncio.TimerHandle` 的實例,可用於取消回呼函式。" -#: ../../library/asyncio-eventloop.rst:287 +#: ../../library/asyncio-eventloop.rst:289 msgid "" "*callback* will be called exactly once. If two callbacks are scheduled for " "exactly the same time, the order in which they are called is undefined." @@ -490,26 +488,25 @@ msgstr "" "*callback* 將只被呼叫恰好一次。如果有兩個回呼函式被排程在完全相同的時間,則其" "呼叫順序是不定的。" -#: ../../library/asyncio-eventloop.rst:291 +#: ../../library/asyncio-eventloop.rst:293 msgid "" "The optional positional *args* will be passed to the callback when it is " -"called. If you want the callback to be called with keyword arguments " -"use :func:`functools.partial`." +"called. If you want the callback to be called with keyword arguments use :" +"func:`functools.partial`." msgstr "" "可選的位置引數 *args* 將在呼叫回呼函式時傳遞。如果要使用關鍵字引數呼叫回呼函" "數,請使用 :func:`functools.partial`。" -#: ../../library/asyncio-eventloop.rst:295 +#: ../../library/asyncio-eventloop.rst:297 msgid "" -"An optional keyword-only *context* argument allows specifying a " -"custom :class:`contextvars.Context` for the *callback* to run in. The " -"current context is used when no *context* is provided." +"An optional keyword-only *context* argument allows specifying a custom :" +"class:`contextvars.Context` for the *callback* to run in. The current " +"context is used when no *context* is provided." msgstr "" -"可選的僅限關鍵字 *context* 引數允許為 *callback* 指定自定義" -"的 :class:`contextvars.Context` 以提供運行。當未提供 *context* 時,將使用目前" -"情境。" +"可選的僅限關鍵字 *context* 引數允許為 *callback* 指定自定義的 :class:" +"`contextvars.Context` 以提供運行。當未提供 *context* 時,將使用目前情境。" -#: ../../library/asyncio-eventloop.rst:303 +#: ../../library/asyncio-eventloop.rst:305 msgid "" "In Python 3.7 and earlier with the default event loop implementation, the " "*delay* could not exceed one day. This has been fixed in Python 3.8." @@ -517,19 +514,19 @@ msgstr "" "在 Python 3.7 及更早版本中,使用預設事件迴圈實作時,*delay* 不能超過一天。這" "在 Python 3.8 中已經修復。" -#: ../../library/asyncio-eventloop.rst:310 +#: ../../library/asyncio-eventloop.rst:312 msgid "" "Schedule *callback* to be called at the given absolute timestamp *when* (an " "int or a float), using the same time reference as :meth:`loop.time`." msgstr "" -"排程 *callback* 在給定的絕對時間戳 *when* (整數或浮點數)處呼叫,使用" -"與 :meth:`loop.time` 相同的時間參照。" +"排程 *callback* 在給定的絕對時間戳 *when* (整數或浮點數)處呼叫,使用與 :" +"meth:`loop.time` 相同的時間參照。" -#: ../../library/asyncio-eventloop.rst:314 +#: ../../library/asyncio-eventloop.rst:316 msgid "This method's behavior is the same as :meth:`call_later`." msgstr "此方法的行為與 :meth:`call_later` 相同。" -#: ../../library/asyncio-eventloop.rst:323 +#: ../../library/asyncio-eventloop.rst:325 msgid "" "In Python 3.7 and earlier with the default event loop implementation, the " "difference between *when* and the current time could not exceed one day. " @@ -538,13 +535,13 @@ msgstr "" "在 Python 3.7 及更早版本中,使用預設事件迴圈實作時,*when* 和目前時間之間的差" "值不能超過一天。這在 Python 3.8 中已經修復。" -#: ../../library/asyncio-eventloop.rst:330 +#: ../../library/asyncio-eventloop.rst:332 msgid "" "Return the current time, as a :class:`float` value, according to the event " "loop's internal monotonic clock." msgstr "根據事件迴圈的內部單調時鐘,回傳目前時間,以 :class:`float` 值表示。" -#: ../../library/asyncio-eventloop.rst:334 +#: ../../library/asyncio-eventloop.rst:336 msgid "" "In Python 3.7 and earlier timeouts (relative *delay* or absolute *when*) " "should not exceed one day. This has been fixed in Python 3.8." @@ -552,19 +549,19 @@ msgstr "" "在 Python 3.7 及更早版本中,超時(相對 *delay* 或絕對 *when*)不應超過一天。" "這在 Python 3.8 中已經修復。" -#: ../../library/asyncio-eventloop.rst:340 +#: ../../library/asyncio-eventloop.rst:342 msgid "The :func:`asyncio.sleep` function." msgstr "函式 :func:`asyncio.sleep`。" -#: ../../library/asyncio-eventloop.rst:344 +#: ../../library/asyncio-eventloop.rst:346 msgid "Creating Futures and Tasks" msgstr "建立 Futures 和 Tasks" -#: ../../library/asyncio-eventloop.rst:348 +#: ../../library/asyncio-eventloop.rst:350 msgid "Create an :class:`asyncio.Future` object attached to the event loop." msgstr "建立附加到事件迴圈的 :class:`asyncio.Future` 物件。" -#: ../../library/asyncio-eventloop.rst:350 +#: ../../library/asyncio-eventloop.rst:352 msgid "" "This is the preferred way to create Futures in asyncio. This lets third-" "party event loops provide alternative implementations of the Future object " @@ -573,94 +570,94 @@ msgstr "" "這是在 asyncio 中建立 Futures 的首選方式。這允許第三方事件迴圈提供 Future 物" "件的替代實作(具有更好的性能或儀器計測表現)。" -#: ../../library/asyncio-eventloop.rst:358 +#: ../../library/asyncio-eventloop.rst:360 msgid "" -"Schedule the execution of :ref:`coroutine ` *coro*. Return " -"a :class:`Task` object." +"Schedule the execution of :ref:`coroutine ` *coro*. Return a :" +"class:`Task` object." msgstr "排程執行\\ :ref:`協程 ` *coro*。回傳 :class:`Task` 物件。" -#: ../../library/asyncio-eventloop.rst:361 +#: ../../library/asyncio-eventloop.rst:363 msgid "" "Third-party event loops can use their own subclass of :class:`Task` for " -"interoperability. In this case, the result type is a subclass " -"of :class:`Task`." +"interoperability. In this case, the result type is a subclass of :class:" +"`Task`." msgstr "" "第三方事件迴圈可以使用其自己的 :class:`Task` 子類別以實現互操作性" "(interoperability)。在這種情況下,結果類型是 :class:`Task` 的子類別。" -#: ../../library/asyncio-eventloop.rst:365 +#: ../../library/asyncio-eventloop.rst:367 msgid "" "If the *name* argument is provided and not ``None``, it is set as the name " "of the task using :meth:`Task.set_name`." msgstr "" -"如果提供了 *name* 引數且不為 ``None``,則將其設置為任務的名稱,使" -"用 :meth:`Task.set_name`。" +"如果提供了 *name* 引數且不為 ``None``,則將其設置為任務的名稱,使用 :meth:" +"`Task.set_name`。" -#: ../../library/asyncio-eventloop.rst:368 +#: ../../library/asyncio-eventloop.rst:370 msgid "" -"An optional keyword-only *context* argument allows specifying a " -"custom :class:`contextvars.Context` for the *coro* to run in. The current " -"context copy is created when no *context* is provided." +"An optional keyword-only *context* argument allows specifying a custom :" +"class:`contextvars.Context` for the *coro* to run in. The current context " +"copy is created when no *context* is provided." msgstr "" -"可選的僅限關鍵字 *context* 引數允許為 *coro* 指定自定義" -"的 :class:`contextvars.Context` 以提供運行。當未提供 *context* 時,將建立目前" -"情境的副本。" +"可選的僅限關鍵字 *context* 引數允許為 *coro* 指定自定義的 :class:" +"`contextvars.Context` 以提供運行。當未提供 *context* 時,將建立目前情境的副" +"本。" -#: ../../library/asyncio-eventloop.rst:372 +#: ../../library/asyncio-eventloop.rst:374 msgid "Added the *name* parameter." msgstr "加入 *name* 參數。" -#: ../../library/asyncio-eventloop.rst:375 +#: ../../library/asyncio-eventloop.rst:377 msgid "Added the *context* parameter." msgstr "加入 *context* 參數。" -#: ../../library/asyncio-eventloop.rst:380 +#: ../../library/asyncio-eventloop.rst:382 msgid "Set a task factory that will be used by :meth:`loop.create_task`." msgstr "設置將由 :meth:`loop.create_task` 使用的任務工廠。" -#: ../../library/asyncio-eventloop.rst:383 +#: ../../library/asyncio-eventloop.rst:385 msgid "" "If *factory* is ``None`` the default task factory will be set. Otherwise, " "*factory* must be a *callable* with the signature matching ``(loop, coro, " -"context=None)``, where *loop* is a reference to the active event loop, and " -"*coro* is a coroutine object. The callable must return " -"a :class:`asyncio.Future`-compatible object." +"**kwargs)``, where *loop* is a reference to the active event loop, and " +"*coro* is a coroutine object. The callable must pass on all *kwargs*, and " +"return a :class:`asyncio.Task`-compatible object." msgstr "" "如果 *factory* 為 ``None``,將設置預設的任務工廠。否則,*factory* 必須是一個" -"具有匹配簽名 ``(loop, coro, context=None)`` 的 *callable*,其中 *loop* 是有效" -"事件迴圈的參照,*coro* 是一個協程物件。該可呼叫物件必須回傳一個" -"與 :class:`asyncio.Future` 相容的物件。" +"具有匹配簽名 ``(loop, coro, **kwargs)`` 的 *callable*,其中 *loop* 是有效事件" +"迴圈的參照、*coro* 是一個協程物件。該可呼叫物件必須傳遞所有 *kwargs* 並回傳一" +"個與 :class:`asyncio.Task` 相容的物件。" -#: ../../library/asyncio-eventloop.rst:391 +#: ../../library/asyncio-eventloop.rst:393 msgid "Return a task factory or ``None`` if the default one is in use." msgstr "回傳任務工廠,如果使用預設任務工廠則回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:395 +#: ../../library/asyncio-eventloop.rst:397 msgid "Opening network connections" msgstr "打開網路連線" -#: ../../library/asyncio-eventloop.rst:406 +#: ../../library/asyncio-eventloop.rst:409 msgid "" "Open a streaming transport connection to a given address specified by *host* " "and *port*." msgstr "打開以 *host* 和 *port* 指定之給定地址的串流傳輸連線。" -#: ../../library/asyncio-eventloop.rst:409 +#: ../../library/asyncio-eventloop.rst:412 msgid "" -"The socket family can be either :py:const:`~socket.AF_INET` " -"or :py:const:`~socket.AF_INET6` depending on *host* (or the *family* " -"argument, if provided)." +"The socket family can be either :py:const:`~socket.AF_INET` or :py:const:" +"`~socket.AF_INET6` depending on *host* (or the *family* argument, if " +"provided)." msgstr "" -"根據 *host*(或提供的 *family* 引數)的情況,socket 家族可以" -"是 :py:const:`~socket.AF_INET` 或 :py:const:`~socket.AF_INET6`。" +"根據 *host*(或提供的 *family* 引數)的情況,socket 家族可以是 :py:const:" +"`~socket.AF_INET` 或 :py:const:`~socket.AF_INET6`。" -#: ../../library/asyncio-eventloop.rst:413 +#: ../../library/asyncio-eventloop.rst:416 msgid "The socket type will be :py:const:`~socket.SOCK_STREAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_STREAM`。" -#: ../../library/asyncio-eventloop.rst:415 -#: ../../library/asyncio-eventloop.rst:1189 -#: ../../library/asyncio-eventloop.rst:1205 +#: ../../library/asyncio-eventloop.rst:418 +#: ../../library/asyncio-eventloop.rst:1211 +#: ../../library/asyncio-eventloop.rst:1228 msgid "" "*protocol_factory* must be a callable returning an :ref:`asyncio protocol " "` implementation." @@ -668,70 +665,70 @@ msgstr "" "*protocol_factory* 必須是一個回傳 :ref:`asyncio protocol ` " "實作的可呼叫函式。" -#: ../../library/asyncio-eventloop.rst:418 +#: ../../library/asyncio-eventloop.rst:421 msgid "" "This method will try to establish the connection in the background. When " "successful, it returns a ``(transport, protocol)`` pair." msgstr "" "此方法將嘗試在背景建立連線。成功時,它將回傳一對 ``(transport, protocol)``。" -#: ../../library/asyncio-eventloop.rst:421 +#: ../../library/asyncio-eventloop.rst:424 msgid "The chronological synopsis of the underlying operation is as follows:" msgstr "底層操作的時間軸簡介如下:" -#: ../../library/asyncio-eventloop.rst:423 +#: ../../library/asyncio-eventloop.rst:426 msgid "" "The connection is established and a :ref:`transport ` is " "created for it." msgstr "建立連線並為其建立\\ :ref:`傳輸 `。" -#: ../../library/asyncio-eventloop.rst:426 +#: ../../library/asyncio-eventloop.rst:429 msgid "" -"*protocol_factory* is called without arguments and is expected to return " -"a :ref:`protocol ` instance." +"*protocol_factory* is called without arguments and is expected to return a :" +"ref:`protocol ` instance." msgstr "" "*protocol_factory* 在無引數的情況下被呼叫,並且預計回傳一個 :ref:`協定 " "` 實例。" -#: ../../library/asyncio-eventloop.rst:429 +#: ../../library/asyncio-eventloop.rst:432 msgid "" -"The protocol instance is coupled with the transport by calling " -"its :meth:`~BaseProtocol.connection_made` method." +"The protocol instance is coupled with the transport by calling its :meth:" +"`~BaseProtocol.connection_made` method." msgstr "" "通過呼叫其 :meth:`~BaseProtocol.connection_made` 方法,將協議實例與傳輸連線在" "一起。" -#: ../../library/asyncio-eventloop.rst:432 +#: ../../library/asyncio-eventloop.rst:435 msgid "A ``(transport, protocol)`` tuple is returned on success." msgstr "成功時回傳一個 ``(transport, protocol)`` 元組。" -#: ../../library/asyncio-eventloop.rst:434 +#: ../../library/asyncio-eventloop.rst:437 msgid "" "The created transport is an implementation-dependent bidirectional stream." msgstr "建立的傳輸是一個依賴實作的雙向串流。" -#: ../../library/asyncio-eventloop.rst:437 -#: ../../library/asyncio-eventloop.rst:569 +#: ../../library/asyncio-eventloop.rst:440 +#: ../../library/asyncio-eventloop.rst:573 msgid "Other arguments:" msgstr "其他引數:" -#: ../../library/asyncio-eventloop.rst:439 +#: ../../library/asyncio-eventloop.rst:442 msgid "" "*ssl*: if given and not false, a SSL/TLS transport is created (by default a " "plain TCP transport is created). If *ssl* is a :class:`ssl.SSLContext` " -"object, this context is used to create the transport; if *ssl* " -"is :const:`True`, a default context returned " -"from :func:`ssl.create_default_context` is used." +"object, this context is used to create the transport; if *ssl* is :const:" +"`True`, a default context returned from :func:`ssl.create_default_context` " +"is used." msgstr "" "若有給定 *ssl* 且非 false,將建立 SSL/TLS 傳輸(預設建立普通 TCP 傳輸)。如" "果 *ssl* 為 :class:`ssl.SSLContext` 物件,則使用該情境來建立傳輸;如果 *ssl* " "為 :const:`True`,則使用 :func:`ssl.create_default_context` 回傳的預設情境。" -#: ../../library/asyncio-eventloop.rst:445 +#: ../../library/asyncio-eventloop.rst:448 msgid ":ref:`SSL/TLS security considerations `" msgstr ":ref:`SSL/TLS 安全考量 `" -#: ../../library/asyncio-eventloop.rst:447 +#: ../../library/asyncio-eventloop.rst:450 msgid "" "*server_hostname* sets or overrides the hostname that the target server's " "certificate will be matched against. Should only be passed if *ssl* is not " @@ -746,7 +743,7 @@ msgstr "" "預設值,必須傳遞 *server_hostname* 的值。若 *server_hostname* 為空字串,將停" "用主機名稱匹配(這是一個嚴重的安全風險,可能導致中間人攻擊)。" -#: ../../library/asyncio-eventloop.rst:455 +#: ../../library/asyncio-eventloop.rst:458 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to getaddrinfo() for *host* resolution. If given, " @@ -757,7 +754,7 @@ msgstr "" "getaddrinfo() 進行 *host* 解析。若有給定這些應該都是相應 :mod:`socket` 模組常" "數的整數。" -#: ../../library/asyncio-eventloop.rst:460 +#: ../../library/asyncio-eventloop.rst:463 msgid "" "*happy_eyeballs_delay*, if given, enables Happy Eyeballs for this " "connection. It should be a floating-point number representing the amount of " @@ -767,11 +764,11 @@ msgid "" "the RFC is ``0.25`` (250 milliseconds)." msgstr "" "若有給定,*happy_eyeballs_delay* 會啟用此連線的 Happy Eyeballs。它應該是一個" -"浮點數,表示等待連線嘗試完成的秒數,然後在並行啟動下一次嘗試。這" -"是 :rfc:`8305` 中定義的「連線嘗試延遲」。RFC 建議的合理預設值為 ``0.25`` 秒" -"(250 毫秒)。" +"浮點數,表示等待連線嘗試完成的秒數,然後在並行啟動下一次嘗試。這是 :rfc:" +"`8305` 中定義的「連線嘗試延遲」。RFC 建議的合理預設值為 ``0.25`` 秒(250 毫" +"秒)。" -#: ../../library/asyncio-eventloop.rst:468 +#: ../../library/asyncio-eventloop.rst:471 msgid "" "*interleave* controls address reordering when a host name resolves to " "multiple IP addresses. If ``0`` or unspecified, no reordering is done, and " @@ -787,29 +784,29 @@ msgstr "" "族計數」。如果未指定 *happy_eyeballs_delay*,則預設值為 ``0``,如果指定則為 " "``1``。" -#: ../../library/asyncio-eventloop.rst:477 +#: ../../library/asyncio-eventloop.rst:480 msgid "" -"*sock*, if given, should be an existing, already " -"connected :class:`socket.socket` object to be used by the transport. If " -"*sock* is given, none of *host*, *port*, *family*, *proto*, *flags*, " -"*happy_eyeballs_delay*, *interleave* and *local_addr* should be specified." +"*sock*, if given, should be an existing, already connected :class:`socket." +"socket` object to be used by the transport. If *sock* is given, none of " +"*host*, *port*, *family*, *proto*, *flags*, *happy_eyeballs_delay*, " +"*interleave* and *local_addr* should be specified." msgstr "" "若有給定 *sock* 則其應為已存在且已連線的 :class:`socket.socket` 物件,可供傳" "輸使用。如果提供了 *sock*,則不應指定 *host*、*port*、*family*、*proto*、" "*flags*、*happy_eyeballs_delay*、*interleave* 和 *local_addr* 中的任何一項。" -#: ../../library/asyncio-eventloop.rst:485 -#: ../../library/asyncio-eventloop.rst:600 -#: ../../library/asyncio-eventloop.rst:844 +#: ../../library/asyncio-eventloop.rst:488 +#: ../../library/asyncio-eventloop.rst:604 +#: ../../library/asyncio-eventloop.rst:852 msgid "" "The *sock* argument transfers ownership of the socket to the transport " -"created. To close the socket, call the " -"transport's :meth:`~asyncio.BaseTransport.close` method." +"created. To close the socket, call the transport's :meth:`~asyncio." +"BaseTransport.close` method." msgstr "" -"引數 *sock* 將 socket 所有權轉移給所建立的傳輸 socket,請呼叫傳輸" -"的 :meth:`~asyncio.BaseTransport.close` 方法。" +"引數 *sock* 將 socket 所有權轉移給所建立的傳輸 socket,請呼叫傳輸的 :meth:" +"`~asyncio.BaseTransport.close` 方法。" -#: ../../library/asyncio-eventloop.rst:489 +#: ../../library/asyncio-eventloop.rst:492 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " "the socket locally. The *local_host* and *local_port* are looked up using " @@ -819,8 +816,8 @@ msgstr "" "地綁定 socket。將使用 ``getaddrinfo()`` 查找 *local_host* 和 *local_port*,方" "式類似於 *host* 和 *port*。" -#: ../../library/asyncio-eventloop.rst:493 -#: ../../library/asyncio-eventloop.rst:938 +#: ../../library/asyncio-eventloop.rst:496 +#: ../../library/asyncio-eventloop.rst:948 msgid "" "*ssl_handshake_timeout* is (for a TLS connection) the time in seconds to " "wait for the TLS handshake to complete before aborting the connection. " @@ -830,10 +827,10 @@ msgstr "" "在那之前若未完成則會中斷連線。如果為 ``None`` (預設值),則會等待 ``60.0`` " "秒。" -#: ../../library/asyncio-eventloop.rst:497 -#: ../../library/asyncio-eventloop.rst:753 -#: ../../library/asyncio-eventloop.rst:855 -#: ../../library/asyncio-eventloop.rst:942 +#: ../../library/asyncio-eventloop.rst:500 +#: ../../library/asyncio-eventloop.rst:759 +#: ../../library/asyncio-eventloop.rst:863 +#: ../../library/asyncio-eventloop.rst:952 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " @@ -842,7 +839,7 @@ msgstr "" "*ssl_shutdown_timeout* 是等待 SSL 關閉完成以前中斷連線的時間,以秒為單位。如" "果為 ``None`` (預設值),則會等待 ``30.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:501 +#: ../../library/asyncio-eventloop.rst:504 msgid "" "*all_errors* determines what exceptions are raised when a connection cannot " "be created. By default, only a single ``Exception`` is raised: the first " @@ -856,12 +853,12 @@ msgstr "" "包含所有錯誤訊息的單一 ``OSError``。當 ``all_errors`` 為 ``True`` 時,將引發" "包含所有例外的 ``ExceptionGroup`` (即使只有一個例外)。" -#: ../../library/asyncio-eventloop.rst:511 -#: ../../library/asyncio-eventloop.rst:765 +#: ../../library/asyncio-eventloop.rst:514 +#: ../../library/asyncio-eventloop.rst:771 msgid "Added support for SSL/TLS in :class:`ProactorEventLoop`." msgstr "新增 :class:`ProactorEventLoop` 中的 SSL/TLS 支援。" -#: ../../library/asyncio-eventloop.rst:515 +#: ../../library/asyncio-eventloop.rst:518 msgid "" "The socket option :ref:`socket.TCP_NODELAY ` is set " "by default for all TCP connections." @@ -869,16 +866,16 @@ msgstr "" "所有 TCP 連線都預設有 :ref:`socket.TCP_NODELAY ` " "socket 選項。" -#: ../../library/asyncio-eventloop.rst:520 -#: ../../library/asyncio-eventloop.rst:865 +#: ../../library/asyncio-eventloop.rst:523 +#: ../../library/asyncio-eventloop.rst:873 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "增加 *ssl_handshake_timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:524 +#: ../../library/asyncio-eventloop.rst:527 msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." msgstr "加入 *happy_eyeballs_delay* 和 *interleave* 參數。" -#: ../../library/asyncio-eventloop.rst:526 +#: ../../library/asyncio-eventloop.rst:529 msgid "" "Happy Eyeballs Algorithm: Success with Dual-Stack Hosts. When a server's " "IPv4 path and protocol are working, but the server's IPv6 path and protocol " @@ -894,55 +891,53 @@ msgstr "" "用戶端的使用者體驗變差。本文件具體說明了減少此用戶可見延遲的演算法要求並提供" "了一種演算法。" -#: ../../library/asyncio-eventloop.rst:535 +#: ../../library/asyncio-eventloop.rst:538 msgid "For more information: https://datatracker.ietf.org/doc/html/rfc6555" msgstr "更多資訊請見: https://datatracker.ietf.org/doc/html/rfc6555" -#: ../../library/asyncio-eventloop.rst:539 -#: ../../library/asyncio-eventloop.rst:663 -#: ../../library/asyncio-eventloop.rst:779 -#: ../../library/asyncio-eventloop.rst:818 -#: ../../library/asyncio-eventloop.rst:869 -#: ../../library/asyncio-eventloop.rst:950 +#: ../../library/asyncio-eventloop.rst:542 +#: ../../library/asyncio-eventloop.rst:668 +#: ../../library/asyncio-eventloop.rst:785 +#: ../../library/asyncio-eventloop.rst:825 +#: ../../library/asyncio-eventloop.rst:877 +#: ../../library/asyncio-eventloop.rst:960 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "增加 *ssl_shutdown_timeout* 參數。" -#: ../../library/asyncio-eventloop.rst:541 +#: ../../library/asyncio-eventloop.rst:544 msgid "*all_errors* was added." msgstr "已新增 *all_errors*。" -#: ../../library/asyncio-eventloop.rst:546 +#: ../../library/asyncio-eventloop.rst:549 msgid "" "The :func:`open_connection` function is a high-level alternative API. It " "returns a pair of (:class:`StreamReader`, :class:`StreamWriter`) that can be " "used directly in async/await code." msgstr "" -"函式 :func:`open_connection` 是高階的替代 API。它回傳一對 " -"(:class:`StreamReader`, :class:`StreamWriter`) 可直接在 async/await 程式碼中" -"使用。" +"函式 :func:`open_connection` 是高階的替代 API。它回傳一對 (:class:" +"`StreamReader`, :class:`StreamWriter`) 可直接在 async/await 程式碼中使用。" -#: ../../library/asyncio-eventloop.rst:556 +#: ../../library/asyncio-eventloop.rst:560 msgid "Create a datagram connection." msgstr "建立一個資料報連線。" -#: ../../library/asyncio-eventloop.rst:558 +#: ../../library/asyncio-eventloop.rst:562 msgid "" -"The socket family can be " -"either :py:const:`~socket.AF_INET`, :py:const:`~socket.AF_INET6`, " -"or :py:const:`~socket.AF_UNIX`, depending on *host* (or the *family* " -"argument, if provided)." +"The socket family can be either :py:const:`~socket.AF_INET`, :py:const:" +"`~socket.AF_INET6`, or :py:const:`~socket.AF_UNIX`, depending on *host* (or " +"the *family* argument, if provided)." msgstr "" "Socket 家族可以是 :py:const:`~socket.AF_INET`、:py:const:`~socket.AF_INET6` " "或 :py:const:`~socket.AF_UNIX`,視乎 *host*\\ (或提供的 *family* 引數)而" "定。" -#: ../../library/asyncio-eventloop.rst:562 +#: ../../library/asyncio-eventloop.rst:566 msgid "The socket type will be :py:const:`~socket.SOCK_DGRAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_DGRAM`。" -#: ../../library/asyncio-eventloop.rst:564 -#: ../../library/asyncio-eventloop.rst:689 -#: ../../library/asyncio-eventloop.rst:836 +#: ../../library/asyncio-eventloop.rst:568 +#: ../../library/asyncio-eventloop.rst:695 +#: ../../library/asyncio-eventloop.rst:844 msgid "" "*protocol_factory* must be a callable returning a :ref:`protocol ` implementation." @@ -950,31 +945,31 @@ msgstr "" "*protocol_factory* 必須是可呼叫的函式,回傳 :ref:`protocol ` 實作。" -#: ../../library/asyncio-eventloop.rst:567 -#: ../../library/asyncio-eventloop.rst:645 +#: ../../library/asyncio-eventloop.rst:571 +#: ../../library/asyncio-eventloop.rst:650 msgid "A tuple of ``(transport, protocol)`` is returned on success." msgstr "成功時回傳 ``(transport, protocol)`` 元組。" -#: ../../library/asyncio-eventloop.rst:571 +#: ../../library/asyncio-eventloop.rst:575 msgid "" "*local_addr*, if given, is a ``(local_host, local_port)`` tuple used to bind " -"the socket locally. The *local_host* and *local_port* are looked up " -"using :meth:`getaddrinfo`." +"the socket locally. The *local_host* and *local_port* are looked up using :" +"meth:`getaddrinfo`." msgstr "" "*local_addr*,如果提供,是一個 ``(local_host, local_port)`` 元組,用於在本地" "綁定 socket。*local_host* 和 *local_port* 使用 :meth:`getaddrinfo` 來查找。" -#: ../../library/asyncio-eventloop.rst:575 +#: ../../library/asyncio-eventloop.rst:579 msgid "" "*remote_addr*, if given, is a ``(remote_host, remote_port)`` tuple used to " "connect the socket to a remote address. The *remote_host* and *remote_port* " "are looked up using :meth:`getaddrinfo`." msgstr "" "*remote_addr*,如果提供,是一個 ``(remote_host, remote_port)`` 元組,用於將 " -"socket 連線到遠端位址。 *remote_host* 和 *remote_port* 使" -"用 :meth:`getaddrinfo` 來查找。" +"socket 連線到遠端位址。 *remote_host* 和 *remote_port* 使用 :meth:" +"`getaddrinfo` 來查找。" -#: ../../library/asyncio-eventloop.rst:579 +#: ../../library/asyncio-eventloop.rst:583 msgid "" "*family*, *proto*, *flags* are the optional address family, protocol and " "flags to be passed through to :meth:`getaddrinfo` for *host* resolution. If " @@ -985,7 +980,7 @@ msgstr "" "的可選地址家族、協定和旗標。如果提供,這些應該都是來自相應的 :mod:`socket` 模" "組常數的整數。" -#: ../../library/asyncio-eventloop.rst:584 +#: ../../library/asyncio-eventloop.rst:588 msgid "" "*reuse_port* tells the kernel to allow this endpoint to be bound to the same " "port as other existing endpoints are bound to, so long as they all set this " @@ -994,36 +989,35 @@ msgid "" "is not defined then this capability is unsupported." msgstr "" "*reuse_port* 告訴核心允許將此端點綁定到與其他現有端點相同的埠,只要它們在建立" -"時都設定了此旗標。此選項不受 Windows 和某些 Unix 系統支援。如果未定" -"義 :py:const:`~socket.SO_REUSEPORT` 常數,則不支援此功能。" +"時都設定了此旗標。此選項不受 Windows 和某些 Unix 系統支援。如果未定義 :py:" +"const:`~socket.SO_REUSEPORT` 常數,則不支援此功能。" -#: ../../library/asyncio-eventloop.rst:590 +#: ../../library/asyncio-eventloop.rst:594 msgid "" "*allow_broadcast* tells the kernel to allow this endpoint to send messages " "to the broadcast address." msgstr "*allow_broadcast* 告訴核心允許此端點向廣播位址發送訊息。" -#: ../../library/asyncio-eventloop.rst:593 +#: ../../library/asyncio-eventloop.rst:597 msgid "" "*sock* can optionally be specified in order to use a preexisting, already " "connected, :class:`socket.socket` object to be used by the transport. If " -"specified, *local_addr* and *remote_addr* should be omitted (must " -"be :const:`None`)." +"specified, *local_addr* and *remote_addr* should be omitted (must be :const:" +"`None`)." msgstr "" "*sock* 可以選擇性地指定,以使用預先存在且已連線的 :class:`socket.socket` 物件" -"供傳輸使用。如果指定,*local_addr* 和 *remote_addr* 應省略(必須" -"是 :const:`None`\\ )。" +"供傳輸使用。如果指定,*local_addr* 和 *remote_addr* 應省略(必須是 :const:" +"`None`\\ )。" -#: ../../library/asyncio-eventloop.rst:604 +#: ../../library/asyncio-eventloop.rst:608 msgid "" -"See :ref:`UDP echo client protocol ` " -"and :ref:`UDP echo server protocol ` " -"examples." +"See :ref:`UDP echo client protocol ` and :" +"ref:`UDP echo server protocol ` examples." msgstr "" -"請參閱 :ref:`UDP 回應用戶端協議 ` " -"和 :ref:`UDP 回應伺服器協議 ` 範例。" +"請參閱 :ref:`UDP 回應用戶端協議 ` 和 :ref:" +"`UDP 回應伺服器協議 ` 範例。" -#: ../../library/asyncio-eventloop.rst:607 +#: ../../library/asyncio-eventloop.rst:611 msgid "" "The *family*, *proto*, *flags*, *reuse_address*, *reuse_port*, " "*allow_broadcast*, and *sock* parameters were added." @@ -1031,21 +1025,20 @@ msgstr "" "新增 *family*、*proto*、*flags*、*reuse_address*、*reuse_port*、" "*allow_broadcast* 和 *sock* 參數。" -#: ../../library/asyncio-eventloop.rst:611 +#: ../../library/asyncio-eventloop.rst:615 msgid "Added support for Windows." msgstr "新增對於 Windows 的支援。" -#: ../../library/asyncio-eventloop.rst:614 +#: ../../library/asyncio-eventloop.rst:618 msgid "" -"The *reuse_address* parameter is no longer supported, as " -"using :ref:`socket.SO_REUSEADDR ` poses a significant " -"security concern for UDP. Explicitly passing ``reuse_address=True`` will " -"raise an exception." +"The *reuse_address* parameter is no longer supported, as using :ref:`socket." +"SO_REUSEADDR ` poses a significant security concern " +"for UDP. Explicitly passing ``reuse_address=True`` will raise an exception." msgstr "" "不再支援 *reuse_address* 參數,因為使用 :py:const:`~sockets.SO_REUSEADDR` 對" "於 UDP 存有重大的安全疑慮。明確傳遞 ``reuse_address=True`` 將引發例外。" -#: ../../library/asyncio-eventloop.rst:620 +#: ../../library/asyncio-eventloop.rst:624 msgid "" "When multiple processes with differing UIDs assign sockets to an identical " "UDP socket address with ``SO_REUSEADDR``, incoming packets can become " @@ -1054,7 +1047,7 @@ msgstr "" "當具有不同 UID 的多個行程使用 ``SO_REUSEADDR`` 將 socket 分配給相同的 UDP " "socket 地址時,傳入的封包可能會在 socket 之間隨機分佈。" -#: ../../library/asyncio-eventloop.rst:624 +#: ../../library/asyncio-eventloop.rst:628 msgid "" "For supported platforms, *reuse_port* can be used as a replacement for " "similar functionality. With *reuse_port*, :ref:`socket.SO_REUSEPORT ` is set by default " "for all TCP connections." msgstr "" -"新增 *ssl_handshake_timeout* 與 *start_serving* 參數。所有 TCP 連線都預設" -"有 :ref:`socket.TCP_NODELAY ` socket 選項。" +"新增 *ssl_handshake_timeout* 與 *start_serving* 參數。所有 TCP 連線都預設有 :" +"ref:`socket.TCP_NODELAY ` socket 選項。" -#: ../../library/asyncio-eventloop.rst:783 +#: ../../library/asyncio-eventloop.rst:789 msgid "" "The :func:`start_server` function is a higher-level alternative API that " "returns a pair of :class:`StreamReader` and :class:`StreamWriter` that can " "be used in an async/await code." msgstr "" -":func:`start_server` 函式是一個更高階的替代 API,它回傳一" -"對 :class:`StreamReader` 和 :class:`StreamWriter`,可以在 async/await 程式碼" -"中使用。" +":func:`start_server` 函式是一個更高階的替代 API,它回傳一對 :class:" +"`StreamReader` 和 :class:`StreamWriter`,可以在 async/await 程式碼中使用。" -#: ../../library/asyncio-eventloop.rst:794 +#: ../../library/asyncio-eventloop.rst:801 msgid "" -"Similar to :meth:`loop.create_server` but works with " -"the :py:const:`~socket.AF_UNIX` socket family." +"Similar to :meth:`loop.create_server` but works with the :py:const:`~socket." +"AF_UNIX` socket family." msgstr "" "類似 :meth:`loop.create_server`,但適用於 :py:const:`~socket.AF_UNIX` socket " "家族。" -#: ../../library/asyncio-eventloop.rst:797 +#: ../../library/asyncio-eventloop.rst:804 msgid "" "*path* is the name of a Unix domain socket, and is required, unless a *sock* " "argument is provided. Abstract Unix sockets, :class:`str`, :class:`bytes`, " @@ -1310,7 +1300,7 @@ msgstr "" "象 Unix sockets、:class:`str`、:class:`bytes` 和 :class:`~pathlib.Path` 路" "徑。" -#: ../../library/asyncio-eventloop.rst:802 +#: ../../library/asyncio-eventloop.rst:809 msgid "" "If *cleanup_socket* is true then the Unix socket will automatically be " "removed from the filesystem when the server is closed, unless the socket has " @@ -1319,13 +1309,13 @@ msgstr "" "如果 *cleanup_socket* 為真,則 Unix socket 將在伺服器關閉時自動從檔案系統中刪" "除,除非在建立伺服器後替換了 socket。" -#: ../../library/asyncio-eventloop.rst:806 +#: ../../library/asyncio-eventloop.rst:813 msgid "" "See the documentation of the :meth:`loop.create_server` method for " "information about arguments to this method." msgstr "有關此方法的引數資訊,請參閱 :meth:`loop.create_server` 方法的文件。" -#: ../../library/asyncio-eventloop.rst:813 +#: ../../library/asyncio-eventloop.rst:820 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :class:`~pathlib.Path` object." @@ -1333,26 +1323,26 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。*path* 參數現在可為一" "個 :class:`~pathlib.Path` 物件。" -#: ../../library/asyncio-eventloop.rst:822 +#: ../../library/asyncio-eventloop.rst:829 msgid "Added the *cleanup_socket* parameter." msgstr "加入 *cleanup_socket* 參數。" -#: ../../library/asyncio-eventloop.rst:829 +#: ../../library/asyncio-eventloop.rst:837 msgid "Wrap an already accepted connection into a transport/protocol pair." msgstr "將已接受的連線包裝成傳輸層/協議對。" -#: ../../library/asyncio-eventloop.rst:831 +#: ../../library/asyncio-eventloop.rst:839 msgid "" "This method can be used by servers that accept connections outside of " "asyncio but that use asyncio to handle them." msgstr "此方法可以由在 asyncio 外接受連線但使用 asyncio 處理連線的伺服器使用。" -#: ../../library/asyncio-eventloop.rst:834 -#: ../../library/asyncio-eventloop.rst:924 +#: ../../library/asyncio-eventloop.rst:842 +#: ../../library/asyncio-eventloop.rst:934 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-eventloop.rst:839 +#: ../../library/asyncio-eventloop.rst:847 msgid "" "*sock* is a preexisting socket object returned from :meth:`socket.accept " "`." @@ -1360,13 +1350,13 @@ msgstr "" "*sock* 是從 :meth:`socket.accept ` 回傳的預先存在的 " "socket 物件。" -#: ../../library/asyncio-eventloop.rst:848 +#: ../../library/asyncio-eventloop.rst:856 msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` to enable SSL over the " "accepted connections." msgstr "*ssl* 可以設置為 :class:`~ssl.SSLContext` 以在已接受的連線上啟用 SSL。" -#: ../../library/asyncio-eventloop.rst:851 +#: ../../library/asyncio-eventloop.rst:859 msgid "" "*ssl_handshake_timeout* is (for an SSL connection) the time in seconds to " "wait for the SSL handshake to complete before aborting the connection. " @@ -1375,29 +1365,29 @@ msgstr "" "(對於 SSL 連線)\\ *ssl_handshake_timeout* 是在中斷連線之前等待 SSL 握手完成" "的時間(以秒為單位)。如果為 ``None``\\ (預設),則為 ``60.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:859 +#: ../../library/asyncio-eventloop.rst:867 msgid "Returns a ``(transport, protocol)`` pair." msgstr "回傳 ``(transport, protocol)`` 對。" -#: ../../library/asyncio-eventloop.rst:873 +#: ../../library/asyncio-eventloop.rst:881 msgid "Transferring files" msgstr "傳輸檔案" -#: ../../library/asyncio-eventloop.rst:878 +#: ../../library/asyncio-eventloop.rst:887 msgid "" "Send a *file* over a *transport*. Return the total number of bytes sent." msgstr "通過 *transport* 發送 *file*。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:881 +#: ../../library/asyncio-eventloop.rst:890 msgid "The method uses high-performance :meth:`os.sendfile` if available." msgstr "如果可用,該方法使用高性能 :meth:`os.sendfile`。" -#: ../../library/asyncio-eventloop.rst:883 +#: ../../library/asyncio-eventloop.rst:892 msgid "*file* must be a regular file object opened in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:885 -#: ../../library/asyncio-eventloop.rst:1136 +#: ../../library/asyncio-eventloop.rst:894 +#: ../../library/asyncio-eventloop.rst:1155 msgid "" "*offset* tells from where to start reading the file. If specified, *count* " "is the total number of bytes to transmit as opposed to sending the file " @@ -1409,7 +1399,7 @@ msgstr "" "不是發送檔案直到達到 EOF。即使此方法引發錯誤時,檔案位置也始終更新,可以使" "用 :meth:`file.tell() ` 取得實際發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:892 +#: ../../library/asyncio-eventloop.rst:901 msgid "" "*fallback* set to ``True`` makes asyncio to manually read and send the file " "when the platform does not support the sendfile system call (e.g. Windows or " @@ -1418,23 +1408,23 @@ msgstr "" "將 *fallback* 設置為 ``True`` 會使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:896 +#: ../../library/asyncio-eventloop.rst:905 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support the " "*sendfile* syscall and *fallback* is ``False``." msgstr "" -"如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,則引" -"發 :exc:`SendfileNotAvailableError`。" +"如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,則引發 :exc:" +"`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:903 +#: ../../library/asyncio-eventloop.rst:912 msgid "TLS Upgrade" msgstr "TLS 升級" -#: ../../library/asyncio-eventloop.rst:910 +#: ../../library/asyncio-eventloop.rst:920 msgid "Upgrade an existing transport-based connection to TLS." msgstr "將基於傳輸的現有連線升級到 TLS。" -#: ../../library/asyncio-eventloop.rst:912 +#: ../../library/asyncio-eventloop.rst:922 msgid "" "Create a TLS coder/decoder instance and insert it between the *transport* " "and the *protocol*. The coder/decoder implements both *transport*-facing " @@ -1443,7 +1433,7 @@ msgstr "" "建立 TLS 編解碼器實例並在 *transport* 和 *protocol* 之間插入它。編解碼器既實" "作了對於 *transport* 的協議,也實作了對於 *protocol* 的傳輸。" -#: ../../library/asyncio-eventloop.rst:916 +#: ../../library/asyncio-eventloop.rst:926 msgid "" "Return the created two-interface instance. After *await*, the *protocol* " "must stop using the original *transport* and communicate with the returned " @@ -1454,25 +1444,25 @@ msgstr "" "*transport*,僅與回傳的物件通信,因為編碼器快取了 *protocol* 端的資料,並且" "與 *transport* 間歇性地交換額外的 TLS session 封包。" -#: ../../library/asyncio-eventloop.rst:921 +#: ../../library/asyncio-eventloop.rst:931 msgid "" "In some situations (e.g. when the passed transport is already closing) this " "may return ``None``." msgstr "在某些情況下(例如傳入的傳輸已經關閉),此函式可能回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:926 +#: ../../library/asyncio-eventloop.rst:936 msgid "" -"*transport* and *protocol* instances that methods " -"like :meth:`~loop.create_server` and :meth:`~loop.create_connection` return." +"*transport* and *protocol* instances that methods like :meth:`~loop." +"create_server` and :meth:`~loop.create_connection` return." msgstr "" -"*transport* 和 *protocol* 實例,由像 :meth:`~loop.create_server` " -"和 :meth:`~loop.create_connection` 等方法回傳。" +"*transport* 和 *protocol* 實例,由像 :meth:`~loop.create_server` 和 :meth:" +"`~loop.create_connection` 等方法回傳。" -#: ../../library/asyncio-eventloop.rst:930 +#: ../../library/asyncio-eventloop.rst:940 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "*sslcontext*:配置好的 :class:`~ssl.SSLContext` 實例。" -#: ../../library/asyncio-eventloop.rst:932 +#: ../../library/asyncio-eventloop.rst:942 msgid "" "*server_side* pass ``True`` when a server-side connection is being upgraded " "(like the one created by :meth:`~loop.create_server`)." @@ -1480,17 +1470,17 @@ msgstr "" "當升級伺服器端連線時(像由 :meth:`~loop.create_server` 建立的那樣)傳遞 " "``True``。" -#: ../../library/asyncio-eventloop.rst:935 +#: ../../library/asyncio-eventloop.rst:945 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "*server_hostname*:設置或覆蓋將用於匹配目標伺服器憑證的主機名。" -#: ../../library/asyncio-eventloop.rst:955 +#: ../../library/asyncio-eventloop.rst:965 msgid "Watching file descriptors" msgstr "監視檔案描述器" -#: ../../library/asyncio-eventloop.rst:959 +#: ../../library/asyncio-eventloop.rst:969 msgid "" "Start monitoring the *fd* file descriptor for read availability and invoke " "*callback* with the specified arguments once *fd* is available for reading." @@ -1498,14 +1488,14 @@ msgstr "" "開始監視 *fd* 檔案描述器的讀取可用性,一但 *fd* 可讀取,使用指定引數叫用 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:963 -#: ../../library/asyncio-eventloop.rst:977 +#: ../../library/asyncio-eventloop.rst:973 +#: ../../library/asyncio-eventloop.rst:987 msgid "" "Any preexisting callback registered for *fd* is cancelled and replaced by " "*callback*." msgstr "任何預先存在、為 *fd* 註冊的回呼函式將被取消並替換為 *callback*。" -#: ../../library/asyncio-eventloop.rst:968 +#: ../../library/asyncio-eventloop.rst:978 msgid "" "Stop monitoring the *fd* file descriptor for read availability. Returns " "``True`` if *fd* was previously being monitored for reads." @@ -1513,7 +1503,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的讀取可用性。如果 *fd* 之前正在監視讀取,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:973 +#: ../../library/asyncio-eventloop.rst:983 msgid "" "Start monitoring the *fd* file descriptor for write availability and invoke " "*callback* with the specified arguments once *fd* is available for writing." @@ -1521,8 +1511,8 @@ msgstr "" "開始監視 *fd* 檔案描述器的寫入可用性,一旦 *fd* 可寫入,使用指定引數叫用 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:980 -#: ../../library/asyncio-eventloop.rst:1245 +#: ../../library/asyncio-eventloop.rst:990 +#: ../../library/asyncio-eventloop.rst:1268 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *callback*." @@ -1530,7 +1520,7 @@ msgstr "" "使用 :func:`functools.partial` 向 *callback* :ref:`傳送關鍵字引數 `。" -#: ../../library/asyncio-eventloop.rst:985 +#: ../../library/asyncio-eventloop.rst:995 msgid "" "Stop monitoring the *fd* file descriptor for write availability. Returns " "``True`` if *fd* was previously being monitored for writes." @@ -1538,7 +1528,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的寫入可用性。如果 *fd* 之前正在監視寫入,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:988 +#: ../../library/asyncio-eventloop.rst:998 msgid "" "See also :ref:`Platform Support ` section for some " "limitations of these methods." @@ -1546,47 +1536,47 @@ msgstr "" "另請參閱\\ :ref:`平台支援 `\\ 部分以了解這些方法的" "一些限制。" -#: ../../library/asyncio-eventloop.rst:993 +#: ../../library/asyncio-eventloop.rst:1003 msgid "Working with socket objects directly" msgstr "直接使用 socket 物件" -#: ../../library/asyncio-eventloop.rst:995 +#: ../../library/asyncio-eventloop.rst:1005 msgid "" -"In general, protocol implementations that use transport-based APIs such " -"as :meth:`loop.create_connection` and :meth:`loop.create_server` are faster " -"than implementations that work with sockets directly. However, there are " -"some use cases when performance is not critical, and working " -"with :class:`~socket.socket` objects directly is more convenient." +"In general, protocol implementations that use transport-based APIs such as :" +"meth:`loop.create_connection` and :meth:`loop.create_server` are faster than " +"implementations that work with sockets directly. However, there are some use " +"cases when performance is not critical, and working with :class:`~socket." +"socket` objects directly is more convenient." msgstr "" -"一般情況下,使用基於傳輸的 API(如 :meth:`loop.create_connection` " -"和 :meth:`loop.create_server`\\ )的協議實作比直接使用 socket 的實作更快。然" -"而在某些情況下性能不是關鍵,直接使用 :class:`~socket.socket` 物件更方便。" +"一般情況下,使用基於傳輸的 API(如 :meth:`loop.create_connection` 和 :meth:" +"`loop.create_server`\\ )的協議實作比直接使用 socket 的實作更快。然而在某些情" +"況下性能不是關鍵,直接使用 :class:`~socket.socket` 物件更方便。" -#: ../../library/asyncio-eventloop.rst:1004 +#: ../../library/asyncio-eventloop.rst:1015 msgid "" -"Receive up to *nbytes* from *sock*. Asynchronous version " -"of :meth:`socket.recv() `." +"Receive up to *nbytes* from *sock*. Asynchronous version of :meth:`socket." +"recv() `." msgstr "" "從 *sock* 接收最多 *nbytes*。:meth:`socket.recv() ` 的非" "同步版本。" -#: ../../library/asyncio-eventloop.rst:1007 +#: ../../library/asyncio-eventloop.rst:1018 msgid "Return the received data as a bytes object." msgstr "將接收到的資料作為 bytes 物件回傳。" -#: ../../library/asyncio-eventloop.rst:1009 -#: ../../library/asyncio-eventloop.rst:1023 -#: ../../library/asyncio-eventloop.rst:1034 -#: ../../library/asyncio-eventloop.rst:1046 -#: ../../library/asyncio-eventloop.rst:1061 +#: ../../library/asyncio-eventloop.rst:1020 +#: ../../library/asyncio-eventloop.rst:1035 +#: ../../library/asyncio-eventloop.rst:1047 +#: ../../library/asyncio-eventloop.rst:1060 #: ../../library/asyncio-eventloop.rst:1076 -#: ../../library/asyncio-eventloop.rst:1086 -#: ../../library/asyncio-eventloop.rst:1112 -#: ../../library/asyncio-eventloop.rst:1150 +#: ../../library/asyncio-eventloop.rst:1092 +#: ../../library/asyncio-eventloop.rst:1103 +#: ../../library/asyncio-eventloop.rst:1130 +#: ../../library/asyncio-eventloop.rst:1169 msgid "*sock* must be a non-blocking socket." msgstr "*sock* 必須是非阻塞 socket。" -#: ../../library/asyncio-eventloop.rst:1011 +#: ../../library/asyncio-eventloop.rst:1022 msgid "" "Even though this method was always documented as a coroutine method, " "releases before Python 3.7 returned a :class:`Future`. Since Python 3.7 this " @@ -1595,52 +1585,51 @@ msgstr "" "儘管此方法一直記錄為協程方法,但 Python 3.7 之前的版本回傳 :class:`Future`。" "自 Python 3.7 起,這是 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:1018 +#: ../../library/asyncio-eventloop.rst:1030 msgid "" -"Receive data from *sock* into the *buf* buffer. Modeled after the " -"blocking :meth:`socket.recv_into() ` method." +"Receive data from *sock* into the *buf* buffer. Modeled after the blocking :" +"meth:`socket.recv_into() ` method." msgstr "" "從 *sock* 接收資料到 *buf* 緩衝區。仿照阻塞 :meth:`socket.recv_into() " "` 方法。" -#: ../../library/asyncio-eventloop.rst:1021 +#: ../../library/asyncio-eventloop.rst:1033 msgid "Return the number of bytes written to the buffer." msgstr "回傳寫入緩衝區位元組的數目。" -#: ../../library/asyncio-eventloop.rst:1029 +#: ../../library/asyncio-eventloop.rst:1042 msgid "" -"Receive a datagram of up to *bufsize* from *sock*. Asynchronous version " -"of :meth:`socket.recvfrom() `." +"Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of :" +"meth:`socket.recvfrom() `." msgstr "" "從 *sock* 接收最多 *bufsize* 大小的資料單元。:meth:`socket.recvfrom() " "` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1032 +#: ../../library/asyncio-eventloop.rst:1045 msgid "Return a tuple of (received data, remote address)." msgstr "回傳一個元組 (received data, remote address)。" -#: ../../library/asyncio-eventloop.rst:1040 +#: ../../library/asyncio-eventloop.rst:1054 msgid "" "Receive a datagram of up to *nbytes* from *sock* into *buf*. Asynchronous " "version of :meth:`socket.recvfrom_into() `." msgstr "" -"從 *sock* 接收最多 *nbytes* 大小的資料單元到 " -"*buf*。:meth:`socket.recvfrom_into() ` 的非同步" -"版本。" +"從 *sock* 接收最多 *nbytes* 大小的資料單元到 *buf*。:meth:`socket." +"recvfrom_into() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1044 +#: ../../library/asyncio-eventloop.rst:1058 msgid "Return a tuple of (number of bytes received, remote address)." msgstr "回傳一個元組 (number of bytes received, remote address)。" -#: ../../library/asyncio-eventloop.rst:1052 +#: ../../library/asyncio-eventloop.rst:1067 msgid "" -"Send *data* to the *sock* socket. Asynchronous version " -"of :meth:`socket.sendall() `." +"Send *data* to the *sock* socket. Asynchronous version of :meth:`socket." +"sendall() `." msgstr "" -"將 *data* 發送到 *sock* socket。:meth:`socket.sendall() " -"` 的非同步版本。" +"將 *data* 發送到 *sock* socket。:meth:`socket.sendall() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1055 +#: ../../library/asyncio-eventloop.rst:1070 msgid "" "This method continues to send to the socket until either all data in *data* " "has been sent or an error occurs. ``None`` is returned on success. On " @@ -1652,8 +1641,8 @@ msgstr "" "回傳 ``None``。錯誤時引發例外。此外,沒有辦法確定接收端成功處理了多少資料(如" "果有的話)。" -#: ../../library/asyncio-eventloop.rst:1063 -#: ../../library/asyncio-eventloop.rst:1114 +#: ../../library/asyncio-eventloop.rst:1078 +#: ../../library/asyncio-eventloop.rst:1132 msgid "" "Even though the method was always documented as a coroutine method, before " "Python 3.7 it returned a :class:`Future`. Since Python 3.7, this is an " @@ -1662,39 +1651,39 @@ msgstr "" "儘管該方法一直被記錄為協程方法,但在 Python 3.7 之前它回傳 :class:`Future`。" "從 Python 3.7 開始,這是一個 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:1070 +#: ../../library/asyncio-eventloop.rst:1086 msgid "" -"Send a datagram from *sock* to *address*. Asynchronous version " -"of :meth:`socket.sendto() `." +"Send a datagram from *sock* to *address*. Asynchronous version of :meth:" +"`socket.sendto() `." msgstr "" -"從 *sock* 向 *address* 發送一個資料單元。:meth:`socket.sendto() " -"` 的非同步版本。" +"從 *sock* 向 *address* 發送一個資料單元。:meth:`socket.sendto() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1074 +#: ../../library/asyncio-eventloop.rst:1090 msgid "Return the number of bytes sent." msgstr "回傳發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:1082 +#: ../../library/asyncio-eventloop.rst:1099 msgid "Connect *sock* to a remote socket at *address*." msgstr "將 *sock* 連線到位於 *address* 的遠端 socket。" -#: ../../library/asyncio-eventloop.rst:1084 +#: ../../library/asyncio-eventloop.rst:1101 msgid "" "Asynchronous version of :meth:`socket.connect() `." msgstr ":meth:`socket.connect() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1088 +#: ../../library/asyncio-eventloop.rst:1105 msgid "" "``address`` no longer needs to be resolved. ``sock_connect`` will try to " -"check if the *address* is already resolved by " -"calling :func:`socket.inet_pton`. If not, :meth:`loop.getaddrinfo` will be " -"used to resolve the *address*." +"check if the *address* is already resolved by calling :func:`socket." +"inet_pton`. If not, :meth:`loop.getaddrinfo` will be used to resolve the " +"*address*." msgstr "" -"不再需要解析 ``address``。``sock_connect`` 將嘗試透過呼" -"叫 :func:`socket.inet_pton` 檢查 *address* 是否已解析。如果沒有,將使" -"用 :meth:`loop.getaddrinfo` 解析 *address*。" +"不再需要解析 ``address``。``sock_connect`` 將嘗試透過呼叫 :func:`socket." +"inet_pton` 檢查 *address* 是否已解析。如果沒有,將使用 :meth:`loop." +"getaddrinfo` 解析 *address*。" -#: ../../library/asyncio-eventloop.rst:1097 +#: ../../library/asyncio-eventloop.rst:1114 msgid "" ":meth:`loop.create_connection` and :func:`asyncio.open_connection() " "`." @@ -1702,7 +1691,7 @@ msgstr "" ":meth:`loop.create_connection` 和 :func:`asyncio.open_connection() " "`。" -#: ../../library/asyncio-eventloop.rst:1103 +#: ../../library/asyncio-eventloop.rst:1121 msgid "" "Accept a connection. Modeled after the blocking :meth:`socket.accept() " "` method." @@ -1710,7 +1699,7 @@ msgstr "" "接受一個連線。模擬阻塞的 :meth:`socket.accept() ` 方" "法。" -#: ../../library/asyncio-eventloop.rst:1106 +#: ../../library/asyncio-eventloop.rst:1124 msgid "" "The socket must be bound to an address and listening for connections. The " "return value is a pair ``(conn, address)`` where *conn* is a *new* socket " @@ -1721,34 +1710,34 @@ msgstr "" "中 *conn* 是一個 *新* socket 物件,可在連線上發送和接收資料,*address* 是連接" "另一端對應的 socket 地址。" -#: ../../library/asyncio-eventloop.rst:1121 +#: ../../library/asyncio-eventloop.rst:1139 msgid ":meth:`loop.create_server` and :func:`start_server`." msgstr ":meth:`loop.create_server` 和 :func:`start_server`。" -#: ../../library/asyncio-eventloop.rst:1126 +#: ../../library/asyncio-eventloop.rst:1145 msgid "" "Send a file using high-performance :mod:`os.sendfile` if possible. Return " "the total number of bytes sent." msgstr "" "如果可行,使用高性能 :mod:`os.sendfile` 發送檔案。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:1129 +#: ../../library/asyncio-eventloop.rst:1148 msgid "" "Asynchronous version of :meth:`socket.sendfile() `." msgstr ":meth:`socket.sendfile() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1131 +#: ../../library/asyncio-eventloop.rst:1150 msgid "" -"*sock* must be a non-" -"blocking :const:`socket.SOCK_STREAM` :class:`~socket.socket`." +"*sock* must be a non-blocking :const:`socket.SOCK_STREAM` :class:`~socket." +"socket`." msgstr "" "*sock* 必須是非阻塞的 :const:`socket.SOCK_STREAM` :class:`~socket.socket`。" -#: ../../library/asyncio-eventloop.rst:1134 +#: ../../library/asyncio-eventloop.rst:1153 msgid "*file* must be a regular file object open in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:1143 +#: ../../library/asyncio-eventloop.rst:1162 msgid "" "*fallback*, when set to ``True``, makes asyncio manually read and send the " "file when the platform does not support the sendfile syscall (e.g. Windows " @@ -1757,27 +1746,27 @@ msgstr "" "當設置為 ``True`` 時,*fallback* 使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:1147 +#: ../../library/asyncio-eventloop.rst:1166 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support " "*sendfile* syscall and *fallback* is ``False``." msgstr "" -"如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,引" -"發 :exc:`SendfileNotAvailableError`。" +"如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,引發 :exc:" +"`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:1156 +#: ../../library/asyncio-eventloop.rst:1175 msgid "DNS" msgstr "DNS" -#: ../../library/asyncio-eventloop.rst:1161 +#: ../../library/asyncio-eventloop.rst:1181 msgid "Asynchronous version of :meth:`socket.getaddrinfo`." msgstr ":meth:`socket.getaddrinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1165 +#: ../../library/asyncio-eventloop.rst:1186 msgid "Asynchronous version of :meth:`socket.getnameinfo`." msgstr ":meth:`socket.getnameinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1168 +#: ../../library/asyncio-eventloop.rst:1189 msgid "" "Both *getaddrinfo* and *getnameinfo* internally utilize their synchronous " "versions through the loop's default thread pool executor. When this executor " @@ -1787,86 +1776,84 @@ msgid "" "executor with a larger number of workers." msgstr "" -#: ../../library/asyncio-eventloop.rst:1175 +#: ../../library/asyncio-eventloop.rst:1196 msgid "" "Both *getaddrinfo* and *getnameinfo* methods were always documented to " -"return a coroutine, but prior to Python 3.7 they were, in fact, " -"returning :class:`asyncio.Future` objects. Starting with Python 3.7 both " -"methods are coroutines." +"return a coroutine, but prior to Python 3.7 they were, in fact, returning :" +"class:`asyncio.Future` objects. Starting with Python 3.7 both methods are " +"coroutines." msgstr "" "*getaddrinfo* 和 *getnameinfo* 方法一直被記錄為回傳協程,但在 Python 3.7 之前" "它們實際上回傳 :class:`asyncio.Future` 物件。從 Python 3.7 開始,兩個方法都是" "協程。" -#: ../../library/asyncio-eventloop.rst:1183 +#: ../../library/asyncio-eventloop.rst:1204 msgid "Working with pipes" msgstr "使用管道" -#: ../../library/asyncio-eventloop.rst:1187 +#: ../../library/asyncio-eventloop.rst:1209 msgid "Register the read end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的讀取端。" -#: ../../library/asyncio-eventloop.rst:1192 +#: ../../library/asyncio-eventloop.rst:1214 msgid "*pipe* is a :term:`file-like object `." msgstr "*pipe* 是 :term:`類檔案物件 `。" -#: ../../library/asyncio-eventloop.rst:1194 +#: ../../library/asyncio-eventloop.rst:1216 msgid "" -"Return pair ``(transport, protocol)``, where *transport* supports " -"the :class:`ReadTransport` interface and *protocol* is an object " -"instantiated by the *protocol_factory*." +"Return pair ``(transport, protocol)``, where *transport* supports the :class:" +"`ReadTransport` interface and *protocol* is an object instantiated by the " +"*protocol_factory*." msgstr "" -"回傳 ``(transport, protocol)`` 對,其中 *transport* 支" -"援 :class:`ReadTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物" -"件。" +"回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" +"`ReadTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1198 -#: ../../library/asyncio-eventloop.rst:1214 +#: ../../library/asyncio-eventloop.rst:1220 +#: ../../library/asyncio-eventloop.rst:1237 msgid "" "With :class:`SelectorEventLoop` event loop, the *pipe* is set to non-" "blocking mode." msgstr "使用 :class:`SelectorEventLoop` 事件迴圈時,*pipe* 設置為非阻塞模式。" -#: ../../library/asyncio-eventloop.rst:1203 +#: ../../library/asyncio-eventloop.rst:1226 msgid "Register the write end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的寫入端。" -#: ../../library/asyncio-eventloop.rst:1208 +#: ../../library/asyncio-eventloop.rst:1231 msgid "*pipe* is :term:`file-like object `." msgstr "*pipe* 是 :term:`file-like object `。" -#: ../../library/asyncio-eventloop.rst:1210 +#: ../../library/asyncio-eventloop.rst:1233 msgid "" -"Return pair ``(transport, protocol)``, where *transport* " -"supports :class:`WriteTransport` interface and *protocol* is an object " -"instantiated by the *protocol_factory*." +"Return pair ``(transport, protocol)``, where *transport* supports :class:" +"`WriteTransport` interface and *protocol* is an object instantiated by the " +"*protocol_factory*." msgstr "" -"回傳 ``(transport, protocol)`` 對,其中 *transport* 支" -"援 :class:`WriteTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的" -"物件。" +"回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" +"`WriteTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1219 +#: ../../library/asyncio-eventloop.rst:1242 msgid "" ":class:`SelectorEventLoop` does not support the above methods on Windows. " "Use :class:`ProactorEventLoop` instead for Windows." msgstr "" -":class:`SelectorEventLoop` 在 Windows 上不支援上述方法。對於 Windows 請使" -"用 :class:`ProactorEventLoop`。" +":class:`SelectorEventLoop` 在 Windows 上不支援上述方法。對於 Windows 請使用 :" +"class:`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1224 +#: ../../library/asyncio-eventloop.rst:1247 msgid "" "The :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods." msgstr ":meth:`loop.subprocess_exec` 和 :meth:`loop.subprocess_shell` 方法。" -#: ../../library/asyncio-eventloop.rst:1229 +#: ../../library/asyncio-eventloop.rst:1252 msgid "Unix signals" msgstr "Unix 訊號" -#: ../../library/asyncio-eventloop.rst:1235 +#: ../../library/asyncio-eventloop.rst:1258 msgid "Set *callback* as the handler for the *signum* signal." msgstr "將 *callback* 設置為 *signum* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1237 +#: ../../library/asyncio-eventloop.rst:1260 msgid "" "The callback will be invoked by *loop*, along with other queued callbacks " "and runnable coroutines of that event loop. Unlike signal handlers " @@ -1877,7 +1864,7 @@ msgstr "" "用 :func:`signal.signal` 註冊的訊號處理程式不同,使用此函式註冊的回呼允許與事" "件迴圈進行互動。" -#: ../../library/asyncio-eventloop.rst:1242 +#: ../../library/asyncio-eventloop.rst:1265 msgid "" "Raise :exc:`ValueError` if the signal number is invalid or uncatchable. " "Raise :exc:`RuntimeError` if there is a problem setting up the handler." @@ -1885,16 +1872,16 @@ msgstr "" "如果訊號號無效或不可捕獲,引發 :exc:`ValueError`。如果設定處理程序有問題,拋" "出 :exc:`RuntimeError`。" -#: ../../library/asyncio-eventloop.rst:1248 +#: ../../library/asyncio-eventloop.rst:1271 msgid "" "Like :func:`signal.signal`, this function must be invoked in the main thread." msgstr "像 :func:`signal.signal` 一樣,此函式必須在主執行緒中叫用。" -#: ../../library/asyncio-eventloop.rst:1253 +#: ../../library/asyncio-eventloop.rst:1276 msgid "Remove the handler for the *sig* signal." msgstr "移除 *sig* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1255 +#: ../../library/asyncio-eventloop.rst:1278 msgid "" "Return ``True`` if the signal handler was removed, or ``False`` if no " "handler was set for the given signal." @@ -1902,19 +1889,19 @@ msgstr "" "如果訊號處理程式被移除,回傳 ``True``;如果給定訊號沒有設置處理程式,回傳 " "``False``。" -#: ../../library/asyncio-eventloop.rst:1262 +#: ../../library/asyncio-eventloop.rst:1285 msgid "The :mod:`signal` module." msgstr ":mod:`signal` 模組。" -#: ../../library/asyncio-eventloop.rst:1266 +#: ../../library/asyncio-eventloop.rst:1289 msgid "Executing code in thread or process pools" msgstr "在執行緒池或行程池中執行程式碼" -#: ../../library/asyncio-eventloop.rst:1270 +#: ../../library/asyncio-eventloop.rst:1293 msgid "Arrange for *func* to be called in the specified executor." msgstr "安排在指定的執行器中呼叫 *func*。" -#: ../../library/asyncio-eventloop.rst:1272 +#: ../../library/asyncio-eventloop.rst:1295 msgid "" "The *executor* argument should be an :class:`concurrent.futures.Executor` " "instance. The default executor is used if *executor* is ``None``. The " @@ -1923,7 +1910,7 @@ msgid "" "and used by :func:`run_in_executor` if needed." msgstr "" -#: ../../library/asyncio-eventloop.rst:1280 +#: ../../library/asyncio-eventloop.rst:1303 msgid "" "import asyncio\n" "import concurrent.futures\n" @@ -1966,23 +1953,23 @@ msgid "" " asyncio.run(main())" msgstr "" -#: ../../library/asyncio-eventloop.rst:1320 +#: ../../library/asyncio-eventloop.rst:1343 msgid "" "Note that the entry point guard (``if __name__ == '__main__'``) is required " "for option 3 due to the peculiarities of :mod:`multiprocessing`, which is " "used by :class:`~concurrent.futures.ProcessPoolExecutor`. See :ref:`Safe " "importing of main module `." msgstr "" -"請注意,由於 :mod:`multiprocessing`\\ " -"(由 :class:`~concurrent.futures.ProcessPoolExecutor` 使用)的特殊性,選項 3 " -"需要進入點保護(\\ ``if __name__ == '__main__'``\\ )。請參閱\\ :ref:`主模組" -"的安全引入 `。" +"請注意,由於 :mod:`multiprocessing`\\ (由 :class:`~concurrent.futures." +"ProcessPoolExecutor` 使用)的特殊性,選項 3 需要進入點保護(\\ ``if __name__ " +"== '__main__'``\\ )。請參閱\\ :ref:`主模組的安全引入 `。" -#: ../../library/asyncio-eventloop.rst:1325 +#: ../../library/asyncio-eventloop.rst:1348 msgid "This method returns a :class:`asyncio.Future` object." msgstr "此方法回傳 :class:`asyncio.Future` 物件。" -#: ../../library/asyncio-eventloop.rst:1327 +#: ../../library/asyncio-eventloop.rst:1350 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *func*." @@ -1990,7 +1977,7 @@ msgstr "" "使用 :func:`functools.partial` 將來\\ :ref:`關鍵字引數傳遞 `\\ 給 *func*。" -#: ../../library/asyncio-eventloop.rst:1330 +#: ../../library/asyncio-eventloop.rst:1353 msgid "" ":meth:`loop.run_in_executor` no longer configures the ``max_workers`` of the " "thread pool executor it creates, instead leaving it up to the thread pool " @@ -1998,38 +1985,38 @@ msgid "" "default." msgstr "" ":meth:`loop.run_in_executor` 不再配置它建立的執行緒池執行器的 " -"``max_workers``,而是讓執行緒池執行器" -"(\\ :class:`~concurrent.futures.ThreadPoolExecutor`)設定預設值。" +"``max_workers``,而是讓執行緒池執行器(\\ :class:`~concurrent.futures." +"ThreadPoolExecutor`)設定預設值。" -#: ../../library/asyncio-eventloop.rst:1339 +#: ../../library/asyncio-eventloop.rst:1362 msgid "" "Set *executor* as the default executor used by :meth:`run_in_executor`. " -"*executor* must be an instance " -"of :class:`~concurrent.futures.ThreadPoolExecutor`." +"*executor* must be an instance of :class:`~concurrent.futures." +"ThreadPoolExecutor`." msgstr "" "將 *executor* 設置為 :meth:`run_in_executor` 使用的預設執行器。*executor* 必" "須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1343 +#: ../../library/asyncio-eventloop.rst:1366 msgid "" -"*executor* must be an instance " -"of :class:`~concurrent.futures.ThreadPoolExecutor`." +"*executor* must be an instance of :class:`~concurrent.futures." +"ThreadPoolExecutor`." msgstr "" "*executor* 必須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1349 +#: ../../library/asyncio-eventloop.rst:1372 msgid "Error Handling API" msgstr "錯誤處理 API" -#: ../../library/asyncio-eventloop.rst:1351 +#: ../../library/asyncio-eventloop.rst:1374 msgid "Allows customizing how exceptions are handled in the event loop." msgstr "允許自定義事件迴圈中的例外處理方式。" -#: ../../library/asyncio-eventloop.rst:1355 +#: ../../library/asyncio-eventloop.rst:1378 msgid "Set *handler* as the new event loop exception handler." msgstr "將 *handler* 設定為新的事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1357 +#: ../../library/asyncio-eventloop.rst:1380 msgid "" "If *handler* is ``None``, the default exception handler will be set. " "Otherwise, *handler* must be a callable with the signature matching ``(loop, " @@ -2042,16 +2029,16 @@ msgstr "" "圈的,``context`` 是包含例外詳細資訊的 ``dict`` 物件(有關情境的詳細資訊,請" "參閱 :meth:`call_exception_handler` 文件)。" -#: ../../library/asyncio-eventloop.rst:1365 +#: ../../library/asyncio-eventloop.rst:1388 msgid "" -"If the handler is called on behalf of a :class:`~asyncio.Task` " -"or :class:`~asyncio.Handle`, it is run in the :class:`contextvars.Context` " -"of that task or callback handle." +"If the handler is called on behalf of a :class:`~asyncio.Task` or :class:" +"`~asyncio.Handle`, it is run in the :class:`contextvars.Context` of that " +"task or callback handle." msgstr "" "如果代表 :class:`~asyncio.Task` 或 :class:`~asyncio.Handle` 呼叫處理程式,它" "將在該任務或回呼處理程式的 :class:`contextvars.Context` 中運行。" -#: ../../library/asyncio-eventloop.rst:1371 +#: ../../library/asyncio-eventloop.rst:1394 msgid "" "The handler may be called in the :class:`~contextvars.Context` of the task " "or handle where the exception originated." @@ -2059,18 +2046,18 @@ msgstr "" "處理程式可能在引發例外的任務或處理程式的 :class:`~contextvars.Context` 中被呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1376 +#: ../../library/asyncio-eventloop.rst:1399 msgid "" "Return the current exception handler, or ``None`` if no custom exception " "handler was set." msgstr "" "回傳目前的例外處理程式,如果未設置自定義例外處理程式,則回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:1383 +#: ../../library/asyncio-eventloop.rst:1406 msgid "Default exception handler." msgstr "預設例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1385 +#: ../../library/asyncio-eventloop.rst:1408 msgid "" "This is called when an exception occurs and no exception handler is set. " "This can be called by a custom exception handler that wants to defer to the " @@ -2079,17 +2066,17 @@ msgstr "" "當發生例外且未設置例外處理程式時呼叫此函式。自定義例外處理程式可以呼叫此函式" "以轉由預設處理程式處理。" -#: ../../library/asyncio-eventloop.rst:1389 +#: ../../library/asyncio-eventloop.rst:1412 msgid "" -"*context* parameter has the same meaning as " -"in :meth:`call_exception_handler`." +"*context* parameter has the same meaning as in :meth:" +"`call_exception_handler`." msgstr "*context* 參數與 :meth:`call_exception_handler` 中的意思相同。" -#: ../../library/asyncio-eventloop.rst:1394 +#: ../../library/asyncio-eventloop.rst:1417 msgid "Call the current event loop exception handler." msgstr "呼叫目前事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1396 +#: ../../library/asyncio-eventloop.rst:1419 msgid "" "*context* is a ``dict`` object containing the following keys (new keys may " "be introduced in future Python versions):" @@ -2097,143 +2084,149 @@ msgstr "" "*context* 是一個包含以下鍵的 ``dict`` 物件(未來的 Python 版本中可能會引入新" "的鍵):" -#: ../../library/asyncio-eventloop.rst:1399 +#: ../../library/asyncio-eventloop.rst:1422 msgid "'message': Error message;" msgstr "'message':錯誤訊息;" -#: ../../library/asyncio-eventloop.rst:1400 +#: ../../library/asyncio-eventloop.rst:1423 msgid "'exception' (optional): Exception object;" msgstr "'exception'(可選):例外物件;" -#: ../../library/asyncio-eventloop.rst:1401 +#: ../../library/asyncio-eventloop.rst:1424 msgid "'future' (optional): :class:`asyncio.Future` instance;" msgstr "'future'(可選): :class:`asyncio.Future` 實例;" -#: ../../library/asyncio-eventloop.rst:1402 +#: ../../library/asyncio-eventloop.rst:1425 msgid "'task' (optional): :class:`asyncio.Task` instance;" msgstr "'task'(可選): :class:`asyncio.Task` 實例;" -#: ../../library/asyncio-eventloop.rst:1403 +#: ../../library/asyncio-eventloop.rst:1426 msgid "'handle' (optional): :class:`asyncio.Handle` instance;" msgstr "'handle'(可選): :class:`asyncio.Handle` 實例;" -#: ../../library/asyncio-eventloop.rst:1404 +#: ../../library/asyncio-eventloop.rst:1427 msgid "'protocol' (optional): :ref:`Protocol ` instance;" msgstr "'protocol'(可選): :ref:`Protocol ` 實例;" -#: ../../library/asyncio-eventloop.rst:1405 +#: ../../library/asyncio-eventloop.rst:1428 msgid "'transport' (optional): :ref:`Transport ` instance;" msgstr "'transport'(可選): :ref:`Transport ` 實例;" -#: ../../library/asyncio-eventloop.rst:1406 +#: ../../library/asyncio-eventloop.rst:1429 msgid "'socket' (optional): :class:`socket.socket` instance;" msgstr "'socket'(可選): :class:`socket.socket` 實例;" -#: ../../library/asyncio-eventloop.rst:1407 +#: ../../library/asyncio-eventloop.rst:1430 +msgid "'source_traceback' (optional): Traceback of the source;" +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1431 +msgid "'handle_traceback' (optional): Traceback of the handle;" +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1432 msgid "'asyncgen' (optional): Asynchronous generator that caused" msgstr "'asyncgen'(可選): 非同步產生器引發" -#: ../../library/asyncio-eventloop.rst:1408 +#: ../../library/asyncio-eventloop.rst:1433 msgid "the exception." msgstr "例外。" -#: ../../library/asyncio-eventloop.rst:1412 +#: ../../library/asyncio-eventloop.rst:1437 msgid "" "This method should not be overloaded in subclassed event loops. For custom " "exception handling, use the :meth:`set_exception_handler` method." msgstr "" -"此方法不應在子類別事件迴圈中被覆寫。為了自定義例外處理,請使" -"用 :meth:`set_exception_handler` 方法。" +"此方法不應在子類別事件迴圈中被覆寫。為了自定義例外處理,請使用 :meth:" +"`set_exception_handler` 方法。" -#: ../../library/asyncio-eventloop.rst:1417 +#: ../../library/asyncio-eventloop.rst:1442 msgid "Enabling debug mode" msgstr "啟用除錯模式" -#: ../../library/asyncio-eventloop.rst:1421 +#: ../../library/asyncio-eventloop.rst:1446 msgid "Get the debug mode (:class:`bool`) of the event loop." msgstr "取得事件迴圈的除錯模式(\\ :class:`bool`\\ )。" -#: ../../library/asyncio-eventloop.rst:1423 +#: ../../library/asyncio-eventloop.rst:1448 msgid "" -"The default value is ``True`` if the environment " -"variable :envvar:`PYTHONASYNCIODEBUG` is set to a non-empty string, " -"``False`` otherwise." +"The default value is ``True`` if the environment variable :envvar:" +"`PYTHONASYNCIODEBUG` is set to a non-empty string, ``False`` otherwise." msgstr "" "如果環境變數 :envvar:`PYTHONASYNCIODEBUG` 被設定為非空字串,則預設值為 " "``True``,否則為 ``False``。" -#: ../../library/asyncio-eventloop.rst:1429 +#: ../../library/asyncio-eventloop.rst:1454 msgid "Set the debug mode of the event loop." msgstr "設定事件迴圈的除錯模式。" -#: ../../library/asyncio-eventloop.rst:1433 +#: ../../library/asyncio-eventloop.rst:1458 msgid "" "The new :ref:`Python Development Mode ` can now also be used to " "enable the debug mode." msgstr "現在也可以使用新的 :ref:`Python 開發模式 ` 啟用除錯模式。" -#: ../../library/asyncio-eventloop.rst:1438 +#: ../../library/asyncio-eventloop.rst:1463 msgid "" "This attribute can be used to set the minimum execution duration in seconds " "that is considered \"slow\". When debug mode is enabled, \"slow\" callbacks " "are logged." msgstr "" -"此屬性可用於設定被視為\"慢\"的最短執行時間(以秒為單位)。啟用偵錯模式後," -"\"慢\"回呼將被記錄。" +"此屬性可用於設定被視為\"慢\"的最短執行時間(以秒為單位)。啟用偵錯模式" +"後,\"慢\"回呼將被記錄。" -#: ../../library/asyncio-eventloop.rst:1442 +#: ../../library/asyncio-eventloop.rst:1467 msgid "Default value is 100 milliseconds." msgstr "預設值為 100 毫秒" -#: ../../library/asyncio-eventloop.rst:1446 +#: ../../library/asyncio-eventloop.rst:1471 msgid "The :ref:`debug mode of asyncio `." msgstr ":ref:`asyncio 的除錯模式 `。" -#: ../../library/asyncio-eventloop.rst:1450 +#: ../../library/asyncio-eventloop.rst:1475 msgid "Running Subprocesses" msgstr "運行子行程" -#: ../../library/asyncio-eventloop.rst:1452 +#: ../../library/asyncio-eventloop.rst:1477 msgid "" "Methods described in this subsections are low-level. In regular async/await " "code consider using the high-level :func:`asyncio.create_subprocess_shell` " "and :func:`asyncio.create_subprocess_exec` convenience functions instead." msgstr "" -"本小節描述的方法是低階的。在常規的 async/await 程式碼中,請考慮使用高" -"階 :func:`asyncio.create_subprocess_shell` " -"和 :func:`asyncio.create_subprocess_exec` 輔助功能而不是。" +"本小節描述的方法是低階的。在常規的 async/await 程式碼中,請考慮使用高階 :" +"func:`asyncio.create_subprocess_shell` 和 :func:`asyncio." +"create_subprocess_exec` 輔助功能而不是。" -#: ../../library/asyncio-eventloop.rst:1459 +#: ../../library/asyncio-eventloop.rst:1484 msgid "" "On Windows, the default event loop :class:`ProactorEventLoop` supports " -"subprocesses, whereas :class:`SelectorEventLoop` does not. " -"See :ref:`Subprocess Support on Windows ` for " -"details." +"subprocesses, whereas :class:`SelectorEventLoop` does not. See :ref:" +"`Subprocess Support on Windows ` for details." msgstr "" -"在 Windows 上,預設事件迴圈 :class:`ProactorEventLoop` 支援子行程," -"而 :class:`SelectorEventLoop` 不支援。詳細資訊請參見 :ref:`Windows 上對於子行" -"程的支援 `。" +"在 Windows 上,預設事件迴圈 :class:`ProactorEventLoop` 支援子行程,而 :class:" +"`SelectorEventLoop` 不支援。詳細資訊請參見 :ref:`Windows 上對於子行程的支援 " +"`。" -#: ../../library/asyncio-eventloop.rst:1470 +#: ../../library/asyncio-eventloop.rst:1496 msgid "" "Create a subprocess from one or more string arguments specified by *args*." msgstr "從 *args* 指定的一個或多個字串引數建立子行程。" -#: ../../library/asyncio-eventloop.rst:1473 +#: ../../library/asyncio-eventloop.rst:1499 msgid "*args* must be a list of strings represented by:" msgstr "*args* 必須是由以下項表示的字串串列:" -#: ../../library/asyncio-eventloop.rst:1475 +#: ../../library/asyncio-eventloop.rst:1501 msgid ":class:`str`;" msgstr ":class:`str`;" -#: ../../library/asyncio-eventloop.rst:1476 +#: ../../library/asyncio-eventloop.rst:1502 msgid "" "or :class:`bytes`, encoded to the :ref:`filesystem encoding `." msgstr "或 :class:`bytes`,編碼為 :ref:`檔案系統編碼 `。" -#: ../../library/asyncio-eventloop.rst:1479 +#: ../../library/asyncio-eventloop.rst:1505 msgid "" "The first string specifies the program executable, and the remaining strings " "specify the arguments. Together, string arguments form the ``argv`` of the " @@ -2242,7 +2235,7 @@ msgstr "" "第一個字串指定程序可執行檔案,其餘字串指定引數。字串引數一起組成程序的 " "``argv``。" -#: ../../library/asyncio-eventloop.rst:1483 +#: ../../library/asyncio-eventloop.rst:1509 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=False`` and the list of strings passed as the first " @@ -2253,75 +2246,75 @@ msgstr "" "字串串列作為第一個引數傳遞;然而,:class:`~subprocess.Popen` 接受單個字串串列" "引數,*subprocess_exec* 接受多個字串引數。" -#: ../../library/asyncio-eventloop.rst:1489 +#: ../../library/asyncio-eventloop.rst:1515 msgid "" -"The *protocol_factory* must be a callable returning a subclass of " -"the :class:`asyncio.SubprocessProtocol` class." +"The *protocol_factory* must be a callable returning a subclass of the :class:" +"`asyncio.SubprocessProtocol` class." msgstr "" "*protocol_factory* 必須是回傳 :class:`asyncio.SubprocessProtocol` 子類別的可" "呼叫物件。" -#: ../../library/asyncio-eventloop.rst:1492 +#: ../../library/asyncio-eventloop.rst:1518 msgid "Other parameters:" msgstr "其他參數:" -#: ../../library/asyncio-eventloop.rst:1494 +#: ../../library/asyncio-eventloop.rst:1520 msgid "*stdin* can be any of these:" msgstr "*stdin* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1496 -#: ../../library/asyncio-eventloop.rst:1507 -#: ../../library/asyncio-eventloop.rst:1517 +#: ../../library/asyncio-eventloop.rst:1522 +#: ../../library/asyncio-eventloop.rst:1533 +#: ../../library/asyncio-eventloop.rst:1543 msgid "a file-like object" msgstr "類檔案物件" -#: ../../library/asyncio-eventloop.rst:1497 +#: ../../library/asyncio-eventloop.rst:1523 msgid "" "an existing file descriptor (a positive integer), for example those created " "with :meth:`os.pipe`" msgstr "現有的檔案描述器(正整數),例如用 :meth:`os.pipe` 建立的" -#: ../../library/asyncio-eventloop.rst:1498 -#: ../../library/asyncio-eventloop.rst:1508 -#: ../../library/asyncio-eventloop.rst:1518 +#: ../../library/asyncio-eventloop.rst:1524 +#: ../../library/asyncio-eventloop.rst:1534 +#: ../../library/asyncio-eventloop.rst:1544 msgid "" "the :const:`subprocess.PIPE` constant (default) which will create a new pipe " "and connect it," msgstr ":const:`subprocess.PIPE` 常數(預設),它將建立一個新的管道並連線," -#: ../../library/asyncio-eventloop.rst:1500 -#: ../../library/asyncio-eventloop.rst:1510 -#: ../../library/asyncio-eventloop.rst:1520 +#: ../../library/asyncio-eventloop.rst:1526 +#: ../../library/asyncio-eventloop.rst:1536 +#: ../../library/asyncio-eventloop.rst:1546 msgid "" "the value ``None`` which will make the subprocess inherit the file " "descriptor from this process" msgstr "值 ``None`` 將使子行程從此行程繼承檔案描述器" -#: ../../library/asyncio-eventloop.rst:1502 -#: ../../library/asyncio-eventloop.rst:1512 -#: ../../library/asyncio-eventloop.rst:1522 +#: ../../library/asyncio-eventloop.rst:1528 +#: ../../library/asyncio-eventloop.rst:1538 +#: ../../library/asyncio-eventloop.rst:1548 msgid "" -"the :const:`subprocess.DEVNULL` constant which indicates that the " -"special :data:`os.devnull` file will be used" +"the :const:`subprocess.DEVNULL` constant which indicates that the special :" +"data:`os.devnull` file will be used" msgstr "" ":const:`subprocess.DEVNULL` 常數,表示將使用特殊的 :data:`os.devnull` 檔案" -#: ../../library/asyncio-eventloop.rst:1505 +#: ../../library/asyncio-eventloop.rst:1531 msgid "*stdout* can be any of these:" msgstr "*stdout* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1515 +#: ../../library/asyncio-eventloop.rst:1541 msgid "*stderr* can be any of these:" msgstr "*stderr* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1524 +#: ../../library/asyncio-eventloop.rst:1550 msgid "" "the :const:`subprocess.STDOUT` constant which will connect the standard " "error stream to the process' standard output stream" msgstr "" ":const:`subprocess.STDOUT` 常數,它將標準錯誤串流連線到行程的標準輸出串流" -#: ../../library/asyncio-eventloop.rst:1527 +#: ../../library/asyncio-eventloop.rst:1553 msgid "" "All other keyword arguments are passed to :class:`subprocess.Popen` without " "interpretation, except for *bufsize*, *universal_newlines*, *shell*, *text*, " @@ -2331,7 +2324,7 @@ msgstr "" "*bufsize*、*universal_newlines*、*shell*、*text*、*encoding* 和 *errors* 除" "外,這些不應該指定。" -#: ../../library/asyncio-eventloop.rst:1532 +#: ../../library/asyncio-eventloop.rst:1558 msgid "" "The ``asyncio`` subprocess API does not support decoding the streams as " "text. :func:`bytes.decode` can be used to convert the bytes returned from " @@ -2340,43 +2333,43 @@ msgstr "" "``asyncio`` 子行程 API 不支援將串流解碼為文本。可以使用 :func:`bytes.decode` " "將從串流回傳的位元組轉換為文本。" -#: ../../library/asyncio-eventloop.rst:1536 +#: ../../library/asyncio-eventloop.rst:1562 msgid "" "If a file-like object passed as *stdin*, *stdout* or *stderr* represents a " -"pipe, then the other side of this pipe should be registered " -"with :meth:`~loop.connect_write_pipe` or :meth:`~loop.connect_read_pipe` for " -"use with the event loop." +"pipe, then the other side of this pipe should be registered with :meth:" +"`~loop.connect_write_pipe` or :meth:`~loop.connect_read_pipe` for use with " +"the event loop." msgstr "" "如果傳遞給 *stdin*、*stdout* 或 *stderr* 的類檔案物件表示管道,則該管道的另一" -"端應該使用 :meth:`~loop.connect_write_pipe` " -"或 :meth:`~loop.connect_read_pipe` 註冊到事件迴圈中。" +"端應該使用 :meth:`~loop.connect_write_pipe` 或 :meth:`~loop." +"connect_read_pipe` 註冊到事件迴圈中。" -#: ../../library/asyncio-eventloop.rst:1541 +#: ../../library/asyncio-eventloop.rst:1567 msgid "" "See the constructor of the :class:`subprocess.Popen` class for documentation " "on other arguments." msgstr "有關其他引數的文件,請參閱 :class:`subprocess.Popen` 類別的建構函式。" -#: ../../library/asyncio-eventloop.rst:1544 +#: ../../library/asyncio-eventloop.rst:1570 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`asyncio.SubprocessTransport` base class and *protocol* is an " "object instantiated by the *protocol_factory*." msgstr "" -"回傳 ``(transport, protocol)`` 對,其中 *transport* 符" -"合 :class:`asyncio.SubprocessTransport` 基底類別,*protocol* 是由 " -"*protocol_factory* 實例化的物件。" +"回傳 ``(transport, protocol)`` 對,其中 *transport* 符合 :class:`asyncio." +"SubprocessTransport` 基底類別,*protocol* 是由 *protocol_factory* 實例化的物" +"件。" -#: ../../library/asyncio-eventloop.rst:1552 +#: ../../library/asyncio-eventloop.rst:1579 msgid "" -"Create a subprocess from *cmd*, which can be a :class:`str` or " -"a :class:`bytes` string encoded to the :ref:`filesystem encoding `, using the platform's \"shell\" syntax." msgstr "" -"使用平台的 “shell” 語法從 *cmd* 建立子行程,*cmd* 可以是 :class:`str` 或編碼" -"為 :ref:`檔案系統編碼 ` 的 :class:`bytes` 字串。" +"使用平台的 \"shell\" 語法從 *cmd* 建立子行程,*cmd* 可以是 :class:`str` 或編" +"碼為 :ref:`檔案系統編碼 ` 的 :class:`bytes` 字串。" -#: ../../library/asyncio-eventloop.rst:1557 +#: ../../library/asyncio-eventloop.rst:1584 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=True``." @@ -2384,31 +2377,31 @@ msgstr "" "這類似於標準函式庫中的 :class:`subprocess.Popen` 類別,使用 ``shell=True`` 呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1560 +#: ../../library/asyncio-eventloop.rst:1587 msgid "" -"The *protocol_factory* must be a callable returning a subclass of " -"the :class:`SubprocessProtocol` class." +"The *protocol_factory* must be a callable returning a subclass of the :class:" +"`SubprocessProtocol` class." msgstr "" "*protocol_factory* 必須是回傳 :class:`SubprocessProtocol` 子類別的可呼叫物" "件。" -#: ../../library/asyncio-eventloop.rst:1563 +#: ../../library/asyncio-eventloop.rst:1590 msgid "" "See :meth:`~loop.subprocess_exec` for more details about the remaining " "arguments." msgstr "有關其餘引數的更多詳細資訊,請參閱 :meth:`~loop.subprocess_exec`。" -#: ../../library/asyncio-eventloop.rst:1566 +#: ../../library/asyncio-eventloop.rst:1593 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`SubprocessTransport` base class and *protocol* is an object " "instantiated by the *protocol_factory*." msgstr "" -"回傳一對 ``(transport, protocol)``,其中 *transport* 符" -"合 :class:`SubprocessTransport` 基底類別,而 *protocol* 是由 " -"*protocol_factory* 實例化的物件。" +"回傳一對 ``(transport, protocol)``,其中 *transport* 符合 :class:" +"`SubprocessTransport` 基底類別,而 *protocol* 是由 *protocol_factory* 實例化" +"的物件。" -#: ../../library/asyncio-eventloop.rst:1571 +#: ../../library/asyncio-eventloop.rst:1598 msgid "" "It is the application's responsibility to ensure that all whitespace and " "special characters are quoted appropriately to avoid `shell injection " @@ -2417,77 +2410,76 @@ msgid "" "escape whitespace and special characters in strings that are going to be " "used to construct shell commands." msgstr "" -"由應用程式負責確保適當引用所有空白和特殊字元,以避免 `shell 注入 `_\\ 風險。可以使" -"用 :func:`shlex.quote` 函式來正確跳脫用於構建 shell 命令的字串中的空白和特殊" -"字元。" +"由應用程式負責確保適當引用所有空白和特殊字元,以避免 `shell 注入 `_\\ 風險。可以使用 :func:" +"`shlex.quote` 函式來正確跳脫用於構建 shell 命令的字串中的空白和特殊字元。" -#: ../../library/asyncio-eventloop.rst:1580 +#: ../../library/asyncio-eventloop.rst:1607 msgid "Callback Handles" msgstr "回呼處理" -#: ../../library/asyncio-eventloop.rst:1584 +#: ../../library/asyncio-eventloop.rst:1611 msgid "" -"A callback wrapper object returned " -"by :meth:`loop.call_soon`, :meth:`loop.call_soon_threadsafe`." +"A callback wrapper object returned by :meth:`loop.call_soon`, :meth:`loop." +"call_soon_threadsafe`." msgstr "" "由 :meth:`loop.call_soon` 和 :meth:`loop.call_soon_threadsafe` 回傳的回呼包裝" "器。" -#: ../../library/asyncio-eventloop.rst:1589 +#: ../../library/asyncio-eventloop.rst:1616 msgid "" "Return the :class:`contextvars.Context` object associated with the handle." msgstr "回傳與處理相關聯的 :class:`contextvars.Context` 物件。" -#: ../../library/asyncio-eventloop.rst:1596 +#: ../../library/asyncio-eventloop.rst:1623 msgid "" "Cancel the callback. If the callback has already been canceled or executed, " "this method has no effect." msgstr "取消回呼。如果回呼已被取消或執行,此方法將不起作用。" -#: ../../library/asyncio-eventloop.rst:1601 +#: ../../library/asyncio-eventloop.rst:1628 msgid "Return ``True`` if the callback was cancelled." msgstr "如果回呼已被取消,回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1607 +#: ../../library/asyncio-eventloop.rst:1634 msgid "" -"A callback wrapper object returned by :meth:`loop.call_later`, " -"and :meth:`loop.call_at`." +"A callback wrapper object returned by :meth:`loop.call_later`, and :meth:" +"`loop.call_at`." msgstr "由 :meth:`loop.call_later` 和 :meth:`loop.call_at` 回傳的回呼包裝器。" -#: ../../library/asyncio-eventloop.rst:1610 +#: ../../library/asyncio-eventloop.rst:1637 msgid "This class is a subclass of :class:`Handle`." msgstr "這個類別是 :class:`Handle` 的子類別。" -#: ../../library/asyncio-eventloop.rst:1614 +#: ../../library/asyncio-eventloop.rst:1641 msgid "Return a scheduled callback time as :class:`float` seconds." msgstr "回傳預定的回呼時間,以 :class:`float` 秒為單位。" -#: ../../library/asyncio-eventloop.rst:1616 +#: ../../library/asyncio-eventloop.rst:1643 msgid "" -"The time is an absolute timestamp, using the same time reference " -"as :meth:`loop.time`." +"The time is an absolute timestamp, using the same time reference as :meth:" +"`loop.time`." msgstr "時間是一個絕對的時間戳,使用與 :meth:`loop.time` 相同的時間參照。" -#: ../../library/asyncio-eventloop.rst:1623 +#: ../../library/asyncio-eventloop.rst:1650 msgid "Server Objects" msgstr "Server 物件" -#: ../../library/asyncio-eventloop.rst:1625 +#: ../../library/asyncio-eventloop.rst:1652 msgid "" -"Server objects are created " -"by :meth:`loop.create_server`, :meth:`loop.create_unix_server`, :func:`start_server`, " -"and :func:`start_unix_server` functions." +"Server objects are created by :meth:`loop.create_server`, :meth:`loop." +"create_unix_server`, :func:`start_server`, and :func:`start_unix_server` " +"functions." msgstr "" -"Server 物件是" -"由 :meth:`loop.create_server`、:meth:`loop.create_unix_server`、:func:`start_server` " -"和 :func:`start_unix_server` 函式所建立。" +"Server 物件是由 :meth:`loop.create_server`、:meth:`loop." +"create_unix_server`、:func:`start_server` 和 :func:`start_unix_server` 函式所" +"建立。" -#: ../../library/asyncio-eventloop.rst:1629 +#: ../../library/asyncio-eventloop.rst:1656 msgid "Do not instantiate the :class:`Server` class directly." msgstr "請勿直接實例化 :class:`Server` 類別。" -#: ../../library/asyncio-eventloop.rst:1633 +#: ../../library/asyncio-eventloop.rst:1660 msgid "" "*Server* objects are asynchronous context managers. When used in an ``async " "with`` statement, it's guaranteed that the Server object is closed and not " @@ -2496,7 +2488,7 @@ msgstr "" "*Server* 物件是非同步情境管理器。當在 ``async with`` 陳述中使用時,可以保證在" "完成 ``async with`` 陳述時,Server 物件將會關閉並停止接受新的連線: ::" -#: ../../library/asyncio-eventloop.rst:1638 +#: ../../library/asyncio-eventloop.rst:1665 msgid "" "srv = await loop.create_server(...)\n" "\n" @@ -2512,30 +2504,30 @@ msgstr "" "\n" "# 此時 srv 已關閉,不再接受新的連線。" -#: ../../library/asyncio-eventloop.rst:1646 +#: ../../library/asyncio-eventloop.rst:1673 msgid "Server object is an asynchronous context manager since Python 3.7." msgstr "自 Python 3.7 起,Server 物件是非同步情境管理器。" -#: ../../library/asyncio-eventloop.rst:1649 +#: ../../library/asyncio-eventloop.rst:1676 msgid "" "This class was exposed publicly as ``asyncio.Server`` in Python 3.9.11, " "3.10.3 and 3.11." msgstr "" "此類別在 Python 3.9.11、3.10.3 和 3.11 中以 ``asyncio.Server`` 的形式被公開。" -#: ../../library/asyncio-eventloop.rst:1654 +#: ../../library/asyncio-eventloop.rst:1681 msgid "" "Stop serving: close listening sockets and set the :attr:`sockets` attribute " "to ``None``." msgstr "停止服務:關閉監聽的 sockets 並將 :attr:`sockets` 屬性設為 ``None``。" -#: ../../library/asyncio-eventloop.rst:1657 +#: ../../library/asyncio-eventloop.rst:1684 msgid "" "The sockets that represent existing incoming client connections are left " "open." msgstr "代表現有傳入用戶端連線的 sockets 仍然保持開啟。" -#: ../../library/asyncio-eventloop.rst:1660 +#: ../../library/asyncio-eventloop.rst:1687 msgid "" "The server is closed asynchronously; use the :meth:`wait_closed` coroutine " "to wait until the server is closed (and no more connections are active)." @@ -2543,53 +2535,53 @@ msgstr "" "伺服器以非同步方式關閉;使用 :meth:`wait_close` 協程等待伺服器關閉(不再有活" "躍連線)。" -#: ../../library/asyncio-eventloop.rst:1666 +#: ../../library/asyncio-eventloop.rst:1693 msgid "Close all existing incoming client connections." msgstr "關閉所有現有的傳入客戶端連線。" -#: ../../library/asyncio-eventloop.rst:1668 +#: ../../library/asyncio-eventloop.rst:1695 msgid "" "Calls :meth:`~asyncio.BaseTransport.close` on all associated transports." msgstr "在所有關聯的傳輸上呼叫 :meth:`~asyncio.BaseTransport.close`。" -#: ../../library/asyncio-eventloop.rst:1671 +#: ../../library/asyncio-eventloop.rst:1698 msgid "" ":meth:`close` should be called before :meth:`close_clients` when closing the " "server to avoid races with new clients connecting." msgstr "" -#: ../../library/asyncio-eventloop.rst:1678 +#: ../../library/asyncio-eventloop.rst:1705 msgid "" "Close all existing incoming client connections immediately, without waiting " "for pending operations to complete." msgstr "立即關閉所有現有的傳入客戶端連線,而不等待待定操作完成。" -#: ../../library/asyncio-eventloop.rst:1681 +#: ../../library/asyncio-eventloop.rst:1708 msgid "" "Calls :meth:`~asyncio.WriteTransport.abort` on all associated transports." msgstr "在所有關聯的傳輸上呼叫 :meth:`~asyncio.BaseTransport.close`。" -#: ../../library/asyncio-eventloop.rst:1684 +#: ../../library/asyncio-eventloop.rst:1711 msgid "" ":meth:`close` should be called before :meth:`abort_clients` when closing the " "server to avoid races with new clients connecting." msgstr "" -#: ../../library/asyncio-eventloop.rst:1691 +#: ../../library/asyncio-eventloop.rst:1718 msgid "Return the event loop associated with the server object." msgstr "回傳與伺服器物件關聯的事件迴圈。" -#: ../../library/asyncio-eventloop.rst:1697 +#: ../../library/asyncio-eventloop.rst:1725 msgid "Start accepting connections." msgstr "開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1699 +#: ../../library/asyncio-eventloop.rst:1727 msgid "" "This method is idempotent, so it can be called when the server is already " "serving." msgstr "此方法是幂等的,因此可以在伺服器已經運行時呼叫。" -#: ../../library/asyncio-eventloop.rst:1702 +#: ../../library/asyncio-eventloop.rst:1730 msgid "" "The *start_serving* keyword-only parameter to :meth:`loop.create_server` " "and :meth:`asyncio.start_server` allows creating a Server object that is not " @@ -2597,19 +2589,19 @@ msgid "" "or :meth:`Server.serve_forever` can be used to make the Server start " "accepting connections." msgstr "" -"*start_serving* 僅限關鍵字參數只能在 :meth:`loop.create_server` " -"和 :meth:`asyncio.start_server` 中使用,允許建立一個最初不接受連線的 Server " -"物件。在這種情況下,可以使用 ``Server.start_serving()`` " -"或 :meth:`Server.serve_forever` 來使 Server 開始接受連線。" +"*start_serving* 僅限關鍵字參數只能在 :meth:`loop.create_server` 和 :meth:" +"`asyncio.start_server` 中使用,允許建立一個最初不接受連線的 Server 物件。在這" +"種情況下,可以使用 ``Server.start_serving()`` 或 :meth:`Server." +"serve_forever` 來使 Server 開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1713 +#: ../../library/asyncio-eventloop.rst:1742 msgid "" "Start accepting connections until the coroutine is cancelled. Cancellation " "of ``serve_forever`` task causes the server to be closed." msgstr "" "開始接受連線,直到協程被取消。取消 ``serve_forever`` 任務會導致伺服器關閉。" -#: ../../library/asyncio-eventloop.rst:1717 +#: ../../library/asyncio-eventloop.rst:1746 msgid "" "This method can be called if the server is already accepting connections. " "Only one ``serve_forever`` task can exist per one *Server* object." @@ -2617,7 +2609,7 @@ msgstr "" "如果伺服器已經接受連線,則可以呼叫此方法。每個 *Server* 物件只能存在一個 " "``serve_forever`` 任務。" -#: ../../library/asyncio-eventloop.rst:1723 +#: ../../library/asyncio-eventloop.rst:1752 msgid "" "async def client_connected(reader, writer):\n" " # Communicate with the client with\n" @@ -2643,24 +2635,24 @@ msgstr "" "\n" "asyncio.run(main('127.0.0.1', 0))" -#: ../../library/asyncio-eventloop.rst:1739 +#: ../../library/asyncio-eventloop.rst:1768 msgid "Return ``True`` if the server is accepting new connections." msgstr "如果伺服器正在接受新連線,則回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1745 +#: ../../library/asyncio-eventloop.rst:1775 msgid "" "Wait until the :meth:`close` method completes and all active connections " "have finished." msgstr "等待 :meth:`close` 方法完成且所有活動連線都已結束。" -#: ../../library/asyncio-eventloop.rst:1750 +#: ../../library/asyncio-eventloop.rst:1780 msgid "" "List of socket-like objects, ``asyncio.trsock.TransportSocket``, which the " "server is listening on." msgstr "" "伺服器正在監聽的類似 socket 的物件串列,``asyncio.trsock.TransportSocket``。" -#: ../../library/asyncio-eventloop.rst:1753 +#: ../../library/asyncio-eventloop.rst:1783 msgid "" "Prior to Python 3.7 ``Server.sockets`` used to return an internal list of " "server sockets directly. In 3.7 a copy of that list is returned." @@ -2668,29 +2660,29 @@ msgstr "" "在 Python 3.7 之前,``Server.sockets`` 曾經直接回傳內部伺服器 sockets 的串" "列。在 3.7 中回傳了該串列的副本。" -#: ../../library/asyncio-eventloop.rst:1763 +#: ../../library/asyncio-eventloop.rst:1793 msgid "Event Loop Implementations" msgstr "事件迴圈實作" -#: ../../library/asyncio-eventloop.rst:1765 +#: ../../library/asyncio-eventloop.rst:1795 msgid "" -"asyncio ships with two different event loop " -"implementations: :class:`SelectorEventLoop` and :class:`ProactorEventLoop`." +"asyncio ships with two different event loop implementations: :class:" +"`SelectorEventLoop` and :class:`ProactorEventLoop`." msgstr "" -"asyncio 內附兩個不同的事件迴圈實作::class:`SelectorEventLoop` " -"和 :class:`ProactorEventLoop`。" +"asyncio 內附兩個不同的事件迴圈實作::class:`SelectorEventLoop` 和 :class:" +"`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1768 +#: ../../library/asyncio-eventloop.rst:1798 msgid "By default asyncio is configured to use :class:`EventLoop`." msgstr "預設情況下,asyncio 被配置為要使用 :class:`EventLoop`。" -#: ../../library/asyncio-eventloop.rst:1773 +#: ../../library/asyncio-eventloop.rst:1803 msgid "" "A subclass of :class:`AbstractEventLoop` based on the :mod:`selectors` " "module." msgstr "基於 :mod:`selectors` 模組的一個 :class:`AbstractEventLoop` 子類別。" -#: ../../library/asyncio-eventloop.rst:1776 +#: ../../library/asyncio-eventloop.rst:1806 msgid "" "Uses the most efficient *selector* available for the given platform. It is " "also possible to manually configure the exact selector implementation to be " @@ -2699,7 +2691,7 @@ msgstr "" "使用特定平台上最有效的 *selector*。也可以手動配置要使用的確切 selector 實" "作: ::" -#: ../../library/asyncio-eventloop.rst:1780 +#: ../../library/asyncio-eventloop.rst:1810 msgid "" "import asyncio\n" "import selectors\n" @@ -2721,7 +2713,7 @@ msgstr "" "\n" "asyncio.set_event_loop_policy(MyPolicy())" -#: ../../library/asyncio-eventloop.rst:1796 +#: ../../library/asyncio-eventloop.rst:1826 msgid "" "A subclass of :class:`AbstractEventLoop` for Windows that uses \"I/O " "Completion Ports\" (IOCP)." @@ -2729,7 +2721,7 @@ msgstr "" "用於 Windows 的 :class:`AbstractEventLoop` 子類別,使用「I/O 完成埠 (IOCP, I/" "O Completion Ports)」。" -#: ../../library/asyncio-eventloop.rst:1802 +#: ../../library/asyncio-eventloop.rst:1832 msgid "" "`MSDN documentation on I/O Completion Ports `_." @@ -2737,25 +2729,25 @@ msgstr "" "`I/O 完成埠的 MSDN 文件 `_。" -#: ../../library/asyncio-eventloop.rst:1807 +#: ../../library/asyncio-eventloop.rst:1837 msgid "" -"An alias to the most efficient available subclass " -"of :class:`AbstractEventLoop` for the given platform." +"An alias to the most efficient available subclass of :class:" +"`AbstractEventLoop` for the given platform." msgstr "" -#: ../../library/asyncio-eventloop.rst:1810 +#: ../../library/asyncio-eventloop.rst:1840 msgid "" -"It is an alias to :class:`SelectorEventLoop` on Unix " -"and :class:`ProactorEventLoop` on Windows." +"It is an alias to :class:`SelectorEventLoop` on Unix and :class:" +"`ProactorEventLoop` on Windows." msgstr "" -"在 Unix 上是 :class:`SelectorEventLoop` 的別名,在 Windows 上" -"是 :class:`ProactorEventLoop` 的別名。" +"在 Unix 上是 :class:`SelectorEventLoop` 的別名,在 Windows 上是 :class:" +"`ProactorEventLoop` 的別名。" -#: ../../library/asyncio-eventloop.rst:1816 +#: ../../library/asyncio-eventloop.rst:1846 msgid "Abstract base class for asyncio-compliant event loops." msgstr "為符合 asyncio 標準的事件迴圈的抽象基礎類別。" -#: ../../library/asyncio-eventloop.rst:1818 +#: ../../library/asyncio-eventloop.rst:1848 msgid "" "The :ref:`asyncio-event-loop-methods` section lists all methods that an " "alternative implementation of ``AbstractEventLoop`` should have defined." @@ -2763,27 +2755,26 @@ msgstr "" ":ref:`asyncio-event-loop-methods` 部分列出了替代 ``AbstractEventLoop`` 實作應" "該定義的所有方法。" -#: ../../library/asyncio-eventloop.rst:1824 +#: ../../library/asyncio-eventloop.rst:1854 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-eventloop.rst:1826 +#: ../../library/asyncio-eventloop.rst:1856 msgid "" "Note that all examples in this section **purposefully** show how to use the " -"low-level event loop APIs, such as :meth:`loop.run_forever` " -"and :meth:`loop.call_soon`. Modern asyncio applications rarely need to be " -"written this way; consider using the high-level functions " -"like :func:`asyncio.run`." +"low-level event loop APIs, such as :meth:`loop.run_forever` and :meth:`loop." +"call_soon`. Modern asyncio applications rarely need to be written this way; " +"consider using the high-level functions like :func:`asyncio.run`." msgstr "" -"請注意,本節中的所有範例都 **故意** 展示如何使用低階事件迴圈 API," -"如 :meth:`loop.run_forever` 和 :meth:`loop.call_soon`。現代 asyncio 應用程式" -"很少需要這種方式撰寫;請考慮使用高階的函式,如 :func:`asyncio.run`。" +"請注意,本節中的所有範例都 **故意** 展示如何使用低階事件迴圈 API,如 :meth:" +"`loop.run_forever` 和 :meth:`loop.call_soon`。現代 asyncio 應用程式很少需要這" +"種方式撰寫;請考慮使用高階的函式,如 :func:`asyncio.run`。" -#: ../../library/asyncio-eventloop.rst:1836 +#: ../../library/asyncio-eventloop.rst:1866 msgid "Hello World with call_soon()" msgstr "使用 call_soon() 的 Hello World 範例" -#: ../../library/asyncio-eventloop.rst:1838 +#: ../../library/asyncio-eventloop.rst:1868 msgid "" "An example using the :meth:`loop.call_soon` method to schedule a callback. " "The callback displays ``\"Hello World\"`` and then stops the event loop::" @@ -2791,7 +2782,7 @@ msgstr "" "使用 :meth:`loop.call_soon` 方法排程回呼的範例。回呼會顯示 ``\"Hello " "World\"``,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1842 +#: ../../library/asyncio-eventloop.rst:1872 msgid "" "import asyncio\n" "\n" @@ -2829,18 +2820,18 @@ msgstr "" "finally:\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:1862 +#: ../../library/asyncio-eventloop.rst:1892 msgid "" "A similar :ref:`Hello World ` example created with a coroutine " "and the :func:`run` function." msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`Hello World ` 範例。" -#: ../../library/asyncio-eventloop.rst:1869 +#: ../../library/asyncio-eventloop.rst:1899 msgid "Display the current date with call_later()" msgstr "使用 call_later() 顯示目前日期" -#: ../../library/asyncio-eventloop.rst:1871 +#: ../../library/asyncio-eventloop.rst:1901 msgid "" "An example of a callback displaying the current date every second. The " "callback uses the :meth:`loop.call_later` method to reschedule itself after " @@ -2849,7 +2840,7 @@ msgstr "" "一個回呼的範例,每秒顯示目前日期。回呼使用 :meth:`loop.call_later` 方法在 5 " "秒後重新排程自己,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1875 +#: ../../library/asyncio-eventloop.rst:1905 msgid "" "import asyncio\n" "import datetime\n" @@ -2895,7 +2886,7 @@ msgstr "" "finally:\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:1899 +#: ../../library/asyncio-eventloop.rst:1929 msgid "" "A similar :ref:`current date ` example created with a " "coroutine and the :func:`run` function." @@ -2903,19 +2894,19 @@ msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`current date " "` 範例。" -#: ../../library/asyncio-eventloop.rst:1906 +#: ../../library/asyncio-eventloop.rst:1936 msgid "Watch a file descriptor for read events" msgstr "監聽檔案描述器以進行讀取事件" -#: ../../library/asyncio-eventloop.rst:1908 +#: ../../library/asyncio-eventloop.rst:1938 msgid "" -"Wait until a file descriptor received some data using " -"the :meth:`loop.add_reader` method and then close the event loop::" +"Wait until a file descriptor received some data using the :meth:`loop." +"add_reader` method and then close the event loop::" msgstr "" "使用 :meth:`loop.add_reader` 方法等待檔案描述器接收到某些資料,然後關閉事件迴" "圈: ::" -#: ../../library/asyncio-eventloop.rst:1911 +#: ../../library/asyncio-eventloop.rst:1941 msgid "" "import asyncio\n" "from socket import socketpair\n" @@ -2983,7 +2974,7 @@ msgstr "" " wsock.close()\n" " loop.close()" -#: ../../library/asyncio-eventloop.rst:1946 +#: ../../library/asyncio-eventloop.rst:1976 msgid "" "A similar :ref:`example ` using " "transports, protocols, and the :meth:`loop.create_connection` method." @@ -2991,7 +2982,7 @@ msgstr "" "使用傳輸、協定和 :meth:`loop.create_connection` 方法的類似 :ref:`範例 " "`。" -#: ../../library/asyncio-eventloop.rst:1950 +#: ../../library/asyncio-eventloop.rst:1980 msgid "" "Another similar :ref:`example ` " "using the high-level :func:`asyncio.open_connection` function and streams." @@ -2999,24 +2990,23 @@ msgstr "" "另一個使用高階 :func:`asyncio.open_connection` 函式和串流的類似 :ref:`範例 " "`。" -#: ../../library/asyncio-eventloop.rst:1958 +#: ../../library/asyncio-eventloop.rst:1988 msgid "Set signal handlers for SIGINT and SIGTERM" msgstr "設定 SIGINT 和 SIGTERM 的訊號處理程式" -#: ../../library/asyncio-eventloop.rst:1960 +#: ../../library/asyncio-eventloop.rst:1990 msgid "(This ``signals`` example only works on Unix.)" msgstr "(此 ``signals`` 範例僅在 Unix 上運作。)" -#: ../../library/asyncio-eventloop.rst:1962 +#: ../../library/asyncio-eventloop.rst:1992 msgid "" -"Register handlers for signals :const:`~signal.SIGINT` " -"and :const:`~signal.SIGTERM` using the :meth:`loop.add_signal_handler` " -"method::" +"Register handlers for signals :const:`~signal.SIGINT` and :const:`~signal." +"SIGTERM` using the :meth:`loop.add_signal_handler` method::" msgstr "" -"使用 :meth:`loop.add_signal_handler` 方法註冊訊號 :py:data:`SIGINT` " -"和 :py:data:`SIGTERM` 的處理程式: ::" +"使用 :meth:`loop.add_signal_handler` 方法註冊訊號 :py:data:`SIGINT` 和 :py:" +"data:`SIGTERM` 的處理程式: ::" -#: ../../library/asyncio-eventloop.rst:1965 +#: ../../library/asyncio-eventloop.rst:1995 msgid "" "import asyncio\n" "import functools\n" diff --git a/library/asyncio-queue.po b/library/asyncio-queue.po index 17149ee2f2..90bb2b684a 100644 --- a/library/asyncio-queue.po +++ b/library/asyncio-queue.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-10 00:14+0000\n" +"POT-Creation-Date: 2025-02-23 00:15+0000\n" "PO-Revision-Date: 2022-02-20 18:34+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -39,8 +39,8 @@ msgstr "" #: ../../library/asyncio-queue.rst:17 msgid "" -"Note that methods of asyncio queues don't have a *timeout* parameter; " -"use :func:`asyncio.wait_for` function to do queue operations with a timeout." +"Note that methods of asyncio queues don't have a *timeout* parameter; use :" +"func:`asyncio.wait_for` function to do queue operations with a timeout." msgstr "" "注意 asyncio 的佇列沒有 *timeout* 參數;請使用 :func:`asyncio.wait_for` 函式" "來為佇列新增具有超時 (timeout) 設定的操作。" @@ -64,8 +64,8 @@ msgid "" "queue reaches *maxsize* until an item is removed by :meth:`get`." msgstr "" "如果 *maxsize* 小於或等於零,則佇列大小是無限制的。如果是大於 ``0`` 的整數," -"則當佇列達到 *maxsize* 時,``await put()`` 將會阻塞 (block),直到某個元素" -"被 :meth:`get` 取出。" +"則當佇列達到 *maxsize* 時,``await put()`` 將會阻塞 (block),直到某個元素被 :" +"meth:`get` 取出。" #: ../../library/asyncio-queue.rst:35 msgid "" @@ -97,47 +97,47 @@ msgstr "如果有 :attr:`maxsize` 個條目在佇列中,則回傳 ``True``。" #: ../../library/asyncio-queue.rst:57 msgid "" -"If the queue was initialized with ``maxsize=0`` (the default), " -"then :meth:`full` never returns ``True``." +"If the queue was initialized with ``maxsize=0`` (the default), then :meth:" +"`full` never returns ``True``." msgstr "" "如果佇列用 ``maxsize=0`` (預設)初始化,則 :meth:`full` 永遠不會回傳 " "``True``。" -#: ../../library/asyncio-queue.rst:62 +#: ../../library/asyncio-queue.rst:63 msgid "" "Remove and return an item from the queue. If queue is empty, wait until an " "item is available." msgstr "從佇列中刪除並回傳一個元素。如果佇列為空,則持續等待直到佇列中有元素。" -#: ../../library/asyncio-queue.rst:65 +#: ../../library/asyncio-queue.rst:66 msgid "" "Raises :exc:`QueueShutDown` if the queue has been shut down and is empty, or " "if the queue has been shut down immediately." msgstr "" -#: ../../library/asyncio-queue.rst:70 +#: ../../library/asyncio-queue.rst:71 msgid "" "Return an item if one is immediately available, else raise :exc:`QueueEmpty`." msgstr "如果佇列內有值則立即回傳佇列中的元素,否則引發 :exc:`QueueEmpty`。" -#: ../../library/asyncio-queue.rst:75 +#: ../../library/asyncio-queue.rst:77 msgid "Block until all items in the queue have been received and processed." msgstr "持續阻塞直到佇列中所有的元素都被接收和處理完畢。" -#: ../../library/asyncio-queue.rst:77 +#: ../../library/asyncio-queue.rst:79 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " -"queue. The count goes down whenever a consumer coroutine " -"calls :meth:`task_done` to indicate that the item was retrieved and all work " -"on it is complete. When the count of unfinished tasks drops to " -"zero, :meth:`join` unblocks." +"queue. The count goes down whenever a consumer coroutine calls :meth:" +"`task_done` to indicate that the item was retrieved and all work on it is " +"complete. When the count of unfinished tasks drops to zero, :meth:`join` " +"unblocks." msgstr "" "當條目新增到佇列的時候,未完成任務的計數就會增加。每當一個消耗者 (consumer) " "協程呼叫 :meth:`task_done`,表示這個條目已經被取回且被它包含的所有工作都已完" "成,未完成任務計數就會減少。當未完成計數降到零的時候,:meth:`join` 阻塞會被解" "除 (unblock)。" -#: ../../library/asyncio-queue.rst:85 +#: ../../library/asyncio-queue.rst:88 msgid "" "Put an item into the queue. If the queue is full, wait until a free slot is " "available before adding the item." @@ -145,57 +145,57 @@ msgstr "" "將一個元素放進佇列。如果佇列滿了,在新增元素之前,會持續等待直到有空閒插槽 " "(free slot) 能被使用。" -#: ../../library/asyncio-queue.rst:88 +#: ../../library/asyncio-queue.rst:91 msgid "Raises :exc:`QueueShutDown` if the queue has been shut down." msgstr "如果佇列已經被關閉,則引發 :exc:`QueueShutDown`。" -#: ../../library/asyncio-queue.rst:92 +#: ../../library/asyncio-queue.rst:95 msgid "Put an item into the queue without blocking." msgstr "不阻塞地將一個元素放入佇列。" -#: ../../library/asyncio-queue.rst:94 +#: ../../library/asyncio-queue.rst:97 msgid "If no free slot is immediately available, raise :exc:`QueueFull`." msgstr "如果沒有立即可用的空閒插槽,引發 :exc:`QueueFull`。" -#: ../../library/asyncio-queue.rst:98 +#: ../../library/asyncio-queue.rst:101 msgid "Return the number of items in the queue." msgstr "回傳佇列中的元素數量。" -#: ../../library/asyncio-queue.rst:102 +#: ../../library/asyncio-queue.rst:105 msgid "" -"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` " -"raise :exc:`QueueShutDown`." +"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` raise :" +"exc:`QueueShutDown`." msgstr "" -#: ../../library/asyncio-queue.rst:105 +#: ../../library/asyncio-queue.rst:108 msgid "" "By default, :meth:`~Queue.get` on a shut down queue will only raise once the " "queue is empty. Set *immediate* to true to make :meth:`~Queue.get` raise " "immediately instead." msgstr "" -#: ../../library/asyncio-queue.rst:109 +#: ../../library/asyncio-queue.rst:112 msgid "" "All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be " "unblocked. If *immediate* is true, a task will be marked as done for each " -"remaining item in the queue, which may unblock callers " -"of :meth:`~Queue.join`." +"remaining item in the queue, which may unblock callers of :meth:`~Queue." +"join`." msgstr "" -#: ../../library/asyncio-queue.rst:118 +#: ../../library/asyncio-queue.rst:121 msgid "Indicate that a formerly enqueued work item is complete." msgstr "表示前面一個排隊的工作項目已經完成。" -#: ../../library/asyncio-queue.rst:120 +#: ../../library/asyncio-queue.rst:123 msgid "" "Used by queue consumers. For each :meth:`~Queue.get` used to fetch a work " "item, a subsequent call to :meth:`task_done` tells the queue that the " "processing on the work item is complete." msgstr "" -"由佇列消耗者使用。對於每個用於取得一個工作項目的 :meth:`~Queue.get`,接續" -"的 :meth:`task_done` 呼叫會告訴佇列這個工作項目的處理已經完成。" +"由佇列消耗者使用。對於每個用於取得一個工作項目的 :meth:`~Queue.get`,接續的 :" +"meth:`task_done` 呼叫會告訴佇列這個工作項目的處理已經完成。" -#: ../../library/asyncio-queue.rst:124 +#: ../../library/asyncio-queue.rst:127 msgid "" "If a :meth:`join` is currently blocking, it will resume when all items have " "been processed (meaning that a :meth:`task_done` call was received for every " @@ -204,53 +204,53 @@ msgstr "" "如果 :meth:`join` 目前正在阻塞,在所有項目都被處理後會解除阻塞(意味著每個" "以 :meth:`~Queue.put` 放進佇列的條目都會收到一個 :meth:`task_done`)。" -#: ../../library/asyncio-queue.rst:129 +#: ../../library/asyncio-queue.rst:132 msgid "" "``shutdown(immediate=True)`` calls :meth:`task_done` for each remaining item " "in the queue." msgstr "" -#: ../../library/asyncio-queue.rst:132 +#: ../../library/asyncio-queue.rst:135 msgid "" "Raises :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "如果被呼叫的次數多於放入佇列中的項目數量,將引發 :exc:`ValueError`。" -#: ../../library/asyncio-queue.rst:137 +#: ../../library/asyncio-queue.rst:140 msgid "Priority Queue" msgstr "Priority Queue(優先佇列)" -#: ../../library/asyncio-queue.rst:141 +#: ../../library/asyncio-queue.rst:144 msgid "" "A variant of :class:`Queue`; retrieves entries in priority order (lowest " "first)." msgstr ":class:`Queue` 的變形;按優先順序取出條目 (最小的先取出)。" -#: ../../library/asyncio-queue.rst:144 +#: ../../library/asyncio-queue.rst:147 msgid "Entries are typically tuples of the form ``(priority_number, data)``." msgstr "條目通常是 ``(priority_number, data)`` 形式的 tuple(元組)。" -#: ../../library/asyncio-queue.rst:149 +#: ../../library/asyncio-queue.rst:152 msgid "LIFO Queue" msgstr "LIFO Queue" -#: ../../library/asyncio-queue.rst:153 +#: ../../library/asyncio-queue.rst:156 msgid "" "A variant of :class:`Queue` that retrieves most recently added entries first " "(last in, first out)." msgstr ":class:`Queue` 的變形,先取出最近新增的條目(後進先出)。" -#: ../../library/asyncio-queue.rst:158 +#: ../../library/asyncio-queue.rst:161 msgid "Exceptions" msgstr "例外" -#: ../../library/asyncio-queue.rst:162 +#: ../../library/asyncio-queue.rst:165 msgid "" "This exception is raised when the :meth:`~Queue.get_nowait` method is called " "on an empty queue." msgstr "當佇列為空的時候,呼叫 :meth:`~Queue.get_nowait` 方法會引發這個例外。" -#: ../../library/asyncio-queue.rst:168 +#: ../../library/asyncio-queue.rst:171 msgid "" "Exception raised when the :meth:`~Queue.put_nowait` method is called on a " "queue that has reached its *maxsize*." @@ -258,22 +258,22 @@ msgstr "" "當佇列中條目數量已經達到它的 *maxsize* 時,呼叫 :meth:`~Queue.put_nowait` 方" "法會引發這個例外。" -#: ../../library/asyncio-queue.rst:174 +#: ../../library/asyncio-queue.rst:177 msgid "" "Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on " "a queue which has been shut down." msgstr "" -#: ../../library/asyncio-queue.rst:181 +#: ../../library/asyncio-queue.rst:184 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-queue.rst:185 +#: ../../library/asyncio-queue.rst:188 msgid "" "Queues can be used to distribute workload between several concurrent tasks::" msgstr "佇列能被用於多個並行任務的工作分配:" -#: ../../library/asyncio-queue.rst:188 +#: ../../library/asyncio-queue.rst:191 msgid "" "import asyncio\n" "import random\n" diff --git a/library/asyncio-runner.po b/library/asyncio-runner.po index 4030cbdb6e..edf75f6778 100644 --- a/library/asyncio-runner.po +++ b/library/asyncio-runner.po @@ -63,27 +63,28 @@ msgstr "當另一個非同步事件迴圈在同一執行緒中執行時,無法 #: ../../library/asyncio-runner.rst:36 ../../library/asyncio-runner.rst:85 msgid "" "If *debug* is ``True``, the event loop will be run in debug mode. ``False`` " -"disables debug mode explicitly. ``None`` is used to respect the global :ref:" -"`asyncio-debug-mode` settings." +"disables debug mode explicitly. ``None`` is used to respect the " +"global :ref:`asyncio-debug-mode` settings." msgstr "" "如果 *debug* 為 ``True``,事件迴圈會以除錯模式執行。``False`` 則會關閉除錯模" "式。``None`` 則會優先使用\\ :ref:`除錯模式 `\\ 的全域設" "定。" #: ../../library/asyncio-runner.rst:40 -#, fuzzy msgid "" "If *loop_factory* is not ``None``, it is used to create a new event loop; " "otherwise :func:`asyncio.new_event_loop` is used. The loop is closed at the " "end. This function should be used as a main entry point for asyncio " "programs, and should ideally only be called once. It is recommended to use " -"*loop_factory* to configure the event loop instead of policies. Passing :" -"class:`asyncio.EventLoop` allows running asyncio without the policy system." +"*loop_factory* to configure the event loop instead of policies. " +"Passing :class:`asyncio.EventLoop` allows running asyncio without the policy " +"system." msgstr "" "如果 *loop_factory* 不為 ``None``,它會被用於建立一個新的事件迴圈;否則會改" "用 :func:`asyncio.new_event_loop`。迴圈會在最後關閉。這個函式應該要作為" "asyncio 程式的主要進入點,且理想上僅會被呼叫一次。推薦使用 *loop_factory* 來" -"設定事件迴圈時而不是使用 policies(政策)。" +"設定事件迴圈時而不是使用 policies(政策)。傳遞 :class:`asyncio.EventLoop` 可" +"以讓 asyncio 在沒有政策系統的情況下運行。" #: ../../library/asyncio-runner.rst:48 msgid "" @@ -135,8 +136,8 @@ msgstr "" #: ../../library/asyncio-runner.rst:82 msgid "" -"Sometimes several top-level async functions should be called in the same :" -"ref:`event loop ` and :class:`contextvars.Context`." +"Sometimes several top-level async functions should be called in the " +"same :ref:`event loop ` and :class:`contextvars.Context`." msgstr "" #: ../../library/asyncio-runner.rst:89 @@ -179,9 +180,9 @@ msgstr "" #: ../../library/asyncio-runner.rst:111 msgid "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *coro* to run in. The runner's default " -"context is used if ``None``." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *coro* to run in. The runner's " +"default context is used if ``None``." msgstr "" #: ../../library/asyncio-runner.rst:120 @@ -216,10 +217,10 @@ msgstr "" #: ../../library/asyncio-runner.rst:143 msgid "" -"When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, :exc:" -"`KeyboardInterrupt` exception is raised in the main thread by default. " -"However this doesn't work with :mod:`asyncio` because it can interrupt " -"asyncio internals and can hang the program from exiting." +"When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-" +"C`, :exc:`KeyboardInterrupt` exception is raised in the main thread by " +"default. However this doesn't work with :mod:`asyncio` because it can " +"interrupt asyncio internals and can hang the program from exiting." msgstr "" #: ../../library/asyncio-runner.rst:148 @@ -247,14 +248,14 @@ msgid "" "handler cancels the main task by calling :meth:`asyncio.Task.cancel` which " "raises :exc:`asyncio.CancelledError` inside the main task. This causes the " "Python stack to unwind, ``try/except`` and ``try/finally`` blocks can be " -"used for resource cleanup. After the main task is cancelled, :meth:`asyncio." -"Runner.run` raises :exc:`KeyboardInterrupt`." +"used for resource cleanup. After the main task is " +"cancelled, :meth:`asyncio.Runner.run` raises :exc:`KeyboardInterrupt`." msgstr "" #: ../../library/asyncio-runner.rst:160 msgid "" -"A user could write a tight loop which cannot be interrupted by :meth:" -"`asyncio.Task.cancel`, in which case the second following :kbd:`Ctrl-C` " -"immediately raises the :exc:`KeyboardInterrupt` without cancelling the main " -"task." +"A user could write a tight loop which cannot be interrupted " +"by :meth:`asyncio.Task.cancel`, in which case the second " +"following :kbd:`Ctrl-C` immediately raises the :exc:`KeyboardInterrupt` " +"without cancelling the main task." msgstr "" diff --git a/library/asyncio-stream.po b/library/asyncio-stream.po index 2b809cf126..6858c444a2 100644 --- a/library/asyncio-stream.po +++ b/library/asyncio-stream.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-25 00:14+0000\n" +"POT-Creation-Date: 2025-02-23 00:15+0000\n" "PO-Revision-Date: 2022-10-31 16:28+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,7 +42,7 @@ msgstr "" msgid "Here is an example of a TCP echo client written using asyncio streams::" msgstr "這是一個使用 asyncio 串流編寫的 TCP echo 客戶端範例: ::" -#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:419 +#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:430 msgid "" "import asyncio\n" "\n" @@ -96,13 +96,13 @@ msgid "" "with streams:" msgstr "下面的高階 asyncio 函式可以用來建立和處理串流:" -#: ../../library/asyncio-stream.rst:58 +#: ../../library/asyncio-stream.rst:59 msgid "" "Establish a network connection and return a pair of ``(reader, writer)`` " "objects." msgstr "建立網路連線並回傳一對 ``(reader, writer)`` 物件。" -#: ../../library/asyncio-stream.rst:61 +#: ../../library/asyncio-stream.rst:62 msgid "" "The returned *reader* and *writer* objects are instances of :class:" "`StreamReader` and :class:`StreamWriter` classes." @@ -110,7 +110,7 @@ msgstr "" "回傳的 *reader* 和 *writer* 物件是 :class:`StreamReader` 和 :class:" "`StreamWriter` 類別的實例。" -#: ../../library/asyncio-stream.rst:64 ../../library/asyncio-stream.rst:110 +#: ../../library/asyncio-stream.rst:65 ../../library/asyncio-stream.rst:112 msgid "" "*limit* determines the buffer size limit used by the returned :class:" "`StreamReader` instance. By default the *limit* is set to 64 KiB." @@ -118,43 +118,43 @@ msgstr "" "*limit* 指定了回傳的 :class:`StreamReader` 實例所使用的緩衝區 (buffer) 大小限" "制。*limit* 預設為 64 KiB。" -#: ../../library/asyncio-stream.rst:68 +#: ../../library/asyncio-stream.rst:69 msgid "" "The rest of the arguments are passed directly to :meth:`loop." "create_connection`." msgstr "其餘的引數會直接傳遞到 :meth:`loop.create_connection`。" -#: ../../library/asyncio-stream.rst:73 ../../library/asyncio-stream.rst:151 +#: ../../library/asyncio-stream.rst:74 ../../library/asyncio-stream.rst:154 msgid "" "The *sock* argument transfers ownership of the socket to the :class:" "`StreamWriter` created. To close the socket, call its :meth:`~asyncio." "StreamWriter.close` method." msgstr "" -#: ../../library/asyncio-stream.rst:77 +#: ../../library/asyncio-stream.rst:78 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "新增 *ssl_handshake_timeout* 參數。" -#: ../../library/asyncio-stream.rst:80 +#: ../../library/asyncio-stream.rst:81 msgid "Added the *happy_eyeballs_delay* and *interleave* parameters." msgstr "新增 *happy_eyeballs_delay* 和 *interleave* 參數。" -#: ../../library/asyncio-stream.rst:83 ../../library/asyncio-stream.rst:126 -#: ../../library/asyncio-stream.rst:161 ../../library/asyncio-stream.rst:191 +#: ../../library/asyncio-stream.rst:84 ../../library/asyncio-stream.rst:128 +#: ../../library/asyncio-stream.rst:164 ../../library/asyncio-stream.rst:195 msgid "Removed the *loop* parameter." msgstr "移除 *loop* 參數。" -#: ../../library/asyncio-stream.rst:86 ../../library/asyncio-stream.rst:129 -#: ../../library/asyncio-stream.rst:164 ../../library/asyncio-stream.rst:194 -#: ../../library/asyncio-stream.rst:387 +#: ../../library/asyncio-stream.rst:87 ../../library/asyncio-stream.rst:131 +#: ../../library/asyncio-stream.rst:167 ../../library/asyncio-stream.rst:198 +#: ../../library/asyncio-stream.rst:397 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "新增 *ssl_shutdown_timeout* 參數。" -#: ../../library/asyncio-stream.rst:99 +#: ../../library/asyncio-stream.rst:101 msgid "Start a socket server." msgstr "啟動 socket 伺服器。" -#: ../../library/asyncio-stream.rst:101 +#: ../../library/asyncio-stream.rst:103 msgid "" "The *client_connected_cb* callback is called whenever a new client " "connection is established. It receives a ``(reader, writer)`` pair as two " @@ -165,7 +165,7 @@ msgstr "" "式會接收到一對引數 ``(reader, writer)``,分別為 :class:`StreamReader` 和 :" "class:`StreamWriter` 的實例。" -#: ../../library/asyncio-stream.rst:106 +#: ../../library/asyncio-stream.rst:108 msgid "" "*client_connected_cb* can be a plain callable or a :ref:`coroutine function " "`; if it is a coroutine function, it will be automatically " @@ -175,47 +175,47 @@ msgstr "" "ref:`協程函式 `;如果它是一個協程函式,它將自動作為 :class:`Task` " "來被排程。" -#: ../../library/asyncio-stream.rst:114 +#: ../../library/asyncio-stream.rst:116 msgid "" "The rest of the arguments are passed directly to :meth:`loop.create_server`." msgstr "剩下的引數將會直接傳遞給 :meth:`loop.create_server`。" -#: ../../library/asyncio-stream.rst:119 ../../library/asyncio-stream.rst:181 +#: ../../library/asyncio-stream.rst:121 ../../library/asyncio-stream.rst:185 msgid "" "The *sock* argument transfers ownership of the socket to the server created. " "To close the socket, call the server's :meth:`~asyncio.Server.close` method." msgstr "" -#: ../../library/asyncio-stream.rst:123 +#: ../../library/asyncio-stream.rst:125 msgid "Added the *ssl_handshake_timeout* and *start_serving* parameters." msgstr "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。" -#: ../../library/asyncio-stream.rst:132 +#: ../../library/asyncio-stream.rst:134 msgid "Added the *keep_alive* parameter." msgstr "新增 *keep_alive* 參數。" -#: ../../library/asyncio-stream.rst:137 +#: ../../library/asyncio-stream.rst:139 msgid "Unix Sockets" msgstr "Unix Sockets" -#: ../../library/asyncio-stream.rst:142 +#: ../../library/asyncio-stream.rst:145 msgid "" "Establish a Unix socket connection and return a pair of ``(reader, writer)``." msgstr "建立一個 Unix socket 連線並回傳一對 ``(reader, writer)``。" -#: ../../library/asyncio-stream.rst:145 +#: ../../library/asyncio-stream.rst:148 msgid "Similar to :func:`open_connection` but operates on Unix sockets." msgstr "與 :func:`open_connection` 相似,但是是操作 Unix sockets。" -#: ../../library/asyncio-stream.rst:147 +#: ../../library/asyncio-stream.rst:150 msgid "See also the documentation of :meth:`loop.create_unix_connection`." msgstr "另請參閱 :meth:`loop.create_unix_connection` 文件。" -#: ../../library/asyncio-stream.rst:155 ../../library/asyncio-stream.rst:185 +#: ../../library/asyncio-stream.rst:158 ../../library/asyncio-stream.rst:189 msgid "Availability" msgstr "" -#: ../../library/asyncio-stream.rst:157 +#: ../../library/asyncio-stream.rst:160 msgid "" "Added the *ssl_handshake_timeout* parameter. The *path* parameter can now be " "a :term:`path-like object`" @@ -223,19 +223,19 @@ msgstr "" "新增 *ssl_handshake_timeout* 參數。*path* 參數現在可以是個 :term:`path-like " "object`" -#: ../../library/asyncio-stream.rst:173 +#: ../../library/asyncio-stream.rst:177 msgid "Start a Unix socket server." msgstr "啟動一個 Unix socket 伺服器。" -#: ../../library/asyncio-stream.rst:175 +#: ../../library/asyncio-stream.rst:179 msgid "Similar to :func:`start_server` but works with Unix sockets." msgstr "與 :func:`start_server` 相似,但會是操作 Unix sockets。" -#: ../../library/asyncio-stream.rst:177 +#: ../../library/asyncio-stream.rst:181 msgid "See also the documentation of :meth:`loop.create_unix_server`." msgstr "另請參閱 :meth:`loop.create_unix_server` 文件。" -#: ../../library/asyncio-stream.rst:187 +#: ../../library/asyncio-stream.rst:191 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :term:`path-like object`." @@ -243,11 +243,11 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。*path* 參數現在可以是" "個 :term:`path-like object`。" -#: ../../library/asyncio-stream.rst:199 +#: ../../library/asyncio-stream.rst:203 msgid "StreamReader" msgstr "StreamReader" -#: ../../library/asyncio-stream.rst:203 +#: ../../library/asyncio-stream.rst:207 msgid "" "Represents a reader object that provides APIs to read data from the IO " "stream. As an :term:`asynchronous iterable`, the object supports the :" @@ -256,7 +256,7 @@ msgstr "" "表示一個有提供 API 來從 IO 串流中讀取資料的 reader 物件。作為一個 :term:" "`asynchronous iterable`,此物件支援 :keyword:`async for` 陳述式。" -#: ../../library/asyncio-stream.rst:207 +#: ../../library/asyncio-stream.rst:211 msgid "" "It is not recommended to instantiate *StreamReader* objects directly; use :" "func:`open_connection` and :func:`start_server` instead." @@ -264,15 +264,15 @@ msgstr "" "不建議直接實例化 *StreamReader* 物件;使用 :func:`open_connection` 和 :func:" "`start_server` 會是較好的做法。" -#: ../../library/asyncio-stream.rst:213 +#: ../../library/asyncio-stream.rst:217 msgid "Acknowledge the EOF." msgstr "" -#: ../../library/asyncio-stream.rst:217 +#: ../../library/asyncio-stream.rst:222 msgid "Read up to *n* bytes from the stream." msgstr "從串流中讀取至多 *n* 個位元組的資料。" -#: ../../library/asyncio-stream.rst:219 +#: ../../library/asyncio-stream.rst:224 msgid "" "If *n* is not provided or set to ``-1``, read until EOF, then return all " "read :class:`bytes`. If EOF was received and the internal buffer is empty, " @@ -282,39 +282,39 @@ msgstr "" "的 :class:`bytes`。讀取到 EOF 且內部緩衝區是空的,則回傳一個空的 ``bytes`` 物" "件。" -#: ../../library/asyncio-stream.rst:224 +#: ../../library/asyncio-stream.rst:229 msgid "If *n* is ``0``, return an empty ``bytes`` object immediately." msgstr "如果 *n* 為 ``0``,則立即回傳一個空的 ``bytes`` 物件。" -#: ../../library/asyncio-stream.rst:226 +#: ../../library/asyncio-stream.rst:231 msgid "" "If *n* is positive, return at most *n* available ``bytes`` as soon as at " "least 1 byte is available in the internal buffer. If EOF is received before " "any byte is read, return an empty ``bytes`` object." msgstr "" -#: ../../library/asyncio-stream.rst:233 +#: ../../library/asyncio-stream.rst:239 msgid "" "Read one line, where \"line\" is a sequence of bytes ending with ``\\n``." msgstr "讀取一行,其中\"行\"指的是以 ``\\n`` 結尾的位元組序列。" -#: ../../library/asyncio-stream.rst:236 +#: ../../library/asyncio-stream.rst:242 msgid "" "If EOF is received and ``\\n`` was not found, the method returns partially " "read data." msgstr "如果讀取到 EOF 而沒有找到 ``\\n``,該方法會回傳部分的已讀取資料。" -#: ../../library/asyncio-stream.rst:239 +#: ../../library/asyncio-stream.rst:245 msgid "" "If EOF is received and the internal buffer is empty, return an empty " "``bytes`` object." msgstr "如果讀取到 EOF 且內部緩衝區是空的,則回傳一個空的 ``bytes`` 物件。" -#: ../../library/asyncio-stream.rst:244 +#: ../../library/asyncio-stream.rst:251 msgid "Read exactly *n* bytes." msgstr "讀取剛好 *n* 個位元組。" -#: ../../library/asyncio-stream.rst:246 +#: ../../library/asyncio-stream.rst:253 msgid "" "Raise an :exc:`IncompleteReadError` if EOF is reached before *n* can be " "read. Use the :attr:`IncompleteReadError.partial` attribute to get the " @@ -324,11 +324,11 @@ msgstr "" "`IncompleteReadError`。使用 :attr:`IncompleteReadError.partial` 屬性來取得串" "流結束前已讀取的部分資料。" -#: ../../library/asyncio-stream.rst:252 +#: ../../library/asyncio-stream.rst:260 msgid "Read data from the stream until *separator* is found." msgstr "從串流中持續讀取資料直到出現 *separator*。" -#: ../../library/asyncio-stream.rst:254 +#: ../../library/asyncio-stream.rst:262 msgid "" "On success, the data and separator will be removed from the internal buffer " "(consumed). Returned data will include the separator at the end." @@ -336,7 +336,7 @@ msgstr "" "成功後,資料和 separator(分隔符號)會從內部緩衝區中刪除(或者說是被消費掉 " "(consumed))。回傳的資料在末尾會有一個 separator。" -#: ../../library/asyncio-stream.rst:258 +#: ../../library/asyncio-stream.rst:266 msgid "" "If the amount of data read exceeds the configured stream limit, a :exc:" "`LimitOverrunError` exception is raised, and the data is left in the " @@ -345,7 +345,7 @@ msgstr "" "如果讀取的資料量超過了設定的串流限制,將會引發 :exc:`LimitOverrunError` 例" "外,資料將被留在內部緩衝區中,並可以再次被讀取。" -#: ../../library/asyncio-stream.rst:262 +#: ../../library/asyncio-stream.rst:270 msgid "" "If EOF is reached before the complete separator is found, an :exc:" "`IncompleteReadError` exception is raised, and the internal buffer is " @@ -356,7 +356,7 @@ msgstr "" "`IncompleteReadError` 例外,且內部緩衝區會被重置。:attr:`IncompleteReadError." "partial` 屬性可能包含一部分的 separator。" -#: ../../library/asyncio-stream.rst:267 +#: ../../library/asyncio-stream.rst:275 msgid "" "The *separator* may also be a tuple of separators. In this case the return " "value will be the shortest possible that has any separator as the suffix. " @@ -364,24 +364,24 @@ msgid "" "separator is considered to be the one that matched." msgstr "" -#: ../../library/asyncio-stream.rst:277 +#: ../../library/asyncio-stream.rst:285 msgid "The *separator* parameter may now be a :class:`tuple` of separators." msgstr "現在 *separator* 參數可以是一個分隔符號的 :class:`tuple`。" -#: ../../library/asyncio-stream.rst:282 +#: ../../library/asyncio-stream.rst:290 msgid "Return ``True`` if the buffer is empty and :meth:`feed_eof` was called." msgstr "如果緩衝區是空的且 :meth:`feed_eof` 曾被呼叫則回傳 ``True``。" -#: ../../library/asyncio-stream.rst:287 +#: ../../library/asyncio-stream.rst:295 msgid "StreamWriter" msgstr "StreamWriter" -#: ../../library/asyncio-stream.rst:291 +#: ../../library/asyncio-stream.rst:299 msgid "" "Represents a writer object that provides APIs to write data to the IO stream." msgstr "表示一個有提供 API 來將資料寫入 IO 串流的 writer 物件。" -#: ../../library/asyncio-stream.rst:294 +#: ../../library/asyncio-stream.rst:302 msgid "" "It is not recommended to instantiate *StreamWriter* objects directly; use :" "func:`open_connection` and :func:`start_server` instead." @@ -389,7 +389,7 @@ msgstr "" "不建議直接實例化 *StreamWriter* 物件;使用 :func:`open_connection` 和 :func:" "`start_server` 會是較好的做法。" -#: ../../library/asyncio-stream.rst:300 +#: ../../library/asyncio-stream.rst:308 msgid "" "The method attempts to write the *data* to the underlying socket " "immediately. If that fails, the data is queued in an internal write buffer " @@ -398,11 +398,11 @@ msgstr "" "此方法會嘗試立即將 *data* 寫入到底層的 socket。如果失敗,資料會被放到內部寫入" "緩衝中排隊等待 (queue),直到它可被發送。" -#: ../../library/asyncio-stream.rst:304 ../../library/asyncio-stream.rst:316 +#: ../../library/asyncio-stream.rst:312 ../../library/asyncio-stream.rst:324 msgid "The method should be used along with the ``drain()`` method::" msgstr "此方法應當與 ``drain()`` 方法一起使用: ::" -#: ../../library/asyncio-stream.rst:306 +#: ../../library/asyncio-stream.rst:314 msgid "" "stream.write(data)\n" "await stream.drain()" @@ -410,7 +410,7 @@ msgstr "" "stream.write(data)\n" "await stream.drain()" -#: ../../library/asyncio-stream.rst:311 +#: ../../library/asyncio-stream.rst:319 msgid "" "The method writes a list (or any iterable) of bytes to the underlying socket " "immediately. If that fails, the data is queued in an internal write buffer " @@ -419,7 +419,7 @@ msgstr "" "此方法會立即嘗試將一個位元組 list(或任何可疊代物件 (iterable))寫入到底層的 " "socket。如果失敗,資料會被放到內部寫入緩衝中排隊等待,直到它可被發送。" -#: ../../library/asyncio-stream.rst:318 +#: ../../library/asyncio-stream.rst:326 msgid "" "stream.writelines(lines)\n" "await stream.drain()" @@ -427,17 +427,17 @@ msgstr "" "stream.writelines(lines)\n" "await stream.drain()" -#: ../../library/asyncio-stream.rst:323 +#: ../../library/asyncio-stream.rst:331 msgid "The method closes the stream and the underlying socket." msgstr "此方法會關閉串流以及底層的 socket。" -#: ../../library/asyncio-stream.rst:325 +#: ../../library/asyncio-stream.rst:333 msgid "" "The method should be used, though not mandatory, along with the " "``wait_closed()`` method::" msgstr "此方法應與 ``wait_closed()`` 方法一起使用,但並非強制: ::" -#: ../../library/asyncio-stream.rst:328 +#: ../../library/asyncio-stream.rst:336 msgid "" "stream.close()\n" "await stream.wait_closed()" @@ -445,7 +445,7 @@ msgstr "" "stream.close()\n" "await stream.wait_closed()" -#: ../../library/asyncio-stream.rst:333 +#: ../../library/asyncio-stream.rst:341 msgid "" "Return ``True`` if the underlying transport supports the :meth:`write_eof` " "method, ``False`` otherwise." @@ -453,26 +453,26 @@ msgstr "" "如果底層的傳輸支援 :meth:`write_eof` 方法就回傳 ``True``,否則回傳 " "``False``。" -#: ../../library/asyncio-stream.rst:338 +#: ../../library/asyncio-stream.rst:346 msgid "" "Close the write end of the stream after the buffered write data is flushed." msgstr "在已緩衝的寫入資料被清理 (flush) 後關閉串流的寫入端。" -#: ../../library/asyncio-stream.rst:343 +#: ../../library/asyncio-stream.rst:351 msgid "Return the underlying asyncio transport." msgstr "回傳底層的 asyncio 傳輸。" -#: ../../library/asyncio-stream.rst:347 +#: ../../library/asyncio-stream.rst:355 msgid "" "Access optional transport information; see :meth:`BaseTransport." "get_extra_info` for details." msgstr "存取可選的傳輸資訊;詳情請見 :meth:`BaseTransport.get_extra_info`。" -#: ../../library/asyncio-stream.rst:352 +#: ../../library/asyncio-stream.rst:361 msgid "Wait until it is appropriate to resume writing to the stream. Example::" msgstr "等待直到可以繼續寫入到串流。範例: ::" -#: ../../library/asyncio-stream.rst:355 +#: ../../library/asyncio-stream.rst:364 msgid "" "writer.write(data)\n" "await writer.drain()" @@ -480,7 +480,7 @@ msgstr "" "writer.write(data)\n" "await writer.drain()" -#: ../../library/asyncio-stream.rst:358 +#: ../../library/asyncio-stream.rst:367 msgid "" "This is a flow control method that interacts with the underlying IO write " "buffer. When the size of the buffer reaches the high watermark, *drain()* " @@ -492,48 +492,48 @@ msgstr "" "(high watermark) 時,*drain()* 會阻塞直到緩衝區大小減少至最低標記位 (low " "watermark) 以便繼續寫入。當沒有要等待的資料時,:meth:`drain` 會立即回傳。" -#: ../../library/asyncio-stream.rst:368 +#: ../../library/asyncio-stream.rst:378 msgid "Upgrade an existing stream-based connection to TLS." msgstr "將現有的基於串流的連線升級到 TLS。" -#: ../../library/asyncio-stream.rst:370 +#: ../../library/asyncio-stream.rst:380 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-stream.rst:372 +#: ../../library/asyncio-stream.rst:382 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "*sslcontext*:一個 :class:`~ssl.SSLContext` 的已配置實例。" -#: ../../library/asyncio-stream.rst:374 +#: ../../library/asyncio-stream.rst:384 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "*server_hostname*:設定或覆寫將會被目標伺服器憑證比對的主機名稱。" -#: ../../library/asyncio-stream.rst:377 +#: ../../library/asyncio-stream.rst:387 msgid "" "*ssl_handshake_timeout* is the time in seconds to wait for the TLS handshake " "to complete before aborting the connection. ``60.0`` seconds if ``None`` " "(default)." msgstr "" -#: ../../library/asyncio-stream.rst:381 +#: ../../library/asyncio-stream.rst:391 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " "(default)." msgstr "" -#: ../../library/asyncio-stream.rst:393 +#: ../../library/asyncio-stream.rst:403 msgid "" "Return ``True`` if the stream is closed or in the process of being closed." msgstr "如果串流已被關閉或正在被關閉則回傳 ``True``。" -#: ../../library/asyncio-stream.rst:400 +#: ../../library/asyncio-stream.rst:411 msgid "Wait until the stream is closed." msgstr "等待直到串流被關閉。" -#: ../../library/asyncio-stream.rst:402 +#: ../../library/asyncio-stream.rst:413 msgid "" "Should be called after :meth:`close` to wait until the underlying connection " "is closed, ensuring that all data has been flushed before e.g. exiting the " @@ -542,19 +542,19 @@ msgstr "" "應當在 :meth:`close` 之後才被呼叫,這會持續等待直到底層的連線被關閉,以確保在" "這之前(例如在程式退出前)所有資料都已經被清空" -#: ../../library/asyncio-stream.rst:410 +#: ../../library/asyncio-stream.rst:421 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-stream.rst:415 +#: ../../library/asyncio-stream.rst:426 msgid "TCP echo client using streams" msgstr "使用串流的 TCP echo 客戶端" -#: ../../library/asyncio-stream.rst:417 +#: ../../library/asyncio-stream.rst:428 msgid "TCP echo client using the :func:`asyncio.open_connection` function::" msgstr "使用 :func:`asyncio.open_connection` 函式的 TCP echo 客戶端: ::" -#: ../../library/asyncio-stream.rst:441 +#: ../../library/asyncio-stream.rst:452 msgid "" "The :ref:`TCP echo client protocol " "` example uses the low-level :meth:" @@ -563,15 +563,15 @@ msgstr "" "使用低階 :meth:`loop.create_connection` 方法的 :ref:`TCP echo 客戶端協定 " "`\\ 範例。" -#: ../../library/asyncio-stream.rst:448 +#: ../../library/asyncio-stream.rst:459 msgid "TCP echo server using streams" msgstr "使用串流的 TCP echo 伺服器" -#: ../../library/asyncio-stream.rst:450 +#: ../../library/asyncio-stream.rst:461 msgid "TCP echo server using the :func:`asyncio.start_server` function::" msgstr "TCP echo 伺服器使用 :func:`asyncio.start_server` 函式: ::" -#: ../../library/asyncio-stream.rst:452 +#: ../../library/asyncio-stream.rst:463 msgid "" "import asyncio\n" "\n" @@ -631,7 +631,7 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../library/asyncio-stream.rst:484 +#: ../../library/asyncio-stream.rst:495 msgid "" "The :ref:`TCP echo server protocol " "` example uses the :meth:`loop." @@ -640,16 +640,16 @@ msgstr "" "使用 :meth:`loop.create_server` 方法的 :ref:`TCP echo 伺服器協定 " "` 範例。" -#: ../../library/asyncio-stream.rst:489 +#: ../../library/asyncio-stream.rst:500 msgid "Get HTTP headers" msgstr "取得 HTTP 標頭" -#: ../../library/asyncio-stream.rst:491 +#: ../../library/asyncio-stream.rst:502 msgid "" "Simple example querying HTTP headers of the URL passed on the command line::" msgstr "查詢自命令列傳入之 URL 所帶有 HTTP 標頭的簡單範例: ::" -#: ../../library/asyncio-stream.rst:493 +#: ../../library/asyncio-stream.rst:504 msgid "" "import asyncio\n" "import urllib.parse\n" @@ -688,34 +688,34 @@ msgid "" "asyncio.run(print_http_headers(url))" msgstr "" -#: ../../library/asyncio-stream.rst:530 +#: ../../library/asyncio-stream.rst:541 msgid "Usage::" msgstr "用法: ::" -#: ../../library/asyncio-stream.rst:532 +#: ../../library/asyncio-stream.rst:543 msgid "python example.py http://example.com/path/page.html" msgstr "python example.py http://example.com/path/page.html" -#: ../../library/asyncio-stream.rst:534 +#: ../../library/asyncio-stream.rst:545 msgid "or with HTTPS::" msgstr "或使用 HTTPS: ::" -#: ../../library/asyncio-stream.rst:536 +#: ../../library/asyncio-stream.rst:547 msgid "python example.py https://example.com/path/page.html" msgstr "python example.py https://example.com/path/page.html" -#: ../../library/asyncio-stream.rst:542 +#: ../../library/asyncio-stream.rst:553 msgid "Register an open socket to wait for data using streams" msgstr "註冊一個使用串流來等待資料的開放 socket" -#: ../../library/asyncio-stream.rst:544 +#: ../../library/asyncio-stream.rst:555 msgid "" "Coroutine waiting until a socket receives data using the :func:" "`open_connection` function::" msgstr "" "等待直到 socket 透過使用 :func:`open_connection` 函式接收到資料的協程: ::" -#: ../../library/asyncio-stream.rst:547 +#: ../../library/asyncio-stream.rst:558 msgid "" "import asyncio\n" "import socket\n" @@ -748,7 +748,7 @@ msgid "" "asyncio.run(wait_for_data())" msgstr "" -#: ../../library/asyncio-stream.rst:579 +#: ../../library/asyncio-stream.rst:590 msgid "" "The :ref:`register an open socket to wait for data using a protocol " "` example uses a low-level protocol and " @@ -758,7 +758,7 @@ msgstr "" "`\\ 範例中,有使用了低階協定以及 :meth:" "`loop.create_connection` 方法。" -#: ../../library/asyncio-stream.rst:583 +#: ../../library/asyncio-stream.rst:594 msgid "" "The :ref:`watch a file descriptor for read events " "` example uses the low-level :meth:`loop." diff --git a/library/asyncio-subprocess.po b/library/asyncio-subprocess.po index a3ffe6d7bf..8669d045c3 100644 --- a/library/asyncio-subprocess.po +++ b/library/asyncio-subprocess.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-03-12 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -127,43 +127,44 @@ msgstr "另請參閱\\ `Examples`_。" msgid "Creating Subprocesses" msgstr "建立子行程" -#: ../../library/asyncio-subprocess.rst:67 +#: ../../library/asyncio-subprocess.rst:68 msgid "Create a subprocess." msgstr "" -#: ../../library/asyncio-subprocess.rst:69 -#: ../../library/asyncio-subprocess.rst:87 +#: ../../library/asyncio-subprocess.rst:70 +#: ../../library/asyncio-subprocess.rst:89 msgid "" "The *limit* argument sets the buffer limit for :class:`StreamReader` " -"wrappers for :attr:`Process.stdout` and :attr:`Process.stderr` (if :const:" -"`subprocess.PIPE` is passed to *stdout* and *stderr* arguments)." +"wrappers for :attr:`~asyncio.subprocess.Process.stdout` and :attr:`~asyncio." +"subprocess.Process.stderr` (if :const:`subprocess.PIPE` is passed to " +"*stdout* and *stderr* arguments)." msgstr "" -#: ../../library/asyncio-subprocess.rst:73 -#: ../../library/asyncio-subprocess.rst:91 +#: ../../library/asyncio-subprocess.rst:74 +#: ../../library/asyncio-subprocess.rst:93 msgid "Return a :class:`~asyncio.subprocess.Process` instance." msgstr "" -#: ../../library/asyncio-subprocess.rst:75 +#: ../../library/asyncio-subprocess.rst:76 msgid "" "See the documentation of :meth:`loop.subprocess_exec` for other parameters." msgstr "" -#: ../../library/asyncio-subprocess.rst:78 -#: ../../library/asyncio-subprocess.rst:105 +#: ../../library/asyncio-subprocess.rst:79 +#: ../../library/asyncio-subprocess.rst:107 msgid "Removed the *loop* parameter." msgstr "" -#: ../../library/asyncio-subprocess.rst:85 +#: ../../library/asyncio-subprocess.rst:87 msgid "Run the *cmd* shell command." msgstr "" -#: ../../library/asyncio-subprocess.rst:93 +#: ../../library/asyncio-subprocess.rst:95 msgid "" "See the documentation of :meth:`loop.subprocess_shell` for other parameters." msgstr "" -#: ../../library/asyncio-subprocess.rst:98 +#: ../../library/asyncio-subprocess.rst:100 msgid "" "It is the application's responsibility to ensure that all whitespace and " "special characters are quoted appropriately to avoid `shell injection " @@ -173,14 +174,14 @@ msgid "" "be used to construct shell commands." msgstr "" -#: ../../library/asyncio-subprocess.rst:110 +#: ../../library/asyncio-subprocess.rst:112 msgid "" "Subprocesses are available for Windows if a :class:`ProactorEventLoop` is " "used. See :ref:`Subprocess Support on Windows ` " "for details." msgstr "" -#: ../../library/asyncio-subprocess.rst:116 +#: ../../library/asyncio-subprocess.rst:118 msgid "" "asyncio also has the following *low-level* APIs to work with subprocesses: :" "meth:`loop.subprocess_exec`, :meth:`loop.subprocess_shell`, :meth:`loop." @@ -189,47 +190,47 @@ msgid "" "Protocols `." msgstr "" -#: ../../library/asyncio-subprocess.rst:124 +#: ../../library/asyncio-subprocess.rst:126 msgid "Constants" msgstr "常數" -#: ../../library/asyncio-subprocess.rst:129 +#: ../../library/asyncio-subprocess.rst:131 msgid "Can be passed to the *stdin*, *stdout* or *stderr* parameters." msgstr "" -#: ../../library/asyncio-subprocess.rst:131 +#: ../../library/asyncio-subprocess.rst:133 msgid "" "If *PIPE* is passed to *stdin* argument, the :attr:`Process.stdin ` attribute will point to a :class:`StreamWriter` " -"instance." +"subprocess.Process.stdin>` attribute will point to a :class:`~asyncio." +"StreamWriter` instance." msgstr "" -#: ../../library/asyncio-subprocess.rst:135 +#: ../../library/asyncio-subprocess.rst:137 msgid "" "If *PIPE* is passed to *stdout* or *stderr* arguments, the :attr:`Process." "stdout ` and :attr:`Process.stderr " "` attributes will point to :class:" -"`StreamReader` instances." +"`~asyncio.StreamReader` instances." msgstr "" -#: ../../library/asyncio-subprocess.rst:143 +#: ../../library/asyncio-subprocess.rst:145 msgid "" "Special value that can be used as the *stderr* argument and indicates that " "standard error should be redirected into standard output." msgstr "" -#: ../../library/asyncio-subprocess.rst:149 +#: ../../library/asyncio-subprocess.rst:151 msgid "" "Special value that can be used as the *stdin*, *stdout* or *stderr* argument " "to process creation functions. It indicates that the special file :data:`os." "devnull` will be used for the corresponding subprocess stream." msgstr "" -#: ../../library/asyncio-subprocess.rst:155 +#: ../../library/asyncio-subprocess.rst:157 msgid "Interacting with Subprocesses" msgstr "" -#: ../../library/asyncio-subprocess.rst:157 +#: ../../library/asyncio-subprocess.rst:159 msgid "" "Both :func:`create_subprocess_exec` and :func:`create_subprocess_shell` " "functions return instances of the *Process* class. *Process* is a high-" @@ -237,61 +238,62 @@ msgid "" "their completion." msgstr "" -#: ../../library/asyncio-subprocess.rst:165 +#: ../../library/asyncio-subprocess.rst:167 msgid "" -"An object that wraps OS processes created by the :func:" -"`create_subprocess_exec` and :func:`create_subprocess_shell` functions." +"An object that wraps OS processes created by the :func:`~asyncio." +"create_subprocess_exec` and :func:`~asyncio.create_subprocess_shell` " +"functions." msgstr "" -#: ../../library/asyncio-subprocess.rst:169 +#: ../../library/asyncio-subprocess.rst:171 msgid "" "This class is designed to have a similar API to the :class:`subprocess." "Popen` class, but there are some notable differences:" msgstr "" -#: ../../library/asyncio-subprocess.rst:173 +#: ../../library/asyncio-subprocess.rst:175 msgid "" "unlike Popen, Process instances do not have an equivalent to the :meth:" "`~subprocess.Popen.poll` method;" msgstr "" -#: ../../library/asyncio-subprocess.rst:176 +#: ../../library/asyncio-subprocess.rst:178 msgid "" "the :meth:`~asyncio.subprocess.Process.communicate` and :meth:`~asyncio." "subprocess.Process.wait` methods don't have a *timeout* parameter: use the :" "func:`~asyncio.wait_for` function;" msgstr "" -#: ../../library/asyncio-subprocess.rst:180 +#: ../../library/asyncio-subprocess.rst:182 msgid "" "the :meth:`Process.wait() ` method is " "asynchronous, whereas :meth:`subprocess.Popen.wait` method is implemented as " "a blocking busy loop;" msgstr "" -#: ../../library/asyncio-subprocess.rst:184 +#: ../../library/asyncio-subprocess.rst:186 msgid "the *universal_newlines* parameter is not supported." msgstr "" -#: ../../library/asyncio-subprocess.rst:186 +#: ../../library/asyncio-subprocess.rst:188 msgid "This class is :ref:`not thread safe `." msgstr "" -#: ../../library/asyncio-subprocess.rst:188 +#: ../../library/asyncio-subprocess.rst:190 msgid "" "See also the :ref:`Subprocess and Threads ` " "section." msgstr "" -#: ../../library/asyncio-subprocess.rst:193 +#: ../../library/asyncio-subprocess.rst:196 msgid "Wait for the child process to terminate." msgstr "" -#: ../../library/asyncio-subprocess.rst:195 +#: ../../library/asyncio-subprocess.rst:198 msgid "Set and return the :attr:`returncode` attribute." msgstr "" -#: ../../library/asyncio-subprocess.rst:199 +#: ../../library/asyncio-subprocess.rst:202 msgid "" "This method can deadlock when using ``stdout=PIPE`` or ``stderr=PIPE`` and " "the child process generates so much output that it blocks waiting for the OS " @@ -299,37 +301,37 @@ msgid "" "using pipes to avoid this condition." msgstr "" -#: ../../library/asyncio-subprocess.rst:207 +#: ../../library/asyncio-subprocess.rst:211 msgid "Interact with process:" msgstr "" -#: ../../library/asyncio-subprocess.rst:209 +#: ../../library/asyncio-subprocess.rst:213 msgid "send data to *stdin* (if *input* is not ``None``);" msgstr "" -#: ../../library/asyncio-subprocess.rst:210 +#: ../../library/asyncio-subprocess.rst:214 msgid "closes *stdin*;" msgstr "" -#: ../../library/asyncio-subprocess.rst:211 +#: ../../library/asyncio-subprocess.rst:215 msgid "read data from *stdout* and *stderr*, until EOF is reached;" msgstr "" -#: ../../library/asyncio-subprocess.rst:212 +#: ../../library/asyncio-subprocess.rst:216 msgid "wait for process to terminate." msgstr "" -#: ../../library/asyncio-subprocess.rst:214 +#: ../../library/asyncio-subprocess.rst:218 msgid "" "The optional *input* argument is the data (:class:`bytes` object) that will " "be sent to the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:217 +#: ../../library/asyncio-subprocess.rst:221 msgid "Return a tuple ``(stdout_data, stderr_data)``." msgstr "" -#: ../../library/asyncio-subprocess.rst:219 +#: ../../library/asyncio-subprocess.rst:223 msgid "" "If either :exc:`BrokenPipeError` or :exc:`ConnectionResetError` exception is " "raised when writing *input* into *stdin*, the exception is ignored. This " @@ -337,7 +339,7 @@ msgid "" "*stdin*." msgstr "" -#: ../../library/asyncio-subprocess.rst:224 +#: ../../library/asyncio-subprocess.rst:228 msgid "" "If it is desired to send data to the process' *stdin*, the process needs to " "be created with ``stdin=PIPE``. Similarly, to get anything other than " @@ -345,75 +347,76 @@ msgid "" "``stdout=PIPE`` and/or ``stderr=PIPE`` arguments." msgstr "" -#: ../../library/asyncio-subprocess.rst:230 +#: ../../library/asyncio-subprocess.rst:234 msgid "" "Note, that the data read is buffered in memory, so do not use this method if " "the data size is large or unlimited." msgstr "" -#: ../../library/asyncio-subprocess.rst:235 -msgid "*stdin* gets closed when `input=None` too." +#: ../../library/asyncio-subprocess.rst:239 +msgid "*stdin* gets closed when ``input=None`` too." msgstr "" -#: ../../library/asyncio-subprocess.rst:239 +#: ../../library/asyncio-subprocess.rst:243 msgid "Sends the signal *signal* to the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:243 +#: ../../library/asyncio-subprocess.rst:247 msgid "" "On Windows, :py:const:`~signal.SIGTERM` is an alias for :meth:`terminate`. " "``CTRL_C_EVENT`` and ``CTRL_BREAK_EVENT`` can be sent to processes started " "with a *creationflags* parameter which includes ``CREATE_NEW_PROCESS_GROUP``." msgstr "" -#: ../../library/asyncio-subprocess.rst:250 +#: ../../library/asyncio-subprocess.rst:254 msgid "Stop the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:252 +#: ../../library/asyncio-subprocess.rst:256 msgid "" "On POSIX systems this method sends :py:const:`~signal.SIGTERM` to the child " "process." msgstr "" -#: ../../library/asyncio-subprocess.rst:255 +#: ../../library/asyncio-subprocess.rst:259 msgid "" "On Windows the Win32 API function :c:func:`!TerminateProcess` is called to " "stop the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:260 +#: ../../library/asyncio-subprocess.rst:264 msgid "Kill the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:262 +#: ../../library/asyncio-subprocess.rst:266 msgid "" -"On POSIX systems this method sends :py:data:`SIGKILL` to the child process." +"On POSIX systems this method sends :py:data:`~signal.SIGKILL` to the child " +"process." msgstr "" -#: ../../library/asyncio-subprocess.rst:265 +#: ../../library/asyncio-subprocess.rst:269 msgid "On Windows this method is an alias for :meth:`terminate`." msgstr "" -#: ../../library/asyncio-subprocess.rst:269 +#: ../../library/asyncio-subprocess.rst:273 msgid "" -"Standard input stream (:class:`StreamWriter`) or ``None`` if the process was " -"created with ``stdin=None``." +"Standard input stream (:class:`~asyncio.StreamWriter`) or ``None`` if the " +"process was created with ``stdin=None``." msgstr "" -#: ../../library/asyncio-subprocess.rst:274 +#: ../../library/asyncio-subprocess.rst:278 msgid "" -"Standard output stream (:class:`StreamReader`) or ``None`` if the process " -"was created with ``stdout=None``." +"Standard output stream (:class:`~asyncio.StreamReader`) or ``None`` if the " +"process was created with ``stdout=None``." msgstr "" -#: ../../library/asyncio-subprocess.rst:279 +#: ../../library/asyncio-subprocess.rst:283 msgid "" -"Standard error stream (:class:`StreamReader`) or ``None`` if the process was " -"created with ``stderr=None``." +"Standard error stream (:class:`~asyncio.StreamReader`) or ``None`` if the " +"process was created with ``stderr=None``." msgstr "" -#: ../../library/asyncio-subprocess.rst:284 +#: ../../library/asyncio-subprocess.rst:288 msgid "" "Use the :meth:`communicate` method rather than :attr:`process.stdin.write() " "`, :attr:`await process.stdout.read() ` or :attr:`await " @@ -421,93 +424,94 @@ msgid "" "pausing reading or writing and blocking the child process." msgstr "" -#: ../../library/asyncio-subprocess.rst:293 +#: ../../library/asyncio-subprocess.rst:297 msgid "Process identification number (PID)." msgstr "" -#: ../../library/asyncio-subprocess.rst:295 +#: ../../library/asyncio-subprocess.rst:299 msgid "" -"Note that for processes created by the :func:`create_subprocess_shell` " -"function, this attribute is the PID of the spawned shell." +"Note that for processes created by the :func:`~asyncio." +"create_subprocess_shell` function, this attribute is the PID of the spawned " +"shell." msgstr "" -#: ../../library/asyncio-subprocess.rst:300 +#: ../../library/asyncio-subprocess.rst:304 msgid "Return code of the process when it exits." msgstr "" -#: ../../library/asyncio-subprocess.rst:302 +#: ../../library/asyncio-subprocess.rst:306 msgid "A ``None`` value indicates that the process has not terminated yet." msgstr "" -#: ../../library/asyncio-subprocess.rst:304 +#: ../../library/asyncio-subprocess.rst:308 msgid "" "A negative value ``-N`` indicates that the child was terminated by signal " "``N`` (POSIX only)." msgstr "" -#: ../../library/asyncio-subprocess.rst:311 +#: ../../library/asyncio-subprocess.rst:315 msgid "Subprocess and Threads" msgstr "子行程與線程" -#: ../../library/asyncio-subprocess.rst:313 +#: ../../library/asyncio-subprocess.rst:317 msgid "" "Standard asyncio event loop supports running subprocesses from different " "threads by default." msgstr "" -#: ../../library/asyncio-subprocess.rst:316 +#: ../../library/asyncio-subprocess.rst:320 msgid "" "On Windows subprocesses are provided by :class:`ProactorEventLoop` only " "(default), :class:`SelectorEventLoop` has no subprocess support." msgstr "" -#: ../../library/asyncio-subprocess.rst:319 +#: ../../library/asyncio-subprocess.rst:323 msgid "" "On UNIX *child watchers* are used for subprocess finish waiting, see :ref:" "`asyncio-watchers` for more info." msgstr "" -#: ../../library/asyncio-subprocess.rst:325 +#: ../../library/asyncio-subprocess.rst:329 msgid "" "UNIX switched to use :class:`ThreadedChildWatcher` for spawning subprocesses " "from different threads without any limitation." msgstr "" -#: ../../library/asyncio-subprocess.rst:328 +#: ../../library/asyncio-subprocess.rst:332 msgid "" "Spawning a subprocess with *inactive* current child watcher raises :exc:" "`RuntimeError`." msgstr "" -#: ../../library/asyncio-subprocess.rst:331 +#: ../../library/asyncio-subprocess.rst:335 msgid "" "Note that alternative event loop implementations might have own limitations; " "please refer to their documentation." msgstr "" -#: ../../library/asyncio-subprocess.rst:336 +#: ../../library/asyncio-subprocess.rst:340 msgid "" "The :ref:`Concurrency and multithreading in asyncio ` section." msgstr "" -#: ../../library/asyncio-subprocess.rst:341 +#: ../../library/asyncio-subprocess.rst:345 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-subprocess.rst:343 +#: ../../library/asyncio-subprocess.rst:347 msgid "" "An example using the :class:`~asyncio.subprocess.Process` class to control a " "subprocess and the :class:`StreamReader` class to read from its standard " "output." msgstr "" -#: ../../library/asyncio-subprocess.rst:349 +#: ../../library/asyncio-subprocess.rst:353 msgid "" "The subprocess is created by the :func:`create_subprocess_exec` function::" msgstr "" -#: ../../library/asyncio-subprocess.rst:352 +#: ../../library/asyncio-subprocess.rst:356 msgid "" "import asyncio\n" "import sys\n" @@ -533,7 +537,7 @@ msgid "" "print(f\"Current date: {date}\")" msgstr "" -#: ../../library/asyncio-subprocess.rst:376 +#: ../../library/asyncio-subprocess.rst:380 msgid "" "See also the :ref:`same example ` written " "using low-level APIs." diff --git a/library/asyncio-sync.po b/library/asyncio-sync.po index b87d208824..a539db9b6e 100644 --- a/library/asyncio-sync.po +++ b/library/asyncio-sync.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-30 00:14+0000\n" +"POT-Creation-Date: 2025-02-23 00:15+0000\n" "PO-Revision-Date: 2022-02-09 19:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -107,8 +107,8 @@ msgid "" " # access shared state" msgstr "" -#: ../../library/asyncio-sync.rst:56 ../../library/asyncio-sync.rst:199 -#: ../../library/asyncio-sync.rst:304 +#: ../../library/asyncio-sync.rst:56 ../../library/asyncio-sync.rst:201 +#: ../../library/asyncio-sync.rst:309 msgid "which is equivalent to::" msgstr "這等價於: ::" @@ -124,17 +124,17 @@ msgid "" " lock.release()" msgstr "" -#: ../../library/asyncio-sync.rst:67 ../../library/asyncio-sync.rst:112 -#: ../../library/asyncio-sync.rst:187 ../../library/asyncio-sync.rst:292 -#: ../../library/asyncio-sync.rst:347 +#: ../../library/asyncio-sync.rst:67 ../../library/asyncio-sync.rst:113 +#: ../../library/asyncio-sync.rst:189 ../../library/asyncio-sync.rst:297 +#: ../../library/asyncio-sync.rst:353 msgid "Removed the *loop* parameter." msgstr "移除 ``loop`` 參數。" -#: ../../library/asyncio-sync.rst:72 +#: ../../library/asyncio-sync.rst:73 msgid "Acquire the lock." msgstr "獲得鎖。" -#: ../../library/asyncio-sync.rst:74 +#: ../../library/asyncio-sync.rst:75 msgid "" "This method waits until the lock is *unlocked*, sets it to *locked* and " "returns ``True``." @@ -142,7 +142,7 @@ msgstr "" "此方法會持續等待直到鎖的狀態成為 *unlocked*,並將其設置為 *locked* 和回傳 " "``True``。" -#: ../../library/asyncio-sync.rst:77 +#: ../../library/asyncio-sync.rst:78 msgid "" "When more than one coroutine is blocked in :meth:`acquire` waiting for the " "lock to be unlocked, only one coroutine eventually proceeds." @@ -150,45 +150,45 @@ msgstr "" "當多於一個的協程 (coroutine) 在 :meth:`acquire` 中等待解鎖而被阻塞,最終只會" "有其中的一個被處理。" -#: ../../library/asyncio-sync.rst:81 +#: ../../library/asyncio-sync.rst:82 msgid "" "Acquiring a lock is *fair*: the coroutine that proceeds will be the first " "coroutine that started waiting on the lock." msgstr "" "鎖的取得方式是\\ *公平*\\ 的:被處理的協程會是最早開始等待解鎖的那一個。" -#: ../../library/asyncio-sync.rst:86 +#: ../../library/asyncio-sync.rst:87 msgid "Release the lock." msgstr "釋放鎖。" -#: ../../library/asyncio-sync.rst:88 +#: ../../library/asyncio-sync.rst:89 msgid "When the lock is *locked*, reset it to *unlocked* and return." msgstr "如果鎖的狀態為 *locked* 則將其重置為 *unlocked* 並回傳。" -#: ../../library/asyncio-sync.rst:90 +#: ../../library/asyncio-sync.rst:91 msgid "If the lock is *unlocked*, a :exc:`RuntimeError` is raised." msgstr "如果鎖的狀態為 *unlocked* 則 :exc:`RuntimeError` 會被引發。" -#: ../../library/asyncio-sync.rst:94 +#: ../../library/asyncio-sync.rst:95 msgid "Return ``True`` if the lock is *locked*." msgstr "如果鎖的狀態為 *locked* 則回傳 ``True``。" -#: ../../library/asyncio-sync.rst:98 +#: ../../library/asyncio-sync.rst:99 msgid "Event" msgstr "Event" -#: ../../library/asyncio-sync.rst:102 +#: ../../library/asyncio-sync.rst:103 msgid "An event object. Not thread-safe." msgstr "一個事件 (event) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:104 +#: ../../library/asyncio-sync.rst:105 msgid "" "An asyncio event can be used to notify multiple asyncio tasks that some " "event has happened." msgstr "" "一個 asyncio 事件可以被用於通知多個有發生某些事件於其中的 asyncio 任務。" -#: ../../library/asyncio-sync.rst:107 +#: ../../library/asyncio-sync.rst:108 msgid "" "An Event object manages an internal flag that can be set to *true* with the :" "meth:`~Event.set` method and reset to *false* with the :meth:`clear` " @@ -200,11 +200,11 @@ msgstr "" "wait` 方法會被阻塞 (block) 直到該旗標被設為 *true*。該旗標初始設置為 " "*false*。" -#: ../../library/asyncio-sync.rst:117 ../../library/asyncio-sync.rst:371 +#: ../../library/asyncio-sync.rst:118 ../../library/asyncio-sync.rst:377 msgid "Example::" msgstr "範例: ::" -#: ../../library/asyncio-sync.rst:119 +#: ../../library/asyncio-sync.rst:120 msgid "" "async def waiter(event):\n" " print('waiting for it ...')\n" @@ -228,11 +228,11 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-sync.rst:142 +#: ../../library/asyncio-sync.rst:144 msgid "Wait until the event is set." msgstr "持續等待直到事件被設置。" -#: ../../library/asyncio-sync.rst:144 +#: ../../library/asyncio-sync.rst:146 msgid "" "If the event is set, return ``True`` immediately. Otherwise block until " "another task calls :meth:`~Event.set`." @@ -240,19 +240,19 @@ msgstr "" "如果事件有被設置則立刻回傳 ``True``。否則持續阻塞直到另一個任務呼叫 :meth:" "`~Event.set`。" -#: ../../library/asyncio-sync.rst:149 +#: ../../library/asyncio-sync.rst:151 msgid "Set the event." msgstr "設置事件。" -#: ../../library/asyncio-sync.rst:151 +#: ../../library/asyncio-sync.rst:153 msgid "All tasks waiting for event to be set will be immediately awakened." msgstr "所有正在等待事件被設置的任務會立即被喚醒。" -#: ../../library/asyncio-sync.rst:156 +#: ../../library/asyncio-sync.rst:158 msgid "Clear (unset) the event." msgstr "清除(還原)事件。" -#: ../../library/asyncio-sync.rst:158 +#: ../../library/asyncio-sync.rst:160 msgid "" "Tasks awaiting on :meth:`~Event.wait` will now block until the :meth:`~Event." "set` method is called again." @@ -260,19 +260,19 @@ msgstr "" "正透過 :meth:`~Event.wait` 等待的 Tasks 現在會持續阻塞直到 :meth:`~Event." "set` 方法再次被呼叫。" -#: ../../library/asyncio-sync.rst:163 +#: ../../library/asyncio-sync.rst:165 msgid "Return ``True`` if the event is set." msgstr "如果事件有被設置則回傳 ``True``。" -#: ../../library/asyncio-sync.rst:167 +#: ../../library/asyncio-sync.rst:169 msgid "Condition" msgstr "Condition" -#: ../../library/asyncio-sync.rst:171 +#: ../../library/asyncio-sync.rst:173 msgid "A Condition object. Not thread-safe." msgstr "一個條件 (codition) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:173 +#: ../../library/asyncio-sync.rst:175 msgid "" "An asyncio condition primitive can be used by a task to wait for some event " "to happen and then get exclusive access to a shared resource." @@ -280,7 +280,7 @@ msgstr "" "一個 asyncio 條件原始物件可以被任務用來等待某事件發生,並獲得一個共享資源的獨" "佔存取權。" -#: ../../library/asyncio-sync.rst:177 +#: ../../library/asyncio-sync.rst:179 msgid "" "In essence, a Condition object combines the functionality of an :class:" "`Event` and a :class:`Lock`. It is possible to have multiple Condition " @@ -292,7 +292,7 @@ msgstr "" "個 Condition 物件共享一個 Lock 是有可能發生的,這能夠協調關注同一共享資源的不" "同狀態以取得其獨佔存取權的多個任務。" -#: ../../library/asyncio-sync.rst:183 +#: ../../library/asyncio-sync.rst:185 msgid "" "The optional *lock* argument must be a :class:`Lock` object or ``None``. In " "the latter case a new Lock object is created automatically." @@ -300,12 +300,12 @@ msgstr "" "可選的 *lock* 引數必須是一個 :class:`Lock` 物件或者為 ``None``。如為後者則一" "個新的 Lock 物件會被自動建立。" -#: ../../library/asyncio-sync.rst:190 +#: ../../library/asyncio-sync.rst:192 msgid "" "The preferred way to use a Condition is an :keyword:`async with` statement::" msgstr "使用 Condition 的推薦方式是透過 :keyword:`async with` 陳述式: ::" -#: ../../library/asyncio-sync.rst:193 +#: ../../library/asyncio-sync.rst:195 msgid "" "cond = asyncio.Condition()\n" "\n" @@ -314,7 +314,7 @@ msgid "" " await cond.wait()" msgstr "" -#: ../../library/asyncio-sync.rst:201 +#: ../../library/asyncio-sync.rst:203 msgid "" "cond = asyncio.Condition()\n" "\n" @@ -326,11 +326,11 @@ msgid "" " cond.release()" msgstr "" -#: ../../library/asyncio-sync.rst:212 +#: ../../library/asyncio-sync.rst:215 msgid "Acquire the underlying lock." msgstr "取得底層的鎖。" -#: ../../library/asyncio-sync.rst:214 +#: ../../library/asyncio-sync.rst:217 msgid "" "This method waits until the underlying lock is *unlocked*, sets it to " "*locked* and returns ``True``." @@ -338,7 +338,7 @@ msgstr "" "此方法會持續等待直到底層的鎖為 *unlocked*,並將其設為 *locked* 並回傳 " "``True``。" -#: ../../library/asyncio-sync.rst:219 +#: ../../library/asyncio-sync.rst:222 msgid "" "Wake up *n* tasks (1 by default) waiting on this condition. If fewer than " "*n* tasks are waiting they are all awakened." @@ -346,7 +346,7 @@ msgstr "" "喚醒至多 *n* 個正在等待此條件的任務(預設為 1),如果少於 *n* 個任務則全部被" "喚醒。" -#: ../../library/asyncio-sync.rst:222 ../../library/asyncio-sync.rst:237 +#: ../../library/asyncio-sync.rst:225 ../../library/asyncio-sync.rst:240 msgid "" "The lock must be acquired before this method is called and released shortly " "after. If called with an *unlocked* lock a :exc:`RuntimeError` error is " @@ -355,31 +355,31 @@ msgstr "" "在此方法被呼叫前必須先獲得鎖,並在之後立刻將其釋放。如果呼叫於一個 " "*unlocked* 的鎖則 :exc:`RuntimeError` 錯誤會被引發。" -#: ../../library/asyncio-sync.rst:228 +#: ../../library/asyncio-sync.rst:231 msgid "Return ``True`` if the underlying lock is acquired." msgstr "如果已取得底層的鎖則回傳 ``True``。" -#: ../../library/asyncio-sync.rst:232 +#: ../../library/asyncio-sync.rst:235 msgid "Wake up all tasks waiting on this condition." msgstr "喚醒所有正在等待此條件的任務。" -#: ../../library/asyncio-sync.rst:234 +#: ../../library/asyncio-sync.rst:237 msgid "This method acts like :meth:`notify`, but wakes up all waiting tasks." msgstr "這個方法的行為就像 :meth:`notify`,但會喚醒所有正在等待的任務。" -#: ../../library/asyncio-sync.rst:243 +#: ../../library/asyncio-sync.rst:246 msgid "Release the underlying lock." msgstr "釋放底層的鎖。" -#: ../../library/asyncio-sync.rst:245 +#: ../../library/asyncio-sync.rst:248 msgid "When invoked on an unlocked lock, a :exc:`RuntimeError` is raised." msgstr "當叫用於一個未被解開的鎖之上時,會引發一個 :exc:`RuntimeError`。" -#: ../../library/asyncio-sync.rst:250 +#: ../../library/asyncio-sync.rst:254 msgid "Wait until notified." msgstr "持續等待直到被通知 (notify)。" -#: ../../library/asyncio-sync.rst:252 +#: ../../library/asyncio-sync.rst:256 msgid "" "If the calling task has not acquired the lock when this method is called, a :" "exc:`RuntimeError` is raised." @@ -387,7 +387,7 @@ msgstr "" "當此方法被呼叫時,如果呼叫它的任務還沒有取得鎖的話,:exc:`RuntimeError` 會被" "引發。" -#: ../../library/asyncio-sync.rst:255 +#: ../../library/asyncio-sync.rst:259 msgid "" "This method releases the underlying lock, and then blocks until it is " "awakened by a :meth:`notify` or :meth:`notify_all` call. Once awakened, the " @@ -397,7 +397,7 @@ msgstr "" "`notify_all` 的呼叫所喚醒。一但被喚醒,Condition 會重新取得該鎖且此方法會回" "傳 ``True``。" -#: ../../library/asyncio-sync.rst:260 +#: ../../library/asyncio-sync.rst:264 msgid "" "Note that a task *may* return from this call spuriously, which is why the " "caller should always re-check the state and be prepared to :meth:`~Condition." @@ -405,11 +405,11 @@ msgid "" "wait_for` instead." msgstr "" -#: ../../library/asyncio-sync.rst:267 +#: ../../library/asyncio-sync.rst:272 msgid "Wait until a predicate becomes *true*." msgstr "持續等待直到謂語 (predicate) 成為 *true*。" -#: ../../library/asyncio-sync.rst:269 +#: ../../library/asyncio-sync.rst:274 msgid "" "The predicate must be a callable which result will be interpreted as a " "boolean value. The method will repeatedly :meth:`~Condition.wait` until the " @@ -419,15 +419,15 @@ msgstr "" "重複地 :meth:`~Condition.wait` 直到謂語求值結果為 *true*。最終的值即為回傳" "值。" -#: ../../library/asyncio-sync.rst:276 +#: ../../library/asyncio-sync.rst:281 msgid "Semaphore" msgstr "Semaphore" -#: ../../library/asyncio-sync.rst:280 +#: ../../library/asyncio-sync.rst:285 msgid "A Semaphore object. Not thread-safe." msgstr "一個旗號 (semaphore) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:282 +#: ../../library/asyncio-sync.rst:287 msgid "" "A semaphore manages an internal counter which is decremented by each :meth:" "`acquire` call and incremented by each :meth:`release` call. The counter can " @@ -438,7 +438,7 @@ msgstr "" "呼叫 :meth:`release` 時增加一。此計數器永遠不會少於零;當 :meth:`acquire` 發" "現它是零時,它會持續阻塞並等待某任務呼叫 :meth:`release`。" -#: ../../library/asyncio-sync.rst:288 +#: ../../library/asyncio-sync.rst:293 msgid "" "The optional *value* argument gives the initial value for the internal " "counter (``1`` by default). If the given value is less than ``0`` a :exc:" @@ -447,12 +447,12 @@ msgstr "" "可選的 *value* 引數給定了內部計數器的初始值(預設為 ``1``\\ )。如給定的值少" "於 ``0`` 則 :exc:`ValueError` 會被引發。" -#: ../../library/asyncio-sync.rst:295 +#: ../../library/asyncio-sync.rst:300 msgid "" "The preferred way to use a Semaphore is an :keyword:`async with` statement::" msgstr "使用 Semaphore 的推薦方式是透過 :keyword:`async with` 陳述式: ::" -#: ../../library/asyncio-sync.rst:298 +#: ../../library/asyncio-sync.rst:303 msgid "" "sem = asyncio.Semaphore(10)\n" "\n" @@ -461,7 +461,7 @@ msgid "" " # work with shared resource" msgstr "" -#: ../../library/asyncio-sync.rst:306 +#: ../../library/asyncio-sync.rst:311 msgid "" "sem = asyncio.Semaphore(10)\n" "\n" @@ -473,11 +473,11 @@ msgid "" " sem.release()" msgstr "" -#: ../../library/asyncio-sync.rst:317 +#: ../../library/asyncio-sync.rst:323 msgid "Acquire a semaphore." msgstr "取得一個旗號。" -#: ../../library/asyncio-sync.rst:319 +#: ../../library/asyncio-sync.rst:325 msgid "" "If the internal counter is greater than zero, decrement it by one and return " "``True`` immediately. If it is zero, wait until a :meth:`release` is called " @@ -486,11 +486,11 @@ msgstr "" "如果內部計數器大於零,將其減一並立刻回傳 ``True``。如果為零,則持續等待直到 :" "meth:`release` 被呼叫,並回傳 ``True``。" -#: ../../library/asyncio-sync.rst:325 +#: ../../library/asyncio-sync.rst:331 msgid "Returns ``True`` if semaphore can not be acquired immediately." msgstr "如果旗號無法立即被取得則回傳 ``True``。" -#: ../../library/asyncio-sync.rst:329 +#: ../../library/asyncio-sync.rst:335 msgid "" "Release a semaphore, incrementing the internal counter by one. Can wake up a " "task waiting to acquire the semaphore." @@ -498,7 +498,7 @@ msgstr "" "釋放一個旗號,並為其內部的計數器數值增加一。可以把一個正在等待取得旗號的任務" "叫醒。" -#: ../../library/asyncio-sync.rst:332 +#: ../../library/asyncio-sync.rst:338 msgid "" "Unlike :class:`BoundedSemaphore`, :class:`Semaphore` allows making more " "``release()`` calls than ``acquire()`` calls." @@ -506,15 +506,15 @@ msgstr "" "和 :class:`BoundedSemaphore` 不同,:class:`Semaphore` 允許 ``release()`` 的呼" "叫次數多於 ``acquire()``。" -#: ../../library/asyncio-sync.rst:337 +#: ../../library/asyncio-sync.rst:343 msgid "BoundedSemaphore" msgstr "BoundedSemaphore" -#: ../../library/asyncio-sync.rst:341 +#: ../../library/asyncio-sync.rst:347 msgid "A bounded semaphore object. Not thread-safe." msgstr "一個有界的旗號物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:343 +#: ../../library/asyncio-sync.rst:349 msgid "" "Bounded Semaphore is a version of :class:`Semaphore` that raises a :exc:" "`ValueError` in :meth:`~Semaphore.release` if it increases the internal " @@ -524,15 +524,15 @@ msgstr "" "加至大於初始 *value* 值的話,:exc:`ValueError` 會在 :meth:`~Semaphore." "release` 時被引發。" -#: ../../library/asyncio-sync.rst:352 +#: ../../library/asyncio-sync.rst:358 msgid "Barrier" msgstr "Barrier" -#: ../../library/asyncio-sync.rst:356 +#: ../../library/asyncio-sync.rst:362 msgid "A barrier object. Not thread-safe." msgstr "一個屏障 (barrier) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:358 +#: ../../library/asyncio-sync.rst:364 msgid "" "A barrier is a simple synchronization primitive that allows to block until " "*parties* number of tasks are waiting on it. Tasks can wait on the :meth:" @@ -541,17 +541,17 @@ msgid "" "waiting tasks would unblock simultaneously." msgstr "" -#: ../../library/asyncio-sync.rst:364 +#: ../../library/asyncio-sync.rst:370 msgid "" ":keyword:`async with` can be used as an alternative to awaiting on :meth:" "`~Barrier.wait`." msgstr "" -#: ../../library/asyncio-sync.rst:367 +#: ../../library/asyncio-sync.rst:373 msgid "The barrier can be reused any number of times." msgstr "" -#: ../../library/asyncio-sync.rst:373 +#: ../../library/asyncio-sync.rst:379 msgid "" "async def example_barrier():\n" " # barrier with 3 parties\n" @@ -575,11 +575,11 @@ msgid "" "asyncio.run(example_barrier())" msgstr "" -#: ../../library/asyncio-sync.rst:394 +#: ../../library/asyncio-sync.rst:400 msgid "Result of this example is::" msgstr "" -#: ../../library/asyncio-sync.rst:396 +#: ../../library/asyncio-sync.rst:402 msgid "" "\n" "\n" @@ -591,27 +591,27 @@ msgstr "" "barrier passed\n" "" -#: ../../library/asyncio-sync.rst:405 +#: ../../library/asyncio-sync.rst:412 msgid "" "Pass the barrier. When all the tasks party to the barrier have called this " "function, they are all unblocked simultaneously." msgstr "" -#: ../../library/asyncio-sync.rst:408 +#: ../../library/asyncio-sync.rst:415 msgid "" "When a waiting or blocked task in the barrier is cancelled, this task exits " "the barrier which stays in the same state. If the state of the barrier is " "\"filling\", the number of waiting task decreases by 1." msgstr "" -#: ../../library/asyncio-sync.rst:413 +#: ../../library/asyncio-sync.rst:420 msgid "" "The return value is an integer in the range of 0 to ``parties-1``, different " "for each task. This can be used to select a task to do some special " "housekeeping, e.g.::" msgstr "" -#: ../../library/asyncio-sync.rst:417 +#: ../../library/asyncio-sync.rst:424 msgid "" "...\n" "async with barrier as position:\n" @@ -620,26 +620,26 @@ msgid "" " print('End of *draining phase*')" msgstr "" -#: ../../library/asyncio-sync.rst:423 +#: ../../library/asyncio-sync.rst:430 msgid "" "This method may raise a :class:`BrokenBarrierError` exception if the barrier " "is broken or reset while a task is waiting. It could raise a :exc:" "`CancelledError` if a task is cancelled." msgstr "" -#: ../../library/asyncio-sync.rst:429 +#: ../../library/asyncio-sync.rst:437 msgid "" "Return the barrier to the default, empty state. Any tasks waiting on it " "will receive the :class:`BrokenBarrierError` exception." msgstr "" -#: ../../library/asyncio-sync.rst:432 +#: ../../library/asyncio-sync.rst:440 msgid "" "If a barrier is broken it may be better to just leave it and create a new " "one." msgstr "" -#: ../../library/asyncio-sync.rst:436 +#: ../../library/asyncio-sync.rst:445 msgid "" "Put the barrier into a broken state. This causes any active or future calls " "to :meth:`~Barrier.wait` to fail with the :class:`BrokenBarrierError`. Use " @@ -647,25 +647,25 @@ msgid "" "waiting tasks." msgstr "" -#: ../../library/asyncio-sync.rst:443 +#: ../../library/asyncio-sync.rst:452 msgid "The number of tasks required to pass the barrier." msgstr "" -#: ../../library/asyncio-sync.rst:447 +#: ../../library/asyncio-sync.rst:456 msgid "The number of tasks currently waiting in the barrier while filling." msgstr "" -#: ../../library/asyncio-sync.rst:451 +#: ../../library/asyncio-sync.rst:460 msgid "A boolean that is ``True`` if the barrier is in the broken state." msgstr "" -#: ../../library/asyncio-sync.rst:456 +#: ../../library/asyncio-sync.rst:465 msgid "" "This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:" "`Barrier` object is reset or broken." msgstr "" -#: ../../library/asyncio-sync.rst:464 +#: ../../library/asyncio-sync.rst:473 msgid "" "Acquiring a lock using ``await lock`` or ``yield from lock`` and/or :keyword:" "`with` statement (``with await lock``, ``with (yield from lock)``) was " diff --git a/library/asyncio-task.po b/library/asyncio-task.po index 61341b2013..65aa9231e1 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-13 00:14+0000\n" +"POT-Creation-Date: 2025-04-14 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -199,8 +199,8 @@ msgstr "" #: ../../library/asyncio-task.rst:110 msgid "" -"The :class:`asyncio.TaskGroup` class provides a more modern alternative to :" -"func:`create_task`. Using this API, the last example becomes::" +"The :class:`asyncio.TaskGroup` class provides a more modern alternative " +"to :func:`create_task`. Using this API, the last example becomes::" msgstr "" #: ../../library/asyncio-task.rst:114 @@ -234,8 +234,8 @@ msgstr "" #: ../../library/asyncio-task.rst:139 msgid "" -"We say that an object is an **awaitable** object if it can be used in an :" -"keyword:`await` expression. Many asyncio APIs are designed to accept " +"We say that an object is an **awaitable** object if it can be used in " +"an :keyword:`await` expression. Many asyncio APIs are designed to accept " "awaitables." msgstr "" @@ -295,8 +295,9 @@ msgstr "" #: ../../library/asyncio-task.rst:183 msgid "" -"When a coroutine is wrapped into a *Task* with functions like :func:`asyncio." -"create_task` the coroutine is automatically scheduled to run soon::" +"When a coroutine is wrapped into a *Task* with functions " +"like :func:`asyncio.create_task` the coroutine is automatically scheduled to " +"run soon::" msgstr "" #: ../../library/asyncio-task.rst:187 @@ -366,8 +367,8 @@ msgstr "" #: ../../library/asyncio-task.rst:230 msgid "" -"A good example of a low-level function that returns a Future object is :meth:" -"`loop.run_in_executor`." +"A good example of a low-level function that returns a Future object " +"is :meth:`loop.run_in_executor`." msgstr "" #: ../../library/asyncio-task.rst:235 @@ -386,21 +387,22 @@ msgstr "" #: ../../library/asyncio-task.rst:246 msgid "" -"If *name* is not ``None``, it is set as the name of the task using :meth:" -"`Task.set_name`." +"If *name* is not ``None``, it is set as the name of the task " +"using :meth:`Task.set_name`." msgstr "" #: ../../library/asyncio-task.rst:249 msgid "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *coro* to run in. The current context " -"copy is created when no *context* is provided." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *coro* to run in. The current " +"context copy is created when no *context* is provided." msgstr "" #: ../../library/asyncio-task.rst:253 msgid "" -"The task is executed in the loop returned by :func:`get_running_loop`, :exc:" -"`RuntimeError` is raised if there is no running loop in current thread." +"The task is executed in the loop returned " +"by :func:`get_running_loop`, :exc:`RuntimeError` is raised if there is no " +"running loop in current thread." msgstr "" #: ../../library/asyncio-task.rst:259 @@ -435,11 +437,11 @@ msgid "" " task.add_done_callback(background_tasks.discard)" msgstr "" -#: ../../library/asyncio-task.rst:287 ../../library/asyncio-task.rst:1188 +#: ../../library/asyncio-task.rst:287 ../../library/asyncio-task.rst:1192 msgid "Added the *name* parameter." msgstr "新增 *name* 參數。" -#: ../../library/asyncio-task.rst:290 ../../library/asyncio-task.rst:1195 +#: ../../library/asyncio-task.rst:290 ../../library/asyncio-task.rst:1199 msgid "Added the *context* parameter." msgstr "新增 *context* 參數。" @@ -449,28 +451,30 @@ msgstr "" #: ../../library/asyncio-task.rst:297 msgid "" -"Tasks can easily and safely be cancelled. When a task is cancelled, :exc:" -"`asyncio.CancelledError` will be raised in the task at the next opportunity." +"Tasks can easily and safely be cancelled. When a task is " +"cancelled, :exc:`asyncio.CancelledError` will be raised in the task at the " +"next opportunity." msgstr "" #: ../../library/asyncio-task.rst:301 msgid "" "It is recommended that coroutines use ``try/finally`` blocks to robustly " "perform clean-up logic. In case :exc:`asyncio.CancelledError` is explicitly " -"caught, it should generally be propagated when clean-up is complete. :exc:" -"`asyncio.CancelledError` directly subclasses :exc:`BaseException` so most " -"code will not need to be aware of it." +"caught, it should generally be propagated when clean-up is " +"complete. :exc:`asyncio.CancelledError` directly " +"subclasses :exc:`BaseException` so most code will not need to be aware of it." msgstr "" #: ../../library/asyncio-task.rst:307 msgid "" -"The asyncio components that enable structured concurrency, like :class:" -"`asyncio.TaskGroup` and :func:`asyncio.timeout`, are implemented using " -"cancellation internally and might misbehave if a coroutine swallows :exc:" -"`asyncio.CancelledError`. Similarly, user code should not generally call :" -"meth:`uncancel `. However, in cases when suppressing :" -"exc:`asyncio.CancelledError` is truly desired, it is necessary to also call " -"``uncancel()`` to completely remove the cancellation state." +"The asyncio components that enable structured concurrency, " +"like :class:`asyncio.TaskGroup` and :func:`asyncio.timeout`, are implemented " +"using cancellation internally and might misbehave if a coroutine " +"swallows :exc:`asyncio.CancelledError`. Similarly, user code should not " +"generally call :meth:`uncancel `. However, in cases " +"when suppressing :exc:`asyncio.CancelledError` is truly desired, it is " +"necessary to also call ``uncancel()`` to completely remove the cancellation " +"state." msgstr "" #: ../../library/asyncio-task.rst:319 @@ -492,19 +496,19 @@ msgstr "" #: ../../library/asyncio-task.rst:335 msgid "" -"Create a task in this task group. The signature matches that of :func:" -"`asyncio.create_task`. If the task group is inactive (e.g. not yet entered, " -"already finished, or in the process of shutting down), we will close the " -"given ``coro``." +"Create a task in this task group. The signature matches that " +"of :func:`asyncio.create_task`. If the task group is inactive (e.g. not yet " +"entered, already finished, or in the process of shutting down), we will " +"close the given ``coro``." msgstr "" #: ../../library/asyncio-task.rst:343 msgid "Close the given coroutine if the task group is not active." msgstr "" -#: ../../library/asyncio-task.rst:345 ../../library/asyncio-task.rst:550 -#: ../../library/asyncio-task.rst:723 ../../library/asyncio-task.rst:781 -#: ../../library/asyncio-task.rst:807 ../../library/asyncio-task.rst:847 +#: ../../library/asyncio-task.rst:345 ../../library/asyncio-task.rst:551 +#: ../../library/asyncio-task.rst:724 ../../library/asyncio-task.rst:782 +#: ../../library/asyncio-task.rst:808 ../../library/asyncio-task.rst:849 msgid "Example::" msgstr "範例: ::" @@ -514,8 +518,8 @@ msgid "" " async with asyncio.TaskGroup() as tg:\n" " task1 = tg.create_task(some_coro(...))\n" " task2 = tg.create_task(another_coro(...))\n" -" print(f\"Both tasks have completed now: {task1.result()}, {task2." -"result()}\")" +" print(f\"Both tasks have completed now: {task1.result()}, " +"{task2.result()}\")" msgstr "" #: ../../library/asyncio-task.rst:353 @@ -532,11 +536,11 @@ msgid "" "The first time any of the tasks belonging to the group fails with an " "exception other than :exc:`asyncio.CancelledError`, the remaining tasks in " "the group are cancelled. No further tasks can then be added to the group. At " -"this point, if the body of the ``async with`` statement is still active (i." -"e., :meth:`~object.__aexit__` hasn't been called yet), the task directly " -"containing the ``async with`` statement is also cancelled. The resulting :" -"exc:`asyncio.CancelledError` will interrupt an ``await``, but it will not " -"bubble out of the containing ``async with`` statement." +"this point, if the body of the ``async with`` statement is still active " +"(i.e., :meth:`~object.__aexit__` hasn't been called yet), the task directly " +"containing the ``async with`` statement is also cancelled. The " +"resulting :exc:`asyncio.CancelledError` will interrupt an ``await``, but it " +"will not bubble out of the containing ``async with`` statement." msgstr "" #: ../../library/asyncio-task.rst:370 @@ -549,23 +553,24 @@ msgstr "" #: ../../library/asyncio-task.rst:377 msgid "" -"Two base exceptions are treated specially: If any task fails with :exc:" -"`KeyboardInterrupt` or :exc:`SystemExit`, the task group still cancels the " -"remaining tasks and waits for them, but then the initial :exc:" -"`KeyboardInterrupt` or :exc:`SystemExit` is re-raised instead of :exc:" -"`ExceptionGroup` or :exc:`BaseExceptionGroup`." +"Two base exceptions are treated specially: If any task fails " +"with :exc:`KeyboardInterrupt` or :exc:`SystemExit`, the task group still " +"cancels the remaining tasks and waits for them, but then the " +"initial :exc:`KeyboardInterrupt` or :exc:`SystemExit` is re-raised instead " +"of :exc:`ExceptionGroup` or :exc:`BaseExceptionGroup`." msgstr "" #: ../../library/asyncio-task.rst:383 msgid "" -"If the body of the ``async with`` statement exits with an exception (so :" -"meth:`~object.__aexit__` is called with an exception set), this is treated " -"the same as if one of the tasks failed: the remaining tasks are cancelled " -"and then waited for, and non-cancellation exceptions are grouped into an " -"exception group and raised. The exception passed into :meth:`~object." -"__aexit__`, unless it is :exc:`asyncio.CancelledError`, is also included in " -"the exception group. The same special case is made for :exc:" -"`KeyboardInterrupt` and :exc:`SystemExit` as in the previous paragraph." +"If the body of the ``async with`` statement exits with an exception " +"(so :meth:`~object.__aexit__` is called with an exception set), this is " +"treated the same as if one of the tasks failed: the remaining tasks are " +"cancelled and then waited for, and non-cancellation exceptions are grouped " +"into an exception group and raised. The exception passed " +"into :meth:`~object.__aexit__`, unless it is :exc:`asyncio.CancelledError`, " +"is also included in the exception group. The same special case is made " +"for :exc:`KeyboardInterrupt` and :exc:`SystemExit` as in the previous " +"paragraph." msgstr "" #: ../../library/asyncio-task.rst:395 @@ -582,15 +587,16 @@ msgstr "" #: ../../library/asyncio-task.rst:403 msgid "" "In the case where a task group is cancelled externally and also must raise " -"an :exc:`ExceptionGroup`, it will call the parent task's :meth:`~asyncio." -"Task.cancel` method. This ensures that a :exc:`asyncio.CancelledError` will " -"be raised at the next :keyword:`await`, so the cancellation is not lost." +"an :exc:`ExceptionGroup`, it will call the parent " +"task's :meth:`~asyncio.Task.cancel` method. This ensures that " +"a :exc:`asyncio.CancelledError` will be raised at the next :keyword:`await`, " +"so the cancellation is not lost." msgstr "" #: ../../library/asyncio-task.rst:409 msgid "" -"Task groups preserve the cancellation count reported by :meth:`asyncio.Task." -"cancelling`." +"Task groups preserve the cancellation count reported " +"by :meth:`asyncio.Task.cancelling`." msgstr "" #: ../../library/asyncio-task.rst:414 @@ -658,34 +664,34 @@ msgstr "" msgid "Sleeping" msgstr "" -#: ../../library/asyncio-task.rst:469 +#: ../../library/asyncio-task.rst:470 msgid "Block for *delay* seconds." msgstr "" -#: ../../library/asyncio-task.rst:471 +#: ../../library/asyncio-task.rst:472 msgid "" "If *result* is provided, it is returned to the caller when the coroutine " "completes." msgstr "" -#: ../../library/asyncio-task.rst:474 +#: ../../library/asyncio-task.rst:475 msgid "" "``sleep()`` always suspends the current task, allowing other tasks to run." msgstr "" -#: ../../library/asyncio-task.rst:477 +#: ../../library/asyncio-task.rst:478 msgid "" "Setting the delay to 0 provides an optimized path to allow other tasks to " "run. This can be used by long-running functions to avoid blocking the event " "loop for the full duration of the function call." msgstr "" -#: ../../library/asyncio-task.rst:483 +#: ../../library/asyncio-task.rst:484 msgid "" "Example of coroutine displaying the current date every second for 5 seconds::" msgstr "" -#: ../../library/asyncio-task.rst:486 +#: ../../library/asyncio-task.rst:487 msgid "" "import asyncio\n" "import datetime\n" @@ -715,40 +721,40 @@ msgstr "" "\n" "asyncio.run(display_date())" -#: ../../library/asyncio-task.rst:501 ../../library/asyncio-task.rst:599 -#: ../../library/asyncio-task.rst:698 ../../library/asyncio-task.rst:872 -#: ../../library/asyncio-task.rst:926 ../../library/asyncio-task.rst:983 +#: ../../library/asyncio-task.rst:502 ../../library/asyncio-task.rst:600 +#: ../../library/asyncio-task.rst:699 ../../library/asyncio-task.rst:874 +#: ../../library/asyncio-task.rst:929 ../../library/asyncio-task.rst:986 msgid "Removed the *loop* parameter." msgstr "移除 *loop* 參數。" -#: ../../library/asyncio-task.rst:504 +#: ../../library/asyncio-task.rst:505 msgid "Raises :exc:`ValueError` if *delay* is :data:`~math.nan`." msgstr "" -#: ../../library/asyncio-task.rst:509 +#: ../../library/asyncio-task.rst:510 msgid "Running Tasks Concurrently" msgstr "" -#: ../../library/asyncio-task.rst:513 +#: ../../library/asyncio-task.rst:514 msgid "" "Run :ref:`awaitable objects ` in the *aws* sequence " "*concurrently*." msgstr "" -#: ../../library/asyncio-task.rst:516 +#: ../../library/asyncio-task.rst:517 msgid "" "If any awaitable in *aws* is a coroutine, it is automatically scheduled as a " "Task." msgstr "" -#: ../../library/asyncio-task.rst:519 +#: ../../library/asyncio-task.rst:520 msgid "" "If all awaitables are completed successfully, the result is an aggregate " "list of returned values. The order of result values corresponds to the " "order of awaitables in *aws*." msgstr "" -#: ../../library/asyncio-task.rst:523 +#: ../../library/asyncio-task.rst:524 msgid "" "If *return_exceptions* is ``False`` (default), the first raised exception is " "immediately propagated to the task that awaits on ``gather()``. Other " @@ -756,19 +762,19 @@ msgid "" "run." msgstr "" -#: ../../library/asyncio-task.rst:528 +#: ../../library/asyncio-task.rst:529 msgid "" "If *return_exceptions* is ``True``, exceptions are treated the same as " "successful results, and aggregated in the result list." msgstr "" -#: ../../library/asyncio-task.rst:531 +#: ../../library/asyncio-task.rst:532 msgid "" "If ``gather()`` is *cancelled*, all submitted awaitables (that have not " "completed yet) are also *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:534 +#: ../../library/asyncio-task.rst:535 msgid "" "If any Task or Future from the *aws* sequence is *cancelled*, it is treated " "as if it raised :exc:`CancelledError` -- the ``gather()`` call is **not** " @@ -776,7 +782,7 @@ msgid "" "submitted Task/Future to cause other Tasks/Futures to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:541 +#: ../../library/asyncio-task.rst:542 msgid "" "A new alternative to create and run tasks concurrently and wait for their " "completion is :class:`asyncio.TaskGroup`. *TaskGroup* provides stronger " @@ -786,7 +792,7 @@ msgid "" "tasks)." msgstr "" -#: ../../library/asyncio-task.rst:552 +#: ../../library/asyncio-task.rst:553 msgid "" "import asyncio\n" "\n" @@ -825,7 +831,7 @@ msgid "" "# [2, 6, 24]" msgstr "" -#: ../../library/asyncio-task.rst:588 +#: ../../library/asyncio-task.rst:589 msgid "" "If *return_exceptions* is false, cancelling gather() after it has been " "marked done won't cancel any submitted awaitables. For instance, gather can " @@ -834,44 +840,44 @@ msgid "" "the awaitables) from gather won't cancel any other awaitables." msgstr "" -#: ../../library/asyncio-task.rst:595 +#: ../../library/asyncio-task.rst:596 msgid "" "If the *gather* itself is cancelled, the cancellation is propagated " "regardless of *return_exceptions*." msgstr "" -#: ../../library/asyncio-task.rst:602 +#: ../../library/asyncio-task.rst:603 msgid "" "Deprecation warning is emitted if no positional arguments are provided or " "not all positional arguments are Future-like objects and there is no running " "event loop." msgstr "" -#: ../../library/asyncio-task.rst:611 +#: ../../library/asyncio-task.rst:612 msgid "Eager Task Factory" msgstr "" -#: ../../library/asyncio-task.rst:615 +#: ../../library/asyncio-task.rst:616 msgid "A task factory for eager task execution." msgstr "" -#: ../../library/asyncio-task.rst:617 +#: ../../library/asyncio-task.rst:618 msgid "" -"When using this factory (via :meth:`loop.set_task_factory(asyncio." -"eager_task_factory) `), coroutines begin execution " -"synchronously during :class:`Task` construction. Tasks are only scheduled on " -"the event loop if they block. This can be a performance improvement as the " -"overhead of loop scheduling is avoided for coroutines that complete " -"synchronously." +"When using this factory " +"(via :meth:`loop.set_task_factory(asyncio.eager_task_factory) " +"`), coroutines begin execution synchronously " +"during :class:`Task` construction. Tasks are only scheduled on the event " +"loop if they block. This can be a performance improvement as the overhead of " +"loop scheduling is avoided for coroutines that complete synchronously." msgstr "" -#: ../../library/asyncio-task.rst:623 +#: ../../library/asyncio-task.rst:624 msgid "" "A common example where this is beneficial is coroutines which employ caching " "or memoization to avoid actual I/O when possible." msgstr "" -#: ../../library/asyncio-task.rst:628 +#: ../../library/asyncio-task.rst:629 msgid "" "Immediate execution of the coroutine is a semantic change. If the coroutine " "returns or raises, the task is never scheduled to the event loop. If the " @@ -880,46 +886,46 @@ msgid "" "the application's task execution order is likely to change." msgstr "" -#: ../../library/asyncio-task.rst:639 +#: ../../library/asyncio-task.rst:640 msgid "" "Create an eager task factory, similar to :func:`eager_task_factory`, using " "the provided *custom_task_constructor* when creating a new task instead of " "the default :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:643 +#: ../../library/asyncio-task.rst:644 msgid "" "*custom_task_constructor* must be a *callable* with the signature matching " -"the signature of :class:`Task.__init__ `. The callable must return a :" -"class:`asyncio.Task`-compatible object." +"the signature of :class:`Task.__init__ `. The callable must return " +"a :class:`asyncio.Task`-compatible object." msgstr "" -#: ../../library/asyncio-task.rst:647 +#: ../../library/asyncio-task.rst:648 msgid "" "This function returns a *callable* intended to be used as a task factory of " -"an event loop via :meth:`loop.set_task_factory(factory) `)." +"an event loop via :meth:`loop.set_task_factory(factory) " +"`)." msgstr "" -#: ../../library/asyncio-task.rst:654 +#: ../../library/asyncio-task.rst:655 msgid "Shielding From Cancellation" msgstr "" -#: ../../library/asyncio-task.rst:658 +#: ../../library/asyncio-task.rst:659 msgid "" -"Protect an :ref:`awaitable object ` from being :meth:" -"`cancelled `." +"Protect an :ref:`awaitable object ` from " +"being :meth:`cancelled `." msgstr "" -#: ../../library/asyncio-task.rst:661 ../../library/asyncio-task.rst:827 +#: ../../library/asyncio-task.rst:662 ../../library/asyncio-task.rst:829 msgid "If *aw* is a coroutine it is automatically scheduled as a Task." msgstr "" -#: ../../library/asyncio-task.rst:663 +#: ../../library/asyncio-task.rst:664 msgid "The statement::" msgstr "" -#: ../../library/asyncio-task.rst:665 +#: ../../library/asyncio-task.rst:666 msgid "" "task = asyncio.create_task(something())\n" "res = await shield(task)" @@ -927,37 +933,37 @@ msgstr "" "task = asyncio.create_task(something())\n" "res = await shield(task)" -#: ../../library/asyncio-task.rst:668 +#: ../../library/asyncio-task.rst:669 msgid "is equivalent to::" msgstr "" -#: ../../library/asyncio-task.rst:670 +#: ../../library/asyncio-task.rst:671 msgid "res = await something()" msgstr "res = await something()" -#: ../../library/asyncio-task.rst:672 +#: ../../library/asyncio-task.rst:673 msgid "" "*except* that if the coroutine containing it is cancelled, the Task running " "in ``something()`` is not cancelled. From the point of view of " "``something()``, the cancellation did not happen. Although its caller is " -"still cancelled, so the \"await\" expression still raises a :exc:" -"`CancelledError`." +"still cancelled, so the \"await\" expression still raises " +"a :exc:`CancelledError`." msgstr "" -#: ../../library/asyncio-task.rst:678 +#: ../../library/asyncio-task.rst:679 msgid "" "If ``something()`` is cancelled by other means (i.e. from within itself) " "that would also cancel ``shield()``." msgstr "" -#: ../../library/asyncio-task.rst:681 +#: ../../library/asyncio-task.rst:682 msgid "" "If it is desired to completely ignore cancellation (not recommended) the " "``shield()`` function should be combined with a try/except clause, as " "follows::" msgstr "" -#: ../../library/asyncio-task.rst:685 +#: ../../library/asyncio-task.rst:686 msgid "" "task = asyncio.create_task(something())\n" "try:\n" @@ -971,7 +977,7 @@ msgstr "" "except CancelledError:\n" " res = None" -#: ../../library/asyncio-task.rst:693 +#: ../../library/asyncio-task.rst:694 msgid "" "Save a reference to tasks passed to this function, to avoid a task " "disappearing mid-execution. The event loop only keeps weak references to " @@ -979,36 +985,36 @@ msgid "" "any time, even before it's done." msgstr "" -#: ../../library/asyncio-task.rst:701 +#: ../../library/asyncio-task.rst:702 msgid "" "Deprecation warning is emitted if *aw* is not Future-like object and there " "is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:707 +#: ../../library/asyncio-task.rst:708 msgid "Timeouts" msgstr "" -#: ../../library/asyncio-task.rst:711 +#: ../../library/asyncio-task.rst:712 msgid "" "Return an :ref:`asynchronous context manager ` that " "can be used to limit the amount of time spent waiting on something." msgstr "" -#: ../../library/asyncio-task.rst:715 +#: ../../library/asyncio-task.rst:716 msgid "" "*delay* can either be ``None``, or a float/int number of seconds to wait. If " "*delay* is ``None``, no time limit will be applied; this can be useful if " "the delay is unknown when the context manager is created." msgstr "" -#: ../../library/asyncio-task.rst:720 +#: ../../library/asyncio-task.rst:721 msgid "" -"In either case, the context manager can be rescheduled after creation using :" -"meth:`Timeout.reschedule`." +"In either case, the context manager can be rescheduled after creation " +"using :meth:`Timeout.reschedule`." msgstr "" -#: ../../library/asyncio-task.rst:725 +#: ../../library/asyncio-task.rst:726 msgid "" "async def main():\n" " async with asyncio.timeout(10):\n" @@ -1018,26 +1024,26 @@ msgstr "" " async with asyncio.timeout(10):\n" " await long_running_task()" -#: ../../library/asyncio-task.rst:729 +#: ../../library/asyncio-task.rst:730 msgid "" "If ``long_running_task`` takes more than 10 seconds to complete, the context " -"manager will cancel the current task and handle the resulting :exc:`asyncio." -"CancelledError` internally, transforming it into a :exc:`TimeoutError` which " -"can be caught and handled." +"manager will cancel the current task and handle the " +"resulting :exc:`asyncio.CancelledError` internally, transforming it into " +"a :exc:`TimeoutError` which can be caught and handled." msgstr "" -#: ../../library/asyncio-task.rst:736 +#: ../../library/asyncio-task.rst:737 msgid "" -"The :func:`asyncio.timeout` context manager is what transforms the :exc:" -"`asyncio.CancelledError` into a :exc:`TimeoutError`, which means the :exc:" -"`TimeoutError` can only be caught *outside* of the context manager." +"The :func:`asyncio.timeout` context manager is what transforms " +"the :exc:`asyncio.CancelledError` into a :exc:`TimeoutError`, which means " +"the :exc:`TimeoutError` can only be caught *outside* of the context manager." msgstr "" -#: ../../library/asyncio-task.rst:741 +#: ../../library/asyncio-task.rst:742 msgid "Example of catching :exc:`TimeoutError`::" msgstr "" -#: ../../library/asyncio-task.rst:743 +#: ../../library/asyncio-task.rst:744 msgid "" "async def main():\n" " try:\n" @@ -1049,48 +1055,48 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -#: ../../library/asyncio-task.rst:752 +#: ../../library/asyncio-task.rst:753 msgid "" "The context manager produced by :func:`asyncio.timeout` can be rescheduled " "to a different deadline and inspected." msgstr "" -#: ../../library/asyncio-task.rst:757 +#: ../../library/asyncio-task.rst:758 msgid "" "An :ref:`asynchronous context manager ` for " "cancelling overdue coroutines." msgstr "" -#: ../../library/asyncio-task.rst:760 +#: ../../library/asyncio-task.rst:761 msgid "" "``when`` should be an absolute time at which the context should time out, as " "measured by the event loop's clock:" msgstr "" -#: ../../library/asyncio-task.rst:763 +#: ../../library/asyncio-task.rst:764 msgid "If ``when`` is ``None``, the timeout will never trigger." msgstr "" -#: ../../library/asyncio-task.rst:764 +#: ../../library/asyncio-task.rst:765 msgid "" "If ``when < loop.time()``, the timeout will trigger on the next iteration of " "the event loop." msgstr "" -#: ../../library/asyncio-task.rst:769 +#: ../../library/asyncio-task.rst:770 msgid "" "Return the current deadline, or ``None`` if the current deadline is not set." msgstr "" -#: ../../library/asyncio-task.rst:774 +#: ../../library/asyncio-task.rst:775 msgid "Reschedule the timeout." msgstr "" -#: ../../library/asyncio-task.rst:778 +#: ../../library/asyncio-task.rst:779 msgid "Return whether the context manager has exceeded its deadline (expired)." msgstr "" -#: ../../library/asyncio-task.rst:783 +#: ../../library/asyncio-task.rst:784 msgid "" "async def main():\n" " try:\n" @@ -1108,17 +1114,17 @@ msgid "" " print(\"Looks like we haven't finished on time.\")" msgstr "" -#: ../../library/asyncio-task.rst:798 +#: ../../library/asyncio-task.rst:799 msgid "Timeout context managers can be safely nested." msgstr "" -#: ../../library/asyncio-task.rst:804 +#: ../../library/asyncio-task.rst:805 msgid "" "Similar to :func:`asyncio.timeout`, except *when* is the absolute time to " "stop waiting, or ``None``." msgstr "" -#: ../../library/asyncio-task.rst:809 +#: ../../library/asyncio-task.rst:810 msgid "" "async def main():\n" " loop = get_running_loop()\n" @@ -1132,41 +1138,41 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -#: ../../library/asyncio-task.rst:824 +#: ../../library/asyncio-task.rst:826 msgid "" "Wait for the *aw* :ref:`awaitable ` to complete with a " "timeout." msgstr "" -#: ../../library/asyncio-task.rst:829 +#: ../../library/asyncio-task.rst:831 msgid "" "*timeout* can either be ``None`` or a float or int number of seconds to wait " "for. If *timeout* is ``None``, block until the future completes." msgstr "" -#: ../../library/asyncio-task.rst:833 +#: ../../library/asyncio-task.rst:835 msgid "" "If a timeout occurs, it cancels the task and raises :exc:`TimeoutError`." msgstr "" -#: ../../library/asyncio-task.rst:836 +#: ../../library/asyncio-task.rst:838 msgid "" -"To avoid the task :meth:`cancellation `, wrap it in :func:" -"`shield`." +"To avoid the task :meth:`cancellation `, wrap it " +"in :func:`shield`." msgstr "" -#: ../../library/asyncio-task.rst:839 +#: ../../library/asyncio-task.rst:841 msgid "" "The function will wait until the future is actually cancelled, so the total " "wait time may exceed the *timeout*. If an exception happens during " "cancellation, it is propagated." msgstr "" -#: ../../library/asyncio-task.rst:843 +#: ../../library/asyncio-task.rst:845 msgid "If the wait is cancelled, the future *aw* is also cancelled." msgstr "" -#: ../../library/asyncio-task.rst:849 +#: ../../library/asyncio-task.rst:851 msgid "" "async def eternity():\n" " # Sleep for one hour\n" @@ -1187,116 +1193,116 @@ msgid "" "# timeout!" msgstr "" -#: ../../library/asyncio-task.rst:867 +#: ../../library/asyncio-task.rst:869 msgid "" "When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be " "cancelled. Previously, it raised :exc:`TimeoutError` immediately." msgstr "" -#: ../../library/asyncio-task.rst:875 +#: ../../library/asyncio-task.rst:877 msgid "Raises :exc:`TimeoutError` instead of :exc:`asyncio.TimeoutError`." msgstr "引發 :exc:`TimeoutError` 而不是 :exc:`asyncio.TimeoutError`。" -#: ../../library/asyncio-task.rst:880 +#: ../../library/asyncio-task.rst:882 msgid "Waiting Primitives" msgstr "" -#: ../../library/asyncio-task.rst:884 +#: ../../library/asyncio-task.rst:887 msgid "" "Run :class:`~asyncio.Future` and :class:`~asyncio.Task` instances in the " "*aws* iterable concurrently and block until the condition specified by " "*return_when*." msgstr "" -#: ../../library/asyncio-task.rst:888 +#: ../../library/asyncio-task.rst:891 msgid "The *aws* iterable must not be empty." msgstr "" -#: ../../library/asyncio-task.rst:890 +#: ../../library/asyncio-task.rst:893 msgid "Returns two sets of Tasks/Futures: ``(done, pending)``." msgstr "" -#: ../../library/asyncio-task.rst:892 +#: ../../library/asyncio-task.rst:895 msgid "Usage::" msgstr "用法: ::" -#: ../../library/asyncio-task.rst:894 +#: ../../library/asyncio-task.rst:897 msgid "done, pending = await asyncio.wait(aws)" msgstr "done, pending = await asyncio.wait(aws)" -#: ../../library/asyncio-task.rst:896 +#: ../../library/asyncio-task.rst:899 msgid "" "*timeout* (a float or int), if specified, can be used to control the maximum " "number of seconds to wait before returning." msgstr "" -#: ../../library/asyncio-task.rst:899 +#: ../../library/asyncio-task.rst:902 msgid "" "Note that this function does not raise :exc:`TimeoutError`. Futures or Tasks " "that aren't done when the timeout occurs are simply returned in the second " "set." msgstr "" -#: ../../library/asyncio-task.rst:903 +#: ../../library/asyncio-task.rst:906 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "" -#: ../../library/asyncio-task.rst:909 +#: ../../library/asyncio-task.rst:912 msgid "Constant" msgstr "常數" -#: ../../library/asyncio-task.rst:910 +#: ../../library/asyncio-task.rst:913 msgid "Description" msgstr "描述" -#: ../../library/asyncio-task.rst:913 +#: ../../library/asyncio-task.rst:916 msgid "The function will return when any future finishes or is cancelled." msgstr "" -#: ../../library/asyncio-task.rst:916 +#: ../../library/asyncio-task.rst:919 msgid "" "The function will return when any future finishes by raising an exception. " -"If no future raises an exception then it is equivalent to :const:" -"`ALL_COMPLETED`." +"If no future raises an exception then it is equivalent " +"to :const:`ALL_COMPLETED`." msgstr "" -#: ../../library/asyncio-task.rst:921 +#: ../../library/asyncio-task.rst:924 msgid "The function will return when all futures finish or are cancelled." msgstr "" -#: ../../library/asyncio-task.rst:923 +#: ../../library/asyncio-task.rst:926 msgid "" "Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the futures " "when a timeout occurs." msgstr "" -#: ../../library/asyncio-task.rst:929 +#: ../../library/asyncio-task.rst:932 msgid "Passing coroutine objects to ``wait()`` directly is forbidden." msgstr "" -#: ../../library/asyncio-task.rst:932 ../../library/asyncio-task.rst:990 +#: ../../library/asyncio-task.rst:935 ../../library/asyncio-task.rst:993 msgid "Added support for generators yielding tasks." msgstr "" -#: ../../library/asyncio-task.rst:938 +#: ../../library/asyncio-task.rst:941 msgid "" "Run :ref:`awaitable objects ` in the *aws* iterable " "concurrently. The returned object can be iterated to obtain the results of " "the awaitables as they finish." msgstr "" -#: ../../library/asyncio-task.rst:942 +#: ../../library/asyncio-task.rst:945 msgid "" -"The object returned by ``as_completed()`` can be iterated as an :term:" -"`asynchronous iterator` or a plain :term:`iterator`. When asynchronous " -"iteration is used, the originally-supplied awaitables are yielded if they " -"are tasks or futures. This makes it easy to correlate previously-scheduled " -"tasks with their results. Example::" +"The object returned by ``as_completed()`` can be iterated as " +"an :term:`asynchronous iterator` or a plain :term:`iterator`. When " +"asynchronous iteration is used, the originally-supplied awaitables are " +"yielded if they are tasks or futures. This makes it easy to correlate " +"previously-scheduled tasks with their results. Example::" msgstr "" -#: ../../library/asyncio-task.rst:948 +#: ../../library/asyncio-task.rst:951 msgid "" "ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" "ipv6_connect = create_task(open_connection(\"::1\", 80))\n" @@ -1313,20 +1319,20 @@ msgid "" " print(\"IPv4 connection established.\")" msgstr "" -#: ../../library/asyncio-task.rst:962 +#: ../../library/asyncio-task.rst:965 msgid "" "During asynchronous iteration, implicitly-created tasks will be yielded for " "supplied awaitables that aren't tasks or futures." msgstr "" -#: ../../library/asyncio-task.rst:965 +#: ../../library/asyncio-task.rst:968 msgid "" "When used as a plain iterator, each iteration yields a new coroutine that " "returns the result or raises the exception of the next completed awaitable. " "This pattern is compatible with Python versions older than 3.13::" msgstr "" -#: ../../library/asyncio-task.rst:969 +#: ../../library/asyncio-task.rst:972 msgid "" "ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" "ipv6_connect = create_task(open_connection(\"::1\", 80))\n" @@ -1339,34 +1345,34 @@ msgid "" " reader, writer = await next_connect" msgstr "" -#: ../../library/asyncio-task.rst:979 +#: ../../library/asyncio-task.rst:982 msgid "" "A :exc:`TimeoutError` is raised if the timeout occurs before all awaitables " "are done. This is raised by the ``async for`` loop during asynchronous " "iteration or by the coroutines yielded during plain iteration." msgstr "" -#: ../../library/asyncio-task.rst:986 +#: ../../library/asyncio-task.rst:989 msgid "" "Deprecation warning is emitted if not all awaitable objects in the *aws* " "iterable are Future-like objects and there is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:993 +#: ../../library/asyncio-task.rst:996 msgid "" "The result can now be used as either an :term:`asynchronous iterator` or as " "a plain :term:`iterator` (previously it was only a plain iterator)." msgstr "" -#: ../../library/asyncio-task.rst:999 +#: ../../library/asyncio-task.rst:1002 msgid "Running in Threads" msgstr "" -#: ../../library/asyncio-task.rst:1003 +#: ../../library/asyncio-task.rst:1007 msgid "Asynchronously run function *func* in a separate thread." msgstr "" -#: ../../library/asyncio-task.rst:1005 +#: ../../library/asyncio-task.rst:1009 msgid "" "Any \\*args and \\*\\*kwargs supplied for this function are directly passed " "to *func*. Also, the current :class:`contextvars.Context` is propagated, " @@ -1374,19 +1380,19 @@ msgid "" "separate thread." msgstr "" -#: ../../library/asyncio-task.rst:1010 +#: ../../library/asyncio-task.rst:1014 msgid "" "Return a coroutine that can be awaited to get the eventual result of *func*." msgstr "" -#: ../../library/asyncio-task.rst:1012 +#: ../../library/asyncio-task.rst:1016 msgid "" "This coroutine function is primarily intended to be used for executing IO-" "bound functions/methods that would otherwise block the event loop if they " "were run in the main thread. For example::" msgstr "" -#: ../../library/asyncio-task.rst:1016 +#: ../../library/asyncio-task.rst:1020 msgid "" "def blocking_io():\n" " print(f\"start blocking_io at {time.strftime('%X')}\")\n" @@ -1415,7 +1421,7 @@ msgid "" "# finished main at 19:50:54" msgstr "" -#: ../../library/asyncio-task.rst:1042 +#: ../../library/asyncio-task.rst:1046 msgid "" "Directly calling ``blocking_io()`` in any coroutine would block the event " "loop for its duration, resulting in an additional 1 second of run time. " @@ -1423,7 +1429,7 @@ msgid "" "thread without blocking the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1049 +#: ../../library/asyncio-task.rst:1053 msgid "" "Due to the :term:`GIL`, ``asyncio.to_thread()`` can typically only be used " "to make IO-bound functions non-blocking. However, for extension modules that " @@ -1431,27 +1437,27 @@ msgid "" "``asyncio.to_thread()`` can also be used for CPU-bound functions." msgstr "" -#: ../../library/asyncio-task.rst:1058 +#: ../../library/asyncio-task.rst:1062 msgid "Scheduling From Other Threads" msgstr "" -#: ../../library/asyncio-task.rst:1062 +#: ../../library/asyncio-task.rst:1066 msgid "Submit a coroutine to the given event loop. Thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:1064 +#: ../../library/asyncio-task.rst:1068 msgid "" "Return a :class:`concurrent.futures.Future` to wait for the result from " "another OS thread." msgstr "" -#: ../../library/asyncio-task.rst:1067 +#: ../../library/asyncio-task.rst:1071 msgid "" "This function is meant to be called from a different OS thread than the one " "where the event loop is running. Example::" msgstr "" -#: ../../library/asyncio-task.rst:1070 +#: ../../library/asyncio-task.rst:1074 msgid "" "# Create a coroutine\n" "coro = asyncio.sleep(1, result=3)\n" @@ -1463,13 +1469,13 @@ msgid "" "assert future.result(timeout) == 3" msgstr "" -#: ../../library/asyncio-task.rst:1079 +#: ../../library/asyncio-task.rst:1083 msgid "" "If an exception is raised in the coroutine, the returned Future will be " "notified. It can also be used to cancel the task in the event loop::" msgstr "" -#: ../../library/asyncio-task.rst:1083 +#: ../../library/asyncio-task.rst:1087 msgid "" "try:\n" " result = future.result(timeout)\n" @@ -1482,59 +1488,59 @@ msgid "" " print(f'The coroutine returned: {result!r}')" msgstr "" -#: ../../library/asyncio-task.rst:1093 +#: ../../library/asyncio-task.rst:1097 msgid "" "See the :ref:`concurrency and multithreading ` " "section of the documentation." msgstr "" -#: ../../library/asyncio-task.rst:1096 +#: ../../library/asyncio-task.rst:1100 msgid "" "Unlike other asyncio functions this function requires the *loop* argument to " "be passed explicitly." msgstr "" -#: ../../library/asyncio-task.rst:1103 +#: ../../library/asyncio-task.rst:1107 msgid "Introspection" msgstr "" -#: ../../library/asyncio-task.rst:1108 +#: ../../library/asyncio-task.rst:1112 msgid "" "Return the currently running :class:`Task` instance, or ``None`` if no task " "is running." msgstr "" -#: ../../library/asyncio-task.rst:1111 +#: ../../library/asyncio-task.rst:1115 msgid "" "If *loop* is ``None`` :func:`get_running_loop` is used to get the current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:1119 +#: ../../library/asyncio-task.rst:1123 msgid "Return a set of not yet finished :class:`Task` objects run by the loop." msgstr "" -#: ../../library/asyncio-task.rst:1122 +#: ../../library/asyncio-task.rst:1126 msgid "" "If *loop* is ``None``, :func:`get_running_loop` is used for getting current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:1130 +#: ../../library/asyncio-task.rst:1134 msgid "Return ``True`` if *obj* is a coroutine object." msgstr "" -#: ../../library/asyncio-task.rst:1136 +#: ../../library/asyncio-task.rst:1140 msgid "Task Object" -msgstr "" +msgstr "Task 物件" -#: ../../library/asyncio-task.rst:1140 +#: ../../library/asyncio-task.rst:1144 msgid "" "A :class:`Future-like ` object that runs a Python :ref:`coroutine " "`. Not thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:1143 +#: ../../library/asyncio-task.rst:1147 msgid "" "Tasks are used to run coroutines in event loops. If a coroutine awaits on a " "Future, the Task suspends the execution of the coroutine and waits for the " @@ -1542,21 +1548,21 @@ msgid "" "wrapped coroutine resumes." msgstr "" -#: ../../library/asyncio-task.rst:1149 +#: ../../library/asyncio-task.rst:1153 msgid "" "Event loops use cooperative scheduling: an event loop runs one Task at a " "time. While a Task awaits for the completion of a Future, the event loop " "runs other Tasks, callbacks, or performs IO operations." msgstr "" -#: ../../library/asyncio-task.rst:1154 +#: ../../library/asyncio-task.rst:1158 msgid "" "Use the high-level :func:`asyncio.create_task` function to create Tasks, or " "the low-level :meth:`loop.create_task` or :func:`ensure_future` functions. " "Manual instantiation of Tasks is discouraged." msgstr "" -#: ../../library/asyncio-task.rst:1159 +#: ../../library/asyncio-task.rst:1163 msgid "" "To cancel a running Task use the :meth:`cancel` method. Calling it will " "cause the Task to throw a :exc:`CancelledError` exception into the wrapped " @@ -1564,28 +1570,28 @@ msgid "" "cancellation, the Future object will be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1164 +#: ../../library/asyncio-task.rst:1168 msgid "" ":meth:`cancelled` can be used to check if the Task was cancelled. The method " -"returns ``True`` if the wrapped coroutine did not suppress the :exc:" -"`CancelledError` exception and was actually cancelled." +"returns ``True`` if the wrapped coroutine did not suppress " +"the :exc:`CancelledError` exception and was actually cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1169 +#: ../../library/asyncio-task.rst:1173 msgid "" -":class:`asyncio.Task` inherits from :class:`Future` all of its APIs except :" -"meth:`Future.set_result` and :meth:`Future.set_exception`." +":class:`asyncio.Task` inherits from :class:`Future` all of its APIs " +"except :meth:`Future.set_result` and :meth:`Future.set_exception`." msgstr "" -#: ../../library/asyncio-task.rst:1173 +#: ../../library/asyncio-task.rst:1177 msgid "" -"An optional keyword-only *context* argument allows specifying a custom :" -"class:`contextvars.Context` for the *coro* to run in. If no *context* is " -"provided, the Task copies the current context and later runs its coroutine " -"in the copied context." +"An optional keyword-only *context* argument allows specifying a " +"custom :class:`contextvars.Context` for the *coro* to run in. If no " +"*context* is provided, the Task copies the current context and later runs " +"its coroutine in the copied context." msgstr "" -#: ../../library/asyncio-task.rst:1178 +#: ../../library/asyncio-task.rst:1182 msgid "" "An optional keyword-only *eager_start* argument allows eagerly starting the " "execution of the :class:`asyncio.Task` at task creation time. If set to " @@ -1595,96 +1601,96 @@ msgid "" "eagerly and will skip scheduling to the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1185 +#: ../../library/asyncio-task.rst:1189 msgid "Added support for the :mod:`contextvars` module." msgstr "" -#: ../../library/asyncio-task.rst:1191 +#: ../../library/asyncio-task.rst:1195 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" -#: ../../library/asyncio-task.rst:1198 +#: ../../library/asyncio-task.rst:1202 msgid "Added the *eager_start* parameter." msgstr "新增 *eager_start* 參數。" -#: ../../library/asyncio-task.rst:1203 +#: ../../library/asyncio-task.rst:1207 msgid "Return ``True`` if the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:1205 +#: ../../library/asyncio-task.rst:1209 msgid "" "A Task is *done* when the wrapped coroutine either returned a value, raised " "an exception, or the Task was cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1210 +#: ../../library/asyncio-task.rst:1214 msgid "Return the result of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1212 +#: ../../library/asyncio-task.rst:1216 msgid "" "If the Task is *done*, the result of the wrapped coroutine is returned (or " "if the coroutine raised an exception, that exception is re-raised.)" msgstr "" -#: ../../library/asyncio-task.rst:1216 ../../library/asyncio-task.rst:1230 +#: ../../library/asyncio-task.rst:1220 ../../library/asyncio-task.rst:1234 msgid "" "If the Task has been *cancelled*, this method raises a :exc:`CancelledError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:1219 +#: ../../library/asyncio-task.rst:1223 msgid "" -"If the Task's result isn't yet available, this method raises an :exc:" -"`InvalidStateError` exception." +"If the Task's result isn't yet available, this method raises " +"an :exc:`InvalidStateError` exception." msgstr "" -#: ../../library/asyncio-task.rst:1224 +#: ../../library/asyncio-task.rst:1228 msgid "Return the exception of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1226 +#: ../../library/asyncio-task.rst:1230 msgid "" "If the wrapped coroutine raised an exception that exception is returned. If " "the wrapped coroutine returned normally this method returns ``None``." msgstr "" -#: ../../library/asyncio-task.rst:1233 +#: ../../library/asyncio-task.rst:1237 msgid "" "If the Task isn't *done* yet, this method raises an :exc:`InvalidStateError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:1238 +#: ../../library/asyncio-task.rst:1242 msgid "Add a callback to be run when the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:1240 ../../library/asyncio-task.rst:1249 +#: ../../library/asyncio-task.rst:1244 ../../library/asyncio-task.rst:1253 msgid "This method should only be used in low-level callback-based code." msgstr "" -#: ../../library/asyncio-task.rst:1242 +#: ../../library/asyncio-task.rst:1246 msgid "" "See the documentation of :meth:`Future.add_done_callback` for more details." msgstr "" -#: ../../library/asyncio-task.rst:1247 +#: ../../library/asyncio-task.rst:1251 msgid "Remove *callback* from the callbacks list." msgstr "" -#: ../../library/asyncio-task.rst:1251 +#: ../../library/asyncio-task.rst:1255 msgid "" "See the documentation of :meth:`Future.remove_done_callback` for more " "details." msgstr "" -#: ../../library/asyncio-task.rst:1256 +#: ../../library/asyncio-task.rst:1260 msgid "Return the list of stack frames for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1258 +#: ../../library/asyncio-task.rst:1262 msgid "" "If the wrapped coroutine is not done, this returns the stack where it is " "suspended. If the coroutine has completed successfully or was cancelled, " @@ -1692,15 +1698,15 @@ msgid "" "this returns the list of traceback frames." msgstr "" -#: ../../library/asyncio-task.rst:1264 +#: ../../library/asyncio-task.rst:1268 msgid "The frames are always ordered from oldest to newest." msgstr "" -#: ../../library/asyncio-task.rst:1266 +#: ../../library/asyncio-task.rst:1270 msgid "Only one stack frame is returned for a suspended coroutine." msgstr "" -#: ../../library/asyncio-task.rst:1268 +#: ../../library/asyncio-task.rst:1272 msgid "" "The optional *limit* argument sets the maximum number of frames to return; " "by default all available frames are returned. The ordering of the returned " @@ -1709,107 +1715,113 @@ msgid "" "are returned. (This matches the behavior of the traceback module.)" msgstr "" -#: ../../library/asyncio-task.rst:1277 +#: ../../library/asyncio-task.rst:1281 msgid "Print the stack or traceback for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1279 +#: ../../library/asyncio-task.rst:1283 msgid "" "This produces output similar to that of the traceback module for the frames " "retrieved by :meth:`get_stack`." msgstr "" -#: ../../library/asyncio-task.rst:1282 +#: ../../library/asyncio-task.rst:1286 msgid "The *limit* argument is passed to :meth:`get_stack` directly." msgstr "" -#: ../../library/asyncio-task.rst:1284 +#: ../../library/asyncio-task.rst:1288 msgid "" "The *file* argument is an I/O stream to which the output is written; by " "default output is written to :data:`sys.stdout`." msgstr "" -#: ../../library/asyncio-task.rst:1289 +#: ../../library/asyncio-task.rst:1293 msgid "Return the coroutine object wrapped by the :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:1293 +#: ../../library/asyncio-task.rst:1297 msgid "" "This will return ``None`` for Tasks which have already completed eagerly. " "See the :ref:`Eager Task Factory `." msgstr "" -#: ../../library/asyncio-task.rst:1300 +#: ../../library/asyncio-task.rst:1304 msgid "Newly added eager task execution means result may be ``None``." msgstr "" -#: ../../library/asyncio-task.rst:1304 +#: ../../library/asyncio-task.rst:1308 msgid "" "Return the :class:`contextvars.Context` object associated with the task." msgstr "" -#: ../../library/asyncio-task.rst:1311 +#: ../../library/asyncio-task.rst:1315 msgid "Return the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1313 +#: ../../library/asyncio-task.rst:1317 msgid "" "If no name has been explicitly assigned to the Task, the default asyncio " "Task implementation generates a default name during instantiation." msgstr "" -#: ../../library/asyncio-task.rst:1321 +#: ../../library/asyncio-task.rst:1325 msgid "Set the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1323 +#: ../../library/asyncio-task.rst:1327 msgid "" "The *value* argument can be any object, which is then converted to a string." msgstr "" -#: ../../library/asyncio-task.rst:1326 +#: ../../library/asyncio-task.rst:1330 msgid "" -"In the default Task implementation, the name will be visible in the :func:" -"`repr` output of a task object." +"In the default Task implementation, the name will be visible in " +"the :func:`repr` output of a task object." msgstr "" -#: ../../library/asyncio-task.rst:1333 +#: ../../library/asyncio-task.rst:1337 msgid "Request the Task to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1335 +#: ../../library/asyncio-task.rst:1339 +msgid "" +"If the Task is already *done* or *cancelled*, return ``False``, otherwise, " +"return ``True``." +msgstr "" + +#: ../../library/asyncio-task.rst:1342 msgid "" -"This arranges for a :exc:`CancelledError` exception to be thrown into the " -"wrapped coroutine on the next cycle of the event loop." +"The method arranges for a :exc:`CancelledError` exception to be thrown into " +"the wrapped coroutine on the next cycle of the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1338 +#: ../../library/asyncio-task.rst:1345 msgid "" "The coroutine then has a chance to clean up or even deny the request by " "suppressing the exception with a :keyword:`try` ... ... ``except " -"CancelledError`` ... :keyword:`finally` block. Therefore, unlike :meth:" -"`Future.cancel`, :meth:`Task.cancel` does not guarantee that the Task will " -"be cancelled, although suppressing cancellation completely is not common and " -"is actively discouraged. Should the coroutine nevertheless decide to " -"suppress the cancellation, it needs to call :meth:`Task.uncancel` in " -"addition to catching the exception." +"CancelledError`` ... :keyword:`finally` block. Therefore, " +"unlike :meth:`Future.cancel`, :meth:`Task.cancel` does not guarantee that " +"the Task will be cancelled, although suppressing cancellation completely is " +"not common and is actively discouraged. Should the coroutine nevertheless " +"decide to suppress the cancellation, it needs to call :meth:`Task.uncancel` " +"in addition to catching the exception." msgstr "" -#: ../../library/asyncio-task.rst:1348 +#: ../../library/asyncio-task.rst:1355 msgid "Added the *msg* parameter." msgstr "新增 *msg* 參數。" -#: ../../library/asyncio-task.rst:1351 +#: ../../library/asyncio-task.rst:1358 msgid "The ``msg`` parameter is propagated from cancelled task to its awaiter." msgstr "" -#: ../../library/asyncio-task.rst:1356 +#: ../../library/asyncio-task.rst:1363 msgid "" "The following example illustrates how coroutines can intercept the " "cancellation request::" msgstr "" -#: ../../library/asyncio-task.rst:1359 +#: ../../library/asyncio-task.rst:1366 msgid "" "async def cancel_me():\n" " print('cancel_me(): before sleep')\n" @@ -1846,41 +1858,41 @@ msgid "" "# main(): cancel_me is cancelled now" msgstr "" -#: ../../library/asyncio-task.rst:1395 +#: ../../library/asyncio-task.rst:1402 msgid "Return ``True`` if the Task is *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:1397 +#: ../../library/asyncio-task.rst:1404 msgid "" -"The Task is *cancelled* when the cancellation was requested with :meth:" -"`cancel` and the wrapped coroutine propagated the :exc:`CancelledError` " -"exception thrown into it." +"The Task is *cancelled* when the cancellation was requested " +"with :meth:`cancel` and the wrapped coroutine propagated " +"the :exc:`CancelledError` exception thrown into it." msgstr "" -#: ../../library/asyncio-task.rst:1403 +#: ../../library/asyncio-task.rst:1410 msgid "Decrement the count of cancellation requests to this Task." msgstr "" -#: ../../library/asyncio-task.rst:1405 +#: ../../library/asyncio-task.rst:1412 msgid "Returns the remaining number of cancellation requests." msgstr "" -#: ../../library/asyncio-task.rst:1407 +#: ../../library/asyncio-task.rst:1414 msgid "" -"Note that once execution of a cancelled task completed, further calls to :" -"meth:`uncancel` are ineffective." +"Note that once execution of a cancelled task completed, further calls " +"to :meth:`uncancel` are ineffective." msgstr "" -#: ../../library/asyncio-task.rst:1412 +#: ../../library/asyncio-task.rst:1419 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. In particular, if a Task gets successfully uncancelled, this " -"allows for elements of structured concurrency like :ref:`taskgroups` and :" -"func:`asyncio.timeout` to continue running, isolating cancellation to the " -"respective structured block. For example::" +"allows for elements of structured concurrency like :ref:`taskgroups` " +"and :func:`asyncio.timeout` to continue running, isolating cancellation to " +"the respective structured block. For example::" msgstr "" -#: ../../library/asyncio-task.rst:1419 +#: ../../library/asyncio-task.rst:1426 msgid "" "async def make_request_with_timeout():\n" " try:\n" @@ -1894,42 +1906,42 @@ msgid "" " await unrelated_code()" msgstr "" -#: ../../library/asyncio-task.rst:1430 +#: ../../library/asyncio-task.rst:1437 msgid "" "While the block with ``make_request()`` and ``make_another_request()`` might " "get cancelled due to the timeout, ``unrelated_code()`` should continue " -"running even in case of the timeout. This is implemented with :meth:" -"`uncancel`. :class:`TaskGroup` context managers use :func:`uncancel` in a " -"similar fashion." +"running even in case of the timeout. This is implemented " +"with :meth:`uncancel`. :class:`TaskGroup` context managers " +"use :func:`uncancel` in a similar fashion." msgstr "" -#: ../../library/asyncio-task.rst:1436 +#: ../../library/asyncio-task.rst:1443 msgid "" -"If end-user code is, for some reason, suppressing cancellation by catching :" -"exc:`CancelledError`, it needs to call this method to remove the " +"If end-user code is, for some reason, suppressing cancellation by " +"catching :exc:`CancelledError`, it needs to call this method to remove the " "cancellation state." msgstr "" -#: ../../library/asyncio-task.rst:1440 +#: ../../library/asyncio-task.rst:1447 msgid "" "When this method decrements the cancellation count to zero, the method " -"checks if a previous :meth:`cancel` call had arranged for :exc:" -"`CancelledError` to be thrown into the task. If it hasn't been thrown yet, " -"that arrangement will be rescinded (by resetting the internal " +"checks if a previous :meth:`cancel` call had arranged " +"for :exc:`CancelledError` to be thrown into the task. If it hasn't been " +"thrown yet, that arrangement will be rescinded (by resetting the internal " "``_must_cancel`` flag)." msgstr "" -#: ../../library/asyncio-task.rst:1446 +#: ../../library/asyncio-task.rst:1453 msgid "Changed to rescind pending cancellation requests upon reaching zero." msgstr "" -#: ../../library/asyncio-task.rst:1451 +#: ../../library/asyncio-task.rst:1458 msgid "" "Return the number of pending cancellation requests to this Task, i.e., the " "number of calls to :meth:`cancel` less the number of :meth:`uncancel` calls." msgstr "" -#: ../../library/asyncio-task.rst:1455 +#: ../../library/asyncio-task.rst:1462 msgid "" "Note that if this number is greater than zero but the Task is still " "executing, :meth:`cancelled` will still return ``False``. This is because " @@ -1938,7 +1950,7 @@ msgid "" "to zero." msgstr "" -#: ../../library/asyncio-task.rst:1461 +#: ../../library/asyncio-task.rst:1468 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. See :meth:`uncancel` for more details." diff --git a/library/asyncio.po b/library/asyncio.po index 3d069c4f74..dab5421359 100644 --- a/library/asyncio.po +++ b/library/asyncio.po @@ -122,9 +122,9 @@ msgstr "" #: ../../library/asyncio.rst:48 msgid "" "create and manage :ref:`event loops `, which provide " -"asynchronous APIs for :ref:`networking `, running :ref:" -"`subprocesses `, handling :ref:`OS signals " -"`, etc;" +"asynchronous APIs for :ref:`networking `, " +"running :ref:`subprocesses `, handling :ref:`OS " +"signals `, etc;" msgstr "" "建立與管理 :ref:`event loops(事件迴圈) `,它提供了能被" "用於\\ :ref:`網路 `、執行\\ :ref:`子行程 " @@ -161,14 +161,14 @@ msgstr "" #: ../../library/asyncio.rst:64 msgid "asyncio REPL" -msgstr "" +msgstr "asyncio REPL" #: ../../library/asyncio.rst:65 -#, fuzzy msgid "" -"You can experiment with an ``asyncio`` concurrent context in the :term:" -"`REPL`:" -msgstr "你能在 REPL 中對一個 ``asyncio`` 的並行情境 (context) 進行實驗:" +"You can experiment with an ``asyncio`` concurrent context in " +"the :term:`REPL`:" +msgstr "" +"你能在 :term:`REPL` 中對一個 ``asyncio`` 的並行情境 (context) 進行實驗:" #: ../../library/asyncio.rst:67 msgid "" diff --git a/library/calendar.po b/library/calendar.po index 906c87d523..59c409fce5 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -647,7 +647,7 @@ msgid "" "Aliases for the months of the year, where ``JANUARY`` is ``1`` and " "``DECEMBER`` is ``12``." msgstr "" -"一年內每個月的別名,其中 ``JANUARY`` 是 ``ㄅ`` 而 ``DECEMBER`` 是 ``12``。" +"一年內每個月的別名,其中 ``JANUARY`` 是 ``1`` 而 ``DECEMBER`` 是 ``12``。" #: ../../library/calendar.rst:531 msgid "" diff --git a/library/cmath.po b/library/cmath.po index ba28b03e18..6d410bc6c9 100644 --- a/library/cmath.po +++ b/library/cmath.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-05 00:13+0000\n" +"POT-Creation-Date: 2025-04-07 00:15+0000\n" "PO-Revision-Date: 2024-03-14 09:26+0800\n" "Last-Translator: Enkai Huang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,9 +33,9 @@ msgid "" "result of the conversion." msgstr "" "本模組提供一些適用於複數的數學函式。本模組中的函式接受整數、浮點數或複數作為" -"引數。它們也接受任何具有 :meth:`~object.__complex__` 或 :meth:`~object." -"__float__` 方法的 Python 物件:這些方法分別用於將物件轉換為複數或浮點數,然後" -"再將函式應用於轉換後的結果。" +"引數。它們也接受任何具有 :meth:`~object.__complex__` " +"或 :meth:`~object.__float__` 方法的 Python 物件:這些方法分別用於將物件轉換為" +"複數或浮點數,然後再將函式應用於轉換後的結果。" #: ../../library/cmath.rst:18 msgid "" @@ -87,19 +87,283 @@ msgstr "" "1.4142135623730951j" #: ../../library/cmath.rst:42 +msgid "**Conversions to and from polar coordinates**" +msgstr "**轉換到極座標和從極座標做轉換**" + +#: ../../library/cmath.rst:44 +msgid ":func:`phase(z) `" +msgstr ":func:`phase(z) `" + +#: ../../library/cmath.rst:44 +msgid "Return the phase of *z*" +msgstr "回傳 *z* 的相位角。" + +#: ../../library/cmath.rst:45 +msgid ":func:`polar(z) `" +msgstr ":func:`polar(z) `" + +#: ../../library/cmath.rst:45 +msgid "Return the representation of *z* in polar coordinates" +msgstr "回傳 *z* 在極座標中的表達方式。" + +#: ../../library/cmath.rst:46 +msgid ":func:`rect(r, phi) `" +msgstr ":func:`rect(r, phi) `" + +#: ../../library/cmath.rst:46 +msgid "Return the complex number *z* with polar coordinates *r* and *phi*" +msgstr "透過極座標 *r* 和 *phi* 回傳複數 *z*。" + +#: ../../library/cmath.rst:48 +msgid "**Power and logarithmic functions**" +msgstr "**冪函數和對數函數**" + +#: ../../library/cmath.rst:50 +msgid ":func:`exp(z) `" +msgstr ":func:`exp(z) `" + +#: ../../library/cmath.rst:50 +msgid "Return *e* raised to the power *z*" +msgstr "回傳 *e* 的 *z* 次方。" + +#: ../../library/cmath.rst:51 +msgid ":func:`log(z[, base]) `" +msgstr ":func:`log(z[, base]) `" + +#: ../../library/cmath.rst:51 +msgid "Return the logarithm of *z* to the given *base* (*e* by default)" +msgstr "回傳 *z* 以給定 *base* 為底(預設為 *e*)的對數。" + +#: ../../library/cmath.rst:52 +msgid ":func:`log10(z) `" +msgstr ":func:`log10(z) `" + +#: ../../library/cmath.rst:52 +msgid "Return the base-10 logarithm of *z*" +msgstr "回傳 *z* 以 10 為底的對數。" + +#: ../../library/cmath.rst:53 +msgid ":func:`sqrt(z) `" +msgstr ":func:`sqrt(z) `" + +#: ../../library/cmath.rst:53 +msgid "Return the square root of *z*" +msgstr "回傳 *z* 的平方根。" + +#: ../../library/cmath.rst:55 +msgid "**Trigonometric functions**" +msgstr "**三角函數**" + +#: ../../library/cmath.rst:57 +msgid ":func:`acos(z) `" +msgstr ":func:`acos(z) `" + +#: ../../library/cmath.rst:57 +msgid "Return the arc cosine of *z*" +msgstr "回傳 *z* 的反餘弦值。" + +#: ../../library/cmath.rst:58 +msgid ":func:`asin(z) `" +msgstr ":func:`asin(z) `" + +#: ../../library/cmath.rst:58 +msgid "Return the arc sine of *z*" +msgstr "回傳 *z* 的反正弦值。" + +#: ../../library/cmath.rst:59 +msgid ":func:`atan(z) `" +msgstr ":func:`atan(z) `" + +#: ../../library/cmath.rst:59 +msgid "Return the arc tangent of *z*" +msgstr "回傳 *z* 的反正切值。" + +#: ../../library/cmath.rst:60 +msgid ":func:`cos(z) `" +msgstr ":func:`cos(z) `" + +#: ../../library/cmath.rst:60 +msgid "Return the cosine of *z*" +msgstr "回傳 *z* 的餘弦值。" + +#: ../../library/cmath.rst:61 +msgid ":func:`sin(z) `" +msgstr ":func:`sin(z) `" + +#: ../../library/cmath.rst:61 +msgid "Return the sine of *z*" +msgstr "回傳 *z* 的正弦值。" + +#: ../../library/cmath.rst:62 +msgid ":func:`tan(z) `" +msgstr ":func:`tan(z) `" + +#: ../../library/cmath.rst:62 +msgid "Return the tangent of *z*" +msgstr "回傳 *z* 的正切值。" + +#: ../../library/cmath.rst:64 +msgid "**Hyperbolic functions**" +msgstr "**雙曲函數**" + +#: ../../library/cmath.rst:66 +msgid ":func:`acosh(z) `" +msgstr ":func:`acosh(z) `" + +#: ../../library/cmath.rst:66 +msgid "Return the inverse hyperbolic cosine of *z*" +msgstr "回傳 *z* 的反雙曲餘弦值。" + +#: ../../library/cmath.rst:67 +msgid ":func:`asinh(z) `" +msgstr ":func:`asinh(z) `" + +#: ../../library/cmath.rst:67 +msgid "Return the inverse hyperbolic sine of *z*" +msgstr "回傳 *z* 的反雙曲正弦值。" + +#: ../../library/cmath.rst:68 +msgid ":func:`atanh(z) `" +msgstr ":func:`atanh(z) `" + +#: ../../library/cmath.rst:68 +msgid "Return the inverse hyperbolic tangent of *z*" +msgstr "回傳 *z* 的反雙曲正切值。" + +#: ../../library/cmath.rst:69 +msgid ":func:`cosh(z) `" +msgstr ":func:`cosh(z) `" + +#: ../../library/cmath.rst:69 +msgid "Return the hyperbolic cosine of *z*" +msgstr "回傳 *z* 的雙曲餘弦值。" + +#: ../../library/cmath.rst:70 +msgid ":func:`sinh(z) `" +msgstr ":func:`sinh(z) `" + +#: ../../library/cmath.rst:70 +msgid "Return the hyperbolic sine of *z*" +msgstr "回傳 *z* 的雙曲正弦值。" + +#: ../../library/cmath.rst:71 +msgid ":func:`tanh(z) `" +msgstr ":func:`tanh(z) `" + +#: ../../library/cmath.rst:71 +msgid "Return the hyperbolic tangent of *z*" +msgstr "回傳 *z* 的雙曲正切值。" + +#: ../../library/cmath.rst:73 +msgid "**Classification functions**" +msgstr "**分類函數**" + +#: ../../library/cmath.rst:75 +msgid ":func:`isfinite(z) `" +msgstr ":func:`isfinite(z) `" + +#: ../../library/cmath.rst:75 +msgid "Check if all components of *z* are finite" +msgstr "" + +#: ../../library/cmath.rst:76 +msgid ":func:`isinf(z) `" +msgstr ":func:`isinf(z) `" + +#: ../../library/cmath.rst:76 +msgid "Check if any component of *z* is infinite" +msgstr "" + +#: ../../library/cmath.rst:77 +msgid ":func:`isnan(z) `" +msgstr ":func:`isnan(z) `" + +#: ../../library/cmath.rst:77 +msgid "Check if any component of *z* is a NaN" +msgstr "" + +#: ../../library/cmath.rst:78 +msgid ":func:`isclose(a, b, *, rel_tol, abs_tol) `" +msgstr ":func:`isclose(a, b, *, rel_tol, abs_tol) `" + +#: ../../library/cmath.rst:78 +msgid "Check if the values *a* and *b* are close to each other" +msgstr "檢查 *a* 和 *b* 的值是否接近" + +#: ../../library/cmath.rst:80 +msgid "**Constants**" +msgstr "**常數**" + +#: ../../library/cmath.rst:82 +msgid ":data:`pi`" +msgstr ":data:`pi`" + +#: ../../library/cmath.rst:82 +msgid "*π* = 3.141592..." +msgstr "*π* = 3.141592..." + +#: ../../library/cmath.rst:83 +msgid ":data:`e`" +msgstr ":data:`e`" + +#: ../../library/cmath.rst:83 +msgid "*e* = 2.718281..." +msgstr "*e* = 2.718281..." + +#: ../../library/cmath.rst:84 +msgid ":data:`tau`" +msgstr ":data:`tau`" + +#: ../../library/cmath.rst:84 +msgid "*τ* = 2\\ *π* = 6.283185..." +msgstr "*τ* = 2\\ *π* = 6.283185..." + +#: ../../library/cmath.rst:85 +msgid ":data:`inf`" +msgstr ":data:`inf`" + +#: ../../library/cmath.rst:85 +msgid "Positive infinity" +msgstr "" + +#: ../../library/cmath.rst:86 +msgid ":data:`infj`" +msgstr ":data:`infj`" + +#: ../../library/cmath.rst:86 +msgid "Pure imaginary infinity" +msgstr "" + +#: ../../library/cmath.rst:87 +msgid ":data:`nan`" +msgstr ":data:`nan`" + +#: ../../library/cmath.rst:87 +msgid "\"Not a number\" (NaN)" +msgstr "" + +#: ../../library/cmath.rst:88 +msgid ":data:`nanj`" +msgstr ":data:`nanj`" + +#: ../../library/cmath.rst:88 +msgid "Pure imaginary NaN" +msgstr "" + +#: ../../library/cmath.rst:93 msgid "Conversions to and from polar coordinates" msgstr "轉換到極座標和從極座標做轉換" -#: ../../library/cmath.rst:44 +#: ../../library/cmath.rst:95 msgid "" "A Python complex number ``z`` is stored internally using *rectangular* or " -"*Cartesian* coordinates. It is completely determined by its *real part* ``z." -"real`` and its *imaginary part* ``z.imag``." +"*Cartesian* coordinates. It is completely determined by its *real part* " +"``z.real`` and its *imaginary part* ``z.imag``." msgstr "" "Python 複數 ``z`` 是用 *直角坐標* 或 *笛卡爾坐標* 儲存在內部的。它完全是由其 " "*實部* ``z.real`` 和 *虛部* ``z.imag`` 所決定。" -#: ../../library/cmath.rst:48 +#: ../../library/cmath.rst:99 msgid "" "*Polar coordinates* give an alternative way to represent a complex number. " "In polar coordinates, a complex number *z* is defined by the modulus *r* and " @@ -112,26 +376,26 @@ msgstr "" "*r* 和相位角 (phase) *phi* 定義。絕對值 *r* 是從 *z* 到原點的距離,而相位角 " "*phi* 是從正 x 軸到連接原點到 *z* 的線段的逆時針角度(以弧度為單位)。" -#: ../../library/cmath.rst:55 +#: ../../library/cmath.rst:106 msgid "" "The following functions can be used to convert from the native rectangular " "coordinates to polar coordinates and back." msgstr "以下的函式可用於原始直角座標與極座標之間的相互轉換。" -#: ../../library/cmath.rst:60 +#: ../../library/cmath.rst:111 msgid "" -"Return the phase of *x* (also known as the *argument* of *x*), as a float. " -"``phase(x)`` is equivalent to ``math.atan2(x.imag, x.real)``. The result " +"Return the phase of *z* (also known as the *argument* of *z*), as a float. " +"``phase(z)`` is equivalent to ``math.atan2(z.imag, z.real)``. The result " "lies in the range [-\\ *π*, *π*], and the branch cut for this operation lies " "along the negative real axis. The sign of the result is the same as the " -"sign of ``x.imag``, even when ``x.imag`` is zero::" +"sign of ``z.imag``, even when ``z.imag`` is zero::" msgstr "" -"以浮點數的形式回傳 *x* 的相位角(也稱為 *x* 的 *引數* )。 ``phase(x)`` 等價" -"於 ``math.atan2(x.imag, x.real)``。結果將位於 [-\\ *π*, *π*] 的範圍內,且此操" -"作的分枝切割將位於負實軸上。結果的符號會與 ``x.imag`` 的符號相同,即使 ``x." -"imag`` 為零: ::" +"以浮點數的形式回傳 *z* 的相位角(也稱為 *z* 的 *引數* )。``phase(z)`` 等價" +"於 ``math.atan2(z.imag, z.real)``。結果將位於 [-\\ *π*, *π*] 的範圍內,且此操" +"作的分枝切割將位於負實軸上。結果的符號會與 ``z.imag`` 的符號相同,即使 " +"``z.imag`` 為零: ::" -#: ../../library/cmath.rst:66 +#: ../../library/cmath.rst:117 msgid "" ">>> phase(complex(-1.0, 0.0))\n" "3.141592653589793\n" @@ -143,171 +407,171 @@ msgstr "" ">>> phase(complex(-1.0, -0.0))\n" "-3.141592653589793" -#: ../../library/cmath.rst:74 +#: ../../library/cmath.rst:125 msgid "" -"The modulus (absolute value) of a complex number *x* can be computed using " +"The modulus (absolute value) of a complex number *z* can be computed using " "the built-in :func:`abs` function. There is no separate :mod:`cmath` module " "function for this operation." msgstr "" -"複數 *x* 的絕對值可以使用內建的 :func:`abs` 函式計算。沒有單獨的 :mod:" -"`cmath` 模組函式適用於此操作。" +"複數 *z* 的絕對值可以使用內建的 :func:`abs` 函式計算。沒有單獨" +"的 :mod:`cmath` 模組函式適用於此操作。" -#: ../../library/cmath.rst:81 +#: ../../library/cmath.rst:132 msgid "" -"Return the representation of *x* in polar coordinates. Returns a pair ``(r, " -"phi)`` where *r* is the modulus of *x* and phi is the phase of *x*. " -"``polar(x)`` is equivalent to ``(abs(x), phase(x))``." +"Return the representation of *z* in polar coordinates. Returns a pair ``(r, " +"phi)`` where *r* is the modulus of *z* and *phi* is the phase of *z*. " +"``polar(z)`` is equivalent to ``(abs(z), phase(z))``." msgstr "" -"回傳 *x* 在極座標中的表達方式。回傳一組數對 ``(r, phi)``, *r* 是 *x* 的絕對" -"值, *phi* 是 *x* 的相位角。 ``polar(x)`` 相當於 ``(abs(x), phase(x))``。" +"回傳 *z* 在極座標中的表達方式。回傳一組數對 ``(r, phi)``, *r* 是 *z* 的絕對" +"值, *phi* 是 *z* 的相位角。 ``polar(z)`` 相當於 ``(abs(z), phase(z))``。" -#: ../../library/cmath.rst:89 +#: ../../library/cmath.rst:140 msgid "" -"Return the complex number *x* with polar coordinates *r* and *phi*. " +"Return the complex number *z* with polar coordinates *r* and *phi*. " "Equivalent to ``complex(r * math.cos(phi), r * math.sin(phi))``." msgstr "" -"透過極座標 *r* 和 *phi* 回傳複數 *x*。相當於 ``complex(r * math.cos(phi), r " +"透過極座標 *r* 和 *phi* 回傳複數 *z*。相當於 ``complex(r * math.cos(phi), r " "* math.sin(phi))``。" -#: ../../library/cmath.rst:94 +#: ../../library/cmath.rst:145 msgid "Power and logarithmic functions" msgstr "冪函數和對數函數" -#: ../../library/cmath.rst:98 +#: ../../library/cmath.rst:149 msgid "" -"Return *e* raised to the power *x*, where *e* is the base of natural " +"Return *e* raised to the power *z*, where *e* is the base of natural " "logarithms." -msgstr "回傳 *e* 的 *x* 次方,其中 *e* 是自然對數的底數。" +msgstr "回傳 *e* 的 *z* 次方,其中 *e* 是自然對數的底數。" -#: ../../library/cmath.rst:104 +#: ../../library/cmath.rst:155 msgid "" -"Returns the logarithm of *x* to the given *base*. If the *base* is not " -"specified, returns the natural logarithm of *x*. There is one branch cut, " +"Return the logarithm of *z* to the given *base*. If the *base* is not " +"specified, returns the natural logarithm of *z*. There is one branch cut, " "from 0 along the negative real axis to -∞." msgstr "" -"回傳 *x* 給定 *base* 的對數。如果未指定 *base*,則傳回 *x* 的自然對數。存在一" +"回傳 *z* 給定 *base* 的對數。如果未指定 *base*,則傳回 *z* 的自然對數。存在一" "條分枝切割,從 0 沿負實數軸到 -∞。" -#: ../../library/cmath.rst:111 +#: ../../library/cmath.rst:162 msgid "" -"Return the base-10 logarithm of *x*. This has the same branch cut as :func:" -"`log`." -msgstr "回傳 *x* 以 10 為底的對數。它與 :func:`log` 具有相同的分枝切割。" +"Return the base-10 logarithm of *z*. This has the same branch cut " +"as :func:`log`." +msgstr "回傳 *z* 以 10 為底的對數。它與 :func:`log` 具有相同的分枝切割。" -#: ../../library/cmath.rst:117 +#: ../../library/cmath.rst:168 msgid "" -"Return the square root of *x*. This has the same branch cut as :func:`log`." -msgstr "回傳 *x* 的平方根。它與 :func:`log` 具有相同的分枝切割。" +"Return the square root of *z*. This has the same branch cut as :func:`log`." +msgstr "回傳 *z* 的平方根。它與 :func:`log` 具有相同的分枝切割。" -#: ../../library/cmath.rst:121 +#: ../../library/cmath.rst:172 msgid "Trigonometric functions" msgstr "三角函數" -#: ../../library/cmath.rst:125 +#: ../../library/cmath.rst:176 msgid "" -"Return the arc cosine of *x*. There are two branch cuts: One extends right " +"Return the arc cosine of *z*. There are two branch cuts: One extends right " "from 1 along the real axis to ∞. The other extends left from -1 along the " "real axis to -∞." msgstr "" -"回傳 *x* 的反餘弦值。存在兩條分枝切割:一條是從 1 沿著實數軸向右延伸到 ∞。另" +"回傳 *z* 的反餘弦值。存在兩條分枝切割:一條是從 1 沿著實數軸向右延伸到 ∞。另" "一條從 -1 沿實數軸向左延伸到 -∞。" -#: ../../library/cmath.rst:132 +#: ../../library/cmath.rst:183 msgid "" -"Return the arc sine of *x*. This has the same branch cuts as :func:`acos`." -msgstr "回傳 *x* 的反正弦值。它與 :func:`acos` 具有相同的分枝切割。" +"Return the arc sine of *z*. This has the same branch cuts as :func:`acos`." +msgstr "回傳 *z* 的反正弦值。它與 :func:`acos` 具有相同的分枝切割。" -#: ../../library/cmath.rst:137 +#: ../../library/cmath.rst:188 msgid "" -"Return the arc tangent of *x*. There are two branch cuts: One extends from " +"Return the arc tangent of *z*. There are two branch cuts: One extends from " "``1j`` along the imaginary axis to ``∞j``. The other extends from ``-1j`` " "along the imaginary axis to ``-∞j``." msgstr "" -"回傳 *x* 的反正切值。有兩條分枝切割:一條是從 ``1j`` 沿著虛軸延伸到 ``∞j``。" +"回傳 *z* 的反正切值。有兩條分枝切割:一條是從 ``1j`` 沿著虛軸延伸到 ``∞j``。" "另一條從 ``-1j`` 沿著虛軸延伸到 ``-∞j``。" -#: ../../library/cmath.rst:144 -msgid "Return the cosine of *x*." -msgstr "回傳 *x* 的餘弦值。" +#: ../../library/cmath.rst:195 +msgid "Return the cosine of *z*." +msgstr "回傳 *z* 的餘弦值。" -#: ../../library/cmath.rst:149 -msgid "Return the sine of *x*." -msgstr "回傳 *x* 的正弦值。" +#: ../../library/cmath.rst:200 +msgid "Return the sine of *z*." +msgstr "回傳 *z* 的正弦值。" -#: ../../library/cmath.rst:154 -msgid "Return the tangent of *x*." -msgstr "回傳 *x* 的正切值。" +#: ../../library/cmath.rst:205 +msgid "Return the tangent of *z*." +msgstr "回傳 *z* 的正切值。" -#: ../../library/cmath.rst:158 +#: ../../library/cmath.rst:209 msgid "Hyperbolic functions" msgstr "雙曲函數" -#: ../../library/cmath.rst:162 +#: ../../library/cmath.rst:213 msgid "" -"Return the inverse hyperbolic cosine of *x*. There is one branch cut, " +"Return the inverse hyperbolic cosine of *z*. There is one branch cut, " "extending left from 1 along the real axis to -∞." msgstr "" -"回傳 *x* 的反雙曲餘弦值。存在一條分枝切割,從 1 沿實數軸向左延伸到 -∞。" +"回傳 *z* 的反雙曲餘弦值。存在一條分枝切割,從 1 沿實數軸向左延伸到 -∞。" -#: ../../library/cmath.rst:168 +#: ../../library/cmath.rst:219 msgid "" -"Return the inverse hyperbolic sine of *x*. There are two branch cuts: One " +"Return the inverse hyperbolic sine of *z*. There are two branch cuts: One " "extends from ``1j`` along the imaginary axis to ``∞j``. The other extends " "from ``-1j`` along the imaginary axis to ``-∞j``." msgstr "" -"回傳 *x* 的反雙曲正弦值。存在兩條分枝切割:一條是從 ``1j`` 沿著虛軸延伸到 " +"回傳 *z* 的反雙曲正弦值。存在兩條分枝切割:一條是從 ``1j`` 沿著虛軸延伸到 " "``∞j``。另一條從 ``-1j`` 沿著虛軸延伸到 ``-∞j``。" -#: ../../library/cmath.rst:175 +#: ../../library/cmath.rst:226 msgid "" -"Return the inverse hyperbolic tangent of *x*. There are two branch cuts: One " +"Return the inverse hyperbolic tangent of *z*. There are two branch cuts: One " "extends from ``1`` along the real axis to ``∞``. The other extends from " "``-1`` along the real axis to ``-∞``." msgstr "" -"回傳 *x* 的反雙曲正切值。存在兩條分枝切割:一條是從 ``1`` 沿著實數軸延伸到 " +"回傳 *z* 的反雙曲正切值。存在兩條分枝切割:一條是從 ``1`` 沿著實數軸延伸到 " "``∞``。另一條從 ``-1`` 沿著實數軸延伸到 ``-∞``。" -#: ../../library/cmath.rst:182 -msgid "Return the hyperbolic cosine of *x*." -msgstr "回傳 *x* 的反雙曲餘弦值。" +#: ../../library/cmath.rst:233 +msgid "Return the hyperbolic cosine of *z*." +msgstr "回傳 *z* 的反雙曲餘弦值。" -#: ../../library/cmath.rst:187 -msgid "Return the hyperbolic sine of *x*." -msgstr "回傳 *x* 的反雙曲正弦值。" +#: ../../library/cmath.rst:238 +msgid "Return the hyperbolic sine of *z*." +msgstr "回傳 *z* 的反雙曲正弦值。" -#: ../../library/cmath.rst:192 -msgid "Return the hyperbolic tangent of *x*." -msgstr "回傳 *x* 的反雙曲正切值。" +#: ../../library/cmath.rst:243 +msgid "Return the hyperbolic tangent of *z*." +msgstr "回傳 *z* 的反雙曲正切值。" -#: ../../library/cmath.rst:196 +#: ../../library/cmath.rst:247 msgid "Classification functions" msgstr "分類函式" -#: ../../library/cmath.rst:200 +#: ../../library/cmath.rst:251 msgid "" -"Return ``True`` if both the real and imaginary parts of *x* are finite, and " +"Return ``True`` if both the real and imaginary parts of *z* are finite, and " "``False`` otherwise." -msgstr "如果 *x* 的實部和虛部都是有限的,則回傳 ``True``,否則回傳 ``False``。" +msgstr "如果 *z* 的實部和虛部都是有限的,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/cmath.rst:208 +#: ../../library/cmath.rst:259 msgid "" -"Return ``True`` if either the real or the imaginary part of *x* is an " +"Return ``True`` if either the real or the imaginary part of *z* is an " "infinity, and ``False`` otherwise." -msgstr "如果 *x* 的實部或虛部是無窮大,則回傳 ``True``,否則回傳 ``False``。" +msgstr "如果 *z* 的實部或虛部是無窮大,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/cmath.rst:214 +#: ../../library/cmath.rst:265 msgid "" -"Return ``True`` if either the real or the imaginary part of *x* is a NaN, " +"Return ``True`` if either the real or the imaginary part of *z* is a NaN, " "and ``False`` otherwise." -msgstr "如果 *x* 的實部或虛部為 NaN,則回傳 ``True``,否則回傳 ``False``。" +msgstr "如果 *z* 的實部或虛部為 NaN,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/cmath.rst:220 +#: ../../library/cmath.rst:271 msgid "" "Return ``True`` if the values *a* and *b* are close to each other and " "``False`` otherwise." msgstr "如果 *a* 和 *b* 的值相互接近,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/cmath.rst:223 +#: ../../library/cmath.rst:274 msgid "" "Whether or not two values are considered close is determined according to " "given absolute and relative tolerances. If no errors occur, the result will " @@ -316,7 +580,7 @@ msgstr "" "兩數是否足夠接近取決於給定的絕對及相對容許偏差 (tolerance)。如果沒有錯誤發" "生,結果將為:``abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)``。" -#: ../../library/cmath.rst:227 +#: ../../library/cmath.rst:278 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " @@ -330,7 +594,7 @@ msgstr "" "設值為 ``1e-09``,該值可確保兩數於大約 9 個十進數位內相同。*rel_tol* 須不為負" "且小於 ``1.0``。" -#: ../../library/cmath.rst:234 +#: ../../library/cmath.rst:285 msgid "" "*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " "nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " @@ -339,7 +603,7 @@ msgid "" "to the call." msgstr "" -#: ../../library/cmath.rst:240 +#: ../../library/cmath.rst:291 msgid "" "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " "handled according to IEEE rules. Specifically, ``NaN`` is not considered " @@ -350,65 +614,66 @@ msgstr "" "處理。更明確地說,``NaN`` 不會與包含自身在內的任何數字足夠接近,而 ``inf`` " "及 ``-inf`` 皆只與自身接近。" -#: ../../library/cmath.rst:249 +#: ../../library/cmath.rst:300 msgid ":pep:`485` -- A function for testing approximate equality" msgstr ":pep:`485` ── 用於測試近似相等的函式" -#: ../../library/cmath.rst:253 +#: ../../library/cmath.rst:304 msgid "Constants" msgstr "常數" -#: ../../library/cmath.rst:257 +#: ../../library/cmath.rst:308 msgid "The mathematical constant *π*, as a float." msgstr "數學常數 *π*,作為一個浮點數。" -#: ../../library/cmath.rst:262 +#: ../../library/cmath.rst:313 msgid "The mathematical constant *e*, as a float." msgstr "數學常數 *e*,作為一個浮點數。" -#: ../../library/cmath.rst:267 +#: ../../library/cmath.rst:318 msgid "The mathematical constant *τ*, as a float." msgstr "數學常數 *τ*,作為一個浮點數。" -#: ../../library/cmath.rst:274 +#: ../../library/cmath.rst:325 msgid "Floating-point positive infinity. Equivalent to ``float('inf')``." msgstr "正無窮大的浮點數。相當於 ``float('inf')``。" -#: ../../library/cmath.rst:281 +#: ../../library/cmath.rst:332 msgid "" "Complex number with zero real part and positive infinity imaginary part. " "Equivalent to ``complex(0.0, float('inf'))``." msgstr "實部為零和虛部為正無窮的複數。相當於 ``complex(0.0, float('inf'))``。" -#: ../../library/cmath.rst:289 +#: ../../library/cmath.rst:340 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to " "``float('nan')``." msgstr "浮點「非數字」 (NaN) 值。相當於 ``float('nan')``。" -#: ../../library/cmath.rst:297 +#: ../../library/cmath.rst:348 msgid "" "Complex number with zero real part and NaN imaginary part. Equivalent to " "``complex(0.0, float('nan'))``." msgstr "實部為零和虛部為 NaN 的複數。相當於 ``complex(0.0, float('nan'))``。" -#: ../../library/cmath.rst:305 +#: ../../library/cmath.rst:356 msgid "" "Note that the selection of functions is similar, but not identical, to that " "in module :mod:`math`. The reason for having two modules is that some users " "aren't interested in complex numbers, and perhaps don't even know what they " "are. They would rather have ``math.sqrt(-1)`` raise an exception than " -"return a complex number. Also note that the functions defined in :mod:" -"`cmath` always return a complex number, even if the answer can be expressed " -"as a real number (in which case the complex number has an imaginary part of " -"zero)." +"return a complex number. Also note that the functions defined " +"in :mod:`cmath` always return a complex number, even if the answer can be " +"expressed as a real number (in which case the complex number has an " +"imaginary part of zero)." msgstr "" "請注意,函式的選擇與模組 :mod:`math` 的類似,但並不完全相同。擁有兩個模組的原" -"因是有些用戶對複數不感興趣,甚至根本就不知道它們是什麼。他們寧願讓 ``math." -"sqrt(-1)`` 引發異常,也不願它回傳複數。另請注意, :mod:`cmath` 中所定義的函式" -"始終都會回傳複數,即使答案可以表示為實數(在這種情況下,複數的虛部為零)。" +"因是有些用戶對複數不感興趣,甚至根本就不知道它們是什麼。他們寧願讓 " +"``math.sqrt(-1)`` 引發異常,也不願它回傳複數。另請注意, :mod:`cmath` 中所定" +"義的函式始終都會回傳複數,即使答案可以表示為實數(在這種情況下,複數的虛部為" +"零)。" -#: ../../library/cmath.rst:313 +#: ../../library/cmath.rst:364 msgid "" "A note on branch cuts: They are curves along which the given function fails " "to be continuous. They are a necessary feature of many complex functions. " @@ -423,17 +688,17 @@ msgstr "" "所有關於複變函數的(不是太初級的)書籍以獲得啟發。對於如何正確地基於數值目的" "選擇分枝切割的相關訊息,以下內容應該是一個很好的參考:" -#: ../../library/cmath.rst:323 +#: ../../library/cmath.rst:374 msgid "" "Kahan, W: Branch cuts for complex elementary functions; or, Much ado about " "nothing's sign bit. In Iserles, A., and Powell, M. (eds.), The state of the " "art in numerical analysis. Clarendon Press (1987) pp165--211." msgstr "" -#: ../../library/cmath.rst:303 +#: ../../library/cmath.rst:354 msgid "module" msgstr "module(模組)" -#: ../../library/cmath.rst:303 +#: ../../library/cmath.rst:354 msgid "math" msgstr "math(數學)" diff --git a/library/cmdline.po b/library/cmdline.po index 51d4a6fe87..aea947803e 100644 --- a/library/cmdline.po +++ b/library/cmdline.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 23:08+0000\n" +"POT-Creation-Date: 2025-05-04 00:16+0000\n" "PO-Revision-Date: 2023-10-14 16:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -62,8 +62,8 @@ msgid ":ref:`dis `" msgstr ":ref:`dis `" #: ../../library/cmdline.rst:16 -msgid ":mod:`doctest`" -msgstr ":mod:`doctest`" +msgid ":ref:`doctest `" +msgstr ":ref:`doctest `" #: ../../library/cmdline.rst:17 msgid ":mod:`!encodings.rot_13`" @@ -122,8 +122,8 @@ msgid ":ref:`pickletools `" msgstr ":ref:`pickletools `" #: ../../library/cmdline.rst:31 -msgid ":mod:`platform`" -msgstr ":mod:`platform`" +msgid ":ref:`platform `" +msgstr ":ref:`platform `" #: ../../library/cmdline.rst:32 msgid ":mod:`poplib`" diff --git a/library/code.po b/library/code.po index b424c1a11c..3d680b5ea3 100644 --- a/library/code.po +++ b/library/code.po @@ -48,14 +48,13 @@ msgid "" "Closely emulate the behavior of the interactive Python interpreter. This " "class builds on :class:`InteractiveInterpreter` and adds prompting using the " "familiar ``sys.ps1`` and ``sys.ps2``, and input buffering. If *local_exit* " -"is true, ``exit()`` and ``quit()`` in the console will not raise :exc:" -"`SystemExit`, but instead return to the calling code." +"is true, ``exit()`` and ``quit()`` in the console will not " +"raise :exc:`SystemExit`, but instead return to the calling code." msgstr "" #: ../../library/code.rst:34 ../../library/code.rst:52 -#, fuzzy msgid "Added *local_exit* parameter." -msgstr "新增 *exitmsg* 參數。" +msgstr "新增 *local_exit* 參數。" #: ../../library/code.rst:39 msgid "" @@ -64,9 +63,9 @@ msgid "" "the :meth:`InteractiveConsole.raw_input` method, if provided. If *local* is " "provided, it is passed to the :class:`InteractiveConsole` constructor for " "use as the default namespace for the interpreter loop. If *local_exit* is " -"provided, it is passed to the :class:`InteractiveConsole` constructor. The :" -"meth:`~InteractiveConsole.interact` method of the instance is then run with " -"*banner* and *exitmsg* passed as the banner and exit message to use, if " +"provided, it is passed to the :class:`InteractiveConsole` constructor. " +"The :meth:`~InteractiveConsole.interact` method of the instance is then run " +"with *banner* and *exitmsg* passed as the banner and exit message to use, if " "provided. The console object is discarded after use." msgstr "" @@ -114,10 +113,10 @@ msgstr "" #: ../../library/code.rst:88 msgid "" -"The input is incorrect; :func:`compile_command` raised an exception (:exc:" -"`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be printed " -"by calling the :meth:`showsyntaxerror` method. :meth:`runsource` returns " -"``False``." +"The input is incorrect; :func:`compile_command` raised an exception " +"(:exc:`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be " +"printed by calling the :meth:`showsyntaxerror` method. :meth:`runsource` " +"returns ``False``." msgstr "" #: ../../library/code.rst:93 @@ -136,15 +135,15 @@ msgstr "" #: ../../library/code.rst:100 msgid "" -"The return value can be used to decide whether to use ``sys.ps1`` or ``sys." -"ps2`` to prompt the next line." +"The return value can be used to decide whether to use ``sys.ps1`` or " +"``sys.ps2`` to prompt the next line." msgstr "" #: ../../library/code.rst:106 msgid "" "Execute a code object. When an exception occurs, :meth:`showtraceback` is " -"called to display a traceback. All exceptions are caught except :exc:" -"`SystemExit`, which is allowed to propagate." +"called to display a traceback. All exceptions are caught " +"except :exc:`SystemExit`, which is allowed to propagate." msgstr "" #: ../../library/code.rst:110 @@ -189,9 +188,9 @@ msgstr "" #: ../../library/code.rst:145 msgid "" -"The :class:`InteractiveConsole` class is a subclass of :class:" -"`InteractiveInterpreter`, and so offers all the methods of the interpreter " -"objects as well as the following additions." +"The :class:`InteractiveConsole` class is a subclass " +"of :class:`InteractiveInterpreter`, and so offers all the methods of the " +"interpreter objects as well as the following additions." msgstr "" #: ../../library/code.rst:152 @@ -239,7 +238,7 @@ msgstr "" #: ../../library/code.rst:188 msgid "" "Write a prompt and read a line. The returned line does not include the " -"trailing newline. When the user enters the EOF key sequence, :exc:" -"`EOFError` is raised. The base implementation reads from ``sys.stdin``; a " -"subclass may replace this with a different implementation." +"trailing newline. When the user enters the EOF key " +"sequence, :exc:`EOFError` is raised. The base implementation reads from " +"``sys.stdin``; a subclass may replace this with a different implementation." msgstr "" diff --git a/library/codecs.po b/library/codecs.po index 90de1fd8dd..d12006bce7 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-04-13 00:40+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1537,7 +1537,7 @@ msgstr "855, IBM855" #: ../../library/codecs.rst:1106 ../../library/codecs.rst:1154 #: ../../library/codecs.rst:1219 ../../library/codecs.rst:1256 -msgid "Bulgarian, Byelorussian, Macedonian, Russian, Serbian" +msgid "Belarusian, Bulgarian, Macedonian, Russian, Serbian" msgstr "" #: ../../library/codecs.rst:1109 diff --git a/library/collections.abc.po b/library/collections.abc.po index 1edc583b3e..e680b63eff 100644 --- a/library/collections.abc.po +++ b/library/collections.abc.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-07 00:14+0000\n" +"POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,8 +33,8 @@ msgstr "**原始碼:**\\ :source:`Lib/_collections_abc.py`" msgid "" "This module provides :term:`abstract base classes ` " "that can be used to test whether a class provides a particular interface; " -"for example, whether it is :term:`hashable` or whether it is " -"a :term:`mapping`." +"for example, whether it is :term:`hashable` or whether it is a :term:" +"`mapping`." msgstr "" #: ../../library/collections.abc.rst:27 @@ -45,7 +45,7 @@ msgstr "" #: ../../library/collections.abc.rst:30 msgid "" -"1) A newly written class can inherit directly from one of the abstract base " +"A newly written class can inherit directly from one of the abstract base " "classes. The class must supply the required abstract methods. The " "remaining mixin methods come from inheritance and can be overridden if " "desired. Other methods may be added as needed:" @@ -71,7 +71,7 @@ msgstr "" #: ../../library/collections.abc.rst:50 msgid "" -"2) Existing classes and built-in classes can be registered as \"virtual " +"Existing classes and built-in classes can be registered as \"virtual " "subclasses\" of the ABCs. Those classes should define the full API " "including all of the abstract methods and all of the mixin methods. This " "lets users rely on :func:`issubclass` or :func:`isinstance` tests to " @@ -104,18 +104,18 @@ msgstr "" msgid "" "In this example, class :class:`!D` does not need to define ``__contains__``, " "``__iter__``, and ``__reversed__`` because the :ref:`in-operator " -"`, the :term:`iteration ` logic, and " -"the :func:`reversed` function automatically fall back to using " -"``__getitem__`` and ``__len__``." +"`, the :term:`iteration ` logic, and the :func:" +"`reversed` function automatically fall back to using ``__getitem__`` and " +"``__len__``." msgstr "" #: ../../library/collections.abc.rst:82 msgid "" -"3) Some simple interfaces are directly recognizable by the presence of the " +"Some simple interfaces are directly recognizable by the presence of the " "required methods (unless those methods have been set to :const:`None`):" msgstr "" -#: ../../library/collections.abc.rst:86 +#: ../../library/collections.abc.rst:85 msgid "" "class E:\n" " def __iter__(self): ...\n" @@ -125,7 +125,7 @@ msgstr "" " def __iter__(self): ...\n" " def __next__(self): ..." -#: ../../library/collections.abc.rst:92 +#: ../../library/collections.abc.rst:91 msgid "" ">>> issubclass(E, Iterable)\n" "True\n" @@ -137,7 +137,7 @@ msgstr "" ">>> isinstance(E(), Iterable)\n" "True" -#: ../../library/collections.abc.rst:99 +#: ../../library/collections.abc.rst:98 msgid "" "Complex interfaces do not support this last technique because an interface " "is more than just the presence of method names. Interfaces specify " @@ -147,178 +147,178 @@ msgid "" "insufficient for distinguishing a :class:`Sequence` from a :class:`Mapping`." msgstr "" -#: ../../library/collections.abc.rst:107 +#: ../../library/collections.abc.rst:106 msgid "" "These abstract classes now support ``[]``. See :ref:`types-genericalias` " "and :pep:`585`." msgstr "" -#: ../../library/collections.abc.rst:114 +#: ../../library/collections.abc.rst:113 msgid "Collections Abstract Base Classes" msgstr "" -#: ../../library/collections.abc.rst:116 +#: ../../library/collections.abc.rst:115 msgid "" "The collections module offers the following :term:`ABCs `:" msgstr "" -#: ../../library/collections.abc.rst:121 +#: ../../library/collections.abc.rst:120 msgid "ABC" msgstr "ABC" -#: ../../library/collections.abc.rst:121 +#: ../../library/collections.abc.rst:120 msgid "Inherits from" msgstr "" -#: ../../library/collections.abc.rst:121 +#: ../../library/collections.abc.rst:120 msgid "Abstract Methods" msgstr "" -#: ../../library/collections.abc.rst:121 +#: ../../library/collections.abc.rst:120 msgid "Mixin Methods" msgstr "" -#: ../../library/collections.abc.rst:123 +#: ../../library/collections.abc.rst:122 msgid ":class:`Container` [1]_" msgstr ":class:`Container` [1]_" -#: ../../library/collections.abc.rst:123 +#: ../../library/collections.abc.rst:122 msgid "``__contains__``" msgstr "``__contains__``" -#: ../../library/collections.abc.rst:124 +#: ../../library/collections.abc.rst:123 msgid ":class:`Hashable` [1]_" msgstr ":class:`Hashable` [1]_" -#: ../../library/collections.abc.rst:124 +#: ../../library/collections.abc.rst:123 msgid "``__hash__``" msgstr "``__hash__``" -#: ../../library/collections.abc.rst:125 +#: ../../library/collections.abc.rst:124 msgid ":class:`Iterable` [1]_ [2]_" msgstr ":class:`Iterable` [1]_ [2]_" -#: ../../library/collections.abc.rst:125 ../../library/collections.abc.rst:126 +#: ../../library/collections.abc.rst:124 ../../library/collections.abc.rst:125 msgid "``__iter__``" msgstr "``__iter__``" -#: ../../library/collections.abc.rst:126 +#: ../../library/collections.abc.rst:125 msgid ":class:`Iterator` [1]_" msgstr ":class:`Iterator` [1]_" -#: ../../library/collections.abc.rst:126 ../../library/collections.abc.rst:127 +#: ../../library/collections.abc.rst:125 ../../library/collections.abc.rst:126 msgid ":class:`Iterable`" msgstr ":class:`Iterable`" -#: ../../library/collections.abc.rst:126 +#: ../../library/collections.abc.rst:125 msgid "``__next__``" msgstr "``__next__``" -#: ../../library/collections.abc.rst:127 +#: ../../library/collections.abc.rst:126 msgid ":class:`Reversible` [1]_" msgstr ":class:`Reversible` [1]_" -#: ../../library/collections.abc.rst:127 +#: ../../library/collections.abc.rst:126 msgid "``__reversed__``" msgstr "``__reversed__``" -#: ../../library/collections.abc.rst:128 +#: ../../library/collections.abc.rst:127 msgid ":class:`Generator` [1]_" msgstr ":class:`Generator` [1]_" -#: ../../library/collections.abc.rst:128 +#: ../../library/collections.abc.rst:127 msgid ":class:`Iterator`" msgstr ":class:`Iterator`" -#: ../../library/collections.abc.rst:128 ../../library/collections.abc.rst:177 +#: ../../library/collections.abc.rst:127 ../../library/collections.abc.rst:176 msgid "``send``, ``throw``" msgstr "``send``、``throw``" -#: ../../library/collections.abc.rst:128 +#: ../../library/collections.abc.rst:127 msgid "``close``, ``__iter__``, ``__next__``" msgstr "``close``、``__iter__``、``__next__``" -#: ../../library/collections.abc.rst:129 +#: ../../library/collections.abc.rst:128 msgid ":class:`Sized` [1]_" msgstr ":class:`Sized` [1]_" -#: ../../library/collections.abc.rst:129 +#: ../../library/collections.abc.rst:128 msgid "``__len__``" msgstr "``__len__``" -#: ../../library/collections.abc.rst:130 +#: ../../library/collections.abc.rst:129 msgid ":class:`Callable` [1]_" msgstr ":class:`Callable` [1]_" -#: ../../library/collections.abc.rst:130 +#: ../../library/collections.abc.rst:129 msgid "``__call__``" msgstr "``__call__``" -#: ../../library/collections.abc.rst:131 +#: ../../library/collections.abc.rst:130 msgid ":class:`Collection` [1]_" msgstr ":class:`Collection` [1]_" -#: ../../library/collections.abc.rst:131 +#: ../../library/collections.abc.rst:130 msgid ":class:`Sized`, :class:`Iterable`, :class:`Container`" msgstr ":class:`Sized`、:class:`Iterable`、:class:`Container`" -#: ../../library/collections.abc.rst:131 ../../library/collections.abc.rst:147 +#: ../../library/collections.abc.rst:130 ../../library/collections.abc.rst:146 msgid "``__contains__``, ``__iter__``, ``__len__``" msgstr "``__contains__``、``__iter__``、``__len__``" -#: ../../library/collections.abc.rst:135 ../../library/collections.abc.rst:138 -#: ../../library/collections.abc.rst:144 +#: ../../library/collections.abc.rst:134 ../../library/collections.abc.rst:137 +#: ../../library/collections.abc.rst:143 msgid ":class:`Sequence`" msgstr ":class:`Sequence`" -#: ../../library/collections.abc.rst:135 +#: ../../library/collections.abc.rst:134 msgid ":class:`Reversible`, :class:`Collection`" msgstr ":class:`Reversible`, :class:`Collection`" -#: ../../library/collections.abc.rst:135 ../../library/collections.abc.rst:144 +#: ../../library/collections.abc.rst:134 ../../library/collections.abc.rst:143 msgid "``__getitem__``, ``__len__``" msgstr "``__getitem__``、``__len__``" -#: ../../library/collections.abc.rst:135 +#: ../../library/collections.abc.rst:134 msgid "" "``__contains__``, ``__iter__``, ``__reversed__``, ``index``, and ``count``" msgstr "" "``__contains__``、``__iter__``、``__reversed__``、``index`` 和 ``count``" -#: ../../library/collections.abc.rst:138 +#: ../../library/collections.abc.rst:137 msgid ":class:`MutableSequence`" msgstr ":class:`MutableSequence`" -#: ../../library/collections.abc.rst:138 +#: ../../library/collections.abc.rst:137 msgid "" "``__getitem__``, ``__setitem__``, ``__delitem__``, ``__len__``, ``insert``" msgstr "" "``__getitem__``、``__setitem__``、``__delitem__``、``__len__``、``insert``" -#: ../../library/collections.abc.rst:138 +#: ../../library/collections.abc.rst:137 msgid "" "Inherited :class:`Sequence` methods and ``append``, ``clear``, ``reverse``, " "``extend``, ``pop``, ``remove``, and ``__iadd__``" msgstr "" -#: ../../library/collections.abc.rst:144 +#: ../../library/collections.abc.rst:143 msgid ":class:`ByteString`" msgstr ":class:`ByteString`" -#: ../../library/collections.abc.rst:144 +#: ../../library/collections.abc.rst:143 msgid "Inherited :class:`Sequence` methods" msgstr "" -#: ../../library/collections.abc.rst:147 ../../library/collections.abc.rst:152 +#: ../../library/collections.abc.rst:146 ../../library/collections.abc.rst:151 msgid ":class:`Set`" msgstr ":class:`Set`" -#: ../../library/collections.abc.rst:147 ../../library/collections.abc.rst:158 +#: ../../library/collections.abc.rst:146 ../../library/collections.abc.rst:157 msgid ":class:`Collection`" msgstr ":class:`Collection`" -#: ../../library/collections.abc.rst:147 +#: ../../library/collections.abc.rst:146 msgid "" "``__le__``, ``__lt__``, ``__eq__``, ``__ne__``, ``__gt__``, ``__ge__``, " "``__and__``, ``__or__``, ``__sub__``, ``__rsub__``, ``__xor__``, " @@ -328,29 +328,29 @@ msgstr "" "``__and__``、``__or__``、``__sub__``、``__rsub__``、``__xor__``、" "``__rxor__`` 和 ``isdisjoint``" -#: ../../library/collections.abc.rst:152 +#: ../../library/collections.abc.rst:151 msgid ":class:`MutableSet`" msgstr ":class:`MutableSet`" -#: ../../library/collections.abc.rst:152 +#: ../../library/collections.abc.rst:151 msgid "``__contains__``, ``__iter__``, ``__len__``, ``add``, ``discard``" msgstr "``__contains__``、``__iter__``、``__len__``、``add``、``discard``" -#: ../../library/collections.abc.rst:152 +#: ../../library/collections.abc.rst:151 msgid "" "Inherited :class:`Set` methods and ``clear``, ``pop``, ``remove``, " "``__ior__``, ``__iand__``, ``__ixor__``, and ``__isub__``" msgstr "" -#: ../../library/collections.abc.rst:158 ../../library/collections.abc.rst:162 +#: ../../library/collections.abc.rst:157 ../../library/collections.abc.rst:161 msgid ":class:`Mapping`" msgstr ":class:`Mapping`" -#: ../../library/collections.abc.rst:158 +#: ../../library/collections.abc.rst:157 msgid "``__getitem__``, ``__iter__``, ``__len__``" msgstr "``__getitem__``、``__iter__``、``__len__``" -#: ../../library/collections.abc.rst:158 +#: ../../library/collections.abc.rst:157 msgid "" "``__contains__``, ``keys``, ``items``, ``values``, ``get``, ``__eq__``, and " "``__ne__``" @@ -358,128 +358,128 @@ msgstr "" "``__contains__``、``keys``、``items``、``values``、``get``、``__eq__`` 和 " "``__ne__``" -#: ../../library/collections.abc.rst:162 +#: ../../library/collections.abc.rst:161 msgid ":class:`MutableMapping`" msgstr ":class:`MutableMapping`" -#: ../../library/collections.abc.rst:162 +#: ../../library/collections.abc.rst:161 msgid "" "``__getitem__``, ``__setitem__``, ``__delitem__``, ``__iter__``, ``__len__``" msgstr "" "``__getitem__``、``__setitem__``、``__delitem__``、``__iter__``、``__len__``" -#: ../../library/collections.abc.rst:162 +#: ../../library/collections.abc.rst:161 msgid "" "Inherited :class:`Mapping` methods and ``pop``, ``popitem``, ``clear``, " "``update``, and ``setdefault``" msgstr "" -#: ../../library/collections.abc.rst:169 +#: ../../library/collections.abc.rst:168 msgid ":class:`MappingView`" msgstr ":class:`MappingView`" -#: ../../library/collections.abc.rst:169 +#: ../../library/collections.abc.rst:168 msgid ":class:`Sized`" msgstr ":class:`Sized`" -#: ../../library/collections.abc.rst:169 +#: ../../library/collections.abc.rst:168 msgid "``__init__``, ``__len__`` and ``__repr__``" msgstr "``__init__``、``__len__`` 和 ``__repr__``" -#: ../../library/collections.abc.rst:170 +#: ../../library/collections.abc.rst:169 msgid ":class:`ItemsView`" msgstr ":class:`ItemsView`" -#: ../../library/collections.abc.rst:170 ../../library/collections.abc.rst:172 +#: ../../library/collections.abc.rst:169 ../../library/collections.abc.rst:171 msgid ":class:`MappingView`, :class:`Set`" msgstr ":class:`MappingView`、:class:`Set`" -#: ../../library/collections.abc.rst:170 ../../library/collections.abc.rst:172 -#: ../../library/collections.abc.rst:174 +#: ../../library/collections.abc.rst:169 ../../library/collections.abc.rst:171 +#: ../../library/collections.abc.rst:173 msgid "``__contains__``, ``__iter__``" msgstr "``__contains__``、``__iter__``" -#: ../../library/collections.abc.rst:172 +#: ../../library/collections.abc.rst:171 msgid ":class:`KeysView`" msgstr ":class:`KeysView`" -#: ../../library/collections.abc.rst:174 +#: ../../library/collections.abc.rst:173 msgid ":class:`ValuesView`" msgstr ":class:`ValuesView`" -#: ../../library/collections.abc.rst:174 +#: ../../library/collections.abc.rst:173 msgid ":class:`MappingView`, :class:`Collection`" msgstr ":class:`MappingView`、:class:`Collection`" -#: ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:175 msgid ":class:`Awaitable` [1]_" msgstr ":class:`Awaitable` [1]_" -#: ../../library/collections.abc.rst:176 +#: ../../library/collections.abc.rst:175 msgid "``__await__``" msgstr "``__await__``" -#: ../../library/collections.abc.rst:177 +#: ../../library/collections.abc.rst:176 msgid ":class:`Coroutine` [1]_" msgstr ":class:`Coroutine` [1]_" -#: ../../library/collections.abc.rst:177 +#: ../../library/collections.abc.rst:176 msgid ":class:`Awaitable`" msgstr ":class:`Awaitable`" -#: ../../library/collections.abc.rst:177 +#: ../../library/collections.abc.rst:176 msgid "``close``" msgstr "``close``" -#: ../../library/collections.abc.rst:178 +#: ../../library/collections.abc.rst:177 msgid ":class:`AsyncIterable` [1]_" msgstr ":class:`AsyncIterable` [1]_" -#: ../../library/collections.abc.rst:178 ../../library/collections.abc.rst:179 +#: ../../library/collections.abc.rst:177 ../../library/collections.abc.rst:178 msgid "``__aiter__``" msgstr "``__aiter__``" -#: ../../library/collections.abc.rst:179 +#: ../../library/collections.abc.rst:178 msgid ":class:`AsyncIterator` [1]_" msgstr ":class:`AsyncIterator` [1]_" -#: ../../library/collections.abc.rst:179 +#: ../../library/collections.abc.rst:178 msgid ":class:`AsyncIterable`" msgstr ":class:`AsyncIterable`" -#: ../../library/collections.abc.rst:179 +#: ../../library/collections.abc.rst:178 msgid "``__anext__``" msgstr "``__anext__``" -#: ../../library/collections.abc.rst:180 +#: ../../library/collections.abc.rst:179 msgid ":class:`AsyncGenerator` [1]_" msgstr ":class:`AsyncGenerator` [1]_" -#: ../../library/collections.abc.rst:180 +#: ../../library/collections.abc.rst:179 msgid ":class:`AsyncIterator`" msgstr ":class:`AsyncIterator`" -#: ../../library/collections.abc.rst:180 +#: ../../library/collections.abc.rst:179 msgid "``asend``, ``athrow``" msgstr "``asend``、``athrow``" -#: ../../library/collections.abc.rst:180 +#: ../../library/collections.abc.rst:179 msgid "``aclose``, ``__aiter__``, ``__anext__``" msgstr "``aclose``、``__aiter__``、``__anext__``" -#: ../../library/collections.abc.rst:181 +#: ../../library/collections.abc.rst:180 msgid ":class:`Buffer` [1]_" msgstr ":class:`Buffer` [1]_" -#: ../../library/collections.abc.rst:181 +#: ../../library/collections.abc.rst:180 msgid "``__buffer__``" msgstr "``__buffer__``" -#: ../../library/collections.abc.rst:186 +#: ../../library/collections.abc.rst:185 msgid "Footnotes" msgstr "註腳" -#: ../../library/collections.abc.rst:187 +#: ../../library/collections.abc.rst:186 msgid "" "These ABCs override :meth:`~abc.ABCMeta.__subclasshook__` to support testing " "an interface by verifying the required methods are present and have not been " @@ -487,214 +487,211 @@ msgid "" "interfaces require registration or direct subclassing." msgstr "" -#: ../../library/collections.abc.rst:193 +#: ../../library/collections.abc.rst:192 msgid "" "Checking ``isinstance(obj, Iterable)`` detects classes that are registered " "as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but " "it does not detect classes that iterate with the :meth:`~object.__getitem__` " -"method. The only reliable way to determine whether an object " -"is :term:`iterable` is to call ``iter(obj)``." +"method. The only reliable way to determine whether an object is :term:" +"`iterable` is to call ``iter(obj)``." msgstr "" -#: ../../library/collections.abc.rst:201 +#: ../../library/collections.abc.rst:200 msgid "Collections Abstract Base Classes -- Detailed Descriptions" msgstr "" -#: ../../library/collections.abc.rst:206 +#: ../../library/collections.abc.rst:205 msgid "ABC for classes that provide the :meth:`~object.__contains__` method." msgstr "" -#: ../../library/collections.abc.rst:210 +#: ../../library/collections.abc.rst:209 msgid "ABC for classes that provide the :meth:`~object.__hash__` method." msgstr "" -#: ../../library/collections.abc.rst:214 +#: ../../library/collections.abc.rst:213 msgid "ABC for classes that provide the :meth:`~object.__len__` method." msgstr "" -#: ../../library/collections.abc.rst:218 +#: ../../library/collections.abc.rst:217 msgid "ABC for classes that provide the :meth:`~object.__call__` method." msgstr "" -#: ../../library/collections.abc.rst:220 +#: ../../library/collections.abc.rst:219 msgid "" "See :ref:`annotating-callables` for details on how to use :class:`!Callable` " "in type annotations." msgstr "" -#: ../../library/collections.abc.rst:225 +#: ../../library/collections.abc.rst:224 msgid "ABC for classes that provide the :meth:`~container.__iter__` method." msgstr "" -#: ../../library/collections.abc.rst:227 +#: ../../library/collections.abc.rst:226 msgid "" "Checking ``isinstance(obj, Iterable)`` detects classes that are registered " "as :class:`Iterable` or that have an :meth:`~container.__iter__` method, but " "it does not detect classes that iterate with the :meth:`~object.__getitem__` " -"method. The only reliable way to determine whether an object " -"is :term:`iterable` is to call ``iter(obj)``." +"method. The only reliable way to determine whether an object is :term:" +"`iterable` is to call ``iter(obj)``." msgstr "" -#: ../../library/collections.abc.rst:236 +#: ../../library/collections.abc.rst:235 msgid "ABC for sized iterable container classes." msgstr "" -#: ../../library/collections.abc.rst:242 +#: ../../library/collections.abc.rst:241 msgid "" -"ABC for classes that provide the :meth:`~iterator.__iter__` " -"and :meth:`~iterator.__next__` methods. See also the definition " -"of :term:`iterator`." +"ABC for classes that provide the :meth:`~iterator.__iter__` and :meth:" +"`~iterator.__next__` methods. See also the definition of :term:`iterator`." msgstr "" -#: ../../library/collections.abc.rst:248 +#: ../../library/collections.abc.rst:247 msgid "" "ABC for iterable classes that also provide the :meth:`~object.__reversed__` " "method." msgstr "" -#: ../../library/collections.abc.rst:255 +#: ../../library/collections.abc.rst:254 msgid "" -"ABC for :term:`generator` classes that implement the protocol defined " -"in :pep:`342` that extends :term:`iterators ` with " -"the :meth:`~generator.send`, :meth:`~generator.throw` " -"and :meth:`~generator.close` methods." +"ABC for :term:`generator` classes that implement the protocol defined in :" +"pep:`342` that extends :term:`iterators ` with the :meth:" +"`~generator.send`, :meth:`~generator.throw` and :meth:`~generator.close` " +"methods." msgstr "" -#: ../../library/collections.abc.rst:260 +#: ../../library/collections.abc.rst:259 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on " -"using :class:`!Generator` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`!Generator` in type annotations." msgstr "" -#: ../../library/collections.abc.rst:269 +#: ../../library/collections.abc.rst:268 msgid "ABCs for read-only and mutable :term:`sequences `." msgstr "" -#: ../../library/collections.abc.rst:271 +#: ../../library/collections.abc.rst:270 msgid "" -"Implementation note: Some of the mixin methods, such " -"as :meth:`~container.__iter__`, :meth:`~object.__reversed__` " -"and :meth:`index`, make repeated calls to the " -"underlying :meth:`~object.__getitem__` method. Consequently, " +"Implementation note: Some of the mixin methods, such as :meth:`~container." +"__iter__`, :meth:`~object.__reversed__` and :meth:`index`, make repeated " +"calls to the underlying :meth:`~object.__getitem__` method. Consequently, " "if :meth:`~object.__getitem__` is implemented with constant access speed, " "the mixin methods will have linear performance; however, if the underlying " "method is linear (as it would be with a linked list), the mixins will have " "quadratic performance and will likely need to be overridden." msgstr "" -#: ../../library/collections.abc.rst:280 +#: ../../library/collections.abc.rst:279 msgid "The index() method added support for *stop* and *start* arguments." msgstr "" -#: ../../library/collections.abc.rst:284 +#: ../../library/collections.abc.rst:283 msgid "" "The :class:`ByteString` ABC has been deprecated. For use in typing, prefer a " "union, like ``bytes | bytearray``, or :class:`collections.abc.Buffer`. For " "use as an ABC, prefer :class:`Sequence` or :class:`collections.abc.Buffer`." msgstr "" -#: ../../library/collections.abc.rst:293 +#: ../../library/collections.abc.rst:292 msgid "ABCs for read-only and mutable :ref:`sets `." msgstr "" -#: ../../library/collections.abc.rst:298 +#: ../../library/collections.abc.rst:297 msgid "ABCs for read-only and mutable :term:`mappings `." msgstr "" -#: ../../library/collections.abc.rst:305 +#: ../../library/collections.abc.rst:304 msgid "" "ABCs for mapping, items, keys, and values :term:`views `." msgstr "" -#: ../../library/collections.abc.rst:309 +#: ../../library/collections.abc.rst:308 msgid "" "ABC for :term:`awaitable` objects, which can be used in :keyword:`await` " -"expressions. Custom implementations must provide " -"the :meth:`~object.__await__` method." +"expressions. Custom implementations must provide the :meth:`~object." +"__await__` method." msgstr "" -#: ../../library/collections.abc.rst:313 +#: ../../library/collections.abc.rst:312 msgid "" -":term:`Coroutine ` objects and instances of " -"the :class:`~collections.abc.Coroutine` ABC are all instances of this ABC." +":term:`Coroutine ` objects and instances of the :class:" +"`~collections.abc.Coroutine` ABC are all instances of this ABC." msgstr "" -#: ../../library/collections.abc.rst:317 +#: ../../library/collections.abc.rst:316 msgid "" "In CPython, generator-based coroutines (:term:`generators ` " "decorated with :func:`@types.coroutine `) are *awaitables*, " "even though they do not have an :meth:`~object.__await__` method. Using " -"``isinstance(gencoro, Awaitable)`` for them will return ``False``. " -"Use :func:`inspect.isawaitable` to detect them." +"``isinstance(gencoro, Awaitable)`` for them will return ``False``. Use :func:" +"`inspect.isawaitable` to detect them." msgstr "" -#: ../../library/collections.abc.rst:327 +#: ../../library/collections.abc.rst:326 msgid "" "ABC for :term:`coroutine` compatible classes. These implement the following " -"methods, defined in :ref:`coroutine-" -"objects`: :meth:`~coroutine.send`, :meth:`~coroutine.throw`, " -"and :meth:`~coroutine.close`. Custom implementations must also " -"implement :meth:`~object.__await__`. All :class:`Coroutine` instances are " -"also instances of :class:`Awaitable`." +"methods, defined in :ref:`coroutine-objects`: :meth:`~coroutine.send`, :meth:" +"`~coroutine.throw`, and :meth:`~coroutine.close`. Custom implementations " +"must also implement :meth:`~object.__await__`. All :class:`Coroutine` " +"instances are also instances of :class:`Awaitable`." msgstr "" -#: ../../library/collections.abc.rst:335 +#: ../../library/collections.abc.rst:334 msgid "" "In CPython, generator-based coroutines (:term:`generators ` " "decorated with :func:`@types.coroutine `) are *awaitables*, " "even though they do not have an :meth:`~object.__await__` method. Using " -"``isinstance(gencoro, Coroutine)`` for them will return ``False``. " -"Use :func:`inspect.isawaitable` to detect them." +"``isinstance(gencoro, Coroutine)`` for them will return ``False``. Use :func:" +"`inspect.isawaitable` to detect them." msgstr "" -#: ../../library/collections.abc.rst:341 +#: ../../library/collections.abc.rst:340 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on " -"using :class:`!Coroutine` in type annotations. The variance and order of " -"type parameters correspond to those of :class:`Generator`." +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`!Coroutine` in type annotations. The variance and order of type parameters " +"correspond to those of :class:`Generator`." msgstr "" -#: ../../library/collections.abc.rst:350 +#: ../../library/collections.abc.rst:349 msgid "" "ABC for classes that provide an ``__aiter__`` method. See also the " "definition of :term:`asynchronous iterable`." msgstr "" -#: ../../library/collections.abc.rst:357 +#: ../../library/collections.abc.rst:356 msgid "" "ABC for classes that provide ``__aiter__`` and ``__anext__`` methods. See " "also the definition of :term:`asynchronous iterator`." msgstr "" -#: ../../library/collections.abc.rst:364 +#: ../../library/collections.abc.rst:363 msgid "" "ABC for :term:`asynchronous generator` classes that implement the protocol " "defined in :pep:`525` and :pep:`492`." msgstr "" -#: ../../library/collections.abc.rst:367 +#: ../../library/collections.abc.rst:366 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on " -"using :class:`!AsyncGenerator` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on using :class:" +"`!AsyncGenerator` in type annotations." msgstr "" -#: ../../library/collections.abc.rst:374 +#: ../../library/collections.abc.rst:373 msgid "" "ABC for classes that provide the :meth:`~object.__buffer__` method, " "implementing the :ref:`buffer protocol `. See :pep:`688`." msgstr "" -#: ../../library/collections.abc.rst:380 +#: ../../library/collections.abc.rst:379 msgid "Examples and Recipes" msgstr "" -#: ../../library/collections.abc.rst:382 +#: ../../library/collections.abc.rst:381 msgid "" "ABCs allow us to ask classes or instances if they provide particular " "functionality, for example::" msgstr "" -#: ../../library/collections.abc.rst:385 +#: ../../library/collections.abc.rst:384 msgid "" "size = None\n" "if isinstance(myvar, collections.abc.Sized):\n" @@ -704,18 +701,17 @@ msgstr "" "if isinstance(myvar, collections.abc.Sized):\n" " size = len(myvar)" -#: ../../library/collections.abc.rst:389 +#: ../../library/collections.abc.rst:388 msgid "" "Several of the ABCs are also useful as mixins that make it easier to develop " "classes supporting container APIs. For example, to write a class supporting " "the full :class:`Set` API, it is only necessary to supply the three " -"underlying abstract " -"methods: :meth:`~object.__contains__`, :meth:`~container.__iter__`, " -"and :meth:`~object.__len__`. The ABC supplies the remaining methods such " -"as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" +"underlying abstract methods: :meth:`~object.__contains__`, :meth:`~container." +"__iter__`, and :meth:`~object.__len__`. The ABC supplies the remaining " +"methods such as :meth:`!__and__` and :meth:`~frozenset.isdisjoint`::" msgstr "" -#: ../../library/collections.abc.rst:396 +#: ../../library/collections.abc.rst:395 msgid "" "class ListBasedSet(collections.abc.Set):\n" " ''' Alternate set implementation favoring space over speed\n" @@ -741,31 +737,31 @@ msgid "" "automatically" msgstr "" -#: ../../library/collections.abc.rst:418 +#: ../../library/collections.abc.rst:417 msgid "Notes on using :class:`Set` and :class:`MutableSet` as a mixin:" msgstr "" -#: ../../library/collections.abc.rst:421 +#: ../../library/collections.abc.rst:420 msgid "" "Since some set operations create new sets, the default mixin methods need a " "way to create new instances from an :term:`iterable`. The class constructor " "is assumed to have a signature in the form ``ClassName(iterable)``. That " -"assumption is factored-out to an internal :class:`classmethod` " -"called :meth:`!_from_iterable` which calls ``cls(iterable)`` to produce a " -"new set. If the :class:`Set` mixin is being used in a class with a different " -"constructor signature, you will need to override :meth:`!_from_iterable` " -"with a classmethod or regular method that can construct new instances from " -"an iterable argument." +"assumption is factored-out to an internal :class:`classmethod` called :meth:" +"`!_from_iterable` which calls ``cls(iterable)`` to produce a new set. If " +"the :class:`Set` mixin is being used in a class with a different constructor " +"signature, you will need to override :meth:`!_from_iterable` with a " +"classmethod or regular method that can construct new instances from an " +"iterable argument." msgstr "" -#: ../../library/collections.abc.rst:432 +#: ../../library/collections.abc.rst:431 msgid "" "To override the comparisons (presumably for speed, as the semantics are " "fixed), redefine :meth:`~object.__le__` and :meth:`~object.__ge__`, then the " "other operations will automatically follow suit." msgstr "" -#: ../../library/collections.abc.rst:438 +#: ../../library/collections.abc.rst:437 msgid "" "The :class:`Set` mixin provides a :meth:`!_hash` method to compute a hash " "value for the set; however, :meth:`~object.__hash__` is not defined because " @@ -774,12 +770,12 @@ msgid "" "define ``__hash__ = Set._hash``." msgstr "" -#: ../../library/collections.abc.rst:446 +#: ../../library/collections.abc.rst:445 msgid "" "`OrderedSet recipe `_ for an " "example built on :class:`MutableSet`." msgstr "" -#: ../../library/collections.abc.rst:449 +#: ../../library/collections.abc.rst:448 msgid "For more about ABCs, see the :mod:`abc` module and :pep:`3119`." msgstr "關於 ABC 的更多資訊請見 :mod:`abc` module 和 :pep:`3119`。" diff --git a/library/collections.po b/library/collections.po index 89f959dbcb..28aa3f51f9 100644 --- a/library/collections.po +++ b/library/collections.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-03 00:15+0000\n" +"POT-Creation-Date: 2025-03-04 00:14+0000\n" "PO-Revision-Date: 2024-01-22 21:42+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,12 +32,12 @@ msgstr "**原始碼:**\\ :source:`Lib/collections/__init__.py`" #: ../../library/collections.rst:20 msgid "" "This module implements specialized container datatypes providing " -"alternatives to Python's general purpose built-in containers, :class:" -"`dict`, :class:`list`, :class:`set`, and :class:`tuple`." +"alternatives to Python's general purpose built-in " +"containers, :class:`dict`, :class:`list`, :class:`set`, and :class:`tuple`." msgstr "" -"這個模組實作了一些特別的容器資料型態,用來替代 Python 一般內建的容器,例如 :" -"class:`dict`\\ (字典)、:class:`list`\\ (串列)、:class:`set`\\ (集合)" -"和 :class:`tuple`\\ (元組)。" +"這個模組實作了一些特別的容器資料型態,用來替代 Python 一般內建的容器,例" +"如 :class:`dict`\\ (字典)、:class:`list`\\ (串列)、:class:`set`\\ (集" +"合)和 :class:`tuple`\\ (元組)。" #: ../../library/collections.rst:25 msgid ":func:`namedtuple`" @@ -124,8 +124,8 @@ msgid "" "calls." msgstr "" ":class:`ChainMap`\\ (對映鏈結)類別的目的是快速將數個對映連結在一起,讓它們" -"可以被當作一個單元來處理。它通常會比建立一個新的字典並多次呼叫 :meth:`~dict." -"update` 來得更快。" +"可以被當作一個單元來處理。它通常會比建立一個新的字典並多次呼" +"叫 :meth:`~dict.update` 來得更快。" #: ../../library/collections.rst:46 msgid "" @@ -203,8 +203,8 @@ msgid "" msgstr "" "回傳包含一個新對映的 :class:`ChainMap`, 新對映後面接著目前實例的所有現存對" "映。如果有給定 ``m``,``m`` 會成為那個最前面的新對映;若沒有指定,則會加上一" -"個空 dict,如此一來呼叫 ``d.new_child()`` 就等同於 ``ChainMap({}, *d." -"maps)``。這個方法用於建立子上下文,而保持父對映的不變。" +"個空 dict,如此一來呼叫 ``d.new_child()`` 就等同於 ``ChainMap({}, " +"*d.maps)``。這個方法用於建立子上下文,而保持父對映的不變。" #: ../../library/collections.rst:86 msgid "The optional ``m`` parameter was added." @@ -218,10 +218,11 @@ msgstr "增加了對關鍵字引數的支援。" msgid "" "Property returning a new :class:`ChainMap` containing all of the maps in the " "current instance except the first one. This is useful for skipping the " -"first map in the search. Use cases are similar to those for the :keyword:" -"`nonlocal` keyword used in :term:`nested scopes `. The use " -"cases also parallel those for the built-in :func:`super` function. A " -"reference to ``d.parents`` is equivalent to: ``ChainMap(*d.maps[1:])``." +"first map in the search. Use cases are similar to those for " +"the :keyword:`nonlocal` keyword used in :term:`nested scopes `. The use cases also parallel those for the built-in :func:`super` " +"function. A reference to ``d.parents`` is equivalent to: " +"``ChainMap(*d.maps[1:])``." msgstr "" "回傳一個包含除了第一個以外所有其他對映的新 :class:`ChainMap` 的特性,可用於需" "要跳過第一個對映的搜尋。使用情境類似於在\\ :term:`巢狀作用域 `_ for templating is a read-only chain of mappings. It " -"also features pushing and popping of contexts similar to the :meth:" -"`~collections.ChainMap.new_child` method and the :attr:`~collections." -"ChainMap.parents` property." +"also features pushing and popping of contexts similar to " +"the :meth:`~collections.ChainMap.new_child` method and " +"the :attr:`~collections.ChainMap.parents` property." msgstr "" "Django 中用於模板的 `Context class `_ 是唯讀的對映鏈,也具有加入 (push) 和移除 " -"(pop) 上下文的功能,與 :meth:`~collections.ChainMap.new_child` 方法和 :attr:" -"`~collections.ChainMap.parents` 特性類似。" +"(pop) 上下文的功能,與 :meth:`~collections.ChainMap.new_child` 方法" +"和 :attr:`~collections.ChainMap.parents` 特性類似。" #: ../../library/collections.rst:136 msgid "" @@ -305,11 +306,11 @@ msgstr "" #: ../../library/collections.rst:141 msgid "" -"A `greatly simplified read-only version of Chainmap `_." +"A `greatly simplified read-only version of Chainmap `_." msgstr "" -"一個\\ `極度簡化、維讀版本的 Chainmap `_。" +"一個\\ `極度簡化、維讀版本的 Chainmap `_。" #: ../../library/collections.rst:146 msgid ":class:`ChainMap` Examples and Recipes" @@ -692,13 +693,13 @@ msgstr "使用 :meth:`~Counter.most_common` 方法的唯一條件是其值要是 msgid "" "For in-place operations such as ``c[key] += 1``, the value type need only " "support addition and subtraction. So fractions, floats, and decimals would " -"work and negative values are supported. The same is also true for :meth:" -"`~Counter.update` and :meth:`~Counter.subtract` which allow negative and " -"zero values for both inputs and outputs." +"work and negative values are supported. The same is also true " +"for :meth:`~Counter.update` and :meth:`~Counter.subtract` which allow " +"negative and zero values for both inputs and outputs." msgstr "" "像是 ``c[key] += 1`` 的原地操作中,其值之型別只必須支援加減,所以分數、浮點" -"數、十進位數與其負值都可以使用。同理,:meth:`~Counter.update` 和 :meth:" -"`~Counter.subtract` 也都允許 0 或負值為輸入或輸出。" +"數、十進位數與其負值都可以使用。同理,:meth:`~Counter.update` " +"和 :meth:`~Counter.subtract` 也都允許 0 或負值為輸入或輸出。" #: ../../library/collections.rst:422 msgid "" @@ -718,8 +719,8 @@ msgstr ":meth:`~Counter.elements` 方法需要其計數為正值,如為 0 或 #: ../../library/collections.rst:432 msgid "" -"`Bag class `_ in Smalltalk." +"`Bag class `_ in Smalltalk." msgstr "" "Smalltalk 中的 `Bag class `_。" @@ -752,8 +753,8 @@ msgid "" "To enumerate all distinct multisets of a given size over a given set of " "elements, see :func:`itertools.combinations_with_replacement`::" msgstr "" -"若要根據給定的元素集合來列舉出所有不重複且擁有指定元素數量的 multiset,請見 :" -"func:`itertools.combinations_with_replacement`: ::" +"若要根據給定的元素集合來列舉出所有不重複且擁有指定元素數量的 multiset,請" +"見 :func:`itertools.combinations_with_replacement`: ::" #: ../../library/collections.rst:447 msgid "" @@ -771,9 +772,9 @@ msgid "" "with data from *iterable*. If *iterable* is not specified, the new deque is " "empty." msgstr "" -"回傳一個新的 deque(雙端佇列)物件,將 *iterable* 中的資料由左至右(使用 :" -"meth:`append`\\ )加入來做初始化。如果 *iterable* 並未給定,回傳的則是一個空" -"的 deque。" +"回傳一個新的 deque(雙端佇列)物件,將 *iterable* 中的資料由左至右(使" +"用 :meth:`append`\\ )加入來做初始化。如果 *iterable* 並未給定,回傳的則是一" +"個空的 deque。" #: ../../library/collections.rst:458 msgid "" @@ -867,32 +868,32 @@ msgstr "在 deque 位置 *i* 中插入 *x*。" #: ../../library/collections.rst:535 msgid "" -"If the insertion would cause a bounded deque to grow beyond *maxlen*, an :" -"exc:`IndexError` is raised." +"If the insertion would cause a bounded deque to grow beyond *maxlen*, " +"an :exc:`IndexError` is raised." msgstr "" -"如果此插入操作導致 deque 超過其長度上限 *maxlen* 的話,會引發 :exc:" -"`IndexError` 例外。" +"如果此插入操作導致 deque 超過其長度上限 *maxlen* 的話,會引" +"發 :exc:`IndexError` 例外。" #: ../../library/collections.rst:543 msgid "" "Remove and return an element from the right side of the deque. If no " "elements are present, raises an :exc:`IndexError`." msgstr "" -"移除並回傳 deque 的最右側元素,若本來就沒有任何元素,則會引發 :exc:" -"`IndexError`。" +"移除並回傳 deque 的最右側元素,若本來就沒有任何元素,則會引" +"發 :exc:`IndexError`。" #: ../../library/collections.rst:549 msgid "" "Remove and return an element from the left side of the deque. If no elements " "are present, raises an :exc:`IndexError`." msgstr "" -"移除並回傳 deque 的最左側元素,若本來就沒有任何元素,則會引發 :exc:" -"`IndexError`。" +"移除並回傳 deque 的最左側元素,若本來就沒有任何元素,則會引" +"發 :exc:`IndexError`。" #: ../../library/collections.rst:555 msgid "" -"Remove the first occurrence of *value*. If not found, raises a :exc:" -"`ValueError`." +"Remove the first occurrence of *value*. If not found, raises " +"a :exc:`ValueError`." msgstr "移除第一個出現的 *value*,如果沒找到的話就引發一個 :exc:`ValueError`。" #: ../../library/collections.rst:561 @@ -1051,17 +1052,17 @@ msgstr "" #: ../../library/collections.rst:678 msgid "" "A `round-robin scheduler `_ can be implemented with input iterators stored in a :" -"class:`deque`. Values are yielded from the active iterator in position " -"zero. If that iterator is exhausted, it can be removed with :meth:`~deque." -"popleft`; otherwise, it can be cycled back to the end with the :meth:`~deque." -"rotate` method::" +"robin_scheduling>`_ can be implemented with input iterators stored in " +"a :class:`deque`. Values are yielded from the active iterator in position " +"zero. If that iterator is exhausted, it can be removed " +"with :meth:`~deque.popleft`; otherwise, it can be cycled back to the end " +"with the :meth:`~deque.rotate` method::" msgstr "" "一個\\ `輪詢調度器 `_\\ 可以透過在 :class:`deque` 中放入 iterator 來實現,值自" -"目前 iterator 的位置 0 取出,如果 iterator 已經消耗完畢就用 :meth:`~deque." -"popleft` 將其從佇列中移除,否則利用 :meth:`~deque.rotate` 來將其移至佇列尾" -"端: ::" +"目前 iterator 的位置 0 取出,如果 iterator 已經消耗完畢就" +"用 :meth:`~deque.popleft` 將其從佇列中移除,否則利用 :meth:`~deque.rotate` 來" +"將其移至佇列尾端: ::" #: ../../library/collections.rst:685 msgid "" @@ -1102,18 +1103,19 @@ msgstr "" #: ../../library/collections.rst:706 msgid "" -"To implement :class:`deque` slicing, use a similar approach applying :meth:" -"`~deque.rotate` to bring a target element to the left side of the deque. " -"Remove old entries with :meth:`~deque.popleft`, add new entries with :meth:" -"`~deque.extend`, and then reverse the rotation. With minor variations on " -"that approach, it is easy to implement Forth style stack manipulations such " -"as ``dup``, ``drop``, ``swap``, ``over``, ``pick``, ``rot``, and ``roll``." +"To implement :class:`deque` slicing, use a similar approach " +"applying :meth:`~deque.rotate` to bring a target element to the left side of " +"the deque. Remove old entries with :meth:`~deque.popleft`, add new entries " +"with :meth:`~deque.extend`, and then reverse the rotation. With minor " +"variations on that approach, it is easy to implement Forth style stack " +"manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``, " +"``rot``, and ``roll``." msgstr "" "要實現 :class:`deque` 切片,可使用近似以下方法:使用 :meth:`~deque.rotate` 來" -"將目標元素移動到 deque 最左側,用 :meth:`~deque.popleft` 移除舊元素並用 :" -"meth:`~deque.extend` 加入新元素,最後再反向 rotate。在這個方法上做小小的更動" -"就能簡單地實現 Forth 風格的 stack 操作,例如 ``dup``、``drop``、``swap``、" -"``over``、``pick``、``rot`` 和 ``roll``。" +"將目標元素移動到 deque 最左側,用 :meth:`~deque.popleft` 移除舊元素並" +"用 :meth:`~deque.extend` 加入新元素,最後再反向 rotate。在這個方法上做小小的" +"更動就能簡單地實現 Forth 風格的 stack 操作,例如 ``dup``、``drop``、" +"``swap``、``over``、``pick``、``rot`` 和 ``roll``。" #: ../../library/collections.rst:716 msgid ":class:`defaultdict` objects" @@ -1127,15 +1129,15 @@ msgid "" "the :class:`dict` class and is not documented here." msgstr "" "回傳一個新的類似字典的物件。:class:`defaultdict` 是內建類別 :class:`dict` 的" -"子類別。它覆蓋掉了一個方法並添加了一個可寫入的實例變數。其餘功能與 :class:" -"`dict` 相同,此文件不再複述。" +"子類別。它覆蓋掉了一個方法並添加了一個可寫入的實例變數。其餘功能" +"與 :class:`dict` 相同,此文件不再複述。" #: ../../library/collections.rst:725 msgid "" -"The first argument provides the initial value for the :attr:" -"`default_factory` attribute; it defaults to ``None``. All remaining " -"arguments are treated the same as if they were passed to the :class:`dict` " -"constructor, including keyword arguments." +"The first argument provides the initial value for " +"the :attr:`default_factory` attribute; it defaults to ``None``. All " +"remaining arguments are treated the same as if they were passed to " +"the :class:`dict` constructor, including keyword arguments." msgstr "" "第一個引數為 :attr:`default_factory` 屬性提供了初始值,他被預設為 ``None``," "所有其他的引數(包括關鍵字引數)都會被傳遞給 :class:`dict` 的建構函式 " @@ -1149,8 +1151,8 @@ msgstr ":class:`defaultdict` 物件支援以下 :class:`dict` 所沒有的方法 #: ../../library/collections.rst:736 msgid "" -"If the :attr:`default_factory` attribute is ``None``, this raises a :exc:" -"`KeyError` exception with the *key* as argument." +"If the :attr:`default_factory` attribute is ``None``, this raises " +"a :exc:`KeyError` exception with the *key* as argument." msgstr "" "如果 :attr:`default_factory` 屬性為 ``None``,呼叫此方法會引發一個附帶引數 " "*key* 的 :exc:`KeyError` 例外。" @@ -1174,24 +1176,24 @@ msgstr "" #: ../../library/collections.rst:746 msgid "" -"This method is called by the :meth:`~object.__getitem__` method of the :" -"class:`dict` class when the requested key is not found; whatever it returns " -"or raises is then returned or raised by :meth:`~object.__getitem__`." +"This method is called by the :meth:`~object.__getitem__` method of " +"the :class:`dict` class when the requested key is not found; whatever it " +"returns or raises is then returned or raised by :meth:`~object.__getitem__`." msgstr "" -"在無法找到所要求的鍵時,此方法會被 :class:`dict` 類別的 :meth:`~object." -"__getitem__` 方法呼叫。無論此方法回傳了值還是引發了例外,都會被 :meth:" -"`~object.__getitem__` 所傳遞。" +"在無法找到所要求的鍵時,此方法會被 :class:`dict` 類別" +"的 :meth:`~object.__getitem__` 方法呼叫。無論此方法回傳了值還是引發了例外,都" +"會被 :meth:`~object.__getitem__` 所傳遞。" #: ../../library/collections.rst:750 msgid "" -"Note that :meth:`__missing__` is *not* called for any operations besides :" -"meth:`~object.__getitem__`. This means that :meth:`get` will, like normal " -"dictionaries, return ``None`` as a default rather than using :attr:" -"`default_factory`." +"Note that :meth:`__missing__` is *not* called for any operations " +"besides :meth:`~object.__getitem__`. This means that :meth:`~dict.get` will, " +"like normal dictionaries, return ``None`` as a default rather than " +"using :attr:`default_factory`." msgstr "" "注意,:meth:`__missing__` *不會*\\ 被 :meth:`~object.__getitem__` 以外的其他" -"方法呼叫,這意味著 :meth:`get` 會像一般的 dict 那樣回傳 ``None`` 做為預設值," -"而非使用 :attr:`default_factory`。" +"方法呼叫,這意味著 :meth:`~dict.get` 會像一般的 dict 那樣回傳 ``None`` 做為預" +"設值,而非使用 :attr:`default_factory`。" #: ../../library/collections.rst:756 msgid ":class:`defaultdict` objects support the following instance variable:" @@ -1206,7 +1208,7 @@ msgstr "" "此屬性為 :meth:`__missing__` 方法所使用。如果有引數被傳入建構函式,則此屬性會" "被初始化成第一個引數,如未提供引數則被初始化為 ``None``。" -#: ../../library/collections.rst:765 ../../library/collections.rst:1191 +#: ../../library/collections.rst:765 ../../library/collections.rst:1192 msgid "" "Added merge (``|``) and update (``|=``) operators, specified in :pep:`584`." msgstr "新增合併 (``|``) 和更新 (``|=``) 運算子,請見 :pep:`584`。" @@ -1226,40 +1228,41 @@ msgstr "" #: ../../library/collections.rst:784 msgid "" "When each key is encountered for the first time, it is not already in the " -"mapping; so an entry is automatically created using the :attr:`~defaultdict." -"default_factory` function which returns an empty :class:`list`. The :meth:`!" -"list.append` operation then attaches the value to the new list. When keys " -"are encountered again, the look-up proceeds normally (returning the list for " -"that key) and the :meth:`!list.append` operation adds another value to the " -"list. This technique is simpler and faster than an equivalent technique " +"mapping; so an entry is automatically created using " +"the :attr:`~defaultdict.default_factory` function which returns an " +"empty :class:`list`. The :meth:`!list.append` operation then attaches the " +"value to the new list. When keys are encountered again, the look-up " +"proceeds normally (returning the list for that key) and the :meth:`!" +"list.append` operation adds another value to the list. This technique is " +"simpler and faster than an equivalent technique " "using :meth:`dict.setdefault`:" msgstr "" -"當每個鍵第一次被存取時,它還沒有存在於對映中,所以會自動呼叫 :attr:" -"`~defaultdict.default_factory` 方法來回傳一個空的 :class:`list` 以建立一個條" -"目,:meth:`!list.append` 操作後續會再新增值到這個新的列表裡。當再次存取該鍵" -"時,就如普通字典般操作(回傳該鍵所對應到的 list),:meth:`!list.append` 也會" -"新增另一個值到 list 中。和使用與其等價的 :meth:`dict.setdefault` 相比,這個技" -"巧更加快速和簡單:" +"當每個鍵第一次被存取時,它還沒有存在於對映中,所以會自動呼" +"叫 :attr:`~defaultdict.default_factory` 方法來回傳一個空的 :class:`list` 以建" +"立一個條目,:meth:`!list.append` 操作後續會再新增值到這個新的列表裡。當再次存" +"取該鍵時,就如普通字典般操作(回傳該鍵所對應到的 list),:meth:`!" +"list.append` 也會新增另一個值到 list 中。和使用與其等價" +"的 :meth:`dict.setdefault` 相比,這個技巧更加快速和簡單:" #: ../../library/collections.rst:799 msgid "" -"Setting the :attr:`~defaultdict.default_factory` to :class:`int` makes the :" -"class:`defaultdict` useful for counting (like a bag or multiset in other " -"languages):" +"Setting the :attr:`~defaultdict.default_factory` to :class:`int` makes " +"the :class:`defaultdict` useful for counting (like a bag or multiset in " +"other languages):" msgstr "" -"設定 :attr:`~defaultdict.default_factory` 為 :class:`int` 使得 :class:" -"`defaultdict` 可被用於計數(類似其他語言中的 bag 或 multiset):" +"設定 :attr:`~defaultdict.default_factory` 為 :class:`int` 使" +"得 :class:`defaultdict` 可被用於計數(類似其他語言中的 bag 或 multiset):" #: ../../library/collections.rst:811 msgid "" -"When a letter is first encountered, it is missing from the mapping, so the :" -"attr:`~defaultdict.default_factory` function calls :func:`int` to supply a " -"default count of zero. The increment operation then builds up the count for " -"each letter." +"When a letter is first encountered, it is missing from the mapping, so " +"the :attr:`~defaultdict.default_factory` function calls :func:`int` to " +"supply a default count of zero. The increment operation then builds up the " +"count for each letter." msgstr "" -"當一個字母首次被存取時,它並不存在於對映中,則 :attr:`~defaultdict." -"default_factory` 函式會呼叫 :func:`int` 來提供一個整數 0 作為預設值。後續的增" -"加操作繼續對每個字母做計數。" +"當一個字母首次被存取時,它並不存在於對映中," +"則 :attr:`~defaultdict.default_factory` 函式會呼叫 :func:`int` 來提供一個整" +"數 0 作為預設值。後續的增加操作繼續對每個字母做計數。" #: ../../library/collections.rst:815 msgid "" @@ -1273,11 +1276,11 @@ msgstr "" #: ../../library/collections.rst:828 msgid "" -"Setting the :attr:`~defaultdict.default_factory` to :class:`set` makes the :" -"class:`defaultdict` useful for building a dictionary of sets:" +"Setting the :attr:`~defaultdict.default_factory` to :class:`set` makes " +"the :class:`defaultdict` useful for building a dictionary of sets:" msgstr "" -"將 :attr:`~defaultdict.default_factory` 設為 :class:`set` 使 :class:" -"`defaultdict` 可用於構建一個值為 set 的字典:" +"將 :attr:`~defaultdict.default_factory` 設為 :class:`set` " +"使 :class:`defaultdict` 可用於構建一個值為 set 的字典:" #: ../../library/collections.rst:841 msgid ":func:`namedtuple` Factory Function for Tuples with Named Fields" @@ -1299,16 +1302,17 @@ msgid "" "Returns a new tuple subclass named *typename*. The new subclass is used to " "create tuple-like objects that have fields accessible by attribute lookup as " "well as being indexable and iterable. Instances of the subclass also have a " -"helpful docstring (with typename and field_names) and a helpful :meth:" -"`__repr__` method which lists the tuple contents in a ``name=value`` format." +"helpful docstring (with *typename* and *field_names*) and a " +"helpful :meth:`~object.__repr__` method which lists the tuple contents in a " +"``name=value`` format." msgstr "" "回傳一個名為 *typename* 的新 tuple 子類別。這個新的子類別被用於建立類似 " "tuple 的物件,可以透過屬性名稱來存取欄位,它同時也是可索引 (indexable) 和可疊" -"代的 (iterable)。子類別實例同樣有文件字串 (docstring)(有類別名稱 typename 和欄" -"位名 field_names)和一個好用的 :meth:`__repr__` 方法,可將 tuple 內容以 " -"``name=value`` 格式列出。" +"代的 (iterable)。子類別實例同樣有文件字串 (docstring)(有類別名稱 *typename* " +"和欄位名 *field_names*)和一個好用的 :meth:`~object.__repr__` 方法,可將 " +"tuple 內容以 ``name=value`` 格式列出。" -#: ../../library/collections.rst:855 +#: ../../library/collections.rst:856 msgid "" "The *field_names* are a sequence of strings such as ``['x', 'y']``. " "Alternatively, *field_names* can be a single string with each fieldname " @@ -1317,19 +1321,20 @@ msgstr "" "*field_names* 是一個像 ``['x', 'y']`` 一樣的字串序列。*field_names* 也可以是" "一個用空白或逗號分隔各個欄位名稱的字串,比如 ``'x y'`` 或者 ``'x, y'``。" -#: ../../library/collections.rst:859 +#: ../../library/collections.rst:860 msgid "" "Any valid Python identifier may be used for a fieldname except for names " "starting with an underscore. Valid identifiers consist of letters, digits, " -"and underscores but do not start with a digit or underscore and cannot be a :" -"mod:`keyword` such as *class*, *for*, *return*, *global*, *pass*, or *raise*." +"and underscores but do not start with a digit or underscore and cannot be " +"a :mod:`keyword` such as *class*, *for*, *return*, *global*, *pass*, or " +"*raise*." msgstr "" "除了底線開頭以外的其他任何有效 Python 識別字 (identifier) 都可以作為欄位名" "稱,有效識別字由字母、數字、底線所組成,但不能是數字或底線開頭,也不能是關鍵" "詞 :mod:`keyword`,例如 *class*、*for*、*return*、*global*、*pass* 或 " "*raise*。" -#: ../../library/collections.rst:865 +#: ../../library/collections.rst:866 msgid "" "If *rename* is true, invalid fieldnames are automatically replaced with " "positional names. For example, ``['abc', 'def', 'ghi', 'abc']`` is " @@ -1340,7 +1345,7 @@ msgstr "" "'def', 'ghi', 'abc']`` 會被轉換成 ``['abc', '_1', 'ghi', '_3']``,移除了關鍵" "字 ``def`` 和重複欄位名 ``abc``。" -#: ../../library/collections.rst:870 +#: ../../library/collections.rst:871 msgid "" "*defaults* can be ``None`` or an :term:`iterable` of default values. Since " "fields with a default value must come after any fields without a default, " @@ -1354,7 +1359,7 @@ msgstr "" "如 fieldnames 為 ``['x', 'y', 'z']`` 且 defaults 為 ``(1, 2)``,那麼 ``x`` 就" "必須被給定一個引數,``y`` 被預設為 ``1``,``z`` 則被預設為 ``2``。" -#: ../../library/collections.rst:877 +#: ../../library/collections.rst:878 msgid "" "If *module* is defined, the :attr:`~type.__module__` attribute of the named " "tuple is set to that value." @@ -1362,7 +1367,7 @@ msgstr "" "如果 *module* 值有被定義,named tuple 的 :attr:`~type.__module__` 屬性就被設" "定為該值。" -#: ../../library/collections.rst:880 +#: ../../library/collections.rst:881 msgid "" "Named tuple instances do not have per-instance dictionaries, so they are " "lightweight and require no more memory than regular tuples." @@ -1370,17 +1375,17 @@ msgstr "" "Named tuple 實例中沒有字典,所以它們更加輕量,且和一般 tuple 相比佔用更少記憶" "體。" -#: ../../library/collections.rst:883 +#: ../../library/collections.rst:884 msgid "" "To support pickling, the named tuple class should be assigned to a variable " "that matches *typename*." msgstr "要支援 pickle,應將 named tuple 類別賦值給一個符合 *typename* 的變數。" -#: ../../library/collections.rst:886 +#: ../../library/collections.rst:887 msgid "Added support for *rename*." msgstr "新增對於 *rename* 的支援。" -#: ../../library/collections.rst:889 +#: ../../library/collections.rst:890 msgid "" "The *verbose* and *rename* parameters became :ref:`keyword-only arguments " "`." @@ -1388,20 +1393,21 @@ msgstr "" "*verbose* 和 *rename* 參數成為\\ :ref:`僅限關鍵字引數 `。" -#: ../../library/collections.rst:893 +#: ../../library/collections.rst:894 msgid "Added the *module* parameter." msgstr "新增 *module* 參數。" -#: ../../library/collections.rst:896 -msgid "Removed the *verbose* parameter and the :attr:`_source` attribute." -msgstr "移除 *verbose* 參數和 :attr:`_source` 屬性。" +#: ../../library/collections.rst:897 +msgid "Removed the *verbose* parameter and the :attr:`!_source` attribute." +msgstr "移除 *verbose* 參數和 :attr:`!_source` 屬性。" -#: ../../library/collections.rst:899 +#: ../../library/collections.rst:900 msgid "" -"Added the *defaults* parameter and the :attr:`_field_defaults` attribute." -msgstr "新增 *defaults* 參數和 :attr:`_field_defaults` 屬性。" +"Added the *defaults* parameter and " +"the :attr:`~somenamedtuple._field_defaults` attribute." +msgstr "新增 *defaults* 參數和 :attr:`~somenamedtuple._field_defaults` 屬性。" -#: ../../library/collections.rst:903 +#: ../../library/collections.rst:904 msgid "" ">>> # Basic example\n" ">>> Point = namedtuple('Point', ['x', 'y'])\n" @@ -1418,7 +1424,7 @@ msgid "" "Point(x=11, y=22)" msgstr "" -#: ../../library/collections.rst:919 +#: ../../library/collections.rst:920 msgid "" "Named tuples are especially useful for assigning field names to result " "tuples returned by the :mod:`csv` or :mod:`sqlite3` modules::" @@ -1426,7 +1432,7 @@ msgstr "" "Named tuple 在賦予欄位名稱於 :mod:`csv` 或 :mod:`sqlite3` 模組回傳之 tuple 時" "相當有用: ::" -#: ../../library/collections.rst:922 +#: ../../library/collections.rst:923 msgid "" "EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title, department, " "paygrade')\n" @@ -1460,7 +1466,7 @@ msgstr "" "for emp in map(EmployeeRecord._make, cursor.fetchall()):\n" " print(emp.name, emp.title)" -#: ../../library/collections.rst:935 +#: ../../library/collections.rst:936 msgid "" "In addition to the methods inherited from tuples, named tuples support three " "additional methods and two attributes. To prevent conflicts with field " @@ -1469,12 +1475,12 @@ msgstr "" "除了繼承自 tuple 的方法,named tuple 還支援三個額外的方法和兩個屬性。為了防止" "欄位名稱有衝突,方法和屬性的名稱以底線開頭。" -#: ../../library/collections.rst:941 +#: ../../library/collections.rst:942 msgid "" "Class method that makes a new instance from an existing sequence or iterable." msgstr "從已存在的序列或可疊代物件建立一個新實例的類別方法。" -#: ../../library/collections.rst:943 +#: ../../library/collections.rst:944 msgid "" ">>> t = [11, 22]\n" ">>> Point._make(t)\n" @@ -1484,13 +1490,13 @@ msgstr "" ">>> Point._make(t)\n" "Point(x=11, y=22)" -#: ../../library/collections.rst:951 +#: ../../library/collections.rst:952 msgid "" "Return a new :class:`dict` which maps field names to their corresponding " "values:" msgstr "回傳一個將欄位名稱對映至對應值的 :class:`dict`:" -#: ../../library/collections.rst:954 +#: ../../library/collections.rst:955 msgid "" ">>> p = Point(x=11, y=22)\n" ">>> p._asdict()\n" @@ -1500,11 +1506,11 @@ msgstr "" ">>> p._asdict()\n" "{'x': 11, 'y': 22}" -#: ../../library/collections.rst:960 +#: ../../library/collections.rst:961 msgid "Returns an :class:`OrderedDict` instead of a regular :class:`dict`." msgstr "回傳一個 :class:`OrderedDict` 而非 :class:`dict`。" -#: ../../library/collections.rst:963 +#: ../../library/collections.rst:964 msgid "" "Returns a regular :class:`dict` instead of an :class:`OrderedDict`. As of " "Python 3.7, regular dicts are guaranteed to be ordered. If the extra " @@ -1515,13 +1521,13 @@ msgstr "" "dict 已經保證有順序性,如果需要 :class:`OrderedDict` 所專屬的特性,推薦的解法" "是將結果專換成所需的類型:``OrderedDict(nt._asdict())``。" -#: ../../library/collections.rst:972 +#: ../../library/collections.rst:973 msgid "" "Return a new instance of the named tuple replacing specified fields with new " "values::" msgstr "回傳一個新的 named tuple 實例,並將指定欄位替換為新的值: ::" -#: ../../library/collections.rst:975 +#: ../../library/collections.rst:976 msgid "" ">>> p = Point(x=11, y=22)\n" ">>> p._replace(x=33)\n" @@ -1539,18 +1545,18 @@ msgstr "" "... inventory[partnum] = record._replace(price=newprices[partnum], " "timestamp=time.now())" -#: ../../library/collections.rst:982 +#: ../../library/collections.rst:983 msgid "" "Named tuples are also supported by generic function :func:`copy.replace`." msgstr "" -#: ../../library/collections.rst:984 +#: ../../library/collections.rst:985 msgid "" "Raise :exc:`TypeError` instead of :exc:`ValueError` for invalid keyword " "arguments." msgstr "" -#: ../../library/collections.rst:990 +#: ../../library/collections.rst:991 msgid "" "Tuple of strings listing the field names. Useful for introspection and for " "creating new named tuple types from existing named tuples." @@ -1558,7 +1564,7 @@ msgstr "" "列出 tuple 欄位名稱的字串,用於自我檢查或是從現有 named tuple 建立一個新的 " "named tuple 型別。" -#: ../../library/collections.rst:993 +#: ../../library/collections.rst:994 msgid "" ">>> p._fields # view the field names\n" "('x', 'y')\n" @@ -1569,11 +1575,11 @@ msgid "" "Pixel(x=11, y=22, red=128, green=255, blue=0)" msgstr "" -#: ../../library/collections.rst:1005 +#: ../../library/collections.rst:1006 msgid "Dictionary mapping field names to default values." msgstr "將欄位名稱對映至預設值的字典。" -#: ../../library/collections.rst:1007 +#: ../../library/collections.rst:1008 msgid "" ">>> Account = namedtuple('Account', ['type', 'balance'], defaults=[0])\n" ">>> Account._field_defaults\n" @@ -1587,13 +1593,13 @@ msgstr "" ">>> Account('premium')\n" "Account(type='premium', balance=0)" -#: ../../library/collections.rst:1015 +#: ../../library/collections.rst:1016 msgid "" -"To retrieve a field whose name is stored in a string, use the :func:" -"`getattr` function:" +"To retrieve a field whose name is stored in a string, use " +"the :func:`getattr` function:" msgstr "要取得這個名稱存於字串的欄位,要使用 :func:`getattr` 函式:" -#: ../../library/collections.rst:1021 +#: ../../library/collections.rst:1022 msgid "" "To convert a dictionary to a named tuple, use the double-star-operator (as " "described in :ref:`tut-unpacking-arguments`):" @@ -1601,7 +1607,7 @@ msgstr "" "(如\\ :ref:`tut-unpacking-arguments`\\ 所述)將一個字典轉換成 named tuple," "要使用 \\*\\* 雙星號運算子:" -#: ../../library/collections.rst:1028 +#: ../../library/collections.rst:1029 msgid "" "Since a named tuple is a regular Python class, it is easy to add or change " "functionality with a subclass. Here is how to add a calculated field and a " @@ -1610,7 +1616,7 @@ msgstr "" "因為一個 named tuple 是一個常規的 Python 類別,我們可以很容易的透過子類別來新" "增或更改功能,以下是如何新增一個計算得到的欄位和固定寬度的輸出列印格式:" -#: ../../library/collections.rst:1032 +#: ../../library/collections.rst:1033 msgid "" ">>> class Point(namedtuple('Point', ['x', 'y'])):\n" "... __slots__ = ()\n" @@ -1640,7 +1646,7 @@ msgstr "" "Point: x= 3.000 y= 4.000 hypot= 5.000\n" "Point: x=14.000 y= 0.714 hypot=14.018" -#: ../../library/collections.rst:1047 +#: ../../library/collections.rst:1048 msgid "" "The subclass shown above sets ``__slots__`` to an empty tuple. This helps " "keep memory requirements low by preventing the creation of instance " @@ -1649,26 +1655,26 @@ msgstr "" "上面的子類別將 ``__slots__`` 設定為空 tuple,這樣一來就防止了字典實例被建立," "因而保持了較低的記憶體用量。" -#: ../../library/collections.rst:1050 +#: ../../library/collections.rst:1051 msgid "" "Subclassing is not useful for adding new, stored fields. Instead, simply " "create a new named tuple type from the :attr:`~somenamedtuple._fields` " "attribute:" msgstr "" -"子類別化無法用於增加新的、已被儲存的欄位,應當透過 :attr:`~somenamedtuple." -"_fields` 屬性以建立一個新的 named tuple 來實現:" +"子類別化無法用於增加新的、已被儲存的欄位,應當透" +"過 :attr:`~somenamedtuple._fields` 屬性以建立一個新的 named tuple 來實現:" -#: ../../library/collections.rst:1055 +#: ../../library/collections.rst:1056 msgid "" "Docstrings can be customized by making direct assignments to the ``__doc__`` " "fields:" msgstr "透過直接賦值給 ``__doc__``,可以自訂說明文件字串:" -#: ../../library/collections.rst:1064 +#: ../../library/collections.rst:1065 msgid "Property docstrings became writeable." msgstr "文件字串屬性變成可寫入。" -#: ../../library/collections.rst:1069 +#: ../../library/collections.rst:1070 msgid "" "See :class:`typing.NamedTuple` for a way to add type hints for named " "tuples. It also provides an elegant notation using the :keyword:`class` " @@ -1677,7 +1683,7 @@ msgstr "" "關於為 named tuple 新增型別提示的方法,請參閱 :class:`typing.NamedTuple`,它" "運用 :keyword:`class` 關鍵字以提供了一個簡潔的表示法: ::" -#: ../../library/collections.rst:1073 +#: ../../library/collections.rst:1074 msgid "" "class Component(NamedTuple):\n" " part_number: int\n" @@ -1689,15 +1695,15 @@ msgstr "" " weight: float\n" " description: Optional[str] = None" -#: ../../library/collections.rst:1078 +#: ../../library/collections.rst:1079 msgid "" "See :meth:`types.SimpleNamespace` for a mutable namespace based on an " "underlying dictionary instead of a tuple." msgstr "" -"關於以 dict 而非 tuple 為底層的可變命名空間,請參考 :meth:`types." -"SimpleNamespace`。" +"關於以 dict 而非 tuple 為底層的可變命名空間,請參" +"考 :meth:`types.SimpleNamespace`。" -#: ../../library/collections.rst:1081 +#: ../../library/collections.rst:1082 msgid "" "The :mod:`dataclasses` module provides a decorator and functions for " "automatically adding generated special methods to user-defined classes." @@ -1705,11 +1711,11 @@ msgstr "" ":mod:`dataclasses` 模組提供了一個裝飾器和一些函式,用於自動將被生成的特殊方法" "新增到使用者定義的類別中。" -#: ../../library/collections.rst:1086 +#: ../../library/collections.rst:1087 msgid ":class:`OrderedDict` objects" msgstr ":class:`OrderedDict` 物件" -#: ../../library/collections.rst:1088 +#: ../../library/collections.rst:1089 msgid "" "Ordered dictionaries are just like regular dictionaries but have some extra " "capabilities relating to ordering operations. They have become less " @@ -1720,11 +1726,11 @@ msgstr "" "功能,但由於內建的 :class:`dict` 類別現在已經有記憶插入順序的能力(Python " "3.7 中確保了這種新行為),它們變得不那麼重要了。" -#: ../../library/collections.rst:1094 +#: ../../library/collections.rst:1095 msgid "Some differences from :class:`dict` still remain:" msgstr "仍存在一些與 :class:`dict` 的不同之處:" -#: ../../library/collections.rst:1096 +#: ../../library/collections.rst:1097 msgid "" "The regular :class:`dict` was designed to be very good at mapping " "operations. Tracking insertion order was secondary." @@ -1732,7 +1738,7 @@ msgstr "" "常規的 :class:`dict` 被設計成非常擅長於對映相關操作,追蹤插入的順序為次要目" "標。" -#: ../../library/collections.rst:1099 +#: ../../library/collections.rst:1100 msgid "" "The :class:`OrderedDict` was designed to be good at reordering operations. " "Space efficiency, iteration speed, and the performance of update operations " @@ -1741,7 +1747,7 @@ msgstr "" ":class:`OrderedDict` 則被設計成擅長於重新排序相關的操作,空間效率、疊代速度和" "更新操作的效能則為次要設計目標。" -#: ../../library/collections.rst:1103 +#: ../../library/collections.rst:1104 msgid "" "The :class:`OrderedDict` algorithm can handle frequent reordering operations " "better than :class:`dict`. As shown in the recipes below, this makes it " @@ -1750,12 +1756,12 @@ msgstr "" ":class:`OrderedDict` 比起 :class:`dict` 更適合處理頻繁的重新排序操作,如在下" "方用法中所示,這讓它適合用於多種 LRU cache 的實作中。" -#: ../../library/collections.rst:1107 +#: ../../library/collections.rst:1108 msgid "" "The equality operation for :class:`OrderedDict` checks for matching order." msgstr ":class:`OrderedDict` 之相等性運算會檢查順序是否相同。" -#: ../../library/collections.rst:1109 +#: ../../library/collections.rst:1110 msgid "" "A regular :class:`dict` can emulate the order sensitive equality test with " "``p == q and all(k1 == k2 for k1, k2 in zip(p, q))``." @@ -1763,23 +1769,24 @@ msgstr "" "一個一般的 :class:`dict` 可以用 ``p == q and all(k1 == k2 for k1, k2 in " "zip(p, q))`` 來效仿有檢查順序的相等性運算。" -#: ../../library/collections.rst:1112 +#: ../../library/collections.rst:1113 msgid "" -"The :meth:`popitem` method of :class:`OrderedDict` has a different " -"signature. It accepts an optional argument to specify which item is popped." +"The :meth:`~OrderedDict.popitem` method of :class:`OrderedDict` has a " +"different signature. It accepts an optional argument to specify which item " +"is popped." msgstr "" -":class:`OrderedDict` 類別的 :meth:`popitem` 方法有不同的函式簽名 " -"(signature),它接受傳入一個選擇性引數來指定要移除哪個元素。" +":class:`OrderedDict` 類別的 :meth:`~OrderedDict.popitem` 方法有不同的函式簽" +"名 (signature),它接受傳入一個選擇性引數來指定要移除哪個元素。" -#: ../../library/collections.rst:1115 +#: ../../library/collections.rst:1116 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=True)`` " "with ``d.popitem()`` which is guaranteed to pop the rightmost (last) item." msgstr "" -"一個一般的 :class:`dict` 可以用 ``d.popitem()`` 來效仿 OrderedDict 的 ``od." -"popitem(last=True)``,這保證會移除最右邊(最後一個)的元素。" +"一個一般的 :class:`dict` 可以用 ``d.popitem()`` 來效仿 OrderedDict 的 " +"``od.popitem(last=True)``,這保證會移除最右邊(最後一個)的元素。" -#: ../../library/collections.rst:1118 +#: ../../library/collections.rst:1119 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=False)`` " "with ``(k := next(iter(d)), d.pop(k))`` which will return and remove the " @@ -1789,15 +1796,15 @@ msgstr "" "OrderedDict 的 ``od.popitem(last=False)``,若最左邊(第一個)的元素存在,則將" "其回傳並移除。" -#: ../../library/collections.rst:1122 +#: ../../library/collections.rst:1123 msgid "" -":class:`OrderedDict` has a :meth:`move_to_end` method to efficiently " -"reposition an element to an endpoint." +":class:`OrderedDict` has a :meth:`~OrderedDict.move_to_end` method to " +"efficiently reposition an element to an endpoint." msgstr "" -":class:`OrderedDict` 有個 :meth:`move_to_end` 方法可有效率地將一個元素重新排" -"列到任一端。" +":class:`OrderedDict` 有個 :meth:`~OrderedDict.move_to_end` 方法可有效率地將一" +"個元素重新排列到任一端。" -#: ../../library/collections.rst:1125 +#: ../../library/collections.rst:1126 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.move_to_end(k, " "last=True)`` with ``d[k] = d.pop(k)`` which will move the key and its " @@ -1807,7 +1814,7 @@ msgstr "" "``od.move_to_end(k, last=True)``,這會將該鍵與其對應到的值移動至最右(最後" "面)的位置。" -#: ../../library/collections.rst:1129 +#: ../../library/collections.rst:1130 msgid "" "A regular :class:`dict` does not have an efficient equivalent for " "OrderedDict's ``od.move_to_end(k, last=False)`` which moves the key and its " @@ -1817,18 +1824,20 @@ msgstr "" "last=False)`` 等價的有效方式,這是將鍵與其對應到的值移動至最左(最前面)位置" "的方法。" -#: ../../library/collections.rst:1133 -msgid "Until Python 3.8, :class:`dict` lacked a :meth:`__reversed__` method." -msgstr "在 Python 3.8 之前,:class:`dict` 並沒有 :meth:`__reversed__` 方法。" +#: ../../library/collections.rst:1134 +msgid "" +"Until Python 3.8, :class:`dict` lacked a :meth:`~object.__reversed__` method." +msgstr "" +"在 Python 3.8 之前,:class:`dict` 並沒有 :meth:`~object.__reversed__` 方法。" -#: ../../library/collections.rst:1138 +#: ../../library/collections.rst:1139 msgid "" "Return an instance of a :class:`dict` subclass that has methods specialized " "for rearranging dictionary order." msgstr "" "回傳一個 :class:`dict` 子類別的實例,它具有專門用於重新排列字典順序的方法。" -#: ../../library/collections.rst:1145 +#: ../../library/collections.rst:1146 msgid "" "The :meth:`popitem` method for ordered dictionaries returns and removes a " "(key, value) pair. The pairs are returned in :abbr:`LIFO (last-in, first-" @@ -1840,7 +1849,7 @@ msgstr "" "回傳鍵值對,否則就按 :abbr:`FIFO (first-in, first-out)` 先進先出的順序回傳鍵" "值對。" -#: ../../library/collections.rst:1152 +#: ../../library/collections.rst:1153 msgid "" "Move an existing *key* to either end of an ordered dictionary. The item is " "moved to the right end if *last* is true (the default) or to the beginning " @@ -1850,7 +1859,7 @@ msgstr "" "設值)則將元素移至右端;如果 *last* 為假值則將元素移至左端。如果 *key* 不存在" "則會引發 :exc:`KeyError`:" -#: ../../library/collections.rst:1157 +#: ../../library/collections.rst:1158 msgid "" ">>> d = OrderedDict.fromkeys('abcde')\n" ">>> d.move_to_end('b')\n" @@ -1868,7 +1877,7 @@ msgstr "" ">>> ''.join(d)\n" "'bacde'" -#: ../../library/collections.rst:1169 +#: ../../library/collections.rst:1170 msgid "" "In addition to the usual mapping methods, ordered dictionaries also support " "reverse iteration using :func:`reversed`." @@ -1876,7 +1885,7 @@ msgstr "" "除了普通的對映方法,ordered dictionary 還支援了透過 :func:`reversed` 來做倒序" "疊代。" -#: ../../library/collections.rst:1174 +#: ../../library/collections.rst:1175 msgid "" "Equality tests between :class:`OrderedDict` objects are order-sensitive and " "are roughly equivalent to ``list(od1.items())==list(od2.items())``." @@ -1884,38 +1893,39 @@ msgstr "" ":class:`OrderedDict` 物件之間的相等性運算是會檢查順序是否相同的,大致等價於 " "``list(od1.items())==list(od2.items())``。" -#: ../../library/collections.rst:1177 +#: ../../library/collections.rst:1178 msgid "" -"Equality tests between :class:`OrderedDict` objects and other :class:" -"`~collections.abc.Mapping` objects are order-insensitive like regular " -"dictionaries. This allows :class:`OrderedDict` objects to be substituted " -"anywhere a regular dictionary is used." +"Equality tests between :class:`OrderedDict` objects and " +"other :class:`~collections.abc.Mapping` objects are order-insensitive like " +"regular dictionaries. This allows :class:`OrderedDict` objects to be " +"substituted anywhere a regular dictionary is used." msgstr "" ":class:`OrderedDict` 物件和其他 :class:`~collections.abc.Mapping` 物件間的相" "等性運算則像普通字典一樣不考慮順序性,這使得 :class:`OrderedDict` 可於任何字" "典可使用的時機中被替換掉。" -#: ../../library/collections.rst:1182 +#: ../../library/collections.rst:1183 msgid "" -"The items, keys, and values :term:`views ` of :class:" -"`OrderedDict` now support reverse iteration using :func:`reversed`." +"The items, keys, and values :term:`views ` " +"of :class:`OrderedDict` now support reverse iteration using :func:`reversed`." msgstr "" ":class:`OrderedDict` 的項 (item)、鍵與值之\\ :term:`視圖 `\\ 現在可透過 :func:`reversed` 來倒序疊代。" -#: ../../library/collections.rst:1186 +#: ../../library/collections.rst:1187 msgid "" "With the acceptance of :pep:`468`, order is retained for keyword arguments " -"passed to the :class:`OrderedDict` constructor and its :meth:`update` method." +"passed to the :class:`OrderedDict` constructor and its :meth:`~dict.update` " +"method." msgstr "" -"隨著 :pep:`468` 被核可,被傳入給 :class:`OrderedDict` 建構函式與其 :meth:" -"`update` 方法的關鍵字引數之順序被保留了下來。" +"隨著 :pep:`468` 被核可,被傳入給 :class:`OrderedDict` 建構函式與" +"其 :meth:`~dict.update` 方法的關鍵字引數之順序被保留了下來。" -#: ../../library/collections.rst:1196 +#: ../../library/collections.rst:1197 msgid ":class:`OrderedDict` Examples and Recipes" msgstr ":class:`OrderedDict` 範例與用法" -#: ../../library/collections.rst:1198 +#: ../../library/collections.rst:1199 msgid "" "It is straightforward to create an ordered dictionary variant that remembers " "the order the keys were *last* inserted. If a new entry overwrites an " @@ -1925,7 +1935,7 @@ msgstr "" "建立一個能夠記住鍵\\ *最後*\\ 插入順序的 ordered dictionary 變體很簡單。如果" "新條目覆蓋了現有條目,則原本插入位置會被更改並移動至末端: ::" -#: ../../library/collections.rst:1203 +#: ../../library/collections.rst:1204 msgid "" "class LastUpdatedOrderedDict(OrderedDict):\n" " 'Store items in the order the keys were last added'\n" @@ -1935,15 +1945,15 @@ msgid "" " self.move_to_end(key)" msgstr "" -#: ../../library/collections.rst:1210 +#: ../../library/collections.rst:1211 msgid "" -"An :class:`OrderedDict` would also be useful for implementing variants of :" -"func:`functools.lru_cache`:" +"An :class:`OrderedDict` would also be useful for implementing variants " +"of :func:`functools.lru_cache`:" msgstr "" ":class:`OrderedDict` 在實現一個 :func:`functools.lru_cache` 的變形版本時也非" "常有用:" -#: ../../library/collections.rst:1213 +#: ../../library/collections.rst:1214 msgid "" "from collections import OrderedDict\n" "from time import time\n" @@ -1970,7 +1980,7 @@ msgid "" " return result" msgstr "" -#: ../../library/collections.rst:1240 +#: ../../library/collections.rst:1241 msgid "" "class MultiHitLRUCache:\n" " \"\"\" LRU cache that defers caching a result until\n" @@ -2008,50 +2018,51 @@ msgid "" " return result" msgstr "" -#: ../../library/collections.rst:1309 +#: ../../library/collections.rst:1310 msgid ":class:`UserDict` objects" msgstr ":class:`UserDict` 物件" -#: ../../library/collections.rst:1311 +#: ../../library/collections.rst:1312 msgid "" "The class, :class:`UserDict` acts as a wrapper around dictionary objects. " "The need for this class has been partially supplanted by the ability to " "subclass directly from :class:`dict`; however, this class can be easier to " "work with because the underlying dictionary is accessible as an attribute." msgstr "" -":class:`UserDict` 類別是作為 dict 物件的包裝器。因為已經可以直接自 :class:" -"`dict` 建立子類別,這個類別的需求已部分被滿足,不過這個類別使用起來更方便,因" -"為被包裝的字典可以作為其屬性來存取。" +":class:`UserDict` 類別是作為 dict 物件的包裝器。因為已經可以直接" +"自 :class:`dict` 建立子類別,這個類別的需求已部分被滿足,不過這個類別使用起來" +"更方便,因為被包裝的字典可以作為其屬性來存取。" -#: ../../library/collections.rst:1319 +#: ../../library/collections.rst:1320 msgid "" "Class that simulates a dictionary. The instance's contents are kept in a " -"regular dictionary, which is accessible via the :attr:`data` attribute of :" -"class:`UserDict` instances. If *initialdata* is provided, :attr:`data` is " -"initialized with its contents; note that a reference to *initialdata* will " -"not be kept, allowing it to be used for other purposes." +"regular dictionary, which is accessible via the :attr:`data` attribute " +"of :class:`UserDict` instances. If *initialdata* is provided, :attr:`data` " +"is initialized with its contents; note that a reference to *initialdata* " +"will not be kept, allowing it to be used for other purposes." msgstr "" -"模擬字典的類別。實例的內容被存於一個字典,可透過 :class:`UserDict` 的 :attr:" -"`data` 屬性來做存取。如果有提供 *initialdata*,:attr:`data` 屬性會被初始化為" -"其值;要注意指到 *initialdata* 的參照不會被保留,使其可被用於其他目的。" +"模擬字典的類別。實例的內容被存於一個字典,可透過 :class:`UserDict` " +"的 :attr:`data` 屬性來做存取。如果有提供 *initialdata*,:attr:`data` 屬性會被" +"初始化為其值;要注意指到 *initialdata* 的參照不會被保留,使其可被用於其他目" +"的。" -#: ../../library/collections.rst:1325 +#: ../../library/collections.rst:1326 msgid "" -"In addition to supporting the methods and operations of mappings, :class:" -"`UserDict` instances provide the following attribute:" +"In addition to supporting the methods and operations of " +"mappings, :class:`UserDict` instances provide the following attribute:" msgstr "" "除了支援作為對映所需的方法與操作,:class:`UserDict` 實例提供了以下屬性:" -#: ../../library/collections.rst:1330 +#: ../../library/collections.rst:1331 msgid "" "A real dictionary used to store the contents of the :class:`UserDict` class." msgstr "一個真實的字典,用於儲存 :class:`UserDict` 類別的資料內容。" -#: ../../library/collections.rst:1336 +#: ../../library/collections.rst:1337 msgid ":class:`UserList` objects" msgstr ":class:`UserList` 物件" -#: ../../library/collections.rst:1338 +#: ../../library/collections.rst:1339 msgid "" "This class acts as a wrapper around list objects. It is a useful base class " "for your own list-like classes which can inherit from them and override " @@ -2062,7 +2073,7 @@ msgstr "" "入新方法來定義你所需的一個類似於 list 的類別。如此一來,我們可以為 list 加入" "新的特性。" -#: ../../library/collections.rst:1343 +#: ../../library/collections.rst:1344 msgid "" "The need for this class has been partially supplanted by the ability to " "subclass directly from :class:`list`; however, this class can be easier to " @@ -2071,33 +2082,33 @@ msgstr "" "因為已經可以直接自 :class:`list` 建立子類別,這個類別的需求已部分被滿足,不過" "這個類別使用起來更方便,因為被包裝的 list 可以作為其屬性來存取。" -#: ../../library/collections.rst:1349 +#: ../../library/collections.rst:1350 msgid "" "Class that simulates a list. The instance's contents are kept in a regular " -"list, which is accessible via the :attr:`data` attribute of :class:" -"`UserList` instances. The instance's contents are initially set to a copy " -"of *list*, defaulting to the empty list ``[]``. *list* can be any iterable, " -"for example a real Python list or a :class:`UserList` object." -msgstr "" -"模擬 list 的類別。實例的內容被存於一個 list,可透過 :class:`UserList` 的 :" -"attr:`data` 屬性來做存取。實例內容被初始化為 *list* 的複製,預設為一個空的 " -"list ``[]``。*list* 可以是任何 iterable,例如一個真實的 Python list 或是一" +"list, which is accessible via the :attr:`data` attribute " +"of :class:`UserList` instances. The instance's contents are initially set " +"to a copy of *list*, defaulting to the empty list ``[]``. *list* can be any " +"iterable, for example a real Python list or a :class:`UserList` object." +msgstr "" +"模擬 list 的類別。實例的內容被存於一個 list,可透過 :class:`UserList` " +"的 :attr:`data` 屬性來做存取。實例內容被初始化為 *list* 的複製,預設為一個空" +"的 list ``[]``。*list* 可以是任何 iterable,例如一個真實的 Python list 或是一" "個 :class:`UserList` 物件。" -#: ../../library/collections.rst:1355 +#: ../../library/collections.rst:1356 msgid "" -"In addition to supporting the methods and operations of mutable sequences, :" -"class:`UserList` instances provide the following attribute:" +"In addition to supporting the methods and operations of mutable " +"sequences, :class:`UserList` instances provide the following attribute:" msgstr "除了支援可變序列的方法與操作,:class:`UserList` 實例提供了以下屬性:" -#: ../../library/collections.rst:1360 +#: ../../library/collections.rst:1361 msgid "" -"A real :class:`list` object used to store the contents of the :class:" -"`UserList` class." +"A real :class:`list` object used to store the contents of " +"the :class:`UserList` class." msgstr "" "一個真實的 :class:`list` 物件,用於儲存 :class:`UserList` 類別的資料內容。" -#: ../../library/collections.rst:1363 +#: ../../library/collections.rst:1364 msgid "" "**Subclassing requirements:** Subclasses of :class:`UserList` are expected " "to offer a constructor which can be called with either no arguments or one " @@ -2111,7 +2122,7 @@ msgstr "" "例,為了達成上述目的,它假設建構函式可傳入單一參數來呼叫,該參數即是做為數據" "來源的一個序列物件。" -#: ../../library/collections.rst:1370 +#: ../../library/collections.rst:1371 msgid "" "If a derived class does not wish to comply with this requirement, all of the " "special methods supported by this class will need to be overridden; please " @@ -2121,11 +2132,11 @@ msgstr "" "如果希望一個自此獲得的子類別不遵從上述要求,那所有該類別支援的特殊方法則必須" "被覆寫;請參考原始碼來理解在這情況下哪些方法是必須提供的。" -#: ../../library/collections.rst:1376 +#: ../../library/collections.rst:1377 msgid ":class:`UserString` objects" msgstr ":class:`UserString` 物件" -#: ../../library/collections.rst:1378 +#: ../../library/collections.rst:1379 msgid "" "The class, :class:`UserString` acts as a wrapper around string objects. The " "need for this class has been partially supplanted by the ability to subclass " @@ -2136,7 +2147,7 @@ msgstr "" "建立子類別,這個類別的需求已經部分被滿足,不過這個類別使用起來更方便,因為被" "包裝的字串可以作為其屬性來存取。" -#: ../../library/collections.rst:1386 +#: ../../library/collections.rst:1387 msgid "" "Class that simulates a string object. The instance's content is kept in a " "regular string object, which is accessible via the :attr:`data` attribute " @@ -2148,21 +2159,21 @@ msgstr "" "的 :attr:`data` 屬性來做存取。實例內容被初始化為 *seq* 的複製,*seq* 引數可以" "是任何可被內建函式 :func:`str` 轉換成字串的物件。" -#: ../../library/collections.rst:1393 +#: ../../library/collections.rst:1394 msgid "" -"In addition to supporting the methods and operations of strings, :class:" -"`UserString` instances provide the following attribute:" +"In addition to supporting the methods and operations of " +"strings, :class:`UserString` instances provide the following attribute:" msgstr "" "除了支援字串的方法和操作以外,:class:`UserString` 實例也提供了以下屬性:" -#: ../../library/collections.rst:1398 +#: ../../library/collections.rst:1399 msgid "" -"A real :class:`str` object used to store the contents of the :class:" -"`UserString` class." +"A real :class:`str` object used to store the contents of " +"the :class:`UserString` class." msgstr "" "一個真實的 :class:`str` 物件,用來儲存 :class:`UserString` 類別的資料內容。" -#: ../../library/collections.rst:1401 +#: ../../library/collections.rst:1402 msgid "" "New methods ``__getnewargs__``, ``__rmod__``, ``casefold``, ``format_map``, " "``isprintable``, and ``maketrans``." diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index 74a22d8a80..63fc65b3ab 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -41,10 +41,10 @@ msgstr "" #: ../../library/concurrent.futures.rst:17 msgid "" -"The asynchronous execution can be performed with threads, using :class:" -"`ThreadPoolExecutor`, or separate processes, using :class:" -"`ProcessPoolExecutor`. Both implement the same interface, which is defined " -"by the abstract :class:`Executor` class." +"The asynchronous execution can be performed with threads, " +"using :class:`ThreadPoolExecutor`, or separate processes, " +"using :class:`ProcessPoolExecutor`. Both implement the same interface, " +"which is defined by the abstract :class:`Executor` class." msgstr "" "非同步執行可以透過 :class:`ThreadPoolExecutor` 來使用執行緒 (thread) 執行,或" "透過 :class:`ProcessPoolExecutor` 來使用單獨行程 (process) 執行。兩者都實作了" @@ -81,9 +81,7 @@ msgid "" "callable. ::" msgstr "" "為可呼叫物件 *fn* 排程來以 ``fn(*args, **kwargs)`` 的形式執行並回傳一個表示可" -"呼叫的執行的 :class:`Future` 物件。\n" -"\n" -"::" +"呼叫的執行的 :class:`Future` 物件。 ::" #: ../../library/concurrent.futures.rst:38 msgid "" @@ -111,11 +109,11 @@ msgstr "*fn* 是非同步執行的,並且對 *fn* 的多次呼叫可以並行 #: ../../library/concurrent.futures.rst:51 msgid "" -"The returned iterator raises a :exc:`TimeoutError` if :meth:`~iterator." -"__next__` is called and the result isn't available after *timeout* seconds " -"from the original call to :meth:`Executor.map`. *timeout* can be an int or a " -"float. If *timeout* is not specified or ``None``, there is no limit to the " -"wait time." +"The returned iterator raises a :exc:`TimeoutError` " +"if :meth:`~iterator.__next__` is called and the result isn't available after " +"*timeout* seconds from the original call to :meth:`Executor.map`. *timeout* " +"can be an int or a float. If *timeout* is not specified or ``None``, there " +"is no limit to the wait time." msgstr "" "如果 :meth:`~iterator.__next__` 被呼叫,且在原先呼叫 :meth:`Executor.map` 的 " "*timeout* 秒後結果仍不可用,回傳的疊代器就會引發 :exc:`TimeoutError`。" @@ -140,8 +138,8 @@ msgstr "" "使用 :class:`ProcessPoolExecutor` 時,此方法將 *iterables* 分成許多分塊 " "(chunks),並將其作為獨立的任務來提交給池 (pool)。可以透過將 *chunksize* 設定" "為正整數來指定這些分塊的(約略)大小。對於非常長的可疊代物件,*chunksize* 使" -"用較大的值(與預設大小 1 相比)可以顯著提高性能。對於 :class:" -"`ThreadPoolExecutor`,*chunksize* 無效。" +"用較大的值(與預設大小 1 相比)可以顯著提高性能。對" +"於 :class:`ThreadPoolExecutor`,*chunksize* 無效。" #: ../../library/concurrent.futures.rst:68 msgid "Added the *chunksize* argument." @@ -150,13 +148,13 @@ msgstr "新增 *chunksize* 引數。" #: ../../library/concurrent.futures.rst:73 msgid "" "Signal the executor that it should free any resources that it is using when " -"the currently pending futures are done executing. Calls to :meth:`Executor." -"submit` and :meth:`Executor.map` made after shutdown will raise :exc:" -"`RuntimeError`." +"the currently pending futures are done executing. Calls " +"to :meth:`Executor.submit` and :meth:`Executor.map` made after shutdown will " +"raise :exc:`RuntimeError`." msgstr "" "向 executor 發出訊號 (signal),表明它應該在目前未定 (pending) 的 future 完成" -"執行時釋放它正在使用的任何資源。在關閉後呼叫 :meth:`Executor.submit` 和 :" -"meth:`Executor.map` 將引發 :exc:`RuntimeError`。" +"執行時釋放它正在使用的任何資源。在關閉後呼叫 :meth:`Executor.submit` " +"和 :meth:`Executor.map` 將引發 :exc:`RuntimeError`。" #: ../../library/concurrent.futures.rst:78 msgid "" @@ -195,9 +193,10 @@ msgstr "" #: ../../library/concurrent.futures.rst:95 msgid "" -"You can avoid having to call this method explicitly if you use the :keyword:" -"`with` statement, which will shutdown the :class:`Executor` (waiting as if :" -"meth:`Executor.shutdown` were called with *wait* set to ``True``)::" +"You can avoid having to call this method explicitly if you use " +"the :keyword:`with` statement, which will shutdown the :class:`Executor` " +"(waiting as if :meth:`Executor.shutdown` were called with *wait* set to " +"``True``)::" msgstr "" "如果使用 :keyword:`with` 陳述句,你就可以不用明確地呼叫此方法,這將會自己關" "閉 :class:`Executor`\\(如同呼叫 :meth:`Executor.shutdown` 時 *wait* 被設定" @@ -311,16 +310,16 @@ msgid "" msgstr "" "*initializer* 是一個可選的可呼叫物件,在每個工作執行緒開始時呼叫; " "*initargs* 是傳遞給 initializer 的引數元組 (tuple)。如果 *initializer* 引發例" -"外,所有目前未定的作業以及任何向池中提交 (submit) 更多作業的嘗試都將引發 :" -"exc:`~concurrent.futures.thread.BrokenThreadPool`。" +"外,所有目前未定的作業以及任何向池中提交 (submit) 更多作業的嘗試都將引" +"發 :exc:`~concurrent.futures.thread.BrokenThreadPool`。" #: ../../library/concurrent.futures.rst:166 msgid "" "If *max_workers* is ``None`` or not given, it will default to the number of " -"processors on the machine, multiplied by ``5``, assuming that :class:" -"`ThreadPoolExecutor` is often used to overlap I/O instead of CPU work and " -"the number of workers should be higher than the number of workers for :class:" -"`ProcessPoolExecutor`." +"processors on the machine, multiplied by ``5``, assuming " +"that :class:`ThreadPoolExecutor` is often used to overlap I/O instead of CPU " +"work and the number of workers should be higher than the number of workers " +"for :class:`ProcessPoolExecutor`." msgstr "" "如果 *max_workers* 為 ``None`` 或未給定,它將預設為機器上的處理器數量乘以 " "``5``,這假定了 :class:`ThreadPoolExecutor` 通常用於 I/O 重疊而非 CPU 密集的" @@ -329,9 +328,9 @@ msgstr "" #: ../../library/concurrent.futures.rst:174 msgid "" -"Added the *thread_name_prefix* parameter to allow users to control the :" -"class:`threading.Thread` names for worker threads created by the pool for " -"easier debugging." +"Added the *thread_name_prefix* parameter to allow users to control " +"the :class:`threading.Thread` names for worker threads created by the pool " +"for easier debugging." msgstr "" "新增 *thread_name_prefix* 參數以允許使用者控制由池所建立的工作執行緒 (worker " "thread) 的 :class:`threading.Thread` 名稱,以便於除錯。" @@ -362,8 +361,8 @@ msgstr "" #: ../../library/concurrent.futures.rst:191 msgid "" -"Default value of *max_workers* is changed to ``min(32, (os." -"process_cpu_count() or 1) + 4)``." +"Default value of *max_workers* is changed to ``min(32, " +"(os.process_cpu_count() or 1) + 4)``." msgstr "" #: ../../library/concurrent.futures.rst:199 @@ -408,15 +407,15 @@ msgstr "ProcessPoolExecutor" #: ../../library/concurrent.futures.rst:233 msgid "" "The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that " -"uses a pool of processes to execute calls asynchronously. :class:" -"`ProcessPoolExecutor` uses the :mod:`multiprocessing` module, which allows " -"it to side-step the :term:`Global Interpreter Lock ` but also means that only picklable objects can be executed and " -"returned." +"uses a pool of processes to execute calls " +"asynchronously. :class:`ProcessPoolExecutor` uses the :mod:`multiprocessing` " +"module, which allows it to side-step the :term:`Global Interpreter Lock " +"` but also means that only picklable objects can be " +"executed and returned." msgstr "" ":class:`ProcessPoolExecutor` 類別是一個 :class:`Executor` 的子類別,它使用行" -"程池來非同步地執行呼叫。:class:`ProcessPoolExecutor` 使用了 :mod:" -"`multiprocessing` 模組,這允許它避開\\ :term:`全域直譯器鎖 (Global " +"程池來非同步地執行呼叫。:class:`ProcessPoolExecutor` 使用" +"了 :mod:`multiprocessing` 模組,這允許它避開\\ :term:`全域直譯器鎖 (Global " "Interpreter Lock) `,但也意味著只能執行和回傳可被 " "pickle 的 (picklable) 物件。" @@ -426,9 +425,9 @@ msgid "" "means that :class:`ProcessPoolExecutor` will not work in the interactive " "interpreter." msgstr "" -"``__main__`` 模組必須可以被工作子行程 (worker subprocess) 引入。這意味著 :" -"class:`ProcessPoolExecutor` 將無法在交互式直譯器 (interactive interpreter) 中" -"工作。" +"``__main__`` 模組必須可以被工作子行程 (worker subprocess) 引入。這意味" +"著 :class:`ProcessPoolExecutor` 將無法在交互式直譯器 (interactive " +"interpreter) 中工作。" #: ../../library/concurrent.futures.rst:243 msgid "" @@ -439,7 +438,6 @@ msgstr "" "或 :class:`Future` 方法將導致死鎖。" #: ../../library/concurrent.futures.rst:248 -#, fuzzy msgid "" "An :class:`Executor` subclass that executes calls asynchronously using a " "pool of at most *max_workers* processes. If *max_workers* is ``None`` or " @@ -450,18 +448,18 @@ msgid "" "the default chosen will be at most ``61``, even if more processors are " "available. *mp_context* can be a :mod:`multiprocessing` context or ``None``. " "It will be used to launch the workers. If *mp_context* is ``None`` or not " -"given, the default :mod:`multiprocessing` context is used. See :ref:" -"`multiprocessing-start-methods`." +"given, the default :mod:`multiprocessing` context is used. " +"See :ref:`multiprocessing-start-methods`." msgstr "" "一個 :class:`Executor` 子類別,它使用了最多有 *max_workers* 個行程的池來非同" -"步地執行呼叫。如果 *max_workers* 為 ``None`` 或未給定,它將被預設為機器上的處" -"理器數量。如果 *max_workers* 小於或等於 ``0``,則會引發 :exc:`ValueError`。" -"在 Windows 上,*max_workers* 必須小於或等於 ``61``。如果不是,則會引發 :exc:" -"`ValueError`。如果 *max_workers* 為 ``None``,則預設選擇最多為 ``61``,即便有" -"更多處理器可用。*mp_context* 可以是 :mod:`multiprocessing` 情境 (context) 或 " -"``None``。它將用於啟動 worker。如果 *mp_context* 為 ``None`` 或未給定,則使用" -"預設的 :mod:`multiprocessing` 情境。請見 :ref:`multiprocessing-start-" -"methods`。" +"步地執行呼叫。如果 *max_workers* 為 ``None`` 或未給定,它將被預設" +"為 :func:`os.process_cpu_count`。如果 *max_workers* 小於或等於 ``0``,則會引" +"發 :exc:`ValueError`。在 Windows 上,*max_workers* 必須小於或等於 ``61``。如" +"果不是,則會引發 :exc:`ValueError`。如果 *max_workers* 為 ``None``,則預設選" +"擇最多為 ``61``,即便有更多處理器可用。*mp_context* 可以" +"是 :mod:`multiprocessing` 情境 (context) 或 ``None``。它將用於啟動 worker。如" +"果 *mp_context* 為 ``None`` 或未給定,則使用預設的 :mod:`multiprocessing` 情" +"境。請見 :ref:`multiprocessing-start-methods`。" #: ../../library/concurrent.futures.rst:262 msgid "" @@ -473,8 +471,8 @@ msgid "" msgstr "" "*initializer* 是一個可選的可呼叫物件,在每個工作行程 (worker process) 開始時" "呼叫;*initargs* 是傳遞給 initializer 的引數元組。如果 *initializer* 引發例" -"外,所有目前未定的作業以及任何向池中提交更多作業的嘗試都將引發 :exc:" -"`~concurrent.futures.process.BrokenProcessPool`。" +"外,所有目前未定的作業以及任何向池中提交更多作業的嘗試都將引" +"發 :exc:`~concurrent.futures.process.BrokenProcessPool`。" #: ../../library/concurrent.futures.rst:268 msgid "" @@ -494,14 +492,15 @@ msgstr "" #: ../../library/concurrent.futures.rst:276 msgid "" -"When one of the worker processes terminates abruptly, a :exc:`~concurrent." -"futures.process.BrokenProcessPool` error is now raised. Previously, " -"behaviour was undefined but operations on the executor or its futures would " -"often freeze or deadlock." +"When one of the worker processes terminates abruptly, " +"a :exc:`~concurrent.futures.process.BrokenProcessPool` error is now raised. " +"Previously, behaviour was undefined but operations on the executor or its " +"futures would often freeze or deadlock." msgstr "" -"當其中一個工作行程突然終止時,現在會引發 :exc:`~concurrent.futures.process." -"BrokenProcessPool` 錯誤。在過去,此行為是未定義的 (undefined),但對 executor " -"或其 future 的操作經常會發生凍結或死鎖。" +"當其中一個工作行程突然終止時,現在會引" +"發 :exc:`~concurrent.futures.process.BrokenProcessPool` 錯誤。在過去,此行為" +"是未定義的 (undefined),但對 executor 或其 future 的操作經常會發生凍結或死" +"鎖。" #: ../../library/concurrent.futures.rst:283 msgid "" @@ -515,13 +514,13 @@ msgid "" "The default :mod:`multiprocessing` start method (see :ref:`multiprocessing-" "start-methods`) will change away from *fork* in Python 3.14. Code that " "requires *fork* be used for their :class:`ProcessPoolExecutor` should " -"explicitly specify that by passing a ``mp_context=multiprocessing." -"get_context(\"fork\")`` parameter." +"explicitly specify that by passing a " +"``mp_context=multiprocessing.get_context(\"fork\")`` parameter." msgstr "" "預設的 :mod:`multiprocessing` 啟動方法(請參閱 :ref:`multiprocessing-start-" -"methods`\\ )將不再是 Python 3.14 中的 *fork*。需要 *fork* 用於其 :class:" -"`ProcessPoolExecutor` 的程式碼應透過傳遞 ``mp_context=multiprocessing." -"get_context(\"fork\")`` 參數來明確指定。" +"methods`\\ )將不再是 Python 3.14 中的 *fork*。需要 *fork* 用於" +"其 :class:`ProcessPoolExecutor` 的程式碼應透過傳遞 " +"``mp_context=multiprocessing.get_context(\"fork\")`` 參數來明確指定。" #: ../../library/concurrent.futures.rst:297 msgid "" @@ -532,11 +531,12 @@ msgstr "" #: ../../library/concurrent.futures.rst:301 msgid "" -"On POSIX systems, if your application has multiple threads and the :mod:" -"`multiprocessing` context uses the ``\"fork\"`` start method: The :func:`os." -"fork` function called internally to spawn workers may raise a :exc:" -"`DeprecationWarning`. Pass a *mp_context* configured to use a different " -"start method. See the :func:`os.fork` documentation for further explanation." +"On POSIX systems, if your application has multiple threads and " +"the :mod:`multiprocessing` context uses the ``\"fork\"`` start method: " +"The :func:`os.fork` function called internally to spawn workers may raise " +"a :exc:`DeprecationWarning`. Pass a *mp_context* configured to use a " +"different start method. See the :func:`os.fork` documentation for further " +"explanation." msgstr "" "在 POSIX 系統上,如果你的應用程式有多個執行緒並且 :mod:`multiprocessing` 情境" "使用了 ``\"fork\"`` 啟動方法:內部呼叫以產生 worker 的 :func:`os.fork` 函式可" @@ -545,8 +545,8 @@ msgstr "" #: ../../library/concurrent.futures.rst:309 msgid "" -"*max_workers* uses :func:`os.process_cpu_count` by default, instead of :func:" -"`os.cpu_count`." +"*max_workers* uses :func:`os.process_cpu_count` by default, instead " +"of :func:`os.cpu_count`." msgstr "" #: ../../library/concurrent.futures.rst:316 @@ -630,8 +630,8 @@ msgid "" "The :class:`Future` class encapsulates the asynchronous execution of a " "callable. :class:`Future` instances are created by :meth:`Executor.submit`." msgstr "" -":class:`Future` 類別封裝了可呼叫物件的非同步執行。:class:`Future` 實例由 :" -"meth:`Executor.submit` 建立。" +":class:`Future` 類別封裝了可呼叫物件的非同步執行。:class:`Future` 實例" +"由 :meth:`Executor.submit` 建立。" #: ../../library/concurrent.futures.rst:361 msgid "" @@ -736,8 +736,8 @@ msgstr "如果 future 已經完成或被取消,*fn* 將立即被呼叫。" #: ../../library/concurrent.futures.rst:429 msgid "" -"The following :class:`Future` methods are meant for use in unit tests and :" -"class:`Executor` implementations." +"The following :class:`Future` methods are meant for use in unit tests " +"and :class:`Executor` implementations." msgstr "以下 :class:`Future` 方法旨在用於單元測試和 :class:`Executor` 實作。" #: ../../library/concurrent.futures.rst:434 @@ -751,14 +751,14 @@ msgstr "" #: ../../library/concurrent.futures.rst:438 msgid "" -"If the method returns ``False`` then the :class:`Future` was cancelled, i." -"e. :meth:`Future.cancel` was called and returned ``True``. Any threads " +"If the method returns ``False`` then the :class:`Future` was cancelled, " +"i.e. :meth:`Future.cancel` was called and returned ``True``. Any threads " "waiting on the :class:`Future` completing (i.e. through :func:`as_completed` " "or :func:`wait`) will be woken up." msgstr "" -"如果該方法回傳 ``False`` 則 :class:`Future` 已被取消,即 :meth:`Future." -"cancel` 被呼叫並回傳 ``True``。任何等待 :class:`Future` 完成的執行緒(即透" -"過 :func:`as_completed` 或 :func:`wait`)將被喚醒。" +"如果該方法回傳 ``False`` 則 :class:`Future` 已被取消," +"即 :meth:`Future.cancel` 被呼叫並回傳 ``True``。任何等待 :class:`Future` 完成" +"的執行緒(即透過 :func:`as_completed` 或 :func:`wait`)將被喚醒。" #: ../../library/concurrent.futures.rst:443 msgid "" @@ -771,11 +771,12 @@ msgstr "" #: ../../library/concurrent.futures.rst:447 msgid "" -"This method can only be called once and cannot be called after :meth:`Future." -"set_result` or :meth:`Future.set_exception` have been called." +"This method can only be called once and cannot be called " +"after :meth:`Future.set_result` or :meth:`Future.set_exception` have been " +"called." msgstr "" -"此方法只能呼叫一次,且不能在呼叫 :meth:`Future.set_result` 或 :meth:`Future." -"set_exception` 之後呼叫。" +"此方法只能呼叫一次,且不能在呼叫 :meth:`Future.set_result` " +"或 :meth:`Future.set_exception` 之後呼叫。" #: ../../library/concurrent.futures.rst:453 msgid "" @@ -792,16 +793,16 @@ msgstr "此方法只能在 :class:`Executor` 實作中和單元測試中使用 #: ../../library/concurrent.futures.rst:459 #: ../../library/concurrent.futures.rst:472 msgid "" -"This method raises :exc:`concurrent.futures.InvalidStateError` if the :class:" -"`Future` is already done." +"This method raises :exc:`concurrent.futures.InvalidStateError` if " +"the :class:`Future` is already done." msgstr "" -"如果 :class:`Future` 已經完成,此方法會引發 :exc:`concurrent.futures." -"InvalidStateError`。" +"如果 :class:`Future` 已經完成,此方法會引" +"發 :exc:`concurrent.futures.InvalidStateError`。" #: ../../library/concurrent.futures.rst:466 msgid "" -"Sets the result of the work associated with the :class:`Future` to the :" -"class:`Exception` *exception*." +"Sets the result of the work associated with the :class:`Future` to " +"the :class:`Exception` *exception*." msgstr "" "將與 :class:`Future` 關聯的工作結果設定為 :class:`Exception` *exception*。" @@ -811,13 +812,13 @@ msgstr "模組函式" #: ../../library/concurrent.futures.rst:482 msgid "" -"Wait for the :class:`Future` instances (possibly created by different :class:" -"`Executor` instances) given by *fs* to complete. Duplicate futures given to " -"*fs* are removed and will be returned only once. Returns a named 2-tuple of " -"sets. The first set, named ``done``, contains the futures that completed " -"(finished or cancelled futures) before the wait completed. The second set, " -"named ``not_done``, contains the futures that did not complete (pending or " -"running futures)." +"Wait for the :class:`Future` instances (possibly created by " +"different :class:`Executor` instances) given by *fs* to complete. Duplicate " +"futures given to *fs* are removed and will be returned only once. Returns a " +"named 2-tuple of sets. The first set, named ``done``, contains the futures " +"that completed (finished or cancelled futures) before the wait completed. " +"The second set, named ``not_done``, contains the futures that did not " +"complete (pending or running futures)." msgstr "" "等待 *fs* 給定的 :class:`Future` 實例(可能由不同的 :class:`Executor` 實例建" "立)完成。提供給 *fs* 的重複 future 將被刪除,並且只會回傳一次。回傳一個集合" @@ -855,8 +856,8 @@ msgstr "當任何 future 完成或被取消時,該函式就會回傳。" #: ../../library/concurrent.futures.rst:507 msgid "" "The function will return when any future finishes by raising an exception. " -"If no future raises an exception then it is equivalent to :const:" -"`ALL_COMPLETED`." +"If no future raises an exception then it is equivalent " +"to :const:`ALL_COMPLETED`." msgstr "" "該函式會在任何 future 透過引發例外而完結時回傳。如果 future 沒有引發例外,那" "麼它等同於 :const:`ALL_COMPLETED`。" @@ -880,10 +881,10 @@ msgstr "" "回傳由 *fs* 給定的 :class:`Future` 實例(可能由不同的 :class:`Executor` 實例" "建立)的疊代器,它在完成時產生 future(已完成或被取消的 future)。*fs* 給定的" "任何重複的 future 將只被回傳一次。呼叫 :func:`as_completed` 之前完成的任何 " -"future 將首先產生。如果 :meth:`~iterator.__next__` 被呼叫,並且在原先呼叫 :" -"func:`as_completed` 的 *timeout* 秒後結果仍不可用,則回傳的疊代器會引發 :exc:" -"`TimeoutError`。*timeout* 可以是整數或浮點數。如果未指定 *timeout* 或為 " -"``None``,則等待時間就沒有限制。" +"future 將首先產生。如果 :meth:`~iterator.__next__` 被呼叫,並且在原先呼" +"叫 :func:`as_completed` 的 *timeout* 秒後結果仍不可用,則回傳的疊代器會引" +"發 :exc:`TimeoutError`。*timeout* 可以是整數或浮點數。如果未指定 *timeout* 或" +"為 ``None``,則等待時間就沒有限制。" #: ../../library/concurrent.futures.rst:529 msgid ":pep:`3148` -- futures - execute computations asynchronously" @@ -932,20 +933,22 @@ msgstr "目前狀態下不允許的 future 操作被執行時而引發。" #: ../../library/concurrent.futures.rst:572 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor`, this exception class " -"is raised when one of the workers of a :class:`~concurrent.futures." -"ThreadPoolExecutor` has failed initializing." +"is raised when one of the workers of " +"a :class:`~concurrent.futures.ThreadPoolExecutor` has failed initializing." msgstr "" -"衍生自 :exc:`~concurrent.futures.BrokenExecutor`,當 :class:`~concurrent." -"futures.ThreadPoolExecutor` 的其中一個 worker 初始化失敗時會引發此例外類別。" +"衍生自 :exc:`~concurrent.futures.BrokenExecutor`," +"當 :class:`~concurrent.futures.ThreadPoolExecutor` 的其中一個 worker 初始化失" +"敗時會引發此例外類別。" #: ../../library/concurrent.futures.rst:583 msgid "" -"Derived from :exc:`~concurrent.futures.BrokenExecutor` (formerly :exc:" -"`RuntimeError`), this exception class is raised when one of the workers of " -"a :class:`~concurrent.futures.ProcessPoolExecutor` has terminated in a non-" -"clean fashion (for example, if it was killed from the outside)." +"Derived from :exc:`~concurrent.futures.BrokenExecutor` " +"(formerly :exc:`RuntimeError`), this exception class is raised when one of " +"the workers of a :class:`~concurrent.futures.ProcessPoolExecutor` has " +"terminated in a non-clean fashion (for example, if it was killed from the " +"outside)." msgstr "" -"衍生自 :exc:`~concurrent.futures.BrokenExecutor`\\(以前為 :exc:" -"`RuntimeError`),當 :class:`~concurrent.futures.ProcessPoolExecutor` 的其中" -"一個 worker 以不乾淨的方式終止時將引發此例外類別(例如它是從外面被 kill 掉" -"的)。" +"衍生自 :exc:`~concurrent.futures.BrokenExecutor`\\(以前" +"為 :exc:`RuntimeError`)," +"當 :class:`~concurrent.futures.ProcessPoolExecutor` 的其中一個 worker 以不乾" +"淨的方式終止時將引發此例外類別(例如它是從外面被 kill 掉的)。" diff --git a/library/configparser.po b/library/configparser.po index 1cf79e0a29..4b3a98b31e 100644 --- a/library/configparser.po +++ b/library/configparser.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-06 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -183,7 +183,7 @@ msgid "" "'no'\n" ">>> topsecret['Port']\n" "'50022'\n" -">>> for key in config['forge.example']: \n" +">>> for key in config['forge.example']:\n" "... print(key)\n" "user\n" "compressionlevel\n" @@ -213,7 +213,7 @@ msgstr "" "'no'\n" ">>> topsecret['Port']\n" "'50022'\n" -">>> for key in config['forge.example']: \n" +">>> for key in config['forge.example']:\n" "... print(key)\n" "user\n" "compressionlevel\n" @@ -233,12 +233,12 @@ msgstr "" #: ../../library/configparser.rst:148 ../../library/configparser.rst:1003 msgid "" -"It is possible to read several configurations into a single :class:" -"`ConfigParser`, where the most recently added configuration has the highest " -"priority. Any conflicting keys are taken from the more recent configuration " -"while the previously existing keys are retained. The example below reads in " -"an ``override.ini`` file, which will override any conflicting keys from the " -"``example.ini`` file." +"It is possible to read several configurations into a " +"single :class:`ConfigParser`, where the most recently added configuration " +"has the highest priority. Any conflicting keys are taken from the more " +"recent configuration while the previously existing keys are retained. The " +"example below reads in an ``override.ini`` file, which will override any " +"conflicting keys from the ``example.ini`` file." msgstr "" #: ../../library/configparser.rst:155 ../../library/configparser.rst:1010 @@ -384,10 +384,10 @@ msgstr "" #: ../../library/configparser.rst:241 msgid "" -"One more thing to be aware of is that the parser-level :meth:`~ConfigParser." -"get` method provides a custom, more complex interface, maintained for " -"backwards compatibility. When using this method, a fallback value can be " -"provided via the ``fallback`` keyword-only argument:" +"One more thing to be aware of is that the parser-" +"level :meth:`~ConfigParser.get` method provides a custom, more complex " +"interface, maintained for backwards compatibility. When using this method, " +"a fallback value can be provided via the ``fallback`` keyword-only argument:" msgstr "" #: ../../library/configparser.rst:246 @@ -399,9 +399,9 @@ msgstr "" #: ../../library/configparser.rst:252 msgid "" -"The same ``fallback`` argument can be used with the :meth:`~ConfigParser." -"getint`, :meth:`~ConfigParser.getfloat` and :meth:`~ConfigParser.getboolean` " -"methods, for example:" +"The same ``fallback`` argument can be used with " +"the :meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat` " +"and :meth:`~ConfigParser.getboolean` methods, for example:" msgstr "" #: ../../library/configparser.rst:256 @@ -587,8 +587,8 @@ msgstr "" #: ../../library/configparser.rst:396 msgid "" -"With ``interpolation`` set to ``None``, the parser would simply return " -"``%(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/" +"With ``interpolation`` set to ``None``, the parser would simply return ``%" +"(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/" "lumberjack`` as the value of ``my_dir``." msgstr "" @@ -597,9 +597,9 @@ msgid "" "An alternative handler for interpolation which implements a more advanced " "syntax, used for instance in ``zc.buildout``. Extended interpolation is " "using ``${section:option}`` to denote a value from a foreign section. " -"Interpolation can span multiple levels. For convenience, if the ``section:" -"`` part is omitted, interpolation defaults to the current section (and " -"possibly the default values from the special section)." +"Interpolation can span multiple levels. For convenience, if the " +"``section:`` part is omitted, interpolation defaults to the current section " +"(and possibly the default values from the special section)." msgstr "" #: ../../library/configparser.rst:411 @@ -668,8 +668,8 @@ msgstr "" #: ../../library/configparser.rst:451 msgid "" "Mapping protocol access is a generic name for functionality that enables " -"using custom objects as if they were dictionaries. In case of :mod:" -"`configparser`, the mapping interface implementation is using the " +"using custom objects as if they were dictionaries. In case " +"of :mod:`configparser`, the mapping interface implementation is using the " "``parser['section']['option']`` notation." msgstr "" @@ -685,9 +685,9 @@ msgstr "" #: ../../library/configparser.rst:462 msgid "" ":mod:`configparser` objects behave as close to actual dictionaries as " -"possible. The mapping interface is complete and adheres to the :class:" -"`~collections.abc.MutableMapping` ABC. However, there are a few differences " -"that should be taken into account:" +"possible. The mapping interface is complete and adheres to " +"the :class:`~collections.abc.MutableMapping` ABC. However, there are a few " +"differences that should be taken into account:" msgstr "" #: ../../library/configparser.rst:467 @@ -709,8 +709,8 @@ msgstr "" #: ../../library/configparser.rst:475 msgid "" -"All sections include ``DEFAULTSECT`` values as well which means that ``." -"clear()`` on a section may not leave the section visibly empty. This is " +"All sections include ``DEFAULTSECT`` values as well which means that " +"``.clear()`` on a section may not leave the section visibly empty. This is " "because default values cannot be deleted from the section (because " "technically they are not there). If they are overridden in the section, " "deleting causes the default value to be visible again. Trying to delete a " @@ -744,10 +744,10 @@ msgstr "" msgid "" "``parser.items()`` is compatible with the mapping protocol (returns a list " "of *section_name*, *section_proxy* pairs including the DEFAULTSECT). " -"However, this method can also be invoked with arguments: ``parser." -"items(section, raw, vars)``. The latter call returns a list of *option*, " -"*value* pairs for a specified ``section``, with all interpolations expanded " -"(unless ``raw=True`` is provided)." +"However, this method can also be invoked with arguments: " +"``parser.items(section, raw, vars)``. The latter call returns a list of " +"*option*, *value* pairs for a specified ``section``, with all interpolations " +"expanded (unless ``raw=True`` is provided)." msgstr "" #: ../../library/configparser.rst:501 @@ -790,8 +790,8 @@ msgstr "" #: ../../library/configparser.rst:525 msgid "" -"Hint: if you want to specify default values for a specific section, use :" -"meth:`~ConfigParser.read_dict` before you read the actual file." +"Hint: if you want to specify default values for a specific section, " +"use :meth:`~ConfigParser.read_dict` before you read the actual file." msgstr "" #: ../../library/configparser.rst:528 @@ -909,8 +909,8 @@ msgstr "" #: ../../library/configparser.rst:603 msgid "" -"See also the *space_around_delimiters* argument to :meth:`ConfigParser." -"write`." +"See also the *space_around_delimiters* argument " +"to :meth:`ConfigParser.write`." msgstr "" #: ../../library/configparser.rst:606 @@ -996,9 +996,10 @@ msgstr "" #: ../../library/configparser.rst:669 msgid "" "When set to ``True``, the parser will not allow for any section or option " -"duplicates while reading from a single source (using :meth:`~ConfigParser." -"read_file`, :meth:`~ConfigParser.read_string` or :meth:`~ConfigParser." -"read_dict`). It is recommended to use strict parsers in new applications." +"duplicates while reading from a single source " +"(using :meth:`~ConfigParser.read_file`, :meth:`~ConfigParser.read_string` " +"or :meth:`~ConfigParser.read_dict`). It is recommended to use strict " +"parsers in new applications." msgstr "" #: ../../library/configparser.rst:674 @@ -1054,9 +1055,9 @@ msgid "" "other valid section name. Some typical values include: ``\"general\"`` or " "``\"common\"``. The name provided is used for recognizing default sections " "when reading from any source and is used when writing configuration back to " -"a file. Its current value can be retrieved using the ``parser_instance." -"default_section`` attribute and may be modified at runtime (i.e. to convert " -"files from one format to another)." +"a file. Its current value can be retrieved using the " +"``parser_instance.default_section`` attribute and may be modified at runtime " +"(i.e. to convert files from one format to another)." msgstr "" #: ../../library/configparser.rst:715 @@ -1069,8 +1070,8 @@ msgid "" "through the *interpolation* argument. ``None`` can be used to turn off " "interpolation completely, ``ExtendedInterpolation()`` provides a more " "advanced variant inspired by ``zc.buildout``. More on the subject in the " -"`dedicated documentation section <#interpolation-of-values>`_. :class:" -"`RawConfigParser` has a default value of ``None``." +"`dedicated documentation section <#interpolation-of-" +"values>`_. :class:`RawConfigParser` has a default value of ``None``." msgstr "" #: ../../library/configparser.rst:724 @@ -1084,9 +1085,9 @@ msgid "" "and :meth:`~ConfigParser.getboolean` are implemented. Should other getters " "be desirable, users may define them in a subclass or pass a dictionary where " "each key is a name of the converter and each value is a callable " -"implementing said conversion. For instance, passing ``{'decimal': decimal." -"Decimal}`` would add :meth:`!getdecimal` on both the parser object and all " -"section proxies. In other words, it will be possible to write both " +"implementing said conversion. For instance, passing ``{'decimal': " +"decimal.Decimal}`` would add :meth:`!getdecimal` on both the parser object " +"and all section proxies. In other words, it will be possible to write both " "``parser_instance.getdecimal('section', 'key', fallback=0)`` and " "``parser_instance['section'].getdecimal('key', 0)``." msgstr "" @@ -1404,13 +1405,13 @@ msgstr "" msgid "" "When *strict* is ``True`` (the default), the parser won't allow for any " "section or option duplicates while reading from a single source (file, " -"string or dictionary), raising :exc:`DuplicateSectionError` or :exc:" -"`DuplicateOptionError`. When *empty_lines_in_values* is ``False`` (default: " -"``True``), each empty line marks the end of an option. Otherwise, internal " -"empty lines of a multiline option are kept as part of the value. When " -"*allow_no_value* is ``True`` (default: ``False``), options without values " -"are accepted; the value held for these is ``None`` and they are serialized " -"without the trailing delimiter." +"string or dictionary), raising :exc:`DuplicateSectionError` " +"or :exc:`DuplicateOptionError`. When *empty_lines_in_values* is ``False`` " +"(default: ``True``), each empty line marks the end of an option. Otherwise, " +"internal empty lines of a multiline option are kept as part of the value. " +"When *allow_no_value* is ``True`` (default: ``False``), options without " +"values are accepted; the value held for these is ``None`` and they are " +"serialized without the trailing delimiter." msgstr "" #: ../../library/configparser.rst:974 @@ -1434,11 +1435,11 @@ msgstr "" #: ../../library/configparser.rst:987 msgid "" -"All option names used in interpolation will be passed through the :meth:" -"`optionxform` method just like any other option name reference. For " -"example, using the default implementation of :meth:`optionxform` (which " -"converts option names to lower case), the values ``foo %(bar)s`` and ``foo " -"%(BAR)s`` are equivalent." +"All option names used in interpolation will be passed through " +"the :meth:`optionxform` method just like any other option name reference. " +"For example, using the default implementation of :meth:`optionxform` (which " +"converts option names to lower case), the values ``foo %(bar)s`` and ``foo %" +"(BAR)s`` are equivalent." msgstr "" #: ../../library/configparser.rst:993 @@ -1528,9 +1529,9 @@ msgstr "" #: ../../library/configparser.rst:1090 msgid "" -"If the given *section* exists, and contains the given *option*, return :" -"const:`True`; otherwise return :const:`False`. If the specified *section* " -"is :const:`None` or an empty string, DEFAULT is assumed." +"If the given *section* exists, and contains the given *option*, " +"return :const:`True`; otherwise return :const:`False`. If the specified " +"*section* is :const:`None` or an empty string, DEFAULT is assumed." msgstr "" #: ../../library/configparser.rst:1097 @@ -1554,8 +1555,8 @@ msgstr "" msgid "" "If none of the named files exist, the :class:`ConfigParser` instance will " "contain an empty dataset. An application which requires initial values to " -"be loaded from a file should load the required file or files using :meth:" -"`read_file` before calling :meth:`read` for any optional files::" +"be loaded from a file should load the required file or files " +"using :meth:`read_file` before calling :meth:`read` for any optional files::" msgstr "" #: ../../library/configparser.rst:1115 @@ -1679,9 +1680,9 @@ msgid "" "``'1'``, ``'yes'``, ``'true'``, and ``'on'``, which cause this method to " "return ``True``, and ``'0'``, ``'no'``, ``'false'``, and ``'off'``, which " "cause it to return ``False``. These string values are checked in a case-" -"insensitive manner. Any other value will cause it to raise :exc:" -"`ValueError`. See :meth:`get` for explanation of *raw*, *vars* and " -"*fallback*." +"insensitive manner. Any other value will cause it to " +"raise :exc:`ValueError`. See :meth:`get` for explanation of *raw*, *vars* " +"and *fallback*." msgstr "" #: ../../library/configparser.rst:1219 @@ -1693,8 +1694,8 @@ msgstr "" #: ../../library/configparser.rst:1222 msgid "" "Otherwise, return a list of *name*, *value* pairs for the options in the " -"given *section*. Optional arguments have the same meaning as for the :meth:" -"`get` method." +"given *section*. Optional arguments have the same meaning as for " +"the :meth:`get` method." msgstr "" #: ../../library/configparser.rst:1226 @@ -1779,9 +1780,9 @@ msgstr "" #: ../../library/configparser.rst:1296 msgid "" -"The maximum depth for recursive interpolation for :meth:`~configparser." -"ConfigParser.get` when the *raw* parameter is false. This is relevant only " -"when the default *interpolation* is used." +"The maximum depth for recursive interpolation " +"for :meth:`~configparser.ConfigParser.get` when the *raw* parameter is " +"false. This is relevant only when the default *interpolation* is used." msgstr "" #: ../../library/configparser.rst:1304 @@ -1819,9 +1820,9 @@ msgstr "" #: ../../library/configparser.rst:1353 msgid "" "If the given section exists, set the given option to the specified value; " -"otherwise raise :exc:`NoSectionError`. While it is possible to use :class:" -"`RawConfigParser` (or :class:`ConfigParser` with *raw* parameters set to " -"true) for *internal* storage of non-string values, full functionality " +"otherwise raise :exc:`NoSectionError`. While it is possible to " +"use :class:`RawConfigParser` (or :class:`ConfigParser` with *raw* parameters " +"set to true) for *internal* storage of non-string values, full functionality " "(including interpolation and output to files) can only be achieved using " "string values." msgstr "" @@ -1855,8 +1856,8 @@ msgstr "" #: ../../library/configparser.rst:1385 msgid "" -"Added the optional *source* and *lineno* attributes and parameters to :meth:" -"`!__init__`." +"Added the optional *source* and *lineno* attributes and parameters " +"to :meth:`!__init__`." msgstr "" #: ../../library/configparser.rst:1392 @@ -1882,8 +1883,8 @@ msgstr "" #: ../../library/configparser.rst:1412 msgid "" "Exception raised when string interpolation cannot be completed because the " -"number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass of :" -"exc:`InterpolationError`." +"number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass " +"of :exc:`InterpolationError`." msgstr "" #: ../../library/configparser.rst:1419 @@ -1922,7 +1923,7 @@ msgstr "" #: ../../library/configparser.rst:1451 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" #: ../../library/configparser.rst:1452 msgid "" diff --git a/library/constants.po b/library/constants.po index 9fd1624475..2650c50799 100644 --- a/library/constants.po +++ b/library/constants.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2025-03-04 00:14+0000\n" "PO-Revision-Date: 2021-11-19 23:36+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -59,21 +59,22 @@ msgstr "" #: ../../library/constants.rst:30 msgid "" -"A special value which should be returned by the binary special methods (e." -"g. :meth:`~object.__eq__`, :meth:`~object.__lt__`, :meth:`~object.__add__`, :" -"meth:`~object.__rsub__`, etc.) to indicate that the operation is not " -"implemented with respect to the other type; may be returned by the in-place " -"binary special methods (e.g. :meth:`~object.__imul__`, :meth:`~object." -"__iand__`, etc.) for the same purpose. It should not be evaluated in a " -"boolean context. :data:`!NotImplemented` is the sole instance of the :data:" -"`types.NotImplementedType` type." +"A special value which should be returned by the binary special methods " +"(e.g. :meth:`~object.__eq__`, :meth:`~object.__lt__`, :meth:`~object.__add__`, :meth:`~object.__rsub__`, " +"etc.) to indicate that the operation is not implemented with respect to the " +"other type; may be returned by the in-place binary special methods " +"(e.g. :meth:`~object.__imul__`, :meth:`~object.__iand__`, etc.) for the same " +"purpose. It should not be evaluated in a boolean context. :data:`!" +"NotImplemented` is the sole instance of the :data:`types.NotImplementedType` " +"type." msgstr "" -"會被二元特殊方法 (binary special methods)(如::meth:`~object.__eq__`、:meth:" -"`~object.__lt__`、:meth:`~object.__add__`、:meth:`~object.__rsub__` 等)所回" -"傳的特殊值,代表著該運算沒有針對其他型別的實作。同理也可以被原地二元特殊方法 " -"(in-place binary special methods) (如::meth:`~object.__imul__`、:meth:" -"`~object.__iand__` 等)回傳。它不應該被作為 boolean(布林)來解讀。:data:`!" -"NotImplemented` 是型別 :data:`types.NotImplementedType` 的唯一實例。" +"會被二元特殊方法 (binary special methods)" +"(如::meth:`~object.__eq__`、:meth:`~object.__lt__`、:meth:`~object.__add__`、:meth:`~object.__rsub__` " +"等)所回傳的特殊值,代表著該運算沒有針對其他型別的實作。同理也可以被原地二元" +"特殊方法 (in-place binary special methods) " +"(如::meth:`~object.__imul__`、:meth:`~object.__iand__` 等)回傳。它不應該被" +"作為 boolean(布林)來解讀。:data:`!NotImplemented` 是型" +"別 :data:`types.NotImplementedType` 的唯一實例。" #: ../../library/constants.rst:40 msgid "" @@ -97,15 +98,15 @@ msgstr "請參見 :ref:`implementing-the-arithmetic-operations` 以找到更多 #: ../../library/constants.rst:51 msgid "" -"``NotImplementedError`` and :data:`!NotImplemented` are not interchangeable, " -"even though they have similar names and purposes. See :exc:" -"`NotImplementedError` for details on when to use it." +":data:`!NotImplemented` and :exc:`!NotImplementedError` are not " +"interchangeable. This constant should only be used as described above; " +"see :exc:`NotImplementedError` for details on correct usage of the exception." msgstr "" -"``NotImplementedError`` 與 :data:`!NotImplemented` 並不一樣且不可互換。即使它" -"們有相似的名稱與用途。欲知更多如何使用它們的細節,請參見 :exc:" -"`NotImplementedError`。" +":data:`!NotImplemented` 與 :exc:`!NotImplementedError` 並不一樣且不可互換。這" +"個常數只能用於上述的情況;欲知更多如何正確使用它們的細節,請參" +"見 :exc:`NotImplementedError`。" -#: ../../library/constants.rst:55 +#: ../../library/constants.rst:56 msgid "" "Evaluating :data:`!NotImplemented` in a boolean context is deprecated. While " "it currently evaluates as true, it will emit a :exc:`DeprecationWarning`. It " @@ -115,7 +116,7 @@ msgstr "" "被解讀成 true,但會發出一個 :exc:`DeprecationWarning`。在未來版本的 Python 將" "會拋出 :exc:`TypeError`。" -#: ../../library/constants.rst:64 +#: ../../library/constants.rst:65 msgid "" "The same as the ellipsis literal \"``...``\". Special value used mostly in " "conjunction with extended slicing syntax for user-defined container data " @@ -123,32 +124,32 @@ msgid "" "type." msgstr "" "與刪節號 \"``...``\" 字面相同。為一特殊值,大多用於結合使用者定義資料型別的延" -"伸切片語法 (extended slicing syntax)。``Ellipsis`` 是型別 :data:`types." -"EllipsisType` 的唯一實例。" +"伸切片語法 (extended slicing syntax)。``Ellipsis`` 是型" +"別 :data:`types.EllipsisType` 的唯一實例。" -#: ../../library/constants.rst:71 +#: ../../library/constants.rst:72 msgid "" "This constant is true if Python was not started with an :option:`-O` option. " "See also the :keyword:`assert` statement." msgstr "" -"如果 Python 沒有被以 :option:`-O` 選項啟動,則此常數為 true。請參見 :keyword:" -"`assert` 陳述式。" +"如果 Python 沒有被以 :option:`-O` 選項啟動,則此常數為 true。請參" +"見 :keyword:`assert` 陳述式。" -#: ../../library/constants.rst:77 +#: ../../library/constants.rst:78 msgid "" "The names :data:`None`, :data:`False`, :data:`True` and :data:`__debug__` " -"cannot be reassigned (assignments to them, even as an attribute name, raise :" -"exc:`SyntaxError`), so they can be considered \"true\" constants." +"cannot be reassigned (assignments to them, even as an attribute name, " +"raise :exc:`SyntaxError`), so they can be considered \"true\" constants." msgstr "" ":data:`None`,:data:`False`,:data:`True`,以及 :data:`__debug__` 都是不能被" -"重新賦值的(任何對它們的賦值,即使是屬性的名稱,也會拋出 :exc:" -"`SyntaxError`)。因此,它們可以被視為”真正的”常數。" +"重新賦值的(任何對它們的賦值,即使是屬性的名稱,也會拋" +"出 :exc:`SyntaxError`)。因此,它們可以被視為”真正的”常數。" -#: ../../library/constants.rst:85 +#: ../../library/constants.rst:86 msgid "Constants added by the :mod:`site` module" msgstr "由 :mod:`site` module(模組)所添增的常數" -#: ../../library/constants.rst:87 +#: ../../library/constants.rst:88 msgid "" "The :mod:`site` module (which is imported automatically during startup, " "except if the :option:`-S` command-line option is given) adds several " @@ -159,7 +160,7 @@ msgstr "" "指令行選項)會添增一些常數到內建命名空間 (built-in namespace) 中。它們在互動" "式直譯器中是很有幫助的,但不應該在程式 (programs) 中被使用。" -#: ../../library/constants.rst:95 +#: ../../library/constants.rst:96 msgid "" "Objects that when printed, print a message like \"Use quit() or Ctrl-D (i.e. " "EOF) to exit\", and when called, raise :exc:`SystemExit` with the specified " @@ -168,23 +169,23 @@ msgstr "" "當印出物件時,會印出一個訊息: \"Use quit() or Ctrl-D (i.e. EOF) to exit\" 。" "當被呼叫時,則會拋出 :exc:`SystemExit` 並帶有指定的返回碼(exit code)。" -#: ../../library/constants.rst:102 +#: ../../library/constants.rst:103 msgid "" "Object that when printed, prints the message \"Type help() for interactive " "help, or help(object) for help about object.\", and when called, acts as " "described :func:`elsewhere `." msgstr "" "當印出此物件時,會印出訊息 \"Type help() for interactive help, or " -"help(object) for help about object.\",並在呼叫時按所述的方式操作 :func:" -"`elsewhere `。" +"help(object) for help about object.\",並在呼叫時按所述的方式操" +"作 :func:`elsewhere `。" -#: ../../library/constants.rst:109 +#: ../../library/constants.rst:110 msgid "" "Objects that when printed or called, print the text of copyright or credits, " "respectively." msgstr "當印出或是呼叫此物件時,分別會印出版權與致謝的文字。" -#: ../../library/constants.rst:114 +#: ../../library/constants.rst:115 msgid "" "Object that when printed, prints the message \"Type license() to see the " "full license text\", and when called, displays the full license text in a " @@ -193,10 +194,10 @@ msgstr "" "當印出此物件時,會印出訊息 \"Type license() to see the full license text\"," "並在呼叫時以分頁形式印出完整的許可證文字(一次一整個畫面)。" -#: ../../library/constants.rst:61 +#: ../../library/constants.rst:62 msgid "..." msgstr "..." -#: ../../library/constants.rst:61 +#: ../../library/constants.rst:62 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" diff --git a/library/contextlib.po b/library/contextlib.po index 5785f5506e..a7be4735e6 100644 --- a/library/contextlib.po +++ b/library/contextlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-04-11 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -21,7 +21,7 @@ msgstr "" #: ../../library/contextlib.rst:2 msgid "" ":mod:`!contextlib` --- Utilities for :keyword:`!with`\\ -statement contexts" -msgstr "" +msgstr ":mod:`!contextlib` --- :keyword:`!with` 陳述式工具程式" #: ../../library/contextlib.rst:7 msgid "**Source code:** :source:`Lib/contextlib.py`" @@ -29,9 +29,9 @@ msgstr "**原始碼:**\\ :source:`Lib/contextlib.py`" #: ../../library/contextlib.rst:11 msgid "" -"This module provides utilities for common tasks involving the :keyword:" -"`with` statement. For more information see also :ref:`typecontextmanager` " -"and :ref:`context-managers`." +"This module provides utilities for common tasks involving " +"the :keyword:`with` statement. For more information see " +"also :ref:`typecontextmanager` and :ref:`context-managers`." msgstr "" #: ../../library/contextlib.rst:17 @@ -44,36 +44,38 @@ msgstr "" #: ../../library/contextlib.rst:23 msgid "" -"An :term:`abstract base class` for classes that implement :meth:`object." -"__enter__` and :meth:`object.__exit__`. A default implementation for :meth:" -"`object.__enter__` is provided which returns ``self`` while :meth:`object." -"__exit__` is an abstract method which by default returns ``None``. See also " -"the definition of :ref:`typecontextmanager`." +"An :term:`abstract base class` for classes that " +"implement :meth:`object.__enter__` and :meth:`object.__exit__`. A default " +"implementation for :meth:`object.__enter__` is provided which returns " +"``self`` while :meth:`object.__exit__` is an abstract method which by " +"default returns ``None``. See also the definition " +"of :ref:`typecontextmanager`." msgstr "" #: ../../library/contextlib.rst:34 msgid "" -"An :term:`abstract base class` for classes that implement :meth:`object." -"__aenter__` and :meth:`object.__aexit__`. A default implementation for :meth:" -"`object.__aenter__` is provided which returns ``self`` while :meth:`object." -"__aexit__` is an abstract method which by default returns ``None``. See also " -"the definition of :ref:`async-context-managers`." +"An :term:`abstract base class` for classes that " +"implement :meth:`object.__aenter__` and :meth:`object.__aexit__`. A default " +"implementation for :meth:`object.__aenter__` is provided which returns " +"``self`` while :meth:`object.__aexit__` is an abstract method which by " +"default returns ``None``. See also the definition of :ref:`async-context-" +"managers`." msgstr "" #: ../../library/contextlib.rst:46 msgid "" "This function is a :term:`decorator` that can be used to define a factory " "function for :keyword:`with` statement context managers, without needing to " -"create a class or separate :meth:`~object.__enter__` and :meth:`~object." -"__exit__` methods." +"create a class or separate :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` methods." msgstr "" #: ../../library/contextlib.rst:50 msgid "" "While many objects natively support use in with statements, sometimes a " "resource needs to be managed that isn't a context manager in its own right, " -"and doesn't implement a ``close()`` method for use with ``contextlib." -"closing``" +"and doesn't implement a ``close()`` method for use with " +"``contextlib.closing``." msgstr "" #: ../../library/contextlib.rst:54 @@ -117,18 +119,18 @@ msgstr "" #: ../../library/contextlib.rst:79 msgid "" -"At the point where the generator yields, the block nested in the :keyword:" -"`with` statement is executed. The generator is then resumed after the block " -"is exited. If an unhandled exception occurs in the block, it is reraised " -"inside the generator at the point where the yield occurred. Thus, you can " -"use a :keyword:`try`...\\ :keyword:`except`...\\ :keyword:`finally` " -"statement to trap the error (if any), or ensure that some cleanup takes " -"place. If an exception is trapped merely in order to log it or to perform " -"some action (rather than to suppress it entirely), the generator must " -"reraise that exception. Otherwise the generator context manager will " -"indicate to the :keyword:`!with` statement that the exception has been " -"handled, and execution will resume with the statement immediately following " -"the :keyword:`!with` statement." +"At the point where the generator yields, the block nested in " +"the :keyword:`with` statement is executed. The generator is then resumed " +"after the block is exited. If an unhandled exception occurs in the block, it " +"is reraised inside the generator at the point where the yield occurred. " +"Thus, you can use a :keyword:`try`...\\ :keyword:`except`..." +"\\ :keyword:`finally` statement to trap the error (if any), or ensure that " +"some cleanup takes place. If an exception is trapped merely in order to log " +"it or to perform some action (rather than to suppress it entirely), the " +"generator must reraise that exception. Otherwise the generator context " +"manager will indicate to the :keyword:`!with` statement that the exception " +"has been handled, and execution will resume with the statement immediately " +"following the :keyword:`!with` statement." msgstr "" #: ../../library/contextlib.rst:91 @@ -148,8 +150,8 @@ msgstr "" #: ../../library/contextlib.rst:104 msgid "" -"Similar to :func:`~contextlib.contextmanager`, but creates an :ref:" -"`asynchronous context manager `." +"Similar to :func:`~contextlib.contextmanager`, but creates " +"an :ref:`asynchronous context manager `." msgstr "" #: ../../library/contextlib.rst:107 @@ -157,8 +159,8 @@ msgid "" "This function is a :term:`decorator` that can be used to define a factory " "function for :keyword:`async with` statement asynchronous context managers, " "without needing to create a class or separate :meth:`~object.__aenter__` " -"and :meth:`~object.__aexit__` methods. It must be applied to an :term:" -"`asynchronous generator` function." +"and :meth:`~object.__aexit__` methods. It must be applied to " +"an :term:`asynchronous generator` function." msgstr "" #: ../../library/contextlib.rst:113 @@ -288,10 +290,11 @@ msgstr "" #: ../../library/contextlib.rst:187 msgid "" "Most types managing resources support the :term:`context manager` protocol, " -"which closes *thing* on leaving the :keyword:`with` statement. As such, :" -"func:`!closing` is most useful for third party types that don't support " -"context managers. This example is purely for illustration purposes, as :func:" -"`~urllib.request.urlopen` would normally be used in a context manager." +"which closes *thing* on leaving the :keyword:`with` statement. As " +"such, :func:`!closing` is most useful for third party types that don't " +"support context managers. This example is purely for illustration purposes, " +"as :func:`~urllib.request.urlopen` would normally be used in a context " +"manager." msgstr "" #: ../../library/contextlib.rst:196 @@ -484,17 +487,17 @@ msgstr "" #: ../../library/contextlib.rst:315 msgid "" -"If the code within the :keyword:`!with` block raises a :exc:" -"`BaseExceptionGroup`, suppressed exceptions are removed from the group. Any " -"exceptions of the group which are not suppressed are re-raised in a new " -"group which is created using the original group's :meth:`~BaseExceptionGroup." -"derive` method." +"If the code within the :keyword:`!with` block raises " +"a :exc:`BaseExceptionGroup`, suppressed exceptions are removed from the " +"group. Any exceptions of the group which are not suppressed are re-raised " +"in a new group which is created using the original " +"group's :meth:`~BaseExceptionGroup.derive` method." msgstr "" #: ../../library/contextlib.rst:323 msgid "" -"``suppress`` now supports suppressing exceptions raised as part of a :exc:" -"`BaseExceptionGroup`." +"``suppress`` now supports suppressing exceptions raised as part of " +"a :exc:`BaseExceptionGroup`." msgstr "" #: ../../library/contextlib.rst:329 @@ -512,10 +515,10 @@ msgstr "" #: ../../library/contextlib.rst:335 msgid "" "For example, the output of :func:`help` normally is sent to *sys.stdout*. " -"You can capture that output in a string by redirecting the output to an :" -"class:`io.StringIO` object. The replacement stream is returned from the " -"``__enter__`` method and so is available as the target of the :keyword:" -"`with` statement::" +"You can capture that output in a string by redirecting the output to " +"an :class:`io.StringIO` object. The replacement stream is returned from the " +"``__enter__`` method and so is available as the target of " +"the :keyword:`with` statement::" msgstr "" #: ../../library/contextlib.rst:341 @@ -566,8 +569,8 @@ msgstr "" #: ../../library/contextlib.rst:369 msgid "" -"Similar to :func:`~contextlib.redirect_stdout` but redirecting :data:`sys." -"stderr` to another file or file-like object." +"Similar to :func:`~contextlib.redirect_stdout` but " +"redirecting :data:`sys.stderr` to another file or file-like object." msgstr "" #: ../../library/contextlib.rst:379 @@ -895,15 +898,16 @@ msgstr "" #: ../../library/contextlib.rst:571 msgid "" "As ``__enter__`` is *not* invoked, this method can be used to cover part of " -"an :meth:`~object.__enter__` implementation with a context manager's own :" -"meth:`~object.__exit__` method." +"an :meth:`~object.__enter__` implementation with a context manager's " +"own :meth:`~object.__exit__` method." msgstr "" #: ../../library/contextlib.rst:575 msgid "" "If passed an object that is not a context manager, this method assumes it is " -"a callback with the same signature as a context manager's :meth:`~object." -"__exit__` method and adds it directly to the callback stack." +"a callback with the same signature as a context " +"manager's :meth:`~object.__exit__` method and adds it directly to the " +"callback stack." msgstr "" #: ../../library/contextlib.rst:579 @@ -971,9 +975,10 @@ msgstr "" #: ../../library/contextlib.rst:624 msgid "" -"An :ref:`asynchronous context manager `, similar to :" -"class:`ExitStack`, that supports combining both synchronous and asynchronous " -"context managers, as well as having coroutines for cleanup logic." +"An :ref:`asynchronous context manager `, similar " +"to :class:`ExitStack`, that supports combining both synchronous and " +"asynchronous context managers, as well as having coroutines for cleanup " +"logic." msgstr "" #: ../../library/contextlib.rst:629 @@ -982,37 +987,37 @@ msgid "" "be used instead." msgstr "" -#: ../../library/contextlib.rst:634 +#: ../../library/contextlib.rst:635 msgid "" "Similar to :meth:`ExitStack.enter_context` but expects an asynchronous " "context manager." msgstr "" -#: ../../library/contextlib.rst:637 +#: ../../library/contextlib.rst:638 msgid "" "Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm* is not an " "asynchronous context manager." msgstr "" -#: ../../library/contextlib.rst:643 +#: ../../library/contextlib.rst:644 msgid "" "Similar to :meth:`ExitStack.push` but expects either an asynchronous context " "manager or a coroutine function." msgstr "" -#: ../../library/contextlib.rst:648 +#: ../../library/contextlib.rst:649 msgid "Similar to :meth:`ExitStack.callback` but expects a coroutine function." msgstr "" -#: ../../library/contextlib.rst:652 +#: ../../library/contextlib.rst:654 msgid "Similar to :meth:`ExitStack.close` but properly handles awaitables." msgstr "" -#: ../../library/contextlib.rst:654 +#: ../../library/contextlib.rst:656 msgid "Continuing the example for :func:`asynccontextmanager`::" msgstr "" -#: ../../library/contextlib.rst:656 +#: ../../library/contextlib.rst:658 msgid "" "async with AsyncExitStack() as stack:\n" " connections = [await stack.enter_async_context(get_connection())\n" @@ -1022,21 +1027,21 @@ msgid "" " # later in the list raise an exception." msgstr "" -#: ../../library/contextlib.rst:666 +#: ../../library/contextlib.rst:668 msgid "Examples and Recipes" msgstr "" -#: ../../library/contextlib.rst:668 +#: ../../library/contextlib.rst:670 msgid "" "This section describes some examples and recipes for making effective use of " "the tools provided by :mod:`contextlib`." msgstr "" -#: ../../library/contextlib.rst:673 +#: ../../library/contextlib.rst:675 msgid "Supporting a variable number of context managers" msgstr "" -#: ../../library/contextlib.rst:675 +#: ../../library/contextlib.rst:677 msgid "" "The primary use case for :class:`ExitStack` is the one given in the class " "documentation: supporting a variable number of context managers and other " @@ -1046,7 +1051,7 @@ msgid "" "of the context managers being optional::" msgstr "" -#: ../../library/contextlib.rst:682 +#: ../../library/contextlib.rst:684 msgid "" "with ExitStack() as stack:\n" " for resource in resources:\n" @@ -1057,27 +1062,27 @@ msgid "" " # Perform operations that use the acquired resources" msgstr "" -#: ../../library/contextlib.rst:690 +#: ../../library/contextlib.rst:692 msgid "" "As shown, :class:`ExitStack` also makes it quite easy to use :keyword:`with` " "statements to manage arbitrary resources that don't natively support the " "context management protocol." msgstr "" -#: ../../library/contextlib.rst:696 +#: ../../library/contextlib.rst:698 msgid "Catching exceptions from ``__enter__`` methods" msgstr "" -#: ../../library/contextlib.rst:698 +#: ../../library/contextlib.rst:700 msgid "" "It is occasionally desirable to catch exceptions from an ``__enter__`` " -"method implementation, *without* inadvertently catching exceptions from the :" -"keyword:`with` statement body or the context manager's ``__exit__`` method. " -"By using :class:`ExitStack` the steps in the context management protocol can " -"be separated slightly in order to allow this::" +"method implementation, *without* inadvertently catching exceptions from " +"the :keyword:`with` statement body or the context manager's ``__exit__`` " +"method. By using :class:`ExitStack` the steps in the context management " +"protocol can be separated slightly in order to allow this::" msgstr "" -#: ../../library/contextlib.rst:704 +#: ../../library/contextlib.rst:706 msgid "" "stack = ExitStack()\n" "try:\n" @@ -1089,36 +1094,36 @@ msgid "" " # Handle normal case" msgstr "" -#: ../../library/contextlib.rst:713 +#: ../../library/contextlib.rst:715 msgid "" "Actually needing to do this is likely to indicate that the underlying API " -"should be providing a direct resource management interface for use with :" -"keyword:`try`/:keyword:`except`/:keyword:`finally` statements, but not all " -"APIs are well designed in that regard. When a context manager is the only " -"resource management API provided, then :class:`ExitStack` can make it easier " -"to handle various situations that can't be handled directly in a :keyword:" -"`with` statement." +"should be providing a direct resource management interface for use " +"with :keyword:`try`/:keyword:`except`/:keyword:`finally` statements, but not " +"all APIs are well designed in that regard. When a context manager is the " +"only resource management API provided, then :class:`ExitStack` can make it " +"easier to handle various situations that can't be handled directly in " +"a :keyword:`with` statement." msgstr "" -#: ../../library/contextlib.rst:723 +#: ../../library/contextlib.rst:725 msgid "Cleaning up in an ``__enter__`` implementation" msgstr "" -#: ../../library/contextlib.rst:725 +#: ../../library/contextlib.rst:727 msgid "" "As noted in the documentation of :meth:`ExitStack.push`, this method can be " -"useful in cleaning up an already allocated resource if later steps in the :" -"meth:`~object.__enter__` implementation fail." +"useful in cleaning up an already allocated resource if later steps in " +"the :meth:`~object.__enter__` implementation fail." msgstr "" -#: ../../library/contextlib.rst:729 +#: ../../library/contextlib.rst:731 msgid "" "Here's an example of doing this for a context manager that accepts resource " "acquisition and release functions, along with an optional validation " "function, and maps them to the context management protocol::" msgstr "" -#: ../../library/contextlib.rst:733 +#: ../../library/contextlib.rst:735 msgid "" "from contextlib import contextmanager, AbstractContextManager, ExitStack\n" "\n" @@ -1156,11 +1161,11 @@ msgid "" " self.release_resource()" msgstr "" -#: ../../library/contextlib.rst:769 +#: ../../library/contextlib.rst:771 msgid "Replacing any use of ``try-finally`` and flag variables" msgstr "" -#: ../../library/contextlib.rst:771 +#: ../../library/contextlib.rst:773 msgid "" "A pattern you will sometimes see is a ``try-finally`` statement with a flag " "variable to indicate whether or not the body of the ``finally`` clause " @@ -1168,7 +1173,7 @@ msgid "" "by using an ``except`` clause instead), it looks something like this::" msgstr "" -#: ../../library/contextlib.rst:776 +#: ../../library/contextlib.rst:778 msgid "" "cleanup_needed = True\n" "try:\n" @@ -1188,21 +1193,21 @@ msgstr "" " if cleanup_needed:\n" " cleanup_resources()" -#: ../../library/contextlib.rst:785 +#: ../../library/contextlib.rst:787 msgid "" "As with any ``try`` statement based code, this can cause problems for " "development and review, because the setup code and the cleanup code can end " "up being separated by arbitrarily long sections of code." msgstr "" -#: ../../library/contextlib.rst:789 +#: ../../library/contextlib.rst:791 msgid "" ":class:`ExitStack` makes it possible to instead register a callback for " "execution at the end of a ``with`` statement, and then later decide to skip " "executing that callback::" msgstr "" -#: ../../library/contextlib.rst:793 +#: ../../library/contextlib.rst:795 msgid "" "from contextlib import ExitStack\n" "\n" @@ -1220,19 +1225,19 @@ msgstr "" " if result:\n" " stack.pop_all()" -#: ../../library/contextlib.rst:801 +#: ../../library/contextlib.rst:803 msgid "" "This allows the intended cleanup behaviour to be made explicit up front, " "rather than requiring a separate flag variable." msgstr "" -#: ../../library/contextlib.rst:804 +#: ../../library/contextlib.rst:806 msgid "" "If a particular application uses this pattern a lot, it can be simplified " "even further by means of a small helper class::" msgstr "" -#: ../../library/contextlib.rst:807 +#: ../../library/contextlib.rst:809 msgid "" "from contextlib import ExitStack\n" "\n" @@ -1264,14 +1269,14 @@ msgstr "" " if result:\n" " cb.cancel()" -#: ../../library/contextlib.rst:822 +#: ../../library/contextlib.rst:824 msgid "" "If the resource cleanup isn't already neatly bundled into a standalone " -"function, then it is still possible to use the decorator form of :meth:" -"`ExitStack.callback` to declare the resource cleanup in advance::" +"function, then it is still possible to use the decorator form " +"of :meth:`ExitStack.callback` to declare the resource cleanup in advance::" msgstr "" -#: ../../library/contextlib.rst:827 +#: ../../library/contextlib.rst:829 msgid "" "from contextlib import ExitStack\n" "\n" @@ -1293,24 +1298,24 @@ msgstr "" " if result:\n" " stack.pop_all()" -#: ../../library/contextlib.rst:837 +#: ../../library/contextlib.rst:839 msgid "" "Due to the way the decorator protocol works, a callback function declared " "this way cannot take any parameters. Instead, any resources to be released " "must be accessed as closure variables." msgstr "" -#: ../../library/contextlib.rst:843 +#: ../../library/contextlib.rst:845 msgid "Using a context manager as a function decorator" msgstr "" -#: ../../library/contextlib.rst:845 +#: ../../library/contextlib.rst:847 msgid "" ":class:`ContextDecorator` makes it possible to use a context manager in both " "an ordinary ``with`` statement and also as a function decorator." msgstr "" -#: ../../library/contextlib.rst:848 +#: ../../library/contextlib.rst:850 msgid "" "For example, it is sometimes useful to wrap functions or groups of " "statements with a logger that can track the time of entry and time of exit. " @@ -1319,7 +1324,7 @@ msgid "" "in a single definition::" msgstr "" -#: ../../library/contextlib.rst:854 +#: ../../library/contextlib.rst:856 msgid "" "from contextlib import ContextDecorator\n" "import logging\n" @@ -1351,11 +1356,11 @@ msgstr "" " def __exit__(self, exc_type, exc, exc_tb):\n" " logging.info('Exiting: %s', self.name)" -#: ../../library/contextlib.rst:869 +#: ../../library/contextlib.rst:871 msgid "Instances of this class can be used as both a context manager::" msgstr "" -#: ../../library/contextlib.rst:871 +#: ../../library/contextlib.rst:873 msgid "" "with track_entry_and_exit('widget loader'):\n" " print('Some time consuming activity goes here')\n" @@ -1365,11 +1370,11 @@ msgstr "" " print('Some time consuming activity goes here')\n" " load_widget()" -#: ../../library/contextlib.rst:875 +#: ../../library/contextlib.rst:877 msgid "And also as a function decorator::" msgstr "" -#: ../../library/contextlib.rst:877 +#: ../../library/contextlib.rst:879 msgid "" "@track_entry_and_exit('widget loader')\n" "def activity():\n" @@ -1381,29 +1386,29 @@ msgstr "" " print('Some time consuming activity goes here')\n" " load_widget()" -#: ../../library/contextlib.rst:882 +#: ../../library/contextlib.rst:884 msgid "" "Note that there is one additional limitation when using context managers as " -"function decorators: there's no way to access the return value of :meth:" -"`~object.__enter__`. If that value is needed, then it is still necessary to " -"use an explicit ``with`` statement." +"function decorators: there's no way to access the return value " +"of :meth:`~object.__enter__`. If that value is needed, then it is still " +"necessary to use an explicit ``with`` statement." msgstr "" -#: ../../library/contextlib.rst:889 +#: ../../library/contextlib.rst:891 msgid ":pep:`343` - The \"with\" statement" msgstr ":pep:`343` - \"with\" 陳述式" -#: ../../library/contextlib.rst:890 +#: ../../library/contextlib.rst:892 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../library/contextlib.rst:896 +#: ../../library/contextlib.rst:898 msgid "Single use, reusable and reentrant context managers" msgstr "" -#: ../../library/contextlib.rst:898 +#: ../../library/contextlib.rst:900 msgid "" "Most context managers are written in a way that means they can only be used " "effectively in a :keyword:`with` statement once. These single use context " @@ -1411,28 +1416,28 @@ msgid "" "them a second time will trigger an exception or otherwise not work correctly." msgstr "" -#: ../../library/contextlib.rst:904 +#: ../../library/contextlib.rst:906 msgid "" "This common limitation means that it is generally advisable to create " "context managers directly in the header of the :keyword:`with` statement " "where they are used (as shown in all of the usage examples above)." msgstr "" -#: ../../library/contextlib.rst:908 +#: ../../library/contextlib.rst:910 msgid "" "Files are an example of effectively single use context managers, since the " "first :keyword:`with` statement will close the file, preventing any further " "IO operations using that file object." msgstr "" -#: ../../library/contextlib.rst:912 +#: ../../library/contextlib.rst:914 msgid "" "Context managers created using :func:`contextmanager` are also single use " "context managers, and will complain about the underlying generator failing " "to yield if an attempt is made to use them a second time::" msgstr "" -#: ../../library/contextlib.rst:916 +#: ../../library/contextlib.rst:918 msgid "" ">>> from contextlib import contextmanager\n" ">>> @contextmanager\n" @@ -1474,11 +1479,11 @@ msgstr "" " ...\n" "RuntimeError: generator didn't yield" -#: ../../library/contextlib.rst:940 +#: ../../library/contextlib.rst:942 msgid "Reentrant context managers" msgstr "" -#: ../../library/contextlib.rst:942 +#: ../../library/contextlib.rst:944 msgid "" "More sophisticated context managers may be \"reentrant\". These context " "managers can not only be used in multiple :keyword:`with` statements, but " @@ -1486,14 +1491,14 @@ msgid "" "the same context manager." msgstr "" -#: ../../library/contextlib.rst:947 +#: ../../library/contextlib.rst:949 msgid "" ":class:`threading.RLock` is an example of a reentrant context manager, as " "are :func:`suppress`, :func:`redirect_stdout`, and :func:`chdir`. Here's a " "very simple example of reentrant use::" msgstr "" -#: ../../library/contextlib.rst:951 +#: ../../library/contextlib.rst:953 msgid "" ">>> from contextlib import redirect_stdout\n" ">>> from io import StringIO\n" @@ -1525,26 +1530,26 @@ msgstr "" "This is written to the stream rather than stdout\n" "This is also written to the stream" -#: ../../library/contextlib.rst:966 +#: ../../library/contextlib.rst:968 msgid "" "Real world examples of reentrancy are more likely to involve multiple " "functions calling each other and hence be far more complicated than this " "example." msgstr "" -#: ../../library/contextlib.rst:970 +#: ../../library/contextlib.rst:972 msgid "" "Note also that being reentrant is *not* the same thing as being thread " "safe. :func:`redirect_stdout`, for example, is definitely not thread safe, " -"as it makes a global modification to the system state by binding :data:`sys." -"stdout` to a different stream." +"as it makes a global modification to the system state by " +"binding :data:`sys.stdout` to a different stream." msgstr "" -#: ../../library/contextlib.rst:979 +#: ../../library/contextlib.rst:981 msgid "Reusable context managers" msgstr "" -#: ../../library/contextlib.rst:981 +#: ../../library/contextlib.rst:983 msgid "" "Distinct from both single use and reentrant context managers are " "\"reusable\" context managers (or, to be completely explicit, \"reusable, " @@ -1554,21 +1559,22 @@ msgid "" "manager instance has already been used in a containing with statement." msgstr "" -#: ../../library/contextlib.rst:988 +#: ../../library/contextlib.rst:990 msgid "" ":class:`threading.Lock` is an example of a reusable, but not reentrant, " -"context manager (for a reentrant lock, it is necessary to use :class:" -"`threading.RLock` instead)." +"context manager (for a reentrant lock, it is necessary to " +"use :class:`threading.RLock` instead)." msgstr "" -#: ../../library/contextlib.rst:992 +#: ../../library/contextlib.rst:994 msgid "" -"Another example of a reusable, but not reentrant, context manager is :class:" -"`ExitStack`, as it invokes *all* currently registered callbacks when leaving " -"any with statement, regardless of where those callbacks were added::" +"Another example of a reusable, but not reentrant, context manager " +"is :class:`ExitStack`, as it invokes *all* currently registered callbacks " +"when leaving any with statement, regardless of where those callbacks were " +"added::" msgstr "" -#: ../../library/contextlib.rst:997 +#: ../../library/contextlib.rst:999 msgid "" ">>> from contextlib import ExitStack\n" ">>> stack = ExitStack()\n" @@ -1622,7 +1628,7 @@ msgstr "" "Callback: from outer context\n" "Leaving outer context" -#: ../../library/contextlib.rst:1023 +#: ../../library/contextlib.rst:1025 msgid "" "As the output from the example shows, reusing a single stack object across " "multiple with statements works correctly, but attempting to nest them will " @@ -1630,13 +1636,13 @@ msgid "" "which is unlikely to be desirable behaviour." msgstr "" -#: ../../library/contextlib.rst:1028 +#: ../../library/contextlib.rst:1030 msgid "" "Using separate :class:`ExitStack` instances instead of reusing a single " "instance avoids that problem::" msgstr "" -#: ../../library/contextlib.rst:1031 +#: ../../library/contextlib.rst:1033 msgid "" ">>> from contextlib import ExitStack\n" ">>> with ExitStack() as outer_stack:\n" diff --git a/library/copy.po b/library/copy.po index 9a072ea439..b0b7a3ac26 100644 --- a/library/copy.po +++ b/library/copy.po @@ -46,14 +46,12 @@ msgid "Interface summary:" msgstr "介面摘要:" #: ../../library/copy.rst:22 -#, fuzzy msgid "Return a shallow copy of *obj*." -msgstr "回傳 *x* 的淺層複製。" +msgstr "回傳 *obj* 的淺層複製。" #: ../../library/copy.rst:27 -#, fuzzy msgid "Return a deep copy of *obj*." -msgstr "回傳 *x* 的深層複製。" +msgstr "回傳 *obj* 的深層複製。" #: ../../library/copy.rst:32 msgid "" @@ -131,8 +129,8 @@ msgid "" "This module does not copy types like module, method, stack trace, stack " "frame, file, socket, window, or any similar types. It does \"copy\" " "functions and classes (shallow and deeply), by returning the original object " -"unchanged; this is compatible with the way these are treated by the :mod:" -"`pickle` module." +"unchanged; this is compatible with the way these are treated by " +"the :mod:`pickle` module." msgstr "" "該模組不複製模組、方法、堆疊追蹤(stack trace)、堆疊框(stack frame)、檔" "案、socket、視窗、陣列以及任何類似的型別。它透過不變更原始物件並將其回傳來" @@ -180,19 +178,19 @@ msgid "" "with the component as first argument and the *memo* dictionary as second " "argument. The *memo* dictionary should be treated as an opaque object." msgstr "" -"想要為一個類別定義它自己的複製操作實作,可以透過定義特殊方法 :meth:" -"`__copy__` 和 :meth:`__deepcopy__`。呼叫前者以實現淺層複製操作;不必傳入額外" -"引數。呼叫後者以實現深層複製操作;它應傳入一個引數,即 ``memo`` 字典。如果 :" -"meth:`__deepcopy__` 實現需要建立一個元件的深層複製,它應當呼叫 :func:" -"`deepcopy` 函式並以該元件作為第一個引數、以該 memo 字典作為第二個引數。memo " -"字典應當被當作不透明物件 (opaque object) 來處理。" +"想要為一個類別定義它自己的複製操作實作,可以透過定義特殊方" +"法 :meth:`__copy__` 和 :meth:`__deepcopy__`。呼叫前者以實現淺層複製操作;不必" +"傳入額外引數。呼叫後者以實現深層複製操作;它應傳入一個引數,即 ``memo`` 字" +"典。如果 :meth:`__deepcopy__` 實現需要建立一個元件的深層複製,它應當呼" +"叫 :func:`~copy.deepcopy` 函式並以該元件作為第一個引數、以該 *memo* 字典作為" +"第二個引數。*memo* 字典應當被當作不透明物件 (opaque object) 來處理。" #: ../../library/copy.rst:114 msgid "" -"Function :func:`!copy.replace` is more limited than :func:`~copy.copy` and :" -"func:`~copy.deepcopy`, and only supports named tuples created by :func:" -"`~collections.namedtuple`, :mod:`dataclasses`, and other classes which " -"define method :meth:`~object.__replace__`." +"Function :func:`!copy.replace` is more limited than :func:`~copy.copy` " +"and :func:`~copy.deepcopy`, and only supports named tuples created " +"by :func:`~collections.namedtuple`, :mod:`dataclasses`, and other classes " +"which define method :meth:`~object.__replace__`." msgstr "" #: ../../library/copy.rst:122 @@ -230,6 +228,5 @@ msgid "__deepcopy__() (copy protocol)" msgstr "__deepcopy__() (複製協定)" #: ../../library/copy.rst:111 -#, fuzzy msgid "__replace__() (replace protocol)" -msgstr "__deepcopy__() (複製協定)" +msgstr "__replace__() (取代協定)" diff --git a/library/ctypes.po b/library/ctypes.po index 233c1e14ac..86164ffb4f 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-23 00:14+0000\n" +"POT-Creation-Date: 2025-02-21 00:13+0000\n" "PO-Revision-Date: 2023-04-26 02:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -48,9 +47,10 @@ msgstr "" #: ../../library/ctypes.rst:27 msgid "" "Note: Some code samples reference the ctypes :class:`c_int` type. On " -"platforms where ``sizeof(long) == sizeof(int)`` it is an alias to :class:" -"`c_long`. So, you should not be confused if :class:`c_long` is printed if " -"you would expect :class:`c_int` --- they are actually the same type." +"platforms where ``sizeof(long) == sizeof(int)`` it is an alias " +"to :class:`c_long`. So, you should not be confused if :class:`c_long` is " +"printed if you would expect :class:`c_int` --- they are actually the same " +"type." msgstr "" #: ../../library/ctypes.rst:35 @@ -76,8 +76,8 @@ msgstr "" #: ../../library/ctypes.rst:48 msgid "" -"Windows errors used to raise :exc:`WindowsError`, which is now an alias of :" -"exc:`OSError`." +"Windows errors used to raise :exc:`WindowsError`, which is now an alias " +"of :exc:`OSError`." msgstr "" #: ../../library/ctypes.rst:53 @@ -90,19 +90,19 @@ msgstr "" #: ../../library/ctypes.rst:57 msgid "" ">>> from ctypes import *\n" -">>> print(windll.kernel32) \n" +">>> print(windll.kernel32)\n" "\n" -">>> print(cdll.msvcrt) \n" +">>> print(cdll.msvcrt)\n" "\n" -">>> libc = cdll.msvcrt \n" +">>> libc = cdll.msvcrt\n" ">>>" msgstr "" ">>> from ctypes import *\n" -">>> print(windll.kernel32) \n" +">>> print(windll.kernel32)\n" "\n" -">>> print(cdll.msvcrt) \n" +">>> print(cdll.msvcrt)\n" "\n" -">>> libc = cdll.msvcrt \n" +">>> libc = cdll.msvcrt\n" ">>>" #: ../../library/ctypes.rst:65 @@ -128,17 +128,17 @@ msgstr "" #: ../../library/ctypes.rst:79 msgid "" -">>> cdll.LoadLibrary(\"libc.so.6\") \n" +">>> cdll.LoadLibrary(\"libc.so.6\")\n" "\n" -">>> libc = CDLL(\"libc.so.6\") \n" -">>> libc \n" +">>> libc = CDLL(\"libc.so.6\")\n" +">>> libc\n" "\n" ">>>" msgstr "" -">>> cdll.LoadLibrary(\"libc.so.6\") \n" +">>> cdll.LoadLibrary(\"libc.so.6\")\n" "\n" -">>> libc = CDLL(\"libc.so.6\") \n" -">>> libc \n" +">>> libc = CDLL(\"libc.so.6\")\n" +">>> libc\n" "\n" ">>>" @@ -154,9 +154,9 @@ msgstr "" msgid "" ">>> libc.printf\n" "<_FuncPtr object at 0x...>\n" -">>> print(windll.kernel32.GetModuleHandleA) \n" +">>> print(windll.kernel32.GetModuleHandleA)\n" "<_FuncPtr object at 0x...>\n" -">>> print(windll.kernel32.MyOwnFunction) \n" +">>> print(windll.kernel32.MyOwnFunction)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"ctypes.py\", line 239, in __getattr__\n" @@ -166,9 +166,9 @@ msgid "" msgstr "" ">>> libc.printf\n" "<_FuncPtr object at 0x...>\n" -">>> print(windll.kernel32.GetModuleHandleA) \n" +">>> print(windll.kernel32.GetModuleHandleA)\n" "<_FuncPtr object at 0x...>\n" -">>> print(windll.kernel32.MyOwnFunction) \n" +">>> print(windll.kernel32.MyOwnFunction)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"ctypes.py\", line 239, in __getattr__\n" @@ -209,17 +209,17 @@ msgstr "" #: ../../library/ctypes.rst:125 msgid "" "Sometimes, dlls export functions with names which aren't valid Python " -"identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to use :func:" -"`getattr` to retrieve the function::" +"identifiers, like ``\"??2@YAPAXI@Z\"``. In this case you have to " +"use :func:`getattr` to retrieve the function::" msgstr "" #: ../../library/ctypes.rst:129 msgid "" -">>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\") \n" +">>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\")\n" "<_FuncPtr object at 0x...>\n" ">>>" msgstr "" -">>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\") \n" +">>> getattr(cdll.msvcrt, \"??2@YAPAXI@Z\")\n" "<_FuncPtr object at 0x...>\n" ">>>" @@ -232,9 +232,9 @@ msgstr "" #: ../../library/ctypes.rst:136 msgid "" -">>> cdll.kernel32[1] \n" +">>> cdll.kernel32[1]\n" "<_FuncPtr object at 0x...>\n" -">>> cdll.kernel32[0] \n" +">>> cdll.kernel32[0]\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"ctypes.py\", line 310, in __getitem__\n" @@ -242,9 +242,9 @@ msgid "" "AttributeError: function ordinal 0 not found\n" ">>>" msgstr "" -">>> cdll.kernel32[1] \n" +">>> cdll.kernel32[1]\n" "<_FuncPtr object at 0x...>\n" -">>> cdll.kernel32[0] \n" +">>> cdll.kernel32[0]\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"ctypes.py\", line 310, in __getitem__\n" @@ -265,10 +265,10 @@ msgstr "" #: ../../library/ctypes.rst:155 msgid "" -">>> print(libc.rand()) \n" +">>> print(libc.rand())\n" "1804289383" msgstr "" -">>> print(libc.rand()) \n" +">>> print(libc.rand())\n" "1804289383" #: ../../library/ctypes.rst:158 @@ -280,11 +280,11 @@ msgstr "" #: ../../library/ctypes.rst:161 msgid "" -">>> print(hex(windll.kernel32.GetModuleHandleA(None))) \n" +">>> print(hex(windll.kernel32.GetModuleHandleA(None)))\n" "0x1d000000\n" ">>>" msgstr "" -">>> print(hex(windll.kernel32.GetModuleHandleA(None))) \n" +">>> print(hex(windll.kernel32.GetModuleHandleA(None)))\n" "0x1d000000\n" ">>>" @@ -296,28 +296,28 @@ msgstr "" #: ../../library/ctypes.rst:168 msgid "" -">>> cdll.kernel32.GetModuleHandleA(None) \n" +">>> cdll.kernel32.GetModuleHandleA(None)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "ValueError: Procedure probably called with not enough arguments (4 bytes " "missing)\n" ">>>\n" "\n" -">>> windll.msvcrt.printf(b\"spam\") \n" +">>> windll.msvcrt.printf(b\"spam\")\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "ValueError: Procedure probably called with too many arguments (4 bytes in " "excess)\n" ">>>" msgstr "" -">>> cdll.kernel32.GetModuleHandleA(None) \n" +">>> cdll.kernel32.GetModuleHandleA(None)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "ValueError: Procedure probably called with not enough arguments (4 bytes " "missing)\n" ">>>\n" "\n" -">>> windll.msvcrt.printf(b\"spam\") \n" +">>> windll.msvcrt.printf(b\"spam\")\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "ValueError: Procedure probably called with too many arguments (4 bytes in " @@ -339,13 +339,13 @@ msgstr "" #: ../../library/ctypes.rst:187 msgid "" -">>> windll.kernel32.GetModuleHandleA(32) \n" +">>> windll.kernel32.GetModuleHandleA(32)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "OSError: exception: access violation reading 0x00000020\n" ">>>" msgstr "" -">>> windll.kernel32.GetModuleHandleA(32) \n" +">>> windll.kernel32.GetModuleHandleA(32)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" "OSError: exception: access violation reading 0x00000020\n" @@ -364,10 +364,10 @@ msgid "" "``None``, integers, bytes objects and (unicode) strings are the only native " "Python objects that can directly be used as parameters in these function " "calls. ``None`` is passed as a C ``NULL`` pointer, bytes objects and strings " -"are passed as pointer to the memory block that contains their data (:c:expr:" -"`char *` or :c:expr:`wchar_t *`). Python integers are passed as the " -"platform's default C :c:expr:`int` type, their value is masked to fit into " -"the C type." +"are passed as pointer to the memory block that contains their data " +"(:c:expr:`char *` or :c:expr:`wchar_t *`). Python integers are passed as " +"the platform's default C :c:expr:`int` type, their value is masked to fit " +"into the C type." msgstr "" #: ../../library/ctypes.rst:205 @@ -664,10 +664,10 @@ msgstr "" #: ../../library/ctypes.rst:292 msgid "" -"Assigning a new value to instances of the pointer types :class:`c_char_p`, :" -"class:`c_wchar_p`, and :class:`c_void_p` changes the *memory location* they " -"point to, *not the contents* of the memory block (of course not, because " -"Python bytes objects are immutable)::" +"Assigning a new value to instances of the pointer " +"types :class:`c_char_p`, :class:`c_wchar_p`, and :class:`c_void_p` changes " +"the *memory location* they point to, *not the contents* of the memory block " +"(of course not, because Python string objects are immutable)::" msgstr "" #: ../../library/ctypes.rst:297 @@ -691,11 +691,11 @@ msgstr "" #: ../../library/ctypes.rst:312 msgid "" "You should be careful, however, not to pass them to functions expecting " -"pointers to mutable memory. If you need mutable memory blocks, ctypes has a :" -"func:`create_string_buffer` function which creates these in various ways. " -"The current memory block contents can be accessed (or changed) with the " -"``raw`` property; if you want to access it as NUL terminated string, use the " -"``value`` property::" +"pointers to mutable memory. If you need mutable memory blocks, ctypes has " +"a :func:`create_string_buffer` function which creates these in various " +"ways. The current memory block contents can be accessed (or changed) with " +"the ``raw`` property; if you want to access it as NUL terminated string, use " +"the ``value`` property::" msgstr "" #: ../../library/ctypes.rst:319 @@ -734,9 +734,9 @@ msgstr "" #: ../../library/ctypes.rst:347 msgid "" -"Note that printf prints to the real standard output channel, *not* to :data:" -"`sys.stdout`, so these examples will only work at the console prompt, not " -"from within *IDLE* or *PythonWin*::" +"Note that printf prints to the real standard output channel, *not* " +"to :data:`sys.stdout`, so these examples will only work at the console " +"prompt, not from within *IDLE* or *PythonWin*::" msgstr "" #: ../../library/ctypes.rst:351 @@ -931,13 +931,13 @@ msgstr "" msgid "" "If you have defined your own classes which you pass to function calls, you " "have to implement a :meth:`~_CData.from_param` class method for them to be " -"able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. The :meth:" -"`~_CData.from_param` class method receives the Python object passed to the " -"function call, it should do a typecheck or whatever is needed to make sure " -"this object is acceptable, and then return the object itself, its :attr:`!" -"_as_parameter_` attribute, or whatever you want to pass as the C function " -"argument in this case. Again, the result should be an integer, string, " -"bytes, a :mod:`ctypes` instance, or an object with an :attr:`!" +"able to use them in the :attr:`~_CFuncPtr.argtypes` sequence. " +"The :meth:`~_CData.from_param` class method receives the Python object " +"passed to the function call, it should do a typecheck or whatever is needed " +"to make sure this object is acceptable, and then return the object itself, " +"its :attr:`!_as_parameter_` attribute, or whatever you want to pass as the C " +"function argument in this case. Again, the result should be an integer, " +"string, bytes, a :mod:`ctypes` instance, or an object with an :attr:`!" "_as_parameter_` attribute." msgstr "" @@ -954,9 +954,10 @@ msgstr "" #: ../../library/ctypes.rst:482 msgid "" -"The C prototype of :c:func:`time` is ``time_t time(time_t *)``. Because :c:" -"type:`time_t` might be of a different type than the default return type :c:" -"expr:`int`, you should specify the :attr:`!restype` attribute::" +"The C prototype of :c:func:`time` is ``time_t time(time_t *)``. " +"Because :c:type:`time_t` might be of a different type than the default " +"return type :c:expr:`int`, you should specify the :attr:`!restype` " +"attribute::" msgstr "" #: ../../library/ctypes.rst:486 @@ -979,10 +980,10 @@ msgstr "" #: ../../library/ctypes.rst:494 msgid "" -">>> print(libc.time(None)) \n" +">>> print(libc.time(None))\n" "1150640792" msgstr "" -">>> print(libc.time(None)) \n" +">>> print(libc.time(None))\n" "1150640792" #: ../../library/ctypes.rst:497 @@ -994,7 +995,7 @@ msgstr "" #: ../../library/ctypes.rst:500 msgid "" ">>> strchr = libc.strchr\n" -">>> strchr(b\"abcdef\", ord(\"d\")) \n" +">>> strchr(b\"abcdef\", ord(\"d\"))\n" "8059983\n" ">>> strchr.restype = c_char_p # c_char_p is a pointer to a string\n" ">>> strchr(b\"abcdef\", ord(\"d\"))\n" @@ -1004,7 +1005,7 @@ msgid "" ">>>" msgstr "" ">>> strchr = libc.strchr\n" -">>> strchr(b\"abcdef\", ord(\"d\")) \n" +">>> strchr(b\"abcdef\", ord(\"d\"))\n" "8059983\n" ">>> strchr.restype = c_char_p # c_char_p 一個字串的指標\n" ">>> strchr(b\"abcdef\", ord(\"d\"))\n" @@ -1062,34 +1063,34 @@ msgstr "" #: ../../library/ctypes.rst:535 msgid "" -">>> GetModuleHandle = windll.kernel32.GetModuleHandleA \n" +">>> GetModuleHandle = windll.kernel32.GetModuleHandleA\n" ">>> def ValidHandle(value):\n" "... if value == 0:\n" "... raise WinError()\n" "... return value\n" "...\n" ">>>\n" -">>> GetModuleHandle.restype = ValidHandle \n" -">>> GetModuleHandle(None) \n" +">>> GetModuleHandle.restype = ValidHandle\n" +">>> GetModuleHandle(None)\n" "486539264\n" -">>> GetModuleHandle(\"something silly\") \n" +">>> GetModuleHandle(\"something silly\")\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"\", line 3, in ValidHandle\n" "OSError: [Errno 126] The specified module could not be found.\n" ">>>" msgstr "" -">>> GetModuleHandle = windll.kernel32.GetModuleHandleA \n" +">>> GetModuleHandle = windll.kernel32.GetModuleHandleA\n" ">>> def ValidHandle(value):\n" "... if value == 0:\n" "... raise WinError()\n" "... return value\n" "...\n" ">>>\n" -">>> GetModuleHandle.restype = ValidHandle \n" -">>> GetModuleHandle(None) \n" +">>> GetModuleHandle.restype = ValidHandle\n" +">>> GetModuleHandle(None)\n" "486539264\n" -">>> GetModuleHandle(\"something silly\") \n" +">>> GetModuleHandle(\"something silly\")\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" " File \"\", line 3, in ValidHandle\n" @@ -1126,10 +1127,10 @@ msgstr "" #: ../../library/ctypes.rst:571 msgid "" ":mod:`ctypes` exports the :func:`byref` function which is used to pass " -"parameters by reference. The same effect can be achieved with the :func:" -"`pointer` function, although :func:`pointer` does a lot more work since it " -"constructs a real pointer object, so it is faster to use :func:`byref` if " -"you don't need the pointer object in Python itself::" +"parameters by reference. The same effect can be achieved with " +"the :func:`pointer` function, although :func:`pointer` does a lot more work " +"since it constructs a real pointer object, so it is faster to " +"use :func:`byref` if you don't need the pointer object in Python itself::" msgstr "" #: ../../library/ctypes.rst:577 @@ -1164,11 +1165,11 @@ msgstr "" #: ../../library/ctypes.rst:595 msgid "" -"Structures and unions must derive from the :class:`Structure` and :class:" -"`Union` base classes which are defined in the :mod:`ctypes` module. Each " -"subclass must define a :attr:`~Structure._fields_` attribute. :attr:`!" -"_fields_` must be a list of *2-tuples*, containing a *field name* and a " -"*field type*." +"Structures and unions must derive from the :class:`Structure` " +"and :class:`Union` base classes which are defined in the :mod:`ctypes` " +"module. Each subclass must define a :attr:`~Structure._fields_` " +"attribute. :attr:`!_fields_` must be a list of *2-tuples*, containing a " +"*field name* and a *field type*." msgstr "" #: ../../library/ctypes.rst:600 @@ -1305,23 +1306,23 @@ msgstr "" #: ../../library/ctypes.rst:667 msgid "" "By default, Structure and Union fields are aligned in the same way the C " -"compiler does it. It is possible to override this behavior by specifying a :" -"attr:`~Structure._pack_` class attribute in the subclass definition. This " +"compiler does it. It is possible to override this behavior by specifying " +"a :attr:`~Structure._pack_` class attribute in the subclass definition. This " "must be set to a positive integer and specifies the maximum alignment for " "the fields. This is what ``#pragma pack(n)`` also does in MSVC. It is also " "possible to set a minimum alignment for how the subclass itself is packed in " "the same way ``#pragma align(n)`` works in MSVC. This can be achieved by " -"specifying a ::attr:`~Structure._align_` class attribute in the subclass " +"specifying a :attr:`~Structure._align_` class attribute in the subclass " "definition." msgstr "" #: ../../library/ctypes.rst:677 msgid "" ":mod:`ctypes` uses the native byte order for Structures and Unions. To " -"build structures with non-native byte order, you can use one of the :class:" -"`BigEndianStructure`, :class:`LittleEndianStructure`, :class:" -"`BigEndianUnion`, and :class:`LittleEndianUnion` base classes. These " -"classes cannot contain pointer fields." +"build structures with non-native byte order, you can use one of " +"the :class:`BigEndianStructure`, :class:`LittleEndianStructure`, :class:`BigEndianUnion`, " +"and :class:`LittleEndianUnion` base classes. These classes cannot contain " +"pointer fields." msgstr "" #: ../../library/ctypes.rst:687 @@ -1460,8 +1461,8 @@ msgstr "" #: ../../library/ctypes.rst:759 msgid "" -"Pointer instances are created by calling the :func:`pointer` function on a :" -"mod:`ctypes` type::" +"Pointer instances are created by calling the :func:`pointer` function on " +"a :mod:`ctypes` type::" msgstr "" #: ../../library/ctypes.rst:762 @@ -1846,8 +1847,8 @@ msgstr "" #: ../../library/ctypes.rst:958 msgid "" "because the new ``class cell`` is not available in the class statement " -"itself. In :mod:`ctypes`, we can define the ``cell`` class and set the :attr:" -"`~Structure._fields_` attribute later, after the class statement::" +"itself. In :mod:`ctypes`, we can define the ``cell`` class and set " +"the :attr:`~Structure._fields_` attribute later, after the class statement::" msgstr "" #: ../../library/ctypes.rst:962 @@ -2009,7 +2010,7 @@ msgstr "結果為: ::" #: ../../library/ctypes.rst:1043 msgid "" -">>> qsort(ia, len(ia), sizeof(c_int), cmp_func) \n" +">>> qsort(ia, len(ia), sizeof(c_int), cmp_func)\n" "py_cmp_func 5 1\n" "py_cmp_func 33 99\n" "py_cmp_func 7 33\n" @@ -2017,7 +2018,7 @@ msgid "" "py_cmp_func 1 7\n" ">>>" msgstr "" -">>> qsort(ia, len(ia), sizeof(c_int), cmp_func) \n" +">>> qsort(ia, len(ia), sizeof(c_int), cmp_func)\n" "py_cmp_func 5 1\n" "py_cmp_func 33 99\n" "py_cmp_func 7 33\n" @@ -2036,7 +2037,7 @@ msgid "" "... return a[0] - b[0]\n" "...\n" ">>>\n" -">>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func)) \n" +">>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func))\n" "py_cmp_func 5 1\n" "py_cmp_func 33 99\n" "py_cmp_func 7 33\n" @@ -2049,7 +2050,7 @@ msgstr "" "... return a[0] - b[0]\n" "...\n" ">>>\n" -">>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func)) \n" +">>> qsort(ia, len(ia), sizeof(c_int), CMPFUNC(py_cmp_func))\n" "py_cmp_func 5 1\n" "py_cmp_func 33 99\n" "py_cmp_func 7 33\n" @@ -2606,13 +2607,14 @@ msgstr "" #: ../../library/ctypes.rst:1376 msgid "" "On Windows creating a :class:`CDLL` instance may fail even if the DLL name " -"exists. When a dependent DLL of the loaded DLL is not found, a :exc:" -"`OSError` error is raised with the message *\"[WinError 126] The specified " -"module could not be found\".* This error message does not contain the name " -"of the missing DLL because the Windows API does not return this information " -"making this error hard to diagnose. To resolve this error and determine " -"which DLL is not found, you need to find the list of dependent DLLs and " -"determine which one is not found using Windows debugging and tracing tools." +"exists. When a dependent DLL of the loaded DLL is not found, " +"a :exc:`OSError` error is raised with the message *\"[WinError 126] The " +"specified module could not be found\".* This error message does not contain " +"the name of the missing DLL because the Windows API does not return this " +"information making this error hard to diagnose. To resolve this error and " +"determine which DLL is not found, you need to find the list of dependent " +"DLLs and determine which one is not found using Windows debugging and " +"tracing tools." msgstr "" #: ../../library/ctypes.rst:1388 ../../library/ctypes.rst:1413 @@ -2648,8 +2650,8 @@ msgstr "" #: ../../library/ctypes.rst:1407 msgid "" -":exc:`WindowsError` used to be raised, which is now an alias of :exc:" -"`OSError`." +":exc:`WindowsError` used to be raised, which is now an alias " +"of :exc:`OSError`." msgstr "" #: ../../library/ctypes.rst:1418 @@ -2698,11 +2700,12 @@ msgstr "" #: ../../library/ctypes.rst:1458 msgid "" "The *use_errno* parameter, when set to true, enables a ctypes mechanism that " -"allows accessing the system :data:`errno` error number in a safe way. :mod:" -"`ctypes` maintains a thread-local copy of the system's :data:`errno` " -"variable; if you call foreign functions created with ``use_errno=True`` then " -"the :data:`errno` value before the function call is swapped with the ctypes " -"private copy, the same happens immediately after the function call." +"allows accessing the system :data:`errno` error number in a safe " +"way. :mod:`ctypes` maintains a thread-local copy of the " +"system's :data:`errno` variable; if you call foreign functions created with " +"``use_errno=True`` then the :data:`errno` value before the function call is " +"swapped with the ctypes private copy, the same happens immediately after the " +"function call." msgstr "" #: ../../library/ctypes.rst:1465 @@ -2715,10 +2718,11 @@ msgstr "" #: ../../library/ctypes.rst:1469 msgid "" "The *use_last_error* parameter, when set to true, enables the same mechanism " -"for the Windows error code which is managed by the :func:`GetLastError` and :" -"func:`!SetLastError` Windows API functions; :func:`ctypes.get_last_error` " -"and :func:`ctypes.set_last_error` are used to request and change the ctypes " -"private copy of the windows error code." +"for the Windows error code which is managed by the :func:`GetLastError` " +"and :func:`!SetLastError` Windows API " +"functions; :func:`ctypes.get_last_error` and :func:`ctypes.set_last_error` " +"are used to request and change the ctypes private copy of the windows error " +"code." msgstr "" #: ../../library/ctypes.rst:1475 @@ -2802,8 +2806,8 @@ msgstr "" #: ../../library/ctypes.rst:1540 msgid "" -"Class which loads shared libraries. *dlltype* should be one of the :class:" -"`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." +"Class which loads shared libraries. *dlltype* should be one of " +"the :class:`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." msgstr "" #: ../../library/ctypes.rst:1543 @@ -2849,9 +2853,9 @@ msgstr "" #: ../../library/ctypes.rst:1589 msgid "" "An instance of :class:`PyDLL` that exposes Python C API functions as " -"attributes. Note that all these functions are assumed to return C :c:expr:" -"`int`, which is of course not always the truth, so you have to assign the " -"correct :attr:`!restype` attribute to use these functions." +"attributes. Note that all these functions are assumed to return " +"C :c:expr:`int`, which is of course not always the truth, so you have to " +"assign the correct :attr:`!restype` attribute to use these functions." msgstr "" #: ../../library/ctypes.rst:1594 ../../library/ctypes.rst:1596 @@ -2863,9 +2867,9 @@ msgstr "" #: ../../library/ctypes.rst:1600 ../../library/ctypes.rst:1602 msgid "" -"Accessing a function on a loaded library raises an auditing event ``ctypes." -"dlsym`` with arguments ``library`` (the library object) and ``name`` (the " -"symbol's name as a string or integer)." +"Accessing a function on a loaded library raises an auditing event " +"``ctypes.dlsym`` with arguments ``library`` (the library object) and " +"``name`` (the symbol's name as a string or integer)." msgstr "" #: ../../library/ctypes.rst:1606 ../../library/ctypes.rst:1608 @@ -2947,12 +2951,12 @@ msgstr "" #: ../../library/ctypes.rst:1664 msgid "" -"When a foreign function is called, each actual argument is passed to the :" -"meth:`~_CData.from_param` class method of the items in the :attr:`argtypes` " -"tuple, this method allows adapting the actual argument to an object that the " -"foreign function accepts. For example, a :class:`c_char_p` item in the :" -"attr:`argtypes` tuple will convert a string passed as argument into a bytes " -"object using ctypes conversion rules." +"When a foreign function is called, each actual argument is passed to " +"the :meth:`~_CData.from_param` class method of the items in " +"the :attr:`argtypes` tuple, this method allows adapting the actual argument " +"to an object that the foreign function accepts. For example, " +"a :class:`c_char_p` item in the :attr:`argtypes` tuple will convert a string " +"passed as argument into a bytes object using ctypes conversion rules." msgstr "" #: ../../library/ctypes.rst:1671 @@ -3004,9 +3008,9 @@ msgstr "" msgid "" "On Windows, when a foreign function call raises a system exception (for " "example, due to an access violation), it will be captured and replaced with " -"a suitable Python exception. Further, an auditing event ``ctypes." -"set_exception`` with argument ``code`` will be raised, allowing an audit " -"hook to replace the exception with its own." +"a suitable Python exception. Further, an auditing event " +"``ctypes.set_exception`` with argument ``code`` will be raised, allowing an " +"audit hook to replace the exception with its own." msgstr "" #: ../../library/ctypes.rst:1715 ../../library/ctypes.rst:1717 @@ -3035,9 +3039,10 @@ msgstr "" msgid "" "The returned function prototype creates functions that use the standard C " "calling convention. The function will release the GIL during the call. If " -"*use_errno* is set to true, the ctypes private copy of the system :data:" -"`errno` variable is exchanged with the real :data:`errno` value before and " -"after the call; *use_last_error* does the same for the Windows error code." +"*use_errno* is set to true, the ctypes private copy of the " +"system :data:`errno` variable is exchanged with the real :data:`errno` value " +"before and after the call; *use_last_error* does the same for the Windows " +"error code." msgstr "" #: ../../library/ctypes.rst:1746 @@ -3101,8 +3106,8 @@ msgstr "" #: ../../library/ctypes.rst:1802 msgid "" -"*paramflags* must be a tuple of the same length as :attr:`~_CFuncPtr." -"argtypes`." +"*paramflags* must be a tuple of the same length " +"as :attr:`~_CFuncPtr.argtypes`." msgstr "" #: ../../library/ctypes.rst:1804 @@ -3325,8 +3330,8 @@ msgid "" "Raises an :ref:`auditing event ` ``ctypes.addressof`` with " "argument ``obj``." msgstr "" -"引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` ``ctypes." -"addressof``。" +"引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` " +"``ctypes.addressof``。" #: ../../library/ctypes.rst:1917 msgid "" @@ -3473,8 +3478,8 @@ msgstr "" #: ../../library/ctypes.rst:2039 msgid "" -"Returns the current value of the ctypes-private copy of the system :data:" -"`errno` variable in the calling thread." +"Returns the current value of the ctypes-private copy of the " +"system :data:`errno` variable in the calling thread." msgstr "" #: ../../library/ctypes.rst:2042 @@ -3549,8 +3554,8 @@ msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_errno`` with " "argument ``errno``." msgstr "" -"引發一個附帶引數 ``errno`` 的\\ :ref:`稽核事件 ` ``ctypes." -"set_errno``。" +"引發一個附帶引數 ``errno`` 的\\ :ref:`稽核事件 ` " +"``ctypes.set_errno``。" #: ../../library/ctypes.rst:2102 msgid "" @@ -3564,8 +3569,8 @@ msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_last_error`` with " "argument ``error``." msgstr "" -"引發一個附帶引數 ``error`` 的\\ :ref:`稽核事件 ` ``ctypes." -"set_last_error``。" +"引發一個附帶引數 ``error`` 的\\ :ref:`稽核事件 ` " +"``ctypes.set_last_error``。" #: ../../library/ctypes.rst:2113 msgid "" @@ -3584,15 +3589,16 @@ msgid "" "Raises an :ref:`auditing event ` ``ctypes.string_at`` with " "arguments ``ptr``, ``size``." msgstr "" -"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." -"string_at``。" +"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` " +"``ctypes.string_at``。" #: ../../library/ctypes.rst:2128 msgid "" "This function is probably the worst-named thing in ctypes. It creates an " "instance of :exc:`OSError`. If *code* is not specified, ``GetLastError`` is " -"called to determine the error code. If *descr* is not specified, :func:" -"`FormatError` is called to get a textual description of the error." +"called to determine the error code. If *descr* is not " +"specified, :func:`FormatError` is called to get a textual description of the " +"error." msgstr "" #: ../../library/ctypes.rst:2136 @@ -3613,8 +3619,8 @@ msgid "" "Raises an :ref:`auditing event ` ``ctypes.wstring_at`` with " "arguments ``ptr``, ``size``." msgstr "" -"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." -"wstring_at``。" +"引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` " +"``ctypes.wstring_at``。" #: ../../library/ctypes.rst:2154 msgid "Data types" @@ -3624,9 +3630,9 @@ msgstr "" msgid "" "This non-public class is the common base class of all ctypes data types. " "Among other things, all ctypes type instances contain a memory block that " -"hold C compatible data; the address of the memory block is returned by the :" -"func:`addressof` helper function. Another instance variable is exposed as :" -"attr:`_objects`; this contains other Python objects that need to be kept " +"hold C compatible data; the address of the memory block is returned by " +"the :func:`addressof` helper function. Another instance variable is exposed " +"as :attr:`_objects`; this contains other Python objects that need to be kept " "alive in case the memory block contains pointers." msgstr "" @@ -3641,8 +3647,8 @@ msgid "" "This method returns a ctypes instance that shares the buffer of the *source* " "object. The *source* object must support the writeable buffer interface. " "The optional *offset* parameter specifies an offset into the source buffer " -"in bytes; the default is zero. If the source buffer is not large enough a :" -"exc:`ValueError` is raised." +"in bytes; the default is zero. If the source buffer is not large enough " +"a :exc:`ValueError` is raised." msgstr "" #: ../../library/ctypes.rst:2177 ../../library/ctypes.rst:2187 @@ -3669,8 +3675,9 @@ msgstr "" #: ../../library/ctypes.rst:2194 ../../library/ctypes.rst:2196 msgid "" -"This method, and others that indirectly call this method, raises an :ref:" -"`auditing event ` ``ctypes.cdata`` with argument ``address``." +"This method, and others that indirectly call this method, raises " +"an :ref:`auditing event ` ``ctypes.cdata`` with argument " +"``address``." msgstr "" #: ../../library/ctypes.rst:2202 @@ -3702,9 +3709,9 @@ msgstr "" #: ../../library/ctypes.rst:2221 msgid "" "Sometimes ctypes data instances do not own the memory block they contain, " -"instead they share part of the memory block of a base object. The :attr:" -"`_b_base_` read-only member is the root ctypes object that owns the memory " -"block." +"instead they share part of the memory block of a base object. " +"The :attr:`_b_base_` read-only member is the root ctypes object that owns " +"the memory block." msgstr "" #: ../../library/ctypes.rst:2228 @@ -3725,8 +3732,8 @@ msgstr "" msgid "" "This non-public class is the base class of all fundamental ctypes data " "types. It is mentioned here because it contains the common attributes of the " -"fundamental ctypes data types. :class:`_SimpleCData` is a subclass of :" -"class:`_CData`, so it inherits their methods and attributes. ctypes data " +"fundamental ctypes data types. :class:`_SimpleCData` is a subclass " +"of :class:`_CData`, so it inherits their methods and attributes. ctypes data " "types that are not and do not contain pointers can now be pickled." msgstr "" @@ -3822,8 +3829,8 @@ msgstr "" #: ../../library/ctypes.rst:2331 msgid "" -"Represents the C 8-bit :c:expr:`signed int` datatype. Usually an alias for :" -"class:`c_byte`." +"Represents the C 8-bit :c:expr:`signed int` datatype. Usually an alias " +"for :class:`c_byte`." msgstr "" #: ../../library/ctypes.rst:2337 @@ -3972,9 +3979,9 @@ msgstr "" #: ../../library/ctypes.rst:2486 msgid "" "The :mod:`!ctypes.wintypes` module provides quite some other Windows " -"specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, or :c:" -"type:`!DWORD`. Some useful structures like :c:type:`!MSG` or :c:type:`!RECT` " -"are also defined." +"specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, " +"or :c:type:`!DWORD`. Some useful structures like :c:type:`!MSG` or :c:type:`!" +"RECT` are also defined." msgstr "" #: ../../library/ctypes.rst:2494 @@ -4014,9 +4021,9 @@ msgstr "" #: ../../library/ctypes.rst:2531 msgid "" "Concrete structure and union types must be created by subclassing one of " -"these types, and at least define a :attr:`_fields_` class variable. :mod:" -"`ctypes` will create :term:`descriptor`\\s which allow reading and writing " -"the fields by direct attribute accesses. These are the" +"these types, and at least define a :attr:`_fields_` class " +"variable. :mod:`ctypes` will create :term:`descriptor`\\s which allow " +"reading and writing the fields by direct attribute accesses. These are the" msgstr "" #: ../../library/ctypes.rst:2539 @@ -4078,9 +4085,9 @@ msgstr "" #: ../../library/ctypes.rst:2572 msgid "" "An optional small integer that allows overriding the alignment of structure " -"fields in the instance. :attr:`_pack_` must already be defined when :attr:" -"`_fields_` is assigned, otherwise it will have no effect. Setting this " -"attribute to 0 is the same as not setting it at all." +"fields in the instance. :attr:`_pack_` must already be defined " +"when :attr:`_fields_` is assigned, otherwise it will have no effect. Setting " +"this attribute to 0 is the same as not setting it at all." msgstr "" #: ../../library/ctypes.rst:2580 @@ -4092,16 +4099,16 @@ msgstr "" #: ../../library/ctypes.rst:2588 msgid "" -"An optional sequence that lists the names of unnamed (anonymous) fields. :" -"attr:`_anonymous_` must be already defined when :attr:`_fields_` is " +"An optional sequence that lists the names of unnamed (anonymous) " +"fields. :attr:`_anonymous_` must be already defined when :attr:`_fields_` is " "assigned, otherwise it will have no effect." msgstr "" #: ../../library/ctypes.rst:2592 msgid "" -"The fields listed in this variable must be structure or union type fields. :" -"mod:`ctypes` will create descriptors in the structure type that allows " -"accessing the nested fields directly, without the need to create the " +"The fields listed in this variable must be structure or union type " +"fields. :mod:`ctypes` will create descriptors in the structure type that " +"allows accessing the nested fields directly, without the need to create the " "structure or union field." msgstr "" @@ -4156,9 +4163,9 @@ msgstr "" #: ../../library/ctypes.rst:2622 msgid "" "It is possible to define sub-subclasses of structures, they inherit the " -"fields of the base class. If the subclass definition has a separate :attr:" -"`_fields_` variable, the fields specified in this are appended to the fields " -"of the base class." +"fields of the base class. If the subclass definition has a " +"separate :attr:`_fields_` variable, the fields specified in this are " +"appended to the fields of the base class." msgstr "" #: ../../library/ctypes.rst:2627 @@ -4181,9 +4188,9 @@ msgstr "" #: ../../library/ctypes.rst:2644 msgid "" -"The recommended way to create concrete array types is by multiplying any :" -"mod:`ctypes` data type with a non-negative integer. Alternatively, you can " -"subclass this type and define :attr:`_length_` and :attr:`_type_` class " +"The recommended way to create concrete array types is by multiplying " +"any :mod:`ctypes` data type with a non-negative integer. Alternatively, you " +"can subclass this type and define :attr:`_length_` and :attr:`_type_` class " "variables. Array elements can be read and written using standard subscript " "and slice accesses; for slice reads, the resulting object is *not* itself " "an :class:`Array`." @@ -4192,8 +4199,8 @@ msgstr "" #: ../../library/ctypes.rst:2654 msgid "" "A positive integer specifying the number of elements in the array. Out-of-" -"range subscripts result in an :exc:`IndexError`. Will be returned by :func:" -"`len`." +"range subscripts result in an :exc:`IndexError`. Will be returned " +"by :func:`len`." msgstr "" #: ../../library/ctypes.rst:2661 @@ -4208,8 +4215,8 @@ msgstr "" #: ../../library/ctypes.rst:2669 msgid "" -"Create an array. Equivalent to ``type * length``, where *type* is a :mod:" -"`ctypes` data type and *length* an integer." +"Create an array. Equivalent to ``type * length``, where *type* is " +"a :mod:`ctypes` data type and *length* an integer." msgstr "" #: ../../library/ctypes.rst:2673 @@ -4231,10 +4238,10 @@ msgstr "" #: ../../library/ctypes.rst:2685 msgid "" "If a pointer points to an array, its elements can be read and written using " -"standard subscript and slice accesses. Pointer objects have no size, so :" -"func:`len` will raise :exc:`TypeError`. Negative subscripts will read from " -"the memory *before* the pointer (as in C), and out-of-range subscripts will " -"probably crash with an access violation (if you're lucky)." +"standard subscript and slice accesses. Pointer objects have no size, " +"so :func:`len` will raise :exc:`TypeError`. Negative subscripts will read " +"from the memory *before* the pointer (as in C), and out-of-range subscripts " +"will probably crash with an access violation (if you're lucky)." msgstr "" #: ../../library/ctypes.rst:2695 diff --git a/library/dataclasses.po b/library/dataclasses.po index 8edd9a1fdb..4cf5400e32 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-14 00:15+0000\n" "PO-Revision-Date: 2023-02-11 15:02+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,7 +33,7 @@ msgid "" msgstr "" "該模組提供了一個裝飾器和函式,用於自動新增生成的\\ :term:`特殊方法 `,例如 :meth:`~object.__init__` 和 :meth:`~object.__repr__` 到使用者" -"定義的類。它最初在 :pep:`557` 中描述。" +"定義的類別。它最初在 :pep:`557` 中描述。" #: ../../library/dataclasses.rst:19 #, fuzzy @@ -79,8 +79,8 @@ msgid "" "Note that this method is automatically added to the class: it is not " "directly specified in the :class:`!InventoryItem` definition shown above." msgstr "" -"請注意,此方法會自動新增到類中:它不會在上面顯示的“InventoryItem”定義中直接指" -"定。" +"請注意,此方法會自動新增到類別中:它不會在上面顯示的 :class:`!InventoryItem` " +"定義中直接指定。" #: ../../library/dataclasses.rst:47 msgid "Module contents" @@ -103,8 +103,8 @@ msgid "" "`. With two exceptions described below, nothing in " "``@dataclass`` examines the type specified in the variable annotation." msgstr "" -"``@dataclass`` 裝飾器檢查類以找到 ``field``\\s。 ``field`` 被定義為具有 :" -"term:`type annotation ` 的類變數。除了下面描述的兩個例" +"``@dataclass`` 裝飾器檢查類別以找到 ``field``\\s。 ``field`` 被定義為具有 :" +"term:`type annotation ` 的類別變數。除了下面描述的兩個例" "外,``@dataclass`` 中沒有任何內容檢查變數註釋中指定的型別。" #: ../../library/dataclasses.rst:60 @@ -112,10 +112,9 @@ msgstr "" msgid "" "The order of the fields in all of the generated methods is the order in " "which they appear in the class definition." -msgstr "所有生成的方法中欄位的順序是它們在類定義中出現的順序。" +msgstr "所有生成的方法中欄位的順序是它們在類別定義中出現的順序。" #: ../../library/dataclasses.rst:63 -#, fuzzy msgid "" "The ``@dataclass`` decorator will add various \"dunder\" methods to the " "class, described below. If any of the added methods already exist in the " @@ -123,9 +122,9 @@ msgid "" "decorator returns the same class that it is called on; no new class is " "created." msgstr "" -"``@dataclass`` 裝飾器將向類新增各種“dunder”方法,如下所述。如果類中已存在任何" -"新增的方法,則行為取決於參數,如下所述。裝飾器回傳呼叫它的同一個類;沒有建立" -"新類。" +"如下所述,``@dataclass`` 裝飾器會向類別新增各種 \"dunder\" 方法。如果類別中已" +"存在任何新增的方法,則行為會取決於參數,如下方文件所述。裝飾器會回傳呼叫它的" +"同一個類別;不會建立新類別。" #: ../../library/dataclasses.rst:69 #, fuzzy @@ -153,6 +152,19 @@ msgid "" "class C:\n" " ..." msgstr "" +"@dataclass\n" +"class C:\n" +" ...\n" +"\n" +"@dataclass()\n" +"class C:\n" +" ...\n" +"\n" +"@dataclass(init=True, repr=True, eq=True, order=False, unsafe_hash=False, " +"frozen=False,\n" +" match_args=True, kw_only=False, slots=False, weakref_slot=False)\n" +"class C:\n" +" ..." #: ../../library/dataclasses.rst:87 msgid "The parameters to ``@dataclass`` are:" @@ -169,7 +181,7 @@ msgstr "*init*:如果為真(預設值),將生成一個 :meth:`~object.__ #, fuzzy msgid "" "If the class already defines :meth:`!__init__`, this parameter is ignored." -msgstr "如果該類已經定義了 :meth:`!__init__`,則忽略此參數。" +msgstr "如果該類別已經定義了 :meth:`!__init__`,則忽略此參數。" #: ../../library/dataclasses.rst:95 #, fuzzy @@ -182,15 +194,14 @@ msgid "" "quantity_on_hand=10)``." msgstr "" "*repr*:如果為真(預設值),將生成一個 :meth:`__repr__` 方法。生成的 repr 字" -"串將包含類名以及每個欄位的名稱和 repr,按照它們在類中定義的順序排列。不包括標" -"記為從 repr 中排除的欄位。例如:``InventoryItem(name='widget', " +"串將包含類別名稱以及每個欄位的名稱和 repr,按照它們在類別中定義的順序排列。不" +"包括標記為從 repr 中排除的欄位。例如:``InventoryItem(name='widget', " "unit_price=3.0, quantity_on_hand=10)``。" #: ../../library/dataclasses.rst:102 -#, fuzzy msgid "" "If the class already defines :meth:`!__repr__`, this parameter is ignored." -msgstr "如果該類已經定義了 :meth:`!__repr__`,則忽略此參數。" +msgstr "如果該類別已經定義了 :meth:`!__repr__`,則此參數會被忽略。" #: ../../library/dataclasses.rst:105 #, fuzzy @@ -201,13 +212,12 @@ msgid "" "type." msgstr "" "*eq*:如果為真(預設值),將生成一個 :meth:`~object.__eq__` 方法。此方法按順" -"序比較類,就好像它是其欄位的元組一樣。比較中的兩個實例必須屬於同一型別。" +"序比較類別,就好像它是其欄位的元組一樣。比較中的兩個實例必須屬於同一型別。" #: ../../library/dataclasses.rst:110 -#, fuzzy msgid "" "If the class already defines :meth:`!__eq__`, this parameter is ignored." -msgstr "如果該類已經定義了 :meth:`!__eq__`,則忽略此參數。" +msgstr "如果該類別已經定義了 :meth:`!__eq__`,則此參數會被忽略。" #: ../../library/dataclasses.rst:113 #, fuzzy @@ -220,16 +230,15 @@ msgid "" msgstr "" "*order*:如果為真(預設為 ``False``),:meth:`~object.__lt__`、:meth:" "`~object.__le__`、:meth:`~object.__gt__` 和 :meth:`~object.__ge__` 方法將是產" -"生。它們按順序比較類,就好像它是其欄位的元組一樣。比較中的兩個實例必須屬於同" -"一型別。如果 *order* 為真且 *eq* 為假,則會引發 :exc:`ValueError`。" +"生。它們按順序比較類別,就好像它是其欄位的元組一樣。比較中的兩個實例必須屬於" +"同一型別。如果 *order* 為真且 *eq* 為假,則會引發 :exc:`ValueError`。" #: ../../library/dataclasses.rst:120 -#, fuzzy msgid "" "If the class already defines any of :meth:`!__lt__`, :meth:`!__le__`, :meth:" "`!__gt__`, or :meth:`!__ge__`, then :exc:`TypeError` is raised." msgstr "" -"如果該類已經定義了 :meth:`!__lt__`、:meth:`!__le__`、:meth:`!__gt__` 或 :" +"如果該類別已經定義了 :meth:`!__lt__`、:meth:`!__le__`、:meth:`!__gt__` 或 :" "meth:`!__ge__` 中的任何一個,則引發 :exc:`TypeError`。" #: ../../library/dataclasses.rst:124 @@ -252,9 +261,9 @@ msgid "" "flags in the ``@dataclass`` decorator." msgstr "" ":meth:`!__hash__` 由內建的 :meth:`hash` 使用,當對像被新增到散列集合(如字典" -"和集合)時。擁有 :meth:`!__hash__` 意味著該類的實例是不可變的。可變性是一個複" -"雜的屬性,它取決於程序員的意圖 :meth:`!__eq__` 的存在和行為,以及 dataclass " -"裝飾器中的 *eq* 和 *frozen* 旗標的值." +"和集合)時。擁有 :meth:`!__hash__` 意味著該類別的實例是不可變的。可變性是一個" +"複雜的屬性,它取決於程序員的意圖 :meth:`!__eq__` 的存在和行為,以及 " +"dataclass 裝飾器中的 *eq* 和 *frozen* 旗標的值." #: ../../library/dataclasses.rst:134 #, fuzzy @@ -267,8 +276,8 @@ msgid "" msgstr "" "預設情況下,``@dataclass`` 不會隱式新增 :meth:`~object.__hash__` 方法,除非這" "樣做是安全的。它也不會新增或更改現有的明確定義的 :meth:`!__hash__` 方法。設定" -"類屬性 ``__hash__ = None`` 對 Python 具有特定含義,如 :meth:`!__hash__` 文件" -"中所述。" +"類別屬性 ``__hash__ = None`` 對 Python 具有特定含義,如 :meth:`!__hash__` 文" +"件中所述。" #: ../../library/dataclasses.rst:140 #, fuzzy @@ -283,8 +292,8 @@ msgstr "" "如果 :meth:`!__hash__` 沒有明確定義,或者如果它被設定為 ``None``,那麼 " "``@dataclass`` *可能* 新增一個隱式的 :meth:`!__hash__` 方法。雖然不推薦,但你" "可以強制 ``@dataclass`` 使用 ``unsafe_hash=True`` 建立一個 :meth:`!__hash__` " -"方法。如果你的類在邏輯上是不可變的但仍然可以改變,則可能是這種情況。這是一個" -"特殊的用例,應該仔細考慮。" +"方法。如果你的類別在邏輯上是不可變的但仍然可以改變,則可能是這種情況。這是一" +"個特殊的用例,應該仔細考慮。" #: ../../library/dataclasses.rst:147 #, fuzzy @@ -312,8 +321,8 @@ msgstr "" "如果 *eq* 和 *frozen* 都為真,預設情況下 ``@dataclass`` 會為你生成一個:meth:" "`!__hash__` 方法。如果 ``eq`` 為真且 ``frozen`` 為假,:meth:`!__hash__` 將被" "設定為 ``None``,將其標記為不可散列(它是不可散列的,因為它是可變的)。如果 " -"``eq`` 為假,:meth:`!__hash__` 將保持不變,這意味著將使用超類的 :meth:`!" -"__hash__` 方法(如果超類是 :class:`object`,這意味著它將回退到基於 id 的散" +"``eq`` 為假,:meth:`!__hash__` 將保持不變,這意味著將使用超類別的 :meth:`!" +"__hash__` 方法(如果超類別是 :class:`object`,這意味著它將回退到基於 id 的散" "列)。" #: ../../library/dataclasses.rst:160 @@ -326,21 +335,22 @@ msgid "" msgstr "" "*frozen*:如果為真(預設為 ``False``),分配給欄位將產生例外。這模擬了只讀的" "凍結實例。如果 :meth:`~object.__setattr__` 或 :meth:`~object.__delattr__` 在" -"類中定義,則 :exc:`TypeError` 被引發。請參閱下面的討論。" +"類別中定義,則 :exc:`TypeError` 被引發。請參閱下面的討論。" #: ../../library/dataclasses.rst:165 #, fuzzy msgid "" "*match_args*: If true (the default is ``True``), the :attr:`~object." -"__match_args__` tuple will be created from the list of parameters to the " -"generated :meth:`~object.__init__` method (even if :meth:`!__init__` is not " -"generated, see above). If false, or if :attr:`!__match_args__` is already " -"defined in the class, then :attr:`!__match_args__` will not be generated." +"__match_args__` tuple will be created from the list of non keyword-only " +"parameters to the generated :meth:`~object.__init__` method (even if :meth:`!" +"__init__` is not generated, see above). If false, or if :attr:`!" +"__match_args__` is already defined in the class, then :attr:`!" +"__match_args__` will not be generated." msgstr "" "*match_args*:如果為真(預設為 ``True``),``__match_args__`` 元組將從參數列" "表建立到生成的 :meth:`~object.__init__` 方法(即使 :meth: `!__init__` 未生" -"成,見上文)。如果為 false,或者類中已經定義了 :attr:`!__match_args__`,則不" -"會生成 :attr:`!__match_args__`。" +"成,見上文)。如果為 false,或者類別中已經定義了 :attr:`!__match_args__`,則" +"不會生成 :attr:`!__match_args__`。" #: ../../library/dataclasses.rst:174 #, fuzzy @@ -349,9 +359,8 @@ msgid "" "marked as keyword-only. If a field is marked as keyword-only, then the only " "effect is that the :meth:`~object.__init__` parameter generated from a " "keyword-only field must be specified with a keyword when :meth:`!__init__` " -"is called. There is no effect on any other aspect of dataclasses. See the :" -"term:`parameter` glossary entry for details. Also see the :const:`KW_ONLY` " -"section." +"is called. See the :term:`parameter` glossary entry for details. Also see " +"the :const:`KW_ONLY` section." msgstr "" "``kw_only``:如果為 true(預設值為 ``False``),則所有欄位將被標記為僅限關鍵" "字。如果一個欄位被標記為僅限關鍵字,那麼唯一的影響是從僅限關鍵字欄位生成的 :" @@ -359,7 +368,11 @@ msgstr "" "類別的任何其他方面都沒有影響。有關詳細資訊,請參閱 :term:`parameter` 詞彙表條" "目。另請參閱 :const:`KW_ONLY` 部分。" -#: ../../library/dataclasses.rst:185 +#: ../../library/dataclasses.rst:182 +msgid "Keyword-only fields are not included in :attr:`!__match_args__`." +msgstr "" + +#: ../../library/dataclasses.rst:186 #, fuzzy msgid "" "*slots*: If true (the default is ``False``), :attr:`~object.__slots__` " @@ -368,10 +381,10 @@ msgid "" "exc:`TypeError` is raised." msgstr "" "``slots``:如果為 true(預設為 ``False``),將生成 :attr:`~object.__slots__` " -"屬性並回傳新類而不是原始類。如果 :attr:`!__slots__` 已經在類中定義,則 :exc:" -"`TypeError` 被引發。" +"屬性並回傳新類別而不是原始類別。如果 :attr:`!__slots__` 已經在類別中定義," +"則 :exc:`TypeError` 被引發。" -#: ../../library/dataclasses.rst:191 +#: ../../library/dataclasses.rst:192 #, fuzzy msgid "" "Calling no-arg :func:`super` in dataclasses using ``slots=True`` will result " @@ -380,10 +393,10 @@ msgid "" "valid workaround. See :gh:`90562` for full details." msgstr "" "``slots``:如果為 true(預設為 ``False``),將生成 :attr:`~object.__slots__` " -"屬性並回傳新類而不是原始類。如果 :attr:`!__slots__` 已經在類中定義,則 :exc:" -"`TypeError` 被引發。" +"屬性並回傳新類別而不是原始類別。如果 :attr:`!__slots__` 已經在類別中定義," +"則 :exc:`TypeError` 被引發。" -#: ../../library/dataclasses.rst:198 +#: ../../library/dataclasses.rst:199 msgid "" "Passing parameters to a base class :meth:`~object.__init_subclass__` when " "using ``slots=True`` will result in a :exc:`TypeError`. Either use " @@ -391,7 +404,7 @@ msgid "" "workaround. See :gh:`91126` for full details." msgstr "" -#: ../../library/dataclasses.rst:206 +#: ../../library/dataclasses.rst:207 #, fuzzy msgid "" "If a field name is already included in the :attr:`!__slots__` of a base " @@ -407,7 +420,7 @@ msgstr "" "夠確定繼承的插槽,基底類別 :attr:`!__slots__` 可以是任何可疊代的,但*不是*疊" "代器。" -#: ../../library/dataclasses.rst:216 +#: ../../library/dataclasses.rst:217 #, fuzzy msgid "" "*weakref_slot*: If true (the default is ``False``), add a slot named " @@ -419,14 +432,14 @@ msgstr "" "插槽,這是使實例可弱引用所必需的。在沒有指定 ``slots=True`` 的情況下指定 " "``weakref_slot=True`` 是錯誤的。" -#: ../../library/dataclasses.rst:224 +#: ../../library/dataclasses.rst:225 #, fuzzy msgid "" "``field``\\s may optionally specify a default value, using normal Python " "syntax::" msgstr "``field``\\s 可以選擇指定一個預設值,使用普通的 Python 語法: ::" -#: ../../library/dataclasses.rst:227 +#: ../../library/dataclasses.rst:228 msgid "" "@dataclass\n" "class C:\n" @@ -434,7 +447,7 @@ msgid "" " b: int = 0 # assign a default value for 'b'" msgstr "" -#: ../../library/dataclasses.rst:232 +#: ../../library/dataclasses.rst:233 #, fuzzy msgid "" "In this example, both :attr:`!a` and :attr:`!b` will be included in the " @@ -443,11 +456,11 @@ msgstr "" "在此示例中,:attr:`!a` 和 :attr:`!b` 都將包含在新增的 :meth:`~object." "__init__` 方法中,該方法將定義為: ::" -#: ../../library/dataclasses.rst:235 +#: ../../library/dataclasses.rst:236 msgid "def __init__(self, a: int, b: int = 0):" -msgstr "" +msgstr "def __init__(self, a: int, b: int = 0):" -#: ../../library/dataclasses.rst:237 +#: ../../library/dataclasses.rst:238 #, fuzzy msgid "" ":exc:`TypeError` will be raised if a field without a default value follows a " @@ -455,9 +468,9 @@ msgid "" "class, or as a result of class inheritance." msgstr "" ":exc:`TypeError` 如果沒有預設值的欄位跟在具有預設值的欄位之後,將引發。無論這" -"發生在單個類中還是作為類繼承的結果,都是如此。" +"發生在單個類別中還是作為類別繼承的結果,都是如此。" -#: ../../library/dataclasses.rst:243 +#: ../../library/dataclasses.rst:244 #, fuzzy msgid "" "For common and simple use cases, no other functionality is required. There " @@ -470,7 +483,7 @@ msgstr "" "位資訊。為了滿足這種對附加資訊的需求,你可以通過呼叫提供的 :func:`!field` 函" "式來替換預設欄位值。例如: ::" -#: ../../library/dataclasses.rst:249 +#: ../../library/dataclasses.rst:250 msgid "" "@dataclass\n" "class C:\n" @@ -479,8 +492,14 @@ msgid "" "c = C()\n" "c.mylist += [1, 2, 3]" msgstr "" +"@dataclass\n" +"class C:\n" +" mylist: list[int] = field(default_factory=list)\n" +"\n" +"c = C()\n" +"c.mylist += [1, 2, 3]" -#: ../../library/dataclasses.rst:256 +#: ../../library/dataclasses.rst:257 #, fuzzy msgid "" "As shown above, the :const:`MISSING` value is a sentinel object used to " @@ -489,14 +508,14 @@ msgid "" "meaning. No code should directly use the :const:`MISSING` value." msgstr "" "如上所示,:const:`MISSING` 值是一個哨兵物件,用於檢測某些參數是否由使用者提" -"供。使用此標記是因為“None”對於某些具有不同含義的參數是有效值。任何程式碼都不" -"應直接使用 :const:`MISSING` 值。" +"供。使用此標記是因為 ``None`` 對於某些具有不同含義的參數是有效值。任何程式碼" +"都不應直接使用 :const:`MISSING` 值。" -#: ../../library/dataclasses.rst:261 +#: ../../library/dataclasses.rst:262 msgid "The parameters to :func:`!field` are:" msgstr ":func:`!field` 的參數是:" -#: ../../library/dataclasses.rst:263 +#: ../../library/dataclasses.rst:264 #, fuzzy msgid "" "*default*: If provided, this will be the default value for this field. This " @@ -506,7 +525,7 @@ msgstr "" "*default*:如果提供,這將是該欄位的預設值。這是必需的,因為 :meth:`!field` 呼" "叫本身會替換預設值的正常位置。" -#: ../../library/dataclasses.rst:267 +#: ../../library/dataclasses.rst:268 #, fuzzy msgid "" "*default_factory*: If provided, it must be a zero-argument callable that " @@ -519,7 +538,7 @@ msgstr "" "時將被呼叫。除其他用途外,這可用於指定具有可變預設值的欄位,如下所述。同時指" "定 *default* 和 *default_factory* 是錯誤的。" -#: ../../library/dataclasses.rst:273 +#: ../../library/dataclasses.rst:274 #, fuzzy msgid "" "*init*: If true (the default), this field is included as a parameter to the " @@ -528,7 +547,7 @@ msgstr "" "*init*:如果為 true(預設值),則此欄位將作為生成的 :meth:`~object.__init__` " "方法的參數包含在內。" -#: ../../library/dataclasses.rst:276 +#: ../../library/dataclasses.rst:277 #, fuzzy msgid "" "*repr*: If true (the default), this field is included in the string returned " @@ -537,21 +556,23 @@ msgstr "" "*repr*:如果為真(預設值),則此欄位包含在生成的 :meth:`~object.__repr__` 方" "法回傳的字串中。" -#: ../../library/dataclasses.rst:279 +#: ../../library/dataclasses.rst:280 #, fuzzy msgid "" "*hash*: This can be a bool or ``None``. If true, this field is included in " -"the generated :meth:`~object.__hash__` method. If ``None`` (the default), " -"use the value of *compare*: this would normally be the expected behavior. A " -"field should be considered in the hash if it's used for comparisons. " -"Setting this value to anything other than ``None`` is discouraged." +"the generated :meth:`~object.__hash__` method. If false, this field is " +"excluded from the generated :meth:`~object.__hash__`. If ``None`` (the " +"default), use the value of *compare*: this would normally be the expected " +"behavior, since a field should be included in the hash if it's used for " +"comparisons. Setting this value to anything other than ``None`` is " +"discouraged." msgstr "" "*hash*:這可以是 bool 或 ``None``。如果為真,則此欄位包含在生成的 :meth:" -"`__hash__` 方法中。如果“無”(預設值),則使用“比較”的值:這通常是預期的行為。" -"如果一個欄位用於比較,則應在雜湊中考慮該欄位。不鼓勵將此值設定為“無”以外的任" -"何值。" +"`__hash__` 方法中。如果 ``None``\\ (預設值),則使用\\ *比較*\\ 的值:這通常" +"是預期的行為。如果一個欄位用於比較,則應在雜湊中考慮該欄位。不鼓勵將此值設定" +"為 ``None`` 以外的任何值。" -#: ../../library/dataclasses.rst:286 +#: ../../library/dataclasses.rst:288 #, fuzzy msgid "" "One possible reason to set ``hash=False`` but ``compare=True`` would be if a " @@ -564,7 +585,7 @@ msgstr "" "湊值的成本很高,則需要該欄位進行相等性測試,並且還有其他欄位有助於型別的雜湊" "值。即使一個欄位被排除在雜湊之外,它仍然會被用於比較。" -#: ../../library/dataclasses.rst:292 +#: ../../library/dataclasses.rst:294 #, fuzzy msgid "" "*compare*: If true (the default), this field is included in the generated " @@ -574,7 +595,7 @@ msgstr "" "*compare*:如果為真(預設值),則此欄位包含在生成的相等和比較方法中(:meth:" "`~object.__eq__`、:meth:`~object.__gt__` 等)。" -#: ../../library/dataclasses.rst:296 +#: ../../library/dataclasses.rst:298 #, fuzzy msgid "" "*metadata*: This can be a mapping or ``None``. ``None`` is treated as an " @@ -589,7 +610,7 @@ msgstr "" "不被資料類別使用,而是作為第三方擴充機制提供的。多個第三方可以各自擁有自己的" "密鑰,用作元資料中的命名空間。" -#: ../../library/dataclasses.rst:304 +#: ../../library/dataclasses.rst:306 #, fuzzy msgid "" "*kw_only*: If true, this field will be marked as keyword-only. This is used " @@ -599,6 +620,10 @@ msgstr "" "`~object.__init__` 方法的參數時使用。" #: ../../library/dataclasses.rst:310 +msgid "Keyword-only fields are also not included in :attr:`!__match_args__`." +msgstr "" + +#: ../../library/dataclasses.rst:314 #, fuzzy msgid "" "If the default value of a field is specified by a call to :func:`!field`, " @@ -614,7 +639,7 @@ msgstr "" "在 :func:`@dataclass ` 裝飾器運行後,類別屬性將全部包含欄位的預設" "值,就像預設值本身已指定一樣。例如,在: ::" -#: ../../library/dataclasses.rst:319 +#: ../../library/dataclasses.rst:323 msgid "" "@dataclass\n" "class C:\n" @@ -623,8 +648,14 @@ msgid "" " z: int = field(repr=False, default=10)\n" " t: int = 20" msgstr "" +"@dataclass\n" +"class C:\n" +" x: int\n" +" y: int = field(repr=False)\n" +" z: int = field(repr=False, default=10)\n" +" t: int = 20" -#: ../../library/dataclasses.rst:326 +#: ../../library/dataclasses.rst:330 #, fuzzy msgid "" "The class attribute :attr:`!C.z` will be ``10``, the class attribute :attr:`!" @@ -634,7 +665,7 @@ msgstr "" "類別屬性 :attr:`!C.z` 將為 ``10``,類別屬性 :attr:`!C.t` 將為 ``20``,類別屬" "性 :attr:`!C.x` 和 :attr:`!C.y` 將不會放。" -#: ../../library/dataclasses.rst:332 +#: ../../library/dataclasses.rst:336 #, fuzzy msgid "" ":class:`!Field` objects describe each defined field. These objects are " @@ -646,15 +677,15 @@ msgstr "" "`fields` 模組級方法回傳(見下文)。使用者不應該直接實例化 :class:`!Field` 物" "件。它記錄的屬性是:" -#: ../../library/dataclasses.rst:337 +#: ../../library/dataclasses.rst:341 msgid ":attr:`!name`: The name of the field." msgstr ":attr:`!name`:欄位的名稱。" -#: ../../library/dataclasses.rst:338 +#: ../../library/dataclasses.rst:342 msgid ":attr:`!type`: The type of the field." msgstr ":attr:`!type`:欄位的型別。" -#: ../../library/dataclasses.rst:339 +#: ../../library/dataclasses.rst:343 #, fuzzy msgid "" ":attr:`!default`, :attr:`!default_factory`, :attr:`!init`, :attr:`!repr`, :" @@ -665,14 +696,23 @@ msgstr "" "attr:`!hash`、:attr:`!compare`, :attr:`!metadata` 和 :attr:`!kw_only` 有與它" "們在 :func:`field` 函式中的含義和值相同。" -#: ../../library/dataclasses.rst:343 +#: ../../library/dataclasses.rst:347 #, fuzzy msgid "" "Other attributes may exist, but they are private and must not be inspected " "or relied on." msgstr "可能存在其他屬性,但它們是私有的,不得檢查或依賴。" -#: ../../library/dataclasses.rst:348 +#: ../../library/dataclasses.rst:352 +msgid "" +"``InitVar[T]`` type annotations describe variables that are :ref:`init-only " +"`. Fields annotated with :class:`!InitVar` " +"are considered pseudo-fields, and thus are neither returned by the :func:" +"`fields` function nor used in any way except adding them as parameters to :" +"meth:`~object.__init__` and an optional :meth:`__post_init__`." +msgstr "" + +#: ../../library/dataclasses.rst:361 #, fuzzy msgid "" "Returns a tuple of :class:`Field` objects that define the fields for this " @@ -684,7 +724,7 @@ msgstr "" "實例。如果未傳遞資料類別或其中一個實例,則引發 :exc:`TypeError`。不回傳 " "``ClassVar`` 或 ``InitVar`` 的偽欄位。" -#: ../../library/dataclasses.rst:355 +#: ../../library/dataclasses.rst:368 #, fuzzy msgid "" "Converts the dataclass *obj* to a dict (by using the factory function " @@ -696,12 +736,12 @@ msgstr "" "都被轉換為其欄位的字典,作為 ``name: value`` 對。資料類別、字典、列表和元組被" "遞迴到。其他物件使用 :func:`copy.deepcopy` 複製。" -#: ../../library/dataclasses.rst:361 +#: ../../library/dataclasses.rst:374 #, fuzzy msgid "Example of using :func:`!asdict` on nested dataclasses::" msgstr "在嵌套資料類別上使用 :func:`!asdict` 的範例: ::" -#: ../../library/dataclasses.rst:363 +#: ../../library/dataclasses.rst:376 msgid "" "@dataclass\n" "class Point:\n" @@ -718,23 +758,37 @@ msgid "" "c = C([Point(0, 0), Point(10, 4)])\n" "assert asdict(c) == {'mylist': [{'x': 0, 'y': 0}, {'x': 10, 'y': 4}]}" msgstr "" +"@dataclass\n" +"class Point:\n" +" x: int\n" +" y: int\n" +"\n" +"@dataclass\n" +"class C:\n" +" mylist: list[Point]\n" +"\n" +"p = Point(10, 20)\n" +"assert asdict(p) == {'x': 10, 'y': 20}\n" +"\n" +"c = C([Point(0, 0), Point(10, 4)])\n" +"assert asdict(c) == {'mylist': [{'x': 0, 'y': 0}, {'x': 10, 'y': 4}]}" -#: ../../library/dataclasses.rst:378 ../../library/dataclasses.rst:398 +#: ../../library/dataclasses.rst:391 ../../library/dataclasses.rst:411 #, fuzzy msgid "To create a shallow copy, the following workaround may be used::" msgstr "要建立淺複製,可以使用以下解決方法:" -#: ../../library/dataclasses.rst:380 +#: ../../library/dataclasses.rst:393 msgid "{field.name: getattr(obj, field.name) for field in fields(obj)}" msgstr "" -#: ../../library/dataclasses.rst:382 +#: ../../library/dataclasses.rst:395 #, fuzzy msgid "" ":func:`!asdict` raises :exc:`TypeError` if *obj* is not a dataclass instance." msgstr ":func:`!asdict` 如果 *obj* 不是資料類別實例,則引發 :exc:`TypeError`。" -#: ../../library/dataclasses.rst:387 +#: ../../library/dataclasses.rst:400 #, fuzzy msgid "" "Converts the dataclass *obj* to a tuple (by using the factory function " @@ -746,21 +800,23 @@ msgstr "" "都被轉換為其欄位值的元組。資料類別、字典、列表和元組被遞迴到。其他物件使用 :" "func:`copy.deepcopy` 複製。" -#: ../../library/dataclasses.rst:393 +#: ../../library/dataclasses.rst:406 msgid "Continuing from the previous example::" msgstr "從前面的例子繼續: ::" -#: ../../library/dataclasses.rst:395 +#: ../../library/dataclasses.rst:408 msgid "" "assert astuple(p) == (10, 20)\n" "assert astuple(c) == ([(0, 0), (10, 4)],)" msgstr "" +"assert astuple(p) == (10, 20)\n" +"assert astuple(c) == ([(0, 0), (10, 4)],)" -#: ../../library/dataclasses.rst:400 +#: ../../library/dataclasses.rst:413 msgid "tuple(getattr(obj, field.name) for field in dataclasses.fields(obj))" -msgstr "" +msgstr "tuple(getattr(obj, field.name) for field in dataclasses.fields(obj))" -#: ../../library/dataclasses.rst:402 +#: ../../library/dataclasses.rst:415 #, fuzzy msgid "" ":func:`!astuple` raises :exc:`TypeError` if *obj* is not a dataclass " @@ -768,7 +824,7 @@ msgid "" msgstr "" ":func:`!astuple` 如果 *obj* 不是資料類別實例,則引發 :exc:`TypeError`。" -#: ../../library/dataclasses.rst:407 +#: ../../library/dataclasses.rst:420 #, fuzzy msgid "" "Creates a new dataclass with name *cls_name*, fields as defined in *fields*, " @@ -788,13 +844,13 @@ msgstr "" "``kw_only`` 的值, ``slots`` 和 ``weakref_slot`` 與它們在 :func:`dataclass` 中" "的含義相同。" -#: ../../library/dataclasses.rst:417 +#: ../../library/dataclasses.rst:430 msgid "" "If *module* is defined, the :attr:`!__module__` attribute of the dataclass " "is set to that value. By default, it is set to the module name of the caller." msgstr "" -#: ../../library/dataclasses.rst:421 +#: ../../library/dataclasses.rst:434 #, fuzzy msgid "" "This function is not strictly required, because any Python mechanism for " @@ -802,11 +858,11 @@ msgid "" "`@dataclass ` function to convert that class to a dataclass. " "This function is provided as a convenience. For example::" msgstr "" -"這個函式不是嚴格要求的,因為任何使用 ``__annotations__`` 建立新類的 Python 機" -"制都可以應用 :func:`dataclass` 函式將該類轉換為資料類別。提供此功能是為了方" -"便。例如: ::" +"這個函式不是嚴格要求的,因為任何使用 ``__annotations__`` 建立新類別的 Python " +"機制都可以應用 :func:`dataclass` 函式將該類別轉換為資料類別。提供此功能是為了" +"方便。例如: ::" -#: ../../library/dataclasses.rst:427 +#: ../../library/dataclasses.rst:440 msgid "" "C = make_dataclass('C',\n" " [('x', int),\n" @@ -814,12 +870,17 @@ msgid "" " ('z', int, field(default=5))],\n" " namespace={'add_one': lambda self: self.x + 1})" msgstr "" +"C = make_dataclass('C',\n" +" [('x', int),\n" +" 'y',\n" +" ('z', int, field(default=5))],\n" +" namespace={'add_one': lambda self: self.x + 1})" -#: ../../library/dataclasses.rst:433 +#: ../../library/dataclasses.rst:446 msgid "Is equivalent to::" msgstr "相當於: ::" -#: ../../library/dataclasses.rst:435 +#: ../../library/dataclasses.rst:448 msgid "" "@dataclass\n" "class C:\n" @@ -831,7 +892,7 @@ msgid "" " return self.x + 1" msgstr "" -#: ../../library/dataclasses.rst:446 +#: ../../library/dataclasses.rst:459 #, fuzzy msgid "" "Creates a new object of the same type as *obj*, replacing fields with values " @@ -843,7 +904,7 @@ msgstr "" "``obj`` 不是資料類別,則引發 :exc:`TypeError`。如果 ``changes`` 中的值未指定" "欄位,則引發 :exc:`TypeError`。" -#: ../../library/dataclasses.rst:451 +#: ../../library/dataclasses.rst:464 #, fuzzy msgid "" "The newly returned object is created by calling the :meth:`~object.__init__` " @@ -853,7 +914,7 @@ msgstr "" "新回傳的對像是通過呼叫資料類別的 :meth:`~object.__init__` 方法建立的。這確" "保 :meth:`__post_init__`(如果存在)也被呼叫。" -#: ../../library/dataclasses.rst:455 +#: ../../library/dataclasses.rst:468 #, fuzzy msgid "" "Init-only variables without default values, if any exist, must be specified " @@ -863,7 +924,7 @@ msgstr "" "沒有預設值的僅初始化變數(如果存在)必須在呼叫 :func:`replace` 時指定,以便它" "們可以傳遞給 :meth:`__init__` 和 :meth:`__post_init__`。" -#: ../../library/dataclasses.rst:459 +#: ../../library/dataclasses.rst:472 #, fuzzy msgid "" "It is an error for *changes* to contain any fields that are defined as " @@ -872,7 +933,7 @@ msgstr "" "*changes* 包含任何定義為具有 ``init=False`` 的欄位是錯誤的。在這種情況下將引" "發 :exc:`ValueError`。" -#: ../../library/dataclasses.rst:463 +#: ../../library/dataclasses.rst:476 #, fuzzy msgid "" "Be forewarned about how ``init=False`` fields work during a call to :func:`!" @@ -885,17 +946,17 @@ msgid "" msgstr "" "預先警告 ``init=False`` 欄位在呼叫 :func:`!replace` 期間是如何工作的。它們不" "是從源物件複製的,而是在 :meth:`__post_init__` 中初始化的,如果它們被初始化的" -"話。預計 ``init=False`` 欄位將很少被明智地使用。如果使用它們,使用替代的類構" -"造函式可能是明智的,或者可能是處理實例複製的自定義:func:`!replace` (或類似命" -"名的)方法。" +"話。預計 ``init=False`` 欄位將很少被明智地使用。如果使用它們,使用替代的類別" +"建構函式可能是明智的,或者可能是處理實例複製的自定義:func:`!replace` (或類似" +"命名的)方法。" -#: ../../library/dataclasses.rst:472 +#: ../../library/dataclasses.rst:485 msgid "" "Dataclass instances are also supported by generic function :func:`copy." "replace`." msgstr "" -#: ../../library/dataclasses.rst:476 +#: ../../library/dataclasses.rst:489 #, fuzzy msgid "" "Return ``True`` if its parameter is a dataclass (including subclasses of a " @@ -903,28 +964,28 @@ msgid "" msgstr "" "如果它的參數是一個資料類別或一個實例,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/dataclasses.rst:479 +#: ../../library/dataclasses.rst:492 #, fuzzy msgid "" "If you need to know if a class is an instance of a dataclass (and not a " "dataclass itself), then add a further check for ``not isinstance(obj, " "type)``::" msgstr "" -"如果你需要知道一個類是否是資料類別的實例(而不是資料類別本身),那麼新增一個" -"進一步的檢查 ``not isinstance(obj, type)``: ::" +"如果你需要知道一個類別是否是資料類別的實例(而不是資料類別本身),那麼新增一" +"個進一步的檢查 ``not isinstance(obj, type)``: ::" -#: ../../library/dataclasses.rst:483 +#: ../../library/dataclasses.rst:496 msgid "" "def is_dataclass_instance(obj):\n" " return is_dataclass(obj) and not isinstance(obj, type)" msgstr "" -#: ../../library/dataclasses.rst:488 +#: ../../library/dataclasses.rst:501 #, fuzzy msgid "A sentinel value signifying a missing default or default_factory." msgstr "表示缺少 default 或 default_factory 的標記值。" -#: ../../library/dataclasses.rst:492 +#: ../../library/dataclasses.rst:505 #, fuzzy msgid "" "A sentinel value used as a type annotation. Any fields after a pseudo-field " @@ -938,16 +999,16 @@ msgstr "" "用作型別註釋的標記值。型別為 :const:`!KW_ONLY` 的偽欄位之後的任何欄位都被標記" "為僅關鍵字欄位。請注意,:const:`!KW_ONLY` 型別的偽欄位將被完全忽略。這包括此" "類欄位的名稱。按照慣例,名稱 ``_`` 用於 :const:`!KW_ONLY` 欄位。僅關鍵字欄位" -"表示 :meth:`~object.__init__` 參數,在實例化類時必須將其指定為關鍵字。" +"表示 :meth:`~object.__init__` 參數,在實例化類別時必須將其指定為關鍵字。" -#: ../../library/dataclasses.rst:501 +#: ../../library/dataclasses.rst:514 #, fuzzy msgid "" "In this example, the fields ``y`` and ``z`` will be marked as keyword-only " "fields::" msgstr "在此示例中,欄位 ``y`` 和 ``z`` 將被標記為僅關鍵字欄位: ::" -#: ../../library/dataclasses.rst:503 +#: ../../library/dataclasses.rst:516 msgid "" "@dataclass\n" "class Point:\n" @@ -958,15 +1019,23 @@ msgid "" "\n" "p = Point(0, y=1.5, z=2.0)" msgstr "" +"@dataclass\n" +"class Point:\n" +" x: float\n" +" _: KW_ONLY\n" +" y: float\n" +" z: float\n" +"\n" +"p = Point(0, y=1.5, z=2.0)" -#: ../../library/dataclasses.rst:512 +#: ../../library/dataclasses.rst:525 #, fuzzy msgid "" "In a single dataclass, it is an error to specify more than one field whose " "type is :const:`!KW_ONLY`." msgstr "在單個資料類別中,指定多個型別為 :const:`!KW_ONLY` 的欄位是錯誤的。" -#: ../../library/dataclasses.rst:519 +#: ../../library/dataclasses.rst:532 #, fuzzy msgid "" "Raised when an implicitly defined :meth:`~object.__setattr__` or :meth:" @@ -976,12 +1045,12 @@ msgstr "" "當在使用 frozen=True 定義的資料類別上呼叫隱式定義的 :meth:`__setattr__` 或 :" "meth:`__delattr__` 時引發。它是 :exc:`AttributeError` 的子類別。" -#: ../../library/dataclasses.rst:526 +#: ../../library/dataclasses.rst:539 #, fuzzy msgid "Post-init processing" msgstr "初始化後處理" -#: ../../library/dataclasses.rst:530 +#: ../../library/dataclasses.rst:543 #, fuzzy msgid "" "When defined on the class, it will be called by the generated :meth:`~object." @@ -992,19 +1061,19 @@ msgid "" "automatically be called." msgstr "" "生成的 :meth:`~object.__init__` 程式碼將呼叫一個名為 :meth:`!self." -"__post_init__` 的方法,如果 :meth:`!__post_init__` 是在類上定義的。它通常被稱" -"為 ``self.!__post_init__()``。但是,如果定義了任何 ``InitVar`` 欄位,它們也將" -"按照它們在類中定義的順序傳遞給 :meth:`!__post_init__` 。如果沒有生成 :meth:`!" -"__init__` 方法,那麼 :meth:`!__post_init__` 將不會被自動呼叫。" +"__post_init__` 的方法,如果 :meth:`!__post_init__` 是在類別上定義的。它通常被" +"稱為 ``self.!__post_init__()``。但是,如果定義了任何 ``InitVar`` 欄位,它們也" +"將按照它們在類別中定義的順序傳遞給 :meth:`!__post_init__` 。如果沒有生成 :" +"meth:`!__init__` 方法,那麼 :meth:`!__post_init__` 將不會被自動呼叫。" -#: ../../library/dataclasses.rst:537 +#: ../../library/dataclasses.rst:550 #, fuzzy msgid "" "Among other uses, this allows for initializing field values that depend on " "one or more other fields. For example::" msgstr "在其他用途中,這允許初始化依賴於一個或多個其他欄位的欄位值。例如: ::" -#: ../../library/dataclasses.rst:540 +#: ../../library/dataclasses.rst:553 msgid "" "@dataclass\n" "class C:\n" @@ -1015,8 +1084,16 @@ msgid "" " def __post_init__(self):\n" " self.c = self.a + self.b" msgstr "" +"@dataclass\n" +"class C:\n" +" a: float\n" +" b: float\n" +" c: float = field(init=False)\n" +"\n" +" def __post_init__(self):\n" +" self.c = self.a + self.b" -#: ../../library/dataclasses.rst:549 +#: ../../library/dataclasses.rst:562 #, fuzzy msgid "" "The :meth:`~object.__init__` method generated by :func:`@dataclass " @@ -1028,7 +1105,7 @@ msgstr "" "類別 :meth:`!__init__` 方法。如果基底類別有一個必須呼叫的 :meth:`!__init__` " "方法,通常在 :meth:`__post_init__` 方法中呼叫此方法: ::" -#: ../../library/dataclasses.rst:554 +#: ../../library/dataclasses.rst:567 msgid "" "class Rectangle:\n" " def __init__(self, height, width):\n" @@ -1042,18 +1119,29 @@ msgid "" " def __post_init__(self):\n" " super().__init__(self.side, self.side)" msgstr "" +"class Rectangle:\n" +" def __init__(self, height, width):\n" +" self.height = height\n" +" self.width = width\n" +"\n" +"@dataclass\n" +"class Square(Rectangle):\n" +" side: float\n" +"\n" +" def __post_init__(self):\n" +" super().__init__(self.side, self.side)" -#: ../../library/dataclasses.rst:566 +#: ../../library/dataclasses.rst:579 #, fuzzy msgid "" "Note, however, that in general the dataclass-generated :meth:`!__init__` " "methods don't need to be called, since the derived dataclass will take care " "of initializing all fields of any base class that is a dataclass itself." msgstr "" -"但是請注意,通常不需要呼叫資料類別生成的 :meth:`!__init__` 方法,因為派生資料" +"但是請注意,通常不需要呼叫資料類別生成的 :meth:`!__init__` 方法,因為衍生資料" "類別將負責初始化作為資料類別本身的任何基底類別的所有欄位。" -#: ../../library/dataclasses.rst:570 +#: ../../library/dataclasses.rst:583 #, fuzzy msgid "" "See the section below on init-only variables for ways to pass parameters to :" @@ -1063,11 +1151,11 @@ msgstr "" "請參閱下面有關僅初始化變數的部分,了解將參數傳遞給 :meth:`!__post_init__` 的" "方法。另請參閱有關 :func:`replace` 如何處理 ``init=False`` 欄位的警告。" -#: ../../library/dataclasses.rst:577 +#: ../../library/dataclasses.rst:590 msgid "Class variables" msgstr "類別變數" -#: ../../library/dataclasses.rst:579 +#: ../../library/dataclasses.rst:592 #, fuzzy msgid "" "One of the few places where :func:`@dataclass ` actually inspects " @@ -1079,23 +1167,23 @@ msgid "" "`fields` function." msgstr "" ":func:`@dataclass ` 實際檢查欄位型別的少數地方之一是確定欄位是否" -"是 :pep:`526` 中定義的類變數。它通過檢查欄位的型別是否為 :data:`typing." +"是 :pep:`526` 中定義的類別變數。它通過檢查欄位的型別是否為 :data:`typing." "ClassVar` 來做到這一點。如果一個欄位是一個 ``ClassVar``,它就被排除在考慮之" "外,並被資料類別機制忽略。模組級 :func:`fields` 函式不會回傳此類別 " "``ClassVar`` 偽欄位。" -#: ../../library/dataclasses.rst:590 +#: ../../library/dataclasses.rst:603 #, fuzzy msgid "Init-only variables" msgstr "僅初始化變數" -#: ../../library/dataclasses.rst:592 +#: ../../library/dataclasses.rst:605 #, fuzzy msgid "" "Another place where :func:`@dataclass ` inspects a type " "annotation is to determine if a field is an init-only variable. It does " -"this by seeing if the type of a field is of type ``dataclasses.InitVar``. " -"If a field is an ``InitVar``, it is considered a pseudo-field called an init-" +"this by seeing if the type of a field is of type :class:`InitVar`. If a " +"field is an :class:`InitVar`, it is considered a pseudo-field called an init-" "only field. As it is not a true field, it is not returned by the module-" "level :func:`fields` function. Init-only fields are added as parameters to " "the generated :meth:`~object.__init__` method, and are passed to the " @@ -1107,16 +1195,16 @@ msgstr "" "是一個 ``InitVar``,它被認為是一個偽欄位,稱為 init-only 欄位。由於它不是真正" "的欄位,因此它不會由模組級 fields 函式回傳。 Init-only 欄位作為參數新增到生成" "的 :meth:`~object.__init__` 方法,並傳遞給可選的 :meth:`__post_init__` 方法。" -"它們不被資料類使用。" +"它們不被資料類別使用。" -#: ../../library/dataclasses.rst:602 +#: ../../library/dataclasses.rst:615 #, fuzzy msgid "" "For example, suppose a field will be initialized from a database, if a value " "is not provided when creating the class::" -msgstr "例如,假設一個欄位將從資料庫中初始化,如果在建立類時沒有提供值: ::" +msgstr "例如,假設一個欄位將從資料庫中初始化,如果在建立類別時沒有提供值: ::" -#: ../../library/dataclasses.rst:605 +#: ../../library/dataclasses.rst:618 msgid "" "@dataclass\n" "class C:\n" @@ -1130,8 +1218,19 @@ msgid "" "\n" "c = C(10, database=my_database)" msgstr "" +"@dataclass\n" +"class C:\n" +" i: int\n" +" j: int | None = None\n" +" database: InitVar[DatabaseType | None] = None\n" +"\n" +" def __post_init__(self, database):\n" +" if self.j is None and database is not None:\n" +" self.j = database.lookup('j')\n" +"\n" +"c = C(10, database=my_database)" -#: ../../library/dataclasses.rst:617 +#: ../../library/dataclasses.rst:630 #, fuzzy msgid "" "In this case, :func:`fields` will return :class:`Field` objects for :attr:`!" @@ -1140,11 +1239,11 @@ msgstr "" "在這種情況下,:func:`fields` 將為 :attr:`!i` 和 :attr:`!j` 回傳 :class:" "`Field` 物件,但不會為 :attr:`!database` 回傳。" -#: ../../library/dataclasses.rst:623 +#: ../../library/dataclasses.rst:636 msgid "Frozen instances" msgstr "凍結實例" -#: ../../library/dataclasses.rst:625 +#: ../../library/dataclasses.rst:638 #, fuzzy msgid "" "It is not possible to create truly immutable Python objects. However, by " @@ -1155,10 +1254,10 @@ msgid "" msgstr "" "不可能建立真正不可變的 Python 物件。但是,通過將 ``frozen=True`` 傳遞給 :" "func:`@dataclass ` 裝飾器,你可以模擬不變性。在這種情況下,資料類" -"別將向類新增 :meth:`~object.__setattr__` 和 :meth:`~object.__delattr__` 方" +"別將向類別新增 :meth:`~object.__setattr__` 和 :meth:`~object.__delattr__` 方" "法。這些方法在叫用時會引發 :exc:`FrozenInstanceError`。" -#: ../../library/dataclasses.rst:631 +#: ../../library/dataclasses.rst:644 #, fuzzy msgid "" "There is a tiny performance penalty when using ``frozen=True``: :meth:" @@ -1168,11 +1267,11 @@ msgstr "" "使用 ``frozen=True`` 時有一個微小的性能損失::meth:`~object.__init__` 不能使" "用簡單賦值來初始化欄位,必須使用 :meth:`!object.__setattr__`。" -#: ../../library/dataclasses.rst:640 +#: ../../library/dataclasses.rst:653 msgid "Inheritance" msgstr "繼承" -#: ../../library/dataclasses.rst:642 +#: ../../library/dataclasses.rst:655 #, fuzzy msgid "" "When the dataclass is being created by the :func:`@dataclass ` " @@ -1185,12 +1284,12 @@ msgid "" "order, derived classes override base classes. An example::" msgstr "" "當 :func:`@dataclass ` 裝飾器建立資料類別時,它會以反向 MRO(即" -"從 :class:`object` 開始)查看該類的所有基底類別,並且對於它找到的每個資料類" +"從 :class:`object` 開始)查看該類別的所有基底類別,並且對於它找到的每個資料類" "別,將該基底類別中的欄位新增到欄位的有序對映中。新增所有基底類別欄位後,它會" "將自己的欄位新增到有序對映中。所有生成的方法都將使用這種組合的、計算的有序欄" -"位對映。因為欄位是按插入順序排列的,所以派生類會覆蓋基底類別。一個例子: ::" +"位對映。因為欄位是按插入順序排列的,所以衍生類別會覆蓋基底類別。一個例子: ::" -#: ../../library/dataclasses.rst:652 +#: ../../library/dataclasses.rst:665 msgid "" "@dataclass\n" "class Base:\n" @@ -1202,8 +1301,17 @@ msgid "" " z: int = 10\n" " x: int = 15" msgstr "" +"@dataclass\n" +"class Base:\n" +" x: Any = 15.0\n" +" y: int = 0\n" +"\n" +"@dataclass\n" +"class C(Base):\n" +" z: int = 10\n" +" x: int = 15" -#: ../../library/dataclasses.rst:662 +#: ../../library/dataclasses.rst:675 #, fuzzy msgid "" "The final list of fields is, in order, :attr:`!x`, :attr:`!y`, :attr:`!z`. " @@ -1213,23 +1321,23 @@ msgstr "" "最終的欄位列表按順序為 :attr:`!x`、:attr:`!y`、:attr:`!z`。:attr:`!x` 的最終" "型別是 :class:`int`,如類別 :class:`!C` 中指定的那樣。" -#: ../../library/dataclasses.rst:665 +#: ../../library/dataclasses.rst:678 #, fuzzy msgid "" "The generated :meth:`~object.__init__` method for :class:`!C` will look " "like::" msgstr "為 :class:`!C` 生成的 :meth:`~object.__init__` 方法將如下所示: ::" -#: ../../library/dataclasses.rst:667 +#: ../../library/dataclasses.rst:680 msgid "def __init__(self, x: int = 15, y: int = 0, z: int = 10):" -msgstr "" +msgstr "def __init__(self, x: int = 15, y: int = 0, z: int = 10):" -#: ../../library/dataclasses.rst:670 +#: ../../library/dataclasses.rst:683 #, fuzzy msgid "Re-ordering of keyword-only parameters in :meth:`!__init__`" msgstr ":meth:`!__init__` 中僅關鍵字參數的重新排序" -#: ../../library/dataclasses.rst:672 +#: ../../library/dataclasses.rst:685 #, fuzzy msgid "" "After the parameters needed for :meth:`~object.__init__` are computed, any " @@ -1241,7 +1349,7 @@ msgstr "" "僅關鍵字)參數之後。這是如何在 Python 中實作僅關鍵字參數的要求:它們必須位於" "非僅關鍵字參數之後。" -#: ../../library/dataclasses.rst:678 +#: ../../library/dataclasses.rst:691 #, fuzzy msgid "" "In this example, :attr:`!Base.y`, :attr:`!Base.w`, and :attr:`!D.t` are " @@ -1251,7 +1359,7 @@ msgstr "" "在此示例中,:attr:`!Base.y`、:attr:`!Base.w` 和 :attr:`!D.t` 是僅限關鍵字的欄" "位,:attr:`!Base.x` 和 :attr:`!D.z` 是常規欄位: ::" -#: ../../library/dataclasses.rst:681 +#: ../../library/dataclasses.rst:694 msgid "" "@dataclass\n" "class Base:\n" @@ -1265,40 +1373,53 @@ msgid "" " z: int = 10\n" " t: int = field(kw_only=True, default=0)" msgstr "" +"@dataclass\n" +"class Base:\n" +" x: Any = 15.0\n" +" _: KW_ONLY\n" +" y: int = 0\n" +" w: int = 1\n" +"\n" +"@dataclass\n" +"class D(Base):\n" +" z: int = 10\n" +" t: int = field(kw_only=True, default=0)" -#: ../../library/dataclasses.rst:693 +#: ../../library/dataclasses.rst:706 #, fuzzy msgid "The generated :meth:`!__init__` method for :class:`!D` will look like::" msgstr "為 :class:`!D` 生成的 :meth:`!__init__` 方法將如下所示: ::" -#: ../../library/dataclasses.rst:695 +#: ../../library/dataclasses.rst:708 msgid "" "def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: " "int = 0):" msgstr "" +"def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: " +"int = 0):" -#: ../../library/dataclasses.rst:697 +#: ../../library/dataclasses.rst:710 #, fuzzy msgid "" "Note that the parameters have been re-ordered from how they appear in the " "list of fields: parameters derived from regular fields are followed by " "parameters derived from keyword-only fields." msgstr "" -"請注意,參數已根據它們在欄位列表中的顯示方式重新排序:從常規欄位派生的參數後" -"跟從僅關鍵字欄位派生的參數。" +"請注意,參數已根據它們在欄位列表中的顯示方式重新排序:從常規欄位衍生的參數後" +"跟從僅關鍵字欄位衍生的參數。" -#: ../../library/dataclasses.rst:701 +#: ../../library/dataclasses.rst:714 #, fuzzy msgid "" "The relative ordering of keyword-only parameters is maintained in the re-" "ordered :meth:`!__init__` parameter list." msgstr "僅關鍵字參數的相對順序在重新排序的 :meth:`!__init__` 參數列表中維護。" -#: ../../library/dataclasses.rst:706 +#: ../../library/dataclasses.rst:719 msgid "Default factory functions" msgstr "預設工廠函式" -#: ../../library/dataclasses.rst:708 +#: ../../library/dataclasses.rst:721 #, fuzzy msgid "" "If a :func:`field` specifies a *default_factory*, it is called with zero " @@ -1308,11 +1429,11 @@ msgstr "" "如果 :func:`field` 指定了 *default_factory*,當需要該欄位的預設值時,它會以零" "引數呼叫。例如,要建立列表的新實例,請使用: ::" -#: ../../library/dataclasses.rst:712 +#: ../../library/dataclasses.rst:725 msgid "mylist: list = field(default_factory=list)" -msgstr "" +msgstr "mylist: list = field(default_factory=list)" -#: ../../library/dataclasses.rst:714 +#: ../../library/dataclasses.rst:727 #, fuzzy msgid "" "If a field is excluded from :meth:`~object.__init__` (using ``init=False``) " @@ -1325,11 +1446,11 @@ msgstr "" "位還指定了 ``default_factory``,那麼預設工廠函式將始終從生成的 :meth:" "`__init__ 中呼叫`功能。發生這種情況是因為沒有其他方法可以為該欄位賦予初始值。" -#: ../../library/dataclasses.rst:721 +#: ../../library/dataclasses.rst:734 msgid "Mutable default values" msgstr "可變預設值" -#: ../../library/dataclasses.rst:723 +#: ../../library/dataclasses.rst:736 #, fuzzy msgid "" "Python stores default member variable values in class attributes. Consider " @@ -1337,7 +1458,7 @@ msgid "" msgstr "" "Python 將預設成員變數值存儲在類別屬性中。考慮這個例子,不使用資料類別: ::" -#: ../../library/dataclasses.rst:726 +#: ../../library/dataclasses.rst:739 msgid "" "class C:\n" " x = []\n" @@ -1351,8 +1472,19 @@ msgid "" "assert o1.x == [1, 2]\n" "assert o1.x is o2.x" msgstr "" +"class C:\n" +" x = []\n" +" def add(self, element):\n" +" self.x.append(element)\n" +"\n" +"o1 = C()\n" +"o2 = C()\n" +"o1.add(1)\n" +"o2.add(2)\n" +"assert o1.x == [1, 2]\n" +"assert o1.x is o2.x" -#: ../../library/dataclasses.rst:738 +#: ../../library/dataclasses.rst:751 #, fuzzy msgid "" "Note that the two instances of class :class:`!C` share the same class " @@ -1361,12 +1493,12 @@ msgstr "" "請注意,類別 :class:`!C` 的兩個實例共享同一個類別變數 :attr:`!x`,正如預期的" "那樣。" -#: ../../library/dataclasses.rst:741 +#: ../../library/dataclasses.rst:754 #, fuzzy msgid "Using dataclasses, *if* this code was valid::" msgstr "使用資料類別,*如果*此程式碼有效: ::" -#: ../../library/dataclasses.rst:743 +#: ../../library/dataclasses.rst:756 msgid "" "@dataclass\n" "class D:\n" @@ -1374,12 +1506,17 @@ msgid "" " def add(self, element):\n" " self.x.append(element)" msgstr "" +"@dataclass\n" +"class D:\n" +" x: list = [] # 這段程式碼會引發 ValueError\n" +" def add(self, element):\n" +" self.x.append(element)" -#: ../../library/dataclasses.rst:749 +#: ../../library/dataclasses.rst:762 msgid "it would generate code similar to::" msgstr "它會生成類似的程式碼: ::" -#: ../../library/dataclasses.rst:751 +#: ../../library/dataclasses.rst:764 msgid "" "class D:\n" " x = []\n" @@ -1390,8 +1527,16 @@ msgid "" "\n" "assert D().x is D().x" msgstr "" +"class D:\n" +" x = []\n" +" def __init__(self, x=x):\n" +" self.x = x\n" +" def add(self, element):\n" +" self.x.append(element)\n" +"\n" +"assert D().x is D().x" -#: ../../library/dataclasses.rst:760 +#: ../../library/dataclasses.rst:773 #, fuzzy msgid "" "This has the same issue as the original example using class :class:`!C`. " @@ -1405,20 +1550,20 @@ msgid "" "partial solution, but it does protect against many common errors." msgstr "" "這與使用類別 :class:`!C` 的原始示例存在相同的問題。也就是說,類別 :class:`!" -"D` 的兩個實例在建立類實例時沒有為 :attr:`!x` 指定值,它們將共享 :attr:`!x` 的" -"同一個副本。因為資料類別只是使用普通的 Python 類建立,所以它們也有這種行為。" -"資料類別沒有通用的方法來檢測這種情況。相反,如果 :func:`dataclass` 裝飾器檢測" -"到不可散列的預設參數,它將引發 :exc:`TypeError`。假設是如果一個值是不可散列" -"的,那麼它就是可變的。這是一個部分解決方案,但它確實可以防止許多常見錯誤。" +"D` 的兩個實例在建立類別實例時沒有為 :attr:`!x` 指定值,它們將共享 :attr:`!x` " +"的同一個副本。因為資料類別只是使用普通的 Python 類別建立,所以它們也有這種行" +"為。資料類別沒有通用的方法來檢測這種情況。相反,如果 :func:`dataclass` 裝飾器" +"檢測到不可散列的預設參數,它將引發 :exc:`TypeError`。假設是如果一個值是不可散" +"列的,那麼它就是可變的。這是一個部分解決方案,但它確實可以防止許多常見錯誤。" -#: ../../library/dataclasses.rst:771 +#: ../../library/dataclasses.rst:784 #, fuzzy msgid "" "Using default factory functions is a way to create new instances of mutable " "types as default values for fields::" msgstr "使用預設工廠函式是一種建立可變型別的新實例作為欄位預設值的方法: ::" -#: ../../library/dataclasses.rst:774 +#: ../../library/dataclasses.rst:787 msgid "" "@dataclass\n" "class D:\n" @@ -1426,8 +1571,13 @@ msgid "" "\n" "assert D().x is not D().x" msgstr "" +"@dataclass\n" +"class D:\n" +" x: list = field(default_factory=list)\n" +"\n" +"assert D().x is not D().x" -#: ../../library/dataclasses.rst:780 +#: ../../library/dataclasses.rst:793 #, fuzzy msgid "" "Instead of looking for and disallowing objects of type :class:`list`, :class:" @@ -1437,12 +1587,12 @@ msgstr "" "不再查找和禁止型別為 :class:`list`、:class:`dict` 或 :class:`set` 的物件,現" "在不允許使用不可散列的對像作為預設值。不可散列性用於近似可變性。" -#: ../../library/dataclasses.rst:787 +#: ../../library/dataclasses.rst:800 #, fuzzy msgid "Descriptor-typed fields" msgstr "描述器型別的欄位" -#: ../../library/dataclasses.rst:789 +#: ../../library/dataclasses.rst:802 #, fuzzy msgid "" "Fields that are assigned :ref:`descriptor objects ` as their " @@ -1450,7 +1600,7 @@ msgid "" msgstr "" "指定為\\ :ref:`描述器物件 `\\ 作為預設值的欄位具有以下特殊行為:" -#: ../../library/dataclasses.rst:792 +#: ../../library/dataclasses.rst:805 #, fuzzy msgid "" "The value for the field passed to the dataclass's :meth:`~object.__init__` " @@ -1460,7 +1610,7 @@ msgstr "" "傳遞給資料類別的 :meth:`~object.__init__` 方法的欄位值被傳遞給描述器的 :meth:" "`~object.__set__` 方法,而不是覆蓋描述器物件。" -#: ../../library/dataclasses.rst:796 +#: ../../library/dataclasses.rst:809 #, fuzzy msgid "" "Similarly, when getting or setting the field, the descriptor's :meth:" @@ -1470,7 +1620,7 @@ msgstr "" "同樣,在取得或設定欄位時,將呼叫描述器的 :meth:`~object.__get__` 或 :meth:`!" "__set__` 方法,而不是回傳或覆蓋描述器物件。" -#: ../../library/dataclasses.rst:800 +#: ../../library/dataclasses.rst:813 #, fuzzy msgid "" "To determine whether a field contains a default value, :func:`@dataclass " @@ -1480,13 +1630,13 @@ msgid "" "default. On the other hand, if the descriptor raises :exc:`AttributeError` " "in this situation, no default value will be provided for the field." msgstr "" -"為了確定一個欄位是否包含預設值,:func:`@dataclass ` 將使用其類存取" -"形式呼叫描述器的 :meth:`!__get__` 方法(即 ``descriptor.__get__(obj=None, " +"為了確定一個欄位是否包含預設值,:func:`@dataclass ` 將使用其類別存" +"取形式呼叫描述器的 :meth:`!__get__` 方法(即 ``descriptor.__get__(obj=None, " "type=cls)``。如果在這種情況下,描述器回傳一個值,它將用作欄位的預設值。另一方" "面,如果描述器在這種情況下引發 :exc:`AttributeError`,則不會為該欄位提供預設" "值。" -#: ../../library/dataclasses.rst:810 +#: ../../library/dataclasses.rst:823 msgid "" "class IntConversionDescriptor:\n" " def __init__(self, *, default):\n" @@ -1514,8 +1664,33 @@ msgid "" "i.quantity_on_hand = 2.5 # calls __set__ with 2.5\n" "print(i.quantity_on_hand) # 2" msgstr "" +"class IntConversionDescriptor:\n" +" def __init__(self, *, default):\n" +" self._default = default\n" +"\n" +" def __set_name__(self, owner, name):\n" +" self._name = \"_\" + name\n" +"\n" +" def __get__(self, obj, type):\n" +" if obj is None:\n" +" return self._default\n" +"\n" +" return getattr(obj, self._name, self._default)\n" +"\n" +" def __set__(self, obj, value):\n" +" setattr(obj, self._name, int(value))\n" +"\n" +"@dataclass\n" +"class InventoryItem:\n" +" quantity_on_hand: IntConversionDescriptor = " +"IntConversionDescriptor(default=100)\n" +"\n" +"i = InventoryItem()\n" +"print(i.quantity_on_hand) # 100\n" +"i.quantity_on_hand = 2.5 # 以 2.5 呼叫 __set__\n" +"print(i.quantity_on_hand) # 2" -#: ../../library/dataclasses.rst:835 +#: ../../library/dataclasses.rst:848 #, fuzzy msgid "" "Note that if a field is annotated with a descriptor type, but is not " diff --git a/library/datetime.po b/library/datetime.po index d1b39481c8..1bec6171ca 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-04-09 00:15+0000\n" "PO-Revision-Date: 2023-08-07 10:20+0800\n" "Last-Translator: Griiid \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1078,8 +1078,8 @@ msgstr "" #: ../../library/datetime.rst:669 msgid "" -"Return a date with the same value, except for those parameters given new " -"values by whichever keyword arguments are specified." +"Return a new :class:`date` object with the same values, but with specified " +"parameters updated." msgstr "" #: ../../library/datetime.rst:672 ../../library/datetime.rst:1937 @@ -1100,8 +1100,8 @@ msgstr "" #: ../../library/datetime.rst:679 msgid "" -":class:`date` objects are also supported by generic function :func:`copy." -"replace`." +"The generic function :func:`copy.replace` also supports :class:`date` " +"objects." msgstr "" #: ../../library/datetime.rst:685 ../../library/datetime.rst:1405 @@ -1331,7 +1331,7 @@ msgid "" "\n" ">>> # Methods for to extracting 'components' under different calendars\n" ">>> t = d.timetuple()\n" -">>> for i in t: \n" +">>> for i in t:\n" "... print(i)\n" "2002 # year\n" "3 # month\n" @@ -1343,7 +1343,7 @@ msgid "" "70 # 70th day in the year\n" "-1\n" ">>> ic = d.isocalendar()\n" -">>> for i in ic: \n" +">>> for i in ic:\n" "... print(i)\n" "2002 # ISO year\n" "11 # ISO week number\n" @@ -1664,7 +1664,7 @@ msgid "" ">>> datetime.fromisoformat('2011-11-04 00:05:23.283+00:00')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, tzinfo=datetime.timezone." "utc)\n" -">>> datetime.fromisoformat('2011-11-04T00:05:23+04:00') \n" +">>> datetime.fromisoformat('2011-11-04T00:05:23+04:00')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23,\n" " tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))" msgstr "" @@ -1686,7 +1686,7 @@ msgstr "" ">>> datetime.fromisoformat('2011-11-04 00:05:23.283+00:00')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23, 283000, tzinfo=datetime.timezone." "utc)\n" -">>> datetime.fromisoformat('2011-11-04T00:05:23+04:00') \n" +">>> datetime.fromisoformat('2011-11-04T00:05:23+04:00')\n" "datetime.datetime(2011, 11, 4, 0, 5, 23,\n" " tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))" @@ -1745,7 +1745,7 @@ msgid "" ">>> date_string = \"02/29\"\n" ">>> when = datetime.strptime(f\"{date_string};1984\", \"%m/%d;%Y\") # " "Avoids leap year bug.\n" -">>> when.strftime(\"%B %d\") \n" +">>> when.strftime(\"%B %d\")\n" "'February 29'" msgstr "" @@ -1957,10 +1957,10 @@ msgstr "" #: ../../library/datetime.rst:1318 msgid "" -"Return a datetime with the same attributes, except for those attributes " -"given new values by whichever keyword arguments are specified. Note that " -"``tzinfo=None`` can be specified to create a naive datetime from an aware " -"datetime with no conversion of date and time data." +"Return a new :class:`datetime` object with the same attributes, but with " +"specified parameters updated. Note that ``tzinfo=None`` can be specified to " +"create a naive datetime from an aware datetime with no conversion of date " +"and time data." msgstr "" #: ../../library/datetime.rst:1323 @@ -2310,14 +2310,14 @@ msgstr "" #: ../../library/datetime.rst:1563 msgid "" ">>> from datetime import datetime\n" -">>> datetime.now().isoformat(timespec='minutes') \n" +">>> datetime.now().isoformat(timespec='minutes')\n" "'2002-12-25T00:00'\n" ">>> dt = datetime(2015, 1, 1, 12, 30, 59, 0)\n" ">>> dt.isoformat(timespec='microseconds')\n" "'2015-01-01T12:30:59.000000'" msgstr "" ">>> from datetime import datetime\n" -">>> datetime.now().isoformat(timespec='minutes') \n" +">>> datetime.now().isoformat(timespec='minutes')\n" "'2002-12-25T00:00'\n" ">>> dt = datetime(2015, 1, 1, 12, 30, 59, 0)\n" ">>> dt.isoformat(timespec='microseconds')\n" @@ -2394,9 +2394,9 @@ msgid "" "datetime.datetime(2005, 7, 14, 12, 30)\n" "\n" ">>> # Using datetime.now()\n" -">>> datetime.now() \n" +">>> datetime.now()\n" "datetime.datetime(2007, 12, 6, 16, 29, 43, 79043) # GMT +1\n" -">>> datetime.now(timezone.utc) \n" +">>> datetime.now(timezone.utc)\n" "datetime.datetime(2007, 12, 6, 15, 29, 43, 79060, tzinfo=datetime.timezone." "utc)\n" "\n" @@ -2407,7 +2407,7 @@ msgid "" "\n" ">>> # Using datetime.timetuple() to get tuple of all attributes\n" ">>> tt = dt.timetuple()\n" -">>> for it in tt: \n" +">>> for it in tt:\n" "... print(it)\n" "...\n" "2006 # year\n" @@ -2422,7 +2422,7 @@ msgid "" "\n" ">>> # Date in ISO format\n" ">>> ic = dt.isocalendar()\n" -">>> for it in ic: \n" +">>> for it in ic:\n" "... print(it)\n" "...\n" "2006 # ISO year\n" @@ -2677,10 +2677,10 @@ msgstr "" #: ../../library/datetime.rst:1896 msgid "" -"Return a :class:`.time` with the same value, except for those attributes " -"given new values by whichever keyword arguments are specified. Note that " -"``tzinfo=None`` can be specified to create a naive :class:`.time` from an " -"aware :class:`.time`, without conversion of the time data." +"Return a new :class:`.time` with the same values, but with specified " +"parameters updated. Note that ``tzinfo=None`` can be specified to create a " +"naive :class:`.time` from an aware :class:`.time`, without conversion of the " +"time data." msgstr "" #: ../../library/datetime.rst:1901 diff --git a/library/dbm.po b/library/dbm.po index a3a5e9c26d..473658aa90 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-12 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -599,7 +599,7 @@ msgstr "" #: ../../library/dbm.rst:457 msgid "" "Synchronize the on-disk directory and data files. This method is called by " -"the :meth:`Shelve.sync` method." +"the :meth:`shelve.Shelf.sync` method." msgstr "" #: ../../library/dbm.rst:462 diff --git a/library/decimal.po b/library/decimal.po index 0563622d36..b2f4740813 100644 --- a/library/decimal.po +++ b/library/decimal.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-04-25 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -542,10 +542,12 @@ msgid "" "Other Unicode decimal digits are also permitted where ``digit`` appears " "above. These include decimal digits from various other alphabets (for " "example, Arabic-Indic and Devanāgarī digits) along with the fullwidth digits " -"``'\\uff10'`` through ``'\\uff19'``." +"``'\\uff10'`` through ``'\\uff19'``. Case is not significant, so, for " +"example, ``inf``, ``Inf``, ``INFINITY``, and ``iNfINity`` are all acceptable " +"spellings for positive infinity." msgstr "" -#: ../../library/decimal.rst:371 +#: ../../library/decimal.rst:373 msgid "" "If *value* is a :class:`tuple`, it should have three components, a sign " "(``0`` for positive or ``1`` for negative), a :class:`tuple` of digits, and " @@ -553,7 +555,7 @@ msgid "" "``Decimal('1.414')``." msgstr "" -#: ../../library/decimal.rst:376 +#: ../../library/decimal.rst:378 msgid "" "If *value* is a :class:`float`, the binary floating-point value is " "losslessly converted to its exact decimal equivalent. This conversion can " @@ -562,7 +564,7 @@ msgid "" "``Decimal('1.100000000000000088817841970012523233890533447265625')``." msgstr "" -#: ../../library/decimal.rst:382 +#: ../../library/decimal.rst:384 msgid "" "The *context* precision does not affect how many digits are stored. That is " "determined exclusively by the number of digits in *value*. For example, " @@ -570,7 +572,7 @@ msgid "" "is only three." msgstr "" -#: ../../library/decimal.rst:387 +#: ../../library/decimal.rst:389 msgid "" "The purpose of the *context* argument is determining what to do if *value* " "is a malformed string. If the context traps :const:`InvalidOperation`, an " @@ -578,29 +580,29 @@ msgid "" "the value of ``NaN``." msgstr "" -#: ../../library/decimal.rst:392 +#: ../../library/decimal.rst:394 msgid "Once constructed, :class:`Decimal` objects are immutable." msgstr "" -#: ../../library/decimal.rst:394 +#: ../../library/decimal.rst:396 msgid "" "The argument to the constructor is now permitted to be a :class:`float` " "instance." msgstr "" -#: ../../library/decimal.rst:398 +#: ../../library/decimal.rst:400 msgid "" ":class:`float` arguments raise an exception if the :exc:`FloatOperation` " "trap is set. By default the trap is off." msgstr "" -#: ../../library/decimal.rst:402 +#: ../../library/decimal.rst:404 msgid "" "Underscores are allowed for grouping, as with integral and floating-point " "literals in code." msgstr "" -#: ../../library/decimal.rst:406 +#: ../../library/decimal.rst:408 msgid "" "Decimal floating-point objects share many properties with the other built-in " "numeric types such as :class:`float` and :class:`int`. All of the usual " @@ -610,7 +612,7 @@ msgid "" "class:`int`)." msgstr "" -#: ../../library/decimal.rst:413 +#: ../../library/decimal.rst:415 msgid "" "There are some small differences between arithmetic on Decimal objects and " "arithmetic on integers and floats. When the remainder operator ``%`` is " @@ -618,7 +620,7 @@ msgid "" "*dividend* rather than the sign of the divisor::" msgstr "" -#: ../../library/decimal.rst:418 +#: ../../library/decimal.rst:420 msgid "" ">>> (-7) % 4\n" "1\n" @@ -630,14 +632,14 @@ msgstr "" ">>> Decimal(-7) % Decimal(4)\n" "Decimal('-3')" -#: ../../library/decimal.rst:423 +#: ../../library/decimal.rst:425 msgid "" "The integer division operator ``//`` behaves analogously, returning the " "integer part of the true quotient (truncating towards zero) rather than its " "floor, so as to preserve the usual identity ``x == (x // y) * y + x % y``::" msgstr "" -#: ../../library/decimal.rst:427 +#: ../../library/decimal.rst:429 msgid "" ">>> -7 // 4\n" "-2\n" @@ -649,13 +651,13 @@ msgstr "" ">>> Decimal(-7) // Decimal(4)\n" "Decimal('-1')" -#: ../../library/decimal.rst:432 +#: ../../library/decimal.rst:434 msgid "" "The ``%`` and ``//`` operators implement the ``remainder`` and ``divide-" "integer`` operations (respectively) as described in the specification." msgstr "" -#: ../../library/decimal.rst:436 +#: ../../library/decimal.rst:438 msgid "" "Decimal objects cannot generally be combined with floats or instances of :" "class:`fractions.Fraction` in arithmetic operations: an attempt to add a :" @@ -666,19 +668,19 @@ msgid "" "numbers of different types." msgstr "" -#: ../../library/decimal.rst:444 +#: ../../library/decimal.rst:446 msgid "" "Mixed-type comparisons between :class:`Decimal` instances and other numeric " "types are now fully supported." msgstr "" -#: ../../library/decimal.rst:448 +#: ../../library/decimal.rst:450 msgid "" "In addition to the standard numeric properties, decimal floating-point " "objects also have a number of specialized methods:" msgstr "" -#: ../../library/decimal.rst:454 +#: ../../library/decimal.rst:456 msgid "" "Return the adjusted exponent after shifting out the coefficient's rightmost " "digits until only the lead digit remains: ``Decimal('321e+5').adjusted()`` " @@ -686,14 +688,14 @@ msgid "" "digit with respect to the decimal point." msgstr "" -#: ../../library/decimal.rst:461 +#: ../../library/decimal.rst:463 msgid "" "Return a pair ``(n, d)`` of integers that represent the given :class:" "`Decimal` instance as a fraction, in lowest terms and with a positive " "denominator::" msgstr "" -#: ../../library/decimal.rst:465 +#: ../../library/decimal.rst:467 msgid "" ">>> Decimal('-3.14').as_integer_ratio()\n" "(-157, 50)" @@ -701,32 +703,32 @@ msgstr "" ">>> Decimal('-3.14').as_integer_ratio()\n" "(-157, 50)" -#: ../../library/decimal.rst:468 +#: ../../library/decimal.rst:470 msgid "" "The conversion is exact. Raise OverflowError on infinities and ValueError " "on NaNs." msgstr "" -#: ../../library/decimal.rst:475 +#: ../../library/decimal.rst:477 msgid "" "Return a :term:`named tuple` representation of the number: " "``DecimalTuple(sign, digits, exponent)``." msgstr "" -#: ../../library/decimal.rst:481 +#: ../../library/decimal.rst:483 msgid "" "Return the canonical encoding of the argument. Currently, the encoding of " "a :class:`Decimal` instance is always canonical, so this operation returns " "its argument unchanged." msgstr "" -#: ../../library/decimal.rst:487 +#: ../../library/decimal.rst:489 msgid "" "Compare the values of two Decimal instances. :meth:`compare` returns a " "Decimal instance, and if either operand is a NaN then the result is a NaN::" msgstr "" -#: ../../library/decimal.rst:491 +#: ../../library/decimal.rst:493 msgid "" "a or b is a NaN ==> Decimal('NaN')\n" "a < b ==> Decimal('-1')\n" @@ -738,14 +740,14 @@ msgstr "" "a == b ==> Decimal('0')\n" "a > b ==> Decimal('1')" -#: ../../library/decimal.rst:498 +#: ../../library/decimal.rst:500 msgid "" "This operation is identical to the :meth:`compare` method, except that all " "NaNs signal. That is, if neither operand is a signaling NaN then any quiet " "NaN operand is treated as though it were a signaling NaN." msgstr "" -#: ../../library/decimal.rst:504 +#: ../../library/decimal.rst:506 msgid "" "Compare two operands using their abstract representation rather than their " "numerical value. Similar to the :meth:`compare` method, but the result " @@ -754,7 +756,7 @@ msgid "" "unequal in this ordering:" msgstr "" -#: ../../library/decimal.rst:513 +#: ../../library/decimal.rst:515 msgid "" "Quiet and signaling NaNs are also included in the total ordering. The " "result of this function is ``Decimal('0')`` if both operands have the same " @@ -764,15 +766,15 @@ msgid "" "details of the total order." msgstr "" -#: ../../library/decimal.rst:520 ../../library/decimal.rst:531 -#: ../../library/decimal.rst:559 ../../library/decimal.rst:846 +#: ../../library/decimal.rst:522 ../../library/decimal.rst:533 +#: ../../library/decimal.rst:561 ../../library/decimal.rst:848 msgid "" "This operation is unaffected by context and is quiet: no flags are changed " "and no rounding is performed. As an exception, the C version may raise " "InvalidOperation if the second operand cannot be converted exactly." msgstr "" -#: ../../library/decimal.rst:526 +#: ../../library/decimal.rst:528 msgid "" "Compare two operands using their abstract representation rather than their " "value as in :meth:`compare_total`, but ignoring the sign of each operand. " @@ -780,44 +782,44 @@ msgid "" "copy_abs())``." msgstr "" -#: ../../library/decimal.rst:537 +#: ../../library/decimal.rst:539 msgid "" "Just returns self, this method is only to comply with the Decimal " "Specification." msgstr "" -#: ../../library/decimal.rst:542 +#: ../../library/decimal.rst:544 msgid "" "Return the absolute value of the argument. This operation is unaffected by " "the context and is quiet: no flags are changed and no rounding is performed." msgstr "" -#: ../../library/decimal.rst:548 +#: ../../library/decimal.rst:550 msgid "" "Return the negation of the argument. This operation is unaffected by the " "context and is quiet: no flags are changed and no rounding is performed." msgstr "" -#: ../../library/decimal.rst:553 +#: ../../library/decimal.rst:555 msgid "" "Return a copy of the first operand with the sign set to be the same as the " "sign of the second operand. For example:" msgstr "" -#: ../../library/decimal.rst:565 +#: ../../library/decimal.rst:567 msgid "" "Return the value of the (natural) exponential function ``e**x`` at the given " "number. The result is correctly rounded using the :const:`ROUND_HALF_EVEN` " "rounding mode." msgstr "" -#: ../../library/decimal.rst:576 +#: ../../library/decimal.rst:578 msgid "" "Alternative constructor that only accepts instances of :class:`float` or :" "class:`int`." msgstr "" -#: ../../library/decimal.rst:579 +#: ../../library/decimal.rst:581 msgid "" "Note ``Decimal.from_float(0.1)`` is not the same as ``Decimal('0.1')``. " "Since 0.1 is not exactly representable in binary floating point, the value " @@ -826,13 +828,13 @@ msgid "" "``0.1000000000000000055511151231257827021181583404541015625``." msgstr "" -#: ../../library/decimal.rst:585 +#: ../../library/decimal.rst:587 msgid "" "From Python 3.2 onwards, a :class:`Decimal` instance can also be constructed " "directly from a :class:`float`." msgstr "" -#: ../../library/decimal.rst:588 +#: ../../library/decimal.rst:590 msgid "" ">>> Decimal.from_float(0.1)\n" "Decimal('0.1000000000000000055511151231257827021181583404541015625')\n" @@ -852,86 +854,86 @@ msgstr "" ">>> Decimal.from_float(float('-inf'))\n" "Decimal('-Infinity')" -#: ../../library/decimal.rst:603 +#: ../../library/decimal.rst:605 msgid "" "Fused multiply-add. Return self*other+third with no rounding of the " "intermediate product self*other." msgstr "" -#: ../../library/decimal.rst:611 +#: ../../library/decimal.rst:613 msgid "" "Return :const:`True` if the argument is canonical and :const:`False` " "otherwise. Currently, a :class:`Decimal` instance is always canonical, so " "this operation always returns :const:`True`." msgstr "" -#: ../../library/decimal.rst:617 +#: ../../library/decimal.rst:619 msgid "" "Return :const:`True` if the argument is a finite number, and :const:`False` " "if the argument is an infinity or a NaN." msgstr "" -#: ../../library/decimal.rst:622 +#: ../../library/decimal.rst:624 msgid "" "Return :const:`True` if the argument is either positive or negative infinity " "and :const:`False` otherwise." msgstr "" -#: ../../library/decimal.rst:627 +#: ../../library/decimal.rst:629 msgid "" "Return :const:`True` if the argument is a (quiet or signaling) NaN and :" "const:`False` otherwise." msgstr "" -#: ../../library/decimal.rst:632 +#: ../../library/decimal.rst:634 msgid "" "Return :const:`True` if the argument is a *normal* finite number. Return :" "const:`False` if the argument is zero, subnormal, infinite or a NaN." msgstr "" -#: ../../library/decimal.rst:637 +#: ../../library/decimal.rst:639 msgid "" "Return :const:`True` if the argument is a quiet NaN, and :const:`False` " "otherwise." msgstr "" -#: ../../library/decimal.rst:642 +#: ../../library/decimal.rst:644 msgid "" "Return :const:`True` if the argument has a negative sign and :const:`False` " "otherwise. Note that zeros and NaNs can both carry signs." msgstr "" -#: ../../library/decimal.rst:647 +#: ../../library/decimal.rst:649 msgid "" "Return :const:`True` if the argument is a signaling NaN and :const:`False` " "otherwise." msgstr "" -#: ../../library/decimal.rst:652 +#: ../../library/decimal.rst:654 msgid "" "Return :const:`True` if the argument is subnormal, and :const:`False` " "otherwise." msgstr "" -#: ../../library/decimal.rst:657 +#: ../../library/decimal.rst:659 msgid "" "Return :const:`True` if the argument is a (positive or negative) zero and :" "const:`False` otherwise." msgstr "" -#: ../../library/decimal.rst:662 +#: ../../library/decimal.rst:664 msgid "" "Return the natural (base e) logarithm of the operand. The result is " "correctly rounded using the :const:`ROUND_HALF_EVEN` rounding mode." msgstr "" -#: ../../library/decimal.rst:667 +#: ../../library/decimal.rst:669 msgid "" "Return the base ten logarithm of the operand. The result is correctly " "rounded using the :const:`ROUND_HALF_EVEN` rounding mode." msgstr "" -#: ../../library/decimal.rst:672 +#: ../../library/decimal.rst:674 msgid "" "For a nonzero number, return the adjusted exponent of its operand as a :" "class:`Decimal` instance. If the operand is a zero then ``Decimal('-" @@ -939,74 +941,74 @@ msgid "" "the operand is an infinity then ``Decimal('Infinity')`` is returned." msgstr "" -#: ../../library/decimal.rst:680 +#: ../../library/decimal.rst:682 msgid "" ":meth:`logical_and` is a logical operation which takes two *logical " "operands* (see :ref:`logical_operands_label`). The result is the digit-wise " "``and`` of the two operands." msgstr "" -#: ../../library/decimal.rst:686 +#: ../../library/decimal.rst:688 msgid "" ":meth:`logical_invert` is a logical operation. The result is the digit-wise " "inversion of the operand." msgstr "" -#: ../../library/decimal.rst:691 +#: ../../library/decimal.rst:693 msgid "" ":meth:`logical_or` is a logical operation which takes two *logical operands* " "(see :ref:`logical_operands_label`). The result is the digit-wise ``or`` of " "the two operands." msgstr "" -#: ../../library/decimal.rst:697 +#: ../../library/decimal.rst:699 msgid "" ":meth:`logical_xor` is a logical operation which takes two *logical " "operands* (see :ref:`logical_operands_label`). The result is the digit-wise " "exclusive or of the two operands." msgstr "" -#: ../../library/decimal.rst:703 +#: ../../library/decimal.rst:705 msgid "" "Like ``max(self, other)`` except that the context rounding rule is applied " "before returning and that ``NaN`` values are either signaled or ignored " "(depending on the context and whether they are signaling or quiet)." msgstr "" -#: ../../library/decimal.rst:710 +#: ../../library/decimal.rst:712 msgid "" "Similar to the :meth:`.max` method, but the comparison is done using the " "absolute values of the operands." msgstr "" -#: ../../library/decimal.rst:715 +#: ../../library/decimal.rst:717 msgid "" "Like ``min(self, other)`` except that the context rounding rule is applied " "before returning and that ``NaN`` values are either signaled or ignored " "(depending on the context and whether they are signaling or quiet)." msgstr "" -#: ../../library/decimal.rst:722 +#: ../../library/decimal.rst:724 msgid "" "Similar to the :meth:`.min` method, but the comparison is done using the " "absolute values of the operands." msgstr "" -#: ../../library/decimal.rst:727 +#: ../../library/decimal.rst:729 msgid "" "Return the largest number representable in the given context (or in the " "current thread's context if no context is given) that is smaller than the " "given operand." msgstr "" -#: ../../library/decimal.rst:733 +#: ../../library/decimal.rst:735 msgid "" "Return the smallest number representable in the given context (or in the " "current thread's context if no context is given) that is larger than the " "given operand." msgstr "" -#: ../../library/decimal.rst:739 +#: ../../library/decimal.rst:741 msgid "" "If the two operands are unequal, return the number closest to the first " "operand in the direction of the second operand. If both operands are " @@ -1014,13 +1016,13 @@ msgid "" "be the same as the sign of the second operand." msgstr "" -#: ../../library/decimal.rst:746 +#: ../../library/decimal.rst:748 msgid "" "Used for producing canonical values of an equivalence class within either " "the current context or the specified context." msgstr "" -#: ../../library/decimal.rst:749 +#: ../../library/decimal.rst:751 msgid "" "This has the same semantics as the unary plus operation, except that if the " "final result is finite it is reduced to its simplest form, with all trailing " @@ -1030,79 +1032,79 @@ msgid "" "exponent is set to 0. In all cases the sign is unchanged." msgstr "" -#: ../../library/decimal.rst:756 +#: ../../library/decimal.rst:758 msgid "" "For example, ``Decimal('32.100')`` and ``Decimal('0.321000e+2')`` both " "normalize to the equivalent value ``Decimal('32.1')``." msgstr "" -#: ../../library/decimal.rst:759 +#: ../../library/decimal.rst:761 msgid "Note that rounding is applied *before* reducing to simplest form." msgstr "" -#: ../../library/decimal.rst:761 +#: ../../library/decimal.rst:763 msgid "" "In the latest versions of the specification, this operation is also known as " "``reduce``." msgstr "" -#: ../../library/decimal.rst:766 +#: ../../library/decimal.rst:768 msgid "" "Return a string describing the *class* of the operand. The returned value " "is one of the following ten strings." msgstr "" -#: ../../library/decimal.rst:769 +#: ../../library/decimal.rst:771 msgid "``\"-Infinity\"``, indicating that the operand is negative infinity." msgstr "" -#: ../../library/decimal.rst:770 +#: ../../library/decimal.rst:772 msgid "" "``\"-Normal\"``, indicating that the operand is a negative normal number." msgstr "" -#: ../../library/decimal.rst:771 +#: ../../library/decimal.rst:773 msgid "" "``\"-Subnormal\"``, indicating that the operand is negative and subnormal." msgstr "" -#: ../../library/decimal.rst:772 +#: ../../library/decimal.rst:774 msgid "``\"-Zero\"``, indicating that the operand is a negative zero." msgstr "" -#: ../../library/decimal.rst:773 +#: ../../library/decimal.rst:775 msgid "``\"+Zero\"``, indicating that the operand is a positive zero." msgstr "" -#: ../../library/decimal.rst:774 +#: ../../library/decimal.rst:776 msgid "" "``\"+Subnormal\"``, indicating that the operand is positive and subnormal." msgstr "" -#: ../../library/decimal.rst:775 +#: ../../library/decimal.rst:777 msgid "" "``\"+Normal\"``, indicating that the operand is a positive normal number." msgstr "" -#: ../../library/decimal.rst:776 +#: ../../library/decimal.rst:778 msgid "``\"+Infinity\"``, indicating that the operand is positive infinity." msgstr "" -#: ../../library/decimal.rst:777 +#: ../../library/decimal.rst:779 msgid "``\"NaN\"``, indicating that the operand is a quiet NaN (Not a Number)." msgstr "" -#: ../../library/decimal.rst:778 +#: ../../library/decimal.rst:780 msgid "``\"sNaN\"``, indicating that the operand is a signaling NaN." msgstr "" -#: ../../library/decimal.rst:782 +#: ../../library/decimal.rst:784 msgid "" "Return a value equal to the first operand after rounding and having the " "exponent of the second operand." msgstr "" -#: ../../library/decimal.rst:788 +#: ../../library/decimal.rst:790 msgid "" "Unlike other operations, if the length of the coefficient after the quantize " "operation would be greater than precision, then an :const:`InvalidOperation` " @@ -1110,13 +1112,13 @@ msgid "" "quantized exponent is always equal to that of the right-hand operand." msgstr "" -#: ../../library/decimal.rst:794 +#: ../../library/decimal.rst:796 msgid "" "Also unlike other operations, quantize never signals Underflow, even if the " "result is subnormal and inexact." msgstr "" -#: ../../library/decimal.rst:797 +#: ../../library/decimal.rst:799 msgid "" "If the exponent of the second operand is larger than that of the first then " "rounding may be necessary. In this case, the rounding mode is determined by " @@ -1125,19 +1127,19 @@ msgid "" "context is used." msgstr "" -#: ../../library/decimal.rst:803 +#: ../../library/decimal.rst:805 msgid "" "An error is returned whenever the resulting exponent is greater than :attr:" "`~Context.Emax` or less than :meth:`~Context.Etiny`." msgstr "" -#: ../../library/decimal.rst:808 +#: ../../library/decimal.rst:810 msgid "" "Return ``Decimal(10)``, the radix (base) in which the :class:`Decimal` class " "does all its arithmetic. Included for compatibility with the specification." msgstr "" -#: ../../library/decimal.rst:814 +#: ../../library/decimal.rst:816 msgid "" "Return the remainder from dividing *self* by *other*. This differs from " "``self % other`` in that the sign of the remainder is chosen so as to " @@ -1146,11 +1148,11 @@ msgid "" "other``, and if two integers are equally near then the even one is chosen." msgstr "" -#: ../../library/decimal.rst:821 +#: ../../library/decimal.rst:823 msgid "If the result is zero then its sign will be the sign of *self*." msgstr "" -#: ../../library/decimal.rst:832 +#: ../../library/decimal.rst:834 msgid "" "Return the result of rotating the digits of the first operand by an amount " "specified by the second operand. The second operand must be an integer in " @@ -1162,20 +1164,20 @@ msgid "" "are unchanged." msgstr "" -#: ../../library/decimal.rst:843 +#: ../../library/decimal.rst:845 msgid "" "Test whether self and other have the same exponent or whether both are " "``NaN``." msgstr "" -#: ../../library/decimal.rst:852 +#: ../../library/decimal.rst:854 msgid "" "Return the first operand with exponent adjusted by the second. Equivalently, " "return the first operand multiplied by ``10**other``. The second operand " "must be an integer." msgstr "" -#: ../../library/decimal.rst:858 +#: ../../library/decimal.rst:860 msgid "" "Return the result of shifting the digits of the first operand by an amount " "specified by the second operand. The second operand must be an integer in " @@ -1186,34 +1188,34 @@ msgid "" "exponent of the first operand are unchanged." msgstr "" -#: ../../library/decimal.rst:868 +#: ../../library/decimal.rst:870 msgid "Return the square root of the argument to full precision." msgstr "" -#: ../../library/decimal.rst:873 ../../library/decimal.rst:1510 +#: ../../library/decimal.rst:875 ../../library/decimal.rst:1512 msgid "" "Convert to a string, using engineering notation if an exponent is needed." msgstr "" -#: ../../library/decimal.rst:875 ../../library/decimal.rst:1512 +#: ../../library/decimal.rst:877 ../../library/decimal.rst:1514 msgid "" "Engineering notation has an exponent which is a multiple of 3. This can " "leave up to 3 digits to the left of the decimal place and may require the " "addition of either one or two trailing zeros." msgstr "" -#: ../../library/decimal.rst:879 +#: ../../library/decimal.rst:881 msgid "" "For example, this converts ``Decimal('123E+1')`` to ``Decimal('1.23E+3')``." msgstr "" -#: ../../library/decimal.rst:883 +#: ../../library/decimal.rst:885 msgid "" "Identical to the :meth:`to_integral_value` method. The ``to_integral`` name " "has been kept for compatibility with older versions." msgstr "" -#: ../../library/decimal.rst:888 +#: ../../library/decimal.rst:890 msgid "" "Round to the nearest integer, signaling :const:`Inexact` or :const:`Rounded` " "as appropriate if rounding occurs. The rounding mode is determined by the " @@ -1221,18 +1223,18 @@ msgid "" "parameter is given then the rounding mode of the current context is used." msgstr "" -#: ../../library/decimal.rst:896 +#: ../../library/decimal.rst:898 msgid "" "Round to the nearest integer without signaling :const:`Inexact` or :const:" "`Rounded`. If given, applies *rounding*; otherwise, uses the rounding " "method in either the supplied *context* or the current context." msgstr "" -#: ../../library/decimal.rst:900 +#: ../../library/decimal.rst:902 msgid "Decimal numbers can be rounded using the :func:`.round` function:" msgstr "" -#: ../../library/decimal.rst:905 +#: ../../library/decimal.rst:907 msgid "" "If *ndigits* is not given or ``None``, returns the nearest :class:`int` to " "*number*, rounding ties to even, and ignoring the rounding mode of the :" @@ -1240,7 +1242,7 @@ msgid "" "infinity or :exc:`ValueError` if it is a (quiet or signaling) NaN." msgstr "" -#: ../../library/decimal.rst:911 +#: ../../library/decimal.rst:913 msgid "" "If *ndigits* is an :class:`int`, the context's rounding mode is respected " "and a :class:`Decimal` representing *number* rounded to the nearest multiple " @@ -1252,27 +1254,27 @@ msgid "" "the current context's precision. In other words, for the non-corner cases:" msgstr "" -#: ../../library/decimal.rst:921 +#: ../../library/decimal.rst:923 msgid "" "if *ndigits* is positive, return *number* rounded to *ndigits* decimal " "places;" msgstr "" -#: ../../library/decimal.rst:923 +#: ../../library/decimal.rst:925 msgid "if *ndigits* is zero, return *number* rounded to the nearest integer;" msgstr "" -#: ../../library/decimal.rst:924 +#: ../../library/decimal.rst:926 msgid "" "if *ndigits* is negative, return *number* rounded to the nearest multiple of " "``10**abs(ndigits)``." msgstr "" -#: ../../library/decimal.rst:927 +#: ../../library/decimal.rst:929 msgid "For example::" msgstr "" -#: ../../library/decimal.rst:929 +#: ../../library/decimal.rst:931 msgid "" ">>> from decimal import Decimal, getcontext, ROUND_DOWN\n" ">>> getcontext().rounding = ROUND_DOWN\n" @@ -1288,11 +1290,11 @@ msgid "" "Decimal('0E+1')" msgstr "" -#: ../../library/decimal.rst:946 +#: ../../library/decimal.rst:948 msgid "Logical operands" msgstr "" -#: ../../library/decimal.rst:948 +#: ../../library/decimal.rst:950 msgid "" "The :meth:`~Decimal.logical_and`, :meth:`~Decimal.logical_invert`, :meth:" "`~Decimal.logical_or`, and :meth:`~Decimal.logical_xor` methods expect their " @@ -1301,38 +1303,38 @@ msgid "" "are all either ``0`` or ``1``." msgstr "" -#: ../../library/decimal.rst:960 +#: ../../library/decimal.rst:962 msgid "Context objects" msgstr "" -#: ../../library/decimal.rst:962 +#: ../../library/decimal.rst:964 msgid "" "Contexts are environments for arithmetic operations. They govern precision, " "set rules for rounding, determine which signals are treated as exceptions, " "and limit the range for exponents." msgstr "" -#: ../../library/decimal.rst:966 +#: ../../library/decimal.rst:968 msgid "" "Each thread has its own current context which is accessed or changed using " "the :func:`getcontext` and :func:`setcontext` functions:" msgstr "" -#: ../../library/decimal.rst:972 +#: ../../library/decimal.rst:974 msgid "Return the current context for the active thread." msgstr "" -#: ../../library/decimal.rst:977 +#: ../../library/decimal.rst:979 msgid "Set the current context for the active thread to *c*." msgstr "" -#: ../../library/decimal.rst:979 +#: ../../library/decimal.rst:981 msgid "" "You can also use the :keyword:`with` statement and the :func:`localcontext` " "function to temporarily change the active context." msgstr "" -#: ../../library/decimal.rst:984 +#: ../../library/decimal.rst:986 msgid "" "Return a context manager that will set the current context for the active " "thread to a copy of *ctx* on entry to the with-statement and restore the " @@ -1341,14 +1343,14 @@ msgid "" "used to set the attributes of the new context." msgstr "" -#: ../../library/decimal.rst:990 +#: ../../library/decimal.rst:992 msgid "" "For example, the following code sets the current decimal precision to 42 " "places, performs a calculation, and then automatically restores the previous " "context::" msgstr "" -#: ../../library/decimal.rst:993 +#: ../../library/decimal.rst:995 msgid "" "from decimal import localcontext\n" "\n" @@ -1358,11 +1360,11 @@ msgid "" "s = +s # Round the final result back to the default precision" msgstr "" -#: ../../library/decimal.rst:1000 +#: ../../library/decimal.rst:1002 msgid "Using keyword arguments, the code would be the following::" msgstr "" -#: ../../library/decimal.rst:1002 +#: ../../library/decimal.rst:1004 msgid "" "from decimal import localcontext\n" "\n" @@ -1376,26 +1378,26 @@ msgstr "" " s = calculate_something()\n" "s = +s" -#: ../../library/decimal.rst:1008 +#: ../../library/decimal.rst:1010 msgid "" "Raises :exc:`TypeError` if *kwargs* supplies an attribute that :class:" "`Context` doesn't support. Raises either :exc:`TypeError` or :exc:" "`ValueError` if *kwargs* supplies an invalid value for an attribute." msgstr "" -#: ../../library/decimal.rst:1012 +#: ../../library/decimal.rst:1014 msgid "" ":meth:`localcontext` now supports setting context attributes through the use " "of keyword arguments." msgstr "" -#: ../../library/decimal.rst:1015 +#: ../../library/decimal.rst:1017 msgid "" "New contexts can also be created using the :class:`Context` constructor " "described below. In addition, the module provides three pre-made contexts:" msgstr "" -#: ../../library/decimal.rst:1021 +#: ../../library/decimal.rst:1023 msgid "" "This is a standard context defined by the General Decimal Arithmetic " "Specification. Precision is set to nine. Rounding is set to :const:" @@ -1404,12 +1406,12 @@ msgid "" "`Subnormal`." msgstr "" -#: ../../library/decimal.rst:1027 +#: ../../library/decimal.rst:1029 msgid "" "Because many of the traps are enabled, this context is useful for debugging." msgstr "" -#: ../../library/decimal.rst:1032 +#: ../../library/decimal.rst:1034 msgid "" "This is a standard context defined by the General Decimal Arithmetic " "Specification. Precision is set to nine. Rounding is set to :const:" @@ -1417,7 +1419,7 @@ msgid "" "exceptions are not raised during computations)." msgstr "" -#: ../../library/decimal.rst:1037 +#: ../../library/decimal.rst:1039 msgid "" "Because the traps are disabled, this context is useful for applications that " "prefer to have result value of ``NaN`` or ``Infinity`` instead of raising " @@ -1425,7 +1427,7 @@ msgid "" "conditions that would otherwise halt the program." msgstr "" -#: ../../library/decimal.rst:1045 +#: ../../library/decimal.rst:1047 msgid "" "This context is used by the :class:`Context` constructor as a prototype for " "new contexts. Changing a field (such a precision) has the effect of " @@ -1433,7 +1435,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/decimal.rst:1049 +#: ../../library/decimal.rst:1051 msgid "" "This context is most useful in multi-threaded environments. Changing one of " "the fields before threads are started has the effect of setting system-wide " @@ -1441,65 +1443,65 @@ msgid "" "as it would require thread synchronization to prevent race conditions." msgstr "" -#: ../../library/decimal.rst:1054 +#: ../../library/decimal.rst:1056 msgid "" "In single threaded environments, it is preferable to not use this context at " "all. Instead, simply create contexts explicitly as described below." msgstr "" -#: ../../library/decimal.rst:1057 +#: ../../library/decimal.rst:1059 msgid "" "The default values are :attr:`Context.prec`\\ =\\ ``28``, :attr:`Context." "rounding`\\ =\\ :const:`ROUND_HALF_EVEN`, and enabled traps for :class:" "`Overflow`, :class:`InvalidOperation`, and :class:`DivisionByZero`." msgstr "" -#: ../../library/decimal.rst:1062 +#: ../../library/decimal.rst:1064 msgid "" "In addition to the three supplied contexts, new contexts can be created with " "the :class:`Context` constructor." msgstr "" -#: ../../library/decimal.rst:1068 +#: ../../library/decimal.rst:1070 msgid "" "Creates a new context. If a field is not specified or is :const:`None`, the " "default values are copied from the :const:`DefaultContext`. If the *flags* " "field is not specified or is :const:`None`, all flags are cleared." msgstr "" -#: ../../library/decimal.rst:1072 +#: ../../library/decimal.rst:1074 msgid "" "*prec* is an integer in the range [``1``, :const:`MAX_PREC`] that sets the " "precision for arithmetic operations in the context." msgstr "" -#: ../../library/decimal.rst:1075 +#: ../../library/decimal.rst:1077 msgid "" "The *rounding* option is one of the constants listed in the section " "`Rounding Modes`_." msgstr "" -#: ../../library/decimal.rst:1078 +#: ../../library/decimal.rst:1080 msgid "" "The *traps* and *flags* fields list any signals to be set. Generally, new " "contexts should only set traps and leave the flags clear." msgstr "" -#: ../../library/decimal.rst:1081 +#: ../../library/decimal.rst:1083 msgid "" "The *Emin* and *Emax* fields are integers specifying the outer limits " "allowable for exponents. *Emin* must be in the range [:const:`MIN_EMIN`, " "``0``], *Emax* in the range [``0``, :const:`MAX_EMAX`]." msgstr "" -#: ../../library/decimal.rst:1085 +#: ../../library/decimal.rst:1087 msgid "" "The *capitals* field is either ``0`` or ``1`` (the default). If set to " "``1``, exponents are printed with a capital ``E``; otherwise, a lowercase " "``e`` is used: ``Decimal('6.02e+23')``." msgstr "" -#: ../../library/decimal.rst:1089 +#: ../../library/decimal.rst:1091 msgid "" "The *clamp* field is either ``0`` (the default) or ``1``. If set to ``1``, " "the exponent ``e`` of a :class:`Decimal` instance representable in this " @@ -1513,7 +1515,7 @@ msgid "" "For example::" msgstr "" -#: ../../library/decimal.rst:1101 +#: ../../library/decimal.rst:1103 msgid "" ">>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')\n" "Decimal('1.23000E+999')" @@ -1521,13 +1523,13 @@ msgstr "" ">>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')\n" "Decimal('1.23000E+999')" -#: ../../library/decimal.rst:1104 +#: ../../library/decimal.rst:1106 msgid "" "A *clamp* value of ``1`` allows compatibility with the fixed-width decimal " "interchange formats specified in IEEE 754." msgstr "" -#: ../../library/decimal.rst:1107 +#: ../../library/decimal.rst:1109 msgid "" "The :class:`Context` class defines several general purpose methods as well " "as a large number of methods for doing arithmetic directly in a given " @@ -1540,30 +1542,30 @@ msgid "" "instance of :class:`int`) anywhere that a Decimal instance is accepted." msgstr "" -#: ../../library/decimal.rst:1120 +#: ../../library/decimal.rst:1122 msgid "Resets all of the flags to ``0``." msgstr "" -#: ../../library/decimal.rst:1124 +#: ../../library/decimal.rst:1126 msgid "Resets all of the traps to ``0``." msgstr "" -#: ../../library/decimal.rst:1130 +#: ../../library/decimal.rst:1132 msgid "Return a duplicate of the context." msgstr "" -#: ../../library/decimal.rst:1134 +#: ../../library/decimal.rst:1136 msgid "Return a copy of the Decimal instance num." msgstr "" -#: ../../library/decimal.rst:1138 +#: ../../library/decimal.rst:1140 msgid "" "Creates a new Decimal instance from *num* but using *self* as context. " "Unlike the :class:`Decimal` constructor, the context precision, rounding " "method, flags, and traps are applied to the conversion." msgstr "" -#: ../../library/decimal.rst:1142 +#: ../../library/decimal.rst:1144 msgid "" "This is useful because constants are often given to a greater precision than " "is needed by the application. Another benefit is that rounding immediately " @@ -1572,7 +1574,7 @@ msgid "" "sum can change the result:" msgstr "" -#: ../../library/decimal.rst:1148 +#: ../../library/decimal.rst:1150 msgid "" ">>> getcontext().prec = 3\n" ">>> Decimal('3.4445') + Decimal('1.0023')\n" @@ -1586,14 +1588,14 @@ msgstr "" ">>> Decimal('3.4445') + Decimal(0) + Decimal('1.0023')\n" "Decimal('4.44')" -#: ../../library/decimal.rst:1156 +#: ../../library/decimal.rst:1158 msgid "" "This method implements the to-number operation of the IBM specification. If " "the argument is a string, no leading or trailing whitespace or underscores " "are permitted." msgstr "" -#: ../../library/decimal.rst:1162 +#: ../../library/decimal.rst:1164 msgid "" "Creates a new Decimal instance from a float *f* but rounding using *self* as " "the context. Unlike the :meth:`Decimal.from_float` class method, the " @@ -1601,7 +1603,7 @@ msgid "" "conversion." msgstr "" -#: ../../library/decimal.rst:1167 +#: ../../library/decimal.rst:1169 msgid "" ">>> context = Context(prec=5, rounding=ROUND_DOWN)\n" ">>> context.create_decimal_from_float(math.pi)\n" @@ -1621,18 +1623,18 @@ msgstr "" " ...\n" "decimal.Inexact: None" -#: ../../library/decimal.rst:1182 +#: ../../library/decimal.rst:1184 msgid "" "Returns a value equal to ``Emin - prec + 1`` which is the minimum exponent " "value for subnormal results. When underflow occurs, the exponent is set to :" "const:`Etiny`." msgstr "" -#: ../../library/decimal.rst:1188 +#: ../../library/decimal.rst:1190 msgid "Returns a value equal to ``Emax - prec + 1``." msgstr "" -#: ../../library/decimal.rst:1190 +#: ../../library/decimal.rst:1192 msgid "" "The usual approach to working with decimals is to create :class:`Decimal` " "instances and then apply arithmetic operations which take place within the " @@ -1642,189 +1644,189 @@ msgid "" "recounted here." msgstr "" -#: ../../library/decimal.rst:1200 +#: ../../library/decimal.rst:1202 msgid "Returns the absolute value of *x*." msgstr "" -#: ../../library/decimal.rst:1205 +#: ../../library/decimal.rst:1207 msgid "Return the sum of *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1210 +#: ../../library/decimal.rst:1212 msgid "Returns the same Decimal object *x*." msgstr "" -#: ../../library/decimal.rst:1215 +#: ../../library/decimal.rst:1217 msgid "Compares *x* and *y* numerically." msgstr "" -#: ../../library/decimal.rst:1220 +#: ../../library/decimal.rst:1222 msgid "Compares the values of the two operands numerically." msgstr "" -#: ../../library/decimal.rst:1225 +#: ../../library/decimal.rst:1227 msgid "Compares two operands using their abstract representation." msgstr "" -#: ../../library/decimal.rst:1230 +#: ../../library/decimal.rst:1232 msgid "" "Compares two operands using their abstract representation, ignoring sign." msgstr "" -#: ../../library/decimal.rst:1235 +#: ../../library/decimal.rst:1237 msgid "Returns a copy of *x* with the sign set to 0." msgstr "" -#: ../../library/decimal.rst:1240 +#: ../../library/decimal.rst:1242 msgid "Returns a copy of *x* with the sign inverted." msgstr "" -#: ../../library/decimal.rst:1245 +#: ../../library/decimal.rst:1247 msgid "Copies the sign from *y* to *x*." msgstr "" -#: ../../library/decimal.rst:1250 +#: ../../library/decimal.rst:1252 msgid "Return *x* divided by *y*." msgstr "" -#: ../../library/decimal.rst:1255 +#: ../../library/decimal.rst:1257 msgid "Return *x* divided by *y*, truncated to an integer." msgstr "" -#: ../../library/decimal.rst:1260 +#: ../../library/decimal.rst:1262 msgid "Divides two numbers and returns the integer part of the result." msgstr "" -#: ../../library/decimal.rst:1265 +#: ../../library/decimal.rst:1267 msgid "Returns ``e ** x``." msgstr "" -#: ../../library/decimal.rst:1270 +#: ../../library/decimal.rst:1272 msgid "Returns *x* multiplied by *y*, plus *z*." msgstr "" -#: ../../library/decimal.rst:1275 +#: ../../library/decimal.rst:1277 msgid "Returns ``True`` if *x* is canonical; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1280 +#: ../../library/decimal.rst:1282 msgid "Returns ``True`` if *x* is finite; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1285 +#: ../../library/decimal.rst:1287 msgid "Returns ``True`` if *x* is infinite; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1290 +#: ../../library/decimal.rst:1292 msgid "Returns ``True`` if *x* is a qNaN or sNaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1295 +#: ../../library/decimal.rst:1297 msgid "" "Returns ``True`` if *x* is a normal number; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1300 +#: ../../library/decimal.rst:1302 msgid "Returns ``True`` if *x* is a quiet NaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1305 +#: ../../library/decimal.rst:1307 msgid "Returns ``True`` if *x* is negative; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1310 +#: ../../library/decimal.rst:1312 msgid "" "Returns ``True`` if *x* is a signaling NaN; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1315 +#: ../../library/decimal.rst:1317 msgid "Returns ``True`` if *x* is subnormal; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1320 +#: ../../library/decimal.rst:1322 msgid "Returns ``True`` if *x* is a zero; otherwise returns ``False``." msgstr "" -#: ../../library/decimal.rst:1325 +#: ../../library/decimal.rst:1327 msgid "Returns the natural (base e) logarithm of *x*." msgstr "" -#: ../../library/decimal.rst:1330 +#: ../../library/decimal.rst:1332 msgid "Returns the base 10 logarithm of *x*." msgstr "" -#: ../../library/decimal.rst:1335 +#: ../../library/decimal.rst:1337 msgid "Returns the exponent of the magnitude of the operand's MSD." msgstr "" -#: ../../library/decimal.rst:1340 +#: ../../library/decimal.rst:1342 msgid "Applies the logical operation *and* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1345 +#: ../../library/decimal.rst:1347 msgid "Invert all the digits in *x*." msgstr "" -#: ../../library/decimal.rst:1350 +#: ../../library/decimal.rst:1352 msgid "Applies the logical operation *or* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1355 +#: ../../library/decimal.rst:1357 msgid "Applies the logical operation *xor* between each operand's digits." msgstr "" -#: ../../library/decimal.rst:1360 +#: ../../library/decimal.rst:1362 msgid "Compares two values numerically and returns the maximum." msgstr "" -#: ../../library/decimal.rst:1365 ../../library/decimal.rst:1375 +#: ../../library/decimal.rst:1367 ../../library/decimal.rst:1377 msgid "Compares the values numerically with their sign ignored." msgstr "" -#: ../../library/decimal.rst:1370 +#: ../../library/decimal.rst:1372 msgid "Compares two values numerically and returns the minimum." msgstr "" -#: ../../library/decimal.rst:1380 +#: ../../library/decimal.rst:1382 msgid "Minus corresponds to the unary prefix minus operator in Python." msgstr "" -#: ../../library/decimal.rst:1385 +#: ../../library/decimal.rst:1387 msgid "Return the product of *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1390 +#: ../../library/decimal.rst:1392 msgid "Returns the largest representable number smaller than *x*." msgstr "" -#: ../../library/decimal.rst:1395 +#: ../../library/decimal.rst:1397 msgid "Returns the smallest representable number larger than *x*." msgstr "" -#: ../../library/decimal.rst:1400 +#: ../../library/decimal.rst:1402 msgid "Returns the number closest to *x*, in direction towards *y*." msgstr "" -#: ../../library/decimal.rst:1405 +#: ../../library/decimal.rst:1407 msgid "Reduces *x* to its simplest form." msgstr "" -#: ../../library/decimal.rst:1410 +#: ../../library/decimal.rst:1412 msgid "Returns an indication of the class of *x*." msgstr "" -#: ../../library/decimal.rst:1415 +#: ../../library/decimal.rst:1417 msgid "" "Plus corresponds to the unary prefix plus operator in Python. This " "operation applies the context precision and rounding, so it is *not* an " "identity operation." msgstr "" -#: ../../library/decimal.rst:1422 +#: ../../library/decimal.rst:1424 msgid "Return ``x`` to the power of ``y``, reduced modulo ``modulo`` if given." msgstr "" -#: ../../library/decimal.rst:1424 +#: ../../library/decimal.rst:1426 msgid "" "With two arguments, compute ``x**y``. If ``x`` is negative then ``y`` must " "be integral. The result will be inexact unless ``y`` is integral and the " @@ -1833,42 +1835,42 @@ msgid "" "in the Python version." msgstr "" -#: ../../library/decimal.rst:1430 +#: ../../library/decimal.rst:1432 msgid "" "``Decimal(0) ** Decimal(0)`` results in ``InvalidOperation``, and if " "``InvalidOperation`` is not trapped, then results in ``Decimal('NaN')``." msgstr "" -#: ../../library/decimal.rst:1433 +#: ../../library/decimal.rst:1435 msgid "" "The C module computes :meth:`power` in terms of the correctly rounded :meth:" "`exp` and :meth:`ln` functions. The result is well-defined but only \"almost " "always correctly rounded\"." msgstr "" -#: ../../library/decimal.rst:1438 +#: ../../library/decimal.rst:1440 msgid "" "With three arguments, compute ``(x**y) % modulo``. For the three argument " "form, the following restrictions on the arguments hold:" msgstr "" -#: ../../library/decimal.rst:1441 +#: ../../library/decimal.rst:1443 msgid "all three arguments must be integral" msgstr "" -#: ../../library/decimal.rst:1442 +#: ../../library/decimal.rst:1444 msgid "``y`` must be nonnegative" msgstr "" -#: ../../library/decimal.rst:1443 +#: ../../library/decimal.rst:1445 msgid "at least one of ``x`` or ``y`` must be nonzero" msgstr "" -#: ../../library/decimal.rst:1444 +#: ../../library/decimal.rst:1446 msgid "``modulo`` must be nonzero and have at most 'precision' digits" msgstr "" -#: ../../library/decimal.rst:1446 +#: ../../library/decimal.rst:1448 msgid "" "The value resulting from ``Context.power(x, y, modulo)`` is equal to the " "value that would be obtained by computing ``(x**y) % modulo`` with unbounded " @@ -1877,110 +1879,110 @@ msgid "" "result is always exact." msgstr "" -#: ../../library/decimal.rst:1456 +#: ../../library/decimal.rst:1458 msgid "Returns a value equal to *x* (rounded), having the exponent of *y*." msgstr "" -#: ../../library/decimal.rst:1461 +#: ../../library/decimal.rst:1463 msgid "Just returns 10, as this is Decimal, :)" msgstr "" -#: ../../library/decimal.rst:1466 +#: ../../library/decimal.rst:1468 msgid "Returns the remainder from integer division." msgstr "" -#: ../../library/decimal.rst:1468 +#: ../../library/decimal.rst:1470 msgid "" "The sign of the result, if non-zero, is the same as that of the original " "dividend." msgstr "" -#: ../../library/decimal.rst:1474 +#: ../../library/decimal.rst:1476 msgid "" "Returns ``x - y * n``, where *n* is the integer nearest the exact value of " "``x / y`` (if the result is 0 then its sign will be the sign of *x*)." msgstr "" -#: ../../library/decimal.rst:1480 +#: ../../library/decimal.rst:1482 msgid "Returns a rotated copy of *x*, *y* times." msgstr "" -#: ../../library/decimal.rst:1485 +#: ../../library/decimal.rst:1487 msgid "Returns ``True`` if the two operands have the same exponent." msgstr "" -#: ../../library/decimal.rst:1490 +#: ../../library/decimal.rst:1492 msgid "Returns the first operand after adding the second value its exp." msgstr "" -#: ../../library/decimal.rst:1495 +#: ../../library/decimal.rst:1497 msgid "Returns a shifted copy of *x*, *y* times." msgstr "" -#: ../../library/decimal.rst:1500 +#: ../../library/decimal.rst:1502 msgid "Square root of a non-negative number to context precision." msgstr "" -#: ../../library/decimal.rst:1505 +#: ../../library/decimal.rst:1507 msgid "Return the difference between *x* and *y*." msgstr "" -#: ../../library/decimal.rst:1519 +#: ../../library/decimal.rst:1521 msgid "Rounds to an integer." msgstr "" -#: ../../library/decimal.rst:1524 +#: ../../library/decimal.rst:1526 msgid "Converts a number to a string using scientific notation." msgstr "" -#: ../../library/decimal.rst:1531 +#: ../../library/decimal.rst:1533 msgid "Constants" msgstr "常數" -#: ../../library/decimal.rst:1533 +#: ../../library/decimal.rst:1535 msgid "" "The constants in this section are only relevant for the C module. They are " "also included in the pure Python version for compatibility." msgstr "" -#: ../../library/decimal.rst:1537 +#: ../../library/decimal.rst:1539 msgid "32-bit" msgstr "32 位元" -#: ../../library/decimal.rst:1537 +#: ../../library/decimal.rst:1539 msgid "64-bit" msgstr "64 位元" -#: ../../library/decimal.rst:1539 ../../library/decimal.rst:1541 +#: ../../library/decimal.rst:1541 ../../library/decimal.rst:1543 msgid "``425000000``" msgstr "``425000000``" -#: ../../library/decimal.rst:1539 ../../library/decimal.rst:1541 +#: ../../library/decimal.rst:1541 ../../library/decimal.rst:1543 msgid "``999999999999999999``" msgstr "``999999999999999999``" -#: ../../library/decimal.rst:1543 +#: ../../library/decimal.rst:1545 msgid "``-425000000``" msgstr "``-425000000``" -#: ../../library/decimal.rst:1543 +#: ../../library/decimal.rst:1545 msgid "``-999999999999999999``" msgstr "``-999999999999999999``" -#: ../../library/decimal.rst:1545 +#: ../../library/decimal.rst:1547 msgid "``-849999999``" msgstr "``-849999999``" -#: ../../library/decimal.rst:1545 +#: ../../library/decimal.rst:1547 msgid "``-1999999999999999997``" msgstr "``-1999999999999999997``" -#: ../../library/decimal.rst:1551 +#: ../../library/decimal.rst:1553 msgid "" "The value is ``True``. Deprecated, because Python now always has threads." msgstr "" -#: ../../library/decimal.rst:1557 +#: ../../library/decimal.rst:1559 msgid "" "The default value is ``True``. If Python is :option:`configured using the --" "without-decimal-contextvar option <--without-decimal-contextvar>`, the C " @@ -1989,55 +1991,55 @@ msgid "" "scenarios." msgstr "" -#: ../../library/decimal.rst:1566 +#: ../../library/decimal.rst:1568 msgid "Rounding modes" msgstr "" -#: ../../library/decimal.rst:1570 +#: ../../library/decimal.rst:1572 msgid "Round towards ``Infinity``." msgstr "" -#: ../../library/decimal.rst:1574 +#: ../../library/decimal.rst:1576 msgid "Round towards zero." msgstr "" -#: ../../library/decimal.rst:1578 +#: ../../library/decimal.rst:1580 msgid "Round towards ``-Infinity``." msgstr "" -#: ../../library/decimal.rst:1582 +#: ../../library/decimal.rst:1584 msgid "Round to nearest with ties going towards zero." msgstr "" -#: ../../library/decimal.rst:1586 +#: ../../library/decimal.rst:1588 msgid "Round to nearest with ties going to nearest even integer." msgstr "" -#: ../../library/decimal.rst:1590 +#: ../../library/decimal.rst:1592 msgid "Round to nearest with ties going away from zero." msgstr "" -#: ../../library/decimal.rst:1594 +#: ../../library/decimal.rst:1596 msgid "Round away from zero." msgstr "" -#: ../../library/decimal.rst:1598 +#: ../../library/decimal.rst:1600 msgid "" "Round away from zero if last digit after rounding towards zero would have " "been 0 or 5; otherwise round towards zero." msgstr "" -#: ../../library/decimal.rst:1605 +#: ../../library/decimal.rst:1607 msgid "Signals" msgstr "" -#: ../../library/decimal.rst:1607 +#: ../../library/decimal.rst:1609 msgid "" "Signals represent conditions that arise during computation. Each corresponds " "to one context flag and one context trap enabler." msgstr "" -#: ../../library/decimal.rst:1610 +#: ../../library/decimal.rst:1612 msgid "" "The context flag is set whenever the condition is encountered. After the " "computation, flags may be checked for informational purposes (for instance, " @@ -2045,7 +2047,7 @@ msgid "" "sure to clear all flags before starting the next computation." msgstr "" -#: ../../library/decimal.rst:1615 +#: ../../library/decimal.rst:1617 msgid "" "If the context's trap enabler is set for the signal, then the condition " "causes a Python exception to be raised. For example, if the :class:" @@ -2053,54 +2055,54 @@ msgid "" "raised upon encountering the condition." msgstr "" -#: ../../library/decimal.rst:1623 +#: ../../library/decimal.rst:1625 msgid "Altered an exponent to fit representation constraints." msgstr "" -#: ../../library/decimal.rst:1625 +#: ../../library/decimal.rst:1627 msgid "" "Typically, clamping occurs when an exponent falls outside the context's :" "attr:`~Context.Emin` and :attr:`~Context.Emax` limits. If possible, the " "exponent is reduced to fit by adding zeros to the coefficient." msgstr "" -#: ../../library/decimal.rst:1632 +#: ../../library/decimal.rst:1634 msgid "Base class for other signals and a subclass of :exc:`ArithmeticError`." msgstr "" -#: ../../library/decimal.rst:1637 +#: ../../library/decimal.rst:1639 msgid "Signals the division of a non-infinite number by zero." msgstr "" -#: ../../library/decimal.rst:1639 +#: ../../library/decimal.rst:1641 msgid "" "Can occur with division, modulo division, or when raising a number to a " "negative power. If this signal is not trapped, returns ``Infinity`` or ``-" "Infinity`` with the sign determined by the inputs to the calculation." msgstr "" -#: ../../library/decimal.rst:1646 +#: ../../library/decimal.rst:1648 msgid "Indicates that rounding occurred and the result is not exact." msgstr "" -#: ../../library/decimal.rst:1648 +#: ../../library/decimal.rst:1650 msgid "" "Signals when non-zero digits were discarded during rounding. The rounded " "result is returned. The signal flag or trap is used to detect when results " "are inexact." msgstr "" -#: ../../library/decimal.rst:1655 +#: ../../library/decimal.rst:1657 msgid "An invalid operation was performed." msgstr "" -#: ../../library/decimal.rst:1657 +#: ../../library/decimal.rst:1659 msgid "" "Indicates that an operation was requested that does not make sense. If not " "trapped, returns ``NaN``. Possible causes include::" msgstr "" -#: ../../library/decimal.rst:1660 +#: ../../library/decimal.rst:1662 msgid "" "Infinity - Infinity\n" "0 * Infinity\n" @@ -2122,11 +2124,11 @@ msgstr "" "x ** (non-integer)\n" "x ** Infinity" -#: ../../library/decimal.rst:1673 +#: ../../library/decimal.rst:1675 msgid "Numerical overflow." msgstr "" -#: ../../library/decimal.rst:1675 +#: ../../library/decimal.rst:1677 msgid "" "Indicates the exponent is larger than :attr:`Context.Emax` after rounding " "has occurred. If not trapped, the result depends on the rounding mode, " @@ -2135,42 +2137,42 @@ msgid "" "`Rounded` are also signaled." msgstr "" -#: ../../library/decimal.rst:1684 +#: ../../library/decimal.rst:1686 msgid "Rounding occurred though possibly no information was lost." msgstr "" -#: ../../library/decimal.rst:1686 +#: ../../library/decimal.rst:1688 msgid "" "Signaled whenever rounding discards digits; even if those digits are zero " "(such as rounding ``5.00`` to ``5.0``). If not trapped, returns the result " "unchanged. This signal is used to detect loss of significant digits." msgstr "" -#: ../../library/decimal.rst:1694 +#: ../../library/decimal.rst:1696 msgid "Exponent was lower than :attr:`~Context.Emin` prior to rounding." msgstr "" -#: ../../library/decimal.rst:1696 +#: ../../library/decimal.rst:1698 msgid "" "Occurs when an operation result is subnormal (the exponent is too small). If " "not trapped, returns the result unchanged." msgstr "" -#: ../../library/decimal.rst:1702 +#: ../../library/decimal.rst:1704 msgid "Numerical underflow with result rounded to zero." msgstr "" -#: ../../library/decimal.rst:1704 +#: ../../library/decimal.rst:1706 msgid "" "Occurs when a subnormal result is pushed to zero by rounding. :class:" "`Inexact` and :class:`Subnormal` are also signaled." msgstr "" -#: ../../library/decimal.rst:1710 +#: ../../library/decimal.rst:1712 msgid "Enable stricter semantics for mixing floats and Decimals." msgstr "" -#: ../../library/decimal.rst:1712 +#: ../../library/decimal.rst:1714 msgid "" "If the signal is not trapped (default), mixing floats and Decimals is " "permitted in the :class:`~decimal.Decimal` constructor, :meth:`~decimal." @@ -2181,18 +2183,18 @@ msgid "" "Context.create_decimal_from_float` do not set the flag." msgstr "" -#: ../../library/decimal.rst:1720 +#: ../../library/decimal.rst:1722 msgid "" "Otherwise (the signal is trapped), only equality comparisons and explicit " "conversions are silent. All other mixed operations raise :exc:" "`FloatOperation`." msgstr "" -#: ../../library/decimal.rst:1724 +#: ../../library/decimal.rst:1726 msgid "The following table summarizes the hierarchy of signals::" msgstr "" -#: ../../library/decimal.rst:1726 +#: ../../library/decimal.rst:1728 msgid "" "exceptions.ArithmeticError(exceptions.Exception)\n" " DecimalException\n" @@ -2218,15 +2220,15 @@ msgstr "" " Subnormal\n" " FloatOperation(DecimalException, exceptions.TypeError)" -#: ../../library/decimal.rst:1745 +#: ../../library/decimal.rst:1747 msgid "Floating-Point Notes" msgstr "" -#: ../../library/decimal.rst:1749 +#: ../../library/decimal.rst:1751 msgid "Mitigating round-off error with increased precision" msgstr "" -#: ../../library/decimal.rst:1751 +#: ../../library/decimal.rst:1753 msgid "" "The use of decimal floating point eliminates decimal representation error " "(making it possible to represent ``0.1`` exactly); however, some operations " @@ -2234,7 +2236,7 @@ msgid "" "precision." msgstr "" -#: ../../library/decimal.rst:1755 +#: ../../library/decimal.rst:1757 msgid "" "The effects of round-off error can be amplified by the addition or " "subtraction of nearly offsetting quantities resulting in loss of " @@ -2243,7 +2245,7 @@ msgid "" "of the associative and distributive properties of addition:" msgstr "" -#: ../../library/decimal.rst:1761 +#: ../../library/decimal.rst:1763 msgid "" "# Examples from Seminumerical Algorithms, Section 4.2.2.\n" ">>> from decimal import Decimal, getcontext\n" @@ -2262,13 +2264,13 @@ msgid "" "Decimal('0.0060000')" msgstr "" -#: ../../library/decimal.rst:1779 +#: ../../library/decimal.rst:1781 msgid "" "The :mod:`decimal` module makes it possible to restore the identities by " "expanding the precision sufficiently to avoid loss of significance:" msgstr "" -#: ../../library/decimal.rst:1782 +#: ../../library/decimal.rst:1784 msgid "" ">>> getcontext().prec = 20\n" ">>> u, v, w = Decimal(11111113), Decimal(-11111111), Decimal('7.51111111')\n" @@ -2284,18 +2286,18 @@ msgid "" "Decimal('0.0060000')" msgstr "" -#: ../../library/decimal.rst:1799 +#: ../../library/decimal.rst:1801 msgid "Special values" msgstr "特殊值" -#: ../../library/decimal.rst:1801 +#: ../../library/decimal.rst:1803 msgid "" "The number system for the :mod:`decimal` module provides special values " "including ``NaN``, ``sNaN``, ``-Infinity``, ``Infinity``, and two zeros, " "``+0`` and ``-0``." msgstr "" -#: ../../library/decimal.rst:1805 +#: ../../library/decimal.rst:1807 msgid "" "Infinities can be constructed directly with: ``Decimal('Infinity')``. Also, " "they can arise from dividing by zero when the :exc:`DivisionByZero` signal " @@ -2304,14 +2306,14 @@ msgid "" "representable number." msgstr "" -#: ../../library/decimal.rst:1810 +#: ../../library/decimal.rst:1812 msgid "" "The infinities are signed (affine) and can be used in arithmetic operations " "where they get treated as very large, indeterminate numbers. For instance, " "adding a constant to infinity gives another infinite result." msgstr "" -#: ../../library/decimal.rst:1814 +#: ../../library/decimal.rst:1816 msgid "" "Some operations are indeterminate and return ``NaN``, or if the :exc:" "`InvalidOperation` signal is trapped, raise an exception. For example, " @@ -2322,14 +2324,14 @@ msgid "" "the calculation to proceed while flagging specific results as invalid." msgstr "" -#: ../../library/decimal.rst:1822 +#: ../../library/decimal.rst:1824 msgid "" "A variant is ``sNaN`` which signals rather than remaining quiet after every " "operation. This is a useful return value when an invalid result needs to " "interrupt a calculation for special handling." msgstr "" -#: ../../library/decimal.rst:1826 +#: ../../library/decimal.rst:1828 msgid "" "The behavior of Python's comparison operators can be a little surprising " "where a ``NaN`` is involved. A test for equality where one of the operands " @@ -2346,7 +2348,7 @@ msgid "" "compare_signal` methods instead." msgstr "" -#: ../../library/decimal.rst:1839 +#: ../../library/decimal.rst:1841 msgid "" "The signed zeros can result from calculations that underflow. They keep the " "sign that would have resulted if the calculation had been carried out to " @@ -2354,7 +2356,7 @@ msgid "" "negative zeros are treated as equal and their sign is informational." msgstr "" -#: ../../library/decimal.rst:1844 +#: ../../library/decimal.rst:1846 msgid "" "In addition to the two signed zeros which are distinct yet equal, there are " "various representations of zero with differing precisions yet equivalent in " @@ -2363,11 +2365,11 @@ msgid "" "that the following calculation returns a value equal to zero:" msgstr "" -#: ../../library/decimal.rst:1859 +#: ../../library/decimal.rst:1861 msgid "Working with threads" msgstr "" -#: ../../library/decimal.rst:1861 +#: ../../library/decimal.rst:1863 msgid "" "The :func:`getcontext` function accesses a different :class:`Context` object " "for each thread. Having separate thread contexts means that threads may " @@ -2375,20 +2377,20 @@ msgid "" "other threads." msgstr "" -#: ../../library/decimal.rst:1865 +#: ../../library/decimal.rst:1867 msgid "" "Likewise, the :func:`setcontext` function automatically assigns its target " "to the current thread." msgstr "" -#: ../../library/decimal.rst:1868 +#: ../../library/decimal.rst:1870 msgid "" "If :func:`setcontext` has not been called before :func:`getcontext`, then :" "func:`getcontext` will automatically create a new context for use in the " "current thread." msgstr "" -#: ../../library/decimal.rst:1872 +#: ../../library/decimal.rst:1874 msgid "" "The new context is copied from a prototype context called *DefaultContext*. " "To control the defaults so that each thread will use the same values " @@ -2397,7 +2399,7 @@ msgid "" "a race condition between threads calling :func:`getcontext`. For example::" msgstr "" -#: ../../library/decimal.rst:1878 +#: ../../library/decimal.rst:1880 msgid "" "# Set applicationwide defaults for all threads about to be launched\n" "DefaultContext.prec = 12\n" @@ -2413,17 +2415,17 @@ msgid "" " . . ." msgstr "" -#: ../../library/decimal.rst:1897 +#: ../../library/decimal.rst:1899 msgid "Recipes" msgstr "" -#: ../../library/decimal.rst:1899 +#: ../../library/decimal.rst:1901 msgid "" "Here are a few recipes that serve as utility functions and that demonstrate " "ways to work with the :class:`Decimal` class::" msgstr "" -#: ../../library/decimal.rst:1902 +#: ../../library/decimal.rst:1904 msgid "" "def moneyfmt(value, places=2, curr='', sep=',', dp='.',\n" " pos='', neg='-', trailneg=''):\n" @@ -2572,41 +2574,41 @@ msgid "" " return +s" msgstr "" -#: ../../library/decimal.rst:2054 +#: ../../library/decimal.rst:2056 msgid "Decimal FAQ" msgstr "" -#: ../../library/decimal.rst:2056 +#: ../../library/decimal.rst:2058 msgid "" "Q. It is cumbersome to type ``decimal.Decimal('1234.5')``. Is there a way " "to minimize typing when using the interactive interpreter?" msgstr "" -#: ../../library/decimal.rst:2059 +#: ../../library/decimal.rst:2061 msgid "A. Some users abbreviate the constructor to just a single letter:" msgstr "" -#: ../../library/decimal.rst:2065 +#: ../../library/decimal.rst:2067 msgid "" "Q. In a fixed-point application with two decimal places, some inputs have " "many places and need to be rounded. Others are not supposed to have excess " "digits and need to be validated. What methods should be used?" msgstr "" -#: ../../library/decimal.rst:2069 +#: ../../library/decimal.rst:2071 msgid "" "A. The :meth:`~Decimal.quantize` method rounds to a fixed number of decimal " "places. If the :const:`Inexact` trap is set, it is also useful for " "validation:" msgstr "" -#: ../../library/decimal.rst:2087 +#: ../../library/decimal.rst:2089 msgid "" "Q. Once I have valid two place inputs, how do I maintain that invariant " "throughout an application?" msgstr "" -#: ../../library/decimal.rst:2090 +#: ../../library/decimal.rst:2092 msgid "" "A. Some operations like addition, subtraction, and multiplication by an " "integer will automatically preserve fixed point. Others operations, like " @@ -2614,13 +2616,13 @@ msgid "" "places and need to be followed-up with a :meth:`~Decimal.quantize` step:" msgstr "" -#: ../../library/decimal.rst:2108 +#: ../../library/decimal.rst:2110 msgid "" "In developing fixed-point applications, it is convenient to define functions " "to handle the :meth:`~Decimal.quantize` step:" msgstr "" -#: ../../library/decimal.rst:2122 +#: ../../library/decimal.rst:2124 msgid "" "Q. There are many ways to express the same value. The numbers ``200``, " "``200.000``, ``2E2``, and ``.02E+4`` all have the same value at various " @@ -2628,17 +2630,17 @@ msgid "" "canonical value?" msgstr "" -#: ../../library/decimal.rst:2127 +#: ../../library/decimal.rst:2129 msgid "" "A. The :meth:`~Decimal.normalize` method maps all equivalent values to a " "single representative:" msgstr "" -#: ../../library/decimal.rst:2134 +#: ../../library/decimal.rst:2136 msgid "Q. When does rounding occur in a computation?" msgstr "" -#: ../../library/decimal.rst:2136 +#: ../../library/decimal.rst:2138 msgid "" "A. It occurs *after* the computation. The philosophy of the decimal " "specification is that numbers are considered exact and are created " @@ -2648,7 +2650,7 @@ msgid "" "computation::" msgstr "" -#: ../../library/decimal.rst:2143 +#: ../../library/decimal.rst:2145 msgid "" ">>> getcontext().prec = 5\n" ">>> pi = Decimal('3.1415926535') # More than 5 digits\n" @@ -2662,13 +2664,13 @@ msgid "" "Decimal('3.1416')" msgstr "" -#: ../../library/decimal.rst:2154 +#: ../../library/decimal.rst:2156 msgid "" "Q. Some decimal values always print with exponential notation. Is there a " "way to get a non-exponential representation?" msgstr "" -#: ../../library/decimal.rst:2157 +#: ../../library/decimal.rst:2159 msgid "" "A. For some values, exponential notation is the only way to express the " "number of significant places in the coefficient. For example, expressing " @@ -2676,25 +2678,25 @@ msgid "" "original's two-place significance." msgstr "" -#: ../../library/decimal.rst:2162 +#: ../../library/decimal.rst:2164 msgid "" "If an application does not care about tracking significance, it is easy to " "remove the exponent and trailing zeroes, losing significance, but keeping " "the value unchanged:" msgstr "" -#: ../../library/decimal.rst:2172 +#: ../../library/decimal.rst:2174 msgid "Q. Is there a way to convert a regular float to a :class:`Decimal`?" msgstr "" -#: ../../library/decimal.rst:2174 +#: ../../library/decimal.rst:2176 msgid "" "A. Yes, any binary floating-point number can be exactly expressed as a " "Decimal though an exact conversion may take more precision than intuition " "would suggest:" msgstr "" -#: ../../library/decimal.rst:2178 +#: ../../library/decimal.rst:2180 msgid "" ">>> Decimal(math.pi)\n" "Decimal('3.141592653589793115997963468544185161590576171875')" @@ -2702,13 +2704,13 @@ msgstr "" ">>> Decimal(math.pi)\n" "Decimal('3.141592653589793115997963468544185161590576171875')" -#: ../../library/decimal.rst:2183 +#: ../../library/decimal.rst:2185 msgid "" "Q. Within a complex calculation, how can I make sure that I haven't gotten a " "spurious result because of insufficient precision or rounding anomalies." msgstr "" -#: ../../library/decimal.rst:2186 +#: ../../library/decimal.rst:2188 msgid "" "A. The decimal module makes it easy to test results. A best practice is to " "re-run calculations using greater precision and with various rounding modes. " @@ -2716,14 +2718,14 @@ msgid "" "issues, ill-conditioned inputs, or a numerically unstable algorithm." msgstr "" -#: ../../library/decimal.rst:2191 +#: ../../library/decimal.rst:2193 msgid "" "Q. I noticed that context precision is applied to the results of operations " "but not to the inputs. Is there anything to watch out for when mixing " "values of different precisions?" msgstr "" -#: ../../library/decimal.rst:2195 +#: ../../library/decimal.rst:2197 msgid "" "A. Yes. The principle is that all values are considered to be exact and so " "is the arithmetic on those values. Only the results are rounded. The " @@ -2732,7 +2734,7 @@ msgid "" "haven't been rounded:" msgstr "" -#: ../../library/decimal.rst:2200 +#: ../../library/decimal.rst:2202 msgid "" ">>> getcontext().prec = 3\n" ">>> Decimal('3.104') + Decimal('2.104')\n" @@ -2746,30 +2748,30 @@ msgstr "" ">>> Decimal('3.104') + Decimal('0.000') + Decimal('2.104')\n" "Decimal('5.20')" -#: ../../library/decimal.rst:2208 +#: ../../library/decimal.rst:2210 msgid "" "The solution is either to increase precision or to force rounding of inputs " "using the unary plus operation:" msgstr "" -#: ../../library/decimal.rst:2211 +#: ../../library/decimal.rst:2213 msgid "" ">>> getcontext().prec = 3\n" ">>> +Decimal('1.23456789') # unary plus triggers rounding\n" "Decimal('1.23')" msgstr "" -#: ../../library/decimal.rst:2217 +#: ../../library/decimal.rst:2219 msgid "" "Alternatively, inputs can be rounded upon creation using the :meth:`Context." "create_decimal` method:" msgstr "" -#: ../../library/decimal.rst:2223 +#: ../../library/decimal.rst:2225 msgid "Q. Is the CPython implementation fast for large numbers?" msgstr "" -#: ../../library/decimal.rst:2225 +#: ../../library/decimal.rst:2227 msgid "" "A. Yes. In the CPython and PyPy3 implementations, the C/CFFI versions of " "the decimal module integrate the high speed `libmpdec >> setcontext(Context(prec=MAX_PREC, Emax=MAX_EMAX, Emin=MIN_EMIN))\n" ">>> x = Decimal(2) ** 256\n" @@ -2808,13 +2810,13 @@ msgstr "" ">>> x / 128\n" "Decimal('904625697166532776746648320380374280103671755200316906558262375061821325312')" -#: ../../library/decimal.rst:2248 +#: ../../library/decimal.rst:2250 msgid "" "For inexact results, :const:`MAX_PREC` is far too large on 64-bit platforms " "and the available memory will be insufficient::" msgstr "" -#: ../../library/decimal.rst:2251 +#: ../../library/decimal.rst:2253 msgid "" ">>> Decimal(1) / 3\n" "Traceback (most recent call last):\n" @@ -2826,7 +2828,7 @@ msgstr "" " File \"\", line 1, in \n" "MemoryError" -#: ../../library/decimal.rst:2256 +#: ../../library/decimal.rst:2258 msgid "" "On systems with overallocation (e.g. Linux), a more sophisticated approach " "is to adjust :attr:`~Context.prec` to the amount of available RAM. Suppose " @@ -2834,7 +2836,7 @@ msgid "" "of 500MB each::" msgstr "" -#: ../../library/decimal.rst:2260 +#: ../../library/decimal.rst:2262 msgid "" ">>> import sys\n" ">>>\n" @@ -2858,14 +2860,14 @@ msgid "" " decimal.Inexact: []" msgstr "" -#: ../../library/decimal.rst:2280 +#: ../../library/decimal.rst:2282 msgid "" "In general (and especially on systems without overallocation), it is " "recommended to estimate even tighter bounds and set the :attr:`Inexact` trap " "if all calculations are expected to be exact." msgstr "" -#: ../../library/decimal.rst:2289 +#: ../../library/decimal.rst:2291 msgid "" "This approach now works for all exact results except for non-integer powers." msgstr "" diff --git a/library/dis.po b/library/dis.po index 74ac573ea5..e1585fde13 100644 --- a/library/dis.po +++ b/library/dis.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-03 00:15+0000\n" +"POT-Creation-Date: 2025-04-24 05:58+0000\n" "PO-Revision-Date: 2018-07-27 16:55+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -61,17 +61,17 @@ msgstr "" msgid "" "Some instructions are accompanied by one or more inline cache entries, which " "take the form of :opcode:`CACHE` instructions. These instructions are hidden " -"by default, but can be shown by passing ``show_caches=True`` to any :mod:" -"`dis` utility. Furthermore, the interpreter now adapts the bytecode to " -"specialize it for different runtime conditions. The adaptive bytecode can be " -"shown by passing ``adaptive=True``." +"by default, but can be shown by passing ``show_caches=True`` to " +"any :mod:`dis` utility. Furthermore, the interpreter now adapts the bytecode " +"to specialize it for different runtime conditions. The adaptive bytecode can " +"be shown by passing ``adaptive=True``." msgstr "" #: ../../library/dis.rst:45 msgid "" "The argument of a jump is the offset of the target instruction relative to " -"the instruction that appears immediately after the jump instruction's :" -"opcode:`CACHE` entries." +"the instruction that appears immediately after the jump " +"instruction's :opcode:`CACHE` entries." msgstr "" #: ../../library/dis.rst:50 @@ -130,7 +130,7 @@ msgstr "" #: ../../library/dis.rst:82 msgid "Command-line interface" -msgstr "" +msgstr "命令列介面" #: ../../library/dis.rst:84 msgid "The :mod:`dis` module can be invoked as a script from the command line:" @@ -142,7 +142,7 @@ msgstr "python -m dis [-h] [-C] [-O] [infile]" #: ../../library/dis.rst:90 msgid "The following options are accepted:" -msgstr "" +msgstr "可接受以下選項:" #: ../../library/dis.rst:96 msgid "Display usage and exit." @@ -152,43 +152,43 @@ msgstr "" msgid "Show inline caches." msgstr "" -#: ../../library/dis.rst:104 +#: ../../library/dis.rst:106 msgid "Show offsets of instructions." msgstr "" -#: ../../library/dis.rst:106 +#: ../../library/dis.rst:110 msgid "" "If :file:`infile` is specified, its disassembled code will be written to " "stdout. Otherwise, disassembly is performed on compiled source code received " "from stdin." msgstr "" -#: ../../library/dis.rst:110 +#: ../../library/dis.rst:114 msgid "Bytecode analysis" msgstr "" -#: ../../library/dis.rst:114 +#: ../../library/dis.rst:118 msgid "" -"The bytecode analysis API allows pieces of Python code to be wrapped in a :" -"class:`Bytecode` object that provides easy access to details of the compiled " -"code." +"The bytecode analysis API allows pieces of Python code to be wrapped in " +"a :class:`Bytecode` object that provides easy access to details of the " +"compiled code." msgstr "" -#: ../../library/dis.rst:121 +#: ../../library/dis.rst:125 msgid "" "Analyse the bytecode corresponding to a function, generator, asynchronous " "generator, coroutine, method, string of source code, or a code object (as " "returned by :func:`compile`)." msgstr "" -#: ../../library/dis.rst:125 +#: ../../library/dis.rst:129 msgid "" "This is a convenience wrapper around many of the functions listed below, " "most notably :func:`get_instructions`, as iterating over a :class:`Bytecode` " "instance yields the bytecode operations as :class:`Instruction` instances." msgstr "" -#: ../../library/dis.rst:129 ../../library/dis.rst:326 +#: ../../library/dis.rst:133 ../../library/dis.rst:330 msgid "" "If *first_line* is not ``None``, it indicates the line number that should be " "reported for the first source line in the disassembled code. Otherwise, the " @@ -196,73 +196,73 @@ msgid "" "code object." msgstr "" -#: ../../library/dis.rst:134 +#: ../../library/dis.rst:138 msgid "" "If *current_offset* is not ``None``, it refers to an instruction offset in " "the disassembled code. Setting this means :meth:`.dis` will display a " "\"current instruction\" marker against the specified opcode." msgstr "" -#: ../../library/dis.rst:138 +#: ../../library/dis.rst:142 msgid "" "If *show_caches* is ``True``, :meth:`.dis` will display inline cache entries " "used by the interpreter to specialize the bytecode." msgstr "" -#: ../../library/dis.rst:141 +#: ../../library/dis.rst:145 msgid "" "If *adaptive* is ``True``, :meth:`.dis` will display specialized bytecode " "that may be different from the original bytecode." msgstr "" -#: ../../library/dis.rst:144 +#: ../../library/dis.rst:148 msgid "" "If *show_offsets* is ``True``, :meth:`.dis` will include instruction offsets " "in the output." msgstr "" -#: ../../library/dis.rst:149 +#: ../../library/dis.rst:153 msgid "" "Construct a :class:`Bytecode` instance from the given traceback, setting " "*current_offset* to the instruction responsible for the exception." msgstr "" -#: ../../library/dis.rst:154 +#: ../../library/dis.rst:158 msgid "The compiled code object." msgstr "" -#: ../../library/dis.rst:158 +#: ../../library/dis.rst:162 msgid "The first source line of the code object (if available)" msgstr "" -#: ../../library/dis.rst:162 +#: ../../library/dis.rst:166 msgid "" -"Return a formatted view of the bytecode operations (the same as printed by :" -"func:`dis.dis`, but returned as a multi-line string)." +"Return a formatted view of the bytecode operations (the same as printed " +"by :func:`dis.dis`, but returned as a multi-line string)." msgstr "" -#: ../../library/dis.rst:167 +#: ../../library/dis.rst:171 msgid "" "Return a formatted multi-line string with detailed information about the " "code object, like :func:`code_info`." msgstr "" -#: ../../library/dis.rst:170 ../../library/dis.rst:210 -#: ../../library/dis.rst:262 +#: ../../library/dis.rst:174 ../../library/dis.rst:214 +#: ../../library/dis.rst:266 msgid "This can now handle coroutine and asynchronous generator objects." msgstr "" -#: ../../library/dis.rst:173 ../../library/dis.rst:265 -#: ../../library/dis.rst:282 ../../library/dis.rst:312 -#: ../../library/dis.rst:335 +#: ../../library/dis.rst:177 ../../library/dis.rst:269 +#: ../../library/dis.rst:286 ../../library/dis.rst:316 +#: ../../library/dis.rst:339 msgid "Added the *show_caches* and *adaptive* parameters." msgstr "新增 *show_caches* 與 *adaptive* 參數。" -#: ../../library/dis.rst:176 +#: ../../library/dis.rst:180 msgid "Example:" msgstr "範例:" -#: ../../library/dis.rst:178 +#: ../../library/dis.rst:182 msgid "" ">>> bytecode = dis.Bytecode(myfunc)\n" ">>> for instr in bytecode:\n" @@ -284,11 +284,11 @@ msgstr "" "CALL\n" "RETURN_VALUE" -#: ../../library/dis.rst:192 +#: ../../library/dis.rst:196 msgid "Analysis functions" msgstr "" -#: ../../library/dis.rst:194 +#: ../../library/dis.rst:198 msgid "" "The :mod:`dis` module also defines the following analysis functions that " "convert the input directly to the desired output. They can be useful if only " @@ -296,39 +296,39 @@ msgid "" "isn't useful:" msgstr "" -#: ../../library/dis.rst:200 +#: ../../library/dis.rst:204 msgid "" "Return a formatted multi-line string with detailed code object information " "for the supplied function, generator, asynchronous generator, coroutine, " "method, source code string or code object." msgstr "" -#: ../../library/dis.rst:204 +#: ../../library/dis.rst:208 msgid "" "Note that the exact contents of code info strings are highly implementation " "dependent and they may change arbitrarily across Python VMs or Python " "releases." msgstr "" -#: ../../library/dis.rst:216 +#: ../../library/dis.rst:220 msgid "" "Print detailed code object information for the supplied function, method, " "source code string or code object to *file* (or ``sys.stdout`` if *file* is " "not specified)." msgstr "" -#: ../../library/dis.rst:220 +#: ../../library/dis.rst:224 msgid "" "This is a convenient shorthand for ``print(code_info(x), file=file)``, " "intended for interactive exploration at the interpreter prompt." msgstr "" -#: ../../library/dis.rst:225 ../../library/dis.rst:256 -#: ../../library/dis.rst:279 ../../library/dis.rst:309 +#: ../../library/dis.rst:229 ../../library/dis.rst:260 +#: ../../library/dis.rst:283 ../../library/dis.rst:313 msgid "Added *file* parameter." msgstr "新增 *file* 參數。" -#: ../../library/dis.rst:231 +#: ../../library/dis.rst:235 msgid "" "Disassemble the *x* object. *x* can denote either a module, a class, a " "method, a function, a generator, an asynchronous generator, a coroutine, a " @@ -344,103 +344,103 @@ msgid "" "disassembles the last traceback." msgstr "" -#: ../../library/dis.rst:244 ../../library/dis.rst:276 -#: ../../library/dis.rst:306 +#: ../../library/dis.rst:248 ../../library/dis.rst:280 +#: ../../library/dis.rst:310 msgid "" "The disassembly is written as text to the supplied *file* argument if " "provided and to ``sys.stdout`` otherwise." msgstr "" -#: ../../library/dis.rst:247 +#: ../../library/dis.rst:251 msgid "" "The maximal depth of recursion is limited by *depth* unless it is ``None``. " "``depth=0`` means no recursion." msgstr "" -#: ../../library/dis.rst:250 +#: ../../library/dis.rst:254 msgid "" "If *show_caches* is ``True``, this function will display inline cache " "entries used by the interpreter to specialize the bytecode." msgstr "" -#: ../../library/dis.rst:253 +#: ../../library/dis.rst:257 msgid "" "If *adaptive* is ``True``, this function will display specialized bytecode " "that may be different from the original bytecode." msgstr "" -#: ../../library/dis.rst:259 +#: ../../library/dis.rst:263 msgid "Implemented recursive disassembling and added *depth* parameter." msgstr "" -#: ../../library/dis.rst:272 +#: ../../library/dis.rst:276 msgid "" "Disassemble the top-of-stack function of a traceback, using the last " "traceback if none was passed. The instruction causing the exception is " "indicated." msgstr "" -#: ../../library/dis.rst:285 ../../library/dis.rst:315 +#: ../../library/dis.rst:289 ../../library/dis.rst:319 msgid "Added the *show_offsets* parameter." msgstr "新增 *show_offsets* 參數。" -#: ../../library/dis.rst:292 +#: ../../library/dis.rst:296 msgid "" "Disassemble a code object, indicating the last instruction if *lasti* was " "provided. The output is divided in the following columns:" msgstr "" -#: ../../library/dis.rst:295 +#: ../../library/dis.rst:299 msgid "the line number, for the first instruction of each line" msgstr "" -#: ../../library/dis.rst:296 +#: ../../library/dis.rst:300 msgid "the current instruction, indicated as ``-->``," msgstr "" -#: ../../library/dis.rst:297 +#: ../../library/dis.rst:301 msgid "a labelled instruction, indicated with ``>>``," msgstr "" -#: ../../library/dis.rst:298 +#: ../../library/dis.rst:302 msgid "the address of the instruction," msgstr "" -#: ../../library/dis.rst:299 +#: ../../library/dis.rst:303 msgid "the operation code name," msgstr "" -#: ../../library/dis.rst:300 +#: ../../library/dis.rst:304 msgid "operation parameters, and" msgstr "" -#: ../../library/dis.rst:301 +#: ../../library/dis.rst:305 msgid "interpretation of the parameters in parentheses." msgstr "" -#: ../../library/dis.rst:303 +#: ../../library/dis.rst:307 msgid "" "The parameter interpretation recognizes local and global variable names, " "constant values, branch targets, and compare operators." msgstr "" -#: ../../library/dis.rst:320 +#: ../../library/dis.rst:324 msgid "" "Return an iterator over the instructions in the supplied function, method, " "source code string or code object." msgstr "" -#: ../../library/dis.rst:323 +#: ../../library/dis.rst:327 msgid "" "The iterator generates a series of :class:`Instruction` named tuples giving " "the details of each operation in the supplied code." msgstr "" -#: ../../library/dis.rst:331 +#: ../../library/dis.rst:335 msgid "The *adaptive* parameter works as it does in :func:`dis`." msgstr "" -#: ../../library/dis.rst:338 +#: ../../library/dis.rst:342 msgid "" "The *show_caches* parameter is deprecated and has no effect. The iterator " "generates the :class:`Instruction` instances with the *cache_info* field " @@ -448,41 +448,41 @@ msgid "" "generates separate items for the cache entries." msgstr "" -#: ../../library/dis.rst:346 +#: ../../library/dis.rst:350 msgid "" -"This generator function uses the :meth:`~codeobject.co_lines` method of the :" -"ref:`code object ` *code* to find the offsets which are starts " -"of lines in the source code. They are generated as ``(offset, lineno)`` " -"pairs." +"This generator function uses the :meth:`~codeobject.co_lines` method of " +"the :ref:`code object ` *code* to find the offsets which are " +"starts of lines in the source code. They are generated as ``(offset, " +"lineno)`` pairs." msgstr "" -#: ../../library/dis.rst:351 +#: ../../library/dis.rst:355 msgid "Line numbers can be decreasing. Before, they were always increasing." msgstr "" -#: ../../library/dis.rst:354 +#: ../../library/dis.rst:358 msgid "" -"The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of the :" -"attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab` " +"The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of " +"the :attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab` " "attributes of the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:359 +#: ../../library/dis.rst:363 msgid "" "Line numbers can be ``None`` for bytecode that does not map to source lines." msgstr "" -#: ../../library/dis.rst:365 +#: ../../library/dis.rst:369 msgid "" "Detect all offsets in the raw compiled bytecode string *code* which are jump " "targets, and return a list of these offsets." msgstr "" -#: ../../library/dis.rst:371 +#: ../../library/dis.rst:375 msgid "Compute the stack effect of *opcode* with argument *oparg*." msgstr "" -#: ../../library/dis.rst:373 +#: ../../library/dis.rst:377 msgid "" "If the code has a jump target and *jump* is ``True``, :func:`~stack_effect` " "will return the stack effect of jumping. If *jump* is ``False``, it will " @@ -490,11 +490,11 @@ msgid "" "it will return the maximal stack effect of both cases." msgstr "" -#: ../../library/dis.rst:380 +#: ../../library/dis.rst:384 msgid "Added *jump* parameter." msgstr "新增 *jump* 參數。" -#: ../../library/dis.rst:383 +#: ../../library/dis.rst:387 msgid "" "If ``oparg`` is omitted (or ``None``), the stack effect is now returned for " "``oparg=0``. Previously this was an error for opcodes that use their arg. It " @@ -502,170 +502,178 @@ msgid "" "does not use it; the ``oparg`` in this case is ignored." msgstr "" -#: ../../library/dis.rst:393 +#: ../../library/dis.rst:397 msgid "Python Bytecode Instructions" msgstr "" -#: ../../library/dis.rst:395 +#: ../../library/dis.rst:399 msgid "" "The :func:`get_instructions` function and :class:`Bytecode` class provide " "details of bytecode instructions as :class:`Instruction` instances:" msgstr "" -#: ../../library/dis.rst:400 +#: ../../library/dis.rst:404 msgid "Details for a bytecode operation" msgstr "" -#: ../../library/dis.rst:404 +#: ../../library/dis.rst:408 msgid "" "numeric code for operation, corresponding to the opcode values listed below " "and the bytecode values in the :ref:`opcode_collections`." msgstr "" -#: ../../library/dis.rst:410 +#: ../../library/dis.rst:414 msgid "human readable name for operation" msgstr "" -#: ../../library/dis.rst:415 +#: ../../library/dis.rst:419 msgid "" "numeric code for the base operation if operation is specialized; otherwise " "equal to :data:`opcode`" msgstr "" -#: ../../library/dis.rst:421 +#: ../../library/dis.rst:425 msgid "" "human readable name for the base operation if operation is specialized; " "otherwise equal to :data:`opname`" msgstr "" -#: ../../library/dis.rst:427 +#: ../../library/dis.rst:431 msgid "numeric argument to operation (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:431 +#: ../../library/dis.rst:435 msgid "alias for :data:`arg`" msgstr "" -#: ../../library/dis.rst:435 +#: ../../library/dis.rst:439 msgid "resolved arg value (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:440 +#: ../../library/dis.rst:444 msgid "" "human readable description of operation argument (if any), otherwise an " "empty string." msgstr "" -#: ../../library/dis.rst:446 +#: ../../library/dis.rst:450 msgid "start index of operation within bytecode sequence" msgstr "" -#: ../../library/dis.rst:451 +#: ../../library/dis.rst:455 msgid "" "start index of operation within bytecode sequence, including prefixed " "``EXTENDED_ARG`` operations if present; otherwise equal to :data:`offset`" msgstr "" -#: ../../library/dis.rst:457 +#: ../../library/dis.rst:461 msgid "start index of the cache entries following the operation" msgstr "" -#: ../../library/dis.rst:462 +#: ../../library/dis.rst:466 msgid "end index of the cache entries following the operation" msgstr "" -#: ../../library/dis.rst:467 +#: ../../library/dis.rst:471 msgid "``True`` if this opcode starts a source line, otherwise ``False``" msgstr "" -#: ../../library/dis.rst:472 +#: ../../library/dis.rst:476 msgid "" "source line number associated with this opcode (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:477 +#: ../../library/dis.rst:481 msgid "``True`` if other code jumps to here, otherwise ``False``" msgstr "" -#: ../../library/dis.rst:482 +#: ../../library/dis.rst:486 msgid "" "bytecode index of the jump target if this is a jump operation, otherwise " "``None``" msgstr "" -#: ../../library/dis.rst:488 +#: ../../library/dis.rst:492 msgid "" ":class:`dis.Positions` object holding the start and end locations that are " "covered by this instruction." msgstr "" -#: ../../library/dis.rst:503 -msgid "Field ``positions`` is added." +#: ../../library/dis.rst:497 +msgid "" +"Information about the cache entries of this instruction, as triplets of the " +"form ``(name, size, data)``, where the ``name`` and ``size`` describe the " +"cache format and data is the contents of the cache. ``cache_info`` is " +"``None`` if the instruction does not have caches." msgstr "" #: ../../library/dis.rst:507 +msgid "Field ``positions`` is added." +msgstr "" + +#: ../../library/dis.rst:511 msgid "Changed field ``starts_line``." msgstr "" -#: ../../library/dis.rst:509 +#: ../../library/dis.rst:513 msgid "" "Added fields ``start_offset``, ``cache_offset``, ``end_offset``, " "``baseopname``, ``baseopcode``, ``jump_target``, ``oparg``, ``line_number`` " "and ``cache_info``." msgstr "" -#: ../../library/dis.rst:516 +#: ../../library/dis.rst:520 msgid "" "In case the information is not available, some fields might be ``None``." msgstr "" -#: ../../library/dis.rst:526 +#: ../../library/dis.rst:530 msgid "" "The Python compiler currently generates the following bytecode instructions." msgstr "" -#: ../../library/dis.rst:529 +#: ../../library/dis.rst:533 msgid "**General instructions**" msgstr "" -#: ../../library/dis.rst:531 +#: ../../library/dis.rst:535 msgid "" "In the following, We will refer to the interpreter stack as ``STACK`` and " "describe operations on it as if it was a Python list. The top of the stack " "corresponds to ``STACK[-1]`` in this language." msgstr "" -#: ../../library/dis.rst:537 +#: ../../library/dis.rst:541 msgid "" "Do nothing code. Used as a placeholder by the bytecode optimizer, and to " "generate line tracing events." msgstr "" -#: ../../library/dis.rst:543 +#: ../../library/dis.rst:547 msgid "Removes the top-of-stack item::" msgstr "" -#: ../../library/dis.rst:545 +#: ../../library/dis.rst:549 msgid "STACK.pop()" msgstr "STACK.pop()" -#: ../../library/dis.rst:550 +#: ../../library/dis.rst:554 msgid "" "Removes the top-of-stack item. Equivalent to ``POP_TOP``. Used to clean up " "at the end of loops, hence the name." msgstr "" -#: ../../library/dis.rst:559 +#: ../../library/dis.rst:563 msgid "Implements ``del STACK[-2]``. Used to clean up when a generator exits." msgstr "" -#: ../../library/dis.rst:567 +#: ../../library/dis.rst:571 msgid "" "Push the i-th item to the top of the stack without removing it from its " "original location::" msgstr "" -#: ../../library/dis.rst:570 +#: ../../library/dis.rst:574 msgid "" "assert i > 0\n" "STACK.append(STACK[-i])" @@ -673,15 +681,15 @@ msgstr "" "assert i > 0\n" "STACK.append(STACK[-i])" -#: ../../library/dis.rst:578 +#: ../../library/dis.rst:582 msgid "Swap the top of the stack with the i-th element::" msgstr "" -#: ../../library/dis.rst:580 +#: ../../library/dis.rst:584 msgid "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" msgstr "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" -#: ../../library/dis.rst:587 +#: ../../library/dis.rst:591 msgid "" "Rather than being an actual instruction, this opcode is used to mark extra " "space for the interpreter to cache useful data directly in the bytecode " @@ -689,86 +697,86 @@ msgid "" "viewed with ``show_caches=True``." msgstr "" -#: ../../library/dis.rst:592 +#: ../../library/dis.rst:596 msgid "" "Logically, this space is part of the preceding instruction. Many opcodes " "expect to be followed by an exact number of caches, and will instruct the " "interpreter to skip over them at runtime." msgstr "" -#: ../../library/dis.rst:596 +#: ../../library/dis.rst:600 msgid "" "Populated caches can look like arbitrary instructions, so great care should " "be taken when reading or modifying raw, adaptive bytecode containing " "quickened data." msgstr "" -#: ../../library/dis.rst:603 +#: ../../library/dis.rst:607 msgid "**Unary operations**" msgstr "" -#: ../../library/dis.rst:605 +#: ../../library/dis.rst:609 msgid "" "Unary operations take the top of the stack, apply the operation, and push " "the result back on the stack." msgstr "" -#: ../../library/dis.rst:611 +#: ../../library/dis.rst:615 msgid "Implements ``STACK[-1] = -STACK[-1]``." msgstr "" -#: ../../library/dis.rst:616 +#: ../../library/dis.rst:620 msgid "Implements ``STACK[-1] = not STACK[-1]``." msgstr "" -#: ../../library/dis.rst:618 ../../library/dis.rst:1314 -#: ../../library/dis.rst:1330 +#: ../../library/dis.rst:622 ../../library/dis.rst:1318 +#: ../../library/dis.rst:1334 msgid "This instruction now requires an exact :class:`bool` operand." msgstr "" -#: ../../library/dis.rst:624 +#: ../../library/dis.rst:628 msgid "Implements ``STACK[-1] = ~STACK[-1]``." msgstr "" -#: ../../library/dis.rst:629 +#: ../../library/dis.rst:633 msgid "Implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:634 +#: ../../library/dis.rst:638 msgid "" "If ``STACK[-1]`` is a :term:`generator iterator` or :term:`coroutine` object " "it is left as is. Otherwise, implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:642 +#: ../../library/dis.rst:646 msgid "Implements ``STACK[-1] = bool(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:647 +#: ../../library/dis.rst:651 msgid "**Binary and in-place operations**" msgstr "" -#: ../../library/dis.rst:649 +#: ../../library/dis.rst:653 msgid "" "Binary operations remove the top two items from the stack (``STACK[-1]`` and " "``STACK[-2]``). They perform the operation, then put the result back on the " "stack." msgstr "" -#: ../../library/dis.rst:652 +#: ../../library/dis.rst:656 msgid "" "In-place operations are like binary operations, but the operation is done in-" "place when ``STACK[-2]`` supports it, and the resulting ``STACK[-1]`` may be " "(but does not have to be) the original ``STACK[-2]``." msgstr "" -#: ../../library/dis.rst:659 +#: ../../library/dis.rst:663 msgid "" "Implements the binary and in-place operators (depending on the value of " "*op*)::" msgstr "" -#: ../../library/dis.rst:662 +#: ../../library/dis.rst:666 msgid "" "rhs = STACK.pop()\n" "lhs = STACK.pop()\n" @@ -778,17 +786,17 @@ msgstr "" "lhs = STACK.pop()\n" "STACK.append(lhs op rhs)" -#: ../../library/dis.rst:671 ../../library/dis.rst:680 -#: ../../library/dis.rst:690 ../../library/dis.rst:698 -#: ../../library/dis.rst:710 ../../library/dis.rst:798 -#: ../../library/dis.rst:808 ../../library/dis.rst:818 -#: ../../library/dis.rst:1042 ../../library/dis.rst:1053 -#: ../../library/dis.rst:1157 ../../library/dis.rst:1169 -#: ../../library/dis.rst:1181 +#: ../../library/dis.rst:675 ../../library/dis.rst:684 +#: ../../library/dis.rst:694 ../../library/dis.rst:702 +#: ../../library/dis.rst:714 ../../library/dis.rst:802 +#: ../../library/dis.rst:812 ../../library/dis.rst:822 +#: ../../library/dis.rst:1046 ../../library/dis.rst:1057 +#: ../../library/dis.rst:1161 ../../library/dis.rst:1173 +#: ../../library/dis.rst:1185 msgid "Implements::" msgstr "" -#: ../../library/dis.rst:673 +#: ../../library/dis.rst:677 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -798,7 +806,7 @@ msgstr "" "container = STACK.pop()\n" "STACK.append(container[key])" -#: ../../library/dis.rst:682 +#: ../../library/dis.rst:686 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -810,7 +818,7 @@ msgstr "" "value = STACK.pop()\n" "container[key] = value" -#: ../../library/dis.rst:692 +#: ../../library/dis.rst:696 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -820,7 +828,7 @@ msgstr "" "container = STACK.pop()\n" "del container[key]" -#: ../../library/dis.rst:700 +#: ../../library/dis.rst:704 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -832,7 +840,7 @@ msgstr "" "container = STACK.pop()\n" "STACK.append(container[start:end])" -#: ../../library/dis.rst:712 +#: ../../library/dis.rst:716 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -846,11 +854,11 @@ msgstr "" "values = STACK.pop()\n" "container[start:end] = value" -#: ../../library/dis.rst:721 +#: ../../library/dis.rst:725 msgid "**Coroutine opcodes**" msgstr "" -#: ../../library/dis.rst:725 +#: ../../library/dis.rst:729 msgid "" "Implements ``STACK[-1] = get_awaitable(STACK[-1])``, where " "``get_awaitable(o)`` returns ``o`` if ``o`` is a coroutine object or a " @@ -858,39 +866,39 @@ msgid "" "resolves ``o.__await__``." msgstr "" -#: ../../library/dis.rst:730 +#: ../../library/dis.rst:734 msgid "" "If the ``where`` operand is nonzero, it indicates where the instruction " "occurs:" msgstr "" -#: ../../library/dis.rst:733 +#: ../../library/dis.rst:737 msgid "``1``: After a call to ``__aenter__``" msgstr "" -#: ../../library/dis.rst:734 +#: ../../library/dis.rst:738 msgid "``2``: After a call to ``__aexit__``" msgstr "" -#: ../../library/dis.rst:738 +#: ../../library/dis.rst:742 msgid "Previously, this instruction did not have an oparg." msgstr "" -#: ../../library/dis.rst:744 +#: ../../library/dis.rst:748 msgid "Implements ``STACK[-1] = STACK[-1].__aiter__()``." msgstr "" -#: ../../library/dis.rst:747 +#: ../../library/dis.rst:751 msgid "Returning awaitable objects from ``__aiter__`` is no longer supported." msgstr "" -#: ../../library/dis.rst:754 +#: ../../library/dis.rst:758 msgid "" "Implement ``STACK.append(get_awaitable(STACK[-1].__anext__()))`` to the " "stack. See ``GET_AWAITABLE`` for details about ``get_awaitable``." msgstr "" -#: ../../library/dis.rst:762 +#: ../../library/dis.rst:766 msgid "" "Terminates an :keyword:`async for` loop. Handles an exception raised when " "awaiting a next item. The stack contains the async iterable in ``STACK[-2]`` " @@ -898,35 +906,35 @@ msgid "" "is not :exc:`StopAsyncIteration`, it is re-raised." msgstr "" -#: ../../library/dis.rst:769 ../../library/dis.rst:877 -#: ../../library/dis.rst:888 +#: ../../library/dis.rst:773 ../../library/dis.rst:881 +#: ../../library/dis.rst:892 msgid "" "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: ../../library/dis.rst:775 +#: ../../library/dis.rst:779 msgid "" -"Handles an exception raised during a :meth:`~generator.throw` or :meth:" -"`~generator.close` call through the current frame. If ``STACK[-1]`` is an " -"instance of :exc:`StopIteration`, pop three values from the stack and push " -"its ``value`` member. Otherwise, re-raise ``STACK[-1]``." +"Handles an exception raised during a :meth:`~generator.throw` " +"or :meth:`~generator.close` call through the current frame. If " +"``STACK[-1]`` is an instance of :exc:`StopIteration`, pop three values from " +"the stack and push its ``value`` member. Otherwise, re-raise ``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:785 +#: ../../library/dis.rst:789 msgid "" "Resolves ``__aenter__`` and ``__aexit__`` from ``STACK[-1]``. Pushes " "``__aexit__`` and result of ``__aenter__()`` to the stack::" msgstr "" -#: ../../library/dis.rst:788 +#: ../../library/dis.rst:792 msgid "STACK.extend((__aexit__, __aenter__())" msgstr "STACK.extend((__aexit__, __aenter__())" -#: ../../library/dis.rst:794 +#: ../../library/dis.rst:798 msgid "**Miscellaneous opcodes**" msgstr "" -#: ../../library/dis.rst:800 +#: ../../library/dis.rst:804 msgid "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" @@ -934,11 +942,11 @@ msgstr "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" -#: ../../library/dis.rst:803 +#: ../../library/dis.rst:807 msgid "Used to implement set comprehensions." msgstr "" -#: ../../library/dis.rst:810 +#: ../../library/dis.rst:814 msgid "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" @@ -946,11 +954,11 @@ msgstr "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" -#: ../../library/dis.rst:813 +#: ../../library/dis.rst:817 msgid "Used to implement list comprehensions." msgstr "" -#: ../../library/dis.rst:820 +#: ../../library/dis.rst:824 msgid "" "value = STACK.pop()\n" "key = STACK.pop()\n" @@ -960,53 +968,53 @@ msgstr "" "key = STACK.pop()\n" "dict.__setitem__(STACK[-i], key, value)" -#: ../../library/dis.rst:824 +#: ../../library/dis.rst:828 msgid "Used to implement dict comprehensions." msgstr "" -#: ../../library/dis.rst:827 +#: ../../library/dis.rst:831 msgid "" "Map value is ``STACK[-1]`` and map key is ``STACK[-2]``. Before, those were " "reversed." msgstr "" -#: ../../library/dis.rst:831 +#: ../../library/dis.rst:835 msgid "" -"For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` and :opcode:" -"`MAP_ADD` instructions, while the added value or key/value pair is popped " -"off, the container object remains on the stack so that it is available for " -"further iterations of the loop." +"For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` " +"and :opcode:`MAP_ADD` instructions, while the added value or key/value pair " +"is popped off, the container object remains on the stack so that it is " +"available for further iterations of the loop." msgstr "" -#: ../../library/dis.rst:839 +#: ../../library/dis.rst:843 msgid "Returns with ``STACK[-1]`` to the caller of the function." msgstr "" -#: ../../library/dis.rst:844 +#: ../../library/dis.rst:848 msgid "Returns with ``co_consts[consti]`` to the caller of the function." msgstr "" -#: ../../library/dis.rst:851 +#: ../../library/dis.rst:855 msgid "Yields ``STACK.pop()`` from a :term:`generator`." msgstr "" -#: ../../library/dis.rst:853 +#: ../../library/dis.rst:857 msgid "oparg set to be the stack depth." msgstr "" -#: ../../library/dis.rst:856 +#: ../../library/dis.rst:860 msgid "" "oparg set to be the exception block depth, for efficient closing of " "generators." msgstr "" -#: ../../library/dis.rst:859 +#: ../../library/dis.rst:863 msgid "" "oparg is ``1`` if this instruction is part of a yield-from or await, and " "``0`` otherwise." msgstr "" -#: ../../library/dis.rst:865 +#: ../../library/dis.rst:869 msgid "" "Checks whether ``__annotations__`` is defined in ``locals()``, if not it is " "set up to an empty ``dict``. This opcode is only emitted if a class or " @@ -1014,39 +1022,39 @@ msgid "" "statically." msgstr "" -#: ../../library/dis.rst:875 +#: ../../library/dis.rst:879 msgid "" "Pops a value from the stack, which is used to restore the exception state." msgstr "" -#: ../../library/dis.rst:882 +#: ../../library/dis.rst:886 msgid "" "Re-raises the exception currently on top of the stack. If oparg is non-zero, " -"pops an additional value from the stack which is used to set :attr:`~frame." -"f_lasti` of the current frame." +"pops an additional value from the stack which is used to " +"set :attr:`~frame.f_lasti` of the current frame." msgstr "" -#: ../../library/dis.rst:893 +#: ../../library/dis.rst:897 msgid "" "Pops a value from the stack. Pushes the current exception to the top of the " "stack. Pushes the value originally popped back to the stack. Used in " "exception handlers." msgstr "" -#: ../../library/dis.rst:901 +#: ../../library/dis.rst:905 msgid "" "Performs exception matching for ``except``. Tests whether the ``STACK[-2]`` " "is an exception matching ``STACK[-1]``. Pops ``STACK[-1]`` and pushes the " "boolean result of the test." msgstr "" -#: ../../library/dis.rst:909 +#: ../../library/dis.rst:913 msgid "" "Performs exception matching for ``except*``. Applies ``split(STACK[-1])`` on " "the exception group representing ``STACK[-2]``." msgstr "" -#: ../../library/dis.rst:912 +#: ../../library/dis.rst:916 msgid "" "In case of a match, pops two items from the stack and pushes the non-" "matching subgroup (``None`` in case of full match) followed by the matching " @@ -1054,7 +1062,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/dis.rst:921 +#: ../../library/dis.rst:925 msgid "" "Calls the function in position 4 on the stack with arguments (type, val, tb) " "representing the exception at the top of the stack. Used to implement the " @@ -1062,40 +1070,40 @@ msgid "" "occurred in a :keyword:`with` statement." msgstr "" -#: ../../library/dis.rst:928 +#: ../../library/dis.rst:932 msgid "" "The ``__exit__`` function is in position 4 of the stack rather than 7. " "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: ../../library/dis.rst:935 +#: ../../library/dis.rst:939 msgid "" "Pushes :exc:`AssertionError` onto the stack. Used by the :keyword:`assert` " "statement." msgstr "" -#: ../../library/dis.rst:943 +#: ../../library/dis.rst:947 msgid "" "Pushes :func:`!builtins.__build_class__` onto the stack. It is later called " "to construct a class." msgstr "" -#: ../../library/dis.rst:949 +#: ../../library/dis.rst:953 msgid "" "This opcode performs several operations before a with block starts. First, " "it loads :meth:`~object.__exit__` from the context manager and pushes it " -"onto the stack for later use by :opcode:`WITH_EXCEPT_START`. Then, :meth:" -"`~object.__enter__` is called. Finally, the result of calling the " -"``__enter__()`` method is pushed onto the stack." +"onto the stack for later use by :opcode:`WITH_EXCEPT_START`. " +"Then, :meth:`~object.__enter__` is called. Finally, the result of calling " +"the ``__enter__()`` method is pushed onto the stack." msgstr "" -#: ../../library/dis.rst:960 +#: ../../library/dis.rst:964 msgid "" "Perform ``STACK.append(len(STACK[-1]))``. Used in :keyword:`match` " "statements where comparison with structure of pattern is needed." msgstr "" -#: ../../library/dis.rst:968 +#: ../../library/dis.rst:972 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Mapping` (or, " "more technically: if it has the :c:macro:`Py_TPFLAGS_MAPPING` flag set in " @@ -1103,7 +1111,7 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:978 +#: ../../library/dis.rst:982 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Sequence` and is " "*not* an instance of :class:`str`/:class:`bytes`/:class:`bytearray` (or, " @@ -1112,40 +1120,42 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:988 +#: ../../library/dis.rst:992 msgid "" "``STACK[-1]`` is a tuple of mapping keys, and ``STACK[-2]`` is the match " -"subject. If ``STACK[-2]`` contains all of the keys in ``STACK[-1]``, push a :" -"class:`tuple` containing the corresponding values. Otherwise, push ``None``." +"subject. If ``STACK[-2]`` contains all of the keys in ``STACK[-1]``, push " +"a :class:`tuple` containing the corresponding values. Otherwise, push " +"``None``." msgstr "" -#: ../../library/dis.rst:994 ../../library/dis.rst:1686 +#: ../../library/dis.rst:998 ../../library/dis.rst:1684 msgid "" "Previously, this instruction also pushed a boolean value indicating success " "(``True``) or failure (``False``)." msgstr "" -#: ../../library/dis.rst:1001 +#: ../../library/dis.rst:1005 msgid "" "Implements ``name = STACK.pop()``. *namei* is the index of *name* in the " "attribute :attr:`~codeobject.co_names` of the :ref:`code object `. The compiler tries to use :opcode:`STORE_FAST` or :opcode:" -"`STORE_GLOBAL` if possible." +"objects>`. The compiler tries to use :opcode:`STORE_FAST` " +"or :opcode:`STORE_GLOBAL` if possible." msgstr "" -#: ../../library/dis.rst:1008 +#: ../../library/dis.rst:1012 msgid "" -"Implements ``del name``, where *namei* is the index into :attr:`~codeobject." -"co_names` attribute of the :ref:`code object `." +"Implements ``del name``, where *namei* is the index " +"into :attr:`~codeobject.co_names` attribute of the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:1014 +#: ../../library/dis.rst:1018 msgid "" "Unpacks ``STACK[-1]`` into *count* individual values, which are put onto the " "stack right-to-left. Require there to be exactly *count* values.::" msgstr "" -#: ../../library/dis.rst:1017 +#: ../../library/dis.rst:1021 msgid "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" @@ -1153,7 +1163,7 @@ msgstr "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" -#: ../../library/dis.rst:1023 +#: ../../library/dis.rst:1027 msgid "" "Implements assignment with a starred target: Unpacks an iterable in " "``STACK[-1]`` into individual values, where the total number of values can " @@ -1161,11 +1171,11 @@ msgid "" "will be a list of all leftover items." msgstr "" -#: ../../library/dis.rst:1028 +#: ../../library/dis.rst:1032 msgid "The number of values before and after the list value is limited to 255." msgstr "" -#: ../../library/dis.rst:1030 +#: ../../library/dis.rst:1034 msgid "" "The number of values before the list value is encoded in the argument of the " "opcode. The number of values after the list if any is encoded using an " @@ -1174,13 +1184,13 @@ msgid "" "list value, the high byte of *counts* the number of values after it." msgstr "" -#: ../../library/dis.rst:1036 +#: ../../library/dis.rst:1040 msgid "" "The extracted values are put onto the stack right-to-left, i.e. ``a, *b, c = " "d`` will be stored after execution as ``STACK.extend((a, b, c))``." msgstr "" -#: ../../library/dis.rst:1044 +#: ../../library/dis.rst:1048 msgid "" "obj = STACK.pop()\n" "value = STACK.pop()\n" @@ -1190,13 +1200,13 @@ msgstr "" "value = STACK.pop()\n" "obj.name = value" -#: ../../library/dis.rst:1048 +#: ../../library/dis.rst:1052 msgid "" -"where *namei* is the index of name in :attr:`~codeobject.co_names` of the :" -"ref:`code object `." +"where *namei* is the index of name in :attr:`~codeobject.co_names` of " +"the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:1055 +#: ../../library/dis.rst:1059 msgid "" "obj = STACK.pop()\n" "del obj.name" @@ -1204,38 +1214,38 @@ msgstr "" "obj = STACK.pop()\n" "del obj.name" -#: ../../library/dis.rst:1058 +#: ../../library/dis.rst:1062 msgid "" -"where *namei* is the index of name into :attr:`~codeobject.co_names` of the :" -"ref:`code object `." +"where *namei* is the index of name into :attr:`~codeobject.co_names` of " +"the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:1064 +#: ../../library/dis.rst:1068 msgid "Works as :opcode:`STORE_NAME`, but stores the name as a global." msgstr "" -#: ../../library/dis.rst:1069 +#: ../../library/dis.rst:1073 msgid "Works as :opcode:`DELETE_NAME`, but deletes a global name." msgstr "" -#: ../../library/dis.rst:1074 +#: ../../library/dis.rst:1078 msgid "Pushes ``co_consts[consti]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1079 +#: ../../library/dis.rst:1083 msgid "" "Pushes the value associated with ``co_names[namei]`` onto the stack. The " "name is looked up within the locals, then the globals, then the builtins." msgstr "" -#: ../../library/dis.rst:1085 +#: ../../library/dis.rst:1089 msgid "" "Pushes a reference to the locals dictionary onto the stack. This is used to " -"prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` and :" -"opcode:`LOAD_FROM_DICT_OR_GLOBALS`." +"prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` " +"and :opcode:`LOAD_FROM_DICT_OR_GLOBALS`." msgstr "" -#: ../../library/dis.rst:1094 +#: ../../library/dis.rst:1098 msgid "" "Pops a mapping off the stack and looks up the value for ``co_names[namei]``. " "If the name is not found there, looks it up in the globals and then the " @@ -1244,13 +1254,13 @@ msgid "" "bodies." msgstr "" -#: ../../library/dis.rst:1105 +#: ../../library/dis.rst:1109 msgid "" "Creates a tuple consuming *count* items from the stack, and pushes the " "resulting tuple onto the stack::" msgstr "" -#: ../../library/dis.rst:1108 +#: ../../library/dis.rst:1112 msgid "" "if count == 0:\n" " value = ()\n" @@ -1268,41 +1278,41 @@ msgstr "" "\n" "STACK.append(value)" -#: ../../library/dis.rst:1119 +#: ../../library/dis.rst:1123 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a list." msgstr "" -#: ../../library/dis.rst:1124 +#: ../../library/dis.rst:1128 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a set." msgstr "" -#: ../../library/dis.rst:1129 +#: ../../library/dis.rst:1133 msgid "" "Pushes a new dictionary object onto the stack. Pops ``2 * count`` items so " "that the dictionary holds *count* entries: ``{..., STACK[-4]: STACK[-3], " "STACK[-2]: STACK[-1]}``." msgstr "" -#: ../../library/dis.rst:1133 +#: ../../library/dis.rst:1137 msgid "" "The dictionary is created from stack items instead of creating an empty " "dictionary pre-sized to hold *count* items." msgstr "" -#: ../../library/dis.rst:1140 +#: ../../library/dis.rst:1144 msgid "" "The version of :opcode:`BUILD_MAP` specialized for constant keys. Pops the " "top element on the stack which contains a tuple of keys, then starting from " "``STACK[-2]``, pops *count* values to form values in the built dictionary." msgstr "" -#: ../../library/dis.rst:1149 +#: ../../library/dis.rst:1153 msgid "" "Concatenates *count* strings from the stack and pushes the resulting string " "onto the stack." msgstr "" -#: ../../library/dis.rst:1159 +#: ../../library/dis.rst:1163 msgid "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" @@ -1310,11 +1320,11 @@ msgstr "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" -#: ../../library/dis.rst:1162 +#: ../../library/dis.rst:1166 msgid "Used to build lists." msgstr "" -#: ../../library/dis.rst:1171 +#: ../../library/dis.rst:1175 msgid "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" @@ -1322,11 +1332,11 @@ msgstr "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" -#: ../../library/dis.rst:1174 +#: ../../library/dis.rst:1178 msgid "Used to build sets." msgstr "" -#: ../../library/dis.rst:1183 +#: ../../library/dis.rst:1187 msgid "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" @@ -1334,21 +1344,21 @@ msgstr "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" -#: ../../library/dis.rst:1186 +#: ../../library/dis.rst:1190 msgid "Used to build dicts." msgstr "" -#: ../../library/dis.rst:1193 +#: ../../library/dis.rst:1197 msgid "Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys." msgstr "" -#: ../../library/dis.rst:1200 +#: ../../library/dis.rst:1204 msgid "" "If the low bit of ``namei`` is not set, this replaces ``STACK[-1]`` with " "``getattr(STACK[-1], co_names[namei>>1])``." msgstr "" -#: ../../library/dis.rst:1203 +#: ../../library/dis.rst:1207 msgid "" "If the low bit of ``namei`` is set, this will attempt to load a method named " "``co_names[namei>>1]`` from the ``STACK[-1]`` object. ``STACK[-1]`` is " @@ -1360,146 +1370,140 @@ msgid "" "pushed." msgstr "" -#: ../../library/dis.rst:1212 +#: ../../library/dis.rst:1216 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is pushed to " "the stack before the attribute or unbound method respectively." msgstr "" -#: ../../library/dis.rst:1219 +#: ../../library/dis.rst:1223 msgid "" "This opcode implements :func:`super`, both in its zero-argument and two-" "argument forms (e.g. ``super().method()``, ``super().attr`` and ``super(cls, " "self).method()``, ``super(cls, self).attr``)." msgstr "" -#: ../../library/dis.rst:1223 +#: ../../library/dis.rst:1227 msgid "It pops three values from the stack (from top of stack down):" msgstr "" -#: ../../library/dis.rst:1225 +#: ../../library/dis.rst:1229 msgid "``self``: the first argument to the current method" msgstr "" -#: ../../library/dis.rst:1226 +#: ../../library/dis.rst:1230 msgid "``cls``: the class within which the current method was defined" msgstr "" -#: ../../library/dis.rst:1227 +#: ../../library/dis.rst:1231 msgid "the global ``super``" msgstr "" -#: ../../library/dis.rst:1229 +#: ../../library/dis.rst:1233 msgid "" "With respect to its argument, it works similarly to :opcode:`LOAD_ATTR`, " "except that ``namei`` is shifted left by 2 bits instead of 1." msgstr "" -#: ../../library/dis.rst:1232 +#: ../../library/dis.rst:1236 msgid "" -"The low bit of ``namei`` signals to attempt a method load, as with :opcode:" -"`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded method. When " -"it is unset a single value is pushed to the stack." +"The low bit of ``namei`` signals to attempt a method load, as " +"with :opcode:`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded " +"method. When it is unset a single value is pushed to the stack." msgstr "" -#: ../../library/dis.rst:1236 +#: ../../library/dis.rst:1240 msgid "" "The second-low bit of ``namei``, if set, means that this was a two-argument " "call to :func:`super` (unset means zero-argument)." msgstr "" -#: ../../library/dis.rst:1244 +#: ../../library/dis.rst:1248 msgid "" "Performs a Boolean operation. The operation name can be found in " "``cmp_op[opname >> 5]``. If the fifth-lowest bit of ``opname`` is set " "(``opname & 16``), the result should be coerced to ``bool``." msgstr "" -#: ../../library/dis.rst:1248 +#: ../../library/dis.rst:1252 msgid "" -"The fifth-lowest bit of the oparg now indicates a forced conversion to :" -"class:`bool`." +"The fifth-lowest bit of the oparg now indicates a forced conversion " +"to :class:`bool`." msgstr "" -#: ../../library/dis.rst:1255 +#: ../../library/dis.rst:1259 msgid "Performs ``is`` comparison, or ``is not`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1262 +#: ../../library/dis.rst:1266 msgid "Performs ``in`` comparison, or ``not in`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1269 +#: ../../library/dis.rst:1273 msgid "" "Imports the module ``co_names[namei]``. ``STACK[-1]`` and ``STACK[-2]`` are " -"popped and provide the *fromlist* and *level* arguments of :func:" -"`__import__`. The module object is pushed onto the stack. The current " -"namespace is not affected: for a proper import statement, a subsequent :" -"opcode:`STORE_FAST` instruction modifies the namespace." +"popped and provide the *fromlist* and *level* arguments " +"of :func:`__import__`. The module object is pushed onto the stack. The " +"current namespace is not affected: for a proper import statement, a " +"subsequent :opcode:`STORE_FAST` instruction modifies the namespace." msgstr "" -#: ../../library/dis.rst:1277 +#: ../../library/dis.rst:1281 msgid "" "Loads the attribute ``co_names[namei]`` from the module found in " "``STACK[-1]``. The resulting object is pushed onto the stack, to be " "subsequently stored by a :opcode:`STORE_FAST` instruction." msgstr "" -#: ../../library/dis.rst:1284 +#: ../../library/dis.rst:1288 msgid "Increments bytecode counter by *delta*." msgstr "" -#: ../../library/dis.rst:1289 +#: ../../library/dis.rst:1293 msgid "Decrements bytecode counter by *delta*. Checks for interrupts." msgstr "" -#: ../../library/dis.rst:1296 +#: ../../library/dis.rst:1300 msgid "Decrements bytecode counter by *delta*. Does not check for interrupts." msgstr "" -#: ../../library/dis.rst:1303 +#: ../../library/dis.rst:1307 msgid "" "If ``STACK[-1]`` is true, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1306 ../../library/dis.rst:1322 +#: ../../library/dis.rst:1310 ../../library/dis.rst:1326 msgid "" "The oparg is now a relative delta rather than an absolute target. This " "opcode is a pseudo-instruction, replaced in final bytecode by the directed " "versions (forward/backward)." msgstr "" -#: ../../library/dis.rst:1311 ../../library/dis.rst:1327 -#: ../../library/dis.rst:1343 ../../library/dis.rst:1357 +#: ../../library/dis.rst:1315 ../../library/dis.rst:1331 +#: ../../library/dis.rst:1344 ../../library/dis.rst:1355 msgid "This is no longer a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1319 +#: ../../library/dis.rst:1323 msgid "" "If ``STACK[-1]`` is false, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1335 +#: ../../library/dis.rst:1339 msgid "" "If ``STACK[-1]`` is not ``None``, increments the bytecode counter by " "*delta*. ``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1338 ../../library/dis.rst:1352 -msgid "" -"This opcode is a pseudo-instruction, replaced in final bytecode by the " -"directed versions (forward/backward)." -msgstr "" - -#: ../../library/dis.rst:1349 +#: ../../library/dis.rst:1350 msgid "" "If ``STACK[-1]`` is ``None``, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1362 +#: ../../library/dis.rst:1360 msgid "" "``STACK[-1]`` is an :term:`iterator`. Call its :meth:`~iterator.__next__` " "method. If this yields a new value, push it on the stack (leaving the " @@ -1507,207 +1511,207 @@ msgid "" "code counter is incremented by *delta*." msgstr "" -#: ../../library/dis.rst:1367 +#: ../../library/dis.rst:1365 msgid "Up until 3.11 the iterator was popped when it was exhausted." msgstr "" -#: ../../library/dis.rst:1372 +#: ../../library/dis.rst:1370 msgid "Loads the global named ``co_names[namei>>1]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1374 +#: ../../library/dis.rst:1372 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` is pushed to the stack " "before the global variable." msgstr "" -#: ../../library/dis.rst:1380 +#: ../../library/dis.rst:1378 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1382 +#: ../../library/dis.rst:1380 msgid "" "This opcode is now only used in situations where the local variable is " "guaranteed to be initialized. It cannot raise :exc:`UnboundLocalError`." msgstr "" -#: ../../library/dis.rst:1388 +#: ../../library/dis.rst:1386 msgid "" "Pushes references to ``co_varnames[var_nums >> 4]`` and " "``co_varnames[var_nums & 15]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1395 +#: ../../library/dis.rst:1393 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack, " "raising an :exc:`UnboundLocalError` if the local variable has not been " "initialized." msgstr "" -#: ../../library/dis.rst:1403 +#: ../../library/dis.rst:1401 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack (or " "pushes ``NULL`` onto the stack if the local variable has not been " "initialized) and sets ``co_varnames[var_num]`` to ``NULL``." msgstr "" -#: ../../library/dis.rst:1411 +#: ../../library/dis.rst:1409 msgid "Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1415 +#: ../../library/dis.rst:1413 msgid "" "Stores ``STACK[-1]`` into ``co_varnames[var_nums >> 4]`` and ``STACK[-2]`` " "into ``co_varnames[var_nums & 15]``." msgstr "" -#: ../../library/dis.rst:1422 +#: ../../library/dis.rst:1420 msgid "" "Stores ``STACK.pop()`` into the local ``co_varnames[var_nums >> 4]`` and " "pushes a reference to the local ``co_varnames[var_nums & 15]`` onto the " "stack." msgstr "" -#: ../../library/dis.rst:1430 +#: ../../library/dis.rst:1428 msgid "Deletes local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1435 +#: ../../library/dis.rst:1433 msgid "" "Creates a new cell in slot ``i``. If that slot is nonempty then that value " "is stored into the new cell." msgstr "" -#: ../../library/dis.rst:1443 +#: ../../library/dis.rst:1441 msgid "" "Loads the cell contained in slot ``i`` of the \"fast locals\" storage. " "Pushes a reference to the object the cell contains on the stack." msgstr "" -#: ../../library/dis.rst:1446 ../../library/dis.rst:1468 -#: ../../library/dis.rst:1479 +#: ../../library/dis.rst:1444 ../../library/dis.rst:1466 +#: ../../library/dis.rst:1477 msgid "" "``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`." msgstr "" -#: ../../library/dis.rst:1452 +#: ../../library/dis.rst:1450 msgid "" "Pops a mapping off the stack and looks up the name associated with slot " "``i`` of the \"fast locals\" storage in this mapping. If the name is not " -"found there, loads it from the cell contained in slot ``i``, similar to :" -"opcode:`LOAD_DEREF`. This is used for loading :term:`closure variables " +"found there, loads it from the cell contained in slot ``i``, similar " +"to :opcode:`LOAD_DEREF`. This is used for loading :term:`closure variables " "` in class bodies (which previously used :opcode:`!" "LOAD_CLASSDEREF`) and in :ref:`annotation scopes ` within " "class bodies." msgstr "" -#: ../../library/dis.rst:1465 +#: ../../library/dis.rst:1463 msgid "" "Stores ``STACK.pop()`` into the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1474 +#: ../../library/dis.rst:1472 msgid "" "Empties the cell contained in slot ``i`` of the \"fast locals\" storage. " "Used by the :keyword:`del` statement." msgstr "" -#: ../../library/dis.rst:1485 +#: ../../library/dis.rst:1483 msgid "" "Copies the ``n`` :term:`free (closure) variables ` from " "the closure into the frame. Removes the need for special code on the " "caller's side when calling closures." msgstr "" -#: ../../library/dis.rst:1494 +#: ../../library/dis.rst:1492 msgid "" "Raises an exception using one of the 3 forms of the ``raise`` statement, " "depending on the value of *argc*:" msgstr "" -#: ../../library/dis.rst:1497 +#: ../../library/dis.rst:1495 msgid "0: ``raise`` (re-raise previous exception)" msgstr "" -#: ../../library/dis.rst:1498 +#: ../../library/dis.rst:1496 msgid "" "1: ``raise STACK[-1]`` (raise exception instance or type at ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1499 +#: ../../library/dis.rst:1497 msgid "" "2: ``raise STACK[-2] from STACK[-1]`` (raise exception instance or type at " "``STACK[-2]`` with ``__cause__`` set to ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1505 +#: ../../library/dis.rst:1503 msgid "" "Calls a callable object with the number of arguments specified by ``argc``. " "On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1508 ../../library/dis.rst:1532 +#: ../../library/dis.rst:1506 ../../library/dis.rst:1530 msgid "The callable" msgstr "" -#: ../../library/dis.rst:1509 ../../library/dis.rst:1533 +#: ../../library/dis.rst:1507 ../../library/dis.rst:1531 msgid "``self`` or ``NULL``" msgstr "" -#: ../../library/dis.rst:1510 ../../library/dis.rst:1534 +#: ../../library/dis.rst:1508 ../../library/dis.rst:1532 msgid "The remaining positional arguments" msgstr "" -#: ../../library/dis.rst:1512 +#: ../../library/dis.rst:1510 msgid "``argc`` is the total of the positional arguments, excluding ``self``." msgstr "" -#: ../../library/dis.rst:1514 +#: ../../library/dis.rst:1512 msgid "" "``CALL`` pops all arguments and the callable object off the stack, calls the " "callable object with those arguments, and pushes the return value returned " "by the callable object." msgstr "" -#: ../../library/dis.rst:1520 +#: ../../library/dis.rst:1518 msgid "The callable now always appears at the same position on the stack." msgstr "" -#: ../../library/dis.rst:1523 +#: ../../library/dis.rst:1521 msgid "Calls with keyword arguments are now handled by :opcode:`CALL_KW`." msgstr "" -#: ../../library/dis.rst:1529 +#: ../../library/dis.rst:1527 msgid "" "Calls a callable object with the number of arguments specified by ``argc``, " "including one or more named arguments. On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1535 +#: ../../library/dis.rst:1533 msgid "The named arguments" msgstr "" -#: ../../library/dis.rst:1536 +#: ../../library/dis.rst:1534 msgid "A :class:`tuple` of keyword argument names" msgstr "" -#: ../../library/dis.rst:1538 +#: ../../library/dis.rst:1536 msgid "" "``argc`` is the total of the positional and named arguments, excluding " "``self``. The length of the tuple of keyword argument names is the number of " "named arguments." msgstr "" -#: ../../library/dis.rst:1541 +#: ../../library/dis.rst:1539 msgid "" "``CALL_KW`` pops all arguments, the keyword names, and the callable object " "off the stack, calls the callable object with those arguments, and pushes " "the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1550 +#: ../../library/dis.rst:1548 msgid "" "Calls a callable object with variable set of positional and keyword " "arguments. If the lowest bit of *flags* is set, the top of the stack " @@ -1719,33 +1723,33 @@ msgid "" "arguments, and pushes the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1565 +#: ../../library/dis.rst:1563 msgid "" "Pushes a ``NULL`` to the stack. Used in the call sequence to match the " "``NULL`` pushed by :opcode:`LOAD_METHOD` for non-method calls." msgstr "" -#: ../../library/dis.rst:1574 +#: ../../library/dis.rst:1572 msgid "" "Pushes a new function object on the stack built from the code object at " "``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:1576 +#: ../../library/dis.rst:1574 msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" msgstr "" -#: ../../library/dis.rst:1579 +#: ../../library/dis.rst:1577 msgid "Qualified name at ``STACK[-1]`` was removed." msgstr "" -#: ../../library/dis.rst:1582 +#: ../../library/dis.rst:1580 msgid "" "Extra function attributes on the stack, signaled by oparg flags, were " "removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`." msgstr "" -#: ../../library/dis.rst:1589 +#: ../../library/dis.rst:1587 msgid "" "Sets an attribute on a function object. Expects the function at " "``STACK[-1]`` and the attribute value to set at ``STACK[-2]``; consumes both " @@ -1753,42 +1757,42 @@ msgid "" "attribute to set:" msgstr "" -#: ../../library/dis.rst:1593 +#: ../../library/dis.rst:1591 msgid "" "``0x01`` a tuple of default values for positional-only and positional-or-" "keyword parameters in positional order" msgstr "" -#: ../../library/dis.rst:1595 +#: ../../library/dis.rst:1593 msgid "``0x02`` a dictionary of keyword-only parameters' default values" msgstr "" -#: ../../library/dis.rst:1596 +#: ../../library/dis.rst:1594 msgid "``0x04`` a tuple of strings containing parameters' annotations" msgstr "" -#: ../../library/dis.rst:1597 +#: ../../library/dis.rst:1595 msgid "``0x08`` a tuple containing cells for free variables, making a closure" msgstr "" -#: ../../library/dis.rst:1606 +#: ../../library/dis.rst:1604 msgid "" "Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, " "implements::" msgstr "" -#: ../../library/dis.rst:1608 +#: ../../library/dis.rst:1606 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" "STACK.append(slice(start, end))" msgstr "" -#: ../../library/dis.rst:1612 +#: ../../library/dis.rst:1610 msgid "if it is 3, implements::" msgstr "" -#: ../../library/dis.rst:1614 +#: ../../library/dis.rst:1612 msgid "" "step = STACK.pop()\n" "end = STACK.pop()\n" @@ -1800,11 +1804,11 @@ msgstr "" "start = STACK.pop()\n" "STACK.append(slice(start, end, step))" -#: ../../library/dis.rst:1619 +#: ../../library/dis.rst:1617 msgid "See the :func:`slice` built-in function for more information." msgstr "" -#: ../../library/dis.rst:1624 +#: ../../library/dis.rst:1622 msgid "" "Prefixes any opcode which has an argument too big to fit into the default " "one byte. *ext* holds an additional byte which act as higher bits in the " @@ -1812,11 +1816,11 @@ msgid "" "allowed, forming an argument from two-byte to four-byte." msgstr "" -#: ../../library/dis.rst:1632 +#: ../../library/dis.rst:1630 msgid "Convert value to a string, depending on ``oparg``::" msgstr "" -#: ../../library/dis.rst:1634 +#: ../../library/dis.rst:1632 msgid "" "value = STACK.pop()\n" "result = func(value)\n" @@ -1826,28 +1830,28 @@ msgstr "" "result = func(value)\n" "STACK.append(result)" -#: ../../library/dis.rst:1638 +#: ../../library/dis.rst:1636 msgid "``oparg == 1``: call :func:`str` on *value*" msgstr "" -#: ../../library/dis.rst:1639 +#: ../../library/dis.rst:1637 msgid "``oparg == 2``: call :func:`repr` on *value*" msgstr "" -#: ../../library/dis.rst:1640 +#: ../../library/dis.rst:1638 msgid "``oparg == 3``: call :func:`ascii` on *value*" msgstr "" -#: ../../library/dis.rst:1642 ../../library/dis.rst:1655 -#: ../../library/dis.rst:1668 -msgid "Used for implementing formatted literal strings (f-strings)." +#: ../../library/dis.rst:1640 ../../library/dis.rst:1653 +#: ../../library/dis.rst:1666 +msgid "Used for implementing formatted string literals (f-strings)." msgstr "" -#: ../../library/dis.rst:1649 +#: ../../library/dis.rst:1647 msgid "Formats the value on top of stack::" msgstr "" -#: ../../library/dis.rst:1651 +#: ../../library/dis.rst:1649 msgid "" "value = STACK.pop()\n" "result = value.__format__(\"\")\n" @@ -1857,11 +1861,11 @@ msgstr "" "result = value.__format__(\"\")\n" "STACK.append(result)" -#: ../../library/dis.rst:1661 +#: ../../library/dis.rst:1659 msgid "Formats the given value with the given format spec::" msgstr "" -#: ../../library/dis.rst:1663 +#: ../../library/dis.rst:1661 msgid "" "spec = STACK.pop()\n" "value = STACK.pop()\n" @@ -1873,14 +1877,14 @@ msgstr "" "result = value.__format__(spec)\n" "STACK.append(result)" -#: ../../library/dis.rst:1675 +#: ../../library/dis.rst:1673 msgid "" "``STACK[-1]`` is a tuple of keyword attribute names, ``STACK[-2]`` is the " "class being matched against, and ``STACK[-3]`` is the match subject. " "*count* is the number of positional sub-patterns." msgstr "" -#: ../../library/dis.rst:1679 +#: ../../library/dis.rst:1677 msgid "" "Pop ``STACK[-1]``, ``STACK[-2]``, and ``STACK[-3]``. If ``STACK[-3]`` is an " "instance of ``STACK[-2]`` and has the positional and keyword attributes " @@ -1888,219 +1892,219 @@ msgid "" "Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:1693 +#: ../../library/dis.rst:1691 msgid "A no-op. Performs internal tracing, debugging and optimization checks." msgstr "" -#: ../../library/dis.rst:1695 +#: ../../library/dis.rst:1693 msgid "" "The ``context`` oparand consists of two parts. The lowest two bits indicate " "where the ``RESUME`` occurs:" msgstr "" -#: ../../library/dis.rst:1698 +#: ../../library/dis.rst:1696 msgid "" "``0`` The start of a function, which is neither a generator, coroutine nor " "an async generator" msgstr "" -#: ../../library/dis.rst:1700 +#: ../../library/dis.rst:1698 msgid "``1`` After a ``yield`` expression" msgstr "" -#: ../../library/dis.rst:1701 +#: ../../library/dis.rst:1699 msgid "``2`` After a ``yield from`` expression" msgstr "" -#: ../../library/dis.rst:1702 +#: ../../library/dis.rst:1700 msgid "``3`` After an ``await`` expression" msgstr "" -#: ../../library/dis.rst:1704 +#: ../../library/dis.rst:1702 msgid "" "The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` " "otherwise." msgstr "" -#: ../../library/dis.rst:1709 +#: ../../library/dis.rst:1707 msgid "The oparg value changed to include information about except-depth" msgstr "" -#: ../../library/dis.rst:1715 +#: ../../library/dis.rst:1713 msgid "" "Create a generator, coroutine, or async generator from the current frame. " "Used as first opcode of in code object for the above mentioned callables. " "Clear the current frame and return the newly created generator." msgstr "" -#: ../../library/dis.rst:1724 +#: ../../library/dis.rst:1722 msgid "" "Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])``. Used in ``yield " "from`` and ``await`` statements." msgstr "" -#: ../../library/dis.rst:1727 +#: ../../library/dis.rst:1725 msgid "" "If the call raises :exc:`StopIteration`, pop the top value from the stack, " "push the exception's ``value`` attribute, and increment the bytecode counter " "by *delta*." msgstr "" -#: ../../library/dis.rst:1736 +#: ../../library/dis.rst:1734 msgid "" "This is not really an opcode. It identifies the dividing line between " "opcodes in the range [0,255] which don't use their argument and those that " "do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively)." msgstr "" -#: ../../library/dis.rst:1740 +#: ../../library/dis.rst:1738 msgid "" "If your application uses pseudo instructions or specialized instructions, " "use the :data:`hasarg` collection instead." msgstr "" -#: ../../library/dis.rst:1743 +#: ../../library/dis.rst:1741 msgid "" "Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT`` " "ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument." msgstr "" -#: ../../library/dis.rst:1747 +#: ../../library/dis.rst:1745 msgid "" "Pseudo instructions were added to the :mod:`dis` module, and for them it is " "not true that comparison with ``HAVE_ARGUMENT`` indicates whether they use " "their arg." msgstr "" -#: ../../library/dis.rst:1752 +#: ../../library/dis.rst:1750 msgid "Use :data:`hasarg` instead." msgstr "" -#: ../../library/dis.rst:1757 +#: ../../library/dis.rst:1755 msgid "" "Calls an intrinsic function with one argument. Passes ``STACK[-1]`` as the " "argument and sets ``STACK[-1]`` to the result. Used to implement " "functionality that is not performance critical." msgstr "" -#: ../../library/dis.rst:1761 ../../library/dis.rst:1815 +#: ../../library/dis.rst:1759 ../../library/dis.rst:1813 msgid "The operand determines which intrinsic function is called:" msgstr "" -#: ../../library/dis.rst:1764 ../../library/dis.rst:1818 +#: ../../library/dis.rst:1762 ../../library/dis.rst:1816 msgid "Operand" msgstr "運算元" -#: ../../library/dis.rst:1764 ../../library/dis.rst:1818 +#: ../../library/dis.rst:1762 ../../library/dis.rst:1816 msgid "Description" msgstr "描述" -#: ../../library/dis.rst:1766 +#: ../../library/dis.rst:1764 msgid "``INTRINSIC_1_INVALID``" msgstr "``INTRINSIC_1_INVALID``" -#: ../../library/dis.rst:1766 ../../library/dis.rst:1820 +#: ../../library/dis.rst:1764 ../../library/dis.rst:1818 msgid "Not valid" msgstr "" -#: ../../library/dis.rst:1768 +#: ../../library/dis.rst:1766 msgid "``INTRINSIC_PRINT``" msgstr "``INTRINSIC_PRINT``" -#: ../../library/dis.rst:1768 +#: ../../library/dis.rst:1766 msgid "Prints the argument to standard out. Used in the REPL." msgstr "" -#: ../../library/dis.rst:1771 +#: ../../library/dis.rst:1769 msgid "``INTRINSIC_IMPORT_STAR``" msgstr "``INTRINSIC_IMPORT_STAR``" -#: ../../library/dis.rst:1771 +#: ../../library/dis.rst:1769 msgid "Performs ``import *`` for the named module." msgstr "" -#: ../../library/dis.rst:1774 +#: ../../library/dis.rst:1772 msgid "``INTRINSIC_STOPITERATION_ERROR``" msgstr "``INTRINSIC_STOPITERATION_ERROR``" -#: ../../library/dis.rst:1774 +#: ../../library/dis.rst:1772 msgid "Extracts the return value from a ``StopIteration`` exception." msgstr "" -#: ../../library/dis.rst:1777 +#: ../../library/dis.rst:1775 msgid "``INTRINSIC_ASYNC_GEN_WRAP``" msgstr "``INTRINSIC_ASYNC_GEN_WRAP``" -#: ../../library/dis.rst:1777 +#: ../../library/dis.rst:1775 msgid "Wraps an async generator value" msgstr "" -#: ../../library/dis.rst:1779 +#: ../../library/dis.rst:1777 msgid "``INTRINSIC_UNARY_POSITIVE``" msgstr "``INTRINSIC_UNARY_POSITIVE``" -#: ../../library/dis.rst:1779 +#: ../../library/dis.rst:1777 msgid "Performs the unary ``+`` operation" msgstr "" -#: ../../library/dis.rst:1782 +#: ../../library/dis.rst:1780 msgid "``INTRINSIC_LIST_TO_TUPLE``" msgstr "``INTRINSIC_LIST_TO_TUPLE``" -#: ../../library/dis.rst:1782 +#: ../../library/dis.rst:1780 msgid "Converts a list to a tuple" msgstr "" -#: ../../library/dis.rst:1784 +#: ../../library/dis.rst:1782 msgid "``INTRINSIC_TYPEVAR``" msgstr "``INTRINSIC_TYPEVAR``" -#: ../../library/dis.rst:1784 +#: ../../library/dis.rst:1782 msgid "Creates a :class:`typing.TypeVar`" msgstr "" -#: ../../library/dis.rst:1786 +#: ../../library/dis.rst:1784 msgid "``INTRINSIC_PARAMSPEC``" msgstr "``INTRINSIC_PARAMSPEC``" -#: ../../library/dis.rst:1786 +#: ../../library/dis.rst:1784 msgid "Creates a :class:`typing.ParamSpec`" msgstr "" -#: ../../library/dis.rst:1789 +#: ../../library/dis.rst:1787 msgid "``INTRINSIC_TYPEVARTUPLE``" msgstr "``INTRINSIC_TYPEVARTUPLE``" -#: ../../library/dis.rst:1789 +#: ../../library/dis.rst:1787 msgid "Creates a :class:`typing.TypeVarTuple`" msgstr "" -#: ../../library/dis.rst:1792 +#: ../../library/dis.rst:1790 msgid "``INTRINSIC_SUBSCRIPT_GENERIC``" msgstr "``INTRINSIC_SUBSCRIPT_GENERIC``" -#: ../../library/dis.rst:1792 +#: ../../library/dis.rst:1790 msgid "Returns :class:`typing.Generic` subscripted with the argument" msgstr "" -#: ../../library/dis.rst:1795 +#: ../../library/dis.rst:1793 msgid "``INTRINSIC_TYPEALIAS``" msgstr "``INTRINSIC_TYPEALIAS``" -#: ../../library/dis.rst:1795 +#: ../../library/dis.rst:1793 msgid "" "Creates a :class:`typing.TypeAliasType`; used in the :keyword:`type` " "statement. The argument is a tuple of the type alias's name, type " "parameters, and value." msgstr "" -#: ../../library/dis.rst:1807 +#: ../../library/dis.rst:1805 msgid "" "Calls an intrinsic function with two arguments. Used to implement " "functionality that is not performance critical::" msgstr "" -#: ../../library/dis.rst:1810 +#: ../../library/dis.rst:1808 msgid "" "arg2 = STACK.pop()\n" "arg1 = STACK.pop()\n" @@ -2112,61 +2116,61 @@ msgstr "" "result = intrinsic2(arg1, arg2)\n" "STACK.append(result)" -#: ../../library/dis.rst:1820 +#: ../../library/dis.rst:1818 msgid "``INTRINSIC_2_INVALID``" msgstr "``INTRINSIC_2_INVALID``" -#: ../../library/dis.rst:1822 +#: ../../library/dis.rst:1820 msgid "``INTRINSIC_PREP_RERAISE_STAR``" msgstr "``INTRINSIC_PREP_RERAISE_STAR``" -#: ../../library/dis.rst:1822 +#: ../../library/dis.rst:1820 msgid "Calculates the :exc:`ExceptionGroup` to raise from a ``try-except*``." msgstr "" -#: ../../library/dis.rst:1826 +#: ../../library/dis.rst:1824 msgid "``INTRINSIC_TYPEVAR_WITH_BOUND``" msgstr "``INTRINSIC_TYPEVAR_WITH_BOUND``" -#: ../../library/dis.rst:1826 +#: ../../library/dis.rst:1824 msgid "Creates a :class:`typing.TypeVar` with a bound." msgstr "" -#: ../../library/dis.rst:1829 +#: ../../library/dis.rst:1827 msgid "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" msgstr "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" -#: ../../library/dis.rst:1829 +#: ../../library/dis.rst:1827 msgid "Creates a :class:`typing.TypeVar` with constraints." msgstr "" -#: ../../library/dis.rst:1833 +#: ../../library/dis.rst:1831 msgid "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" msgstr "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" -#: ../../library/dis.rst:1833 +#: ../../library/dis.rst:1831 msgid "Sets the ``__type_params__`` attribute of a function." msgstr "" -#: ../../library/dis.rst:1840 +#: ../../library/dis.rst:1838 msgid "**Pseudo-instructions**" msgstr "" -#: ../../library/dis.rst:1842 +#: ../../library/dis.rst:1840 msgid "" "These opcodes do not appear in Python bytecode. They are used by the " "compiler but are replaced by real opcodes or removed before bytecode is " "generated." msgstr "" -#: ../../library/dis.rst:1847 +#: ../../library/dis.rst:1845 msgid "" "Set up an exception handler for the following code block. If an exception " "occurs, the value stack level is restored to its current state and control " "is transferred to the exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1854 +#: ../../library/dis.rst:1852 msgid "" "Like ``SETUP_FINALLY``, but in case of an exception also pushes the last " "instruction (``lasti``) to the stack so that ``RERAISE`` can restore it. If " @@ -2175,91 +2179,92 @@ msgid "" "exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1863 +#: ../../library/dis.rst:1861 msgid "" "Like ``SETUP_CLEANUP``, but in case of an exception one more item is popped " "from the stack before control is transferred to the exception handler at " "``target``." msgstr "" -#: ../../library/dis.rst:1867 +#: ../../library/dis.rst:1865 msgid "" "This variant is used in :keyword:`with` and :keyword:`async with` " -"constructs, which push the return value of the context manager's :meth:" -"`~object.__enter__` or :meth:`~object.__aenter__` to the stack." +"constructs, which push the return value of the context " +"manager's :meth:`~object.__enter__` or :meth:`~object.__aenter__` to the " +"stack." msgstr "" -#: ../../library/dis.rst:1874 +#: ../../library/dis.rst:1872 msgid "" "Marks the end of the code block associated with the last ``SETUP_FINALLY``, " "``SETUP_CLEANUP`` or ``SETUP_WITH``." msgstr "" -#: ../../library/dis.rst:1880 +#: ../../library/dis.rst:1878 msgid "" "Undirected relative jump instructions which are replaced by their directed " "(forward/backward) counterparts by the assembler." msgstr "" -#: ../../library/dis.rst:1885 +#: ../../library/dis.rst:1883 msgid "" "Pushes a reference to the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1888 +#: ../../library/dis.rst:1886 msgid "" "Note that ``LOAD_CLOSURE`` is replaced with ``LOAD_FAST`` in the assembler." msgstr "" -#: ../../library/dis.rst:1890 +#: ../../library/dis.rst:1888 msgid "This opcode is now a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1896 +#: ../../library/dis.rst:1894 msgid "" "Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode with a " "flag set in the arg." msgstr "" -#: ../../library/dis.rst:1903 +#: ../../library/dis.rst:1901 msgid "Opcode collections" msgstr "" -#: ../../library/dis.rst:1905 +#: ../../library/dis.rst:1903 msgid "" "These collections are provided for automatic introspection of bytecode " "instructions:" msgstr "" -#: ../../library/dis.rst:1908 +#: ../../library/dis.rst:1906 msgid "" "The collections now contain pseudo instructions and instrumented " "instructions as well. These are opcodes with values ``>= MIN_PSEUDO_OPCODE`` " "and ``>= MIN_INSTRUMENTED_OPCODE``." msgstr "" -#: ../../library/dis.rst:1915 +#: ../../library/dis.rst:1913 msgid "Sequence of operation names, indexable using the bytecode." msgstr "" -#: ../../library/dis.rst:1920 +#: ../../library/dis.rst:1918 msgid "Dictionary mapping operation names to bytecodes." msgstr "" -#: ../../library/dis.rst:1925 +#: ../../library/dis.rst:1923 msgid "Sequence of all compare operation names." msgstr "" -#: ../../library/dis.rst:1930 +#: ../../library/dis.rst:1928 msgid "Sequence of bytecodes that use their argument." msgstr "" -#: ../../library/dis.rst:1937 +#: ../../library/dis.rst:1935 msgid "Sequence of bytecodes that access a constant." msgstr "" -#: ../../library/dis.rst:1942 +#: ../../library/dis.rst:1940 msgid "" "Sequence of bytecodes that access a :term:`free (closure) variable `. 'free' in this context refers to names in the current scope that " @@ -2268,47 +2273,47 @@ msgid "" "scopes." msgstr "" -#: ../../library/dis.rst:1950 +#: ../../library/dis.rst:1948 msgid "Sequence of bytecodes that access an attribute by name." msgstr "" -#: ../../library/dis.rst:1955 +#: ../../library/dis.rst:1953 msgid "Sequence of bytecodes that have a jump target. All jumps are relative." msgstr "" -#: ../../library/dis.rst:1962 +#: ../../library/dis.rst:1960 msgid "Sequence of bytecodes that access a local variable." msgstr "" -#: ../../library/dis.rst:1967 +#: ../../library/dis.rst:1965 msgid "Sequence of bytecodes of Boolean operations." msgstr "" -#: ../../library/dis.rst:1971 +#: ../../library/dis.rst:1969 msgid "Sequence of bytecodes that set an exception handler." msgstr "" -#: ../../library/dis.rst:1978 +#: ../../library/dis.rst:1976 msgid "Sequence of bytecodes that have a relative jump target." msgstr "" -#: ../../library/dis.rst:1980 +#: ../../library/dis.rst:1978 msgid "All jumps are now relative. Use :data:`hasjump`." msgstr "" -#: ../../library/dis.rst:1986 +#: ../../library/dis.rst:1984 msgid "Sequence of bytecodes that have an absolute jump target." msgstr "" -#: ../../library/dis.rst:1988 +#: ../../library/dis.rst:1986 msgid "All jumps are now relative. This list is empty." msgstr "" -#: ../../library/dis.rst:1604 +#: ../../library/dis.rst:1602 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/dis.rst:1604 +#: ../../library/dis.rst:1602 msgid "slice" msgstr "slice(切片)" diff --git a/library/doctest.po b/library/doctest.po index fda2f389c6..fb18a89516 100644 --- a/library/doctest.po +++ b/library/doctest.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-17 00:15+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,7 +42,7 @@ msgstr "" msgid "" "To perform regression testing by verifying that interactive examples from a " "test file or a test object work as expected." -msgstr "" +msgstr "透過驗證測試檔案或測試物件中的互動式範例是否按預期運作來執行迴歸測試。" #: ../../library/doctest.rst:26 msgid "" @@ -166,7 +166,6 @@ msgid "And so on, eventually ending with:" msgstr "" #: ../../library/doctest.rst:116 -#, fuzzy msgid "" "Trying:\n" " factorial(1e100)\n" @@ -191,10 +190,10 @@ msgstr "" " OverflowError: n too large\n" "ok\n" "2 items passed all tests:\n" -" 1 tests in __main__\n" -" 8 tests in __main__.factorial\n" -"9 tests in 2 items.\n" -"9 passed and 0 failed.\n" +" 1 test in __main__\n" +" 6 tests in __main__.factorial\n" +"7 tests in 2 items.\n" +"7 passed.\n" "Test passed.\n" "$" @@ -273,39 +272,27 @@ msgstr "" #: ../../library/doctest.rst:176 msgid "" -"There is also a command line shortcut for running :func:`testmod`. You can " -"instruct the Python interpreter to run the doctest module directly from the " -"standard library and pass the module name(s) on the command line::" +"There is also a command line shortcut for running :func:`testmod`, see " +"section :ref:`doctest-cli`." msgstr "" -#: ../../library/doctest.rst:180 -msgid "python -m doctest -v example.py" -msgstr "python -m doctest -v example.py" - -#: ../../library/doctest.rst:182 -msgid "" -"This will import :file:`example.py` as a standalone module and run :func:" -"`testmod` on it. Note that this may not work correctly if the file is part " -"of a package and imports other submodules from that package." -msgstr "" - -#: ../../library/doctest.rst:186 +#: ../../library/doctest.rst:179 msgid "" "For more information on :func:`testmod`, see section :ref:`doctest-basic-" "api`." msgstr "" -#: ../../library/doctest.rst:192 +#: ../../library/doctest.rst:185 msgid "Simple Usage: Checking Examples in a Text File" msgstr "" -#: ../../library/doctest.rst:194 +#: ../../library/doctest.rst:187 msgid "" "Another simple application of doctest is testing interactive examples in a " "text file. This can be done with the :func:`testfile` function::" msgstr "" -#: ../../library/doctest.rst:197 +#: ../../library/doctest.rst:190 msgid "" "import doctest\n" "doctest.testfile(\"example.txt\")" @@ -313,7 +300,7 @@ msgstr "" "import doctest\n" "doctest.testfile(\"example.txt\")" -#: ../../library/doctest.rst:200 +#: ../../library/doctest.rst:193 msgid "" "That short script executes and verifies any interactive Python examples " "contained in the file :file:`example.txt`. The file content is treated as " @@ -321,7 +308,7 @@ msgid "" "Python program! For example, perhaps :file:`example.txt` contains this:" msgstr "" -#: ../../library/doctest.rst:205 +#: ../../library/doctest.rst:198 msgid "" "The ``example`` module\n" "======================\n" @@ -355,13 +342,13 @@ msgstr "" " >>> factorial(6)\n" " 120" -#: ../../library/doctest.rst:223 +#: ../../library/doctest.rst:216 msgid "" "Running ``doctest.testfile(\"example.txt\")`` then finds the error in this " "documentation::" msgstr "" -#: ../../library/doctest.rst:226 +#: ../../library/doctest.rst:219 msgid "" "File \"./example.txt\", line 14, in example.txt\n" "Failed example:\n" @@ -379,7 +366,7 @@ msgstr "" "Got:\n" " 720" -#: ../../library/doctest.rst:234 +#: ../../library/doctest.rst:227 msgid "" "As with :func:`testmod`, :func:`testfile` won't display anything unless an " "example fails. If an example does fail, then the failing example(s) and the " @@ -387,7 +374,7 @@ msgid "" "func:`testmod`." msgstr "" -#: ../../library/doctest.rst:239 +#: ../../library/doctest.rst:232 msgid "" "By default, :func:`testfile` looks for files in the calling module's " "directory. See section :ref:`doctest-basic-api` for a description of the " @@ -395,40 +382,79 @@ msgid "" "locations." msgstr "" -#: ../../library/doctest.rst:243 +#: ../../library/doctest.rst:236 msgid "" "Like :func:`testmod`, :func:`testfile`'s verbosity can be set with the ``-" "v`` command-line switch or with the optional keyword argument *verbose*." msgstr "" -#: ../../library/doctest.rst:247 +#: ../../library/doctest.rst:240 msgid "" -"There is also a command line shortcut for running :func:`testfile`. You can " -"instruct the Python interpreter to run the doctest module directly from the " -"standard library and pass the file name(s) on the command line::" +"There is also a command line shortcut for running :func:`testfile`, see " +"section :ref:`doctest-cli`." +msgstr "" + +#: ../../library/doctest.rst:243 +msgid "" +"For more information on :func:`testfile`, see section :ref:`doctest-basic-" +"api`." +msgstr "" + +#: ../../library/doctest.rst:249 +msgid "Command-line Usage" msgstr "" #: ../../library/doctest.rst:251 -msgid "python -m doctest -v example.txt" -msgstr "python -m doctest -v example.txt" +msgid "" +"The :mod:`doctest` module can be invoked as a script from the command line:" +msgstr "" #: ../../library/doctest.rst:253 +msgid "python -m doctest [-v] [-o OPTION] [-f] file [file ...]" +msgstr "" + +#: ../../library/doctest.rst:261 msgid "" -"Because the file name does not end with :file:`.py`, :mod:`doctest` infers " -"that it must be run with :func:`testfile`, not :func:`testmod`." +"Detailed report of all examples tried is printed to standard output, along " +"with assorted summaries at the end::" msgstr "" -#: ../../library/doctest.rst:256 +#: ../../library/doctest.rst:264 +msgid "python -m doctest -v example.py" +msgstr "python -m doctest -v example.py" + +#: ../../library/doctest.rst:266 msgid "" -"For more information on :func:`testfile`, see section :ref:`doctest-basic-" -"api`." +"This will import :file:`example.py` as a standalone module and run :func:" +"`testmod` on it. Note that this may not work correctly if the file is part " +"of a package and imports other submodules from that package." +msgstr "" + +#: ../../library/doctest.rst:270 +msgid "" +"If the file name does not end with :file:`.py`, :mod:`!doctest` infers that " +"it must be run with :func:`testfile` instead::" +msgstr "" + +#: ../../library/doctest.rst:273 +msgid "python -m doctest -v example.txt" +msgstr "python -m doctest -v example.txt" + +#: ../../library/doctest.rst:277 +msgid "" +"Option flags control various aspects of doctest's behavior, see section :ref:" +"`doctest-options`." +msgstr "" + +#: ../../library/doctest.rst:284 +msgid "This is shorthand for ``-o FAIL_FAST``." msgstr "" -#: ../../library/doctest.rst:262 +#: ../../library/doctest.rst:292 msgid "How It Works" msgstr "" -#: ../../library/doctest.rst:264 +#: ../../library/doctest.rst:294 msgid "" "This section examines in detail how doctest works: which docstrings it looks " "at, how it finds interactive examples, what execution context it uses, how " @@ -438,17 +464,17 @@ msgid "" "see the following sections." msgstr "" -#: ../../library/doctest.rst:275 +#: ../../library/doctest.rst:305 msgid "Which Docstrings Are Examined?" msgstr "" -#: ../../library/doctest.rst:277 +#: ../../library/doctest.rst:307 msgid "" "The module docstring, and all function, class and method docstrings are " "searched. Objects imported into the module are not searched." msgstr "" -#: ../../library/doctest.rst:280 +#: ../../library/doctest.rst:310 msgid "" "In addition, there are cases when you want tests to be part of a module but " "not part of the help text, which requires that the tests not be included in " @@ -461,11 +487,11 @@ msgid "" "__test__.K``." msgstr "" -#: ../../library/doctest.rst:289 +#: ../../library/doctest.rst:319 msgid "For example, place this block of code at the top of :file:`example.py`:" msgstr "" -#: ../../library/doctest.rst:291 +#: ../../library/doctest.rst:321 msgid "" "__test__ = {\n" " 'numbers': \"\"\"\n" @@ -487,7 +513,7 @@ msgstr "" "\"\"\"\n" "}" -#: ../../library/doctest.rst:303 +#: ../../library/doctest.rst:333 msgid "" "The value of ``example.__test__[\"numbers\"]`` will be treated as a " "docstring and all the tests inside it will be run. It is important to note " @@ -496,24 +522,24 @@ msgid "" "scanned for tests." msgstr "" -#: ../../library/doctest.rst:309 +#: ../../library/doctest.rst:339 msgid "" "Any classes found are recursively searched similarly, to test docstrings in " "their contained methods and nested classes." msgstr "" -#: ../../library/doctest.rst:316 +#: ../../library/doctest.rst:346 msgid "How are Docstring Examples Recognized?" msgstr "" -#: ../../library/doctest.rst:318 +#: ../../library/doctest.rst:348 msgid "" "In most cases a copy-and-paste of an interactive console session works fine, " "but doctest isn't trying to do an exact emulation of any specific Python " "shell." msgstr "" -#: ../../library/doctest.rst:323 +#: ../../library/doctest.rst:353 msgid "" ">>> # comments are ignored\n" ">>> x = 12\n" @@ -547,18 +573,18 @@ msgstr "" "NO!!!\n" ">>>" -#: ../../library/doctest.rst:343 +#: ../../library/doctest.rst:373 msgid "" "Any expected output must immediately follow the final ``'>>> '`` or ``'... " "'`` line containing the code, and the expected output (if any) extends to " "the next ``'>>> '`` or all-whitespace line." msgstr "" -#: ../../library/doctest.rst:347 +#: ../../library/doctest.rst:377 msgid "The fine print:" msgstr "" -#: ../../library/doctest.rst:349 +#: ../../library/doctest.rst:379 msgid "" "Expected output cannot contain an all-whitespace line, since such a line is " "taken to signal the end of expected output. If expected output does contain " @@ -566,7 +592,7 @@ msgid "" "line is expected." msgstr "" -#: ../../library/doctest.rst:354 +#: ../../library/doctest.rst:384 msgid "" "All hard tab characters are expanded to spaces, using 8-column tab stops. " "Tabs in output generated by the tested code are not modified. Because any " @@ -581,20 +607,20 @@ msgid "" "`DocTestParser` class." msgstr "" -#: ../../library/doctest.rst:366 +#: ../../library/doctest.rst:396 msgid "" "Output to stdout is captured, but not output to stderr (exception tracebacks " "are captured via a different means)." msgstr "" -#: ../../library/doctest.rst:369 +#: ../../library/doctest.rst:399 msgid "" "If you continue a line via backslashing in an interactive session, or for " "any other reason use a backslash, you should use a raw docstring, which will " "preserve your backslashes exactly as you type them::" msgstr "" -#: ../../library/doctest.rst:373 +#: ../../library/doctest.rst:403 msgid "" ">>> def f(x):\n" "... r'''Backslashes in a raw docstring: m\\n'''\n" @@ -603,7 +629,7 @@ msgid "" "Backslashes in a raw docstring: m\\n" msgstr "" -#: ../../library/doctest.rst:379 +#: ../../library/doctest.rst:409 msgid "" "Otherwise, the backslash will be interpreted as part of the string. For " "example, the ``\\n`` above would be interpreted as a newline character. " @@ -611,7 +637,7 @@ msgid "" "use a raw string)::" msgstr "" -#: ../../library/doctest.rst:383 +#: ../../library/doctest.rst:413 msgid "" ">>> def f(x):\n" "... '''Backslashes in a raw docstring: m\\\\n'''\n" @@ -620,11 +646,11 @@ msgid "" "Backslashes in a raw docstring: m\\n" msgstr "" -#: ../../library/doctest.rst:389 +#: ../../library/doctest.rst:419 msgid "The starting column doesn't matter::" msgstr "" -#: ../../library/doctest.rst:391 +#: ../../library/doctest.rst:421 msgid "" ">>> assert \"Easy!\"\n" " >>> import math\n" @@ -636,17 +662,17 @@ msgstr "" " >>> math.floor(1.9)\n" " 1" -#: ../../library/doctest.rst:396 +#: ../../library/doctest.rst:426 msgid "" "and as many leading whitespace characters are stripped from the expected " "output as appeared in the initial ``'>>> '`` line that started the example." msgstr "" -#: ../../library/doctest.rst:403 +#: ../../library/doctest.rst:433 msgid "What's the Execution Context?" msgstr "" -#: ../../library/doctest.rst:405 +#: ../../library/doctest.rst:435 msgid "" "By default, each time :mod:`doctest` finds a docstring to test, it uses a " "*shallow copy* of :mod:`!M`'s globals, so that running tests doesn't change " @@ -657,17 +683,17 @@ msgid "" "defined in other docstrings." msgstr "" -#: ../../library/doctest.rst:413 +#: ../../library/doctest.rst:443 msgid "" "You can force use of your own dict as the execution context by passing " "``globs=your_dict`` to :func:`testmod` or :func:`testfile` instead." msgstr "" -#: ../../library/doctest.rst:420 +#: ../../library/doctest.rst:450 msgid "What About Exceptions?" msgstr "" -#: ../../library/doctest.rst:422 +#: ../../library/doctest.rst:452 msgid "" "No problem, provided that the traceback is the only output produced by the " "example: just paste in the traceback. [#]_ Since tracebacks contain details " @@ -676,11 +702,11 @@ msgid "" "it accepts." msgstr "" -#: ../../library/doctest.rst:428 +#: ../../library/doctest.rst:458 msgid "Simple example::" msgstr "簡單範例: ::" -#: ../../library/doctest.rst:430 +#: ../../library/doctest.rst:460 msgid "" ">>> [1, 2, 3].remove(42)\n" "Traceback (most recent call last):\n" @@ -692,20 +718,20 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: list.remove(x): x not in list" -#: ../../library/doctest.rst:435 +#: ../../library/doctest.rst:465 msgid "" "That doctest succeeds if :exc:`ValueError` is raised, with the ``list." "remove(x): x not in list`` detail as shown." msgstr "" -#: ../../library/doctest.rst:438 +#: ../../library/doctest.rst:468 msgid "" "The expected output for an exception must start with a traceback header, " "which may be either of the following two lines, indented the same as the " "first line of the example::" msgstr "" -#: ../../library/doctest.rst:442 +#: ../../library/doctest.rst:472 msgid "" "Traceback (most recent call last):\n" "Traceback (innermost last):" @@ -713,14 +739,14 @@ msgstr "" "Traceback (most recent call last):\n" "Traceback (innermost last):" -#: ../../library/doctest.rst:445 +#: ../../library/doctest.rst:475 msgid "" "The traceback header is followed by an optional traceback stack, whose " "contents are ignored by doctest. The traceback stack is typically omitted, " "or copied verbatim from an interactive session." msgstr "" -#: ../../library/doctest.rst:449 +#: ../../library/doctest.rst:479 msgid "" "The traceback stack is followed by the most interesting part: the line(s) " "containing the exception type and detail. This is usually the last line of " @@ -728,7 +754,7 @@ msgid "" "multi-line detail::" msgstr "" -#: ../../library/doctest.rst:454 +#: ../../library/doctest.rst:484 msgid "" ">>> raise ValueError('multi\\n line\\ndetail')\n" "Traceback (most recent call last):\n" @@ -737,21 +763,27 @@ msgid "" " line\n" "detail" msgstr "" +">>> raise ValueError('multi\\n line\\ndetail')\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"ValueError: multi\n" +" line\n" +"detail" -#: ../../library/doctest.rst:461 +#: ../../library/doctest.rst:491 msgid "" "The last three lines (starting with :exc:`ValueError`) are compared against " "the exception's type and detail, and the rest are ignored." msgstr "" -#: ../../library/doctest.rst:464 +#: ../../library/doctest.rst:494 msgid "" "Best practice is to omit the traceback stack, unless it adds significant " "documentation value to the example. So the last example is probably better " "as::" msgstr "" -#: ../../library/doctest.rst:467 +#: ../../library/doctest.rst:497 msgid "" ">>> raise ValueError('multi\\n line\\ndetail')\n" "Traceback (most recent call last):\n" @@ -760,8 +792,14 @@ msgid "" " line\n" "detail" msgstr "" +">>> raise ValueError('multi\\n line\\ndetail')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError: multi\n" +" line\n" +"detail" -#: ../../library/doctest.rst:474 +#: ../../library/doctest.rst:504 msgid "" "Note that tracebacks are treated very specially. In particular, in the " "rewritten example, the use of ``...`` is independent of doctest's :const:" @@ -770,11 +808,11 @@ msgid "" "transcript of a Monty Python skit." msgstr "" -#: ../../library/doctest.rst:480 +#: ../../library/doctest.rst:510 msgid "Some details you should read once, but won't need to remember:" msgstr "" -#: ../../library/doctest.rst:482 +#: ../../library/doctest.rst:512 msgid "" "Doctest can't guess whether your expected output came from an exception " "traceback or from ordinary printing. So, e.g., an example that expects " @@ -784,7 +822,7 @@ msgid "" "create real problems." msgstr "" -#: ../../library/doctest.rst:489 +#: ../../library/doctest.rst:519 msgid "" "Each line of the traceback stack (if present) must be indented further than " "the first line of the example, *or* start with a non-alphanumeric character. " @@ -793,14 +831,14 @@ msgid "" "course this does the right thing for genuine tracebacks." msgstr "" -#: ../../library/doctest.rst:495 +#: ../../library/doctest.rst:525 msgid "" "When the :const:`IGNORE_EXCEPTION_DETAIL` doctest option is specified, " "everything following the leftmost colon and any module information in the " "exception name is ignored." msgstr "" -#: ../../library/doctest.rst:499 +#: ../../library/doctest.rst:529 msgid "" "The interactive shell omits the traceback header line for some :exc:" "`SyntaxError`\\ s. But doctest uses the traceback header line to " @@ -809,13 +847,13 @@ msgid "" "need to manually add the traceback header line to your test example." msgstr "" -#: ../../library/doctest.rst:507 +#: ../../library/doctest.rst:537 msgid "" "For some exceptions, Python displays the position of the error using ``^`` " "markers and tildes::" msgstr "" -#: ../../library/doctest.rst:510 +#: ../../library/doctest.rst:540 msgid "" ">>> 1 + None\n" " File \"\", line 1\n" @@ -829,7 +867,7 @@ msgstr "" " ~~^~~~~~\n" "TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" -#: ../../library/doctest.rst:516 +#: ../../library/doctest.rst:546 msgid "" "Since the lines showing the position of the error come before the exception " "type and detail, they are not checked by doctest. For example, the " @@ -837,7 +875,7 @@ msgid "" "location::" msgstr "" -#: ../../library/doctest.rst:520 +#: ../../library/doctest.rst:550 msgid "" ">>> 1 + None\n" " File \"\", line 1\n" @@ -851,11 +889,11 @@ msgstr "" " ^~~~~~~~\n" "TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'" -#: ../../library/doctest.rst:531 +#: ../../library/doctest.rst:561 msgid "Option Flags" msgstr "可選旗標" -#: ../../library/doctest.rst:533 +#: ../../library/doctest.rst:563 msgid "" "A number of option flags control various aspects of doctest's behavior. " "Symbolic names for the flags are supplied as module constants, which can be :" @@ -865,17 +903,13 @@ msgid "" "option." msgstr "" -#: ../../library/doctest.rst:539 -msgid "The ``-o`` command line option." -msgstr "" - -#: ../../library/doctest.rst:542 +#: ../../library/doctest.rst:569 msgid "" "The first group of options define test semantics, controlling aspects of how " "doctest decides whether actual output matches an example's expected output:" msgstr "" -#: ../../library/doctest.rst:548 +#: ../../library/doctest.rst:575 msgid "" "By default, if an expected output block contains just ``1``, an actual " "output block containing just ``1`` or just ``True`` is considered to be a " @@ -887,7 +921,7 @@ msgid "" "not for several years." msgstr "" -#: ../../library/doctest.rst:560 +#: ../../library/doctest.rst:587 msgid "" "By default, if an expected output block contains a line containing only the " "string ````, then that line will match a blank line in the actual " @@ -896,7 +930,7 @@ msgid "" "`DONT_ACCEPT_BLANKLINE` is specified, this substitution is not allowed." msgstr "" -#: ../../library/doctest.rst:569 +#: ../../library/doctest.rst:596 msgid "" "When specified, all sequences of whitespace (blanks and newlines) are " "treated as equal. Any sequence of whitespace within the expected output " @@ -906,7 +940,7 @@ msgid "" "across multiple lines in your source." msgstr "" -#: ../../library/doctest.rst:580 +#: ../../library/doctest.rst:607 msgid "" "When specified, an ellipsis marker (``...``) in the expected output can " "match any substring in the actual output. This includes substrings that " @@ -915,14 +949,14 @@ msgid "" "matched too much!\" surprises that ``.*`` is prone to in regular expressions." msgstr "" -#: ../../library/doctest.rst:589 +#: ../../library/doctest.rst:616 msgid "" "When specified, doctests expecting exceptions pass so long as an exception " "of the expected type is raised, even if the details (message and fully " "qualified exception name) don't match." msgstr "" -#: ../../library/doctest.rst:593 +#: ../../library/doctest.rst:620 msgid "" "For example, an example expecting ``ValueError: 42`` will pass if the actual " "exception raised is ``ValueError: 3*14``, but will fail if, say, a :exc:" @@ -932,7 +966,7 @@ msgid "" "these variations will work with the flag specified:" msgstr "" -#: ../../library/doctest.rst:601 +#: ../../library/doctest.rst:628 msgid "" ">>> raise Exception('message')\n" "Traceback (most recent call last):\n" @@ -958,20 +992,20 @@ msgstr "" "Traceback (most recent call last):\n" "__main__.Exception: message" -#: ../../library/doctest.rst:615 +#: ../../library/doctest.rst:642 msgid "" "Note that :const:`ELLIPSIS` can also be used to ignore the details of the " "exception message, but such a test may still fail based on whether the " "module name is present or matches exactly." msgstr "" -#: ../../library/doctest.rst:619 +#: ../../library/doctest.rst:646 msgid "" ":const:`IGNORE_EXCEPTION_DETAIL` now also ignores any information relating " "to the module containing the exception under test." msgstr "" -#: ../../library/doctest.rst:626 +#: ../../library/doctest.rst:653 msgid "" "When specified, do not run the example at all. This can be useful in " "contexts where doctest examples serve as both documentation and test cases, " @@ -980,32 +1014,32 @@ msgid "" "might depend on resources which would be unavailable to the test driver." msgstr "" -#: ../../library/doctest.rst:632 +#: ../../library/doctest.rst:659 msgid "" "The SKIP flag can also be used for temporarily \"commenting out\" examples." msgstr "" -#: ../../library/doctest.rst:637 +#: ../../library/doctest.rst:664 msgid "A bitmask or'ing together all the comparison flags above." msgstr "" -#: ../../library/doctest.rst:639 +#: ../../library/doctest.rst:666 msgid "The second group of options controls how test failures are reported:" msgstr "" -#: ../../library/doctest.rst:644 +#: ../../library/doctest.rst:671 msgid "" "When specified, failures that involve multi-line expected and actual outputs " "are displayed using a unified diff." msgstr "" -#: ../../library/doctest.rst:650 +#: ../../library/doctest.rst:677 msgid "" "When specified, failures that involve multi-line expected and actual outputs " "will be displayed using a context diff." msgstr "" -#: ../../library/doctest.rst:656 +#: ../../library/doctest.rst:683 msgid "" "When specified, differences are computed by ``difflib.Differ``, using the " "same algorithm as the popular :file:`ndiff.py` utility. This is the only " @@ -1015,7 +1049,7 @@ msgid "" "mismatching column positions." msgstr "" -#: ../../library/doctest.rst:665 +#: ../../library/doctest.rst:692 msgid "" "When specified, display the first failing example in each doctest, but " "suppress output for all remaining examples. This will prevent doctest from " @@ -1026,7 +1060,7 @@ msgid "" "of failures reported; only the output is suppressed." msgstr "" -#: ../../library/doctest.rst:676 +#: ../../library/doctest.rst:703 msgid "" "When specified, exit after the first failing example and don't attempt to " "run the remaining examples. Thus, the number of failures reported will be at " @@ -1034,23 +1068,17 @@ msgid "" "first failure won't even produce debugging output." msgstr "" -#: ../../library/doctest.rst:681 -msgid "" -"The doctest command line accepts the option ``-f`` as a shorthand for ``-o " -"FAIL_FAST``." -msgstr "" - -#: ../../library/doctest.rst:689 +#: ../../library/doctest.rst:711 msgid "A bitmask or'ing together all the reporting flags above." msgstr "" -#: ../../library/doctest.rst:692 +#: ../../library/doctest.rst:714 msgid "" "There is also a way to register new option flag names, though this isn't " "useful unless you intend to extend :mod:`doctest` internals via subclassing:" msgstr "" -#: ../../library/doctest.rst:698 +#: ../../library/doctest.rst:720 msgid "" "Create a new option flag with a given name, and return the new flag's " "integer value. :func:`register_optionflag` can be used when subclassing :" @@ -1059,39 +1087,39 @@ msgid "" "be called using the following idiom::" msgstr "" -#: ../../library/doctest.rst:704 +#: ../../library/doctest.rst:726 msgid "MY_FLAG = register_optionflag('MY_FLAG')" msgstr "MY_FLAG = register_optionflag('MY_FLAG')" -#: ../../library/doctest.rst:714 +#: ../../library/doctest.rst:736 msgid "Directives" msgstr "" -#: ../../library/doctest.rst:716 +#: ../../library/doctest.rst:738 msgid "" "Doctest directives may be used to modify the :ref:`option flags ` for an individual example. Doctest directives are special Python " "comments following an example's source code:" msgstr "" -#: ../../library/doctest.rst:727 +#: ../../library/doctest.rst:749 msgid "" "Whitespace is not allowed between the ``+`` or ``-`` and the directive " "option name. The directive option name can be any of the option flag names " "explained above." msgstr "" -#: ../../library/doctest.rst:731 +#: ../../library/doctest.rst:753 msgid "" "An example's doctest directives modify doctest's behavior for that single " "example. Use ``+`` to enable the named behavior, or ``-`` to disable it." msgstr "" -#: ../../library/doctest.rst:734 +#: ../../library/doctest.rst:756 msgid "For example, this test passes:" msgstr "" -#: ../../library/doctest.rst:736 +#: ../../library/doctest.rst:758 msgid "" ">>> print(list(range(20))) # doctest: +NORMALIZE_WHITESPACE\n" "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,\n" @@ -1101,7 +1129,7 @@ msgstr "" "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9,\n" "10, 11, 12, 13, 14, 15, 16, 17, 18, 19]" -#: ../../library/doctest.rst:743 +#: ../../library/doctest.rst:765 msgid "" "Without the directive it would fail, both because the actual output doesn't " "have two blanks before the single-digit list elements, and because the " @@ -1109,7 +1137,7 @@ msgid "" "a directive to do so:" msgstr "" -#: ../../library/doctest.rst:748 +#: ../../library/doctest.rst:770 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "[0, 1, ..., 18, 19]" @@ -1117,13 +1145,13 @@ msgstr "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "[0, 1, ..., 18, 19]" -#: ../../library/doctest.rst:754 +#: ../../library/doctest.rst:776 msgid "" "Multiple directives can be used on a single physical line, separated by " "commas:" msgstr "" -#: ../../library/doctest.rst:757 +#: ../../library/doctest.rst:779 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" @@ -1131,13 +1159,13 @@ msgstr "" ">>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" -#: ../../library/doctest.rst:763 +#: ../../library/doctest.rst:785 msgid "" "If multiple directive comments are used for a single example, then they are " "combined:" msgstr "" -#: ../../library/doctest.rst:766 +#: ../../library/doctest.rst:788 msgid "" ">>> print(list(range(20))) # doctest: +ELLIPSIS\n" "... # doctest: +NORMALIZE_WHITESPACE\n" @@ -1147,14 +1175,14 @@ msgstr "" "... # doctest: +NORMALIZE_WHITESPACE\n" "[0, 1, ..., 18, 19]" -#: ../../library/doctest.rst:773 +#: ../../library/doctest.rst:795 msgid "" "As the previous example shows, you can add ``...`` lines to your example " "containing only directives. This can be useful when an example is too long " "for a directive to comfortably fit on the same line:" msgstr "" -#: ../../library/doctest.rst:777 +#: ../../library/doctest.rst:799 msgid "" ">>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40)))\n" "... # doctest: +ELLIPSIS\n" @@ -1164,7 +1192,7 @@ msgstr "" "... # doctest: +ELLIPSIS\n" "[0, ..., 4, 10, ..., 19, 30, ..., 39]" -#: ../../library/doctest.rst:784 +#: ../../library/doctest.rst:806 msgid "" "Note that since all options are disabled by default, and directives apply " "only to the example they appear in, enabling options (via ``+`` in a " @@ -1174,11 +1202,11 @@ msgid "" "be useful." msgstr "" -#: ../../library/doctest.rst:794 +#: ../../library/doctest.rst:816 msgid "Warnings" msgstr "警告" -#: ../../library/doctest.rst:796 +#: ../../library/doctest.rst:818 msgid "" ":mod:`doctest` is serious about requiring exact matches in expected output. " "If even a single character doesn't match, the test fails. This will " @@ -1188,7 +1216,7 @@ msgid "" "test like ::" msgstr "" -#: ../../library/doctest.rst:802 +#: ../../library/doctest.rst:824 msgid "" ">>> foo()\n" "{\"spam\", \"eggs\"}" @@ -1196,11 +1224,11 @@ msgstr "" ">>> foo()\n" "{\"spam\", \"eggs\"}" -#: ../../library/doctest.rst:805 +#: ../../library/doctest.rst:827 msgid "is vulnerable! One workaround is to do ::" msgstr "" -#: ../../library/doctest.rst:807 +#: ../../library/doctest.rst:829 msgid "" ">>> foo() == {\"spam\", \"eggs\"}\n" "True" @@ -1208,11 +1236,11 @@ msgstr "" ">>> foo() == {\"spam\", \"eggs\"}\n" "True" -#: ../../library/doctest.rst:810 +#: ../../library/doctest.rst:832 msgid "instead. Another is to do ::" msgstr "" -#: ../../library/doctest.rst:812 +#: ../../library/doctest.rst:834 msgid "" ">>> d = sorted(foo())\n" ">>> d\n" @@ -1222,29 +1250,29 @@ msgstr "" ">>> d\n" "['eggs', 'spam']" -#: ../../library/doctest.rst:816 +#: ../../library/doctest.rst:838 msgid "There are others, but you get the idea." msgstr "" -#: ../../library/doctest.rst:818 +#: ../../library/doctest.rst:840 msgid "Another bad idea is to print things that embed an object address, like" msgstr "" -#: ../../library/doctest.rst:820 +#: ../../library/doctest.rst:842 msgid "" -">>> id(1.0) # certain to fail some of the time \n" +">>> id(1.0) # certain to fail some of the time\n" "7948648\n" ">>> class C: pass\n" -">>> C() # the default repr() for instances embeds an address \n" +">>> C() # the default repr() for instances embeds an address\n" "" msgstr "" -#: ../../library/doctest.rst:828 +#: ../../library/doctest.rst:850 msgid "" "The :const:`ELLIPSIS` directive gives a nice approach for the last example:" msgstr "" -#: ../../library/doctest.rst:830 +#: ../../library/doctest.rst:852 msgid "" ">>> C() # doctest: +ELLIPSIS\n" "" @@ -1252,14 +1280,14 @@ msgstr "" ">>> C() # doctest: +ELLIPSIS\n" "" -#: ../../library/doctest.rst:836 +#: ../../library/doctest.rst:858 msgid "" "Floating-point numbers are also subject to small output variations across " "platforms, because Python defers to the platform C library for float " "formatting, and C libraries vary widely in quality here. ::" msgstr "" -#: ../../library/doctest.rst:840 +#: ../../library/doctest.rst:862 msgid "" ">>> 1./7 # risky\n" "0.14285714285714285\n" @@ -1269,29 +1297,29 @@ msgid "" "0.142857" msgstr "" -#: ../../library/doctest.rst:847 +#: ../../library/doctest.rst:869 msgid "" "Numbers of the form ``I/2.**J`` are safe across all platforms, and I often " "contrive doctest examples to produce numbers of that form::" msgstr "" -#: ../../library/doctest.rst:850 +#: ../../library/doctest.rst:872 msgid "" ">>> 3./4 # utterly safe\n" "0.75" msgstr "" -#: ../../library/doctest.rst:853 +#: ../../library/doctest.rst:875 msgid "" "Simple fractions are also easier for people to understand, and that makes " "for better documentation." msgstr "" -#: ../../library/doctest.rst:860 +#: ../../library/doctest.rst:882 msgid "Basic API" msgstr "基礎 API" -#: ../../library/doctest.rst:862 +#: ../../library/doctest.rst:884 msgid "" "The functions :func:`testmod` and :func:`testfile` provide a simple " "interface to doctest that should be sufficient for most basic uses. For a " @@ -1299,25 +1327,25 @@ msgid "" "simple-testmod` and :ref:`doctest-simple-testfile`." msgstr "" -#: ../../library/doctest.rst:870 +#: ../../library/doctest.rst:892 msgid "" "All arguments except *filename* are optional, and should be specified in " "keyword form." msgstr "" -#: ../../library/doctest.rst:873 +#: ../../library/doctest.rst:895 msgid "" "Test examples in the file named *filename*. Return ``(failure_count, " "test_count)``." msgstr "" -#: ../../library/doctest.rst:876 +#: ../../library/doctest.rst:898 msgid "" "Optional argument *module_relative* specifies how the filename should be " "interpreted:" msgstr "" -#: ../../library/doctest.rst:879 +#: ../../library/doctest.rst:901 msgid "" "If *module_relative* is ``True`` (the default), then *filename* specifies an " "OS-independent module-relative path. By default, this path is relative to " @@ -1327,20 +1355,20 @@ msgid "" "absolute path (i.e., it may not begin with ``/``)." msgstr "" -#: ../../library/doctest.rst:886 +#: ../../library/doctest.rst:908 msgid "" "If *module_relative* is ``False``, then *filename* specifies an OS-specific " "path. The path may be absolute or relative; relative paths are resolved " "with respect to the current working directory." msgstr "" -#: ../../library/doctest.rst:890 +#: ../../library/doctest.rst:912 msgid "" "Optional argument *name* gives the name of the test; by default, or if " "``None``, ``os.path.basename(filename)`` is used." msgstr "" -#: ../../library/doctest.rst:893 +#: ../../library/doctest.rst:915 msgid "" "Optional argument *package* is a Python package or the name of a Python " "package whose directory should be used as the base directory for a module-" @@ -1349,7 +1377,7 @@ msgid "" "is an error to specify *package* if *module_relative* is ``False``." msgstr "" -#: ../../library/doctest.rst:899 +#: ../../library/doctest.rst:921 msgid "" "Optional argument *globs* gives a dict to be used as the globals when " "executing examples. A new shallow copy of this dict is created for the " @@ -1357,7 +1385,7 @@ msgid "" "``None``, a new empty dict is used." msgstr "" -#: ../../library/doctest.rst:904 +#: ../../library/doctest.rst:926 msgid "" "Optional argument *extraglobs* gives a dict merged into the globals used to " "execute examples. This works like :meth:`dict.update`: if *globs* and " @@ -1370,27 +1398,27 @@ msgid "" "tested." msgstr "" -#: ../../library/doctest.rst:913 +#: ../../library/doctest.rst:935 msgid "" "Optional argument *verbose* prints lots of stuff if true, and prints only " "failures if false; by default, or if ``None``, it's true if and only if ``'-" "v'`` is in ``sys.argv``." msgstr "" -#: ../../library/doctest.rst:917 +#: ../../library/doctest.rst:939 msgid "" "Optional argument *report* prints a summary at the end when true, else " "prints nothing at the end. In verbose mode, the summary is detailed, else " "the summary is very brief (in fact, empty if all tests passed)." msgstr "" -#: ../../library/doctest.rst:921 +#: ../../library/doctest.rst:943 msgid "" "Optional argument *optionflags* (default value 0) takes the :ref:`bitwise OR " "` of option flags. See section :ref:`doctest-options`." msgstr "" -#: ../../library/doctest.rst:925 +#: ../../library/doctest.rst:947 msgid "" "Optional argument *raise_on_error* defaults to false. If true, an exception " "is raised upon the first failure or unexpected exception in an example. " @@ -1398,33 +1426,33 @@ msgid "" "continue running examples." msgstr "" -#: ../../library/doctest.rst:930 ../../library/doctest.rst:1072 +#: ../../library/doctest.rst:952 ../../library/doctest.rst:1094 msgid "" "Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) " "that should be used to extract tests from the files. It defaults to a " "normal parser (i.e., ``DocTestParser()``)." msgstr "" -#: ../../library/doctest.rst:934 ../../library/doctest.rst:1076 +#: ../../library/doctest.rst:956 ../../library/doctest.rst:1098 msgid "" "Optional argument *encoding* specifies an encoding that should be used to " "convert the file to unicode." msgstr "" -#: ../../library/doctest.rst:940 +#: ../../library/doctest.rst:962 msgid "" "All arguments are optional, and all except for *m* should be specified in " "keyword form." msgstr "" -#: ../../library/doctest.rst:943 +#: ../../library/doctest.rst:965 msgid "" "Test examples in docstrings in functions and classes reachable from module " "*m* (or module :mod:`__main__` if *m* is not supplied or is ``None``), " "starting with ``m.__doc__``." msgstr "" -#: ../../library/doctest.rst:947 +#: ../../library/doctest.rst:969 msgid "" "Also test examples reachable from dict ``m.__test__``, if it exists. ``m." "__test__`` maps names (strings) to functions, classes and strings; function " @@ -1432,22 +1460,22 @@ msgid "" "directly, as if they were docstrings." msgstr "" -#: ../../library/doctest.rst:952 +#: ../../library/doctest.rst:974 msgid "" "Only docstrings attached to objects belonging to module *m* are searched." msgstr "" -#: ../../library/doctest.rst:954 +#: ../../library/doctest.rst:976 msgid "Return ``(failure_count, test_count)``." msgstr "" -#: ../../library/doctest.rst:956 +#: ../../library/doctest.rst:978 msgid "" "Optional argument *name* gives the name of the module; by default, or if " "``None``, ``m.__name__`` is used." msgstr "" -#: ../../library/doctest.rst:959 +#: ../../library/doctest.rst:981 msgid "" "Optional argument *exclude_empty* defaults to false. If true, objects for " "which no doctests are found are excluded from consideration. The default is " @@ -1458,39 +1486,39 @@ msgid "" "defaults to true." msgstr "" -#: ../../library/doctest.rst:967 +#: ../../library/doctest.rst:989 msgid "" "Optional arguments *extraglobs*, *verbose*, *report*, *optionflags*, " "*raise_on_error*, and *globs* are the same as for function :func:`testfile` " "above, except that *globs* defaults to ``m.__dict__``." msgstr "" -#: ../../library/doctest.rst:974 +#: ../../library/doctest.rst:996 msgid "" "Test examples associated with object *f*; for example, *f* may be a string, " "a module, a function, or a class object." msgstr "" -#: ../../library/doctest.rst:977 +#: ../../library/doctest.rst:999 msgid "" "A shallow copy of dictionary argument *globs* is used for the execution " "context." msgstr "" -#: ../../library/doctest.rst:979 +#: ../../library/doctest.rst:1001 msgid "" "Optional argument *name* is used in failure messages, and defaults to " "``\"NoName\"``." msgstr "" -#: ../../library/doctest.rst:982 +#: ../../library/doctest.rst:1004 msgid "" "If optional argument *verbose* is true, output is generated even if there " "are no failures. By default, output is generated only in case of an example " "failure." msgstr "" -#: ../../library/doctest.rst:985 +#: ../../library/doctest.rst:1007 msgid "" "Optional argument *compileflags* gives the set of flags that should be used " "by the Python compiler when running the examples. By default, or if " @@ -1498,16 +1526,16 @@ msgid "" "found in *globs*." msgstr "" -#: ../../library/doctest.rst:989 +#: ../../library/doctest.rst:1011 msgid "" "Optional argument *optionflags* works as for function :func:`testfile` above." msgstr "" -#: ../../library/doctest.rst:995 +#: ../../library/doctest.rst:1017 msgid "Unittest API" msgstr "" -#: ../../library/doctest.rst:997 +#: ../../library/doctest.rst:1019 msgid "" "As your collection of doctest'ed modules grows, you'll want a way to run all " "their doctests systematically. :mod:`doctest` provides two functions that " @@ -1517,7 +1545,7 @@ msgid "" "your test module::" msgstr "" -#: ../../library/doctest.rst:1003 +#: ../../library/doctest.rst:1025 msgid "" "import unittest\n" "import doctest\n" @@ -1535,19 +1563,19 @@ msgstr "" " tests.addTests(doctest.DocTestSuite(my_module_with_doctests))\n" " return tests" -#: ../../library/doctest.rst:1011 +#: ../../library/doctest.rst:1033 msgid "" "There are two main functions for creating :class:`unittest.TestSuite` " "instances from text files and modules with doctests:" msgstr "" -#: ../../library/doctest.rst:1017 +#: ../../library/doctest.rst:1039 msgid "" "Convert doctest tests from one or more text files to a :class:`unittest." "TestSuite`." msgstr "" -#: ../../library/doctest.rst:1020 +#: ../../library/doctest.rst:1042 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " "framework and runs the interactive examples in each file. If an example in " @@ -1558,21 +1586,21 @@ msgid "" "marked as skipped." msgstr "" -#: ../../library/doctest.rst:1027 +#: ../../library/doctest.rst:1049 msgid "Pass one or more paths (as strings) to text files to be examined." msgstr "" -#: ../../library/doctest.rst:1029 +#: ../../library/doctest.rst:1051 msgid "Options may be provided as keyword arguments:" msgstr "" -#: ../../library/doctest.rst:1031 +#: ../../library/doctest.rst:1053 msgid "" "Optional argument *module_relative* specifies how the filenames in *paths* " "should be interpreted:" msgstr "" -#: ../../library/doctest.rst:1034 +#: ../../library/doctest.rst:1056 msgid "" "If *module_relative* is ``True`` (the default), then each filename in " "*paths* specifies an OS-independent module-relative path. By default, this " @@ -1583,14 +1611,14 @@ msgid "" "``)." msgstr "" -#: ../../library/doctest.rst:1042 +#: ../../library/doctest.rst:1064 msgid "" "If *module_relative* is ``False``, then each filename in *paths* specifies " "an OS-specific path. The path may be absolute or relative; relative paths " "are resolved with respect to the current working directory." msgstr "" -#: ../../library/doctest.rst:1046 +#: ../../library/doctest.rst:1068 msgid "" "Optional argument *package* is a Python package or the name of a Python " "package whose directory should be used as the base directory for module-" @@ -1600,7 +1628,7 @@ msgid "" "``False``." msgstr "" -#: ../../library/doctest.rst:1053 +#: ../../library/doctest.rst:1075 msgid "" "Optional argument *setUp* specifies a set-up function for the test suite. " "This is called before running the tests in each file. The *setUp* function " @@ -1608,7 +1636,7 @@ msgid "" "test globals as the *globs* attribute of the test passed." msgstr "" -#: ../../library/doctest.rst:1058 +#: ../../library/doctest.rst:1080 msgid "" "Optional argument *tearDown* specifies a tear-down function for the test " "suite. This is called after running the tests in each file. The *tearDown* " @@ -1616,14 +1644,14 @@ msgid "" "access the test globals as the *globs* attribute of the test passed." msgstr "" -#: ../../library/doctest.rst:1063 ../../library/doctest.rst:1098 +#: ../../library/doctest.rst:1085 ../../library/doctest.rst:1120 msgid "" "Optional argument *globs* is a dictionary containing the initial global " "variables for the tests. A new copy of this dictionary is created for each " "test. By default, *globs* is a new empty dictionary." msgstr "" -#: ../../library/doctest.rst:1067 +#: ../../library/doctest.rst:1089 msgid "" "Optional argument *optionflags* specifies the default doctest options for " "the tests, created by or-ing together individual option flags. See section :" @@ -1631,17 +1659,17 @@ msgid "" "for a better way to set reporting options." msgstr "" -#: ../../library/doctest.rst:1079 +#: ../../library/doctest.rst:1101 msgid "" "The global ``__file__`` is added to the globals provided to doctests loaded " "from a text file using :func:`DocFileSuite`." msgstr "" -#: ../../library/doctest.rst:1085 +#: ../../library/doctest.rst:1107 msgid "Convert doctest tests for a module to a :class:`unittest.TestSuite`." msgstr "" -#: ../../library/doctest.rst:1087 +#: ../../library/doctest.rst:1109 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " "framework and runs each doctest in the module. If any of the doctests fail, " @@ -1651,42 +1679,42 @@ msgid "" "skipped, then the synthesized unit test is also marked as skipped." msgstr "" -#: ../../library/doctest.rst:1094 +#: ../../library/doctest.rst:1116 msgid "" "Optional argument *module* provides the module to be tested. It can be a " "module object or a (possibly dotted) module name. If not specified, the " "module calling this function is used." msgstr "" -#: ../../library/doctest.rst:1102 +#: ../../library/doctest.rst:1124 msgid "" "Optional argument *extraglobs* specifies an extra set of global variables, " "which is merged into *globs*. By default, no extra globals are used." msgstr "" -#: ../../library/doctest.rst:1105 +#: ../../library/doctest.rst:1127 msgid "" "Optional argument *test_finder* is the :class:`DocTestFinder` object (or a " "drop-in replacement) that is used to extract doctests from the module." msgstr "" -#: ../../library/doctest.rst:1108 +#: ../../library/doctest.rst:1130 msgid "" "Optional arguments *setUp*, *tearDown*, and *optionflags* are the same as " "for function :func:`DocFileSuite` above." msgstr "" -#: ../../library/doctest.rst:1111 +#: ../../library/doctest.rst:1133 msgid "This function uses the same search technique as :func:`testmod`." msgstr "" -#: ../../library/doctest.rst:1113 +#: ../../library/doctest.rst:1135 msgid "" ":func:`DocTestSuite` returns an empty :class:`unittest.TestSuite` if " "*module* contains no docstrings instead of raising :exc:`ValueError`." msgstr "" -#: ../../library/doctest.rst:1119 +#: ../../library/doctest.rst:1141 msgid "" "When doctests which have been converted to unit tests by :func:" "`DocFileSuite` or :func:`DocTestSuite` fail, this exception is raised " @@ -1694,7 +1722,7 @@ msgid "" "approximate) line number." msgstr "" -#: ../../library/doctest.rst:1123 +#: ../../library/doctest.rst:1145 msgid "" "Under the covers, :func:`DocTestSuite` creates a :class:`unittest.TestSuite` " "out of :class:`!doctest.DocTestCase` instances, and :class:`!DocTestCase` is " @@ -1703,14 +1731,14 @@ msgid "" "questions about the exact details of :mod:`unittest` integration." msgstr "" -#: ../../library/doctest.rst:1129 +#: ../../library/doctest.rst:1151 msgid "" "Similarly, :func:`DocFileSuite` creates a :class:`unittest.TestSuite` out " "of :class:`!doctest.DocFileCase` instances, and :class:`!DocFileCase` is a " "subclass of :class:`!DocTestCase`." msgstr "" -#: ../../library/doctest.rst:1133 +#: ../../library/doctest.rst:1155 msgid "" "So both ways of creating a :class:`unittest.TestSuite` run instances of :" "class:`!DocTestCase`. This is important for a subtle reason: when you run :" @@ -1723,23 +1751,23 @@ msgid "" "through :mod:`unittest` to :mod:`doctest` test runners." msgstr "" -#: ../../library/doctest.rst:1143 +#: ../../library/doctest.rst:1165 msgid "" "For this reason, :mod:`doctest` also supports a notion of :mod:`doctest` " "reporting flags specific to :mod:`unittest` support, via this function:" msgstr "" -#: ../../library/doctest.rst:1149 +#: ../../library/doctest.rst:1171 msgid "Set the :mod:`doctest` reporting flags to use." msgstr "" -#: ../../library/doctest.rst:1151 +#: ../../library/doctest.rst:1173 msgid "" "Argument *flags* takes the :ref:`bitwise OR ` of option flags. See " "section :ref:`doctest-options`. Only \"reporting flags\" can be used." msgstr "" -#: ../../library/doctest.rst:1154 +#: ../../library/doctest.rst:1176 msgid "" "This is a module-global setting, and affects all future doctests run by " "module :mod:`unittest`: the :meth:`!runTest` method of :class:`!" @@ -1753,17 +1781,17 @@ msgid "" "`!doctest`'s :mod:`unittest` reporting flags are ignored." msgstr "" -#: ../../library/doctest.rst:1165 +#: ../../library/doctest.rst:1187 msgid "" "The value of the :mod:`unittest` reporting flags in effect before the " "function was called is returned by the function." msgstr "" -#: ../../library/doctest.rst:1172 +#: ../../library/doctest.rst:1194 msgid "Advanced API" msgstr "" -#: ../../library/doctest.rst:1174 +#: ../../library/doctest.rst:1196 msgid "" "The basic API is a simple wrapper that's intended to make doctest easy to " "use. It is fairly flexible, and should meet most users' needs; however, if " @@ -1771,62 +1799,62 @@ msgid "" "doctest's capabilities, then you should use the advanced API." msgstr "" -#: ../../library/doctest.rst:1179 +#: ../../library/doctest.rst:1201 msgid "" "The advanced API revolves around two container classes, which are used to " "store the interactive examples extracted from doctest cases:" msgstr "" -#: ../../library/doctest.rst:1182 +#: ../../library/doctest.rst:1204 msgid "" ":class:`Example`: A single Python :term:`statement`, paired with its " "expected output." msgstr "" -#: ../../library/doctest.rst:1185 +#: ../../library/doctest.rst:1207 msgid "" ":class:`DocTest`: A collection of :class:`Example`\\ s, typically extracted " "from a single docstring or text file." msgstr "" -#: ../../library/doctest.rst:1188 +#: ../../library/doctest.rst:1210 msgid "" "Additional processing classes are defined to find, parse, and run, and check " "doctest examples:" msgstr "" -#: ../../library/doctest.rst:1191 +#: ../../library/doctest.rst:1213 msgid "" ":class:`DocTestFinder`: Finds all docstrings in a given module, and uses a :" "class:`DocTestParser` to create a :class:`DocTest` from every docstring that " "contains interactive examples." msgstr "" -#: ../../library/doctest.rst:1195 +#: ../../library/doctest.rst:1217 msgid "" ":class:`DocTestParser`: Creates a :class:`DocTest` object from a string " "(such as an object's docstring)." msgstr "" -#: ../../library/doctest.rst:1198 +#: ../../library/doctest.rst:1220 msgid "" ":class:`DocTestRunner`: Executes the examples in a :class:`DocTest`, and " "uses an :class:`OutputChecker` to verify their output." msgstr "" -#: ../../library/doctest.rst:1201 +#: ../../library/doctest.rst:1223 msgid "" ":class:`OutputChecker`: Compares the actual output from a doctest example " "with the expected output, and decides whether they match." msgstr "" -#: ../../library/doctest.rst:1204 +#: ../../library/doctest.rst:1226 msgid "" "The relationships among these processing classes are summarized in the " "following diagram::" msgstr "" -#: ../../library/doctest.rst:1207 +#: ../../library/doctest.rst:1229 msgid "" " list of:\n" "+------+ +---------+\n" @@ -1846,30 +1874,30 @@ msgstr "" " DocTestParser | Example | OutputChecker\n" " +---------+" -#: ../../library/doctest.rst:1220 +#: ../../library/doctest.rst:1242 msgid "DocTest Objects" msgstr "DocTest 物件" -#: ../../library/doctest.rst:1225 +#: ../../library/doctest.rst:1247 msgid "" "A collection of doctest examples that should be run in a single namespace. " "The constructor arguments are used to initialize the attributes of the same " "names." msgstr "" -#: ../../library/doctest.rst:1229 +#: ../../library/doctest.rst:1251 msgid "" ":class:`DocTest` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: ../../library/doctest.rst:1235 +#: ../../library/doctest.rst:1257 msgid "" "A list of :class:`Example` objects encoding the individual interactive " "Python examples that should be run by this test." msgstr "" -#: ../../library/doctest.rst:1241 +#: ../../library/doctest.rst:1263 msgid "" "The namespace (aka globals) that the examples should be run in. This is a " "dictionary mapping names to values. Any changes to the namespace made by " @@ -1877,57 +1905,57 @@ msgid "" "`globs` after the test is run." msgstr "" -#: ../../library/doctest.rst:1249 +#: ../../library/doctest.rst:1271 msgid "" "A string name identifying the :class:`DocTest`. Typically, this is the name " "of the object or file that the test was extracted from." msgstr "" -#: ../../library/doctest.rst:1255 +#: ../../library/doctest.rst:1277 msgid "" "The name of the file that this :class:`DocTest` was extracted from; or " "``None`` if the filename is unknown, or if the :class:`DocTest` was not " "extracted from a file." msgstr "" -#: ../../library/doctest.rst:1262 +#: ../../library/doctest.rst:1284 msgid "" "The line number within :attr:`filename` where this :class:`DocTest` begins, " "or ``None`` if the line number is unavailable. This line number is zero-" "based with respect to the beginning of the file." msgstr "" -#: ../../library/doctest.rst:1269 +#: ../../library/doctest.rst:1291 msgid "" "The string that the test was extracted from, or ``None`` if the string is " "unavailable, or if the test was not extracted from a string." msgstr "" -#: ../../library/doctest.rst:1276 +#: ../../library/doctest.rst:1298 msgid "Example Objects" msgstr "Example 物件" -#: ../../library/doctest.rst:1281 +#: ../../library/doctest.rst:1303 msgid "" "A single interactive example, consisting of a Python statement and its " "expected output. The constructor arguments are used to initialize the " "attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1286 +#: ../../library/doctest.rst:1308 msgid "" ":class:`Example` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: ../../library/doctest.rst:1292 +#: ../../library/doctest.rst:1314 msgid "" "A string containing the example's source code. This source code consists of " "a single Python statement, and always ends with a newline; the constructor " "adds a newline when necessary." msgstr "" -#: ../../library/doctest.rst:1299 +#: ../../library/doctest.rst:1321 msgid "" "The expected output from running the example's source code (either from " "stdout, or a traceback in case of exception). :attr:`want` ends with a " @@ -1935,7 +1963,7 @@ msgid "" "The constructor adds a newline when necessary." msgstr "" -#: ../../library/doctest.rst:1307 +#: ../../library/doctest.rst:1329 msgid "" "The exception message generated by the example, if the example is expected " "to generate an exception; or ``None`` if it is not expected to generate an " @@ -1944,20 +1972,20 @@ msgid "" "unless it's ``None``. The constructor adds a newline if needed." msgstr "" -#: ../../library/doctest.rst:1316 +#: ../../library/doctest.rst:1338 msgid "" "The line number within the string containing this example where the example " "begins. This line number is zero-based with respect to the beginning of the " "containing string." msgstr "" -#: ../../library/doctest.rst:1323 +#: ../../library/doctest.rst:1345 msgid "" "The example's indentation in the containing string, i.e., the number of " "space characters that precede the example's first prompt." msgstr "" -#: ../../library/doctest.rst:1329 +#: ../../library/doctest.rst:1351 msgid "" "A dictionary mapping from option flags to ``True`` or ``False``, which is " "used to override default options for this example. Any option flags not " @@ -1966,11 +1994,11 @@ msgid "" "default, no options are set." msgstr "" -#: ../../library/doctest.rst:1339 +#: ../../library/doctest.rst:1361 msgid "DocTestFinder objects" msgstr "DocTestFinder 物件" -#: ../../library/doctest.rst:1344 +#: ../../library/doctest.rst:1366 msgid "" "A processing class used to extract the :class:`DocTest`\\ s that are " "relevant to a given object, from its docstring and the docstrings of its " @@ -1978,48 +2006,48 @@ msgid "" "classes, functions, methods, staticmethods, classmethods, and properties." msgstr "" -#: ../../library/doctest.rst:1349 +#: ../../library/doctest.rst:1371 msgid "" "The optional argument *verbose* can be used to display the objects searched " "by the finder. It defaults to ``False`` (no output)." msgstr "" -#: ../../library/doctest.rst:1352 +#: ../../library/doctest.rst:1374 msgid "" "The optional argument *parser* specifies the :class:`DocTestParser` object " "(or a drop-in replacement) that is used to extract doctests from docstrings." msgstr "" -#: ../../library/doctest.rst:1355 +#: ../../library/doctest.rst:1377 msgid "" "If the optional argument *recurse* is false, then :meth:`DocTestFinder.find` " "will only examine the given object, and not any contained objects." msgstr "" -#: ../../library/doctest.rst:1358 +#: ../../library/doctest.rst:1380 msgid "" "If the optional argument *exclude_empty* is false, then :meth:`DocTestFinder." "find` will include tests for objects with empty docstrings." msgstr "" -#: ../../library/doctest.rst:1362 +#: ../../library/doctest.rst:1384 msgid ":class:`DocTestFinder` defines the following method:" msgstr "" -#: ../../library/doctest.rst:1367 +#: ../../library/doctest.rst:1389 msgid "" "Return a list of the :class:`DocTest`\\ s that are defined by *obj*'s " "docstring, or by any of its contained objects' docstrings." msgstr "" -#: ../../library/doctest.rst:1370 +#: ../../library/doctest.rst:1392 msgid "" "The optional argument *name* specifies the object's name; this name will be " "used to construct names for the returned :class:`DocTest`\\ s. If *name* is " "not specified, then ``obj.__name__`` is used." msgstr "" -#: ../../library/doctest.rst:1374 +#: ../../library/doctest.rst:1396 msgid "" "The optional parameter *module* is the module that contains the given " "object. If the module is not specified or is ``None``, then the test finder " @@ -2027,26 +2055,26 @@ msgid "" "module is used:" msgstr "" -#: ../../library/doctest.rst:1378 +#: ../../library/doctest.rst:1400 msgid "As a default namespace, if *globs* is not specified." msgstr "" -#: ../../library/doctest.rst:1380 +#: ../../library/doctest.rst:1402 msgid "" "To prevent the DocTestFinder from extracting DocTests from objects that are " "imported from other modules. (Contained objects with modules other than " "*module* are ignored.)" msgstr "" -#: ../../library/doctest.rst:1384 +#: ../../library/doctest.rst:1406 msgid "To find the name of the file containing the object." msgstr "" -#: ../../library/doctest.rst:1386 +#: ../../library/doctest.rst:1408 msgid "To help find the line number of the object within its file." msgstr "" -#: ../../library/doctest.rst:1388 +#: ../../library/doctest.rst:1410 msgid "" "If *module* is ``False``, no attempt to find the module will be made. This " "is obscure, of use mostly in testing doctest itself: if *module* is " @@ -2055,7 +2083,7 @@ msgid "" "contained objects will (recursively) be searched for doctests." msgstr "" -#: ../../library/doctest.rst:1394 +#: ../../library/doctest.rst:1416 msgid "" "The globals for each :class:`DocTest` is formed by combining *globs* and " "*extraglobs* (bindings in *extraglobs* override bindings in *globs*). A new " @@ -2065,34 +2093,34 @@ msgid "" "defaults to ``{}``." msgstr "" -#: ../../library/doctest.rst:1405 +#: ../../library/doctest.rst:1427 msgid "DocTestParser objects" msgstr "DocTestParser 物件" -#: ../../library/doctest.rst:1410 +#: ../../library/doctest.rst:1432 msgid "" "A processing class used to extract interactive examples from a string, and " "use them to create a :class:`DocTest` object." msgstr "" -#: ../../library/doctest.rst:1414 +#: ../../library/doctest.rst:1436 msgid ":class:`DocTestParser` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1419 +#: ../../library/doctest.rst:1441 msgid "" "Extract all doctest examples from the given string, and collect them into a :" "class:`DocTest` object." msgstr "" -#: ../../library/doctest.rst:1422 +#: ../../library/doctest.rst:1444 msgid "" "*globs*, *name*, *filename*, and *lineno* are attributes for the new :class:" "`DocTest` object. See the documentation for :class:`DocTest` for more " "information." msgstr "" -#: ../../library/doctest.rst:1429 +#: ../../library/doctest.rst:1451 msgid "" "Extract all doctest examples from the given string, and return them as a " "list of :class:`Example` objects. Line numbers are 0-based. The optional " @@ -2100,7 +2128,7 @@ msgid "" "error messages." msgstr "" -#: ../../library/doctest.rst:1436 +#: ../../library/doctest.rst:1458 msgid "" "Divide the given string into examples and intervening text, and return them " "as a list of alternating :class:`Example`\\ s and strings. Line numbers for " @@ -2108,34 +2136,33 @@ msgid "" "name identifying this string, and is only used for error messages." msgstr "" -#: ../../library/doctest.rst:1443 -#, fuzzy +#: ../../library/doctest.rst:1465 msgid "TestResults objects" -msgstr "DocTestRunner 物件" +msgstr "TestResults 物件" -#: ../../library/doctest.rst:1450 +#: ../../library/doctest.rst:1472 msgid "Number of failed tests." msgstr "" -#: ../../library/doctest.rst:1454 +#: ../../library/doctest.rst:1476 msgid "Number of attempted tests." msgstr "" -#: ../../library/doctest.rst:1458 +#: ../../library/doctest.rst:1480 msgid "Number of skipped tests." msgstr "" -#: ../../library/doctest.rst:1466 +#: ../../library/doctest.rst:1488 msgid "DocTestRunner objects" msgstr "DocTestRunner 物件" -#: ../../library/doctest.rst:1471 +#: ../../library/doctest.rst:1493 msgid "" "A processing class used to execute and verify the interactive examples in a :" "class:`DocTest`." msgstr "" -#: ../../library/doctest.rst:1474 +#: ../../library/doctest.rst:1496 msgid "" "The comparison between expected outputs and actual outputs is done by an :" "class:`OutputChecker`. This comparison may be customized with a number of " @@ -2145,7 +2172,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/doctest.rst:1480 +#: ../../library/doctest.rst:1502 msgid "" "The test runner's display output can be controlled in two ways. First, an " "output function can be passed to :meth:`run`; this function will be called " @@ -2156,14 +2183,14 @@ msgid "" "`report_unexpected_exception`, and :meth:`report_failure`." msgstr "" -#: ../../library/doctest.rst:1488 +#: ../../library/doctest.rst:1510 msgid "" "The optional keyword argument *checker* specifies the :class:`OutputChecker` " "object (or drop-in replacement) that should be used to compare the expected " "outputs to the actual outputs of doctest examples." msgstr "" -#: ../../library/doctest.rst:1492 +#: ../../library/doctest.rst:1514 msgid "" "The optional keyword argument *verbose* controls the :class:" "`DocTestRunner`'s verbosity. If *verbose* is ``True``, then information is " @@ -2172,14 +2199,14 @@ msgid "" "verbose output is used iff the command-line switch ``-v`` is used." msgstr "" -#: ../../library/doctest.rst:1498 +#: ../../library/doctest.rst:1520 msgid "" "The optional keyword argument *optionflags* can be used to control how the " "test runner compares expected output to actual output, and how it displays " "failures. For more information, see section :ref:`doctest-options`." msgstr "" -#: ../../library/doctest.rst:1502 +#: ../../library/doctest.rst:1524 msgid "" "The test runner accumulates statistics. The aggregated number of attempted, " "failed and skipped examples is also available via the :attr:`tries`, :attr:" @@ -2187,53 +2214,53 @@ msgid "" "`summarize` methods return a :class:`TestResults` instance." msgstr "" -#: ../../library/doctest.rst:1507 +#: ../../library/doctest.rst:1529 msgid ":class:`DocTestRunner` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1512 +#: ../../library/doctest.rst:1534 msgid "" "Report that the test runner is about to process the given example. This " "method is provided to allow subclasses of :class:`DocTestRunner` to " "customize their output; it should not be called directly." msgstr "" -#: ../../library/doctest.rst:1516 +#: ../../library/doctest.rst:1538 msgid "" "*example* is the example about to be processed. *test* is the test " "*containing example*. *out* is the output function that was passed to :meth:" "`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1523 +#: ../../library/doctest.rst:1545 msgid "" "Report that the given example ran successfully. This method is provided to " "allow subclasses of :class:`DocTestRunner` to customize their output; it " "should not be called directly." msgstr "" -#: ../../library/doctest.rst:1527 ../../library/doctest.rst:1538 +#: ../../library/doctest.rst:1549 ../../library/doctest.rst:1560 msgid "" "*example* is the example about to be processed. *got* is the actual output " "from the example. *test* is the test containing *example*. *out* is the " "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1534 +#: ../../library/doctest.rst:1556 msgid "" "Report that the given example failed. This method is provided to allow " "subclasses of :class:`DocTestRunner` to customize their output; it should " "not be called directly." msgstr "" -#: ../../library/doctest.rst:1545 +#: ../../library/doctest.rst:1567 msgid "" "Report that the given example raised an unexpected exception. This method is " "provided to allow subclasses of :class:`DocTestRunner` to customize their " "output; it should not be called directly." msgstr "" -#: ../../library/doctest.rst:1549 +#: ../../library/doctest.rst:1571 msgid "" "*example* is the example about to be processed. *exc_info* is a tuple " "containing information about the unexpected exception (as returned by :func:" @@ -2241,14 +2268,14 @@ msgid "" "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1557 +#: ../../library/doctest.rst:1579 msgid "" "Run the examples in *test* (a :class:`DocTest` object), and display the " "results using the writer function *out*. Return a :class:`TestResults` " "instance." msgstr "" -#: ../../library/doctest.rst:1561 +#: ../../library/doctest.rst:1583 msgid "" "The examples are run in the namespace ``test.globs``. If *clear_globs* is " "true (the default), then this namespace will be cleared after the test runs, " @@ -2256,55 +2283,54 @@ msgid "" "after the test completes, then use *clear_globs=False*." msgstr "" -#: ../../library/doctest.rst:1566 +#: ../../library/doctest.rst:1588 msgid "" "*compileflags* gives the set of flags that should be used by the Python " "compiler when running the examples. If not specified, then it will default " "to the set of future-import flags that apply to *globs*." msgstr "" -#: ../../library/doctest.rst:1570 +#: ../../library/doctest.rst:1592 msgid "" "The output of each example is checked using the :class:`DocTestRunner`'s " "output checker, and the results are formatted by the :meth:`!DocTestRunner." "report_\\*` methods." msgstr "" -#: ../../library/doctest.rst:1577 +#: ../../library/doctest.rst:1599 msgid "" "Print a summary of all the test cases that have been run by this " "DocTestRunner, and return a :class:`TestResults` instance." msgstr "" -#: ../../library/doctest.rst:1580 +#: ../../library/doctest.rst:1602 msgid "" "The optional *verbose* argument controls how detailed the summary is. If " "the verbosity is not specified, then the :class:`DocTestRunner`'s verbosity " "is used." msgstr "" -#: ../../library/doctest.rst:1584 -#, fuzzy +#: ../../library/doctest.rst:1606 msgid ":class:`DocTestParser` has the following attributes:" -msgstr ":exc:`DocTestFailure` 定義了以下屬性:" +msgstr ":class:`DocTestParser` 有以下屬性:" -#: ../../library/doctest.rst:1588 +#: ../../library/doctest.rst:1610 msgid "Number of attempted examples." msgstr "" -#: ../../library/doctest.rst:1592 +#: ../../library/doctest.rst:1614 msgid "Number of failed examples." msgstr "" -#: ../../library/doctest.rst:1596 +#: ../../library/doctest.rst:1618 msgid "Number of skipped examples." msgstr "" -#: ../../library/doctest.rst:1604 +#: ../../library/doctest.rst:1626 msgid "OutputChecker objects" msgstr "OutputChecker 物件" -#: ../../library/doctest.rst:1609 +#: ../../library/doctest.rst:1631 msgid "" "A class used to check the whether the actual output from a doctest example " "matches the expected output. :class:`OutputChecker` defines two methods: :" @@ -2313,11 +2339,11 @@ msgid "" "string describing the differences between two outputs." msgstr "" -#: ../../library/doctest.rst:1616 +#: ../../library/doctest.rst:1638 msgid ":class:`OutputChecker` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1620 +#: ../../library/doctest.rst:1642 msgid "" "Return ``True`` iff the actual output from an example (*got*) matches the " "expected output (*want*). These strings are always considered to match if " @@ -2326,28 +2352,28 @@ msgid "" "`doctest-options` for more information about option flags." msgstr "" -#: ../../library/doctest.rst:1629 +#: ../../library/doctest.rst:1651 msgid "" "Return a string describing the differences between the expected output for a " "given example (*example*) and the actual output (*got*). *optionflags* is " "the set of option flags used to compare *want* and *got*." msgstr "" -#: ../../library/doctest.rst:1637 +#: ../../library/doctest.rst:1659 msgid "Debugging" msgstr "" -#: ../../library/doctest.rst:1639 +#: ../../library/doctest.rst:1661 msgid "Doctest provides several mechanisms for debugging doctest examples:" msgstr "" -#: ../../library/doctest.rst:1641 +#: ../../library/doctest.rst:1663 msgid "" "Several functions convert doctests to executable Python programs, which can " "be run under the Python debugger, :mod:`pdb`." msgstr "" -#: ../../library/doctest.rst:1644 +#: ../../library/doctest.rst:1666 msgid "" "The :class:`DebugRunner` class is a subclass of :class:`DocTestRunner` that " "raises an exception for the first failing example, containing information " @@ -2355,13 +2381,13 @@ msgid "" "debugging on the example." msgstr "" -#: ../../library/doctest.rst:1649 +#: ../../library/doctest.rst:1671 msgid "" "The :mod:`unittest` cases generated by :func:`DocTestSuite` support the :" "meth:`debug` method defined by :class:`unittest.TestCase`." msgstr "" -#: ../../library/doctest.rst:1652 +#: ../../library/doctest.rst:1674 msgid "" "You can add a call to :func:`pdb.set_trace` in a doctest example, and you'll " "drop into the Python debugger when that line is executed. Then you can " @@ -2369,7 +2395,7 @@ msgid "" "`a.py` contains just this module docstring::" msgstr "" -#: ../../library/doctest.rst:1657 +#: ../../library/doctest.rst:1679 msgid "" "\"\"\"\n" ">>> def f(x):\n" @@ -2391,11 +2417,11 @@ msgstr "" "9\n" "\"\"\"" -#: ../../library/doctest.rst:1667 +#: ../../library/doctest.rst:1689 msgid "Then an interactive Python session may look like this::" msgstr "" -#: ../../library/doctest.rst:1669 +#: ../../library/doctest.rst:1691 msgid "" ">>> import a, doctest\n" ">>> doctest.testmod(a)\n" @@ -2457,17 +2483,17 @@ msgstr "" "(0, 3)\n" ">>>" -#: ../../library/doctest.rst:1700 +#: ../../library/doctest.rst:1722 msgid "" "Functions that convert doctests to Python code, and possibly run the " "synthesized code under the debugger:" msgstr "" -#: ../../library/doctest.rst:1706 +#: ../../library/doctest.rst:1728 msgid "Convert text with examples to a script." msgstr "" -#: ../../library/doctest.rst:1708 +#: ../../library/doctest.rst:1730 msgid "" "Argument *s* is a string containing doctest examples. The string is " "converted to a Python script, where doctest examples in *s* are converted to " @@ -2475,7 +2501,7 @@ msgid "" "generated script is returned as a string. For example, ::" msgstr "" -#: ../../library/doctest.rst:1713 +#: ../../library/doctest.rst:1735 msgid "" "import doctest\n" "print(doctest.script_from_examples(r\"\"\"\n" @@ -2488,11 +2514,11 @@ msgid "" "\"\"\"))" msgstr "" -#: ../../library/doctest.rst:1723 +#: ../../library/doctest.rst:1745 msgid "displays::" msgstr "" -#: ../../library/doctest.rst:1725 +#: ../../library/doctest.rst:1747 msgid "" "# Set x and y to 1 and 2.\n" "x, y = 1, 2\n" @@ -2503,18 +2529,18 @@ msgid "" "## 3" msgstr "" -#: ../../library/doctest.rst:1733 +#: ../../library/doctest.rst:1755 msgid "" "This function is used internally by other functions (see below), but can " "also be useful when you want to transform an interactive Python session into " "a Python script." msgstr "" -#: ../../library/doctest.rst:1740 +#: ../../library/doctest.rst:1762 msgid "Convert the doctest for an object to a script." msgstr "" -#: ../../library/doctest.rst:1742 +#: ../../library/doctest.rst:1764 msgid "" "Argument *module* is a module object, or dotted name of a module, containing " "the object whose doctests are of interest. Argument *name* is the name " @@ -2524,7 +2550,7 @@ msgid "" "module :file:`a.py` contains a top-level function :func:`!f`, then ::" msgstr "" -#: ../../library/doctest.rst:1749 +#: ../../library/doctest.rst:1771 msgid "" "import a, doctest\n" "print(doctest.testsource(a, \"a.f\"))" @@ -2532,17 +2558,17 @@ msgstr "" "import a, doctest\n" "print(doctest.testsource(a, \"a.f\"))" -#: ../../library/doctest.rst:1752 +#: ../../library/doctest.rst:1774 msgid "" "prints a script version of function :func:`!f`'s docstring, with doctests " "converted to code, and the rest placed in comments." msgstr "" -#: ../../library/doctest.rst:1758 +#: ../../library/doctest.rst:1780 msgid "Debug the doctests for an object." msgstr "" -#: ../../library/doctest.rst:1760 +#: ../../library/doctest.rst:1782 msgid "" "The *module* and *name* arguments are the same as for function :func:" "`testsource` above. The synthesized Python script for the named object's " @@ -2550,13 +2576,13 @@ msgid "" "the control of the Python debugger, :mod:`pdb`." msgstr "" -#: ../../library/doctest.rst:1765 +#: ../../library/doctest.rst:1787 msgid "" "A shallow copy of ``module.__dict__`` is used for both local and global " "execution context." msgstr "" -#: ../../library/doctest.rst:1768 +#: ../../library/doctest.rst:1790 msgid "" "Optional argument *pm* controls whether post-mortem debugging is used. If " "*pm* has a true value, the script file is run directly, and the debugger " @@ -2568,30 +2594,30 @@ msgid "" "to :func:`pdb.run`." msgstr "" -#: ../../library/doctest.rst:1779 +#: ../../library/doctest.rst:1801 msgid "Debug the doctests in a string." msgstr "" -#: ../../library/doctest.rst:1781 +#: ../../library/doctest.rst:1803 msgid "" "This is like function :func:`debug` above, except that a string containing " "doctest examples is specified directly, via the *src* argument." msgstr "" -#: ../../library/doctest.rst:1784 +#: ../../library/doctest.rst:1806 msgid "" "Optional argument *pm* has the same meaning as in function :func:`debug` " "above." msgstr "" -#: ../../library/doctest.rst:1786 +#: ../../library/doctest.rst:1808 msgid "" "Optional argument *globs* gives a dictionary to use as both local and global " "execution context. If not specified, or ``None``, an empty dictionary is " "used. If specified, a shallow copy of the dictionary is used." msgstr "" -#: ../../library/doctest.rst:1791 +#: ../../library/doctest.rst:1813 msgid "" "The :class:`DebugRunner` class, and the special exceptions it may raise, are " "of most interest to testing framework authors, and will only be sketched " @@ -2599,7 +2625,7 @@ msgid "" "(which is a doctest!) for more details:" msgstr "" -#: ../../library/doctest.rst:1799 +#: ../../library/doctest.rst:1821 msgid "" "A subclass of :class:`DocTestRunner` that raises an exception as soon as a " "failure is encountered. If an unexpected exception occurs, an :exc:" @@ -2609,89 +2635,89 @@ msgid "" "the actual output." msgstr "" -#: ../../library/doctest.rst:1806 +#: ../../library/doctest.rst:1828 msgid "" "For information about the constructor parameters and methods, see the " "documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-" "api`." msgstr "" -#: ../../library/doctest.rst:1809 +#: ../../library/doctest.rst:1831 msgid "" "There are two exceptions that may be raised by :class:`DebugRunner` " "instances:" msgstr "" -#: ../../library/doctest.rst:1814 +#: ../../library/doctest.rst:1836 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example's actual output did not match its expected output. The constructor " "arguments are used to initialize the attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1818 +#: ../../library/doctest.rst:1840 msgid ":exc:`DocTestFailure` defines the following attributes:" msgstr ":exc:`DocTestFailure` 定義了以下屬性:" -#: ../../library/doctest.rst:1823 ../../library/doctest.rst:1847 +#: ../../library/doctest.rst:1845 ../../library/doctest.rst:1869 msgid "The :class:`DocTest` object that was being run when the example failed." msgstr "" -#: ../../library/doctest.rst:1828 ../../library/doctest.rst:1852 +#: ../../library/doctest.rst:1850 ../../library/doctest.rst:1874 msgid "The :class:`Example` that failed." msgstr "" -#: ../../library/doctest.rst:1833 +#: ../../library/doctest.rst:1855 msgid "The example's actual output." msgstr "" -#: ../../library/doctest.rst:1838 +#: ../../library/doctest.rst:1860 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example raised an unexpected exception. The constructor arguments are used " "to initialize the attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1842 +#: ../../library/doctest.rst:1864 msgid ":exc:`UnexpectedException` defines the following attributes:" msgstr "" -#: ../../library/doctest.rst:1857 +#: ../../library/doctest.rst:1879 msgid "" "A tuple containing information about the unexpected exception, as returned " "by :func:`sys.exc_info`." msgstr "" -#: ../../library/doctest.rst:1864 +#: ../../library/doctest.rst:1886 msgid "Soapbox" msgstr "" -#: ../../library/doctest.rst:1866 +#: ../../library/doctest.rst:1888 msgid "" "As mentioned in the introduction, :mod:`doctest` has grown to have three " "primary uses:" msgstr "" -#: ../../library/doctest.rst:1869 +#: ../../library/doctest.rst:1891 msgid "Checking examples in docstrings." msgstr "" -#: ../../library/doctest.rst:1871 +#: ../../library/doctest.rst:1893 msgid "Regression testing." msgstr "" -#: ../../library/doctest.rst:1873 +#: ../../library/doctest.rst:1895 msgid "Executable documentation / literate testing." msgstr "" -#: ../../library/doctest.rst:1875 +#: ../../library/doctest.rst:1897 msgid "" "These uses have different requirements, and it is important to distinguish " "them. In particular, filling your docstrings with obscure test cases makes " "for bad documentation." msgstr "" -#: ../../library/doctest.rst:1879 +#: ../../library/doctest.rst:1901 msgid "" "When writing a docstring, choose docstring examples with care. There's an " "art to this that needs to be learned---it may not be natural at first. " @@ -2703,7 +2729,7 @@ msgid "" "\"harmless\" change." msgstr "" -#: ../../library/doctest.rst:1887 +#: ../../library/doctest.rst:1909 msgid "" "Doctest also makes an excellent tool for regression testing, especially if " "you don't skimp on explanatory text. By interleaving prose and examples, it " @@ -2724,13 +2750,13 @@ msgid "" "different results, blurring the distinction between testing and explaining." msgstr "" -#: ../../library/doctest.rst:1905 +#: ../../library/doctest.rst:1927 msgid "" "Regression testing is best confined to dedicated objects or files. There " "are several options for organizing tests:" msgstr "" -#: ../../library/doctest.rst:1908 +#: ../../library/doctest.rst:1930 msgid "" "Write text files containing test cases as interactive examples, and test the " "files using :func:`testfile` or :func:`DocFileSuite`. This is recommended, " @@ -2738,7 +2764,7 @@ msgid "" "doctest." msgstr "" -#: ../../library/doctest.rst:1913 +#: ../../library/doctest.rst:1935 msgid "" "Define functions named ``_regrtest_topic`` that consist of single " "docstrings, containing test cases for the named topics. These functions can " @@ -2746,13 +2772,13 @@ msgid "" "test file." msgstr "" -#: ../../library/doctest.rst:1917 +#: ../../library/doctest.rst:1939 msgid "" "Define a ``__test__`` dictionary mapping from regression test topics to " "docstrings containing test cases." msgstr "" -#: ../../library/doctest.rst:1920 +#: ../../library/doctest.rst:1942 msgid "" "When you have placed your tests in a module, the module can itself be the " "test runner. When a test fails, you can arrange for your test runner to re-" @@ -2760,8 +2786,7 @@ msgid "" "example of such a test runner::" msgstr "" -#: ../../library/doctest.rst:1925 -#, fuzzy +#: ../../library/doctest.rst:1947 msgid "" "if __name__ == '__main__':\n" " import doctest\n" @@ -2791,55 +2816,58 @@ msgstr "" " optionflags=flags)\n" " else:\n" " fail, total = doctest.testmod(optionflags=flags)\n" -" print(\"{} failures out of {} tests\".format(fail, total))" +" print(f\"{fail} failures out of {total} tests\")" -#: ../../library/doctest.rst:1942 +#: ../../library/doctest.rst:1964 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" -#: ../../library/doctest.rst:1943 +#: ../../library/doctest.rst:1965 msgid "" "Examples containing both expected output and an exception are not supported. " "Trying to guess where one ends and the other begins is too error-prone, and " "that also makes for a confusing test." msgstr "" -#: ../../library/doctest.rst:339 +#: ../../library/doctest.rst:369 msgid ">>>" msgstr ">>>" -#: ../../library/doctest.rst:339 +#: ../../library/doctest.rst:369 msgid "interpreter prompt" msgstr "interpreter prompt(直譯器提示)" -#: ../../library/doctest.rst:339 ../../library/doctest.rst:577 +#: ../../library/doctest.rst:369 ../../library/doctest.rst:604 msgid "..." msgstr "..." -#: ../../library/doctest.rst:505 +#: ../../library/doctest.rst:535 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../library/doctest.rst:505 +#: ../../library/doctest.rst:535 msgid "marker" msgstr "marker(標記)" -#: ../../library/doctest.rst:557 +#: ../../library/doctest.rst:584 msgid "" msgstr "" -#: ../../library/doctest.rst:577 ../../library/doctest.rst:707 +#: ../../library/doctest.rst:604 ../../library/doctest.rst:729 msgid "in doctests" msgstr "於 doctests 中" -#: ../../library/doctest.rst:707 +#: ../../library/doctest.rst:729 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/doctest.rst:707 +#: ../../library/doctest.rst:729 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../library/doctest.rst:707 +#: ../../library/doctest.rst:729 msgid "- (minus)" msgstr "- (減號)" + +#~ msgid "The ``-o`` command line option." +#~ msgstr " ``-o`` 命令列選項。" diff --git a/library/email.errors.po b/library/email.errors.po index 4e9e91bc1f..2709c6bc47 100644 --- a/library/email.errors.po +++ b/library/email.errors.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-07 00:03+0000\n" +"POT-Creation-Date: 2025-03-04 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -64,40 +64,31 @@ msgstr "" #: ../../library/email.errors.rst:48 msgid "" -"Raised when a payload is added to a :class:`~email.message.Message` object " -"using :meth:`add_payload`, but the payload is already a scalar and the " -"message's :mailheader:`Content-Type` main type is not either :mimetype:" -"`multipart` or missing. :exc:`MultipartConversionError` multiply inherits " -"from :exc:`MessageError` and the built-in :exc:`TypeError`." +"Raised if the :meth:`~email.message.Message.attach` method is called on an " +"instance of a class derived from :class:`~email.mime.nonmultipart." +"MIMENonMultipart` (e.g. :class:`~email.mime.image.MIMEImage`). :exc:" +"`MultipartConversionError` multiply inherits from :exc:`MessageError` and " +"the built-in :exc:`TypeError`." msgstr "" -#: ../../library/email.errors.rst:54 -msgid "" -"Since :meth:`Message.add_payload` is deprecated, this exception is rarely " -"raised in practice. However the exception may also be raised if the :meth:" -"`~email.message.Message.attach` method is called on an instance of a class " -"derived from :class:`~email.mime.nonmultipart.MIMENonMultipart` (e.g. :class:" -"`~email.mime.image.MIMEImage`)." -msgstr "" - -#: ../../library/email.errors.rst:64 +#: ../../library/email.errors.rst:58 msgid "" "Raised when an error occurs when the :mod:`~email.generator` outputs headers." msgstr "" -#: ../../library/email.errors.rst:70 +#: ../../library/email.errors.rst:64 msgid "" "This is the base class for all defects found when parsing email messages. It " "is derived from :exc:`ValueError`." msgstr "" -#: ../../library/email.errors.rst:75 +#: ../../library/email.errors.rst:69 msgid "" "This is the base class for all defects found when parsing email headers. It " "is derived from :exc:`MessageDefect`." msgstr "" -#: ../../library/email.errors.rst:78 +#: ../../library/email.errors.rst:72 msgid "" "Here is the list of the defects that the :class:`~email.parser.FeedParser` " "can find while parsing messages. Note that the defects are added to the " @@ -107,90 +98,84 @@ msgid "" "not." msgstr "" -#: ../../library/email.errors.rst:84 +#: ../../library/email.errors.rst:78 msgid "" "All defect classes are subclassed from :class:`email.errors.MessageDefect`." msgstr "" -#: ../../library/email.errors.rst:86 +#: ../../library/email.errors.rst:82 msgid "" -":class:`NoBoundaryInMultipartDefect` -- A message claimed to be a multipart, " -"but had no :mimetype:`boundary` parameter." +"A message claimed to be a multipart, but had no :mimetype:`boundary` " +"parameter." msgstr "" -#: ../../library/email.errors.rst:89 +#: ../../library/email.errors.rst:87 msgid "" -":class:`StartBoundaryNotFoundDefect` -- The start boundary claimed in the :" -"mailheader:`Content-Type` header was never found." +"The start boundary claimed in the :mailheader:`Content-Type` header was " +"never found." msgstr "" #: ../../library/email.errors.rst:92 msgid "" -":class:`CloseBoundaryNotFoundDefect` -- A start boundary was found, but no " -"corresponding close boundary was ever found." +"A start boundary was found, but no corresponding close boundary was ever " +"found." msgstr "" -#: ../../library/email.errors.rst:97 -msgid "" -":class:`FirstHeaderLineIsContinuationDefect` -- The message had a " -"continuation line as its first header line." +#: ../../library/email.errors.rst:99 +msgid "The message had a continuation line as its first header line." msgstr "" -#: ../../library/email.errors.rst:100 -msgid "" -":class:`MisplacedEnvelopeHeaderDefect` - A \"Unix From\" header was found in " -"the middle of a header block." +#: ../../library/email.errors.rst:103 +msgid "A \"Unix From\" header was found in the middle of a header block." msgstr "" -#: ../../library/email.errors.rst:103 +#: ../../library/email.errors.rst:107 msgid "" -":class:`MissingHeaderBodySeparatorDefect` - A line was found while parsing " -"headers that had no leading white space but contained no ':'. Parsing " -"continues assuming that the line represents the first line of the body." +"A line was found while parsing headers that had no leading white space but " +"contained no ':'. Parsing continues assuming that the line represents the " +"first line of the body." msgstr "" -#: ../../library/email.errors.rst:109 +#: ../../library/email.errors.rst:115 msgid "" -":class:`MalformedHeaderDefect` -- A header was found that was missing a " -"colon, or was otherwise malformed." +"A header was found that was missing a colon, or was otherwise malformed." msgstr "" -#: ../../library/email.errors.rst:112 +#: ../../library/email.errors.rst:117 msgid "This defect has not been used for several Python versions." msgstr "" -#: ../../library/email.errors.rst:115 +#: ../../library/email.errors.rst:122 msgid "" -":class:`MultipartInvariantViolationDefect` -- A message claimed to be a :" -"mimetype:`multipart`, but no subparts were found. Note that when a message " -"has this defect, its :meth:`~email.message.Message.is_multipart` method may " -"return ``False`` even though its content type claims to be :mimetype:" -"`multipart`." +"A message claimed to be a :mimetype:`multipart`, but no subparts were found. " +"Note that when a message has this defect, its :meth:`~email.message.Message." +"is_multipart` method may return ``False`` even though its content type " +"claims to be :mimetype:`multipart`." msgstr "" -#: ../../library/email.errors.rst:120 +#: ../../library/email.errors.rst:129 msgid "" -":class:`InvalidBase64PaddingDefect` -- When decoding a block of base64 " -"encoded bytes, the padding was not correct. Enough padding is added to " -"perform the decode, but the resulting decoded bytes may be invalid." +"When decoding a block of base64 encoded bytes, the padding was not correct. " +"Enough padding is added to perform the decode, but the resulting decoded " +"bytes may be invalid." msgstr "" -#: ../../library/email.errors.rst:124 +#: ../../library/email.errors.rst:135 msgid "" -":class:`InvalidBase64CharactersDefect` -- When decoding a block of base64 " -"encoded bytes, characters outside the base64 alphabet were encountered. The " -"characters are ignored, but the resulting decoded bytes may be invalid." +"When decoding a block of base64 encoded bytes, characters outside the base64 " +"alphabet were encountered. The characters are ignored, but the resulting " +"decoded bytes may be invalid." msgstr "" -#: ../../library/email.errors.rst:128 +#: ../../library/email.errors.rst:141 msgid "" -":class:`InvalidBase64LengthDefect` -- When decoding a block of base64 " -"encoded bytes, the number of non-padding base64 characters was invalid (1 " -"more than a multiple of 4). The encoded block was kept as-is." +"When decoding a block of base64 encoded bytes, the number of non-padding " +"base64 characters was invalid (1 more than a multiple of 4). The encoded " +"block was kept as-is." msgstr "" -#: ../../library/email.errors.rst:132 +#: ../../library/email.errors.rst:147 msgid "" -":class:`InvalidDateDefect` -- When decoding an invalid or unparsable date " -"field. The original value is kept as-is." +"When decoding an invalid or unparsable date field. The original value is " +"kept as-is." msgstr "" diff --git a/library/email.examples.po b/library/email.examples.po index fe74e43133..f027517443 100644 --- a/library/email.examples.po +++ b/library/email.examples.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-08 00:14+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -337,7 +337,7 @@ msgid "" " recette\n" " sera sûrement un très bon repas.\n" "

\n" -" \n" +" \n" " \n" "\n" "\"\"\".format(asparagus_cid=asparagus_cid[1:-1]), subtype='html')\n" diff --git a/library/email.parser.po b/library/email.parser.po index 69565e928d..770ac9a254 100644 --- a/library/email.parser.po +++ b/library/email.parser.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -44,35 +43,35 @@ msgid "" "root :class:`~email.message.EmailMessage` instance of the object structure. " "For simple, non-MIME messages the payload of this root object will likely be " "a string containing the text of the message. For MIME messages, the root " -"object will return ``True`` from its :meth:`~email.message.EmailMessage." -"is_multipart` method, and the subparts can be accessed via the payload " -"manipulation methods, such as :meth:`~email.message.EmailMessage.get_body`, :" -"meth:`~email.message.EmailMessage.iter_parts`, and :meth:`~email.message." -"EmailMessage.walk`." +"object will return ``True`` from " +"its :meth:`~email.message.EmailMessage.is_multipart` method, and the " +"subparts can be accessed via the payload manipulation methods, such " +"as :meth:`~email.message.EmailMessage.get_body`, :meth:`~email.message.EmailMessage.iter_parts`, " +"and :meth:`~email.message.EmailMessage.walk`." msgstr "" #: ../../library/email.parser.rst:30 msgid "" -"There are actually two parser interfaces available for use, the :class:" -"`Parser` API and the incremental :class:`FeedParser` API. The :class:" -"`Parser` API is most useful if you have the entire text of the message in " -"memory, or if the entire message lives in a file on the file system. :class:" -"`FeedParser` is more appropriate when you are reading the message from a " -"stream which might block waiting for more input (such as reading an email " -"message from a socket). The :class:`FeedParser` can consume and parse the " -"message incrementally, and only returns the root object when you close the " -"parser." +"There are actually two parser interfaces available for use, " +"the :class:`Parser` API and the incremental :class:`FeedParser` API. " +"The :class:`Parser` API is most useful if you have the entire text of the " +"message in memory, or if the entire message lives in a file on the file " +"system. :class:`FeedParser` is more appropriate when you are reading the " +"message from a stream which might block waiting for more input (such as " +"reading an email message from a socket). The :class:`FeedParser` can " +"consume and parse the message incrementally, and only returns the root " +"object when you close the parser." msgstr "" #: ../../library/email.parser.rst:39 msgid "" "Note that the parser can be extended in limited ways, and of course you can " "implement your own parser completely from scratch. All of the logic that " -"connects the :mod:`email` package's bundled parser and the :class:`~email." -"message.EmailMessage` class is embodied in the :class:`~email.policy.Policy` " -"class, so a custom parser can create message object trees any way it finds " -"necessary by implementing custom versions of the appropriate :class:`!" -"Policy` methods." +"connects the :mod:`email` package's bundled parser and " +"the :class:`~email.message.EmailMessage` class is embodied in " +"the :class:`~email.policy.Policy` class, so a custom parser can create " +"message object trees any way it finds necessary by implementing custom " +"versions of the appropriate :class:`!Policy` methods." msgstr "" #: ../../library/email.parser.rst:49 @@ -84,11 +83,11 @@ msgid "" "The :class:`BytesFeedParser`, imported from the :mod:`email.feedparser` " "module, provides an API that is conducive to incremental parsing of email " "messages, such as would be necessary when reading the text of an email " -"message from a source that can block (such as a socket). The :class:" -"`BytesFeedParser` can of course be used to parse an email message fully " -"contained in a :term:`bytes-like object`, string, or file, but the :class:" -"`BytesParser` API may be more convenient for such use cases. The semantics " -"and results of the two parser APIs are identical." +"message from a source that can block (such as a socket). " +"The :class:`BytesFeedParser` can of course be used to parse an email message " +"fully contained in a :term:`bytes-like object`, string, or file, but " +"the :class:`BytesParser` API may be more convenient for such use cases. The " +"semantics and results of the two parser APIs are identical." msgstr "" #: ../../library/email.parser.rst:60 @@ -98,10 +97,10 @@ msgid "" "to retrieve the root message object. The :class:`BytesFeedParser` is " "extremely accurate when parsing standards-compliant messages, and it does a " "very good job of parsing non-compliant messages, providing information about " -"how a message was deemed broken. It will populate a message object's :attr:" -"`~email.message.EmailMessage.defects` attribute with a list of any problems " -"it found in a message. See the :mod:`email.errors` module for the list of " -"defects that it can find." +"how a message was deemed broken. It will populate a message " +"object's :attr:`~email.message.EmailMessage.defects` attribute with a list " +"of any problems it found in a message. See the :mod:`email.errors` module " +"for the list of defects that it can find." msgstr "" #: ../../library/email.parser.rst:70 @@ -111,21 +110,21 @@ msgstr "" #: ../../library/email.parser.rst:75 msgid "" "Create a :class:`BytesFeedParser` instance. Optional *_factory* is a no-" -"argument callable; if not specified use the :attr:`~email.policy.Policy." -"message_factory` from the *policy*. Call *_factory* whenever a new message " -"object is needed." +"argument callable; if not specified use " +"the :attr:`~email.policy.Policy.message_factory` from the *policy*. Call " +"*_factory* whenever a new message object is needed." msgstr "" #: ../../library/email.parser.rst:80 msgid "" "If *policy* is specified use the rules it specifies to update the " -"representation of the message. If *policy* is not set, use the :class:" -"`compat32 ` policy, which maintains backward " -"compatibility with the Python 3.2 version of the email package and provides :" -"class:`~email.message.Message` as the default factory. All other policies " -"provide :class:`~email.message.EmailMessage` as the default *_factory*. For " -"more information on what else *policy* controls, see the :mod:`~email." -"policy` documentation." +"representation of the message. If *policy* is not set, use " +"the :class:`compat32 ` policy, which maintains " +"backward compatibility with the Python 3.2 version of the email package and " +"provides :class:`~email.message.Message` as the default factory. All other " +"policies provide :class:`~email.message.EmailMessage` as the default " +"*_factory*. For more information on what else *policy* controls, see " +"the :mod:`~email.policy` documentation." msgstr "" #: ../../library/email.parser.rst:89 ../../library/email.parser.rst:145 @@ -160,10 +159,10 @@ msgstr "" #: ../../library/email.parser.rst:116 msgid "" -"Works like :class:`BytesFeedParser` except that the input to the :meth:" -"`~BytesFeedParser.feed` method must be a string. This is of limited " -"utility, since the only way for such a message to be valid is for it to " -"contain only ASCII text or, if :attr:`~email.policy.Policy.utf8` is " +"Works like :class:`BytesFeedParser` except that the input to " +"the :meth:`~BytesFeedParser.feed` method must be a string. This is of " +"limited utility, since the only way for such a message to be valid is for it " +"to contain only ASCII text or, if :attr:`~email.policy.Policy.utf8` is " "``True``, no binary attachments." msgstr "" @@ -176,13 +175,13 @@ msgid "" "The :class:`BytesParser` class, imported from the :mod:`email.parser` " "module, provides an API that can be used to parse a message when the " "complete contents of the message are available in a :term:`bytes-like " -"object` or file. The :mod:`email.parser` module also provides :class:" -"`Parser` for parsing strings, and header-only parsers, :class:" -"`BytesHeaderParser` and :class:`HeaderParser`, which can be used if you're " -"only interested in the headers of the message. :class:`BytesHeaderParser` " -"and :class:`HeaderParser` can be much faster in these situations, since they " -"do not attempt to parse the message body, instead setting the payload to the " -"raw body." +"object` or file. The :mod:`email.parser` module also " +"provides :class:`Parser` for parsing strings, and header-only " +"parsers, :class:`BytesHeaderParser` and :class:`HeaderParser`, which can be " +"used if you're only interested in the headers of the " +"message. :class:`BytesHeaderParser` and :class:`HeaderParser` can be much " +"faster in these situations, since they do not attempt to parse the message " +"body, instead setting the payload to the raw body." msgstr "" #: ../../library/email.parser.rst:141 @@ -206,8 +205,8 @@ msgstr "" #: ../../library/email.parser.rst:156 msgid "" "Read all the data from the binary file-like object *fp*, parse the resulting " -"bytes, and return the message object. *fp* must support both the :meth:`~io." -"IOBase.readline` and the :meth:`~io.IOBase.read` methods." +"bytes, and return the message object. *fp* must support both " +"the :meth:`~io.IOBase.readline` and the :meth:`~io.IOBase.read` methods." msgstr "" #: ../../library/email.parser.rst:161 @@ -217,8 +216,8 @@ msgid "" "and header continuation lines, optionally preceded by an envelope header. " "The header block is terminated either by the end of the data or by a blank " "line. Following the header block is the body of the message (which may " -"contain MIME-encoded subparts, including subparts with a :mailheader:" -"`Content-Transfer-Encoding` of ``8bit``)." +"contain MIME-encoded subparts, including subparts with " +"a :mailheader:`Content-Transfer-Encoding` of ``8bit``)." msgstr "" #: ../../library/email.parser.rst:169 @@ -231,9 +230,9 @@ msgstr "" #: ../../library/email.parser.rst:176 msgid "" "Similar to the :meth:`parse` method, except it takes a :term:`bytes-like " -"object` instead of a file-like object. Calling this method on a :term:" -"`bytes-like object` is equivalent to wrapping *bytes* in a :class:`~io." -"BytesIO` instance first and calling :meth:`parse`." +"object` instead of a file-like object. Calling this method on " +"a :term:`bytes-like object` is equivalent to wrapping *bytes* in " +"a :class:`~io.BytesIO` instance first and calling :meth:`parse`." msgstr "" #: ../../library/email.parser.rst:181 ../../library/email.parser.rst:221 @@ -267,16 +266,16 @@ msgstr "" #: ../../library/email.parser.rst:210 msgid "" -"Other than the text mode requirement, this method operates like :meth:" -"`BytesParser.parse`." +"Other than the text mode requirement, this method operates " +"like :meth:`BytesParser.parse`." msgstr "" #: ../../library/email.parser.rst:216 msgid "" "Similar to the :meth:`parse` method, except it takes a string object instead " "of a file-like object. Calling this method on a string is equivalent to " -"wrapping *text* in a :class:`~io.StringIO` instance first and calling :meth:" -"`parse`." +"wrapping *text* in a :class:`~io.StringIO` instance first and " +"calling :meth:`parse`." msgstr "" #: ../../library/email.parser.rst:226 @@ -330,10 +329,10 @@ msgstr "" #: ../../library/email.parser.rst:286 msgid "" ">>> import email\n" -">>> msg = email.message_from_bytes(myBytes) " +">>> msg = email.message_from_bytes(myBytes)" msgstr "" ">>> import email\n" -">>> msg = email.message_from_bytes(myBytes) " +">>> msg = email.message_from_bytes(myBytes)" #: ../../library/email.parser.rst:291 msgid "Additional notes" @@ -347,37 +346,39 @@ msgstr "" msgid "" "Most non-\\ :mimetype:`multipart` type messages are parsed as a single " "message object with a string payload. These objects will return ``False`` " -"for :meth:`~email.message.EmailMessage.is_multipart`, and :meth:`~email." -"message.EmailMessage.iter_parts` will yield an empty list." +"for :meth:`~email.message.EmailMessage.is_multipart`, " +"and :meth:`~email.message.EmailMessage.iter_parts` will yield an empty list." msgstr "" #: ../../library/email.parser.rst:300 msgid "" "All :mimetype:`multipart` type messages will be parsed as a container " "message object with a list of sub-message objects for their payload. The " -"outer container message will return ``True`` for :meth:`~email.message." -"EmailMessage.is_multipart`, and :meth:`~email.message.EmailMessage." -"iter_parts` will yield a list of subparts." +"outer container message will return ``True`` " +"for :meth:`~email.message.EmailMessage.is_multipart`, " +"and :meth:`~email.message.EmailMessage.iter_parts` will yield a list of " +"subparts." msgstr "" #: ../../library/email.parser.rst:306 msgid "" -"Most messages with a content type of :mimetype:`message/\\*` (such as :" -"mimetype:`message/delivery-status` and :mimetype:`message/rfc822`) will also " -"be parsed as container object containing a list payload of length 1. Their :" -"meth:`~email.message.EmailMessage.is_multipart` method will return ``True``. " -"The single element yielded by :meth:`~email.message.EmailMessage.iter_parts` " -"will be a sub-message object." +"Most messages with a content type of :mimetype:`message/\\*` (such " +"as :mimetype:`message/delivery-status` and :mimetype:`message/rfc822`) will " +"also be parsed as container object containing a list payload of length 1. " +"Their :meth:`~email.message.EmailMessage.is_multipart` method will return " +"``True``. The single element yielded " +"by :meth:`~email.message.EmailMessage.iter_parts` will be a sub-message " +"object." msgstr "" #: ../../library/email.parser.rst:313 msgid "" "Some non-standards-compliant messages may not be internally consistent about " -"their :mimetype:`multipart`\\ -edness. Such messages may have a :mailheader:" -"`Content-Type` header of type :mimetype:`multipart`, but their :meth:`~email." -"message.EmailMessage.is_multipart` method may return ``False``. If such " -"messages were parsed with the :class:`~email.parser.FeedParser`, they will " -"have an instance of the :class:`~email.errors." -"MultipartInvariantViolationDefect` class in their *defects* attribute list. " -"See :mod:`email.errors` for details." +"their :mimetype:`multipart`\\ -edness. Such messages may have " +"a :mailheader:`Content-Type` header of type :mimetype:`multipart`, but " +"their :meth:`~email.message.EmailMessage.is_multipart` method may return " +"``False``. If such messages were parsed with " +"the :class:`~email.parser.FeedParser`, they will have an instance of " +"the :class:`~email.errors.MultipartInvariantViolationDefect` class in their " +"*defects* attribute list. See :mod:`email.errors` for details." msgstr "" diff --git a/library/ensurepip.po b/library/ensurepip.po index 04b427e687..a3793b5fd2 100644 --- a/library/ensurepip.po +++ b/library/ensurepip.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -91,20 +91,20 @@ msgstr "" msgid "Command line interface" msgstr "命令列介面" -#: ../../library/ensurepip.rst:46 +#: ../../library/ensurepip.rst:48 msgid "" "The command line interface is invoked using the interpreter's ``-m`` switch." msgstr "使用直譯器 (interpreter) 的 ``-m`` 來叫用命令列介面" -#: ../../library/ensurepip.rst:48 +#: ../../library/ensurepip.rst:50 msgid "The simplest possible invocation is::" msgstr "最簡單可行的呼叫: ::" -#: ../../library/ensurepip.rst:50 +#: ../../library/ensurepip.rst:52 msgid "python -m ensurepip" msgstr "python -m ensurepip" -#: ../../library/ensurepip.rst:52 +#: ../../library/ensurepip.rst:54 msgid "" "This invocation will install ``pip`` if it is not already installed, but " "otherwise does nothing. To ensure the installed version of ``pip`` is at " @@ -115,11 +115,11 @@ msgstr "" "upgrade`` 參數來確保 ``pip`` 的安裝版本至少為目前 ``ensurepip`` 中最新可用的" "版本: ::" -#: ../../library/ensurepip.rst:57 +#: ../../library/ensurepip.rst:59 msgid "python -m ensurepip --upgrade" msgstr "python -m ensurepip --upgrade" -#: ../../library/ensurepip.rst:59 +#: ../../library/ensurepip.rst:61 msgid "" "By default, ``pip`` is installed into the current virtual environment (if " "one is active) or into the system site packages (if there is no active " @@ -129,25 +129,25 @@ msgstr "" "預設上,``pip`` 會被安裝至目前虛擬環境(若已啟動虛擬環境)或系統端的套件(若" "沒有啟動的虛擬環境)。安裝位置可透過兩個額外的命令列選項來控制:" -#: ../../library/ensurepip.rst:64 +#: ../../library/ensurepip.rst:68 msgid "" -":samp:`--root {dir}`: Installs ``pip`` relative to the given root directory " -"rather than the root of the currently active virtual environment (if any) or " -"the default root for the current Python installation." +"Installs ``pip`` relative to the given root directory rather than the root " +"of the currently active virtual environment (if any) or the default root for " +"the current Python installation." msgstr "" -"``--root ``:安裝 ``pip`` 到給定的根目錄 (root directory) 的相對路徑,而" -"不是目前虛擬環境(若存在)的根目錄,或目前 Python 安裝版所預設的根目錄。" +"安裝 ``pip`` 到給定的根目錄 (root directory) 的相對路徑,而不是目前虛擬環境" +"(若存在)的根目錄,或目前 Python 安裝版所預設的根目錄。" -#: ../../library/ensurepip.rst:67 +#: ../../library/ensurepip.rst:74 msgid "" -"``--user``: Installs ``pip`` into the user site packages directory rather " -"than globally for the current Python installation (this option is not " -"permitted inside an active virtual environment)." +"Installs ``pip`` into the user site packages directory rather than globally " +"for the current Python installation (this option is not permitted inside an " +"active virtual environment)." msgstr "" -"``--user`` :安裝 ``pip`` 到使用者端的套件目錄,而不是全域安裝到目前的 " -"Python 安裝版(此選項不允許在一啟動的虛擬環境中使用)。" +"安裝 ``pip`` 到使用者端的套件目錄,而不是全域安裝到目前的 Python 安裝版(此選" +"項不允許在一啟動的虛擬環境中使用)。" -#: ../../library/ensurepip.rst:71 +#: ../../library/ensurepip.rst:78 msgid "" "By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where X.Y " "stands for the version of Python used to invoke ``ensurepip``). The scripts " @@ -156,45 +156,42 @@ msgstr "" "預設會安裝 ``pipX`` 和 ``pipX.Y`` 腳本(X.Y 代表用來叫用 ``ensurepip`` 的 " "Python 之版本)。安裝的腳本可透過兩個額外的命令列選項來控制:" -#: ../../library/ensurepip.rst:76 +#: ../../library/ensurepip.rst:85 msgid "" -"``--altinstall``: if an alternate installation is requested, the ``pipX`` " -"script will *not* be installed." -msgstr "" -"``--altinstall``:若要求一個替代安裝版,則\\ *不會*\\ 安裝 ``pipX`` 腳本。" +"If an alternate installation is requested, the ``pipX`` script will *not* be " +"installed." +msgstr "若要求一個替代安裝版,則\\ *不會*\\ 安裝 ``pipX`` 腳本。" -#: ../../library/ensurepip.rst:79 +#: ../../library/ensurepip.rst:90 msgid "" -"``--default-pip``: if a \"default pip\" installation is requested, the " -"``pip`` script will be installed in addition to the two regular scripts." -msgstr "" -"``--default-pip``: 若要求安裝「預設 pip」,則會安裝 ``pip`` 腳本,及 2 個常" -"規腳本。" +"If a \"default pip\" installation is requested, the ``pip`` script will be " +"installed in addition to the two regular scripts." +msgstr "若要求安裝「預設 pip」,則會安裝 ``pip`` 腳本,及 2 個常規腳本。" -#: ../../library/ensurepip.rst:82 +#: ../../library/ensurepip.rst:93 msgid "" "Providing both of the script selection options will trigger an exception." msgstr "提供兩種指令選項將會導致例外 (exception) 。" -#: ../../library/ensurepip.rst:86 +#: ../../library/ensurepip.rst:96 msgid "Module API" msgstr "模組 API" -#: ../../library/ensurepip.rst:88 +#: ../../library/ensurepip.rst:98 msgid ":mod:`ensurepip` exposes two functions for programmatic use:" msgstr ":mod:`ensurepip` 開放了兩個用於編寫程式的函式:" -#: ../../library/ensurepip.rst:92 +#: ../../library/ensurepip.rst:102 msgid "" "Returns a string specifying the available version of pip that will be " "installed when bootstrapping an environment." msgstr "回傳一個字串,用以標明初始建置時,安裝的 pip 的可行版本號。" -#: ../../library/ensurepip.rst:99 +#: ../../library/ensurepip.rst:109 msgid "Bootstraps ``pip`` into the current or designated environment." msgstr "在目前或指定的環境之中建立 ``pip``。" -#: ../../library/ensurepip.rst:101 +#: ../../library/ensurepip.rst:111 msgid "" "*root* specifies an alternative root directory to install relative to. If " "*root* is ``None``, then installation uses the default install location for " @@ -203,64 +200,64 @@ msgstr "" "*root* 指定一個替代的根目錄,作為安裝的相對路徑。若 *root* 為 ``None``,則安" "裝使用目前環境的預設安裝位置。" -#: ../../library/ensurepip.rst:105 +#: ../../library/ensurepip.rst:115 msgid "" "*upgrade* indicates whether or not to upgrade an existing installation of an " "earlier version of ``pip`` to the available version." msgstr "*upgrade* 指出是否要將一個既有的較早版本的 ``pip`` 升級至可用的新版。" -#: ../../library/ensurepip.rst:108 +#: ../../library/ensurepip.rst:118 msgid "" "*user* indicates whether to use the user scheme rather than installing " "globally." msgstr "*user* 指出是否要使用使用者的安裝方案而不是全域安裝。" -#: ../../library/ensurepip.rst:111 +#: ../../library/ensurepip.rst:121 msgid "" "By default, the scripts ``pipX`` and ``pipX.Y`` will be installed (where X.Y " "stands for the current version of Python)." msgstr "預設會安裝 ``pipX`` 和 ``pipX.Y`` 腳本(X.Y 代表 Python 的目前版本)。" -#: ../../library/ensurepip.rst:114 +#: ../../library/ensurepip.rst:124 msgid "If *altinstall* is set, then ``pipX`` will *not* be installed." msgstr "如果啟用了 *altinstall*,則不會安裝 ``pipX``。" -#: ../../library/ensurepip.rst:116 +#: ../../library/ensurepip.rst:126 msgid "" "If *default_pip* is set, then ``pip`` will be installed in addition to the " "two regular scripts." msgstr "如果啟用了 *default_pip*,則會安裝 ``pip``,以及 2 個常規腳本。" -#: ../../library/ensurepip.rst:119 +#: ../../library/ensurepip.rst:129 msgid "" "Setting both *altinstall* and *default_pip* will trigger :exc:`ValueError`." msgstr "同時啟用 *altinstall* 跟 *default_pip*,將會觸發 :exc:`ValueError`。" -#: ../../library/ensurepip.rst:122 +#: ../../library/ensurepip.rst:132 msgid "" "*verbosity* controls the level of output to :data:`sys.stdout` from the " "bootstrapping operation." msgstr "" "*verbosity* 用來控制初始建置操作內,對於 :data:`sys.stdout` 的輸出等級。" -#: ../../library/ensurepip.rst:125 +#: ../../library/ensurepip.rst:135 msgid "" "Raises an :ref:`auditing event ` ``ensurepip.bootstrap`` with " "argument ``root``." msgstr "" -"引發一個附帶引數 ``root`` 的\\ :ref:`稽核事件 ` ``ensurepip." -"bootstrap``。" +"引發一個附帶引數 ``root`` 的\\ :ref:`稽核事件 ` " +"``ensurepip.bootstrap``。" -#: ../../library/ensurepip.rst:129 +#: ../../library/ensurepip.rst:139 msgid "" -"The bootstrapping process has side effects on both ``sys.path`` and ``os." -"environ``. Invoking the command line interface in a subprocess instead " +"The bootstrapping process has side effects on both ``sys.path`` and " +"``os.environ``. Invoking the command line interface in a subprocess instead " "allows these side effects to be avoided." msgstr "" "初始建置的過程對於 ``sys.path`` 及 ``os.environ`` 均有副作用。改為在一子行程 " "(subprocess) 呼叫命令列介面可避免這些副作用。" -#: ../../library/ensurepip.rst:135 +#: ../../library/ensurepip.rst:145 msgid "" "The bootstrapping process may install additional modules required by " "``pip``, but other software should not assume those dependencies will always " diff --git a/library/exceptions.po b/library/exceptions.po index c3f246ac87..e862cec0b2 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-04 00:13+0000\n" +"POT-Creation-Date: 2025-03-04 00:14+0000\n" "PO-Revision-Date: 2024-12-20 16:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -508,14 +508,16 @@ msgstr "" #: ../../library/exceptions.rst:338 msgid "" -"``NotImplementedError`` and :data:`NotImplemented` are not interchangeable, " -"even though they have similar names and purposes. See :data:`!" -"NotImplemented` for details on when to use it." +":exc:`!NotImplementedError` and :data:`!NotImplemented` are not " +"interchangeable. This exception should only be used as described above; " +"see :data:`NotImplemented` for details on correct usage of the built-in " +"constant." msgstr "" -"``NotImplementedError`` 和 :data:`NotImplemented` 雖然有相似的名稱和目的但並" -"不是可互換的。參考 :data:`!NotImplemented` 裡關於何時使用的細節。" +":exc:`!NotImplementedError` 和 :data:`!NotImplemented` 並不是可互換的。這個例" +"外只能用在上面描述的情況;參考 :data:`NotImplemented` 裡關於內建常數正確使用" +"方法的細節。" -#: ../../library/exceptions.rst:347 +#: ../../library/exceptions.rst:349 msgid "" "This exception is raised when a system function returns a system-related " "error, including I/O failures such as \"file not found\" or \"disk full\" " @@ -524,7 +526,7 @@ msgstr "" "當系統函式回傳系統相關錯誤,包含像\"找不到檔案\"或\"硬碟已滿\"的 I/O 失敗會引" "發此例外(而非不合法的引數或其他次要的錯誤)。" -#: ../../library/exceptions.rst:351 +#: ../../library/exceptions.rst:353 msgid "" "The second form of the constructor sets the corresponding attributes, " "described below. The attributes default to :const:`None` if not specified. " @@ -537,7 +539,7 @@ msgstr "" "數,:attr:`~BaseException.args` 屬性只會是包含建構函式前兩個引數的雙元素元" "組。" -#: ../../library/exceptions.rst:357 +#: ../../library/exceptions.rst:359 msgid "" "The constructor often actually returns a subclass of :exc:`OSError`, as " "described in `OS exceptions`_ below. The particular subclass depends on the " @@ -550,11 +552,11 @@ msgstr "" "個行為只發生在直接建構 :exc:`OSError` 或透過別名,且產生子類別的時候不會被繼" "承。" -#: ../../library/exceptions.rst:365 +#: ../../library/exceptions.rst:367 msgid "A numeric error code from the C variable :c:data:`errno`." msgstr "從 C 變數 :c:data:`errno` 而來的數值錯誤代碼。" -#: ../../library/exceptions.rst:369 +#: ../../library/exceptions.rst:371 msgid "" "Under Windows, this gives you the native Windows error code. " "The :attr:`.errno` attribute is then an approximate translation, in POSIX " @@ -563,7 +565,7 @@ msgstr "" "在 Windows 下,這會提供你原生的 Windows 錯誤代碼。而 :attr:`.errno` 屬性是一" "個該原生錯誤代碼對於 POSIX 來說的近似翻譯。" -#: ../../library/exceptions.rst:373 +#: ../../library/exceptions.rst:375 msgid "" "Under Windows, if the *winerror* constructor argument is an integer, " "the :attr:`.errno` attribute is determined from the Windows error code, and " @@ -574,7 +576,7 @@ msgstr "" "據該 Windows 錯誤代碼來決定,且 *errno* 引數會被忽略。在其他平台上," "*winerror* 引數會被忽略,而 :attr:`winerror` 屬性會不存在。" -#: ../../library/exceptions.rst:381 +#: ../../library/exceptions.rst:383 msgid "" "The corresponding error message, as provided by the operating system. It is " "formatted by the C functions :c:func:`perror` under POSIX, " @@ -583,7 +585,7 @@ msgstr "" "作業系統提供的對應錯誤訊息。在 POSIX 下會使用 C 函式 :c:func:`perror` 做格式" "化,而在 Windows 下會使用 :c:func:`FormatMessage`。" -#: ../../library/exceptions.rst:389 +#: ../../library/exceptions.rst:391 msgid "" "For exceptions that involve a file system path (such as :func:`open` " "or :func:`os.unlink`), :attr:`filename` is the file name passed to the " @@ -596,7 +598,7 @@ msgstr "" "案系統路徑的函式(像是 :func:`os.rename`),:attr:`filename2` 對應到傳入函式" "的第二個檔案名稱。" -#: ../../library/exceptions.rst:396 +#: ../../library/exceptions.rst:398 msgid "" ":exc:`EnvironmentError`, :exc:`IOError`, :exc:`WindowsError`, :exc:`socket.error`, :exc:`select.error` " "and :exc:`mmap.error` have been merged into :exc:`OSError`, and the " @@ -605,7 +607,7 @@ msgstr "" ":exc:`EnvironmentError`、:exc:`IOError`、:exc:`WindowsError`、:exc:`socket.error`、:exc:`select.error` " "及 :exc:`mmap.error` 已合併進 :exc:`OSError`,而建構函式可能會回傳子類別。" -#: ../../library/exceptions.rst:402 +#: ../../library/exceptions.rst:404 msgid "" "The :attr:`filename` attribute is now the original file name passed to the " "function, instead of the name encoded to or decoded from " @@ -616,7 +618,7 @@ msgstr "" "和錯誤處理函式 `\\ 編碼或解碼過的名" "稱。並且新增 *filename2* 建構函式引數與屬性。" -#: ../../library/exceptions.rst:411 +#: ../../library/exceptions.rst:413 msgid "" "Raised when the result of an arithmetic operation is too large to be " "represented. This cannot occur for integers (which would rather " @@ -630,7 +632,7 @@ msgstr "" "有時候會因為整數在要求範圍之外而引發。因為在 C 裡面缺乏浮點數例外處理的標準" "化,大部分的浮點數運算都沒有被檢查。" -#: ../../library/exceptions.rst:421 +#: ../../library/exceptions.rst:423 msgid "" "This exception is derived from :exc:`RuntimeError`. It is raised when an " "operation is blocked during interpreter shutdown also known as :term:`Python " @@ -640,7 +642,7 @@ msgstr "" "作 :term:`Python 最終化 (Python finalization) `)期間" "被阻塞會引發此例外。" -#: ../../library/exceptions.rst:425 +#: ../../library/exceptions.rst:427 msgid "" "Examples of operations which can be blocked with " "a :exc:`PythonFinalizationError` during the Python finalization:" @@ -648,23 +650,23 @@ msgstr "" "在 Python 最終化期間,能夠以 :exc:`PythonFinalizationError` 被阻塞的操作範" "例:" -#: ../../library/exceptions.rst:428 +#: ../../library/exceptions.rst:430 msgid "Creating a new Python thread." msgstr "建立新的 Python 執行緒。" -#: ../../library/exceptions.rst:429 +#: ../../library/exceptions.rst:431 msgid ":func:`os.fork`." msgstr ":func:`os.fork`。" -#: ../../library/exceptions.rst:431 +#: ../../library/exceptions.rst:433 msgid "See also the :func:`sys.is_finalizing` function." msgstr "也可以參閱 :func:`sys.is_finalizing` 函式。" -#: ../../library/exceptions.rst:433 ../../library/exceptions.rst:443 +#: ../../library/exceptions.rst:435 ../../library/exceptions.rst:445 msgid "Previously, a plain :exc:`RuntimeError` was raised." msgstr "在之前,會引發一般的 :exc:`RuntimeError`。" -#: ../../library/exceptions.rst:439 +#: ../../library/exceptions.rst:441 msgid "" "This exception is derived from :exc:`RuntimeError`. It is raised when the " "interpreter detects that the maximum recursion depth " @@ -673,7 +675,7 @@ msgstr "" "此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參" "考 :func:`sys.getrecursionlimit`)時會引發此例外。" -#: ../../library/exceptions.rst:449 +#: ../../library/exceptions.rst:451 msgid "" "This exception is raised when a weak reference proxy, created by " "the :func:`weakref.proxy` function, is used to access an attribute of the " @@ -684,7 +686,7 @@ msgstr "" "用來存取已經被垃圾回收 (garbage collected) 的參照物屬性時會引發此例外。更多關" "於弱參照的資訊參考 :mod:`weakref` 模組。" -#: ../../library/exceptions.rst:457 +#: ../../library/exceptions.rst:459 msgid "" "Raised when an error is detected that doesn't fall in any of the other " "categories. The associated value is a string indicating what precisely went " @@ -693,7 +695,7 @@ msgstr "" "當偵測到一個不屬於任何其他種類的錯誤時會引發此例外。關聯值是一個表示確切什麼" "地方出錯的字串。" -#: ../../library/exceptions.rst:464 +#: ../../library/exceptions.rst:466 msgid "" "Raised by built-in function :func:`next` and " "an :term:`iterator`\\'s :meth:`~iterator.__next__` method to signal that " @@ -702,7 +704,7 @@ msgstr "" "會被內建函式 :func:`next` 及 :term:`iterator` 的 :meth:`~iterator.__next__` " "方法引發,用來表示疊代器沒有更多項目可以產生。" -#: ../../library/exceptions.rst:470 +#: ../../library/exceptions.rst:472 msgid "" "The exception object has a single attribute :attr:`!value`, which is given " "as an argument when constructing the exception, and defaults " @@ -711,7 +713,7 @@ msgstr "" "此例外物件有單一屬性 :attr:`!value`,當建構此例外時會以引數給定,預設" "為 :const:`None`。" -#: ../../library/exceptions.rst:474 +#: ../../library/exceptions.rst:476 msgid "" "When a :term:`generator` or :term:`coroutine` function returns, a " "new :exc:`StopIteration` instance is raised, and the value returned by the " @@ -722,7 +724,7 @@ msgstr "" "的 :exc:`StopIteration` 實例會被引發,而該函式的回傳值會被用來當作此例外建構" "函式的 :attr:`value` 參數。" -#: ../../library/exceptions.rst:479 +#: ../../library/exceptions.rst:481 msgid "" "If a generator code directly or indirectly raises :exc:`StopIteration`, it " "is converted into a :exc:`RuntimeError` (retaining the :exc:`StopIteration` " @@ -731,13 +733,13 @@ msgstr "" "如果產生器程式直接或間接引發 :exc:`StopIteration`,則其會被轉換" "成 :exc:`RuntimeError`\\ (保留 :exc:`StopIteration` 作為新例外的成因)。" -#: ../../library/exceptions.rst:483 +#: ../../library/exceptions.rst:485 msgid "" "Added ``value`` attribute and the ability for generator functions to use it " "to return a value." msgstr "新增 ``value`` 屬性且產生器函式可以用它來回傳值。" -#: ../../library/exceptions.rst:487 +#: ../../library/exceptions.rst:489 msgid "" "Introduced the RuntimeError transformation via ``from __future__ import " "generator_stop``, see :pep:`479`." @@ -745,7 +747,7 @@ msgstr "" "透過 ``from __future__ import generator_stop`` 引入 RuntimeError 的轉換,參" "考 :pep:`479`。" -#: ../../library/exceptions.rst:491 +#: ../../library/exceptions.rst:493 msgid "" "Enable :pep:`479` for all code by default: a :exc:`StopIteration` error " "raised in a generator is transformed into a :exc:`RuntimeError`." @@ -753,7 +755,7 @@ msgstr "" "預設對所有程式啟用 :pep:`479`:在產生器引發的 :exc:`StopIteration` 錯誤會轉換" "成 :exc:`RuntimeError`。" -#: ../../library/exceptions.rst:497 +#: ../../library/exceptions.rst:499 msgid "" "Must be raised by :meth:`~object.__anext__` method of an :term:`asynchronous " "iterator` object to stop the iteration." @@ -761,7 +763,7 @@ msgstr "" "此例外必須被 :term:`asynchronous iterator` 物件的 :meth:`~object.__anext__` " "方法引發來停止疊代。" -#: ../../library/exceptions.rst:504 +#: ../../library/exceptions.rst:506 msgid "" "Raised when the parser encounters a syntax error. This may occur in " "an :keyword:`import` statement, in a call to the built-in " @@ -772,7 +774,7 @@ msgstr "" "呼叫內建函式 :func:`compile`、:func:`exec` 或 :func:`eval` 的時候,或者在讀取" "初始腳本或標準輸入(也包含互動式)的時候。" -#: ../../library/exceptions.rst:510 +#: ../../library/exceptions.rst:512 msgid "" "The :func:`str` of the exception instance returns only the error message. " "Details is a tuple whose members are also available as separate attributes." @@ -780,18 +782,18 @@ msgstr "" "例外實例的 :func:`str` 只回傳錯誤訊息。Details 是個元組,其成員也能夠以分開的" "屬性取得。" -#: ../../library/exceptions.rst:515 +#: ../../library/exceptions.rst:517 msgid "The name of the file the syntax error occurred in." msgstr "發生語法錯誤所在的檔案名稱。" -#: ../../library/exceptions.rst:519 +#: ../../library/exceptions.rst:521 msgid "" "Which line number in the file the error occurred in. This is 1-indexed: the " "first line in the file has a ``lineno`` of 1." msgstr "" "發生錯誤所在檔案的列號。這是以 1 開始的索引:檔案第一列的 ``lineno`` 是 1。" -#: ../../library/exceptions.rst:524 +#: ../../library/exceptions.rst:526 msgid "" "The column in the line where the error occurred. This is 1-indexed: the " "first character in the line has an ``offset`` of 1." @@ -799,11 +801,11 @@ msgstr "" "發生錯誤所在該列的欄號 (column)。這是以 1 開始的索引:該列第一個字元的 " "``offset`` 是 1。" -#: ../../library/exceptions.rst:529 +#: ../../library/exceptions.rst:531 msgid "The source code text involved in the error." msgstr "涉及該錯誤的原始程式碼文字。" -#: ../../library/exceptions.rst:533 +#: ../../library/exceptions.rst:535 msgid "" "Which line number in the file the error occurred ends in. This is 1-indexed: " "the first line in the file has a ``lineno`` of 1." @@ -811,7 +813,7 @@ msgstr "" "發生錯誤所在檔案的結束列號。這是以 1 開始的索引:檔案第一列的 ``lineno`` 是 " "1。" -#: ../../library/exceptions.rst:538 +#: ../../library/exceptions.rst:540 msgid "" "The column in the end line where the error occurred finishes. This is 1-" "indexed: the first character in the line has an ``offset`` of 1." @@ -819,7 +821,7 @@ msgstr "" "發生錯誤所在該結束列的欄號。這是以 1 開始的索引:該列第一個字元的 ``offset`` " "是 1。" -#: ../../library/exceptions.rst:541 +#: ../../library/exceptions.rst:543 msgid "" "For errors in f-string fields, the message is prefixed by \"f-string: \" and " "the offsets are offsets in a text constructed from the replacement " @@ -830,18 +832,18 @@ msgstr "" "(offset) 是從替代表達式建構的文字的偏移量。例如編譯 f'Bad {a b} field' 會得到" "這個 args 屬性:('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))。" -#: ../../library/exceptions.rst:546 +#: ../../library/exceptions.rst:548 msgid "Added the :attr:`end_lineno` and :attr:`end_offset` attributes." msgstr "新增 :attr:`end_lineno` 與 :attr:`end_offset` 屬性。" -#: ../../library/exceptions.rst:551 +#: ../../library/exceptions.rst:553 msgid "" "Base class for syntax errors related to incorrect indentation. This is a " "subclass of :exc:`SyntaxError`." msgstr "" "與不正確的縮排有關的語法錯誤的基礎類別。這是 :exc:`SyntaxError` 的子類別。" -#: ../../library/exceptions.rst:557 +#: ../../library/exceptions.rst:559 msgid "" "Raised when indentation contains an inconsistent use of tabs and spaces. " "This is a subclass of :exc:`IndentationError`." @@ -849,7 +851,7 @@ msgstr "" "當縮排包含製表符號 (tab) 和空白的不一致用法時會引發此例外。這" "是 :exc:`IndentationError` 的子類別。" -#: ../../library/exceptions.rst:563 +#: ../../library/exceptions.rst:565 msgid "" "Raised when the interpreter finds an internal error, but the situation does " "not look so serious to cause it to abandon all hope. The associated value is " @@ -862,7 +864,7 @@ msgstr "" "在 :term:`CPython` 中,這可能是因為錯誤地使用 Python 的 C API,例如回傳一個 " "``NULL`` 值而沒有設定例外。" -#: ../../library/exceptions.rst:569 +#: ../../library/exceptions.rst:571 msgid "" "If you're confident that this exception wasn't your fault, or the fault of a " "package you're using, you should report this to the author or maintainer of " @@ -877,7 +879,7 @@ msgstr "" "互動式 Python 會話的開頭被印出)、確切的錯誤訊息(該例外的關聯值)及如果可能" "的話,觸發此錯誤的程式來源。" -#: ../../library/exceptions.rst:580 +#: ../../library/exceptions.rst:582 msgid "" "This exception is raised by the :func:`sys.exit` function. It inherits " "from :exc:`BaseException` instead of :exc:`Exception` so that it is not " @@ -898,7 +900,7 @@ msgstr "" "``None``,結束狀態會是 0;如果它是其他型別(例如字串),則物件的值會被印出而" "結束狀態是 1。" -#: ../../library/exceptions.rst:591 +#: ../../library/exceptions.rst:593 msgid "" "A call to :func:`sys.exit` is translated into an exception so that clean-up " "handlers (:keyword:`finally` clauses of :keyword:`try` statements) can be " @@ -912,13 +914,13 @@ msgstr "" "風險下執行腳本。如果在絕對有必要立即結束的情況(例如在子行程呼叫" "完 :func:`os.fork` 之後 )可以使用 :func:`os._exit` 函式。" -#: ../../library/exceptions.rst:600 +#: ../../library/exceptions.rst:602 msgid "" "The exit status or error message that is passed to the constructor. " "(Defaults to ``None``.)" msgstr "傳入建構函式的結束狀態或錯誤訊息。(預設是 ``None``。 )" -#: ../../library/exceptions.rst:606 +#: ../../library/exceptions.rst:608 msgid "" "Raised when an operation or function is applied to an object of " "inappropriate type. The associated value is a string giving details about " @@ -927,7 +929,7 @@ msgstr "" "當一個操作或函式被用在不適合的型別的物件時會引發此例外。關聯值是一個字串,提" "供關於不相符型別的細節。" -#: ../../library/exceptions.rst:609 +#: ../../library/exceptions.rst:611 msgid "" "This exception may be raised by user code to indicate that an attempted " "operation on an object is not supported, and is not meant to be. If an " @@ -938,7 +940,7 @@ msgstr "" "這樣做。如果一個物件有意要支援某個給定的操作但尚未提供實作,該引發的正確例外" "是 :exc:`NotImplementedError`。" -#: ../../library/exceptions.rst:614 +#: ../../library/exceptions.rst:616 msgid "" "Passing arguments of the wrong type (e.g. passing a :class:`list` when " "an :class:`int` is expected) should result in a :exc:`TypeError`, but " @@ -949,7 +951,7 @@ msgstr "" "導致 :exc:`TypeError`,但傳入帶有錯誤值的引數(例如超出預期範圍的數值)應該要" "導致 :exc:`ValueError`。" -#: ../../library/exceptions.rst:621 +#: ../../library/exceptions.rst:623 msgid "" "Raised when a reference is made to a local variable in a function or method, " "but no value has been bound to that variable. This is a subclass " @@ -958,7 +960,7 @@ msgstr "" "當在函式或方法裡引用某個區域變數,但該變數尚未被繫結到任何值的時候會引發此例" "外。這是 :exc:`NameError` 的子類別。" -#: ../../library/exceptions.rst:628 +#: ../../library/exceptions.rst:630 msgid "" "Raised when a Unicode-related encoding or decoding error occurs. It is a " "subclass of :exc:`ValueError`." @@ -966,7 +968,7 @@ msgstr "" "當 Unicode 相關的編碼或解碼錯誤發生時會引發此例外。這是 :exc:`ValueError` 的" "子類別。" -#: ../../library/exceptions.rst:631 +#: ../../library/exceptions.rst:633 msgid "" ":exc:`UnicodeError` has attributes that describe the encoding or decoding " "error. For example, ``err.object[err.start:err.end]`` gives the particular " @@ -975,27 +977,27 @@ msgstr "" ":exc:`UnicodeError` 有屬性描述編碼或解碼錯誤。例如 " "``err.object[err.start:err.end]`` 會提供讓編解碼器失敗的具體無效輸入。" -#: ../../library/exceptions.rst:637 +#: ../../library/exceptions.rst:639 msgid "The name of the encoding that raised the error." msgstr "引發錯誤的編碼名稱。" -#: ../../library/exceptions.rst:641 +#: ../../library/exceptions.rst:643 msgid "A string describing the specific codec error." msgstr "描述特定編解碼器錯誤的字串。" -#: ../../library/exceptions.rst:645 +#: ../../library/exceptions.rst:647 msgid "The object the codec was attempting to encode or decode." msgstr "編解碼器嘗試編碼或解碼的物件。" -#: ../../library/exceptions.rst:649 +#: ../../library/exceptions.rst:651 msgid "The first index of invalid data in :attr:`object`." msgstr "在 :attr:`object` 中無效資料的開始索引。" -#: ../../library/exceptions.rst:653 +#: ../../library/exceptions.rst:655 msgid "The index after the last invalid data in :attr:`object`." msgstr "在 :attr:`object` 中最後的無效資料後的索引。" -#: ../../library/exceptions.rst:658 +#: ../../library/exceptions.rst:660 msgid "" "Raised when a Unicode-related error occurs during encoding. It is a " "subclass of :exc:`UnicodeError`." @@ -1003,7 +1005,7 @@ msgstr "" "在編碼當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:664 +#: ../../library/exceptions.rst:666 msgid "" "Raised when a Unicode-related error occurs during decoding. It is a " "subclass of :exc:`UnicodeError`." @@ -1011,7 +1013,7 @@ msgstr "" "在解碼當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:670 +#: ../../library/exceptions.rst:672 msgid "" "Raised when a Unicode-related error occurs during translating. It is a " "subclass of :exc:`UnicodeError`." @@ -1019,7 +1021,7 @@ msgstr "" "在轉譯當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:676 +#: ../../library/exceptions.rst:678 msgid "" "Raised when an operation or function receives an argument that has the right " "type but an inappropriate value, and the situation is not described by a " @@ -1028,7 +1030,7 @@ msgstr "" "當一個操作或函式收到引數是正確型別但是不適合的值,且該情況無法被更精確的例外" "例如 :exc:`IndexError` 所描述時會引發此例外。" -#: ../../library/exceptions.rst:683 +#: ../../library/exceptions.rst:685 msgid "" "Raised when the second argument of a division or modulo operation is zero. " "The associated value is a string indicating the type of the operands and the " @@ -1037,7 +1039,7 @@ msgstr "" "當除法或模數運算 (modulo operation) 的第二個引數是 0 的時候會引發此例外。關聯" "值是一個字串,表示運算元及運算的類型。" -#: ../../library/exceptions.rst:688 +#: ../../library/exceptions.rst:690 msgid "" "The following exceptions are kept for compatibility with previous versions; " "starting from Python 3.3, they are aliases of :exc:`OSError`." @@ -1045,21 +1047,21 @@ msgstr "" "以下例外是為了相容於之前版本而保留;從 Python 3.3 開始,它們" "是 :exc:`OSError` 的別名。" -#: ../../library/exceptions.rst:697 +#: ../../library/exceptions.rst:699 msgid "Only available on Windows." msgstr "僅限於在 Windows 中使用。" -#: ../../library/exceptions.rst:701 +#: ../../library/exceptions.rst:703 msgid "OS exceptions" msgstr "作業系統例外" -#: ../../library/exceptions.rst:703 +#: ../../library/exceptions.rst:705 msgid "" "The following exceptions are subclasses of :exc:`OSError`, they get raised " "depending on the system error code." msgstr "以下的例外是 :exc:`OSError` 的子類別,它們根據系統錯誤代碼來引發。" -#: ../../library/exceptions.rst:708 +#: ../../library/exceptions.rst:710 msgid "" "Raised when an operation would block on an object (e.g. socket) set for non-" "blocking operation. Corresponds " @@ -1070,14 +1072,14 @@ msgstr "" "到 :c:data:`errno` :py:const:`~errno.EAGAIN`、:py:const:`~errno.EALREADY`、:py:const:`~errno.EWOULDBLOCK` " "及 :py:const:`~errno.EINPROGRESS`。" -#: ../../library/exceptions.rst:713 +#: ../../library/exceptions.rst:715 msgid "" "In addition to those of :exc:`OSError`, :exc:`BlockingIOError` can have one " "more attribute:" msgstr "" "除了 :exc:`OSError` 的那些屬性之外,:exc:`BlockingIOError` 有多一個屬性:" -#: ../../library/exceptions.rst:718 +#: ../../library/exceptions.rst:720 msgid "" "An integer containing the number of characters written to the stream before " "it blocked. This attribute is available when using the buffered I/O classes " @@ -1086,7 +1088,7 @@ msgstr "" "一個整數,內容為在其阻塞之前,已寫進串流的字元數。當使用 :mod:`io` 模組裡的緩" "衝 I/O 類別時這個屬性是可用的。" -#: ../../library/exceptions.rst:724 +#: ../../library/exceptions.rst:726 msgid "" "Raised when an operation on a child process failed. Corresponds " "to :c:data:`errno` :py:const:`~errno.ECHILD`." @@ -1094,11 +1096,11 @@ msgstr "" "當子行程上的操作失敗時會引發此例外。對應" "到 :c:data:`errno` :py:const:`~errno.ECHILD`。" -#: ../../library/exceptions.rst:729 +#: ../../library/exceptions.rst:731 msgid "A base class for connection-related issues." msgstr "連線相關問題的基礎類別。" -#: ../../library/exceptions.rst:731 +#: ../../library/exceptions.rst:733 msgid "" "Subclasses " "are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:`ConnectionRefusedError` " @@ -1108,7 +1110,7 @@ msgstr "" "有 :exc:`BrokenPipeError`、:exc:`ConnectionAbortedError`、:exc:`ConnectionRefusedError` " "及 :exc:`ConnectionResetError`。" -#: ../../library/exceptions.rst:736 +#: ../../library/exceptions.rst:738 msgid "" "A subclass of :exc:`ConnectionError`, raised when trying to write on a pipe " "while the other end has been closed, or trying to write on a socket which " @@ -1119,7 +1121,7 @@ msgstr "" "會引發此例外,或者當嘗試寫入已關閉寫入的 socket 時也會引發。對應" "到 :c:data:`errno` :py:const:`~errno.EPIPE` 及 :py:const:`~errno.ESHUTDOWN`。" -#: ../../library/exceptions.rst:743 +#: ../../library/exceptions.rst:745 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " "aborted by the peer. Corresponds " @@ -1128,7 +1130,7 @@ msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線的嘗試被對等端點 (peer) 中斷時會引" "發此例外。對應到 :c:data:`errno` :py:const:`~errno.ECONNABORTED`。" -#: ../../library/exceptions.rst:749 +#: ../../library/exceptions.rst:751 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " "refused by the peer. Corresponds " @@ -1137,7 +1139,7 @@ msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線的嘗試被對等端點拒絕時會引發此例" "外。對應到 :c:data:`errno` :py:const:`~errno.ECONNREFUSED`。" -#: ../../library/exceptions.rst:755 +#: ../../library/exceptions.rst:757 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection is reset by " "the peer. Corresponds to :c:data:`errno` :py:const:`~errno.ECONNRESET`." @@ -1145,7 +1147,7 @@ msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線被對等端點重置時會引發此例外。對應" "到 :c:data:`errno` :py:const:`~errno.ECONNRESET`。" -#: ../../library/exceptions.rst:761 +#: ../../library/exceptions.rst:763 msgid "" "Raised when trying to create a file or directory which already exists. " "Corresponds to :c:data:`errno` :py:const:`~errno.EEXIST`." @@ -1153,7 +1155,7 @@ msgstr "" "當嘗試建立已存在的檔案或目錄時會引發此例外。對應" "到 :c:data:`errno` :py:const:`~errno.EEXIST`。" -#: ../../library/exceptions.rst:766 +#: ../../library/exceptions.rst:768 msgid "" "Raised when a file or directory is requested but doesn't exist. Corresponds " "to :c:data:`errno` :py:const:`~errno.ENOENT`." @@ -1161,7 +1163,7 @@ msgstr "" "當請求不存在的檔案或目錄時會引發此例外。對應" "到 :c:data:`errno` :py:const:`~errno.ENOENT`。" -#: ../../library/exceptions.rst:771 +#: ../../library/exceptions.rst:773 msgid "" "Raised when a system call is interrupted by an incoming signal. Corresponds " "to :c:data:`errno` :py:const:`~errno.EINTR`." @@ -1169,7 +1171,7 @@ msgstr "" "當系統呼叫被傳入的信號中斷時會引發此例外。對應" "到 :c:data:`errno` :py:const:`~errno.EINTR`。" -#: ../../library/exceptions.rst:774 +#: ../../library/exceptions.rst:776 msgid "" "Python now retries system calls when a syscall is interrupted by a signal, " "except if the signal handler raises an exception (see :pep:`475` for the " @@ -1178,7 +1180,7 @@ msgstr "" "現在當 syscall 被信號中斷時 Python 會重試系統呼叫而不會引" "發 :exc:`InterruptedError`,除非信號處理器引發例外(理由可參考 :pep:`475`)。" -#: ../../library/exceptions.rst:781 +#: ../../library/exceptions.rst:783 msgid "" "Raised when a file operation (such as :func:`os.remove`) is requested on a " "directory. Corresponds to :c:data:`errno` :py:const:`~errno.EISDIR`." @@ -1186,7 +1188,7 @@ msgstr "" "當在目錄上請求檔案操作(例如 :func:`os.remove`)時會引發此例外。對應" "到 :c:data:`errno` :py:const:`~errno.EISDIR`。" -#: ../../library/exceptions.rst:787 +#: ../../library/exceptions.rst:789 msgid "" "Raised when a directory operation (such as :func:`os.listdir`) is requested " "on something which is not a directory. On most POSIX platforms, it may also " @@ -1198,7 +1200,7 @@ msgstr "" "外。在大多數的 POSIX 平台上,如果嘗試操作開啟或遍歷一個當作目錄的非目錄檔案也" "會引發此例外。對應到 :c:data:`errno` :py:const:`~errno.ENOTDIR`。" -#: ../../library/exceptions.rst:795 +#: ../../library/exceptions.rst:797 msgid "" "Raised when trying to run an operation without the adequate access rights - " "for example filesystem permissions. Corresponds " @@ -1209,14 +1211,14 @@ msgstr "" "到 :c:data:`errno` :py:const:`~errno.EACCES`、:py:const:`~errno.EPERM` " "及 :py:const:`~errno.ENOTCAPABLE`。" -#: ../../library/exceptions.rst:800 +#: ../../library/exceptions.rst:802 msgid "" "WASI's :py:const:`~errno.ENOTCAPABLE` is now mapped " "to :exc:`PermissionError`." msgstr "" "WASI 的 :py:const:`~errno.ENOTCAPABLE` 現在對應到 :exc:`PermissionError`。" -#: ../../library/exceptions.rst:806 +#: ../../library/exceptions.rst:808 msgid "" "Raised when a given process doesn't exist. Corresponds " "to :c:data:`errno` :py:const:`~errno.ESRCH`." @@ -1224,7 +1226,7 @@ msgstr "" "當給定的行程不存在時會引發此例外。對應" "到 :c:data:`errno` :py:const:`~errno.ESRCH`。" -#: ../../library/exceptions.rst:811 +#: ../../library/exceptions.rst:813 msgid "" "Raised when a system function timed out at the system level. Corresponds " "to :c:data:`errno` :py:const:`~errno.ETIMEDOUT`." @@ -1232,40 +1234,40 @@ msgstr "" "當系統函式在系統層級超時會引發此例外。對應" "到 :c:data:`errno` :py:const:`~errno.ETIMEDOUT`。" -#: ../../library/exceptions.rst:814 +#: ../../library/exceptions.rst:816 msgid "All the above :exc:`OSError` subclasses were added." msgstr "加入以上所有的 :exc:`OSError` 子類別。" -#: ../../library/exceptions.rst:820 +#: ../../library/exceptions.rst:822 msgid ":pep:`3151` - Reworking the OS and IO exception hierarchy" msgstr ":pep:`3151` — 改寫作業系統與 IO 例外階層" -#: ../../library/exceptions.rst:826 +#: ../../library/exceptions.rst:828 msgid "Warnings" msgstr "警告" -#: ../../library/exceptions.rst:828 +#: ../../library/exceptions.rst:830 msgid "" "The following exceptions are used as warning categories; see " "the :ref:`warning-categories` documentation for more details." msgstr "" "以下的例外是當作警告的種類使用;更多細節參考 :ref:`warning-categories` 文件。" -#: ../../library/exceptions.rst:833 +#: ../../library/exceptions.rst:835 msgid "Base class for warning categories." msgstr "警告種類的基礎類別。" -#: ../../library/exceptions.rst:838 +#: ../../library/exceptions.rst:840 msgid "Base class for warnings generated by user code." msgstr "使用者程式碼產生的警告的基礎類別。" -#: ../../library/exceptions.rst:843 +#: ../../library/exceptions.rst:845 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for other Python developers." msgstr "關於已棄用功能的警告的基礎類別,且當那些警告是針對其他 Python 開發者。" -#: ../../library/exceptions.rst:846 +#: ../../library/exceptions.rst:848 msgid "" "Ignored by the default warning filters, except in the ``__main__`` module " "(:pep:`565`). Enabling the :ref:`Python Development Mode ` shows " @@ -1274,17 +1276,17 @@ msgstr "" "會被預設的警告過濾器忽略,在 ``__main__`` 模組裡除外 (:pep:`565`)。啟" "用 :ref:`Python 開發模式 `\\ 會顯示此警告。" -#: ../../library/exceptions.rst:850 ../../library/exceptions.rst:866 +#: ../../library/exceptions.rst:852 ../../library/exceptions.rst:868 msgid "The deprecation policy is described in :pep:`387`." msgstr "棄用原則描述在 :pep:`387` 裡。" -#: ../../library/exceptions.rst:855 +#: ../../library/exceptions.rst:857 msgid "" "Base class for warnings about features which are obsolete and expected to be " "deprecated in the future, but are not deprecated at the moment." msgstr "關於過時且預期未來要被棄用,但目前尚未被棄用的功能的警告的基礎類別。" -#: ../../library/exceptions.rst:859 +#: ../../library/exceptions.rst:861 msgid "" "This class is rarely used as emitting a warning about a possible upcoming " "deprecation is unusual, and :exc:`DeprecationWarning` is preferred for " @@ -1293,8 +1295,8 @@ msgstr "" "因為發出關於可能即將被棄用的警告是不尋常的,此類別很少被使用,而對已經被棄用" "的情況會優先使用 :exc:`DeprecationWarning`。" -#: ../../library/exceptions.rst:863 ../../library/exceptions.rst:889 -#: ../../library/exceptions.rst:916 +#: ../../library/exceptions.rst:865 ../../library/exceptions.rst:891 +#: ../../library/exceptions.rst:918 msgid "" "Ignored by the default warning filters. Enabling the :ref:`Python " "Development Mode ` shows this warning." @@ -1302,15 +1304,15 @@ msgstr "" "會被預設的警告過濾器忽略。啟用 :ref:`Python 開發模式 `\\ 會顯示此警" "告。" -#: ../../library/exceptions.rst:871 +#: ../../library/exceptions.rst:873 msgid "Base class for warnings about dubious syntax." msgstr "關於可疑語法的警告的基礎類別。" -#: ../../library/exceptions.rst:876 +#: ../../library/exceptions.rst:878 msgid "Base class for warnings about dubious runtime behavior." msgstr "關於可疑執行環境行為的警告的基礎類別。" -#: ../../library/exceptions.rst:881 +#: ../../library/exceptions.rst:883 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for end users of applications that are written in Python." @@ -1318,36 +1320,36 @@ msgstr "" "關於已棄用功能的警告的基礎類別,且當那些警告是針對以 Python 寫的應用程式的終" "端使用者。" -#: ../../library/exceptions.rst:887 +#: ../../library/exceptions.rst:889 msgid "Base class for warnings about probable mistakes in module imports." msgstr "關於在模組引入的可能錯誤的警告的基礎類別。" -#: ../../library/exceptions.rst:895 +#: ../../library/exceptions.rst:897 msgid "Base class for warnings related to Unicode." msgstr "Unicode 相關警告的基礎類別。" -#: ../../library/exceptions.rst:900 +#: ../../library/exceptions.rst:902 msgid "Base class for warnings related to encodings." msgstr "編碼相關警告的基礎類別。" -#: ../../library/exceptions.rst:902 +#: ../../library/exceptions.rst:904 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節參考\\ :ref:`io-encoding-warning`。" -#: ../../library/exceptions.rst:909 +#: ../../library/exceptions.rst:911 msgid "" "Base class for warnings related to :class:`bytes` and :class:`bytearray`." msgstr ":class:`bytes` 及 :class:`bytearray` 相關警告的基礎類別。" -#: ../../library/exceptions.rst:914 +#: ../../library/exceptions.rst:916 msgid "Base class for warnings related to resource usage." msgstr "資源用法相關警告的基礎類別。" -#: ../../library/exceptions.rst:925 +#: ../../library/exceptions.rst:927 msgid "Exception groups" msgstr "例外群組" -#: ../../library/exceptions.rst:927 +#: ../../library/exceptions.rst:929 msgid "" "The following are used when it is necessary to raise multiple unrelated " "exceptions. They are part of the exception hierarchy so they can be handled " @@ -1359,7 +1361,7 @@ msgstr "" "所有其他例外一樣使用 :keyword:`except` 來處理。此外,它們會以包含的例外型別為" "基礎來比對其子群組而被 :keyword:`except*` 辨認出來。" -#: ../../library/exceptions.rst:936 +#: ../../library/exceptions.rst:938 msgid "" "Both of these exception types wrap the exceptions in the sequence ``excs``. " "The ``msg`` parameter must be a string. The difference between the two " @@ -1375,7 +1377,7 @@ msgstr "" "裝 :exc:`Exception` 的子類別。這個設計使得 ``except Exception`` 可以捕" "捉 :exc:`ExceptionGroup` 但不能捕捉 :exc:`BaseExceptionGroup`。" -#: ../../library/exceptions.rst:944 +#: ../../library/exceptions.rst:946 msgid "" "The :exc:`BaseExceptionGroup` constructor returns an :exc:`ExceptionGroup` " "rather than a :exc:`BaseExceptionGroup` if all contained exceptions " @@ -1390,17 +1392,17 @@ msgstr "" "是 :exc:`Exception` 的子類別,:exc:`ExceptionGroup` 建構函式會引" "發 :exc:`TypeError`。" -#: ../../library/exceptions.rst:953 +#: ../../library/exceptions.rst:955 msgid "The ``msg`` argument to the constructor. This is a read-only attribute." msgstr "建構函式的 ``msg`` 引數。這是一個唯讀的屬性。" -#: ../../library/exceptions.rst:957 +#: ../../library/exceptions.rst:959 msgid "" "A tuple of the exceptions in the ``excs`` sequence given to the constructor. " "This is a read-only attribute." msgstr "指定給建構函式 ``excs`` 序列中的例外組成的元組。這是一個唯讀的屬性。" -#: ../../library/exceptions.rst:962 +#: ../../library/exceptions.rst:964 msgid "" "Returns an exception group that contains only the exceptions from the " "current group that match *condition*, or ``None`` if the result is empty." @@ -1408,7 +1410,7 @@ msgstr "" "回傳只包含從現有群組比對到 *condition* 的例外的例外群組,或者當結果為空時回" "傳 ``None``。" -#: ../../library/exceptions.rst:965 +#: ../../library/exceptions.rst:967 msgid "" "The condition can be an exception type or tuple of exception types, in which " "case each exception is checked for a match using the same check that is used " @@ -1421,7 +1423,7 @@ msgstr "" "物件(除了型別物件之外),其接受一個例外作為單一引數,而如果該例外應該在子群" "組中就回傳 true。" -#: ../../library/exceptions.rst:971 +#: ../../library/exceptions.rst:973 msgid "" "The nesting structure of the current exception is preserved in the result, " "as are the values of " @@ -1434,7 +1436,7 @@ msgstr "" "及 :attr:`~BaseException.__notes__` 欄位的值也一樣。空的巢狀群組會從結果裡排" "除。" -#: ../../library/exceptions.rst:978 +#: ../../library/exceptions.rst:980 msgid "" "The condition is checked for all exceptions in the nested exception group, " "including the top-level and any nested exception groups. If the condition is " @@ -1443,11 +1445,11 @@ msgstr "" "條件會對巢狀例外群組裡的所有例外做檢查,包括頂層及任何巢狀的例外群組。如果條" "件對這樣的例外群組為 true,它會被完整包含在結果裡。" -#: ../../library/exceptions.rst:982 +#: ../../library/exceptions.rst:984 msgid "``condition`` can be any callable which is not a type object." msgstr "``condition`` 可以是任何不是型別物件的可呼叫物件。" -#: ../../library/exceptions.rst:987 +#: ../../library/exceptions.rst:989 msgid "" "Like :meth:`subgroup`, but returns the pair ``(match, rest)`` where " "``match`` is ``subgroup(condition)`` and ``rest`` is the remaining non-" @@ -1456,13 +1458,13 @@ msgstr "" "像 :meth:`subgroup` 一樣,但回傳一對 ``(match, rest)``,其中 ``match`` 是 " "``subgroup(condition)`` 而 ``rest`` 是剩下沒有比對到的部分。" -#: ../../library/exceptions.rst:993 +#: ../../library/exceptions.rst:995 msgid "" "Returns an exception group with the same :attr:`message`, but which wraps " "the exceptions in ``excs``." msgstr "回傳有相同 :attr:`message` 但將例外包裝在 ``excs`` 的例外群組。" -#: ../../library/exceptions.rst:996 +#: ../../library/exceptions.rst:998 msgid "" "This method is used by :meth:`subgroup` and :meth:`split`, which are used in " "various contexts to break up an exception group. A subclass needs to " @@ -1473,7 +1475,7 @@ msgstr "" "組。子類別需要覆寫它來讓 :meth:`subgroup` 及 :meth:`split` 回傳子類別而不" "是 :exc:`ExceptionGroup` 的實例。" -#: ../../library/exceptions.rst:1002 +#: ../../library/exceptions.rst:1004 msgid "" ":meth:`subgroup` and :meth:`split` copy " "the :attr:`~BaseException.__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException.__context__` " @@ -1486,7 +1488,7 @@ msgstr "" "和 :attr:`~BaseException.__notes__` 欄位到 :meth:`derive` 所回傳的例外群組" "上,因此這些欄位不需要被 :meth:`derive` 更新。" -#: ../../library/exceptions.rst:1009 +#: ../../library/exceptions.rst:1011 msgid "" ">>> class MyGroup(ExceptionGroup):\n" "... def derive(self, excs):\n" @@ -1540,7 +1542,7 @@ msgstr "" ">>> exc.__traceback__ is match.__traceback__ is rest.__traceback__\n" "True" -#: ../../library/exceptions.rst:1035 +#: ../../library/exceptions.rst:1037 msgid "" "Note that :exc:`BaseExceptionGroup` defines :meth:`~object.__new__`, so " "subclasses that need a different constructor signature need to override that " @@ -1552,7 +1554,7 @@ msgstr "" "建構函式簽名的子類別需要覆寫它而不是 :meth:`~object.__init__`。例如下面定義了" "一個例外群組子類別接受 exit_code 並從中建構群組的訊息。: ::" -#: ../../library/exceptions.rst:1041 +#: ../../library/exceptions.rst:1043 msgid "" "class Errors(ExceptionGroup):\n" " def __new__(cls, errors, exit_code):\n" @@ -1572,7 +1574,7 @@ msgstr "" " def derive(self, excs):\n" " return Errors(excs, self.exit_code)" -#: ../../library/exceptions.rst:1050 +#: ../../library/exceptions.rst:1052 msgid "" "Like :exc:`ExceptionGroup`, any subclass of :exc:`BaseExceptionGroup` which " "is also a subclass of :exc:`Exception` can only wrap instances " @@ -1581,15 +1583,15 @@ msgstr "" "像 :exc:`ExceptionGroup` 一樣,任何 :exc:`BaseExceptionGroup` 的子類別且也" "是 :exc:`Exception` 的子類別只能包裝 :exc:`Exception` 的實例。" -#: ../../library/exceptions.rst:1058 +#: ../../library/exceptions.rst:1060 msgid "Exception hierarchy" msgstr "例外階層" -#: ../../library/exceptions.rst:1060 +#: ../../library/exceptions.rst:1062 msgid "The class hierarchy for built-in exceptions is:" msgstr "內建例外的類別階層如下:" -#: ../../library/exceptions.rst:1062 +#: ../../library/exceptions.rst:1064 msgid "" "BaseException\n" " ├── BaseExceptionGroup\n" @@ -1770,10 +1772,10 @@ msgstr "__suppress_context__(例外屬性)" msgid "assert" msgstr "assert" -#: ../../library/exceptions.rst:345 +#: ../../library/exceptions.rst:347 msgid "module" msgstr "module(模組)" -#: ../../library/exceptions.rst:345 +#: ../../library/exceptions.rst:347 msgid "errno" msgstr "errno" diff --git a/library/fcntl.po b/library/fcntl.po index a806871acf..69d45662a5 100644 --- a/library/fcntl.po +++ b/library/fcntl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-04-24 05:58+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -118,24 +118,43 @@ msgid "" "a :meth:`~io.IOBase.fileno` method are accepted as well). The values used " "for *cmd* are operating system dependent, and are available as constants in " "the :mod:`fcntl` module, using the same names as used in the relevant C " -"header files. The argument *arg* can either be an integer value, or a :class:" -"`bytes` object. With an integer value, the return value of this function is " -"the integer return value of the C :c:func:`fcntl` call. When the argument " -"is bytes it represents a binary structure, e.g. created by :func:`struct." -"pack`. The binary data is copied to a buffer whose address is passed to the " -"C :c:func:`fcntl` call. The return value after a successful call is the " -"contents of the buffer, converted to a :class:`bytes` object. The length of " -"the returned object will be the same as the length of the *arg* argument. " -"This is limited to 1024 bytes. If the information returned in the buffer by " -"the operating system is larger than 1024 bytes, this is most likely to " -"result in a segmentation violation or a more subtle data corruption." -msgstr "" - -#: ../../library/fcntl.rst:104 +"header files. The argument *arg* can either be an integer value, a :class:" +"`bytes` object, or a string. The type and size of *arg* must match the type " +"and size of the argument of the operation as specified in the relevant C " +"documentation." +msgstr "" + +#: ../../library/fcntl.rst:96 +msgid "" +"When *arg* is an integer, the function returns the integer return value of " +"the C :c:func:`fcntl` call." +msgstr "" + +#: ../../library/fcntl.rst:99 +msgid "" +"When the argument is bytes, it represents a binary structure, for example, " +"created by :func:`struct.pack`. A string value is encoded to binary using " +"the UTF-8 encoding. The binary data is copied to a buffer whose address is " +"passed to the C :c:func:`fcntl` call. The return value after a successful " +"call is the contents of the buffer, converted to a :class:`bytes` object. " +"The length of the returned object will be the same as the length of the " +"*arg* argument. This is limited to 1024 bytes." +msgstr "" + +#: ../../library/fcntl.rst:108 msgid "If the :c:func:`fcntl` call fails, an :exc:`OSError` is raised." msgstr "" -#: ../../library/fcntl.rst:106 +#: ../../library/fcntl.rst:111 +msgid "" +"If the type or the size of *arg* does not match the type or size of the " +"argument of the operation (for example, if an integer is passed when a " +"pointer is expected, or the information returned in the buffer by the " +"operating system is larger than 1024 bytes), this is most likely to result " +"in a segmentation violation or a more subtle data corruption." +msgstr "" + +#: ../../library/fcntl.rst:118 msgid "" "Raises an :ref:`auditing event ` ``fcntl.fcntl`` with arguments " "``fd``, ``cmd``, ``arg``." @@ -143,68 +162,65 @@ msgstr "" "引發一個附帶引數 ``fd``、``cmd``、``arg`` 的\\ :ref:`稽核事件 ` " "``fcntl.fcntl``。" -#: ../../library/fcntl.rst:111 +#: ../../library/fcntl.rst:123 msgid "" "This function is identical to the :func:`~fcntl.fcntl` function, except that " "the argument handling is even more complicated." msgstr "" -#: ../../library/fcntl.rst:114 -msgid "" -"The *request* parameter is limited to values that can fit in 32-bits. " -"Additional constants of interest for use as the *request* argument can be " -"found in the :mod:`termios` module, under the same names as used in the " -"relevant C header files." -msgstr "" - -#: ../../library/fcntl.rst:119 +#: ../../library/fcntl.rst:126 msgid "" -"The parameter *arg* can be one of an integer, an object supporting the read-" -"only buffer interface (like :class:`bytes`) or an object supporting the read-" -"write buffer interface (like :class:`bytearray`)." +"The *request* parameter is limited to values that can fit in 32-bits or 64-" +"bits, depending on the platform. Additional constants of interest for use as " +"the *request* argument can be found in the :mod:`termios` module, under the " +"same names as used in the relevant C header files." msgstr "" -#: ../../library/fcntl.rst:123 +#: ../../library/fcntl.rst:132 msgid "" -"In all but the last case, behaviour is as for the :func:`~fcntl.fcntl` " -"function." +"The parameter *arg* can be an integer, a :term:`bytes-like object`, or a " +"string. The type and size of *arg* must match the type and size of the " +"argument of the operation as specified in the relevant C documentation." msgstr "" -#: ../../library/fcntl.rst:126 +#: ../../library/fcntl.rst:137 msgid "" -"If a mutable buffer is passed, then the behaviour is determined by the value " -"of the *mutate_flag* parameter." +"If *arg* does not support the read-write buffer interface or the " +"*mutate_flag* is false, behavior is as for the :func:`~fcntl.fcntl` function." msgstr "" -#: ../../library/fcntl.rst:129 +#: ../../library/fcntl.rst:141 msgid "" -"If it is false, the buffer's mutability is ignored and behaviour is as for a " -"read-only buffer, except that the 1024 byte limit mentioned above is avoided " -"-- so long as the buffer you pass is at least as long as what the operating " -"system wants to put there, things should work." +"If *arg* supports the read-write buffer interface (like :class:`bytearray`) " +"and *mutate_flag* is true (the default), then the buffer is (in effect) " +"passed to the underlying :c:func:`!ioctl` system call, the latter's return " +"code is passed back to the calling Python, and the buffer's new contents " +"reflect the action of the :c:func:`ioctl`. This is a slight simplification, " +"because if the supplied buffer is less than 1024 bytes long it is first " +"copied into a static buffer 1024 bytes long which is then passed to :func:" +"`ioctl` and copied back into the supplied buffer." msgstr "" -#: ../../library/fcntl.rst:134 +#: ../../library/fcntl.rst:150 msgid "" -"If *mutate_flag* is true (the default), then the buffer is (in effect) " -"passed to the underlying :func:`ioctl` system call, the latter's return code " -"is passed back to the calling Python, and the buffer's new contents reflect " -"the action of the :func:`ioctl`. This is a slight simplification, because " -"if the supplied buffer is less than 1024 bytes long it is first copied into " -"a static buffer 1024 bytes long which is then passed to :func:`ioctl` and " -"copied back into the supplied buffer." +"If the :c:func:`ioctl` call fails, an :exc:`OSError` exception is raised." msgstr "" -#: ../../library/fcntl.rst:142 +#: ../../library/fcntl.rst:153 msgid "" -"If the :c:func:`ioctl` call fails, an :exc:`OSError` exception is raised." +"If the type or size of *arg* does not match the type or size of the " +"operation's argument (for example, if an integer is passed when a pointer is " +"expected, or the information returned in the buffer by the operating system " +"is larger than 1024 bytes, or the size of the mutable bytes-like object is " +"too small), this is most likely to result in a segmentation violation or a " +"more subtle data corruption." msgstr "" -#: ../../library/fcntl.rst:144 +#: ../../library/fcntl.rst:161 msgid "An example::" msgstr "範例: ::" -#: ../../library/fcntl.rst:146 +#: ../../library/fcntl.rst:163 msgid "" ">>> import array, fcntl, struct, termios, os\n" ">>> os.getpgrp()\n" @@ -228,7 +244,7 @@ msgstr "" ">>> buf\n" "array('h', [13341])" -#: ../../library/fcntl.rst:157 +#: ../../library/fcntl.rst:174 msgid "" "Raises an :ref:`auditing event ` ``fcntl.ioctl`` with arguments " "``fd``, ``request``, ``arg``." @@ -236,7 +252,7 @@ msgstr "" "引發一個附帶引數 ``fd``、``request``、``arg`` 的\\ :ref:`稽核事件 " "` ``fcntl.ioctl``。" -#: ../../library/fcntl.rst:162 +#: ../../library/fcntl.rst:179 msgid "" "Perform the lock operation *operation* on file descriptor *fd* (file objects " "providing a :meth:`~io.IOBase.fileno` method are accepted as well). See the " @@ -244,12 +260,12 @@ msgid "" "function is emulated using :c:func:`fcntl`.)" msgstr "" -#: ../../library/fcntl.rst:167 +#: ../../library/fcntl.rst:184 msgid "" "If the :c:func:`flock` call fails, an :exc:`OSError` exception is raised." msgstr "" -#: ../../library/fcntl.rst:169 +#: ../../library/fcntl.rst:186 msgid "" "Raises an :ref:`auditing event ` ``fcntl.flock`` with arguments " "``fd``, ``operation``." @@ -257,7 +273,7 @@ msgstr "" "引發一個附帶引數 ``fd``、``operation`` 的\\ :ref:`稽核事件 ` " "``fcntl.flock``。" -#: ../../library/fcntl.rst:174 +#: ../../library/fcntl.rst:191 msgid "" "This is essentially a wrapper around the :func:`~fcntl.fcntl` locking calls. " "*fd* is the file descriptor (file objects providing a :meth:`~io.IOBase." @@ -265,25 +281,25 @@ msgid "" "*cmd* is one of the following values:" msgstr "" -#: ../../library/fcntl.rst:181 +#: ../../library/fcntl.rst:198 msgid "Release an existing lock." msgstr "" -#: ../../library/fcntl.rst:185 +#: ../../library/fcntl.rst:202 msgid "Acquire a shared lock." msgstr "" -#: ../../library/fcntl.rst:189 +#: ../../library/fcntl.rst:206 msgid "Acquire an exclusive lock." msgstr "" -#: ../../library/fcntl.rst:193 +#: ../../library/fcntl.rst:210 msgid "" "Bitwise OR with any of the other three ``LOCK_*`` constants to make the " "request non-blocking." msgstr "" -#: ../../library/fcntl.rst:196 +#: ../../library/fcntl.rst:213 msgid "" "If :const:`!LOCK_NB` is used and the lock cannot be acquired, an :exc:" "`OSError` will be raised and the exception will have an *errno* attribute " @@ -293,33 +309,33 @@ msgid "" "a file opened for writing." msgstr "" -#: ../../library/fcntl.rst:203 +#: ../../library/fcntl.rst:220 msgid "" "*len* is the number of bytes to lock, *start* is the byte offset at which " "the lock starts, relative to *whence*, and *whence* is as with :func:`io." "IOBase.seek`, specifically:" msgstr "" -#: ../../library/fcntl.rst:207 +#: ../../library/fcntl.rst:224 msgid "``0`` -- relative to the start of the file (:const:`os.SEEK_SET`)" msgstr "" -#: ../../library/fcntl.rst:208 +#: ../../library/fcntl.rst:225 msgid "``1`` -- relative to the current buffer position (:const:`os.SEEK_CUR`)" msgstr "" -#: ../../library/fcntl.rst:209 +#: ../../library/fcntl.rst:226 msgid "``2`` -- relative to the end of the file (:const:`os.SEEK_END`)" msgstr "" -#: ../../library/fcntl.rst:211 +#: ../../library/fcntl.rst:228 msgid "" "The default for *start* is 0, which means to start at the beginning of the " "file. The default for *len* is 0 which means to lock to the end of the " "file. The default for *whence* is also 0." msgstr "" -#: ../../library/fcntl.rst:215 +#: ../../library/fcntl.rst:232 msgid "" "Raises an :ref:`auditing event ` ``fcntl.lockf`` with arguments " "``fd``, ``cmd``, ``len``, ``start``, ``whence``." @@ -327,11 +343,11 @@ msgstr "" "引發一個附帶引數 ``fd``、``cmd``、``len``、``start``、``whence`` 的\\ :ref:`" "稽核事件 ` ``fcntl.lockf``。" -#: ../../library/fcntl.rst:217 +#: ../../library/fcntl.rst:234 msgid "Examples (all on a SVR4 compliant system)::" msgstr "" -#: ../../library/fcntl.rst:219 +#: ../../library/fcntl.rst:236 msgid "" "import struct, fcntl, os\n" "\n" @@ -349,7 +365,7 @@ msgstr "" "lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0)\n" "rv = fcntl.fcntl(f, fcntl.F_SETLKW, lockdata)" -#: ../../library/fcntl.rst:227 +#: ../../library/fcntl.rst:244 msgid "" "Note that in the first example the return value variable *rv* will hold an " "integer value; in the second example it will hold a :class:`bytes` object. " @@ -357,11 +373,11 @@ msgid "" "therefore using the :func:`flock` call may be better." msgstr "" -#: ../../library/fcntl.rst:235 +#: ../../library/fcntl.rst:252 msgid "Module :mod:`os`" msgstr ":mod:`os` 模組" -#: ../../library/fcntl.rst:236 +#: ../../library/fcntl.rst:253 msgid "" "If the locking flags :const:`~os.O_SHLOCK` and :const:`~os.O_EXLOCK` are " "present in the :mod:`os` module (on BSD only), the :func:`os.open` function " diff --git a/library/filecmp.po b/library/filecmp.po index ca8839f45d..350f3717b1 100644 --- a/library/filecmp.po +++ b/library/filecmp.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -87,8 +87,8 @@ msgstr "" #: ../../library/filecmp.rst:51 msgid "" -"The *shallow* parameter has the same meaning and default value as for :func:" -"`filecmp.cmp`." +"The *shallow* parameter has the same meaning and default value as " +"for :func:`filecmp.cmp`." msgstr "" #: ../../library/filecmp.rst:54 @@ -112,9 +112,9 @@ msgstr "" #: ../../library/filecmp.rst:75 msgid "" "Construct a new directory comparison object, to compare the directories *a* " -"and *b*. *ignore* is a list of names to ignore, and defaults to :const:" -"`filecmp.DEFAULT_IGNORES`. *hide* is a list of names to hide, and defaults " -"to ``[os.curdir, os.pardir]``." +"and *b*. *ignore* is a list of names to ignore, and defaults " +"to :const:`filecmp.DEFAULT_IGNORES`. *hide* is a list of names to hide, and " +"defaults to ``[os.curdir, os.pardir]``." msgstr "" #: ../../library/filecmp.rst:80 @@ -251,8 +251,8 @@ msgid "" "... for sub_dcmp in dcmp.subdirs.values():\n" "... print_diff_files(sub_dcmp)\n" "...\n" -">>> dcmp = dircmp('dir1', 'dir2') \n" -">>> print_diff_files(dcmp) " +">>> dcmp = dircmp('dir1', 'dir2')\n" +">>> print_diff_files(dcmp)" msgstr "" ">>> from filecmp import dircmp\n" ">>> def print_diff_files(dcmp):\n" @@ -262,5 +262,5 @@ msgstr "" "... for sub_dcmp in dcmp.subdirs.values():\n" "... print_diff_files(sub_dcmp)\n" "...\n" -">>> dcmp = dircmp('dir1', 'dir2') \n" -">>> print_diff_files(dcmp) " +">>> dcmp = dircmp('dir1', 'dir2')\n" +">>> print_diff_files(dcmp)" diff --git a/library/fractions.po b/library/fractions.po index 0bed2f807a..19f4409273 100644 --- a/library/fractions.po +++ b/library/fractions.po @@ -43,13 +43,13 @@ msgid "" "of :class:`numbers.Rational` and returns a new :class:`Fraction` instance " "with value ``numerator/denominator``. If *denominator* is ``0``, it raises " "a :exc:`ZeroDivisionError`. The second version requires that " -"*other_fraction* is an instance of :class:`numbers.Rational` and returns a :" -"class:`Fraction` instance with the same value. The next two versions accept " -"either a :class:`float` or a :class:`decimal.Decimal` instance, and return " -"a :class:`Fraction` instance with exactly the same value. Note that due to " -"the usual issues with binary floating point (see :ref:`tut-fp-issues`), the " -"argument to ``Fraction(1.1)`` is not exactly equal to 11/10, and so " -"``Fraction(1.1)`` does *not* return ``Fraction(11, 10)`` as one might " +"*other_fraction* is an instance of :class:`numbers.Rational` and returns " +"a :class:`Fraction` instance with the same value. The next two versions " +"accept either a :class:`float` or a :class:`decimal.Decimal` instance, and " +"return a :class:`Fraction` instance with exactly the same value. Note that " +"due to the usual issues with binary floating point (see :ref:`tut-fp-" +"issues`), the argument to ``Fraction(1.1)`` is not exactly equal to 11/10, " +"and so ``Fraction(1.1)`` does *not* return ``Fraction(11, 10)`` as one might " "expect. (But see the documentation for the :meth:`limit_denominator` method " "below.) The last version of the constructor expects a string or unicode " "instance. The usual form for this instance is::" @@ -64,10 +64,10 @@ msgid "" "where the optional ``sign`` may be either '+' or '-' and ``numerator`` and " "``denominator`` (if present) are strings of decimal digits (underscores may " "be used to delimit digits as with integral literals in code). In addition, " -"any string that represents a finite value and is accepted by the :class:" -"`float` constructor is also accepted by the :class:`Fraction` constructor. " -"In either form the input string may also have leading and/or trailing " -"whitespace. Here are some examples::" +"any string that represents a finite value and is accepted by " +"the :class:`float` constructor is also accepted by the :class:`Fraction` " +"constructor. In either form the input string may also have leading and/or " +"trailing whitespace. Here are some examples::" msgstr "" #: ../../library/fractions.rst:52 @@ -124,17 +124,17 @@ msgstr "" #: ../../library/fractions.rst:78 msgid "" -"The :class:`Fraction` class inherits from the abstract base class :class:" -"`numbers.Rational`, and implements all of the methods and operations from " -"that class. :class:`Fraction` instances are :term:`hashable`, and should be " -"treated as immutable. In addition, :class:`Fraction` has the following " -"properties and methods:" +"The :class:`Fraction` class inherits from the abstract base " +"class :class:`numbers.Rational`, and implements all of the methods and " +"operations from that class. :class:`Fraction` instances " +"are :term:`hashable`, and should be treated as immutable. In " +"addition, :class:`Fraction` has the following properties and methods:" msgstr "" #: ../../library/fractions.rst:84 msgid "" -"The :class:`Fraction` constructor now accepts :class:`float` and :class:" -"`decimal.Decimal` instances." +"The :class:`Fraction` constructor now accepts :class:`float` " +"and :class:`decimal.Decimal` instances." msgstr "" #: ../../library/fractions.rst:88 @@ -152,8 +152,8 @@ msgstr "" #: ../../library/fractions.rst:97 msgid "" -":class:`Fraction` implements ``__int__`` now to satisfy ``typing." -"SupportsInt`` instance checks." +":class:`Fraction` implements ``__int__`` now to satisfy " +"``typing.SupportsInt`` instance checks." msgstr "" #: ../../library/fractions.rst:101 @@ -194,9 +194,9 @@ msgstr "" #: ../../library/fractions.rst:138 msgid "" -"Alternative constructor which only accepts instances of :class:`float` or :" -"class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is not " -"the same value as ``Fraction(3, 10)``." +"Alternative constructor which only accepts instances of :class:`float` " +"or :class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is " +"not the same value as ``Fraction(3, 10)``." msgstr "" #: ../../library/fractions.rst:144 @@ -207,8 +207,8 @@ msgstr "" #: ../../library/fractions.rst:150 msgid "" -"Alternative constructor which only accepts instances of :class:`decimal." -"Decimal` or :class:`numbers.Integral`." +"Alternative constructor which only accepts instances " +"of :class:`decimal.Decimal` or :class:`numbers.Integral`." msgstr "" #: ../../library/fractions.rst:155 @@ -245,15 +245,15 @@ msgid "" "The first version returns the nearest :class:`int` to ``self``, rounding " "half to even. The second version rounds ``self`` to the nearest multiple of " "``Fraction(1, 10**ndigits)`` (logically, if ``ndigits`` is negative), again " -"rounding half toward even. This method can also be accessed through the :" -"func:`round` function." +"rounding half toward even. This method can also be accessed through " +"the :func:`round` function." msgstr "" #: ../../library/fractions.rst:208 msgid "" -"Provides support for formatting of :class:`Fraction` instances via the :meth:" -"`str.format` method, the :func:`format` built-in function, or :ref:" -"`Formatted string literals `." +"Provides support for formatting of :class:`Fraction` instances via " +"the :meth:`str.format` method, the :func:`format` built-in function, " +"or :ref:`Formatted string literals `." msgstr "" #: ../../library/fractions.rst:212 @@ -281,7 +281,6 @@ msgid "Here are some examples::" msgstr "" #: ../../library/fractions.rst:229 -#, fuzzy msgid "" ">>> from fractions import Fraction\n" ">>> format(Fraction(103993, 33102), '_')\n" @@ -303,6 +302,14 @@ msgid "" "'34.67% price increase'" msgstr "" ">>> from fractions import Fraction\n" +">>> format(Fraction(103993, 33102), '_')\n" +"'103_993/33_102'\n" +">>> format(Fraction(1, 7), '.^+10')\n" +"'...+1/7...'\n" +">>> format(Fraction(3, 1), '')\n" +"'3'\n" +">>> format(Fraction(3, 1), '#')\n" +"'3/1'\n" ">>> format(Fraction(1, 7), '.40g')\n" "'0.1428571428571428571428571428571428571429'\n" ">>> format(Fraction('1234567.855'), '_.2f')\n" diff --git a/library/functional.po b/library/functional.po index d8cea9f862..89f98aafb8 100644 --- a/library/functional.po +++ b/library/functional.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -21,13 +20,15 @@ msgstr "" #: ../../library/functional.rst:3 msgid "Functional Programming Modules" -msgstr "函式編程模組" +msgstr "函式程式設計模組" #: ../../library/functional.rst:5 msgid "" "The modules described in this chapter provide functions and classes that " "support a functional programming style, and general operations on callables." msgstr "" +"本章節所描述的模組提供了支援函式程式設計風格的函式和類別,以及對可呼叫物件的" +"一般操作。" #: ../../library/functional.rst:8 msgid "The following modules are documented in this chapter:" diff --git a/library/functions.po b/library/functions.po index 0ebf226880..9493604248 100644 --- a/library/functions.po +++ b/library/functions.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-31 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2024-05-06 17:06+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -460,9 +460,9 @@ msgid "" "iterator. If *default* is given, it is returned if the iterator is " "exhausted, otherwise :exc:`StopAsyncIteration` is raised." msgstr "" -"呼叫 *async_iterator* 的 :meth:`~object.__anext__` 方法,回傳 :term:" -"`awaitable`。等待返回疊代器的下一個值。如果指定 *default*,當疊代器結束時會返" -"回該值,否則會引發 :exc:`StopAsyncIteration` 。" +"呼叫 *async_iterator* 的 :meth:`~object.__anext__` 方法,回" +"傳 :term:`awaitable`。等待返回疊代器的下一個值。如果指定 *default*,當疊代器" +"結束時會返回該值,否則會引發 :exc:`StopAsyncIteration` 。" #: ../../library/functions.rst:104 msgid "" @@ -489,9 +489,9 @@ msgstr "" #: ../../library/functions.rst:116 msgid "" "As :func:`repr`, return a string containing a printable representation of an " -"object, but escape the non-ASCII characters in the string returned by :func:" -"`repr` using ``\\x``, ``\\u``, or ``\\U`` escapes. This generates a string " -"similar to that returned by :func:`repr` in Python 2." +"object, but escape the non-ASCII characters in the string returned " +"by :func:`repr` using ``\\x``, ``\\u``, or ``\\U`` escapes. This generates " +"a string similar to that returned by :func:`repr` in Python 2." msgstr "" "就像函式 :func:`repr`,回傳一個表示物件的字串,但是 :func:`repr` 回傳的字串中" "非 ASCII 編碼的字元會被跳脫 (escape),像是 ``\\x``、``\\u`` 和 ``\\U``。這個" @@ -505,8 +505,8 @@ msgid "" "integer. Some examples:" msgstr "" "將一個整數轉變為一個前綴為 \"0b\" 的二進位制字串。結果是一個有效的 Python 運" -"算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:`~object." -"__index__` method 回傳一個整數。舉例來說:" +"算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定" +"義 :meth:`~object.__index__` method 回傳一個整數。舉例來說:" #: ../../library/functions.rst:134 msgid "" @@ -524,9 +524,9 @@ msgid "" "Return a Boolean value, i.e. one of ``True`` or ``False``. The argument is " "converted using the standard :ref:`truth testing procedure `. If the " "argument is false or omitted, this returns ``False``; otherwise, it returns " -"``True``. The :class:`bool` class is a subclass of :class:`int` (see :ref:" -"`typesnumeric`). It cannot be subclassed further. Its only instances are " -"``False`` and ``True`` (see :ref:`typebool`)." +"``True``. The :class:`bool` class is a subclass of :class:`int` " +"(see :ref:`typesnumeric`). It cannot be subclassed further. Its only " +"instances are ``False`` and ``True`` (see :ref:`typebool`)." msgstr "" "回傳一個布林值,即 ``True`` 或者 ``False``。引數會使用標準的\\ :ref:`真值測試" "程序 `\\ 來轉換。如果引數為假或者被省略,則回傳 ``False``;其他情況回" @@ -551,18 +551,18 @@ msgid "" "not accessible, this function will raise :exc:`RuntimeError`." msgstr "" "這個函式將呼叫 :func:`sys.breakpointhook` 函式,並將 ``args`` 和 ``kws`` 傳遞" -"給它。這將有效地讓你在特定的呼叫點進入除錯器。預設情況下,``sys." -"breakpointhook()`` 呼叫 :func:`pdb.set_trace` 不須帶任何引數。這樣的設計是為" -"了方便使用者,讓他們不需要額外地導入 :mod:`pdb` 模組或輸入太多程式就可以進入" -"除錯器。然而,可以將 :func:`sys.breakpointhook` 設置為其他函式,並且 :func:" -"`breakpoint` 將自動呼叫該函式,讓你進入所選擇的除錯器。如果無法存取 :func:" -"`sys.breakpointhook` 這個函式,則此函式將引發 :exc:`RuntimeError`。" +"給它。這將有效地讓你在特定的呼叫點進入除錯器。預設情況下," +"``sys.breakpointhook()`` 呼叫 :func:`pdb.set_trace` 不須帶任何引數。這樣的設" +"計是為了方便使用者,讓他們不需要額外地導入 :mod:`pdb` 模組或輸入太多程式就可" +"以進入除錯器。然而,可以將 :func:`sys.breakpointhook` 設置為其他函式,並" +"且 :func:`breakpoint` 將自動呼叫該函式,讓你進入所選擇的除錯器。如果無法存" +"取 :func:`sys.breakpointhook` 這個函式,則此函式將引發 :exc:`RuntimeError`。" #: ../../library/functions.rst:173 msgid "" -"By default, the behavior of :func:`breakpoint` can be changed with the :" -"envvar:`PYTHONBREAKPOINT` environment variable. See :func:`sys." -"breakpointhook` for usage details." +"By default, the behavior of :func:`breakpoint` can be changed with " +"the :envvar:`PYTHONBREAKPOINT` environment variable. " +"See :func:`sys.breakpointhook` for usage details." msgstr "" "預設情況下,:func:`breakpoint` 的行為可以透過 :envvar:`PYTHONBREAKPOINT` 環境" "變數來更改。有關使用詳情,請參考 :func:`sys.breakpointhook`。" @@ -589,9 +589,9 @@ msgid "" "as most methods that the :class:`bytes` type has, see :ref:`bytes-methods`." msgstr "" "回傳一個新的 bytes 陣列。:class:`bytearray` class 是一個可變的整數序列,包含" -"範圍為 0 <= x < 256 的整數。它有可變序列大部分常見的 method(如在 :ref:" -"`typesseq-mutable` 中所述),同時也有 :class:`bytes` 型別大部分的 method,參" -"見 :ref:`bytes-methods`。" +"範圍為 0 <= x < 256 的整數。它有可變序列大部分常見的 method(如" +"在 :ref:`typesseq-mutable` 中所述),同時也有 :class:`bytes` 型別大部分的 " +"method,參見 :ref:`bytes-methods`。" #: ../../library/functions.rst:195 msgid "" @@ -644,8 +644,8 @@ msgstr "可參考 :ref:`binaryseq` 和 :ref:`typebytearray`。" #: ../../library/functions.rst:222 msgid "" "Return a new \"bytes\" object which is an immutable sequence of integers in " -"the range ``0 <= x < 256``. :class:`bytes` is an immutable version of :" -"class:`bytearray` -- it has the same non-mutating methods and the same " +"the range ``0 <= x < 256``. :class:`bytes` is an immutable version " +"of :class:`bytearray` -- it has the same non-mutating methods and the same " "indexing and slicing behavior." msgstr "" "回傳一個新的 \"bytes\" 物件,會是一個元素是範圍為 ``0 <= x < 256`` 整數的不可" @@ -667,11 +667,12 @@ msgstr "可參考 :ref:`binaryseq`、:ref:`typebytes` 和 :ref:`bytes-methods` #: ../../library/functions.rst:236 msgid "" -"Return :const:`True` if the *object* argument appears callable, :const:" -"`False` if not. If this returns ``True``, it is still possible that a call " -"fails, but if it is ``False``, calling *object* will never succeed. Note " -"that classes are callable (calling a class returns a new instance); " -"instances are callable if their class has a :meth:`~object.__call__` method." +"Return :const:`True` if the *object* argument appears " +"callable, :const:`False` if not. If this returns ``True``, it is still " +"possible that a call fails, but if it is ``False``, calling *object* will " +"never succeed. Note that classes are callable (calling a class returns a new " +"instance); instances are callable if their class has " +"a :meth:`~object.__call__` method." msgstr "" "如果引數 *object* 是可呼叫的,回傳 :const:`True`,否則回傳 :const:`False`。如" "果回傳 ``True``,呼叫仍可能會失敗;但如果回傳 ``False``,則呼叫 *object* 肯定" @@ -726,8 +727,8 @@ msgstr "" #: ../../library/functions.rst:269 msgid "" -"The ``@classmethod`` form is a function :term:`decorator` -- see :ref:" -"`function` for details." +"The ``@classmethod`` form is a function :term:`decorator` -- " +"see :ref:`function` for details." msgstr "" "``@classmethod`` 語法是一個函式 :term:`decorator` — 參見 :ref:`function` 中關" "於函式定義的詳細介紹。" @@ -755,31 +756,30 @@ msgstr "" #: ../../library/functions.rst:281 msgid "" -"Class methods can now wrap other :term:`descriptors ` such as :" -"func:`property`." +"Class methods can now wrap other :term:`descriptors ` such " +"as :func:`property`." msgstr "" -"Class methods 現在可以包裝其他\\ :term:`描述器 `,例如 :func:" -"`property`" +"Class methods 現在可以包裝其他\\ :term:`描述器 `,例" +"如 :func:`property`" #: ../../library/functions.rst:285 msgid "" -"Class methods now inherit the method attributes (:attr:`~function." -"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" -"attr:`~function.__doc__` and :attr:`~function.__annotations__`) and have a " -"new ``__wrapped__`` attribute." +"Class methods now inherit the method attributes " +"(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " +"and :attr:`~function.__annotations__`) and have a new ``__wrapped__`` " +"attribute." msgstr "" -"Class method 現在繼承了 method 屬性(:attr:`~function.__module__`、:attr:" -"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." -"__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " -"``__wrapped__`` 屬性。" +"Class method 現在繼承了 method 屬性" +"(:attr:`~function.__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function.__doc__` " +"和 :attr:`~function.__annotations__`),並擁有一個新的 ``__wrapped__`` 屬性。" #: ../../library/functions.rst:292 msgid "" "Class methods can no longer wrap other :term:`descriptors ` such " "as :func:`property`." msgstr "" -"Class methods 不能再包裝其他的\\ :term:`描述器 `,例如 :func:" -"`property`。" +"Class methods 不能再包裝其他的\\ :term:`描述器 `,例" +"如 :func:`property`。" #: ../../library/functions.rst:299 msgid "" @@ -788,9 +788,9 @@ msgid "" "string, a byte string, or an AST object. Refer to the :mod:`ast` module " "documentation for information on how to work with AST objects." msgstr "" -"將 *source* 編譯成程式碼或 AST 物件。程式碼物件可以被 :func:`exec` 或 :func:" -"`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。參見 :mod:" -"`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" +"將 *source* 編譯成程式碼或 AST 物件。程式碼物件可以被 :func:`exec` " +"或 :func:`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。" +"參見 :mod:`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" #: ../../library/functions.rst:304 msgid "" @@ -816,38 +816,40 @@ msgstr "" #: ../../library/functions.rst:314 msgid "" -"The optional arguments *flags* and *dont_inherit* control which :ref:" -"`compiler options ` should be activated and which :ref:" -"`future features ` should be allowed. If neither is present (or both " -"are zero) the code is compiled with the same flags that affect the code that " -"is calling :func:`compile`. If the *flags* argument is given and " -"*dont_inherit* is not (or is zero) then the compiler options and the future " -"statements specified by the *flags* argument are used in addition to those " -"that would be used anyway. If *dont_inherit* is a non-zero integer then the " -"*flags* argument is it -- the flags (future features and compiler options) " -"in the surrounding code are ignored." +"The optional arguments *flags* and *dont_inherit* control " +"which :ref:`compiler options ` should be activated and " +"which :ref:`future features ` should be allowed. If neither is " +"present (or both are zero) the code is compiled with the same flags that " +"affect the code that is calling :func:`compile`. If the *flags* argument is " +"given and *dont_inherit* is not (or is zero) then the compiler options and " +"the future statements specified by the *flags* argument are used in addition " +"to those that would be used anyway. If *dont_inherit* is a non-zero integer " +"then the *flags* argument is it -- the flags (future features and compiler " +"options) in the surrounding code are ignored." msgstr "" "可選引數 *flags* 和 *dont_inherit* 控制啟用哪個\\ :ref:`編譯器選項 `\\ 以及允許哪個\\ :ref:`未來功能 `。如果兩者都不存在" "(或兩者都為零),則會呼叫與 :func:`compile` 相同旗標的程式碼來編譯。如果給" "定 *flags* 引數而未給定 *dont_inherit*(或為零)則無論如何都會使用由 *flags* " "引數所指定的編譯器選項和未來陳述式。如果 *dont_inherit* 是一個非零整數,則使" -"用 *flags* 引數 -- 周圍程式碼中的旗標(未來功能和編譯器選項)將被忽略。" +"用 *flags* 引數 -- 周圍程式碼中的旗標(未來功能和編譯器選項)將被忽略。" #: ../../library/functions.rst:325 msgid "" "Compiler options and future statements are specified by bits which can be " "bitwise ORed together to specify multiple options. The bitfield required to " -"specify a given future feature can be found as the :attr:`~__future__." -"_Feature.compiler_flag` attribute on the :class:`~__future__._Feature` " -"instance in the :mod:`__future__` module. :ref:`Compiler flags ` can be found in :mod:`ast` module, with ``PyCF_`` prefix." +"specify a given future feature can be found as " +"the :attr:`~__future__._Feature.compiler_flag` attribute on " +"the :class:`~__future__._Feature` instance in the :mod:`__future__` " +"module. :ref:`Compiler flags ` can be found " +"in :mod:`ast` module, with ``PyCF_`` prefix." msgstr "" "編譯器選項和 future 陳述式使用 bits 來表示,可以一起被位元操作 OR 來表示複數" -"個選項。需要被具體定義特徵的位元域可以透過 :mod:`__future__` module 中 :" -"class:`~__future__._Feature` 實例中的 :attr:`~__future__._Feature." -"compiler_flag` 屬性來獲得。:ref:`編譯器旗標 `\\ 可以在 :" -"mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名稱。" +"個選項。需要被具體定義特徵的位元域可以透過 :mod:`__future__` module " +"中 :class:`~__future__._Feature` 實例中" +"的 :attr:`~__future__._Feature.compiler_flag` 屬性來獲得。:ref:`編譯器旗標 " +"`\\ 可以在 :mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名" +"稱。" #: ../../library/functions.rst:333 msgid "" @@ -857,8 +859,8 @@ msgid "" "optimization; ``__debug__`` is true), ``1`` (asserts are removed, " "``__debug__`` is false) or ``2`` (docstrings are removed too)." msgstr "" -"引數 *optimize* 用來指定編譯器的最佳化級別;預設值 ``-1`` 選擇與直譯器的 :" -"option:`-O` 選項相同的最佳化級別。其他級別為 ``0``\\ (沒有最佳化;\\ " +"引數 *optimize* 用來指定編譯器的最佳化級別;預設值 ``-1`` 選擇與直譯器" +"的 :option:`-O` 選項相同的最佳化級別。其他級別為 ``0``\\ (沒有最佳化;\\ " "``__debug__`` 為真值)、``1``\\ (assert 被刪除,``__debug__`` 為假值)或 " "``2``\\ (說明字串 (docstring) 也被刪除)。" @@ -872,8 +874,8 @@ msgstr "" #: ../../library/functions.rst:342 msgid "" -"If you want to parse Python code into its AST representation, see :func:`ast." -"parse`." +"If you want to parse Python code into its AST representation, " +"see :func:`ast.parse`." msgstr "如果你想解析 Python 程式碼為 AST 運算式,請參閱 :func:`ast.parse`。" #: ../../library/functions.rst:345 ../../library/functions.rst:347 @@ -889,8 +891,8 @@ msgstr "" msgid "" "When compiling a string with multi-line code in ``'single'`` or ``'eval'`` " "mode, input must be terminated by at least one newline character. This is " -"to facilitate detection of incomplete and complete statements in the :mod:" -"`code` module." +"to facilitate detection of incomplete and complete statements in " +"the :mod:`code` module." msgstr "" "在 ``'single'`` 或 ``'eval'`` 模式編譯多行程式碼時,輸入必須以至少一個換行符" "結尾。這使 :mod:`code` module 更容易檢測陳述式的完整性。" @@ -983,23 +985,23 @@ msgid "" "and ``')'``, which are ignored. The string must not contain whitespace " "between ``'+'``, ``'-'``, the ``'j'`` or ``'J'`` suffix, and the decimal " "number. For example, ``complex('1+2j')`` is fine, but ``complex('1 + 2j')`` " -"raises :exc:`ValueError`. More precisely, the input must conform to the :" -"token:`~float:complexvalue` production rule in the following grammar, after " -"parentheses and leading and trailing whitespace characters are removed:" +"raises :exc:`ValueError`. More precisely, the input must conform to " +"the :token:`~float:complexvalue` production rule in the following grammar, " +"after parentheses and leading and trailing whitespace characters are removed:" msgstr "" #: ../../library/functions.rst:424 msgid "" "If the argument is a number, the constructor serves as a numeric conversion " "like :class:`int` and :class:`float`. For a general Python object ``x``, " -"``complex(x)`` delegates to ``x.__complex__()``. If :meth:`~object." -"__complex__` is not defined then it falls back to :meth:`~object.__float__`. " -"If :meth:`!__float__` is not defined then it falls back to :meth:`~object." -"__index__`." +"``complex(x)`` delegates to ``x.__complex__()``. " +"If :meth:`~object.__complex__` is not defined then it falls back " +"to :meth:`~object.__float__`. If :meth:`!__float__` is not defined then it " +"falls back to :meth:`~object.__index__`." msgstr "" "如果引數是一個數字,則建構函式會像 :class:`int` 和 :class:`float` 一樣進行數" -"值轉換。對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 ``x." -"__complex__()``。如果 :meth:`~object.__complex__` 未定義,則會回退 (fall " +"值轉換。對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 " +"``x.__complex__()``。如果 :meth:`~object.__complex__` 未定義,則會回退 (fall " "back) 到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未定義,則會再回" "退到 :meth:`~object.__index__`。" @@ -1029,8 +1031,8 @@ msgstr "可以使用底線將程式碼文字中的數字進行分組。" #: ../../library/functions.rst:450 msgid "" -"Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` and :" -"meth:`~object.__float__` are not defined." +"Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` " +"and :meth:`~object.__float__` are not defined." msgstr "" "如果 :meth:`~object.__complex__` 和 :meth:`~object.__float__` 未定義,則會回" "退到 :meth:`~object.__index__`。" @@ -1058,8 +1060,8 @@ msgstr "" #: ../../library/functions.rst:473 msgid "" -"For other containers see the built-in :class:`list`, :class:`set`, and :" -"class:`tuple` classes, as well as the :mod:`collections` module." +"For other containers see the built-in :class:`list`, :class:`set`, " +"and :class:`tuple` classes, as well as the :mod:`collections` module." msgstr "" "其他容器型別,請參見內建的 :class:`list`、:class:`set` 和 :class:`tuple` " "class,以及 :mod:`collections` module。" @@ -1077,9 +1079,9 @@ msgstr "" msgid "" "If the object has a method named :meth:`~object.__dir__`, this method will " "be called and must return the list of attributes. This allows objects that " -"implement a custom :func:`~object.__getattr__` or :func:`~object." -"__getattribute__` function to customize the way :func:`dir` reports their " -"attributes." +"implement a custom :func:`~object.__getattr__` " +"or :func:`~object.__getattribute__` function to customize the " +"way :func:`dir` reports their attributes." msgstr "" "如果物件有一個名為 :meth:`~object.__dir__` 的 method,那麼該 method 將被呼" "叫,並且必須回傳一個屬性列表。這允許實現自定義 :func:`~object.__getattr__` " @@ -1091,12 +1093,12 @@ msgid "" "If the object does not provide :meth:`~object.__dir__`, the function tries " "its best to gather information from the object's :attr:`~object.__dict__` " "attribute, if defined, and from its type object. The resulting list is not " -"necessarily complete and may be inaccurate when the object has a custom :" -"func:`~object.__getattr__`." +"necessarily complete and may be inaccurate when the object has a " +"custom :func:`~object.__getattr__`." msgstr "" -"如果物件不提供 :meth:`~object.__dir__`,這個函式會嘗試從物件已定義的 :attr:" -"`~object.__dict__` 屬性和型別物件收集資訊。結果列表並不總是完整的,如果物件有" -"自定義 :func:`~object.__getattr__`,那結果可能不準確。" +"如果物件不提供 :meth:`~object.__dir__`,這個函式會嘗試從物件已定義" +"的 :attr:`~object.__dict__` 屬性和型別物件收集資訊。結果列表並不總是完整的," +"如果物件有自定義 :func:`~object.__getattr__`,那結果可能不準確。" #: ../../library/functions.rst:496 msgid "" @@ -1153,30 +1155,30 @@ msgid "" "consisting of their quotient and remainder when using integer division. " "With mixed operand types, the rules for binary arithmetic operators apply. " "For integers, the result is the same as ``(a // b, a % b)``. For floating-" -"point numbers the result is ``(q, a % b)``, where *q* is usually ``math." -"floor(a / b)`` but may be 1 less than that. In any case ``q * b + a % b`` " -"is very close to *a*, if ``a % b`` is non-zero it has the same sign as *b*, " -"and ``0 <= abs(a % b) < abs(b)``." +"point numbers the result is ``(q, a % b)``, where *q* is usually " +"``math.floor(a / b)`` but may be 1 less than that. In any case ``q * b + a " +"% b`` is very close to *a*, if ``a % b`` is non-zero it has the same sign as " +"*b*, and ``0 <= abs(a % b) < abs(b)``." msgstr "" "它將兩個(非複數)數字作為引數,並在執行整數除法時回傳一對商和餘數。對於混合" "運算元型別,適用二進位算術運算子的規則。對於整數,運算結果和 ``(a // b, a % " -"b)`` 一致。對於浮點數,運算結果是 ``(q, a % b)``,*q* 通常是 ``math." -"floor(a / b)`` 但可能會比 1 小。在任何情況下,``q * b + a % b`` 和 *a* 基本相" -"等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣,且 ``0 <= abs(a % b) < " -"abs(b)``。" +"b)`` 一致。對於浮點數,運算結果是 ``(q, a % b)``,*q* 通常是 " +"``math.floor(a / b)`` 但可能會比 1 小。在任何情況下,``q * b + a % b`` 和 " +"*a* 基本相等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣,且 ``0 <= abs(a % " +"b) < abs(b)``。" #: ../../library/functions.rst:552 msgid "" -"Return an enumerate object. *iterable* must be a sequence, an :term:" -"`iterator`, or some other object which supports iteration. The :meth:" -"`~iterator.__next__` method of the iterator returned by :func:`enumerate` " -"returns a tuple containing a count (from *start* which defaults to 0) and " -"the values obtained from iterating over *iterable*." +"Return an enumerate object. *iterable* must be a sequence, " +"an :term:`iterator`, or some other object which supports iteration. " +"The :meth:`~iterator.__next__` method of the iterator returned " +"by :func:`enumerate` returns a tuple containing a count (from *start* which " +"defaults to 0) and the values obtained from iterating over *iterable*." msgstr "" "回傳一個列舉 (enumerate) 物件。*iterable* 必須是一個序列、:term:`iterator` 或" -"其他支援疊代的物件。:func:`enumerate` 回傳之 iterator 的 :meth:`~iterator." -"__next__` method 回傳一個 tuple(元組),裡面包含一個計數值(從 *start* 開" -"始,預設為 0)和透過疊代 *iterable* 獲得的值。" +"其他支援疊代的物件。:func:`enumerate` 回傳之 iterator " +"的 :meth:`~iterator.__next__` method 回傳一個 tuple(元組),裡面包含一個計數" +"值(從 *start* 開始,預設為 0)和透過疊代 *iterable* 獲得的值。" #: ../../library/functions.rst:564 msgid "Equivalent to::" @@ -1243,14 +1245,14 @@ msgid "" "reference to the dictionary of the built-in module :mod:`builtins` is " "inserted under that key before *expression* is parsed. That way you can " "control what builtins are available to the executed code by inserting your " -"own ``__builtins__`` dictionary into *globals* before passing it to :func:" -"`eval`. If the *locals* mapping is omitted it defaults to the *globals* " -"dictionary. If both mappings are omitted, the expression is executed with " -"the *globals* and *locals* in the environment where :func:`eval` is called. " -"Note, *eval()* will only have access to the :term:`nested scopes ` (non-locals) in the enclosing environment if they are already " -"referenced in the scope that is calling :func:`eval` (e.g. via a :keyword:" -"`nonlocal` statement)." +"own ``__builtins__`` dictionary into *globals* before passing it " +"to :func:`eval`. If the *locals* mapping is omitted it defaults to the " +"*globals* dictionary. If both mappings are omitted, the expression is " +"executed with the *globals* and *locals* in the environment " +"where :func:`eval` is called. Note, *eval()* will only have access to " +"the :term:`nested scopes ` (non-locals) in the enclosing " +"environment if they are already referenced in the scope that is " +"calling :func:`eval` (e.g. via a :keyword:`nonlocal` statement)." msgstr "" "*expression* 引數會被視為一條 Python 運算式(技術上而言,是條件列表)來剖析及" "求值,而 *globals* 和 *locals* 對映分別用作全域和區域命名空間。如果 " @@ -1258,11 +1260,11 @@ msgstr "" "析之前,將為該鍵插入對內建 :mod:`builtins` module dictionary 的引用。這麼一" "來,在將 ``__builtins__`` dictionary 傳入 :func:`eval` 之前,你可以透過將它插" "入 *globals* 來控制你需要哪些內建函式來執行程式碼。如果 *locals* 對映被省略," -"那它的預設值是 *globals* dictionary。如果兩個對映都被省略,則以在 :func:" -"`eval` 被呼叫的環境中的 *globals* 和 *locals* 執行運算式。請注意,*eval()* 在" -"封閉 (enclosing) 環境中無法存取\\ :term:`巢狀作用域 ` (non-" -"locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透過 :keyword:" -"`nonlocal` 陳述式)。" +"那它的預設值是 *globals* dictionary。如果兩個對映都被省略,則以" +"在 :func:`eval` 被呼叫的環境中的 *globals* 和 *locals* 執行運算式。請注意," +"*eval()* 在封閉 (enclosing) 環境中無法存取\\ :term:`巢狀作用域 ` (non-locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透" +"過 :keyword:`nonlocal` 陳述式)。" #: ../../library/functions.rst:612 msgid "Example:" @@ -1287,8 +1289,8 @@ msgid "" "pass around for use by :func:`eval` or :func:`exec`." msgstr "" "提示::func:`exec` 函式支援動態執行陳述式。:func:`globals` 和 :func:`locals` " -"函式分別回傳目前的全域性和局部性 dictionary,它們對於將引數傳遞給 :func:" -"`eval` 或 :func:`exec` 可能會方便許多。" +"函式分別回傳目前的全域性和局部性 dictionary,它們對於將引數傳遞" +"給 :func:`eval` 或 :func:`exec` 可能會方便許多。" #: ../../library/functions.rst:628 msgid "" @@ -1330,18 +1332,18 @@ msgid "" "as a suite of Python statements which is then executed (unless a syntax " "error occurs). [#]_ If it is a code object, it is simply executed. In all " "cases, the code that's executed is expected to be valid as file input (see " -"the section :ref:`file-input` in the Reference Manual). Be aware that the :" -"keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return` statements may " -"not be used outside of function definitions even within the context of code " -"passed to the :func:`exec` function. The return value is ``None``." +"the section :ref:`file-input` in the Reference Manual). Be aware that " +"the :keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return` statements " +"may not be used outside of function definitions even within the context of " +"code passed to the :func:`exec` function. The return value is ``None``." msgstr "" "這個函式支援動態執行 Python 程式碼。*source* 必須是字串或者程式碼物件。如果是" "字串,那麼該字串將被剖析為一系列 Python 陳述式並執行(除非發生語法錯誤)。" "[#]_ 如果是程式碼物件,它將被直接執行。無論哪種情況,被執行的程式碼都需要和檔" "案輸入一樣是有效的(可參閱語言參考手冊中關於\\ :ref:`file-input`\\ 的章節)。" -"請注意,即使在傳遞給 :func:`exec` 函式的程式碼的上下文中,:keyword:" -"`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在函式之外使" -"用。該函式回傳值是 ``None``。" +"請注意,即使在傳遞給 :func:`exec` 函式的程式碼的上下文" +"中,:keyword:`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在" +"函式之外使用。該函式回傳值是 ``None``。" #: ../../library/functions.rst:668 msgid "" @@ -1371,9 +1373,9 @@ msgstr "" #: ../../library/functions.rst:684 msgid "" "If the *globals* dictionary does not contain a value for the key " -"``__builtins__``, a reference to the dictionary of the built-in module :mod:" -"`builtins` is inserted under that key. That way you can control what " -"builtins are available to the executed code by inserting your own " +"``__builtins__``, a reference to the dictionary of the built-in " +"module :mod:`builtins` is inserted under that key. That way you can control " +"what builtins are available to the executed code by inserting your own " "``__builtins__`` dictionary into *globals* before passing it to :func:`exec`." msgstr "" "如果 *globals* dictionary 不包含 ``__builtins__`` 鍵值,則將為該鍵插入對內" @@ -1408,9 +1410,9 @@ msgid "" "Pass an explicit *locals* dictionary if you need to see effects of the code " "on *locals* after function :func:`exec` returns." msgstr "" -"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣。如果你想在 :" -"func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 *locals* " -"dictionary 。" +"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣。如果你想" +"在 :func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 " +"*locals* dictionary 。" #: ../../library/functions.rst:713 msgid "Added the *closure* parameter." @@ -1510,9 +1512,9 @@ msgstr "" #: ../../library/functions.rst:796 msgid "" -"For a general Python object ``x``, ``float(x)`` delegates to ``x." -"__float__()``. If :meth:`~object.__float__` is not defined then it falls " -"back to :meth:`~object.__index__`." +"For a general Python object ``x``, ``float(x)`` delegates to " +"``x.__float__()``. If :meth:`~object.__float__` is not defined then it " +"falls back to :meth:`~object.__index__`." msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 會委派給 ``x.__float__()``。如果未" "定義 :meth:`~object.__float__` 則會回退到 :meth:`~object.__index__`。" @@ -1540,8 +1542,8 @@ msgid "" "is used by most built-in types: :ref:`formatspec`." msgstr "" "將 *value* 轉換為 *format_spec* 控制的 \"格式化\" 表示。*format_spec* 的解釋" -"取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語法::ref:" -"`formatspec`。" +"取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語" +"法::ref:`formatspec`。" #: ../../library/functions.rst:825 msgid "" @@ -1553,12 +1555,12 @@ msgstr "" #: ../../library/functions.rst:828 msgid "" -"A call to ``format(value, format_spec)`` is translated to ``type(value)." -"__format__(value, format_spec)`` which bypasses the instance dictionary when " -"searching for the value's :meth:`~object.__format__` method. A :exc:" -"`TypeError` exception is raised if the method search reaches :mod:`object` " -"and the *format_spec* is non-empty, or if either the *format_spec* or the " -"return value are not strings." +"A call to ``format(value, format_spec)`` is translated to " +"``type(value).__format__(value, format_spec)`` which bypasses the instance " +"dictionary when searching for the value's :meth:`~object.__format__` method. " +"A :exc:`TypeError` exception is raised if the method search " +"reaches :mod:`object` and the *format_spec* is non-empty, or if either the " +"*format_spec* or the return value are not strings." msgstr "" "呼叫 ``format(value, format_spec)`` 會轉換成 ``type(value).__format__(value, " "format_spec)``,當搜尋 value 的 :meth:`~object.__format__` method 時,會忽略" @@ -1570,23 +1572,24 @@ msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." msgstr "" -"當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引發 :" -"exc:`TypeError`。" +"當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引" +"發 :exc:`TypeError`。" #: ../../library/functions.rst:844 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " -"*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" -"ref:`types-set` for documentation about this class." +"*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` " +"and :ref:`types-set` for documentation about this class." msgstr "" "回傳一個新的 :class:`frozenset` 物件,它包含選擇性引數 *iterable* 中的元素。" -"``frozenset`` 是一個內建的 class。有關此 class 的文件,請參閱 :class:" -"`frozenset` 和 :ref:`types-set`。" +"``frozenset`` 是一個內建的 class。有關此 class 的文件,請參" +"閱 :class:`frozenset` 和 :ref:`types-set`。" #: ../../library/functions.rst:848 msgid "" -"For other containers see the built-in :class:`set`, :class:`list`, :class:" -"`tuple`, and :class:`dict` classes, as well as the :mod:`collections` module." +"For other containers see the built-" +"in :class:`set`, :class:`list`, :class:`tuple`, and :class:`dict` classes, " +"as well as the :mod:`collections` module." msgstr "" "請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` " "class,以及 :mod:`collections` module 來了解其它的容器。" @@ -1602,16 +1605,16 @@ msgid "" msgstr "" "回傳 *object* 之具名屬性的值。*name* 必須是字串。如果該字串是物件屬性之一的名" "稱,則回傳該屬性的值。例如,``getattr(x, 'foobar')`` 等同於 ``x.foobar``。如" -"果指定的屬性不存在,且提供了 *default* 值,則回傳其值,否則引發 :exc:" -"`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:" -"`setattr`)。" +"果指定的屬性不存在,且提供了 *default* 值,則回傳其值,否則引" +"發 :exc:`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請" +"見 :func:`setattr`)。" #: ../../library/functions.rst:865 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " -"with two leading underscores) name in order to retrieve it with :func:" -"`getattr`." +"with two leading underscores) name in order to retrieve it " +"with :func:`getattr`." msgstr "" "由於\\ :ref:`私有名稱改編 (private name mangling) ` 是" "發生在編譯期,因此你必須手動改編私有屬性(有兩個前導底線的屬性)的名稱,才能" @@ -1650,8 +1653,9 @@ msgstr "" #: ../../library/functions.rst:895 msgid "" -"For objects with custom :meth:`~object.__hash__` methods, note that :func:" -"`hash` truncates the return value based on the bit width of the host machine." +"For objects with custom :meth:`~object.__hash__` methods, note " +"that :func:`hash` truncates the return value based on the bit width of the " +"host machine." msgstr "" "請注意,如果物件帶有自訂的 :meth:`~object.__hash__` 方法,:func:`hash` 將根據" "運行機器的位元長度來截斷回傳值。" @@ -1697,12 +1701,12 @@ msgstr "" #: ../../library/functions.rst:923 msgid "" "Convert an integer number to a lowercase hexadecimal string prefixed with " -"\"0x\". If *x* is not a Python :class:`int` object, it has to define an :" -"meth:`~object.__index__` method that returns an integer. Some examples:" +"\"0x\". If *x* is not a Python :class:`int` object, it has to define " +"an :meth:`~object.__index__` method that returns an integer. Some examples:" msgstr "" -"將整數轉換為以 \"0x\" 為前綴的小寫十六進位制字串。如果 *x* 不是 Python :" -"class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並且回傳一" -"個整數。舉例來說:" +"將整數轉換為以 \"0x\" 為前綴的小寫十六進位制字串。如果 *x* 不是 " +"Python :class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並" +"且回傳一個整數。舉例來說:" #: ../../library/functions.rst:932 msgid "" @@ -1721,8 +1725,8 @@ msgstr "另請參閱 :func:`int` 將十六進位制字串轉換為以 16 為基 #: ../../library/functions.rst:949 msgid "" -"To obtain a hexadecimal string representation for a float, use the :meth:" -"`float.hex` method." +"To obtain a hexadecimal string representation for a float, use " +"the :meth:`float.hex` method." msgstr "" "如果要取得浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" @@ -1760,14 +1764,14 @@ msgstr "" #: ../../library/functions.rst:973 msgid "" -">>> s = input('--> ') \n" +">>> s = input('--> ')\n" "--> Monty Python's Flying Circus\n" -">>> s \n" +">>> s\n" "\"Monty Python's Flying Circus\"" msgstr "" -">>> s = input('--> ') \n" +">>> s = input('--> ')\n" "--> Monty Python's Flying Circus\n" -">>> s \n" +">>> s\n" "\"Monty Python's Flying Circus\"" #: ../../library/functions.rst:978 @@ -1830,11 +1834,11 @@ msgstr "" #: ../../library/functions.rst:1015 msgid "" -"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x." -"__int__()``. If the argument defines :meth:`~object.__index__`, it returns " -"``x.__index__()``. If the argument defines :meth:`~object.__trunc__`, it " -"returns ``x.__trunc__()``. For floating-point numbers, this truncates " -"towards zero." +"If the argument defines :meth:`~object.__int__`, ``int(x)`` returns " +"``x.__int__()``. If the argument defines :meth:`~object.__index__`, it " +"returns ``x.__index__()``. If the argument " +"defines :meth:`~object.__trunc__`, it returns ``x.__trunc__()``. For " +"floating-point numbers, this truncates towards zero." msgstr "" "如果引數定義了 :meth:`~object.__int__`,則 ``int(x)`` 回傳 ``x.__int__()``。" "如果引數定義了 :meth:`~object.__index__` 則回傳 ``x.__index__()``。如果引數定" @@ -1849,10 +1853,10 @@ msgid "" "``-`` (with no space in between), have leading zeros, be surrounded by " "whitespace, and have single underscores interspersed between digits." msgstr "" -"如果引數不是數字或如果有給定 *base*,則它必須是個字串、:class:`bytes` 或 :" -"class:`bytearray` 實例,表示基數 (radix) *base* 中的整數。可選地,字串之前可" -"以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、或在" -"數字間有單一底線。" +"如果引數不是數字或如果有給定 *base*,則它必須是個字串、:class:`bytes` " +"或 :class:`bytearray` 實例,表示基數 (radix) *base* 中的整數。可選地,字串之" +"前可以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、" +"或在數字間有單一底線。" #: ../../library/functions.rst:1027 msgid "" @@ -1882,15 +1886,15 @@ msgstr "整數型別定義請參閱\\ :ref:`typesnumeric`。" #: ../../library/functions.rst:1040 msgid "" -"If *base* is not an instance of :class:`int` and the *base* object has a :" -"meth:`base.__index__ ` method, that method is called to " +"If *base* is not an instance of :class:`int` and the *base* object has " +"a :meth:`base.__index__ ` method, that method is called to " "obtain an integer for the base. Previous versions used :meth:`base.__int__ " "` instead of :meth:`base.__index__ `." msgstr "" "如果 *base* 不是 :class:`int` 的實例,但 *base* 物件有 :meth:`base.__index__ " "` method,則會呼叫該 method 來取得此進位制所需的整數。以前" -"的版本使用 :meth:`base.__int__ ` 而不是 :meth:`base." -"__index__ `。" +"的版本使用 :meth:`base.__int__ ` 而不" +"是 :meth:`base.__index__ `。" #: ../../library/functions.rst:1050 msgid "The first parameter is now positional-only." @@ -1912,14 +1916,14 @@ msgid "" ":class:`int` string inputs and string representations can be limited to help " "avoid denial of service attacks. A :exc:`ValueError` is raised when the " "limit is exceeded while converting a string to an :class:`int` or when " -"converting an :class:`int` into a string would exceed the limit. See the :" -"ref:`integer string conversion length limitation ` " +"converting an :class:`int` into a string would exceed the limit. See " +"the :ref:`integer string conversion length limitation ` " "documentation." msgstr "" ":class:`int` 的字串輸入和字串表示法可以被限制,以避免阻斷服務攻擊 (denial of " -"service attack)。在字串 *x* 轉換為 :class:`int` 時已超出限制,或是在 :class:" -"`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱\\ :ref:`整" -"數字串轉換的長度限制 `\\ 說明文件。" +"service attack)。在字串 *x* 轉換為 :class:`int` 時已超出限制,或是" +"在 :class:`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱" +"\\ :ref:`整數字串轉換的長度限制 `\\ 說明文件。" #: ../../library/functions.rst:1069 msgid "" @@ -1929,18 +1933,18 @@ msgid "" "the function always returns ``False``. If *classinfo* is a tuple of type " "objects (or recursively, other such tuples) or a :ref:`types-union` of " "multiple types, return ``True`` if *object* is an instance of any of the " -"types. If *classinfo* is not a type or tuple of types and such tuples, a :" -"exc:`TypeError` exception is raised. :exc:`TypeError` may not be raised for " -"an invalid type if an earlier check succeeds." -msgstr "" -"如果 *object* 引數是 *classinfo* 引數的實例,或者是(直接、間接或 :term:" -"`virtual `)subclass 的實例,則回傳 ``True``。如果 " -"*object* 不是給定型別的物件,函式始終回傳 ``False``。如果 *classinfo* 是包含" -"物件型別的 tuple(或多個遞迴 tuple)或一個包含多種型別的 :ref:`types-union`," -"若 *object* 是其中的任何一個物件的實例則回傳 ``True``。如果 *classinfo* 既不" -"是型別,也不是型別 tuple 或型別的遞迴 tuple,那麼會引發 :exc:`TypeError` 異" -"常。若是先前檢查已經成功,:exc:`TypeError` 可能不會再因為不合格的型別而被引" -"發。" +"types. If *classinfo* is not a type or tuple of types and such tuples, " +"a :exc:`TypeError` exception is raised. :exc:`TypeError` may not be raised " +"for an invalid type if an earlier check succeeds." +msgstr "" +"如果 *object* 引數是 *classinfo* 引數的實例,或者是(直接、間接" +"或 :term:`virtual `)subclass 的實例,則回傳 ``True``。" +"如果 *object* 不是給定型別的物件,函式始終回傳 ``False``。如果 *classinfo* 是" +"包含物件型別的 tuple(或多個遞迴 tuple)或一個包含多種型別的 :ref:`types-" +"union`,若 *object* 是其中的任何一個物件的實例則回傳 ``True``。如果 " +"*classinfo* 既不是型別,也不是型別 tuple 或型別的遞迴 tuple,那麼會引" +"發 :exc:`TypeError` 異常。若是先前檢查已經成功,:exc:`TypeError` 可能不會再因" +"為不合格的型別而被引發。" #: ../../library/functions.rst:1080 ../../library/functions.rst:1094 msgid "*classinfo* can be a :ref:`types-union`." @@ -1948,27 +1952,27 @@ msgstr "*classinfo* 可以是一個 :ref:`types-union`。" #: ../../library/functions.rst:1086 msgid "" -"Return ``True`` if *class* is a subclass (direct, indirect, or :term:" -"`virtual `) of *classinfo*. A class is considered a " -"subclass of itself. *classinfo* may be a tuple of class objects (or " -"recursively, other such tuples) or a :ref:`types-union`, in which case " +"Return ``True`` if *class* is a subclass (direct, indirect, " +"or :term:`virtual `) of *classinfo*. A class is " +"considered a subclass of itself. *classinfo* may be a tuple of class objects " +"(or recursively, other such tuples) or a :ref:`types-union`, in which case " "return ``True`` if *class* is a subclass of any entry in *classinfo*. In " "any other case, a :exc:`TypeError` exception is raised." msgstr "" "如果 *class* 是 *classinfo* 的 subclass(直接、間接或 :term:`virtual " "`),則回傳 ``True``。*classinfo* 可以是 class 物件的 " "tuple(或遞迴地其他類似 tuple)或是一個 :ref:`types-union`,此時若 *class* " -"是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引發 :" -"exc:`TypeError`。" +"是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引" +"發 :exc:`TypeError`。" #: ../../library/functions.rst:1101 msgid "" "Return an :term:`iterator` object. The first argument is interpreted very " "differently depending on the presence of the second argument. Without a " -"second argument, *object* must be a collection object which supports the :" -"term:`iterable` protocol (the :meth:`~object.__iter__` method), or it must " -"support the sequence protocol (the :meth:`~object.__getitem__` method with " -"integer arguments starting at ``0``). If it does not support either of " +"second argument, *object* must be a collection object which supports " +"the :term:`iterable` protocol (the :meth:`~object.__iter__` method), or it " +"must support the sequence protocol (the :meth:`~object.__getitem__` method " +"with integer arguments starting at ``0``). If it does not support either of " "those protocols, :exc:`TypeError` is raised. If the second argument, " "*sentinel*, is given, then *object* must be a callable object. The iterator " "created in this case will call *object* with no arguments for each call to " @@ -1977,13 +1981,13 @@ msgid "" "returned." msgstr "" "回傳一個 :term:`iterator` 物件。根據是否存在第二個引數,第一個引數的意義是非" -"常不同的。如果沒有第二個引數,*object* 必須是支援 :term:`iterable` 協定(有 :" -"meth:`~object.__iter__` method)的集合物件,或必須支援序列協定(有 :meth:" -"`~object.__getitem__` 方法,且數字引數從 ``0`` 開始)。如果它不支援這些協定," -"會引發 :exc:`TypeError`。如果有第二個引數 *sentinel*,那麼 *object* 必須是可" -"呼叫的物件,這種情況下生成的 iterator,每次疊代呼叫 :meth:`~iterator." -"__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 *sentinel* 則引發 :" -"exc:`StopIteration`,否則回傳呼叫結果。" +"常不同的。如果沒有第二個引數,*object* 必須是支援 :term:`iterable` 協定" +"(有 :meth:`~object.__iter__` method)的集合物件,或必須支援序列協定" +"(有 :meth:`~object.__getitem__` 方法,且數字引數從 ``0`` 開始)。如果它不支" +"援這些協定,會引發 :exc:`TypeError`。如果有第二個引數 *sentinel*,那麼 " +"*object* 必須是可呼叫的物件,這種情況下生成的 iterator,每次疊代呼" +"叫 :meth:`~iterator.__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 " +"*sentinel* 則引發 :exc:`StopIteration`,否則回傳呼叫結果。" #: ../../library/functions.rst:1115 msgid "See also :ref:`typeiter`." @@ -2021,8 +2025,8 @@ msgstr "" #: ../../library/functions.rst:1135 msgid "" -"``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." -"maxsize`, such as :class:`range(2 ** 100) `." +"``len`` raises :exc:`OverflowError` on lengths larger " +"than :data:`sys.maxsize`, such as :class:`range(2 ** 100) `." msgstr "" "如果物件長度大於 :data:`sys.maxsize`,像是 :class:`range(2 ** 100) `," "則 ``len`` 會引發 :exc:`OverflowError`。" @@ -2045,8 +2049,8 @@ msgstr "" #: ../../library/functions.rst:1154 msgid "" "At module scope, as well as when using :func:`exec` or :func:`eval` with a " -"single namespace, this function returns the same namespace as :func:" -"`globals`." +"single namespace, this function returns the same namespace " +"as :func:`globals`." msgstr "" #: ../../library/functions.rst:1158 @@ -2107,10 +2111,10 @@ msgstr "" #: ../../library/functions.rst:1193 msgid "" "As part of :pep:`667`, the semantics of mutating the mapping objects " -"returned from this function are now defined. The behavior in :term:" -"`optimized scopes ` is now as described above. Aside from " -"being defined, the behaviour in other scopes remains unchanged from previous " -"versions." +"returned from this function are now defined. The behavior " +"in :term:`optimized scopes ` is now as described above. " +"Aside from being defined, the behaviour in other scopes remains unchanged " +"from previous versions." msgstr "" #: ../../library/functions.rst:1203 @@ -2148,20 +2152,20 @@ msgid "" "There are two optional keyword-only arguments. The *key* argument specifies " "a one-argument ordering function like that used for :meth:`list.sort`. The " "*default* argument specifies an object to return if the provided iterable is " -"empty. If the iterable is empty and *default* is not provided, a :exc:" -"`ValueError` is raised." +"empty. If the iterable is empty and *default* is not provided, " +"a :exc:`ValueError` is raised." msgstr "" "這個函式有兩個選擇性的僅限關鍵字引數。*key* 引數能指定單一引數所使用的排序函" "式,如同 :meth:`list.sort` 的使用方式。*default* 引數是當 iterable 為空時回傳" -"的物件。如果 iterable 為空,並且沒有提供 *default*,則會引發 :exc:" -"`ValueError`。" +"的物件。如果 iterable 為空,並且沒有提供 *default*,則會引" +"發 :exc:`ValueError`。" #: ../../library/functions.rst:1229 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " -"such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and ``heapq." -"nlargest(1, iterable, key=keyfunc)``." +"such as ``sorted(iterable, key=keyfunc, reverse=True)[0]`` and " +"``heapq.nlargest(1, iterable, key=keyfunc)``." msgstr "" "如果有多個最大元素,則此函式將回傳第一個找到的。這和其他穩定排序工具如 " "``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " @@ -2177,8 +2181,8 @@ msgstr "*key* 可以為 ``None``。" #: ../../library/functions.rst:1245 msgid "" -"Return a \"memory view\" object created from the given argument. See :ref:" -"`typememoryview` for more information." +"Return a \"memory view\" object created from the given argument. " +"See :ref:`typememoryview` for more information." msgstr "" "回傳由給定的引數所建立之「memory view(記憶體檢視)」物件。有關詳細資訊,請參" "閱\\ :ref:`typememoryview`。" @@ -2211,13 +2215,14 @@ msgstr "" #: ../../library/functions.rst:1282 msgid "" -"Retrieve the next item from the :term:`iterator` by calling its :meth:" -"`~iterator.__next__` method. If *default* is given, it is returned if the " -"iterator is exhausted, otherwise :exc:`StopIteration` is raised." +"Retrieve the next item from the :term:`iterator` by calling " +"its :meth:`~iterator.__next__` method. If *default* is given, it is " +"returned if the iterator is exhausted, otherwise :exc:`StopIteration` is " +"raised." msgstr "" "透過呼叫 :term:`iterator` 的 :meth:`~iterator.__next__` method 取得下一個元" -"素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引發 :" -"exc:`StopIteration`。" +"素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引" +"發 :exc:`StopIteration`。" #: ../../library/functions.rst:1289 msgid "" @@ -2246,8 +2251,8 @@ msgid "" "integer. For example:" msgstr "" "將一個整數轉變為一個前綴為 \"0o\" 的八進位制字串。回傳結果是一個有效的 " -"Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" -"`~object.__index__` method 回傳一個整數。舉例來說:" +"Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定" +"義 :meth:`~object.__index__` method 回傳一個整數。舉例來說:" #: ../../library/functions.rst:1313 msgid "" @@ -2288,18 +2293,18 @@ msgid "" "already exists), ``'x'`` for exclusive creation, and ``'a'`` for appending " "(which on *some* Unix systems, means that *all* writes append to the end of " "the file regardless of the current seek position). In text mode, if " -"*encoding* is not specified the encoding used is platform-dependent: :func:" -"`locale.getencoding` is called to get the current locale encoding. (For " -"reading and writing raw bytes use binary mode and leave *encoding* " -"unspecified.) The available modes are:" +"*encoding* is not specified the encoding used is platform-" +"dependent: :func:`locale.getencoding` is called to get the current locale " +"encoding. (For reading and writing raw bytes use binary mode and leave " +"*encoding* unspecified.) The available modes are:" msgstr "" "*mode* 是一個選擇性字串,用於指定開啟檔案的模式。預設值是 ``'r'``,這意味著它" "以文字模式開啟並讀取。其他常見模式有:寫入 ``'w'``\\ (會捨去已經存在的檔" "案)、唯一性建立 ``'x'``、追加寫入 ``'a'``\\ (在\\ *一些* Unix 系統上,無論" "目前的檔案指標在什麼位置,*所有* 寫入都會追加到檔案末尾)。在文字模式,如果沒" -"有指定 *encoding*,則根據電腦平臺來決定使用的編碼:呼叫 :func:`locale." -"getencoding` 來取得目前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制模" -"式且不要指定 *encoding*。)可用的模式有:" +"有指定 *encoding*,則根據電腦平臺來決定使用的編碼:呼" +"叫 :func:`locale.getencoding` 來取得目前的本地編碼。(要讀取和寫入原始 " +"bytes,請使用二進位制模式且不要指定 *encoding*。)可用的模式有:" #: ../../library/functions.rst:1357 msgid "Character" @@ -2429,9 +2434,9 @@ msgid "" "systems, the buffer will typically be 4096 or 8192 bytes long." msgstr "" "二進制檔案會以固定大小的區塊進行緩衝;緩衝區的大小是使用啟發式嘗試 " -"(heuristic trying) 來決定底層設備的「區塊大小」,並會回退到 :attr:`io." -"DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 8192 個位元" -"組。" +"(heuristic trying) 來決定底層設備的「區塊大小」,並會回退" +"到 :attr:`io.DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 " +"8192 個位元組。" #: ../../library/functions.rst:1401 msgid "" @@ -2460,8 +2465,9 @@ msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled—this cannot be used in binary mode. A variety of " "standard error handlers are available (listed under :ref:`error-handlers`), " -"though any error handling name that has been registered with :func:`codecs." -"register_error` is also valid. The standard names include:" +"though any error handling name that has been registered " +"with :func:`codecs.register_error` is also valid. The standard names " +"include:" msgstr "" "*errors* 是一個選擇性的字串,用於指定要如何處理編碼和解碼的錯誤——它不能在二進" "制模式下使用。有許多不同的標準錯誤處理程式(error handler,在\\ :ref:`error-" @@ -2555,10 +2561,10 @@ msgstr "" #: ../../library/functions.rst:1463 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " -"characters written are translated to the system default line separator, :" -"data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no translation " -"takes place. If *newline* is any of the other legal values, any ``'\\n'`` " -"characters written are translated to the given string." +"characters written are translated to the system default line " +"separator, :data:`os.linesep`. If *newline* is ``''`` or ``'\\n'``, no " +"translation takes place. If *newline* is any of the other legal values, any " +"``'\\n'`` characters written are translated to the given string." msgstr "" "將輸出寫入資料串流時,如果 *newline* 是 ``None``,則被寫入的任何 ``'\\n'`` 字" "元都會轉換為系統預設的行分隔符號 :data:`os.linesep`。如果 *newline* 是 " @@ -2595,8 +2601,8 @@ msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" #: ../../library/functions.rst:1482 msgid "" -"The following example uses the :ref:`dir_fd ` parameter of the :func:" -"`os.open` function to open a file relative to a given directory::" +"The following example uses the :ref:`dir_fd ` parameter of " +"the :func:`os.open` function to open a file relative to a given directory::" msgstr "" "下面的範例使用 :func:`os.open` 函式回傳值當作 :ref:`dir_fd ` 的參數," "從給定的目錄中用相對路徑開啟檔案: ::" @@ -2618,35 +2624,35 @@ msgstr "" msgid "" "The type of :term:`file object` returned by the :func:`open` function " "depends on the mode. When :func:`open` is used to open a file in a text " -"mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass of :" -"class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When used " -"to open a file in a binary mode with buffering, the returned class is a " +"mode (``'w'``, ``'r'``, ``'wt'``, ``'rt'``, etc.), it returns a subclass " +"of :class:`io.TextIOBase` (specifically :class:`io.TextIOWrapper`). When " +"used to open a file in a binary mode with buffering, the returned class is a " "subclass of :class:`io.BufferedIOBase`. The exact class varies: in read " "binary mode, it returns an :class:`io.BufferedReader`; in write binary and " "append binary modes, it returns an :class:`io.BufferedWriter`, and in read/" "write mode, it returns an :class:`io.BufferedRandom`. When buffering is " -"disabled, the raw stream, a subclass of :class:`io.RawIOBase`, :class:`io." -"FileIO`, is returned." +"disabled, the raw stream, a subclass " +"of :class:`io.RawIOBase`, :class:`io.FileIO`, is returned." msgstr "" ":func:`open` 函式回傳的 :term:`file object` 型別取決於模式。當 :func:`open` " "是在文字模式中開啟檔案時(``'w'``、``'r'``、``'wt'``、``'rt'`` 等),它會回" -"傳 :class:`io.TextIOBase` 的一個 subclass(具體來說,就是 :class:`io." -"TextIOWrapper`)。使用有緩衝的二進制模式開啟檔案時,回傳的 class 則會是 :" -"class:`io.BufferedIOBase` 的 subclass。確切的 class 各不相同:在讀取的二進制" -"模式,它會回傳 :class:`io.BufferedReader`;在寫入和附加的二進制模式,它會回" -"傳 :class:`io.BufferedWriter`,而在讀/寫模式,它會回傳 :class:`io." -"BufferedRandom`。當緩衝被停用時,會回傳原始資料串流 :class:`io.FileIO`,它" -"是 :class:`io.RawIOBase` 的一個 subclass。" +"傳 :class:`io.TextIOBase` 的一個 subclass(具體來說,就" +"是 :class:`io.TextIOWrapper`)。使用有緩衝的二進制模式開啟檔案時,回傳的 " +"class 則會是 :class:`io.BufferedIOBase` 的 subclass。確切的 class 各不相同:" +"在讀取的二進制模式,它會回傳 :class:`io.BufferedReader`;在寫入和附加的二進制" +"模式,它會回傳 :class:`io.BufferedWriter`,而在讀/寫模式,它會回" +"傳 :class:`io.BufferedRandom`。當緩衝被停用時,會回傳原始資料串" +"流 :class:`io.FileIO`,它是 :class:`io.RawIOBase` 的一個 subclass。" #: ../../library/functions.rst:1516 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " -"(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" -"`tempfile`, and :mod:`shutil`." +"(where :func:`open` is " +"declared), :mod:`os`, :mod:`os.path`, :mod:`tempfile`, and :mod:`shutil`." msgstr "" -"另請參閱檔案操作模組,例如 :mod:`fileinput`、:mod:`io`\\ (定義了 :func:" -"`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以及 :mod:" -"`shutil`。" +"另請參閱檔案操作模組,例如 :mod:`fileinput`、:mod:`io`\\ (定義" +"了 :func:`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以" +"及 :mod:`shutil`。" #: ../../library/functions.rst:1520 msgid "" @@ -2679,8 +2685,8 @@ msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." msgstr "" -"如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引發 :exc:" -"`FileExistsError`。" +"如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引" +"發 :exc:`FileExistsError`。" #: ../../library/functions.rst:1535 msgid "The file is now non-inheritable." @@ -2689,8 +2695,8 @@ msgstr "檔案在此版本開始是不可繼承的。" #: ../../library/functions.rst:1539 msgid "" "If the system call is interrupted and the signal handler does not raise an " -"exception, the function now retries the system call instead of raising an :" -"exc:`InterruptedError` exception (see :pep:`475` for the rationale)." +"exception, the function now retries the system call instead of raising " +"an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" "如果系統呼叫被中斷,但訊號處理程式沒有引發例外,此函式現在會重試系統呼叫,而" "不是引發 :exc:`InterruptedError` 例外(原因詳見 :pep:`475`)。" @@ -2705,8 +2711,8 @@ msgstr "增加對於實作 :class:`os.PathLike` 物件的支援。" #: ../../library/functions.rst:1547 msgid "" -"On Windows, opening a console buffer may return a subclass of :class:`io." -"RawIOBase` other than :class:`io.FileIO`." +"On Windows, opening a console buffer may return a subclass " +"of :class:`io.RawIOBase` other than :class:`io.FileIO`." msgstr "" "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " "subclass,而不是 :class:`io.FileIO`。" @@ -2747,9 +2753,9 @@ msgid "" "2)`` returns ``100``, but ``pow(10, -2)`` returns ``0.01``. For a negative " "base of type :class:`int` or :class:`float` and a non-integral exponent, a " "complex result is delivered. For example, ``pow(-9, 0.5)`` returns a value " -"close to ``3j``. Whereas, for a negative base of type :class:`int` or :class:" -"`float` with an integral exponent, a float result is delivered. For example, " -"``pow(-9, 2.0)`` returns ``81.0``." +"close to ``3j``. Whereas, for a negative base of type :class:`int` " +"or :class:`float` with an integral exponent, a float result is delivered. " +"For example, ``pow(-9, 2.0)`` returns ``81.0``." msgstr "" "引數必須是數值型別。對於混合型別的運算元,會套用二元算術運算子的強制轉型 " "(coercion) 規則。對於 :class:`int` 運算元,運算結果會(在強制轉型後)與運算元" @@ -2757,9 +2763,9 @@ msgstr "" "並得到浮點數的結果。例如,``pow(10, 2)`` 會回傳 ``100``,但 ``pow(10, -2)`` " "會回傳 ``0.01``。如果底數 (base) 是型別為 :class:`int` 或 :class:`float` 的負" "數且指數 (exponent) 不是整數,則會得到一個複數的結果,例如 ``pow(-9, 0.5)`` " -"會回傳一個接近 ``3j`` 的值。如果底數 (base) 是型別為 :class:`int` 或 :class:" -"`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 ``pow(-9, 2.0)`` " -"會回傳 ``81.0``。" +"會回傳一個接近 ``3j`` 的值。如果底數 (base) 是型別為 :class:`int` " +"或 :class:`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 " +"``pow(-9, 2.0)`` 會回傳 ``81.0``。" #: ../../library/functions.rst:1580 msgid "" @@ -2910,12 +2916,12 @@ msgstr "" msgid "" "If given, *doc* will be the docstring of the property attribute. Otherwise, " "the property will copy *fget*'s docstring (if it exists). This makes it " -"possible to create read-only properties easily using :func:`property` as a :" -"term:`decorator`::" +"possible to create read-only properties easily using :func:`property` as " +"a :term:`decorator`::" msgstr "" "如果有給定 *doc*,它將會是 property 屬性的說明字串。否則,property 會複製 " -"*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使用 :func:" -"`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" +"*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使" +"用 :func:`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" #: ../../library/functions.rst:1660 msgid "" @@ -3046,10 +3052,10 @@ msgstr "" #: ../../library/functions.rst:1754 msgid "" -"Return a reverse :term:`iterator`. *seq* must be an object which has a :" -"meth:`~object.__reversed__` method or supports the sequence protocol (the :" -"meth:`~object.__len__` method and the :meth:`~object.__getitem__` method " -"with integer arguments starting at ``0``)." +"Return a reverse :term:`iterator`. *seq* must be an object which has " +"a :meth:`~object.__reversed__` method or supports the sequence protocol " +"(the :meth:`~object.__len__` method and the :meth:`~object.__getitem__` " +"method with integer arguments starting at ``0``)." msgstr "" #: ../../library/functions.rst:1762 @@ -3072,8 +3078,8 @@ msgstr "" #: ../../library/functions.rst:1775 msgid "" -"For a general Python object ``number``, ``round`` delegates to ``number." -"__round__``." +"For a general Python object ``number``, ``round`` delegates to " +"``number.__round__``." msgstr "" #: ../../library/functions.rst:1780 @@ -3094,9 +3100,9 @@ msgstr "" #: ../../library/functions.rst:1796 msgid "" -"For other containers see the built-in :class:`frozenset`, :class:`list`, :" -"class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` " -"module." +"For other containers see the built-" +"in :class:`frozenset`, :class:`list`, :class:`tuple`, and :class:`dict` " +"classes, as well as the :mod:`collections` module." msgstr "" #: ../../library/functions.rst:1803 @@ -3111,10 +3117,10 @@ msgstr "" #: ../../library/functions.rst:1809 msgid "" "*name* need not be a Python identifier as defined in :ref:`identifiers` " -"unless the object chooses to enforce that, for example in a custom :meth:" -"`~object.__getattribute__` or via :attr:`~object.__slots__`. An attribute " -"whose name is not an identifier will not be accessible using the dot " -"notation, but is accessible through :func:`getattr` etc.." +"unless the object chooses to enforce that, for example in a " +"custom :meth:`~object.__getattribute__` or via :attr:`~object.__slots__`. An " +"attribute whose name is not an identifier will not be accessible using the " +"dot notation, but is accessible through :func:`getattr` etc.." msgstr "" #: ../../library/functions.rst:1817 @@ -3142,14 +3148,16 @@ msgstr "" #: ../../library/functions.rst:1839 msgid "" "Slice objects are also generated when extended indexing syntax is used. For " -"example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See :func:" -"`itertools.islice` for an alternate version that returns an :term:`iterator`." +"example: ``a[start:stop:step]`` or ``a[start:stop, i]``. " +"See :func:`itertools.islice` for an alternate version that returns " +"an :term:`iterator`." msgstr "" #: ../../library/functions.rst:1844 msgid "" -"Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:" -"`~slice.stop`, and :attr:`~slice.step` are hashable)." +"Slice objects are now :term:`hashable` " +"(provided :attr:`~slice.start`, :attr:`~slice.stop`, and :attr:`~slice.step` " +"are hashable)." msgstr "" #: ../../library/functions.rst:1850 @@ -3164,8 +3172,9 @@ msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" #: ../../library/functions.rst:1854 msgid "" "*key* specifies a function of one argument that is used to extract a " -"comparison key from each element in *iterable* (for example, ``key=str." -"lower``). The default value is ``None`` (compare the elements directly)." +"comparison key from each element in *iterable* (for example, " +"``key=str.lower``). The default value is ``None`` (compare the elements " +"directly)." msgstr "" #: ../../library/functions.rst:1858 @@ -3227,8 +3236,8 @@ msgstr "" #: ../../library/functions.rst:1891 msgid "" -"The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" -"`function` for details." +"The ``@staticmethod`` form is a function :term:`decorator` -- " +"see :ref:`function` for details." msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" @@ -3236,9 +3245,9 @@ msgstr "" #: ../../library/functions.rst:1894 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " -"an instance (such as ``C().f()``). Moreover, the static method :term:" -"`descriptor` is also callable, so it can be used in the class definition " -"(such as ``f()``)." +"an instance (such as ``C().f()``). Moreover, the static " +"method :term:`descriptor` is also callable, so it can be used in the class " +"definition (such as ``f()``)." msgstr "" #: ../../library/functions.rst:1899 @@ -3277,15 +3286,15 @@ msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" #: ../../library/functions.rst:1917 msgid "" -"Static methods now inherit the method attributes (:attr:`~function." -"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" -"attr:`~function.__doc__` and :attr:`~function.__annotations__`), have a new " -"``__wrapped__`` attribute, and are now callable as regular functions." +"Static methods now inherit the method attributes " +"(:attr:`~function.__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function.__doc__` " +"and :attr:`~function.__annotations__`), have a new ``__wrapped__`` " +"attribute, and are now callable as regular functions." msgstr "" -"Static method 現在繼承了 method 屬性(:attr:`~function.__module__`、:attr:" -"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." -"__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " -"``__wrapped__`` 屬性,且為如一般函式的可呼叫物件。" +"Static method 現在繼承了 method 屬性" +"(:attr:`~function.__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function.__doc__` " +"和 :attr:`~function.__annotations__`),並擁有一個新的 ``__wrapped__`` 屬性," +"且為如一般函式的可呼叫物件。" #: ../../library/functions.rst:1933 msgid "" @@ -3308,10 +3317,10 @@ msgstr "" #: ../../library/functions.rst:1945 msgid "" "For some use cases, there are good alternatives to :func:`sum`. The " -"preferred, fast way to concatenate a sequence of strings is by calling ``''." -"join(sequence)``. To add floating-point values with extended precision, " -"see :func:`math.fsum`\\. To concatenate a series of iterables, consider " -"using :func:`itertools.chain`." +"preferred, fast way to concatenate a sequence of strings is by calling " +"``''.join(sequence)``. To add floating-point values with extended " +"precision, see :func:`math.fsum`\\. To concatenate a series of iterables, " +"consider using :func:`itertools.chain`." msgstr "" #: ../../library/functions.rst:1951 @@ -3339,17 +3348,17 @@ msgstr "" #: ../../library/functions.rst:1969 msgid "" -"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C -" -"> A -> object`` and the value of *type* is ``B``, then :func:`super` " +"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C " +"-> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" #: ../../library/functions.rst:1973 msgid "" "The :attr:`~type.__mro__` attribute of the class corresponding to " -"*object_or_type* lists the method resolution search order used by both :func:" -"`getattr` and :func:`super`. The attribute is dynamic and can change " -"whenever the inheritance hierarchy is updated." +"*object_or_type* lists the method resolution search order used by " +"both :func:`getattr` and :func:`super`. The attribute is dynamic and can " +"change whenever the inheritance hierarchy is updated." msgstr "" #: ../../library/functions.rst:1978 @@ -3432,9 +3441,9 @@ msgstr "" #: ../../library/functions.rst:2031 msgid "" -"For practical suggestions on how to design cooperative classes using :func:" -"`super`, see `guide to using super() `_." +"For practical suggestions on how to design cooperative classes " +"using :func:`super`, see `guide to using super() `_." msgstr "" #: ../../library/functions.rst:2041 @@ -3446,8 +3455,8 @@ msgstr "" #: ../../library/functions.rst:2050 msgid "" "With one argument, return the type of an *object*. The return value is a " -"type object and generally the same object as returned by :attr:`object." -"__class__`." +"type object and generally the same object as returned " +"by :attr:`object.__class__`." msgstr "" #: ../../library/functions.rst:2054 @@ -3464,9 +3473,9 @@ msgid "" "tuple contains the base classes and becomes the :attr:`~type.__bases__` " "attribute; if empty, :class:`object`, the ultimate base of all classes, is " "added. The *dict* dictionary contains attribute and method definitions for " -"the class body; it may be copied or wrapped before becoming the :attr:`~type." -"__dict__` attribute. The following two statements create identical :class:`!" -"type` objects:" +"the class body; it may be copied or wrapped before becoming " +"the :attr:`~type.__dict__` attribute. The following two statements create " +"identical :class:`!type` objects:" msgstr "" #: ../../library/functions.rst:2072 @@ -3509,10 +3518,11 @@ msgstr "" #: ../../library/functions.rst:2094 msgid "" -"Objects such as modules and instances have an updateable :attr:`~object." -"__dict__` attribute; however, other objects may have write restrictions on " -"their :attr:`!__dict__` attributes (for example, classes use a :class:`types." -"MappingProxyType` to prevent direct dictionary updates)." +"Objects such as modules and instances have an " +"updateable :attr:`~object.__dict__` attribute; however, other objects may " +"have write restrictions on their :attr:`!__dict__` attributes (for example, " +"classes use a :class:`types.MappingProxyType` to prevent direct dictionary " +"updates)." msgstr "" #: ../../library/functions.rst:2099 @@ -3567,15 +3577,15 @@ msgstr "" #: ../../library/functions.rst:2128 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " -"columns into rows. This is similar to `transposing a matrix `_." +"columns into rows. This is similar to `transposing a matrix `_." msgstr "" #: ../../library/functions.rst:2132 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " -"iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" -"`list`." +"iterated on, e.g. by a :keyword:`!for` loop or by wrapping in " +"a :class:`list`." msgstr "" #: ../../library/functions.rst:2136 @@ -3632,8 +3642,8 @@ msgstr "" #: ../../library/functions.rst:2177 msgid "" "Shorter iterables can be padded with a constant value to make all the " -"iterables have the same length. This is done by :func:`itertools." -"zip_longest`." +"iterables have the same length. This is done " +"by :func:`itertools.zip_longest`." msgstr "" #: ../../library/functions.rst:2181 @@ -3913,29 +3923,3 @@ msgstr "import(引入)" #: ../../library/functions.rst:2209 msgid "builtins" msgstr "builtins(內建)" - -#~ msgid "" -#~ "Most users should just pass a *globals* argument and never *locals*. If " -#~ "exec gets two separate objects as *globals* and *locals*, the code will " -#~ "be executed as if it were embedded in a class definition." -#~ msgstr "" -#~ "大部分使用者只需要傳入 *globals* 引數,而不用傳遞 *locals*。如果 exec 有" -#~ "兩個不同的 *globals* 和 *locals* 物件,程式碼就像嵌入在 class 定義中一樣執" -#~ "行。" - -#~ msgid "" -#~ "Update and return a dictionary representing the current local symbol " -#~ "table. Free variables are returned by :func:`locals` when it is called in " -#~ "function blocks, but not in class blocks. Note that at the module level, :" -#~ "func:`locals` and :func:`globals` are the same dictionary." -#~ msgstr "" -#~ "更新並回傳表示目前本地符號表的 dictionary。在函式區塊而不是 class 區塊中呼" -#~ "叫 :func:`locals` 時會回傳自由變數。請注意,在 module 階層中,:func:" -#~ "`locals` 和 :func:`globals` 是相同的 dictionary。" - -#~ msgid "" -#~ "The contents of this dictionary should not be modified; changes may not " -#~ "affect the values of local and free variables used by the interpreter." -#~ msgstr "" -#~ "此 dictionary 的內容不應該被更動;更改可能不會影響直譯器使用的本地變數或自" -#~ "由變數的值。" diff --git a/library/getpass.po b/library/getpass.po index afd4253883..5762de3fea 100644 --- a/library/getpass.po +++ b/library/getpass.po @@ -61,8 +61,8 @@ msgstr "" #: ../../library/getpass.rst:28 msgid "" "If echo free input is unavailable getpass() falls back to printing a warning " -"message to *stream* and reading from ``sys.stdin`` and issuing a :exc:" -"`GetPassWarning`." +"message to *stream* and reading from ``sys.stdin`` and issuing " +"a :exc:`GetPassWarning`." msgstr "" "如果無回音輸入 (echo-free input) 無法使用則 getpass() 將回退為印出一條警告訊" "息到 *stream*,並從 ``sys.stdin`` 讀取且同時發出 :exc:`GetPassWarning`。" @@ -84,18 +84,18 @@ msgid "Return the \"login name\" of the user." msgstr "回傳使用者的\"登入名稱\"。" #: ../../library/getpass.rst:45 -#, fuzzy msgid "" -"This function checks the environment variables :envvar:`LOGNAME`, :envvar:" -"`USER`, :envvar:`!LNAME` and :envvar:`USERNAME`, in order, and returns the " -"value of the first one which is set to a non-empty string. If none are set, " -"the login name from the password database is returned on systems which " -"support the :mod:`pwd` module, otherwise, an :exc:`OSError` is raised." +"This function checks the environment " +"variables :envvar:`LOGNAME`, :envvar:`USER`, :envvar:`!LNAME` " +"and :envvar:`USERNAME`, in order, and returns the value of the first one " +"which is set to a non-empty string. If none are set, the login name from " +"the password database is returned on systems which support the :mod:`pwd` " +"module, otherwise, an :exc:`OSError` is raised." msgstr "" "此函式會按順序檢查環境變數 :envvar:`LOGNAME`、:envvar:`USER`、:envvar:`!" "LNAME` 和 :envvar:`USERNAME`,並回傳其中第一個被設定成非空字串的值。如果均未" "設定,則在支援 :mod:`pwd` 模組的系統上將會回傳來自密碼資料庫的登入名稱,否則" -"將引發一個例外。" +"將引發一個 :exc:`OSError` 例外。" #: ../../library/getpass.rst:52 msgid "In general, this function should be preferred over :func:`os.getlogin`." @@ -103,4 +103,4 @@ msgstr "大部分情況下,此函式應該要比 :func:`os.getlogin` 優先使 #: ../../library/getpass.rst:54 msgid "Previously, various exceptions beyond just :exc:`OSError` were raised." -msgstr "" +msgstr "在過去,除了 :exc:`OSError` 外還會引發各種例外。" diff --git a/library/gzip.po b/library/gzip.po index d2643f46da..80147ac8e0 100644 --- a/library/gzip.po +++ b/library/gzip.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-04-26 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -105,7 +105,7 @@ msgstr "" msgid "Added support for the ``'x'``, ``'xb'`` and ``'xt'`` modes." msgstr "新增 ``'x'``、``'xb'`` 和 ``'xt'`` 模式的支援。" -#: ../../library/gzip.rst:59 ../../library/gzip.rst:175 +#: ../../library/gzip.rst:59 ../../library/gzip.rst:173 msgid "Accepts a :term:`path-like object`." msgstr "接受\\ :term:`類路徑物件 `。" @@ -201,27 +201,26 @@ msgstr ":class:`GzipFile` 也提供了以下的方法和屬性:" #: ../../library/gzip.rst:124 msgid "" -"Read *n* uncompressed bytes without advancing the file position. At most one " -"single read on the compressed stream is done to satisfy the call. The " -"number of bytes returned may be more or less than requested." +"Read *n* uncompressed bytes without advancing the file position. The number " +"of bytes returned may be more or less than requested." msgstr "" -#: ../../library/gzip.rst:129 +#: ../../library/gzip.rst:127 msgid "" "While calling :meth:`peek` does not change the file position of the :class:" "`GzipFile`, it may change the position of the underlying file object (e.g. " "if the :class:`GzipFile` was constructed with the *fileobj* parameter)." msgstr "" -#: ../../library/gzip.rst:138 +#: ../../library/gzip.rst:136 msgid "``'rb'`` for reading and ``'wb'`` for writing." msgstr "" -#: ../../library/gzip.rst:140 +#: ../../library/gzip.rst:138 msgid "In previous versions it was an integer ``1`` or ``2``." msgstr "" -#: ../../library/gzip.rst:145 +#: ../../library/gzip.rst:143 msgid "" "When decompressing, this attribute is set to the last timestamp in the most " "recently read header. It is an integer, holding the number of seconds since " @@ -229,62 +228,62 @@ msgid "" "reading any headers is ``None``." msgstr "" -#: ../../library/gzip.rst:152 +#: ../../library/gzip.rst:150 msgid "" "The path to the gzip file on disk, as a :class:`str` or :class:`bytes`. " "Equivalent to the output of :func:`os.fspath` on the original input path, " "with no other normalization, resolution or expansion." msgstr "" -#: ../../library/gzip.rst:156 +#: ../../library/gzip.rst:154 msgid "" "Support for the :keyword:`with` statement was added, along with the *mtime* " "constructor argument and :attr:`mtime` attribute." msgstr "" -#: ../../library/gzip.rst:160 +#: ../../library/gzip.rst:158 msgid "Support for zero-padded and unseekable files was added." msgstr "" -#: ../../library/gzip.rst:163 +#: ../../library/gzip.rst:161 msgid "The :meth:`io.BufferedIOBase.read1` method is now implemented." msgstr ":meth:`io.BufferedIOBase.read1` 方法現在已有實作。" -#: ../../library/gzip.rst:166 +#: ../../library/gzip.rst:164 msgid "Added support for the ``'x'`` and ``'xb'`` modes." msgstr "新增 ``'x'`` 和 ``'xb'`` 模式的支援。" -#: ../../library/gzip.rst:169 +#: ../../library/gzip.rst:167 msgid "" "Added support for writing arbitrary :term:`bytes-like objects `. The :meth:`~io.BufferedIOBase.read` method now accepts an argument " "of ``None``." msgstr "" -#: ../../library/gzip.rst:178 +#: ../../library/gzip.rst:176 msgid "" "Opening :class:`GzipFile` for writing without specifying the *mode* argument " "is deprecated." msgstr "" -#: ../../library/gzip.rst:182 +#: ../../library/gzip.rst:180 msgid "" "Remove the ``filename`` attribute, use the :attr:`~GzipFile.name` attribute " "instead." msgstr "" -#: ../../library/gzip.rst:189 +#: ../../library/gzip.rst:187 msgid "" "Compress the *data*, returning a :class:`bytes` object containing the " "compressed data. *compresslevel* and *mtime* have the same meaning as in " "the :class:`GzipFile` constructor above." msgstr "" -#: ../../library/gzip.rst:194 +#: ../../library/gzip.rst:192 msgid "Added the *mtime* parameter for reproducible output." msgstr "" -#: ../../library/gzip.rst:196 +#: ../../library/gzip.rst:194 msgid "" "Speed is improved by compressing all data at once instead of in a streamed " "fashion. Calls with *mtime* set to ``0`` are delegated to :func:`zlib." @@ -293,13 +292,13 @@ msgid "" "underlying zlib implementation." msgstr "" -#: ../../library/gzip.rst:203 +#: ../../library/gzip.rst:201 msgid "" "The gzip header OS byte is guaranteed to be set to 255 when this function is " "used as was the case in 3.10 and earlier." msgstr "" -#: ../../library/gzip.rst:209 +#: ../../library/gzip.rst:207 msgid "" "Decompress the *data*, returning a :class:`bytes` object containing the " "uncompressed data. This function is capable of decompressing multi-member " @@ -308,21 +307,21 @@ msgid "" "*wbits* set to 31 is faster." msgstr "" -#: ../../library/gzip.rst:216 +#: ../../library/gzip.rst:214 msgid "" "Speed is improved by decompressing members at once in memory instead of in a " "streamed fashion." msgstr "" -#: ../../library/gzip.rst:223 +#: ../../library/gzip.rst:221 msgid "Examples of usage" msgstr "用法範例" -#: ../../library/gzip.rst:225 +#: ../../library/gzip.rst:223 msgid "Example of how to read a compressed file::" msgstr "如何讀取壓縮檔案的範例: ::" -#: ../../library/gzip.rst:227 +#: ../../library/gzip.rst:225 msgid "" "import gzip\n" "with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" @@ -332,11 +331,11 @@ msgstr "" "with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" " file_content = f.read()" -#: ../../library/gzip.rst:231 +#: ../../library/gzip.rst:229 msgid "Example of how to create a compressed GZIP file::" msgstr "如何建立一個壓縮的 GZIP 檔案的範例: ::" -#: ../../library/gzip.rst:233 +#: ../../library/gzip.rst:231 msgid "" "import gzip\n" "content = b\"Lots of content here\"\n" @@ -348,11 +347,11 @@ msgstr "" "with gzip.open('/home/joe/file.txt.gz', 'wb') as f:\n" " f.write(content)" -#: ../../library/gzip.rst:238 +#: ../../library/gzip.rst:236 msgid "Example of how to GZIP compress an existing file::" msgstr "如何壓縮一個已存在的檔案的範例: ::" -#: ../../library/gzip.rst:240 +#: ../../library/gzip.rst:238 msgid "" "import gzip\n" "import shutil\n" @@ -366,11 +365,11 @@ msgstr "" " with gzip.open('/home/joe/file.txt.gz', 'wb') as f_out:\n" " shutil.copyfileobj(f_in, f_out)" -#: ../../library/gzip.rst:246 +#: ../../library/gzip.rst:244 msgid "Example of how to GZIP compress a binary string::" msgstr "如何壓縮一個二進位字串的範例: ::" -#: ../../library/gzip.rst:248 +#: ../../library/gzip.rst:246 msgid "" "import gzip\n" "s_in = b\"Lots of content here\"\n" @@ -380,56 +379,62 @@ msgstr "" "s_in = b\"Lots of content here\"\n" "s_out = gzip.compress(s_in)" -#: ../../library/gzip.rst:254 +#: ../../library/gzip.rst:252 msgid "Module :mod:`zlib`" msgstr ":mod:`zlib` 模組" -#: ../../library/gzip.rst:255 +#: ../../library/gzip.rst:253 msgid "" "The basic data compression module needed to support the :program:`gzip` file " "format." msgstr "" -#: ../../library/gzip.rst:264 +#: ../../library/gzip.rst:256 +msgid "" +"In case gzip (de)compression is a bottleneck, the `python-isal`_ package " +"speeds up (de)compression with a mostly compatible API." +msgstr "" + +#: ../../library/gzip.rst:266 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/gzip.rst:266 +#: ../../library/gzip.rst:268 msgid "" "The :mod:`gzip` module provides a simple command line interface to compress " "or decompress files." msgstr "" -#: ../../library/gzip.rst:269 +#: ../../library/gzip.rst:271 msgid "Once executed the :mod:`gzip` module keeps the input file(s)." msgstr "" -#: ../../library/gzip.rst:273 +#: ../../library/gzip.rst:275 msgid "" "Add a new command line interface with a usage. By default, when you will " "execute the CLI, the default compression level is 6." msgstr "" -#: ../../library/gzip.rst:277 +#: ../../library/gzip.rst:279 msgid "Command line options" msgstr "命令列選項" -#: ../../library/gzip.rst:281 +#: ../../library/gzip.rst:283 msgid "If *file* is not specified, read from :data:`sys.stdin`." msgstr "如果未指定 *file*,則從 :data:`sys.stdin` 讀取。" -#: ../../library/gzip.rst:285 +#: ../../library/gzip.rst:287 msgid "Indicates the fastest compression method (less compression)." msgstr "" -#: ../../library/gzip.rst:289 +#: ../../library/gzip.rst:291 msgid "Indicates the slowest compression method (best compression)." msgstr "" -#: ../../library/gzip.rst:293 +#: ../../library/gzip.rst:295 msgid "Decompress the given file." msgstr "解壓縮指定的檔案。" -#: ../../library/gzip.rst:297 +#: ../../library/gzip.rst:299 msgid "Show the help message." msgstr "顯示幫助訊息。" diff --git a/library/hashlib.po b/library/hashlib.po index a70a88e0dd..f2b02c5096 100644 --- a/library/hashlib.po +++ b/library/hashlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-04-24 05:58+0000\n" "PO-Revision-Date: 2024-05-11 16:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,42 +29,39 @@ msgstr "**原始碼:**\\ :source:`Lib/hashlib.py`" #: ../../library/hashlib.rst:23 msgid "" -"This module implements a common interface to many different secure hash and " -"message digest algorithms. Included are the FIPS secure hash algorithms " -"SHA1, SHA224, SHA256, SHA384, SHA512, (defined in `the FIPS 180-4 " -"standard`_), the SHA-3 series (defined in `the FIPS 202 standard`_) as well " -"as RSA's MD5 algorithm (defined in internet :rfc:`1321`). The terms " -"\"secure hash\" and \"message digest\" are interchangeable. Older " -"algorithms were called message digests. The modern term is secure hash." +"This module implements a common interface to many different hash algorithms. " +"Included are the FIPS secure hash algorithms SHA224, SHA256, SHA384, SHA512, " +"(defined in `the FIPS 180-4 standard`_), the SHA-3 series (defined in `the " +"FIPS 202 standard`_) as well as the legacy algorithms SHA1 (`formerly part " +"of FIPS`_) and the MD5 algorithm (defined in internet :rfc:`1321`)." msgstr "" -"該模組實作了許多不同安全雜湊和訊息摘要演算法的通用介面,其中包括 FIPS 安全雜" -"湊演算法 SHA1、SHA224、SHA256、SHA384、SHA512(定義於 `FIPS 180-4 標準 `_)、SHA-3 系列(定義於 `FIPS 202 標準 `_)以及 RSA 的 MD5 演算法(定義於網際網路 :rfc:`1321`)。「安全雜" -"湊 (secure hash)」和「訊息摘要 (message digest)」這兩個術語是可以互換的。較舊" -"的演算法稱為訊息摘要、現代則較常稱之安全雜湊。" +"該模組實作了許多不同雜湊演算法的通用介面,其中包括 FIPS 安全雜湊演算法 SHA1、" +"SHA224、SHA256、SHA384、SHA512(定義於 `FIPS 180-4 標準 `_)、SHA-3 系列(定義於 `FIPS 202 標準 `_)以及遺留的 SHA1 演算法(`先前為 FIPS 的一部分 `_)和 MD5 演算法(定義於網際網路 :rfc:`1321`)。" -#: ../../library/hashlib.rst:33 +#: ../../library/hashlib.rst:31 msgid "" -"If you want the adler32 or crc32 hash functions, they are available in the :" -"mod:`zlib` module." +"If you want the adler32 or crc32 hash functions, they are available in " +"the :mod:`zlib` module." msgstr "" "如果你需要 adler32 或 crc32 雜湊函式,可以在 :mod:`zlib` 模組中找到它們。" -#: ../../library/hashlib.rst:40 +#: ../../library/hashlib.rst:38 msgid "Hash algorithms" msgstr "雜湊演算法" -#: ../../library/hashlib.rst:42 +#: ../../library/hashlib.rst:40 msgid "" "There is one constructor method named for each type of :dfn:`hash`. All " -"return a hash object with the same simple interface. For example: use :func:" -"`sha256` to create a SHA-256 hash object. You can now feed this object with :" -"term:`bytes-like objects ` (normally :class:`bytes`) " -"using the :meth:`update` method. At any point you can ask it " -"for the :dfn:`digest` of the concatenation of the data fed to it so far " -"using the :meth:`digest()` or :meth:`hexdigest()` methods." +"return a hash object with the same simple interface. For example: " +"use :func:`sha256` to create a SHA-256 hash object. You can now feed this " +"object with :term:`bytes-like objects ` " +"(normally :class:`bytes`) using the :meth:`update` method. At " +"any point you can ask it for the :dfn:`digest` of the concatenation of the " +"data fed to it so far using the :meth:`digest()` " +"or :meth:`hexdigest()` methods." msgstr "" "每種種類的 :dfn:`hash` 都有一個以其命名的建構函式方法。全部都會回傳具有相同簡" "單介面的雜湊物件。例如:可使用 :func:`sha256` 來建立 SHA-256 雜湊物件。現在你" @@ -74,45 +71,43 @@ msgstr "" "` 方法來要求它提供迄今為止傳遞給它的資料串聯的\\ :dfn:`摘要 " "(digest)`。" -#: ../../library/hashlib.rst:50 +#: ../../library/hashlib.rst:48 msgid "" "To allow multithreading, the Python :term:`GIL` is released while computing " -"a hash supplied more than 2047 bytes of data at once in its constructor or :" -"meth:`.update` method." +"a hash supplied more than 2047 bytes of data at once in its constructor " +"or :meth:`.update` method." msgstr "" "為了允許多執行緒 (multithreading),Python :term:`GIL` 被釋放,同時在其建構函" "式或 :meth:`.update` 方法中計算一次提供超過 2047 位元組資料的雜" "湊值。" -#: ../../library/hashlib.rst:57 +#: ../../library/hashlib.rst:55 msgid "" -"Constructors for hash algorithms that are always present in this module are :" -"func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, :func:" -"`sha512`, :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:" -"`sha3_512`, :func:`shake_128`, :func:`shake_256`, :func:`blake2b`, and :func:" -"`blake2s`. :func:`md5` is normally available as well, though it may be " -"missing or blocked if you are using a rare \"FIPS compliant\" build of " -"Python. These correspond to :data:`algorithms_guaranteed`." +"Constructors for hash algorithms that are always present in this module " +"are :func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, :func:`sha512`, :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256`, :func:`blake2b`, " +"and :func:`blake2s`. :func:`md5` is normally available as well, though it " +"may be missing or blocked if you are using a rare \"FIPS compliant\" build " +"of Python. These correspond to :data:`algorithms_guaranteed`." msgstr "" -"此模組中始終存在的雜湊演算法之建構函式有 :func:`sha1`、:func:`sha224`、:func:" -"`sha256`、:func:`sha384`、:func:`sha512`、:func:`sha3_224`、:func:" -"`sha3_256`、:func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:" -"`shake_256`、:func:`blake2b` 和 :func:`blake2s`。:func:`md5` 通常也可用,但如" -"果你使用罕見的「符合 FIPS (FIPS compliant)」的 Python 建置版本,它可能不存在" -"或者不被允許使用。以上會對應到 :data:`algorithms_guaranteed`。" +"此模組中始終存在的雜湊演算法之建構函式" +"有 :func:`sha1`、:func:`sha224`、:func:`sha256`、:func:`sha384`、:func:`sha512`、:func:`sha3_224`、:func:`sha3_256`、:func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:`shake_256`、:func:`blake2b` " +"和 :func:`blake2s`。:func:`md5` 通常也可用,但如果你使用罕見的「符合 FIPS " +"(FIPS compliant)」的 Python 建置版本,它可能不存在或者不被允許使用。以上會對" +"應到 :data:`algorithms_guaranteed`。" -#: ../../library/hashlib.rst:65 +#: ../../library/hashlib.rst:63 msgid "" -"Additional algorithms may also be available if your Python distribution's :" -"mod:`hashlib` was linked against a build of OpenSSL that provides others. " -"Others *are not guaranteed available* on all installations and will only be " -"accessible by name via :func:`new`. See :data:`algorithms_available`." +"Additional algorithms may also be available if your Python " +"distribution's :mod:`hashlib` was linked against a build of OpenSSL that " +"provides others. Others *are not guaranteed available* on all installations " +"and will only be accessible by name via :func:`new`. " +"See :data:`algorithms_available`." msgstr "" "如果你的 Python 發行版的 :mod:`hashlib` 與提供其他演算法的 OpenSSL 版本鏈結," "也可能有其他演算法可用。其他則\\ *不保證可用*\\ 於在所有安裝上,並且只能以名" "稱來透過 :func:`new` 存取。請參閱 :data:`algorithms_available`。" -#: ../../library/hashlib.rst:72 +#: ../../library/hashlib.rst:70 msgid "" "Some algorithms have known hash collision weaknesses (including MD5 and " "SHA1). Refer to `Attacks on cryptographic hash algorithms`_ and the `hashlib-" @@ -122,17 +117,17 @@ msgstr "" "閱 `Attacks on cryptographic hash algorithms`_ 和本文件後面的\\ `也參考 " "`_\\ 部分。" -#: ../../library/hashlib.rst:76 +#: ../../library/hashlib.rst:74 msgid "" -"SHA3 (Keccak) and SHAKE constructors :func:`sha3_224`, :func:`sha3_256`, :" -"func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256` were " -"added. :func:`blake2b` and :func:`blake2s` were added." +"SHA3 (Keccak) and SHAKE " +"constructors :func:`sha3_224`, :func:`sha3_256`, :func:`sha3_384`, :func:`sha3_512`, :func:`shake_128`, :func:`shake_256` " +"were added. :func:`blake2b` and :func:`blake2s` were added." msgstr "" -"新增了 SHA3 (Keccak) 和 SHAKE 建構函式 :func:`sha3_224`、:func:`sha3_256`、:" -"func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:`shake_256`。也新" -"增了 :func:`blake2b` 和 :func:`blake2s`。" +"新增了 SHA3 (Keccak) 和 SHAKE 建構函" +"式 :func:`sha3_224`、:func:`sha3_256`、:func:`sha3_384`、:func:`sha3_512`、:func:`shake_128`、:func:`shake_256`。" +"也新增了 :func:`blake2b` 和 :func:`blake2s`。" -#: ../../library/hashlib.rst:84 +#: ../../library/hashlib.rst:82 msgid "" "All hashlib constructors take a keyword-only argument *usedforsecurity* with " "default value ``True``. A false value allows the use of insecure and blocked " @@ -145,11 +140,11 @@ msgstr "" "全 (insecure) 和阻塞的 (blocked) 雜湊演算法。``False`` 表示雜湊演算法未在安全" "情境中使用,例如作為一種非加密用途的單向壓縮函式。" -#: ../../library/hashlib.rst:91 +#: ../../library/hashlib.rst:89 msgid "Hashlib now uses SHA3 and SHAKE from OpenSSL if it provides it." msgstr "Hashlib 現在使用 OpenSSL 中的 SHA3 和 SHAKE(如果有提供的話)。" -#: ../../library/hashlib.rst:94 +#: ../../library/hashlib.rst:92 msgid "" "For any of the MD5, SHA1, SHA2, or SHA3 algorithms that the linked OpenSSL " "does not provide we fall back to a verified implementation from the `HACL\\* " @@ -158,18 +153,18 @@ msgstr "" "對於鏈結之 OpenSSL 未提供的任何 MD5、SHA1、SHA2 或 SHA3 演算法,我們會回退使" "用 `HACL\\* 專案 `_\\ 中經過驗證的實作。" -#: ../../library/hashlib.rst:100 +#: ../../library/hashlib.rst:98 msgid "Usage" msgstr "用法" -#: ../../library/hashlib.rst:102 +#: ../../library/hashlib.rst:100 msgid "" "To obtain the digest of the byte string ``b\"Nobody inspects the spammish " "repetition\"``::" msgstr "" "取得位元組字串 ``b\"Nobody inspects the spammish repetition\"`` 的摘要: ::" -#: ../../library/hashlib.rst:105 +#: ../../library/hashlib.rst:103 msgid "" ">>> import hashlib\n" ">>> m = hashlib.sha256()\n" @@ -177,8 +172,7 @@ msgid "" ">>> m.update(b\" the spammish repetition\")\n" ">>> m.digest()\n" "b'\\x03\\x1e\\xdd}Ae\\x15\\x93\\xc5\\xfe\\\\" -"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:" -"\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" +"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" ">>> m.hexdigest()\n" "'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'" msgstr "" @@ -188,20 +182,19 @@ msgstr "" ">>> m.update(b\" the spammish repetition\")\n" ">>> m.digest()\n" "b'\\x03\\x1e\\xdd}Ae\\x15\\x93\\xc5\\xfe\\\\" -"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:" -"\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" +"\\x00o\\xa5u+7\\xfd\\xdf\\xf7\\xbcN\\x84:\\xa6\\xaf\\x0c\\x95\\x0fK\\x94\\x06'\n" ">>> m.hexdigest()\n" "'031edd7d41651593c5fe5c006fa5752b37fddff7bc4e843aa6af0c950f4b9406'" -#: ../../library/hashlib.rst:114 +#: ../../library/hashlib.rst:112 msgid "More condensed:" msgstr "更濃縮:" -#: ../../library/hashlib.rst:120 +#: ../../library/hashlib.rst:118 msgid "Constructors" msgstr "建構函式" -#: ../../library/hashlib.rst:124 +#: ../../library/hashlib.rst:122 msgid "" "Is a generic constructor that takes the string *name* of the desired " "algorithm as its first parameter. It also exists to allow access to the " @@ -211,25 +204,25 @@ msgstr "" "是一個通用建構函式,它將目標演算法的字串 *name* 作為其第一個參數。它還允許使" "用者取得上面列出的雜湊值以及 OpenSSL 函式庫可能提供的任何其他演算法。" -#: ../../library/hashlib.rst:129 +#: ../../library/hashlib.rst:127 msgid "Using :func:`new` with an algorithm name:" msgstr "使用 :func:`new` 和演算法名稱:" -#: ../../library/hashlib.rst:148 +#: ../../library/hashlib.rst:146 msgid "" "Named constructors such as these are faster than passing an algorithm name " "to :func:`new`." msgstr "諸如此類的附名建構函式比將演算法名稱傳遞給 :func:`new` 更快。" -#: ../../library/hashlib.rst:152 +#: ../../library/hashlib.rst:150 msgid "Attributes" msgstr "屬性" -#: ../../library/hashlib.rst:154 +#: ../../library/hashlib.rst:152 msgid "Hashlib provides the following constant module attributes:" msgstr "Hashlib 提供以下常數模組屬性:" -#: ../../library/hashlib.rst:158 +#: ../../library/hashlib.rst:156 msgid "" "A set containing the names of the hash algorithms guaranteed to be supported " "by this module on all platforms. Note that 'md5' is in this list despite " @@ -240,41 +233,41 @@ msgstr "" "列表中,儘管有一些上游供應商提供了奇怪的「符合 FIPS (FIPS compliant)」的 " "Python 建置,並將其排除在外。" -#: ../../library/hashlib.rst:167 +#: ../../library/hashlib.rst:165 msgid "" "A set containing the names of the hash algorithms that are available in the " -"running Python interpreter. These names will be recognized when passed to :" -"func:`new`. :attr:`algorithms_guaranteed` will always be a subset. The " +"running Python interpreter. These names will be recognized when passed " +"to :func:`new`. :attr:`algorithms_guaranteed` will always be a subset. The " "same algorithm may appear multiple times in this set under different names " "(thanks to OpenSSL)." msgstr "" -"包含正在運行的 Python 直譯器中可用的雜湊演算法名稱的集合。這些名稱在傳遞給 :" -"func:`new` 時將被識別。:attr:`algorithms_guaranteed` 都會是它的一個子集。相同" -"的演算法可能會以不同的名稱多次出現在該集合中(多虧了 OpenSSL)。" +"包含正在運行的 Python 直譯器中可用的雜湊演算法名稱的集合。這些名稱在傳遞" +"給 :func:`new` 時將被識別。:attr:`algorithms_guaranteed` 都會是它的一個子集。" +"相同的演算法可能會以不同的名稱多次出現在該集合中(多虧了 OpenSSL)。" -#: ../../library/hashlib.rst:176 +#: ../../library/hashlib.rst:174 msgid "Hash Objects" msgstr "雜湊物件" -#: ../../library/hashlib.rst:178 +#: ../../library/hashlib.rst:176 msgid "" "The following values are provided as constant attributes of the hash objects " "returned by the constructors:" msgstr "以下的值皆為建構函式回傳之雜湊物件的常數屬性:" -#: ../../library/hashlib.rst:183 +#: ../../library/hashlib.rst:181 msgid "The size of the resulting hash in bytes." msgstr "生成雜湊的大小(以位元組為單位)。" -#: ../../library/hashlib.rst:187 +#: ../../library/hashlib.rst:185 msgid "The internal block size of the hash algorithm in bytes." msgstr "雜湊演算法的內部區塊大小(以位元組為單位)。" -#: ../../library/hashlib.rst:189 +#: ../../library/hashlib.rst:187 msgid "A hash object has the following attributes:" msgstr "雜湊物件具有以下屬性:" -#: ../../library/hashlib.rst:193 +#: ../../library/hashlib.rst:191 msgid "" "The canonical name of this hash, always lowercase and always suitable as a " "parameter to :func:`new` to create another hash of this type." @@ -282,7 +275,7 @@ msgstr "" "該雜湊的規範名稱,都會是小寫,且都會適合作為 :func:`new` 的參數以建立此型別的" "另一個雜湊。" -#: ../../library/hashlib.rst:196 +#: ../../library/hashlib.rst:194 msgid "" "The name attribute has been present in CPython since its inception, but " "until Python 3.4 was not formally specified, so may not exist on some " @@ -291,30 +284,31 @@ msgstr "" "name 屬性自 CPython 誕生以來就存在於其中,但直到 Python 3.4 才正式確立,因此" "在某些平台上可能不存在。" -#: ../../library/hashlib.rst:201 +#: ../../library/hashlib.rst:199 msgid "A hash object has the following methods:" msgstr "雜湊物件具有以下方法:" -#: ../../library/hashlib.rst:206 +#: ../../library/hashlib.rst:204 msgid "" "Update the hash object with the :term:`bytes-like object`. Repeated calls " "are equivalent to a single call with the concatenation of all the arguments: " "``m.update(a); m.update(b)`` is equivalent to ``m.update(a+b)``." msgstr "" "使用\\ :term:`類位元組物件 `\\ 來更新雜湊物件。重複呼叫相" -"當於連接所有引數的單一呼叫:``m.update(a); m.update(b)`` 等價於 ``m." -"update(a+b)``。" +"當於連接所有引數的單一呼叫:``m.update(a); m.update(b)`` 等價於 " +"``m.update(a+b)``。" -#: ../../library/hashlib.rst:214 +#: ../../library/hashlib.rst:212 msgid "" "Return the digest of the data passed to the :meth:`update` method so far. " "This is a bytes object of size :attr:`digest_size` which may contain bytes " "in the whole range from 0 to 255." msgstr "" -"回傳目前有傳遞給 :meth:`update` 方法的資料之摘要。這是一個大小為 :attr:" -"`digest_size` 的位元組物件,它可能包含從 0 到 255 的整個範圍內的位元組。" +"回傳目前有傳遞給 :meth:`update` 方法的資料之摘要。這是一個大小" +"為 :attr:`digest_size` 的位元組物件,它可能包含從 0 到 255 的整個範圍內的位元" +"組。" -#: ../../library/hashlib.rst:221 +#: ../../library/hashlib.rst:219 msgid "" "Like :meth:`digest` except the digest is returned as a string object of " "double length, containing only hexadecimal digits. This may be used to " @@ -323,7 +317,7 @@ msgstr "" "與 :meth:`digest` 類似,只不過摘要會是作為雙倍長度的字串物件回傳,僅包含十六" "進位數字。這可用於在電子郵件或其他非二進位環境中安全地交換值。" -#: ../../library/hashlib.rst:228 +#: ../../library/hashlib.rst:226 msgid "" "Return a copy (\"clone\") of the hash object. This can be used to " "efficiently compute the digests of data sharing a common initial substring." @@ -331,11 +325,11 @@ msgstr "" "回傳雜湊物件的副本(「複製 (clone)」),這可用於高效率地計算出共享同一初始子" "字串的資料之摘要。" -#: ../../library/hashlib.rst:233 +#: ../../library/hashlib.rst:231 msgid "SHAKE variable length digests" msgstr "SHAKE 可變長度摘要" -#: ../../library/hashlib.rst:238 +#: ../../library/hashlib.rst:236 msgid "" "The :func:`shake_128` and :func:`shake_256` algorithms provide variable " "length digests with length_in_bits//2 up to 128 or 256 bits of security. As " @@ -346,7 +340,7 @@ msgstr "" "length_in_bits//2 最高為 128 或 256 位元安全性。因此,他們的摘要方法會需要長" "度。最大長度不受 SHAKE 演算法限制。" -#: ../../library/hashlib.rst:245 +#: ../../library/hashlib.rst:243 msgid "" "Return the digest of the data passed to the :meth:`~hash.update` method so " "far. This is a bytes object of size *length* which may contain bytes in the " @@ -355,7 +349,7 @@ msgstr "" "回傳目前有傳遞給 :meth:`~hash.update` 方法的資料之摘要。這是一個大小為 " "*length* 的位元組物件,可能包含從 0 到 255 的整個範圍內的位元組。" -#: ../../library/hashlib.rst:252 +#: ../../library/hashlib.rst:250 msgid "" "Like :meth:`digest` except the digest is returned as a string object of " "double length, containing only hexadecimal digits. This may be used to " @@ -364,15 +358,15 @@ msgstr "" "與 :meth:`digest` 類似,只不過摘要作為雙倍長度的字串物件回傳,僅包含十六進位" "數字。這可用於交換電子郵件或其他非二進位環境中的值。" -#: ../../library/hashlib.rst:256 +#: ../../library/hashlib.rst:254 msgid "Example use:" msgstr "範例:" -#: ../../library/hashlib.rst:263 +#: ../../library/hashlib.rst:261 msgid "File hashing" msgstr "檔案雜湊" -#: ../../library/hashlib.rst:265 +#: ../../library/hashlib.rst:263 msgid "" "The hashlib module provides a helper function for efficient hashing of a " "file or file-like object." @@ -380,28 +374,36 @@ msgstr "" "hashlib 模組提供了一個輔助函式,用於對檔案或類檔案物件 (file-like object) 進" "行有效率的雜湊。" -#: ../../library/hashlib.rst:270 +#: ../../library/hashlib.rst:268 msgid "" "Return a digest object that has been updated with contents of file object." msgstr "回傳已用檔案物件內容更新的摘要物件。" -#: ../../library/hashlib.rst:272 +#: ../../library/hashlib.rst:270 msgid "" "*fileobj* must be a file-like object opened for reading in binary mode. It " "accepts file objects from builtin :func:`open`, :class:`~io.BytesIO` " "instances, SocketIO objects from :meth:`socket.socket.makefile`, and " -"similar. The function may bypass Python's I/O and use the file descriptor " +"similar. *fileobj* must be opened in blocking mode, otherwise " +"a :exc:`BlockingIOError` may be raised." +msgstr "" +"*fileobj* 必須是以二進位模式讀取的類檔案物件。它接受來自內建 :func:`open` 的" +"檔案物件、:class:`~io.BytesIO` 實例、來自 :meth:`socket.socket.makefile` 的 " +"SocketIO 物件等。*fileobj* 必須以阻塞模式開啟,否則可能會引" +"發 :exc:`BlockingIOError`。" + +#: ../../library/hashlib.rst:276 +msgid "" +"The function may bypass Python's I/O and use the file descriptor " "from :meth:`~io.IOBase.fileno` directly. *fileobj* must be assumed to be in " "an unknown state after this function returns or raises. It is up to the " "caller to close *fileobj*." msgstr "" -"*fileobj* 必須是以二進位模式讀取的類檔案物件。它接受來自內建 :func:`open` 的" -"檔案物件、:class:`~io.BytesIO` 實例、來自 :meth:`socket.socket.makefile` 的 " -"SocketIO 物件等。該函式可以繞過 Python 的 I/O 並直接使用 :meth:`~io.IOBase." -"fileno` 中的檔案描述器 (file descriptor)。在此函式回傳或引發後,必須假定 " -"*fileobj* 處於未知狀態 (unknown state)。由呼叫者決定是否關閉 *fileobj*。" +"該函式可以繞過 Python 的 I/O 並直接使用 :meth:`~io.IOBase.fileno` 中的檔案描" +"述器 (file descriptor)。在此函式回傳或引發後,必須假定 *fileobj* 處於未知狀" +"態 (unknown state)。由呼叫者決定是否關閉 *fileobj*。" -#: ../../library/hashlib.rst:280 +#: ../../library/hashlib.rst:281 msgid "" "*digest* must either be a hash algorithm name as a *str*, a hash " "constructor, or a callable that returns a hash object." @@ -409,15 +411,21 @@ msgstr "" "*digest* 必須是名稱作為 *str* 的雜湊演算法、雜湊建構函式或會回傳雜湊物件的可" "呼叫函式。" -#: ../../library/hashlib.rst:283 +#: ../../library/hashlib.rst:284 msgid "Example:" msgstr "範例:" -#: ../../library/hashlib.rst:306 +#: ../../library/hashlib.rst:305 +msgid "" +"Now raises a :exc:`BlockingIOError` if the file is opened in blocking mode. " +"Previously, spurious null bytes were added to the digest." +msgstr "" + +#: ../../library/hashlib.rst:311 msgid "Key derivation" msgstr "密鑰的生成" -#: ../../library/hashlib.rst:308 +#: ../../library/hashlib.rst:313 msgid "" "Key derivation and key stretching algorithms are designed for secure " "password hashing. Naive algorithms such as ``sha1(password)`` are not " @@ -430,7 +438,7 @@ msgstr "" "的密碼雜湊函式必須是可調校的 (tunable)、緩慢的,並且有包含 `salt(鹽) " "`_。" -#: ../../library/hashlib.rst:316 +#: ../../library/hashlib.rst:321 msgid "" "The function provides PKCS#5 password-based key derivation function 2. It " "uses HMAC as pseudorandom function." @@ -438,7 +446,7 @@ msgstr "" "該函式提供基於密碼的 PKCS#5 密鑰生成函式 2。它使用 HMAC 作為偽隨機函式 " "(pseudorandom function)。" -#: ../../library/hashlib.rst:319 +#: ../../library/hashlib.rst:324 msgid "" "The string *hash_name* is the desired name of the hash digest algorithm for " "HMAC, e.g. 'sha1' or 'sha256'. *password* and *salt* are interpreted as " @@ -448,10 +456,10 @@ msgid "" msgstr "" "字串 *hash_name* 是 HMAC 的雜湊摘要演算法所需的名稱,例如 ``sha1`` 或 " "``sha256``。*password* 和 *salt* 被直譯為位元組緩衝區。應用程式和函式庫應為 " -"*password* 設下合理的長度限制(例如 1024)。*salt* 應該是來自適當來源(例如 :" -"func:`os.urandom`)且大約 16 或更多位元組。" +"*password* 設下合理的長度限制(例如 1024)。*salt* 應該是來自適當來源(例" +"如 :func:`os.urandom`)且大約 16 或更多位元組。" -#: ../../library/hashlib.rst:325 +#: ../../library/hashlib.rst:330 msgid "" "The number of *iterations* should be chosen based on the hash algorithm and " "computing power. As of 2022, hundreds of thousands of iterations of SHA-256 " @@ -464,7 +472,7 @@ msgstr "" "讀 NIST-SP-800-132_ 的 *Appendix A.2.2*。`stackexchange pbkdf2 疊代問題`_\\ " "上的答案有詳細解釋。" -#: ../../library/hashlib.rst:331 +#: ../../library/hashlib.rst:336 msgid "" "*dklen* is the length of the derived key in bytes. If *dklen* is ``None`` " "then the digest size of the hash algorithm *hash_name* is used, e.g. 64 for " @@ -473,11 +481,11 @@ msgstr "" "*dklen* 是生成的密鑰長度。如果 *dklen* 為 ``None``,則會使用雜湊演算法 " "*hash_name* 的摘要大小,例如 SHA-512 為 64。" -#: ../../library/hashlib.rst:340 +#: ../../library/hashlib.rst:345 msgid "Function only available when Python is compiled with OpenSSL." msgstr "僅當有使用 OpenSSL 編譯 Python 時該函式才可用。" -#: ../../library/hashlib.rst:344 +#: ../../library/hashlib.rst:349 msgid "" "Function now only available when Python is built with OpenSSL. The slow pure " "Python implementation has been removed." @@ -485,13 +493,13 @@ msgstr "" "該函式現在僅在有使用 OpenSSL 建置 Python 時可用。緩慢的純 Python 實作已被刪" "除。" -#: ../../library/hashlib.rst:350 +#: ../../library/hashlib.rst:355 msgid "" "The function provides scrypt password-based key derivation function as " "defined in :rfc:`7914`." msgstr "該函式提供(如 :rfc:`7914` 中所定義的)scrypt 基於密碼的密鑰衍生函式。" -#: ../../library/hashlib.rst:353 +#: ../../library/hashlib.rst:358 msgid "" "*password* and *salt* must be :term:`bytes-like objects `. Applications and libraries should limit *password* to a sensible " @@ -502,7 +510,7 @@ msgstr "" "程式和函式庫應為 *password* 設下合理的長度限制(例如 1024)。*salt* 應該是來" "自適當來源(例如 :func:`os.urandom`)且大約 16 或更多位元組。" -#: ../../library/hashlib.rst:358 +#: ../../library/hashlib.rst:363 msgid "" "*n* is the CPU/Memory cost factor, *r* the block size, *p* parallelization " "factor and *maxmem* limits memory (OpenSSL 1.1.0 defaults to 32 MiB). " @@ -511,17 +519,17 @@ msgstr "" "*n* 是 CPU/記憶體開銷係數、*r* 是區塊大小、*p* 為平行化係數、*maxmem* 為記憶" "體限制(OpenSSL 1.1.0 預設為 32 MiB)。*dklen* 是生成密鑰的長度。" -#: ../../library/hashlib.rst:368 +#: ../../library/hashlib.rst:373 msgid "BLAKE2" msgstr "BLAKE2" -#: ../../library/hashlib.rst:375 +#: ../../library/hashlib.rst:380 msgid "" "BLAKE2_ is a cryptographic hash function defined in :rfc:`7693` that comes " "in two flavors:" msgstr "BLAKE2_ 是在 :rfc:`7693` 中定義的加密雜湊函式,有兩種類型:" -#: ../../library/hashlib.rst:378 +#: ../../library/hashlib.rst:383 msgid "" "**BLAKE2b**, optimized for 64-bit platforms and produces digests of any size " "between 1 and 64 bytes," @@ -529,7 +537,7 @@ msgstr "" "**BLAKE2b**,針對 64 位元平台進行了最佳化,可生成 1 到 64 位元組之間任意大小" "的摘要," -#: ../../library/hashlib.rst:381 +#: ../../library/hashlib.rst:386 msgid "" "**BLAKE2s**, optimized for 8- to 32-bit platforms and produces digests of " "any size between 1 and 32 bytes." @@ -537,7 +545,7 @@ msgstr "" "**BLAKE2s**,針對 8 至 32 位元平台進行了最佳化,可生成 1 至 32 位元組之間任意" "大小的摘要。" -#: ../../library/hashlib.rst:384 +#: ../../library/hashlib.rst:389 msgid "" "BLAKE2 supports **keyed mode** (a faster and simpler replacement for HMAC_), " "**salted hashing**, **personalization**, and **tree hashing**." @@ -545,21 +553,21 @@ msgstr "" "BLAKE2 支援\\ **密鑰模式 (keyed mode)** (更快、更簡單的 HMAC_ 替代品)、**加" "鹽雜湊 (salted hashing)**、**個人化**\\ 和\\ **樹狀雜湊**。" -#: ../../library/hashlib.rst:387 +#: ../../library/hashlib.rst:392 msgid "" -"Hash objects from this module follow the API of standard library's :mod:" -"`hashlib` objects." +"Hash objects from this module follow the API of standard " +"library's :mod:`hashlib` objects." msgstr "該模組中的雜湊物件遵循標準函式庫的 :mod:`hashlib` 物件 API。" -#: ../../library/hashlib.rst:392 +#: ../../library/hashlib.rst:397 msgid "Creating hash objects" msgstr "建立雜湊物件" -#: ../../library/hashlib.rst:394 +#: ../../library/hashlib.rst:399 msgid "New hash objects are created by calling constructor functions:" msgstr "新的雜湊物件是透過呼叫建構函式建立的:" -#: ../../library/hashlib.rst:408 +#: ../../library/hashlib.rst:413 msgid "" "These functions return the corresponding hash objects for calculating " "BLAKE2b or BLAKE2s. They optionally take these general parameters:" @@ -567,7 +575,7 @@ msgstr "" "這些函式回傳相應的雜湊物件以計算 BLAKE2b 或 BLAKE2s。他們可以選擇採用這些通用" "參數:" -#: ../../library/hashlib.rst:411 +#: ../../library/hashlib.rst:416 msgid "" "*data*: initial chunk of data to hash, which must be :term:`bytes-like " "object`. It can be passed only as positional argument." @@ -575,18 +583,18 @@ msgstr "" "*data*:要雜湊的初始資料塊 (data chunk),它必須是\\ :term:`類位元組物件 " "`。它只能作為位置引數傳遞。" -#: ../../library/hashlib.rst:414 +#: ../../library/hashlib.rst:419 msgid "*digest_size*: size of output digest in bytes." msgstr "*digest_size*:輸出摘要的大小(以位元組為單位)。" -#: ../../library/hashlib.rst:416 +#: ../../library/hashlib.rst:421 msgid "" "*key*: key for keyed hashing (up to 64 bytes for BLAKE2b, up to 32 bytes for " "BLAKE2s)." msgstr "" "*key*:用於密鑰雜湊的密鑰(BLAKE2b 最多 64 位元組、BLAKE2s 最多 32 位元組)。" -#: ../../library/hashlib.rst:419 +#: ../../library/hashlib.rst:424 msgid "" "*salt*: salt for randomized hashing (up to 16 bytes for BLAKE2b, up to 8 " "bytes for BLAKE2s)." @@ -594,62 +602,62 @@ msgstr "" "*salt*:用於隨機雜湊的鹽(BLAKE2b 最多 16 個位元組、BLAKE2s 最多 8 個位元" "組)。" -#: ../../library/hashlib.rst:422 +#: ../../library/hashlib.rst:427 msgid "" "*person*: personalization string (up to 16 bytes for BLAKE2b, up to 8 bytes " "for BLAKE2s)." msgstr "" "*person*:個人化字串(BLAKE2b 最多 16 個位元組、BLAKE2s 最多 8 個位元組)。" -#: ../../library/hashlib.rst:425 +#: ../../library/hashlib.rst:430 msgid "The following table shows limits for general parameters (in bytes):" msgstr "下表顯示了一般參數的限制(以位元組為單位):" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:433 msgid "Hash" msgstr "雜湊" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:433 msgid "digest_size" msgstr "digest_size" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:433 msgid "len(key)" msgstr "len(key)" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:433 msgid "len(salt)" msgstr "len(salt)" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:433 msgid "len(person)" msgstr "len(person)" -#: ../../library/hashlib.rst:430 +#: ../../library/hashlib.rst:435 msgid "BLAKE2b" msgstr "BLAKE2b" -#: ../../library/hashlib.rst:430 +#: ../../library/hashlib.rst:435 msgid "64" msgstr "64" -#: ../../library/hashlib.rst:430 +#: ../../library/hashlib.rst:435 msgid "16" msgstr "16" -#: ../../library/hashlib.rst:431 +#: ../../library/hashlib.rst:436 msgid "BLAKE2s" msgstr "BLAKE2s" -#: ../../library/hashlib.rst:431 +#: ../../library/hashlib.rst:436 msgid "32" msgstr "32" -#: ../../library/hashlib.rst:431 +#: ../../library/hashlib.rst:436 msgid "8" msgstr "8" -#: ../../library/hashlib.rst:436 +#: ../../library/hashlib.rst:441 msgid "" "BLAKE2 specification defines constant lengths for salt and personalization " "parameters, however, for convenience, this implementation accepts byte " @@ -663,26 +671,26 @@ msgstr "" "以像是 ``b'salt`` 和 ``b'salt\\x00`` 是相同的值。(但 *key* 的情況並非如" "此。)" -#: ../../library/hashlib.rst:443 +#: ../../library/hashlib.rst:448 msgid "These sizes are available as module `constants`_ described below." msgstr "這些大小可作為模組\\ `常數 `_\\ 使用,如下所述。" -#: ../../library/hashlib.rst:445 +#: ../../library/hashlib.rst:450 msgid "" "Constructor functions also accept the following tree hashing parameters:" msgstr "建構函式還接受以下樹狀雜湊參數:" -#: ../../library/hashlib.rst:447 +#: ../../library/hashlib.rst:452 msgid "*fanout*: fanout (0 to 255, 0 if unlimited, 1 in sequential mode)." msgstr "*fanout*:扇出(0 到 255,如果無限制則為 0、順序模式為 1)。" -#: ../../library/hashlib.rst:449 +#: ../../library/hashlib.rst:454 msgid "" "*depth*: maximal depth of tree (1 to 255, 255 if unlimited, 1 in sequential " "mode)." msgstr "*depth*:樹的最大深度(1 到 255,如果無限制則為 255、順序模式為 1)。" -#: ../../library/hashlib.rst:452 +#: ../../library/hashlib.rst:457 msgid "" "*leaf_size*: maximal byte length of leaf (0 to ``2**32-1``, 0 if unlimited " "or in sequential mode)." @@ -690,7 +698,7 @@ msgstr "" "*leaf_size*:葉的最大位元組長度(0 到 ``2**32-1``,如果無限制或處於順序模式則" "為 0)。" -#: ../../library/hashlib.rst:455 +#: ../../library/hashlib.rst:460 msgid "" "*node_offset*: node offset (0 to ``2**64-1`` for BLAKE2b, 0 to ``2**48-1`` " "for BLAKE2s, 0 for the first, leftmost, leaf, or in sequential mode)." @@ -698,12 +706,12 @@ msgstr "" "*node_offset*:節點偏移量(BLAKE2b 為 0 到 ``2**64-1``,BLAKE2s 為 0 到 " "``2**48-1``,0 表示第一個、最左邊、葉子或在順序模式下)。" -#: ../../library/hashlib.rst:458 +#: ../../library/hashlib.rst:463 msgid "" "*node_depth*: node depth (0 to 255, 0 for leaves, or in sequential mode)." msgstr "*node_depth*:節點深度(0 到 255,葉為 0,或在順序模式下)。" -#: ../../library/hashlib.rst:460 +#: ../../library/hashlib.rst:465 msgid "" "*inner_size*: inner digest size (0 to 64 for BLAKE2b, 0 to 32 for BLAKE2s, 0 " "in sequential mode)." @@ -711,18 +719,18 @@ msgstr "" "*inner_size*:內部摘要大小(BLAKE2b 為 0 到 64,BLAKE2s 為 0 到 32,順序模式" "為 0)。" -#: ../../library/hashlib.rst:463 +#: ../../library/hashlib.rst:468 msgid "" "*last_node*: boolean indicating whether the processed node is the last one " "(``False`` for sequential mode)." msgstr "" "*last_node*:布林值,代表處理的節點是否為最後一個(``False`` 代表順序模式)。" -#: ../../library/hashlib.rst:466 +#: ../../library/hashlib.rst:471 msgid "Explanation of tree mode parameters." msgstr "樹狀模式參數說明。" -#: ../../library/hashlib.rst:470 +#: ../../library/hashlib.rst:475 msgid "" "See section 2.10 in `BLAKE2 specification `_ for comprehensive review of tree hashing." @@ -730,49 +738,51 @@ msgstr "" "關於樹狀雜湊的綜合回顧,請參閱 `BLAKE2 規範 `_\\ 中的第 2.10 節。" -#: ../../library/hashlib.rst:476 +#: ../../library/hashlib.rst:481 msgid "Constants" msgstr "常數" -#: ../../library/hashlib.rst:481 +#: ../../library/hashlib.rst:486 msgid "Salt length (maximum length accepted by constructors)." msgstr "鹽長度(建構函式接受的最大長度)。" -#: ../../library/hashlib.rst:487 +#: ../../library/hashlib.rst:492 msgid "" "Personalization string length (maximum length accepted by constructors)." msgstr "個人化字串長度(建構函式接受的最大長度)。" -#: ../../library/hashlib.rst:493 +#: ../../library/hashlib.rst:498 msgid "Maximum key size." msgstr "最大密鑰大小。" -#: ../../library/hashlib.rst:499 +#: ../../library/hashlib.rst:504 msgid "Maximum digest size that the hash function can output." msgstr "雜湊函式可以輸出的最大摘要大小。" -#: ../../library/hashlib.rst:503 +#: ../../library/hashlib.rst:508 msgid "Examples" msgstr "範例" -#: ../../library/hashlib.rst:506 +#: ../../library/hashlib.rst:511 msgid "Simple hashing" msgstr "簡單雜湊" -#: ../../library/hashlib.rst:508 +#: ../../library/hashlib.rst:513 msgid "" "To calculate hash of some data, you should first construct a hash object by " -"calling the appropriate constructor function (:func:`blake2b` or :func:" -"`blake2s`), then update it with the data by calling :meth:`~hash.update` on " -"the object, and, finally, get the digest out of the object by calling :meth:" -"`~hash.digest` (or :meth:`~hash.hexdigest` for hex-encoded string)." +"calling the appropriate constructor function (:func:`blake2b` " +"or :func:`blake2s`), then update it with the data by " +"calling :meth:`~hash.update` on the object, and, finally, get the digest out " +"of the object by calling :meth:`~hash.digest` (or :meth:`~hash.hexdigest` " +"for hex-encoded string)." msgstr "" "要計算某些資料的雜湊值,你應該首先透過呼叫適當的建構函式(:func:`blake2b` " -"或 :func:`blake2s`)以建構一個雜湊物件,然後透過於物件呼叫 :meth:`~hash." -"update` 來以資料對它更新,最後透過呼叫 :meth:`~hash.digest`\\ (或對於十六進" -"位編碼字串則為 :meth:`~hash.hexdigest`)從物件中獲得摘要。" +"或 :func:`blake2s`)以建構一個雜湊物件,然後透過於物件呼" +"叫 :meth:`~hash.update` 來以資料對它更新,最後透過呼" +"叫 :meth:`~hash.digest`\\ (或對於十六進位編碼字串則" +"為 :meth:`~hash.hexdigest`)從物件中獲得摘要。" -#: ../../library/hashlib.rst:521 +#: ../../library/hashlib.rst:526 msgid "" "As a shortcut, you can pass the first chunk of data to update directly to " "the constructor as the positional argument:" @@ -780,17 +790,17 @@ msgstr "" "作為一個快捷方式,你可以將要更新的第一個資料塊作為位置引數直接傳遞給建構函" "式:" -#: ../../library/hashlib.rst:528 +#: ../../library/hashlib.rst:533 msgid "" "You can call :meth:`hash.update` as many times as you need to iteratively " "update the hash:" msgstr "你可以根據需求來多次呼叫 :meth:`hash.update` 以疊代更新雜湊:" -#: ../../library/hashlib.rst:542 +#: ../../library/hashlib.rst:547 msgid "Using different digest sizes" msgstr "使用不同的摘要大小" -#: ../../library/hashlib.rst:544 +#: ../../library/hashlib.rst:549 msgid "" "BLAKE2 has configurable size of digests up to 64 bytes for BLAKE2b and up to " "32 bytes for BLAKE2s. For example, to replace SHA-1 with BLAKE2b without " @@ -800,7 +810,7 @@ msgstr "" "組。例如,要在不改變輸出大小的情況下用 BLAKE2b 替換 SHA-1,我們可以指定 " "BLAKE2b 生成 20 位元組的摘要:" -#: ../../library/hashlib.rst:558 +#: ../../library/hashlib.rst:563 msgid "" "Hash objects with different digest sizes have completely different outputs " "(shorter hashes are *not* prefixes of longer hashes); BLAKE2b and BLAKE2s " @@ -809,23 +819,23 @@ msgstr "" "具有不同摘要大小的雜湊物件具有完全不同的輸出(較短的雜湊值\\ *不是*\\ 較長雜" "湊值的前綴);即使輸出長度相同,BLAKE2b 和 BLAKE2s 也會產生不同的輸出:" -#: ../../library/hashlib.rst:574 +#: ../../library/hashlib.rst:579 msgid "Keyed hashing" msgstr "密鑰雜湊 (Keyed hashing)" -#: ../../library/hashlib.rst:576 +#: ../../library/hashlib.rst:581 msgid "" "Keyed hashing can be used for authentication as a faster and simpler " -"replacement for `Hash-based message authentication code `_ (HMAC). BLAKE2 can be securely used in prefix-MAC " -"mode thanks to the indifferentiability property inherited from BLAKE." +"replacement for `Hash-based message authentication code `_ (HMAC). BLAKE2 can be securely used in prefix-" +"MAC mode thanks to the indifferentiability property inherited from BLAKE." msgstr "" "密鑰雜湊可用於身份驗證,作為\\ `基於雜湊的訊息驗證碼 (Hash-based message " "authentication code) `_ (HMAC) 的更快、" "更簡單的替代方案。由於繼承自 BLAKE 的不可微特性 (indifferentiability " "property),BLAKE2 可以安全地用於 prefix-MAC 模式。" -#: ../../library/hashlib.rst:582 +#: ../../library/hashlib.rst:587 msgid "" "This example shows how to get a (hex-encoded) 128-bit authentication code " "for message ``b'message data'`` with key ``b'pseudorandom key'``::" @@ -833,7 +843,7 @@ msgstr "" "此範例示範了如何使用密鑰 ``b'pseudorandom key'`` 取得訊息 ``b'message " "data'`` 的(十六進位編碼)128 位元驗證碼: ::" -#: ../../library/hashlib.rst:585 +#: ../../library/hashlib.rst:590 msgid "" ">>> from hashlib import blake2b\n" ">>> h = blake2b(key=b'pseudorandom key', digest_size=16)\n" @@ -847,7 +857,7 @@ msgstr "" ">>> h.hexdigest()\n" "'3d363ff7401e02026f4a4687d4863ced'" -#: ../../library/hashlib.rst:592 +#: ../../library/hashlib.rst:597 msgid "" "As a practical example, a web application can symmetrically sign cookies " "sent to users and later verify them to make sure they weren't tampered with::" @@ -855,7 +865,7 @@ msgstr "" "舉一個實際的例子,網頁應用程式可以對發送給使用者的 cookie 進行對稱簽名 " "(symmetrically sign),然後驗證它們以確保它們沒有被篡改: ::" -#: ../../library/hashlib.rst:595 +#: ../../library/hashlib.rst:600 msgid "" ">>> from hashlib import blake2b\n" ">>> from hmac import compare_digest\n" @@ -909,7 +919,7 @@ msgstr "" ">>> verify(cookie, b'0102030405060708090a0b0c0d0e0f00')\n" "False" -#: ../../library/hashlib.rst:621 +#: ../../library/hashlib.rst:626 msgid "" "Even though there's a native keyed hashing mode, BLAKE2 can, of course, be " "used in HMAC construction with :mod:`hmac` module::" @@ -917,7 +927,7 @@ msgstr "" "儘管有原生密鑰雜湊模式,BLAKE2 還是可以透過 :mod:`hmac` 模組用於建構 " "HMAC: ::" -#: ../../library/hashlib.rst:624 +#: ../../library/hashlib.rst:629 msgid "" ">>> import hmac, hashlib\n" ">>> m = hmac.new(b'secret key', digestmod=hashlib.blake2s)\n" @@ -931,11 +941,11 @@ msgstr "" ">>> m.hexdigest()\n" "'e3c8102868d28b5ff85fc35dda07329970d1a01e273c37481326fe0c861c8142'" -#: ../../library/hashlib.rst:632 +#: ../../library/hashlib.rst:637 msgid "Randomized hashing" msgstr "隨機雜湊 (Randomized hashing)" -#: ../../library/hashlib.rst:634 +#: ../../library/hashlib.rst:639 msgid "" "By setting *salt* parameter users can introduce randomization to the hash " "function. Randomized hashing is useful for protecting against collision " @@ -944,7 +954,7 @@ msgstr "" "透過設定 *salt* 參數,使用者可以向雜湊函式引入隨機化。隨機雜湊在防止針對數位" "簽章中雜湊函式的碰撞攻擊 (collision attacks) 非常有用。" -#: ../../library/hashlib.rst:638 +#: ../../library/hashlib.rst:643 msgid "" "Randomized hashing is designed for situations where one party, the message " "preparer, generates all or part of a message to be signed by a second party, " @@ -975,7 +985,7 @@ msgstr "" "的所有部分都是由簽名者所準備好的,使用隨機雜湊可能會降低數位簽章提供的安全" "性。" -#: ../../library/hashlib.rst:657 +#: ../../library/hashlib.rst:662 msgid "" "(`NIST SP-800-106 \"Randomized Hashing for Digital Signatures\" `_)" @@ -983,7 +993,7 @@ msgstr "" "(`NIST SP-800-106 「數位簽章的隨機雜湊 (Randomized Hashing for Digital " "Signatures)」 `_)" -#: ../../library/hashlib.rst:660 +#: ../../library/hashlib.rst:665 msgid "" "In BLAKE2 the salt is processed as a one-time input to the hash function " "during initialization, rather than as an input to each compression function." @@ -991,7 +1001,7 @@ msgstr "" "在 BLAKE2 中,鹽在初始化期間作為雜湊函式的一次性輸入被處理,而不是作為每個壓" "縮函式的輸入。" -#: ../../library/hashlib.rst:665 +#: ../../library/hashlib.rst:670 msgid "" "*Salted hashing* (or just hashing) with BLAKE2 or any other general-purpose " "cryptographic hash function, such as SHA-256, is not suitable for hashing " @@ -1002,11 +1012,11 @@ msgstr "" "純雜湊)不適合對密碼進行雜湊處理。有關更多資訊,請參閱 `BLAKE2 FAQ `_ 。" -#: ../../library/hashlib.rst:688 +#: ../../library/hashlib.rst:693 msgid "Personalization" msgstr "個人化" -#: ../../library/hashlib.rst:690 +#: ../../library/hashlib.rst:695 msgid "" "Sometimes it is useful to force hash function to produce different digests " "for the same input for different purposes. Quoting the authors of the Skein " @@ -1015,7 +1025,7 @@ msgstr "" "有時候強制雜湊函式為不同目的的相同輸入生成不同的摘要是很有用的。引用 Skein 雜" "湊函式的作者的話:" -#: ../../library/hashlib.rst:694 +#: ../../library/hashlib.rst:699 msgid "" "We recommend that all application designers seriously consider doing this; " "we have seen many protocols where a hash that is computed in one part of the " @@ -1029,7 +1039,7 @@ msgstr "" "關的資料上完成的,並且攻擊者可以強制應用程式將雜湊輸入設為相同的。對協議中使" "用的每個雜湊函式進行個人化可以立即阻止此類攻擊。" -#: ../../library/hashlib.rst:701 +#: ../../library/hashlib.rst:706 msgid "" "(`The Skein Hash Function Family `_, p. 21)" @@ -1037,11 +1047,11 @@ msgstr "" "(`Skein 雜湊函式系列 `_,第 21 頁)" -#: ../../library/hashlib.rst:705 +#: ../../library/hashlib.rst:710 msgid "BLAKE2 can be personalized by passing bytes to the *person* argument::" msgstr "BLAKE2 可以透過將位元組傳遞給 *person* 引數來做個人化: ::" -#: ../../library/hashlib.rst:707 +#: ../../library/hashlib.rst:712 msgid "" ">>> from hashlib import blake2b\n" ">>> FILES_HASH_PERSON = b'MyApp Files Hash'\n" @@ -1067,21 +1077,21 @@ msgstr "" ">>> h.hexdigest()\n" "'cf68fb5761b9c44e7878bfb2c4c9aea52264a80b75005e65619778de59f383a3'" -#: ../../library/hashlib.rst:719 +#: ../../library/hashlib.rst:724 msgid "" "Personalization together with the keyed mode can also be used to derive " "different keys from a single one." msgstr "個人化與密鑰模式還可以一起用於從單個密鑰得出不同的密鑰。" -#: ../../library/hashlib.rst:733 +#: ../../library/hashlib.rst:738 msgid "Tree mode" msgstr "樹狀模式" -#: ../../library/hashlib.rst:735 +#: ../../library/hashlib.rst:740 msgid "Here's an example of hashing a minimal tree with two leaf nodes::" msgstr "下面是對具有兩個葉節點的最小樹進行雜湊處理的範例: ::" -#: ../../library/hashlib.rst:737 +#: ../../library/hashlib.rst:742 msgid "" " 10\n" " / \\\n" @@ -1091,13 +1101,13 @@ msgstr "" " / \\\n" "00 01" -#: ../../library/hashlib.rst:741 +#: ../../library/hashlib.rst:746 msgid "" "This example uses 64-byte internal digests, and returns the 32-byte final " "digest::" msgstr "此範例使用 64-byte 內部摘要,並回傳 32-byte 最終摘要: ::" -#: ../../library/hashlib.rst:744 +#: ../../library/hashlib.rst:749 msgid "" ">>> from hashlib import blake2b\n" ">>>\n" @@ -1151,11 +1161,11 @@ msgstr "" ">>> h10.hexdigest()\n" "'3ad2a9b37c6070e374c7a8c508fe20ca86b6ed54e286e93a0318e95e881db5aa'" -#: ../../library/hashlib.rst:771 +#: ../../library/hashlib.rst:776 msgid "Credits" msgstr "製作人員" -#: ../../library/hashlib.rst:773 +#: ../../library/hashlib.rst:778 msgid "" "BLAKE2_ was designed by *Jean-Philippe Aumasson*, *Samuel Neves*, *Zooko " "Wilcox-O'Hearn*, and *Christian Winnerlein* based on SHA-3_ finalist BLAKE_ " @@ -1167,13 +1177,13 @@ msgstr "" "Henzen*、*Willi Meier* 和 *Raphael C.-W. Phan* 所建立的 SHA-3_ 最終版本 " "BLAKE_。" -#: ../../library/hashlib.rst:778 +#: ../../library/hashlib.rst:783 msgid "" "It uses core algorithm from ChaCha_ cipher designed by *Daniel J. " "Bernstein*." msgstr "它使用 *Daniel J. Bernstein* 設計的 ChaCha_ 密碼的核心演算法。" -#: ../../library/hashlib.rst:780 +#: ../../library/hashlib.rst:785 msgid "" "The stdlib implementation is based on pyblake2_ module. It was written by " "*Dmitry Chestnykh* based on C implementation written by *Samuel Neves*. The " @@ -1183,17 +1193,17 @@ msgstr "" "Neves* 的 C 版本實作為基礎所編寫的。該文件是由 *Dmitry Chestnykh* 編寫並從 " "pyblake2_ 複製過來的。" -#: ../../library/hashlib.rst:784 +#: ../../library/hashlib.rst:789 msgid "The C code was partly rewritten for Python by *Christian Heimes*." msgstr "*Christian Heimes* 為 Python 重寫了部分 C 程式碼。" -#: ../../library/hashlib.rst:786 +#: ../../library/hashlib.rst:791 msgid "" "The following public domain dedication applies for both C hash function " "implementation, extension code, and this documentation:" msgstr "以下公開領域貢獻適用於 C 雜湊函式實作、擴充程式碼和此文件:" -#: ../../library/hashlib.rst:789 +#: ../../library/hashlib.rst:794 msgid "" "To the extent possible under law, the author(s) have dedicated all copyright " "and related and neighboring rights to this software to the public domain " @@ -1202,7 +1212,7 @@ msgstr "" "在法律允許的範圍內,作者已將該軟體的所有版權以及相關和鄰接權利奉獻給全球的公" "開領域。該軟體的發布沒有任何授權 (warranty)。" -#: ../../library/hashlib.rst:793 +#: ../../library/hashlib.rst:798 msgid "" "You should have received a copy of the CC0 Public Domain Dedication along " "with this software. If not, see https://creativecommons.org/publicdomain/" @@ -1212,7 +1222,7 @@ msgstr "" "Dedication) 的副本。如果沒有,請參閱 https://creativecommons.org/" "publicdomain/zero/1.0/ 。" -#: ../../library/hashlib.rst:797 +#: ../../library/hashlib.rst:802 msgid "" "The following people have helped with development or contributed their " "changes to the project and the public domain according to the Creative " @@ -1221,55 +1231,55 @@ msgstr "" "以下人員根據創用 CC 通用公眾領域貢獻宣告 1.0 (Creative Commons Public Domain " "Dedication 1.0 Universal) 於專案和公開領域做出了開發或貢獻:" -#: ../../library/hashlib.rst:801 +#: ../../library/hashlib.rst:806 msgid "*Alexandr Sokolovskiy*" msgstr "*Alexandr Sokolovskiy*" -#: ../../library/hashlib.rst:821 +#: ../../library/hashlib.rst:827 msgid "Module :mod:`hmac`" msgstr ":mod:`hmac` 模組" -#: ../../library/hashlib.rst:822 +#: ../../library/hashlib.rst:828 msgid "A module to generate message authentication codes using hashes." msgstr "使用雜湊生成訊息驗證程式碼的模組。" -#: ../../library/hashlib.rst:824 +#: ../../library/hashlib.rst:830 msgid "Module :mod:`base64`" msgstr ":mod:`base64` 模組" -#: ../../library/hashlib.rst:825 +#: ../../library/hashlib.rst:831 msgid "Another way to encode binary hashes for non-binary environments." msgstr "另一種在非二進位環境中編碼二進位雜湊的方法。" -#: ../../library/hashlib.rst:827 +#: ../../library/hashlib.rst:833 msgid "https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.180-4.pdf" msgstr "https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.180-4.pdf" -#: ../../library/hashlib.rst:828 +#: ../../library/hashlib.rst:834 msgid "The FIPS 180-4 publication on Secure Hash Algorithms." msgstr "有關安全雜湊演算法的 FIPS 180-4 出版物。" -#: ../../library/hashlib.rst:830 +#: ../../library/hashlib.rst:836 msgid "https://csrc.nist.gov/pubs/fips/202/final" msgstr "https://csrc.nist.gov/pubs/fips/202/final" -#: ../../library/hashlib.rst:831 +#: ../../library/hashlib.rst:837 msgid "The FIPS 202 publication on the SHA-3 Standard." msgstr "有關 SHA-3 標準的 FIPS 202 出版物。" -#: ../../library/hashlib.rst:833 +#: ../../library/hashlib.rst:839 msgid "https://www.blake2.net/" msgstr "https://www.blake2.net/" -#: ../../library/hashlib.rst:834 +#: ../../library/hashlib.rst:840 msgid "Official BLAKE2 website." msgstr "BLAKE2 官方網站。" -#: ../../library/hashlib.rst:836 +#: ../../library/hashlib.rst:842 msgid "https://en.wikipedia.org/wiki/Cryptographic_hash_function" msgstr "https://en.wikipedia.org/wiki/Cryptographic_hash_function" -#: ../../library/hashlib.rst:837 +#: ../../library/hashlib.rst:843 msgid "" "Wikipedia article with information on which algorithms have known issues and " "what that means regarding their use." @@ -1277,21 +1287,21 @@ msgstr "" "包含有關哪些演算法存在已知問題以及這些問題對其使用意味著什麼資訊的維基百科文" "章。" -#: ../../library/hashlib.rst:840 +#: ../../library/hashlib.rst:846 msgid "https://www.ietf.org/rfc/rfc8018.txt" msgstr "https://www.ietf.org/rfc/rfc8018.txt" -#: ../../library/hashlib.rst:841 +#: ../../library/hashlib.rst:847 msgid "PKCS #5: Password-Based Cryptography Specification Version 2.1" msgstr "PKCS #5:基於密碼的加密規範版本 2.1" -#: ../../library/hashlib.rst:843 +#: ../../library/hashlib.rst:849 msgid "" "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf" msgstr "" "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf" -#: ../../library/hashlib.rst:844 +#: ../../library/hashlib.rst:850 msgid "NIST Recommendation for Password-Based Key Derivation." msgstr "NIST(美國國家標準技術研究院)針對基於密碼的密鑰衍生的建議。" @@ -1307,14 +1317,14 @@ msgstr "" "安全雜湊演算法、SHA1、SHA2、SHA224、SHA256、SHA384、SHA512、SHA3、Shake、" "Blake2" -#: ../../library/hashlib.rst:55 +#: ../../library/hashlib.rst:53 msgid "OpenSSL" msgstr "OpenSSL" -#: ../../library/hashlib.rst:55 +#: ../../library/hashlib.rst:53 msgid "(use in module hashlib)" msgstr "(使用於 hashlib 模組中)" -#: ../../library/hashlib.rst:372 +#: ../../library/hashlib.rst:377 msgid "blake2b, blake2s" msgstr "blake2b, blake2s" diff --git a/library/heapq.po b/library/heapq.po index e475cd285a..fb9399796c 100644 --- a/library/heapq.po +++ b/library/heapq.po @@ -123,8 +123,8 @@ msgstr "在線性時間內將 list *x* 轉為 heap,且過程不會申請額外 #: ../../library/heapq.rst:71 msgid "" "Pop and return the smallest item from the *heap*, and also push the new " -"*item*. The heap size doesn't change. If the heap is empty, :exc:" -"`IndexError` is raised." +"*item*. The heap size doesn't change. If the heap is " +"empty, :exc:`IndexError` is raised." msgstr "" "從 *heap* 取出並回傳最小的元素,接著將新的 *item* 放進heap。heap 的大小不會改" "變。如果 heap 是空的會產生 :exc:`IndexError` 錯誤。" @@ -220,26 +220,26 @@ msgid "" "Return a list with the *n* smallest elements from the dataset defined by " "*iterable*. *key*, if provided, specifies a function of one argument that " "is used to extract a comparison key from each element in *iterable* (for " -"example, ``key=str.lower``). Equivalent to: ``sorted(iterable, key=key)[:" -"n]``." +"example, ``key=str.lower``). Equivalent to: ``sorted(iterable, key=key)" +"[:n]``." msgstr "" "回傳一個包含資料 *iterable* 中前 *n* 小元素的 list 。如果有指定 *key* 引數," "*key* 會是只有一個引數的函式,用來從每一個在 *iterable* 中的元素提取一個比較" -"的依據(例如 ``key=str.lower`` )。效果相當於 ``sorted(iterable, key=key)[:" -"n]`` 。" +"的依據(例如 ``key=str.lower`` )。效果相當於 ``sorted(iterable, key=key)" +"[:n]`` 。" #: ../../library/heapq.rst:130 msgid "" "The latter two functions perform best for smaller values of *n*. For larger " "values, it is more efficient to use the :func:`sorted` function. Also, when " -"``n==1``, it is more efficient to use the built-in :func:`min` and :func:" -"`max` functions. If repeated usage of these functions is required, consider " -"turning the iterable into an actual heap." +"``n==1``, it is more efficient to use the built-in :func:`min` " +"and :func:`max` functions. If repeated usage of these functions is " +"required, consider turning the iterable into an actual heap." msgstr "" -"後兩個函式在 *n* 值比較小時有最好的表現。對於較大的 *n* 值,只用 :func:" -"`sorted` 函式會更有效率。同樣地,當 ``n==1`` 時,使用內建函式 :func:`min` " -"和 :func:`max` 會有更好的效率。如果需要重複使用這些函式,可以考慮將 iterable " -"轉成真正的 heap 。" +"後兩個函式在 *n* 值比較小時有最好的表現。對於較大的 *n* 值,只" +"用 :func:`sorted` 函式會更有效率。同樣地,當 ``n==1`` 時,使用內建函" +"式 :func:`min` 和 :func:`max` 會有更好的效率。如果需要重複使用這些函式,可以" +"考慮將 iterable 轉成真正的 heap 。" #: ../../library/heapq.rst:138 msgid "Basic Examples" @@ -358,10 +358,10 @@ msgid "" "returned in the order they were added. And since no two entry counts are the " "same, the tuple comparison will never attempt to directly compare two tasks." msgstr "" -"一個針對前兩個問題的解法是:儲存一個包含 priority 、 entry count 和 task 三個" -"元素的 tuple 。兩個 task 有相同 priority 時, entry count 會讓兩個 task 能根" -"據加入的順序排序。因為沒有任何兩個 task 擁有相同的 entry count ,所以永遠不會" -"直接使用 task 做比較。" +"一個針對前兩個問題的解法是:儲存一個包含 priority、entry count 和 task 三個元" +"素的 tuple 。兩個 task 有相同 priority 時,entry count 會讓兩個 task 能根據加" +"入的順序排序。因為沒有任何兩個 task 擁有相同的 entry count,所以永遠不會直接" +"使用 task 做比較。" #: ../../library/heapq.rst:192 msgid "" @@ -439,6 +439,33 @@ msgid "" " return task\n" " raise KeyError('pop from an empty priority queue')" msgstr "" +"pq = [] # 在 heap 中的 entry 串列\n" +"entry_finder = {} # task 對應到 entry 的對映\n" +"REMOVED = '' # 被刪除的 task 的佔位器\n" +"counter = itertools.count() # 唯一的序列計數\n" +"\n" +"def add_task(task, priority=0):\n" +" '新增一個 task 或更新一個已存在 task 的 priority'\n" +" if task in entry_finder:\n" +" remove_task(task)\n" +" count = next(counter)\n" +" entry = [priority, count, task]\n" +" entry_finder[task] = entry\n" +" heappush(pq, entry)\n" +"\n" +"def remove_task(task):\n" +" '將一個已存在的 task 標記為 REMOVED。如果找不到會引發 KeyError。'\n" +" entry = entry_finder.pop(task)\n" +" entry[-1] = REMOVED\n" +"\n" +"def pop_task():\n" +" '移除並回傳最低 priority 的 task。如果 heap 是空的會引發 KeyError。'\n" +" while pq:\n" +" priority, count, task = heappop(pq)\n" +" if task is not REMOVED:\n" +" del entry_finder[task]\n" +" return task\n" +" raise KeyError('從空的優先佇列中 pop 出元素')" #: ../../library/heapq.rst:241 msgid "Theory" diff --git a/library/html.po b/library/html.po index 5da95baaf8..a8f42a9973 100644 --- a/library/html.po +++ b/library/html.po @@ -20,7 +20,7 @@ msgstr "" #: ../../library/html.rst:2 msgid ":mod:`!html` --- HyperText Markup Language support" -msgstr ":mod:`!html` --- 超連結標記語言 (HTML) 支援" +msgstr ":mod:`!html` --- 超文本標記語言 (HTML) 支援" #: ../../library/html.rst:7 msgid "**Source code:** :source:`Lib/html/__init__.py`" @@ -45,11 +45,11 @@ msgstr "" #: ../../library/html.rst:26 msgid "" -"Convert all named and numeric character references (e.g. ``>``, ``>" -"``, ``>``) in the string *s* to the corresponding Unicode characters. " -"This function uses the rules defined by the HTML 5 standard for both valid " -"and invalid character references, and the :data:`list of HTML 5 named " -"character references `." +"Convert all named and numeric character references (e.g. ``>``, " +"``>``, ``>``) in the string *s* to the corresponding Unicode " +"characters. This function uses the rules defined by the HTML 5 standard for " +"both valid and invalid character references, and the :data:`list of HTML 5 " +"named character references `." msgstr "" "將字串 *s* 中所有附名 (named) 且為數值的 (numeric) 字元參照(如: ``>``、 " "``>``、``>`` )轉換為對應的 Unicode 字元。此函式針對有效及無效的字元" diff --git a/library/http.cookiejar.po b/library/http.cookiejar.po index 6184715dab..8614f5b523 100644 --- a/library/http.cookiejar.po +++ b/library/http.cookiejar.po @@ -36,11 +36,11 @@ msgstr "" #: ../../library/http.cookiejar.rst:19 msgid "" -"Both the regular Netscape cookie protocol and the protocol defined by :rfc:" -"`2965` are handled. RFC 2965 handling is switched off by default. :rfc:" -"`2109` cookies are parsed as Netscape cookies and subsequently treated " -"either as Netscape or RFC 2965 cookies according to the 'policy' in effect. " -"Note that the great majority of cookies on the internet are Netscape " +"Both the regular Netscape cookie protocol and the protocol defined " +"by :rfc:`2965` are handled. RFC 2965 handling is switched off by " +"default. :rfc:`2109` cookies are parsed as Netscape cookies and subsequently " +"treated either as Netscape or RFC 2965 cookies according to the 'policy' in " +"effect. Note that the great majority of cookies on the internet are Netscape " "cookies. :mod:`http.cookiejar` attempts to follow the de-facto Netscape " "cookie protocol (which differs substantially from that set out in the " "original Netscape specification), including taking note of the ``max-age`` " @@ -49,11 +49,11 @@ msgstr "" #: ../../library/http.cookiejar.rst:31 msgid "" -"The various named parameters found in :mailheader:`Set-Cookie` and :" -"mailheader:`Set-Cookie2` headers (eg. ``domain`` and ``expires``) are " +"The various named parameters found in :mailheader:`Set-Cookie` " +"and :mailheader:`Set-Cookie2` headers (eg. ``domain`` and ``expires``) are " "conventionally referred to as :dfn:`attributes`. To distinguish them from " -"Python attributes, the documentation for this module uses the term :dfn:" -"`cookie-attribute` instead." +"Python attributes, the documentation for this module uses the " +"term :dfn:`cookie-attribute` instead." msgstr "" #: ../../library/http.cookiejar.rst:38 @@ -126,8 +126,8 @@ msgid "" "a sequence of the only domains for which we accept and return cookies. " "*secure_protocols* is a sequence of protocols for which secure cookies can " "be added to. By default *https* and *wss* (secure websocket) are considered " -"secure protocols. For all other arguments, see the documentation for :class:" -"`CookiePolicy` and :class:`DefaultCookiePolicy` objects." +"secure protocols. For all other arguments, see the documentation " +"for :class:`CookiePolicy` and :class:`DefaultCookiePolicy` objects." msgstr "" #: ../../library/http.cookiejar.rst:98 @@ -138,17 +138,17 @@ msgid "" "attribute of 1) are treated according to the RFC 2965 rules. However, if " "RFC 2965 handling is turned off or :attr:`rfc2109_as_netscape` is ``True``, " "RFC 2109 cookies are 'downgraded' by the :class:`CookieJar` instance to " -"Netscape cookies, by setting the :attr:`version` attribute of the :class:" -"`Cookie` instance to 0. :class:`DefaultCookiePolicy` also provides some " -"parameters to allow some fine-tuning of policy." +"Netscape cookies, by setting the :attr:`version` attribute of " +"the :class:`Cookie` instance to 0. :class:`DefaultCookiePolicy` also " +"provides some parameters to allow some fine-tuning of policy." msgstr "" #: ../../library/http.cookiejar.rst:111 msgid "" "This class represents Netscape, :rfc:`2109` and :rfc:`2965` cookies. It is " -"not expected that users of :mod:`http.cookiejar` construct their own :class:" -"`Cookie` instances. Instead, if necessary, call :meth:`make_cookies` on a :" -"class:`CookieJar` instance." +"not expected that users of :mod:`http.cookiejar` construct their " +"own :class:`Cookie` instances. Instead, if necessary, " +"call :meth:`make_cookies` on a :class:`CookieJar` instance." msgstr "" #: ../../library/http.cookiejar.rst:119 @@ -165,8 +165,9 @@ msgstr ":mod:`http.cookies` 模組" #: ../../library/http.cookiejar.rst:123 msgid "" -"HTTP cookie classes, principally useful for server-side code. The :mod:" -"`http.cookiejar` and :mod:`http.cookies` modules do not depend on each other." +"HTTP cookie classes, principally useful for server-side code. " +"The :mod:`http.cookiejar` and :mod:`http.cookies` modules do not depend on " +"each other." msgstr "" #: ../../library/http.cookiejar.rst:127 @@ -227,7 +228,7 @@ msgstr ":class:`CookieJar` 擁有以下方法:" #: ../../library/http.cookiejar.rst:158 msgid "Add correct :mailheader:`Cookie` header to *request*." -msgstr "" +msgstr "將正確的 :mailheader:`Cookie` 標頭加入 *request*。" #: ../../library/http.cookiejar.rst:160 msgid "" @@ -240,10 +241,10 @@ msgstr "" #: ../../library/http.cookiejar.rst:164 msgid "" "The *request* object (usually a :class:`urllib.request.Request` instance) " -"must support the methods :meth:`get_full_url`, :meth:`has_header`, :meth:" -"`get_header`, :meth:`header_items`, :meth:`add_unredirected_header` and the " -"attributes :attr:`host`, :attr:`!type`, :attr:`unverifiable` and :attr:" -"`origin_req_host` as documented by :mod:`urllib.request`." +"must support the " +"methods :meth:`get_full_url`, :meth:`has_header`, :meth:`get_header`, :meth:`header_items`, :meth:`add_unredirected_header` " +"and the attributes :attr:`host`, :attr:`!type`, :attr:`unverifiable` " +"and :attr:`origin_req_host` as documented by :mod:`urllib.request`." msgstr "" #: ../../library/http.cookiejar.rst:172 ../../library/http.cookiejar.rst:198 @@ -254,32 +255,34 @@ msgstr "" #: ../../library/http.cookiejar.rst:178 msgid "" -"Extract cookies from HTTP *response* and store them in the :class:" -"`CookieJar`, where allowed by policy." +"Extract cookies from HTTP *response* and store them in " +"the :class:`CookieJar`, where allowed by policy." msgstr "" #: ../../library/http.cookiejar.rst:181 msgid "" -"The :class:`CookieJar` will look for allowable :mailheader:`Set-Cookie` and :" -"mailheader:`Set-Cookie2` headers in the *response* argument, and store " +"The :class:`CookieJar` will look for allowable :mailheader:`Set-Cookie` " +"and :mailheader:`Set-Cookie2` headers in the *response* argument, and store " "cookies as appropriate (subject to the :meth:`CookiePolicy.set_ok` method's " "approval)." msgstr "" #: ../../library/http.cookiejar.rst:185 msgid "" -"The *response* object (usually the result of a call to :meth:`urllib.request." -"urlopen`, or similar) should support an :meth:`info` method, which returns " -"an :class:`email.message.Message` instance." +"The *response* object (usually the result of a call " +"to :meth:`urllib.request.urlopen`, or similar) should support " +"an :meth:`info` method, which returns an :class:`email.message.Message` " +"instance." msgstr "" #: ../../library/http.cookiejar.rst:189 msgid "" "The *request* object (usually a :class:`urllib.request.Request` instance) " -"must support the method :meth:`get_full_url` and the attributes :attr:" -"`host`, :attr:`unverifiable` and :attr:`origin_req_host`, as documented by :" -"mod:`urllib.request`. The request is used to set default values for cookie-" -"attributes as well as for checking that the cookie is allowed to be set." +"must support the method :meth:`get_full_url` and the " +"attributes :attr:`host`, :attr:`unverifiable` and :attr:`origin_req_host`, " +"as documented by :mod:`urllib.request`. The request is used to set default " +"values for cookie-attributes as well as for checking that the cookie is " +"allowed to be set." msgstr "" #: ../../library/http.cookiejar.rst:203 @@ -309,7 +312,7 @@ msgstr "" #: ../../library/http.cookiejar.rst:227 msgid "Clear some cookies." -msgstr "" +msgstr "清除一些 cookies。" #: ../../library/http.cookiejar.rst:229 msgid "" @@ -322,7 +325,7 @@ msgstr "" #: ../../library/http.cookiejar.rst:235 msgid "Raises :exc:`KeyError` if no matching cookie exists." -msgstr "" +msgstr "如果沒有符合的 cookie 存在,則引發 :exc:`KeyError`。" #: ../../library/http.cookiejar.rst:240 msgid "Discard all session cookies." @@ -349,7 +352,7 @@ msgstr "" #: ../../library/http.cookiejar.rst:255 msgid "Save cookies to a file." -msgstr "" +msgstr "將 cookies 儲存到檔案中。" #: ../../library/http.cookiejar.rst:257 msgid "" @@ -361,8 +364,8 @@ msgstr "" msgid "" "*filename* is the name of file in which to save cookies. If *filename* is " "not specified, :attr:`self.filename` is used (whose default is the value " -"passed to the constructor, if any); if :attr:`self.filename` is :const:" -"`None`, :exc:`ValueError` is raised." +"passed to the constructor, if any); if :attr:`self.filename` " +"is :const:`None`, :exc:`ValueError` is raised." msgstr "" #: ../../library/http.cookiejar.rst:265 @@ -374,32 +377,32 @@ msgstr "" #: ../../library/http.cookiejar.rst:268 msgid "" "The file is overwritten if it already exists, thus wiping all the cookies it " -"contains. Saved cookies can be restored later using the :meth:`load` or :" -"meth:`revert` methods." +"contains. Saved cookies can be restored later using the :meth:`load` " +"or :meth:`revert` methods." msgstr "" #: ../../library/http.cookiejar.rst:275 msgid "Load cookies from a file." -msgstr "" +msgstr "從檔案中載入 cookies。" #: ../../library/http.cookiejar.rst:277 msgid "Old cookies are kept unless overwritten by newly loaded ones." -msgstr "" +msgstr "舊的 cookies 會被保留,除非被新載入的 cookies 覆蓋。" #: ../../library/http.cookiejar.rst:279 msgid "Arguments are as for :meth:`save`." -msgstr "" +msgstr "引數與 :meth:`save` 相同。" #: ../../library/http.cookiejar.rst:281 msgid "" -"The named file must be in the format understood by the class, or :exc:" -"`LoadError` will be raised. Also, :exc:`OSError` may be raised, for example " -"if the file does not exist." +"The named file must be in the format understood by the class, " +"or :exc:`LoadError` will be raised. Also, :exc:`OSError` may be raised, for " +"example if the file does not exist." msgstr "" #: ../../library/http.cookiejar.rst:285 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." -msgstr "" +msgstr "以前會引發 :exc:`IOError`,現在它是 :exc:`OSError` 的別名。" #: ../../library/http.cookiejar.rst:291 msgid "Clear all cookies and reload cookies from a saved file." @@ -413,7 +416,7 @@ msgstr "" #: ../../library/http.cookiejar.rst:296 msgid ":class:`FileCookieJar` instances have the following public attributes:" -msgstr "" +msgstr ":class:`FileCookieJar` 實例擁有以下公開屬性:" #: ../../library/http.cookiejar.rst:301 msgid "" @@ -493,8 +496,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:366 msgid "" "*cookie* is a :class:`Cookie` instance. *request* is an object implementing " -"the interface defined by the documentation for :meth:`CookieJar." -"extract_cookies`." +"the interface defined by the documentation " +"for :meth:`CookieJar.extract_cookies`." msgstr "" #: ../../library/http.cookiejar.rst:373 @@ -505,8 +508,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:375 msgid "" "*cookie* is a :class:`Cookie` instance. *request* is an object implementing " -"the interface defined by the documentation for :meth:`CookieJar." -"add_cookie_header`." +"the interface defined by the documentation " +"for :meth:`CookieJar.add_cookie_header`." msgstr "" #: ../../library/http.cookiejar.rst:382 @@ -524,12 +527,13 @@ msgstr "" #: ../../library/http.cookiejar.rst:389 msgid "" -"If :meth:`domain_return_ok` returns true for the cookie domain, :meth:" -"`path_return_ok` is called for the cookie path. Otherwise, :meth:" -"`path_return_ok` and :meth:`return_ok` are never called for that cookie " -"domain. If :meth:`path_return_ok` returns true, :meth:`return_ok` is called " -"with the :class:`Cookie` object itself for a full check. Otherwise, :meth:" -"`return_ok` is never called for that cookie path." +"If :meth:`domain_return_ok` returns true for the cookie " +"domain, :meth:`path_return_ok` is called for the cookie path. " +"Otherwise, :meth:`path_return_ok` and :meth:`return_ok` are never called for " +"that cookie domain. If :meth:`path_return_ok` returns " +"true, :meth:`return_ok` is called with the :class:`Cookie` object itself for " +"a full check. Otherwise, :meth:`return_ok` is never called for that cookie " +"path." msgstr "" #: ../../library/http.cookiejar.rst:396 @@ -554,19 +558,19 @@ msgstr "關於 :meth:`domain_return_ok` 請見文件。" #: ../../library/http.cookiejar.rst:410 msgid "" -"In addition to implementing the methods above, implementations of the :class:" -"`CookiePolicy` interface must also supply the following attributes, " -"indicating which protocols should be used, and how. All of these attributes " -"may be assigned to." +"In addition to implementing the methods above, implementations of " +"the :class:`CookiePolicy` interface must also supply the following " +"attributes, indicating which protocols should be used, and how. All of " +"these attributes may be assigned to." msgstr "" #: ../../library/http.cookiejar.rst:418 msgid "Implement Netscape protocol." -msgstr "" +msgstr "實作 Netscape 協定。" #: ../../library/http.cookiejar.rst:423 msgid "Implement :rfc:`2965` protocol." -msgstr "" +msgstr "實作 :rfc:`2965` 協定。" #: ../../library/http.cookiejar.rst:428 msgid "" @@ -640,8 +644,8 @@ msgid "" "A domain blocklist and allowlist is provided (both off by default). Only " "domains not in the blocklist and present in the allowlist (if the allowlist " "is active) participate in cookie setting and returning. Use the " -"*blocked_domains* constructor argument, and :meth:`blocked_domains` and :" -"meth:`set_blocked_domains` methods (and the corresponding argument and " +"*blocked_domains* constructor argument, and :meth:`blocked_domains` " +"and :meth:`set_blocked_domains` methods (and the corresponding argument and " "methods for *allowed_domains*). If you set an allowlist, you can turn it " "off again by setting it to :const:`None`." msgstr "" @@ -652,11 +656,12 @@ msgid "" "cookie domain to be matched. For example, ``\"example.com\"`` matches a " "blocklist entry of ``\"example.com\"``, but ``\"www.example.com\"`` does " "not. Domains that do start with a dot are matched by more specific domains " -"too. For example, both ``\"www.example.com\"`` and ``\"www.coyote.example." -"com\"`` match ``\".example.com\"`` (but ``\"example.com\"`` itself does " -"not). IP addresses are an exception, and must match exactly. For example, " -"if blocked_domains contains ``\"192.168.1.2\"`` and ``\".168.1.2\"``, " -"192.168.1.2 is blocked, but 193.168.1.2 is not." +"too. For example, both ``\"www.example.com\"`` and " +"``\"www.coyote.example.com\"`` match ``\".example.com\"`` (but " +"``\"example.com\"`` itself does not). IP addresses are an exception, and " +"must match exactly. For example, if blocked_domains contains " +"``\"192.168.1.2\"`` and ``\".168.1.2\"``, 192.168.1.2 is blocked, but " +"193.168.1.2 is not." msgstr "" #: ../../library/http.cookiejar.rst:483 @@ -704,10 +709,10 @@ msgid "" "If true, request that the :class:`CookieJar` instance downgrade :rfc:`2109` " "cookies (ie. cookies received in a :mailheader:`Set-Cookie` header with a " "version cookie-attribute of 1) to Netscape cookies by setting the version " -"attribute of the :class:`Cookie` instance to 0. The default value is :const:" -"`None`, in which case RFC 2109 cookies are downgraded if and only if :rfc:" -"`2965` handling is turned off. Therefore, RFC 2109 cookies are downgraded " -"by default." +"attribute of the :class:`Cookie` instance to 0. The default value " +"is :const:`None`, in which case RFC 2109 cookies are downgraded if and only " +"if :rfc:`2965` handling is turned off. Therefore, RFC 2109 cookies are " +"downgraded by default." msgstr "" #: ../../library/http.cookiejar.rst:532 @@ -767,8 +772,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:580 msgid "" -"When setting cookies, the 'host prefix' must not contain a dot (eg. ``www." -"foo.bar.com`` can't set a cookie for ``.bar.com``, because ``www.foo`` " +"When setting cookies, the 'host prefix' must not contain a dot (eg. " +"``www.foo.bar.com`` can't set a cookie for ``.bar.com``, because ``www.foo`` " "contains a dot)." msgstr "" @@ -824,10 +829,10 @@ msgstr "" #: ../../library/http.cookiejar.rst:630 msgid "" -"Integer or :const:`None`. Netscape cookies have :attr:`version` 0. :rfc:" -"`2965` and :rfc:`2109` cookies have a ``version`` cookie-attribute of 1. " -"However, note that :mod:`http.cookiejar` may 'downgrade' RFC 2109 cookies to " -"Netscape cookies, in which case :attr:`version` is 0." +"Integer or :const:`None`. Netscape cookies have :attr:`version` " +"0. :rfc:`2965` and :rfc:`2109` cookies have a ``version`` cookie-attribute " +"of 1. However, note that :mod:`http.cookiejar` may 'downgrade' RFC 2109 " +"cookies to Netscape cookies, in which case :attr:`version` is 0." msgstr "" #: ../../library/http.cookiejar.rst:638 @@ -840,8 +845,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:648 msgid "" -"String representing a port or a set of ports (eg. '80', or '80,8080'), or :" -"const:`None`." +"String representing a port or a set of ports (eg. '80', or '80,8080'), " +"or :const:`None`." msgstr "" #: ../../library/http.cookiejar.rst:654 @@ -858,8 +863,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:669 msgid "" -"Integer expiry date in seconds since epoch, or :const:`None`. See also the :" -"meth:`is_expired` method." +"Integer expiry date in seconds since epoch, or :const:`None`. See also " +"the :meth:`is_expired` method." msgstr "" #: ../../library/http.cookiejar.rst:675 @@ -868,8 +873,8 @@ msgstr "" #: ../../library/http.cookiejar.rst:680 msgid "" -"String comment from the server explaining the function of this cookie, or :" -"const:`None`." +"String comment from the server explaining the function of this cookie, " +"or :const:`None`." msgstr "" #: ../../library/http.cookiejar.rst:686 @@ -947,14 +952,14 @@ msgstr "" msgid "" "import http.cookiejar, urllib.request\n" "cj = http.cookiejar.CookieJar()\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com//")" msgstr "" "import http.cookiejar, urllib.request\n" "cj = http.cookiejar.CookieJar()\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com//")" #: ../../library/http.cookiejar.rst:754 @@ -968,18 +973,18 @@ msgstr "" msgid "" "import os, http.cookiejar, urllib.request\n" "cj = http.cookiejar.MozillaCookieJar()\n" -"cj.load(os.path.join(os.path.expanduser(\"~\"), \".netscape\", \"cookies." -"txt\"))\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"cj.load(os.path.join(os.path.expanduser(\"~\"), \".netscape\", " +"\"cookies.txt\"))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com//")" msgstr "" "import os, http.cookiejar, urllib.request\n" "cj = http.cookiejar.MozillaCookieJar()\n" -"cj.load(os.path.join(os.path.expanduser(\"~\"), \".netscape\", \"cookies." -"txt\"))\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"cj.load(os.path.join(os.path.expanduser(\"~\"), \".netscape\", " +"\"cookies.txt\"))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com//")" #: ../../library/http.cookiejar.rst:763 @@ -998,8 +1003,8 @@ msgid "" " rfc2965=True, strict_ns_domain=Policy.DomainStrict,\n" " blocked_domains=[\"ads.net\", \".ads.net\"])\n" "cj = CookieJar(policy)\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com//")" msgstr "" "import urllib.request\n" @@ -1008,6 +1013,6 @@ msgstr "" " rfc2965=True, strict_ns_domain=Policy.DomainStrict,\n" " blocked_domains=[\"ads.net\", \".ads.net\"])\n" "cj = CookieJar(policy)\n" -"opener = urllib.request.build_opener(urllib.request." -"HTTPCookieProcessor(cj))\n" +"opener = " +"urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))\n" "r = opener.open(\"http://example.com//")" diff --git a/library/http.cookies.po b/library/http.cookies.po index ef5a4f6381..28b2b12d38 100644 --- a/library/http.cookies.po +++ b/library/http.cookies.po @@ -38,15 +38,15 @@ msgstr "" #: ../../library/http.cookies.rst:19 msgid "" -"The module formerly strictly applied the parsing rules described in the :rfc:" -"`2109` and :rfc:`2068` specifications. It has since been discovered that " -"MSIE 3.0x didn't follow the character rules outlined in those specs; many " -"current-day browsers and servers have also relaxed parsing rules when it " -"comes to cookie handling. As a result, this module now uses parsing rules " -"that are a bit less strict than they once were." +"The module formerly strictly applied the parsing rules described in " +"the :rfc:`2109` and :rfc:`2068` specifications. It has since been " +"discovered that MSIE 3.0x didn't follow the character rules outlined in " +"those specs; many current-day browsers and servers have also relaxed parsing " +"rules when it comes to cookie handling. As a result, this module now uses " +"parsing rules that are a bit less strict than they once were." msgstr "" "此模組原先嚴格遵循了 :rfc:`2109` 和 :rfc:`2068` 規範所描述的剖析規則。自從發" -"現 MSIE 3.0x 並不遵循這些規範所描述的字元規則,許多當前的瀏覽器和伺服器也在處" +"現 MSIE 3.0x 並不遵循這些規範所描述的字元規則,許多目前的瀏覽器和伺服器也在處" "理 cookie 時放寬了剖析規則。因此,此模組現在使用的剖析規則比之前的更為寬鬆。" #: ../../library/http.cookies.rst:26 @@ -55,8 +55,9 @@ msgid "" "``!#$%&'*+-.^_`|~:`` denote the set of valid characters allowed by this " "module in a cookie name (as :attr:`~Morsel.key`)." msgstr "" -"字元集 :data:`string.ascii_letters`、:data:`string.digits` 和 ``!#$%&'*+-." -"^_`|~`` 表示此模組在 cookie 名稱 (:attr:`~Morsel.key`) 中允許的合法字元集合。" +"字元集 :data:`string.ascii_letters`、:data:`string.digits` 和 ``!#$" +"%&'*+-.^_`|~`` 表示此模組在 cookie 名稱 (:attr:`~Morsel.key`) 中允許的合法字" +"元集合。" #: ../../library/http.cookies.rst:30 msgid "Allowed ':' as a valid cookie name character." @@ -95,11 +96,12 @@ msgstr "如果有給定 *input*,它會被傳遞給 :meth:`load` 方法。" #: ../../library/http.cookies.rst:58 msgid "" -"This class derives from :class:`BaseCookie` and overrides :meth:`~BaseCookie." -"value_decode` and :meth:`~BaseCookie.value_encode`. :class:`!SimpleCookie` " -"supports strings as cookie values. When setting the value, :class:`!" -"SimpleCookie` calls the builtin :func:`str` to convert the value to a " -"string. Values received from HTTP are kept as strings." +"This class derives from :class:`BaseCookie` and " +"overrides :meth:`~BaseCookie.value_decode` " +"and :meth:`~BaseCookie.value_encode`. :class:`!SimpleCookie` supports " +"strings as cookie values. When setting the value, :class:`!SimpleCookie` " +"calls the builtin :func:`str` to convert the value to a string. Values " +"received from HTTP are kept as strings." msgstr "" "這個類別繼承自 :class:`BaseCookie` 並覆寫了 :meth:`~BaseCookie.value_decode` " "和 :meth:`~BaseCookie.value_encode`。:class:`!SimpleCookie` 支援字串作為 " @@ -112,11 +114,11 @@ msgstr ":mod:`http.cookiejar` 模組" #: ../../library/http.cookies.rst:67 msgid "" -"HTTP cookie handling for web *clients*. The :mod:`http.cookiejar` and :mod:" -"`http.cookies` modules do not depend on each other." +"HTTP cookie handling for web *clients*. The :mod:`http.cookiejar` " +"and :mod:`http.cookies` modules do not depend on each other." msgstr "" -"用於網路\\ *用戶端*\\ 的 HTTP cookie 處理。:mod:`http.cookiejar` 和 :mod:" -"`http.cookies` 模組互不相依。" +"用於網路\\ *用戶端*\\ 的 HTTP cookie 處理。:mod:`http.cookiejar` " +"和 :mod:`http.cookies` 模組互不相依。" #: ../../library/http.cookies.rst:70 msgid ":rfc:`2109` - HTTP State Management Mechanism" @@ -133,8 +135,8 @@ msgstr "Cookie 物件" #: ../../library/http.cookies.rst:82 msgid "" "Return a tuple ``(real_value, coded_value)`` from a string representation. " -"``real_value`` can be any type. This method does no decoding in :class:" -"`BaseCookie` --- it exists so it can be overridden." +"``real_value`` can be any type. This method does no decoding " +"in :class:`BaseCookie` --- it exists so it can be overridden." msgstr "" "從字串表示回傳 ``(real_value, coded_value)`` 的元組。``real_value`` 可以是任" "何型別。此方法在 :class:`BaseCookie` 中不做解碼 --- 它存在以便可以被覆寫。" @@ -151,8 +153,8 @@ msgstr "" #: ../../library/http.cookies.rst:94 msgid "" -"In general, it should be the case that :meth:`value_encode` and :meth:" -"`value_decode` are inverses on the range of *value_decode*." +"In general, it should be the case that :meth:`value_encode` " +"and :meth:`value_decode` are inverses on the range of *value_decode*." msgstr "" "一般來說,:meth:`value_encode` 和 :meth:`value_decode` 應該在 *value_decode* " "的範圍內是互逆的 (inverse)。" @@ -245,11 +247,13 @@ msgstr "" #: ../../library/http.cookies.rst:160 msgid "" -"Attributes :attr:`~Morsel.key`, :attr:`~Morsel.value` and :attr:`~Morsel." -"coded_value` are read-only. Use :meth:`~Morsel.set` for setting them." +"Attributes :attr:`~Morsel.key`, :attr:`~Morsel.value` " +"and :attr:`~Morsel.coded_value` are read-only. Use :meth:`~Morsel.set` for " +"setting them." msgstr "" -"屬性 :attr:`~Morsel.key`、:attr:`~Morsel.value` 和 :attr:`~Morsel." -"coded_value` 是唯讀的。請使用 :meth:`~Morsel.set` 來設定它們。" +"屬性 :attr:`~Morsel.key`、:attr:`~Morsel.value` " +"和 :attr:`~Morsel.coded_value` 是唯讀的。請使用 :meth:`~Morsel.set` 來設定它" +"們。" #: ../../library/http.cookies.rst:165 msgid "Added support for the :attr:`samesite` attribute." @@ -326,8 +330,8 @@ msgid "" "Raise an error if key is not a valid :rfc:`2109` attribute, otherwise behave " "the same as :meth:`dict.setdefault`." msgstr "" -"如果鍵不是一個有效的 :rfc:`2109` 屬性會引發錯誤,否則行為與 :meth:`dict." -"setdefault` 相同。" +"如果鍵不是一個有效的 :rfc:`2109` 屬性會引發錯誤,否則行為" +"與 :meth:`dict.setdefault` 相同。" #: ../../library/http.cookies.rst:245 msgid "Example" diff --git a/library/http.po b/library/http.po index 06281fd946..f1803bc12b 100644 --- a/library/http.po +++ b/library/http.po @@ -40,13 +40,13 @@ msgid "" ":mod:`http.client` is a low-level HTTP protocol client; for high-level URL " "opening use :mod:`urllib.request`" msgstr "" -":mod:`http.client` 是一個低階的 HTTP 協定客戶端;對於高階的 URL 存取請使用 :" -"mod:`urllib.request`" +":mod:`http.client` 是一個低階的 HTTP 協定客戶端;對於高階的 URL 存取請使" +"用 :mod:`urllib.request`" #: ../../library/http.rst:20 msgid "" -":mod:`http.server` contains basic HTTP server classes based on :mod:" -"`socketserver`" +":mod:`http.server` contains basic HTTP server classes based " +"on :mod:`socketserver`" msgstr ":mod:`http.server` 包含基於 :mod:`socketserver` 的基本 HTTP 伺服器類別" #: ../../library/http.rst:21 @@ -116,8 +116,8 @@ msgstr "HTTP 狀態碼" #: ../../library/http.rst:55 msgid "" "Supported, `IANA-registered status codes `_ available in :class:`http." -"HTTPStatus` are:" +"http-status-codes/http-status-codes.xhtml>`_ available " +"in :class:`http.HTTPStatus` are:" msgstr "" ":class:`http.HTTPStatus` 當中,已支援並且有於 `IANA 註冊的狀態碼 `_\\ 有:" @@ -590,9 +590,8 @@ msgid "``413``" msgstr "``413``" #: ../../library/http.rst:97 -#, fuzzy msgid "``CONTENT_TOO_LARGE``" -msgstr "``REQUEST_ENTITY_TOO_LARGE``" +msgstr "``CONTENT_TOO_LARGE``" #: ../../library/http.rst:97 #, fuzzy @@ -604,9 +603,8 @@ msgid "``414``" msgstr "``414``" #: ../../library/http.rst:98 -#, fuzzy msgid "``URI_TOO_LONG``" -msgstr "``REQUEST_URI_TOO_LONG``" +msgstr "``URI_TOO_LONG``" #: ../../library/http.rst:98 #, fuzzy @@ -631,9 +629,8 @@ msgid "``416``" msgstr "``416``" #: ../../library/http.rst:100 -#, fuzzy msgid "``RANGE_NOT_SATISFIABLE``" -msgstr "``REQUESTED_RANGE_NOT_SATISFIABLE``" +msgstr "``RANGE_NOT_SATISFIABLE``" #: ../../library/http.rst:100 #, fuzzy diff --git a/library/http.server.po b/library/http.server.po index e9346abbd1..73e6238b9b 100644 --- a/library/http.server.po +++ b/library/http.server.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-03-16 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,8 +31,8 @@ msgstr "此模組定義了用於實作 HTTP 伺服器的類別。" #: ../../library/http.server.rst:22 msgid "" -":mod:`http.server` is not recommended for production. It only implements :" -"ref:`basic security checks `." +":mod:`http.server` is not recommended for production. It only " +"implements :ref:`basic security checks `." msgstr "" #: ../../includes/wasm-notavail.rst:3 @@ -69,9 +69,9 @@ msgstr "" #: ../../library/http.server.rst:39 msgid "" "This class builds on the :class:`~socketserver.TCPServer` class by storing " -"the server address as instance variables named :attr:`server_name` and :attr:" -"`server_port`. The server is accessible by the handler, typically through " -"the handler's :attr:`server` instance variable." +"the server address as instance variables named :attr:`server_name` " +"and :attr:`server_port`. The server is accessible by the handler, typically " +"through the handler's :attr:`server` instance variable." msgstr "" #: ../../library/http.server.rst:46 @@ -93,9 +93,9 @@ msgstr "" msgid "" "This class is used to handle the HTTP requests that arrive at the server. " "By itself, it cannot respond to any actual HTTP requests; it must be " -"subclassed to handle each request method (e.g. GET or POST). :class:" -"`BaseHTTPRequestHandler` provides a number of class and instance variables, " -"and methods for use by subclasses." +"subclassed to handle each request method (e.g. GET or " +"POST). :class:`BaseHTTPRequestHandler` provides a number of class and " +"instance variables, and methods for use by subclasses." msgstr "" #: ../../library/http.server.rst:66 @@ -132,9 +132,9 @@ msgstr "" #: ../../library/http.server.rst:92 msgid "" "Contains the string representation of the HTTP request line. The terminating " -"CRLF is stripped. This attribute should be set by :meth:" -"`handle_one_request`. If no valid request line was processed, it should be " -"set to the empty string." +"CRLF is stripped. This attribute should be set " +"by :meth:`handle_one_request`. If no valid request line was processed, it " +"should be set to the empty string." msgstr "" #: ../../library/http.server.rst:99 @@ -192,9 +192,9 @@ msgstr "" #: ../../library/http.server.rst:144 msgid "" -"Contains the Python system version, in a form usable by the :attr:" -"`version_string` method and the :attr:`server_version` class variable. For " -"example, ``'Python/1.4'``." +"Contains the Python system version, in a form usable by " +"the :attr:`version_string` method and the :attr:`server_version` class " +"variable. For example, ``'Python/1.4'``." msgstr "" #: ../../library/http.server.rst:150 @@ -225,8 +225,8 @@ msgstr "" #: ../../library/http.server.rst:172 msgid "" "Specifies an :class:`email.message.Message`\\ -like class to parse HTTP " -"headers. Typically, this is not overridden, and it defaults to :class:`http." -"client.HTTPMessage`." +"headers. Typically, this is not overridden, and it defaults " +"to :class:`http.client.HTTPMessage`." msgstr "" #: ../../library/http.server.rst:178 @@ -307,8 +307,8 @@ msgid "" "Adds the HTTP header to an internal buffer which will be written to the " "output stream when either :meth:`end_headers` or :meth:`flush_headers` is " "invoked. *keyword* should specify the header keyword, with *value* " -"specifying its value. Note that, after the send_header calls are done, :meth:" -"`end_headers` MUST BE called in order to complete the operation." +"specifying its value. Note that, after the send_header calls are " +"done, :meth:`end_headers` MUST BE called in order to complete the operation." msgstr "" #: ../../library/http.server.rst:250 @@ -357,15 +357,15 @@ msgstr "" msgid "" "Logs an arbitrary message to ``sys.stderr``. This is typically overridden to " "create custom error logging mechanisms. The *format* argument is a standard " -"printf-style format string, where the additional arguments to :meth:" -"`log_message` are applied as inputs to the formatting. The client ip address " -"and current date and time are prefixed to every message logged." +"printf-style format string, where the additional arguments " +"to :meth:`log_message` are applied as inputs to the formatting. The client " +"ip address and current date and time are prefixed to every message logged." msgstr "" #: ../../library/http.server.rst:301 msgid "" -"Returns the server software's version string. This is a combination of the :" -"attr:`server_version` and :attr:`sys_version` attributes." +"Returns the server software's version string. This is a combination of " +"the :attr:`server_version` and :attr:`sys_version` attributes." msgstr "" #: ../../library/http.server.rst:306 @@ -410,15 +410,15 @@ msgstr "" #: ../../library/http.server.rst:337 msgid "" -"A lot of the work, such as parsing the request, is done by the base class :" -"class:`BaseHTTPRequestHandler`. This class implements the :func:`do_GET` " -"and :func:`do_HEAD` functions." +"A lot of the work, such as parsing the request, is done by the base " +"class :class:`BaseHTTPRequestHandler`. This class implements " +"the :func:`do_GET` and :func:`do_HEAD` functions." msgstr "" #: ../../library/http.server.rst:341 msgid "" -"The following are defined as class-level attributes of :class:" -"`SimpleHTTPRequestHandler`:" +"The following are defined as class-level attributes " +"of :class:`SimpleHTTPRequestHandler`:" msgstr "" #: ../../library/http.server.rst:346 @@ -463,9 +463,9 @@ msgid "" "If the request was mapped to a directory, the directory is checked for a " "file named ``index.html`` or ``index.htm`` (in that order). If found, the " "file's contents are returned; otherwise a directory listing is generated by " -"calling the :meth:`list_directory` method. This method uses :func:`os." -"listdir` to scan the directory, and returns a ``404`` error response if the :" -"func:`~os.listdir` fails." +"calling the :meth:`list_directory` method. This method " +"uses :func:`os.listdir` to scan the directory, and returns a ``404`` error " +"response if the :func:`~os.listdir` fails." msgstr "" #: ../../library/http.server.rst:379 @@ -495,8 +495,8 @@ msgstr "" #: ../../library/http.server.rst:395 msgid "" -"For example usage, see the implementation of the ``test`` function in :" -"source:`Lib/http/server.py`." +"For example usage, see the implementation of the ``test`` function " +"in :source:`Lib/http/server.py`." msgstr "" #: ../../library/http.server.rst:398 @@ -541,92 +541,21 @@ msgid "" "attribute :attr:`index_pages`." msgstr "" -#: ../../library/http.server.rst:423 -msgid "" -":mod:`http.server` can also be invoked directly using the :option:`-m` " -"switch of the interpreter. Similar to the previous example, this serves " -"files relative to the current directory::" -msgstr "" - -#: ../../library/http.server.rst:427 -msgid "python -m http.server" -msgstr "python -m http.server" - -#: ../../library/http.server.rst:429 -msgid "" -"The server listens to port 8000 by default. The default can be overridden by " -"passing the desired port number as an argument::" -msgstr "" - -#: ../../library/http.server.rst:432 -msgid "python -m http.server 9000" -msgstr "python -m http.server 9000" - -#: ../../library/http.server.rst:434 -msgid "" -"By default, the server binds itself to all interfaces. The option ``-b/--" -"bind`` specifies a specific address to which it should bind. Both IPv4 and " -"IPv6 addresses are supported. For example, the following command causes the " -"server to bind to localhost only::" -msgstr "" - -#: ../../library/http.server.rst:439 -msgid "python -m http.server --bind 127.0.0.1" -msgstr "python -m http.server --bind 127.0.0.1" - -#: ../../library/http.server.rst:441 -msgid "Added the ``--bind`` option." -msgstr "新增 ``--bind`` 選項。" - -#: ../../library/http.server.rst:444 -msgid "Support IPv6 in the ``--bind`` option." -msgstr "於 ``--bind`` 選項中支援 IPv6。" - -#: ../../library/http.server.rst:447 -msgid "" -"By default, the server uses the current directory. The option ``-d/--" -"directory`` specifies a directory to which it should serve the files. For " -"example, the following command uses a specific directory::" -msgstr "" - -#: ../../library/http.server.rst:451 -msgid "python -m http.server --directory /tmp/" -msgstr "python -m http.server --directory /tmp/" - -#: ../../library/http.server.rst:453 -msgid "Added the ``--directory`` option." -msgstr "新增 ``--directory`` 選項。" - -#: ../../library/http.server.rst:456 -msgid "" -"By default, the server is conformant to HTTP/1.0. The option ``-p/--" -"protocol`` specifies the HTTP version to which the server is conformant. For " -"example, the following command runs an HTTP/1.1 conformant server::" -msgstr "" - -#: ../../library/http.server.rst:460 -msgid "python -m http.server --protocol HTTP/1.1" -msgstr "python -m http.server --protocol HTTP/1.1" - -#: ../../library/http.server.rst:462 -msgid "Added the ``--protocol`` option." -msgstr "新增 ``--protocol`` 選項。" - -#: ../../library/http.server.rst:467 +#: ../../library/http.server.rst:424 msgid "" "This class is used to serve either files or output of CGI scripts from the " "current directory and below. Note that mapping HTTP hierarchic structure to " "local directory structure is exactly as in :class:`SimpleHTTPRequestHandler`." msgstr "" -#: ../../library/http.server.rst:473 +#: ../../library/http.server.rst:430 msgid "" "CGI scripts run by the :class:`CGIHTTPRequestHandler` class cannot execute " "redirects (HTTP code 302), because code 200 (script output follows) is sent " "prior to execution of the CGI script. This pre-empts the status code." msgstr "" -#: ../../library/http.server.rst:478 +#: ../../library/http.server.rst:435 msgid "" "The class will however, run the CGI script, instead of serving it as a file, " "if it guesses it to be a CGI script. Only directory-based CGI are used --- " @@ -634,93 +563,160 @@ msgid "" "denoting CGI scripts." msgstr "" -#: ../../library/http.server.rst:483 +#: ../../library/http.server.rst:440 msgid "" "The :func:`do_GET` and :func:`do_HEAD` functions are modified to run CGI " "scripts and serve the output, instead of serving files, if the request leads " "to somewhere below the ``cgi_directories`` path." msgstr "" -#: ../../library/http.server.rst:487 +#: ../../library/http.server.rst:444 msgid "The :class:`CGIHTTPRequestHandler` defines the following data member:" msgstr "" -#: ../../library/http.server.rst:491 +#: ../../library/http.server.rst:448 msgid "" "This defaults to ``['/cgi-bin', '/htbin']`` and describes directories to " "treat as containing CGI scripts." msgstr "" -#: ../../library/http.server.rst:494 +#: ../../library/http.server.rst:451 msgid "The :class:`CGIHTTPRequestHandler` defines the following method:" msgstr "" -#: ../../library/http.server.rst:498 +#: ../../library/http.server.rst:455 msgid "" "This method serves the ``'POST'`` request type, only allowed for CGI " "scripts. Error 501, \"Can only POST to CGI scripts\", is output when trying " "to POST to a non-CGI url." msgstr "" -#: ../../library/http.server.rst:502 +#: ../../library/http.server.rst:459 msgid "" "Note that CGI scripts will be run with UID of user nobody, for security " "reasons. Problems with the CGI script will be translated to error 403." msgstr "" -#: ../../library/http.server.rst:507 +#: ../../library/http.server.rst:464 msgid "" ":class:`CGIHTTPRequestHandler` is being removed in 3.15. CGI has not been " "considered a good way to do things for well over a decade. This code has " "been unmaintained for a while now and sees very little practical use. " -"Retaining it could lead to further :ref:`security considerations `." +"Retaining it could lead to further :ref:`security considerations " +"`." +msgstr "" + +#: ../../library/http.server.rst:474 +msgid "Command-line interface" +msgstr "命令列介面" + +#: ../../library/http.server.rst:476 +msgid "" +":mod:`http.server` can also be invoked directly using the :option:`-m` " +"switch of the interpreter. The following example illustrates how to serve " +"files relative to the current directory::" +msgstr "" + +#: ../../library/http.server.rst:480 +msgid "python -m http.server [OPTIONS] [port]" +msgstr "python -m http.server [OPTIONS] [port]" + +#: ../../library/http.server.rst:482 +msgid "The following options are accepted:" +msgstr "可接受以下選項:" + +#: ../../library/http.server.rst:488 +msgid "" +"The server listens to port 8000 by default. The default can be overridden by " +"passing the desired port number as an argument::" +msgstr "" + +#: ../../library/http.server.rst:491 +msgid "python -m http.server 9000" +msgstr "python -m http.server 9000" + +#: ../../library/http.server.rst:495 +msgid "" +"Specifies a specific address to which it should bind. Both IPv4 and IPv6 " +"addresses are supported. By default, the server binds itself to all " +"interfaces. For example, the following command causes the server to bind to " +"localhost only::" +msgstr "" + +#: ../../library/http.server.rst:500 +msgid "python -m http.server --bind 127.0.0.1" +msgstr "python -m http.server --bind 127.0.0.1" + +#: ../../library/http.server.rst:504 +msgid "Support IPv6 in the ``--bind`` option." +msgstr "於 ``--bind`` 選項中支援 IPv6。" + +#: ../../library/http.server.rst:509 +msgid "" +"Specifies a directory to which it should serve the files. By default, the " +"server uses the current directory. For example, the following command uses a " +"specific directory::" msgstr "" #: ../../library/http.server.rst:513 +msgid "python -m http.server --directory /tmp/" +msgstr "python -m http.server --directory /tmp/" + +#: ../../library/http.server.rst:519 +msgid "" +"Specifies the HTTP version to which the server is conformant. By default, " +"the server is conformant to HTTP/1.0. For example, the following command " +"runs an HTTP/1.1 conformant server::" +msgstr "" + +#: ../../library/http.server.rst:523 +msgid "python -m http.server --protocol HTTP/1.1" +msgstr "python -m http.server --protocol HTTP/1.1" + +#: ../../library/http.server.rst:529 msgid "" ":class:`CGIHTTPRequestHandler` can be enabled in the command line by passing " "the ``--cgi`` option::" msgstr "" -#: ../../library/http.server.rst:516 +#: ../../library/http.server.rst:532 msgid "python -m http.server --cgi" msgstr "python -m http.server --cgi" -#: ../../library/http.server.rst:520 +#: ../../library/http.server.rst:536 msgid "" -":mod:`http.server` command line ``--cgi`` support is being removed because :" -"class:`CGIHTTPRequestHandler` is being removed." +":mod:`http.server` command line ``--cgi`` support is being removed " +"because :class:`CGIHTTPRequestHandler` is being removed." msgstr "" -#: ../../library/http.server.rst:525 +#: ../../library/http.server.rst:541 msgid "" -":class:`CGIHTTPRequestHandler` and the ``--cgi`` command line option are not " +":class:`CGIHTTPRequestHandler` and the ``--cgi`` command-line option are not " "intended for use by untrusted clients and may be vulnerable to exploitation. " "Always use within a secure environment." msgstr "" -#: ../../library/http.server.rst:532 -msgid "Security Considerations" +#: ../../library/http.server.rst:549 +msgid "Security considerations" msgstr "安全性注意事項" -#: ../../library/http.server.rst:536 +#: ../../library/http.server.rst:553 msgid "" ":class:`SimpleHTTPRequestHandler` will follow symbolic links when handling " "requests, this makes it possible for files outside of the specified " "directory to be served." msgstr "" -#: ../../library/http.server.rst:540 +#: ../../library/http.server.rst:557 msgid "" "Earlier versions of Python did not scrub control characters from the log " -"messages emitted to stderr from ``python -m http.server`` or the default :" -"class:`BaseHTTPRequestHandler` ``.log_message`` implementation. This could " -"allow remote clients connecting to your server to send nefarious control " -"codes to your terminal." +"messages emitted to stderr from ``python -m http.server`` or the " +"default :class:`BaseHTTPRequestHandler` ``.log_message`` implementation. " +"This could allow remote clients connecting to your server to send nefarious " +"control codes to your terminal." msgstr "" -#: ../../library/http.server.rst:546 +#: ../../library/http.server.rst:563 msgid "Control characters are scrubbed in stderr logs." msgstr "" @@ -748,10 +744,19 @@ msgstr "URL(統一資源定位器)" msgid "httpd" msgstr "httpd" -#: ../../library/http.server.rst:534 +#: ../../library/http.server.rst:551 msgid "http.server" msgstr "http.server" -#: ../../library/http.server.rst:534 +#: ../../library/http.server.rst:551 msgid "security" msgstr "security(安全)" + +#~ msgid "Added the ``--bind`` option." +#~ msgstr "新增 ``--bind`` 選項。" + +#~ msgid "Added the ``--directory`` option." +#~ msgstr "新增 ``--directory`` 選項。" + +#~ msgid "Added the ``--protocol`` option." +#~ msgstr "新增 ``--protocol`` 選項。" diff --git a/library/idle.po b/library/idle.po index 66d6e0817f..e68ee42b2f 100644 --- a/library/idle.po +++ b/library/idle.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -7,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-25 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -18,59 +17,64 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: ../../library/idle.rst:4 ../../library/idle.rst:10 -msgid "IDLE" -msgstr "IDLE" +#: ../../library/idle.rst:4 +msgid "IDLE --- Python editor and shell" +msgstr "IDLE --- Python 編輯器與 shell" #: ../../library/idle.rst:8 msgid "**Source code:** :source:`Lib/idlelib/`" msgstr "**原始碼:**\\ :source:`Lib/idlelib/`" -#: ../../library/idle.rst:17 +#: ../../library/idle.rst:20 msgid "IDLE is Python's Integrated Development and Learning Environment." msgstr "" +"IDLE 是 Python 的整合開發與學習環境 (Integrated Development and Learning " +"Environment)。" -#: ../../library/idle.rst:19 +#: ../../library/idle.rst:22 msgid "IDLE has the following features:" -msgstr "" +msgstr "IDLE 具有以下功能:" -#: ../../library/idle.rst:21 +#: ../../library/idle.rst:24 msgid "cross-platform: works mostly the same on Windows, Unix, and macOS" -msgstr "" +msgstr "跨平台:在 Windows、Unix 和 macOS 上的運作大致相同" -#: ../../library/idle.rst:23 +#: ../../library/idle.rst:26 msgid "" "Python shell window (interactive interpreter) with colorizing of code input, " "output, and error messages" msgstr "" +"Python shell window(互動式解譯器)提供有色彩的程式碼輸入、輸出和錯誤訊息" -#: ../../library/idle.rst:26 +#: ../../library/idle.rst:29 msgid "" "multi-window text editor with multiple undo, Python colorizing, smart " "indent, call tips, auto completion, and other features" msgstr "" +"多視窗文字編輯器,具有多次復原、Python 語法上色、智慧縮排、呼叫提示、自動完成" +"等功能" -#: ../../library/idle.rst:29 +#: ../../library/idle.rst:32 msgid "" "search within any window, replace within editor windows, and search through " "multiple files (grep)" -msgstr "" +msgstr "能在任何視窗中搜尋、編輯器視窗中取代文字,以及搜尋多個檔案 (grep)" -#: ../../library/idle.rst:32 +#: ../../library/idle.rst:35 msgid "" "debugger with persistent breakpoints, stepping, and viewing of global and " "local namespaces" -msgstr "" +msgstr "具有持久性斷點、能夠逐步執行和檢視全域和區域命名空間的除錯器" -#: ../../library/idle.rst:35 +#: ../../library/idle.rst:38 msgid "configuration, browsers, and other dialogs" -msgstr "" +msgstr "設定、瀏覽器和其他對話框" -#: ../../library/idle.rst:38 +#: ../../library/idle.rst:41 msgid "Menus" msgstr "目錄" -#: ../../library/idle.rst:40 +#: ../../library/idle.rst:43 msgid "" "IDLE has two main window types, the Shell window and the Editor window. It " "is possible to have multiple editor windows simultaneously. On Windows and " @@ -78,81 +82,81 @@ msgid "" "which window type it is associated with." msgstr "" -#: ../../library/idle.rst:45 +#: ../../library/idle.rst:48 msgid "" "Output windows, such as used for Edit => Find in Files, are a subtype of " "editor window. They currently have the same top menu but a different " "default title and context menu." msgstr "" -#: ../../library/idle.rst:49 +#: ../../library/idle.rst:52 msgid "" "On macOS, there is one application menu. It dynamically changes according " "to the window currently selected. It has an IDLE menu, and some entries " "described below are moved around to conform to Apple guidelines." msgstr "" -#: ../../library/idle.rst:54 +#: ../../library/idle.rst:57 msgid "File menu (Shell and Editor)" msgstr "" -#: ../../library/idle.rst:56 +#: ../../library/idle.rst:59 msgid "New File" msgstr "新增檔案" -#: ../../library/idle.rst:57 +#: ../../library/idle.rst:60 msgid "Create a new file editing window." msgstr "" -#: ../../library/idle.rst:59 +#: ../../library/idle.rst:62 msgid "Open..." msgstr "" -#: ../../library/idle.rst:60 +#: ../../library/idle.rst:63 msgid "Open an existing file with an Open dialog." msgstr "" -#: ../../library/idle.rst:62 +#: ../../library/idle.rst:65 msgid "Open Module..." msgstr "" -#: ../../library/idle.rst:63 +#: ../../library/idle.rst:66 msgid "Open an existing module (searches sys.path)." msgstr "" -#: ../../library/idle.rst:65 +#: ../../library/idle.rst:68 msgid "Recent Files" msgstr "" -#: ../../library/idle.rst:66 +#: ../../library/idle.rst:69 msgid "Open a list of recent files. Click one to open it." msgstr "" -#: ../../library/idle.rst:72 +#: ../../library/idle.rst:75 msgid "Module Browser" msgstr "" -#: ../../library/idle.rst:73 +#: ../../library/idle.rst:76 msgid "" "Show functions, classes, and methods in the current Editor file in a tree " "structure. In the shell, open a module first." msgstr "" -#: ../../library/idle.rst:76 +#: ../../library/idle.rst:79 msgid "Path Browser" msgstr "" -#: ../../library/idle.rst:77 +#: ../../library/idle.rst:80 msgid "" "Show sys.path directories, modules, functions, classes and methods in a tree " "structure." msgstr "" -#: ../../library/idle.rst:80 +#: ../../library/idle.rst:83 msgid "Save" msgstr "" -#: ../../library/idle.rst:81 +#: ../../library/idle.rst:84 msgid "" "Save the current window to the associated file, if there is one. Windows " "that have been changed since being opened or last saved have a \\* before " @@ -160,11 +164,11 @@ msgid "" "instead." msgstr "" -#: ../../library/idle.rst:86 +#: ../../library/idle.rst:89 msgid "Save As..." msgstr "" -#: ../../library/idle.rst:87 +#: ../../library/idle.rst:90 msgid "" "Save the current window with a Save As dialog. The file saved becomes the " "new associated file for the window. (If your file namager is set to hide " @@ -173,283 +177,283 @@ msgid "" "text files, except that on macOS Aqua,'.py' is added for all files.)" msgstr "" -#: ../../library/idle.rst:93 +#: ../../library/idle.rst:96 msgid "Save Copy As..." msgstr "" -#: ../../library/idle.rst:94 +#: ../../library/idle.rst:97 msgid "" "Save the current window to different file without changing the associated " "file. (See Save As note above about filename extensions.)" msgstr "" -#: ../../library/idle.rst:97 +#: ../../library/idle.rst:100 msgid "Print Window" msgstr "" -#: ../../library/idle.rst:98 +#: ../../library/idle.rst:101 msgid "Print the current window to the default printer." msgstr "" -#: ../../library/idle.rst:100 +#: ../../library/idle.rst:103 msgid "Close Window" msgstr "" -#: ../../library/idle.rst:101 +#: ../../library/idle.rst:104 msgid "" "Close the current window (if an unsaved editor, ask to save; if an unsaved " "Shell, ask to quit execution). Calling ``exit()`` or ``close()`` in the " "Shell window also closes Shell. If this is the only window, also exit IDLE." msgstr "" -#: ../../library/idle.rst:105 +#: ../../library/idle.rst:108 msgid "Exit IDLE" msgstr "離開 IDLE" -#: ../../library/idle.rst:106 +#: ../../library/idle.rst:109 msgid "Close all windows and quit IDLE (ask to save unsaved edit windows)." msgstr "" -#: ../../library/idle.rst:109 +#: ../../library/idle.rst:112 msgid "Edit menu (Shell and Editor)" msgstr "" -#: ../../library/idle.rst:111 +#: ../../library/idle.rst:114 msgid "Undo" msgstr "" -#: ../../library/idle.rst:112 +#: ../../library/idle.rst:115 msgid "" "Undo the last change to the current window. A maximum of 1000 changes may " "be undone." msgstr "" -#: ../../library/idle.rst:115 +#: ../../library/idle.rst:118 msgid "Redo" msgstr "" -#: ../../library/idle.rst:116 +#: ../../library/idle.rst:119 msgid "Redo the last undone change to the current window." msgstr "" -#: ../../library/idle.rst:118 +#: ../../library/idle.rst:121 msgid "Select All" msgstr "Select All(選擇全部)" -#: ../../library/idle.rst:119 +#: ../../library/idle.rst:122 msgid "Select the entire contents of the current window." msgstr "" -#: ../../library/idle.rst:121 ../../library/idle.rst:353 -#: ../../library/idle.rst:367 +#: ../../library/idle.rst:124 ../../library/idle.rst:356 +#: ../../library/idle.rst:370 msgid "Cut" msgstr "Cut(剪下)" -#: ../../library/idle.rst:122 ../../library/idle.rst:368 +#: ../../library/idle.rst:125 ../../library/idle.rst:371 msgid "" "Copy selection into the system-wide clipboard; then delete the selection." msgstr "" -#: ../../library/idle.rst:124 ../../library/idle.rst:353 -#: ../../library/idle.rst:370 +#: ../../library/idle.rst:127 ../../library/idle.rst:356 +#: ../../library/idle.rst:373 msgid "Copy" msgstr "Copy(複製)" -#: ../../library/idle.rst:125 ../../library/idle.rst:371 +#: ../../library/idle.rst:128 ../../library/idle.rst:374 msgid "Copy selection into the system-wide clipboard." msgstr "" -#: ../../library/idle.rst:127 ../../library/idle.rst:353 -#: ../../library/idle.rst:373 +#: ../../library/idle.rst:130 ../../library/idle.rst:356 +#: ../../library/idle.rst:376 msgid "Paste" msgstr "Paste(貼上)" -#: ../../library/idle.rst:128 ../../library/idle.rst:374 +#: ../../library/idle.rst:131 ../../library/idle.rst:377 msgid "Insert contents of the system-wide clipboard into the current window." msgstr "" -#: ../../library/idle.rst:130 +#: ../../library/idle.rst:133 msgid "The clipboard functions are also available in context menus." msgstr "" -#: ../../library/idle.rst:132 +#: ../../library/idle.rst:135 msgid "Find..." msgstr "" -#: ../../library/idle.rst:133 +#: ../../library/idle.rst:136 msgid "Open a search dialog with many options" msgstr "" -#: ../../library/idle.rst:135 +#: ../../library/idle.rst:138 msgid "Find Again" msgstr "" -#: ../../library/idle.rst:136 +#: ../../library/idle.rst:139 msgid "Repeat the last search, if there is one." msgstr "" -#: ../../library/idle.rst:138 +#: ../../library/idle.rst:141 msgid "Find Selection" msgstr "" -#: ../../library/idle.rst:139 +#: ../../library/idle.rst:142 msgid "Search for the currently selected string, if there is one." msgstr "" -#: ../../library/idle.rst:141 +#: ../../library/idle.rst:144 msgid "Find in Files..." msgstr "" -#: ../../library/idle.rst:142 +#: ../../library/idle.rst:145 msgid "Open a file search dialog. Put results in a new output window." msgstr "" -#: ../../library/idle.rst:144 +#: ../../library/idle.rst:147 msgid "Replace..." msgstr "" -#: ../../library/idle.rst:145 +#: ../../library/idle.rst:148 msgid "Open a search-and-replace dialog." msgstr "" -#: ../../library/idle.rst:147 +#: ../../library/idle.rst:150 msgid "Go to Line" msgstr "" -#: ../../library/idle.rst:148 +#: ../../library/idle.rst:151 msgid "" "Move the cursor to the beginning of the line requested and make that line " "visible. A request past the end of the file goes to the end. Clear any " "selection and update the line and column status." msgstr "" -#: ../../library/idle.rst:152 +#: ../../library/idle.rst:155 msgid "Show Completions" msgstr "" -#: ../../library/idle.rst:153 +#: ../../library/idle.rst:156 msgid "" "Open a scrollable list allowing selection of existing names. See :ref:" "`Completions ` in the Editing and navigation section below." msgstr "" -#: ../../library/idle.rst:156 +#: ../../library/idle.rst:159 msgid "Expand Word" msgstr "" -#: ../../library/idle.rst:157 +#: ../../library/idle.rst:160 msgid "" "Expand a prefix you have typed to match a full word in the same window; " "repeat to get a different expansion." msgstr "" -#: ../../library/idle.rst:160 +#: ../../library/idle.rst:163 msgid "Show Call Tip" msgstr "" -#: ../../library/idle.rst:161 +#: ../../library/idle.rst:164 msgid "" "After an unclosed parenthesis for a function, open a small window with " "function parameter hints. See :ref:`Calltips ` in the Editing and " "navigation section below." msgstr "" -#: ../../library/idle.rst:165 +#: ../../library/idle.rst:168 msgid "Show Surrounding Parens" msgstr "" -#: ../../library/idle.rst:166 +#: ../../library/idle.rst:169 msgid "Highlight the surrounding parenthesis." msgstr "" -#: ../../library/idle.rst:171 +#: ../../library/idle.rst:174 msgid "Format menu (Editor window only)" msgstr "" -#: ../../library/idle.rst:173 +#: ../../library/idle.rst:176 msgid "Format Paragraph" msgstr "" -#: ../../library/idle.rst:174 +#: ../../library/idle.rst:177 msgid "" "Reformat the current blank-line-delimited paragraph in comment block or " "multiline string or selected line in a string. All lines in the paragraph " "will be formatted to less than N columns, where N defaults to 72." msgstr "" -#: ../../library/idle.rst:178 +#: ../../library/idle.rst:181 msgid "Indent Region" msgstr "" -#: ../../library/idle.rst:179 +#: ../../library/idle.rst:182 msgid "Shift selected lines right by the indent width (default 4 spaces)." msgstr "" -#: ../../library/idle.rst:181 +#: ../../library/idle.rst:184 msgid "Dedent Region" msgstr "" -#: ../../library/idle.rst:182 +#: ../../library/idle.rst:185 msgid "Shift selected lines left by the indent width (default 4 spaces)." msgstr "" -#: ../../library/idle.rst:184 +#: ../../library/idle.rst:187 msgid "Comment Out Region" msgstr "" -#: ../../library/idle.rst:185 +#: ../../library/idle.rst:188 msgid "Insert ## in front of selected lines." msgstr "" -#: ../../library/idle.rst:187 +#: ../../library/idle.rst:190 msgid "Uncomment Region" msgstr "" -#: ../../library/idle.rst:188 +#: ../../library/idle.rst:191 msgid "Remove leading # or ## from selected lines." msgstr "" -#: ../../library/idle.rst:190 +#: ../../library/idle.rst:193 msgid "Tabify Region" msgstr "" -#: ../../library/idle.rst:191 +#: ../../library/idle.rst:194 msgid "" "Turn *leading* stretches of spaces into tabs. (Note: We recommend using 4 " "space blocks to indent Python code.)" msgstr "" -#: ../../library/idle.rst:194 +#: ../../library/idle.rst:197 msgid "Untabify Region" msgstr "" -#: ../../library/idle.rst:195 +#: ../../library/idle.rst:198 msgid "Turn *all* tabs into the correct number of spaces." msgstr "" -#: ../../library/idle.rst:197 +#: ../../library/idle.rst:200 msgid "Toggle Tabs" msgstr "" -#: ../../library/idle.rst:198 +#: ../../library/idle.rst:201 msgid "Open a dialog to switch between indenting with spaces and tabs." msgstr "" -#: ../../library/idle.rst:200 +#: ../../library/idle.rst:203 msgid "New Indent Width" msgstr "" -#: ../../library/idle.rst:201 +#: ../../library/idle.rst:204 msgid "" "Open a dialog to change indent width. The accepted default by the Python " "community is 4 spaces." msgstr "" -#: ../../library/idle.rst:204 +#: ../../library/idle.rst:207 msgid "Strip Trailing Chitespace" msgstr "" -#: ../../library/idle.rst:205 +#: ../../library/idle.rst:208 msgid "" "Remove trailing space and other whitespace characters after the last non-" "whitespace character of a line by applying str.rstrip to each line, " @@ -457,15 +461,15 @@ msgid "" "extra newlines at the end of the file." msgstr "" -#: ../../library/idle.rst:214 +#: ../../library/idle.rst:217 msgid "Run menu (Editor window only)" msgstr "" -#: ../../library/idle.rst:218 +#: ../../library/idle.rst:221 msgid "Run Module" msgstr "" -#: ../../library/idle.rst:219 +#: ../../library/idle.rst:222 msgid "" "Do :ref:`Check Module `. If no error, restart the shell to " "clean the environment, then execute the module. Output is displayed in the " @@ -475,22 +479,22 @@ msgid "" "similar to executing a file with ``python -i file`` at a command line." msgstr "" -#: ../../library/idle.rst:229 +#: ../../library/idle.rst:232 msgid "Run... Customized" msgstr "" -#: ../../library/idle.rst:230 +#: ../../library/idle.rst:233 msgid "" "Same as :ref:`Run Module `, but run the module with customized " "settings. *Command Line Arguments* extend :data:`sys.argv` as if passed on " "a command line. The module can be run in the Shell without restarting." msgstr "" -#: ../../library/idle.rst:236 +#: ../../library/idle.rst:239 msgid "Check Module" msgstr "" -#: ../../library/idle.rst:237 +#: ../../library/idle.rst:240 msgid "" "Check the syntax of the module currently open in the Editor window. If the " "module has not been saved IDLE will either prompt the user to save or " @@ -499,70 +503,70 @@ msgid "" "window." msgstr "" -#: ../../library/idle.rst:245 +#: ../../library/idle.rst:248 msgid "Python Shell" msgstr "" -#: ../../library/idle.rst:246 +#: ../../library/idle.rst:249 msgid "Open or wake up the Python Shell window." msgstr "" -#: ../../library/idle.rst:250 +#: ../../library/idle.rst:253 msgid "Shell menu (Shell window only)" msgstr "" -#: ../../library/idle.rst:252 +#: ../../library/idle.rst:255 msgid "View Last Restart" msgstr "" -#: ../../library/idle.rst:253 +#: ../../library/idle.rst:256 msgid "Scroll the shell window to the last Shell restart." msgstr "" -#: ../../library/idle.rst:255 +#: ../../library/idle.rst:258 msgid "Restart Shell" msgstr "" -#: ../../library/idle.rst:256 +#: ../../library/idle.rst:259 msgid "" "Restart the shell to clean the environment and reset display and exception " "handling." msgstr "" -#: ../../library/idle.rst:258 +#: ../../library/idle.rst:261 msgid "Previous History" msgstr "" -#: ../../library/idle.rst:259 +#: ../../library/idle.rst:262 msgid "" "Cycle through earlier commands in history which match the current entry." msgstr "" -#: ../../library/idle.rst:261 +#: ../../library/idle.rst:264 msgid "Next History" msgstr "" -#: ../../library/idle.rst:262 +#: ../../library/idle.rst:265 msgid "Cycle through later commands in history which match the current entry." msgstr "" -#: ../../library/idle.rst:264 +#: ../../library/idle.rst:267 msgid "Interrupt Execution" msgstr "" -#: ../../library/idle.rst:265 +#: ../../library/idle.rst:268 msgid "Stop a running program." msgstr "" -#: ../../library/idle.rst:268 +#: ../../library/idle.rst:271 msgid "Debug menu (Shell window only)" msgstr "" -#: ../../library/idle.rst:270 +#: ../../library/idle.rst:273 msgid "Go to File/Line" msgstr "" -#: ../../library/idle.rst:271 +#: ../../library/idle.rst:274 msgid "" "Look on the current line. with the cursor, and the line above for a filename " "and line number. If found, open the file if not already open, and show the " @@ -571,45 +575,45 @@ msgid "" "Shell window and Output windows." msgstr "" -#: ../../library/idle.rst:281 +#: ../../library/idle.rst:284 msgid "Debugger (toggle)" msgstr "" -#: ../../library/idle.rst:282 +#: ../../library/idle.rst:285 msgid "" "When activated, code entered in the Shell or run from an Editor will run " "under the debugger. In the Editor, breakpoints can be set with the context " "menu. This feature is still incomplete and somewhat experimental." msgstr "" -#: ../../library/idle.rst:286 +#: ../../library/idle.rst:289 msgid "Stack Viewer" msgstr "" -#: ../../library/idle.rst:287 +#: ../../library/idle.rst:290 msgid "" "Show the stack traceback of the last exception in a tree widget, with access " "to locals and globals." msgstr "" -#: ../../library/idle.rst:290 +#: ../../library/idle.rst:293 msgid "Auto-open Stack Viewer" msgstr "" -#: ../../library/idle.rst:291 +#: ../../library/idle.rst:294 msgid "" "Toggle automatically opening the stack viewer on an unhandled exception." msgstr "" -#: ../../library/idle.rst:294 +#: ../../library/idle.rst:297 msgid "Options menu (Shell and Editor)" msgstr "" -#: ../../library/idle.rst:296 +#: ../../library/idle.rst:299 msgid "Configure IDLE" msgstr "" -#: ../../library/idle.rst:297 +#: ../../library/idle.rst:300 msgid "" "Open a configuration dialog and change preferences for the following: fonts, " "indentation, keybindings, text color themes, startup windows and size, " @@ -618,39 +622,39 @@ msgid "" "see :ref:`Setting preferences ` under Help and preferences." msgstr "" -#: ../../library/idle.rst:304 +#: ../../library/idle.rst:307 msgid "" "Most configuration options apply to all windows or all future windows. The " "option items below only apply to the active window." msgstr "" -#: ../../library/idle.rst:307 +#: ../../library/idle.rst:310 msgid "Show/Hide Code Context (Editor Window only)" msgstr "" -#: ../../library/idle.rst:308 +#: ../../library/idle.rst:311 msgid "" "Open a pane at the top of the edit window which shows the block context of " "the code which has scrolled above the top of the window. See :ref:`Code " "Context ` in the Editing and Navigation section below." msgstr "" -#: ../../library/idle.rst:313 +#: ../../library/idle.rst:316 msgid "Show/Hide Line Numbers (Editor Window only)" msgstr "" -#: ../../library/idle.rst:314 +#: ../../library/idle.rst:317 msgid "" "Open a column to the left of the edit window which shows the number of each " "line of text. The default is off, which may be changed in the preferences " "(see :ref:`Setting preferences `)." msgstr "" -#: ../../library/idle.rst:318 +#: ../../library/idle.rst:321 msgid "Zoom/Restore Height" msgstr "" -#: ../../library/idle.rst:319 +#: ../../library/idle.rst:322 msgid "" "Toggles the window between normal size and maximum height. The initial size " "defaults to 40 lines by 80 chars unless changed on the General tab of the " @@ -660,74 +664,74 @@ msgid "" "no effect when a window is maximized." msgstr "" -#: ../../library/idle.rst:327 +#: ../../library/idle.rst:330 msgid "Window menu (Shell and Editor)" msgstr "" -#: ../../library/idle.rst:329 +#: ../../library/idle.rst:332 msgid "" "Lists the names of all open windows; select one to bring it to the " "foreground (deiconifying it if necessary)." msgstr "" -#: ../../library/idle.rst:333 +#: ../../library/idle.rst:336 msgid "Help menu (Shell and Editor)" msgstr "" -#: ../../library/idle.rst:335 +#: ../../library/idle.rst:338 msgid "About IDLE" -msgstr "" +msgstr "關於 IDLE" -#: ../../library/idle.rst:336 +#: ../../library/idle.rst:339 msgid "Display version, copyright, license, credits, and more." msgstr "" -#: ../../library/idle.rst:338 +#: ../../library/idle.rst:341 msgid "IDLE Help" msgstr "" -#: ../../library/idle.rst:339 +#: ../../library/idle.rst:342 msgid "" "Display this IDLE document, detailing the menu options, basic editing and " "navigation, and other tips." msgstr "" -#: ../../library/idle.rst:342 +#: ../../library/idle.rst:345 msgid "Python Docs" msgstr "" -#: ../../library/idle.rst:343 +#: ../../library/idle.rst:346 msgid "" "Access local Python documentation, if installed, or start a web browser and " "open docs.python.org showing the latest Python documentation." msgstr "" -#: ../../library/idle.rst:346 +#: ../../library/idle.rst:349 msgid "Turtle Demo" msgstr "" -#: ../../library/idle.rst:347 +#: ../../library/idle.rst:350 msgid "Run the turtledemo module with example Python code and turtle drawings." msgstr "" -#: ../../library/idle.rst:349 +#: ../../library/idle.rst:352 msgid "" "Additional help sources may be added here with the Configure IDLE dialog " "under the General tab. See the :ref:`Help sources ` subsection " "below for more on Help menu choices." msgstr "" -#: ../../library/idle.rst:362 +#: ../../library/idle.rst:365 msgid "Context menus" msgstr "" -#: ../../library/idle.rst:364 +#: ../../library/idle.rst:367 msgid "" "Open a context menu by right-clicking in a window (Control-click on macOS). " "Context menus have the standard clipboard functions also on the Edit menu." msgstr "" -#: ../../library/idle.rst:376 +#: ../../library/idle.rst:379 msgid "" "Editor windows also have breakpoint functions. Lines with a breakpoint set " "are specially marked. Breakpoints only have an effect when running under " @@ -735,66 +739,66 @@ msgid "" "directory." msgstr "" -#: ../../library/idle.rst:353 ../../library/idle.rst:381 +#: ../../library/idle.rst:356 ../../library/idle.rst:384 msgid "Set Breakpoint" msgstr "" -#: ../../library/idle.rst:382 +#: ../../library/idle.rst:385 msgid "Set a breakpoint on the current line." msgstr "" -#: ../../library/idle.rst:353 ../../library/idle.rst:384 +#: ../../library/idle.rst:356 ../../library/idle.rst:387 msgid "Clear Breakpoint" msgstr "" -#: ../../library/idle.rst:385 +#: ../../library/idle.rst:388 msgid "Clear the breakpoint on that line." msgstr "" -#: ../../library/idle.rst:387 +#: ../../library/idle.rst:390 msgid "Shell and Output windows also have the following." msgstr "" -#: ../../library/idle.rst:389 +#: ../../library/idle.rst:392 msgid "Go to file/line" msgstr "" -#: ../../library/idle.rst:390 +#: ../../library/idle.rst:393 msgid "Same as in Debug menu." msgstr "" -#: ../../library/idle.rst:392 +#: ../../library/idle.rst:395 msgid "" "The Shell window also has an output squeezing facility explained in the " "*Python Shell window* subsection below." msgstr "" -#: ../../library/idle.rst:395 +#: ../../library/idle.rst:398 msgid "Squeeze" msgstr "" -#: ../../library/idle.rst:396 +#: ../../library/idle.rst:399 msgid "" "If the cursor is over an output line, squeeze all the output between the " "code above and the prompt below down to a 'Squeezed text' label." msgstr "" -#: ../../library/idle.rst:403 +#: ../../library/idle.rst:406 msgid "Editing and Navigation" msgstr "" -#: ../../library/idle.rst:406 +#: ../../library/idle.rst:409 msgid "Editor windows" msgstr "" -#: ../../library/idle.rst:408 +#: ../../library/idle.rst:411 msgid "" "IDLE may open editor windows when it starts, depending on settings and how " "you start IDLE. Thereafter, use the File menu. There can be only one open " "editor window for a given file." msgstr "" -#: ../../library/idle.rst:412 +#: ../../library/idle.rst:415 msgid "" "The title bar contains the name of the file, the full path, and the version " "of Python and IDLE running the window. The status bar contains the line " @@ -802,17 +806,17 @@ msgid "" "numbers with 0." msgstr "" -#: ../../library/idle.rst:417 +#: ../../library/idle.rst:420 msgid "" "IDLE assumes that files with a known .py* extension contain Python code and " "that other files do not. Run Python code with the Run menu." msgstr "" -#: ../../library/idle.rst:421 +#: ../../library/idle.rst:424 msgid "Key bindings" msgstr "" -#: ../../library/idle.rst:423 +#: ../../library/idle.rst:426 msgid "" "The IDLE insertion cursor is a thin vertical bar between character " "positions. When characters are entered, the insertion cursor and everything " @@ -820,7 +824,7 @@ msgid "" "the new space." msgstr "" -#: ../../library/idle.rst:428 +#: ../../library/idle.rst:431 msgid "" "Several non-character keys move the cursor and possibly delete characters. " "Deletion does not puts text on the clipboard, but IDLE has an undo list. " @@ -829,52 +833,52 @@ msgid "" "discussions assume that the keys have not been re-bound to something else.)" msgstr "" -#: ../../library/idle.rst:435 +#: ../../library/idle.rst:438 msgid "Arrow keys move the cursor one character or line." msgstr "" -#: ../../library/idle.rst:437 +#: ../../library/idle.rst:440 msgid "" ":kbd:`C-LeftArrow` and :kbd:`C-RightArrow` moves left or right one word." msgstr "" -#: ../../library/idle.rst:439 +#: ../../library/idle.rst:442 msgid ":kbd:`Home` and :kbd:`End` go to the beginning or end of the line." msgstr "" -#: ../../library/idle.rst:441 +#: ../../library/idle.rst:444 msgid ":kbd:`Page Up` and :kbd:`Page Down` go up or down one screen." msgstr "" -#: ../../library/idle.rst:443 +#: ../../library/idle.rst:446 msgid ":kbd:`C-Home` and :kbd:`C-End` go to beginning or end of the file." msgstr "" -#: ../../library/idle.rst:445 +#: ../../library/idle.rst:448 msgid "" ":kbd:`Backspace` and :kbd:`Del` (or :kbd:`C-d`) delete the previous or next " "character." msgstr "" -#: ../../library/idle.rst:448 +#: ../../library/idle.rst:451 msgid ":kbd:`C-Backspace` and :kbd:`C-Del` delete one word left or right." msgstr "" -#: ../../library/idle.rst:450 +#: ../../library/idle.rst:453 msgid ":kbd:`C-k` deletes ('kills') everything to the right." msgstr "" -#: ../../library/idle.rst:452 +#: ../../library/idle.rst:455 msgid "" "Standard keybindings (like :kbd:`C-c` to copy and :kbd:`C-v` to paste) may " "work. Keybindings are selected in the Configure IDLE dialog." msgstr "" -#: ../../library/idle.rst:456 +#: ../../library/idle.rst:459 msgid "Automatic indentation" msgstr "" -#: ../../library/idle.rst:458 +#: ../../library/idle.rst:461 msgid "" "After a block-opening statement, the next line is indented by 4 spaces (in " "the Python Shell window by one tab). After certain keywords (break, return " @@ -884,17 +888,17 @@ msgid "" "tabs are restricted to four spaces due to Tcl/Tk limitations." msgstr "" -#: ../../library/idle.rst:465 +#: ../../library/idle.rst:468 msgid "" "See also the indent/dedent region commands on the :ref:`Format menu `." msgstr "" -#: ../../library/idle.rst:469 +#: ../../library/idle.rst:472 msgid "Search and Replace" msgstr "" -#: ../../library/idle.rst:471 +#: ../../library/idle.rst:474 msgid "" "Any selection becomes a search target. However, only selections within a " "line work because searches are only performed within lines with the terminal " @@ -902,11 +906,11 @@ msgid "" "interpreted according to the Python re module." msgstr "" -#: ../../library/idle.rst:479 +#: ../../library/idle.rst:482 msgid "Completions" msgstr "" -#: ../../library/idle.rst:481 +#: ../../library/idle.rst:484 msgid "" "Completions are supplied, when requested and available, for module names, " "attributes of classes or functions, or filenames. Each request method " @@ -919,7 +923,7 @@ msgid "" "box. A double click within the box selects and closes." msgstr "" -#: ../../library/idle.rst:492 +#: ../../library/idle.rst:495 msgid "" "One way to open a box is to type a key character and wait for a predefined " "interval. This defaults to 2 seconds; customize it in the settings dialog. " @@ -931,7 +935,7 @@ msgid "" "directory name and a separator." msgstr "" -#: ../../library/idle.rst:502 +#: ../../library/idle.rst:505 msgid "" "Instead of waiting, or after a box is closed, open a completion box " "immediately with Show Completions on the Edit menu. The default hot key is :" @@ -942,7 +946,7 @@ msgid "" "directory." msgstr "" -#: ../../library/idle.rst:510 +#: ../../library/idle.rst:513 msgid "" "Hitting :kbd:`Tab` after a prefix usually has the same effect as Show " "Completions. (With no prefix, it indents.) However, if there is only one " @@ -950,14 +954,14 @@ msgid "" "without opening a box." msgstr "" -#: ../../library/idle.rst:515 +#: ../../library/idle.rst:518 msgid "" "Invoking 'Show Completions', or hitting :kbd:`Tab` after a prefix, outside " "of a string and without a preceding '.' opens a box with keywords, builtin " "names, and available module-level names." msgstr "" -#: ../../library/idle.rst:519 +#: ../../library/idle.rst:522 msgid "" "When editing code in an editor (as oppose to Shell), increase the available " "module-level names by running your code and not restarting the Shell " @@ -965,18 +969,18 @@ msgid "" "file. This also increases possible attribute completions." msgstr "" -#: ../../library/idle.rst:525 +#: ../../library/idle.rst:528 msgid "" "Completion boxes initially exclude names beginning with '_' or, for modules, " "not included in '__all__'. The hidden names can be accessed by typing '_' " "after '.', either before or after the box is opened." msgstr "" -#: ../../library/idle.rst:532 +#: ../../library/idle.rst:535 msgid "Calltips" msgstr "" -#: ../../library/idle.rst:534 +#: ../../library/idle.rst:537 msgid "" "A calltip is shown automatically when one types :kbd:`(` after the name of " "an *accessible* function. A function name expression may include dots and " @@ -986,7 +990,7 @@ msgid "" "or enter its shortcut to display a calltip." msgstr "" -#: ../../library/idle.rst:541 +#: ../../library/idle.rst:544 msgid "" "The calltip consists of the function's signature and docstring up to the " "latter's first blank line or the fifth non-blank line. (Some builtin " @@ -995,14 +999,14 @@ msgid "" "or name (keyword) only. Details are subject to change." msgstr "" -#: ../../library/idle.rst:547 +#: ../../library/idle.rst:550 msgid "" "In Shell, the accessible functions depends on what modules have been " "imported into the user process, including those imported by Idle itself, and " "which definitions have been run, all since the last restart." msgstr "" -#: ../../library/idle.rst:551 +#: ../../library/idle.rst:554 msgid "" "For example, restart the Shell and enter ``itertools.count(``. A calltip " "appears because Idle imports itertools into the user process for its own " @@ -1012,18 +1016,18 @@ msgid "" "display a calltip." msgstr "" -#: ../../library/idle.rst:558 +#: ../../library/idle.rst:561 msgid "" "In an editor, import statements have no effect until one runs the file. One " "might want to run a file after writing import statements, after adding " "function definitions, or after opening an existing file." msgstr "" -#: ../../library/idle.rst:565 +#: ../../library/idle.rst:568 msgid "Code Context" msgstr "" -#: ../../library/idle.rst:567 +#: ../../library/idle.rst:570 msgid "" "Within an editor window containing Python code, code context can be toggled " "in order to show or hide a pane at the top of the window. When shown, this " @@ -1037,23 +1041,23 @@ msgid "" "the top of the editor." msgstr "" -#: ../../library/idle.rst:578 +#: ../../library/idle.rst:581 msgid "" "The text and background colors for the context pane can be configured under " "the Highlights tab in the Configure IDLE dialog." msgstr "" -#: ../../library/idle.rst:582 +#: ../../library/idle.rst:585 msgid "Shell window" msgstr "" -#: ../../library/idle.rst:584 +#: ../../library/idle.rst:587 msgid "" "In IDLE's Shell, enter, edit, and recall complete statements. (Most consoles " "and terminals only work with a single physical line at a time)." msgstr "" -#: ../../library/idle.rst:587 +#: ../../library/idle.rst:590 msgid "" "Submit a single-line statement for execution by hitting :kbd:`Return` with " "the cursor anywhere on the line. If a line is extended with Backslash (:kbd:" @@ -1061,7 +1065,7 @@ msgid "" "compound statement by entering a blank line after the statement." msgstr "" -#: ../../library/idle.rst:593 +#: ../../library/idle.rst:596 msgid "" "When one pastes code into Shell, it is not compiled and possibly executed " "until one hits :kbd:`Return`, as specified above. One may edit pasted code " @@ -1070,7 +1074,7 @@ msgid "" "one." msgstr "" -#: ../../library/idle.rst:599 +#: ../../library/idle.rst:602 msgid "" "Lines containing ``RESTART`` mean that the user execution process has been " "re-started. This occurs when the user execution process has crashed, when " @@ -1078,38 +1082,38 @@ msgid "" "window." msgstr "" -#: ../../library/idle.rst:604 +#: ../../library/idle.rst:607 msgid "" "The editing features described in previous subsections work when entering " "code interactively. IDLE's Shell window also responds to the following:" msgstr "" -#: ../../library/idle.rst:607 +#: ../../library/idle.rst:610 msgid ":kbd:`C-c` attempts to interrupt statement execution (but may fail)." msgstr "" -#: ../../library/idle.rst:609 +#: ../../library/idle.rst:612 msgid ":kbd:`C-d` closes Shell if typed at a ``>>>`` prompt." msgstr "" -#: ../../library/idle.rst:611 +#: ../../library/idle.rst:614 msgid "" ":kbd:`Alt-p` and :kbd:`Alt-n` (:kbd:`C-p` and :kbd:`C-n` on macOS) retrieve " "to the current prompt the previous or next previously entered statement that " "matches anything already typed." msgstr "" -#: ../../library/idle.rst:615 +#: ../../library/idle.rst:618 msgid "" ":kbd:`Return` while the cursor is on any previous statement appends the " "latter to anything already typed at the prompt." msgstr "" -#: ../../library/idle.rst:619 +#: ../../library/idle.rst:622 msgid "Text colors" msgstr "" -#: ../../library/idle.rst:621 +#: ../../library/idle.rst:624 msgid "" "Idle defaults to black on white text, but colors text with special meanings. " "For the shell, these are shell output, shell error, user output, and user " @@ -1119,7 +1123,7 @@ msgid "" "(when present), found text (when possible), and selected text." msgstr "" -#: ../../library/idle.rst:628 +#: ../../library/idle.rst:631 msgid "" "IDLE also highlights the :ref:`soft keywords ` :keyword:" "`match`, :keyword:`case `, and :keyword:`_ ` in " @@ -1128,7 +1132,7 @@ msgid "" "patterns." msgstr "" -#: ../../library/idle.rst:634 +#: ../../library/idle.rst:637 msgid "" "Text coloring is done in the background, so uncolorized text is occasionally " "visible. To change the color scheme, use the Configure IDLE dialog " @@ -1136,11 +1140,11 @@ msgid "" "and text in popups and dialogs is not user-configurable." msgstr "" -#: ../../library/idle.rst:641 +#: ../../library/idle.rst:644 msgid "Startup and Code Execution" msgstr "" -#: ../../library/idle.rst:643 +#: ../../library/idle.rst:646 msgid "" "Upon startup with the ``-s`` option, IDLE will execute the file referenced " "by the environment variables :envvar:`IDLESTARTUP` or :envvar:" @@ -1152,7 +1156,7 @@ msgid "" "modules." msgstr "" -#: ../../library/idle.rst:651 +#: ../../library/idle.rst:654 msgid "" "In addition, ``Tk`` also loads a startup file if it is present. Note that " "the Tk file is loaded unconditionally. This additional file is ``.Idle.py`` " @@ -1161,61 +1165,90 @@ msgid "" "importing functions to be used from IDLE's Python shell." msgstr "" -#: ../../library/idle.rst:658 +#: ../../library/idle.rst:661 msgid "Command line usage" msgstr "命令列用法" -#: ../../library/idle.rst:660 -msgid "" -"idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] " -"[arg] ...\n" -"\n" -"-c command run command in the shell window\n" -"-d enable debugger and open shell window\n" -"-e open editor window\n" -"-h print help message with legal combinations and exit\n" -"-i open shell window\n" -"-r file run file in shell window\n" -"-s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window\n" -"-t title set title of shell window\n" -"- run stdin in shell (- must be last option before args)" -msgstr "" -"idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] " -"[arg] ...\n" -"\n" -"-c command run command in the shell window\n" -"-d enable debugger and open shell window\n" -"-e open editor window\n" -"-h print help message with legal combinations and exit\n" -"-i open shell window\n" -"-r file run file in shell window\n" -"-s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window\n" -"-t title set title of shell window\n" -"- run stdin in shell (- must be last option before args)" - -#: ../../library/idle.rst:674 -msgid "If there are arguments:" -msgstr "" - -#: ../../library/idle.rst:676 -msgid "" -"If ``-``, ``-c``, or ``r`` is used, all arguments are placed in ``sys." -"argv[1:...]`` and ``sys.argv[0]`` is set to ``''``, ``'-c'``, or ``'-r'``. " -"No editor window is opened, even if that is the default set in the Options " -"dialog." +#: ../../library/idle.rst:665 +msgid "" +"IDLE can be invoked from the command line with various options. The general " +"syntax is:" +msgstr "" + +#: ../../library/idle.rst:667 +msgid "python -m idlelib [options] [file ...]" msgstr "" -#: ../../library/idle.rst:681 +#: ../../library/idle.rst:671 +msgid "The following options are available:" +msgstr "" + +#: ../../library/idle.rst:675 msgid "" -"Otherwise, arguments are files opened for editing and ``sys.argv`` reflects " -"the arguments passed to IDLE itself." +"Run the specified Python command in the shell window. For example, pass ``-c " +"\"print('Hello, World!')\"``. On Windows, the outer quotes must be double " +"quotes as shown." +msgstr "" + +#: ../../library/idle.rst:681 +msgid "Enable the debugger and open the shell window." msgstr "" #: ../../library/idle.rst:685 +msgid "Open an editor window." +msgstr "" + +#: ../../library/idle.rst:689 +msgid "Print a help message with legal combinations of options and exit." +msgstr "" + +#: ../../library/idle.rst:693 +msgid "Open a shell window." +msgstr "" + +#: ../../library/idle.rst:697 +msgid "Run the specified file in the shell window." +msgstr "" + +#: ../../library/idle.rst:701 +msgid "" +"Run the startup file (as defined by the environment variables :envvar:" +"`IDLESTARTUP` or :envvar:`PYTHONSTARTUP`) before opening the shell window." +msgstr "" + +#: ../../library/idle.rst:705 +msgid "Set the title of the shell window." +msgstr "" + +#: ../../library/idle.rst:709 +msgid "" +"Read and execute standard input in the shell window. This option must be the " +"last one before any arguments." +msgstr "" + +#: ../../library/idle.rst:711 +msgid "If arguments are provided:" +msgstr "" + +#: ../../library/idle.rst:713 +msgid "" +"If ``-``, ``-c``, or ``-r`` is used, all arguments are placed in ``sys." +"argv[1:]``, and ``sys.argv[0]`` is set to ``''``, ``'-c'``, or ``'-r'`` " +"respectively. No editor window is opened, even if that is the default set in " +"the *Options* dialog." +msgstr "" + +#: ../../library/idle.rst:716 +msgid "" +"Otherwise, arguments are treated as files to be opened for editing, and " +"``sys.argv`` reflects the arguments passed to IDLE itself." +msgstr "" + +#: ../../library/idle.rst:720 msgid "Startup failure" msgstr "" -#: ../../library/idle.rst:687 +#: ../../library/idle.rst:722 msgid "" "IDLE uses a socket to communicate between the IDLE GUI process and the user " "code execution process. A connection must be established whenever the Shell " @@ -1225,7 +1258,7 @@ msgid "" "directs the user here. It then exits." msgstr "" -#: ../../library/idle.rst:694 +#: ../../library/idle.rst:729 msgid "" "One specific connection failure on Unix systems results from misconfigured " "masquerading rules somewhere in a system's network setup. When IDLE is " @@ -1235,7 +1268,7 @@ msgid "" "``tcplisten `` in another." msgstr "" -#: ../../library/idle.rst:702 +#: ../../library/idle.rst:737 msgid "" "A common cause of failure is a user-written file with the same name as a " "standard library module, such as *random.py* and *tkinter.py*. When such a " @@ -1244,7 +1277,7 @@ msgid "" "file." msgstr "" -#: ../../library/idle.rst:708 +#: ../../library/idle.rst:743 msgid "" "Though less common than in the past, an antivirus or firewall program may " "stop the connection. If the program cannot be taught to allow the " @@ -1254,7 +1287,7 @@ msgid "" "connections." msgstr "" -#: ../../library/idle.rst:715 +#: ../../library/idle.rst:750 msgid "" "Python installation issues occasionally stop IDLE: multiple versions can " "clash, or a single installation might need admin access. If one undo the " @@ -1262,7 +1295,7 @@ msgid "" "completely remove Python and start over." msgstr "" -#: ../../library/idle.rst:720 +#: ../../library/idle.rst:755 msgid "" "A zombie pythonw.exe process could be a problem. On Windows, use Task " "Manager to check for one and stop it if there is. Sometimes a restart " @@ -1271,7 +1304,7 @@ msgid "" "may fix a temporary problem." msgstr "" -#: ../../library/idle.rst:726 +#: ../../library/idle.rst:761 msgid "" "When IDLE first starts, it attempts to read user configuration files in ``~/." "idlerc/`` (~ is one's home directory). If there is a problem, an error " @@ -1282,14 +1315,14 @@ msgid "" "with the settings dialog." msgstr "" -#: ../../library/idle.rst:734 +#: ../../library/idle.rst:769 msgid "" "If IDLE quits with no message, and it was not started from a console, try " "starting it from a console or terminal (``python -m idlelib``) and see if " "this results in an error message." msgstr "" -#: ../../library/idle.rst:738 +#: ../../library/idle.rst:773 msgid "" "On Unix-based systems with tcl/tk older than ``8.6.11`` (see ``About IDLE``) " "certain characters of certain fonts can cause a tk failure with a message to " @@ -1298,11 +1331,11 @@ msgid "" "upgrade tcl/tk, then re-configure IDLE to use a font that works better." msgstr "" -#: ../../library/idle.rst:746 +#: ../../library/idle.rst:781 msgid "Running user code" msgstr "" -#: ../../library/idle.rst:748 +#: ../../library/idle.rst:783 msgid "" "With rare exceptions, the result of executing Python code with IDLE is " "intended to be the same as executing the same code by the default method, " @@ -1312,7 +1345,7 @@ msgid "" "``threading.active_count()`` returns 2 instead of 1." msgstr "" -#: ../../library/idle.rst:755 +#: ../../library/idle.rst:790 msgid "" "By default, IDLE runs user code in a separate OS process rather than in the " "user interface process that runs the shell and editor. In the execution " @@ -1322,7 +1355,7 @@ msgid "" "__stderr__`` are not touched, but may be ``None``." msgstr "" -#: ../../library/idle.rst:762 +#: ../../library/idle.rst:797 msgid "" "Sending print output from one process to a text widget in another is slower " "than printing to a system terminal in the same process. This has the most " @@ -1334,7 +1367,7 @@ msgid "" "fields and lines." msgstr "" -#: ../../library/idle.rst:771 +#: ../../library/idle.rst:806 msgid "" "IDLE's standard stream replacements are not inherited by subprocesses " "created in the execution process, whether directly by user code or by " @@ -1345,14 +1378,14 @@ msgid "" "attached to that window for input and output." msgstr "" -#: ../../library/idle.rst:780 +#: ../../library/idle.rst:815 msgid "" "If ``sys`` is reset by user code, such as with ``importlib.reload(sys)``, " "IDLE's changes are lost and input from the keyboard and output to the screen " "will not work correctly." msgstr "" -#: ../../library/idle.rst:784 +#: ../../library/idle.rst:819 msgid "" "When Shell has the focus, it controls the keyboard and screen. This is " "normally transparent, but functions that directly access the keyboard and " @@ -1360,7 +1393,7 @@ msgid "" "determine whether a key has been pressed and if so, which." msgstr "" -#: ../../library/idle.rst:789 +#: ../../library/idle.rst:824 msgid "" "The IDLE code running in the execution process adds frames to the call stack " "that would not be there otherwise. IDLE wraps ``sys.getrecursionlimit`` and " @@ -1368,17 +1401,17 @@ msgid "" "frames." msgstr "" -#: ../../library/idle.rst:794 +#: ../../library/idle.rst:829 msgid "" "When user code raises SystemExit either directly or by calling sys.exit, " "IDLE returns to a Shell prompt instead of exiting." msgstr "" -#: ../../library/idle.rst:798 +#: ../../library/idle.rst:833 msgid "User output in Shell" msgstr "" -#: ../../library/idle.rst:800 +#: ../../library/idle.rst:835 msgid "" "When a program outputs text, the result is determined by the corresponding " "output device. When IDLE executes user code, ``sys.stdout`` and ``sys." @@ -1388,7 +1421,7 @@ msgid "" "rather than production runs." msgstr "" -#: ../../library/idle.rst:807 +#: ../../library/idle.rst:842 msgid "" "For instance, Shell never throws away output. A program that sends " "unlimited output to Shell will eventually fill memory, resulting in a memory " @@ -1397,7 +1430,7 @@ msgid "" "lines, with 300 the default." msgstr "" -#: ../../library/idle.rst:813 +#: ../../library/idle.rst:848 msgid "" "A Tk Text widget, and hence IDLE's Shell, displays characters (codepoints) " "in the BMP (Basic Multilingual Plane) subset of Unicode. Which characters " @@ -1411,7 +1444,7 @@ msgid "" "spacing behavior.) ::" msgstr "" -#: ../../library/idle.rst:823 +#: ../../library/idle.rst:858 msgid "" ">>> s = 'a\\tb\\a<\\x02><\\r>\\bc\\nd' # Enter 22 chars.\n" ">>> len(s)\n" @@ -1422,7 +1455,7 @@ msgid "" "# Result varies by OS and font. Try it." msgstr "" -#: ../../library/idle.rst:831 +#: ../../library/idle.rst:866 msgid "" "The ``repr`` function is used for interactive echo of expression values. It " "returns an altered version of the input string in which control codes, some " @@ -1431,13 +1464,13 @@ msgid "" "regardless of how they are displayed." msgstr "" -#: ../../library/idle.rst:837 +#: ../../library/idle.rst:872 msgid "" "Normal and error output are generally kept separate (on separate lines) from " "code input and each other. They each get different highlight colors." msgstr "" -#: ../../library/idle.rst:840 +#: ../../library/idle.rst:875 msgid "" "For SyntaxError tracebacks, the normal '^' marking where the error was " "detected is replaced by coloring the text with an error highlight. When code " @@ -1446,7 +1479,7 @@ msgid "" "opened if necessary." msgstr "" -#: ../../library/idle.rst:846 +#: ../../library/idle.rst:881 msgid "" "Shell has a special facility for squeezing output lines down to a 'Squeezed " "text' label. This is done automatically for output over N lines (N = 50 by " @@ -1455,18 +1488,18 @@ msgid "" "on the output. This can be useful lines long enough to slow down scrolling." msgstr "" -#: ../../library/idle.rst:854 +#: ../../library/idle.rst:889 msgid "" "Squeezed output is expanded in place by double-clicking the label. It can " "also be sent to the clipboard or a separate view window by right-clicking " "the label." msgstr "" -#: ../../library/idle.rst:859 +#: ../../library/idle.rst:894 msgid "Developing tkinter applications" msgstr "" -#: ../../library/idle.rst:861 +#: ../../library/idle.rst:896 msgid "" "IDLE is intentionally different from standard Python in order to facilitate " "development of tkinter programs. Enter ``import tkinter as tk; root = tk." @@ -1478,7 +1511,7 @@ msgid "" "changes in standard Python until one enters ``root.update()``." msgstr "" -#: ../../library/idle.rst:870 +#: ../../library/idle.rst:905 msgid "" "Most tkinter programs run ``root.mainloop()``, which usually does not return " "until the tk app is destroyed. If the program is run with ``python -i`` or " @@ -1486,7 +1519,7 @@ msgid "" "``mainloop()`` returns, at which time there is nothing left to interact with." msgstr "" -#: ../../library/idle.rst:876 +#: ../../library/idle.rst:911 msgid "" "When running a tkinter program from an IDLE editor, one can comment out the " "mainloop call. One then gets a shell prompt immediately and can interact " @@ -1494,11 +1527,11 @@ msgid "" "mainloop call when running in standard Python." msgstr "" -#: ../../library/idle.rst:882 +#: ../../library/idle.rst:917 msgid "Running without a subprocess" msgstr "" -#: ../../library/idle.rst:884 +#: ../../library/idle.rst:919 msgid "" "By default, IDLE executes user code in a separate subprocess via a socket, " "which uses the internal loopback interface. This connection is not " @@ -1506,7 +1539,7 @@ msgid "" "firewall software complains anyway, you can ignore it." msgstr "" -#: ../../library/idle.rst:889 +#: ../../library/idle.rst:924 msgid "" "If the attempt to make the socket connection fails, Idle will notify you. " "Such failures are sometimes transient, but if persistent, the problem may be " @@ -1515,7 +1548,7 @@ msgid "" "command line switch." msgstr "" -#: ../../library/idle.rst:895 +#: ../../library/idle.rst:930 msgid "" "If IDLE is started with the -n command line switch it will run in a single " "process and will not create the subprocess which runs the RPC Python " @@ -1529,15 +1562,15 @@ msgid "" "at all possible." msgstr "" -#: ../../library/idle.rst:910 +#: ../../library/idle.rst:945 msgid "Help and Preferences" msgstr "" -#: ../../library/idle.rst:915 +#: ../../library/idle.rst:950 msgid "Help sources" msgstr "" -#: ../../library/idle.rst:917 +#: ../../library/idle.rst:952 msgid "" "Help menu entry \"IDLE Help\" displays a formatted html version of the IDLE " "chapter of the Library Reference. The result, in a read-only tkinter text " @@ -1547,7 +1580,7 @@ msgid "" "the opened box." msgstr "" -#: ../../library/idle.rst:925 +#: ../../library/idle.rst:960 msgid "" "Help menu entry \"Python Docs\" opens the extensive sources of help, " "including tutorials, available at ``docs.python.org/x.y``, where 'x.y' is " @@ -1556,17 +1589,17 @@ msgid "" "instead." msgstr "" -#: ../../library/idle.rst:931 +#: ../../library/idle.rst:966 msgid "" "Selected URLs can be added or removed from the help menu at any time using " "the General tab of the Configure IDLE dialog." msgstr "" -#: ../../library/idle.rst:937 +#: ../../library/idle.rst:972 msgid "Setting preferences" -msgstr "" +msgstr "設定偏好" -#: ../../library/idle.rst:939 +#: ../../library/idle.rst:974 msgid "" "The font preferences, highlighting, keys, and general preferences can be " "changed via Configure IDLE on the Option menu. Non-default user settings are " @@ -1575,7 +1608,7 @@ msgid "" "or more of the files in ``.idlerc``." msgstr "" -#: ../../library/idle.rst:945 +#: ../../library/idle.rst:980 msgid "" "On the Font tab, see the text sample for the effect of font face and size on " "multiple characters in multiple languages. Edit the sample to add other " @@ -1584,7 +1617,7 @@ msgid "" "them to the top of the sample and try changing first size and then font." msgstr "" -#: ../../library/idle.rst:952 +#: ../../library/idle.rst:987 msgid "" "On the Highlights and Keys tab, select a built-in or custom color theme and " "key set. To use a newer built-in color theme or key set with older IDLEs, " @@ -1592,22 +1625,22 @@ msgid "" "IDLEs." msgstr "" -#: ../../library/idle.rst:958 +#: ../../library/idle.rst:993 msgid "IDLE on macOS" -msgstr "" +msgstr "macOS 上的 IDLE" -#: ../../library/idle.rst:960 +#: ../../library/idle.rst:995 msgid "" "Under System Preferences: Dock, one can set \"Prefer tabs when opening " "documents\" to \"Always\". This setting is not compatible with the tk/" "tkinter GUI framework used by IDLE, and it breaks a few IDLE features." msgstr "" -#: ../../library/idle.rst:965 +#: ../../library/idle.rst:1000 msgid "Extensions" msgstr "" -#: ../../library/idle.rst:967 +#: ../../library/idle.rst:1002 msgid "" "IDLE contains an extension facility. Preferences for extensions can be " "changed with the Extensions tab of the preferences dialog. See the beginning " @@ -1616,21 +1649,21 @@ msgid "" "testing." msgstr "" -#: ../../library/idle.rst:975 -msgid "idlelib" -msgstr "idlelib" +#: ../../library/idle.rst:1010 +msgid "idlelib --- implementation of IDLE application" +msgstr "" -#: ../../library/idle.rst:980 +#: ../../library/idle.rst:1015 msgid "**Source code:** :source:`Lib/idlelib`" msgstr "**原始碼:**\\ :source:`Lib/idlelib/`" -#: ../../library/idle.rst:984 +#: ../../library/idle.rst:1019 msgid "" "The Lib/idlelib package implements the IDLE application. See the rest of " "this page for how to use IDLE." msgstr "" -#: ../../library/idle.rst:987 +#: ../../library/idle.rst:1022 msgid "" "The files in idlelib are described in idlelib/README.txt. Access it either " "in idlelib or click Help => About IDLE on the IDLE menu. This file also " @@ -1639,6 +1672,10 @@ msgid "" "changes can be backported (see :pep:`434`)." msgstr "" +#: ../../library/idle.rst:10 +msgid "IDLE" +msgstr "IDLE" + #: ../../library/idle.rst:10 msgid "Python Editor" msgstr "Python Editor(Python 編輯器)" @@ -1647,26 +1684,56 @@ msgstr "Python Editor(Python 編輯器)" msgid "Integrated Development Environment" msgstr "Integrated Development Environment(整合開發環境)" -#: ../../library/idle.rst:68 +#: ../../library/idle.rst:71 msgid "Module browser" msgstr "Module browser(模組瀏覽器)" -#: ../../library/idle.rst:68 +#: ../../library/idle.rst:71 msgid "Path browser" msgstr "Path browser(路徑瀏覽器)" -#: ../../library/idle.rst:210 +#: ../../library/idle.rst:213 msgid "Run script" msgstr "Run script(執行腳本)" -#: ../../library/idle.rst:277 +#: ../../library/idle.rst:280 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/idle.rst:277 +#: ../../library/idle.rst:280 msgid "stack viewer" msgstr "stack viewer(堆疊檢視器)" -#: ../../library/idle.rst:353 +#: ../../library/idle.rst:356 msgid "breakpoints" msgstr "breakpoints(中斷點)" + +#~ msgid "" +#~ "idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] " +#~ "[arg] ...\n" +#~ "\n" +#~ "-c command run command in the shell window\n" +#~ "-d enable debugger and open shell window\n" +#~ "-e open editor window\n" +#~ "-h print help message with legal combinations and exit\n" +#~ "-i open shell window\n" +#~ "-r file run file in shell window\n" +#~ "-s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window\n" +#~ "-t title set title of shell window\n" +#~ "- run stdin in shell (- must be last option before args)" +#~ msgstr "" +#~ "idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] " +#~ "[arg] ...\n" +#~ "\n" +#~ "-c command run command in the shell window\n" +#~ "-d enable debugger and open shell window\n" +#~ "-e open editor window\n" +#~ "-h print help message with legal combinations and exit\n" +#~ "-i open shell window\n" +#~ "-r file run file in shell window\n" +#~ "-s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window\n" +#~ "-t title set title of shell window\n" +#~ "- run stdin in shell (- must be last option before args)" + +#~ msgid "idlelib" +#~ msgstr "idlelib" diff --git a/library/importlib.metadata.po b/library/importlib.metadata.po index 16d9154e59..32a230af5d 100644 --- a/library/importlib.metadata.po +++ b/library/importlib.metadata.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-03-28 00:16+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -113,13 +113,13 @@ msgstr "" #: ../../library/importlib.metadata.rst:82 msgid "" "(example) $ python\n" -">>> from importlib.metadata import version \n" -">>> version('wheel') \n" +">>> from importlib.metadata import version\n" +">>> version('wheel')\n" "'0.32.3'" msgstr "" "(example) $ python\n" -">>> from importlib.metadata import version \n" -">>> version('wheel') \n" +">>> from importlib.metadata import version\n" +">>> version('wheel')\n" "'0.32.3'" #: ../../library/importlib.metadata.rst:89 @@ -136,7 +136,7 @@ msgstr "" #: ../../library/importlib.metadata.rst:95 msgid "" -">>> list(metadata('wheel')) \n" +">>> list(metadata('wheel'))\n" "['Metadata-Version', 'Name', 'Version', 'Summary', 'Home-page', 'Author', " "'Author-email', 'Maintainer', 'Maintainer-email', 'License', 'Project-URL', " "'Project-URL', 'Project-URL', 'Keywords', 'Platform', 'Classifier', " @@ -145,7 +145,7 @@ msgid "" "'Classifier', 'Requires-Python', 'Provides-Extra', 'Requires-Dist', " "'Requires-Dist']" msgstr "" -">>> list(metadata('wheel')) \n" +">>> list(metadata('wheel'))\n" "['Metadata-Version', 'Name', 'Version', 'Summary', 'Home-page', 'Author', " "'Author-email', 'Maintainer', 'Maintainer-email', 'License', 'Project-URL', " "'Project-URL', 'Project-URL', 'Keywords', 'Platform', 'Classifier', " @@ -225,8 +225,8 @@ msgid "Query all entry points::" msgstr "" #: ../../library/importlib.metadata.rst:152 -msgid ">>> eps = entry_points() " -msgstr ">>> eps = entry_points() " +msgid ">>> eps = entry_points()" +msgstr ">>> eps = entry_points()" #: ../../library/importlib.metadata.rst:154 msgid "" @@ -237,11 +237,11 @@ msgstr "" #: ../../library/importlib.metadata.rst:158 msgid "" -">>> sorted(eps.groups) \n" +">>> sorted(eps.groups)\n" "['console_scripts', 'distutils.commands', 'distutils.setup_keywords', " "'egg_info.writers', 'setuptools.installation']" msgstr "" -">>> sorted(eps.groups) \n" +">>> sorted(eps.groups)\n" "['console_scripts', 'distutils.commands', 'distutils.setup_keywords', " "'egg_info.writers', 'setuptools.installation']" @@ -253,8 +253,8 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:165 -msgid ">>> scripts = eps.select(group='console_scripts') " -msgstr ">>> scripts = eps.select(group='console_scripts') " +msgid ">>> scripts = eps.select(group='console_scripts')" +msgstr ">>> scripts = eps.select(group='console_scripts')" #: ../../library/importlib.metadata.rst:167 msgid "" @@ -263,8 +263,8 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:170 -msgid ">>> scripts = entry_points(group='console_scripts') " -msgstr ">>> scripts = entry_points(group='console_scripts') " +msgid ">>> scripts = entry_points(group='console_scripts')" +msgstr ">>> scripts = entry_points(group='console_scripts')" #: ../../library/importlib.metadata.rst:172 msgid "" @@ -273,13 +273,13 @@ msgstr "" #: ../../library/importlib.metadata.rst:174 msgid "" -">>> 'wheel' in scripts.names \n" +">>> 'wheel' in scripts.names\n" "True\n" -">>> wheel = scripts['wheel'] " +">>> wheel = scripts['wheel']" msgstr "" -">>> 'wheel' in scripts.names \n" +">>> 'wheel' in scripts.names\n" "True\n" -">>> wheel = scripts['wheel'] " +">>> wheel = scripts['wheel']" #: ../../library/importlib.metadata.rst:178 msgid "Equivalently, query for that entry point during selection::" @@ -287,11 +287,11 @@ msgstr "" #: ../../library/importlib.metadata.rst:180 msgid "" -">>> (wheel,) = entry_points(group='console_scripts', name='wheel') \n" -">>> (wheel,) = entry_points().select(group='console_scripts', name='wheel') " +">>> (wheel,) = entry_points(group='console_scripts', name='wheel')\n" +">>> (wheel,) = entry_points().select(group='console_scripts', name='wheel')" msgstr "" -">>> (wheel,) = entry_points(group='console_scripts', name='wheel') \n" -">>> (wheel,) = entry_points().select(group='console_scripts', name='wheel') " +">>> (wheel,) = entry_points(group='console_scripts', name='wheel')\n" +">>> (wheel,) = entry_points().select(group='console_scripts', name='wheel')" #: ../../library/importlib.metadata.rst:183 msgid "Inspect the resolved entry point::" @@ -299,28 +299,28 @@ msgstr "" #: ../../library/importlib.metadata.rst:185 msgid "" -">>> wheel \n" +">>> wheel\n" "EntryPoint(name='wheel', value='wheel.cli:main', group='console_scripts')\n" -">>> wheel.module \n" +">>> wheel.module\n" "'wheel.cli'\n" -">>> wheel.attr \n" +">>> wheel.attr\n" "'main'\n" -">>> wheel.extras \n" +">>> wheel.extras\n" "[]\n" -">>> main = wheel.load() \n" -">>> main \n" +">>> main = wheel.load()\n" +">>> main\n" "" msgstr "" -">>> wheel \n" +">>> wheel\n" "EntryPoint(name='wheel', value='wheel.cli:main', group='console_scripts')\n" -">>> wheel.module \n" +">>> wheel.module\n" "'wheel.cli'\n" -">>> wheel.attr \n" +">>> wheel.attr\n" "'main'\n" -">>> wheel.extras \n" +">>> wheel.extras\n" "[]\n" -">>> main = wheel.load() \n" -">>> main \n" +">>> main = wheel.load()\n" +">>> main\n" "" #: ../../library/importlib.metadata.rst:197 @@ -359,10 +359,10 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:226 -#: ../../library/importlib.metadata.rst:274 -#: ../../library/importlib.metadata.rst:295 -#: ../../library/importlib.metadata.rst:358 -#: ../../library/importlib.metadata.rst:409 +#: ../../library/importlib.metadata.rst:275 +#: ../../library/importlib.metadata.rst:296 +#: ../../library/importlib.metadata.rst:359 +#: ../../library/importlib.metadata.rst:410 msgid "" "Raises :exc:`PackageNotFoundError` if the named distribution package is not " "installed in the current Python environment." @@ -389,8 +389,8 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:240 -msgid ">>> wheel_metadata = metadata('wheel') " -msgstr ">>> wheel_metadata = metadata('wheel') " +msgid ">>> wheel_metadata = metadata('wheel')" +msgstr ">>> wheel_metadata = metadata('wheel')" #: ../../library/importlib.metadata.rst:242 msgid "" @@ -400,10 +400,10 @@ msgstr "" #: ../../library/importlib.metadata.rst:245 msgid "" -">>> wheel_metadata['Requires-Python'] \n" +">>> wheel_metadata['Requires-Python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" msgstr "" -">>> wheel_metadata['Requires-Python'] \n" +">>> wheel_metadata['Requires-Python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" #: ../../library/importlib.metadata.rst:248 @@ -421,7 +421,7 @@ msgstr "" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" #: ../../library/importlib.metadata.rst:254 -#: ../../library/importlib.metadata.rst:452 +#: ../../library/importlib.metadata.rst:453 msgid "" "The full set of available metadata is not described here. See the PyPA `Core " "metadata specification `__ for the named " +"distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:277 +#: ../../library/importlib.metadata.rst:278 msgid "" "The :func:`!version` function is the quickest way to get a `Distribution " "Package `_'s version number, as a string::" msgstr "" -#: ../../library/importlib.metadata.rst:281 +#: ../../library/importlib.metadata.rst:282 msgid "" -">>> version('wheel') \n" +">>> version('wheel')\n" "'0.32.3'" msgstr "" -">>> version('wheel') \n" +">>> version('wheel')\n" "'0.32.3'" -#: ../../library/importlib.metadata.rst:288 +#: ../../library/importlib.metadata.rst:289 msgid "Distribution files" msgstr "" -#: ../../library/importlib.metadata.rst:292 +#: ../../library/importlib.metadata.rst:293 msgid "" "Return the full set of files contained within the named distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:298 +#: ../../library/importlib.metadata.rst:299 msgid "" "Returns :const:`None` if the distribution is found but the installation " "database records reporting the files associated with the distribuion package " "are missing." msgstr "" -#: ../../library/importlib.metadata.rst:304 +#: ../../library/importlib.metadata.rst:305 msgid "" "A :class:`pathlib.PurePath` derived object with additional ``dist``, " "``size``, and ``hash`` properties corresponding to the distribution " "package's installation metadata for that file." msgstr "" -#: ../../library/importlib.metadata.rst:308 +#: ../../library/importlib.metadata.rst:309 msgid "" "The :func:`!files` function takes a `Distribution Package `_ name and returns " @@ -494,35 +495,35 @@ msgid "" "class:`PackagePath` instance. For example::" msgstr "" -#: ../../library/importlib.metadata.rst:313 +#: ../../library/importlib.metadata.rst:314 msgid "" -">>> util = [p for p in files('wheel') if 'util.py' in str(p)][0] \n" -">>> util \n" +">>> util = [p for p in files('wheel') if 'util.py' in str(p)][0]\n" +">>> util\n" "PackagePath('wheel/util.py')\n" -">>> util.size \n" +">>> util.size\n" "859\n" -">>> util.dist \n" +">>> util.dist\n" "\n" -">>> util.hash \n" +">>> util.hash\n" "" msgstr "" -">>> util = [p for p in files('wheel') if 'util.py' in str(p)][0] \n" -">>> util \n" +">>> util = [p for p in files('wheel') if 'util.py' in str(p)][0]\n" +">>> util\n" "PackagePath('wheel/util.py')\n" -">>> util.size \n" +">>> util.size\n" "859\n" -">>> util.dist \n" +">>> util.dist\n" "\n" -">>> util.hash \n" +">>> util.hash\n" "" -#: ../../library/importlib.metadata.rst:323 +#: ../../library/importlib.metadata.rst:324 msgid "Once you have the file, you can also read its contents::" msgstr "" -#: ../../library/importlib.metadata.rst:325 +#: ../../library/importlib.metadata.rst:326 msgid "" -">>> print(util.read_text()) \n" +">>> print(util.read_text())\n" "import base64\n" "import sys\n" "...\n" @@ -531,7 +532,7 @@ msgid "" " return s.encode('utf-8')\n" " return s" msgstr "" -">>> print(util.read_text()) \n" +">>> print(util.read_text())\n" "import base64\n" "import sys\n" "...\n" @@ -540,21 +541,21 @@ msgstr "" " return s.encode('utf-8')\n" " return s" -#: ../../library/importlib.metadata.rst:334 +#: ../../library/importlib.metadata.rst:335 msgid "" "You can also use the :meth:`!locate` method to get the absolute path to the " "file::" msgstr "" -#: ../../library/importlib.metadata.rst:337 +#: ../../library/importlib.metadata.rst:338 msgid "" -">>> util.locate() \n" +">>> util.locate()\n" "PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')" msgstr "" -">>> util.locate() \n" +">>> util.locate()\n" "PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')" -#: ../../library/importlib.metadata.rst:340 +#: ../../library/importlib.metadata.rst:341 msgid "" "In the case where the metadata file listing files (``RECORD`` or ``SOURCES." "txt``) is missing, :func:`!files` will return :const:`None`. The caller may " @@ -564,49 +565,49 @@ msgid "" "distribution is not known to have the metadata present." msgstr "" -#: ../../library/importlib.metadata.rst:351 +#: ../../library/importlib.metadata.rst:352 msgid "Distribution requirements" msgstr "" -#: ../../library/importlib.metadata.rst:355 +#: ../../library/importlib.metadata.rst:356 msgid "" "Return the declared dependency specifiers for the named distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:361 +#: ../../library/importlib.metadata.rst:362 msgid "" "To get the full set of requirements for a `Distribution Package `_, use " "the :func:`!requires` function::" msgstr "" -#: ../../library/importlib.metadata.rst:365 +#: ../../library/importlib.metadata.rst:366 msgid "" -">>> requires('wheel') \n" +">>> requires('wheel')\n" "[\"pytest (>=3.0.0) ; extra == 'test'\", \"pytest-cov ; extra == 'test'\"]" msgstr "" -">>> requires('wheel') \n" +">>> requires('wheel')\n" "[\"pytest (>=3.0.0) ; extra == 'test'\", \"pytest-cov ; extra == 'test'\"]" -#: ../../library/importlib.metadata.rst:373 +#: ../../library/importlib.metadata.rst:374 msgid "Mapping import to distribution packages" msgstr "" -#: ../../library/importlib.metadata.rst:377 +#: ../../library/importlib.metadata.rst:378 msgid "" "Return a mapping from the top level module and import package names found " "via :data:`sys.meta_path` to the names of the distribution packages (if any) " "that provide the corresponding files." msgstr "" -#: ../../library/importlib.metadata.rst:381 +#: ../../library/importlib.metadata.rst:382 msgid "" "To allow for namespace packages (which may have members provided by multiple " "distribution packages), each top level import name maps to a list of " "distribution names rather than mapping directly to a single name." msgstr "" -#: ../../library/importlib.metadata.rst:385 +#: ../../library/importlib.metadata.rst:386 msgid "" "A convenience method to resolve the `Distribution Package `_ name (or names, " @@ -615,7 +616,7 @@ msgid "" "glossary/#term-Import-Package>`_::" msgstr "" -#: ../../library/importlib.metadata.rst:390 +#: ../../library/importlib.metadata.rst:391 msgid "" ">>> packages_distributions()\n" "{'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': " @@ -625,110 +626,110 @@ msgstr "" "{'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': " "['jaraco.classes', 'jaraco.functools'], ...}" -#: ../../library/importlib.metadata.rst:393 +#: ../../library/importlib.metadata.rst:394 msgid "" "Some editable installs, `do not supply top-level names `_, and thus this function is not " "reliable with such installs." msgstr "" -#: ../../library/importlib.metadata.rst:402 +#: ../../library/importlib.metadata.rst:403 msgid "Distributions" msgstr "" -#: ../../library/importlib.metadata.rst:406 +#: ../../library/importlib.metadata.rst:407 msgid "" "Return a :class:`Distribution` instance describing the named distribution " "package." msgstr "" -#: ../../library/importlib.metadata.rst:414 +#: ../../library/importlib.metadata.rst:415 msgid "Details of an installed distribution package." msgstr "" -#: ../../library/importlib.metadata.rst:416 +#: ../../library/importlib.metadata.rst:417 msgid "" "Note: different :class:`!Distribution` instances do not currently compare " "equal, even if they relate to the same installed distribution and " "accordingly have the same attributes." msgstr "" -#: ../../library/importlib.metadata.rst:420 +#: ../../library/importlib.metadata.rst:421 msgid "" "While the module level API described above is the most common and convenient " "usage, you can get all of that information from the :class:`!Distribution` " "class. :class:`!Distribution` is an abstract object that represents the " "metadata for a Python `Distribution Package `_. You can get the concreate :" +"latest/glossary/#term-Distribution-Package>`_. You can get the concrete :" "class:`!Distribution` subclass instance for an installed distribution " "package by calling the :func:`distribution` function::" msgstr "" -#: ../../library/importlib.metadata.rst:427 +#: ../../library/importlib.metadata.rst:428 msgid "" -">>> from importlib.metadata import distribution \n" -">>> dist = distribution('wheel') \n" -">>> type(dist) \n" +">>> from importlib.metadata import distribution\n" +">>> dist = distribution('wheel')\n" +">>> type(dist)\n" "" msgstr "" -">>> from importlib.metadata import distribution \n" -">>> dist = distribution('wheel') \n" -">>> type(dist) \n" +">>> from importlib.metadata import distribution\n" +">>> dist = distribution('wheel')\n" +">>> type(dist)\n" "" -#: ../../library/importlib.metadata.rst:432 +#: ../../library/importlib.metadata.rst:433 msgid "" "Thus, an alternative way to get the version number is through the :class:`!" "Distribution` instance::" msgstr "" -#: ../../library/importlib.metadata.rst:435 +#: ../../library/importlib.metadata.rst:436 msgid "" -">>> dist.version \n" +">>> dist.version\n" "'0.32.3'" msgstr "" -">>> dist.version \n" +">>> dist.version\n" "'0.32.3'" -#: ../../library/importlib.metadata.rst:438 +#: ../../library/importlib.metadata.rst:439 msgid "" "There are all kinds of additional metadata available on :class:`!" "Distribution` instances::" msgstr "" -#: ../../library/importlib.metadata.rst:441 +#: ../../library/importlib.metadata.rst:442 msgid "" -">>> dist.metadata['Requires-Python'] \n" +">>> dist.metadata['Requires-Python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'\n" -">>> dist.metadata['License'] \n" +">>> dist.metadata['License']\n" "'MIT'" msgstr "" -">>> dist.metadata['Requires-Python'] \n" +">>> dist.metadata['Requires-Python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'\n" -">>> dist.metadata['License'] \n" +">>> dist.metadata['License']\n" "'MIT'" -#: ../../library/importlib.metadata.rst:446 +#: ../../library/importlib.metadata.rst:447 msgid "" "For editable packages, an ``origin`` property may present :pep:`610` " "metadata::" msgstr "" -#: ../../library/importlib.metadata.rst:449 +#: ../../library/importlib.metadata.rst:450 msgid "" ">>> dist.origin.url\n" "'file:///path/to/wheel-0.32.3.editable-py3-none-any.whl'" msgstr "" -#: ../../library/importlib.metadata.rst:455 +#: ../../library/importlib.metadata.rst:456 msgid "The ``.origin`` property was added." msgstr "新增 ``.origin`` 屬性 (property)。" -#: ../../library/importlib.metadata.rst:459 +#: ../../library/importlib.metadata.rst:460 msgid "Distribution Discovery" msgstr "" -#: ../../library/importlib.metadata.rst:461 +#: ../../library/importlib.metadata.rst:462 msgid "" "By default, this package provides built-in support for discovery of metadata " "for file system and zip file `Distribution Package `_ metadata is not available through :" @@ -763,14 +764,14 @@ msgid "" "on :data:`sys.meta_path`." msgstr "" -#: ../../library/importlib.metadata.rst:480 +#: ../../library/importlib.metadata.rst:481 msgid "" "By default ``importlib.metadata`` installs a finder for distribution " "packages found on the file system. This finder doesn't actually find any " "*distributions*, but it can find their metadata." msgstr "" -#: ../../library/importlib.metadata.rst:485 +#: ../../library/importlib.metadata.rst:486 msgid "" "The abstract class :py:class:`importlib.abc.MetaPathFinder` defines the " "interface expected of finders by Python's import system. ``importlib." @@ -780,7 +781,7 @@ msgid "" "base class, which defines this abstract method::" msgstr "" -#: ../../library/importlib.metadata.rst:493 +#: ../../library/importlib.metadata.rst:494 msgid "" "@abc.abstractmethod\n" "def find_distributions(context=DistributionFinder.Context()):\n" @@ -789,14 +790,14 @@ msgid "" " \"\"\"" msgstr "" -#: ../../library/importlib.metadata.rst:499 +#: ../../library/importlib.metadata.rst:500 msgid "" "The ``DistributionFinder.Context`` object provides ``.path`` and ``.name`` " "properties indicating the path to search and name to match and may supply " "other relevant context." msgstr "" -#: ../../library/importlib.metadata.rst:503 +#: ../../library/importlib.metadata.rst:504 msgid "" "What this means in practice is that to support finding distribution package " "metadata in locations other than the file system, subclass ``Distribution`` " @@ -805,17 +806,17 @@ msgid "" "method." msgstr "" -#: ../../library/importlib.metadata.rst:510 +#: ../../library/importlib.metadata.rst:511 msgid "Example" msgstr "" -#: ../../library/importlib.metadata.rst:512 +#: ../../library/importlib.metadata.rst:513 msgid "" "Consider for example a custom finder that loads Python modules from a " "database::" msgstr "" -#: ../../library/importlib.metadata.rst:515 +#: ../../library/importlib.metadata.rst:516 msgid "" "class DatabaseImporter(importlib.abc.MetaPathFinder):\n" " def __init__(self, db):\n" @@ -827,14 +828,14 @@ msgid "" "sys.meta_path.append(DatabaseImporter(connect_db(...)))" msgstr "" -#: ../../library/importlib.metadata.rst:524 +#: ../../library/importlib.metadata.rst:525 msgid "" "That importer now presumably provides importable modules from a database, " "but it provides no metadata or entry points. For this custom importer to " "provide metadata, it would also need to implement ``DistributionFinder``::" msgstr "" -#: ../../library/importlib.metadata.rst:529 +#: ../../library/importlib.metadata.rst:530 msgid "" "from importlib.metadata import DistributionFinder\n" "\n" @@ -847,7 +848,7 @@ msgid "" " yield DatabaseDistribution(dist_record)" msgstr "" -#: ../../library/importlib.metadata.rst:539 +#: ../../library/importlib.metadata.rst:540 msgid "" "In this way, ``query_distributions`` would return records for each " "distribution served by the database matching the query. For example, if " @@ -856,7 +857,7 @@ msgid "" "``Context(name=None)``." msgstr "" -#: ../../library/importlib.metadata.rst:545 +#: ../../library/importlib.metadata.rst:546 msgid "" "For the sake of simplicity, this example ignores ``context.path``\\. The " "``path`` attribute defaults to ``sys.path`` and is the set of import paths " @@ -869,11 +870,11 @@ msgid "" "``context.path`` and only yield ``Distribution``\\ s pertinent to that path." msgstr "" -#: ../../library/importlib.metadata.rst:556 +#: ../../library/importlib.metadata.rst:557 msgid "``DatabaseDistribution``, then, would look something like::" msgstr "" -#: ../../library/importlib.metadata.rst:558 +#: ../../library/importlib.metadata.rst:559 msgid "" "class DatabaseDistribution(importlib.metadata.Distribution):\n" " def __init__(self, record):\n" @@ -896,14 +897,14 @@ msgid "" " raise RuntimeError(\"This distribution has no file system\")" msgstr "" -#: ../../library/importlib.metadata.rst:578 +#: ../../library/importlib.metadata.rst:579 msgid "" "This basic implementation should provide metadata and entry points for " "packages served by the ``DatabaseImporter``, assuming that the ``record`` " "supplies suitable ``.name``, ``.version``, and ``.entry_points`` attributes." msgstr "" -#: ../../library/importlib.metadata.rst:583 +#: ../../library/importlib.metadata.rst:584 msgid "" "The ``DatabaseDistribution`` may also provide other metadata files, like " "``RECORD`` (required for ``Distribution.files``) or override the " diff --git a/library/importlib.po b/library/importlib.po index bdfc300dcf..4c36d9ea83 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,9 +43,9 @@ msgid "" "to comprehend than one implemented in a programming language other than " "Python." msgstr "" -"第一是提供 Python 原始碼中 :keyword:`import` 陳述式的實作(因此,也延伸到 :" -"func:`__import__` 函式)。這讓 :keyword:`!import` 實作可以移植到任何 Python " -"直譯器。同時,這也提供了一個比用其他程式語言實作更容易理解的版本。 " +"第一是提供 Python 原始碼中 :keyword:`import` 陳述式的實作(因此,也延伸" +"到 :func:`__import__` 函式)。這讓 :keyword:`!import` 實作可以移植到任何 " +"Python 直譯器。同時,這也提供了一個比用其他程式語言實作更容易理解的版本。" #: ../../library/importlib.rst:29 msgid "" @@ -89,8 +89,8 @@ msgstr "" #: ../../library/importlib.rst:47 msgid "" "Original specification of packages. Some semantics have changed since the " -"writing of this document (e.g. redirecting based on ``None`` in :data:`sys." -"modules`)." +"writing of this document (e.g. redirecting based on ``None`` " +"in :data:`sys.modules`)." msgstr "" #: ../../library/importlib.rst:51 @@ -231,11 +231,11 @@ msgstr "" #: ../../library/importlib.rst:115 msgid "" -"The :func:`import_module` function acts as a simplifying wrapper around :" -"func:`importlib.__import__`. This means all semantics of the function are " -"derived from :func:`importlib.__import__`. The most important difference " -"between these two functions is that :func:`import_module` returns the " -"specified package or module (e.g. ``pkg.mod``), while :func:`__import__` " +"The :func:`import_module` function acts as a simplifying wrapper " +"around :func:`importlib.__import__`. This means all semantics of the " +"function are derived from :func:`importlib.__import__`. The most important " +"difference between these two functions is that :func:`import_module` returns " +"the specified package or module (e.g. ``pkg.mod``), while :func:`__import__` " "returns the top-level package or module (e.g. ``pkg``)." msgstr "" @@ -347,11 +347,11 @@ msgstr "" #: ../../library/importlib.rst:193 msgid "" -"If a module imports objects from another module using :keyword:`from` ... :" -"keyword:`import` ..., calling :func:`reload` for the other module does not " -"redefine the objects imported from it --- one way around this is to re-" -"execute the :keyword:`!from` statement, another is to use :keyword:`!import` " -"and qualified names (*module.name*) instead." +"If a module imports objects from another module " +"using :keyword:`from` ... :keyword:`import` ..., calling :func:`reload` for " +"the other module does not redefine the objects imported from it --- one way " +"around this is to re-execute the :keyword:`!from` statement, another is to " +"use :keyword:`!import` and qualified names (*module.name*) instead." msgstr "" #: ../../library/importlib.rst:199 @@ -364,8 +364,8 @@ msgstr "" #: ../../library/importlib.rst:205 msgid "" -":exc:`ModuleNotFoundError` is raised when the module being reloaded lacks a :" -"class:`~importlib.machinery.ModuleSpec`." +":exc:`ModuleNotFoundError` is raised when the module being reloaded lacks " +"a :class:`~importlib.machinery.ModuleSpec`." msgstr "" #: ../../library/importlib.rst:211 @@ -444,26 +444,27 @@ msgstr "" msgid "" "An abstract base class representing a :term:`path entry finder`. Though it " "bears some similarities to :class:`MetaPathFinder`, ``PathEntryFinder`` is " -"meant for use only within the path-based import subsystem provided by :class:" -"`importlib.machinery.PathFinder`." +"meant for use only within the path-based import subsystem provided " +"by :class:`importlib.machinery.PathFinder`." msgstr "" #: ../../library/importlib.rst:285 msgid "" "An abstract method for finding a :term:`spec ` for the " -"specified module. The finder will search for the module only within the :" -"term:`path entry` to which it is assigned. If a spec cannot be found, " +"specified module. The finder will search for the module only within " +"the :term:`path entry` to which it is assigned. If a spec cannot be found, " "``None`` is returned. When passed in, ``target`` is a module object that " -"the finder may use to make a more educated guess about what spec to return. :" -"func:`importlib.util.spec_from_loader` may be useful for implementing " -"concrete ``PathEntryFinders``." +"the finder may use to make a more educated guess about what spec to " +"return. :func:`importlib.util.spec_from_loader` may be useful for " +"implementing concrete ``PathEntryFinders``." msgstr "" #: ../../library/importlib.rst:297 msgid "" "An optional method which, when called, should invalidate any internal cache " -"used by the finder. Used by :meth:`importlib.machinery.PathFinder." -"invalidate_caches` when invalidating the caches of all cached finders." +"used by the finder. Used " +"by :meth:`importlib.machinery.PathFinder.invalidate_caches` when " +"invalidating the caches of all cached finders." msgstr "" #: ../../library/importlib.rst:305 @@ -474,9 +475,9 @@ msgstr "" #: ../../library/importlib.rst:308 msgid "" -"Loaders that wish to support resource reading should implement a :meth:" -"`get_resource_reader` method as specified by :class:`importlib.resources.abc." -"ResourceReader`." +"Loaders that wish to support resource reading should implement " +"a :meth:`get_resource_reader` method as specified " +"by :class:`importlib.resources.abc.ResourceReader`." msgstr "" #: ../../library/importlib.rst:312 @@ -498,8 +499,8 @@ msgstr "" msgid "" "An abstract method that executes the module in its own namespace when a " "module is imported or reloaded. The module should already be initialized " -"when :meth:`exec_module` is called. When this method exists, :meth:" -"`create_module` must be defined." +"when :meth:`exec_module` is called. When this method " +"exists, :meth:`create_module` must be defined." msgstr "" #: ../../library/importlib.rst:336 @@ -508,8 +509,9 @@ msgstr ":meth:`create_module` 也必須被定義。" #: ../../library/importlib.rst:341 msgid "" -"A legacy method for loading a module. If the module cannot be loaded, :exc:" -"`ImportError` is raised, otherwise the loaded module is returned." +"A legacy method for loading a module. If the module cannot be " +"loaded, :exc:`ImportError` is raised, otherwise the loaded module is " +"returned." msgstr "" #: ../../library/importlib.rst:345 @@ -567,67 +569,69 @@ msgstr "" #: ../../library/importlib.rst:373 msgid "" -"The recommended API for loading a module is :meth:`exec_module` (and :meth:" -"`create_module`). Loaders should implement it instead of :meth:" -"`load_module`. The import machinery takes care of all the other " +"The recommended API for loading a module is :meth:`exec_module` " +"(and :meth:`create_module`). Loaders should implement it instead " +"of :meth:`load_module`. The import machinery takes care of all the other " "responsibilities of :meth:`load_module` when :meth:`exec_module` is " "implemented." msgstr "" -#: ../../library/importlib.rst:383 ../../library/importlib.rst:631 +#: ../../library/importlib.rst:383 ../../library/importlib.rst:636 msgid "*Superseded by TraversableResources*" msgstr "" #: ../../library/importlib.rst:385 msgid "" -"An abstract base class for a :term:`loader` which implements the optional :" -"pep:`302` protocol for loading arbitrary resources from the storage back-end." +"An abstract base class for a :term:`loader` which implements the " +"optional :pep:`302` protocol for loading arbitrary resources from the " +"storage back-end." msgstr "" #: ../../library/importlib.rst:389 msgid "" -"This ABC is deprecated in favour of supporting resource loading through :" -"class:`importlib.resources.abc.TraversableResources`." +"This ABC is deprecated in favour of supporting resource loading " +"through :class:`importlib.resources.abc.TraversableResources`." msgstr "" -#: ../../library/importlib.rst:395 +#: ../../library/importlib.rst:396 msgid "" "An abstract method to return the bytes for the data located at *path*. " "Loaders that have a file-like storage back-end that allows storing arbitrary " "data can implement this abstract method to give direct access to the data " "stored. :exc:`OSError` is to be raised if the *path* cannot be found. The " -"*path* is expected to be constructed using a module's :attr:`~module." -"__file__` attribute or an item from a package's :attr:`~module.__path__`." +"*path* is expected to be constructed using a " +"module's :attr:`~module.__file__` attribute or an item from a " +"package's :attr:`~module.__path__`." msgstr "" -#: ../../library/importlib.rst:404 +#: ../../library/importlib.rst:405 msgid "Raises :exc:`OSError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:410 +#: ../../library/importlib.rst:411 msgid "" -"An abstract base class for a :term:`loader` which implements the optional :" -"pep:`302` protocol for loaders that inspect modules." +"An abstract base class for a :term:`loader` which implements the " +"optional :pep:`302` protocol for loaders that inspect modules." msgstr "" -#: ../../library/importlib.rst:415 +#: ../../library/importlib.rst:416 msgid "" "Return the code object for a module, or ``None`` if the module does not have " "a code object (as would be the case, for example, for a built-in module). " "Raise an :exc:`ImportError` if loader cannot find the requested module." msgstr "" -#: ../../library/importlib.rst:421 +#: ../../library/importlib.rst:422 msgid "" "While the method has a default implementation, it is suggested that it be " "overridden if possible for performance." msgstr "" -#: ../../library/importlib.rst:427 +#: ../../library/importlib.rst:428 msgid "No longer abstract and a concrete implementation is provided." msgstr "" -#: ../../library/importlib.rst:432 +#: ../../library/importlib.rst:434 msgid "" "An abstract method to return the source of a module. It is returned as a " "text string using :term:`universal newlines`, translating all recognized " @@ -636,233 +640,234 @@ msgid "" "cannot find the module specified." msgstr "" -#: ../../library/importlib.rst:438 ../../library/importlib.rst:447 -#: ../../library/importlib.rst:497 +#: ../../library/importlib.rst:440 ../../library/importlib.rst:449 +#: ../../library/importlib.rst:500 msgid "Raises :exc:`ImportError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:443 +#: ../../library/importlib.rst:445 msgid "" "An optional method to return a true value if the module is a package, a " "false value otherwise. :exc:`ImportError` is raised if the :term:`loader` " "cannot find the module." msgstr "" -#: ../../library/importlib.rst:452 +#: ../../library/importlib.rst:454 msgid "Create a code object from Python source." msgstr "" -#: ../../library/importlib.rst:454 +#: ../../library/importlib.rst:456 msgid "" -"The *data* argument can be whatever the :func:`compile` function supports (i." -"e. string or bytes). The *path* argument should be the \"path\" to where the " -"source code originated from, which can be an abstract concept (e.g. location " -"in a zip file)." +"The *data* argument can be whatever the :func:`compile` function supports " +"(i.e. string or bytes). The *path* argument should be the \"path\" to where " +"the source code originated from, which can be an abstract concept (e.g. " +"location in a zip file)." msgstr "" -#: ../../library/importlib.rst:459 +#: ../../library/importlib.rst:461 msgid "" "With the subsequent code object one can execute it in a module by running " "``exec(code, module.__dict__)``." msgstr "" -#: ../../library/importlib.rst:464 +#: ../../library/importlib.rst:466 msgid "Made the method static." msgstr "" -#: ../../library/importlib.rst:469 +#: ../../library/importlib.rst:471 msgid "Implementation of :meth:`Loader.exec_module`." msgstr ":meth:`Loader.exec_module` 的實作。" -#: ../../library/importlib.rst:475 +#: ../../library/importlib.rst:477 msgid "Implementation of :meth:`Loader.load_module`." msgstr ":meth:`Loader.load_module` 的實作。" -#: ../../library/importlib.rst:477 +#: ../../library/importlib.rst:479 msgid "use :meth:`exec_module` instead." msgstr "請改用 :meth:`exec_module`。" -#: ../../library/importlib.rst:483 +#: ../../library/importlib.rst:485 msgid "" "An abstract base class which inherits from :class:`InspectLoader` that, when " "implemented, helps a module to be executed as a script. The ABC represents " "an optional :pep:`302` protocol." msgstr "" -#: ../../library/importlib.rst:489 +#: ../../library/importlib.rst:492 msgid "" "An abstract method that is to return the value of :attr:`~module.__file__` " "for the specified module. If no path is available, :exc:`ImportError` is " "raised." msgstr "" -#: ../../library/importlib.rst:493 +#: ../../library/importlib.rst:496 msgid "" "If source code is available, then the method should return the path to the " "source file, regardless of whether a bytecode was used to load the module." msgstr "" -#: ../../library/importlib.rst:503 +#: ../../library/importlib.rst:506 msgid "" -"An abstract base class which inherits from :class:`ResourceLoader` and :" -"class:`ExecutionLoader`, providing concrete implementations of :meth:" -"`ResourceLoader.get_data` and :meth:`ExecutionLoader.get_filename`." +"An abstract base class which inherits from :class:`ResourceLoader` " +"and :class:`ExecutionLoader`, providing concrete implementations " +"of :meth:`ResourceLoader.get_data` and :meth:`ExecutionLoader.get_filename`." msgstr "" -#: ../../library/importlib.rst:507 +#: ../../library/importlib.rst:510 msgid "" "The *fullname* argument is a fully resolved name of the module the loader is " "to handle. The *path* argument is the path to the file for the module." msgstr "" -#: ../../library/importlib.rst:514 +#: ../../library/importlib.rst:517 msgid "The name of the module the loader can handle." msgstr "" -#: ../../library/importlib.rst:518 +#: ../../library/importlib.rst:521 msgid "Path to the file of the module." msgstr "" -#: ../../library/importlib.rst:522 +#: ../../library/importlib.rst:525 msgid "Calls super's ``load_module()``." msgstr "" -#: ../../library/importlib.rst:524 +#: ../../library/importlib.rst:527 msgid "Use :meth:`Loader.exec_module` instead." msgstr "" -#: ../../library/importlib.rst:529 ../../library/importlib.rst:1124 +#: ../../library/importlib.rst:533 ../../library/importlib.rst:1140 msgid "Returns :attr:`path`." msgstr "" -#: ../../library/importlib.rst:533 +#: ../../library/importlib.rst:538 msgid "Reads *path* as a binary file and returns the bytes from it." msgstr "" -#: ../../library/importlib.rst:538 +#: ../../library/importlib.rst:543 msgid "" "An abstract base class for implementing source (and optionally bytecode) " -"file loading. The class inherits from both :class:`ResourceLoader` and :" -"class:`ExecutionLoader`, requiring the implementation of:" +"file loading. The class inherits from both :class:`ResourceLoader` " +"and :class:`ExecutionLoader`, requiring the implementation of:" msgstr "" -#: ../../library/importlib.rst:542 +#: ../../library/importlib.rst:547 msgid ":meth:`ResourceLoader.get_data`" msgstr ":meth:`ResourceLoader.get_data`" -#: ../../library/importlib.rst:543 +#: ../../library/importlib.rst:548 msgid ":meth:`ExecutionLoader.get_filename`" msgstr ":meth:`ExecutionLoader.get_filename`" -#: ../../library/importlib.rst:544 +#: ../../library/importlib.rst:549 msgid "" "Should only return the path to the source file; sourceless loading is not " "supported." msgstr "" -#: ../../library/importlib.rst:547 +#: ../../library/importlib.rst:552 msgid "" "The abstract methods defined by this class are to add optional bytecode file " -"support. Not implementing these optional methods (or causing them to raise :" -"exc:`NotImplementedError`) causes the loader to only work with source code. " -"Implementing the methods allows the loader to work with source *and* " +"support. Not implementing these optional methods (or causing them to " +"raise :exc:`NotImplementedError`) causes the loader to only work with source " +"code. Implementing the methods allows the loader to work with source *and* " "bytecode files; it does not allow for *sourceless* loading where only " "bytecode is provided. Bytecode files are an optimization to speed up " "loading by removing the parsing step of Python's compiler, and so no " "bytecode-specific API is exposed." msgstr "" -#: ../../library/importlib.rst:558 +#: ../../library/importlib.rst:563 msgid "" "Optional abstract method which returns a :class:`dict` containing metadata " "about the specified path. Supported dictionary keys are:" msgstr "" -#: ../../library/importlib.rst:561 +#: ../../library/importlib.rst:566 msgid "" "``'mtime'`` (mandatory): an integer or floating-point number representing " "the modification time of the source code;" msgstr "" -#: ../../library/importlib.rst:563 +#: ../../library/importlib.rst:568 msgid "``'size'`` (optional): the size in bytes of the source code." msgstr "" -#: ../../library/importlib.rst:565 +#: ../../library/importlib.rst:570 msgid "" "Any other keys in the dictionary are ignored, to allow for future " "extensions. If the path cannot be handled, :exc:`OSError` is raised." msgstr "" -#: ../../library/importlib.rst:570 ../../library/importlib.rst:583 +#: ../../library/importlib.rst:575 ../../library/importlib.rst:588 msgid "Raise :exc:`OSError` instead of :exc:`NotImplementedError`." msgstr "" -#: ../../library/importlib.rst:575 +#: ../../library/importlib.rst:580 msgid "" "Optional abstract method which returns the modification time for the " "specified path." msgstr "" -#: ../../library/importlib.rst:578 +#: ../../library/importlib.rst:583 msgid "" "This method is deprecated in favour of :meth:`path_stats`. You don't have " "to implement it, but it is still available for compatibility purposes. " "Raise :exc:`OSError` if the path cannot be handled." msgstr "" -#: ../../library/importlib.rst:588 +#: ../../library/importlib.rst:593 msgid "" "Optional abstract method which writes the specified bytes to a file path. " "Any intermediate directories which do not exist are to be created " "automatically." msgstr "" -#: ../../library/importlib.rst:592 +#: ../../library/importlib.rst:597 msgid "" -"When writing to the path fails because the path is read-only (:const:`errno." -"EACCES`/:exc:`PermissionError`), do not propagate the exception." +"When writing to the path fails because the path is read-only " +"(:const:`errno.EACCES`/:exc:`PermissionError`), do not propagate the " +"exception." msgstr "" -#: ../../library/importlib.rst:596 +#: ../../library/importlib.rst:601 msgid "No longer raises :exc:`NotImplementedError` when called." msgstr "" -#: ../../library/importlib.rst:601 +#: ../../library/importlib.rst:606 msgid "Concrete implementation of :meth:`InspectLoader.get_code`." msgstr "" -#: ../../library/importlib.rst:605 +#: ../../library/importlib.rst:610 msgid "Concrete implementation of :meth:`Loader.exec_module`." msgstr "" -#: ../../library/importlib.rst:611 +#: ../../library/importlib.rst:616 msgid "Concrete implementation of :meth:`Loader.load_module`." msgstr "" -#: ../../library/importlib.rst:613 +#: ../../library/importlib.rst:618 msgid "Use :meth:`exec_module` instead." msgstr "" -#: ../../library/importlib.rst:618 +#: ../../library/importlib.rst:623 msgid "Concrete implementation of :meth:`InspectLoader.get_source`." msgstr "" -#: ../../library/importlib.rst:622 +#: ../../library/importlib.rst:627 msgid "" "Concrete implementation of :meth:`InspectLoader.is_package`. A module is " -"determined to be a package if its file path (as provided by :meth:" -"`ExecutionLoader.get_filename`) is a file named ``__init__`` when the file " -"extension is removed **and** the module name itself does not end in " +"determined to be a package if its file path (as provided " +"by :meth:`ExecutionLoader.get_filename`) is a file named ``__init__`` when " +"the file extension is removed **and** the module name itself does not end in " "``__init__``." msgstr "" -#: ../../library/importlib.rst:633 +#: ../../library/importlib.rst:638 msgid "" "An :term:`abstract base class` to provide the ability to read *resources*." msgstr "" -#: ../../library/importlib.rst:636 +#: ../../library/importlib.rst:641 msgid "" "From the perspective of this ABC, a *resource* is a binary artifact that is " "shipped within a package. Typically this is something like a data file that " @@ -872,11 +877,11 @@ msgid "" "file versus on the file system." msgstr "" -#: ../../library/importlib.rst:644 +#: ../../library/importlib.rst:649 msgid "" -"For any of methods of this class, a *resource* argument is expected to be a :" -"term:`path-like object` which represents conceptually just a file name. This " -"means that no subdirectory paths should be included in the *resource* " +"For any of methods of this class, a *resource* argument is expected to be " +"a :term:`path-like object` which represents conceptually just a file name. " +"This means that no subdirectory paths should be included in the *resource* " "argument. This is because the location of the package the reader is for, " "acts as the \"directory\". Hence the metaphor for directories and file names " "is packages and resources, respectively. This is also why instances of this " @@ -884,7 +889,7 @@ msgid "" "potentially representing multiple packages or a module)." msgstr "" -#: ../../library/importlib.rst:655 +#: ../../library/importlib.rst:660 msgid "" "Loaders that wish to support resource reading are expected to provide a " "method called ``get_resource_reader(fullname)`` which returns an object " @@ -893,45 +898,45 @@ msgid "" "with this ABC should only be returned when the specified module is a package." msgstr "" -#: ../../library/importlib.rst:664 ../../library/importlib.rst:774 +#: ../../library/importlib.rst:669 ../../library/importlib.rst:789 msgid "Use :class:`importlib.resources.abc.TraversableResources` instead." msgstr "" -#: ../../library/importlib.rst:669 +#: ../../library/importlib.rst:675 msgid "" "Returns an opened, :term:`file-like object` for binary reading of the " "*resource*." msgstr "" -#: ../../library/importlib.rst:672 +#: ../../library/importlib.rst:678 msgid "If the resource cannot be found, :exc:`FileNotFoundError` is raised." msgstr "" -#: ../../library/importlib.rst:677 +#: ../../library/importlib.rst:684 msgid "Returns the file system path to the *resource*." msgstr "" -#: ../../library/importlib.rst:679 +#: ../../library/importlib.rst:686 msgid "" -"If the resource does not concretely exist on the file system, raise :exc:" -"`FileNotFoundError`." +"If the resource does not concretely exist on the file system, " +"raise :exc:`FileNotFoundError`." msgstr "" -#: ../../library/importlib.rst:684 +#: ../../library/importlib.rst:692 msgid "" -"Returns ``True`` if the named *name* is considered a resource. :exc:" -"`FileNotFoundError` is raised if *name* does not exist." +"Returns ``True`` if the named *name* is considered a " +"resource. :exc:`FileNotFoundError` is raised if *name* does not exist." msgstr "" -#: ../../library/importlib.rst:689 +#: ../../library/importlib.rst:698 msgid "" "Returns an :term:`iterable` of strings over the contents of the package. Do " "note that it is not required that all names returned by the iterator be " -"actual resources, e.g. it is acceptable to return names for which :meth:" -"`is_resource` would be false." +"actual resources, e.g. it is acceptable to return names for " +"which :meth:`is_resource` would be false." msgstr "" -#: ../../library/importlib.rst:695 +#: ../../library/importlib.rst:704 msgid "" "Allowing non-resource names to be returned is to allow for situations where " "how a package and its resources are stored are known a priori and the non-" @@ -940,254 +945,258 @@ msgid "" "stored on the file system then those subdirectory names can be used directly." msgstr "" -#: ../../library/importlib.rst:703 +#: ../../library/importlib.rst:712 msgid "The abstract method returns an iterable of no items." msgstr "" -#: ../../library/importlib.rst:708 +#: ../../library/importlib.rst:717 msgid "" "An object with a subset of :class:`pathlib.Path` methods suitable for " "traversing directories and opening files." msgstr "" -#: ../../library/importlib.rst:711 +#: ../../library/importlib.rst:720 msgid "" -"For a representation of the object on the file-system, use :meth:`importlib." -"resources.as_file`." +"For a representation of the object on the file-system, " +"use :meth:`importlib.resources.as_file`." msgstr "" -#: ../../library/importlib.rst:716 +#: ../../library/importlib.rst:725 msgid "Use :class:`importlib.resources.abc.Traversable` instead." msgstr "" -#: ../../library/importlib.rst:721 +#: ../../library/importlib.rst:730 msgid "Abstract. The base name of this object without any parent references." msgstr "" -#: ../../library/importlib.rst:725 +#: ../../library/importlib.rst:735 msgid "Yield ``Traversable`` objects in ``self``." msgstr "" -#: ../../library/importlib.rst:729 +#: ../../library/importlib.rst:740 msgid "Return ``True`` if ``self`` is a directory." msgstr "" -#: ../../library/importlib.rst:733 +#: ../../library/importlib.rst:745 msgid "Return ``True`` if ``self`` is a file." msgstr "" -#: ../../library/importlib.rst:737 +#: ../../library/importlib.rst:750 msgid "Return Traversable child in ``self``." msgstr "" -#: ../../library/importlib.rst:741 +#: ../../library/importlib.rst:755 msgid "Return ``Traversable`` child in ``self``." msgstr "" -#: ../../library/importlib.rst:745 +#: ../../library/importlib.rst:760 msgid "" "*mode* may be 'r' or 'rb' to open as text or binary. Return a handle " "suitable for reading (same as :attr:`pathlib.Path.open`)." msgstr "" -#: ../../library/importlib.rst:748 +#: ../../library/importlib.rst:763 msgid "" -"When opening as text, accepts encoding parameters such as those accepted by :" -"class:`io.TextIOWrapper`." +"When opening as text, accepts encoding parameters such as those accepted " +"by :class:`io.TextIOWrapper`." msgstr "" -#: ../../library/importlib.rst:753 +#: ../../library/importlib.rst:768 msgid "Read contents of ``self`` as bytes." msgstr "" -#: ../../library/importlib.rst:757 +#: ../../library/importlib.rst:772 msgid "Read contents of ``self`` as text." msgstr "" -#: ../../library/importlib.rst:762 +#: ../../library/importlib.rst:777 msgid "" -"An abstract base class for resource readers capable of serving the :meth:" -"`importlib.resources.files` interface. Subclasses :class:`importlib." -"resources.abc.ResourceReader` and provides concrete implementations of the :" -"class:`importlib.resources.abc.ResourceReader`'s abstract methods. " +"An abstract base class for resource readers capable of serving " +"the :meth:`importlib.resources.files` interface. " +"Subclasses :class:`importlib.resources.abc.ResourceReader` and provides " +"concrete implementations of " +"the :class:`importlib.resources.abc.ResourceReader`'s abstract methods. " "Therefore, any loader supplying :class:`importlib.abc.TraversableResources` " "also supplies ResourceReader." msgstr "" -#: ../../library/importlib.rst:769 +#: ../../library/importlib.rst:784 msgid "" "Loaders that wish to support resource reading are expected to implement this " "interface." msgstr "" -#: ../../library/importlib.rst:779 +#: ../../library/importlib.rst:795 msgid "" "Returns a :class:`importlib.resources.abc.Traversable` object for the loaded " "package." msgstr "" -#: ../../library/importlib.rst:785 +#: ../../library/importlib.rst:801 msgid ":mod:`importlib.machinery` -- Importers and path hooks" msgstr "" -#: ../../library/importlib.rst:790 +#: ../../library/importlib.rst:806 msgid "**Source code:** :source:`Lib/importlib/machinery.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/machinery.py`" -#: ../../library/importlib.rst:794 +#: ../../library/importlib.rst:810 msgid "" "This module contains the various objects that help :keyword:`import` find " "and load modules." msgstr "" -#: ../../library/importlib.rst:799 +#: ../../library/importlib.rst:815 msgid "" "A list of strings representing the recognized file suffixes for source " "modules." msgstr "" -#: ../../library/importlib.rst:806 +#: ../../library/importlib.rst:822 msgid "" "A list of strings representing the file suffixes for non-optimized bytecode " "modules." msgstr "" -#: ../../library/importlib.rst:811 ../../library/importlib.rst:821 +#: ../../library/importlib.rst:827 ../../library/importlib.rst:837 msgid "Use :const:`BYTECODE_SUFFIXES` instead." msgstr "" -#: ../../library/importlib.rst:816 +#: ../../library/importlib.rst:832 msgid "" "A list of strings representing the file suffixes for optimized bytecode " "modules." msgstr "" -#: ../../library/importlib.rst:826 +#: ../../library/importlib.rst:842 msgid "" "A list of strings representing the recognized file suffixes for bytecode " "modules (including the leading dot)." msgstr "" -#: ../../library/importlib.rst:831 +#: ../../library/importlib.rst:847 msgid "The value is no longer dependent on ``__debug__``." msgstr "" -#: ../../library/importlib.rst:836 +#: ../../library/importlib.rst:852 msgid "" "A list of strings representing the recognized file suffixes for extension " "modules." msgstr "" -#: ../../library/importlib.rst:843 +#: ../../library/importlib.rst:859 msgid "" "Returns a combined list of strings representing all file suffixes for " "modules recognized by the standard import machinery. This is a helper for " "code which simply needs to know if a filesystem path potentially refers to a " -"module without needing any details on the kind of module (for example, :func:" -"`inspect.getmodulename`)." +"module without needing any details on the kind of module (for " +"example, :func:`inspect.getmodulename`)." msgstr "" -#: ../../library/importlib.rst:854 +#: ../../library/importlib.rst:870 msgid "" "An :term:`importer` for built-in modules. All known built-in modules are " -"listed in :data:`sys.builtin_module_names`. This class implements the :class:" -"`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." +"listed in :data:`sys.builtin_module_names`. This class implements " +"the :class:`importlib.abc.MetaPathFinder` " +"and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" -#: ../../library/importlib.rst:859 ../../library/importlib.rst:873 -#: ../../library/importlib.rst:886 ../../library/importlib.rst:901 +#: ../../library/importlib.rst:875 ../../library/importlib.rst:889 +#: ../../library/importlib.rst:902 ../../library/importlib.rst:917 msgid "" "Only class methods are defined by this class to alleviate the need for " "instantiation." msgstr "" -#: ../../library/importlib.rst:862 +#: ../../library/importlib.rst:878 msgid "" -"As part of :pep:`489`, the builtin importer now implements :meth:`Loader." -"create_module` and :meth:`Loader.exec_module`" +"As part of :pep:`489`, the builtin importer now " +"implements :meth:`Loader.create_module` and :meth:`Loader.exec_module`" msgstr "" -#: ../../library/importlib.rst:869 +#: ../../library/importlib.rst:885 msgid "" -"An :term:`importer` for frozen modules. This class implements the :class:" -"`importlib.abc.MetaPathFinder` and :class:`importlib.abc.InspectLoader` ABCs." +"An :term:`importer` for frozen modules. This class implements " +"the :class:`importlib.abc.MetaPathFinder` " +"and :class:`importlib.abc.InspectLoader` ABCs." msgstr "" -#: ../../library/importlib.rst:876 +#: ../../library/importlib.rst:892 msgid "" "Gained :meth:`~Loader.create_module` and :meth:`~Loader.exec_module` methods." msgstr "" -#: ../../library/importlib.rst:883 +#: ../../library/importlib.rst:899 msgid "" ":term:`Finder ` for modules declared in the Windows registry. This " "class implements the :class:`importlib.abc.MetaPathFinder` ABC." msgstr "" -#: ../../library/importlib.rst:891 +#: ../../library/importlib.rst:907 msgid "" "Use :mod:`site` configuration instead. Future versions of Python may not " "enable this finder by default." msgstr "" -#: ../../library/importlib.rst:898 +#: ../../library/importlib.rst:914 msgid "" "A :term:`Finder ` for :data:`sys.path` and package ``__path__`` " "attributes. This class implements the :class:`importlib.abc.MetaPathFinder` " "ABC." msgstr "" -#: ../../library/importlib.rst:906 +#: ../../library/importlib.rst:922 msgid "" "Class method that attempts to find a :term:`spec ` for the " "module specified by *fullname* on :data:`sys.path` or, if defined, on " -"*path*. For each path entry that is searched, :data:`sys." -"path_importer_cache` is checked. If a non-false object is found then it is " -"used as the :term:`path entry finder` to look for the module being searched " -"for. If no entry is found in :data:`sys.path_importer_cache`, then :data:" -"`sys.path_hooks` is searched for a finder for the path entry and, if found, " -"is stored in :data:`sys.path_importer_cache` along with being queried about " -"the module. If no finder is ever found then ``None`` is both stored in the " -"cache and returned." +"*path*. For each path entry that is " +"searched, :data:`sys.path_importer_cache` is checked. If a non-false object " +"is found then it is used as the :term:`path entry finder` to look for the " +"module being searched for. If no entry is found " +"in :data:`sys.path_importer_cache`, then :data:`sys.path_hooks` is searched " +"for a finder for the path entry and, if found, is stored " +"in :data:`sys.path_importer_cache` along with being queried about the " +"module. If no finder is ever found then ``None`` is both stored in the cache " +"and returned." msgstr "" -#: ../../library/importlib.rst:920 +#: ../../library/importlib.rst:936 msgid "" "If the current working directory -- represented by an empty string -- is no " -"longer valid then ``None`` is returned but no value is cached in :data:`sys." -"path_importer_cache`." +"longer valid then ``None`` is returned but no value is cached " +"in :data:`sys.path_importer_cache`." msgstr "" -#: ../../library/importlib.rst:927 +#: ../../library/importlib.rst:943 msgid "" "Calls :meth:`importlib.abc.PathEntryFinder.invalidate_caches` on all finders " "stored in :data:`sys.path_importer_cache` that define the method. Otherwise " "entries in :data:`sys.path_importer_cache` set to ``None`` are deleted." msgstr "" -#: ../../library/importlib.rst:932 +#: ../../library/importlib.rst:948 msgid "Entries of ``None`` in :data:`sys.path_importer_cache` are deleted." msgstr "" -#: ../../library/importlib.rst:935 +#: ../../library/importlib.rst:951 msgid "" "Calls objects in :data:`sys.path_hooks` with the current working directory " "for ``''`` (i.e. the empty string)." msgstr "" -#: ../../library/importlib.rst:942 +#: ../../library/importlib.rst:958 msgid "" "A concrete implementation of :class:`importlib.abc.PathEntryFinder` which " "caches results from the file system." msgstr "" -#: ../../library/importlib.rst:945 +#: ../../library/importlib.rst:961 msgid "" "The *path* argument is the directory for which the finder is in charge of " "searching." msgstr "" -#: ../../library/importlib.rst:948 +#: ../../library/importlib.rst:964 msgid "" "The *loader_details* argument is a variable number of 2-item tuples each " "containing a loader and a sequence of file suffixes the loader recognizes. " @@ -1195,7 +1204,7 @@ msgid "" "module's name and the path to the file found." msgstr "" -#: ../../library/importlib.rst:953 +#: ../../library/importlib.rst:969 msgid "" "The finder will cache the directory contents as necessary, making stat calls " "for each module search to verify the cache is not outdated. Because cache " @@ -1208,166 +1217,166 @@ msgid "" "to call :func:`importlib.invalidate_caches`." msgstr "" -#: ../../library/importlib.rst:967 +#: ../../library/importlib.rst:983 msgid "The path the finder will search in." msgstr "" -#: ../../library/importlib.rst:971 +#: ../../library/importlib.rst:987 msgid "Attempt to find the spec to handle *fullname* within :attr:`path`." msgstr "" -#: ../../library/importlib.rst:977 +#: ../../library/importlib.rst:993 msgid "Clear out the internal cache." msgstr "" -#: ../../library/importlib.rst:981 +#: ../../library/importlib.rst:997 msgid "" "A class method which returns a closure for use on :data:`sys.path_hooks`. An " "instance of :class:`FileFinder` is returned by the closure using the path " "argument given to the closure directly and *loader_details* indirectly." msgstr "" -#: ../../library/importlib.rst:986 +#: ../../library/importlib.rst:1002 msgid "" -"If the argument to the closure is not an existing directory, :exc:" -"`ImportError` is raised." +"If the argument to the closure is not an existing " +"directory, :exc:`ImportError` is raised." msgstr "" -#: ../../library/importlib.rst:992 +#: ../../library/importlib.rst:1008 msgid "" "A concrete implementation of :class:`importlib.abc.SourceLoader` by " "subclassing :class:`importlib.abc.FileLoader` and providing some concrete " "implementations of other methods." msgstr "" -#: ../../library/importlib.rst:1000 +#: ../../library/importlib.rst:1016 msgid "The name of the module that this loader will handle." msgstr "" -#: ../../library/importlib.rst:1004 +#: ../../library/importlib.rst:1020 msgid "The path to the source file." msgstr "" -#: ../../library/importlib.rst:1008 +#: ../../library/importlib.rst:1024 msgid "Return ``True`` if :attr:`path` appears to be for a package." msgstr "" -#: ../../library/importlib.rst:1012 +#: ../../library/importlib.rst:1028 msgid "" "Concrete implementation of :meth:`importlib.abc.SourceLoader.path_stats`." msgstr "" -#: ../../library/importlib.rst:1016 +#: ../../library/importlib.rst:1032 msgid "Concrete implementation of :meth:`importlib.abc.SourceLoader.set_data`." msgstr "" -#: ../../library/importlib.rst:1020 ../../library/importlib.rst:1063 +#: ../../library/importlib.rst:1036 ../../library/importlib.rst:1079 msgid "" "Concrete implementation of :meth:`importlib.abc.Loader.load_module` where " "specifying the name of the module to load is optional." msgstr "" -#: ../../library/importlib.rst:1025 ../../library/importlib.rst:1068 +#: ../../library/importlib.rst:1041 ../../library/importlib.rst:1084 msgid "Use :meth:`importlib.abc.Loader.exec_module` instead." msgstr "" -#: ../../library/importlib.rst:1030 +#: ../../library/importlib.rst:1046 msgid "" "A concrete implementation of :class:`importlib.abc.FileLoader` which can " "import bytecode files (i.e. no source code files exist)." msgstr "" -#: ../../library/importlib.rst:1033 +#: ../../library/importlib.rst:1049 msgid "" "Please note that direct use of bytecode files (and thus not source code " "files) inhibits your modules from being usable by all Python implementations " "or new versions of Python which change the bytecode format." msgstr "" -#: ../../library/importlib.rst:1042 +#: ../../library/importlib.rst:1058 msgid "The name of the module the loader will handle." msgstr "" -#: ../../library/importlib.rst:1046 +#: ../../library/importlib.rst:1062 msgid "The path to the bytecode file." msgstr "" -#: ../../library/importlib.rst:1050 +#: ../../library/importlib.rst:1066 msgid "Determines if the module is a package based on :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1054 +#: ../../library/importlib.rst:1070 msgid "Returns the code object for :attr:`name` created from :attr:`path`." msgstr "" -#: ../../library/importlib.rst:1058 +#: ../../library/importlib.rst:1074 msgid "" "Returns ``None`` as bytecode files have no source when this loader is used." msgstr "" -#: ../../library/importlib.rst:1073 +#: ../../library/importlib.rst:1089 msgid "" "A concrete implementation of :class:`importlib.abc.ExecutionLoader` for " "extension modules." msgstr "" -#: ../../library/importlib.rst:1076 +#: ../../library/importlib.rst:1092 msgid "" "The *fullname* argument specifies the name of the module the loader is to " "support. The *path* argument is the path to the extension module's file." msgstr "" -#: ../../library/importlib.rst:1079 +#: ../../library/importlib.rst:1095 msgid "" "Note that, by default, importing an extension module will fail in " "subinterpreters if it doesn't implement multi-phase init (see :pep:`489`), " "even if it would otherwise import successfully." msgstr "" -#: ../../library/importlib.rst:1085 +#: ../../library/importlib.rst:1101 msgid "Multi-phase init is now required for use in subinterpreters." msgstr "" -#: ../../library/importlib.rst:1090 ../../library/importlib.rst:1276 +#: ../../library/importlib.rst:1106 ../../library/importlib.rst:1292 msgid "Name of the module the loader supports." msgstr "" -#: ../../library/importlib.rst:1094 +#: ../../library/importlib.rst:1110 msgid "Path to the extension module." msgstr "" -#: ../../library/importlib.rst:1098 +#: ../../library/importlib.rst:1114 msgid "" -"Creates the module object from the given specification in accordance with :" -"pep:`489`." +"Creates the module object from the given specification in accordance " +"with :pep:`489`." msgstr "" -#: ../../library/importlib.rst:1105 +#: ../../library/importlib.rst:1121 msgid "Initializes the given module object in accordance with :pep:`489`." msgstr "" -#: ../../library/importlib.rst:1111 +#: ../../library/importlib.rst:1127 msgid "" "Returns ``True`` if the file path points to a package's ``__init__`` module " "based on :const:`EXTENSION_SUFFIXES`." msgstr "" -#: ../../library/importlib.rst:1116 +#: ../../library/importlib.rst:1132 msgid "Returns ``None`` as extension modules lack a code object." msgstr "" -#: ../../library/importlib.rst:1120 +#: ../../library/importlib.rst:1136 msgid "Returns ``None`` as extension modules do not have source code." msgstr "" -#: ../../library/importlib.rst:1131 +#: ../../library/importlib.rst:1147 msgid "" "A concrete implementation of :class:`importlib.abc.InspectLoader` for " "namespace packages. This is an alias for a private class and is only made " "public for introspecting the ``__loader__`` attribute on namespace packages::" msgstr "" -#: ../../library/importlib.rst:1136 +#: ../../library/importlib.rst:1152 msgid "" ">>> from importlib.machinery import NamespaceLoader\n" ">>> import my_namespace\n" @@ -1385,7 +1394,7 @@ msgstr "" ">>> isinstance(my_namespace.__loader__, importlib.abc.Loader)\n" "True" -#: ../../library/importlib.rst:1149 +#: ../../library/importlib.rst:1165 msgid "" "A specification for a module's import-system-related state. This is " "typically exposed as the module's :attr:`~module.__spec__` attribute. Many " @@ -1394,39 +1403,40 @@ msgid "" "the *values* are usually equivalent, they can differ since there is no " "synchronization between the two objects. For example, it is possible to " "update the module's :attr:`~module.__file__` at runtime and this will not be " -"automatically reflected in the module's :attr:`__spec__.origin `, and vice versa." +"automatically reflected in the module's :attr:`__spec__.origin " +"`, and vice versa." msgstr "" -#: ../../library/importlib.rst:1163 +#: ../../library/importlib.rst:1179 msgid "" -"The module's fully qualified name (see :attr:`module.__name__`). The :term:" -"`finder` should always set this attribute to a non-empty string." +"The module's fully qualified name (see :attr:`module.__name__`). " +"The :term:`finder` should always set this attribute to a non-empty string." msgstr "" -#: ../../library/importlib.rst:1168 +#: ../../library/importlib.rst:1184 msgid "" "The :term:`loader` used to load the module (see :attr:`module.__loader__`). " "The :term:`finder` should always set this attribute." msgstr "" -#: ../../library/importlib.rst:1173 +#: ../../library/importlib.rst:1189 msgid "" -"The location the :term:`loader` should use to load the module (see :attr:" -"`module.__file__`). For example, for modules loaded from a ``.py`` file this " -"is the filename. The :term:`finder` should always set this attribute to a " -"meaningful value for the :term:`loader` to use. In the uncommon case that " -"there is not one (like for namespace packages), it should be set to ``None``." +"The location the :term:`loader` should use to load the module " +"(see :attr:`module.__file__`). For example, for modules loaded from a " +"``.py`` file this is the filename. The :term:`finder` should always set this " +"attribute to a meaningful value for the :term:`loader` to use. In the " +"uncommon case that there is not one (like for namespace packages), it should " +"be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1182 +#: ../../library/importlib.rst:1198 msgid "" "A (possibly empty) :term:`sequence` of strings enumerating the locations in " "which a package's submodules will be found (see :attr:`module.__path__`). " "Most of the time there will only be a single directory in this list." msgstr "" -#: ../../library/importlib.rst:1187 +#: ../../library/importlib.rst:1203 msgid "" "The :term:`finder` should set this attribute to a sequence, even an empty " "one, to indicate to the import system that the module is a package. It " @@ -1434,41 +1444,42 @@ msgid "" "later to a special object for namespace packages." msgstr "" -#: ../../library/importlib.rst:1195 +#: ../../library/importlib.rst:1211 msgid "" "The :term:`finder` may set this attribute to an object containing " "additional, module-specific data to use when loading the module. Otherwise " "it should be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1201 +#: ../../library/importlib.rst:1217 msgid "" -"The filename of a compiled version of the module's code (see :attr:`module." -"__cached__`). The :term:`finder` should always set this attribute but it may " -"be ``None`` for modules that do not need compiled code stored." +"The filename of a compiled version of the module's code " +"(see :attr:`module.__cached__`). The :term:`finder` should always set this " +"attribute but it may be ``None`` for modules that do not need compiled code " +"stored." msgstr "" -#: ../../library/importlib.rst:1208 +#: ../../library/importlib.rst:1224 msgid "" "(Read-only) The fully qualified name of the package the module is in (or the " "empty string for a top-level module). See :attr:`module.__package__`. If the " "module is a package then this is the same as :attr:`name`." msgstr "" -#: ../../library/importlib.rst:1215 +#: ../../library/importlib.rst:1231 msgid "" "``True`` if the spec's :attr:`origin` refers to a loadable location, " "``False`` otherwise. This value impacts how :attr:`!origin` is interpreted " "and how the module's :attr:`~module.__file__` is populated." msgstr "" -#: ../../library/importlib.rst:1222 +#: ../../library/importlib.rst:1238 msgid "" "A specialization of :class:`importlib.machinery.ExtensionFileLoader` that is " "able to load extension modules in Framework format." msgstr "" -#: ../../library/importlib.rst:1225 +#: ../../library/importlib.rst:1241 msgid "" "For compatibility with the iOS App Store, *all* binary modules in an iOS app " "must be dynamic libraries, contained in a framework with appropriate " @@ -1477,37 +1488,37 @@ msgid "" "material outside the Frameworks folder." msgstr "" -#: ../../library/importlib.rst:1231 +#: ../../library/importlib.rst:1247 msgid "" "To accommodate this requirement, when running on iOS, extension module " "binaries are *not* packaged as ``.so`` files on ``sys.path``, but as " "individual standalone frameworks. To discover those frameworks, this loader " "is be registered against the ``.fwork`` file extension, with a ``.fwork`` " -"file acting as a placeholder in the original location of the binary on ``sys." -"path``. The ``.fwork`` file contains the path of the actual binary in the " -"``Frameworks`` folder, relative to the app bundle. To allow for resolving a " -"framework-packaged binary back to the original location, the framework is " -"expected to contain a ``.origin`` file that contains the location of the ``." -"fwork`` file, relative to the app bundle." +"file acting as a placeholder in the original location of the binary on " +"``sys.path``. The ``.fwork`` file contains the path of the actual binary in " +"the ``Frameworks`` folder, relative to the app bundle. To allow for " +"resolving a framework-packaged binary back to the original location, the " +"framework is expected to contain a ``.origin`` file that contains the " +"location of the ``.fwork`` file, relative to the app bundle." msgstr "" -#: ../../library/importlib.rst:1242 +#: ../../library/importlib.rst:1258 msgid "" "For example, consider the case of an import ``from foo.bar import _whiz``, " "where ``_whiz`` is implemented with the binary module ``sources/foo/bar/" -"_whiz.abi3.so``, with ``sources`` being the location registered on ``sys." -"path``, relative to the application bundle. This module *must* be " +"_whiz.abi3.so``, with ``sources`` being the location registered on " +"``sys.path``, relative to the application bundle. This module *must* be " "distributed as ``Frameworks/foo.bar._whiz.framework/foo.bar._whiz`` " "(creating the framework name from the full import path of the module), with " "an ``Info.plist`` file in the ``.framework`` directory identifying the " "binary as a framework. The ``foo.bar._whiz`` module would be represented in " "the original location with a ``sources/foo/bar/_whiz.abi3.fwork`` marker " "file, containing the path ``Frameworks/foo.bar._whiz/foo.bar._whiz``. The " -"framework would also contain ``Frameworks/foo.bar._whiz.framework/foo.bar." -"_whiz.origin``, containing the path to the ``.fwork`` file." +"framework would also contain ``Frameworks/foo.bar._whiz.framework/" +"foo.bar._whiz.origin``, containing the path to the ``.fwork`` file." msgstr "" -#: ../../library/importlib.rst:1256 +#: ../../library/importlib.rst:1272 msgid "" "When a module is loaded with this loader, the ``__file__`` for the module " "will report as the location of the ``.fwork`` file. This allows code to use " @@ -1516,7 +1527,7 @@ msgid "" "in the ``.framework`` folder." msgstr "" -#: ../../library/importlib.rst:1262 +#: ../../library/importlib.rst:1278 msgid "" "The Xcode project building the app is responsible for converting any ``.so`` " "files from wherever they exist in the ``PYTHONPATH`` into frameworks in the " @@ -1527,45 +1538,45 @@ msgid "" "details on how to construct this build step." msgstr "" -#: ../../library/importlib.rst:1272 +#: ../../library/importlib.rst:1288 msgid "Availability" msgstr "" -#: ../../library/importlib.rst:1280 +#: ../../library/importlib.rst:1296 msgid "Path to the ``.fwork`` file for the extension module." msgstr "" -#: ../../library/importlib.rst:1284 +#: ../../library/importlib.rst:1300 msgid ":mod:`importlib.util` -- Utility code for importers" msgstr "" -#: ../../library/importlib.rst:1290 +#: ../../library/importlib.rst:1306 msgid "**Source code:** :source:`Lib/importlib/util.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/util.py`" -#: ../../library/importlib.rst:1294 +#: ../../library/importlib.rst:1310 msgid "" "This module contains the various objects that help in the construction of " "an :term:`importer`." msgstr "" -#: ../../library/importlib.rst:1299 +#: ../../library/importlib.rst:1315 msgid "" "The bytes which represent the bytecode version number. If you need help with " "loading/writing bytecode then consider :class:`importlib.abc.SourceLoader`." msgstr "" -#: ../../library/importlib.rst:1306 +#: ../../library/importlib.rst:1322 msgid "" "Return the :pep:`3147`/:pep:`488` path to the byte-compiled file associated " "with the source *path*. For example, if *path* is ``/foo/bar/baz.py`` the " "return value would be ``/foo/bar/__pycache__/baz.cpython-32.pyc`` for Python " -"3.2. The ``cpython-32`` string comes from the current magic tag (see :func:" -"`get_tag`; if :attr:`sys.implementation.cache_tag` is not defined then :exc:" -"`NotImplementedError` will be raised)." +"3.2. The ``cpython-32`` string comes from the current magic tag " +"(see :func:`get_tag`; if :attr:`sys.implementation.cache_tag` is not defined " +"then :exc:`NotImplementedError` will be raised)." msgstr "" -#: ../../library/importlib.rst:1313 +#: ../../library/importlib.rst:1329 msgid "" "The *optimization* parameter is used to specify the optimization level of " "the bytecode file. An empty string represents no optimization, so ``/foo/bar/" @@ -1573,12 +1584,12 @@ msgid "" "``/foo/bar/__pycache__/baz.cpython-32.pyc``. ``None`` causes the " "interpreter's optimization level to be used. Any other value's string " "representation is used, so ``/foo/bar/baz.py`` with an *optimization* of " -"``2`` will lead to the bytecode path of ``/foo/bar/__pycache__/baz." -"cpython-32.opt-2.pyc``. The string representation of *optimization* can only " -"be alphanumeric, else :exc:`ValueError` is raised." +"``2`` will lead to the bytecode path of ``/foo/bar/__pycache__/" +"baz.cpython-32.opt-2.pyc``. The string representation of *optimization* can " +"only be alphanumeric, else :exc:`ValueError` is raised." msgstr "" -#: ../../library/importlib.rst:1323 +#: ../../library/importlib.rst:1339 msgid "" "The *debug_override* parameter is deprecated and can be used to override the " "system's value for ``__debug__``. A ``True`` value is the equivalent of " @@ -1587,60 +1598,63 @@ msgid "" "are not ``None`` then :exc:`TypeError` is raised." msgstr "" -#: ../../library/importlib.rst:1331 +#: ../../library/importlib.rst:1347 msgid "" "The *optimization* parameter was added and the *debug_override* parameter " "was deprecated." msgstr "" -#: ../../library/importlib.rst:1335 ../../library/importlib.rst:1351 -#: ../../library/importlib.rst:1440 +#: ../../library/importlib.rst:1351 ../../library/importlib.rst:1367 +#: ../../library/importlib.rst:1456 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/importlib.rst:1341 +#: ../../library/importlib.rst:1357 msgid "" "Given the *path* to a :pep:`3147` file name, return the associated source " -"code file path. For example, if *path* is ``/foo/bar/__pycache__/baz." -"cpython-32.pyc`` the returned path would be ``/foo/bar/baz.py``. *path* " +"code file path. For example, if *path* is ``/foo/bar/__pycache__/" +"baz.cpython-32.pyc`` the returned path would be ``/foo/bar/baz.py``. *path* " "need not exist, however if it does not conform to :pep:`3147` or :pep:`488` " -"format, a :exc:`ValueError` is raised. If :attr:`sys.implementation." -"cache_tag` is not defined, :exc:`NotImplementedError` is raised." +"format, a :exc:`ValueError` is raised. " +"If :attr:`sys.implementation.cache_tag` is not " +"defined, :exc:`NotImplementedError` is raised." msgstr "" -#: ../../library/importlib.rst:1356 +#: ../../library/importlib.rst:1372 msgid "" "Decode the given bytes representing source code and return it as a string " -"with universal newlines (as required by :meth:`importlib.abc.InspectLoader." -"get_source`)." +"with universal newlines (as required " +"by :meth:`importlib.abc.InspectLoader.get_source`)." msgstr "" -#: ../../library/importlib.rst:1364 +#: ../../library/importlib.rst:1380 msgid "Resolve a relative module name to an absolute one." msgstr "" -#: ../../library/importlib.rst:1366 +#: ../../library/importlib.rst:1382 msgid "" "If **name** has no leading dots, then **name** is simply returned. This " -"allows for usage such as ``importlib.util.resolve_name('sys', __spec__." -"parent)`` without doing a check to see if the **package** argument is needed." +"allows for usage such as ``importlib.util.resolve_name('sys', " +"__spec__.parent)`` without doing a check to see if the **package** argument " +"is needed." msgstr "" -#: ../../library/importlib.rst:1371 +#: ../../library/importlib.rst:1387 msgid "" ":exc:`ImportError` is raised if **name** is a relative module name but " -"**package** is a false value (e.g. ``None`` or the empty string). :exc:" -"`ImportError` is also raised if a relative name would escape its containing " -"package (e.g. requesting ``..bacon`` from within the ``spam`` package)." +"**package** is a false value (e.g. ``None`` or the empty " +"string). :exc:`ImportError` is also raised if a relative name would escape " +"its containing package (e.g. requesting ``..bacon`` from within the ``spam`` " +"package)." msgstr "" -#: ../../library/importlib.rst:1379 +#: ../../library/importlib.rst:1395 msgid "" "To improve consistency with import statements, raise :exc:`ImportError` " "instead of :exc:`ValueError` for invalid relative import attempts." msgstr "" -#: ../../library/importlib.rst:1386 +#: ../../library/importlib.rst:1402 msgid "" "Find the :term:`spec ` for a module, optionally relative to the " "specified **package** name. If the module is in :data:`sys.modules`, then " @@ -1650,30 +1664,30 @@ msgid "" "if no spec is found." msgstr "" -#: ../../library/importlib.rst:1393 +#: ../../library/importlib.rst:1409 msgid "" "If **name** is for a submodule (contains a dot), the parent module is " "automatically imported." msgstr "" -#: ../../library/importlib.rst:1396 +#: ../../library/importlib.rst:1412 msgid "**name** and **package** work the same as for :func:`import_module`." msgstr "" -#: ../../library/importlib.rst:1400 +#: ../../library/importlib.rst:1416 msgid "" "Raises :exc:`ModuleNotFoundError` instead of :exc:`AttributeError` if " "**package** is in fact not a package (i.e. lacks a :attr:`~module.__path__` " "attribute)." msgstr "" -#: ../../library/importlib.rst:1407 +#: ../../library/importlib.rst:1423 msgid "" "Create a new module based on **spec** and :meth:`spec.loader.create_module " "`." msgstr "" -#: ../../library/importlib.rst:1410 +#: ../../library/importlib.rst:1426 msgid "" "If :meth:`spec.loader.create_module ` " "does not return ``None``, then any pre-existing attributes will not be " @@ -1681,23 +1695,23 @@ msgid "" "accessing **spec** or setting an attribute on the module." msgstr "" -#: ../../library/importlib.rst:1415 +#: ../../library/importlib.rst:1431 msgid "" "This function is preferred over using :class:`types.ModuleType` to create a " "new module as **spec** is used to set as many import-controlled attributes " "on the module as possible." msgstr "" -#: ../../library/importlib.rst:1423 +#: ../../library/importlib.rst:1439 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on a loader. The parameters have the same meaning as they do " -"for ModuleSpec. The function uses available :term:`loader` APIs, such as :" -"meth:`InspectLoader.is_package`, to fill in any missing information on the " -"spec." +"for ModuleSpec. The function uses available :term:`loader` APIs, such " +"as :meth:`InspectLoader.is_package`, to fill in any missing information on " +"the spec." msgstr "" -#: ../../library/importlib.rst:1433 +#: ../../library/importlib.rst:1449 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on the path to a file. Missing information will be filled in " @@ -1705,14 +1719,14 @@ msgid "" "module will be file-based." msgstr "" -#: ../../library/importlib.rst:1445 +#: ../../library/importlib.rst:1461 msgid "" "Return the hash of *source_bytes* as bytes. A hash-based ``.pyc`` file " "embeds the :func:`source_hash` of the corresponding source file's contents " "in its header." msgstr "" -#: ../../library/importlib.rst:1453 +#: ../../library/importlib.rst:1469 msgid "" "A context manager that can temporarily skip the compatibility check for " "extension modules. By default the check is enabled and will fail when a " @@ -1721,46 +1735,49 @@ msgid "" "interpreter GIL, when imported in an interpreter with its own GIL." msgstr "" -#: ../../library/importlib.rst:1460 +#: ../../library/importlib.rst:1476 msgid "" "Note that this function is meant to accommodate an unusual case; one which " "is likely to eventually go away. There's is a pretty good chance this is " "not what you were looking for." msgstr "" -#: ../../library/importlib.rst:1464 +#: ../../library/importlib.rst:1480 msgid "" "You can get the same effect as this function by implementing the basic " "interface of multi-phase init (:pep:`489`) and lying about support for " "multiple interpreters (or per-interpreter GIL)." msgstr "" +"你可以透過實作多階段初始化的基本介面 (:pep:`489`) 並假稱有多個直譯器(或直譯" +"器各別持有的 GIL)的支援,來達到與此函式相同的效果。" -#: ../../library/importlib.rst:1469 +#: ../../library/importlib.rst:1485 msgid "" "Using this function to disable the check can lead to unexpected behavior and " "even crashes. It should only be used during extension module development." msgstr "" -#: ../../library/importlib.rst:1477 +#: ../../library/importlib.rst:1493 msgid "" "A class which postpones the execution of the loader of a module until the " "module has an attribute accessed." msgstr "" -#: ../../library/importlib.rst:1480 +#: ../../library/importlib.rst:1496 msgid "" -"This class **only** works with loaders that define :meth:`~importlib.abc." -"Loader.exec_module` as control over what module type is used for the module " -"is required. For those same reasons, the loader's :meth:`~importlib.abc." -"Loader.create_module` method must return ``None`` or a type for which its " -"``__class__`` attribute can be mutated along with not using :term:`slots " -"<__slots__>`. Finally, modules which substitute the object placed into :data:" -"`sys.modules` will not work as there is no way to properly replace the " -"module references throughout the interpreter safely; :exc:`ValueError` is " -"raised if such a substitution is detected." +"This class **only** works with loaders that " +"define :meth:`~importlib.abc.Loader.exec_module` as control over what module " +"type is used for the module is required. For those same reasons, the " +"loader's :meth:`~importlib.abc.Loader.create_module` method must return " +"``None`` or a type for which its ``__class__`` attribute can be mutated " +"along with not using :term:`slots <__slots__>`. Finally, modules which " +"substitute the object placed into :data:`sys.modules` will not work as there " +"is no way to properly replace the module references throughout the " +"interpreter safely; :exc:`ValueError` is raised if such a substitution is " +"detected." msgstr "" -#: ../../library/importlib.rst:1491 +#: ../../library/importlib.rst:1507 msgid "" "For projects where startup time is critical, this class allows for " "potentially minimizing the cost of loading a module if it is never used. For " @@ -1769,21 +1786,21 @@ msgid "" "postponed and thus occurring out of context." msgstr "" -#: ../../library/importlib.rst:1499 +#: ../../library/importlib.rst:1515 msgid "" "Began calling :meth:`~importlib.abc.Loader.create_module`, removing the " -"compatibility warning for :class:`importlib.machinery.BuiltinImporter` and :" -"class:`importlib.machinery.ExtensionFileLoader`." +"compatibility warning for :class:`importlib.machinery.BuiltinImporter` " +"and :class:`importlib.machinery.ExtensionFileLoader`." msgstr "" -#: ../../library/importlib.rst:1506 +#: ../../library/importlib.rst:1522 msgid "" "A class method which returns a callable that creates a lazy loader. This is " "meant to be used in situations where the loader is passed by class instead " "of by instance. ::" msgstr "" -#: ../../library/importlib.rst:1511 +#: ../../library/importlib.rst:1527 msgid "" "suffixes = importlib.machinery.SOURCE_SUFFIXES\n" "loader = importlib.machinery.SourceFileLoader\n" @@ -1795,20 +1812,20 @@ msgstr "" "lazy_loader = importlib.util.LazyLoader.factory(loader)\n" "finder = importlib.machinery.FileFinder(path, (lazy_loader, suffixes))" -#: ../../library/importlib.rst:1519 +#: ../../library/importlib.rst:1535 msgid "Examples" msgstr "範例" -#: ../../library/importlib.rst:1522 +#: ../../library/importlib.rst:1538 msgid "Importing programmatically" msgstr "" -#: ../../library/importlib.rst:1524 +#: ../../library/importlib.rst:1540 msgid "" "To programmatically import a module, use :func:`importlib.import_module`. ::" msgstr "" -#: ../../library/importlib.rst:1527 +#: ../../library/importlib.rst:1543 msgid "" "import importlib\n" "\n" @@ -1818,23 +1835,23 @@ msgstr "" "\n" "itertools = importlib.import_module('itertools')" -#: ../../library/importlib.rst:1533 +#: ../../library/importlib.rst:1549 msgid "Checking if a module can be imported" msgstr "" -#: ../../library/importlib.rst:1535 +#: ../../library/importlib.rst:1551 msgid "" "If you need to find out if a module can be imported without actually doing " "the import, then you should use :func:`importlib.util.find_spec`." msgstr "" -#: ../../library/importlib.rst:1538 +#: ../../library/importlib.rst:1554 msgid "" -"Note that if ``name`` is a submodule (contains a dot), :func:`importlib.util." -"find_spec` will import the parent module. ::" +"Note that if ``name`` is a submodule (contains a " +"dot), :func:`importlib.util.find_spec` will import the parent module. ::" msgstr "" -#: ../../library/importlib.rst:1542 +#: ../../library/importlib.rst:1558 msgid "" "import importlib.util\n" "import sys\n" @@ -1854,27 +1871,27 @@ msgid "" " print(f\"can't find the {name!r} module\")" msgstr "" -#: ../../library/importlib.rst:1561 +#: ../../library/importlib.rst:1577 msgid "Importing a source file directly" msgstr "" -#: ../../library/importlib.rst:1563 +#: ../../library/importlib.rst:1579 msgid "" "This recipe should be used with caution: it is an approximation of an import " -"statement where the file path is specified directly, rather than :data:`sys." -"path` being searched. Alternatives should first be considered first, such as " -"modifying :data:`sys.path` when a proper module is required, or using :func:" -"`runpy.run_path` when the global namespace resulting from running a Python " -"file is appropriate." +"statement where the file path is specified directly, rather " +"than :data:`sys.path` being searched. Alternatives should first be " +"considered first, such as modifying :data:`sys.path` when a proper module is " +"required, or using :func:`runpy.run_path` when the global namespace " +"resulting from running a Python file is appropriate." msgstr "" -#: ../../library/importlib.rst:1570 +#: ../../library/importlib.rst:1586 msgid "" "To import a Python source file directly from a path, use the following " "recipe::" msgstr "" -#: ../../library/importlib.rst:1572 +#: ../../library/importlib.rst:1588 msgid "" "import importlib.util\n" "import sys\n" @@ -1897,15 +1914,15 @@ msgid "" "json = import_from_path(module_name, file_path)" msgstr "" -#: ../../library/importlib.rst:1594 +#: ../../library/importlib.rst:1610 msgid "Implementing lazy imports" msgstr "" -#: ../../library/importlib.rst:1596 +#: ../../library/importlib.rst:1612 msgid "The example below shows how to implement lazy imports::" msgstr "" -#: ../../library/importlib.rst:1598 +#: ../../library/importlib.rst:1614 msgid "" ">>> import importlib.util\n" ">>> import sys\n" @@ -1925,25 +1942,26 @@ msgid "" "False" msgstr "" -#: ../../library/importlib.rst:1617 +#: ../../library/importlib.rst:1633 msgid "Setting up an importer" msgstr "" -#: ../../library/importlib.rst:1619 +#: ../../library/importlib.rst:1635 msgid "" -"For deep customizations of import, you typically want to implement an :term:" -"`importer`. This means managing both the :term:`finder` and :term:`loader` " -"side of things. For finders there are two flavours to choose from depending " -"on your needs: a :term:`meta path finder` or a :term:`path entry finder`. " -"The former is what you would put on :data:`sys.meta_path` while the latter " -"is what you create using a :term:`path entry hook` on :data:`sys.path_hooks` " -"which works with :data:`sys.path` entries to potentially create a finder. " -"This example will show you how to register your own importers so that import " -"will use them (for creating an importer for yourself, read the documentation " -"for the appropriate classes defined within this package)::" +"For deep customizations of import, you typically want to implement " +"an :term:`importer`. This means managing both the :term:`finder` " +"and :term:`loader` side of things. For finders there are two flavours to " +"choose from depending on your needs: a :term:`meta path finder` or " +"a :term:`path entry finder`. The former is what you would put " +"on :data:`sys.meta_path` while the latter is what you create using " +"a :term:`path entry hook` on :data:`sys.path_hooks` which works " +"with :data:`sys.path` entries to potentially create a finder. This example " +"will show you how to register your own importers so that import will use " +"them (for creating an importer for yourself, read the documentation for the " +"appropriate classes defined within this package)::" msgstr "" -#: ../../library/importlib.rst:1630 +#: ../../library/importlib.rst:1646 msgid "" "import importlib.machinery\n" "import sys\n" @@ -1967,11 +1985,11 @@ msgid "" "sys.path_hooks.append(SpamPathEntryFinder.path_hook(loader_details))" msgstr "" -#: ../../library/importlib.rst:1651 +#: ../../library/importlib.rst:1667 msgid "Approximating :func:`importlib.import_module`" msgstr "" -#: ../../library/importlib.rst:1653 +#: ../../library/importlib.rst:1669 msgid "" "Import itself is implemented in Python code, making it possible to expose " "most of the import machinery through importlib. The following helps " @@ -1979,7 +1997,7 @@ msgid "" "approximate implementation of :func:`importlib.import_module`::" msgstr "" -#: ../../library/importlib.rst:1659 +#: ../../library/importlib.rst:1675 msgid "" "import importlib.util\n" "import sys\n" @@ -2012,11 +2030,11 @@ msgid "" " return module" msgstr "" -#: ../../library/importlib.rst:424 +#: ../../library/importlib.rst:425 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/importlib.rst:424 +#: ../../library/importlib.rst:425 msgid "importlib.abc.InspectLoader.get_source method" msgstr "importlib.abc.InspectLoader.get_source 方法" diff --git a/library/importlib.resources.abc.po b/library/importlib.resources.abc.po index f000c0ec12..0f8fe4133b 100644 --- a/library/importlib.resources.abc.po +++ b/library/importlib.resources.abc.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -69,33 +69,33 @@ msgstr "" msgid "Use :class:`importlib.resources.abc.TraversableResources` instead." msgstr "" -#: ../../library/importlib.resources.abc.rst:51 +#: ../../library/importlib.resources.abc.rst:52 msgid "" "Returns an opened, :term:`file-like object` for binary reading of the " "*resource*." msgstr "" -#: ../../library/importlib.resources.abc.rst:54 +#: ../../library/importlib.resources.abc.rst:55 msgid "If the resource cannot be found, :exc:`FileNotFoundError` is raised." msgstr "" -#: ../../library/importlib.resources.abc.rst:59 +#: ../../library/importlib.resources.abc.rst:61 msgid "Returns the file system path to the *resource*." msgstr "" -#: ../../library/importlib.resources.abc.rst:61 +#: ../../library/importlib.resources.abc.rst:63 msgid "" "If the resource does not concretely exist on the file system, raise :exc:" "`FileNotFoundError`." msgstr "" -#: ../../library/importlib.resources.abc.rst:66 +#: ../../library/importlib.resources.abc.rst:69 msgid "" "Returns ``True`` if the named *name* is considered a resource. :exc:" "`FileNotFoundError` is raised if *name* does not exist." msgstr "" -#: ../../library/importlib.resources.abc.rst:71 +#: ../../library/importlib.resources.abc.rst:75 msgid "" "Returns an :term:`iterable` of strings over the contents of the package. Do " "note that it is not required that all names returned by the iterator be " @@ -103,7 +103,7 @@ msgid "" "`is_resource` would be false." msgstr "" -#: ../../library/importlib.resources.abc.rst:77 +#: ../../library/importlib.resources.abc.rst:81 msgid "" "Allowing non-resource names to be returned is to allow for situations where " "how a package and its resources are stored are known a priori and the non-" @@ -112,52 +112,52 @@ msgid "" "stored on the file system then those subdirectory names can be used directly." msgstr "" -#: ../../library/importlib.resources.abc.rst:85 +#: ../../library/importlib.resources.abc.rst:89 msgid "The abstract method returns an iterable of no items." msgstr "" -#: ../../library/importlib.resources.abc.rst:90 +#: ../../library/importlib.resources.abc.rst:94 msgid "" "An object with a subset of :class:`pathlib.Path` methods suitable for " "traversing directories and opening files." msgstr "" -#: ../../library/importlib.resources.abc.rst:93 +#: ../../library/importlib.resources.abc.rst:97 msgid "" "For a representation of the object on the file-system, use :meth:`importlib." "resources.as_file`." msgstr "" -#: ../../library/importlib.resources.abc.rst:98 +#: ../../library/importlib.resources.abc.rst:102 msgid "Abstract. The base name of this object without any parent references." msgstr "" -#: ../../library/importlib.resources.abc.rst:102 +#: ../../library/importlib.resources.abc.rst:107 msgid "Yield Traversable objects in self." msgstr "" -#: ../../library/importlib.resources.abc.rst:106 +#: ../../library/importlib.resources.abc.rst:112 msgid "Return ``True`` if self is a directory." msgstr "" -#: ../../library/importlib.resources.abc.rst:110 +#: ../../library/importlib.resources.abc.rst:117 msgid "Return ``True`` if self is a file." msgstr "" -#: ../../library/importlib.resources.abc.rst:114 +#: ../../library/importlib.resources.abc.rst:122 msgid "" "Traverse directories according to *pathsegments* and return the result as :" "class:`!Traversable`." msgstr "" -#: ../../library/importlib.resources.abc.rst:117 +#: ../../library/importlib.resources.abc.rst:125 msgid "" "Each *pathsegments* argument may contain multiple names separated by forward " "slashes (``/``, ``posixpath.sep`` ). For example, the following are " "equivalent::" msgstr "" -#: ../../library/importlib.resources.abc.rst:121 +#: ../../library/importlib.resources.abc.rst:129 msgid "" "files.joinpath('subdir', 'subsuddir', 'file.txt')\n" "files.joinpath('subdir/subsuddir/file.txt')" @@ -165,7 +165,7 @@ msgstr "" "files.joinpath('subdir', 'subsuddir', 'file.txt')\n" "files.joinpath('subdir/subsuddir/file.txt')" -#: ../../library/importlib.resources.abc.rst:124 +#: ../../library/importlib.resources.abc.rst:132 msgid "" "Note that some :class:`!Traversable` implementations might not be updated to " "the latest version of the protocol. For compatibility with such " @@ -173,42 +173,42 @@ msgid "" "call to ``joinpath``. For example::" msgstr "" -#: ../../library/importlib.resources.abc.rst:129 +#: ../../library/importlib.resources.abc.rst:137 msgid "files.joinpath('subdir').joinpath('subsubdir').joinpath('file.txt')" msgstr "files.joinpath('subdir').joinpath('subsubdir').joinpath('file.txt')" -#: ../../library/importlib.resources.abc.rst:133 +#: ../../library/importlib.resources.abc.rst:141 msgid "" "``joinpath`` accepts multiple *pathsegments*, and these segments may contain " "forward slashes as path separators. Previously, only a single *child* " "argument was accepted." msgstr "" -#: ../../library/importlib.resources.abc.rst:139 +#: ../../library/importlib.resources.abc.rst:148 msgid "Return Traversable child in self. Equivalent to ``joinpath(child)``." msgstr "" -#: ../../library/importlib.resources.abc.rst:144 +#: ../../library/importlib.resources.abc.rst:154 msgid "" "*mode* may be 'r' or 'rb' to open as text or binary. Return a handle " "suitable for reading (same as :attr:`pathlib.Path.open`)." msgstr "" -#: ../../library/importlib.resources.abc.rst:147 +#: ../../library/importlib.resources.abc.rst:157 msgid "" "When opening as text, accepts encoding parameters such as those accepted by :" "class:`io.TextIOWrapper`." msgstr "" -#: ../../library/importlib.resources.abc.rst:152 +#: ../../library/importlib.resources.abc.rst:162 msgid "Read contents of self as bytes." msgstr "" -#: ../../library/importlib.resources.abc.rst:156 +#: ../../library/importlib.resources.abc.rst:166 msgid "Read contents of self as text." msgstr "" -#: ../../library/importlib.resources.abc.rst:161 +#: ../../library/importlib.resources.abc.rst:171 msgid "" "An abstract base class for resource readers capable of serving the :meth:" "`importlib.resources.files` interface. Subclasses :class:`ResourceReader` " @@ -217,13 +217,13 @@ msgid "" "TraversableResources` also supplies :class:`!ResourceReader`." msgstr "" -#: ../../library/importlib.resources.abc.rst:168 +#: ../../library/importlib.resources.abc.rst:178 msgid "" "Loaders that wish to support resource reading are expected to implement this " "interface." msgstr "" -#: ../../library/importlib.resources.abc.rst:173 +#: ../../library/importlib.resources.abc.rst:184 msgid "" "Returns a :class:`importlib.resources.abc.Traversable` object for the loaded " "package." diff --git a/library/io.po b/library/io.po index 15f657ad1c..d248520927 100644 --- a/library/io.po +++ b/library/io.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-05-04 00:16+0000\n" "PO-Revision-Date: 2023-12-08 00:08+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -77,7 +77,7 @@ msgstr "" "原本會引發 :exc:`IOError` 的操作,現在將改成引發 :exc:`OSError`。因為 :exc:" "`IOError` 現在是 :exc:`OSError` 的別名。" -#: ../../library/io.rst:51 ../../library/io.rst:855 ../../library/io.rst:1149 +#: ../../library/io.rst:51 ../../library/io.rst:855 ../../library/io.rst:1150 msgid "Text I/O" msgstr "文字 I/O" @@ -118,7 +118,7 @@ msgid "" "`TextIOBase`." msgstr "文字資料串流 API 的詳細說明在 :class:`TextIOBase` 文件當中。" -#: ../../library/io.rst:72 ../../library/io.rst:1137 +#: ../../library/io.rst:72 ../../library/io.rst:1138 msgid "Binary I/O" msgstr "二進位 (Binary) I/O" @@ -1552,12 +1552,13 @@ msgstr "" #: ../../library/io.rst:952 msgid "" "*encoding* gives the name of the encoding that the stream will be decoded or " -"encoded with. It defaults to :func:`locale.getencoding`. " +"encoded with. In :ref:`UTF-8 Mode `, this defaults to UTF-8. " +"Otherwise, it defaults to :func:`locale.getencoding`. " "``encoding=\"locale\"`` can be used to specify the current locale's encoding " "explicitly. See :ref:`io-text-encoding` for more information." msgstr "" -#: ../../library/io.rst:957 +#: ../../library/io.rst:958 msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled. Pass ``'strict'`` to raise a :exc:`ValueError` " @@ -1572,13 +1573,13 @@ msgid "" "that has been registered with :func:`codecs.register_error` is also valid." msgstr "" -#: ../../library/io.rst:973 +#: ../../library/io.rst:974 msgid "" "*newline* controls how line endings are handled. It can be ``None``, " "``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as follows:" msgstr "" -#: ../../library/io.rst:976 +#: ../../library/io.rst:977 msgid "" "When reading input from the stream, if *newline* is ``None``, :term:" "`universal newlines` mode is enabled. Lines in the input can end in " @@ -1590,7 +1591,7 @@ msgid "" "returned to the caller untranslated." msgstr "" -#: ../../library/io.rst:985 +#: ../../library/io.rst:986 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -1599,13 +1600,13 @@ msgid "" "characters written are translated to the given string." msgstr "" -#: ../../library/io.rst:991 +#: ../../library/io.rst:992 msgid "" "If *line_buffering* is ``True``, :meth:`~IOBase.flush` is implied when a " "call to write contains a newline character or a carriage return." msgstr "" -#: ../../library/io.rst:994 +#: ../../library/io.rst:995 msgid "" "If *write_through* is ``True``, calls to :meth:`~BufferedIOBase.write` are " "guaranteed not to be buffered: any data written on the :class:" @@ -1613,11 +1614,11 @@ msgid "" "*buffer*." msgstr "" -#: ../../library/io.rst:998 +#: ../../library/io.rst:999 msgid "The *write_through* argument has been added." msgstr "" -#: ../../library/io.rst:1001 +#: ../../library/io.rst:1002 msgid "" "The default *encoding* is now ``locale.getpreferredencoding(False)`` instead " "of ``locale.getpreferredencoding()``. Don't change temporary the locale " @@ -1625,108 +1626,108 @@ msgid "" "instead of the user preferred encoding." msgstr "" -#: ../../library/io.rst:1007 +#: ../../library/io.rst:1008 msgid "" "The *encoding* argument now supports the ``\"locale\"`` dummy encoding name." msgstr "" -#: ../../library/io.rst:1010 +#: ../../library/io.rst:1011 msgid "" ":class:`TextIOWrapper` provides these data attributes and methods in " "addition to those from :class:`TextIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:1015 +#: ../../library/io.rst:1016 msgid "Whether line buffering is enabled." msgstr "" -#: ../../library/io.rst:1019 +#: ../../library/io.rst:1020 msgid "Whether writes are passed immediately to the underlying binary buffer." msgstr "" -#: ../../library/io.rst:1027 +#: ../../library/io.rst:1028 msgid "" "Reconfigure this text stream using new settings for *encoding*, *errors*, " "*newline*, *line_buffering* and *write_through*." msgstr "" -#: ../../library/io.rst:1030 +#: ../../library/io.rst:1031 msgid "" "Parameters not specified keep current settings, except ``errors='strict'`` " "is used when *encoding* is specified but *errors* is not specified." msgstr "" -#: ../../library/io.rst:1034 +#: ../../library/io.rst:1035 msgid "" "It is not possible to change the encoding or newline if some data has " "already been read from the stream. On the other hand, changing encoding " "after write is possible." msgstr "" -#: ../../library/io.rst:1038 +#: ../../library/io.rst:1039 msgid "" "This method does an implicit stream flush before setting the new parameters." msgstr "" -#: ../../library/io.rst:1043 +#: ../../library/io.rst:1044 msgid "The method supports ``encoding=\"locale\"`` option." msgstr "" -#: ../../library/io.rst:1048 +#: ../../library/io.rst:1049 msgid "" "Set the stream position. Return the new stream position as an :class:`int`." msgstr "" -#: ../../library/io.rst:1051 +#: ../../library/io.rst:1052 msgid "" "Four operations are supported, given by the following argument combinations:" msgstr "" -#: ../../library/io.rst:1054 +#: ../../library/io.rst:1055 msgid "``seek(0, SEEK_SET)``: Rewind to the start of the stream." msgstr "" -#: ../../library/io.rst:1055 +#: ../../library/io.rst:1056 msgid "" "``seek(cookie, SEEK_SET)``: Restore a previous position; *cookie* **must " "be** a number returned by :meth:`tell`." msgstr "" -#: ../../library/io.rst:1057 +#: ../../library/io.rst:1058 msgid "``seek(0, SEEK_END)``: Fast-forward to the end of the stream." msgstr "" -#: ../../library/io.rst:1058 +#: ../../library/io.rst:1059 msgid "``seek(0, SEEK_CUR)``: Leave the current stream position unchanged." msgstr "" -#: ../../library/io.rst:1060 +#: ../../library/io.rst:1061 msgid "Any other argument combinations are invalid, and may raise exceptions." msgstr "" -#: ../../library/io.rst:1065 +#: ../../library/io.rst:1066 msgid ":data:`os.SEEK_SET`, :data:`os.SEEK_CUR`, and :data:`os.SEEK_END`." msgstr "" -#: ../../library/io.rst:1069 +#: ../../library/io.rst:1070 msgid "" "Return the stream position as an opaque number. The return value of :meth:`!" "tell` can be given as input to :meth:`seek`, to restore a previous stream " "position." msgstr "" -#: ../../library/io.rst:1076 +#: ../../library/io.rst:1077 msgid "" "A text stream using an in-memory text buffer. It inherits from :class:" "`TextIOBase`." msgstr "" -#: ../../library/io.rst:1079 +#: ../../library/io.rst:1080 msgid "" "The text buffer is discarded when the :meth:`~IOBase.close` method is called." msgstr "" -#: ../../library/io.rst:1082 +#: ../../library/io.rst:1083 msgid "" "The initial value of the buffer can be set by providing *initial_value*. If " "newline translation is enabled, newlines will be encoded as if by :meth:" @@ -1738,31 +1739,31 @@ msgid "" "at the end of the buffer." msgstr "" -#: ../../library/io.rst:1091 +#: ../../library/io.rst:1092 msgid "" "The *newline* argument works like that of :class:`TextIOWrapper`, except " "that when writing output to the stream, if *newline* is ``None``, newlines " "are written as ``\\n`` on all platforms." msgstr "" -#: ../../library/io.rst:1095 +#: ../../library/io.rst:1096 msgid "" ":class:`StringIO` provides this method in addition to those from :class:" "`TextIOBase` and :class:`IOBase`:" msgstr "" -#: ../../library/io.rst:1100 +#: ../../library/io.rst:1101 msgid "" "Return a :class:`str` containing the entire contents of the buffer. Newlines " "are decoded as if by :meth:`~TextIOBase.read`, although the stream position " "is not changed." msgstr "" -#: ../../library/io.rst:1104 +#: ../../library/io.rst:1105 msgid "Example usage::" msgstr "使用範例: ::" -#: ../../library/io.rst:1106 +#: ../../library/io.rst:1107 msgid "" "import io\n" "\n" @@ -1779,23 +1780,23 @@ msgid "" "output.close()" msgstr "" -#: ../../library/io.rst:1126 +#: ../../library/io.rst:1127 msgid "" "A helper codec that decodes newlines for :term:`universal newlines` mode. It " "inherits from :class:`codecs.IncrementalDecoder`." msgstr "" -#: ../../library/io.rst:1131 +#: ../../library/io.rst:1132 msgid "Performance" msgstr "" -#: ../../library/io.rst:1133 +#: ../../library/io.rst:1134 msgid "" "This section discusses the performance of the provided concrete I/O " "implementations." msgstr "" -#: ../../library/io.rst:1139 +#: ../../library/io.rst:1140 msgid "" "By reading and writing only large chunks of data even when the user asks for " "a single byte, buffered I/O hides any inefficiency in calling and executing " @@ -1808,7 +1809,7 @@ msgid "" "data." msgstr "" -#: ../../library/io.rst:1151 +#: ../../library/io.rst:1152 msgid "" "Text I/O over a binary storage (such as a file) is significantly slower than " "binary I/O over the same storage, because it requires conversions between " @@ -1818,24 +1819,24 @@ msgid "" "the reconstruction algorithm used." msgstr "" -#: ../../library/io.rst:1158 +#: ../../library/io.rst:1159 msgid "" ":class:`StringIO`, however, is a native in-memory unicode container and will " "exhibit similar speed to :class:`BytesIO`." msgstr "" -#: ../../library/io.rst:1162 +#: ../../library/io.rst:1163 msgid "Multi-threading" msgstr "" -#: ../../library/io.rst:1164 +#: ../../library/io.rst:1165 msgid "" ":class:`FileIO` objects are thread-safe to the extent that the operating " "system calls (such as :manpage:`read(2)` under Unix) they wrap are thread-" "safe too." msgstr "" -#: ../../library/io.rst:1167 +#: ../../library/io.rst:1168 msgid "" "Binary buffered objects (instances of :class:`BufferedReader`, :class:" "`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`) " @@ -1843,15 +1844,15 @@ msgid "" "them from multiple threads at once." msgstr "" -#: ../../library/io.rst:1172 +#: ../../library/io.rst:1173 msgid ":class:`TextIOWrapper` objects are not thread-safe." msgstr "" -#: ../../library/io.rst:1175 +#: ../../library/io.rst:1176 msgid "Reentrancy" msgstr "" -#: ../../library/io.rst:1177 +#: ../../library/io.rst:1178 msgid "" "Binary buffered objects (instances of :class:`BufferedReader`, :class:" "`BufferedWriter`, :class:`BufferedRandom` and :class:`BufferedRWPair`) are " @@ -1862,7 +1863,7 @@ msgid "" "from entering the buffered object." msgstr "" -#: ../../library/io.rst:1185 +#: ../../library/io.rst:1186 msgid "" "The above implicitly extends to text files, since the :func:`open` function " "will wrap a buffered object inside a :class:`TextIOWrapper`. This includes " @@ -1878,31 +1879,14 @@ msgstr "file object(檔案物件)" msgid "io module" msgstr "io 模組" -#: ../../library/io.rst:970 ../../library/io.rst:1121 +#: ../../library/io.rst:971 ../../library/io.rst:1122 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/io.rst:970 +#: ../../library/io.rst:971 msgid "io.TextIOWrapper class" msgstr "io.TextIOWrapper 類別" -#: ../../library/io.rst:1121 +#: ../../library/io.rst:1122 msgid "io.IncrementalNewlineDecoder class" msgstr "io.IncrementalNewlineDecoder 類別" - -#, fuzzy -#~ msgid "" -#~ "This function raises an auditing event open with arguments path, mode and " -#~ "flags. The mode and flags arguments may have been modified or inferred " -#~ "from the original call." -#~ msgstr "" -#~ "此函式會引發一個帶有引數 *path*、*mode* 以及 *flags* 的\\ :ref:`稽核事件 " -#~ "(auditing event) ` ``open``。*mode* 與 *flags* 引數可能已經被修" -#~ "改或者從原始呼叫中被推斷出來。" - -#~ msgid "" -#~ "Raises an :ref:`auditing event ` ``open`` with arguments " -#~ "``path``, ``mode``, ``flags``." -#~ msgstr "" -#~ "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " -#~ "` ``open``。" diff --git a/library/itertools.po b/library/itertools.po index ee5d1f4e0f..5e949d15db 100644 --- a/library/itertools.po +++ b/library/itertools.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-07 15:02+0800\n" +"POT-Creation-Date: 2025-04-19 00:14+0000\n" "PO-Revision-Date: 2024-08-16 15:01+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -488,10 +488,10 @@ msgid "" "www.ramseysolutions.com/real-estate/amortization-schedule>`_, accumulate the " "interest and apply payments:" msgstr "" -"*function* 引數可以被設定為 :func:`min` 以得到連續的最小值,設定" -"為 :func:`max` 以得到連續的最大值,或者設定為 :func:`operator.mul` 以得到連續" -"的乘積。也可以透過累積利息和付款來建立\\ `攤銷表 (Amortization tables) " -"`_ :" +"*function* 引數可以被設定為 :func:`min` 以得到連續的最小值,設定為 :func:" +"`max` 以得到連續的最大值,或者設定為 :func:`operator.mul` 以得到連續的乘積。" +"也可以透過累積利息和付款來建立\\ `攤銷表 (Amortization tables) `_ :" #: ../../library/itertools.rst:136 msgid "" @@ -630,9 +630,9 @@ msgstr "從輸入 *iterable* 中回傳長度為 *r* 的元素的子序列。" #: ../../library/itertools.rst:227 msgid "" "The output is a subsequence of :func:`product` keeping only entries that are " -"subsequences of the *iterable*. The length of the output is given " -"by :func:`math.comb` which computes ``n! / r! / (n - r)!`` when ``0 ≤ r ≤ " -"n`` or zero when ``r > n``." +"subsequences of the *iterable*. The length of the output is given by :func:" +"`math.comb` which computes ``n! / r! / (n - r)!`` when ``0 ≤ r ≤ n`` or zero " +"when ``r > n``." msgstr "" "輸出是 :func:`product` 的子序列,僅保留作為 *iterable* 子序列的條目。輸出的長" "度由 :func:`math.comb` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / r! / (n - r)!" @@ -758,8 +758,8 @@ msgstr "" #: ../../library/itertools.rst:323 msgid "" "Make an iterator that returns evenly spaced values beginning with *start*. " -"Can be used with :func:`map` to generate consecutive data points or " -"with :func:`zip` to add sequence numbers. Roughly equivalent to::" +"Can be used with :func:`map` to generate consecutive data points or with :" +"func:`zip` to add sequence numbers. Roughly equivalent to::" msgstr "" "建立一個疊代器,回傳從 *start* 開始的等差的值。可以與 :func:`map` 一起使用來" "產生連續的資料點,或與 :func:`zip` 一起使用來增加序列號。大致等價於: ::" @@ -939,9 +939,9 @@ msgstr "" #: ../../library/itertools.rst:420 msgid "" "The returned group is itself an iterator that shares the underlying iterable " -"with :func:`groupby`. Because the source is shared, when " -"the :func:`groupby` object is advanced, the previous group is no longer " -"visible. So, if that data is needed later, it should be stored as a list::" +"with :func:`groupby`. Because the source is shared, when the :func:" +"`groupby` object is advanced, the previous group is no longer visible. So, " +"if that data is needed later, it should be stored as a list::" msgstr "" "回傳的群組本身是一個與 :func:`groupby` 共享底層可疊代物件的疊代器。由於來源是" "共享的,當 :func:`groupby` 物件前進時,前一個群組將不再可見。因此,如果之後需" @@ -1146,11 +1146,11 @@ msgstr "" #: ../../library/itertools.rst:536 msgid "" -"Return successive *r* length `permutations of elements `_ from the *iterable*." +"Return successive *r* length `permutations of elements `_ from the *iterable*." msgstr "" -"回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 `_ 。" +"回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 `_ 。" #: ../../library/itertools.rst:539 msgid "" @@ -1163,13 +1163,13 @@ msgstr "" #: ../../library/itertools.rst:543 msgid "" "The output is a subsequence of :func:`product` where entries with repeated " -"elements have been filtered out. The length of the output is given " -"by :func:`math.perm` which computes ``n! / (n - r)!`` when ``0 ≤ r ≤ n`` or " -"zero when ``r > n``." +"elements have been filtered out. The length of the output is given by :func:" +"`math.perm` which computes ``n! / (n - r)!`` when ``0 ≤ r ≤ n`` or zero when " +"``r > n``." msgstr "" -"輸出是 :func:`product` 的子序列,其中重複元素的條目已被濾除。輸出的長度" -"由 :func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 " -"``r > n`` 時為零。" +"輸出是 :func:`product` 的子序列,其中重複元素的條目已被濾除。輸出的長度由 :" +"func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 ``r " +"> n`` 時為零。" #: ../../library/itertools.rst:548 msgid "" @@ -1432,15 +1432,14 @@ msgid "" "the input iterator and there is no way to access it. This could be an issue " "if an application wants to further consume the input iterator after " "*takewhile* has been run to exhaustion. To work around this problem, " -"consider using `more-itertools before_and_after() `_ instead." +"consider using `more-itertools before_and_after() `_ instead." msgstr "" "注意,第一個不符合條件判斷的元素將從輸入疊代器中被消耗,且無法再存取它。如果" "應用程式希望在 *takewhile* 耗盡後進一步消耗輸入疊代器,這可能會是個問題。為了" "解決這個問題,可以考慮使用 `more-itertools 中的 before_and_after() `_ 作為替代。" +"more-itertools.readthedocs.io/en/stable/api.html#more_itertools." +"before_and_after>`_ 作為替代。" #: ../../library/itertools.rst:691 msgid "Return *n* independent iterators from a single iterable." @@ -1486,9 +1485,9 @@ msgstr "" msgid "" "When the input *iterable* is already a tee iterator object, all members of " "the return tuple are constructed as if they had been produced by the " -"upstream :func:`tee` call. This \"flattening step\" allows " -"nested :func:`tee` calls to share the same underlying data chain and to have " -"a single update step rather than a chain of calls." +"upstream :func:`tee` call. This \"flattening step\" allows nested :func:" +"`tee` calls to share the same underlying data chain and to have a single " +"update step rather than a chain of calls." msgstr "" #: ../../library/itertools.rst:734 @@ -1522,19 +1521,19 @@ msgid "" "even if the original *iterable* is threadsafe." msgstr "" "``tee`` 疊代器不是執行緒安全 (threadsafe) 的。當同時使用由同一個 :func:`tee` " -"呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引" -"發 :exc:`RuntimeError`。" +"呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引發 :exc:" +"`RuntimeError`。" #: ../../library/itertools.rst:758 msgid "" "This itertool may require significant auxiliary storage (depending on how " "much temporary data needs to be stored). In general, if one iterator uses " -"most or all of the data before another iterator starts, it is faster to " -"use :func:`list` instead of :func:`tee`." +"most or all of the data before another iterator starts, it is faster to use :" +"func:`list` instead of :func:`tee`." msgstr "" "此 itertool 可能需要大量的輔助儲存空間(取決於需要儲存多少臨時資料)。通常如" -"果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使" -"用 :func:`list` 會比 :func:`tee` 更快。" +"果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使用 :func:" +"`list` 會比 :func:`tee` 更快。" #: ../../library/itertools.rst:766 msgid "Make an iterator that aggregates elements from each of the *iterables*." @@ -1600,9 +1599,9 @@ msgstr "" #: ../../library/itertools.rst:798 msgid "" -"If one of the iterables is potentially infinite, then " -"the :func:`zip_longest` function should be wrapped with something that " -"limits the number of calls (for example :func:`islice` or :func:`takewhile`)." +"If one of the iterables is potentially infinite, then the :func:" +"`zip_longest` function should be wrapped with something that limits the " +"number of calls (for example :func:`islice` or :func:`takewhile`)." msgstr "" "如果其中一個 iterables 可能是無限的,那麼應該用別的可以限制呼叫次數的方法來包" "裝 :func:`zip_longest` 函式(例如 :func:`islice` 或 :func:`takewhile`)。" @@ -1625,16 +1624,16 @@ msgid "" "``chain.from_iterable`` is related to the concept of flattening. The " "recipes also give ideas about ways that the tools can be combined — for " "example, how ``starmap()`` and ``repeat()`` can work together. The recipes " -"also show patterns for using itertools with the :mod:`operator` " -"and :mod:`collections` modules as well as with the built-in itertools such " -"as ``map()``, ``filter()``, ``reversed()``, and ``enumerate()``." +"also show patterns for using itertools with the :mod:`operator` and :mod:" +"`collections` modules as well as with the built-in itertools such as " +"``map()``, ``filter()``, ``reversed()``, and ``enumerate()``." msgstr "" "itertools 應用技巧的主要目的是教學。這些應用技巧展示了對單個工具進行思考的各" "種方式 —— 例如,``chain.from_iterable`` 與攤平 (flattening) 的概念相關。這些" "應用技巧還提供了組合使用工具的想法 —— 例如,``starmap()`` 和 ``repeat()`` 如" -"何一起工作。另外還展示了將 itertools 與 :mod:`operator` " -"和 :mod:`collections` 模組一同使用以及與內建 itertools(如 ``map()``、" -"``filter()``、``reversed()`` 和 ``enumerate()``)一同使用的模式。" +"何一起工作。另外還展示了將 itertools 與 :mod:`operator` 和 :mod:" +"`collections` 模組一同使用以及與內建 itertools(如 ``map()``、``filter()``、" +"``reversed()`` 和 ``enumerate()``)一同使用的模式。" #: ../../library/itertools.rst:820 msgid "" @@ -1653,8 +1652,8 @@ msgid "" "Substantially all of these recipes and many, many others can be installed " "from the :pypi:`more-itertools` project found on the Python Package Index::" msgstr "" -"幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上" -"的 :pypi:`more-itertools` 專案中安裝: ::" +"幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上的 :" +"pypi:`more-itertools` 專案中安裝: ::" #: ../../library/itertools.rst:829 msgid "python -m pip install more-itertools" @@ -1675,8 +1674,8 @@ msgstr "" "可疊代物件一次性引入記憶體,能保持優異的記憶體性能。以\\ `函式風格 " "(functional style) `_ 將工具連接在一起,能將程式碼的數量維持在較少的情況。透過優先使" -"用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和" -"\\ :term:`產生器 `,則能保持高速度。" +"用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和\\ :" +"term:`產生器 `,則能保持高速度。" #: ../../library/itertools.rst:839 msgid "" @@ -1857,6 +1856,12 @@ msgstr "以下的應用技巧具有更多的數學風格:" #: ../../library/itertools.rst:1010 msgid "" +"def multinomial(*counts):\n" +" \"Number of distinct arrangements of a multiset.\"\n" +" # Counter('abracadabra').values() → 5 2 2 1 1\n" +" # multinomial(5, 2, 2, 1, 1) → 83160\n" +" return prod(map(comb, accumulate(counts), counts))\n" +"\n" "def powerset(iterable):\n" " \"Subsequences of the iterable from shortest to longest.\"\n" " # powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)\n" @@ -1973,13 +1978,7 @@ msgid "" " # totient(12) → 4 because len([1, 5, 7, 11]) == 4\n" " for prime in set(factor(n)):\n" " n -= n // prime\n" -" return n\n" -"\n" -"def multinomial(*counts):\n" -" \"Number of distinct arrangements of a multiset.\"\n" -" # Counter('abracadabra').values() -> 5 2 1 1 2\n" -" # multinomial(5, 2, 1, 1, 2) → 83160\n" -" return prod(map(comb, accumulate(counts), counts))" +" return n" msgstr "" #~ msgid "" diff --git a/library/json.po b/library/json.po index 5c7cb4ed9f..485a9121cb 100644 --- a/library/json.po +++ b/library/json.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-09 00:13+0000\n" +"POT-Creation-Date: 2025-04-09 00:15+0000\n" "PO-Revision-Date: 2023-08-05 15:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -822,12 +822,13 @@ msgstr "" msgid "" "If *skipkeys* is false (the default), a :exc:`TypeError` will be raised when " "trying to encode keys that are " -"not :class:`str`, :class:`int`, :class:`float` or ``None``. If *skipkeys* " -"is true, such items are simply skipped." +"not :class:`str`, :class:`int`, :class:`float`, :class:`bool` or ``None``. " +"If *skipkeys* is true, such items are simply skipped." msgstr "" "若 *skipkeys* 為 false(預設值),則當在編碼不" -"是 :class:`str`、:class:`int`、:class:`float` 或 ``None`` 的鍵值時,將引" -"發 :exc:`TypeError`。如果 *skipkeys* 為 true,這些項目將直接被跳過。" +"是 :class:`str`、:class:`int`、:class:`float`、:class:`bool` 或 ``None`` 的鍵" +"值時,將引發 :exc:`TypeError`。如果 *skipkeys* 為 true,這些項目將直接被跳" +"過。" #: ../../library/json.rst:492 msgid "" diff --git a/library/language.po b/library/language.po index fd197d5ad7..faf9fb5c18 100644 --- a/library/language.po +++ b/library/language.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -28,6 +27,8 @@ msgid "" "language. These modules support tokenizing, parsing, syntax analysis, " "bytecode disassembly, and various other facilities." msgstr "" +"Python 提供了許多模組來協助處理 Python 語言。這些模組支援標記化、剖析、語法分" +"析、位元碼反組譯,以及其他各種設施。" #: ../../library/language.rst:11 msgid "These modules include:" diff --git a/library/logging.handlers.po b/library/logging.handlers.po index c735ab982e..e8b7682ec7 100644 --- a/library/logging.handlers.po +++ b/library/logging.handlers.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-04-14 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1608,36 +1608,41 @@ msgid "" "process." msgstr "" -#: ../../library/logging.handlers.rst:1177 +#: ../../library/logging.handlers.rst:1175 +msgid "" +"Raises :exc:`RuntimeError` if called and the listener is already running." +msgstr "" + +#: ../../library/logging.handlers.rst:1181 msgid "Stops the listener." msgstr "" -#: ../../library/logging.handlers.rst:1179 +#: ../../library/logging.handlers.rst:1183 msgid "" "This asks the thread to terminate, and then waits for it to do so. Note that " "if you don't call this before your application exits, there may be some " "records still left on the queue, which won't be processed." msgstr "" -#: ../../library/logging.handlers.rst:1185 +#: ../../library/logging.handlers.rst:1189 msgid "" "Writes a sentinel to the queue to tell the listener to quit. This " "implementation uses ``put_nowait()``. You may want to override this method " "if you want to use timeouts or work with custom queue implementations." msgstr "" -#: ../../library/logging.handlers.rst:1195 +#: ../../library/logging.handlers.rst:1199 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../library/logging.handlers.rst:1196 +#: ../../library/logging.handlers.rst:1200 msgid "API reference for the logging module." msgstr "" -#: ../../library/logging.handlers.rst:1198 +#: ../../library/logging.handlers.rst:1202 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../library/logging.handlers.rst:1199 +#: ../../library/logging.handlers.rst:1203 msgid "Configuration API for the logging module." msgstr "" diff --git a/library/logging.po b/library/logging.po index c11c77e048..b1f72fc580 100644 --- a/library/logging.po +++ b/library/logging.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-02-25 00:14+0000\n" "PO-Revision-Date: 2024-03-28 22:40+0800\n" "Last-Translator: RockLeon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -791,18 +791,20 @@ msgid "" msgstr "" #: ../../library/logging.rst:565 -msgid "Sets the :class:`Formatter` for this handler to *fmt*." +msgid "" +"Sets the formatter for this handler to *fmt*. The *fmt* argument must be a :" +"class:`Formatter` instance or ``None``." msgstr "" -#: ../../library/logging.rst:570 +#: ../../library/logging.rst:571 msgid "Adds the specified filter *filter* to this handler." msgstr "" -#: ../../library/logging.rst:575 +#: ../../library/logging.rst:576 msgid "Removes the specified filter *filter* from this handler." msgstr "" -#: ../../library/logging.rst:580 +#: ../../library/logging.rst:581 msgid "" "Apply this handler's filters to the record and return ``True`` if the record " "is to be processed. The filters are consulted in turn, until one of them " @@ -811,28 +813,33 @@ msgid "" "record." msgstr "" -#: ../../library/logging.rst:589 +#: ../../library/logging.rst:590 msgid "" "Ensure all logging output has been flushed. This version does nothing and is " "intended to be implemented by subclasses." msgstr "" -#: ../../library/logging.rst:595 +#: ../../library/logging.rst:596 msgid "" "Tidy up any resources used by the handler. This version does no output but " -"removes the handler from an internal list of handlers which is closed when :" -"func:`shutdown` is called. Subclasses should ensure that this gets called " -"from overridden :meth:`close` methods." +"removes the handler from an internal map of handlers, which is used for " +"handler lookup by name." +msgstr "" + +#: ../../library/logging.rst:600 +msgid "" +"Subclasses should ensure that this gets called from overridden :meth:`close` " +"methods." msgstr "" -#: ../../library/logging.rst:603 +#: ../../library/logging.rst:606 msgid "" "Conditionally emits the specified logging record, depending on filters which " "may have been added to the handler. Wraps the actual emission of the record " "with acquisition/release of the I/O thread lock." msgstr "" -#: ../../library/logging.rst:610 +#: ../../library/logging.rst:613 msgid "" "This method should be called from handlers when an exception is encountered " "during an :meth:`emit` call. If the module-level attribute :data:" @@ -845,20 +852,20 @@ msgid "" "is more useful during development)." msgstr "" -#: ../../library/logging.rst:623 +#: ../../library/logging.rst:626 msgid "" "Do formatting for a record - if a formatter is set, use it. Otherwise, use " "the default formatter for the module." msgstr "" -#: ../../library/logging.rst:629 +#: ../../library/logging.rst:632 msgid "" "Do whatever it takes to actually log the specified logging record. This " "version is intended to be implemented by subclasses and so raises a :exc:" "`NotImplementedError`." msgstr "" -#: ../../library/logging.rst:633 +#: ../../library/logging.rst:636 msgid "" "This method is called after a handler-level lock is acquired, which is " "released after this method returns. When you override this method, note that " @@ -867,13 +874,13 @@ msgid "" "Specifically:" msgstr "" -#: ../../library/logging.rst:639 +#: ../../library/logging.rst:642 msgid "" "Logging configuration APIs acquire the module-level lock, and then " "individual handler-level locks as those handlers are configured." msgstr "" -#: ../../library/logging.rst:642 +#: ../../library/logging.rst:645 msgid "" "Many logging APIs lock the module-level lock. If such an API is called from " "this method, it could cause a deadlock if a configuration call is made on " @@ -883,16 +890,16 @@ msgid "" "method, the handler-level lock has already been acquired)." msgstr "" -#: ../../library/logging.rst:649 +#: ../../library/logging.rst:652 msgid "" "For a list of handlers included as standard, see :mod:`logging.handlers`." msgstr "" -#: ../../library/logging.rst:654 +#: ../../library/logging.rst:657 msgid "Formatter Objects" msgstr "" -#: ../../library/logging.rst:660 +#: ../../library/logging.rst:663 msgid "" "Responsible for converting a :class:`LogRecord` to an output string to be " "interpreted by a human or external system." @@ -902,7 +909,7 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/logging.rst:663 +#: ../../library/logging.rst:666 msgid "" "A format string in the given *style* for the logged output as a whole. The " "possible mapping keys are drawn from the :class:`LogRecord` object's :ref:" @@ -910,14 +917,14 @@ msgid "" "is just the logged message." msgstr "" -#: ../../library/logging.rst:671 +#: ../../library/logging.rst:674 msgid "" "A format string in the given *style* for the date/time portion of the logged " "output. If not specified, the default described in :meth:`formatTime` is " "used." msgstr "" -#: ../../library/logging.rst:676 +#: ../../library/logging.rst:679 msgid "" "Can be one of ``'%'``, ``'{'`` or ``'$'`` and determines how the format " "string will be merged with its data: using one of :ref:`old-string-" @@ -928,32 +935,32 @@ msgid "" "use ``{``- and ``$``-formatting for log messages." msgstr "" -#: ../../library/logging.rst:686 +#: ../../library/logging.rst:689 msgid "" "If ``True`` (the default), incorrect or mismatched *fmt* and *style* will " "raise a :exc:`ValueError`; for example, ``logging.Formatter('%(asctime)s - " "%(message)s', style='{')``." msgstr "" -#: ../../library/logging.rst:691 +#: ../../library/logging.rst:694 msgid "" "A dictionary with default values to use in custom fields. For example, " "``logging.Formatter('%(ip)s %(message)s', defaults={\"ip\": None})``" msgstr "" -#: ../../library/logging.rst:696 +#: ../../library/logging.rst:699 msgid "Added the *style* parameter." msgstr "新增 *style* 參數。" -#: ../../library/logging.rst:699 +#: ../../library/logging.rst:702 msgid "Added the *validate* parameter." msgstr "新增 *validate* 參數。" -#: ../../library/logging.rst:702 +#: ../../library/logging.rst:705 msgid "Added the *defaults* parameter." msgstr "新增 *defaults* 參數。" -#: ../../library/logging.rst:708 +#: ../../library/logging.rst:711 msgid "" "The record's attribute dictionary is used as the operand to a string " "formatting operation. Returns the resulting string. Before formatting the " @@ -972,13 +979,13 @@ msgid "" "recalculates it afresh." msgstr "" -#: ../../library/logging.rst:724 +#: ../../library/logging.rst:727 msgid "" "If stack information is available, it's appended after the exception " "information, using :meth:`formatStack` to transform it if necessary." msgstr "" -#: ../../library/logging.rst:730 +#: ../../library/logging.rst:733 msgid "" "This method should be called from :meth:`format` by a formatter which wants " "to make use of a formatted time. This method can be overridden in formatters " @@ -991,7 +998,7 @@ msgid "" "resulting string is returned." msgstr "" -#: ../../library/logging.rst:740 +#: ../../library/logging.rst:743 msgid "" "This function uses a user-configurable function to convert the creation time " "to a tuple. By default, :func:`time.localtime` is used; to change this for a " @@ -1001,7 +1008,7 @@ msgid "" "be shown in GMT, set the ``converter`` attribute in the ``Formatter`` class." msgstr "" -#: ../../library/logging.rst:748 +#: ../../library/logging.rst:751 msgid "" "Previously, the default format was hard-coded as in this example: " "``2010-09-06 22:38:15,292`` where the part before the comma is handled by a " @@ -1016,11 +1023,11 @@ msgid "" "the millisecond value)." msgstr "" -#: ../../library/logging.rst:761 +#: ../../library/logging.rst:764 msgid "The ``default_msec_format`` can be ``None``." msgstr "" -#: ../../library/logging.rst:766 +#: ../../library/logging.rst:769 msgid "" "Formats the specified exception information (a standard exception tuple as " "returned by :func:`sys.exc_info`) as a string. This default implementation " @@ -1028,14 +1035,14 @@ msgid "" "returned." msgstr "" -#: ../../library/logging.rst:773 +#: ../../library/logging.rst:776 msgid "" "Formats the specified stack information (a string as returned by :func:" "`traceback.print_stack`, but with the last newline removed) as a string. " "This default implementation just returns the input value." msgstr "" -#: ../../library/logging.rst:779 +#: ../../library/logging.rst:782 msgid "" "A base formatter class suitable for subclassing when you want to format a " "number of records. You can pass a :class:`Formatter` instance which you want " @@ -1044,7 +1051,7 @@ msgid "" "used as the line formatter." msgstr "" -#: ../../library/logging.rst:787 +#: ../../library/logging.rst:790 msgid "" "Return a header for a list of *records*. The base implementation just " "returns the empty string. You will need to override this method if you want " @@ -1052,14 +1059,14 @@ msgid "" "separator line." msgstr "" -#: ../../library/logging.rst:794 +#: ../../library/logging.rst:797 msgid "" "Return a footer for a list of *records*. The base implementation just " "returns the empty string. You will need to override this method if you want " "specific behaviour, e.g. to show the count of records or a separator line." msgstr "" -#: ../../library/logging.rst:801 +#: ../../library/logging.rst:804 msgid "" "Return formatted text for a list of *records*. The base implementation just " "returns the empty string if there are no records; otherwise, it returns the " @@ -1067,11 +1074,11 @@ msgid "" "and the footer." msgstr "" -#: ../../library/logging.rst:809 +#: ../../library/logging.rst:812 msgid "Filter Objects" msgstr "" -#: ../../library/logging.rst:811 +#: ../../library/logging.rst:814 msgid "" "``Filters`` can be used by ``Handlers`` and ``Loggers`` for more " "sophisticated filtering than is provided by levels. The base filter class " @@ -1081,7 +1088,7 @@ msgid "" "If initialized with the empty string, all events are passed." msgstr "" -#: ../../library/logging.rst:821 +#: ../../library/logging.rst:824 msgid "" "Returns an instance of the :class:`Filter` class. If *name* is specified, it " "names a logger which, together with its children, will have its events " @@ -1089,7 +1096,7 @@ msgid "" "event." msgstr "" -#: ../../library/logging.rst:828 +#: ../../library/logging.rst:831 msgid "" "Is the specified record to be logged? Returns false for no, true for yes. " "Filters can either modify log records in-place or return a completely " @@ -1097,7 +1104,7 @@ msgid "" "future processing of the event." msgstr "" -#: ../../library/logging.rst:833 +#: ../../library/logging.rst:836 msgid "" "Note that filters attached to handlers are consulted before an event is " "emitted by the handler, whereas filters attached to loggers are consulted " @@ -1107,13 +1114,13 @@ msgid "" "setting, unless the filter has also been applied to those descendant loggers." msgstr "" -#: ../../library/logging.rst:840 +#: ../../library/logging.rst:843 msgid "" "You don't actually need to subclass ``Filter``: you can pass any instance " "which has a ``filter`` method with the same semantics." msgstr "" -#: ../../library/logging.rst:843 +#: ../../library/logging.rst:846 msgid "" "You don't need to create specialized ``Filter`` classes, or use other " "classes with a ``filter`` method: you can use a function (or other callable) " @@ -1124,7 +1131,7 @@ msgid "" "value should conform to that returned by :meth:`~Filter.filter`." msgstr "" -#: ../../library/logging.rst:853 +#: ../../library/logging.rst:856 msgid "" "You can now return a :class:`LogRecord` instance from filters to replace the " "log record rather than modifying it in place. This allows filters attached " @@ -1132,7 +1139,7 @@ msgid "" "having side effects on other handlers." msgstr "" -#: ../../library/logging.rst:859 +#: ../../library/logging.rst:862 msgid "" "Although filters are used primarily to filter records based on more " "sophisticated criteria than levels, they get to see every record which is " @@ -1144,11 +1151,11 @@ msgid "" "contextual information into logs (see :ref:`filters-contextual`)." msgstr "" -#: ../../library/logging.rst:872 +#: ../../library/logging.rst:875 msgid "LogRecord Objects" msgstr "LogRecord 物件" -#: ../../library/logging.rst:874 +#: ../../library/logging.rst:877 msgid "" ":class:`LogRecord` instances are created automatically by the :class:" "`Logger` every time something is logged, and can be created manually via :" @@ -1156,17 +1163,17 @@ msgid "" "wire)." msgstr "" -#: ../../library/logging.rst:882 +#: ../../library/logging.rst:885 msgid "Contains all the information pertinent to the event being logged." msgstr "" -#: ../../library/logging.rst:884 +#: ../../library/logging.rst:887 msgid "" "The primary information is passed in *msg* and *args*, which are combined " "using ``msg % args`` to create the :attr:`!message` attribute of the record." msgstr "" -#: ../../library/logging.rst:888 +#: ../../library/logging.rst:891 msgid "" "The name of the logger used to log the event represented by this :class:`!" "LogRecord`. Note that the logger name in the :class:`!LogRecord` will always " @@ -1174,7 +1181,7 @@ msgid "" "different (ancestor) logger." msgstr "" -#: ../../library/logging.rst:896 +#: ../../library/logging.rst:899 msgid "" "The :ref:`numeric level ` of the logging event (such as ``10`` for " "``DEBUG``, ``20`` for ``INFO``, etc). Note that this is converted to *two* " @@ -1182,46 +1189,46 @@ msgid "" "attr:`!levelname` for the corresponding level name." msgstr "" -#: ../../library/logging.rst:903 +#: ../../library/logging.rst:906 msgid "" "The full string path of the source file where the logging call was made." msgstr "" -#: ../../library/logging.rst:907 +#: ../../library/logging.rst:910 msgid "The line number in the source file where the logging call was made." msgstr "" -#: ../../library/logging.rst:911 +#: ../../library/logging.rst:914 msgid "" "The event description message, which can be a %-format string with " "placeholders for variable data, or an arbitrary object (see :ref:`arbitrary-" "object-messages`)." msgstr "" -#: ../../library/logging.rst:916 +#: ../../library/logging.rst:919 msgid "" "Variable data to merge into the *msg* argument to obtain the event " "description." msgstr "" -#: ../../library/logging.rst:920 +#: ../../library/logging.rst:923 msgid "" "An exception tuple with the current exception information, as returned by :" "func:`sys.exc_info`, or ``None`` if no exception information is available." msgstr "" -#: ../../library/logging.rst:925 +#: ../../library/logging.rst:928 msgid "" "The name of the function or method from which the logging call was invoked." msgstr "" -#: ../../library/logging.rst:929 +#: ../../library/logging.rst:932 msgid "" "A text string representing stack information from the base of the stack in " "the current thread, up to the logging call." msgstr "" -#: ../../library/logging.rst:936 +#: ../../library/logging.rst:939 msgid "" "Returns the message for this :class:`LogRecord` instance after merging any " "user-supplied arguments with the message. If the user-supplied message " @@ -1230,7 +1237,7 @@ msgid "" "whose ``__str__`` method can return the actual format string to be used." msgstr "" -#: ../../library/logging.rst:943 +#: ../../library/logging.rst:946 msgid "" "The creation of a :class:`LogRecord` has been made more configurable by " "providing a factory which is used to create the record. The factory can be " @@ -1238,13 +1245,13 @@ msgid "" "this for the factory's signature)." msgstr "" -#: ../../library/logging.rst:949 +#: ../../library/logging.rst:952 msgid "" "This functionality can be used to inject your own values into a :class:" "`LogRecord` at creation time. You can use the following pattern::" msgstr "" -#: ../../library/logging.rst:952 +#: ../../library/logging.rst:955 msgid "" "old_factory = logging.getLogRecordFactory()\n" "\n" @@ -1264,18 +1271,18 @@ msgstr "" "\n" "logging.setLogRecordFactory(record_factory)" -#: ../../library/logging.rst:961 +#: ../../library/logging.rst:964 msgid "" "With this pattern, multiple factories could be chained, and as long as they " "don't overwrite each other's attributes or unintentionally overwrite the " "standard attributes listed above, there should be no surprises." msgstr "" -#: ../../library/logging.rst:970 +#: ../../library/logging.rst:973 msgid "LogRecord attributes" msgstr "LogRecord 屬性" -#: ../../library/logging.rst:972 +#: ../../library/logging.rst:975 msgid "" "The LogRecord has a number of attributes, most of which are derived from the " "parameters to the constructor. (Note that the names do not always correspond " @@ -1286,7 +1293,7 @@ msgid "" "style format string." msgstr "" -#: ../../library/logging.rst:980 +#: ../../library/logging.rst:983 msgid "" "If you are using {}-formatting (:func:`str.format`), you can use ``{attrname}" "`` as the placeholder in the format string. If you are using $-formatting (:" @@ -1294,7 +1301,7 @@ msgid "" "course, replace ``attrname`` with the actual attribute name you want to use." msgstr "" -#: ../../library/logging.rst:986 +#: ../../library/logging.rst:989 msgid "" "In the case of {}-formatting, you can specify formatting flags by placing " "them after the attribute name, separated from it with a colon. For example: " @@ -1303,318 +1310,318 @@ msgid "" "on the options available to you." msgstr "" -#: ../../library/logging.rst:993 +#: ../../library/logging.rst:996 msgid "Attribute name" msgstr "屬性名稱" -#: ../../library/logging.rst:993 ../../library/logging.rst:1363 +#: ../../library/logging.rst:996 ../../library/logging.rst:1366 msgid "Format" msgstr "格式" -#: ../../library/logging.rst:993 ../../library/logging.rst:1363 +#: ../../library/logging.rst:996 ../../library/logging.rst:1366 msgid "Description" msgstr "描述" -#: ../../library/logging.rst:0 ../../library/logging.rst:995 +#: ../../library/logging.rst:0 ../../library/logging.rst:998 msgid "args" msgstr "args" -#: ../../library/logging.rst:995 ../../library/logging.rst:1009 -#: ../../library/logging.rst:1037 ../../library/logging.rst:1055 +#: ../../library/logging.rst:998 ../../library/logging.rst:1012 +#: ../../library/logging.rst:1040 ../../library/logging.rst:1058 msgid "You shouldn't need to format this yourself." msgstr "你不應該需要自己格式化它。" -#: ../../library/logging.rst:995 +#: ../../library/logging.rst:998 msgid "" "The tuple of arguments merged into ``msg`` to produce ``message``, or a dict " "whose values are used for the merge (when there is only one argument, and it " "is a dictionary)." msgstr "" -#: ../../library/logging.rst:1000 +#: ../../library/logging.rst:1003 msgid "asctime" msgstr "asctime" -#: ../../library/logging.rst:1000 +#: ../../library/logging.rst:1003 msgid "``%(asctime)s``" msgstr "``%(asctime)s``" -#: ../../library/logging.rst:1000 +#: ../../library/logging.rst:1003 msgid "" "Human-readable time when the :class:`LogRecord` was created. By default " "this is of the form '2003-07-08 16:49:45,896' (the numbers after the comma " "are millisecond portion of the time)." msgstr "" -#: ../../library/logging.rst:1006 +#: ../../library/logging.rst:1009 msgid "created" msgstr "created" -#: ../../library/logging.rst:1006 +#: ../../library/logging.rst:1009 msgid "``%(created)f``" msgstr "``%(created)f``" -#: ../../library/logging.rst:1006 +#: ../../library/logging.rst:1009 msgid "" "Time when the :class:`LogRecord` was created (as returned by :func:`time." "time_ns` / 1e9)." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1009 +#: ../../library/logging.rst:0 ../../library/logging.rst:1012 msgid "exc_info" msgstr "exc_info" -#: ../../library/logging.rst:1009 +#: ../../library/logging.rst:1012 msgid "" "Exception tuple (à la ``sys.exc_info``) or, if no exception has occurred, " "``None``." msgstr "" -#: ../../library/logging.rst:1012 +#: ../../library/logging.rst:1015 msgid "filename" msgstr "filename" -#: ../../library/logging.rst:1012 +#: ../../library/logging.rst:1015 msgid "``%(filename)s``" msgstr "``%(filename)s``" -#: ../../library/logging.rst:1012 +#: ../../library/logging.rst:1015 msgid "Filename portion of ``pathname``." msgstr "``pathname`` 的檔案名稱部分。" -#: ../../library/logging.rst:1014 +#: ../../library/logging.rst:1017 msgid "funcName" msgstr "funcName" -#: ../../library/logging.rst:1014 +#: ../../library/logging.rst:1017 msgid "``%(funcName)s``" msgstr "``%(funcName)s``" -#: ../../library/logging.rst:1014 +#: ../../library/logging.rst:1017 msgid "Name of function containing the logging call." msgstr "" -#: ../../library/logging.rst:1016 +#: ../../library/logging.rst:1019 msgid "levelname" msgstr "levelname" -#: ../../library/logging.rst:1016 +#: ../../library/logging.rst:1019 msgid "``%(levelname)s``" msgstr "``%(levelname)s``" -#: ../../library/logging.rst:1016 +#: ../../library/logging.rst:1019 msgid "" "Text logging level for the message (``'DEBUG'``, ``'INFO'``, ``'WARNING'``, " "``'ERROR'``, ``'CRITICAL'``)." msgstr "" -#: ../../library/logging.rst:1020 +#: ../../library/logging.rst:1023 msgid "levelno" msgstr "levelno" -#: ../../library/logging.rst:1020 +#: ../../library/logging.rst:1023 msgid "``%(levelno)s``" msgstr "``%(levelno)s``" -#: ../../library/logging.rst:1020 +#: ../../library/logging.rst:1023 msgid "" "Numeric logging level for the message (:const:`DEBUG`, :const:`INFO`, :const:" "`WARNING`, :const:`ERROR`, :const:`CRITICAL`)." msgstr "" -#: ../../library/logging.rst:1025 +#: ../../library/logging.rst:1028 msgid "lineno" msgstr "lineno" -#: ../../library/logging.rst:1025 +#: ../../library/logging.rst:1028 msgid "``%(lineno)d``" msgstr "``%(lineno)d``" -#: ../../library/logging.rst:1025 +#: ../../library/logging.rst:1028 msgid "Source line number where the logging call was issued (if available)." msgstr "" -#: ../../library/logging.rst:1028 +#: ../../library/logging.rst:1031 msgid "message" msgstr "message" -#: ../../library/logging.rst:1028 +#: ../../library/logging.rst:1031 msgid "``%(message)s``" msgstr "``%(message)s``" -#: ../../library/logging.rst:1028 +#: ../../library/logging.rst:1031 msgid "" "The logged message, computed as ``msg % args``. This is set when :meth:" "`Formatter.format` is invoked." msgstr "" -#: ../../library/logging.rst:1032 +#: ../../library/logging.rst:1035 msgid "module" msgstr "模組" -#: ../../library/logging.rst:1032 +#: ../../library/logging.rst:1035 msgid "``%(module)s``" msgstr "``%(module)s``" -#: ../../library/logging.rst:1032 +#: ../../library/logging.rst:1035 msgid "Module (name portion of ``filename``)." msgstr "模組(``filename`` 的名稱部分)。" -#: ../../library/logging.rst:1034 +#: ../../library/logging.rst:1037 msgid "msecs" msgstr "msecs" -#: ../../library/logging.rst:1034 +#: ../../library/logging.rst:1037 msgid "``%(msecs)d``" msgstr "``%(msecs)d``" -#: ../../library/logging.rst:1034 +#: ../../library/logging.rst:1037 msgid "" "Millisecond portion of the time when the :class:`LogRecord` was created." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1037 +#: ../../library/logging.rst:0 ../../library/logging.rst:1040 msgid "msg" msgstr "msg" -#: ../../library/logging.rst:1037 +#: ../../library/logging.rst:1040 msgid "" "The format string passed in the original logging call. Merged with ``args`` " "to produce ``message``, or an arbitrary object (see :ref:`arbitrary-object-" "messages`)." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1042 +#: ../../library/logging.rst:0 ../../library/logging.rst:1045 msgid "name" msgstr "name" -#: ../../library/logging.rst:1042 +#: ../../library/logging.rst:1045 msgid "``%(name)s``" msgstr "``%(name)s``" -#: ../../library/logging.rst:1042 +#: ../../library/logging.rst:1045 msgid "Name of the logger used to log the call." msgstr "" -#: ../../library/logging.rst:1044 +#: ../../library/logging.rst:1047 msgid "pathname" msgstr "pathname" -#: ../../library/logging.rst:1044 +#: ../../library/logging.rst:1047 msgid "``%(pathname)s``" msgstr "``%(pathname)s``" -#: ../../library/logging.rst:1044 +#: ../../library/logging.rst:1047 msgid "" "Full pathname of the source file where the logging call was issued (if " "available)." msgstr "" -#: ../../library/logging.rst:1047 +#: ../../library/logging.rst:1050 msgid "process" msgstr "process" -#: ../../library/logging.rst:1047 +#: ../../library/logging.rst:1050 msgid "``%(process)d``" msgstr "``%(process)d``" -#: ../../library/logging.rst:1047 +#: ../../library/logging.rst:1050 msgid "Process ID (if available)." msgstr "行程 ID(如果可用)。" -#: ../../library/logging.rst:1049 +#: ../../library/logging.rst:1052 msgid "processName" msgstr "processName" -#: ../../library/logging.rst:1049 +#: ../../library/logging.rst:1052 msgid "``%(processName)s``" msgstr "``%(processName)s``" -#: ../../library/logging.rst:1049 +#: ../../library/logging.rst:1052 msgid "Process name (if available)." msgstr "行程名稱(如果可用)。" -#: ../../library/logging.rst:1051 +#: ../../library/logging.rst:1054 msgid "relativeCreated" msgstr "relativeCreated" -#: ../../library/logging.rst:1051 +#: ../../library/logging.rst:1054 msgid "``%(relativeCreated)d``" msgstr "``%(relativeCreated)d``" -#: ../../library/logging.rst:1051 +#: ../../library/logging.rst:1054 msgid "" "Time in milliseconds when the LogRecord was created, relative to the time " "the logging module was loaded." msgstr "" -#: ../../library/logging.rst:1055 +#: ../../library/logging.rst:1058 msgid "stack_info" msgstr "stack_info" -#: ../../library/logging.rst:1055 +#: ../../library/logging.rst:1058 msgid "" "Stack frame information (where available) from the bottom of the stack in " "the current thread, up to and including the stack frame of the logging call " "which resulted in the creation of this record." msgstr "" -#: ../../library/logging.rst:1061 +#: ../../library/logging.rst:1064 msgid "thread" msgstr "thread" -#: ../../library/logging.rst:1061 +#: ../../library/logging.rst:1064 msgid "``%(thread)d``" msgstr "``%(thread)d``" -#: ../../library/logging.rst:1061 +#: ../../library/logging.rst:1064 msgid "Thread ID (if available)." msgstr "執行緒 ID(如果可用)。" -#: ../../library/logging.rst:1063 +#: ../../library/logging.rst:1066 msgid "threadName" msgstr "threadName" -#: ../../library/logging.rst:1063 +#: ../../library/logging.rst:1066 msgid "``%(threadName)s``" msgstr "``%(threadName)s``" -#: ../../library/logging.rst:1063 +#: ../../library/logging.rst:1066 msgid "Thread name (if available)." msgstr "" -#: ../../library/logging.rst:1065 +#: ../../library/logging.rst:1068 msgid "taskName" msgstr "taskName" -#: ../../library/logging.rst:1065 +#: ../../library/logging.rst:1068 msgid "``%(taskName)s``" msgstr "``%(taskName)s``" -#: ../../library/logging.rst:1065 +#: ../../library/logging.rst:1068 msgid ":class:`asyncio.Task` name (if available)." msgstr "" -#: ../../library/logging.rst:1068 +#: ../../library/logging.rst:1071 msgid "*processName* was added." msgstr "新增 *processName*。" -#: ../../library/logging.rst:1071 +#: ../../library/logging.rst:1074 msgid "*taskName* was added." msgstr "新增 *taskName*。" -#: ../../library/logging.rst:1077 +#: ../../library/logging.rst:1080 msgid "LoggerAdapter Objects" msgstr "LoggerAdapter 物件" -#: ../../library/logging.rst:1079 +#: ../../library/logging.rst:1082 msgid "" ":class:`LoggerAdapter` instances are used to conveniently pass contextual " "information into logging calls. For a usage example, see the section on :ref:" "`adding contextual information to your logging output `." msgstr "" -#: ../../library/logging.rst:1085 +#: ../../library/logging.rst:1088 msgid "" "Returns an instance of :class:`LoggerAdapter` initialized with an " "underlying :class:`Logger` instance, a dict-like object (*extra*), and a " @@ -1624,7 +1631,7 @@ msgid "" "calls and only use the one of the :class:`LoggerAdapter` instance" msgstr "" -#: ../../library/logging.rst:1094 +#: ../../library/logging.rst:1097 msgid "" "Modifies the message and/or keyword arguments passed to a logging call in " "order to insert contextual information. This implementation takes the object " @@ -1633,15 +1640,15 @@ msgid "" "(possibly modified) versions of the arguments passed in." msgstr "" -#: ../../library/logging.rst:1102 +#: ../../library/logging.rst:1105 msgid "Delegates to the underlying :attr:`!manager` on *logger*." msgstr "" -#: ../../library/logging.rst:1106 +#: ../../library/logging.rst:1109 msgid "Delegates to the underlying :meth:`!_log` method on *logger*." msgstr "" -#: ../../library/logging.rst:1108 +#: ../../library/logging.rst:1111 msgid "" "In addition to the above, :class:`LoggerAdapter` supports the following " "methods of :class:`Logger`: :meth:`~Logger.debug`, :meth:`~Logger.info`, :" @@ -1653,28 +1660,28 @@ msgid "" "interchangeably." msgstr "" -#: ../../library/logging.rst:1119 +#: ../../library/logging.rst:1122 msgid "" "The :meth:`~Logger.isEnabledFor`, :meth:`~Logger.getEffectiveLevel`, :meth:" "`~Logger.setLevel` and :meth:`~Logger.hasHandlers` methods were added to :" "class:`LoggerAdapter`. These methods delegate to the underlying logger." msgstr "" -#: ../../library/logging.rst:1125 +#: ../../library/logging.rst:1128 msgid "" "Attribute :attr:`!manager` and method :meth:`!_log` were added, which " "delegate to the underlying logger and allow adapters to be nested." msgstr "" -#: ../../library/logging.rst:1130 +#: ../../library/logging.rst:1133 msgid "The *merge_extra* argument was added." msgstr "新增 *merge_extra* 引數。" -#: ../../library/logging.rst:1134 +#: ../../library/logging.rst:1137 msgid "Thread Safety" msgstr "執行緒安全" -#: ../../library/logging.rst:1136 +#: ../../library/logging.rst:1139 msgid "" "The logging module is intended to be thread-safe without any special work " "needing to be done by its clients. It achieves this though using threading " @@ -1683,7 +1690,7 @@ msgid "" "O." msgstr "" -#: ../../library/logging.rst:1141 +#: ../../library/logging.rst:1144 msgid "" "If you are implementing asynchronous signal handlers using the :mod:`signal` " "module, you may not be able to use logging from within such handlers. This " @@ -1691,17 +1698,17 @@ msgid "" "always re-entrant, and so cannot be invoked from such signal handlers." msgstr "" -#: ../../library/logging.rst:1148 +#: ../../library/logging.rst:1151 msgid "Module-Level Functions" msgstr "模組層級函式" -#: ../../library/logging.rst:1150 +#: ../../library/logging.rst:1153 msgid "" "In addition to the classes described above, there are a number of module-" "level functions." msgstr "" -#: ../../library/logging.rst:1156 +#: ../../library/logging.rst:1159 msgid "" "Return a logger with the specified name or, if name is ``None``, return the " "root logger of the hierarchy. If specified, the name is typically a dot-" @@ -1711,14 +1718,14 @@ msgid "" "for not doing that, as mentioned in :ref:`logger`." msgstr "" -#: ../../library/logging.rst:1163 +#: ../../library/logging.rst:1166 msgid "" "All calls to this function with a given name return the same logger " "instance. This means that logger instances never need to be passed between " "different parts of an application." msgstr "" -#: ../../library/logging.rst:1170 +#: ../../library/logging.rst:1173 msgid "" "Return either the standard :class:`Logger` class, or the last class passed " "to :func:`setLoggerClass`. This function may be called from within a new " @@ -1727,7 +1734,7 @@ msgid "" "example::" msgstr "" -#: ../../library/logging.rst:1175 +#: ../../library/logging.rst:1178 msgid "" "class MyLogger(logging.getLoggerClass()):\n" " # ... override behaviour here" @@ -1735,37 +1742,37 @@ msgstr "" "class MyLogger(logging.getLoggerClass()):\n" " # ... 在這裡覆蓋其行為" -#: ../../library/logging.rst:1181 +#: ../../library/logging.rst:1184 msgid "Return a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1183 +#: ../../library/logging.rst:1186 msgid "" "This function has been provided, along with :func:`setLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1188 +#: ../../library/logging.rst:1191 msgid "" "See :func:`setLogRecordFactory` for more information about the how the " "factory is called." msgstr "" -#: ../../library/logging.rst:1193 +#: ../../library/logging.rst:1196 msgid "" "This is a convenience function that calls :meth:`Logger.debug`, on the root " "logger. The handling of the arguments is in every way identical to what is " "described in that method." msgstr "" -#: ../../library/logging.rst:1197 +#: ../../library/logging.rst:1200 msgid "" "The only difference is that if the root logger has no handlers, then :func:" "`basicConfig` is called, prior to calling ``debug`` on the root logger." msgstr "" -#: ../../library/logging.rst:1200 +#: ../../library/logging.rst:1203 msgid "" "For very short scripts or quick demonstrations of ``logging`` facilities, " "``debug`` and the other module-level functions may be convenient. However, " @@ -1775,38 +1782,38 @@ msgid "" "described at the beginnning of this documentation." msgstr "" -#: ../../library/logging.rst:1210 +#: ../../library/logging.rst:1213 msgid "" "Logs a message with level :const:`INFO` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1216 +#: ../../library/logging.rst:1219 msgid "" "Logs a message with level :const:`WARNING` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1219 +#: ../../library/logging.rst:1222 msgid "" "There is an obsolete function ``warn`` which is functionally identical to " "``warning``. As ``warn`` is deprecated, please do not use it - use " "``warning`` instead." msgstr "" -#: ../../library/logging.rst:1226 +#: ../../library/logging.rst:1229 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1232 +#: ../../library/logging.rst:1235 msgid "" "Logs a message with level :const:`CRITICAL` on the root logger. The " "arguments and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1238 +#: ../../library/logging.rst:1241 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`. Exception info is " @@ -1814,13 +1821,13 @@ msgid "" "exception handler." msgstr "" -#: ../../library/logging.rst:1244 +#: ../../library/logging.rst:1247 msgid "" "Logs a message with level *level* on the root logger. The arguments and " "behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1249 +#: ../../library/logging.rst:1252 msgid "" "Provides an overriding level *level* for all loggers which takes precedence " "over the logger's own level. When the need arises to temporarily throttle " @@ -1834,7 +1841,7 @@ msgid "" "individual loggers." msgstr "" -#: ../../library/logging.rst:1260 +#: ../../library/logging.rst:1263 msgid "" "Note that if you have defined any custom logging level higher than " "``CRITICAL`` (this is not recommended), you won't be able to rely on the " @@ -1842,13 +1849,13 @@ msgid "" "a suitable value." msgstr "" -#: ../../library/logging.rst:1265 +#: ../../library/logging.rst:1268 msgid "" "The *level* parameter was defaulted to level ``CRITICAL``. See :issue:" "`28524` for more information about this change." msgstr "" -#: ../../library/logging.rst:1271 +#: ../../library/logging.rst:1274 msgid "" "Associates level *level* with text *levelName* in an internal dictionary, " "which is used to map numeric levels to a textual representation, for example " @@ -1858,24 +1865,24 @@ msgid "" "and they should increase in increasing order of severity." msgstr "" -#: ../../library/logging.rst:1278 +#: ../../library/logging.rst:1281 msgid "" "If you are thinking of defining your own levels, please see the section on :" "ref:`custom-levels`." msgstr "" -#: ../../library/logging.rst:1283 +#: ../../library/logging.rst:1286 msgid "" "Returns a mapping from level names to their corresponding logging levels. " "For example, the string \"CRITICAL\" maps to :const:`CRITICAL`. The returned " "mapping is copied from an internal mapping on each call to this function." msgstr "" -#: ../../library/logging.rst:1291 +#: ../../library/logging.rst:1294 msgid "Returns the textual or numeric representation of logging level *level*." msgstr "" -#: ../../library/logging.rst:1293 +#: ../../library/logging.rst:1296 msgid "" "If *level* is one of the predefined levels :const:`CRITICAL`, :const:" "`ERROR`, :const:`WARNING`, :const:`INFO` or :const:`DEBUG` then you get the " @@ -1885,20 +1892,20 @@ msgid "" "the corresponding string representation is returned." msgstr "" -#: ../../library/logging.rst:1300 +#: ../../library/logging.rst:1303 msgid "" "The *level* parameter also accepts a string representation of the level such " "as 'INFO'. In such cases, this functions returns the corresponding numeric " "value of the level." msgstr "" -#: ../../library/logging.rst:1304 +#: ../../library/logging.rst:1307 msgid "" "If no matching numeric or string value is passed in, the string 'Level %s' % " "level is returned." msgstr "" -#: ../../library/logging.rst:1307 +#: ../../library/logging.rst:1310 msgid "" "Levels are internally integers (as they need to be compared in the logging " "logic). This function is used to convert between an integer level and the " @@ -1907,7 +1914,7 @@ msgid "" "vice versa." msgstr "" -#: ../../library/logging.rst:1313 +#: ../../library/logging.rst:1316 msgid "" "In Python versions earlier than 3.4, this function could also be passed a " "text level, and would return the corresponding numeric value of the level. " @@ -1915,17 +1922,17 @@ msgid "" "Python 3.4, but reinstated in 3.4.2 due to retain backward compatibility." msgstr "" -#: ../../library/logging.rst:1321 +#: ../../library/logging.rst:1324 msgid "" "Returns a handler with the specified *name*, or ``None`` if there is no " "handler with that name." msgstr "" -#: ../../library/logging.rst:1328 +#: ../../library/logging.rst:1331 msgid "Returns an immutable set of all known handler names." msgstr "" -#: ../../library/logging.rst:1334 +#: ../../library/logging.rst:1337 msgid "" "Creates and returns a new :class:`LogRecord` instance whose attributes are " "defined by *attrdict*. This function is useful for taking a pickled :class:" @@ -1933,7 +1940,7 @@ msgid "" "as a :class:`LogRecord` instance at the receiving end." msgstr "" -#: ../../library/logging.rst:1342 +#: ../../library/logging.rst:1345 msgid "" "Does basic configuration for the logging system by creating a :class:" "`StreamHandler` with a default :class:`Formatter` and adding it to the root " @@ -1942,13 +1949,13 @@ msgid "" "no handlers are defined for the root logger." msgstr "" -#: ../../library/logging.rst:1348 +#: ../../library/logging.rst:1351 msgid "" "This function does nothing if the root logger already has handlers " "configured, unless the keyword argument *force* is set to ``True``." msgstr "" -#: ../../library/logging.rst:1351 +#: ../../library/logging.rst:1354 msgid "" "This function should be called from the main thread before other threads are " "started. In versions of Python prior to 2.7.1 and 3.2, if this function is " @@ -1957,54 +1964,54 @@ msgid "" "unexpected results such as messages being duplicated in the log." msgstr "" -#: ../../library/logging.rst:1358 +#: ../../library/logging.rst:1361 msgid "The following keyword arguments are supported." msgstr "支援以下的關鍵字引數。" -#: ../../library/logging.rst:1365 +#: ../../library/logging.rst:1368 msgid "*filename*" msgstr "*filename*" -#: ../../library/logging.rst:1365 +#: ../../library/logging.rst:1368 msgid "" "Specifies that a :class:`FileHandler` be created, using the specified " "filename, rather than a :class:`StreamHandler`." msgstr "" -#: ../../library/logging.rst:1369 +#: ../../library/logging.rst:1372 msgid "*filemode*" msgstr "*filemode*" -#: ../../library/logging.rst:1369 +#: ../../library/logging.rst:1372 msgid "" "If *filename* is specified, open the file in this :ref:`mode `. " "Defaults to ``'a'``." msgstr "" -#: ../../library/logging.rst:1373 +#: ../../library/logging.rst:1376 msgid "*format*" msgstr "*format*" -#: ../../library/logging.rst:1373 +#: ../../library/logging.rst:1376 msgid "" "Use the specified format string for the handler. Defaults to attributes " "``levelname``, ``name`` and ``message`` separated by colons." msgstr "" -#: ../../library/logging.rst:1378 +#: ../../library/logging.rst:1381 msgid "*datefmt*" msgstr "*datefmt*" -#: ../../library/logging.rst:1378 +#: ../../library/logging.rst:1381 msgid "" "Use the specified date/time format, as accepted by :func:`time.strftime`." msgstr "" -#: ../../library/logging.rst:1381 +#: ../../library/logging.rst:1384 msgid "*style*" msgstr "*style*" -#: ../../library/logging.rst:1381 +#: ../../library/logging.rst:1384 msgid "" "If *format* is specified, use this style for the format string. One of " "``'%'``, ``'{'`` or ``'$'`` for :ref:`printf-style `." msgstr "" -#: ../../library/logging.rst:1392 +#: ../../library/logging.rst:1395 msgid "*stream*" msgstr "*stream*" -#: ../../library/logging.rst:1392 +#: ../../library/logging.rst:1395 msgid "" "Use the specified stream to initialize the :class:`StreamHandler`. Note that " "this argument is incompatible with *filename* - if both are present, a " "``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1398 +#: ../../library/logging.rst:1401 msgid "*handlers*" msgstr "*handlers*" -#: ../../library/logging.rst:1398 +#: ../../library/logging.rst:1401 msgid "" "If specified, this should be an iterable of already created handlers to add " "to the root logger. Any handlers which don't already have a formatter set " @@ -2044,33 +2051,33 @@ msgid "" "present, a ``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1407 +#: ../../library/logging.rst:1410 msgid "*force*" msgstr "*force*" -#: ../../library/logging.rst:1407 +#: ../../library/logging.rst:1410 msgid "" "If this keyword argument is specified as true, any existing handlers " "attached to the root logger are removed and closed, before carrying out the " "configuration as specified by the other arguments." msgstr "" -#: ../../library/logging.rst:1413 +#: ../../library/logging.rst:1416 msgid "*encoding*" msgstr "*encoding*" -#: ../../library/logging.rst:1413 +#: ../../library/logging.rst:1416 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " "the output file." msgstr "" -#: ../../library/logging.rst:1418 +#: ../../library/logging.rst:1421 msgid "*errors*" msgstr "*errors*" -#: ../../library/logging.rst:1418 +#: ../../library/logging.rst:1421 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " @@ -2079,39 +2086,39 @@ msgid "" "`open`, which means that it will be treated the same as passing 'errors'." msgstr "" -#: ../../library/logging.rst:1429 +#: ../../library/logging.rst:1432 msgid "The *style* argument was added." msgstr "新增 *style* 引數。" -#: ../../library/logging.rst:1432 +#: ../../library/logging.rst:1435 msgid "" "The *handlers* argument was added. Additional checks were added to catch " "situations where incompatible arguments are specified (e.g. *handlers* " "together with *stream* or *filename*, or *stream* together with *filename*)." msgstr "" -#: ../../library/logging.rst:1438 +#: ../../library/logging.rst:1441 msgid "The *force* argument was added." msgstr "新增 *force* 引數。" -#: ../../library/logging.rst:1441 +#: ../../library/logging.rst:1444 msgid "The *encoding* and *errors* arguments were added." msgstr "新增 *encoding* 與 *errors* 引數。" -#: ../../library/logging.rst:1446 +#: ../../library/logging.rst:1449 msgid "" "Informs the logging system to perform an orderly shutdown by flushing and " "closing all handlers. This should be called at application exit and no " "further use of the logging system should be made after this call." msgstr "" -#: ../../library/logging.rst:1450 +#: ../../library/logging.rst:1453 msgid "" "When the logging module is imported, it registers this function as an exit " "handler (see :mod:`atexit`), so normally there's no need to do that manually." msgstr "" -#: ../../library/logging.rst:1457 +#: ../../library/logging.rst:1460 msgid "" "Tells the logging system to use the class *klass* when instantiating a " "logger. The class should define :meth:`!__init__` such that only a name " @@ -2123,32 +2130,32 @@ msgid "" "loggers." msgstr "" -#: ../../library/logging.rst:1468 +#: ../../library/logging.rst:1471 msgid "Set a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1470 +#: ../../library/logging.rst:1473 msgid "The factory callable to be used to instantiate a log record." msgstr "" -#: ../../library/logging.rst:1472 +#: ../../library/logging.rst:1475 msgid "" "This function has been provided, along with :func:`getLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1477 +#: ../../library/logging.rst:1480 msgid "The factory has the following signature:" msgstr "" -#: ../../library/logging.rst:1479 +#: ../../library/logging.rst:1482 msgid "" "``factory(name, level, fn, lno, msg, args, exc_info, func=None, sinfo=None, " "**kwargs)``" msgstr "" -#: ../../library/logging.rst:1481 +#: ../../library/logging.rst:1484 msgid "The logger name." msgstr "" @@ -2156,7 +2163,7 @@ msgstr "" msgid "level" msgstr "" -#: ../../library/logging.rst:1482 +#: ../../library/logging.rst:1485 msgid "The logging level (numeric)." msgstr "" @@ -2164,7 +2171,7 @@ msgstr "" msgid "fn" msgstr "fn" -#: ../../library/logging.rst:1483 +#: ../../library/logging.rst:1486 msgid "The full pathname of the file where the logging call was made." msgstr "" @@ -2172,19 +2179,19 @@ msgstr "" msgid "lno" msgstr "lno" -#: ../../library/logging.rst:1484 +#: ../../library/logging.rst:1487 msgid "The line number in the file where the logging call was made." msgstr "" -#: ../../library/logging.rst:1485 +#: ../../library/logging.rst:1488 msgid "The logging message." msgstr "" -#: ../../library/logging.rst:1486 +#: ../../library/logging.rst:1489 msgid "The arguments for the logging message." msgstr "" -#: ../../library/logging.rst:1487 +#: ../../library/logging.rst:1490 msgid "An exception tuple, or ``None``." msgstr "" @@ -2192,7 +2199,7 @@ msgstr "" msgid "func" msgstr "func" -#: ../../library/logging.rst:1488 +#: ../../library/logging.rst:1491 msgid "The name of the function or method which invoked the logging call." msgstr "" @@ -2200,7 +2207,7 @@ msgstr "" msgid "sinfo" msgstr "sinfo" -#: ../../library/logging.rst:1490 +#: ../../library/logging.rst:1493 msgid "" "A stack traceback such as is provided by :func:`traceback.print_stack`, " "showing the call hierarchy." @@ -2210,15 +2217,15 @@ msgstr "" msgid "kwargs" msgstr "kwargs" -#: ../../library/logging.rst:1492 +#: ../../library/logging.rst:1495 msgid "Additional keyword arguments." msgstr "額外的關鍵字引數。" -#: ../../library/logging.rst:1496 +#: ../../library/logging.rst:1499 msgid "Module-Level Attributes" msgstr "模組層級屬性" -#: ../../library/logging.rst:1500 +#: ../../library/logging.rst:1503 msgid "" "A \"handler of last resort\" is available through this attribute. This is a :" "class:`StreamHandler` writing to ``sys.stderr`` with a level of ``WARNING``, " @@ -2229,15 +2236,15 @@ msgid "" "reason, ``lastResort`` can be set to ``None``." msgstr "" -#: ../../library/logging.rst:1512 +#: ../../library/logging.rst:1515 msgid "Used to see if exceptions during handling should be propagated." msgstr "" -#: ../../library/logging.rst:1514 +#: ../../library/logging.rst:1517 msgid "Default: ``True``." msgstr "" -#: ../../library/logging.rst:1516 +#: ../../library/logging.rst:1519 msgid "" "If :data:`raiseExceptions` is ``False``, exceptions get silently ignored. " "This is what is mostly wanted for a logging system - most users will not " @@ -2245,22 +2252,22 @@ msgid "" "application errors." msgstr "" -#: ../../library/logging.rst:1523 +#: ../../library/logging.rst:1526 msgid "Integration with the warnings module" msgstr "" -#: ../../library/logging.rst:1525 +#: ../../library/logging.rst:1528 msgid "" "The :func:`captureWarnings` function can be used to integrate :mod:`logging` " "with the :mod:`warnings` module." msgstr "" -#: ../../library/logging.rst:1530 +#: ../../library/logging.rst:1533 msgid "" "This function is used to turn the capture of warnings by logging on and off." msgstr "" -#: ../../library/logging.rst:1533 +#: ../../library/logging.rst:1536 msgid "" "If *capture* is ``True``, warnings issued by the :mod:`warnings` module will " "be redirected to the logging system. Specifically, a warning will be " @@ -2269,46 +2276,46 @@ msgid "" "`WARNING`." msgstr "" -#: ../../library/logging.rst:1538 +#: ../../library/logging.rst:1541 msgid "" "If *capture* is ``False``, the redirection of warnings to the logging system " "will stop, and warnings will be redirected to their original destinations (i." "e. those in effect before ``captureWarnings(True)`` was called)." msgstr "" -#: ../../library/logging.rst:1545 +#: ../../library/logging.rst:1548 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../library/logging.rst:1546 +#: ../../library/logging.rst:1549 msgid "Configuration API for the logging module." msgstr "" -#: ../../library/logging.rst:1548 +#: ../../library/logging.rst:1551 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../library/logging.rst:1549 +#: ../../library/logging.rst:1552 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../library/logging.rst:1551 +#: ../../library/logging.rst:1554 msgid ":pep:`282` - A Logging System" msgstr "" -#: ../../library/logging.rst:1552 +#: ../../library/logging.rst:1555 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "" -#: ../../library/logging.rst:1555 +#: ../../library/logging.rst:1558 msgid "" "`Original Python logging package `_" msgstr "" -#: ../../library/logging.rst:1556 +#: ../../library/logging.rst:1559 msgid "" "This is the original source for the :mod:`logging` package. The version of " "the package available from this site is suitable for use with Python 1.5.2, " diff --git a/library/mailbox.po b/library/mailbox.po index 5a8a09d14a..44c110bdc8 100644 --- a/library/mailbox.po +++ b/library/mailbox.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-24 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -426,7 +426,7 @@ msgid "" "addition to the following:" msgstr "" -#: ../../library/mailbox.rst:376 ../../library/mailbox.rst:654 +#: ../../library/mailbox.rst:376 ../../library/mailbox.rst:669 msgid "Return a list of the names of all folders." msgstr "" @@ -443,7 +443,7 @@ msgid "" "instance representing it." msgstr "" -#: ../../library/mailbox.rst:394 ../../library/mailbox.rst:672 +#: ../../library/mailbox.rst:394 ../../library/mailbox.rst:687 msgid "" "Delete the folder whose name is *folder*. If the folder contains any " "messages, a :exc:`NotEmptyError` exception will be raised and the folder " @@ -664,55 +664,64 @@ msgid "" "remarks:" msgstr "" -#: ../../library/mailbox.rst:592 +#: ../../library/mailbox.rst:592 ../../library/mailbox.rst:602 +#: ../../library/mailbox.rst:608 ../../library/mailbox.rst:871 +#: ../../library/mailbox.rst:881 +msgid "" +"Note: This method has an extra parameter (*from_*) compared with other " +"classes. The first line of an mbox file entry is the Unix \"From \" line. If " +"*from_* is False, the first line of the file is dropped." +msgstr "" + +#: ../../library/mailbox.rst:598 msgid "" "Using the file after calling :meth:`~Mailbox.flush` or :meth:`~Mailbox." "close` on the :class:`!mbox` instance may yield unpredictable results or " "raise an exception." msgstr "" -#: ../../library/mailbox.rst:600 ../../library/mailbox.rst:813 -#: ../../library/mailbox.rst:864 +#: ../../library/mailbox.rst:615 ../../library/mailbox.rst:828 +#: ../../library/mailbox.rst:889 msgid "" "Three locking mechanisms are used---dot locking and, if available, the :c:" "func:`!flock` and :c:func:`!lockf` system calls." msgstr "" -#: ../../library/mailbox.rst:606 +#: ../../library/mailbox.rst:621 msgid "" "`mbox man page from tin `_" msgstr "" -#: ../../library/mailbox.rst:607 +#: ../../library/mailbox.rst:622 msgid "A specification of the format, with details on locking." msgstr "" -#: ../../library/mailbox.rst:609 +#: ../../library/mailbox.rst:624 msgid "" "`Configuring Netscape Mail on Unix: Why The Content-Length Format is Bad " "`_" msgstr "" -#: ../../library/mailbox.rst:610 +#: ../../library/mailbox.rst:625 msgid "An argument for using the original mbox format rather than a variation." msgstr "" -#: ../../library/mailbox.rst:612 +#: ../../library/mailbox.rst:627 msgid "" "`\"mbox\" is a family of several mutually incompatible mailbox formats " "`_" msgstr "" -#: ../../library/mailbox.rst:613 +#: ../../library/mailbox.rst:628 msgid "A history of mbox variations." msgstr "" -#: ../../library/mailbox.rst:619 +#: ../../library/mailbox.rst:634 msgid ":class:`!MH` objects" msgstr ":class:`!MH` 物件" -#: ../../library/mailbox.rst:624 +#: ../../library/mailbox.rst:639 msgid "" "A subclass of :class:`Mailbox` for mailboxes in MH format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -722,7 +731,7 @@ msgid "" "is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:631 +#: ../../library/mailbox.rst:646 msgid "" "MH is a directory-based mailbox format invented for the MH Message Handling " "System, a mail user agent. Each message in an MH mailbox resides in its own " @@ -733,7 +742,7 @@ msgid "" "called :file:`.mh_sequences` in each folder." msgstr "" -#: ../../library/mailbox.rst:639 +#: ../../library/mailbox.rst:654 msgid "" "The :class:`!MH` class manipulates MH mailboxes, but it does not attempt to " "emulate all of :program:`mh`'s behaviors. In particular, it does not modify " @@ -741,67 +750,67 @@ msgid "" "are used by :program:`mh` to store its state and configuration." msgstr "" -#: ../../library/mailbox.rst:644 +#: ../../library/mailbox.rst:659 msgid "" ":class:`!MH` instances have all of the methods of :class:`Mailbox` in " "addition to the following:" msgstr "" -#: ../../library/mailbox.rst:649 +#: ../../library/mailbox.rst:664 msgid "Supported folders that don't contain a :file:`.mh_sequences` file." msgstr "" -#: ../../library/mailbox.rst:659 +#: ../../library/mailbox.rst:674 msgid "" "Return an :class:`!MH` instance representing the folder whose name is " "*folder*. A :exc:`NoSuchMailboxError` exception is raised if the folder does " "not exist." msgstr "" -#: ../../library/mailbox.rst:666 +#: ../../library/mailbox.rst:681 msgid "" "Create a folder whose name is *folder* and return an :class:`!MH` instance " "representing it." msgstr "" -#: ../../library/mailbox.rst:679 +#: ../../library/mailbox.rst:694 msgid "" "Return a dictionary of sequence names mapped to key lists. If there are no " "sequences, the empty dictionary is returned." msgstr "" -#: ../../library/mailbox.rst:685 +#: ../../library/mailbox.rst:700 msgid "" "Re-define the sequences that exist in the mailbox based upon *sequences*, a " "dictionary of names mapped to key lists, like returned by :meth:" "`get_sequences`." msgstr "" -#: ../../library/mailbox.rst:692 +#: ../../library/mailbox.rst:707 msgid "" "Rename messages in the mailbox as necessary to eliminate gaps in numbering. " "Entries in the sequences list are updated correspondingly." msgstr "" -#: ../../library/mailbox.rst:697 +#: ../../library/mailbox.rst:712 msgid "" "Already-issued keys are invalidated by this operation and should not be " "subsequently used." msgstr "" -#: ../../library/mailbox.rst:700 +#: ../../library/mailbox.rst:715 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!MH` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:708 +#: ../../library/mailbox.rst:723 msgid "" "These methods immediately delete the message. The MH convention of marking a " "message for deletion by prepending a comma to its name is not used." msgstr "" -#: ../../library/mailbox.rst:715 +#: ../../library/mailbox.rst:730 msgid "" "Three locking mechanisms are used---dot locking and, if available, the :c:" "func:`!flock` and :c:func:`!lockf` system calls. For MH mailboxes, locking " @@ -810,51 +819,51 @@ msgid "" "files." msgstr "" -#: ../../library/mailbox.rst:724 +#: ../../library/mailbox.rst:739 msgid "" "Depending upon the host platform, it may not be possible to remove the " "underlying message while the returned file remains open." msgstr "" -#: ../../library/mailbox.rst:730 +#: ../../library/mailbox.rst:745 msgid "" "All changes to MH mailboxes are immediately applied, so this method does " "nothing." msgstr "" -#: ../../library/mailbox.rst:736 +#: ../../library/mailbox.rst:751 msgid "" ":class:`!MH` instances do not keep any open files, so this method is " "equivalent to :meth:`unlock`." msgstr "" -#: ../../library/mailbox.rst:742 +#: ../../library/mailbox.rst:757 msgid "`nmh - Message Handling System `_" msgstr "" -#: ../../library/mailbox.rst:743 +#: ../../library/mailbox.rst:758 msgid "" "Home page of :program:`nmh`, an updated version of the original :program:" "`mh`." msgstr "" -#: ../../library/mailbox.rst:745 +#: ../../library/mailbox.rst:760 msgid "" "`MH & nmh: Email for Users & Programmers `_" msgstr "" -#: ../../library/mailbox.rst:746 +#: ../../library/mailbox.rst:761 msgid "" "A GPL-licensed book on :program:`mh` and :program:`nmh`, with some " "information on the mailbox format." msgstr "" -#: ../../library/mailbox.rst:753 +#: ../../library/mailbox.rst:768 msgid ":class:`!Babyl` objects" msgstr ":class:`!Babyl` 物件" -#: ../../library/mailbox.rst:758 +#: ../../library/mailbox.rst:773 msgid "" "A subclass of :class:`Mailbox` for mailboxes in Babyl format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -864,7 +873,7 @@ msgid "" "mailbox is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:765 +#: ../../library/mailbox.rst:780 msgid "" "Babyl is a single-file mailbox format used by the Rmail mail user agent " "included with Emacs. The beginning of a message is indicated by a line " @@ -874,7 +883,7 @@ msgid "" "Underscore (``'\\037'``) character." msgstr "" -#: ../../library/mailbox.rst:772 +#: ../../library/mailbox.rst:787 msgid "" "Messages in a Babyl mailbox have two sets of headers, original headers and " "so-called visible headers. Visible headers are typically a subset of the " @@ -885,31 +894,31 @@ msgid "" "in the Babyl options section." msgstr "" -#: ../../library/mailbox.rst:780 +#: ../../library/mailbox.rst:795 msgid "" ":class:`!Babyl` instances have all of the methods of :class:`Mailbox` in " "addition to the following:" msgstr "" -#: ../../library/mailbox.rst:786 +#: ../../library/mailbox.rst:801 msgid "" "Return a list of the names of all user-defined labels used in the mailbox." msgstr "" -#: ../../library/mailbox.rst:790 +#: ../../library/mailbox.rst:805 msgid "" "The actual messages are inspected to determine which labels exist in the " "mailbox rather than consulting the list of labels in the Babyl options " "section, but the Babyl section is updated whenever the mailbox is modified." msgstr "" -#: ../../library/mailbox.rst:795 +#: ../../library/mailbox.rst:810 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!Babyl` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:801 +#: ../../library/mailbox.rst:816 msgid "" "In Babyl mailboxes, the headers of a message are not stored contiguously " "with the body of the message. To generate a file-like representation, the " @@ -919,30 +928,30 @@ msgid "" "memory compared to a string representation." msgstr "" -#: ../../library/mailbox.rst:819 +#: ../../library/mailbox.rst:834 msgid "" "`Format of Version 5 Babyl Files `_" msgstr "" -#: ../../library/mailbox.rst:820 +#: ../../library/mailbox.rst:835 msgid "A specification of the Babyl format." msgstr "" -#: ../../library/mailbox.rst:822 +#: ../../library/mailbox.rst:837 msgid "" "`Reading Mail with Rmail `_" msgstr "" -#: ../../library/mailbox.rst:823 +#: ../../library/mailbox.rst:838 msgid "The Rmail manual, with some information on Babyl semantics." msgstr "" -#: ../../library/mailbox.rst:829 +#: ../../library/mailbox.rst:844 msgid ":class:`!MMDF` objects" msgstr ":class:`!MMDF` 物件" -#: ../../library/mailbox.rst:834 +#: ../../library/mailbox.rst:849 msgid "" "A subclass of :class:`Mailbox` for mailboxes in MMDF format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -952,7 +961,7 @@ msgid "" "mailbox is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:841 +#: ../../library/mailbox.rst:856 msgid "" "MMDF is a single-file mailbox format invented for the Multichannel " "Memorandum Distribution Facility, a mail transfer agent. Each message is in " @@ -965,52 +974,52 @@ msgid "" "subsequent messages." msgstr "" -#: ../../library/mailbox.rst:850 +#: ../../library/mailbox.rst:865 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!MMDF` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:856 +#: ../../library/mailbox.rst:877 msgid "" "Using the file after calling :meth:`~Mailbox.flush` or :meth:`~Mailbox." "close` on the :class:`!MMDF` instance may yield unpredictable results or " "raise an exception." msgstr "" -#: ../../library/mailbox.rst:870 +#: ../../library/mailbox.rst:895 msgid "" "`mmdf man page from tin `_" msgstr "" -#: ../../library/mailbox.rst:871 +#: ../../library/mailbox.rst:896 msgid "" "A specification of MMDF format from the documentation of tin, a newsreader." msgstr "" -#: ../../library/mailbox.rst:873 +#: ../../library/mailbox.rst:898 msgid "`MMDF `_" msgstr "`MMDF `_" -#: ../../library/mailbox.rst:874 +#: ../../library/mailbox.rst:899 msgid "" "A Wikipedia article describing the Multichannel Memorandum Distribution " "Facility." msgstr "" -#: ../../library/mailbox.rst:881 +#: ../../library/mailbox.rst:906 msgid ":class:`!Message` objects" msgstr ":class:`!Message` 物件" -#: ../../library/mailbox.rst:886 +#: ../../library/mailbox.rst:911 msgid "" "A subclass of the :mod:`email.message` module's :class:`~email.message." "Message`. Subclasses of :class:`!mailbox.Message` add mailbox-format-" "specific state and behavior." msgstr "" -#: ../../library/mailbox.rst:890 +#: ../../library/mailbox.rst:915 msgid "" "If *message* is omitted, the new instance is created in a default, empty " "state. If *message* is an :class:`email.message.Message` instance, its " @@ -1022,7 +1031,7 @@ msgid "" "compatibility." msgstr "" -#: ../../library/mailbox.rst:899 +#: ../../library/mailbox.rst:924 msgid "" "The format-specific state and behaviors offered by subclasses vary, but in " "general it is only the properties that are not specific to a particular " @@ -1034,7 +1043,7 @@ msgid "" "important is retained, because it applies to the message itself." msgstr "" -#: ../../library/mailbox.rst:908 +#: ../../library/mailbox.rst:933 msgid "" "There is no requirement that :class:`!Message` instances be used to " "represent messages retrieved using :class:`Mailbox` instances. In some " @@ -1045,17 +1054,17 @@ msgid "" "initialized." msgstr "" -#: ../../library/mailbox.rst:919 +#: ../../library/mailbox.rst:944 msgid ":class:`!MaildirMessage` objects" msgstr ":class:`!MaildirMessage` 物件" -#: ../../library/mailbox.rst:924 +#: ../../library/mailbox.rst:949 msgid "" "A message with Maildir-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:927 +#: ../../library/mailbox.rst:952 msgid "" "Typically, a mail user agent application moves all of the messages in the :" "file:`new` subdirectory to the :file:`cur` subdirectory after the first time " @@ -1069,128 +1078,128 @@ msgid "" "flags for Maildir messages are as follows:" msgstr "" -#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1106 -#: ../../library/mailbox.rst:1477 +#: ../../library/mailbox.rst:964 ../../library/mailbox.rst:1131 +#: ../../library/mailbox.rst:1502 msgid "Flag" msgstr "" -#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1106 -#: ../../library/mailbox.rst:1477 +#: ../../library/mailbox.rst:964 ../../library/mailbox.rst:1131 +#: ../../library/mailbox.rst:1502 msgid "Meaning" msgstr "含義" -#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1106 -#: ../../library/mailbox.rst:1257 ../../library/mailbox.rst:1344 -#: ../../library/mailbox.rst:1477 +#: ../../library/mailbox.rst:964 ../../library/mailbox.rst:1131 +#: ../../library/mailbox.rst:1282 ../../library/mailbox.rst:1369 +#: ../../library/mailbox.rst:1502 msgid "Explanation" msgstr "" -#: ../../library/mailbox.rst:941 ../../library/mailbox.rst:1112 -#: ../../library/mailbox.rst:1483 +#: ../../library/mailbox.rst:966 ../../library/mailbox.rst:1137 +#: ../../library/mailbox.rst:1508 msgid "D" msgstr "D" -#: ../../library/mailbox.rst:941 +#: ../../library/mailbox.rst:966 msgid "Draft" msgstr "" -#: ../../library/mailbox.rst:941 +#: ../../library/mailbox.rst:966 msgid "Under composition" msgstr "" -#: ../../library/mailbox.rst:943 ../../library/mailbox.rst:1114 -#: ../../library/mailbox.rst:1485 +#: ../../library/mailbox.rst:968 ../../library/mailbox.rst:1139 +#: ../../library/mailbox.rst:1510 msgid "F" msgstr "F" -#: ../../library/mailbox.rst:943 ../../library/mailbox.rst:1114 -#: ../../library/mailbox.rst:1485 +#: ../../library/mailbox.rst:968 ../../library/mailbox.rst:1139 +#: ../../library/mailbox.rst:1510 msgid "Flagged" msgstr "" -#: ../../library/mailbox.rst:943 ../../library/mailbox.rst:1114 -#: ../../library/mailbox.rst:1263 ../../library/mailbox.rst:1485 +#: ../../library/mailbox.rst:968 ../../library/mailbox.rst:1139 +#: ../../library/mailbox.rst:1288 ../../library/mailbox.rst:1510 msgid "Marked as important" msgstr "" -#: ../../library/mailbox.rst:945 +#: ../../library/mailbox.rst:970 msgid "P" msgstr "P" -#: ../../library/mailbox.rst:945 +#: ../../library/mailbox.rst:970 msgid "Passed" msgstr "" -#: ../../library/mailbox.rst:945 +#: ../../library/mailbox.rst:970 msgid "Forwarded, resent, or bounced" msgstr "" -#: ../../library/mailbox.rst:947 ../../library/mailbox.rst:1108 -#: ../../library/mailbox.rst:1479 +#: ../../library/mailbox.rst:972 ../../library/mailbox.rst:1133 +#: ../../library/mailbox.rst:1504 msgid "R" msgstr "R" -#: ../../library/mailbox.rst:947 +#: ../../library/mailbox.rst:972 msgid "Replied" msgstr "" -#: ../../library/mailbox.rst:947 ../../library/mailbox.rst:1116 -#: ../../library/mailbox.rst:1261 ../../library/mailbox.rst:1352 -#: ../../library/mailbox.rst:1487 +#: ../../library/mailbox.rst:972 ../../library/mailbox.rst:1141 +#: ../../library/mailbox.rst:1286 ../../library/mailbox.rst:1377 +#: ../../library/mailbox.rst:1512 msgid "Replied to" msgstr "" -#: ../../library/mailbox.rst:949 +#: ../../library/mailbox.rst:974 msgid "S" msgstr "S" -#: ../../library/mailbox.rst:949 +#: ../../library/mailbox.rst:974 msgid "Seen" msgstr "" -#: ../../library/mailbox.rst:949 ../../library/mailbox.rst:1108 -#: ../../library/mailbox.rst:1479 +#: ../../library/mailbox.rst:974 ../../library/mailbox.rst:1133 +#: ../../library/mailbox.rst:1504 msgid "Read" msgstr "" -#: ../../library/mailbox.rst:951 +#: ../../library/mailbox.rst:976 msgid "T" msgstr "T" -#: ../../library/mailbox.rst:951 +#: ../../library/mailbox.rst:976 msgid "Trashed" msgstr "" -#: ../../library/mailbox.rst:951 ../../library/mailbox.rst:1112 -#: ../../library/mailbox.rst:1348 ../../library/mailbox.rst:1483 +#: ../../library/mailbox.rst:976 ../../library/mailbox.rst:1137 +#: ../../library/mailbox.rst:1373 ../../library/mailbox.rst:1508 msgid "Marked for subsequent deletion" msgstr "" -#: ../../library/mailbox.rst:954 +#: ../../library/mailbox.rst:979 msgid ":class:`!MaildirMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:959 +#: ../../library/mailbox.rst:984 msgid "" "Return either \"new\" (if the message should be stored in the :file:`new` " "subdirectory) or \"cur\" (if the message should be stored in the :file:`cur` " "subdirectory)." msgstr "" -#: ../../library/mailbox.rst:965 +#: ../../library/mailbox.rst:990 msgid "" "A message is typically moved from :file:`new` to :file:`cur` after its " "mailbox has been accessed, whether or not the message has been read. A " "message ``msg`` has been read if ``\"S\" in msg.get_flags()`` is ``True``." msgstr "" -#: ../../library/mailbox.rst:973 +#: ../../library/mailbox.rst:998 msgid "" "Set the subdirectory the message should be stored in. Parameter *subdir* " "must be either \"new\" or \"cur\"." msgstr "" -#: ../../library/mailbox.rst:979 +#: ../../library/mailbox.rst:1004 msgid "" "Return a string specifying the flags that are currently set. If the message " "complies with the standard Maildir format, the result is the concatenation " @@ -1199,11 +1208,11 @@ msgid "" "flags are set or if \"info\" contains experimental semantics." msgstr "" -#: ../../library/mailbox.rst:989 +#: ../../library/mailbox.rst:1014 msgid "Set the flags specified by *flags* and unset all others." msgstr "" -#: ../../library/mailbox.rst:994 +#: ../../library/mailbox.rst:1019 msgid "" "Set the flag(s) specified by *flag* without changing other flags. To add " "more than one flag at a time, *flag* may be a string of more than one " @@ -1211,7 +1220,7 @@ msgid "" "experimental information rather than flags." msgstr "" -#: ../../library/mailbox.rst:1002 +#: ../../library/mailbox.rst:1027 msgid "" "Unset the flag(s) specified by *flag* without changing other flags. To " "remove more than one flag at a time, *flag* maybe a string of more than one " @@ -1219,30 +1228,30 @@ msgid "" "the current \"info\" is not modified." msgstr "" -#: ../../library/mailbox.rst:1010 +#: ../../library/mailbox.rst:1035 msgid "" "Return the delivery date of the message as a floating-point number " "representing seconds since the epoch." msgstr "" -#: ../../library/mailbox.rst:1016 +#: ../../library/mailbox.rst:1041 msgid "" "Set the delivery date of the message to *date*, a floating-point number " "representing seconds since the epoch." msgstr "" -#: ../../library/mailbox.rst:1022 +#: ../../library/mailbox.rst:1047 msgid "" "Return a string containing the \"info\" for a message. This is useful for " "accessing and modifying \"info\" that is experimental (i.e., not a list of " "flags)." msgstr "" -#: ../../library/mailbox.rst:1029 +#: ../../library/mailbox.rst:1054 msgid "Set \"info\" to *info*, which should be a string." msgstr "" -#: ../../library/mailbox.rst:1031 +#: ../../library/mailbox.rst:1056 msgid "" "When a :class:`!MaildirMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1250,176 +1259,176 @@ msgid "" "take place:" msgstr "" -#: ../../library/mailbox.rst:1037 ../../library/mailbox.rst:1055 -#: ../../library/mailbox.rst:1070 ../../library/mailbox.rst:1177 -#: ../../library/mailbox.rst:1194 ../../library/mailbox.rst:1209 -#: ../../library/mailbox.rst:1225 ../../library/mailbox.rst:1292 -#: ../../library/mailbox.rst:1307 ../../library/mailbox.rst:1321 -#: ../../library/mailbox.rst:1418 ../../library/mailbox.rst:1435 -#: ../../library/mailbox.rst:1449 ../../library/mailbox.rst:1549 -#: ../../library/mailbox.rst:1566 ../../library/mailbox.rst:1581 -#: ../../library/mailbox.rst:1597 +#: ../../library/mailbox.rst:1062 ../../library/mailbox.rst:1080 +#: ../../library/mailbox.rst:1095 ../../library/mailbox.rst:1202 +#: ../../library/mailbox.rst:1219 ../../library/mailbox.rst:1234 +#: ../../library/mailbox.rst:1250 ../../library/mailbox.rst:1317 +#: ../../library/mailbox.rst:1332 ../../library/mailbox.rst:1346 +#: ../../library/mailbox.rst:1443 ../../library/mailbox.rst:1460 +#: ../../library/mailbox.rst:1474 ../../library/mailbox.rst:1574 +#: ../../library/mailbox.rst:1591 ../../library/mailbox.rst:1606 +#: ../../library/mailbox.rst:1622 msgid "Resulting state" msgstr "" -#: ../../library/mailbox.rst:1037 ../../library/mailbox.rst:1307 -#: ../../library/mailbox.rst:1435 +#: ../../library/mailbox.rst:1062 ../../library/mailbox.rst:1332 +#: ../../library/mailbox.rst:1460 msgid ":class:`mboxMessage` or :class:`MMDFMessage` state" msgstr "" -#: ../../library/mailbox.rst:1040 ../../library/mailbox.rst:1057 -#: ../../library/mailbox.rst:1072 ../../library/mailbox.rst:1181 -#: ../../library/mailbox.rst:1553 +#: ../../library/mailbox.rst:1065 ../../library/mailbox.rst:1082 +#: ../../library/mailbox.rst:1097 ../../library/mailbox.rst:1206 +#: ../../library/mailbox.rst:1578 msgid "\"cur\" subdirectory" msgstr "" -#: ../../library/mailbox.rst:1040 ../../library/mailbox.rst:1181 -#: ../../library/mailbox.rst:1198 ../../library/mailbox.rst:1213 -#: ../../library/mailbox.rst:1229 ../../library/mailbox.rst:1553 -#: ../../library/mailbox.rst:1570 ../../library/mailbox.rst:1585 -#: ../../library/mailbox.rst:1601 +#: ../../library/mailbox.rst:1065 ../../library/mailbox.rst:1206 +#: ../../library/mailbox.rst:1223 ../../library/mailbox.rst:1238 +#: ../../library/mailbox.rst:1254 ../../library/mailbox.rst:1578 +#: ../../library/mailbox.rst:1595 ../../library/mailbox.rst:1610 +#: ../../library/mailbox.rst:1626 msgid "O flag" msgstr "" -#: ../../library/mailbox.rst:1042 ../../library/mailbox.rst:1061 -#: ../../library/mailbox.rst:1185 ../../library/mailbox.rst:1200 -#: ../../library/mailbox.rst:1233 ../../library/mailbox.rst:1298 -#: ../../library/mailbox.rst:1314 ../../library/mailbox.rst:1557 -#: ../../library/mailbox.rst:1572 ../../library/mailbox.rst:1605 +#: ../../library/mailbox.rst:1067 ../../library/mailbox.rst:1086 +#: ../../library/mailbox.rst:1210 ../../library/mailbox.rst:1225 +#: ../../library/mailbox.rst:1258 ../../library/mailbox.rst:1323 +#: ../../library/mailbox.rst:1339 ../../library/mailbox.rst:1582 +#: ../../library/mailbox.rst:1597 ../../library/mailbox.rst:1630 msgid "F flag" msgstr "" -#: ../../library/mailbox.rst:1044 ../../library/mailbox.rst:1046 -#: ../../library/mailbox.rst:1063 ../../library/mailbox.rst:1078 -#: ../../library/mailbox.rst:1179 ../../library/mailbox.rst:1187 -#: ../../library/mailbox.rst:1227 ../../library/mailbox.rst:1296 -#: ../../library/mailbox.rst:1424 ../../library/mailbox.rst:1551 -#: ../../library/mailbox.rst:1559 ../../library/mailbox.rst:1599 +#: ../../library/mailbox.rst:1069 ../../library/mailbox.rst:1071 +#: ../../library/mailbox.rst:1088 ../../library/mailbox.rst:1103 +#: ../../library/mailbox.rst:1204 ../../library/mailbox.rst:1212 +#: ../../library/mailbox.rst:1252 ../../library/mailbox.rst:1321 +#: ../../library/mailbox.rst:1449 ../../library/mailbox.rst:1576 +#: ../../library/mailbox.rst:1584 ../../library/mailbox.rst:1624 msgid "R flag" msgstr "" -#: ../../library/mailbox.rst:1044 ../../library/mailbox.rst:1187 -#: ../../library/mailbox.rst:1202 ../../library/mailbox.rst:1217 -#: ../../library/mailbox.rst:1235 ../../library/mailbox.rst:1312 -#: ../../library/mailbox.rst:1442 ../../library/mailbox.rst:1559 -#: ../../library/mailbox.rst:1574 ../../library/mailbox.rst:1589 -#: ../../library/mailbox.rst:1607 +#: ../../library/mailbox.rst:1069 ../../library/mailbox.rst:1212 +#: ../../library/mailbox.rst:1227 ../../library/mailbox.rst:1242 +#: ../../library/mailbox.rst:1260 ../../library/mailbox.rst:1337 +#: ../../library/mailbox.rst:1467 ../../library/mailbox.rst:1584 +#: ../../library/mailbox.rst:1599 ../../library/mailbox.rst:1614 +#: ../../library/mailbox.rst:1632 msgid "A flag" msgstr "" -#: ../../library/mailbox.rst:1046 ../../library/mailbox.rst:1179 -#: ../../library/mailbox.rst:1551 +#: ../../library/mailbox.rst:1071 ../../library/mailbox.rst:1204 +#: ../../library/mailbox.rst:1576 msgid "S flag" msgstr "" -#: ../../library/mailbox.rst:1048 ../../library/mailbox.rst:1080 -#: ../../library/mailbox.rst:1183 ../../library/mailbox.rst:1422 -#: ../../library/mailbox.rst:1555 +#: ../../library/mailbox.rst:1073 ../../library/mailbox.rst:1105 +#: ../../library/mailbox.rst:1208 ../../library/mailbox.rst:1447 +#: ../../library/mailbox.rst:1580 msgid "T flag" msgstr "" -#: ../../library/mailbox.rst:1048 ../../library/mailbox.rst:1183 -#: ../../library/mailbox.rst:1215 ../../library/mailbox.rst:1231 -#: ../../library/mailbox.rst:1440 ../../library/mailbox.rst:1555 -#: ../../library/mailbox.rst:1587 ../../library/mailbox.rst:1603 +#: ../../library/mailbox.rst:1073 ../../library/mailbox.rst:1208 +#: ../../library/mailbox.rst:1240 ../../library/mailbox.rst:1256 +#: ../../library/mailbox.rst:1465 ../../library/mailbox.rst:1580 +#: ../../library/mailbox.rst:1612 ../../library/mailbox.rst:1628 msgid "D flag" msgstr "" -#: ../../library/mailbox.rst:1051 +#: ../../library/mailbox.rst:1076 msgid "" "When a :class:`!MaildirMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1055 ../../library/mailbox.rst:1194 -#: ../../library/mailbox.rst:1449 ../../library/mailbox.rst:1566 +#: ../../library/mailbox.rst:1080 ../../library/mailbox.rst:1219 +#: ../../library/mailbox.rst:1474 ../../library/mailbox.rst:1591 msgid ":class:`MHMessage` state" msgstr "" -#: ../../library/mailbox.rst:1057 ../../library/mailbox.rst:1198 -#: ../../library/mailbox.rst:1294 ../../library/mailbox.rst:1310 -#: ../../library/mailbox.rst:1323 ../../library/mailbox.rst:1451 -#: ../../library/mailbox.rst:1570 +#: ../../library/mailbox.rst:1082 ../../library/mailbox.rst:1223 +#: ../../library/mailbox.rst:1319 ../../library/mailbox.rst:1335 +#: ../../library/mailbox.rst:1348 ../../library/mailbox.rst:1476 +#: ../../library/mailbox.rst:1595 msgid "\"unseen\" sequence" msgstr "" -#: ../../library/mailbox.rst:1059 ../../library/mailbox.rst:1074 +#: ../../library/mailbox.rst:1084 ../../library/mailbox.rst:1099 msgid "\"cur\" subdirectory and S flag" msgstr "" -#: ../../library/mailbox.rst:1059 ../../library/mailbox.rst:1196 -#: ../../library/mailbox.rst:1568 +#: ../../library/mailbox.rst:1084 ../../library/mailbox.rst:1221 +#: ../../library/mailbox.rst:1593 msgid "no \"unseen\" sequence" msgstr "" -#: ../../library/mailbox.rst:1061 ../../library/mailbox.rst:1200 -#: ../../library/mailbox.rst:1298 ../../library/mailbox.rst:1314 -#: ../../library/mailbox.rst:1572 +#: ../../library/mailbox.rst:1086 ../../library/mailbox.rst:1225 +#: ../../library/mailbox.rst:1323 ../../library/mailbox.rst:1339 +#: ../../library/mailbox.rst:1597 msgid "\"flagged\" sequence" msgstr "" -#: ../../library/mailbox.rst:1063 ../../library/mailbox.rst:1202 -#: ../../library/mailbox.rst:1296 ../../library/mailbox.rst:1312 -#: ../../library/mailbox.rst:1325 ../../library/mailbox.rst:1453 -#: ../../library/mailbox.rst:1574 +#: ../../library/mailbox.rst:1088 ../../library/mailbox.rst:1227 +#: ../../library/mailbox.rst:1321 ../../library/mailbox.rst:1337 +#: ../../library/mailbox.rst:1350 ../../library/mailbox.rst:1478 +#: ../../library/mailbox.rst:1599 msgid "\"replied\" sequence" msgstr "" -#: ../../library/mailbox.rst:1066 +#: ../../library/mailbox.rst:1091 msgid "" "When a :class:`!MaildirMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1070 ../../library/mailbox.rst:1209 -#: ../../library/mailbox.rst:1321 ../../library/mailbox.rst:1581 +#: ../../library/mailbox.rst:1095 ../../library/mailbox.rst:1234 +#: ../../library/mailbox.rst:1346 ../../library/mailbox.rst:1606 msgid ":class:`BabylMessage` state" msgstr "" -#: ../../library/mailbox.rst:1072 ../../library/mailbox.rst:1213 -#: ../../library/mailbox.rst:1323 ../../library/mailbox.rst:1420 -#: ../../library/mailbox.rst:1438 ../../library/mailbox.rst:1451 -#: ../../library/mailbox.rst:1585 +#: ../../library/mailbox.rst:1097 ../../library/mailbox.rst:1238 +#: ../../library/mailbox.rst:1348 ../../library/mailbox.rst:1445 +#: ../../library/mailbox.rst:1463 ../../library/mailbox.rst:1476 +#: ../../library/mailbox.rst:1610 msgid "\"unseen\" label" msgstr "" -#: ../../library/mailbox.rst:1074 ../../library/mailbox.rst:1211 -#: ../../library/mailbox.rst:1583 +#: ../../library/mailbox.rst:1099 ../../library/mailbox.rst:1236 +#: ../../library/mailbox.rst:1608 msgid "no \"unseen\" label" msgstr "" -#: ../../library/mailbox.rst:1076 ../../library/mailbox.rst:1426 +#: ../../library/mailbox.rst:1101 ../../library/mailbox.rst:1451 msgid "P flag" msgstr "" -#: ../../library/mailbox.rst:1076 +#: ../../library/mailbox.rst:1101 msgid "\"forwarded\" or \"resent\" label" msgstr "" -#: ../../library/mailbox.rst:1078 ../../library/mailbox.rst:1217 -#: ../../library/mailbox.rst:1325 ../../library/mailbox.rst:1424 -#: ../../library/mailbox.rst:1442 ../../library/mailbox.rst:1453 -#: ../../library/mailbox.rst:1589 +#: ../../library/mailbox.rst:1103 ../../library/mailbox.rst:1242 +#: ../../library/mailbox.rst:1350 ../../library/mailbox.rst:1449 +#: ../../library/mailbox.rst:1467 ../../library/mailbox.rst:1478 +#: ../../library/mailbox.rst:1614 msgid "\"answered\" label" msgstr "" -#: ../../library/mailbox.rst:1080 ../../library/mailbox.rst:1215 -#: ../../library/mailbox.rst:1422 ../../library/mailbox.rst:1440 -#: ../../library/mailbox.rst:1587 +#: ../../library/mailbox.rst:1105 ../../library/mailbox.rst:1240 +#: ../../library/mailbox.rst:1447 ../../library/mailbox.rst:1465 +#: ../../library/mailbox.rst:1612 msgid "\"deleted\" label" msgstr "" -#: ../../library/mailbox.rst:1087 +#: ../../library/mailbox.rst:1112 msgid ":class:`!mboxMessage` objects" msgstr ":class:`!mboxMessage` 物件" -#: ../../library/mailbox.rst:1092 +#: ../../library/mailbox.rst:1117 msgid "" "A message with mbox-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1095 +#: ../../library/mailbox.rst:1120 msgid "" "Messages in an mbox mailbox are stored together in a single file. The " "sender's envelope address and the time of delivery are typically stored in a " @@ -1430,53 +1439,53 @@ msgid "" "typically stored in :mailheader:`Status` and :mailheader:`X-Status` headers." msgstr "" -#: ../../library/mailbox.rst:1103 +#: ../../library/mailbox.rst:1128 msgid "Conventional flags for mbox messages are as follows:" msgstr "" -#: ../../library/mailbox.rst:1110 ../../library/mailbox.rst:1481 +#: ../../library/mailbox.rst:1135 ../../library/mailbox.rst:1506 msgid "O" msgstr "O" -#: ../../library/mailbox.rst:1110 ../../library/mailbox.rst:1481 +#: ../../library/mailbox.rst:1135 ../../library/mailbox.rst:1506 msgid "Old" msgstr "" -#: ../../library/mailbox.rst:1110 ../../library/mailbox.rst:1481 +#: ../../library/mailbox.rst:1135 ../../library/mailbox.rst:1506 msgid "Previously detected by MUA" msgstr "" -#: ../../library/mailbox.rst:1112 ../../library/mailbox.rst:1483 +#: ../../library/mailbox.rst:1137 ../../library/mailbox.rst:1508 msgid "Deleted" msgstr "" -#: ../../library/mailbox.rst:1116 ../../library/mailbox.rst:1487 +#: ../../library/mailbox.rst:1141 ../../library/mailbox.rst:1512 msgid "A" msgstr "A" -#: ../../library/mailbox.rst:1116 ../../library/mailbox.rst:1487 +#: ../../library/mailbox.rst:1141 ../../library/mailbox.rst:1512 msgid "Answered" msgstr "" -#: ../../library/mailbox.rst:1119 ../../library/mailbox.rst:1490 +#: ../../library/mailbox.rst:1144 ../../library/mailbox.rst:1515 msgid "" "The \"R\" and \"O\" flags are stored in the :mailheader:`Status` header, and " "the \"D\", \"F\", and \"A\" flags are stored in the :mailheader:`X-Status` " "header. The flags and headers typically appear in the order mentioned." msgstr "" -#: ../../library/mailbox.rst:1123 +#: ../../library/mailbox.rst:1148 msgid ":class:`!mboxMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:1128 ../../library/mailbox.rst:1500 +#: ../../library/mailbox.rst:1153 ../../library/mailbox.rst:1525 msgid "" "Return a string representing the \"From \" line that marks the start of the " "message in an mbox mailbox. The leading \"From \" and the trailing newline " "are excluded." msgstr "" -#: ../../library/mailbox.rst:1135 ../../library/mailbox.rst:1507 +#: ../../library/mailbox.rst:1160 ../../library/mailbox.rst:1532 msgid "" "Set the \"From \" line to *from_*, which should be specified without a " "leading \"From \" or trailing newline. For convenience, *time_* may be " @@ -1486,7 +1495,7 @@ msgid "" "func:`time.gmtime`)." msgstr "" -#: ../../library/mailbox.rst:1145 ../../library/mailbox.rst:1517 +#: ../../library/mailbox.rst:1170 ../../library/mailbox.rst:1542 msgid "" "Return a string specifying the flags that are currently set. If the message " "complies with the conventional format, the result is the concatenation in " @@ -1494,28 +1503,28 @@ msgid "" "``'D'``, ``'F'``, and ``'A'``." msgstr "" -#: ../../library/mailbox.rst:1153 ../../library/mailbox.rst:1525 +#: ../../library/mailbox.rst:1178 ../../library/mailbox.rst:1550 msgid "" "Set the flags specified by *flags* and unset all others. Parameter *flags* " "should be the concatenation in any order of zero or more occurrences of each " "of ``'R'``, ``'O'``, ``'D'``, ``'F'``, and ``'A'``." msgstr "" -#: ../../library/mailbox.rst:1160 ../../library/mailbox.rst:1532 +#: ../../library/mailbox.rst:1185 ../../library/mailbox.rst:1557 msgid "" "Set the flag(s) specified by *flag* without changing other flags. To add " "more than one flag at a time, *flag* may be a string of more than one " "character." msgstr "" -#: ../../library/mailbox.rst:1167 ../../library/mailbox.rst:1539 +#: ../../library/mailbox.rst:1192 ../../library/mailbox.rst:1564 msgid "" "Unset the flag(s) specified by *flag* without changing other flags. To " "remove more than one flag at a time, *flag* maybe a string of more than one " "character." msgstr "" -#: ../../library/mailbox.rst:1171 +#: ../../library/mailbox.rst:1196 msgid "" "When an :class:`!mboxMessage` instance is created based upon a :class:" "`MaildirMessage` instance, a \"From \" line is generated based upon the :" @@ -1523,50 +1532,50 @@ msgid "" "conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1177 ../../library/mailbox.rst:1292 -#: ../../library/mailbox.rst:1418 ../../library/mailbox.rst:1549 +#: ../../library/mailbox.rst:1202 ../../library/mailbox.rst:1317 +#: ../../library/mailbox.rst:1443 ../../library/mailbox.rst:1574 msgid ":class:`MaildirMessage` state" msgstr "" -#: ../../library/mailbox.rst:1190 +#: ../../library/mailbox.rst:1215 msgid "" "When an :class:`!mboxMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1196 ../../library/mailbox.rst:1211 -#: ../../library/mailbox.rst:1568 ../../library/mailbox.rst:1583 +#: ../../library/mailbox.rst:1221 ../../library/mailbox.rst:1236 +#: ../../library/mailbox.rst:1593 ../../library/mailbox.rst:1608 msgid "R flag and O flag" msgstr "" -#: ../../library/mailbox.rst:1205 +#: ../../library/mailbox.rst:1230 msgid "" "When an :class:`!mboxMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1220 +#: ../../library/mailbox.rst:1245 msgid "" "When a :class:`!mboxMessage` instance is created based upon an :class:" "`MMDFMessage` instance, the \"From \" line is copied and all flags directly " "correspond:" msgstr "" -#: ../../library/mailbox.rst:1225 +#: ../../library/mailbox.rst:1250 msgid ":class:`MMDFMessage` state" msgstr "" -#: ../../library/mailbox.rst:1242 +#: ../../library/mailbox.rst:1267 msgid ":class:`!MHMessage` objects" msgstr ":class:`!MHMessage` 物件" -#: ../../library/mailbox.rst:1247 +#: ../../library/mailbox.rst:1272 msgid "" "A message with MH-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1250 +#: ../../library/mailbox.rst:1275 msgid "" "MH messages do not support marks or flags in the traditional sense, but they " "do support sequences, which are logical groupings of arbitrary messages. " @@ -1575,57 +1584,57 @@ msgid "" "formats, as follows:" msgstr "" -#: ../../library/mailbox.rst:1257 +#: ../../library/mailbox.rst:1282 msgid "Sequence" msgstr "" -#: ../../library/mailbox.rst:1259 ../../library/mailbox.rst:1346 +#: ../../library/mailbox.rst:1284 ../../library/mailbox.rst:1371 msgid "unseen" msgstr "" -#: ../../library/mailbox.rst:1259 ../../library/mailbox.rst:1346 +#: ../../library/mailbox.rst:1284 ../../library/mailbox.rst:1371 msgid "Not read, but previously detected by MUA" msgstr "" -#: ../../library/mailbox.rst:1261 +#: ../../library/mailbox.rst:1286 msgid "replied" msgstr "" -#: ../../library/mailbox.rst:1263 +#: ../../library/mailbox.rst:1288 msgid "flagged" msgstr "" -#: ../../library/mailbox.rst:1266 +#: ../../library/mailbox.rst:1291 msgid ":class:`!MHMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:1271 +#: ../../library/mailbox.rst:1296 msgid "Return a list of the names of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1276 +#: ../../library/mailbox.rst:1301 msgid "Set the list of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1281 +#: ../../library/mailbox.rst:1306 msgid "Add *sequence* to the list of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1286 +#: ../../library/mailbox.rst:1311 msgid "Remove *sequence* from the list of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1288 +#: ../../library/mailbox.rst:1313 msgid "" "When an :class:`!MHMessage` instance is created based upon a :class:" "`MaildirMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1294 ../../library/mailbox.rst:1420 +#: ../../library/mailbox.rst:1319 ../../library/mailbox.rst:1445 msgid "no S flag" msgstr "" -#: ../../library/mailbox.rst:1301 +#: ../../library/mailbox.rst:1326 msgid "" "When an :class:`!MHMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1633,110 +1642,110 @@ msgid "" "take place:" msgstr "" -#: ../../library/mailbox.rst:1310 ../../library/mailbox.rst:1438 +#: ../../library/mailbox.rst:1335 ../../library/mailbox.rst:1463 msgid "no R flag" msgstr "" -#: ../../library/mailbox.rst:1317 +#: ../../library/mailbox.rst:1342 msgid "" "When an :class:`!MHMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1332 +#: ../../library/mailbox.rst:1357 msgid ":class:`!BabylMessage` objects" msgstr ":class:`!BabylMessage` 物件" -#: ../../library/mailbox.rst:1337 +#: ../../library/mailbox.rst:1362 msgid "" "A message with Babyl-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1340 +#: ../../library/mailbox.rst:1365 msgid "" "Certain message labels, called :dfn:`attributes`, are defined by convention " "to have special meanings. The attributes are as follows:" msgstr "" -#: ../../library/mailbox.rst:1344 +#: ../../library/mailbox.rst:1369 msgid "Label" msgstr "" -#: ../../library/mailbox.rst:1348 +#: ../../library/mailbox.rst:1373 msgid "deleted" msgstr "" -#: ../../library/mailbox.rst:1350 +#: ../../library/mailbox.rst:1375 msgid "filed" msgstr "" -#: ../../library/mailbox.rst:1350 +#: ../../library/mailbox.rst:1375 msgid "Copied to another file or mailbox" msgstr "" -#: ../../library/mailbox.rst:1352 +#: ../../library/mailbox.rst:1377 msgid "answered" msgstr "" -#: ../../library/mailbox.rst:1354 +#: ../../library/mailbox.rst:1379 msgid "forwarded" msgstr "" -#: ../../library/mailbox.rst:1354 +#: ../../library/mailbox.rst:1379 msgid "Forwarded" msgstr "" -#: ../../library/mailbox.rst:1356 +#: ../../library/mailbox.rst:1381 msgid "edited" msgstr "" -#: ../../library/mailbox.rst:1356 +#: ../../library/mailbox.rst:1381 msgid "Modified by the user" msgstr "" -#: ../../library/mailbox.rst:1358 +#: ../../library/mailbox.rst:1383 msgid "resent" msgstr "" -#: ../../library/mailbox.rst:1358 +#: ../../library/mailbox.rst:1383 msgid "Resent" msgstr "" -#: ../../library/mailbox.rst:1361 +#: ../../library/mailbox.rst:1386 msgid "" "By default, Rmail displays only visible headers. The :class:`!BabylMessage` " "class, though, uses the original headers because they are more complete. " "Visible headers may be accessed explicitly if desired." msgstr "" -#: ../../library/mailbox.rst:1365 +#: ../../library/mailbox.rst:1390 msgid ":class:`!BabylMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:1370 +#: ../../library/mailbox.rst:1395 msgid "Return a list of labels on the message." msgstr "" -#: ../../library/mailbox.rst:1375 +#: ../../library/mailbox.rst:1400 msgid "Set the list of labels on the message to *labels*." msgstr "" -#: ../../library/mailbox.rst:1380 +#: ../../library/mailbox.rst:1405 msgid "Add *label* to the list of labels on the message." msgstr "" -#: ../../library/mailbox.rst:1385 +#: ../../library/mailbox.rst:1410 msgid "Remove *label* from the list of labels on the message." msgstr "" -#: ../../library/mailbox.rst:1390 +#: ../../library/mailbox.rst:1415 msgid "" "Return a :class:`Message` instance whose headers are the message's visible " "headers and whose body is empty." msgstr "" -#: ../../library/mailbox.rst:1396 +#: ../../library/mailbox.rst:1421 msgid "" "Set the message's visible headers to be the same as the headers in " "*message*. Parameter *visible* should be a :class:`Message` instance, an :" @@ -1744,7 +1753,7 @@ msgid "" "(which should be open in text mode)." msgstr "" -#: ../../library/mailbox.rst:1404 +#: ../../library/mailbox.rst:1429 msgid "" "When a :class:`!BabylMessage` instance's original headers are modified, the " "visible headers are not automatically modified to correspond. This method " @@ -1757,17 +1766,17 @@ msgid "" "visible headers." msgstr "" -#: ../../library/mailbox.rst:1414 +#: ../../library/mailbox.rst:1439 msgid "" "When a :class:`!BabylMessage` instance is created based upon a :class:" "`MaildirMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1426 +#: ../../library/mailbox.rst:1451 msgid "\"forwarded\" label" msgstr "" -#: ../../library/mailbox.rst:1429 +#: ../../library/mailbox.rst:1454 msgid "" "When a :class:`!BabylMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1775,23 +1784,23 @@ msgid "" "take place:" msgstr "" -#: ../../library/mailbox.rst:1445 +#: ../../library/mailbox.rst:1470 msgid "" "When a :class:`!BabylMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1460 +#: ../../library/mailbox.rst:1485 msgid ":class:`!MMDFMessage` objects" msgstr ":class:`!MMDFMessage` 物件" -#: ../../library/mailbox.rst:1465 +#: ../../library/mailbox.rst:1490 msgid "" "A message with MMDF-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1468 +#: ../../library/mailbox.rst:1493 msgid "" "As with message in an mbox mailbox, MMDF messages are stored with the " "sender's address and the delivery date in an initial line beginning with " @@ -1799,19 +1808,19 @@ msgid "" "typically stored in :mailheader:`Status` and :mailheader:`X-Status` headers." msgstr "" -#: ../../library/mailbox.rst:1473 +#: ../../library/mailbox.rst:1498 msgid "" "Conventional flags for MMDF messages are identical to those of mbox message " "and are as follows:" msgstr "" -#: ../../library/mailbox.rst:1494 +#: ../../library/mailbox.rst:1519 msgid "" ":class:`!MMDFMessage` instances offer the following methods, which are " "identical to those offered by :class:`mboxMessage`:" msgstr "" -#: ../../library/mailbox.rst:1543 +#: ../../library/mailbox.rst:1568 msgid "" "When an :class:`!MMDFMessage` instance is created based upon a :class:" "`MaildirMessage` instance, a \"From \" line is generated based upon the :" @@ -1819,43 +1828,43 @@ msgid "" "conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1562 +#: ../../library/mailbox.rst:1587 msgid "" "When an :class:`!MMDFMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1577 +#: ../../library/mailbox.rst:1602 msgid "" "When an :class:`!MMDFMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1592 +#: ../../library/mailbox.rst:1617 msgid "" "When an :class:`!MMDFMessage` instance is created based upon an :class:" "`mboxMessage` instance, the \"From \" line is copied and all flags directly " "correspond:" msgstr "" -#: ../../library/mailbox.rst:1597 +#: ../../library/mailbox.rst:1622 msgid ":class:`mboxMessage` state" msgstr "" -#: ../../library/mailbox.rst:1612 +#: ../../library/mailbox.rst:1637 msgid "Exceptions" msgstr "例外" -#: ../../library/mailbox.rst:1614 +#: ../../library/mailbox.rst:1639 msgid "" "The following exception classes are defined in the :mod:`!mailbox` module:" msgstr "" -#: ../../library/mailbox.rst:1619 +#: ../../library/mailbox.rst:1644 msgid "The based class for all other module-specific exceptions." msgstr "" -#: ../../library/mailbox.rst:1624 +#: ../../library/mailbox.rst:1649 msgid "" "Raised when a mailbox is expected but is not found, such as when " "instantiating a :class:`Mailbox` subclass with a path that does not exist " @@ -1863,13 +1872,13 @@ msgid "" "that does not exist." msgstr "" -#: ../../library/mailbox.rst:1631 +#: ../../library/mailbox.rst:1656 msgid "" "Raised when a mailbox is not empty but is expected to be, such as when " "deleting a folder that contains messages." msgstr "" -#: ../../library/mailbox.rst:1637 +#: ../../library/mailbox.rst:1662 msgid "" "Raised when some mailbox-related condition beyond the control of the program " "causes it to be unable to proceed, such as when failing to acquire a lock " @@ -1877,23 +1886,23 @@ msgid "" "name already exists." msgstr "" -#: ../../library/mailbox.rst:1645 +#: ../../library/mailbox.rst:1670 msgid "" "Raised when the data in a file cannot be parsed, such as when an :class:`MH` " "instance attempts to read a corrupted :file:`.mh_sequences` file." msgstr "" -#: ../../library/mailbox.rst:1652 +#: ../../library/mailbox.rst:1677 msgid "Examples" msgstr "範例" -#: ../../library/mailbox.rst:1654 +#: ../../library/mailbox.rst:1679 msgid "" "A simple example of printing the subjects of all messages in a mailbox that " "seem interesting::" msgstr "" -#: ../../library/mailbox.rst:1657 +#: ../../library/mailbox.rst:1682 msgid "" "import mailbox\n" "for message in mailbox.mbox('~/mbox'):\n" @@ -1907,13 +1916,13 @@ msgstr "" " if subject and 'python' in subject.lower():\n" " print(subject)" -#: ../../library/mailbox.rst:1663 +#: ../../library/mailbox.rst:1688 msgid "" "To copy all mail from a Babyl mailbox to an MH mailbox, converting all of " "the format-specific information that can be converted::" msgstr "" -#: ../../library/mailbox.rst:1666 +#: ../../library/mailbox.rst:1691 msgid "" "import mailbox\n" "destination = mailbox.MH('~/Mail')\n" @@ -1931,7 +1940,7 @@ msgstr "" "destination.flush()\n" "destination.unlock()" -#: ../../library/mailbox.rst:1674 +#: ../../library/mailbox.rst:1699 msgid "" "This example sorts mail from several mailing lists into different mailboxes, " "being careful to avoid mail corruption due to concurrent modification by " @@ -1939,7 +1948,7 @@ msgid "" "termination due to malformed messages in the mailbox::" msgstr "" -#: ../../library/mailbox.rst:1679 +#: ../../library/mailbox.rst:1704 msgid "" "import mailbox\n" "import email.errors\n" diff --git a/library/markup.po b/library/markup.po index 6804f0d603..357746f4d1 100644 --- a/library/markup.po +++ b/library/markup.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -20,7 +19,7 @@ msgstr "" #: ../../library/markup.rst:5 msgid "Structured Markup Processing Tools" -msgstr "" +msgstr "結構化標記處理工具" #: ../../library/markup.rst:7 msgid "" @@ -29,3 +28,7 @@ msgid "" "Generalized Markup Language (SGML) and the Hypertext Markup Language (HTML), " "and several interfaces for working with the Extensible Markup Language (XML)." msgstr "" +"Python 支援多種模組來處理各種形式的結構化資料標記。這包括用於處理標準通用標記" +"語言 (SGML, Standard Generalized Markup Language) 和超文本標記語言 (HTML, " +"Hypertext Markup Language) 的模組,以及用於處理可擴展標記語言 (XML, " +"Extensible Markup Language) 的幾個介面。" diff --git a/library/marshal.po b/library/marshal.po index d36682828d..92d8e87392 100644 --- a/library/marshal.po +++ b/library/marshal.po @@ -34,34 +34,35 @@ msgid "" "are undocumented on purpose; it may change between Python versions (although " "it rarely does). [#]_" msgstr "" -"此 module(模組)包含一個能以二進位制格式來讀寫 Python 值的函式。這種格式是 " -"Python 專屬但獨立於機器架構的(例如,你可以在一臺 PC 上寫入某個 Python 值,再" -"將檔案傳到一臺 Mac 上並在那裡讀取它)。這種格式的細節是有意地不在文件上說明" -"的;它可能在不同 Python 版本中被改變(雖然這種情況極少發生)。[#]_" +"此模組包含一個能以二進位制格式來讀寫 Python 值的函式。這種格式是 Python 專屬" +"但獨立於機器架構的(例如,你可以在一臺 PC 上寫入某個 Python 值,再將檔案傳到" +"一臺 Mac 上並在那裡讀取它)。這種格式的細節是有意地不在文件上說明的;它可能在" +"不同 Python 版本中被改變(雖然這種情況極少發生)。[#]_" #: ../../library/marshal.rst:21 -#, fuzzy msgid "" "This is not a general \"persistence\" module. For general persistence and " "transfer of Python objects through RPC calls, see the modules :mod:`pickle` " "and :mod:`shelve`. The :mod:`marshal` module exists mainly to support " -"reading and writing the \"pseudo-compiled\" code for Python modules of :file:" -"`.pyc` files. Therefore, the Python maintainers reserve the right to modify " -"the marshal format in backward incompatible ways should the need arise. The " -"format of code objects is not compatible between Python versions, even if " -"the version of the format is the same. De-serializing a code object in the " -"incorrect Python version has undefined behavior. If you're serializing and " -"de-serializing Python objects, use the :mod:`pickle` module instead -- the " -"performance is comparable, version independence is guaranteed, and pickle " -"supports a substantially wider range of objects than marshal." +"reading and writing the \"pseudo-compiled\" code for Python modules " +"of :file:`.pyc` files. Therefore, the Python maintainers reserve the right " +"to modify the marshal format in backward incompatible ways should the need " +"arise. The format of code objects is not compatible between Python versions, " +"even if the version of the format is the same. De-serializing a code object " +"in the incorrect Python version has undefined behavior. If you're " +"serializing and de-serializing Python objects, use the :mod:`pickle` module " +"instead -- the performance is comparable, version independence is " +"guaranteed, and pickle supports a substantially wider range of objects than " +"marshal." msgstr "" -"這不是一個通用「持續性 (persistence)」module 。關於通用持續性以及透過 RPC 呼" -"叫傳遞 Python 物件,請參閱 :mod:`pickle` 和 :mod:`shelve` 等 module 。:mod:" -"`marshal` module 主要是為了支援用來讀寫「偽編譯 (pseudo-compiled)」 :file:`." -"pyc` 檔案的 Python module。因此,Python 維護者保留了在必要時以不向後相容的方" -"式修改 marshal 格式的權利。如果你要序列化和反序列化 Python 物件,請改用 :mod:" -"`pickle` module -- 其執行效率相當、有保證版本獨立性,且實質上 pickle 還支援" -"比 marshal 更多樣的物件。" +"這不是一個通用「持久性 (persistence)」模組。關於通用持久性以及透過 RPC 呼叫傳" +"遞 Python 物件,請參閱 :mod:`pickle` 和 :mod:`shelve` 等模組。:mod:`marshal` " +"模組主要是為了支援用來讀寫 :file:`.pyc` 檔案之 Python 模組的「偽編譯 (pseudo-" +"compiled)」程式碼。因此,Python 維護者保留了在必要時以不向後相容的方式修改 " +"marshal 格式的權利。程式碼物件的格式在不同 Python 版本間是不相容的,即使格式" +"版本相同。在不正確的 Python 版本中反序列化程式碼物件會有未定義的行為。如果你" +"要序列化和反序列化 Python 物件,請改用 :mod:`pickle` 模組 -- 其執行效率相當、" +"有保證版本獨立性,且實質上 pickle 還支援比 marshal 更多樣的物件。" #: ../../library/marshal.rst:37 msgid "" @@ -69,7 +70,7 @@ msgid "" "maliciously constructed data. Never unmarshal data received from an " "untrusted or unauthenticated source." msgstr "" -":mod:`marshal` module 對於錯誤或惡意構建的資料來說是不安全的。永遠不要 " +":mod:`marshal` 模組對於錯誤或惡意構建的資料來說是不安全的。永遠不要 " "unmarshal 來自不受信任的或來源未經驗證的資料。" #: ../../library/marshal.rst:43 @@ -81,20 +82,20 @@ msgid "" "bytearrays, tuples, lists, sets, frozensets, dictionaries, and code objects " "(if *allow_code* is true), where it should be understood that tuples, lists, " "sets, frozensets and dictionaries are only supported as long as the values " -"contained therein are themselves supported. The singletons :const:`None`, :" -"const:`Ellipsis` and :exc:`StopIteration` can also be marshalled and " -"unmarshalled. For format *version* lower than 3, recursive lists, sets and " -"dictionaries cannot be written (see below)." +"contained therein are themselves supported. The " +"singletons :const:`None`, :const:`Ellipsis` and :exc:`StopIteration` can " +"also be marshalled and unmarshalled. For format *version* lower than 3, " +"recursive lists, sets and dictionaries cannot be written (see below)." msgstr "" -"不是所有 Python 物件型別都有支援;一般來說,此 module 只能寫入和讀取不依賴於" -"特定 Python 呼叫 (invocation) 的物件。下列型別是有支援的:布林 (boolean)、整" -"數、浮點數 (floating-point number)、複數、字串、位元組串 (bytes)、位元組陣列 " +"不是所有 Python 物件型別都有支援;一般來說,此模組只能寫入和讀取不依賴於特定 " +"Python 呼叫 (invocation) 的物件。下列型別是有支援的:布林 (boolean)、整數、浮" +"點數 (floating-point number)、複數、字串、位元組串 (bytes)、位元組陣列 " "(bytearray)、元組 (tuple)、list、集合 (set)、凍結集合 (frozenset)、" "dictionary 和程式碼物件(如 *allow_code* 為 true),需要了解的一點是元組、" "list、集合、凍結集合和 dictionary 只在其所包含的值也屬於這些型別時才會支援。" -"單例 (singleton) 物件 :const:`None`、:const:`Ellipsis` 和 :exc:" -"`StopIteration` 也可以被 marshal 和 unmarshal。對於 *version* 低於 3 的格式," -"遞迴 list、集合和 dictionary 無法被寫入(見下文)。" +"單例 (singleton) 物件 :const:`None`、:const:`Ellipsis` " +"和 :exc:`StopIteration` 也可以被 marshal 和 unmarshal。對於 *version* 低於 3 " +"的格式,遞迴 list、集合和 dictionary 無法被寫入(見下文)。" #: ../../library/marshal.rst:56 msgid "" @@ -105,7 +106,7 @@ msgstr "" #: ../../library/marshal.rst:59 msgid "The module defines these functions:" -msgstr "這個 module 定義了以下函式:" +msgstr "這個模組定義了以下函式:" #: ../../library/marshal.rst:64 msgid "" @@ -117,16 +118,16 @@ msgstr "" #: ../../library/marshal.rst:67 msgid "" -"If the value has (or contains an object that has) an unsupported type, a :" -"exc:`ValueError` exception is raised --- but garbage data will also be " -"written to the file. The object will not be properly read back by :func:" -"`load`. :ref:`Code objects ` are only supported if " +"If the value has (or contains an object that has) an unsupported type, " +"a :exc:`ValueError` exception is raised --- but garbage data will also be " +"written to the file. The object will not be properly read back " +"by :func:`load`. :ref:`Code objects ` are only supported if " "*allow_code* is true." msgstr "" "如果值具有(或其所包含的物件具有)不支援的型別,則會引發 :exc:`ValueError` 例" -"外 --- 但是垃圾資料 (garbage data) 也將寫入檔案,物件也無法正確地透過 :func:" -"`load` 重新讀取。:ref:`程式碼物件 `\\ 只有在 *allow_code* 為 " -"true 時才會支援。" +"外 --- 但是垃圾資料 (garbage data) 也將寫入檔案,物件也無法正確地透" +"過 :func:`load` 重新讀取。:ref:`程式碼物件 `\\ 只有在 " +"*allow_code* 為 true 時才會支援。" #: ../../library/marshal.rst:72 msgid "" @@ -151,14 +152,15 @@ msgstr "新增 *allow_code* 參數。" msgid "" "Read one value from the open file and return it. If no valid value is read " "(e.g. because the data has a different Python version's incompatible marshal " -"format), raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. :ref:" -"`Code objects ` are only supported if *allow_code* is true. " -"The file must be a readable :term:`binary file`." +"format), raise :exc:`EOFError`, :exc:`ValueError` " +"or :exc:`TypeError`. :ref:`Code objects ` are only supported " +"if *allow_code* is true. The file must be a readable :term:`binary file`." msgstr "" "從開啟的檔案讀取一個值並回傳。如果讀不到有效的值(例如,由於資料為不同 " -"Python 版本的不相容 marshal 格式),則會引發 :exc:`EOFError`、:exc:" -"`ValueError` 或 :exc:`TypeError`。:ref:`程式碼物件 `\\ 只有在 " -"*allow_code* 為 true 時才會支援。檔案必須為可讀取的 :term:`binary file`。" +"Python 版本的不相容 marshal 格式),則會引" +"發 :exc:`EOFError`、:exc:`ValueError` 或 :exc:`TypeError`。:ref:`程式碼物件 " +"`\\ 只有在 *allow_code* 為 true 時才會支援。檔案必須為可讀取" +"的 :term:`binary file`。" #: ../../library/marshal.rst:89 msgid "" @@ -168,8 +170,9 @@ msgstr "引發一個沒有附帶引數的\\ :ref:`稽核事件 ` ``mar #: ../../library/marshal.rst:93 msgid "" -"If an object containing an unsupported type was marshalled with :func:" -"`dump`, :func:`load` will substitute ``None`` for the unmarshallable type." +"If an object containing an unsupported type was marshalled " +"with :func:`dump`, :func:`load` will substitute ``None`` for the " +"unmarshallable type." msgstr "" "如果透過 :func:`dump` marshal 了一個包含不支援型別的物件,:func:`load` 會將不" "可 marshal 的型別替換為 ``None``。" @@ -191,9 +194,9 @@ msgid "" "is true." msgstr "" "回傳將透過 ``dump(value, file)`` 來被寫入一個檔案的位元組串物件,其值必須是有" -"支援的型別,如果值(或其包含的任一物件)為不支援的型別則會引發 :exc:" -"`ValueError`。:ref:`程式碼物件 `\\ 只有在 *allow_code* 為 true " -"時才會支援。" +"支援的型別,如果值(或其包含的任一物件)為不支援的型別則會引" +"發 :exc:`ValueError`。:ref:`程式碼物件 `\\ 只有在 *allow_code* " +"為 true 時才會支援。" #: ../../library/marshal.rst:112 msgid "" @@ -204,22 +207,22 @@ msgstr "*version* 引數指明 ``dumps`` 應當使用的資料型別(見下文 #: ../../library/marshal.rst:123 msgid "" "Convert the :term:`bytes-like object` to a value. If no valid value is " -"found, raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. :ref:" -"`Code objects ` are only supported if *allow_code* is true. " -"Extra bytes in the input are ignored." +"found, raise :exc:`EOFError`, :exc:`ValueError` " +"or :exc:`TypeError`. :ref:`Code objects ` are only supported " +"if *allow_code* is true. Extra bytes in the input are ignored." msgstr "" -"將 :term:`bytes-like object` 轉換為一個值。如果找不到有效的值,則會引發 :exc:" -"`EOFError`、:exc:`ValueError` 或 :exc:`TypeError`。:ref:`程式碼物件 `\\ 只有在 *allow_code* 為 true 時才會支援。輸入中額外的位元組串會被" -"忽略。" +"將 :term:`bytes-like object` 轉換為一個值。如果找不到有效的值,則會引" +"發 :exc:`EOFError`、:exc:`ValueError` 或 :exc:`TypeError`。:ref:`程式碼物件 " +"`\\ 只有在 *allow_code* 為 true 時才會支援。輸入中額外的位元組" +"串會被忽略。" #: ../../library/marshal.rst:128 msgid "" "Raises an :ref:`auditing event ` ``marshal.loads`` with argument " "``bytes``." msgstr "" -"引發一個附帶引數 ``bytes`` 的\\ :ref:`稽核事件 ` ``marshal." -"loads``。" +"引發一個附帶引數 ``bytes`` 的\\ :ref:`稽核事件 ` " +"``marshal.loads``。" #: ../../library/marshal.rst:132 msgid "" @@ -240,7 +243,7 @@ msgid "" "for floating-point numbers. Version 3 adds support for object instancing and " "recursion. The current version is 4." msgstr "" -"表示 module 所使用的格式。第 0 版為歷史格式,第 1 版共享了駐留字串 (interned " +"表示模組所使用的格式。第 0 版為歷史格式,第 1 版共享了駐留字串 (interned " "string),第 2 版對浮點數使用二進位制格式。第 3 版添加了對於物件實例化和遞迴的" "支援。目前使用的是第 4 版。" @@ -256,7 +259,7 @@ msgid "" "marshal\" means to convert some data from internal to external form (in an " "RPC buffer for instance) and \"unmarshalling\" for the reverse process." msgstr "" -"此 module 的名稱來源於 Modula-3 (及其他語言) 的設計者所使用的術語,他們使用 " +"此模組的名稱來源於 Modula-3 (及其他語言) 的設計者所使用的術語,他們使用 " "\"marshal\" 來表示自包含 (self-contained) 形式資料的傳輸。嚴格來說,將資料從" "內部形式轉換為外部形式 (例如用於 RPC 緩衝區) 稱為 \"marshal\",而其反向過程則" "稱為 \"unmarshal\"。" diff --git a/library/math.po b/library/math.po index c6ffeda216..1c6cb27a07 100644 --- a/library/math.po +++ b/library/math.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-05 00:15+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2024-04-26 15:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -548,8 +548,8 @@ msgstr ":func:`lgamma(x) `" #: ../../library/math.rst:112 msgid "" -"Natural logarithm of the absolute value of the `Gamma function `_ at *x*" +"Natural logarithm of the absolute value of the `Gamma function `_ at *x*" msgstr "" #: ../../library/math.rst:114 @@ -622,11 +622,11 @@ msgstr "" #: ../../library/math.rst:139 ../../library/math.rst:205 msgid "" -"Raises :exc:`TypeError` if either of the arguments are not integers. " -"Raises :exc:`ValueError` if either of the arguments are negative." +"Raises :exc:`TypeError` if either of the arguments are not integers. Raises :" +"exc:`ValueError` if either of the arguments are negative." msgstr "" -"當任一參數非整數型別時會引發 :exc:`TypeError`。當任一參數為負數時會引" -"發 :exc:`ValueError`。" +"當任一參數非整數型別時會引發 :exc:`TypeError`。當任一參數為負數時會引發 :exc:" +"`ValueError`。" #: ../../library/math.rst:147 msgid "" @@ -714,12 +714,12 @@ msgstr "" #: ../../library/math.rst:216 msgid "" "Return the ceiling of *x*, the smallest integer greater than or equal to " -"*x*. If *x* is not a float, delegates to :meth:`x.__ceil__ " -"`, which should return an :class:`~numbers.Integral` value." +"*x*. If *x* is not a float, delegates to :meth:`x.__ceil__ `, which should return an :class:`~numbers.Integral` value." msgstr "" "回傳 *x* 經上取整的值,即大於或等於 *x* 的最小整數。若 *x* 並非浮點數,此函式" -"將委派給 :meth:`x.__ceil__ `,並回" -"傳 :class:`~numbers.Integral` 型別的值。" +"將委派給 :meth:`x.__ceil__ `,並回傳 :class:`~numbers." +"Integral` 型別的值。" #: ../../library/math.rst:223 msgid "Return the absolute value of *x*." @@ -732,8 +732,8 @@ msgid "" "which should return an :class:`~numbers.Integral` value." msgstr "" "回傳 *x* 經下取整的值,即小於或等於 *x* 的最大整數。若 *x* 並非浮點數,此函式" -"將委派給 :meth:`x.__floor__ `,並回" -"傳 :class:`~numbers.Integral` 型別的值。" +"將委派給 :meth:`x.__floor__ `,並回傳 :class:`~numbers." +"Integral` 型別的值。" #: ../../library/math.rst:235 msgid "" @@ -820,8 +820,8 @@ msgid "" "Return *x* with the fractional part removed, leaving the integer part. This " "rounds toward 0: ``trunc()`` is equivalent to :func:`floor` for positive " "*x*, and equivalent to :func:`ceil` for negative *x*. If *x* is not a float, " -"delegates to :meth:`x.__trunc__ `, which should return " -"an :class:`~numbers.Integral` value." +"delegates to :meth:`x.__trunc__ `, which should return an :" +"class:`~numbers.Integral` value." msgstr "" #: ../../library/math.rst:306 @@ -898,9 +898,9 @@ msgstr "" msgid "" "*abs_tol* is the absolute tolerance; it defaults to ``0.0`` and it must be " "nonnegative. When comparing ``x`` to ``0.0``, ``isclose(x, 0)`` is computed " -"as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any ``x`` and " -"rel_tol less than ``1.0``. So add an appropriate positive abs_tol argument " -"to the call." +"as ``abs(x) <= rel_tol * abs(x)``, which is ``False`` for any nonzero ``x`` " +"and *rel_tol* less than ``1.0``. So add an appropriate positive *abs_tol* " +"argument to the call." msgstr "" #: ../../library/math.rst:357 @@ -941,8 +941,8 @@ msgstr "" #: ../../library/math.rst:390 msgid "" -"Return ``x * (2**i)``. This is essentially the inverse of " -"function :func:`frexp`." +"Return ``x * (2**i)``. This is essentially the inverse of function :func:" +"`frexp`." msgstr "回傳 ``x * (2**i)``。此函式本質上為 :func:`frexp` 的反函式。" #: ../../library/math.rst:396 @@ -1000,8 +1000,8 @@ msgstr "若 *x* 為正無限值,回傳 *x*。" #: ../../library/math.rst:422 msgid "" "If *x* is equal to zero, return the smallest positive *denormalized* " -"representable float (smaller than the minimum positive *normalized* " -"float, :data:`sys.float_info.min `)." +"representable float (smaller than the minimum positive *normalized* float, :" +"data:`sys.float_info.min `)." msgstr "" #: ../../library/math.rst:425 @@ -1024,8 +1024,8 @@ msgstr "" #: ../../library/math.rst:434 msgid "" -"See also :func:`math.nextafter` and :data:`sys.float_info.epsilon " -"`." +"See also :func:`math.nextafter` and :data:`sys.float_info.epsilon `." msgstr "" #: ../../library/math.rst:441 @@ -1159,9 +1159,9 @@ msgstr "" #: ../../library/math.rst:565 msgid "" "For further discussion and two alternative approaches, see the `ASPN " -"cookbook recipes for accurate floating-point summation `_\\." +"cookbook recipes for accurate floating-point summation `_\\." msgstr "" "更深入的討論及兩種替代做法請參閱 `ASPN cookbook recipes 精準的浮點數總和 " "`_。" @@ -1264,8 +1264,8 @@ msgid "" "``pi``. The vector in the plane from the origin to point ``(x, y)`` makes " "this angle with the positive X axis. The point of :func:`atan2` is that the " "signs of both inputs are known to it, so it can compute the correct quadrant " -"for the angle. For example, ``atan(1)`` and ``atan2(1, 1)`` are both ``pi/" -"4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." +"for the angle. For example, ``atan(1)`` and ``atan2(1, 1)`` are both " +"``pi/4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." msgstr "" #: ../../library/math.rst:664 @@ -1328,8 +1328,8 @@ msgstr "" #: ../../library/math.rst:722 msgid "" "The :func:`erf` function can be used to compute traditional statistical " -"functions such as the `cumulative standard normal distribution `_::" +"functions such as the `cumulative standard normal distribution `_::" msgstr "" #: ../../library/math.rst:726 @@ -1383,8 +1383,8 @@ msgstr "" #: ../../library/math.rst:786 msgid "" -"A floating-point positive infinity. (For negative infinity, use ``-" -"math.inf``.) Equivalent to the output of ``float('inf')``." +"A floating-point positive infinity. (For negative infinity, use ``-math." +"inf``.) Equivalent to the output of ``float('inf')``." msgstr "" #: ../../library/math.rst:794 @@ -1405,15 +1405,15 @@ msgstr "" msgid "" "The :mod:`math` module consists mostly of thin wrappers around the platform " "C math library functions. Behavior in exceptional cases follows Annex F of " -"the C99 standard where appropriate. The current implementation will " -"raise :exc:`ValueError` for invalid operations like ``sqrt(-1.0)`` or " -"``log(0.0)`` (where C99 Annex F recommends signaling invalid operation or " -"divide-by-zero), and :exc:`OverflowError` for results that overflow (for " -"example, ``exp(1000.0)``). A NaN will not be returned from any of the " -"functions above unless one or more of the input arguments was a NaN; in that " -"case, most functions will return a NaN, but (again following C99 Annex F) " -"there are some exceptions to this rule, for example ``pow(float('nan'), " -"0.0)`` or ``hypot(float('nan'), float('inf'))``." +"the C99 standard where appropriate. The current implementation will raise :" +"exc:`ValueError` for invalid operations like ``sqrt(-1.0)`` or ``log(0.0)`` " +"(where C99 Annex F recommends signaling invalid operation or divide-by-" +"zero), and :exc:`OverflowError` for results that overflow (for example, " +"``exp(1000.0)``). A NaN will not be returned from any of the functions " +"above unless one or more of the input arguments was a NaN; in that case, " +"most functions will return a NaN, but (again following C99 Annex F) there " +"are some exceptions to this rule, for example ``pow(float('nan'), 0.0)`` or " +"``hypot(float('nan'), float('inf'))``." msgstr "" #: ../../library/math.rst:832 diff --git a/library/modulefinder.po b/library/modulefinder.po index e4f1f62d68..ae4cd98992 100644 --- a/library/modulefinder.po +++ b/library/modulefinder.po @@ -139,6 +139,19 @@ msgid "" "print('Modules not imported:')\n" "print('\\n'.join(finder.badmodules.keys()))" msgstr "" +"from modulefinder import ModuleFinder\n" +"\n" +"finder = ModuleFinder()\n" +"finder.run_script('bacon.py')\n" +"\n" +"print('載入模組:')\n" +"for name, mod in finder.modules.items():\n" +" print('%s: ' % name, end='')\n" +" print(','.join(list(mod.globalnames.keys())[:3]))\n" +"\n" +"print('-'*50)\n" +"print('模組沒有被引入:')\n" +"print('\\n'.join(finder.badmodules.keys()))" #: ../../library/modulefinder.rst:94 msgid "Sample output (may vary depending on the architecture)::" @@ -164,7 +177,7 @@ msgid "" "guido.python.ham\n" "baconhameggs" msgstr "" -"Loaded modules:\n" +"載入模組:\n" "_types:\n" "copyreg: _inverted_registry,_slotnames,__all__\n" "re._compiler: isstring,_sre,_optimize_unicode\n" @@ -178,6 +191,6 @@ msgstr "" "array:\n" "types: __module__,IntType,TypeType\n" "---------------------------------------------------\n" -"Modules not imported:\n" +"模組沒有被引入:\n" "guido.python.ham\n" "baconhameggs" diff --git a/library/modules.po b/library/modules.po index 147e11b561..551ff94e39 100644 --- a/library/modules.po +++ b/library/modules.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -27,7 +26,9 @@ msgid "" "The modules described in this chapter provide new ways to import other " "Python modules and hooks for customizing the import process." msgstr "" +"本章節所描述的模組提供了引入其他 Python 模組的新方法,以及用於自訂引入過程的 " +"hook。" #: ../../library/modules.rst:10 msgid "The full list of modules described in this chapter is:" -msgstr "" +msgstr "本章節所描述的完整模組列表為:" diff --git a/library/numbers.po b/library/numbers.po index 221858c2e6..db32c6ca63 100644 --- a/library/numbers.po +++ b/library/numbers.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: 2022-11-16 04:57+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -72,19 +72,19 @@ msgstr "為抽象的。取得該數值的實數部分。" msgid "Abstract. Retrieves the imaginary component of this number." msgstr "為抽象的。取得該數值的虛數部分。" -#: ../../library/numbers.rst:43 +#: ../../library/numbers.rst:44 msgid "" "Abstract. Returns the complex conjugate. For example, ``(1+3j).conjugate() " "== (1-3j)``." msgstr "為抽象的。回傳共軛複數,例如 ``(1+3j).conjugate() == (1-3j)``。" -#: ../../library/numbers.rst:48 +#: ../../library/numbers.rst:49 msgid "" "To :class:`Complex`, :class:`!Real` adds the operations that work on real " "numbers." msgstr "相對於 :class:`Complex`,:class:`!Real` 加入了只有實數才能進行的操作。" -#: ../../library/numbers.rst:51 +#: ../../library/numbers.rst:52 msgid "" "In short, those are: a conversion to :class:`float`, :func:`math.trunc`, :" "func:`round`, :func:`math.floor`, :func:`math.ceil`, :func:`divmod`, ``//``, " @@ -94,7 +94,7 @@ msgstr "" "`math.floor`、:func:`math.ceil`、:func:`divmod`、``//``、``%``、 ``<``、" "``<=``、``>``、和 ``>=``。" -#: ../../library/numbers.rst:55 +#: ../../library/numbers.rst:56 msgid "" "Real also provides defaults for :func:`complex`, :attr:`~Complex.real`, :" "attr:`~Complex.imag`, and :meth:`~Complex.conjugate`." @@ -102,7 +102,7 @@ msgstr "" "實數同樣提供 :func:`complex`、:attr:`~Complex.real`、:attr:`~Complex.imag` " "和 :meth:`~Complex.conjugate` 的預設值。" -#: ../../library/numbers.rst:61 +#: ../../library/numbers.rst:62 msgid "" "Subtypes :class:`Real` and adds :attr:`~Rational.numerator` and :attr:" "`~Rational.denominator` properties. It also provides a default for :func:" @@ -111,7 +111,7 @@ msgstr "" ":class:`Real` 的子型別,並增加了 :attr:`~Rational.numerator` 和 :attr:" "`~Rational.denominator` 這兩種特性。它也會提供 :func:`float` 的預設值。" -#: ../../library/numbers.rst:65 +#: ../../library/numbers.rst:66 msgid "" "The :attr:`~Rational.numerator` and :attr:`~Rational.denominator` values " "should be instances of :class:`Integral` and should be in lowest terms with :" @@ -120,11 +120,11 @@ msgstr "" ":attr:`~Rational.numerator` 和 :attr:`~Rational.denominator` 的值必須是 :" "class:`Integral` 的實例且 :attr:`~Rational.denominator` 要是正數。" -#: ../../library/numbers.rst:71 ../../library/numbers.rst:75 +#: ../../library/numbers.rst:72 ../../library/numbers.rst:76 msgid "Abstract." msgstr "為抽象的。" -#: ../../library/numbers.rst:80 +#: ../../library/numbers.rst:81 msgid "" "Subtypes :class:`Rational` and adds a conversion to :class:`int`. Provides " "defaults for :func:`float`, :attr:`~Rational.numerator`, and :attr:" @@ -136,11 +136,11 @@ msgstr "" "預設值。為 :func:`pow` 方法增加了求餘 (modulus) 和位元字串運算 (bit-string " "operations) 的抽象方法:``<<``、``>>``、``&``、``^``、``|``、``~``。" -#: ../../library/numbers.rst:88 +#: ../../library/numbers.rst:89 msgid "Notes for type implementers" msgstr "給型別實作者的註記" -#: ../../library/numbers.rst:90 +#: ../../library/numbers.rst:91 msgid "" "Implementers should be careful to make equal numbers equal and hash them to " "the same values. This may be subtle if there are two different extensions of " @@ -151,7 +151,7 @@ msgstr "" "同的實數擴充時,這可能是很微妙的。例如,:class:`fractions.Fraction` 底下的 :" "func:`hash` 實作如下: ::" -#: ../../library/numbers.rst:95 +#: ../../library/numbers.rst:96 msgid "" "def __hash__(self):\n" " if self.denominator == 1:\n" @@ -165,12 +165,22 @@ msgid "" " # simple fractions.\n" " return hash((self.numerator, self.denominator))" msgstr "" +"def __hash__(self):\n" +" if self.denominator == 1:\n" +" # 正確處理整數。\n" +" return hash(self.numerator)\n" +" # 檢查費時,但絕對正確。\n" +" if self == float(self):\n" +" return hash(float(self))\n" +" else:\n" +" # 使用 tuple 的雜湊值以避免簡單分數上的高碰撞率。\n" +" return hash((self.numerator, self.denominator))" -#: ../../library/numbers.rst:109 +#: ../../library/numbers.rst:110 msgid "Adding More Numeric ABCs" msgstr "加入更多數值 ABC" -#: ../../library/numbers.rst:111 +#: ../../library/numbers.rst:112 msgid "" "There are, of course, more possible ABCs for numbers, and this would be a " "poor hierarchy if it precluded the possibility of adding those. You can add " @@ -179,7 +189,7 @@ msgstr "" "當然,還有更多用於數值的 ABC,如果不加入它們就不會有健全的階層。你可以在 :" "class:`Complex` 和 :class:`Real` 中加入 ``MyFoo``,像是: ::" -#: ../../library/numbers.rst:116 +#: ../../library/numbers.rst:117 msgid "" "class MyFoo(Complex): ...\n" "MyFoo.register(Real)" @@ -187,11 +197,11 @@ msgstr "" "class MyFoo(Complex): ...\n" "MyFoo.register(Real)" -#: ../../library/numbers.rst:123 +#: ../../library/numbers.rst:124 msgid "Implementing the arithmetic operations" msgstr "實作算術操作" -#: ../../library/numbers.rst:125 +#: ../../library/numbers.rst:126 msgid "" "We want to implement the arithmetic operations so that mixed-mode operations " "either call an implementation whose author knew about the types of both " @@ -204,7 +214,7 @@ msgstr "" "子型別,這意味著 :meth:`~object.__add__` 和 :meth:`~object.__radd__` 必須用如" "下方式定義: ::" -#: ../../library/numbers.rst:132 +#: ../../library/numbers.rst:133 msgid "" "class MyIntegral(Integral):\n" "\n" @@ -254,7 +264,7 @@ msgstr "" " else:\n" " return NotImplemented" -#: ../../library/numbers.rst:157 +#: ../../library/numbers.rst:158 msgid "" "There are 5 different cases for a mixed-type operation on subclasses of :" "class:`Complex`. I'll refer to all of the above code that doesn't refer to " @@ -267,13 +277,13 @@ msgstr "" "(boilerplate)」。``a`` 是 :class:`Complex` 之子型別 ``A`` 的實例 (``a : A <: " "Complex``),同時 ``b : B <: Complex``。我將要計算 ``a + b``:" -#: ../../library/numbers.rst:164 +#: ../../library/numbers.rst:165 msgid "" "If ``A`` defines an :meth:`~object.__add__` which accepts ``b``, all is well." msgstr "" "如果 ``A`` 有定義成一個接受 ``b`` 的 :meth:`~object.__add__`,不會發生問題。" -#: ../../library/numbers.rst:166 +#: ../../library/numbers.rst:167 msgid "" "If ``A`` falls back to the boilerplate code, and it were to return a value " "from :meth:`~object.__add__`, we'd miss the possibility that ``B`` defines a " @@ -286,14 +296,14 @@ msgstr "" "回傳一個來自 :meth:`!__add__` 的 :data:`NotImplemented`。(或者 ``A`` 可能完" "全不實作 :meth:`!__add__`。)" -#: ../../library/numbers.rst:172 +#: ../../library/numbers.rst:173 msgid "" "Then ``B``'s :meth:`~object.__radd__` gets a chance. If it accepts ``a``, " "all is well." msgstr "" "接著看 ``B`` 的 :meth:`~object.__radd__`。如果它接受 ``a`` ,不會發生問題。" -#: ../../library/numbers.rst:174 +#: ../../library/numbers.rst:175 msgid "" "If it falls back to the boilerplate, there are no more possible methods to " "try, so this is where the default implementation should live." @@ -301,7 +311,7 @@ msgstr "" "如果沒有成功回退到模板,就沒有更多的方法可以去嘗試,因此這裡將使用預設的實" "作。" -#: ../../library/numbers.rst:177 +#: ../../library/numbers.rst:178 msgid "" "If ``B <: A``, Python tries ``B.__radd__`` before ``A.__add__``. This is ok, " "because it was implemented with knowledge of ``A``, so it can handle those " @@ -311,7 +321,7 @@ msgstr "" "的,因為它是透過對 ``A`` 的理解而實作的,所以這可以在交給 :class:`Complex` 之" "前處理好這些實例。" -#: ../../library/numbers.rst:182 +#: ../../library/numbers.rst:183 msgid "" "If ``A <: Complex`` and ``B <: Real`` without sharing any other knowledge, " "then the appropriate shared operation is the one involving the built in :" @@ -322,7 +332,7 @@ msgstr "" "當的共享操作會涉及內建的 :class:`complex`,並且分別用到 :meth:`~object." "__radd__`,因此 ``a+b == b+a``。" -#: ../../library/numbers.rst:187 +#: ../../library/numbers.rst:188 msgid "" "Because most of the operations on any given type will be very similar, it " "can be useful to define a helper function which generates the forward and " @@ -333,7 +343,7 @@ msgstr "" "(forward) 與向後 (reverse) 實例的輔助函式可能會非常有用。例如,:class:" "`fractions.Fraction` 使用了: ::" -#: ../../library/numbers.rst:192 +#: ../../library/numbers.rst:193 msgid "" "def _operator_fallbacks(monomorphic_operator, fallback_operator):\n" " def forward(a, b):\n" diff --git a/library/operator.po b/library/operator.po index fda2efbfbe..a4e5af2d33 100644 --- a/library/operator.po +++ b/library/operator.po @@ -32,12 +32,12 @@ msgstr "**原始碼:**\\ :source:`Lib/operator.py`" #: ../../library/operator.rst:18 msgid "" "The :mod:`operator` module exports a set of efficient functions " -"corresponding to the intrinsic operators of Python. For example, ``operator." -"add(x, y)`` is equivalent to the expression ``x+y``. Many function names are " -"those used for special methods, without the double underscores. For " -"backward compatibility, many of these have a variant with the double " -"underscores kept. The variants without the double underscores are preferred " -"for clarity." +"corresponding to the intrinsic operators of Python. For example, " +"``operator.add(x, y)`` is equivalent to the expression ``x+y``. Many " +"function names are those used for special methods, without the double " +"underscores. For backward compatibility, many of these have a variant with " +"the double underscores kept. The variants without the double underscores are " +"preferred for clarity." msgstr "" ":mod:`operator` module(模組)提供了一套與 Python 原生運算子對應的高效率函" "式。例如,``operator.add(x, y)`` 與表示式 ``x+y`` 相同。許多函式名與特殊方法" @@ -64,8 +64,8 @@ msgid "" "``eq(a, b)`` is equivalent to ``a == b``, ``ne(a, b)`` is equivalent to ``a !" "= b``, ``gt(a, b)`` is equivalent to ``a > b`` and ``ge(a, b)`` is " "equivalent to ``a >= b``. Note that these functions can return any value, " -"which may or may not be interpretable as a Boolean value. See :ref:" -"`comparisons` for more information about rich comparisons." +"which may or may not be interpretable as a Boolean value. " +"See :ref:`comparisons` for more information about rich comparisons." msgstr "" "在 *a* 和 *b* 之間進行 \"rich comparison\"。具體來說,``lt(a, b)`` 與 ``a < " "b`` 相同,``le(a, b)`` 與 ``a <= b`` 相同,``eq(a, b)`` 與 ``a == b`` 相同," @@ -84,8 +84,8 @@ msgstr "" msgid "" "Return the outcome of :keyword:`not` *obj*. (Note that there is no :meth:`!" "__not__` method for object instances; only the interpreter core defines this " -"operation. The result is affected by the :meth:`~object.__bool__` and :meth:" -"`~object.__len__` methods.)" +"operation. The result is affected by the :meth:`~object.__bool__` " +"and :meth:`~object.__len__` methods.)" msgstr "" "回傳 :keyword:`not` *obj* 的結果。(請注意物件實例並沒有 :meth:`!__not__` " "method(方法);只有直譯器核心定義此操作。結果會受 :meth:`~object.__bool__` " @@ -234,16 +234,16 @@ msgid "" "actual length, then an estimate using :meth:`object.__length_hint__`, and " "finally return the default value." msgstr "" -"回傳物件 *obj* 的估計長度。首先嘗試回傳其實際長度,再使用 :meth:`object." -"__length_hint__` 得出估計值,最後才是回傳預設值。" +"回傳物件 *obj* 的估計長度。首先嘗試回傳其實際長度,再使" +"用 :meth:`object.__length_hint__` 得出估計值,最後才是回傳預設值。" #: ../../library/operator.rst:254 msgid "The following operation works with callables:" -msgstr "" +msgstr "以下操作適用於可呼叫物件:" #: ../../library/operator.rst:259 msgid "Return ``obj(*args, **kwargs)``." -msgstr "" +msgstr "回傳 ``obj(*args, **kwargs)``。" #: ../../library/operator.rst:264 msgid "" @@ -253,8 +253,9 @@ msgid "" "other functions that expect a function argument." msgstr "" ":mod:`operator` module 還定義了一些用於常規屬性和條目查詢的工具。這些工具適合" -"用來編寫快速欄位提取器以作為 :func:`map`、:func:`sorted`、:meth:`itertools." -"groupby` 或其他需要函式引數的函式之引數。" +"用來編寫快速欄位提取器以作" +"為 :func:`map`、:func:`sorted`、:meth:`itertools.groupby` 或其他需要函式引數" +"的函式之引數。" #: ../../library/operator.rst:273 msgid "" @@ -271,8 +272,8 @@ msgstr "在 ``f = attrgetter('name')`` 之後,呼叫 ``f(b)`` 將回傳 ``b.na #: ../../library/operator.rst:279 msgid "" -"After ``f = attrgetter('name', 'date')``, the call ``f(b)`` returns ``(b." -"name, b.date)``." +"After ``f = attrgetter('name', 'date')``, the call ``f(b)`` returns " +"``(b.name, b.date)``." msgstr "" "在 ``f = attrgetter('name', 'date')`` 之後,呼叫 ``f(b)`` 將回傳 ``(b.name, " "b.date)``。" @@ -309,6 +310,22 @@ msgid "" " obj = getattr(obj, name)\n" " return obj" msgstr "" +"def attrgetter(*items):\n" +" if any(not isinstance(item, str) for item in items):\n" +" raise TypeError('屬性名稱必須是一個字串')\n" +" if len(items) == 1:\n" +" attr = items[0]\n" +" def g(obj):\n" +" return resolve_attr(obj, attr)\n" +" else:\n" +" def g(obj):\n" +" return tuple(resolve_attr(obj, attr) for attr in items)\n" +" return g\n" +"\n" +"def resolve_attr(obj, attr):\n" +" for name in attr.split(\".\"):\n" +" obj = getattr(obj, name)\n" +" return obj" #: ../../library/operator.rst:308 msgid "" @@ -355,9 +372,10 @@ msgstr "" #: ../../library/operator.rst:329 msgid "" -"The items can be any type accepted by the operand's :meth:`~object." -"__getitem__` method. Dictionaries accept any :term:`hashable` value. " -"Lists, tuples, and strings accept an index or a slice:" +"The items can be any type accepted by the " +"operand's :meth:`~object.__getitem__` method. Dictionaries accept " +"any :term:`hashable` value. Lists, tuples, and strings accept an index or a " +"slice:" msgstr "" "傳入的條目可以為運算元的 :meth:`~object.__getitem__` 所接受的任何型別。" "dictionary(字典)接受任意\\ :term:`可雜湊 `\\ 的值。list、tupple " @@ -389,8 +407,8 @@ msgid "" "After ``f = methodcaller('name', 'foo', bar=1)``, the call ``f(b)`` returns " "``b.name('foo', bar=1)``." msgstr "" -"在 ``f = methodcaller('name', 'foo', bar=1)`` 之後,呼叫 ``f(b)`` 將回傳 ``b." -"name('foo', bar=1)``。" +"在 ``f = methodcaller('name', 'foo', bar=1)`` 之後,呼叫 ``f(b)`` 將回傳 " +"``b.name('foo', bar=1)``。" #: ../../library/operator.rst:367 msgid "" @@ -843,9 +861,9 @@ msgid "" "y``." msgstr "" "許多運算都有「原地」版本。以下列出的是提供對原地運算子(與一般語法相比)更底" -"層存取的函式,例如 :term:`statement` ``x += y`` 相當於 ``x = operator." -"iadd(x, y)``。換一種方式來講就是 ``z = operator.iadd(x, y)`` 等價於複合陳述" -"式 ``z = x; z += y``。" +"層存取的函式,例如 :term:`statement` ``x += y`` 相當於 ``x = " +"operator.iadd(x, y)``。換一種方式來講就是 ``z = operator.iadd(x, y)`` 等價於" +"複合陳述式 ``z = x; z += y``。" #: ../../library/operator.rst:465 msgid "" diff --git a/library/os.path.po b/library/os.path.po index 01916c12a2..0aa9f44b60 100644 --- a/library/os.path.po +++ b/library/os.path.po @@ -37,9 +37,9 @@ msgid "" "module. The path parameters can be passed as strings, or bytes, or any " "object implementing the :class:`os.PathLike` protocol." msgstr "" -"該模組實現了一些有用的路徑名操作函式。若要讀取或寫入檔案,請參閱 :func:" -"`open` 函式,要存取檔案系統,請參閱 :mod:`os` 模組。路徑參數可以以字串、位元" -"組或任何依照 :class:`os.PathLike` 協議實作的物件傳遞。" +"該模組實現了一些有用的路徑名操作函式。若要讀取或寫入檔案,請參" +"閱 :func:`open` 函式,要存取檔案系統,請參閱 :mod:`os` 模組。路徑參數可以以字" +"串、位元組或任何依照 :class:`os.PathLike` 協議實作的物件傳遞。" #: ../../library/os.path.rst:19 msgid "" @@ -68,12 +68,12 @@ msgstr "" #: ../../library/os.path.rst:37 msgid "" "Since different operating systems have different path name conventions, " -"there are several versions of this module in the standard library. The :mod:" -"`os.path` module is always the path module suitable for the operating system " -"Python is running on, and therefore usable for local paths. However, you " -"can also import and use the individual modules if you want to manipulate a " -"path that is *always* in one of the different formats. They all have the " -"same interface:" +"there are several versions of this module in the standard library. " +"The :mod:`os.path` module is always the path module suitable for the " +"operating system Python is running on, and therefore usable for local " +"paths. However, you can also import and use the individual modules if you " +"want to manipulate a path that is *always* in one of the different formats. " +"They all have the same interface:" msgstr "" "由於不同的作業系統具有不同的路徑命名慣例,在標準函式庫中的路徑模組有數個版本" "可供使用,而 :mod:`os.path` 模組都會是運行 Python 之作業系統所適用本地路徑。" @@ -90,14 +90,13 @@ msgstr ":mod:`ntpath` 用於 Windows 的路徑" #: ../../library/os.path.rst:51 msgid "" -":func:`exists`, :func:`lexists`, :func:`isdir`, :func:`isfile`, :func:" -"`islink`, and :func:`ismount` now return ``False`` instead of raising an " -"exception for paths that contain characters or bytes unrepresentable at the " -"OS level." +":func:`exists`, :func:`lexists`, :func:`isdir`, :func:`isfile`, :func:`islink`, " +"and :func:`ismount` now return ``False`` instead of raising an exception for " +"paths that contain characters or bytes unrepresentable at the OS level." msgstr "" -"對於包含有作業系統層級無法表示之字元或位元組的路徑,:func:`exists`、:func:" -"`lexists`、:func:`isdir`、:func:`isfile`、:func:`islink` 和 :func:`ismount` " -"函式現在會回傳 ``False``,而不是引發例外。" +"對於包含有作業系統層級無法表示之字元或位元組的路" +"徑,:func:`exists`、:func:`lexists`、:func:`isdir`、:func:`isfile`、:func:`islink` " +"和 :func:`ismount` 函式現在會回傳 ``False``,而不是引發例外。" #: ../../library/os.path.rst:59 msgid "" @@ -105,8 +104,8 @@ msgid "" "platforms, this is equivalent to calling the function :func:`normpath` as " "follows: ``normpath(join(os.getcwd(), path))``." msgstr "" -"回傳經正規化的絕對路徑名 *path* 。在大多數平台上,這等效於按照以下方式呼叫 :" -"func:`normpath` 函式:``normpath(join(os.getcwd(), path))``。" +"回傳經正規化的絕對路徑名 *path* 。在大多數平台上,這等效於按照以下方式呼" +"叫 :func:`normpath` 函式:``normpath(join(os.getcwd(), path))``。" #: ../../library/os.path.rst:63 ../../library/os.path.rst:76 #: ../../library/os.path.rst:117 ../../library/os.path.rst:126 @@ -134,8 +133,8 @@ msgid "" msgstr "" "回傳路徑名 *path* 的基底名稱。這是將 *path* 傳遞給函式 :func:`split` 後回傳結" "果中的第二個元素。請注意,此函式的結果與 Unix 的 :program:`basename` 程式不" -"同;對於 ``'/foo/bar/'``,:program:`basename` 回傳 ``'bar'``,而 :func:" -"`basename` 函式回傳空字串(``''``)。" +"同;對於 ``'/foo/bar/'``,:program:`basename` 回傳 ``'bar'``," +"而 :func:`basename` 函式回傳空字串(``''``)。" #: ../../library/os.path.rst:82 #, fuzzy @@ -146,8 +145,8 @@ msgid "" "empty. Unlike :func:`commonprefix`, this returns a valid path." msgstr "" "回傳序列 *paths* 中每個路徑名的最長共同子路徑。如果 *paths* 同時包含絕對路徑" -"和相對路徑、*paths* 位於不同的驅動機或 *paths* 為空,則引發 :exc:" -"`ValueError`。與 :func:`commonprefix` 不同,此函式回傳的是有效路徑。" +"和相對路徑、*paths* 位於不同的驅動機或 *paths* 為空,則引" +"發 :exc:`ValueError`。與 :func:`commonprefix` 不同,此函式回傳的是有效路徑。" #: ../../library/os.path.rst:90 msgid "Accepts a sequence of :term:`path-like objects `." @@ -219,11 +218,11 @@ msgstr "" #: ../../library/os.path.rst:148 msgid "" "Return ``True`` if *path* refers to an existing path, including broken " -"symbolic links. Equivalent to :func:`exists` on platforms lacking :func:" -"`os.lstat`." +"symbolic links. Equivalent to :func:`exists` on platforms " +"lacking :func:`os.lstat`." msgstr "" -"如果 *path* 是一個存在的路徑則回傳 ``True``,對已損壞的符號連結也是。在缺乏 :" -"func:`os.lstat` 的平台上,與 :func:`exists` 函式等效。" +"如果 *path* 是一個存在的路徑則回傳 ``True``,對已損壞的符號連結也是。在缺" +"乏 :func:`os.lstat` 的平台上,與 :func:`exists` 函式等效。" #: ../../library/os.path.rst:160 msgid "" @@ -235,10 +234,11 @@ msgstr "" #: ../../library/os.path.rst:165 msgid "" -"On Unix, an initial ``~`` is replaced by the environment variable :envvar:" -"`HOME` if it is set; otherwise the current user's home directory is looked " -"up in the password directory through the built-in module :mod:`pwd`. An " -"initial ``~user`` is looked up directly in the password directory." +"On Unix, an initial ``~`` is replaced by the environment " +"variable :envvar:`HOME` if it is set; otherwise the current user's home " +"directory is looked up in the password directory through the built-in " +"module :mod:`pwd`. An initial ``~user`` is looked up directly in the " +"password directory." msgstr "" "在 Unix 上,如果環境變數 :envvar:`HOME` 有被設置,則將初始的 ``~`` 替換為該變" "數的值;否則將使用內建模組 :mod:`pwd` 在密碼目錄中查找目前使用者的家目錄。對" @@ -289,9 +289,9 @@ msgstr "" #: ../../library/os.path.rst:204 msgid "" "Return the time of last access of *path*. The return value is a floating-" -"point number giving the number of seconds since the epoch (see the :mod:" -"`time` module). Raise :exc:`OSError` if the file does not exist or is " -"inaccessible." +"point number giving the number of seconds since the epoch (see " +"the :mod:`time` module). Raise :exc:`OSError` if the file does not exist " +"or is inaccessible." msgstr "" "回傳 *path* 的最後存取時間。回傳值是一個浮點數,表示自紀元(參見 :mod:`time` " "模組)以來的秒數。如果檔案不存在或無法存取,則引發 :exc:`OSError`。" @@ -324,18 +324,18 @@ msgid "" "Return the size, in bytes, of *path*. Raise :exc:`OSError` if the file does " "not exist or is inaccessible." msgstr "" -"回傳 *path* 的大小(以位元組為單位)。如果檔案不存在或無法存取,則引發 :exc:" -"`OSError`。" +"回傳 *path* 的大小(以位元組為單位)。如果檔案不存在或無法存取,則引" +"發 :exc:`OSError`。" #: ../../library/os.path.rst:242 -#, fuzzy msgid "" "Return ``True`` if *path* is an absolute pathname. On Unix, that means it " "begins with a slash, on Windows that it begins with two (back)slashes, or a " "drive letter, colon, and (back)slash together." msgstr "" "如果 *path* 是絕對路徑名,則回傳 ``True``。在 Unix 上,這表示它以斜線開頭;" -"在 Windows 上,表示在去除可能的驅動機字母後,以(反)斜線開頭。" +"在 Windows 上,表示這是以兩個(反)斜線開頭或者以一個驅動機字母、冒號和(反)" +"斜線開頭。" #: ../../library/os.path.rst:249 msgid "" @@ -350,8 +350,8 @@ msgid "" "true for the same path." msgstr "" "如果 *path* 是一個\\ :func:`已存在的 `\\ 常規檔案,則回傳 ``True``。" -"這將跟隨符號連結,因此同一個路徑可以同時回傳 :func:`islink` 和 :func:" -"`isfile` 的結果為真。" +"這將跟隨符號連結,因此同一個路徑可以同時回傳 :func:`islink` " +"和 :func:`isfile` 的結果為真。" #: ../../library/os.path.rst:266 msgid "" @@ -394,12 +394,12 @@ msgid "" "called to see if it is different from the input path." msgstr "" "如果路徑名 *path* 是一個掛載點 (:dfn:`mount point`),則回傳 ``True``:即在檔" -"案系統中掛載了不同的檔案系統。在 POSIX 系統上,該函式檢查 *path* 的父目錄 :" -"file:`{path}/..` 是否位於不同的設備上,或者 :file:`{path}/..` 和 *path* 是否" -"指向同一設備上的相同 i-node --- 這應該能夠檢測出所有 Unix 和 POSIX 變體的掛載" -"點。但無法可靠地檢測出相同檔案系統上的綁定掛載點 (bind mount)。在 Windows " -"上,以驅動機字母開頭的根目錄和 UNC 共享路徑始終是掛載點,對於任何其他路徑,會" -"呼叫 ``GetVolumePathName`` 函式來檢查它是否與輸入路徑不同。" +"案系統中掛載了不同的檔案系統。在 POSIX 系統上,該函式檢查 *path* 的父目" +"錄 :file:`{path}/..` 是否位於不同的設備上,或者 :file:`{path}/..` 和 *path* " +"是否指向同一設備上的相同 i-node --- 這應該能夠檢測出所有 Unix 和 POSIX 變體的" +"掛載點。但無法可靠地檢測出相同檔案系統上的綁定掛載點 (bind mount)。在 " +"Windows 上,以驅動機字母開頭的根目錄和 UNC 共享路徑始終是掛載點,對於任何其他" +"路徑,會呼叫 ``GetVolumePathName`` 函式來檢查它是否與輸入路徑不同。" #: ../../library/os.path.rst:305 msgid "Added support for detecting non-root mount points on Windows." @@ -425,8 +425,9 @@ msgid "" "windows/dev-drive/>`_ for information on enabling and creating Dev Drives." msgstr "" "可能會對無效的路徑引發錯誤,例如,沒有可識別的驅動機的路徑,但在不支援 Dev 磁" -"碟機的平台上返回 ``False``。請參閱 `Windows 文件 `_\\ 以了解有關啟用和建立 Dev 驅動機的資訊。" +"碟機的平台上返回 ``False``。請參閱 `Windows 文件 `_\\ 以了解有關啟用和建立 Dev 驅動機的" +"資訊。" #: ../../library/os.path.rst:327 msgid "" @@ -479,9 +480,9 @@ msgid "" "On Windows, the drive is not reset when a rooted path segment (e.g., " "``r'\\foo'``) is encountered. If a segment is on a different drive or is an " "absolute path, all previous segments are ignored and the drive is reset. " -"Note that since there is a current directory for each drive, ``os.path." -"join(\"c:\", \"foo\")`` represents a path relative to the current directory " -"on drive :file:`C:` (:file:`c:foo`), not :file:`c:\\\\foo`." +"Note that since there is a current directory for each drive, " +"``os.path.join(\"c:\", \"foo\")`` represents a path relative to the current " +"directory on drive :file:`C:` (:file:`c:foo`), not :file:`c:\\\\foo`." msgstr "" "在 Windows 上,當遇到根路徑段(例如,``r'\\foo'``)時,驅動機不會被重置。如果" "一個段位於不同的驅動機上,或者是絕對路徑,則將忽略所有之前的段並重置驅動機。" @@ -525,10 +526,10 @@ msgid "" "leading characters shall be treated as a single character." msgstr "" "在 POSIX 系統中,根據 `IEEE Std 1003.1 2013 版; 4.13 Pathname Resolution " -"`_ 標準,如果一個路徑名恰好以兩個斜線開頭,則在前導字元後的第" -"一個部分可能會以由實作品自行定義的方式解釋,雖然多於兩個前導字元應該被視為單" -"個字元。" +"`_ 標準,如果一個路徑名恰好以兩個斜線開頭,則在前導" +"字元後的第一個部分可能會以由實作品自行定義的方式解釋,雖然多於兩個前導字元應" +"該被視為單個字元。" #: ../../library/os.path.rst:406 #, fuzzy @@ -549,9 +550,9 @@ msgid "" "``True``, :exc:`OSError` is raised. If *strict* is ``False`` these errors " "are ignored, and so the result might be missing or otherwise inaccessible." msgstr "" -"如果路徑不存在或遇到符號連結迴圈,且 *strict* 為 ``True``,則引發 :exc:" -"`OSError`。如果 *strict* 為 ``False``,則將路徑盡可能解析,並將任何剩餘部分附" -"加在後面,而不檢查其是否存在。" +"如果路徑不存在或遇到符號連結迴圈,且 *strict* 為 ``True``,則引" +"發 :exc:`OSError`。如果 *strict* 為 ``False``,則將路徑盡可能解析,並將任何剩" +"餘部分附加在後面,而不檢查其是否存在。" #: ../../library/os.path.rst:416 msgid "" @@ -620,13 +621,14 @@ msgstr "如果文件描述符 *fp1* 和 *fp2* 指向同一個檔案,則回傳 #: ../../library/os.path.rst:476 msgid "" "Return ``True`` if the stat tuples *stat1* and *stat2* refer to the same " -"file. These structures may have been returned by :func:`os.fstat`, :func:`os." -"lstat`, or :func:`os.stat`. This function implements the underlying " -"comparison used by :func:`samefile` and :func:`sameopenfile`." +"file. These structures may have been returned " +"by :func:`os.fstat`, :func:`os.lstat`, or :func:`os.stat`. This function " +"implements the underlying comparison used by :func:`samefile` " +"and :func:`sameopenfile`." msgstr "" "如果 stat 值組 *stat1* 和 *stat2* 指向同一個檔案,則回傳 ``True``。這些結構可" -"能由 :func:`os.fstat`、:func:`os.lstat` 或 :func:`os.stat` 回傳。此函式使用 :" -"func:`samefile` 和 :func:`sameopenfile` 實現了底層比較。" +"能由 :func:`os.fstat`、:func:`os.lstat` 或 :func:`os.stat` 回傳。此函式使" +"用 :func:`samefile` 和 :func:`sameopenfile` 實現了底層比較。" #: ../../library/os.path.rst:490 msgid "" @@ -645,8 +647,8 @@ msgstr "" "結尾,則 *tail* 將為空。如果 *path* 中沒有斜線,則 *head* 將為空。如果 " "*path* 為空,則 *head* 和 *tail* 都為空。除非 *head* 是根目錄(僅有一個或多個" "斜線),否則從 *head* 中刪除尾部的斜線。在所有情況下,``join(head, tail)`` 回" -"傳指向與 *path* 相同位置的路徑(但字串可能不同)。還可以參考函式 :func:" -"`dirname` 和 :func:`basename`。" +"傳指向與 *path* 相同位置的路徑(但字串可能不同)。還可以參考函" +"式 :func:`dirname` 和 :func:`basename`。" #: ../../library/os.path.rst:506 msgid "" @@ -716,9 +718,8 @@ msgid "" msgstr "" "在 POSIX 系統上,*drive* 始終為空。*root* 可能為空(如果 *path* 是相對路" "徑),一個斜線(如果 *path* 是絕對路徑),或者兩個斜線(根據 `IEEE Std " -"1003.1-2017; 4.13 Pathname Resolution `_ 的實作定義)。例" -"如: ::" +"1003.1-2017; 4.13 Pathname Resolution `_ 的實作定義)。例如: ::" #: ../../library/os.path.rst:543 msgid "" diff --git a/library/os.po b/library/os.po index 8e5e0369c7..b2f2e44c90 100644 --- a/library/os.po +++ b/library/os.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-19 00:15+0000\n" +"POT-Creation-Date: 2025-03-30 00:15+0000\n" "PO-Revision-Date: 2024-04-29 15:24+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -200,8 +200,8 @@ msgid "" ":func:`locale.getpreferredencoding` returns ``'utf-8'`` (the *do_setlocale* " "argument has no effect)." msgstr "" -":func:`locale.getpreferredencoding` 回傳 ``'utf-8'``\\ (*do_setlocale* " -"引數並無任何效果)。" +":func:`locale.getpreferredencoding` 回傳 ``'utf-8'``\\ (*do_setlocale* 引數" +"並無任何效果)。" #: ../../library/os.rst:119 msgid "" @@ -216,9 +216,7 @@ msgstr "" msgid "" "On Unix, :func:`os.device_encoding` returns ``'utf-8'`` rather than the " "device encoding." -msgstr "" -"在 Unix 中,:func:`os.device_encoding` 回傳 ``'utf-8'`` 而非" -"裝置編碼。" +msgstr "在 Unix 中,:func:`os.device_encoding` 回傳 ``'utf-8'`` 而非裝置編碼。" #: ../../library/os.rst:127 msgid "" @@ -226,9 +224,8 @@ msgid "" "envvar:`PYTHONIOENCODING` (just as they can be in the default locale-aware " "mode)." msgstr "" -"請注意,在 UTF-8 模式中,標準的串流設定會被 " -":envvar:`PYTHONIOENCODING` 覆蓋(如同在預設在地化覺察 " -"模式一樣)。" +"請注意,在 UTF-8 模式中,標準的串流設定會被 :envvar:`PYTHONIOENCODING` 覆蓋" +"(如同在預設在地化覺察 模式一樣)。" #: ../../library/os.rst:131 msgid "" @@ -240,13 +237,11 @@ msgstr "" msgid "" "Command line arguments, environment variables and filenames are decoded to " "text using the UTF-8 encoding." -msgstr "" -"命令列引數、環境變數及檔案名稱會以 UTF-8 編碼形式來被解碼成文字。" +msgstr "命令列引數、環境變數及檔案名稱會以 UTF-8 編碼形式來被解碼成文字。" #: ../../library/os.rst:136 msgid ":func:`os.fsdecode` and :func:`os.fsencode` use the UTF-8 encoding." -msgstr "" -":func:`os.fsdecode` 和 :func:`os.fsencode` 使用 UTF-8 編碼。" +msgstr ":func:`os.fsdecode` 和 :func:`os.fsencode` 使用 UTF-8 編碼。" #: ../../library/os.rst:137 msgid "" @@ -314,93 +309,93 @@ msgid "" "Return the filename corresponding to the controlling terminal of the process." msgstr "" -#: ../../library/os.rst:181 ../../library/os.rst:322 ../../library/os.rst:337 -#: ../../library/os.rst:358 ../../library/os.rst:367 ../../library/os.rst:376 -#: ../../library/os.rst:389 ../../library/os.rst:398 ../../library/os.rst:426 -#: ../../library/os.rst:434 ../../library/os.rst:442 ../../library/os.rst:462 -#: ../../library/os.rst:480 ../../library/os.rst:491 ../../library/os.rst:503 -#: ../../library/os.rst:512 ../../library/os.rst:522 ../../library/os.rst:533 -#: ../../library/os.rst:545 ../../library/os.rst:579 ../../library/os.rst:586 -#: ../../library/os.rst:593 ../../library/os.rst:602 ../../library/os.rst:639 -#: ../../library/os.rst:652 ../../library/os.rst:661 ../../library/os.rst:678 -#: ../../library/os.rst:687 ../../library/os.rst:694 ../../library/os.rst:703 -#: ../../library/os.rst:712 ../../library/os.rst:719 ../../library/os.rst:726 -#: ../../library/os.rst:735 ../../library/os.rst:792 ../../library/os.rst:831 -#: ../../library/os.rst:953 ../../library/os.rst:979 ../../library/os.rst:992 -#: ../../library/os.rst:1009 ../../library/os.rst:1027 -#: ../../library/os.rst:1038 ../../library/os.rst:1061 -#: ../../library/os.rst:1082 ../../library/os.rst:1094 -#: ../../library/os.rst:1105 ../../library/os.rst:1118 -#: ../../library/os.rst:1139 ../../library/os.rst:1160 -#: ../../library/os.rst:1172 ../../library/os.rst:1183 -#: ../../library/os.rst:1244 ../../library/os.rst:1367 -#: ../../library/os.rst:1379 ../../library/os.rst:1393 -#: ../../library/os.rst:1403 ../../library/os.rst:1418 -#: ../../library/os.rst:1433 ../../library/os.rst:1446 -#: ../../library/os.rst:1463 ../../library/os.rst:1489 -#: ../../library/os.rst:1506 ../../library/os.rst:1520 -#: ../../library/os.rst:1535 ../../library/os.rst:1547 -#: ../../library/os.rst:1574 ../../library/os.rst:1586 -#: ../../library/os.rst:1596 ../../library/os.rst:1610 -#: ../../library/os.rst:1662 ../../library/os.rst:1682 -#: ../../library/os.rst:1691 ../../library/os.rst:1703 -#: ../../library/os.rst:1738 ../../library/os.rst:1762 -#: ../../library/os.rst:1772 ../../library/os.rst:1780 -#: ../../library/os.rst:1789 ../../library/os.rst:1800 -#: ../../library/os.rst:1837 ../../library/os.rst:1864 -#: ../../library/os.rst:1915 ../../library/os.rst:1921 -#: ../../library/os.rst:2087 ../../library/os.rst:2164 -#: ../../library/os.rst:2181 ../../library/os.rst:2195 -#: ../../library/os.rst:2221 ../../library/os.rst:2239 -#: ../../library/os.rst:2255 ../../library/os.rst:2271 -#: ../../library/os.rst:2334 ../../library/os.rst:2358 -#: ../../library/os.rst:2378 ../../library/os.rst:2514 -#: ../../library/os.rst:2536 ../../library/os.rst:2580 -#: ../../library/os.rst:2592 ../../library/os.rst:2614 -#: ../../library/os.rst:3322 ../../library/os.rst:3456 -#: ../../library/os.rst:3479 ../../library/os.rst:3493 -#: ../../library/os.rst:3713 ../../library/os.rst:3738 -#: ../../library/os.rst:3763 ../../library/os.rst:3817 -#: ../../library/os.rst:3826 ../../library/os.rst:3835 -#: ../../library/os.rst:3843 ../../library/os.rst:3852 -#: ../../library/os.rst:3861 ../../library/os.rst:3933 -#: ../../library/os.rst:3996 ../../library/os.rst:4006 -#: ../../library/os.rst:4024 ../../library/os.rst:4033 -#: ../../library/os.rst:4043 ../../library/os.rst:4053 -#: ../../library/os.rst:4063 ../../library/os.rst:4074 -#: ../../library/os.rst:4219 ../../library/os.rst:4288 -#: ../../library/os.rst:4323 ../../library/os.rst:4331 -#: ../../library/os.rst:4338 ../../library/os.rst:4345 -#: ../../library/os.rst:4352 ../../library/os.rst:4359 -#: ../../library/os.rst:4366 ../../library/os.rst:4373 -#: ../../library/os.rst:4381 ../../library/os.rst:4389 -#: ../../library/os.rst:4396 ../../library/os.rst:4403 -#: ../../library/os.rst:4412 ../../library/os.rst:4420 -#: ../../library/os.rst:4428 ../../library/os.rst:4435 -#: ../../library/os.rst:4442 ../../library/os.rst:4491 -#: ../../library/os.rst:4518 ../../library/os.rst:4541 -#: ../../library/os.rst:4557 ../../library/os.rst:4564 -#: ../../library/os.rst:4575 ../../library/os.rst:4585 -#: ../../library/os.rst:4594 ../../library/os.rst:4626 -#: ../../library/os.rst:4734 ../../library/os.rst:4750 -#: ../../library/os.rst:4783 ../../library/os.rst:4852 -#: ../../library/os.rst:4871 ../../library/os.rst:4882 -#: ../../library/os.rst:4894 ../../library/os.rst:4939 -#: ../../library/os.rst:4976 ../../library/os.rst:4999 -#: ../../library/os.rst:5020 ../../library/os.rst:5054 -#: ../../library/os.rst:5095 ../../library/os.rst:5115 -#: ../../library/os.rst:5129 ../../library/os.rst:5146 -#: ../../library/os.rst:5161 ../../library/os.rst:5172 -#: ../../library/os.rst:5184 ../../library/os.rst:5197 -#: ../../library/os.rst:5206 ../../library/os.rst:5216 -#: ../../library/os.rst:5229 ../../library/os.rst:5264 -#: ../../library/os.rst:5280 ../../library/os.rst:5291 -#: ../../library/os.rst:5303 ../../library/os.rst:5310 -#: ../../library/os.rst:5319 ../../library/os.rst:5328 -#: ../../library/os.rst:5337 ../../library/os.rst:5346 -#: ../../library/os.rst:5498 ../../library/os.rst:5507 -#: ../../library/os.rst:5531 ../../library/os.rst:5558 -#: ../../library/os.rst:5567 ../../library/os.rst:5690 +#: ../../library/os.rst:181 ../../library/os.rst:323 ../../library/os.rst:338 +#: ../../library/os.rst:359 ../../library/os.rst:368 ../../library/os.rst:377 +#: ../../library/os.rst:390 ../../library/os.rst:399 ../../library/os.rst:427 +#: ../../library/os.rst:435 ../../library/os.rst:443 ../../library/os.rst:463 +#: ../../library/os.rst:481 ../../library/os.rst:492 ../../library/os.rst:504 +#: ../../library/os.rst:513 ../../library/os.rst:523 ../../library/os.rst:534 +#: ../../library/os.rst:546 ../../library/os.rst:580 ../../library/os.rst:587 +#: ../../library/os.rst:594 ../../library/os.rst:603 ../../library/os.rst:640 +#: ../../library/os.rst:653 ../../library/os.rst:662 ../../library/os.rst:679 +#: ../../library/os.rst:688 ../../library/os.rst:695 ../../library/os.rst:704 +#: ../../library/os.rst:713 ../../library/os.rst:720 ../../library/os.rst:727 +#: ../../library/os.rst:736 ../../library/os.rst:793 ../../library/os.rst:832 +#: ../../library/os.rst:954 ../../library/os.rst:980 ../../library/os.rst:993 +#: ../../library/os.rst:1010 ../../library/os.rst:1028 +#: ../../library/os.rst:1039 ../../library/os.rst:1062 +#: ../../library/os.rst:1083 ../../library/os.rst:1095 +#: ../../library/os.rst:1106 ../../library/os.rst:1119 +#: ../../library/os.rst:1140 ../../library/os.rst:1161 +#: ../../library/os.rst:1173 ../../library/os.rst:1184 +#: ../../library/os.rst:1245 ../../library/os.rst:1368 +#: ../../library/os.rst:1380 ../../library/os.rst:1394 +#: ../../library/os.rst:1404 ../../library/os.rst:1419 +#: ../../library/os.rst:1434 ../../library/os.rst:1447 +#: ../../library/os.rst:1464 ../../library/os.rst:1490 +#: ../../library/os.rst:1507 ../../library/os.rst:1521 +#: ../../library/os.rst:1536 ../../library/os.rst:1548 +#: ../../library/os.rst:1575 ../../library/os.rst:1587 +#: ../../library/os.rst:1597 ../../library/os.rst:1611 +#: ../../library/os.rst:1663 ../../library/os.rst:1683 +#: ../../library/os.rst:1692 ../../library/os.rst:1704 +#: ../../library/os.rst:1739 ../../library/os.rst:1763 +#: ../../library/os.rst:1773 ../../library/os.rst:1781 +#: ../../library/os.rst:1790 ../../library/os.rst:1801 +#: ../../library/os.rst:1838 ../../library/os.rst:1865 +#: ../../library/os.rst:1916 ../../library/os.rst:1922 +#: ../../library/os.rst:2088 ../../library/os.rst:2165 +#: ../../library/os.rst:2182 ../../library/os.rst:2196 +#: ../../library/os.rst:2222 ../../library/os.rst:2240 +#: ../../library/os.rst:2256 ../../library/os.rst:2272 +#: ../../library/os.rst:2335 ../../library/os.rst:2359 +#: ../../library/os.rst:2379 ../../library/os.rst:2515 +#: ../../library/os.rst:2537 ../../library/os.rst:2581 +#: ../../library/os.rst:2593 ../../library/os.rst:2615 +#: ../../library/os.rst:3323 ../../library/os.rst:3457 +#: ../../library/os.rst:3480 ../../library/os.rst:3494 +#: ../../library/os.rst:3714 ../../library/os.rst:3739 +#: ../../library/os.rst:3764 ../../library/os.rst:3818 +#: ../../library/os.rst:3827 ../../library/os.rst:3836 +#: ../../library/os.rst:3844 ../../library/os.rst:3853 +#: ../../library/os.rst:3862 ../../library/os.rst:3934 +#: ../../library/os.rst:3997 ../../library/os.rst:4007 +#: ../../library/os.rst:4025 ../../library/os.rst:4034 +#: ../../library/os.rst:4044 ../../library/os.rst:4054 +#: ../../library/os.rst:4064 ../../library/os.rst:4075 +#: ../../library/os.rst:4220 ../../library/os.rst:4289 +#: ../../library/os.rst:4324 ../../library/os.rst:4332 +#: ../../library/os.rst:4339 ../../library/os.rst:4346 +#: ../../library/os.rst:4353 ../../library/os.rst:4360 +#: ../../library/os.rst:4367 ../../library/os.rst:4374 +#: ../../library/os.rst:4382 ../../library/os.rst:4390 +#: ../../library/os.rst:4397 ../../library/os.rst:4404 +#: ../../library/os.rst:4413 ../../library/os.rst:4421 +#: ../../library/os.rst:4429 ../../library/os.rst:4436 +#: ../../library/os.rst:4443 ../../library/os.rst:4492 +#: ../../library/os.rst:4519 ../../library/os.rst:4542 +#: ../../library/os.rst:4558 ../../library/os.rst:4565 +#: ../../library/os.rst:4576 ../../library/os.rst:4586 +#: ../../library/os.rst:4595 ../../library/os.rst:4627 +#: ../../library/os.rst:4735 ../../library/os.rst:4751 +#: ../../library/os.rst:4784 ../../library/os.rst:4853 +#: ../../library/os.rst:4872 ../../library/os.rst:4883 +#: ../../library/os.rst:4895 ../../library/os.rst:4940 +#: ../../library/os.rst:4977 ../../library/os.rst:5000 +#: ../../library/os.rst:5021 ../../library/os.rst:5055 +#: ../../library/os.rst:5096 ../../library/os.rst:5116 +#: ../../library/os.rst:5130 ../../library/os.rst:5147 +#: ../../library/os.rst:5162 ../../library/os.rst:5173 +#: ../../library/os.rst:5185 ../../library/os.rst:5198 +#: ../../library/os.rst:5207 ../../library/os.rst:5217 +#: ../../library/os.rst:5230 ../../library/os.rst:5265 +#: ../../library/os.rst:5281 ../../library/os.rst:5292 +#: ../../library/os.rst:5304 ../../library/os.rst:5311 +#: ../../library/os.rst:5320 ../../library/os.rst:5329 +#: ../../library/os.rst:5338 ../../library/os.rst:5347 +#: ../../library/os.rst:5499 ../../library/os.rst:5508 +#: ../../library/os.rst:5532 ../../library/os.rst:5559 +#: ../../library/os.rst:5568 ../../library/os.rst:5691 msgid "Availability" msgstr "" @@ -447,8 +442,8 @@ msgid "" "Calling :func:`putenv` directly does not change :data:`os.environ`, so it's " "better to modify :data:`os.environ`." msgstr "" -"呼叫 :func:`putenv` 並不會改變 :data:`os.environ`," -"所以建議直接修改 :data:`os.environ`。" +"呼叫 :func:`putenv` 並不會改變 :data:`os.environ`,所以建議直接修改 :data:" +"`os.environ`。" #: ../../library/os.rst:216 msgid "" @@ -531,17 +526,17 @@ msgid "" "e.g. :class:`pathlib.PurePath`." msgstr "" -#: ../../library/os.rst:304 +#: ../../library/os.rst:305 msgid "Return the file system path representation of the object." msgstr "" -#: ../../library/os.rst:306 +#: ../../library/os.rst:307 msgid "" "The method should only return a :class:`str` or :class:`bytes` object, with " "the preference being for :class:`str`." msgstr "" -#: ../../library/os.rst:312 +#: ../../library/os.rst:313 msgid "" "Return the value of the environment variable *key* as a string if it exists, " "or *default* if it doesn't. *key* is a string. Note that since :func:" @@ -550,14 +545,14 @@ msgid "" "changes." msgstr "" -#: ../../library/os.rst:318 +#: ../../library/os.rst:319 msgid "" "On Unix, keys and values are decoded with :func:`sys.getfilesystemencoding` " "and ``'surrogateescape'`` error handler. Use :func:`os.getenvb` if you would " "like to use a different encoding." msgstr "" -#: ../../library/os.rst:327 +#: ../../library/os.rst:328 msgid "" "Return the value of the environment variable *key* as bytes if it exists, or " "*default* if it doesn't. *key* must be bytes. Note that since :func:" @@ -566,13 +561,13 @@ msgid "" "environment changes." msgstr "" -#: ../../library/os.rst:334 +#: ../../library/os.rst:335 msgid "" ":func:`getenvb` is only available if :const:`supports_bytes_environ` is " "``True``." msgstr "" -#: ../../library/os.rst:344 +#: ../../library/os.rst:345 msgid "" "Returns the list of directories that will be searched for a named " "executable, similar to a shell, when launching a process. *env*, when " @@ -580,28 +575,28 @@ msgid "" "in. By default, when *env* is ``None``, :data:`environ` is used." msgstr "" -#: ../../library/os.rst:355 +#: ../../library/os.rst:356 msgid "" "Return the effective group id of the current process. This corresponds to " "the \"set id\" bit on the file being executed in the current process." msgstr "" -#: ../../library/os.rst:365 +#: ../../library/os.rst:366 msgid "Return the current process's effective user id." msgstr "" -#: ../../library/os.rst:374 +#: ../../library/os.rst:375 msgid "Return the real group id of the current process." msgstr "" -#: ../../library/os.rst:378 ../../library/os.rst:451 ../../library/os.rst:535 -#: ../../library/os.rst:758 +#: ../../library/os.rst:379 ../../library/os.rst:452 ../../library/os.rst:536 +#: ../../library/os.rst:759 msgid "" "The function is a stub on WASI, see :ref:`wasm-availability` for more " "information." msgstr "" -#: ../../library/os.rst:384 +#: ../../library/os.rst:385 msgid "" "Return list of group ids that *user* belongs to. If *group* is not in the " "list, it is included; typically, *group* is specified as the group ID field " @@ -609,12 +604,12 @@ msgid "" "potentially omitted." msgstr "" -#: ../../library/os.rst:396 +#: ../../library/os.rst:397 msgid "" "Return list of supplemental group ids associated with the current process." msgstr "" -#: ../../library/os.rst:402 +#: ../../library/os.rst:403 msgid "" "On macOS, :func:`getgroups` behavior differs somewhat from other Unix " "platforms. If the Python interpreter was built with a deployment target of " @@ -631,7 +626,7 @@ msgid "" "get_config_var`." msgstr "" -#: ../../library/os.rst:419 +#: ../../library/os.rst:420 msgid "" "Return the name of the user logged in on the controlling terminal of the " "process. For most purposes, it is more useful to use :func:`getpass." @@ -640,32 +635,32 @@ msgid "" "getpwuid(os.getuid())[0]`` to get the login name of the current real user id." msgstr "" -#: ../../library/os.rst:431 +#: ../../library/os.rst:432 msgid "" "Return the process group id of the process with process id *pid*. If *pid* " "is 0, the process group id of the current process is returned." msgstr "" -#: ../../library/os.rst:440 +#: ../../library/os.rst:441 msgid "Return the id of the current process group." msgstr "" -#: ../../library/os.rst:449 +#: ../../library/os.rst:450 msgid "Return the current process id." msgstr "" -#: ../../library/os.rst:458 +#: ../../library/os.rst:459 msgid "" "Return the parent's process id. When the parent process has exited, on Unix " "the id returned is the one of the init process (1), on Windows it is still " "the same id, which may be already reused by another process." msgstr "" -#: ../../library/os.rst:464 +#: ../../library/os.rst:465 msgid "Added support for Windows." msgstr "新增對 Windows 的支援。" -#: ../../library/os.rst:472 +#: ../../library/os.rst:473 msgid "" "Get program scheduling priority. The value *which* is one of :const:" "`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who* is " @@ -676,42 +671,42 @@ msgid "" "user ID of the calling process." msgstr "" -#: ../../library/os.rst:489 ../../library/os.rst:501 +#: ../../library/os.rst:490 ../../library/os.rst:502 msgid "" "Parameters for the :func:`getpriority` and :func:`setpriority` functions." msgstr "" -#: ../../library/os.rst:509 +#: ../../library/os.rst:510 msgid "" "Return a tuple (ruid, euid, suid) denoting the current process's real, " "effective, and saved user ids." msgstr "" -#: ../../library/os.rst:519 +#: ../../library/os.rst:520 msgid "" "Return a tuple (rgid, egid, sgid) denoting the current process's real, " "effective, and saved group ids." msgstr "" -#: ../../library/os.rst:531 +#: ../../library/os.rst:532 msgid "Return the current process's real user id." msgstr "" -#: ../../library/os.rst:541 +#: ../../library/os.rst:542 msgid "" "Call the system initgroups() to initialize the group access list with all of " "the groups of which the specified username is a member, plus the specified " "group id." msgstr "" -#: ../../library/os.rst:554 +#: ../../library/os.rst:555 msgid "" "Set the environment variable named *key* to the string *value*. Such " "changes to the environment affect subprocesses started with :func:`os." "system`, :func:`popen` or :func:`fork` and :func:`execv`." msgstr "" -#: ../../library/os.rst:558 +#: ../../library/os.rst:559 msgid "" "Assignments to items in :data:`os.environ` are automatically translated into " "corresponding calls to :func:`putenv`; however, calls to :func:`putenv` " @@ -721,13 +716,13 @@ msgid "" "in their implementations." msgstr "" -#: ../../library/os.rst:566 +#: ../../library/os.rst:567 msgid "" "On some platforms, including FreeBSD and macOS, setting ``environ`` may " "cause memory leaks. Refer to the system documentation for :c:func:`!putenv`." msgstr "" -#: ../../library/os.rst:569 +#: ../../library/os.rst:570 msgid "" "Raises an :ref:`auditing event ` ``os.putenv`` with arguments " "``key``, ``value``." @@ -735,24 +730,23 @@ msgstr "" "引發一個附帶引數 ``key``、``value`` 的\\ :ref:`稽核事件 ` ``os." "putenv``。" -#: ../../library/os.rst:571 +#: ../../library/os.rst:572 msgid "The function is now always available." -msgstr "" -"此函式現在都會是可用的。" +msgstr "此函式現在都會是可用的。" -#: ../../library/os.rst:577 +#: ../../library/os.rst:578 msgid "Set the current process's effective group id." msgstr "" -#: ../../library/os.rst:584 +#: ../../library/os.rst:585 msgid "Set the current process's effective user id." msgstr "" -#: ../../library/os.rst:591 +#: ../../library/os.rst:592 msgid "Set the current process' group id." msgstr "" -#: ../../library/os.rst:598 +#: ../../library/os.rst:599 msgid "" "Set the list of supplemental group ids associated with the current process " "to *groups*. *groups* must be a sequence, and each element must be an " @@ -760,7 +754,7 @@ msgid "" "the superuser." msgstr "" -#: ../../library/os.rst:604 +#: ../../library/os.rst:605 msgid "" "On macOS, the length of *groups* may not exceed the system-defined maximum " "number of effective group ids, typically 16. See the documentation for :func:" @@ -768,13 +762,13 @@ msgid "" "calling setgroups()." msgstr "" -#: ../../library/os.rst:611 +#: ../../library/os.rst:612 msgid "" "Reassociate the current thread with a Linux namespace. See the :manpage:" "`setns(2)` and :manpage:`namespaces(7)` man pages for more details." msgstr "" -#: ../../library/os.rst:615 +#: ../../library/os.rst:616 msgid "" "If *fd* refers to a :file:`/proc/{pid}/ns/` link, ``setns()`` reassociates " "the calling thread with the namespace associated with that link, and " @@ -783,7 +777,7 @@ msgid "" "constraints)." msgstr "" -#: ../../library/os.rst:622 +#: ../../library/os.rst:623 msgid "" "Since Linux 5.8, *fd* may refer to a PID file descriptor obtained from :func:" "`~os.pidfd_open`. In this case, ``setns()`` reassociates the calling thread " @@ -794,19 +788,19 @@ msgid "" "memberships in unspecified namespaces are left unchanged." msgstr "" -#: ../../library/os.rst:631 +#: ../../library/os.rst:632 msgid "" "*fd* can be any object with a :meth:`~io.IOBase.fileno` method, or a raw " "file descriptor." msgstr "" -#: ../../library/os.rst:633 +#: ../../library/os.rst:634 msgid "" "This example reassociates the thread with the ``init`` process's network " "namespace::" msgstr "" -#: ../../library/os.rst:635 +#: ../../library/os.rst:636 msgid "" "fd = os.open(\"/proc/1/ns/net\", os.O_RDONLY)\n" "os.setns(fd, os.CLONE_NEWNET)\n" @@ -816,25 +810,25 @@ msgstr "" "os.setns(fd, os.CLONE_NEWNET)\n" "os.close(fd)" -#: ../../library/os.rst:645 +#: ../../library/os.rst:646 msgid "The :func:`~os.unshare` function." msgstr ":func:`~os.unshare` 函式。" -#: ../../library/os.rst:649 +#: ../../library/os.rst:650 msgid "" "Call the system call :c:func:`!setpgrp` or ``setpgrp(0, 0)`` depending on " "which version is implemented (if any). See the Unix manual for the " "semantics." msgstr "" -#: ../../library/os.rst:657 +#: ../../library/os.rst:658 msgid "" "Call the system call :c:func:`!setpgid` to set the process group id of the " "process with id *pid* to the process group with id *pgrp*. See the Unix " "manual for the semantics." msgstr "" -#: ../../library/os.rst:668 +#: ../../library/os.rst:669 msgid "" "Set program scheduling priority. The value *which* is one of :const:" "`PRIO_PROCESS`, :const:`PRIO_PGRP`, or :const:`PRIO_USER`, and *who* is " @@ -847,96 +841,96 @@ msgid "" "scheduling." msgstr "" -#: ../../library/os.rst:685 +#: ../../library/os.rst:686 msgid "Set the current process's real and effective group ids." msgstr "" -#: ../../library/os.rst:692 +#: ../../library/os.rst:693 msgid "Set the current process's real, effective, and saved group ids." msgstr "" -#: ../../library/os.rst:701 +#: ../../library/os.rst:702 msgid "Set the current process's real, effective, and saved user ids." msgstr "" -#: ../../library/os.rst:710 +#: ../../library/os.rst:711 msgid "Set the current process's real and effective user ids." msgstr "" -#: ../../library/os.rst:717 +#: ../../library/os.rst:718 msgid "" "Call the system call :c:func:`!getsid`. See the Unix manual for the " "semantics." msgstr "" -#: ../../library/os.rst:724 +#: ../../library/os.rst:725 msgid "" "Call the system call :c:func:`!setsid`. See the Unix manual for the " "semantics." msgstr "" -#: ../../library/os.rst:733 +#: ../../library/os.rst:734 msgid "Set the current process's user id." msgstr "" -#: ../../library/os.rst:741 +#: ../../library/os.rst:742 msgid "" "Return the error message corresponding to the error code in *code*. On " "platforms where :c:func:`!strerror` returns ``NULL`` when given an unknown " "error number, :exc:`ValueError` is raised." msgstr "" -#: ../../library/os.rst:748 +#: ../../library/os.rst:749 msgid "" "``True`` if the native OS type of the environment is bytes (eg. ``False`` on " "Windows)." msgstr "" -#: ../../library/os.rst:756 +#: ../../library/os.rst:757 msgid "Set the current numeric umask and return the previous umask." msgstr "" -#: ../../library/os.rst:768 +#: ../../library/os.rst:769 msgid "" "Returns information identifying the current operating system. The return " "value is an object with five attributes:" msgstr "" -#: ../../library/os.rst:771 +#: ../../library/os.rst:772 msgid ":attr:`sysname` - operating system name" msgstr ":attr:`sysname` - 作業系統名稱" -#: ../../library/os.rst:772 +#: ../../library/os.rst:773 msgid ":attr:`nodename` - name of machine on network (implementation-defined)" msgstr "" -#: ../../library/os.rst:773 +#: ../../library/os.rst:774 msgid ":attr:`release` - operating system release" msgstr "" -#: ../../library/os.rst:774 +#: ../../library/os.rst:775 msgid ":attr:`version` - operating system version" msgstr ":attr:`version` - 作業系統版本" -#: ../../library/os.rst:775 +#: ../../library/os.rst:776 msgid ":attr:`machine` - hardware identifier" msgstr "" -#: ../../library/os.rst:777 +#: ../../library/os.rst:778 msgid "" "For backwards compatibility, this object is also iterable, behaving like a " "five-tuple containing :attr:`sysname`, :attr:`nodename`, :attr:`release`, :" "attr:`version`, and :attr:`machine` in that order." msgstr "" -#: ../../library/os.rst:782 +#: ../../library/os.rst:783 msgid "" "Some systems truncate :attr:`nodename` to 8 characters or to the leading " "component; a better way to get the hostname is :func:`socket.gethostname` " "or even ``socket.gethostbyaddr(socket.gethostname())``." msgstr "" -#: ../../library/os.rst:787 +#: ../../library/os.rst:788 msgid "" "On macOS, iOS and Android, this returns the *kernel* name and version (i.e., " "``'Darwin'`` on macOS and iOS; ``'Linux'`` on Android). :func:`platform." @@ -944,20 +938,20 @@ msgid "" "on iOS and Android." msgstr "" -#: ../../library/os.rst:794 ../../library/os.rst:5001 +#: ../../library/os.rst:795 ../../library/os.rst:5002 msgid "" "Return type changed from a tuple to a tuple-like object with named " "attributes." msgstr "" -#: ../../library/os.rst:803 +#: ../../library/os.rst:804 msgid "" "Unset (delete) the environment variable named *key*. Such changes to the " "environment affect subprocesses started with :func:`os.system`, :func:" "`popen` or :func:`fork` and :func:`execv`." msgstr "" -#: ../../library/os.rst:807 +#: ../../library/os.rst:808 msgid "" "Deletion of items in :data:`os.environ` is automatically translated into a " "corresponding call to :func:`unsetenv`; however, calls to :func:`unsetenv` " @@ -965,18 +959,18 @@ msgid "" "items of :data:`os.environ`." msgstr "" -#: ../../library/os.rst:812 +#: ../../library/os.rst:813 msgid "" "Raises an :ref:`auditing event ` ``os.unsetenv`` with argument " "``key``." msgstr "" "引發一個附帶引數 ``key`` 的\\ :ref:`稽核事件 ` ``os.unsetenv``。" -#: ../../library/os.rst:814 +#: ../../library/os.rst:815 msgid "The function is now always available and is also available on Windows." msgstr "" -#: ../../library/os.rst:820 +#: ../../library/os.rst:821 msgid "" "Disassociate parts of the process execution context, and move them into a " "newly created namespace. See the :manpage:`unshare(2)` man page for more " @@ -987,28 +981,28 @@ msgid "" "are made to the calling process's execution context." msgstr "" -#: ../../library/os.rst:837 +#: ../../library/os.rst:838 msgid "The :func:`~os.setns` function." msgstr ":func:`~os.setns` 函式。" -#: ../../library/os.rst:841 +#: ../../library/os.rst:842 msgid "" "Flags to the :func:`unshare` function, if the implementation supports them. " "See :manpage:`unshare(2)` in the Linux manual for their exact effect and " "availability." msgstr "" -#: ../../library/os.rst:864 +#: ../../library/os.rst:865 msgid "File Object Creation" msgstr "" -#: ../../library/os.rst:866 +#: ../../library/os.rst:867 msgid "" "These functions create new :term:`file objects `. (See also :" "func:`~os.open` for opening file descriptors.)" msgstr "" -#: ../../library/os.rst:872 +#: ../../library/os.rst:873 msgid "" "Return an open file object connected to the file descriptor *fd*. This is " "an alias of the :func:`open` built-in function and accepts the same " @@ -1016,16 +1010,16 @@ msgid "" "must always be an integer." msgstr "" -#: ../../library/os.rst:881 +#: ../../library/os.rst:882 msgid "File Descriptor Operations" msgstr "" -#: ../../library/os.rst:883 +#: ../../library/os.rst:884 msgid "" "These functions operate on I/O streams referenced using file descriptors." msgstr "" -#: ../../library/os.rst:885 +#: ../../library/os.rst:886 msgid "" "File descriptors are small integers corresponding to a file that has been " "opened by the current process. For example, standard input is usually file " @@ -1035,7 +1029,7 @@ msgid "" "pipes are also referenced by file descriptors." msgstr "" -#: ../../library/os.rst:892 +#: ../../library/os.rst:893 msgid "" "The :meth:`~io.IOBase.fileno` method can be used to obtain the file " "descriptor associated with a :term:`file object` when required. Note that " @@ -1043,11 +1037,11 @@ msgid "" "ignoring aspects such as internal buffering of data." msgstr "" -#: ../../library/os.rst:900 +#: ../../library/os.rst:901 msgid "Close file descriptor *fd*." msgstr "" -#: ../../library/os.rst:904 +#: ../../library/os.rst:905 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To close a " @@ -1055,13 +1049,13 @@ msgid "" "`popen` or :func:`fdopen`, use its :meth:`~io.IOBase.close` method." msgstr "" -#: ../../library/os.rst:912 +#: ../../library/os.rst:913 msgid "" "Close all file descriptors from *fd_low* (inclusive) to *fd_high* " "(exclusive), ignoring errors. Equivalent to (but much faster than)::" msgstr "" -#: ../../library/os.rst:915 +#: ../../library/os.rst:916 msgid "" "for fd in range(fd_low, fd_high):\n" " try:\n" @@ -1075,7 +1069,7 @@ msgstr "" " except OSError:\n" " pass" -#: ../../library/os.rst:924 +#: ../../library/os.rst:925 msgid "" "Copy *count* bytes from file descriptor *src*, starting from offset " "*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. " @@ -1083,14 +1077,14 @@ msgid "" "respectively for *offset_dst*." msgstr "" -#: ../../library/os.rst:929 +#: ../../library/os.rst:930 msgid "" "In Linux kernel older than 5.3, the files pointed to by *src* and *dst* must " "reside in the same filesystem, otherwise an :exc:`OSError` is raised with :" "attr:`~OSError.errno` set to :const:`errno.EXDEV`." msgstr "" -#: ../../library/os.rst:933 +#: ../../library/os.rst:934 msgid "" "This copy is done without the additional cost of transferring data from the " "kernel to user space and then back into the kernel. Additionally, some " @@ -1100,19 +1094,19 @@ msgid "" "(in the case of NFS)." msgstr "" -#: ../../library/os.rst:940 +#: ../../library/os.rst:941 msgid "" "The function copies bytes between two file descriptors. Text options, like " "the encoding and the line ending, are ignored." msgstr "" -#: ../../library/os.rst:943 +#: ../../library/os.rst:944 msgid "" "The return value is the amount of bytes copied. This could be less than the " "amount requested." msgstr "" -#: ../../library/os.rst:948 +#: ../../library/os.rst:949 msgid "" "On Linux, :func:`os.copy_file_range` should not be used for copying a range " "of a pseudo file from a special filesystem like procfs and sysfs. It will " @@ -1120,39 +1114,39 @@ msgid "" "known Linux kernel issue." msgstr "" -#: ../../library/os.rst:960 +#: ../../library/os.rst:961 msgid "" "Return a string describing the encoding of the device associated with *fd* " "if it is connected to a terminal; else return :const:`None`." msgstr "" -#: ../../library/os.rst:963 +#: ../../library/os.rst:964 msgid "" "On Unix, if the :ref:`Python UTF-8 Mode ` is enabled, return " "``'UTF-8'`` rather than the device encoding." msgstr "" -#: ../../library/os.rst:966 +#: ../../library/os.rst:967 msgid "On Unix, the function now implements the Python UTF-8 Mode." msgstr "" -#: ../../library/os.rst:972 +#: ../../library/os.rst:973 msgid "" "Return a duplicate of file descriptor *fd*. The new file descriptor is :ref:" "`non-inheritable `." msgstr "" -#: ../../library/os.rst:975 +#: ../../library/os.rst:976 msgid "" "On Windows, when duplicating a standard stream (0: stdin, 1: stdout, 2: " "stderr), the new file descriptor is :ref:`inheritable `." msgstr "" -#: ../../library/os.rst:981 ../../library/os.rst:1266 +#: ../../library/os.rst:982 ../../library/os.rst:1267 msgid "The new file descriptor is now non-inheritable." msgstr "" -#: ../../library/os.rst:987 +#: ../../library/os.rst:988 msgid "" "Duplicate file descriptor *fd* to *fd2*, closing the latter first if " "necessary. Return *fd2*. The new file descriptor is :ref:`inheritable " @@ -1160,23 +1154,23 @@ msgid "" "``False``." msgstr "" -#: ../../library/os.rst:994 +#: ../../library/os.rst:995 msgid "Add the optional *inheritable* parameter." -msgstr "" +msgstr "新增可選用的參數 *inheritable*。" -#: ../../library/os.rst:997 +#: ../../library/os.rst:998 msgid "Return *fd2* on success. Previously, ``None`` was always returned." msgstr "" -#: ../../library/os.rst:1003 +#: ../../library/os.rst:1004 msgid "" "Change the mode of the file given by *fd* to the numeric *mode*. See the " "docs for :func:`chmod` for possible values of *mode*. As of Python 3.3, " "this is equivalent to ``os.chmod(fd, mode)``." msgstr "" -#: ../../library/os.rst:1007 ../../library/os.rst:2136 -#: ../../library/os.rst:2237 +#: ../../library/os.rst:1008 ../../library/os.rst:2137 +#: ../../library/os.rst:2238 msgid "" "Raises an :ref:`auditing event ` ``os.chmod`` with arguments " "``path``, ``mode``, ``dir_fd``." @@ -1184,28 +1178,28 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.chmod``。" -#: ../../library/os.rst:1011 ../../library/os.rst:1029 -#: ../../library/os.rst:1120 ../../library/os.rst:1705 -#: ../../library/os.rst:2133 ../../library/os.rst:2166 -#: ../../library/os.rst:3458 +#: ../../library/os.rst:1012 ../../library/os.rst:1030 +#: ../../library/os.rst:1121 ../../library/os.rst:1706 +#: ../../library/os.rst:2134 ../../library/os.rst:2167 +#: ../../library/os.rst:3459 msgid "" "The function is limited on WASI, see :ref:`wasm-availability` for more " "information." msgstr "" -#: ../../library/os.rst:1014 ../../library/os.rst:2244 +#: ../../library/os.rst:1015 ../../library/os.rst:2245 msgid "Added support on Windows." msgstr "新增對 Windows 的支援。" -#: ../../library/os.rst:1020 +#: ../../library/os.rst:1021 msgid "" "Change the owner and group id of the file given by *fd* to the numeric *uid* " "and *gid*. To leave one of the ids unchanged, set it to -1. See :func:" "`chown`. As of Python 3.3, this is equivalent to ``os.chown(fd, uid, gid)``." msgstr "" -#: ../../library/os.rst:1025 ../../library/os.rst:2162 -#: ../../library/os.rst:2253 +#: ../../library/os.rst:1026 ../../library/os.rst:2163 +#: ../../library/os.rst:2254 msgid "" "Raises an :ref:`auditing event ` ``os.chown`` with arguments " "``path``, ``uid``, ``gid``, ``dir_fd``." @@ -1213,17 +1207,17 @@ msgstr "" "引發一個附帶引數 ``path``、``uid``、``gid``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.chown``。" -#: ../../library/os.rst:1035 +#: ../../library/os.rst:1036 msgid "" "Force write of file with filedescriptor *fd* to disk. Does not force update " "of metadata." msgstr "" -#: ../../library/os.rst:1041 +#: ../../library/os.rst:1042 msgid "This function is not available on MacOS." msgstr "" -#: ../../library/os.rst:1046 +#: ../../library/os.rst:1047 msgid "" "Return system configuration information relevant to an open file. *name* " "specifies the configuration value to retrieve; it may be a string which is " @@ -1234,7 +1228,7 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:1054 ../../library/os.rst:2572 +#: ../../library/os.rst:1055 ../../library/os.rst:2573 msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " @@ -1242,53 +1236,53 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:1059 +#: ../../library/os.rst:1060 msgid "As of Python 3.3, this is equivalent to ``os.pathconf(fd, name)``." msgstr "" -#: ../../library/os.rst:1066 +#: ../../library/os.rst:1067 msgid "" "Get the status of the file descriptor *fd*. Return a :class:`stat_result` " "object." msgstr "" -#: ../../library/os.rst:1069 +#: ../../library/os.rst:1070 msgid "As of Python 3.3, this is equivalent to ``os.stat(fd)``." msgstr "" -#: ../../library/os.rst:1073 ../../library/os.rst:2400 +#: ../../library/os.rst:1074 ../../library/os.rst:2401 msgid "The :func:`.stat` function." msgstr "" -#: ../../library/os.rst:1078 +#: ../../library/os.rst:1079 msgid "" "Return information about the filesystem containing the file associated with " "file descriptor *fd*, like :func:`statvfs`. As of Python 3.3, this is " "equivalent to ``os.statvfs(fd)``." msgstr "" -#: ../../library/os.rst:1087 +#: ../../library/os.rst:1088 msgid "" "Force write of file with filedescriptor *fd* to disk. On Unix, this calls " "the native :c:func:`!fsync` function; on Windows, the MS :c:func:`!_commit` " "function." msgstr "" -#: ../../library/os.rst:1090 +#: ../../library/os.rst:1091 msgid "" "If you're starting with a buffered Python :term:`file object` *f*, first do " "``f.flush()``, and then do ``os.fsync(f.fileno())``, to ensure that all " "internal buffers associated with *f* are written to disk." msgstr "" -#: ../../library/os.rst:1099 +#: ../../library/os.rst:1100 msgid "" "Truncate the file corresponding to file descriptor *fd*, so that it is at " "most *length* bytes in size. As of Python 3.3, this is equivalent to ``os." "truncate(fd, length)``." msgstr "" -#: ../../library/os.rst:1103 +#: ../../library/os.rst:1104 msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``fd``, ``length``." @@ -1296,46 +1290,46 @@ msgstr "" "引發一個附帶引數 ``fd``、``length`` 的\\ :ref:`稽核事件 ` ``os." "truncate``。" -#: ../../library/os.rst:1107 ../../library/os.rst:3497 +#: ../../library/os.rst:1108 ../../library/os.rst:3498 msgid "Added support for Windows" msgstr "新增對 Windows 的支援" -#: ../../library/os.rst:1113 +#: ../../library/os.rst:1114 msgid "" "Get the blocking mode of the file descriptor: ``False`` if the :data:" "`O_NONBLOCK` flag is set, ``True`` if the flag is cleared." msgstr "" -#: ../../library/os.rst:1116 +#: ../../library/os.rst:1117 msgid "See also :func:`set_blocking` and :meth:`socket.socket.setblocking`." msgstr "另請參閱 :func:`set_blocking` 與 :meth:`socket.socket.setblocking`。" -#: ../../library/os.rst:1123 ../../library/os.rst:1708 +#: ../../library/os.rst:1124 ../../library/os.rst:1709 msgid "On Windows, this function is limited to pipes." msgstr "" -#: ../../library/os.rst:1127 ../../library/os.rst:1712 +#: ../../library/os.rst:1128 ../../library/os.rst:1713 msgid "Added support for pipes on Windows." msgstr "新增對 Windows 上的 pipe 支援。" -#: ../../library/os.rst:1133 +#: ../../library/os.rst:1134 msgid "" "Grant access to the slave pseudo-terminal device associated with the master " "pseudo-terminal device to which the file descriptor *fd* refers. The file " "descriptor *fd* is not closed upon failure." msgstr "" -#: ../../library/os.rst:1137 +#: ../../library/os.rst:1138 msgid "Calls the C standard library function :c:func:`grantpt`." msgstr "" -#: ../../library/os.rst:1146 +#: ../../library/os.rst:1147 msgid "" "Return ``True`` if the file descriptor *fd* is open and connected to a tty(-" "like) device, else ``False``." msgstr "" -#: ../../library/os.rst:1152 +#: ../../library/os.rst:1153 msgid "" "Apply, test or remove a POSIX lock on an open file descriptor. *fd* is an " "open file descriptor. *cmd* specifies the command to use - one of :data:" @@ -1343,7 +1337,7 @@ msgid "" "specifies the section of the file to lock." msgstr "" -#: ../../library/os.rst:1158 +#: ../../library/os.rst:1159 msgid "" "Raises an :ref:`auditing event ` ``os.lockf`` with arguments " "``fd``, ``cmd``, ``len``." @@ -1351,119 +1345,119 @@ msgstr "" "引發一個附帶引數 ``fd``、``cmd``、``len`` 的\\ :ref:`稽核事件 ` " "``os.lockf``。" -#: ../../library/os.rst:1170 +#: ../../library/os.rst:1171 msgid "Flags that specify what action :func:`lockf` will take." msgstr "" -#: ../../library/os.rst:1179 +#: ../../library/os.rst:1180 msgid "" "Prepare the tty of which fd is a file descriptor for a new login session. " "Make the calling process a session leader; make the tty the controlling tty, " "the stdin, the stdout, and the stderr of the calling process; close fd." msgstr "" -#: ../../library/os.rst:1190 +#: ../../library/os.rst:1191 msgid "" "Set the current position of file descriptor *fd* to position *pos*, modified " "by *whence*, and return the new position in bytes relative to the start of " "the file. Valid values for *whence* are:" msgstr "" -#: ../../library/os.rst:1195 +#: ../../library/os.rst:1196 msgid "" ":const:`SEEK_SET` or ``0`` -- set *pos* relative to the beginning of the file" msgstr "" -#: ../../library/os.rst:1196 +#: ../../library/os.rst:1197 msgid "" ":const:`SEEK_CUR` or ``1`` -- set *pos* relative to the current file position" msgstr "" -#: ../../library/os.rst:1197 +#: ../../library/os.rst:1198 msgid ":const:`SEEK_END` or ``2`` -- set *pos* relative to the end of the file" msgstr "" -#: ../../library/os.rst:1198 +#: ../../library/os.rst:1199 msgid "" ":const:`SEEK_HOLE` -- set *pos* to the next data location, relative to *pos*" msgstr "" -#: ../../library/os.rst:1199 +#: ../../library/os.rst:1200 msgid "" ":const:`SEEK_DATA` -- set *pos* to the next data hole, relative to *pos*" msgstr "" -#: ../../library/os.rst:1203 +#: ../../library/os.rst:1204 msgid "Add support for :const:`!SEEK_HOLE` and :const:`!SEEK_DATA`." msgstr "" -#: ../../library/os.rst:1210 +#: ../../library/os.rst:1211 msgid "" "Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` " "method on :term:`file-like objects `, for whence to adjust the " "file position indicator." msgstr "" -#: ../../library/os.rst:1214 +#: ../../library/os.rst:1215 msgid ":const:`SEEK_SET`" msgstr ":const:`SEEK_SET`" -#: ../../library/os.rst:1215 +#: ../../library/os.rst:1216 msgid "Adjust the file position relative to the beginning of the file." msgstr "" -#: ../../library/os.rst:1216 +#: ../../library/os.rst:1217 msgid ":const:`SEEK_CUR`" msgstr ":const:`SEEK_CUR`" -#: ../../library/os.rst:1217 +#: ../../library/os.rst:1218 msgid "Adjust the file position relative to the current file position." msgstr "" -#: ../../library/os.rst:1218 +#: ../../library/os.rst:1219 msgid ":const:`SEEK_END`" msgstr ":const:`SEEK_END`" -#: ../../library/os.rst:1219 +#: ../../library/os.rst:1220 msgid "Adjust the file position relative to the end of the file." msgstr "" -#: ../../library/os.rst:1221 +#: ../../library/os.rst:1222 msgid "Their values are 0, 1, and 2, respectively." msgstr "" -#: ../../library/os.rst:1227 +#: ../../library/os.rst:1228 msgid "" "Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` " "method on :term:`file-like objects `, for seeking file data and " "holes on sparsely allocated files." msgstr "" -#: ../../library/os.rst:1231 +#: ../../library/os.rst:1232 msgid ":data:`!SEEK_DATA`" msgstr ":data:`!SEEK_DATA`" -#: ../../library/os.rst:1232 +#: ../../library/os.rst:1233 msgid "" "Adjust the file offset to the next location containing data, relative to the " "seek position." msgstr "" -#: ../../library/os.rst:1235 +#: ../../library/os.rst:1236 msgid ":data:`!SEEK_HOLE`" msgstr ":data:`!SEEK_HOLE`" -#: ../../library/os.rst:1236 +#: ../../library/os.rst:1237 msgid "" "Adjust the file offset to the next location containing a hole, relative to " "the seek position. A hole is defined as a sequence of zeros." msgstr "" -#: ../../library/os.rst:1242 +#: ../../library/os.rst:1243 msgid "These operations only make sense for filesystems that support them." msgstr "" -#: ../../library/os.rst:1251 +#: ../../library/os.rst:1252 msgid "" "Open the file *path* and set various flags according to *flags* and possibly " "its mode according to *mode*. When computing *mode*, the current umask " @@ -1471,7 +1465,7 @@ msgid "" "file. The new file descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:1256 +#: ../../library/os.rst:1257 msgid "" "For a description of the flag and mode values, see the C run-time " "documentation; flag constants (like :const:`O_RDONLY` and :const:`O_WRONLY`) " @@ -1479,13 +1473,13 @@ msgid "" "const:`O_BINARY` is needed to open files in binary mode." msgstr "" -#: ../../library/os.rst:1261 +#: ../../library/os.rst:1262 msgid "" "This function can support :ref:`paths relative to directory descriptors " "` with the *dir_fd* parameter." msgstr "" -#: ../../library/os.rst:1264 +#: ../../library/os.rst:1265 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." @@ -1493,7 +1487,7 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " "` ``open``。" -#: ../../library/os.rst:1271 +#: ../../library/os.rst:1272 msgid "" "This function is intended for low-level I/O. For normal usage, use the " "built-in function :func:`open`, which returns a :term:`file object` with :" @@ -1501,41 +1495,41 @@ msgid "" "a file descriptor in a file object, use :func:`fdopen`." msgstr "" -#: ../../library/os.rst:1276 ../../library/os.rst:2405 -#: ../../library/os.rst:2445 ../../library/os.rst:2516 -#: ../../library/os.rst:2538 ../../library/os.rst:2619 -#: ../../library/os.rst:2649 ../../library/os.rst:2756 -#: ../../library/os.rst:3513 +#: ../../library/os.rst:1277 ../../library/os.rst:2406 +#: ../../library/os.rst:2446 ../../library/os.rst:2517 +#: ../../library/os.rst:2539 ../../library/os.rst:2620 +#: ../../library/os.rst:2650 ../../library/os.rst:2757 +#: ../../library/os.rst:3514 msgid "Added the *dir_fd* parameter." msgstr "新增 *dir_fd* 參數。" -#: ../../library/os.rst:1279 ../../library/os.rst:1630 -#: ../../library/os.rst:1819 ../../library/os.rst:5097 +#: ../../library/os.rst:1280 ../../library/os.rst:1631 +#: ../../library/os.rst:1820 ../../library/os.rst:5098 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the function now retries the system call instead of raising an :" "exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -#: ../../library/os.rst:1284 ../../library/os.rst:2029 -#: ../../library/os.rst:2061 ../../library/os.rst:2092 -#: ../../library/os.rst:2142 ../../library/os.rst:2183 -#: ../../library/os.rst:2223 ../../library/os.rst:2241 -#: ../../library/os.rst:2257 ../../library/os.rst:2316 -#: ../../library/os.rst:2408 ../../library/os.rst:2448 -#: ../../library/os.rst:2492 ../../library/os.rst:2519 -#: ../../library/os.rst:2541 ../../library/os.rst:2582 -#: ../../library/os.rst:2652 ../../library/os.rst:2671 -#: ../../library/os.rst:2759 ../../library/os.rst:3049 -#: ../../library/os.rst:3336 ../../library/os.rst:3500 -#: ../../library/os.rst:3516 ../../library/os.rst:3556 -#: ../../library/os.rst:3656 ../../library/os.rst:3717 -#: ../../library/os.rst:4114 ../../library/os.rst:4294 -#: ../../library/os.rst:4859 +#: ../../library/os.rst:1285 ../../library/os.rst:2030 +#: ../../library/os.rst:2062 ../../library/os.rst:2093 +#: ../../library/os.rst:2143 ../../library/os.rst:2184 +#: ../../library/os.rst:2224 ../../library/os.rst:2242 +#: ../../library/os.rst:2258 ../../library/os.rst:2317 +#: ../../library/os.rst:2409 ../../library/os.rst:2449 +#: ../../library/os.rst:2493 ../../library/os.rst:2520 +#: ../../library/os.rst:2542 ../../library/os.rst:2583 +#: ../../library/os.rst:2653 ../../library/os.rst:2672 +#: ../../library/os.rst:2760 ../../library/os.rst:3050 +#: ../../library/os.rst:3337 ../../library/os.rst:3501 +#: ../../library/os.rst:3517 ../../library/os.rst:3557 +#: ../../library/os.rst:3657 ../../library/os.rst:3718 +#: ../../library/os.rst:4115 ../../library/os.rst:4295 +#: ../../library/os.rst:4860 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:1287 +#: ../../library/os.rst:1288 msgid "" "The following constants are options for the *flags* parameter to the :func:" "`~os.open` function. They can be combined using the bitwise OR operator ``|" @@ -1545,45 +1539,45 @@ msgid "" "on Windows." msgstr "" -#: ../../library/os.rst:1302 +#: ../../library/os.rst:1303 msgid "The above constants are available on Unix and Windows." msgstr "" -#: ../../library/os.rst:1313 +#: ../../library/os.rst:1314 msgid "The above constants are only available on Unix." msgstr "" -#: ../../library/os.rst:1315 +#: ../../library/os.rst:1316 msgid "Add :data:`O_CLOEXEC` constant." msgstr "" -#: ../../library/os.rst:1326 +#: ../../library/os.rst:1327 msgid "The above constants are only available on Windows." msgstr "" -#: ../../library/os.rst:1333 +#: ../../library/os.rst:1334 msgid "The above constants are only available on macOS." msgstr "" -#: ../../library/os.rst:1335 +#: ../../library/os.rst:1336 msgid "" "Add :data:`O_EVTONLY`, :data:`O_FSYNC`, :data:`O_SYMLINK` and :data:" "`O_NOFOLLOW_ANY` constants." msgstr "" -#: ../../library/os.rst:1349 +#: ../../library/os.rst:1350 msgid "" "The above constants are extensions and not present if they are not defined " "by the C library." msgstr "" -#: ../../library/os.rst:1352 +#: ../../library/os.rst:1353 msgid "" "Add :data:`O_PATH` on systems that support it. Add :data:`O_TMPFILE`, only " "available on Linux Kernel 3.11 or newer." msgstr "" -#: ../../library/os.rst:1362 +#: ../../library/os.rst:1363 msgid "" "Open a new pseudo-terminal pair. Return a pair of file descriptors " "``(master, slave)`` for the pty and the tty, respectively. The new file " @@ -1591,18 +1585,18 @@ msgid "" "more portable approach, use the :mod:`pty` module." msgstr "" -#: ../../library/os.rst:1369 ../../library/os.rst:1381 +#: ../../library/os.rst:1370 ../../library/os.rst:1382 msgid "The new file descriptors are now non-inheritable." msgstr "" -#: ../../library/os.rst:1375 +#: ../../library/os.rst:1376 msgid "" "Create a pipe. Return a pair of file descriptors ``(r, w)`` usable for " "reading and writing, respectively. The new file descriptor is :ref:`non-" "inheritable `." msgstr "" -#: ../../library/os.rst:1387 +#: ../../library/os.rst:1388 msgid "" "Create a pipe with *flags* set atomically. *flags* can be constructed by " "ORing together one or more of these values: :data:`O_NONBLOCK`, :data:" @@ -1610,13 +1604,13 @@ msgid "" "and writing, respectively." msgstr "" -#: ../../library/os.rst:1400 +#: ../../library/os.rst:1401 msgid "" "Ensures that enough disk space is allocated for the file specified by *fd* " "starting from *offset* and continuing for *len* bytes." msgstr "" -#: ../../library/os.rst:1410 +#: ../../library/os.rst:1411 msgid "" "Announces an intention to access data in a specific pattern thus allowing " "the kernel to make optimizations. The advice applies to the region of the " @@ -1627,43 +1621,43 @@ msgid "" "`POSIX_FADV_DONTNEED`." msgstr "" -#: ../../library/os.rst:1430 +#: ../../library/os.rst:1431 msgid "" "Flags that can be used in *advice* in :func:`posix_fadvise` that specify the " "access pattern that is likely to be used." msgstr "" -#: ../../library/os.rst:1440 +#: ../../library/os.rst:1441 msgid "" "Read at most *n* bytes from file descriptor *fd* at a position of *offset*, " "leaving the file offset unchanged." msgstr "" -#: ../../library/os.rst:1443 ../../library/os.rst:1619 +#: ../../library/os.rst:1444 ../../library/os.rst:1620 msgid "" "Return a bytestring containing the bytes read. If the end of the file " "referred to by *fd* has been reached, an empty bytes object is returned." msgstr "" -#: ../../library/os.rst:1453 +#: ../../library/os.rst:1454 msgid "Open and return a file descriptor for a master pseudo-terminal device." msgstr "" -#: ../../library/os.rst:1455 +#: ../../library/os.rst:1456 msgid "" "Calls the C standard library function :c:func:`posix_openpt`. The *oflag* " "argument is used to set file status flags and file access modes as specified " "in the manual page of :c:func:`posix_openpt` of your system." msgstr "" -#: ../../library/os.rst:1459 +#: ../../library/os.rst:1460 msgid "" "The returned file descriptor is :ref:`non-inheritable `. If " "the value :data:`O_CLOEXEC` is available on the system, it is added to " "*oflag*." msgstr "" -#: ../../library/os.rst:1470 +#: ../../library/os.rst:1471 msgid "" "Read from a file descriptor *fd* at a position of *offset* into mutable :" "term:`bytes-like objects ` *buffers*, leaving the file " @@ -1671,92 +1665,92 @@ msgid "" "move on to the next buffer in the sequence to hold the rest of the data." msgstr "" -#: ../../library/os.rst:1475 ../../library/os.rst:1560 +#: ../../library/os.rst:1476 ../../library/os.rst:1561 msgid "" "The flags argument contains a bitwise OR of zero or more of the following " "flags:" msgstr "" -#: ../../library/os.rst:1478 +#: ../../library/os.rst:1479 msgid ":data:`RWF_HIPRI`" msgstr ":data:`RWF_HIPRI`" -#: ../../library/os.rst:1479 +#: ../../library/os.rst:1480 msgid ":data:`RWF_NOWAIT`" msgstr ":data:`RWF_NOWAIT`" -#: ../../library/os.rst:1481 ../../library/os.rst:1756 +#: ../../library/os.rst:1482 ../../library/os.rst:1757 msgid "" "Return the total number of bytes actually read which can be less than the " "total capacity of all the objects." msgstr "" -#: ../../library/os.rst:1484 ../../library/os.rst:1569 -#: ../../library/os.rst:1759 ../../library/os.rst:1834 +#: ../../library/os.rst:1485 ../../library/os.rst:1570 +#: ../../library/os.rst:1760 ../../library/os.rst:1835 msgid "" "The operating system may set a limit (:func:`sysconf` value " "``'SC_IOV_MAX'``) on the number of buffers that can be used." msgstr "" -#: ../../library/os.rst:1487 +#: ../../library/os.rst:1488 msgid "Combine the functionality of :func:`os.readv` and :func:`os.pread`." msgstr "" -#: ../../library/os.rst:1491 ../../library/os.rst:1576 +#: ../../library/os.rst:1492 ../../library/os.rst:1577 msgid "Using flags requires Linux >= 4.6." msgstr "" -#: ../../library/os.rst:1498 +#: ../../library/os.rst:1499 msgid "" "Do not wait for data which is not immediately available. If this flag is " "specified, the system call will return instantly if it would have to read " "data from the backing storage or wait for a lock." msgstr "" -#: ../../library/os.rst:1502 +#: ../../library/os.rst:1503 msgid "" "If some data was successfully read, it will return the number of bytes read. " "If no bytes were read, it will return ``-1`` and set errno to :const:`errno." "EAGAIN`." msgstr "" -#: ../../library/os.rst:1513 +#: ../../library/os.rst:1514 msgid "" "High priority read/write. Allows block-based filesystems to use polling of " "the device, which provides lower latency, but may use additional resources." msgstr "" -#: ../../library/os.rst:1517 +#: ../../library/os.rst:1518 msgid "" "Currently, on Linux, this feature is usable only on a file descriptor opened " "using the :data:`O_DIRECT` flag." msgstr "" -#: ../../library/os.rst:1527 +#: ../../library/os.rst:1528 msgid "" "Return the name of the slave pseudo-terminal device associated with the " "master pseudo-terminal device to which the file descriptor *fd* refers. The " "file descriptor *fd* is not closed upon failure." msgstr "" -#: ../../library/os.rst:1531 +#: ../../library/os.rst:1532 msgid "" "Calls the reentrant C standard library function :c:func:`ptsname_r` if it is " "available; otherwise, the C standard library function :c:func:`ptsname`, " "which is not guaranteed to be thread-safe, is called." msgstr "" -#: ../../library/os.rst:1542 +#: ../../library/os.rst:1543 msgid "" "Write the bytestring in *str* to file descriptor *fd* at position of " "*offset*, leaving the file offset unchanged." msgstr "" -#: ../../library/os.rst:1545 ../../library/os.rst:1809 +#: ../../library/os.rst:1546 ../../library/os.rst:1810 msgid "Return the number of bytes actually written." msgstr "" -#: ../../library/os.rst:1554 +#: ../../library/os.rst:1555 msgid "" "Write the *buffers* contents to file descriptor *fd* at an offset *offset*, " "leaving the file offset unchanged. *buffers* must be a sequence of :term:" @@ -1765,39 +1759,39 @@ msgid "" "the second, and so on." msgstr "" -#: ../../library/os.rst:1563 +#: ../../library/os.rst:1564 msgid ":data:`RWF_DSYNC`" msgstr ":data:`RWF_DSYNC`" -#: ../../library/os.rst:1564 +#: ../../library/os.rst:1565 msgid ":data:`RWF_SYNC`" msgstr ":data:`RWF_SYNC`" -#: ../../library/os.rst:1565 +#: ../../library/os.rst:1566 msgid ":data:`RWF_APPEND`" msgstr ":data:`RWF_APPEND`" -#: ../../library/os.rst:1567 +#: ../../library/os.rst:1568 msgid "Return the total number of bytes actually written." msgstr "" -#: ../../library/os.rst:1572 +#: ../../library/os.rst:1573 msgid "Combine the functionality of :func:`os.writev` and :func:`os.pwrite`." msgstr "" -#: ../../library/os.rst:1583 +#: ../../library/os.rst:1584 msgid "" "Provide a per-write equivalent of the :data:`O_DSYNC` :func:`os.open` flag. " "This flag effect applies only to the data range written by the system call." msgstr "" -#: ../../library/os.rst:1593 +#: ../../library/os.rst:1594 msgid "" "Provide a per-write equivalent of the :data:`O_SYNC` :func:`os.open` flag. " "This flag effect applies only to the data range written by the system call." msgstr "" -#: ../../library/os.rst:1603 +#: ../../library/os.rst:1604 msgid "" "Provide a per-write equivalent of the :data:`O_APPEND` :func:`os.open` flag. " "This flag is meaningful only for :func:`os.pwritev`, and its effect applies " @@ -1807,11 +1801,11 @@ msgid "" "*offset* is updated." msgstr "" -#: ../../library/os.rst:1617 +#: ../../library/os.rst:1618 msgid "Read at most *n* bytes from file descriptor *fd*." msgstr "" -#: ../../library/os.rst:1624 +#: ../../library/os.rst:1625 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To read a \"file " @@ -1820,26 +1814,26 @@ msgid "" "`~file.readline` methods." msgstr "" -#: ../../library/os.rst:1639 +#: ../../library/os.rst:1640 msgid "" "Copy *count* bytes from file descriptor *in_fd* to file descriptor *out_fd* " "starting at *offset*. Return the number of bytes sent. When EOF is reached " "return ``0``." msgstr "" -#: ../../library/os.rst:1643 +#: ../../library/os.rst:1644 msgid "" "The first function notation is supported by all platforms that define :func:" "`sendfile`." msgstr "" -#: ../../library/os.rst:1646 +#: ../../library/os.rst:1647 msgid "" "On Linux, if *offset* is given as ``None``, the bytes are read from the " "current position of *in_fd* and the position of *in_fd* is updated." msgstr "" -#: ../../library/os.rst:1649 +#: ../../library/os.rst:1650 msgid "" "The second case may be used on macOS and FreeBSD where *headers* and " "*trailers* are arbitrary sequences of buffers that are written before and " @@ -1847,58 +1841,58 @@ msgid "" "case." msgstr "" -#: ../../library/os.rst:1653 +#: ../../library/os.rst:1654 msgid "" "On macOS and FreeBSD, a value of ``0`` for *count* specifies to send until " "the end of *in_fd* is reached." msgstr "" -#: ../../library/os.rst:1656 +#: ../../library/os.rst:1657 msgid "" "All platforms support sockets as *out_fd* file descriptor, and some " "platforms allow other types (e.g. regular file, pipe) as well." msgstr "" -#: ../../library/os.rst:1659 +#: ../../library/os.rst:1660 msgid "" "Cross-platform applications should not use *headers*, *trailers* and *flags* " "arguments." msgstr "" -#: ../../library/os.rst:1666 +#: ../../library/os.rst:1667 msgid "" "For a higher-level wrapper of :func:`sendfile`, see :meth:`socket.socket." "sendfile`." msgstr "" -#: ../../library/os.rst:1671 +#: ../../library/os.rst:1672 msgid "Parameters *out* and *in* was renamed to *out_fd* and *in_fd*." msgstr "" -#: ../../library/os.rst:1679 +#: ../../library/os.rst:1680 msgid "" "Parameters to the :func:`sendfile` function, if the implementation supports " "them." msgstr "" -#: ../../library/os.rst:1688 +#: ../../library/os.rst:1689 msgid "" "Parameter to the :func:`sendfile` function, if the implementation supports " "it. The data won't be cached in the virtual memory and will be freed " "afterwards." msgstr "" -#: ../../library/os.rst:1698 +#: ../../library/os.rst:1699 msgid "" "Set the blocking mode of the specified file descriptor. Set the :data:" "`O_NONBLOCK` flag if blocking is ``False``, clear the flag otherwise." msgstr "" -#: ../../library/os.rst:1701 +#: ../../library/os.rst:1702 msgid "See also :func:`get_blocking` and :meth:`socket.socket.setblocking`." msgstr "另請參閱 :func:`get_blocking` 與 :meth:`socket.socket.setblocking`。" -#: ../../library/os.rst:1718 +#: ../../library/os.rst:1719 msgid "" "Transfer *count* bytes from file descriptor *src*, starting from offset " "*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. " @@ -1910,7 +1904,7 @@ msgid "" "`~OSError.errno` set to :const:`errno.EXDEV`." msgstr "" -#: ../../library/os.rst:1727 +#: ../../library/os.rst:1728 msgid "" "This copy is done without the additional cost of transferring data from the " "kernel to user space and then back into the kernel. Additionally, some " @@ -1918,7 +1912,7 @@ msgid "" "files are opened as binary." msgstr "" -#: ../../library/os.rst:1732 +#: ../../library/os.rst:1733 msgid "" "Upon successful completion, returns the number of bytes spliced to or from " "the pipe. A return value of 0 means end of input. If *src* refers to a pipe, " @@ -1927,7 +1921,7 @@ msgid "" "the pipe." msgstr "" -#: ../../library/os.rst:1751 +#: ../../library/os.rst:1752 msgid "" "Read from a file descriptor *fd* into a number of mutable :term:`bytes-like " "objects ` *buffers*. Transfer data into each buffer until " @@ -1935,41 +1929,41 @@ msgid "" "rest of the data." msgstr "" -#: ../../library/os.rst:1769 +#: ../../library/os.rst:1770 msgid "" "Return the process group associated with the terminal given by *fd* (an open " "file descriptor as returned by :func:`os.open`)." msgstr "" -#: ../../library/os.rst:1777 +#: ../../library/os.rst:1778 msgid "" "Set the process group associated with the terminal given by *fd* (an open " "file descriptor as returned by :func:`os.open`) to *pg*." msgstr "" -#: ../../library/os.rst:1785 +#: ../../library/os.rst:1786 msgid "" "Return a string which specifies the terminal device associated with file " "descriptor *fd*. If *fd* is not associated with a terminal device, an " "exception is raised." msgstr "" -#: ../../library/os.rst:1794 +#: ../../library/os.rst:1795 msgid "" "Unlock the slave pseudo-terminal device associated with the master pseudo-" "terminal device to which the file descriptor *fd* refers. The file " "descriptor *fd* is not closed upon failure." msgstr "" -#: ../../library/os.rst:1798 +#: ../../library/os.rst:1799 msgid "Calls the C standard library function :c:func:`unlockpt`." msgstr "" -#: ../../library/os.rst:1807 +#: ../../library/os.rst:1808 msgid "Write the bytestring in *str* to file descriptor *fd*." msgstr "" -#: ../../library/os.rst:1813 +#: ../../library/os.rst:1814 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To write a " @@ -1978,7 +1972,7 @@ msgid "" "its :meth:`~file.write` method." msgstr "" -#: ../../library/os.rst:1827 +#: ../../library/os.rst:1828 msgid "" "Write the contents of *buffers* to file descriptor *fd*. *buffers* must be a " "sequence of :term:`bytes-like objects `. Buffers are " @@ -1986,70 +1980,70 @@ msgid "" "before proceeding to the second, and so on." msgstr "" -#: ../../library/os.rst:1832 +#: ../../library/os.rst:1833 msgid "Returns the total number of bytes actually written." msgstr "" -#: ../../library/os.rst:1845 +#: ../../library/os.rst:1846 msgid "Querying the size of a terminal" msgstr "" -#: ../../library/os.rst:1851 +#: ../../library/os.rst:1852 msgid "" "Return the size of the terminal window as ``(columns, lines)``, tuple of " "type :class:`terminal_size`." msgstr "" -#: ../../library/os.rst:1854 +#: ../../library/os.rst:1855 msgid "" "The optional argument ``fd`` (default ``STDOUT_FILENO``, or standard output) " "specifies which file descriptor should be queried." msgstr "" -#: ../../library/os.rst:1857 +#: ../../library/os.rst:1858 msgid "" "If the file descriptor is not connected to a terminal, an :exc:`OSError` is " "raised." msgstr "" -#: ../../library/os.rst:1860 +#: ../../library/os.rst:1861 msgid "" ":func:`shutil.get_terminal_size` is the high-level function which should " "normally be used, ``os.get_terminal_size`` is the low-level implementation." msgstr "" -#: ../../library/os.rst:1868 +#: ../../library/os.rst:1869 msgid "" "A subclass of tuple, holding ``(columns, lines)`` of the terminal window " "size." msgstr "" -#: ../../library/os.rst:1872 +#: ../../library/os.rst:1873 msgid "Width of the terminal window in characters." msgstr "" -#: ../../library/os.rst:1876 +#: ../../library/os.rst:1877 msgid "Height of the terminal window in characters." msgstr "" -#: ../../library/os.rst:1882 +#: ../../library/os.rst:1883 msgid "Inheritance of File Descriptors" msgstr "" -#: ../../library/os.rst:1886 +#: ../../library/os.rst:1887 msgid "" "A file descriptor has an \"inheritable\" flag which indicates if the file " "descriptor can be inherited by child processes. Since Python 3.4, file " "descriptors created by Python are non-inheritable by default." msgstr "" -#: ../../library/os.rst:1890 +#: ../../library/os.rst:1891 msgid "" "On UNIX, non-inheritable file descriptors are closed in child processes at " "the execution of a new program, other file descriptors are inherited." msgstr "" -#: ../../library/os.rst:1893 +#: ../../library/os.rst:1894 msgid "" "On Windows, non-inheritable handles and file descriptors are closed in child " "processes, except for standard streams (file descriptors 0, 1 and 2: stdin, " @@ -2060,38 +2054,38 @@ msgid "" "only inherited if the *close_fds* parameter is ``False``." msgstr "" -#: ../../library/os.rst:1901 +#: ../../library/os.rst:1902 msgid "On WebAssembly platforms, the file descriptor cannot be modified." msgstr "" -#: ../../library/os.rst:1905 +#: ../../library/os.rst:1906 msgid "" "Get the \"inheritable\" flag of the specified file descriptor (a boolean)." msgstr "" -#: ../../library/os.rst:1909 +#: ../../library/os.rst:1910 msgid "Set the \"inheritable\" flag of the specified file descriptor." msgstr "" -#: ../../library/os.rst:1913 +#: ../../library/os.rst:1914 msgid "Get the \"inheritable\" flag of the specified handle (a boolean)." msgstr "" -#: ../../library/os.rst:1919 +#: ../../library/os.rst:1920 msgid "Set the \"inheritable\" flag of the specified handle." msgstr "" -#: ../../library/os.rst:1927 +#: ../../library/os.rst:1928 msgid "Files and Directories" msgstr "" -#: ../../library/os.rst:1929 +#: ../../library/os.rst:1930 msgid "" "On some Unix platforms, many of these functions support one or more of these " "features:" msgstr "" -#: ../../library/os.rst:1934 +#: ../../library/os.rst:1935 msgid "" "**specifying a file descriptor:** Normally the *path* argument provided to " "functions in the :mod:`os` module must be a string specifying a file path. " @@ -2102,7 +2096,7 @@ msgid "" "``chdir``).)" msgstr "" -#: ../../library/os.rst:1942 +#: ../../library/os.rst:1943 msgid "" "You can check whether or not *path* can be specified as a file descriptor " "for a particular function on your platform using :data:`os.supports_fd`. If " @@ -2110,13 +2104,13 @@ msgid "" "`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1947 +#: ../../library/os.rst:1948 msgid "" "If the function also supports *dir_fd* or *follow_symlinks* arguments, it's " "an error to specify one of those when supplying *path* as a file descriptor." msgstr "" -#: ../../library/os.rst:1952 +#: ../../library/os.rst:1953 msgid "" "**paths relative to directory descriptors:** If *dir_fd* is not ``None``, it " "should be a file descriptor referring to a directory, and the path to " @@ -2127,14 +2121,14 @@ msgid "" "``access``)." msgstr "" -#: ../../library/os.rst:1959 +#: ../../library/os.rst:1960 msgid "" "You can check whether or not *dir_fd* is supported for a particular function " "on your platform using :data:`os.supports_dir_fd`. If it's unavailable, " "using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1965 +#: ../../library/os.rst:1966 msgid "" "**not following symlinks:** If *follow_symlinks* is ``False``, and the last " "element of the path to operate on is a symbolic link, the function will " @@ -2143,14 +2137,14 @@ msgid "" "function.)" msgstr "" -#: ../../library/os.rst:1971 +#: ../../library/os.rst:1972 msgid "" "You can check whether or not *follow_symlinks* is supported for a particular " "function on your platform using :data:`os.supports_follow_symlinks`. If it's " "unavailable, using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1979 +#: ../../library/os.rst:1980 msgid "" "Use the real uid/gid to test for access to *path*. Note that most " "operations will use the effective uid/gid, therefore this routine can be " @@ -2162,13 +2156,13 @@ msgid "" "manpage:`access(2)` for more information." msgstr "" -#: ../../library/os.rst:1988 +#: ../../library/os.rst:1989 msgid "" "This function can support specifying :ref:`paths relative to directory " "descriptors ` and :ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:1991 +#: ../../library/os.rst:1992 msgid "" "If *effective_ids* is ``True``, :func:`access` will perform its access " "checks using the effective uid/gid instead of the real uid/gid. " @@ -2177,7 +2171,7 @@ msgid "" "unavailable, using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1999 +#: ../../library/os.rst:2000 msgid "" "Using :func:`access` to check if a user is authorized to e.g. open a file " "before actually doing so using :func:`open` creates a security hole, because " @@ -2186,7 +2180,7 @@ msgid "" "For example::" msgstr "" -#: ../../library/os.rst:2005 +#: ../../library/os.rst:2006 msgid "" "if os.access(\"myfile\", os.R_OK):\n" " with open(\"myfile\") as fp:\n" @@ -2198,11 +2192,11 @@ msgstr "" " return fp.read()\n" "return \"some default data\"" -#: ../../library/os.rst:2010 +#: ../../library/os.rst:2011 msgid "is better written as::" msgstr "" -#: ../../library/os.rst:2012 +#: ../../library/os.rst:2013 msgid "" "try:\n" " fp = open(\"myfile\")\n" @@ -2220,113 +2214,113 @@ msgstr "" " with fp:\n" " return fp.read()" -#: ../../library/os.rst:2022 +#: ../../library/os.rst:2023 msgid "" "I/O operations may fail even when :func:`access` indicates that they would " "succeed, particularly for operations on network filesystems which may have " "permissions semantics beyond the usual POSIX permission-bit model." msgstr "" -#: ../../library/os.rst:2026 +#: ../../library/os.rst:2027 msgid "Added the *dir_fd*, *effective_ids*, and *follow_symlinks* parameters." msgstr "新增 *dir_fd*、*effective_ids* 與 *follow_symlinks* 參數。" -#: ../../library/os.rst:2038 +#: ../../library/os.rst:2039 msgid "" "Values to pass as the *mode* parameter of :func:`access` to test the " "existence, readability, writability and executability of *path*, " "respectively." msgstr "" -#: ../../library/os.rst:2047 +#: ../../library/os.rst:2048 msgid "Change the current working directory to *path*." msgstr "" -#: ../../library/os.rst:2049 +#: ../../library/os.rst:2050 msgid "" "This function can support :ref:`specifying a file descriptor `. " "The descriptor must refer to an opened directory, not an open file." msgstr "" -#: ../../library/os.rst:2052 +#: ../../library/os.rst:2053 msgid "" "This function can raise :exc:`OSError` and subclasses such as :exc:" "`FileNotFoundError`, :exc:`PermissionError`, and :exc:`NotADirectoryError`." msgstr "" -#: ../../library/os.rst:2055 ../../library/os.rst:2193 +#: ../../library/os.rst:2056 ../../library/os.rst:2194 msgid "" "Raises an :ref:`auditing event ` ``os.chdir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.chdir``。" -#: ../../library/os.rst:2057 +#: ../../library/os.rst:2058 msgid "" "Added support for specifying *path* as a file descriptor on some platforms." msgstr "" -#: ../../library/os.rst:2067 +#: ../../library/os.rst:2068 msgid "" "Set the flags of *path* to the numeric *flags*. *flags* may take a " "combination (bitwise OR) of the following values (as defined in the :mod:" "`stat` module):" msgstr "" -#: ../../library/os.rst:2070 +#: ../../library/os.rst:2071 msgid ":const:`stat.UF_NODUMP`" msgstr ":const:`stat.UF_NODUMP`" -#: ../../library/os.rst:2071 +#: ../../library/os.rst:2072 msgid ":const:`stat.UF_IMMUTABLE`" msgstr ":const:`stat.UF_IMMUTABLE`" -#: ../../library/os.rst:2072 +#: ../../library/os.rst:2073 msgid ":const:`stat.UF_APPEND`" msgstr ":const:`stat.UF_APPEND`" -#: ../../library/os.rst:2073 +#: ../../library/os.rst:2074 msgid ":const:`stat.UF_OPAQUE`" msgstr ":const:`stat.UF_OPAQUE`" -#: ../../library/os.rst:2074 +#: ../../library/os.rst:2075 msgid ":const:`stat.UF_NOUNLINK`" msgstr ":const:`stat.UF_NOUNLINK`" -#: ../../library/os.rst:2075 +#: ../../library/os.rst:2076 msgid ":const:`stat.UF_COMPRESSED`" msgstr ":const:`stat.UF_COMPRESSED`" -#: ../../library/os.rst:2076 +#: ../../library/os.rst:2077 msgid ":const:`stat.UF_HIDDEN`" msgstr ":const:`stat.UF_HIDDEN`" -#: ../../library/os.rst:2077 +#: ../../library/os.rst:2078 msgid ":const:`stat.SF_ARCHIVED`" msgstr ":const:`stat.SF_ARCHIVED`" -#: ../../library/os.rst:2078 +#: ../../library/os.rst:2079 msgid ":const:`stat.SF_IMMUTABLE`" msgstr ":const:`stat.SF_IMMUTABLE`" -#: ../../library/os.rst:2079 +#: ../../library/os.rst:2080 msgid ":const:`stat.SF_APPEND`" msgstr ":const:`stat.SF_APPEND`" -#: ../../library/os.rst:2080 +#: ../../library/os.rst:2081 msgid ":const:`stat.SF_NOUNLINK`" msgstr ":const:`stat.SF_NOUNLINK`" -#: ../../library/os.rst:2081 +#: ../../library/os.rst:2082 msgid ":const:`stat.SF_SNAPSHOT`" msgstr ":const:`stat.SF_SNAPSHOT`" -#: ../../library/os.rst:2083 +#: ../../library/os.rst:2084 msgid "" "This function can support :ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:2085 ../../library/os.rst:2219 +#: ../../library/os.rst:2086 ../../library/os.rst:2220 msgid "" "Raises an :ref:`auditing event ` ``os.chflags`` with arguments " "``path``, ``flags``." @@ -2334,102 +2328,102 @@ msgstr "" "引發一個附帶引數 ``path``、``flags`` 的\\ :ref:`稽核事件 ` ``os." "chflags``。" -#: ../../library/os.rst:2089 +#: ../../library/os.rst:2090 msgid "Added the *follow_symlinks* parameter." msgstr "新增 *follow_symlinks* 參數。" -#: ../../library/os.rst:2098 +#: ../../library/os.rst:2099 msgid "" "Change the mode of *path* to the numeric *mode*. *mode* may take one of the " "following values (as defined in the :mod:`stat` module) or bitwise ORed " "combinations of them:" msgstr "" -#: ../../library/os.rst:2102 +#: ../../library/os.rst:2103 msgid ":const:`stat.S_ISUID`" msgstr ":const:`stat.S_ISUID`" -#: ../../library/os.rst:2103 +#: ../../library/os.rst:2104 msgid ":const:`stat.S_ISGID`" msgstr ":const:`stat.S_ISGID`" -#: ../../library/os.rst:2104 +#: ../../library/os.rst:2105 msgid ":const:`stat.S_ENFMT`" msgstr ":const:`stat.S_ENFMT`" -#: ../../library/os.rst:2105 +#: ../../library/os.rst:2106 msgid ":const:`stat.S_ISVTX`" msgstr ":const:`stat.S_ISVTX`" -#: ../../library/os.rst:2106 +#: ../../library/os.rst:2107 msgid ":const:`stat.S_IREAD`" msgstr ":const:`stat.S_IREAD`" -#: ../../library/os.rst:2107 +#: ../../library/os.rst:2108 msgid ":const:`stat.S_IWRITE`" msgstr ":const:`stat.S_IWRITE`" -#: ../../library/os.rst:2108 +#: ../../library/os.rst:2109 msgid ":const:`stat.S_IEXEC`" msgstr ":const:`stat.S_IEXEC`" -#: ../../library/os.rst:2109 +#: ../../library/os.rst:2110 msgid ":const:`stat.S_IRWXU`" msgstr ":const:`stat.S_IRWXU`" -#: ../../library/os.rst:2110 +#: ../../library/os.rst:2111 msgid ":const:`stat.S_IRUSR`" msgstr ":const:`stat.S_IRUSR`" -#: ../../library/os.rst:2111 +#: ../../library/os.rst:2112 msgid ":const:`stat.S_IWUSR`" msgstr ":const:`stat.S_IWUSR`" -#: ../../library/os.rst:2112 +#: ../../library/os.rst:2113 msgid ":const:`stat.S_IXUSR`" msgstr ":const:`stat.S_IXUSR`" -#: ../../library/os.rst:2113 +#: ../../library/os.rst:2114 msgid ":const:`stat.S_IRWXG`" msgstr ":const:`stat.S_IRWXG`" -#: ../../library/os.rst:2114 +#: ../../library/os.rst:2115 msgid ":const:`stat.S_IRGRP`" msgstr ":const:`stat.S_IRGRP`" -#: ../../library/os.rst:2115 +#: ../../library/os.rst:2116 msgid ":const:`stat.S_IWGRP`" msgstr ":const:`stat.S_IWGRP`" -#: ../../library/os.rst:2116 +#: ../../library/os.rst:2117 msgid ":const:`stat.S_IXGRP`" msgstr ":const:`stat.S_IXGRP`" -#: ../../library/os.rst:2117 +#: ../../library/os.rst:2118 msgid ":const:`stat.S_IRWXO`" msgstr ":const:`stat.S_IRWXO`" -#: ../../library/os.rst:2118 +#: ../../library/os.rst:2119 msgid ":const:`stat.S_IROTH`" msgstr ":const:`stat.S_IROTH`" -#: ../../library/os.rst:2119 +#: ../../library/os.rst:2120 msgid ":const:`stat.S_IWOTH`" msgstr ":const:`stat.S_IWOTH`" -#: ../../library/os.rst:2120 +#: ../../library/os.rst:2121 msgid ":const:`stat.S_IXOTH`" msgstr ":const:`stat.S_IXOTH`" -#: ../../library/os.rst:2122 ../../library/os.rst:2155 -#: ../../library/os.rst:3546 +#: ../../library/os.rst:2123 ../../library/os.rst:2156 +#: ../../library/os.rst:3547 msgid "" "This function can support :ref:`specifying a file descriptor `, :" "ref:`paths relative to directory descriptors ` and :ref:`not " "following symlinks `." msgstr "" -#: ../../library/os.rst:2128 +#: ../../library/os.rst:2129 msgid "" "Although Windows supports :func:`chmod`, you can only set the file's read-" "only flag with it (via the ``stat.S_IWRITE`` and ``stat.S_IREAD`` constants " @@ -2437,68 +2431,68 @@ msgid "" "value of *follow_symlinks* is ``False`` on Windows." msgstr "" -#: ../../library/os.rst:2138 ../../library/os.rst:2169 +#: ../../library/os.rst:2139 ../../library/os.rst:2170 msgid "" "Added support for specifying *path* as an open file descriptor, and the " "*dir_fd* and *follow_symlinks* arguments." msgstr "" -#: ../../library/os.rst:2145 +#: ../../library/os.rst:2146 msgid "" "Added support for a file descriptor and the *follow_symlinks* argument on " "Windows." msgstr "" -#: ../../library/os.rst:2152 +#: ../../library/os.rst:2153 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. To " "leave one of the ids unchanged, set it to -1." msgstr "" -#: ../../library/os.rst:2159 +#: ../../library/os.rst:2160 msgid "" "See :func:`shutil.chown` for a higher-level function that accepts names in " "addition to numeric ids." msgstr "" -#: ../../library/os.rst:2173 +#: ../../library/os.rst:2174 msgid "Supports a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:2179 +#: ../../library/os.rst:2180 msgid "Change the root directory of the current process to *path*." msgstr "" -#: ../../library/os.rst:2189 +#: ../../library/os.rst:2190 msgid "" "Change the current working directory to the directory represented by the " "file descriptor *fd*. The descriptor must refer to an opened directory, not " "an open file. As of Python 3.3, this is equivalent to ``os.chdir(fd)``." msgstr "" -#: ../../library/os.rst:2200 +#: ../../library/os.rst:2201 msgid "Return a string representing the current working directory." msgstr "" -#: ../../library/os.rst:2205 +#: ../../library/os.rst:2206 msgid "Return a bytestring representing the current working directory." msgstr "" -#: ../../library/os.rst:2207 +#: ../../library/os.rst:2208 msgid "" "The function now uses the UTF-8 encoding on Windows, rather than the ANSI " "code page: see :pep:`529` for the rationale. The function is no longer " "deprecated on Windows." msgstr "" -#: ../../library/os.rst:2215 +#: ../../library/os.rst:2216 msgid "" "Set the flags of *path* to the numeric *flags*, like :func:`chflags`, but do " "not follow symbolic links. As of Python 3.3, this is equivalent to ``os." "chflags(path, flags, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2229 +#: ../../library/os.rst:2230 msgid "" "Change the mode of *path* to the numeric *mode*. If path is a symlink, this " "affects the symlink rather than the target. See the docs for :func:`chmod` " @@ -2506,31 +2500,31 @@ msgid "" "chmod(path, mode, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2234 +#: ../../library/os.rst:2235 msgid "" "``lchmod()`` is not part of POSIX, but Unix implementations may have it if " "changing the mode of symbolic links is supported." msgstr "" -#: ../../library/os.rst:2249 +#: ../../library/os.rst:2250 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. " "This function will not follow symbolic links. As of Python 3.3, this is " "equivalent to ``os.chown(path, uid, gid, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2263 +#: ../../library/os.rst:2264 msgid "Create a hard link pointing to *src* named *dst*." msgstr "" -#: ../../library/os.rst:2265 +#: ../../library/os.rst:2266 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " "supply :ref:`paths relative to directory descriptors `, and :ref:" "`not following symlinks `." msgstr "" -#: ../../library/os.rst:2269 +#: ../../library/os.rst:2270 msgid "" "Raises an :ref:`auditing event ` ``os.link`` with arguments " "``src``, ``dst``, ``src_dir_fd``, ``dst_dir_fd``." @@ -2538,20 +2532,20 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``src_dir_fd``、``dst_dir_fd`` 的\\ :ref:`" "稽核事件 ` ``os.link``。" -#: ../../library/os.rst:2273 ../../library/os.rst:4543 +#: ../../library/os.rst:2274 ../../library/os.rst:4544 msgid "Added Windows support." msgstr "新支援 Windows。" -#: ../../library/os.rst:2276 +#: ../../library/os.rst:2277 msgid "Added the *src_dir_fd*, *dst_dir_fd*, and *follow_symlinks* parameters." msgstr "新增 *src_dir_fd*、*dst_dir_fd* 與 *follow_symlinks* 參數。" -#: ../../library/os.rst:2279 ../../library/os.rst:2703 -#: ../../library/os.rst:2740 ../../library/os.rst:3468 +#: ../../library/os.rst:2280 ../../library/os.rst:2704 +#: ../../library/os.rst:2741 ../../library/os.rst:3469 msgid "Accepts a :term:`path-like object` for *src* and *dst*." msgstr "" -#: ../../library/os.rst:2285 +#: ../../library/os.rst:2286 msgid "" "Return a list containing the names of the entries in the directory given by " "*path*. The list is in arbitrary order, and does not include the special " @@ -2560,7 +2554,7 @@ msgid "" "function, whether a name for that file be included is unspecified." msgstr "" -#: ../../library/os.rst:2291 +#: ../../library/os.rst:2292 msgid "" "*path* may be a :term:`path-like object`. If *path* is of type ``bytes`` " "(directly or indirectly through the :class:`PathLike` interface), the " @@ -2568,42 +2562,42 @@ msgid "" "circumstances, they will be of type ``str``." msgstr "" -#: ../../library/os.rst:2296 ../../library/os.rst:2788 +#: ../../library/os.rst:2297 ../../library/os.rst:2789 msgid "" "This function can also support :ref:`specifying a file descriptor " "`; the file descriptor must refer to a directory." msgstr "" -#: ../../library/os.rst:2299 +#: ../../library/os.rst:2300 msgid "" "Raises an :ref:`auditing event ` ``os.listdir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.listdir``。" -#: ../../library/os.rst:2302 +#: ../../library/os.rst:2303 msgid "To encode ``str`` filenames to ``bytes``, use :func:`~os.fsencode`." msgstr "" -#: ../../library/os.rst:2306 +#: ../../library/os.rst:2307 msgid "" "The :func:`scandir` function returns directory entries along with file " "attribute information, giving better performance for many common use cases." msgstr "" -#: ../../library/os.rst:2310 +#: ../../library/os.rst:2311 msgid "The *path* parameter became optional." msgstr "" -#: ../../library/os.rst:2313 ../../library/os.rst:3327 +#: ../../library/os.rst:2314 ../../library/os.rst:3328 msgid "Added support for specifying *path* as an open file descriptor." msgstr "" -#: ../../library/os.rst:2322 +#: ../../library/os.rst:2323 msgid "Return a list containing the names of drives on a Windows system." msgstr "" -#: ../../library/os.rst:2324 +#: ../../library/os.rst:2325 msgid "" "A drive name typically looks like ``'C:\\\\'``. Not every drive name will be " "associated with a volume, and some may be inaccessible for a variety of " @@ -2611,22 +2605,22 @@ msgid "" "function does not test for access." msgstr "" -#: ../../library/os.rst:2329 +#: ../../library/os.rst:2330 msgid "May raise :exc:`OSError` if an error occurs collecting the drive names." msgstr "" -#: ../../library/os.rst:2332 +#: ../../library/os.rst:2333 msgid "" "Raises an :ref:`auditing event ` ``os.listdrives`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.listdrives``。" -#: ../../library/os.rst:2341 +#: ../../library/os.rst:2342 msgid "" "Return a list containing the mount points for a volume on a Windows system." msgstr "" -#: ../../library/os.rst:2344 +#: ../../library/os.rst:2345 msgid "" "*volume* must be represented as a GUID path, like those returned by :func:" "`os.listvolumes`. Volumes may be mounted in multiple locations or not at " @@ -2634,19 +2628,19 @@ msgid "" "associated with a volume will not be returned by this function." msgstr "" -#: ../../library/os.rst:2350 +#: ../../library/os.rst:2351 msgid "" "The mount points return by this function will be absolute paths, and may be " "longer than the drive name." msgstr "" -#: ../../library/os.rst:2353 +#: ../../library/os.rst:2354 msgid "" "Raises :exc:`OSError` if the volume is not recognized or if an error occurs " "collecting the paths." msgstr "" -#: ../../library/os.rst:2356 +#: ../../library/os.rst:2357 msgid "" "Raises an :ref:`auditing event ` ``os.listmounts`` with argument " "``volume``." @@ -2654,11 +2648,11 @@ msgstr "" "引發一個附帶引數 ``volume`` 的\\ :ref:`稽核事件 ` ``os." "listmounts``。" -#: ../../library/os.rst:2365 +#: ../../library/os.rst:2366 msgid "Return a list containing the volumes in the system." msgstr "" -#: ../../library/os.rst:2367 +#: ../../library/os.rst:2368 msgid "" "Volumes are typically represented as a GUID path that looks like ``\\\\?" "\\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\\``. Files can usually be " @@ -2667,49 +2661,49 @@ msgid "" "function is to retrieve mount points using :func:`os.listmounts`." msgstr "" -#: ../../library/os.rst:2374 +#: ../../library/os.rst:2375 msgid "May raise :exc:`OSError` if an error occurs collecting the volumes." msgstr "" -#: ../../library/os.rst:2376 +#: ../../library/os.rst:2377 msgid "" "Raises an :ref:`auditing event ` ``os.listvolumes`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.listvolumes``。" -#: ../../library/os.rst:2385 +#: ../../library/os.rst:2386 msgid "" "Perform the equivalent of an :c:func:`!lstat` system call on the given path. " "Similar to :func:`~os.stat`, but does not follow symbolic links. Return a :" "class:`stat_result` object." msgstr "" -#: ../../library/os.rst:2389 +#: ../../library/os.rst:2390 msgid "" "On platforms that do not support symbolic links, this is an alias for :func:" "`~os.stat`." msgstr "" -#: ../../library/os.rst:2392 +#: ../../library/os.rst:2393 msgid "" "As of Python 3.3, this is equivalent to ``os.stat(path, dir_fd=dir_fd, " "follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2395 ../../library/os.rst:2437 -#: ../../library/os.rst:2505 ../../library/os.rst:2533 -#: ../../library/os.rst:2607 +#: ../../library/os.rst:2396 ../../library/os.rst:2438 +#: ../../library/os.rst:2506 ../../library/os.rst:2534 +#: ../../library/os.rst:2608 msgid "" "This function can also support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: ../../library/os.rst:2402 ../../library/os.rst:2616 -#: ../../library/os.rst:3461 +#: ../../library/os.rst:2403 ../../library/os.rst:2617 +#: ../../library/os.rst:3462 msgid "Added support for Windows 6.0 (Vista) symbolic links." msgstr "" -#: ../../library/os.rst:2411 +#: ../../library/os.rst:2412 msgid "" "On Windows, now opens reparse points that represent another path (name " "surrogates), including symbolic links and directory junctions. Other kinds " @@ -2717,18 +2711,18 @@ msgid "" "stat`." msgstr "" -#: ../../library/os.rst:2420 +#: ../../library/os.rst:2421 msgid "Create a directory named *path* with numeric mode *mode*." msgstr "" -#: ../../library/os.rst:2422 +#: ../../library/os.rst:2423 msgid "" "If the directory already exists, :exc:`FileExistsError` is raised. If a " "parent directory in the path does not exist, :exc:`FileNotFoundError` is " "raised." msgstr "" -#: ../../library/os.rst:2427 +#: ../../library/os.rst:2428 msgid "" "On some systems, *mode* is ignored. Where it is used, the current umask " "value is first masked out. If bits other than the last 9 (i.e. the last 3 " @@ -2737,20 +2731,20 @@ msgid "" "call :func:`chmod` explicitly to set them." msgstr "" -#: ../../library/os.rst:2433 +#: ../../library/os.rst:2434 msgid "" "On Windows, a *mode* of ``0o700`` is specifically handled to apply access " "control to the new directory such that only the current user and " "administrators have access. Other values of *mode* are ignored." msgstr "" -#: ../../library/os.rst:2440 +#: ../../library/os.rst:2441 msgid "" "It is also possible to create temporary directories; see the :mod:`tempfile` " "module's :func:`tempfile.mkdtemp` function." msgstr "" -#: ../../library/os.rst:2443 ../../library/os.rst:2480 +#: ../../library/os.rst:2444 ../../library/os.rst:2481 msgid "" "Raises an :ref:`auditing event ` ``os.mkdir`` with arguments " "``path``, ``mode``, ``dir_fd``." @@ -2758,17 +2752,17 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.mkdir``。" -#: ../../library/os.rst:2451 +#: ../../library/os.rst:2452 msgid "Windows now handles a *mode* of ``0o700``." msgstr "" -#: ../../library/os.rst:2461 +#: ../../library/os.rst:2462 msgid "" "Recursive directory creation function. Like :func:`mkdir`, but makes all " "intermediate-level directories needed to contain the leaf directory." msgstr "" -#: ../../library/os.rst:2464 +#: ../../library/os.rst:2465 msgid "" "The *mode* parameter is passed to :func:`mkdir` for creating the leaf " "directory; see :ref:`the mkdir() description ` for how it is " @@ -2777,27 +2771,27 @@ msgid "" "file permission bits of existing parent directories are not changed." msgstr "" -#: ../../library/os.rst:2470 +#: ../../library/os.rst:2471 msgid "" "If *exist_ok* is ``False`` (the default), a :exc:`FileExistsError` is raised " "if the target directory already exists." msgstr "" -#: ../../library/os.rst:2475 +#: ../../library/os.rst:2476 msgid "" ":func:`makedirs` will become confused if the path elements to create " "include :data:`pardir` (eg. \"..\" on UNIX systems)." msgstr "" -#: ../../library/os.rst:2478 +#: ../../library/os.rst:2479 msgid "This function handles UNC paths correctly." msgstr "" -#: ../../library/os.rst:2482 +#: ../../library/os.rst:2483 msgid "Added the *exist_ok* parameter." msgstr "新增 *exist_ok* 參數。" -#: ../../library/os.rst:2487 +#: ../../library/os.rst:2488 msgid "" "Before Python 3.4.1, if *exist_ok* was ``True`` and the directory existed, :" "func:`makedirs` would still raise an error if *mode* did not match the mode " @@ -2805,19 +2799,19 @@ msgid "" "safely, it was removed in Python 3.4.1. See :issue:`21082`." msgstr "" -#: ../../library/os.rst:2495 +#: ../../library/os.rst:2496 msgid "" "The *mode* argument no longer affects the file permission bits of newly " "created intermediate-level directories." msgstr "" -#: ../../library/os.rst:2502 +#: ../../library/os.rst:2503 msgid "" "Create a FIFO (a named pipe) named *path* with numeric mode *mode*. The " "current umask value is first masked out from the mode." msgstr "" -#: ../../library/os.rst:2508 +#: ../../library/os.rst:2509 msgid "" "FIFOs are pipes that can be accessed like regular files. FIFOs exist until " "they are deleted (for example with :func:`os.unlink`). Generally, FIFOs are " @@ -2827,7 +2821,7 @@ msgid "" "rendezvous point." msgstr "" -#: ../../library/os.rst:2525 +#: ../../library/os.rst:2526 msgid "" "Create a filesystem node (file, device special file or named pipe) named " "*path*. *mode* specifies both the permissions to use and the type of node to " @@ -2838,23 +2832,23 @@ msgid "" "`os.makedev`), otherwise it is ignored." msgstr "" -#: ../../library/os.rst:2547 +#: ../../library/os.rst:2548 msgid "" "Extract the device major number from a raw device number (usually the :attr:" "`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." msgstr "" -#: ../../library/os.rst:2553 +#: ../../library/os.rst:2554 msgid "" "Extract the device minor number from a raw device number (usually the :attr:" "`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." msgstr "" -#: ../../library/os.rst:2559 +#: ../../library/os.rst:2560 msgid "Compose a raw device number from the major and minor device numbers." msgstr "" -#: ../../library/os.rst:2564 +#: ../../library/os.rst:2565 msgid "" "Return system configuration information relevant to a named file. *name* " "specifies the configuration value to retrieve; it may be a string which is " @@ -2865,20 +2859,20 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:2577 ../../library/os.rst:3320 -#: ../../library/os.rst:3489 +#: ../../library/os.rst:2578 ../../library/os.rst:3321 +#: ../../library/os.rst:3490 msgid "" "This function can support :ref:`specifying a file descriptor `." msgstr "" -#: ../../library/os.rst:2588 +#: ../../library/os.rst:2589 msgid "" "Dictionary mapping names accepted by :func:`pathconf` and :func:`fpathconf` " "to the integer values defined for those names by the host operating system. " "This can be used to determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:2597 +#: ../../library/os.rst:2598 msgid "" "Return a string representing the path to which the symbolic link points. " "The result may be either an absolute or relative pathname; if it is " @@ -2886,7 +2880,7 @@ msgid "" "join(os.path.dirname(path), result)``." msgstr "" -#: ../../library/os.rst:2602 +#: ../../library/os.rst:2603 msgid "" "If the *path* is a string object (directly or indirectly through a :class:" "`PathLike` interface), the result will also be a string object, and the call " @@ -2894,42 +2888,42 @@ msgid "" "indirectly), the result will be a bytes object." msgstr "" -#: ../../library/os.rst:2610 +#: ../../library/os.rst:2611 msgid "" "When trying to resolve a path that may contain links, use :func:`~os.path." "realpath` to properly handle recursion and platform differences." msgstr "" -#: ../../library/os.rst:2622 +#: ../../library/os.rst:2623 msgid "Accepts a :term:`path-like object` on Unix." msgstr "" -#: ../../library/os.rst:2625 +#: ../../library/os.rst:2626 msgid "Accepts a :term:`path-like object` and a bytes object on Windows." msgstr "" -#: ../../library/os.rst:2628 +#: ../../library/os.rst:2629 msgid "" "Added support for directory junctions, and changed to return the " "substitution path (which typically includes ``\\\\?\\`` prefix) rather than " "the optional \"print name\" field that was previously returned." msgstr "" -#: ../../library/os.rst:2634 +#: ../../library/os.rst:2635 msgid "" "Remove (delete) the file *path*. If *path* is a directory, an :exc:" "`OSError` is raised. Use :func:`rmdir` to remove directories. If the file " "does not exist, a :exc:`FileNotFoundError` is raised." msgstr "" -#: ../../library/os.rst:2638 ../../library/os.rst:2751 -#: ../../library/os.rst:3440 +#: ../../library/os.rst:2639 ../../library/os.rst:2752 +#: ../../library/os.rst:3441 msgid "" "This function can support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: ../../library/os.rst:2641 +#: ../../library/os.rst:2642 msgid "" "On Windows, attempting to remove a file that is in use causes an exception " "to be raised; on Unix, the directory entry is removed but the storage " @@ -2937,12 +2931,12 @@ msgid "" "longer in use." msgstr "" -#: ../../library/os.rst:2645 +#: ../../library/os.rst:2646 msgid "This function is semantically identical to :func:`unlink`." msgstr "" -#: ../../library/os.rst:2647 ../../library/os.rst:2669 -#: ../../library/os.rst:3511 +#: ../../library/os.rst:2648 ../../library/os.rst:2670 +#: ../../library/os.rst:3512 msgid "" "Raises an :ref:`auditing event ` ``os.remove`` with arguments " "``path``, ``dir_fd``." @@ -2950,7 +2944,7 @@ msgstr "" "引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` ``os." "remove``。" -#: ../../library/os.rst:2660 +#: ../../library/os.rst:2661 msgid "" "Remove directories recursively. Works like :func:`rmdir` except that, if " "the leaf directory is successfully removed, :func:`removedirs` tries to " @@ -2962,20 +2956,20 @@ msgid "" "could not be successfully removed." msgstr "" -#: ../../library/os.rst:2677 +#: ../../library/os.rst:2678 msgid "" "Rename the file or directory *src* to *dst*. If *dst* exists, the operation " "will fail with an :exc:`OSError` subclass in a number of cases:" msgstr "" -#: ../../library/os.rst:2680 +#: ../../library/os.rst:2681 msgid "" "On Windows, if *dst* exists a :exc:`FileExistsError` is always raised. The " "operation may fail if *src* and *dst* are on different filesystems. Use :" "func:`shutil.move` to support moves to a different filesystem." msgstr "" -#: ../../library/os.rst:2684 +#: ../../library/os.rst:2685 msgid "" "On Unix, if *src* is a file and *dst* is a directory or vice-versa, an :exc:" "`IsADirectoryError` or a :exc:`NotADirectoryError` will be raised " @@ -2987,20 +2981,20 @@ msgid "" "operation (this is a POSIX requirement)." msgstr "" -#: ../../library/os.rst:2693 ../../library/os.rst:2733 +#: ../../library/os.rst:2694 ../../library/os.rst:2734 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " "supply :ref:`paths relative to directory descriptors `." msgstr "" -#: ../../library/os.rst:2696 +#: ../../library/os.rst:2697 msgid "" "If you want cross-platform overwriting of the destination, use :func:" "`replace`." msgstr "" -#: ../../library/os.rst:2698 ../../library/os.rst:2719 -#: ../../library/os.rst:2736 +#: ../../library/os.rst:2699 ../../library/os.rst:2720 +#: ../../library/os.rst:2737 msgid "" "Raises an :ref:`auditing event ` ``os.rename`` with arguments " "``src``, ``dst``, ``src_dir_fd``, ``dst_dir_fd``." @@ -3008,11 +3002,11 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``src_dir_fd``、``dst_dir_fd`` 的\\ :ref:`" "稽核事件 ` ``os.rename``。" -#: ../../library/os.rst:2700 +#: ../../library/os.rst:2701 msgid "Added the *src_dir_fd* and *dst_dir_fd* parameters." msgstr "新增 *src_dir_fd* 與 *dst_dir_fd* 參數。" -#: ../../library/os.rst:2709 +#: ../../library/os.rst:2710 msgid "" "Recursive directory or file renaming function. Works like :func:`rename`, " "except creation of any intermediate directories needed to make the new " @@ -3021,17 +3015,17 @@ msgid "" "using :func:`removedirs`." msgstr "" -#: ../../library/os.rst:2716 +#: ../../library/os.rst:2717 msgid "" "This function can fail with the new directory structure made if you lack " "permissions needed to remove the leaf directory or file." msgstr "" -#: ../../library/os.rst:2721 +#: ../../library/os.rst:2722 msgid "Accepts a :term:`path-like object` for *old* and *new*." msgstr "" -#: ../../library/os.rst:2727 +#: ../../library/os.rst:2728 msgid "" "Rename the file or directory *src* to *dst*. If *dst* is a non-empty " "directory, :exc:`OSError` will be raised. If *dst* exists and is a file, it " @@ -3040,7 +3034,7 @@ msgid "" "renaming will be an atomic operation (this is a POSIX requirement)." msgstr "" -#: ../../library/os.rst:2746 +#: ../../library/os.rst:2747 msgid "" "Remove (delete) the directory *path*. If the directory does not exist or is " "not empty, a :exc:`FileNotFoundError` or an :exc:`OSError` is raised " @@ -3048,7 +3042,7 @@ msgid "" "rmtree` can be used." msgstr "" -#: ../../library/os.rst:2754 +#: ../../library/os.rst:2755 msgid "" "Raises an :ref:`auditing event ` ``os.rmdir`` with arguments " "``path``, ``dir_fd``." @@ -3056,7 +3050,7 @@ msgstr "" "引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` ``os." "rmdir``。" -#: ../../library/os.rst:2765 +#: ../../library/os.rst:2766 msgid "" "Return an iterator of :class:`os.DirEntry` objects corresponding to the " "entries in the directory given by *path*. The entries are yielded in " @@ -3066,7 +3060,7 @@ msgid "" "unspecified." msgstr "" -#: ../../library/os.rst:2772 +#: ../../library/os.rst:2773 msgid "" "Using :func:`scandir` instead of :func:`listdir` can significantly increase " "the performance of code that also needs file type or file attribute " @@ -3078,7 +3072,7 @@ msgid "" "Unix but only requires one for symbolic links on Windows." msgstr "" -#: ../../library/os.rst:2782 +#: ../../library/os.rst:2783 msgid "" "*path* may be a :term:`path-like object`. If *path* is of type ``bytes`` " "(directly or indirectly through the :class:`PathLike` interface), the type " @@ -3087,31 +3081,31 @@ msgid "" "they will be of type ``str``." msgstr "" -#: ../../library/os.rst:2791 +#: ../../library/os.rst:2792 msgid "" "Raises an :ref:`auditing event ` ``os.scandir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.scandir``。" -#: ../../library/os.rst:2793 +#: ../../library/os.rst:2794 msgid "" "The :func:`scandir` iterator supports the :term:`context manager` protocol " "and has the following method:" msgstr "" -#: ../../library/os.rst:2798 +#: ../../library/os.rst:2799 msgid "Close the iterator and free acquired resources." msgstr "" -#: ../../library/os.rst:2800 +#: ../../library/os.rst:2801 msgid "" "This is called automatically when the iterator is exhausted or garbage " "collected, or when an error happens during iterating. However it is " "advisable to call it explicitly or use the :keyword:`with` statement." msgstr "" -#: ../../library/os.rst:2807 +#: ../../library/os.rst:2808 msgid "" "The following example shows a simple use of :func:`scandir` to display all " "the files (excluding directories) in the given *path* that don't start with " @@ -3119,7 +3113,7 @@ msgid "" "system call::" msgstr "" -#: ../../library/os.rst:2812 +#: ../../library/os.rst:2813 msgid "" "with os.scandir(path) as it:\n" " for entry in it:\n" @@ -3131,7 +3125,7 @@ msgstr "" " if not entry.name.startswith('.') and entry.is_file():\n" " print(entry.name)" -#: ../../library/os.rst:2819 +#: ../../library/os.rst:2820 msgid "" "On Unix-based systems, :func:`scandir` uses the system's `opendir() `_ and " @@ -3142,7 +3136,7 @@ msgid "" "desktop/aa364428(v=vs.85).aspx>`_ functions." msgstr "" -#: ../../library/os.rst:2831 +#: ../../library/os.rst:2832 msgid "" "Added support for the :term:`context manager` protocol and the :func:" "`~scandir.close` method. If a :func:`scandir` iterator is neither exhausted " @@ -3150,28 +3144,28 @@ msgid "" "destructor." msgstr "" -#: ../../library/os.rst:2837 +#: ../../library/os.rst:2838 msgid "The function accepts a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:2839 +#: ../../library/os.rst:2840 msgid "Added support for :ref:`file descriptors ` on Unix." msgstr "" -#: ../../library/os.rst:2845 +#: ../../library/os.rst:2846 msgid "" "Object yielded by :func:`scandir` to expose the file path and other file " "attributes of a directory entry." msgstr "" -#: ../../library/os.rst:2848 +#: ../../library/os.rst:2849 msgid "" ":func:`scandir` will provide as much of this information as possible without " "making additional system calls. When a ``stat()`` or ``lstat()`` system call " "is made, the ``os.DirEntry`` object will cache the result." msgstr "" -#: ../../library/os.rst:2852 +#: ../../library/os.rst:2853 msgid "" "``os.DirEntry`` instances are not intended to be stored in long-lived data " "structures; if you know the file metadata has changed or if a long time has " @@ -3179,7 +3173,7 @@ msgid "" "up-to-date information." msgstr "" -#: ../../library/os.rst:2857 +#: ../../library/os.rst:2858 msgid "" "Because the ``os.DirEntry`` methods can make operating system calls, they " "may also raise :exc:`OSError`. If you need very fine-grained control over " @@ -3187,29 +3181,29 @@ msgid "" "methods and handle as appropriate." msgstr "" -#: ../../library/os.rst:2862 +#: ../../library/os.rst:2863 msgid "" "To be directly usable as a :term:`path-like object`, ``os.DirEntry`` " "implements the :class:`PathLike` interface." msgstr "" -#: ../../library/os.rst:2865 +#: ../../library/os.rst:2866 msgid "Attributes and methods on a ``os.DirEntry`` instance are as follows:" msgstr "" -#: ../../library/os.rst:2869 +#: ../../library/os.rst:2870 msgid "" "The entry's base filename, relative to the :func:`scandir` *path* argument." msgstr "" -#: ../../library/os.rst:2872 +#: ../../library/os.rst:2873 msgid "" "The :attr:`name` attribute will be ``bytes`` if the :func:`scandir` *path* " "argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." "fsdecode` to decode byte filenames." msgstr "" -#: ../../library/os.rst:2878 +#: ../../library/os.rst:2879 msgid "" "The entry's full path name: equivalent to ``os.path.join(scandir_path, entry." "name)`` where *scandir_path* is the :func:`scandir` *path* argument. The " @@ -3219,51 +3213,51 @@ msgid "" "attribute." msgstr "" -#: ../../library/os.rst:2885 +#: ../../library/os.rst:2886 msgid "" "The :attr:`path` attribute will be ``bytes`` if the :func:`scandir` *path* " "argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." "fsdecode` to decode byte filenames." msgstr "" -#: ../../library/os.rst:2891 +#: ../../library/os.rst:2892 msgid "Return the inode number of the entry." msgstr "" -#: ../../library/os.rst:2893 +#: ../../library/os.rst:2894 msgid "" "The result is cached on the ``os.DirEntry`` object. Use ``os.stat(entry." "path, follow_symlinks=False).st_ino`` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2897 +#: ../../library/os.rst:2898 msgid "" "On the first, uncached call, a system call is required on Windows but not on " "Unix." msgstr "" -#: ../../library/os.rst:2902 +#: ../../library/os.rst:2903 msgid "" "Return ``True`` if this entry is a directory or a symbolic link pointing to " "a directory; return ``False`` if the entry is or points to any other kind of " "file, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2906 +#: ../../library/os.rst:2907 msgid "" "If *follow_symlinks* is ``False``, return ``True`` only if this entry is a " "directory (without following symlinks); return ``False`` if the entry is any " "other kind of file or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2910 +#: ../../library/os.rst:2911 msgid "" "The result is cached on the ``os.DirEntry`` object, with a separate cache " "for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` along " "with :func:`stat.S_ISDIR` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2914 +#: ../../library/os.rst:2915 msgid "" "On the first, uncached call, no system call is required in most cases. " "Specifically, for non-symlinks, neither Windows or Unix require a system " @@ -3273,46 +3267,46 @@ msgid "" "is ``False``." msgstr "" -#: ../../library/os.rst:2921 ../../library/os.rst:2951 +#: ../../library/os.rst:2922 ../../library/os.rst:2952 msgid "" "This method can raise :exc:`OSError`, such as :exc:`PermissionError`, but :" "exc:`FileNotFoundError` is caught and not raised." msgstr "" -#: ../../library/os.rst:2926 +#: ../../library/os.rst:2927 msgid "" "Return ``True`` if this entry is a file or a symbolic link pointing to a " "file; return ``False`` if the entry is or points to a directory or other non-" "file entry, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2930 +#: ../../library/os.rst:2931 msgid "" "If *follow_symlinks* is ``False``, return ``True`` only if this entry is a " "file (without following symlinks); return ``False`` if the entry is a " "directory or other non-file entry, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2934 +#: ../../library/os.rst:2935 msgid "" "The result is cached on the ``os.DirEntry`` object. Caching, system calls " "made, and exceptions raised are as per :func:`~os.DirEntry.is_dir`." msgstr "" -#: ../../library/os.rst:2939 +#: ../../library/os.rst:2940 msgid "" "Return ``True`` if this entry is a symbolic link (even if broken); return " "``False`` if the entry points to a directory or any kind of file, or if it " "doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2943 +#: ../../library/os.rst:2944 msgid "" "The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." "islink` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2946 +#: ../../library/os.rst:2947 msgid "" "On the first, uncached call, no system call is required in most cases. " "Specifically, neither Windows or Unix require a system call, except on " @@ -3320,48 +3314,48 @@ msgid "" "``dirent.d_type == DT_UNKNOWN``." msgstr "" -#: ../../library/os.rst:2956 +#: ../../library/os.rst:2957 msgid "" "Return ``True`` if this entry is a junction (even if broken); return " "``False`` if the entry points to a regular directory, any kind of file, a " "symlink, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2960 +#: ../../library/os.rst:2961 msgid "" "The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." "isjunction` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2967 +#: ../../library/os.rst:2968 msgid "" "Return a :class:`stat_result` object for this entry. This method follows " "symbolic links by default; to stat a symbolic link add the " "``follow_symlinks=False`` argument." msgstr "" -#: ../../library/os.rst:2971 +#: ../../library/os.rst:2972 msgid "" "On Unix, this method always requires a system call. On Windows, it only " "requires a system call if *follow_symlinks* is ``True`` and the entry is a " "reparse point (for example, a symbolic link or directory junction)." msgstr "" -#: ../../library/os.rst:2976 +#: ../../library/os.rst:2977 msgid "" "On Windows, the ``st_ino``, ``st_dev`` and ``st_nlink`` attributes of the :" "class:`stat_result` are always set to zero. Call :func:`os.stat` to get " "these attributes." msgstr "" -#: ../../library/os.rst:2980 +#: ../../library/os.rst:2981 msgid "" "The result is cached on the ``os.DirEntry`` object, with a separate cache " "for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` to fetch " "up-to-date information." msgstr "" -#: ../../library/os.rst:2984 +#: ../../library/os.rst:2985 msgid "" "Note that there is a nice correspondence between several attributes and " "methods of ``os.DirEntry`` and of :class:`pathlib.Path`. In particular, the " @@ -3369,13 +3363,13 @@ msgid "" "``is_file()``, ``is_symlink()``, ``is_junction()``, and ``stat()`` methods." msgstr "" -#: ../../library/os.rst:2992 +#: ../../library/os.rst:2993 msgid "" "Added support for the :class:`~os.PathLike` interface. Added support for :" "class:`bytes` paths on Windows." msgstr "" -#: ../../library/os.rst:2996 +#: ../../library/os.rst:2997 msgid "" "The ``st_ctime`` attribute of a stat result is deprecated on Windows. The " "file creation time is properly available as ``st_birthtime``, and in the " @@ -3383,7 +3377,7 @@ msgid "" "time, if available." msgstr "" -#: ../../library/os.rst:3005 +#: ../../library/os.rst:3006 msgid "" "Get the status of a file or a file descriptor. Perform the equivalent of a :" "c:func:`stat` system call on the given path. *path* may be specified as " @@ -3392,21 +3386,21 @@ msgid "" "`stat_result` object." msgstr "" -#: ../../library/os.rst:3011 +#: ../../library/os.rst:3012 msgid "" "This function normally follows symlinks; to stat a symlink add the argument " "``follow_symlinks=False``, or use :func:`lstat`." msgstr "" -#: ../../library/os.rst:3014 ../../library/os.rst:4093 -#: ../../library/os.rst:4109 ../../library/os.rst:4125 -#: ../../library/os.rst:4145 +#: ../../library/os.rst:3015 ../../library/os.rst:4094 +#: ../../library/os.rst:4110 ../../library/os.rst:4126 +#: ../../library/os.rst:4146 msgid "" "This function can support :ref:`specifying a file descriptor ` and :" "ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:3017 +#: ../../library/os.rst:3018 msgid "" "On Windows, passing ``follow_symlinks=False`` will disable following all " "name-surrogate reparse points, which includes symlinks and directory " @@ -3420,11 +3414,11 @@ msgid "" "junction points, which will raise the usual exceptions." msgstr "" -#: ../../library/os.rst:3030 ../../library/os.rst:3800 +#: ../../library/os.rst:3031 ../../library/os.rst:3801 msgid "Example::" msgstr "範例: ::" -#: ../../library/os.rst:3032 +#: ../../library/os.rst:3033 msgid "" ">>> import os\n" ">>> statinfo = os.stat('somefile.txt')\n" @@ -3444,17 +3438,17 @@ msgstr "" ">>> statinfo.st_size\n" "264" -#: ../../library/os.rst:3043 +#: ../../library/os.rst:3044 msgid ":func:`fstat` and :func:`lstat` functions." msgstr ":func:`fstat` 和 :func:`lstat` 函式。" -#: ../../library/os.rst:3045 +#: ../../library/os.rst:3046 msgid "" "Added the *dir_fd* and *follow_symlinks* parameters, specifying a file " "descriptor instead of a path." msgstr "新增 *dir_fd* 與 *follow_symlinks* 參數,指定一個檔案描述器而非路徑。" -#: ../../library/os.rst:3052 +#: ../../library/os.rst:3053 msgid "" "On Windows, all reparse points that can be resolved by the operating system " "are now followed, and passing ``follow_symlinks=False`` disables following " @@ -3464,122 +3458,122 @@ msgid "" "of raising an error." msgstr "" -#: ../../library/os.rst:3063 +#: ../../library/os.rst:3064 msgid "" "Object whose attributes correspond roughly to the members of the :c:struct:" "`stat` structure. It is used for the result of :func:`os.stat`, :func:`os." "fstat` and :func:`os.lstat`." msgstr "" -#: ../../library/os.rst:3067 +#: ../../library/os.rst:3068 msgid "Attributes:" msgstr "屬性:" -#: ../../library/os.rst:3071 +#: ../../library/os.rst:3072 msgid "File mode: file type and file mode bits (permissions)." msgstr "" -#: ../../library/os.rst:3075 +#: ../../library/os.rst:3076 msgid "" "Platform dependent, but if non-zero, uniquely identifies the file for a " "given value of ``st_dev``. Typically:" msgstr "" -#: ../../library/os.rst:3078 +#: ../../library/os.rst:3079 msgid "the inode number on Unix," msgstr "" -#: ../../library/os.rst:3079 +#: ../../library/os.rst:3080 msgid "" "the `file index `_ on " "Windows" msgstr "" -#: ../../library/os.rst:3085 +#: ../../library/os.rst:3086 msgid "Identifier of the device on which this file resides." msgstr "" -#: ../../library/os.rst:3089 +#: ../../library/os.rst:3090 msgid "Number of hard links." msgstr "" -#: ../../library/os.rst:3093 +#: ../../library/os.rst:3094 msgid "User identifier of the file owner." msgstr "" -#: ../../library/os.rst:3097 +#: ../../library/os.rst:3098 msgid "Group identifier of the file owner." msgstr "" -#: ../../library/os.rst:3101 +#: ../../library/os.rst:3102 msgid "" "Size of the file in bytes, if it is a regular file or a symbolic link. The " "size of a symbolic link is the length of the pathname it contains, without a " "terminating null byte." msgstr "" -#: ../../library/os.rst:3105 +#: ../../library/os.rst:3106 msgid "Timestamps:" msgstr "" -#: ../../library/os.rst:3109 +#: ../../library/os.rst:3110 msgid "Time of most recent access expressed in seconds." msgstr "" -#: ../../library/os.rst:3113 +#: ../../library/os.rst:3114 msgid "Time of most recent content modification expressed in seconds." msgstr "" -#: ../../library/os.rst:3117 +#: ../../library/os.rst:3118 msgid "Time of most recent metadata change expressed in seconds." msgstr "" -#: ../../library/os.rst:3119 +#: ../../library/os.rst:3120 msgid "" "``st_ctime`` is deprecated on Windows. Use ``st_birthtime`` for the file " "creation time. In the future, ``st_ctime`` will contain the time of the most " "recent metadata change, as for other platforms." msgstr "" -#: ../../library/os.rst:3126 +#: ../../library/os.rst:3127 msgid "Time of most recent access expressed in nanoseconds as an integer." msgstr "" -#: ../../library/os.rst:3132 +#: ../../library/os.rst:3133 msgid "" "Time of most recent content modification expressed in nanoseconds as an " "integer." msgstr "" -#: ../../library/os.rst:3139 +#: ../../library/os.rst:3140 msgid "" "Time of most recent metadata change expressed in nanoseconds as an integer." msgstr "" -#: ../../library/os.rst:3144 +#: ../../library/os.rst:3145 msgid "" "``st_ctime_ns`` is deprecated on Windows. Use ``st_birthtime_ns`` for the " "file creation time. In the future, ``st_ctime`` will contain the time of the " "most recent metadata change, as for other platforms." msgstr "" -#: ../../library/os.rst:3151 +#: ../../library/os.rst:3152 msgid "" "Time of file creation expressed in seconds. This attribute is not always " "available, and may raise :exc:`AttributeError`." msgstr "" -#: ../../library/os.rst:3154 +#: ../../library/os.rst:3155 msgid "``st_birthtime`` is now available on Windows." msgstr "" -#: ../../library/os.rst:3159 +#: ../../library/os.rst:3160 msgid "" "Time of file creation expressed in nanoseconds as an integer. This attribute " "is not always available, and may raise :exc:`AttributeError`." msgstr "" -#: ../../library/os.rst:3167 +#: ../../library/os.rst:3168 msgid "" "The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, :" "attr:`st_ctime` and :attr:`st_birthtime` attributes depend on the operating " @@ -3589,7 +3583,7 @@ msgid "" "details." msgstr "" -#: ../../library/os.rst:3174 +#: ../../library/os.rst:3175 msgid "" "Similarly, although :attr:`st_atime_ns`, :attr:`st_mtime_ns`, :attr:" "`st_ctime_ns` and :attr:`st_birthtime_ns` are always expressed in " @@ -3602,74 +3596,74 @@ msgid "" "`st_birthtime_ns`." msgstr "" -#: ../../library/os.rst:3184 +#: ../../library/os.rst:3185 msgid "" "On some Unix systems (such as Linux), the following attributes may also be " "available:" msgstr "" -#: ../../library/os.rst:3189 +#: ../../library/os.rst:3190 msgid "" "Number of 512-byte blocks allocated for file. This may be smaller than :attr:" "`st_size`/512 when the file has holes." msgstr "" -#: ../../library/os.rst:3194 +#: ../../library/os.rst:3195 msgid "" "\"Preferred\" blocksize for efficient file system I/O. Writing to a file in " "smaller chunks may cause an inefficient read-modify-rewrite." msgstr "" -#: ../../library/os.rst:3199 +#: ../../library/os.rst:3200 msgid "Type of device if an inode device." msgstr "" -#: ../../library/os.rst:3203 +#: ../../library/os.rst:3204 msgid "User defined flags for file." msgstr "" -#: ../../library/os.rst:3205 +#: ../../library/os.rst:3206 msgid "" "On other Unix systems (such as FreeBSD), the following attributes may be " "available (but may be only filled out if root tries to use them):" msgstr "" -#: ../../library/os.rst:3210 +#: ../../library/os.rst:3211 msgid "File generation number." msgstr "" -#: ../../library/os.rst:3212 +#: ../../library/os.rst:3213 msgid "" "On Solaris and derivatives, the following attributes may also be available:" msgstr "" -#: ../../library/os.rst:3217 +#: ../../library/os.rst:3218 msgid "" "String that uniquely identifies the type of the filesystem that contains the " "file." msgstr "" -#: ../../library/os.rst:3220 +#: ../../library/os.rst:3221 msgid "On macOS systems, the following attributes may also be available:" msgstr "" -#: ../../library/os.rst:3224 +#: ../../library/os.rst:3225 msgid "Real size of the file." msgstr "" -#: ../../library/os.rst:3228 +#: ../../library/os.rst:3229 msgid "Creator of the file." msgstr "" -#: ../../library/os.rst:3232 +#: ../../library/os.rst:3233 msgid "File type." msgstr "" -#: ../../library/os.rst:3234 +#: ../../library/os.rst:3235 msgid "On Windows systems, the following attributes are also available:" msgstr "" -#: ../../library/os.rst:3238 +#: ../../library/os.rst:3239 msgid "" "Windows file attributes: ``dwFileAttributes`` member of the " "``BY_HANDLE_FILE_INFORMATION`` structure returned by :c:func:`!" @@ -3677,7 +3671,7 @@ msgid "" "FILE_ATTRIBUTE_ARCHIVE>` constants in the :mod:`stat` module." msgstr "" -#: ../../library/os.rst:3248 +#: ../../library/os.rst:3249 msgid "" "When :attr:`st_file_attributes` has the :const:`~stat." "FILE_ATTRIBUTE_REPARSE_POINT` set, this field contains the tag identifying " @@ -3685,14 +3679,14 @@ msgid "" "IO_REPARSE_TAG_SYMLINK>` constants in the :mod:`stat` module." msgstr "" -#: ../../library/os.rst:3253 +#: ../../library/os.rst:3254 msgid "" "The standard module :mod:`stat` defines functions and constants that are " "useful for extracting information from a :c:struct:`stat` structure. (On " "Windows, some items are filled with dummy values.)" msgstr "" -#: ../../library/os.rst:3257 +#: ../../library/os.rst:3258 msgid "" "For backward compatibility, a :class:`stat_result` instance is also " "accessible as a tuple of at least 10 integers giving the most important (and " @@ -3704,49 +3698,49 @@ msgid "" "class:`stat_result` as a tuple always returns integers." msgstr "" -#: ../../library/os.rst:3266 +#: ../../library/os.rst:3267 msgid "Windows now returns the file index as :attr:`st_ino` when available." msgstr "" -#: ../../library/os.rst:3270 +#: ../../library/os.rst:3271 msgid "Added the :attr:`st_fstype` member to Solaris/derivatives." msgstr "" -#: ../../library/os.rst:3273 +#: ../../library/os.rst:3274 msgid "Added the :attr:`st_reparse_tag` member on Windows." msgstr "在 Windows 上新增 :attr:`st_reparse_tag` 成員。" -#: ../../library/os.rst:3276 +#: ../../library/os.rst:3277 msgid "" "On Windows, the :attr:`st_mode` member now identifies special files as :" "const:`S_IFCHR`, :const:`S_IFIFO` or :const:`S_IFBLK` as appropriate." msgstr "" -#: ../../library/os.rst:3281 +#: ../../library/os.rst:3282 msgid "" "On Windows, :attr:`st_ctime` is deprecated. Eventually, it will contain the " "last metadata change time, for consistency with other platforms, but for now " "still contains creation time. Use :attr:`st_birthtime` for the creation time." msgstr "" -#: ../../library/os.rst:3287 +#: ../../library/os.rst:3288 msgid "" "On Windows, :attr:`st_ino` may now be up to 128 bits, depending on the file " "system. Previously it would not be above 64 bits, and larger file " "identifiers would be arbitrarily packed." msgstr "" -#: ../../library/os.rst:3291 +#: ../../library/os.rst:3292 msgid "" "On Windows, :attr:`st_rdev` no longer returns a value. Previously it would " "contain the same as :attr:`st_dev`, which was incorrect." msgstr "" -#: ../../library/os.rst:3294 +#: ../../library/os.rst:3295 msgid "Added the :attr:`st_birthtime` member on Windows." msgstr "在 Windows 上新增 :attr:`st_birthtime` 成員。" -#: ../../library/os.rst:3299 +#: ../../library/os.rst:3300 msgid "" "Perform a :c:func:`!statvfs` system call on the given path. The return " "value is an object whose attributes describe the filesystem on the given " @@ -3756,7 +3750,7 @@ msgid "" "`f_favail`, :attr:`f_flag`, :attr:`f_namemax`, :attr:`f_fsid`." msgstr "" -#: ../../library/os.rst:3306 +#: ../../library/os.rst:3307 msgid "" "Two module-level constants are defined for the :attr:`f_flag` attribute's " "bit-flags: if :const:`ST_RDONLY` is set, the filesystem is mounted read-" @@ -3764,7 +3758,7 @@ msgid "" "are disabled or not supported." msgstr "" -#: ../../library/os.rst:3311 +#: ../../library/os.rst:3312 msgid "" "Additional module-level constants are defined for GNU/glibc based systems. " "These are :const:`ST_NODEV` (disallow access to device special files), :" @@ -3777,11 +3771,11 @@ msgid "" "relative to mtime/ctime)." msgstr "" -#: ../../library/os.rst:3324 +#: ../../library/os.rst:3325 msgid "The :const:`ST_RDONLY` and :const:`ST_NOSUID` constants were added." msgstr "新增 :const:`ST_RDONLY` 與 :const:`ST_NOSUID` 常數。" -#: ../../library/os.rst:3330 +#: ../../library/os.rst:3331 msgid "" "The :const:`ST_NODEV`, :const:`ST_NOEXEC`, :const:`ST_SYNCHRONOUS`, :const:" "`ST_MANDLOCK`, :const:`ST_WRITE`, :const:`ST_APPEND`, :const:" @@ -3789,11 +3783,11 @@ msgid "" "`ST_RELATIME` constants were added." msgstr "" -#: ../../library/os.rst:3339 +#: ../../library/os.rst:3340 msgid "Added the :attr:`f_fsid` attribute." msgstr "新增 :attr:`f_fsid` 屬性。" -#: ../../library/os.rst:3345 +#: ../../library/os.rst:3346 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "accept an open file descriptor for their *dir_fd* parameter. Different " @@ -3805,7 +3799,7 @@ msgid "" "(Specifying ``None`` for *dir_fd* is always supported on all platforms.)" msgstr "" -#: ../../library/os.rst:3355 +#: ../../library/os.rst:3356 msgid "" "To check whether a particular function accepts an open file descriptor for " "its *dir_fd* parameter, use the ``in`` operator on ``supports_dir_fd``. As " @@ -3813,17 +3807,17 @@ msgid "" "open file descriptors for *dir_fd* on the local platform::" msgstr "" -#: ../../library/os.rst:3360 +#: ../../library/os.rst:3361 msgid "os.stat in os.supports_dir_fd" msgstr "os.stat in os.supports_dir_fd" -#: ../../library/os.rst:3362 +#: ../../library/os.rst:3363 msgid "" "Currently *dir_fd* parameters only work on Unix platforms; none of them work " "on Windows." msgstr "" -#: ../../library/os.rst:3370 +#: ../../library/os.rst:3371 msgid "" "A :class:`set` object indicating whether :func:`os.access` permits " "specifying ``True`` for its *effective_ids* parameter on the local platform. " @@ -3832,23 +3826,23 @@ msgid "" "func:`os.access`; otherwise it will be empty." msgstr "" -#: ../../library/os.rst:3376 +#: ../../library/os.rst:3377 msgid "" "This expression evaluates to ``True`` if :func:`os.access` supports " "``effective_ids=True`` on the local platform::" msgstr "" -#: ../../library/os.rst:3379 +#: ../../library/os.rst:3380 msgid "os.access in os.supports_effective_ids" msgstr "os.access in os.supports_effective_ids" -#: ../../library/os.rst:3381 +#: ../../library/os.rst:3382 msgid "" "Currently *effective_ids* is only supported on Unix platforms; it does not " "work on Windows." msgstr "" -#: ../../library/os.rst:3389 +#: ../../library/os.rst:3390 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "permit specifying their *path* parameter as an open file descriptor on the " @@ -3857,7 +3851,7 @@ msgid "" "*path* arguments is not available on all platforms Python supports." msgstr "" -#: ../../library/os.rst:3396 +#: ../../library/os.rst:3397 msgid "" "To determine whether a particular function permits specifying an open file " "descriptor for its *path* parameter, use the ``in`` operator on " @@ -3866,11 +3860,11 @@ msgid "" "platform::" msgstr "" -#: ../../library/os.rst:3402 +#: ../../library/os.rst:3403 msgid "os.chdir in os.supports_fd" msgstr "os.chdir in os.supports_fd" -#: ../../library/os.rst:3409 +#: ../../library/os.rst:3410 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "accept ``False`` for their *follow_symlinks* parameter on the local " @@ -3883,7 +3877,7 @@ msgid "" "on all platforms.)" msgstr "" -#: ../../library/os.rst:3419 +#: ../../library/os.rst:3420 msgid "" "To check whether a particular function accepts ``False`` for its " "*follow_symlinks* parameter, use the ``in`` operator on " @@ -3892,15 +3886,15 @@ msgid "" "stat` on the local platform::" msgstr "" -#: ../../library/os.rst:3425 +#: ../../library/os.rst:3426 msgid "os.stat in os.supports_follow_symlinks" msgstr "os.stat in os.supports_follow_symlinks" -#: ../../library/os.rst:3432 +#: ../../library/os.rst:3433 msgid "Create a symbolic link pointing to *src* named *dst*." msgstr "" -#: ../../library/os.rst:3434 +#: ../../library/os.rst:3435 msgid "" "On Windows, a symlink represents either a file or a directory, and does not " "morph to the target dynamically. If the target is present, the type of the " @@ -3910,7 +3904,7 @@ msgid "" "ignored." msgstr "" -#: ../../library/os.rst:3445 +#: ../../library/os.rst:3446 msgid "" "On newer versions of Windows 10, unprivileged accounts can create symlinks " "if Developer Mode is enabled. When Developer Mode is not available/enabled, " @@ -3918,12 +3912,12 @@ msgid "" "must be run as an administrator." msgstr "" -#: ../../library/os.rst:3451 +#: ../../library/os.rst:3452 msgid "" ":exc:`OSError` is raised when the function is called by an unprivileged user." msgstr "" -#: ../../library/os.rst:3454 +#: ../../library/os.rst:3455 msgid "" "Raises an :ref:`auditing event ` ``os.symlink`` with arguments " "``src``, ``dst``, ``dir_fd``." @@ -3931,27 +3925,27 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.symlink``。" -#: ../../library/os.rst:3464 +#: ../../library/os.rst:3465 msgid "" "Added the *dir_fd* parameter, and now allow *target_is_directory* on non-" "Windows platforms." msgstr "" -#: ../../library/os.rst:3471 +#: ../../library/os.rst:3472 msgid "Added support for unelevated symlinks on Windows with Developer Mode." msgstr "" -#: ../../library/os.rst:3477 +#: ../../library/os.rst:3478 msgid "Force write of everything to disk." msgstr "" -#: ../../library/os.rst:3486 +#: ../../library/os.rst:3487 msgid "" "Truncate the file corresponding to *path*, so that it is at most *length* " "bytes in size." msgstr "" -#: ../../library/os.rst:3491 +#: ../../library/os.rst:3492 msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``path``, ``length``." @@ -3959,46 +3953,46 @@ msgstr "" "引發一個附帶引數 ``path``、``length`` 的\\ :ref:`稽核事件 ` ``os." "truncate``。" -#: ../../library/os.rst:3506 +#: ../../library/os.rst:3507 msgid "" "Remove (delete) the file *path*. This function is semantically identical " "to :func:`remove`; the ``unlink`` name is its traditional Unix name. Please " "see the documentation for :func:`remove` for further information." msgstr "" -#: ../../library/os.rst:3522 +#: ../../library/os.rst:3523 msgid "Set the access and modified times of the file specified by *path*." msgstr "" -#: ../../library/os.rst:3524 +#: ../../library/os.rst:3525 msgid "" ":func:`utime` takes two optional parameters, *times* and *ns*. These specify " "the times set on *path* and are used as follows:" msgstr "" -#: ../../library/os.rst:3527 +#: ../../library/os.rst:3528 msgid "" "If *ns* is specified, it must be a 2-tuple of the form ``(atime_ns, " "mtime_ns)`` where each member is an int expressing nanoseconds." msgstr "" -#: ../../library/os.rst:3530 +#: ../../library/os.rst:3531 msgid "" "If *times* is not ``None``, it must be a 2-tuple of the form ``(atime, " "mtime)`` where each member is an int or float expressing seconds." msgstr "" -#: ../../library/os.rst:3533 +#: ../../library/os.rst:3534 msgid "" "If *times* is ``None`` and *ns* is unspecified, this is equivalent to " "specifying ``ns=(atime_ns, mtime_ns)`` where both times are the current time." msgstr "" -#: ../../library/os.rst:3537 +#: ../../library/os.rst:3538 msgid "It is an error to specify tuples for both *times* and *ns*." msgstr "" -#: ../../library/os.rst:3539 +#: ../../library/os.rst:3540 msgid "" "Note that the exact times you set here may not be returned by a subsequent :" "func:`~os.stat` call, depending on the resolution with which your operating " @@ -4008,7 +4002,7 @@ msgid "" "func:`utime`." msgstr "" -#: ../../library/os.rst:3550 +#: ../../library/os.rst:3551 msgid "" "Raises an :ref:`auditing event ` ``os.utime`` with arguments " "``path``, ``times``, ``ns``, ``dir_fd``." @@ -4016,13 +4010,13 @@ msgstr "" "引發一個附帶引數 ``path``、``times``、``ns``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.utime``。" -#: ../../library/os.rst:3552 +#: ../../library/os.rst:3553 msgid "" "Added support for specifying *path* as an open file descriptor, and the " "*dir_fd*, *follow_symlinks*, and *ns* parameters." msgstr "" -#: ../../library/os.rst:3566 +#: ../../library/os.rst:3567 msgid "" "Generate the file names in a directory tree by walking the tree either top-" "down or bottom-up. For each directory in the tree rooted at directory *top* " @@ -4030,7 +4024,7 @@ msgid "" "filenames)``." msgstr "" -#: ../../library/os.rst:3571 +#: ../../library/os.rst:3572 msgid "" "*dirpath* is a string, the path to the directory. *dirnames* is a list of " "the names of the subdirectories in *dirpath* (including symlinks to " @@ -4044,7 +4038,7 @@ msgid "" "unspecified." msgstr "" -#: ../../library/os.rst:3582 +#: ../../library/os.rst:3583 msgid "" "If optional argument *topdown* is ``True`` or not specified, the triple for " "a directory is generated before the triples for any of its subdirectories " @@ -4055,7 +4049,7 @@ msgid "" "its subdirectories are generated." msgstr "" -#: ../../library/os.rst:3590 +#: ../../library/os.rst:3591 msgid "" "When *topdown* is ``True``, the caller can modify the *dirnames* list in-" "place (perhaps using :keyword:`del` or slice assignment), and :func:`walk` " @@ -4068,7 +4062,7 @@ msgid "" "itself is generated." msgstr "" -#: ../../library/os.rst:3599 +#: ../../library/os.rst:3600 msgid "" "By default, errors from the :func:`scandir` call are ignored. If optional " "argument *onerror* is specified, it should be a function; it will be called " @@ -4078,54 +4072,54 @@ msgid "" "object." msgstr "" -#: ../../library/os.rst:3605 +#: ../../library/os.rst:3606 msgid "" "By default, :func:`walk` will not walk down into symbolic links that resolve " "to directories. Set *followlinks* to ``True`` to visit directories pointed " "to by symlinks, on systems that support them." msgstr "" -#: ../../library/os.rst:3611 +#: ../../library/os.rst:3612 msgid "" "Be aware that setting *followlinks* to ``True`` can lead to infinite " "recursion if a link points to a parent directory of itself. :func:`walk` " "does not keep track of the directories it visited already." msgstr "" -#: ../../library/os.rst:3617 +#: ../../library/os.rst:3618 msgid "" "If you pass a relative pathname, don't change the current working directory " "between resumptions of :func:`walk`. :func:`walk` never changes the current " "directory, and assumes that its caller doesn't either." msgstr "" -#: ../../library/os.rst:3621 ../../library/os.rst:3683 +#: ../../library/os.rst:3622 ../../library/os.rst:3684 msgid "" "This example displays the number of bytes taken by non-directory files in " "each directory under the starting directory, except that it doesn't look " -"under any CVS subdirectory::" +"under any ``__pycache__`` subdirectory::" msgstr "" -#: ../../library/os.rst:3625 +#: ../../library/os.rst:3626 msgid "" "import os\n" "from os.path import join, getsize\n" -"for root, dirs, files in os.walk('python/Lib/email'):\n" +"for root, dirs, files in os.walk('python/Lib/xml'):\n" " print(root, \"consumes\", end=\" \")\n" " print(sum(getsize(join(root, name)) for name in files), end=\" \")\n" " print(\"bytes in\", len(files), \"non-directory files\")\n" -" if 'CVS' in dirs:\n" -" dirs.remove('CVS') # don't visit CVS directories" +" if '__pycache__' in dirs:\n" +" dirs.remove('__pycache__') # don't visit __pycache__ directories" msgstr "" -#: ../../library/os.rst:3634 +#: ../../library/os.rst:3635 msgid "" "In the next example (simple implementation of :func:`shutil.rmtree`), " "walking the tree bottom-up is essential, :func:`rmdir` doesn't allow " "deleting a directory before the directory is empty::" msgstr "" -#: ../../library/os.rst:3638 +#: ../../library/os.rst:3639 msgid "" "# Delete everything reachable from the directory named in \"top\",\n" "# assuming there are no symbolic links.\n" @@ -4140,7 +4134,7 @@ msgid "" "os.rmdir(top)" msgstr "" -#: ../../library/os.rst:3650 +#: ../../library/os.rst:3651 msgid "" "Raises an :ref:`auditing event ` ``os.walk`` with arguments " "``top``, ``topdown``, ``onerror``, ``followlinks``." @@ -4148,25 +4142,25 @@ msgstr "" "引發一個附帶引數 ``top``、``topdown``、``onerror``、``followlinks`` 的\\ :" "ref:`稽核事件 ` ``os.walk``。" -#: ../../library/os.rst:3652 +#: ../../library/os.rst:3653 msgid "" "This function now calls :func:`os.scandir` instead of :func:`os.listdir`, " "making it faster by reducing the number of calls to :func:`os.stat`." msgstr "" -#: ../../library/os.rst:3666 +#: ../../library/os.rst:3667 msgid "" "This behaves exactly like :func:`walk`, except that it yields a 4-tuple " "``(dirpath, dirnames, filenames, dirfd)``, and it supports ``dir_fd``." msgstr "" -#: ../../library/os.rst:3669 +#: ../../library/os.rst:3670 msgid "" "*dirpath*, *dirnames* and *filenames* are identical to :func:`walk` output, " "and *dirfd* is a file descriptor referring to the directory *dirpath*." msgstr "" -#: ../../library/os.rst:3672 +#: ../../library/os.rst:3673 msgid "" "This function always supports :ref:`paths relative to directory descriptors " "` and :ref:`not following symlinks `. Note however " @@ -4174,32 +4168,32 @@ msgid "" "*follow_symlinks* is ``False``." msgstr "" -#: ../../library/os.rst:3679 +#: ../../library/os.rst:3680 msgid "" "Since :func:`fwalk` yields file descriptors, those are only valid until the " "next iteration step, so you should duplicate them (e.g. with :func:`dup`) if " "you want to keep them longer." msgstr "" -#: ../../library/os.rst:3687 +#: ../../library/os.rst:3688 msgid "" "import os\n" -"for root, dirs, files, rootfd in os.fwalk('python/Lib/email'):\n" +"for root, dirs, files, rootfd in os.fwalk('python/Lib/xml'):\n" " print(root, \"consumes\", end=\"\")\n" " print(sum([os.stat(name, dir_fd=rootfd).st_size for name in files]),\n" " end=\"\")\n" " print(\"bytes in\", len(files), \"non-directory files\")\n" -" if 'CVS' in dirs:\n" -" dirs.remove('CVS') # don't visit CVS directories" +" if '__pycache__' in dirs:\n" +" dirs.remove('__pycache__') # don't visit __pycache__ directories" msgstr "" -#: ../../library/os.rst:3696 +#: ../../library/os.rst:3697 msgid "" "In the next example, walking the tree bottom-up is essential: :func:`rmdir` " "doesn't allow deleting a directory before the directory is empty::" msgstr "" -#: ../../library/os.rst:3700 +#: ../../library/os.rst:3701 msgid "" "# Delete everything reachable from the directory named in \"top\",\n" "# assuming there are no symbolic links.\n" @@ -4213,7 +4207,7 @@ msgid "" " os.rmdir(name, dir_fd=rootfd)" msgstr "" -#: ../../library/os.rst:3711 +#: ../../library/os.rst:3712 msgid "" "Raises an :ref:`auditing event ` ``os.fwalk`` with arguments " "``top``, ``topdown``, ``onerror``, ``follow_symlinks``, ``dir_fd``." @@ -4221,11 +4215,11 @@ msgstr "" "引發一個附帶引數 ``top``、``topdown``、``onerror``、``follow_symlinks``、" "``dir_fd`` 的\\ :ref:`稽核事件 ` ``os.fwalk``。" -#: ../../library/os.rst:3720 +#: ../../library/os.rst:3721 msgid "Added support for :class:`bytes` paths." msgstr "新增對 :class:`bytes` 路徑的支援。" -#: ../../library/os.rst:3726 +#: ../../library/os.rst:3727 msgid "" "Create an anonymous file and return a file descriptor that refers to it. " "*flags* must be one of the ``os.MFD_*`` constants available on the system " @@ -4233,7 +4227,7 @@ msgid "" "descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3731 +#: ../../library/os.rst:3732 msgid "" "The name supplied in *name* is used as a filename and will be displayed as " "the target of the corresponding symbolic link in the directory ``/proc/self/" @@ -4243,15 +4237,15 @@ msgid "" "side effects." msgstr "" -#: ../../library/os.rst:3761 +#: ../../library/os.rst:3762 msgid "These flags can be passed to :func:`memfd_create`." msgstr "這些旗標可以傳給 :func:`memfd_create`。" -#: ../../library/os.rst:3765 +#: ../../library/os.rst:3766 msgid "The ``MFD_HUGE*`` flags are only available since Linux 4.14." msgstr "``MFD_HUGE*`` 旗標僅在 Linux 4.14 以上可用。" -#: ../../library/os.rst:3772 +#: ../../library/os.rst:3773 msgid "" "Create and return an event file descriptor. The file descriptors supports " "raw :func:`read` and :func:`write` with a buffer size of 8, :func:`~select." @@ -4260,7 +4254,7 @@ msgid "" "ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3778 +#: ../../library/os.rst:3779 msgid "" "*initval* is the initial value of the event counter. The initial value must " "be a 32 bit unsigned integer. Please note that the initial value is limited " @@ -4268,39 +4262,39 @@ msgid "" "integer with a maximum value of 2\\ :sup:`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3783 +#: ../../library/os.rst:3784 msgid "" "*flags* can be constructed from :const:`EFD_CLOEXEC`, :const:`EFD_NONBLOCK`, " "and :const:`EFD_SEMAPHORE`." msgstr "" -#: ../../library/os.rst:3786 +#: ../../library/os.rst:3787 msgid "" "If :const:`EFD_SEMAPHORE` is specified and the event counter is non-zero, :" "func:`eventfd_read` returns 1 and decrements the counter by one." msgstr "" -#: ../../library/os.rst:3789 +#: ../../library/os.rst:3790 msgid "" "If :const:`EFD_SEMAPHORE` is not specified and the event counter is non-" "zero, :func:`eventfd_read` returns the current event counter value and " "resets the counter to zero." msgstr "" -#: ../../library/os.rst:3793 +#: ../../library/os.rst:3794 msgid "" "If the event counter is zero and :const:`EFD_NONBLOCK` is not specified, :" "func:`eventfd_read` blocks." msgstr "" -#: ../../library/os.rst:3796 +#: ../../library/os.rst:3797 msgid "" ":func:`eventfd_write` increments the event counter. Write blocks if the " "write operation would increment the counter to a value larger than 2\\ :sup:" "`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3802 +#: ../../library/os.rst:3803 msgid "" "import os\n" "\n" @@ -4318,64 +4312,64 @@ msgid "" " os.close(fd)" msgstr "" -#: ../../library/os.rst:3823 +#: ../../library/os.rst:3824 msgid "" "Read value from an :func:`eventfd` file descriptor and return a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3832 +#: ../../library/os.rst:3833 msgid "" "Add value to an :func:`eventfd` file descriptor. *value* must be a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3841 +#: ../../library/os.rst:3842 msgid "Set close-on-exec flag for new :func:`eventfd` file descriptor." msgstr "" -#: ../../library/os.rst:3849 +#: ../../library/os.rst:3850 msgid "" "Set :const:`O_NONBLOCK` status flag for new :func:`eventfd` file descriptor." msgstr "設定新的 :func:`eventfd` 檔案描述器的 :const:`O_NONBLOCK` 狀態旗標。" -#: ../../library/os.rst:3858 +#: ../../library/os.rst:3859 msgid "" "Provide semaphore-like semantics for reads from an :func:`eventfd` file " "descriptor. On read the internal counter is decremented by one." msgstr "" -#: ../../library/os.rst:3869 +#: ../../library/os.rst:3870 msgid "Timer File Descriptors" msgstr "" -#: ../../library/os.rst:3873 +#: ../../library/os.rst:3874 msgid "" "These functions provide support for Linux's *timer file descriptor* API. " "Naturally, they are all only available on Linux." msgstr "" -#: ../../library/os.rst:3878 +#: ../../library/os.rst:3879 msgid "Create and return a timer file descriptor (*timerfd*)." msgstr "" -#: ../../library/os.rst:3880 +#: ../../library/os.rst:3881 msgid "The file descriptor returned by :func:`timerfd_create` supports:" msgstr "" -#: ../../library/os.rst:3882 +#: ../../library/os.rst:3883 msgid ":func:`read`" msgstr ":func:`read`" -#: ../../library/os.rst:3883 +#: ../../library/os.rst:3884 msgid ":func:`~select.select`" msgstr ":func:`~select.select`" -#: ../../library/os.rst:3884 +#: ../../library/os.rst:3885 msgid ":func:`~select.poll`" msgstr ":func:`~select.poll`" -#: ../../library/os.rst:3886 +#: ../../library/os.rst:3887 msgid "" "The file descriptor's :func:`read` method can be called with a buffer size " "of 8. If the timer has already expired one or more times, :func:`read` " @@ -4384,31 +4378,31 @@ msgid "" "byteorder)``." msgstr "" -#: ../../library/os.rst:3891 +#: ../../library/os.rst:3892 msgid "" ":func:`~select.select` and :func:`~select.poll` can be used to wait until " "timer expires and the file descriptor is readable." msgstr "" -#: ../../library/os.rst:3894 +#: ../../library/os.rst:3895 msgid "" "*clockid* must be a valid :ref:`clock ID `, as " "defined in the :py:mod:`time` module:" msgstr "" -#: ../../library/os.rst:3897 +#: ../../library/os.rst:3898 msgid ":const:`time.CLOCK_REALTIME`" msgstr ":const:`time.CLOCK_REALTIME`" -#: ../../library/os.rst:3898 +#: ../../library/os.rst:3899 msgid ":const:`time.CLOCK_MONOTONIC`" msgstr ":const:`time.CLOCK_MONOTONIC`" -#: ../../library/os.rst:3899 +#: ../../library/os.rst:3900 msgid ":const:`time.CLOCK_BOOTTIME` (Since Linux 3.15 for timerfd_create)" msgstr "" -#: ../../library/os.rst:3901 +#: ../../library/os.rst:3902 msgid "" "If *clockid* is :const:`time.CLOCK_REALTIME`, a settable system-wide real-" "time clock is used. If system clock is changed, timer setting need to be " @@ -4416,35 +4410,35 @@ msgid "" "`TFD_TIMER_CANCEL_ON_SET`." msgstr "" -#: ../../library/os.rst:3906 +#: ../../library/os.rst:3907 msgid "" "If *clockid* is :const:`time.CLOCK_MONOTONIC`, a non-settable monotonically " "increasing clock is used. Even if the system clock is changed, the timer " "setting will not be affected." msgstr "" -#: ../../library/os.rst:3910 +#: ../../library/os.rst:3911 msgid "" "If *clockid* is :const:`time.CLOCK_BOOTTIME`, same as :const:`time." "CLOCK_MONOTONIC` except it includes any time that the system is suspended." msgstr "" -#: ../../library/os.rst:3913 +#: ../../library/os.rst:3914 msgid "" "The file descriptor's behaviour can be modified by specifying a *flags* " "value. Any of the following variables may used, combined using bitwise OR " "(the ``|`` operator):" msgstr "" -#: ../../library/os.rst:3917 +#: ../../library/os.rst:3918 msgid ":const:`TFD_NONBLOCK`" msgstr ":const:`TFD_NONBLOCK`" -#: ../../library/os.rst:3918 +#: ../../library/os.rst:3919 msgid ":const:`TFD_CLOEXEC`" msgstr ":const:`TFD_CLOEXEC`" -#: ../../library/os.rst:3920 +#: ../../library/os.rst:3921 msgid "" "If :const:`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks until the " "timer expires. If it is set as a flag, :func:`read` doesn't block, but If " @@ -4452,46 +4446,46 @@ msgid "" "raises :class:`OSError` with ``errno`` is set to :const:`errno.EAGAIN`." msgstr "" -#: ../../library/os.rst:3926 +#: ../../library/os.rst:3927 msgid ":const:`TFD_CLOEXEC` is always set by Python automatically." msgstr "" -#: ../../library/os.rst:3928 +#: ../../library/os.rst:3929 msgid "" "The file descriptor must be closed with :func:`os.close` when it is no " "longer needed, or else the file descriptor will be leaked." msgstr "" -#: ../../library/os.rst:3931 +#: ../../library/os.rst:3932 msgid "The :manpage:`timerfd_create(2)` man page." msgstr ":manpage:`timerfd_create(2)` 手冊頁。" -#: ../../library/os.rst:3940 +#: ../../library/os.rst:3941 msgid "" "Alter a timer file descriptor's internal timer. This function operates the " "same interval timer as :func:`timerfd_settime_ns`." msgstr "" -#: ../../library/os.rst:3943 +#: ../../library/os.rst:3944 msgid "*fd* must be a valid timer file descriptor." msgstr "" -#: ../../library/os.rst:3945 +#: ../../library/os.rst:3946 msgid "" "The timer's behaviour can be modified by specifying a *flags* value. Any of " "the following variables may used, combined using bitwise OR (the ``|`` " "operator):" msgstr "" -#: ../../library/os.rst:3949 +#: ../../library/os.rst:3950 msgid ":const:`TFD_TIMER_ABSTIME`" msgstr ":const:`TFD_TIMER_ABSTIME`" -#: ../../library/os.rst:3950 +#: ../../library/os.rst:3951 msgid ":const:`TFD_TIMER_CANCEL_ON_SET`" msgstr ":const:`TFD_TIMER_CANCEL_ON_SET`" -#: ../../library/os.rst:3952 +#: ../../library/os.rst:3953 msgid "" "The timer is disabled by setting *initial* to zero (``0``). If *initial* is " "equal to or greater than zero, the timer is enabled. If *initial* is less " @@ -4499,20 +4493,20 @@ msgid "" "const:`errno.EINVAL`" msgstr "" -#: ../../library/os.rst:3957 +#: ../../library/os.rst:3958 msgid "" "By default the timer will fire when *initial* seconds have elapsed. (If " "*initial* is zero, timer will fire immediately.)" msgstr "" -#: ../../library/os.rst:3960 +#: ../../library/os.rst:3961 msgid "" "However, if the :const:`TFD_TIMER_ABSTIME` flag is set, the timer will fire " "when the timer's clock (set by *clockid* in :func:`timerfd_create`) reaches " "*initial* seconds." msgstr "" -#: ../../library/os.rst:3964 +#: ../../library/os.rst:3965 msgid "" "The timer's interval is set by the *interval* :py:class:`float`. If " "*interval* is zero, the timer only fires once, on the initial expiration. If " @@ -4522,7 +4516,7 @@ msgid "" "EINVAL`" msgstr "" -#: ../../library/os.rst:3971 +#: ../../library/os.rst:3972 msgid "" "If the :const:`TFD_TIMER_CANCEL_ON_SET` flag is set along with :const:" "`TFD_TIMER_ABSTIME` and the clock for this timer is :const:`time." @@ -4531,86 +4525,86 @@ msgid "" "ECANCELED." msgstr "" -#: ../../library/os.rst:3977 +#: ../../library/os.rst:3978 msgid "" "Linux manages system clock as UTC. A daylight-savings time transition is " "done by changing time offset only and doesn't cause discontinuous system " "clock change." msgstr "" -#: ../../library/os.rst:3981 +#: ../../library/os.rst:3982 msgid "" "Discontinuous system clock change will be caused by the following events:" msgstr "" -#: ../../library/os.rst:3983 +#: ../../library/os.rst:3984 msgid "``settimeofday``" msgstr "``settimeofday``" -#: ../../library/os.rst:3984 +#: ../../library/os.rst:3985 msgid "``clock_settime``" msgstr "``clock_settime``" -#: ../../library/os.rst:3985 +#: ../../library/os.rst:3986 msgid "set the system date and time by ``date`` command" msgstr "" -#: ../../library/os.rst:3987 +#: ../../library/os.rst:3988 msgid "" "Return a two-item tuple of (``next_expiration``, ``interval``) from the " "previous timer state, before this function executed." msgstr "" -#: ../../library/os.rst:3992 +#: ../../library/os.rst:3993 msgid "" ":manpage:`timerfd_create(2)`, :manpage:`timerfd_settime(2)`, :manpage:" "`settimeofday(2)`, :manpage:`clock_settime(2)`, and :manpage:`date(1)`." msgstr "" -#: ../../library/os.rst:4003 +#: ../../library/os.rst:4004 msgid "" "Similar to :func:`timerfd_settime`, but use time as nanoseconds. This " "function operates the same interval timer as :func:`timerfd_settime`." msgstr "" -#: ../../library/os.rst:4013 +#: ../../library/os.rst:4014 msgid "Return a two-item tuple of floats (``next_expiration``, ``interval``)." msgstr "" -#: ../../library/os.rst:4015 +#: ../../library/os.rst:4016 msgid "" "``next_expiration`` denotes the relative time until next the timer next " "fires, regardless of if the :const:`TFD_TIMER_ABSTIME` flag is set." msgstr "" -#: ../../library/os.rst:4018 +#: ../../library/os.rst:4019 msgid "" "``interval`` denotes the timer's interval. If zero, the timer will only fire " "once, after ``next_expiration`` seconds have elapsed." msgstr "" -#: ../../library/os.rst:4022 +#: ../../library/os.rst:4023 msgid ":manpage:`timerfd_gettime(2)`" msgstr ":manpage:`timerfd_gettime(2)`" -#: ../../library/os.rst:4031 +#: ../../library/os.rst:4032 msgid "Similar to :func:`timerfd_gettime`, but return time as nanoseconds." msgstr "" -#: ../../library/os.rst:4039 +#: ../../library/os.rst:4040 msgid "" "A flag for the :func:`timerfd_create` function, which sets the :const:" "`O_NONBLOCK` status flag for the new timer file descriptor. If :const:" "`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks." msgstr "" -#: ../../library/os.rst:4049 +#: ../../library/os.rst:4050 msgid "" "A flag for the :func:`timerfd_create` function, If :const:`TFD_CLOEXEC` is " "set as a flag, set close-on-exec flag for new file descriptor." msgstr "" -#: ../../library/os.rst:4059 +#: ../../library/os.rst:4060 msgid "" "A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " "functions. If this flag is set, *initial* is interpreted as an absolute " @@ -4618,22 +4612,22 @@ msgid "" "Epoch)." msgstr "" -#: ../../library/os.rst:4069 +#: ../../library/os.rst:4070 msgid "" "A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " "functions along with :const:`TFD_TIMER_ABSTIME`. The timer is cancelled when " "the time of the underlying clock changes discontinuously." msgstr "" -#: ../../library/os.rst:4080 +#: ../../library/os.rst:4081 msgid "Linux extended attributes" msgstr "" -#: ../../library/os.rst:4084 +#: ../../library/os.rst:4085 msgid "These functions are all available on Linux only." msgstr "" -#: ../../library/os.rst:4088 +#: ../../library/os.rst:4089 msgid "" "Return the value of the extended filesystem attribute *attribute* for " "*path*. *attribute* can be bytes or str (directly or indirectly through the :" @@ -4641,7 +4635,7 @@ msgid "" "encoding." msgstr "" -#: ../../library/os.rst:4096 +#: ../../library/os.rst:4097 msgid "" "Raises an :ref:`auditing event ` ``os.getxattr`` with arguments " "``path``, ``attribute``." @@ -4649,12 +4643,12 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute`` 的\\ :ref:`稽核事件 ` " "``os.getxattr``。" -#: ../../library/os.rst:4098 ../../library/os.rst:4130 -#: ../../library/os.rst:4155 +#: ../../library/os.rst:4099 ../../library/os.rst:4131 +#: ../../library/os.rst:4156 msgid "Accepts a :term:`path-like object` for *path* and *attribute*." msgstr "" -#: ../../library/os.rst:4104 +#: ../../library/os.rst:4105 msgid "" "Return a list of the extended filesystem attributes on *path*. The " "attributes in the list are represented as strings decoded with the " @@ -4662,14 +4656,14 @@ msgid "" "the current directory." msgstr "" -#: ../../library/os.rst:4112 +#: ../../library/os.rst:4113 msgid "" "Raises an :ref:`auditing event ` ``os.listxattr`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.listxattr``。" -#: ../../library/os.rst:4120 +#: ../../library/os.rst:4121 msgid "" "Removes the extended filesystem attribute *attribute* from *path*. " "*attribute* should be bytes or str (directly or indirectly through the :" @@ -4677,7 +4671,7 @@ msgid "" "`filesystem encoding and error handler`." msgstr "" -#: ../../library/os.rst:4128 +#: ../../library/os.rst:4129 msgid "" "Raises an :ref:`auditing event ` ``os.removexattr`` with arguments " "``path``, ``attribute``." @@ -4685,7 +4679,7 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute`` 的\\ :ref:`稽核事件 ` " "``os.removexattr``。" -#: ../../library/os.rst:4136 +#: ../../library/os.rst:4137 msgid "" "Set the extended filesystem attribute *attribute* on *path* to *value*. " "*attribute* must be a bytes or str with no embedded NULs (directly or " @@ -4697,13 +4691,13 @@ msgid "" "will not be created and ``EEXISTS`` will be raised." msgstr "" -#: ../../library/os.rst:4150 +#: ../../library/os.rst:4151 msgid "" "A bug in Linux kernel versions less than 2.6.39 caused the flags argument to " "be ignored on some filesystems." msgstr "" -#: ../../library/os.rst:4153 +#: ../../library/os.rst:4154 msgid "" "Raises an :ref:`auditing event ` ``os.setxattr`` with arguments " "``path``, ``attribute``, ``value``, ``flags``." @@ -4711,33 +4705,33 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute``、``value``、``flags`` 的\\ :ref:`稽" "核事件 ` ``os.setxattr``。" -#: ../../library/os.rst:4161 +#: ../../library/os.rst:4162 msgid "" "The maximum size the value of an extended attribute can be. Currently, this " "is 64 KiB on Linux." msgstr "" -#: ../../library/os.rst:4167 +#: ../../library/os.rst:4168 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must create an attribute." msgstr "" -#: ../../library/os.rst:4173 +#: ../../library/os.rst:4174 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must replace an existing attribute." msgstr "" -#: ../../library/os.rst:4180 +#: ../../library/os.rst:4181 msgid "Process Management" msgstr "行程管理" -#: ../../library/os.rst:4182 +#: ../../library/os.rst:4183 msgid "These functions may be used to create and manage processes." msgstr "" -#: ../../library/os.rst:4184 +#: ../../library/os.rst:4185 msgid "" "The various :func:`exec\\* ` functions take a list of arguments for " "the new program loaded into the process. In each case, the first of these " @@ -4748,7 +4742,7 @@ msgid "" "standard output; ``foo`` will seem to be ignored." msgstr "" -#: ../../library/os.rst:4195 +#: ../../library/os.rst:4196 msgid "" "Generate a :const:`SIGABRT` signal to the current process. On Unix, the " "default behavior is to produce a core dump; on Windows, the process " @@ -4757,31 +4751,31 @@ msgid "" "`SIGABRT` with :func:`signal.signal`." msgstr "" -#: ../../library/os.rst:4204 +#: ../../library/os.rst:4205 msgid "Add a path to the DLL search path." msgstr "" -#: ../../library/os.rst:4206 +#: ../../library/os.rst:4207 msgid "" "This search path is used when resolving dependencies for imported extension " "modules (the module itself is resolved through :data:`sys.path`), and also " "by :mod:`ctypes`." msgstr "" -#: ../../library/os.rst:4210 +#: ../../library/os.rst:4211 msgid "" "Remove the directory by calling **close()** on the returned object or using " "it in a :keyword:`with` statement." msgstr "" -#: ../../library/os.rst:4213 +#: ../../library/os.rst:4214 msgid "" "See the `Microsoft documentation `_ for more information about how " "DLLs are loaded." msgstr "" -#: ../../library/os.rst:4217 +#: ../../library/os.rst:4218 msgid "" "Raises an :ref:`auditing event ` ``os.add_dll_directory`` with " "argument ``path``." @@ -4789,7 +4783,7 @@ msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os." "add_dll_directory``。" -#: ../../library/os.rst:4221 +#: ../../library/os.rst:4222 msgid "" "Previous versions of CPython would resolve DLLs using the default behavior " "for the current process. This led to inconsistencies, such as only sometimes " @@ -4797,14 +4791,14 @@ msgid "" "such as ``AddDllDirectory`` having no effect." msgstr "" -#: ../../library/os.rst:4228 +#: ../../library/os.rst:4229 msgid "" "In 3.8, the two primary ways DLLs are loaded now explicitly override the " "process-wide behavior to ensure consistency. See the :ref:`porting notes " "` for information on updating libraries." msgstr "" -#: ../../library/os.rst:4243 +#: ../../library/os.rst:4244 msgid "" "These functions all execute a new program, replacing the current process; " "they do not return. On Unix, the new executable is loaded into the current " @@ -4812,7 +4806,7 @@ msgid "" "reported as :exc:`OSError` exceptions." msgstr "" -#: ../../library/os.rst:4248 +#: ../../library/os.rst:4249 msgid "" "The current process is replaced immediately. Open file objects and " "descriptors are not flushed, so if there may be data buffered on these open " @@ -4820,7 +4814,7 @@ msgid "" "fsync` before calling an :func:`exec\\* ` function." msgstr "" -#: ../../library/os.rst:4254 +#: ../../library/os.rst:4255 msgid "" "The \"l\" and \"v\" variants of the :func:`exec\\* ` functions differ " "in how command-line arguments are passed. The \"l\" variants are perhaps " @@ -4833,7 +4827,7 @@ msgid "" "is not enforced." msgstr "" -#: ../../library/os.rst:4263 +#: ../../library/os.rst:4264 msgid "" "The variants which include a \"p\" near the end (:func:`execlp`, :func:" "`execlpe`, :func:`execvp`, and :func:`execvpe`) will use the :envvar:`PATH` " @@ -4847,7 +4841,7 @@ msgid "" "even on Windows, as plain names will not be resolved." msgstr "" -#: ../../library/os.rst:4274 +#: ../../library/os.rst:4275 msgid "" "For :func:`execle`, :func:`execlpe`, :func:`execve`, and :func:`execvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -4857,7 +4851,7 @@ msgid "" "process to inherit the environment of the current process." msgstr "" -#: ../../library/os.rst:4281 +#: ../../library/os.rst:4282 msgid "" "For :func:`execve` on some platforms, *path* may also be specified as an " "open file descriptor. This functionality may not be supported on your " @@ -4866,7 +4860,7 @@ msgid "" "`NotImplementedError`." msgstr "" -#: ../../library/os.rst:4286 +#: ../../library/os.rst:4287 msgid "" "Raises an :ref:`auditing event ` ``os.exec`` with arguments " "``path``, ``args``, ``env``." @@ -4874,25 +4868,25 @@ msgstr "" "引發一個附帶引數 ``path``、``args``、``env`` 的\\ :ref:`稽核事件 ` " "``os.exec``。" -#: ../../library/os.rst:4290 +#: ../../library/os.rst:4291 msgid "" "Added support for specifying *path* as an open file descriptor for :func:" "`execve`." msgstr "" -#: ../../library/os.rst:4299 +#: ../../library/os.rst:4300 msgid "" "Exit the process with status *n*, without calling cleanup handlers, flushing " "stdio buffers, etc." msgstr "" -#: ../../library/os.rst:4304 +#: ../../library/os.rst:4305 msgid "" "The standard way to exit is :func:`sys.exit(n) `. :func:`!_exit` " "should normally only be used in the child process after a :func:`fork`." msgstr "" -#: ../../library/os.rst:4307 +#: ../../library/os.rst:4308 msgid "" "The following exit codes are defined and can be used with :func:`_exit`, " "although they are not required. These are typically used for system " @@ -4900,139 +4894,139 @@ msgid "" "delivery program." msgstr "" -#: ../../library/os.rst:4313 +#: ../../library/os.rst:4314 msgid "" "Some of these may not be available on all Unix platforms, since there is " "some variation. These constants are defined where they are defined by the " "underlying platform." msgstr "" -#: ../../library/os.rst:4320 +#: ../../library/os.rst:4321 msgid "" "Exit code that means no error occurred. May be taken from the defined value " "of ``EXIT_SUCCESS`` on some platforms. Generally has a value of zero." msgstr "" -#: ../../library/os.rst:4328 +#: ../../library/os.rst:4329 msgid "" "Exit code that means the command was used incorrectly, such as when the " "wrong number of arguments are given." msgstr "" -#: ../../library/os.rst:4336 +#: ../../library/os.rst:4337 msgid "Exit code that means the input data was incorrect." msgstr "" -#: ../../library/os.rst:4343 +#: ../../library/os.rst:4344 msgid "Exit code that means an input file did not exist or was not readable." msgstr "" -#: ../../library/os.rst:4350 +#: ../../library/os.rst:4351 msgid "Exit code that means a specified user did not exist." msgstr "" -#: ../../library/os.rst:4357 +#: ../../library/os.rst:4358 msgid "Exit code that means a specified host did not exist." msgstr "" -#: ../../library/os.rst:4364 +#: ../../library/os.rst:4365 msgid "Exit code that means that a required service is unavailable." msgstr "" -#: ../../library/os.rst:4371 +#: ../../library/os.rst:4372 msgid "Exit code that means an internal software error was detected." msgstr "" -#: ../../library/os.rst:4378 +#: ../../library/os.rst:4379 msgid "" "Exit code that means an operating system error was detected, such as the " "inability to fork or create a pipe." msgstr "" -#: ../../library/os.rst:4386 +#: ../../library/os.rst:4387 msgid "" "Exit code that means some system file did not exist, could not be opened, or " "had some other kind of error." msgstr "" -#: ../../library/os.rst:4394 +#: ../../library/os.rst:4395 msgid "Exit code that means a user specified output file could not be created." msgstr "" -#: ../../library/os.rst:4401 +#: ../../library/os.rst:4402 msgid "" "Exit code that means that an error occurred while doing I/O on some file." msgstr "" -#: ../../library/os.rst:4408 +#: ../../library/os.rst:4409 msgid "" "Exit code that means a temporary failure occurred. This indicates something " "that may not really be an error, such as a network connection that couldn't " "be made during a retryable operation." msgstr "" -#: ../../library/os.rst:4417 +#: ../../library/os.rst:4418 msgid "" "Exit code that means that a protocol exchange was illegal, invalid, or not " "understood." msgstr "" -#: ../../library/os.rst:4425 +#: ../../library/os.rst:4426 msgid "" "Exit code that means that there were insufficient permissions to perform the " "operation (but not intended for file system problems)." msgstr "" -#: ../../library/os.rst:4433 +#: ../../library/os.rst:4434 msgid "Exit code that means that some kind of configuration error occurred." msgstr "" -#: ../../library/os.rst:4440 +#: ../../library/os.rst:4441 msgid "Exit code that means something like \"an entry was not found\"." msgstr "" -#: ../../library/os.rst:4447 +#: ../../library/os.rst:4448 msgid "" "Fork a child process. Return ``0`` in the child and the child's process id " "in the parent. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:4450 +#: ../../library/os.rst:4451 msgid "" "Note that some platforms including FreeBSD <= 6.3 and Cygwin have known " "issues when using ``fork()`` from a thread." msgstr "" -#: ../../library/os.rst:4453 +#: ../../library/os.rst:4454 msgid "" "Raises an :ref:`auditing event ` ``os.fork`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.fork``。" -#: ../../library/os.rst:4457 +#: ../../library/os.rst:4458 msgid "" "If you use TLS sockets in an application calling ``fork()``, see the warning " "in the :mod:`ssl` documentation." msgstr "" -#: ../../library/os.rst:4462 ../../library/os.rst:4506 +#: ../../library/os.rst:4463 ../../library/os.rst:4507 msgid "" "On macOS the use of this function is unsafe when mixed with using higher-" "level system APIs, and that includes using :mod:`urllib.request`." msgstr "" -#: ../../library/os.rst:4465 +#: ../../library/os.rst:4466 msgid "" "Calling ``fork()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:4469 +#: ../../library/os.rst:4470 msgid "" "If Python is able to detect that your process has multiple threads, :func:" "`os.fork` now raises a :exc:`DeprecationWarning`." msgstr "" -#: ../../library/os.rst:4473 +#: ../../library/os.rst:4474 msgid "" "We chose to surface this as a warning, when detectable, to better inform " "developers of a design problem that the POSIX platform specifically notes as " @@ -5043,21 +5037,21 @@ msgid "" "``free``)." msgstr "" -#: ../../library/os.rst:4482 +#: ../../library/os.rst:4483 msgid "" "Users of macOS or users of libc or malloc implementations other than those " "typically found in glibc to date are among those already more likely to " "experience deadlocks running such code." msgstr "" -#: ../../library/os.rst:4486 +#: ../../library/os.rst:4487 msgid "" "See `this discussion on fork being incompatible with threads `_ for technical details of why we're surfacing " "this longstanding platform compatibility problem to developers." msgstr "" -#: ../../library/os.rst:4496 +#: ../../library/os.rst:4497 msgid "" "Fork a child process, using a new pseudo-terminal as the child's controlling " "terminal. Return a pair of ``(pid, fd)``, where *pid* is ``0`` in the child, " @@ -5066,31 +5060,31 @@ msgid "" "the :mod:`pty` module. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:4502 +#: ../../library/os.rst:4503 msgid "" "Raises an :ref:`auditing event ` ``os.forkpty`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.forkpty``。" -#: ../../library/os.rst:4509 +#: ../../library/os.rst:4510 msgid "" "Calling ``forkpty()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:4513 +#: ../../library/os.rst:4514 msgid "" "If Python is able to detect that your process has multiple threads, this now " "raises a :exc:`DeprecationWarning`. See the longer explanation on :func:`os." "fork`." msgstr "" -#: ../../library/os.rst:4527 +#: ../../library/os.rst:4528 msgid "" "Send signal *sig* to the process *pid*. Constants for the specific signals " "available on the host platform are defined in the :mod:`signal` module." msgstr "" -#: ../../library/os.rst:4530 +#: ../../library/os.rst:4531 msgid "" "Windows: The :const:`signal.CTRL_C_EVENT` and :const:`signal." "CTRL_BREAK_EVENT` signals are special signals which can only be sent to " @@ -5100,11 +5094,11 @@ msgid "" "be set to *sig*." msgstr "" -#: ../../library/os.rst:4537 +#: ../../library/os.rst:4538 msgid "See also :func:`signal.pthread_kill`." msgstr "另請參閱 :func:`signal.pthread_kill`。" -#: ../../library/os.rst:4539 +#: ../../library/os.rst:4540 msgid "" "Raises an :ref:`auditing event ` ``os.kill`` with arguments " "``pid``, ``sig``." @@ -5112,11 +5106,11 @@ msgstr "" "引發一個附帶引數 ``pid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." "kill``。" -#: ../../library/os.rst:4553 +#: ../../library/os.rst:4554 msgid "Send the signal *sig* to the process group *pgid*." msgstr "" -#: ../../library/os.rst:4555 +#: ../../library/os.rst:4556 msgid "" "Raises an :ref:`auditing event ` ``os.killpg`` with arguments " "``pgid``, ``sig``." @@ -5124,23 +5118,23 @@ msgstr "" "引發一個附帶引數 ``pgid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." "killpg``。" -#: ../../library/os.rst:4562 +#: ../../library/os.rst:4563 msgid "" "Add *increment* to the process's \"niceness\". Return the new niceness." msgstr "" -#: ../../library/os.rst:4569 +#: ../../library/os.rst:4570 msgid "" "Return a file descriptor referring to the process *pid* with *flags* set. " "This descriptor can be used to perform process management without races and " "signals." msgstr "" -#: ../../library/os.rst:4573 +#: ../../library/os.rst:4574 msgid "See the :manpage:`pidfd_open(2)` man page for more details." msgstr "更多細節請見 :manpage:`pidfd_open(2)` 手冊頁。" -#: ../../library/os.rst:4580 +#: ../../library/os.rst:4581 msgid "" "This flag indicates that the file descriptor will be non-blocking. If the " "process referred to by the file descriptor has not yet terminated, then an " @@ -5148,13 +5142,13 @@ msgid "" "immediately return the error :const:`~errno.EAGAIN` rather than blocking." msgstr "" -#: ../../library/os.rst:4591 +#: ../../library/os.rst:4592 msgid "" "Lock program segments into memory. The value of *op* (defined in ````) determines which segments are locked." msgstr "" -#: ../../library/os.rst:4599 +#: ../../library/os.rst:4600 msgid "" "Open a pipe to or from command *cmd*. The return value is an open file " "object connected to the pipe, which can be read or written depending on " @@ -5164,7 +5158,7 @@ msgid "" "rather than bytes." msgstr "" -#: ../../library/os.rst:4607 +#: ../../library/os.rst:4608 msgid "" "The ``close`` method returns :const:`None` if the subprocess exited " "successfully, or the subprocess's return code if there was an error. On " @@ -5176,57 +5170,57 @@ msgid "" "contains the signed integer return code from the child process." msgstr "" -#: ../../library/os.rst:4617 +#: ../../library/os.rst:4618 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the ``close`` " "method result (exit status) into an exit code if it is not ``None``. On " "Windows, the ``close`` method result is directly the exit code (or ``None``)." msgstr "" -#: ../../library/os.rst:4622 +#: ../../library/os.rst:4623 msgid "" "This is implemented using :class:`subprocess.Popen`; see that class's " "documentation for more powerful ways to manage and communicate with " "subprocesses." msgstr "" -#: ../../library/os.rst:4629 +#: ../../library/os.rst:4630 msgid "" "The :ref:`Python UTF-8 Mode ` affects encodings used for *cmd* " "and pipe contents." msgstr "" -#: ../../library/os.rst:4632 +#: ../../library/os.rst:4633 msgid "" ":func:`popen` is a simple wrapper around :class:`subprocess.Popen`. Use :" "class:`subprocess.Popen` or :func:`subprocess.run` to control options like " "encodings." msgstr "" -#: ../../library/os.rst:4641 +#: ../../library/os.rst:4642 msgid "Wraps the :c:func:`!posix_spawn` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4643 +#: ../../library/os.rst:4644 msgid "" "Most users should use :func:`subprocess.run` instead of :func:`posix_spawn`." msgstr "" -#: ../../library/os.rst:4645 +#: ../../library/os.rst:4646 msgid "" "The positional-only arguments *path*, *args*, and *env* are similar to :func:" "`execve`. *env* is allowed to be ``None``, in which case current process' " "environment is used." msgstr "" -#: ../../library/os.rst:4649 +#: ../../library/os.rst:4650 msgid "" "The *path* parameter is the path to the executable file. The *path* should " "contain a directory. Use :func:`posix_spawnp` to pass an executable file " "without directory." msgstr "" -#: ../../library/os.rst:4653 +#: ../../library/os.rst:4654 msgid "" "The *file_actions* argument may be a sequence of tuples describing actions " "to take on specific file descriptors in the child process between the C " @@ -5235,39 +5229,39 @@ msgid "" "describing the remaining tuple elements:" msgstr "" -#: ../../library/os.rst:4661 +#: ../../library/os.rst:4662 msgid "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" msgstr "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" -#: ../../library/os.rst:4663 +#: ../../library/os.rst:4664 msgid "Performs ``os.dup2(os.open(path, flags, mode), fd)``." msgstr "" -#: ../../library/os.rst:4667 +#: ../../library/os.rst:4668 msgid "(``os.POSIX_SPAWN_CLOSE``, *fd*)" msgstr "(``os.POSIX_SPAWN_CLOSE``, *fd*)" -#: ../../library/os.rst:4669 +#: ../../library/os.rst:4670 msgid "Performs ``os.close(fd)``." msgstr "" -#: ../../library/os.rst:4673 +#: ../../library/os.rst:4674 msgid "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" msgstr "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" -#: ../../library/os.rst:4675 +#: ../../library/os.rst:4676 msgid "Performs ``os.dup2(fd, new_fd)``." msgstr "" -#: ../../library/os.rst:4679 +#: ../../library/os.rst:4680 msgid "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" msgstr "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" -#: ../../library/os.rst:4681 +#: ../../library/os.rst:4682 msgid "Performs ``os.closerange(fd, INF)``." msgstr "" -#: ../../library/os.rst:4683 +#: ../../library/os.rst:4684 msgid "" "These tuples correspond to the C library :c:func:`!" "posix_spawn_file_actions_addopen`, :c:func:`!" @@ -5277,7 +5271,7 @@ msgid "" "c:func:`!posix_spawn` call itself." msgstr "" -#: ../../library/os.rst:4690 +#: ../../library/os.rst:4691 msgid "" "The *setpgroup* argument will set the process group of the child to the " "value specified. If the value specified is 0, the child's process group ID " @@ -5286,7 +5280,7 @@ msgid "" "corresponds to the C library :c:macro:`!POSIX_SPAWN_SETPGROUP` flag." msgstr "" -#: ../../library/os.rst:4696 +#: ../../library/os.rst:4697 msgid "" "If the *resetids* argument is ``True`` it will reset the effective UID and " "GID of the child to the real UID and GID of the parent process. If the " @@ -5297,7 +5291,7 @@ msgid "" "library :c:macro:`!POSIX_SPAWN_RESETIDS` flag." msgstr "" -#: ../../library/os.rst:4704 +#: ../../library/os.rst:4705 msgid "" "If the *setsid* argument is ``True``, it will create a new session ID for " "``posix_spawn``. *setsid* requires :c:macro:`!POSIX_SPAWN_SETSID` or :c:" @@ -5305,7 +5299,7 @@ msgid "" "is raised." msgstr "" -#: ../../library/os.rst:4709 +#: ../../library/os.rst:4710 msgid "" "The *setsigmask* argument will set the signal mask to the signal set " "specified. If the parameter is not used, then the child inherits the " @@ -5313,14 +5307,14 @@ msgid "" "POSIX_SPAWN_SETSIGMASK` flag." msgstr "" -#: ../../library/os.rst:4714 +#: ../../library/os.rst:4715 msgid "" "The *sigdef* argument will reset the disposition of all signals in the set " "specified. This argument corresponds to the C library :c:macro:`!" "POSIX_SPAWN_SETSIGDEF` flag." msgstr "" -#: ../../library/os.rst:4718 +#: ../../library/os.rst:4719 msgid "" "The *scheduler* argument must be a tuple containing the (optional) scheduler " "policy and an instance of :class:`sched_param` with the scheduler " @@ -5330,7 +5324,7 @@ msgid "" "POSIX_SPAWN_SETSCHEDULER` flags." msgstr "" -#: ../../library/os.rst:4725 ../../library/os.rst:4746 +#: ../../library/os.rst:4726 ../../library/os.rst:4747 msgid "" "Raises an :ref:`auditing event ` ``os.posix_spawn`` with arguments " "``path``, ``argv``, ``env``." @@ -5338,79 +5332,79 @@ msgstr "" "引發一個附帶引數 ``path``、``argv``、``env`` 的\\ :ref:`稽核事件 ` " "``os.posix_spawn``。" -#: ../../library/os.rst:4729 +#: ../../library/os.rst:4730 msgid "" "*env* parameter accepts ``None``. ``os.POSIX_SPAWN_CLOSEFROM`` is available " "on platforms where :c:func:`!posix_spawn_file_actions_addclosefrom_np` " "exists." msgstr "" -#: ../../library/os.rst:4740 +#: ../../library/os.rst:4741 msgid "Wraps the :c:func:`!posix_spawnp` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4742 +#: ../../library/os.rst:4743 msgid "" "Similar to :func:`posix_spawn` except that the system searches for the " "*executable* file in the list of directories specified by the :envvar:`PATH` " "environment variable (in the same way as for ``execvp(3)``)." msgstr "" -#: ../../library/os.rst:4752 +#: ../../library/os.rst:4753 msgid "See :func:`posix_spawn` documentation." msgstr "見 :func:`posix_spawn` 文件。" -#: ../../library/os.rst:4758 +#: ../../library/os.rst:4759 msgid "" "Register callables to be executed when a new child process is forked using :" "func:`os.fork` or similar process cloning APIs. The parameters are optional " "and keyword-only. Each specifies a different call point." msgstr "" -#: ../../library/os.rst:4763 +#: ../../library/os.rst:4764 msgid "*before* is a function called before forking a child process." msgstr "" -#: ../../library/os.rst:4764 +#: ../../library/os.rst:4765 msgid "" "*after_in_parent* is a function called from the parent process after forking " "a child process." msgstr "" -#: ../../library/os.rst:4766 +#: ../../library/os.rst:4767 msgid "*after_in_child* is a function called from the child process." msgstr "" -#: ../../library/os.rst:4768 +#: ../../library/os.rst:4769 msgid "" "These calls are only made if control is expected to return to the Python " "interpreter. A typical :mod:`subprocess` launch will not trigger them as " "the child is not going to re-enter the interpreter." msgstr "" -#: ../../library/os.rst:4772 +#: ../../library/os.rst:4773 msgid "" "Functions registered for execution before forking are called in reverse " "registration order. Functions registered for execution after forking " "(either in the parent or in the child) are called in registration order." msgstr "" -#: ../../library/os.rst:4777 +#: ../../library/os.rst:4778 msgid "" "Note that :c:func:`fork` calls made by third-party C code may not call those " "functions, unless it explicitly calls :c:func:`PyOS_BeforeFork`, :c:func:" "`PyOS_AfterFork_Parent` and :c:func:`PyOS_AfterFork_Child`." msgstr "" -#: ../../library/os.rst:4781 +#: ../../library/os.rst:4782 msgid "There is no way to unregister a function." msgstr "" -#: ../../library/os.rst:4797 +#: ../../library/os.rst:4798 msgid "Execute the program *path* in a new process." msgstr "" -#: ../../library/os.rst:4799 +#: ../../library/os.rst:4800 msgid "" "(Note that the :mod:`subprocess` module provides more powerful facilities " "for spawning new processes and retrieving their results; using that module " @@ -5418,7 +5412,7 @@ msgid "" "`subprocess-replacements` section.)" msgstr "" -#: ../../library/os.rst:4804 +#: ../../library/os.rst:4805 msgid "" "If *mode* is :const:`P_NOWAIT`, this function returns the process id of the " "new process; if *mode* is :const:`P_WAIT`, returns the process's exit code " @@ -5427,13 +5421,13 @@ msgid "" "handle, so can be used with the :func:`waitpid` function." msgstr "" -#: ../../library/os.rst:4810 +#: ../../library/os.rst:4811 msgid "" "Note on VxWorks, this function doesn't return ``-signal`` when the new " "process is killed. Instead it raises OSError exception." msgstr "" -#: ../../library/os.rst:4813 +#: ../../library/os.rst:4814 msgid "" "The \"l\" and \"v\" variants of the :func:`spawn\\* ` functions " "differ in how command-line arguments are passed. The \"l\" variants are " @@ -5445,7 +5439,7 @@ msgid "" "to the child process must start with the name of the command being run." msgstr "" -#: ../../library/os.rst:4822 +#: ../../library/os.rst:4823 msgid "" "The variants which include a second \"p\" near the end (:func:`spawnlp`, :" "func:`spawnlpe`, :func:`spawnvp`, and :func:`spawnvpe`) will use the :envvar:" @@ -5458,7 +5452,7 @@ msgid "" "appropriate absolute or relative path." msgstr "" -#: ../../library/os.rst:4832 +#: ../../library/os.rst:4833 msgid "" "For :func:`spawnle`, :func:`spawnlpe`, :func:`spawnve`, and :func:`spawnvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -5470,13 +5464,13 @@ msgid "" "values will cause the function to fail, with a return value of ``127``." msgstr "" -#: ../../library/os.rst:4841 +#: ../../library/os.rst:4842 msgid "" "As an example, the following calls to :func:`spawnlp` and :func:`spawnvpe` " "are equivalent::" msgstr "" -#: ../../library/os.rst:4844 +#: ../../library/os.rst:4845 msgid "" "import os\n" "os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')\n" @@ -5490,7 +5484,7 @@ msgstr "" "L = ['cp', 'index.html', '/dev/null']\n" "os.spawnvpe(os.P_WAIT, 'cp', L, os.environ)" -#: ../../library/os.rst:4850 +#: ../../library/os.rst:4851 msgid "" "Raises an :ref:`auditing event ` ``os.spawn`` with arguments " "``mode``, ``path``, ``args``, ``env``." @@ -5498,7 +5492,7 @@ msgstr "" "引發一個附帶引數 ``mode``、``path``、``args``、``env`` 的\\ :ref:`稽核事件 " "` ``os.spawn``。" -#: ../../library/os.rst:4854 +#: ../../library/os.rst:4855 msgid "" ":func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp` and :func:`spawnvpe` are " "not available on Windows. :func:`spawnle` and :func:`spawnve` are not " @@ -5506,7 +5500,7 @@ msgid "" "instead." msgstr "" -#: ../../library/os.rst:4866 +#: ../../library/os.rst:4867 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If either of these values is given, the :func:" @@ -5514,7 +5508,7 @@ msgid "" "been created, with the process id as the return value." msgstr "" -#: ../../library/os.rst:4876 +#: ../../library/os.rst:4877 msgid "" "Possible value for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If this is given as *mode*, the :func:`spawn\\* " @@ -5523,7 +5517,7 @@ msgid "" "successful, or ``-signal`` if a signal kills the process." msgstr "" -#: ../../library/os.rst:4888 +#: ../../library/os.rst:4889 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. These are less portable than those listed above. :" @@ -5533,11 +5527,11 @@ msgid "" "function will not return." msgstr "" -#: ../../library/os.rst:4899 +#: ../../library/os.rst:4900 msgid "Start a file with its associated application." msgstr "" -#: ../../library/os.rst:4901 +#: ../../library/os.rst:4902 msgid "" "When *operation* is not specified, this acts like double-clicking the file " "in Windows Explorer, or giving the file name as an argument to the :program:" @@ -5545,7 +5539,7 @@ msgid "" "whatever application (if any) its extension is associated." msgstr "" -#: ../../library/os.rst:4906 +#: ../../library/os.rst:4907 msgid "" "When another *operation* is given, it must be a \"command verb\" that " "specifies what should be done with the file. Common verbs documented by " @@ -5553,28 +5547,28 @@ msgid "" "as well as ``'explore'`` and ``'find'`` (to be used on directories)." msgstr "" -#: ../../library/os.rst:4911 +#: ../../library/os.rst:4912 msgid "" "When launching an application, specify *arguments* to be passed as a single " "string. This argument may have no effect when using this function to launch " "a document." msgstr "" -#: ../../library/os.rst:4915 +#: ../../library/os.rst:4916 msgid "" "The default working directory is inherited, but may be overridden by the " "*cwd* argument. This should be an absolute path. A relative *path* will be " "resolved against this argument." msgstr "" -#: ../../library/os.rst:4919 +#: ../../library/os.rst:4920 msgid "" "Use *show_cmd* to override the default window style. Whether this has any " "effect will depend on the application being launched. Values are integers as " "supported by the Win32 :c:func:`!ShellExecute` function." msgstr "" -#: ../../library/os.rst:4923 +#: ../../library/os.rst:4924 msgid "" ":func:`startfile` returns as soon as the associated application is launched. " "There is no option to wait for the application to close, and no way to " @@ -5585,14 +5579,14 @@ msgid "" "encoded for Win32." msgstr "" -#: ../../library/os.rst:4931 +#: ../../library/os.rst:4932 msgid "" "To reduce interpreter startup overhead, the Win32 :c:func:`!ShellExecute` " "function is not resolved until this function is first called. If the " "function cannot be resolved, :exc:`NotImplementedError` will be raised." msgstr "" -#: ../../library/os.rst:4935 +#: ../../library/os.rst:4936 msgid "" "Raises an :ref:`auditing event ` ``os.startfile`` with arguments " "``path``, ``operation``." @@ -5600,7 +5594,7 @@ msgstr "" "引發一個附帶引數 ``path``、``operation`` 的\\ :ref:`稽核事件 ` " "``os.startfile``。" -#: ../../library/os.rst:4937 +#: ../../library/os.rst:4938 msgid "" "Raises an :ref:`auditing event ` ``os.startfile/2`` with arguments " "``path``, ``operation``, ``arguments``, ``cwd``, ``show_cmd``." @@ -5608,13 +5602,13 @@ msgstr "" "引發一個附帶引數 ``path``、``operation``、``arguments``、``cwd``、" "``show_cmd`` 的\\ :ref:`稽核事件 ` ``os.startfile/2``。" -#: ../../library/os.rst:4941 +#: ../../library/os.rst:4942 msgid "" "Added the *arguments*, *cwd* and *show_cmd* arguments, and the ``os." "startfile/2`` audit event." msgstr "" -#: ../../library/os.rst:4948 +#: ../../library/os.rst:4949 msgid "" "Execute the command (a string) in a subshell. This is implemented by " "calling the Standard C function :c:func:`system`, and has the same " @@ -5625,13 +5619,13 @@ msgid "" "value of the Python function is system-dependent." msgstr "" -#: ../../library/os.rst:4956 +#: ../../library/os.rst:4957 msgid "" "On Unix, the return value is the exit status of the process encoded in the " "format specified for :func:`wait`." msgstr "" -#: ../../library/os.rst:4959 +#: ../../library/os.rst:4960 msgid "" "On Windows, the return value is that returned by the system shell after " "running *command*. The shell is given by the Windows environment variable :" @@ -5640,7 +5634,7 @@ msgid "" "shell documentation." msgstr "" -#: ../../library/os.rst:4965 +#: ../../library/os.rst:4966 msgid "" "The :mod:`subprocess` module provides more powerful facilities for spawning " "new processes and retrieving their results; using that module is preferable " @@ -5648,54 +5642,54 @@ msgid "" "the :mod:`subprocess` documentation for some helpful recipes." msgstr "" -#: ../../library/os.rst:4970 +#: ../../library/os.rst:4971 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the result " "(exit status) into an exit code. On Windows, the result is directly the exit " "code." msgstr "" -#: ../../library/os.rst:4974 +#: ../../library/os.rst:4975 msgid "" "Raises an :ref:`auditing event ` ``os.system`` with argument " "``command``." msgstr "" "引發一個附帶引數 ``command`` 的\\ :ref:`稽核事件 ` ``os.system``。" -#: ../../library/os.rst:4981 +#: ../../library/os.rst:4982 msgid "" "Returns the current global process times. The return value is an object with " "five attributes:" msgstr "" -#: ../../library/os.rst:4984 +#: ../../library/os.rst:4985 msgid ":attr:`!user` - user time" msgstr ":attr:`!user` - 使用者時間" -#: ../../library/os.rst:4985 +#: ../../library/os.rst:4986 msgid ":attr:`!system` - system time" msgstr ":attr:`!system` - 系統時間" -#: ../../library/os.rst:4986 +#: ../../library/os.rst:4987 msgid ":attr:`!children_user` - user time of all child processes" msgstr ":attr:`!children_user` - 所有子行程的使用者時間" -#: ../../library/os.rst:4987 +#: ../../library/os.rst:4988 msgid ":attr:`!children_system` - system time of all child processes" msgstr ":attr:`!children_system` - 所有子行程的系統時間" -#: ../../library/os.rst:4988 +#: ../../library/os.rst:4989 msgid ":attr:`!elapsed` - elapsed real time since a fixed point in the past" msgstr "" -#: ../../library/os.rst:4990 +#: ../../library/os.rst:4991 msgid "" "For backwards compatibility, this object also behaves like a five-tuple " "containing :attr:`!user`, :attr:`!system`, :attr:`!children_user`, :attr:`!" "children_system`, and :attr:`!elapsed` in that order." msgstr "" -#: ../../library/os.rst:4994 +#: ../../library/os.rst:4995 msgid "" "See the Unix manual page :manpage:`times(2)` and `times(3) `_ manual page on Unix or `the " @@ -5705,7 +5699,7 @@ msgid "" "attributes are zero." msgstr "" -#: ../../library/os.rst:5008 +#: ../../library/os.rst:5009 msgid "" "Wait for completion of a child process, and return a tuple containing its " "pid and exit status indication: a 16-bit number, whose low byte is the " @@ -5714,87 +5708,87 @@ msgid "" "if a core file was produced." msgstr "" -#: ../../library/os.rst:5014 +#: ../../library/os.rst:5015 msgid "" "If there are no children that could be waited for, :exc:`ChildProcessError` " "is raised." msgstr "" -#: ../../library/os.rst:5017 ../../library/os.rst:5092 +#: ../../library/os.rst:5018 ../../library/os.rst:5093 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exit code." msgstr "" -#: ../../library/os.rst:5024 +#: ../../library/os.rst:5025 msgid "" "The other :func:`!wait*` functions documented below can be used to wait for " "the completion of a specific child process and have more options. :func:" "`waitpid` is the only one also available on Windows." msgstr "" -#: ../../library/os.rst:5031 +#: ../../library/os.rst:5032 msgid "Wait for the completion of a child process." msgstr "" -#: ../../library/os.rst:5033 +#: ../../library/os.rst:5034 msgid "" "*idtype* can be :data:`P_PID`, :data:`P_PGID`, :data:`P_ALL`, or (on Linux) :" "data:`P_PIDFD`. The interpretation of *id* depends on it; see their " "individual descriptions." msgstr "" -#: ../../library/os.rst:5036 +#: ../../library/os.rst:5037 msgid "" "*options* is an OR combination of flags. At least one of :data:`WEXITED`, :" "data:`WSTOPPED` or :data:`WCONTINUED` is required; :data:`WNOHANG` and :data:" "`WNOWAIT` are additional optional flags." msgstr "" -#: ../../library/os.rst:5040 +#: ../../library/os.rst:5041 msgid "" "The return value is an object representing the data contained in the :c:type:" "`siginfo_t` structure with the following attributes:" msgstr "" -#: ../../library/os.rst:5043 +#: ../../library/os.rst:5044 msgid ":attr:`!si_pid` (process ID)" msgstr "" -#: ../../library/os.rst:5044 +#: ../../library/os.rst:5045 msgid ":attr:`!si_uid` (real user ID of the child)" msgstr "" -#: ../../library/os.rst:5045 +#: ../../library/os.rst:5046 msgid ":attr:`!si_signo` (always :const:`~signal.SIGCHLD`)" msgstr "" -#: ../../library/os.rst:5046 +#: ../../library/os.rst:5047 msgid "" ":attr:`!si_status` (the exit status or signal number, depending on :attr:`!" "si_code`)" msgstr "" -#: ../../library/os.rst:5047 +#: ../../library/os.rst:5048 msgid ":attr:`!si_code` (see :data:`CLD_EXITED` for possible values)" msgstr "" -#: ../../library/os.rst:5049 +#: ../../library/os.rst:5050 msgid "" "If :data:`WNOHANG` is specified and there are no matching children in the " "requested state, ``None`` is returned. Otherwise, if there are no matching " "children that could be waited for, :exc:`ChildProcessError` is raised." msgstr "" -#: ../../library/os.rst:5058 +#: ../../library/os.rst:5059 msgid "This function is now available on macOS as well." msgstr "" -#: ../../library/os.rst:5064 +#: ../../library/os.rst:5065 msgid "The details of this function differ on Unix and Windows." msgstr "" -#: ../../library/os.rst:5066 +#: ../../library/os.rst:5067 msgid "" "On Unix: Wait for completion of a child process given by process id *pid*, " "and return a tuple containing its process id and exit status indication " @@ -5803,7 +5797,7 @@ msgid "" "operation." msgstr "" -#: ../../library/os.rst:5071 +#: ../../library/os.rst:5072 msgid "" "If *pid* is greater than ``0``, :func:`waitpid` requests status information " "for that specific process. If *pid* is ``0``, the request is for the status " @@ -5813,7 +5807,7 @@ msgid "" "group ``-pid`` (the absolute value of *pid*)." msgstr "" -#: ../../library/os.rst:5078 +#: ../../library/os.rst:5079 msgid "" "*options* is an OR combination of flags. If it contains :data:`WNOHANG` and " "there are no matching children in the requested state, ``(0, 0)`` is " @@ -5822,7 +5816,7 @@ msgid "" "are :data:`WUNTRACED` and :data:`WCONTINUED`." msgstr "" -#: ../../library/os.rst:5084 +#: ../../library/os.rst:5085 msgid "" "On Windows: Wait for completion of a process given by process handle *pid*, " "and return a tuple containing *pid*, and its exit status shifted left by 8 " @@ -5834,7 +5828,7 @@ msgid "" "process handles." msgstr "" -#: ../../library/os.rst:5105 +#: ../../library/os.rst:5106 msgid "" "Similar to :func:`waitpid`, except no process id argument is given and a 3-" "element tuple containing the child's process id, exit status indication, and " @@ -5843,13 +5837,13 @@ msgid "" "same as that provided to :func:`waitpid` and :func:`wait4`." msgstr "" -#: ../../library/os.rst:5112 ../../library/os.rst:5126 +#: ../../library/os.rst:5113 ../../library/os.rst:5127 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exitcode." msgstr "" -#: ../../library/os.rst:5120 +#: ../../library/os.rst:5121 msgid "" "Similar to :func:`waitpid`, except a 3-element tuple, containing the child's " "process id, exit status indication, and resource usage information is " @@ -5858,118 +5852,118 @@ msgid "" "to :func:`waitpid`." msgstr "" -#: ../../library/os.rst:5137 +#: ../../library/os.rst:5138 msgid "" "These are the possible values for *idtype* in :func:`waitid`. They affect " "how *id* is interpreted:" msgstr "" -#: ../../library/os.rst:5140 +#: ../../library/os.rst:5141 msgid ":data:`!P_PID` - wait for the child whose PID is *id*." msgstr "" -#: ../../library/os.rst:5141 +#: ../../library/os.rst:5142 msgid ":data:`!P_PGID` - wait for any child whose progress group ID is *id*." msgstr "" -#: ../../library/os.rst:5142 +#: ../../library/os.rst:5143 msgid ":data:`!P_ALL` - wait for any child; *id* is ignored." msgstr "" -#: ../../library/os.rst:5143 +#: ../../library/os.rst:5144 msgid "" ":data:`!P_PIDFD` - wait for the child identified by the file descriptor *id* " "(a process file descriptor created with :func:`pidfd_open`)." msgstr "" -#: ../../library/os.rst:5148 +#: ../../library/os.rst:5149 msgid ":data:`!P_PIDFD` is only available on Linux >= 5.4." msgstr "" -#: ../../library/os.rst:5151 +#: ../../library/os.rst:5152 msgid "The :data:`!P_PIDFD` constant." msgstr "" -#: ../../library/os.rst:5157 +#: ../../library/os.rst:5158 msgid "" "This *options* flag for :func:`waitpid`, :func:`wait3`, :func:`wait4`, and :" "func:`waitid` causes child processes to be reported if they have been " "continued from a job control stop since they were last reported." msgstr "" -#: ../../library/os.rst:5166 +#: ../../library/os.rst:5167 msgid "" "This *options* flag for :func:`waitid` causes child processes that have " "terminated to be reported." msgstr "" -#: ../../library/os.rst:5169 +#: ../../library/os.rst:5170 msgid "" "The other ``wait*`` functions always report children that have terminated, " "so this option is not available for them." msgstr "" -#: ../../library/os.rst:5179 +#: ../../library/os.rst:5180 msgid "" "This *options* flag for :func:`waitid` causes child processes that have been " "stopped by the delivery of a signal to be reported." msgstr "" -#: ../../library/os.rst:5182 ../../library/os.rst:5214 +#: ../../library/os.rst:5183 ../../library/os.rst:5215 msgid "This option is not available for the other ``wait*`` functions." msgstr "" -#: ../../library/os.rst:5191 +#: ../../library/os.rst:5192 msgid "" "This *options* flag for :func:`waitpid`, :func:`wait3`, and :func:`wait4` " "causes child processes to also be reported if they have been stopped but " "their current state has not been reported since they were stopped." msgstr "" -#: ../../library/os.rst:5195 +#: ../../library/os.rst:5196 msgid "This option is not available for :func:`waitid`." msgstr "" -#: ../../library/os.rst:5202 +#: ../../library/os.rst:5203 msgid "" "This *options* flag causes :func:`waitpid`, :func:`wait3`, :func:`wait4`, " "and :func:`waitid` to return right away if no child process status is " "available immediately." msgstr "" -#: ../../library/os.rst:5211 +#: ../../library/os.rst:5212 msgid "" "This *options* flag causes :func:`waitid` to leave the child in a waitable " "state, so that a later :func:`!wait*` call can be used to retrieve the child " "status information again." msgstr "" -#: ../../library/os.rst:5226 +#: ../../library/os.rst:5227 msgid "" "These are the possible values for :attr:`!si_code` in the result returned " "by :func:`waitid`." msgstr "" -#: ../../library/os.rst:5233 +#: ../../library/os.rst:5234 msgid "Added :data:`CLD_KILLED` and :data:`CLD_STOPPED` values." msgstr "" -#: ../../library/os.rst:5239 +#: ../../library/os.rst:5240 msgid "Convert a wait status to an exit code." msgstr "" -#: ../../library/os.rst:5241 +#: ../../library/os.rst:5242 msgid "On Unix:" msgstr "" -#: ../../library/os.rst:5243 +#: ../../library/os.rst:5244 msgid "" "If the process exited normally (if ``WIFEXITED(status)`` is true), return " "the process exit status (return ``WEXITSTATUS(status)``): result greater " "than or equal to 0." msgstr "" -#: ../../library/os.rst:5246 +#: ../../library/os.rst:5247 msgid "" "If the process was terminated by a signal (if ``WIFSIGNALED(status)`` is " "true), return ``-signum`` where *signum* is the number of the signal that " @@ -5977,15 +5971,15 @@ msgid "" "than 0." msgstr "" -#: ../../library/os.rst:5250 +#: ../../library/os.rst:5251 msgid "Otherwise, raise a :exc:`ValueError`." msgstr "" -#: ../../library/os.rst:5252 +#: ../../library/os.rst:5253 msgid "On Windows, return *status* shifted right by 8 bits." msgstr "" -#: ../../library/os.rst:5254 +#: ../../library/os.rst:5255 msgid "" "On Unix, if the process is being traced or if :func:`waitpid` was called " "with :data:`WUNTRACED` option, the caller must first check if " @@ -5993,226 +5987,226 @@ msgid "" "``WIFSTOPPED(status)`` is true." msgstr "" -#: ../../library/os.rst:5261 +#: ../../library/os.rst:5262 msgid "" ":func:`WIFEXITED`, :func:`WEXITSTATUS`, :func:`WIFSIGNALED`, :func:" "`WTERMSIG`, :func:`WIFSTOPPED`, :func:`WSTOPSIG` functions." msgstr "" -#: ../../library/os.rst:5269 +#: ../../library/os.rst:5270 msgid "" "The following functions take a process status code as returned by :func:" "`system`, :func:`wait`, or :func:`waitpid` as a parameter. They may be used " "to determine the disposition of a process." msgstr "" -#: ../../library/os.rst:5275 +#: ../../library/os.rst:5276 msgid "" "Return ``True`` if a core dump was generated for the process, otherwise " "return ``False``." msgstr "" -#: ../../library/os.rst:5278 ../../library/os.rst:5344 +#: ../../library/os.rst:5279 ../../library/os.rst:5345 msgid "This function should be employed only if :func:`WIFSIGNALED` is true." msgstr "" -#: ../../library/os.rst:5285 +#: ../../library/os.rst:5286 msgid "" "Return ``True`` if a stopped child has been resumed by delivery of :const:" "`~signal.SIGCONT` (if the process has been continued from a job control " "stop), otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5289 +#: ../../library/os.rst:5290 msgid "See :data:`WCONTINUED` option." msgstr "參閱 :data:`WCONTINUED` 選項。" -#: ../../library/os.rst:5296 +#: ../../library/os.rst:5297 msgid "" "Return ``True`` if the process was stopped by delivery of a signal, " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5299 +#: ../../library/os.rst:5300 msgid "" ":func:`WIFSTOPPED` only returns ``True`` if the :func:`waitpid` call was " "done using :data:`WUNTRACED` option or when the process is being traced " "(see :manpage:`ptrace(2)`)." msgstr "" -#: ../../library/os.rst:5307 +#: ../../library/os.rst:5308 msgid "" "Return ``True`` if the process was terminated by a signal, otherwise return " "``False``." msgstr "" -#: ../../library/os.rst:5315 +#: ../../library/os.rst:5316 msgid "" "Return ``True`` if the process exited terminated normally, that is, by " "calling ``exit()`` or ``_exit()``, or by returning from ``main()``; " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5324 +#: ../../library/os.rst:5325 msgid "Return the process exit status." msgstr "" -#: ../../library/os.rst:5326 +#: ../../library/os.rst:5327 msgid "This function should be employed only if :func:`WIFEXITED` is true." msgstr "" -#: ../../library/os.rst:5333 +#: ../../library/os.rst:5334 msgid "Return the signal which caused the process to stop." msgstr "" -#: ../../library/os.rst:5335 +#: ../../library/os.rst:5336 msgid "This function should be employed only if :func:`WIFSTOPPED` is true." msgstr "" -#: ../../library/os.rst:5342 +#: ../../library/os.rst:5343 msgid "Return the number of the signal that caused the process to terminate." msgstr "" -#: ../../library/os.rst:5350 +#: ../../library/os.rst:5351 msgid "Interface to the scheduler" msgstr "" -#: ../../library/os.rst:5352 +#: ../../library/os.rst:5353 msgid "" "These functions control how a process is allocated CPU time by the operating " "system. They are only available on some Unix platforms. For more detailed " "information, consult your Unix manpages." msgstr "" -#: ../../library/os.rst:5358 +#: ../../library/os.rst:5359 msgid "" "The following scheduling policies are exposed if they are supported by the " "operating system." msgstr "" -#: ../../library/os.rst:5365 +#: ../../library/os.rst:5366 msgid "The default scheduling policy." msgstr "" -#: ../../library/os.rst:5369 +#: ../../library/os.rst:5370 msgid "" "Scheduling policy for CPU-intensive processes that tries to preserve " "interactivity on the rest of the computer." msgstr "" -#: ../../library/os.rst:5374 +#: ../../library/os.rst:5375 msgid "Scheduling policy for extremely low priority background tasks." msgstr "" -#: ../../library/os.rst:5378 +#: ../../library/os.rst:5379 msgid "Scheduling policy for sporadic server programs." msgstr "" -#: ../../library/os.rst:5382 +#: ../../library/os.rst:5383 msgid "A First In First Out scheduling policy." msgstr "" -#: ../../library/os.rst:5386 +#: ../../library/os.rst:5387 msgid "A round-robin scheduling policy." msgstr "" -#: ../../library/os.rst:5390 +#: ../../library/os.rst:5391 msgid "" "This flag can be OR'ed with any other scheduling policy. When a process with " "this flag set forks, its child's scheduling policy and priority are reset to " "the default." msgstr "" -#: ../../library/os.rst:5397 +#: ../../library/os.rst:5398 msgid "" "This class represents tunable scheduling parameters used in :func:" "`sched_setparam`, :func:`sched_setscheduler`, and :func:`sched_getparam`. It " "is immutable." msgstr "" -#: ../../library/os.rst:5401 +#: ../../library/os.rst:5402 msgid "At the moment, there is only one possible parameter:" msgstr "" -#: ../../library/os.rst:5405 +#: ../../library/os.rst:5406 msgid "The scheduling priority for a scheduling policy." msgstr "" -#: ../../library/os.rst:5410 +#: ../../library/os.rst:5411 msgid "" "Get the minimum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5416 +#: ../../library/os.rst:5417 msgid "" "Get the maximum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5422 +#: ../../library/os.rst:5423 msgid "" "Set the scheduling policy for the process with PID *pid*. A *pid* of 0 means " "the calling process. *policy* is one of the scheduling policy constants " "above. *param* is a :class:`sched_param` instance." msgstr "" -#: ../../library/os.rst:5429 +#: ../../library/os.rst:5430 msgid "" "Return the scheduling policy for the process with PID *pid*. A *pid* of 0 " "means the calling process. The result is one of the scheduling policy " "constants above." msgstr "" -#: ../../library/os.rst:5436 +#: ../../library/os.rst:5437 msgid "" "Set the scheduling parameters for the process with PID *pid*. A *pid* of 0 " "means the calling process. *param* is a :class:`sched_param` instance." msgstr "" -#: ../../library/os.rst:5442 +#: ../../library/os.rst:5443 msgid "" "Return the scheduling parameters as a :class:`sched_param` instance for the " "process with PID *pid*. A *pid* of 0 means the calling process." msgstr "" -#: ../../library/os.rst:5448 +#: ../../library/os.rst:5449 msgid "" "Return the round-robin quantum in seconds for the process with PID *pid*. A " "*pid* of 0 means the calling process." msgstr "" -#: ../../library/os.rst:5454 +#: ../../library/os.rst:5455 msgid "" "Voluntarily relinquish the CPU. See :manpage:`sched_yield(2)` for details." msgstr "" -#: ../../library/os.rst:5459 +#: ../../library/os.rst:5460 msgid "" "Restrict the process with PID *pid* (or the current process if zero) to a " "set of CPUs. *mask* is an iterable of integers representing the set of CPUs " "to which the process should be restricted." msgstr "" -#: ../../library/os.rst:5466 +#: ../../library/os.rst:5467 msgid "Return the set of CPUs the process with PID *pid* is restricted to." msgstr "" -#: ../../library/os.rst:5468 +#: ../../library/os.rst:5469 msgid "" "If *pid* is zero, return the set of CPUs the calling thread of the current " "process is restricted to." msgstr "" -#: ../../library/os.rst:5471 +#: ../../library/os.rst:5472 msgid "See also the :func:`process_cpu_count` function." msgstr "也請見 :func:`process_cpu_count` 函式。" -#: ../../library/os.rst:5477 +#: ../../library/os.rst:5478 msgid "Miscellaneous System Information" msgstr "" -#: ../../library/os.rst:5482 +#: ../../library/os.rst:5483 msgid "" "Return string-valued system configuration values. *name* specifies the " "configuration value to retrieve; it may be a string which is the name of a " @@ -6223,13 +6217,13 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:5490 +#: ../../library/os.rst:5491 msgid "" "If the configuration value specified by *name* isn't defined, ``None`` is " "returned." msgstr "" -#: ../../library/os.rst:5493 +#: ../../library/os.rst:5494 msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " @@ -6237,62 +6231,62 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:5503 +#: ../../library/os.rst:5504 msgid "" "Dictionary mapping names accepted by :func:`confstr` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:5512 +#: ../../library/os.rst:5513 msgid "" "Return the number of logical CPUs in the **system**. Returns ``None`` if " "undetermined." msgstr "" -#: ../../library/os.rst:5515 +#: ../../library/os.rst:5516 msgid "" "The :func:`process_cpu_count` function can be used to get the number of " "logical CPUs usable by the calling thread of the **current process**." msgstr "" -#: ../../library/os.rst:5520 +#: ../../library/os.rst:5521 msgid "" "If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " "set, :func:`cpu_count` returns the overridden value *n*." msgstr "" -#: ../../library/os.rst:5527 +#: ../../library/os.rst:5528 msgid "" "Return the number of processes in the system run queue averaged over the " "last 1, 5, and 15 minutes or raises :exc:`OSError` if the load average was " "unobtainable." msgstr "" -#: ../../library/os.rst:5536 +#: ../../library/os.rst:5537 msgid "" "Get the number of logical CPUs usable by the calling thread of the **current " "process**. Returns ``None`` if undetermined. It can be less than :func:" "`cpu_count` depending on the CPU affinity." msgstr "" -#: ../../library/os.rst:5540 +#: ../../library/os.rst:5541 msgid "" "The :func:`cpu_count` function can be used to get the number of logical CPUs " "in the **system**." msgstr "" -#: ../../library/os.rst:5543 +#: ../../library/os.rst:5544 msgid "" "If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " "set, :func:`process_cpu_count` returns the overridden value *n*." msgstr "" -#: ../../library/os.rst:5546 +#: ../../library/os.rst:5547 msgid "See also the :func:`sched_getaffinity` function." msgstr "也請見 :func:`sched_getaffinity` 函式。" -#: ../../library/os.rst:5553 +#: ../../library/os.rst:5554 msgid "" "Return integer-valued system configuration values. If the configuration " "value specified by *name* isn't defined, ``-1`` is returned. The comments " @@ -6301,44 +6295,44 @@ msgid "" "``sysconf_names``." msgstr "" -#: ../../library/os.rst:5563 +#: ../../library/os.rst:5564 msgid "" "Dictionary mapping names accepted by :func:`sysconf` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:5569 +#: ../../library/os.rst:5570 msgid "Add ``'SC_MINSIGSTKSZ'`` name." msgstr "" -#: ../../library/os.rst:5572 +#: ../../library/os.rst:5573 msgid "" "The following data values are used to support path manipulation operations. " "These are defined for all platforms." msgstr "" -#: ../../library/os.rst:5575 +#: ../../library/os.rst:5576 msgid "" "Higher-level operations on pathnames are defined in the :mod:`os.path` " "module." msgstr "" -#: ../../library/os.rst:5581 +#: ../../library/os.rst:5582 msgid "" "The constant string used by the operating system to refer to the current " "directory. This is ``'.'`` for Windows and POSIX. Also available via :mod:" "`os.path`." msgstr "" -#: ../../library/os.rst:5589 +#: ../../library/os.rst:5590 msgid "" "The constant string used by the operating system to refer to the parent " "directory. This is ``'..'`` for Windows and POSIX. Also available via :mod:" "`os.path`." msgstr "" -#: ../../library/os.rst:5598 +#: ../../library/os.rst:5599 msgid "" "The character used by the operating system to separate pathname components. " "This is ``'/'`` for POSIX and ``'\\\\'`` for Windows. Note that knowing " @@ -6347,7 +6341,7 @@ msgid "" "useful. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5608 +#: ../../library/os.rst:5609 msgid "" "An alternative character used by the operating system to separate pathname " "components, or ``None`` if only one separator character exists. This is set " @@ -6355,27 +6349,27 @@ msgid "" "via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5617 +#: ../../library/os.rst:5618 msgid "" "The character which separates the base filename from the extension; for " "example, the ``'.'`` in :file:`os.py`. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5625 +#: ../../library/os.rst:5626 msgid "" "The character conventionally used by the operating system to separate search " "path components (as in :envvar:`PATH`), such as ``':'`` for POSIX or ``';'`` " "for Windows. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5632 +#: ../../library/os.rst:5633 msgid "" "The default search path used by :func:`exec\\*p\\* ` and :func:" "`spawn\\*p\\* ` if the environment doesn't have a ``'PATH'`` key. " "Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5639 +#: ../../library/os.rst:5640 msgid "" "The string used to separate (or, rather, terminate) lines on the current " "platform. This may be a single character, such as ``'\\n'`` for POSIX, or " @@ -6384,36 +6378,36 @@ msgid "" "default); use a single ``'\\n'`` instead, on all platforms." msgstr "" -#: ../../library/os.rst:5648 +#: ../../library/os.rst:5649 msgid "" "The file path of the null device. For example: ``'/dev/null'`` for POSIX, " "``'nul'`` for Windows. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5659 +#: ../../library/os.rst:5660 msgid "" "Flags for use with the :func:`~sys.setdlopenflags` and :func:`~sys." "getdlopenflags` functions. See the Unix manual page :manpage:`dlopen(3)` " "for what the different flags mean." msgstr "" -#: ../../library/os.rst:5667 +#: ../../library/os.rst:5668 msgid "Random numbers" msgstr "" -#: ../../library/os.rst:5672 +#: ../../library/os.rst:5673 msgid "" "Get up to *size* random bytes. The function can return less bytes than " "requested." msgstr "" -#: ../../library/os.rst:5675 +#: ../../library/os.rst:5676 msgid "" "These bytes can be used to seed user-space random number generators or for " "cryptographic purposes." msgstr "" -#: ../../library/os.rst:5678 +#: ../../library/os.rst:5679 msgid "" "``getrandom()`` relies on entropy gathered from device drivers and other " "sources of environmental noise. Unnecessarily reading large quantities of " @@ -6421,32 +6415,32 @@ msgid "" "``/dev/urandom`` devices." msgstr "" -#: ../../library/os.rst:5683 +#: ../../library/os.rst:5684 msgid "" "The flags argument is a bit mask that can contain zero or more of the " "following values ORed together: :py:const:`os.GRND_RANDOM` and :py:data:" "`GRND_NONBLOCK`." msgstr "" -#: ../../library/os.rst:5687 +#: ../../library/os.rst:5688 msgid "" "See also the `Linux getrandom() manual page `_." msgstr "" -#: ../../library/os.rst:5696 +#: ../../library/os.rst:5697 msgid "" "Return a bytestring of *size* random bytes suitable for cryptographic use." msgstr "" -#: ../../library/os.rst:5698 +#: ../../library/os.rst:5699 msgid "" "This function returns random bytes from an OS-specific randomness source. " "The returned data should be unpredictable enough for cryptographic " "applications, though its exact quality depends on the OS implementation." msgstr "" -#: ../../library/os.rst:5702 +#: ../../library/os.rst:5703 msgid "" "On Linux, if the ``getrandom()`` syscall is available, it is used in " "blocking mode: block until the system urandom entropy pool is initialized " @@ -6456,206 +6450,206 @@ msgid "" "to poll until the system urandom entropy pool is initialized." msgstr "" -#: ../../library/os.rst:5709 +#: ../../library/os.rst:5710 msgid "" "On a Unix-like system, random bytes are read from the ``/dev/urandom`` " "device. If the ``/dev/urandom`` device is not available or not readable, " "the :exc:`NotImplementedError` exception is raised." msgstr "" -#: ../../library/os.rst:5713 +#: ../../library/os.rst:5714 msgid "On Windows, it will use ``BCryptGenRandom()``." msgstr "" -#: ../../library/os.rst:5716 +#: ../../library/os.rst:5717 msgid "" "The :mod:`secrets` module provides higher level functions. For an easy-to-" "use interface to the random number generator provided by your platform, " "please see :class:`random.SystemRandom`." msgstr "" -#: ../../library/os.rst:5720 +#: ../../library/os.rst:5721 msgid "" "On Linux 3.17 and newer, the ``getrandom()`` syscall is now used when " "available. On OpenBSD 5.6 and newer, the C ``getentropy()`` function is now " "used. These functions avoid the usage of an internal file descriptor." msgstr "" -#: ../../library/os.rst:5726 +#: ../../library/os.rst:5727 msgid "" "On Linux, if the ``getrandom()`` syscall blocks (the urandom entropy pool is " "not initialized yet), fall back on reading ``/dev/urandom``." msgstr "" -#: ../../library/os.rst:5730 +#: ../../library/os.rst:5731 msgid "" "On Linux, ``getrandom()`` is now used in blocking mode to increase the " "security." msgstr "" -#: ../../library/os.rst:5734 +#: ../../library/os.rst:5735 msgid "" "On Windows, ``BCryptGenRandom()`` is used instead of ``CryptGenRandom()`` " "which is deprecated." msgstr "" -#: ../../library/os.rst:5740 +#: ../../library/os.rst:5741 msgid "" "By default, when reading from ``/dev/random``, :func:`getrandom` blocks if " "no random bytes are available, and when reading from ``/dev/urandom``, it " "blocks if the entropy pool has not yet been initialized." msgstr "" -#: ../../library/os.rst:5744 +#: ../../library/os.rst:5745 msgid "" "If the :py:data:`GRND_NONBLOCK` flag is set, then :func:`getrandom` does not " "block in these cases, but instead immediately raises :exc:`BlockingIOError`." msgstr "" -#: ../../library/os.rst:5751 +#: ../../library/os.rst:5752 msgid "" "If this bit is set, then random bytes are drawn from the ``/dev/" "random`` pool instead of the ``/dev/urandom`` pool." msgstr "" -#: ../../library/os.rst:363 ../../library/os.rst:529 ../../library/os.rst:731 +#: ../../library/os.rst:364 ../../library/os.rst:530 ../../library/os.rst:732 msgid "user" msgstr "user(使用者)" -#: ../../library/os.rst:363 +#: ../../library/os.rst:364 msgid "effective id" msgstr "" -#: ../../library/os.rst:372 ../../library/os.rst:438 ../../library/os.rst:447 -#: ../../library/os.rst:456 ../../library/os.rst:470 ../../library/os.rst:666 -#: ../../library/os.rst:4523 ../../library/os.rst:4549 +#: ../../library/os.rst:373 ../../library/os.rst:439 ../../library/os.rst:448 +#: ../../library/os.rst:457 ../../library/os.rst:471 ../../library/os.rst:667 +#: ../../library/os.rst:4524 ../../library/os.rst:4550 msgid "process" msgstr "process" -#: ../../library/os.rst:372 ../../library/os.rst:438 +#: ../../library/os.rst:373 ../../library/os.rst:439 msgid "group" msgstr "group(群組)" -#: ../../library/os.rst:447 ../../library/os.rst:529 +#: ../../library/os.rst:448 ../../library/os.rst:530 msgid "id" msgstr "id" -#: ../../library/os.rst:456 +#: ../../library/os.rst:457 msgid "id of parent" msgstr "" -#: ../../library/os.rst:470 ../../library/os.rst:666 +#: ../../library/os.rst:471 ../../library/os.rst:667 msgid "scheduling priority" msgstr "scheduling priority(排程優先權)" -#: ../../library/os.rst:552 ../../library/os.rst:801 +#: ../../library/os.rst:553 ../../library/os.rst:802 msgid "environment variables" msgstr "environment variables(環境變數)" -#: ../../library/os.rst:552 +#: ../../library/os.rst:553 msgid "setting" msgstr "setting(設定)" -#: ../../library/os.rst:731 +#: ../../library/os.rst:732 msgid "id, setting" msgstr "id, setting(設定)" -#: ../../library/os.rst:764 +#: ../../library/os.rst:765 msgid "gethostname() (in module socket)" msgstr "gethostname()(於 socket 模組)" -#: ../../library/os.rst:764 +#: ../../library/os.rst:765 msgid "gethostbyaddr() (in module socket)" msgstr "gethostbyaddr()(於 socket 模組)" -#: ../../library/os.rst:801 ../../library/os.rst:2658 +#: ../../library/os.rst:802 ../../library/os.rst:2659 msgid "deleting" msgstr "deleting(刪除)" -#: ../../library/os.rst:1360 ../../library/os.rst:3028 +#: ../../library/os.rst:1361 ../../library/os.rst:3029 msgid "module" msgstr "module(模組)" -#: ../../library/os.rst:1360 +#: ../../library/os.rst:1361 msgid "pty" msgstr "pty" -#: ../../library/os.rst:2045 ../../library/os.rst:2457 -#: ../../library/os.rst:2658 ../../library/os.rst:3562 -#: ../../library/os.rst:3662 +#: ../../library/os.rst:2046 ../../library/os.rst:2458 +#: ../../library/os.rst:2659 ../../library/os.rst:3563 +#: ../../library/os.rst:3663 msgid "directory" msgstr "directory(目錄)" -#: ../../library/os.rst:2045 +#: ../../library/os.rst:2046 msgid "changing" msgstr "changing(改變)" -#: ../../library/os.rst:2457 +#: ../../library/os.rst:2458 msgid "creating" msgstr "creating(建立)" -#: ../../library/os.rst:2457 +#: ../../library/os.rst:2458 msgid "UNC paths" msgstr "UNC paths(UNC 路徑)" -#: ../../library/os.rst:2457 +#: ../../library/os.rst:2458 msgid "and os.makedirs()" msgstr "以及 os.makedirs()" -#: ../../library/os.rst:3028 +#: ../../library/os.rst:3029 msgid "stat" msgstr "stat" -#: ../../library/os.rst:3562 ../../library/os.rst:3662 +#: ../../library/os.rst:3563 ../../library/os.rst:3663 msgid "walking" msgstr "" -#: ../../library/os.rst:3562 ../../library/os.rst:3662 +#: ../../library/os.rst:3563 ../../library/os.rst:3663 msgid "traversal" msgstr "traversal(遍歷)" -#: ../../library/os.rst:4523 ../../library/os.rst:4549 +#: ../../library/os.rst:4524 ../../library/os.rst:4550 msgid "killing" msgstr "" -#: ../../library/os.rst:4523 ../../library/os.rst:4549 +#: ../../library/os.rst:4524 ../../library/os.rst:4550 msgid "signalling" msgstr "signalling(信號)" -#: ../../library/os.rst:5578 ../../library/os.rst:5614 +#: ../../library/os.rst:5579 ../../library/os.rst:5615 msgid ". (dot)" msgstr ". (點)" -#: ../../library/os.rst:5578 ../../library/os.rst:5586 -#: ../../library/os.rst:5594 ../../library/os.rst:5605 -#: ../../library/os.rst:5614 +#: ../../library/os.rst:5579 ../../library/os.rst:5587 +#: ../../library/os.rst:5595 ../../library/os.rst:5606 +#: ../../library/os.rst:5615 msgid "in pathnames" msgstr "於 pathnames(路徑名稱)中" -#: ../../library/os.rst:5586 +#: ../../library/os.rst:5587 msgid ".." msgstr ".." -#: ../../library/os.rst:5594 ../../library/os.rst:5605 +#: ../../library/os.rst:5595 ../../library/os.rst:5606 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../library/os.rst:5595 +#: ../../library/os.rst:5596 msgid "\\ (backslash)" msgstr "\\ (反斜線)" -#: ../../library/os.rst:5595 +#: ../../library/os.rst:5596 msgid "in pathnames (Windows)" msgstr "in pathnames (Windows)(在路徑名稱中 (Windows))" -#: ../../library/os.rst:5621 +#: ../../library/os.rst:5622 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/os.rst:5621 +#: ../../library/os.rst:5622 msgid "path separator (POSIX)" msgstr "path separator (POSIX)(路徑分隔器 (POSIX))" -#: ../../library/os.rst:5621 +#: ../../library/os.rst:5622 msgid "; (semicolon)" msgstr "; (分號)" diff --git a/library/pathlib.po b/library/pathlib.po index b6108e93b9..86e5df8c15 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -76,8 +76,8 @@ msgid "" "You cannot instantiate a :class:`WindowsPath` when running on Unix, but you " "can instantiate :class:`PureWindowsPath`." msgstr "" -"如果你想在 Unix 機器上處理 Windows 路徑(或反過來),你無法在 Unix 上實例化 :" -"class:`WindowsPath`,但你可以實例化 :class:`PureWindowsPath`。" +"如果你想在 Unix 機器上處理 Windows 路徑(或反過來),你無法在 Unix 上實例" +"化 :class:`WindowsPath`,但你可以實例化 :class:`PureWindowsPath`。" #: ../../library/pathlib.rst:40 msgid "" @@ -94,8 +94,8 @@ msgstr ":pep:`428`:pathlib 模組 -- 物件導向檔案系統路徑。" #: ../../library/pathlib.rst:48 msgid "" -"For low-level path manipulation on strings, you can also use the :mod:`os." -"path` module." +"For low-level path manipulation on strings, you can also use " +"the :mod:`os.path` module." msgstr "針對字串上的底層路徑操作,你也可以使用 :mod:`os.path` 模組。" #: ../../library/pathlib.rst:53 @@ -222,8 +222,8 @@ msgid "" "A generic class that represents the system's path flavour (instantiating it " "creates either a :class:`PurePosixPath` or a :class:`PureWindowsPath`)::" msgstr "" -"一個通用的類別,表示系統的路徑類型(實例化時會建立一個 :class:" -"`PurePosixPath` 或 :class:`PureWindowsPath`): ::" +"一個通用的類別,表示系統的路徑類型(實例化時會建立一" +"個 :class:`PurePosixPath` 或 :class:`PureWindowsPath`): ::" #: ../../library/pathlib.rst:121 msgid "" @@ -241,8 +241,8 @@ msgid "" "path object::" msgstr "" "*pathsegments* 中的每個元素可以是以下的其中一種:一個表示路徑片段的字串,或一" -"個物件,它實作了 :class:`os.PathLike` 介面且其中的 :meth:`~os.PathLike." -"__fspath__` 方法會回傳字串,就像是另一個路徑物件: ::" +"個物件,它實作了 :class:`os.PathLike` 介面且其中" +"的 :meth:`~os.PathLike.__fspath__` 方法會回傳字串,就像是另一個路徑物件: ::" #: ../../library/pathlib.rst:129 msgid "" @@ -270,11 +270,11 @@ msgstr "" #: ../../library/pathlib.rst:139 msgid "" -"If a segment is an absolute path, all previous segments are ignored (like :" -"func:`os.path.join`)::" +"If a segment is an absolute path, all previous segments are ignored " +"(like :func:`os.path.join`)::" msgstr "" -"如果一個片段是絕對路徑,則所有之前的片段會被忽略(類似 :func:`os.path." -"join`): ::" +"如果一個片段是絕對路徑,則所有之前的片段會被忽略(類" +"似 :func:`os.path.join`): ::" #: ../../library/pathlib.rst:142 msgid "" @@ -290,8 +290,8 @@ msgstr "" #: ../../library/pathlib.rst:147 msgid "" -"On Windows, the drive is not reset when a rooted relative path segment (e." -"g., ``r'\\foo'``) is encountered::" +"On Windows, the drive is not reset when a rooted relative path segment " +"(e.g., ``r'\\foo'``) is encountered::" msgstr "" "在 Windows 系統上,當遇到具有根目錄的相對路徑片段(例如 ``r'\\foo'``)時,磁" "碟機 (drive) 部分不會被重置: ::" @@ -504,8 +504,8 @@ msgstr "" #: ../../library/pathlib.rst:251 msgid "" -"A path object can be used anywhere an object implementing :class:`os." -"PathLike` is accepted::" +"A path object can be used anywhere an object " +"implementing :class:`os.PathLike` is accepted::" msgstr "" "路徑物件可以被用在任何可以接受實作 :class:`os.PathLike` 的物件的地方: ::" @@ -690,8 +690,8 @@ msgstr "" #: ../../library/pathlib.rst:350 msgid "" -"If the path starts with more than two successive slashes, :class:`~pathlib." -"PurePosixPath` collapses them::" +"If the path starts with more than two successive " +"slashes, :class:`~pathlib.PurePosixPath` collapses them::" msgstr "" "如果路徑以超過兩個連續的斜線開頭,:class:`~pathlib.PurePosixPath` 會合併它" "們: ::" @@ -715,12 +715,12 @@ msgstr "" #: ../../library/pathlib.rst:362 msgid "" "This behavior conforms to *The Open Group Base Specifications Issue 6*, " -"paragraph `4.11 Pathname Resolution `_:" +"paragraph `4.11 Pathname Resolution `_:" msgstr "" "此行為符合 *The Open Group Base Specifications Issue 6*,章節 `4.11 路徑名稱" -"解析 `_:" +"解析 `_:" #: ../../library/pathlib.rst:366 msgid "" @@ -1132,9 +1132,9 @@ msgid "" "\"``**``\" isn't supported (it acts like non-recursive \"``*``\"), and if a " "relative pattern is provided, then matching is done from the right::" msgstr "" -"此方法類似於 :meth:`~PurePath.full_match`,但不允許空白模式(會引發 :exc:" -"`ValueError`)、不支援遞迴萬用字元 \"``**``\"(它會像非遞迴的 \"``*``\" 一" -"樣),且如果提供相對模式,則會從右邊進行比對: ::" +"此方法類似於 :meth:`~PurePath.full_match`,但不允許空白模式(會引" +"發 :exc:`ValueError`)、不支援遞迴萬用字元 \"``**``\"(它會像非遞迴的 " +"\"``*``\" 一樣),且如果提供相對模式,則會從右邊進行比對: ::" #: ../../library/pathlib.rst:605 msgid "" @@ -1167,8 +1167,8 @@ msgid "" "Compute a version of this path relative to the path represented by *other*. " "If it's impossible, :exc:`ValueError` is raised::" msgstr "" -"計算這個路徑相對於 *other* 所表示路徑的版本。如果做不到會引發 :exc:" -"`ValueError`: ::" +"計算這個路徑相對於 *other* 所表示路徑的版本。如果做不到會引" +"發 :exc:`ValueError`: ::" #: ../../library/pathlib.rst:624 msgid "" @@ -1202,8 +1202,8 @@ msgstr "" msgid "" "When *walk_up* is false (the default), the path must start with *other*. " "When the argument is true, ``..`` entries may be added to form the relative " -"path. In all other cases, such as the paths referencing different drives, :" -"exc:`ValueError` is raised.::" +"path. In all other cases, such as the paths referencing different " +"drives, :exc:`ValueError` is raised.::" msgstr "" "當 *walk_up* 是 False(預設值),路徑必須以 *other* 為開始。當此引數是 True," "可能會加入 ``..`` 以組成相對路徑。在其他情況下,例如路徑參考到不同的磁碟機," @@ -1454,11 +1454,11 @@ msgstr "" #: ../../library/pathlib.rst:778 msgid "" -"Raises :exc:`UnsupportedOperation` on Windows. In previous versions, :exc:" -"`NotImplementedError` was raised instead." +"Raises :exc:`UnsupportedOperation` on Windows. In previous " +"versions, :exc:`NotImplementedError` was raised instead." msgstr "" -"在 Windows 上會引發 :exc:`UnsupportedOperation`。在先前版本中,則是引發 :exc:" -"`NotImplementedError`。" +"在 Windows 上會引發 :exc:`UnsupportedOperation`。在先前版本中,則是引" +"發 :exc:`NotImplementedError`。" #: ../../library/pathlib.rst:785 msgid "" @@ -1607,8 +1607,8 @@ msgid "" ":exc:`ValueError` is raised if the URI does not start with ``file:``, or the " "parsed path isn't absolute." msgstr "" -"如果 URI 不是 ``file:`` 開頭,或是剖析後的路徑不是絕對路徑,則會引發 :exc:" -"`ValueError`。" +"如果 URI 不是 ``file:`` 開頭,或是剖析後的路徑不是絕對路徑,則會引" +"發 :exc:`ValueError`。" #: ../../library/pathlib.rst:864 msgid "" @@ -1638,8 +1638,8 @@ msgid "" "For historical reasons, this method is also available from :class:`PurePath` " "objects. However, its use of :func:`os.fsencode` makes it strictly impure." msgstr "" -"因為歷史上的原因,此方法也可以從 :class:`PurePath` 物件上使用。然而,它使用 :" -"func:`os.fsencode` 而讓它完全不純粹。" +"因為歷史上的原因,此方法也可以從 :class:`PurePath` 物件上使用。然而,它使" +"用 :func:`os.fsencode` 而讓它完全不純粹。" #: ../../library/pathlib.rst:882 msgid "Expanding and resolving paths" @@ -1651,8 +1651,9 @@ msgid "" "by :func:`os.path.expanduser` with ``~`` construct). If the home directory " "can't be resolved, :exc:`RuntimeError` is raised." msgstr "" -"回傳一個代表使用者家目錄的新的路徑物件(像以 ``~`` 構成的 :func:`os.path." -"expanduser` 的回傳一樣)。如果無法解析家目錄,會引發 :exc:`RuntimeError`。" +"回傳一個代表使用者家目錄的新的路徑物件(像以 ``~`` 構成" +"的 :func:`os.path.expanduser` 的回傳一樣)。如果無法解析家目錄,會引" +"發 :exc:`RuntimeError`。" #: ../../library/pathlib.rst:892 msgid "" @@ -1665,8 +1666,8 @@ msgstr "" #: ../../library/pathlib.rst:900 msgid "" "Return a new path with expanded ``~`` and ``~user`` constructs, as returned " -"by :meth:`os.path.expanduser`. If a home directory can't be resolved, :exc:" -"`RuntimeError` is raised." +"by :meth:`os.path.expanduser`. If a home directory can't be " +"resolved, :exc:`RuntimeError` is raised." msgstr "" "回傳一個展開 ``~`` 和 ``~user`` 構成的新路徑,像 :meth:`os.path.expanduser` " "回傳的一樣。如果無法解析家目錄,會引發 :exc:`RuntimeError`。" @@ -1683,8 +1684,8 @@ msgstr "" #: ../../library/pathlib.rst:915 msgid "" -"Return a new path object representing the current directory (as returned by :" -"func:`os.getcwd`)::" +"Return a new path object representing the current directory (as returned " +"by :func:`os.getcwd`)::" msgstr "" "回傳一個代表目前目錄的新的路徑物件(像 :func:`os.getcwd` 回傳的一樣): ::" @@ -1760,9 +1761,9 @@ msgid "" "resolved as far as possible and any remainder is appended without checking " "whether it exists." msgstr "" -"如果路徑不存在或遇到符號連結迴圈,且 *strict* 為 ``True``,則引發 :exc:" -"`OSError`。如果 *strict* 為 ``False``,則將盡可能解析該路徑,並將任何剩餘部分" -"追加到路徑中,而不檢查其是否存在。" +"如果路徑不存在或遇到符號連結迴圈,且 *strict* 為 ``True``,則引" +"發 :exc:`OSError`。如果 *strict* 為 ``False``,則將盡可能解析該路徑,並將任何" +"剩餘部分追加到路徑中,而不檢查其是否存在。" #: ../../library/pathlib.rst:956 msgid "The *strict* parameter was added (pre-3.6 behavior is strict)." @@ -1780,8 +1781,8 @@ msgstr "" #: ../../library/pathlib.rst:967 msgid "" -"Return the path to which the symbolic link points (as returned by :func:`os." -"readlink`)::" +"Return the path to which the symbolic link points (as returned " +"by :func:`os.readlink`)::" msgstr "回傳符號連結指向的路徑(如 :func:`os.readlink` 的回傳值): ::" #: ../../library/pathlib.rst:970 @@ -1810,15 +1811,11 @@ msgstr "查詢檔案類型和狀態" #: ../../library/pathlib.rst:987 msgid "" -":meth:`~Path.exists`, :meth:`~Path.is_dir`, :meth:`~Path.is_file`, :meth:" -"`~Path.is_mount`, :meth:`~Path.is_symlink`, :meth:`~Path.is_block_device`, :" -"meth:`~Path.is_char_device`, :meth:`~Path.is_fifo`, :meth:`~Path.is_socket` " +":meth:`~Path.exists`, :meth:`~Path.is_dir`, :meth:`~Path.is_file`, :meth:`~Path.is_mount`, :meth:`~Path.is_symlink`, :meth:`~Path.is_block_device`, :meth:`~Path.is_char_device`, :meth:`~Path.is_fifo`, :meth:`~Path.is_socket` " "now return ``False`` instead of raising an exception for paths that contain " "characters unrepresentable at the OS level." msgstr "" -":meth:`~Path.exists`、:meth:`~Path.is_dir`、:meth:`~Path.is_file`、:meth:" -"`~Path.is_mount`、:meth:`~Path.is_symlink`、:meth:`~Path.is_block_device`、:" -"meth:`~Path.is_char_device`、:meth:`~Path.is_fifo`、:meth:`~Path.is_socket` " +":meth:`~Path.exists`、:meth:`~Path.is_dir`、:meth:`~Path.is_file`、:meth:`~Path.is_mount`、:meth:`~Path.is_symlink`、:meth:`~Path.is_block_device`、:meth:`~Path.is_char_device`、:meth:`~Path.is_fifo`、:meth:`~Path.is_socket` " "遇到路徑包含 OS 層無法表示的字元時現在會回傳 ``False`` 而不是引發例外。" #: ../../library/pathlib.rst:997 @@ -2019,12 +2016,12 @@ msgstr "" #: ../../library/pathlib.rst:1144 msgid "" "Return whether this path points to the same file as *other_path*, which can " -"be either a Path object, or a string. The semantics are similar to :func:" -"`os.path.samefile` and :func:`os.path.samestat`." +"be either a Path object, or a string. The semantics are similar " +"to :func:`os.path.samefile` and :func:`os.path.samestat`." msgstr "" "回傳此路徑是否指向與 *other_path* 相同的檔案,*other_path* 可以是路徑 (Path) " -"物件或字串。其語義類似於 :func:`os.path.samefile` 和 :func:`os.path." -"samestat`。" +"物件或字串。其語義類似於 :func:`os.path.samefile` " +"和 :func:`os.path.samestat`。" #: ../../library/pathlib.rst:1148 msgid "" @@ -2203,8 +2200,8 @@ msgstr "" #: ../../library/pathlib.rst:1279 msgid "" ">>> sorted(Path('.').glob('*.py'))\n" -"[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." -"py')]\n" +"[PosixPath('pathlib.py'), PosixPath('setup.py'), " +"PosixPath('test_pathlib.py')]\n" ">>> sorted(Path('.').glob('*/*.py'))\n" "[PosixPath('docs/conf.py')]\n" ">>> sorted(Path('.').glob('**/*.py'))\n" @@ -2215,8 +2212,8 @@ msgid "" " PosixPath('test_pathlib.py')]" msgstr "" ">>> sorted(Path('.').glob('*.py'))\n" -"[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." -"py')]\n" +"[PosixPath('pathlib.py'), PosixPath('setup.py'), " +"PosixPath('test_pathlib.py')]\n" ">>> sorted(Path('.').glob('*/*.py'))\n" "[PosixPath('docs/conf.py')]\n" ">>> sorted(Path('.').glob('**/*.py'))\n" @@ -2271,8 +2268,8 @@ msgstr "" #: ../../library/pathlib.rst:1321 msgid "" -"Glob the given relative *pattern* recursively. This is like calling :func:" -"`Path.glob` with \"``**/``\" added in front of the *pattern*." +"Glob the given relative *pattern* recursively. This is like " +"calling :func:`Path.glob` with \"``**/``\" added in front of the *pattern*." msgstr "" "遞迴地 glob 給定的相對 *pattern*。這相當於在給定的相對 *pattern* 前面加上 " "\"``**/``\" 並呼叫 :func:`Path.glob`。" @@ -2338,14 +2335,15 @@ msgstr "" #: ../../library/pathlib.rst:1364 msgid "" "When *top_down* is true, the caller can modify the *dirnames* list in-place " -"(for example, using :keyword:`del` or slice assignment), and :meth:`Path." -"walk` will only recurse into the subdirectories whose names remain in " -"*dirnames*. This can be used to prune the search, or to impose a specific " -"order of visiting, or even to inform :meth:`Path.walk` about directories the " -"caller creates or renames before it resumes :meth:`Path.walk` again. " -"Modifying *dirnames* when *top_down* is false has no effect on the behavior " -"of :meth:`Path.walk` since the directories in *dirnames* have already been " -"generated by the time *dirnames* is yielded to the caller." +"(for example, using :keyword:`del` or slice assignment), " +"and :meth:`Path.walk` will only recurse into the subdirectories whose names " +"remain in *dirnames*. This can be used to prune the search, or to impose a " +"specific order of visiting, or even to inform :meth:`Path.walk` about " +"directories the caller creates or renames before it " +"resumes :meth:`Path.walk` again. Modifying *dirnames* when *top_down* is " +"false has no effect on the behavior of :meth:`Path.walk` since the " +"directories in *dirnames* have already been generated by the time *dirnames* " +"is yielded to the caller." msgstr "" "當 *top_down* 是 true,呼叫者可以原地 (in-place) 修改 *dirnames* 串列(例如使" "用 :keyword:`del` 或切片賦值 (slice assignment)),且 :meth:`Path.walk` 只會" @@ -2384,8 +2382,9 @@ msgstr "" #: ../../library/pathlib.rst:1387 msgid "" "Be aware that setting *follow_symlinks* to true can lead to infinite " -"recursion if a link points to a parent directory of itself. :meth:`Path." -"walk` does not keep track of the directories it has already visited." +"recursion if a link points to a parent directory of " +"itself. :meth:`Path.walk` does not keep track of the directories it has " +"already visited." msgstr "" "需要注意的是如果符號連結指向一個其本身的父目錄,則將 *follow_symlinks* 設定" "為 true 會導致無窮的遞迴。:meth:`Path.walk` 不會紀錄其已經瀏覽過的目錄。" @@ -2399,17 +2398,17 @@ msgid "" "*dirnames* as appropriate." msgstr "" ":meth:`Path.walk` 假設其走訪的目錄在執行過程中不會被修改。舉例來說,如果在 " -"*dirnames* 裡的目錄已經被一個符號連結取代,且 *follow_symlinks* 是 false,:" -"meth:`Path.walk` 依然會試著往下進入它。為了防止這樣的行為,可以從 *dirnames* " -"適當地移除目錄。" +"*dirnames* 裡的目錄已經被一個符號連結取代,且 *follow_symlinks* 是 " +"false,:meth:`Path.walk` 依然會試著往下進入它。為了防止這樣的行為,可以從 " +"*dirnames* 適當地移除目錄。" #: ../../library/pathlib.rst:1400 msgid "" "Unlike :func:`os.walk`, :meth:`Path.walk` lists symlinks to directories in " "*filenames* if *follow_symlinks* is false." msgstr "" -"如果 *follow_symlinks* 是 false,和 :func:`os.walk` 行為不同的是 :meth:`Path." -"walk` 會將指向目錄的符號連結放在 *filenames* 串列。" +"如果 *follow_symlinks* 是 false,和 :func:`os.walk` 行為不同的" +"是 :meth:`Path.walk` 會將指向目錄的符號連結放在 *filenames* 串列。" #: ../../library/pathlib.rst:1403 msgid "" @@ -2422,8 +2421,8 @@ msgstr "" #: ../../library/pathlib.rst:1406 msgid "" "from pathlib import Path\n" -"for root, dirs, files in Path(\"cpython/Lib/concurrent\")." -"walk(on_error=print):\n" +"for root, dirs, files in Path(\"cpython/Lib/" +"concurrent\").walk(on_error=print):\n" " print(\n" " root,\n" " \"consumes\",\n" @@ -2436,8 +2435,8 @@ msgid "" " dirs.remove('__pycache__')" msgstr "" "from pathlib import Path\n" -"for root, dirs, files in Path(\"cpython/Lib/concurrent\")." -"walk(on_error=print):\n" +"for root, dirs, files in Path(\"cpython/Lib/" +"concurrent\").walk(on_error=print):\n" " print(\n" " root,\n" " \"consumes\",\n" @@ -2487,8 +2486,8 @@ msgid "" "Create a file at this given path. If *mode* is given, it is combined with " "the process's ``umask`` value to determine the file mode and access flags. " "If the file already exists, the function succeeds when *exist_ok* is true " -"(and its modification time is updated to the current time), otherwise :exc:" -"`FileExistsError` is raised." +"(and its modification time is updated to the current time), " +"otherwise :exc:`FileExistsError` is raised." msgstr "" "根據給定路徑來建立一個檔案。如果 *mode* 有給定,它會與行程的 ``umask`` 值結" "合,以確定檔案模式和存取旗標。當檔案已經存在時,若 *exist_ok* 為 true 則函式" @@ -2496,8 +2495,8 @@ msgstr "" #: ../../library/pathlib.rst:1447 msgid "" -"The :meth:`~Path.open`, :meth:`~Path.write_text` and :meth:`~Path." -"write_bytes` methods are often used to create files." +"The :meth:`~Path.open`, :meth:`~Path.write_text` " +"and :meth:`~Path.write_bytes` methods are often used to create files." msgstr "" ":meth:`~Path.open`、:meth:`~Path.write_text` 和 :meth:`~Path.write_bytes` 方" "法通常用於建立檔案。" @@ -2523,19 +2522,19 @@ msgstr "" #: ../../library/pathlib.rst:1462 msgid "" -"If *parents* is false (the default), a missing parent raises :exc:" -"`FileNotFoundError`." +"If *parents* is false (the default), a missing parent " +"raises :exc:`FileNotFoundError`." msgstr "" -"如果 *parents* 是 false(預設值),缺少的父路徑會引發 :exc:" -"`FileNotFoundError`。" +"如果 *parents* 是 false(預設值),缺少的父路徑會引" +"發 :exc:`FileNotFoundError`。" #: ../../library/pathlib.rst:1465 msgid "" "If *exist_ok* is false (the default), :exc:`FileExistsError` is raised if " "the target directory already exists." msgstr "" -"如果 *exist_ok* 是 false(預設值),則當目標目錄已經存在的話會引發 :exc:" -"`FileExistsError`。" +"如果 *exist_ok* 是 false(預設值),則當目標目錄已經存在的話會引" +"發 :exc:`FileExistsError`。" #: ../../library/pathlib.rst:1468 msgid "" @@ -2543,8 +2542,9 @@ msgid "" "given path already exists in the file system and is not a directory (same " "behavior as the POSIX ``mkdir -p`` command)." msgstr "" -"如果 *exist_ok* 是 true,只有當最後的路徑組成不是一個已存在的非目錄檔案,:" -"exc:`FileExistsError` 例外會被忽略(與 POSIX 的 ``mkdir -p`` 指令行為相同)。" +"如果 *exist_ok* 是 true,只有當最後的路徑組成不是一個已存在的非目錄檔" +"案,:exc:`FileExistsError` 例外會被忽略(與 POSIX 的 ``mkdir -p`` 指令行為相" +"同)。" #: ../../library/pathlib.rst:1472 msgid "The *exist_ok* parameter was added." @@ -2623,11 +2623,11 @@ msgstr "重新命名和刪除" #: ../../library/pathlib.rst:1526 msgid "" -"Rename this file or directory to the given *target*, and return a new :class:" -"`!Path` instance pointing to *target*. On Unix, if *target* exists and is a " -"file, it will be replaced silently if the user has permission. On Windows, " -"if *target* exists, :exc:`FileExistsError` will be raised. *target* can be " -"either a string or another path object::" +"Rename this file or directory to the given *target*, and return a " +"new :class:`!Path` instance pointing to *target*. On Unix, if *target* " +"exists and is a file, it will be replaced silently if the user has " +"permission. On Windows, if *target* exists, :exc:`FileExistsError` will be " +"raised. *target* can be either a string or another path object::" msgstr "" "將此檔案或目錄重新命名為給定的 *target* ,並回傳一個新的 :class:`!Path` 實例" "指向該 *target*。在 Unix 系統上,若 *target* 存在且為一個檔案,若使用者有權" @@ -2657,8 +2657,8 @@ msgstr "" #: ../../library/pathlib.rst:1541 ../../library/pathlib.rst:1557 msgid "" "The target path may be absolute or relative. Relative paths are interpreted " -"relative to the current working directory, *not* the directory of the :class:" -"`!Path` object." +"relative to the current working directory, *not* the directory of " +"the :class:`!Path` object." msgstr "" "目標路徑可以是絕對路徑或相對路徑。相對路徑會相對於目前的工作目錄進行解釋,*而" "不是*\\ 相對於 :class:`!Path` 物件所在的目錄。" @@ -2675,17 +2675,18 @@ msgstr "新增了回傳值,回傳新的 :class:`!Path` 實例。" #: ../../library/pathlib.rst:1553 msgid "" -"Rename this file or directory to the given *target*, and return a new :class:" -"`!Path` instance pointing to *target*. If *target* points to an existing " -"file or empty directory, it will be unconditionally replaced." +"Rename this file or directory to the given *target*, and return a " +"new :class:`!Path` instance pointing to *target*. If *target* points to an " +"existing file or empty directory, it will be unconditionally replaced." msgstr "" -"將此檔案或目錄重新命名為給定的 *target*,並回傳一個指向 *target* 的新 :class:" -"`!Path` 實例。如果 *target* 指向一個現有的檔案或空目錄,它將被無條件地取代。" +"將此檔案或目錄重新命名為給定的 *target*,並回傳一個指向 *target* 的" +"新 :class:`!Path` 實例。如果 *target* 指向一個現有的檔案或空目錄,它將被無條" +"件地取代。" #: ../../library/pathlib.rst:1567 msgid "" -"Remove this file or symbolic link. If the path points to a directory, use :" -"func:`Path.rmdir` instead." +"Remove this file or symbolic link. If the path points to a directory, " +"use :func:`Path.rmdir` instead." msgstr "移除這個檔案或符號連結。如果路徑指向目錄,請改用 :func:`Path.rmdir`。" #: ../../library/pathlib.rst:1570 @@ -2807,11 +2808,11 @@ msgstr "模式語言 (pattern language)" #: ../../library/pathlib.rst:1652 msgid "" -"The following wildcards are supported in patterns for :meth:`~PurePath." -"full_match`, :meth:`~Path.glob` and :meth:`~Path.rglob`:" +"The following wildcards are supported in patterns " +"for :meth:`~PurePath.full_match`, :meth:`~Path.glob` and :meth:`~Path.rglob`:" msgstr "" -"以下的萬用字元在 :meth:`~PurePath.full_match`、:meth:`~Path.glob` 和 :meth:" -"`~Path.rglob` 的模式中被支援:" +"以下的萬用字元在 :meth:`~PurePath.full_match`、:meth:`~Path.glob` " +"和 :meth:`~Path.rglob` 的模式中被支援:" #: ../../library/pathlib.rst:1655 msgid "``**`` (entire segment)" @@ -2940,8 +2941,8 @@ msgstr "" #: ../../library/pathlib.rst:1693 msgid "" -"Globbing with a pattern that ends with a pathname components separator (:" -"data:`~os.sep` or :data:`~os.altsep`) returns only directories." +"Globbing with a pattern that ends with a pathname components separator " +"(:data:`~os.sep` or :data:`~os.altsep`) returns only directories." msgstr "" "Glob 使用以路徑名稱組成的分隔符號(:data:`~os.sep` 或 :data:`~os.altsep`)作" "結尾的模式則只會回傳目錄。" @@ -2952,8 +2953,8 @@ msgstr "與 :mod:`glob` 模組的比較" #: ../../library/pathlib.rst:1701 msgid "" -"The patterns accepted and results generated by :meth:`Path.glob` and :meth:" -"`Path.rglob` differ slightly from those by the :mod:`glob` module:" +"The patterns accepted and results generated by :meth:`Path.glob` " +"and :meth:`Path.rglob` differ slightly from those by the :mod:`glob` module:" msgstr "" ":meth:`Path.glob` 和 :meth:`Path.rglob` 接受的模式和產生的結果與 :mod:`glob` " "模組略有不同:" @@ -2963,16 +2964,16 @@ msgid "" "Files beginning with a dot are not special in pathlib. This is like passing " "``include_hidden=True`` to :func:`glob.glob`." msgstr "" -"pathlib 中以點開頭的檔案並不特別。這和將 ``include_hidden=True`` 傳遞給 :" -"func:`glob.glob` 相同。" +"pathlib 中以點開頭的檔案並不特別。這和將 ``include_hidden=True`` 傳遞" +"給 :func:`glob.glob` 相同。" #: ../../library/pathlib.rst:1706 msgid "" "\"``**``\" pattern components are always recursive in pathlib. This is like " "passing ``recursive=True`` to :func:`glob.glob`." msgstr "" -"``**`` 模式組成在 pathlib 中總是遞迴的。這與將 ``recursive=True`` 傳遞給 :" -"func:`glob.glob` 相同。" +"``**`` 模式組成在 pathlib 中總是遞迴的。這與將 ``recursive=True`` 傳遞" +"給 :func:`glob.glob` 相同。" #: ../../library/pathlib.rst:1708 msgid "" @@ -2989,14 +2990,14 @@ msgid "" "Like all :class:`PurePath` and :class:`Path` objects, the values returned " "from :meth:`Path.glob` and :meth:`Path.rglob` don't include trailing slashes." msgstr "" -"與所有 :class:`PurePath` 和 :class:`Path` 物件一樣,從 :meth:`Path.glob` 和 :" -"meth:`Path.rglob` 回傳的值不包含結尾斜線。" +"與所有 :class:`PurePath` 和 :class:`Path` 物件一樣,從 :meth:`Path.glob` " +"和 :meth:`Path.rglob` 回傳的值不包含結尾斜線。" #: ../../library/pathlib.rst:1714 msgid "" "The values returned from pathlib's ``path.glob()`` and ``path.rglob()`` " -"include the *path* as a prefix, unlike the results of ``glob." -"glob(root_dir=path)``." +"include the *path* as a prefix, unlike the results of " +"``glob.glob(root_dir=path)``." msgstr "" "pathlib 的 ``path.glob()`` 和 ``path.rglob()`` 回傳的值包含了 *path* 作為前" "綴,而 ``glob.glob(root_dir=path)`` 的結果則不會如此。" @@ -3019,8 +3020,8 @@ msgstr "與 :mod:`os` 和 :mod:`os.path` 模組的比較" #: ../../library/pathlib.rst:1726 msgid "" "pathlib implements path operations using :class:`PurePath` and :class:`Path` " -"objects, and so it's said to be *object-oriented*. On the other hand, the :" -"mod:`os` and :mod:`os.path` modules supply functions that work with low-" +"objects, and so it's said to be *object-oriented*. On the other hand, " +"the :mod:`os` and :mod:`os.path` modules supply functions that work with low-" "level ``str`` and ``bytes`` objects, which is a more *procedural* approach. " "Some users consider the object-oriented style to be more readable." msgstr "" @@ -3031,8 +3032,8 @@ msgstr "" #: ../../library/pathlib.rst:1732 msgid "" -"Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths and :" -"ref:`paths relative to directory descriptors `. These features " +"Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths " +"and :ref:`paths relative to directory descriptors `. These features " "aren't available in pathlib." msgstr "" ":mod:`os` 和 :mod:`os.path` 中的許多函式支援 ``bytes`` 路徑和\\ :ref:`相對路" @@ -3041,9 +3042,9 @@ msgstr "" #: ../../library/pathlib.rst:1736 msgid "" -"Python's ``str`` and ``bytes`` types, and portions of the :mod:`os` and :mod:" -"`os.path` modules, are written in C and are very speedy. pathlib is written " -"in pure Python and is often slower, but rarely slow enough to matter." +"Python's ``str`` and ``bytes`` types, and portions of the :mod:`os` " +"and :mod:`os.path` modules, are written in C and are very speedy. pathlib is " +"written in pure Python and is often slower, but rarely slow enough to matter." msgstr "" "Python 的 ``str`` 和 ``bytes`` 型別,以及 :mod:`os` 和 :mod:`os.path` 模組的" "一些部分,是用 C 寫的且非常快速。pathlib 是用純 Python 寫的且通常比較慢,但很" @@ -3057,9 +3058,9 @@ msgid "" "are involved, :meth:`Path.absolute` preserves these segments for greater " "safety." msgstr "" -"pathlib 的路徑正規化略比 :mod:`os.path` 更武斷和一致。例如,儘管 :func:`os." -"path.abspath` 會從路徑中移除 \"``..``\" 片段,如果包含符號連結的話這可能會改" -"變其意義,而 :meth:`Path.absolute` 則會保留這些片段以增加安全性。" +"pathlib 的路徑正規化略比 :mod:`os.path` 更武斷和一致。例如,儘" +"管 :func:`os.path.abspath` 會從路徑中移除 \"``..``\" 片段,如果包含符號連結的" +"話這可能會改變其意義,而 :meth:`Path.absolute` 則會保留這些片段以增加安全性。" #: ../../library/pathlib.rst:1745 msgid "" @@ -3089,7 +3090,7 @@ msgstr "" "pathlib 將 ``Path(\"./my_program\")`` 正規化為 ``Path(\"my_program\")``,這會" "在作為執行檔搜尋路徑使用時改變路徑的意義,例如在 shell 或在衍生 (spawn) 子行" "程時。具體來說,在路徑中缺少分隔符號可能會使其強制在 :envvar:`PATH` 中尋找," -"而不是當前目錄。" +"而不是目前目錄。" #: ../../library/pathlib.rst:1758 msgid "" @@ -3103,11 +3104,11 @@ msgstr "對應工具" #: ../../library/pathlib.rst:1765 msgid "" -"Below is a table mapping various :mod:`os` functions to their corresponding :" -"class:`PurePath`/:class:`Path` equivalent." +"Below is a table mapping various :mod:`os` functions to their " +"corresponding :class:`PurePath`/:class:`Path` equivalent." msgstr "" -"以下是一張表格,對應許多 :mod:`os` 函式及其相符於 :class:`PurePath`/:class:" -"`Path` 的項目。" +"以下是一張表格,對應許多 :mod:`os` 函式及其相符" +"於 :class:`PurePath`/:class:`Path` 的項目。" #: ../../library/pathlib.rst:1769 msgid ":mod:`os` and :mod:`os.path`" @@ -3378,23 +3379,23 @@ msgid "" msgstr "" ":func:`os.path.relpath` 會呼叫 :func:`~os.path.abspath` 來將路徑變成絕對路徑" "並移除 \"``..``\" 部分,而 :meth:`PurePath.relative_to` 是一個文本上的操作," -"當它輸入的錨點不同時(例如一個是絕對路徑,另一個則是相對路徑)會引發 :exc:" -"`ValueError`。" +"當它輸入的錨點不同時(例如一個是絕對路徑,另一個則是相對路徑)會引" +"發 :exc:`ValueError`。" #: ../../library/pathlib.rst:1810 msgid "" ":func:`os.path.expanduser` returns the path unchanged if the home directory " -"can't be resolved, whereas :meth:`Path.expanduser` raises :exc:" -"`RuntimeError`." +"can't be resolved, whereas :meth:`Path.expanduser` " +"raises :exc:`RuntimeError`." msgstr "" -":func:`os.path.expanduser` 會在無法解析家目錄時回傳原始路徑,而 :meth:`Path." -"expanduser` 則會引發 :exc:`RuntimeError`。" +":func:`os.path.expanduser` 會在無法解析家目錄時回傳原始路徑," +"而 :meth:`Path.expanduser` 則會引發 :exc:`RuntimeError`。" #: ../../library/pathlib.rst:1813 msgid "" ":func:`os.path.abspath` removes \"``..``\" components without resolving " -"symlinks, which may change the meaning of the path, whereas :meth:`Path." -"absolute` leaves any \"``..``\" components in the path." +"symlinks, which may change the meaning of the path, " +"whereas :meth:`Path.absolute` leaves any \"``..``\" components in the path." msgstr "" ":func:`os.path.abspath` 將 \"``..``\" 組成移除而不解析符號連結,這可能會改變" "路徑的意義,而 :meth:`Path.absolute` 則會保留路徑中任何 \"``..``\" 組成。" diff --git a/library/pdb.po b/library/pdb.po index 4dc66fd8de..2cdb572a06 100644 --- a/library/pdb.po +++ b/library/pdb.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-15 00:13+0000\n" +"POT-Creation-Date: 2025-04-09 00:15+0000\n" "PO-Revision-Date: 2024-10-19 17:39+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -152,17 +152,17 @@ msgstr "" "透過 :mod:`readline` 模組達成的 tab 補全可用於補全本模組的命令和命令的引數," "例如會提供目前的全域和區域名稱以作為 ``p`` 命令的引數。" -#: ../../library/pdb.rst:78 +#: ../../library/pdb.rst:80 msgid "" "You can also invoke :mod:`pdb` from the command line to debug other " "scripts. For example::" msgstr "你還可以從命令列叫用 :mod:`pdb` 來偵錯其他腳本。例如: ::" -#: ../../library/pdb.rst:81 -msgid "python -m pdb myscript.py" -msgstr "python -m pdb myscript.py" - #: ../../library/pdb.rst:83 +msgid "python -m pdb [-c command] (-m module | pyfile) [args ...]" +msgstr "python -m pdb [-c command] (-m module | pyfile) [args ...]" + +#: ../../library/pdb.rst:85 msgid "" "When invoked as a module, pdb will automatically enter post-mortem debugging " "if the program being debugged exits abnormally. After post-mortem debugging " @@ -174,28 +174,35 @@ msgstr "" "偵錯後(或程式正常退出後),pdb 將重新啟動程式。自動重新啟動會保留 pdb 的狀態" "(例如斷點),並且在大多數情況下比在程式退出時退出偵錯器更有用。" -#: ../../library/pdb.rst:89 +#: ../../library/pdb.rst:93 msgid "" -"Added the ``-c`` option to execute commands as if given in a :file:`.pdbrc` " -"file; see :ref:`debugger-commands`." +"To execute commands as if given in a :file:`.pdbrc` file; see :ref:`debugger-" +"commands`." msgstr "" -"新增了 ``-c`` 選項來執行命令,就像能在 :file:`.pdbrc` 檔案中給定的那樣;請參" -"閱\\ :ref:`偵錯器命令 `。" +"就像在 :file:`.pdbrc` 檔案中給定的那樣來執行命令;請參閱\\ :ref:`偵錯器命令 " +"`。" -#: ../../library/pdb.rst:93 +#: ../../library/pdb.rst:96 +msgid "Added the ``-c`` option." +msgstr "新增了 ``-c`` 選項。" + +#: ../../library/pdb.rst:101 msgid "" -"Added the ``-m`` option to execute modules similar to the way ``python -m`` " -"does. As with a script, the debugger will pause execution just before the " -"first line of the module." +"To execute modules similar to the way ``python -m`` does. As with a script, " +"the debugger will pause execution just before the first line of the module." msgstr "" -"新增了 ``-m`` 選項以類似於 ``python -m`` 的方式來執行模組。與腳本一樣,偵錯器" -"將在模組的第一列之前暫停執行。" +"以類似於 ``python -m`` 的方式來執行模組。與腳本一樣,偵錯器將在模組的第一列之" +"前暫停執行。" + +#: ../../library/pdb.rst:104 +msgid "Added the ``-m`` option." +msgstr "新增了 ``-m`` 選項。" -#: ../../library/pdb.rst:98 +#: ../../library/pdb.rst:107 msgid "Typical usage to execute a statement under control of the debugger is::" msgstr "在偵錯器控制下執行陳述式的典型用法是: ::" -#: ../../library/pdb.rst:100 +#: ../../library/pdb.rst:109 msgid "" ">>> import pdb\n" ">>> def f(x):\n" @@ -215,11 +222,11 @@ msgstr "" "0.5\n" ">>>" -#: ../../library/pdb.rst:109 +#: ../../library/pdb.rst:118 msgid "The typical usage to inspect a crashed program is::" msgstr "檢查一個損壞程式的典型用法: ::" -#: ../../library/pdb.rst:111 +#: ../../library/pdb.rst:120 msgid "" ">>> import pdb\n" ">>> def f(x):\n" @@ -251,7 +258,7 @@ msgstr "" "0\n" "(Pdb)" -#: ../../library/pdb.rst:126 +#: ../../library/pdb.rst:135 msgid "" "The implementation of :pep:`667` means that name assignments made via " "``pdb`` will immediately affect the active scope, even when running inside " @@ -261,13 +268,13 @@ msgstr "" "影響有效作用域,即使在\\ :term:`最佳化作用域 `\\ 內運作也是" "如此。" -#: ../../library/pdb.rst:132 +#: ../../library/pdb.rst:141 msgid "" "The module defines the following functions; each enters the debugger in a " "slightly different way:" msgstr "本模組定義了下列函式,每個函式進入偵錯器的方式略有不同:" -#: ../../library/pdb.rst:137 +#: ../../library/pdb.rst:146 msgid "" "Execute the *statement* (given as a string or a code object) under debugger " "control. The debugger prompt appears before any code is executed; you can " @@ -285,7 +292,7 @@ msgstr "" "用 :mod:`__main__` 模組的字典。(請參閱內建函式 :func:`exec` 或 :func:`eval` " "的說明。)" -#: ../../library/pdb.rst:149 +#: ../../library/pdb.rst:158 msgid "" "Evaluate the *expression* (given as a string or a code object) under " "debugger control. When :func:`runeval` returns, it returns the value of the " @@ -295,7 +302,7 @@ msgstr "" "當 :func:`runeval` 回傳時,它回傳 *expression* 的值。除此之外,該函式" "與 :func:`run` 類似。" -#: ../../library/pdb.rst:156 +#: ../../library/pdb.rst:165 msgid "" "Call the *function* (a function or method object, not a string) with the " "given arguments. When :func:`runcall` returns, it returns whatever the " @@ -306,7 +313,7 @@ msgstr "" "串)。:func:`runcall` 回傳的是所呼叫函式的回傳值。偵錯器提示字元將在進入函式" "後立即出現。" -#: ../../library/pdb.rst:164 +#: ../../library/pdb.rst:173 msgid "" "Enter the debugger at the calling stack frame. This is useful to hard-code " "a breakpoint at a given point in a program, even if the code is not " @@ -317,17 +324,17 @@ msgstr "" "一個斷點,即便該程式碼不在偵錯狀態(如斷言失敗時)。如有給定 *header*,它將在" "偵錯正要開始前被印出到控制台。" -#: ../../library/pdb.rst:169 +#: ../../library/pdb.rst:178 msgid "The keyword-only argument *header*." msgstr "僅限關鍵字引數 *header*。" -#: ../../library/pdb.rst:172 +#: ../../library/pdb.rst:181 msgid "" ":func:`set_trace` will enter the debugger immediately, rather than on the " "next line of code to be executed." msgstr ":func:`set_trace` 將立即進入偵錯器,而不是在下一列要執行的程式碼中。" -#: ../../library/pdb.rst:178 +#: ../../library/pdb.rst:187 msgid "" "Enter post-mortem debugging of the given exception or :ref:`traceback object " "`. If no value is given, it uses the exception that is " @@ -336,16 +343,16 @@ msgstr "" "進入所給定例外或\\ :ref:`回溯物件 `\\ 的事後偵錯。如果沒有" "給定,預設使用目前正在處理的例外,或如果沒有例外則會引發 ``ValueError``。" -#: ../../library/pdb.rst:183 +#: ../../library/pdb.rst:192 msgid "Support for exception objects was added." msgstr "新增對例外物件的支援。" -#: ../../library/pdb.rst:188 +#: ../../library/pdb.rst:197 msgid "" "Enter post-mortem debugging of the exception found in :data:`sys.last_exc`." msgstr "進入在 :data:`sys.last_exc` 中發現的例外的事後偵錯。" -#: ../../library/pdb.rst:192 +#: ../../library/pdb.rst:201 msgid "" "The ``run*`` functions and :func:`set_trace` are aliases for instantiating " "the :class:`Pdb` class and calling the method of the same name. If you want " @@ -355,11 +362,11 @@ msgstr "" "(instantiate) :class:`Pdb` 類別並呼叫同名方法。如果要使用更多功能,則必須自己" "執行以下操作:" -#: ../../library/pdb.rst:199 +#: ../../library/pdb.rst:208 msgid ":class:`Pdb` is the debugger class." msgstr ":class:`Pdb` 是偵錯器類別。" -#: ../../library/pdb.rst:201 +#: ../../library/pdb.rst:210 msgid "" "The *completekey*, *stdin* and *stdout* arguments are passed to the " "underlying :class:`cmd.Cmd` class; see the description there." @@ -367,7 +374,7 @@ msgstr "" "*completekey*、*stdin* 與 *stdout* 引數會被傳到底層的 :class:`cmd.Cmd` 類別;" "請於該文件閱讀相關敘述。" -#: ../../library/pdb.rst:204 +#: ../../library/pdb.rst:213 msgid "" "The *skip* argument, if given, must be an iterable of glob-style module name " "patterns. The debugger will not step into frames that originate in a module " @@ -376,7 +383,7 @@ msgstr "" "如果給定 *skip* 引數,則它必須是一個給出 glob 樣式之模組名稱的疊代器。如果遇" "到匹配這些樣式的模組,偵錯器將不會進入來自該模組的 frame。 [1]_" -#: ../../library/pdb.rst:208 +#: ../../library/pdb.rst:217 msgid "" "By default, Pdb sets a handler for the SIGINT signal (which is sent when the " "user presses :kbd:`Ctrl-C` on the console) when you give " @@ -389,50 +396,50 @@ msgstr "" "允許你透過按下 :kbd:`Ctrl-C` 再次切入偵錯器。如果你希望 Pdb 不影響到 SIGINT " "處理程式,請將 *nosigint* 設定為 true。" -#: ../../library/pdb.rst:213 +#: ../../library/pdb.rst:222 msgid "" "The *readrc* argument defaults to true and controls whether Pdb will " "load .pdbrc files from the filesystem." msgstr "*readrc* 引數預設為 true,它控制 Pdb 是否從檔案系統載入 .pdbrc 檔案。" -#: ../../library/pdb.rst:216 +#: ../../library/pdb.rst:225 msgid "Example call to enable tracing with *skip*::" msgstr "啟用追蹤 (tracing) 且帶有 *skip* 引數的呼叫示範: ::" -#: ../../library/pdb.rst:218 +#: ../../library/pdb.rst:227 msgid "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" msgstr "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" -#: ../../library/pdb.rst:220 +#: ../../library/pdb.rst:229 msgid "" "Raises an :ref:`auditing event ` ``pdb.Pdb`` with no arguments." msgstr "" "不帶引數地引發一個\\ :ref:`稽核事件 (auditing event) ` " "``pdb.Pdb``。" -#: ../../library/pdb.rst:222 +#: ../../library/pdb.rst:231 msgid "Added the *skip* parameter." msgstr "新增了 *skip* 參數。" -#: ../../library/pdb.rst:225 +#: ../../library/pdb.rst:234 msgid "" "Added the *nosigint* parameter. Previously, a SIGINT handler was never set " "by Pdb." msgstr "新增了 *nosigint* 參數。以前 SIGINT 處理程式從未被 Pdb 設定過。" -#: ../../library/pdb.rst:229 +#: ../../library/pdb.rst:238 msgid "The *readrc* argument." msgstr "*readrc* 引數。" -#: ../../library/pdb.rst:237 +#: ../../library/pdb.rst:246 msgid "See the documentation for the functions explained above." msgstr "請見上面關於這些函式的文件說明。" -#: ../../library/pdb.rst:243 +#: ../../library/pdb.rst:252 msgid "Debugger Commands" msgstr "偵錯器命令" -#: ../../library/pdb.rst:245 +#: ../../library/pdb.rst:254 msgid "" "The commands recognized by the debugger are listed below. Most commands can " "be abbreviated to one or two letters as indicated; e.g. ``h(elp)`` means " @@ -449,7 +456,7 @@ msgstr "" "空格(空格符 (spaces) 或製表符 (tabs))分隔。在命令語法中,可選引數被括在方括" "號 (``[]``) 中;使用時請勿輸入方括號。命令語法中的選擇項由豎線 (``|``) 分隔。" -#: ../../library/pdb.rst:254 +#: ../../library/pdb.rst:263 msgid "" "Entering a blank line repeats the last command entered. Exception: if the " "last command was a :pdbcmd:`list` command, the next 11 lines are listed." @@ -457,7 +464,7 @@ msgstr "" "輸入一個空白列 (blank line) 將重複上次輸入的命令。例外:如果上一個命令" "是 :pdbcmd:`list` 命令,則會列出接下來的 11 列。" -#: ../../library/pdb.rst:257 +#: ../../library/pdb.rst:266 msgid "" "Commands that the debugger doesn't recognize are assumed to be Python " "statements and are executed in the context of the program being debugged. " @@ -472,13 +479,13 @@ msgstr "" "大方法,甚至可以修改變數或呼叫函式。當此類陳述式發生例外,將印出例外名稱,但" "偵錯器的狀態不會改變。" -#: ../../library/pdb.rst:265 +#: ../../library/pdb.rst:274 msgid "" "Expressions/Statements whose prefix is a pdb command are now correctly " "identified and executed." msgstr "現在可以正確辨識並執行前綴為 pdb 命令的運算式/陳述式。" -#: ../../library/pdb.rst:269 +#: ../../library/pdb.rst:278 msgid "" "The debugger supports :ref:`aliases `. Aliases can have " "parameters which allows one a certain level of adaptability to the context " @@ -487,7 +494,7 @@ msgstr "" "偵錯器有支援設定\\ :ref:`別名 `。別名可以有參數,使得偵錯器" "對被檢查的情境有一定程度的適應性。" -#: ../../library/pdb.rst:273 +#: ../../library/pdb.rst:282 msgid "" "Multiple commands may be entered on a single line, separated by ``;;``. (A " "single ``;`` is not used as it is the separator for multiple commands in a " @@ -502,7 +509,7 @@ msgstr "" "總是在第一處 ``;;`` 被切分開,即使它位於引號內的字串之中。對於具有雙分號字串" "的一個變通解法,是使用隱式字串連接 ``';'';'`` 或 ``\";\"\";\"``。" -#: ../../library/pdb.rst:280 +#: ../../library/pdb.rst:289 msgid "" "To set a temporary global variable, use a *convenience variable*. A " "*convenience variable* is a variable whose name starts with ``$``. For " @@ -516,27 +523,27 @@ msgstr "" "可以在偵錯器會話 (debugger session) 中使用它。當程式恢復執行時,*便利變數*\\ " "將被清除,因此與使用 ``foo = 1`` 等普通變數相比,它不太會去干擾你的程式。" -#: ../../library/pdb.rst:287 +#: ../../library/pdb.rst:296 msgid "There are three preset *convenience variables*:" msgstr "共有三個預先設定的\\ *便利變數*:" -#: ../../library/pdb.rst:289 +#: ../../library/pdb.rst:298 msgid "``$_frame``: the current frame you are debugging" msgstr "``$_frame``:目前正在偵錯的 frame" -#: ../../library/pdb.rst:290 +#: ../../library/pdb.rst:299 msgid "``$_retval``: the return value if the frame is returning" msgstr "``$_retval``:frame 回傳時的回傳值" -#: ../../library/pdb.rst:291 +#: ../../library/pdb.rst:300 msgid "``$_exception``: the exception if the frame is raising an exception" msgstr "``$_exception``:frame 引發例外時的例外" -#: ../../library/pdb.rst:295 +#: ../../library/pdb.rst:304 msgid "Added the *convenience variable* feature." msgstr "新增了\\ *便利變數*\\ 功能。" -#: ../../library/pdb.rst:301 +#: ../../library/pdb.rst:310 msgid "" "If a file :file:`.pdbrc` exists in the user's home directory or in the " "current directory, it is read with ``'utf-8'`` encoding and executed as if " @@ -550,7 +557,7 @@ msgstr "" "空列和以 ``#`` 開頭的列會被忽略之外。這對於別名設定特別有用。如果兩個檔案都存" "在,則先讀取家目錄中的檔案,且定義於其中的別名可以被本地檔案覆蓋。" -#: ../../library/pdb.rst:308 +#: ../../library/pdb.rst:317 msgid "" ":file:`.pdbrc` can now contain commands that continue debugging, such " "as :pdbcmd:`continue` or :pdbcmd:`next`. Previously, these commands had no " @@ -559,7 +566,7 @@ msgstr "" ":file:`.pdbrc` 現在可以包含繼續偵錯的命令,如 :pdbcmd:`continue` " "或 :pdbcmd:`next`。以前檔案中的這些命令是無效的。" -#: ../../library/pdb.rst:313 +#: ../../library/pdb.rst:322 msgid "" ":file:`.pdbrc` is now read with ``'utf-8'`` encoding. Previously, it was " "read with the system locale encoding." @@ -567,7 +574,7 @@ msgstr "" ":file:`.pdbrc` 現在使用 ``'utf-8'`` 編碼讀取。以前它是使用系統區域設定編碼讀" "取的。" -#: ../../library/pdb.rst:320 +#: ../../library/pdb.rst:329 msgid "" "Without argument, print the list of available commands. With a *command* as " "argument, print help about that command. ``help pdb`` displays the full " @@ -580,7 +587,7 @@ msgstr "" "由於 *command* 引數必須是一個識別字 (identifier),若要取得 ``!`` 命令的幫助訊" "息則必須輸入 ``help exec``。" -#: ../../library/pdb.rst:328 +#: ../../library/pdb.rst:337 msgid "" "Print a stack trace, with the most recent frame at the bottom. An arrow " "(``>``) indicates the current frame, which determines the context of most " @@ -589,7 +596,7 @@ msgstr "" "印出 stack trace,最新的 frame 會位於底部。箭頭(``>``)表示目前的 frame,它" "也決定了大多數命令的情境。" -#: ../../library/pdb.rst:333 +#: ../../library/pdb.rst:342 msgid "" "Move the current frame *count* (default one) levels down in the stack trace " "(to a newer frame)." @@ -597,7 +604,7 @@ msgstr "" "在 stack trace 中,將目前 frame 向下移動 *count* 級(預設為 1 級,移往較新的 " "frame)。" -#: ../../library/pdb.rst:338 +#: ../../library/pdb.rst:347 msgid "" "Move the current frame *count* (default one) levels up in the stack trace " "(to an older frame)." @@ -605,7 +612,7 @@ msgstr "" "在 stack trace 中,將目前 frame 向上移動 *count* 級(預設為 1 級,移向較舊的 " "frame)。" -#: ../../library/pdb.rst:343 +#: ../../library/pdb.rst:352 msgid "" "With a *lineno* argument, set a break at line *lineno* in the current file. " "The line number may be prefixed with a *filename* and a colon, to specify a " @@ -619,7 +626,7 @@ msgstr "" "檔案會在 :data:`sys.path` 上搜尋。可接受的 *filename* 形式為 ``/abspath/to/" "file.py``、``relpath/file.py``、``module`` 和 ``package.module``。" -#: ../../library/pdb.rst:350 +#: ../../library/pdb.rst:359 msgid "" "With a *function* argument, set a break at the first executable statement " "within that function. *function* can be any expression that evaluates to a " @@ -628,13 +635,13 @@ msgstr "" "如帶有 *function* 引數,在該函式內的第一個可執行陳述式處設定中斷。*function* " "可以是任何其求值結果為目前命名空間中函式的運算式。" -#: ../../library/pdb.rst:354 +#: ../../library/pdb.rst:363 msgid "" "If a second argument is present, it is an expression which must evaluate to " "true before the breakpoint is honored." msgstr "如果第二個引數存在,它是一個運算式,在斷點生效前其必須求值為 true" -#: ../../library/pdb.rst:357 +#: ../../library/pdb.rst:366 msgid "" "Without argument, list all breaks, including for each breakpoint, the number " "of times that breakpoint has been hit, the current ignore count, and the " @@ -643,20 +650,20 @@ msgstr "" "如果不帶引數執行會列出所有斷點資訊,包括每個斷點、命中該斷點的次數、目前的忽" "略次數以及關聯的條件(如存在)。" -#: ../../library/pdb.rst:361 +#: ../../library/pdb.rst:370 msgid "" "Each breakpoint is assigned a number to which all the other breakpoint " "commands refer." msgstr "每個斷點都有賦予一個編號,所有其他斷點命令都參照該編號。" -#: ../../library/pdb.rst:366 +#: ../../library/pdb.rst:375 msgid "" "Temporary breakpoint, which is removed automatically when it is first hit. " "The arguments are the same as for :pdbcmd:`break`." msgstr "" "臨時斷點,在第一次遇見時會自動被刪除。它的引數與 :pdbcmd:`break` 相同。" -#: ../../library/pdb.rst:371 +#: ../../library/pdb.rst:380 msgid "" "With a *filename:lineno* argument, clear all the breakpoints at this line. " "With a space separated list of breakpoint numbers, clear those breakpoints. " @@ -665,7 +672,7 @@ msgstr "" "如帶有 *filename:lineno* 引數,則清除此列上的所有斷點。如果引數是空格分隔的斷" "點編號列表,則清除這些斷點。如果不帶引數則清除所有斷點(但會先提示確認)。" -#: ../../library/pdb.rst:377 +#: ../../library/pdb.rst:386 msgid "" "Disable the breakpoints given as a space separated list of breakpoint " "numbers. Disabling a breakpoint means it cannot cause the program to stop " @@ -675,11 +682,11 @@ msgstr "" "停用斷點,斷點以空格分隔的斷點編號列表來給定。停用斷點表示它不會導致程式停止" "執行,但是與清除斷點不同,停用的斷點將保留在斷點列表中並且可以(重新)啟用。" -#: ../../library/pdb.rst:384 +#: ../../library/pdb.rst:393 msgid "Enable the breakpoints specified." msgstr "啟用指定的斷點。" -#: ../../library/pdb.rst:388 +#: ../../library/pdb.rst:397 msgid "" "Set the ignore count for the given breakpoint number. If *count* is " "omitted, the ignore count is set to 0. A breakpoint becomes active when the " @@ -691,7 +698,7 @@ msgstr "" "為 0 時,斷點將變為有效狀態。當非 0 時,每次到達斷點,且斷點沒有被禁用,且任" "何關聯的條件被求值為 true,則 *count* 就會遞減。" -#: ../../library/pdb.rst:396 +#: ../../library/pdb.rst:405 msgid "" "Set a new *condition* for the breakpoint, an expression which must evaluate " "to true before the breakpoint is honored. If *condition* is absent, any " @@ -700,7 +707,7 @@ msgstr "" "為斷點設定一個新 *condition*,為一個運算式,且其求值結果為 true 時斷點才會起" "作用。如果沒有給定 *condition*,則刪除任何現有條件,也就是不為斷點設定條件。" -#: ../../library/pdb.rst:402 +#: ../../library/pdb.rst:411 msgid "" "Specify a list of commands for breakpoint number *bpnumber*. The commands " "themselves appear on the following lines. Type a line containing just " @@ -709,7 +716,7 @@ msgstr "" "為編號是 *bpnumber* 的斷點指定一系列命令。命令內容出現在後續的幾列中。輸入僅" "包含 ``end`` 的一列來結束命令列表。例如: ::" -#: ../../library/pdb.rst:406 +#: ../../library/pdb.rst:415 msgid "" "(Pdb) commands 1\n" "(com) p some_variable\n" @@ -721,7 +728,7 @@ msgstr "" "(com) end\n" "(Pdb)" -#: ../../library/pdb.rst:411 +#: ../../library/pdb.rst:420 msgid "" "To remove all commands from a breakpoint, type ``commands`` and follow it " "immediately with ``end``; that is, give no commands." @@ -729,12 +736,12 @@ msgstr "" "要刪除斷點上的所有命令,請輸入 ``commands`` 並立即以 ``end`` 結尾,也就是不指" "定任何命令。" -#: ../../library/pdb.rst:414 +#: ../../library/pdb.rst:423 msgid "" "With no *bpnumber* argument, ``commands`` refers to the last breakpoint set." msgstr "不帶有 *bpnumber* 引數則 ``commands`` 會關聯到上一個設定的斷點。" -#: ../../library/pdb.rst:416 +#: ../../library/pdb.rst:425 msgid "" "You can use breakpoint commands to start your program up again. Simply use " "the :pdbcmd:`continue` command, or :pdbcmd:`step`, or any other command that " @@ -743,7 +750,7 @@ msgstr "" "可以使用斷點命令來重新啟動程式,只需使用 :pdbcmd:`continue` " "或 :pdbcmd:`step` 命令,或其他可以繼續執行程式的命令。" -#: ../../library/pdb.rst:420 +#: ../../library/pdb.rst:429 msgid "" "Specifying any command resuming execution " "(currently :pdbcmd:`continue`, :pdbcmd:`step`, :pdbcmd:`next`, :pdbcmd:`return`, :pdbcmd:`jump`, :pdbcmd:`quit` " @@ -759,7 +766,7 @@ msgstr "" "執行下去(即使是簡單的 next 或 step),都可能會遇到另一個斷點,該斷點可能具有" "自己的命令列表,這會導致無法確定要執行哪個列表。" -#: ../../library/pdb.rst:429 +#: ../../library/pdb.rst:438 msgid "" "If you use the ``silent`` command in the command list, the usual message " "about stopping at a breakpoint is not printed. This may be desirable for " @@ -771,7 +778,7 @@ msgstr "" "息就不會印出。對於要印出特定訊息再繼續的斷點來說,這可能會是需要的功能。如果" "其他命令都沒有印出任何內容,那你就看不到已到達斷點的跡象。" -#: ../../library/pdb.rst:436 +#: ../../library/pdb.rst:445 msgid "" "Execute the current line, stop at the first possible occasion (either in a " "function that is called or on the next line in the current function)." @@ -779,7 +786,7 @@ msgstr "" "執行目前列,在第一個可以停止的位置(在被呼叫的函式內部或在目前函式的下一列)" "停止。" -#: ../../library/pdb.rst:441 +#: ../../library/pdb.rst:450 msgid "" "Continue execution until the next line in the current function is reached or " "it returns. (The difference between :pdbcmd:`next` and :pdbcmd:`step` is " @@ -792,13 +799,13 @@ msgstr "" "而 :pdbcmd:`next`\\ (幾乎)全速執行被呼叫的函式,並僅在目前函式的下一列停" "止。)" -#: ../../library/pdb.rst:449 +#: ../../library/pdb.rst:458 msgid "" "Without argument, continue execution until the line with a number greater " "than the current one is reached." msgstr "如果不帶引數則繼續執行,直到列號比目前的列大時停止。" -#: ../../library/pdb.rst:452 +#: ../../library/pdb.rst:461 msgid "" "With *lineno*, continue execution until a line with a number greater or " "equal to *lineno* is reached. In both cases, also stop when the current " @@ -807,19 +814,19 @@ msgstr "" "如帶有 *lineno* 則繼續執行,直到到達列號大於或等於 *lineno* 的那一列。在這兩" "種情況下,目前 frame 回傳時也會停止。" -#: ../../library/pdb.rst:456 +#: ../../library/pdb.rst:465 msgid "Allow giving an explicit line number." msgstr "允許明確給定一個列號。" -#: ../../library/pdb.rst:461 +#: ../../library/pdb.rst:470 msgid "Continue execution until the current function returns." msgstr "繼續執行,直到目前的函式回傳。" -#: ../../library/pdb.rst:465 +#: ../../library/pdb.rst:474 msgid "Continue execution, only stop when a breakpoint is encountered." msgstr "繼續執行,除非遇到斷點才停下來。" -#: ../../library/pdb.rst:469 +#: ../../library/pdb.rst:478 msgid "" "Set the next line that will be executed. Only available in the bottom-most " "frame. This lets you jump back and execute code again, or jump forward to " @@ -828,7 +835,7 @@ msgstr "" "設定即將執行的下一列,僅可用於堆疊中最底部的 frame。這讓你可以跳回去並再次執" "行程式碼,或者往前跳以跳過不想執行的程式碼。" -#: ../../library/pdb.rst:473 +#: ../../library/pdb.rst:482 msgid "" "It should be noted that not all jumps are allowed -- for instance it is not " "possible to jump into the middle of a :keyword:`for` loop or out of " @@ -837,7 +844,7 @@ msgstr "" "需要注意的是,不是所有的跳轉都是被允許的 -- 例如不能跳轉到 :keyword:`for` 迴" "圈的中間或跳出 :keyword:`finally` 子句。" -#: ../../library/pdb.rst:479 +#: ../../library/pdb.rst:488 msgid "" "List source code for the current file. Without arguments, list 11 lines " "around the current line or continue the previous listing. With ``.`` as " @@ -850,7 +857,7 @@ msgstr "" "列出那一列周圍的 11 列。如果帶有兩個引數,則列出給定範圍中的程式碼;如果第二" "個引數小於第一個引數,則將其直譯為要列出的列數。" -#: ../../library/pdb.rst:485 +#: ../../library/pdb.rst:494 msgid "" "The current line in the current frame is indicated by ``->``. If an " "exception is being debugged, the line where the exception was originally " @@ -860,26 +867,26 @@ msgstr "" "目前 frame 中的目前列會用 ``->`` 標記出來。如果正在偵錯一個例外,且引發或傳遞" "該例外的那一列不是目前列,則會用 ``>>`` 來標記該列。" -#: ../../library/pdb.rst:490 +#: ../../library/pdb.rst:499 msgid "Added the ``>>`` marker." msgstr "新增了 ``>>`` 標記。" -#: ../../library/pdb.rst:495 +#: ../../library/pdb.rst:504 msgid "" "List all source code for the current function or frame. Interesting lines " "are marked as for :pdbcmd:`list`." msgstr "" "列出目前函式或 frame 的所有原始碼。相關列的標記方式與 :pdbcmd:`list` 相同。" -#: ../../library/pdb.rst:502 +#: ../../library/pdb.rst:511 msgid "Print the arguments of the current function and their current values." msgstr "印出目前函式的引數及它們目前的值。" -#: ../../library/pdb.rst:506 +#: ../../library/pdb.rst:515 msgid "Evaluate *expression* in the current context and print its value." msgstr "在目前情境中為 *expression* 求值並印出其值。" -#: ../../library/pdb.rst:510 +#: ../../library/pdb.rst:519 msgid "" "``print()`` can also be used, but is not a debugger command --- this " "executes the Python :func:`print` function." @@ -887,7 +894,7 @@ msgstr "" "也可以使用 ``print()``,但它不是一個偵錯器命令 --- 它會執行 " "Python :func:`print` 函式。" -#: ../../library/pdb.rst:516 +#: ../../library/pdb.rst:525 msgid "" "Like the :pdbcmd:`p` command, except the value of *expression* is pretty-" "printed using the :mod:`pprint` module." @@ -895,26 +902,26 @@ msgstr "" "與 :pdbcmd:`p` 命令類似,除了 *expression* 的值是使用 :mod:`pprint` 模組美化" "後印出來的。" -#: ../../library/pdb.rst:521 +#: ../../library/pdb.rst:530 msgid "Print the type of *expression*." msgstr "印出 *expression* 的型別。" -#: ../../library/pdb.rst:525 +#: ../../library/pdb.rst:534 msgid "Try to get source code of *expression* and display it." msgstr "嘗試取得 *expression* 的原始碼並顯示它。" -#: ../../library/pdb.rst:531 +#: ../../library/pdb.rst:540 msgid "" "Display the value of *expression* if it changed, each time execution stops " "in the current frame." msgstr "每次在目前 frame 中停止執行時,顯示 *expression* 的值(如果有變更)。" -#: ../../library/pdb.rst:534 +#: ../../library/pdb.rst:543 msgid "" "Without *expression*, list all display expressions for the current frame." msgstr "如果不帶有 *expression*,則列出目前 frame 的所有運算式。" -#: ../../library/pdb.rst:538 +#: ../../library/pdb.rst:547 msgid "" "Display evaluates *expression* and compares to the result of the previous " "evaluation of *expression*, so when the result is mutable, display may not " @@ -923,11 +930,11 @@ msgstr "" "display 會對 *expression* 求值並將結果與之前 *expression* 的求值結果進行比" "較,因此當結果可變時,display 可能無法取得其變更。" -#: ../../library/pdb.rst:542 ../../library/pdb.rst:692 +#: ../../library/pdb.rst:551 ../../library/pdb.rst:701 msgid "Example::" msgstr "範例如下: ::" -#: ../../library/pdb.rst:544 +#: ../../library/pdb.rst:553 msgid "" "lst = []\n" "breakpoint()\n" @@ -941,7 +948,7 @@ msgstr "" "lst.append(1)\n" "print(lst)" -#: ../../library/pdb.rst:550 +#: ../../library/pdb.rst:559 msgid "" "Display won't realize ``lst`` has been changed because the result of " "evaluation is modified in place by ``lst.append(1)`` before being compared::" @@ -949,7 +956,7 @@ msgstr "" "display 不會意識到 ``lst`` 已更改,因為其求值結果在比較之前已被 " "``lst.append(1)`` 原地 (in place) 修改: ::" -#: ../../library/pdb.rst:553 +#: ../../library/pdb.rst:562 msgid "" "> example.py(3)()\n" "-> pass\n" @@ -975,11 +982,11 @@ msgstr "" "-> print(lst)\n" "(Pdb)" -#: ../../library/pdb.rst:565 +#: ../../library/pdb.rst:574 msgid "You can do some tricks with copy mechanism to make it work::" msgstr "你可以運用複製機制的一些技巧來使其能夠運作: ::" -#: ../../library/pdb.rst:567 +#: ../../library/pdb.rst:576 msgid "" "> example.py(3)()\n" "-> pass\n" @@ -1007,7 +1014,7 @@ msgstr "" "display lst[:]: [1] [old: []]\n" "(Pdb)" -#: ../../library/pdb.rst:584 +#: ../../library/pdb.rst:593 msgid "" "Do not display *expression* anymore in the current frame. Without " "*expression*, clear all display expressions for the current frame." @@ -1015,7 +1022,7 @@ msgstr "" "不再顯示目前 frame 中的 *expression*。如果不帶有 *expression*,則清除目前 " "frame 的所有顯示運算式。" -#: ../../library/pdb.rst:591 +#: ../../library/pdb.rst:600 msgid "" "Start an interactive interpreter (using the :mod:`code` module) in a new " "global namespace initialised from the local and global namespaces for the " @@ -1026,7 +1033,7 @@ msgstr "" "(使用 :mod:`code` 模組)。可使用 ``exit()`` 或 ``quit()`` 退出直譯器並回到偵" "錯器。" -#: ../../library/pdb.rst:598 +#: ../../library/pdb.rst:607 msgid "" "As ``interact`` creates a new dedicated namespace for code execution, " "assignments to variables will not affect the original namespaces. However, " @@ -1037,12 +1044,12 @@ msgstr "" "影響原始命名空間,但是對任何被參照的可變物件的修改將像往常一樣反映在原始命名" "空間中。" -#: ../../library/pdb.rst:605 +#: ../../library/pdb.rst:614 msgid "" "``exit()`` and ``quit()`` can be used to exit the :pdbcmd:`interact` command." msgstr "``exit()`` 和 ``quit()`` 可用來退出 :pdbcmd:`interact` 命令。" -#: ../../library/pdb.rst:609 +#: ../../library/pdb.rst:618 msgid "" ":pdbcmd:`interact` directs its output to the debugger's output channel " "rather than :data:`sys.stderr`." @@ -1050,7 +1057,7 @@ msgstr "" ":pdbcmd:`interact` 將其輸出導向到偵錯器的輸出通道 (output channel),而不" "是 :data:`sys.stderr`。" -#: ../../library/pdb.rst:617 +#: ../../library/pdb.rst:626 msgid "" "Create an alias called *name* that executes *command*. The *command* must " "*not* be enclosed in quotes. Replaceable parameters can be indicated by " @@ -1063,7 +1070,7 @@ msgstr "" "有參數替換。如果省略 *command*,則顯示 *name* 的目前別名。如果未給定引數,則" "列出所有別名。" -#: ../../library/pdb.rst:623 +#: ../../library/pdb.rst:632 msgid "" "Aliases may be nested and can contain anything that can be legally typed at " "the pdb prompt. Note that internal pdb commands *can* be overridden by " @@ -1075,14 +1082,14 @@ msgstr "" "部 pdb 命令\\ *可以*\\ 被別名所覆蓋。這樣的命令在別名被移除前都將被隱藏。別名" "會遞迴地應用到命令列的第一個單詞;該列內的其他單詞則不會受影響。" -#: ../../library/pdb.rst:629 +#: ../../library/pdb.rst:638 msgid "" "As an example, here are two useful aliases (especially when placed in " "the :file:`.pdbrc` file)::" msgstr "" "作為範例,這裡列出了兩個有用的別名(特別是放在 :file:`.pdbrc` 檔案中時): ::" -#: ../../library/pdb.rst:632 +#: ../../library/pdb.rst:641 msgid "" "# Print instance variables (usage \"pi classInst\")\n" "alias pi for k in %1.__dict__.keys(): print(f\"%1.{k} = {%1.__dict__[k]}\")\n" @@ -1094,11 +1101,11 @@ msgstr "" "# 印出 self 中的實例變數\n" "alias ps pi self" -#: ../../library/pdb.rst:639 +#: ../../library/pdb.rst:648 msgid "Delete the specified alias *name*." msgstr "刪除指定的別名 *name*。" -#: ../../library/pdb.rst:643 +#: ../../library/pdb.rst:652 msgid "" "Execute the (one-line) *statement* in the context of the current stack " "frame. The exclamation point can be omitted unless the first word of the " @@ -1107,7 +1114,7 @@ msgstr "" "在目前 stack frame 的情境中執行(單列)\\ *statement*。除非陳述式的第一個單詞" "類似於偵錯器命令,否則可以省略驚嘆號,例如:" -#: ../../library/pdb.rst:647 +#: ../../library/pdb.rst:656 msgid "" "(Pdb) ! n=42\n" "(Pdb)" @@ -1115,7 +1122,7 @@ msgstr "" "(Pdb) ! n=42\n" "(Pdb)" -#: ../../library/pdb.rst:652 +#: ../../library/pdb.rst:661 msgid "" "To set a global variable, you can prefix the assignment command with " "a :keyword:`global` statement on the same line, e.g.:" @@ -1123,7 +1130,7 @@ msgstr "" "要設定全域變數,你可以在同一列的賦值命令前面加上 :keyword:`global` 陳述式,例" "如:" -#: ../../library/pdb.rst:655 +#: ../../library/pdb.rst:664 msgid "" "(Pdb) global list_options; list_options = ['-l']\n" "(Pdb)" @@ -1131,7 +1138,7 @@ msgstr "" "(Pdb) global list_options; list_options = ['-l']\n" "(Pdb)" -#: ../../library/pdb.rst:663 +#: ../../library/pdb.rst:672 msgid "" "Restart the debugged Python program. If *args* is supplied, it is split " "with :mod:`shlex` and the result is used as the new :data:`sys.argv`. " @@ -1142,11 +1149,11 @@ msgstr "" "割,並將結果用作新的 :data:`sys.argv`。歷史記錄、斷點、操作和偵錯器選項均會被" "保留。:pdbcmd:`restart` 是 :pdbcmd:`run` 的別名。" -#: ../../library/pdb.rst:670 +#: ../../library/pdb.rst:679 msgid "Quit from the debugger. The program being executed is aborted." msgstr "離開偵錯器,執行中的程式會被中止。" -#: ../../library/pdb.rst:674 +#: ../../library/pdb.rst:683 msgid "" "Enter a recursive debugger that steps through *code* (which is an arbitrary " "expression or statement to be executed in the current environment)." @@ -1154,26 +1161,26 @@ msgstr "" "進入一個遞迴偵錯器,逐步執行 *code*\\ (這是要在目前環境中執行的任意運算式或" "陳述式)。" -#: ../../library/pdb.rst:680 +#: ../../library/pdb.rst:689 msgid "Print the return value for the last return of the current function." msgstr "印出目前函式最後一次回傳的回傳值。" -#: ../../library/pdb.rst:684 +#: ../../library/pdb.rst:693 msgid "List or jump between chained exceptions." msgstr "列出鏈接例外 (chained exceptions),或在其間跳轉。" -#: ../../library/pdb.rst:686 +#: ../../library/pdb.rst:695 msgid "" "When using ``pdb.pm()`` or ``Pdb.post_mortem(...)`` with a chained " "exception instead of a traceback, it allows the user to move between the " "chained exceptions using ``exceptions`` command to list exceptions, and " -"``exception `` to switch to that exception." +"``exceptions `` to switch to that exception." msgstr "" "當使用 ``pdb.pm()`` 或 ``Pdb.post_mortem(...)`` 於鏈接例外而不是回溯時,它允" "許使用者在鏈接例外之間移動,使用 ``exceptions`` 命令以列出例外,並使用 " -"``exception `` 切換到該例外。" +"``exceptions `` 切換到該例外。" -#: ../../library/pdb.rst:694 +#: ../../library/pdb.rst:703 msgid "" "def out():\n" " try:\n" @@ -1209,11 +1216,11 @@ msgstr "" "\n" " out()" -#: ../../library/pdb.rst:711 +#: ../../library/pdb.rst:720 msgid "calling ``pdb.pm()`` will allow to move between exceptions::" msgstr "呼叫 ``pdb.pm()`` 將允許在例外之間移動: ::" -#: ../../library/pdb.rst:713 +#: ../../library/pdb.rst:722 msgid "" "> example.py(5)out()\n" "-> raise ValueError(\"reraise middle() error\") from e\n" @@ -1247,11 +1254,11 @@ msgstr "" "> example.py(10)middle()\n" "-> return inner(0)" -#: ../../library/pdb.rst:732 +#: ../../library/pdb.rst:741 msgid "Footnotes" msgstr "註腳" -#: ../../library/pdb.rst:733 +#: ../../library/pdb.rst:742 msgid "" "Whether a frame is considered to originate in a certain module is determined " "by the ``__name__`` in the frame globals." @@ -1279,18 +1286,21 @@ msgstr "bdb" msgid "cmd" msgstr "cmd" -#: ../../library/pdb.rst:297 +#: ../../library/pdb.rst:306 msgid ".pdbrc" msgstr ".pdbrc" -#: ../../library/pdb.rst:297 +#: ../../library/pdb.rst:306 msgid "file" msgstr "file(檔案)" -#: ../../library/pdb.rst:297 +#: ../../library/pdb.rst:306 msgid "debugger" msgstr "debugger(偵錯器)" -#: ../../library/pdb.rst:297 +#: ../../library/pdb.rst:306 msgid "configuration" msgstr "configuration(設定)" + +#~ msgid "python -m pdb myscript.py" +#~ msgstr "python -m pdb myscript.py" diff --git a/library/persistence.po b/library/persistence.po index b655269a25..7e6edefbbd 100644 --- a/library/persistence.po +++ b/library/persistence.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -30,6 +29,10 @@ msgid "" "objects from the bytes. The various DBM-related modules support a family of " "hash-based file formats that store a mapping of strings to other strings." msgstr "" +"本章節所描述的模組支援將 Python 資料以持久形式儲存在磁碟上。:mod:`pickle` " +"和 :mod:`marshal` 模組可以將許多 Python 資料型別轉換為位元串流,然後再從位元" +"串流重建物件。各種與 DBM 有關的模組支援一系列基於雜湊的檔案格式,用來儲存字串" +"對字串的對映。" #: ../../library/persistence.rst:13 msgid "The list of modules described in this chapter is:" diff --git a/library/pickle.po b/library/pickle.po index c9791e8e2a..5c8035fb3f 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -39,9 +39,9 @@ msgid "" "The :mod:`pickle` module implements binary protocols for serializing and de-" "serializing a Python object structure. *\"Pickling\"* is the process " "whereby a Python object hierarchy is converted into a byte stream, and " -"*\"unpickling\"* is the inverse operation, whereby a byte stream (from a :" -"term:`binary file` or :term:`bytes-like object`) is converted back into an " -"object hierarchy. Pickling (and unpickling) is alternatively known as " +"*\"unpickling\"* is the inverse operation, whereby a byte stream (from " +"a :term:`binary file` or :term:`bytes-like object`) is converted back into " +"an object hierarchy. Pickling (and unpickling) is alternatively known as " "\"serialization\", \"marshalling,\" [#]_ or \"flattening\"; however, to " "avoid confusion, the terms used here are \"pickling\" and \"unpickling\"." msgstr "" @@ -55,7 +55,7 @@ msgstr "" #: ../../library/pickle.rst:33 msgid "The ``pickle`` module **is not secure**. Only unpickle data you trust." -msgstr "``pickle`` 模組**並不安全**,切記只拆封你信任的資料。" +msgstr "``pickle`` 模組\\ **並不安全**,切記只拆封你信任的資料。" #: ../../library/pickle.rst:35 msgid "" @@ -63,8 +63,8 @@ msgid "" "arbitrary code during unpickling**. Never unpickle data that could have come " "from an untrusted source, or that could have been tampered with." msgstr "" -"pickle 封包是有可能被建立來在拆封的時候**執行任意惡意程式碼**的。絕對不要拆封" -"任何你無法信任其來源、或可能被修改過的 pickle 封包。" +"pickle 封包是有可能被建立來在拆封的時候\\ **執行任意惡意程式碼**\\ 的。絕對不" +"要拆封任何你無法信任其來源、或可能被修改過的 pickle 封包。" #: ../../library/pickle.rst:39 msgid "" @@ -92,12 +92,12 @@ msgstr "和 ``marshal`` 的比較" msgid "" "Python has a more primitive serialization module called :mod:`marshal`, but " "in general :mod:`pickle` should always be the preferred way to serialize " -"Python objects. :mod:`marshal` exists primarily to support Python's :file:`." -"pyc` files." +"Python objects. :mod:`marshal` exists primarily to support " +"Python's :file:`.pyc` files." msgstr "" "Python 有另一個比較原始的序列化模組叫 :mod:`marshal`,不過其設計目的是為了支" -"援 Python 的預編譯功能 :file:`.pyc` 的運作。總地來說,請盡可能地使用 :mod:" -"`pickle`,沒事不要用 :mod:`marshal`。" +"援 Python 的預編譯功能 :file:`.pyc` 的運作。總地來說,請盡可能地使" +"用 :mod:`pickle`,沒事不要用 :mod:`marshal`。" #: ../../library/pickle.rst:57 msgid "" @@ -128,9 +128,9 @@ msgid "" msgstr "" "這對遞迴物件和物件共用都有影響。遞迴物件是指包含自我參照的物件。這些情況在 " "marshal 模組中不會被處理,若嘗試使用 marshal 處理遞迴物件會導致 Python 直譯器" -"崩潰。物件共用發生在序列化的物件階層中、不同位置對同一物件有多個參照時。:mod:" -"`pickle` 只會儲存這個被參照的物件一次,並確保所有其他參照指向這個主要的版本。" -"共用的物件會保持共用,這對於可變(mutable)物件來說非常重要。" +"崩潰。物件共用發生在序列化的物件階層中、不同位置對同一物件有多個參照" +"時。:mod:`pickle` 只會儲存這個被參照的物件一次,並確保所有其他參照指向這個主" +"要的版本。共用的物件會保持共用,這對於可變(mutable)物件來說非常重要。" #: ../../library/pickle.rst:72 msgid "" @@ -146,14 +146,14 @@ msgstr "" #: ../../library/pickle.rst:77 msgid "" "The :mod:`marshal` serialization format is not guaranteed to be portable " -"across Python versions. Because its primary job in life is to support :file:" -"`.pyc` files, the Python implementers reserve the right to change the " -"serialization format in non-backwards compatible ways should the need arise. " -"The :mod:`pickle` serialization format is guaranteed to be backwards " -"compatible across Python releases provided a compatible pickle protocol is " -"chosen and pickling and unpickling code deals with Python 2 to Python 3 type " -"differences if your data is crossing that unique breaking change language " -"boundary." +"across Python versions. Because its primary job in life is to " +"support :file:`.pyc` files, the Python implementers reserve the right to " +"change the serialization format in non-backwards compatible ways should the " +"need arise. The :mod:`pickle` serialization format is guaranteed to be " +"backwards compatible across Python releases provided a compatible pickle " +"protocol is chosen and pickling and unpickling code deals with Python 2 to " +"Python 3 type differences if your data is crossing that unique breaking " +"change language boundary." msgstr "" ":mod:`marshal` 序列化格式無法保證能在不同版本的 Python 之間移植。因為其主要的" "作用是支援 :file:`.pyc` 檔案的運作,Python 的實作人員會在需要時實作無法前向相" @@ -205,8 +205,8 @@ msgid "" "JSON, by default, can only represent a subset of the Python built-in types, " "and no custom classes; pickle can represent an extremely large number of " "Python types (many of them automatically, by clever usage of Python's " -"introspection facilities; complex cases can be tackled by implementing :ref:" -"`specific object APIs `);" +"introspection facilities; complex cases can be tackled by " +"implementing :ref:`specific object APIs `);" msgstr "" "預設狀態下的 JSON 只能紀錄一小部份的 Python 內建型別,且無法紀錄自訂類別;但" "透過 Python 的自省措施,pickle 可以紀錄絕大多數的 Python 型別(其他比較複雜的" @@ -258,8 +258,9 @@ msgid "" "generated by :mod:`pickle`. :mod:`pickletools` source code has extensive " "comments about opcodes used by pickle protocols." msgstr "" -":mod:`pickletools` 含有工具可分析 :mod:`pickle` 所產生的資料流。:mod:" -"`pickletools` 的源始碼詳細地記載了所有 pickle 協定的操作碼(opcode)。" +":mod:`pickletools` 含有工具可分析 :mod:`pickle` 所產生的資料" +"流。:mod:`pickletools` 的源始碼詳細地記載了所有 pickle 協定的操作碼" +"(opcode)。" #: ../../library/pickle.rst:139 msgid "" @@ -295,9 +296,9 @@ msgstr "" #: ../../library/pickle.rst:153 msgid "" -"Protocol version 3 was added in Python 3.0. It has explicit support for :" -"class:`bytes` objects and cannot be unpickled by Python 2.x. This was the " -"default protocol in Python 3.0--3.7." +"Protocol version 3 was added in Python 3.0. It has explicit support " +"for :class:`bytes` objects and cannot be unpickled by Python 2.x. This was " +"the default protocol in Python 3.0--3.7." msgstr "" "版本 3 的協定在 Python 3.0 被新增。現在能支援封裝 :class:`bytes` 的物件且無法" "被 2.x 版本的 Python 拆封。在 3.0~3.7 的 Python 預設使用 3 版協定。" @@ -331,9 +332,9 @@ msgstr "" # persistence-layer/ #: ../../library/pickle.rst:168 msgid "" -"Serialization is a more primitive notion than persistence; although :mod:" -"`pickle` reads and writes file objects, it does not handle the issue of " -"naming persistent objects, nor the (even more complicated) issue of " +"Serialization is a more primitive notion than persistence; " +"although :mod:`pickle` reads and writes file objects, it does not handle the " +"issue of naming persistent objects, nor the (even more complicated) issue of " "concurrent access to persistent objects. The :mod:`pickle` module can " "transform a complex object into a byte stream and it can transform the byte " "stream into an object with the same internal structure. Perhaps the most " @@ -357,15 +358,15 @@ msgstr "模組介面" #: ../../library/pickle.rst:183 msgid "" "To serialize an object hierarchy, you simply call the :func:`dumps` " -"function. Similarly, to de-serialize a data stream, you call the :func:" -"`loads` function. However, if you want more control over serialization and " -"de-serialization, you can create a :class:`Pickler` or an :class:`Unpickler` " -"object, respectively." +"function. Similarly, to de-serialize a data stream, you call " +"the :func:`loads` function. However, if you want more control over " +"serialization and de-serialization, you can create a :class:`Pickler` or " +"an :class:`Unpickler` object, respectively." msgstr "" "想要序列化一個物件,你只需要呼叫 :func:`dumps` 函式。而當你想要去序列化一個資" "料流時,你只需要呼叫 :func:`loads` 即可。不過,若你希望能各自對序列化和去序列" -"化的過程中有更多的掌控度,你可以自訂一個 :class:`Pickler` 或 :class:" -"`Unpickler` 物件。" +"化的過程中有更多的掌控度,你可以自訂一個 :class:`Pickler` " +"或 :class:`Unpickler` 物件。" #: ../../library/pickle.rst:188 msgid "The :mod:`pickle` module provides the following constants:" @@ -374,12 +375,13 @@ msgstr ":mod:`pickle` 模組提供以下常數:" #: ../../library/pickle.rst:193 msgid "" "An integer, the highest :ref:`protocol version ` " -"available. This value can be passed as a *protocol* value to functions :" -"func:`dump` and :func:`dumps` as well as the :class:`Pickler` constructor." +"available. This value can be passed as a *protocol* value to " +"functions :func:`dump` and :func:`dumps` as well as the :class:`Pickler` " +"constructor." msgstr "" "一個整數,表示可使用的最高\\ :ref:`協定版本 `。這個值可作" -"為 *protocol* 的數值傳給 :func:`dump` 和 :func:`dumps` 函式以及 :class:" -"`Pickler` 建構式。" +"為 *protocol* 的數值傳給 :func:`dump` 和 :func:`dumps` 函式以" +"及 :class:`Pickler` 建構式。" #: ../../library/pickle.rst:200 msgid "" @@ -419,8 +421,8 @@ msgid "" "Arguments *file*, *protocol*, *fix_imports* and *buffer_callback* have the " "same meaning as in the :class:`Pickler` constructor." msgstr "" -"引數 *file*、*protocol*、*fix_imports* 和 *buffer_callback* 的意義與 :class:" -"`Pickler` 建構式中的相同。" +"引數 *file*、*protocol*、*fix_imports* 和 *buffer_callback* 的意義" +"與 :class:`Pickler` 建構式中的相同。" #: ../../library/pickle.rst:225 ../../library/pickle.rst:236 #: ../../library/pickle.rst:328 @@ -440,8 +442,8 @@ msgid "" "Arguments *protocol*, *fix_imports* and *buffer_callback* have the same " "meaning as in the :class:`Pickler` constructor." msgstr "" -"引數 *protocol*、*fix_imports* 和 *buffer_callback* 的意義和 :class:" -"`Pickler` 建構式中的相同。" +"引數 *protocol*、*fix_imports* 和 *buffer_callback* 的意義" +"和 :class:`Pickler` 建構式中的相同。" #: ../../library/pickle.rst:241 msgid "" @@ -487,8 +489,8 @@ msgid "" "Arguments *fix_imports*, *encoding*, *errors*, *strict* and *buffers* have " "the same meaning as in the :class:`Unpickler` constructor." msgstr "" -"引數 *fix_imports*、*encoding*、*errors*、*strict* 和 *buffers* 的意義與 :" -"class:`Unpickler` 建構式所用的相同。" +"引數 *fix_imports*、*encoding*、*errors*、*strict* 和 *buffers* 的意義" +"與 :class:`Unpickler` 建構式所用的相同。" #: ../../library/pickle.rst:271 msgid "The :mod:`pickle` module defines three exceptions:" @@ -496,8 +498,8 @@ msgstr ":mod:`pickle` 模組定義了以下三種例外:" #: ../../library/pickle.rst:275 msgid "" -"Common base class for the other pickling exceptions. It inherits from :exc:" -"`Exception`." +"Common base class for the other pickling exceptions. It inherits " +"from :exc:`Exception`." msgstr "" "繼承 :exc:`Exception` 類別。一個在封裝或拆封時遭遇其他例外時通用的基底類別。" @@ -520,8 +522,8 @@ msgid "" "Error raised when there is a problem unpickling an object, such as a data " "corruption or a security violation. It inherits from :exc:`PickleError`." msgstr "" -"拆封物件時遇到問題(如資料毀損或違反安全性原則等)所引發的意外。繼承自 :exc:" -"`PickleError` 類別。" +"拆封物件時遇到問題(如資料毀損或違反安全性原則等)所引發的意外。繼承" +"自 :exc:`PickleError` 類別。" #: ../../library/pickle.rst:291 msgid "" @@ -534,11 +536,11 @@ msgstr "" #: ../../library/pickle.rst:296 msgid "" -"The :mod:`pickle` module exports three classes, :class:`Pickler`, :class:" -"`Unpickler` and :class:`PickleBuffer`:" +"The :mod:`pickle` module exports three " +"classes, :class:`Pickler`, :class:`Unpickler` and :class:`PickleBuffer`:" msgstr "" -"引入模組 :mod:`pickle` 時會帶來三個類別::class:`Pickler`、:class:" -"`Unpickler` 和 :class:`PickleBuffer`:" +"引入模組 :mod:`pickle` 時會帶來三個類" +"別::class:`Pickler`、:class:`Unpickler` 和 :class:`PickleBuffer`:" #: ../../library/pickle.rst:301 msgid "This takes a binary file for writing a pickle data stream." @@ -552,14 +554,15 @@ msgid "" "number is specified, :data:`HIGHEST_PROTOCOL` is selected." msgstr "" "可選引數 *protocol* 接受整數,用來要求封裝器(pickler)使用指定的協定;支援" -"從 0 版起到 :data:`HIGHEST_PROTOCOL` 版的協定。如未指定,則預設為 :data:" -"`DEFAULT_PROTOCOL`。若指定了負數,則視為選擇 :data:`HIGHEST_PROTOCOL`。" +"從 0 版起到 :data:`HIGHEST_PROTOCOL` 版的協定。如未指定,則預設" +"為 :data:`DEFAULT_PROTOCOL`。若指定了負數,則視為選" +"擇 :data:`HIGHEST_PROTOCOL`。" #: ../../library/pickle.rst:308 msgid "" "The *file* argument must have a write() method that accepts a single bytes " -"argument. It can thus be an on-disk file opened for binary writing, an :" -"class:`io.BytesIO` instance, or any other custom object that meets this " +"argument. It can thus be an on-disk file opened for binary writing, " +"an :class:`io.BytesIO` instance, or any other custom object that meets this " "interface." msgstr "" "引數 *file* 必須支援可寫入單一位元組引數的 write() 方法。只要滿足此條件,傳入" @@ -639,8 +642,8 @@ msgstr "關於細節與用法範例請見 :ref:`pickle-persistent`。" #: ../../library/pickle.rst:348 msgid "" -"Add the default implementation of this method in the C implementation of :" -"class:`!Pickler`." +"Add the default implementation of this method in the C implementation " +"of :class:`!Pickler`." msgstr "在 C 的 :class:`!Pickler` 實作中的增加了這個方法的預設實作。" # SkyLull: [T] @@ -666,12 +669,12 @@ msgstr "" #: ../../library/pickle.rst:362 msgid "" "By default, a pickler object will not have a :attr:`dispatch_table` " -"attribute, and it will instead use the global dispatch table managed by the :" -"mod:`copyreg` module. However, to customize the pickling for a specific " +"attribute, and it will instead use the global dispatch table managed by " +"the :mod:`copyreg` module. However, to customize the pickling for a specific " "pickler object one can set the :attr:`dispatch_table` attribute to a dict-" -"like object. Alternatively, if a subclass of :class:`Pickler` has a :attr:" -"`dispatch_table` attribute then this will be used as the default dispatch " -"table for instances of that class." +"like object. Alternatively, if a subclass of :class:`Pickler` has " +"a :attr:`dispatch_table` attribute then this will be used as the default " +"dispatch table for instances of that class." msgstr "" "預設情況下,封裝器(pickler)物件不會有 :attr:`dispatch_table` 屬性,而是會使" "用由 :mod:`copyreg` 模組管理的全域調度表。不過,若要自訂某個封裝器(pickler)" @@ -688,14 +691,14 @@ msgid "" "Special reducer that can be defined in :class:`Pickler` subclasses. This " "method has priority over any reducer in the :attr:`dispatch_table`. It " "should conform to the same interface as a :meth:`~object.__reduce__` method, " -"and can optionally return :data:`NotImplemented` to fallback on :attr:" -"`dispatch_table`-registered reducers to pickle ``obj``." +"and can optionally return :data:`NotImplemented` to fallback " +"on :attr:`dispatch_table`-registered reducers to pickle ``obj``." msgstr "" "一個可以在 :class:`Pickler` 子類別中被定義的縮減器(reducer)。這個方法的優先" -"度高於任何其他 :attr:`分派表 ` 中的縮減器。他應該要有和 :" -"meth:`~object.__reduce__` 方法相同的函式介面,且可以可選地回傳 :data:" -"`NotImplemented` 以退回(fallback)使用 :attr:`分派表 ` 中登" -"錄的縮減方法來封裝 ``obj``。" +"度高於任何其他 :attr:`分派表 ` 中的縮減器。他應該要有" +"和 :meth:`~object.__reduce__` 方法相同的函式介面,且可以可選地回" +"傳 :data:`NotImplemented` 以退回(fallback)使用 :attr:`分派表 " +"` 中登錄的縮減方法來封裝 ``obj``。" #: ../../library/pickle.rst:383 msgid "For a detailed example, see :ref:`reducer_override`." @@ -730,15 +733,15 @@ msgstr "協定版本號會被自動偵測,所以不需要在這邊手動輸入 msgid "" "The argument *file* must have three methods, a read() method that takes an " "integer argument, a readinto() method that takes a buffer argument and a " -"readline() method that requires no arguments, as in the :class:`io." -"BufferedIOBase` interface. Thus *file* can be an on-disk file opened for " -"binary reading, an :class:`io.BytesIO` object, or any other custom object " -"that meets this interface." +"readline() method that requires no arguments, as in " +"the :class:`io.BufferedIOBase` interface. Thus *file* can be an on-disk " +"file opened for binary reading, an :class:`io.BytesIO` object, or any other " +"custom object that meets this interface." msgstr "" "參數 *file* 必須擁有三個方法,分別是接受整數作為引數的 read() 方法、接受緩衝" -"區作為引數的 readinto() 方法以及不需要引數的 readline() 方法,如同在 :class:" -"`io.BufferedIOBase` 的介面一樣。因此,*file* 可以是一個以二進位讀取模式開啟的" -"檔案、一個 :class:`io.BytesIO` 物件、或任何符合此介面的自訂物件。" +"區作為引數的 readinto() 方法以及不需要引數的 readline() 方法,如同" +"在 :class:`io.BufferedIOBase` 的介面一樣。因此,*file* 可以是一個以二進位讀取" +"模式開啟的檔案、一個 :class:`io.BytesIO` 物件、或任何符合此介面的自訂物件。" #: ../../library/pickle.rst:412 msgid "" @@ -749,18 +752,18 @@ msgid "" "decode 8-bit string instances pickled by Python 2; these default to 'ASCII' " "and 'strict', respectively. The *encoding* can be 'bytes' to read these 8-" "bit string instances as bytes objects. Using ``encoding='latin1'`` is " -"required for unpickling NumPy arrays and instances of :class:`~datetime." -"datetime`, :class:`~datetime.date` and :class:`~datetime.time` pickled by " -"Python 2." +"required for unpickling NumPy arrays and instances " +"of :class:`~datetime.datetime`, :class:`~datetime.date` " +"and :class:`~datetime.time` pickled by Python 2." msgstr "" "可選引數 *fix_imports*、*encoding* 和 *errors* 用來控制 Python 2 pickle 資料" "的相容性支援。如果 *fix_imports* 為 true,則 pickle 模組會嘗試將舊的 Python " "2 模組名稱映射到 Python 3 中使用的新名稱。*encoding* 和 *errors* 告訴 pickle " "模組如何解碼由 Python 2 pickle 封裝的 8 位元字串實例;*encoding* 和 *errors* " "預設分別為 'ASCII' 和 'strict'。*encoding* 可以設定為 'bytes' 以將這些 8 位元" -"字串實例讀為位元組物件。而由 Python 2 封裝的 NumPy 陣列、:class:`~datetime." -"datetime`、:class:`~datetime.date` 和 :class:`~datetime.time` 的實例則必須使" -"用 ``encoding='latin1'`` 來拆封。" +"字串實例讀為位元組物件。而由 Python 2 封裝的 NumPy 陣" +"列、:class:`~datetime.datetime`、:class:`~datetime.date` " +"和 :class:`~datetime.time` 的實例則必須使用 ``encoding='latin1'`` 來拆封。" #: ../../library/pickle.rst:423 msgid "" @@ -801,17 +804,17 @@ msgstr "預設會引發 :exc:`UnpicklingError` 例外。" #: ../../library/pickle.rst:447 msgid "" "If defined, :meth:`persistent_load` should return the object specified by " -"the persistent ID *pid*. If an invalid persistent ID is encountered, an :" -"exc:`UnpicklingError` should be raised." +"the persistent ID *pid*. If an invalid persistent ID is encountered, " +"an :exc:`UnpicklingError` should be raised." msgstr "" -"若有定義 :meth:`persistent_load`,則其將回傳符合持久化識別碼 `pid` 的物件。如" +"若有定義,則 :meth:`persistent_load` 將回傳符合持久化識別碼 *pid* 的物件。如" "果遭遇了無效的持久化識別碼,則會引發 :exc:`UnpicklingError`。" #: ../../library/pickle.rst:453 msgid "" -"Add the default implementation of this method in the C implementation of :" -"class:`!Unpickler`." -msgstr "" +"Add the default implementation of this method in the C implementation " +"of :class:`!Unpickler`." +msgstr "在 C 的 :class:`!Unpickler` 實作中的增加了這個方法的預設實作。" #: ../../library/pickle.rst:459 msgid "" @@ -820,15 +823,15 @@ msgid "" "unlike its name suggests, :meth:`find_class` is also used for finding " "functions." msgstr "" -"如有需要將引入 *module* ,並從中回傳名為 *name* 的物件,這裡的 *module* 和 " -"*name* 引數接受的輸入是 :class:`str` 物件。注意,雖然名稱上看起來不像,但 :" -"meth:`find_class` 亦可被用於尋找其他函式。" +"如有需要將引入 *module*,並從中回傳名為 *name* 的物件,這裡的 *module* 和 " +"*name* 引數接受的輸入是 :class:`str` 物件。注意,雖然名稱上看起來不像," +"但 :meth:`find_class` 亦可被用於尋找其他函式。" #: ../../library/pickle.rst:464 msgid "" "Subclasses may override this to gain control over what type of objects and " -"how they can be loaded, potentially reducing security risks. Refer to :ref:" -"`pickle-restrict` for details." +"how they can be loaded, potentially reducing security risks. Refer " +"to :ref:`pickle-restrict` for details." msgstr "" "子類別可以覆寫此方法以控制可以載入哪些類型的物件、以及如何載入它們,從而潛在" "地降低安全性風險。詳情請參考\\ :ref:`pickle-restrict`。" @@ -842,13 +845,13 @@ msgstr "" "``pickle.find_class``。" # SkyLull: [T] -# 參見 #729 +# 參見 #729 # wrapper -> 包裝器 #: ../../library/pickle.rst:472 msgid "" -"A wrapper for a buffer representing picklable data. *buffer* must be a :ref:" -"`buffer-providing ` object, such as a :term:`bytes-like " -"object` or a N-dimensional array." +"A wrapper for a buffer representing picklable data. *buffer* must be " +"a :ref:`buffer-providing ` object, such as a :term:`bytes-" +"like object` or a N-dimensional array." msgstr "" "一個表示了含有可封裝資料緩衝區的包裝函式(wrapper function)。*buffer* 必須是" "一個 :ref:`提供緩衝區 ` 的物件,例如一個 :term:`類位元組物件 " @@ -857,8 +860,8 @@ msgstr "" #: ../../library/pickle.rst:476 msgid "" ":class:`PickleBuffer` is itself a buffer provider, therefore it is possible " -"to pass it to other APIs expecting a buffer-providing object, such as :class:" -"`memoryview`." +"to pass it to other APIs expecting a buffer-providing object, such " +"as :class:`memoryview`." msgstr "" ":class:`PickleBuffer` 本身就是一個提供緩衝區的物件,所以是能夠將其提供給其它" "「預期收到含有緩衝物件的 API」的,比如 :class:`memoryview`。" @@ -902,11 +905,11 @@ msgstr "下列型別可以被封裝:" #: ../../library/pickle.rst:505 msgid "" -"built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, and :data:" -"`NotImplemented`);" +"built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, " +"and :data:`NotImplemented`);" msgstr "" -"內建常數(``None``、``True``、``False``、``Ellipsis`` 和 :data:" -"`NotImplemented`);" +"內建常數(``None``、``True``、``False``、``Ellipsis`` " +"和 :data:`NotImplemented`);" #: ../../library/pickle.rst:508 msgid "integers, floating-point numbers, complex numbers;" @@ -926,8 +929,8 @@ msgid "" "functions (built-in and user-defined) accessible from the top level of a " "module (using :keyword:`def`, not :keyword:`lambda`);" msgstr "" -"在模組最表面的層級就能被存取的函式(內建或自訂的皆可,不過僅限使用 :keyword:" -"`def` 定義的函式,:keyword:`lambda` 函式不適用);" +"在模組最表面的層級就能被存取的函式(內建或自訂的皆可,不過僅限使" +"用 :keyword:`def` 定義的函式,:keyword:`lambda` 函式不適用);" #: ../../library/pickle.rst:517 msgid "classes accessible from the top level of a module;" @@ -935,8 +938,9 @@ msgstr "在模組最表面的層級就能被存取的類別;" #: ../../library/pickle.rst:519 msgid "" -"instances of such classes whose the result of calling :meth:`~object." -"__getstate__` is picklable (see section :ref:`pickle-inst` for details)." +"instances of such classes whose the result of " +"calling :meth:`~object.__getstate__` is picklable (see section :ref:`pickle-" +"inst` for details)." msgstr "" "實例,只要在呼叫了 :meth:`~object.__getstate__` 後其回傳值全都是可封裝物件。" "(詳情請參閱 :ref:`pickle-inst`)。" @@ -946,9 +950,9 @@ msgid "" "Attempts to pickle unpicklable objects will raise the :exc:`PicklingError` " "exception; when this happens, an unspecified number of bytes may have " "already been written to the underlying file. Trying to pickle a highly " -"recursive data structure may exceed the maximum recursion depth, a :exc:" -"`RecursionError` will be raised in this case. You can carefully raise this " -"limit with :func:`sys.setrecursionlimit`." +"recursive data structure may exceed the maximum recursion depth, " +"a :exc:`RecursionError` will be raised in this case. You can carefully " +"raise this limit with :func:`sys.setrecursionlimit`." msgstr "" "嘗試封裝無法封裝的物件會引發 :exc:`PicklingError` 例外;注意當這種情況發生" "時,可能已經有未知數量的位元組已被寫入到檔案。嘗試封裝深度遞迴的資料結構可能" @@ -960,11 +964,11 @@ msgstr "" # qualified name -> 限定名稱 #: ../../library/pickle.rst:529 msgid "" -"Note that functions (built-in and user-defined) are pickled by fully :term:" -"`qualified name`, not by value. [#]_ This means that only the function name " -"is pickled, along with the name of the containing module and classes. " -"Neither the function's code, nor any of its function attributes are " -"pickled. Thus the defining module must be importable in the unpickling " +"Note that functions (built-in and user-defined) are pickled by " +"fully :term:`qualified name`, not by value. [#]_ This means that only the " +"function name is pickled, along with the name of the containing module and " +"classes. Neither the function's code, nor any of its function attributes " +"are pickled. Thus the defining module must be importable in the unpickling " "environment, and the module must contain the named object, otherwise an " "exception will be raised. [#]_" msgstr "" @@ -1011,8 +1015,8 @@ msgid "" "and still load objects that were created with an earlier version of the " "class. If you plan to have long-lived objects that will see many versions " "of a class, it may be worthwhile to put a version number in the objects so " -"that suitable conversions can be made by the class's :meth:`~object." -"__setstate__` method." +"that suitable conversions can be made by the " +"class's :meth:`~object.__setstate__` method." msgstr "" "同樣地,當類別實例被封裝時,它所屬類別具有的程式碼和資料不會被一起封裝。只有" "實例資料本身會被封裝。這是有意而為的,因為如此你才可以在類別中修正錯誤或新增" @@ -1036,15 +1040,16 @@ msgstr "" msgid "" "In most cases, no additional code is needed to make instances picklable. By " "default, pickle will retrieve the class and the attributes of an instance " -"via introspection. When a class instance is unpickled, its :meth:`~object." -"__init__` method is usually *not* invoked. The default behaviour first " -"creates an uninitialized instance and then restores the saved attributes. " -"The following code shows an implementation of this behaviour::" +"via introspection. When a class instance is unpickled, " +"its :meth:`~object.__init__` method is usually *not* invoked. The default " +"behaviour first creates an uninitialized instance and then restores the " +"saved attributes. The following code shows an implementation of this " +"behaviour::" msgstr "" "大部分的實例不需要額外的程式碼就已經是可封裝的了。在這樣的預設狀況中,pickle " -"模組透過自省機制來取得類別及其實例的屬性。當類別實例被拆封時,其 :meth:" -"`~object.__init__` 方法通常*不會*被叫用。預設行為首先會建立一個未初始化的實" -"例,然後還原紀錄中的屬性。以下程式碼的實作展示了前述行為::" +"模組透過自省機制來取得類別及其實例的屬性。當類別實例被拆封時," +"其 :meth:`~object.__init__` 方法通常\\ *不會*\\ 被呼叫。預設行為首先會建立一" +"個未初始化的實例,然後還原紀錄中的屬性。以下程式碼的實作展示了前述行為: ::" #: ../../library/pickle.rst:575 msgid "" @@ -1073,12 +1078,12 @@ msgstr "" #: ../../library/pickle.rst:588 msgid "" -"In protocols 2 and newer, classes that implements the :meth:" -"`__getnewargs_ex__` method can dictate the values passed to the :meth:" -"`__new__` method upon unpickling. The method must return a pair ``(args, " -"kwargs)`` where *args* is a tuple of positional arguments and *kwargs* a " -"dictionary of named arguments for constructing the object. Those will be " -"passed to the :meth:`__new__` method upon unpickling." +"In protocols 2 and newer, classes that implements " +"the :meth:`__getnewargs_ex__` method can dictate the values passed to " +"the :meth:`__new__` method upon unpickling. The method must return a pair " +"``(args, kwargs)`` where *args* is a tuple of positional arguments and " +"*kwargs* a dictionary of named arguments for constructing the object. Those " +"will be passed to the :meth:`__new__` method upon unpickling." msgstr "" "在第 2 版協定或更新的版本中,有實作 :meth:`__getnewargs_ex__` 方法的類別,可" "以決定在拆封時要傳遞給 :meth:`__new__` 方法的值。該方法必須回傳一個 ``(args, " @@ -1105,8 +1110,8 @@ msgid "" "``args`` which will be passed to the :meth:`__new__` method upon unpickling." msgstr "" "此方法與 :meth:`__getnewargs_ex__` 的目的一樣,但僅支援位置參數。它必須回傳一" -"個由傳入引數所組成的元組(tuple)\\ ``args``,這些引數會在拆封時傳遞給 :meth:" -"`__new__` 方法。" +"個由傳入引數所組成的元組(tuple)\\ ``args``,這些引數會在拆封時傳遞" +"給 :meth:`__new__` 方法。" #: ../../library/pickle.rst:610 msgid "" @@ -1117,8 +1122,8 @@ msgstr "" #: ../../library/pickle.rst:613 msgid "" -"Before Python 3.6, :meth:`__getnewargs__` was called instead of :meth:" -"`__getnewargs_ex__` in protocols 2 and 3." +"Before Python 3.6, :meth:`__getnewargs__` was called instead " +"of :meth:`__getnewargs_ex__` in protocols 2 and 3." msgstr "" "在 Python 3.6 之前、版本 2 和版本 3 的協定中,會呼叫 :meth:`__getnewargs__` " "而非 :meth:`__getnewargs_ex__`。" @@ -1136,26 +1141,26 @@ msgstr "" #: ../../library/pickle.rst:625 msgid "" -"For a class that has no instance :attr:`~object.__dict__` and no :attr:" -"`~object.__slots__`, the default state is ``None``." +"For a class that has no instance :attr:`~object.__dict__` and " +"no :attr:`~object.__slots__`, the default state is ``None``." msgstr "" "沒有 :attr:`~object.__dict__` 和 :attr:`~object.__slots__` 實例的類別,其預設" "狀態為 ``None``。" #: ../../library/pickle.rst:628 msgid "" -"For a class that has an instance :attr:`~object.__dict__` and no :attr:" -"`~object.__slots__`, the default state is ``self.__dict__``." +"For a class that has an instance :attr:`~object.__dict__` and " +"no :attr:`~object.__slots__`, the default state is ``self.__dict__``." msgstr "" "有 :attr:`~object.__dict__` 實例、但沒有 :attr:`~object.__slots__` 實例的類" "別,其預設狀態為 ``self.__dict__``。" #: ../../library/pickle.rst:631 msgid "" -"For a class that has an instance :attr:`~object.__dict__` and :attr:`~object." -"__slots__`, the default state is a tuple consisting of two dictionaries: " -"``self.__dict__``, and a dictionary mapping slot names to slot values. Only " -"slots that have a value are included in the latter." +"For a class that has an instance :attr:`~object.__dict__` " +"and :attr:`~object.__slots__`, the default state is a tuple consisting of " +"two dictionaries: ``self.__dict__``, and a dictionary mapping slot names to " +"slot values. Only slots that have a value are included in the latter." msgstr "" "有 :attr:`~object.__dict__` 和 :attr:`~object.__slots__` 實例的類別,其預設狀" "態是一個含有兩個字典的元組(tuple),該二字典分別為 ``self.__dict__`` 本身," @@ -1164,10 +1169,10 @@ msgstr "" #: ../../library/pickle.rst:637 msgid "" -"For a class that has :attr:`~object.__slots__` and no instance :attr:" -"`~object.__dict__`, the default state is a tuple whose first item is " -"``None`` and whose second item is a dictionary mapping slot names to slot " -"values described in the previous bullet." +"For a class that has :attr:`~object.__slots__` and no " +"instance :attr:`~object.__dict__`, the default state is a tuple whose first " +"item is ``None`` and whose second item is a dictionary mapping slot names to " +"slot values described in the previous bullet." msgstr "" "沒有 :attr:`~object.__dict__` 但有 :attr:`~object.__slots__` 實例的類別,其預" "設狀態是一個二元組(tuple),元組中的第一個值是 ``None``,第二個值則是紀錄欄" @@ -1175,8 +1180,8 @@ msgstr "" #: ../../library/pickle.rst:642 msgid "" -"Added the default implementation of the ``__getstate__()`` method in the :" -"class:`object` class." +"Added the default implementation of the ``__getstate__()`` method in " +"the :class:`object` class." msgstr "在 :class:`object` 類別中增加預設的 ``__getstate__()`` 實作。" #: ../../library/pickle.rst:649 @@ -1192,61 +1197,64 @@ msgstr "" #: ../../library/pickle.rst:656 msgid "" -"If :meth:`__reduce__` returns a state with value ``None`` at pickling, the :" -"meth:`__setstate__` method will not be called upon unpickling." +"If :meth:`__reduce__` returns a state with value ``None`` at pickling, " +"the :meth:`__setstate__` method will not be called upon unpickling." msgstr "" -"如果 :meth:`__reduce__` 在封裝時回傳了 ``None`` 狀態,則拆封時就不會去呼叫 :" -"meth:`__setstate__`。" +"如果 :meth:`__reduce__` 在封裝時回傳了 ``None`` 狀態,則拆封時就不會去呼" +"叫 :meth:`__setstate__`。" #: ../../library/pickle.rst:660 msgid "" "Refer to the section :ref:`pickle-state` for more information about how to " -"use the methods :meth:`~object.__getstate__` and :meth:`~object." -"__setstate__`." +"use the methods :meth:`~object.__getstate__` " +"and :meth:`~object.__setstate__`." msgstr "" -"參閱 :ref:`pickle-state` 以了解 :meth:`~object.__getstate__` 和 :meth:" -"`~object.__setstate__` 的使用方法。" +"參閱 :ref:`pickle-state` 以了解 :meth:`~object.__getstate__` " +"和 :meth:`~object.__setstate__` 的使用方法。" #: ../../library/pickle.rst:665 msgid "" -"At unpickling time, some methods like :meth:`~object.__getattr__`, :meth:" -"`~object.__getattribute__`, or :meth:`~object.__setattr__` may be called " -"upon the instance. In case those methods rely on some internal invariant " -"being true, the type should implement :meth:`~object.__new__` to establish " -"such an invariant, as :meth:`~object.__init__` is not called when unpickling " -"an instance." +"At unpickling time, some methods " +"like :meth:`~object.__getattr__`, :meth:`~object.__getattribute__`, " +"or :meth:`~object.__setattr__` may be called upon the instance. In case " +"those methods rely on some internal invariant being true, the type should " +"implement :meth:`~object.__new__` to establish such an invariant, " +"as :meth:`~object.__init__` is not called when unpickling an instance." msgstr "" -"在拆封時,某些方法如 :meth:`~object.__getattr__`、:meth:`~object." -"__getattribute__` 或 :meth:`~object.__setattr__` 可能會在建立實例時被呼叫。如" -"果這些方法依賴了某些實例內部的不變性,則應實作 :meth:`~object.__new__` 以建立" -"此不變性,因為在拆封實例時不會呼叫 :meth:`~object.__init__`。" +"在拆封時,某些方法" +"如 :meth:`~object.__getattr__`、:meth:`~object.__getattribute__` " +"或 :meth:`~object.__setattr__` 可能會在建立實例時被呼叫。如果這些方法依賴了某" +"些實例內部的不變性,則應實作 :meth:`~object.__new__` 以建立此不變性,因為在拆" +"封實例時不會呼叫 :meth:`~object.__init__`。" #: ../../library/pickle.rst:674 msgid "" "As we shall see, pickle does not use directly the methods described above. " -"In fact, these methods are part of the copy protocol which implements the :" -"meth:`~object.__reduce__` special method. The copy protocol provides a " +"In fact, these methods are part of the copy protocol which implements " +"the :meth:`~object.__reduce__` special method. The copy protocol provides a " "unified interface for retrieving the data necessary for pickling and copying " "objects. [#]_" msgstr "" -"如稍後所演示,pickle 並不直接使用上述方法。這些方法實際上是實作了 :meth:" -"`~object.__reduce__` 特殊方法的拷貝協定(copy protocol)。拷貝協定提供了統一" -"的介面,以檢索進行封裝及複製物件時所需的資料。 [#]_" +"如稍後所演示,pickle 並不直接使用上述方法。這些方法實際上是實作" +"了 :meth:`~object.__reduce__` 特殊方法的拷貝協定(copy protocol)。拷貝協定提" +"供了統一的介面,以檢索進行封裝及複製物件時所需的資料。 [#]_" #: ../../library/pickle.rst:680 msgid "" "Although powerful, implementing :meth:`~object.__reduce__` directly in your " "classes is error prone. For this reason, class designers should use the " -"high-level interface (i.e., :meth:`~object.__getnewargs_ex__`, :meth:" -"`~object.__getstate__` and :meth:`~object.__setstate__`) whenever possible. " -"We will show, however, cases where using :meth:`!__reduce__` is the only " -"option or leads to more efficient pickling or both." +"high-level interface " +"(i.e., :meth:`~object.__getnewargs_ex__`, :meth:`~object.__getstate__` " +"and :meth:`~object.__setstate__`) whenever possible. We will show, however, " +"cases where using :meth:`!__reduce__` is the only option or leads to more " +"efficient pickling or both." msgstr "" "直接在類別中實作 :meth:`~object.__reduce__` 雖然功能強大但卻容易導致出錯。因" -"此,設計類別者應盡可能使用高階介面(例如,:meth:`~object." -"__getnewargs_ex__`、:meth:`~object.__getstate__` 和 :meth:`~object." -"__setstate__`)。不過,我們也將展示一些特例狀況,在這些狀況中,使用 :meth:`!" -"__reduce__` 可能是唯一的選擇、是更有效率的封裝方法或二者兼備。" +"此,設計類別者應盡可能使用高階介面(例" +"如,:meth:`~object.__getnewargs_ex__`、:meth:`~object.__getstate__` " +"和 :meth:`~object.__setstate__`)。不過,我們也將展示一些特例狀況,在這些狀況" +"中,使用 :meth:`!__reduce__` 可能是唯一的選擇、是更有效率的封裝方法或二者兼" +"備。" #: ../../library/pickle.rst:689 msgid "" @@ -1293,14 +1301,14 @@ msgstr "" #: ../../library/pickle.rst:710 msgid "" -"Optionally, the object's state, which will be passed to the object's :meth:" -"`__setstate__` method as previously described. If the object has no such " -"method then, the value must be a dictionary and it will be added to the " -"object's :attr:`~object.__dict__` attribute." +"Optionally, the object's state, which will be passed to the " +"object's :meth:`__setstate__` method as previously described. If the object " +"has no such method then, the value must be a dictionary and it will be added " +"to the object's :attr:`~object.__dict__` attribute." msgstr "" "可選項。物件狀態。如前所述,會被傳遞給該物件的 :meth:`__setstate__` 方法。如" -"果該物件沒有實作此方法,則本值必須是一個字典,且其將會被新增到物件的 :attr:" -"`~object.__dict__` 屬性中。" +"果該物件沒有實作此方法,則本值必須是一個字典,且其將會被新增到物件" +"的 :attr:`~object.__dict__` 屬性中。" # SkyLull: [T] # signature: https://jo-jo.medium.com/c-c-%E5%B9%BC%E5%B9%BC%E7%8F%AD-%E7%B0%BD%E7%AB%A0signature-fa9b04e1a3e2 @@ -1309,18 +1317,19 @@ msgid "" "Optionally, an iterator (and not a sequence) yielding successive items. " "These items will be appended to the object either using ``obj.append(item)`` " "or, in batch, using ``obj.extend(list_of_items)``. This is primarily used " -"for list subclasses, but may be used by other classes as long as they have :" -"ref:`append and extend methods ` with the appropriate " +"for list subclasses, but may be used by other classes as long as they " +"have :ref:`append and extend methods ` with the appropriate " "signature. (Whether :meth:`!append` or :meth:`!extend` is used depends on " "which pickle protocol version is used as well as the number of items to " "append, so both must be supported.)" msgstr "" -"可選項。一個用來提供連續項目的疊代器(而非序列)。這些項目將個別透過 ``obj." -"append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被附加到" -"物件中。主要用於串列(list)子類別,但只要其他類別具有相應的 :ref:`append 和 " -"extend 方法 `\\ 以及相同的函式簽章(signature)就也可以使" -"用。 (是否會呼叫 :meth:`!append` 或 :meth:`!extend` 方法將取決於所選用的 " -"pickle 協定版本以及要附加的項目數量,因此必須同時支援這兩種方法。)" +"可選項。一個用來提供連續項目的疊代器(而非序列)。這些項目將個別透過 " +"``obj.append(item)`` 方法或成批次地透過 ``obj.extend(list_of_items)`` 方法被" +"附加到物件中。主要用於串列(list)子類別,但只要其他類別具有相應" +"的 :ref:`append 和 extend 方法 `\\ 以及相同的函式簽章" +"(signature)就也可以使用。 (是否會呼叫 :meth:`!append` 或 :meth:`!extend` " +"方法將取決於所選用的 pickle 協定版本以及要附加的項目數量,因此必須同時支援這" +"兩種方法。)" #: ../../library/pickle.rst:725 msgid "" @@ -1338,8 +1347,8 @@ msgid "" "Optionally, a callable with a ``(obj, state)`` signature. This callable " "allows the user to programmatically control the state-updating behavior of a " "specific object, instead of using ``obj``'s static :meth:`__setstate__` " -"method. If not ``None``, this callable will have priority over ``obj``'s :" -"meth:`__setstate__`." +"method. If not ``None``, this callable will have priority over " +"``obj``'s :meth:`__setstate__`." msgstr "" "可選項。一個具有 ``(obj, state)`` 函式簽章(signature)的可呼叫物件。該物件允" "許使用者以可編寫的邏輯,而不是物件 ``obj`` 預設的 :meth:`__setstate__` 靜態方" @@ -1354,15 +1363,16 @@ msgstr "加入第六個可選項(一個 ``(obj, state)`` 元組)。" msgid "" "Alternatively, a :meth:`__reduce_ex__` method may be defined. The only " "difference is this method should take a single integer argument, the " -"protocol version. When defined, pickle will prefer it over the :meth:" -"`__reduce__` method. In addition, :meth:`__reduce__` automatically becomes " -"a synonym for the extended version. The main use for this method is to " -"provide backwards-compatible reduce values for older Python releases." +"protocol version. When defined, pickle will prefer it over " +"the :meth:`__reduce__` method. In addition, :meth:`__reduce__` " +"automatically becomes a synonym for the extended version. The main use for " +"this method is to provide backwards-compatible reduce values for older " +"Python releases." msgstr "" "另外,你也可以定義一個 :meth:`__reduce_ex__` 方法。唯一的不同的地方是此方法只" -"接受協定版本(整數)作為參數。當有定義本方法時,pickle 會優先呼叫它而不是 :" -"meth:`__reduce__` 。此外,呼叫 :meth:`__reduce__` 時也會自動變成呼叫這個變體" -"版本。此方法主要是為了向後相容的舊的 Python 版本而存在。" +"接受協定版本(整數)作為參數。當有定義本方法時,pickle 會優先呼叫它而不" +"是 :meth:`__reduce__` 。此外,呼叫 :meth:`__reduce__` 時也會自動變成呼叫這個" +"變體版本。此方法主要是為了向後相容的舊的 Python 版本而存在。" #: ../../library/pickle.rst:754 msgid "Persistence of External Objects" @@ -1385,8 +1395,8 @@ msgstr "" msgid "" "The resolution of such persistent IDs is not defined by the :mod:`pickle` " "module; it will delegate this resolution to the user-defined methods on the " -"pickler and unpickler, :meth:`~Pickler.persistent_id` and :meth:`~Unpickler." -"persistent_load` respectively." +"pickler and unpickler, :meth:`~Pickler.persistent_id` " +"and :meth:`~Unpickler.persistent_load` respectively." msgstr "" ":mod:`pickle` 沒有定義要如何解決或分派這個持久化 ID 的問題;故其處理方式有賴" "使用者自行定義在封裝器(pickler)以及拆封器(unpickler)中。方法的名稱各自" @@ -1402,20 +1412,21 @@ msgid "" "object, along with a marker so that the unpickler will recognize it as a " "persistent ID." msgstr "" -"要封裝具有外部持久化 ID 的物件,封裝器(pickler)必須擁有一個自訂的方法 :" -"meth:`~Pickler.persistent_id`,這個方法將接收一個物件作為參數,並回傳 `None` " -"或該物件的持久化 ID。當回傳 `None` 時,封裝器會正常地封裝該物件。當回傳一個持" -"久化 ID 字串時,封裝器會封裝該物件並加上一個標記,讓拆封器(unpikler)能識別" -"它是一個持久化 ID。" +"要封裝具有外部持久化 ID 的物件,封裝器(pickler)必須擁有一個自訂的方" +"法 :meth:`~Pickler.persistent_id`,這個方法將接收一個物件作為參數,並回傳 " +"``None`` 或該物件的持久化 ID。當回傳 ``None`` 時,封裝器會正常地封裝該物件。" +"當回傳一個持久化 ID 字串時,封裝器會封裝該物件並加上一個標記,讓拆封器" +"(unpickler)能識別它是一個持久化 ID。" #: ../../library/pickle.rst:778 msgid "" -"To unpickle external objects, the unpickler must have a custom :meth:" -"`~Unpickler.persistent_load` method that takes a persistent ID object and " -"returns the referenced object." +"To unpickle external objects, the unpickler must have a " +"custom :meth:`~Unpickler.persistent_load` method that takes a persistent ID " +"object and returns the referenced object." msgstr "" -"要拆封外部物件,拆封器(unpickler)必須有一個自訂的 :meth:`~Unpickler." -"persistent_load` 方法,該方法應接受一個持久化 ID 物件,並回傳相對應的物件。" +"要拆封外部物件,拆封器(unpickler)必須有一個自訂" +"的 :meth:`~Unpickler.persistent_load` 方法,該方法應接受一個持久化 ID 物件," +"並回傳相對應的物件。" #: ../../library/pickle.rst:782 msgid "" @@ -1487,8 +1498,8 @@ msgid "" " # Initialize and populate our database.\n" " conn = sqlite3.connect(\":memory:\")\n" " cursor = conn.cursor()\n" -" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task " -"TEXT)\")\n" +" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task TEXT)" +"\")\n" " tasks = (\n" " 'give food to fish',\n" " 'prepare group meeting',\n" @@ -1574,8 +1585,8 @@ msgstr "" " # 初始化資料庫。\n" " conn = sqlite3.connect(\":memory:\")\n" " cursor = conn.cursor()\n" -" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task " -"TEXT)\")\n" +" cursor.execute(\"CREATE TABLE memos(key INTEGER PRIMARY KEY, task TEXT)" +"\")\n" " tasks = (\n" " 'give food to fish',\n" " 'prepare group meeting',\n" @@ -1710,9 +1721,9 @@ msgid "" msgstr "" "以下的範例展示了如何修改針對特定類別封裝時的行為。下面的 :class:`!" "TextReader` 類別會開啟一個文字檔案,並在每次呼叫其 :meth:`!readline` 方法時返" -"回目前行編號與該行內容。如果 :class:`!TextReader` 實例被封裝,所有*除了檔案物" -"件之外*的屬性成員都會被保存。在該實例被拆封時,檔案將被重新開啟,並從上次的位" -"置繼續讀取。這個行為的達成是透過 :meth:`!__setstate__` 和 :meth:`!" +"回目前行編號與該行內容。如果 :class:`!TextReader` 實例被封裝,所有\\ *除了檔" +"案物件之外*\\ 的屬性成員都會被保存。在該實例被拆封時,檔案將被重新開啟,並從" +"上次的位置繼續讀取。這個行為的達成是透過 :meth:`!__setstate__` 和 :meth:`!" "__getstate__` 方法來實作的。::" #: ../../library/pickle.rst:844 @@ -1837,15 +1848,16 @@ msgid "" "alternatively return :data:`NotImplemented` to fallback to the traditional " "behavior." msgstr "" -"如果是這樣的話,可以繼承 :class:`Pickler` 類別並實作一個 :meth:`~Pickler." -"reducer_override` 方法。此方法可以回傳任意的縮減元組(參閱 :meth:`~object." -"__reduce__`)、也可以回傳 :data:`NotImplemented` 以回退至原始的行為。" +"如果是這樣的話,可以繼承 :class:`Pickler` 類別並實作一" +"個 :meth:`~Pickler.reducer_override` 方法。此方法可以回傳任意的縮減元組(參" +"閱 :meth:`~object.__reduce__`)、也可以回傳 :data:`NotImplemented` 以回退至原" +"始的行為。" #: ../../library/pickle.rst:910 msgid "" -"If both the :attr:`~Pickler.dispatch_table` and :meth:`~Pickler." -"reducer_override` are defined, then :meth:`~Pickler.reducer_override` method " -"takes priority." +"If both the :attr:`~Pickler.dispatch_table` " +"and :meth:`~Pickler.reducer_override` are defined, " +"then :meth:`~Pickler.reducer_override` method takes priority." msgstr "" "如果 :attr:`~Pickler.dispatch_table` 和 :meth:`~Pickler.reducer_override` 都" "被定義了的話,:meth:`~Pickler.reducer_override` 的優先度較高。" @@ -1854,14 +1866,14 @@ msgstr "" msgid "" "For performance reasons, :meth:`~Pickler.reducer_override` may not be called " "for the following objects: ``None``, ``True``, ``False``, and exact " -"instances of :class:`int`, :class:`float`, :class:`bytes`, :class:`str`, :" -"class:`dict`, :class:`set`, :class:`frozenset`, :class:`list` and :class:" -"`tuple`." +"instances " +"of :class:`int`, :class:`float`, :class:`bytes`, :class:`str`, :class:`dict`, :class:`set`, :class:`frozenset`, :class:`list` " +"and :class:`tuple`." msgstr "" "出於效能考量,處裡以下物件可能不會呼叫 :meth:`~Pickler.reducer_override`:" -"``None``、``True``、``False``,以及 :class:`int`、:class:`float`、:class:" -"`bytes`、:class:`str`、:class:`dict`、:class:`set`、:class:`frozenset`、:" -"class:`list` 和 :class:`tuple` 的實例。" +"``None``、``True``、``False``,以" +"及 :class:`int`、:class:`float`、:class:`bytes`、:class:`str`、:class:`dict`、:class:`set`、:class:`frozenset`、:class:`list` " +"和 :class:`tuple` 的實例。" #: ../../library/pickle.rst:921 msgid "" @@ -1952,8 +1964,9 @@ msgid "" "implementation of the communications system) support the out-of-band " "transfer facilities provided by pickle protocol 5 and higher." msgstr "" -"如果*供給者*(被傳遞物件的型別的實作)與*消費者*(資訊交換系統的實作)都支援" -"由 pickle 協定 5 或更高版本提供的帶外傳輸功能,則可以避免此一先天限制。" +"如果\\ *供給者*\\ (被傳遞物件的型別的實作)與\\ *消費者*\\ (資訊交換系統的" +"實作)都支援由 pickle 協定 5 或更高版本提供的帶外傳輸功能,則可以避免此一先天" +"限制。" #: ../../library/pickle.rst:973 msgid "Provider API" @@ -1961,14 +1974,15 @@ msgstr "供給者 API" #: ../../library/pickle.rst:975 msgid "" -"The large data objects to be pickled must implement a :meth:`~object." -"__reduce_ex__` method specialized for protocol 5 and higher, which returns " -"a :class:`PickleBuffer` instance (instead of e.g. a :class:`bytes` object) " -"for any large data." +"The large data objects to be pickled must implement " +"a :meth:`~object.__reduce_ex__` method specialized for protocol 5 and " +"higher, which returns a :class:`PickleBuffer` instance (instead of e.g. " +"a :class:`bytes` object) for any large data." msgstr "" -"要封裝的大型資料物件,則必須實作一個針對 5 版協定及以上的 :meth:`~object." -"__reduce_ex__` 方法,該方法應回傳一個 :class:`PickleBuffer` 實例來處理任何大" -"型資料(而非回傳如 :class:`bytes` 物件)。" +"要封裝的大型資料物件,則必須實作一個針對 5 版協定及以上" +"的 :meth:`~object.__reduce_ex__` 方法,該方法應回傳一" +"個 :class:`PickleBuffer` 實例來處理任何大型資料(而非回傳如 :class:`bytes` 物" +"件)。" #: ../../library/pickle.rst:980 msgid "" @@ -1978,9 +1992,9 @@ msgid "" "opt-in to tell :mod:`pickle` that they will handle those buffers by " "themselves." msgstr "" -"一個 :class:`PickleBuffer` 物件*指示*了當下底層的緩衝區狀態適合進行帶外資料傳" -"輸。這些物件仍然相容 :mod:`pickle` 模組的一般使用方式。消費者程式也可以選擇介" -"入,指示 :mod:`pickle` 他們將自行處理這些緩衝區。" +"一個 :class:`PickleBuffer` 物件\\ *指示*\\ 了當下底層的緩衝區狀態適合進行帶外" +"資料傳輸。這些物件仍然相容 :mod:`pickle` 模組的一般使用方式。消費者程式也可以" +"選擇介入,指示 :mod:`pickle` 他們將自行處理這些緩衝區。" #: ../../library/pickle.rst:987 msgid "Consumer API" @@ -1988,41 +2002,42 @@ msgstr "消費者 API" #: ../../library/pickle.rst:989 msgid "" -"A communications system can enable custom handling of the :class:" -"`PickleBuffer` objects generated when serializing an object graph." +"A communications system can enable custom handling of " +"the :class:`PickleBuffer` objects generated when serializing an object graph." msgstr "" "一個資訊交換系統可以決定要自行處裡序列化物件圖時產生的 :class:`PickleBuffer` " "物件。" #: ../../library/pickle.rst:992 msgid "" -"On the sending side, it needs to pass a *buffer_callback* argument to :class:" -"`Pickler` (or to the :func:`dump` or :func:`dumps` function), which will be " -"called with each :class:`PickleBuffer` generated while pickling the object " -"graph. Buffers accumulated by the *buffer_callback* will not see their data " -"copied into the pickle stream, only a cheap marker will be inserted." +"On the sending side, it needs to pass a *buffer_callback* argument " +"to :class:`Pickler` (or to the :func:`dump` or :func:`dumps` function), " +"which will be called with each :class:`PickleBuffer` generated while " +"pickling the object graph. Buffers accumulated by the *buffer_callback* " +"will not see their data copied into the pickle stream, only a cheap marker " +"will be inserted." msgstr "" -"傳送端需要傳遞一個呼叫緩衝區的回呼函式給 :class:`Pickler`\\ (或 :func:" -"`dump` 或 :func:`dumps` 函式)的 *buffer_callback* 引數,使每次生成 :class:" -"`PickleBuffer` 時,該物件在處理物件圖時能被呼叫。除了一個簡易標記以外,由 " -"*buffer_callback* 累積的緩衝區資料不會被複製到 pickle 串流中。" +"傳送端需要傳遞一個呼叫緩衝區的回呼函式給 :class:`Pickler`\\ " +"(或 :func:`dump` 或 :func:`dumps` 函式)的 *buffer_callback* 引數,使每次生" +"成 :class:`PickleBuffer` 時,該物件在處理物件圖時能被呼叫。除了一個簡易標記以" +"外,由 *buffer_callback* 累積的緩衝區資料不會被複製到 pickle 串流中。" #: ../../library/pickle.rst:999 msgid "" -"On the receiving side, it needs to pass a *buffers* argument to :class:" -"`Unpickler` (or to the :func:`load` or :func:`loads` function), which is an " -"iterable of the buffers which were passed to *buffer_callback*. That " -"iterable should produce buffers in the same order as they were passed to " -"*buffer_callback*. Those buffers will provide the data expected by the " -"reconstructors of the objects whose pickling produced the original :class:" -"`PickleBuffer` objects." -msgstr "" -"接收端需要傳遞一個緩衝區物件給 :class:`Unpickler`\\ (或 :func:`load` 或 :" -"func:`loads` 函式)的 *buffers* 引數。該物件須是一個可疊代的(iterable)緩衝" -"區(buffer)物件,其中包含傳遞給 *buffer_callback* 的緩衝區物件。這個可疊代物" -"件的緩衝區順序應該與它們當初被封裝時傳遞給 *buffer_callback* 的順序相同。這些" -"緩衝區將提供物件重建所需的資料,以使重建器能還原出那個當時產生了 :class:" -"`PickleBuffer` 的物件。" +"On the receiving side, it needs to pass a *buffers* argument " +"to :class:`Unpickler` (or to the :func:`load` or :func:`loads` function), " +"which is an iterable of the buffers which were passed to *buffer_callback*. " +"That iterable should produce buffers in the same order as they were passed " +"to *buffer_callback*. Those buffers will provide the data expected by the " +"reconstructors of the objects whose pickling produced the " +"original :class:`PickleBuffer` objects." +msgstr "" +"接收端需要傳遞一個緩衝區物件給 :class:`Unpickler`\\ (或 :func:`load` " +"或 :func:`loads` 函式)的 *buffers* 引數。該物件須是一個可疊代的(iterable)" +"緩衝區(buffer)物件,其中包含傳遞給 *buffer_callback* 的緩衝區物件。這個可疊" +"代物件的緩衝區順序應該與它們當初被封裝時傳遞給 *buffer_callback* 的順序相同。" +"這些緩衝區將提供物件重建所需的資料,以使重建器能還原出那個當時產生" +"了 :class:`PickleBuffer` 的物件。" #: ../../library/pickle.rst:1007 msgid "" @@ -2043,8 +2058,8 @@ msgid "" "Here is a trivial example where we implement a :class:`bytearray` subclass " "able to participate in out-of-band buffer pickling::" msgstr "" -"這一個簡單的範例展示了如何實作一個可以參與帶外緩衝區封裝的 :class:" -"`bytearray` 子類別:::" +"這一個簡單的範例展示了如何實作一個可以參與帶外緩衝區封裝" +"的 :class:`bytearray` 子類別:::" #: ../../library/pickle.rst:1018 msgid "" @@ -2202,11 +2217,11 @@ msgstr "" #: ../../library/pickle.rst:1094 msgid "" -"For this reason, you may want to control what gets unpickled by customizing :" -"meth:`Unpickler.find_class`. Unlike its name suggests, :meth:`Unpickler." -"find_class` is called whenever a global (i.e., a class or a function) is " -"requested. Thus it is possible to either completely forbid globals or " -"restrict them to a safe subset." +"For this reason, you may want to control what gets unpickled by " +"customizing :meth:`Unpickler.find_class`. Unlike its name " +"suggests, :meth:`Unpickler.find_class` is called whenever a global (i.e., a " +"class or a function) is requested. Thus it is possible to either completely " +"forbid globals or restrict them to a safe subset." msgstr "" "基於以上原因,你可能會希望透過自訂 :meth:`Unpickler.find_class` 來控制哪些是" "能夠被拆封的內容。與其名稱字面意義暗示的不同,實際上每當你請求一個全域物件" @@ -2215,8 +2230,8 @@ msgstr "" #: ../../library/pickle.rst:1100 msgid "" -"Here is an example of an unpickler allowing only few safe classes from the :" -"mod:`builtins` module to be loaded::" +"Here is an example of an unpickler allowing only few safe classes from " +"the :mod:`builtins` module to be loaded::" msgstr "" "以下是一個僅允許從 :mod:`builtins` 模組中載入少數安全類別的拆封器" "(unpickler)的例子:::" @@ -2446,8 +2461,8 @@ msgstr "" #: ../../library/pickle.rst:1222 msgid "" -"The exception raised will likely be an :exc:`ImportError` or an :exc:" -"`AttributeError` but it could be something else." +"The exception raised will likely be an :exc:`ImportError` or " +"an :exc:`AttributeError` but it could be something else." msgstr "" "引發的例外應該是 :exc:`ImportError` 或 :exc:`AttributeError`,但也可能是其他" "例外。" diff --git a/library/pkgutil.po b/library/pkgutil.po index 31147bebcb..3851b2c077 100644 --- a/library/pkgutil.po +++ b/library/pkgutil.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -41,8 +41,8 @@ msgid "" "Extend the search path for the modules which comprise a package. Intended " "use is to place the following code in a package's :file:`__init__.py`::" msgstr "" -"擴充組成一個套件之模組的搜尋路徑。預期用法是將以下程式碼放入套件的 :file:" -"`__init__.py`: ::" +"擴充組成一個套件之模組的搜尋路徑。預期用法是將以下程式碼放入套件" +"的 :file:`__init__.py`: ::" #: ../../library/pkgutil.rst:25 msgid "" @@ -55,9 +55,10 @@ msgstr "" #: ../../library/pkgutil.rst:28 msgid "" "For each directory on :data:`sys.path` that has a subdirectory that matches " -"the package name, add the subdirectory to the package's :attr:`~module." -"__path__`. This is useful if one wants to distribute different parts of a " -"single logical package as multiple directories." +"the package name, add the subdirectory to the " +"package's :attr:`~module.__path__`. This is useful if one wants to " +"distribute different parts of a single logical package as multiple " +"directories." msgstr "" "對於 :data:`sys.path` 上具有與套件名稱相符的子目錄的每個目錄,將該子目錄新增" "至套件的 :attr:`~module.__path__` 中。如果想要將單一邏輯套件的不同部分給分配" @@ -66,12 +67,12 @@ msgstr "" #: ../../library/pkgutil.rst:34 msgid "" "It also looks for :file:`\\*.pkg` files beginning where ``*`` matches the " -"*name* argument. This feature is similar to :file:`\\*.pth` files (see the :" -"mod:`site` module for more information), except that it doesn't special-case " -"lines starting with ``import``. A :file:`\\*.pkg` file is trusted at face " -"value: apart from skipping blank lines and ignoring comments, all entries " -"found in a :file:`\\*.pkg` file are added to the path, regardless of whether " -"they exist on the filesystem (this is a feature)." +"*name* argument. This feature is similar to :file:`\\*.pth` files (see " +"the :mod:`site` module for more information), except that it doesn't special-" +"case lines starting with ``import``. A :file:`\\*.pkg` file is trusted at " +"face value: apart from skipping blank lines and ignoring comments, all " +"entries found in a :file:`\\*.pkg` file are added to the path, regardless of " +"whether they exist on the filesystem (this is a feature)." msgstr "" "它還會尋找 :file:`\\*.pkg` 檔案,其中開頭的 ``*`` 與 *name* 引數相符。此功能" "類似於 :file:`\\*.pth` 檔案(更多資訊請參閱 :mod:`site` 模組),但他不特別處" @@ -90,11 +91,11 @@ msgstr "" #: ../../library/pkgutil.rst:46 msgid "" -"It is assumed that :data:`sys.path` is a sequence. Items of :data:`sys." -"path` that are not strings referring to existing directories are ignored. " -"Unicode items on :data:`sys.path` that cause errors when used as filenames " -"may cause this function to raise an exception (in line with :func:`os.path." -"isdir` behavior)." +"It is assumed that :data:`sys.path` is a sequence. Items " +"of :data:`sys.path` that are not strings referring to existing directories " +"are ignored. Unicode items on :data:`sys.path` that cause errors when used " +"as filenames may cause this function to raise an exception (in line " +"with :func:`os.path.isdir` behavior)." msgstr "" ":data:`sys.path` 被假設是一個序列,:data:`sys.path` 中的項目裡,若不是代表現" "存目錄的字串則將被忽略。:data:`sys.path` 上用作檔案名稱時導致錯誤的 Unicode " @@ -106,14 +107,14 @@ msgstr "取得給定之 *fullname* 的模組 :term:`loader`。" #: ../../library/pkgutil.rst:56 msgid "" -"This is a backwards compatibility wrapper around :func:`importlib.util." -"find_spec` that converts most failures to :exc:`ImportError` and only " -"returns the loader rather than the full :class:`importlib.machinery." -"ModuleSpec`." +"This is a backwards compatibility wrapper " +"around :func:`importlib.util.find_spec` that converts most failures " +"to :exc:`ImportError` and only returns the loader rather than the " +"full :class:`importlib.machinery.ModuleSpec`." msgstr "" "這是一個 :func:`importlib.util.find_spec` 的向後相容包裝器,它將大多數的失敗" -"轉換為 :exc:`ImportError` 並且僅回傳載入器而不是完整的 :class:`importlib." -"machinery.ModuleSpec`。" +"轉換為 :exc:`ImportError` 並且僅回傳載入器而不是完整" +"的 :class:`importlib.machinery.ModuleSpec`。" #: ../../library/pkgutil.rst:61 ../../library/pkgutil.rst:82 #: ../../library/pkgutil.rst:97 ../../library/pkgutil.rst:121 @@ -147,8 +148,8 @@ msgstr "" #: ../../library/pkgutil.rst:79 msgid "" -"The cache (or part of it) can be cleared manually if a rescan of :data:`sys." -"path_hooks` is necessary." +"The cache (or part of it) can be cleared manually if a rescan " +"of :data:`sys.path_hooks` is necessary." msgstr "" "如果需要重新掃描 :data:`sys.path_hooks`,可以手動清除快取(或部分快取)。" @@ -216,12 +217,12 @@ msgstr "*prefix* 是在輸出的每個模組名稱前面的輸出字串。" msgid "" "Only works for a :term:`finder` which defines an ``iter_modules()`` method. " "This interface is non-standard, so the module also provides implementations " -"for :class:`importlib.machinery.FileFinder` and :class:`zipimport." -"zipimporter`." +"for :class:`importlib.machinery.FileFinder` " +"and :class:`zipimport.zipimporter`." msgstr "" "僅適用於有定義 ``iter_modules()`` 方法的 :term:`finder`。此介面並非是標準的," -"因此該模組還提供了 :class:`importlib.machinery.FileFinder` 和 :class:" -"`zipimport.zipimporter` 的實作。" +"因此該模組還提供了 :class:`importlib.machinery.FileFinder` " +"和 :class:`zipimport.zipimporter` 的實作。" #: ../../library/pkgutil.rst:149 msgid "" @@ -244,13 +245,13 @@ msgstr "" msgid "" "*onerror* is a function which gets called with one argument (the name of the " "package which was being imported) if any exception occurs while trying to " -"import a package. If no *onerror* function is supplied, :exc:" -"`ImportError`\\s are caught and ignored, while all other exceptions are " -"propagated, terminating the search." +"import a package. If no *onerror* function is " +"supplied, :exc:`ImportError`\\s are caught and ignored, while all other " +"exceptions are propagated, terminating the search." msgstr "" "*onerror* 是一個函式,如果在嘗試引入套件時發生任何例外,則使用一個引數(正在" -"引入之套件的名稱)來呼叫函式。如果未提供 *onerror* 函式,則會捕獲並忽略 :exc:" -"`ImportError`,同時傳播所有其他例外並終止搜尋。" +"引入之套件的名稱)來呼叫函式。如果未提供 *onerror* 函式,則會捕獲並忽" +"略 :exc:`ImportError`,同時傳播所有其他例外並終止搜尋。" #: ../../library/pkgutil.rst:166 msgid "Examples::" @@ -264,6 +265,11 @@ msgid "" "# list all submodules of ctypes\n" "walk_packages(ctypes.__path__, ctypes.__name__ + '.')" msgstr "" +"# 列出 Python 可存取的所有模組\n" +"walk_packages()\n" +"\n" +"# 列出 ctypes 的所有子模組\n" +"walk_packages(ctypes.__path__, ctypes.__name__ + '.')" #: ../../library/pkgutil.rst:188 msgid "Get a resource from a package." @@ -271,12 +277,12 @@ msgstr "從套件中取得資源。" #: ../../library/pkgutil.rst:190 msgid "" -"This is a wrapper for the :term:`loader` :meth:`get_data ` API. The *package* argument should be the name of " -"a package, in standard module format (``foo.bar``). The *resource* argument " -"should be in the form of a relative filename, using ``/`` as the path " -"separator. The parent directory name ``..`` is not allowed, and nor is a " -"rooted name (starting with a ``/``)." +"This is a wrapper for the :term:`loader` :meth:`get_data " +"` API. The *package* argument should " +"be the name of a package, in standard module format (``foo.bar``). The " +"*resource* argument should be in the form of a relative filename, using ``/" +"`` as the path separator. The parent directory name ``..`` is not allowed, " +"and nor is a rooted name (starting with a ``/``)." msgstr "" "這是 :term:`loader` :meth:`get_data ` " "API 的包裝器。*package* 引數應該是採用標準模組格式 (``foo.bar``) 的套件名稱。" @@ -306,15 +312,16 @@ msgstr "" #: ../../library/pkgutil.rst:206 msgid "" "If the package cannot be located or loaded, or it uses a :term:`loader` " -"which does not support :meth:`get_data `, then ``None`` is returned. In particular, the :term:`loader` " -"for :term:`namespace packages ` does not support :meth:" -"`get_data `." +"which does not support :meth:`get_data " +"`, then ``None`` is returned. In " +"particular, the :term:`loader` for :term:`namespace packages ` does not support :meth:`get_data " +"`." msgstr "" -"如果無法定位或載入套件,或者它使用不支援 :meth:`get_data ` 的 :term:`loader` 則回傳 ``None``。特別是\\ :term:`" -"命名空間套件 `\\ 的 :term:`loader` 不支援 :meth:`get_data " -"`。" +"如果無法定位或載入套件,或者它使用不支援 :meth:`get_data " +"` 的 :term:`loader` 則回傳 ``None``。" +"特別是\\ :term:`命名空間套件 `\\ 的 :term:`loader` 不支" +"援 :meth:`get_data `。" #: ../../library/pkgutil.rst:215 msgid "Resolve a name to an object." @@ -322,9 +329,9 @@ msgstr "將名稱解析為物件。" #: ../../library/pkgutil.rst:217 msgid "" -"This functionality is used in numerous places in the standard library (see :" -"issue:`12915`) - and equivalent functionality is also in widely used third-" -"party packages such as setuptools, Django and Pyramid." +"This functionality is used in numerous places in the standard library " +"(see :issue:`12915`) - and equivalent functionality is also in widely used " +"third-party packages such as setuptools, Django and Pyramid." msgstr "" "標準函式庫中的許多地方都使用了此功能(請參閱 :issue:`12915`),且相同功能也被" "用於擁有廣大使用者的第三方套件,如 setuptools、Django 和 Pyramid。" diff --git a/library/platform.po b/library/platform.po index 4132559a7c..d7f235e812 100644 --- a/library/platform.po +++ b/library/platform.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-05-04 00:16+0000\n" "PO-Revision-Date: 2022-06-11 14:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,7 +35,7 @@ msgid "" msgstr "特定平臺清單為按字母順序排列,Linux 包括在 Unix 小節之中。" #: ../../library/platform.rst:21 -msgid "Cross Platform" +msgid "Cross platform" msgstr "跨平台" #: ../../library/platform.rst:26 @@ -88,8 +88,8 @@ msgid "" "To get at the \"64-bitness\" of the current interpreter, it is more reliable " "to query the :data:`sys.maxsize` attribute::" msgstr "" -"要取得目前直譯器的 \"64 位元性 (64-bitness)\",更可靠的做法是查詢 :data:`sys." -"maxsize` 屬性: ::" +"要取得目前直譯器的 \"64 位元性 (64-bitness)\",更可靠的做法是查" +"詢 :data:`sys.maxsize` 屬性: ::" #: ../../library/platform.rst:51 msgid "is_64bits = sys.maxsize > 2**32" @@ -264,12 +264,13 @@ msgstr "" #: ../../library/platform.rst:172 msgid "" "Fairly portable uname interface. Returns a :func:`~collections.namedtuple` " -"containing six attributes: :attr:`system`, :attr:`node`, :attr:`release`, :" -"attr:`version`, :attr:`machine`, and :attr:`processor`." +"containing six " +"attributes: :attr:`system`, :attr:`node`, :attr:`release`, :attr:`version`, :attr:`machine`, " +"and :attr:`processor`." msgstr "" -"具有高可攜性 (portable) 的 uname 介面。回傳包含六個屬性的 :func:" -"`~collections.namedtuple`::attr:`system`、:attr:`node`、:attr:`release`、:" -"attr:`version`、:attr:`machine` 和 :attr:`processor`。" +"具有高可攜性 (portable) 的 uname 介面。回傳包含六個屬性" +"的 :func:`~collections.namedtuple`::attr:`system`、:attr:`node`、:attr:`release`、:attr:`version`、:attr:`machine` " +"和 :attr:`processor`。" #: ../../library/platform.rst:176 msgid ":attr:`processor` is resolved late, on demand." @@ -277,11 +278,12 @@ msgstr ":attr:`processor` 會延遲解析,有需求時才會解析" #: ../../library/platform.rst:178 msgid "" -"Note: the first two attribute names differ from the names presented by :func:" -"`os.uname`, where they are named :attr:`sysname` and :attr:`nodename`." +"Note: the first two attribute names differ from the names presented " +"by :func:`os.uname`, where they are named :attr:`sysname` " +"and :attr:`nodename`." msgstr "" -"注意:前兩個屬性名稱與 :func:`os.uname` 提供的名稱不同,它們分別命名為 :attr:" -"`sysname` 和 :attr:`nodename`。" +"注意:前兩個屬性名稱與 :func:`os.uname` 提供的名稱不同,它們分別命名" +"為 :attr:`sysname` 和 :attr:`nodename`。" #: ../../library/platform.rst:182 msgid "Entries which cannot be determined are set to ``''``." @@ -296,7 +298,7 @@ msgid ":attr:`processor` is resolved late instead of immediately." msgstr ":attr:`processor` 會延遲解析,並非立即解析。" #: ../../library/platform.rst:192 -msgid "Java Platform" +msgid "Java platform" msgstr "Java 平台" #: ../../library/platform.rst:197 @@ -322,7 +324,7 @@ msgid "" msgstr "" #: ../../library/platform.rst:210 -msgid "Windows Platform" +msgid "Windows platform" msgstr "Windows 平台" #: ../../library/platform.rst:215 @@ -342,8 +344,8 @@ msgid "" "As a hint: *ptype* is ``'Uniprocessor Free'`` on single processor NT " "machines and ``'Multiprocessor Free'`` on multi processor machines. The " "``'Free'`` refers to the OS version being free of debugging code. It could " -"also state ``'Checked'`` which means the OS version uses debugging code, i." -"e. code that checks arguments, ranges, etc." +"also state ``'Checked'`` which means the OS version uses debugging code, " +"i.e. code that checks arguments, ranges, etc." msgstr "" "一點提示:*ptype* 在單個處理器的 NT 機器上為 ``'Uniprocessor Free'``,而在多" "個處理器的機器上為 ``'Multiprocessor Free'``。``'Free'`` 是指該 OS 版本沒有除" @@ -369,7 +371,7 @@ msgstr "" "``True``。" #: ../../library/platform.rst:244 -msgid "macOS Platform" +msgid "macOS platform" msgstr "macOS 平台" #: ../../library/platform.rst:248 @@ -389,13 +391,13 @@ msgid "" msgstr "無法確定的條目會被設為 ``''``。所有 tuple 條目均為字串。" #: ../../library/platform.rst:256 -msgid "iOS Platform" +msgid "iOS platform" msgstr "iOS 平台" #: ../../library/platform.rst:260 msgid "" -"Get iOS version information and return it as a :func:`~collections." -"namedtuple` with the following attributes:" +"Get iOS version information and return it as " +"a :func:`~collections.namedtuple` with the following attributes:" msgstr "" #: ../../library/platform.rst:263 @@ -419,14 +421,13 @@ msgid "" msgstr "" #: ../../library/platform.rst:270 -#, fuzzy msgid "" "Entries which cannot be determined are set to the defaults given as " "parameters." -msgstr "無法確定的條目會被設為 ``''``。所有 tuple 條目均為字串。" +msgstr "無法確定的條目會被設定為以參數給定的預設值。" #: ../../library/platform.rst:275 -msgid "Unix Platforms" +msgid "Unix platforms" msgstr "Unix 平台" #: ../../library/platform.rst:279 @@ -453,7 +454,7 @@ msgid "The file is read and scanned in chunks of *chunksize* bytes." msgstr "檔案會以 *chunksize* 位元組大小的分塊 (chunk) 來讀取和掃描。" #: ../../library/platform.rst:291 -msgid "Linux Platforms" +msgid "Linux platforms" msgstr "Linux 平台" #: ../../library/platform.rst:295 @@ -474,8 +475,8 @@ msgid "" "Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor ``/" "usr/lib/os-release`` can be read." msgstr "" -"當 ``/etc/os-release`` 與 ``/usr/lib/os-release`` 均無法被讀取時將引發 :exc:" -"`OSError` 或其子類別。" +"當 ``/etc/os-release`` 與 ``/usr/lib/os-release`` 均無法被讀取時將引" +"發 :exc:`OSError` 或其子類別。" #: ../../library/platform.rst:304 msgid "" @@ -517,7 +518,7 @@ msgid "" msgstr "" #: ../../library/platform.rst:329 -msgid "Android Platform" +msgid "Android platform" msgstr "Android 平台" #: ../../library/platform.rst:334 @@ -534,8 +535,8 @@ msgstr "" #: ../../library/platform.rst:340 msgid "" "``api_level`` - API level of the running device, as an integer (e.g. ``34`` " -"for Android 14). To get the API level which Python was built against, see :" -"func:`sys.getandroidapilevel`." +"for Android 14). To get the API level which Python was built against, " +"see :func:`sys.getandroidapilevel`." msgstr "" #: ../../library/platform.rst:344 @@ -564,6 +565,44 @@ msgstr "" #: ../../library/platform.rst:358 msgid "" -"Google maintains a `list of known model and device names `__." +"Google maintains a `list of known model and device names `__." +msgstr "" + +#: ../../library/platform.rst:366 +msgid "Command-line usage" +msgstr "命令列用法" + +#: ../../library/platform.rst:368 +msgid "" +":mod:`platform` can also be invoked directly using the :option:`-m` switch " +"of the interpreter::" +msgstr "" + +#: ../../library/platform.rst:371 +msgid "python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...]" +msgstr "python -m platform [--terse] [--nonaliased] [{nonaliased,terse} ...]" + +#: ../../library/platform.rst:373 +msgid "The following options are accepted:" +msgstr "可接受以下選項:" + +#: ../../library/platform.rst:379 +msgid "" +"Print terse information about the platform. This is equivalent to " +"calling :func:`platform.platform` with the *terse* argument set to ``True``." +msgstr "" + +#: ../../library/platform.rst:384 +msgid "" +"Print platform information without system/OS name aliasing. This is " +"equivalent to calling :func:`platform.platform` with the *aliased* argument " +"set to ``True``." +msgstr "" + +#: ../../library/platform.rst:388 +msgid "" +"You can also pass one or more positional arguments (``terse``, " +"``nonaliased``) to explicitly control the output format. These behave " +"similarly to their corresponding options." msgstr "" diff --git a/library/plistlib.po b/library/plistlib.po index 8e0a57dc70..cd169610e3 100644 --- a/library/plistlib.po +++ b/library/plistlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-04-14 00:15+0000\n" "PO-Revision-Date: 2016-01-31 07:27+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -132,95 +132,92 @@ msgstr "" #: ../../library/plistlib.rst:81 msgid "" -"The parser for the binary format raises :exc:`InvalidFileException` when the " -"file cannot be parsed." +"The parser raises :exc:`InvalidFileException` when the file cannot be parsed." msgstr "" -#: ../../library/plistlib.rst:86 ../../library/plistlib.rst:131 +#: ../../library/plistlib.rst:85 ../../library/plistlib.rst:130 msgid "The keyword-only parameter *aware_datetime* has been added." msgstr "" -#: ../../library/plistlib.rst:92 +#: ../../library/plistlib.rst:91 msgid "" "Load a plist from a bytes or string object. See :func:`load` for an " "explanation of the keyword arguments." msgstr "" -#: ../../library/plistlib.rst:97 +#: ../../library/plistlib.rst:96 msgid "*data* can be a string when *fmt* equals :data:`FMT_XML`." msgstr "" -#: ../../library/plistlib.rst:102 +#: ../../library/plistlib.rst:101 msgid "" -"Write *value* to a plist file. *Fp* should be a writable, binary file object." +"Write *value* to a plist file. *fp* should be a writable, binary file object." msgstr "" -#: ../../library/plistlib.rst:105 +#: ../../library/plistlib.rst:104 msgid "" "The *fmt* argument specifies the format of the plist file and can be one of " "the following values:" msgstr "" -#: ../../library/plistlib.rst:108 +#: ../../library/plistlib.rst:107 msgid ":data:`FMT_XML`: XML formatted plist file" msgstr "" -#: ../../library/plistlib.rst:110 +#: ../../library/plistlib.rst:109 msgid ":data:`FMT_BINARY`: Binary formatted plist file" msgstr "" -#: ../../library/plistlib.rst:112 +#: ../../library/plistlib.rst:111 msgid "" "When *sort_keys* is true (the default) the keys for dictionaries will be " "written to the plist in sorted order, otherwise they will be written in the " "iteration order of the dictionary." msgstr "" -#: ../../library/plistlib.rst:116 +#: ../../library/plistlib.rst:115 msgid "" "When *skipkeys* is false (the default) the function raises :exc:`TypeError` " "when a key of a dictionary is not a string, otherwise such keys are skipped." msgstr "" -#: ../../library/plistlib.rst:119 +#: ../../library/plistlib.rst:118 msgid "" "When *aware_datetime* is true and any field with type ``datetime.datetime`` " "is set as an :ref:`aware object `, it will convert to " "UTC timezone before writing it." msgstr "" -#: ../../library/plistlib.rst:123 +#: ../../library/plistlib.rst:122 msgid "" "A :exc:`TypeError` will be raised if the object is of an unsupported type or " "a container that contains objects of unsupported types." msgstr "" -#: ../../library/plistlib.rst:126 +#: ../../library/plistlib.rst:125 msgid "" "An :exc:`OverflowError` will be raised for integer values that cannot be " "represented in (binary) plist files." msgstr "" -#: ../../library/plistlib.rst:137 +#: ../../library/plistlib.rst:136 msgid "" "Return *value* as a plist-formatted bytes object. See the documentation for :" "func:`dump` for an explanation of the keyword arguments of this function." msgstr "" -#: ../../library/plistlib.rst:144 +#: ../../library/plistlib.rst:143 msgid "The following classes are available:" msgstr "" -#: ../../library/plistlib.rst:148 +#: ../../library/plistlib.rst:147 msgid "" "Wraps an :class:`int`. This is used when reading or writing NSKeyedArchiver " "encoded data, which contains UID (see PList manual)." msgstr "" -#: ../../library/plistlib.rst:151 -msgid "" -"It has one attribute, :attr:`data`, which can be used to retrieve the int " -"value of the UID. :attr:`data` must be in the range ``0 <= data < 2**64``." +#: ../../library/plistlib.rst:152 +msgid "Int value of the UID. It must be in the range ``0 <= data < 2**64``." msgstr "" #: ../../library/plistlib.rst:157 @@ -235,15 +232,23 @@ msgstr "" msgid "The binary format for plist files" msgstr "" -#: ../../library/plistlib.rst:174 +#: ../../library/plistlib.rst:173 +msgid "The module defines the following exceptions:" +msgstr "" + +#: ../../library/plistlib.rst:177 +msgid "Raised when a file cannot be parsed." +msgstr "" + +#: ../../library/plistlib.rst:183 msgid "Examples" msgstr "範例" -#: ../../library/plistlib.rst:176 +#: ../../library/plistlib.rst:185 msgid "Generating a plist::" msgstr "" -#: ../../library/plistlib.rst:178 +#: ../../library/plistlib.rst:187 msgid "" "import datetime\n" "import plistlib\n" @@ -285,11 +290,11 @@ msgstr "" ")\n" "print(plistlib.dumps(pl).decode())" -#: ../../library/plistlib.rst:198 +#: ../../library/plistlib.rst:207 msgid "Parsing a plist::" msgstr "" -#: ../../library/plistlib.rst:200 +#: ../../library/plistlib.rst:209 msgid "" "import plistlib\n" "\n" diff --git a/library/profile.po b/library/profile.po index aa480c4282..5babd398ac 100644 --- a/library/profile.po +++ b/library/profile.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-02 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,7 +27,7 @@ msgstr "**原始碼:**\\ :source:`Lib/profile.py` 與 :source:`Lib/pstats.py`" #: ../../library/profile.rst:14 msgid "Introduction to the profilers" -msgstr "" +msgstr "分析器簡介" #: ../../library/profile.rst:20 msgid "" @@ -53,20 +53,21 @@ msgstr "" #: ../../library/profile.rst:33 msgid "" -":mod:`profile`, a pure Python module whose interface is imitated by :mod:" -"`cProfile`, but which adds significant overhead to profiled programs. If " -"you're trying to extend the profiler in some way, the task might be easier " -"with this module. Originally designed and written by Jim Roskind." +":mod:`profile`, a pure Python module whose interface is imitated " +"by :mod:`cProfile`, but which adds significant overhead to profiled " +"programs. If you're trying to extend the profiler in some way, the task " +"might be easier with this module. Originally designed and written by Jim " +"Roskind." msgstr "" #: ../../library/profile.rst:40 msgid "" "The profiler modules are designed to provide an execution profile for a " -"given program, not for benchmarking purposes (for that, there is :mod:" -"`timeit` for reasonably accurate results). This particularly applies to " -"benchmarking Python code against C code: the profilers introduce overhead " -"for Python code, but not for C-level functions, and so the C code would seem " -"faster than any Python one." +"given program, not for benchmarking purposes (for that, there " +"is :mod:`timeit` for reasonably accurate results). This particularly " +"applies to benchmarking Python code against C code: the profilers introduce " +"overhead for Python code, but not for C-level functions, and so the C code " +"would seem faster than any Python one." msgstr "" #: ../../library/profile.rst:51 @@ -223,48 +224,49 @@ msgid "" "formats them in various ways." msgstr "" -#: ../../library/profile.rst:126 +#: ../../library/profile.rst:128 msgid "" "The files :mod:`cProfile` and :mod:`profile` can also be invoked as a script " "to profile another script. For example::" msgstr "" -#: ../../library/profile.rst:129 +#: ../../library/profile.rst:131 msgid "" "python -m cProfile [-o output_file] [-s sort_order] (-m module | myscript.py)" msgstr "" "python -m cProfile [-o output_file] [-s sort_order] (-m module | myscript.py)" -#: ../../library/profile.rst:131 -msgid "``-o`` writes the profile results to a file instead of to stdout" +#: ../../library/profile.rst:135 +msgid "Writes the profile results to a file instead of to stdout." msgstr "" -#: ../../library/profile.rst:133 +#: ../../library/profile.rst:139 msgid "" -"``-s`` specifies one of the :func:`~pstats.Stats.sort_stats` sort values to " -"sort the output by. This only applies when ``-o`` is not supplied." +"Specifies one of the :func:`~pstats.Stats.sort_stats` sort values to sort " +"the output by. This only applies when :option:`-o ` is not " +"supplied." msgstr "" -#: ../../library/profile.rst:136 -msgid "``-m`` specifies that a module is being profiled instead of a script." +#: ../../library/profile.rst:145 +msgid "Specifies that a module is being profiled instead of a script." msgstr "" -#: ../../library/profile.rst:138 +#: ../../library/profile.rst:147 msgid "Added the ``-m`` option to :mod:`cProfile`." msgstr "新增 ``-m`` 選項到 :mod:`cProfile`。" -#: ../../library/profile.rst:141 +#: ../../library/profile.rst:150 msgid "Added the ``-m`` option to :mod:`profile`." msgstr "新增 ``-m`` 選項到 :mod:`profile`。" -#: ../../library/profile.rst:144 +#: ../../library/profile.rst:153 msgid "" "The :mod:`pstats` module's :class:`~pstats.Stats` class has a variety of " "methods for manipulating and printing the data saved into a profile results " "file::" msgstr "" -#: ../../library/profile.rst:147 +#: ../../library/profile.rst:156 msgid "" "import pstats\n" "from pstats import SortKey\n" @@ -276,7 +278,7 @@ msgstr "" "p = pstats.Stats('restats')\n" "p.strip_dirs().sort_stats(-1).print_stats()" -#: ../../library/profile.rst:152 +#: ../../library/profile.rst:161 msgid "" "The :meth:`~pstats.Stats.strip_dirs` method removed the extraneous path from " "all the module names. The :meth:`~pstats.Stats.sort_stats` method sorted all " @@ -285,7 +287,7 @@ msgid "" "statistics. You might try the following sort calls::" msgstr "" -#: ../../library/profile.rst:158 +#: ../../library/profile.rst:167 msgid "" "p.sort_stats(SortKey.NAME)\n" "p.print_stats()" @@ -293,60 +295,60 @@ msgstr "" "p.sort_stats(SortKey.NAME)\n" "p.print_stats()" -#: ../../library/profile.rst:161 +#: ../../library/profile.rst:170 msgid "" "The first call will actually sort the list by function name, and the second " "call will print out the statistics. The following are some interesting " "calls to experiment with::" msgstr "" -#: ../../library/profile.rst:165 +#: ../../library/profile.rst:174 msgid "p.sort_stats(SortKey.CUMULATIVE).print_stats(10)" msgstr "p.sort_stats(SortKey.CUMULATIVE).print_stats(10)" -#: ../../library/profile.rst:167 +#: ../../library/profile.rst:176 msgid "" "This sorts the profile by cumulative time in a function, and then only " "prints the ten most significant lines. If you want to understand what " "algorithms are taking time, the above line is what you would use." msgstr "" -#: ../../library/profile.rst:171 +#: ../../library/profile.rst:180 msgid "" "If you were looking to see what functions were looping a lot, and taking a " "lot of time, you would do::" msgstr "" -#: ../../library/profile.rst:174 +#: ../../library/profile.rst:183 msgid "p.sort_stats(SortKey.TIME).print_stats(10)" msgstr "p.sort_stats(SortKey.TIME).print_stats(10)" -#: ../../library/profile.rst:176 +#: ../../library/profile.rst:185 msgid "" "to sort according to time spent within each function, and then print the " "statistics for the top ten functions." msgstr "" -#: ../../library/profile.rst:179 +#: ../../library/profile.rst:188 msgid "You might also try::" msgstr "" -#: ../../library/profile.rst:181 +#: ../../library/profile.rst:190 msgid "p.sort_stats(SortKey.FILENAME).print_stats('__init__')" msgstr "p.sort_stats(SortKey.FILENAME).print_stats('__init__')" -#: ../../library/profile.rst:183 +#: ../../library/profile.rst:192 msgid "" "This will sort all the statistics by file name, and then print out " "statistics for only the class init methods (since they are spelled with " "``__init__`` in them). As one final example, you could try::" msgstr "" -#: ../../library/profile.rst:187 +#: ../../library/profile.rst:196 msgid "p.sort_stats(SortKey.TIME, SortKey.CUMULATIVE).print_stats(.5, 'init')" msgstr "p.sort_stats(SortKey.TIME, SortKey.CUMULATIVE).print_stats(.5, 'init')" -#: ../../library/profile.rst:189 +#: ../../library/profile.rst:198 msgid "" "This line sorts statistics with a primary key of time, and a secondary key " "of cumulative time, and then prints out some of the statistics. To be " @@ -355,27 +357,27 @@ msgid "" "list is printed." msgstr "" -#: ../../library/profile.rst:194 +#: ../../library/profile.rst:203 msgid "" "If you wondered what functions called the above functions, you could now " "(``p`` is still sorted according to the last criteria) do::" msgstr "" -#: ../../library/profile.rst:197 +#: ../../library/profile.rst:206 msgid "p.print_callers(.5, 'init')" msgstr "p.print_callers(.5, 'init')" -#: ../../library/profile.rst:199 +#: ../../library/profile.rst:208 msgid "and you would get a list of callers for each of the listed functions." msgstr "" -#: ../../library/profile.rst:201 +#: ../../library/profile.rst:210 msgid "" "If you want more functionality, you're going to have to read the manual, or " "guess what the following functions do::" msgstr "" -#: ../../library/profile.rst:204 +#: ../../library/profile.rst:213 msgid "" "p.print_callees()\n" "p.add('restats')" @@ -383,34 +385,34 @@ msgstr "" "p.print_callees()\n" "p.add('restats')" -#: ../../library/profile.rst:207 +#: ../../library/profile.rst:216 msgid "" "Invoked as a script, the :mod:`pstats` module is a statistics browser for " "reading and examining profile dumps. It has a simple line-oriented " "interface (implemented using :mod:`cmd`) and interactive help." msgstr "" -#: ../../library/profile.rst:212 +#: ../../library/profile.rst:221 msgid ":mod:`profile` and :mod:`cProfile` Module Reference" -msgstr "" +msgstr ":mod:`profile` 與 :mod:`cProfile` 模組參考文件" -#: ../../library/profile.rst:218 +#: ../../library/profile.rst:227 msgid "" "Both the :mod:`profile` and :mod:`cProfile` modules provide the following " "functions:" msgstr "" -#: ../../library/profile.rst:223 +#: ../../library/profile.rst:232 msgid "" "This function takes a single argument that can be passed to the :func:`exec` " "function, and an optional file name. In all cases this routine executes::" msgstr "" -#: ../../library/profile.rst:226 +#: ../../library/profile.rst:235 msgid "exec(command, __main__.__dict__, __main__.__dict__)" msgstr "exec(command, __main__.__dict__, __main__.__dict__)" -#: ../../library/profile.rst:228 +#: ../../library/profile.rst:237 msgid "" "and gathers profiling statistics from the execution. If no file name is " "present, then this function automatically creates a :class:`~pstats.Stats` " @@ -419,27 +421,27 @@ msgid "" "how the results are sorted." msgstr "" -#: ../../library/profile.rst:236 +#: ../../library/profile.rst:245 msgid "" "This function is similar to :func:`run`, with added arguments to supply the " "globals and locals mappings for the *command* string. This routine executes::" msgstr "" -#: ../../library/profile.rst:240 +#: ../../library/profile.rst:249 msgid "exec(command, globals, locals)" msgstr "exec(command, globals, locals)" -#: ../../library/profile.rst:242 +#: ../../library/profile.rst:251 msgid "and gathers profiling statistics as in the :func:`run` function above." msgstr "" -#: ../../library/profile.rst:246 +#: ../../library/profile.rst:255 msgid "" "This class is normally only used if more precise control over profiling is " "needed than what the :func:`cProfile.run` function provides." msgstr "" -#: ../../library/profile.rst:249 +#: ../../library/profile.rst:258 msgid "" "A custom timer can be supplied for measuring how long code takes to run via " "the *timer* argument. This must be a function that returns a single number " @@ -449,13 +451,13 @@ msgid "" "time unit would be ``.001``." msgstr "" -#: ../../library/profile.rst:256 +#: ../../library/profile.rst:265 msgid "" "Directly using the :class:`Profile` class allows formatting profile results " "without writing the profile data to a file::" msgstr "" -#: ../../library/profile.rst:259 +#: ../../library/profile.rst:268 msgid "" "import cProfile, pstats, io\n" "from pstats import SortKey\n" @@ -481,13 +483,13 @@ msgstr "" "ps.print_stats()\n" "print(s.getvalue())" -#: ../../library/profile.rst:271 +#: ../../library/profile.rst:280 msgid "" "The :class:`Profile` class can also be used as a context manager (supported " "only in :mod:`cProfile` module. see :ref:`typecontextmanager`)::" msgstr "" -#: ../../library/profile.rst:274 +#: ../../library/profile.rst:283 msgid "" "import cProfile\n" "\n" @@ -496,61 +498,67 @@ msgid "" "\n" " pr.print_stats()" msgstr "" +"import cProfile\n" +"\n" +"with cProfile.Profile() as pr:\n" +" # ... do something ...\n" +"\n" +" pr.print_stats()" -#: ../../library/profile.rst:281 +#: ../../library/profile.rst:290 msgid "Added context manager support." msgstr "新增情境管理器的支援。" -#: ../../library/profile.rst:286 +#: ../../library/profile.rst:295 msgid "Start collecting profiling data. Only in :mod:`cProfile`." msgstr "" -#: ../../library/profile.rst:290 +#: ../../library/profile.rst:299 msgid "Stop collecting profiling data. Only in :mod:`cProfile`." msgstr "" -#: ../../library/profile.rst:294 +#: ../../library/profile.rst:303 msgid "" "Stop collecting profiling data and record the results internally as the " "current profile." msgstr "" -#: ../../library/profile.rst:299 +#: ../../library/profile.rst:308 msgid "" "Create a :class:`~pstats.Stats` object based on the current profile and " "print the results to stdout." msgstr "" -#: ../../library/profile.rst:302 +#: ../../library/profile.rst:311 msgid "" "The *sort* parameter specifies the sorting order of the displayed " "statistics. It accepts a single key or a tuple of keys to enable multi-level " "sorting, as in :func:`Stats.sort_stats `." msgstr "" -#: ../../library/profile.rst:306 +#: ../../library/profile.rst:315 msgid ":meth:`~Profile.print_stats` now accepts a tuple of keys." msgstr "" -#: ../../library/profile.rst:311 +#: ../../library/profile.rst:320 msgid "Write the results of the current profile to *filename*." msgstr "" -#: ../../library/profile.rst:315 +#: ../../library/profile.rst:324 msgid "Profile the cmd via :func:`exec`." msgstr "" -#: ../../library/profile.rst:319 +#: ../../library/profile.rst:328 msgid "" "Profile the cmd via :func:`exec` with the specified global and local " "environment." msgstr "" -#: ../../library/profile.rst:324 +#: ../../library/profile.rst:333 msgid "Profile ``func(*args, **kwargs)``" msgstr "" -#: ../../library/profile.rst:326 +#: ../../library/profile.rst:335 msgid "" "Note that profiling will only work if the called command/function actually " "returns. If the interpreter is terminated (e.g. via a :func:`sys.exit` call " @@ -558,23 +566,23 @@ msgid "" "printed." msgstr "" -#: ../../library/profile.rst:334 +#: ../../library/profile.rst:343 msgid "The :class:`Stats` Class" -msgstr "" +msgstr ":class:`Stats` 類別" -#: ../../library/profile.rst:336 +#: ../../library/profile.rst:345 msgid "" "Analysis of the profiler data is done using the :class:`~pstats.Stats` class." msgstr "" -#: ../../library/profile.rst:343 +#: ../../library/profile.rst:352 msgid "" "This class constructor creates an instance of a \"statistics object\" from a " "*filename* (or list of filenames) or from a :class:`Profile` instance. " "Output will be printed to the stream specified by *stream*." msgstr "" -#: ../../library/profile.rst:347 +#: ../../library/profile.rst:356 msgid "" "The file selected by the above constructor must have been created by the " "corresponding version of :mod:`profile` or :mod:`cProfile`. To be specific, " @@ -588,40 +596,41 @@ msgid "" "can be used." msgstr "" -#: ../../library/profile.rst:358 +#: ../../library/profile.rst:367 msgid "" "Instead of reading the profile data from a file, a :class:`cProfile.Profile` " "or :class:`profile.Profile` object can be used as the profile data source." msgstr "" -#: ../../library/profile.rst:361 +#: ../../library/profile.rst:370 msgid ":class:`Stats` objects have the following methods:" -msgstr "" +msgstr ":class:`Stats` 物件有以下方法:" -#: ../../library/profile.rst:365 +#: ../../library/profile.rst:374 msgid "" "This method for the :class:`Stats` class removes all leading path " "information from file names. It is very useful in reducing the size of the " "printout to fit within (close to) 80 columns. This method modifies the " "object, and the stripped information is lost. After performing a strip " "operation, the object is considered to have its entries in a \"random\" " -"order, as it was just after object initialization and loading. If :meth:" -"`~pstats.Stats.strip_dirs` causes two function names to be indistinguishable " -"(they are on the same line of the same filename, and have the same function " -"name), then the statistics for these two entries are accumulated into a " -"single entry." +"order, as it was just after object initialization and loading. " +"If :meth:`~pstats.Stats.strip_dirs` causes two function names to be " +"indistinguishable (they are on the same line of the same filename, and have " +"the same function name), then the statistics for these two entries are " +"accumulated into a single entry." msgstr "" -#: ../../library/profile.rst:379 +#: ../../library/profile.rst:388 msgid "" "This method of the :class:`Stats` class accumulates additional profiling " "information into the current profiling object. Its arguments should refer " -"to filenames created by the corresponding version of :func:`profile.run` or :" -"func:`cProfile.run`. Statistics for identically named (re: file, line, name) " -"functions are automatically accumulated into single function statistics." +"to filenames created by the corresponding version of :func:`profile.run` " +"or :func:`cProfile.run`. Statistics for identically named (re: file, line, " +"name) functions are automatically accumulated into single function " +"statistics." msgstr "" -#: ../../library/profile.rst:389 +#: ../../library/profile.rst:398 msgid "" "Save the data loaded into the :class:`Stats` object to a file named " "*filename*. The file is created if it does not exist, and is overwritten if " @@ -629,7 +638,7 @@ msgid "" "the :class:`profile.Profile` and :class:`cProfile.Profile` classes." msgstr "" -#: ../../library/profile.rst:397 +#: ../../library/profile.rst:406 msgid "" "This method modifies the :class:`Stats` object by sorting it according to " "the supplied criteria. The argument can be either a string or a SortKey " @@ -639,7 +648,7 @@ msgid "" "prone." msgstr "" -#: ../../library/profile.rst:404 +#: ../../library/profile.rst:413 msgid "" "When more than one key is provided, then additional keys are used as " "secondary criteria when there is equality in all keys selected before them. " @@ -648,178 +657,178 @@ msgid "" "function names) by sorting by file name." msgstr "" -#: ../../library/profile.rst:410 +#: ../../library/profile.rst:419 msgid "" "For the string argument, abbreviations can be used for any key names, as " "long as the abbreviation is unambiguous." msgstr "" -#: ../../library/profile.rst:413 +#: ../../library/profile.rst:422 msgid "The following are the valid string and SortKey:" msgstr "" -#: ../../library/profile.rst:416 +#: ../../library/profile.rst:425 msgid "Valid String Arg" msgstr "" -#: ../../library/profile.rst:416 +#: ../../library/profile.rst:425 msgid "Valid enum Arg" msgstr "" -#: ../../library/profile.rst:416 +#: ../../library/profile.rst:425 msgid "Meaning" msgstr "含義" -#: ../../library/profile.rst:418 +#: ../../library/profile.rst:427 msgid "``'calls'``" msgstr "``'calls'``" -#: ../../library/profile.rst:418 +#: ../../library/profile.rst:427 msgid "SortKey.CALLS" msgstr "SortKey.CALLS" -#: ../../library/profile.rst:418 ../../library/profile.rst:430 +#: ../../library/profile.rst:427 ../../library/profile.rst:439 msgid "call count" msgstr "" -#: ../../library/profile.rst:420 +#: ../../library/profile.rst:429 msgid "``'cumulative'``" msgstr "``'cumulative'``" -#: ../../library/profile.rst:420 +#: ../../library/profile.rst:429 msgid "SortKey.CUMULATIVE" msgstr "SortKey.CUMULATIVE" -#: ../../library/profile.rst:420 ../../library/profile.rst:422 +#: ../../library/profile.rst:429 ../../library/profile.rst:431 msgid "cumulative time" msgstr "" -#: ../../library/profile.rst:422 +#: ../../library/profile.rst:431 msgid "``'cumtime'``" msgstr "``'cumtime'``" -#: ../../library/profile.rst:422 ../../library/profile.rst:424 -#: ../../library/profile.rst:428 ../../library/profile.rst:430 -#: ../../library/profile.rst:444 +#: ../../library/profile.rst:431 ../../library/profile.rst:433 +#: ../../library/profile.rst:437 ../../library/profile.rst:439 +#: ../../library/profile.rst:453 msgid "N/A" msgstr "N/A" -#: ../../library/profile.rst:424 +#: ../../library/profile.rst:433 msgid "``'file'``" msgstr "``'file'``" -#: ../../library/profile.rst:424 ../../library/profile.rst:426 -#: ../../library/profile.rst:428 +#: ../../library/profile.rst:433 ../../library/profile.rst:435 +#: ../../library/profile.rst:437 msgid "file name" msgstr "file name(檔案名稱)" -#: ../../library/profile.rst:426 +#: ../../library/profile.rst:435 msgid "``'filename'``" msgstr "``'filename'``" -#: ../../library/profile.rst:426 +#: ../../library/profile.rst:435 msgid "SortKey.FILENAME" msgstr "SortKey.FILENAME" -#: ../../library/profile.rst:428 +#: ../../library/profile.rst:437 msgid "``'module'``" msgstr "``'module'``" -#: ../../library/profile.rst:430 +#: ../../library/profile.rst:439 msgid "``'ncalls'``" msgstr "``'ncalls'``" -#: ../../library/profile.rst:432 +#: ../../library/profile.rst:441 msgid "``'pcalls'``" msgstr "``'pcalls'``" -#: ../../library/profile.rst:432 +#: ../../library/profile.rst:441 msgid "SortKey.PCALLS" msgstr "SortKey.PCALLS" -#: ../../library/profile.rst:432 +#: ../../library/profile.rst:441 msgid "primitive call count" msgstr "" -#: ../../library/profile.rst:434 +#: ../../library/profile.rst:443 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/profile.rst:434 +#: ../../library/profile.rst:443 msgid "SortKey.LINE" msgstr "SortKey.LINE" -#: ../../library/profile.rst:434 +#: ../../library/profile.rst:443 msgid "line number" msgstr "列號" -#: ../../library/profile.rst:436 +#: ../../library/profile.rst:445 msgid "``'name'``" msgstr "``'name'``" -#: ../../library/profile.rst:436 +#: ../../library/profile.rst:445 msgid "SortKey.NAME" msgstr "SortKey.NAME" -#: ../../library/profile.rst:436 +#: ../../library/profile.rst:445 msgid "function name" msgstr "" -#: ../../library/profile.rst:438 +#: ../../library/profile.rst:447 msgid "``'nfl'``" msgstr "``'nfl'``" -#: ../../library/profile.rst:438 +#: ../../library/profile.rst:447 msgid "SortKey.NFL" msgstr "SortKey.NFL" -#: ../../library/profile.rst:438 +#: ../../library/profile.rst:447 msgid "name/file/line" msgstr "" -#: ../../library/profile.rst:440 +#: ../../library/profile.rst:449 msgid "``'stdname'``" msgstr "``'stdname'``" -#: ../../library/profile.rst:440 +#: ../../library/profile.rst:449 msgid "SortKey.STDNAME" msgstr "SortKey.STDNAME" -#: ../../library/profile.rst:440 +#: ../../library/profile.rst:449 msgid "standard name" msgstr "" -#: ../../library/profile.rst:442 +#: ../../library/profile.rst:451 msgid "``'time'``" msgstr "``'time'``" -#: ../../library/profile.rst:442 +#: ../../library/profile.rst:451 msgid "SortKey.TIME" msgstr "SortKey.TIME" -#: ../../library/profile.rst:442 ../../library/profile.rst:444 +#: ../../library/profile.rst:451 ../../library/profile.rst:453 msgid "internal time" msgstr "" -#: ../../library/profile.rst:444 +#: ../../library/profile.rst:453 msgid "``'tottime'``" msgstr "``'tottime'``" -#: ../../library/profile.rst:447 +#: ../../library/profile.rst:456 msgid "" "Note that all sorts on statistics are in descending order (placing most time " "consuming items first), where as name, file, and line number searches are in " -"ascending order (alphabetical). The subtle distinction between ``SortKey." -"NFL`` and ``SortKey.STDNAME`` is that the standard name is a sort of the " -"name as printed, which means that the embedded line numbers get compared in " -"an odd way. For example, lines 3, 20, and 40 would (if the file names were " -"the same) appear in the string order 20, 3 and 40. In contrast, ``SortKey." -"NFL`` does a numeric compare of the line numbers. In fact, " +"ascending order (alphabetical). The subtle distinction between " +"``SortKey.NFL`` and ``SortKey.STDNAME`` is that the standard name is a sort " +"of the name as printed, which means that the embedded line numbers get " +"compared in an odd way. For example, lines 3, 20, and 40 would (if the file " +"names were the same) appear in the string order 20, 3 and 40. In contrast, " +"``SortKey.NFL`` does a numeric compare of the line numbers. In fact, " "``sort_stats(SortKey.NFL)`` is the same as ``sort_stats(SortKey.NAME, " "SortKey.FILENAME, SortKey.LINE)``." msgstr "" -#: ../../library/profile.rst:458 +#: ../../library/profile.rst:467 msgid "" "For backward-compatibility reasons, the numeric arguments ``-1``, ``0``, " "``1``, and ``2`` are permitted. They are interpreted as ``'stdname'``, " @@ -828,31 +837,32 @@ msgid "" "used, and additional arguments will be silently ignored." msgstr "" -#: ../../library/profile.rst:466 +#: ../../library/profile.rst:475 msgid "Added the SortKey enum." msgstr "" -#: ../../library/profile.rst:471 +#: ../../library/profile.rst:480 msgid "" "This method for the :class:`Stats` class reverses the ordering of the basic " "list within the object. Note that by default ascending vs descending order " "is properly selected based on the sort key of choice." msgstr "" -#: ../../library/profile.rst:481 +#: ../../library/profile.rst:490 msgid "" "This method for the :class:`Stats` class prints out a report as described in " "the :func:`profile.run` definition." msgstr "" -#: ../../library/profile.rst:484 +#: ../../library/profile.rst:493 msgid "" -"The order of the printing is based on the last :meth:`~pstats.Stats." -"sort_stats` operation done on the object (subject to caveats in :meth:" -"`~pstats.Stats.add` and :meth:`~pstats.Stats.strip_dirs`)." +"The order of the printing is based on the " +"last :meth:`~pstats.Stats.sort_stats` operation done on the object (subject " +"to caveats in :meth:`~pstats.Stats.add` " +"and :meth:`~pstats.Stats.strip_dirs`)." msgstr "" -#: ../../library/profile.rst:489 +#: ../../library/profile.rst:498 msgid "" "The arguments provided (if any) can be used to limit the list down to the " "significant entries. Initially, the list is taken to be the complete set of " @@ -864,28 +874,28 @@ msgid "" "example::" msgstr "" -#: ../../library/profile.rst:498 +#: ../../library/profile.rst:507 msgid "print_stats(.1, 'foo:')" msgstr "print_stats(.1, 'foo:')" -#: ../../library/profile.rst:500 +#: ../../library/profile.rst:509 msgid "" "would first limit the printing to first 10% of list, and then only print " "functions that were part of filename :file:`.\\*foo:`. In contrast, the " "command::" msgstr "" -#: ../../library/profile.rst:504 +#: ../../library/profile.rst:513 msgid "print_stats('foo:', .1)" msgstr "print_stats('foo:', .1)" -#: ../../library/profile.rst:506 +#: ../../library/profile.rst:515 msgid "" "would limit the list to all functions having file names :file:`.\\*foo:`, " "and then proceed to only print the first 10% of them." msgstr "" -#: ../../library/profile.rst:512 +#: ../../library/profile.rst:521 msgid "" "This method for the :class:`Stats` class prints a list of all functions that " "called each function in the profiled database. The ordering is identical to " @@ -895,7 +905,7 @@ msgid "" "produced the stats:" msgstr "" -#: ../../library/profile.rst:519 +#: ../../library/profile.rst:528 msgid "" "With :mod:`profile`, a number is shown in parentheses after each caller to " "show how many times this specific call was made. For convenience, a second " @@ -903,14 +913,14 @@ msgid "" "at the right." msgstr "" -#: ../../library/profile.rst:524 +#: ../../library/profile.rst:533 msgid "" "With :mod:`cProfile`, each caller is preceded by three numbers: the number " "of times this specific call was made, and the total and cumulative times " "spent in the current function while it was invoked by this specific caller." msgstr "" -#: ../../library/profile.rst:532 +#: ../../library/profile.rst:541 msgid "" "This method for the :class:`Stats` class prints a list of all function that " "were called by the indicated function. Aside from this reversal of " @@ -918,7 +928,7 @@ msgid "" "are identical to the :meth:`~pstats.Stats.print_callers` method." msgstr "" -#: ../../library/profile.rst:540 +#: ../../library/profile.rst:549 msgid "" "This method returns an instance of StatsProfile, which contains a mapping of " "function names to instances of FunctionProfile. Each FunctionProfile " @@ -926,17 +936,17 @@ msgid "" "long the function took to run, how many times it was called, etc..." msgstr "" -#: ../../library/profile.rst:545 +#: ../../library/profile.rst:554 msgid "" "Added the following dataclasses: StatsProfile, FunctionProfile. Added the " "following function: get_stats_profile." msgstr "" -#: ../../library/profile.rst:552 +#: ../../library/profile.rst:561 msgid "What Is Deterministic Profiling?" msgstr "" -#: ../../library/profile.rst:554 +#: ../../library/profile.rst:563 msgid "" ":dfn:`Deterministic profiling` is meant to reflect the fact that all " "*function call*, *function return*, and *exception* events are monitored, " @@ -949,7 +959,7 @@ msgid "" "being spent." msgstr "" -#: ../../library/profile.rst:563 +#: ../../library/profile.rst:572 msgid "" "In Python, since there is an interpreter active during execution, the " "presence of instrumented code is not required in order to do deterministic " @@ -961,7 +971,7 @@ msgid "" "time statistics about the execution of a Python program." msgstr "" -#: ../../library/profile.rst:572 +#: ../../library/profile.rst:581 msgid "" "Call count statistics can be used to identify bugs in code (surprising " "counts), and to identify possible inline-expansion points (high call " @@ -973,11 +983,11 @@ msgid "" "compared to iterative implementations." msgstr "" -#: ../../library/profile.rst:585 +#: ../../library/profile.rst:594 msgid "Limitations" msgstr "限制" -#: ../../library/profile.rst:587 +#: ../../library/profile.rst:596 msgid "" "One limitation has to do with accuracy of timing information. There is a " "fundamental problem with deterministic profilers involving accuracy. The " @@ -988,7 +998,7 @@ msgid "" "first error induces a second source of error." msgstr "" -#: ../../library/profile.rst:595 +#: ../../library/profile.rst:604 msgid "" "The second problem is that it \"takes a while\" from when an event is " "dispatched until the profiler's call to get the time actually *gets* the " @@ -1001,7 +1011,7 @@ msgid "" "clock tick), but it *can* accumulate and become very significant." msgstr "" -#: ../../library/profile.rst:605 +#: ../../library/profile.rst:614 msgid "" "The problem is more important with :mod:`profile` than with the lower-" "overhead :mod:`cProfile`. For this reason, :mod:`profile` provides a means " @@ -1015,11 +1025,11 @@ msgid "" "calibration." msgstr "" -#: ../../library/profile.rst:619 +#: ../../library/profile.rst:628 msgid "Calibration" msgstr "校正" -#: ../../library/profile.rst:621 +#: ../../library/profile.rst:630 msgid "" "The profiler of the :mod:`profile` module subtracts a constant from each " "event handling time to compensate for the overhead of calling the time " @@ -1028,7 +1038,7 @@ msgid "" "platform (see :ref:`profile-limitations`). ::" msgstr "" -#: ../../library/profile.rst:627 +#: ../../library/profile.rst:636 msgid "" "import profile\n" "pr = profile.Profile()\n" @@ -1040,7 +1050,7 @@ msgstr "" "for i in range(5):\n" " print(pr.calibrate(10000))" -#: ../../library/profile.rst:632 +#: ../../library/profile.rst:641 msgid "" "The method executes the number of Python calls given by the argument, " "directly and again under the profiler, measuring the time for both. It then " @@ -1050,19 +1060,19 @@ msgid "" "4.04e-6." msgstr "" -#: ../../library/profile.rst:638 +#: ../../library/profile.rst:647 msgid "" "The object of this exercise is to get a fairly consistent result. If your " "computer is *very* fast, or your timer function has poor resolution, you " "might have to pass 100000, or even 1000000, to get consistent results." msgstr "" -#: ../../library/profile.rst:642 +#: ../../library/profile.rst:651 msgid "" "When you have a consistent answer, there are three ways you can use it::" msgstr "" -#: ../../library/profile.rst:644 +#: ../../library/profile.rst:653 msgid "" "import profile\n" "\n" @@ -1077,40 +1087,40 @@ msgid "" "pr = profile.Profile(bias=your_computed_bias)" msgstr "" -#: ../../library/profile.rst:656 +#: ../../library/profile.rst:665 msgid "" "If you have a choice, you are better off choosing a smaller constant, and " "then your results will \"less often\" show up as negative in profile " "statistics." msgstr "" -#: ../../library/profile.rst:662 +#: ../../library/profile.rst:671 msgid "Using a custom timer" msgstr "" -#: ../../library/profile.rst:664 +#: ../../library/profile.rst:673 msgid "" "If you want to change how current time is determined (for example, to force " "use of wall-clock time or elapsed process time), pass the timing function " "you want to the :class:`Profile` class constructor::" msgstr "" -#: ../../library/profile.rst:668 +#: ../../library/profile.rst:677 msgid "pr = profile.Profile(your_time_func)" msgstr "pr = profile.Profile(your_time_func)" -#: ../../library/profile.rst:670 +#: ../../library/profile.rst:679 msgid "" "The resulting profiler will then call ``your_time_func``. Depending on " "whether you are using :class:`profile.Profile` or :class:`cProfile.Profile`, " "``your_time_func``'s return value will be interpreted differently:" msgstr "" -#: ../../library/profile.rst:674 +#: ../../library/profile.rst:683 msgid ":class:`profile.Profile`" msgstr ":class:`profile.Profile`" -#: ../../library/profile.rst:675 +#: ../../library/profile.rst:684 msgid "" "``your_time_func`` should return a single number, or a list of numbers whose " "sum is the current time (like what :func:`os.times` returns). If the " @@ -1119,7 +1129,7 @@ msgid "" "routine." msgstr "" -#: ../../library/profile.rst:681 +#: ../../library/profile.rst:690 msgid "" "Be warned that you should calibrate the profiler class for the timer " "function that you choose (see :ref:`profile-calibration`). For most " @@ -1131,11 +1141,11 @@ msgid "" "along with the appropriate calibration constant." msgstr "" -#: ../../library/profile.rst:690 +#: ../../library/profile.rst:699 msgid ":class:`cProfile.Profile`" msgstr ":class:`cProfile.Profile`" -#: ../../library/profile.rst:691 +#: ../../library/profile.rst:700 msgid "" "``your_time_func`` should return a single number. If it returns integers, " "you can also invoke the class constructor with a second argument specifying " @@ -1144,11 +1154,11 @@ msgid "" "you would construct the :class:`Profile` instance as follows::" msgstr "" -#: ../../library/profile.rst:697 +#: ../../library/profile.rst:706 msgid "pr = cProfile.Profile(your_integer_time_func, 0.001)" msgstr "pr = cProfile.Profile(your_integer_time_func, 0.001)" -#: ../../library/profile.rst:699 +#: ../../library/profile.rst:708 msgid "" "As the :class:`cProfile.Profile` class cannot be calibrated, custom timer " "functions should be used with care and should be as fast as possible. For " @@ -1156,11 +1166,11 @@ msgid "" "in the C source of the internal :mod:`!_lsprof` module." msgstr "" -#: ../../library/profile.rst:704 +#: ../../library/profile.rst:713 msgid "" "Python 3.3 adds several new functions in :mod:`time` that can be used to " -"make precise measurements of process or wall-clock time. For example, see :" -"func:`time.perf_counter`." +"make precise measurements of process or wall-clock time. For example, " +"see :func:`time.perf_counter`." msgstr "" #: ../../library/profile.rst:16 diff --git a/library/pwd.po b/library/pwd.po index aac5275e62..4f4a5acc84 100644 --- a/library/pwd.po +++ b/library/pwd.po @@ -144,11 +144,10 @@ msgid "" "The uid and gid items are integers, all others are strings. :exc:`KeyError` " "is raised if the entry asked for cannot be found." msgstr "" -"uid 和 gid 項目為整數,其他項目都是字串。如果找不到請求的條目,則會引發 :exc:" -"`KeyError`。" +"uid 和 gid 項目為整數,其他項目都是字串。如果找不到請求的條目,則會引" +"發 :exc:`KeyError`。" #: ../../library/pwd.rst:42 -#, fuzzy msgid "" "In traditional Unix the field ``pw_passwd`` usually contains a password " "encrypted with a DES derived algorithm. However most modern unices use a " @@ -158,12 +157,11 @@ msgid "" "world readable. Whether the *pw_passwd* field contains anything useful is " "system-dependent." msgstr "" -"在傳統的 Unix 中,``pw_passwd`` 欄位通常包含一個使用 DES 衍生演算法加密的密碼" -"(參見模組 :mod:`crypt`)。然而,大多數現代 Unix 是使用所謂的 *shadow " -"password* 系統。在那些 Unix 上,*pw_passwd* 欄位僅包含一個星號 (``'*'``) 或字" -"母 ``'x'``,其中加密密碼存儲在非全域可讀的 (not world readable) :file:`/etc/" -"shadow` 文件中。 *pw_passwd* 欄位是否包含任何有用的內容取決於系統。如果可用," -"應該要在需要存取加密密碼的地方使用 :mod:`spwd` 模組。" +"在傳統的 Unix 中,``pw_passwd`` 欄位通常包含一個使用 DES 衍生演算法加密的密" +"碼。然而,大多數現代 Unix 是使用所謂的 *shadow password* 系統。在那些 Unix " +"上,*pw_passwd* 欄位僅包含一個星號 (``'*'``) 或字母 ``'x'``,其中加密密碼存儲" +"在非全域可讀的 (not world readable) :file:`/etc/shadow` 檔案中。*pw_passwd* " +"欄位是否包含任何有用的內容取決於系統。" #: ../../library/pwd.rst:50 msgid "It defines the following items:" diff --git a/library/python.po b/library/python.po index 804cb269c0..2c76635377 100644 --- a/library/python.po +++ b/library/python.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -28,3 +27,5 @@ msgid "" "related to the Python interpreter and its interaction with its environment. " "Here's an overview:" msgstr "" +"本章節所描述的模組提供了與 Python 直譯器及其與環境互動相關的廣泛服務。以下是" +"概觀:" diff --git a/library/re.po b/library/re.po index d6c4730895..f62cafba70 100644 --- a/library/re.po +++ b/library/re.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-04-11 00:15+0000\n" "PO-Revision-Date: 2023-09-16 14:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -169,7 +169,7 @@ msgstr "" msgid "The special characters are:" msgstr "" -#: ../../library/re.rst:101 ../../library/re.rst:1649 +#: ../../library/re.rst:101 ../../library/re.rst:1658 msgid "``.``" msgstr "``.``" @@ -379,19 +379,24 @@ msgstr "" #: ../../library/re.rst:253 msgid "" -"Special characters lose their special meaning inside sets. For example, " -"``[(+*)]`` will match any of the literal characters ``'('``, ``'+'``, " -"``'*'``, or ``')'``." +"Special characters except backslash lose their special meaning inside sets. " +"For example, ``[(+*)]`` will match any of the literal characters ``'('``, " +"``'+'``, ``'*'``, or ``')'``." msgstr "" -#: ../../library/re.rst:259 +#: ../../library/re.rst:260 msgid "" -"Character classes such as ``\\w`` or ``\\S`` (defined below) are also " -"accepted inside a set, although the characters they match depend on the " -"flags_ used." +"Backslash either escapes characters which have special meaning in a set such " +"as ``'-'``, ``']'``, ``'^'`` and ``'\\\\'`` itself or signals a special " +"sequence which represents a single character such as ``\\xa0`` or ``\\n`` or " +"a character class such as ``\\w`` or ``\\S`` (defined below). Note that " +"``\\b`` represents a single \"backspace\" character, not a word boundary as " +"outside a set, and numeric escapes such as ``\\1`` are always octal escapes, " +"not group references. Special sequences which do not match a single " +"character such as ``\\A`` and ``\\Z`` are not allowed." msgstr "" -#: ../../library/re.rst:264 +#: ../../library/re.rst:273 msgid "" "Characters that are not within a range can be matched by :dfn:" "`complementing` the set. If the first character of the set is ``'^'``, all " @@ -401,7 +406,7 @@ msgid "" "first character in the set." msgstr "" -#: ../../library/re.rst:271 +#: ../../library/re.rst:280 msgid "" "To match a literal ``']'`` inside a set, precede it with a backslash, or " "place it at the beginning of the set. For example, both ``[()[\\]{}]`` and " @@ -409,7 +414,7 @@ msgid "" "and parentheses." msgstr "" -#: ../../library/re.rst:281 +#: ../../library/re.rst:290 msgid "" "Support of nested sets and set operations as in `Unicode Technical Standard " "#18`_ might be added in the future. This would change the syntax, so to " @@ -419,17 +424,17 @@ msgid "" "``'||'``. To avoid a warning escape them with a backslash." msgstr "" -#: ../../library/re.rst:291 +#: ../../library/re.rst:300 msgid "" ":exc:`FutureWarning` is raised if a character set contains constructs that " "will change semantically in the future." msgstr "" -#: ../../library/re.rst:297 +#: ../../library/re.rst:306 msgid "``|``" msgstr "``|``" -#: ../../library/re.rst:298 +#: ../../library/re.rst:307 msgid "" "``A|B``, where *A* and *B* can be arbitrary REs, creates a regular " "expression that will match either *A* or *B*. An arbitrary number of REs " @@ -442,11 +447,11 @@ msgid "" "use ``\\|``, or enclose it inside a character class, as in ``[|]``." msgstr "" -#: ../../library/re.rst:311 +#: ../../library/re.rst:320 msgid "``(...)``" msgstr "``(...)``" -#: ../../library/re.rst:312 +#: ../../library/re.rst:321 msgid "" "Matches whatever regular expression is inside the parentheses, and indicates " "the start and end of a group; the contents of a group can be retrieved after " @@ -456,11 +461,11 @@ msgid "" "character class: ``[(]``, ``[)]``." msgstr "" -#: ../../library/re.rst:320 +#: ../../library/re.rst:329 msgid "``(?...)``" msgstr "``(?...)``" -#: ../../library/re.rst:321 +#: ../../library/re.rst:330 msgid "" "This is an extension notation (a ``'?'`` following a ``'('`` is not " "meaningful otherwise). The first character after the ``'?'`` determines " @@ -469,46 +474,46 @@ msgid "" "rule. Following are the currently supported extensions." msgstr "" -#: ../../library/re.rst:327 +#: ../../library/re.rst:336 msgid "``(?aiLmsux)``" msgstr "``(?aiLmsux)``" -#: ../../library/re.rst:328 +#: ../../library/re.rst:337 msgid "" "(One or more letters from the set ``'a'``, ``'i'``, ``'L'``, ``'m'``, " "``'s'``, ``'u'``, ``'x'``.) The group matches the empty string; the letters " "set the corresponding flags for the entire regular expression:" msgstr "" -#: ../../library/re.rst:333 ../../library/re.rst:365 +#: ../../library/re.rst:342 ../../library/re.rst:374 msgid ":const:`re.A` (ASCII-only matching)" msgstr "" -#: ../../library/re.rst:334 ../../library/re.rst:366 +#: ../../library/re.rst:343 ../../library/re.rst:375 msgid ":const:`re.I` (ignore case)" msgstr "" -#: ../../library/re.rst:335 ../../library/re.rst:367 +#: ../../library/re.rst:344 ../../library/re.rst:376 msgid ":const:`re.L` (locale dependent)" msgstr "" -#: ../../library/re.rst:336 ../../library/re.rst:368 +#: ../../library/re.rst:345 ../../library/re.rst:377 msgid ":const:`re.M` (multi-line)" msgstr "" -#: ../../library/re.rst:337 ../../library/re.rst:369 +#: ../../library/re.rst:346 ../../library/re.rst:378 msgid ":const:`re.S` (dot matches all)" msgstr "" -#: ../../library/re.rst:338 ../../library/re.rst:370 +#: ../../library/re.rst:347 ../../library/re.rst:379 msgid ":const:`re.U` (Unicode matching)" msgstr "" -#: ../../library/re.rst:339 ../../library/re.rst:371 +#: ../../library/re.rst:348 ../../library/re.rst:380 msgid ":const:`re.X` (verbose)" msgstr "" -#: ../../library/re.rst:341 +#: ../../library/re.rst:350 msgid "" "(The flags are described in :ref:`contents-of-module-re`.) This is useful if " "you wish to include the flags as part of the regular expression, instead of " @@ -516,15 +521,15 @@ msgid "" "be used first in the expression string." msgstr "" -#: ../../library/re.rst:347 +#: ../../library/re.rst:356 msgid "This construction can only be used at the start of the expression." msgstr "" -#: ../../library/re.rst:352 +#: ../../library/re.rst:361 msgid "``(?:...)``" msgstr "``(?:...)``" -#: ../../library/re.rst:353 +#: ../../library/re.rst:362 msgid "" "A non-capturing version of regular parentheses. Matches whatever regular " "expression is inside the parentheses, but the substring matched by the group " @@ -532,11 +537,11 @@ msgid "" "pattern." msgstr "" -#: ../../library/re.rst:358 +#: ../../library/re.rst:367 msgid "``(?aiLmsux-imsx:...)``" msgstr "``(?aiLmsux-imsx:...)``" -#: ../../library/re.rst:359 +#: ../../library/re.rst:368 msgid "" "(Zero or more letters from the set ``'a'``, ``'i'``, ``'L'``, ``'m'``, " "``'s'``, ``'u'``, ``'x'``, optionally followed by ``'-'`` followed by one or " @@ -544,11 +549,11 @@ msgid "" "or remove the corresponding flags for the part of the expression:" msgstr "" -#: ../../library/re.rst:373 +#: ../../library/re.rst:382 msgid "(The flags are described in :ref:`contents-of-module-re`.)" msgstr "" -#: ../../library/re.rst:375 +#: ../../library/re.rst:384 msgid "" "The letters ``'a'``, ``'L'`` and ``'u'`` are mutually exclusive when used as " "inline flags, so they can't be combined or follow ``'-'``. Instead, when " @@ -561,15 +566,15 @@ msgid "" "restored outside of the group." msgstr "" -#: ../../library/re.rst:387 +#: ../../library/re.rst:396 msgid "The letters ``'a'``, ``'L'`` and ``'u'`` also can be used in a group." msgstr "" -#: ../../library/re.rst:390 +#: ../../library/re.rst:399 msgid "``(?>...)``" msgstr "``(?>...)``" -#: ../../library/re.rst:391 +#: ../../library/re.rst:400 msgid "" "Attempts to match ``...`` as if it was a separate regular expression, and if " "successful, continues to match the rest of the pattern following it. If the " @@ -583,11 +588,11 @@ msgid "" "thus fail to match." msgstr "" -#: ../../library/re.rst:407 +#: ../../library/re.rst:416 msgid "``(?P...)``" msgstr "``(?P...)``" -#: ../../library/re.rst:408 +#: ../../library/re.rst:417 msgid "" "Similar to regular parentheses, but the substring matched by the group is " "accessible via the symbolic group name *name*. Group names must be valid " @@ -597,108 +602,108 @@ msgid "" "the group were not named." msgstr "" -#: ../../library/re.rst:415 +#: ../../library/re.rst:424 msgid "" "Named groups can be referenced in three contexts. If the pattern is ``(?" "P['\"]).*?(?P=quote)`` (i.e. matching a string quoted with either " "single or double quotes):" msgstr "" -#: ../../library/re.rst:420 +#: ../../library/re.rst:429 msgid "Context of reference to group \"quote\"" msgstr "" -#: ../../library/re.rst:420 +#: ../../library/re.rst:429 msgid "Ways to reference it" msgstr "" -#: ../../library/re.rst:422 +#: ../../library/re.rst:431 msgid "in the same pattern itself" msgstr "" -#: ../../library/re.rst:422 +#: ../../library/re.rst:431 msgid "``(?P=quote)`` (as shown)" msgstr "" -#: ../../library/re.rst:423 ../../library/re.rst:430 +#: ../../library/re.rst:432 ../../library/re.rst:439 msgid "``\\1``" msgstr "``\\1``" -#: ../../library/re.rst:425 +#: ../../library/re.rst:434 msgid "when processing match object *m*" msgstr "" -#: ../../library/re.rst:425 +#: ../../library/re.rst:434 msgid "``m.group('quote')``" msgstr "``m.group('quote')``" -#: ../../library/re.rst:426 +#: ../../library/re.rst:435 msgid "``m.end('quote')`` (etc.)" msgstr "" -#: ../../library/re.rst:428 +#: ../../library/re.rst:437 msgid "in a string passed to the *repl* argument of ``re.sub()``" msgstr "" -#: ../../library/re.rst:428 +#: ../../library/re.rst:437 msgid "``\\g``" msgstr "``\\g``" -#: ../../library/re.rst:429 +#: ../../library/re.rst:438 msgid "``\\g<1>``" msgstr "``\\g<1>``" -#: ../../library/re.rst:433 +#: ../../library/re.rst:442 msgid "" "In :class:`bytes` patterns, group *name* can only contain bytes in the ASCII " "range (``b'\\x00'``-``b'\\x7f'``)." msgstr "" -#: ../../library/re.rst:439 +#: ../../library/re.rst:448 msgid "``(?P=name)``" msgstr "``(?P=name)``" -#: ../../library/re.rst:440 +#: ../../library/re.rst:449 msgid "" "A backreference to a named group; it matches whatever text was matched by " "the earlier group named *name*." msgstr "" -#: ../../library/re.rst:445 +#: ../../library/re.rst:454 msgid "``(?#...)``" msgstr "``(?#...)``" -#: ../../library/re.rst:446 +#: ../../library/re.rst:455 msgid "A comment; the contents of the parentheses are simply ignored." msgstr "" -#: ../../library/re.rst:450 +#: ../../library/re.rst:459 msgid "``(?=...)``" msgstr "``(?=...)``" -#: ../../library/re.rst:451 +#: ../../library/re.rst:460 msgid "" "Matches if ``...`` matches next, but doesn't consume any of the string. " "This is called a :dfn:`lookahead assertion`. For example, ``Isaac (?" "=Asimov)`` will match ``'Isaac '`` only if it's followed by ``'Asimov'``." msgstr "" -#: ../../library/re.rst:457 +#: ../../library/re.rst:466 msgid "``(?!...)``" msgstr "``(?!...)``" -#: ../../library/re.rst:458 +#: ../../library/re.rst:467 msgid "" "Matches if ``...`` doesn't match next. This is a :dfn:`negative lookahead " "assertion`. For example, ``Isaac (?!Asimov)`` will match ``'Isaac '`` only " "if it's *not* followed by ``'Asimov'``." msgstr "" -#: ../../library/re.rst:464 +#: ../../library/re.rst:473 msgid "``(?<=...)``" msgstr "``(?<=...)``" -#: ../../library/re.rst:465 +#: ../../library/re.rst:474 msgid "" "Matches if the current position in the string is preceded by a match for " "``...`` that ends at the current position. This is called a :dfn:`positive " @@ -712,19 +717,19 @@ msgid "" "func:`match` function:" msgstr "" -#: ../../library/re.rst:480 +#: ../../library/re.rst:489 msgid "This example looks for a word following a hyphen:" msgstr "" -#: ../../library/re.rst:486 +#: ../../library/re.rst:495 msgid "Added support for group references of fixed length." msgstr "" -#: ../../library/re.rst:491 +#: ../../library/re.rst:500 msgid "``(?'``." msgstr "" -#: ../../library/re.rst:509 +#: ../../library/re.rst:518 msgid "" "Group *id* can only contain ASCII digits. In :class:`bytes` patterns, group " "*name* can only contain bytes in the ASCII range (``b'\\x00'``-``b'\\x7f'``)." msgstr "" -#: ../../library/re.rst:517 +#: ../../library/re.rst:526 msgid "" "The special sequences consist of ``'\\'`` and a character from the list " "below. If the ordinary character is not an ASCII digit or an ASCII letter, " @@ -761,11 +766,11 @@ msgid "" "matches the character ``'$'``." msgstr "" -#: ../../library/re.rst:524 +#: ../../library/re.rst:533 msgid "``\\number``" msgstr "``\\number``" -#: ../../library/re.rst:525 +#: ../../library/re.rst:534 msgid "" "Matches the contents of the group of the same number. Groups are numbered " "starting from 1. For example, ``(.+) \\1`` matches ``'the the'`` or ``'55 " @@ -777,19 +782,19 @@ msgid "" "escapes are treated as characters." msgstr "" -#: ../../library/re.rst:536 +#: ../../library/re.rst:545 msgid "``\\A``" msgstr "``\\A``" -#: ../../library/re.rst:537 +#: ../../library/re.rst:546 msgid "Matches only at the start of the string." msgstr "" -#: ../../library/re.rst:541 +#: ../../library/re.rst:550 msgid "``\\b``" msgstr "``\\b``" -#: ../../library/re.rst:542 +#: ../../library/re.rst:551 msgid "" "Matches the empty string, but only at the beginning or end of a word. A word " "is defined as a sequence of word characters. Note that formally, ``\\b`` is " @@ -799,7 +804,7 @@ msgid "" "``'as at ay'`` but not ``'attempt'`` or ``'atlas'``." msgstr "" -#: ../../library/re.rst:550 +#: ../../library/re.rst:559 msgid "" "The default word characters in Unicode (str) patterns are Unicode " "alphanumerics and the underscore, but this can be changed by using the :py:" @@ -807,17 +812,17 @@ msgid "" "if the :py:const:`~re.LOCALE` flag is used." msgstr "" -#: ../../library/re.rst:558 +#: ../../library/re.rst:567 msgid "" "Inside a character range, ``\\b`` represents the backspace character, for " "compatibility with Python's string literals." msgstr "" -#: ../../library/re.rst:563 +#: ../../library/re.rst:572 msgid "``\\B``" msgstr "``\\B``" -#: ../../library/re.rst:564 +#: ../../library/re.rst:573 msgid "" "Matches the empty string, but only when it is *not* at the beginning or end " "of a word. This means that ``r'at\\B'`` matches ``'athens'``, ``'atom'``, " @@ -828,61 +833,61 @@ msgid "" "current locale if the :py:const:`~re.LOCALE` flag is used." msgstr "" -#: ../../library/re.rst:577 +#: ../../library/re.rst:586 msgid "" "Note that ``\\B`` does not match an empty string, which differs from RE " "implementations in other programming languages such as Perl. This behavior " "is kept for compatibility reasons." msgstr "" -#: ../../library/re.rst:583 +#: ../../library/re.rst:592 msgid "``\\d``" msgstr "``\\d``" -#: ../../library/re.rst:584 ../../library/re.rst:608 ../../library/re.rst:630 +#: ../../library/re.rst:593 ../../library/re.rst:617 ../../library/re.rst:639 msgid "For Unicode (str) patterns:" msgstr "" -#: ../../library/re.rst:585 +#: ../../library/re.rst:594 msgid "" "Matches any Unicode decimal digit (that is, any character in Unicode " "character category `[Nd]`__). This includes ``[0-9]``, and also many other " "digit characters." msgstr "" -#: ../../library/re.rst:589 +#: ../../library/re.rst:598 msgid "Matches ``[0-9]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:593 ../../library/re.rst:615 ../../library/re.rst:638 +#: ../../library/re.rst:602 ../../library/re.rst:624 ../../library/re.rst:647 msgid "For 8-bit (bytes) patterns:" msgstr "" -#: ../../library/re.rst:594 +#: ../../library/re.rst:603 msgid "" "Matches any decimal digit in the ASCII character set; this is equivalent to " "``[0-9]``." msgstr "" -#: ../../library/re.rst:599 +#: ../../library/re.rst:608 msgid "``\\D``" msgstr "``\\D``" -#: ../../library/re.rst:600 +#: ../../library/re.rst:609 msgid "" "Matches any character which is not a decimal digit. This is the opposite of " "``\\d``." msgstr "" -#: ../../library/re.rst:603 +#: ../../library/re.rst:612 msgid "Matches ``[^0-9]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:607 +#: ../../library/re.rst:616 msgid "``\\s``" msgstr "``\\s``" -#: ../../library/re.rst:609 +#: ../../library/re.rst:618 msgid "" "Matches Unicode whitespace characters (as defined by :py:meth:`str." "isspace`). This includes ``[ \\t\\n\\r\\f\\v]``, and also many other " @@ -890,48 +895,48 @@ msgid "" "in many languages." msgstr "" -#: ../../library/re.rst:613 +#: ../../library/re.rst:622 msgid "" "Matches ``[ \\t\\n\\r\\f\\v]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:616 +#: ../../library/re.rst:625 msgid "" "Matches characters considered whitespace in the ASCII character set; this is " "equivalent to ``[ \\t\\n\\r\\f\\v]``." msgstr "" -#: ../../library/re.rst:621 +#: ../../library/re.rst:630 msgid "``\\S``" msgstr "``\\S``" -#: ../../library/re.rst:622 +#: ../../library/re.rst:631 msgid "" "Matches any character which is not a whitespace character. This is the " "opposite of ``\\s``." msgstr "" -#: ../../library/re.rst:625 +#: ../../library/re.rst:634 msgid "" "Matches ``[^ \\t\\n\\r\\f\\v]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:629 +#: ../../library/re.rst:638 msgid "``\\w``" msgstr "``\\w``" -#: ../../library/re.rst:631 +#: ../../library/re.rst:640 msgid "" "Matches Unicode word characters; this includes all Unicode alphanumeric " "characters (as defined by :py:meth:`str.isalnum`), as well as the underscore " "(``_``)." msgstr "" -#: ../../library/re.rst:636 +#: ../../library/re.rst:645 msgid "Matches ``[a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:639 +#: ../../library/re.rst:648 msgid "" "Matches characters considered alphanumeric in the ASCII character set; this " "is equivalent to ``[a-zA-Z0-9_]``. If the :py:const:`~re.LOCALE` flag is " @@ -939,42 +944,42 @@ msgid "" "the underscore." msgstr "" -#: ../../library/re.rst:646 +#: ../../library/re.rst:655 msgid "``\\W``" msgstr "``\\W``" -#: ../../library/re.rst:647 +#: ../../library/re.rst:656 msgid "" "Matches any character which is not a word character. This is the opposite of " "``\\w``. By default, matches non-underscore (``_``) characters for which :py:" "meth:`str.isalnum` returns ``False``." msgstr "" -#: ../../library/re.rst:652 +#: ../../library/re.rst:661 msgid "Matches ``[^a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:654 +#: ../../library/re.rst:663 msgid "" "If the :py:const:`~re.LOCALE` flag is used, matches characters which are " "neither alphanumeric in the current locale nor the underscore." msgstr "" -#: ../../library/re.rst:660 +#: ../../library/re.rst:669 msgid "``\\Z``" msgstr "``\\Z``" -#: ../../library/re.rst:661 +#: ../../library/re.rst:670 msgid "Matches only at the end of the string." msgstr "" -#: ../../library/re.rst:677 +#: ../../library/re.rst:686 msgid "" "Most of the :ref:`escape sequences ` supported by Python " "string literals are also accepted by the regular expression parser::" msgstr "" -#: ../../library/re.rst:680 +#: ../../library/re.rst:689 msgid "" "\\a \\b \\f \\n\n" "\\N \\r \\t \\u\n" @@ -984,20 +989,20 @@ msgstr "" "\\N \\r \\t \\u\n" "\\U \\v \\x \\\\" -#: ../../library/re.rst:684 +#: ../../library/re.rst:693 msgid "" "(Note that ``\\b`` is used to represent word boundaries, and means " "\"backspace\" only inside character classes.)" msgstr "" -#: ../../library/re.rst:687 +#: ../../library/re.rst:696 msgid "" "``'\\u'``, ``'\\U'``, and ``'\\N'`` escape sequences are only recognized in " "Unicode (str) patterns. In bytes patterns they are errors. Unknown escapes " "of ASCII letters are reserved for future use and treated as errors." msgstr "" -#: ../../library/re.rst:693 +#: ../../library/re.rst:702 msgid "" "Octal escapes are included in a limited form. If the first digit is a 0, or " "if there are three octal digits, it is considered an octal escape. " @@ -1005,27 +1010,27 @@ msgid "" "are always at most three digits in length." msgstr "" -#: ../../library/re.rst:698 +#: ../../library/re.rst:707 msgid "The ``'\\u'`` and ``'\\U'`` escape sequences have been added." msgstr "" -#: ../../library/re.rst:701 +#: ../../library/re.rst:710 msgid "" "Unknown escapes consisting of ``'\\'`` and an ASCII letter now are errors." msgstr "" -#: ../../library/re.rst:704 +#: ../../library/re.rst:713 msgid "" "The :samp:`'\\\\N\\\\{{name}\\\\}'` escape sequence has been added. As in " "string literals, it expands to the named Unicode character (e.g. ``'\\N{EM " "DASH}'``)." msgstr "" -#: ../../library/re.rst:712 +#: ../../library/re.rst:721 msgid "Module Contents" msgstr "模組內容" -#: ../../library/re.rst:714 +#: ../../library/re.rst:723 msgid "" "The module defines several functions, constants, and an exception. Some of " "the functions are simplified versions of the full featured methods for " @@ -1033,26 +1038,26 @@ msgid "" "compiled form." msgstr "" -#: ../../library/re.rst:721 +#: ../../library/re.rst:730 msgid "Flags" msgstr "旗標" -#: ../../library/re.rst:723 +#: ../../library/re.rst:732 msgid "" "Flag constants are now instances of :class:`RegexFlag`, which is a subclass " "of :class:`enum.IntFlag`." msgstr "" -#: ../../library/re.rst:730 +#: ../../library/re.rst:739 msgid "" "An :class:`enum.IntFlag` class containing the regex options listed below." msgstr "" -#: ../../library/re.rst:732 +#: ../../library/re.rst:741 msgid "- added to ``__all__``" msgstr "" -#: ../../library/re.rst:737 +#: ../../library/re.rst:746 msgid "" "Make ``\\w``, ``\\W``, ``\\b``, ``\\B``, ``\\d``, ``\\D``, ``\\s`` and " "``\\S`` perform ASCII-only matching instead of full Unicode matching. This " @@ -1060,11 +1065,11 @@ msgid "" "patterns." msgstr "" -#: ../../library/re.rst:741 +#: ../../library/re.rst:750 msgid "Corresponds to the inline flag ``(?a)``." msgstr "" -#: ../../library/re.rst:745 +#: ../../library/re.rst:754 msgid "" "The :py:const:`~re.U` flag still exists for backward compatibility, but is " "redundant in Python 3 since matches are Unicode by default for ``str`` " @@ -1072,15 +1077,15 @@ msgid "" "`~re.UNICODE` and the inline flag ``(?u)`` are similarly redundant." msgstr "" -#: ../../library/re.rst:754 +#: ../../library/re.rst:763 msgid "Display debug information about compiled expression." msgstr "" -#: ../../library/re.rst:756 +#: ../../library/re.rst:765 msgid "No corresponding inline flag." msgstr "" -#: ../../library/re.rst:762 +#: ../../library/re.rst:771 msgid "" "Perform case-insensitive matching; expressions like ``[A-Z]`` will also " "match lowercase letters. Full Unicode matching (such as ``Ü`` matching " @@ -1089,33 +1094,33 @@ msgid "" "flag unless the :py:const:`~re.LOCALE` flag is also used." msgstr "" -#: ../../library/re.rst:770 +#: ../../library/re.rst:779 msgid "Corresponds to the inline flag ``(?i)``." msgstr "" -#: ../../library/re.rst:772 +#: ../../library/re.rst:781 msgid "" "Note that when the Unicode patterns ``[a-z]`` or ``[A-Z]`` are used in " "combination with the :const:`IGNORECASE` flag, they will match the 52 ASCII " "letters and 4 additional non-ASCII letters: 'İ' (U+0130, Latin capital " -"letter I with dot above), 'ı' (U+0131, Latin small letter dotless i), 'ſ' " -"(U+017F, Latin small letter long s) and 'K' (U+212A, Kelvin sign). If the :" -"py:const:`~re.ASCII` flag is used, only letters 'a' to 'z' and 'A' to 'Z' " -"are matched." +"letter I with dot above), 'ı' (U+0131, Latin small letter dotless i), " +"'ſ' (U+017F, Latin small letter long s) and 'K' (U+212A, Kelvin sign). If " +"the :py:const:`~re.ASCII` flag is used, only letters 'a' to 'z' and 'A' to " +"'Z' are matched." msgstr "" -#: ../../library/re.rst:783 +#: ../../library/re.rst:792 msgid "" "Make ``\\w``, ``\\W``, ``\\b``, ``\\B`` and case-insensitive matching " "dependent on the current locale. This flag can be used only with bytes " "patterns." msgstr "" -#: ../../library/re.rst:787 +#: ../../library/re.rst:796 msgid "Corresponds to the inline flag ``(?L)``." msgstr "" -#: ../../library/re.rst:791 +#: ../../library/re.rst:800 msgid "" "This flag is discouraged; consider Unicode matching instead. The locale " "mechanism is very unreliable as it only handles one \"culture\" at a time " @@ -1124,20 +1129,20 @@ msgid "" "languages." msgstr "" -#: ../../library/re.rst:798 +#: ../../library/re.rst:807 msgid "" ":py:const:`~re.LOCALE` can be used only with bytes patterns and is not " "compatible with :py:const:`~re.ASCII`." msgstr "" -#: ../../library/re.rst:802 +#: ../../library/re.rst:811 msgid "" "Compiled regular expression objects with the :py:const:`~re.LOCALE` flag no " "longer depend on the locale at compile time. Only the locale at matching " "time affects the result of matching." msgstr "" -#: ../../library/re.rst:811 +#: ../../library/re.rst:820 msgid "" "When specified, the pattern character ``'^'`` matches at the beginning of " "the string and at the beginning of each line (immediately following each " @@ -1148,11 +1153,11 @@ msgid "" "the end of the string." msgstr "" -#: ../../library/re.rst:818 +#: ../../library/re.rst:827 msgid "Corresponds to the inline flag ``(?m)``." msgstr "" -#: ../../library/re.rst:822 +#: ../../library/re.rst:831 msgid "" "Indicates no flag being applied, the value is ``0``. This flag may be used " "as a default value for a function keyword argument or as a base value that " @@ -1160,35 +1165,35 @@ msgid "" "value::" msgstr "" -#: ../../library/re.rst:827 +#: ../../library/re.rst:836 msgid "" "def myfunc(text, flag=re.NOFLAG):\n" " return re.match(text, flag)" msgstr "" -#: ../../library/re.rst:835 +#: ../../library/re.rst:844 msgid "" "Make the ``'.'`` special character match any character at all, including a " "newline; without this flag, ``'.'`` will match anything *except* a newline." msgstr "" -#: ../../library/re.rst:838 +#: ../../library/re.rst:847 msgid "Corresponds to the inline flag ``(?s)``." msgstr "" -#: ../../library/re.rst:844 +#: ../../library/re.rst:853 msgid "" "In Python 3, Unicode characters are matched by default for ``str`` patterns. " "This flag is therefore redundant with **no effect** and is only kept for " "backward compatibility." msgstr "" -#: ../../library/re.rst:849 +#: ../../library/re.rst:858 msgid "" "See :py:const:`~re.ASCII` to restrict matching to ASCII characters instead." msgstr "" -#: ../../library/re.rst:856 +#: ../../library/re.rst:865 msgid "" "This flag allows you to write regular expressions that look nicer and are " "more readable by allowing you to visually separate logical sections of the " @@ -1201,13 +1206,13 @@ msgid "" "ignored." msgstr "" -#: ../../library/re.rst:866 +#: ../../library/re.rst:875 msgid "" "This means that the two following regular expression objects that match a " "decimal number are functionally equal::" msgstr "" -#: ../../library/re.rst:869 +#: ../../library/re.rst:878 msgid "" "a = re.compile(r\"\"\"\\d + # the integral part\n" " \\. # the decimal point\n" @@ -1215,15 +1220,15 @@ msgid "" "b = re.compile(r\"\\d+\\.\\d*\")" msgstr "" -#: ../../library/re.rst:874 +#: ../../library/re.rst:883 msgid "Corresponds to the inline flag ``(?x)``." msgstr "" -#: ../../library/re.rst:878 +#: ../../library/re.rst:887 msgid "Functions" msgstr "函式" -#: ../../library/re.rst:882 +#: ../../library/re.rst:891 msgid "" "Compile a regular expression pattern into a :ref:`regular expression object " "`, which can be used for matching using its :func:`~Pattern." @@ -1232,10 +1237,10 @@ msgstr "" "將正規表示式模式編譯成\\ :ref:`正規表示式物件 `,可以使用它的 :" "func:`~Pattern.match`、:func:`~Pattern.search` 等方法來匹配,如下所述。" -#: ../../library/re.rst:887 ../../library/re.rst:919 ../../library/re.rst:937 -#: ../../library/re.rst:948 ../../library/re.rst:994 ../../library/re.rst:1028 -#: ../../library/re.rst:1043 ../../library/re.rst:1102 -#: ../../library/re.rst:1138 +#: ../../library/re.rst:896 ../../library/re.rst:928 ../../library/re.rst:946 +#: ../../library/re.rst:957 ../../library/re.rst:1003 ../../library/re.rst:1037 +#: ../../library/re.rst:1052 ../../library/re.rst:1111 +#: ../../library/re.rst:1147 msgid "" "The expression's behaviour can be modified by specifying a *flags* value. " "Values can be any of the `flags`_ variables, combined using bitwise OR (the " @@ -1244,11 +1249,11 @@ msgstr "" "可以透過指定 *flags* 值來修改運算式的行為,值可以是任何 `flags`_ 變數,使用位" "元 OR(bitwise OR、``|`` 運算子)組合。" -#: ../../library/re.rst:891 +#: ../../library/re.rst:900 msgid "The sequence ::" msgstr "順序為: ::" -#: ../../library/re.rst:893 +#: ../../library/re.rst:902 msgid "" "prog = re.compile(pattern)\n" "result = prog.match(string)" @@ -1256,15 +1261,15 @@ msgstr "" "prog = re.compile(pattern)\n" "result = prog.match(string)" -#: ../../library/re.rst:896 +#: ../../library/re.rst:905 msgid "is equivalent to ::" msgstr "等價於: ::" -#: ../../library/re.rst:898 +#: ../../library/re.rst:907 msgid "result = re.match(pattern, string)" msgstr "result = re.match(pattern, string)" -#: ../../library/re.rst:900 +#: ../../library/re.rst:909 msgid "" "but using :func:`re.compile` and saving the resulting regular expression " "object for reuse is more efficient when the expression will be used several " @@ -1273,7 +1278,7 @@ msgstr "" "但是當表示式在單一程式中多次使用時,使用 :func:`re.compile` 並保存產生的正規" "表示式物件以供重複使用會更有效率。" -#: ../../library/re.rst:906 +#: ../../library/re.rst:915 msgid "" "The compiled versions of the most recent patterns passed to :func:`re." "compile` and the module-level matching functions are cached, so programs " @@ -1283,7 +1288,7 @@ msgstr "" "傳遞給 :func:`re.compile` 之最新模式的編譯版本和模組層級匹配函式都會被快取," "因此一次僅使用幾個正規表示式的程式不必去擔心編譯正規表示式。" -#: ../../library/re.rst:914 +#: ../../library/re.rst:923 msgid "" "Scan through *string* looking for the first location where the regular " "expression *pattern* produces a match, and return a corresponding :class:" @@ -1295,7 +1300,7 @@ msgstr "" "class:`~re.Match`。如果字串中沒有與模式匹配的位置則回傳 ``None``;請注意,這" "與在字串中的某個點查找零長度匹配不同。" -#: ../../library/re.rst:926 +#: ../../library/re.rst:935 msgid "" "If zero or more characters at the beginning of *string* match the regular " "expression *pattern*, return a corresponding :class:`~re.Match`. Return " @@ -1306,7 +1311,7 @@ msgstr "" "class:`~re.Match`。如果字串與模式不匹配,則回傳 ``None``;請注意,這與零長度" "匹配不同。" -#: ../../library/re.rst:931 +#: ../../library/re.rst:940 msgid "" "Note that even in :const:`MULTILINE` mode, :func:`re.match` will only match " "at the beginning of the string and not at the beginning of each line." @@ -1314,7 +1319,7 @@ msgstr "" "請注意,即使在 :const:`MULTILINE` 模式 (mode) 下,:func:`re.match` 只會於字串" "的開頭匹配,而非每行的開頭。" -#: ../../library/re.rst:934 +#: ../../library/re.rst:943 msgid "" "If you want to locate a match anywhere in *string*, use :func:`search` " "instead (see also :ref:`search-vs-match`)." @@ -1322,7 +1327,7 @@ msgstr "" "如果你想在 *string* 中的任何位置找到匹配項,請使用 :func:`search`\\ (另請參" "閱 :ref:`search-vs-match`)。" -#: ../../library/re.rst:944 +#: ../../library/re.rst:953 msgid "" "If the whole *string* matches the regular expression *pattern*, return a " "corresponding :class:`~re.Match`. Return ``None`` if the string does not " @@ -1331,7 +1336,7 @@ msgstr "" "如果整個 *string* 與正規表示式 *pattern* 匹配,則回傳對應的 :class:`~re." "Match`。如果字串與模式不匹配,則回傳 ``None``;請注意,這與零長度匹配不同。" -#: ../../library/re.rst:957 +#: ../../library/re.rst:966 msgid "" "Split *string* by the occurrences of *pattern*. If capturing parentheses " "are used in *pattern*, then the text of all groups in the pattern are also " @@ -1343,7 +1348,7 @@ msgstr "" "中所有群組的文字也會作為結果串列的一部分回傳。如果 *maxsplit* 非零,則最多發" "生 *maxsplit* 次拆分,並且字串的其餘部分會作為串列的最終元素回傳。 ::" -#: ../../library/re.rst:963 +#: ../../library/re.rst:972 msgid "" ">>> re.split(r'\\W+', 'Words, words, words.')\n" "['Words', 'words', 'words', '']\n" @@ -1363,7 +1368,7 @@ msgstr "" ">>> re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE)\n" "['0', '3', '9']" -#: ../../library/re.rst:972 +#: ../../library/re.rst:981 msgid "" "If there are capturing groups in the separator and it matches at the start " "of the string, the result will start with an empty string. The same holds " @@ -1372,7 +1377,7 @@ msgstr "" "如果分隔符號中有捕獲群組並且它在字串的開頭匹配,則結果將以空字串開頭。這同樣" "適用於字串的結尾: ::" -#: ../../library/re.rst:976 +#: ../../library/re.rst:985 msgid "" ">>> re.split(r'(\\W+)', '...words, words...')\n" "['', '...', 'words', ', ', 'words', '...', '']" @@ -1380,19 +1385,19 @@ msgstr "" ">>> re.split(r'(\\W+)', '...words, words...')\n" "['', '...', 'words', ', ', 'words', '...', '']" -#: ../../library/re.rst:979 +#: ../../library/re.rst:988 msgid "" "That way, separator components are always found at the same relative indices " "within the result list." msgstr "如此一來,分隔符號元件始終可以在結果串列中的相同相對索引處找到。" -#: ../../library/re.rst:982 +#: ../../library/re.rst:991 msgid "" "Empty matches for the pattern split the string only when not adjacent to a " "previous empty match." msgstr "只有當與先前的空匹配不相鄰時,模式的空匹配才會拆分字串。" -#: ../../library/re.rst:985 +#: ../../library/re.rst:994 msgid "" ">>> re.split(r'\\b', 'Words, words, words.')\n" "['', 'Words', ', ', 'words', ', ', 'words', '.']\n" @@ -1410,16 +1415,16 @@ msgstr "" "['', '...', '', '', 'w', '', 'o', '', 'r', '', 'd', '', 's', '...', '', '', " "'']" -#: ../../library/re.rst:998 ../../library/re.rst:1106 +#: ../../library/re.rst:1007 ../../library/re.rst:1115 msgid "Added the optional flags argument." msgstr "新增可選的旗標引數。" -#: ../../library/re.rst:1001 +#: ../../library/re.rst:1010 msgid "" "Added support of splitting on a pattern that could match an empty string." msgstr "新增了對可以匹配空字串之模式進行拆分的支援。" -#: ../../library/re.rst:1004 +#: ../../library/re.rst:1013 msgid "" "Passing *maxsplit* and *flags* as positional arguments is deprecated. In " "future Python versions they will be :ref:`keyword-only parameters `。" -#: ../../library/re.rst:1012 +#: ../../library/re.rst:1021 msgid "" "Return all non-overlapping matches of *pattern* in *string*, as a list of " "strings or tuples. The *string* is scanned left-to-right, and matches are " @@ -1437,7 +1442,7 @@ msgstr "" "以字串或元組串列的形式回傳 *string* 中 *pattern* 的所有非重疊匹配項。從左到右" "掃描 *string*,並按找到的順序回傳符合項目。結果中會包含空匹配項。" -#: ../../library/re.rst:1016 +#: ../../library/re.rst:1025 msgid "" "The result depends on the number of capturing groups in the pattern. If " "there are no groups, return a list of strings matching the whole pattern. " @@ -1450,11 +1455,11 @@ msgstr "" "列。如果恰好存在一個群組,則回傳與該群組匹配的字串串列。如果存在多個群組,則" "回傳與群組匹配的字串元組串列。非捕獲群組則不影響結果的形式。" -#: ../../library/re.rst:1032 ../../library/re.rst:1047 +#: ../../library/re.rst:1041 ../../library/re.rst:1056 msgid "Non-empty matches can now start just after a previous empty match." msgstr "非空匹配現在可以剛好在前一個空匹配的後面開始。" -#: ../../library/re.rst:1038 +#: ../../library/re.rst:1047 msgid "" "Return an :term:`iterator` yielding :class:`~re.Match` objects over all non-" "overlapping matches for the RE *pattern* in *string*. The *string* is " @@ -1465,7 +1470,7 @@ msgstr "" "yield :class:`~re.Match` 物件。從左到右掃描 *string*,並按找到的順序回傳匹配" "項目。結果中包含空匹配項。" -#: ../../library/re.rst:1053 +#: ../../library/re.rst:1062 msgid "" "Return the string obtained by replacing the leftmost non-overlapping " "occurrences of *pattern* in *string* by the replacement *repl*. If the " @@ -1485,7 +1490,7 @@ msgstr "" "留以供將來使用並被視為錯誤。其他未知轉義符例如 ``\\&`` 會被單獨保留。例如 " "``\\6`` 的反向參照將被替換為模式中第 6 組匹配的子字串。例如: ::" -#: ../../library/re.rst:1064 +#: ../../library/re.rst:1073 msgid "" ">>> re.sub(r'def\\s+([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\(\\s*\\):',\n" "... r'static PyObject*\\npy_\\1(void)\\n{',\n" @@ -1497,7 +1502,7 @@ msgstr "" "... 'def myfunc():')\n" "'static PyObject*\\npy_myfunc(void)\\n{'" -#: ../../library/re.rst:1069 +#: ../../library/re.rst:1078 msgid "" "If *repl* is a function, it is called for every non-overlapping occurrence " "of *pattern*. The function takes a single :class:`~re.Match` argument, and " @@ -1506,7 +1511,7 @@ msgstr "" "如果 *repl* 是一個函式,則 *pattern* 的每個不重疊出現之處都會呼叫它。此函式接" "收單一 :class:`~re.Match` 引數,並回傳替換字串。例如: ::" -#: ../../library/re.rst:1073 +#: ../../library/re.rst:1082 msgid "" ">>> def dashrepl(matchobj):\n" "... if matchobj.group(0) == '-': return ' '\n" @@ -1528,11 +1533,11 @@ msgstr "" "IGNORECASE)\n" "'Baked Beans & Spam'" -#: ../../library/re.rst:1082 +#: ../../library/re.rst:1091 msgid "The pattern may be a string or a :class:`~re.Pattern`." msgstr "此模式可以是字串或 :class:`~re.Pattern`。" -#: ../../library/re.rst:1084 +#: ../../library/re.rst:1093 msgid "" "The optional argument *count* is the maximum number of pattern occurrences " "to be replaced; *count* must be a non-negative integer. If omitted or zero, " @@ -1544,7 +1549,7 @@ msgstr "" "略或為零,則所有出現的內容都將被替換。只有當與先前的空匹配不相鄰時,模式的空" "匹配才會被替換,因此 ``sub('x*', '-', 'abxd')`` 會回傳 ``'-a-b--d -'``。" -#: ../../library/re.rst:1092 +#: ../../library/re.rst:1101 msgid "" "In string-type *repl* arguments, in addition to the character escapes and " "backreferences described above, ``\\g`` will use the substring matched " @@ -1563,18 +1568,18 @@ msgstr "" "群組 20 的參照,而不是對後面跟著字面字元 ``'0'`` 的群組 2 的參照。反向參照 " "``\\g<0>`` 會取代以 RE 所匹配到的整個子字串。" -#: ../../library/re.rst:1109 ../../library/re.rst:1387 +#: ../../library/re.rst:1118 ../../library/re.rst:1396 msgid "Unmatched groups are replaced with an empty string." msgstr "不匹配的群組將被替換為空字串。" -#: ../../library/re.rst:1112 +#: ../../library/re.rst:1121 msgid "" "Unknown escapes in *pattern* consisting of ``'\\'`` and an ASCII letter now " "are errors." msgstr "" "在由 ``'\\'`` 和一個 ASCII 字母組成之 *pattern* 中的未知轉義符現在為錯誤。" -#: ../../library/re.rst:1116 +#: ../../library/re.rst:1125 msgid "" "Unknown escapes in *repl* consisting of ``'\\'`` and an ASCII letter now are " "errors. Empty matches for the pattern are replaced when adjacent to a " @@ -1583,7 +1588,7 @@ msgstr "" "由 ``'\\'`` 和一個 ASCII 字母組成之 *repl* 中的未知轉義符現在為錯誤。當與先前" "的非空匹配相鄰時,模式的空匹配將被替換。" -#: ../../library/re.rst:1122 +#: ../../library/re.rst:1131 msgid "" "Group *id* can only contain ASCII digits. In :class:`bytes` replacement " "strings, group *name* can only contain bytes in the ASCII range " @@ -1592,7 +1597,7 @@ msgstr "" "群組 *id* 只能包含 ASCII 數字。在 :class:`bytes` 替換字串中,群組 *name* 只能" "包含 ASCII 範圍內的位元組 (``b'\\x00'``-``b'\\x7f'``)。" -#: ../../library/re.rst:1127 +#: ../../library/re.rst:1136 msgid "" "Passing *count* and *flags* as positional arguments is deprecated. In future " "Python versions they will be :ref:`keyword-only parameters `。" -#: ../../library/re.rst:1135 +#: ../../library/re.rst:1144 msgid "" "Perform the same operation as :func:`sub`, but return a tuple ``(new_string, " "number_of_subs_made)``." @@ -1609,7 +1614,7 @@ msgstr "" "執行與 :func:`sub` 相同的操作,但回傳一個元組 ``(new_string, " "number_of_subs_made)``。" -#: ../../library/re.rst:1145 +#: ../../library/re.rst:1154 msgid "" "Escape special characters in *pattern*. This is useful if you want to match " "an arbitrary literal string that may have regular expression metacharacters " @@ -1618,7 +1623,7 @@ msgstr "" "對 *pattern* 中的特殊字元進行轉義。如果你想要匹配其中可能包含正規表示式元字" "元 (metacharacter) 的任意文本字串,這會非常有用。例如: ::" -#: ../../library/re.rst:1149 +#: ../../library/re.rst:1158 msgid "" ">>> print(re.escape('https://www.python.org/'))\n" "https://www//.python//.org/n" @@ -1644,7 +1649,7 @@ msgstr "" ">>> print('|'.join(map(re.escape, sorted(operators, reverse=True))))\n" "/|\\-|\\+|\\*\\*|\\*" -#: ../../library/re.rst:1160 +#: ../../library/re.rst:1169 msgid "" "This function must not be used for the replacement string in :func:`sub` " "and :func:`subn`, only backslashes should be escaped. For example::" @@ -1652,7 +1657,7 @@ msgstr "" "此函式不得用於 :func:`sub` 和 :func:`subn` 中的替換字串,僅應轉義反斜線。例" "如: ::" -#: ../../library/re.rst:1163 +#: ../../library/re.rst:1172 msgid "" ">>> digits_re = r'\\d+'\n" ">>> sample = '/usr/sbin/sendmail - 0 errors, 12 warnings'\n" @@ -1664,11 +1669,11 @@ msgstr "" ">>> print(re.sub(digits_re, digits_re.replace('\\\\', r'\\\\'), sample))\n" "/usr/sbin/sendmail - \\d+ errors, \\d+ warnings" -#: ../../library/re.rst:1168 +#: ../../library/re.rst:1177 msgid "The ``'_'`` character is no longer escaped." msgstr "``'_'`` 字元不再被轉義。" -#: ../../library/re.rst:1171 +#: ../../library/re.rst:1180 msgid "" "Only characters that can have special meaning in a regular expression are " "escaped. As a result, ``'!'``, ``'\"'``, ``'%'``, ``\"'\"``, ``','``, " @@ -1676,15 +1681,15 @@ msgid "" "are no longer escaped." msgstr "" -#: ../../library/re.rst:1180 +#: ../../library/re.rst:1189 msgid "Clear the regular expression cache." msgstr "清除正規表示式快取。" -#: ../../library/re.rst:1184 +#: ../../library/re.rst:1193 msgid "Exceptions" msgstr "例外" -#: ../../library/re.rst:1188 +#: ../../library/re.rst:1197 msgid "" "Exception raised when a string passed to one of the functions here is not a " "valid regular expression (for example, it might contain unmatched " @@ -1694,55 +1699,55 @@ msgid "" "attributes:" msgstr "" "當傳遞給此處函式之一的字串不是有效的正規表示式(例如它可能包含不匹配的括號)" -"或在編譯或匹配期間發生某些其他錯誤時,將引發例外。如果字串不包含模式匹配項,則" -"絕不是錯誤。``PatternError`` 實例具有以下附加屬性:" +"或在編譯或匹配期間發生某些其他錯誤時,將引發例外。如果字串不包含模式匹配項," +"則絕不是錯誤。``PatternError`` 實例具有以下附加屬性:" -#: ../../library/re.rst:1196 +#: ../../library/re.rst:1205 msgid "The unformatted error message." msgstr "未格式化的錯誤訊息。" -#: ../../library/re.rst:1200 +#: ../../library/re.rst:1209 msgid "The regular expression pattern." msgstr "正規表示式模式。" -#: ../../library/re.rst:1204 +#: ../../library/re.rst:1213 msgid "The index in *pattern* where compilation failed (may be ``None``)." msgstr "*pattern* 中編譯失敗的索引(可能是 ``None``)。" -#: ../../library/re.rst:1208 +#: ../../library/re.rst:1217 msgid "The line corresponding to *pos* (may be ``None``)." msgstr "對應 *pos* 的列(可能是 ``None``)。" -#: ../../library/re.rst:1212 +#: ../../library/re.rst:1221 msgid "The column corresponding to *pos* (may be ``None``)." msgstr "對應 *pos* 的欄(可能是 ``None``)。" -#: ../../library/re.rst:1214 +#: ../../library/re.rst:1223 msgid "Added additional attributes." msgstr "新增額外屬性。" -#: ../../library/re.rst:1217 +#: ../../library/re.rst:1226 msgid "" "``PatternError`` was originally named ``error``; the latter is kept as an " "alias for backward compatibility." msgstr "" "``PatternError`` 最初被命名為 ``error``;後者為了向後相容性而被保留為別名。" -#: ../../library/re.rst:1224 +#: ../../library/re.rst:1233 msgid "Regular Expression Objects" msgstr "" -#: ../../library/re.rst:1228 +#: ../../library/re.rst:1237 msgid "Compiled regular expression object returned by :func:`re.compile`." msgstr "" -#: ../../library/re.rst:1230 +#: ../../library/re.rst:1239 msgid "" ":py:class:`re.Pattern` supports ``[]`` to indicate a Unicode (str) or bytes " "pattern. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1236 +#: ../../library/re.rst:1245 msgid "" "Scan through *string* looking for the first location where this regular " "expression produces a match, and return a corresponding :class:`~re.Match`. " @@ -1751,7 +1756,7 @@ msgid "" "string." msgstr "" -#: ../../library/re.rst:1241 +#: ../../library/re.rst:1250 msgid "" "The optional second parameter *pos* gives an index in the string where the " "search is to start; it defaults to ``0``. This is not completely equivalent " @@ -1760,7 +1765,7 @@ msgid "" "necessarily at the index where the search is to start." msgstr "" -#: ../../library/re.rst:1247 +#: ../../library/re.rst:1256 msgid "" "The optional parameter *endpos* limits how far the string will be searched; " "it will be as if the string is *endpos* characters long, so only the " @@ -1770,7 +1775,7 @@ msgid "" "equivalent to ``rx.search(string[:50], 0)``. ::" msgstr "" -#: ../../library/re.rst:1254 +#: ../../library/re.rst:1263 msgid "" ">>> pattern = re.compile(\"d\")\n" ">>> pattern.search(\"dog\") # Match at index 0\n" @@ -1778,7 +1783,7 @@ msgid "" ">>> pattern.search(\"dog\", 1) # No match; search doesn't include the \"d\"" msgstr "" -#: ../../library/re.rst:1262 +#: ../../library/re.rst:1271 msgid "" "If zero or more characters at the *beginning* of *string* match this regular " "expression, return a corresponding :class:`~re.Match`. Return ``None`` if " @@ -1786,13 +1791,13 @@ msgid "" "zero-length match." msgstr "" -#: ../../library/re.rst:1267 ../../library/re.rst:1285 +#: ../../library/re.rst:1276 ../../library/re.rst:1294 msgid "" "The optional *pos* and *endpos* parameters have the same meaning as for the :" "meth:`~Pattern.search` method. ::" msgstr "" -#: ../../library/re.rst:1270 +#: ../../library/re.rst:1279 msgid "" ">>> pattern = re.compile(\"o\")\n" ">>> pattern.match(\"dog\") # No match as \"o\" is not at the start of " @@ -1802,20 +1807,20 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1275 +#: ../../library/re.rst:1284 msgid "" "If you want to locate a match anywhere in *string*, use :meth:`~Pattern." "search` instead (see also :ref:`search-vs-match`)." msgstr "" -#: ../../library/re.rst:1281 +#: ../../library/re.rst:1290 msgid "" "If the whole *string* matches this regular expression, return a " "corresponding :class:`~re.Match`. Return ``None`` if the string does not " "match the pattern; note that this is different from a zero-length match." msgstr "" -#: ../../library/re.rst:1288 +#: ../../library/re.rst:1297 msgid "" ">>> pattern = re.compile(\"o[gh]\")\n" ">>> pattern.fullmatch(\"dog\") # No match as \"o\" is not at the start " @@ -1826,72 +1831,72 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1299 +#: ../../library/re.rst:1308 msgid "Identical to the :func:`split` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1304 +#: ../../library/re.rst:1313 msgid "" "Similar to the :func:`findall` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1311 +#: ../../library/re.rst:1320 msgid "" "Similar to the :func:`finditer` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1318 +#: ../../library/re.rst:1327 msgid "Identical to the :func:`sub` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1323 +#: ../../library/re.rst:1332 msgid "Identical to the :func:`subn` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1328 +#: ../../library/re.rst:1337 msgid "" "The regex matching flags. This is a combination of the flags given to :func:" "`.compile`, any ``(?...)`` inline flags in the pattern, and implicit flags " "such as :py:const:`~re.UNICODE` if the pattern is a Unicode string." msgstr "" -#: ../../library/re.rst:1335 +#: ../../library/re.rst:1344 msgid "The number of capturing groups in the pattern." msgstr "" -#: ../../library/re.rst:1340 +#: ../../library/re.rst:1349 msgid "" "A dictionary mapping any symbolic group names defined by ``(?P)`` to " "group numbers. The dictionary is empty if no symbolic groups were used in " "the pattern." msgstr "" -#: ../../library/re.rst:1347 +#: ../../library/re.rst:1356 msgid "The pattern string from which the pattern object was compiled." msgstr "" -#: ../../library/re.rst:1350 +#: ../../library/re.rst:1359 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Compiled " "regular expression objects are considered atomic." msgstr "" -#: ../../library/re.rst:1358 +#: ../../library/re.rst:1367 msgid "Match Objects" msgstr "" -#: ../../library/re.rst:1360 +#: ../../library/re.rst:1369 msgid "" "Match objects always have a boolean value of ``True``. Since :meth:`~Pattern." "match` and :meth:`~Pattern.search` return ``None`` when there is no match, " "you can test whether there was a match with a simple ``if`` statement::" msgstr "" -#: ../../library/re.rst:1365 +#: ../../library/re.rst:1374 msgid "" "match = re.search(pattern, string)\n" "if match:\n" @@ -1901,17 +1906,17 @@ msgstr "" "if match:\n" " process(match)" -#: ../../library/re.rst:1371 +#: ../../library/re.rst:1380 msgid "Match object returned by successful ``match``\\ es and ``search``\\ es." msgstr "" -#: ../../library/re.rst:1373 +#: ../../library/re.rst:1382 msgid "" ":py:class:`re.Match` supports ``[]`` to indicate a Unicode (str) or bytes " "match. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1379 +#: ../../library/re.rst:1388 msgid "" "Return the string obtained by doing backslash substitution on the template " "string *template*, as done by the :meth:`~Pattern.sub` method. Escapes such " @@ -1921,7 +1926,7 @@ msgid "" "backreference ``\\g<0>`` will be replaced by the entire match." msgstr "" -#: ../../library/re.rst:1392 +#: ../../library/re.rst:1401 msgid "" "Returns one or more subgroups of the match. If there is a single argument, " "the result is a single string; if there are multiple arguments, the result " @@ -1936,7 +1941,7 @@ msgid "" "the pattern that matched multiple times, the last match is returned. ::" msgstr "" -#: ../../library/re.rst:1404 +#: ../../library/re.rst:1413 msgid "" ">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" ">>> m.group(0) # The entire match\n" @@ -1949,7 +1954,7 @@ msgid "" "('Isaac', 'Newton')" msgstr "" -#: ../../library/re.rst:1414 +#: ../../library/re.rst:1423 msgid "" "If the regular expression uses the ``(?P...)`` syntax, the *groupN* " "arguments may also be strings identifying groups by their group name. If a " @@ -1957,11 +1962,11 @@ msgid "" "`IndexError` exception is raised." msgstr "" -#: ../../library/re.rst:1419 +#: ../../library/re.rst:1428 msgid "A moderately complicated example::" msgstr "" -#: ../../library/re.rst:1421 +#: ../../library/re.rst:1430 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " "Reynolds\")\n" @@ -1977,11 +1982,11 @@ msgstr "" ">>> m.group('last_name')\n" "'Reynolds'" -#: ../../library/re.rst:1427 +#: ../../library/re.rst:1436 msgid "Named groups can also be referred to by their index::" msgstr "" -#: ../../library/re.rst:1429 +#: ../../library/re.rst:1438 msgid "" ">>> m.group(1)\n" "'Malcolm'\n" @@ -1993,24 +1998,24 @@ msgstr "" ">>> m.group(2)\n" "'Reynolds'" -#: ../../library/re.rst:1434 +#: ../../library/re.rst:1443 msgid "If a group matches multiple times, only the last match is accessible::" msgstr "" -#: ../../library/re.rst:1436 +#: ../../library/re.rst:1445 msgid "" ">>> m = re.match(r\"(..)+\", \"a1b2c3\") # Matches 3 times.\n" ">>> m.group(1) # Returns only the last match.\n" "'c3'" msgstr "" -#: ../../library/re.rst:1443 +#: ../../library/re.rst:1452 msgid "" "This is identical to ``m.group(g)``. This allows easier access to an " "individual group from a match::" msgstr "" -#: ../../library/re.rst:1446 +#: ../../library/re.rst:1455 msgid "" ">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" ">>> m[0] # The entire match\n" @@ -2021,11 +2026,11 @@ msgid "" "'Newton'" msgstr "" -#: ../../library/re.rst:1454 +#: ../../library/re.rst:1463 msgid "Named groups are supported as well::" msgstr "" -#: ../../library/re.rst:1456 +#: ../../library/re.rst:1465 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Isaac " "Newton\")\n" @@ -2041,18 +2046,18 @@ msgstr "" ">>> m['last_name']\n" "'Newton'" -#: ../../library/re.rst:1467 +#: ../../library/re.rst:1476 msgid "" "Return a tuple containing all the subgroups of the match, from 1 up to " "however many groups are in the pattern. The *default* argument is used for " "groups that did not participate in the match; it defaults to ``None``." msgstr "" -#: ../../library/re.rst:1471 ../../library/re.rst:1696 +#: ../../library/re.rst:1480 ../../library/re.rst:1705 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/re.rst:1473 +#: ../../library/re.rst:1482 msgid "" ">>> m = re.match(r\"(\\d+)\\.(\\d+)\", \"24.1632\")\n" ">>> m.groups()\n" @@ -2062,14 +2067,14 @@ msgstr "" ">>> m.groups()\n" "('24', '1632')" -#: ../../library/re.rst:1477 +#: ../../library/re.rst:1486 msgid "" "If we make the decimal place and everything after it optional, not all " "groups might participate in the match. These groups will default to " "``None`` unless the *default* argument is given::" msgstr "" -#: ../../library/re.rst:1481 +#: ../../library/re.rst:1490 msgid "" ">>> m = re.match(r\"(\\d+)\\.?(\\d+)?\", \"24\")\n" ">>> m.groups() # Second group defaults to None.\n" @@ -2078,14 +2083,14 @@ msgid "" "('24', '0')" msgstr "" -#: ../../library/re.rst:1490 +#: ../../library/re.rst:1499 msgid "" "Return a dictionary containing all the *named* subgroups of the match, keyed " "by the subgroup name. The *default* argument is used for groups that did " "not participate in the match; it defaults to ``None``. For example::" msgstr "" -#: ../../library/re.rst:1494 +#: ../../library/re.rst:1503 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " "Reynolds\")\n" @@ -2097,7 +2102,7 @@ msgstr "" ">>> m.groupdict()\n" "{'first_name': 'Malcolm', 'last_name': 'Reynolds'}" -#: ../../library/re.rst:1502 +#: ../../library/re.rst:1511 msgid "" "Return the indices of the start and end of the substring matched by *group*; " "*group* defaults to zero (meaning the whole matched substring). Return " @@ -2106,11 +2111,11 @@ msgid "" "matched by group *g* (equivalent to ``m.group(g)``) is ::" msgstr "" -#: ../../library/re.rst:1508 +#: ../../library/re.rst:1517 msgid "m.string[m.start(g):m.end(g)]" msgstr "m.string[m.start(g):m.end(g)]" -#: ../../library/re.rst:1510 +#: ../../library/re.rst:1519 msgid "" "Note that ``m.start(group)`` will equal ``m.end(group)`` if *group* matched " "a null string. For example, after ``m = re.search('b(c?)', 'cba')``, ``m." @@ -2118,11 +2123,11 @@ msgid "" "2, and ``m.start(2)`` raises an :exc:`IndexError` exception." msgstr "" -#: ../../library/re.rst:1515 +#: ../../library/re.rst:1524 msgid "An example that will remove *remove_this* from email addresses::" msgstr "" -#: ../../library/re.rst:1517 +#: ../../library/re.rst:1526 msgid "" ">>> email = \"tony@tiremove_thisger.net\"\n" ">>> m = re.search(\"remove_this\", email)\n" @@ -2134,28 +2139,28 @@ msgstr "" ">>> email[:m.start()] + email[m.end():]\n" "'tony@tiger.net'" -#: ../../library/re.rst:1525 +#: ../../library/re.rst:1534 msgid "" "For a match *m*, return the 2-tuple ``(m.start(group), m.end(group))``. Note " "that if *group* did not contribute to the match, this is ``(-1, -1)``. " "*group* defaults to zero, the entire match." msgstr "" -#: ../../library/re.rst:1532 +#: ../../library/re.rst:1541 msgid "" "The value of *pos* which was passed to the :meth:`~Pattern.search` or :meth:" "`~Pattern.match` method of a :ref:`regex object `. This is the " "index into the string at which the RE engine started looking for a match." msgstr "" -#: ../../library/re.rst:1539 +#: ../../library/re.rst:1548 msgid "" "The value of *endpos* which was passed to the :meth:`~Pattern.search` or :" "meth:`~Pattern.match` method of a :ref:`regex object `. This is " "the index into the string beyond which the RE engine will not go." msgstr "" -#: ../../library/re.rst:1546 +#: ../../library/re.rst:1555 msgid "" "The integer index of the last matched capturing group, or ``None`` if no " "group was matched at all. For example, the expressions ``(a)b``, ``((a)" @@ -2164,43 +2169,43 @@ msgid "" "applied to the same string." msgstr "" -#: ../../library/re.rst:1555 +#: ../../library/re.rst:1564 msgid "" "The name of the last matched capturing group, or ``None`` if the group " "didn't have a name, or if no group was matched at all." msgstr "" -#: ../../library/re.rst:1561 +#: ../../library/re.rst:1570 msgid "" "The :ref:`regular expression object ` whose :meth:`~Pattern." "match` or :meth:`~Pattern.search` method produced this match instance." msgstr "" -#: ../../library/re.rst:1567 +#: ../../library/re.rst:1576 msgid "The string passed to :meth:`~Pattern.match` or :meth:`~Pattern.search`." msgstr "" -#: ../../library/re.rst:1570 +#: ../../library/re.rst:1579 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Match objects " "are considered atomic." msgstr "" -#: ../../library/re.rst:1578 +#: ../../library/re.rst:1587 msgid "Regular Expression Examples" msgstr "" -#: ../../library/re.rst:1582 +#: ../../library/re.rst:1591 msgid "Checking for a Pair" msgstr "" -#: ../../library/re.rst:1584 +#: ../../library/re.rst:1593 msgid "" "In this example, we'll use the following helper function to display match " "objects a little more gracefully::" msgstr "" -#: ../../library/re.rst:1587 +#: ../../library/re.rst:1596 msgid "" "def displaymatch(match):\n" " if match is None:\n" @@ -2212,7 +2217,7 @@ msgstr "" " return None\n" " return '' % (match.group(), match.groups())" -#: ../../library/re.rst:1592 +#: ../../library/re.rst:1601 msgid "" "Suppose you are writing a poker program where a player's hand is represented " "as a 5-character string with each character representing a card, \"a\" for " @@ -2220,11 +2225,11 @@ msgid "" "\"2\" through \"9\" representing the card with that value." msgstr "" -#: ../../library/re.rst:1597 +#: ../../library/re.rst:1606 msgid "To see if a given string is a valid hand, one could do the following::" msgstr "" -#: ../../library/re.rst:1599 +#: ../../library/re.rst:1608 msgid "" ">>> valid = re.compile(r\"^[a2-9tjqk]{5}$\")\n" ">>> displaymatch(valid.match(\"akt5q\")) # Valid.\n" @@ -2235,14 +2240,14 @@ msgid "" "\"\"" msgstr "" -#: ../../library/re.rst:1607 +#: ../../library/re.rst:1616 msgid "" "That last hand, ``\"727ak\"``, contained a pair, or two of the same valued " "cards. To match this with a regular expression, one could use backreferences " "as such::" msgstr "" -#: ../../library/re.rst:1610 +#: ../../library/re.rst:1619 msgid "" ">>> pair = re.compile(r\".*(.).*\\1\")\n" ">>> displaymatch(pair.match(\"717ak\")) # Pair of 7s.\n" @@ -2252,13 +2257,13 @@ msgid "" "\"\"" msgstr "" -#: ../../library/re.rst:1617 +#: ../../library/re.rst:1626 msgid "" "To find out what card the pair consists of, one could use the :meth:`~Match." "group` method of the match object in the following manner::" msgstr "" -#: ../../library/re.rst:1620 +#: ../../library/re.rst:1629 msgid "" ">>> pair = re.compile(r\".*(.).*\\1\")\n" ">>> pair.match(\"717ak\").group(1)\n" @@ -2276,11 +2281,11 @@ msgid "" "'a'" msgstr "" -#: ../../library/re.rst:1636 +#: ../../library/re.rst:1645 msgid "Simulating scanf()" msgstr "模擬 scanf()" -#: ../../library/re.rst:1640 +#: ../../library/re.rst:1649 msgid "" "Python does not currently have an equivalent to :c:func:`!scanf`. Regular " "expressions are generally more powerful, though also more verbose, than :c:" @@ -2289,130 +2294,130 @@ msgid "" "expressions." msgstr "" -#: ../../library/re.rst:1647 +#: ../../library/re.rst:1656 msgid ":c:func:`!scanf` Token" msgstr "" -#: ../../library/re.rst:1647 +#: ../../library/re.rst:1656 msgid "Regular Expression" msgstr "" -#: ../../library/re.rst:1649 +#: ../../library/re.rst:1658 msgid "``%c``" msgstr "``%c``" -#: ../../library/re.rst:1651 +#: ../../library/re.rst:1660 msgid "``%5c``" msgstr "``%5c``" -#: ../../library/re.rst:1651 +#: ../../library/re.rst:1660 msgid "``.{5}``" msgstr "``.{5}``" -#: ../../library/re.rst:1653 +#: ../../library/re.rst:1662 msgid "``%d``" msgstr "``%d``" -#: ../../library/re.rst:1653 +#: ../../library/re.rst:1662 msgid "``[-+]?\\d+``" msgstr "``[-+]?\\d+``" -#: ../../library/re.rst:1655 +#: ../../library/re.rst:1664 msgid "``%e``, ``%E``, ``%f``, ``%g``" msgstr "``%e``, ``%E``, ``%f``, ``%g``" -#: ../../library/re.rst:1655 +#: ../../library/re.rst:1664 msgid "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" msgstr "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" -#: ../../library/re.rst:1657 +#: ../../library/re.rst:1666 msgid "``%i``" msgstr "``%i``" -#: ../../library/re.rst:1657 +#: ../../library/re.rst:1666 msgid "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" msgstr "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" -#: ../../library/re.rst:1659 +#: ../../library/re.rst:1668 msgid "``%o``" msgstr "``%o``" -#: ../../library/re.rst:1659 +#: ../../library/re.rst:1668 msgid "``[-+]?[0-7]+``" msgstr "``[-+]?[0-7]+``" -#: ../../library/re.rst:1661 +#: ../../library/re.rst:1670 msgid "``%s``" msgstr "``%s``" -#: ../../library/re.rst:1661 +#: ../../library/re.rst:1670 msgid "``\\S+``" msgstr "``\\S+``" -#: ../../library/re.rst:1663 +#: ../../library/re.rst:1672 msgid "``%u``" msgstr "``%u``" -#: ../../library/re.rst:1663 +#: ../../library/re.rst:1672 msgid "``\\d+``" msgstr "``\\d+``" -#: ../../library/re.rst:1665 +#: ../../library/re.rst:1674 msgid "``%x``, ``%X``" msgstr "``%x``、``%X``" -#: ../../library/re.rst:1665 +#: ../../library/re.rst:1674 msgid "``[-+]?(0[xX])?[\\dA-Fa-f]+``" msgstr "``[-+]?(0[xX])?[\\dA-Fa-f]+``" -#: ../../library/re.rst:1668 +#: ../../library/re.rst:1677 msgid "To extract the filename and numbers from a string like ::" msgstr "" -#: ../../library/re.rst:1670 +#: ../../library/re.rst:1679 msgid "/usr/sbin/sendmail - 0 errors, 4 warnings" msgstr "/usr/sbin/sendmail - 0 errors, 4 warnings" -#: ../../library/re.rst:1672 +#: ../../library/re.rst:1681 msgid "you would use a :c:func:`!scanf` format like ::" msgstr "" -#: ../../library/re.rst:1674 +#: ../../library/re.rst:1683 msgid "%s - %d errors, %d warnings" msgstr "" -#: ../../library/re.rst:1676 +#: ../../library/re.rst:1685 msgid "The equivalent regular expression would be ::" msgstr "" -#: ../../library/re.rst:1678 +#: ../../library/re.rst:1687 msgid "(\\S+) - (\\d+) errors, (\\d+) warnings" msgstr "" -#: ../../library/re.rst:1684 +#: ../../library/re.rst:1693 msgid "search() vs. match()" msgstr "search() vs. match()" -#: ../../library/re.rst:1688 +#: ../../library/re.rst:1697 msgid "" "Python offers different primitive operations based on regular expressions:" msgstr "" -#: ../../library/re.rst:1690 +#: ../../library/re.rst:1699 msgid ":func:`re.match` checks for a match only at the beginning of the string" msgstr "" -#: ../../library/re.rst:1691 +#: ../../library/re.rst:1700 msgid "" ":func:`re.search` checks for a match anywhere in the string (this is what " "Perl does by default)" msgstr "" -#: ../../library/re.rst:1693 +#: ../../library/re.rst:1702 msgid ":func:`re.fullmatch` checks for entire string to be a match" msgstr "" -#: ../../library/re.rst:1698 +#: ../../library/re.rst:1707 msgid "" ">>> re.match(\"c\", \"abcdef\") # No match\n" ">>> re.search(\"c\", \"abcdef\") # Match\n" @@ -2422,13 +2427,13 @@ msgid "" ">>> re.fullmatch(\"r.*n\", \"python\") # No match" msgstr "" -#: ../../library/re.rst:1705 +#: ../../library/re.rst:1714 msgid "" "Regular expressions beginning with ``'^'`` can be used with :func:`search` " "to restrict the match at the beginning of the string::" msgstr "" -#: ../../library/re.rst:1708 +#: ../../library/re.rst:1717 msgid "" ">>> re.match(\"c\", \"abcdef\") # No match\n" ">>> re.search(\"^c\", \"abcdef\") # No match\n" @@ -2436,7 +2441,7 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1713 +#: ../../library/re.rst:1722 msgid "" "Note however that in :const:`MULTILINE` mode :func:`match` only matches at " "the beginning of the string, whereas using :func:`search` with a regular " @@ -2444,18 +2449,18 @@ msgid "" "line. ::" msgstr "" -#: ../../library/re.rst:1717 +#: ../../library/re.rst:1726 msgid "" ">>> re.match(\"X\", \"A\\nB\\nX\", re.MULTILINE) # No match\n" ">>> re.search(\"^X\", \"A\\nB\\nX\", re.MULTILINE) # Match\n" "" msgstr "" -#: ../../library/re.rst:1723 +#: ../../library/re.rst:1732 msgid "Making a Phonebook" msgstr "" -#: ../../library/re.rst:1725 +#: ../../library/re.rst:1734 msgid "" ":func:`split` splits a string into a list delimited by the passed pattern. " "The method is invaluable for converting textual data into data structures " @@ -2463,13 +2468,13 @@ msgid "" "following example that creates a phonebook." msgstr "" -#: ../../library/re.rst:1730 +#: ../../library/re.rst:1739 msgid "" "First, here is the input. Normally it may come from a file, here we are " "using triple-quoted string syntax" msgstr "" -#: ../../library/re.rst:1733 +#: ../../library/re.rst:1742 msgid "" ">>> text = \"\"\"Ross McFluff: 834.345.1254 155 Elm Street\n" "...\n" @@ -2487,13 +2492,13 @@ msgstr "" "...\n" "... Heather Albrecht: 548.326.4584 919 Park Place\"\"\"" -#: ../../library/re.rst:1743 +#: ../../library/re.rst:1752 msgid "" "The entries are separated by one or more newlines. Now we convert the string " "into a list with each nonempty line having its own entry:" msgstr "" -#: ../../library/re.rst:1746 +#: ../../library/re.rst:1755 msgid "" ">>> entries = re.split(\"\\n+\", text)\n" ">>> entries\n" @@ -2509,14 +2514,14 @@ msgstr "" "'Frank Burger: 925.541.7625 662 South Dogwood Way',\n" "'Heather Albrecht: 548.326.4584 919 Park Place']" -#: ../../library/re.rst:1756 +#: ../../library/re.rst:1765 msgid "" "Finally, split each entry into a list with first name, last name, telephone " "number, and address. We use the ``maxsplit`` parameter of :func:`split` " "because the address has spaces, our splitting pattern, in it:" msgstr "" -#: ../../library/re.rst:1760 +#: ../../library/re.rst:1769 msgid "" ">>> [re.split(\":? \", entry, maxsplit=3) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155 Elm Street'],\n" @@ -2530,14 +2535,14 @@ msgstr "" "['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919 Park Place']]" -#: ../../library/re.rst:1769 +#: ../../library/re.rst:1778 msgid "" "The ``:?`` pattern matches the colon after the last name, so that it does " "not occur in the result list. With a ``maxsplit`` of ``4``, we could " "separate the house number from the street name:" msgstr "" -#: ../../library/re.rst:1773 +#: ../../library/re.rst:1782 msgid "" ">>> [re.split(\":? \", entry, maxsplit=4) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155', 'Elm Street'],\n" @@ -2551,11 +2556,11 @@ msgstr "" "['Frank', 'Burger', '925.541.7625', '662', 'South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919', 'Park Place']]" -#: ../../library/re.rst:1784 +#: ../../library/re.rst:1793 msgid "Text Munging" msgstr "" -#: ../../library/re.rst:1786 +#: ../../library/re.rst:1795 msgid "" ":func:`sub` replaces every occurrence of a pattern with a string or the " "result of a function. This example demonstrates using :func:`sub` with a " @@ -2563,7 +2568,7 @@ msgid "" "each word of a sentence except for the first and last characters::" msgstr "" -#: ../../library/re.rst:1791 +#: ../../library/re.rst:1800 msgid "" ">>> def repl(m):\n" "... inner_word = list(m.group(2))\n" @@ -2587,11 +2592,11 @@ msgstr "" ">>> re.sub(r\"(\\w)(\\w+)(\\w)\", repl, text)\n" "'Pofsroser Aodlambelk, plasee reoprt yuor asnebces potlmrpy.'" -#: ../../library/re.rst:1804 +#: ../../library/re.rst:1813 msgid "Finding all Adverbs" msgstr "" -#: ../../library/re.rst:1806 +#: ../../library/re.rst:1815 msgid "" ":func:`findall` matches *all* occurrences of a pattern, not just the first " "one as :func:`search` does. For example, if a writer wanted to find all of " @@ -2599,7 +2604,7 @@ msgid "" "manner::" msgstr "" -#: ../../library/re.rst:1811 +#: ../../library/re.rst:1820 msgid "" ">>> text = \"He was carefully disguised but captured quickly by police.\"\n" ">>> re.findall(r\"\\w+ly\\b\", text)\n" @@ -2609,11 +2614,11 @@ msgstr "" ">>> re.findall(r\"\\w+ly\\b\", text)\n" "['carefully', 'quickly']" -#: ../../library/re.rst:1817 +#: ../../library/re.rst:1826 msgid "Finding all Adverbs and their Positions" msgstr "" -#: ../../library/re.rst:1819 +#: ../../library/re.rst:1828 msgid "" "If one wants more information about all matches of a pattern than the " "matched text, :func:`finditer` is useful as it provides :class:`~re.Match` " @@ -2622,7 +2627,7 @@ msgid "" "they would use :func:`finditer` in the following manner::" msgstr "" -#: ../../library/re.rst:1825 +#: ../../library/re.rst:1834 msgid "" ">>> text = \"He was carefully disguised but captured quickly by police.\"\n" ">>> for m in re.finditer(r\"\\w+ly\\b\", text):\n" @@ -2636,11 +2641,11 @@ msgstr "" "07-16: carefully\n" "40-47: quickly" -#: ../../library/re.rst:1833 +#: ../../library/re.rst:1842 msgid "Raw String Notation" msgstr "" -#: ../../library/re.rst:1835 +#: ../../library/re.rst:1844 msgid "" "Raw string notation (``r\"text\"``) keeps regular expressions sane. Without " "it, every backslash (``'\\'``) in a regular expression would have to be " @@ -2648,7 +2653,7 @@ msgid "" "lines of code are functionally identical::" msgstr "" -#: ../../library/re.rst:1840 +#: ../../library/re.rst:1849 msgid "" ">>> re.match(r\"\\W(.)\\1\\W\", \" ff \")\n" "\n" @@ -2660,7 +2665,7 @@ msgstr "" ">>> re.match(\"\\\\W(.)\\\\1\\\\W\", \" ff \")\n" "" -#: ../../library/re.rst:1845 +#: ../../library/re.rst:1854 msgid "" "When one wants to match a literal backslash, it must be escaped in the " "regular expression. With raw string notation, this means ``r\"\\\\\"``. " @@ -2668,7 +2673,7 @@ msgid "" "following lines of code functionally identical::" msgstr "" -#: ../../library/re.rst:1850 +#: ../../library/re.rst:1859 msgid "" ">>> re.match(r\"\\\\\", r\"\\\\\")\n" "\n" @@ -2680,25 +2685,25 @@ msgstr "" ">>> re.match(\"\\\\\\\\\", r\"\\\\\")\n" "" -#: ../../library/re.rst:1857 +#: ../../library/re.rst:1866 msgid "Writing a Tokenizer" msgstr "" -#: ../../library/re.rst:1859 +#: ../../library/re.rst:1868 msgid "" "A `tokenizer or scanner `_ " "analyzes a string to categorize groups of characters. This is a useful " "first step in writing a compiler or interpreter." msgstr "" -#: ../../library/re.rst:1863 +#: ../../library/re.rst:1872 msgid "" "The text categories are specified with regular expressions. The technique " "is to combine those into a single master regular expression and to loop over " "successive matches::" msgstr "" -#: ../../library/re.rst:1867 +#: ../../library/re.rst:1876 msgid "" "from typing import NamedTuple\n" "import re\n" @@ -2754,11 +2759,11 @@ msgid "" " print(token)" msgstr "" -#: ../../library/re.rst:1919 +#: ../../library/re.rst:1928 msgid "The tokenizer produces the following output::" msgstr "" -#: ../../library/re.rst:1921 +#: ../../library/re.rst:1930 msgid "" "Token(type='IF', value='IF', line=2, column=4)\n" "Token(type='ID', value='quantity', line=2, column=7)\n" @@ -2800,7 +2805,7 @@ msgstr "" "Token(type='ENDIF', value='ENDIF', line=5, column=4)\n" "Token(type='END', value=';', line=5, column=9)" -#: ../../library/re.rst:1942 +#: ../../library/re.rst:1951 msgid "" "Friedl, Jeffrey. Mastering Regular Expressions. 3rd ed., O'Reilly Media, " "2009. The third edition of the book no longer covers Python at all, but the " @@ -2816,20 +2821,20 @@ msgstr ". (點)" #: ../../library/re.rst:123 ../../library/re.rst:130 ../../library/re.rst:137 #: ../../library/re.rst:143 ../../library/re.rst:157 ../../library/re.rst:181 #: ../../library/re.rst:220 ../../library/re.rst:235 ../../library/re.rst:244 -#: ../../library/re.rst:257 ../../library/re.rst:262 ../../library/re.rst:295 -#: ../../library/re.rst:308 ../../library/re.rst:318 ../../library/re.rst:350 -#: ../../library/re.rst:405 ../../library/re.rst:437 ../../library/re.rst:443 -#: ../../library/re.rst:448 ../../library/re.rst:455 ../../library/re.rst:462 -#: ../../library/re.rst:489 ../../library/re.rst:499 ../../library/re.rst:522 -#: ../../library/re.rst:534 ../../library/re.rst:539 ../../library/re.rst:561 -#: ../../library/re.rst:581 ../../library/re.rst:597 ../../library/re.rst:605 -#: ../../library/re.rst:619 ../../library/re.rst:627 ../../library/re.rst:644 -#: ../../library/re.rst:658 ../../library/re.rst:663 ../../library/re.rst:854 -#: ../../library/re.rst:1090 +#: ../../library/re.rst:258 ../../library/re.rst:271 ../../library/re.rst:304 +#: ../../library/re.rst:317 ../../library/re.rst:327 ../../library/re.rst:359 +#: ../../library/re.rst:414 ../../library/re.rst:446 ../../library/re.rst:452 +#: ../../library/re.rst:457 ../../library/re.rst:464 ../../library/re.rst:471 +#: ../../library/re.rst:498 ../../library/re.rst:508 ../../library/re.rst:531 +#: ../../library/re.rst:543 ../../library/re.rst:548 ../../library/re.rst:570 +#: ../../library/re.rst:590 ../../library/re.rst:606 ../../library/re.rst:614 +#: ../../library/re.rst:628 ../../library/re.rst:636 ../../library/re.rst:653 +#: ../../library/re.rst:667 ../../library/re.rst:672 ../../library/re.rst:863 +#: ../../library/re.rst:1099 msgid "in regular expressions" msgstr "於正規表示式中" -#: ../../library/re.rst:106 ../../library/re.rst:262 +#: ../../library/re.rst:106 ../../library/re.rst:271 msgid "^ (caret)" msgstr "^ (插入符號)" @@ -2877,7 +2882,7 @@ msgstr "?+" msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/re.rst:220 ../../library/re.rst:257 ../../library/re.rst:522 +#: ../../library/re.rst:220 ../../library/re.rst:258 ../../library/re.rst:531 msgid "\\ (backslash)" msgstr "\\ (反斜線)" @@ -2889,147 +2894,147 @@ msgstr "[] (方括號)" msgid "- (minus)" msgstr "- (減號)" -#: ../../library/re.rst:295 +#: ../../library/re.rst:304 msgid "| (vertical bar)" msgstr "| (垂直線)" -#: ../../library/re.rst:308 +#: ../../library/re.rst:317 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/re.rst:318 +#: ../../library/re.rst:327 msgid "(?" msgstr "(?" -#: ../../library/re.rst:350 +#: ../../library/re.rst:359 msgid "(?:" msgstr "(?:" -#: ../../library/re.rst:405 +#: ../../library/re.rst:414 msgid "(?P<" msgstr "(?P<" -#: ../../library/re.rst:437 +#: ../../library/re.rst:446 msgid "(?P=" msgstr "(?P=" -#: ../../library/re.rst:443 +#: ../../library/re.rst:452 msgid "(?#" msgstr "(?#" -#: ../../library/re.rst:448 +#: ../../library/re.rst:457 msgid "(?=" msgstr "(?=" -#: ../../library/re.rst:455 +#: ../../library/re.rst:464 msgid "(?!" msgstr "(?!" -#: ../../library/re.rst:462 +#: ../../library/re.rst:471 msgid "(?<=" msgstr "(?<=" -#: ../../library/re.rst:489 +#: ../../library/re.rst:498 msgid "(?\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -109,13 +109,13 @@ msgstr "" #: ../../library/readline.rst:67 msgid "" "Execute the init line provided in the *string* argument. This calls :c:func:" -"`rl_parse_and_bind` in the underlying library." +"`!rl_parse_and_bind` in the underlying library." msgstr "" #: ../../library/readline.rst:73 msgid "" "Execute a readline initialization file. The default filename is the last " -"filename used. This calls :c:func:`rl_read_init_file` in the underlying " +"filename used. This calls :c:func:`!rl_read_init_file` in the underlying " "library." msgstr "" @@ -129,20 +129,20 @@ msgstr "" #: ../../library/readline.rst:85 msgid "" -"Return the current contents of the line buffer (:c:data:`rl_line_buffer` in " +"Return the current contents of the line buffer (:c:data:`!rl_line_buffer` in " "the underlying library)." msgstr "" #: ../../library/readline.rst:91 msgid "" "Insert text into the line buffer at the cursor position. This calls :c:func:" -"`rl_insert_text` in the underlying library, but ignores the return value." +"`!rl_insert_text` in the underlying library, but ignores the return value." msgstr "" #: ../../library/readline.rst:98 msgid "" "Change what's displayed on the screen to reflect the current contents of the " -"line buffer. This calls :c:func:`rl_redisplay` in the underlying library." +"line buffer. This calls :c:func:`!rl_redisplay` in the underlying library." msgstr "" #: ../../library/readline.rst:103 @@ -156,22 +156,22 @@ msgstr "" #: ../../library/readline.rst:110 msgid "" "Load a readline history file, and append it to the history list. The default " -"filename is :file:`~/.history`. This calls :c:func:`read_history` in the " +"filename is :file:`~/.history`. This calls :c:func:`!read_history` in the " "underlying library." msgstr "" #: ../../library/readline.rst:117 msgid "" "Save the history list to a readline history file, overwriting any existing " -"file. The default filename is :file:`~/.history`. This calls :c:func:" -"`write_history` in the underlying library." +"file. The default filename is :file:`~/.history`. This calls :c:func:`!" +"write_history` in the underlying library." msgstr "" #: ../../library/readline.rst:124 msgid "" "Append the last *nelements* items of history to a file. The default " "filename is :file:`~/.history`. The file must already exist. This calls :c:" -"func:`append_history` in the underlying library. This function only exists " +"func:`!append_history` in the underlying library. This function only exists " "if Python was compiled for a version of the library that supports it." msgstr "" @@ -179,8 +179,8 @@ msgstr "" msgid "" "Set or return the desired number of lines to save in the history file. The :" "func:`write_history_file` function uses this value to truncate the history " -"file, by calling :c:func:`history_truncate_file` in the underlying library. " -"Negative values imply unlimited history file size." +"file, by calling :c:func:`!history_truncate_file` in the underlying " +"library. Negative values imply unlimited history file size." msgstr "" #: ../../library/readline.rst:144 @@ -193,7 +193,7 @@ msgstr "" #: ../../library/readline.rst:151 msgid "" -"Clear the current history. This calls :c:func:`clear_history` in the " +"Clear the current history. This calls :c:func:`!clear_history` in the " "underlying library. The Python function only exists if Python was compiled " "for a version of the library that supports it." msgstr "" @@ -208,32 +208,32 @@ msgstr "" #: ../../library/readline.rst:165 msgid "" "Return the current contents of history item at *index*. The item index is " -"one-based. This calls :c:func:`history_get` in the underlying library." +"one-based. This calls :c:func:`!history_get` in the underlying library." msgstr "" #: ../../library/readline.rst:171 msgid "" "Remove history item specified by its position from the history. The position " -"is zero-based. This calls :c:func:`remove_history` in the underlying " +"is zero-based. This calls :c:func:`!remove_history` in the underlying " "library." msgstr "" #: ../../library/readline.rst:178 msgid "" "Replace history item specified by its position with *line*. The position is " -"zero-based. This calls :c:func:`replace_history_entry` in the underlying " +"zero-based. This calls :c:func:`!replace_history_entry` in the underlying " "library." msgstr "" #: ../../library/readline.rst:185 msgid "" "Append *line* to the history buffer, as if it was the last line typed. This " -"calls :c:func:`add_history` in the underlying library." +"calls :c:func:`!add_history` in the underlying library." msgstr "" #: ../../library/readline.rst:191 msgid "" -"Enable or disable automatic calls to :c:func:`add_history` when reading " +"Enable or disable automatic calls to :c:func:`!add_history` when reading " "input via readline. The *enabled* argument should be a Boolean value that " "when true, enables auto history, and that when false, disables auto history." msgstr "" @@ -250,16 +250,16 @@ msgstr "" #: ../../library/readline.rst:209 msgid "" -"Set or remove the function invoked by the :c:data:`rl_startup_hook` callback " -"of the underlying library. If *function* is specified, it will be used as " -"the new hook function; if omitted or ``None``, any function already " +"Set or remove the function invoked by the :c:data:`!rl_startup_hook` " +"callback of the underlying library. If *function* is specified, it will be " +"used as the new hook function; if omitted or ``None``, any function already " "installed is removed. The hook is called with no arguments just before " "readline prints the first prompt." msgstr "" #: ../../library/readline.rst:218 msgid "" -"Set or remove the function invoked by the :c:data:`rl_pre_input_hook` " +"Set or remove the function invoked by the :c:data:`!rl_pre_input_hook` " "callback of the underlying library. If *function* is specified, it will be " "used as the new hook function; if omitted or ``None``, any function already " "installed is removed. The hook is called with no arguments after the first " @@ -295,9 +295,9 @@ msgstr "" #: ../../library/readline.rst:249 msgid "" "The installed completer function is invoked by the *entry_func* callback " -"passed to :c:func:`rl_completion_matches` in the underlying library. The " -"*text* string comes from the first parameter to the :c:data:" -"`rl_attempted_completion_function` callback of the underlying library." +"passed to :c:func:`!rl_completion_matches` in the underlying library. The " +"*text* string comes from the first parameter to the :c:data:`!" +"rl_attempted_completion_function` callback of the underlying library." msgstr "" #: ../../library/readline.rst:258 @@ -308,15 +308,15 @@ msgstr "" #: ../../library/readline.rst:263 msgid "" -"Get the type of completion being attempted. This returns the :c:data:" -"`rl_completion_type` variable in the underlying library as an integer." +"Get the type of completion being attempted. This returns the :c:data:`!" +"rl_completion_type` variable in the underlying library as an integer." msgstr "" #: ../../library/readline.rst:271 msgid "" "Get the beginning or ending index of the completion scope. These indexes are " -"the *start* and *end* arguments passed to the :c:data:" -"`rl_attempted_completion_function` callback of the underlying library. The " +"the *start* and *end* arguments passed to the :c:data:`!" +"rl_attempted_completion_function` callback of the underlying library. The " "values may be different in the same input editing scenario based on the " "underlying C readline implementation. Ex: libedit is known to behave " "differently than libreadline." @@ -326,7 +326,7 @@ msgstr "" msgid "" "Set or get the word delimiters for completion. These determine the start of " "the word to be considered for completion (the completion scope). These " -"functions access the :c:data:`rl_completer_word_break_characters` variable " +"functions access the :c:data:`!rl_completer_word_break_characters` variable " "in the underlying library." msgstr "" @@ -335,7 +335,7 @@ msgid "" "Set or remove the completion display function. If *function* is specified, " "it will be used as the new completion display function; if omitted or " "``None``, any completion display function already installed is removed. " -"This sets or clears the :c:data:`rl_completion_display_matches_hook` " +"This sets or clears the :c:data:`!rl_completion_display_matches_hook` " "callback in the underlying library. The completion display function is " "called as ``function(substitution, [matches], longest_match_length)`` once " "each time matches need to be displayed." diff --git a/library/sched.po b/library/sched.po index 3e6f6d458d..2fa14ca924 100644 --- a/library/sched.po +++ b/library/sched.po @@ -92,6 +92,33 @@ msgid "" "From print_time 1652342840.369612 default\n" "1652342840.3697174" msgstr "" +">>> import sched, time\n" +">>> s = sched.scheduler(time.time, time.sleep)\n" +">>> def print_time(a='default'):\n" +"... print(\"From print_time\", time.time(), a)\n" +"...\n" +">>> def print_some_times():\n" +"... print(time.time())\n" +"... s.enter(10, 1, print_time)\n" +"... s.enter(5, 2, print_time, argument=('positional',))\n" +"... # 儘管優先順序較高,但由於 enter() 是相對的,'keyword' 在 " +"'positional' 之後運行\n" +"... s.enter(5, 1, print_time, kwargs={'a': 'keyword'})\n" +"... s.enterabs(1_650_000_000, 10, print_time, argument=(\"first " +"enterabs\",))\n" +"... s.enterabs(1_650_000_000, 5, print_time, argument=(\"second " +"enterabs\",))\n" +"... s.run()\n" +"... print(time.time())\n" +"...\n" +">>> print_some_times()\n" +"1652342830.3640375\n" +"From print_time 1652342830.3642538 second enterabs\n" +"From print_time 1652342830.3643398 first enterabs\n" +"From print_time 1652342835.3694863 positional\n" +"From print_time 1652342835.3696074 keyword\n" +"From print_time 1652342840.369612 default\n" +"1652342840.3697174" #: ../../library/sched.rst:67 msgid "Scheduler Objects" @@ -149,8 +176,8 @@ msgid "" "Remove the event from the queue. If *event* is not an event currently in the " "queue, this method will raise a :exc:`ValueError`." msgstr "" -"從佇列中刪除該事件。如果 *event* 不是目前佇列中的事件,此方法將引發 :exc:" -"`ValueError`。" +"從佇列中刪除該事件。如果 *event* 不是目前佇列中的事件,此方法將引" +"發 :exc:`ValueError`。" #: ../../library/sched.rst:113 msgid "Return ``True`` if the event queue is empty." diff --git a/library/secrets.po b/library/secrets.po index 009b340e6a..4fd800964c 100644 --- a/library/secrets.po +++ b/library/secrets.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 23:08+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2022-11-30 13:42+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -66,8 +66,8 @@ msgid "" "provided by the operating system. See :class:`random.SystemRandom` for " "additional details." msgstr "" -"一個用來產生亂數的類別,用的是作業系統提供的最高品質來源。 請參閱 :class:" -"`random.SystemRandom` 以取得更多細節。" +"一個用來產生亂數的類別,用的是作業系統提供的最高品質來源。 請參" +"閱 :class:`random.SystemRandom` 以取得更多細節。" #: ../../library/secrets.rst:47 msgid "Return a randomly chosen element from a non-empty sequence." @@ -104,10 +104,10 @@ msgstr "" #: ../../library/secrets.rst:71 msgid "" -">>> token_bytes(16) \n" +">>> token_bytes(16)\n" "b'\\xebr\\x17D*t\\xae\\xd4\\xe3S\\xb6\\xe2\\xebP1\\x8b'" msgstr "" -">>> token_bytes(16) \n" +">>> token_bytes(16)\n" "b'\\xebr\\x17D*t\\xae\\xd4\\xe3S\\xb6\\xe2\\xebP1\\x8b'" #: ../../library/secrets.rst:79 @@ -122,10 +122,10 @@ msgstr "" #: ../../library/secrets.rst:83 msgid "" -">>> token_hex(16) \n" +">>> token_hex(16)\n" "'f9bf78b9a18ce6d46a0cd2b0b86df9da'" msgstr "" -">>> token_hex(16) \n" +">>> token_hex(16)\n" "'f9bf78b9a18ce6d46a0cd2b0b86df9da'" #: ../../library/secrets.rst:90 @@ -141,10 +141,10 @@ msgstr "" #: ../../library/secrets.rst:95 msgid "" -">>> token_urlsafe(16) \n" +">>> token_urlsafe(16)\n" "'Drmhze6EPcv0fN_81Bj-nA'" msgstr "" -">>> token_urlsafe(16) \n" +">>> token_urlsafe(16)\n" "'Drmhze6EPcv0fN_81Bj-nA'" #: ../../library/secrets.rst:102 @@ -174,9 +174,9 @@ msgid "" "argument to the various ``token_*`` functions. That argument is taken as " "the number of bytes of randomness to use." msgstr "" -"對於想自行管理權杖長度的使用者,你可以對各種 ``token_*`` 函式明白地指定 :" -"class:`int` 引數(argument)來指定權杖要使用的隨機性程度。 該引數以位元組數來" -"表示要使用的隨機性程度。" +"對於想自行管理權杖長度的使用者,你可以對各種 ``token_*`` 函式明白地指" +"定 :class:`int` 引數(argument)來指定權杖要使用的隨機性程度。 該引數以位元組" +"數來表示要使用的隨機性程度。" #: ../../library/secrets.rst:117 msgid "" @@ -289,6 +289,12 @@ msgid "" " words = [word.strip() for word in f]\n" " password = ' '.join(secrets.choice(words) for i in range(4))" msgstr "" +"import secrets\n" +"# 在標準 Linux 系統上,使用一個方便的字典檔案。\n" +"# 其他平台可能需要提供自己的字詞列表。\n" +"with open('/usr/share/dict/words') as f:\n" +" words = [word.strip() for word in f]\n" +" password = ' '.join(secrets.choice(words) for i in range(4))" #: ../../library/secrets.rst:192 msgid "" diff --git a/library/selectors.po b/library/selectors.po index 6b0f35f089..e231d00893 100644 --- a/library/selectors.po +++ b/library/selectors.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -166,35 +166,35 @@ msgid "" "implementations support the :term:`context manager` protocol." msgstr "" -#: ../../library/selectors.rst:108 +#: ../../library/selectors.rst:109 msgid "Register a file object for selection, monitoring it for I/O events." msgstr "" -#: ../../library/selectors.rst:110 +#: ../../library/selectors.rst:111 msgid "" "*fileobj* is the file object to monitor. It may either be an integer file " "descriptor or an object with a ``fileno()`` method. *events* is a bitwise " "mask of events to monitor. *data* is an opaque object." msgstr "" -#: ../../library/selectors.rst:115 +#: ../../library/selectors.rst:116 msgid "" "This returns a new :class:`SelectorKey` instance, or raises a :exc:" "`ValueError` in case of invalid event mask or file descriptor, or :exc:" "`KeyError` if the file object is already registered." msgstr "" -#: ../../library/selectors.rst:121 +#: ../../library/selectors.rst:123 msgid "" "Unregister a file object from selection, removing it from monitoring. A file " "object shall be unregistered prior to being closed." msgstr "" -#: ../../library/selectors.rst:124 +#: ../../library/selectors.rst:126 msgid "*fileobj* must be a file object previously registered." msgstr "" -#: ../../library/selectors.rst:126 +#: ../../library/selectors.rst:128 msgid "" "This returns the associated :class:`SelectorKey` instance, or raises a :exc:" "`KeyError` if *fileobj* is not registered. It will raise :exc:`ValueError` " @@ -202,30 +202,30 @@ msgid "" "``fileno()`` method has an invalid return value)." msgstr "" -#: ../../library/selectors.rst:133 +#: ../../library/selectors.rst:135 msgid "Change a registered file object's monitored events or attached data." msgstr "" -#: ../../library/selectors.rst:135 +#: ../../library/selectors.rst:137 msgid "" "This is equivalent to ``BaseSelector.unregister(fileobj)`` followed by " "``BaseSelector.register(fileobj, events, data)``, except that it can be " "implemented more efficiently." msgstr "" -#: ../../library/selectors.rst:139 +#: ../../library/selectors.rst:141 msgid "" "This returns a new :class:`SelectorKey` instance, or raises a :exc:" "`ValueError` in case of invalid event mask or file descriptor, or :exc:" "`KeyError` if the file object is not registered." msgstr "" -#: ../../library/selectors.rst:145 +#: ../../library/selectors.rst:148 msgid "" "Wait until some registered file objects become ready, or the timeout expires." msgstr "" -#: ../../library/selectors.rst:148 +#: ../../library/selectors.rst:151 msgid "" "If ``timeout > 0``, this specifies the maximum wait time, in seconds. If " "``timeout <= 0``, the call won't block, and will report the currently ready " @@ -233,26 +233,26 @@ msgid "" "monitored file object becomes ready." msgstr "" -#: ../../library/selectors.rst:154 +#: ../../library/selectors.rst:157 msgid "" "This returns a list of ``(key, events)`` tuples, one for each ready file " "object." msgstr "" -#: ../../library/selectors.rst:157 +#: ../../library/selectors.rst:160 msgid "" "*key* is the :class:`SelectorKey` instance corresponding to a ready file " "object. *events* is a bitmask of events ready on this file object." msgstr "" -#: ../../library/selectors.rst:162 +#: ../../library/selectors.rst:165 msgid "" "This method can return before any file object becomes ready or the timeout " "has elapsed if the current process receives a signal: in this case, an empty " "list will be returned." msgstr "" -#: ../../library/selectors.rst:166 +#: ../../library/selectors.rst:169 msgid "" "The selector is now retried with a recomputed timeout when interrupted by a " "signal if the signal handler did not raise an exception (see :pep:`475` for " @@ -260,90 +260,90 @@ msgid "" "timeout." msgstr "" -#: ../../library/selectors.rst:174 +#: ../../library/selectors.rst:177 msgid "Close the selector." msgstr "" -#: ../../library/selectors.rst:176 +#: ../../library/selectors.rst:179 msgid "" "This must be called to make sure that any underlying resource is freed. The " "selector shall not be used once it has been closed." msgstr "" -#: ../../library/selectors.rst:181 +#: ../../library/selectors.rst:184 msgid "Return the key associated with a registered file object." msgstr "" -#: ../../library/selectors.rst:183 +#: ../../library/selectors.rst:186 msgid "" "This returns the :class:`SelectorKey` instance associated to this file " "object, or raises :exc:`KeyError` if the file object is not registered." msgstr "" -#: ../../library/selectors.rst:188 +#: ../../library/selectors.rst:192 msgid "Return a mapping of file objects to selector keys." msgstr "" -#: ../../library/selectors.rst:190 +#: ../../library/selectors.rst:194 msgid "" "This returns a :class:`~collections.abc.Mapping` instance mapping registered " "file objects to their associated :class:`SelectorKey` instance." msgstr "" -#: ../../library/selectors.rst:197 +#: ../../library/selectors.rst:201 msgid "" "The default selector class, using the most efficient implementation " "available on the current platform. This should be the default choice for " "most users." msgstr "" -#: ../../library/selectors.rst:204 +#: ../../library/selectors.rst:208 msgid ":func:`select.select`-based selector." msgstr "" -#: ../../library/selectors.rst:209 +#: ../../library/selectors.rst:213 msgid ":func:`select.poll`-based selector." msgstr "" -#: ../../library/selectors.rst:214 +#: ../../library/selectors.rst:218 msgid ":func:`select.epoll`-based selector." msgstr "" -#: ../../library/selectors.rst:218 +#: ../../library/selectors.rst:222 msgid "" "This returns the file descriptor used by the underlying :func:`select.epoll` " "object." msgstr "" -#: ../../library/selectors.rst:223 +#: ../../library/selectors.rst:227 msgid ":func:`select.devpoll`-based selector." msgstr "" -#: ../../library/selectors.rst:227 +#: ../../library/selectors.rst:231 msgid "" "This returns the file descriptor used by the underlying :func:`select." "devpoll` object." msgstr "" -#: ../../library/selectors.rst:234 +#: ../../library/selectors.rst:238 msgid ":func:`select.kqueue`-based selector." msgstr "" -#: ../../library/selectors.rst:238 +#: ../../library/selectors.rst:242 msgid "" "This returns the file descriptor used by the underlying :func:`select." "kqueue` object." msgstr "" -#: ../../library/selectors.rst:243 +#: ../../library/selectors.rst:247 msgid "Examples" msgstr "範例" -#: ../../library/selectors.rst:245 +#: ../../library/selectors.rst:249 msgid "Here is a simple echo server implementation::" msgstr "" -#: ../../library/selectors.rst:247 +#: ../../library/selectors.rst:251 msgid "" "import selectors\n" "import socket\n" diff --git a/library/shutil.po b/library/shutil.po index 633b582f04..2eac9779e4 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-23 00:14+0000\n" +"POT-Creation-Date: 2025-04-20 00:16+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,8 +35,8 @@ msgstr "" #: ../../library/shutil.rst:25 msgid "" -"Even the higher-level file copying functions (:func:`shutil.copy`, :func:" -"`shutil.copy2`) cannot copy all file metadata." +"Even the higher-level file copying functions " +"(:func:`shutil.copy`, :func:`shutil.copy2`) cannot copy all file metadata." msgstr "" #: ../../library/shutil.rst:28 @@ -98,8 +98,8 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.copyfile`` with " "arguments ``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." -"copyfile``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " +"``shutil.copyfile``。" #: ../../library/shutil.rst:72 msgid "" @@ -135,10 +135,10 @@ msgid "" "like object>` or path names given as strings. If *follow_symlinks* is false, " "and both *src* and *dst* are symbolic links, :func:`copymode` will attempt " "to modify the mode of *dst* itself (rather than the file it points to). " -"This functionality is not available on every platform; please see :func:" -"`copystat` for more information. If :func:`copymode` cannot modify symbolic " -"links on the local platform, and it is asked to do so, it will do nothing " -"and return." +"This functionality is not available on every platform; please " +"see :func:`copystat` for more information. If :func:`copymode` cannot " +"modify symbolic links on the local platform, and it is asked to do so, it " +"will do nothing and return." msgstr "" #: ../../library/shutil.rst:106 ../../library/shutil.rst:179 @@ -146,8 +146,8 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.copymode`` with " "arguments ``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." -"copymode``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " +"``shutil.copymode``。" #: ../../library/shutil.rst:108 msgid "Added *follow_symlinks* argument." @@ -190,9 +190,9 @@ msgstr "" #: ../../library/shutil.rst:140 msgid "" -"If ``os.chflags in os.supports_follow_symlinks`` is ``True``, :func:" -"`copystat` can modify the flags of a symbolic link. (``os.chflags`` is not " -"available on all platforms.)" +"If ``os.chflags in os.supports_follow_symlinks`` is " +"``True``, :func:`copystat` can modify the flags of a symbolic link. " +"(``os.chflags`` is not available on all platforms.)" msgstr "" #: ../../library/shutil.rst:145 @@ -211,8 +211,8 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.copystat`` with " "arguments ``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." -"copystat``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " +"``shutil.copystat``。" #: ../../library/shutil.rst:155 msgid "" @@ -260,15 +260,16 @@ msgid "" "attempts to copy all metadata from the *src* symbolic link to the newly " "created *dst* symbolic link. However, this functionality is not available on " "all platforms. On platforms where some or all of this functionality is " -"unavailable, :func:`copy2` will preserve all the metadata it can; :func:" -"`copy2` never raises an exception because it cannot preserve file metadata." +"unavailable, :func:`copy2` will preserve all the metadata it " +"can; :func:`copy2` never raises an exception because it cannot preserve file " +"metadata." msgstr "" #: ../../library/shutil.rst:204 msgid "" -":func:`copy2` uses :func:`copystat` to copy the file metadata. Please see :" -"func:`copystat` for more information about platform support for modifying " -"symbolic link metadata." +":func:`copy2` uses :func:`copystat` to copy the file metadata. Please " +"see :func:`copystat` for more information about platform support for " +"modifying symbolic link metadata." msgstr "" #: ../../library/shutil.rst:212 @@ -280,9 +281,9 @@ msgstr "" #: ../../library/shutil.rst:224 msgid "" -"This factory function creates a function that can be used as a callable for :" -"func:`copytree`\\'s *ignore* argument, ignoring files and directories that " -"match one of the glob-style *patterns* provided. See the example below." +"This factory function creates a function that can be used as a callable " +"for :func:`copytree`\\'s *ignore* argument, ignoring files and directories " +"that match one of the glob-style *patterns* provided. See the example below." msgstr "" #: ../../library/shutil.rst:233 @@ -309,9 +310,9 @@ msgstr "" #: ../../library/shutil.rst:245 msgid "" "When *symlinks* is false, if the file pointed to by the symlink doesn't " -"exist, an exception will be added in the list of errors raised in an :exc:" -"`Error` exception at the end of the copy process. You can set the optional " -"*ignore_dangling_symlinks* flag to true if you want to silence this " +"exist, an exception will be added in the list of errors raised in " +"an :exc:`Error` exception at the end of the copy process. You can set the " +"optional *ignore_dangling_symlinks* flag to true if you want to silence this " "exception. Notice that this option has no effect on platforms that don't " "support :func:`os.symlink`." msgstr "" @@ -344,8 +345,8 @@ msgstr "" #: ../../library/shutil.rst:269 msgid "" -"If *dirs_exist_ok* is false (the default) and *dst* already exists, a :exc:" -"`FileExistsError` is raised. If *dirs_exist_ok* is true, the copying " +"If *dirs_exist_ok* is false (the default) and *dst* already exists, " +"a :exc:`FileExistsError` is raised. If *dirs_exist_ok* is true, the copying " "operation will continue if it encounters existing directories, and files " "within the *dst* tree will be overwritten by corresponding files from the " "*src* tree." @@ -356,8 +357,8 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.copytree`` with " "arguments ``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." -"copytree``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " +"``shutil.copytree``。" #: ../../library/shutil.rst:277 msgid "" @@ -452,8 +453,8 @@ msgstr "新增 *onexc* 參數並棄用 *onerror*。" #: ../../library/shutil.rst:346 msgid "" ":func:`!rmtree` now ignores :exc:`FileNotFoundError` exceptions for all but " -"the top-level path. Exceptions other than :exc:`OSError` and subclasses of :" -"exc:`!OSError` are now always propagated to the caller." +"the top-level path. Exceptions other than :exc:`OSError` and subclasses " +"of :exc:`!OSError` are now always propagated to the caller." msgstr "" #: ../../library/shutil.rst:354 @@ -494,9 +495,9 @@ msgstr "" msgid "" "If *copy_function* is given, it must be a callable that takes two arguments, " "*src* and the destination, and will be used to copy *src* to the destination " -"if :func:`os.rename` cannot be used. If the source is a directory, :func:" -"`copytree` is called, passing it the *copy_function*. The default " -"*copy_function* is :func:`copy2`. Using :func:`~shutil.copy` as the " +"if :func:`os.rename` cannot be used. If the source is a " +"directory, :func:`copytree` is called, passing it the *copy_function*. The " +"default *copy_function* is :func:`copy2`. Using :func:`~shutil.copy` as the " "*copy_function* allows the move to succeed when it is not possible to also " "copy the metadata, at the expense of not copying any of the metadata." msgstr "" @@ -506,8 +507,8 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.move`` with arguments " "``src``, ``dst``." msgstr "" -"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." -"move``。" +"引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` " +"``shutil.move``。" #: ../../library/shutil.rst:388 msgid "" @@ -586,9 +587,9 @@ msgstr "" #: ../../library/shutil.rst:452 msgid "" "*path* is a \"``PATH`` string\" specifying the directories to look in, " -"delimited by :data:`os.pathsep`. When no *path* is specified, the :envvar:" -"`PATH` environment variable is read from :data:`os.environ`, falling back " -"to :data:`os.defpath` if it is not set." +"delimited by :data:`os.pathsep`. When no *path* is specified, " +"the :envvar:`PATH` environment variable is read from :data:`os.environ`, " +"falling back to :data:`os.defpath` if it is not set." msgstr "" #: ../../library/shutil.rst:457 @@ -626,10 +627,10 @@ msgstr "" #: ../../library/shutil.rst:476 msgid "" -">> shutil.which(\"C:\\\\Python33\\\\python\")\n" +">>> shutil.which(\"C:\\\\Python33\\\\python\")\n" "'C:\\\\Python33\\\\python.EXE'" msgstr "" -">> shutil.which(\"C:\\\\Python33\\\\python\")\n" +">>> shutil.which(\"C:\\\\Python33\\\\python\")\n" "'C:\\\\Python33\\\\python.EXE'" #: ../../library/shutil.rst:481 @@ -662,12 +663,12 @@ msgstr "" #: ../../library/shutil.rst:505 msgid "" -"Starting from Python 3.8, all functions involving a file copy (:func:" -"`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, and :func:" -"`move`) may use platform-specific \"fast-copy\" syscalls in order to copy " -"the file more efficiently (see :issue:`33671`). \"fast-copy\" means that the " -"copying operation occurs within the kernel, avoiding the use of userspace " -"buffers in Python as in \"``outfd.write(infd.read())``\"." +"Starting from Python 3.8, all functions involving a file copy " +"(:func:`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, " +"and :func:`move`) may use platform-specific \"fast-copy\" syscalls in order " +"to copy the file more efficiently (see :issue:`33671`). \"fast-copy\" means " +"that the copying operation occurs within the kernel, avoiding the use of " +"userspace buffers in Python as in \"``outfd.write(infd.read())``\"." msgstr "" #: ../../library/shutil.rst:513 @@ -681,15 +682,15 @@ msgstr "" #: ../../library/shutil.rst:517 msgid "" "On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " -"instead of 64 KiB) and a :func:`memoryview`-based variant of :func:`shutil." -"copyfileobj` is used." +"instead of 64 KiB) and a :func:`memoryview`-based variant " +"of :func:`shutil.copyfileobj` is used." msgstr "" #: ../../library/shutil.rst:521 msgid "" "If the fast-copy operation fails and no data was written in the destination " -"file then shutil will silently fallback on using less efficient :func:" -"`copyfileobj` function internally." +"file then shutil will silently fallback on using less " +"efficient :func:`copyfileobj` function internally." msgstr "" #: ../../library/shutil.rst:530 @@ -785,8 +786,8 @@ msgstr "" msgid "" "*format* is the archive format: one of \"zip\" (if the :mod:`zlib` module is " "available), \"tar\", \"gztar\" (if the :mod:`zlib` module is available), " -"\"bztar\" (if the :mod:`bz2` module is available), or \"xztar\" (if the :mod:" -"`lzma` module is available)." +"\"bztar\" (if the :mod:`bz2` module is available), or \"xztar\" (if " +"the :mod:`lzma` module is available)." msgstr "" #: ../../library/shutil.rst:599 @@ -835,15 +836,15 @@ msgid "" "Raises an :ref:`auditing event ` ``shutil.make_archive`` with " "arguments ``base_name``, ``format``, ``root_dir``, ``base_dir``." msgstr "" -"引發一個附帶引數 ``base_name``、``format``、``root_dir``、``base_dir`` 的\\ :" -"ref:`稽核事件 ` ``shutil.make_archive``。" +"引發一個附帶引數 ``base_name``、``format``、``root_dir``、``base_dir`` 的" +"\\ :ref:`稽核事件 ` ``shutil.make_archive``。" #: ../../library/shutil.rst:626 msgid "" -"This function is not thread-safe when custom archivers registered with :func:" -"`register_archive_format` do not support the *root_dir* argument. In this " -"case it temporarily changes the current working directory of the process to " -"*root_dir* to perform archiving." +"This function is not thread-safe when custom archivers registered " +"with :func:`register_archive_format` do not support the *root_dir* " +"argument. In this case it temporarily changes the current working directory " +"of the process to *root_dir* to perform archiving." msgstr "" #: ../../library/shutil.rst:632 @@ -950,10 +951,11 @@ msgstr "" #: ../../library/shutil.rst:695 msgid "" "*format* is the archive format: one of \"zip\", \"tar\", \"gztar\", " -"\"bztar\", or \"xztar\". Or any other format registered with :func:" -"`register_unpack_format`. If not provided, :func:`unpack_archive` will use " -"the archive file name extension and see if an unpacker was registered for " -"that extension. In case none is found, a :exc:`ValueError` is raised." +"\"bztar\", or \"xztar\". Or any other format registered " +"with :func:`register_unpack_format`. If not " +"provided, :func:`unpack_archive` will use the archive file name extension " +"and see if an unpacker was registered for that extension. In case none is " +"found, a :exc:`ValueError` is raised." msgstr "" #: ../../library/shutil.rst:702 @@ -993,8 +995,8 @@ msgstr "新增 *filter* 引數。" #: ../../library/shutil.rst:727 msgid "" "Registers an unpack format. *name* is the name of the format and " -"*extensions* is a list of extensions corresponding to the format, like ``." -"zip`` for Zip files." +"*extensions* is a list of extensions corresponding to the format, like " +"``.zip`` for Zip files." msgstr "" #: ../../library/shutil.rst:731 @@ -1014,8 +1016,8 @@ msgstr "" #: ../../library/shutil.rst:736 msgid "" -"possibly a *filter* keyword argument, if it was given to :func:" -"`unpack_archive`;" +"possibly a *filter* keyword argument, if it was given " +"to :func:`unpack_archive`;" msgstr "" #: ../../library/shutil.rst:738 @@ -1133,8 +1135,8 @@ msgstr "" #: ../../library/shutil.rst:818 msgid "" -"In the final archive, :file:`please_add.txt` should be included, but :file:" -"`do_not_add.txt` should not. Therefore we use the following::" +"In the final archive, :file:`please_add.txt` should be included, " +"but :file:`do_not_add.txt` should not. Therefore we use the following::" msgstr "" #: ../../library/shutil.rst:821 @@ -1193,8 +1195,8 @@ msgstr "" #: ../../library/shutil.rst:852 msgid "" "When ``COLUMNS`` or ``LINES`` is not defined, which is the common case, the " -"terminal connected to :data:`sys.__stdout__` is queried by invoking :func:" -"`os.get_terminal_size`." +"terminal connected to :data:`sys.__stdout__` is queried by " +"invoking :func:`os.get_terminal_size`." msgstr "" #: ../../library/shutil.rst:856 diff --git a/library/signal.po b/library/signal.po index 1ae764dd5d..4eb34bd770 100644 --- a/library/signal.po +++ b/library/signal.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-04-15 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,8 +51,8 @@ msgstr "" msgid "" "A handler for a particular signal, once set, remains installed until it is " "explicitly reset (Python emulates the BSD style interface regardless of the " -"underlying implementation), with the exception of the handler for :const:" -"`SIGCHLD`, which follows the underlying implementation." +"underlying implementation), with the exception of the handler " +"for :const:`SIGCHLD`, which follows the underlying implementation." msgstr "" "特定訊號的處理程式一旦被設定,就會一直被安裝,直到被明確地重設為止 (不管底層" "的實作為何,Python 皆模擬出 BSD 風格的介面),但 :const:`SIGCHLD` 的處理程式除" @@ -86,12 +86,12 @@ msgstr "" #: ../../library/signal.rst:42 msgid "" -"It makes little sense to catch synchronous errors like :const:`SIGFPE` or :" -"const:`SIGSEGV` that are caused by an invalid operation in C code. Python " -"will return from the signal handler to the C code, which is likely to raise " -"the same signal again, causing Python to apparently hang. From Python 3.3 " -"onwards, you can use the :mod:`faulthandler` module to report on synchronous " -"errors." +"It makes little sense to catch synchronous errors like :const:`SIGFPE` " +"or :const:`SIGSEGV` that are caused by an invalid operation in C code. " +"Python will return from the signal handler to the C code, which is likely to " +"raise the same signal again, causing Python to apparently hang. From Python " +"3.3 onwards, you can use the :mod:`faulthandler` module to report on " +"synchronous errors." msgstr "" "捕捉像 :const:`SIGFPE` 或 :const:`SIGSEGV` 這類由 C 程式碼中無效操作所引起的" "同步錯誤是沒有意義的。Python 將從訊號處理程式中回傳到 C 程式碼,而 C 程式碼很" @@ -131,8 +131,8 @@ msgid "" "instead." msgstr "" "Python 訊號處理程式總是在主直譯器的主 Python 執行緒中執行,即使訊號是在另一個" -"執行緒中接收到的。這意味著訊號不能用來做為執行緒間通訊的方式。你可以使用 :" -"mod:`threading` 模組的同步原語 (synchronization primitive) 來代替。" +"執行緒中接收到的。這意味著訊號不能用來做為執行緒間通訊的方式。你可以使" +"用 :mod:`threading` 模組的同步原語 (synchronization primitive) 來代替。" #: ../../library/signal.rst:69 msgid "" @@ -146,20 +146,22 @@ msgstr "模組內容" #: ../../library/signal.rst:75 msgid "" -"signal (SIG*), handler (:const:`SIG_DFL`, :const:`SIG_IGN`) and sigmask (:" -"const:`SIG_BLOCK`, :const:`SIG_UNBLOCK`, :const:`SIG_SETMASK`) related " -"constants listed below were turned into :class:`enums ` (:" -"class:`Signals`, :class:`Handlers` and :class:`Sigmasks` respectively). :" -"func:`getsignal`, :func:`pthread_sigmask`, :func:`sigpending` and :func:" -"`sigwait` functions return human-readable :class:`enums ` as :" -"class:`Signals` objects." +"signal (SIG*), handler (:const:`SIG_DFL`, :const:`SIG_IGN`) and sigmask " +"(:const:`SIG_BLOCK`, :const:`SIG_UNBLOCK`, :const:`SIG_SETMASK`) related " +"constants listed below were turned into :class:`enums ` " +"(:class:`Signals`, :class:`Handlers` and :class:`Sigmasks` " +"respectively). :func:`getsignal`, :func:`pthread_sigmask`, :func:`sigpending` " +"and :func:`sigwait` functions return human-readable :class:`enums " +"` as :class:`Signals` objects." msgstr "" "下面列出的訊號 (SIG*)、處理器(:const:`SIG_DFL`、:const:`SIG_IGN`)和訊號遮" -"罩 (sigmask)(:const:`SIG_BLOCK`、:const:`SIG_UNBLOCK`、:const:" -"`SIG_SETMASK`)的相關常數被轉換成 :class:`enums `\\ (:class:" -"`Signals`、:class:`Handlers` 和 :class:`Sigmasks`)。:func:`getsignal`、:" -"func:`pthread_sigmask`、:func:`sigpending` 和 :func:`sigwait` 函式會回傳可被" -"人類閱讀的\\ :class:`枚舉 `\\ 作為 :class:`Signals` 物件。" +"罩 (sigmask)" +"(:const:`SIG_BLOCK`、:const:`SIG_UNBLOCK`、:const:`SIG_SETMASK`)的相關常數" +"被轉換成 :class:`enums `\\ " +"(:class:`Signals`、:class:`Handlers` " +"和 :class:`Sigmasks`)。:func:`getsignal`、:func:`pthread_sigmask`、:func:`sigpending` " +"和 :func:`sigwait` 函式會回傳可被人類閱讀的\\ :class:`枚舉 `\\ " +"作為 :class:`Signals` 物件。" #: ../../library/signal.rst:85 msgid "The signal module defines three enums:" @@ -172,18 +174,18 @@ msgstr "SIG* 常數和 CTRL_* 常數的 :class:`enum.IntEnum` 集合。" #: ../../library/signal.rst:95 msgid "" -":class:`enum.IntEnum` collection the constants :const:`SIG_DFL` and :const:" -"`SIG_IGN`." +":class:`enum.IntEnum` collection the constants :const:`SIG_DFL` " +"and :const:`SIG_IGN`." msgstr "" ":const:`SIG_DFL` 和 :const:`SIG_IGN` 常數的 :class:`enum.IntEnum` 集合。" #: ../../library/signal.rst:101 msgid "" -":class:`enum.IntEnum` collection the constants :const:`SIG_BLOCK`, :const:" -"`SIG_UNBLOCK` and :const:`SIG_SETMASK`." +":class:`enum.IntEnum` collection the " +"constants :const:`SIG_BLOCK`, :const:`SIG_UNBLOCK` and :const:`SIG_SETMASK`." msgstr "" -":const:`SIG_BLOCK`、:const:`SIG_UNBLOCK` 和 :const:`SIG_SETMASK` 常數的 :" -"class:`enum.IntEnum` 集合。" +":const:`SIG_BLOCK`、:const:`SIG_UNBLOCK` 和 :const:`SIG_SETMASK` 常數" +"的 :class:`enum.IntEnum` 集合。" #: ../../library/signal.rst:103 ../../library/signal.rst:136 #: ../../library/signal.rst:142 ../../library/signal.rst:148 @@ -196,9 +198,9 @@ msgstr "" #: ../../library/signal.rst:351 ../../library/signal.rst:390 #: ../../library/signal.rst:414 ../../library/signal.rst:437 #: ../../library/signal.rst:471 ../../library/signal.rst:501 -#: ../../library/signal.rst:508 ../../library/signal.rst:561 -#: ../../library/signal.rst:603 ../../library/signal.rst:618 -#: ../../library/signal.rst:644 ../../library/signal.rst:664 +#: ../../library/signal.rst:508 ../../library/signal.rst:563 +#: ../../library/signal.rst:605 ../../library/signal.rst:620 +#: ../../library/signal.rst:646 ../../library/signal.rst:666 msgid "Availability" msgstr "" @@ -222,8 +224,8 @@ msgid "" "default action for :const:`SIGCHLD` is to simply ignore it." msgstr "" "這是兩種標準訊號處理選項之一;它會簡單地執行訊號的預設功能。例如,在大多數系" -"統上,:const:`SIGQUIT` 的預設動作是轉儲 (dump) 核心並退出,而 :const:" -"`SIGCHLD` 的預設動作是直接忽略。" +"統上,:const:`SIGQUIT` 的預設動作是轉儲 (dump) 核心並退出," +"而 :const:`SIGCHLD` 的預設動作是直接忽略。" #: ../../library/signal.rst:124 msgid "" @@ -318,8 +320,8 @@ msgstr "" #: ../../library/signal.rst:219 msgid "" -"On architectures where the signal is available. See the man page :manpage:" -"`signal(7)` for further information." +"On architectures where the signal is available. See the man " +"page :manpage:`signal(7)` for further information." msgstr "" "在訊號可用的架構上。請參閱 :manpage:`signal(7)` 線上手冊以取得更多資訊。" @@ -345,23 +347,25 @@ msgid "" "signal is defined as :const:`signal.SIGHUP`; the variable names are " "identical to the names used in C programs, as found in ````. The " "Unix man page for ':c:func:`signal`' lists the existing signals (on some " -"systems this is :manpage:`signal(2)`, on others the list is in :manpage:" -"`signal(7)`). Note that not all systems define the same set of signal names; " -"only those names defined by the system are defined by this module." -msgstr "" -"所有的訊號編號都是以符號定義的。例如,掛斷訊號被定義為 :const:`signal." -"SIGHUP`;變數名稱與 C 程式中使用的名稱相同,可在 ```` 中找到。Unix " -"線上手冊 ':c:func:`signal`' 列出了現有的訊號(在某些系統上是 :manpage:" -"`signal(2)`,在其他系統上是在 :manpage:`signal(7)` 中)。請注意,並非所有系統" -"都會定義同一套訊號名稱;只有那些由系統所定義的名稱才會由這個模組定義。" +"systems this is :manpage:`signal(2)`, on others the list is " +"in :manpage:`signal(7)`). Note that not all systems define the same set of " +"signal names; only those names defined by the system are defined by this " +"module." +msgstr "" +"所有的訊號編號都是以符號定義的。例如,掛斷訊號被定義" +"為 :const:`signal.SIGHUP`;變數名稱與 C 程式中使用的名稱相同,可在 " +"```` 中找到。Unix 線上手冊 ':c:func:`signal`' 列出了現有的訊號(在" +"某些系統上是 :manpage:`signal(2)`,在其他系統上是在 :manpage:`signal(7)` " +"中)。請注意,並非所有系統都會定義同一套訊號名稱;只有那些由系統所定義的名稱" +"才會由這個模組定義。" #: ../../library/signal.rst:259 msgid "" "The signal corresponding to the :kbd:`Ctrl+C` keystroke event. This signal " "can only be used with :func:`os.kill`." msgstr "" -"與 :kbd:`Ctrl+C` 擊鍵 (keystroke) 事件相對應的訊號。此訊號只能與 :func:`os." -"kill` 搭配使用。" +"與 :kbd:`Ctrl+C` 擊鍵 (keystroke) 事件相對應的訊號。此訊號只能" +"與 :func:`os.kill` 搭配使用。" #: ../../library/signal.rst:269 msgid "" @@ -373,8 +377,8 @@ msgstr "" #: ../../library/signal.rst:279 msgid "" -"One more than the number of the highest signal number. Use :func:" -"`valid_signals` to get valid signal numbers." +"One more than the number of the highest signal number. " +"Use :func:`valid_signals` to get valid signal numbers." msgstr "" "比最高編號訊號的編號多一。使用 :func:`valid_signals` 來取得有效的訊號編號。" @@ -427,10 +431,10 @@ msgstr ":mod:`signal` 模組定義了一個例外:" #: ../../library/signal.rst:329 msgid "" -"Raised to signal an error from the underlying :func:`setitimer` or :func:" -"`getitimer` implementation. Expect this error if an invalid interval timer " -"or a negative time is passed to :func:`setitimer`. This error is a subtype " -"of :exc:`OSError`." +"Raised to signal an error from the underlying :func:`setitimer` " +"or :func:`getitimer` implementation. Expect this error if an invalid " +"interval timer or a negative time is passed to :func:`setitimer`. This error " +"is a subtype of :exc:`OSError`." msgstr "" "當 :func:`setitimer` 或 :func:`getitimer` 底層實作發生錯誤時引發訊號。如果傳" "給 :func:`setitimer` 的是無效的間隔計時器或負數時間,則預期會發生此錯誤。這個" @@ -438,8 +442,8 @@ msgstr "" #: ../../library/signal.rst:334 msgid "" -"This error used to be a subtype of :exc:`IOError`, which is now an alias of :" -"exc:`OSError`." +"This error used to be a subtype of :exc:`IOError`, which is now an alias " +"of :exc:`OSError`." msgstr "此錯誤過去是 :exc:`IOError` 的子型別,現在是 :exc:`OSError` 的別名。" #: ../../library/signal.rst:339 @@ -469,28 +473,28 @@ msgstr "更多資訊請見 :manpage:`alarm(2)` 線上手冊。" #: ../../library/signal.rst:358 msgid "" "Return the current signal handler for the signal *signalnum*. The returned " -"value may be a callable Python object, or one of the special values :const:" -"`signal.SIG_IGN`, :const:`signal.SIG_DFL` or :const:`None`. Here, :const:" -"`signal.SIG_IGN` means that the signal was previously ignored, :const:" -"`signal.SIG_DFL` means that the default way of handling the signal was " -"previously in use, and ``None`` means that the previous signal handler was " -"not installed from Python." +"value may be a callable Python object, or one of the special " +"values :const:`signal.SIG_IGN`, :const:`signal.SIG_DFL` or :const:`None`. " +"Here, :const:`signal.SIG_IGN` means that the signal was previously " +"ignored, :const:`signal.SIG_DFL` means that the default way of handling the " +"signal was previously in use, and ``None`` means that the previous signal " +"handler was not installed from Python." msgstr "" "回傳訊號 *signalnum* 的目前訊號處理程式。回傳值可以是一個可呼叫的 Python 物" -"件,或是特殊值 :const:`signal.SIG_IGN`、:const:`signal.SIG_DFL` 或 :const:" -"`None` 之一。這裡的 :const:`signal.SIG_IGN` 表示訊號先前被忽略,:const:" -"`signal.SIG_DFL` 表示訊號先前使用預設的處理方式,而 ``None`` 表示先前的訊號處" -"理程式並未從 Python 安裝。" +"件,或是特殊值 :const:`signal.SIG_IGN`、:const:`signal.SIG_DFL` " +"或 :const:`None` 之一。這裡的 :const:`signal.SIG_IGN` 表示訊號先前被忽" +"略,:const:`signal.SIG_DFL` 表示訊號先前使用預設的處理方式,而 ``None`` 表示" +"先前的訊號處理程式並未從 Python 安裝。" #: ../../library/signal.rst:369 msgid "" -"Returns the description of signal *signalnum*, such as \"Interrupt\" for :" -"const:`SIGINT`. Returns :const:`None` if *signalnum* has no description. " -"Raises :exc:`ValueError` if *signalnum* is invalid." +"Returns the description of signal *signalnum*, such as \"Interrupt\" " +"for :const:`SIGINT`. Returns :const:`None` if *signalnum* has no " +"description. Raises :exc:`ValueError` if *signalnum* is invalid." msgstr "" "回傳訊號 *signalnum* 的描述,例如 :const:`SIGINT` 的 \"Interrupt\"。如果 " -"*signalnum* 沒有描述,則回傳 :const:`None`。如果 *signalnum* 無效則會引發 :" -"exc:`ValueError`。" +"*signalnum* 沒有描述,則回傳 :const:`None`。如果 *signalnum* 無效則會引" +"發 :exc:`ValueError`。" #: ../../library/signal.rst:378 msgid "" @@ -513,11 +517,11 @@ msgstr "更多資訊請見 :manpage:`signal(2)` 線上手冊。" #: ../../library/signal.rst:394 msgid "" -"See also :func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` and :" -"func:`sigpending`." +"See also :func:`sigwait`, :func:`sigwaitinfo`, :func:`sigtimedwait` " +"and :func:`sigpending`." msgstr "" -"也請見 :func:`sigwait`、:func:`sigwaitinfo`、:func:`sigtimedwait` 和 :func:" -"`sigpending`。" +"也請見 :func:`sigwait`、:func:`sigwaitinfo`、:func:`sigtimedwait` " +"和 :func:`sigpending`。" #: ../../library/signal.rst:400 msgid "Sends a signal to the calling process. Returns nothing." @@ -559,8 +563,8 @@ msgid "" "attribute of :class:`threading.Thread` objects to get a suitable value for " "*thread_id*." msgstr "" -"使用 :func:`threading.get_ident` 或 :class:`threading.Thread` 物件的 :attr:" -"`~threading.Thread.ident` 屬性來取得 *thread_id* 的適當值。" +"使用 :func:`threading.get_ident` 或 :class:`threading.Thread` 物件" +"的 :attr:`~threading.Thread.ident` 屬性來取得 *thread_id* 的適當值。" #: ../../library/signal.rst:432 msgid "" @@ -624,13 +628,13 @@ msgstr ":data:`SIG_SETMASK`:將被阻檔的訊號集合設定為 *mask* 引數 #: ../../library/signal.rst:462 msgid "" -"*mask* is a set of signal numbers (e.g. {:const:`signal.SIGINT`, :const:" -"`signal.SIGTERM`}). Use :func:`~signal.valid_signals` for a full mask " -"including all signals." +"*mask* is a set of signal numbers (e.g. " +"{:const:`signal.SIGINT`, :const:`signal.SIGTERM`}). " +"Use :func:`~signal.valid_signals` for a full mask including all signals." msgstr "" -"*mask* 是一組訊號編號(例如 {:const:`signal.SIGINT`, :const:`signal." -"SIGTERM`})的集合。使用 :func:`~signal.valid_signals` 來取得包含所有訊號的完" -"整遮罩。" +"*mask* 是一組訊號編號(例如 " +"{:const:`signal.SIGINT`, :const:`signal.SIGTERM`})的集合。使" +"用 :func:`~signal.valid_signals` 來取得包含所有訊號的完整遮罩。" #: ../../library/signal.rst:466 msgid "" @@ -650,30 +654,33 @@ msgstr "另請參閱 :func:`pause`、:func:`sigpending` 與 :func:`sigwait`。" #: ../../library/signal.rst:483 msgid "" -"Sets given interval timer (one of :const:`signal.ITIMER_REAL`, :const:" -"`signal.ITIMER_VIRTUAL` or :const:`signal.ITIMER_PROF`) specified by *which* " -"to fire after *seconds* (float is accepted, different from :func:`alarm`) " -"and after that every *interval* seconds (if *interval* is non-zero). The " -"interval timer specified by *which* can be cleared by setting *seconds* to " -"zero." +"Sets given interval timer (one " +"of :const:`signal.ITIMER_REAL`, :const:`signal.ITIMER_VIRTUAL` " +"or :const:`signal.ITIMER_PROF`) specified by *which* to fire after *seconds* " +"(float is accepted, different from :func:`alarm`) and after that every " +"*interval* seconds (if *interval* is non-zero). The interval timer specified " +"by *which* can be cleared by setting *seconds* to zero." msgstr "" -"設定由 *which* 指定的間隔計時器(:const:`signal.ITIMER_REAL`、:const:`signal." -"ITIMER_VIRTUAL` 或 :const:`signal.ITIMER_PROF` 之一)並在*seconds*\\ (接受浮" -"點數,與 :func:`alarm` 不同)之後啟動,在之後的每 *interval* 秒啟動一次(如" -"果 *interval* 非零)。*which* 指定的間隔計時器可透過將 *seconds* 設定為零來清" -"除它。" +"設定由 *which* 指定的間隔計時器" +"(:const:`signal.ITIMER_REAL`、:const:`signal.ITIMER_VIRTUAL` " +"或 :const:`signal.ITIMER_PROF` 之一)並在*seconds*\\ (接受浮點數," +"與 :func:`alarm` 不同)之後啟動,在之後的每 *interval* 秒啟動一次(如果 " +"*interval* 非零)。*which* 指定的間隔計時器可透過將 *seconds* 設定為零來清除" +"它。" #: ../../library/signal.rst:490 msgid "" "When an interval timer fires, a signal is sent to the process. The signal " "sent is dependent on the timer being used; :const:`signal.ITIMER_REAL` will " -"deliver :const:`SIGALRM`, :const:`signal.ITIMER_VIRTUAL` sends :const:" -"`SIGVTALRM`, and :const:`signal.ITIMER_PROF` will deliver :const:`SIGPROF`." +"deliver :const:`SIGALRM`, :const:`signal.ITIMER_VIRTUAL` " +"sends :const:`SIGVTALRM`, and :const:`signal.ITIMER_PROF` will " +"deliver :const:`SIGPROF`." msgstr "" -"當間隔計時器啟動時,一個訊號會被傳送給行程。傳送的訊號取決於使用的計時器;:" -"const:`signal.ITIMER_REAL` 會傳送 :const:`SIGALRM`,:const:`signal." -"ITIMER_VIRTUAL` 會傳送 :const:`SIGVTALRM`,而 :const:`signal.ITIMER_PROF` 會" -"傳送 :const:`SIGPROF`。" +"當間隔計時器啟動時,一個訊號會被傳送給行程。傳送的訊號取決於使用的計時" +"器;:const:`signal.ITIMER_REAL` 會傳" +"送 :const:`SIGALRM`,:const:`signal.ITIMER_VIRTUAL` 會傳" +"送 :const:`SIGVTALRM`,而 :const:`signal.ITIMER_PROF` 會傳" +"送 :const:`SIGPROF`。" #: ../../library/signal.rst:496 msgid "The old values are returned as a tuple: (delay, interval)." @@ -681,8 +688,8 @@ msgstr "舊值會以一個元組回傳:(delay, interval)。" #: ../../library/signal.rst:498 msgid "" -"Attempting to pass an invalid interval timer will cause an :exc:" -"`ItimerError`." +"Attempting to pass an invalid interval timer will cause " +"an :exc:`ItimerError`." msgstr "嘗試傳入無效的間隔計時器會導致 :exc:`ItimerError`。" #: ../../library/signal.rst:506 @@ -691,15 +698,19 @@ msgstr "回傳由 *which* 指定之間隔計時器的目前值。" #: ../../library/signal.rst:513 msgid "" -"Set the wakeup file descriptor to *fd*. When a signal is received, the " -"signal number is written as a single byte into the fd. This can be used by " -"a library to wakeup a poll or select call, allowing the signal to be fully " -"processed." +"Set the wakeup file descriptor to *fd*. When a signal your program has " +"registered a signal handler for is received, the signal number is written as " +"a single byte into the fd. If you haven't registered a signal handler for " +"the signals you care about, then nothing will be written to the wakeup fd. " +"This can be used by a library to wakeup a poll or select call, allowing the " +"signal to be fully processed." msgstr "" -"設定喚醒檔案描述器為 *fd*。當接收到訊號時,訊號編號會以單一位元組寫入 fd。這" -"可被函式庫用來喚醒輪詢 (wakeup a poll) 或 select 呼叫,讓訊號得以完全處理。" +"設定喚醒檔案描述器為 *fd*。當接收到其處理程式已有被註冊的訊號時,訊號編號會以" +"單一位元組寫入 fd。如果你沒有為你在意的訊號註冊處理程式,就不會寫入到喚醒 " +"fd。這可被函式庫用來喚醒輪詢 (wakeup a poll) 或 select 呼叫,讓訊號得以完全處" +"理。" -#: ../../library/signal.rst:518 +#: ../../library/signal.rst:520 msgid "" "The old wakeup fd is returned (or -1 if file descriptor wakeup was not " "enabled). If *fd* is -1, file descriptor wakeup is disabled. If not -1, " @@ -710,7 +721,7 @@ msgstr "" "停用檔案描述器喚醒。如果不是 -1,*fd* 必須是非阻塞的。在再次呼叫輪詢或 " "select 之前,由函式庫來決定是否移除 *fd* 中的任何位元組。" -#: ../../library/signal.rst:523 ../../library/signal.rst:578 +#: ../../library/signal.rst:525 ../../library/signal.rst:580 msgid "" "When threads are enabled, this function can only be called from :ref:`the " "main thread of the main interpreter `; attempting to " @@ -720,7 +731,7 @@ msgstr "" "當啟用執行緒時,這個函式只能從\\ :ref:`主直譯器 `\\ 的主" "執行緒來呼叫;嘗試從其他執行緒呼叫它將會引發 :exc:`ValueError` 例外。" -#: ../../library/signal.rst:528 +#: ../../library/signal.rst:530 msgid "" "There are two common ways to use this function. In both approaches, you use " "the fd to wake up when a signal arrives, but then they differ in how they " @@ -729,7 +740,7 @@ msgstr "" "使用這個函式有兩種常見的方式。在這兩種方法中,當訊號抵達時,你都要使用 fd 來" "喚醒,但它們的不同之處在於如何判斷\\ *哪個或哪些*\\ 訊號有抵達。" -#: ../../library/signal.rst:533 +#: ../../library/signal.rst:535 msgid "" "In the first approach, we read the data out of the fd's buffer, and the byte " "values give you the signal numbers. This is simple, but in rare cases it can " @@ -745,7 +756,7 @@ msgstr "" "法,那麼你應該設定 ``warn_on_full_buffer=True``,這至少會在訊號丟失時將警告印" "出到 stderr。" -#: ../../library/signal.rst:542 +#: ../../library/signal.rst:544 msgid "" "In the second approach, we use the wakeup fd *only* for wakeups, and ignore " "the actual byte values. In this case, all we care about is whether the fd's " @@ -759,15 +770,15 @@ msgstr "" "如果你使用這種方法,那麼你應該設定 ``warn_on_full_buffer=False``,這樣你的使" "用者就不會被虛假的警告訊息所混淆。" -#: ../../library/signal.rst:549 +#: ../../library/signal.rst:551 msgid "On Windows, the function now also supports socket handles." msgstr "在 Windows 上,此功能現在也支援 socket 處理程式。" -#: ../../library/signal.rst:552 +#: ../../library/signal.rst:554 msgid "Added ``warn_on_full_buffer`` parameter." msgstr "新增 ``warn_on_full_buffer`` 參數。" -#: ../../library/signal.rst:557 +#: ../../library/signal.rst:559 msgid "" "Change system call restart behaviour: if *flag* is :const:`False`, system " "calls will be restarted when interrupted by signal *signalnum*, otherwise " @@ -776,11 +787,11 @@ msgstr "" "改變系統呼叫重新啟動的行為:如果 *flag* 是 :const:`False`,系統呼叫會在被訊" "號 *signalnum* 中斷時重新啟動,否則系統呼叫會被中斷。不會回傳任何東西。" -#: ../../library/signal.rst:563 +#: ../../library/signal.rst:565 msgid "See the man page :manpage:`siginterrupt(3)` for further information." msgstr "更多資訊請見 :manpage:`siginterrupt(3)` 線上手冊。" -#: ../../library/signal.rst:565 +#: ../../library/signal.rst:567 msgid "" "Note that installing a signal handler with :func:`signal` will reset the " "restart behaviour to interruptible by implicitly calling :c:func:`!" @@ -789,21 +800,22 @@ msgstr "" "請注意,使用 :func:`signal` 安裝訊號處理程式,會透過隱式呼叫 :c:func:`!" "siginterrupt` 來將重新啟動的行為重設為可中斷,且指定訊號的 *flag* 值為 true。" -#: ../../library/signal.rst:572 +#: ../../library/signal.rst:574 msgid "" "Set the handler for signal *signalnum* to the function *handler*. *handler* " "can be a callable Python object taking two arguments (see below), or one of " "the special values :const:`signal.SIG_IGN` or :const:`signal.SIG_DFL`. The " -"previous signal handler will be returned (see the description of :func:" -"`getsignal` above). (See the Unix man page :manpage:`signal(2)` for further " -"information.)" +"previous signal handler will be returned (see the description " +"of :func:`getsignal` above). (See the Unix man page :manpage:`signal(2)` " +"for further information.)" msgstr "" "將訊號 *signalnum* 的處理程式設定為函式 *handler*。*handler* 可以是帶兩個引數" -"的可呼叫 Python 物件(見下面),或是特殊值 :const:`signal.SIG_IGN` 或 :const:" -"`signal.SIG_DFL` 之一。先前的訊號處理程式將會被回傳(請參閱上面 :func:" -"`getsignal` 的說明)。(更多資訊請參閱 Unix 線上手冊 :`signal(2)`)。" +"的可呼叫 Python 物件(見下面),或是特殊值 :const:`signal.SIG_IGN` " +"或 :const:`signal.SIG_DFL` 之一。先前的訊號處理程式將會被回傳(請參閱上" +"面 :func:`getsignal` 的說明)。(更多資訊請參閱 Unix 線上手" +"冊 :manpage:`signal(2)`)。" -#: ../../library/signal.rst:583 +#: ../../library/signal.rst:585 msgid "" "The *handler* is called with two arguments: the signal number and the " "current stack frame (``None`` or a frame object; for a description of frame " @@ -814,22 +826,22 @@ msgstr "" "frame 物件;關於 frame 物件的描述,請參閱\\ :ref:`型別階層中的描述 `\\ 或 :mod:`inspect` 模組中的屬性描述)。" -#: ../../library/signal.rst:588 +#: ../../library/signal.rst:590 msgid "" -"On Windows, :func:`signal` can only be called with :const:`SIGABRT`, :const:" -"`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, :const:" -"`SIGTERM`, or :const:`SIGBREAK`. A :exc:`ValueError` will be raised in any " -"other case. Note that not all systems define the same set of signal names; " +"On Windows, :func:`signal` can only be called " +"with :const:`SIGABRT`, :const:`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, :const:`SIGTERM`, " +"or :const:`SIGBREAK`. A :exc:`ValueError` will be raised in any other case. " +"Note that not all systems define the same set of signal names; " "an :exc:`AttributeError` will be raised if a signal name is not defined as " "``SIG*`` module level constant." msgstr "" -"在 Windows 上,:func:`signal` 只能在使用 :const:`SIGABRT`、:const:`SIGFPE`、:" -"const:`SIGILL`、:const:`SIGINT`、:const:`SIGSEGV`、:const:`SIGTERM` 或 :" -"const:`SIGBREAK` 時呼叫。在其他情況下會引發 :exc:`ValueError`。請注意,並非所" -"有系統都定義相同的訊號名稱;如果訊號名稱沒有被定義為 ``SIG*`` 模組層級常數," -"則會引發 :exc:`AttributeError` 錯誤。" +"在 Windows 上,:func:`signal` 只能在使" +"用 :const:`SIGABRT`、:const:`SIGFPE`、:const:`SIGILL`、:const:`SIGINT`、:const:`SIGSEGV`、:const:`SIGTERM` " +"或 :const:`SIGBREAK` 時呼叫。在其他情況下會引發 :exc:`ValueError`。請注意,並" +"非所有系統都定義相同的訊號名稱;如果訊號名稱沒有被定義為 ``SIG*`` 模組層級常" +"數,則會引發 :exc:`AttributeError` 錯誤。" -#: ../../library/signal.rst:599 +#: ../../library/signal.rst:601 msgid "" "Examine the set of signals that are pending for delivery to the calling " "thread (i.e., the signals which have been raised while blocked). Return the " @@ -838,15 +850,15 @@ msgstr "" "檢查待傳送至呼叫執行緒的訊號集合(即阻檔時已被提出的訊號)。回傳待定訊號的集" "合。" -#: ../../library/signal.rst:605 +#: ../../library/signal.rst:607 msgid "See the man page :manpage:`sigpending(2)` for further information." msgstr "更多資訊請見 :manpage:`sigpending(2)` 線上手冊。" -#: ../../library/signal.rst:607 +#: ../../library/signal.rst:609 msgid "See also :func:`pause`, :func:`pthread_sigmask` and :func:`sigwait`." msgstr "另請參閱 :func:`pause`、:func:`pthread_sigmask` 與 :func:`sigwait`。" -#: ../../library/signal.rst:614 +#: ../../library/signal.rst:616 msgid "" "Suspend execution of the calling thread until the delivery of one of the " "signals specified in the signal set *sigset*. The function accepts the " @@ -856,54 +868,55 @@ msgstr "" "暫停呼叫執行緒的執行,直到送出訊號集合 *sigset* 中指定的一個訊號。函式接受訊" "號(將其從待定訊號清單中移除),並回傳訊號編號。" -#: ../../library/signal.rst:620 +#: ../../library/signal.rst:622 msgid "See the man page :manpage:`sigwait(3)` for further information." msgstr "更多資訊請見 :manpage:`sigwait(3)` 線上手冊。" -#: ../../library/signal.rst:622 +#: ../../library/signal.rst:624 msgid "" -"See also :func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:" -"`sigwaitinfo` and :func:`sigtimedwait`." +"See " +"also :func:`pause`, :func:`pthread_sigmask`, :func:`sigpending`, :func:`sigwaitinfo` " +"and :func:`sigtimedwait`." msgstr "" -"另也請見 :func:`pause`、:func:`pthread_sigmask`、:func:`sigpending`、:func:" -"`sigwaitinfo` 和 :func:`sigtimedwait`。" +"另也請" +"見 :func:`pause`、:func:`pthread_sigmask`、:func:`sigpending`、:func:`sigwaitinfo` " +"和 :func:`sigtimedwait`。" -#: ../../library/signal.rst:630 +#: ../../library/signal.rst:632 msgid "" "Suspend execution of the calling thread until the delivery of one of the " "signals specified in the signal set *sigset*. The function accepts the " "signal and removes it from the pending list of signals. If one of the " "signals in *sigset* is already pending for the calling thread, the function " "will return immediately with information about that signal. The signal " -"handler is not called for the delivered signal. The function raises an :exc:" -"`InterruptedError` if it is interrupted by a signal that is not in *sigset*." +"handler is not called for the delivered signal. The function raises " +"an :exc:`InterruptedError` if it is interrupted by a signal that is not in " +"*sigset*." msgstr "" "暫停呼叫執行緒的執行,直到送出訊號集合 *sigset* 中指定的一個訊號。該函式接受" "訊號,並將其從待定訊號清單中移除。如果 *sigset* 中的一個訊號已經是呼叫執行緒" "的待定訊號,函式會立即回傳該訊號的相關資訊。對於已傳送的訊號,訊號處理程式不" -"會被呼叫。如果被不在 *sigset* 中的訊號中斷,函式會引發 :exc:" -"`InterruptedError`。" +"會被呼叫。如果被不在 *sigset* 中的訊號中斷,函式會引" +"發 :exc:`InterruptedError`。" -#: ../../library/signal.rst:639 +#: ../../library/signal.rst:641 msgid "" -"The return value is an object representing the data contained in the :c:type:" -"`siginfo_t` structure, namely: :attr:`si_signo`, :attr:`si_code`, :attr:" -"`si_errno`, :attr:`si_pid`, :attr:`si_uid`, :attr:`si_status`, :attr:" -"`si_band`." +"The return value is an object representing the data contained in " +"the :c:type:`siginfo_t` structure, " +"namely: :attr:`si_signo`, :attr:`si_code`, :attr:`si_errno`, :attr:`si_pid`, :attr:`si_uid`, :attr:`si_status`, :attr:`si_band`." msgstr "" -"回傳值是一個物件,代表 :c:type:`siginfo_t` 結構所包含的資料,即 :attr:" -"`si_signo`、:attr:`si_code`、:attr:`si_errno`、:attr:`si_pid`、:attr:" -"`si_uid`、:attr:`si_status`、:attr:`si_band`。" +"回傳值是一個物件,代表 :c:type:`siginfo_t` 結構所包含的資料," +"即 :attr:`si_signo`、:attr:`si_code`、:attr:`si_errno`、:attr:`si_pid`、:attr:`si_uid`、:attr:`si_status`、:attr:`si_band`。" -#: ../../library/signal.rst:646 +#: ../../library/signal.rst:648 msgid "See the man page :manpage:`sigwaitinfo(2)` for further information." msgstr "更多資訊請見 :manpage:`sigwaitinfo(2)` 線上手冊。" -#: ../../library/signal.rst:648 +#: ../../library/signal.rst:650 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigtimedwait`." msgstr "另請參閱 :func:`pause`、:func:`sigwait` 與 :func:`sigtimedwait`。" -#: ../../library/signal.rst:652 +#: ../../library/signal.rst:654 msgid "" "The function is now retried if interrupted by a signal not in *sigset* and " "the signal handler does not raise an exception (see :pep:`475` for the " @@ -912,7 +925,7 @@ msgstr "" "現在如果被不在 *sigset* 中的訊號中斷,且訊號處理程式沒有引發例外,則會重試函" "式(理由請參閱 :pep:`475`)。" -#: ../../library/signal.rst:660 +#: ../../library/signal.rst:662 msgid "" "Like :func:`sigwaitinfo`, but takes an additional *timeout* argument " "specifying a timeout. If *timeout* is specified as ``0``, a poll is " @@ -921,15 +934,15 @@ msgstr "" "類似 :func:`sigwaitinfo`,但需要額外的 *timeout* 引數指定逾時時間。如果 " "*timeout* 指定為 ``0``,會執行輪詢。如果發生逾時則會回傳 :const:`None`。" -#: ../../library/signal.rst:666 +#: ../../library/signal.rst:668 msgid "See the man page :manpage:`sigtimedwait(2)` for further information." msgstr "更多資訊請見 :manpage:`sigtimedwait(2)` 線上手冊。" -#: ../../library/signal.rst:668 +#: ../../library/signal.rst:670 msgid "See also :func:`pause`, :func:`sigwait` and :func:`sigwaitinfo`." msgstr "另請參閱 :func:`pause`、:func:`sigwait` 與 :func:`sigwaitinfo`。" -#: ../../library/signal.rst:672 +#: ../../library/signal.rst:674 msgid "" "The function is now retried with the recomputed *timeout* if interrupted by " "a signal not in *sigset* and the signal handler does not raise an exception " @@ -938,11 +951,11 @@ msgstr "" "現在如果被不在 *sigset* 中的訊號中斷,且訊號處理程式沒有引發例外,則會使用重" "新計算的 *timeout* 重試函式(理由請參閱 :pep:`475`)。" -#: ../../library/signal.rst:681 +#: ../../library/signal.rst:683 msgid "Examples" msgstr "範例" -#: ../../library/signal.rst:683 +#: ../../library/signal.rst:685 msgid "" "Here is a minimal example program. It uses the :func:`alarm` function to " "limit the time spent waiting to open a file; this is useful if the file is " @@ -956,7 +969,7 @@ msgstr "" "無限期地被擱置。解決方法是在開啟檔案前設定一個 5 秒的警報;如果操作時間過長," "警報訊號就會被送出,而處理程式會產生例外。 ::" -#: ../../library/signal.rst:690 +#: ../../library/signal.rst:692 msgid "" "import signal, os\n" "\n" @@ -990,24 +1003,24 @@ msgstr "" "\n" "signal.alarm(0) # 停用警報" -#: ../../library/signal.rst:707 +#: ../../library/signal.rst:709 msgid "Note on SIGPIPE" msgstr "關於 SIGPIPE 的說明" -#: ../../library/signal.rst:709 +#: ../../library/signal.rst:711 msgid "" -"Piping output of your program to tools like :manpage:`head(1)` will cause a :" -"const:`SIGPIPE` signal to be sent to your process when the receiver of its " -"standard output closes early. This results in an exception like :code:" -"`BrokenPipeError: [Errno 32] Broken pipe`. To handle this case, wrap your " -"entry point to catch this exception as follows::" +"Piping output of your program to tools like :manpage:`head(1)` will cause " +"a :const:`SIGPIPE` signal to be sent to your process when the receiver of " +"its standard output closes early. This results in an exception " +"like :code:`BrokenPipeError: [Errno 32] Broken pipe`. To handle this case, " +"wrap your entry point to catch this exception as follows::" msgstr "" "將程式的輸出管道化到 :manpage:`head(1)` 之類的工具,會在你的行程的標準輸出接" -"收器提早關閉時,導致 :const:`SIGPIPE` 訊號傳送給你的行程。這會導致類似 :code:" -"`BrokenPipeError: [Errno 32] Broken pipe` 的例外。要處理這種情況,請將你的進" -"入點包裝成如下的樣子來捕捉這個例外: ::" +"收器提早關閉時,導致 :const:`SIGPIPE` 訊號傳送給你的行程。這會導致類" +"似 :code:`BrokenPipeError: [Errno 32] Broken pipe` 的例外。要處理這種情況,請" +"將你的進入點包裝成如下的樣子來捕捉這個例外: ::" -#: ../../library/signal.rst:715 +#: ../../library/signal.rst:717 msgid "" "import os\n" "import sys\n" @@ -1052,7 +1065,7 @@ msgstr "" "if __name__ == '__main__':\n" " main()" -#: ../../library/signal.rst:736 +#: ../../library/signal.rst:738 msgid "" "Do not set :const:`SIGPIPE`'s disposition to :const:`SIG_DFL` in order to " "avoid :exc:`BrokenPipeError`. Doing that would cause your program to exit " @@ -1063,11 +1076,11 @@ msgstr "" "(disposition) 設定為 :const:`SIG_DFL`。這樣做會導致你的程式在寫入任何 socket " "連線時被中斷而意外退出。" -#: ../../library/signal.rst:745 +#: ../../library/signal.rst:747 msgid "Note on Signal Handlers and Exceptions" msgstr "訊號處理程式與例外的說明" -#: ../../library/signal.rst:747 +#: ../../library/signal.rst:749 msgid "" "If a signal handler raises an exception, the exception will be propagated to " "the main thread and may be raised after any :term:`bytecode` instruction. " @@ -1079,15 +1092,15 @@ msgid "" msgstr "" "如果訊號處理程式產生例外,例外會傳送到主執行緒並可能在任何 :term:`bytecode` " "指令之後發生。最值得注意的是,:exc:`KeyboardInterrupt` 可能在執行過程中的任何" -"時候出現。大多數 Python 程式碼,包括標準函式庫,都無法避免這種情況,因此 :" -"exc:`KeyboardInterrupt`\\ (或任何其他由訊號處理程式產生的例外)可能會在罕見" -"的情況下使程式處於預期之外的狀態。" +"時候出現。大多數 Python 程式碼,包括標準函式庫,都無法避免這種情況,因" +"此 :exc:`KeyboardInterrupt`\\ (或任何其他由訊號處理程式產生的例外)可能會在" +"罕見的情況下使程式處於預期之外的狀態。" -#: ../../library/signal.rst:754 +#: ../../library/signal.rst:756 msgid "To illustrate this issue, consider the following code::" msgstr "為了說明這個問題,請參考以下程式碼: ::" -#: ../../library/signal.rst:756 +#: ../../library/signal.rst:758 msgid "" "class SpamContext:\n" " def __init__(self):\n" @@ -1119,11 +1132,11 @@ msgstr "" " ...\n" " self.lock.release()" -#: ../../library/signal.rst:771 +#: ../../library/signal.rst:773 msgid "" -"For many programs, especially those that merely want to exit on :exc:" -"`KeyboardInterrupt`, this is not a problem, but applications that are " -"complex or require high reliability should avoid raising exceptions from " +"For many programs, especially those that merely want to exit " +"on :exc:`KeyboardInterrupt`, this is not a problem, but applications that " +"are complex or require high reliability should avoid raising exceptions from " "signal handlers. They should also avoid catching :exc:`KeyboardInterrupt` as " "a means of gracefully shutting down. Instead, they should install their " "own :const:`SIGINT` handler. Below is an example of an HTTP server that " @@ -1132,11 +1145,11 @@ msgstr "" "對許多程式來說,尤其是那些只想在 :exc:`KeyboardInterrupt` 時退出的程式,這並" "不是問題,但是對於複雜或需要高可靠性的應用程式來說,應該避免從訊號處理程式產" "生例外。它們也應該避免將捕獲 :exc:`KeyboardInterrupt` 作為一種優雅關閉 " -"(gracefully shutting down) 的方式。相反地,它們應該安裝自己的 :const:" -"`SIGINT` 處理程式。以下是 HTTP 伺服器避免 :exc:`KeyboardInterrupt` 的範" -"例: ::" +"(gracefully shutting down) 的方式。相反地,它們應該安裝自己" +"的 :const:`SIGINT` 處理程式。以下是 HTTP 伺服器避免 :exc:`KeyboardInterrupt` " +"的範例: ::" -#: ../../library/signal.rst:779 +#: ../../library/signal.rst:781 msgid "" "import signal\n" "import socket\n" diff --git a/library/smtplib.po b/library/smtplib.po index 5e46fd820e..921c053924 100644 --- a/library/smtplib.po +++ b/library/smtplib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-02-12 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -706,11 +706,11 @@ msgid "" "and *to_addrs*, ``send_message`` does not transmit any :mailheader:`Bcc` or :" "mailheader:`Resent-Bcc` headers that may appear in *msg*. If any of the " "addresses in *from_addr* and *to_addrs* contain non-ASCII characters and the " -"server does not advertise ``SMTPUTF8`` support, an :exc:`SMTPNotSupported` " -"error is raised. Otherwise the ``Message`` is serialized with a clone of " -"its :mod:`~email.policy` with the :attr:`~email.policy.EmailPolicy.utf8` " -"attribute set to ``True``, and ``SMTPUTF8`` and ``BODY=8BITMIME`` are added " -"to *mail_options*." +"server does not advertise ``SMTPUTF8`` support, an :exc:" +"`SMTPNotSupportedError` is raised. Otherwise the ``Message`` is serialized " +"with a clone of its :mod:`~email.policy` with the :attr:`~email.policy." +"EmailPolicy.utf8` attribute set to ``True``, and ``SMTPUTF8`` and " +"``BODY=8BITMIME`` are added to *mail_options*." msgstr "" #: ../../library/smtplib.rst:534 diff --git a/library/socket.po b/library/socket.po index 67135fe667..3f6e8c5fc1 100644 --- a/library/socket.po +++ b/library/socket.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-10-30 00:03+0000\n" +"POT-Creation-Date: 2025-04-19 00:14+0000\n" "PO-Revision-Date: 2024-12-30 23:45+0800\n" "Last-Translator: Jay \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -19,8 +19,8 @@ msgstr "" "X-Generator: Poedit 3.5\n" #: ../../library/socket.rst:2 -msgid ":mod:`socket` --- Low-level networking interface" -msgstr ":mod:`socket` — 網路底層介面" +msgid ":mod:`!socket` --- Low-level networking interface" +msgstr ":mod:`!socket` — 低階網路介面" #: ../../library/socket.rst:7 msgid "**Source code:** :source:`Lib/socket.py`" @@ -41,35 +41,35 @@ msgid "" "operating system socket APIs." msgstr "由於是呼叫作業系統的 socket API,某些行為可能會因平台而有所差異。" -#: ../../library/socket.rst:171 ../../library/socket.rst:181 -#: ../../library/socket.rst:209 ../../library/socket.rst:216 -#: ../../library/socket.rst:233 ../../library/socket.rst:383 -#: ../../library/socket.rst:461 ../../library/socket.rst:475 -#: ../../library/socket.rst:490 ../../library/socket.rst:501 -#: ../../library/socket.rst:510 ../../library/socket.rst:519 -#: ../../library/socket.rst:530 ../../library/socket.rst:542 -#: ../../library/socket.rst:553 ../../library/socket.rst:566 -#: ../../library/socket.rst:594 ../../library/socket.rst:606 -#: ../../library/socket.rst:612 ../../library/socket.rst:643 -#: ../../library/socket.rst:658 ../../library/socket.rst:667 -#: ../../library/socket.rst:684 ../../library/socket.rst:699 -#: ../../library/socket.rst:709 ../../library/socket.rst:898 -#: ../../library/socket.rst:1023 ../../library/socket.rst:1039 -#: ../../library/socket.rst:1052 ../../library/socket.rst:1067 -#: ../../library/socket.rst:1084 ../../library/socket.rst:1095 -#: ../../library/socket.rst:1106 ../../library/socket.rst:1117 -#: ../../library/socket.rst:1206 ../../library/socket.rst:1226 -#: ../../library/socket.rst:1252 ../../library/socket.rst:1275 -#: ../../library/socket.rst:1304 ../../library/socket.rst:1315 -#: ../../library/socket.rst:1342 ../../library/socket.rst:1359 -#: ../../library/socket.rst:1376 ../../library/socket.rst:1390 -#: ../../library/socket.rst:1441 ../../library/socket.rst:1488 -#: ../../library/socket.rst:1502 ../../library/socket.rst:1522 -#: ../../library/socket.rst:1569 ../../library/socket.rst:1614 -#: ../../library/socket.rst:1739 ../../library/socket.rst:1783 -#: ../../library/socket.rst:1891 ../../library/socket.rst:1909 -#: ../../library/socket.rst:1993 ../../library/socket.rst:2003 -#: ../../library/socket.rst:2015 ../../includes/wasm-notavail.rst:3 +#: ../../library/socket.rst:176 ../../library/socket.rst:186 +#: ../../library/socket.rst:214 ../../library/socket.rst:221 +#: ../../library/socket.rst:238 ../../library/socket.rst:388 +#: ../../library/socket.rst:466 ../../library/socket.rst:483 +#: ../../library/socket.rst:498 ../../library/socket.rst:509 +#: ../../library/socket.rst:518 ../../library/socket.rst:527 +#: ../../library/socket.rst:538 ../../library/socket.rst:550 +#: ../../library/socket.rst:561 ../../library/socket.rst:574 +#: ../../library/socket.rst:602 ../../library/socket.rst:614 +#: ../../library/socket.rst:620 ../../library/socket.rst:650 +#: ../../library/socket.rst:665 ../../library/socket.rst:674 +#: ../../library/socket.rst:691 ../../library/socket.rst:706 +#: ../../library/socket.rst:716 ../../library/socket.rst:905 +#: ../../library/socket.rst:1030 ../../library/socket.rst:1046 +#: ../../library/socket.rst:1059 ../../library/socket.rst:1074 +#: ../../library/socket.rst:1091 ../../library/socket.rst:1102 +#: ../../library/socket.rst:1113 ../../library/socket.rst:1124 +#: ../../library/socket.rst:1213 ../../library/socket.rst:1233 +#: ../../library/socket.rst:1259 ../../library/socket.rst:1282 +#: ../../library/socket.rst:1311 ../../library/socket.rst:1322 +#: ../../library/socket.rst:1349 ../../library/socket.rst:1366 +#: ../../library/socket.rst:1383 ../../library/socket.rst:1397 +#: ../../library/socket.rst:1448 ../../library/socket.rst:1495 +#: ../../library/socket.rst:1509 ../../library/socket.rst:1529 +#: ../../library/socket.rst:1576 ../../library/socket.rst:1621 +#: ../../library/socket.rst:1746 ../../library/socket.rst:1790 +#: ../../library/socket.rst:1898 ../../library/socket.rst:1916 +#: ../../library/socket.rst:2000 ../../library/socket.rst:2010 +#: ../../library/socket.rst:2022 ../../includes/wasm-notavail.rst:3 msgid "Availability" msgstr "" @@ -147,8 +147,8 @@ msgid "" "Previously, :const:`AF_UNIX` socket paths were assumed to use UTF-8 encoding." msgstr "" -#: ../../library/socket.rst:66 ../../library/socket.rst:1189 -#: ../../library/socket.rst:1231 ../../library/socket.rst:1987 +#: ../../library/socket.rst:66 ../../library/socket.rst:1196 +#: ../../library/socket.rst:1238 ../../library/socket.rst:1994 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" @@ -281,120 +281,132 @@ msgid "" msgstr "" #: ../../library/socket.rst:146 +msgid ":const:`BTPROTO_HCI` accepts a format that depends on your OS." +msgstr "" + +#: ../../library/socket.rst:148 +msgid "" +"On Linux it accepts a tuple ``(device_id,)`` where ``device_id`` is an " +"integer specifying the number of the Bluetooth device." +msgstr "" + +#: ../../library/socket.rst:150 msgid "" -":const:`BTPROTO_HCI` accepts ``(device_id,)`` where ``device_id`` is either " -"an integer or a string with the Bluetooth address of the interface. (This " -"depends on your OS; NetBSD and DragonFlyBSD expect a Bluetooth address while " -"everything else expects an integer.)" +"On FreeBSD, NetBSD and DragonFly BSD it accepts ``bdaddr`` where ``bdaddr`` " +"is the Bluetooth address as a string." msgstr "" -#: ../../library/socket.rst:151 +#: ../../library/socket.rst:153 msgid "NetBSD and DragonFlyBSD support added." msgstr "加入對 NetBSD 和 DragonFlyBSD 的支援。" -#: ../../library/socket.rst:154 +#: ../../library/socket.rst:156 +msgid "FreeBSD support added." +msgstr "新增對 FreeBSD 的支援。" + +#: ../../library/socket.rst:159 msgid "" -":const:`BTPROTO_SCO` accepts ``bdaddr`` where ``bdaddr`` is a :class:`bytes` " -"object containing the Bluetooth address in a string format. (ex. " -"``b'12:23:34:45:56:67'``) This protocol is not supported under FreeBSD." +":const:`BTPROTO_SCO` accepts ``bdaddr`` where ``bdaddr`` is the Bluetooth " +"address as a string or a :class:`bytes` object. (ex. ``'12:23:34:45:56:67'`` " +"or ``b'12:23:34:45:56:67'``) This protocol is not supported under FreeBSD." msgstr "" -#: ../../library/socket.rst:159 +#: ../../library/socket.rst:164 msgid "" ":const:`AF_ALG` is a Linux-only socket based interface to Kernel " "cryptography. An algorithm socket is configured with a tuple of two to four " "elements ``(type, name [, feat [, mask]])``, where:" msgstr "" -#: ../../library/socket.rst:163 +#: ../../library/socket.rst:168 msgid "" "*type* is the algorithm type as string, e.g. ``aead``, ``hash``, " "``skcipher`` or ``rng``." msgstr "" -#: ../../library/socket.rst:166 +#: ../../library/socket.rst:171 msgid "" "*name* is the algorithm name and operation mode as string, e.g. ``sha256``, " "``hmac(sha256)``, ``cbc(aes)`` or ``drbg_nopr_ctr_aes256``." msgstr "" -#: ../../library/socket.rst:169 +#: ../../library/socket.rst:174 msgid "*feat* and *mask* are unsigned 32bit integers." msgstr "" -#: ../../library/socket.rst:173 +#: ../../library/socket.rst:178 msgid "Some algorithm types require more recent Kernels." msgstr "" -#: ../../library/socket.rst:177 +#: ../../library/socket.rst:182 msgid "" ":const:`AF_VSOCK` allows communication between virtual machines and their " "hosts. The sockets are represented as a ``(CID, port)`` tuple where the " "context ID or CID and port are integers." msgstr "" -#: ../../library/socket.rst:183 +#: ../../library/socket.rst:188 msgid "See :manpage:`vsock(7)`" msgstr "請見 :manpage:`vsock(7)`" -#: ../../library/socket.rst:187 +#: ../../library/socket.rst:192 msgid "" ":const:`AF_PACKET` is a low-level interface directly to network devices. The " "addresses are represented by the tuple ``(ifname, proto[, pkttype[, hatype[, " "addr]]])`` where:" msgstr "" -#: ../../library/socket.rst:191 +#: ../../library/socket.rst:196 msgid "*ifname* - String specifying the device name." msgstr "" -#: ../../library/socket.rst:192 +#: ../../library/socket.rst:197 msgid "" "*proto* - The Ethernet protocol number. May be :data:`ETH_P_ALL` to capture " "all protocols, one of the :ref:`ETHERTYPE_* constants ` or any other Ethernet protocol number." msgstr "" -#: ../../library/socket.rst:196 +#: ../../library/socket.rst:201 msgid "*pkttype* - Optional integer specifying the packet type:" msgstr "" -#: ../../library/socket.rst:198 +#: ../../library/socket.rst:203 msgid "``PACKET_HOST`` (the default) - Packet addressed to the local host." msgstr "" -#: ../../library/socket.rst:199 +#: ../../library/socket.rst:204 msgid "``PACKET_BROADCAST`` - Physical-layer broadcast packet." msgstr "" -#: ../../library/socket.rst:200 +#: ../../library/socket.rst:205 msgid "" "``PACKET_MULTICAST`` - Packet sent to a physical-layer multicast address." msgstr "" -#: ../../library/socket.rst:201 +#: ../../library/socket.rst:206 msgid "" "``PACKET_OTHERHOST`` - Packet to some other host that has been caught by a " "device driver in promiscuous mode." msgstr "" -#: ../../library/socket.rst:203 +#: ../../library/socket.rst:208 msgid "" "``PACKET_OUTGOING`` - Packet originating from the local host that is looped " "back to a packet socket." msgstr "" -#: ../../library/socket.rst:205 +#: ../../library/socket.rst:210 msgid "*hatype* - Optional integer specifying the ARP hardware address type." msgstr "" -#: ../../library/socket.rst:206 +#: ../../library/socket.rst:211 msgid "" "*addr* - Optional bytes-like object specifying the hardware physical " "address, whose interpretation depends on the device." msgstr "" -#: ../../library/socket.rst:211 +#: ../../library/socket.rst:216 msgid "" ":const:`AF_QIPCRTR` is a Linux-only socket based interface for communicating " "with services running on co-processors in Qualcomm platforms. The address " @@ -402,7 +414,7 @@ msgid "" "*port* are non-negative integers." msgstr "" -#: ../../library/socket.rst:220 +#: ../../library/socket.rst:225 msgid "" ":const:`IPPROTO_UDPLITE` is a variant of UDP which allows you to specify " "what portion of a packet is covered with the checksum. It adds two socket " @@ -413,14 +425,14 @@ msgid "" "of their data. In both cases ``length`` should be in ``range(8, 2**16, 8)``." msgstr "" -#: ../../library/socket.rst:229 +#: ../../library/socket.rst:234 msgid "" "Such a socket should be constructed with ``socket(AF_INET, SOCK_DGRAM, " "IPPROTO_UDPLITE)`` for IPv4 or ``socket(AF_INET6, SOCK_DGRAM, " "IPPROTO_UDPLITE)`` for IPv6." msgstr "" -#: ../../library/socket.rst:237 +#: ../../library/socket.rst:242 msgid "" ":const:`AF_HYPERV` is a Windows-only socket based interface for " "communicating with Hyper-V hosts and guests. The address family is " @@ -428,49 +440,49 @@ msgid "" "``service_id`` are UUID strings." msgstr "" -#: ../../library/socket.rst:242 +#: ../../library/socket.rst:247 msgid "" "The ``vm_id`` is the virtual machine identifier or a set of known VMID " "values if the target is not a specific virtual machine. Known VMID constants " "defined on ``socket`` are:" msgstr "" -#: ../../library/socket.rst:246 +#: ../../library/socket.rst:251 msgid "``HV_GUID_ZERO``" msgstr "``HV_GUID_ZERO``" -#: ../../library/socket.rst:247 +#: ../../library/socket.rst:252 msgid "``HV_GUID_BROADCAST``" msgstr "``HV_GUID_BROADCAST``" -#: ../../library/socket.rst:248 +#: ../../library/socket.rst:253 msgid "" "``HV_GUID_WILDCARD`` - Used to bind on itself and accept connections from " "all partitions." msgstr "" -#: ../../library/socket.rst:250 +#: ../../library/socket.rst:255 msgid "" "``HV_GUID_CHILDREN`` - Used to bind on itself and accept connection from " "child partitions." msgstr "" -#: ../../library/socket.rst:252 +#: ../../library/socket.rst:257 msgid "``HV_GUID_LOOPBACK`` - Used as a target to itself." msgstr "" -#: ../../library/socket.rst:253 +#: ../../library/socket.rst:258 msgid "" "``HV_GUID_PARENT`` - When used as a bind accepts connection from the parent " "partition. When used as an address target it will connect to the parent " "partition." msgstr "" -#: ../../library/socket.rst:256 +#: ../../library/socket.rst:261 msgid "The ``service_id`` is the service identifier of the registered service." msgstr "" -#: ../../library/socket.rst:260 +#: ../../library/socket.rst:265 msgid "" "If you use a hostname in the *host* portion of IPv4/v6 socket address, the " "program may show a nondeterministic behavior, as Python uses the first " @@ -480,41 +492,41 @@ msgid "" "deterministic behavior use a numeric address in *host* portion." msgstr "" -#: ../../library/socket.rst:267 +#: ../../library/socket.rst:272 msgid "" "All errors raise exceptions. The normal exceptions for invalid argument " "types and out-of-memory conditions can be raised. Errors related to socket " "or address semantics raise :exc:`OSError` or one of its subclasses." msgstr "" -#: ../../library/socket.rst:272 +#: ../../library/socket.rst:277 msgid "" "Non-blocking mode is supported through :meth:`~socket.setblocking`. A " "generalization of this based on timeouts is supported " "through :meth:`~socket.settimeout`." msgstr "" -#: ../../library/socket.rst:278 +#: ../../library/socket.rst:283 msgid "Module contents" msgstr "模組內容" -#: ../../library/socket.rst:280 +#: ../../library/socket.rst:285 msgid "The module :mod:`socket` exports the following elements." msgstr "" -#: ../../library/socket.rst:284 +#: ../../library/socket.rst:289 msgid "Exceptions" msgstr "例外" -#: ../../library/socket.rst:288 +#: ../../library/socket.rst:293 msgid "A deprecated alias of :exc:`OSError`." msgstr "一個已棄用的 :exc:`OSError` 的別名。" -#: ../../library/socket.rst:290 +#: ../../library/socket.rst:295 msgid "Following :pep:`3151`, this class was made an alias of :exc:`OSError`." msgstr "" -#: ../../library/socket.rst:296 +#: ../../library/socket.rst:301 msgid "" "A subclass of :exc:`OSError`, this exception is raised for address-related " "errors, i.e. for functions that use *h_errno* in the POSIX C API, " @@ -525,12 +537,12 @@ msgid "" "the :c:func:`hstrerror` C function." msgstr "" -#: ../../library/socket.rst:304 ../../library/socket.rst:317 -#: ../../library/socket.rst:330 +#: ../../library/socket.rst:309 ../../library/socket.rst:322 +#: ../../library/socket.rst:335 msgid "This class was made a subclass of :exc:`OSError`." msgstr "" -#: ../../library/socket.rst:309 +#: ../../library/socket.rst:314 msgid "" "A subclass of :exc:`OSError`, this exception is raised for address-related " "errors by :func:`getaddrinfo` and :func:`getnameinfo`. The accompanying " @@ -540,11 +552,11 @@ msgid "" "match one of the :const:`!EAI_\\*` constants defined in this module." msgstr "" -#: ../../library/socket.rst:322 +#: ../../library/socket.rst:327 msgid "A deprecated alias of :exc:`TimeoutError`." msgstr "" -#: ../../library/socket.rst:324 +#: ../../library/socket.rst:329 msgid "" "A subclass of :exc:`OSError`, this exception is raised when a timeout occurs " "on a socket which has had timeouts enabled via a prior call " @@ -553,21 +565,21 @@ msgid "" "string whose value is currently always \"timed out\"." msgstr "" -#: ../../library/socket.rst:333 +#: ../../library/socket.rst:338 msgid "This class was made an alias of :exc:`TimeoutError`." msgstr "" -#: ../../library/socket.rst:338 +#: ../../library/socket.rst:343 msgid "Constants" msgstr "常數" -#: ../../library/socket.rst:340 +#: ../../library/socket.rst:345 msgid "" "The AF_* and SOCK_* constants are now :class:`AddressFamily` " "and :class:`SocketKind` :class:`.IntEnum` collections." msgstr "" -#: ../../library/socket.rst:349 +#: ../../library/socket.rst:354 msgid "" "These constants represent the address (and protocol) families, used for the " "first argument to :func:`~socket.socket`. If the :const:`AF_UNIX` constant " @@ -575,14 +587,14 @@ msgid "" "available depending on the system." msgstr "" -#: ../../library/socket.rst:356 +#: ../../library/socket.rst:361 msgid "" ":const:`AF_UNSPEC` means that :func:`getaddrinfo` should return socket " "addresses for any address family (either IPv4, IPv6, or any other) that can " "be used." msgstr "" -#: ../../library/socket.rst:366 +#: ../../library/socket.rst:371 msgid "" "These constants represent the socket types, used for the second argument " "to :func:`~socket.socket`. More constants may be available depending on the " @@ -590,20 +602,20 @@ msgid "" "generally useful.)" msgstr "" -#: ../../library/socket.rst:374 +#: ../../library/socket.rst:379 msgid "" "These two constants, if defined, can be combined with the socket types and " "allow you to set some flags atomically (thus avoiding possible race " "conditions and the need for separate calls)." msgstr "" -#: ../../library/socket.rst:380 +#: ../../library/socket.rst:385 msgid "" "`Secure File Descriptor Handling `_ for a more thorough explanation." msgstr "" -#: ../../library/socket.rst:404 +#: ../../library/socket.rst:409 msgid "" "Many constants of these forms, documented in the Unix documentation on " "sockets and/or the IP protocol, are also defined in the socket module. They " @@ -613,41 +625,41 @@ msgid "" "for a few symbols, default values are provided." msgstr "" -#: ../../library/socket.rst:411 +#: ../../library/socket.rst:416 msgid "" "``SO_DOMAIN``, ``SO_PROTOCOL``, ``SO_PEERSEC``, ``SO_PASSSEC``, " "``TCP_USER_TIMEOUT``, ``TCP_CONGESTION`` were added." msgstr "" -#: ../../library/socket.rst:415 +#: ../../library/socket.rst:420 msgid "" "On Windows, ``TCP_FASTOPEN``, ``TCP_KEEPCNT`` appear if run-time Windows " "supports." msgstr "" -#: ../../library/socket.rst:419 +#: ../../library/socket.rst:424 msgid "``TCP_NOTSENT_LOWAT`` was added." msgstr "新增 ``TCP_NOTSENT_LOWAT``。" -#: ../../library/socket.rst:422 +#: ../../library/socket.rst:427 msgid "" "On Windows, ``TCP_KEEPIDLE``, ``TCP_KEEPINTVL`` appear if run-time Windows " "supports." msgstr "" -#: ../../library/socket.rst:425 +#: ../../library/socket.rst:430 msgid "" "``IP_RECVTOS`` was added. Added ``TCP_KEEPALIVE``. On MacOS this constant " "can be used in the same way that ``TCP_KEEPIDLE`` is used on Linux." msgstr "" -#: ../../library/socket.rst:430 +#: ../../library/socket.rst:435 msgid "" "Added ``TCP_CONNECTION_INFO``. On MacOS this constant can be used in the " "same way that ``TCP_INFO`` is used on Linux and BSD." msgstr "" -#: ../../library/socket.rst:434 +#: ../../library/socket.rst:439 msgid "" "Added ``SO_RTABLE`` and ``SO_USER_COOKIE``. On OpenBSD and FreeBSD " "respectively those constants can be used in the same way that ``SO_MARK`` is " @@ -663,133 +675,137 @@ msgid "" "``IP_DROP_SOURCE_MEMBERSHIP``." msgstr "" -#: ../../library/socket.rst:448 +#: ../../library/socket.rst:453 msgid "" "Added ``SO_BINDTOIFINDEX``. On Linux this constant can be used in the same " "way that ``SO_BINDTODEVICE`` is used, but with the index of a network " "interface instead of its name." msgstr "" -#: ../../library/socket.rst:458 ../../library/socket.rst:539 -#: ../../library/socket.rst:563 +#: ../../library/socket.rst:463 ../../library/socket.rst:547 +#: ../../library/socket.rst:571 msgid "" "Many constants of these forms, documented in the Linux documentation, are " "also defined in the socket module." msgstr "" -#: ../../library/socket.rst:465 +#: ../../library/socket.rst:470 msgid "NetBSD support was added." msgstr "" -#: ../../library/socket.rst:471 +#: ../../library/socket.rst:473 +msgid "Restored missing ``CAN_RAW_ERR_FILTER`` on Linux." +msgstr "" + +#: ../../library/socket.rst:479 msgid "" "CAN_BCM, in the CAN protocol family, is the broadcast manager (BCM) " "protocol. Broadcast manager constants, documented in the Linux " "documentation, are also defined in the socket module." msgstr "" -#: ../../library/socket.rst:478 +#: ../../library/socket.rst:486 msgid "" "The :data:`CAN_BCM_CAN_FD_FRAME` flag is only available on Linux >= 4.8." msgstr "" -#: ../../library/socket.rst:484 +#: ../../library/socket.rst:492 msgid "" "Enables CAN FD support in a CAN_RAW socket. This is disabled by default. " "This allows your application to send both CAN and CAN FD frames; however, " "you must accept both CAN and CAN FD frames when reading from the socket." msgstr "" -#: ../../library/socket.rst:488 ../../library/socket.rst:499 +#: ../../library/socket.rst:496 ../../library/socket.rst:507 msgid "This constant is documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:496 +#: ../../library/socket.rst:504 msgid "" "Joins the applied CAN filters such that only CAN frames that match all given " "CAN filters are passed to user space." msgstr "" -#: ../../library/socket.rst:507 +#: ../../library/socket.rst:515 msgid "" "CAN_ISOTP, in the CAN protocol family, is the ISO-TP (ISO 15765-2) protocol. " "ISO-TP constants, documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:516 +#: ../../library/socket.rst:524 msgid "" "CAN_J1939, in the CAN protocol family, is the SAE J1939 protocol. J1939 " "constants, documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:527 +#: ../../library/socket.rst:535 msgid "" "These two constants, documented in the FreeBSD divert(4) manual page, are " "also defined in the socket module." msgstr "" -#: ../../library/socket.rst:547 +#: ../../library/socket.rst:555 msgid "" ":data:`!ETH_P_ALL` can be used in the :class:`~socket.socket` constructor as " "*proto* for the :const:`AF_PACKET` family in order to capture every packet, " "regardless of protocol." msgstr "" -#: ../../library/socket.rst:551 +#: ../../library/socket.rst:559 msgid "For more information, see the :manpage:`packet(7)` manpage." msgstr "" -#: ../../library/socket.rst:576 +#: ../../library/socket.rst:584 msgid "" "Constants for Windows' WSAIoctl(). The constants are used as arguments to " "the :meth:`~socket.socket.ioctl` method of socket objects." msgstr "" -#: ../../library/socket.rst:579 ../../library/socket.rst:1604 +#: ../../library/socket.rst:587 ../../library/socket.rst:1611 msgid "``SIO_LOOPBACK_FAST_PATH`` was added." msgstr "加入 ``SIO_LOOPBACK_FAST_PATH``。" -#: ../../library/socket.rst:585 +#: ../../library/socket.rst:593 msgid "" "TIPC related constants, matching the ones exported by the C socket API. See " "the TIPC documentation for more information." msgstr "" -#: ../../library/socket.rst:592 +#: ../../library/socket.rst:600 msgid "Constants for Linux Kernel cryptography." msgstr "" -#: ../../library/socket.rst:604 +#: ../../library/socket.rst:612 msgid "Constants for Linux host/guest communication." msgstr "" -#: ../../library/socket.rst:618 +#: ../../library/socket.rst:626 msgid "" "This constant contains a boolean value which indicates if IPv6 is supported " "on this platform." msgstr "" -#: ../../library/socket.rst:624 +#: ../../library/socket.rst:632 msgid "" "These are string constants containing Bluetooth addresses with special " "meanings. For example, :const:`BDADDR_ANY` can be used to indicate any " "address when specifying the binding socket with :const:`BTPROTO_RFCOMM`." msgstr "" -#: ../../library/socket.rst:633 +#: ../../library/socket.rst:641 msgid "" -"For use with :const:`BTPROTO_HCI`. :const:`HCI_FILTER` is not available for " -"NetBSD or DragonFlyBSD. :const:`HCI_TIME_STAMP` and :const:`HCI_DATA_DIR` " -"are not available for FreeBSD, NetBSD, or DragonFlyBSD." +"For use with :const:`BTPROTO_HCI`. :const:`!HCI_FILTER` is only available on " +"Linux and FreeBSD. :const:`!HCI_TIME_STAMP` and :const:`!HCI_DATA_DIR` are " +"only available on Linux." msgstr "" -#: ../../library/socket.rst:640 +#: ../../library/socket.rst:647 msgid "" "Constant for Qualcomm's IPC router protocol, used to communicate with " "service providing remote processors." msgstr "" -#: ../../library/socket.rst:649 +#: ../../library/socket.rst:656 msgid "" "LOCAL_CREDS and LOCAL_CREDS_PERSISTENT can be used with SOCK_DGRAM, " "SOCK_STREAM sockets, equivalent to Linux/DragonFlyBSD SO_PASSCRED, while " @@ -798,42 +814,42 @@ msgid "" "message type." msgstr "" -#: ../../library/socket.rst:662 +#: ../../library/socket.rst:669 msgid "" "Constant to optimize CPU locality, to be used in conjunction " "with :data:`SO_REUSEPORT`." msgstr "" -#: ../../library/socket.rst:682 +#: ../../library/socket.rst:689 msgid "Constants for Windows Hyper-V sockets for host/guest communications." msgstr "" -#: ../../library/socket.rst:695 +#: ../../library/socket.rst:702 msgid "" "`IEEE 802.3 protocol number `_. constants." msgstr "" -#: ../../library/socket.rst:707 +#: ../../library/socket.rst:714 msgid "" "These constants are used by the :meth:`~socket.socket.shutdown` method of " "socket objects." msgstr "" -#: ../../library/socket.rst:712 +#: ../../library/socket.rst:719 msgid "Functions" msgstr "函式" -#: ../../library/socket.rst:715 +#: ../../library/socket.rst:722 msgid "Creating sockets" msgstr "建立 sockets" -#: ../../library/socket.rst:717 +#: ../../library/socket.rst:724 msgid "" "The following functions all create :ref:`socket objects `." msgstr "" -#: ../../library/socket.rst:722 +#: ../../library/socket.rst:729 msgid "" "Create a new socket using the given address family, socket type and protocol " "number. The address family should be :const:`AF_INET` (the " @@ -846,7 +862,7 @@ msgid "" "or :const:`CAN_J1939`." msgstr "" -#: ../../library/socket.rst:732 +#: ../../library/socket.rst:739 msgid "" "If *fileno* is specified, the values for *family*, *type*, and *proto* are " "auto-detected from the specified file descriptor. Auto-detection can be " @@ -857,12 +873,12 @@ msgid "" "duplicate. This may help close a detached socket using :meth:`socket.close`." msgstr "" -#: ../../library/socket.rst:741 ../../library/socket.rst:887 -#: ../../library/socket.rst:1423 ../../library/socket.rst:1517 +#: ../../library/socket.rst:748 ../../library/socket.rst:894 +#: ../../library/socket.rst:1430 ../../library/socket.rst:1524 msgid "The newly created socket is :ref:`non-inheritable `." msgstr "" -#: ../../library/socket.rst:743 +#: ../../library/socket.rst:750 msgid "" "Raises an :ref:`auditing event ` ``socket.__new__`` with arguments " "``self``, ``family``, ``type``, ``protocol``." @@ -870,30 +886,30 @@ msgstr "" "引發一個附帶引數 ``self``、``family``、``type``、``protocol`` 的\\ :ref:`稽核" "事件 ` ``socket.__new__``。" -#: ../../library/socket.rst:745 +#: ../../library/socket.rst:752 msgid "The AF_CAN family was added. The AF_RDS family was added." msgstr "" -#: ../../library/socket.rst:749 +#: ../../library/socket.rst:756 msgid "The CAN_BCM protocol was added." msgstr "新增 CAN_BCM 協定。" -#: ../../library/socket.rst:752 ../../library/socket.rst:889 +#: ../../library/socket.rst:759 ../../library/socket.rst:896 msgid "The returned socket is now non-inheritable." msgstr "" -#: ../../library/socket.rst:755 +#: ../../library/socket.rst:762 msgid "The CAN_ISOTP protocol was added." msgstr "新增 CAN_ISOTP 協定。" -#: ../../library/socket.rst:758 +#: ../../library/socket.rst:765 msgid "" "When :const:`SOCK_NONBLOCK` or :const:`SOCK_CLOEXEC` bit flags are applied " "to *type* they are cleared, and :attr:`socket.type` will not reflect them. " "They are still passed to the underlying system ``socket()`` call. Therefore," msgstr "" -#: ../../library/socket.rst:766 +#: ../../library/socket.rst:773 msgid "" "sock = socket.socket(\n" " socket.AF_INET,\n" @@ -903,21 +919,21 @@ msgstr "" " socket.AF_INET,\n" " socket.SOCK_STREAM | socket.SOCK_NONBLOCK)" -#: ../../library/socket.rst:770 +#: ../../library/socket.rst:777 msgid "" "will still create a non-blocking socket on OSes that support " "``SOCK_NONBLOCK``, but ``sock.type`` will be set to ``socket.SOCK_STREAM``." msgstr "" -#: ../../library/socket.rst:774 +#: ../../library/socket.rst:781 msgid "The CAN_J1939 protocol was added." msgstr "新增 CAN_J1939 協定。" -#: ../../library/socket.rst:777 +#: ../../library/socket.rst:784 msgid "The IPPROTO_MPTCP protocol was added." msgstr "新增 IPPROTO_MPTCP 協定。" -#: ../../library/socket.rst:782 +#: ../../library/socket.rst:789 msgid "" "Build a pair of connected socket objects using the given address family, " "socket type, and protocol number. Address family, socket type, and protocol " @@ -926,25 +942,25 @@ msgid "" "default is :const:`AF_INET`." msgstr "" -#: ../../library/socket.rst:787 +#: ../../library/socket.rst:794 msgid "The newly created sockets are :ref:`non-inheritable `." msgstr "" -#: ../../library/socket.rst:789 +#: ../../library/socket.rst:796 msgid "" "The returned socket objects now support the whole socket API, rather than a " "subset." msgstr "" -#: ../../library/socket.rst:793 +#: ../../library/socket.rst:800 msgid "The returned sockets are now non-inheritable." msgstr "" -#: ../../library/socket.rst:796 +#: ../../library/socket.rst:803 msgid "Windows support added." msgstr "新增對 Windows 的支援。" -#: ../../library/socket.rst:802 +#: ../../library/socket.rst:809 msgid "" "Connect to a TCP service listening on the internet *address* (a 2-tuple " "``(host, port)``), and return the socket object. This is a higher-level " @@ -955,21 +971,21 @@ msgid "" "IPv4 and IPv6." msgstr "" -#: ../../library/socket.rst:810 +#: ../../library/socket.rst:817 msgid "" "Passing the optional *timeout* parameter will set the timeout on the socket " "instance before attempting to connect. If no *timeout* is supplied, the " "global default timeout setting returned by :func:`getdefaulttimeout` is used." msgstr "" -#: ../../library/socket.rst:815 +#: ../../library/socket.rst:822 msgid "" "If supplied, *source_address* must be a 2-tuple ``(host, port)`` for the " "socket to bind to as its source address before connecting. If host or port " "are '' or 0 respectively the OS default behavior will be used." msgstr "" -#: ../../library/socket.rst:819 +#: ../../library/socket.rst:826 msgid "" "When a connection cannot be created, an exception is raised. By default, it " "is the exception from the last address in the list. If *all_errors* is " @@ -977,21 +993,21 @@ msgid "" "attempts." msgstr "" -#: ../../library/socket.rst:824 +#: ../../library/socket.rst:831 msgid "*source_address* was added." msgstr "新增 *source_address*。" -#: ../../library/socket.rst:827 +#: ../../library/socket.rst:834 msgid "*all_errors* was added." msgstr "新增 *all_errors*。" -#: ../../library/socket.rst:833 +#: ../../library/socket.rst:840 msgid "" "Convenience function which creates a TCP socket bound to *address* (a 2-" "tuple ``(host, port)``) and returns the socket object." msgstr "" -#: ../../library/socket.rst:836 +#: ../../library/socket.rst:843 msgid "" "*family* should be either :data:`AF_INET` or :data:`AF_INET6`. *backlog* is " "the queue size passed to :meth:`socket.listen`; if not specified , a default " @@ -999,20 +1015,20 @@ msgid "" "the :data:`SO_REUSEPORT` socket option." msgstr "" -#: ../../library/socket.rst:841 +#: ../../library/socket.rst:848 msgid "" -"If *dualstack_ipv6* is true and the platform supports it the socket will be " -"able to accept both IPv4 and IPv6 connections, else it will " -"raise :exc:`ValueError`. Most POSIX platforms and Windows are supposed to " -"support this functionality. When this functionality is enabled the address " -"returned by :meth:`socket.getpeername` when an IPv4 connection occurs will " -"be an IPv6 address represented as an IPv4-mapped IPv6 address. If " -"*dualstack_ipv6* is false it will explicitly disable this functionality on " -"platforms that enable it by default (e.g. Linux). This parameter can be used " -"in conjunction with :func:`has_dualstack_ipv6`:" +"If *dualstack_ipv6* is true, *family* is :data:`AF_INET6` and the platform " +"supports it the socket will be able to accept both IPv4 and IPv6 " +"connections, else it will raise :exc:`ValueError`. Most POSIX platforms and " +"Windows are supposed to support this functionality. When this functionality " +"is enabled the address returned by :meth:`socket.getpeername` when an IPv4 " +"connection occurs will be an IPv6 address represented as an IPv4-mapped IPv6 " +"address. If *dualstack_ipv6* is false it will explicitly disable this " +"functionality on platforms that enable it by default (e.g. Linux). This " +"parameter can be used in conjunction with :func:`has_dualstack_ipv6`:" msgstr "" -#: ../../library/socket.rst:854 +#: ../../library/socket.rst:861 msgid "" "import socket\n" "\n" @@ -1032,20 +1048,20 @@ msgstr "" "else:\n" " s = socket.create_server(addr)" -#: ../../library/socket.rst:863 +#: ../../library/socket.rst:870 msgid "" "On POSIX platforms the :data:`SO_REUSEADDR` socket option is set in order to " "immediately reuse previous sockets which were bound on the same *address* " "and remained in TIME_WAIT state." msgstr "" -#: ../../library/socket.rst:871 +#: ../../library/socket.rst:878 msgid "" "Return ``True`` if the platform supports creating a TCP socket which can " "handle both IPv4 and IPv6 connections." msgstr "" -#: ../../library/socket.rst:878 +#: ../../library/socket.rst:885 msgid "" "Duplicate the file descriptor *fd* (an integer as returned by a file " "object's :meth:`~io.IOBase.fileno` method) and build a socket object from " @@ -1058,39 +1074,39 @@ msgid "" "daemon). The socket is assumed to be in blocking mode." msgstr "" -#: ../../library/socket.rst:895 +#: ../../library/socket.rst:902 msgid "" "Instantiate a socket from data obtained from the :meth:`socket.share` " "method. The socket is assumed to be in blocking mode." msgstr "" -#: ../../library/socket.rst:905 +#: ../../library/socket.rst:912 msgid "" "This is a Python type object that represents the socket object type. It is " "the same as ``type(socket(...))``." msgstr "" -#: ../../library/socket.rst:910 +#: ../../library/socket.rst:917 msgid "Other functions" msgstr "其他函式" -#: ../../library/socket.rst:912 +#: ../../library/socket.rst:919 msgid "The :mod:`socket` module also offers various network-related services:" msgstr "" -#: ../../library/socket.rst:917 +#: ../../library/socket.rst:924 msgid "" "Close a socket file descriptor. This is like :func:`os.close`, but for " "sockets. On some platforms (most noticeable Windows) :func:`os.close` does " "not work for socket file descriptors." msgstr "" -#: ../../library/socket.rst:925 +#: ../../library/socket.rst:932 msgid "" "This function wraps the C function ``getaddrinfo`` of the underlying system." msgstr "" -#: ../../library/socket.rst:927 +#: ../../library/socket.rst:934 msgid "" "Translate the *host*/*port* argument into a sequence of 5-tuples that " "contain all the necessary arguments for creating a socket connected to that " @@ -1100,7 +1116,7 @@ msgid "" "and *port*, you can pass ``NULL`` to the underlying C API." msgstr "" -#: ../../library/socket.rst:934 +#: ../../library/socket.rst:941 msgid "" "The *family*, *type* and *proto* arguments can be optionally specified in " "order to provide options and limit the list of addresses returned. Pass " @@ -1108,7 +1124,7 @@ msgid "" "limit the results. See the note below for details." msgstr "" -#: ../../library/socket.rst:939 +#: ../../library/socket.rst:946 msgid "" "The *flags* argument can be one or several of the ``AI_*`` constants, and " "will influence how results are computed and returned. For " @@ -1116,15 +1132,15 @@ msgid "" "will raise an error if *host* is a domain name." msgstr "" -#: ../../library/socket.rst:944 +#: ../../library/socket.rst:951 msgid "The function returns a list of 5-tuples with the following structure:" msgstr "" -#: ../../library/socket.rst:946 +#: ../../library/socket.rst:953 msgid "``(family, type, proto, canonname, sockaddr)``" msgstr "``(family, type, proto, canonname, sockaddr)``" -#: ../../library/socket.rst:948 +#: ../../library/socket.rst:955 msgid "" "In these tuples, *family*, *type*, *proto* are all integers and are meant to " "be passed to the :func:`~socket.socket` function. *canonname* will be a " @@ -1137,7 +1153,7 @@ msgid "" "the :meth:`socket.connect` method." msgstr "" -#: ../../library/socket.rst:960 +#: ../../library/socket.rst:967 msgid "" "If you intend to use results from :func:`!getaddrinfo` to create a socket " "(rather than, for example, retrieve *canonname*), consider limiting the " @@ -1146,13 +1162,13 @@ msgid "" "application can handle." msgstr "" -#: ../../library/socket.rst:966 +#: ../../library/socket.rst:973 msgid "" "The behavior with default values of *family*, *type*, *proto* and *flags* is " "system-specific." msgstr "" -#: ../../library/socket.rst:969 +#: ../../library/socket.rst:976 msgid "" "Many systems (for example, most Linux configurations) will return a sorted " "list of all matching addresses. These addresses should generally be tried in " @@ -1162,14 +1178,14 @@ msgid "" "attempts." msgstr "" -#: ../../library/socket.rst:976 +#: ../../library/socket.rst:983 msgid "" "Some systems will, however, only return a single address. (For example, this " "was reported on Solaris and AIX configurations.) On these systems, limiting " "the *type* and/or *proto* helps ensure that this address is usable." msgstr "" -#: ../../library/socket.rst:981 +#: ../../library/socket.rst:988 msgid "" "Raises an :ref:`auditing event ` ``socket.getaddrinfo`` with " "arguments ``host``, ``port``, ``family``, ``type``, ``protocol``." @@ -1177,14 +1193,14 @@ msgstr "" "引發一個附帶引數 ``host``、``port``、``family``、``type``、``protocol`` 的" "\\ :ref:`稽核事件 ` ``socket.getaddrinfo``。" -#: ../../library/socket.rst:983 +#: ../../library/socket.rst:990 msgid "" "The following example fetches address information for a hypothetical TCP " "connection to ``example.org`` on port 80 (results may differ on your system " "if IPv6 isn't enabled)::" msgstr "" -#: ../../library/socket.rst:987 +#: ../../library/socket.rst:994 msgid "" ">>> socket.getaddrinfo(\"example.org\", 80, proto=socket.IPPROTO_TCP)\n" "[(socket.AF_INET6, socket.SOCK_STREAM,\n" @@ -1198,17 +1214,17 @@ msgstr "" " (socket.AF_INET, socket.SOCK_STREAM,\n" " 6, '', ('93.184.216.34', 80))]" -#: ../../library/socket.rst:993 +#: ../../library/socket.rst:1000 msgid "parameters can now be passed using keyword arguments." msgstr "" -#: ../../library/socket.rst:996 +#: ../../library/socket.rst:1003 msgid "" "for IPv6 multicast addresses, string representing an address will not " "contain ``%scope_id`` part." msgstr "" -#: ../../library/socket.rst:1004 +#: ../../library/socket.rst:1011 msgid "" "Return a fully qualified domain name for *name*. If *name* is omitted or " "empty, it is interpreted as the local host. To find the fully qualified " @@ -1219,7 +1235,7 @@ msgid "" "``'0.0.0.0'``, the hostname from :func:`gethostname` is returned." msgstr "" -#: ../../library/socket.rst:1015 +#: ../../library/socket.rst:1022 msgid "" "Translate a host name to IPv4 address format. The IPv4 address is returned " "as a string, such as ``'100.50.200.5'``. If the host name is an IPv4 " @@ -1229,7 +1245,7 @@ msgid "" "stack support." msgstr "" -#: ../../library/socket.rst:1021 ../../library/socket.rst:1037 +#: ../../library/socket.rst:1028 ../../library/socket.rst:1044 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyname`` with " "argument ``hostname``." @@ -1237,7 +1253,7 @@ msgstr "" "引發一個附帶引數 ``hostname`` 的\\ :ref:`稽核事件 ` " "``socket.gethostbyname``。" -#: ../../library/socket.rst:1028 +#: ../../library/socket.rst:1035 msgid "" "Translate a host name to IPv4 address format, extended interface. Return a 3-" "tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the host's " @@ -1249,26 +1265,26 @@ msgid "" "stack support." msgstr "" -#: ../../library/socket.rst:1044 +#: ../../library/socket.rst:1051 msgid "" "Return a string containing the hostname of the machine where the Python " "interpreter is currently executing." msgstr "" -#: ../../library/socket.rst:1047 +#: ../../library/socket.rst:1054 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostname`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``socket.gethostname``。" -#: ../../library/socket.rst:1049 +#: ../../library/socket.rst:1056 msgid "" "Note: :func:`gethostname` doesn't always return the fully qualified domain " "name; use :func:`getfqdn` for that." msgstr "" -#: ../../library/socket.rst:1057 +#: ../../library/socket.rst:1064 msgid "" "Return a 3-tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is " "the primary host name responding to the given *ip_address*, *aliaslist* is a " @@ -1279,7 +1295,7 @@ msgid "" "function :func:`getfqdn`. :func:`gethostbyaddr` supports both IPv4 and IPv6." msgstr "" -#: ../../library/socket.rst:1065 +#: ../../library/socket.rst:1072 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyaddr`` with " "argument ``ip_address``." @@ -1287,7 +1303,7 @@ msgstr "" "引發一個附帶引數 ``ip_address`` 的\\ :ref:`稽核事件 ` " "``socket.gethostbyaddr``。" -#: ../../library/socket.rst:1072 +#: ../../library/socket.rst:1079 msgid "" "Translate a socket address *sockaddr* into a 2-tuple ``(host, port)``. " "Depending on the settings of *flags*, the result can contain a fully " @@ -1295,18 +1311,18 @@ msgid "" "Similarly, *port* can contain a string port name or a numeric port number." msgstr "" -#: ../../library/socket.rst:1077 +#: ../../library/socket.rst:1084 msgid "" "For IPv6 addresses, ``%scope_id`` is appended to the host part if *sockaddr* " "contains meaningful *scope_id*. Usually this happens for multicast addresses." msgstr "" -#: ../../library/socket.rst:1080 +#: ../../library/socket.rst:1087 msgid "" "For more information about *flags* you can consult :manpage:`getnameinfo(3)`." msgstr "" -#: ../../library/socket.rst:1082 +#: ../../library/socket.rst:1089 msgid "" "Raises an :ref:`auditing event ` ``socket.getnameinfo`` with " "argument ``sockaddr``." @@ -1314,7 +1330,7 @@ msgstr "" "引發一個附帶引數 ``sockaddr`` 的\\ :ref:`稽核事件 ` " "``socket.getnameinfo``。" -#: ../../library/socket.rst:1089 +#: ../../library/socket.rst:1096 msgid "" "Translate an internet protocol name (for example, ``'icmp'``) to a constant " "suitable for passing as the (optional) third argument to " @@ -1324,14 +1340,14 @@ msgid "" "omitted or zero." msgstr "" -#: ../../library/socket.rst:1100 +#: ../../library/socket.rst:1107 msgid "" "Translate an internet service name and protocol name to a port number for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: ../../library/socket.rst:1104 +#: ../../library/socket.rst:1111 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyname`` with " "arguments ``servicename``, ``protocolname``." @@ -1339,14 +1355,14 @@ msgstr "" "引發一個附帶引數 ``sockaddr``、``protocolname`` 的\\ :ref:`稽核事件 " "` ``socket.getservbyname``。" -#: ../../library/socket.rst:1111 +#: ../../library/socket.rst:1118 msgid "" "Translate an internet port number and protocol name to a service name for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: ../../library/socket.rst:1115 +#: ../../library/socket.rst:1122 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyport`` with " "arguments ``port``, ``protocolname``." @@ -1354,40 +1370,40 @@ msgstr "" "引發一個附帶引數 ``port``、``protocolname`` 的\\ :ref:`稽核事件 ` " "``socket.getservbyport``。" -#: ../../library/socket.rst:1122 +#: ../../library/socket.rst:1129 msgid "" "Convert 32-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: ../../library/socket.rst:1129 +#: ../../library/socket.rst:1136 msgid "" "Convert 16-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: ../../library/socket.rst:1133 ../../library/socket.rst:1151 +#: ../../library/socket.rst:1140 ../../library/socket.rst:1158 msgid "" "Raises :exc:`OverflowError` if *x* does not fit in a 16-bit unsigned integer." msgstr "" -#: ../../library/socket.rst:1140 +#: ../../library/socket.rst:1147 msgid "" "Convert 32-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: ../../library/socket.rst:1147 +#: ../../library/socket.rst:1154 msgid "" "Convert 16-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: ../../library/socket.rst:1158 +#: ../../library/socket.rst:1165 msgid "" "Convert an IPv4 address from dotted-quad string format (for example, " "'123.45.67.89') to 32-bit packed binary format, as a bytes object four " @@ -1396,26 +1412,26 @@ msgid "" "which is the C type for the 32-bit packed binary this function returns." msgstr "" -#: ../../library/socket.rst:1164 +#: ../../library/socket.rst:1171 msgid "" ":func:`inet_aton` also accepts strings with less than three dots; see the " "Unix manual page :manpage:`inet(3)` for details." msgstr "" -#: ../../library/socket.rst:1167 +#: ../../library/socket.rst:1174 msgid "" "If the IPv4 address string passed to this function is " "invalid, :exc:`OSError` will be raised. Note that exactly what is valid " "depends on the underlying C implementation of :c:func:`inet_aton`." msgstr "" -#: ../../library/socket.rst:1171 +#: ../../library/socket.rst:1178 msgid "" ":func:`inet_aton` does not support IPv6, and :func:`inet_pton` should be " "used instead for IPv4/v6 dual stack support." msgstr "" -#: ../../library/socket.rst:1177 +#: ../../library/socket.rst:1184 msgid "" "Convert a 32-bit packed IPv4 address (a :term:`bytes-like object` four bytes " "in length) to its standard dotted-quad string representation (for example, " @@ -1425,7 +1441,7 @@ msgid "" "argument." msgstr "" -#: ../../library/socket.rst:1184 +#: ../../library/socket.rst:1191 msgid "" "If the byte sequence passed to this function is not exactly 4 bytes in " "length, :exc:`OSError` will be raised. :func:`inet_ntoa` does not support " @@ -1433,7 +1449,7 @@ msgid "" "support." msgstr "" -#: ../../library/socket.rst:1195 +#: ../../library/socket.rst:1202 msgid "" "Convert an IP address from its family-specific string format to a packed, " "binary format. :func:`inet_pton` is useful when a library or network " @@ -1441,7 +1457,7 @@ msgid "" "to :func:`inet_aton`) or :c:struct:`in6_addr`." msgstr "" -#: ../../library/socket.rst:1200 +#: ../../library/socket.rst:1207 msgid "" "Supported values for *address_family* are currently :const:`AF_INET` " "and :const:`AF_INET6`. If the IP address string *ip_string* is " @@ -1450,11 +1466,11 @@ msgid "" "implementation of :c:func:`inet_pton`." msgstr "" -#: ../../library/socket.rst:1208 ../../library/socket.rst:1228 +#: ../../library/socket.rst:1215 ../../library/socket.rst:1235 msgid "Windows support added" msgstr "" -#: ../../library/socket.rst:1214 +#: ../../library/socket.rst:1221 msgid "" "Convert a packed IP address (a :term:`bytes-like object` of some number of " "bytes) to its standard, family-specific string representation (for example, " @@ -1463,7 +1479,7 @@ msgid "" "(similar to :func:`inet_ntoa`) or :c:struct:`in6_addr`." msgstr "" -#: ../../library/socket.rst:1221 +#: ../../library/socket.rst:1228 msgid "" "Supported values for *address_family* are currently :const:`AF_INET` " "and :const:`AF_INET6`. If the bytes object *packed_ip* is not the correct " @@ -1472,7 +1488,7 @@ msgid "" "to :func:`inet_ntop`." msgstr "" -#: ../../library/socket.rst:1243 +#: ../../library/socket.rst:1250 msgid "" "Return the total length, without trailing padding, of an ancillary data item " "with associated data of the given *length*. This value can often be used as " @@ -1483,12 +1499,12 @@ msgid "" "*length* is outside the permissible range of values." msgstr "" -#: ../../library/socket.rst:1254 ../../library/socket.rst:1741 -#: ../../library/socket.rst:1785 ../../library/socket.rst:1893 +#: ../../library/socket.rst:1261 ../../library/socket.rst:1748 +#: ../../library/socket.rst:1792 ../../library/socket.rst:1900 msgid "Most Unix platforms." msgstr "" -#: ../../library/socket.rst:1261 +#: ../../library/socket.rst:1268 msgid "" "Return the buffer size needed for :meth:`~socket.recvmsg` to receive an " "ancillary data item with associated data of the given *length*, along with " @@ -1498,7 +1514,7 @@ msgid "" "values." msgstr "" -#: ../../library/socket.rst:1269 +#: ../../library/socket.rst:1276 msgid "" "Note that some systems might support ancillary data without providing this " "function. Also note that setting the buffer size using the results of this " @@ -1506,18 +1522,18 @@ msgid "" "received, since additional data may be able to fit into the padding area." msgstr "" -#: ../../library/socket.rst:1277 +#: ../../library/socket.rst:1284 msgid "most Unix platforms." msgstr "" -#: ../../library/socket.rst:1284 +#: ../../library/socket.rst:1291 msgid "" "Return the default timeout in seconds (float) for new socket objects. A " "value of ``None`` indicates that new socket objects have no timeout. When " "the socket module is first imported, the default is ``None``." msgstr "" -#: ../../library/socket.rst:1291 +#: ../../library/socket.rst:1298 msgid "" "Set the default timeout in seconds (float) for new socket objects. When the " "socket module is first imported, the default is ``None``. " @@ -1525,13 +1541,13 @@ msgid "" "meanings." msgstr "" -#: ../../library/socket.rst:1299 +#: ../../library/socket.rst:1306 msgid "" "Set the machine's hostname to *name*. This will raise an :exc:`OSError` if " "you don't have enough rights." msgstr "" -#: ../../library/socket.rst:1302 +#: ../../library/socket.rst:1309 msgid "" "Raises an :ref:`auditing event ` ``socket.sethostname`` with " "argument ``name``." @@ -1539,103 +1555,103 @@ msgstr "" "引發一個附帶引數 ``name`` 的\\ :ref:`稽核事件 ` " "``socket.sethostname``。" -#: ../../library/socket.rst:1311 +#: ../../library/socket.rst:1318 msgid "" "Return a list of network interface information (index int, name string) " "tuples. :exc:`OSError` if the system call fails." msgstr "" -#: ../../library/socket.rst:1319 ../../library/socket.rst:1346 -#: ../../library/socket.rst:1363 +#: ../../library/socket.rst:1326 ../../library/socket.rst:1353 +#: ../../library/socket.rst:1370 msgid "Windows support was added." msgstr "增加對 Windows 的支援。" -#: ../../library/socket.rst:1324 +#: ../../library/socket.rst:1331 msgid "" "On Windows network interfaces have different names in different contexts " "(all names are examples):" msgstr "" -#: ../../library/socket.rst:1327 +#: ../../library/socket.rst:1334 msgid "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" msgstr "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" -#: ../../library/socket.rst:1328 +#: ../../library/socket.rst:1335 msgid "name: ``ethernet_32770``" msgstr "" -#: ../../library/socket.rst:1329 +#: ../../library/socket.rst:1336 msgid "friendly name: ``vEthernet (nat)``" msgstr "" -#: ../../library/socket.rst:1330 +#: ../../library/socket.rst:1337 msgid "description: ``Hyper-V Virtual Ethernet Adapter``" msgstr "" -#: ../../library/socket.rst:1332 +#: ../../library/socket.rst:1339 msgid "" "This function returns names of the second form from the list, " "``ethernet_32770`` in this example case." msgstr "" -#: ../../library/socket.rst:1338 +#: ../../library/socket.rst:1345 msgid "" "Return a network interface index number corresponding to an interface " "name. :exc:`OSError` if no interface with the given name exists." msgstr "" -#: ../../library/socket.rst:1350 ../../library/socket.rst:1367 +#: ../../library/socket.rst:1357 ../../library/socket.rst:1374 msgid "\"Interface name\" is a name as documented in :func:`if_nameindex`." msgstr "" -#: ../../library/socket.rst:1355 +#: ../../library/socket.rst:1362 msgid "" "Return a network interface name corresponding to an interface index " "number. :exc:`OSError` if no interface with the given index exists." msgstr "" -#: ../../library/socket.rst:1372 +#: ../../library/socket.rst:1379 msgid "" "Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket " "*sock*. The *fds* parameter is a sequence of file descriptors. " "Consult :meth:`~socket.sendmsg` for the documentation of these parameters." msgstr "" -#: ../../library/socket.rst:1378 ../../library/socket.rst:1392 +#: ../../library/socket.rst:1385 ../../library/socket.rst:1399 msgid "" "Unix platforms supporting :meth:`~socket.sendmsg` and :const:`SCM_RIGHTS` " "mechanism." msgstr "" -#: ../../library/socket.rst:1386 +#: ../../library/socket.rst:1393 msgid "" "Receive up to *maxfds* file descriptors from an :const:`AF_UNIX` socket " "*sock*. Return ``(msg, list(fds), flags, addr)``. " "Consult :meth:`~socket.recvmsg` for the documentation of these parameters." msgstr "" -#: ../../library/socket.rst:1399 +#: ../../library/socket.rst:1406 msgid "Any truncated integers at the end of the list of file descriptors." msgstr "" -#: ../../library/socket.rst:1405 +#: ../../library/socket.rst:1412 msgid "Socket Objects" msgstr "Socket 物件" -#: ../../library/socket.rst:1407 +#: ../../library/socket.rst:1414 msgid "" "Socket objects have the following methods. Except " "for :meth:`~socket.makefile`, these correspond to Unix system calls " "applicable to sockets." msgstr "" -#: ../../library/socket.rst:1411 +#: ../../library/socket.rst:1418 msgid "" "Support for the :term:`context manager` protocol was added. Exiting the " "context manager is equivalent to calling :meth:`~socket.close`." msgstr "" -#: ../../library/socket.rst:1418 +#: ../../library/socket.rst:1425 msgid "" "Accept a connection. The socket must be bound to an address and listening " "for connections. The return value is a pair ``(conn, address)`` where *conn* " @@ -1644,27 +1660,27 @@ msgid "" "connection." msgstr "" -#: ../../library/socket.rst:1425 ../../library/socket.rst:1519 +#: ../../library/socket.rst:1432 ../../library/socket.rst:1526 msgid "The socket is now non-inheritable." msgstr "" -#: ../../library/socket.rst:1428 ../../library/socket.rst:1654 -#: ../../library/socket.rst:1668 ../../library/socket.rst:1745 -#: ../../library/socket.rst:1818 ../../library/socket.rst:1837 -#: ../../library/socket.rst:1854 ../../library/socket.rst:1899 +#: ../../library/socket.rst:1435 ../../library/socket.rst:1661 +#: ../../library/socket.rst:1675 ../../library/socket.rst:1752 +#: ../../library/socket.rst:1825 ../../library/socket.rst:1844 +#: ../../library/socket.rst:1861 ../../library/socket.rst:1906 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the method now retries the system call instead of raising " "an :exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -#: ../../library/socket.rst:1436 +#: ../../library/socket.rst:1443 msgid "" "Bind the socket to *address*. The socket must not already be bound. (The " "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1439 +#: ../../library/socket.rst:1446 msgid "" "Raises an :ref:`auditing event ` ``socket.bind`` with arguments " "``self``, ``address``." @@ -1672,7 +1688,7 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.bind``。" -#: ../../library/socket.rst:1446 +#: ../../library/socket.rst:1453 msgid "" "Mark the socket closed. The underlying system resource (e.g. a file " "descriptor) is also closed when all file objects from :meth:`makefile` are " @@ -1681,33 +1697,33 @@ msgid "" "flushed)." msgstr "" -#: ../../library/socket.rst:1452 +#: ../../library/socket.rst:1459 msgid "" "Sockets are automatically closed when they are garbage-collected, but it is " "recommended to :meth:`close` them explicitly, or to use a :keyword:`with` " "statement around them." msgstr "" -#: ../../library/socket.rst:1456 +#: ../../library/socket.rst:1463 msgid "" ":exc:`OSError` is now raised if an error occurs when the " "underlying :c:func:`close` call is made." msgstr "" -#: ../../library/socket.rst:1462 +#: ../../library/socket.rst:1469 msgid "" ":meth:`close` releases the resource associated with a connection but does " "not necessarily close the connection immediately. If you want to close the " "connection in a timely fashion, call :meth:`shutdown` before :meth:`close`." msgstr "" -#: ../../library/socket.rst:1470 +#: ../../library/socket.rst:1477 msgid "" "Connect to a remote socket at *address*. (The format of *address* depends on " "the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1473 +#: ../../library/socket.rst:1480 msgid "" "If the connection is interrupted by a signal, the method waits until the " "connection completes, or raise a :exc:`TimeoutError` on timeout, if the " @@ -1717,7 +1733,7 @@ msgid "" "signal (or the exception raised by the signal handler)." msgstr "" -#: ../../library/socket.rst:1480 ../../library/socket.rst:1500 +#: ../../library/socket.rst:1487 ../../library/socket.rst:1507 msgid "" "Raises an :ref:`auditing event ` ``socket.connect`` with arguments " "``self``, ``address``." @@ -1725,7 +1741,7 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.connect``。" -#: ../../library/socket.rst:1482 +#: ../../library/socket.rst:1489 msgid "" "The method now waits until the connection completes instead of raising " "an :exc:`InterruptedError` exception if the connection is interrupted by a " @@ -1733,7 +1749,7 @@ msgid "" "blocking or has a timeout (see the :pep:`475` for the rationale)." msgstr "" -#: ../../library/socket.rst:1493 +#: ../../library/socket.rst:1500 msgid "" "Like ``connect(address)``, but return an error indicator instead of raising " "an exception for errors returned by the C-level :c:func:`connect` call " @@ -1743,38 +1759,38 @@ msgid "" "asynchronous connects." msgstr "" -#: ../../library/socket.rst:1506 +#: ../../library/socket.rst:1513 msgid "" "Put the socket object into closed state without actually closing the " "underlying file descriptor. The file descriptor is returned, and can be " "reused for other purposes." msgstr "" -#: ../../library/socket.rst:1515 +#: ../../library/socket.rst:1522 msgid "Duplicate the socket." msgstr "" -#: ../../library/socket.rst:1527 +#: ../../library/socket.rst:1534 msgid "" "Return the socket's file descriptor (a small integer), or -1 on failure. " "This is useful with :func:`select.select`." msgstr "" -#: ../../library/socket.rst:1530 +#: ../../library/socket.rst:1537 msgid "" "Under Windows the small integer returned by this method cannot be used where " "a file descriptor can be used (such as :func:`os.fdopen`). Unix does not " "have this limitation." msgstr "" -#: ../../library/socket.rst:1536 +#: ../../library/socket.rst:1543 msgid "" "Get the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle: ``True`` if the socket can be inherited in " "child processes, ``False`` if it cannot." msgstr "" -#: ../../library/socket.rst:1545 +#: ../../library/socket.rst:1552 msgid "" "Return the remote address to which the socket is connected. This is useful " "to find out the port number of a remote IPv4/v6 socket, for instance. (The " @@ -1782,14 +1798,14 @@ msgid "" "above.) On some systems this function is not supported." msgstr "" -#: ../../library/socket.rst:1553 +#: ../../library/socket.rst:1560 msgid "" "Return the socket's own address. This is useful to find out the port number " "of an IPv4/v6 socket, for instance. (The format of the address returned " "depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1560 +#: ../../library/socket.rst:1567 msgid "" "Return the value of the given socket option (see the Unix man " "page :manpage:`getsockopt(2)`). The needed symbolic constants (:ref:`SO_\\* " @@ -1802,16 +1818,16 @@ msgid "" "structures encoded as byte strings)." msgstr "" -#: ../../library/socket.rst:1574 +#: ../../library/socket.rst:1581 msgid "" "Return ``True`` if socket is in blocking mode, ``False`` if in non-blocking." msgstr "" -#: ../../library/socket.rst:1577 +#: ../../library/socket.rst:1584 msgid "This is equivalent to checking ``socket.gettimeout() != 0``." msgstr "這等同於檢查 ``socket.gettimeout() != 0``。" -#: ../../library/socket.rst:1584 +#: ../../library/socket.rst:1591 msgid "" "Return the timeout in seconds (float) associated with socket operations, or " "``None`` if no timeout is set. This reflects the last call " @@ -1822,11 +1838,11 @@ msgstr "" msgid "platform" msgstr "平台" -#: ../../library/socket.rst:1591 +#: ../../library/socket.rst:1598 msgid "Windows" msgstr "Windows" -#: ../../library/socket.rst:1593 +#: ../../library/socket.rst:1600 msgid "" "The :meth:`ioctl` method is a limited interface to the WSAIoctl system " "interface. Please refer to the `Win32 documentation >> import socket\n" ">>> s1, s2 = socket.socketpair()\n" @@ -2042,7 +2058,7 @@ msgstr "" ">>> [b1, b2, b3]\n" "[bytearray(b'Mary'), bytearray(b'01 had a 9'), bytearray(b'little lamb---')]" -#: ../../library/socket.rst:1792 +#: ../../library/socket.rst:1799 msgid "" "Receive data from the socket, writing it into *buffer* instead of creating a " "new bytestring. The return value is a pair ``(nbytes, address)`` where " @@ -2052,7 +2068,7 @@ msgid "" "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1802 +#: ../../library/socket.rst:1809 msgid "" "Receive up to *nbytes* bytes from the socket, storing the data into a buffer " "rather than creating a new bytestring. If *nbytes* is not specified (or 0), " @@ -2061,7 +2077,7 @@ msgid "" "of the optional argument *flags*; it defaults to zero." msgstr "" -#: ../../library/socket.rst:1811 +#: ../../library/socket.rst:1818 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -2071,7 +2087,7 @@ msgid "" "data. For further information on this topic, consult the :ref:`socket-howto`." msgstr "" -#: ../../library/socket.rst:1826 +#: ../../library/socket.rst:1833 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -2081,13 +2097,13 @@ msgid "" "to determine how much data, if any, was successfully sent." msgstr "" -#: ../../library/socket.rst:1833 +#: ../../library/socket.rst:1840 msgid "" "The socket timeout is no longer reset each time data is sent successfully. " "The socket timeout is now the maximum total duration to send all data." msgstr "" -#: ../../library/socket.rst:1846 +#: ../../library/socket.rst:1853 msgid "" "Send data to the socket. The socket should not be connected to a remote " "socket, since the destination socket is specified by *address*. The " @@ -2096,7 +2112,7 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1852 +#: ../../library/socket.rst:1859 msgid "" "Raises an :ref:`auditing event ` ``socket.sendto`` with arguments " "``self``, ``address``." @@ -2104,7 +2120,7 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.sendto``。" -#: ../../library/socket.rst:1862 +#: ../../library/socket.rst:1869 msgid "" "Send normal and ancillary data to the socket, gathering the non-ancillary " "data from a series of buffers and concatenating it into a single message. " @@ -2124,14 +2140,14 @@ msgid "" "bytes of non-ancillary data sent." msgstr "" -#: ../../library/socket.rst:1882 +#: ../../library/socket.rst:1889 msgid "" "The following function sends the list of file descriptors *fds* over " "an :const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` " "mechanism. See also :meth:`recvmsg`. ::" msgstr "" -#: ../../library/socket.rst:1886 +#: ../../library/socket.rst:1893 msgid "" "import socket, array\n" "\n" @@ -2145,7 +2161,7 @@ msgstr "" " return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, " "array.array(\"i\", fds))])" -#: ../../library/socket.rst:1895 +#: ../../library/socket.rst:1902 msgid "" "Raises an :ref:`auditing event ` ``socket.sendmsg`` with arguments " "``self``, ``address``." @@ -2153,14 +2169,14 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.sendmsg``。" -#: ../../library/socket.rst:1906 +#: ../../library/socket.rst:1913 msgid "" "Specialized version of :meth:`~socket.sendmsg` for :const:`AF_ALG` socket. " "Set mode, IV, AEAD associated data length and flags for :const:`AF_ALG` " "socket." msgstr "" -#: ../../library/socket.rst:1915 +#: ../../library/socket.rst:1922 msgid "" "Send a file until EOF is reached by using high-" "performance :mod:`os.sendfile` and return the total number of bytes which " @@ -2175,38 +2191,38 @@ msgid "" "type. Non-blocking sockets are not supported." msgstr "" -#: ../../library/socket.rst:1931 +#: ../../library/socket.rst:1938 msgid "" "Set the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle." msgstr "" -#: ../../library/socket.rst:1939 +#: ../../library/socket.rst:1946 msgid "" "Set blocking or non-blocking mode of the socket: if *flag* is false, the " "socket is set to non-blocking, else to blocking mode." msgstr "" -#: ../../library/socket.rst:1942 +#: ../../library/socket.rst:1949 msgid "" "This method is a shorthand for certain :meth:`~socket.settimeout` calls:" msgstr "" -#: ../../library/socket.rst:1944 +#: ../../library/socket.rst:1951 msgid "``sock.setblocking(True)`` is equivalent to ``sock.settimeout(None)``" msgstr "``sock.setblocking(True)`` 等價於 ``sock.settimeout(None)``" -#: ../../library/socket.rst:1946 +#: ../../library/socket.rst:1953 msgid "``sock.setblocking(False)`` is equivalent to ``sock.settimeout(0.0)``" msgstr "``sock.setblocking(False)`` 等價於 ``sock.settimeout(0.0)``" -#: ../../library/socket.rst:1948 +#: ../../library/socket.rst:1955 msgid "" "The method no longer applies :const:`SOCK_NONBLOCK` flag " "on :attr:`socket.type`." msgstr "" -#: ../../library/socket.rst:1955 +#: ../../library/socket.rst:1962 msgid "" "Set a timeout on blocking socket operations. The *value* argument can be a " "nonnegative floating-point number expressing seconds, or ``None``. If a non-" @@ -2216,19 +2232,19 @@ msgid "" "blocking mode. If ``None`` is given, the socket is put in blocking mode." msgstr "" -#: ../../library/socket.rst:1962 +#: ../../library/socket.rst:1969 msgid "" "For further information, please consult the :ref:`notes on socket timeouts " "`." msgstr "" -#: ../../library/socket.rst:1964 +#: ../../library/socket.rst:1971 msgid "" "The method no longer toggles :const:`SOCK_NONBLOCK` flag " "on :attr:`socket.type`." msgstr "" -#: ../../library/socket.rst:1977 +#: ../../library/socket.rst:1984 msgid "" "Set the value of the given socket option (see the Unix manual " "page :manpage:`setsockopt(2)`). The needed symbolic constants are defined " @@ -2242,11 +2258,11 @@ msgid "" "``optlen=optlen``." msgstr "" -#: ../../library/socket.rst:1990 +#: ../../library/socket.rst:1997 msgid "setsockopt(level, optname, None, optlen: int) form added." msgstr "" -#: ../../library/socket.rst:1998 +#: ../../library/socket.rst:2005 msgid "" "Shut down one or both halves of the connection. If *how* " "is :const:`SHUT_RD`, further receives are disallowed. If *how* " @@ -2254,7 +2270,7 @@ msgid "" "is :const:`SHUT_RDWR`, further sends and receives are disallowed." msgstr "" -#: ../../library/socket.rst:2008 +#: ../../library/socket.rst:2015 msgid "" "Duplicate a socket and prepare it for sharing with a target process. The " "target process must be provided with *process_id*. The resulting bytes " @@ -2265,49 +2281,49 @@ msgid "" "the target process." msgstr "" -#: ../../library/socket.rst:2020 +#: ../../library/socket.rst:2027 msgid "" "Note that there are no methods :meth:`read` or :meth:`write`; " "use :meth:`~socket.recv` and :meth:`~socket.send` without *flags* argument " "instead." msgstr "" -#: ../../library/socket.rst:2023 +#: ../../library/socket.rst:2030 msgid "" "Socket objects also have these (read-only) attributes that correspond to the " "values given to the :class:`~socket.socket` constructor." msgstr "" -#: ../../library/socket.rst:2029 +#: ../../library/socket.rst:2036 msgid "The socket family." msgstr "" -#: ../../library/socket.rst:2034 +#: ../../library/socket.rst:2041 msgid "The socket type." msgstr "" -#: ../../library/socket.rst:2039 +#: ../../library/socket.rst:2046 msgid "The socket protocol." msgstr "" -#: ../../library/socket.rst:2046 +#: ../../library/socket.rst:2053 msgid "Notes on socket timeouts" msgstr "" -#: ../../library/socket.rst:2048 +#: ../../library/socket.rst:2055 msgid "" "A socket object can be in one of three modes: blocking, non-blocking, or " "timeout. Sockets are by default always created in blocking mode, but this " "can be changed by calling :func:`setdefaulttimeout`." msgstr "" -#: ../../library/socket.rst:2052 +#: ../../library/socket.rst:2059 msgid "" "In *blocking mode*, operations block until complete or the system returns an " "error (such as connection timed out)." msgstr "" -#: ../../library/socket.rst:2055 +#: ../../library/socket.rst:2062 msgid "" "In *non-blocking mode*, operations fail (with an error that is unfortunately " "system-dependent) if they cannot be completed immediately: functions from " @@ -2315,14 +2331,14 @@ msgid "" "available for reading or writing." msgstr "" -#: ../../library/socket.rst:2060 +#: ../../library/socket.rst:2067 msgid "" "In *timeout mode*, operations fail if they cannot be completed within the " "timeout specified for the socket (they raise a :exc:`timeout` exception) or " "if the system returns an error." msgstr "" -#: ../../library/socket.rst:2065 +#: ../../library/socket.rst:2072 msgid "" "At the operating system level, sockets in *timeout mode* are internally set " "in non-blocking mode. Also, the blocking and timeout modes are shared " @@ -2331,11 +2347,11 @@ msgid "" "you decide to use the :meth:`~socket.fileno` of a socket." msgstr "" -#: ../../library/socket.rst:2072 +#: ../../library/socket.rst:2079 msgid "Timeouts and the ``connect`` method" msgstr "" -#: ../../library/socket.rst:2074 +#: ../../library/socket.rst:2081 msgid "" "The :meth:`~socket.connect` operation is also subject to the timeout " "setting, and in general it is recommended to call :meth:`~socket.settimeout` " @@ -2345,24 +2361,24 @@ msgid "" "timeout setting." msgstr "" -#: ../../library/socket.rst:2082 +#: ../../library/socket.rst:2089 msgid "Timeouts and the ``accept`` method" msgstr "" -#: ../../library/socket.rst:2084 +#: ../../library/socket.rst:2091 msgid "" "If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by " "the :meth:`~socket.accept` method inherit that timeout. Otherwise, the " "behaviour depends on settings of the listening socket:" msgstr "" -#: ../../library/socket.rst:2088 +#: ../../library/socket.rst:2095 msgid "" "if the listening socket is in *blocking mode* or in *timeout mode*, the " "socket returned by :meth:`~socket.accept` is in *blocking mode*;" msgstr "" -#: ../../library/socket.rst:2091 +#: ../../library/socket.rst:2098 msgid "" "if the listening socket is in *non-blocking mode*, whether the socket " "returned by :meth:`~socket.accept` is in blocking or non-blocking mode is " @@ -2370,11 +2386,11 @@ msgid "" "it is recommended you manually override this setting." msgstr "" -#: ../../library/socket.rst:2100 +#: ../../library/socket.rst:2107 msgid "Example" msgstr "範例" -#: ../../library/socket.rst:2102 +#: ../../library/socket.rst:2109 msgid "" "Here are four minimal example programs using the TCP/IP protocol: a server " "that echoes all data that it receives back (servicing only one client), and " @@ -2388,11 +2404,11 @@ msgid "" "by :meth:`~socket.accept`." msgstr "" -#: ../../library/socket.rst:2112 +#: ../../library/socket.rst:2119 msgid "The first two examples support IPv4 only. ::" msgstr "前兩個範例只支援 IPv4: ::" -#: ../../library/socket.rst:2114 +#: ../../library/socket.rst:2121 msgid "" "# Echo server program\n" "import socket\n" @@ -2411,7 +2427,7 @@ msgid "" " conn.sendall(data)" msgstr "" -#: ../../library/socket.rst:2132 +#: ../../library/socket.rst:2139 msgid "" "# Echo client program\n" "import socket\n" @@ -2425,7 +2441,7 @@ msgid "" "print('Received', repr(data))" msgstr "" -#: ../../library/socket.rst:2143 +#: ../../library/socket.rst:2150 msgid "" "The next two examples are identical to the above two, but support both IPv4 " "and IPv6. The server side will listen to the first address family available " @@ -2435,7 +2451,7 @@ msgid "" "resolution, and sends traffic to the first one connected successfully. ::" msgstr "" -#: ../../library/socket.rst:2150 +#: ../../library/socket.rst:2157 msgid "" "# Echo server program\n" "import socket\n" @@ -2472,7 +2488,7 @@ msgid "" " conn.send(data)" msgstr "" -#: ../../library/socket.rst:2186 +#: ../../library/socket.rst:2193 msgid "" "# Echo client program\n" "import socket\n" @@ -2505,14 +2521,14 @@ msgid "" "print('Received', repr(data))" msgstr "" -#: ../../library/socket.rst:2215 +#: ../../library/socket.rst:2222 msgid "" "The next example shows how to write a very simple network sniffer with raw " "sockets on Windows. The example requires administrator privileges to modify " "the interface::" msgstr "" -#: ../../library/socket.rst:2219 +#: ../../library/socket.rst:2226 msgid "" "import socket\n" "\n" @@ -2536,29 +2552,29 @@ msgid "" "s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)" msgstr "" -#: ../../library/socket.rst:2240 +#: ../../library/socket.rst:2247 msgid "" "The next example shows how to use the socket interface to communicate to a " "CAN network using the raw socket protocol. To use CAN with the broadcast " "manager protocol instead, open a socket with::" msgstr "" -#: ../../library/socket.rst:2244 +#: ../../library/socket.rst:2251 msgid "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" msgstr "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" -#: ../../library/socket.rst:2246 +#: ../../library/socket.rst:2253 msgid "" "After binding (:const:`CAN_RAW`) or connecting (:const:`CAN_BCM`) the " "socket, you can use the :meth:`socket.send` and :meth:`socket.recv` " "operations (and their counterparts) on the socket object as usual." msgstr "" -#: ../../library/socket.rst:2250 +#: ../../library/socket.rst:2257 msgid "This last example might require special privileges::" msgstr "" -#: ../../library/socket.rst:2252 +#: ../../library/socket.rst:2259 msgid "" "import socket\n" "import struct\n" @@ -2600,29 +2616,29 @@ msgid "" " print('Error sending CAN frame')" msgstr "" -#: ../../library/socket.rst:2290 +#: ../../library/socket.rst:2297 msgid "" "Running an example several times with too small delay between executions, " "could lead to this error::" msgstr "" -#: ../../library/socket.rst:2293 +#: ../../library/socket.rst:2300 msgid "OSError: [Errno 98] Address already in use" msgstr "OSError: [Errno 98] Address already in use" -#: ../../library/socket.rst:2295 +#: ../../library/socket.rst:2302 msgid "" "This is because the previous execution has left the socket in a " "``TIME_WAIT`` state, and can't be immediately reused." msgstr "" -#: ../../library/socket.rst:2298 +#: ../../library/socket.rst:2305 msgid "" "There is a :mod:`socket` flag to set, in order to prevent " "this, :const:`socket.SO_REUSEADDR`::" msgstr "" -#: ../../library/socket.rst:2301 +#: ../../library/socket.rst:2308 msgid "" "s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" @@ -2632,30 +2648,30 @@ msgstr "" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" "s.bind((HOST, PORT))" -#: ../../library/socket.rst:2305 +#: ../../library/socket.rst:2312 msgid "" "the :data:`SO_REUSEADDR` flag tells the kernel to reuse a local socket in " "``TIME_WAIT`` state, without waiting for its natural timeout to expire." msgstr "" -#: ../../library/socket.rst:2311 +#: ../../library/socket.rst:2318 msgid "" "For an introduction to socket programming (in C), see the following papers:" msgstr "" -#: ../../library/socket.rst:2313 +#: ../../library/socket.rst:2320 msgid "" "*An Introductory 4.3BSD Interprocess Communication Tutorial*, by Stuart " "Sechrest" msgstr "" -#: ../../library/socket.rst:2315 +#: ../../library/socket.rst:2322 msgid "" "*An Advanced 4.3BSD Interprocess Communication Tutorial*, by Samuel J. " "Leffler et al," msgstr "" -#: ../../library/socket.rst:2318 +#: ../../library/socket.rst:2325 msgid "" "both in the UNIX Programmer's Manual, Supplementary Documents 1 (sections " "PS1:7 and PS1:8). The platform-specific reference material for the various " @@ -2674,18 +2690,18 @@ msgstr "object(物件)" msgid "socket" msgstr "socket" -#: ../../library/socket.rst:1623 +#: ../../library/socket.rst:1630 msgid "I/O control" msgstr "I/O control(I/O 控制)" -#: ../../library/socket.rst:1623 +#: ../../library/socket.rst:1630 msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/socket.rst:1975 +#: ../../library/socket.rst:1982 msgid "module" msgstr "module(模組)" -#: ../../library/socket.rst:1975 +#: ../../library/socket.rst:1982 msgid "struct" msgstr "struct" diff --git a/library/socketserver.po b/library/socketserver.po index d87251dc5d..31b914a9a2 100644 --- a/library/socketserver.po +++ b/library/socketserver.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-07 00:13+0000\n" +"POT-Creation-Date: 2025-02-09 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -90,9 +90,9 @@ msgid "" "classes, passing it the server's address and the request handler class. It " "is recommended to use the server in a :keyword:`with` statement. Then call " "the :meth:`~BaseServer.handle_request` or :meth:`~BaseServer.serve_forever` " -"method of the server object to process one or many requests. Finally, " -"call :meth:`~BaseServer.server_close` to close the socket (unless you used " -"a :keyword:`!with` statement)." +"method of the server object to process one or many requests. Finally, call :" +"meth:`~BaseServer.server_close` to close the socket (unless you used a :" +"keyword:`!with` statement)." msgstr "" #: ../../library/socketserver.rst:64 @@ -103,8 +103,8 @@ msgid "" "attribute *daemon_threads*, which indicates whether or not the server should " "wait for thread termination. You should set the flag explicitly if you " "would like threads to behave autonomously; the default is :const:`False`, " -"meaning that Python will not exit until all threads created " -"by :class:`ThreadingMixIn` have exited." +"meaning that Python will not exit until all threads created by :class:" +"`ThreadingMixIn` have exited." msgstr "" #: ../../library/socketserver.rst:73 @@ -177,9 +177,9 @@ msgstr "" #: ../../library/socketserver.rst:112 msgid "" -"The mix-in class comes first, since it overrides a method defined " -"in :class:`UDPServer`. Setting the various attributes also changes the " -"behavior of the underlying server mechanism." +"The mix-in class comes first, since it overrides a method defined in :class:" +"`UDPServer`. Setting the various attributes also changes the behavior of " +"the underlying server mechanism." msgstr "" #: ../../library/socketserver.rst:116 @@ -204,18 +204,18 @@ msgstr "" #: ../../library/socketserver.rst:131 msgid "" -"For :class:`ThreadingMixIn` use daemonic threads by " -"setting :data:`ThreadingMixIn.daemon_threads ` to ``True`` " -"to not wait until threads complete." +"For :class:`ThreadingMixIn` use daemonic threads by setting :data:" +"`ThreadingMixIn.daemon_threads ` to ``True`` to not wait " +"until threads complete." msgstr "" #: ../../library/socketserver.rst:137 msgid "" -":meth:`ForkingMixIn.server_close ` " -"and :meth:`ThreadingMixIn.server_close ` now waits " -"until all child processes and non-daemonic threads complete. Add a " -"new :attr:`ForkingMixIn.block_on_close ` class attribute to " -"opt-in for the pre-3.7 behaviour." +":meth:`ForkingMixIn.server_close ` and :meth:" +"`ThreadingMixIn.server_close ` now waits until all " +"child processes and non-daemonic threads complete. Add a new :attr:" +"`ForkingMixIn.block_on_close ` class attribute to opt-in for " +"the pre-3.7 behaviour." msgstr "" #: ../../library/socketserver.rst:153 @@ -230,13 +230,13 @@ msgstr "" #: ../../library/socketserver.rst:159 msgid "" -"To implement a service, you must derive a class " -"from :class:`BaseRequestHandler` and redefine " -"its :meth:`~BaseRequestHandler.handle` method. You can then run various " -"versions of the service by combining one of the server classes with your " -"request handler class. The request handler class must be different for " -"datagram or stream services. This can be hidden by using the handler " -"subclasses :class:`StreamRequestHandler` or :class:`DatagramRequestHandler`." +"To implement a service, you must derive a class from :class:" +"`BaseRequestHandler` and redefine its :meth:`~BaseRequestHandler.handle` " +"method. You can then run various versions of the service by combining one of " +"the server classes with your request handler class. The request handler " +"class must be different for datagram or stream services. This can be hidden " +"by using the handler subclasses :class:`StreamRequestHandler` or :class:" +"`DatagramRequestHandler`." msgstr "" #: ../../library/socketserver.rst:167 @@ -264,8 +264,8 @@ msgid "" "In some cases, it may be appropriate to process part of a request " "synchronously, but to finish processing in a forked child depending on the " "request data. This can be implemented by using a synchronous server and " -"doing an explicit fork in the request handler " -"class :meth:`~BaseRequestHandler.handle` method." +"doing an explicit fork in the request handler class :meth:" +"`~BaseRequestHandler.handle` method." msgstr "" #: ../../library/socketserver.rst:185 @@ -288,8 +288,8 @@ msgstr "" msgid "" "This is the superclass of all Server objects in the module. It defines the " "interface, given below, but does not implement most of the methods, which is " -"done in subclasses. The two parameters are stored in the " -"respective :attr:`server_address` and :attr:`RequestHandlerClass` attributes." +"done in subclasses. The two parameters are stored in the respective :attr:" +"`server_address` and :attr:`RequestHandlerClass` attributes." msgstr "" #: ../../library/socketserver.rst:210 @@ -302,13 +302,12 @@ msgstr "" #: ../../library/socketserver.rst:217 msgid "" "Process a single request. This function calls the following methods in " -"order: :meth:`get_request`, :meth:`verify_request`, " -"and :meth:`process_request`. If the user-" -"provided :meth:`~BaseRequestHandler.handle` method of the handler class " -"raises an exception, the server's :meth:`handle_error` method will be " -"called. If no request is received within :attr:`timeout` " -"seconds, :meth:`handle_timeout` will be called and :meth:`handle_request` " -"will return." +"order: :meth:`get_request`, :meth:`verify_request`, and :meth:" +"`process_request`. If the user-provided :meth:`~BaseRequestHandler.handle` " +"method of the handler class raises an exception, the server's :meth:" +"`handle_error` method will be called. If no request is received within :" +"attr:`timeout` seconds, :meth:`handle_timeout` will be called and :meth:" +"`handle_request` will return." msgstr "" #: ../../library/socketserver.rst:229 @@ -334,9 +333,9 @@ msgstr "" #: ../../library/socketserver.rst:251 msgid "" -"Tell the :meth:`serve_forever` loop to stop and wait until it " -"does. :meth:`shutdown` must be called while :meth:`serve_forever` is running " -"in a different thread otherwise it will deadlock." +"Tell the :meth:`serve_forever` loop to stop and wait until it does. :meth:" +"`shutdown` must be called while :meth:`serve_forever` is running in a " +"different thread otherwise it will deadlock." msgstr "" #: ../../library/socketserver.rst:258 @@ -345,41 +344,44 @@ msgstr "" #: ../../library/socketserver.rst:263 msgid "" -"The family of protocols to which the server's socket belongs. Common " -"examples are :const:`socket.AF_INET` and :const:`socket.AF_UNIX`." +"The family of protocols to which the server's socket belongs. Common " +"examples are :const:`socket.AF_INET`, :const:`socket.AF_INET6`, and :const:" +"`socket.AF_UNIX`. Subclass the TCP or UDP server classes in this module " +"with class attribute ``address_family = AF_INET6`` set if you want IPv6 " +"server classes." msgstr "" -#: ../../library/socketserver.rst:269 +#: ../../library/socketserver.rst:272 msgid "" "The user-provided request handler class; an instance of this class is " "created for each request." msgstr "" -#: ../../library/socketserver.rst:275 +#: ../../library/socketserver.rst:278 msgid "" "The address on which the server is listening. The format of addresses " -"varies depending on the protocol family; see the documentation for " -"the :mod:`socket` module for details. For internet protocols, this is a " -"tuple containing a string giving the address, and an integer port number: " +"varies depending on the protocol family; see the documentation for the :mod:" +"`socket` module for details. For internet protocols, this is a tuple " +"containing a string giving the address, and an integer port number: " "``('127.0.0.1', 80)``, for example." msgstr "" -#: ../../library/socketserver.rst:284 +#: ../../library/socketserver.rst:287 msgid "" "The socket object on which the server will listen for incoming requests." msgstr "" -#: ../../library/socketserver.rst:287 +#: ../../library/socketserver.rst:290 msgid "The server classes support the following class variables:" msgstr "" -#: ../../library/socketserver.rst:293 +#: ../../library/socketserver.rst:296 msgid "" -"Whether the server will allow the reuse of an address. This defaults " -"to :const:`False`, and can be set in subclasses to change the policy." +"Whether the server will allow the reuse of an address. This defaults to :" +"const:`False`, and can be set in subclasses to change the policy." msgstr "" -#: ../../library/socketserver.rst:299 +#: ../../library/socketserver.rst:302 msgid "" "The size of the request queue. If it takes a long time to process a single " "request, any requests that arrive while the server is busy are placed into a " @@ -388,40 +390,40 @@ msgid "" "default value is usually 5, but this can be overridden by subclasses." msgstr "" -#: ../../library/socketserver.rst:308 +#: ../../library/socketserver.rst:311 msgid "" -"The type of socket used by the server; :const:`socket.SOCK_STREAM` " -"and :const:`socket.SOCK_DGRAM` are two common values." +"The type of socket used by the server; :const:`socket.SOCK_STREAM` and :" +"const:`socket.SOCK_DGRAM` are two common values." msgstr "" -#: ../../library/socketserver.rst:314 +#: ../../library/socketserver.rst:317 msgid "" "Timeout duration, measured in seconds, or :const:`None` if no timeout is " "desired. If :meth:`handle_request` receives no incoming requests within the " "timeout period, the :meth:`handle_timeout` method is called." msgstr "" -#: ../../library/socketserver.rst:319 +#: ../../library/socketserver.rst:322 msgid "" "There are various server methods that can be overridden by subclasses of " "base server classes like :class:`TCPServer`; these methods aren't useful to " "external users of the server object." msgstr "" -#: ../../library/socketserver.rst:328 +#: ../../library/socketserver.rst:331 msgid "" "Actually processes the request by instantiating :attr:`RequestHandlerClass` " "and calling its :meth:`~BaseRequestHandler.handle` method." msgstr "" -#: ../../library/socketserver.rst:334 +#: ../../library/socketserver.rst:337 msgid "" "Must accept a request from the socket, and return a 2-tuple containing the " "*new* socket object to be used to communicate with the client, and the " "client's address." msgstr "" -#: ../../library/socketserver.rst:341 +#: ../../library/socketserver.rst:344 msgid "" "This function is called if the :meth:`~BaseRequestHandler.handle` method of " "a :attr:`RequestHandlerClass` instance raises an exception. The default " @@ -429,11 +431,11 @@ msgid "" "further requests." msgstr "" -#: ../../library/socketserver.rst:346 +#: ../../library/socketserver.rst:349 msgid "Now only called for exceptions derived from the :exc:`Exception` class." msgstr "" -#: ../../library/socketserver.rst:353 +#: ../../library/socketserver.rst:356 msgid "" "This function is called when the :attr:`timeout` attribute has been set to a " "value other than :const:`None` and the timeout period has passed with no " @@ -442,28 +444,28 @@ msgid "" "threading servers this method does nothing." msgstr "" -#: ../../library/socketserver.rst:362 +#: ../../library/socketserver.rst:365 msgid "" -"Calls :meth:`finish_request` to create an instance of " -"the :attr:`RequestHandlerClass`. If desired, this function can create a new " -"process or thread to handle the request; the :class:`ForkingMixIn` " -"and :class:`ThreadingMixIn` classes do this." +"Calls :meth:`finish_request` to create an instance of the :attr:" +"`RequestHandlerClass`. If desired, this function can create a new process " +"or thread to handle the request; the :class:`ForkingMixIn` and :class:" +"`ThreadingMixIn` classes do this." msgstr "" -#: ../../library/socketserver.rst:374 +#: ../../library/socketserver.rst:377 msgid "" "Called by the server's constructor to activate the server. The default " "behavior for a TCP server just invokes :meth:`~socket.socket.listen` on the " "server's socket. May be overridden." msgstr "" -#: ../../library/socketserver.rst:381 +#: ../../library/socketserver.rst:384 msgid "" "Called by the server's constructor to bind the socket to the desired " "address. May be overridden." msgstr "" -#: ../../library/socketserver.rst:387 +#: ../../library/socketserver.rst:390 msgid "" "Must return a Boolean value; if the value is :const:`True`, the request will " "be processed, and if it's :const:`False`, the request will be denied. This " @@ -471,17 +473,17 @@ msgid "" "default implementation always returns :const:`True`." msgstr "" -#: ../../library/socketserver.rst:393 +#: ../../library/socketserver.rst:396 msgid "" "Support for the :term:`context manager` protocol was added. Exiting the " "context manager is equivalent to calling :meth:`server_close`." msgstr "" -#: ../../library/socketserver.rst:399 +#: ../../library/socketserver.rst:402 msgid "Request Handler Objects" msgstr "" -#: ../../library/socketserver.rst:403 +#: ../../library/socketserver.rst:406 msgid "" "This is the superclass of all request handler objects. It defines the " "interface, given below. A concrete request handler subclass must define a " @@ -489,87 +491,87 @@ msgid "" "instance of the subclass is created for each request." msgstr "" -#: ../../library/socketserver.rst:412 +#: ../../library/socketserver.rst:415 msgid "" "Called before the :meth:`handle` method to perform any initialization " "actions required. The default implementation does nothing." msgstr "" -#: ../../library/socketserver.rst:418 +#: ../../library/socketserver.rst:421 msgid "" "This function must do all the work required to service a request. The " "default implementation does nothing. Several instance attributes are " "available to it; the request is available as :attr:`request`; the client " -"address as :attr:`client_address`; and the server instance " -"as :attr:`server`, in case it needs access to per-server information." +"address as :attr:`client_address`; and the server instance as :attr:" +"`server`, in case it needs access to per-server information." msgstr "" -#: ../../library/socketserver.rst:424 +#: ../../library/socketserver.rst:427 msgid "" "The type of :attr:`request` is different for datagram or stream services. " "For stream services, :attr:`request` is a socket object; for datagram " "services, :attr:`request` is a pair of string and socket." msgstr "" -#: ../../library/socketserver.rst:431 +#: ../../library/socketserver.rst:434 msgid "" "Called after the :meth:`handle` method to perform any clean-up actions " "required. The default implementation does nothing. If :meth:`setup` raises " "an exception, this function will not be called." msgstr "" -#: ../../library/socketserver.rst:438 +#: ../../library/socketserver.rst:441 msgid "" "The *new* :class:`socket.socket` object to be used to communicate with the " "client." msgstr "" -#: ../../library/socketserver.rst:444 +#: ../../library/socketserver.rst:447 msgid "Client address returned by :meth:`BaseServer.get_request`." msgstr "" -#: ../../library/socketserver.rst:449 +#: ../../library/socketserver.rst:452 msgid ":class:`BaseServer` object used for handling the request." msgstr "" -#: ../../library/socketserver.rst:455 +#: ../../library/socketserver.rst:458 msgid "" -"These :class:`BaseRequestHandler` subclasses override " -"the :meth:`~BaseRequestHandler.setup` and :meth:`~BaseRequestHandler.finish` " -"methods, and provide :attr:`rfile` and :attr:`wfile` attributes." +"These :class:`BaseRequestHandler` subclasses override the :meth:" +"`~BaseRequestHandler.setup` and :meth:`~BaseRequestHandler.finish` methods, " +"and provide :attr:`rfile` and :attr:`wfile` attributes." msgstr "" -#: ../../library/socketserver.rst:461 +#: ../../library/socketserver.rst:464 msgid "" -"A file object from which receives the request is read. Support " -"the :class:`io.BufferedIOBase` readable interface." +"A file object from which receives the request is read. Support the :class:" +"`io.BufferedIOBase` readable interface." msgstr "" -#: ../../library/socketserver.rst:466 +#: ../../library/socketserver.rst:469 msgid "" -"A file object to which the reply is written. Support " -"the :class:`io.BufferedIOBase` writable interface" +"A file object to which the reply is written. Support the :class:`io." +"BufferedIOBase` writable interface" msgstr "" -#: ../../library/socketserver.rst:470 +#: ../../library/socketserver.rst:473 msgid "" ":attr:`wfile` also supports the :class:`io.BufferedIOBase` writable " "interface." msgstr "" -#: ../../library/socketserver.rst:476 +#: ../../library/socketserver.rst:479 msgid "Examples" msgstr "範例" -#: ../../library/socketserver.rst:479 +#: ../../library/socketserver.rst:482 msgid ":class:`socketserver.TCPServer` Example" msgstr ":class:`socketserver.TCPServer` 範例" -#: ../../library/socketserver.rst:481 ../../library/socketserver.rst:592 +#: ../../library/socketserver.rst:484 ../../library/socketserver.rst:595 msgid "This is the server side::" msgstr "" -#: ../../library/socketserver.rst:483 +#: ../../library/socketserver.rst:486 msgid "" "import socketserver\n" "\n" @@ -606,14 +608,14 @@ msgid "" " server.serve_forever()" msgstr "" -#: ../../library/socketserver.rst:517 +#: ../../library/socketserver.rst:520 msgid "" "An alternative request handler class that makes use of streams (file-like " "objects that simplify communication by providing the standard file " "interface)::" msgstr "" -#: ../../library/socketserver.rst:520 +#: ../../library/socketserver.rst:523 msgid "" "class MyTCPHandler(socketserver.StreamRequestHandler):\n" "\n" @@ -629,7 +631,7 @@ msgid "" " self.wfile.write(self.data.upper())" msgstr "" -#: ../../library/socketserver.rst:533 +#: ../../library/socketserver.rst:536 msgid "" "The difference is that the ``readline()`` call in the second handler will " "call ``recv()`` multiple times until it encounters a newline character, " @@ -641,11 +643,11 @@ msgid "" "the number of ``recv()`` calls on the server required to receive it." msgstr "" -#: ../../library/socketserver.rst:543 ../../library/socketserver.rst:616 +#: ../../library/socketserver.rst:546 ../../library/socketserver.rst:619 msgid "This is the client side::" msgstr "" -#: ../../library/socketserver.rst:545 +#: ../../library/socketserver.rst:548 msgid "" "import socket\n" "import sys\n" @@ -667,15 +669,15 @@ msgid "" "print(\"Received:\", received)" msgstr "" -#: ../../library/socketserver.rst:565 ../../library/socketserver.rst:691 +#: ../../library/socketserver.rst:568 ../../library/socketserver.rst:694 msgid "The output of the example should look something like this:" msgstr "" -#: ../../library/socketserver.rst:567 +#: ../../library/socketserver.rst:570 msgid "Server:" msgstr "" -#: ../../library/socketserver.rst:569 +#: ../../library/socketserver.rst:572 msgid "" "$ python TCPServer.py\n" "127.0.0.1 wrote:\n" @@ -689,11 +691,11 @@ msgstr "" "127.0.0.1 wrote:\n" "b'python is nice'" -#: ../../library/socketserver.rst:577 +#: ../../library/socketserver.rst:580 msgid "Client:" msgstr "" -#: ../../library/socketserver.rst:579 +#: ../../library/socketserver.rst:582 msgid "" "$ python TCPClient.py hello world with TCP\n" "Sent: hello world with TCP\n" @@ -709,11 +711,11 @@ msgstr "" "Sent: python is nice\n" "Received: PYTHON IS NICE" -#: ../../library/socketserver.rst:590 +#: ../../library/socketserver.rst:593 msgid ":class:`socketserver.UDPServer` Example" msgstr ":class:`socketserver.UDPServer` 範例" -#: ../../library/socketserver.rst:594 +#: ../../library/socketserver.rst:597 msgid "" "import socketserver\n" "\n" @@ -738,7 +740,7 @@ msgid "" " server.serve_forever()" msgstr "" -#: ../../library/socketserver.rst:618 +#: ../../library/socketserver.rst:621 msgid "" "import socket\n" "import sys\n" @@ -758,27 +760,27 @@ msgid "" "print(\"Received:\", received)" msgstr "" -#: ../../library/socketserver.rst:635 +#: ../../library/socketserver.rst:638 msgid "" "The output of the example should look exactly like for the TCP server " "example." msgstr "" -#: ../../library/socketserver.rst:639 +#: ../../library/socketserver.rst:642 msgid "Asynchronous Mixins" msgstr "" -#: ../../library/socketserver.rst:641 +#: ../../library/socketserver.rst:644 msgid "" -"To build asynchronous handlers, use the :class:`ThreadingMixIn` " -"and :class:`ForkingMixIn` classes." +"To build asynchronous handlers, use the :class:`ThreadingMixIn` and :class:" +"`ForkingMixIn` classes." msgstr "" -#: ../../library/socketserver.rst:644 +#: ../../library/socketserver.rst:647 msgid "An example for the :class:`ThreadingMixIn` class::" msgstr "" -#: ../../library/socketserver.rst:646 +#: ../../library/socketserver.rst:649 msgid "" "import socket\n" "import threading\n" @@ -792,8 +794,8 @@ msgid "" " response = bytes(\"{}: {}\".format(cur_thread.name, data), 'ascii')\n" " self.request.sendall(response)\n" "\n" -"class ThreadedTCPServer(socketserver.ThreadingMixIn, " -"socketserver.TCPServer):\n" +"class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver." +"TCPServer):\n" " pass\n" "\n" "def client(ip, port, message):\n" @@ -826,7 +828,7 @@ msgid "" " server.shutdown()" msgstr "" -#: ../../library/socketserver.rst:693 +#: ../../library/socketserver.rst:696 msgid "" "$ python ThreadedTCPServer.py\n" "Server loop running in thread: Thread-1\n" @@ -840,7 +842,7 @@ msgstr "" "Received: Thread-3: Hello World 2\n" "Received: Thread-4: Hello World 3" -#: ../../library/socketserver.rst:702 +#: ../../library/socketserver.rst:705 msgid "" "The :class:`ForkingMixIn` class is used in the same way, except that the " "server will spawn a new process for each request. Available only on POSIX " diff --git a/library/sqlite3.po b/library/sqlite3.po index 509dad97ff..2b9942a219 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2023, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-02 00:13+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -38,8 +38,8 @@ msgstr "" #: ../../library/sqlite3.rst:32 msgid "" "The :mod:`!sqlite3` module was written by Gerhard Häring. It provides an " -"SQL interface compliant with the DB-API 2.0 specification described by :pep:" -"`249`, and requires SQLite 3.15.2 or newer." +"SQL interface compliant with the DB-API 2.0 specification described " +"by :pep:`249`, and requires SQLite 3.15.2 or newer." msgstr "" #: ../../library/sqlite3.rst:36 @@ -128,8 +128,8 @@ msgstr "" #: ../../library/sqlite3.rst:89 msgid "" "In order to execute SQL statements and fetch results from SQL queries, we " -"will need to use a database cursor. Call :meth:`con.cursor() ` to create the :class:`Cursor`:" +"will need to use a database cursor. Call :meth:`con.cursor() " +"` to create the :class:`Cursor`:" msgstr "" #: ../../library/sqlite3.rst:93 @@ -142,8 +142,8 @@ msgid "" "database table ``movie`` with columns for title, release year, and review " "score. For simplicity, we can just use column names in the table declaration " "-- thanks to the `flexible typing`_ feature of SQLite, specifying the data " -"types is optional. Execute the ``CREATE TABLE`` statement by calling :meth:" -"`cur.execute(...) `:" +"types is optional. Execute the ``CREATE TABLE`` statement by " +"calling :meth:`cur.execute(...) `:" msgstr "" #: ../../library/sqlite3.rst:106 @@ -155,9 +155,9 @@ msgid "" "We can verify that the new table has been created by querying the " "``sqlite_master`` table built-in to SQLite, which should now contain an " "entry for the ``movie`` table definition (see `The Schema Table`_ for " -"details). Execute that query by calling :meth:`cur.execute(...) `, assign the result to ``res``, and call :meth:`res.fetchone() " -"` to fetch the resulting row:" +"details). Execute that query by calling :meth:`cur.execute(...) " +"`, assign the result to ``res``, and " +"call :meth:`res.fetchone() ` to fetch the resulting row:" msgstr "" #: ../../library/sqlite3.rst:121 @@ -172,9 +172,10 @@ msgstr "" #: ../../library/sqlite3.rst:127 msgid "" -"We can see that the table has been created, as the query returns a :class:" -"`tuple` containing the table's name. If we query ``sqlite_master`` for a non-" -"existent table ``spam``, :meth:`!res.fetchone` will return ``None``:" +"We can see that the table has been created, as the query returns " +"a :class:`tuple` containing the table's name. If we query ``sqlite_master`` " +"for a non-existent table ``spam``, :meth:`!res.fetchone` will return " +"``None``:" msgstr "" #: ../../library/sqlite3.rst:132 @@ -190,8 +191,8 @@ msgstr "" #: ../../library/sqlite3.rst:138 msgid "" "Now, add two rows of data supplied as SQL literals by executing an " -"``INSERT`` statement, once again by calling :meth:`cur.execute(...) `:" +"``INSERT`` statement, once again by calling :meth:`cur.execute(...) " +"`:" msgstr "" #: ../../library/sqlite3.rst:142 @@ -212,8 +213,8 @@ msgstr "" msgid "" "The ``INSERT`` statement implicitly opens a transaction, which needs to be " "committed before changes are saved in the database (see :ref:`sqlite3-" -"controlling-transactions` for details). Call :meth:`con.commit() ` on the connection object to commit the transaction:" +"controlling-transactions` for details). Call :meth:`con.commit() " +"` on the connection object to commit the transaction:" msgstr "" #: ../../library/sqlite3.rst:156 @@ -224,8 +225,8 @@ msgstr "con.commit()" msgid "" "We can verify that the data was inserted correctly by executing a ``SELECT`` " "query. Use the now-familiar :meth:`cur.execute(...) ` to " -"assign the result to ``res``, and call :meth:`res.fetchall() ` to return all resulting rows:" +"assign the result to ``res``, and call :meth:`res.fetchall() " +"` to return all resulting rows:" msgstr "" #: ../../library/sqlite3.rst:166 @@ -246,8 +247,8 @@ msgstr "" #: ../../library/sqlite3.rst:175 msgid "" -"Now, insert three more rows by calling :meth:`cur.executemany(...) `:" +"Now, insert three more rows by calling :meth:`cur.executemany(...) " +"`:" msgstr "" #: ../../library/sqlite3.rst:178 @@ -303,9 +304,10 @@ msgstr "" #: ../../library/sqlite3.rst:211 msgid "" -"Finally, verify that the database has been written to disk by calling :meth:" -"`con.close() ` to close the existing connection, opening a " -"new one, creating a new cursor, then querying the database:" +"Finally, verify that the database has been written to disk by " +"calling :meth:`con.close() ` to close the existing " +"connection, opening a new one, creating a new cursor, then querying the " +"database:" msgstr "" #: ../../library/sqlite3.rst:216 @@ -356,7 +358,7 @@ msgstr ":ref:`sqlite3-adapters`" msgid ":ref:`sqlite3-converters`" msgstr ":ref:`sqlite3-converters`" -#: ../../library/sqlite3.rst:244 ../../library/sqlite3.rst:615 +#: ../../library/sqlite3.rst:244 ../../library/sqlite3.rst:618 msgid ":ref:`sqlite3-connection-context-manager`" msgstr ":ref:`sqlite3-connection-context-manager`" @@ -394,9 +396,9 @@ msgstr "" #: ../../library/sqlite3.rst:277 msgid "" -"How many seconds the connection should wait before raising an :exc:" -"`OperationalError` when a table is locked. If another connection opens a " -"transaction to modify a table, that table will be locked until the " +"How many seconds the connection should wait before raising " +"an :exc:`OperationalError` when a table is locked. If another connection " +"opens a transaction to modify a table, that table will be locked until the " "transaction is committed. Default five seconds." msgstr "" @@ -405,25 +407,23 @@ msgid "" "Control whether and how data types not :ref:`natively supported by SQLite " "` are looked up to be converted to Python types, using the " "converters registered with :func:`register_converter`. Set it to any " -"combination (using ``|``, bitwise or) of :const:`PARSE_DECLTYPES` and :const:" -"`PARSE_COLNAMES` to enable this. Column names takes precedence over declared " -"types if both flags are set. Types cannot be detected for generated fields " -"(for example ``max(data)``), even when the *detect_types* parameter is set; :" -"class:`str` will be returned instead. By default (``0``), type detection is " -"disabled." +"combination (using ``|``, bitwise or) of :const:`PARSE_DECLTYPES` " +"and :const:`PARSE_COLNAMES` to enable this. Column names takes precedence " +"over declared types if both flags are set. By default (``0``), type " +"detection is disabled." msgstr "" -#: ../../library/sqlite3.rst:298 +#: ../../library/sqlite3.rst:295 msgid "" -"Control legacy transaction handling behaviour. See :attr:`Connection." -"isolation_level` and :ref:`sqlite3-transaction-control-isolation-level` for " -"more information. Can be ``\"DEFERRED\"`` (default), ``\"EXCLUSIVE\"`` or " -"``\"IMMEDIATE\"``; or ``None`` to disable opening transactions implicitly. " -"Has no effect unless :attr:`Connection.autocommit` is set to :const:" -"`~sqlite3.LEGACY_TRANSACTION_CONTROL` (the default)." +"Control legacy transaction handling behaviour. " +"See :attr:`Connection.isolation_level` and :ref:`sqlite3-transaction-control-" +"isolation-level` for more information. Can be ``\"DEFERRED\"`` (default), " +"``\"EXCLUSIVE\"`` or ``\"IMMEDIATE\"``; or ``None`` to disable opening " +"transactions implicitly. Has no effect unless :attr:`Connection.autocommit` " +"is set to :const:`~sqlite3.LEGACY_TRANSACTION_CONTROL` (the default)." msgstr "" -#: ../../library/sqlite3.rst:308 +#: ../../library/sqlite3.rst:305 msgid "" "If ``True`` (default), :exc:`ProgrammingError` will be raised if the " "database connection is used by a thread other than the one that created it. " @@ -432,19 +432,19 @@ msgid "" "See :attr:`threadsafety` for more information." msgstr "" -#: ../../library/sqlite3.rst:317 +#: ../../library/sqlite3.rst:314 msgid "" "A custom subclass of :class:`Connection` to create the connection with, if " "not the default :class:`Connection` class." msgstr "" -#: ../../library/sqlite3.rst:321 +#: ../../library/sqlite3.rst:318 msgid "" "The number of statements that :mod:`!sqlite3` should internally cache for " "this connection, to avoid parsing overhead. By default, 128 statements." msgstr "" -#: ../../library/sqlite3.rst:326 +#: ../../library/sqlite3.rst:323 msgid "" "If set to ``True``, *database* is interpreted as a :abbr:`URI (Uniform " "Resource Identifier)` with a file path and an optional query string. The " @@ -453,28 +453,28 @@ msgid "" "various :ref:`sqlite3-uri-tricks`." msgstr "" -#: ../../library/sqlite3.rst:335 +#: ../../library/sqlite3.rst:332 msgid "" -"Control :pep:`249` transaction handling behaviour. See :attr:`Connection." -"autocommit` and :ref:`sqlite3-transaction-control-autocommit` for more " -"information. *autocommit* currently defaults to :const:`~sqlite3." -"LEGACY_TRANSACTION_CONTROL`. The default will change to ``False`` in a " -"future Python release." +"Control :pep:`249` transaction handling behaviour. " +"See :attr:`Connection.autocommit` and :ref:`sqlite3-transaction-control-" +"autocommit` for more information. *autocommit* currently defaults " +"to :const:`~sqlite3.LEGACY_TRANSACTION_CONTROL`. The default will change to " +"``False`` in a future Python release." msgstr "" #: ../../library/sqlite3.rst:0 msgid "Return type" msgstr "" -#: ../../library/sqlite3.rst:346 +#: ../../library/sqlite3.rst:343 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect`` with argument " "``database``." msgstr "" -"引發一個附帶引數 ``database`` 的\\ :ref:`稽核事件 ` ``sqlite3." -"connect``。" +"引發一個附帶引數 ``database`` 的\\ :ref:`稽核事件 ` " +"``sqlite3.connect``。" -#: ../../library/sqlite3.rst:347 +#: ../../library/sqlite3.rst:344 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.connect/handle`` with " "argument ``connection_handle``." @@ -482,31 +482,31 @@ msgstr "" "引發一個附帶引數 ``connection_handle`` 的\\ :ref:`稽核事件 ` " "``sqlite3.connect/handle``。" -#: ../../library/sqlite3.rst:349 +#: ../../library/sqlite3.rst:346 msgid "Added the *uri* parameter." msgstr "新增 *uri* 參數。" -#: ../../library/sqlite3.rst:352 +#: ../../library/sqlite3.rst:349 msgid "" "*database* can now also be a :term:`path-like object`, not only a string." msgstr "" -#: ../../library/sqlite3.rst:355 +#: ../../library/sqlite3.rst:352 msgid "Added the ``sqlite3.connect/handle`` auditing event." msgstr "新增 ``sqlite3.connect/handle`` 稽核事件。" -#: ../../library/sqlite3.rst:358 +#: ../../library/sqlite3.rst:355 msgid "Added the *autocommit* parameter." msgstr "新增 *autocommit* 參數。" -#: ../../library/sqlite3.rst:361 +#: ../../library/sqlite3.rst:358 msgid "" "Positional use of the parameters *timeout*, *detect_types*, " "*isolation_level*, *check_same_thread*, *factory*, *cached_statements*, and " "*uri* is deprecated. They will become keyword-only parameters in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:369 +#: ../../library/sqlite3.rst:366 msgid "" "Return ``True`` if the string *statement* appears to contain one or more " "complete SQL statements. No syntactic verification or parsing of any kind is " @@ -514,11 +514,11 @@ msgid "" "and the statement is terminated by a semicolon." msgstr "" -#: ../../library/sqlite3.rst:375 +#: ../../library/sqlite3.rst:372 msgid "For example:" msgstr "範例:" -#: ../../library/sqlite3.rst:377 +#: ../../library/sqlite3.rst:374 msgid "" ">>> sqlite3.complete_statement(\"SELECT foo FROM bar;\")\n" "True\n" @@ -530,20 +530,20 @@ msgstr "" ">>> sqlite3.complete_statement(\"SELECT foo\")\n" "False" -#: ../../library/sqlite3.rst:384 +#: ../../library/sqlite3.rst:381 msgid "" "This function may be useful during command-line input to determine if the " "entered text seems to form a complete SQL statement, or if additional input " "is needed before calling :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:388 +#: ../../library/sqlite3.rst:385 msgid "" "See :func:`!runsource` in :source:`Lib/sqlite3/__main__.py` for real-world " "use." msgstr "" -#: ../../library/sqlite3.rst:393 +#: ../../library/sqlite3.rst:390 msgid "" "Enable or disable callback tracebacks. By default you will not get any " "tracebacks in user-defined functions, aggregates, converters, authorizer " @@ -552,14 +552,14 @@ msgid "" "on :data:`sys.stderr`. Use ``False`` to disable the feature again." msgstr "" -#: ../../library/sqlite3.rst:402 +#: ../../library/sqlite3.rst:399 msgid "" "Errors in user-defined function callbacks are logged as unraisable " "exceptions. Use an :func:`unraisable hook handler ` for " "introspection of the failed callback." msgstr "" -#: ../../library/sqlite3.rst:408 +#: ../../library/sqlite3.rst:405 msgid "" "Register an *adapter* :term:`callable` to adapt the Python type *type* into " "an SQLite type. The adapter is called with a Python object of type *type* as " @@ -567,7 +567,7 @@ msgid "" "natively understands `." msgstr "" -#: ../../library/sqlite3.rst:416 +#: ../../library/sqlite3.rst:413 msgid "" "Register the *converter* :term:`callable` to convert SQLite objects of type " "*typename* into a Python object of a specific type. The converter is invoked " @@ -577,115 +577,122 @@ msgid "" "type detection works." msgstr "" -#: ../../library/sqlite3.rst:424 +#: ../../library/sqlite3.rst:421 msgid "" "Note: *typename* and the name of the type in your query are matched case-" "insensitively." msgstr "" -#: ../../library/sqlite3.rst:431 +#: ../../library/sqlite3.rst:428 msgid "Module constants" msgstr "" -#: ../../library/sqlite3.rst:435 +#: ../../library/sqlite3.rst:432 msgid "" "Set :attr:`~Connection.autocommit` to this constant to select old style (pre-" "Python 3.12) transaction control behaviour. See :ref:`sqlite3-transaction-" "control-isolation-level` for more information." msgstr "" -#: ../../library/sqlite3.rst:441 +#: ../../library/sqlite3.rst:438 msgid "" "Pass this flag value to the *detect_types* parameter of :func:`connect` to " -"look up a converter function by using the type name, parsed from the query " -"column name, as the converter dictionary key. The type name must be wrapped " -"in square brackets (``[]``)." +"look up a converter function using the declared types for each column. The " +"types are declared when the database table is created. :mod:`!sqlite3` will " +"look up a converter function using the first word of the declared type as " +"the converter dictionary key. For example:" msgstr "" -#: ../../library/sqlite3.rst:447 +#: ../../library/sqlite3.rst:446 msgid "" -"SELECT p as \"p [point]\" FROM test; ! will look up converter \"point\"" +"CREATE TABLE test(\n" +" i integer primary key, ! will look up a converter named \"integer\"\n" +" p point, ! will look up a converter named \"point\"\n" +" n number(10) ! will look up a converter named \"number\"\n" +" )" msgstr "" -#: ../../library/sqlite3.rst:451 +#: ../../library/sqlite3.rst:454 msgid "" -"This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|`` " +"This flag may be combined with :const:`PARSE_COLNAMES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:456 +#: ../../library/sqlite3.rst:459 msgid "" -"Pass this flag value to the *detect_types* parameter of :func:`connect` to " -"look up a converter function using the declared types for each column. The " -"types are declared when the database table is created. :mod:`!sqlite3` will " -"look up a converter function using the first word of the declared type as " -"the converter dictionary key. For example:" +"Generated fields (for example ``MAX(p)``) are returned as :class:`str`. " +"Use :const:`!PARSE_COLNAMES` to enforce types for such queries." msgstr "" #: ../../library/sqlite3.rst:464 msgid "" -"CREATE TABLE test(\n" -" i integer primary key, ! will look up a converter named \"integer\"\n" -" p point, ! will look up a converter named \"point\"\n" -" n number(10) ! will look up a converter named \"number\"\n" -" )" +"Pass this flag value to the *detect_types* parameter of :func:`connect` to " +"look up a converter function by using the type name, parsed from the query " +"column name, as the converter dictionary key. The query column name must be " +"wrapped in double quotes (``\"``) and the type name must be wrapped in " +"square brackets (``[]``)." msgstr "" -#: ../../library/sqlite3.rst:472 +#: ../../library/sqlite3.rst:471 msgid "" -"This flag may be combined with :const:`PARSE_COLNAMES` using the ``|`` " +"SELECT MAX(p) as \"p [point]\" FROM test; ! will look up converter \"point\"" +msgstr "" + +#: ../../library/sqlite3.rst:475 +msgid "" +"This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:479 +#: ../../library/sqlite3.rst:482 msgid "" "Flags that should be returned by the *authorizer_callback* :term:`callable` " "passed to :meth:`Connection.set_authorizer`, to indicate whether:" msgstr "" -#: ../../library/sqlite3.rst:482 +#: ../../library/sqlite3.rst:485 msgid "Access is allowed (:const:`!SQLITE_OK`)," msgstr "" -#: ../../library/sqlite3.rst:483 +#: ../../library/sqlite3.rst:486 msgid "" "The SQL statement should be aborted with an error (:const:`!SQLITE_DENY`)" msgstr "" -#: ../../library/sqlite3.rst:484 +#: ../../library/sqlite3.rst:487 msgid "" "The column should be treated as a ``NULL`` value (:const:`!SQLITE_IGNORE`)" msgstr "" -#: ../../library/sqlite3.rst:488 +#: ../../library/sqlite3.rst:491 msgid "" "String constant stating the supported DB-API level. Required by the DB-API. " "Hard-coded to ``\"2.0\"``." msgstr "" -#: ../../library/sqlite3.rst:493 +#: ../../library/sqlite3.rst:496 msgid "" "String constant stating the type of parameter marker formatting expected by " "the :mod:`!sqlite3` module. Required by the DB-API. Hard-coded to " "``\"qmark\"``." msgstr "" -#: ../../library/sqlite3.rst:499 +#: ../../library/sqlite3.rst:502 msgid "The ``named`` DB-API parameter style is also supported." msgstr "" -#: ../../library/sqlite3.rst:503 +#: ../../library/sqlite3.rst:506 msgid "" "Version number of the runtime SQLite library as a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:507 +#: ../../library/sqlite3.rst:510 msgid "" -"Version number of the runtime SQLite library as a :class:`tuple` of :class:" -"`integers `." +"Version number of the runtime SQLite library as a :class:`tuple` " +"of :class:`integers `." msgstr "" -#: ../../library/sqlite3.rst:512 +#: ../../library/sqlite3.rst:515 msgid "" "Integer constant required by the DB-API 2.0, stating the level of thread " "safety the :mod:`!sqlite3` module supports. This attribute is set based on " @@ -693,187 +700,189 @@ msgid "" "underlying SQLite library is compiled with. The SQLite threading modes are:" msgstr "" -#: ../../library/sqlite3.rst:517 +#: ../../library/sqlite3.rst:520 msgid "" "**Single-thread**: In this mode, all mutexes are disabled and SQLite is " "unsafe to use in more than a single thread at once." msgstr "" -#: ../../library/sqlite3.rst:519 +#: ../../library/sqlite3.rst:522 msgid "" "**Multi-thread**: In this mode, SQLite can be safely used by multiple " "threads provided that no single database connection is used simultaneously " "in two or more threads." msgstr "" -#: ../../library/sqlite3.rst:522 +#: ../../library/sqlite3.rst:525 msgid "" "**Serialized**: In serialized mode, SQLite can be safely used by multiple " "threads with no restriction." msgstr "" -#: ../../library/sqlite3.rst:525 +#: ../../library/sqlite3.rst:528 msgid "" "The mappings from SQLite threading modes to DB-API 2.0 threadsafety levels " "are as follows:" msgstr "" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:532 msgid "SQLite threading mode" msgstr "SQLite 執行緒模式" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:532 msgid ":pep:`threadsafety <0249#threadsafety>`" msgstr ":pep:`執行緒安全 <0249#threadsafety>`" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:532 msgid "`SQLITE_THREADSAFE`_" msgstr "`SQLITE_THREADSAFE`_" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:532 msgid "DB-API 2.0 meaning" msgstr "" -#: ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:535 msgid "single-thread" msgstr "" -#: ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:535 msgid "0" msgstr "0" -#: ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:535 msgid "Threads may not share the module" msgstr "" -#: ../../library/sqlite3.rst:535 +#: ../../library/sqlite3.rst:538 msgid "multi-thread" msgstr "" -#: ../../library/sqlite3.rst:535 ../../library/sqlite3.rst:538 +#: ../../library/sqlite3.rst:538 ../../library/sqlite3.rst:541 msgid "1" msgstr "1" -#: ../../library/sqlite3.rst:535 +#: ../../library/sqlite3.rst:538 msgid "2" msgstr "2" -#: ../../library/sqlite3.rst:535 +#: ../../library/sqlite3.rst:538 msgid "Threads may share the module, but not connections" msgstr "" -#: ../../library/sqlite3.rst:538 +#: ../../library/sqlite3.rst:541 msgid "serialized" msgstr "" -#: ../../library/sqlite3.rst:538 +#: ../../library/sqlite3.rst:541 msgid "3" msgstr "3" -#: ../../library/sqlite3.rst:538 +#: ../../library/sqlite3.rst:541 msgid "Threads may share the module, connections and cursors" msgstr "" -#: ../../library/sqlite3.rst:544 +#: ../../library/sqlite3.rst:547 msgid "Set *threadsafety* dynamically instead of hard-coding it to ``1``." msgstr "" -#: ../../library/sqlite3.rst:549 +#: ../../library/sqlite3.rst:552 msgid "" "Version number of this module as a :class:`string `. This is not the " "version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:552 ../../library/sqlite3.rst:562 +#: ../../library/sqlite3.rst:555 ../../library/sqlite3.rst:565 msgid "" "This constant used to reflect the version number of the ``pysqlite`` " "package, a third-party library which used to upstream changes to :mod:`!" "sqlite3`. Today, it carries no meaning or practical value." msgstr "" -#: ../../library/sqlite3.rst:559 +#: ../../library/sqlite3.rst:562 msgid "" "Version number of this module as a :class:`tuple` of :class:`integers " "`. This is not the version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:586 +#: ../../library/sqlite3.rst:589 msgid "" -"These constants are used for the :meth:`Connection.setconfig` and :meth:" -"`~Connection.getconfig` methods." +"These constants are used for the :meth:`Connection.setconfig` " +"and :meth:`~Connection.getconfig` methods." msgstr "" -#: ../../library/sqlite3.rst:589 +#: ../../library/sqlite3.rst:592 msgid "" "The availability of these constants varies depending on the version of " "SQLite Python was compiled with." msgstr "" -#: ../../library/sqlite3.rst:596 +#: ../../library/sqlite3.rst:599 msgid "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" msgstr "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" -#: ../../library/sqlite3.rst:597 +#: ../../library/sqlite3.rst:600 msgid "SQLite docs: Database Connection Configuration Options" msgstr "" -#: ../../library/sqlite3.rst:603 +#: ../../library/sqlite3.rst:606 msgid "Connection objects" msgstr "Connection 物件" -#: ../../library/sqlite3.rst:607 +#: ../../library/sqlite3.rst:610 msgid "" "Each open SQLite database is represented by a ``Connection`` object, which " -"is created using :func:`sqlite3.connect`. Their main purpose is creating :" -"class:`Cursor` objects, and :ref:`sqlite3-controlling-transactions`." +"is created using :func:`sqlite3.connect`. Their main purpose is " +"creating :class:`Cursor` objects, and :ref:`sqlite3-controlling-" +"transactions`." msgstr "" -#: ../../library/sqlite3.rst:614 +#: ../../library/sqlite3.rst:617 msgid ":ref:`sqlite3-connection-shortcuts`" msgstr ":ref:`sqlite3-connection-shortcuts`" -#: ../../library/sqlite3.rst:620 +#: ../../library/sqlite3.rst:623 msgid "" -"A :exc:`ResourceWarning` is emitted if :meth:`close` is not called before a :" -"class:`!Connection` object is deleted." +"A :exc:`ResourceWarning` is emitted if :meth:`close` is not called before " +"a :class:`!Connection` object is deleted." msgstr "" -#: ../../library/sqlite3.rst:623 +#: ../../library/sqlite3.rst:626 msgid "An SQLite database connection has the following attributes and methods:" msgstr "" -#: ../../library/sqlite3.rst:627 +#: ../../library/sqlite3.rst:630 msgid "" "Create and return a :class:`Cursor` object. The cursor method accepts a " -"single optional parameter *factory*. If supplied, this must be a :term:" -"`callable` returning an instance of :class:`Cursor` or its subclasses." +"single optional parameter *factory*. If supplied, this must be " +"a :term:`callable` returning an instance of :class:`Cursor` or its " +"subclasses." msgstr "" -#: ../../library/sqlite3.rst:634 +#: ../../library/sqlite3.rst:637 msgid "" "Open a :class:`Blob` handle to an existing :abbr:`BLOB (Binary Large " "OBject)`." msgstr "" -#: ../../library/sqlite3.rst:637 +#: ../../library/sqlite3.rst:640 msgid "The name of the table where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:640 +#: ../../library/sqlite3.rst:643 msgid "The name of the column where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:643 +#: ../../library/sqlite3.rst:646 msgid "The name of the row where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:646 +#: ../../library/sqlite3.rst:649 msgid "" "Set to ``True`` if the blob should be opened without write permissions. " "Defaults to ``False``." msgstr "" -#: ../../library/sqlite3.rst:651 +#: ../../library/sqlite3.rst:654 msgid "" "The name of the database where the blob is located. Defaults to ``\"main\"``." msgstr "" @@ -882,33 +891,33 @@ msgstr "" msgid "Raises" msgstr "" -#: ../../library/sqlite3.rst:655 +#: ../../library/sqlite3.rst:658 msgid "When trying to open a blob in a ``WITHOUT ROWID`` table." msgstr "" -#: ../../library/sqlite3.rst:662 +#: ../../library/sqlite3.rst:665 msgid "" "The blob size cannot be changed using the :class:`Blob` class. Use the SQL " "function ``zeroblob`` to create a blob with a fixed size." msgstr "" -#: ../../library/sqlite3.rst:669 +#: ../../library/sqlite3.rst:672 msgid "" "Commit any pending transaction to the database. If :attr:`autocommit` is " -"``True``, or there is no open transaction, this method does nothing. If :" -"attr:`!autocommit` is ``False``, a new transaction is implicitly opened if a " -"pending transaction was committed by this method." +"``True``, or there is no open transaction, this method does nothing. " +"If :attr:`!autocommit` is ``False``, a new transaction is implicitly opened " +"if a pending transaction was committed by this method." msgstr "" -#: ../../library/sqlite3.rst:677 +#: ../../library/sqlite3.rst:680 msgid "" "Roll back to the start of any pending transaction. If :attr:`autocommit` is " -"``True``, or there is no open transaction, this method does nothing. If :" -"attr:`!autocommit` is ``False``, a new transaction is implicitly opened if a " -"pending transaction was rolled back by this method." +"``True``, or there is no open transaction, this method does nothing. " +"If :attr:`!autocommit` is ``False``, a new transaction is implicitly opened " +"if a pending transaction was rolled back by this method." msgstr "" -#: ../../library/sqlite3.rst:685 +#: ../../library/sqlite3.rst:688 msgid "" "Close the database connection. If :attr:`autocommit` is ``False``, any " "pending transaction is implicitly rolled back. If :attr:`!autocommit` is " @@ -917,63 +926,63 @@ msgid "" "losing pending changes." msgstr "" -#: ../../library/sqlite3.rst:695 +#: ../../library/sqlite3.rst:698 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.execute` on it " "with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:701 +#: ../../library/sqlite3.rst:704 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executemany` on " "it with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:707 +#: ../../library/sqlite3.rst:710 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executescript` " "on it with the given *sql_script*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:713 +#: ../../library/sqlite3.rst:716 msgid "Create or remove a user-defined SQL function." msgstr "" -#: ../../library/sqlite3.rst:715 +#: ../../library/sqlite3.rst:718 msgid "The name of the SQL function." msgstr "" -#: ../../library/sqlite3.rst:718 +#: ../../library/sqlite3.rst:721 msgid "" "The number of arguments the SQL function can accept. If ``-1``, it may take " "any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:722 +#: ../../library/sqlite3.rst:725 msgid "" "A :term:`callable` that is called when the SQL function is invoked. The " "callable must return :ref:`a type natively supported by SQLite `. Set to ``None`` to remove an existing SQL function." msgstr "" -#: ../../library/sqlite3.rst:729 +#: ../../library/sqlite3.rst:732 msgid "" "If ``True``, the created SQL function is marked as `deterministic `_, which allows SQLite to perform additional " "optimizations." msgstr "" -#: ../../library/sqlite3.rst:734 +#: ../../library/sqlite3.rst:737 msgid "Added the *deterministic* parameter." msgstr "新增 *deterministic* 參數。" -#: ../../library/sqlite3.rst:737 ../../library/sqlite3.rst:781 -#: ../../library/sqlite3.rst:849 ../../library/sqlite3.rst:1128 -#: ../../library/sqlite3.rst:1550 ../../library/sqlite3.rst:1593 +#: ../../library/sqlite3.rst:740 ../../library/sqlite3.rst:784 +#: ../../library/sqlite3.rst:852 ../../library/sqlite3.rst:1131 +#: ../../library/sqlite3.rst:1553 ../../library/sqlite3.rst:1596 msgid "Example:" msgstr "範例:" -#: ../../library/sqlite3.rst:739 +#: ../../library/sqlite3.rst:742 msgid "" ">>> import hashlib\n" ">>> def md5sum(t):\n" @@ -995,27 +1004,27 @@ msgstr "" "('acbd18db4cc2f85cedef654fccc4a4d8',)\n" ">>> con.close()" -#: ../../library/sqlite3.rst:753 +#: ../../library/sqlite3.rst:756 msgid "" "Passing *name*, *narg*, and *func* as keyword arguments is deprecated. These " "parameters will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:759 +#: ../../library/sqlite3.rst:762 msgid "Create or remove a user-defined SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:761 +#: ../../library/sqlite3.rst:764 msgid "The name of the SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:764 +#: ../../library/sqlite3.rst:767 msgid "" "The number of arguments the SQL aggregate function can accept. If ``-1``, it " "may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:768 +#: ../../library/sqlite3.rst:771 msgid "" "A class must implement the following methods: * ``step()``: Add a row to " "the aggregate. * ``finalize()``: Return the final result of the aggregate " @@ -1024,31 +1033,31 @@ msgid "" "*n_arg*. Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:769 +#: ../../library/sqlite3.rst:772 msgid "A class must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:771 +#: ../../library/sqlite3.rst:774 msgid "``step()``: Add a row to the aggregate." msgstr "" -#: ../../library/sqlite3.rst:772 ../../library/sqlite3.rst:833 +#: ../../library/sqlite3.rst:775 ../../library/sqlite3.rst:836 msgid "" "``finalize()``: Return the final result of the aggregate as :ref:`a type " "natively supported by SQLite `." msgstr "" -#: ../../library/sqlite3.rst:775 +#: ../../library/sqlite3.rst:778 msgid "" "The number of arguments that the ``step()`` method must accept is controlled " "by *n_arg*." msgstr "" -#: ../../library/sqlite3.rst:778 +#: ../../library/sqlite3.rst:781 msgid "Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:783 +#: ../../library/sqlite3.rst:786 msgid "" "class MySum:\n" " def __init__(self):\n" @@ -1090,27 +1099,27 @@ msgstr "" "\n" "con.close()" -#: ../../library/sqlite3.rst:812 +#: ../../library/sqlite3.rst:815 msgid "" "Passing *name*, *n_arg*, and *aggregate_class* as keyword arguments is " "deprecated. These parameters will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:818 +#: ../../library/sqlite3.rst:821 msgid "Create or remove a user-defined aggregate window function." msgstr "" -#: ../../library/sqlite3.rst:820 +#: ../../library/sqlite3.rst:823 msgid "The name of the SQL aggregate window function to create or remove." msgstr "" -#: ../../library/sqlite3.rst:823 +#: ../../library/sqlite3.rst:826 msgid "" "The number of arguments the SQL aggregate window function can accept. If " "``-1``, it may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:827 +#: ../../library/sqlite3.rst:830 msgid "" "A class that must implement the following methods: * ``step()``: Add a row " "to the current window. * ``value()``: Return the current value of the " @@ -1122,39 +1131,39 @@ msgid "" "function." msgstr "" -#: ../../library/sqlite3.rst:828 +#: ../../library/sqlite3.rst:831 msgid "A class that must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:830 +#: ../../library/sqlite3.rst:833 msgid "``step()``: Add a row to the current window." msgstr "" -#: ../../library/sqlite3.rst:831 +#: ../../library/sqlite3.rst:834 msgid "``value()``: Return the current value of the aggregate." msgstr "" -#: ../../library/sqlite3.rst:832 +#: ../../library/sqlite3.rst:835 msgid "``inverse()``: Remove a row from the current window." msgstr "" -#: ../../library/sqlite3.rst:836 +#: ../../library/sqlite3.rst:839 msgid "" "The number of arguments that the ``step()`` and ``value()`` methods must " "accept is controlled by *num_params*." msgstr "" -#: ../../library/sqlite3.rst:839 +#: ../../library/sqlite3.rst:842 msgid "Set to ``None`` to remove an existing SQL aggregate window function." msgstr "" -#: ../../library/sqlite3.rst:841 +#: ../../library/sqlite3.rst:844 msgid "" "If used with a version of SQLite older than 3.25.0, which does not support " "aggregate window functions." msgstr "" -#: ../../library/sqlite3.rst:851 +#: ../../library/sqlite3.rst:854 msgid "" "# Example taken from https://www.sqlite.org/windowfunctions.html#udfwinfunc\n" "class WindowSumInt:\n" @@ -1202,30 +1211,30 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:905 +#: ../../library/sqlite3.rst:908 msgid "" "Create a collation named *name* using the collating function *callable*. " "*callable* is passed two :class:`string ` arguments, and it should " "return an :class:`integer `:" msgstr "" -#: ../../library/sqlite3.rst:909 +#: ../../library/sqlite3.rst:912 msgid "``1`` if the first is ordered higher than the second" msgstr "" -#: ../../library/sqlite3.rst:910 +#: ../../library/sqlite3.rst:913 msgid "``-1`` if the first is ordered lower than the second" msgstr "" -#: ../../library/sqlite3.rst:911 +#: ../../library/sqlite3.rst:914 msgid "``0`` if they are ordered equal" msgstr "" -#: ../../library/sqlite3.rst:913 +#: ../../library/sqlite3.rst:916 msgid "The following example shows a reverse sorting collation:" msgstr "" -#: ../../library/sqlite3.rst:915 +#: ../../library/sqlite3.rst:918 msgid "" "def collate_reverse(string1, string2):\n" " if string1 == string2:\n" @@ -1263,33 +1272,33 @@ msgstr "" " print(row)\n" "con.close()" -#: ../../library/sqlite3.rst:941 +#: ../../library/sqlite3.rst:944 msgid "Remove a collation function by setting *callable* to ``None``." msgstr "" -#: ../../library/sqlite3.rst:943 +#: ../../library/sqlite3.rst:946 msgid "" "The collation name can contain any Unicode character. Earlier, only ASCII " "characters were allowed." msgstr "" -#: ../../library/sqlite3.rst:950 +#: ../../library/sqlite3.rst:953 msgid "" "Call this method from a different thread to abort any queries that might be " -"executing on the connection. Aborted queries will raise an :exc:" -"`OperationalError`." +"executing on the connection. Aborted queries will raise " +"an :exc:`OperationalError`." msgstr "" -#: ../../library/sqlite3.rst:957 +#: ../../library/sqlite3.rst:960 msgid "" "Register :term:`callable` *authorizer_callback* to be invoked for each " "attempt to access a column of a table in the database. The callback should " -"return one of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, or :const:" -"`SQLITE_IGNORE` to signal how access to the column should be handled by the " -"underlying SQLite library." +"return one of :const:`SQLITE_OK`, :const:`SQLITE_DENY`, " +"or :const:`SQLITE_IGNORE` to signal how access to the column should be " +"handled by the underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:964 +#: ../../library/sqlite3.rst:967 msgid "" "The first argument to the callback signifies what kind of operation is to be " "authorized. The second and third argument will be arguments or ``None`` " @@ -1299,7 +1308,7 @@ msgid "" "attempt or ``None`` if this access attempt is directly from input SQL code." msgstr "" -#: ../../library/sqlite3.rst:971 +#: ../../library/sqlite3.rst:974 msgid "" "Please consult the SQLite documentation about the possible values for the " "first argument and the meaning of the second and third argument depending on " @@ -1307,21 +1316,21 @@ msgid "" "module." msgstr "" -#: ../../library/sqlite3.rst:975 +#: ../../library/sqlite3.rst:978 msgid "Passing ``None`` as *authorizer_callback* will disable the authorizer." msgstr "" -#: ../../library/sqlite3.rst:977 +#: ../../library/sqlite3.rst:980 msgid "Added support for disabling the authorizer using ``None``." msgstr "" -#: ../../library/sqlite3.rst:980 +#: ../../library/sqlite3.rst:983 msgid "" "Passing *authorizer_callback* as a keyword argument is deprecated. The " "parameter will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:987 +#: ../../library/sqlite3.rst:990 msgid "" "Register :term:`callable` *progress_handler* to be invoked for every *n* " "instructions of the SQLite virtual machine. This is useful if you want to " @@ -1329,59 +1338,60 @@ msgid "" "a GUI." msgstr "" -#: ../../library/sqlite3.rst:992 +#: ../../library/sqlite3.rst:995 msgid "" "If you want to clear any previously installed progress handler, call the " "method with ``None`` for *progress_handler*." msgstr "" -#: ../../library/sqlite3.rst:995 +#: ../../library/sqlite3.rst:998 msgid "" "Returning a non-zero value from the handler function will terminate the " "currently executing query and cause it to raise a :exc:`DatabaseError` " "exception." msgstr "" -#: ../../library/sqlite3.rst:999 +#: ../../library/sqlite3.rst:1002 msgid "" "Passing *progress_handler* as a keyword argument is deprecated. The " "parameter will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:1006 +#: ../../library/sqlite3.rst:1009 msgid "" "Register :term:`callable` *trace_callback* to be invoked for each SQL " "statement that is actually executed by the SQLite backend." msgstr "" -#: ../../library/sqlite3.rst:1009 +#: ../../library/sqlite3.rst:1012 msgid "" "The only argument passed to the callback is the statement (as :class:`str`) " "that is being executed. The return value of the callback is ignored. Note " -"that the backend does not only run statements passed to the :meth:`Cursor." -"execute` methods. Other sources include the :ref:`transaction management " -"` of the :mod:`!sqlite3` module and the " -"execution of triggers defined in the current database." +"that the backend does not only run statements passed to " +"the :meth:`Cursor.execute` methods. Other sources include " +"the :ref:`transaction management ` of " +"the :mod:`!sqlite3` module and the execution of triggers defined in the " +"current database." msgstr "" -#: ../../library/sqlite3.rst:1017 +#: ../../library/sqlite3.rst:1020 msgid "Passing ``None`` as *trace_callback* will disable the trace callback." msgstr "" -#: ../../library/sqlite3.rst:1020 +#: ../../library/sqlite3.rst:1023 msgid "" "Exceptions raised in the trace callback are not propagated. As a development " "and debugging aid, use :meth:`~sqlite3.enable_callback_tracebacks` to enable " "printing tracebacks from exceptions raised in the trace callback." msgstr "" -#: ../../library/sqlite3.rst:1027 +#: ../../library/sqlite3.rst:1030 msgid "" "Passing *trace_callback* as a keyword argument is deprecated. The parameter " "will become positional-only in Python 3.15." msgstr "" -#: ../../library/sqlite3.rst:1034 +#: ../../library/sqlite3.rst:1037 msgid "" "Enable the SQLite engine to load SQLite extensions from shared libraries if " "*enabled* is ``True``; else, disallow loading SQLite extensions. SQLite " @@ -1390,16 +1400,16 @@ msgid "" "distributed with SQLite." msgstr "" -#: ../../library/sqlite3.rst:1043 +#: ../../library/sqlite3.rst:1046 msgid "" "The :mod:`!sqlite3` module is not built with loadable extension support by " "default, because some platforms (notably macOS) have SQLite libraries which " "are compiled without this feature. To get loadable extension support, you " -"must pass the :option:`--enable-loadable-sqlite-extensions` option to :" -"program:`configure`." +"must pass the :option:`--enable-loadable-sqlite-extensions` option " +"to :program:`configure`." msgstr "" -#: ../../library/sqlite3.rst:1050 +#: ../../library/sqlite3.rst:1053 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." @@ -1407,11 +1417,11 @@ msgstr "" "引發一個附帶引數 ``connection``、``enabled`` 的\\ :ref:`稽核事件 ` " "``sqlite3.enable_load_extension``。" -#: ../../library/sqlite3.rst:1054 +#: ../../library/sqlite3.rst:1057 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "加入 ``sqlite3.enable_load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1060 +#: ../../library/sqlite3.rst:1063 msgid "" "con.enable_load_extension(True)\n" "\n" @@ -1441,24 +1451,24 @@ msgid "" " print(row)" msgstr "" -#: ../../library/sqlite3.rst:1086 +#: ../../library/sqlite3.rst:1089 msgid "" "Load an SQLite extension from a shared library. Enable extension loading " "with :meth:`enable_load_extension` before calling this method." msgstr "" -#: ../../library/sqlite3.rst:1090 +#: ../../library/sqlite3.rst:1093 msgid "The path to the SQLite extension." msgstr "" -#: ../../library/sqlite3.rst:1094 +#: ../../library/sqlite3.rst:1097 msgid "" "Entry point name. If ``None`` (the default), SQLite will come up with an " "entry point name of its own; see the SQLite docs `Loading an Extension`_ for " "details." msgstr "" -#: ../../library/sqlite3.rst:1103 +#: ../../library/sqlite3.rst:1106 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." @@ -1466,29 +1476,29 @@ msgstr "" "引發一個附帶引數 ``connection``、``path`` 的\\ :ref:`稽核事件 ` " "``sqlite3.load_extension``。" -#: ../../library/sqlite3.rst:1107 +#: ../../library/sqlite3.rst:1110 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "加入 ``sqlite3.load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1110 +#: ../../library/sqlite3.rst:1113 msgid "Added the *entrypoint* parameter." msgstr "新增 *entrypoint* 參數。" -#: ../../library/sqlite3.rst:1117 +#: ../../library/sqlite3.rst:1120 msgid "" "Return an :term:`iterator` to dump the database as SQL source code. Useful " -"when saving an in-memory database for later restoration. Similar to the ``." -"dump`` command in the :program:`sqlite3` shell." +"when saving an in-memory database for later restoration. Similar to the " +"``.dump`` command in the :program:`sqlite3` shell." msgstr "" -#: ../../library/sqlite3.rst:1121 +#: ../../library/sqlite3.rst:1124 msgid "" "An optional ``LIKE`` pattern for database objects to dump, e.g. " "``prefix_%``. If ``None`` (the default), all database objects will be " "included." msgstr "" -#: ../../library/sqlite3.rst:1130 +#: ../../library/sqlite3.rst:1133 msgid "" "# Convert file example.db to SQL dump file dump.sql\n" "con = sqlite3.connect('example.db')\n" @@ -1498,35 +1508,35 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:1141 ../../library/sqlite3.rst:1215 +#: ../../library/sqlite3.rst:1144 ../../library/sqlite3.rst:1218 msgid ":ref:`sqlite3-howto-encoding`" msgstr ":ref:`sqlite3-howto-encoding`" -#: ../../library/sqlite3.rst:1143 +#: ../../library/sqlite3.rst:1146 msgid "Added the *filter* parameter." msgstr "新增 *filter* 參數。" -#: ../../library/sqlite3.rst:1148 +#: ../../library/sqlite3.rst:1151 msgid "Create a backup of an SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1150 +#: ../../library/sqlite3.rst:1153 msgid "" "Works even if the database is being accessed by other clients or " "concurrently by the same connection." msgstr "" -#: ../../library/sqlite3.rst:1153 +#: ../../library/sqlite3.rst:1156 msgid "The database connection to save the backup to." msgstr "" -#: ../../library/sqlite3.rst:1156 +#: ../../library/sqlite3.rst:1159 msgid "" "The number of pages to copy at a time. If equal to or less than ``0``, the " "entire database is copied in a single step. Defaults to ``-1``." msgstr "" -#: ../../library/sqlite3.rst:1162 +#: ../../library/sqlite3.rst:1165 msgid "" "If set to a :term:`callable`, it is invoked with three integer arguments for " "every backup iteration: the *status* of the last iteration, the *remaining* " @@ -1534,24 +1544,24 @@ msgid "" "Defaults to ``None``." msgstr "" -#: ../../library/sqlite3.rst:1171 +#: ../../library/sqlite3.rst:1174 msgid "" "The name of the database to back up. Either ``\"main\"`` (the default) for " "the main database, ``\"temp\"`` for the temporary database, or the name of a " "custom database as attached using the ``ATTACH DATABASE`` SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1178 +#: ../../library/sqlite3.rst:1181 msgid "" "The number of seconds to sleep between successive attempts to back up " "remaining pages." msgstr "" -#: ../../library/sqlite3.rst:1182 +#: ../../library/sqlite3.rst:1185 msgid "Example 1, copy an existing database into another:" msgstr "" -#: ../../library/sqlite3.rst:1184 +#: ../../library/sqlite3.rst:1187 msgid "" "def progress(status, remaining, total):\n" " print(f'Copied {total-remaining} of {total} pages...')\n" @@ -1573,11 +1583,11 @@ msgstr "" "dst.close()\n" "src.close()" -#: ../../library/sqlite3.rst:1201 +#: ../../library/sqlite3.rst:1204 msgid "Example 2, copy an existing database into a transient copy:" msgstr "" -#: ../../library/sqlite3.rst:1203 +#: ../../library/sqlite3.rst:1206 msgid "" "src = sqlite3.connect('example.db')\n" "dst = sqlite3.connect(':memory:')\n" @@ -1591,25 +1601,25 @@ msgstr "" "dst.close()\n" "src.close()" -#: ../../library/sqlite3.rst:1219 +#: ../../library/sqlite3.rst:1222 msgid "Get a connection runtime limit." msgstr "" -#: ../../library/sqlite3.rst:1221 +#: ../../library/sqlite3.rst:1224 msgid "The `SQLite limit category`_ to be queried." msgstr "" -#: ../../library/sqlite3.rst:1226 ../../library/sqlite3.rst:1263 +#: ../../library/sqlite3.rst:1229 ../../library/sqlite3.rst:1266 msgid "If *category* is not recognised by the underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:1229 +#: ../../library/sqlite3.rst:1232 msgid "" -"Example, query the maximum length of an SQL statement for :class:" -"`Connection` ``con`` (the default is 1000000000):" +"Example, query the maximum length of an SQL statement " +"for :class:`Connection` ``con`` (the default is 1000000000):" msgstr "" -#: ../../library/sqlite3.rst:1239 +#: ../../library/sqlite3.rst:1242 msgid "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" "1000000000" @@ -1617,7 +1627,7 @@ msgstr "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" "1000000000" -#: ../../library/sqlite3.rst:1249 +#: ../../library/sqlite3.rst:1252 msgid "" "Set a connection runtime limit. Attempts to increase a limit above its hard " "upper bound are silently truncated to the hard upper bound. Regardless of " @@ -1625,22 +1635,22 @@ msgid "" "returned." msgstr "" -#: ../../library/sqlite3.rst:1254 +#: ../../library/sqlite3.rst:1257 msgid "The `SQLite limit category`_ to be set." msgstr "" -#: ../../library/sqlite3.rst:1257 +#: ../../library/sqlite3.rst:1260 msgid "" "The value of the new limit. If negative, the current limit is unchanged." msgstr "" -#: ../../library/sqlite3.rst:1266 +#: ../../library/sqlite3.rst:1269 msgid "" "Example, limit the number of attached databases to 1 for :class:`Connection` " "``con`` (the default limit is 10):" msgstr "" -#: ../../library/sqlite3.rst:1269 +#: ../../library/sqlite3.rst:1272 msgid "" ">>> con.setlimit(sqlite3.SQLITE_LIMIT_ATTACHED, 1)\n" "10\n" @@ -1652,25 +1662,25 @@ msgstr "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_ATTACHED)\n" "1" -#: ../../library/sqlite3.rst:1287 +#: ../../library/sqlite3.rst:1290 msgid "Query a boolean connection configuration option." msgstr "" -#: ../../library/sqlite3.rst:1289 ../../library/sqlite3.rst:1300 +#: ../../library/sqlite3.rst:1292 ../../library/sqlite3.rst:1303 msgid "A :ref:`SQLITE_DBCONFIG code `." msgstr "" -#: ../../library/sqlite3.rst:1298 +#: ../../library/sqlite3.rst:1301 msgid "Set a boolean connection configuration option." msgstr "" -#: ../../library/sqlite3.rst:1303 +#: ../../library/sqlite3.rst:1306 msgid "" "``True`` if the configuration option should be enabled (default); ``False`` " "if it should be disabled." msgstr "" -#: ../../library/sqlite3.rst:1311 +#: ../../library/sqlite3.rst:1314 msgid "" "Serialize a database into a :class:`bytes` object. For an ordinary on-disk " "database file, the serialization is just a copy of the disk file. For an in-" @@ -1679,114 +1689,114 @@ msgid "" "backed up to disk." msgstr "" -#: ../../library/sqlite3.rst:1317 +#: ../../library/sqlite3.rst:1320 msgid "The database name to be serialized. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1325 +#: ../../library/sqlite3.rst:1328 msgid "" "This method is only available if the underlying SQLite library has the " "serialize API." msgstr "" -#: ../../library/sqlite3.rst:1333 +#: ../../library/sqlite3.rst:1336 msgid "" -"Deserialize a :meth:`serialized ` database into a :class:" -"`Connection`. This method causes the database connection to disconnect from " -"database *name*, and reopen *name* as an in-memory database based on the " -"serialization contained in *data*." +"Deserialize a :meth:`serialized ` database into " +"a :class:`Connection`. This method causes the database connection to " +"disconnect from database *name*, and reopen *name* as an in-memory database " +"based on the serialization contained in *data*." msgstr "" -#: ../../library/sqlite3.rst:1339 +#: ../../library/sqlite3.rst:1342 msgid "A serialized database." msgstr "" -#: ../../library/sqlite3.rst:1342 +#: ../../library/sqlite3.rst:1345 msgid "The database name to deserialize into. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1346 +#: ../../library/sqlite3.rst:1349 msgid "" "If the database connection is currently involved in a read transaction or a " "backup operation." msgstr "" -#: ../../library/sqlite3.rst:1350 +#: ../../library/sqlite3.rst:1353 msgid "If *data* does not contain a valid SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1353 +#: ../../library/sqlite3.rst:1356 msgid "If :func:`len(data) ` is larger than ``2**63 - 1``." msgstr "" -#: ../../library/sqlite3.rst:1358 +#: ../../library/sqlite3.rst:1361 msgid "" "This method is only available if the underlying SQLite library has the " "deserialize API." msgstr "" -#: ../../library/sqlite3.rst:1365 +#: ../../library/sqlite3.rst:1368 msgid "" "This attribute controls :pep:`249`-compliant transaction behaviour. :attr:`!" "autocommit` has three allowed values:" msgstr "" -#: ../../library/sqlite3.rst:1368 +#: ../../library/sqlite3.rst:1371 msgid "" -"``False``: Select :pep:`249`-compliant transaction behaviour, implying that :" -"mod:`!sqlite3` ensures a transaction is always open. Use :meth:`commit` and :" -"meth:`rollback` to close transactions." +"``False``: Select :pep:`249`-compliant transaction behaviour, implying " +"that :mod:`!sqlite3` ensures a transaction is always open. " +"Use :meth:`commit` and :meth:`rollback` to close transactions." msgstr "" -#: ../../library/sqlite3.rst:1372 +#: ../../library/sqlite3.rst:1375 msgid "This is the recommended value of :attr:`!autocommit`." msgstr "" -#: ../../library/sqlite3.rst:1374 +#: ../../library/sqlite3.rst:1377 msgid "" -"``True``: Use SQLite's `autocommit mode`_. :meth:`commit` and :meth:" -"`rollback` have no effect in this mode." +"``True``: Use SQLite's `autocommit mode`_. :meth:`commit` " +"and :meth:`rollback` have no effect in this mode." msgstr "" -#: ../../library/sqlite3.rst:1377 +#: ../../library/sqlite3.rst:1380 msgid "" ":data:`LEGACY_TRANSACTION_CONTROL`: Pre-Python 3.12 (non-:pep:`249`-" "compliant) transaction control. See :attr:`isolation_level` for more details." msgstr "" -#: ../../library/sqlite3.rst:1381 +#: ../../library/sqlite3.rst:1384 msgid "This is currently the default value of :attr:`!autocommit`." msgstr "" -#: ../../library/sqlite3.rst:1383 +#: ../../library/sqlite3.rst:1386 msgid "" "Changing :attr:`!autocommit` to ``False`` will open a new transaction, and " "changing it to ``True`` will commit any pending transaction." msgstr "" -#: ../../library/sqlite3.rst:1386 +#: ../../library/sqlite3.rst:1389 msgid "See :ref:`sqlite3-transaction-control-autocommit` for more details." msgstr "更多詳情請見 :ref:`sqlite3-transaction-control-autocommit`。" -#: ../../library/sqlite3.rst:1390 +#: ../../library/sqlite3.rst:1393 msgid "" -"The :attr:`isolation_level` attribute has no effect unless :attr:" -"`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." +"The :attr:`isolation_level` attribute has no effect " +"unless :attr:`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." msgstr "" -#: ../../library/sqlite3.rst:1397 +#: ../../library/sqlite3.rst:1400 msgid "" "This read-only attribute corresponds to the low-level SQLite `autocommit " "mode`_." msgstr "" -#: ../../library/sqlite3.rst:1400 +#: ../../library/sqlite3.rst:1403 msgid "" "``True`` if a transaction is active (there are uncommitted changes), " "``False`` otherwise." msgstr "" -#: ../../library/sqlite3.rst:1407 +#: ../../library/sqlite3.rst:1410 msgid "" "Controls the :ref:`legacy transaction handling mode ` of :mod:`!sqlite3`. If set to ``None``, " @@ -1796,13 +1806,13 @@ msgid "" "` is performed." msgstr "" -#: ../../library/sqlite3.rst:1415 +#: ../../library/sqlite3.rst:1418 msgid "" "If not overridden by the *isolation_level* parameter of :func:`connect`, the " "default is ``\"\"``, which is an alias for ``\"DEFERRED\"``." msgstr "" -#: ../../library/sqlite3.rst:1420 +#: ../../library/sqlite3.rst:1423 msgid "" "Using :attr:`autocommit` to control transaction handling is recommended over " "using :attr:`!isolation_level`. :attr:`!isolation_level` has no effect " @@ -1810,57 +1820,57 @@ msgid "" "default)." msgstr "" -#: ../../library/sqlite3.rst:1427 +#: ../../library/sqlite3.rst:1430 msgid "" "The initial :attr:`~Cursor.row_factory` for :class:`Cursor` objects created " -"from this connection. Assigning to this attribute does not affect the :attr:" -"`!row_factory` of existing cursors belonging to this connection, only new " -"ones. Is ``None`` by default, meaning each row is returned as a :class:" -"`tuple`." +"from this connection. Assigning to this attribute does not affect " +"the :attr:`!row_factory` of existing cursors belonging to this connection, " +"only new ones. Is ``None`` by default, meaning each row is returned as " +"a :class:`tuple`." msgstr "" -#: ../../library/sqlite3.rst:1434 ../../library/sqlite3.rst:1720 -#: ../../library/sqlite3.rst:1743 +#: ../../library/sqlite3.rst:1437 ../../library/sqlite3.rst:1723 +#: ../../library/sqlite3.rst:1746 msgid "See :ref:`sqlite3-howto-row-factory` for more details." msgstr "更多詳情請見 :ref:`sqlite3-howto-row-factory`。" -#: ../../library/sqlite3.rst:1438 +#: ../../library/sqlite3.rst:1441 msgid "" "A :term:`callable` that accepts a :class:`bytes` parameter and returns a " "text representation of it. The callable is invoked for SQLite values with " "the ``TEXT`` data type. By default, this attribute is set to :class:`str`." msgstr "" -#: ../../library/sqlite3.rst:1443 +#: ../../library/sqlite3.rst:1446 msgid "See :ref:`sqlite3-howto-encoding` for more details." msgstr "更多詳情請見 :ref:`sqlite3-howto-encoding`。" -#: ../../library/sqlite3.rst:1447 +#: ../../library/sqlite3.rst:1450 msgid "" "Return the total number of database rows that have been modified, inserted, " "or deleted since the database connection was opened." msgstr "" -#: ../../library/sqlite3.rst:1454 +#: ../../library/sqlite3.rst:1457 msgid "Cursor objects" msgstr "Cursor 物件" -#: ../../library/sqlite3.rst:1456 +#: ../../library/sqlite3.rst:1459 msgid "" "A ``Cursor`` object represents a `database cursor`_ which is used to execute " "SQL statements, and manage the context of a fetch operation. Cursors are " -"created using :meth:`Connection.cursor`, or by using any of the :ref:" -"`connection shortcut methods `." +"created using :meth:`Connection.cursor`, or by using any of " +"the :ref:`connection shortcut methods `." msgstr "" -#: ../../library/sqlite3.rst:1463 +#: ../../library/sqlite3.rst:1466 msgid "" -"Cursor objects are :term:`iterators `, meaning that if you :meth:" -"`~Cursor.execute` a ``SELECT`` query, you can simply iterate over the cursor " -"to fetch the resulting rows:" +"Cursor objects are :term:`iterators `, meaning that if " +"you :meth:`~Cursor.execute` a ``SELECT`` query, you can simply iterate over " +"the cursor to fetch the resulting rows:" msgstr "" -#: ../../library/sqlite3.rst:1474 +#: ../../library/sqlite3.rst:1477 msgid "" "for row in cur.execute(\"SELECT t FROM data\"):\n" " print(row)" @@ -1868,78 +1878,79 @@ msgstr "" "for row in cur.execute(\"SELECT t FROM data\"):\n" " print(row)" -#: ../../library/sqlite3.rst:1488 +#: ../../library/sqlite3.rst:1491 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr "" -#: ../../library/sqlite3.rst:1495 +#: ../../library/sqlite3.rst:1498 msgid "" -"Execute a single SQL statement, optionally binding Python values using :ref:" -"`placeholders `." +"Execute a single SQL statement, optionally binding Python values " +"using :ref:`placeholders `." msgstr "" -#: ../../library/sqlite3.rst:1499 +#: ../../library/sqlite3.rst:1502 msgid "A single SQL statement." msgstr "單一個 SQL 陳述式。" -#: ../../library/sqlite3.rst:1502 +#: ../../library/sqlite3.rst:1505 msgid "" "Python values to bind to placeholders in *sql*. A :class:`!dict` if named " "placeholders are used. A :term:`!sequence` if unnamed placeholders are used. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1509 +#: ../../library/sqlite3.rst:1512 msgid "If *sql* contains more than one SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1512 +#: ../../library/sqlite3.rst:1515 msgid "" -"If :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`, :" -"attr:`~Connection.isolation_level` is not ``None``, *sql* is an ``INSERT``, " -"``UPDATE``, ``DELETE``, or ``REPLACE`` statement, and there is no open " -"transaction, a transaction is implicitly opened before executing *sql*." +"If :attr:`~Connection.autocommit` " +"is :data:`LEGACY_TRANSACTION_CONTROL`, :attr:`~Connection.isolation_level` " +"is not ``None``, *sql* is an ``INSERT``, ``UPDATE``, ``DELETE``, or " +"``REPLACE`` statement, and there is no open transaction, a transaction is " +"implicitly opened before executing *sql*." msgstr "" -#: ../../library/sqlite3.rst:1521 +#: ../../library/sqlite3.rst:1524 msgid "" ":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and *parameters* is a sequence instead of a :class:" -"`dict`. Starting with Python 3.14, :exc:`ProgrammingError` will be raised " -"instead." +"placeholders>` are used and *parameters* is a sequence instead of " +"a :class:`dict`. Starting with Python 3.14, :exc:`ProgrammingError` will be " +"raised instead." msgstr "" -#: ../../library/sqlite3.rst:1527 +#: ../../library/sqlite3.rst:1530 msgid "Use :meth:`executescript` to execute multiple SQL statements." msgstr "" -#: ../../library/sqlite3.rst:1531 +#: ../../library/sqlite3.rst:1534 msgid "" "For every item in *parameters*, repeatedly execute the :ref:`parameterized " "` :abbr:`DML (Data Manipulation Language)` SQL " "statement *sql*." msgstr "" -#: ../../library/sqlite3.rst:1535 +#: ../../library/sqlite3.rst:1538 msgid "Uses the same implicit transaction handling as :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:1537 +#: ../../library/sqlite3.rst:1540 msgid "A single SQL DML statement." msgstr "" -#: ../../library/sqlite3.rst:1540 +#: ../../library/sqlite3.rst:1543 msgid "" "An :term:`!iterable` of parameters to bind with the placeholders in *sql*. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1546 +#: ../../library/sqlite3.rst:1549 msgid "" "If *sql* contains more than one SQL statement, or is not a DML statement." msgstr "" -#: ../../library/sqlite3.rst:1552 +#: ../../library/sqlite3.rst:1555 msgid "" "rows = [\n" " (\"row1\",),\n" @@ -1955,13 +1966,13 @@ msgstr "" "# cur 是一個 sqlite3.Cursor 物件\n" "cur.executemany(\"INSERT INTO data VALUES(?)\", rows)" -#: ../../library/sqlite3.rst:1567 +#: ../../library/sqlite3.rst:1570 msgid "" "Any resulting rows are discarded, including DML statements with `RETURNING " "clauses`_." msgstr "" -#: ../../library/sqlite3.rst:1574 +#: ../../library/sqlite3.rst:1577 msgid "" ":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and the items in *parameters* are sequences instead " @@ -1969,20 +1980,20 @@ msgid "" "be raised instead." msgstr "" -#: ../../library/sqlite3.rst:1583 +#: ../../library/sqlite3.rst:1586 msgid "" -"Execute the SQL statements in *sql_script*. If the :attr:`~Connection." -"autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and there is a pending " -"transaction, an implicit ``COMMIT`` statement is executed first. No other " -"implicit transaction control is performed; any transaction control must be " -"added to *sql_script*." +"Execute the SQL statements in *sql_script*. If " +"the :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and " +"there is a pending transaction, an implicit ``COMMIT`` statement is executed " +"first. No other implicit transaction control is performed; any transaction " +"control must be added to *sql_script*." msgstr "" -#: ../../library/sqlite3.rst:1591 +#: ../../library/sqlite3.rst:1594 msgid "*sql_script* must be a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:1595 +#: ../../library/sqlite3.rst:1598 msgid "" "# cur is an sqlite3.Cursor object\n" "cur.executescript(\"\"\"\n" @@ -2002,20 +2013,20 @@ msgstr "" " COMMIT;\n" "\"\"\")" -#: ../../library/sqlite3.rst:1608 +#: ../../library/sqlite3.rst:1611 msgid "" "If :attr:`~Cursor.row_factory` is ``None``, return the next row query result " "set as a :class:`tuple`. Else, pass it to the row factory and return its " "result. Return ``None`` if no more data is available." msgstr "" -#: ../../library/sqlite3.rst:1616 +#: ../../library/sqlite3.rst:1619 msgid "" "Return the next set of rows of a query result as a :class:`list`. Return an " "empty list if no more rows are available." msgstr "" -#: ../../library/sqlite3.rst:1619 +#: ../../library/sqlite3.rst:1622 msgid "" "The number of rows to fetch per call is specified by the *size* parameter. " "If *size* is not given, :attr:`arraysize` determines the number of rows to " @@ -2023,7 +2034,7 @@ msgid "" "available are returned." msgstr "" -#: ../../library/sqlite3.rst:1625 +#: ../../library/sqlite3.rst:1628 msgid "" "Note there are performance considerations involved with the *size* " "parameter. For optimal performance, it is usually best to use the arraysize " @@ -2031,44 +2042,44 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:1632 +#: ../../library/sqlite3.rst:1635 msgid "" "Return all (remaining) rows of a query result as a :class:`list`. Return an " "empty list if no rows are available. Note that the :attr:`arraysize` " "attribute can affect the performance of this operation." msgstr "" -#: ../../library/sqlite3.rst:1639 +#: ../../library/sqlite3.rst:1642 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:1641 +#: ../../library/sqlite3.rst:1644 msgid "" -"The cursor will be unusable from this point forward; a :exc:" -"`ProgrammingError` exception will be raised if any operation is attempted " -"with the cursor." +"The cursor will be unusable from this point forward; " +"a :exc:`ProgrammingError` exception will be raised if any operation is " +"attempted with the cursor." msgstr "" -#: ../../library/sqlite3.rst:1646 ../../library/sqlite3.rst:1650 +#: ../../library/sqlite3.rst:1649 ../../library/sqlite3.rst:1653 msgid "Required by the DB-API. Does nothing in :mod:`!sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:1654 +#: ../../library/sqlite3.rst:1657 msgid "" -"Read/write attribute that controls the number of rows returned by :meth:" -"`fetchmany`. The default value is 1 which means a single row would be " -"fetched per call." +"Read/write attribute that controls the number of rows returned " +"by :meth:`fetchmany`. The default value is 1 which means a single row would " +"be fetched per call." msgstr "" -#: ../../library/sqlite3.rst:1659 +#: ../../library/sqlite3.rst:1662 msgid "" "Read-only attribute that provides the SQLite database :class:`Connection` " -"belonging to the cursor. A :class:`Cursor` object created by calling :meth:" -"`con.cursor() ` will have a :attr:`connection` attribute " -"that refers to *con*:" +"belonging to the cursor. A :class:`Cursor` object created by " +"calling :meth:`con.cursor() ` will have " +"a :attr:`connection` attribute that refers to *con*:" msgstr "" -#: ../../library/sqlite3.rst:1664 +#: ../../library/sqlite3.rst:1667 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> cur = con.cursor()\n" @@ -2082,18 +2093,18 @@ msgstr "" "True\n" ">>> con.close()" -#: ../../library/sqlite3.rst:1674 +#: ../../library/sqlite3.rst:1677 msgid "" "Read-only attribute that provides the column names of the last query. To " "remain compatible with the Python DB API, it returns a 7-tuple for each " "column where the last six items of each tuple are ``None``." msgstr "" -#: ../../library/sqlite3.rst:1678 +#: ../../library/sqlite3.rst:1681 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: ../../library/sqlite3.rst:1682 +#: ../../library/sqlite3.rst:1685 msgid "" "Read-only attribute that provides the row id of the last inserted row. It is " "only updated after successful ``INSERT`` or ``REPLACE`` statements using " @@ -2103,15 +2114,15 @@ msgid "" "``None``." msgstr "" -#: ../../library/sqlite3.rst:1690 +#: ../../library/sqlite3.rst:1693 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: ../../library/sqlite3.rst:1692 +#: ../../library/sqlite3.rst:1695 msgid "Added support for the ``REPLACE`` statement." msgstr "新增 ``REPLACE`` 陳述式的支援。" -#: ../../library/sqlite3.rst:1697 +#: ../../library/sqlite3.rst:1700 msgid "" "Read-only attribute that provides the number of modified rows for " "``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " @@ -2121,7 +2132,7 @@ msgid "" "resulting rows must be fetched in order for :attr:`!rowcount` to be updated." msgstr "" -#: ../../library/sqlite3.rst:1708 +#: ../../library/sqlite3.rst:1711 msgid "" "Control how a row fetched from this :class:`!Cursor` is represented. If " "``None``, a row is represented as a :class:`tuple`. Can be set to the " @@ -2130,61 +2141,61 @@ msgid "" "and returns a custom object representing an SQLite row." msgstr "" -#: ../../library/sqlite3.rst:1715 +#: ../../library/sqlite3.rst:1718 msgid "" "Defaults to what :attr:`Connection.row_factory` was set to when the :class:`!" -"Cursor` was created. Assigning to this attribute does not affect :attr:" -"`Connection.row_factory` of the parent connection." +"Cursor` was created. Assigning to this attribute does not " +"affect :attr:`Connection.row_factory` of the parent connection." msgstr "" -#: ../../library/sqlite3.rst:1731 +#: ../../library/sqlite3.rst:1734 msgid "Row objects" msgstr "Row 物件" -#: ../../library/sqlite3.rst:1735 +#: ../../library/sqlite3.rst:1738 msgid "" -"A :class:`!Row` instance serves as a highly optimized :attr:`~Connection." -"row_factory` for :class:`Connection` objects. It supports iteration, " -"equality testing, :func:`len`, and :term:`mapping` access by column name and " -"index." +"A :class:`!Row` instance serves as a highly " +"optimized :attr:`~Connection.row_factory` for :class:`Connection` objects. " +"It supports iteration, equality testing, :func:`len`, and :term:`mapping` " +"access by column name and index." msgstr "" -#: ../../library/sqlite3.rst:1740 +#: ../../library/sqlite3.rst:1743 msgid "" "Two :class:`!Row` objects compare equal if they have identical column names " "and values." msgstr "" -#: ../../library/sqlite3.rst:1747 +#: ../../library/sqlite3.rst:1750 msgid "" "Return a :class:`list` of column names as :class:`strings `. " -"Immediately after a query, it is the first member of each tuple in :attr:" -"`Cursor.description`." +"Immediately after a query, it is the first member of each tuple " +"in :attr:`Cursor.description`." msgstr "" -#: ../../library/sqlite3.rst:1751 +#: ../../library/sqlite3.rst:1754 msgid "Added support of slicing." msgstr "新增對切片的支援。" -#: ../../library/sqlite3.rst:1758 +#: ../../library/sqlite3.rst:1761 msgid "Blob objects" msgstr "Blob 物件" -#: ../../library/sqlite3.rst:1764 +#: ../../library/sqlite3.rst:1767 msgid "" "A :class:`Blob` instance is a :term:`file-like object` that can read and " -"write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. Call :func:" -"`len(blob) ` to get the size (number of bytes) of the blob. Use indices " -"and :term:`slices ` for direct access to the blob data." +"write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. " +"Call :func:`len(blob) ` to get the size (number of bytes) of the blob. " +"Use indices and :term:`slices ` for direct access to the blob data." msgstr "" -#: ../../library/sqlite3.rst:1769 +#: ../../library/sqlite3.rst:1772 msgid "" "Use the :class:`Blob` as a :term:`context manager` to ensure that the blob " "handle is closed after use." msgstr "" -#: ../../library/sqlite3.rst:1772 +#: ../../library/sqlite3.rst:1775 msgid "" "con = sqlite3.connect(\":memory:\")\n" "con.execute(\"CREATE TABLE test(blob_col blob)\")\n" @@ -2206,37 +2217,37 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:1800 +#: ../../library/sqlite3.rst:1803 msgid "Close the blob." msgstr "" -#: ../../library/sqlite3.rst:1802 +#: ../../library/sqlite3.rst:1805 msgid "" -"The blob will be unusable from this point onward. An :class:`~sqlite3." -"Error` (or subclass) exception will be raised if any further operation is " -"attempted with the blob." +"The blob will be unusable from this point onward. " +"An :class:`~sqlite3.Error` (or subclass) exception will be raised if any " +"further operation is attempted with the blob." msgstr "" -#: ../../library/sqlite3.rst:1808 +#: ../../library/sqlite3.rst:1811 msgid "" "Read *length* bytes of data from the blob at the current offset position. If " "the end of the blob is reached, the data up to :abbr:`EOF (End of File)` " -"will be returned. When *length* is not specified, or is negative, :meth:" -"`~Blob.read` will read until the end of the blob." +"will be returned. When *length* is not specified, or is " +"negative, :meth:`~Blob.read` will read until the end of the blob." msgstr "" -#: ../../library/sqlite3.rst:1816 +#: ../../library/sqlite3.rst:1819 msgid "" "Write *data* to the blob at the current offset. This function cannot change " -"the blob length. Writing beyond the end of the blob will raise :exc:" -"`ValueError`." +"the blob length. Writing beyond the end of the blob will " +"raise :exc:`ValueError`." msgstr "" -#: ../../library/sqlite3.rst:1822 +#: ../../library/sqlite3.rst:1825 msgid "Return the current access position of the blob." msgstr "" -#: ../../library/sqlite3.rst:1826 +#: ../../library/sqlite3.rst:1829 msgid "" "Set the current access position of the blob to *offset*. The *origin* " "argument defaults to :const:`os.SEEK_SET` (absolute blob positioning). Other " @@ -2244,26 +2255,26 @@ msgid "" "position) and :const:`os.SEEK_END` (seek relative to the blob’s end)." msgstr "" -#: ../../library/sqlite3.rst:1834 +#: ../../library/sqlite3.rst:1837 msgid "PrepareProtocol objects" msgstr "PrepareProtocol 物件" -#: ../../library/sqlite3.rst:1838 +#: ../../library/sqlite3.rst:1841 msgid "" "The PrepareProtocol type's single purpose is to act as a :pep:`246` style " "adaption protocol for objects that can :ref:`adapt themselves ` to :ref:`native SQLite types `." msgstr "" -#: ../../library/sqlite3.rst:1846 +#: ../../library/sqlite3.rst:1849 msgid "Exceptions" msgstr "例外" -#: ../../library/sqlite3.rst:1848 +#: ../../library/sqlite3.rst:1851 msgid "The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`)." msgstr "" -#: ../../library/sqlite3.rst:1852 +#: ../../library/sqlite3.rst:1855 msgid "" "This exception is not currently raised by the :mod:`!sqlite3` module, but " "may be raised by applications using :mod:`!sqlite3`, for example if a user-" @@ -2271,39 +2282,39 @@ msgid "" "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1859 +#: ../../library/sqlite3.rst:1862 msgid "" "The base class of the other exceptions in this module. Use this to catch all " "errors with one single :keyword:`except` statement. ``Error`` is a subclass " "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1863 +#: ../../library/sqlite3.rst:1866 msgid "" "If the exception originated from within the SQLite library, the following " "two attributes are added to the exception:" msgstr "" -#: ../../library/sqlite3.rst:1868 +#: ../../library/sqlite3.rst:1871 msgid "" -"The numeric error code from the `SQLite API `_" +"The numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1875 +#: ../../library/sqlite3.rst:1878 msgid "" "The symbolic name of the numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1882 +#: ../../library/sqlite3.rst:1885 msgid "" "Exception raised for misuse of the low-level SQLite C API. In other words, " "if this exception is raised, it probably indicates a bug in the :mod:`!" "sqlite3` module. ``InterfaceError`` is a subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1889 +#: ../../library/sqlite3.rst:1892 msgid "" "Exception raised for errors that are related to the database. This serves as " "the base exception for several types of database errors. It is only raised " @@ -2311,14 +2322,14 @@ msgid "" "subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1896 +#: ../../library/sqlite3.rst:1899 msgid "" "Exception raised for errors caused by problems with the processed data, like " "numeric values out of range, and strings which are too long. ``DataError`` " "is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1902 +#: ../../library/sqlite3.rst:1905 msgid "" "Exception raised for errors that are related to the database's operation, " "and not necessarily under the control of the programmer. For example, the " @@ -2326,28 +2337,28 @@ msgid "" "``OperationalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1910 +#: ../../library/sqlite3.rst:1913 msgid "" "Exception raised when the relational integrity of the database is affected, " "e.g. a foreign key check fails. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1915 +#: ../../library/sqlite3.rst:1918 msgid "" "Exception raised when SQLite encounters an internal error. If this is " "raised, it may indicate that there is a problem with the runtime SQLite " "library. ``InternalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1922 +#: ../../library/sqlite3.rst:1925 msgid "" "Exception raised for :mod:`!sqlite3` API programming errors, for example " "supplying the wrong number of bindings to a query, or trying to operate on a " -"closed :class:`Connection`. ``ProgrammingError`` is a subclass of :exc:" -"`DatabaseError`." +"closed :class:`Connection`. ``ProgrammingError`` is a subclass " +"of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1929 +#: ../../library/sqlite3.rst:1932 msgid "" "Exception raised in case a method or database API is not supported by the " "underlying SQLite library. For example, setting *deterministic* to ``True`` " @@ -2356,78 +2367,78 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1939 +#: ../../library/sqlite3.rst:1942 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:1941 +#: ../../library/sqlite3.rst:1944 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:1944 +#: ../../library/sqlite3.rst:1947 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:1947 ../../library/sqlite3.rst:1964 +#: ../../library/sqlite3.rst:1950 ../../library/sqlite3.rst:1967 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:1947 ../../library/sqlite3.rst:1964 +#: ../../library/sqlite3.rst:1950 ../../library/sqlite3.rst:1967 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:1949 ../../library/sqlite3.rst:1966 +#: ../../library/sqlite3.rst:1952 ../../library/sqlite3.rst:1969 msgid "``None``" msgstr "``None``" -#: ../../library/sqlite3.rst:1949 ../../library/sqlite3.rst:1966 +#: ../../library/sqlite3.rst:1952 ../../library/sqlite3.rst:1969 msgid "``NULL``" msgstr "``NULL``" -#: ../../library/sqlite3.rst:1951 ../../library/sqlite3.rst:1968 +#: ../../library/sqlite3.rst:1954 ../../library/sqlite3.rst:1971 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../library/sqlite3.rst:1951 ../../library/sqlite3.rst:1968 +#: ../../library/sqlite3.rst:1954 ../../library/sqlite3.rst:1971 msgid "``INTEGER``" msgstr "``INTEGER``" -#: ../../library/sqlite3.rst:1953 ../../library/sqlite3.rst:1970 +#: ../../library/sqlite3.rst:1956 ../../library/sqlite3.rst:1973 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/sqlite3.rst:1953 ../../library/sqlite3.rst:1970 +#: ../../library/sqlite3.rst:1956 ../../library/sqlite3.rst:1973 msgid "``REAL``" msgstr "``REAL``" -#: ../../library/sqlite3.rst:1955 +#: ../../library/sqlite3.rst:1958 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/sqlite3.rst:1955 ../../library/sqlite3.rst:1972 +#: ../../library/sqlite3.rst:1958 ../../library/sqlite3.rst:1975 msgid "``TEXT``" msgstr "``TEXT``" -#: ../../library/sqlite3.rst:1957 ../../library/sqlite3.rst:1975 +#: ../../library/sqlite3.rst:1960 ../../library/sqlite3.rst:1978 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../library/sqlite3.rst:1957 ../../library/sqlite3.rst:1975 +#: ../../library/sqlite3.rst:1960 ../../library/sqlite3.rst:1978 msgid "``BLOB``" msgstr "``BLOB``" -#: ../../library/sqlite3.rst:1961 +#: ../../library/sqlite3.rst:1964 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:1972 +#: ../../library/sqlite3.rst:1975 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:1978 +#: ../../library/sqlite3.rst:1981 msgid "" "The type system of the :mod:`!sqlite3` module is extensible in two ways: you " "can store additional Python types in an SQLite database via :ref:`object " @@ -2436,47 +2447,47 @@ msgid "" "converters>`." msgstr "" -#: ../../library/sqlite3.rst:1988 +#: ../../library/sqlite3.rst:1991 msgid "Default adapters and converters (deprecated)" msgstr "" -#: ../../library/sqlite3.rst:1992 +#: ../../library/sqlite3.rst:1995 msgid "" "The default adapters and converters are deprecated as of Python 3.12. " "Instead, use the :ref:`sqlite3-adapter-converter-recipes` and tailor them to " "your needs." msgstr "" -#: ../../library/sqlite3.rst:1996 +#: ../../library/sqlite3.rst:1999 msgid "The deprecated default adapters and converters consist of:" msgstr "" -#: ../../library/sqlite3.rst:1998 +#: ../../library/sqlite3.rst:2001 msgid "" "An adapter for :class:`datetime.date` objects to :class:`strings ` in " "`ISO 8601`_ format." msgstr "" -#: ../../library/sqlite3.rst:2000 +#: ../../library/sqlite3.rst:2003 msgid "" "An adapter for :class:`datetime.datetime` objects to strings in ISO 8601 " "format." msgstr "" -#: ../../library/sqlite3.rst:2002 +#: ../../library/sqlite3.rst:2005 msgid "" -"A converter for :ref:`declared ` \"date\" types to :" -"class:`datetime.date` objects." +"A converter for :ref:`declared ` \"date\" types " +"to :class:`datetime.date` objects." msgstr "" -#: ../../library/sqlite3.rst:2004 +#: ../../library/sqlite3.rst:2007 msgid "" "A converter for declared \"timestamp\" types to :class:`datetime.datetime` " "objects. Fractional parts will be truncated to 6 digits (microsecond " "precision)." msgstr "" -#: ../../library/sqlite3.rst:2010 +#: ../../library/sqlite3.rst:2013 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -2484,42 +2495,42 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:2023 +#: ../../library/sqlite3.rst:2026 msgid "Command-line interface" msgstr "命令列介面" -#: ../../library/sqlite3.rst:2025 +#: ../../library/sqlite3.rst:2028 msgid "" "The :mod:`!sqlite3` module can be invoked as a script, using the " "interpreter's :option:`-m` switch, in order to provide a simple SQLite " "shell. The argument signature is as follows::" msgstr "" -#: ../../library/sqlite3.rst:2030 +#: ../../library/sqlite3.rst:2033 msgid "python -m sqlite3 [-h] [-v] [filename] [sql]" msgstr "python -m sqlite3 [-h] [-v] [filename] [sql]" -#: ../../library/sqlite3.rst:2032 +#: ../../library/sqlite3.rst:2035 msgid "Type ``.quit`` or CTRL-D to exit the shell." msgstr "" -#: ../../library/sqlite3.rst:2038 +#: ../../library/sqlite3.rst:2041 msgid "Print CLI help." msgstr "" -#: ../../library/sqlite3.rst:2042 +#: ../../library/sqlite3.rst:2045 msgid "Print underlying SQLite library version." msgstr "" -#: ../../library/sqlite3.rst:2050 +#: ../../library/sqlite3.rst:2053 msgid "How-to guides" msgstr "" -#: ../../library/sqlite3.rst:2055 +#: ../../library/sqlite3.rst:2058 msgid "How to use placeholders to bind values in SQL queries" msgstr "" -#: ../../library/sqlite3.rst:2057 +#: ../../library/sqlite3.rst:2060 msgid "" "SQL operations usually need to use values from Python variables. However, " "beware of using Python's string operations to assemble queries, as they are " @@ -2527,7 +2538,7 @@ msgid "" "close the single quote and inject ``OR TRUE`` to select all rows::" msgstr "" -#: ../../library/sqlite3.rst:2062 +#: ../../library/sqlite3.rst:2065 msgid "" ">>> # Never do this -- insecure!\n" ">>> symbol = input()\n" @@ -2538,7 +2549,7 @@ msgid "" ">>> cur.execute(sql)" msgstr "" -#: ../../library/sqlite3.rst:2070 +#: ../../library/sqlite3.rst:2073 msgid "" "Instead, use the DB-API's parameter substitution. To insert a variable into " "a query string, use a placeholder in the string, and substitute the actual " @@ -2546,7 +2557,7 @@ msgid "" "second argument of the cursor's :meth:`~Cursor.execute` method." msgstr "" -#: ../../library/sqlite3.rst:2075 +#: ../../library/sqlite3.rst:2078 msgid "" "An SQL statement may use one of two kinds of placeholders: question marks " "(qmark style) or named placeholders (named style). For the qmark style, " @@ -2557,7 +2568,7 @@ msgid "" "ignored. Here's an example of both styles:" msgstr "" -#: ../../library/sqlite3.rst:2086 +#: ../../library/sqlite3.rst:2089 msgid "" "con = sqlite3.connect(\":memory:\")\n" "cur = con.execute(\"CREATE TABLE lang(name, first_appeared)\")\n" @@ -2578,24 +2589,24 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2113 +#: ../../library/sqlite3.rst:2116 msgid "" ":pep:`249` numeric placeholders are *not* supported. If used, they will be " "interpreted as named placeholders." msgstr "" -#: ../../library/sqlite3.rst:2120 +#: ../../library/sqlite3.rst:2123 msgid "How to adapt custom Python types to SQLite values" msgstr "" -#: ../../library/sqlite3.rst:2122 +#: ../../library/sqlite3.rst:2125 msgid "" "SQLite supports only a limited set of data types natively. To store custom " "Python types in SQLite databases, *adapt* them to one of the :ref:`Python " "types SQLite natively understands `." msgstr "" -#: ../../library/sqlite3.rst:2126 +#: ../../library/sqlite3.rst:2129 msgid "" "There are two ways to adapt Python objects to SQLite types: letting your " "object adapt itself, or using an *adapter callable*. The latter will take " @@ -2605,11 +2616,11 @@ msgid "" "custom adapter functions." msgstr "" -#: ../../library/sqlite3.rst:2138 +#: ../../library/sqlite3.rst:2141 msgid "How to write adaptable objects" msgstr "" -#: ../../library/sqlite3.rst:2140 +#: ../../library/sqlite3.rst:2143 msgid "" "Suppose we have a :class:`!Point` class that represents a pair of " "coordinates, ``x`` and ``y``, in a Cartesian coordinate system. The " @@ -2619,7 +2630,7 @@ msgid "" "object passed to *protocol* will be of type :class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:2148 +#: ../../library/sqlite3.rst:2151 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2651,18 +2662,18 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2172 +#: ../../library/sqlite3.rst:2175 msgid "How to register adapter callables" msgstr "" -#: ../../library/sqlite3.rst:2174 +#: ../../library/sqlite3.rst:2177 msgid "" "The other possibility is to create a function that converts the Python " "object to an SQLite-compatible type. This function can then be registered " "using :func:`register_adapter`." msgstr "" -#: ../../library/sqlite3.rst:2178 +#: ../../library/sqlite3.rst:2181 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2696,36 +2707,36 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2205 +#: ../../library/sqlite3.rst:2208 msgid "How to convert SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:2207 +#: ../../library/sqlite3.rst:2210 msgid "" "Writing an adapter lets you convert *from* custom Python types *to* SQLite " "values. To be able to convert *from* SQLite values *to* custom Python types, " "we use *converters*." msgstr "" -#: ../../library/sqlite3.rst:2212 +#: ../../library/sqlite3.rst:2215 msgid "" "Let's go back to the :class:`!Point` class. We stored the x and y " "coordinates separated via semicolons as strings in SQLite." msgstr "" -#: ../../library/sqlite3.rst:2215 +#: ../../library/sqlite3.rst:2218 msgid "" "First, we'll define a converter function that accepts the string as a " "parameter and constructs a :class:`!Point` object from it." msgstr "" -#: ../../library/sqlite3.rst:2220 +#: ../../library/sqlite3.rst:2223 msgid "" "Converter functions are **always** passed a :class:`bytes` object, no matter " "the underlying SQLite data type." msgstr "" -#: ../../library/sqlite3.rst:2223 +#: ../../library/sqlite3.rst:2226 msgid "" "def convert_point(s):\n" " x, y = map(float, s.split(b\";\"))\n" @@ -2735,32 +2746,32 @@ msgstr "" " x, y = map(float, s.split(b\";\"))\n" " return Point(x, y)" -#: ../../library/sqlite3.rst:2229 +#: ../../library/sqlite3.rst:2232 msgid "" "We now need to tell :mod:`!sqlite3` when it should convert a given SQLite " "value. This is done when connecting to a database, using the *detect_types* " "parameter of :func:`connect`. There are three options:" msgstr "" -#: ../../library/sqlite3.rst:2233 +#: ../../library/sqlite3.rst:2236 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" msgstr "" -#: ../../library/sqlite3.rst:2234 +#: ../../library/sqlite3.rst:2237 msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`" msgstr "" -#: ../../library/sqlite3.rst:2235 +#: ../../library/sqlite3.rst:2238 msgid "" -"Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." -"PARSE_COLNAMES``. Column names take precedence over declared types." +"Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | " +"sqlite3.PARSE_COLNAMES``. Column names take precedence over declared types." msgstr "" -#: ../../library/sqlite3.rst:2239 +#: ../../library/sqlite3.rst:2242 msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" -#: ../../library/sqlite3.rst:2241 +#: ../../library/sqlite3.rst:2244 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2802,15 +2813,15 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2292 +#: ../../library/sqlite3.rst:2295 msgid "Adapter and converter recipes" msgstr "" -#: ../../library/sqlite3.rst:2294 +#: ../../library/sqlite3.rst:2297 msgid "This section shows recipes for common adapters and converters." msgstr "" -#: ../../library/sqlite3.rst:2296 +#: ../../library/sqlite3.rst:2299 msgid "" "import datetime\n" "import sqlite3\n" @@ -2848,23 +2859,23 @@ msgid "" "sqlite3.register_converter(\"timestamp\", convert_timestamp)" msgstr "" -#: ../../library/sqlite3.rst:2356 +#: ../../library/sqlite3.rst:2359 msgid "How to use connection shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:2358 +#: ../../library/sqlite3.rst:2361 msgid "" -"Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :" -"meth:`~Connection.executescript` methods of the :class:`Connection` class, " -"your code can be written more concisely because you don't have to create the " -"(often superfluous) :class:`Cursor` objects explicitly. Instead, the :class:" -"`Cursor` objects are created implicitly and these shortcut methods return " -"the cursor objects. This way, you can execute a ``SELECT`` statement and " -"iterate over it directly using only a single call on the :class:`Connection` " -"object." +"Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, " +"and :meth:`~Connection.executescript` methods of the :class:`Connection` " +"class, your code can be written more concisely because you don't have to " +"create the (often superfluous) :class:`Cursor` objects explicitly. Instead, " +"the :class:`Cursor` objects are created implicitly and these shortcut " +"methods return the cursor objects. This way, you can execute a ``SELECT`` " +"statement and iterate over it directly using only a single call on " +"the :class:`Connection` object." msgstr "" -#: ../../library/sqlite3.rst:2367 +#: ../../library/sqlite3.rst:2370 msgid "" "# Create and fill the table.\n" "con = sqlite3.connect(\":memory:\")\n" @@ -2888,11 +2899,11 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2399 +#: ../../library/sqlite3.rst:2402 msgid "How to use the connection context manager" msgstr "" -#: ../../library/sqlite3.rst:2401 +#: ../../library/sqlite3.rst:2404 msgid "" "A :class:`Connection` object can be used as a context manager that " "automatically commits or rolls back open transactions when leaving the body " @@ -2904,25 +2915,25 @@ msgid "" "rolling back." msgstr "" -#: ../../library/sqlite3.rst:2412 +#: ../../library/sqlite3.rst:2415 msgid "" "If there is no open transaction upon leaving the body of the ``with`` " "statement, or if :attr:`~Connection.autocommit` is ``True``, the context " "manager does nothing." msgstr "" -#: ../../library/sqlite3.rst:2417 +#: ../../library/sqlite3.rst:2420 msgid "" "The context manager neither implicitly opens a new transaction nor closes " -"the connection. If you need a closing context manager, consider using :meth:" -"`contextlib.closing`." +"the connection. If you need a closing context manager, consider " +"using :meth:`contextlib.closing`." msgstr "" -#: ../../library/sqlite3.rst:2421 +#: ../../library/sqlite3.rst:2424 msgid "" "con = sqlite3.connect(\":memory:\")\n" -"con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR " -"UNIQUE)\")\n" +"con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR UNIQUE)" +"\")\n" "\n" "# Successful, con.commit() is called automatically afterwards\n" "with con:\n" @@ -2942,19 +2953,19 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2451 +#: ../../library/sqlite3.rst:2454 msgid "How to work with SQLite URIs" msgstr "" -#: ../../library/sqlite3.rst:2453 +#: ../../library/sqlite3.rst:2456 msgid "Some useful URI tricks include:" msgstr "" -#: ../../library/sqlite3.rst:2455 +#: ../../library/sqlite3.rst:2458 msgid "Open a database in read-only mode:" msgstr "" -#: ../../library/sqlite3.rst:2457 +#: ../../library/sqlite3.rst:2460 msgid "" ">>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n" ">>> con.execute(\"CREATE TABLE readonly(data)\")\n" @@ -2968,13 +2979,13 @@ msgstr "" "OperationalError: attempt to write a readonly database\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2465 +#: ../../library/sqlite3.rst:2468 msgid "" "Do not implicitly create a new database file if it does not already exist; " "will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:" msgstr "" -#: ../../library/sqlite3.rst:2468 +#: ../../library/sqlite3.rst:2471 msgid "" ">>> con = sqlite3.connect(\"file:nosuchdb.db?mode=rw\", uri=True)\n" "Traceback (most recent call last):\n" @@ -2984,11 +2995,11 @@ msgstr "" "Traceback (most recent call last):\n" "OperationalError: unable to open database file" -#: ../../library/sqlite3.rst:2475 +#: ../../library/sqlite3.rst:2478 msgid "Create a shared named in-memory database:" msgstr "" -#: ../../library/sqlite3.rst:2477 +#: ../../library/sqlite3.rst:2480 msgid "" "db = \"file:mem1?mode=memory&cache=shared\"\n" "con1 = sqlite3.connect(db, uri=True)\n" @@ -3014,32 +3025,32 @@ msgstr "" "con1.close()\n" "con2.close()" -#: ../../library/sqlite3.rst:2491 +#: ../../library/sqlite3.rst:2494 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:2500 +#: ../../library/sqlite3.rst:2503 msgid "How to create and use row factories" msgstr "" -#: ../../library/sqlite3.rst:2502 +#: ../../library/sqlite3.rst:2505 msgid "" -"By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If a :" -"class:`!tuple` does not suit your needs, you can use the :class:`sqlite3." -"Row` class or a custom :attr:`~Cursor.row_factory`." +"By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If " +"a :class:`!tuple` does not suit your needs, you can use " +"the :class:`sqlite3.Row` class or a custom :attr:`~Cursor.row_factory`." msgstr "" -#: ../../library/sqlite3.rst:2507 +#: ../../library/sqlite3.rst:2510 msgid "" -"While :attr:`!row_factory` exists as an attribute both on the :class:" -"`Cursor` and the :class:`Connection`, it is recommended to set :class:" -"`Connection.row_factory`, so all cursors created from the connection will " -"use the same row factory." +"While :attr:`!row_factory` exists as an attribute both on " +"the :class:`Cursor` and the :class:`Connection`, it is recommended to " +"set :class:`Connection.row_factory`, so all cursors created from the " +"connection will use the same row factory." msgstr "" -#: ../../library/sqlite3.rst:2512 +#: ../../library/sqlite3.rst:2515 msgid "" ":class:`!Row` provides indexed and case-insensitive named access to columns, " "with minimal memory overhead and performance impact over a :class:`!tuple`. " @@ -3047,7 +3058,7 @@ msgid "" "attribute:" msgstr "" -#: ../../library/sqlite3.rst:2517 +#: ../../library/sqlite3.rst:2520 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" @@ -3055,11 +3066,11 @@ msgstr "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" -#: ../../library/sqlite3.rst:2522 +#: ../../library/sqlite3.rst:2525 msgid "Queries now return :class:`!Row` objects:" msgstr "" -#: ../../library/sqlite3.rst:2524 +#: ../../library/sqlite3.rst:2527 msgid "" ">>> res = con.execute(\"SELECT 'Earth' AS name, 6378 AS radius\")\n" ">>> row = res.fetchone()\n" @@ -3074,7 +3085,7 @@ msgid "" ">>> con.close()" msgstr "" -#: ../../library/sqlite3.rst:2540 +#: ../../library/sqlite3.rst:2543 msgid "" "The ``FROM`` clause can be omitted in the ``SELECT`` statement, as in the " "above example. In such cases, SQLite returns a single row with columns " @@ -3082,13 +3093,13 @@ msgid "" "alias``." msgstr "" -#: ../../library/sqlite3.rst:2545 +#: ../../library/sqlite3.rst:2548 msgid "" "You can create a custom :attr:`~Cursor.row_factory` that returns each row as " "a :class:`dict`, with column names mapped to values:" msgstr "" -#: ../../library/sqlite3.rst:2548 +#: ../../library/sqlite3.rst:2551 msgid "" "def dict_factory(cursor, row):\n" " fields = [column[0] for column in cursor.description]\n" @@ -3098,12 +3109,12 @@ msgstr "" " fields = [column[0] for column in cursor.description]\n" " return {key: value for key, value in zip(fields, row)}" -#: ../../library/sqlite3.rst:2554 +#: ../../library/sqlite3.rst:2557 msgid "" "Using it, queries now return a :class:`!dict` instead of a :class:`!tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2556 +#: ../../library/sqlite3.rst:2559 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = dict_factory\n" @@ -3119,11 +3130,11 @@ msgstr "" "{'a': 1, 'b': 2}\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2565 +#: ../../library/sqlite3.rst:2568 msgid "The following row factory returns a :term:`named tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2567 +#: ../../library/sqlite3.rst:2570 msgid "" "from collections import namedtuple\n" "\n" @@ -3139,11 +3150,11 @@ msgstr "" " cls = namedtuple(\"Row\", fields)\n" " return cls._make(row)" -#: ../../library/sqlite3.rst:2576 +#: ../../library/sqlite3.rst:2579 msgid ":func:`!namedtuple_factory` can be used as follows:" msgstr "" -#: ../../library/sqlite3.rst:2578 +#: ../../library/sqlite3.rst:2581 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = namedtuple_factory\n" @@ -3169,69 +3180,69 @@ msgstr "" "2\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2592 +#: ../../library/sqlite3.rst:2595 msgid "" -"With some adjustments, the above recipe can be adapted to use a :class:" -"`~dataclasses.dataclass`, or any other custom class, instead of a :class:" -"`~collections.namedtuple`." +"With some adjustments, the above recipe can be adapted to use " +"a :class:`~dataclasses.dataclass`, or any other custom class, instead of " +"a :class:`~collections.namedtuple`." msgstr "" -#: ../../library/sqlite3.rst:2600 +#: ../../library/sqlite3.rst:2603 msgid "How to handle non-UTF-8 text encodings" msgstr "" -#: ../../library/sqlite3.rst:2602 +#: ../../library/sqlite3.rst:2605 msgid "" "By default, :mod:`!sqlite3` uses :class:`str` to adapt SQLite values with " "the ``TEXT`` data type. This works well for UTF-8 encoded text, but it might " -"fail for other encodings and invalid UTF-8. You can use a custom :attr:" -"`~Connection.text_factory` to handle such cases." +"fail for other encodings and invalid UTF-8. You can use a " +"custom :attr:`~Connection.text_factory` to handle such cases." msgstr "" -#: ../../library/sqlite3.rst:2608 +#: ../../library/sqlite3.rst:2611 msgid "" "Because of SQLite's `flexible typing`_, it is not uncommon to encounter " "table columns with the ``TEXT`` data type containing non-UTF-8 encodings, or " "even arbitrary data. To demonstrate, let's assume we have a database with " "ISO-8859-2 (Latin-2) encoded text, for example a table of Czech-English " -"dictionary entries. Assuming we now have a :class:`Connection` instance :py:" -"data:`!con` connected to this database, we can decode the Latin-2 encoded " -"text using this :attr:`~Connection.text_factory`:" +"dictionary entries. Assuming we now have a :class:`Connection` " +"instance :py:data:`!con` connected to this database, we can decode the " +"Latin-2 encoded text using this :attr:`~Connection.text_factory`:" msgstr "" -#: ../../library/sqlite3.rst:2617 +#: ../../library/sqlite3.rst:2620 msgid "con.text_factory = lambda data: str(data, encoding=\"latin2\")" msgstr "con.text_factory = lambda data: str(data, encoding=\"latin2\")" -#: ../../library/sqlite3.rst:2621 +#: ../../library/sqlite3.rst:2624 msgid "" "For invalid UTF-8 or arbitrary data in stored in ``TEXT`` table columns, you " "can use the following technique, borrowed from the :ref:`unicode-howto`:" msgstr "" -#: ../../library/sqlite3.rst:2624 +#: ../../library/sqlite3.rst:2627 msgid "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" msgstr "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" -#: ../../library/sqlite3.rst:2630 +#: ../../library/sqlite3.rst:2633 msgid "" "The :mod:`!sqlite3` module API does not support strings containing " "surrogates." msgstr "" -#: ../../library/sqlite3.rst:2635 +#: ../../library/sqlite3.rst:2638 msgid ":ref:`unicode-howto`" msgstr ":ref:`unicode-howto`" -#: ../../library/sqlite3.rst:2641 +#: ../../library/sqlite3.rst:2644 msgid "Explanation" msgstr "解釋" -#: ../../library/sqlite3.rst:2647 +#: ../../library/sqlite3.rst:2650 msgid "Transaction control" msgstr "" -#: ../../library/sqlite3.rst:2649 +#: ../../library/sqlite3.rst:2652 msgid "" ":mod:`!sqlite3` offers multiple methods of controlling whether, when and how " "database transactions are opened and closed. :ref:`sqlite3-transaction-" @@ -3239,135 +3250,133 @@ msgid "" "isolation-level` retains the pre-Python 3.12 behaviour." msgstr "" -#: ../../library/sqlite3.rst:2658 +#: ../../library/sqlite3.rst:2661 msgid "Transaction control via the ``autocommit`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2660 +#: ../../library/sqlite3.rst:2663 msgid "" -"The recommended way of controlling transaction behaviour is through the :" -"attr:`Connection.autocommit` attribute, which should preferably be set using " -"the *autocommit* parameter of :func:`connect`." +"The recommended way of controlling transaction behaviour is through " +"the :attr:`Connection.autocommit` attribute, which should preferably be set " +"using the *autocommit* parameter of :func:`connect`." msgstr "" -#: ../../library/sqlite3.rst:2665 +#: ../../library/sqlite3.rst:2668 msgid "" "It is suggested to set *autocommit* to ``False``, which implies :pep:`249`-" "compliant transaction control. This means:" msgstr "" -#: ../../library/sqlite3.rst:2669 +#: ../../library/sqlite3.rst:2672 msgid "" -":mod:`!sqlite3` ensures that a transaction is always open, so :func:" -"`connect`, :meth:`Connection.commit`, and :meth:`Connection.rollback` will " -"implicitly open a new transaction (immediately after closing the pending " -"one, for the latter two). :mod:`!sqlite3` uses ``BEGIN DEFERRED`` statements " -"when opening transactions." +":mod:`!sqlite3` ensures that a transaction is always open, " +"so :func:`connect`, :meth:`Connection.commit`, " +"and :meth:`Connection.rollback` will implicitly open a new transaction " +"(immediately after closing the pending one, for the latter two). :mod:`!" +"sqlite3` uses ``BEGIN DEFERRED`` statements when opening transactions." msgstr "" -#: ../../library/sqlite3.rst:2674 +#: ../../library/sqlite3.rst:2677 msgid "Transactions should be committed explicitly using :meth:`!commit`." msgstr "" -#: ../../library/sqlite3.rst:2675 +#: ../../library/sqlite3.rst:2678 msgid "Transactions should be rolled back explicitly using :meth:`!rollback`." msgstr "" -#: ../../library/sqlite3.rst:2676 +#: ../../library/sqlite3.rst:2679 msgid "" -"An implicit rollback is performed if the database is :meth:`~Connection." -"close`-ed with pending changes." +"An implicit rollback is performed if the database " +"is :meth:`~Connection.close`-ed with pending changes." msgstr "" -#: ../../library/sqlite3.rst:2679 +#: ../../library/sqlite3.rst:2682 msgid "" "Set *autocommit* to ``True`` to enable SQLite's `autocommit mode`_. In this " "mode, :meth:`Connection.commit` and :meth:`Connection.rollback` have no " "effect. Note that SQLite's autocommit mode is distinct from the :pep:`249`-" -"compliant :attr:`Connection.autocommit` attribute; use :attr:`Connection." -"in_transaction` to query the low-level SQLite autocommit mode." +"compliant :attr:`Connection.autocommit` attribute; " +"use :attr:`Connection.in_transaction` to query the low-level SQLite " +"autocommit mode." msgstr "" -#: ../../library/sqlite3.rst:2687 +#: ../../library/sqlite3.rst:2690 msgid "" "Set *autocommit* to :data:`LEGACY_TRANSACTION_CONTROL` to leave transaction " -"control behaviour to the :attr:`Connection.isolation_level` attribute. See :" -"ref:`sqlite3-transaction-control-isolation-level` for more information." +"control behaviour to the :attr:`Connection.isolation_level` attribute. " +"See :ref:`sqlite3-transaction-control-isolation-level` for more information." msgstr "" -#: ../../library/sqlite3.rst:2696 +#: ../../library/sqlite3.rst:2699 msgid "Transaction control via the ``isolation_level`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2700 +#: ../../library/sqlite3.rst:2703 msgid "" -"The recommended way of controlling transactions is via the :attr:" -"`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-control-" -"autocommit`." +"The recommended way of controlling transactions is via " +"the :attr:`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-" +"control-autocommit`." msgstr "" -#: ../../library/sqlite3.rst:2704 +#: ../../library/sqlite3.rst:2707 msgid "" -"If :attr:`Connection.autocommit` is set to :data:" -"`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour is " -"controlled using the :attr:`Connection.isolation_level` attribute. " +"If :attr:`Connection.autocommit` is set " +"to :data:`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour " +"is controlled using the :attr:`Connection.isolation_level` attribute. " "Otherwise, :attr:`!isolation_level` has no effect." msgstr "" -#: ../../library/sqlite3.rst:2710 +#: ../../library/sqlite3.rst:2713 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " -"``None``, new transactions are implicitly opened before :meth:`~Cursor." -"execute` and :meth:`~Cursor.executemany` executes ``INSERT``, ``UPDATE``, " -"``DELETE``, or ``REPLACE`` statements; for other statements, no implicit " -"transaction handling is performed. Use the :meth:`~Connection.commit` and :" -"meth:`~Connection.rollback` methods to respectively commit and roll back " -"pending transactions. You can choose the underlying `SQLite transaction " -"behaviour`_ — that is, whether and what type of ``BEGIN`` statements :mod:`!" -"sqlite3` implicitly executes – via the :attr:`~Connection.isolation_level` " -"attribute." +"``None``, new transactions are implicitly opened " +"before :meth:`~Cursor.execute` and :meth:`~Cursor.executemany` executes " +"``INSERT``, ``UPDATE``, ``DELETE``, or ``REPLACE`` statements; for other " +"statements, no implicit transaction handling is performed. Use " +"the :meth:`~Connection.commit` and :meth:`~Connection.rollback` methods to " +"respectively commit and roll back pending transactions. You can choose the " +"underlying `SQLite transaction behaviour`_ — that is, whether and what type " +"of ``BEGIN`` statements :mod:`!sqlite3` implicitly executes – via " +"the :attr:`~Connection.isolation_level` attribute." msgstr "" -#: ../../library/sqlite3.rst:2723 +#: ../../library/sqlite3.rst:2726 msgid "" "If :attr:`~Connection.isolation_level` is set to ``None``, no transactions " "are implicitly opened at all. This leaves the underlying SQLite library in " "`autocommit mode`_, but also allows the user to perform their own " "transaction handling using explicit SQL statements. The underlying SQLite " -"library autocommit mode can be queried using the :attr:`~Connection." -"in_transaction` attribute." +"library autocommit mode can be queried using " +"the :attr:`~Connection.in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:2731 +#: ../../library/sqlite3.rst:2734 msgid "" "The :meth:`~Cursor.executescript` method implicitly commits any pending " "transaction before execution of the given SQL script, regardless of the " "value of :attr:`~Connection.isolation_level`." msgstr "" -#: ../../library/sqlite3.rst:2735 +#: ../../library/sqlite3.rst:2738 msgid "" ":mod:`!sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:2739 +#: ../../library/sqlite3.rst:2742 msgid "" -"The recommended way of controlling transactions is now via the :attr:" -"`~Connection.autocommit` attribute." +"The recommended way of controlling transactions is now via " +"the :attr:`~Connection.autocommit` attribute." msgstr "" -#: ../../library/sqlite3.rst:1490 +#: ../../library/sqlite3.rst:1493 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/sqlite3.rst:1490 ../../library/sqlite3.rst:1491 +#: ../../library/sqlite3.rst:1493 ../../library/sqlite3.rst:1494 msgid "in SQL statements" msgstr "於 SQL 陳述式中" -#: ../../library/sqlite3.rst:1491 +#: ../../library/sqlite3.rst:1494 msgid ": (colon)" msgstr ": (冒號)" - -#~ msgid "`threadsafety`_" -#~ msgstr "`threadsafety`_" diff --git a/library/ssl.po b/library/ssl.po index 0779b084a5..8a3cf24926 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2024-08-28 00:43+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -89,15 +89,16 @@ msgid "" "also encrypts and decrypts the data going over the socket with SSL. It " "supports additional methods such as :meth:`getpeercert`, which retrieves the " "certificate of the other side of the connection, :meth:`cipher`, which " -"retrieves the cipher being used for the secure connection or :meth:" -"`get_verified_chain`, :meth:`get_unverified_chain` which retrieves " +"retrieves the cipher being used for the secure connection " +"or :meth:`get_verified_chain`, :meth:`get_unverified_chain` which retrieves " "certificate chain." msgstr "" "此模組提供了一個 :class:`ssl.SSLSocket` 類別,它是從 :class:`socket.socket` " "衍生出來的,並且提供類似 socket 的包裝器,讓使用 SSL 進行資料傳輸時,可以進行" "資料的加密及解密。它也提供了一些額外的方法,如 :meth:`getpeercert`,用於取得" -"連結另一端的憑證,以及 :meth:`cipher`,用於搜尋用於安全連接的加密方法 " -"(cipher)。" +"連結另一端的憑證;以及 :meth:`cipher`,用於搜尋用於安全連接的加密方法 " +"(cipher);和 :meth:`get_verified_chain`、:meth:`get_unverified_chain` 能用於" +"取得憑證鏈。" #: ../../library/ssl.rst:51 msgid "" @@ -142,9 +143,10 @@ msgstr "Socket 建立" #: ../../library/ssl.rst:79 msgid "" -"Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." -"wrap_socket` method. The helper function :func:`create_default_context` " -"returns a new context with secure default settings." +"Instances of :class:`SSLSocket` must be created using " +"the :meth:`SSLContext.wrap_socket` method. The helper " +"function :func:`create_default_context` returns a new context with secure " +"default settings." msgstr "" ":class:`SSLSocket` 實例必須使用 :meth:`SSLContext.wrap_socket` 方法來建立。輔" "助函式 :func:`create_default_context` 會回傳有安全預設設定的新語境 " @@ -245,31 +247,31 @@ msgid "" "If all three are :const:`None`, this function can choose to trust the " "system's default CA certificates instead." msgstr "" -"*cafile*, *capath*, *cadata* 是用來選擇用於憑證認證的 CA 憑證,就像 :meth:" -"`SSLContext.load_verify_locations` 一樣。如果三個值都是 :const:`None`,此函式" -"會自動選擇系統預設的 CA 憑證。" +"*cafile*, *capath*, *cadata* 是用來選擇用於憑證認證的 CA 憑證,就" +"像 :meth:`SSLContext.load_verify_locations` 一樣。如果三個值都" +"是 :const:`None`,此函式會自動選擇系統預設的 CA 憑證。" # Skylull: `high encryption cipher` 可能是指 https://superuser.com/questions/1751902/how-to-check-which-ciphers-are-included-in-high-ciphers-constant # 其文中表示可能是指 128bit 以上 key length 的加密算法,需要其他來源佐證。 # 或是 https://help.fortinet.com/fweb/582/Content/FortiWeb/fortiweb-admin/supported_cipher_suites.htm#ssl_414712646_1189301 #: ../../library/ssl.rst:141 msgid "" -"The settings are: :data:`PROTOCOL_TLS_CLIENT` or :data:" -"`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` with " -"high encryption cipher suites without RC4 and without unauthenticated cipher " -"suites. Passing :const:`~Purpose.SERVER_AUTH` as *purpose* sets :data:" -"`~SSLContext.verify_mode` to :data:`CERT_REQUIRED` and either loads CA " -"certificates (when at least one of *cafile*, *capath* or *cadata* is given) " -"or uses :meth:`SSLContext.load_default_certs` to load default CA " +"The settings are: :data:`PROTOCOL_TLS_CLIENT` " +"or :data:`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` " +"with high encryption cipher suites without RC4 and without unauthenticated " +"cipher suites. Passing :const:`~Purpose.SERVER_AUTH` as *purpose* " +"sets :data:`~SSLContext.verify_mode` to :data:`CERT_REQUIRED` and either " +"loads CA certificates (when at least one of *cafile*, *capath* or *cadata* " +"is given) or uses :meth:`SSLContext.load_default_certs` to load default CA " "certificates." msgstr "" -"這些設定包含::data:`PROTOCOL_TLS_CLIENT` 或 :data:`PROTOCOL_TLS_SERVER`、:" -"data:`OP_NO_SSLv2`、以及 :data:`OP_NO_SSLv3`,使用高等加密套件但不包含 RC4 和" -"未經身份驗證的加密套件。如果將 *purpose* 設定為 :const:`~Purpose." -"SERVER_AUTH`,則會把 :data:`~SSLContext.verify_mode` 設為 :data:" -"`CERT_REQUIRED` 並使用設定的 CA 憑證(當 *cafile*、*capath* 或 *cadata* 其中一" -"個值有被設定時) 或使用預設的 CA 憑證 :meth:`SSLContext." -"load_default_certs` 。" +"這些設定包含::data:`PROTOCOL_TLS_CLIENT` " +"或 :data:`PROTOCOL_TLS_SERVER`、:data:`OP_NO_SSLv2`、以" +"及 :data:`OP_NO_SSLv3`,使用高等加密套件但不包含 RC4 和未經身份驗證的加密套" +"件。如果將 *purpose* 設定為 :const:`~Purpose.SERVER_AUTH`,則會" +"把 :data:`~SSLContext.verify_mode` 設為 :data:`CERT_REQUIRED` 並使用設定的 " +"CA 憑證(當 *cafile*、*capath* 或 *cadata* 其中一個值有被設定時) 或使用預設的 " +"CA 憑證 :meth:`SSLContext.load_default_certs` 。" #: ../../library/ssl.rst:150 msgid "" @@ -277,16 +279,16 @@ msgid "" "variable :envvar:`SSLKEYLOGFILE` is set, :func:`create_default_context` " "enables key logging." msgstr "" -"當系統有支援 :attr:`~SSLContext.keylog_filename` 並且有設定環境變數 :envvar:" -"`SSLKEYLOGFILE` 時 :func:`create_default_context` 會啟用密鑰日誌記錄 " -"(logging)。" +"當系統有支援 :attr:`~SSLContext.keylog_filename` 並且有設定環境變" +"數 :envvar:`SSLKEYLOGFILE` 時 :func:`create_default_context` 會啟用密鑰日誌記" +"錄 (logging)。" #: ../../library/ssl.rst:154 msgid "" -"The default settings for this context include :data:" -"`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. These make the " -"underlying OpenSSL implementation behave more like a conforming " -"implementation of :rfc:`5280`, in exchange for a small amount of " +"The default settings for this context " +"include :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. " +"These make the underlying OpenSSL implementation behave more like a " +"conforming implementation of :rfc:`5280`, in exchange for a small amount of " "incompatibility with older X.509 certificates." msgstr "" @@ -301,8 +303,8 @@ msgstr "" #: ../../library/ssl.rst:165 msgid "" -"If your application needs specific settings, you should create a :class:" -"`SSLContext` and apply the settings yourself." +"If your application needs specific settings, you should create " +"a :class:`SSLContext` and apply the settings yourself." msgstr "" "如果你的應用程式需要特殊的設定,你應該要自行建立一個 :class:`SSLContext` 並自" "行調整設定。" @@ -313,9 +315,9 @@ msgid "" "with a :class:`SSLContext` created by this function that they get an error " "stating \"Protocol or cipher suite mismatch\", it may be that they only " "support SSL3.0 which this function excludes using the :data:`OP_NO_SSLv3`. " -"SSL3.0 is widely considered to be `completely broken `_. If you still wish to continue to use this function but " -"still allow SSL 3.0 connections you can re-enable them using::" +"SSL3.0 is widely considered to be `completely broken `_. If you still wish to continue to use this " +"function but still allow SSL 3.0 connections you can re-enable them using::" msgstr "" "如果你發現某些舊的客戶端或伺服器常適用此函式建立的 :class:`SSLContext` 連線" "時,收到 \"Protocol or cipher suite mismatch\" 錯誤,這可能是因為他們的系統僅" @@ -340,13 +342,12 @@ msgid "" msgstr "" #: ../../library/ssl.rst:187 -#, fuzzy msgid "" "ctx = ssl.create_default_context()\n" "ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" msgstr "" -"ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)\n" -"ctx.options &= ~ssl.OP_NO_SSLv3" +"ctx = ssl.create_default_context()\n" +"ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" #: ../../library/ssl.rst:194 msgid "RC4 was dropped from the default cipher string." @@ -366,16 +367,17 @@ msgstr "增加了 :envvar:`SSLKEYLOGFILE` 對密鑰日誌記錄 (logging) 的支 #: ../../library/ssl.rst:208 msgid "" -"The context now uses :data:`PROTOCOL_TLS_CLIENT` or :data:" -"`PROTOCOL_TLS_SERVER` protocol instead of generic :data:`PROTOCOL_TLS`." +"The context now uses :data:`PROTOCOL_TLS_CLIENT` " +"or :data:`PROTOCOL_TLS_SERVER` protocol instead of " +"generic :data:`PROTOCOL_TLS`." msgstr "" "目前語境使用 :data:`PROTOCOL_TLS_CLIENT` 協定或 :data:`PROTOCOL_TLS_SERVER` " "協定而非通用的 :data:`PROTOCOL_TLS`。" #: ../../library/ssl.rst:214 msgid "" -"The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:" -"`VERIFY_X509_STRICT` in its default verify flags." +"The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` " +"and :data:`VERIFY_X509_STRICT` in its default verify flags." msgstr "" #: ../../library/ssl.rst:219 @@ -392,9 +394,9 @@ msgid "" "OpenSSL library." msgstr "" "引發由底層 SSL 實作(目前由 OpenSSL 函式庫提供)所引發的錯誤訊息。這表示在覆" -"蓋底層網路連線的高階加密和身份驗證層中存在一些問題。這項錯誤是 :exc:" -"`OSError` 的一個子型別。:exc:`SSLError` 實例的錯誤程式代碼和訊息是由 OpenSSL " -"函式庫提供。" +"蓋底層網路連線的高階加密和身份驗證層中存在一些問題。這項錯誤" +"是 :exc:`OSError` 的一個子型別。:exc:`SSLError` 實例的錯誤程式代碼和訊息是由 " +"OpenSSL 函式庫提供。" #: ../../library/ssl.rst:230 msgid ":exc:`SSLError` used to be a subtype of :exc:`socket.error`." @@ -490,16 +492,16 @@ msgstr "隨機產生" #: ../../library/ssl.rst:319 msgid "" -"Return *num* cryptographically strong pseudo-random bytes. Raises an :class:" -"`SSLError` if the PRNG has not been seeded with enough data or if the " -"operation is not supported by the current RAND method. :func:`RAND_status` " -"can be used to check the status of the PRNG and :func:`RAND_add` can be used " -"to seed the PRNG." +"Return *num* cryptographically strong pseudo-random bytes. Raises " +"an :class:`SSLError` if the PRNG has not been seeded with enough data or if " +"the operation is not supported by the current RAND " +"method. :func:`RAND_status` can be used to check the status of the PRNG " +"and :func:`RAND_add` can be used to seed the PRNG." msgstr "" "回傳 *num* 個加密性強的偽隨機位元組。如果 PRNG 未使用足夠的資料做為隨機種子 " -"(seed) 或是目前的 RAND 方法不支持該操作則會導致 :class:`SSLError` 錯誤。:" -"func:`RAND_status` 函式可以用來檢查 PRNG 函式,而 :func:`RAND_add` 則可以用來" -"為 PRNG 設定隨機種子。" +"(seed) 或是目前的 RAND 方法不支持該操作則會導致 :class:`SSLError` 錯" +"誤。:func:`RAND_status` 函式可以用來檢查 PRNG 函式,而 :func:`RAND_add` 則可" +"以用來為 PRNG 設定隨機種子。" #: ../../library/ssl.rst:325 msgid "For almost all applications :func:`os.urandom` is preferable." @@ -512,20 +514,21 @@ msgid "" "Cryptographically_secure_pseudorandom_number_generator>`_, to get the " "requirements of a cryptographically strong generator." msgstr "" -"請閱讀維基百科的\\ `密碼學安全偽隨機數產生器 (CSPRNG) `_\\ 文章來了" -"解密碼學安全偽隨機數產生器的需求。" +"請閱讀維基百科的\\ `密碼學安全偽隨機數產生器 (CSPRNG) `_\\ 文章來了解密碼學" +"安全偽隨機數產生器的需求。" #: ../../library/ssl.rst:336 msgid "" "Return ``True`` if the SSL pseudo-random number generator has been seeded " -"with 'enough' randomness, and ``False`` otherwise. You can use :func:`ssl." -"RAND_egd` and :func:`ssl.RAND_add` to increase the randomness of the pseudo-" -"random number generator." +"with 'enough' randomness, and ``False`` otherwise. You can " +"use :func:`ssl.RAND_egd` and :func:`ssl.RAND_add` to increase the randomness " +"of the pseudo-random number generator." msgstr "" "如果 SSL 偽隨機數產生器已經使用「足夠的」隨機性進行隨機種子生成,則回傳 " -"``True`` ,否則回傳 ``False``。你可以使用 :func:`ssl.RAND_egd` 函式和 :func:" -"`ssl.RAND_add` 函式來增加偽隨機數產生器的隨機性。" +"``True`` ,否則回傳 ``False``。你可以使用 :func:`ssl.RAND_egd` 函式" +"和 :func:`ssl.RAND_add` 函式來增加偽隨機數產生器的隨機性。" #: ../../library/ssl.rst:343 msgid "" @@ -564,18 +567,18 @@ msgstr "以下是一個範例:" msgid "" ">>> import ssl\n" ">>> timestamp = ssl.cert_time_to_seconds(\"Jan 5 09:34:43 2018 GMT\")\n" -">>> timestamp \n" +">>> timestamp\n" "1515144883\n" ">>> from datetime import datetime\n" -">>> print(datetime.utcfromtimestamp(timestamp)) \n" +">>> print(datetime.utcfromtimestamp(timestamp))\n" "2018-01-05 09:34:43" msgstr "" ">>> import ssl\n" ">>> timestamp = ssl.cert_time_to_seconds(\"Jan 5 09:34:43 2018 GMT\")\n" -">>> timestamp \n" +">>> timestamp\n" "1515144883\n" ">>> from datetime import datetime\n" -">>> print(datetime.utcfromtimestamp(timestamp)) \n" +">>> print(datetime.utcfromtimestamp(timestamp))\n" "2018-01-05 09:34:43" #: ../../library/ssl.rst:377 @@ -598,19 +601,19 @@ msgid "" "PEM-encoded string. If ``ssl_version`` is specified, uses that version of " "the SSL protocol to attempt to connect to the server. If *ca_certs* is " "specified, it should be a file containing a list of root certificates, the " -"same format as used for the *cafile* parameter in :meth:`SSLContext." -"load_verify_locations`. The call will attempt to validate the server " -"certificate against that set of root certificates, and will fail if the " -"validation attempt fails. A timeout can be specified with the ``timeout`` " -"parameter." +"same format as used for the *cafile* parameter " +"in :meth:`SSLContext.load_verify_locations`. The call will attempt to " +"validate the server certificate against that set of root certificates, and " +"will fail if the validation attempt fails. A timeout can be specified with " +"the ``timeout`` parameter." msgstr "" "輸入使用 SSL 保護的伺服器的地址 ``addr``,輸入形式為一個 pair (*hostname*, " "*port-number*),取得該伺服器的憑證,並以 PEM 編碼字串的形式回傳。如果指定了 " "``ssl_version``,則使用指定的 SSL 協議來嘗試與伺服器連線。如果指定 " -"*ca_certs*,則它應該是一個包含根憑證列表的檔案,並與 :meth:`SSLContext." -"load_verify_locations` 中的參數 *cafile* 所使用的格式相同。此呼叫將嘗試使用該" -"組根憑證對伺服器憑證進行驗證,如果驗證失敗,呼叫將失敗。可以使用 ``timeout`` " -"參數指定超時時間。" +"*ca_certs*,則它應該是一個包含根憑證列表的檔案,並" +"與 :meth:`SSLContext.load_verify_locations` 中的參數 *cafile* 所使用的格式相" +"同。此呼叫將嘗試使用該組根憑證對伺服器憑證進行驗證,如果驗證失敗,呼叫將失" +"敗。可以使用 ``timeout`` 參數指定超時時間。" #: ../../library/ssl.rst:399 msgid "This function is now IPv6-compatible." @@ -618,11 +621,11 @@ msgstr "此函式現在是與 IPv6 相容的。" #: ../../library/ssl.rst:402 msgid "" -"The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` to :data:" -"`PROTOCOL_TLS` for maximum compatibility with modern servers." +"The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` " +"to :data:`PROTOCOL_TLS` for maximum compatibility with modern servers." msgstr "" -"預設的 *ssl_version* 已經從 :data:`PROTOCOL_SSLv3` 改為 :data:" -"`PROTOCOL_TLS`,已確保與現今的伺服器有最大的相容性。" +"預設的 *ssl_version* 已經從 :data:`PROTOCOL_SSLv3` 改" +"為 :data:`PROTOCOL_TLS`,已確保與現今的伺服器有最大的相容性。" #: ../../library/ssl.rst:406 msgid "The *timeout* parameter was added." @@ -649,9 +652,9 @@ msgid "" "paths are the same as used by :meth:`SSLContext.set_default_verify_paths`. " "The return value is a :term:`named tuple` ``DefaultVerifyPaths``:" msgstr "" -"回傳一個具有 OpenSSL 的預設 cafile 和 capath 路徑的附名元組。這些路徑與 :" -"meth:`SSLContext.set_default_verify_paths` 使用的相同。回傳值是一個 :term:" -"`named tuple` ``DefaultVerifyPaths``:" +"回傳一個具有 OpenSSL 的預設 cafile 和 capath 路徑的附名元組。這些路徑" +"與 :meth:`SSLContext.set_default_verify_paths` 使用的相同。回傳值是一" +"個 :term:`named tuple` ``DefaultVerifyPaths``:" #: ../../library/ssl.rst:426 msgid "" @@ -697,15 +700,17 @@ msgstr "" #: ../../library/ssl.rst:441 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " -"The encoding_type specifies the encoding of cert_bytes. It is either :const:" -"`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for PKCS#7 ASN.1 " -"data. Trust specifies the purpose of the certificate as a set of OIDS or " -"exactly ``True`` if the certificate is trustworthy for all purposes." +"The encoding_type specifies the encoding of cert_bytes. It is " +"either :const:`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for " +"PKCS#7 ASN.1 data. Trust specifies the purpose of the certificate as a set " +"of OIDS or exactly ``True`` if the certificate is trustworthy for all " +"purposes." msgstr "" "此函式會回傳一個元組 (cert_bytes, encoding_type, trust) 串列。encoding_type " -"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料的 :const:" -"`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。Trust 通過一" -"組 OIDS 來指定憑證的用途,或是如果憑證對所有用途都可以使用則回傳 ``True``。" +"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料" +"的 :const:`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" +"Trust 通過一組 OIDS 來指定憑證的用途,或是如果憑證對所有用途都可以使用則回傳 " +"``True``。" #: ../../library/ssl.rst:448 ../../library/ssl.rst:1599 #: ../../library/ssl.rst:1898 @@ -733,12 +738,13 @@ msgstr "" #: ../../library/ssl.rst:464 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " -"The encoding_type specifies the encoding of cert_bytes. It is either :const:" -"`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for PKCS#7 ASN.1 data." +"The encoding_type specifies the encoding of cert_bytes. It is " +"either :const:`x509_asn` for X.509 ASN.1 data or :const:`pkcs_7_asn` for " +"PKCS#7 ASN.1 data." msgstr "" "此函式會回傳一個元組 (cert_bytes, encoding_type, trust) 串列。encoding_type " -"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料的 :const:" -"`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" +"指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料" +"的 :const:`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" #: ../../library/ssl.rst:475 msgid "Constants" @@ -753,10 +759,11 @@ msgstr "" #: ../../library/ssl.rst:483 msgid "" -"Possible value for :attr:`SSLContext.verify_mode`. Except for :const:" -"`PROTOCOL_TLS_CLIENT`, it is the default mode. With client-side sockets, " -"just about any cert is accepted. Validation errors, such as untrusted or " -"expired cert, are ignored and do not abort the TLS/SSL handshake." +"Possible value for :attr:`SSLContext.verify_mode`. Except " +"for :const:`PROTOCOL_TLS_CLIENT`, it is the default mode. With client-side " +"sockets, just about any cert is accepted. Validation errors, such as " +"untrusted or expired cert, are ignored and do not abort the TLS/SSL " +"handshake." msgstr "" ":attr:`SSLContext.verify_mode` 可能的值。除了 :attr:`SSLContext.verify_mode` " "外,這是預設的模式。對於客戶端的 sockets,幾乎任何憑證都能被允許。驗證錯誤," @@ -776,13 +783,14 @@ msgstr "參閱下方 :ref:`ssl-security` 的討論。" #: ../../library/ssl.rst:496 msgid "" -"Possible value for :attr:`SSLContext.verify_mode`. In client mode, :const:" -"`CERT_OPTIONAL` has the same meaning as :const:`CERT_REQUIRED`. It is " -"recommended to use :const:`CERT_REQUIRED` for client-side sockets instead." +"Possible value for :attr:`SSLContext.verify_mode`. In client " +"mode, :const:`CERT_OPTIONAL` has the same meaning as :const:`CERT_REQUIRED`. " +"It is recommended to use :const:`CERT_REQUIRED` for client-side sockets " +"instead." msgstr "" -":attr:`SSLContext.verify_mode` 可能的值。在客戶端模式下,:const:" -"`CERT_OPTIONAL` 具有與 :const:`CERT_REQUIRED` 相同的含意。對於客戶端 sockets " -"推薦改用 :const:`CERT_REQUIRED`。" +":attr:`SSLContext.verify_mode` 可能的值。在客戶端模式" +"下,:const:`CERT_OPTIONAL` 具有與 :const:`CERT_REQUIRED` 相同的含意。對於客戶" +"端 sockets 推薦改用 :const:`CERT_REQUIRED`。" #: ../../library/ssl.rst:501 msgid "" @@ -798,29 +806,30 @@ msgstr "" #: ../../library/ssl.rst:507 ../../library/ssl.rst:526 msgid "" -"Use of this setting requires a valid set of CA certificates to be passed to :" -"meth:`SSLContext.load_verify_locations`." +"Use of this setting requires a valid set of CA certificates to be passed " +"to :meth:`SSLContext.load_verify_locations`." msgstr "" -"使用此設定需要將一組有效的 CA 憑證傳送給 :meth:`SSLContext." -"load_verify_locations`。" +"使用此設定需要將一組有效的 CA 憑證傳送" +"給 :meth:`SSLContext.load_verify_locations`。" #: ../../library/ssl.rst:512 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In this mode, " -"certificates are required from the other side of the socket connection; an :" -"class:`SSLError` will be raised if no certificate is provided, or if its " +"certificates are required from the other side of the socket connection; " +"an :class:`SSLError` will be raised if no certificate is provided, or if its " "validation fails. This mode is **not** sufficient to verify a certificate in " -"client mode as it does not match hostnames. :attr:`~SSLContext." -"check_hostname` must be enabled as well to verify the authenticity of a " -"cert. :const:`PROTOCOL_TLS_CLIENT` uses :const:`CERT_REQUIRED` and enables :" -"attr:`~SSLContext.check_hostname` by default." +"client mode as it does not match " +"hostnames. :attr:`~SSLContext.check_hostname` must be enabled as well to " +"verify the authenticity of a cert. :const:`PROTOCOL_TLS_CLIENT` " +"uses :const:`CERT_REQUIRED` and enables :attr:`~SSLContext.check_hostname` " +"by default." msgstr "" ":attr:`SSLContext.verify_mode` 可能的值。在這個模式下,需要從 socket 連線的另" "一端取得憑證;如果未提供憑證或是驗證失敗,則將會導致 :class:`SSLError`。此模" -"式 **不能** 在客戶端模式下對憑證進行驗證,因為它無法去配對主機名稱。:attr:" -"`~SSLContext.check_hostname` 也必須被開起來來驗證憑證的真實性。:const:" -"`PROTOCOL_TLS_CLIENT` 會使用 :const:`CERT_REQUIRED` 並預設開啟 :attr:" -"`~SSLContext.check_hostname`。" +"式\\ **不能**\\ 在客戶端模式下對憑證進行驗證,因為它無法去配對主機名" +"稱。:attr:`~SSLContext.check_hostname` 也必須被開起來來驗證憑證的真實" +"性。:const:`PROTOCOL_TLS_CLIENT` 會使用 :const:`CERT_REQUIRED` 並預設開" +"啟 :attr:`~SSLContext.check_hostname`。" #: ../../library/ssl.rst:522 msgid "" @@ -849,8 +858,8 @@ msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, only the " "peer cert is checked but none of the intermediate CA certificates. The mode " "requires a valid CRL that is signed by the peer cert's issuer (its direct " -"ancestor CA). If no proper CRL has been loaded with :attr:`SSLContext." -"load_verify_locations`, validation will fail." +"ancestor CA). If no proper CRL has been loaded " +"with :attr:`SSLContext.load_verify_locations`, validation will fail." msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。在此模式下,只會檢查同等的憑證而不" "會去檢查中間的 CA 憑證。此模式需要提供由對等憑證發行者 (它的直接上級 CA) 的有" @@ -916,8 +925,8 @@ msgstr "" #: ../../library/ssl.rst:608 msgid "" "TLS clients and servers require different default settings for secure " -"communication. The generic TLS protocol constant is deprecated in favor of :" -"data:`PROTOCOL_TLS_CLIENT` and :data:`PROTOCOL_TLS_SERVER`." +"communication. The generic TLS protocol constant is deprecated in favor " +"of :data:`PROTOCOL_TLS_CLIENT` and :data:`PROTOCOL_TLS_SERVER`." msgstr "" "TLS 的客戶端及伺服器端需要不同的預設值來實現安全通訊。通用的 TLS 協定常數已被" "廢除,並改用 :data:`PROTOCOL_TLS_CLIENT` 和 :data:`PROTOCOL_TLS_SERVER`。" @@ -963,13 +972,13 @@ msgstr "第三版的 SSL 是不安全的,強烈建議不要使用。" #: ../../library/ssl.rst:649 msgid "" "OpenSSL has deprecated all version specific protocols. Use the default " -"protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` with :" -"attr:`SSLContext.minimum_version` and :attr:`SSLContext.maximum_version` " -"instead." +"protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` " +"with :attr:`SSLContext.minimum_version` " +"and :attr:`SSLContext.maximum_version` instead." msgstr "" -"OpenSSL 已經終止了所有特定版本的協定。請改用預設的 :data:" -"`PROTOCOL_TLS_SERVER` 協定或帶有 :attr:`SSLContext.minimum_version` 和 :attr:" -"`SSLContext.maximum_version` 的 :data:`PROTOCOL_TLS_CLIENT`。" +"OpenSSL 已經終止了所有特定版本的協定。請改用預設" +"的 :data:`PROTOCOL_TLS_SERVER` 協定或帶有 :attr:`SSLContext.minimum_version` " +"和 :attr:`SSLContext.maximum_version` 的 :data:`PROTOCOL_TLS_CLIENT`。" #: ../../library/ssl.rst:657 msgid "Selects TLS version 1.0 as the channel encryption protocol." @@ -1042,11 +1051,13 @@ msgstr "" #: ../../library/ssl.rst:725 msgid "" -"The option is deprecated since OpenSSL 1.1.0, use the new :attr:`SSLContext." -"minimum_version` and :attr:`SSLContext.maximum_version` instead." +"The option is deprecated since OpenSSL 1.1.0, use the " +"new :attr:`SSLContext.minimum_version` " +"and :attr:`SSLContext.maximum_version` instead." msgstr "" -"該選項自從 OpenSSL 1.1.0 以後已被棄用,請改用新的 :attr:`SSLContext." -"minimum_version` 及 :attr:`SSLContext.maximum_version` 代替。" +"該選項自從 OpenSSL 1.1.0 以後已被棄用,請改用新" +"的 :attr:`SSLContext.minimum_version` 及 :attr:`SSLContext.maximum_version` " +"代替。" #: ../../library/ssl.rst:732 msgid "" @@ -1196,16 +1207,16 @@ msgid "" "Whether the OpenSSL library has built-in support for the *Application-Layer " "Protocol Negotiation* TLS extension as described in :rfc:`7301`." msgstr "" -"OpenSSL 函式庫是否內建支援 *應用層協定協商* TLS 擴充套件,該擴充套件描述在 :" -"rfc:`7301` 中。" +"OpenSSL 函式庫是否內建支援 *應用層協定協商* TLS 擴充套件,該擴充套件描述" +"在 :rfc:`7301` 中。" #: ../../library/ssl.rst:864 msgid "" "Whether the OpenSSL library has built-in support not checking subject common " "name and :attr:`SSLContext.hostname_checks_common_name` is writeable." msgstr "" -"OpenSSL 函式庫是否內建支援不檢查主題通用名稱及 :attr:`SSLContext." -"hostname_checks_common_name` 是否可寫。" +"OpenSSL 函式庫是否內建支援不檢查主題通用名稱" +"及 :attr:`SSLContext.hostname_checks_common_name` 是否可寫。" #: ../../library/ssl.rst:872 msgid "" @@ -1268,17 +1279,16 @@ msgid "" msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.3 協定。" #: ../../library/ssl.rst:933 -#, fuzzy msgid "Whether the OpenSSL library has built-in support for TLS-PSK." -msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.0 協定。" +msgstr "此 OpenSSL 函式庫是否內建支援 TLS-PSK。" #: ../../library/ssl.rst:939 msgid "" "List of supported TLS channel binding types. Strings in this list can be " "used as arguments to :meth:`SSLSocket.get_channel_binding`." msgstr "" -"支援的 TLS 通道綁定類型列表。列表中的字串可以作為 :meth:`SSLSocket." -"get_channel_binding` 的參數。" +"支援的 TLS 通道綁定類型列表。列表中的字串可以作" +"為 :meth:`SSLSocket.get_channel_binding` 的參數。" #: ../../library/ssl.rst:946 msgid "The version string of the OpenSSL library loaded by the interpreter::" @@ -1329,14 +1339,14 @@ msgid "" "parameters-6>`_ contains this list and references to the RFCs where their " "meaning is defined." msgstr "" -"來自 :rfc:`5246` 和其他文件的警報描述。`IANA TLS Alert Registry `_ 包" -"含了此列表以及其含義定義所在的 RFC 的引用。" +"來自 :rfc:`5246` 和其他文件的警報描述。`IANA TLS Alert Registry `_ 包含了此列表以及其含義定義所在的 RFC 的引用。" #: ../../library/ssl.rst:982 msgid "" -"Used as the return value of the callback function in :meth:`SSLContext." -"set_servername_callback`." +"Used as the return value of the callback function " +"in :meth:`SSLContext.set_servername_callback`." msgstr "" "被用來做為 :meth:`SSLContext.set_servername_callback` 中回呼函式的回傳值。" @@ -1346,20 +1356,20 @@ msgstr ":class:`enum.IntEnum` 為 ALERT_DESCRIPTION_* 常數中的一個集合 #: ../../library/ssl.rst:995 msgid "" -"Option for :func:`create_default_context` and :meth:`SSLContext." -"load_default_certs`. This value indicates that the context may be used to " -"authenticate web servers (therefore, it will be used to create client-side " -"sockets)." +"Option for :func:`create_default_context` " +"and :meth:`SSLContext.load_default_certs`. This value indicates that the " +"context may be used to authenticate web servers (therefore, it will be used " +"to create client-side sockets)." msgstr "" ":func:`create_default_context` 和 :meth:`SSLContext.load_default_certs` 的選" "項。此值表示該語境可能會用於驗證網頁伺服器 (因此它將用於建立用戶端 socket)。" #: ../../library/ssl.rst:1004 msgid "" -"Option for :func:`create_default_context` and :meth:`SSLContext." -"load_default_certs`. This value indicates that the context may be used to " -"authenticate web clients (therefore, it will be used to create server-side " -"sockets)." +"Option for :func:`create_default_context` " +"and :meth:`SSLContext.load_default_certs`. This value indicates that the " +"context may be used to authenticate web clients (therefore, it will be used " +"to create server-side sockets)." msgstr "" ":func:`create_default_context` 和 :meth:`SSLContext.load_default_certs` 的選" "項。此值表示該語境可能會用於驗證網頁用戶端 (因此,它將用於建立伺服器端的 " @@ -1371,11 +1381,13 @@ msgstr ":class:`enum.IntEnum` 為 SSL_ERROR_* 常數中的一個集合。" #: ../../library/ssl.rst:1019 msgid "" -":class:`enum.IntEnum` collection of SSL and TLS versions for :attr:" -"`SSLContext.maximum_version` and :attr:`SSLContext.minimum_version`." +":class:`enum.IntEnum` collection of SSL and TLS versions " +"for :attr:`SSLContext.maximum_version` " +"and :attr:`SSLContext.minimum_version`." msgstr "" -"用於 :attr:`SSLContext.maximum_version` 和 :attr:`SSLContext." -"minimum_version` 的 SSL 和 TLS 版本 :class:`enum.IntEnum` 集合。" +"用於 :attr:`SSLContext.maximum_version` " +"和 :attr:`SSLContext.minimum_version` 的 SSL 和 TLS 版" +"本 :class:`enum.IntEnum` 集合。" #: ../../library/ssl.rst:1027 msgid "" @@ -1392,11 +1404,11 @@ msgstr "SSL 3.0 到 TLS 1.3。" #: ../../library/ssl.rst:1041 msgid "" -"All :class:`TLSVersion` members except :attr:`TLSVersion.TLSv1_2` and :attr:" -"`TLSVersion.TLSv1_3` are deprecated." +"All :class:`TLSVersion` members except :attr:`TLSVersion.TLSv1_2` " +"and :attr:`TLSVersion.TLSv1_3` are deprecated." msgstr "" -"除了 :attr:`TLSVersion.TLSv1_2` 和 :attr:`TLSVersion.TLSv1_3` 之外,所有的 :" -"class:`TLSVersion` 成員都已被棄用。" +"除了 :attr:`TLSVersion.TLSv1_2` 和 :attr:`TLSVersion.TLSv1_3` 之外,所有" +"的 :class:`TLSVersion` 成員都已被棄用。" #: ../../library/ssl.rst:1046 msgid "SSL Sockets" @@ -1439,12 +1451,8 @@ msgid ":meth:`~socket.socket.getsockopt`, :meth:`~socket.socket.setsockopt`" msgstr ":meth:`~socket.socket.getsockopt`、:meth:`~socket.socket.setsockopt`" #: ../../library/ssl.rst:1060 -msgid "" -":meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`, :meth:" -"`~socket.socket.setblocking`" -msgstr "" -":meth:`~socket.socket.gettimeout`、:meth:`~socket.socket.settimeout`、:meth:" -"`~socket.socket.setblocking`" +msgid ":meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`, :meth:`~socket.socket.setblocking`" +msgstr ":meth:`~socket.socket.gettimeout`、:meth:`~socket.socket.settimeout`、:meth:`~socket.socket.setblocking`" #: ../../library/ssl.rst:1062 msgid ":meth:`~socket.socket.listen`" @@ -1495,8 +1503,8 @@ msgstr "" #: ../../library/ssl.rst:1077 msgid "" -"Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." -"wrap_socket` method." +"Instances of :class:`SSLSocket` must be created using " +"the :meth:`SSLContext.wrap_socket` method." msgstr "" ":class:`SSLSocket` 的實例必須使用 :meth:`SSLContext.wrap_socket` 方法建立。" @@ -1515,17 +1523,18 @@ msgstr "" #: ../../library/ssl.rst:1088 msgid "" -"It is deprecated to create a :class:`SSLSocket` instance directly, use :meth:" -"`SSLContext.wrap_socket` to wrap a socket." +"It is deprecated to create a :class:`SSLSocket` instance directly, " +"use :meth:`SSLContext.wrap_socket` to wrap a socket." msgstr "" -"直接建立 :class:`SSLSocket` 實例的方式已被棄用,請使用 :meth:`SSLContext." -"wrap_socket` 來包裝 socket。" +"直接建立 :class:`SSLSocket` 實例的方式已被棄用,請使" +"用 :meth:`SSLContext.wrap_socket` 來包裝 socket。" #: ../../library/ssl.rst:1092 msgid "" -":class:`SSLSocket` instances must to created with :meth:`~SSLContext." -"wrap_socket`. In earlier versions, it was possible to create instances " -"directly. This was never documented or officially supported." +":class:`SSLSocket` instances must to created " +"with :meth:`~SSLContext.wrap_socket`. In earlier versions, it was possible " +"to create instances directly. This was never documented or officially " +"supported." msgstr "" ":class:`SSLSocket` 實例必須使用 :meth:`~SSLContext.wrap_socket` 建立。在較早" "的版本中可以直接建立實例,但這從未被記錄或正式支援。" @@ -1554,11 +1563,12 @@ msgstr "" #: ../../library/ssl.rst:1111 msgid "" -"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" -"ref:`non-blocking ` and the read would block." +"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket " +"is :ref:`non-blocking ` and the read would block." msgstr "" -"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" -"`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且讀取操作將會被阻塞。" +"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引" +"發 :exc:`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且讀取操作將會被阻" +"塞。" #: ../../library/ssl.rst:1114 msgid "" @@ -1590,11 +1600,12 @@ msgstr "" #: ../../library/ssl.rst:1130 msgid "" -"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" -"ref:`non-blocking ` and the write would block." +"Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket " +"is :ref:`non-blocking ` and the write would block." msgstr "" -"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" -"`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且寫入操作將會被阻塞。" +"如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引" +"發 :exc:`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且寫入操作將會被阻" +"塞。" #: ../../library/ssl.rst:1133 msgid "" @@ -1620,8 +1631,8 @@ msgid "" "The :meth:`~SSLSocket.read` and :meth:`~SSLSocket.write` methods are the low-" "level methods that read and write unencrypted, application-level data and " "decrypt/encrypt it to encrypted, wire-level data. These methods require an " -"active SSL connection, i.e. the handshake was completed and :meth:`SSLSocket." -"unwrap` was not called." +"active SSL connection, i.e. the handshake was completed " +"and :meth:`SSLSocket.unwrap` was not called." msgstr "" ":meth:`~SSLSocket.read` 和 :meth:`~SSLSocket.write` 方法為低階層的方法,負責" "讀取和寫入未加密的應用層資料,並將其加密/解密為加密的寫入層資料。這些方法需要" @@ -1629,8 +1640,9 @@ msgstr "" #: ../../library/ssl.rst:1151 msgid "" -"Normally you should use the socket API methods like :meth:`~socket.socket." -"recv` and :meth:`~socket.socket.send` instead of these methods." +"Normally you should use the socket API methods " +"like :meth:`~socket.socket.recv` and :meth:`~socket.socket.send` instead of " +"these methods." msgstr "" "通常你應該使用像 :meth:`~socket.socket.recv` 和 :meth:`~socket.socket.send` " "這樣的 socket API 方法,而不是直接使用這些方法。" @@ -1641,12 +1653,13 @@ msgstr "執行 SSL 設定握手。" #: ../../library/ssl.rst:1159 msgid "" -"The handshake method also performs :func:`match_hostname` when the :attr:" -"`~SSLContext.check_hostname` attribute of the socket's :attr:`~SSLSocket." -"context` is true." +"The handshake method also performs :func:`match_hostname` when " +"the :attr:`~SSLContext.check_hostname` attribute of the " +"socket's :attr:`~SSLSocket.context` is true." msgstr "" -"當 socket 的 :attr:`~SSLSocket.context` 的 :attr:`~SSLContext." -"check_hostname` 屬性質為 true 時,握手方法也會執行 :func:`match_hostname`。" +"當 socket 的 :attr:`~SSLSocket.context` " +"的 :attr:`~SSLContext.check_hostname` 屬性質為 true 時,握手方法也會執" +"行 :func:`match_hostname`。" #: ../../library/ssl.rst:1164 msgid "" @@ -1658,23 +1671,23 @@ msgstr "" #: ../../library/ssl.rst:1168 msgid "" -"Hostname or IP address is matched by OpenSSL during handshake. The function :" -"func:`match_hostname` is no longer used. In case OpenSSL refuses a hostname " -"or IP address, the handshake is aborted early and a TLS alert message is " -"sent to the peer." +"Hostname or IP address is matched by OpenSSL during handshake. The " +"function :func:`match_hostname` is no longer used. In case OpenSSL refuses a " +"hostname or IP address, the handshake is aborted early and a TLS alert " +"message is sent to the peer." msgstr "" -"在握手過程中,OpenSSL 會去配對主機名稱或 IP 地址。已不再使用 :func:" -"`match_hostname` 函式。如果 OpenSSL 拒絕某個主機名稱或 IP 地址,握手將會提前" -"中止,並向對方發送 TLS 警報訊息。" +"在握手過程中,OpenSSL 會去配對主機名稱或 IP 地址。已不再使" +"用 :func:`match_hostname` 函式。如果 OpenSSL 拒絕某個主機名稱或 IP 地址,握手" +"將會提前中止,並向對方發送 TLS 警報訊息。" #: ../../library/ssl.rst:1176 msgid "" "If there is no certificate for the peer on the other end of the connection, " -"return ``None``. If the SSL handshake hasn't been done yet, raise :exc:" -"`ValueError`." +"return ``None``. If the SSL handshake hasn't been done yet, " +"raise :exc:`ValueError`." msgstr "" -"如果連線端沒有證書,則回傳 ``None``。如果 SSL 握手尚未完成,則引發 :exc:" -"`ValueError`。" +"如果連線端沒有證書,則回傳 ``None``。如果 SSL 握手尚未完成,則引" +"發 :exc:`ValueError`。" #: ../../library/ssl.rst:1180 msgid "" @@ -1755,8 +1768,8 @@ msgid "" "socket's role:" msgstr "" "如果 ``binary_form`` 參數設定為 :const:`True`,且對等提供了證書,則該方法會" -"以 DER 編碼形式 將整個證書以位元組序列形式回傳。如果對等未提供證書,則回傳 :" -"const:`None`。對等是否提供證書取決於 SSL socket 的腳色:" +"以 DER 編碼形式 將整個證書以位元組序列形式回傳。如果對等未提供證書,則回" +"傳 :const:`None`。對等是否提供證書取決於 SSL socket 的腳色:" #: ../../library/ssl.rst:1219 msgid "" @@ -1767,13 +1780,13 @@ msgstr "對於客戶端 SSL socket,伺服器將永遠提供證書,無論是 #: ../../library/ssl.rst:1222 msgid "" "for a server SSL socket, the client will only provide a certificate when " -"requested by the server; therefore :meth:`getpeercert` will return :const:" -"`None` if you used :const:`CERT_NONE` (rather than :const:`CERT_OPTIONAL` " -"or :const:`CERT_REQUIRED`)." +"requested by the server; therefore :meth:`getpeercert` will " +"return :const:`None` if you used :const:`CERT_NONE` (rather " +"than :const:`CERT_OPTIONAL` or :const:`CERT_REQUIRED`)." msgstr "" "對於伺服器 SSL socket,客戶端僅在伺服器要求時才會提供證書;因此,如果你使用的" -"是 :const:`CERT_NONE` (而非 :const:`CERT_OPTIONAL` 或 :const:" -"`CERT_REQUIRED`),則 :meth:`getpeercert` 會回傳 :const:`None`。" +"是 :const:`CERT_NONE` (而非 :const:`CERT_OPTIONAL` " +"或 :const:`CERT_REQUIRED`),則 :meth:`getpeercert` 會回傳 :const:`None`。" #: ../../library/ssl.rst:1227 msgid "See also :attr:`SSLContext.check_hostname`." @@ -1849,17 +1862,18 @@ msgstr "" msgid "" "The *cb_type* parameter allow selection of the desired channel binding type. " "Valid channel binding types are listed in the :data:`CHANNEL_BINDING_TYPES` " -"list. Currently only the 'tls-unique' channel binding, defined by :rfc:" -"`5929`, is supported. :exc:`ValueError` will be raised if an unsupported " -"channel binding type is requested." +"list. Currently only the 'tls-unique' channel binding, defined " +"by :rfc:`5929`, is supported. :exc:`ValueError` will be raised if an " +"unsupported channel binding type is requested." msgstr "" #: ../../library/ssl.rst:1299 msgid "" -"Return the protocol that was selected during the TLS handshake. If :meth:" -"`SSLContext.set_alpn_protocols` was not called, if the other party does not " -"support ALPN, if this socket does not support any of the client's proposed " -"protocols, or if the handshake has not happened yet, ``None`` is returned." +"Return the protocol that was selected during the TLS handshake. " +"If :meth:`SSLContext.set_alpn_protocols` was not called, if the other party " +"does not support ALPN, if this socket does not support any of the client's " +"proposed protocols, or if the handshake has not happened yet, ``None`` is " +"returned." msgstr "" #: ../../library/ssl.rst:1309 @@ -1887,8 +1901,8 @@ msgstr "" msgid "" "Requests post-handshake authentication (PHA) from a TLS 1.3 client. PHA can " "only be initiated for a TLS 1.3 connection from a server-side socket, after " -"the initial TLS handshake and with PHA enabled on both sides, see :attr:" -"`SSLContext.post_handshake_auth`." +"the initial TLS handshake and with PHA enabled on both sides, " +"see :attr:`SSLContext.post_handshake_auth`." msgstr "" #: ../../library/ssl.rst:1335 @@ -1900,8 +1914,8 @@ msgstr "" #: ../../library/ssl.rst:1339 msgid "" -"If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), an :exc:" -"`SSLError` is raised." +"If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), " +"an :exc:`SSLError` is raised." msgstr "" #: ../../library/ssl.rst:1343 @@ -1945,16 +1959,16 @@ msgstr "" msgid "" "The attribute is now always ASCII text. When ``server_hostname`` is an " "internationalized domain name (IDN), this attribute now stores the A-label " -"form (``\"xn--pythn-mua.org\"``), rather than the U-label form (``\"pythön." -"org\"``)." +"form (``\"xn--pythn-mua.org\"``), rather than the U-label form " +"(``\"pythön.org\"``)." msgstr "" #: ../../library/ssl.rst:1391 msgid "" "The :class:`SSLSession` for this SSL connection. The session is available " "for client and server side sockets after the TLS handshake has been " -"performed. For client sockets the session can be set before :meth:" -"`~SSLSocket.do_handshake` has been called to reuse a session." +"performed. For client sockets the session can be set " +"before :meth:`~SSLSocket.do_handshake` has been called to reuse a session." msgstr "" #: ../../library/ssl.rst:1404 @@ -2084,28 +2098,27 @@ msgstr "" #: ../../library/ssl.rst:1453 msgid "" -"The context is created with secure default values. The options :data:" -"`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:" -"`OP_SINGLE_DH_USE`, :data:`OP_SINGLE_ECDH_USE`, :data:`OP_NO_SSLv2`, and :" -"data:`OP_NO_SSLv3` (except for :data:`PROTOCOL_SSLv3`) are set by default. " -"The initial cipher suite list contains only ``HIGH`` ciphers, no ``NULL`` " -"ciphers and no ``MD5`` ciphers." +"The context is created with secure default values. The " +"options :data:`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:`OP_SINGLE_DH_USE`, :data:`OP_SINGLE_ECDH_USE`, :data:`OP_NO_SSLv2`, " +"and :data:`OP_NO_SSLv3` (except for :data:`PROTOCOL_SSLv3`) are set by " +"default. The initial cipher suite list contains only ``HIGH`` ciphers, no " +"``NULL`` ciphers and no ``MD5`` ciphers." msgstr "" #: ../../library/ssl.rst:1463 msgid "" ":class:`SSLContext` without protocol argument is deprecated. The context " -"class will either require :data:`PROTOCOL_TLS_CLIENT` or :data:" -"`PROTOCOL_TLS_SERVER` protocol in the future." +"class will either require :data:`PROTOCOL_TLS_CLIENT` " +"or :data:`PROTOCOL_TLS_SERVER` protocol in the future." msgstr "" #: ../../library/ssl.rst:1469 msgid "" "The default cipher suites now include only secure AES and ChaCha20 ciphers " "with forward secrecy and security level 2. RSA and DH keys with less than " -"2048 bits and ECC keys with less than 224 bits are prohibited. :data:" -"`PROTOCOL_TLS`, :data:`PROTOCOL_TLS_CLIENT`, and :data:`PROTOCOL_TLS_SERVER` " -"use TLS 1.2 as minimum TLS version." +"2048 bits and ECC keys with less than 224 bits are " +"prohibited. :data:`PROTOCOL_TLS`, :data:`PROTOCOL_TLS_CLIENT`, " +"and :data:`PROTOCOL_TLS_SERVER` use TLS 1.2 as minimum TLS version." msgstr "" #: ../../library/ssl.rst:1477 @@ -2190,9 +2203,9 @@ msgstr "" msgid "" "Load a set of default \"certification authority\" (CA) certificates from " "default locations. On Windows it loads CA certs from the ``CA`` and ``ROOT`` " -"system stores. On all systems it calls :meth:`SSLContext." -"set_default_verify_paths`. In the future the method may load CA certificates " -"from other locations, too." +"system stores. On all systems it " +"calls :meth:`SSLContext.set_default_verify_paths`. In the future the method " +"may load CA certificates from other locations, too." msgstr "" #: ../../library/ssl.rst:1543 @@ -2207,8 +2220,9 @@ msgstr "" #: ../../library/ssl.rst:1553 msgid "" "Load a set of \"certification authority\" (CA) certificates used to validate " -"other peers' certificates when :data:`verify_mode` is other than :data:" -"`CERT_NONE`. At least one of *cafile* or *capath* must be specified." +"other peers' certificates when :data:`verify_mode` is other " +"than :data:`CERT_NONE`. At least one of *cafile* or *capath* must be " +"specified." msgstr "" #: ../../library/ssl.rst:1557 @@ -2262,8 +2276,8 @@ msgstr "" #: ../../library/ssl.rst:1596 msgid "" -"Get a list of enabled ciphers. The list is in order of cipher priority. See :" -"meth:`SSLContext.set_ciphers`." +"Get a list of enabled ciphers. The list is in order of cipher priority. " +"See :meth:`SSLContext.set_ciphers`." msgstr "" #: ../../library/ssl.rst:1601 @@ -2351,16 +2365,16 @@ msgstr "" #: ../../library/ssl.rst:1653 msgid "" -"TLS 1.3 cipher suites cannot be disabled with :meth:`~SSLContext." -"set_ciphers`." +"TLS 1.3 cipher suites cannot be disabled " +"with :meth:`~SSLContext.set_ciphers`." msgstr "" #: ../../library/ssl.rst:1658 msgid "" "Specify which protocols the socket should advertise during the SSL/TLS " -"handshake. It should be a list of ASCII strings, like ``['http/1.1', " -"'spdy/2']``, ordered by preference. The selection of a protocol will happen " -"during the handshake, and will play out according to :rfc:`7301`. After a " +"handshake. It should be a list of ASCII strings, like ``['http/1.1', 'spdy/" +"2']``, ordered by preference. The selection of a protocol will happen during " +"the handshake, and will play out according to :rfc:`7301`. After a " "successful handshake, the :meth:`SSLSocket.selected_alpn_protocol` method " "will return the agreed-upon protocol." msgstr "" @@ -2378,9 +2392,9 @@ msgid "" "ordered by preference. The selection of a protocol will happen during the " "handshake, and will play out according to the `Application Layer Protocol " "Negotiation `_. After a successful handshake, the :meth:" -"`SSLSocket.selected_npn_protocol` method will return the agreed-upon " -"protocol." +"Layer_Protocol_Negotiation>`_. After a successful handshake, " +"the :meth:`SSLSocket.selected_npn_protocol` method will return the agreed-" +"upon protocol." msgstr "" #: ../../library/ssl.rst:1680 @@ -2417,37 +2431,37 @@ msgstr "" #: ../../library/ssl.rst:1708 msgid "" -"A typical use of this callback is to change the :class:`ssl.SSLSocket`'s :" -"attr:`SSLSocket.context` attribute to a new object of type :class:" -"`SSLContext` representing a certificate chain that matches the server name." +"A typical use of this callback is to change " +"the :class:`ssl.SSLSocket`'s :attr:`SSLSocket.context` attribute to a new " +"object of type :class:`SSLContext` representing a certificate chain that " +"matches the server name." msgstr "" #: ../../library/ssl.rst:1713 msgid "" "Due to the early negotiation phase of the TLS connection, only limited " -"methods and attributes are usable like :meth:`SSLSocket." -"selected_alpn_protocol` and :attr:`SSLSocket.context`. The :meth:`SSLSocket." -"getpeercert`, :meth:`SSLSocket.get_verified_chain`, :meth:`SSLSocket." -"get_unverified_chain` :meth:`SSLSocket.cipher` and :meth:`SSLSocket." -"compression` methods require that the TLS connection has progressed beyond " -"the TLS Client Hello and therefore will not return meaningful values nor can " -"they be called safely." +"methods and attributes are usable " +"like :meth:`SSLSocket.selected_alpn_protocol` and :attr:`SSLSocket.context`. " +"The :meth:`SSLSocket.getpeercert`, :meth:`SSLSocket.get_verified_chain`, :meth:`SSLSocket.get_unverified_chain` :meth:`SSLSocket.cipher` " +"and :meth:`SSLSocket.compression` methods require that the TLS connection " +"has progressed beyond the TLS Client Hello and therefore will not return " +"meaningful values nor can they be called safely." msgstr "" #: ../../library/ssl.rst:1722 msgid "" "The *sni_callback* function must return ``None`` to allow the TLS " -"negotiation to continue. If a TLS failure is required, a constant :const:" -"`ALERT_DESCRIPTION_* ` can be returned. " -"Other return values will result in a TLS fatal error with :const:" -"`ALERT_DESCRIPTION_INTERNAL_ERROR`." +"negotiation to continue. If a TLS failure is required, a " +"constant :const:`ALERT_DESCRIPTION_* ` can " +"be returned. Other return values will result in a TLS fatal error " +"with :const:`ALERT_DESCRIPTION_INTERNAL_ERROR`." msgstr "" #: ../../library/ssl.rst:1728 msgid "" "If an exception is raised from the *sni_callback* function the TLS " -"connection will terminate with a fatal TLS alert message :const:" -"`ALERT_DESCRIPTION_HANDSHAKE_FAILURE`." +"connection will terminate with a fatal TLS alert " +"message :const:`ALERT_DESCRIPTION_HANDSHAKE_FAILURE`." msgstr "" #: ../../library/ssl.rst:1732 @@ -2483,8 +2497,8 @@ msgstr "" #: ../../library/ssl.rst:1759 msgid "" -"This setting doesn't apply to client sockets. You can also use the :data:" -"`OP_SINGLE_DH_USE` option to further improve security." +"This setting doesn't apply to client sockets. You can also use " +"the :data:`OP_SINGLE_DH_USE` option to further improve security." msgstr "" #: ../../library/ssl.rst:1766 @@ -2498,8 +2512,8 @@ msgstr "" #: ../../library/ssl.rst:1772 msgid "" -"This setting doesn't apply to client sockets. You can also use the :data:" -"`OP_SINGLE_ECDH_USE` option to further improve security." +"This setting doesn't apply to client sockets. You can also use " +"the :data:`OP_SINGLE_ECDH_USE` option to further improve security." msgstr "" #: ../../library/ssl.rst:1775 @@ -2518,10 +2532,11 @@ msgstr "" #: ../../library/ssl.rst:1787 msgid "" -"Wrap an existing Python socket *sock* and return an instance of :attr:" -"`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The returned SSL " -"socket is tied to the context, its settings and certificates. *sock* must be " -"a :const:`~socket.SOCK_STREAM` socket; other socket types are unsupported." +"Wrap an existing Python socket *sock* and return an instance " +"of :attr:`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The " +"returned SSL socket is tied to the context, its settings and certificates. " +"*sock* must be a :const:`~socket.SOCK_STREAM` socket; other socket types are " +"unsupported." msgstr "" #: ../../library/ssl.rst:1793 @@ -2537,8 +2552,8 @@ msgid "" "after :meth:`connect` is called on the socket. For server-side sockets, if " "the socket has no remote peer, it is assumed to be a listening socket, and " "the server-side SSL wrapping is automatically performed on client " -"connections accepted via the :meth:`accept` method. The method may raise :" -"exc:`SSLError`." +"connections accepted via the :meth:`accept` method. The method may " +"raise :exc:`SSLError`." msgstr "" #: ../../library/ssl.rst:1804 @@ -2554,20 +2569,20 @@ msgstr "" msgid "" "The parameter ``do_handshake_on_connect`` specifies whether to do the SSL " "handshake automatically after doing a :meth:`socket.connect`, or whether the " -"application program will call it explicitly, by invoking the :meth:" -"`SSLSocket.do_handshake` method. Calling :meth:`SSLSocket.do_handshake` " -"explicitly gives the program control over the blocking behavior of the " -"socket I/O involved in the handshake." +"application program will call it explicitly, by invoking " +"the :meth:`SSLSocket.do_handshake` method. " +"Calling :meth:`SSLSocket.do_handshake` explicitly gives the program control " +"over the blocking behavior of the socket I/O involved in the handshake." msgstr "" #: ../../library/ssl.rst:1817 msgid "" -"The parameter ``suppress_ragged_eofs`` specifies how the :meth:`SSLSocket." -"recv` method should signal unexpected EOF from the other end of the " -"connection. If specified as :const:`True` (the default), it returns a " -"normal EOF (an empty bytes object) in response to unexpected EOF errors " -"raised from the underlying socket; if :const:`False`, it will raise the " -"exceptions back to the caller." +"The parameter ``suppress_ragged_eofs`` specifies how " +"the :meth:`SSLSocket.recv` method should signal unexpected EOF from the " +"other end of the connection. If specified as :const:`True` (the default), " +"it returns a normal EOF (an empty bytes object) in response to unexpected " +"EOF errors raised from the underlying socket; if :const:`False`, it will " +"raise the exceptions back to the caller." msgstr "" #: ../../library/ssl.rst:1824 @@ -2576,8 +2591,8 @@ msgstr "" #: ../../library/ssl.rst:1826 msgid "" -"To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, use :meth:" -"`SSLContext.wrap_bio`." +"To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, " +"use :meth:`SSLContext.wrap_bio`." msgstr "" #: ../../library/ssl.rst:1829 @@ -2598,15 +2613,15 @@ msgstr "" #: ../../library/ssl.rst:1842 msgid "" -"The return type of :meth:`SSLContext.wrap_socket`, defaults to :class:" -"`SSLSocket`. The attribute can be overridden on instance of class in order " -"to return a custom subclass of :class:`SSLSocket`." +"The return type of :meth:`SSLContext.wrap_socket`, defaults " +"to :class:`SSLSocket`. The attribute can be overridden on instance of class " +"in order to return a custom subclass of :class:`SSLSocket`." msgstr "" #: ../../library/ssl.rst:1851 msgid "" -"Wrap the BIO objects *incoming* and *outgoing* and return an instance of :" -"attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " +"Wrap the BIO objects *incoming* and *outgoing* and return an instance " +"of :attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " "routines will read input data from the incoming BIO and write data to the " "outgoing BIO." msgstr "" @@ -2625,9 +2640,9 @@ msgstr "" #: ../../library/ssl.rst:1868 msgid "" -"The return type of :meth:`SSLContext.wrap_bio`, defaults to :class:" -"`SSLObject`. The attribute can be overridden on instance of class in order " -"to return a custom subclass of :class:`SSLObject`." +"The return type of :meth:`SSLContext.wrap_bio`, defaults " +"to :class:`SSLObject`. The attribute can be overridden on instance of class " +"in order to return a custom subclass of :class:`SSLObject`." msgstr "" #: ../../library/ssl.rst:1876 @@ -2652,14 +2667,15 @@ msgstr "" #: ../../library/ssl.rst:1887 msgid "" "Whether to match the peer cert's hostname in :meth:`SSLSocket.do_handshake`. " -"The context's :attr:`~SSLContext.verify_mode` must be set to :data:" -"`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, and you must pass " +"The context's :attr:`~SSLContext.verify_mode` must be set " +"to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, and you must pass " "*server_hostname* to :meth:`~SSLContext.wrap_socket` in order to match the " -"hostname. Enabling hostname checking automatically sets :attr:`~SSLContext." -"verify_mode` from :data:`CERT_NONE` to :data:`CERT_REQUIRED`. It cannot be " -"set back to :data:`CERT_NONE` as long as hostname checking is enabled. The :" -"data:`PROTOCOL_TLS_CLIENT` protocol enables hostname checking by default. " -"With other protocols, hostname checking must be enabled explicitly." +"hostname. Enabling hostname checking automatically " +"sets :attr:`~SSLContext.verify_mode` from :data:`CERT_NONE` " +"to :data:`CERT_REQUIRED`. It cannot be set back to :data:`CERT_NONE` as " +"long as hostname checking is enabled. The :data:`PROTOCOL_TLS_CLIENT` " +"protocol enables hostname checking by default. With other protocols, " +"hostname checking must be enabled explicitly." msgstr "" #: ../../library/ssl.rst:1900 @@ -2688,10 +2704,10 @@ msgstr "" #: ../../library/ssl.rst:1915 msgid "" -":attr:`~SSLContext.verify_mode` is now automatically changed to :data:" -"`CERT_REQUIRED` when hostname checking is enabled and :attr:`~SSLContext." -"verify_mode` is :data:`CERT_NONE`. Previously the same operation would have " -"failed with a :exc:`ValueError`." +":attr:`~SSLContext.verify_mode` is now automatically changed " +"to :data:`CERT_REQUIRED` when hostname checking is enabled " +"and :attr:`~SSLContext.verify_mode` is :data:`CERT_NONE`. Previously the " +"same operation would have failed with a :exc:`ValueError`." msgstr "" #: ../../library/ssl.rst:1922 @@ -2707,18 +2723,20 @@ msgstr "" msgid "" "A :class:`TLSVersion` enum member representing the highest supported TLS " "version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`. The " -"attribute is read-only for protocols other than :const:`PROTOCOL_TLS`, :" -"const:`PROTOCOL_TLS_CLIENT`, and :const:`PROTOCOL_TLS_SERVER`." +"attribute is read-only for protocols other " +"than :const:`PROTOCOL_TLS`, :const:`PROTOCOL_TLS_CLIENT`, " +"and :const:`PROTOCOL_TLS_SERVER`." msgstr "" #: ../../library/ssl.rst:1937 msgid "" -"The attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext." -"minimum_version` and :attr:`SSLContext.options` all affect the supported SSL " -"and TLS versions of the context. The implementation does not prevent invalid " -"combination. For example a context with :attr:`OP_NO_TLSv1_2` in :attr:" -"`~SSLContext.options` and :attr:`~SSLContext.maximum_version` set to :attr:" -"`TLSVersion.TLSv1_2` will not be able to establish a TLS 1.2 connection." +"The " +"attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext.minimum_version` " +"and :attr:`SSLContext.options` all affect the supported SSL and TLS versions " +"of the context. The implementation does not prevent invalid combination. For " +"example a context with :attr:`OP_NO_TLSv1_2` in :attr:`~SSLContext.options` " +"and :attr:`~SSLContext.maximum_version` set to :attr:`TLSVersion.TLSv1_2` " +"will not be able to establish a TLS 1.2 connection." msgstr "" #: ../../library/ssl.rst:1950 @@ -2729,16 +2747,16 @@ msgstr "" #: ../../library/ssl.rst:1957 msgid "" -"Control the number of TLS 1.3 session tickets of a :const:" -"`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 to 1.2 " -"connections." +"Control the number of TLS 1.3 session tickets of " +"a :const:`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 " +"to 1.2 connections." msgstr "" #: ../../library/ssl.rst:1965 msgid "" "An integer representing the set of SSL options enabled on this context. The " -"default value is :data:`OP_ALL`, but you can specify other options such as :" -"data:`OP_NO_SSLv2` by ORing them together." +"default value is :data:`OP_ALL`, but you can specify other options such " +"as :data:`OP_NO_SSLv2` by ORing them together." msgstr "" #: ../../library/ssl.rst:1969 @@ -2748,8 +2766,8 @@ msgstr "" #: ../../library/ssl.rst:1977 msgid "" "All ``OP_NO_SSL*`` and ``OP_NO_TLS*`` options have been deprecated since " -"Python 3.7. Use :attr:`SSLContext.minimum_version` and :attr:`SSLContext." -"maximum_version` instead." +"Python 3.7. Use :attr:`SSLContext.minimum_version` " +"and :attr:`SSLContext.maximum_version` instead." msgstr "" #: ../../library/ssl.rst:1983 @@ -2770,8 +2788,9 @@ msgstr "" msgid "" "When enabled on server-side sockets, :attr:`SSLContext.verify_mode` must be " "set to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, too. The actual " -"client cert exchange is delayed until :meth:`SSLSocket." -"verify_client_post_handshake` is called and some I/O is performed." +"client cert exchange is delayed " +"until :meth:`SSLSocket.verify_client_post_handshake` is called and some I/O " +"is performed." msgstr "" #: ../../library/ssl.rst:2001 @@ -2802,9 +2821,9 @@ msgstr "" #: ../../library/ssl.rst:2027 msgid "" -"The flags for certificate verification operations. You can set flags like :" -"data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default OpenSSL does " -"neither require nor verify certificate revocation lists (CRLs)." +"The flags for certificate verification operations. You can set flags " +"like :data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default " +"OpenSSL does neither require nor verify certificate revocation lists (CRLs)." msgstr "" #: ../../library/ssl.rst:2033 @@ -2814,8 +2833,8 @@ msgstr "" #: ../../library/ssl.rst:2041 msgid "" "Whether to try to verify other peers' certificates and how to behave if " -"verification fails. This attribute must be one of :data:`CERT_NONE`, :data:" -"`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." +"verification fails. This attribute must be one " +"of :data:`CERT_NONE`, :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." msgstr "" #: ../../library/ssl.rst:2045 @@ -2862,9 +2881,8 @@ msgid "client-identity must be a non-empty string." msgstr "" #: ../../library/ssl.rst:2075 ../../library/ssl.rst:2122 -#, fuzzy msgid "Example usage::" -msgstr "範例: ::" +msgstr "範例用法: ::" #: ../../library/ssl.rst:2077 msgid "" @@ -3051,9 +3069,9 @@ msgid "" "certificate chains for each issuer you are willing to trust. Again, this " "file just contains these chains concatenated together. For validation, " "Python will use the first chain it finds in the file which matches. The " -"platform's certificates file can be used by calling :meth:`SSLContext." -"load_default_certs`, this is done automatically with :func:`." -"create_default_context`." +"platform's certificates file can be used by " +"calling :meth:`SSLContext.load_default_certs`, this is done automatically " +"with :func:`.create_default_context`." msgstr "" #: ../../library/ssl.rst:2228 @@ -3200,8 +3218,8 @@ msgstr "" #: ../../library/ssl.rst:2320 msgid "" -"When you use the context to connect to a server, :const:`CERT_REQUIRED` and :" -"attr:`~SSLContext.check_hostname` validate the server certificate: it " +"When you use the context to connect to a server, :const:`CERT_REQUIRED` " +"and :attr:`~SSLContext.check_hostname` validate the server certificate: it " "ensures that the server certificate was signed with one of the CA " "certificates, checks the signature for correctness, and verifies other " "properties like validity and identity of the hostname::" @@ -3237,10 +3255,10 @@ msgid "" "{'OCSP': ('http://ocsp.digicert.com/',),\n" " 'caIssuers': ('http://cacerts.digicert.com/" "DigiCertSHA2ExtendedValidationServerCA.crt',),\n" -" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g1." -"crl',\n" -" 'http://crl4.digicert.com/sha2-ev-server-g1." -"crl'),\n" +" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-" +"g1.crl',\n" +" 'http://crl4.digicert.com/sha2-ev-server-" +"g1.crl'),\n" " 'issuer': ((('countryName', 'US'),),\n" " (('organizationName', 'DigiCert Inc'),),\n" " (('organizationalUnitName', 'www.digicert.com'),),\n" @@ -3281,10 +3299,10 @@ msgstr "" "{'OCSP': ('http://ocsp.digicert.com/',),\n" " 'caIssuers': ('http://cacerts.digicert.com/" "DigiCertSHA2ExtendedValidationServerCA.crt',),\n" -" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g1." -"crl',\n" -" 'http://crl4.digicert.com/sha2-ev-server-g1." -"crl'),\n" +" 'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-" +"g1.crl',\n" +" 'http://crl4.digicert.com/sha2-ev-server-" +"g1.crl'),\n" " 'issuer': ((('countryName', 'US'),),\n" " (('organizationName', 'DigiCert Inc'),),\n" " (('organizationalUnitName', 'www.digicert.com'),),\n" @@ -3405,8 +3423,9 @@ msgstr "" #: ../../library/ssl.rst:2421 msgid "" "When a client connects, you'll call :meth:`accept` on the socket to get the " -"new socket from the other end, and use the context's :meth:`SSLContext." -"wrap_socket` method to create a server-side SSL socket for the connection::" +"new socket from the other end, and use the " +"context's :meth:`SSLContext.wrap_socket` method to create a server-side SSL " +"socket for the connection::" msgstr "" #: ../../library/ssl.rst:2425 @@ -3473,10 +3492,10 @@ msgid "" "Most :class:`SSLSocket` methods will raise either :exc:`SSLWantWriteError` " "or :exc:`SSLWantReadError` instead of :exc:`BlockingIOError` if an I/O " "operation would block. :exc:`SSLWantReadError` will be raised if a read " -"operation on the underlying socket is necessary, and :exc:" -"`SSLWantWriteError` for a write operation on the underlying socket. Note " -"that attempts to *write* to an SSL socket may require *reading* from the " -"underlying socket first, and attempts to *read* from the SSL socket may " +"operation on the underlying socket is necessary, " +"and :exc:`SSLWantWriteError` for a write operation on the underlying socket. " +"Note that attempts to *write* to an SSL socket may require *reading* from " +"the underlying socket first, and attempts to *read* from the SSL socket may " "require a prior *write* to the underlying socket." msgstr "" @@ -3492,8 +3511,8 @@ msgid "" "read from (or written to), but it does not imply that there is sufficient " "data at the upper SSL layer. For example, only part of an SSL frame might " "have arrived. Therefore, you must be ready to handle :meth:`SSLSocket.recv` " -"and :meth:`SSLSocket.send` failures, and retry after another call to :func:" -"`~select.select`." +"and :meth:`SSLSocket.send` failures, and retry after another call " +"to :func:`~select.select`." msgstr "" #: ../../library/ssl.rst:2485 @@ -3507,16 +3526,16 @@ msgstr "" #: ../../library/ssl.rst:2491 msgid "" -"(of course, similar provisions apply when using other primitives such as :" -"func:`~select.poll`, or those in the :mod:`selectors` module)" +"(of course, similar provisions apply when using other primitives such " +"as :func:`~select.poll`, or those in the :mod:`selectors` module)" msgstr "" #: ../../library/ssl.rst:2494 msgid "" -"The SSL handshake itself will be non-blocking: the :meth:`SSLSocket." -"do_handshake` method has to be retried until it returns successfully. Here " -"is a synopsis using :func:`~select.select` to wait for the socket's " -"readiness::" +"The SSL handshake itself will be non-blocking: " +"the :meth:`SSLSocket.do_handshake` method has to be retried until it returns " +"successfully. Here is a synopsis using :func:`~select.select` to wait for " +"the socket's readiness::" msgstr "" #: ../../library/ssl.rst:2499 @@ -3544,9 +3563,9 @@ msgid "" "The :mod:`asyncio` module supports :ref:`non-blocking SSL sockets ` and provides a higher level :ref:`Streams API `. It polls for events using the :mod:`selectors` module and " -"handles :exc:`SSLWantWriteError`, :exc:`SSLWantReadError` and :exc:" -"`BlockingIOError` exceptions. It runs the SSL handshake asynchronously as " -"well." +"handles :exc:`SSLWantWriteError`, :exc:`SSLWantReadError` " +"and :exc:`BlockingIOError` exceptions. It runs the SSL handshake " +"asynchronously as well." msgstr "" #: ../../library/ssl.rst:2519 @@ -3555,8 +3574,8 @@ msgstr "" #: ../../library/ssl.rst:2523 msgid "" -"Ever since the SSL module was introduced in Python 2.6, the :class:" -"`SSLSocket` class has provided two related but distinct areas of " +"Ever since the SSL module was introduced in Python 2.6, " +"the :class:`SSLSocket` class has provided two related but distinct areas of " "functionality:" msgstr "" @@ -3581,11 +3600,11 @@ msgid "" "Combining SSL protocol handling and network IO usually works well, but there " "are some cases where it doesn't. An example is async IO frameworks that want " "to use a different IO multiplexing model than the \"select/poll on a file " -"descriptor\" (readiness based) model that is assumed by :class:`socket." -"socket` and by the internal OpenSSL socket IO routines. This is mostly " -"relevant for platforms like Windows where this model is not efficient. For " -"this purpose, a reduced scope variant of :class:`SSLSocket` called :class:" -"`SSLObject` is provided." +"descriptor\" (readiness based) model that is assumed " +"by :class:`socket.socket` and by the internal OpenSSL socket IO routines. " +"This is mostly relevant for platforms like Windows where this model is not " +"efficient. For this purpose, a reduced scope variant of :class:`SSLSocket` " +"called :class:`SSLObject` is provided." msgstr "" #: ../../library/ssl.rst:2545 @@ -3722,8 +3741,8 @@ msgstr "" #: ../../library/ssl.rst:2595 msgid "" "There is no handling of *suppress_ragged_eofs*. All end-of-file conditions " -"that are in violation of the protocol are reported via the :exc:" -"`SSLEOFError` exception." +"that are in violation of the protocol are reported via " +"the :exc:`SSLEOFError` exception." msgstr "" #: ../../library/ssl.rst:2599 @@ -3734,9 +3753,9 @@ msgstr "" #: ../../library/ssl.rst:2602 msgid "" -"The *server_name_callback* callback passed to :meth:`SSLContext." -"set_servername_callback` will get an :class:`SSLObject` instance instead of " -"a :class:`SSLSocket` instance as its first parameter." +"The *server_name_callback* callback passed " +"to :meth:`SSLContext.set_servername_callback` will get an :class:`SSLObject` " +"instance instead of a :class:`SSLSocket` instance as its first parameter." msgstr "" #: ../../library/ssl.rst:2606 @@ -3746,15 +3765,16 @@ msgstr "" #: ../../library/ssl.rst:2608 msgid "" "All IO on an :class:`SSLObject` is :ref:`non-blocking `. " -"This means that for example :meth:`~SSLSocket.read` will raise an :exc:" -"`SSLWantReadError` if it needs more data than the incoming BIO has available." +"This means that for example :meth:`~SSLSocket.read` will raise " +"an :exc:`SSLWantReadError` if it needs more data than the incoming BIO has " +"available." msgstr "" #: ../../library/ssl.rst:2613 msgid "" -":class:`SSLObject` instances must be created with :meth:`~SSLContext." -"wrap_bio`. In earlier versions, it was possible to create instances " -"directly. This was never documented or officially supported." +":class:`SSLObject` instances must be created " +"with :meth:`~SSLContext.wrap_bio`. In earlier versions, it was possible to " +"create instances directly. This was never documented or officially supported." msgstr "" #: ../../library/ssl.rst:2619 @@ -3824,11 +3844,11 @@ msgstr "" #: ../../library/ssl.rst:2681 msgid "" "For **client use**, if you don't have any special requirements for your " -"security policy, it is highly recommended that you use the :func:" -"`create_default_context` function to create your SSL context. It will load " -"the system's trusted CA certificates, enable certificate validation and " -"hostname checking, and try to choose reasonably secure protocol and cipher " -"settings." +"security policy, it is highly recommended that you use " +"the :func:`create_default_context` function to create your SSL context. It " +"will load the system's trusted CA certificates, enable certificate " +"validation and hostname checking, and try to choose reasonably secure " +"protocol and cipher settings." msgstr "" #: ../../library/ssl.rst:2688 @@ -3853,16 +3873,16 @@ msgstr "" #: ../../library/ssl.rst:2697 msgid "" -"If a client certificate is needed for the connection, it can be added with :" -"meth:`SSLContext.load_cert_chain`." +"If a client certificate is needed for the connection, it can be added " +"with :meth:`SSLContext.load_cert_chain`." msgstr "" #: ../../library/ssl.rst:2700 msgid "" -"By contrast, if you create the SSL context by calling the :class:" -"`SSLContext` constructor yourself, it will not have certificate validation " -"nor hostname checking enabled by default. If you do so, please read the " -"paragraphs below to achieve a good security level." +"By contrast, if you create the SSL context by calling " +"the :class:`SSLContext` constructor yourself, it will not have certificate " +"validation nor hostname checking enabled by default. If you do so, please " +"read the paragraphs below to achieve a good security level." msgstr "" #: ../../library/ssl.rst:2706 @@ -3875,23 +3895,23 @@ msgstr "驗證憑證" #: ../../library/ssl.rst:2711 msgid "" -"When calling the :class:`SSLContext` constructor directly, :const:" -"`CERT_NONE` is the default. Since it does not authenticate the other peer, " -"it can be insecure, especially in client mode where most of the time you " -"would like to ensure the authenticity of the server you're talking to. " -"Therefore, when in client mode, it is highly recommended to use :const:" -"`CERT_REQUIRED`. However, it is in itself not sufficient; you also have to " -"check that the server certificate, which can be obtained by calling :meth:" -"`SSLSocket.getpeercert`, matches the desired service. For many protocols " -"and applications, the service can be identified by the hostname. This common " -"check is automatically performed when :attr:`SSLContext.check_hostname` is " -"enabled." +"When calling the :class:`SSLContext` constructor " +"directly, :const:`CERT_NONE` is the default. Since it does not authenticate " +"the other peer, it can be insecure, especially in client mode where most of " +"the time you would like to ensure the authenticity of the server you're " +"talking to. Therefore, when in client mode, it is highly recommended to " +"use :const:`CERT_REQUIRED`. However, it is in itself not sufficient; you " +"also have to check that the server certificate, which can be obtained by " +"calling :meth:`SSLSocket.getpeercert`, matches the desired service. For " +"many protocols and applications, the service can be identified by the " +"hostname. This common check is automatically performed " +"when :attr:`SSLContext.check_hostname` is enabled." msgstr "" #: ../../library/ssl.rst:2723 msgid "" -"Hostname matchings is now performed by OpenSSL. Python no longer uses :func:" -"`match_hostname`." +"Hostname matchings is now performed by OpenSSL. Python no longer " +"uses :func:`match_hostname`." msgstr "" #: ../../library/ssl.rst:2727 @@ -3910,9 +3930,9 @@ msgstr "協定版本" msgid "" "SSL versions 2 and 3 are considered insecure and are therefore dangerous to " "use. If you want maximum compatibility between clients and servers, it is " -"recommended to use :const:`PROTOCOL_TLS_CLIENT` or :const:" -"`PROTOCOL_TLS_SERVER` as the protocol version. SSLv2 and SSLv3 are disabled " -"by default." +"recommended to use :const:`PROTOCOL_TLS_CLIENT` " +"or :const:`PROTOCOL_TLS_SERVER` as the protocol version. SSLv2 and SSLv3 are " +"disabled by default." msgstr "" #: ../../library/ssl.rst:2743 @@ -3928,9 +3948,9 @@ msgstr "" #: ../../library/ssl.rst:2748 msgid "" "The SSL context created above will only allow TLSv1.3 and later (if " -"supported by your system) connections to a server. :const:" -"`PROTOCOL_TLS_CLIENT` implies certificate validation and hostname checks by " -"default. You have to load certificates into the context." +"supported by your system) connections to a " +"server. :const:`PROTOCOL_TLS_CLIENT` implies certificate validation and " +"hostname checks by default. You have to load certificates into the context." msgstr "" #: ../../library/ssl.rst:2755 @@ -3940,14 +3960,14 @@ msgstr "" #: ../../library/ssl.rst:2757 msgid "" "If you have advanced security requirements, fine-tuning of the ciphers " -"enabled when negotiating a SSL session is possible through the :meth:" -"`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the ssl module " -"disables certain weak ciphers by default, but you may want to further " -"restrict the cipher choice. Be sure to read OpenSSL's documentation about " -"the `cipher list format `_. If you want to check which ciphers are enabled by a given " -"cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl ciphers`` " -"command on your system." +"enabled when negotiating a SSL session is possible through " +"the :meth:`SSLContext.set_ciphers` method. Starting from Python 3.2.3, the " +"ssl module disables certain weak ciphers by default, but you may want to " +"further restrict the cipher choice. Be sure to read OpenSSL's documentation " +"about the `cipher list format `_. If you want to check which ciphers are enabled by a " +"given cipher list, use :meth:`SSLContext.get_ciphers` or the ``openssl " +"ciphers`` command on your system." msgstr "" #: ../../library/ssl.rst:2768 @@ -3978,9 +3998,9 @@ msgstr "" #: ../../library/ssl.rst:2789 msgid "" "TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and ChaCha20 " -"cipher suites are enabled by default. The method :meth:`SSLContext." -"set_ciphers` cannot enable or disable any TLS 1.3 ciphers yet, but :meth:" -"`SSLContext.get_ciphers` returns them." +"cipher suites are enabled by default. The " +"method :meth:`SSLContext.set_ciphers` cannot enable or disable any TLS 1.3 " +"ciphers yet, but :meth:`SSLContext.get_ciphers` returns them." msgstr "" #: ../../library/ssl.rst:2793 diff --git a/library/statistics.po b/library/statistics.po index 1337bd2d8f..30c55ed953 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2023-07-22 21:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -47,19 +47,20 @@ msgstr "" #: ../../library/statistics.rst:31 msgid "" -"Unless explicitly noted, these functions support :class:`int`, :class:" -"`float`, :class:`~decimal.Decimal` and :class:`~fractions.Fraction`. " -"Behaviour with other types (whether in the numeric tower or not) is " -"currently unsupported. Collections with a mix of types are also undefined " -"and implementation-dependent. If your input data consists of mixed types, " -"you may be able to use :func:`map` to ensure a consistent result, for " -"example: ``map(float, input_data)``." -msgstr "" -"除非特別註明,這些函數支援 :class:`int`、:class:`float`、:class:`~decimal." -"Decimal` 以及 :class:`~fractions.Fraction`。目前不支援其他型別(無論是否為數" -"值型別)。含有混合型別的資料的集合亦是尚未定義,且取決於該型別的實作。若你的" -"輸入資料含有混合型別,你可以考慮使用 :func:`map` 來確保結果是一致的,例如:" -"``map(float, input_data)``。" +"Unless explicitly noted, these functions " +"support :class:`int`, :class:`float`, :class:`~decimal.Decimal` " +"and :class:`~fractions.Fraction`. Behaviour with other types (whether in the " +"numeric tower or not) is currently unsupported. Collections with a mix of " +"types are also undefined and implementation-dependent. If your input data " +"consists of mixed types, you may be able to use :func:`map` to ensure a " +"consistent result, for example: ``map(float, input_data)``." +msgstr "" +"除非特別註明,這些函數支" +"援 :class:`int`、:class:`float`、:class:`~decimal.Decimal` 以" +"及 :class:`~fractions.Fraction`。目前不支援其他型別(無論是否為數值型別)。含" +"有混合型別的資料的集合亦是尚未定義,且取決於該型別的實作。若你的輸入資料含有" +"混合型別,你可以考慮使用 :func:`map` 來確保結果是一致的,例如:``map(float, " +"input_data)``。" #: ../../library/statistics.rst:39 msgid "" @@ -386,13 +387,13 @@ msgstr "將 *data* 轉換為浮點數並計算其算數平均數。" #: ../../library/statistics.rst:168 msgid "" -"This runs faster than the :func:`mean` function and it always returns a :" -"class:`float`. The *data* may be a sequence or iterable. If the input " +"This runs faster than the :func:`mean` function and it always returns " +"a :class:`float`. The *data* may be a sequence or iterable. If the input " "dataset is empty, raises a :exc:`StatisticsError`." msgstr "" "這個函式運算比 :func:`mean` 更快,並且它總是回傳一個 :class:`float`。*data* " -"可以是一個 sequence 或者 iterable。如果輸入的資料為空,則引發 :exc:" -"`StatisticsError`。" +"可以是一個 sequence 或者 iterable。如果輸入的資料為空,則引" +"發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:172 msgid "" @@ -425,11 +426,11 @@ msgstr "" #: ../../library/statistics.rst:188 msgid "" -"If *weights* is supplied, it must be the same length as the *data* or a :exc:" -"`ValueError` will be raised." +"If *weights* is supplied, it must be the same length as the *data* or " +"a :exc:`ValueError` will be raised." msgstr "" -"如果有提供 *weights*,它必須與 *data* 長度相同,否則將引發 :exc:" -"`ValueError`。" +"如果有提供 *weights*,它必須與 *data* 長度相同,否則將引" +"發 :exc:`ValueError`。" #: ../../library/statistics.rst:193 ../../library/statistics.rst:261 msgid "Added support for *weights*." @@ -536,8 +537,8 @@ msgid "" ":exc:`StatisticsError` is raised if *data* is empty, any element is less " "than zero, or if the weighted sum isn't positive." msgstr "" -"若 *data* 為空、含有任何小於零的元素、或者加權總和不為正數,則引發 :exc:" -"`StatisticsError`。" +"若 *data* 為空、含有任何小於零的元素、或者加權總和不為正數,則引" +"發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:255 msgid "" @@ -558,9 +559,9 @@ msgstr "" #: ../../library/statistics.rst:272 msgid "" -"The basic idea is to smooth the data using `a kernel function `_. to help draw inferences about a " -"population from a sample." +"The basic idea is to smooth the data using `a kernel function `_. to help draw inferences about " +"a population from a sample." msgstr "" #: ../../library/statistics.rst:276 @@ -596,13 +597,11 @@ msgid "" msgstr "" #: ../../library/statistics.rst:293 ../../library/statistics.rst:324 -#, fuzzy msgid "" "A :exc:`StatisticsError` will be raised if the *data* sequence is empty." msgstr "若 *data* 為空,則引發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:295 -#, fuzzy msgid "" "`Wikipedia has an example `_ where we can use :func:`kde` to " @@ -610,11 +609,10 @@ msgid "" "sample:" msgstr "" "`維基百科有一個範例 `_,我們可以使用 ``kde_normal()`` 這個錦囊" -"妙計來生成並繪製從小樣本估計的機率密度函式:" +"Kernel_density_estimation#Example>`_,我們可以使用 :func:`kde` 來從一個小樣本" +"生成並繪製估計的機率密度函數:" #: ../../library/statistics.rst:300 -#, fuzzy msgid "" ">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" ">>> f_hat = kde(sample, h=1.5)\n" @@ -622,9 +620,9 @@ msgid "" ">>> yarr = [f_hat(x) for x in xarr]" msgstr "" ">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" -">>> pdf, cdf, rand = kde_normal(sample, h=1.5)\n" +">>> f_hat = kde(sample, h=1.5)\n" ">>> xarr = [i/100 for i in range(-750, 1100)]\n" -">>> yarr = [pdf(x) for x in xarr]" +">>> yarr = [f_hat(x) for x in xarr]" #: ../../library/statistics.rst:307 msgid "The points in ``xarr`` and ``yarr`` can be used to make a PDF plot:" @@ -713,11 +711,12 @@ msgstr "" #: ../../library/statistics.rst:371 msgid "" -"Return the low median of numeric data. If *data* is empty, :exc:" -"`StatisticsError` is raised. *data* can be a sequence or iterable." +"Return the low median of numeric data. If *data* is " +"empty, :exc:`StatisticsError` is raised. *data* can be a sequence or " +"iterable." msgstr "" -"回傳數值型資料的低中位數 (low median)。若 *data* 為空,則引發 :exc:" -"`StatisticsError`。*data* 可為 sequence 或者 iterable。" +"回傳數值型資料的低中位數 (low median)。若 *data* 為空,則引" +"發 :exc:`StatisticsError`。*data* 可為 sequence 或者 iterable。" #: ../../library/statistics.rst:374 msgid "" @@ -753,8 +752,8 @@ msgid "" "Return the high median of data. If *data* is empty, :exc:`StatisticsError` " "is raised. *data* can be a sequence or iterable." msgstr "" -"回傳數值型資料的高中位數 (high median)。若 *data* 為空,則引發 :exc:" -"`StatisticsError`。*data* 可為 sequence 或者 iterable。" +"回傳數值型資料的高中位數 (high median)。若 *data* 為空,則引" +"發 :exc:`StatisticsError`。*data* 可為 sequence 或者 iterable。" #: ../../library/statistics.rst:394 msgid "" @@ -890,8 +889,8 @@ msgid "" msgstr "" "若有多個出現次數相同的眾數,則回傳在 *data* 中最先出現的眾數。如果希望回傳其" "中最小或最大的眾數,可以使用 ``min(multimode(data))`` 或 " -"``max(multimode(data))``。如果輸入的 *data* 為空,則會引發 :exc:" -"`StatisticsError`。" +"``max(multimode(data))``。如果輸入的 *data* 為空,則會引" +"發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:472 msgid "" @@ -968,8 +967,8 @@ msgid "" "Return the population standard deviation (the square root of the population " "variance). See :func:`pvariance` for arguments and other details." msgstr "" -"回傳母體標準差(即母體變異數的平方根)。有關引數以及其他細節,請參見 :func:" -"`pvariance`。" +"回傳母體標準差(即母體變異數的平方根)。有關引數以及其他細節,請參" +"見 :func:`pvariance`。" #: ../../library/statistics.rst:521 msgid "" @@ -1098,8 +1097,8 @@ msgid "" "Return the sample standard deviation (the square root of the sample " "variance). See :func:`variance` for arguments and other details." msgstr "" -"回傳樣本標準差(即樣本變異數的平方根)。有關引數以及其他細節,請參見 :func:" -"`variance`。" +"回傳樣本標準差(即樣本變異數的平方根)。有關引數以及其他細節,請參" +"見 :func:`variance`。" #: ../../library/statistics.rst:593 msgid "" @@ -1217,12 +1216,12 @@ msgstr "" #: ../../library/statistics.rst:656 msgid "" -"If you somehow know the actual population mean μ you should pass it to the :" -"func:`pvariance` function as the *mu* parameter to get the variance of a " -"sample." +"If you somehow know the actual population mean μ you should pass it to " +"the :func:`pvariance` function as the *mu* parameter to get the variance of " +"a sample." msgstr "" -"若你剛好知道真正的母體平均數 μ,你應該將其作為 *mu* 參數傳入 :func:" -"`pvariance` 函式來計算樣本變異數。" +"若你剛好知道真正的母體平均數 μ,你應該將其作為 *mu* 參數傳" +"入 :func:`pvariance` 函式來計算樣本變異數。" #: ../../library/statistics.rst:662 msgid "" @@ -1244,14 +1243,13 @@ msgstr "" "如果 *n* 不是至少為 1,則引發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:670 -#, fuzzy msgid "" "The *data* can be any iterable containing sample data. For meaningful " "results, the number of data points in *data* should be larger than *n*. " "Raises :exc:`StatisticsError` if there is not at least one data point." msgstr "" "*data* 可以是包含樣本資料的任何 iterable。為了取得有意義的結果,*data* 中的資" -"料點數量應大於 *n*。如果資料點少於兩個,則引發 :exc:`StatisticsError`。" +"料點數量應大於 *n*。如果連一個資料點都沒有,則引發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:674 msgid "" @@ -1331,8 +1329,8 @@ msgstr "" #: ../../library/statistics.rst:722 msgid "" -"Both inputs must be of the same length (no less than two), otherwise :exc:" -"`StatisticsError` is raised." +"Both inputs must be of the same length (no less than two), " +"otherwise :exc:`StatisticsError` is raised." msgstr "" "兩輸入必須具有相同長度(至少兩個),否則會引發 :exc:`StatisticsError`。" @@ -1397,8 +1395,8 @@ msgid "" "Both inputs must be of the same length (no less than two), and need not to " "be constant, otherwise :exc:`StatisticsError` is raised." msgstr "" -"兩輸入必須具有相同長度(至少兩個),且不須為常數,否則會引發 :exc:" -"`StatisticsError`。" +"兩輸入必須具有相同長度(至少兩個),且不須為常數,否則會引" +"發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:762 msgid "" @@ -1439,8 +1437,8 @@ msgstr "新增了對 Spearman 等級相關係數的支援。" #: ../../library/statistics.rst:794 msgid "" -"Return the slope and intercept of `simple linear regression `_ parameters estimated using " +"Return the slope and intercept of `simple linear regression `_ parameters estimated using " "ordinary least squares. Simple linear regression describes the relationship " "between an independent variable *x* and a dependent variable *y* in terms of " "this linear function:" @@ -1468,11 +1466,11 @@ msgstr "" #: ../../library/statistics.rst:808 msgid "" "Both inputs must be of the same length (no less than two), and the " -"independent variable *x* cannot be constant; otherwise a :exc:" -"`StatisticsError` is raised." +"independent variable *x* cannot be constant; otherwise " +"a :exc:`StatisticsError` is raised." msgstr "" -"兩輸入必須具有相同長度(至少兩個),且自變數 *x* 不得為常數,否則會引發 :exc:" -"`StatisticsError`。" +"兩輸入必須具有相同長度(至少兩個),且自變數 *x* 不得為常數,否則會引" +"發 :exc:`StatisticsError`。" #: ../../library/statistics.rst:812 msgid "" @@ -1481,9 +1479,9 @@ msgid "" "cumulative number of Monty Python films that would have been produced by " "2019 assuming that they had kept the pace." msgstr "" -"舉例來說,我們可以使用 `Monty Python 系列電影的上映日期 `_\\ 來預測至 2019 年為止,假設他們保持" -"固定的製作速度,應該會產生的 Monty Python 電影的累計數量。" +"舉例來說,我們可以使用 `Monty Python 系列電影的上映日期 `_\\ 來預測至 2019 年為止,假設他們" +"保持固定的製作速度,應該會產生的 Monty Python 電影的累計數量。" #: ../../library/statistics.rst:818 msgid "" @@ -1538,6 +1536,18 @@ msgid "" ">>> [5_906, 10_152, 6_796, 6_450, 414] # actual distance in million km\n" "[5906, 10152, 6796, 6450, 414]" msgstr "" +">>> model = linear_regression(period_squared, dist_cubed, " +"proportional=True)\n" +">>> slope = model.slope\n" +"\n" +">>> # 矮行星: 冥王星、 鬩神星、 鳥神星、 妊神星、 穀神星\n" +">>> orbital_periods = [90_560, 204_199, 111_845, 103_410, 1_680] # 天數\n" +">>> predicted_dist = [math.cbrt(slope * (p * p)) for p in orbital_periods]\n" +">>> list(map(round, predicted_dist))\n" +"[5912, 10166, 6806, 6459, 414]\n" +"\n" +">>> [5_906, 10_152, 6_796, 6_450, 414] # 以百萬公里為單位的實際距離\n" +"[5906, 10152, 6796, 6450, 414]" #: ../../library/statistics.rst:854 msgid "Added support for *proportional*." @@ -1562,9 +1572,9 @@ msgstr ":class:`NormalDist` 物件" #: ../../library/statistics.rst:870 msgid "" ":class:`NormalDist` is a tool for creating and manipulating normal " -"distributions of a `random variable `_. It is a class that treats the mean and " -"standard deviation of data measurements as a single entity." +"distributions of a `random variable `_. It is a class that treats the mean and standard " +"deviation of data measurements as a single entity." msgstr "" ":class:`NormalDist` 是一種用於建立與操作\\ `隨機變數 (random variable) " "`_ 的常態分布的工" @@ -1572,12 +1582,12 @@ msgstr "" #: ../../library/statistics.rst:876 msgid "" -"Normal distributions arise from the `Central Limit Theorem `_ and have a wide range of " +"Normal distributions arise from the `Central Limit Theorem `_ and have a wide range of " "applications in statistics." msgstr "" -"常態分布源自於\\ `中央極限定理 (Central Limit Theorem) `_,在統計學中有著廣泛的應用。" +"常態分布源自於\\ `中央極限定理 (Central Limit Theorem) `_,在統計學中有著廣泛的應用。" #: ../../library/statistics.rst:882 msgid "" @@ -1658,8 +1668,8 @@ msgid "" "Generates *n* random samples for a given mean and standard deviation. " "Returns a :class:`list` of :class:`float` values." msgstr "" -"給定平均值與標準差,產生 *n* 個隨機樣本。回傳一個由 :class:`float` 組成的 :" -"class:`list`。" +"給定平均值與標準差,產生 *n* 個隨機樣本。回傳一個由 :class:`float` 組成" +"的 :class:`list`。" #: ../../library/statistics.rst:935 msgid "" @@ -1683,9 +1693,9 @@ msgid "" "random variable *X* will be near the given value *x*. Mathematically, it is " "the limit of the ratio ``P(x <= X < x+dx) / dx`` as *dx* approaches zero." msgstr "" -"利用\\ `機率密度函數 (probability density function, pdf) `_ 計算隨機變數 *X* 接近給定" -"值 *x* 的相對概度 (relative likelihood)。數學上,它是比率 ``P(x <= X < " +"利用\\ `機率密度函數 (probability density function, pdf) `_ 計算隨機變數 *X* 接近給" +"定值 *x* 的相對概度 (relative likelihood)。數學上,它是比率 ``P(x <= X < " "x+dx) / dx`` 在 *dx* 趨近於零時的極限值。" #: ../../library/statistics.rst:952 @@ -1705,23 +1715,24 @@ msgid "" "random variable *X* will be less than or equal to *x*. Mathematically, it " "is written ``P(X <= x)``." msgstr "" -"利用\\ `累積分布函式 (cumulative distribution function, cdf) `_ 計算隨機變數 *X* 小於" -"或等於 *x* 的機率。數學上,它記為 ``P(X <= x)``。" +"利用\\ `累積分布函式 (cumulative distribution function, cdf) `_ 計算隨機變數 *X* 小" +"於或等於 *x* 的機率。數學上,它記為 ``P(X <= x)``。" #: ../../library/statistics.rst:966 msgid "" "Compute the inverse cumulative distribution function, also known as the " "`quantile function `_ or " -"the `percent-point `_ " +"the `percent-point `_ " "function. Mathematically, it is written ``x : P(X <= x) = p``." msgstr "" "計算反累計分布函式 (inverse cumulative distribution function),也稱為\\ `分位" "數函式 (quantile function) `_ 或者\\ `百分率點 (percent-point) `_ 函式。數學上記為 ``x : P(X <= x) = p``。" +"Quantile_function>`_ 或者\\ `百分率點 (percent-point) `_ " +"函式。數學上記為 ``x : P(X <= x) = p``。" #: ../../library/statistics.rst:972 msgid "" @@ -1784,6 +1795,9 @@ msgid "" ">>> temperature_february * (9/5) + 32 # Fahrenheit\n" "NormalDist(mu=41.0, sigma=4.5)" msgstr "" +">>> temperature_february = NormalDist(5, 2.5) # 攝氏\n" +">>> temperature_february * (9/5) + 32 # 華氏\n" +"NormalDist(mu=41.0, sigma=4.5)" #: ../../library/statistics.rst:1013 msgid "" @@ -1797,13 +1811,13 @@ msgid "" "Since normal distributions arise from additive effects of independent " "variables, it is possible to `add and subtract two independent normally " "distributed random variables `_ represented as instances of :" -"class:`NormalDist`. For example:" +"Sum_of_normally_distributed_random_variables>`_ represented as instances " +"of :class:`NormalDist`. For example:" msgstr "" "由於常態分布源自於自變數的加法效應 (additive effects),因此可以\\ `將兩個獨立" "的常態分布隨機變數相加與相減 `_,並且表示為 :class:" -"`NormalDist` 的實例。例如:" +"Sum_of_normally_distributed_random_variables>`_,並且表示" +"為 :class:`NormalDist` 的實例。例如:" #: ../../library/statistics.rst:1022 msgid "" @@ -1902,7 +1916,7 @@ msgid "" ">>> X = NormalDist(10, 2.5).samples(n, seed=3652260728)\n" ">>> Y = NormalDist(15, 1.75).samples(n, seed=4582495471)\n" ">>> Z = NormalDist(50, 1.25).samples(n, seed=6582483453)\n" -">>> quantiles(map(model, X, Y, Z)) \n" +">>> quantiles(map(model, X, Y, Z))\n" "[1.4591308524824727, 1.8035946855390597, 2.175091447274739]" msgstr "" ">>> def model(x, y, z):\n" @@ -1912,7 +1926,7 @@ msgstr "" ">>> X = NormalDist(10, 2.5).samples(n, seed=3652260728)\n" ">>> Y = NormalDist(15, 1.75).samples(n, seed=4582495471)\n" ">>> Z = NormalDist(50, 1.25).samples(n, seed=6582483453)\n" -">>> quantiles(map(model, X, Y, Z)) \n" +">>> quantiles(map(model, X, Y, Z))\n" "[1.4591308524824727, 1.8035946855390597, 2.175091447274739]" #: ../../library/statistics.rst:1088 @@ -1926,8 +1940,8 @@ msgid "" "size is large and when the probability of a successful trial is near 50%." msgstr "" "當樣本數量夠大,且試驗成功的機率接近 50%,可以使用常態分布來近似\\ `二項分布 " -"(Binomial distributions) `_。" +"(Binomial distributions) `_。" #: ../../library/statistics.rst:1095 msgid "" @@ -1976,8 +1990,8 @@ msgstr "常態分布常在機器學習問題中出現。" #: ../../library/statistics.rst:1130 msgid "" -"Wikipedia has a `nice example of a Naive Bayesian Classifier `_. The " +"Wikipedia has a `nice example of a Naive Bayesian Classifier `_. The " "challenge is to predict a person's gender from measurements of normally " "distributed features including height, weight, and foot size." msgstr "" @@ -2030,9 +2044,9 @@ msgid "" "the prior times the product of likelihoods for the feature measurements " "given the gender:" msgstr "" -"從可能為男性或女性的 50% `先驗機率 (prior probability) `_ 為開端,我們將後驗機率 (posterior probability) " -"計算為先驗機率乘以給定性別下,各特徵量測值的概度乘積:" +"從可能為男性或女性的 50% `先驗機率 (prior probability) `_ 為開端,我們將後驗機率 (posterior " +"probability) 計算為先驗機率乘以給定性別下,各特徵量測值的概度乘積:" #: ../../library/statistics.rst:1162 msgid "" @@ -2086,8 +2100,8 @@ msgstr "" #~ "smoothing is controlled by a scaling parameter, ``h``, which is called " #~ "the *bandwidth*." #~ msgstr "" -#~ "基本想法是使用\\ `一個核函式如常態分布、三角分布或均勻分布 `_\\ 來使資料更加平滑。" #~ "平滑程度由一個縮放參數 ``h`` 控制,被稱為 *bandwidth*。" diff --git a/library/stdtypes.po b/library/stdtypes.po index 1755b6f92f..44218436f1 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-30 00:13+0000\n" +"POT-Creation-Date: 2025-04-24 05:58+0000\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -65,22 +65,24 @@ msgstr "真值檢測" #: ../../library/stdtypes.rst:41 msgid "" -"Any object can be tested for truth value, for use in an :keyword:`if` or :" -"keyword:`while` condition or as operand of the Boolean operations below." +"Any object can be tested for truth value, for use in an :keyword:`if` " +"or :keyword:`while` condition or as operand of the Boolean operations below." msgstr "" -"任何物件都可以進行檢測以判斷是否為真值,以便在 :keyword:`if` 或 :keyword:" -"`while` 條件中使用,或是作為如下所述 boolean(布林)運算之運算元所用。" +"任何物件都可以進行檢測以判斷是否為真值,以便在 :keyword:`if` " +"或 :keyword:`while` 條件中使用,或是作為如下所述 boolean(布林)運算之運算元" +"所用。" #: ../../library/stdtypes.rst:46 msgid "" -"By default, an object is considered true unless its class defines either a :" -"meth:`~object.__bool__` method that returns ``False`` or a :meth:`~object." -"__len__` method that returns zero, when called with the object. [1]_ Here " -"are most of the built-in objects considered false:" +"By default, an object is considered true unless its class defines either " +"a :meth:`~object.__bool__` method that returns ``False`` or " +"a :meth:`~object.__len__` method that returns zero, when called with the " +"object. [1]_ Here are most of the built-in objects considered false:" msgstr "" -"預設情況下,一個物件會被視為真值,除非它的 class 定義了會回傳 ``False`` 的 :" -"meth:`~object.__bool__` method 或是定義了會回傳零的 :meth:`~object.__len__` " -"method。[1]_ 以下列出了大部分會被視為 false 的內建物件:" +"預設情況下,一個物件會被視為真值,除非它的 class 定義了會回傳 ``False`` " +"的 :meth:`~object.__bool__` method 或是定義了會回傳零" +"的 :meth:`~object.__len__` method。[1]_ 以下列出了大部分會被視為 false 的內建" +"物件:" #: ../../library/stdtypes.rst:56 msgid "constants defined to be false: ``None`` and ``False``" @@ -135,8 +137,8 @@ msgstr "結果" #: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:276 #: ../../library/stdtypes.rst:416 ../../library/stdtypes.rst:965 -#: ../../library/stdtypes.rst:1170 ../../library/stdtypes.rst:2432 -#: ../../library/stdtypes.rst:3651 +#: ../../library/stdtypes.rst:1170 ../../library/stdtypes.rst:2578 +#: ../../library/stdtypes.rst:3797 msgid "Notes" msgstr "註解" @@ -150,7 +152,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:967 #: ../../library/stdtypes.rst:970 ../../library/stdtypes.rst:1181 -#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 +#: ../../library/stdtypes.rst:2584 ../../library/stdtypes.rst:3803 msgid "\\(1)" msgstr "\\(1)" @@ -164,8 +166,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:289 #: ../../library/stdtypes.rst:309 ../../library/stdtypes.rst:1209 -#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:2444 -#: ../../library/stdtypes.rst:3661 ../../library/stdtypes.rst:3663 +#: ../../library/stdtypes.rst:2588 ../../library/stdtypes.rst:2590 +#: ../../library/stdtypes.rst:3807 ../../library/stdtypes.rst:3809 msgid "\\(2)" msgstr "\\(2)" @@ -178,18 +180,18 @@ msgid "if *x* is false, then ``True``, else ``False``" msgstr "假如 *x* 為假,則 ``True``,否則 ``False``" #: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:979 -#: ../../library/stdtypes.rst:1212 ../../library/stdtypes.rst:2446 -#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:2450 -#: ../../library/stdtypes.rst:2452 ../../library/stdtypes.rst:3665 -#: ../../library/stdtypes.rst:3667 ../../library/stdtypes.rst:3669 -#: ../../library/stdtypes.rst:3671 +#: ../../library/stdtypes.rst:1212 ../../library/stdtypes.rst:2592 +#: ../../library/stdtypes.rst:2594 ../../library/stdtypes.rst:2596 +#: ../../library/stdtypes.rst:2598 ../../library/stdtypes.rst:3811 +#: ../../library/stdtypes.rst:3813 ../../library/stdtypes.rst:3815 +#: ../../library/stdtypes.rst:3817 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:320 #: ../../library/stdtypes.rst:434 ../../library/stdtypes.rst:1016 -#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:2478 -#: ../../library/stdtypes.rst:3701 +#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:2624 +#: ../../library/stdtypes.rst:3847 msgid "Notes:" msgstr "註解:" @@ -236,9 +238,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2409 -#: ../../library/stdtypes.rst:2432 ../../library/stdtypes.rst:3628 -#: ../../library/stdtypes.rst:3651 +#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2410 +#: ../../library/stdtypes.rst:2555 ../../library/stdtypes.rst:2578 +#: ../../library/stdtypes.rst:3774 ../../library/stdtypes.rst:3797 msgid "Meaning" msgstr "含義" @@ -325,23 +327,24 @@ msgid "" "Non-identical instances of a class normally compare as non-equal unless the " "class defines the :meth:`~object.__eq__` method." msgstr "" -"一個 class 的非相同實例通常會比較為不相等,除非 class 有定義 :meth:`~object." -"__eq__` method。" +"一個 class 的非相同實例通常會比較為不相等,除非 class 有定" +"義 :meth:`~object.__eq__` method。" #: ../../library/stdtypes.rst:184 msgid "" "Instances of a class cannot be ordered with respect to other instances of " "the same class, or other types of object, unless the class defines enough of " -"the methods :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object." -"__gt__`, and :meth:`~object.__ge__` (in general, :meth:`~object.__lt__` and :" -"meth:`~object.__eq__` are sufficient, if you want the conventional meanings " -"of the comparison operators)." +"the " +"methods :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " +"and :meth:`~object.__ge__` (in general, :meth:`~object.__lt__` " +"and :meth:`~object.__eq__` are sufficient, if you want the conventional " +"meanings of the comparison operators)." msgstr "" "一個 class 的實例不可以與其他相同 class 的實例或其他物件型別進行排序,除非 " -"class 定義足夠的 method ,包含 :meth:`~object.__lt__`、:meth:`~object." -"__le__`、:meth:`~object.__gt__` 及 :meth:`~object.__ge__`\\ (一般來說,使" -"用 :meth:`~object.__lt__` 及 :meth:`~object.__eq__` 就可以滿足常規意義上的比" -"較運算子)。" +"class 定義足夠的 method ,包" +"含 :meth:`~object.__lt__`、:meth:`~object.__le__`、:meth:`~object.__gt__` " +"及 :meth:`~object.__ge__`\\ (一般來說,使用 :meth:`~object.__lt__` " +"及 :meth:`~object.__eq__` 就可以滿足常規意義上的比較運算子)。" #: ../../library/stdtypes.rst:191 msgid "" @@ -354,8 +357,8 @@ msgstr "" #: ../../library/stdtypes.rst:199 msgid "" -"Two more operations with the same syntactic priority, :keyword:`in` and :" -"keyword:`not in`, are supported by types that are :term:`iterable` or " +"Two more operations with the same syntactic priority, :keyword:`in` " +"and :keyword:`not in`, are supported by types that are :term:`iterable` or " "implement the :meth:`~object.__contains__` method." msgstr "" "此外,擁有相同的語法優先序的 :keyword:`in` 及 :keyword:`not in` 兩種運算皆被" @@ -373,20 +376,21 @@ msgid "" "subtype of integers. Integers have unlimited precision. Floating-point " "numbers are usually implemented using :c:expr:`double` in C; information " "about the precision and internal representation of floating-point numbers " -"for the machine on which your program is running is available in :data:`sys." -"float_info`. Complex numbers have a real and imaginary part, which are each " -"a floating-point number. To extract these parts from a complex number *z*, " -"use ``z.real`` and ``z.imag``. (The standard library includes the additional " -"numeric types :mod:`fractions.Fraction`, for rationals, and :mod:`decimal." -"Decimal`, for floating-point numbers with user-definable precision.)" +"for the machine on which your program is running is available " +"in :data:`sys.float_info`. Complex numbers have a real and imaginary part, " +"which are each a floating-point number. To extract these parts from a " +"complex number *z*, use ``z.real`` and ``z.imag``. (The standard library " +"includes the additional numeric types :mod:`fractions.Fraction`, for " +"rationals, and :mod:`decimal.Decimal`, for floating-point numbers with user-" +"definable precision.)" msgstr "" "數值型別共有三種::dfn:`整數`、:dfn:`浮點數` 及 :dfn:`複數`。此外,Boolean 為" -"整數中的一個子型別。整數有無限的精度。浮點數通常使用 C 裡面的 :c:expr:" -"`double` 實作。關於在你程式所運作的機器上之浮點數的精度及內部表示法可以在 :" -"data:`sys.float_info` 進行查找。複數包含實數及虛數的部分,這兩部分各自是一個" -"浮點數。若要從一個複數 *z* 提取這兩部分,需使用 ``z.real`` 及 ``z.imag``。" -"(標準函式庫包含額外的數值型別,像是 :mod:`fractions.Fraction` 表示有理數," -"而 :mod:`decimal.Decimal` 表示可由使用者制定精度的浮點數。)" +"整數中的一個子型別。整數有無限的精度。浮點數通常使用 C 裡面" +"的 :c:expr:`double` 實作。關於在你程式所運作的機器上之浮點數的精度及內部表示" +"法可以在 :data:`sys.float_info` 進行查找。複數包含實數及虛數的部分,這兩部分" +"各自是一個浮點數。若要從一個複數 *z* 提取這兩部分,需使用 ``z.real`` 及 " +"``z.imag``。(標準函式庫包含額外的數值型別,像是 :mod:`fractions.Fraction` 表" +"示有理數,而 :mod:`decimal.Decimal` 表示可由使用者制定精度的浮點數。)" #: ../../library/stdtypes.rst:238 msgid "" @@ -429,8 +433,8 @@ msgid "" "All numeric types (except complex) support the following operations (for " "priorities of the operations, see :ref:`operator-summary`):" msgstr "" -"所有數值型別(除複數外)皆支援以下的運算(有關運算的先後順序,詳見 :ref:" -"`operator-summary`):" +"所有數值型別(除複數外)皆支援以下的運算(有關運算的先後順序,詳" +"見 :ref:`operator-summary`):" #: ../../library/stdtypes.rst:276 msgid "Full documentation" @@ -559,7 +563,7 @@ msgid "" msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" #: ../../library/stdtypes.rst:302 ../../library/stdtypes.rst:1202 -#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3688 +#: ../../library/stdtypes.rst:2586 ../../library/stdtypes.rst:3834 msgid "\\(6)" msgstr "\\(6)" @@ -597,9 +601,9 @@ msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:311 ../../library/stdtypes.rst:313 #: ../../library/stdtypes.rst:1191 ../../library/stdtypes.rst:1194 -#: ../../library/stdtypes.rst:2465 ../../library/stdtypes.rst:2468 -#: ../../library/stdtypes.rst:2471 ../../library/stdtypes.rst:3684 -#: ../../library/stdtypes.rst:3691 +#: ../../library/stdtypes.rst:2611 ../../library/stdtypes.rst:2614 +#: ../../library/stdtypes.rst:2617 ../../library/stdtypes.rst:3830 +#: ../../library/stdtypes.rst:3837 msgid "\\(5)" msgstr "\\(5)" @@ -620,11 +624,11 @@ msgid "" "always rounded towards minus infinity: ``1//2`` is ``0``, ``(-1)//2`` is " "``-1``, ``1//(-2)`` is ``-1``, and ``(-1)//(-2)`` is ``0``." msgstr "" -"也被稱為整數除法。對於型別為 :class:`int` 的運算元來說,結果之型別會是 :" -"class:`int`。對於型別為 :class:`float` 的運算元來說,結果之型別會是 :class:" -"`float`。一般來說,結果會是一個整數,但其型別不一定會是 :class:`int`。結果總" -"是會往負無窮大的方向取整數值: ``1//2`` 為 ``0``、``(-1)//2`` 為 ``-1``、" -"``1//(-2)`` 為 ``-1`` 及 ``(-1)//(-2)`` 為 ``0``。" +"也被稱為整數除法。對於型別為 :class:`int` 的運算元來說,結果之型別會" +"是 :class:`int`。對於型別為 :class:`float` 的運算元來說,結果之型別會" +"是 :class:`float`。一般來說,結果會是一個整數,但其型別不一定會" +"是 :class:`int`。結果總是會往負無窮大的方向取整數值: ``1//2`` 為 ``0``、" +"``(-1)//2`` 為 ``-1``、``1//(-2)`` 為 ``-1`` 及 ``(-1)//(-2)`` 為 ``0``。" #: ../../library/stdtypes.rst:331 msgid "" @@ -638,8 +642,8 @@ msgid "" "fractional part. See functions :func:`math.floor` and :func:`math.ceil` for " "alternative conversions." msgstr "" -"從 :class:`float` 轉換為 :class:`int` 會導致截斷並排除小數部分。詳見 :func:" -"`math.floor` 及 :func:`math.ceil` 以了解更多轉換方式。" +"從 :class:`float` 轉換為 :class:`int` 會導致截斷並排除小數部分。詳" +"見 :func:`math.floor` 及 :func:`math.ceil` 以了解更多轉換方式。" #: ../../library/stdtypes.rst:347 msgid "" @@ -758,8 +762,8 @@ msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:418 ../../library/stdtypes.rst:421 #: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:2458 -#: ../../library/stdtypes.rst:3673 ../../library/stdtypes.rst:3677 +#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:2604 +#: ../../library/stdtypes.rst:3819 ../../library/stdtypes.rst:3823 msgid "\\(4)" msgstr "\\(4)" @@ -829,13 +833,13 @@ msgstr "向右移動 *n* 個位元等同於向下除法除以 ``pow(2, n)``。" #: ../../library/stdtypes.rst:446 msgid "" "Performing these calculations with at least one extra sign extension bit in " -"a finite two's complement representation (a working bit-width of ``1 + max(x." -"bit_length(), y.bit_length())`` or more) is sufficient to get the same " +"a finite two's complement representation (a working bit-width of ``1 + " +"max(x.bit_length(), y.bit_length())`` or more) is sufficient to get the same " "result as if there were an infinite number of sign bits." msgstr "" -"在有限的二的補數表示法中執行這些計算(一個有效位元寬度為 ``1 + max(x." -"bit_length(), y.bit_length())`` 或以上)並至少有一個額外的符號擴展位元,便足" -"以得到與無窮多個符號位元相同的結果。" +"在有限的二的補數表示法中執行這些計算(一個有效位元寬度為 ``1 + " +"max(x.bit_length(), y.bit_length())`` 或以上)並至少有一個額外的符號擴展位" +"元,便足以得到與無窮多個符號位元相同的結果。" #: ../../library/stdtypes.rst:453 msgid "Additional Methods on Integer Types" @@ -874,13 +878,13 @@ msgid "" "More precisely, if ``x`` is nonzero, then ``x.bit_length()`` is the unique " "positive integer ``k`` such that ``2**(k-1) <= abs(x) < 2**k``. " "Equivalently, when ``abs(x)`` is small enough to have a correctly rounded " -"logarithm, then ``k = 1 + int(log(abs(x), 2))``. If ``x`` is zero, then ``x." -"bit_length()`` returns ``0``." +"logarithm, then ``k = 1 + int(log(abs(x), 2))``. If ``x`` is zero, then " +"``x.bit_length()`` returns ``0``." msgstr "" "更準確來說,若 ``x`` 非為零,則 ``x.bit_length()`` 會得出滿足 ``2**(k-1) <= " "abs(x) < 2**k`` 的單一正整數 ``k``。同樣地,當 ``abs(x)`` 足夠小到能正確地取" -"得捨入的對數,則 ``k = 1 + int(log(abs(x), 2))``。若 ``x`` 為零,則 ``x." -"bit_length()`` 會回傳 ``0``。" +"得捨入的對數,則 ``k = 1 + int(log(abs(x), 2))``。若 ``x`` 為零,則 " +"``x.bit_length()`` 會回傳 ``0``。" #: ../../library/stdtypes.rst:475 ../../library/stdtypes.rst:498 #: ../../library/stdtypes.rst:543 ../../library/stdtypes.rst:587 @@ -933,9 +937,9 @@ msgstr "回傳表示一個整數的一列位元組。" #: ../../library/stdtypes.rst:519 msgid "" -"The integer is represented using *length* bytes, and defaults to 1. An :exc:" -"`OverflowError` is raised if the integer is not representable with the given " -"number of bytes." +"The integer is represented using *length* bytes, and defaults to 1. " +"An :exc:`OverflowError` is raised if the integer is not representable with " +"the given number of bytes." msgstr "" "此整數會使用 *length* 位元組表示,並且預設為 1。如果該整數無法用給定的位元組" "數來表示,則會引發 :exc:`OverflowError`。" @@ -981,8 +985,8 @@ msgid "" "However, when using the default arguments, don't try to convert a value " "greater than 255 or you'll get an :exc:`OverflowError`." msgstr "" -"然而,使用預設引數時,不要嘗試轉換大於 255 的值,否則你將會得到一個 :exc:" -"`OverflowError`。" +"然而,使用預設引數時,不要嘗試轉換大於 255 的值,否則你將會得到一" +"個 :exc:`OverflowError`。" #: ../../library/stdtypes.rst:545 msgid "" @@ -1028,8 +1032,8 @@ msgid "" "integer, and defaults to ``\"big\"``. If *byteorder* is ``\"big\"``, the " "most significant byte is at the beginning of the byte array. If *byteorder* " "is ``\"little\"``, the most significant byte is at the end of the byte " -"array. To request the native byte order of the host system, use :data:`sys." -"byteorder` as the byte order value." +"array. To request the native byte order of the host system, " +"use :data:`sys.byteorder` as the byte order value." msgstr "" "*byteorder* 引數決定了用來表示整數的位元組順序並且預設為 ``\"big\"``。如果 " "*byteorder* 是 ``\"big\"``,最重要的位元組位於位元組陣列的開頭。如果 " @@ -1087,8 +1091,8 @@ msgstr "" #: ../../library/stdtypes.rst:618 msgid "" -"Returns ``True``. Exists for duck type compatibility with :meth:`float." -"is_integer`." +"Returns ``True``. Exists for duck type compatibility " +"with :meth:`float.is_integer`." msgstr "回傳 ``True``。為了與 :meth:`float.is_integer` 的鴨子型別相容而存在。" #: ../../library/stdtypes.rst:623 @@ -1106,8 +1110,8 @@ msgstr "" #: ../../library/stdtypes.rst:630 msgid "" "Return a pair of integers whose ratio is exactly equal to the original " -"float. The ratio is in lowest terms and has a positive denominator. Raises :" -"exc:`OverflowError` on infinities and a :exc:`ValueError` on NaNs." +"float. The ratio is in lowest terms and has a positive denominator. " +"Raises :exc:`OverflowError` on infinities and a :exc:`ValueError` on NaNs." msgstr "" "回傳一對整數,其比率完全等於原始浮點數。比率是在最低條件下並且有一個正分母。" "在無窮大時引發 :exc:`OverflowError`,在 NaN 時引發 :exc:`ValueError`。" @@ -1164,8 +1168,8 @@ msgstr "" #: ../../library/stdtypes.rst:669 msgid "" -"Note that :meth:`float.hex` is an instance method, while :meth:`float." -"fromhex` is a class method." +"Note that :meth:`float.hex` is an instance method, " +"while :meth:`float.fromhex` is a class method." msgstr "" "請注意 :meth:`float.hex` 是一個實例 method,而 :meth:`float.fromhex` 是一個 " "class method。" @@ -1194,10 +1198,10 @@ msgstr "" "其中可選的 ``sign`` 可以是 ``+`` 或 ``-``,``integer`` 和 ``fraction`` 是十六" "進位數字的字串,而 ``exponent`` 是一個十進位整數並且有一個可選的前導符號。大" "小寫不重要,並且整數或小數部分至少有一個十六進位數字。這個語法與 C99 標準的" -"第 6.4.4.2 節指定的語法相似,也與 Java 1.5 以後的語法相似。特別是 :meth:" -"`float.hex` 的輸出可用作 C 或 Java 程式碼中的十六進位浮點數文字,並且 C 的 " -"``%a`` 格式字元或 Java 的 ``Double.toHexString`` 產生的十六進位字串可被 :" -"meth:`float.fromhex` 接受。" +"第 6.4.4.2 節指定的語法相似,也與 Java 1.5 以後的語法相似。特別" +"是 :meth:`float.hex` 的輸出可用作 C 或 Java 程式碼中的十六進位浮點數文字,並" +"且 C 的 ``%a`` 格式字元或 Java 的 ``Double.toHexString`` 產生的十六進位字串可" +"被 :meth:`float.fromhex` 接受。" #: ../../library/stdtypes.rst:689 msgid "" @@ -1240,27 +1244,29 @@ msgstr "數值型別的雜湊" #: ../../library/stdtypes.rst:711 msgid "" "For numbers ``x`` and ``y``, possibly of different types, it's a requirement " -"that ``hash(x) == hash(y)`` whenever ``x == y`` (see the :meth:`~object." -"__hash__` method documentation for more details). For ease of " -"implementation and efficiency across a variety of numeric types (including :" -"class:`int`, :class:`float`, :class:`decimal.Decimal` and :class:`fractions." -"Fraction`) Python's hash for numeric types is based on a single mathematical " -"function that's defined for any rational number, and hence applies to all " -"instances of :class:`int` and :class:`fractions.Fraction`, and all finite " -"instances of :class:`float` and :class:`decimal.Decimal`. Essentially, this " -"function is given by reduction modulo ``P`` for a fixed prime ``P``. The " -"value of ``P`` is made available to Python as the :attr:`~sys.hash_info." -"modulus` attribute of :data:`sys.hash_info`." +"that ``hash(x) == hash(y)`` whenever ``x == y`` (see " +"the :meth:`~object.__hash__` method documentation for more details). For " +"ease of implementation and efficiency across a variety of numeric types " +"(including :class:`int`, :class:`float`, :class:`decimal.Decimal` " +"and :class:`fractions.Fraction`) Python's hash for numeric types is based on " +"a single mathematical function that's defined for any rational number, and " +"hence applies to all instances of :class:`int` " +"and :class:`fractions.Fraction`, and all finite instances of :class:`float` " +"and :class:`decimal.Decimal`. Essentially, this function is given by " +"reduction modulo ``P`` for a fixed prime ``P``. The value of ``P`` is made " +"available to Python as the :attr:`~sys.hash_info.modulus` attribute " +"of :data:`sys.hash_info`." msgstr "" "對於數字 ``x`` 和 ``y``,可能是不同型別,當 ``x == y`` 時,``hash(x) == " "hash(y)`` 是一個要求( 詳見 :meth:`~object.__hash__` method 的文件以獲得更多" -"細節)。為了實作的便利性和效率跨越各種數值型別(包括 :class:`int`、:class:" -"`float`、:class:`decimal.Decimal` 和 :class:`fractions.Fraction`)Python 的數" -"值型別的雜湊是基於一個數學函式,它對於任何有理數都是定義的,因此適用於所有 :" -"class:`int` 和 :class:`fractions.Fraction` 的實例,以及所有有限的 :class:" -"`float` 和 :class:`decimal.Decimal` 的實例。基本上,這個函式是由簡化的 modulo" -"(模數) ``P`` 給出的一個固定的質數 ``P``。``P`` 的值作為 :data:`sys." -"hash_info` 的 :attr:`~sys.hash_info.modulus` 屬性提供給 Python。" +"細節)。為了實作的便利性和效率跨越各種數值型別(包" +"括 :class:`int`、:class:`float`、:class:`decimal.Decimal` " +"和 :class:`fractions.Fraction`)Python 的數值型別的雜湊是基於一個數學函式,它" +"對於任何有理數都是定義的,因此適用於所有 :class:`int` " +"和 :class:`fractions.Fraction` 的實例,以及所有有限的 :class:`float` " +"和 :class:`decimal.Decimal` 的實例。基本上,這個函式是由簡化的 modulo(模" +"數) ``P`` 給出的一個固定的質數 ``P``。``P`` 的值作為 :data:`sys.hash_info` " +"的 :attr:`~sys.hash_info.modulus` 屬性提供給 Python。" #: ../../library/stdtypes.rst:726 msgid "" @@ -1315,21 +1321,23 @@ msgstr "" #: ../../library/stdtypes.rst:748 msgid "" "For a :class:`complex` number ``z``, the hash values of the real and " -"imaginary parts are combined by computing ``hash(z.real) + sys.hash_info." -"imag * hash(z.imag)``, reduced modulo ``2**sys.hash_info.width`` so that it " -"lies in ``range(-2**(sys.hash_info.width - 1), 2**(sys.hash_info.width - " -"1))``. Again, if the result is ``-1``, it's replaced with ``-2``." +"imaginary parts are combined by computing ``hash(z.real) + " +"sys.hash_info.imag * hash(z.imag)``, reduced modulo " +"``2**sys.hash_info.width`` so that it lies in " +"``range(-2**(sys.hash_info.width - 1), 2**(sys.hash_info.width - 1))``. " +"Again, if the result is ``-1``, it's replaced with ``-2``." msgstr "" "對於一個 :class:`complex` 值 ``z``,實部和虛部的雜湊值藉由 ``hash(z.real) + " -"sys.hash_info.imag * hash(z.imag)`` 的計算進行組合,對 ``2**sys.hash_info." -"width`` 取模數使其介於 ``range(-2**(sys.hash_info.width - 1), 2**(sys." -"hash_info.width - 1))``。同樣地,如果結果是 ``-1``,則將其替換為 ``-2``。" +"sys.hash_info.imag * hash(z.imag)`` 的計算進行組合,對 " +"``2**sys.hash_info.width`` 取模數使其介於 ``range(-2**(sys.hash_info.width - " +"1), 2**(sys.hash_info.width - 1))``。同樣地,如果結果是 ``-1``,則將其替換為 " +"``-2``。" #: ../../library/stdtypes.rst:756 msgid "" "To clarify the above rules, here's some example Python code, equivalent to " -"the built-in hash, for computing the hash of a rational number, :class:" -"`float`, or :class:`complex`::" +"the built-in hash, for computing the hash of a rational " +"number, :class:`float`, or :class:`complex`::" msgstr "" "為了闡明上述規則,這裡有一些 Python 程式碼範例,等同於內建的雜湊,用於計算有" "理數、:class:`float` 或 :class:`complex` 的雜湊: ::" @@ -1376,8 +1384,8 @@ msgid "" "def hash_complex(z):\n" " \"\"\"Compute the hash of a complex number z.\"\"\"\n" "\n" -" hash_value = hash_float(z.real) + sys.hash_info.imag * hash_float(z." -"imag)\n" +" hash_value = hash_float(z.real) + sys.hash_info.imag * " +"hash_float(z.imag)\n" " # do a signed reduction modulo 2**sys.hash_info.width\n" " M = 2**(sys.hash_info.width - 1)\n" " hash_value = (hash_value & (M - 1)) - (hash_value & M)\n" @@ -1453,8 +1461,8 @@ msgstr "" #: ../../library/stdtypes.rst:858 msgid "" -"One method needs to be defined for container objects to provide :term:" -"`iterable` support:" +"One method needs to be defined for container objects to " +"provide :term:`iterable` support:" msgstr "" "需要為容器物件定義一個 method 來提供\\ :term:`可疊代物件 `\\ 支援:" @@ -1465,15 +1473,15 @@ msgid "" "of iteration, additional methods can be provided to specifically request " "iterators for those iteration types. (An example of an object supporting " "multiple forms of iteration would be a tree structure which supports both " -"breadth-first and depth-first traversal.) This method corresponds to the :c:" -"member:`~PyTypeObject.tp_iter` slot of the type structure for Python objects " -"in the Python/C API." +"breadth-first and depth-first traversal.) This method corresponds to " +"the :c:member:`~PyTypeObject.tp_iter` slot of the type structure for Python " +"objects in the Python/C API." msgstr "" "回傳一個\\ :term:`疊代器 `\\ 物件。該物件需要支援下述的疊代器協定。" "如果一個容器支援不同型別的疊代,則可以提供額外的 methods 來專門請求這些疊代型" "別的疊代器。(支援多種形式疊代的物件的一個例子是支援廣度優先和深度優先遍歷的" -"樹結構。)此 method 對應 Python/C API 中 Python 物件的型別結構的 :c:member:" -"`~PyTypeObject.tp_iter` 插槽。" +"樹結構。)此 method 對應 Python/C API 中 Python 物件的型別結構" +"的 :c:member:`~PyTypeObject.tp_iter` 插槽。" #: ../../library/stdtypes.rst:874 msgid "" @@ -1485,9 +1493,10 @@ msgstr "" #: ../../library/stdtypes.rst:880 msgid "" "Return the :term:`iterator` object itself. This is required to allow both " -"containers and iterators to be used with the :keyword:`for` and :keyword:" -"`in` statements. This method corresponds to the :c:member:`~PyTypeObject." -"tp_iter` slot of the type structure for Python objects in the Python/C API." +"containers and iterators to be used with the :keyword:`for` " +"and :keyword:`in` statements. This method corresponds to " +"the :c:member:`~PyTypeObject.tp_iter` slot of the type structure for Python " +"objects in the Python/C API." msgstr "" "回傳\\ :term:`疊代器 `\\ 物件本身。這是為了允許容器和疊代器都可以" "與 :keyword:`for` 和 :keyword:`in` 在陳述式中使用。此 method 對應於 Python/C " @@ -1500,9 +1509,9 @@ msgid "" "the :c:member:`~PyTypeObject.tp_iternext` slot of the type structure for " "Python objects in the Python/C API." msgstr "" -"從\\ :term:`疊代器 `\\ 回傳下一個項目。如果沒有更多項目,則引發 :" -"exc:`StopIteration` 例外。此 method 對應於 Python/C API 中Python 物件的型別結" -"構的 :c:member:`~PyTypeObject.tp_iternext` 插槽。" +"從\\ :term:`疊代器 `\\ 回傳下一個項目。如果沒有更多項目,則引" +"發 :exc:`StopIteration` 例外。此 method 對應於 Python/C API 中Python 物件的型" +"別結構的 :c:member:`~PyTypeObject.tp_iternext` 插槽。" #: ../../library/stdtypes.rst:894 msgid "" @@ -1516,8 +1525,8 @@ msgstr "" #: ../../library/stdtypes.rst:899 msgid "" -"Once an iterator's :meth:`~iterator.__next__` method raises :exc:" -"`StopIteration`, it must continue to do so on subsequent calls. " +"Once an iterator's :meth:`~iterator.__next__` method " +"raises :exc:`StopIteration`, it must continue to do so on subsequent calls. " "Implementations that do not obey this property are deemed broken." msgstr "" "一旦疊代器的 :meth:`~iterator.__next__` method 引發 :exc:`StopIteration`,則" @@ -1530,12 +1539,12 @@ msgstr "" #: ../../library/stdtypes.rst:909 msgid "" "Python's :term:`generator`\\s provide a convenient way to implement the " -"iterator protocol. If a container object's :meth:`~iterator.__iter__` " -"method is implemented as a generator, it will automatically return an " -"iterator object (technically, a generator object) supplying the :meth:`!" -"__iter__` and :meth:`~generator.__next__` methods. More information about " -"generators can be found in :ref:`the documentation for the yield expression " -"`." +"iterator protocol. If a container object's :meth:`~object.__iter__` method " +"is implemented as a generator, it will automatically return an iterator " +"object (technically, a generator object) supplying " +"the :meth:`~iterator.__iter__` and :meth:`~generator.__next__` methods. More " +"information about generators can be found in :ref:`the documentation for the " +"yield expression `." msgstr "" #: ../../library/stdtypes.rst:921 @@ -1584,7 +1593,7 @@ msgstr "``x in s``" #: ../../library/stdtypes.rst:967 msgid "``True`` if an item of *s* is equal to *x*, else ``False``" -msgstr "" +msgstr "如果 *s* 的一個項目等於 *x* 則為 ``True``,否則為 ``False``" #: ../../library/stdtypes.rst:970 msgid "``x not in s``" @@ -1592,7 +1601,7 @@ msgstr "``x not in s``" #: ../../library/stdtypes.rst:970 msgid "``False`` if an item of *s* is equal to *x*, else ``True``" -msgstr "" +msgstr "如果 *s* 的一個項目等於 *x* 則為 ``False``,否則為 ``True``" #: ../../library/stdtypes.rst:973 msgid "``s + t``" @@ -1600,7 +1609,7 @@ msgstr "``s + t``" #: ../../library/stdtypes.rst:973 msgid "the concatenation of *s* and *t*" -msgstr "" +msgstr "*s* 和 *t* 的串接" #: ../../library/stdtypes.rst:973 msgid "(6)(7)" @@ -1612,7 +1621,7 @@ msgstr "``s * n`` 或 ``n * s``" #: ../../library/stdtypes.rst:976 msgid "equivalent to adding *s* to itself *n* times" -msgstr "" +msgstr "等同於將 *s* 加到自己 *n* 次" #: ../../library/stdtypes.rst:976 msgid "(2)(7)" @@ -1624,7 +1633,7 @@ msgstr "``s[i]``" #: ../../library/stdtypes.rst:979 msgid "*i*\\ th item of *s*, origin 0" -msgstr "" +msgstr "*s* 的第 *i* 項,起始為 0" #: ../../library/stdtypes.rst:981 msgid "``s[i:j]``" @@ -1684,7 +1693,7 @@ msgid "" "before index *j*)" msgstr "" -#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3659 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3805 msgid "\\(8)" msgstr "\\(8)" @@ -1694,7 +1703,7 @@ msgstr "``s.count(x)``" #: ../../library/stdtypes.rst:996 msgid "total number of occurrences of *x* in *s*" -msgstr "" +msgstr "*s* 中 *x* 的總出現次數" #: ../../library/stdtypes.rst:1000 msgid "" @@ -1709,9 +1718,9 @@ msgstr "" msgid "" "Forward and reversed iterators over mutable sequences access values using an " "index. That index will continue to march forward (or backward) even if the " -"underlying sequence is mutated. The iterator terminates only when an :exc:" -"`IndexError` or a :exc:`StopIteration` is encountered (or when the index " -"drops below zero)." +"underlying sequence is mutated. The iterator terminates only when " +"an :exc:`IndexError` or a :exc:`StopIteration` is encountered (or when the " +"index drops below zero)." msgstr "" #: ../../library/stdtypes.rst:1019 @@ -1823,17 +1832,17 @@ msgstr "" #: ../../library/stdtypes.rst:1084 msgid "" -"if concatenating :class:`str` objects, you can build a list and use :meth:" -"`str.join` at the end or else write to an :class:`io.StringIO` instance and " -"retrieve its value when complete" +"if concatenating :class:`str` objects, you can build a list and " +"use :meth:`str.join` at the end or else write to an :class:`io.StringIO` " +"instance and retrieve its value when complete" msgstr "" #: ../../library/stdtypes.rst:1088 msgid "" -"if concatenating :class:`bytes` objects, you can similarly use :meth:`bytes." -"join` or :class:`io.BytesIO`, or you can do in-place concatenation with a :" -"class:`bytearray` object. :class:`bytearray` objects are mutable and have " -"an efficient overallocation mechanism" +"if concatenating :class:`bytes` objects, you can similarly " +"use :meth:`bytes.join` or :class:`io.BytesIO`, or you can do in-place " +"concatenation with a :class:`bytearray` object. :class:`bytearray` objects " +"are mutable and have an efficient overallocation mechanism" msgstr "" #: ../../library/stdtypes.rst:1093 @@ -1868,15 +1877,15 @@ msgstr "" #: ../../library/stdtypes.rst:1122 msgid "" "The only operation that immutable sequence types generally implement that is " -"not also implemented by mutable sequence types is support for the :func:" -"`hash` built-in." +"not also implemented by mutable sequence types is support for " +"the :func:`hash` built-in." msgstr "" #: ../../library/stdtypes.rst:1126 msgid "" "This support allows immutable sequences, such as :class:`tuple` instances, " -"to be used as :class:`dict` keys and stored in :class:`set` and :class:" -"`frozenset` instances." +"to be used as :class:`dict` keys and stored in :class:`set` " +"and :class:`frozenset` instances." msgstr "" #: ../../library/stdtypes.rst:1130 @@ -2048,9 +2057,9 @@ msgstr "" msgid "" ":meth:`clear` and :meth:`!copy` are included for consistency with the " "interfaces of mutable containers that don't support slicing operations (such " -"as :class:`dict` and :class:`set`). :meth:`!copy` is not part of the :class:" -"`collections.abc.MutableSequence` ABC, but most concrete mutable sequence " -"classes provide it." +"as :class:`dict` and :class:`set`). :meth:`!copy` is not part of " +"the :class:`collections.abc.MutableSequence` ABC, but most concrete mutable " +"sequence classes provide it." msgstr "" #: ../../library/stdtypes.rst:1245 @@ -2059,10 +2068,11 @@ msgstr "" #: ../../library/stdtypes.rst:1249 msgid "" -"The value *n* is an integer, or an object implementing :meth:`~object." -"__index__`. Zero and negative values of *n* clear the sequence. Items in " -"the sequence are not copied; they are referenced multiple times, as " -"explained for ``s * n`` under :ref:`typesseq-common`." +"The value *n* is an integer, or an object " +"implementing :meth:`~object.__index__`. Zero and negative values of *n* " +"clear the sequence. Items in the sequence are not copied; they are " +"referenced multiple times, as explained for ``s * n`` under :ref:`typesseq-" +"common`." msgstr "" #: ../../library/stdtypes.rst:1258 @@ -2131,8 +2141,8 @@ msgstr "" #: ../../library/stdtypes.rst:1298 msgid "" -":meth:`sort` accepts two arguments that can only be passed by keyword (:ref:" -"`keyword-only arguments `):" +":meth:`sort` accepts two arguments that can only be passed by keyword " +"(:ref:`keyword-only arguments `):" msgstr "" #: ../../library/stdtypes.rst:1301 @@ -2194,8 +2204,8 @@ msgid "" "Tuples are immutable sequences, typically used to store collections of " "heterogeneous data (such as the 2-tuples produced by the :func:`enumerate` " "built-in). Tuples are also used for cases where an immutable sequence of " -"homogeneous data is needed (such as allowing storage in a :class:`set` or :" -"class:`dict` instance)." +"homogeneous data is needed (such as allowing storage in a :class:`set` " +"or :class:`dict` instance)." msgstr "" #: ../../library/stdtypes.rst:1349 @@ -2263,8 +2273,8 @@ msgstr "" #: ../../library/stdtypes.rst:1392 msgid "" -"The arguments to the range constructor must be integers (either built-in :" -"class:`int` or any object that implements the :meth:`~object.__index__` " +"The arguments to the range constructor must be integers (either built-" +"in :class:`int` or any object that implements the :meth:`~object.__index__` " "special method). If the *step* argument is omitted, it defaults to ``1``. " "If the *start* argument is omitted, it defaults to ``0``. If *step* is " "zero, :exc:`ValueError` is raised." @@ -2293,8 +2303,8 @@ msgstr "" #: ../../library/stdtypes.rst:1411 msgid "" "Ranges containing absolute values larger than :data:`sys.maxsize` are " -"permitted but some features (such as :func:`len`) may raise :exc:" -"`OverflowError`." +"permitted but some features (such as :func:`len`) may " +"raise :exc:`OverflowError`." msgstr "" #: ../../library/stdtypes.rst:1415 @@ -2359,8 +2369,8 @@ msgstr "" #: ../../library/stdtypes.rst:1451 msgid "" -"The advantage of the :class:`range` type over a regular :class:`list` or :" -"class:`tuple` is that a :class:`range` object will always take the same " +"The advantage of the :class:`range` type over a regular :class:`list` " +"or :class:`tuple` is that a :class:`range` object will always take the same " "(small) amount of memory, no matter the size of the range it represents (as " "it only stores the ``start``, ``stop`` and ``step`` values, calculating " "individual items and subranges as needed)." @@ -2385,9 +2395,9 @@ msgstr "" #: ../../library/stdtypes.rst:1484 msgid "" -"Implement the Sequence ABC. Support slicing and negative indices. Test :" -"class:`int` objects for membership in constant time instead of iterating " -"through all items." +"Implement the Sequence ABC. Support slicing and negative indices. " +"Test :class:`int` objects for membership in constant time instead of " +"iterating through all items." msgstr "" #: ../../library/stdtypes.rst:1490 @@ -2415,9 +2425,9 @@ msgstr "" #: ../../library/stdtypes.rst:1514 msgid "" -"Textual data in Python is handled with :class:`str` objects, or :dfn:" -"`strings`. Strings are immutable :ref:`sequences ` of Unicode code " -"points. String literals are written in a variety of ways:" +"Textual data in Python is handled with :class:`str` objects, " +"or :dfn:`strings`. Strings are immutable :ref:`sequences ` of " +"Unicode code points. String literals are written in a variety of ways:" msgstr "" #: ../../library/stdtypes.rst:1519 @@ -2468,9 +2478,9 @@ msgstr "" #: ../../library/stdtypes.rst:1543 msgid "" -"There is also no mutable string type, but :meth:`str.join` or :class:`io." -"StringIO` can be used to efficiently construct strings from multiple " -"fragments." +"There is also no mutable string type, but :meth:`str.join` " +"or :class:`io.StringIO` can be used to efficiently construct strings from " +"multiple fragments." msgstr "" #: ../../library/stdtypes.rst:1547 @@ -2489,24 +2499,24 @@ msgstr "" #: ../../library/stdtypes.rst:1563 msgid "" -"If neither *encoding* nor *errors* is given, ``str(object)`` returns :meth:" -"`type(object).__str__(object) `, which is the \"informal\" " -"or nicely printable string representation of *object*. For string objects, " -"this is the string itself. If *object* does not have a :meth:`~object." -"__str__` method, then :func:`str` falls back to returning :func:" -"`repr(object) `." +"If neither *encoding* nor *errors* is given, ``str(object)`` " +"returns :meth:`type(object).__str__(object) `, which is the " +"\"informal\" or nicely printable string representation of *object*. For " +"string objects, this is the string itself. If *object* does not have " +"a :meth:`~object.__str__` method, then :func:`str` falls back to " +"returning :func:`repr(object) `." msgstr "" #: ../../library/stdtypes.rst:1575 msgid "" -"If at least one of *encoding* or *errors* is given, *object* should be a :" -"term:`bytes-like object` (e.g. :class:`bytes` or :class:`bytearray`). In " +"If at least one of *encoding* or *errors* is given, *object* should be " +"a :term:`bytes-like object` (e.g. :class:`bytes` or :class:`bytearray`). In " "this case, if *object* is a :class:`bytes` (or :class:`bytearray`) object, " -"then ``str(bytes, encoding, errors)`` is equivalent to :meth:`bytes." -"decode(encoding, errors) `. Otherwise, the bytes object " -"underlying the buffer object is obtained before calling :meth:`bytes." -"decode`. See :ref:`binaryseq` and :ref:`bufferobjects` for information on " -"buffer objects." +"then ``str(bytes, encoding, errors)`` is equivalent " +"to :meth:`bytes.decode(encoding, errors) `. Otherwise, the " +"bytes object underlying the buffer object is obtained before " +"calling :meth:`bytes.decode`. See :ref:`binaryseq` and :ref:`bufferobjects` " +"for information on buffer objects." msgstr "" #: ../../library/stdtypes.rst:1584 @@ -2527,10 +2537,10 @@ msgstr "" #: ../../library/stdtypes.rst:1592 msgid "" -"For more information on the ``str`` class and its methods, see :ref:" -"`textseq` and the :ref:`string-methods` section below. To output formatted " -"strings, see the :ref:`f-strings` and :ref:`formatstrings` sections. In " -"addition, see the :ref:`stringservices` section." +"For more information on the ``str`` class and its methods, " +"see :ref:`textseq` and the :ref:`string-methods` section below. To output " +"formatted strings, see the :ref:`f-strings` and :ref:`formatstrings` " +"sections. In addition, see the :ref:`stringservices` section." msgstr "" #: ../../library/stdtypes.rst:1604 @@ -2546,11 +2556,11 @@ msgstr "" #: ../../library/stdtypes.rst:1612 msgid "" "Strings also support two styles of string formatting, one providing a large " -"degree of flexibility and customization (see :meth:`str.format`, :ref:" -"`formatstrings` and :ref:`string-formatting`) and the other based on C " -"``printf`` style formatting that handles a narrower range of types and is " -"slightly harder to use correctly, but is often faster for the cases it can " -"handle (:ref:`old-string-formatting`)." +"degree of flexibility and customization " +"(see :meth:`str.format`, :ref:`formatstrings` and :ref:`string-formatting`) " +"and the other based on C ``printf`` style formatting that handles a narrower " +"range of types and is slightly harder to use correctly, but is often faster " +"for the cases it can handle (:ref:`old-string-formatting`)." msgstr "" #: ../../library/stdtypes.rst:1619 @@ -2584,8 +2594,8 @@ msgid "" "Casefolding is similar to lowercasing but more aggressive because it is " "intended to remove all case distinctions in a string. For example, the " "German lowercase letter ``'ß'`` is equivalent to ``\"ss\"``. Since it is " -"already lowercase, :meth:`lower` would do nothing to ``'ß'``; :meth:" -"`casefold` converts it to ``\"ss\"``." +"already lowercase, :meth:`lower` would do nothing to " +"``'ß'``; :meth:`casefold` converts it to ``\"ss\"``." msgstr "" #: ../../library/stdtypes.rst:1644 @@ -2619,7 +2629,7 @@ msgstr "" msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1673 ../../library/stdtypes.rst:2824 +#: ../../library/stdtypes.rst:1673 ../../library/stdtypes.rst:2970 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." @@ -2630,25 +2640,25 @@ msgid "" "*errors* controls how encoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " "are ``'ignore'``, ``'replace'``, ``'xmlcharrefreplace'``, " -"``'backslashreplace'`` and any other name registered via :func:`codecs." -"register_error`. See :ref:`error-handlers` for details." +"``'backslashreplace'`` and any other name registered " +"via :func:`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" #: ../../library/stdtypes.rst:1683 msgid "" "For performance reasons, the value of *errors* is not checked for validity " -"unless an encoding error actually occurs, :ref:`devmode` is enabled or a :" -"ref:`debug build ` is used." +"unless an encoding error actually occurs, :ref:`devmode` is enabled or " +"a :ref:`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:1688 ../../library/stdtypes.rst:2843 +#: ../../library/stdtypes.rst:1688 ../../library/stdtypes.rst:2989 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1691 ../../library/stdtypes.rst:2846 +#: ../../library/stdtypes.rst:1691 ../../library/stdtypes.rst:2992 msgid "" -"The value of the *errors* argument is now checked in :ref:`devmode` and in :" -"ref:`debug mode `." +"The value of the *errors* argument is now checked in :ref:`devmode` and " +"in :ref:`debug mode `." msgstr "" #: ../../library/stdtypes.rst:1698 @@ -2685,8 +2695,8 @@ msgstr "" #: ../../library/stdtypes.rst:1733 msgid "" "The :meth:`~str.find` method should be used only if you need to know the " -"position of *sub*. To check if *sub* is a substring or not, use the :" -"keyword:`in` operator::" +"position of *sub*. To check if *sub* is a substring or not, use " +"the :keyword:`in` operator::" msgstr "" #: ../../library/stdtypes.rst:1737 @@ -2715,13 +2725,14 @@ msgstr "" #: ../../library/stdtypes.rst:1757 msgid "" -"When formatting a number (:class:`int`, :class:`float`, :class:`complex`, :" -"class:`decimal.Decimal` and subclasses) with the ``n`` type (ex: ``'{:n}'." -"format(1234)``), the function temporarily sets the ``LC_CTYPE`` locale to " -"the ``LC_NUMERIC`` locale to decode ``decimal_point`` and ``thousands_sep`` " -"fields of :c:func:`localeconv` if they are non-ASCII or longer than 1 byte, " -"and the ``LC_NUMERIC`` locale is different than the ``LC_CTYPE`` locale. " -"This temporary change affects other threads." +"When formatting a number " +"(:class:`int`, :class:`float`, :class:`complex`, :class:`decimal.Decimal` " +"and subclasses) with the ``n`` type (ex: ``'{:n}'.format(1234)``), the " +"function temporarily sets the ``LC_CTYPE`` locale to the ``LC_NUMERIC`` " +"locale to decode ``decimal_point`` and ``thousands_sep`` fields " +"of :c:func:`localeconv` if they are non-ASCII or longer than 1 byte, and the " +"``LC_NUMERIC`` locale is different than the ``LC_CTYPE`` locale. This " +"temporary change affects other threads." msgstr "" #: ../../library/stdtypes.rst:1766 @@ -2747,20 +2758,20 @@ msgstr "" msgid "" "Return ``True`` if all characters in the string are alphanumeric and there " "is at least one character, ``False`` otherwise. A character ``c`` is " -"alphanumeric if one of the following returns ``True``: ``c.isalpha()``, ``c." -"isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." +"alphanumeric if one of the following returns ``True``: ``c.isalpha()``, " +"``c.isdecimal()``, ``c.isdigit()``, or ``c.isnumeric()``." msgstr "" #: ../../library/stdtypes.rst:1804 msgid "" "Return ``True`` if all characters in the string are alphabetic and there is " "at least one character, ``False`` otherwise. Alphabetic characters are " -"those characters defined in the Unicode character database as \"Letter\", i." -"e., those with general category property being one of \"Lm\", \"Lt\", " +"those characters defined in the Unicode character database as \"Letter\", " +"i.e., those with general category property being one of \"Lm\", \"Lt\", " "\"Lu\", \"Ll\", or \"Lo\". Note that this is different from the `Alphabetic " "property defined in the section 4.10 'Letters, Alphabetic, and Ideographic' " -"of the Unicode Standard `_." +"of the Unicode Standard `_." msgstr "" #: ../../library/stdtypes.rst:1815 @@ -2839,29 +2850,42 @@ msgstr "" #: ../../library/stdtypes.rst:1879 msgid "" -"Return ``True`` if all characters in the string are printable or the string " -"is empty, ``False`` otherwise. Nonprintable characters are those characters " -"defined in the Unicode character database as \"Other\" or \"Separator\", " -"excepting the ASCII space (0x20) which is considered printable. (Note that " -"printable characters in this context are those which should not be escaped " -"when :func:`repr` is invoked on a string. It has no bearing on the handling " -"of strings written to :data:`sys.stdout` or :data:`sys.stderr`.)" +"Return true if all characters in the string are printable, false if it " +"contains at least one non-printable character." msgstr "" -#: ../../library/stdtypes.rst:1890 +#: ../../library/stdtypes.rst:1882 +msgid "" +"Here \"printable\" means the character is suitable for :func:`repr` to use " +"in its output; \"non-printable\" means that :func:`repr` on built-in types " +"will hex-escape the character. It has no bearing on the handling of strings " +"written to :data:`sys.stdout` or :data:`sys.stderr`." +msgstr "" + +#: ../../library/stdtypes.rst:1887 +msgid "" +"The printable characters are those which in the Unicode character database " +"(see :mod:`unicodedata`) have a general category in group Letter, Mark, " +"Number, Punctuation, or Symbol (L, M, N, P, or S); plus the ASCII space " +"0x20. Nonprintable characters are those in group Separator or Other (Z or " +"C), except the ASCII space." +msgstr "" + +#: ../../library/stdtypes.rst:1896 msgid "" "Return ``True`` if there are only whitespace characters in the string and " "there is at least one character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1893 +#: ../../library/stdtypes.rst:1899 msgid "" -"A character is *whitespace* if in the Unicode character database (see :mod:" -"`unicodedata`), either its general category is ``Zs`` (\"Separator, " -"space\"), or its bidirectional class is one of ``WS``, ``B``, or ``S``." +"A character is *whitespace* if in the Unicode character database " +"(see :mod:`unicodedata`), either its general category is ``Zs`` " +"(\"Separator, space\"), or its bidirectional class is one of ``WS``, ``B``, " +"or ``S``." msgstr "" -#: ../../library/stdtypes.rst:1901 +#: ../../library/stdtypes.rst:1907 msgid "" "Return ``True`` if the string is a titlecased string and there is at least " "one character, for example uppercase characters may only follow uncased " @@ -2869,41 +2893,41 @@ msgid "" "otherwise." msgstr "" -#: ../../library/stdtypes.rst:1908 +#: ../../library/stdtypes.rst:1914 msgid "" "Return ``True`` if all cased characters [4]_ in the string are uppercase and " "there is at least one cased character, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:1926 +#: ../../library/stdtypes.rst:1932 msgid "" -"Return a string which is the concatenation of the strings in *iterable*. A :" -"exc:`TypeError` will be raised if there are any non-string values in " +"Return a string which is the concatenation of the strings in *iterable*. " +"A :exc:`TypeError` will be raised if there are any non-string values in " "*iterable*, including :class:`bytes` objects. The separator between " "elements is the string providing this method." msgstr "" -#: ../../library/stdtypes.rst:1934 +#: ../../library/stdtypes.rst:1940 msgid "" "Return the string left justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:1941 +#: ../../library/stdtypes.rst:1947 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "lowercase." msgstr "" -#: ../../library/stdtypes.rst:1944 +#: ../../library/stdtypes.rst:1950 msgid "" "The lowercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:1951 +#: ../../library/stdtypes.rst:1957 msgid "" "Return a copy of the string with leading characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -2912,7 +2936,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:1956 +#: ../../library/stdtypes.rst:1962 msgid "" ">>> ' spacious '.lstrip()\n" "'spacious '\n" @@ -2924,13 +2948,13 @@ msgstr "" ">>> 'www.example.com'.lstrip('cmowz.')\n" "'example.com'" -#: ../../library/stdtypes.rst:1961 +#: ../../library/stdtypes.rst:1967 msgid "" "See :meth:`str.removeprefix` for a method that will remove a single prefix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:1964 +#: ../../library/stdtypes.rst:1970 msgid "" ">>> 'Arthur: three!'.lstrip('Arthur: ')\n" "'ee!'\n" @@ -2942,13 +2966,13 @@ msgstr "" ">>> 'Arthur: three!'.removeprefix('Arthur: ')\n" "'three!'" -#: ../../library/stdtypes.rst:1972 +#: ../../library/stdtypes.rst:1978 msgid "" -"This static method returns a translation table usable for :meth:`str." -"translate`." +"This static method returns a translation table usable " +"for :meth:`str.translate`." msgstr "" -#: ../../library/stdtypes.rst:1974 +#: ../../library/stdtypes.rst:1980 msgid "" "If there is only one argument, it must be a dictionary mapping Unicode " "ordinals (integers) or characters (strings of length 1) to Unicode ordinals, " @@ -2956,7 +2980,7 @@ msgid "" "converted to ordinals." msgstr "" -#: ../../library/stdtypes.rst:1979 +#: ../../library/stdtypes.rst:1985 msgid "" "If there are two arguments, they must be strings of equal length, and in the " "resulting dictionary, each character in x will be mapped to the character at " @@ -2964,7 +2988,7 @@ msgid "" "whose characters will be mapped to ``None`` in the result." msgstr "" -#: ../../library/stdtypes.rst:1987 +#: ../../library/stdtypes.rst:1993 msgid "" "Split the string at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -2972,13 +2996,13 @@ msgid "" "containing the string itself, followed by two empty strings." msgstr "" -#: ../../library/stdtypes.rst:1995 +#: ../../library/stdtypes.rst:2001 msgid "" "If the string starts with the *prefix* string, return " "``string[len(prefix):]``. Otherwise, return a copy of the original string::" msgstr "" -#: ../../library/stdtypes.rst:1999 +#: ../../library/stdtypes.rst:2005 msgid "" ">>> 'TestHook'.removeprefix('Test')\n" "'Hook'\n" @@ -2990,14 +3014,14 @@ msgstr "" ">>> 'BaseTestCase'.removeprefix('Test')\n" "'BaseTestCase'" -#: ../../library/stdtypes.rst:2009 +#: ../../library/stdtypes.rst:2015 msgid "" "If the string ends with the *suffix* string and that *suffix* is not empty, " "return ``string[:-len(suffix)]``. Otherwise, return a copy of the original " "string::" msgstr "" -#: ../../library/stdtypes.rst:2013 +#: ../../library/stdtypes.rst:2019 msgid "" ">>> 'MiscTests'.removesuffix('Tests')\n" "'Misc'\n" @@ -3009,7 +3033,7 @@ msgstr "" ">>> 'TmpDirMixin'.removesuffix('Tests')\n" "'TmpDirMixin'" -#: ../../library/stdtypes.rst:2023 +#: ../../library/stdtypes.rst:2029 msgid "" "Return a copy of the string with all occurrences of substring *old* replaced " "by *new*. If *count* is given, only the first *count* occurrences are " @@ -3017,31 +3041,31 @@ msgid "" "replaced." msgstr "" -#: ../../library/stdtypes.rst:2027 +#: ../../library/stdtypes.rst:2033 msgid "*count* is now supported as a keyword argument." msgstr "*count* 現在作為關鍵字引數被支援。" -#: ../../library/stdtypes.rst:2033 +#: ../../library/stdtypes.rst:2039 msgid "" "Return the highest index in the string where substring *sub* is found, such " "that *sub* is contained within ``s[start:end]``. Optional arguments *start* " "and *end* are interpreted as in slice notation. Return ``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2040 +#: ../../library/stdtypes.rst:2046 msgid "" "Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is " "not found." msgstr "" -#: ../../library/stdtypes.rst:2046 +#: ../../library/stdtypes.rst:2052 msgid "" "Return the string right justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2053 +#: ../../library/stdtypes.rst:2059 msgid "" "Split the string at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -3049,7 +3073,7 @@ msgid "" "containing two empty strings, followed by the string itself." msgstr "" -#: ../../library/stdtypes.rst:2061 +#: ../../library/stdtypes.rst:2067 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done, the " @@ -3058,7 +3082,7 @@ msgid "" "behaves like :meth:`split` which is described in detail below." msgstr "" -#: ../../library/stdtypes.rst:2070 +#: ../../library/stdtypes.rst:2076 msgid "" "Return a copy of the string with trailing characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -3067,7 +3091,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2075 +#: ../../library/stdtypes.rst:2081 msgid "" ">>> ' spacious '.rstrip()\n" "' spacious'\n" @@ -3079,13 +3103,13 @@ msgstr "" ">>> 'mississippi'.rstrip('ipz')\n" "'mississ'" -#: ../../library/stdtypes.rst:2080 +#: ../../library/stdtypes.rst:2086 msgid "" "See :meth:`str.removesuffix` for a method that will remove a single suffix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2083 +#: ../../library/stdtypes.rst:2089 msgid "" ">>> 'Monty Python'.rstrip(' Python')\n" "'M'\n" @@ -3097,7 +3121,7 @@ msgstr "" ">>> 'Monty Python'.removesuffix(' Python')\n" "'Monty'" -#: ../../library/stdtypes.rst:2090 +#: ../../library/stdtypes.rst:2096 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, " @@ -3106,30 +3130,30 @@ msgid "" "possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:2096 +#: ../../library/stdtypes.rst:2102 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " "``['1', '', '2']``). The *sep* argument may consist of multiple characters " -"as a single delimiter (to split with multiple delimiters, use :func:`re." -"split`). Splitting an empty string with a specified separator returns " -"``['']``." -msgstr "" - -#: ../../library/stdtypes.rst:2103 ../../library/stdtypes.rst:2121 -#: ../../library/stdtypes.rst:2173 ../../library/stdtypes.rst:2241 -#: ../../library/stdtypes.rst:2309 ../../library/stdtypes.rst:3161 -#: ../../library/stdtypes.rst:3179 ../../library/stdtypes.rst:3270 -#: ../../library/stdtypes.rst:3286 ../../library/stdtypes.rst:3311 -#: ../../library/stdtypes.rst:3325 ../../library/stdtypes.rst:3353 -#: ../../library/stdtypes.rst:3367 ../../library/stdtypes.rst:3385 -#: ../../library/stdtypes.rst:3412 ../../library/stdtypes.rst:3435 -#: ../../library/stdtypes.rst:3462 ../../library/stdtypes.rst:3504 -#: ../../library/stdtypes.rst:3528 +"as a single delimiter (to split with multiple delimiters, " +"use :func:`re.split`). Splitting an empty string with a specified separator " +"returns ``['']``." +msgstr "" + +#: ../../library/stdtypes.rst:2109 ../../library/stdtypes.rst:2127 +#: ../../library/stdtypes.rst:2179 ../../library/stdtypes.rst:2247 +#: ../../library/stdtypes.rst:2315 ../../library/stdtypes.rst:3307 +#: ../../library/stdtypes.rst:3325 ../../library/stdtypes.rst:3416 +#: ../../library/stdtypes.rst:3432 ../../library/stdtypes.rst:3457 +#: ../../library/stdtypes.rst:3471 ../../library/stdtypes.rst:3499 +#: ../../library/stdtypes.rst:3513 ../../library/stdtypes.rst:3531 +#: ../../library/stdtypes.rst:3558 ../../library/stdtypes.rst:3581 +#: ../../library/stdtypes.rst:3608 ../../library/stdtypes.rst:3650 +#: ../../library/stdtypes.rst:3674 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/stdtypes.rst:2105 +#: ../../library/stdtypes.rst:2111 msgid "" ">>> '1,2,3'.split(',')\n" "['1', '2', '3']\n" @@ -3149,7 +3173,7 @@ msgstr "" ">>> '1<>2<>3<4'.split('<>')\n" "['1', '2', '3<4']" -#: ../../library/stdtypes.rst:2114 +#: ../../library/stdtypes.rst:2120 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive whitespace are regarded as a single separator, " @@ -3159,7 +3183,7 @@ msgid "" "returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:2123 +#: ../../library/stdtypes.rst:2129 msgid "" ">>> '1 2 3'.split()\n" "['1', '2', '3']\n" @@ -3175,120 +3199,120 @@ msgstr "" ">>> ' 1 2 3 '.split()\n" "['1', '2', '3']" -#: ../../library/stdtypes.rst:2136 +#: ../../library/stdtypes.rst:2142 msgid "" "Return a list of the lines in the string, breaking at line boundaries. Line " "breaks are not included in the resulting list unless *keepends* is given and " "true." msgstr "" -#: ../../library/stdtypes.rst:2140 +#: ../../library/stdtypes.rst:2146 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2144 +#: ../../library/stdtypes.rst:2150 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2144 +#: ../../library/stdtypes.rst:2150 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2146 +#: ../../library/stdtypes.rst:2152 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2146 +#: ../../library/stdtypes.rst:2152 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2148 +#: ../../library/stdtypes.rst:2154 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2148 +#: ../../library/stdtypes.rst:2154 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2150 +#: ../../library/stdtypes.rst:2156 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2150 +#: ../../library/stdtypes.rst:2156 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2152 +#: ../../library/stdtypes.rst:2158 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2152 +#: ../../library/stdtypes.rst:2158 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2154 +#: ../../library/stdtypes.rst:2160 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2154 +#: ../../library/stdtypes.rst:2160 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2156 +#: ../../library/stdtypes.rst:2162 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2156 +#: ../../library/stdtypes.rst:2162 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2158 +#: ../../library/stdtypes.rst:2164 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2158 +#: ../../library/stdtypes.rst:2164 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2160 +#: ../../library/stdtypes.rst:2166 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2160 +#: ../../library/stdtypes.rst:2166 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2162 +#: ../../library/stdtypes.rst:2168 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2162 +#: ../../library/stdtypes.rst:2168 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2164 +#: ../../library/stdtypes.rst:2170 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2164 +#: ../../library/stdtypes.rst:2170 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2166 +#: ../../library/stdtypes.rst:2172 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2166 +#: ../../library/stdtypes.rst:2172 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2171 +#: ../../library/stdtypes.rst:2177 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2175 +#: ../../library/stdtypes.rst:2181 msgid "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "['ab c', '', 'de fg', 'kl']\n" @@ -3300,14 +3324,14 @@ msgstr "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']" -#: ../../library/stdtypes.rst:2180 +#: ../../library/stdtypes.rst:2186 msgid "" "Unlike :meth:`~str.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:2184 +#: ../../library/stdtypes.rst:2190 msgid "" ">>> \"\".splitlines()\n" "[]\n" @@ -3319,11 +3343,11 @@ msgstr "" ">>> \"One line\\n\".splitlines()\n" "['One line']" -#: ../../library/stdtypes.rst:2189 +#: ../../library/stdtypes.rst:2195 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2191 +#: ../../library/stdtypes.rst:2197 msgid "" ">>> ''.split('\\n')\n" "['']\n" @@ -3335,7 +3359,7 @@ msgstr "" ">>> 'Two lines\\n'.split('\\n')\n" "['Two lines', '']" -#: ../../library/stdtypes.rst:2199 +#: ../../library/stdtypes.rst:2205 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -3343,7 +3367,7 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2207 +#: ../../library/stdtypes.rst:2213 msgid "" "Return a copy of the string with the leading and trailing characters " "removed. The *chars* argument is a string specifying the set of characters " @@ -3352,7 +3376,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2213 +#: ../../library/stdtypes.rst:2219 msgid "" ">>> ' spacious '.strip()\n" "'spacious'\n" @@ -3364,7 +3388,7 @@ msgstr "" ">>> 'www.example.com'.strip('cmowz.')\n" "'example'" -#: ../../library/stdtypes.rst:2218 +#: ../../library/stdtypes.rst:2224 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -3372,7 +3396,7 @@ msgid "" "A similar action takes place on the trailing end. For example::" msgstr "" -#: ../../library/stdtypes.rst:2224 +#: ../../library/stdtypes.rst:2230 msgid "" ">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" ">>> comment_string.strip('.#! ')\n" @@ -3382,20 +3406,20 @@ msgstr "" ">>> comment_string.strip('.#! ')\n" "'Section 3.2.1 Issue #32'" -#: ../../library/stdtypes.rst:2231 +#: ../../library/stdtypes.rst:2237 msgid "" "Return a copy of the string with uppercase characters converted to lowercase " -"and vice versa. Note that it is not necessarily true that ``s.swapcase()." -"swapcase() == s``." +"and vice versa. Note that it is not necessarily true that " +"``s.swapcase().swapcase() == s``." msgstr "" -#: ../../library/stdtypes.rst:2238 +#: ../../library/stdtypes.rst:2244 msgid "" "Return a titlecased version of the string where words start with an " "uppercase character and the remaining characters are lowercase." msgstr "" -#: ../../library/stdtypes.rst:2243 +#: ../../library/stdtypes.rst:2249 msgid "" ">>> 'Hello world'.title()\n" "'Hello World'" @@ -3403,7 +3427,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2246 ../../library/stdtypes.rst:3472 +#: ../../library/stdtypes.rst:2252 ../../library/stdtypes.rst:3618 msgid "" "The algorithm uses a simple language-independent definition of a word as " "groups of consecutive letters. The definition works in many contexts but it " @@ -3411,7 +3435,7 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2251 +#: ../../library/stdtypes.rst:2257 msgid "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" @@ -3419,19 +3443,19 @@ msgstr "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:2254 +#: ../../library/stdtypes.rst:2260 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2257 +#: ../../library/stdtypes.rst:2263 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2260 +#: ../../library/stdtypes.rst:2266 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -3451,31 +3475,31 @@ msgstr "" ">>> titlecase(\"they're bill's friends.\")\n" "\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:2272 +#: ../../library/stdtypes.rst:2278 msgid "" "Return a copy of the string in which each character has been mapped through " "the given translation table. The table must be an object that implements " -"indexing via :meth:`~object.__getitem__`, typically a :term:`mapping` or :" -"term:`sequence`. When indexed by a Unicode ordinal (an integer), the table " -"object can do any of the following: return a Unicode ordinal or a string, to " -"map the character to one or more other characters; return ``None``, to " -"delete the character from the return string; or raise a :exc:`LookupError` " -"exception, to map the character to itself." +"indexing via :meth:`~object.__getitem__`, typically a :term:`mapping` " +"or :term:`sequence`. When indexed by a Unicode ordinal (an integer), the " +"table object can do any of the following: return a Unicode ordinal or a " +"string, to map the character to one or more other characters; return " +"``None``, to delete the character from the return string; or raise " +"a :exc:`LookupError` exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2281 +#: ../../library/stdtypes.rst:2287 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2284 +#: ../../library/stdtypes.rst:2290 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2290 +#: ../../library/stdtypes.rst:2296 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s`` " @@ -3484,14 +3508,14 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2296 +#: ../../library/stdtypes.rst:2302 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." msgstr "" -#: ../../library/stdtypes.rst:2303 +#: ../../library/stdtypes.rst:2309 msgid "" "Return a copy of the string left filled with ASCII ``'0'`` digits to make a " "string of length *width*. A leading sign prefix (``'+'``/``'-'``) is handled " @@ -3499,7 +3523,7 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2311 +#: ../../library/stdtypes.rst:2317 msgid "" ">>> \"42\".zfill(5)\n" "'00042'\n" @@ -3511,11 +3535,197 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2321 +#: ../../library/stdtypes.rst:2338 +msgid "Formatted String Literals (f-strings)" +msgstr "" + +#: ../../library/stdtypes.rst:2341 +msgid "" +"The :keyword:`await` and :keyword:`async for` can be used in expressions " +"within f-strings." +msgstr "" + +#: ../../library/stdtypes.rst:2344 +msgid "Added the debugging operator (``=``)" +msgstr "" + +#: ../../library/stdtypes.rst:2346 +msgid "" +"Many restrictions on expressions within f-strings have been removed. " +"Notably, nested strings, comments, and backslashes are now permitted." +msgstr "" + +#: ../../library/stdtypes.rst:2350 +msgid "" +"An :dfn:`f-string` (formally a :dfn:`formatted string literal`) is a string " +"literal that is prefixed with ``f`` or ``F``. This type of string literal " +"allows embedding arbitrary Python expressions within *replacement fields*, " +"which are delimited by curly brackets (``{}``). These expressions are " +"evaluated at runtime, similarly to :meth:`str.format`, and are converted " +"into regular :class:`str` objects. For example:" +msgstr "" + +#: ../../library/stdtypes.rst:2358 +msgid "" +">>> who = 'nobody'\n" +">>> nationality = 'Spanish'\n" +">>> f'{who.title()} expects the {nationality} Inquisition!'\n" +"'Nobody expects the Spanish Inquisition!'" +msgstr "" + +#: ../../library/stdtypes.rst:2365 +msgid "It is also possible to use a multi line f-string:" +msgstr "" + +#: ../../library/stdtypes.rst:2367 +msgid "" +">>> f'''This is a string\n" +"... on two lines'''\n" +"'This is a string\\non two lines'" +msgstr "" + +#: ../../library/stdtypes.rst:2373 +msgid "" +"A single opening curly bracket, ``'{'``, marks a *replacement field* that " +"can contain any Python expression:" +msgstr "" + +#: ../../library/stdtypes.rst:2376 +msgid "" +">>> nationality = 'Spanish'\n" +">>> f'The {nationality} Inquisition!'\n" +"'The Spanish Inquisition!'" +msgstr "" + +#: ../../library/stdtypes.rst:2382 +msgid "To include a literal ``{`` or ``}``, use a double bracket:" +msgstr "" + +#: ../../library/stdtypes.rst:2384 +msgid "" +">>> x = 42\n" +">>> f'{{x}} is {x}'\n" +"'{x} is 42'" +msgstr "" + +#: ../../library/stdtypes.rst:2390 +msgid "" +"Functions can also be used, and :ref:`format specifiers `:" +msgstr "" + +#: ../../library/stdtypes.rst:2392 +msgid "" +">>> from math import sqrt\n" +">>> f'√2 \\N{ALMOST EQUAL TO} {sqrt(2):.5f}'\n" +"'√2 ≈ 1.41421'" +msgstr "" + +#: ../../library/stdtypes.rst:2398 +msgid "Any non-string expression is converted using :func:`str`, by default:" +msgstr "" + +#: ../../library/stdtypes.rst:2400 +msgid "" +">>> from fractions import Fraction\n" +">>> f'{Fraction(1, 3)}'\n" +"'1/3'" +msgstr "" + +#: ../../library/stdtypes.rst:2406 +msgid "" +"To use an explicit conversion, use the ``!`` (exclamation mark) operator, " +"followed by any of the valid formats, which are:" +msgstr "" + +#: ../../library/stdtypes.rst:2410 ../../library/stdtypes.rst:2578 +#: ../../library/stdtypes.rst:3797 +msgid "Conversion" +msgstr "" + +#: ../../library/stdtypes.rst:2412 +msgid "``!a``" +msgstr "``!a``" + +#: ../../library/stdtypes.rst:2412 +msgid ":func:`ascii`" +msgstr ":func:`ascii`" + +#: ../../library/stdtypes.rst:2413 +msgid "``!r``" +msgstr "``!r``" + +#: ../../library/stdtypes.rst:2413 +msgid ":func:`repr`" +msgstr ":func:`repr`" + +#: ../../library/stdtypes.rst:2414 +msgid "``!s``" +msgstr "``!s``" + +#: ../../library/stdtypes.rst:2414 +msgid ":func:`str`" +msgstr ":func:`str`" + +#: ../../library/stdtypes.rst:2417 +msgid "For example:" +msgstr "舉例來說:" + +#: ../../library/stdtypes.rst:2419 +msgid "" +">>> from fractions import Fraction\n" +">>> f'{Fraction(1, 3)!s}'\n" +"'1/3'\n" +">>> f'{Fraction(1, 3)!r}'\n" +"'Fraction(1, 3)'\n" +">>> question = '¿Dónde está el Presidente?'\n" +">>> print(f'{question!a}')\n" +"'\\xbfD\\xf3nde est\\xe1 el Presidente?'" +msgstr "" + +#: ../../library/stdtypes.rst:2430 +msgid "" +"While debugging it may be helpful to see both the expression and its value, " +"by using the equals sign (``=``) after the expression. This preserves spaces " +"within the brackets, and can be used with a converter. By default, the " +"debugging operator uses the :func:`repr` (``!r``) conversion. For example:" +msgstr "" + +#: ../../library/stdtypes.rst:2436 +msgid "" +">>> from fractions import Fraction\n" +">>> calculation = Fraction(1, 3)\n" +">>> f'{calculation=}'\n" +"'calculation=Fraction(1, 3)'\n" +">>> f'{calculation = }'\n" +"'calculation = Fraction(1, 3)'\n" +">>> f'{calculation = !s}'\n" +"'calculation = 1/3'" +msgstr "" + +#: ../../library/stdtypes.rst:2447 +msgid "" +"Once the output has been evaluated, it can be formatted using a :ref:`format " +"specifier ` following a colon (``':'``). After the expression " +"has been evaluated, and possibly converted to a string, the :meth:`!" +"__format__` method of the result is called with the format specifier, or the " +"empty string if no format specifier is given. The formatted result is then " +"used as the final value for the replacement field. For example:" +msgstr "" + +#: ../../library/stdtypes.rst:2455 +msgid "" +">>> from fractions import Fraction\n" +">>> f'{Fraction(1, 7):.6f}'\n" +"'0.142857'\n" +">>> f'{Fraction(1, 7):_^+10}'\n" +"'___+1/7___'" +msgstr "" + +#: ../../library/stdtypes.rst:2467 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:2334 +#: ../../library/stdtypes.rst:2480 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -3526,7 +3736,7 @@ msgid "" "or extensibility." msgstr "" -#: ../../library/stdtypes.rst:2342 +#: ../../library/stdtypes.rst:2488 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " @@ -3536,13 +3746,13 @@ msgid "" "function in the C language. For example:" msgstr "" -#: ../../library/stdtypes.rst:2349 +#: ../../library/stdtypes.rst:2495 msgid "" ">>> print('%s has %d quote types.' % ('Python', 2))\n" "Python has 2 quote types." msgstr "" -#: ../../library/stdtypes.rst:2354 +#: ../../library/stdtypes.rst:2500 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -3550,36 +3760,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:2364 ../../library/stdtypes.rst:3583 +#: ../../library/stdtypes.rst:2510 ../../library/stdtypes.rst:3729 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:2367 ../../library/stdtypes.rst:3586 +#: ../../library/stdtypes.rst:2513 ../../library/stdtypes.rst:3732 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:2369 ../../library/stdtypes.rst:3588 +#: ../../library/stdtypes.rst:2515 ../../library/stdtypes.rst:3734 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:2372 ../../library/stdtypes.rst:3591 +#: ../../library/stdtypes.rst:2518 ../../library/stdtypes.rst:3737 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:2375 ../../library/stdtypes.rst:3594 +#: ../../library/stdtypes.rst:2521 ../../library/stdtypes.rst:3740 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is read from the next element of the tuple in *values*, and the " "object to convert comes after the minimum field width and optional precision." msgstr "" -#: ../../library/stdtypes.rst:2379 ../../library/stdtypes.rst:3598 +#: ../../library/stdtypes.rst:2525 ../../library/stdtypes.rst:3744 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -3587,15 +3797,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:2384 ../../library/stdtypes.rst:3603 +#: ../../library/stdtypes.rst:2530 ../../library/stdtypes.rst:3749 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:2386 ../../library/stdtypes.rst:3605 +#: ../../library/stdtypes.rst:2532 ../../library/stdtypes.rst:3751 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:2388 +#: ../../library/stdtypes.rst:2534 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the string *must* include a parenthesised mapping key into that " @@ -3603,297 +3813,293 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:2397 ../../library/stdtypes.rst:3616 +#: ../../library/stdtypes.rst:2543 ../../library/stdtypes.rst:3762 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:2400 ../../library/stdtypes.rst:3619 +#: ../../library/stdtypes.rst:2546 ../../library/stdtypes.rst:3765 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:2409 ../../library/stdtypes.rst:3628 +#: ../../library/stdtypes.rst:2555 ../../library/stdtypes.rst:3774 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:2411 ../../library/stdtypes.rst:3630 +#: ../../library/stdtypes.rst:2557 ../../library/stdtypes.rst:3776 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:2411 ../../library/stdtypes.rst:3630 +#: ../../library/stdtypes.rst:2557 ../../library/stdtypes.rst:3776 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:2414 ../../library/stdtypes.rst:3633 +#: ../../library/stdtypes.rst:2560 ../../library/stdtypes.rst:3779 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:2414 ../../library/stdtypes.rst:3633 +#: ../../library/stdtypes.rst:2560 ../../library/stdtypes.rst:3779 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:2416 ../../library/stdtypes.rst:3635 +#: ../../library/stdtypes.rst:2562 ../../library/stdtypes.rst:3781 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:2416 ../../library/stdtypes.rst:3635 +#: ../../library/stdtypes.rst:2562 ../../library/stdtypes.rst:3781 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:2419 ../../library/stdtypes.rst:3638 +#: ../../library/stdtypes.rst:2565 ../../library/stdtypes.rst:3784 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2419 ../../library/stdtypes.rst:3638 +#: ../../library/stdtypes.rst:2565 ../../library/stdtypes.rst:3784 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:3641 +#: ../../library/stdtypes.rst:2568 ../../library/stdtypes.rst:3787 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:3641 +#: ../../library/stdtypes.rst:2568 ../../library/stdtypes.rst:3787 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:2426 ../../library/stdtypes.rst:3645 +#: ../../library/stdtypes.rst:2572 ../../library/stdtypes.rst:3791 msgid "" "A length modifier (``h``, ``l``, or ``L``) may be present, but is ignored as " "it is not necessary for Python -- so e.g. ``%ld`` is identical to ``%d``." msgstr "" -#: ../../library/stdtypes.rst:2429 ../../library/stdtypes.rst:3648 +#: ../../library/stdtypes.rst:2575 ../../library/stdtypes.rst:3794 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:2432 ../../library/stdtypes.rst:3651 -msgid "Conversion" -msgstr "" - -#: ../../library/stdtypes.rst:2434 ../../library/stdtypes.rst:3653 +#: ../../library/stdtypes.rst:2580 ../../library/stdtypes.rst:3799 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:2434 ../../library/stdtypes.rst:2436 -#: ../../library/stdtypes.rst:3653 ../../library/stdtypes.rst:3655 +#: ../../library/stdtypes.rst:2580 ../../library/stdtypes.rst:2582 +#: ../../library/stdtypes.rst:3799 ../../library/stdtypes.rst:3801 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:2436 ../../library/stdtypes.rst:3655 +#: ../../library/stdtypes.rst:2582 ../../library/stdtypes.rst:3801 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 +#: ../../library/stdtypes.rst:2584 ../../library/stdtypes.rst:3803 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 +#: ../../library/stdtypes.rst:2584 ../../library/stdtypes.rst:3803 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3659 +#: ../../library/stdtypes.rst:2586 ../../library/stdtypes.rst:3805 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3659 +#: ../../library/stdtypes.rst:2586 ../../library/stdtypes.rst:3805 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:3661 +#: ../../library/stdtypes.rst:2588 ../../library/stdtypes.rst:3807 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:3661 +#: ../../library/stdtypes.rst:2588 ../../library/stdtypes.rst:3807 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2444 ../../library/stdtypes.rst:3663 +#: ../../library/stdtypes.rst:2590 ../../library/stdtypes.rst:3809 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:2444 ../../library/stdtypes.rst:3663 +#: ../../library/stdtypes.rst:2590 ../../library/stdtypes.rst:3809 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2446 ../../library/stdtypes.rst:3665 +#: ../../library/stdtypes.rst:2592 ../../library/stdtypes.rst:3811 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:2446 ../../library/stdtypes.rst:3665 +#: ../../library/stdtypes.rst:2592 ../../library/stdtypes.rst:3811 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:3667 +#: ../../library/stdtypes.rst:2594 ../../library/stdtypes.rst:3813 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:3667 +#: ../../library/stdtypes.rst:2594 ../../library/stdtypes.rst:3813 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2450 ../../library/stdtypes.rst:3669 +#: ../../library/stdtypes.rst:2596 ../../library/stdtypes.rst:3815 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:2450 ../../library/stdtypes.rst:2452 -#: ../../library/stdtypes.rst:3669 ../../library/stdtypes.rst:3671 +#: ../../library/stdtypes.rst:2596 ../../library/stdtypes.rst:2598 +#: ../../library/stdtypes.rst:3815 ../../library/stdtypes.rst:3817 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:2452 ../../library/stdtypes.rst:3671 +#: ../../library/stdtypes.rst:2598 ../../library/stdtypes.rst:3817 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:3673 +#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:3819 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:3673 +#: ../../library/stdtypes.rst:2600 ../../library/stdtypes.rst:3819 msgid "" "Floating-point format. Uses lowercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2458 ../../library/stdtypes.rst:3677 +#: ../../library/stdtypes.rst:2604 ../../library/stdtypes.rst:3823 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2458 ../../library/stdtypes.rst:3677 +#: ../../library/stdtypes.rst:2604 ../../library/stdtypes.rst:3823 msgid "" "Floating-point format. Uses uppercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2462 ../../library/stdtypes.rst:3681 +#: ../../library/stdtypes.rst:2608 ../../library/stdtypes.rst:3827 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:2462 +#: ../../library/stdtypes.rst:2608 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:2465 ../../library/stdtypes.rst:3694 +#: ../../library/stdtypes.rst:2611 ../../library/stdtypes.rst:3840 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:2465 +#: ../../library/stdtypes.rst:2611 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:2468 ../../library/stdtypes.rst:3688 +#: ../../library/stdtypes.rst:2614 ../../library/stdtypes.rst:3834 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:2468 +#: ../../library/stdtypes.rst:2614 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:2471 ../../library/stdtypes.rst:3691 +#: ../../library/stdtypes.rst:2617 ../../library/stdtypes.rst:3837 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:2471 +#: ../../library/stdtypes.rst:2617 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:2474 ../../library/stdtypes.rst:3697 +#: ../../library/stdtypes.rst:2620 ../../library/stdtypes.rst:3843 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:2474 ../../library/stdtypes.rst:3697 +#: ../../library/stdtypes.rst:2620 ../../library/stdtypes.rst:3843 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:2481 ../../library/stdtypes.rst:3704 +#: ../../library/stdtypes.rst:2627 ../../library/stdtypes.rst:3850 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:2485 ../../library/stdtypes.rst:3708 +#: ../../library/stdtypes.rst:2631 ../../library/stdtypes.rst:3854 msgid "" "The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on " "whether the ``'x'`` or ``'X'`` format was used) to be inserted before the " "first digit." msgstr "" -#: ../../library/stdtypes.rst:2489 ../../library/stdtypes.rst:3712 +#: ../../library/stdtypes.rst:2635 ../../library/stdtypes.rst:3858 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:2492 ../../library/stdtypes.rst:3715 +#: ../../library/stdtypes.rst:2638 ../../library/stdtypes.rst:3861 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2496 ../../library/stdtypes.rst:3719 +#: ../../library/stdtypes.rst:2642 ../../library/stdtypes.rst:3865 msgid "" "The alternate form causes the result to always contain a decimal point, and " "trailing zeroes are not removed as they would otherwise be." msgstr "" -#: ../../library/stdtypes.rst:2499 ../../library/stdtypes.rst:3722 +#: ../../library/stdtypes.rst:2645 ../../library/stdtypes.rst:3868 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2503 ../../library/stdtypes.rst:3726 +#: ../../library/stdtypes.rst:2649 ../../library/stdtypes.rst:3872 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:2506 ../../library/stdtypes.rst:3735 +#: ../../library/stdtypes.rst:2652 ../../library/stdtypes.rst:3881 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:2508 +#: ../../library/stdtypes.rst:2654 msgid "" "Since Python strings have an explicit length, ``%s`` conversions do not " "assume that ``'\\0'`` is the end of the string." msgstr "" -#: ../../library/stdtypes.rst:2513 +#: ../../library/stdtypes.rst:2659 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:2524 +#: ../../library/stdtypes.rst:2670 msgid "" -"Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" -"`memoryview`" +"Binary Sequence Types " +"--- :class:`bytes`, :class:`bytearray`, :class:`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:2532 +#: ../../library/stdtypes.rst:2678 msgid "" -"The core built-in types for manipulating binary data are :class:`bytes` and :" -"class:`bytearray`. They are supported by :class:`memoryview` which uses the :" -"ref:`buffer protocol ` to access the memory of other binary " -"objects without needing to make a copy." +"The core built-in types for manipulating binary data are :class:`bytes` " +"and :class:`bytearray`. They are supported by :class:`memoryview` which uses " +"the :ref:`buffer protocol ` to access the memory of other " +"binary objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:2537 +#: ../../library/stdtypes.rst:2683 msgid "" "The :mod:`array` module supports efficient storage of basic data types like " "32-bit integers and IEEE754 double-precision floating values." msgstr "" -#: ../../library/stdtypes.rst:2543 +#: ../../library/stdtypes.rst:2689 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:2547 +#: ../../library/stdtypes.rst:2693 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -3901,40 +4107,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:2554 +#: ../../library/stdtypes.rst:2700 msgid "" "Firstly, the syntax for bytes literals is largely the same as that for " "string literals, except that a ``b`` prefix is added:" msgstr "" -#: ../../library/stdtypes.rst:2557 +#: ../../library/stdtypes.rst:2703 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:2558 +#: ../../library/stdtypes.rst:2704 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:2559 +#: ../../library/stdtypes.rst:2705 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:2561 +#: ../../library/stdtypes.rst:2707 msgid "" "Only ASCII characters are permitted in bytes literals (regardless of the " "declared source code encoding). Any binary values over 127 must be entered " "into bytes literals using the appropriate escape sequence." msgstr "" -#: ../../library/stdtypes.rst:2565 +#: ../../library/stdtypes.rst:2711 msgid "" "As with string literals, bytes literals may also use a ``r`` prefix to " "disable processing of escape sequences. See :ref:`strings` for more about " "the various forms of bytes literal, including supported escape sequences." msgstr "" -#: ../../library/stdtypes.rst:2569 +#: ../../library/stdtypes.rst:2715 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -3947,29 +4153,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:2579 +#: ../../library/stdtypes.rst:2725 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:2582 +#: ../../library/stdtypes.rst:2728 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:2583 +#: ../../library/stdtypes.rst:2729 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2584 +#: ../../library/stdtypes.rst:2730 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:2586 +#: ../../library/stdtypes.rst:2732 msgid "Also see the :ref:`bytes ` built-in." -msgstr "" +msgstr "另見內建的 :ref:`bytes `。" -#: ../../library/stdtypes.rst:2588 +#: ../../library/stdtypes.rst:2734 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -3977,32 +4183,32 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:2594 +#: ../../library/stdtypes.rst:2740 msgid "" "This :class:`bytes` class method returns a bytes object, decoding the given " "string object. The string must contain two hexadecimal digits per byte, " "with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2601 +#: ../../library/stdtypes.rst:2747 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:2605 +#: ../../library/stdtypes.rst:2751 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2610 ../../library/stdtypes.rst:2695 +#: ../../library/stdtypes.rst:2756 ../../library/stdtypes.rst:2841 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:2616 +#: ../../library/stdtypes.rst:2762 msgid "" "If you want to make the hex string easier to read, you can specify a single " "character separator *sep* parameter to include in the output. By default, " @@ -4011,13 +4217,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:2633 +#: ../../library/stdtypes.rst:2779 msgid "" ":meth:`bytes.hex` now supports optional *sep* and *bytes_per_sep* parameters " "to insert separators between bytes in the hex output." msgstr "" -#: ../../library/stdtypes.rst:2637 +#: ../../library/stdtypes.rst:2783 msgid "" "Since bytes objects are sequences of integers (akin to a tuple), for a bytes " "object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes " @@ -4025,58 +4231,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2642 +#: ../../library/stdtypes.rst:2788 msgid "" "The representation of bytes objects uses the literal format (``b'...'``) " "since it is often more useful than e.g. ``bytes([46, 46, 46])``. You can " "always convert a bytes object into a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2650 +#: ../../library/stdtypes.rst:2796 msgid "Bytearray Objects" -msgstr "" +msgstr "Bytearray 物件" -#: ../../library/stdtypes.rst:2654 +#: ../../library/stdtypes.rst:2800 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:2659 +#: ../../library/stdtypes.rst:2805 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:2662 +#: ../../library/stdtypes.rst:2808 msgid "Creating an empty instance: ``bytearray()``" -msgstr "" +msgstr "建立一個空的實例:``bytearray()``" -#: ../../library/stdtypes.rst:2663 +#: ../../library/stdtypes.rst:2809 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:2664 +#: ../../library/stdtypes.rst:2810 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2665 +#: ../../library/stdtypes.rst:2811 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:2667 +#: ../../library/stdtypes.rst:2813 msgid "" "As bytearray objects are mutable, they support the :ref:`mutable ` sequence operations in addition to the common bytes and bytearray " "operations described in :ref:`bytes-methods`." msgstr "" -#: ../../library/stdtypes.rst:2671 +#: ../../library/stdtypes.rst:2817 msgid "Also see the :ref:`bytearray ` built-in." -msgstr "" +msgstr "另見內建的 :ref:`bytearray `。" -#: ../../library/stdtypes.rst:2673 +#: ../../library/stdtypes.rst:2819 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4084,33 +4290,33 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:2679 +#: ../../library/stdtypes.rst:2825 msgid "" "This :class:`bytearray` class method returns bytearray object, decoding the " "given string object. The string must contain two hexadecimal digits per " "byte, with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2686 +#: ../../library/stdtypes.rst:2832 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:2690 +#: ../../library/stdtypes.rst:2836 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2703 +#: ../../library/stdtypes.rst:2849 msgid "" "Similar to :meth:`bytes.hex`, :meth:`bytearray.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:2708 +#: ../../library/stdtypes.rst:2854 msgid "" "Since bytearray objects are sequences of integers (akin to a list), for a " "bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be " @@ -4118,7 +4324,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2713 +#: ../../library/stdtypes.rst:2859 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -4126,11 +4332,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2722 +#: ../../library/stdtypes.rst:2868 msgid "Bytes and Bytearray Operations" -msgstr "" +msgstr "Bytes 和 Bytearray 的操作" -#: ../../library/stdtypes.rst:2727 +#: ../../library/stdtypes.rst:2873 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -4139,14 +4345,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:2735 +#: ../../library/stdtypes.rst:2881 msgid "" "The methods on bytes and bytearray objects don't accept strings as their " "arguments, just as the methods on strings don't accept bytes as their " "arguments. For example, you have to write::" msgstr "" -#: ../../library/stdtypes.rst:2739 +#: ../../library/stdtypes.rst:2885 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -4154,11 +4360,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:2742 +#: ../../library/stdtypes.rst:2888 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:2744 +#: ../../library/stdtypes.rst:2890 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -4166,60 +4372,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:2747 +#: ../../library/stdtypes.rst:2893 msgid "" "Some bytes and bytearray operations assume the use of ASCII compatible " "binary formats, and hence should be avoided when working with arbitrary " "binary data. These restrictions are covered below." msgstr "" -#: ../../library/stdtypes.rst:2752 +#: ../../library/stdtypes.rst:2898 msgid "" "Using these ASCII based operations to manipulate binary data that is not " "stored in an ASCII based format may lead to data corruption." msgstr "" -#: ../../library/stdtypes.rst:2755 +#: ../../library/stdtypes.rst:2901 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:2761 +#: ../../library/stdtypes.rst:2907 msgid "" "Return the number of non-overlapping occurrences of subsequence *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" -#: ../../library/stdtypes.rst:2765 ../../library/stdtypes.rst:2870 -#: ../../library/stdtypes.rst:2892 ../../library/stdtypes.rst:2958 -#: ../../library/stdtypes.rst:2971 +#: ../../library/stdtypes.rst:2911 ../../library/stdtypes.rst:3016 +#: ../../library/stdtypes.rst:3038 ../../library/stdtypes.rst:3104 +#: ../../library/stdtypes.rst:3117 msgid "" "The subsequence to search for may be any :term:`bytes-like object` or an " "integer in the range 0 to 255." msgstr "" -#: ../../library/stdtypes.rst:2768 +#: ../../library/stdtypes.rst:2914 msgid "" "If *sub* is empty, returns the number of empty slices between characters " "which is the length of the bytes object plus one." msgstr "" -#: ../../library/stdtypes.rst:2771 ../../library/stdtypes.rst:2882 -#: ../../library/stdtypes.rst:2895 ../../library/stdtypes.rst:2961 -#: ../../library/stdtypes.rst:2974 +#: ../../library/stdtypes.rst:2917 ../../library/stdtypes.rst:3028 +#: ../../library/stdtypes.rst:3041 ../../library/stdtypes.rst:3107 +#: ../../library/stdtypes.rst:3120 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:2778 +#: ../../library/stdtypes.rst:2924 msgid "" "If the binary data starts with the *prefix* string, return " "``bytes[len(prefix):]``. Otherwise, return a copy of the original binary " "data::" msgstr "" -#: ../../library/stdtypes.rst:2782 +#: ../../library/stdtypes.rst:2928 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -4231,32 +4437,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:2787 +#: ../../library/stdtypes.rst:2933 msgid "The *prefix* may be any :term:`bytes-like object`." -msgstr "" - -#: ../../library/stdtypes.rst:2791 ../../library/stdtypes.rst:2813 -#: ../../library/stdtypes.rst:2946 ../../library/stdtypes.rst:3039 -#: ../../library/stdtypes.rst:3053 ../../library/stdtypes.rst:3084 -#: ../../library/stdtypes.rst:3098 ../../library/stdtypes.rst:3140 -#: ../../library/stdtypes.rst:3211 ../../library/stdtypes.rst:3229 -#: ../../library/stdtypes.rst:3257 ../../library/stdtypes.rst:3396 -#: ../../library/stdtypes.rst:3451 ../../library/stdtypes.rst:3494 -#: ../../library/stdtypes.rst:3515 ../../library/stdtypes.rst:3537 -#: ../../library/stdtypes.rst:3739 +msgstr "*prefix* 可以是任何的 :term:`bytes-like object`。" + +#: ../../library/stdtypes.rst:2937 ../../library/stdtypes.rst:2959 +#: ../../library/stdtypes.rst:3092 ../../library/stdtypes.rst:3185 +#: ../../library/stdtypes.rst:3199 ../../library/stdtypes.rst:3230 +#: ../../library/stdtypes.rst:3244 ../../library/stdtypes.rst:3286 +#: ../../library/stdtypes.rst:3357 ../../library/stdtypes.rst:3375 +#: ../../library/stdtypes.rst:3403 ../../library/stdtypes.rst:3542 +#: ../../library/stdtypes.rst:3597 ../../library/stdtypes.rst:3640 +#: ../../library/stdtypes.rst:3661 ../../library/stdtypes.rst:3683 +#: ../../library/stdtypes.rst:3885 msgid "" "The bytearray version of this method does *not* operate in place - it always " "produces a new object, even if no changes were made." msgstr "" -#: ../../library/stdtypes.rst:2800 +#: ../../library/stdtypes.rst:2946 msgid "" "If the binary data ends with the *suffix* string and that *suffix* is not " "empty, return ``bytes[:-len(suffix)]``. Otherwise, return a copy of the " "original binary data::" msgstr "" -#: ../../library/stdtypes.rst:2804 +#: ../../library/stdtypes.rst:2950 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -4268,37 +4474,37 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:2809 +#: ../../library/stdtypes.rst:2955 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2822 +#: ../../library/stdtypes.rst:2968 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:2827 +#: ../../library/stdtypes.rst:2973 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " -"are ``'ignore'``, ``'replace'``, and any other name registered via :func:" -"`codecs.register_error`. See :ref:`error-handlers` for details." +"are ``'ignore'``, ``'replace'``, and any other name registered " +"via :func:`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:2833 +#: ../../library/stdtypes.rst:2979 msgid "" "For performance reasons, the value of *errors* is not checked for validity " -"unless a decoding error actually occurs, :ref:`devmode` is enabled or a :ref:" -"`debug build ` is used." +"unless a decoding error actually occurs, :ref:`devmode` is enabled or " +"a :ref:`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:2839 +#: ../../library/stdtypes.rst:2985 msgid "" -"Passing the *encoding* argument to :class:`str` allows decoding any :term:" -"`bytes-like object` directly, without needing to make a temporary :class:`!" -"bytes` or :class:`!bytearray` object." +"Passing the *encoding* argument to :class:`str` allows decoding " +"any :term:`bytes-like object` directly, without needing to make a " +"temporary :class:`!bytes` or :class:`!bytearray` object." msgstr "" -#: ../../library/stdtypes.rst:2854 +#: ../../library/stdtypes.rst:3000 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -4306,11 +4512,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:2859 +#: ../../library/stdtypes.rst:3005 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2865 +#: ../../library/stdtypes.rst:3011 msgid "" "Return the lowest index in the data where the subsequence *sub* is found, " "such that *sub* is contained in the slice ``s[start:end]``. Optional " @@ -4318,14 +4524,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:2875 +#: ../../library/stdtypes.rst:3021 msgid "" "The :meth:`~bytes.find` method should be used only if you need to know the " -"position of *sub*. To check if *sub* is a substring or not, use the :" -"keyword:`in` operator::" +"position of *sub*. To check if *sub* is a substring or not, use " +"the :keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:2879 +#: ../../library/stdtypes.rst:3025 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -4333,13 +4539,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:2889 +#: ../../library/stdtypes.rst:3035 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:2902 +#: ../../library/stdtypes.rst:3048 msgid "" "Return a bytes or bytearray object which is the concatenation of the binary " "data sequences in *iterable*. A :exc:`TypeError` will be raised if there " @@ -4349,15 +4555,15 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:2913 +#: ../../library/stdtypes.rst:3059 msgid "" -"This static method returns a translation table usable for :meth:`bytes." -"translate` that will map each character in *from* into the character at the " -"same position in *to*; *from* and *to* must both be :term:`bytes-like " -"objects ` and have the same length." +"This static method returns a translation table usable " +"for :meth:`bytes.translate` that will map each character in *from* into the " +"character at the same position in *to*; *from* and *to* must both " +"be :term:`bytes-like objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:2924 +#: ../../library/stdtypes.rst:3070 msgid "" "Split the sequence at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -4366,24 +4572,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:2931 ../../library/stdtypes.rst:2988 +#: ../../library/stdtypes.rst:3077 ../../library/stdtypes.rst:3134 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2937 +#: ../../library/stdtypes.rst:3083 msgid "" "Return a copy of the sequence with all occurrences of subsequence *old* " "replaced by *new*. If the optional argument *count* is given, only the " "first *count* occurrences are replaced." msgstr "" -#: ../../library/stdtypes.rst:2941 +#: ../../library/stdtypes.rst:3087 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:2953 +#: ../../library/stdtypes.rst:3099 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -4391,13 +4597,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2968 +#: ../../library/stdtypes.rst:3114 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:2981 +#: ../../library/stdtypes.rst:3127 msgid "" "Split the sequence at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -4406,7 +4612,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:2994 +#: ../../library/stdtypes.rst:3140 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -4414,11 +4620,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:2999 +#: ../../library/stdtypes.rst:3145 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:3005 +#: ../../library/stdtypes.rst:3151 msgid "" "Return a copy of the bytes or bytearray object where all bytes occurring in " "the optional argument *delete* are removed, and the remaining bytes have " @@ -4426,18 +4632,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3010 +#: ../../library/stdtypes.rst:3156 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3013 +#: ../../library/stdtypes.rst:3159 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3016 +#: ../../library/stdtypes.rst:3162 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -4445,11 +4651,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3019 +#: ../../library/stdtypes.rst:3165 msgid "*delete* is now supported as a keyword argument." -msgstr "" +msgstr "支援 *delete* 關鍵字引數。" -#: ../../library/stdtypes.rst:3023 +#: ../../library/stdtypes.rst:3169 msgid "" "The following methods on bytes and bytearray objects have default behaviours " "that assume the use of ASCII compatible binary formats, but can still be " @@ -4458,7 +4664,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3032 +#: ../../library/stdtypes.rst:3178 msgid "" "Return a copy of the object centered in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4466,7 +4672,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3046 +#: ../../library/stdtypes.rst:3192 msgid "" "Return a copy of the object left justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4474,7 +4680,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3060 +#: ../../library/stdtypes.rst:3206 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " "*chars* argument is a binary sequence specifying the set of byte values to " @@ -4484,7 +4690,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3067 +#: ../../library/stdtypes.rst:3213 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -4496,14 +4702,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3072 +#: ../../library/stdtypes.rst:3218 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removeprefix` for a method that will remove a " "single prefix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3077 +#: ../../library/stdtypes.rst:3223 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -4515,7 +4721,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3091 +#: ../../library/stdtypes.rst:3237 msgid "" "Return a copy of the object right justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4523,7 +4729,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3105 +#: ../../library/stdtypes.rst:3251 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are " @@ -4533,7 +4739,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3116 +#: ../../library/stdtypes.rst:3262 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " "*chars* argument is a binary sequence specifying the set of byte values to " @@ -4543,7 +4749,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3123 +#: ../../library/stdtypes.rst:3269 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -4555,14 +4761,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3128 +#: ../../library/stdtypes.rst:3274 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removesuffix` for a method that will remove a " "single suffix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3133 +#: ../../library/stdtypes.rst:3279 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -4574,7 +4780,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3147 +#: ../../library/stdtypes.rst:3293 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given and non-negative, at most " @@ -4583,7 +4789,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3153 +#: ../../library/stdtypes.rst:3299 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty subsequences (for example, ``b'1,,2'.split(b',')`` " @@ -4594,7 +4800,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3163 +#: ../../library/stdtypes.rst:3309 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -4614,7 +4820,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3172 +#: ../../library/stdtypes.rst:3318 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive ASCII whitespace are regarded as a single " @@ -4624,7 +4830,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3182 +#: ../../library/stdtypes.rst:3328 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -4640,7 +4846,7 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3193 +#: ../../library/stdtypes.rst:3339 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " "removed. The *chars* argument is a binary sequence specifying the set of " @@ -4650,7 +4856,7 @@ msgid "" "a prefix or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3201 +#: ../../library/stdtypes.rst:3347 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -4662,13 +4868,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3206 +#: ../../library/stdtypes.rst:3352 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3215 +#: ../../library/stdtypes.rst:3361 msgid "" "The following methods on bytes and bytearray objects assume the use of ASCII " "compatible binary formats and should not be applied to arbitrary binary " @@ -4676,14 +4882,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3223 +#: ../../library/stdtypes.rst:3369 msgid "" "Return a copy of the sequence with each byte interpreted as an ASCII " "character, and the first byte capitalized and the rest lowercased. Non-ASCII " "byte values are passed through unchanged." msgstr "" -#: ../../library/stdtypes.rst:3236 +#: ../../library/stdtypes.rst:3382 msgid "" "Return a copy of the sequence where all ASCII tab characters are replaced by " "one or more ASCII spaces, depending on the current column and the given tab " @@ -4699,7 +4905,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3250 +#: ../../library/stdtypes.rst:3396 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -4711,7 +4917,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:3264 +#: ../../library/stdtypes.rst:3410 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -4720,7 +4926,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3272 +#: ../../library/stdtypes.rst:3418 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -4732,7 +4938,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:3281 +#: ../../library/stdtypes.rst:3427 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -4740,7 +4946,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3288 +#: ../../library/stdtypes.rst:3434 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -4752,20 +4958,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:3297 +#: ../../library/stdtypes.rst:3443 msgid "" "Return ``True`` if the sequence is empty or all bytes in the sequence are " "ASCII, ``False`` otherwise. ASCII bytes are in the range 0-0x7F." msgstr "" -#: ../../library/stdtypes.rst:3307 +#: ../../library/stdtypes.rst:3453 msgid "" "Return ``True`` if all bytes in the sequence are ASCII decimal digits and " "the sequence is not empty, ``False`` otherwise. ASCII decimal digits are " "those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3313 +#: ../../library/stdtypes.rst:3459 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -4777,13 +4983,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:3322 +#: ../../library/stdtypes.rst:3468 msgid "" "Return ``True`` if there is at least one lowercase ASCII character in the " "sequence and no uppercase ASCII characters, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:3327 +#: ../../library/stdtypes.rst:3473 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -4795,16 +5001,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:3332 ../../library/stdtypes.rst:3374 -#: ../../library/stdtypes.rst:3390 ../../library/stdtypes.rst:3440 -#: ../../library/stdtypes.rst:3509 +#: ../../library/stdtypes.rst:3478 ../../library/stdtypes.rst:3520 +#: ../../library/stdtypes.rst:3536 ../../library/stdtypes.rst:3586 +#: ../../library/stdtypes.rst:3655 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " "values in the sequence ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3340 +#: ../../library/stdtypes.rst:3486 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -4812,14 +5018,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:3349 +#: ../../library/stdtypes.rst:3495 msgid "" "Return ``True`` if the sequence is ASCII titlecase and the sequence is not " "empty, ``False`` otherwise. See :meth:`bytes.title` for more details on the " "definition of \"titlecase\"." msgstr "" -#: ../../library/stdtypes.rst:3355 +#: ../../library/stdtypes.rst:3501 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -4831,14 +5037,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:3364 +#: ../../library/stdtypes.rst:3510 msgid "" "Return ``True`` if there is at least one uppercase alphabetic ASCII " "character in the sequence and no lowercase ASCII characters, ``False`` " "otherwise." msgstr "" -#: ../../library/stdtypes.rst:3369 +#: ../../library/stdtypes.rst:3515 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -4850,13 +5056,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:3382 +#: ../../library/stdtypes.rst:3528 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3387 +#: ../../library/stdtypes.rst:3533 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -4864,7 +5070,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:3407 +#: ../../library/stdtypes.rst:3553 msgid "" "Return a list of the lines in the binary sequence, breaking at ASCII line " "boundaries. This method uses the :term:`universal newlines` approach to " @@ -4872,7 +5078,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:3414 +#: ../../library/stdtypes.rst:3560 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -4884,14 +5090,14 @@ msgstr "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']" -#: ../../library/stdtypes.rst:3419 +#: ../../library/stdtypes.rst:3565 msgid "" "Unlike :meth:`~bytes.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:3423 +#: ../../library/stdtypes.rst:3569 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -4903,13 +5109,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:3432 +#: ../../library/stdtypes.rst:3578 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart and vice-versa." msgstr "" -#: ../../library/stdtypes.rst:3437 +#: ../../library/stdtypes.rst:3583 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -4917,22 +5123,22 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:3444 +#: ../../library/stdtypes.rst:3590 msgid "" -"Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." -"swapcase() == bin`` for the binary versions. Case conversions are " -"symmetrical in ASCII, even though that is not generally true for arbitrary " -"Unicode code points." +"Unlike :func:`str.swapcase`, it is always the case that " +"``bin.swapcase().swapcase() == bin`` for the binary versions. Case " +"conversions are symmetrical in ASCII, even though that is not generally true " +"for arbitrary Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:3458 +#: ../../library/stdtypes.rst:3604 msgid "" "Return a titlecased version of the binary sequence where words start with an " "uppercase ASCII character and the remaining characters are lowercase. " "Uncased byte values are left unmodified." msgstr "" -#: ../../library/stdtypes.rst:3464 +#: ../../library/stdtypes.rst:3610 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -4940,7 +5146,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:3467 +#: ../../library/stdtypes.rst:3613 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -4948,7 +5154,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:3477 +#: ../../library/stdtypes.rst:3623 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -4956,12 +5162,12 @@ msgstr "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:3480 +#: ../../library/stdtypes.rst:3626 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:3482 +#: ../../library/stdtypes.rst:3628 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -4983,13 +5189,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:3501 +#: ../../library/stdtypes.rst:3647 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3506 +#: ../../library/stdtypes.rst:3652 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -4997,7 +5203,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:3522 +#: ../../library/stdtypes.rst:3668 msgid "" "Return a copy of the sequence left filled with ASCII ``b'0'`` digits to make " "a sequence of length *width*. A leading sign prefix (``b'+'``/ ``b'-'``) is " @@ -5006,7 +5212,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:3530 +#: ../../library/stdtypes.rst:3676 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -5018,11 +5224,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:3544 +#: ../../library/stdtypes.rst:3690 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:3561 +#: ../../library/stdtypes.rst:3707 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -5030,17 +5236,17 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:3566 +#: ../../library/stdtypes.rst:3712 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " "*interpolation* operator. Given ``format % values`` (where *format* is a " "bytes object), ``%`` conversion specifications in *format* are replaced with " -"zero or more elements of *values*. The effect is similar to using the :c:" -"func:`sprintf` in the C language." +"zero or more elements of *values*. The effect is similar to using " +"the :c:func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:3573 +#: ../../library/stdtypes.rst:3719 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -5048,7 +5254,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:3607 +#: ../../library/stdtypes.rst:3753 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the bytes object *must* include a parenthesised mapping key into " @@ -5056,73 +5262,73 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:3681 +#: ../../library/stdtypes.rst:3827 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:3684 +#: ../../library/stdtypes.rst:3830 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:3684 +#: ../../library/stdtypes.rst:3830 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:3688 +#: ../../library/stdtypes.rst:3834 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3691 +#: ../../library/stdtypes.rst:3837 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:3694 +#: ../../library/stdtypes.rst:3840 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3694 +#: ../../library/stdtypes.rst:3840 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:3729 +#: ../../library/stdtypes.rst:3875 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." -msgstr "" +msgstr "``b'%s'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:3732 +#: ../../library/stdtypes.rst:3878 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." -msgstr "" +msgstr "``b'%r'`` 已被棄用,但在 3.x 系列中不會被移除。" -#: ../../library/stdtypes.rst:3744 +#: ../../library/stdtypes.rst:3890 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:3751 +#: ../../library/stdtypes.rst:3897 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:3753 +#: ../../library/stdtypes.rst:3899 msgid "" ":class:`memoryview` objects allow Python code to access the internal data of " "an object that supports the :ref:`buffer protocol ` without " "copying." msgstr "" -#: ../../library/stdtypes.rst:3759 +#: ../../library/stdtypes.rst:3905 msgid "" "Create a :class:`memoryview` that references *object*. *object* must " "support the buffer protocol. Built-in objects that support the buffer " "protocol include :class:`bytes` and :class:`bytearray`." msgstr "" -#: ../../library/stdtypes.rst:3763 +#: ../../library/stdtypes.rst:3909 msgid "" "A :class:`memoryview` has the notion of an *element*, which is the atomic " "memory unit handled by the originating *object*. For many simple types such " @@ -5130,32 +5336,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:3768 +#: ../../library/stdtypes.rst:3914 msgid "" "``len(view)`` is equal to the length of :class:`~memoryview.tolist`, which " "is the nested list representation of the view. If ``view.ndim = 1``, this is " "equal to the number of elements in the view." msgstr "" -#: ../../library/stdtypes.rst:3772 +#: ../../library/stdtypes.rst:3918 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:3775 +#: ../../library/stdtypes.rst:3921 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:3778 +#: ../../library/stdtypes.rst:3924 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:3781 +#: ../../library/stdtypes.rst:3927 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -5177,7 +5383,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:3791 +#: ../../library/stdtypes.rst:3937 msgid "" "If :class:`~memoryview.format` is one of the native format specifiers from " "the :mod:`struct` module, indexing with an integer or a tuple of integers is " @@ -5188,11 +5394,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:3800 +#: ../../library/stdtypes.rst:3946 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:3802 +#: ../../library/stdtypes.rst:3948 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -5214,13 +5420,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:3812 +#: ../../library/stdtypes.rst:3958 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:3815 +#: ../../library/stdtypes.rst:3961 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -5260,14 +5466,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:3833 +#: ../../library/stdtypes.rst:3979 msgid "" "One-dimensional memoryviews of :term:`hashable` (read-only) types with " "formats 'B', 'b' or 'c' are also hashable. The hash is defined as ``hash(m) " "== hash(m.tobytes())``::" msgstr "" -#: ../../library/stdtypes.rst:3837 +#: ../../library/stdtypes.rst:3983 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -5285,40 +5491,41 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:3845 +#: ../../library/stdtypes.rst:3991 msgid "" "One-dimensional memoryviews can now be sliced. One-dimensional memoryviews " "with formats 'B', 'b' or 'c' are now :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:3849 +#: ../../library/stdtypes.rst:3995 msgid "" -"memoryview is now registered automatically with :class:`collections.abc." -"Sequence`" +"memoryview is now registered automatically " +"with :class:`collections.abc.Sequence`" msgstr "" -#: ../../library/stdtypes.rst:3853 +#: ../../library/stdtypes.rst:3999 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:3856 +#: ../../library/stdtypes.rst:4002 msgid ":class:`memoryview` has several methods:" -msgstr "" +msgstr ":class:`memoryview` 有幾個方法:" -#: ../../library/stdtypes.rst:3860 +#: ../../library/stdtypes.rst:4006 msgid "" "A memoryview and a :pep:`3118` exporter are equal if their shapes are " "equivalent and if all corresponding values are equal when the operands' " "respective format codes are interpreted using :mod:`struct` syntax." msgstr "" -#: ../../library/stdtypes.rst:3864 +#: ../../library/stdtypes.rst:4010 msgid "" -"For the subset of :mod:`struct` format strings currently supported by :meth:" -"`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == w.tolist()``::" +"For the subset of :mod:`struct` format strings currently supported " +"by :meth:`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == " +"w.tolist()``::" msgstr "" -#: ../../library/stdtypes.rst:3867 +#: ../../library/stdtypes.rst:4013 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -5352,14 +5559,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:3883 +#: ../../library/stdtypes.rst:4029 msgid "" "If either format string is not supported by the :mod:`struct` module, then " "the objects will always compare as unequal (even if the format strings and " "buffer contents are identical)::" msgstr "" -#: ../../library/stdtypes.rst:3887 +#: ../../library/stdtypes.rst:4033 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -5385,25 +5592,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:3899 +#: ../../library/stdtypes.rst:4045 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:3902 +#: ../../library/stdtypes.rst:4048 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:3908 +#: ../../library/stdtypes.rst:4054 msgid "" "Return the data in the buffer as a bytestring. This is equivalent to " "calling the :class:`bytes` constructor on the memoryview. ::" msgstr "" -#: ../../library/stdtypes.rst:3911 +#: ../../library/stdtypes.rst:4057 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -5417,7 +5624,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:3917 +#: ../../library/stdtypes.rst:4063 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -5425,7 +5632,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:3922 +#: ../../library/stdtypes.rst:4068 msgid "" "*order* can be {'C', 'F', 'A'}. When *order* is 'C' or 'F', the data of the " "original array is converted to C or Fortran order. For contiguous views, 'A' " @@ -5434,13 +5641,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:3931 +#: ../../library/stdtypes.rst:4077 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:3934 +#: ../../library/stdtypes.rst:4080 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -5450,18 +5657,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:3940 +#: ../../library/stdtypes.rst:4086 msgid "" "Similar to :meth:`bytes.hex`, :meth:`memoryview.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:3947 +#: ../../library/stdtypes.rst:4093 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:3949 +#: ../../library/stdtypes.rst:4095 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -5479,19 +5686,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:3957 +#: ../../library/stdtypes.rst:4103 msgid "" -":meth:`tolist` now supports all single character native formats in :mod:" -"`struct` module syntax as well as multi-dimensional representations." +":meth:`tolist` now supports all single character native formats " +"in :mod:`struct` module syntax as well as multi-dimensional representations." msgstr "" -#: ../../library/stdtypes.rst:3964 +#: ../../library/stdtypes.rst:4110 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:3967 +#: ../../library/stdtypes.rst:4113 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -5517,23 +5724,23 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:3983 +#: ../../library/stdtypes.rst:4129 msgid "" "Release the underlying buffer exposed by the memoryview object. Many " -"objects take special actions when a view is held on them (for example, a :" -"class:`bytearray` would temporarily forbid resizing); therefore, calling " +"objects take special actions when a view is held on them (for example, " +"a :class:`bytearray` would temporarily forbid resizing); therefore, calling " "release() is handy to remove these restrictions (and free any dangling " "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:3989 +#: ../../library/stdtypes.rst:4135 msgid "" "After this method has been called, any further operation on the view raises " "a :class:`ValueError` (except :meth:`release` itself which can be called " "multiple times)::" msgstr "" -#: ../../library/stdtypes.rst:3993 +#: ../../library/stdtypes.rst:4139 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -5549,13 +5756,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4000 +#: ../../library/stdtypes.rst:4146 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:4003 +#: ../../library/stdtypes.rst:4149 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -5575,7 +5782,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4016 +#: ../../library/stdtypes.rst:4162 msgid "" "Cast a memoryview to a new format or shape. *shape* defaults to " "``[byte_length//new_itemsize]``, which means that the result view will be " @@ -5584,19 +5791,19 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4022 +#: ../../library/stdtypes.rst:4168 msgid "" -"The destination format is restricted to a single element native format in :" -"mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' or " -"'c'). The byte length of the result must be the same as the original length. " -"Note that all byte lengths may depend on the operating system." +"The destination format is restricted to a single element native format " +"in :mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' " +"or 'c'). The byte length of the result must be the same as the original " +"length. Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4028 +#: ../../library/stdtypes.rst:4174 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4030 +#: ../../library/stdtypes.rst:4176 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -5640,11 +5847,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4051 +#: ../../library/stdtypes.rst:4197 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4053 +#: ../../library/stdtypes.rst:4199 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -5668,11 +5875,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4064 +#: ../../library/stdtypes.rst:4210 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4066 +#: ../../library/stdtypes.rst:4212 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -5722,11 +5929,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4090 +#: ../../library/stdtypes.rst:4236 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4092 +#: ../../library/stdtypes.rst:4238 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -5748,19 +5955,19 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4104 +#: ../../library/stdtypes.rst:4250 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4107 +#: ../../library/stdtypes.rst:4253 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4111 +#: ../../library/stdtypes.rst:4257 msgid "The underlying object of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4113 +#: ../../library/stdtypes.rst:4259 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -5772,14 +5979,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4122 +#: ../../library/stdtypes.rst:4268 msgid "" "``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is the " "amount of space in bytes that the array would use in a contiguous " "representation. It is not necessarily equal to ``len(m)``::" msgstr "" -#: ../../library/stdtypes.rst:4126 +#: ../../library/stdtypes.rst:4272 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -5811,11 +6018,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4141 +#: ../../library/stdtypes.rst:4287 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4143 +#: ../../library/stdtypes.rst:4289 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -5839,11 +6046,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4158 +#: ../../library/stdtypes.rst:4304 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4162 +#: ../../library/stdtypes.rst:4308 msgid "" "A string containing the format (in :mod:`struct` module style) for each " "element in the view. A memoryview can be created from exporters with " @@ -5851,17 +6058,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4167 +#: ../../library/stdtypes.rst:4313 msgid "" "format ``'B'`` is now handled according to the struct module syntax. This " "means that ``memoryview(b'abc')[0] == b'abc'[0] == 97``." msgstr "" -#: ../../library/stdtypes.rst:4173 +#: ../../library/stdtypes.rst:4319 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4175 +#: ../../library/stdtypes.rst:4321 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -5881,59 +6088,59 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:4186 +#: ../../library/stdtypes.rst:4332 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4191 +#: ../../library/stdtypes.rst:4337 msgid "" "A tuple of integers the length of :attr:`ndim` giving the shape of the " "memory as an N-dimensional array." msgstr "" -#: ../../library/stdtypes.rst:4194 ../../library/stdtypes.rst:4202 +#: ../../library/stdtypes.rst:4340 ../../library/stdtypes.rst:4348 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4199 +#: ../../library/stdtypes.rst:4345 msgid "" "A tuple of integers the length of :attr:`ndim` giving the size in bytes to " "access each element for each dimension of the array." msgstr "" -#: ../../library/stdtypes.rst:4207 +#: ../../library/stdtypes.rst:4353 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4211 +#: ../../library/stdtypes.rst:4357 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4217 +#: ../../library/stdtypes.rst:4363 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4223 +#: ../../library/stdtypes.rst:4369 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4231 +#: ../../library/stdtypes.rst:4377 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4235 +#: ../../library/stdtypes.rst:4381 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " "sequence, and computing mathematical operations such as intersection, union, " "difference, and symmetric difference. (For other containers see the built-" -"in :class:`dict`, :class:`list`, and :class:`tuple` classes, and the :mod:" -"`collections` module.)" +"in :class:`dict`, :class:`list`, and :class:`tuple` classes, and " +"the :mod:`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4242 +#: ../../library/stdtypes.rst:4388 msgid "" "Like other collections, sets support ``x in set``, ``len(set)``, and ``for x " "in set``. Being an unordered collection, sets do not record element " @@ -5941,30 +6148,30 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4247 +#: ../../library/stdtypes.rst:4393 msgid "" -"There are currently two built-in set types, :class:`set` and :class:" -"`frozenset`. The :class:`set` type is mutable --- the contents can be " -"changed using methods like :meth:`~set.add` and :meth:`~set.remove`. Since " -"it is mutable, it has no hash value and cannot be used as either a " +"There are currently two built-in set types, :class:`set` " +"and :class:`frozenset`. The :class:`set` type is mutable --- the contents " +"can be changed using methods like :meth:`~set.add` and :meth:`~set.remove`. " +"Since it is mutable, it has no hash value and cannot be used as either a " "dictionary key or as an element of another set. The :class:`frozenset` type " "is immutable and :term:`hashable` --- its contents cannot be altered after " "it is created; it can therefore be used as a dictionary key or as an element " "of another set." msgstr "" -#: ../../library/stdtypes.rst:4255 +#: ../../library/stdtypes.rst:4401 msgid "" "Non-empty sets (not frozensets) can be created by placing a comma-separated " "list of elements within braces, for example: ``{'jack', 'sjoerd'}``, in " "addition to the :class:`set` constructor." msgstr "" -#: ../../library/stdtypes.rst:4259 +#: ../../library/stdtypes.rst:4405 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4264 +#: ../../library/stdtypes.rst:4410 msgid "" "Return a new set or frozenset object whose elements are taken from " "*iterable*. The elements of a set must be :term:`hashable`. To represent " @@ -5972,102 +6179,102 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4270 +#: ../../library/stdtypes.rst:4416 msgid "Sets can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4272 +#: ../../library/stdtypes.rst:4418 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4273 +#: ../../library/stdtypes.rst:4419 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4274 +#: ../../library/stdtypes.rst:4420 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4276 +#: ../../library/stdtypes.rst:4422 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4281 +#: ../../library/stdtypes.rst:4427 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4285 +#: ../../library/stdtypes.rst:4431 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4289 +#: ../../library/stdtypes.rst:4435 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4293 +#: ../../library/stdtypes.rst:4439 msgid "" "Return ``True`` if the set has no elements in common with *other*. Sets are " "disjoint if and only if their intersection is the empty set." msgstr "" -#: ../../library/stdtypes.rst:4299 +#: ../../library/stdtypes.rst:4445 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4303 +#: ../../library/stdtypes.rst:4449 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4309 +#: ../../library/stdtypes.rst:4455 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4313 +#: ../../library/stdtypes.rst:4459 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4319 +#: ../../library/stdtypes.rst:4465 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4324 +#: ../../library/stdtypes.rst:4470 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4329 +#: ../../library/stdtypes.rst:4475 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4334 +#: ../../library/stdtypes.rst:4480 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4338 +#: ../../library/stdtypes.rst:4484 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4341 +#: ../../library/stdtypes.rst:4487 msgid "" -"Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" -"meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" -"`issuperset` methods will accept any iterable as an argument. In contrast, " -"their operator based counterparts require their arguments to be sets. This " -"precludes error-prone constructions like ``set('abc') & 'cbs'`` in favor of " -"the more readable ``set('abc').intersection('cbs')``." +"Note, the non-operator versions " +"of :meth:`union`, :meth:`intersection`, :meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, " +"and :meth:`issuperset` methods will accept any iterable as an argument. In " +"contrast, their operator based counterparts require their arguments to be " +"sets. This precludes error-prone constructions like ``set('abc') & 'cbs'`` " +"in favor of the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4348 +#: ../../library/stdtypes.rst:4494 msgid "" "Both :class:`set` and :class:`frozenset` support set to set comparisons. Two " "sets are equal if and only if every element of each set is contained in the " @@ -6077,14 +6284,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4355 +#: ../../library/stdtypes.rst:4501 msgid "" "Instances of :class:`set` are compared to instances of :class:`frozenset` " "based on their members. For example, ``set('abc') == frozenset('abc')`` " "returns ``True`` and so does ``set('abc') in set([frozenset('abc')])``." msgstr "" -#: ../../library/stdtypes.rst:4359 +#: ../../library/stdtypes.rst:4505 msgid "" "The subset and equality comparisons do not generalize to a total ordering " "function. For example, any two nonempty disjoint sets are not equal and are " @@ -6092,134 +6299,136 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4364 +#: ../../library/stdtypes.rst:4510 msgid "" "Since sets only define partial ordering (subset relationships), the output " "of the :meth:`list.sort` method is undefined for lists of sets." msgstr "" -#: ../../library/stdtypes.rst:4367 +#: ../../library/stdtypes.rst:4513 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4369 +#: ../../library/stdtypes.rst:4515 msgid "" "Binary operations that mix :class:`set` instances with :class:`frozenset` " "return the type of the first operand. For example: ``frozenset('ab') | " "set('bc')`` returns an instance of :class:`frozenset`." msgstr "" -#: ../../library/stdtypes.rst:4373 +#: ../../library/stdtypes.rst:4519 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4379 +#: ../../library/stdtypes.rst:4525 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4384 +#: ../../library/stdtypes.rst:4530 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4389 +#: ../../library/stdtypes.rst:4535 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4394 +#: ../../library/stdtypes.rst:4540 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4398 +#: ../../library/stdtypes.rst:4544 msgid "Add element *elem* to the set." -msgstr "" +msgstr "將元素 *elem* 加入集合。" -#: ../../library/stdtypes.rst:4402 +#: ../../library/stdtypes.rst:4548 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4407 +#: ../../library/stdtypes.rst:4553 msgid "Remove element *elem* from the set if it is present." msgstr "" -#: ../../library/stdtypes.rst:4411 +#: ../../library/stdtypes.rst:4557 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4416 +#: ../../library/stdtypes.rst:4562 msgid "Remove all elements from the set." -msgstr "" +msgstr "從集合中移除所有元素。" -#: ../../library/stdtypes.rst:4419 +#: ../../library/stdtypes.rst:4565 msgid "" -"Note, the non-operator versions of the :meth:`update`, :meth:" -"`intersection_update`, :meth:`difference_update`, and :meth:" -"`symmetric_difference_update` methods will accept any iterable as an " -"argument." +"Note, the non-operator versions of " +"the :meth:`update`, :meth:`intersection_update`, :meth:`difference_update`, " +"and :meth:`symmetric_difference_update` methods will accept any iterable as " +"an argument." msgstr "" -#: ../../library/stdtypes.rst:4424 +#: ../../library/stdtypes.rst:4570 msgid "" -"Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:" -"`remove`, and :meth:`discard` methods may be a set. To support searching " -"for an equivalent frozenset, a temporary one is created from *elem*." +"Note, the *elem* argument to " +"the :meth:`~object.__contains__`, :meth:`remove`, and :meth:`discard` " +"methods may be a set. To support searching for an equivalent frozenset, a " +"temporary one is created from *elem*." msgstr "" -#: ../../library/stdtypes.rst:4433 +#: ../../library/stdtypes.rst:4579 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4443 +#: ../../library/stdtypes.rst:4589 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " -"type, the :dfn:`dictionary`. (For other containers see the built-in :class:" -"`list`, :class:`set`, and :class:`tuple` classes, and the :mod:`collections` " -"module.)" +"type, the :dfn:`dictionary`. (For other containers see the built-" +"in :class:`list`, :class:`set`, and :class:`tuple` classes, and " +"the :mod:`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4449 +#: ../../library/stdtypes.rst:4595 msgid "" -"A dictionary's keys are *almost* arbitrary values. Values that are not :" -"term:`hashable`, that is, values containing lists, dictionaries or other " -"mutable types (that are compared by value rather than by object identity) " -"may not be used as keys. Values that compare equal (such as ``1``, ``1.0``, " -"and ``True``) can be used interchangeably to index the same dictionary entry." +"A dictionary's keys are *almost* arbitrary values. Values that are " +"not :term:`hashable`, that is, values containing lists, dictionaries or " +"other mutable types (that are compared by value rather than by object " +"identity) may not be used as keys. Values that compare equal (such as ``1``, " +"``1.0``, and ``True``) can be used interchangeably to index the same " +"dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:4460 +#: ../../library/stdtypes.rst:4606 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4463 +#: ../../library/stdtypes.rst:4609 msgid "Dictionaries can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4465 +#: ../../library/stdtypes.rst:4611 msgid "" "Use a comma-separated list of ``key: value`` pairs within braces: ``{'jack': " "4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4467 +#: ../../library/stdtypes.rst:4613 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4468 +#: ../../library/stdtypes.rst:4614 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:4471 +#: ../../library/stdtypes.rst:4617 msgid "" "If no positional argument is given, an empty dictionary is created. If a " "positional argument is given and it defines a ``keys()`` method, a " @@ -6232,7 +6441,7 @@ msgid "" "that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:4481 +#: ../../library/stdtypes.rst:4627 msgid "" "If keyword arguments are given, the keyword arguments and their values are " "added to the dictionary created from the positional argument. If a key " @@ -6240,13 +6449,13 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:4486 +#: ../../library/stdtypes.rst:4632 msgid "" "To illustrate, the following examples all return a dictionary equal to " "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:4489 +#: ../../library/stdtypes.rst:4635 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -6266,44 +6475,44 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:4498 +#: ../../library/stdtypes.rst:4644 msgid "" "Providing keyword arguments as in the first example only works for keys that " "are valid Python identifiers. Otherwise, any valid keys can be used." msgstr "" -#: ../../library/stdtypes.rst:4502 +#: ../../library/stdtypes.rst:4648 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:4507 +#: ../../library/stdtypes.rst:4653 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4511 +#: ../../library/stdtypes.rst:4657 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4515 +#: ../../library/stdtypes.rst:4661 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:4520 +#: ../../library/stdtypes.rst:4666 msgid "" "If a subclass of dict defines a method :meth:`__missing__` and *key* is not " "present, the ``d[key]`` operation calls that method with the key *key* as " "argument. The ``d[key]`` operation then returns or raises whatever is " "returned or raised by the ``__missing__(key)`` call. No other operations or " -"methods invoke :meth:`__missing__`. If :meth:`__missing__` is not defined, :" -"exc:`KeyError` is raised. :meth:`__missing__` must be a method; it cannot be " -"an instance variable::" +"methods invoke :meth:`__missing__`. If :meth:`__missing__` is not " +"defined, :exc:`KeyError` is raised. :meth:`__missing__` must be a method; it " +"cannot be an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:4528 +#: ../../library/stdtypes.rst:4674 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -6327,51 +6536,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:4539 +#: ../../library/stdtypes.rst:4685 msgid "" -"The example above shows part of the implementation of :class:`collections." -"Counter`. A different ``__missing__`` method is used by :class:`collections." -"defaultdict`." +"The example above shows part of the implementation " +"of :class:`collections.Counter`. A different ``__missing__`` method is used " +"by :class:`collections.defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:4545 +#: ../../library/stdtypes.rst:4691 msgid "Set ``d[key]`` to *value*." -msgstr "" +msgstr "將 ``d[key]`` 設為 *value*。" -#: ../../library/stdtypes.rst:4549 +#: ../../library/stdtypes.rst:4695 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." -msgstr "" +msgstr "從 *d* 中移除 ``d[key]``。若 *key* 不在對映中則引發 :exc:`KeyError`。" -#: ../../library/stdtypes.rst:4554 +#: ../../library/stdtypes.rst:4700 msgid "Return ``True`` if *d* has a key *key*, else ``False``." -msgstr "" +msgstr "若 *d* 有鍵 *key* 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/stdtypes.rst:4558 +#: ../../library/stdtypes.rst:4704 msgid "Equivalent to ``not key in d``." -msgstr "" +msgstr "等價於 ``not key in d``。" -#: ../../library/stdtypes.rst:4562 +#: ../../library/stdtypes.rst:4708 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4567 +#: ../../library/stdtypes.rst:4713 msgid "Remove all items from the dictionary." -msgstr "" +msgstr "從字典中移除所有項目。" -#: ../../library/stdtypes.rst:4571 +#: ../../library/stdtypes.rst:4717 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4575 +#: ../../library/stdtypes.rst:4721 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:4577 +#: ../../library/stdtypes.rst:4723 msgid "" ":meth:`fromkeys` is a class method that returns a new dictionary. *value* " "defaults to ``None``. All of the values refer to just a single instance, so " @@ -6380,70 +6589,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:4585 +#: ../../library/stdtypes.rst:4731 msgid "" "Return the value for *key* if *key* is in the dictionary, else *default*. If " "*default* is not given, it defaults to ``None``, so that this method never " "raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4591 +#: ../../library/stdtypes.rst:4737 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4596 +#: ../../library/stdtypes.rst:4742 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:4601 +#: ../../library/stdtypes.rst:4747 msgid "" "If *key* is in the dictionary, remove it and return its value, else return " -"*default*. If *default* is not given and *key* is not in the dictionary, a :" -"exc:`KeyError` is raised." +"*default*. If *default* is not given and *key* is not in the dictionary, " +"a :exc:`KeyError` is raised." msgstr "" -#: ../../library/stdtypes.rst:4607 +#: ../../library/stdtypes.rst:4753 msgid "" "Remove and return a ``(key, value)`` pair from the dictionary. Pairs are " "returned in :abbr:`LIFO (last-in, first-out)` order." msgstr "" -#: ../../library/stdtypes.rst:4610 +#: ../../library/stdtypes.rst:4756 msgid "" ":meth:`popitem` is useful to destructively iterate over a dictionary, as " -"often used in set algorithms. If the dictionary is empty, calling :meth:" -"`popitem` raises a :exc:`KeyError`." +"often used in set algorithms. If the dictionary is empty, " +"calling :meth:`popitem` raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4614 +#: ../../library/stdtypes.rst:4760 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:4620 +#: ../../library/stdtypes.rst:4766 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4627 +#: ../../library/stdtypes.rst:4773 msgid "" "If *key* is in the dictionary, return its value. If not, insert *key* with " "a value of *default* and return *default*. *default* defaults to ``None``." msgstr "" -#: ../../library/stdtypes.rst:4633 +#: ../../library/stdtypes.rst:4779 msgid "" "Update the dictionary with the key/value pairs from *other*, overwriting " "existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:4636 +#: ../../library/stdtypes.rst:4782 msgid "" ":meth:`update` accepts either another object with a ``keys()`` method (in " "which case :meth:`~object.__getitem__` is called with every key returned " @@ -6452,20 +6661,20 @@ msgid "" "is then updated with those key/value pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:4644 +#: ../../library/stdtypes.rst:4790 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4647 +#: ../../library/stdtypes.rst:4793 msgid "" "An equality comparison between one ``dict.values()`` view and another will " "always return ``False``. This also applies when comparing ``dict.values()`` " "to itself::" msgstr "" -#: ../../library/stdtypes.rst:4651 +#: ../../library/stdtypes.rst:4797 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -6475,34 +6684,34 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:4657 +#: ../../library/stdtypes.rst:4803 msgid "" "Create a new dictionary with the merged keys and values of *d* and *other*, " "which must both be dictionaries. The values of *other* take priority when " "*d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4665 +#: ../../library/stdtypes.rst:4811 msgid "" "Update the dictionary *d* with keys and values from *other*, which may be " "either a :term:`mapping` or an :term:`iterable` of key/value pairs. The " "values of *other* take priority when *d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4671 +#: ../../library/stdtypes.rst:4817 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " "'>') raise :exc:`TypeError`." msgstr "" -#: ../../library/stdtypes.rst:4675 +#: ../../library/stdtypes.rst:4821 msgid "" "Dictionaries preserve insertion order. Note that updating a key does not " "affect the order. Keys added after deletion are inserted at the end. ::" msgstr "" -#: ../../library/stdtypes.rst:4678 +#: ../../library/stdtypes.rst:4824 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6534,17 +6743,17 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:4693 +#: ../../library/stdtypes.rst:4839 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:4697 +#: ../../library/stdtypes.rst:4843 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:4699 +#: ../../library/stdtypes.rst:4845 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6566,85 +6775,85 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:4709 +#: ../../library/stdtypes.rst:4855 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4714 +#: ../../library/stdtypes.rst:4860 msgid "" -":class:`types.MappingProxyType` can be used to create a read-only view of a :" -"class:`dict`." +":class:`types.MappingProxyType` can be used to create a read-only view of " +"a :class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:4721 +#: ../../library/stdtypes.rst:4867 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:4723 +#: ../../library/stdtypes.rst:4869 msgid "" -"The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" -"`dict.items` are *view objects*. They provide a dynamic view on the " -"dictionary's entries, which means that when the dictionary changes, the view " -"reflects these changes." +"The objects returned by :meth:`dict.keys`, :meth:`dict.values` " +"and :meth:`dict.items` are *view objects*. They provide a dynamic view on " +"the dictionary's entries, which means that when the dictionary changes, the " +"view reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:4728 +#: ../../library/stdtypes.rst:4874 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:4733 +#: ../../library/stdtypes.rst:4879 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4737 +#: ../../library/stdtypes.rst:4883 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4740 +#: ../../library/stdtypes.rst:4886 msgid "" "Keys and values are iterated over in insertion order. This allows the " -"creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." -"values(), d.keys())``. Another way to create the same list is ``pairs = " -"[(v, k) for (k, v) in d.items()]``." +"creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = " +"zip(d.values(), d.keys())``. Another way to create the same list is ``pairs " +"= [(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:4745 +#: ../../library/stdtypes.rst:4891 msgid "" "Iterating views while adding or deleting entries in the dictionary may raise " "a :exc:`RuntimeError` or fail to iterate over all entries." msgstr "" -#: ../../library/stdtypes.rst:4748 +#: ../../library/stdtypes.rst:4894 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:4753 +#: ../../library/stdtypes.rst:4899 msgid "" "Return ``True`` if *x* is in the underlying dictionary's keys, values or " "items (in the latter case, *x* should be a ``(key, value)`` tuple)." msgstr "" -#: ../../library/stdtypes.rst:4758 +#: ../../library/stdtypes.rst:4904 msgid "" "Return a reverse iterator over the keys, values or items of the dictionary. " "The view will be iterated in reverse order of the insertion." msgstr "" -#: ../../library/stdtypes.rst:4761 +#: ../../library/stdtypes.rst:4907 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4766 +#: ../../library/stdtypes.rst:4912 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:4771 +#: ../../library/stdtypes.rst:4917 msgid "" "Keys views are set-like since their entries are unique and :term:`hashable`. " "Items views also have set-like operations since the (key, value) pairs are " @@ -6658,11 +6867,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:4783 +#: ../../library/stdtypes.rst:4929 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:4785 +#: ../../library/stdtypes.rst:4931 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -6703,11 +6912,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:4827 +#: ../../library/stdtypes.rst:4973 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:4834 +#: ../../library/stdtypes.rst:4980 msgid "" "Python's :keyword:`with` statement supports the concept of a runtime context " "defined by a context manager. This is implemented using a pair of methods " @@ -6718,7 +6927,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:4842 +#: ../../library/stdtypes.rst:4988 msgid "" "Enter the runtime context and return either this object or another object " "related to the runtime context. The value returned by this method is bound " @@ -6729,16 +6938,17 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:4847 +#: ../../library/stdtypes.rst:4993 msgid "" "An example of a context manager that returns itself is a :term:`file " -"object`. File objects return themselves from __enter__() to allow :func:" -"`open` to be used as the context expression in a :keyword:`with` statement." +"object`. File objects return themselves from __enter__() to " +"allow :func:`open` to be used as the context expression in a :keyword:`with` " +"statement." msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:4851 +#: ../../library/stdtypes.rst:4997 msgid "" "An example of a context manager that returns a related object is the one " "returned by :func:`decimal.localcontext`. These managers set the active " @@ -6752,7 +6962,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的目前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:4861 +#: ../../library/stdtypes.rst:5007 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -6760,11 +6970,11 @@ msgid "" "the exception type, value and traceback information. Otherwise, all three " "arguments are ``None``." msgstr "" -"退出 runtime 情境並回傳布林旗標以表示是否應抑制曾發生的任何例外。如果在執行 :" -"keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " +"退出 runtime 情境並回傳布林旗標以表示是否應抑制曾發生的任何例外。如果在執" +"行 :keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:4866 +#: ../../library/stdtypes.rst:5012 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -6774,24 +6984,24 @@ msgid "" "replace any exception that occurred in the body of the :keyword:`!with` " "statement." msgstr "" -"從此方法回傳 true 值將導致 :keyword:`with` 陳述式抑制例外並繼續執行緊接著 :" -"keyword:`!with` 陳述式之後的陳述式。否則,該例外將在該方法執行完畢後繼續傳播 " -"(propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體中發生" -"的任何例外。" +"從此方法回傳 true 值將導致 :keyword:`with` 陳述式抑制例外並繼續執行緊接" +"著 :keyword:`!with` 陳述式之後的陳述式。否則,該例外將在該方法執行完畢後繼續" +"傳播 (propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體" +"中發生的任何例外。" -#: ../../library/stdtypes.rst:4873 +#: ../../library/stdtypes.rst:5019 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " "successfully and does not want to suppress the raised exception. This allows " -"context management code to easily detect whether or not an :meth:`~object." -"__exit__` method has actually failed." +"context management code to easily detect whether or not " +"an :meth:`~object.__exit__` method has actually failed." msgstr "" "傳入的例外不應明確重新引發 - 取而代之的是,此方法應回傳 false 值以指示該方法" -"已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" -"`__exit__` 方法是否曾實際失敗過。" +"已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢" +"測 :meth:`__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:4879 +#: ../../library/stdtypes.rst:5025 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -6803,22 +7013,23 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:4885 +#: ../../library/stdtypes.rst:5031 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " "generator function is decorated with the :class:`contextlib.contextmanager` " -"decorator, it will return a context manager implementing the necessary :meth:" -"`~contextmanager.__enter__` and :meth:`~contextmanager.__exit__` methods, " -"rather than the iterator produced by an undecorated generator function." +"decorator, it will return a context manager implementing the " +"necessary :meth:`~contextmanager.__enter__` " +"and :meth:`~contextmanager.__exit__` methods, rather than the iterator " +"produced by an undecorated generator function." msgstr "" "Python 的 :term:`generator` 和 :class:`contextlib.contextmanager` 裝飾器提供" -"了一種便捷的方法來實作這些協定。如果產生器函式以 :class:`contextlib." -"contextmanager` 裝飾器裝飾,它將回傳一個有實作出需要的 :meth:" -"`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" -"理器,而不是由未裝飾產生器函式產生的疊代器。" +"了一種便捷的方法來實作這些協定。如果產生器函式" +"以 :class:`contextlib.contextmanager` 裝飾器裝飾,它將回傳一個有實作出需要" +"的 :meth:`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法" +"的情境管理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:4892 +#: ../../library/stdtypes.rst:5038 msgid "" "Note that there is no specific slot for any of these methods in the type " "structure for Python objects in the Python/C API. Extension types wanting to " @@ -6830,27 +7041,27 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:4900 +#: ../../library/stdtypes.rst:5046 msgid "" -"Type Annotation Types --- :ref:`Generic Alias `, :ref:" -"`Union `" +"Type Annotation Types --- :ref:`Generic Alias `, :ref:`Union `" msgstr "" -"型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" -"ref:`聯合 (Union) `" +"型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:4905 +#: ../../library/stdtypes.rst:5051 msgid "" -"The core built-in types for :term:`type annotations ` are :ref:" -"`Generic Alias ` and :ref:`Union `." +"The core built-in types for :term:`type annotations ` " +"are :ref:`Generic Alias ` and :ref:`Union `." msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:4912 +#: ../../library/stdtypes.rst:5058 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:4918 +#: ../../library/stdtypes.rst:5064 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -6866,7 +7077,7 @@ msgstr "" "立的。``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使" "用。" -#: ../../library/stdtypes.rst:4928 +#: ../../library/stdtypes.rst:5074 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -6874,7 +7085,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:4931 +#: ../../library/stdtypes.rst:5077 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -6882,19 +7093,19 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:4934 +#: ../../library/stdtypes.rst:5080 msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " "object contains. For example, ``set[bytes]`` can be used in type annotations " -"to signify a :class:`set` in which all the elements are of type :class:" -"`bytes`." +"to signify a :class:`set` in which all the elements are of " +"type :class:`bytes`." msgstr "" "對於一個容器類別,提供給該類別的\\ :ref:`下標 `\\ 引數可以代表" -"物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" -"`set`,其中所有元素的型別都是 :class:`bytes`。" +"物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一" +"個 :class:`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:4940 +#: ../../library/stdtypes.rst:5086 msgid "" "For a class which defines :meth:`~object.__class_getitem__` but is not a " "container, the argument(s) supplied to a subscription of the class will " @@ -6906,7 +7117,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:4946 +#: ../../library/stdtypes.rst:5092 msgid "" "If ``x = re.search('foo', 'foo')``, ``x`` will be a :ref:`re.Match ` object where the return values of ``x.group(0)`` and ``x[0]`` will " @@ -6918,11 +7129,11 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:4952 +#: ../../library/stdtypes.rst:5098 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " -"``y`` will also be an instance of ``re.Match``, but the return values of ``y." -"group(0)`` and ``y[0]`` will both be of type :class:`bytes`. In type " +"``y`` will also be an instance of ``re.Match``, but the return values of " +"``y.group(0)`` and ``y[0]`` will both be of type :class:`bytes`. In type " "annotations, we would represent this variety of :ref:`re.Match ` objects with ``re.Match[bytes]``." msgstr "" @@ -6931,26 +7142,26 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:4958 +#: ../../library/stdtypes.rst:5104 msgid "" -"``GenericAlias`` objects are instances of the class :class:`types." -"GenericAlias`, which can also be used to create ``GenericAlias`` objects " -"directly." +"``GenericAlias`` objects are instances of the " +"class :class:`types.GenericAlias`, which can also be used to create " +"``GenericAlias`` objects directly." msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:4964 +#: ../../library/stdtypes.rst:5110 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " "expecting a :class:`list` containing :class:`float` elements::" msgstr "" "建立一個 ``GenericAlias`` 來表示一個型別 ``T``,其以型別 *X*、*Y* 等(取決於" -"所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" -"class:`list`: ::" +"所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素" +"的 :class:`list`: ::" -#: ../../library/stdtypes.rst:4969 +#: ../../library/stdtypes.rst:5115 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -6958,7 +7169,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:4972 +#: ../../library/stdtypes.rst:5118 msgid "" "Another example for :term:`mapping` objects, using a :class:`dict`, which is " "a generic type expecting two type parameters representing the key type and " @@ -6969,7 +7180,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:4977 +#: ../../library/stdtypes.rst:5123 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -6977,7 +7188,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:4980 +#: ../../library/stdtypes.rst:5126 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -6985,7 +7196,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:4983 +#: ../../library/stdtypes.rst:5129 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -6997,7 +7208,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:4988 +#: ../../library/stdtypes.rst:5134 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -7009,7 +7220,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:4994 +#: ../../library/stdtypes.rst:5140 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -7019,13 +7230,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:4998 +#: ../../library/stdtypes.rst:5144 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:5001 +#: ../../library/stdtypes.rst:5147 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -7043,13 +7254,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:5009 +#: ../../library/stdtypes.rst:5155 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5011 +#: ../../library/stdtypes.rst:5157 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -7063,15 +7274,15 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5017 +#: ../../library/stdtypes.rst:5163 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" msgstr "" -"為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." -"__getitem__` 方法會在這種情況下引發例外: ::" +"為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器" +"的 :meth:`~object.__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5020 +#: ../../library/stdtypes.rst:5166 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -7083,17 +7294,17 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5025 +#: ../../library/stdtypes.rst:5171 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " "items in the ``GenericAlias`` object's :attr:`~genericalias.__args__`. ::" msgstr "" "然而當使用\\ :ref:`型別變數 (type variable) ` 時,此類運算式是有效" -"的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." -"__args__` 中的型別變數項目一樣多: ::" +"的。索引的元素數量必須與 ``GenericAlias`` 物件" +"的 :attr:`~genericalias.__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5029 +#: ../../library/stdtypes.rst:5175 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -7105,245 +7316,253 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5036 +#: ../../library/stdtypes.rst:5182 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5038 +#: ../../library/stdtypes.rst:5184 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5041 +#: ../../library/stdtypes.rst:5187 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5042 +#: ../../library/stdtypes.rst:5188 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5043 +#: ../../library/stdtypes.rst:5189 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5044 +#: ../../library/stdtypes.rst:5190 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5045 +#: ../../library/stdtypes.rst:5191 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5046 +#: ../../library/stdtypes.rst:5192 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5047 +#: ../../library/stdtypes.rst:5193 +msgid ":class:`asyncio.Future`" +msgstr ":class:`asyncio.Future`" + +#: ../../library/stdtypes.rst:5194 +msgid ":class:`asyncio.Task`" +msgstr ":class:`asyncio.Task`" + +#: ../../library/stdtypes.rst:5195 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5048 +#: ../../library/stdtypes.rst:5196 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5049 +#: ../../library/stdtypes.rst:5197 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5050 +#: ../../library/stdtypes.rst:5198 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5051 +#: ../../library/stdtypes.rst:5199 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5052 +#: ../../library/stdtypes.rst:5200 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5053 +#: ../../library/stdtypes.rst:5201 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5054 +#: ../../library/stdtypes.rst:5202 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5055 +#: ../../library/stdtypes.rst:5203 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5056 +#: ../../library/stdtypes.rst:5204 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5057 +#: ../../library/stdtypes.rst:5205 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5058 +#: ../../library/stdtypes.rst:5206 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5059 +#: ../../library/stdtypes.rst:5207 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5060 +#: ../../library/stdtypes.rst:5208 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5061 +#: ../../library/stdtypes.rst:5209 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5062 +#: ../../library/stdtypes.rst:5210 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5063 +#: ../../library/stdtypes.rst:5211 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5064 +#: ../../library/stdtypes.rst:5212 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5065 +#: ../../library/stdtypes.rst:5213 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5066 +#: ../../library/stdtypes.rst:5214 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5067 +#: ../../library/stdtypes.rst:5215 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5068 +#: ../../library/stdtypes.rst:5216 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5069 +#: ../../library/stdtypes.rst:5217 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5070 +#: ../../library/stdtypes.rst:5218 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5071 +#: ../../library/stdtypes.rst:5219 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5072 +#: ../../library/stdtypes.rst:5220 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5073 +#: ../../library/stdtypes.rst:5221 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5074 +#: ../../library/stdtypes.rst:5222 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5075 +#: ../../library/stdtypes.rst:5223 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5076 +#: ../../library/stdtypes.rst:5224 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5077 +#: ../../library/stdtypes.rst:5225 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5078 +#: ../../library/stdtypes.rst:5226 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5079 +#: ../../library/stdtypes.rst:5227 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5080 +#: ../../library/stdtypes.rst:5228 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5081 +#: ../../library/stdtypes.rst:5229 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5082 +#: ../../library/stdtypes.rst:5230 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5083 +#: ../../library/stdtypes.rst:5231 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5084 +#: ../../library/stdtypes.rst:5232 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5085 +#: ../../library/stdtypes.rst:5233 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5086 +#: ../../library/stdtypes.rst:5234 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5087 +#: ../../library/stdtypes.rst:5235 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5088 +#: ../../library/stdtypes.rst:5236 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5089 +#: ../../library/stdtypes.rst:5237 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5090 +#: ../../library/stdtypes.rst:5238 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5091 +#: ../../library/stdtypes.rst:5239 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5092 +#: ../../library/stdtypes.rst:5240 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5093 +#: ../../library/stdtypes.rst:5241 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5094 +#: ../../library/stdtypes.rst:5242 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5099 +#: ../../library/stdtypes.rst:5247 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5101 +#: ../../library/stdtypes.rst:5249 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5105 +#: ../../library/stdtypes.rst:5253 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5107 +#: ../../library/stdtypes.rst:5255 msgid "" ">>> list[int].__origin__\n" "" @@ -7351,16 +7570,16 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5113 +#: ../../library/stdtypes.rst:5261 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " "class::" msgstr "" -"此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" -"class:`tuple`\\ (長度可以為 1): ::" +"此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型" +"別 :class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5117 +#: ../../library/stdtypes.rst:5265 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -7368,7 +7587,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5123 +#: ../../library/stdtypes.rst:5271 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -7376,7 +7595,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5126 +#: ../../library/stdtypes.rst:5274 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -7390,89 +7609,90 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5134 +#: ../../library/stdtypes.rst:5282 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " -"have correct ``__parameters__`` after substitution because :class:`typing." -"ParamSpec` is intended primarily for static type checking." +"have correct ``__parameters__`` after substitution " +"because :class:`typing.ParamSpec` is intended primarily for static type " +"checking." msgstr "" "具有 :class:`typing.ParamSpec` 參數的一個 ``GenericAlias`` 物件在替換後可能沒" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5141 +#: ../../library/stdtypes.rst:5289 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." msgstr "" -"如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" -"`~typing.TypeVarTuple`\\ )。" +"如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參" +"閱 :data:`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5149 +#: ../../library/stdtypes.rst:5297 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5150 +#: ../../library/stdtypes.rst:5298 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5152 +#: ../../library/stdtypes.rst:5300 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5153 +#: ../../library/stdtypes.rst:5301 msgid "" "Introducing the ability to natively parameterize standard-library classes, " -"provided they implement the special class method :meth:`~object." -"__class_getitem__`." +"provided they implement the special class " +"method :meth:`~object.__class_getitem__`." msgstr "" -"引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" -"`~object.__class_getitem__`。" +"引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方" +"法 :meth:`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5157 +#: ../../library/stdtypes.rst:5305 msgid "" -":ref:`Generics`, :ref:`user-defined generics ` and :" -"class:`typing.Generic`" +":ref:`Generics`, :ref:`user-defined generics ` " +"and :class:`typing.Generic`" msgstr "" -":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" -"`typing.Generic`" +":ref:`Generics`、:ref:`使用者定義泛型 `\\ " +"和 :class:`typing.Generic`" -#: ../../library/stdtypes.rst:5158 +#: ../../library/stdtypes.rst:5306 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" "有關如何實作可以在 runtime 參數化並能被靜態型別檢查器理解的泛型類別的文件。" -#: ../../library/stdtypes.rst:5167 +#: ../../library/stdtypes.rst:5315 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5173 +#: ../../library/stdtypes.rst:5321 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " "primarily for :term:`type annotations `. The union type " -"expression enables cleaner type hinting syntax compared to :data:`typing." -"Union`." +"expression enables cleaner type hinting syntax compared " +"to :data:`typing.Union`." msgstr "" "一個聯合物件可以保存多個\\ :ref:`型別物件 (type object) `\\ 之 ``|``\\ (位元 or)運算的值。這些型別主要用於\\ :term:`型別註" "釋 (type annotation) `。與 :data:`typing.Union` 相比,聯合型別運" "算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5180 +#: ../../library/stdtypes.rst:5328 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " -"example, the following function expects an argument of type :class:`int` or :" -"class:`float`::" +"example, the following function expects an argument of type :class:`int` " +"or :class:`float`::" msgstr "" "定義一個包含 *X*、*Y* 等型別的聯合物件。``X | Y`` 表示 X 或 Y。它相當於 " -"``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" -"class:`float` 的引數: ::" +"``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` " +"或 :class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5185 +#: ../../library/stdtypes.rst:5333 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -7480,7 +7700,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5190 +#: ../../library/stdtypes.rst:5338 msgid "" "The ``|`` operand cannot be used at runtime to define unions where one or " "more members is a forward reference. For example, ``int | \"Foo\"``, where " @@ -7493,58 +7713,58 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5198 +#: ../../library/stdtypes.rst:5346 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5200 +#: ../../library/stdtypes.rst:5348 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5202 +#: ../../library/stdtypes.rst:5350 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5204 +#: ../../library/stdtypes.rst:5352 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5206 +#: ../../library/stdtypes.rst:5354 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:5356 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5210 +#: ../../library/stdtypes.rst:5358 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5212 +#: ../../library/stdtypes.rst:5360 msgid "It is compatible with :data:`typing.Union`::" msgstr "它與 :data:`typing.Union` 相容: ::" -#: ../../library/stdtypes.rst:5214 +#: ../../library/stdtypes.rst:5362 msgid "int | str == typing.Union[int, str]" msgstr "int | str == typing.Union[int, str]" -#: ../../library/stdtypes.rst:5216 +#: ../../library/stdtypes.rst:5364 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5218 +#: ../../library/stdtypes.rst:5366 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5223 +#: ../../library/stdtypes.rst:5371 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5226 +#: ../../library/stdtypes.rst:5374 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -7552,14 +7772,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5229 +#: ../../library/stdtypes.rst:5377 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5232 +#: ../../library/stdtypes.rst:5380 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -7569,16 +7789,17 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5239 +#: ../../library/stdtypes.rst:5387 msgid "" -"The user-exposed type for the union object can be accessed from :data:`types." -"UnionType` and used for :func:`isinstance` checks. An object cannot be " -"instantiated from the type::" +"The user-exposed type for the union object can be accessed " +"from :data:`types.UnionType` and used for :func:`isinstance` checks. An " +"object cannot be instantiated from the type::" msgstr "" -"構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`types." -"UnionType` 存取並用於 :func:`isinstance` 檢查。物件不能以型別來實例化: ::" +"構成聯合物件的對使用者公開型別 (user-exposed type) 可以透" +"過 :data:`types.UnionType` 存取並用於 :func:`isinstance` 檢查。物件不能以型別" +"來實例化: ::" -#: ../../library/stdtypes.rst:5243 +#: ../../library/stdtypes.rst:5391 msgid "" ">>> import types\n" ">>> isinstance(int | str, types.UnionType)\n" @@ -7596,7 +7817,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'types.UnionType' instances" -#: ../../library/stdtypes.rst:5252 +#: ../../library/stdtypes.rst:5400 msgid "" "The :meth:`!__or__` method for type objects was added to support the syntax " "``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may " @@ -7605,7 +7826,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5256 +#: ../../library/stdtypes.rst:5404 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -7631,72 +7852,72 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5272 +#: ../../library/stdtypes.rst:5420 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5280 +#: ../../library/stdtypes.rst:5428 msgid "Other Built-in Types" msgstr "" -#: ../../library/stdtypes.rst:5282 +#: ../../library/stdtypes.rst:5430 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5289 +#: ../../library/stdtypes.rst:5437 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5291 +#: ../../library/stdtypes.rst:5439 msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " -"table. Module attributes can be assigned to. (Note that the :keyword:" -"`import` statement is not, strictly speaking, an operation on a module " -"object; ``import foo`` does not require a module object named *foo* to " -"exist, rather it requires an (external) *definition* for a module named " +"table. Module attributes can be assigned to. (Note that " +"the :keyword:`import` statement is not, strictly speaking, an operation on a " +"module object; ``import foo`` does not require a module object named *foo* " +"to exist, rather it requires an (external) *definition* for a module named " "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5298 +#: ../../library/stdtypes.rst:5446 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " "will actually change the module's symbol table, but direct assignment to " -"the :attr:`~object.__dict__` attribute is not possible (you can write ``m." -"__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't write " -"``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is not " -"recommended." +"the :attr:`~object.__dict__` attribute is not possible (you can write " +"``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't " +"write ``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is " +"not recommended." msgstr "" -#: ../../library/stdtypes.rst:5306 +#: ../../library/stdtypes.rst:5454 msgid "" "Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5314 +#: ../../library/stdtypes.rst:5462 msgid "Classes and Class Instances" msgstr "" -#: ../../library/stdtypes.rst:5316 +#: ../../library/stdtypes.rst:5464 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "" -#: ../../library/stdtypes.rst:5322 +#: ../../library/stdtypes.rst:5470 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5324 +#: ../../library/stdtypes.rst:5472 msgid "" "Function objects are created by function definitions. The only operation on " "a function object is to call it: ``func(argument-list)``." msgstr "" -#: ../../library/stdtypes.rst:5327 +#: ../../library/stdtypes.rst:5475 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -7704,36 +7925,36 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5331 +#: ../../library/stdtypes.rst:5479 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5337 +#: ../../library/stdtypes.rst:5485 msgid "Methods" msgstr "" -#: ../../library/stdtypes.rst:5341 +#: ../../library/stdtypes.rst:5489 msgid "" "Methods are functions that are called using the attribute notation. There " -"are two flavors: :ref:`built-in methods ` (such as :meth:" -"`append` on lists) and :ref:`class instance method `. " -"Built-in methods are described with the types that support them." +"are two flavors: :ref:`built-in methods ` (such " +"as :meth:`append` on lists) and :ref:`class instance method `. Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5346 +#: ../../library/stdtypes.rst:5494 msgid "" "If you access a method (a function defined in a class namespace) through an " -"instance, you get a special object: a :dfn:`bound method` (also called :ref:" -"`instance method `) object. When called, it will add the " -"``self`` argument to the argument list. Bound methods have two special read-" -"only attributes: :attr:`m.__self__ ` is the object on which " -"the method operates, and :attr:`m.__func__ ` is the " -"function implementing the method. Calling ``m(arg-1, arg-2, ..., arg-n)`` " -"is completely equivalent to calling ``m.__func__(m.__self__, arg-1, " -"arg-2, ..., arg-n)``." +"instance, you get a special object: a :dfn:`bound method` (also " +"called :ref:`instance method `) object. When called, it " +"will add the ``self`` argument to the argument list. Bound methods have two " +"special read-only attributes: :attr:`m.__self__ ` is the " +"object on which the method operates, and :attr:`m.__func__ " +"` is the function implementing the method. Calling " +"``m(arg-1, arg-2, ..., arg-n)`` is completely equivalent to calling " +"``m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5357 +#: ../../library/stdtypes.rst:5505 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -7744,7 +7965,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5365 +#: ../../library/stdtypes.rst:5513 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -7772,25 +7993,25 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5380 +#: ../../library/stdtypes.rst:5528 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5388 +#: ../../library/stdtypes.rst:5536 msgid "Code Objects" msgstr "程式碼物件" -#: ../../library/stdtypes.rst:5394 +#: ../../library/stdtypes.rst:5542 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " "objects because they don't contain a reference to their global execution " "environment. Code objects are returned by the built-in :func:`compile` " -"function and can be extracted from function objects through their :attr:" -"`~function.__code__` attribute. See also the :mod:`code` module." +"function and can be extracted from function objects through " +"their :attr:`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5401 +#: ../../library/stdtypes.rst:5549 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -7799,21 +8020,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5408 +#: ../../library/stdtypes.rst:5556 msgid "" "A code object can be executed or evaluated by passing it (instead of a " "source string) to the :func:`exec` or :func:`eval` built-in functions." msgstr "" -#: ../../library/stdtypes.rst:5411 +#: ../../library/stdtypes.rst:5559 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5417 +#: ../../library/stdtypes.rst:5565 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5423 +#: ../../library/stdtypes.rst:5571 msgid "" "Type objects represent the various object types. An object's type is " "accessed by the built-in function :func:`type`. There are no special " @@ -7821,119 +8042,119 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5428 +#: ../../library/stdtypes.rst:5576 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5434 +#: ../../library/stdtypes.rst:5582 msgid "The Null Object" msgstr "Null 物件" -#: ../../library/stdtypes.rst:5436 +#: ../../library/stdtypes.rst:5584 msgid "" "This object is returned by functions that don't explicitly return a value. " "It supports no special operations. There is exactly one null object, named " "``None`` (a built-in name). ``type(None)()`` produces the same singleton." msgstr "" -#: ../../library/stdtypes.rst:5440 +#: ../../library/stdtypes.rst:5588 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5447 +#: ../../library/stdtypes.rst:5595 msgid "The Ellipsis Object" -msgstr "" +msgstr "Ellipsis 物件" -#: ../../library/stdtypes.rst:5449 +#: ../../library/stdtypes.rst:5597 msgid "" "This object is commonly used by slicing (see :ref:`slicings`). It supports " -"no special operations. There is exactly one ellipsis object, named :const:" -"`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces the :const:" -"`Ellipsis` singleton." +"no special operations. There is exactly one ellipsis object, " +"named :const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces " +"the :const:`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5454 +#: ../../library/stdtypes.rst:5602 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:5460 +#: ../../library/stdtypes.rst:5608 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:5462 +#: ../../library/stdtypes.rst:5610 msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " -"more information. There is exactly one :data:`NotImplemented` object. :code:" -"`type(NotImplemented)()` produces the singleton instance." +"more information. There is exactly one :data:`NotImplemented` " +"object. :code:`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5467 +#: ../../library/stdtypes.rst:5615 msgid "It is written as :code:`NotImplemented`." msgstr "" -#: ../../library/stdtypes.rst:5473 +#: ../../library/stdtypes.rst:5621 msgid "Internal Objects" msgstr "" -#: ../../library/stdtypes.rst:5475 +#: ../../library/stdtypes.rst:5623 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:5483 +#: ../../library/stdtypes.rst:5631 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:5485 +#: ../../library/stdtypes.rst:5633 msgid "" "The implementation adds a few special read-only attributes to several object " -"types, where they are relevant. Some of these are not reported by the :func:" -"`dir` built-in function." +"types, where they are relevant. Some of these are not reported by " +"the :func:`dir` built-in function." msgstr "" -#: ../../library/stdtypes.rst:5492 +#: ../../library/stdtypes.rst:5640 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5498 +#: ../../library/stdtypes.rst:5646 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5506 +#: ../../library/stdtypes.rst:5654 msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:5511 +#: ../../library/stdtypes.rst:5659 msgid "" "The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:5516 +#: ../../library/stdtypes.rst:5664 msgid "" -"The :ref:`type parameters ` of generic classes, functions, and :" -"ref:`type aliases `. For classes and functions that are not " -"generic, this will be an empty tuple." +"The :ref:`type parameters ` of generic classes, functions, " +"and :ref:`type aliases `. For classes and functions that are " +"not generic, this will be an empty tuple." msgstr "" -#: ../../library/stdtypes.rst:5526 +#: ../../library/stdtypes.rst:5674 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:5528 +#: ../../library/stdtypes.rst:5676 msgid "" -"CPython has a global limit for converting between :class:`int` and :class:" -"`str` to mitigate denial of service attacks. This limit *only* applies to " -"decimal or other non-power-of-two number bases. Hexadecimal, octal, and " -"binary conversions are unlimited. The limit can be configured." +"CPython has a global limit for converting between :class:`int` " +"and :class:`str` to mitigate denial of service attacks. This limit *only* " +"applies to decimal or other non-power-of-two number bases. Hexadecimal, " +"octal, and binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:5533 +#: ../../library/stdtypes.rst:5681 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -7943,24 +8164,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:5540 +#: ../../library/stdtypes.rst:5688 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:5542 +#: ../../library/stdtypes.rst:5690 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" -#: ../../library/stdtypes.rst:5546 +#: ../../library/stdtypes.rst:5694 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:5548 +#: ../../library/stdtypes.rst:5696 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -7984,19 +8205,19 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:5568 +#: ../../library/stdtypes.rst:5716 msgid "" -"The default limit is 4300 digits as provided in :data:`sys.int_info." -"default_max_str_digits `. The lowest limit that can be " -"configured is 640 digits as provided in :data:`sys.int_info." -"str_digits_check_threshold `." +"The default limit is 4300 digits as provided " +"in :data:`sys.int_info.default_max_str_digits `. The lowest " +"limit that can be configured is 640 digits as provided " +"in :data:`sys.int_info.str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:5573 +#: ../../library/stdtypes.rst:5721 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:5575 +#: ../../library/stdtypes.rst:5723 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8014,84 +8235,84 @@ msgstr "" "... '571186405732').to_bytes(53, 'big')\n" "..." -#: ../../library/stdtypes.rst:5588 +#: ../../library/stdtypes.rst:5736 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:5590 +#: ../../library/stdtypes.rst:5738 msgid "" -"The limitation only applies to potentially slow conversions between :class:" -"`int` and :class:`str` or :class:`bytes`:" +"The limitation only applies to potentially slow conversions " +"between :class:`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:5593 +#: ../../library/stdtypes.rst:5741 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:5594 +#: ../../library/stdtypes.rst:5742 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:5595 +#: ../../library/stdtypes.rst:5743 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:5596 +#: ../../library/stdtypes.rst:5744 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:5597 +#: ../../library/stdtypes.rst:5745 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:5600 +#: ../../library/stdtypes.rst:5748 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:5602 +#: ../../library/stdtypes.rst:5750 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:5603 +#: ../../library/stdtypes.rst:5751 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:5604 +#: ../../library/stdtypes.rst:5752 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:5605 +#: ../../library/stdtypes.rst:5753 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:5606 +#: ../../library/stdtypes.rst:5754 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:5607 +#: ../../library/stdtypes.rst:5755 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:5610 +#: ../../library/stdtypes.rst:5758 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:5612 +#: ../../library/stdtypes.rst:5760 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" -#: ../../library/stdtypes.rst:5615 +#: ../../library/stdtypes.rst:5763 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" -#: ../../library/stdtypes.rst:5618 +#: ../../library/stdtypes.rst:5766 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -8099,47 +8320,48 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:5620 +#: ../../library/stdtypes.rst:5768 msgid "" -":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" -"`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " -"env var and the ``-X`` option are set, the ``-X`` option takes precedence. A " -"value of *-1* indicates that both were unset, thus a value of :data:`sys." -"int_info.default_max_str_digits` was used during initialization." +":data:`sys.flags.int_max_str_digits` contains the value " +"of :envvar:`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. " +"If both the env var and the ``-X`` option are set, the ``-X`` option takes " +"precedence. A value of *-1* indicates that both were unset, thus a value " +"of :data:`sys.int_info.default_max_str_digits` was used during " +"initialization." msgstr "" -#: ../../library/stdtypes.rst:5626 +#: ../../library/stdtypes.rst:5774 msgid "" -"From code, you can inspect the current limit and set a new one using these :" -"mod:`sys` APIs:" +"From code, you can inspect the current limit and set a new one using " +"these :mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:5629 +#: ../../library/stdtypes.rst:5777 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" -#: ../../library/stdtypes.rst:5633 +#: ../../library/stdtypes.rst:5781 msgid "" -"Information about the default and minimum can be found in :data:`sys." -"int_info`:" +"Information about the default and minimum can be found " +"in :data:`sys.int_info`:" msgstr "" -#: ../../library/stdtypes.rst:5635 +#: ../../library/stdtypes.rst:5783 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:5637 +#: ../../library/stdtypes.rst:5785 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" -#: ../../library/stdtypes.rst:5644 +#: ../../library/stdtypes.rst:5792 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -8151,7 +8373,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:5653 +#: ../../library/stdtypes.rst:5801 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " @@ -8159,11 +8381,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:5659 +#: ../../library/stdtypes.rst:5807 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:5661 +#: ../../library/stdtypes.rst:5809 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " @@ -8171,11 +8393,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:5666 +#: ../../library/stdtypes.rst:5814 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:5668 +#: ../../library/stdtypes.rst:5816 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -8197,38 +8419,38 @@ msgstr "" "... elif current_limit < lower_bound:\n" "... sys.set_int_max_str_digits(lower_bound)" -#: ../../library/stdtypes.rst:5678 +#: ../../library/stdtypes.rst:5826 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:5682 +#: ../../library/stdtypes.rst:5830 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:5683 +#: ../../library/stdtypes.rst:5831 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5686 +#: ../../library/stdtypes.rst:5834 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5689 +#: ../../library/stdtypes.rst:5837 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5691 +#: ../../library/stdtypes.rst:5839 msgid "" "Cased characters are those with general category property being one of " "\"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:5694 +#: ../../library/stdtypes.rst:5842 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -8241,13 +8463,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:316 #: ../../library/stdtypes.rst:393 ../../library/stdtypes.rst:950 #: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:1139 -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 -#: ../../library/stdtypes.rst:5419 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:5567 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1154 -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4581 msgid "statement" msgstr "statement(陳述式)" @@ -8369,11 +8591,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:1260 #: ../../library/stdtypes.rst:1339 ../../library/stdtypes.rst:1383 #: ../../library/stdtypes.rst:1504 ../../library/stdtypes.rst:1540 -#: ../../library/stdtypes.rst:2526 ../../library/stdtypes.rst:2545 -#: ../../library/stdtypes.rst:2652 ../../library/stdtypes.rst:4233 -#: ../../library/stdtypes.rst:4435 ../../library/stdtypes.rst:4914 -#: ../../library/stdtypes.rst:5169 ../../library/stdtypes.rst:5339 -#: ../../library/stdtypes.rst:5383 +#: ../../library/stdtypes.rst:2672 ../../library/stdtypes.rst:2691 +#: ../../library/stdtypes.rst:2798 ../../library/stdtypes.rst:4379 +#: ../../library/stdtypes.rst:4581 ../../library/stdtypes.rst:5060 +#: ../../library/stdtypes.rst:5317 ../../library/stdtypes.rst:5487 +#: ../../library/stdtypes.rst:5531 msgid "object" msgstr "object(物件)" @@ -8465,9 +8687,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:950 -#: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4435 -#: ../../library/stdtypes.rst:5390 ../../library/stdtypes.rst:5404 -#: ../../library/stdtypes.rst:5419 +#: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:5538 ../../library/stdtypes.rst:5552 +#: ../../library/stdtypes.rst:5567 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -8483,8 +8705,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2402 -#: ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2548 +#: ../../library/stdtypes.rst:3767 msgid "+ (plus)" msgstr "+ (加號)" @@ -8496,13 +8718,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2402 -#: ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2548 +#: ../../library/stdtypes.rst:3767 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2359 -#: ../../library/stdtypes.rst:3578 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2505 +#: ../../library/stdtypes.rst:3724 msgid "* (asterisk)" msgstr "* (星號)" @@ -8514,8 +8736,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2323 -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2469 +#: ../../library/stdtypes.rst:3692 msgid "% (percent)" msgstr "% (百分號)" @@ -8525,7 +8747,7 @@ msgstr "**" #: ../../library/stdtypes.rst:316 ../../library/stdtypes.rst:393 #: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:1154 -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4581 msgid "operations on" msgstr "operations on(操作於)" @@ -8534,7 +8756,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:335 ../../library/stdtypes.rst:1606 -#: ../../library/stdtypes.rst:2526 ../../library/stdtypes.rst:5419 +#: ../../library/stdtypes.rst:2672 ../../library/stdtypes.rst:5567 msgid "module" msgstr "模組" @@ -8602,7 +8824,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4829 +#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4975 msgid "protocol" msgstr "protocol(協定)" @@ -8628,7 +8850,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4581 msgid "len" msgstr "len" @@ -8705,14 +8927,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:2526 -#: ../../library/stdtypes.rst:2652 ../../library/stdtypes.rst:2724 -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:2672 +#: ../../library/stdtypes.rst:2798 ../../library/stdtypes.rst:2870 +#: ../../library/stdtypes.rst:3692 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 -#: ../../library/stdtypes.rst:5169 ../../library/stdtypes.rst:5419 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4581 +#: ../../library/stdtypes.rst:5317 ../../library/stdtypes.rst:5567 msgid "type" msgstr "type(型別)" @@ -8720,7 +8942,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4581 msgid "del" msgstr "del" @@ -8762,6 +8984,7 @@ msgstr "range" #: ../../library/stdtypes.rst:1504 ../../library/stdtypes.rst:1553 #: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2469 msgid "string" msgstr "string(字串)" @@ -8782,17 +9005,17 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2518 +#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2664 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2526 -#: ../../library/stdtypes.rst:2545 ../../library/stdtypes.rst:2724 -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2672 +#: ../../library/stdtypes.rst:2691 ../../library/stdtypes.rst:2870 +#: ../../library/stdtypes.rst:3692 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2724 +#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2870 msgid "methods" msgstr "methods(方法)" @@ -8800,183 +9023,239 @@ msgstr "methods(方法)" msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2131 ../../library/stdtypes.rst:3400 +#: ../../library/stdtypes.rst:2137 ../../library/stdtypes.rst:3546 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/stdtypes.rst:2131 +#: ../../library/stdtypes.rst:2137 msgid "str.splitlines method" msgstr "str.splitlines 方法" #: ../../library/stdtypes.rst:2323 +msgid "! formatted string literal" +msgstr "! formatted string literals(! 格式化字串常數)" + +#: ../../library/stdtypes.rst:2323 +msgid "formatted string literals" +msgstr "formatted string literals(格式化字串常數)" + +#: ../../library/stdtypes.rst:2323 +msgid "! f-string" +msgstr "! f-string(! f 字串)" + +#: ../../library/stdtypes.rst:2323 +msgid "f-strings" +msgstr "f-string(f 字串)" + +#: ../../library/stdtypes.rst:2323 +msgid "fstring" +msgstr "fstring(f 字串)" + +#: ../../library/stdtypes.rst:2323 +msgid "interpolated string literal" +msgstr "interpolated string literal(插值字串常數)" + +#: ../../library/stdtypes.rst:2323 +msgid "formatted literal" +msgstr "formatted literal(格式化常數)" + +#: ../../library/stdtypes.rst:2323 +msgid "interpolated literal" +msgstr "interpolated literal(插值常數)" + +#: ../../library/stdtypes.rst:2323 +msgid "{} (curly brackets)" +msgstr "{} (花括號)" + +#: ../../library/stdtypes.rst:2323 +msgid "in formatted string literal" +msgstr "於格式化字串常數中" + +#: ../../library/stdtypes.rst:2323 +msgid "! (exclamation mark)" +msgstr "! (驚嘆號)" + +#: ../../library/stdtypes.rst:2323 +msgid ": (colon)" +msgstr ": (冒號)" + +#: ../../library/stdtypes.rst:2323 +msgid "= (equals)" +msgstr "= (等號)" + +#: ../../library/stdtypes.rst:2323 +msgid "for help in debugging using string literals" +msgstr "" + +#: ../../library/stdtypes.rst:2469 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2469 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2469 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:2469 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:2323 ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:2469 ../../library/stdtypes.rst:3692 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:2323 ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:2469 ../../library/stdtypes.rst:3692 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:3578 +#: ../../library/stdtypes.rst:2505 ../../library/stdtypes.rst:3724 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:2402 -#: ../../library/stdtypes.rst:3578 ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:2505 ../../library/stdtypes.rst:2548 +#: ../../library/stdtypes.rst:3724 ../../library/stdtypes.rst:3767 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:3578 +#: ../../library/stdtypes.rst:2505 ../../library/stdtypes.rst:3724 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:2548 ../../library/stdtypes.rst:3767 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:2548 ../../library/stdtypes.rst:3767 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:2518 +#: ../../library/stdtypes.rst:2664 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:2526 +#: ../../library/stdtypes.rst:2672 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:2526 +#: ../../library/stdtypes.rst:2672 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:3400 +#: ../../library/stdtypes.rst:3546 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:3400 +#: ../../library/stdtypes.rst:3546 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:3692 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:3692 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:3692 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:3546 +#: ../../library/stdtypes.rst:3692 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4233 +#: ../../library/stdtypes.rst:4379 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4581 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:4581 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:4518 +#: ../../library/stdtypes.rst:4664 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:4829 +#: ../../library/stdtypes.rst:4975 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:4829 +#: ../../library/stdtypes.rst:4975 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:4829 +#: ../../library/stdtypes.rst:4975 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:4902 +#: ../../library/stdtypes.rst:5048 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:4902 +#: ../../library/stdtypes.rst:5048 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:4914 +#: ../../library/stdtypes.rst:5060 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:4914 +#: ../../library/stdtypes.rst:5060 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:4914 +#: ../../library/stdtypes.rst:5060 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5169 +#: ../../library/stdtypes.rst:5317 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5169 +#: ../../library/stdtypes.rst:5317 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5339 +#: ../../library/stdtypes.rst:5487 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5383 +#: ../../library/stdtypes.rst:5531 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5383 +#: ../../library/stdtypes.rst:5531 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5390 +#: ../../library/stdtypes.rst:5538 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5390 +#: ../../library/stdtypes.rst:5538 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5404 +#: ../../library/stdtypes.rst:5552 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5404 +#: ../../library/stdtypes.rst:5552 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5443 +#: ../../library/stdtypes.rst:5591 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5443 +#: ../../library/stdtypes.rst:5591 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" diff --git a/library/string.po b/library/string.po index 73accbfc38..91b6bcfecd 100644 --- a/library/string.po +++ b/library/string.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-16 00:13+0000\n" +"POT-Creation-Date: 2025-04-08 00:14+0000\n" "PO-Revision-Date: 2024-03-10 15:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -447,7 +447,7 @@ msgstr "" msgid "The general form of a *standard format specifier* is:" msgstr "*標準格式說明符號 (standard format specifier)* 的一般型式如下:" -#: ../../library/string.rst:331 +#: ../../library/string.rst:333 msgid "" "If a valid *align* value is specified, it can be preceded by a *fill* " "character that can be any character and defaults to a space if omitted. It " @@ -463,45 +463,46 @@ msgstr "" "*fill* 字元的,但仍可透過巢狀替換欄位的方式插入大括號。此限制不影" "響 :func:`format` 函式。" -#: ../../library/string.rst:340 +#: ../../library/string.rst:342 msgid "The meaning of the various alignment options is as follows:" msgstr "" -#: ../../library/string.rst:349 ../../library/string.rst:381 +#: ../../library/string.rst:351 ../../library/string.rst:383 +#: ../../library/string.rst:442 msgid "Option" msgstr "選項" -#: ../../library/string.rst:349 ../../library/string.rst:381 -#: ../../library/string.rst:466 ../../library/string.rst:477 -#: ../../library/string.rst:512 +#: ../../library/string.rst:351 ../../library/string.rst:383 +#: ../../library/string.rst:442 ../../library/string.rst:481 +#: ../../library/string.rst:492 ../../library/string.rst:527 msgid "Meaning" msgstr "含義" -#: ../../library/string.rst:351 +#: ../../library/string.rst:353 msgid "``'<'``" msgstr "``'<'``" -#: ../../library/string.rst:351 +#: ../../library/string.rst:353 msgid "" "Forces the field to be left-aligned within the available space (this is the " "default for most objects)." msgstr "強制欄位在可用空間內靠左對齊(這是大多數物件的預設值)。" -#: ../../library/string.rst:354 +#: ../../library/string.rst:356 msgid "``'>'``" msgstr "``'>'``" -#: ../../library/string.rst:354 +#: ../../library/string.rst:356 msgid "" "Forces the field to be right-aligned within the available space (this is the " "default for numbers)." msgstr "強制欄位在可用空間內靠右對齊(這是數字的預設值)。" -#: ../../library/string.rst:357 +#: ../../library/string.rst:359 msgid "``'='``" msgstr "``'='``" -#: ../../library/string.rst:357 +#: ../../library/string.rst:359 msgid "" "Forces the padding to be placed after the sign (if any) but before the " "digits. This is used for printing fields in the form '+000000120'. This " @@ -510,15 +511,15 @@ msgid "" "immediately precedes the field width." msgstr "" -#: ../../library/string.rst:364 +#: ../../library/string.rst:366 msgid "``'^'``" msgstr "``'^'``" -#: ../../library/string.rst:364 +#: ../../library/string.rst:366 msgid "Forces the field to be centered within the available space." msgstr "強制欄位在可用空間內置中。" -#: ../../library/string.rst:368 +#: ../../library/string.rst:370 msgid "" "Note that unless a minimum field width is defined, the field width will " "always be the same size as the data to fill it, so that the alignment option " @@ -527,54 +528,54 @@ msgstr "" "請注意,除非有定義了最小欄位寬度,否則欄位寬度將始終與填充它的資料大小相同," "故在該情況下的對齊選項是沒有意義的。" -#: ../../library/string.rst:372 +#: ../../library/string.rst:374 msgid "" "The *sign* option is only valid for number types, and can be one of the " "following:" msgstr "*sign* 選項只適用於數字型別,並可為以下之一:" -#: ../../library/string.rst:383 +#: ../../library/string.rst:385 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/string.rst:383 +#: ../../library/string.rst:385 msgid "" -"indicates that a sign should be used for both positive as well as negative " +"Indicates that a sign should be used for both positive as well as negative " "numbers." msgstr "表示正數與負數均需使用符號。" -#: ../../library/string.rst:386 +#: ../../library/string.rst:388 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/string.rst:386 +#: ../../library/string.rst:388 msgid "" -"indicates that a sign should be used only for negative numbers (this is the " +"Indicates that a sign should be used only for negative numbers (this is the " "default behavior)." -msgstr "" +msgstr "表示正數應使用前導空格,負數應使用減號。" -#: ../../library/string.rst:375 ../../library/string.rst:389 +#: ../../library/string.rst:377 ../../library/string.rst:391 msgid "space" msgstr "空格" -#: ../../library/string.rst:389 +#: ../../library/string.rst:391 msgid "" -"indicates that a leading space should be used on positive numbers, and a " +"Indicates that a leading space should be used on positive numbers, and a " "minus sign on negative numbers." msgstr "表示正數應使用前導空格,負數應使用減號。" -#: ../../library/string.rst:396 +#: ../../library/string.rst:398 msgid "" "The ``'z'`` option coerces negative zero floating-point values to positive " "zero after rounding to the format precision. This option is only valid for " "floating-point presentation types." msgstr "" -#: ../../library/string.rst:400 +#: ../../library/string.rst:402 msgid "Added the ``'z'`` option (see also :pep:`682`)." msgstr "新增 ``'z'`` 選項(請見 :pep:`682`\\ )。" -#: ../../library/string.rst:405 +#: ../../library/string.rst:407 msgid "" "The ``'#'`` option causes the \"alternate form\" to be used for the " "conversion. The alternate form is defined differently for different types. " @@ -590,42 +591,14 @@ msgstr "" #: ../../library/string.rst:419 msgid "" -"The ``','`` option signals the use of a comma for a thousands separator for " -"floating-point presentation types and for integer presentation type ``'d'``. " -"For other presentation types, this option is an error. For a locale aware " -"separator, use the ``'n'`` integer presentation type instead." -msgstr "" - -#: ../../library/string.rst:425 -msgid "Added the ``','`` option (see also :pep:`378`)." -msgstr "新增 ``','`` 選項(請見 :pep:`378`\\ )。" - -#: ../../library/string.rst:430 -msgid "" -"The ``'_'`` option signals the use of an underscore for a thousands " -"separator for floating-point presentation types and for integer presentation " -"type ``'d'``. For integer presentation types ``'b'``, ``'o'``, ``'x'``, and " -"``'X'``, underscores will be inserted every 4 digits. For other " -"presentation types, specifying this option is an error." -msgstr "" -"``'_'`` 選項表示對於浮點表示型別和整數表示型別 ``'d'`` 使用底線作為千位分隔符" -"號。對於整數表示型別 ``'b'``,``'o'``,``'x'`` 和 ``'X'``,每 4 位數字會插入" -"底線。對於其他表示型別,指定此選項會出錯。" - -#: ../../library/string.rst:437 -msgid "Added the ``'_'`` option (see also :pep:`515`)." -msgstr "新增 ``'_'`` 選項(請見 :pep:`515`\\ )。" - -#: ../../library/string.rst:440 -msgid "" -"*width* is a decimal integer defining the minimum total field width, " +"The *width* is a decimal integer defining the minimum total field width, " "including any prefixes, separators, and other formatting characters. If not " "specified, then the field width will be determined by the content." msgstr "" "*width* 是一個十進位整數,定義了最小總欄位寬度,包括任何前綴、分隔符號和其他" "格式字元。如果未指定,則欄位寬度將由內容決定。" -#: ../../library/string.rst:444 +#: ../../library/string.rst:423 msgid "" "When no explicit alignment is given, preceding the *width* field by a zero " "(``'0'``) character enables sign-aware zero-padding for numeric types, " @@ -636,13 +609,59 @@ msgstr "" "為 :class:`complex` 以外的數值型別啟用有符號察覺的零填充 (sign-aware zero-" "padding)。這相當於使用 ``'0'`` 為 *fill* 字元且對齊類型為 ``'='``。" -#: ../../library/string.rst:449 +#: ../../library/string.rst:428 msgid "" "Preceding the *width* field by ``'0'`` no longer affects the default " "alignment for strings." msgstr "在 *width* 欄位前面加上 ``'0'`` 不再影響字串的預設對齊方式。" -#: ../../library/string.rst:453 +#: ../../library/string.rst:433 +msgid "" +"The *grouping* option after the *width* field specifies a digit group " +"separator for the integral part of a number. It can be one of the following:" +msgstr "" + +#: ../../library/string.rst:444 +msgid "``','``" +msgstr "``','``" + +#: ../../library/string.rst:444 +msgid "" +"Inserts a comma every 3 digits for integer presentation type ``'d'`` and " +"floating-point presentation types, excluding ``'n'``. For other presentation " +"types, this option is not supported." +msgstr "" + +#: ../../library/string.rst:450 +msgid "``'_'``" +msgstr "``'_'``" + +#: ../../library/string.rst:450 +msgid "" +"Inserts an underscore every 3 digits for integer presentation type ``'d'`` " +"and floating-point presentation types, excluding ``'n'``. For integer " +"presentation types ``'b'``, ``'o'``, ``'x'``, and ``'X'``, underscores are " +"inserted every 4 digits. For other presentation types, this option is not " +"supported." +msgstr "" +"在整數表示型別 ``'d'`` 和浮點數表示型別中,每 3 位數插入一個底線,這不包括 " +"``'n'``。對於整數表示型別 ``'b'``,``'o'``,``'x'`` 和 ``'X'``,每 4 位數字會" +"插入底線。對於其他表示型別來說此選項並不支援。" + +#: ../../library/string.rst:460 +msgid "" +"For a locale aware separator, use the ``'n'`` presentation type instead." +msgstr "" + +#: ../../library/string.rst:462 +msgid "Added the ``','`` option (see also :pep:`378`)." +msgstr "新增 ``','`` 選項(請見 :pep:`378`\\ )。" + +#: ../../library/string.rst:465 +msgid "Added the ``'_'`` option (see also :pep:`515`)." +msgstr "新增 ``'_'`` 選項(請見 :pep:`515`\\ )。" + +#: ../../library/string.rst:468 msgid "" "The *precision* is a decimal integer indicating how many digits should be " "displayed after the decimal point for presentation types ``'f'`` and " @@ -657,89 +676,89 @@ msgstr "" "示類型,該欄位指定最大欄位大小 - 換言之,將使用欄位中的多少字元。整數表示類型" "不允許使用 *precision*。" -#: ../../library/string.rst:461 +#: ../../library/string.rst:476 msgid "Finally, the *type* determines how the data should be presented." msgstr "最終,型別決定了資料將會如何呈現" -#: ../../library/string.rst:463 +#: ../../library/string.rst:478 msgid "The available string presentation types are:" msgstr "可用的字串表示型別有:" -#: ../../library/string.rst:466 ../../library/string.rst:477 -#: ../../library/string.rst:512 +#: ../../library/string.rst:481 ../../library/string.rst:492 +#: ../../library/string.rst:527 msgid "Type" msgstr "型別" -#: ../../library/string.rst:468 +#: ../../library/string.rst:483 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/string.rst:468 +#: ../../library/string.rst:483 msgid "String format. This is the default type for strings and may be omitted." msgstr "" -#: ../../library/string.rst:471 ../../library/string.rst:500 -#: ../../library/string.rst:585 +#: ../../library/string.rst:486 ../../library/string.rst:515 +#: ../../library/string.rst:601 msgid "None" msgstr "None" -#: ../../library/string.rst:471 +#: ../../library/string.rst:486 msgid "The same as ``'s'``." msgstr "與 ``'s'`` 相同。" -#: ../../library/string.rst:474 +#: ../../library/string.rst:489 msgid "The available integer presentation types are:" msgstr "" -#: ../../library/string.rst:479 +#: ../../library/string.rst:494 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/string.rst:479 +#: ../../library/string.rst:494 msgid "Binary format. Outputs the number in base 2." msgstr "" -#: ../../library/string.rst:481 +#: ../../library/string.rst:496 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/string.rst:481 +#: ../../library/string.rst:496 msgid "" "Character. Converts the integer to the corresponding unicode character " "before printing." msgstr "" -#: ../../library/string.rst:484 +#: ../../library/string.rst:499 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/string.rst:484 +#: ../../library/string.rst:499 msgid "Decimal Integer. Outputs the number in base 10." msgstr "" -#: ../../library/string.rst:486 +#: ../../library/string.rst:501 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/string.rst:486 +#: ../../library/string.rst:501 msgid "Octal format. Outputs the number in base 8." msgstr "" -#: ../../library/string.rst:488 +#: ../../library/string.rst:503 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/string.rst:488 +#: ../../library/string.rst:503 msgid "" "Hex format. Outputs the number in base 16, using lower-case letters for the " "digits above 9." msgstr "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用小寫字母。" -#: ../../library/string.rst:491 +#: ../../library/string.rst:506 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/string.rst:491 +#: ../../library/string.rst:506 msgid "" "Hex format. Outputs the number in base 16, using upper-case letters for the " "digits above 9. In case ``'#'`` is specified, the prefix ``'0x'`` will be " @@ -748,21 +767,21 @@ msgstr "" "十六進位格式。輸出以 16 為基數的數字,9 以上的數字使用大寫字母。如果指定了 " "``'#'``,則前綴 ``'0x'`` 也會被轉成大寫的 ``'0X'``。" -#: ../../library/string.rst:496 ../../library/string.rst:578 +#: ../../library/string.rst:511 ../../library/string.rst:593 msgid "``'n'``" msgstr "``'n'``" -#: ../../library/string.rst:496 +#: ../../library/string.rst:511 msgid "" "Number. This is the same as ``'d'``, except that it uses the current locale " -"setting to insert the appropriate number separator characters." +"setting to insert the appropriate digit group separators." msgstr "" -#: ../../library/string.rst:500 +#: ../../library/string.rst:515 msgid "The same as ``'d'``." msgstr "與 ``'d'`` 相同。" -#: ../../library/string.rst:503 +#: ../../library/string.rst:518 msgid "" "In addition to the above presentation types, integers can be formatted with " "the floating-point presentation types listed below (except ``'n'`` and " @@ -770,17 +789,17 @@ msgid "" "floating-point number before formatting." msgstr "" -#: ../../library/string.rst:508 +#: ../../library/string.rst:523 msgid "" "The available presentation types for :class:`float` " "and :class:`~decimal.Decimal` values are:" msgstr "" -#: ../../library/string.rst:514 +#: ../../library/string.rst:529 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/string.rst:514 +#: ../../library/string.rst:529 msgid "" "Scientific notation. For a given precision ``p``, formats the number in " "scientific notation with the letter 'e' separating the coefficient from the " @@ -792,21 +811,21 @@ msgid "" "unless the ``#`` option is used." msgstr "" -#: ../../library/string.rst:525 +#: ../../library/string.rst:540 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/string.rst:525 +#: ../../library/string.rst:540 msgid "" "Scientific notation. Same as ``'e'`` except it uses an upper case 'E' as the " "separator character." msgstr "" -#: ../../library/string.rst:528 +#: ../../library/string.rst:543 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/string.rst:528 +#: ../../library/string.rst:543 msgid "" "Fixed-point notation. For a given precision ``p``, formats the number as a " "decimal number with exactly ``p`` digits following the decimal point. With " @@ -816,21 +835,21 @@ msgid "" "point is omitted unless the ``#`` option is used." msgstr "" -#: ../../library/string.rst:537 +#: ../../library/string.rst:552 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/string.rst:537 +#: ../../library/string.rst:552 msgid "" "Fixed-point notation. Same as ``'f'``, but converts ``nan`` to ``NAN`` and " "``inf`` to ``INF``." msgstr "" -#: ../../library/string.rst:540 +#: ../../library/string.rst:555 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/string.rst:540 +#: ../../library/string.rst:555 msgid "" "General format. For a given precision ``p >= 1``, this rounds the number to " "``p`` significant digits and then formats the result in either fixed-point " @@ -838,7 +857,7 @@ msgid "" "``0`` is treated as equivalent to a precision of ``1``." msgstr "" -#: ../../library/string.rst:547 +#: ../../library/string.rst:562 msgid "" "The precise rules are as follows: suppose that the result formatted with " "presentation type ``'e'`` and precision ``p-1`` would have exponent " @@ -851,7 +870,7 @@ msgid "" "unless the ``'#'`` option is used." msgstr "" -#: ../../library/string.rst:560 +#: ../../library/string.rst:575 msgid "" "With no precision given, uses a precision of ``6`` significant digits " "for :class:`float`. For :class:`~decimal.Decimal`, the coefficient of the " @@ -861,40 +880,41 @@ msgid "" "1, and fixed-point notation is used otherwise." msgstr "" -#: ../../library/string.rst:569 +#: ../../library/string.rst:584 msgid "" "Positive and negative infinity, positive and negative zero, and nans, are " "formatted as ``inf``, ``-inf``, ``0``, ``-0`` and ``nan`` respectively, " "regardless of the precision." msgstr "" -#: ../../library/string.rst:574 +#: ../../library/string.rst:589 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/string.rst:574 +#: ../../library/string.rst:589 msgid "" "General format. Same as ``'g'`` except switches to ``'E'`` if the number " "gets too large. The representations of infinity and NaN are uppercased, too." msgstr "" -#: ../../library/string.rst:578 +#: ../../library/string.rst:593 msgid "" "Number. This is the same as ``'g'``, except that it uses the current locale " -"setting to insert the appropriate number separator characters." +"setting to insert the appropriate digit group separators for the integral " +"part of a number." msgstr "" -#: ../../library/string.rst:582 +#: ../../library/string.rst:598 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/string.rst:582 +#: ../../library/string.rst:598 msgid "" "Percentage. Multiplies the number by 100 and displays in fixed (``'f'``) " "format, followed by a percent sign." msgstr "" -#: ../../library/string.rst:585 +#: ../../library/string.rst:601 msgid "" "For :class:`float` this is like the ``'g'`` type, except that when fixed-" "point notation is used to format the result, it always includes at least one " @@ -903,20 +923,20 @@ msgid "" "as large as needed to represent the given value faithfully." msgstr "" -#: ../../library/string.rst:593 +#: ../../library/string.rst:609 msgid "" "For :class:`~decimal.Decimal`, this is the same as either ``'g'`` or ``'G'`` " "depending on the value of ``context.capitals`` for the current decimal " "context." msgstr "" -#: ../../library/string.rst:597 +#: ../../library/string.rst:613 msgid "" "The overall effect is to match the output of :func:`str` as altered by the " "other format modifiers." msgstr "" -#: ../../library/string.rst:601 +#: ../../library/string.rst:617 msgid "" "The result should be correctly rounded to a given precision ``p`` of digits " "after the decimal point. The rounding mode for :class:`float` matches that " @@ -924,7 +944,7 @@ msgid "" "mode of the current :ref:`context ` will be used." msgstr "" -#: ../../library/string.rst:606 +#: ../../library/string.rst:622 msgid "" "The available presentation types for :class:`complex` are the same as those " "for :class:`float` (``'%'`` is not allowed). Both the real and imaginary " @@ -936,17 +956,17 @@ msgid "" "surrounded by parentheses), possibly altered by other format modifiers." msgstr "" -#: ../../library/string.rst:619 +#: ../../library/string.rst:635 msgid "Format examples" msgstr "格式範例" -#: ../../library/string.rst:621 +#: ../../library/string.rst:637 msgid "" "This section contains examples of the :meth:`str.format` syntax and " "comparison with the old ``%``-formatting." msgstr "本節包含 :meth:`str.format` 語法以及與舊式 ``%`` 格式的比較。" -#: ../../library/string.rst:624 +#: ../../library/string.rst:640 msgid "" "In most of the cases the syntax is similar to the old ``%``-formatting, with " "the addition of the ``{}`` and with ``:`` used instead of ``%``. For " @@ -955,17 +975,17 @@ msgstr "" "此語法在大多情況下與舊式的 ``%`` 格式類似,只是增加了 ``{}`` 和 ``:`` 來取代 " "``%``。例如,``'%03.2f'`` 可以改寫為 ``'{:03.2f}'``。" -#: ../../library/string.rst:628 +#: ../../library/string.rst:644 msgid "" "The new format syntax also supports new and different options, shown in the " "following examples." msgstr "新的語法還支援新的選項,將在以下的範例中說明。" -#: ../../library/string.rst:631 +#: ../../library/string.rst:647 msgid "Accessing arguments by position::" msgstr "按位置存取引數: ::" -#: ../../library/string.rst:633 +#: ../../library/string.rst:649 msgid "" ">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" "'a, b, c'\n" @@ -990,11 +1010,11 @@ msgstr "" ">>> '{0}{1}{0}'.format('abra', 'cad') # 引數索引可以重複\n" "'abracadabra'" -#: ../../library/string.rst:644 +#: ../../library/string.rst:660 msgid "Accessing arguments by name::" msgstr "按名稱存取引數: ::" -#: ../../library/string.rst:646 +#: ../../library/string.rst:662 msgid "" ">>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', " "longitude='-115.81W')\n" @@ -1004,11 +1024,11 @@ msgid "" "'Coordinates: 37.24N, -115.81W'" msgstr "" -#: ../../library/string.rst:652 +#: ../../library/string.rst:668 msgid "Accessing arguments' attributes::" msgstr "存取引數的屬性: ::" -#: ../../library/string.rst:654 +#: ../../library/string.rst:670 msgid "" ">>> c = 3-5j\n" ">>> ('The complex number {0} is formed from the real part {0.real} '\n" @@ -1025,11 +1045,11 @@ msgid "" "'Point(4, 2)'" msgstr "" -#: ../../library/string.rst:667 +#: ../../library/string.rst:683 msgid "Accessing arguments' items::" msgstr "存取引數的內容: ::" -#: ../../library/string.rst:669 +#: ../../library/string.rst:685 msgid "" ">>> coord = (3, 5)\n" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" @@ -1039,11 +1059,11 @@ msgstr "" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" "'X: 3; Y: 5'" -#: ../../library/string.rst:673 +#: ../../library/string.rst:689 msgid "Replacing ``%s`` and ``%r``::" msgstr "替換 ``%s`` 和 ``%r``: ::" -#: ../../library/string.rst:675 +#: ../../library/string.rst:691 msgid "" ">>> \"repr() shows quotes: {!r}; str() doesn't: {!s}\".format('test1', " "'test2')\n" @@ -1053,11 +1073,11 @@ msgstr "" "'test2')\n" "\"repr() shows quotes: 'test1'; str() doesn't: test2\"" -#: ../../library/string.rst:678 +#: ../../library/string.rst:694 msgid "Aligning the text and specifying a width::" msgstr "對齊文字以及指定寬度: ::" -#: ../../library/string.rst:680 +#: ../../library/string.rst:696 msgid "" ">>> '{:<30}'.format('left aligned')\n" "'left aligned '\n" @@ -1069,11 +1089,11 @@ msgid "" "'***********centered***********'" msgstr "" -#: ../../library/string.rst:689 +#: ../../library/string.rst:705 msgid "Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::" msgstr "替換 ``%+f``、``%-f`` 和 ``% f`` 以及指定正負號: ::" -#: ../../library/string.rst:691 +#: ../../library/string.rst:707 msgid "" ">>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always\n" "'+3.140000; -3.140000'\n" @@ -1091,12 +1111,12 @@ msgstr "" "同\n" "'3.140000; -3.140000'" -#: ../../library/string.rst:698 +#: ../../library/string.rst:714 msgid "" "Replacing ``%x`` and ``%o`` and converting the value to different bases::" msgstr "替換 ``%x`` 和 ``%o`` 並將其值轉換為不同的進位制: ::" -#: ../../library/string.rst:700 +#: ../../library/string.rst:716 msgid "" ">>> # format also supports binary numbers\n" ">>> \"int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}\".format(42)\n" @@ -1106,23 +1126,35 @@ msgid "" "'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'" msgstr "" -#: ../../library/string.rst:707 -msgid "Using the comma as a thousands separator::" -msgstr "使用逗號作為千位分隔符: ::" +#: ../../library/string.rst:723 +msgid "Using the comma or the underscore as a digit group separator::" +msgstr "使用逗號或底線作為數字分組分隔符號: ::" -#: ../../library/string.rst:709 +#: ../../library/string.rst:725 msgid "" ">>> '{:,}'.format(1234567890)\n" -"'1,234,567,890'" +"'1,234,567,890'\n" +">>> '{:_}'.format(1234567890)\n" +"'1_234_567_890'\n" +">>> '{:_b}'.format(1234567890)\n" +"'100_1001_1001_0110_0000_0010_1101_0010'\n" +">>> '{:_x}'.format(1234567890)\n" +"'4996_02d2'" msgstr "" ">>> '{:,}'.format(1234567890)\n" -"'1,234,567,890'" - -#: ../../library/string.rst:712 +"'1,234,567,890'\n" +">>> '{:_}'.format(1234567890)\n" +"'1_234_567_890'\n" +">>> '{:_b}'.format(1234567890)\n" +"'100_1001_1001_0110_0000_0010_1101_0010'\n" +">>> '{:_x}'.format(1234567890)\n" +"'4996_02d2'" + +#: ../../library/string.rst:734 msgid "Expressing a percentage::" msgstr "表示為百分比: ::" -#: ../../library/string.rst:714 +#: ../../library/string.rst:736 msgid "" ">>> points = 19\n" ">>> total = 22\n" @@ -1134,11 +1166,11 @@ msgstr "" ">>> 'Correct answers: {:.2%}'.format(points/total)\n" "'Correct answers: 86.36%'" -#: ../../library/string.rst:719 +#: ../../library/string.rst:741 msgid "Using type-specific formatting::" msgstr "作為特定型別格式: ::" -#: ../../library/string.rst:721 +#: ../../library/string.rst:743 msgid "" ">>> import datetime\n" ">>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n" @@ -1150,11 +1182,11 @@ msgstr "" ">>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" "'2010-07-04 12:15:58'" -#: ../../library/string.rst:726 +#: ../../library/string.rst:748 msgid "Nesting arguments and more complex examples::" msgstr "巢狀引數及更多複雜範例: ::" -#: ../../library/string.rst:728 +#: ../../library/string.rst:750 msgid "" ">>> for align, text in zip('<^>', ['left', 'center', 'right']):\n" "... '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n" @@ -1170,7 +1202,7 @@ msgid "" "3232235521\n" ">>>\n" ">>> width = 5\n" -">>> for num in range(5,12): \n" +">>> for num in range(5,12):\n" "... for base in 'dXob':\n" "... print('{0:{width}{base}}'.format(num, base=base, width=width), " "end=' ')\n" @@ -1198,7 +1230,7 @@ msgstr "" "3232235521\n" ">>>\n" ">>> width = 5\n" -">>> for num in range(5,12): \n" +">>> for num in range(5,12):\n" "... for base in 'dXob':\n" "... print('{0:{width}{base}}'.format(num, base=base, width=width), " "end=' ')\n" @@ -1212,11 +1244,11 @@ msgstr "" " 10 A 12 1010\n" " 11 B 13 1011" -#: ../../library/string.rst:760 +#: ../../library/string.rst:782 msgid "Template strings" msgstr "模板字串" -#: ../../library/string.rst:762 +#: ../../library/string.rst:784 msgid "" "Template strings provide simpler string substitutions as described " "in :pep:`292`. A primary use case for template strings is for " @@ -1231,17 +1263,17 @@ msgstr "" "化工具更容易翻譯。基於模板字串建構的 i18n 函式庫範例,請參閱 `flufl.i18n " "`_ 套件。" -#: ../../library/string.rst:772 +#: ../../library/string.rst:794 msgid "" "Template strings support ``$``-based substitutions, using the following " "rules:" msgstr "" -#: ../../library/string.rst:774 +#: ../../library/string.rst:796 msgid "``$$`` is an escape; it is replaced with a single ``$``." msgstr "" -#: ../../library/string.rst:776 +#: ../../library/string.rst:798 msgid "" "``$identifier`` names a substitution placeholder matching a mapping key of " "``\"identifier\"``. By default, ``\"identifier\"`` is restricted to any " @@ -1251,30 +1283,30 @@ msgid "" "specification." msgstr "" -#: ../../library/string.rst:783 +#: ../../library/string.rst:805 msgid "" "``${identifier}`` is equivalent to ``$identifier``. It is required when " "valid identifier characters follow the placeholder but are not part of the " "placeholder, such as ``\"${noun}ification\"``." msgstr "" -#: ../../library/string.rst:787 +#: ../../library/string.rst:809 msgid "" "Any other appearance of ``$`` in the string will result in " "a :exc:`ValueError` being raised." msgstr "" -#: ../../library/string.rst:790 +#: ../../library/string.rst:812 msgid "" "The :mod:`string` module provides a :class:`Template` class that implements " "these rules. The methods of :class:`Template` are:" msgstr "" -#: ../../library/string.rst:796 +#: ../../library/string.rst:818 msgid "The constructor takes a single argument which is the template string." msgstr "" -#: ../../library/string.rst:801 +#: ../../library/string.rst:823 msgid "" "Performs the template substitution, returning a new string. *mapping* is " "any dictionary-like object with keys that match the placeholders in the " @@ -1286,7 +1318,7 @@ msgstr "" "的字典型物件。或者如果關鍵字就是佔位符號時,你也可以改提供關鍵字引數。當 " "*mapping* 跟 *kwds* 同時給定並存在重複時,*kwds* 的佔位符號會被優先使用。" -#: ../../library/string.rst:810 +#: ../../library/string.rst:832 msgid "" "Like :meth:`substitute`, except that if placeholders are missing from " "*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the " @@ -1299,7 +1331,7 @@ msgstr "" "與 :meth:`substitute` 不同的是,任何包含 ``$`` 的字句會直接回傳 ``$`` 而非引" "發 :exc:`ValueError`。" -#: ../../library/string.rst:816 +#: ../../library/string.rst:838 msgid "" "While other exceptions may still occur, this method is called \"safe\" " "because it always tries to return a usable string instead of raising an " @@ -1313,7 +1345,7 @@ msgstr "" "完全安全,因為它會默默忽略格式錯誤的模板,這些模板包含了多餘的左右定界符、不" "匹配的括號,或者不是有效的 Python 識別字的佔位符號。" -#: ../../library/string.rst:826 +#: ../../library/string.rst:848 msgid "" "Returns false if the template has invalid placeholders that will " "cause :meth:`substitute` to raise :exc:`ValueError`." @@ -1321,18 +1353,18 @@ msgstr "" "如果模板有將導致 :meth:`substitute` 引發 :exc:`ValueError` 的無效佔位符號,就" "會回傳 false。" -#: ../../library/string.rst:834 +#: ../../library/string.rst:856 msgid "" "Returns a list of the valid identifiers in the template, in the order they " "first appear, ignoring any invalid identifiers." msgstr "" "回傳模板中有效識別字的串列,按照它們首次出現的順序,並忽略任何無效的識別字。" -#: ../../library/string.rst:839 +#: ../../library/string.rst:861 msgid ":class:`Template` instances also provide one public data attribute:" msgstr ":class:`Template` 實例也提供一個公開的資料屬性:" -#: ../../library/string.rst:843 +#: ../../library/string.rst:865 msgid "" "This is the object passed to the constructor's *template* argument. In " "general, you shouldn't change it, but read-only access is not enforced." @@ -1340,11 +1372,11 @@ msgstr "" "這是傳遞給建構函式 *template* 引數的物件。一般來說,你不應該改變它,但並沒有" "強制設定成唯讀。" -#: ../../library/string.rst:846 +#: ../../library/string.rst:868 msgid "Here is an example of how to use a Template::" msgstr "以下是如何使用 Template 的一個範例: ::" -#: ../../library/string.rst:848 +#: ../../library/string.rst:870 msgid "" ">>> from string import Template\n" ">>> s = Template('$who likes $what')\n" @@ -1378,7 +1410,7 @@ msgstr "" ">>> Template('$who likes $what').safe_substitute(d)\n" "'tim likes $what'" -#: ../../library/string.rst:864 +#: ../../library/string.rst:886 msgid "" "Advanced usage: you can derive subclasses of :class:`Template` to customize " "the placeholder syntax, delimiter character, or the entire regular " @@ -1388,7 +1420,7 @@ msgstr "" "進階用法:你可以衍生 :class:`Template` 類別來自定義佔位符號語法、左右定界符字" "元,或者用於剖析模板字串的正規表示式。你可以透過覆寫這些類別屬性來達成:" -#: ../../library/string.rst:869 +#: ../../library/string.rst:891 msgid "" "*delimiter* -- This is the literal string describing a placeholder " "introducing delimiter. The default value is ``$``. Note that this should " @@ -1402,7 +1434,7 @@ msgstr "" "注意你不能在建立類別後修改左右定界符。(意即在子類別的命名空間中必須設置不同" "的左右定界符)" -#: ../../library/string.rst:876 +#: ../../library/string.rst:898 msgid "" "*idpattern* -- This is the regular expression describing the pattern for non-" "braced placeholders. The default value is the regular expression ``(?a:[_a-" @@ -1410,19 +1442,19 @@ msgid "" "pattern will also apply to braced placeholders." msgstr "" -#: ../../library/string.rst:883 +#: ../../library/string.rst:905 msgid "" "Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with " "some non-ASCII characters. That's why we use the local ``a`` flag here." msgstr "" -#: ../../library/string.rst:887 +#: ../../library/string.rst:909 msgid "" "*braceidpattern* can be used to define separate patterns used inside and " "outside the braces." msgstr "" -#: ../../library/string.rst:891 +#: ../../library/string.rst:913 msgid "" "*braceidpattern* -- This is like *idpattern* but describes the pattern for " "braced placeholders. Defaults to ``None`` which means to fall back to " @@ -1431,7 +1463,7 @@ msgid "" "unbraced placeholders." msgstr "" -#: ../../library/string.rst:899 +#: ../../library/string.rst:921 msgid "" "*flags* -- The regular expression flags that will be applied when compiling " "the regular expression used for recognizing substitutions. The default " @@ -1440,7 +1472,7 @@ msgid "" "regular expressions." msgstr "" -#: ../../library/string.rst:907 +#: ../../library/string.rst:929 msgid "" "Alternatively, you can provide the entire regular expression pattern by " "overriding the class attribute *pattern*. If you do this, the value must be " @@ -1449,13 +1481,13 @@ msgid "" "placeholder rule:" msgstr "" -#: ../../library/string.rst:913 +#: ../../library/string.rst:935 msgid "" "*escaped* -- This group matches the escape sequence, e.g. ``$$``, in the " "default pattern." msgstr "*escaped* -- 此群組與跳脫序列匹配,例如在預設模式下為 ``$$``。" -#: ../../library/string.rst:916 +#: ../../library/string.rst:938 msgid "" "*named* -- This group matches the unbraced placeholder name; it should not " "include the delimiter in capturing group." @@ -1463,7 +1495,7 @@ msgstr "" "*named* -- 此群組與不帶大括號的佔位符號名稱匹配;它不應包含擷取群組中的左右定" "界符號。" -#: ../../library/string.rst:919 +#: ../../library/string.rst:941 msgid "" "*braced* -- This group matches the brace enclosed placeholder name; it " "should not include either the delimiter or braces in the capturing group." @@ -1471,7 +1503,7 @@ msgstr "" "*braced* -- 此群組與大括號括起來的佔位符號名稱匹配;它不應在擷取群組中包含左" "右定界符或大括號。" -#: ../../library/string.rst:922 +#: ../../library/string.rst:944 msgid "" "*invalid* -- This group matches any other delimiter pattern (usually a " "single delimiter), and it should appear last in the regular expression." @@ -1479,7 +1511,7 @@ msgstr "" "*invalid* -- 此群組與任何其他左右定界符模式(通常是單一左右定界符)匹配,且它" "應該出現在正規表示式的最後。" -#: ../../library/string.rst:925 +#: ../../library/string.rst:947 msgid "" "The methods on this class will raise :exc:`ValueError` if the pattern " "matches the template without one of these named groups matching." @@ -1487,11 +1519,11 @@ msgstr "" "當此模式有匹配於模板但這些命名組中卻有任一個不匹配,此類別的方法將引" "發 :exc:`ValueError`。" -#: ../../library/string.rst:930 +#: ../../library/string.rst:952 msgid "Helper functions" msgstr "輔助函式" -#: ../../library/string.rst:934 +#: ../../library/string.rst:956 msgid "" "Split the argument into words using :meth:`str.split`, capitalize each word " "using :meth:`str.capitalize`, and join the capitalized words " @@ -1509,10 +1541,9 @@ msgstr "" msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../library/string.rst:202 ../../library/string.rst:342 -#: ../../library/string.rst:375 ../../library/string.rst:394 -#: ../../library/string.rst:403 ../../library/string.rst:417 -#: ../../library/string.rst:428 +#: ../../library/string.rst:202 ../../library/string.rst:344 +#: ../../library/string.rst:377 ../../library/string.rst:396 +#: ../../library/string.rst:405 ../../library/string.rst:437 msgid "in string formatting" msgstr "於字串格式化" @@ -1532,50 +1563,50 @@ msgstr "! (驚嘆號)" msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/string.rst:342 +#: ../../library/string.rst:344 msgid "< (less)" msgstr "< (小於)" -#: ../../library/string.rst:342 +#: ../../library/string.rst:344 msgid "> (greater)" msgstr "> (大於)" -#: ../../library/string.rst:342 +#: ../../library/string.rst:344 msgid "= (equals)" -msgstr "= (等於)" +msgstr "= (等號)" -#: ../../library/string.rst:342 +#: ../../library/string.rst:344 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../library/string.rst:375 +#: ../../library/string.rst:377 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../library/string.rst:375 +#: ../../library/string.rst:377 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/string.rst:394 +#: ../../library/string.rst:396 msgid "z" msgstr "z" -#: ../../library/string.rst:403 +#: ../../library/string.rst:405 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/string.rst:417 +#: ../../library/string.rst:437 msgid ", (comma)" msgstr ", (逗號)" -#: ../../library/string.rst:428 +#: ../../library/string.rst:437 msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../library/string.rst:770 +#: ../../library/string.rst:792 msgid "$ (dollar)" msgstr "$ (金錢符號)" -#: ../../library/string.rst:770 +#: ../../library/string.rst:792 msgid "in template strings" msgstr "於 template strings(模板字串)" diff --git a/library/struct.po b/library/struct.po index 812644b7bc..690def85aa 100644 --- a/library/struct.po +++ b/library/struct.po @@ -52,12 +52,12 @@ msgstr "" #: ../../library/struct.rst:39 msgid "" "Several :mod:`struct` functions (and methods of :class:`Struct`) take a " -"*buffer* argument. This refers to objects that implement the :ref:" -"`bufferobjects` and provide either a readable or read-writable buffer. The " -"most common types used for that purpose are :class:`bytes` and :class:" -"`bytearray`, but many other types that can be viewed as an array of bytes " -"implement the buffer protocol, so that they can be read/filled without " -"additional copying from a :class:`bytes` object." +"*buffer* argument. This refers to objects that implement " +"the :ref:`bufferobjects` and provide either a readable or read-writable " +"buffer. The most common types used for that purpose are :class:`bytes` " +"and :class:`bytearray`, but many other types that can be viewed as an array " +"of bytes implement the buffer protocol, so that they can be read/filled " +"without additional copying from a :class:`bytes` object." msgstr "" #: ../../library/struct.rst:48 @@ -247,8 +247,8 @@ msgstr "" msgid "" "Native byte order is big-endian or little-endian, depending on the host " "system. For example, Intel x86, AMD64 (x86-64), and Apple M1 are little-" -"endian; IBM z and many legacy architectures are big-endian. Use :data:`sys." -"byteorder` to check the endianness of your system." +"endian; IBM z and many legacy architectures are big-endian. " +"Use :data:`sys.byteorder` to check the endianness of your system." msgstr "" #: ../../library/struct.rst:183 @@ -259,8 +259,8 @@ msgstr "" #: ../../library/struct.rst:186 msgid "" -"Standard size depends only on the format character; see the table in the :" -"ref:`format-characters` section." +"Standard size depends only on the format character; see the table in " +"the :ref:`format-characters` section." msgstr "" #: ../../library/struct.rst:189 @@ -666,13 +666,13 @@ msgid "" "The ``'p'`` format character encodes a \"Pascal string\", meaning a short " "variable-length string stored in a *fixed number of bytes*, given by the " "count. The first byte stored is the length of the string, or 255, whichever " -"is smaller. The bytes of the string follow. If the string passed in to :" -"func:`pack` is too long (longer than the count minus 1), only the leading " -"``count-1`` bytes of the string are stored. If the string is shorter than " -"``count-1``, it is padded with null bytes so that exactly count bytes in all " -"are used. Note that for :func:`unpack`, the ``'p'`` format character " -"consumes ``count`` bytes, but that the string returned can never contain " -"more than 255 bytes." +"is smaller. The bytes of the string follow. If the string passed in " +"to :func:`pack` is too long (longer than the count minus 1), only the " +"leading ``count-1`` bytes of the string are stored. If the string is " +"shorter than ``count-1``, it is padded with null bytes so that exactly count " +"bytes in all are used. Note that for :func:`unpack`, the ``'p'`` format " +"character consumes ``count`` bytes, but that the string returned can never " +"contain more than 255 bytes." msgstr "" #: ../../library/struct.rst:339 @@ -706,8 +706,8 @@ msgstr "" msgid "" "When packing a value ``x`` using one of the integer formats (``'b'``, " "``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, ``'l'``, ``'L'``, ``'q'``, " -"``'Q'``), if ``x`` is outside the valid range for that format then :exc:" -"`struct.error` is raised." +"``'Q'``), if ``x`` is outside the valid range for that format " +"then :exc:`struct.error` is raised." msgstr "" #: ../../library/struct.rst:363 @@ -1076,8 +1076,8 @@ msgstr "" #: ../../library/struct.rst:595 msgid "" "Identical to the :func:`unpack_from` function, using the compiled format. " -"The buffer's size in bytes, starting at position *offset*, must be at least :" -"attr:`size`." +"The buffer's size in bytes, starting at position *offset*, must be at " +"least :attr:`size`." msgstr "" #: ../../library/struct.rst:602 @@ -1135,7 +1135,7 @@ msgstr "於 struct format strings(結構格式字串)" #: ../../library/struct.rst:136 msgid "= (equals)" -msgstr "= (等於)" +msgstr "= (等號)" #: ../../library/struct.rst:136 msgid "< (less)" diff --git a/library/sys.monitoring.po b/library/sys.monitoring.po index cd5f4ccbcc..ff8a42a082 100644 --- a/library/sys.monitoring.po +++ b/library/sys.monitoring.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2024, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # Translators: # Matt Wang , 2024 @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-19 01:58+0800\n" +"POT-Creation-Date: 2025-04-25 00:15+0000\n" "PO-Revision-Date: 2024-10-21 17:51+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,8 +27,8 @@ msgid "" "``import sys`` and then use ``sys.monitoring``." msgstr "" ":mod:`sys.monitoring` 是 :mod:`sys` 模組內的一個命名空間,不是一個獨立的模" -"組,所以不需要 ``import sys.monitoring``,只需 ``import sys`` 然後使用 ``sys." -"monitoring``。" +"組,所以不需要 ``import sys.monitoring``,只需 ``import sys`` 然後使用 " +"``sys.monitoring``。" #: ../../library/sys.monitoring.rst:19 msgid "" @@ -221,8 +221,8 @@ msgstr "" #: ../../library/sys.monitoring.rst:142 msgid "" -"An exception is raised, except those that cause a :monitoring-event:" -"`STOP_ITERATION` event." +"An exception is raised, except those that cause a :monitoring-" +"event:`STOP_ITERATION` event." msgstr "" "例外被引發,除了那些會導致 :monitoring-event:`STOP_ITERATION` 的事件外。" @@ -248,12 +248,12 @@ msgstr "將來可能會新增更多事件。" msgid "" "These events are attributes of the :mod:`!sys.monitoring.events` namespace. " "Each event is represented as a power-of-2 integer constant. To define a set " -"of events, simply bitwise or the individual events together. For example, to " +"of events, simply bitwise OR the individual events together. For example, to " "specify both :monitoring-event:`PY_RETURN` and :monitoring-event:`PY_START` " "events, use the expression ``PY_RETURN | PY_START``." msgstr "" "這些事件是 :mod:`!sys.monitoring.events` 命名空間的屬性。每個事件以 2 次方的" -"整數常數表示。要定義一組事件,只要將個別事件以 bitwise or 相接即可。例如,若" +"整數常數表示。要定義一組事件,只要將個別事件以 bitwise OR 相接即可。例如,若" "要指定 :monitoring-event:`PY_RETURN` 和 :monitoring-event:`PY_START` 兩個事" "件,請使用運算式 ``PY_RETURN | PY_START``。" @@ -273,11 +273,11 @@ msgstr "" msgid "Events are divided into three groups:" msgstr "事件被分為三組:" -#: ../../library/sys.monitoring.rst:171 +#: ../../library/sys.monitoring.rst:173 msgid "Local events" msgstr "區域事件" -#: ../../library/sys.monitoring.rst:173 +#: ../../library/sys.monitoring.rst:175 msgid "" "Local events are associated with normal execution of the program and happen " "at clearly defined locations. All local events can be disabled. The local " @@ -286,114 +286,114 @@ msgstr "" "區域事件與程式的正常執行相關,並發生在明確定義的位置。所有區域事件都可以被停" "用。區域事件有:" -#: ../../library/sys.monitoring.rst:177 +#: ../../library/sys.monitoring.rst:179 msgid ":monitoring-event:`PY_START`" msgstr ":monitoring-event:`PY_START`" -#: ../../library/sys.monitoring.rst:178 +#: ../../library/sys.monitoring.rst:180 msgid ":monitoring-event:`PY_RESUME`" msgstr ":monitoring-event:`PY_RESUME`" -#: ../../library/sys.monitoring.rst:179 +#: ../../library/sys.monitoring.rst:181 msgid ":monitoring-event:`PY_RETURN`" msgstr ":monitoring-event:`PY_RETURN`" -#: ../../library/sys.monitoring.rst:180 +#: ../../library/sys.monitoring.rst:182 msgid ":monitoring-event:`PY_YIELD`" msgstr ":monitoring-event:`PY_YIELD`" -#: ../../library/sys.monitoring.rst:181 +#: ../../library/sys.monitoring.rst:183 msgid ":monitoring-event:`CALL`" msgstr ":monitoring-event:`CALL`" -#: ../../library/sys.monitoring.rst:182 +#: ../../library/sys.monitoring.rst:184 msgid ":monitoring-event:`LINE`" msgstr ":monitoring-event:`LINE`" -#: ../../library/sys.monitoring.rst:183 +#: ../../library/sys.monitoring.rst:185 msgid ":monitoring-event:`INSTRUCTION`" msgstr ":monitoring-event:`INSTRUCTION`" -#: ../../library/sys.monitoring.rst:184 +#: ../../library/sys.monitoring.rst:186 msgid ":monitoring-event:`JUMP`" msgstr ":monitoring-event:`JUMP`" -#: ../../library/sys.monitoring.rst:185 +#: ../../library/sys.monitoring.rst:187 msgid ":monitoring-event:`BRANCH`" msgstr ":monitoring-event:`BRANCH`" -#: ../../library/sys.monitoring.rst:186 +#: ../../library/sys.monitoring.rst:188 msgid ":monitoring-event:`STOP_ITERATION`" msgstr ":monitoring-event:`STOP_ITERATION`" -#: ../../library/sys.monitoring.rst:189 +#: ../../library/sys.monitoring.rst:191 msgid "Ancillary events" msgstr "附屬事件 (ancillary events)" -#: ../../library/sys.monitoring.rst:191 +#: ../../library/sys.monitoring.rst:193 msgid "" "Ancillary events can be monitored like other events, but are controlled by " "another event:" msgstr "附屬事件可以像其他事件一樣被監控,但由另一個事件所控制:" -#: ../../library/sys.monitoring.rst:194 +#: ../../library/sys.monitoring.rst:196 msgid ":monitoring-event:`C_RAISE`" msgstr ":monitoring-event:`C_RAISE`" -#: ../../library/sys.monitoring.rst:195 +#: ../../library/sys.monitoring.rst:197 msgid ":monitoring-event:`C_RETURN`" msgstr ":monitoring-event:`C_RETURN`" -#: ../../library/sys.monitoring.rst:197 +#: ../../library/sys.monitoring.rst:199 msgid "" "The :monitoring-event:`C_RETURN` and :monitoring-event:`C_RAISE` events are " -"controlled by the :monitoring-event:`CALL` event. :monitoring-event:" -"`C_RETURN` and :monitoring-event:`C_RAISE` events will only be seen if the " -"corresponding :monitoring-event:`CALL` event is being monitored." +"controlled by the :monitoring-event:`CALL` event. :monitoring-" +"event:`C_RETURN` and :monitoring-event:`C_RAISE` events will only be seen if " +"the corresponding :monitoring-event:`CALL` event is being monitored." msgstr "" -":monitoring-event:`C_RETURN` 和 :monitoring-event:`C_RAISE` 事件由 :" -"monitoring-event:`CALL` 事件控制。只有當對應的 :monitoring-event:`CALL` 事件" -"受到監控時,才會看到 :monitoring-event:`C_RETURN` 和 :monitoring-event:" -"`C_RAISE` 事件。" +":monitoring-event:`C_RETURN` 和 :monitoring-event:`C_RAISE` 事件" +"由 :monitoring-event:`CALL` 事件控制。只有當對應的 :monitoring-event:`CALL` " +"事件受到監控時,才會看到 :monitoring-event:`C_RETURN` 和 :monitoring-" +"event:`C_RAISE` 事件。" -#: ../../library/sys.monitoring.rst:203 +#: ../../library/sys.monitoring.rst:205 msgid "Other events" msgstr "其他事件" -#: ../../library/sys.monitoring.rst:205 +#: ../../library/sys.monitoring.rst:207 msgid "" "Other events are not necessarily tied to a specific location in the program " "and cannot be individually disabled." msgstr "其他事件不一定與程式中的特定位置相關聯,也不能單獨停用。" -#: ../../library/sys.monitoring.rst:208 +#: ../../library/sys.monitoring.rst:210 msgid "The other events that can be monitored are:" msgstr "其他可以監控的事件有:" -#: ../../library/sys.monitoring.rst:210 +#: ../../library/sys.monitoring.rst:212 msgid ":monitoring-event:`PY_THROW`" msgstr ":monitoring-event:`PY_THROW`" -#: ../../library/sys.monitoring.rst:211 +#: ../../library/sys.monitoring.rst:213 msgid ":monitoring-event:`PY_UNWIND`" msgstr ":monitoring-event:`PY_UNWIND`" -#: ../../library/sys.monitoring.rst:212 +#: ../../library/sys.monitoring.rst:214 msgid ":monitoring-event:`RAISE`" msgstr ":monitoring-event:`RAISE`" -#: ../../library/sys.monitoring.rst:213 +#: ../../library/sys.monitoring.rst:215 msgid ":monitoring-event:`EXCEPTION_HANDLED`" msgstr ":monitoring-event:`EXCEPTION_HANDLED`" -#: ../../library/sys.monitoring.rst:217 +#: ../../library/sys.monitoring.rst:219 msgid "The STOP_ITERATION event" msgstr "STOP_ITERATION 事件" -#: ../../library/sys.monitoring.rst:219 +#: ../../library/sys.monitoring.rst:221 msgid "" -":pep:`PEP 380 <380#use-of-stopiteration-to-return-values>` specifies that a :" -"exc:`StopIteration` exception is raised when returning a value from a " +":pep:`PEP 380 <380#use-of-stopiteration-to-return-values>` specifies that " +"a :exc:`StopIteration` exception is raised when returning a value from a " "generator or coroutine. However, this is a very inefficient way to return a " "value, so some Python implementations, notably CPython 3.12+, do not raise " "an exception unless it would be visible to other code." @@ -403,7 +403,7 @@ msgstr "" "式,因此有一些 Python 實作(特別是 CPython 3.12+)不會引發例外,除非它對其他" "程式碼是可見的。" -#: ../../library/sys.monitoring.rst:225 +#: ../../library/sys.monitoring.rst:227 msgid "" "To allow tools to monitor for real exceptions without slowing down " "generators and coroutines, the :monitoring-event:`STOP_ITERATION` event is " @@ -414,11 +414,11 @@ msgstr "" "event:`STOP_ITERATION` 事件。與 :monitoring-event:`RAISE` 不同,:monitoring-" "event:`STOP_ITERATION` 可以區域停用。" -#: ../../library/sys.monitoring.rst:231 +#: ../../library/sys.monitoring.rst:233 msgid "Turning events on and off" msgstr "開啟和關閉事件" -#: ../../library/sys.monitoring.rst:233 +#: ../../library/sys.monitoring.rst:235 msgid "" "In order to monitor an event, it must be turned on and a corresponding " "callback must be registered. Events can be turned on or off by setting the " @@ -427,52 +427,52 @@ msgstr "" "為了監控一個事件,必須打開它並註冊相應的回呼。可以透過將事件設定為全域或只為" "特定程式碼物件來開啟或關閉事件。" -#: ../../library/sys.monitoring.rst:240 +#: ../../library/sys.monitoring.rst:242 msgid "Setting events globally" msgstr "全域設定事件" -#: ../../library/sys.monitoring.rst:242 +#: ../../library/sys.monitoring.rst:244 msgid "" "Events can be controlled globally by modifying the set of events being " "monitored." msgstr "可以透過修改正在監控的事件集合來全域地控制事件。" -#: ../../library/sys.monitoring.rst:246 +#: ../../library/sys.monitoring.rst:248 msgid "Returns the ``int`` representing all the active events." msgstr "回傳代表所有有效事件的 ``int``。" -#: ../../library/sys.monitoring.rst:250 +#: ../../library/sys.monitoring.rst:252 msgid "" -"Activates all events which are set in *event_set*. Raises a :exc:" -"`ValueError` if *tool_id* is not in use." +"Activates all events which are set in *event_set*. Raises " +"a :exc:`ValueError` if *tool_id* is not in use." msgstr "" -"啟動 *event_set* 中設定的所有事件。如果 *tool_id* 並未正在被使用,則引發 :" -"exc:`ValueError`。" +"啟動 *event_set* 中設定的所有事件。如果 *tool_id* 並未正在被使用,則引" +"發 :exc:`ValueError`。" -#: ../../library/sys.monitoring.rst:253 +#: ../../library/sys.monitoring.rst:255 msgid "No events are active by default." msgstr "預設沒有有效事件。" -#: ../../library/sys.monitoring.rst:256 +#: ../../library/sys.monitoring.rst:258 msgid "Per code object events" msgstr "各別程式碼物件事件" -#: ../../library/sys.monitoring.rst:258 +#: ../../library/sys.monitoring.rst:260 msgid "" "Events can also be controlled on a per code object basis. The functions " "defined below which accept a :class:`types.CodeType` should be prepared to " "accept a look-alike object from functions which are not defined in Python " "(see :ref:`c-api-monitoring`)." msgstr "" -"事件還可以基於各別程式碼物件進行控制。下面定義的、接受 :class:`types." -"CodeType` 的函式應該準備好接受來自 Python 中未定義函式的類似物件(請參閱 :" -"ref:`c-api-monitoring`)。" +"事件還可以基於各別程式碼物件進行控制。下面定義的、接" +"受 :class:`types.CodeType` 的函式應該準備好接受來自 Python 中未定義函式的類似" +"物件(請參閱 :ref:`c-api-monitoring`)。" -#: ../../library/sys.monitoring.rst:265 +#: ../../library/sys.monitoring.rst:267 msgid "Returns all the local events for *code*" msgstr "回傳 *code* 的所有區域事件" -#: ../../library/sys.monitoring.rst:269 +#: ../../library/sys.monitoring.rst:271 msgid "" "Activates all the local events for *code* which are set in *event_set*. " "Raises a :exc:`ValueError` if *tool_id* is not in use." @@ -480,7 +480,7 @@ msgstr "" "啟動 *event_set* 中針對 *code* 設定的所有區域事件。如果 *tool_id* 並未正在被" "使用,則引發 :exc:`ValueError`。" -#: ../../library/sys.monitoring.rst:272 +#: ../../library/sys.monitoring.rst:274 msgid "" "Local events add to global events, but do not mask them. In other words, all " "global events will trigger for a code object, regardless of the local events." @@ -488,26 +488,27 @@ msgstr "" "區域事件會加入到全域事件中,但不會掩蓋它們。換句話說,無論區域事件如何,所有" "全域事件都將為程式碼物件觸發。" -#: ../../library/sys.monitoring.rst:278 +#: ../../library/sys.monitoring.rst:280 msgid "Disabling events" msgstr "停用事件" -#: ../../library/sys.monitoring.rst:282 +#: ../../library/sys.monitoring.rst:284 msgid "" "A special value that can be returned from a callback function to disable " "events for the current code location." msgstr "可以從回呼函式回傳的特殊值,以停用目前程式碼位置的事件。" -#: ../../library/sys.monitoring.rst:285 +#: ../../library/sys.monitoring.rst:287 msgid "" -"Local events can be disabled for a specific code location by returning :data:" -"`sys.monitoring.DISABLE` from a callback function. This does not change " -"which events are set, or any other code locations for the same event." +"Local events can be disabled for a specific code location by " +"returning :data:`sys.monitoring.DISABLE` from a callback function. This does " +"not change which events are set, or any other code locations for the same " +"event." msgstr "" "可透過回呼函式回傳 :data:`sys.monitoring.DISABLE` 來停用特定程式碼位置的區域" "事件。這不會改變被設定的事件,或相同事件的任何其他程式碼位置。" -#: ../../library/sys.monitoring.rst:289 +#: ../../library/sys.monitoring.rst:291 msgid "" "Disabling events for specific locations is very important for high " "performance monitoring. For example, a program can be run under a debugger " @@ -517,25 +518,25 @@ msgstr "" "停用特定位置的事件對於高效能監控非常重要。舉例來說,如果除少數斷點外,偵錯器" "可以停用所有監控,那麼在偵錯器下執行程式就不會有任何開銷 (overhead)。" -#: ../../library/sys.monitoring.rst:296 +#: ../../library/sys.monitoring.rst:298 msgid "" "Enable all the events that were disabled by :data:`sys.monitoring.DISABLE` " "for all tools." msgstr "為所有工具啟用由 :data:`sys.monitoring.DISABLE` 停用的所有事件。" -#: ../../library/sys.monitoring.rst:303 +#: ../../library/sys.monitoring.rst:305 msgid "Registering callback functions" msgstr "註冊回呼函式" -#: ../../library/sys.monitoring.rst:305 +#: ../../library/sys.monitoring.rst:307 msgid "To register a callable for events call" msgstr "用來註冊對事件呼叫的可呼叫物件" -#: ../../library/sys.monitoring.rst:309 +#: ../../library/sys.monitoring.rst:311 msgid "Registers the callable *func* for the *event* with the given *tool_id*" msgstr "使用給定的 *tool_id* 來註冊對 *event* 的可呼叫物件 *func*" -#: ../../library/sys.monitoring.rst:311 +#: ../../library/sys.monitoring.rst:313 msgid "" "If another callback was registered for the given *tool_id* and *event*, it " "is unregistered and returned. Otherwise :func:`register_callback` returns " @@ -544,35 +545,35 @@ msgstr "" "如果給定的 *tool_id* 和 *event* 已經註冊了另一個回呼,則會取消註冊並回傳。否" "則 :func:`register_callback` 會回傳 ``None``。" -#: ../../library/sys.monitoring.rst:316 +#: ../../library/sys.monitoring.rst:318 msgid "" -"Functions can be unregistered by calling ``sys.monitoring." -"register_callback(tool_id, event, None)``." +"Functions can be unregistered by calling " +"``sys.monitoring.register_callback(tool_id, event, None)``." msgstr "" "可以透過呼叫 ``sys.monitoring.register_callback(tool_id, event, None)`` 來取" "消註冊函式。" -#: ../../library/sys.monitoring.rst:319 +#: ../../library/sys.monitoring.rst:321 msgid "Callback functions can be registered and unregistered at any time." msgstr "回呼函式可以隨時被註冊和取消註冊。" -#: ../../library/sys.monitoring.rst:321 +#: ../../library/sys.monitoring.rst:323 msgid "" -"Registering or unregistering a callback function will generate a :func:`sys." -"audit` event." +"Registering or unregistering a callback function will generate " +"a :func:`sys.audit` event." msgstr "註冊或取消註冊回呼函式將產生 :func:`sys.audit` 事件。" -#: ../../library/sys.monitoring.rst:325 +#: ../../library/sys.monitoring.rst:327 msgid "Callback function arguments" msgstr "回呼函式引數" -#: ../../library/sys.monitoring.rst:329 +#: ../../library/sys.monitoring.rst:331 msgid "" "A special value that is passed to a callback function to indicate that there " "are no arguments to the call." msgstr "傳遞給回呼函式的特殊值,表示該呼叫沒有引數。" -#: ../../library/sys.monitoring.rst:332 +#: ../../library/sys.monitoring.rst:334 msgid "" "When an active event occurs, the registered callback function is called. " "Different events will provide the callback function with different " @@ -581,19 +582,19 @@ msgstr "" "當有效事件發生時,已註冊的回呼函式會被呼叫。不同的事件會為回呼函式提供不同的" "引數,如下所示:" -#: ../../library/sys.monitoring.rst:335 +#: ../../library/sys.monitoring.rst:337 msgid ":monitoring-event:`PY_START` and :monitoring-event:`PY_RESUME`::" msgstr ":monitoring-event:`PY_START` 和 :monitoring-event:`PY_RESUME`: ::" -#: ../../library/sys.monitoring.rst:337 ../../library/sys.monitoring.rst:368 +#: ../../library/sys.monitoring.rst:339 ../../library/sys.monitoring.rst:370 msgid "func(code: CodeType, instruction_offset: int) -> DISABLE | Any" msgstr "func(code: CodeType, instruction_offset: int) -> DISABLE | Any" -#: ../../library/sys.monitoring.rst:339 +#: ../../library/sys.monitoring.rst:341 msgid ":monitoring-event:`PY_RETURN` and :monitoring-event:`PY_YIELD`::" msgstr ":monitoring-event:`PY_RETURN` 和 :monitoring-event:`PY_YIELD`: ::" -#: ../../library/sys.monitoring.rst:341 +#: ../../library/sys.monitoring.rst:343 msgid "" "func(code: CodeType, instruction_offset: int, retval: object) -> DISABLE | " "Any" @@ -601,15 +602,15 @@ msgstr "" "func(code: CodeType, instruction_offset: int, retval: object) -> DISABLE | " "Any" -#: ../../library/sys.monitoring.rst:343 +#: ../../library/sys.monitoring.rst:345 msgid "" -":monitoring-event:`CALL`, :monitoring-event:`C_RAISE` and :monitoring-event:" -"`C_RETURN`::" +":monitoring-event:`CALL`, :monitoring-event:`C_RAISE` and :monitoring-" +"event:`C_RETURN`::" msgstr "" -":monitoring-event:`CALL`、:monitoring-event:`C_RAISE` 和 :monitoring-event:" -"`C_RETURN`: ::" +":monitoring-event:`CALL`、:monitoring-event:`C_RAISE` 和 :monitoring-" +"event:`C_RETURN`: ::" -#: ../../library/sys.monitoring.rst:345 +#: ../../library/sys.monitoring.rst:347 msgid "" "func(code: CodeType, instruction_offset: int, callable: object, arg0: object " "| MISSING) -> DISABLE | Any" @@ -617,22 +618,22 @@ msgstr "" "func(code: CodeType, instruction_offset: int, callable: object, arg0: object " "| MISSING) -> DISABLE | Any" -#: ../../library/sys.monitoring.rst:347 +#: ../../library/sys.monitoring.rst:349 msgid "" "If there are no arguments, *arg0* is set to :data:`sys.monitoring.MISSING`." msgstr "如果沒有引數,*arg0* 將被設定為 :data:`sys.monitoring.MISSING`。" -#: ../../library/sys.monitoring.rst:349 +#: ../../library/sys.monitoring.rst:351 msgid "" -":monitoring-event:`RAISE`, :monitoring-event:`RERAISE`, :monitoring-event:" -"`EXCEPTION_HANDLED`, :monitoring-event:`PY_UNWIND`, :monitoring-event:" -"`PY_THROW` and :monitoring-event:`STOP_ITERATION`::" +":monitoring-event:`RAISE`, :monitoring-event:`RERAISE`, :monitoring-" +"event:`EXCEPTION_HANDLED`, :monitoring-event:`PY_UNWIND`, :monitoring-" +"event:`PY_THROW` and :monitoring-event:`STOP_ITERATION`::" msgstr "" -":monitoring-event:`RAISE`、:monitoring-event:`RERAISE`、:monitoring-event:" -"`EXCEPTION_HANDLED`、:monitoring-event:`PY_UNWIND`、:monitoring-event:" -"`PY_THROW` 和 :monitoring-event:`STOP_ITERATION`: ::" +":monitoring-event:`RAISE`、:monitoring-event:`RERAISE`、:monitoring-" +"event:`EXCEPTION_HANDLED`、:monitoring-event:`PY_UNWIND`、:monitoring-" +"event:`PY_THROW` 和 :monitoring-event:`STOP_ITERATION`: ::" -#: ../../library/sys.monitoring.rst:352 +#: ../../library/sys.monitoring.rst:354 msgid "" "func(code: CodeType, instruction_offset: int, exception: BaseException) -> " "DISABLE | Any" @@ -640,19 +641,19 @@ msgstr "" "func(code: CodeType, instruction_offset: int, exception: BaseException) -> " "DISABLE | Any" -#: ../../library/sys.monitoring.rst:354 +#: ../../library/sys.monitoring.rst:356 msgid ":monitoring-event:`LINE`::" msgstr ":monitoring-event:`LINE`: ::" -#: ../../library/sys.monitoring.rst:356 +#: ../../library/sys.monitoring.rst:358 msgid "func(code: CodeType, line_number: int) -> DISABLE | Any" msgstr "func(code: CodeType, line_number: int) -> DISABLE | Any" -#: ../../library/sys.monitoring.rst:358 +#: ../../library/sys.monitoring.rst:360 msgid ":monitoring-event:`BRANCH` and :monitoring-event:`JUMP`::" msgstr ":monitoring-event:`BRANCH` 和 :monitoring-event:`JUMP`: ::" -#: ../../library/sys.monitoring.rst:360 +#: ../../library/sys.monitoring.rst:362 msgid "" "func(code: CodeType, instruction_offset: int, destination_offset: int) -> " "DISABLE | Any" @@ -660,7 +661,7 @@ msgstr "" "func(code: CodeType, instruction_offset: int, destination_offset: int) -> " "DISABLE | Any" -#: ../../library/sys.monitoring.rst:362 +#: ../../library/sys.monitoring.rst:364 msgid "" "Note that the *destination_offset* is where the code will next execute. For " "an untaken branch this will be the offset of the instruction following the " @@ -669,6 +670,6 @@ msgstr "" "請注意,*destination_offset* 是程式碼接下來要執行的地方。對於未採用的分支,這" "將是該分支之後的指令的偏移量。" -#: ../../library/sys.monitoring.rst:366 +#: ../../library/sys.monitoring.rst:368 msgid ":monitoring-event:`INSTRUCTION`::" msgstr ":monitoring-event:`INSTRUCTION`: ::" diff --git a/library/sys.po b/library/sys.po index 99a0ab456f..b4321d66db 100644 --- a/library/sys.po +++ b/library/sys.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-18 00:13+0000\n" +"POT-Creation-Date: 2025-03-27 00:14+0000\n" "PO-Revision-Date: 2023-04-26 02:54+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,10 +45,10 @@ msgstr "" #: ../../library/sys.rst:25 ../../library/sys.rst:299 ../../library/sys.rst:369 #: ../../library/sys.rst:760 ../../library/sys.rst:778 -#: ../../library/sys.rst:1020 ../../library/sys.rst:1519 -#: ../../library/sys.rst:1760 ../../library/sys.rst:1775 -#: ../../library/sys.rst:1783 ../../library/sys.rst:1799 -#: ../../library/sys.rst:2043 +#: ../../library/sys.rst:1020 ../../library/sys.rst:1522 +#: ../../library/sys.rst:1763 ../../library/sys.rst:1778 +#: ../../library/sys.rst:1786 ../../library/sys.rst:1802 +#: ../../library/sys.rst:2046 msgid "Availability" msgstr "" @@ -996,8 +996,8 @@ msgstr "" #: ../../library/sys.rst:767 msgid "" -"Return the name of the current default string encoding used by the Unicode " -"implementation." +"Return ``'utf-8'``. This is the name of the default string encoding, used in " +"methods like :meth:`str.encode`." msgstr "" #: ../../library/sys.rst:773 @@ -1134,7 +1134,7 @@ msgstr "" #: ../../library/sys.rst:886 msgid "" -"Return the interpreter's \"thread switch interval\"; see :func:" +"Return the interpreter's \"thread switch interval\" in seconds; see :func:" "`setswitchinterval`." msgstr "" @@ -1325,7 +1325,7 @@ msgstr "" msgid "See :pep:`525` for more details." msgstr "更多細節請見 :pep:`525`。" -#: ../../library/sys.rst:1043 ../../library/sys.rst:1731 +#: ../../library/sys.rst:1043 ../../library/sys.rst:1734 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.)" @@ -1337,7 +1337,7 @@ msgid "" "`set_coroutine_origin_tracking_depth`." msgstr "" -#: ../../library/sys.rst:1055 ../../library/sys.rst:1752 +#: ../../library/sys.rst:1055 ../../library/sys.rst:1755 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.) Use it only for debugging purposes." @@ -1547,17 +1547,21 @@ msgid "" "is disabled." msgstr "" -#: ../../library/sys.rst:1241 +#: ../../library/sys.rst:1240 ../../library/sys.rst:1272 +msgid "It is not guaranteed to exist in all implementations of Python." +msgstr "" + +#: ../../library/sys.rst:1244 msgid "" "Return :const:`True` if the main Python interpreter is :term:`shutting down " "`. Return :const:`False` otherwise." msgstr "" -#: ../../library/sys.rst:1244 +#: ../../library/sys.rst:1247 msgid "See also the :exc:`PythonFinalizationError` exception." msgstr "" -#: ../../library/sys.rst:1250 +#: ../../library/sys.rst:1253 msgid "" "This variable is not always defined; it is set to the exception instance " "when an exception is not handled and the interpreter prints an error message " @@ -1568,44 +1572,40 @@ msgid "" "more information.)" msgstr "" -#: ../../library/sys.rst:1262 +#: ../../library/sys.rst:1265 msgid "" "Return :const:`True` if the given string is \"interned\", :const:`False` " "otherwise." msgstr "" -#: ../../library/sys.rst:1269 -msgid "It is not guaranteed to exist in all implementations of Python." -msgstr "" - -#: ../../library/sys.rst:1276 +#: ../../library/sys.rst:1279 msgid "" "These three variables are deprecated; use :data:`sys.last_exc` instead. They " "hold the legacy representation of ``sys.last_exc``, as returned from :func:" "`exc_info` above." msgstr "" -#: ../../library/sys.rst:1282 +#: ../../library/sys.rst:1285 msgid "" "An integer giving the maximum value a variable of type :c:type:`Py_ssize_t` " "can take. It's usually ``2**31 - 1`` on a 32-bit platform and ``2**63 - 1`` " "on a 64-bit platform." msgstr "" -#: ../../library/sys.rst:1289 +#: ../../library/sys.rst:1292 msgid "" "An integer giving the value of the largest Unicode code point, i.e. " "``1114111`` (``0x10FFFF`` in hexadecimal)." msgstr "" -#: ../../library/sys.rst:1292 +#: ../../library/sys.rst:1295 msgid "" "Before :pep:`393`, ``sys.maxunicode`` used to be either ``0xFFFF`` or " "``0x10FFFF``, depending on the configuration option that specified whether " "Unicode characters were stored as UCS-2 or UCS-4." msgstr "" -#: ../../library/sys.rst:1300 +#: ../../library/sys.rst:1303 msgid "" "A list of :term:`meta path finder` objects that have their :meth:`~importlib." "abc.MetaPathFinder.find_spec` methods called to see if one of the objects " @@ -1618,40 +1618,40 @@ msgid "" "``None`` if the module cannot be found." msgstr "" -#: ../../library/sys.rst:1313 +#: ../../library/sys.rst:1316 msgid ":class:`importlib.abc.MetaPathFinder`" msgstr ":class:`importlib.abc.MetaPathFinder`" -#: ../../library/sys.rst:1314 +#: ../../library/sys.rst:1317 msgid "" "The abstract base class defining the interface of finder objects on :data:" "`meta_path`." msgstr "" -#: ../../library/sys.rst:1316 +#: ../../library/sys.rst:1319 msgid ":class:`importlib.machinery.ModuleSpec`" msgstr ":class:`importlib.machinery.ModuleSpec`" -#: ../../library/sys.rst:1317 +#: ../../library/sys.rst:1320 msgid "" "The concrete class which :meth:`~importlib.abc.MetaPathFinder.find_spec` " "should return instances of." msgstr "" -#: ../../library/sys.rst:1323 +#: ../../library/sys.rst:1326 msgid "" ":term:`Module specs ` were introduced in Python 3.4, by :pep:" "`451`." msgstr "" -#: ../../library/sys.rst:1328 +#: ../../library/sys.rst:1331 msgid "" "Removed the fallback that looked for a :meth:`!find_module` method if a :" "data:`meta_path` entry didn't have a :meth:`~importlib.abc.MetaPathFinder." "find_spec` method." msgstr "" -#: ../../library/sys.rst:1334 +#: ../../library/sys.rst:1337 msgid "" "This is a dictionary that maps module names to modules which have already " "been loaded. This can be manipulated to force reloading of modules and " @@ -1663,13 +1663,13 @@ msgid "" "other threads." msgstr "" -#: ../../library/sys.rst:1346 +#: ../../library/sys.rst:1349 msgid "" "The list of the original command line arguments passed to the Python " "executable." msgstr "" -#: ../../library/sys.rst:1349 +#: ../../library/sys.rst:1352 msgid "" "The elements of :data:`sys.orig_argv` are the arguments to the Python " "interpreter, while the elements of :data:`sys.argv` are the arguments to the " @@ -1677,68 +1677,68 @@ msgid "" "in :data:`sys.orig_argv` and missing from :data:`sys.argv`." msgstr "" -#: ../../library/sys.rst:1361 +#: ../../library/sys.rst:1364 msgid "" "A list of strings that specifies the search path for modules. Initialized " "from the environment variable :envvar:`PYTHONPATH`, plus an installation-" "dependent default." msgstr "" -#: ../../library/sys.rst:1365 +#: ../../library/sys.rst:1368 msgid "" "By default, as initialized upon program startup, a potentially unsafe path " "is prepended to :data:`sys.path` (*before* the entries inserted as a result " "of :envvar:`PYTHONPATH`):" msgstr "" -#: ../../library/sys.rst:1369 +#: ../../library/sys.rst:1372 msgid "" "``python -m module`` command line: prepend the current working directory." msgstr "" -#: ../../library/sys.rst:1371 +#: ../../library/sys.rst:1374 msgid "" "``python script.py`` command line: prepend the script's directory. If it's a " "symbolic link, resolve symbolic links." msgstr "" -#: ../../library/sys.rst:1373 +#: ../../library/sys.rst:1376 msgid "" "``python -c code`` and ``python`` (REPL) command lines: prepend an empty " "string, which means the current working directory." msgstr "" -#: ../../library/sys.rst:1376 +#: ../../library/sys.rst:1379 msgid "" "To not prepend this potentially unsafe path, use the :option:`-P` command " "line option or the :envvar:`PYTHONSAFEPATH` environment variable." msgstr "" -#: ../../library/sys.rst:1379 +#: ../../library/sys.rst:1382 msgid "" "A program is free to modify this list for its own purposes. Only strings " "should be added to :data:`sys.path`; all other data types are ignored during " "import." msgstr "" -#: ../../library/sys.rst:1385 +#: ../../library/sys.rst:1388 msgid "" "Module :mod:`site` This describes how to use .pth files to extend :data:`sys." "path`." msgstr "" -#: ../../library/sys.rst:1390 +#: ../../library/sys.rst:1393 msgid "" "A list of callables that take a path argument to try to create a :term:" "`finder` for the path. If a finder can be created, it is to be returned by " "the callable, else raise :exc:`ImportError`." msgstr "" -#: ../../library/sys.rst:1394 ../../library/sys.rst:1405 +#: ../../library/sys.rst:1397 ../../library/sys.rst:1408 msgid "Originally specified in :pep:`302`." msgstr "" -#: ../../library/sys.rst:1399 +#: ../../library/sys.rst:1402 msgid "" "A dictionary acting as a cache for :term:`finder` objects. The keys are " "paths that have been passed to :data:`sys.path_hooks` and the values are the " @@ -1746,91 +1746,91 @@ msgid "" "is found on :data:`sys.path_hooks` then ``None`` is stored." msgstr "" -#: ../../library/sys.rst:1410 +#: ../../library/sys.rst:1413 msgid "A string containing a platform identifier. Known values are:" msgstr "" -#: ../../library/sys.rst:1413 +#: ../../library/sys.rst:1416 msgid "System" msgstr "" -#: ../../library/sys.rst:1413 +#: ../../library/sys.rst:1416 msgid "``platform`` value" msgstr "" -#: ../../library/sys.rst:1415 +#: ../../library/sys.rst:1418 msgid "AIX" msgstr "AIX" -#: ../../library/sys.rst:1415 +#: ../../library/sys.rst:1418 msgid "``'aix'``" msgstr "``'aix'``" -#: ../../library/sys.rst:1416 +#: ../../library/sys.rst:1419 msgid "Android" msgstr "Android" -#: ../../library/sys.rst:1416 +#: ../../library/sys.rst:1419 msgid "``'android'``" msgstr "``'android'``" -#: ../../library/sys.rst:1417 +#: ../../library/sys.rst:1420 msgid "Emscripten" msgstr "Emscripten" -#: ../../library/sys.rst:1417 +#: ../../library/sys.rst:1420 msgid "``'emscripten'``" msgstr "``'emscripten'``" -#: ../../library/sys.rst:1418 +#: ../../library/sys.rst:1421 msgid "iOS" msgstr "iOS" -#: ../../library/sys.rst:1418 +#: ../../library/sys.rst:1421 msgid "``'ios'``" msgstr "``'ios'``" -#: ../../library/sys.rst:1419 +#: ../../library/sys.rst:1422 msgid "Linux" msgstr "Linux" -#: ../../library/sys.rst:1419 +#: ../../library/sys.rst:1422 msgid "``'linux'``" msgstr "``'linux'``" -#: ../../library/sys.rst:1420 +#: ../../library/sys.rst:1423 msgid "macOS" msgstr "macOS" -#: ../../library/sys.rst:1420 +#: ../../library/sys.rst:1423 msgid "``'darwin'``" msgstr "``'darwin'``" -#: ../../library/sys.rst:1421 +#: ../../library/sys.rst:1424 msgid "Windows" msgstr "Windows" -#: ../../library/sys.rst:1421 +#: ../../library/sys.rst:1424 msgid "``'win32'``" msgstr "``'win32'``" -#: ../../library/sys.rst:1422 +#: ../../library/sys.rst:1425 msgid "Windows/Cygwin" msgstr "Windows/Cygwin" -#: ../../library/sys.rst:1422 +#: ../../library/sys.rst:1425 msgid "``'cygwin'``" msgstr "``'cygwin'``" -#: ../../library/sys.rst:1423 +#: ../../library/sys.rst:1426 msgid "WASI" msgstr "WASI" -#: ../../library/sys.rst:1423 +#: ../../library/sys.rst:1426 msgid "``'wasi'``" msgstr "``'wasi'``" -#: ../../library/sys.rst:1426 +#: ../../library/sys.rst:1429 msgid "" "On Unix systems not listed in the table, the value is the lowercased OS name " "as returned by ``uname -s``, with the first part of the version as returned " @@ -1839,81 +1839,81 @@ msgid "" "version, it is therefore recommended to use the following idiom::" msgstr "" -#: ../../library/sys.rst:1432 +#: ../../library/sys.rst:1435 msgid "" "if sys.platform.startswith('freebsd'):\n" " # FreeBSD-specific code here..." msgstr "" -#: ../../library/sys.rst:1435 +#: ../../library/sys.rst:1438 msgid "" "On Linux, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``." msgstr "" -#: ../../library/sys.rst:1439 +#: ../../library/sys.rst:1442 msgid "" "On AIX, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``." msgstr "" -#: ../../library/sys.rst:1443 +#: ../../library/sys.rst:1446 msgid "" "On Android, :data:`sys.platform` now returns ``'android'`` rather than " "``'linux'``." msgstr "" -#: ../../library/sys.rst:1449 +#: ../../library/sys.rst:1452 msgid "" ":data:`os.name` has a coarser granularity. :func:`os.uname` gives system-" "dependent version information." msgstr "" -#: ../../library/sys.rst:1452 +#: ../../library/sys.rst:1455 msgid "" "The :mod:`platform` module provides detailed checks for the system's " "identity." msgstr "" -#: ../../library/sys.rst:1458 +#: ../../library/sys.rst:1461 msgid "" "Name of the platform-specific library directory. It is used to build the " "path of standard library and the paths of installed extension modules." msgstr "" -#: ../../library/sys.rst:1461 +#: ../../library/sys.rst:1464 msgid "" "It is equal to ``\"lib\"`` on most platforms. On Fedora and SuSE, it is " "equal to ``\"lib64\"`` on 64-bit platforms which gives the following ``sys." "path`` paths (where ``X.Y`` is the Python ``major.minor`` version):" msgstr "" -#: ../../library/sys.rst:1465 +#: ../../library/sys.rst:1468 msgid "" "``/usr/lib64/pythonX.Y/``: Standard library (like ``os.py`` of the :mod:`os` " "module)" msgstr "" -#: ../../library/sys.rst:1467 +#: ../../library/sys.rst:1470 msgid "" "``/usr/lib64/pythonX.Y/lib-dynload/``: C extension modules of the standard " "library (like the :mod:`errno` module, the exact filename is platform " "specific)" msgstr "" -#: ../../library/sys.rst:1470 +#: ../../library/sys.rst:1473 msgid "" "``/usr/lib/pythonX.Y/site-packages/`` (always use ``lib``, not :data:`sys." "platlibdir`): Third-party modules" msgstr "" -#: ../../library/sys.rst:1472 +#: ../../library/sys.rst:1475 msgid "" "``/usr/lib64/pythonX.Y/site-packages/``: C extension modules of third-party " "packages" msgstr "" -#: ../../library/sys.rst:1480 +#: ../../library/sys.rst:1483 msgid "" "A string giving the site-specific directory prefix where the platform " "independent Python files are installed; on Unix, the default is :file:`/usr/" @@ -1922,14 +1922,14 @@ msgid "" "derived paths." msgstr "" -#: ../../library/sys.rst:1486 +#: ../../library/sys.rst:1489 msgid "" "If a :ref:`virtual environment ` is in effect, this value will be " "changed in ``site.py`` to point to the virtual environment. The value for " "the Python installation will still be available, via :data:`base_prefix`." msgstr "" -#: ../../library/sys.rst:1501 +#: ../../library/sys.rst:1504 msgid "" "Strings specifying the primary and secondary prompt of the interpreter. " "These are only defined if the interpreter is in interactive mode. Their " @@ -1939,7 +1939,7 @@ msgid "" "used to implement a dynamic prompt." msgstr "" -#: ../../library/sys.rst:1511 +#: ../../library/sys.rst:1514 msgid "" "Set the flags used by the interpreter for :c:func:`dlopen` calls, such as " "when the interpreter loads extension modules. Among other things, this will " @@ -1950,14 +1950,14 @@ msgid "" "g. :const:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:1523 +#: ../../library/sys.rst:1526 msgid "" "Set the :ref:`integer string conversion length limitation " "` used by this interpreter. See also :func:" "`get_int_max_str_digits`." msgstr "" -#: ../../library/sys.rst:1535 +#: ../../library/sys.rst:1538 msgid "" "Set the system's profile function, which allows you to implement a Python " "source code profiler in Python. See chapter :ref:`profile` for more " @@ -1972,14 +1972,14 @@ msgid "" "in the profile function will cause itself unset." msgstr "" -#: ../../library/sys.rst:1547 +#: ../../library/sys.rst:1550 msgid "" "The same tracing mechanism is used for :func:`!setprofile` as :func:" "`settrace`. To trace calls with :func:`!setprofile` inside a tracing " "function (e.g. in a debugger breakpoint), see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1551 +#: ../../library/sys.rst:1554 msgid "" "Profile functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -1987,71 +1987,71 @@ msgid "" "depends on the event type." msgstr "" -#: ../../library/sys.rst:1556 ../../library/sys.rst:1643 +#: ../../library/sys.rst:1559 ../../library/sys.rst:1646 msgid "The events have the following meaning:" msgstr "" -#: ../../library/sys.rst:1558 ../../library/sys.rst:1645 +#: ../../library/sys.rst:1561 ../../library/sys.rst:1648 msgid "``'call'``" msgstr "``'call'``" -#: ../../library/sys.rst:1559 +#: ../../library/sys.rst:1562 msgid "" "A function is called (or some other code block entered). The profile " "function is called; *arg* is ``None``." msgstr "" -#: ../../library/sys.rst:1562 ../../library/sys.rst:1660 +#: ../../library/sys.rst:1565 ../../library/sys.rst:1663 msgid "``'return'``" msgstr "``'return'``" -#: ../../library/sys.rst:1563 +#: ../../library/sys.rst:1566 msgid "" "A function (or other code block) is about to return. The profile function " "is called; *arg* is the value that will be returned, or ``None`` if the " "event is caused by an exception being raised." msgstr "" -#: ../../library/sys.rst:1567 +#: ../../library/sys.rst:1570 msgid "``'c_call'``" msgstr "``'c_call'``" -#: ../../library/sys.rst:1568 +#: ../../library/sys.rst:1571 msgid "" "A C function is about to be called. This may be an extension function or a " "built-in. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1571 +#: ../../library/sys.rst:1574 msgid "``'c_return'``" msgstr "``'c_return'``" -#: ../../library/sys.rst:1572 +#: ../../library/sys.rst:1575 msgid "A C function has returned. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1574 +#: ../../library/sys.rst:1577 msgid "``'c_exception'``" msgstr "``'c_exception'``" -#: ../../library/sys.rst:1575 +#: ../../library/sys.rst:1578 msgid "A C function has raised an exception. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1577 +#: ../../library/sys.rst:1580 msgid "" "Raises an :ref:`auditing event ` ``sys.setprofile`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.setprofile``。" -#: ../../library/sys.rst:1582 +#: ../../library/sys.rst:1585 msgid "" "Set the maximum depth of the Python interpreter stack to *limit*. This " "limit prevents infinite recursion from causing an overflow of the C stack " "and crashing Python." msgstr "" -#: ../../library/sys.rst:1586 +#: ../../library/sys.rst:1589 msgid "" "The highest possible limit is platform-dependent. A user may need to set " "the limit higher when they have a program that requires deep recursion and a " @@ -2059,19 +2059,19 @@ msgid "" "because a too-high limit can lead to a crash." msgstr "" -#: ../../library/sys.rst:1591 +#: ../../library/sys.rst:1594 msgid "" "If the new limit is too low at the current recursion depth, a :exc:" "`RecursionError` exception is raised." msgstr "" -#: ../../library/sys.rst:1594 +#: ../../library/sys.rst:1597 msgid "" "A :exc:`RecursionError` exception is now raised if the new limit is too low " "at the current recursion depth." msgstr "" -#: ../../library/sys.rst:1601 +#: ../../library/sys.rst:1604 msgid "" "Set the interpreter's thread switch interval (in seconds). This floating-" "point value determines the ideal duration of the \"timeslices\" allocated to " @@ -2082,7 +2082,7 @@ msgid "" "scheduler." msgstr "" -#: ../../library/sys.rst:1618 +#: ../../library/sys.rst:1621 msgid "" "Set the system's trace function, which allows you to implement a Python " "source code debugger in Python. The function is thread-specific; for a " @@ -2091,7 +2091,7 @@ msgid "" "`threading.settrace`." msgstr "" -#: ../../library/sys.rst:1623 +#: ../../library/sys.rst:1626 msgid "" "Trace functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -2099,7 +2099,7 @@ msgid "" "the event type." msgstr "" -#: ../../library/sys.rst:1628 +#: ../../library/sys.rst:1631 msgid "" "The trace function is invoked (with *event* set to ``'call'``) whenever a " "new local scope is entered; it should return a reference to a local trace " @@ -2107,36 +2107,36 @@ msgid "" "traced." msgstr "" -#: ../../library/sys.rst:1633 +#: ../../library/sys.rst:1636 msgid "" "The local trace function should return a reference to itself, or to another " "function which would then be used as the local trace function for the scope." msgstr "" -#: ../../library/sys.rst:1636 +#: ../../library/sys.rst:1639 msgid "" "If there is any error occurred in the trace function, it will be unset, just " "like ``settrace(None)`` is called." msgstr "" -#: ../../library/sys.rst:1640 +#: ../../library/sys.rst:1643 msgid "" "Tracing is disabled while calling the trace function (e.g. a function set " "by :func:`!settrace`). For recursive tracing see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1646 +#: ../../library/sys.rst:1649 msgid "" "A function is called (or some other code block entered). The global trace " "function is called; *arg* is ``None``; the return value specifies the local " "trace function." msgstr "" -#: ../../library/sys.rst:1650 +#: ../../library/sys.rst:1653 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/sys.rst:1651 +#: ../../library/sys.rst:1654 msgid "" "The interpreter is about to execute a new line of code or re-execute the " "condition of a loop. The local trace function is called; *arg* is ``None``; " @@ -2146,7 +2146,7 @@ msgid "" "to :const:`False` on that :ref:`frame `." msgstr "" -#: ../../library/sys.rst:1661 +#: ../../library/sys.rst:1664 msgid "" "A function (or other code block) is about to return. The local trace " "function is called; *arg* is the value that will be returned, or ``None`` if " @@ -2154,22 +2154,22 @@ msgid "" "return value is ignored." msgstr "" -#: ../../library/sys.rst:1666 +#: ../../library/sys.rst:1669 msgid "``'exception'``" msgstr "``'exception'``" -#: ../../library/sys.rst:1667 +#: ../../library/sys.rst:1670 msgid "" "An exception has occurred. The local trace function is called; *arg* is a " "tuple ``(exception, value, traceback)``; the return value specifies the new " "local trace function." msgstr "" -#: ../../library/sys.rst:1671 +#: ../../library/sys.rst:1674 msgid "``'opcode'``" msgstr "``'opcode'``" -#: ../../library/sys.rst:1672 +#: ../../library/sys.rst:1675 msgid "" "The interpreter is about to execute a new opcode (see :mod:`dis` for opcode " "details). The local trace function is called; *arg* is ``None``; the return " @@ -2179,13 +2179,13 @@ msgid "" "objects>`." msgstr "" -#: ../../library/sys.rst:1679 +#: ../../library/sys.rst:1682 msgid "" "Note that as an exception is propagated down the chain of callers, an " "``'exception'`` event is generated at each level." msgstr "" -#: ../../library/sys.rst:1682 +#: ../../library/sys.rst:1685 msgid "" "For more fine-grained usage, it's possible to set a trace function by " "assigning ``frame.f_trace = tracefunc`` explicitly, rather than relying on " @@ -2199,17 +2199,17 @@ msgid "" "on each frame)." msgstr "" -#: ../../library/sys.rst:1693 +#: ../../library/sys.rst:1696 msgid "For more information on code and frame objects, refer to :ref:`types`." msgstr "" -#: ../../library/sys.rst:1695 +#: ../../library/sys.rst:1698 msgid "" "Raises an :ref:`auditing event ` ``sys.settrace`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.settrace``。" -#: ../../library/sys.rst:1699 +#: ../../library/sys.rst:1702 msgid "" "The :func:`settrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -2217,13 +2217,13 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:1706 +#: ../../library/sys.rst:1709 msgid "" "``'opcode'`` event type added; :attr:`~frame.f_trace_lines` and :attr:" "`~frame.f_trace_opcodes` attributes added to frames" msgstr "" -#: ../../library/sys.rst:1711 +#: ../../library/sys.rst:1714 msgid "" "Accepts two optional keyword arguments which are callables that accept an :" "term:`asynchronous generator iterator` as an argument. The *firstiter* " @@ -2232,7 +2232,7 @@ msgid "" "about to be garbage collected." msgstr "" -#: ../../library/sys.rst:1717 +#: ../../library/sys.rst:1720 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_firstiter`` with no arguments." @@ -2240,7 +2240,7 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." "set_asyncgen_hooks_firstiter``。" -#: ../../library/sys.rst:1719 +#: ../../library/sys.rst:1722 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_finalizer`` with no arguments." @@ -2248,20 +2248,20 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." "set_asyncgen_hooks_finalizer``。" -#: ../../library/sys.rst:1721 +#: ../../library/sys.rst:1724 msgid "" "Two auditing events are raised because the underlying API consists of two " "calls, each of which must raise its own event." msgstr "" -#: ../../library/sys.rst:1724 +#: ../../library/sys.rst:1727 msgid "" "See :pep:`525` for more details, and for a reference example of a " "*finalizer* method see the implementation of ``asyncio.Loop." "shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`" msgstr "" -#: ../../library/sys.rst:1736 +#: ../../library/sys.rst:1739 msgid "" "Allows enabling or disabling coroutine origin tracking. When enabled, the " "``cr_origin`` attribute on coroutine objects will contain a tuple of " @@ -2270,111 +2270,111 @@ msgid "" "disabled, ``cr_origin`` will be ``None``." msgstr "" -#: ../../library/sys.rst:1743 +#: ../../library/sys.rst:1746 msgid "" "To enable, pass a *depth* value greater than zero; this sets the number of " "frames whose information will be captured. To disable, pass set *depth* to " "zero." msgstr "" -#: ../../library/sys.rst:1747 +#: ../../library/sys.rst:1750 msgid "This setting is thread-specific." msgstr "" -#: ../../library/sys.rst:1757 +#: ../../library/sys.rst:1760 msgid "" "Activate the stack profiler trampoline *backend*. The only supported backend " "is ``\"perf\"``." msgstr "" -#: ../../library/sys.rst:1766 +#: ../../library/sys.rst:1769 msgid ":ref:`perf_profiling`" msgstr ":ref:`perf_profiling`" -#: ../../library/sys.rst:1767 +#: ../../library/sys.rst:1770 msgid "https://perf.wiki.kernel.org/" msgstr "https://perf.wiki.kernel.org/" -#: ../../library/sys.rst:1771 +#: ../../library/sys.rst:1774 msgid "Deactivate the current stack profiler trampoline backend." msgstr "" -#: ../../library/sys.rst:1773 +#: ../../library/sys.rst:1776 msgid "If no stack profiler is activated, this function has no effect." msgstr "" -#: ../../library/sys.rst:1781 +#: ../../library/sys.rst:1784 msgid "Return ``True`` if a stack profiler trampoline is active." msgstr "" -#: ../../library/sys.rst:1789 +#: ../../library/sys.rst:1792 msgid "" "Changes the :term:`filesystem encoding and error handler` to 'mbcs' and " "'replace' respectively, for consistency with versions of Python prior to 3.6." msgstr "" -#: ../../library/sys.rst:1793 +#: ../../library/sys.rst:1796 msgid "" "This is equivalent to defining the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable before launching Python." msgstr "" -#: ../../library/sys.rst:1796 +#: ../../library/sys.rst:1799 msgid "" "See also :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors`." msgstr "" -#: ../../library/sys.rst:1802 +#: ../../library/sys.rst:1805 msgid "" "Changing the filesystem encoding after Python startup is risky because the " "old fsencoding or paths encoded by the old fsencoding may be cached " "somewhere. Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." msgstr "" -#: ../../library/sys.rst:1806 +#: ../../library/sys.rst:1809 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`。" -#: ../../library/sys.rst:1809 +#: ../../library/sys.rst:1812 msgid "Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." msgstr "" -#: ../../library/sys.rst:1816 +#: ../../library/sys.rst:1819 msgid "" ":term:`File objects ` used by the interpreter for standard " "input, output and errors:" msgstr "" -#: ../../library/sys.rst:1819 +#: ../../library/sys.rst:1822 msgid "" "``stdin`` is used for all interactive input (including calls to :func:" "`input`);" msgstr "" -#: ../../library/sys.rst:1821 +#: ../../library/sys.rst:1824 msgid "" "``stdout`` is used for the output of :func:`print` and :term:`expression` " "statements and for the prompts of :func:`input`;" msgstr "" -#: ../../library/sys.rst:1823 +#: ../../library/sys.rst:1826 msgid "The interpreter's own prompts and its error messages go to ``stderr``." msgstr "" -#: ../../library/sys.rst:1825 +#: ../../library/sys.rst:1828 msgid "" "These streams are regular :term:`text files ` like those returned " "by the :func:`open` function. Their parameters are chosen as follows:" msgstr "" -#: ../../library/sys.rst:1829 +#: ../../library/sys.rst:1832 msgid "" "The encoding and error handling are is initialized from :c:member:`PyConfig." "stdio_encoding` and :c:member:`PyConfig.stdio_errors`." msgstr "" -#: ../../library/sys.rst:1832 +#: ../../library/sys.rst:1835 msgid "" "On Windows, UTF-8 is used for the console device. Non-character devices " "such as disk files and pipes use the system locale encoding (i.e. the ANSI " @@ -2385,14 +2385,14 @@ msgid "" "initially attached to a console." msgstr "" -#: ../../library/sys.rst:1841 +#: ../../library/sys.rst:1844 msgid "" "The special behaviour of the console can be overridden by setting the " "environment variable PYTHONLEGACYWINDOWSSTDIO before starting Python. In " "that case, the console codepages are used as for any other character device." msgstr "" -#: ../../library/sys.rst:1846 +#: ../../library/sys.rst:1849 msgid "" "Under all platforms, you can override the character encoding by setting the :" "envvar:`PYTHONIOENCODING` environment variable before starting Python or by " @@ -2401,7 +2401,7 @@ msgid "" "only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set." msgstr "" -#: ../../library/sys.rst:1853 +#: ../../library/sys.rst:1856 msgid "" "When interactive, the ``stdout`` stream is line-buffered. Otherwise, it is " "block-buffered like regular text files. The ``stderr`` stream is line-" @@ -2410,19 +2410,19 @@ msgid "" "`PYTHONUNBUFFERED` environment variable." msgstr "" -#: ../../library/sys.rst:1859 +#: ../../library/sys.rst:1862 msgid "" "Non-interactive ``stderr`` is now line-buffered instead of fully buffered." msgstr "" -#: ../../library/sys.rst:1865 +#: ../../library/sys.rst:1868 msgid "" "To write or read binary data from/to the standard streams, use the " "underlying binary :data:`~io.TextIOBase.buffer` object. For example, to " "write bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``." msgstr "" -#: ../../library/sys.rst:1869 +#: ../../library/sys.rst:1872 msgid "" "However, if you are writing a library (and do not control in which context " "its code will be executed), be aware that the standard streams may be " @@ -2430,7 +2430,7 @@ msgid "" "support the :attr:`!buffer` attribute." msgstr "" -#: ../../library/sys.rst:1879 +#: ../../library/sys.rst:1882 msgid "" "These objects contain the original values of ``stdin``, ``stderr`` and " "``stdout`` at the start of the program. They are used during finalization, " @@ -2438,7 +2438,7 @@ msgid "" "``sys.std*`` object has been redirected." msgstr "" -#: ../../library/sys.rst:1884 +#: ../../library/sys.rst:1887 msgid "" "It can also be used to restore the actual files to known working file " "objects in case they have been overwritten with a broken object. However, " @@ -2446,7 +2446,7 @@ msgid "" "before replacing it, and restore the saved object." msgstr "" -#: ../../library/sys.rst:1890 +#: ../../library/sys.rst:1893 msgid "" "Under some conditions ``stdin``, ``stdout`` and ``stderr`` as well as the " "original values ``__stdin__``, ``__stdout__`` and ``__stderr__`` can be " @@ -2454,12 +2454,12 @@ msgid "" "to a console and Python apps started with :program:`pythonw`." msgstr "" -#: ../../library/sys.rst:1898 +#: ../../library/sys.rst:1901 msgid "" "A frozenset of strings containing the names of standard library modules." msgstr "" -#: ../../library/sys.rst:1900 +#: ../../library/sys.rst:1903 msgid "" "It is the same on all platforms. Modules which are not available on some " "platforms and modules disabled at Python build are also listed. All module " @@ -2467,7 +2467,7 @@ msgid "" "modules are excluded." msgstr "" -#: ../../library/sys.rst:1905 +#: ../../library/sys.rst:1908 msgid "" "For packages, only the main package is listed: sub-packages and sub-modules " "are not listed. For example, the ``email`` package is listed, but the " @@ -2475,60 +2475,60 @@ msgid "" "listed." msgstr "" -#: ../../library/sys.rst:1910 +#: ../../library/sys.rst:1913 msgid "See also the :data:`sys.builtin_module_names` list." msgstr "另請參閱 :attr:`sys.builtin_module_names` 清單。" -#: ../../library/sys.rst:1917 +#: ../../library/sys.rst:1920 msgid "" "A :term:`named tuple` holding information about the thread implementation." msgstr "" -#: ../../library/sys.rst:1922 +#: ../../library/sys.rst:1925 msgid "The name of the thread implementation:" msgstr "" -#: ../../library/sys.rst:1924 +#: ../../library/sys.rst:1927 msgid "``\"nt\"``: Windows threads" msgstr "``\"nt\"``: Windows 執行緒" -#: ../../library/sys.rst:1925 +#: ../../library/sys.rst:1928 msgid "``\"pthread\"``: POSIX threads" msgstr "``\"pthread\"``: POSIX 執行緒" -#: ../../library/sys.rst:1926 +#: ../../library/sys.rst:1929 msgid "" "``\"pthread-stubs\"``: stub POSIX threads (on WebAssembly platforms without " "threading support)" msgstr "" -#: ../../library/sys.rst:1928 +#: ../../library/sys.rst:1931 msgid "``\"solaris\"``: Solaris threads" msgstr "" -#: ../../library/sys.rst:1932 +#: ../../library/sys.rst:1935 msgid "The name of the lock implementation:" msgstr "" -#: ../../library/sys.rst:1934 +#: ../../library/sys.rst:1937 msgid "``\"semaphore\"``: a lock uses a semaphore" msgstr "" -#: ../../library/sys.rst:1935 +#: ../../library/sys.rst:1938 msgid "``\"mutex+cond\"``: a lock uses a mutex and a condition variable" msgstr "" -#: ../../library/sys.rst:1936 +#: ../../library/sys.rst:1939 msgid "``None`` if this information is unknown" msgstr "為 ``None`` 表示此資訊未知" -#: ../../library/sys.rst:1940 +#: ../../library/sys.rst:1943 msgid "" "The name and version of the thread library. It is a string, or ``None`` if " "this information is unknown." msgstr "" -#: ../../library/sys.rst:1948 +#: ../../library/sys.rst:1951 msgid "" "When this variable is set to an integer value, it determines the maximum " "number of levels of traceback information printed when an unhandled " @@ -2537,73 +2537,73 @@ msgid "" "are printed." msgstr "" -#: ../../library/sys.rst:1956 +#: ../../library/sys.rst:1959 msgid "Handle an unraisable exception." msgstr "處理一個不可被引發的例外。" -#: ../../library/sys.rst:1958 +#: ../../library/sys.rst:1961 msgid "" "Called when an exception has occurred but there is no way for Python to " "handle it. For example, when a destructor raises an exception or during " "garbage collection (:func:`gc.collect`)." msgstr "" -#: ../../library/sys.rst:1962 +#: ../../library/sys.rst:1965 msgid "The *unraisable* argument has the following attributes:" msgstr "" -#: ../../library/sys.rst:1964 +#: ../../library/sys.rst:1967 msgid ":attr:`!exc_type`: Exception type." msgstr ":attr:`!exc_type`: 例外型別。" -#: ../../library/sys.rst:1965 +#: ../../library/sys.rst:1968 msgid ":attr:`!exc_value`: Exception value, can be ``None``." msgstr ":attr:`!exc_value`: 例外值,可以為 ``None``。" -#: ../../library/sys.rst:1966 +#: ../../library/sys.rst:1969 msgid ":attr:`!exc_traceback`: Exception traceback, can be ``None``." msgstr ":attr:`!exc_traceback`: 例外追蹤,可以為 ``None``。" -#: ../../library/sys.rst:1967 +#: ../../library/sys.rst:1970 msgid ":attr:`!err_msg`: Error message, can be ``None``." msgstr ":attr:`!err_msg`: 錯誤訊息,可以為 ``None``。" -#: ../../library/sys.rst:1968 +#: ../../library/sys.rst:1971 msgid ":attr:`!object`: Object causing the exception, can be ``None``." msgstr ":attr:`!object`: 導致例外的物件,可以為 ``None``。" -#: ../../library/sys.rst:1970 +#: ../../library/sys.rst:1973 msgid "" "The default hook formats :attr:`!err_msg` and :attr:`!object` as: " "``f'{err_msg}: {object!r}'``; use \"Exception ignored in\" error message if :" "attr:`!err_msg` is ``None``." msgstr "" -#: ../../library/sys.rst:1974 +#: ../../library/sys.rst:1977 msgid "" ":func:`sys.unraisablehook` can be overridden to control how unraisable " "exceptions are handled." msgstr "" -#: ../../library/sys.rst:1979 +#: ../../library/sys.rst:1982 msgid ":func:`excepthook` which handles uncaught exceptions." msgstr "處理未被捕捉到例外的 :func:`excepthook`。" -#: ../../library/sys.rst:1983 +#: ../../library/sys.rst:1986 msgid "" "Storing :attr:`!exc_value` using a custom hook can create a reference cycle. " "It should be cleared explicitly to break the reference cycle when the " "exception is no longer needed." msgstr "" -#: ../../library/sys.rst:1987 +#: ../../library/sys.rst:1990 msgid "" "Storing :attr:`!object` using a custom hook can resurrect it if it is set to " "an object which is being finalized. Avoid storing :attr:`!object` after the " "custom hook completes to avoid resurrecting objects." msgstr "" -#: ../../library/sys.rst:1991 ../../library/sys.rst:1993 +#: ../../library/sys.rst:1994 ../../library/sys.rst:1996 msgid "" "Raise an auditing event ``sys.unraisablehook`` with arguments *hook*, " "*unraisable* when an exception that cannot be handled occurs. The " @@ -2611,7 +2611,7 @@ msgid "" "hook has been set, *hook* may be ``None``." msgstr "" -#: ../../library/sys.rst:2002 +#: ../../library/sys.rst:2005 msgid "" "A string containing the version number of the Python interpreter plus " "additional information on the build number and compiler used. This string " @@ -2620,13 +2620,13 @@ msgid "" "functions provided by the :mod:`platform` module." msgstr "" -#: ../../library/sys.rst:2011 +#: ../../library/sys.rst:2014 msgid "" "The C API version for this interpreter. Programmers may find this useful " "when debugging version conflicts between Python and extension modules." msgstr "" -#: ../../library/sys.rst:2017 +#: ../../library/sys.rst:2020 msgid "" "A tuple containing the five components of the version number: *major*, " "*minor*, *micro*, *releaselevel*, and *serial*. All values except " @@ -2637,18 +2637,18 @@ msgid "" "version_info.major`` and so on." msgstr "" -#: ../../library/sys.rst:2025 +#: ../../library/sys.rst:2028 msgid "Added named component attributes." msgstr "新增了附名的元件屬性。" -#: ../../library/sys.rst:2030 +#: ../../library/sys.rst:2033 msgid "" "This is an implementation detail of the warnings framework; do not modify " "this value. Refer to the :mod:`warnings` module for more information on the " "warnings framework." msgstr "" -#: ../../library/sys.rst:2037 +#: ../../library/sys.rst:2040 msgid "" "The version number used to form registry keys on Windows platforms. This is " "stored as string resource 1000 in the Python DLL. The value is normally the " @@ -2657,20 +2657,20 @@ msgid "" "has no effect on the registry keys used by Python." msgstr "" -#: ../../library/sys.rst:2049 +#: ../../library/sys.rst:2052 msgid "" "Namespace containing functions and constants for register callbacks and " "controlling monitoring events. See :mod:`sys.monitoring` for details." msgstr "" -#: ../../library/sys.rst:2055 +#: ../../library/sys.rst:2058 msgid "" "A dictionary of the various implementation-specific flags passed through " "the :option:`-X` command-line option. Option names are either mapped to " "their values, if given explicitly, or to :const:`True`. Example:" msgstr "" -#: ../../library/sys.rst:2059 +#: ../../library/sys.rst:2062 msgid "" "$ ./python -Xa=b -Xc\n" "Python 3.2a3+ (py3k, Oct 16 2010, 20:14:50)\n" @@ -2690,18 +2690,18 @@ msgstr "" ">>> sys._xoptions\n" "{'a': 'b', 'c': True}" -#: ../../library/sys.rst:2071 +#: ../../library/sys.rst:2074 msgid "" "This is a CPython-specific way of accessing options passed through :option:`-" "X`. Other implementations may export them through other means, or not at " "all." msgstr "" -#: ../../library/sys.rst:2079 +#: ../../library/sys.rst:2082 msgid "Citations" msgstr "引用" -#: ../../library/sys.rst:2080 +#: ../../library/sys.rst:2083 msgid "" "ISO/IEC 9899:1999. \"Programming languages -- C.\" A public draft of this " "standard is available at https://www.open-std.org/jtc1/sc22/wg14/www/docs/" @@ -2722,50 +2722,50 @@ msgstr "object(物件)" msgid "traceback" msgstr "traceback" -#: ../../library/sys.rst:954 ../../library/sys.rst:1531 +#: ../../library/sys.rst:954 ../../library/sys.rst:1534 msgid "profile function" msgstr "" -#: ../../library/sys.rst:954 ../../library/sys.rst:1531 +#: ../../library/sys.rst:954 ../../library/sys.rst:1534 msgid "profiler" msgstr "" -#: ../../library/sys.rst:963 ../../library/sys.rst:1614 +#: ../../library/sys.rst:963 ../../library/sys.rst:1617 msgid "trace function" msgstr "" -#: ../../library/sys.rst:963 ../../library/sys.rst:1614 +#: ../../library/sys.rst:963 ../../library/sys.rst:1617 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/sys.rst:1359 +#: ../../library/sys.rst:1362 msgid "module" msgstr "module(模組)" -#: ../../library/sys.rst:1359 +#: ../../library/sys.rst:1362 msgid "search" msgstr "search(搜尋)" -#: ../../library/sys.rst:1359 +#: ../../library/sys.rst:1362 msgid "path" msgstr "path(路徑)" -#: ../../library/sys.rst:1495 +#: ../../library/sys.rst:1498 msgid "interpreter prompts" msgstr "interpreter prompts(直譯器提示)" -#: ../../library/sys.rst:1495 +#: ../../library/sys.rst:1498 msgid "prompts, interpreter" msgstr "prompts, interpreter(提示、直譯器)" -#: ../../library/sys.rst:1495 +#: ../../library/sys.rst:1498 msgid ">>>" msgstr ">>>" -#: ../../library/sys.rst:1495 +#: ../../library/sys.rst:1498 msgid "interpreter prompt" msgstr "interpreter prompt(直譯器提示)" -#: ../../library/sys.rst:1495 +#: ../../library/sys.rst:1498 msgid "..." msgstr "..." diff --git a/library/sysconfig.po b/library/sysconfig.po index 7323abb9ea..f8b98b310e 100644 --- a/library/sysconfig.po +++ b/library/sysconfig.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-04 00:13+0000\n" +"POT-Creation-Date: 2025-04-29 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -731,15 +731,15 @@ msgstr "回傳 :file:`pyconfig.h` 的路徑。" msgid "Return the path of :file:`Makefile`." msgstr "回傳 :file:`Makefile` 的路徑。" -#: ../../library/sysconfig.rst:434 -msgid "Using :mod:`sysconfig` as a script" -msgstr "將 :mod:`sysconfig` 作為腳本使用" +#: ../../library/sysconfig.rst:435 +msgid "Command-line usage" +msgstr "命令列用法" -#: ../../library/sysconfig.rst:436 +#: ../../library/sysconfig.rst:437 msgid "You can use :mod:`sysconfig` as a script with Python's *-m* option:" msgstr "" -#: ../../library/sysconfig.rst:438 +#: ../../library/sysconfig.rst:439 msgid "" "$ python -m sysconfig\n" "Platform: \"macosx-10.4-i386\"\n" @@ -785,7 +785,7 @@ msgstr "" " ARFLAGS = \"rc\"\n" " ..." -#: ../../library/sysconfig.rst:462 +#: ../../library/sysconfig.rst:463 msgid "" "This call will print in the standard output the information returned " "by :func:`get_platform`, :func:`get_python_version`, :func:`get_path` " @@ -795,3 +795,6 @@ msgstr "" #: ../../library/sysconfig.rst:14 msgid "configuration information" msgstr "configuration information(設定資訊)" + +#~ msgid "Using :mod:`sysconfig` as a script" +#~ msgstr "將 :mod:`sysconfig` 作為腳本使用" diff --git a/library/tempfile.po b/library/tempfile.po index 9dd531ec72..e497bab54c 100644 --- a/library/tempfile.po +++ b/library/tempfile.po @@ -31,17 +31,18 @@ msgstr "**原始碼:**\\ :source:`Lib/tempfile.py`" #: ../../library/tempfile.rst:17 msgid "" "This module creates temporary files and directories. It works on all " -"supported platforms. :class:`TemporaryFile`, :class:`NamedTemporaryFile`, :" -"class:`TemporaryDirectory`, and :class:`SpooledTemporaryFile` are high-level " -"interfaces which provide automatic cleanup and can be used as :term:`context " -"managers `. :func:`mkstemp` and :func:`mkdtemp` are lower-" -"level functions which require manual cleanup." -msgstr "" -"該 module(模組)用於建立臨時檔案和目錄,它可以在所有有支援的平臺上使用。:" -"class:`TemporaryFile`、:class:`NamedTemporaryFile`、:class:" -"`TemporaryDirectory` 和 :class:`SpooledTemporaryFile` 是有自動清除功能的高階" -"介面,可作為\\ :term:`情境管理器 (context manager) ` 使用。:" -"func:`mkstemp` 和 :func:`mkdtemp` 是低階函式,使用完畢後需手動清理。" +"supported " +"platforms. :class:`TemporaryFile`, :class:`NamedTemporaryFile`, :class:`TemporaryDirectory`, " +"and :class:`SpooledTemporaryFile` are high-level interfaces which provide " +"automatic cleanup and can be used as :term:`context managers `. :func:`mkstemp` and :func:`mkdtemp` are lower-level functions " +"which require manual cleanup." +msgstr "" +"該 module(模組)用於建立臨時檔案和目錄,它可以在所有有支援的平臺上使" +"用。:class:`TemporaryFile`、:class:`NamedTemporaryFile`、:class:`TemporaryDirectory` " +"和 :class:`SpooledTemporaryFile` 是有自動清除功能的高階介面,可作為\\ :term:`" +"情境管理器 (context manager) ` 使用。:func:`mkstemp` " +"和 :func:`mkdtemp` 是低階函式,使用完畢後需手動清理。" #: ../../library/tempfile.rst:24 msgid "" @@ -82,13 +83,13 @@ msgstr "" #: ../../library/tempfile.rst:44 msgid "" -"The resulting object can be used as a :term:`context manager` (see :ref:" -"`tempfile-examples`). On completion of the context or destruction of the " -"file object the temporary file will be removed from the filesystem." +"The resulting object can be used as a :term:`context manager` " +"(see :ref:`tempfile-examples`). On completion of the context or destruction " +"of the file object the temporary file will be removed from the filesystem." msgstr "" -"生成的物件可以作為\\ :term:`情境管理器 `\\ 使用(參見 :ref:" -"`tempfile-examples`)。完成情境或銷毀臨時檔案物件後,臨時檔案將從檔案系統中刪" -"除。" +"生成的物件可以作為\\ :term:`情境管理器 `\\ 使用(參" +"見 :ref:`tempfile-examples`)。完成情境或銷毀臨時檔案物件後,臨時檔案將從檔案" +"系統中刪除。" #: ../../library/tempfile.rst:49 msgid "" @@ -171,8 +172,8 @@ msgid "" "with *delete* and *delete_on_close* parameters that determine whether and " "how the named file should be automatically deleted." msgstr "" -"為了管理指定檔案,它使用 *delete* 和 *delete_on_close* 參數擴充 :func:" -"`TemporaryFile` 來指定是否以及如何自動刪除指定檔案。" +"為了管理指定檔案,它使用 *delete* 和 *delete_on_close* 參數擴" +"充 :func:`TemporaryFile` 來指定是否以及如何自動刪除指定檔案。" #: ../../library/tempfile.rst:89 msgid "" @@ -202,8 +203,8 @@ msgstr "" "如果 *delete* 為 true(預設值)並且 *delete_on_close* 為 true(預設值),則檔" "案在關閉後會立即被刪除。如果 *delete* 為 true 並且 *delete_on_close* 為 " "false,則僅在情境管理器退出時刪除檔案,或者在\\ :term:`類檔案物件 `\\ 完結時刪除檔案。在這種情況下,並不總是保證能成功刪除(請參閱 :" -"meth:`object.__del__`\\ )。如果 *delete* 為 false,則會忽略 " +"object>`\\ 完結時刪除檔案。在這種情況下,並不總是保證能成功刪除(請參" +"閱 :meth:`object.__del__`\\ )。如果 *delete* 為 false,則會忽略 " "*delete_on_close* 的值。" #: ../../library/tempfile.rst:104 @@ -245,21 +246,21 @@ msgid "" "additional open shares delete access (e.g. by calling :func:`os.open` with " "the flag ``O_TEMPORARY``)" msgstr "" -"額外的 open 會共享刪除存取權限(例如,通過使用旗標 ``O_TEMPORARY`` 來呼叫 :" -"func:`os.open`\\ )" +"額外的 open 會共享刪除存取權限(例如,通過使用旗標 ``O_TEMPORARY`` 來呼" +"叫 :func:`os.open`\\ )" #: ../../library/tempfile.rst:121 msgid "" "*delete* is true but *delete_on_close* is false. Note, that in this case the " -"additional opens that do not share delete access (e.g. created via builtin :" -"func:`open`) must be closed before exiting the context manager, else the :" -"func:`os.unlink` call on context manager exit will fail with a :exc:" -"`PermissionError`." +"additional opens that do not share delete access (e.g. created via " +"builtin :func:`open`) must be closed before exiting the context manager, " +"else the :func:`os.unlink` call on context manager exit will fail with " +"a :exc:`PermissionError`." msgstr "" "*delete* 為 true 但 *delete_on_close* 為 false。請注意,在這種情況下不共享刪" "除存取權限的其他 open(例如透過內建的 :func:`open` 建立)必須在退出情境管理器" -"之前關閉,否則情境管理器上的 :func:`os.unlink` 呼叫退出將失敗並出現 :exc:" -"`PermissionError`。" +"之前關閉,否則情境管理器上的 :func:`os.unlink` 呼叫退出將失敗並出" +"現 :exc:`PermissionError`。" #: ../../library/tempfile.rst:127 msgid "" @@ -292,8 +293,8 @@ msgid "" "This class operates exactly as :func:`TemporaryFile` does, except that data " "is spooled in memory until the file size exceeds *max_size*, or until the " "file's :func:`~io.IOBase.fileno` method is called, at which point the " -"contents are written to disk and operation proceeds as with :func:" -"`TemporaryFile`." +"contents are written to disk and operation proceeds as " +"with :func:`TemporaryFile`." msgstr "" "此類別執行的操作與 :func:`TemporaryFile` 完全相同,但會將資料排存 (spool) 於" "在記憶體中,直到檔案大小超過 *max_size*,或檔案的 :func:`~io.IOBase.fileno` " @@ -316,10 +317,10 @@ msgid "" "depending on whether :meth:`rollover` has been called. This file-like " "object can be used in a :keyword:`with` statement, just like a normal file." msgstr "" -"回傳的物件是 file-like object,它的 :attr:`!_file` 屬性是 :class:`io." -"BytesIO` 或 :class:`io.TextIOWrapper` 物件(取決於指定的是二進位制模式還是文" -"字模式)或真實的檔案物件(取決於是否已呼叫 :meth:`rollover`)。file-like " -"object 可以像普通檔案一樣在 :keyword:`with` 陳述式中使用。" +"回傳的物件是 file-like object,它的 :attr:`!_file` 屬性" +"是 :class:`io.BytesIO` 或 :class:`io.TextIOWrapper` 物件(取決於指定的是二進" +"位制模式還是文字模式)或真實的檔案物件(取決於是否已呼叫 :meth:`rollover`)。" +"file-like object 可以像普通檔案一樣在 :keyword:`with` 陳述式中使用。" #: ../../library/tempfile.rst:166 msgid "the truncate method now accepts a *size* argument." @@ -336,8 +337,8 @@ msgstr "" #: ../../library/tempfile.rst:180 msgid "" -"This class securely creates a temporary directory using the same rules as :" -"func:`mkdtemp`. The resulting object can be used as a :term:`context " +"This class securely creates a temporary directory using the same rules " +"as :func:`mkdtemp`. The resulting object can be used as a :term:`context " "manager` (see :ref:`tempfile-examples`). On completion of the context or " "destruction of the temporary directory object, the newly created temporary " "directory and all its contents are removed from the filesystem." @@ -354,9 +355,9 @@ msgid "" "manager`, the :attr:`!name` will be assigned to the target of the :keyword:`!" "as` clause in the :keyword:`with` statement, if there is one." msgstr "" -"可以從回傳物件的 :attr:`!name` 屬性中找到的臨時目錄名稱。當回傳的物件用作\\ :" -"term:`情境管理器 `\\ 時,這個 :attr:`!name` 會作為 :keyword:" -"`with` 陳述句中 :keyword:`!as` 子句的目標(如果有 as 的話)。" +"可以從回傳物件的 :attr:`!name` 屬性中找到的臨時目錄名稱。當回傳的物件用作" +"\\ :term:`情境管理器 `\\ 時,這個 :attr:`!name` 會作" +"為 :keyword:`with` 陳述句中 :keyword:`!as` 子句的目標(如果有 as 的話)。" #: ../../library/tempfile.rst:195 msgid "" @@ -434,15 +435,15 @@ msgid "" "between the file name and the suffix; if you need one, put it at the " "beginning of *suffix*." msgstr "" -"如果 *suffix* 不是 ``None`` 則檔名將以該後綴結尾,若為 ``None`` 則沒有後綴。:" -"func:`mkstemp` 不會在檔名和後綴之間加點 (dot),如果需要加一個點號,請將其放" -"在 *suffix* 的開頭。" +"如果 *suffix* 不是 ``None`` 則檔名將以該後綴結尾,若為 ``None`` 則沒有後" +"綴。:func:`mkstemp` 不會在檔名和後綴之間加點 (dot),如果需要加一個點號,請將" +"其放在 *suffix* 的開頭。" #: ../../library/tempfile.rst:239 msgid "" "If *prefix* is not ``None``, the file name will begin with that prefix; " -"otherwise, a default prefix is used. The default is the return value of :" -"func:`gettempprefix` or :func:`gettempprefixb`, as appropriate." +"otherwise, a default prefix is used. The default is the return value " +"of :func:`gettempprefix` or :func:`gettempprefixb`, as appropriate." msgstr "" "如果 *prefix* 不是 ``None`` 則檔名將以該字首開頭,若為 ``None`` 則使用預設前" "綴。預設前綴是 :func:`gettempprefix` 或 :func:`gettempprefixb` 函式的回傳值" @@ -525,8 +526,8 @@ msgstr ":func:`mkdtemp` 的使用者用完臨時目錄後需要自行將其刪 #: ../../library/tempfile.rst:285 msgid "" -"The *prefix*, *suffix*, and *dir* arguments are the same as for :func:" -"`mkstemp`." +"The *prefix*, *suffix*, and *dir* arguments are the same as " +"for :func:`mkstemp`." msgstr "" "引數 *prefix*、*suffix* 和 *dir* 的含義與它們在 :func:`mkstemp` 中相同。" @@ -580,8 +581,8 @@ msgstr "" #: ../../library/tempfile.rst:325 msgid "" -"On all other platforms, the directories :file:`/tmp`, :file:`/var/tmp`, and :" -"file:`/usr/tmp`, in that order." +"On all other platforms, the directories :file:`/tmp`, :file:`/var/tmp`, " +"and :file:`/usr/tmp`, in that order." msgstr "" "在所有其他平臺上,目錄依次為 :file:`/tmp`、:file:`/var/tmp` 和 :file:`/usr/" "tmp`。" @@ -654,16 +655,16 @@ msgstr "" #: ../../library/tempfile.rst:375 msgid "" "Beware that if you set ``tempdir`` to a bytes value, there is a nasty side " -"effect: The global default return type of :func:`mkstemp` and :func:" -"`mkdtemp` changes to bytes when no explicit ``prefix``, ``suffix``, or " -"``dir`` arguments of type str are supplied. Please do not write code " -"expecting or depending on this. This awkward behavior is maintained for " -"compatibility with the historical implementation." +"effect: The global default return type of :func:`mkstemp` " +"and :func:`mkdtemp` changes to bytes when no explicit ``prefix``, " +"``suffix``, or ``dir`` arguments of type str are supplied. Please do not " +"write code expecting or depending on this. This awkward behavior is " +"maintained for compatibility with the historical implementation." msgstr "" -"請注意如果你將 ``tempdir`` 設為位元組串值,會有一個麻煩的副作用::func:" -"`mkstemp` 和 :func:`mkdtemp` 的全域性預設回傳型別會在沒有提供明顯字串型別的 " -"``prefix``、``suffix`` 或 ``dir`` 時被改為位元組串。請不要編寫預期此行為或依" -"賴於此行為的程式。這個奇怪的行為是為了維持與以往實作版本的相容性。" +"請注意如果你將 ``tempdir`` 設為位元組串值,會有一個麻煩的副作" +"用::func:`mkstemp` 和 :func:`mkdtemp` 的全域性預設回傳型別會在沒有提供明顯字" +"串型別的 ``prefix``、``suffix`` 或 ``dir`` 時被改為位元組串。請不要編寫預期此" +"行為或依賴於此行為的程式。這個奇怪的行為是為了維持與以往實作版本的相容性。" #: ../../library/tempfile.rst:386 msgid "Examples" @@ -715,6 +716,45 @@ msgid "" ">>>\n" "# directory and contents have been removed" msgstr "" +">>> import tempfile\n" +"\n" +"# 建立一個臨時檔案並寫入一些資料\n" +">>> fp = tempfile.TemporaryFile()\n" +">>> fp.write(b'Hello world!')\n" +"# read data from file\n" +">>> fp.seek(0)\n" +">>> fp.read()\n" +"b'Hello world!'\n" +"# 關閉檔案,檔案會被刪除\n" +">>> fp.close()\n" +"\n" +"# 使用情境管理器建立臨時檔案\n" +">>> with tempfile.TemporaryFile() as fp:\n" +"... fp.write(b'Hello world!')\n" +"... fp.seek(0)\n" +"... fp.read()\n" +"b'Hello world!'\n" +">>>\n" +"# 檔案現在已關閉並刪除\n" +"\n" +"# 使用情境管理器建立臨時檔案\n" +"# 關閉檔案,使用名稱再次開啟檔案\n" +">>> with tempfile.NamedTemporaryFile(delete_on_close=False) as fp:\n" +"... fp.write(b'Hello world!')\n" +"... fp.close()\n" +"... # 檔案已被關閉,但未被刪除\n" +"... # 透過其名稱再次開啟檔案\n" +"... with open(fp.name, mode='rb') as f:\n" +"... f.read()\n" +"b'Hello world!'\n" +">>>\n" +"# 現在檔案已被刪除\n" +"\n" +"# 使用情境管理器建立臨時目錄\n" +">>> with tempfile.TemporaryDirectory() as tmpdirname:\n" +"... print('created temporary directory', tmpdirname)\n" +">>>\n" +"# 目錄及其內容已被刪除" #: ../../library/tempfile.rst:433 msgid "Deprecated functions and variables" @@ -815,5 +855,5 @@ msgstr "file(檔案)" #~ "允許用檔名第二次開啟檔案,在各個平臺上是不同的(在 Unix 上可以;在 " #~ "Windows NT 版本以上不行)。如果 *delete* 為 true(預設值),則檔案會在關閉" #~ "後立即被刪除。該函式回傳的物件始終是 file-like object,它的 :attr:`!file` " -#~ "屬性是底層的真實檔案物件。file-like object 可以像普通檔案一樣在 :keyword:" -#~ "`with` 陳述句中使用。" +#~ "屬性是底層的真實檔案物件。file-like object 可以像普通檔案一樣" +#~ "在 :keyword:`with` 陳述句中使用。" diff --git a/library/time.po b/library/time.po index f1ec859a7e..8d53a79a3b 100644 --- a/library/time.po +++ b/library/time.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-19 00:15+0000\n" +"POT-Creation-Date: 2025-03-10 00:13+0000\n" "PO-Revision-Date: 2024-11-20 15:25+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -86,14 +86,13 @@ msgstr "" #: ../../library/time.rst:55 msgid "" -"UTC is Coordinated Universal Time (formerly known as Greenwich Mean Time, or " -"GMT). The acronym UTC is not a mistake but a compromise between English and " -"French." +"UTC is `Coordinated Universal Time`_ and superseded `Greenwich Mean Time`_ " +"or GMT as the basis of international timekeeping. The acronym UTC is not a " +"mistake but conforms to an earlier, language-agnostic naming scheme for time " +"standards such as UT0, UT1, and UT2." msgstr "" -"UTC 是 Coordinated Universal Time --- 世界協調時間(原稱為格林威治標準時間," -"或 GMT)。縮寫 UTC 並不是寫錯,而是英文和法文之間折衷的結果。" -#: ../../library/time.rst:61 +#: ../../library/time.rst:65 msgid "" "DST is Daylight Saving Time, an adjustment of the timezone by (usually) one " "hour during part of the year. DST rules are magic (determined by local law) " @@ -106,7 +105,7 @@ msgstr "" "含當地規則的表(通常會為了靈活性而從系統文件中讀取),在這方面是唯一的真正依" "據。" -#: ../../library/time.rst:67 +#: ../../library/time.rst:71 msgid "" "The precision of the various real-time functions may be less than suggested " "by the units in which their value or argument is expressed. E.g. on most " @@ -115,13 +114,13 @@ msgstr "" "各種即時 (real-time) 函式的精確度可能低於其值或引數所表示的單位所建議的精確" "度。例如,在大多數 Unix 系統上,時鐘每秒只「跳」50 次或 100 次。" -#: ../../library/time.rst:71 +#: ../../library/time.rst:75 msgid "" "On the other hand, the precision of :func:`.time` and :func:`sleep` is " "better than their Unix equivalents: times are expressed as floating-point " -"numbers, :func:`.time` returns the most accurate time available (using " -"Unix :c:func:`!gettimeofday` where available), and :func:`sleep` will accept " -"a time with a nonzero fraction (Unix :c:func:`!select` is used to implement " +"numbers, :func:`.time` returns the most accurate time available (using Unix :" +"c:func:`!gettimeofday` where available), and :func:`sleep` will accept a " +"time with a nonzero fraction (Unix :c:func:`!select` is used to implement " "this, where available)." msgstr "" "另一方面,:func:`.time` 和 :func:`sleep` 的精確度比它們的在 Unix 的等效函式更" @@ -129,104 +128,103 @@ msgstr "" "Unix 的 :c:func:`!gettimeofday`\\ ),而 :func:`sleep` 可以接受帶有非零分數的" "時間(如果可以會使用 Unix 的 :c:func:`!select` 來實作)。" -#: ../../library/time.rst:78 +#: ../../library/time.rst:82 msgid "" -"The time value as returned by :func:`gmtime`, :func:`localtime`, " -"and :func:`strptime`, and accepted by :func:`asctime`, :func:`mktime` " -"and :func:`strftime`, is a sequence of 9 integers. The return values " -"of :func:`gmtime`, :func:`localtime`, and :func:`strptime` also offer " -"attribute names for individual fields." +"The time value as returned by :func:`gmtime`, :func:`localtime`, and :func:" +"`strptime`, and accepted by :func:`asctime`, :func:`mktime` and :func:" +"`strftime`, is a sequence of 9 integers. The return values of :func:" +"`gmtime`, :func:`localtime`, and :func:`strptime` also offer attribute names " +"for individual fields." msgstr "" -"由 :func:`gmtime`、:func:`localtime` 和 :func:`strptime` 回傳,並" -"由 :func:`asctime`、:func:`mktime` 和 :func:`strftime` 接受的時間值,是一個 " -"9 個整數的序列。:func:`gmtime`、:func:`localtime` 和 :func:`strptime` 的回傳" -"值也為各個欄位提供屬性名稱。" +"由 :func:`gmtime`、:func:`localtime` 和 :func:`strptime` 回傳,並由 :func:" +"`asctime`、:func:`mktime` 和 :func:`strftime` 接受的時間值,是一個 9 個整數的" +"序列。:func:`gmtime`、:func:`localtime` 和 :func:`strptime` 的回傳值也為各個" +"欄位提供屬性名稱。" -#: ../../library/time.rst:84 +#: ../../library/time.rst:88 msgid "See :class:`struct_time` for a description of these objects." msgstr "關於這些物件的敘述請見 :class:`struct_time`。" -#: ../../library/time.rst:86 +#: ../../library/time.rst:90 msgid "" -"The :class:`struct_time` type was extended to provide " -"the :attr:`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` " -"attributes when platform supports corresponding ``struct tm`` members." +"The :class:`struct_time` type was extended to provide the :attr:" +"`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` attributes when " +"platform supports corresponding ``struct tm`` members." msgstr "" "當平台支援對應的 ``struct tm`` 成員時,:class:`struct_time` 型別被擴展以提" "供 :attr:`~struct_time.tm_gmtoff` 和 :attr:`~struct_time.tm_zone` 屬性。" -#: ../../library/time.rst:92 +#: ../../library/time.rst:96 msgid "" -"The :class:`struct_time` attributes :attr:`~struct_time.tm_gmtoff` " -"and :attr:`~struct_time.tm_zone` are now available on all platforms." +"The :class:`struct_time` attributes :attr:`~struct_time.tm_gmtoff` and :attr:" +"`~struct_time.tm_zone` are now available on all platforms." msgstr "" -":class:`struct_time` 的屬性 :attr:`~struct_time.tm_gmtoff` " -"和 :attr:`~struct_time.tm_zone` 現在在所有平台上都可用。" +":class:`struct_time` 的屬性 :attr:`~struct_time.tm_gmtoff` 和 :attr:" +"`~struct_time.tm_zone` 現在在所有平台上都可用。" -#: ../../library/time.rst:97 +#: ../../library/time.rst:101 msgid "Use the following functions to convert between time representations:" msgstr "使用以下函式在時間表示之間進行轉換:" -#: ../../library/time.rst:100 +#: ../../library/time.rst:104 msgid "From" msgstr "轉換來源" -#: ../../library/time.rst:100 +#: ../../library/time.rst:104 msgid "To" msgstr "轉換目標" -#: ../../library/time.rst:100 +#: ../../library/time.rst:104 msgid "Use" msgstr "使用" -#: ../../library/time.rst:29 ../../library/time.rst:102 -#: ../../library/time.rst:105 ../../library/time.rst:108 -#: ../../library/time.rst:111 +#: ../../library/time.rst:29 ../../library/time.rst:106 +#: ../../library/time.rst:109 ../../library/time.rst:112 +#: ../../library/time.rst:115 msgid "seconds since the epoch" msgstr "紀元秒數" -#: ../../library/time.rst:102 ../../library/time.rst:108 +#: ../../library/time.rst:106 ../../library/time.rst:112 msgid ":class:`struct_time` in UTC" msgstr "世界協調時間的 :class:`struct_time`" -#: ../../library/time.rst:102 +#: ../../library/time.rst:106 msgid ":func:`gmtime`" msgstr ":func:`gmtime`" -#: ../../library/time.rst:105 ../../library/time.rst:111 +#: ../../library/time.rst:109 ../../library/time.rst:115 msgid ":class:`struct_time` in local time" msgstr "本地時間的 :class:`struct_time`" -#: ../../library/time.rst:105 +#: ../../library/time.rst:109 msgid ":func:`localtime`" msgstr ":func:`localtime`" -#: ../../library/time.rst:108 +#: ../../library/time.rst:112 msgid ":func:`calendar.timegm`" msgstr ":func:`calendar.timegm`" -#: ../../library/time.rst:111 +#: ../../library/time.rst:115 msgid ":func:`mktime`" msgstr ":func:`mktime`" -#: ../../library/time.rst:119 +#: ../../library/time.rst:123 msgid "Functions" msgstr "函式" -#: ../../library/time.rst:123 +#: ../../library/time.rst:127 msgid "" -"Convert a tuple or :class:`struct_time` representing a time as returned " -"by :func:`gmtime` or :func:`localtime` to a string of the following form: " -"``'Sun Jun 20 23:21:05 1993'``. The day field is two characters long and is " -"space padded if the day is a single digit, e.g.: ``'Wed Jun 9 04:26:40 " -"1993'``." +"Convert a tuple or :class:`struct_time` representing a time as returned by :" +"func:`gmtime` or :func:`localtime` to a string of the following form: ``'Sun " +"Jun 20 23:21:05 1993'``. The day field is two characters long and is space " +"padded if the day is a single digit, e.g.: ``'Wed Jun 9 04:26:40 1993'``." msgstr "" "將由 :func:`gmtime` 或 :func:`localtime` 回傳的元組或 :class:`struct_time` 表" "示的時間轉換為以下格式的字串:``'Sun Jun 20 23:21:05 1993'``。日期欄位為兩個" "字元長,如果日期是個位數,則用空格填充,例如:``'Wed Jun 9 04:26:40 " "1993'``。" -#: ../../library/time.rst:129 +#: ../../library/time.rst:133 msgid "" "If *t* is not provided, the current time as returned by :func:`localtime` is " "used. Locale information is not used by :func:`asctime`." @@ -234,28 +232,28 @@ msgstr "" "如果沒有提供 *t*,則使用由 :func:`localtime` 回傳的目前時間。:func:`asctime` " "不使用區域資訊。" -#: ../../library/time.rst:134 +#: ../../library/time.rst:138 msgid "" "Unlike the C function of the same name, :func:`asctime` does not add a " "trailing newline." msgstr "與同名的 C 函式不同,:func:`asctime` 不會添加結尾的換行字元。" -#: ../../library/time.rst:139 +#: ../../library/time.rst:143 msgid "" "Return the *clk_id* of the thread-specific CPU-time clock for the specified " "*thread_id*." msgstr "為指定的 *thread_id* 回傳執行緒專用 CPU-time 時鐘的 *clk_id*。" -#: ../../library/time.rst:141 +#: ../../library/time.rst:145 msgid "" "Use :func:`threading.get_ident` or the :attr:`~threading.Thread.ident` " "attribute of :class:`threading.Thread` objects to get a suitable value for " "*thread_id*." msgstr "" -"使用 :func:`threading.get_ident` 或 :class:`threading.Thread` 物件" -"的 :attr:`~threading.Thread.ident` 屬性來取得適用於 *thread_id* 的值。" +"使用 :func:`threading.get_ident` 或 :class:`threading.Thread` 物件的 :attr:" +"`~threading.Thread.ident` 屬性來取得適用於 *thread_id* 的值。" -#: ../../library/time.rst:146 +#: ../../library/time.rst:150 msgid "" "Passing an invalid or expired *thread_id* may result in undefined behavior, " "such as segmentation fault." @@ -263,27 +261,27 @@ msgstr "" "傳遞無效或過期的 *thread_id* 可能會導致未定義的行為,例如分段錯誤 " "(segmentation fault)。" -#: ../../library/time.rst:149 ../../library/time.rst:161 -#: ../../library/time.rst:174 ../../library/time.rst:183 -#: ../../library/time.rst:196 ../../library/time.rst:205 -#: ../../library/time.rst:743 ../../library/time.rst:767 -#: ../../library/time.rst:863 ../../library/time.rst:874 -#: ../../library/time.rst:884 ../../library/time.rst:894 -#: ../../library/time.rst:903 ../../library/time.rst:912 -#: ../../library/time.rst:921 ../../library/time.rst:932 -#: ../../library/time.rst:940 ../../library/time.rst:951 -#: ../../library/time.rst:962 ../../library/time.rst:971 -#: ../../library/time.rst:984 +#: ../../library/time.rst:153 ../../library/time.rst:165 +#: ../../library/time.rst:178 ../../library/time.rst:187 +#: ../../library/time.rst:200 ../../library/time.rst:209 +#: ../../library/time.rst:747 ../../library/time.rst:771 +#: ../../library/time.rst:867 ../../library/time.rst:878 +#: ../../library/time.rst:888 ../../library/time.rst:898 +#: ../../library/time.rst:907 ../../library/time.rst:916 +#: ../../library/time.rst:925 ../../library/time.rst:936 +#: ../../library/time.rst:944 ../../library/time.rst:955 +#: ../../library/time.rst:966 ../../library/time.rst:975 +#: ../../library/time.rst:988 msgid "Availability" msgstr "" -#: ../../library/time.rst:151 +#: ../../library/time.rst:155 msgid "" "See the man page for :manpage:`pthread_getcpuclockid(3)` for further " "information." msgstr "若需更多資訊,請參閱 :manpage:`pthread_getcpuclockid(3)` 的說明文件。" -#: ../../library/time.rst:158 +#: ../../library/time.rst:162 msgid "" "Return the resolution (precision) of the specified clock *clk_id*. Refer " "to :ref:`time-clock-id-constants` for a list of accepted values for *clk_id*." @@ -291,46 +289,46 @@ msgstr "" "回傳指定時鐘 *clk_id* 的解析度(精確度)。有關 *clk_id* 可接受的值的串列,請" "參閱 :ref:`time-clock-id-constants`。" -#: ../../library/time.rst:168 +#: ../../library/time.rst:172 msgid "" "Return the time of the specified clock *clk_id*. Refer to :ref:`time-clock-" "id-constants` for a list of accepted values for *clk_id*." msgstr "" -"回傳指定時鐘 *clk_id* 的時間。有關 *clk_id* 可接受的值的串列,請參" -"閱 :ref:`time-clock-id-constants`。" +"回傳指定時鐘 *clk_id* 的時間。有關 *clk_id* 可接受的值的串列,請參閱 :ref:" +"`time-clock-id-constants`。" -#: ../../library/time.rst:171 +#: ../../library/time.rst:175 msgid "" -"Use :func:`clock_gettime_ns` to avoid the precision loss caused by " -"the :class:`float` type." +"Use :func:`clock_gettime_ns` to avoid the precision loss caused by the :" +"class:`float` type." msgstr "" "使用 :func:`clock_gettime_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:181 +#: ../../library/time.rst:185 msgid "Similar to :func:`clock_gettime` but return time as nanoseconds." msgstr "" "類似於 :func:`clock_gettime`,但回傳以奈秒 (nanoseconds) 為單位的時間。" -#: ../../library/time.rst:190 +#: ../../library/time.rst:194 msgid "" -"Set the time of the specified clock *clk_id*. " -"Currently, :data:`CLOCK_REALTIME` is the only accepted value for *clk_id*." +"Set the time of the specified clock *clk_id*. Currently, :data:" +"`CLOCK_REALTIME` is the only accepted value for *clk_id*." msgstr "" "設定指定時鐘 *clk_id* 的時間。目前,:data:`CLOCK_REALTIME` 是 *clk_id* 唯一可" "以接受的值。" -#: ../../library/time.rst:193 +#: ../../library/time.rst:197 msgid "" -"Use :func:`clock_settime_ns` to avoid the precision loss caused by " -"the :class:`float` type." +"Use :func:`clock_settime_ns` to avoid the precision loss caused by the :" +"class:`float` type." msgstr "" "使用 :func:`clock_settime_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:203 +#: ../../library/time.rst:207 msgid "Similar to :func:`clock_settime` but set time with nanoseconds." msgstr "類似於 :func:`clock_settime`,但設定以奈秒為單位的時間。" -#: ../../library/time.rst:212 +#: ../../library/time.rst:216 msgid "" "Convert a time expressed in seconds since the epoch_ to a string of a form: " "``'Sun Jun 20 23:21:05 1993'`` representing local time. The day field is two " @@ -341,18 +339,18 @@ msgstr "" "Jun 20 23:21:05 1993'``。日期欄位為兩個字元長,如果日期是個位數,則用空格填" "充,例如:``'Wed Jun 9 04:26:40 1993'``。" -#: ../../library/time.rst:217 +#: ../../library/time.rst:221 msgid "" -"If *secs* is not provided or :const:`None`, the current time as returned " -"by :func:`.time` is used. ``ctime(secs)`` is equivalent to " -"``asctime(localtime(secs))``. Locale information is not used " -"by :func:`ctime`." +"If *secs* is not provided or :const:`None`, the current time as returned by :" +"func:`.time` is used. ``ctime(secs)`` is equivalent to " +"``asctime(localtime(secs))``. Locale information is not used by :func:" +"`ctime`." msgstr "" "如果未提供 *secs* 或其為 :const:`None`,則使用由 :func:`.time` 回傳的目前時" "間。``ctime(secs)`` 等同於 ``asctime(localtime(secs))``。:func:`ctime` 不使用" "區域資訊。" -#: ../../library/time.rst:225 +#: ../../library/time.rst:229 msgid "" "Get information on the specified clock as a namespace object. Supported " "clock names and the corresponding functions to read their value are:" @@ -360,31 +358,31 @@ msgstr "" "取得指定時鐘的資訊作為命名空間物件。支援的時鐘名稱及讀取他們的值的對應函式如" "下:" -#: ../../library/time.rst:229 +#: ../../library/time.rst:233 msgid "``'monotonic'``: :func:`time.monotonic`" msgstr "``'monotonic'``::func:`time.monotonic`" -#: ../../library/time.rst:230 +#: ../../library/time.rst:234 msgid "``'perf_counter'``: :func:`time.perf_counter`" msgstr "``'perf_counter'``::func:`time.perf_counter`" -#: ../../library/time.rst:231 +#: ../../library/time.rst:235 msgid "``'process_time'``: :func:`time.process_time`" msgstr "``'process_time'``::func:`time.process_time`" -#: ../../library/time.rst:232 +#: ../../library/time.rst:236 msgid "``'thread_time'``: :func:`time.thread_time`" msgstr "``'thread_time'``::func:`time.thread_time`" -#: ../../library/time.rst:233 +#: ../../library/time.rst:237 msgid "``'time'``: :func:`time.time`" msgstr "``'time'``::func:`time.time`" -#: ../../library/time.rst:235 +#: ../../library/time.rst:239 msgid "The result has the following attributes:" msgstr "其結果具有以下屬性:" -#: ../../library/time.rst:237 +#: ../../library/time.rst:241 msgid "" "*adjustable*: ``True`` if the clock can be changed automatically (e.g. by a " "NTP daemon) or manually by the system administrator, ``False`` otherwise" @@ -392,80 +390,80 @@ msgstr "" "*adjustable*: 如果時鐘可以自動(例如,透過 NTP 常駐程式)或由系統管理員手動更" "改,則為 ``True``,否則為 ``False``" -#: ../../library/time.rst:239 +#: ../../library/time.rst:243 msgid "" "*implementation*: The name of the underlying C function used to get the " "clock value. Refer to :ref:`time-clock-id-constants` for possible values." msgstr "" -"*implementation*: 用於取得時鐘的值的底層 C 函式名稱。有關可能的值,請參" -"閱 :ref:`time-clock-id-constants`。" +"*implementation*: 用於取得時鐘的值的底層 C 函式名稱。有關可能的值,請參閱 :" +"ref:`time-clock-id-constants`。" -#: ../../library/time.rst:241 +#: ../../library/time.rst:245 msgid "" "*monotonic*: ``True`` if the clock cannot go backward, ``False`` otherwise" msgstr "*monotonic*: 如果時鐘不能倒轉,則為 ``True``,否則為 ``False``" -#: ../../library/time.rst:243 +#: ../../library/time.rst:247 msgid "*resolution*: The resolution of the clock in seconds (:class:`float`)" msgstr "*resolution*: 以秒 (:class:`float`) 為單位的時鐘的解析度" -#: ../../library/time.rst:250 +#: ../../library/time.rst:254 msgid "" -"Convert a time expressed in seconds since the epoch_ to " -"a :class:`struct_time` in UTC in which the dst flag is always zero. If " -"*secs* is not provided or :const:`None`, the current time as returned " -"by :func:`.time` is used. Fractions of a second are ignored. See above for " -"a description of the :class:`struct_time` object. " -"See :func:`calendar.timegm` for the inverse of this function." +"Convert a time expressed in seconds since the epoch_ to a :class:" +"`struct_time` in UTC in which the dst flag is always zero. If *secs* is not " +"provided or :const:`None`, the current time as returned by :func:`.time` is " +"used. Fractions of a second are ignored. See above for a description of " +"the :class:`struct_time` object. See :func:`calendar.timegm` for the inverse " +"of this function." msgstr "" "將自 epoch_ 起以秒表示的時間轉換為 UTC 中的 :class:`struct_time`,其中 dst 旗" "標始終為零。如果未提供 *secs* 或其為 :const:`None`,則使用由 :func:`.time` 回" "傳的目前時間。忽略秒的分數部分。關於 :class:`struct_time` 物件的描述,請參閱" "上文。此函式的反運算請參閱 :func:`calendar.timegm`。" -#: ../../library/time.rst:260 +#: ../../library/time.rst:264 msgid "" "Like :func:`gmtime` but converts to local time. If *secs* is not provided " "or :const:`None`, the current time as returned by :func:`.time` is used. " "The dst flag is set to ``1`` when DST applies to the given time." msgstr "" -"類似於 :func:`gmtime`,但轉換為當地時間。如果未提供 *secs* 或其" -"為 :const:`None`,則使用由 :func:`.time` 回傳的目前時間。當 DST 適用於給定時" -"間時,dst 旗標會被設定為 ``1``。" +"類似於 :func:`gmtime`,但轉換為當地時間。如果未提供 *secs* 或其為 :const:" +"`None`,則使用由 :func:`.time` 回傳的目前時間。當 DST 適用於給定時間時,dst " +"旗標會被設定為 ``1``。" -#: ../../library/time.rst:264 +#: ../../library/time.rst:268 msgid "" ":func:`localtime` may raise :exc:`OverflowError`, if the timestamp is " "outside the range of values supported by the platform C :c:func:`localtime` " -"or :c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` " -"or :c:func:`gmtime` failure. It's common for this to be restricted to years " +"or :c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` or :" +"c:func:`gmtime` failure. It's common for this to be restricted to years " "between 1970 and 2038." msgstr "" "如果時間戳超出 C 平台的 :c:func:`localtime` 或 :c:func:`gmtime` 函式支援的範" -"圍,:func:`localtime` 可能會引發 :exc:`OverflowError`;" -"在 :c:func:`localtime` 或 :c:func:`gmtime` 失敗時,會引發 :exc:`OSError`。通" -"常會把年份限制在 1970 年到 2038 年之間。" +"圍,:func:`localtime` 可能會引發 :exc:`OverflowError`;在 :c:func:" +"`localtime` 或 :c:func:`gmtime` 失敗時,會引發 :exc:`OSError`。通常會把年份限" +"制在 1970 年到 2038 年之間。" -#: ../../library/time.rst:273 +#: ../../library/time.rst:277 msgid "" -"This is the inverse function of :func:`localtime`. Its argument is " -"the :class:`struct_time` or full 9-tuple (since the dst flag is needed; use " +"This is the inverse function of :func:`localtime`. Its argument is the :" +"class:`struct_time` or full 9-tuple (since the dst flag is needed; use " "``-1`` as the dst flag if it is unknown) which expresses the time in *local* " -"time, not UTC. It returns a floating-point number, for compatibility " -"with :func:`.time`. If the input value cannot be represented as a valid " -"time, either :exc:`OverflowError` or :exc:`ValueError` will be raised (which " +"time, not UTC. It returns a floating-point number, for compatibility with :" +"func:`.time`. If the input value cannot be represented as a valid time, " +"either :exc:`OverflowError` or :exc:`ValueError` will be raised (which " "depends on whether the invalid value is caught by Python or the underlying C " "libraries). The earliest date for which it can generate a time is platform-" "dependent." msgstr "" -"這是 :func:`localtime` 的反函式。其引數是表示\\ *當地*\\ 時間(不是 UTC)" -"的 :class:`struct_time` 或完整的 9 元組(因為需要 dst 旗標;如果 dst 為未知," -"則使用 ``-1`` 作為 dst 旗標)。它回傳一個浮點數,以與 :func:`.time` 相容。如" -"果輸入值不能表示為有效時間,將引發 :exc:`OverflowError` " -"或 :exc:`ValueError`\\ (取決於無效值是被 Python 還是底層 C 函式庫捕獲)。它" -"能生成時間的最早日期根據平台而有所不同。" +"這是 :func:`localtime` 的反函式。其引數是表示\\ *當地*\\ 時間(不是 UTC)的 :" +"class:`struct_time` 或完整的 9 元組(因為需要 dst 旗標;如果 dst 為未知,則使" +"用 ``-1`` 作為 dst 旗標)。它回傳一個浮點數,以與 :func:`.time` 相容。如果輸" +"入值不能表示為有效時間,將引發 :exc:`OverflowError` 或 :exc:`ValueError`\\ " +"(取決於無效值是被 Python 還是底層 C 函式庫捕獲)。它能生成時間的最早日期根據" +"平台而有所不同。" -#: ../../library/time.rst:285 +#: ../../library/time.rst:289 msgid "" "Return the value (in fractional seconds) of a monotonic clock, i.e. a clock " "that cannot go backwards. The clock is not affected by system clock " @@ -476,11 +474,11 @@ msgstr "" "示)。該時鐘不受系統時鐘更新的影響。回傳值的參考點沒有定義,因此只有兩次呼叫" "結果之間的差異才是有效的。" -#: ../../library/time.rst:290 ../../library/time.rst:709 +#: ../../library/time.rst:294 ../../library/time.rst:713 msgid "Clock:" msgstr "時鐘:" -#: ../../library/time.rst:292 +#: ../../library/time.rst:296 msgid "" "On Windows, call ``QueryPerformanceCounter()`` and " "``QueryPerformanceFrequency()``." @@ -488,42 +486,42 @@ msgstr "" "在 Windows 上,呼叫 ``QueryPerformanceCounter()`` 和 " "``QueryPerformanceFrequency()``。" -#: ../../library/time.rst:294 +#: ../../library/time.rst:298 msgid "On macOS, call ``mach_absolute_time()`` and ``mach_timebase_info()``." msgstr "" "在 macOS 上,呼叫 ``mach_absolute_time()`` 和 ``mach_timebase_info()``。" -#: ../../library/time.rst:295 +#: ../../library/time.rst:299 msgid "On HP-UX, call ``gethrtime()``." msgstr "在 HP-UX 上,呼叫 ``gethrtime()``。" -#: ../../library/time.rst:296 +#: ../../library/time.rst:300 msgid "Call ``clock_gettime(CLOCK_HIGHRES)`` if available." msgstr "如果可以的話,呼叫 ``clock_gettime(CLOCK_HIGHRES)``。" -#: ../../library/time.rst:297 +#: ../../library/time.rst:301 msgid "Otherwise, call ``clock_gettime(CLOCK_MONOTONIC)``." msgstr "否則,呼叫 ``clock_gettime(CLOCK_MONOTONIC)``。" -#: ../../library/time.rst:299 +#: ../../library/time.rst:303 msgid "" -"Use :func:`monotonic_ns` to avoid the precision loss caused by " -"the :class:`float` type." +"Use :func:`monotonic_ns` to avoid the precision loss caused by the :class:" +"`float` type." msgstr "使用 :func:`monotonic_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:304 +#: ../../library/time.rst:308 msgid "The function is now always available and always system-wide." msgstr "此函式現在始終可用且涵蓋整個系統。" -#: ../../library/time.rst:307 +#: ../../library/time.rst:311 msgid "On macOS, the function is now system-wide." msgstr "在 macOS 上,此函式現在涵蓋整個系統。" -#: ../../library/time.rst:313 +#: ../../library/time.rst:317 msgid "Similar to :func:`monotonic`, but return time as nanoseconds." msgstr "類似於 :func:`monotonic`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:322 +#: ../../library/time.rst:326 msgid "" "Return the value (in fractional seconds) of a performance counter, i.e. a " "clock with the highest available resolution to measure a short duration. It " @@ -535,7 +533,7 @@ msgstr "" "間隔的時鐘。它包括睡眠時經過的時間,並且涵蓋整個系統。回傳值的參考點沒有定" "義,因此只有兩次呼叫結果之間的差異才是有效的。" -#: ../../library/time.rst:330 +#: ../../library/time.rst:334 msgid "" "On CPython, use the same clock as :func:`time.monotonic` and is a monotonic " "clock, i.e. a clock that cannot go backwards." @@ -543,26 +541,26 @@ msgstr "" "在 CPython 上,使用與 :func:`time.monotonic` 相同的時鐘,且其為單調時鐘(即不" "能倒轉的時鐘)。" -#: ../../library/time.rst:333 +#: ../../library/time.rst:337 msgid "" -"Use :func:`perf_counter_ns` to avoid the precision loss caused by " -"the :class:`float` type." +"Use :func:`perf_counter_ns` to avoid the precision loss caused by the :class:" +"`float` type." msgstr "" "使用 :func:`perf_counter_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:338 +#: ../../library/time.rst:342 msgid "On Windows, the function is now system-wide." msgstr "在 Windows 上,此函式現在涵蓋整個系統。" -#: ../../library/time.rst:341 +#: ../../library/time.rst:345 msgid "Use the same clock as :func:`time.monotonic`." msgstr "使用與 :func:`time.monotonic` 相同的時鐘。" -#: ../../library/time.rst:347 +#: ../../library/time.rst:351 msgid "Similar to :func:`perf_counter`, but return time as nanoseconds." msgstr "類似於 :func:`perf_counter`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:359 +#: ../../library/time.rst:363 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current process. It does not include time elapsed during " @@ -574,18 +572,18 @@ msgstr "" "經過的時間。根據定義,它涵蓋整個行程。回傳值的參考點沒有定義,因此只有兩次呼" "叫結果之間的差異才是有效的。" -#: ../../library/time.rst:365 +#: ../../library/time.rst:369 msgid "" -"Use :func:`process_time_ns` to avoid the precision loss caused by " -"the :class:`float` type." +"Use :func:`process_time_ns` to avoid the precision loss caused by the :class:" +"`float` type." msgstr "" "使用 :func:`process_time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:372 +#: ../../library/time.rst:376 msgid "Similar to :func:`process_time` but return time as nanoseconds." msgstr "類似於 :func:`process_time`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:378 +#: ../../library/time.rst:382 msgid "" "Suspend execution of the calling thread for the given number of seconds. The " "argument may be a floating-point number to indicate a more precise sleep " @@ -594,7 +592,7 @@ msgstr "" "在一個給定的秒數內暫停呼叫執行緒 (calling thread) 的執行。引數可以是浮點數," "以表示更精確的睡眠時間。" -#: ../../library/time.rst:382 +#: ../../library/time.rst:386 msgid "" "If the sleep is interrupted by a signal and no exception is raised by the " "signal handler, the sleep is restarted with a recomputed timeout." @@ -602,17 +600,17 @@ msgstr "" "如果睡眠被訊號中斷且訊號處理器未引發例外,則睡眠將以重新計算過的逾時 " "(timeout) 重新開始。" -#: ../../library/time.rst:385 +#: ../../library/time.rst:389 msgid "" "The suspension time may be longer than requested by an arbitrary amount, " "because of the scheduling of other activity in the system." msgstr "由於系統中其他活動的調度,暫停時間可能會比請求的時間長任意的量。" -#: ../../library/time.rst:389 +#: ../../library/time.rst:393 msgid "Windows implementation" msgstr "Windows 實作" -#: ../../library/time.rst:390 +#: ../../library/time.rst:394 msgid "" "On Windows, if *secs* is zero, the thread relinquishes the remainder of its " "time slice to any other thread that is ready to run. If there are no other " @@ -628,34 +626,34 @@ msgstr "" "learn.microsoft.com/windows-hardware/drivers/kernel/high-resolution-" "timers>`_,其解析度為 100 奈秒。如果 *secs* 為零,則使用 ``Sleep(0)``。" -#: ../../library/time.rst:399 +#: ../../library/time.rst:403 msgid "Unix implementation" msgstr "Unix 實作" -#: ../../library/time.rst:400 +#: ../../library/time.rst:404 msgid "Use ``clock_nanosleep()`` if available (resolution: 1 nanosecond);" msgstr "如果可以,使用 ``clock_nanosleep()``\\ (解析度:1 奈秒);" -#: ../../library/time.rst:401 +#: ../../library/time.rst:405 msgid "Or use ``nanosleep()`` if available (resolution: 1 nanosecond);" msgstr "或者使用 ``nanosleep()``\\ (解析度:1 奈秒);" -#: ../../library/time.rst:402 +#: ../../library/time.rst:406 msgid "Or use ``select()`` (resolution: 1 microsecond)." msgstr "或使用 ``select()``\\ (解析度:1 微秒)。" -#: ../../library/time.rst:406 +#: ../../library/time.rst:410 msgid "" "To emulate a \"no-op\", use :keyword:`pass` instead of ``time.sleep(0)``." msgstr "" -#: ../../library/time.rst:408 +#: ../../library/time.rst:412 msgid "" "To voluntarily relinquish the CPU, specify a real-time :ref:`scheduling " "policy ` and use :func:`os.sched_yield` instead." msgstr "" -#: ../../library/time.rst:411 +#: ../../library/time.rst:415 msgid "" "Raises an :ref:`auditing event ` ``time.sleep`` with argument " "``secs``." @@ -663,7 +661,7 @@ msgstr "" "引發一個帶有引數 ``secs`` 的\\ :ref:`稽核事件 (auditing event) ` " "``time.sleep``。" -#: ../../library/time.rst:413 +#: ../../library/time.rst:417 msgid "" "The function now sleeps at least *secs* even if the sleep is interrupted by " "a signal, except if the signal handler raises an exception (see :pep:`475` " @@ -672,7 +670,7 @@ msgstr "" "即使睡眠被訊號中斷,此函式現在至少還是會睡眠 *secs*,除非訊號處理器引發例外" "(理由請參閱 :pep:`475`)。" -#: ../../library/time.rst:418 +#: ../../library/time.rst:422 msgid "" "On Unix, the ``clock_nanosleep()`` and ``nanosleep()`` functions are now " "used if available. On Windows, a waitable timer is now used." @@ -680,24 +678,24 @@ msgstr "" "在 Unix 上,如果可以的話現在會使用 ``clock_nanosleep()`` 和 ``nanosleep()`` " "函式。在 Windows 上,現在使用可等待的計時器。" -#: ../../library/time.rst:422 +#: ../../library/time.rst:426 msgid "Raises an auditing event." msgstr "引發一個稽核事件。" -#: ../../library/time.rst:430 +#: ../../library/time.rst:434 msgid "" -"Convert a tuple or :class:`struct_time` representing a time as returned " -"by :func:`gmtime` or :func:`localtime` to a string as specified by the " -"*format* argument. If *t* is not provided, the current time as returned " -"by :func:`localtime` is used. *format* must be a string. :exc:`ValueError` " -"is raised if any field in *t* is outside of the allowed range." +"Convert a tuple or :class:`struct_time` representing a time as returned by :" +"func:`gmtime` or :func:`localtime` to a string as specified by the *format* " +"argument. If *t* is not provided, the current time as returned by :func:" +"`localtime` is used. *format* must be a string. :exc:`ValueError` is " +"raised if any field in *t* is outside of the allowed range." msgstr "" -"將由 :func:`gmtime` 或 :func:`localtime` 回傳代表時間的一個元組" -"或 :class:`struct_time` 轉換為由 *format* 引數指定的字串。如果未提供 *t*,則" -"使用由 :func:`localtime` 回傳的目前時間。*format* 必須是一個字串。如果 *t* 中" -"的任何欄位超出允許範圍,將會引發 :exc:`ValueError`。" +"將由 :func:`gmtime` 或 :func:`localtime` 回傳代表時間的一個元組或 :class:" +"`struct_time` 轉換為由 *format* 引數指定的字串。如果未提供 *t*,則使用由 :" +"func:`localtime` 回傳的目前時間。*format* 必須是一個字串。如果 *t* 中的任何欄" +"位超出允許範圍,將會引發 :exc:`ValueError`。" -#: ../../library/time.rst:436 +#: ../../library/time.rst:440 msgid "" "0 is a legal argument for any position in the time tuple; if it is normally " "illegal the value is forced to a correct one." @@ -705,7 +703,7 @@ msgstr "" "0 在時間元組中的任何位置都是合法引數;如果元組中出現常見的錯誤,該值將被強制" "更改為正確的值。" -#: ../../library/time.rst:439 +#: ../../library/time.rst:443 msgid "" "The following directives can be embedded in the *format* string. They are " "shown without the optional field width and precision specification, and are " @@ -714,151 +712,151 @@ msgstr "" "以下指令可以嵌入在 *format* 字串中。它們顯示時不帶可選的欄位寬度和精度規範," "並在 :func:`strftime` 的結果中被標示的字元替換:" -#: ../../library/time.rst:444 +#: ../../library/time.rst:448 msgid "Directive" msgstr "指令" -#: ../../library/time.rst:444 +#: ../../library/time.rst:448 msgid "Meaning" msgstr "意義" -#: ../../library/time.rst:444 +#: ../../library/time.rst:448 msgid "Notes" msgstr "註解" -#: ../../library/time.rst:446 +#: ../../library/time.rst:450 msgid "``%a``" msgstr "``%a``" -#: ../../library/time.rst:446 +#: ../../library/time.rst:450 msgid "Locale's abbreviated weekday name." msgstr "區域設定的週間日 (weekday) 縮寫名稱。" -#: ../../library/time.rst:449 +#: ../../library/time.rst:453 msgid "``%A``" msgstr "``%A``" -#: ../../library/time.rst:449 +#: ../../library/time.rst:453 msgid "Locale's full weekday name." msgstr "區域設定的完整週間日名稱。" -#: ../../library/time.rst:451 +#: ../../library/time.rst:455 msgid "``%b``" msgstr "``%b``" -#: ../../library/time.rst:451 +#: ../../library/time.rst:455 msgid "Locale's abbreviated month name." msgstr "區域設定的縮寫月份名稱。" -#: ../../library/time.rst:454 +#: ../../library/time.rst:458 msgid "``%B``" msgstr "``%B``" -#: ../../library/time.rst:454 +#: ../../library/time.rst:458 msgid "Locale's full month name." msgstr "區域設定的完整月份名稱。" -#: ../../library/time.rst:456 +#: ../../library/time.rst:460 msgid "``%c``" msgstr "``%c``" -#: ../../library/time.rst:456 +#: ../../library/time.rst:460 msgid "Locale's appropriate date and time representation." msgstr "區域設定的合適的日期和時間的表示法。" -#: ../../library/time.rst:459 +#: ../../library/time.rst:463 msgid "``%d``" msgstr "``%d``" -#: ../../library/time.rst:459 +#: ../../library/time.rst:463 msgid "Day of the month as a decimal number [01,31]." msgstr "月份中的日期,表示為十進位數 [01,31]。" -#: ../../library/time.rst:462 +#: ../../library/time.rst:466 msgid "``%f``" msgstr "``%f``" -#: ../../library/time.rst:462 +#: ../../library/time.rst:466 msgid "Microseconds as a decimal number" msgstr "微秒,表示為十進位數" -#: ../../library/time.rst:463 +#: ../../library/time.rst:467 msgid "[000000,999999]." msgstr "[000000,999999]。" -#: ../../library/time.rst:462 +#: ../../library/time.rst:466 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/time.rst:466 +#: ../../library/time.rst:470 msgid "``%H``" msgstr "``%H``" -#: ../../library/time.rst:466 +#: ../../library/time.rst:470 msgid "Hour (24-hour clock) as a decimal number [00,23]." msgstr "小時(24 小時制),表示為十進位數 [00,23]。" -#: ../../library/time.rst:469 +#: ../../library/time.rst:473 msgid "``%I``" msgstr "``%I``" -#: ../../library/time.rst:469 +#: ../../library/time.rst:473 msgid "Hour (12-hour clock) as a decimal number [01,12]." msgstr "小時(12 小時制),表示為十進位數 [01,12]。" -#: ../../library/time.rst:472 +#: ../../library/time.rst:476 msgid "``%j``" msgstr "``%j``" -#: ../../library/time.rst:472 +#: ../../library/time.rst:476 msgid "Day of the year as a decimal number [001,366]." msgstr "一年中的第幾天,表示為十進位數 [001,366]。" -#: ../../library/time.rst:475 +#: ../../library/time.rst:479 msgid "``%m``" msgstr "``%m``" -#: ../../library/time.rst:475 +#: ../../library/time.rst:479 msgid "Month as a decimal number [01,12]." msgstr "月份,表示為十進位數 [01,12]。" -#: ../../library/time.rst:478 +#: ../../library/time.rst:482 msgid "``%M``" msgstr "``%M``" -#: ../../library/time.rst:478 +#: ../../library/time.rst:482 msgid "Minute as a decimal number [00,59]." msgstr "分鐘,表示為十進位數 [00,59]。" -#: ../../library/time.rst:481 +#: ../../library/time.rst:485 msgid "``%p``" msgstr "``%p``" -#: ../../library/time.rst:481 +#: ../../library/time.rst:485 msgid "Locale's equivalent of either AM or PM." msgstr "區域設定中相當於 AM 或 PM 的表示。" -#: ../../library/time.rst:481 +#: ../../library/time.rst:485 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/time.rst:484 +#: ../../library/time.rst:488 msgid "``%S``" msgstr "``%S``" -#: ../../library/time.rst:484 +#: ../../library/time.rst:488 msgid "Second as a decimal number [00,61]." msgstr "秒,表示為十進位數 [00,61]。" -#: ../../library/time.rst:484 +#: ../../library/time.rst:488 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/time.rst:487 +#: ../../library/time.rst:491 msgid "``%U``" msgstr "``%U``" -#: ../../library/time.rst:487 +#: ../../library/time.rst:491 msgid "" "Week number of the year (Sunday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Sunday are " @@ -867,31 +865,31 @@ msgstr "" "一年中的週數(星期天作為一週的第一天),表示為十進位數 [00,53]。新的一年中," "在第一個星期天之前的所有日子都被認定為第 0 週。" -#: ../../library/time.rst:487 ../../library/time.rst:501 +#: ../../library/time.rst:491 ../../library/time.rst:505 msgid "\\(4)" msgstr "\\(4)" -#: ../../library/time.rst:495 +#: ../../library/time.rst:499 msgid "``%u``" msgstr "``%u``" -#: ../../library/time.rst:495 +#: ../../library/time.rst:499 msgid "Day of the week (Monday is 1; Sunday is 7) as a decimal number [1, 7]." msgstr "一週中的日期(周一為 1;週日為 7),表示為十進位數 [1,7]。" -#: ../../library/time.rst:498 +#: ../../library/time.rst:502 msgid "``%w``" msgstr "``%w``" -#: ../../library/time.rst:498 +#: ../../library/time.rst:502 msgid "Weekday as a decimal number [0(Sunday),6]." msgstr "週間日,表示為十進位數 [0(星期天),6]。" -#: ../../library/time.rst:501 +#: ../../library/time.rst:505 msgid "``%W``" msgstr "``%W``" -#: ../../library/time.rst:501 +#: ../../library/time.rst:505 msgid "" "Week number of the year (Monday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Monday are " @@ -900,43 +898,43 @@ msgstr "" "一年中的週數(星期一作為一週的第一天),表示為十進位數 [00,53]。新的一年中," "在第一個星期一之前的所有日子都被認定為第 0 週。" -#: ../../library/time.rst:509 +#: ../../library/time.rst:513 msgid "``%x``" msgstr "``%x``" -#: ../../library/time.rst:509 +#: ../../library/time.rst:513 msgid "Locale's appropriate date representation." msgstr "區域設定的合適的日期表示法。" -#: ../../library/time.rst:512 +#: ../../library/time.rst:516 msgid "``%X``" msgstr "``%X``" -#: ../../library/time.rst:512 +#: ../../library/time.rst:516 msgid "Locale's appropriate time representation." msgstr "區域設定的合適的時間表示法。" -#: ../../library/time.rst:515 +#: ../../library/time.rst:519 msgid "``%y``" msgstr "``%y``" -#: ../../library/time.rst:515 +#: ../../library/time.rst:519 msgid "Year without century as a decimal number [00,99]." msgstr "去掉世紀的年份,表示為十進位數 [00,99]。" -#: ../../library/time.rst:518 +#: ../../library/time.rst:522 msgid "``%Y``" msgstr "``%Y``" -#: ../../library/time.rst:518 +#: ../../library/time.rst:522 msgid "Year with century as a decimal number." msgstr "帶世紀的年份,表示為十進位數。" -#: ../../library/time.rst:521 +#: ../../library/time.rst:525 msgid "``%z``" msgstr "``%z``" -#: ../../library/time.rst:521 +#: ../../library/time.rst:525 msgid "" "Time zone offset indicating a positive or negative time difference from UTC/" "GMT of the form +HHMM or -HHMM, where H represents decimal hour digits and M " @@ -945,19 +943,19 @@ msgstr "" "時區偏移量,表示與 UTC/GMT 的正或負時間差,形式為 +HHMM 或 -HHMM,其中 H 代表" "十進位的小時數碼 (digits),M 代表十進位的分鐘數碼 [-23:59, +23:59]。 [1]_" -#: ../../library/time.rst:527 +#: ../../library/time.rst:531 msgid "``%Z``" msgstr "``%Z``" -#: ../../library/time.rst:527 +#: ../../library/time.rst:531 msgid "Time zone name (no characters if no time zone exists). Deprecated. [1]_" msgstr "時區名稱(如果不存在時區,則無字元)。已被棄用。 [1]_" -#: ../../library/time.rst:530 +#: ../../library/time.rst:534 msgid "``%G``" msgstr "``%G``" -#: ../../library/time.rst:530 +#: ../../library/time.rst:534 msgid "" "ISO 8601 year (similar to ``%Y`` but follows the rules for the ISO 8601 " "calendar year). The year starts with the week that contains the first " @@ -966,11 +964,11 @@ msgstr "" "ISO 8601 年(類似於 ``%Y``,但遵循 ISO 8601 日曆年的規則)。年份從包含該日曆" "年第一個星期四的那一週開始。" -#: ../../library/time.rst:535 +#: ../../library/time.rst:539 msgid "``%V``" msgstr "``%V``" -#: ../../library/time.rst:535 +#: ../../library/time.rst:539 msgid "" "ISO 8601 week number (as a decimal number [01,53]). The first week of the " "year is the one that contains the first Thursday of the year. Weeks start on " @@ -979,30 +977,30 @@ msgstr "" "ISO 8601 週數(以十進位數表示 [01,53])。年份的第一週是包含該年第一個星期四的" "那一週。每週從星期一開始。" -#: ../../library/time.rst:540 +#: ../../library/time.rst:544 msgid "``%%``" msgstr "``%%``" -#: ../../library/time.rst:540 +#: ../../library/time.rst:544 msgid "A literal ``'%'`` character." msgstr "字面意義上的 ``'%'`` 字元。" -#: ../../library/time.rst:543 +#: ../../library/time.rst:547 msgid "Notes:" msgstr "註解:" -#: ../../library/time.rst:546 +#: ../../library/time.rst:550 msgid "" -"The ``%f`` format directive only applies to :func:`strptime`, not " -"to :func:`strftime`. However, see also :meth:`datetime.datetime.strptime` " -"and :meth:`datetime.datetime.strftime` where the ``%f`` format " -"directive :ref:`applies to microseconds `." +"The ``%f`` format directive only applies to :func:`strptime`, not to :func:" +"`strftime`. However, see also :meth:`datetime.datetime.strptime` and :meth:" +"`datetime.datetime.strftime` where the ``%f`` format directive :ref:`applies " +"to microseconds `." msgstr "" "``%f`` 格式的指令僅適用於 :func:`strptime`,不適用於 :func:`strftime`。然而," "在 :meth:`datetime.datetime.strptime` 和 :meth:`datetime.datetime.strftime` " "其中的 ``%f`` 格式的指令\\ :ref:`適用於微秒 `。" -#: ../../library/time.rst:552 +#: ../../library/time.rst:556 msgid "" "When used with the :func:`strptime` function, the ``%p`` directive only " "affects the output hour field if the ``%I`` directive is used to parse the " @@ -1011,7 +1009,7 @@ msgstr "" "當與 :func:`strptime` 函式一起使用時,``%p`` 指令僅在使用 ``%I`` 指令剖析小時" "時影響輸出小時的欄位。" -#: ../../library/time.rst:558 +#: ../../library/time.rst:562 msgid "" "The range really is ``0`` to ``61``; value ``60`` is valid in timestamps " "representing `leap seconds`_ and value ``61`` is supported for historical " @@ -1020,7 +1018,7 @@ msgstr "" "範圍確實是從 ``0`` 到 ``61``;數值 ``60`` 在表示 `leap seconds`_ 的時間戳中是" "有效的,而數值 ``61`` 是出於歷史因素而被支援。" -#: ../../library/time.rst:563 +#: ../../library/time.rst:567 msgid "" "When used with the :func:`strptime` function, ``%U`` and ``%W`` are only " "used in calculations when the day of the week and the year are specified." @@ -1028,7 +1026,7 @@ msgstr "" "當與 :func:`strptime` 函式一起使用時,``%U`` 和 ``%W`` 僅在指定週間的某天和年" "份時用於計算中。" -#: ../../library/time.rst:566 +#: ../../library/time.rst:570 msgid "" "Here is an example, a format for dates compatible with that specified in " "the :rfc:`2822` Internet email standard. [1]_ ::" @@ -1036,7 +1034,7 @@ msgstr "" "以下是一個範例,其為一種與 :rfc:`2822` 網際網路電子郵件標準中指定的日期格式兼" "容的格式。 [1]_: ::" -#: ../../library/time.rst:569 +#: ../../library/time.rst:573 msgid "" ">>> from time import gmtime, strftime\n" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" @@ -1046,17 +1044,17 @@ msgstr "" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" "'Thu, 28 Jun 2001 14:17:15 +0000'" -#: ../../library/time.rst:573 +#: ../../library/time.rst:577 msgid "" "Additional directives may be supported on certain platforms, but only the " "ones listed here have a meaning standardized by ANSI C. To see the full set " -"of format codes supported on your platform, consult " -"the :manpage:`strftime(3)` documentation." +"of format codes supported on your platform, consult the :manpage:" +"`strftime(3)` documentation." msgstr "" "某些平台可能支援額外的指令,但只有這裡列出的指令具有 ANSI C 標準化的意義。要" "查看你的平台上支援的完整格式碼集,請參閱 :manpage:`strftime(3)` 文件。" -#: ../../library/time.rst:578 +#: ../../library/time.rst:582 msgid "" "On some platforms, an optional field width and precision specification can " "immediately follow the initial ``'%'`` of a directive in the following " @@ -1066,23 +1064,23 @@ msgstr "" "在某些平台上,可選的欄位寬度和精度規範可以以此順序緊跟在指令初始的 ``'%'`` 之" "後;這也是不可攜 (portable) 的。欄位寬度通常為 2,除了 ``%j`` 為 3。" -#: ../../library/time.rst:589 +#: ../../library/time.rst:593 msgid "" "Parse a string representing a time according to a format. The return value " "is a :class:`struct_time` as returned by :func:`gmtime` or :func:`localtime`." msgstr "" -"根據格式剖析表示時間的字串。回傳值是 :class:`struct_time`,如同" -"由 :func:`gmtime` 或 :func:`localtime` 回傳的一樣。" +"根據格式剖析表示時間的字串。回傳值是 :class:`struct_time`,如同由 :func:" +"`gmtime` 或 :func:`localtime` 回傳的一樣。" -#: ../../library/time.rst:593 +#: ../../library/time.rst:597 msgid "" -"The *format* parameter uses the same directives as those used " -"by :func:`strftime`; it defaults to ``\"%a %b %d %H:%M:%S %Y\"`` which " -"matches the formatting returned by :func:`ctime`. If *string* cannot be " -"parsed according to *format*, or if it has excess data after " -"parsing, :exc:`ValueError` is raised. The default values used to fill in any " -"missing data when more accurate values cannot be inferred are ``(1900, 1, 1, " -"0, 0, 0, 0, 1, -1)``. Both *string* and *format* must be strings." +"The *format* parameter uses the same directives as those used by :func:" +"`strftime`; it defaults to ``\"%a %b %d %H:%M:%S %Y\"`` which matches the " +"formatting returned by :func:`ctime`. If *string* cannot be parsed according " +"to *format*, or if it has excess data after parsing, :exc:`ValueError` is " +"raised. The default values used to fill in any missing data when more " +"accurate values cannot be inferred are ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)``. " +"Both *string* and *format* must be strings." msgstr "" "*format* 參數使用與 :func:`strftime` 相同的指令;預設為 ``\"%a %b %d %H:%M:" "%S %Y\"``,與 :func:`ctime` 回傳的格式匹配。如果 *string* 無法根據 *format* " @@ -1090,11 +1088,11 @@ msgstr "" "時,用來填充任何缺失資料的預設值為 ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)``。" "*string* 和 *format* 都必須是字串。" -#: ../../library/time.rst:601 +#: ../../library/time.rst:605 msgid "For example:" msgstr "例如:" -#: ../../library/time.rst:608 +#: ../../library/time.rst:612 msgid "" "Support for the ``%Z`` directive is based on the values contained in " "``tzname`` and whether ``daylight`` is true. Because of this, it is " @@ -1105,7 +1103,7 @@ msgstr "" "因此,除了識別始終已知的 UTC 和 GMT(且被考慮為非日光節約時區)外,這是特定於" "平台的。" -#: ../../library/time.rst:613 +#: ../../library/time.rst:617 msgid "" "Only the directives specified in the documentation are supported. Because " "``strftime()`` is implemented per platform it can sometimes offer more " @@ -1117,121 +1115,121 @@ msgstr "" "提供比列出的還要更多的指令。但是 ``strptime()`` 與任何平台無關,因此不一定支" "援所有未記載為支援的指令。" -#: ../../library/time.rst:622 +#: ../../library/time.rst:626 msgid "" -"The type of the time value sequence returned " -"by :func:`gmtime`, :func:`localtime`, and :func:`strptime`. It is an object " -"with a :term:`named tuple` interface: values can be accessed by index and by " -"attribute name. The following values are present:" +"The type of the time value sequence returned by :func:`gmtime`, :func:" +"`localtime`, and :func:`strptime`. It is an object with a :term:`named " +"tuple` interface: values can be accessed by index and by attribute name. " +"The following values are present:" msgstr "" "由 :func:`gmtime`、:func:`localtime` 和 :func:`strptime` 回傳的時間值序列的型" "別。它是一個具有 :term:`named tuple` 介面的物件:值可以通過索引和屬性名稱存" "取。包含以下值:" -#: ../../library/time.rst:629 +#: ../../library/time.rst:633 msgid "Index" msgstr "索引" -#: ../../library/time.rst:630 +#: ../../library/time.rst:634 msgid "Attribute" msgstr "屬性" -#: ../../library/time.rst:631 +#: ../../library/time.rst:635 msgid "Values" msgstr "值" -#: ../../library/time.rst:633 +#: ../../library/time.rst:637 msgid "0" msgstr "0" -#: ../../library/time.rst:635 +#: ../../library/time.rst:639 msgid "(for example, 1993)" msgstr "(例如 1993)" -#: ../../library/time.rst:637 +#: ../../library/time.rst:641 msgid "1" msgstr "1" -#: ../../library/time.rst:639 +#: ../../library/time.rst:643 msgid "range [1, 12]" msgstr "範圍 [1, 12]" -#: ../../library/time.rst:641 +#: ../../library/time.rst:645 msgid "2" msgstr "2" -#: ../../library/time.rst:643 +#: ../../library/time.rst:647 msgid "range [1, 31]" msgstr "範圍 [1, 31]" -#: ../../library/time.rst:645 +#: ../../library/time.rst:649 msgid "3" msgstr "3" -#: ../../library/time.rst:647 +#: ../../library/time.rst:651 msgid "range [0, 23]" msgstr "範圍 [0, 23]" -#: ../../library/time.rst:649 +#: ../../library/time.rst:653 msgid "4" msgstr "4" -#: ../../library/time.rst:651 +#: ../../library/time.rst:655 msgid "range [0, 59]" msgstr "範圍 [0, 59]" -#: ../../library/time.rst:653 +#: ../../library/time.rst:657 msgid "5" msgstr "5" -#: ../../library/time.rst:655 +#: ../../library/time.rst:659 msgid "range [0, 61]; see :ref:`Note (2) ` in :func:`strftime`" msgstr "" "範圍 [0, 61];參見 :func:`strftime` 中的\\ :ref:`註釋 (2) `" -#: ../../library/time.rst:657 +#: ../../library/time.rst:661 msgid "6" msgstr "6" -#: ../../library/time.rst:659 +#: ../../library/time.rst:663 msgid "range [0, 6]; Monday is 0" msgstr "範圍 [0, 6];星期一是 0" -#: ../../library/time.rst:661 +#: ../../library/time.rst:665 msgid "7" msgstr "7" -#: ../../library/time.rst:663 +#: ../../library/time.rst:667 msgid "range [1, 366]" msgstr "範圍 [1, 366]" -#: ../../library/time.rst:665 +#: ../../library/time.rst:669 msgid "8" msgstr "8" -#: ../../library/time.rst:667 +#: ../../library/time.rst:671 msgid "0, 1 or -1; see below" msgstr "0、1 或 -1;見下文" -#: ../../library/time.rst:669 ../../library/time.rst:673 +#: ../../library/time.rst:673 ../../library/time.rst:677 msgid "N/A" msgstr "N/A" -#: ../../library/time.rst:671 +#: ../../library/time.rst:675 msgid "abbreviation of timezone name" msgstr "時區名稱的縮寫" -#: ../../library/time.rst:675 +#: ../../library/time.rst:679 msgid "offset east of UTC in seconds" msgstr "UTC 向東的偏移量(以秒為單位)" -#: ../../library/time.rst:677 +#: ../../library/time.rst:681 msgid "" "Note that unlike the C structure, the month value is a range of [1, 12], not " "[0, 11]." msgstr "請注意,與 C 結構不同,月份值的範圍是 [1, 12],而不是 [0, 11]。" -#: ../../library/time.rst:680 +#: ../../library/time.rst:684 msgid "" "In calls to :func:`mktime`, :attr:`tm_isdst` may be set to 1 when daylight " "savings time is in effect, and 0 when it is not. A value of -1 indicates " @@ -1241,28 +1239,28 @@ msgstr "" "在呼叫 :func:`mktime` 時,當日光節約時間生效的時候,:attr:`tm_isdst` 可以設定" "為 1,不生效時設定為 0。值 -1 表示未知是否生效,通常結果會填入正確的狀態。" -#: ../../library/time.rst:684 +#: ../../library/time.rst:688 msgid "" -"When a tuple with an incorrect length is passed to a function expecting " -"a :class:`struct_time`, or having elements of the wrong type, " -"a :exc:`TypeError` is raised." +"When a tuple with an incorrect length is passed to a function expecting a :" +"class:`struct_time`, or having elements of the wrong type, a :exc:" +"`TypeError` is raised." msgstr "" "當一個長度不正確的元組被傳遞給預期得到 :class:`struct_time` 的函式時,或者其" "中有元素型別錯誤時,將引發 :exc:`TypeError`。" -#: ../../library/time.rst:690 +#: ../../library/time.rst:694 msgid "" "Return the time in seconds since the epoch_ as a floating-point number. The " "handling of `leap seconds`_ is platform dependent. On Windows and most Unix " "systems, the leap seconds are not counted towards the time in seconds since " -"the epoch_. This is commonly referred to as `Unix time `_." +"the epoch_. This is commonly referred to as `Unix time `_." msgstr "" "回傳自 epoch_ 起的時間(秒)至今的浮點數。對 `leap seconds`_ 的處理是與平台有" "關的。在 Windows 和大多數 Unix 系統上,閏秒不計入自 epoch_ 起的秒數中。這通常" "被稱為 `Unix 時間 `_。" -#: ../../library/time.rst:696 +#: ../../library/time.rst:700 msgid "" "Note that even though the time is always returned as a floating-point " "number, not all systems provide time with a better precision than 1 second. " @@ -1274,45 +1272,45 @@ msgstr "" "間。雖然此函式通常回傳非遞減的值,但如果在兩次呼叫之間系統時鐘被回調,則它可" "能回傳比之前呼叫更小的值。" -#: ../../library/time.rst:702 +#: ../../library/time.rst:706 msgid "" "The number returned by :func:`.time` may be converted into a more common " -"time format (i.e. year, month, day, hour, etc...) in UTC by passing it " -"to :func:`gmtime` function or in local time by passing it to " -"the :func:`localtime` function. In both cases a :class:`struct_time` object " -"is returned, from which the components of the calendar date may be accessed " -"as attributes." +"time format (i.e. year, month, day, hour, etc...) in UTC by passing it to :" +"func:`gmtime` function or in local time by passing it to the :func:" +"`localtime` function. In both cases a :class:`struct_time` object is " +"returned, from which the components of the calendar date may be accessed as " +"attributes." msgstr "" "由 :func:`.time` 回傳的數字可以通過傳遞給 :func:`gmtime` 函式轉換為 UTC 內更" "常見的時間格式(即年、月、日、小時等)或通過傳遞給 :func:`localtime` 函式轉換" "為當地時間。在這兩種情況下都會回傳一個 :class:`struct_time` 物件,從中可以作" "為屬性存取日曆日期的組成部分。" -#: ../../library/time.rst:711 +#: ../../library/time.rst:715 msgid "On Windows, call ``GetSystemTimeAsFileTime()``." msgstr "在 Windows 上,呼叫 ``GetSystemTimeAsFileTime()``。" -#: ../../library/time.rst:712 +#: ../../library/time.rst:716 msgid "Call ``clock_gettime(CLOCK_REALTIME)`` if available." msgstr "如果可以的話,呼叫 ``clock_gettime(CLOCK_REALTIME)``。" -#: ../../library/time.rst:713 +#: ../../library/time.rst:717 msgid "Otherwise, call ``gettimeofday()``." msgstr "否則,呼叫 ``gettimeofday()``。" -#: ../../library/time.rst:715 +#: ../../library/time.rst:719 msgid "" "Use :func:`time_ns` to avoid the precision loss caused by the :class:`float` " "type." msgstr "使用 :func:`time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:721 +#: ../../library/time.rst:725 msgid "" "Similar to :func:`~time.time` but returns time as an integer number of " "nanoseconds since the epoch_." msgstr "類似於 :func:`~time.time`,但回傳自 epoch_ 起的以奈秒為單位的整數。" -#: ../../library/time.rst:734 +#: ../../library/time.rst:738 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current thread. It does not include time elapsed during " @@ -1324,22 +1322,22 @@ msgstr "" "期間經過的時間。根據定義,這是執行緒特定 (thread-specific) 的。回傳值的參照點" "未定義,因此只有同一執行緒中兩次呼叫結果之間的差異才是有效的。" -#: ../../library/time.rst:740 +#: ../../library/time.rst:744 msgid "" -"Use :func:`thread_time_ns` to avoid the precision loss caused by " -"the :class:`float` type." +"Use :func:`thread_time_ns` to avoid the precision loss caused by the :class:" +"`float` type." msgstr "" "使用 :func:`thread_time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:745 +#: ../../library/time.rst:749 msgid "Unix systems supporting ``CLOCK_THREAD_CPUTIME_ID``." msgstr "有支援 ``CLOCK_THREAD_CPUTIME_ID`` 的 Unix 系統。" -#: ../../library/time.rst:752 +#: ../../library/time.rst:756 msgid "Similar to :func:`thread_time` but return time as nanoseconds." msgstr "類似於 :func:`thread_time`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:759 +#: ../../library/time.rst:763 msgid "" "Reset the time conversion rules used by the library routines. The " "environment variable :envvar:`TZ` specifies how this is done. It will also " @@ -1356,51 +1354,51 @@ msgstr "" "``daylight``\\ (如果該時區沒有日光節約時間規則,則設定為 0;如果在過去、現在" "或未來的某個時間有日光節約時間規則,則設置為非零的值)。" -#: ../../library/time.rst:771 +#: ../../library/time.rst:775 msgid "" "Although in many cases, changing the :envvar:`TZ` environment variable may " -"affect the output of functions like :func:`localtime` without " -"calling :func:`tzset`, this behavior should not be relied on." +"affect the output of functions like :func:`localtime` without calling :func:" +"`tzset`, this behavior should not be relied on." msgstr "" "雖然在許多情況下,更改 :envvar:`TZ` 環境變數可能會在沒有呼叫 :func:`tzset` 的" "情況下影響 :func:`localtime` 等函式的輸出,但是這種行為是不該被依賴的。" -#: ../../library/time.rst:775 +#: ../../library/time.rst:779 msgid "The :envvar:`TZ` environment variable should contain no whitespace." msgstr ":envvar:`TZ` 環境變數不應包含空格字元。" -#: ../../library/time.rst:777 +#: ../../library/time.rst:781 msgid "" "The standard format of the :envvar:`TZ` environment variable is (whitespace " "added for clarity)::" msgstr "" ":envvar:`TZ` 環境變數的標準格式為(為了清楚表達,中間增加了空格字元): ::" -#: ../../library/time.rst:780 +#: ../../library/time.rst:784 msgid "std offset [dst [offset [,start[/time], end[/time]]]]" msgstr "std offset [dst [offset [,start[/time], end[/time]]]]" -#: ../../library/time.rst:782 +#: ../../library/time.rst:786 msgid "Where the components are:" msgstr "其中各個組成部分為:" -#: ../../library/time.rst:784 +#: ../../library/time.rst:788 msgid "``std`` and ``dst``" msgstr "``std`` 和 ``dst``" -#: ../../library/time.rst:785 +#: ../../library/time.rst:789 msgid "" "Three or more alphanumerics giving the timezone abbreviations. These will be " "propagated into time.tzname" msgstr "" -"三個或更多字母與數字 (alphanumerics) 組成的時區縮寫。這些縮寫會被傳播到 " -"time.tzname 中。" +"三個或更多字母與數字 (alphanumerics) 組成的時區縮寫。這些縮寫會被傳播到 time." +"tzname 中。" -#: ../../library/time.rst:788 +#: ../../library/time.rst:792 msgid "``offset``" msgstr "``offset``" -#: ../../library/time.rst:789 +#: ../../library/time.rst:793 msgid "" "The offset has the form: ``± hh[:mm[:ss]]``. This indicates the value added " "the local time to arrive at UTC. If preceded by a '-', the timezone is east " @@ -1411,22 +1409,22 @@ msgstr "" "果以 '-' 開頭,則表示該時區位於本初子午線以東;否則,位於其西。如果 dst 之後" "沒有偏移量,則假定日光時間比標準時間快一小時。" -#: ../../library/time.rst:794 +#: ../../library/time.rst:798 msgid "``start[/time], end[/time]``" msgstr "``start[/time], end[/time]``" -#: ../../library/time.rst:795 +#: ../../library/time.rst:799 msgid "" "Indicates when to change to and back from DST. The format of the start and " "end dates are one of the following:" msgstr "" "表示何時切換至日光節約時間及何時切換回來。開始和結束日期的格式如以下其一:" -#: ../../library/time.rst:798 +#: ../../library/time.rst:802 msgid ":samp:`J{n}`" msgstr ":samp:`J{n}`" -#: ../../library/time.rst:799 +#: ../../library/time.rst:803 msgid "" "The Julian day *n* (1 <= *n* <= 365). Leap days are not counted, so in all " "years February 28 is day 59 and March 1 is day 60." @@ -1434,22 +1432,22 @@ msgstr "" "儒略日 (Julian day) *n*(1 <= *n* <= 365)。閏日不計算,因此在所有年份中,2 " "月 28 日是第 59 天,3 月 1 日是第 60 天。" -#: ../../library/time.rst:802 +#: ../../library/time.rst:806 msgid ":samp:`{n}`" msgstr ":samp:`{n}`" -#: ../../library/time.rst:803 +#: ../../library/time.rst:807 msgid "" "The zero-based Julian day (0 <= *n* <= 365). Leap days are counted, and it " "is possible to refer to February 29." msgstr "" "從 0 開始的儒略日 (0 <= *n* <= 365)。閏日會計算,因此可以適用至 2 月 29 日。" -#: ../../library/time.rst:806 +#: ../../library/time.rst:810 msgid ":samp:`M{m}.{n}.{d}`" msgstr ":samp:`M{m}.{n}.{d}`" -#: ../../library/time.rst:807 +#: ../../library/time.rst:811 msgid "" "The *d*'th day (0 <= *d* <= 6) of week *n* of month *m* of the year (1 <= " "*n* <= 5, 1 <= *m* <= 12, where week 5 means \"the last *d* day in month " @@ -1460,7 +1458,7 @@ msgstr "" "*m* <= 12,其中 *n* 為 5 表示「該月的最後一個第 *d* 天」,這可能出現在第四或" "第五週)。第 1 週是 *d* 天首次出現的那一週。第零天為星期天。" -#: ../../library/time.rst:813 +#: ../../library/time.rst:817 msgid "" "``time`` has the same format as ``offset`` except that no leading sign ('-' " "or '+') is allowed. The default, if time is not given, is 02:00:00." @@ -1468,7 +1466,7 @@ msgstr "" "``time`` 的格式與 ``offset`` 相同,但不允許出現前導符號('-' 或 '+')。如果未" "指定時間,則預設為 02:00:00。" -#: ../../library/time.rst:818 +#: ../../library/time.rst:822 msgid "" ">>> os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0'\n" ">>> time.tzset()\n" @@ -1488,7 +1486,7 @@ msgstr "" ">>> time.strftime('%X %x %Z')\n" "'16:08:12 05/08/03 AEST'" -#: ../../library/time.rst:827 +#: ../../library/time.rst:831 msgid "" "On many Unix systems (including \\*BSD, Linux, Solaris, and Darwin), it is " "more convenient to use the system's zoneinfo (:manpage:`tzfile(5)`) " @@ -1505,7 +1503,7 @@ msgstr "" "Eastern'``、``'Australia/Melbourne'``、``'Egypt'`` 或 ``'Europe/" "Amsterdam'``。 ::" -#: ../../library/time.rst:835 +#: ../../library/time.rst:839 msgid "" ">>> os.environ['TZ'] = 'US/Eastern'\n" ">>> time.tzset()\n" @@ -1525,35 +1523,35 @@ msgstr "" ">>> time.tzname\n" "('EET', 'EEST')" -#: ../../library/time.rst:848 +#: ../../library/time.rst:852 msgid "Clock ID Constants" msgstr "時鐘 ID 常數" -#: ../../library/time.rst:850 +#: ../../library/time.rst:854 msgid "" -"These constants are used as parameters for :func:`clock_getres` " -"and :func:`clock_gettime`." +"These constants are used as parameters for :func:`clock_getres` and :func:" +"`clock_gettime`." msgstr "這些常數用作 :func:`clock_getres` 和 :func:`clock_gettime` 的參數。" -#: ../../library/time.rst:855 +#: ../../library/time.rst:859 msgid "" "Identical to :data:`CLOCK_MONOTONIC`, except it also includes any time that " "the system is suspended." msgstr "" "與 :data:`CLOCK_MONOTONIC` 基本相同,不同之處在於它還包括系統暫停的任何時間。" -#: ../../library/time.rst:858 +#: ../../library/time.rst:862 msgid "" "This allows applications to get a suspend-aware monotonic clock without " "having to deal with the complications of :data:`CLOCK_REALTIME`, which may " "have discontinuities if the time is changed using ``settimeofday()`` or " "similar." msgstr "" -"這允許應用程式取得一個能夠感知暫停的單調時鐘,而無需處" -"理 :data:`CLOCK_REALTIME` 的複雜情況,後者在使用 ``settimeofday()`` 或類似函" -"式更改時間時可能會出現不連續的情況。" +"這允許應用程式取得一個能夠感知暫停的單調時鐘,而無需處理 :data:" +"`CLOCK_REALTIME` 的複雜情況,後者在使用 ``settimeofday()`` 或類似函式更改時間" +"時可能會出現不連續的情況。" -#: ../../library/time.rst:870 +#: ../../library/time.rst:874 msgid "" "The Solaris OS has a ``CLOCK_HIGHRES`` timer that attempts to use an optimal " "hardware source, and may give close to nanosecond resolution. " @@ -1562,13 +1560,13 @@ msgstr "" "Solaris 作業系統具有 ``CLOCK_HIGHRES`` 計時器,它嘗試使用最佳的硬體資源,並可" "能提供接近奈秒的解析度。``CLOCK_HIGHRES`` 是不可調整且高解析度的時鐘。" -#: ../../library/time.rst:881 +#: ../../library/time.rst:885 msgid "" "Clock that cannot be set and represents monotonic time since some " "unspecified starting point." msgstr "該時鐘無法被設定,其表示自某個未指定起點以來的單調時間。" -#: ../../library/time.rst:891 +#: ../../library/time.rst:895 msgid "" "Similar to :data:`CLOCK_MONOTONIC`, but provides access to a raw hardware-" "based time that is not subject to NTP adjustments." @@ -1576,7 +1574,7 @@ msgstr "" "類似於 :data:`CLOCK_MONOTONIC`,但提供對基於硬體的原始時間的存取,此時間不受 " "NTP 調整的影響。" -#: ../../library/time.rst:900 +#: ../../library/time.rst:904 msgid "" "Similar to :data:`CLOCK_MONOTONIC_RAW`, but reads a value cached by the " "system at context switch and hence has less accuracy." @@ -1584,11 +1582,11 @@ msgstr "" "類似於 :data:`CLOCK_MONOTONIC_RAW`,但讀取的是系統在情境切換時快取的值,因此" "精準度較低。" -#: ../../library/time.rst:910 ../../library/time.rst:919 +#: ../../library/time.rst:914 ../../library/time.rst:923 msgid "High-resolution per-process timer from the CPU." msgstr "來自 CPU 的高解析度每個行程的計時器。" -#: ../../library/time.rst:927 +#: ../../library/time.rst:931 msgid "" "`International Atomic Time `_" @@ -1596,18 +1594,18 @@ msgstr "" "`國際原子時間 `_" -#: ../../library/time.rst:929 +#: ../../library/time.rst:933 msgid "" "The system must have a current leap second table in order for this to give " "the correct answer. PTP or NTP software can maintain a leap second table." msgstr "" "系統必須擁有目前的閏秒表才能給出正確答案。PTP 或 NTP 軟體可以維護閏秒表。" -#: ../../library/time.rst:938 +#: ../../library/time.rst:942 msgid "Thread-specific CPU-time clock." msgstr "執行緒相關的 CPU 時間時鐘。" -#: ../../library/time.rst:947 +#: ../../library/time.rst:951 msgid "" "Time whose absolute value is the time the system has been running and not " "suspended, providing accurate uptime measurement, both absolute and interval." @@ -1615,7 +1613,7 @@ msgstr "" "表示系統運作且無暫停的絕對時間,提供包括絕對時間 (absolute) 和時間區間 " "(interval) 的精確的正常上線時間 (uptime) 測量。" -#: ../../library/time.rst:958 +#: ../../library/time.rst:962 msgid "" "Clock that increments monotonically, tracking the time since an arbitrary " "point, unaffected by frequency or time adjustments and not incremented while " @@ -1624,7 +1622,7 @@ msgstr "" "單調增量的時鐘,從某個任意點開始計時,不受頻率或時間調整影響,並且在系統休眠" "時不增量。" -#: ../../library/time.rst:968 +#: ../../library/time.rst:972 msgid "" "Like :data:`CLOCK_UPTIME_RAW`, but the value is cached by the system at " "context switches and therefore has less accuracy." @@ -1632,23 +1630,23 @@ msgstr "" "類似於 :data:`CLOCK_UPTIME_RAW`,但該值在情境切換時由系統快取,因此精準度較" "低。" -#: ../../library/time.rst:975 +#: ../../library/time.rst:979 msgid "" -"The following constant is the only parameter that can be sent " -"to :func:`clock_settime`." +"The following constant is the only parameter that can be sent to :func:" +"`clock_settime`." msgstr "以下常數是唯一可以傳遞給 :func:`clock_settime` 的參數。" -#: ../../library/time.rst:981 +#: ../../library/time.rst:985 msgid "" "System-wide real-time clock. Setting this clock requires appropriate " "privileges." msgstr "涵蓋整個系統的即時時鐘。設定此時鐘需要適當的權限。" -#: ../../library/time.rst:992 +#: ../../library/time.rst:996 msgid "Timezone Constants" msgstr "時區常數" -#: ../../library/time.rst:996 +#: ../../library/time.rst:1000 msgid "" "The offset of the local DST timezone, in seconds west of UTC, if one is " "defined. This is negative if the local DST timezone is east of UTC (as in " @@ -1659,11 +1657,11 @@ msgstr "" "為單位)。若本地 DST 時區位於 UTC 以東(例如包括英國在內的西歐),則此值為負" "值。僅在 ``daylight`` 為非零時使用此值。詳情請參見下方註釋。" -#: ../../library/time.rst:1002 +#: ../../library/time.rst:1006 msgid "Nonzero if a DST timezone is defined. See note below." msgstr "如果定義了 DST 時區,則為非零值。詳情請參見下方註釋。" -#: ../../library/time.rst:1006 +#: ../../library/time.rst:1010 msgid "" "The offset of the local (non-DST) timezone, in seconds west of UTC (negative " "in most of Western Europe, positive in the US, zero in the UK). See note " @@ -1672,7 +1670,7 @@ msgstr "" "本地(非 DST)時區相對於 UTC 以西的偏移量(以秒為單位),西歐大多數地區為負," "美國為正,英國為零。詳情請參見下方註釋。" -#: ../../library/time.rst:1011 +#: ../../library/time.rst:1015 msgid "" "A tuple of two strings: the first is the name of the local non-DST timezone, " "the second is the name of the local DST timezone. If no DST timezone is " @@ -1681,48 +1679,46 @@ msgstr "" "一個包含兩個字串的元組:第一個是本地非 DST 時區的名稱,第二個是本地 DST 時區" "的名稱。如果沒有定義 DST 時區,則不應使用第二個字串。詳情請參見下方註釋。" -#: ../../library/time.rst:1017 +#: ../../library/time.rst:1021 msgid "" -"For the above Timezone constants " -"(:data:`altzone`, :data:`daylight`, :data:`timezone`, and :data:`tzname`), " -"the value is determined by the timezone rules in effect at module load time " -"or the last time :func:`tzset` is called and may be incorrect for times in " -"the past. It is recommended to use the :attr:`~struct_time.tm_gmtoff` " -"and :attr:`~struct_time.tm_zone` results from :func:`localtime` to obtain " -"timezone information." +"For the above Timezone constants (:data:`altzone`, :data:`daylight`, :data:" +"`timezone`, and :data:`tzname`), the value is determined by the timezone " +"rules in effect at module load time or the last time :func:`tzset` is called " +"and may be incorrect for times in the past. It is recommended to use the :" +"attr:`~struct_time.tm_gmtoff` and :attr:`~struct_time.tm_zone` results from :" +"func:`localtime` to obtain timezone information." msgstr "" -"對於上述時區常數(:data:`altzone`、:data:`daylight`、:data:`timezone` " -"和 :data:`tzname`),其值由模組載入時或 :func:`tzset` 最後一次被呼叫時的時區" -"規則決定,且過去的時間可能會不準確。建議使用 :func:`localtime` 回傳" -"的 :attr:`~struct_time.tm_gmtoff` 和 :attr:`~struct_time.tm_zone` 來取得時區" -"資訊。" +"對於上述時區常數(:data:`altzone`、:data:`daylight`、:data:`timezone` 和 :" +"data:`tzname`),其值由模組載入時或 :func:`tzset` 最後一次被呼叫時的時區規則" +"決定,且過去的時間可能會不準確。建議使用 :func:`localtime` 回傳的 :attr:" +"`~struct_time.tm_gmtoff` 和 :attr:`~struct_time.tm_zone` 來取得時區資訊。" -#: ../../library/time.rst:1026 +#: ../../library/time.rst:1030 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/time.rst:1027 +#: ../../library/time.rst:1031 msgid "More object-oriented interface to dates and times." msgstr "更多物件導向的日期和時間介面。" -#: ../../library/time.rst:1029 +#: ../../library/time.rst:1033 msgid "Module :mod:`locale`" msgstr ":mod:`locale` 模組" -#: ../../library/time.rst:1030 +#: ../../library/time.rst:1034 msgid "" "Internationalization services. The locale setting affects the " -"interpretation of many format specifiers in :func:`strftime` " -"and :func:`strptime`." +"interpretation of many format specifiers in :func:`strftime` and :func:" +"`strptime`." msgstr "" "國際化服務。區域設定會影響 :func:`strftime` 和 :func:`strptime` 中許多格式指" "定符號 (format specifiers) 的解譯。" -#: ../../library/time.rst:1033 +#: ../../library/time.rst:1037 msgid "Module :mod:`calendar`" msgstr ":mod:`calendar` 模組" -#: ../../library/time.rst:1034 +#: ../../library/time.rst:1038 msgid "" "General calendar-related functions. :func:`~calendar.timegm` is the " "inverse of :func:`gmtime` from this module." @@ -1730,11 +1726,11 @@ msgstr "" "通用的日曆相關函式。:func:`~calendar.timegm` 是本模組中 :func:`gmtime` 的反函" "式。" -#: ../../library/time.rst:1038 +#: ../../library/time.rst:1042 msgid "Footnotes" msgstr "註解" -#: ../../library/time.rst:1039 +#: ../../library/time.rst:1043 msgid "" "The use of ``%Z`` is now deprecated, but the ``%z`` escape that expands to " "the preferred hour/minute offset is not supported by all ANSI C libraries. " @@ -1774,27 +1770,35 @@ msgstr "Coordinated Universal Time(世界協調時間)" msgid "Greenwich Mean Time" msgstr "Greenwich Mean Time(格林威治標準時間)" -#: ../../library/time.rst:59 +#: ../../library/time.rst:63 msgid "Daylight Saving Time" msgstr "Daylight Saving Time(日光節約時間)" -#: ../../library/time.rst:319 ../../library/time.rst:354 -#: ../../library/time.rst:729 +#: ../../library/time.rst:323 ../../library/time.rst:358 +#: ../../library/time.rst:733 msgid "benchmarking" msgstr "benchmarking(基準測試)" -#: ../../library/time.rst:354 ../../library/time.rst:729 +#: ../../library/time.rst:358 ../../library/time.rst:733 msgid "CPU time" msgstr "CPU time(CPU 時間)" -#: ../../library/time.rst:354 ../../library/time.rst:729 +#: ../../library/time.rst:358 ../../library/time.rst:733 msgid "processor time" msgstr "processor time(處理器時間)" -#: ../../library/time.rst:425 ../../library/time.rst:584 +#: ../../library/time.rst:429 ../../library/time.rst:588 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/time.rst:425 ../../library/time.rst:584 +#: ../../library/time.rst:429 ../../library/time.rst:588 msgid "datetime format" msgstr "datetime format(日期時間格式)" + +#~ msgid "" +#~ "UTC is Coordinated Universal Time (formerly known as Greenwich Mean Time, " +#~ "or GMT). The acronym UTC is not a mistake but a compromise between " +#~ "English and French." +#~ msgstr "" +#~ "UTC 是 Coordinated Universal Time --- 世界協調時間(原稱為格林威治標準時" +#~ "間,或 GMT)。縮寫 UTC 並不是寫錯,而是英文和法文之間折衷的結果。" diff --git a/library/timeit.po b/library/timeit.po index 89f2f6c5da..a52e2b76e1 100644 --- a/library/timeit.po +++ b/library/timeit.po @@ -36,8 +36,8 @@ msgid "" "execution times. See also Tim Peters' introduction to the \"Algorithms\" " "chapter in the second edition of *Python Cookbook*, published by O'Reilly." msgstr "" -"該模組提供了一種對少量 Python 程式碼進行計時的簡單方法。它有一個\\ :ref:" -"`timeit-command-line-interface`\\ 和一個\\ :ref:`可呼叫介面 `,它避免了許多測量執行時間的常見陷阱。另請參閱由 O'Reilly 出版的 " "*Python 錦囊妙計 (Python Cookbook)* 第二版中 Tim Peters 所寫的「演算法」章節" "的介紹。" @@ -107,11 +107,11 @@ msgstr "" #: ../../library/timeit.rst:52 msgid "" "Note however that :func:`.timeit` will automatically determine the number of " -"repetitions only when the command-line interface is used. In the :ref:" -"`timeit-examples` section you can find more advanced examples." +"repetitions only when the command-line interface is used. In " +"the :ref:`timeit-examples` section you can find more advanced examples." msgstr "" -"但請注意,僅當使用命令列介面時 :func:`.timeit` 才會自動確定重複次數。在\\ :" -"ref:`timeit-examples`\\ 章節中有更進階的範例。" +"但請注意,僅當使用命令列介面時 :func:`.timeit` 才會自動確定重複次數。在" +"\\ :ref:`timeit-examples`\\ 章節中有更進階的範例。" #: ../../library/timeit.rst:60 msgid "Python Interface" @@ -157,8 +157,8 @@ msgid "" "The default timer, which is always time.perf_counter(), returns float " "seconds. An alternative, time.perf_counter_ns, returns integer nanoseconds." msgstr "" -"預設計時器始終為 time.perf_counter(),會回傳浮點秒數。另一種方法是 time." -"perf_counter_ns,會回傳整數奈秒。" +"預設計時器始終為 time.perf_counter(),會回傳浮點秒數。另一種方法是 " +"time.perf_counter_ns,會回傳整數奈秒。" #: ../../library/timeit.rst:95 msgid ":func:`time.perf_counter` is now the default timer." @@ -186,9 +186,9 @@ msgstr "" #: ../../library/timeit.rst:111 msgid "" -"To measure the execution time of the first statement, use the :meth:`." -"timeit` method. The :meth:`.repeat` and :meth:`.autorange` methods are " -"convenience methods to call :meth:`.timeit` multiple times." +"To measure the execution time of the first statement, use " +"the :meth:`.timeit` method. The :meth:`.repeat` and :meth:`.autorange` " +"methods are convenience methods to call :meth:`.timeit` multiple times." msgstr "" "要測量第一個陳述式的執行時間,請使用 :meth:`.timeit` 方法。:meth:`.repeat` " "和 :meth:`.autorange` 方法是多次呼叫 :meth:`.timeit` 的便捷方法。" @@ -313,6 +313,11 @@ msgid "" "except Exception:\n" " t.print_exc()" msgstr "" +"t = Timer(...) # 在 try/except 之外\n" +"try:\n" +" t.timeit(...) # 或 t.repeat(...)\n" +"except Exception:\n" +" t.print_exc()" #: ../../library/timeit.rst:199 msgid "" @@ -359,8 +364,8 @@ msgid "" "measure process time, not wallclock time, using :func:`time.process_time` " "instead of :func:`time.perf_counter`, which is the default" msgstr "" -"若要測量行程時間 (process time) 而非掛鐘時間 (wallclock time),請使用 :func:" -"`time.process_time` 而不是預設的 :func:`time.perf_counter`" +"若要測量行程時間 (process time) 而非掛鐘時間 (wallclock time),請使" +"用 :func:`time.process_time` 而不是預設的 :func:`time.perf_counter`" #: ../../library/timeit.rst:238 msgid "" @@ -401,15 +406,15 @@ msgstr "" msgid "" ":func:`default_timer` measurements can be affected by other programs running " "on the same machine, so the best thing to do when accurate timing is " -"necessary is to repeat the timing a few times and use the best time. The :" -"option:`-r` option is good for this; the default of 5 repetitions is " +"necessary is to repeat the timing a few times and use the best time. " +"The :option:`-r` option is good for this; the default of 5 repetitions is " "probably enough in most cases. You can use :func:`time.process_time` to " "measure CPU time." msgstr "" ":func:`default_timer` 測量可能會受到同一台機器上運行的其他程式的影響,因此," "當需要精確計時時,最好的做法是重複計時幾次並使用最佳時間。:option:`-r` 選項對" -"此很有用;在大多數情況下,預設的重複 5 次可能就足夠了。你可以使用 :func:" -"`time.process_time` 來測量 CPU 時間。" +"此很有用;在大多數情況下,預設的重複 5 次可能就足夠了。你可以使" +"用 :func:`time.process_time` 來測量 CPU 時間。" #: ../../library/timeit.rst:267 msgid "" @@ -437,15 +442,15 @@ msgid "" "$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"char in " "text\"\n" "5000000 loops, best of 5: 0.0877 usec per loop\n" -"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"text." -"find(char)\"\n" +"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" " +"\"text.find(char)\"\n" "1000000 loops, best of 5: 0.342 usec per loop" msgstr "" "$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"char in " "text\"\n" "5000000 loops, best of 5: 0.0877 usec per loop\n" -"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" \"text." -"find(char)\"\n" +"$ python -m timeit -s \"text = 'sample string'; char = 'g'\" " +"\"text.find(char)\"\n" "1000000 loops, best of 5: 0.342 usec per loop" #: ../../library/timeit.rst:287 @@ -507,11 +512,12 @@ msgstr "" #: ../../library/timeit.rst:312 msgid "" "The following examples show how to time expressions that contain multiple " -"lines. Here we compare the cost of using :func:`hasattr` vs. :keyword:`try`/:" -"keyword:`except` to test for missing and present object attributes:" +"lines. Here we compare the cost of using :func:`hasattr` " +"vs. :keyword:`try`/:keyword:`except` to test for missing and present object " +"attributes:" msgstr "" -"以下範例展示如何對包含多行的運算式進行計時。這裡我們使用 :func:`hasattr` 與 :" -"keyword:`try`/:keyword:`except` 來測試缺失和存在之物件屬性並比較其花費 " +"以下範例展示如何對包含多行的運算式進行計時。這裡我們使用 :func:`hasattr` " +"與 :keyword:`try`/:keyword:`except` 來測試缺失和存在之物件屬性並比較其花費 " "(cost):" #: ../../library/timeit.rst:316 @@ -614,6 +620,13 @@ msgid "" " import timeit\n" " print(timeit.timeit(\"test()\", setup=\"from __main__ import test\"))" msgstr "" +"def test():\n" +" \"\"\"一個笨笨的測試函式\"\"\"\n" +" L = [i for i in range(100)]\n" +"\n" +"if __name__ == '__main__':\n" +" import timeit\n" +" print(timeit.timeit(\"test()\", setup=\"from __main__ import test\"))" #: ../../library/timeit.rst:369 msgid "" diff --git a/library/tk.po b/library/tk.po index 7b366eefa0..5a3fc9a8d8 100644 --- a/library/tk.po +++ b/library/tk.po @@ -25,28 +25,27 @@ msgid "Graphical User Interfaces with Tk" msgstr "以 Tk 打造圖形使用者介面 (Graphical User Interfaces)" #: ../../library/tk.rst:13 -#, fuzzy msgid "" "Tk/Tcl has long been an integral part of Python. It provides a robust and " "platform independent windowing toolkit, that is available to Python " -"programmers using the :mod:`tkinter` package, and its extension, the :mod:" -"`tkinter.ttk` module." +"programmers using the :mod:`tkinter` package, and its extension, " +"the :mod:`tkinter.ttk` module." msgstr "" "Tk/Tcl 長期以來一直是 Python 不可或缺的一部分。它提供了一個強大且獨立於平台的" -"視窗工具包,可供使用 :mod:`tkinter` 套件及其擴充套件 :mod:`tkinter.tix` 和 :" -"mod:`tkinter.ttk` 模組的 Python 開發者使用。" +"視窗工具包,可供使用 :mod:`tkinter` 套件及其擴充套件 :mod:`tkinter.ttk` 模組" +"的 Python 開發者使用。" #: ../../library/tk.rst:17 msgid "" "The :mod:`tkinter` package is a thin object-oriented layer on top of Tcl/Tk. " "To use :mod:`tkinter`, you don't need to write Tcl code, but you will need " -"to consult the Tk documentation, and occasionally the Tcl documentation. :" -"mod:`tkinter` is a set of wrappers that implement the Tk widgets as Python " -"classes." +"to consult the Tk documentation, and occasionally the Tcl " +"documentation. :mod:`tkinter` is a set of wrappers that implement the Tk " +"widgets as Python classes." msgstr "" -":mod:`tkinter` 套件是 Tcl/Tk 之上的一個輕薄物件導向層。要使用 :mod:" -"`tkinter`,你不需要編寫 Tcl 程式,但會需要查閱 Tk 文件和部份 Tcl 文件。:mod:" -"`tkinter` 是一組將 Tk 小工具 (widget) 實作為 Python 類別的包裝器。" +":mod:`tkinter` 套件是 Tcl/Tk 之上的一個輕薄物件導向層。要使" +"用 :mod:`tkinter`,你不需要編寫 Tcl 程式,但會需要查閱 Tk 文件和部份 Tcl 文" +"件。:mod:`tkinter` 是一組將 Tk 小工具 (widget) 實作為 Python 類別的包裝器。" #: ../../library/tk.rst:23 msgid "" @@ -60,10 +59,10 @@ msgid "" "GuiProgramming>`_." msgstr "" ":mod:`tkinter` 的主要優點是速度快,而且通常與 Python 捆綁 (bundle) 在一起。儘" -"管其標準文件不是很完整,但還是有些不錯的材料,包括:參考資料、教學、書籍等。:" -"mod:`tkinter` 曾因其過時的外觀而眾所皆知,但這在 Tk 8.5 中得到了極大的改進。" -"此外,還有許多其他你可能會感興趣的 GUI 函式庫。Python wiki 列出了幾個替代的 " -"`GUI 框架和工具 `_。" +"管其標準文件不是很完整,但還是有些不錯的材料,包括:參考資料、教學、書籍" +"等。:mod:`tkinter` 曾因其過時的外觀而眾所皆知,但這在 Tk 8.5 中得到了極大的改" +"進。此外,還有許多其他你可能會感興趣的 GUI 函式庫。Python wiki 列出了幾個替代" +"的 `GUI 框架和工具 `_。" #: ../../library/tk.rst:7 msgid "GUI" diff --git a/library/tkinter.ttk.po b/library/tkinter.ttk.po index 52ae5a7140..6dc7058647 100644 --- a/library/tkinter.ttk.po +++ b/library/tkinter.ttk.po @@ -77,11 +77,9 @@ msgstr "" #: ../../library/tkinter.ttk.rst:43 msgid "" -"That code causes several :mod:`tkinter.ttk` widgets (:class:`Button`, :class:" -"`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:`Label`, :class:" -"`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, :class:" -"`Radiobutton`, :class:`Scale` and :class:`Scrollbar`) to automatically " -"replace the Tk widgets." +"That code causes several :mod:`tkinter.ttk` widgets " +"(:class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, :class:`Radiobutton`, :class:`Scale` " +"and :class:`Scrollbar`) to automatically replace the Tk widgets." msgstr "" #: ../../library/tkinter.ttk.rst:49 @@ -96,8 +94,8 @@ msgstr "" #: ../../library/tkinter.ttk.rst:59 msgid "" -"`Converting existing applications to use Tile widgets `_" +"`Converting existing applications to use Tile widgets `_" msgstr "" #: ../../library/tkinter.ttk.rst:60 @@ -112,13 +110,11 @@ msgstr "" #: ../../library/tkinter.ttk.rst:67 msgid "" -"Ttk comes with 18 widgets, twelve of which already existed in tkinter: :" -"class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:" -"`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, :" -"class:`Radiobutton`, :class:`Scale`, :class:`Scrollbar`, and :class:" -"`Spinbox`. The other six are new: :class:`Combobox`, :class:`Notebook`, :" -"class:`Progressbar`, :class:`Separator`, :class:`Sizegrip` and :class:" -"`Treeview`. And all them are subclasses of :class:`Widget`." +"Ttk comes with 18 widgets, twelve of which already existed in " +"tkinter: :class:`Button`, :class:`Checkbutton`, :class:`Entry`, :class:`Frame`, :class:`Label`, :class:`LabelFrame`, :class:`Menubutton`, :class:`PanedWindow`, :class:`Radiobutton`, :class:`Scale`, :class:`Scrollbar`, " +"and :class:`Spinbox`. The other six are " +"new: :class:`Combobox`, :class:`Notebook`, :class:`Progressbar`, :class:`Separator`, :class:`Sizegrip` " +"and :class:`Treeview`. And all them are subclasses of :class:`Widget`." msgstr "" #: ../../library/tkinter.ttk.rst:75 @@ -537,11 +533,10 @@ msgstr "" #: ../../library/tkinter.ttk.rst:300 msgid "" -"Besides the methods inherited from :class:`Widget`: :meth:`Widget.cget`, :" -"meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate` " -"and :meth:`Widget.state`, and the following inherited from :class:`Entry`: :" -"meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, :meth:`Entry." -"index`, :meth:`Entry.insert`, :meth:`Entry.selection`, :meth:`Entry.xview`, " +"Besides the methods inherited " +"from :class:`Widget`: :meth:`Widget.cget`, :meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate` " +"and :meth:`Widget.state`, and the following inherited " +"from :class:`Entry`: :meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, :meth:`Entry.index`, :meth:`Entry.insert`, :meth:`Entry.selection`, :meth:`Entry.xview`, " "it has some other methods, described at :class:`ttk.Combobox`." msgstr "" @@ -669,12 +664,11 @@ msgstr "" #: ../../library/tkinter.ttk.rst:388 msgid "" -"Besides the methods inherited from :class:`Widget`: :meth:`Widget.cget`, :" -"meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate` " -"and :meth:`Widget.state`, and the following inherited from :class:`Entry`: :" -"meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, :meth:`Entry." -"index`, :meth:`Entry.insert`, :meth:`Entry.xview`, it has some other " -"methods, described at :class:`ttk.Spinbox`." +"Besides the methods inherited " +"from :class:`Widget`: :meth:`Widget.cget`, :meth:`Widget.configure`, :meth:`Widget.identify`, :meth:`Widget.instate` " +"and :meth:`Widget.state`, and the following inherited " +"from :class:`Entry`: :meth:`Entry.bbox`, :meth:`Entry.delete`, :meth:`Entry.icursor`, :meth:`Entry.index`, :meth:`Entry.insert`, :meth:`Entry.xview`, " +"it has some other methods, described at :class:`ttk.Spinbox`." msgstr "" #: ../../library/tkinter.ttk.rst:405 @@ -842,8 +836,8 @@ msgstr "" #: ../../library/tkinter.ttk.rst:523 msgid "" -"Specifies an image to display in the tab. See the option image described in :" -"class:`Widget`." +"Specifies an image to display in the tab. See the option image described " +"in :class:`Widget`." msgstr "" #: ../../library/tkinter.ttk.rst:526 @@ -855,8 +849,8 @@ msgstr "" #: ../../library/tkinter.ttk.rst:530 msgid "" "Specifies the index (0-based) of a character to underline in the text " -"string. The underlined character is used for mnemonic activation if :meth:" -"`Notebook.enable_traversal` is called." +"string. The underlined character is used for mnemonic activation " +"if :meth:`Notebook.enable_traversal` is called." msgstr "" #: ../../library/tkinter.ttk.rst:538 @@ -1112,9 +1106,9 @@ msgstr "ttk.Progressbar" #: ../../library/tkinter.ttk.rst:705 msgid "" -"Begin autoincrement mode: schedules a recurring timer event that calls :meth:" -"`Progressbar.step` every *interval* milliseconds. If omitted, *interval* " -"defaults to 50 milliseconds." +"Begin autoincrement mode: schedules a recurring timer event that " +"calls :meth:`Progressbar.step` every *interval* milliseconds. If omitted, " +"*interval* defaults to 50 milliseconds." msgstr "" #: ../../library/tkinter.ttk.rst:712 @@ -1127,8 +1121,8 @@ msgstr "" #: ../../library/tkinter.ttk.rst:719 msgid "" -"Stop autoincrement mode: cancels any recurring timer event initiated by :" -"meth:`Progressbar.start` for this progress bar." +"Stop autoincrement mode: cancels any recurring timer event initiated " +"by :meth:`Progressbar.start` for this progress bar." msgstr "" #: ../../library/tkinter.ttk.rst:724 @@ -1235,8 +1229,8 @@ msgstr "" #: ../../library/tkinter.ttk.rst:795 msgid "" "The Treeview widget supports horizontal and vertical scrolling, according to " -"the options described in `Scrollable Widget Options`_ and the methods :meth:" -"`Treeview.xview` and :meth:`Treeview.yview`." +"the options described in `Scrollable Widget Options`_ and the " +"methods :meth:`Treeview.xview` and :meth:`Treeview.yview`." msgstr "" #: ../../library/tkinter.ttk.rst:810 @@ -1909,8 +1903,8 @@ msgid "" "elements making up the widget and how they are arranged, along with dynamic " "and default settings for element options. By default the style name is the " "same as the widget's class name, but it may be overridden by the widget's " -"style option. If you don't know the class name of a widget, use the method :" -"meth:`Misc.winfo_class` (somewidget.winfo_class())." +"style option. If you don't know the class name of a widget, use the " +"method :meth:`Misc.winfo_class` (somewidget.winfo_class())." msgstr "" #: ../../library/tkinter.ttk.rst:1275 @@ -2245,9 +2239,8 @@ msgid "" msgstr "" #: ../../library/tkinter.ttk.rst:1465 -#, fuzzy msgid "margins=padding" -msgstr "padding=padding" +msgstr "margins=padding" #: ../../library/tkinter.ttk.rst:1466 msgid "" @@ -2318,9 +2311,9 @@ msgstr "" msgid "" "Each key in *settings* is a style and each value may contain the keys " "'configure', 'map', 'layout' and 'element create' and they are expected to " -"have the same format as specified by the methods :meth:`Style.configure`, :" -"meth:`Style.map`, :meth:`Style.layout` and :meth:`Style.element_create` " -"respectively." +"have the same format as specified by the " +"methods :meth:`Style.configure`, :meth:`Style.map`, :meth:`Style.layout` " +"and :meth:`Style.element_create` respectively." msgstr "" #: ../../library/tkinter.ttk.rst:1532 diff --git a/library/token.po b/library/token.po index de853e2c2d..28c57739a7 100644 --- a/library/token.po +++ b/library/token.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-30 23:07+0000\n" +"POT-Creation-Date: 2025-03-25 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,273 +41,425 @@ msgid "" "functions. The functions mirror definitions in the Python C header files." msgstr "" -#: ../../library/token.rst:25 +#: ../../library/token.rst:22 +msgid "" +"Note that a token's value may depend on tokenizer options. For example, a " +"``\"+\"`` token may be reported as either :data:`PLUS` or :data:`OP`, or a " +"``\"match\"`` token may be either :data:`NAME` or :data:`SOFT_KEYWORD`." +msgstr "" + +#: ../../library/token.rst:29 msgid "" "Dictionary mapping the numeric values of the constants defined in this " "module back to name strings, allowing more human-readable representation of " "parse trees to be generated." msgstr "" -#: ../../library/token.rst:32 +#: ../../library/token.rst:36 msgid "Return ``True`` for terminal token values." msgstr "" -#: ../../library/token.rst:37 +#: ../../library/token.rst:41 msgid "Return ``True`` for non-terminal token values." msgstr "" -#: ../../library/token.rst:42 +#: ../../library/token.rst:46 msgid "Return ``True`` if *x* is the marker indicating the end of input." msgstr "" -#: ../../library/token.rst:45 +#: ../../library/token.rst:49 msgid "The token constants are:" msgstr "" -#: ../../library/token-list.inc:18 -msgid "Token value for ``\"(\"``." +#: ../../library/token.rst:53 +msgid "" +"Token value that indicates an :ref:`identifier `. Note that " +"keywords are also initially tokenized an ``NAME`` tokens." msgstr "" -#: ../../library/token-list.inc:22 -msgid "Token value for ``\")\"``." +#: ../../library/token.rst:58 +msgid "Token value that indicates a :ref:`numeric literal `" msgstr "" -#: ../../library/token-list.inc:26 -msgid "Token value for ``\"[\"``." +#: ../../library/token.rst:62 +msgid "" +"Token value that indicates a :ref:`string or byte literal `, " +"excluding :ref:`formatted string literals `. The token string is " +"not interpreted: it includes the surrounding quotation marks and the prefix " +"(if given); backslashes are included literally, without processing escape " +"sequences." msgstr "" -#: ../../library/token-list.inc:30 -msgid "Token value for ``\"]\"``." +#: ../../library/token.rst:70 +msgid "" +"A generic token value that indicates an :ref:`operator ` or :ref:" +"`delimiter `." msgstr "" -#: ../../library/token-list.inc:34 -msgid "Token value for ``\":\"``." +#: ../../library/token.rst:75 +msgid "" +"This value is only reported by the :mod:`tokenize` module. Internally, the " +"tokenizer uses :ref:`exact token types ` instead." msgstr "" -#: ../../library/token-list.inc:38 -msgid "Token value for ``\",\"``." +#: ../../library/token.rst:81 +msgid "" +"Token value used to indicate a comment. The parser ignores :data:`!COMMENT` " +"tokens." msgstr "" -#: ../../library/token-list.inc:42 -msgid "Token value for ``\";\"``." +#: ../../library/token.rst:86 +msgid "" +"Token value that indicates the end of a :ref:`logical line `." msgstr "" -#: ../../library/token-list.inc:46 -msgid "Token value for ``\"+\"``." +#: ../../library/token.rst:90 +msgid "" +"Token value used to indicate a non-terminating newline. :data:`!NL` tokens " +"are generated when a logical line of code is continued over multiple " +"physical lines. The parser ignores :data:`!NL` tokens." msgstr "" -#: ../../library/token-list.inc:50 -msgid "Token value for ``\"-\"``." +#: ../../library/token.rst:96 +msgid "" +"Token value used at the beginning of a :ref:`logical line ` " +"to indicate the start of an :ref:`indented block `." msgstr "" -#: ../../library/token-list.inc:54 -msgid "Token value for ``\"*\"``." +#: ../../library/token.rst:101 +msgid "" +"Token value used at the beginning of a :ref:`logical line ` " +"to indicate the end of an :ref:`indented block `." msgstr "" -#: ../../library/token-list.inc:58 -msgid "Token value for ``\"/\"``." +#: ../../library/token.rst:106 +msgid "" +"Token value used to indicate the beginning of an :ref:`f-string literal `." msgstr "" -#: ../../library/token-list.inc:62 -msgid "Token value for ``\"|\"``." +#: ../../library/token.rst:111 +msgid "" +"The token string includes the prefix and the opening quote(s), but none of " +"the contents of the literal." msgstr "" -#: ../../library/token-list.inc:66 -msgid "Token value for ``\"&\"``." +#: ../../library/token.rst:116 +msgid "" +"Token value used for literal text inside an :ref:`f-string literal `, including format specifications." msgstr "" -#: ../../library/token-list.inc:70 -msgid "Token value for ``\"<\"``." +#: ../../library/token.rst:121 +msgid "" +"Replacement fields (that is, the non-literal parts of f-strings) use the " +"same tokens as other expressions, and are delimited by :data:`LBRACE`, :data:" +"`RBRACE`, :data:`EXCLAMATION` and :data:`COLON` tokens." msgstr "" -#: ../../library/token-list.inc:74 -msgid "Token value for ``\">\"``." +#: ../../library/token.rst:128 +msgid "Token value used to indicate the end of a :ref:`f-string `." msgstr "" -#: ../../library/token-list.inc:78 -msgid "Token value for ``\"=\"``." +#: ../../library/token.rst:132 +msgid "The token string contains the closing quote(s)." msgstr "" -#: ../../library/token-list.inc:82 -msgid "Token value for ``\".\"``." +#: ../../library/token.rst:136 +msgid "Token value that indicates the end of input." msgstr "" -#: ../../library/token-list.inc:86 -msgid "Token value for ``\"%\"``." +#: ../../library/token.rst:140 +msgid "" +"Token value that indicates the encoding used to decode the source bytes into " +"text. The first token returned by :func:`tokenize.tokenize` will always be " +"an ``ENCODING`` token." msgstr "" -#: ../../library/token-list.inc:90 -msgid "Token value for ``\"{\"``." +#: ../../library/token.rst:146 +msgid "" +"This token type isn't used by the C tokenizer but is needed for the :mod:" +"`tokenize` module." msgstr "" -#: ../../library/token-list.inc:94 -msgid "Token value for ``\"}\"``." +#: ../../library/token.rst:150 +msgid "" +"The following token types are not produced by the :mod:`tokenize` module, " +"and are defined for special uses in the tokenizer or parser:" msgstr "" -#: ../../library/token-list.inc:98 -msgid "Token value for ``\"==\"``." +#: ../../library/token.rst:155 +msgid "" +"Token value indicating that a ``type: ignore`` comment was recognized. Such " +"tokens are produced instead of regular :data:`COMMENT` tokens only with the :" +"data:`~ast.PyCF_TYPE_COMMENTS` flag." msgstr "" -#: ../../library/token-list.inc:102 -msgid "Token value for ``\"!=\"``." +#: ../../library/token.rst:161 +msgid "" +"Token value indicating that a type comment was recognized. Such tokens are " +"produced instead of regular :data:`COMMENT` tokens only with the :data:`~ast." +"PyCF_TYPE_COMMENTS` flag." msgstr "" -#: ../../library/token-list.inc:106 -msgid "Token value for ``\"<=\"``." +#: ../../library/token.rst:167 +msgid "Token value indicating a :ref:`soft keyword `." msgstr "" -#: ../../library/token-list.inc:110 -msgid "Token value for ``\">=\"``." +#: ../../library/token.rst:169 +msgid "" +"The tokenizer never produces this value. To check for a soft keyword, pass " +"a :data:`NAME` token's string to :func:`keyword.issoftkeyword`." msgstr "" -#: ../../library/token-list.inc:114 -msgid "Token value for ``\"~\"``." +#: ../../library/token.rst:175 +msgid "Token value used to indicate wrong input." msgstr "" -#: ../../library/token-list.inc:118 -msgid "Token value for ``\"^\"``." +#: ../../library/token.rst:177 +msgid "" +"The :mod:`tokenize` module generally indicates errors by raising exceptions " +"instead of emitting this token. It can also emit tokens such as :data:`OP` " +"or :data:`NAME` with strings that are later rejected by the parser." msgstr "" -#: ../../library/token-list.inc:122 -msgid "Token value for ``\"<<\"``." +#: ../../library/token.rst:185 +msgid "" +"The remaining tokens represent specific :ref:`operators ` and :" +"ref:`delimiters `. (The :mod:`tokenize` module reports these as :" +"data:`OP`; see ``exact_type`` in the :mod:`tokenize` documentation for " +"details.)" msgstr "" -#: ../../library/token-list.inc:126 -msgid "Token value for ``\">>\"``." +#: ../../library/token-list.inc:7 +msgid "Token" msgstr "" -#: ../../library/token-list.inc:130 -msgid "Token value for ``\"**\"``." +#: ../../library/token-list.inc:8 +msgid "Value" msgstr "" -#: ../../library/token-list.inc:134 -msgid "Token value for ``\"+=\"``." +#: ../../library/token-list.inc:10 +msgid "``\"(\"``" msgstr "" -#: ../../library/token-list.inc:138 -msgid "Token value for ``\"-=\"``." +#: ../../library/token-list.inc:12 +msgid "``\")\"``" msgstr "" -#: ../../library/token-list.inc:142 -msgid "Token value for ``\"*=\"``." +#: ../../library/token-list.inc:14 +msgid "``\"[\"``" msgstr "" -#: ../../library/token-list.inc:146 -msgid "Token value for ``\"/=\"``." +#: ../../library/token-list.inc:16 +msgid "``\"]\"``" msgstr "" -#: ../../library/token-list.inc:150 -msgid "Token value for ``\"%=\"``." +#: ../../library/token-list.inc:18 +msgid "``\":\"``" msgstr "" -#: ../../library/token-list.inc:154 -msgid "Token value for ``\"&=\"``." +#: ../../library/token-list.inc:20 +msgid "``\",\"``" msgstr "" -#: ../../library/token-list.inc:158 -msgid "Token value for ``\"|=\"``." +#: ../../library/token-list.inc:22 +msgid "``\";\"``" msgstr "" -#: ../../library/token-list.inc:162 -msgid "Token value for ``\"^=\"``." +#: ../../library/token-list.inc:24 +msgid "``\"+\"``" msgstr "" -#: ../../library/token-list.inc:166 -msgid "Token value for ``\"<<=\"``." +#: ../../library/token-list.inc:26 +msgid "``\"-\"``" msgstr "" -#: ../../library/token-list.inc:170 -msgid "Token value for ``\">>=\"``." +#: ../../library/token-list.inc:28 +msgid "``\"*\"``" msgstr "" -#: ../../library/token-list.inc:174 -msgid "Token value for ``\"**=\"``." +#: ../../library/token-list.inc:30 +msgid "``\"/\"``" msgstr "" -#: ../../library/token-list.inc:178 -msgid "Token value for ``\"//\"``." +#: ../../library/token-list.inc:32 +msgid "``\"|\"``" msgstr "" -#: ../../library/token-list.inc:182 -msgid "Token value for ``\"//=\"``." +#: ../../library/token-list.inc:34 +msgid "``\"&\"``" msgstr "" -#: ../../library/token-list.inc:186 -msgid "Token value for ``\"@\"``." +#: ../../library/token-list.inc:36 +msgid "``\"<\"``" msgstr "" -#: ../../library/token-list.inc:190 -msgid "Token value for ``\"@=\"``." +#: ../../library/token-list.inc:38 +msgid "``\">\"``" msgstr "" -#: ../../library/token-list.inc:194 -msgid "Token value for ``\"->\"``." +#: ../../library/token-list.inc:40 +msgid "``\"=\"``" msgstr "" -#: ../../library/token-list.inc:198 -msgid "Token value for ``\"...\"``." +#: ../../library/token-list.inc:42 +msgid "``\".\"``" msgstr "" -#: ../../library/token-list.inc:202 -msgid "Token value for ``\":=\"``." +#: ../../library/token-list.inc:44 +msgid "``\"%\"``" msgstr "" -#: ../../library/token-list.inc:206 -msgid "Token value for ``\"!\"``." +#: ../../library/token-list.inc:46 +msgid "``\"{\"``" msgstr "" -#: ../../library/token.rst:49 -msgid "" -"The following token type values aren't used by the C tokenizer but are " -"needed for the :mod:`tokenize` module." +#: ../../library/token-list.inc:48 +msgid "``\"}\"``" msgstr "" -#: ../../library/token.rst:55 -msgid "Token value used to indicate a comment." +#: ../../library/token-list.inc:50 +msgid "``\"==\"``" msgstr "" -#: ../../library/token.rst:61 -msgid "" -"Token value used to indicate a non-terminating newline. The :data:`NEWLINE` " -"token indicates the end of a logical line of Python code; ``NL`` tokens are " -"generated when a logical line of code is continued over multiple physical " -"lines." +#: ../../library/token-list.inc:52 +msgid "``\"!=\"``" msgstr "" -#: ../../library/token.rst:69 -msgid "" -"Token value that indicates the encoding used to decode the source bytes into " -"text. The first token returned by :func:`tokenize.tokenize` will always be " -"an ``ENCODING`` token." +#: ../../library/token-list.inc:54 +msgid "``\"<=\"``" msgstr "" -#: ../../library/token.rst:77 -msgid "" -"Token value indicating that a type comment was recognized. Such tokens are " -"only produced when :func:`ast.parse` is invoked with ``type_comments=True``." +#: ../../library/token-list.inc:56 +msgid "``\">=\"``" +msgstr "" + +#: ../../library/token-list.inc:58 +msgid "``\"~\"``" +msgstr "" + +#: ../../library/token-list.inc:60 +msgid "``\"^\"``" +msgstr "" + +#: ../../library/token-list.inc:62 +msgid "``\"<<\"``" +msgstr "" + +#: ../../library/token-list.inc:64 +msgid "``\">>\"``" +msgstr "" + +#: ../../library/token-list.inc:66 +msgid "``\"**\"``" +msgstr "" + +#: ../../library/token-list.inc:68 +msgid "``\"+=\"``" +msgstr "" + +#: ../../library/token-list.inc:70 +msgid "``\"-=\"``" +msgstr "" + +#: ../../library/token-list.inc:72 +msgid "``\"*=\"``" +msgstr "" + +#: ../../library/token-list.inc:74 +msgid "``\"/=\"``" +msgstr "" + +#: ../../library/token-list.inc:76 +msgid "``\"%=\"``" +msgstr "" + +#: ../../library/token-list.inc:78 +msgid "``\"&=\"``" +msgstr "" + +#: ../../library/token-list.inc:80 +msgid "``\"|=\"``" +msgstr "" + +#: ../../library/token-list.inc:82 +msgid "``\"^=\"``" msgstr "" -#: ../../library/token.rst:84 +#: ../../library/token-list.inc:84 +msgid "``\"<<=\"``" +msgstr "" + +#: ../../library/token-list.inc:86 +msgid "``\">>=\"``" +msgstr "" + +#: ../../library/token-list.inc:88 +msgid "``\"**=\"``" +msgstr "" + +#: ../../library/token-list.inc:90 +msgid "``\"//\"``" +msgstr "" + +#: ../../library/token-list.inc:92 +msgid "``\"//=\"``" +msgstr "" + +#: ../../library/token-list.inc:94 +msgid "``\"@\"``" +msgstr "" + +#: ../../library/token-list.inc:96 +msgid "``\"@=\"``" +msgstr "" + +#: ../../library/token-list.inc:98 +msgid "``\"->\"``" +msgstr "" + +#: ../../library/token-list.inc:100 +msgid "``\"...\"``" +msgstr "" + +#: ../../library/token-list.inc:102 +msgid "``\":=\"``" +msgstr "" + +#: ../../library/token-list.inc:104 +msgid "``\"!\"``" +msgstr "" + +#: ../../library/token.rst:193 +msgid "The following non-token constants are provided:" +msgstr "" + +#: ../../library/token.rst:197 +msgid "The number of token types defined in this module." +msgstr "" + +#: ../../library/token.rst:204 msgid "" "A dictionary mapping the string representation of a token to its numeric " "code." msgstr "" -#: ../../library/token.rst:89 +#: ../../library/token.rst:209 msgid "Added :data:`!AWAIT` and :data:`!ASYNC` tokens." msgstr "" -#: ../../library/token.rst:92 +#: ../../library/token.rst:212 msgid "Added :data:`COMMENT`, :data:`NL` and :data:`ENCODING` tokens." msgstr "" -#: ../../library/token.rst:95 +#: ../../library/token.rst:215 msgid "" "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens. \"async\" and \"await\" " "are now tokenized as :data:`NAME` tokens." msgstr "" -#: ../../library/token.rst:99 +#: ../../library/token.rst:219 msgid "" "Added :data:`TYPE_COMMENT`, :data:`TYPE_IGNORE`, :data:`COLONEQUAL`. Added :" "data:`!AWAIT` and :data:`!ASYNC` tokens back (they're needed to support " @@ -315,6 +467,10 @@ msgid "" "set to 6 or lower)." msgstr "" -#: ../../library/token.rst:105 +#: ../../library/token.rst:225 +msgid "Added :data:`EXCLAMATION`." +msgstr "" + +#: ../../library/token.rst:228 msgid "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens again." msgstr "" diff --git a/library/tokenize.po b/library/tokenize.po index eed97f5d0f..c5081d3b15 100644 --- a/library/tokenize.po +++ b/library/tokenize.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -36,18 +35,18 @@ msgstr "" #: ../../library/tokenize.rst:19 msgid "" -"To simplify token stream handling, all :ref:`operator ` and :ref:" -"`delimiter ` tokens and :data:`Ellipsis` are returned using the " -"generic :data:`~token.OP` token type. The exact type can be determined by " -"checking the ``exact_type`` property on the :term:`named tuple` returned " -"from :func:`tokenize.tokenize`." +"To simplify token stream handling, all :ref:`operator ` " +"and :ref:`delimiter ` tokens and :data:`Ellipsis` are returned " +"using the generic :data:`~token.OP` token type. The exact type can be " +"determined by checking the ``exact_type`` property on the :term:`named " +"tuple` returned from :func:`tokenize.tokenize`." msgstr "" #: ../../library/tokenize.rst:28 msgid "" "Note that the functions in this module are only designed to parse " -"syntactically valid Python code (code that does not raise when parsed using :" -"func:`ast.parse`). The behavior of the functions in this module is " +"syntactically valid Python code (code that does not raise when parsed " +"using :func:`ast.parse`). The behavior of the functions in this module is " "**undefined** when providing invalid Python code and it can change at any " "point." msgstr "" @@ -63,9 +62,9 @@ msgstr "" #: ../../library/tokenize.rst:41 msgid "" "The :func:`.tokenize` generator requires one argument, *readline*, which " -"must be a callable object which provides the same interface as the :meth:`io." -"IOBase.readline` method of file objects. Each call to the function should " -"return one line of input as bytes." +"must be a callable object which provides the same interface as " +"the :meth:`io.IOBase.readline` method of file objects. Each call to the " +"function should return one line of input as bytes." msgstr "" #: ../../library/tokenize.rst:46 @@ -114,14 +113,14 @@ msgstr "" #: ../../library/tokenize.rst:77 msgid "" -"The result is an iterator yielding named tuples, exactly like :func:`." -"tokenize`. It does not yield an :data:`~token.ENCODING` token." +"The result is an iterator yielding named tuples, exactly " +"like :func:`.tokenize`. It does not yield an :data:`~token.ENCODING` token." msgstr "" #: ../../library/tokenize.rst:80 msgid "" -"All constants from the :mod:`token` module are also exported from :mod:" -"`tokenize`." +"All constants from the :mod:`token` module are also exported " +"from :mod:`tokenize`." msgstr "" #: ../../library/tokenize.rst:83 @@ -188,14 +187,14 @@ msgstr "" #: ../../library/tokenize.rst:125 msgid "" -"Use :func:`.open` to open Python source files: it uses :func:" -"`detect_encoding` to detect the file encoding." +"Use :func:`.open` to open Python source files: it " +"uses :func:`detect_encoding` to detect the file encoding." msgstr "" #: ../../library/tokenize.rst:131 msgid "" -"Open a file in read only mode using the encoding detected by :func:" -"`detect_encoding`." +"Open a file in read only mode using the encoding detected " +"by :func:`detect_encoding`." msgstr "" #: ../../library/tokenize.rst:138 @@ -242,7 +241,7 @@ msgstr "python -m tokenize [-e] [filename.py]" #: ../../library/tokenize.rst:164 msgid "The following options are accepted:" -msgstr "" +msgstr "可接受以下選項:" #: ../../library/tokenize.rst:170 msgid "show this help message and exit" diff --git a/library/traceback.po b/library/traceback.po index 3a7269ef34..6337736158 100644 --- a/library/traceback.po +++ b/library/traceback.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-13 00:15+0000\n" +"POT-Creation-Date: 2025-03-03 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -161,15 +161,15 @@ msgstr "" #: ../../library/traceback.rst:114 msgid "" -"This is a shorthand for ``print_exception(sys.exception(), limit, file, " -"chain)``." +"This is a shorthand for ``print_exception(sys.exception(), limit=limit, " +"file=file, chain=chain)``." msgstr "" #: ../../library/traceback.rst:120 msgid "" -"This is a shorthand for ``print_exception(sys.last_exc, limit, file, " -"chain)``. In general it will work only after an exception has reached an " -"interactive prompt (see :data:`sys.last_exc`)." +"This is a shorthand for ``print_exception(sys.last_exc, limit=limit, " +"file=file, chain=chain)``. In general it will work only after an exception " +"has reached an interactive prompt (see :data:`sys.last_exc`)." msgstr "" #: ../../library/traceback.rst:127 @@ -563,7 +563,7 @@ msgid "" "objects>` in a :ref:`traceback `." msgstr "" -#: ../../library/traceback.rst:504 +#: ../../library/traceback.rst:506 msgid "" "Represents a single :ref:`frame ` in the :ref:`traceback " "` or stack that is being formatted or printed. It may " @@ -577,38 +577,60 @@ msgid "" "display." msgstr "" -#: ../../library/traceback.rst:515 +#: ../../library/traceback.rst:517 msgid ":class:`!FrameSummary` instances have the following attributes:" msgstr "" -#: ../../library/traceback.rst:519 +#: ../../library/traceback.rst:521 msgid "" "The filename of the source code for this frame. Equivalent to accessing :" "attr:`f.f_code.co_filename ` on a :ref:`frame object " "` *f*." msgstr "" -#: ../../library/traceback.rst:525 +#: ../../library/traceback.rst:527 msgid "The line number of the source code for this frame." msgstr "" -#: ../../library/traceback.rst:529 +#: ../../library/traceback.rst:531 msgid "" "Equivalent to accessing :attr:`f.f_code.co_name ` on a :" "ref:`frame object ` *f*." msgstr "" -#: ../../library/traceback.rst:534 +#: ../../library/traceback.rst:536 msgid "" "A string representing the source code for this frame, with leading and " "trailing whitespace stripped. If the source is not available, it is ``None``." msgstr "" -#: ../../library/traceback.rst:541 +#: ../../library/traceback.rst:542 +msgid "" +"The last line number of the source code for this frame. By default, it is " +"set to ``lineno`` and indexation starts from 1." +msgstr "" + +#: ../../library/traceback.rst:545 +msgid "The default value changed from ``None`` to ``lineno``." +msgstr "" + +#: ../../library/traceback.rst:550 +msgid "" +"The column number of the source code for this frame. By default, it is " +"``None`` and indexation starts from 0." +msgstr "" + +#: ../../library/traceback.rst:555 +msgid "" +"The last column number of the source code for this frame. By default, it is " +"``None`` and indexation starts from 0." +msgstr "" + +#: ../../library/traceback.rst:562 msgid "Examples of Using the Module-Level Functions" msgstr "" -#: ../../library/traceback.rst:543 +#: ../../library/traceback.rst:564 msgid "" "This simple example implements a basic read-eval-print loop, similar to (but " "less useful than) the standard Python interactive interpreter loop. For a " @@ -616,7 +638,7 @@ msgid "" "`code` module. ::" msgstr "" -#: ../../library/traceback.rst:548 +#: ../../library/traceback.rst:569 msgid "" "import sys, traceback\n" "\n" @@ -635,13 +657,13 @@ msgid "" " run_user_code(envdir)" msgstr "" -#: ../../library/traceback.rst:565 +#: ../../library/traceback.rst:586 msgid "" "The following example demonstrates the different ways to print and format " "the exception and traceback:" msgstr "" -#: ../../library/traceback.rst:568 +#: ../../library/traceback.rst:589 msgid "" "import sys, traceback\n" "\n" @@ -673,11 +695,11 @@ msgid "" " print(\"*** tb_lineno:\", exc.__traceback__.tb_lineno)" msgstr "" -#: ../../library/traceback.rst:599 +#: ../../library/traceback.rst:620 msgid "The output for the example would look similar to this:" msgstr "" -#: ../../library/traceback.rst:601 +#: ../../library/traceback.rst:622 msgid "" "*** print_tb:\n" " File \"\", line 10, in \n" @@ -727,13 +749,13 @@ msgid "" "*** tb_lineno: 10" msgstr "" -#: ../../library/traceback.rst:646 +#: ../../library/traceback.rst:667 msgid "" "The following example shows the different ways to print and format the " "stack::" msgstr "" -#: ../../library/traceback.rst:648 +#: ../../library/traceback.rst:669 msgid "" ">>> import traceback\n" ">>> def another_function():\n" @@ -785,11 +807,11 @@ msgstr "" " ' File \"\", line 8, in lumberstack\\n print(repr(traceback." "format_stack()))\\n']" -#: ../../library/traceback.rst:672 +#: ../../library/traceback.rst:693 msgid "This last example demonstrates the final few formatting functions:" msgstr "" -#: ../../library/traceback.rst:674 +#: ../../library/traceback.rst:695 msgid "" ">>> import traceback\n" ">>> traceback.format_list([('spam.py', 3, '', 'spam.eggs()'),\n" @@ -801,15 +823,15 @@ msgid "" "['IndexError: tuple index out of range\\n']" msgstr "" -#: ../../library/traceback.rst:688 +#: ../../library/traceback.rst:709 msgid "Examples of Using :class:`TracebackException`" msgstr ":class:`TracebackException` 的使用範例" -#: ../../library/traceback.rst:690 +#: ../../library/traceback.rst:711 msgid "With the helper class, we have more options::" msgstr "" -#: ../../library/traceback.rst:692 +#: ../../library/traceback.rst:713 msgid "" ">>> import sys\n" ">>> from traceback import TracebackException\n" diff --git a/library/turtle.po b/library/turtle.po index 1c8a60bcbc..ef88f69b8e 100644 --- a/library/turtle.po +++ b/library/turtle.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-15 00:13+0000\n" +"POT-Creation-Date: 2025-05-03 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -19,8 +19,8 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../library/turtle.rst:3 -msgid ":mod:`turtle` --- Turtle graphics" -msgstr ":mod:`turtle` --- 龜圖學 (Turtle graphics)" +msgid ":mod:`!turtle` --- Turtle graphics" +msgstr ":mod:`!turtle` --- 龜圖學 (Turtle graphics)" #: ../../library/turtle.rst:10 msgid "**Source code:** :source:`Lib/turtle.py`" @@ -37,8 +37,8 @@ msgid "" "developed by Wally Feurzeig, Seymour Papert and Cynthia Solomon in 1967." msgstr "" "龜圖學是由 Wally Feurzeig,Seymour Papert 與 Cynthia Solomon 於 1967 年開發" -"的,一個 `以 Logo 程式語言撰寫的廣受歡迎的幾何繪圖工具 `_。" +"的,一個 `以 Logo 程式語言撰寫的廣受歡迎的幾何繪圖工具 `_。" #: ../../library/turtle.rst:29 msgid "Get started" @@ -322,8 +322,8 @@ msgstr "" #: ../../library/turtle.rst:195 msgid "" "The turtle module makes this possible by exposing all its basic " -"functionality as functions, available with ``from turtle import *``. The :" -"ref:`turtle graphics tutorial ` covers this approach." +"functionality as functions, available with ``from turtle import *``. " +"The :ref:`turtle graphics tutorial ` covers this approach." msgstr "" #: ../../library/turtle.rst:199 @@ -1059,8 +1059,8 @@ msgstr "" #: ../../library/turtle.rst:545 msgid "" -"If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` (e." -"g. as returned by :func:`pos`)." +"If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` " +"(e.g. as returned by :func:`pos`)." msgstr "" #: ../../library/turtle.rst:548 @@ -1583,8 +1583,8 @@ msgstr "" #: ../../library/turtle.rst:938 msgid "" -"Return the turtle's current heading (value depends on the turtle mode, see :" -"func:`mode`)." +"Return the turtle's current heading (value depends on the turtle mode, " +"see :func:`mode`)." msgstr "" #: ../../library/turtle.rst:941 @@ -1656,8 +1656,8 @@ msgstr "" #: ../../library/turtle.rst:1002 msgid "" -"Set the angle measurement units to radians. Equivalent to ``degrees(2*math." -"pi)``." +"Set the angle measurement units to radians. Equivalent to " +"``degrees(2*math.pi)``." msgstr "" #: ../../library/turtle.rst:1005 @@ -2005,8 +2005,8 @@ msgstr "``color()``" #: ../../library/turtle.rst:1221 msgid "" "Return the current pencolor and the current fillcolor as a pair of color " -"specification strings or tuples as returned by :func:`pencolor` and :func:" -"`fillcolor`." +"specification strings or tuples as returned by :func:`pencolor` " +"and :func:`fillcolor`." msgstr "" #: ../../library/turtle.rst:1225 @@ -2199,8 +2199,8 @@ msgid "" "name of current shape. Shape with *name* must exist in the TurtleScreen's " "shape dictionary. Initially there are the following polygon shapes: " "\"arrow\", \"turtle\", \"circle\", \"square\", \"triangle\", \"classic\". " -"To learn about how to deal with shapes see Screen method :func:" -"`register_shape`." +"To learn about how to deal with shapes see Screen " +"method :func:`register_shape`." msgstr "" #: ../../library/turtle.rst:1398 @@ -2645,8 +2645,8 @@ msgstr "" #: ../../library/turtle.rst:1754 msgid "" -"Add as many components to this object as desired, using the :meth:`~Shape." -"addcomponent` method." +"Add as many components to this object as desired, using " +"the :meth:`~Shape.addcomponent` method." msgstr "" #: ../../library/turtle.rst:1757 @@ -3282,16 +3282,16 @@ msgstr "" msgid "" "If the value \"using_IDLE\" in the configuration dictionary is ``False`` " "(default value), also enter mainloop. Remark: If IDLE with the ``-n`` " -"switch (no subprocess) is used, this value should be set to ``True`` in :" -"file:`turtle.cfg`. In this case IDLE's own mainloop is active also for the " -"client script." +"switch (no subprocess) is used, this value should be set to ``True`` " +"in :file:`turtle.cfg`. In this case IDLE's own mainloop is active also for " +"the client script." msgstr "" #: ../../library/turtle.rst:2274 msgid "" "Set the size and position of the main window. Default values of arguments " -"are stored in the configuration dictionary and can be changed via a :file:" -"`turtle.cfg` file." +"are stored in the configuration dictionary and can be changed via " +"a :file:`turtle.cfg` file." msgstr "" #: ../../library/turtle.rst:2278 @@ -3344,8 +3344,8 @@ msgstr "" #: ../../library/turtle.rst:2318 msgid "" -"a :class:`!tkinter.Canvas`, a :class:`ScrolledCanvas` or a :class:" -"`TurtleScreen`" +"a :class:`!tkinter.Canvas`, a :class:`ScrolledCanvas` or " +"a :class:`TurtleScreen`" msgstr "" #: ../../library/turtle.rst:2321 @@ -3356,8 +3356,9 @@ msgstr "" #: ../../library/turtle.rst:2327 msgid "" -"Subclass of RawTurtle, has the same interface but draws on a default :class:" -"`Screen` object created automatically when needed for the first time." +"Subclass of RawTurtle, has the same interface but draws on a " +"default :class:`Screen` object created automatically when needed for the " +"first time." msgstr "" #: ../../library/turtle.rst:2333 @@ -3427,8 +3428,8 @@ msgstr "\"compound\"" #: ../../library/turtle.rst:2364 msgid "" -"``None`` (a compound shape has to be constructed using the :meth:" -"`addcomponent` method)" +"``None`` (a compound shape has to be constructed using " +"the :meth:`addcomponent` method)" msgstr "" #: ../../library/turtle.rst:2370 @@ -3515,17 +3516,18 @@ msgstr "" msgid "" "``Turtle`` is a subclass of :class:`RawTurtle`, which *doesn't* " "automatically create a drawing surface - a *canvas* will need to be provided " -"or created for it. The *canvas* can be a :class:`!tkinter.Canvas`, :class:" -"`ScrolledCanvas` or :class:`TurtleScreen`." +"or created for it. The *canvas* can be a :class:`!" +"tkinter.Canvas`, :class:`ScrolledCanvas` or :class:`TurtleScreen`." msgstr "" #: ../../library/turtle.rst:2421 msgid "" -":class:`TurtleScreen` is the basic drawing surface for a turtle. :class:" -"`Screen` is a subclass of ``TurtleScreen``, and includes :ref:`some " -"additional methods ` for managing its appearance (including " -"size and title) and behaviour. ``TurtleScreen``'s constructor needs a :class:" -"`!tkinter.Canvas` or a :class:`ScrolledCanvas` as an argument." +":class:`TurtleScreen` is the basic drawing surface for a " +"turtle. :class:`Screen` is a subclass of ``TurtleScreen``, and " +"includes :ref:`some additional methods ` for managing its " +"appearance (including size and title) and behaviour. ``TurtleScreen``'s " +"constructor needs a :class:`!tkinter.Canvas` or a :class:`ScrolledCanvas` as " +"an argument." msgstr "" #: ../../library/turtle.rst:2428 @@ -3828,8 +3830,8 @@ msgstr "" #: ../../library/turtle.rst:2589 msgid "" -"Line 5 and 6 correspond to the arguments of the method :func:`Screen." -"screensize `." +"Line 5 and 6 correspond to the arguments of the " +"method :func:`Screen.screensize `." msgstr "" #: ../../library/turtle.rst:2591 @@ -3853,9 +3855,10 @@ msgstr "" #: ../../library/turtle.rst:2598 msgid "" -"If you set e.g. ``language = italian`` the docstringdict :file:" -"`turtle_docstringdict_italian.py` will be loaded at import time (if present " -"on the import path, e.g. in the same directory as :mod:`turtle`)." +"If you set e.g. ``language = italian`` the " +"docstringdict :file:`turtle_docstringdict_italian.py` will be loaded at " +"import time (if present on the import path, e.g. in the same directory " +"as :mod:`turtle`)." msgstr "" #: ../../library/turtle.rst:2601 @@ -4181,9 +4184,9 @@ msgstr "" #: ../../library/turtle.rst:2726 msgid "" -"The method :func:`!Turtle.fill` has been eliminated. The behaviour of :func:" -"`begin_fill` and :func:`end_fill` have changed slightly: now every filling " -"process must be completed with an ``end_fill()`` call." +"The method :func:`!Turtle.fill` has been eliminated. The behaviour " +"of :func:`begin_fill` and :func:`end_fill` have changed slightly: now every " +"filling process must be completed with an ``end_fill()`` call." msgstr "" #: ../../library/turtle.rst:2731 @@ -4200,11 +4203,11 @@ msgstr "" #: ../../library/turtle.rst:2739 msgid "" -"The :class:`Turtle` methods :func:`shearfactor`, :func:`shapetransform` and :" -"func:`get_shapepoly` have been added. Thus the full range of regular linear " -"transforms is now available for transforming turtle shapes. :func:" -"`tiltangle` has been enhanced in functionality: it now can be used to get or " -"set the tilt angle." +"The :class:`Turtle` methods :func:`shearfactor`, :func:`shapetransform` " +"and :func:`get_shapepoly` have been added. Thus the full range of regular " +"linear transforms is now available for transforming turtle " +"shapes. :func:`tiltangle` has been enhanced in functionality: it now can be " +"used to get or set the tilt angle." msgstr "" #: ../../library/turtle.rst:2745 @@ -4223,9 +4226,9 @@ msgstr "" #: ../../library/turtle.rst:2753 msgid "" -"Two input methods have been added: :func:`Screen.textinput ` and :" -"func:`Screen.numinput `. These pop up input dialogs and return " -"strings and numbers respectively." +"Two input methods have been added: :func:`Screen.textinput ` " +"and :func:`Screen.numinput `. These pop up input dialogs and " +"return strings and numbers respectively." msgstr "" #: ../../library/turtle.rst:2757 diff --git a/library/typing.po b/library/typing.po index 2c0ecd3181..68cfc42bf8 100644 --- a/library/typing.po +++ b/library/typing.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-11 06:16+0000\n" +"POT-Creation-Date: 2025-05-03 00:14+0000\n" "PO-Revision-Date: 2024-07-11 11:12+0800\n" "Last-Translator: Li-Hung Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -19,8 +19,8 @@ msgstr "" "X-Generator: Poedit 3.4.4\n" #: ../../library/typing.rst:3 -msgid ":mod:`typing` --- Support for type hints" -msgstr ":mod:`typing` --- 支援型別提示" +msgid ":mod:`!typing` --- Support for type hints" +msgstr ":mod:`!typing` --- 支援型別提示" #: ../../library/typing.rst:16 msgid "**Source code:** :source:`Lib/typing.py`" @@ -55,8 +55,8 @@ msgstr "" msgid "" "The function ``surface_area_of_cube`` takes an argument expected to be an " "instance of :class:`float`, as indicated by the :term:`type hint` " -"``edge_length: float``. The function is expected to return an instance of :" -"class:`str`, as indicated by the ``-> str`` hint." +"``edge_length: float``. The function is expected to return an instance " +"of :class:`str`, as indicated by the ``-> str`` hint." msgstr "" "函式 ``surface_area_of_cube`` 需要一個引數且預期是一個 :class:`float` 的實" "例,如 ``edge_length: float`` 所指出的\\ :term:`型別提示 `。這個函" @@ -73,9 +73,9 @@ msgstr "" #: ../../library/typing.rst:42 msgid "" -"New features are frequently added to the ``typing`` module. The :pypi:" -"`typing_extensions` package provides backports of these new features to " -"older versions of Python." +"New features are frequently added to the ``typing`` module. " +"The :pypi:`typing_extensions` package provides backports of these new " +"features to older versions of Python." msgstr "" "新功能會頻繁的新增至 ``typing`` 模組中。:pypi:`typing_extensions` 套件為這些" "新功能提供了 backport(向後移植的)版本,提供給舊版本的 Python 使用。" @@ -94,8 +94,8 @@ msgstr "型別提示的快速預覽(發布於 mypy 的文件中)" #: ../../library/typing.rst:51 msgid "" -"\"Type System Reference\" section of `the mypy docs `_" +"\"Type System Reference\" section of `the mypy docs `_" msgstr "" "`mypy 文件 `_\\ 的 \"型別系" "統參考資料 (Type System Reference)\" 章節" @@ -110,11 +110,10 @@ msgstr "" "多數 Python 型別檢查器中廣為使用。(某些部分依然是特定給 mypy 使用。)" #: ../../library/typing.rst:56 -msgid "" -"`\"Static Typing with Python\" `_" +msgid "`\"Static Typing with Python\" `_" msgstr "" -"`\"Python 的靜態型別 (Static Typing)\" `_" +"`\"Python 的靜態型別 (Static Typing)\" `_" #: ../../library/typing.rst:57 msgid "" @@ -131,12 +130,12 @@ msgstr "Python 型別系統的技術規範" #: ../../library/typing.rst:66 msgid "" "The canonical, up-to-date specification of the Python type system can be " -"found at `\"Specification for the Python type system\" `_." +"found at `\"Specification for the Python type system\" `_." msgstr "" "關於 Python 型別系統標準的 (canonical)、最新的技術規範可以在\\ `「Python 型別" -"系統的技術規範」 `_\\ 找到。" +"系統的技術規範」 `_\\ 找" +"到。" #: ../../library/typing.rst:72 msgid "Type aliases" @@ -148,9 +147,9 @@ msgid "" "an instance of :class:`TypeAliasType`. In this example, ``Vector`` and " "``list[float]`` will be treated equivalently by static type checkers::" msgstr "" -"一個型別別名被定義來使用 :keyword:`type` 陳述式,其建立了 :class:" -"`TypeAliasType` 的實例。在這個範例中,``Vector`` 及 ``list[float]`` 會被當作" -"和靜態型別檢查器一樣同等對待: ::" +"一個型別別名被定義來使用 :keyword:`type` 陳述式,其建立" +"了 :class:`TypeAliasType` 的實例。在這個範例中,``Vector`` 及 " +"``list[float]`` 會被當作和靜態型別檢查器一樣同等對待: ::" #: ../../library/typing.rst:79 msgid "" @@ -377,18 +376,19 @@ msgstr "註釋 callable 物件" #: ../../library/typing.rst:210 msgid "" -"Functions -- or other :term:`callable` objects -- can be annotated using :" -"class:`collections.abc.Callable` or deprecated :data:`typing.Callable`. " -"``Callable[[int], str]`` signifies a function that takes a single parameter " -"of type :class:`int` and returns a :class:`str`." +"Functions -- or other :term:`callable` objects -- can be annotated " +"using :class:`collections.abc.Callable` or " +"deprecated :data:`typing.Callable`. ``Callable[[int], str]`` signifies a " +"function that takes a single parameter of type :class:`int` and returns " +"a :class:`str`." msgstr "" -"函式,或者是其他 :term:`callable` 物件,可以使用 :class:`collections.abc." -"Callable` 或以棄用的 :data:`typing.Callable` 進行註釋。 ``Callable[[int], " -"str]`` 象徵為一個函式,可以接受一個型別為 :class:`int` 的引數,並回傳一個 :" -"class:`str`。" +"函式,或者是其他 :term:`callable` 物件,可以使" +"用 :class:`collections.abc.Callable` 或以棄用的 :data:`typing.Callable` 進行" +"註釋。 ``Callable[[int], str]`` 象徵為一個函式,可以接受一個型別" +"為 :class:`int` 的引數,並回傳一個 :class:`str`。" -#: ../../library/typing.rst:215 ../../library/typing.rst:3128 -#: ../../library/typing.rst:3308 +#: ../../library/typing.rst:215 ../../library/typing.rst:3121 +#: ../../library/typing.rst:3301 msgid "For example:" msgstr "舉例來說:" @@ -443,8 +443,8 @@ msgid "" "``Callable`` cannot express complex signatures such as functions that take a " "variadic number of arguments, :ref:`overloaded functions `, or " "functions that have keyword-only parameters. However, these signatures can " -"be expressed by defining a :class:`Protocol` class with a :meth:`~object." -"__call__` method:" +"be expressed by defining a :class:`Protocol` class with " +"a :meth:`~object.__call__` method:" msgstr "" "``Callable`` 不如有可變數量引數的函式、:func:`overloaded functions " "`、或是僅限關鍵字參數的函式,可以表示複雜簽名。然而,這些簽名可以透" @@ -492,13 +492,13 @@ msgstr "" "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " "ReturnType]`` 的形式。" -#: ../../library/typing.rst:285 ../../library/typing.rst:3798 +#: ../../library/typing.rst:285 ../../library/typing.rst:3791 msgid "" -"``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" -"pep:`612` for more details." +"``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. " +"See :pep:`612` for more details." msgstr "" -"``Callable`` 現已支援 :class:`ParamSpec` 以及 :data:`Concatenate`。請參閱 :" -"pep:`612` 閱讀詳細內容。" +"``Callable`` 現已支援 :class:`ParamSpec` 以及 :data:`Concatenate`。請參" +"閱 :pep:`612` 閱讀詳細內容。" #: ../../library/typing.rst:290 msgid "" @@ -603,9 +603,10 @@ msgstr "" #: ../../library/typing.rst:356 msgid "" ":class:`list` only accepts one type argument, so a type checker would emit " -"an error on the ``y`` assignment above. Similarly, :class:`~collections.abc." -"Mapping` only accepts two type arguments: the first indicates the type of " -"the keys, and the second indicates the type of the values." +"an error on the ``y`` assignment above. " +"Similarly, :class:`~collections.abc.Mapping` only accepts two type " +"arguments: the first indicates the type of the keys, and the second " +"indicates the type of the values." msgstr "" ":class:`list` 只接受一個型別引數,所以型別檢查器可能在上述 ``y`` 賦值 " "(assignment) 觸發錯誤。類似的範例,:class:`~collections.abc.Mapping` 只接受兩" @@ -616,8 +617,8 @@ msgstr "" msgid "" "Unlike most other Python containers, however, it is common in idiomatic " "Python code for tuples to have elements which are not all of the same type. " -"For this reason, tuples are special-cased in Python's typing system. :class:" -"`tuple` accepts *any number* of type arguments::" +"For this reason, tuples are special-cased in Python's typing " +"system. :class:`tuple` accepts *any number* of type arguments::" msgstr "" "然而,與其他多數的 Python 容器不同,在慣用的 (idiomatic) Python 程式碼中,元" "組可以擁有不完全相同型別的元素是相當常見的。為此,元組在 Python 的加註型別系" @@ -677,9 +678,10 @@ msgstr "類別物件的型別" #: ../../library/typing.rst:403 msgid "" "A variable annotated with ``C`` may accept a value of type ``C``. In " -"contrast, a variable annotated with ``type[C]`` (or deprecated :class:" -"`typing.Type[C] `) may accept values that are classes themselves -- " -"specifically, it will accept the *class object* of ``C``. For example::" +"contrast, a variable annotated with ``type[C]`` (or " +"deprecated :class:`typing.Type[C] `) may accept values that are " +"classes themselves -- specifically, it will accept the *class object* of " +"``C``. For example::" msgstr "" "一個變數被註釋為 ``C`` 可以接受一個型別為 ``C`` 的值。相對的,一個變數備註解" "為 ``type[C]`` \\ (或已棄用的 :class:`typing.Type[C] `)\\ 可以接受本" @@ -718,8 +720,9 @@ msgstr "" #: ../../library/typing.rst:429 msgid "" -"The only legal parameters for :class:`type` are classes, :data:`Any`, :ref:" -"`type variables `, and unions of any of these types. For example::" +"The only legal parameters for :class:`type` are " +"classes, :data:`Any`, :ref:`type variables `, and unions of any of " +"these types. For example::" msgstr "" ":class:`type` 僅有的合法參數是類別、:data:`Any`、:ref:`型別變數 " "`\\ 以及這些型別任意組合成的聯集。舉例來說: ::" @@ -737,8 +740,8 @@ msgstr "" #: ../../library/typing.rst:441 msgid "" -"``type[Any]`` is equivalent to :class:`type`, which is the root of Python's :" -"ref:`metaclass hierarchy `." +"``type[Any]`` is equivalent to :class:`type`, which is the root of " +"Python's :ref:`metaclass hierarchy `." msgstr "" "``type[Any]`` 等價於 :class:`type` ,其為 Python :ref:`metaclass 階層結構 " "(hierachy) `。" @@ -749,9 +752,9 @@ msgstr "" #: ../../library/typing.rst:450 msgid "" -"A generator can be annotated using the generic type :class:" -"`Generator[YieldType, SendType, ReturnType] `. " -"For example::" +"A generator can be annotated using the generic " +"type :class:`Generator[YieldType, SendType, ReturnType] " +"`. For example::" msgstr "" #: ../../library/typing.rst:454 @@ -798,8 +801,9 @@ msgstr "" #: ../../library/typing.rst:478 msgid "" "Simple generators that only ever yield values can also be annotated as " -"having a return type of either :class:`Iterable[YieldType] ` or :class:`Iterator[YieldType] `::" +"having a return type of either :class:`Iterable[YieldType] " +"` or :class:`Iterator[YieldType] " +"`::" msgstr "" #: ../../library/typing.rst:483 @@ -814,8 +818,8 @@ msgstr "" msgid "" "Async generators are handled in a similar fashion, but don't expect a " "``ReturnType`` type argument (:class:`AsyncGenerator[YieldType, SendType] " -"`). The ``SendType`` argument defaults to :" -"const:`!None`, so the following definitions are equivalent::" +"`). The ``SendType`` argument defaults " +"to :const:`!None`, so the following definitions are equivalent::" msgstr "" #: ../../library/typing.rst:494 @@ -833,9 +837,9 @@ msgstr "" #: ../../library/typing.rst:504 msgid "" -"As in the synchronous case, :class:`AsyncIterable[YieldType] ` and :class:`AsyncIterator[YieldType] ` are available as well::" +"As in the synchronous case, :class:`AsyncIterable[YieldType] " +"` and :class:`AsyncIterator[YieldType] " +"` are available as well::" msgstr "" #: ../../library/typing.rst:509 @@ -904,8 +908,8 @@ msgstr "" #: ../../library/typing.rst:557 msgid "" "Generic classes implicitly inherit from :class:`Generic`. For compatibility " -"with Python 3.11 and lower, it is also possible to inherit explicitly from :" -"class:`Generic` to indicate a generic class::" +"with Python 3.11 and lower, it is also possible to inherit explicitly " +"from :class:`Generic` to indicate a generic class::" msgstr "" "泛型類別隱性繼承了 :class:`Generic`。為了相容 Python 3.11 及更早版本,也可以" "明確的繼承 :class:`Generic` 並指出是一個泛型類別: ::" @@ -939,8 +943,8 @@ msgstr "" #: ../../library/typing.rst:577 msgid "" -"A generic type can have any number of type variables. All varieties of :" -"class:`TypeVar` are permissible as parameters for a generic type::" +"A generic type can have any number of type variables. All varieties " +"of :class:`TypeVar` are permissible as parameters for a generic type::" msgstr "" "一個泛型型別可以有任意數量的型別變數。所有種類的 :class:`TypeVar` 都可以作為" "泛型型別的參數: ::" @@ -1080,14 +1084,14 @@ msgid "" "User-defined generics for parameter expressions are also supported via " "parameter specification variables in the form ``[**P]``. The behavior is " "consistent with type variables' described above as parameter specification " -"variables are treated by the typing module as a specialized type variable. " -"The one exception to this is that a list of types can be used to substitute " -"a :class:`ParamSpec`::" +"variables are treated by the :mod:`!typing` module as a specialized type " +"variable. The one exception to this is that a list of types can be used to " +"substitute a :class:`ParamSpec`::" msgstr "" "使用者定義的參數運算式 (parameter expression) 泛型一樣有支援,透過 ``[**P]`` " -"格式的參數規格變數來進行表示。對於上述作為參數規格變數的型別變數,將持續被型" -"別模組視為一個特定的型別變數。對此,其中一個例外是一個型別列表可以替代 :" -"class:`ParamSpec`: ::" +"格式的參數規格變數來進行表示。對於上述作為參數規格變數的型別變數,將持續" +"被 :mod:`!typing` 模組視為一個特定的型別變數。對此,其中一個例外是一個型別列" +"表可以替代 :class:`ParamSpec`: ::" #: ../../library/typing.rst:671 msgid "" @@ -1096,6 +1100,10 @@ msgid "" ">>> Z[int, [dict, float]]\n" "__main__.Z[int, [dict, float]]" msgstr "" +">>> class Z[T, **P]: ... # T 為 TypeVar;P 為 ParamSpec\n" +"...\n" +">>> Z[int, [dict, float]]\n" +"__main__.Z[int, [dict, float]]" #: ../../library/typing.rst:676 msgid "" @@ -1114,6 +1122,12 @@ msgid "" "class Z(Generic[P]):\n" " ..." msgstr "" +"from typing import ParamSpec, Generic\n" +"\n" +"P = ParamSpec('P')\n" +"\n" +"class Z(Generic[P]):\n" +" ..." #: ../../library/typing.rst:686 msgid "" @@ -1137,6 +1151,12 @@ msgid "" ">>> X[[int, str]]\n" "__main__.X[[int, str]]" msgstr "" +">>> class X[**P]: ...\n" +"...\n" +">>> X[int, str]\n" +"__main__.X[[int, str]]\n" +">>> X[[int, str]]\n" +"__main__.X[[int, str]]" #: ../../library/typing.rst:699 msgid "" @@ -1149,22 +1169,22 @@ msgstr "" #: ../../library/typing.rst:703 msgid "" -":class:`Generic` can now be parameterized over parameter expressions. See :" -"class:`ParamSpec` and :pep:`612` for more details." +":class:`Generic` can now be parameterized over parameter expressions. " +"See :class:`ParamSpec` and :pep:`612` for more details." msgstr "" -":class:`Generic` 現在可以透過參數運算式來進行參數化。詳細內容請見 :class:" -"`ParamSpec` 以及 :pep:`612`。" +":class:`Generic` 現在可以透過參數運算式來進行參數化。詳細內容請" +"見 :class:`ParamSpec` 以及 :pep:`612`。" #: ../../library/typing.rst:707 msgid "" "A user-defined generic class can have ABCs as base classes without a " "metaclass conflict. Generic metaclasses are not supported. The outcome of " -"parameterizing generics is cached, and most types in the typing module are :" -"term:`hashable` and comparable for equality." +"parameterizing generics is cached, and most types in the :mod:`!typing` " +"module are :term:`hashable` and comparable for equality." msgstr "" "一個使用者定義的泛型類別可以將 ABC 作為他們的基底類別,且不會有 metaclass 衝" -"突。泛型的 metaclass 則不支援。參數化泛型的輸出將被存為快取,而在型別模組中多" -"數的型別皆為 :term:`hashable` 且可以比較相等性。" +"突。泛型的 metaclass 則不支援。參數化泛型的輸出將被存為快取,而在 :mod:`!" +"typing` 模組中多數的型別皆為 :term:`hashable` 且可以比較相等性。" #: ../../library/typing.rst:714 msgid "The :data:`Any` type" @@ -1176,8 +1196,8 @@ msgid "" "every type as being compatible with :data:`Any` and :data:`Any` as being " "compatible with every type." msgstr "" -":data:`Any` 是一種特別的型別。一個靜態型別檢查器會將每個型別視為可相容於 :" -"data:`Any` 且 :data:`Any` 也可以相容於每個型別。" +":data:`Any` 是一種特別的型別。一個靜態型別檢查器會將每個型別視為可相容" +"於 :data:`Any` 且 :data:`Any` 也可以相容於每個型別。" #: ../../library/typing.rst:720 msgid "" @@ -1207,11 +1227,11 @@ msgstr "" #: ../../library/typing.rst:738 msgid "" -"Notice that no type checking is performed when assigning a value of type :" -"data:`Any` to a more precise type. For example, the static type checker did " -"not report an error when assigning ``a`` to ``s`` even though ``s`` was " -"declared to be of type :class:`str` and receives an :class:`int` value at " -"runtime!" +"Notice that no type checking is performed when assigning a value of " +"type :data:`Any` to a more precise type. For example, the static type " +"checker did not report an error when assigning ``a`` to ``s`` even though " +"``s`` was declared to be of type :class:`str` and receives an :class:`int` " +"value at runtime!" msgstr "" "請注意,當賦予型別為 :data:`Any` 的值更精確的型別時,將不會執行任何型別檢查。" "舉例來說,靜態型別檢查器不會在 runtime 中,將 ``a`` 賦值給 ``s`` 的情況下回報" @@ -1252,8 +1272,8 @@ msgid "" "subtype of every other type." msgstr "" ":data:`Any` 的行為對比 :class:`object` 的行為。與 :data:`Any` 相似,所有的型" -"別會作為 :class:`object` 的子型別。然而,不像 :data:`Any`,反之不亦然::" -"class:`object` 並\\ *不是*\\一個其他型別的子型別。" +"別會作為 :class:`object` 的子型別。然而,不像 :data:`Any`,反之不亦" +"然::class:`object` 並\\ *不是*\\一個其他型別的子型別。" #: ../../library/typing.rst:765 msgid "" @@ -1310,16 +1330,16 @@ msgstr "" #: ../../library/typing.rst:798 msgid "" -"This requirement previously also applied to abstract base classes, such as :" -"class:`~collections.abc.Iterable`. The problem with this approach is that a " -"class had to be explicitly marked to support them, which is unpythonic and " -"unlike what one would normally do in idiomatic dynamically typed Python " -"code. For example, this conforms to :pep:`484`::" +"This requirement previously also applied to abstract base classes, such " +"as :class:`~collections.abc.Iterable`. The problem with this approach is " +"that a class had to be explicitly marked to support them, which is " +"unpythonic and unlike what one would normally do in idiomatic dynamically " +"typed Python code. For example, this conforms to :pep:`484`::" msgstr "" "這個需求之前也被運用在抽象基底類別,例如 :class:`~collections.abc.Iterable`。" "這種方式的問題在於,一個類別需要顯式的標記來支援他們,這並不符合 Python 風" -"格,也不像一個常見的慣用動態型別 Python 程式碼。舉例來說,下列程式碼符合 :" -"pep:`484`: ::" +"格,也不像一個常見的慣用動態型別 Python 程式碼。舉例來說,下列程式碼符" +"合 :pep:`484`: ::" #: ../../library/typing.rst:804 msgid "" @@ -1330,6 +1350,12 @@ msgid "" " def __len__(self) -> int: ...\n" " def __iter__(self) -> Iterator[int]: ..." msgstr "" +"from collections.abc import Sized, Iterable, Iterator\n" +"\n" +"class Bucket(Sized, Iterable[int]):\n" +" ...\n" +" def __len__(self) -> int: ...\n" +" def __iter__(self) -> Iterator[int]: ..." #: ../../library/typing.rst:811 msgid "" @@ -1356,6 +1382,15 @@ msgid "" "def collect(items: Iterable[int]) -> int: ...\n" "result = collect(Bucket()) # Passes type check" msgstr "" +"from collections.abc import Iterator, Iterable\n" +"\n" +"class Bucket: # 注意:沒有基底類別\n" +" ...\n" +" def __len__(self) -> int: ...\n" +" def __iter__(self) -> Iterator[int]: ...\n" +"\n" +"def collect(items: Iterable[int]) -> int: ...\n" +"result = collect(Bucket()) # Passes type check" #: ../../library/typing.rst:827 msgid "" @@ -1421,7 +1456,7 @@ msgstr "定義: ::" #: ../../library/typing.rst:863 msgid "AnyStr = TypeVar('AnyStr', str, bytes)" -msgstr "" +msgstr "AnyStr = TypeVar('AnyStr', str, bytes)" #: ../../library/typing.rst:865 msgid "" @@ -1434,8 +1469,8 @@ msgstr "" #: ../../library/typing.rst:868 ../../library/typing.rst:986 #: ../../library/typing.rst:1043 ../../library/typing.rst:1209 #: ../../library/typing.rst:1270 ../../library/typing.rst:1312 -#: ../../library/typing.rst:1527 ../../library/typing.rst:1588 -#: ../../library/typing.rst:3065 ../../library/typing.rst:3293 +#: ../../library/typing.rst:1513 ../../library/typing.rst:1574 +#: ../../library/typing.rst:3058 ../../library/typing.rst:3286 msgid "For example::" msgstr "舉例來說: ::" @@ -1451,9 +1486,10 @@ msgstr "" #: ../../library/typing.rst:877 msgid "" -"Note that, despite its name, ``AnyStr`` has nothing to do with the :class:" -"`Any` type, nor does it mean \"any string\". In particular, ``AnyStr`` and " -"``str | bytes`` are different from each other and have different use cases::" +"Note that, despite its name, ``AnyStr`` has nothing to do with " +"the :class:`Any` type, nor does it mean \"any string\". In particular, " +"``AnyStr`` and ``str | bytes`` are different from each other and have " +"different use cases::" msgstr "" "請注意,儘管他的名稱相近,``AnyStr`` 與 :class:`Any` 型別無關,更不代表是「任" "何字串」的意思。尤其,``AnyStr`` 與 ``str | bytes`` 兩者不同且具有不同的使用" @@ -1475,8 +1511,8 @@ msgstr "" #: ../../library/typing.rst:892 msgid "" "Deprecated in favor of the new :ref:`type parameter syntax `. " -"Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. See :" -"pep:`695` for more details." +"Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. " +"See :pep:`695` for more details." msgstr "" #: ../../library/typing.rst:897 @@ -1502,7 +1538,7 @@ msgstr "" "此。然而,若是一個型別僅為 ``str`` 的物件則不相容。一個字串若是透過組合多個 " "``LiteralString`` 型別的物件建立,則此字串也可以視為 ``LiteralString``。" -#: ../../library/typing.rst:912 ../../library/typing.rst:2159 +#: ../../library/typing.rst:912 ../../library/typing.rst:2145 msgid "Example:" msgstr "舉例來說: ::" @@ -1538,16 +1574,16 @@ msgstr "更多細節請見 :pep:`675`。" #: ../../library/typing.rst:940 msgid "" -":data:`!Never` and :data:`!NoReturn` represent the `bottom type `_, a type that has no members." +":data:`!Never` and :data:`!NoReturn` represent the `bottom type `_, a type that has no members." msgstr "" ":data:`!Never` 和 :data:`!NoReturn` 表示\\ `底部型別 (bottom type) `_,為一個沒有任何成員的型別。" #: ../../library/typing.rst:944 msgid "" -"They can be used to indicate that a function never returns, such as :func:" -"`sys.exit`::" +"They can be used to indicate that a function never returns, such " +"as :func:`sys.exit`::" msgstr "它們可以被用來代表一個不會回傳的函式,像是 :func:`sys.exit`: ::" #: ../../library/typing.rst:947 @@ -1557,14 +1593,18 @@ msgid "" "def stop() -> Never:\n" " raise RuntimeError('no way')" msgstr "" +"from typing import Never # 或 NoReturn\n" +"\n" +"def stop() -> Never:\n" +" raise RuntimeError('no way')" #: ../../library/typing.rst:952 msgid "" "Or to define a function that should never be called, as there are no valid " "arguments, such as :func:`assert_never`::" msgstr "" -"或被用來定義一個不應被呼叫的函式,因為不會有有效的引數,、像是 :func:" -"`assert_never`: ::" +"或被用來定義一個不應被呼叫的函式,因為不會有有效的引數,、像" +"是 :func:`assert_never`: ::" #: ../../library/typing.rst:956 msgid "" @@ -1749,17 +1789,17 @@ msgstr "更多細節請見 :pep:`613`。" msgid "" ":data:`TypeAlias` is deprecated in favor of the :keyword:`type` statement, " "which creates instances of :class:`TypeAliasType` and which natively " -"supports forward references. Note that while :data:`TypeAlias` and :class:" -"`TypeAliasType` serve similar purposes and have similar names, they are " -"distinct and the latter is not the type of the former. Removal of :data:" -"`TypeAlias` is not currently planned, but users are encouraged to migrate " -"to :keyword:`type` statements." -msgstr "" -":data:`TypeAlias` 被棄用,請改用 :keyword:`type` 陳述式來建立 :class:" -"`TypeAliasType` 的實例,其自然可以支援傳遞參照的使用。請注意,雖然 :data:" -"`TypeAlias` 以及 :class:`TypeAliasType` 提供相似的用途且具有相似的名稱,他們" -"是不同的,且後者不是前者的型別。現在還沒有移除 :data:`TypeAlias` 的計畫,但鼓" -"勵使用者們遷移 (migrate) 至 :keyword:`type` 陳述式。" +"supports forward references. Note that while :data:`TypeAlias` " +"and :class:`TypeAliasType` serve similar purposes and have similar names, " +"they are distinct and the latter is not the type of the former. Removal " +"of :data:`TypeAlias` is not currently planned, but users are encouraged to " +"migrate to :keyword:`type` statements." +msgstr "" +":data:`TypeAlias` 被棄用,請改用 :keyword:`type` 陳述式來建" +"立 :class:`TypeAliasType` 的實例,其自然可以支援傳遞參照的使用。請注意,雖" +"然 :data:`TypeAlias` 以及 :class:`TypeAliasType` 提供相似的用途且具有相似的名" +"稱,他們是不同的,且後者不是前者的型別。現在還沒有移除 :data:`TypeAlias` 的計" +"畫,但鼓勵使用者們遷移 (migrate) 至 :keyword:`type` 陳述式。" #: ../../library/typing.rst:1084 msgid "Special forms" @@ -1814,7 +1854,7 @@ msgstr "多餘的引數會被略過,舉例來說: ::" #: ../../library/typing.rst:1107 msgid "Union[int, str, int] == Union[int, str] == int | str" -msgstr "" +msgstr "Union[int, str, int] == Union[int, str] == int | str" #: ../../library/typing.rst:1109 msgid "When comparing unions, the argument order is ignored, e.g.::" @@ -1905,9 +1945,9 @@ msgid "" "a :ref:`Callable `. The last parameter to " "``Concatenate`` must be a :class:`ParamSpec` or ellipsis (``...``)." msgstr "" -"``Concatenate`` 可以被用在\\ :ref:`可呼叫物件 `\\ 與 :" -"class:`ParamSpec` 的接合 (conjunction) 並註釋一個高階的 Callable 物件可以新" -"增、移除、轉換另一個 Callable 物件的參數。使用方法是依照這個格式 " +"``Concatenate`` 可以被用在\\ :ref:`可呼叫物件 `\\ " +"與 :class:`ParamSpec` 的接合 (conjunction) 並註釋一個高階的 Callable 物件可以" +"新增、移除、轉換另一個 Callable 物件的參數。使用方法是依照這個格式 " "``Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable]``。``Concatenate`` " "目前只在 :ref:`Callable 物件 `\\ 中第一個引數使用時有" "效。``Concatenate`` 的最後一個參數必須為一個 :class:`ParamSpec` 或是刪節號 " @@ -1915,13 +1955,13 @@ msgstr "" #: ../../library/typing.rst:1160 msgid "" -"For example, to annotate a decorator ``with_lock`` which provides a :class:" -"`threading.Lock` to the decorated function, ``Concatenate`` can be used to " -"indicate that ``with_lock`` expects a callable which takes in a ``Lock`` as " -"the first argument, and returns a callable with a different type signature. " -"In this case, the :class:`ParamSpec` indicates that the returned callable's " -"parameter types are dependent on the parameter types of the callable being " -"passed in::" +"For example, to annotate a decorator ``with_lock`` which provides " +"a :class:`threading.Lock` to the decorated function, ``Concatenate`` can be " +"used to indicate that ``with_lock`` expects a callable which takes in a " +"``Lock`` as the first argument, and returns a callable with a different type " +"signature. In this case, the :class:`ParamSpec` indicates that the returned " +"callable's parameter types are dependent on the parameter types of the " +"callable being passed in::" msgstr "" "舉例來說,註釋一個為裝飾過後的函式提供 :class:`threading.Lock` 的裝飾器 " "``with_lock``,``Concatenate`` 可以用於指出 ``with_lock`` 預期一個 Callable " @@ -1957,7 +1997,7 @@ msgid "" "sum_threadsafe([1.1, 2.2, 3.3])" msgstr "" -#: ../../library/typing.rst:1196 ../../library/typing.rst:2127 +#: ../../library/typing.rst:1196 ../../library/typing.rst:2113 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)" @@ -1967,7 +2007,7 @@ msgstr ":pep:`612` -- 參數技術規範變數" msgid ":class:`ParamSpec`" msgstr ":class:`ParamSpec`" -#: ../../library/typing.rst:1199 ../../library/typing.rst:2130 +#: ../../library/typing.rst:1199 ../../library/typing.rst:2116 msgid ":ref:`annotating-callables`" msgstr ":ref:`annotating-callables`" @@ -2043,15 +2083,16 @@ msgstr ":data:`ClassVar` 只接受型別請不得使用下標。" #: ../../library/typing.rst:1247 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 " -"runtime behavior, but it can be used by third-party type checkers. For " -"example, a type checker might flag the following code as an error::" +":data:`ClassVar` is not a class itself, and should not be used " +"with :func:`isinstance` or :func:`issubclass`. :data:`ClassVar` does not " +"change Python runtime behavior, but it can be used by third-party type " +"checkers. For example, a type checker might flag the following code as an " +"error::" msgstr "" -":data:`ClassVar` 並不代表該類別本身,而且不應該和 :func:`isinstance` 或是 :" -"func:`issubclass` 一起使用。:data:`ClassVar` 不會改變 Python runtime 的行為," -"但它可以被第三方的型別檢查器使用。舉例來說,一個型別檢查器可能會標記下方的程" -"式碼為一個錯誤: ::" +":data:`ClassVar` 並不代表該類別本身,而且不應該和 :func:`isinstance` 或" +"是 :func:`issubclass` 一起使用。:data:`ClassVar` 不會改變 Python runtime 的行" +"為,但它可以被第三方的型別檢查器使用。舉例來說,一個型別檢查器可能會標記下方" +"的程式碼為一個錯誤: ::" #: ../../library/typing.rst:1253 msgid "" @@ -2088,7 +2129,7 @@ msgid "" " TIMEOUT = 1 # Error reported by type checker" msgstr "" -#: ../../library/typing.rst:1281 ../../library/typing.rst:3081 +#: ../../library/typing.rst:1281 ../../library/typing.rst:3074 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." @@ -2108,8 +2149,8 @@ msgid "" "This is mainly useful for ``total=False`` TypedDicts. See :class:`TypedDict` " "and :pep:`655` for more details." msgstr "" -"主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` 與 :" -"pep:`655`。" +"主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` " +"與 :pep:`655`。" #: ../../library/typing.rst:1301 msgid "" @@ -2210,32 +2251,31 @@ msgstr "" "T2 = Annotated[T1, ValueRange(-20, 3)]" #: ../../library/typing.rst:1371 -msgid "Details of the syntax:" -msgstr "" - -#: ../../library/typing.rst:1373 -msgid "The first argument to ``Annotated`` must be a valid type" -msgstr "" - -#: ../../library/typing.rst:1375 msgid "" -"Multiple metadata elements can be supplied (``Annotated`` supports variadic " -"arguments)::" +"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:1378 +#: ../../library/typing.rst:1375 msgid "" "@dataclass\n" "class ctype:\n" -" kind: str\n" +" kind: str\n" "\n" -"Annotated[int, ValueRange(3, 10), ctype(\"char\")]" +"a1 = Annotated[int, ValueRange(3, 10), ctype(\"char\")]\n" +"a2 = Annotated[int, ctype(\"char\"), ValueRange(3, 10)]\n" +"\n" +"assert a1 != a2 # Order matters" msgstr "" "@dataclass\n" "class ctype:\n" -" kind: str\n" +" kind: str\n" +"\n" +"a1 = Annotated[int, ValueRange(3, 10), ctype(\"char\")]\n" +"a2 = Annotated[int, ctype(\"char\"), ValueRange(3, 10)]\n" "\n" -"Annotated[int, ValueRange(3, 10), ctype(\"char\")]" +"assert a1 != a2 # 順序是有意義的" #: ../../library/typing.rst:1384 msgid "" @@ -2246,33 +2286,11 @@ msgstr "" #: ../../library/typing.rst:1388 msgid "" -"``Annotated`` must be subscripted with at least two arguments " -"( ``Annotated[int]`` is not valid)" -msgstr "" - -#: ../../library/typing.rst:1391 -msgid "" -"The order of the metadata elements is preserved and matters for equality " -"checks::" -msgstr "" - -#: ../../library/typing.rst:1394 -msgid "" -"assert Annotated[int, ValueRange(3, 10), ctype(\"char\")] != Annotated[\n" -" int, ctype(\"char\"), ValueRange(3, 10)\n" -"]" -msgstr "" -"assert Annotated[int, ValueRange(3, 10), ctype(\"char\")] != Annotated[\n" -" int, ctype(\"char\"), ValueRange(3, 10)\n" -"]" - -#: ../../library/typing.rst:1398 -msgid "" "Nested ``Annotated`` types are flattened. The order of the metadata elements " "starts with the innermost annotation::" msgstr "" -#: ../../library/typing.rst:1401 +#: ../../library/typing.rst:1391 msgid "" "assert Annotated[Annotated[int, ValueRange(3, 10)], ctype(\"char\")] == " "Annotated[\n" @@ -2284,11 +2302,11 @@ msgstr "" " int, ValueRange(3, 10), ctype(\"char\")\n" "]" -#: ../../library/typing.rst:1405 +#: ../../library/typing.rst:1395 msgid "Duplicated metadata elements are not removed::" msgstr "" -#: ../../library/typing.rst:1407 +#: ../../library/typing.rst:1397 msgid "" "assert Annotated[int, ValueRange(3, 10)] != Annotated[\n" " int, ValueRange(3, 10), ValueRange(3, 10)\n" @@ -2298,11 +2316,11 @@ msgstr "" " int, ValueRange(3, 10), ValueRange(3, 10)\n" "]" -#: ../../library/typing.rst:1411 +#: ../../library/typing.rst:1401 msgid "``Annotated`` can be used with nested and generic aliases:" msgstr "" -#: ../../library/typing.rst:1413 +#: ../../library/typing.rst:1403 msgid "" "@dataclass\n" "class MaxLen:\n" @@ -2316,35 +2334,29 @@ msgid "" "type V = Vec[int]" msgstr "" -#: ../../library/typing.rst:1425 +#: ../../library/typing.rst:1415 msgid "``Annotated`` cannot be used with an unpacked :class:`TypeVarTuple`::" msgstr "" -#: ../../library/typing.rst:1427 -msgid "type Variadic[*Ts] = Annotated[*Ts, Ann1] # NOT valid" +#: ../../library/typing.rst:1417 +msgid "" +"type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., " +"Ann1] # NOT valid" msgstr "" -#: ../../library/typing.rst:1429 -msgid "This would be equivalent to::" -msgstr "這會等價於: ::" - -#: ../../library/typing.rst:1431 -msgid "Annotated[T1, T2, T3, ..., Ann1]" -msgstr "Annotated[T1, T2, T3, ..., Ann1]" - -#: ../../library/typing.rst:1433 +#: ../../library/typing.rst:1419 msgid "" -"where ``T1``, ``T2``, etc. are :class:`TypeVars `. This would be " -"invalid: only one type should be passed to Annotated." +"where ``T1``, ``T2``, ... are :class:`TypeVars `. This is invalid " +"as only one type should be passed to Annotated." msgstr "" -#: ../../library/typing.rst:1436 +#: ../../library/typing.rst:1422 msgid "" "By default, :func:`get_type_hints` strips the metadata from annotations. " "Pass ``include_extras=True`` to have the metadata preserved:" msgstr "" -#: ../../library/typing.rst:1439 +#: ../../library/typing.rst:1425 msgid "" ">>> from typing import Annotated, get_type_hints\n" ">>> def func(x: Annotated[int, \"metadata\"]) -> None: pass\n" @@ -2362,13 +2374,13 @@ msgstr "" ">>> get_type_hints(func, include_extras=True)\n" "{'x': typing.Annotated[int, 'metadata'], 'return': }" -#: ../../library/typing.rst:1449 +#: ../../library/typing.rst:1435 msgid "" "At runtime, the metadata associated with an ``Annotated`` type can be " "retrieved via the :attr:`!__metadata__` attribute:" msgstr "" -#: ../../library/typing.rst:1452 +#: ../../library/typing.rst:1438 msgid "" ">>> from typing import Annotated\n" ">>> X = Annotated[int, \"very\", \"important\", \"metadata\"]\n" @@ -2384,13 +2396,13 @@ msgstr "" ">>> X.__metadata__\n" "('very', 'important', 'metadata')" -#: ../../library/typing.rst:1461 +#: ../../library/typing.rst:1447 msgid "" -"At runtime, if you want to retrieve the original type wrapped by " -"``Annotated``, use the :attr:`!__origin__` attribute:" +"If you want to retrieve the original type wrapped by ``Annotated``, use " +"the :attr:`!__origin__` attribute:" msgstr "" -#: ../../library/typing.rst:1464 +#: ../../library/typing.rst:1450 msgid "" ">>> from typing import Annotated, get_origin\n" ">>> Password = Annotated[str, \"secret\"]\n" @@ -2402,11 +2414,11 @@ msgstr "" ">>> Password.__origin__\n" "" -#: ../../library/typing.rst:1471 +#: ../../library/typing.rst:1457 msgid "Note that using :func:`get_origin` will return ``Annotated`` itself:" msgstr "" -#: ../../library/typing.rst:1473 +#: ../../library/typing.rst:1459 msgid "" ">>> get_origin(Password)\n" "typing.Annotated" @@ -2414,20 +2426,20 @@ msgstr "" ">>> get_origin(Password)\n" "typing.Annotated" -#: ../../library/typing.rst:1480 +#: ../../library/typing.rst:1466 msgid ":pep:`593` - Flexible function and variable annotations" msgstr "" -#: ../../library/typing.rst:1481 +#: ../../library/typing.rst:1467 msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "" -#: ../../library/typing.rst:1488 ../../library/typing.rst:1572 +#: ../../library/typing.rst:1474 ../../library/typing.rst:1558 msgid "" "Special typing construct for marking user-defined type predicate functions." msgstr "" -#: ../../library/typing.rst:1490 +#: ../../library/typing.rst:1476 msgid "" "``TypeIs`` can be used to annotate the return type of a user-defined type " "predicate function. ``TypeIs`` only accepts a single type argument. At " @@ -2435,7 +2447,7 @@ msgid "" "one positional argument." msgstr "" -#: ../../library/typing.rst:1495 +#: ../../library/typing.rst:1481 msgid "" "``TypeIs`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " @@ -2445,7 +2457,7 @@ msgid "" "predicate\"::" msgstr "" -#: ../../library/typing.rst:1501 +#: ../../library/typing.rst:1487 msgid "" "def is_str(val: str | float):\n" " # \"isinstance\" type predicate\n" @@ -2457,40 +2469,40 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1510 +#: ../../library/typing.rst:1496 msgid "" "Sometimes it would be convenient to use a user-defined boolean function as a " -"type predicate. Such a function should use ``TypeIs[...]`` or :data:" -"`TypeGuard` as its return type to alert static type checkers to this " -"intention. ``TypeIs`` usually has more intuitive behavior than " +"type predicate. Such a function should use ``TypeIs[...]`` " +"or :data:`TypeGuard` as its return type to alert static type checkers to " +"this intention. ``TypeIs`` usually has more intuitive behavior than " "``TypeGuard``, but it cannot be used when the input and output types are " "incompatible (e.g., ``list[object]`` to ``list[int]``) or when the function " "does not return ``True`` for all instances of the narrowed type." msgstr "" -#: ../../library/typing.rst:1518 +#: ../../library/typing.rst:1504 msgid "" "Using ``-> TypeIs[NarrowedType]`` tells the static type checker that for a " "given function:" msgstr "" -#: ../../library/typing.rst:1521 ../../library/typing.rst:1582 +#: ../../library/typing.rst:1507 ../../library/typing.rst:1568 msgid "The return value is a boolean." msgstr "" -#: ../../library/typing.rst:1522 +#: ../../library/typing.rst:1508 msgid "" "If the return value is ``True``, the type of its argument is the " "intersection of the argument's original type and ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1524 +#: ../../library/typing.rst:1510 msgid "" "If the return value is ``False``, the type of its argument is narrowed to " "exclude ``NarrowedType``." msgstr "" -#: ../../library/typing.rst:1529 +#: ../../library/typing.rst:1515 msgid "" "from typing import assert_type, final, TypeIs\n" "\n" @@ -2514,7 +2526,7 @@ msgid "" " assert_type(arg, Unrelated)" msgstr "" -#: ../../library/typing.rst:1550 +#: ../../library/typing.rst:1536 msgid "" "The type inside ``TypeIs`` must be consistent with the type of the " "function's argument; if it is not, static type checkers will raise an " @@ -2523,27 +2535,27 @@ msgid "" "functions in a type-safe manner." msgstr "" -#: ../../library/typing.rst:1556 +#: ../../library/typing.rst:1542 msgid "" "If a ``TypeIs`` function is a class or instance method, then the type in " "``TypeIs`` maps to the type of the second parameter (after ``cls`` or " "``self``)." msgstr "" -#: ../../library/typing.rst:1560 +#: ../../library/typing.rst:1546 msgid "" "In short, the form ``def foo(arg: TypeA) -> TypeIs[TypeB]: ...``, means that " "if ``foo(arg)`` returns ``True``, then ``arg`` is an instance of ``TypeB``, " "and if it returns ``False``, it is not an instance of ``TypeB``." msgstr "" -#: ../../library/typing.rst:1564 +#: ../../library/typing.rst:1550 msgid "" -"``TypeIs`` also works with type variables. For more information, see :pep:" -"`742` (Narrowing types with ``TypeIs``)." +"``TypeIs`` also works with type variables. For more information, " +"see :pep:`742` (Narrowing types with ``TypeIs``)." msgstr "" -#: ../../library/typing.rst:1574 +#: ../../library/typing.rst:1560 msgid "" "Type predicate functions are user-defined functions that return whether " "their argument is an instance of a particular type. ``TypeGuard`` works " @@ -2551,25 +2563,25 @@ msgid "" "checking behavior (see below)." msgstr "" -#: ../../library/typing.rst:1579 +#: ../../library/typing.rst:1565 msgid "" "Using ``-> TypeGuard`` tells the static type checker that for a given " "function:" msgstr "" -#: ../../library/typing.rst:1583 +#: ../../library/typing.rst:1569 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1586 +#: ../../library/typing.rst:1572 msgid "" "``TypeGuard`` also works with type variables. See :pep:`647` for more " "details." msgstr "" -#: ../../library/typing.rst:1590 +#: ../../library/typing.rst:1576 msgid "" "def is_str_list(val: list[object]) -> TypeGuard[list[str]]:\n" " '''Determines whether all objects in the list are strings'''\n" @@ -2584,11 +2596,11 @@ msgid "" " print(\"Not a list of strings!\")" msgstr "" -#: ../../library/typing.rst:1602 +#: ../../library/typing.rst:1588 msgid "``TypeIs`` and ``TypeGuard`` differ in the following ways:" msgstr "" -#: ../../library/typing.rst:1604 +#: ../../library/typing.rst:1590 msgid "" "``TypeIs`` requires the narrowed type to be a subtype of the input type, " "while ``TypeGuard`` does not. The main reason is to allow for things like " @@ -2596,7 +2608,7 @@ msgid "" "subtype of the former, since ``list`` is invariant." msgstr "" -#: ../../library/typing.rst:1608 +#: ../../library/typing.rst:1594 msgid "" "When a ``TypeGuard`` function returns ``True``, type checkers narrow the " "type of the variable to exactly the ``TypeGuard`` type. When a ``TypeIs`` " @@ -2605,7 +2617,7 @@ msgid "" "type. (Technically, this is known as an intersection type.)" msgstr "" -#: ../../library/typing.rst:1612 +#: ../../library/typing.rst:1598 msgid "" "When a ``TypeGuard`` function returns ``False``, type checkers cannot narrow " "the type of the variable at all. When a ``TypeIs`` function returns " @@ -2613,18 +2625,18 @@ msgid "" "``TypeIs`` type." msgstr "" -#: ../../library/typing.rst:1621 +#: ../../library/typing.rst:1607 msgid "Typing operator to conceptually mark an object as having been unpacked." msgstr "" -#: ../../library/typing.rst:1623 +#: ../../library/typing.rst:1609 msgid "" "For example, using the unpack operator ``*`` on a :ref:`type variable tuple " "` is equivalent to using ``Unpack`` to mark the type variable " "tuple as having been unpacked::" msgstr "" -#: ../../library/typing.rst:1627 +#: ../../library/typing.rst:1613 msgid "" "Ts = TypeVarTuple('Ts')\n" "tup: tuple[*Ts]\n" @@ -2632,7 +2644,7 @@ msgid "" "tup: tuple[Unpack[Ts]]" msgstr "" -#: ../../library/typing.rst:1632 +#: ../../library/typing.rst:1618 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " @@ -2640,7 +2652,7 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" -#: ../../library/typing.rst:1638 +#: ../../library/typing.rst:1624 msgid "" "# In older versions of Python, TypeVarTuple and Unpack\n" "# are located in the `typing_extensions` backports package.\n" @@ -2651,13 +2663,13 @@ msgid "" "tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible" msgstr "" -#: ../../library/typing.rst:1646 +#: ../../library/typing.rst:1632 msgid "" "``Unpack`` can also be used along with :class:`typing.TypedDict` for typing " "``**kwargs`` in a function signature::" msgstr "" -#: ../../library/typing.rst:1649 +#: ../../library/typing.rst:1635 msgid "" "from typing import TypedDict, Unpack\n" "\n" @@ -2670,23 +2682,23 @@ msgid "" "def foo(**kwargs: Unpack[Movie]): ..." msgstr "" -#: ../../library/typing.rst:1659 +#: ../../library/typing.rst:1645 msgid "" "See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` typing." msgstr "" -#: ../../library/typing.rst:1664 +#: ../../library/typing.rst:1650 msgid "Building generic types and type aliases" msgstr "" -#: ../../library/typing.rst:1666 +#: ../../library/typing.rst:1652 msgid "" "The following classes should not be used directly as annotations. Their " "intended purpose is to be building blocks for creating generic types and " "type aliases." msgstr "" -#: ../../library/typing.rst:1670 +#: ../../library/typing.rst:1656 msgid "" "These objects can be created through special syntax (:ref:`type parameter " "lists ` and the :keyword:`type` statement). For compatibility " @@ -2694,17 +2706,17 @@ msgid "" "syntax, as documented below." msgstr "" -#: ../../library/typing.rst:1677 +#: ../../library/typing.rst:1663 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1679 +#: ../../library/typing.rst:1665 msgid "" "A generic type is typically declared by adding a list of type parameters " "after the class name::" msgstr "" -#: ../../library/typing.rst:1682 +#: ../../library/typing.rst:1668 msgid "" "class Mapping[KT, VT]:\n" " def __getitem__(self, key: KT) -> VT:\n" @@ -2712,17 +2724,17 @@ msgid "" " # Etc." msgstr "" -#: ../../library/typing.rst:1687 +#: ../../library/typing.rst:1673 msgid "" "Such a class implicitly inherits from ``Generic``. The runtime semantics of " "this syntax are discussed in the :ref:`Language Reference `." msgstr "" -#: ../../library/typing.rst:1691 +#: ../../library/typing.rst:1677 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1693 +#: ../../library/typing.rst:1679 msgid "" "def lookup_name[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:\n" " try:\n" @@ -2736,20 +2748,20 @@ msgstr "" " except KeyError:\n" " return default" -#: ../../library/typing.rst:1699 +#: ../../library/typing.rst:1685 msgid "" "Here the brackets after the function name indicate a :ref:`generic function " "`." msgstr "" -#: ../../library/typing.rst:1702 +#: ../../library/typing.rst:1688 msgid "" "For backwards compatibility, generic classes can also be declared by " "explicitly inheriting from ``Generic``. In this case, the type parameters " "must be declared separately::" msgstr "" -#: ../../library/typing.rst:1707 +#: ../../library/typing.rst:1693 msgid "" "KT = TypeVar('KT')\n" "VT = TypeVar('VT')\n" @@ -2767,18 +2779,18 @@ msgstr "" " ...\n" " # Etc." -#: ../../library/typing.rst:1719 +#: ../../library/typing.rst:1705 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1721 +#: ../../library/typing.rst:1707 msgid "" "The preferred way to construct a type variable is via the dedicated syntax " "for :ref:`generic functions `, :ref:`generic classes " "`, and :ref:`generic type aliases `::" msgstr "" -#: ../../library/typing.rst:1726 +#: ../../library/typing.rst:1712 msgid "" "class Sequence[T]: # T is a TypeVar\n" " ..." @@ -2786,13 +2798,13 @@ msgstr "" "class Sequence[T]: # T 是一個 TypeVar\n" " ..." -#: ../../library/typing.rst:1729 +#: ../../library/typing.rst:1715 msgid "" "This syntax can also be used to create bounded and constrained type " "variables::" msgstr "" -#: ../../library/typing.rst:1732 +#: ../../library/typing.rst:1718 msgid "" "class StrSequence[S: str]: # S is a TypeVar with a `str` upper bound;\n" " ... # we can say that S is \"bounded by `str`\"\n" @@ -2803,20 +2815,23 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1739 +#: ../../library/typing.rst:1725 msgid "" "However, if desired, reusable type variables can also be constructed " "manually, like so::" msgstr "" -#: ../../library/typing.rst:1741 +#: ../../library/typing.rst:1727 msgid "" "T = TypeVar('T') # Can be anything\n" "S = TypeVar('S', bound=str) # Can be any subtype of str\n" "A = TypeVar('A', str, bytes) # Must be exactly str or bytes" msgstr "" +"T = TypeVar('T') # 可以是任何東西\n" +"S = TypeVar('S', bound=str) # 可以是任何 str 的子型別\n" +"A = TypeVar('A', str, bytes) # 必須是 str 或 bytes" -#: ../../library/typing.rst:1745 +#: ../../library/typing.rst:1731 msgid "" "Type variables exist primarily for the benefit of static type checkers. " "They serve as the parameters for generic types as well as for generic " @@ -2824,7 +2839,7 @@ msgid "" "information on generic types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1751 +#: ../../library/typing.rst:1737 msgid "" "def repeat[T](x: T, n: int) -> Sequence[T]:\n" " \"\"\"Return a list containing n references to x.\"\"\"\n" @@ -2842,13 +2857,13 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:1766 +#: ../../library/typing.rst:1752 msgid "" "Note that type variables can be *bounded*, *constrained*, or neither, but " "cannot be both bounded *and* constrained." msgstr "" -#: ../../library/typing.rst:1769 +#: ../../library/typing.rst:1755 msgid "" "The variance of type variables is inferred by type checkers when they are " "created through the :ref:`type parameter syntax ` or when " @@ -2858,14 +2873,14 @@ msgid "" "invariant. See :pep:`484` and :pep:`695` for more details." msgstr "" -#: ../../library/typing.rst:1777 +#: ../../library/typing.rst:1763 msgid "" "Bounded type variables and constrained type variables have different " "semantics in several important ways. Using a *bounded* type variable means " "that the ``TypeVar`` will be solved using the most specific type possible::" msgstr "" -#: ../../library/typing.rst:1781 +#: ../../library/typing.rst:1767 msgid "" "x = print_capitalized('a string')\n" "reveal_type(x) # revealed type is str\n" @@ -2879,13 +2894,13 @@ msgid "" "z = print_capitalized(45) # error: int is not a subtype of str" msgstr "" -#: ../../library/typing.rst:1792 +#: ../../library/typing.rst:1778 msgid "" "The upper bound of a type variable can be a concrete type, abstract type " "(ABC or Protocol), or even a union of types::" msgstr "" -#: ../../library/typing.rst:1795 +#: ../../library/typing.rst:1781 msgid "" "# Can be anything with an __abs__ method\n" "def print_abs[T: SupportsAbs](arg: T) -> None:\n" @@ -2896,13 +2911,13 @@ msgid "" "V = TypeVar('V', bound=SupportsAbs) # Can be anything with an __abs__ method" msgstr "" -#: ../../library/typing.rst:1804 +#: ../../library/typing.rst:1790 msgid "" "Using a *constrained* type variable, however, means that the ``TypeVar`` can " "only ever be solved as being exactly one of the constraints given::" msgstr "" -#: ../../library/typing.rst:1807 +#: ../../library/typing.rst:1793 msgid "" "a = concatenate('one', 'two')\n" "reveal_type(a) # revealed type is str\n" @@ -2915,88 +2930,88 @@ msgid "" "or bytes in a function call, but not both" msgstr "" -#: ../../library/typing.rst:1815 +#: ../../library/typing.rst:1801 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." -msgstr "" +msgstr "在 runtime ``isinstance(x, T)`` 會引發 :exc:`TypeError`。" -#: ../../library/typing.rst:1819 +#: ../../library/typing.rst:1805 msgid "The name of the type variable." msgstr "" -#: ../../library/typing.rst:1823 +#: ../../library/typing.rst:1809 msgid "Whether the type var has been explicitly marked as covariant." msgstr "" -#: ../../library/typing.rst:1827 +#: ../../library/typing.rst:1813 msgid "Whether the type var has been explicitly marked as contravariant." msgstr "" -#: ../../library/typing.rst:1831 +#: ../../library/typing.rst:1817 msgid "" "Whether the type variable's variance should be inferred by type checkers." msgstr "" -#: ../../library/typing.rst:1837 +#: ../../library/typing.rst:1823 msgid "The upper bound of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1841 +#: ../../library/typing.rst:1827 msgid "" "For type variables created through :ref:`type parameter syntax `, the bound is evaluated only when the attribute is accessed, not " "when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1847 +#: ../../library/typing.rst:1833 msgid "A tuple containing the constraints of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1851 +#: ../../library/typing.rst:1837 msgid "" "For type variables created through :ref:`type parameter syntax `, the constraints are evaluated only when the attribute is accessed, " "not when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1857 +#: ../../library/typing.rst:1843 msgid "" "The default value of the type variable, or :data:`typing.NoDefault` if it " "has no default." msgstr "" -#: ../../library/typing.rst:1864 +#: ../../library/typing.rst:1850 msgid "" "Return whether or not the type variable has a default value. This is " -"equivalent to checking whether :attr:`__default__` is not the :data:`typing." -"NoDefault` singleton, except that it does not force evaluation of the :ref:" -"`lazily evaluated ` default value." +"equivalent to checking whether :attr:`__default__` is not " +"the :data:`typing.NoDefault` singleton, except that it does not force " +"evaluation of the :ref:`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:1873 +#: ../../library/typing.rst:1859 msgid "" "Type variables can now be declared using the :ref:`type parameter ` syntax introduced by :pep:`695`. The ``infer_variance`` parameter " "was added." msgstr "" -#: ../../library/typing.rst:1879 ../../library/typing.rst:2018 -#: ../../library/typing.rst:2120 +#: ../../library/typing.rst:1865 ../../library/typing.rst:2004 +#: ../../library/typing.rst:2106 msgid "Support for default values was added." -msgstr "" +msgstr "新增對預設值的支援。" -#: ../../library/typing.rst:1885 +#: ../../library/typing.rst:1871 msgid "" "Type variable tuple. A specialized form of :ref:`type variable ` " "that enables *variadic* generics." msgstr "" -#: ../../library/typing.rst:1888 +#: ../../library/typing.rst:1874 msgid "" "Type variable tuples can be declared in :ref:`type parameter lists ` using a single asterisk (``*``) before the name::" msgstr "" -#: ../../library/typing.rst:1891 +#: ../../library/typing.rst:1877 msgid "" "def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, " "T]:\n" @@ -3006,11 +3021,11 @@ msgstr "" "T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1894 +#: ../../library/typing.rst:1880 msgid "Or by explicitly invoking the ``TypeVarTuple`` constructor::" msgstr "" -#: ../../library/typing.rst:1896 +#: ../../library/typing.rst:1882 msgid "" "T = TypeVar(\"T\")\n" "Ts = TypeVarTuple(\"Ts\")\n" @@ -3024,7 +3039,7 @@ msgstr "" "def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1902 +#: ../../library/typing.rst:1888 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " @@ -3032,7 +3047,7 @@ msgid "" "wrapped in a tuple. For example::" msgstr "" -#: ../../library/typing.rst:1907 +#: ../../library/typing.rst:1893 msgid "" "# T is bound to int, Ts is bound to ()\n" "# Return value is (1,), which has type tuple[int]\n" @@ -3052,7 +3067,7 @@ msgid "" "move_first_element_to_last(tup=())" msgstr "" -#: ../../library/typing.rst:1924 +#: ../../library/typing.rst:1910 msgid "" "Note the use of the unpacking operator ``*`` in ``tuple[T, *Ts]``. " "Conceptually, you can think of ``Ts`` as a tuple of type variables ``(T1, " @@ -3062,26 +3077,29 @@ msgid "" "` instead, as ``Unpack[Ts]``.)" msgstr "" -#: ../../library/typing.rst:1932 +#: ../../library/typing.rst:1918 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" -#: ../../library/typing.rst:1935 +#: ../../library/typing.rst:1921 msgid "" "x: Ts # Not valid\n" "x: tuple[Ts] # Not valid\n" "x: tuple[*Ts] # The correct way to do it" msgstr "" +"x: Ts # 無效\n" +"x: tuple[Ts] # 無效\n" +"x: tuple[*Ts] # 正確的做法" -#: ../../library/typing.rst:1939 +#: ../../library/typing.rst:1925 msgid "" "Type variable tuples can be used in the same contexts as normal type " "variables. For example, in class definitions, arguments, and return types::" msgstr "" -#: ../../library/typing.rst:1942 +#: ../../library/typing.rst:1928 msgid "" "class Array[*Shape]:\n" " def __getitem__(self, key: tuple[*Shape]) -> float: ...\n" @@ -3093,12 +3111,12 @@ msgstr "" " def __abs__(self) -> \"Array[*Shape]\": ...\n" " def get_shape(self) -> tuple[*Shape]: ..." -#: ../../library/typing.rst:1947 +#: ../../library/typing.rst:1933 msgid "" "Type variable tuples can be happily combined with normal type variables:" msgstr "" -#: ../../library/typing.rst:1949 +#: ../../library/typing.rst:1935 msgid "" "class Array[DType, *Shape]: # This is fine\n" " pass\n" @@ -3113,26 +3131,29 @@ msgid "" "int_array_2d: Array[int, Height, Width] = Array() # Yup, fine too" msgstr "" -#: ../../library/typing.rst:1963 +#: ../../library/typing.rst:1949 msgid "" "However, note that at most one type variable tuple may appear in a single " "list of type arguments or type parameters::" msgstr "" -#: ../../library/typing.rst:1966 +#: ../../library/typing.rst:1952 msgid "" "x: tuple[*Ts, *Ts] # Not valid\n" "class Array[*Shape, *Shape]: # Not valid\n" " pass" msgstr "" +"x: tuple[*Ts, *Ts] # 無效\n" +"class Array[*Shape, *Shape]: # 無效\n" +" pass" -#: ../../library/typing.rst:1970 +#: ../../library/typing.rst:1956 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" -#: ../../library/typing.rst:1973 +#: ../../library/typing.rst:1959 msgid "" "def call_soon[*Ts](\n" " callback: Callable[[*Ts], None],\n" @@ -3148,7 +3169,7 @@ msgstr "" " ...\n" " callback(*args)" -#: ../../library/typing.rst:1980 +#: ../../library/typing.rst:1966 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -3157,61 +3178,61 @@ msgid "" "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" -#: ../../library/typing.rst:1987 +#: ../../library/typing.rst:1973 msgid "See :pep:`646` for more details on type variable tuples." msgstr "" -#: ../../library/typing.rst:1991 +#: ../../library/typing.rst:1977 msgid "The name of the type variable tuple." msgstr "" -#: ../../library/typing.rst:1995 +#: ../../library/typing.rst:1981 msgid "" "The default value of the type variable tuple, or :data:`typing.NoDefault` if " "it has no default." msgstr "" -#: ../../library/typing.rst:2002 +#: ../../library/typing.rst:1988 msgid "" "Return whether or not the type variable tuple has a default value. This is " -"equivalent to checking whether :attr:`__default__` is not the :data:`typing." -"NoDefault` singleton, except that it does not force evaluation of the :ref:" -"`lazily evaluated ` default value." +"equivalent to checking whether :attr:`__default__` is not " +"the :data:`typing.NoDefault` singleton, except that it does not force " +"evaluation of the :ref:`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:2013 +#: ../../library/typing.rst:1999 msgid "" "Type variable tuples can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2022 +#: ../../library/typing.rst:2008 msgid "" "Parameter specification variable. A specialized version of :ref:`type " "variables `." msgstr "" -#: ../../library/typing.rst:2025 +#: ../../library/typing.rst:2011 msgid "" "In :ref:`type parameter lists `, parameter specifications can " "be declared with two asterisks (``**``)::" msgstr "" -#: ../../library/typing.rst:2028 +#: ../../library/typing.rst:2014 msgid "type IntFunc[**P] = Callable[P, int]" msgstr "type IntFunc[**P] = Callable[P, int]" -#: ../../library/typing.rst:2030 +#: ../../library/typing.rst:2016 msgid "" "For compatibility with Python 3.11 and earlier, ``ParamSpec`` objects can " "also be created as follows::" msgstr "" -#: ../../library/typing.rst:2033 +#: ../../library/typing.rst:2019 msgid "P = ParamSpec('P')" msgstr "P = ParamSpec('P')" -#: ../../library/typing.rst:2035 +#: ../../library/typing.rst:2021 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -3221,7 +3242,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:2042 +#: ../../library/typing.rst:2028 msgid "" "For example, to add basic logging to a function, one can create a decorator " "``add_logging`` to log function calls. The parameter specification variable " @@ -3229,7 +3250,7 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:2047 +#: ../../library/typing.rst:2033 msgid "" "from collections.abc import Callable\n" "import logging\n" @@ -3247,97 +3268,98 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:2062 +#: ../../library/typing.rst:2048 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " "use a :class:`TypeVar` with upper bound ``Callable[..., Any]``. However " "this causes two problems:" msgstr "" -#: ../../library/typing.rst:2066 +#: ../../library/typing.rst:2052 msgid "" "The type checker can't type check the ``inner`` function because ``*args`` " "and ``**kwargs`` have to be typed :data:`Any`." msgstr "" -#: ../../library/typing.rst:2068 +#: ../../library/typing.rst:2054 msgid "" ":func:`~cast` may be required in the body of the ``add_logging`` decorator " "when returning the ``inner`` function, or the static type checker must be " "told to ignore the ``return inner``." msgstr "" -#: ../../library/typing.rst:2075 +#: ../../library/typing.rst:2061 msgid "" -"Since ``ParamSpec`` captures both positional and keyword parameters, ``P." -"args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " +"Since ``ParamSpec`` captures both positional and keyword parameters, " +"``P.args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " "components. ``P.args`` represents the tuple of positional parameters in a " "given call and should only be used to annotate ``*args``. ``P.kwargs`` " "represents the mapping of keyword parameters to their values in a given " "call, and should be only be used to annotate ``**kwargs``. Both attributes " "require the annotated parameter to be in scope. At runtime, ``P.args`` and " -"``P.kwargs`` are instances respectively of :class:`ParamSpecArgs` and :class:" -"`ParamSpecKwargs`." +"``P.kwargs`` are instances respectively of :class:`ParamSpecArgs` " +"and :class:`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:2087 +#: ../../library/typing.rst:2073 msgid "The name of the parameter specification." msgstr "" -#: ../../library/typing.rst:2091 +#: ../../library/typing.rst:2077 msgid "" -"The default value of the parameter specification, or :data:`typing." -"NoDefault` if it has no default." +"The default value of the parameter specification, " +"or :data:`typing.NoDefault` if it has no default." msgstr "" -#: ../../library/typing.rst:2098 +#: ../../library/typing.rst:2084 msgid "" "Return whether or not the parameter specification has a default value. This " -"is equivalent to checking whether :attr:`__default__` is not the :data:" -"`typing.NoDefault` singleton, except that it does not force evaluation of " -"the :ref:`lazily evaluated ` default value." +"is equivalent to checking whether :attr:`__default__` is not " +"the :data:`typing.NoDefault` singleton, except that it does not force " +"evaluation of the :ref:`lazily evaluated ` default value." msgstr "" -#: ../../library/typing.rst:2105 +#: ../../library/typing.rst:2091 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " -"generic types. The ``bound`` argument is also accepted, similar to :class:" -"`TypeVar`. However the actual semantics of these keywords are yet to be " -"decided." +"generic types. The ``bound`` argument is also accepted, similar " +"to :class:`TypeVar`. However the actual semantics of these keywords are yet " +"to be decided." msgstr "" -#: ../../library/typing.rst:2115 +#: ../../library/typing.rst:2101 msgid "" "Parameter specifications can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:2123 +#: ../../library/typing.rst:2109 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:2129 +#: ../../library/typing.rst:2115 msgid ":data:`Concatenate`" msgstr ":data:`Concatenate`" -#: ../../library/typing.rst:2135 +#: ../../library/typing.rst:2121 msgid "" -"Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." -"args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " -"``P.kwargs`` is an instance of ``ParamSpecKwargs``. They are intended for " -"runtime introspection and have no special meaning to static type checkers." +"Arguments and keyword arguments attributes of a :class:`ParamSpec`. The " +"``P.args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, " +"and ``P.kwargs`` is an instance of ``ParamSpecKwargs``. They are intended " +"for runtime introspection and have no special meaning to static type " +"checkers." msgstr "" -#: ../../library/typing.rst:2140 +#: ../../library/typing.rst:2126 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" -#: ../../library/typing.rst:2143 +#: ../../library/typing.rst:2129 msgid "" ">>> from typing import ParamSpec, get_origin\n" ">>> P = ParamSpec(\"P\")\n" @@ -3353,11 +3375,11 @@ msgstr "" ">>> get_origin(P.kwargs) is P\n" "True" -#: ../../library/typing.rst:2157 +#: ../../library/typing.rst:2143 msgid "The type of type aliases created through the :keyword:`type` statement." msgstr "" -#: ../../library/typing.rst:2161 +#: ../../library/typing.rst:2147 msgid "" ">>> type Alias = int\n" ">>> type(Alias)\n" @@ -3367,11 +3389,11 @@ msgstr "" ">>> type(Alias)\n" "" -#: ../../library/typing.rst:2171 +#: ../../library/typing.rst:2157 msgid "The name of the type alias:" msgstr "" -#: ../../library/typing.rst:2173 +#: ../../library/typing.rst:2159 msgid "" ">>> type Alias = int\n" ">>> Alias.__name__\n" @@ -3381,11 +3403,11 @@ msgstr "" ">>> Alias.__name__\n" "'Alias'" -#: ../../library/typing.rst:2181 +#: ../../library/typing.rst:2167 msgid "The module in which the type alias was defined::" msgstr "" -#: ../../library/typing.rst:2183 +#: ../../library/typing.rst:2169 msgid "" ">>> type Alias = int\n" ">>> Alias.__module__\n" @@ -3395,13 +3417,13 @@ msgstr "" ">>> Alias.__module__\n" "'__main__'" -#: ../../library/typing.rst:2189 +#: ../../library/typing.rst:2175 msgid "" "The type parameters of the type alias, or an empty tuple if the alias is not " "generic:" msgstr "" -#: ../../library/typing.rst:2192 +#: ../../library/typing.rst:2178 msgid "" ">>> type ListOrSet[T] = list[T] | set[T]\n" ">>> ListOrSet.__type_params__\n" @@ -3417,14 +3439,14 @@ msgstr "" ">>> NotGeneric.__type_params__\n" "()" -#: ../../library/typing.rst:2203 +#: ../../library/typing.rst:2189 msgid "" "The type alias's value. This is :ref:`lazily evaluated `, " "so names used in the definition of the alias are not resolved until the " "``__value__`` attribute is accessed:" msgstr "" -#: ../../library/typing.rst:2207 +#: ../../library/typing.rst:2193 msgid "" ">>> type Mutually = Recursive\n" ">>> type Recursive = Mutually\n" @@ -3448,27 +3470,27 @@ msgstr "" ">>> Recursive.__value__\n" "Mutually" -#: ../../library/typing.rst:2221 +#: ../../library/typing.rst:2207 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:2223 +#: ../../library/typing.rst:2209 msgid "" "These functions and classes should not be used directly as annotations. " "Their intended purpose is to be building blocks for creating and declaring " "types." msgstr "" -#: ../../library/typing.rst:2229 +#: ../../library/typing.rst:2215 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:2231 ../../library/typing.rst:2323 -#: ../../library/typing.rst:3364 +#: ../../library/typing.rst:2217 ../../library/typing.rst:2309 +#: ../../library/typing.rst:3357 msgid "Usage::" -msgstr "" +msgstr "用法: ::" -#: ../../library/typing.rst:2233 +#: ../../library/typing.rst:2219 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3478,20 +3500,20 @@ msgstr "" " name: str\n" " id: int" -#: ../../library/typing.rst:2237 +#: ../../library/typing.rst:2223 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../library/typing.rst:2239 +#: ../../library/typing.rst:2225 msgid "Employee = collections.namedtuple('Employee', ['name', 'id'])" msgstr "Employee = collections.namedtuple('Employee', ['name', 'id'])" -#: ../../library/typing.rst:2241 +#: ../../library/typing.rst:2227 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:2243 +#: ../../library/typing.rst:2229 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3507,12 +3529,12 @@ msgstr "" "employee = Employee('Guido')\n" "assert employee.id == 3" -#: ../../library/typing.rst:2250 +#: ../../library/typing.rst:2236 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:2252 +#: ../../library/typing.rst:2238 msgid "" "The resulting class has an extra attribute ``__annotations__`` giving a dict " "that maps the field names to the field types. (The field names are in the " @@ -3521,11 +3543,11 @@ msgid "" "API.)" msgstr "" -#: ../../library/typing.rst:2258 +#: ../../library/typing.rst:2244 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:2260 +#: ../../library/typing.rst:2246 msgid "" "class Employee(NamedTuple):\n" " \"\"\"Represents an employee.\"\"\"\n" @@ -3536,11 +3558,11 @@ msgid "" " return f''" msgstr "" -#: ../../library/typing.rst:2268 +#: ../../library/typing.rst:2254 msgid "``NamedTuple`` subclasses can be generic::" msgstr "" -#: ../../library/typing.rst:2270 +#: ../../library/typing.rst:2256 msgid "" "class Group[T](NamedTuple):\n" " key: T\n" @@ -3550,11 +3572,11 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2274 +#: ../../library/typing.rst:2260 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:2276 +#: ../../library/typing.rst:2262 msgid "" "# For creating a generic NamedTuple on Python 3.11\n" "T = TypeVar(\"T\")\n" @@ -3567,38 +3589,38 @@ msgid "" "Employee = NamedTuple('Employee', [('name', str), ('id', int)])" msgstr "" -#: ../../library/typing.rst:2286 +#: ../../library/typing.rst:2272 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:2289 +#: ../../library/typing.rst:2275 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:2292 +#: ../../library/typing.rst:2278 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:2296 +#: ../../library/typing.rst:2282 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:2300 +#: ../../library/typing.rst:2286 msgid "Added support for generic namedtuples." msgstr "" -#: ../../library/typing.rst:2303 +#: ../../library/typing.rst:2289 msgid "" "The undocumented keyword argument syntax for creating NamedTuple classes " "(``NT = NamedTuple(\"NT\", x=int)``) is deprecated, and will be disallowed " "in 3.15. Use the class-based syntax or the functional syntax instead." msgstr "" -#: ../../library/typing.rst:2308 +#: ../../library/typing.rst:2294 msgid "" "When using the functional syntax to create a NamedTuple class, failing to " "pass a value to the 'fields' parameter (``NT = NamedTuple(\"NT\")``) is " @@ -3608,48 +3630,48 @@ msgid "" "NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", [])``." msgstr "" -#: ../../library/typing.rst:2318 +#: ../../library/typing.rst:2304 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" -#: ../../library/typing.rst:2320 +#: ../../library/typing.rst:2306 msgid "" "A ``NewType`` is considered a distinct type by a typechecker. At runtime, " "however, calling a ``NewType`` returns its argument unchanged." msgstr "" -#: ../../library/typing.rst:2325 +#: ../../library/typing.rst:2311 msgid "" "UserId = NewType('UserId', int) # Declare the NewType \"UserId\"\n" "first_user = UserId(1) # \"UserId\" returns the argument unchanged at " "runtime" msgstr "" -#: ../../library/typing.rst:2330 +#: ../../library/typing.rst:2316 msgid "The module in which the new type is defined." msgstr "" -#: ../../library/typing.rst:2334 +#: ../../library/typing.rst:2320 msgid "The name of the new type." msgstr "" -#: ../../library/typing.rst:2338 +#: ../../library/typing.rst:2324 msgid "The type that the new type is based on." msgstr "" -#: ../../library/typing.rst:2342 +#: ../../library/typing.rst:2328 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:2347 +#: ../../library/typing.rst:2333 msgid "Base class for protocol classes." msgstr "" -#: ../../library/typing.rst:2349 +#: ../../library/typing.rst:2335 msgid "Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:2351 +#: ../../library/typing.rst:2337 msgid "" "class Proto(Protocol):\n" " def meth(self) -> int:\n" @@ -3659,13 +3681,13 @@ msgstr "" " def meth(self) -> int:\n" " ..." -#: ../../library/typing.rst:2355 +#: ../../library/typing.rst:2341 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:2358 +#: ../../library/typing.rst:2344 msgid "" "class C:\n" " def meth(self) -> int:\n" @@ -3677,19 +3699,20 @@ msgid "" "func(C()) # Passes static type check" msgstr "" -#: ../../library/typing.rst:2367 +#: ../../library/typing.rst:2353 msgid "" -"See :pep:`544` for more details. Protocol classes decorated with :func:" -"`runtime_checkable` (described later) act as simple-minded runtime protocols " -"that check only the presence of given attributes, ignoring their type " -"signatures." +"See :pep:`544` for more details. Protocol classes decorated " +"with :func:`runtime_checkable` (described later) act as simple-minded " +"runtime protocols that check only the presence of given attributes, ignoring " +"their type signatures. Protocol classes without this decorator cannot be " +"used as the second argument to :func:`isinstance` or :func:`issubclass`." msgstr "" -#: ../../library/typing.rst:2372 +#: ../../library/typing.rst:2359 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:2374 +#: ../../library/typing.rst:2361 msgid "" "class GenProto[T](Protocol):\n" " def meth(self) -> T:\n" @@ -3699,13 +3722,13 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2378 +#: ../../library/typing.rst:2365 msgid "" "In code that needs to be compatible with Python 3.11 or older, generic " "Protocols can be written as follows::" msgstr "" -#: ../../library/typing.rst:2381 +#: ../../library/typing.rst:2368 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -3719,20 +3742,19 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2391 +#: ../../library/typing.rst:2378 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:2393 +#: ../../library/typing.rst:2380 msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " -"This raises :exc:`TypeError` when applied to a non-protocol class. This " -"allows a simple-minded structural check, very similar to \"one trick " -"ponies\" in :mod:`collections.abc` such as :class:`~collections.abc." -"Iterable`. For example::" +"This allows a simple-minded structural check, very similar to \"one trick " +"ponies\" in :mod:`collections.abc` such " +"as :class:`~collections.abc.Iterable`. For example::" msgstr "" -#: ../../library/typing.rst:2398 +#: ../../library/typing.rst:2384 msgid "" "@runtime_checkable\n" "class Closable(Protocol):\n" @@ -3760,18 +3782,23 @@ msgstr "" "import threading\n" "assert isinstance(threading.Thread(name='Bob'), Named)" -#: ../../library/typing.rst:2413 +#: ../../library/typing.rst:2397 +msgid "" +"This decorator raises :exc:`TypeError` when applied to a non-protocol class." +msgstr "" + +#: ../../library/typing.rst:2401 msgid "" ":func:`!runtime_checkable` will check only the presence of the required " -"methods or attributes, not their type signatures or types. For example, :" -"class:`ssl.SSLObject` is a class, therefore it passes an :func:`issubclass` " -"check against :ref:`Callable `. However, the ``ssl." -"SSLObject.__init__`` method exists only to raise a :exc:`TypeError` with a " -"more informative message, therefore making it impossible to call " -"(instantiate) :class:`ssl.SSLObject`." +"methods or attributes, not their type signatures or types. For " +"example, :class:`ssl.SSLObject` is a class, therefore it passes " +"an :func:`issubclass` check against :ref:`Callable `. " +"However, the ``ssl.SSLObject.__init__`` method exists only to raise " +"a :exc:`TypeError` with a more informative message, therefore making it " +"impossible to call (instantiate) :class:`ssl.SSLObject`." msgstr "" -#: ../../library/typing.rst:2424 +#: ../../library/typing.rst:2412 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" @@ -3779,7 +3806,7 @@ msgid "" "calls for structural checks in performance-sensitive code." msgstr "" -#: ../../library/typing.rst:2432 +#: ../../library/typing.rst:2420 msgid "" "The internal implementation of :func:`isinstance` checks against runtime-" "checkable protocols now uses :func:`inspect.getattr_static` to look up " @@ -3789,22 +3816,23 @@ msgid "" "versa. Most users are unlikely to be affected by this change." msgstr "" -#: ../../library/typing.rst:2441 +#: ../../library/typing.rst:2429 msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " "onto a runtime-checkable protocol will still work, but will have no impact " -"on :func:`isinstance` checks comparing objects to the protocol. See :ref:" -"`\"What's new in Python 3.12\" ` for more details." +"on :func:`isinstance` checks comparing objects to the protocol. " +"See :ref:`\"What's new in Python 3.12\" ` for more " +"details." msgstr "" -#: ../../library/typing.rst:2452 +#: ../../library/typing.rst:2440 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: ../../library/typing.rst:2455 +#: ../../library/typing.rst:2443 msgid "" "``TypedDict`` declares a dictionary type that expects all of its instances " "to have a certain set of keys, where each key is associated with a value of " @@ -3812,7 +3840,7 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:2461 +#: ../../library/typing.rst:2449 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3825,41 +3853,46 @@ msgid "" "assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')" msgstr "" -#: ../../library/typing.rst:2471 +#: ../../library/typing.rst:2459 msgid "" "An alternative way to create a ``TypedDict`` is by using function-call " "syntax. The second argument must be a literal :class:`dict`::" msgstr "" -#: ../../library/typing.rst:2474 +#: ../../library/typing.rst:2462 msgid "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" msgstr "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" -#: ../../library/typing.rst:2476 +#: ../../library/typing.rst:2464 msgid "" -"This functional syntax allows defining keys which are not valid :ref:" -"`identifiers `, for example because they are keywords or " -"contain hyphens::" +"This functional syntax allows defining keys which are not " +"valid :ref:`identifiers `, for example because they are " +"keywords or contain hyphens, or when key names must not be :ref:`mangled " +"` like regular private names::" msgstr "" -#: ../../library/typing.rst:2480 +#: ../../library/typing.rst:2469 msgid "" "# raises SyntaxError\n" "class Point2D(TypedDict):\n" " in: int # 'in' is a keyword\n" " x-y: int # name with hyphens\n" "\n" +"class Definition(TypedDict):\n" +" __schema: str # mangled to `_Definition__schema`\n" +"\n" "# OK, functional syntax\n" -"Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})" +"Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})\n" +"Definition = TypedDict('Definition', {'__schema': str}) # not mangled" msgstr "" -#: ../../library/typing.rst:2488 +#: ../../library/typing.rst:2481 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " "mark individual keys as non-required using :data:`NotRequired`::" msgstr "" -#: ../../library/typing.rst:2491 +#: ../../library/typing.rst:2484 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3870,20 +3903,28 @@ msgid "" "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': " "NotRequired[str]})" msgstr "" +"class Point2D(TypedDict):\n" +" x: int\n" +" y: int\n" +" label: NotRequired[str]\n" +"\n" +"# 替代語法\n" +"Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': " +"NotRequired[str]})" -#: ../../library/typing.rst:2499 +#: ../../library/typing.rst:2492 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." msgstr "" -#: ../../library/typing.rst:2502 +#: ../../library/typing.rst:2495 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" -#: ../../library/typing.rst:2505 +#: ../../library/typing.rst:2498 msgid "" "class Point2D(TypedDict, total=False):\n" " x: int\n" @@ -3892,8 +3933,14 @@ msgid "" "# Alternative syntax\n" "Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" msgstr "" +"class Point2D(TypedDict, total=False):\n" +" x: int\n" +" y: int\n" +"\n" +"# 替代語法\n" +"Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" -#: ../../library/typing.rst:2512 +#: ../../library/typing.rst:2505 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have any of the keys " "omitted. A type checker is only expected to support a literal ``False`` or " @@ -3901,13 +3948,13 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:2517 +#: ../../library/typing.rst:2510 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" -#: ../../library/typing.rst:2520 +#: ../../library/typing.rst:2513 msgid "" "class Point2D(TypedDict, total=False):\n" " x: Required[int]\n" @@ -3921,14 +3968,25 @@ msgid "" " 'label': str\n" "}, total=False)" msgstr "" +"class Point2D(TypedDict, total=False):\n" +" x: Required[int]\n" +" y: Required[int]\n" +" label: str\n" +"\n" +"# 替代語法\n" +"Point2D = TypedDict('Point2D', {\n" +" 'x': Required[int],\n" +" 'y': Required[int],\n" +" 'label': str\n" +"}, total=False)" -#: ../../library/typing.rst:2532 +#: ../../library/typing.rst:2525 msgid "" "It is possible for a ``TypedDict`` type to inherit from one or more other " "``TypedDict`` types using the class-based syntax. Usage::" msgstr "" -#: ../../library/typing.rst:2536 +#: ../../library/typing.rst:2529 msgid "" "class Point3D(Point2D):\n" " z: int" @@ -3936,13 +3994,13 @@ msgstr "" "class Point3D(Point2D):\n" " z: int" -#: ../../library/typing.rst:2539 +#: ../../library/typing.rst:2532 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:2542 +#: ../../library/typing.rst:2535 msgid "" "class Point3D(TypedDict):\n" " x: int\n" @@ -3954,13 +4012,13 @@ msgstr "" " y: int\n" " z: int" -#: ../../library/typing.rst:2547 +#: ../../library/typing.rst:2540 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:2550 +#: ../../library/typing.rst:2543 msgid "" "class X(TypedDict):\n" " x: int\n" @@ -3974,12 +4032,23 @@ msgid "" "\n" "class XZ(X, Z): pass # raises TypeError" msgstr "" +"class X(TypedDict):\n" +" x: int\n" +"\n" +"class Y(TypedDict):\n" +" y: int\n" +"\n" +"class Z(object): pass # 一個非 TypedDict 的類別\n" +"\n" +"class XY(X, Y): pass # OK\n" +"\n" +"class XZ(X, Z): pass # 引發 TypeError" -#: ../../library/typing.rst:2562 +#: ../../library/typing.rst:2555 msgid "A ``TypedDict`` can be generic::" msgstr "" -#: ../../library/typing.rst:2564 +#: ../../library/typing.rst:2557 msgid "" "class Group[T](TypedDict):\n" " key: T\n" @@ -3989,13 +4058,13 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2568 +#: ../../library/typing.rst:2561 msgid "" "To create a generic ``TypedDict`` that is compatible with Python 3.11 or " "lower, inherit from :class:`Generic` explicitly:" msgstr "" -#: ../../library/typing.rst:2571 +#: ../../library/typing.rst:2564 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -4009,19 +4078,20 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2579 +#: ../../library/typing.rst:2572 msgid "" -"A ``TypedDict`` can be introspected via annotations dicts (see :ref:" -"`annotations-howto` for more information on annotations best practices), :" -"attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." +"A ``TypedDict`` can be introspected via annotations dicts " +"(see :ref:`annotations-howto` for more information on annotations best " +"practices), :attr:`__total__`, :attr:`__required_keys__`, " +"and :attr:`__optional_keys__`." msgstr "" -#: ../../library/typing.rst:2585 +#: ../../library/typing.rst:2578 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" -#: ../../library/typing.rst:2588 +#: ../../library/typing.rst:2581 msgid "" ">>> from typing import TypedDict\n" ">>> class Point2D(TypedDict): pass\n" @@ -4045,7 +4115,7 @@ msgstr "" ">>> Point3D.__total__\n" "True" -#: ../../library/typing.rst:2601 +#: ../../library/typing.rst:2594 msgid "" "This attribute reflects *only* the value of the ``total`` argument to the " "current ``TypedDict`` class, not whether the class is semantically total. " @@ -4056,21 +4126,21 @@ msgid "" "introspection." msgstr "" -#: ../../library/typing.rst:2614 +#: ../../library/typing.rst:2607 msgid "" -"``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" -"class:`frozenset` objects containing required and non-required keys, " +"``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` " +"return :class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" -#: ../../library/typing.rst:2617 +#: ../../library/typing.rst:2610 msgid "" "Keys marked with :data:`Required` will always appear in " "``__required_keys__`` and keys marked with :data:`NotRequired` will always " "appear in ``__optional_keys__``." msgstr "" -#: ../../library/typing.rst:2620 +#: ../../library/typing.rst:2613 msgid "" "For backwards compatibility with Python 3.10 and below, it is also possible " "to use inheritance to declare both required and non-required keys in the " @@ -4079,7 +4149,7 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: ../../library/typing.rst:2627 +#: ../../library/typing.rst:2620 msgid "" ">>> class Point2D(TypedDict, total=False):\n" "... x: int\n" @@ -4105,7 +4175,7 @@ msgstr "" ">>> Point3D.__optional_keys__ == frozenset({'x', 'y'})\n" "True" -#: ../../library/typing.rst:2645 +#: ../../library/typing.rst:2638 msgid "" "If ``from __future__ import annotations`` is used or if annotations are " "given as strings, annotations are not evaluated when the ``TypedDict`` is " @@ -4114,48 +4184,48 @@ msgid "" "attributes may be incorrect." msgstr "" -#: ../../library/typing.rst:2651 +#: ../../library/typing.rst:2644 msgid "Support for :data:`ReadOnly` is reflected in the following attributes:" msgstr "" -#: ../../library/typing.rst:2655 +#: ../../library/typing.rst:2648 msgid "" "A :class:`frozenset` containing the names of all read-only keys. Keys are " "read-only if they carry the :data:`ReadOnly` qualifier." msgstr "" -#: ../../library/typing.rst:2662 +#: ../../library/typing.rst:2655 msgid "" "A :class:`frozenset` containing the names of all mutable keys. Keys are " "mutable if they do not carry the :data:`ReadOnly` qualifier." msgstr "" -#: ../../library/typing.rst:2667 +#: ../../library/typing.rst:2660 msgid "" "See :pep:`589` for more examples and detailed rules of using ``TypedDict``." msgstr "" -#: ../../library/typing.rst:2671 +#: ../../library/typing.rst:2664 msgid "" -"Added support for marking individual keys as :data:`Required` or :data:" -"`NotRequired`. See :pep:`655`." +"Added support for marking individual keys as :data:`Required` " +"or :data:`NotRequired`. See :pep:`655`." msgstr "" -#: ../../library/typing.rst:2675 +#: ../../library/typing.rst:2668 msgid "Added support for generic ``TypedDict``\\ s." msgstr "" -#: ../../library/typing.rst:2678 +#: ../../library/typing.rst:2671 msgid "" "Removed support for the keyword-argument method of creating ``TypedDict``\\ " "s." msgstr "" -#: ../../library/typing.rst:2681 +#: ../../library/typing.rst:2674 msgid "Support for the :data:`ReadOnly` qualifier was added." msgstr "" -#: ../../library/typing.rst:2684 +#: ../../library/typing.rst:2677 msgid "" "When using the functional syntax to create a TypedDict class, failing to " "pass a value to the 'fields' parameter (``TD = TypedDict(\"TD\")``) is " @@ -4165,106 +4235,106 @@ msgid "" "TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." msgstr "" -#: ../../library/typing.rst:2693 +#: ../../library/typing.rst:2686 msgid "Protocols" msgstr "協定" -#: ../../library/typing.rst:2695 +#: ../../library/typing.rst:2688 msgid "" -"The following protocols are provided by the typing module. All are decorated " -"with :func:`@runtime_checkable `." +"The following protocols are provided by the :mod:`!typing` module. All are " +"decorated with :func:`@runtime_checkable `." msgstr "" -#: ../../library/typing.rst:2700 +#: ../../library/typing.rst:2693 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:2705 +#: ../../library/typing.rst:2698 msgid "An ABC with one abstract method ``__bytes__``." msgstr "一個有抽象方法 ``__bytes__`` 的 ABC。" -#: ../../library/typing.rst:2709 +#: ../../library/typing.rst:2702 msgid "An ABC with one abstract method ``__complex__``." msgstr "一個有抽象方法 ``__complex__`` 的 ABC。" -#: ../../library/typing.rst:2713 +#: ../../library/typing.rst:2706 msgid "An ABC with one abstract method ``__float__``." msgstr "一個有抽象方法 ``__float__`` 的 ABC。" -#: ../../library/typing.rst:2717 +#: ../../library/typing.rst:2710 msgid "An ABC with one abstract method ``__index__``." msgstr "一個有抽象方法 ``__index__`` 的 ABC。" -#: ../../library/typing.rst:2723 +#: ../../library/typing.rst:2716 msgid "An ABC with one abstract method ``__int__``." msgstr "一個有抽象方法 ``__int__`` 的 ABC。" -#: ../../library/typing.rst:2727 +#: ../../library/typing.rst:2720 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2731 +#: ../../library/typing.rst:2724 msgid "ABCs for working with IO" msgstr "" -#: ../../library/typing.rst:2737 +#: ../../library/typing.rst:2730 msgid "" "Generic type ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " "by :func:`open`." msgstr "" -#: ../../library/typing.rst:2743 +#: ../../library/typing.rst:2736 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2747 +#: ../../library/typing.rst:2740 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2749 +#: ../../library/typing.rst:2742 msgid "" "This returns the value unchanged. To the type checker this signals that the " "return value has the designated type, but at runtime we intentionally don't " "check anything (we want this to be as fast as possible)." msgstr "" -#: ../../library/typing.rst:2756 +#: ../../library/typing.rst:2749 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" -#: ../../library/typing.rst:2758 +#: ../../library/typing.rst:2751 msgid "" "At runtime this does nothing: it returns the first argument unchanged with " "no checks or side effects, no matter the actual type of the argument." msgstr "" -#: ../../library/typing.rst:2761 +#: ../../library/typing.rst:2754 msgid "" "When a static type checker encounters a call to ``assert_type()``, it emits " "an error if the value is not of the specified type::" msgstr "" -#: ../../library/typing.rst:2764 +#: ../../library/typing.rst:2757 msgid "" "def greet(name: str) -> None:\n" " assert_type(name, str) # OK, inferred type of `name` is `str`\n" " assert_type(name, int) # type checker error" msgstr "" -#: ../../library/typing.rst:2768 +#: ../../library/typing.rst:2761 msgid "" "This function is useful for ensuring the type checker's understanding of a " "script is in line with the developer's intentions::" msgstr "" -#: ../../library/typing.rst:2771 +#: ../../library/typing.rst:2764 msgid "" "def complex_function(arg: object):\n" " # Do some complex type-narrowing logic,\n" @@ -4274,16 +4344,16 @@ msgid "" " assert_type(arg, int)" msgstr "" -#: ../../library/typing.rst:2782 +#: ../../library/typing.rst:2775 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" -#: ../../library/typing.rst:2784 +#: ../../library/typing.rst:2777 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/typing.rst:2786 +#: ../../library/typing.rst:2779 msgid "" "def int_or_str(arg: int | str) -> None:\n" " match arg:\n" @@ -4303,14 +4373,14 @@ msgstr "" " case _ as unreachable:\n" " assert_never(unreachable)" -#: ../../library/typing.rst:2795 +#: ../../library/typing.rst:2788 msgid "" "Here, the annotations allow the type checker to infer that the last case can " "never execute, because ``arg`` is either an :class:`int` or a :class:`str`, " "and both options are covered by earlier cases." msgstr "" -#: ../../library/typing.rst:2800 +#: ../../library/typing.rst:2793 msgid "" "If a type checker finds that a call to ``assert_never()`` is reachable, it " "will emit an error. For example, if the type annotation for ``arg`` was " @@ -4320,47 +4390,47 @@ msgid "" "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" -#: ../../library/typing.rst:2808 +#: ../../library/typing.rst:2801 msgid "At runtime, this throws an exception when called." msgstr "" -#: ../../library/typing.rst:2811 +#: ../../library/typing.rst:2804 msgid "" -"`Unreachable Code and Exhaustiveness Checking `__ has more information about " -"exhaustiveness checking with static typing." +"`Unreachable Code and Exhaustiveness Checking `__ has more information about exhaustiveness " +"checking with static typing." msgstr "" -#: ../../library/typing.rst:2819 +#: ../../library/typing.rst:2812 msgid "Ask a static type checker to reveal the inferred type of an expression." msgstr "" -#: ../../library/typing.rst:2821 +#: ../../library/typing.rst:2814 msgid "" "When a static type checker encounters a call to this function, it emits a " "diagnostic with the inferred type of the argument. For example::" msgstr "" -#: ../../library/typing.rst:2824 +#: ../../library/typing.rst:2817 msgid "" "x: int = 1\n" "reveal_type(x) # Revealed type is \"builtins.int\"" msgstr "" -#: ../../library/typing.rst:2827 +#: ../../library/typing.rst:2820 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" -#: ../../library/typing.rst:2830 +#: ../../library/typing.rst:2823 msgid "" -"At runtime, this function prints the runtime type of its argument to :data:" -"`sys.stderr` and returns the argument unchanged (allowing the call to be " -"used within an expression)::" +"At runtime, this function prints the runtime type of its argument " +"to :data:`sys.stderr` and returns the argument unchanged (allowing the call " +"to be used within an expression)::" msgstr "" -#: ../../library/typing.rst:2834 +#: ../../library/typing.rst:2827 msgid "" "x = reveal_type(1) # prints \"Runtime type is int\"\n" "print(x) # prints \"1\"" @@ -4368,13 +4438,13 @@ msgstr "" "x = reveal_type(1) # 印出 \"Runtime type is int\"\n" "print(x) # 印出 \"1\"" -#: ../../library/typing.rst:2837 +#: ../../library/typing.rst:2830 msgid "" "Note that the runtime type may be different from (more or less specific " "than) the type statically inferred by a type checker." msgstr "" -#: ../../library/typing.rst:2840 +#: ../../library/typing.rst:2833 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing``, however, " @@ -4382,13 +4452,13 @@ msgid "" "clearly." msgstr "" -#: ../../library/typing.rst:2851 +#: ../../library/typing.rst:2844 msgid "" -"Decorator to mark an object as providing :func:`dataclass `-like behavior." +"Decorator to mark an object as providing :func:`dataclass " +"`-like behavior." msgstr "" -#: ../../library/typing.rst:2854 +#: ../../library/typing.rst:2847 msgid "" "``dataclass_transform`` may be used to decorate a class, metaclass, or a " "function that is itself a decorator. The presence of " @@ -4397,11 +4467,11 @@ msgid "" "to :func:`@dataclasses.dataclass `." msgstr "" -#: ../../library/typing.rst:2861 +#: ../../library/typing.rst:2854 msgid "Example usage with a decorator function:" msgstr "" -#: ../../library/typing.rst:2863 +#: ../../library/typing.rst:2856 msgid "" "@dataclass_transform()\n" "def create_model[T](cls: type[T]) -> type[T]:\n" @@ -4423,11 +4493,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2875 +#: ../../library/typing.rst:2868 msgid "On a base class::" msgstr "" -#: ../../library/typing.rst:2877 +#: ../../library/typing.rst:2870 msgid "" "@dataclass_transform()\n" "class ModelBase: ...\n" @@ -4443,11 +4513,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2884 +#: ../../library/typing.rst:2877 msgid "On a metaclass::" msgstr "" -#: ../../library/typing.rst:2886 +#: ../../library/typing.rst:2879 msgid "" "@dataclass_transform()\n" "class ModelMeta(type): ...\n" @@ -4467,15 +4537,15 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2895 +#: ../../library/typing.rst:2888 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " -"similarly to classes created with :func:`@dataclasses.dataclass `. For example, type checkers will assume these classes have " -"``__init__`` methods that accept ``id`` and ``name``." +"similarly to classes created with :func:`@dataclasses.dataclass " +"`. For example, type checkers will assume these " +"classes have ``__init__`` methods that accept ``id`` and ``name``." msgstr "" -#: ../../library/typing.rst:2901 +#: ../../library/typing.rst:2894 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 " @@ -4485,7 +4555,7 @@ msgid "" "arguments (``True`` or ``False``) to be statically evaluated." msgstr "" -#: ../../library/typing.rst:2909 +#: ../../library/typing.rst:2902 msgid "" "The arguments to the ``dataclass_transform`` decorator can be used to " "customize the default behaviors of the decorated class, metaclass, or " @@ -4496,90 +4566,90 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/typing.rst:2913 +#: ../../library/typing.rst:2906 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:2918 +#: ../../library/typing.rst:2911 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:2923 +#: ../../library/typing.rst:2916 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:2928 +#: ../../library/typing.rst:2921 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:2929 +#: ../../library/typing.rst:2922 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:2935 +#: ../../library/typing.rst:2928 msgid "" "Specifies a static list of supported classes or functions that describe " "fields, similar to :func:`dataclasses.field`. Defaults to ``()``." msgstr "" -#: ../../library/typing.rst:2941 +#: ../../library/typing.rst:2934 msgid "" "Arbitrary other keyword arguments are accepted in order to allow for " "possible future extensions." msgstr "" -#: ../../library/typing.rst:2945 +#: ../../library/typing.rst:2938 msgid "" "Type checkers recognize the following optional parameters on field " "specifiers:" msgstr "" -#: ../../library/typing.rst:2948 +#: ../../library/typing.rst:2941 msgid "**Recognised parameters for field specifiers**" msgstr "" -#: ../../library/typing.rst:2952 +#: ../../library/typing.rst:2945 msgid "Parameter name" msgstr "" -#: ../../library/typing.rst:2953 +#: ../../library/typing.rst:2946 msgid "Description" msgstr "" -#: ../../library/typing.rst:2954 +#: ../../library/typing.rst:2947 msgid "``init``" msgstr "``init``" -#: ../../library/typing.rst:2955 +#: ../../library/typing.rst:2948 msgid "" "Indicates whether the field should be included in the synthesized " "``__init__`` method. If unspecified, ``init`` defaults to ``True``." msgstr "" -#: ../../library/typing.rst:2958 +#: ../../library/typing.rst:2951 msgid "``default``" msgstr "``default``" -#: ../../library/typing.rst:2959 +#: ../../library/typing.rst:2952 msgid "Provides the default value for the field." msgstr "" -#: ../../library/typing.rst:2960 +#: ../../library/typing.rst:2953 msgid "``default_factory``" msgstr "``default_factory``" -#: ../../library/typing.rst:2961 +#: ../../library/typing.rst:2954 msgid "" "Provides a runtime callback that returns the default value for the field. If " "neither ``default`` nor ``default_factory`` are specified, the field is " @@ -4587,19 +4657,19 @@ msgid "" "is instantiated." msgstr "" -#: ../../library/typing.rst:2966 +#: ../../library/typing.rst:2959 msgid "``factory``" msgstr "``factory``" -#: ../../library/typing.rst:2967 +#: ../../library/typing.rst:2960 msgid "An alias for the ``default_factory`` parameter on field specifiers." msgstr "" -#: ../../library/typing.rst:2968 +#: ../../library/typing.rst:2961 msgid "``kw_only``" msgstr "``kw_only``" -#: ../../library/typing.rst:2969 +#: ../../library/typing.rst:2962 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. " @@ -4609,32 +4679,32 @@ msgid "" "will be used." msgstr "" -#: ../../library/typing.rst:2975 +#: ../../library/typing.rst:2968 msgid "``alias``" msgstr "``alias``" -#: ../../library/typing.rst:2976 +#: ../../library/typing.rst:2969 msgid "" "Provides an alternative name for the field. This alternative name is used in " "the synthesized ``__init__`` method." msgstr "" -#: ../../library/typing.rst:2979 +#: ../../library/typing.rst:2972 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:2983 +#: ../../library/typing.rst:2976 msgid "See :pep:`681` for more details." msgstr "更多細節請見 :pep:`681`。" -#: ../../library/typing.rst:2991 +#: ../../library/typing.rst:2984 msgid "Decorator for creating overloaded functions and methods." msgstr "" -#: ../../library/typing.rst:2993 +#: ../../library/typing.rst:2986 msgid "" "The ``@overload`` decorator allows describing functions and methods that " "support multiple different combinations of argument types. A series of " @@ -4642,23 +4712,23 @@ msgid "" "``@overload``-decorated definition (for the same function/method)." msgstr "" -#: ../../library/typing.rst:2998 +#: ../../library/typing.rst:2991 msgid "" "``@overload``-decorated definitions are for the benefit of the type checker " "only, since they will be overwritten by the non-``@overload``-decorated " "definition. The non-``@overload``-decorated definition, meanwhile, will be " "used at runtime but should be ignored by a type checker. At runtime, " -"calling an ``@overload``-decorated function directly will raise :exc:" -"`NotImplementedError`." +"calling an ``@overload``-decorated function directly will " +"raise :exc:`NotImplementedError`." msgstr "" -#: ../../library/typing.rst:3006 +#: ../../library/typing.rst:2999 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:3009 +#: ../../library/typing.rst:3002 msgid "" "@overload\n" "def process(response: None) -> None:\n" @@ -4672,25 +4742,36 @@ msgid "" "def process(response):\n" " ... # actual implementation goes here" msgstr "" +"@overload\n" +"def process(response: None) -> None:\n" +" ...\n" +"@overload\n" +"def process(response: int) -> tuple[int, str]:\n" +" ...\n" +"@overload\n" +"def process(response: bytes) -> str:\n" +" ...\n" +"def process(response):\n" +" ... # 實際的實作在這邊" -#: ../../library/typing.rst:3023 +#: ../../library/typing.rst:3016 msgid "" "See :pep:`484` for more details and comparison with other typing semantics." msgstr "" -#: ../../library/typing.rst:3025 +#: ../../library/typing.rst:3018 msgid "" -"Overloaded functions can now be introspected at runtime using :func:" -"`get_overloads`." +"Overloaded functions can now be introspected at runtime " +"using :func:`get_overloads`." msgstr "" -#: ../../library/typing.rst:3032 +#: ../../library/typing.rst:3025 msgid "" "Return a sequence of :func:`@overload `-decorated definitions for " "*func*." msgstr "" -#: ../../library/typing.rst:3035 +#: ../../library/typing.rst:3028 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " @@ -4700,32 +4781,32 @@ msgid "" "returns an empty sequence." msgstr "" -#: ../../library/typing.rst:3042 +#: ../../library/typing.rst:3035 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" -#: ../../library/typing.rst:3050 +#: ../../library/typing.rst:3043 msgid "Clear all registered overloads in the internal registry." msgstr "" -#: ../../library/typing.rst:3052 +#: ../../library/typing.rst:3045 msgid "This can be used to reclaim the memory used by the registry." msgstr "" -#: ../../library/typing.rst:3059 +#: ../../library/typing.rst:3052 msgid "Decorator to indicate final methods and final classes." msgstr "" -#: ../../library/typing.rst:3061 +#: ../../library/typing.rst:3054 msgid "" "Decorating a method with ``@final`` indicates to a type checker that the " "method cannot be overridden in a subclass. Decorating a class with " "``@final`` indicates that it cannot be subclassed." msgstr "" -#: ../../library/typing.rst:3067 +#: ../../library/typing.rst:3060 msgid "" "class Base:\n" " @final\n" @@ -4741,8 +4822,21 @@ msgid "" "class Other(Leaf): # Error reported by type checker\n" " ..." msgstr "" +"class Base:\n" +" @final\n" +" def done(self) -> None:\n" +" ...\n" +"class Sub(Base):\n" +" def done(self) -> None: # 型別檢查器回報的錯誤\n" +" ...\n" +"\n" +"@final\n" +"class Leaf:\n" +" ...\n" +"class Other(Leaf): # 型別檢查器回報的錯誤\n" +" ..." -#: ../../library/typing.rst:3086 +#: ../../library/typing.rst:3079 msgid "" "The decorator will now attempt to set a ``__final__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, \"__final__\", " @@ -4752,11 +4846,11 @@ msgid "" "exception." msgstr "" -#: ../../library/typing.rst:3097 +#: ../../library/typing.rst:3090 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:3099 +#: ../../library/typing.rst:3092 msgid "" "This works as a class or function :term:`decorator`. With a class, it " "applies recursively to all methods and classes defined in that class (but " @@ -4764,40 +4858,40 @@ msgid "" "will ignore all annotations in a function or class with this decorator." msgstr "" -#: ../../library/typing.rst:3105 +#: ../../library/typing.rst:3098 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" -#: ../../library/typing.rst:3109 +#: ../../library/typing.rst:3102 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:3111 +#: ../../library/typing.rst:3104 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:3114 +#: ../../library/typing.rst:3107 msgid "" "No type checker ever added support for ``@no_type_check_decorator``. It is " "therefore deprecated, and will be removed in Python 3.15." msgstr "" -#: ../../library/typing.rst:3120 +#: ../../library/typing.rst:3113 msgid "" "Decorator to indicate that a method in a subclass is intended to override a " "method or attribute in a superclass." msgstr "" -#: ../../library/typing.rst:3123 +#: ../../library/typing.rst:3116 msgid "" "Type checkers should emit an error if a method decorated with ``@override`` " "does not, in fact, override anything. This helps prevent bugs that may occur " "when a base class is changed without an equivalent change to a child class." msgstr "" -#: ../../library/typing.rst:3130 +#: ../../library/typing.rst:3123 msgid "" "class Base:\n" " def log_status(self) -> None:\n" @@ -4813,11 +4907,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:3145 +#: ../../library/typing.rst:3138 msgid "There is no runtime checking of this property." msgstr "" -#: ../../library/typing.rst:3147 +#: ../../library/typing.rst:3140 msgid "" "The decorator will attempt to set an ``__override__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, " @@ -4827,22 +4921,22 @@ msgid "" "without raising an exception." msgstr "" -#: ../../library/typing.rst:3154 +#: ../../library/typing.rst:3147 msgid "See :pep:`698` for more details." msgstr "更多細節請見 :pep:`698`。" -#: ../../library/typing.rst:3161 +#: ../../library/typing.rst:3154 msgid "Decorator to mark a class or function as unavailable at runtime." msgstr "" -#: ../../library/typing.rst:3163 +#: ../../library/typing.rst:3156 msgid "" "This decorator is itself not available at runtime. It is mainly intended to " "mark classes that are defined in type stub files if an implementation " "returns an instance of a private class::" msgstr "" -#: ../../library/typing.rst:3167 +#: ../../library/typing.rst:3160 msgid "" "@type_check_only\n" "class Response: # private or not available at runtime\n" @@ -4852,29 +4946,29 @@ msgid "" "def fetch_response() -> Response: ..." msgstr "" -#: ../../library/typing.rst:3174 +#: ../../library/typing.rst:3167 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:3178 +#: ../../library/typing.rst:3171 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:3182 +#: ../../library/typing.rst:3175 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: ../../library/typing.rst:3185 +#: ../../library/typing.rst:3178 msgid "" "This is often the same as ``obj.__annotations__``, but this function makes " "the following changes to the annotations dictionary:" msgstr "" -#: ../../library/typing.rst:3188 +#: ../../library/typing.rst:3181 msgid "" "Forward references encoded as string literals or :class:`ForwardRef` objects " "are handled by evaluating them in *globalns*, *localns*, and (where " @@ -4883,17 +4977,17 @@ msgid "" "inferred from *obj*." msgstr "" -#: ../../library/typing.rst:3193 +#: ../../library/typing.rst:3186 msgid "``None`` is replaced with :class:`types.NoneType`." msgstr "" -#: ../../library/typing.rst:3194 +#: ../../library/typing.rst:3187 msgid "" "If :func:`@no_type_check ` has been applied to *obj*, an " "empty dictionary is returned." msgstr "" -#: ../../library/typing.rst:3196 +#: ../../library/typing.rst:3189 msgid "" "If *obj* is a class ``C``, the function returns a dictionary that merges " "annotations from ``C``'s base classes with those on ``C`` directly. This is " @@ -4903,62 +4997,62 @@ msgid "" "annotations on classes appearing later in the method resolution order." msgstr "" -#: ../../library/typing.rst:3203 +#: ../../library/typing.rst:3196 msgid "" "The function recursively replaces all occurrences of ``Annotated[T, ...]`` " -"with ``T``, unless *include_extras* is set to ``True`` (see :class:" -"`Annotated` for more information)." +"with ``T``, unless *include_extras* is set to ``True`` " +"(see :class:`Annotated` for more information)." msgstr "" -#: ../../library/typing.rst:3207 +#: ../../library/typing.rst:3200 msgid "" "See also :func:`inspect.get_annotations`, a lower-level function that " "returns annotations more directly." msgstr "" -#: ../../library/typing.rst:3212 +#: ../../library/typing.rst:3205 msgid "" "If any forward references in the annotations of *obj* are not resolvable or " -"are not valid Python code, this function will raise an exception such as :" -"exc:`NameError`. For example, this can happen with imported :ref:`type " +"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 `." msgstr "" -#: ../../library/typing.rst:3218 +#: ../../library/typing.rst:3211 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." msgstr "" -"新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" -"`Annotated` 的文件。" +"新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請" +"見 :data:`Annotated` 的文件。" -#: ../../library/typing.rst:3222 +#: ../../library/typing.rst:3215 msgid "" "Previously, ``Optional[t]`` was added for function and method annotations if " "a default value equal to ``None`` was set. Now the annotation is returned " "unchanged." msgstr "" -#: ../../library/typing.rst:3229 +#: ../../library/typing.rst:3222 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:3232 +#: ../../library/typing.rst:3225 msgid "" "If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, " -"it will be normalized to the original class. If ``X`` is an instance of :" -"class:`ParamSpecArgs` or :class:`ParamSpecKwargs`, return the underlying :" -"class:`ParamSpec`. Return ``None`` for unsupported objects." +"it will be normalized to the original class. If ``X`` is an instance " +"of :class:`ParamSpecArgs` or :class:`ParamSpecKwargs`, return the " +"underlying :class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:3238 ../../library/typing.rst:3262 +#: ../../library/typing.rst:3231 ../../library/typing.rst:3255 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:3240 +#: ../../library/typing.rst:3233 msgid "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" @@ -4976,13 +5070,13 @@ msgstr "" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" -#: ../../library/typing.rst:3254 +#: ../../library/typing.rst:3247 msgid "" "Get type arguments with all substitutions performed: for a typing object of " "the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``." msgstr "" -#: ../../library/typing.rst:3257 +#: ../../library/typing.rst:3250 msgid "" "If ``X`` is a union or :class:`Literal` contained in another generic type, " "the order of ``(Y, Z, ...)`` may be different from the order of the original " @@ -4990,7 +5084,7 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:3264 +#: ../../library/typing.rst:3257 msgid "" "assert get_args(int) == ()\n" "assert get_args(Dict[int, str]) == (int, str)\n" @@ -5000,11 +5094,11 @@ msgstr "" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" -#: ../../library/typing.rst:3274 +#: ../../library/typing.rst:3267 msgid "Return the set of members defined in a :class:`Protocol`." msgstr "" -#: ../../library/typing.rst:3276 +#: ../../library/typing.rst:3269 msgid "" ">>> from typing import Protocol, get_protocol_members\n" ">>> class P(Protocol):\n" @@ -5013,16 +5107,22 @@ msgid "" ">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" "True" msgstr "" +">>> from typing import Protocol, get_protocol_members\n" +">>> class P(Protocol):\n" +"... def a(self) -> str: ...\n" +"... b: int\n" +">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" +"True" -#: ../../library/typing.rst:3285 +#: ../../library/typing.rst:3278 msgid "Raise :exc:`TypeError` for arguments that are not Protocols." msgstr "" -#: ../../library/typing.rst:3291 +#: ../../library/typing.rst:3284 msgid "Determine if a type is a :class:`Protocol`." msgstr "確定一個型別是否 :class:`Protocol`。" -#: ../../library/typing.rst:3295 +#: ../../library/typing.rst:3288 msgid "" "class P(Protocol):\n" " def a(self) -> str: ...\n" @@ -5031,12 +5131,18 @@ msgid "" "is_protocol(P) # => True\n" "is_protocol(int) # => False" msgstr "" +"class P(Protocol):\n" +" def a(self) -> str: ...\n" +" b: int\n" +"\n" +"is_protocol(P) # => True\n" +"is_protocol(int) # => False" -#: ../../library/typing.rst:3306 +#: ../../library/typing.rst:3299 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:3310 +#: ../../library/typing.rst:3303 msgid "" "class Film(TypedDict):\n" " title: str\n" @@ -5050,32 +5156,32 @@ msgid "" "assert not is_typeddict(TypedDict)" msgstr "" -#: ../../library/typing.rst:3327 +#: ../../library/typing.rst:3320 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:3329 +#: ../../library/typing.rst:3322 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. ``ForwardRef`` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:3334 +#: ../../library/typing.rst:3327 msgid "" ":pep:`585` generic types such as ``list[\"SomeClass\"]`` will not be " "implicitly transformed into ``list[ForwardRef(\"SomeClass\")]`` and thus " "will not automatically resolve to ``list[SomeClass]``." msgstr "" -#: ../../library/typing.rst:3342 +#: ../../library/typing.rst:3335 msgid "" "A sentinel object used to indicate that a type parameter has no default " "value. For example:" msgstr "" -#: ../../library/typing.rst:3345 +#: ../../library/typing.rst:3338 msgid "" ">>> T = TypeVar(\"T\")\n" ">>> T.__default__ is typing.NoDefault\n" @@ -5084,18 +5190,24 @@ msgid "" ">>> S.__default__ is None\n" "True" msgstr "" +">>> T = TypeVar(\"T\")\n" +">>> T.__default__ is typing.NoDefault\n" +"True\n" +">>> S = TypeVar(\"S\", default=None)\n" +">>> S.__default__ is None\n" +"True" -#: ../../library/typing.rst:3357 +#: ../../library/typing.rst:3350 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:3361 +#: ../../library/typing.rst:3354 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It is ``False`` at runtime." msgstr "" -#: ../../library/typing.rst:3366 +#: ../../library/typing.rst:3359 msgid "" "if TYPE_CHECKING:\n" " import expensive_mod\n" @@ -5109,7 +5221,7 @@ msgstr "" "def fun(arg: 'expensive_mod.SomeType') -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" -#: ../../library/typing.rst:3372 +#: ../../library/typing.rst:3365 msgid "" "The first type annotation must be enclosed in quotes, making it a \"forward " "reference\", to hide the ``expensive_mod`` reference from the interpreter " @@ -5117,7 +5229,7 @@ msgid "" "second annotation does not need to be enclosed in quotes." msgstr "" -#: ../../library/typing.rst:3379 +#: ../../library/typing.rst:3372 msgid "" "If ``from __future__ import annotations`` is used, annotations are not " "evaluated at function definition time. Instead, they are stored as strings " @@ -5125,20 +5237,20 @@ msgid "" "annotation (see :pep:`563`)." msgstr "" -#: ../../library/typing.rst:3391 +#: ../../library/typing.rst:3384 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:3393 +#: ../../library/typing.rst:3386 msgid "" "This module defines several deprecated aliases to pre-existing standard " -"library classes. These were originally included in the typing module in " -"order to support parameterizing these generic classes using ``[]``. However, " -"the aliases became redundant in Python 3.9 when the corresponding pre-" -"existing classes were enhanced to support ``[]`` (see :pep:`585`)." +"library classes. These were originally included in the :mod:`!typing` module " +"in order to support parameterizing these generic classes using ``[]``. " +"However, the aliases became redundant in Python 3.9 when the corresponding " +"pre-existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:3400 +#: ../../library/typing.rst:3393 msgid "" "The redundant types are deprecated as of Python 3.9. However, while the " "aliases may be removed at some point, removal of these aliases is not " @@ -5146,571 +5258,577 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:3405 +#: ../../library/typing.rst:3398 msgid "" "If at some point it is decided to remove these deprecated aliases, a " "deprecation warning will be issued by the interpreter for at least two " -"releases prior to removal. The aliases are guaranteed to remain in the " -"typing module without deprecation warnings until at least Python 3.14." +"releases prior to removal. The aliases are guaranteed to remain in " +"the :mod:`!typing` module without deprecation warnings until at least Python " +"3.14." msgstr "" -#: ../../library/typing.rst:3410 +#: ../../library/typing.rst:3403 msgid "" "Type checkers are encouraged to flag uses of the deprecated types if the " "program they are checking targets a minimum Python version of 3.9 or newer." msgstr "" -#: ../../library/typing.rst:3416 +#: ../../library/typing.rst:3409 msgid "Aliases to built-in types" msgstr "內建型別的別名" -#: ../../library/typing.rst:3420 +#: ../../library/typing.rst:3413 msgid "Deprecated alias to :class:`dict`." msgstr "棄用 :class:`dict` 的別名。" -#: ../../library/typing.rst:3422 +#: ../../library/typing.rst:3415 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Mapping` rather than to " "use :class:`dict` or :class:`!typing.Dict`." msgstr "" -#: ../../library/typing.rst:3426 +#: ../../library/typing.rst:3419 msgid "" -":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.dict ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3432 +#: ../../library/typing.rst:3425 msgid "Deprecated alias to :class:`list`." msgstr "棄用 :class:`list` 的別名。" -#: ../../library/typing.rst:3434 +#: ../../library/typing.rst:3427 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " -"collection type such as :class:`~collections.abc.Sequence` or :class:" -"`~collections.abc.Iterable` rather than to use :class:`list` or :class:`!" -"typing.List`." +"collection type such as :class:`~collections.abc.Sequence` " +"or :class:`~collections.abc.Iterable` rather than to use :class:`list` " +"or :class:`!typing.List`." msgstr "" -#: ../../library/typing.rst:3439 +#: ../../library/typing.rst:3432 msgid "" -":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.list ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3445 +#: ../../library/typing.rst:3438 msgid "Deprecated alias to :class:`builtins.set `." msgstr "棄用 :class:`builtins.set ` 的別名。" -#: ../../library/typing.rst:3447 +#: ../../library/typing.rst:3440 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " -"collection type such as :class:`collections.abc.Set` rather than to use :" -"class:`set` or :class:`typing.Set`." +"collection type such as :class:`collections.abc.Set` rather than to " +"use :class:`set` or :class:`typing.Set`." msgstr "" -#: ../../library/typing.rst:3451 +#: ../../library/typing.rst:3444 msgid "" -":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.set ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3457 +#: ../../library/typing.rst:3450 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "棄用 :class:`builtins.frozenset ` 的別名。" -#: ../../library/typing.rst:3459 +#: ../../library/typing.rst:3452 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3466 +#: ../../library/typing.rst:3459 msgid "Deprecated alias for :class:`tuple`." msgstr "棄用 :class:`tuple` 的別名。" -#: ../../library/typing.rst:3468 +#: ../../library/typing.rst:3461 msgid "" -":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" -"`annotating-tuples` for more details." +":class:`tuple` and ``Tuple`` are special-cased in the type system; " +"see :ref:`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:3471 +#: ../../library/typing.rst:3464 msgid "" -":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.tuple ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3477 +#: ../../library/typing.rst:3470 msgid "Deprecated alias to :class:`type`." msgstr "棄用 :class:`type` 的別名。" -#: ../../library/typing.rst:3479 +#: ../../library/typing.rst:3472 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:3484 +#: ../../library/typing.rst:3477 msgid "" -":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`builtins.type ` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3491 +#: ../../library/typing.rst:3484 msgid "Aliases to types in :mod:`collections`" msgstr ":mod:`collections` 中型別的別名" -#: ../../library/typing.rst:3495 +#: ../../library/typing.rst:3488 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "棄用 :class:`collections.defaultdict` 的別名。" -#: ../../library/typing.rst:3499 +#: ../../library/typing.rst:3492 msgid "" -":class:`collections.defaultdict` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.defaultdict` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3505 +#: ../../library/typing.rst:3498 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "棄用 :class:`collections.OrderedDict` 的別名。" -#: ../../library/typing.rst:3509 +#: ../../library/typing.rst:3502 msgid "" -":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.OrderedDict` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3515 +#: ../../library/typing.rst:3508 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "棄用 :class:`collections.ChainMap` 的別名。" -#: ../../library/typing.rst:3519 +#: ../../library/typing.rst:3512 msgid "" -":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.ChainMap` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3525 +#: ../../library/typing.rst:3518 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "棄用 :class:`collections.Counter` 的別名。" -#: ../../library/typing.rst:3529 +#: ../../library/typing.rst:3522 msgid "" -":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.Counter` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3535 +#: ../../library/typing.rst:3528 msgid "Deprecated alias to :class:`collections.deque`." msgstr "棄用 :class:`collections.deque` 的別名。" -#: ../../library/typing.rst:3539 +#: ../../library/typing.rst:3532 msgid "" -":class:`collections.deque` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.deque` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3546 +#: ../../library/typing.rst:3539 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:3551 +#: ../../library/typing.rst:3544 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3554 +#: ../../library/typing.rst:3547 msgid "" -"These types (and the corresponding functions) are generic over :data:" -"`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " +"These types (and the corresponding functions) are generic " +"over :data:`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " "``Pattern[bytes]``; ``Match`` can be specialised as ``Match[str]`` or " "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:3559 +#: ../../library/typing.rst:3552 msgid "" -"Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" -"pep:`585` and :ref:`types-genericalias`." +"Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3565 +#: ../../library/typing.rst:3558 msgid "Deprecated alias for :class:`str`." msgstr "棄用 :class:`str` 的別名。" -#: ../../library/typing.rst:3567 +#: ../../library/typing.rst:3560 msgid "" "``Text`` is provided to supply a forward compatible path for Python 2 code: " "in Python 2, ``Text`` is an alias for ``unicode``." msgstr "" -#: ../../library/typing.rst:3571 +#: ../../library/typing.rst:3564 msgid "" "Use ``Text`` to indicate that a value must contain a unicode string in a " "manner that is compatible with both Python 2 and Python 3::" msgstr "" -#: ../../library/typing.rst:3574 +#: ../../library/typing.rst:3567 msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" msgstr "" +"def add_unicode_checkmark(text: Text) -> Text:\n" +" return text + u' \\u2713'" -#: ../../library/typing.rst:3579 +#: ../../library/typing.rst:3572 msgid "" "Python 2 is no longer supported, and most type checkers also no longer " "support type checking Python 2 code. Removal of the alias is not currently " "planned, but users are encouraged to use :class:`str` instead of ``Text``." msgstr "" -#: ../../library/typing.rst:3589 +#: ../../library/typing.rst:3582 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中容器 ABC 的別名" -#: ../../library/typing.rst:3593 +#: ../../library/typing.rst:3586 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "棄用 :class:`collections.abc.Set` 的別名。" -#: ../../library/typing.rst:3595 +#: ../../library/typing.rst:3588 msgid "" -":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" -"`585` and :ref:`types-genericalias`." +":class:`collections.abc.Set` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3601 +#: ../../library/typing.rst:3594 msgid "" -"This type represents the types :class:`bytes`, :class:`bytearray`, and :" -"class:`memoryview` of byte sequences." +"This type represents the types :class:`bytes`, :class:`bytearray`, " +"and :class:`memoryview` of byte sequences." msgstr "" -#: ../../library/typing.rst:3604 +#: ../../library/typing.rst:3597 msgid "" "Prefer :class:`collections.abc.Buffer`, or a union like ``bytes | bytearray " "| memoryview``." msgstr "" -#: ../../library/typing.rst:3609 +#: ../../library/typing.rst:3602 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "棄用 :class:`collections.abc.Collection` 的別名。" -#: ../../library/typing.rst:3613 +#: ../../library/typing.rst:3606 msgid "" -":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Collection` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3619 +#: ../../library/typing.rst:3612 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "棄用 :class:`collections.abc.Container` 的別名。" -#: ../../library/typing.rst:3621 +#: ../../library/typing.rst:3614 msgid "" -":class:`collections.abc.Container` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Container` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3627 +#: ../../library/typing.rst:3620 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "棄用 :class:`collections.abc.ItemsView` 的別名。" -#: ../../library/typing.rst:3629 +#: ../../library/typing.rst:3622 msgid "" -":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.ItemsView` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3635 +#: ../../library/typing.rst:3628 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "棄用 :class:`collections.abc.KeysView` 的別名。" -#: ../../library/typing.rst:3637 +#: ../../library/typing.rst:3630 msgid "" -":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.KeysView` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3643 +#: ../../library/typing.rst:3636 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "棄用 :class:`collections.abc.Mapping` 的別名。" -#: ../../library/typing.rst:3645 +#: ../../library/typing.rst:3638 msgid "" -":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Mapping` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3651 +#: ../../library/typing.rst:3644 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "棄用 :class:`collections.abc.MappingView` 的別名。" -#: ../../library/typing.rst:3653 +#: ../../library/typing.rst:3646 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3659 +#: ../../library/typing.rst:3652 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "棄用 :class:`collections.abc.MutableMapping` 的別名。" -#: ../../library/typing.rst:3661 +#: ../../library/typing.rst:3654 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3668 +#: ../../library/typing.rst:3661 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "棄用 :class:`collections.abc.MutableSequence` 的別名。" -#: ../../library/typing.rst:3670 +#: ../../library/typing.rst:3663 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3677 +#: ../../library/typing.rst:3670 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "棄用 :class:`collections.abc.MutableSet` 的別名。" -#: ../../library/typing.rst:3679 +#: ../../library/typing.rst:3672 msgid "" -":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.MutableSet` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3685 +#: ../../library/typing.rst:3678 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "棄用 :class:`collections.abc.Sequence` 的別名。" -#: ../../library/typing.rst:3687 +#: ../../library/typing.rst:3680 msgid "" -":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Sequence` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3693 +#: ../../library/typing.rst:3686 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "棄用 :class:`collections.abc.ValuesView` 的別名。" -#: ../../library/typing.rst:3695 +#: ../../library/typing.rst:3688 msgid "" -":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.ValuesView` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3702 +#: ../../library/typing.rst:3695 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" -msgstr "" +msgstr ":mod:`collections.abc` 中非同步 ABC 的別名" -#: ../../library/typing.rst:3706 +#: ../../library/typing.rst:3699 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "棄用 :class:`collections.abc.Coroutine` 的別名。" -#: ../../library/typing.rst:3708 +#: ../../library/typing.rst:3701 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`collections.abc.Coroutine` and ``typing.Coroutine`` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`collections.abc.Coroutine` and ``typing.Coroutine`` in type " +"annotations." msgstr "" -#: ../../library/typing.rst:3714 +#: ../../library/typing.rst:3707 msgid "" -":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Coroutine` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3720 +#: ../../library/typing.rst:3713 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "棄用 :class:`collections.abc.AsyncGenerator` 的別名。" -#: ../../library/typing.rst:3722 +#: ../../library/typing.rst:3715 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` in type " -"annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` " +"in type annotations." msgstr "" -#: ../../library/typing.rst:3728 +#: ../../library/typing.rst:3721 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3733 +#: ../../library/typing.rst:3726 msgid "The ``SendType`` parameter now has a default." -msgstr "" +msgstr "``SendType`` 參數現在有預設值。" -#: ../../library/typing.rst:3738 +#: ../../library/typing.rst:3731 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "棄用 :class:`collections.abc.AsyncIterable` 的別名。" -#: ../../library/typing.rst:3742 +#: ../../library/typing.rst:3735 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3748 +#: ../../library/typing.rst:3741 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "棄用 :class:`collections.abc.AsyncIterator` 的別名。" -#: ../../library/typing.rst:3752 +#: ../../library/typing.rst:3745 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3758 +#: ../../library/typing.rst:3751 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "棄用 :class:`collections.abc.Awaitable` 的別名。" -#: ../../library/typing.rst:3762 +#: ../../library/typing.rst:3755 msgid "" -":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Awaitable` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3769 +#: ../../library/typing.rst:3762 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3773 +#: ../../library/typing.rst:3766 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "棄用 :class:`collections.abc.Iterable` 的別名。" -#: ../../library/typing.rst:3775 +#: ../../library/typing.rst:3768 msgid "" -":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Iterable` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3781 +#: ../../library/typing.rst:3774 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "棄用 :class:`collections.abc.Iterator` 的別名。" -#: ../../library/typing.rst:3783 +#: ../../library/typing.rst:3776 msgid "" -":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Iterator` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3789 +#: ../../library/typing.rst:3782 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "棄用 :class:`collections.abc.Callable` 的別名。" -#: ../../library/typing.rst:3791 +#: ../../library/typing.rst:3784 msgid "" -"See :ref:`annotating-callables` for details on how to use :class:" -"`collections.abc.Callable` and ``typing.Callable`` in type annotations." +"See :ref:`annotating-callables` for details on how to " +"use :class:`collections.abc.Callable` and ``typing.Callable`` in type " +"annotations." msgstr "" -#: ../../library/typing.rst:3794 +#: ../../library/typing.rst:3787 msgid "" -":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Callable` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3804 +#: ../../library/typing.rst:3797 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "棄用 :class:`collections.abc.Generator` 的別名。" -#: ../../library/typing.rst:3806 +#: ../../library/typing.rst:3799 msgid "" -"See :ref:`annotating-generators-and-coroutines` for details on using :class:" -"`collections.abc.Generator` and ``typing.Generator`` in type annotations." +"See :ref:`annotating-generators-and-coroutines` for details on " +"using :class:`collections.abc.Generator` and ``typing.Generator`` in type " +"annotations." msgstr "" -#: ../../library/typing.rst:3810 +#: ../../library/typing.rst:3803 msgid "" -":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Generator` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3814 +#: ../../library/typing.rst:3807 msgid "Default values for the send and return types were added." msgstr "" -#: ../../library/typing.rst:3819 +#: ../../library/typing.rst:3812 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "棄用 :class:`collections.abc.Hashable` 的別名。" -#: ../../library/typing.rst:3821 +#: ../../library/typing.rst:3814 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "改為直接使用 :class:`collections.abc.Hashable`。" -#: ../../library/typing.rst:3826 +#: ../../library/typing.rst:3819 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "棄用 :class:`collections.abc.Reversible` 的別名。" -#: ../../library/typing.rst:3828 +#: ../../library/typing.rst:3821 msgid "" -":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" -"pep:`585` and :ref:`types-genericalias`." +":class:`collections.abc.Reversible` now supports subscripting (``[]``). " +"See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3834 +#: ../../library/typing.rst:3827 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "棄用 :class:`collections.abc.Sized` 的別名。" -#: ../../library/typing.rst:3836 +#: ../../library/typing.rst:3829 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "改為直接使用 :class:`collections.abc.Sized`。" -#: ../../library/typing.rst:3842 +#: ../../library/typing.rst:3835 msgid "Aliases to :mod:`contextlib` ABCs" msgstr ":mod:`contextlib` ABC 的別名" -#: ../../library/typing.rst:3846 +#: ../../library/typing.rst:3839 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:3848 +#: ../../library/typing.rst:3841 msgid "" -"The first type parameter, ``T_co``, represents the type returned by the :" -"meth:`~object.__enter__` method. The optional second type parameter, " +"The first type parameter, ``T_co``, represents the type returned by " +"the :meth:`~object.__enter__` method. The optional second type parameter, " "``ExitT_co``, which defaults to ``bool | None``, represents the type " "returned by the :meth:`~object.__exit__` method." msgstr "" -#: ../../library/typing.rst:3855 +#: ../../library/typing.rst:3848 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3860 +#: ../../library/typing.rst:3853 msgid "Added the optional second type parameter, ``ExitT_co``." msgstr "" -#: ../../library/typing.rst:3865 +#: ../../library/typing.rst:3858 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:3867 +#: ../../library/typing.rst:3860 msgid "" -"The first type parameter, ``T_co``, represents the type returned by the :" -"meth:`~object.__aenter__` method. The optional second type parameter, " +"The first type parameter, ``T_co``, represents the type returned by " +"the :meth:`~object.__aenter__` method. The optional second type parameter, " "``AExitT_co``, which defaults to ``bool | None``, represents the type " "returned by the :meth:`~object.__aexit__` method." msgstr "" -#: ../../library/typing.rst:3874 +#: ../../library/typing.rst:3867 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3879 +#: ../../library/typing.rst:3872 msgid "Added the optional second type parameter, ``AExitT_co``." msgstr "" -#: ../../library/typing.rst:3883 +#: ../../library/typing.rst:3876 msgid "Deprecation Timeline of Major Features" -msgstr "" +msgstr "主要功能的棄用時程表" -#: ../../library/typing.rst:3885 +#: ../../library/typing.rst:3878 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -5718,111 +5836,130 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:3892 +#: ../../library/typing.rst:3885 msgid "Feature" msgstr "" -#: ../../library/typing.rst:3893 +#: ../../library/typing.rst:3886 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:3894 +#: ../../library/typing.rst:3887 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:3895 +#: ../../library/typing.rst:3888 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:3896 +#: ../../library/typing.rst:3889 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:3897 ../../library/typing.rst:3901 +#: ../../library/typing.rst:3890 ../../library/typing.rst:3894 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:3898 +#: ../../library/typing.rst:3891 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:3899 +#: ../../library/typing.rst:3892 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:3900 +#: ../../library/typing.rst:3893 msgid ":class:`typing.ByteString`" msgstr ":class:`typing.ByteString`" -#: ../../library/typing.rst:3902 +#: ../../library/typing.rst:3895 msgid "3.14" msgstr "3.14" -#: ../../library/typing.rst:3903 +#: ../../library/typing.rst:3896 msgid ":gh:`91896`" msgstr ":gh:`91896`" -#: ../../library/typing.rst:3904 +#: ../../library/typing.rst:3897 msgid ":data:`typing.Text`" msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:3905 +#: ../../library/typing.rst:3898 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:3906 ../../library/typing.rst:3910 -#: ../../library/typing.rst:3914 +#: ../../library/typing.rst:3899 ../../library/typing.rst:3903 +#: ../../library/typing.rst:3907 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:3907 +#: ../../library/typing.rst:3900 msgid ":gh:`92332`" msgstr ":gh:`92332`" -#: ../../library/typing.rst:3908 +#: ../../library/typing.rst:3901 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" -#: ../../library/typing.rst:3909 ../../library/typing.rst:3913 +#: ../../library/typing.rst:3902 ../../library/typing.rst:3906 msgid "3.12" msgstr "3.12" -#: ../../library/typing.rst:3911 +#: ../../library/typing.rst:3904 msgid ":gh:`94309`" msgstr ":gh:`94309`" -#: ../../library/typing.rst:3912 +#: ../../library/typing.rst:3905 msgid ":data:`typing.TypeAlias`" msgstr ":data:`typing.TypeAlias`" -#: ../../library/typing.rst:3915 +#: ../../library/typing.rst:3908 msgid ":pep:`695`" msgstr ":pep:`695`" -#: ../../library/typing.rst:3916 +#: ../../library/typing.rst:3909 msgid ":func:`@typing.no_type_check_decorator `" msgstr ":func:`@typing.no_type_check_decorator `" -#: ../../library/typing.rst:3917 ../../library/typing.rst:3921 +#: ../../library/typing.rst:3910 ../../library/typing.rst:3914 msgid "3.13" msgstr "3.13" -#: ../../library/typing.rst:3918 +#: ../../library/typing.rst:3911 msgid "3.15" msgstr "3.15" -#: ../../library/typing.rst:3919 +#: ../../library/typing.rst:3912 msgid ":gh:`106309`" msgstr ":gh:`106309`" -#: ../../library/typing.rst:3920 +#: ../../library/typing.rst:3913 msgid ":data:`typing.AnyStr`" msgstr ":data:`typing.AnyStr`" -#: ../../library/typing.rst:3922 +#: ../../library/typing.rst:3915 msgid "3.18" msgstr "3.18" -#: ../../library/typing.rst:3923 +#: ../../library/typing.rst:3916 msgid ":gh:`105578`" msgstr ":gh:`105578`" + +#~ msgid "" +#~ "@dataclass\n" +#~ "class ctype:\n" +#~ " kind: str\n" +#~ "\n" +#~ "Annotated[int, ValueRange(3, 10), ctype(\"char\")]" +#~ msgstr "" +#~ "@dataclass\n" +#~ "class ctype:\n" +#~ " kind: str\n" +#~ "\n" +#~ "Annotated[int, ValueRange(3, 10), ctype(\"char\")]" + +#~ msgid "This would be equivalent to::" +#~ msgstr "這會等價於: ::" + +#~ msgid "Annotated[T1, T2, T3, ..., Ann1]" +#~ msgstr "Annotated[T1, T2, T3, ..., Ann1]" diff --git a/library/unicodedata.po b/library/unicodedata.po index 2e2e5479be..a4a717761c 100644 --- a/library/unicodedata.po +++ b/library/unicodedata.po @@ -26,8 +26,8 @@ msgstr ":mod:`!unicodedata` --- Unicode 資料庫" msgid "" "This module provides access to the Unicode Character Database (UCD) which " "defines character properties for all Unicode characters. The data contained " -"in this database is compiled from the `UCD version 15.1.0 `_." +"in this database is compiled from the `UCD version 15.1.0 `_." msgstr "" #: ../../library/unicodedata.rst:23 @@ -57,22 +57,22 @@ msgstr "" #: ../../library/unicodedata.rst:47 msgid "" "Returns the decimal value assigned to the character *chr* as integer. If no " -"such value is defined, *default* is returned, or, if not given, :exc:" -"`ValueError` is raised." +"such value is defined, *default* is returned, or, if not " +"given, :exc:`ValueError` is raised." msgstr "" #: ../../library/unicodedata.rst:54 msgid "" "Returns the digit value assigned to the character *chr* as integer. If no " -"such value is defined, *default* is returned, or, if not given, :exc:" -"`ValueError` is raised." +"such value is defined, *default* is returned, or, if not " +"given, :exc:`ValueError` is raised." msgstr "" #: ../../library/unicodedata.rst:61 msgid "" "Returns the numeric value assigned to the character *chr* as float. If no " -"such value is defined, *default* is returned, or, if not given, :exc:" -"`ValueError` is raised." +"such value is defined, *default* is returned, or, if not " +"given, :exc:`ValueError` is raised." msgstr "" #: ../../library/unicodedata.rst:68 @@ -188,14 +188,12 @@ msgid "Footnotes" msgstr "註解" #: ../../library/unicodedata.rst:178 -#, fuzzy msgid "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" -msgstr "https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt" +msgstr "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" #: ../../library/unicodedata.rst:180 -#, fuzzy msgid "https://www.unicode.org/Public/15.1.0/ucd/NamedSequences.txt" -msgstr "https://www.unicode.org/Public/15.0.0/ucd/NamedSequences.txt" +msgstr "https://www.unicode.org/Public/15.1.0/ucd/NamedSequences.txt" #: ../../library/unicodedata.rst:11 msgid "Unicode" diff --git a/library/unittest.mock-examples.po b/library/unittest.mock-examples.po index 1b709b5160..cb271a4ff9 100644 --- a/library/unittest.mock-examples.po +++ b/library/unittest.mock-examples.po @@ -75,8 +75,9 @@ msgid "" "with the correct arguments." msgstr "" "一旦 mock 被呼叫,它的 :attr:`~Mock.called` 屬性將被設定為 ``True``。更重要的" -"是,我們可以使用 :meth:`~Mock.assert_called_with` 或 :meth:`~Mock." -"assert_called_once_with` 方法來檢查它是否被使用正確的引數來呼叫。" +"是,我們可以使用 :meth:`~Mock.assert_called_with` " +"或 :meth:`~Mock.assert_called_once_with` 方法來檢查它是否被使用正確的引數來呼" +"叫。" #: ../../library/unittest.mock-examples.rst:59 msgid "" @@ -121,12 +122,12 @@ msgstr "" msgid "" "We don't have to do any work to provide the 'close' method on our mock. " "Accessing close creates it. So, if 'close' hasn't already been called then " -"accessing it in the test will create it, but :meth:`~Mock." -"assert_called_with` will raise a failure exception." +"accessing it in the test will create it, " +"but :meth:`~Mock.assert_called_with` will raise a failure exception." msgstr "" "我們不必做任何額外的事情來為 mock 提供 'close' 方法,存取 close 會建立它。因" -"此,如果 'close' 並未被呼叫過,在測試中存取 'close' 就會建立它,但 :meth:" -"`~Mock.assert_called_with` 就會引發一個失敗的例外。" +"此,如果 'close' 並未被呼叫過,在測試中存取 'close' 就會建立它," +"但 :meth:`~Mock.assert_called_with` 就會引發一個失敗的例外。" #: ../../library/unittest.mock-examples.rst:106 msgid "Mocking Classes" @@ -148,8 +149,8 @@ msgid "" "In the example below we have a function ``some_function`` that instantiates " "``Foo`` and calls a method on it. The call to :func:`patch` replaces the " "class ``Foo`` with a mock. The ``Foo`` instance is the result of calling the " -"mock, so it is configured by modifying the mock :attr:`~Mock." -"return_value`. ::" +"mock, so it is configured by modifying the " +"mock :attr:`~Mock.return_value`. ::" msgstr "" "在下面的範例中,我們有一個函式 ``some_function``,它實例化 ``Foo`` 並呼叫它的" "方法。對 :func:`patch` 的呼叫將類別 ``Foo`` 替換為一個 mock。``Foo`` 實例是呼" @@ -197,9 +198,9 @@ msgstr "追蹤所有呼叫" #: ../../library/unittest.mock-examples.rst:146 msgid "" -"Often you want to track more than a single call to a method. The :attr:" -"`~Mock.mock_calls` attribute records all calls to child attributes of the " -"mock - and also to their children." +"Often you want to track more than a single call to a method. " +"The :attr:`~Mock.mock_calls` attribute records all calls to child attributes " +"of the mock - and also to their children." msgstr "" "通常你會想要追蹤對一個方法的多個呼叫。:attr:`~Mock.mock_calls` 屬性記錄對 " "mock 的子屬性以及其子屬性的所有呼叫。" @@ -256,9 +257,9 @@ msgid "" "``mock.connection.cursor().execute(\"SELECT 1\")``. If we wanted this call " "to return a list, then we have to configure the result of the nested call." msgstr "" -"有時你想要 mock 更複雜的情況,例如 ``mock.connection.cursor()." -"execute(\"SELECT 1\")``。如果我們希望此呼叫回傳一個串列,那麼我們就必須配置巢" -"狀呼叫的結果。" +"有時你想要 mock 更複雜的情況,例如 " +"``mock.connection.cursor().execute(\"SELECT 1\")``。如果我們希望此呼叫回傳一" +"個串列,那麼我們就必須配置巢狀呼叫的結果。" #: ../../library/unittest.mock-examples.rst:214 msgid "" @@ -322,10 +323,10 @@ msgstr "Mock 非同步可疊代物件" #: ../../library/unittest.mock-examples.rst:283 msgid "" -"Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to mock :ref:" -"`async-iterators` through ``__aiter__``. The :attr:`~Mock.return_value` " -"attribute of ``__aiter__`` can be used to set the return values to be used " -"for iteration." +"Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to " +"mock :ref:`async-iterators` through ``__aiter__``. " +"The :attr:`~Mock.return_value` attribute of ``__aiter__`` can be used to set " +"the return values to be used for iteration." msgstr "" "從 Python 3.8 開始,``AsyncMock`` 和 ``MagicMock`` 支援透過 ``__aiter__`` 來 " "mock :ref:`async-iterators`。``__aiter__`` 的 :attr:`~Mock.return_value` 屬性" @@ -337,10 +338,10 @@ msgstr "Mock 非同步情境管理器" #: ../../library/unittest.mock-examples.rst:300 msgid "" -"Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to mock :ref:" -"`async-context-managers` through ``__aenter__`` and ``__aexit__``. By " -"default, ``__aenter__`` and ``__aexit__`` are ``AsyncMock`` instances that " -"return an async function." +"Since Python 3.8, ``AsyncMock`` and ``MagicMock`` have support to " +"mock :ref:`async-context-managers` through ``__aenter__`` and ``__aexit__``. " +"By default, ``__aenter__`` and ``__aexit__`` are ``AsyncMock`` instances " +"that return an async function." msgstr "" "從 Python 3.8 開始,``AsyncMock`` 和 ``MagicMock`` 支援透過 ``__aenter__`` " "和 ``__aexit__`` 來 mock :ref:`async-context-managers`。預設情況下," @@ -426,9 +427,10 @@ msgstr "使用 side_effect 回傳各別檔案內容" #: ../../library/unittest.mock-examples.rst:366 msgid "" -":func:`mock_open` is used to patch :func:`open` method. :attr:`~Mock." -"side_effect` can be used to return a new Mock object per call. This can be " -"used to return different contents per file stored in a dictionary::" +":func:`mock_open` is used to patch :func:`open` " +"method. :attr:`~Mock.side_effect` can be used to return a new Mock object " +"per call. This can be used to return different contents per file stored in a " +"dictionary::" msgstr "" ":func:`mock_open` 是用於 patch :func:`open` 方法。:attr:`~Mock.side_effect` " "可以用來在每次呼叫回傳一個新的 mock 物件。這可以用於回傳儲存在字典中的各別檔" @@ -499,19 +501,19 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:404 msgid "" -"mock provides three convenient decorators for this: :func:`patch`, :func:" -"`patch.object` and :func:`patch.dict`. ``patch`` takes a single string, of " -"the form ``package.module.Class.attribute`` to specify the attribute you are " -"patching. It also optionally takes a value that you want the attribute (or " -"class or whatever) to be replaced with. 'patch.object' takes an object and " -"the name of the attribute you would like patched, plus optionally the value " -"to patch it with." +"mock provides three convenient decorators for " +"this: :func:`patch`, :func:`patch.object` and :func:`patch.dict`. ``patch`` " +"takes a single string, of the form ``package.module.Class.attribute`` to " +"specify the attribute you are patching. It also optionally takes a value " +"that you want the attribute (or class or whatever) to be replaced with. " +"'patch.object' takes an object and the name of the attribute you would like " +"patched, plus optionally the value to patch it with." msgstr "" -"mock 為此提供了三個方便的裝飾器::func:`patch`、:func:`patch.object` 和 :" -"func:`patch.dict`。``patch`` 接受單一字串,格式為 ``package.module.Class." -"attribute``,用來指定要 patch 的屬性。同時它也可以接受你想要替換的屬性(或類" -"別或其他)的值。``patch.object`` 接受一個物件和你想要 patch 的屬性的名稱,同" -"時也可以接受要 patch 的值。" +"mock 為此提供了三個方便的裝飾器::func:`patch`、:func:`patch.object` " +"和 :func:`patch.dict`。``patch`` 接受單一字串,格式為 " +"``package.module.Class.attribute``,用來指定要 patch 的屬性。同時它也可以接受" +"你想要替換的屬性(或類別或其他)的值。``patch.object`` 接受一個物件和你想要 " +"patch 的屬性的名稱,同時也可以接受要 patch 的值。" #: ../../library/unittest.mock-examples.rst:412 msgid "``patch.object``::" @@ -551,11 +553,11 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:429 msgid "" -"If you are patching a module (including :mod:`builtins`) then use :func:" -"`patch` instead of :func:`patch.object`:" +"If you are patching a module (including :mod:`builtins`) then " +"use :func:`patch` instead of :func:`patch.object`:" msgstr "" -"如果你要 patch 一個模組(包括 :mod:`builtins`),請使用 :func:`patch` 而非 :" -"func:`patch.object`:" +"如果你要 patch 一個模組(包括 :mod:`builtins`),請使用 :func:`patch` 而" +"非 :func:`patch.object`:" #: ../../library/unittest.mock-examples.rst:439 msgid "" @@ -657,8 +659,9 @@ msgid "" "as class decorators. When used in this way it is the same as applying the " "decorator individually to every method whose name starts with \"test\"." msgstr "" -"另外,“patch”、“patch.object” 和 “patch.dict” 也可以用來作為類別裝飾器。以這" -"種方式使用時,與將裝飾器單獨應用於每個名稱以 “test” 開頭的方法相同。" +"另外,``patch``、``patch.object`` 和 ``patch.dict`` 也可以用來作為類別裝飾" +"器。以這種方式使用時,與將裝飾器單獨應用於每個名稱以 \"test\" 開頭的方法相" +"同。" #: ../../library/unittest.mock-examples.rst:523 msgid "Further Examples" @@ -741,16 +744,17 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:573 msgid "" -"mock_backend.get_endpoint.return_value.create_call.return_value.start_call." -"return_value = mock_response" +"mock_backend.get_endpoint.return_value.create_call.return_value.start_call.return_value " +"= mock_response" msgstr "" -"mock_backend.get_endpoint.return_value.create_call.return_value.start_call." -"return_value = mock_response" +"mock_backend.get_endpoint.return_value.create_call.return_value.start_call.return_value " +"= mock_response" #: ../../library/unittest.mock-examples.rst:575 msgid "" -"We can do that in a slightly nicer way using the :meth:`~Mock." -"configure_mock` method to directly set the return value for us::" +"We can do that in a slightly nicer way using " +"the :meth:`~Mock.configure_mock` method to directly set the return value for " +"us::" msgstr "" "我們可以使用 :meth:`~Mock.configure_mock` 方法來以稍微好一點的方式為我們直接" "設定回傳值: ::" @@ -760,15 +764,17 @@ msgid "" ">>> something = Something()\n" ">>> mock_response = Mock(spec=open)\n" ">>> mock_backend = Mock()\n" -">>> config = {'get_endpoint.return_value.create_call.return_value.start_call." -"return_value': mock_response}\n" +">>> config = " +"{'get_endpoint.return_value.create_call.return_value.start_call.return_value': " +"mock_response}\n" ">>> mock_backend.configure_mock(**config)" msgstr "" ">>> something = Something()\n" ">>> mock_response = Mock(spec=open)\n" ">>> mock_backend = Mock()\n" -">>> config = {'get_endpoint.return_value.create_call.return_value.start_call." -"return_value': mock_response}\n" +">>> config = " +"{'get_endpoint.return_value.create_call.return_value.start_call.return_value': " +"mock_response}\n" ">>> mock_backend.configure_mock(**config)" #: ../../library/unittest.mock-examples.rst:584 @@ -800,13 +806,13 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:595 msgid "" -">>> chained = call.get_endpoint('foobar').create_call('spam', 'eggs')." -"start_call()\n" +">>> chained = call.get_endpoint('foobar').create_call('spam', " +"'eggs').start_call()\n" ">>> call_list = chained.call_list()\n" ">>> assert mock_backend.mock_calls == call_list" msgstr "" -">>> chained = call.get_endpoint('foobar').create_call('spam', 'eggs')." -"start_call()\n" +">>> chained = call.get_endpoint('foobar').create_call('spam', " +"'eggs').start_call()\n" ">>> call_list = chained.call_list()\n" ">>> assert mock_backend.mock_calls == call_list" @@ -819,13 +825,13 @@ msgid "" "In some tests I wanted to mock out a call to :meth:`datetime.date.today` to " "return a known date, but I didn't want to prevent the code under test from " "creating new date objects. Unfortunately :class:`datetime.date` is written " -"in C, and so I couldn't just monkey-patch out the static :meth:`datetime." -"date.today` method." +"in C, and so I couldn't just monkey-patch out the " +"static :meth:`datetime.date.today` method." msgstr "" "在某些測試中,我們會想 mock 對 :meth:`datetime.date.today` 的呼叫以回傳一個已" -"知日期,但我不想阻止測試中的程式碼建立新的日期物件。不幸的是 :class:" -"`datetime.date` 是用 C 語言寫的,所以們我不能 monkey patch 靜態的 :meth:" -"`datetime.date.today` 方法。" +"知日期,但我不想阻止測試中的程式碼建立新的日期物件。不幸的" +"是 :class:`datetime.date` 是用 C 語言寫的,所以們我不能 monkey patch 靜態" +"的 :meth:`datetime.date.today` 方法。" #: ../../library/unittest.mock-examples.rst:608 msgid "" @@ -901,9 +907,9 @@ msgid "" "is discussed in `this blog entry `_." msgstr "" -"處理 mock 日期或其他內建類別的另一種方法在 `這個 blog `_ 中" -"討論。" +"處理 mock 日期或其他內建類別的另一種方法在 `這個 blog `_ 中討論。" #: ../../library/unittest.mock-examples.rst:643 msgid "Mocking a Generator Method" @@ -921,8 +927,8 @@ msgstr "" msgid "" "A generator method / function is called to return the generator object. It " "is the generator object that is then iterated over. The protocol method for " -"iteration is :meth:`~container.__iter__`, so we can mock this using a :class:" -"`MagicMock`." +"iteration is :meth:`~container.__iter__`, so we can mock this using " +"a :class:`MagicMock`." msgstr "" "產生器方法 / 函式會被呼叫以回傳產生器物件。之後此產生器會進行疊代。疊代的協定" "方法是 :meth:`~container.__iter__`,所以我們可以使用 :class:`MagicMock` 來 " @@ -948,16 +954,16 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:675 msgid "" -"There are also generator expressions and more `advanced uses `_ of generators, but we aren't concerned " -"about them here. A very good introduction to generators and how powerful " -"they are is: `Generator Tricks for Systems Programmers `_." +"There are also generator expressions and more `advanced uses `_ of generators, but we aren't " +"concerned about them here. A very good introduction to generators and how " +"powerful they are is: `Generator Tricks for Systems Programmers `_." msgstr "" "還有關於產生器運算式及產生器的更多 `進階用法 `_ ,但我們在這裡不考慮它們。一個關於產生器及其強大功能" -"的優良說明是:`Generator Tricks for Systems Programmers `_。" +"的優良說明是:`Generator Tricks for Systems Programmers `_。" #: ../../library/unittest.mock-examples.rst:683 msgid "Applying the same patch to every test method" @@ -1054,8 +1060,8 @@ msgstr "" msgid "" "If you use this technique you must ensure that the patching is \"undone\" by " "calling ``stop``. This can be fiddlier than you might think, because if an " -"exception is raised in the setUp then tearDown is not called. :meth:" -"`unittest.TestCase.addCleanup` makes this easier::" +"exception is raised in the setUp then tearDown is not " +"called. :meth:`unittest.TestCase.addCleanup` makes this easier::" msgstr "" "如果你使用這個技巧,你必須確保透過呼叫 ``stop`` 來 \"取消\" patch。這可能會比" "你想像的還要複雜一點,因為如果有例外在 ``setUp`` 中被引發,則 ``tearDown`` 就" @@ -1147,9 +1153,9 @@ msgstr "mock 有很好的 API,用於對 mock 物件的使用方式做出斷言 #: ../../library/unittest.mock-examples.rst:792 msgid "" -"If your mock is only being called once you can use the :meth:`~Mock." -"assert_called_once_with` method that also asserts that the :attr:`~Mock." -"call_count` is one." +"If your mock is only being called once you can use " +"the :meth:`~Mock.assert_called_once_with` method that also asserts that " +"the :attr:`~Mock.call_count` is one." msgstr "" "如果你的 mock 只被呼叫一次,你可以使用 :meth:`~Mock.assert_called_once_with` " "方法,其也斷言 :attr:`~Mock.call_count` 是1。" @@ -1158,8 +1164,8 @@ msgstr "" msgid "" "Both ``assert_called_with`` and ``assert_called_once_with`` make assertions " "about the *most recent* call. If your mock is going to be called several " -"times, and you want to make assertions about *all* those calls you can use :" -"attr:`~Mock.call_args_list`:" +"times, and you want to make assertions about *all* those calls you can " +"use :attr:`~Mock.call_args_list`:" msgstr "" "``assert_called_with`` 和 ``assert_called_once_with`` 都對\\ *最近一次*\\ 的" "呼叫做出斷言。如果你的 mock 將被多次呼叫,並且你想要對\\ *所有*\\ 這些呼叫進" @@ -1332,12 +1338,12 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:912 msgid "" -"An alternative approach is to create a subclass of :class:`Mock` or :class:" -"`MagicMock` that copies (using :func:`copy.deepcopy`) the arguments. Here's " -"an example implementation:" +"An alternative approach is to create a subclass of :class:`Mock` " +"or :class:`MagicMock` that copies (using :func:`copy.deepcopy`) the " +"arguments. Here's an example implementation:" msgstr "" -"另一種方法是建立 :class:`Mock` 或 :class:`MagicMock` 的子類別來複製(使用 :" -"func:`copy.deepcopy`\\ )引數。這是一個實作的例子:" +"另一種方法是建立 :class:`Mock` 或 :class:`MagicMock` 的子類別來複製(使" +"用 :func:`copy.deepcopy`\\ )引數。這是一個實作的例子:" #: ../../library/unittest.mock-examples.rst:937 msgid "" @@ -1466,8 +1472,8 @@ msgid "" "and using :data:`~Mock.side_effect` to delegate dictionary access to a real " "underlying dictionary that is under our control." msgstr "" -"我們可以使用 :class:`MagicMock` 來做到這一點,它的行為會與字典一致,並使用 :" -"data:`~Mock.side_effect` 將字典存取委託給我們控制下的真實底層字典。" +"我們可以使用 :class:`MagicMock` 來做到這一點,它的行為會與字典一致,並使" +"用 :data:`~Mock.side_effect` 將字典存取委託給我們控制下的真實底層字典。" #: ../../library/unittest.mock-examples.rst:1000 msgid "" @@ -1476,15 +1482,16 @@ msgid "" "``side_effect`` is called with the key (and in the case of ``__setitem__`` " "the value too). We can also control what is returned." msgstr "" -"當 ``MagicMock`` 的 :meth:`~object.__getitem__` 和 :meth:`~object." -"__setitem__` 方法被呼叫時(一般的字典存取), ``side_effect`` 會被使用鍵 " -"(key) 來呼叫 (在 ``__setitem__`` 的情況也會使用值 (value))。我們也可以控制" -"回傳的內容。" +"當 ``MagicMock`` 的 :meth:`~object.__getitem__` " +"和 :meth:`~object.__setitem__` 方法被呼叫時(一般的字典存取), " +"``side_effect`` 會被使用鍵 (key) 來呼叫 (在 ``__setitem__`` 的情況也會使用" +"值 (value))。我們也可以控制回傳的內容。" #: ../../library/unittest.mock-examples.rst:1005 msgid "" -"After the ``MagicMock`` has been used we can use attributes like :data:" -"`~Mock.call_args_list` to assert about how the dictionary was used:" +"After the ``MagicMock`` has been used we can use attributes " +"like :data:`~Mock.call_args_list` to assert about how the dictionary was " +"used:" msgstr "" "使用 ``MagicMock`` 後,我們可以使用諸如 :data:`~Mock.call_args_list` 之類的屬" "性來斷言字典被使用的方式:" @@ -1549,10 +1556,11 @@ msgstr "" #: ../../library/unittest.mock-examples.rst:1101 msgid "" -"Sometimes this is inconvenient. For example, `one user `_ is subclassing mock to created a `Twisted " -"adaptor `_. Having this applied to attributes too actually causes errors." +"Sometimes this is inconvenient. For example, `one user `_ is subclassing mock to created " +"a `Twisted adaptor `_. Having this applied to attributes too " +"actually causes errors." msgstr "" "有時候這很不方便。例如,`有一個使用者 `_\\ 正在子類別化 mock 以建立 `Twisted adaptor `_ provides similar functionality, that may be " -"useful here, in the form of its equality matcher (`hamcrest.library." -"integration.match_equality `_)." -msgstr "" -"從版本 1.5 開始,Python 測試函式庫 `PyHamcrest `_ 以其相等匹配器的形式,提供了類似的功能,在這裡可能是有用" -"的 (\\ `hamcrest.library.integration.match_equality `_\\ )。" +"useful here, in the form of its equality matcher " +"(`hamcrest.library.integration.match_equality `_)." +msgstr "" +"從版本 1.5 開始,Python 測試函式庫 `PyHamcrest `_ 以其相等匹配器的形式,提供了類似的功能,在這裡" +"可能是有用的 (\\ `hamcrest.library.integration.match_equality `_\\ )。" diff --git a/library/unittest.mock.po b/library/unittest.mock.po index b01f99b930..dcdcb78d7a 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2025-02-22 00:13+0000\n" "PO-Revision-Date: 2024-02-19 21:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -50,15 +50,15 @@ msgstr "" #: ../../library/unittest.mock.rst:26 msgid "" "Additionally, mock provides a :func:`patch` decorator that handles patching " -"module and class level attributes within the scope of a test, along with :" -"const:`sentinel` for creating unique objects. See the `quick guide`_ for " -"some examples of how to use :class:`Mock`, :class:`MagicMock` and :func:" -"`patch`." +"module and class level attributes within the scope of a test, along " +"with :const:`sentinel` for creating unique objects. See the `quick guide`_ " +"for some examples of how to use :class:`Mock`, :class:`MagicMock` " +"and :func:`patch`." msgstr "" "此外,mock 還提供了一個 :func:`patch` 裝飾器,用於 patching 測試範圍內對 " -"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件的 :const:" -"`sentinel`。有關如何使用 :class:`Mock`\\、:class:`MagicMock` 和 :func:" -"`patch` 的一些範例,請參閱\\ `快速導引 `_。" +"module(模組)以及 class(類別)級別的屬性,以及用於建立唯一物件" +"的 :const:`sentinel`。有關如何使用 :class:`Mock`\\、:class:`MagicMock` " +"和 :func:`patch` 的一些範例,請參閱\\ `快速導引 `_。" #: ../../library/unittest.mock.rst:32 msgid "" @@ -222,11 +222,11 @@ msgid "" "replacing, and any functions and methods (including constructors) have the " "same call signature as the real object." msgstr "" -"為了確保測試中的 mock 物件與它們要替換的物件具有相同的 api,你可以使用\\ :" -"ref:`自動規格 `。自動規格(auto-speccing)可以通過 patch 的 " -"*autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的 mock 物" -"件與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構函式)" -"都具有與真實物件相同的呼叫簽名(call signature)。" +"為了確保測試中的 mock 物件與它們要替換的物件具有相同的 api,你可以使用" +"\\ :ref:`自動規格 `。自動規格(auto-speccing)可以通過 patch " +"的 *autospec* 引數或 :func:`create_autospec` 函式來完成。自動規格建立的 mock " +"物件與它們要替換的物件具有相同的屬性和方法,並且任何函式和方法(包括建構函" +"式)都具有與真實物件相同的呼叫簽名(call signature)。" #: ../../library/unittest.mock.rst:177 msgid "" @@ -264,12 +264,12 @@ msgstr "" msgid "" ":class:`MagicMock` is a subclass of :class:`Mock` with all the magic methods " "pre-created and ready to use. There are also non-callable variants, useful " -"when you are mocking out objects that aren't callable: :class:" -"`NonCallableMock` and :class:`NonCallableMagicMock`" +"when you are mocking out objects that aren't " +"callable: :class:`NonCallableMock` and :class:`NonCallableMagicMock`" msgstr "" ":class:`MagicMock` 是 :class:`Mock` 的子類別,其中所有魔術方法均已預先建立並" -"可供使用。也有不可呼叫的變體,在你 mock 無法呼叫的物件時很有用::class:" -"`NonCallableMock` 和 :class:`NonCallableMagicMock`" +"可供使用。也有不可呼叫的變體,在你 mock 無法呼叫的物件時很有" +"用::class:`NonCallableMock` 和 :class:`NonCallableMagicMock`" #: ../../library/unittest.mock.rst:224 msgid "" @@ -279,8 +279,8 @@ msgid "" "class of :class:`Mock` using the *new_callable* argument to :func:`patch`." msgstr "" ":func:`patch` 裝飾器可以輕鬆地用 :class:`Mock` 物件臨時替換特定模組中的類別。" -"預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使用 :" -"func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。" +"預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使" +"用 :func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。" #: ../../library/unittest.mock.rst:232 msgid "" @@ -300,18 +300,18 @@ msgid "" msgstr "" "*spec*:這可以是字串的 list(串列),也可以是充當 mock 物件規格的現有物件(類" "別或實例)。如果傳入一個物件,則通過對該物件呼叫 dir 來形成字串的串列(不包括" -"不支援的魔術屬性和方法)。存取不在此串列中的任何屬性都會引發 :exc:" -"`AttributeError`。" +"不支援的魔術屬性和方法)。存取不在此串列中的任何屬性都會引" +"發 :exc:`AttributeError`。" #: ../../library/unittest.mock.rst:241 msgid "" -"If *spec* is an object (rather than a list of strings) then :attr:`~object." -"__class__` returns the class of the spec object. This allows mocks to pass :" -"func:`isinstance` tests." +"If *spec* is an object (rather than a list of strings) " +"then :attr:`~object.__class__` returns the class of the spec object. This " +"allows mocks to pass :func:`isinstance` tests." msgstr "" -"如果 *spec* 是一個物件(而不是一個字串的串列),那麼 :attr:`~object." -"__class__` 會回傳 spec 物件的類別。這允許 mocks 通過 :func:`isinstance` 測" -"試。" +"如果 *spec* 是一個物件(而不是一個字串的串列),那" +"麼 :attr:`~object.__class__` 會回傳 spec 物件的類別。這允許 mocks 通" +"過 :func:`isinstance` 測試。" #: ../../library/unittest.mock.rst:245 msgid "" @@ -320,13 +320,13 @@ msgid "" "will raise an :exc:`AttributeError`." msgstr "" "*spec_set*:*spec* 的一個更嚴格的變體。如果使用 *spec_set*,在 mock 上嘗試 " -"*set* 或取得不在傳遞給 *spec_set* 的物件上的屬性將會引發 :exc:" -"`AttributeError`。" +"*set* 或取得不在傳遞給 *spec_set* 的物件上的屬性將會引" +"發 :exc:`AttributeError`。" #: ../../library/unittest.mock.rst:249 msgid "" -"*side_effect*: A function to be called whenever the Mock is called. See the :" -"attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " +"*side_effect*: A function to be called whenever the Mock is called. See " +"the :attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " "dynamically changing return values. The function is called with the same " "arguments as the mock, and unless it returns :data:`DEFAULT`, the return " "value of this function is used as the return value." @@ -367,8 +367,8 @@ msgstr "" #: ../../library/unittest.mock.rst:267 msgid "" "*unsafe*: By default, accessing any attribute whose name starts with " -"*assert*, *assret*, *asert*, *aseert* or *assrt* will raise an :exc:" -"`AttributeError`. Passing ``unsafe=True`` will allow access to these " +"*assert*, *assret*, *asert*, *aseert* or *assrt* will raise " +"an :exc:`AttributeError`. Passing ``unsafe=True`` will allow access to these " "attributes." msgstr "" "*unsafe*:預設情況下,存取任何以 *assert*、*assret*、*asert*、*aseert* 或 " @@ -381,13 +381,13 @@ msgid "" "calling the Mock will pass the call through to the wrapped object (returning " "the real result). Attribute access on the mock will return a Mock object " "that wraps the corresponding attribute of the wrapped object (so attempting " -"to access an attribute that doesn't exist will raise an :exc:" -"`AttributeError`)." +"to access an attribute that doesn't exist will raise " +"an :exc:`AttributeError`)." msgstr "" "*wraps*:被 mock 物件包裝的項目。如果 *wraps* 不是 ``None``,那麼呼叫 Mock 將" "通過被包裝的物件(回傳真實結果)。存取 mock 的屬性將會回傳一個 Mock 物件,該" -"物件包裝了被包裝物件的對應屬性(因此嘗試存取不存在的屬性將引發 :exc:" -"`AttributeError`\\ )。" +"物件包裝了被包裝物件的對應屬性(因此嘗試存取不存在的屬性將引" +"發 :exc:`AttributeError`\\ )。" #: ../../library/unittest.mock.rst:281 msgid "" @@ -408,8 +408,8 @@ msgstr "" #: ../../library/unittest.mock.rst:288 msgid "" "Mocks can also be called with arbitrary keyword arguments. These will be " -"used to set attributes on the mock after it is created. See the :meth:" -"`configure_mock` method for details." +"used to set attributes on the mock after it is created. See " +"the :meth:`configure_mock` method for details." msgstr "" "Mocks 還可以使用任意的關鍵字引數進行呼叫。這些關鍵字引數將在建立 mock 之後用" "於設定 mock 的屬性。欲知更多,請參見 :meth:`configure_mock` 方法。" @@ -440,19 +440,19 @@ msgstr "斷言 mock 已經被使用指定的引數呼叫。" #: ../../library/unittest.mock.rst:351 msgid "" -"The assert passes if the mock has *ever* been called, unlike :meth:" -"`assert_called_with` and :meth:`assert_called_once_with` that only pass if " -"the call is the most recent one, and in the case of :meth:" -"`assert_called_once_with` it must also be the only call." +"The assert passes if the mock has *ever* been called, " +"unlike :meth:`assert_called_with` and :meth:`assert_called_once_with` that " +"only pass if the call is the most recent one, and in the case " +"of :meth:`assert_called_once_with` it must also be the only call." msgstr "" -"這個斷言在 mock 曾經被呼叫過時通過,不同於 :meth:`assert_called_with` 和 :" -"meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對於 :meth:" -"`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。" +"這個斷言在 mock 曾經被呼叫過時通過,不同於 :meth:`assert_called_with` " +"和 :meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對" +"於 :meth:`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。" #: ../../library/unittest.mock.rst:364 msgid "" -"assert the mock has been called with the specified calls. The :attr:" -"`mock_calls` list is checked for the calls." +"assert the mock has been called with the specified calls. " +"The :attr:`mock_calls` list is checked for the calls." msgstr "" "斷言 mock 已經使用指定的呼叫方式來呼叫。此斷言會檢查 :attr:`mock_calls` 串列" "中的呼叫。" @@ -481,31 +481,92 @@ msgstr "斷言 mock 從未被呼叫。" msgid "The reset_mock method resets all the call attributes on a mock object:" msgstr "reset_mock 方法重置 mock 物件上的所有呼叫屬性:" -#: ../../library/unittest.mock.rst:412 -msgid "Added two keyword-only arguments to the reset_mock function." -msgstr "reset_mock 函式新增了兩個僅限關鍵字引數 (keyword-only arguments)。" +#: ../../library/unittest.mock.rst:404 +msgid "" +">>> mock = Mock(return_value=None)\n" +">>> mock('hello')\n" +">>> mock.called\n" +"True\n" +">>> mock.reset_mock()\n" +">>> mock.called\n" +"False" +msgstr "" +">>> mock = Mock(return_value=None)\n" +">>> mock('hello')\n" +">>> mock.called\n" +"True\n" +">>> mock.reset_mock()\n" +">>> mock.called\n" +"False" -#: ../../library/unittest.mock.rst:415 +#: ../../library/unittest.mock.rst:414 msgid "" "This can be useful where you want to make a series of assertions that reuse " -"the same object. Note that :meth:`reset_mock` *doesn't* clear the :attr:" -"`return_value`, :attr:`side_effect` or any child attributes you have set " -"using normal assignment by default. In case you want to reset :attr:" -"`return_value` or :attr:`side_effect`, then pass the corresponding parameter " -"as ``True``. Child mocks and the return value mock (if any) are reset as " -"well." +"the same object." msgstr "" -"這在你想要進行一系列重複使用同一物件的斷言時非常有用。請注意,預設情況下,:" -"meth:`reset_mock` *不會*\\ 清除 :attr:`return_value`、:attr:`side_effect` 或" -"使用普通賦值設定的任何子屬性。如果你想要重置 :attr:`return_value` 或 :attr:" -"`side_effect`,則將相應的參數設置為 ``True``。Child mock 和回傳值 mock(如果" -"有的話)也會被重置。" -#: ../../library/unittest.mock.rst:423 -msgid "*return_value*, and *side_effect* are keyword-only arguments." -msgstr "*return_value* 和 *side_effect* 是僅限關鍵字引數。" +#: ../../library/unittest.mock.rst:417 +msgid "" +"*return_value* parameter when set to ``True`` resets :attr:`return_value`:" +msgstr "" + +#: ../../library/unittest.mock.rst:419 +msgid "" +">>> mock = Mock(return_value=5)\n" +">>> mock('hello')\n" +"5\n" +">>> mock.reset_mock(return_value=True)\n" +">>> mock('hello')\n" +"" +msgstr "" +">>> mock = Mock(return_value=5)\n" +">>> mock('hello')\n" +"5\n" +">>> mock.reset_mock(return_value=True)\n" +">>> mock('hello')\n" +"" -#: ../../library/unittest.mock.rst:429 +#: ../../library/unittest.mock.rst:428 +msgid "" +"*side_effect* parameter when set to ``True`` resets :attr:`side_effect`:" +msgstr "" + +#: ../../library/unittest.mock.rst:430 +msgid "" +">>> mock = Mock(side_effect=ValueError)\n" +">>> mock('hello')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError\n" +">>> mock.reset_mock(side_effect=True)\n" +">>> mock('hello')\n" +"" +msgstr "" +">>> mock = Mock(side_effect=ValueError)\n" +">>> mock('hello')\n" +"Traceback (most recent call last):\n" +" ...\n" +"ValueError\n" +">>> mock.reset_mock(side_effect=True)\n" +">>> mock('hello')\n" +"" + +#: ../../library/unittest.mock.rst:441 +msgid "" +"Note that :meth:`reset_mock` *doesn't* clear " +"the :attr:`return_value`, :attr:`side_effect` or any child attributes you " +"have set using normal assignment by default." +msgstr "" + +#: ../../library/unittest.mock.rst:445 +msgid "Child mocks are reset as well." +msgstr "" + +#: ../../library/unittest.mock.rst:447 +msgid "Added two keyword-only arguments to the reset_mock function." +msgstr "reset_mock 函式新增了兩個僅限關鍵字引數 (keyword-only arguments)。" + +#: ../../library/unittest.mock.rst:452 msgid "" "Add a spec to a mock. *spec* can either be an object or a list of strings. " "Only attributes on the *spec* can be fetched as attributes from the mock." @@ -513,25 +574,25 @@ msgstr "" "向 mock 增加一個規格 (spec)。*spec* 可以是一個物件或一個字串串列 (list of " "strings)。只有在 *spec* 上的屬性才能作為 mock 的屬性被取得。" -#: ../../library/unittest.mock.rst:433 +#: ../../library/unittest.mock.rst:456 msgid "If *spec_set* is true then only attributes on the spec can be set." msgstr "如果 *spec_set* 為 true,那麼只能設定在規格中的屬性。" -#: ../../library/unittest.mock.rst:438 +#: ../../library/unittest.mock.rst:461 msgid "" "Attach a mock as an attribute of this one, replacing its name and parent. " -"Calls to the attached mock will be recorded in the :attr:`method_calls` and :" -"attr:`mock_calls` attributes of this one." +"Calls to the attached mock will be recorded in the :attr:`method_calls` " +"and :attr:`mock_calls` attributes of this one." msgstr "" "將一個 mock 作為這個 Mock 的屬性附加,取代它的名稱和上代 (parent)。對附加的 " "mock 的呼叫將被記錄在這個 Mock 的 :attr:`method_calls` 和 :attr:`mock_calls` " "屬性中。" -#: ../../library/unittest.mock.rst:445 +#: ../../library/unittest.mock.rst:468 msgid "Set attributes on the mock through keyword arguments." msgstr "透過關鍵字引數在 mock 上設定屬性。" -#: ../../library/unittest.mock.rst:447 +#: ../../library/unittest.mock.rst:470 msgid "" "Attributes plus return values and side effects can be set on child mocks " "using standard dot notation and unpacking a dictionary in the method call:" @@ -539,18 +600,18 @@ msgstr "" "可以在使用 method(方法)呼叫時,使用標準點記法 (dot notation) 並將字典拆開," "為 child mock 設定屬性、回傳值和 side effects:" -#: ../../library/unittest.mock.rst:461 +#: ../../library/unittest.mock.rst:484 msgid "The same thing can be achieved in the constructor call to mocks:" msgstr "同樣的事情可以在 mock 的建構函式呼叫中實現:" -#: ../../library/unittest.mock.rst:474 +#: ../../library/unittest.mock.rst:497 msgid "" ":meth:`configure_mock` exists to make it easier to do configuration after " "the mock has been created." msgstr "" ":meth:`configure_mock` 的存在是為了在 mock 被建立後更容易進行組態設定。" -#: ../../library/unittest.mock.rst:480 +#: ../../library/unittest.mock.rst:503 msgid "" ":class:`Mock` objects limit the results of ``dir(some_mock)`` to useful " "results. For mocks with a *spec* this includes all the permitted attributes " @@ -559,13 +620,13 @@ msgstr "" ":class:`Mock` 物件限制了 ``dir(some_mock)`` 僅顯示有用的結果。對於具有 " "*spec* 的 mock,這包含所有被允許的 mock 屬性。" -#: ../../library/unittest.mock.rst:484 +#: ../../library/unittest.mock.rst:507 msgid "" "See :data:`FILTER_DIR` for what this filtering does, and how to switch it " "off." msgstr "請參閱 :data:`FILTER_DIR` 以了解這種過濾行為的作用,以及如何關閉它。" -#: ../../library/unittest.mock.rst:490 +#: ../../library/unittest.mock.rst:513 msgid "" "Create the child mocks for attributes and return value. By default child " "mocks will be the same type as the parent. Subclasses of Mock may want to " @@ -574,35 +635,35 @@ msgstr "" "建立為了得到屬性和回傳值的 child mock。預設情況下,child mock 將與其上代是相" "同的型別。Mock 的子類別可能會想要置換此行為,以自定義 child mock 的建立方式。" -#: ../../library/unittest.mock.rst:495 +#: ../../library/unittest.mock.rst:518 msgid "" "For non-callable mocks the callable variant will be used (rather than any " "custom subclass)." msgstr "對於不可呼叫的 mock,將使用可呼叫的變體,而不是任何的自定義子類別。" -#: ../../library/unittest.mock.rst:501 +#: ../../library/unittest.mock.rst:524 msgid "A boolean representing whether or not the mock object has been called:" msgstr "一個 boolean(布林),表述 mock 物件是否已經被呼叫:" -#: ../../library/unittest.mock.rst:512 +#: ../../library/unittest.mock.rst:535 msgid "An integer telling you how many times the mock object has been called:" msgstr "一個整數,告訴你 mock 物件被呼叫的次數:" -#: ../../library/unittest.mock.rst:524 +#: ../../library/unittest.mock.rst:547 msgid "Set this to configure the value returned by calling the mock:" msgstr "設定此值以配置呼叫 mock 時回傳的值:" -#: ../../library/unittest.mock.rst:531 +#: ../../library/unittest.mock.rst:554 msgid "" "The default return value is a mock object and you can configure it in the " "normal way:" msgstr "預設的回傳值是一個 mock 物件,你也可以按照正常的方式配置它:" -#: ../../library/unittest.mock.rst:540 +#: ../../library/unittest.mock.rst:563 msgid ":attr:`return_value` can also be set in the constructor:" msgstr ":attr:`return_value` 也可以在建構函式中設定:" -#: ../../library/unittest.mock.rst:551 +#: ../../library/unittest.mock.rst:574 msgid "" "This can either be a function to be called when the mock is called, an " "iterable or an exception (class or instance) to be raised." @@ -610,7 +671,7 @@ msgstr "" "這可以是一個在呼叫 mock 時要呼叫的函式、一個可疊代物件,或者要引發的例外(類" "別或實例)。" -#: ../../library/unittest.mock.rst:554 +#: ../../library/unittest.mock.rst:577 msgid "" "If you pass in a function it will be called with same arguments as the mock " "and unless the function returns the :data:`DEFAULT` singleton the call to " @@ -618,37 +679,37 @@ msgid "" "returns :data:`DEFAULT` then the mock will return its normal value (from " "the :attr:`return_value`)." msgstr "" -"如果你傳遞一個函式,它將被呼叫,其引數與 mock 相同,且除非該函式回傳 :data:" -"`DEFAULT` 單例 (singleton),否則對 mock 的呼叫將回傳函式回傳的任何值。如果函" -"式回傳 :data:`DEFAULT`,那麼 mock 將回傳其正常的回傳值(從 :attr:" -"`return_value` 得到)。" +"如果你傳遞一個函式,它將被呼叫,其引數與 mock 相同,且除非該函式回" +"傳 :data:`DEFAULT` 單例 (singleton),否則對 mock 的呼叫將回傳函式回傳的任何" +"值。如果函式回傳 :data:`DEFAULT`,那麼 mock 將回傳其正常的回傳值" +"(從 :attr:`return_value` 得到)。" -#: ../../library/unittest.mock.rst:560 +#: ../../library/unittest.mock.rst:583 msgid "" "If you pass in an iterable, it is used to retrieve an iterator which must " "yield a value on every call. This value can either be an exception instance " -"to be raised, or a value to be returned from the call to the mock (:data:" -"`DEFAULT` handling is identical to the function case)." +"to be raised, or a value to be returned from the call to the mock " +"(:data:`DEFAULT` handling is identical to the function case)." msgstr "" "如果你傳遞一個可疊代物件,它將被用於檢索一個疊代器,該疊代器必須在每次呼叫時" "產出 (yield) 一個值。這個值可以是要引發的例外實例,或者是對 mock 呼叫時要回傳" "的值(處理 :data:`DEFAULT` 的方式與函式的狀況相同)。" -#: ../../library/unittest.mock.rst:565 +#: ../../library/unittest.mock.rst:588 msgid "" "An example of a mock that raises an exception (to test exception handling of " "an API):" msgstr "以下是一個引發例外的 mock 的範例(用於測試 API 的例外處理):" -#: ../../library/unittest.mock.rst:575 +#: ../../library/unittest.mock.rst:598 msgid "Using :attr:`side_effect` to return a sequence of values:" msgstr "使用 :attr:`side_effect` 回傳一連串值的範例:" -#: ../../library/unittest.mock.rst:582 +#: ../../library/unittest.mock.rst:605 msgid "Using a callable:" msgstr "使用可被呼叫物件的範例:" -#: ../../library/unittest.mock.rst:592 +#: ../../library/unittest.mock.rst:615 msgid "" ":attr:`side_effect` can be set in the constructor. Here's an example that " "adds one to the value the mock is called with and returns it:" @@ -656,11 +717,11 @@ msgstr "" ":attr:`side_effect` 可以在建構函式中設定。以下是一個範例,它將 mock 被呼叫時" "給的值加一並回傳:" -#: ../../library/unittest.mock.rst:602 +#: ../../library/unittest.mock.rst:625 msgid "Setting :attr:`side_effect` to ``None`` clears it:" msgstr "將 :attr:`side_effect` 設定為 ``None`` 可以清除它:" -#: ../../library/unittest.mock.rst:616 +#: ../../library/unittest.mock.rst:639 msgid "" "This is either ``None`` (if the mock hasn't been called), or the arguments " "that the mock was last called with. This will be in the form of a tuple: the " @@ -674,35 +735,36 @@ msgstr "" "是 mock 被呼叫時傳遞的所有有序引數(或一個空元組)。第二個成員,其可以通過 " "``kwargs`` 屬性存取,是所有關鍵字引數(或一個空字典)。" -#: ../../library/unittest.mock.rst:649 +#: ../../library/unittest.mock.rst:672 msgid "" -":attr:`call_args`, along with members of the lists :attr:`call_args_list`, :" -"attr:`method_calls` and :attr:`mock_calls` are :data:`call` objects. These " -"are tuples, so they can be unpacked to get at the individual arguments and " -"make more complex assertions. See :ref:`calls as tuples `." +":attr:`call_args`, along with members of the " +"lists :attr:`call_args_list`, :attr:`method_calls` and :attr:`mock_calls` " +"are :data:`call` objects. These are tuples, so they can be unpacked to get " +"at the individual arguments and make more complex assertions. " +"See :ref:`calls as tuples `." msgstr "" -":attr:`call_args`,以及串列 :attr:`call_args_list`、:attr:`method_calls` 和 :" -"attr:`mock_calls` 的成員都是 :data:`call` 物件。這些都是元組,因此可以解包以" -"取得各個引數並進行更複雜的斷言。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:655 +#: ../../library/unittest.mock.rst:678 msgid "Added ``args`` and ``kwargs`` properties." msgstr "新增 ``args`` 與 ``kwargs`` 特性。" -#: ../../library/unittest.mock.rst:661 +#: ../../library/unittest.mock.rst:684 msgid "" "This is a list of all the calls made to the mock object in sequence (so the " "length of the list is the number of times it has been called). Before any " "calls have been made it is an empty list. The :data:`call` object can be " -"used for conveniently constructing lists of calls to compare with :attr:" -"`call_args_list`." +"used for conveniently constructing lists of calls to compare " +"with :attr:`call_args_list`." msgstr "" "這是按順序列出所有呼叫 mock 物件的串列(因此串列的長度表示它被呼叫的次數)。" "在任何呼叫發生之前,它會是一個空的串列。 :data:`call` 物件可用於方便地建構呼" "叫的串列,以便與 :attr:`call_args_list` 進行比較。" -#: ../../library/unittest.mock.rst:677 +#: ../../library/unittest.mock.rst:700 msgid "" "Members of :attr:`call_args_list` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " @@ -711,7 +773,7 @@ msgstr "" ":attr:`call_args_list` 的成員都是 :data:`call` 物件。這些物件可以被拆包為元" "組,以取得各個引數。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:684 +#: ../../library/unittest.mock.rst:707 msgid "" "As well as tracking calls to themselves, mocks also track calls to methods " "and attributes, and *their* methods and attributes:" @@ -719,7 +781,7 @@ msgstr "" "除了追蹤對自身的呼叫之外,mock 還會追蹤對方法和屬性的呼叫,以及\\ *它們(這些" "方法和屬性)*\\ 的方法和屬性:" -#: ../../library/unittest.mock.rst:695 +#: ../../library/unittest.mock.rst:718 msgid "" "Members of :attr:`method_calls` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " @@ -728,7 +790,7 @@ msgstr "" ":attr:`method_calls` 的成員都是 :data:`call` 物件。這些物件可以拆包為元組,以" "取得各個引數。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:702 +#: ../../library/unittest.mock.rst:725 msgid "" ":attr:`mock_calls` records *all* calls to the mock object, its methods, " "magic methods *and* return value mocks." @@ -736,7 +798,7 @@ msgstr "" ":attr:`mock_calls` 記錄了 *所有* 對 mock 物件的呼叫,包含其方法、魔術方法以及" "回傳值 mock。" -#: ../../library/unittest.mock.rst:720 +#: ../../library/unittest.mock.rst:743 msgid "" "Members of :attr:`mock_calls` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " @@ -745,7 +807,7 @@ msgstr "" ":attr:`method_calls` 的成員都是 :data:`call` 物件。這些物件可以拆包為元組,以" "取得各個引數。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:726 +#: ../../library/unittest.mock.rst:749 msgid "" "The way :attr:`mock_calls` are recorded means that where nested calls are " "made, the parameters of ancestor calls are not recorded and so will always " @@ -754,7 +816,7 @@ msgstr "" ":attr:`mock_calls` 記錄的方式意味著在進行巢狀呼叫時,上代 (ancestor) 呼叫的參" "數不會被記錄,因此在比較時它們將始終相等:" -#: ../../library/unittest.mock.rst:740 +#: ../../library/unittest.mock.rst:763 msgid "" "Normally the :attr:`!__class__` attribute of an object will return its type. " "For a mock object with a :attr:`!spec`, :attr:`!__class__` returns the spec " @@ -765,15 +827,15 @@ msgstr "" "的 mock 物件,:attr:`!__class__` 會回傳 spec 的類別。這允許 mock 物件通過對它" "們所替代或偽裝的物件進行的 :func:`isinstance` 測試:" -#: ../../library/unittest.mock.rst:749 +#: ../../library/unittest.mock.rst:772 msgid "" -":attr:`!__class__` is assignable to, this allows a mock to pass an :func:" -"`isinstance` check without forcing you to use a spec:" +":attr:`!__class__` is assignable to, this allows a mock to pass " +"an :func:`isinstance` check without forcing you to use a spec:" msgstr "" ":attr:`!__class__` 可以被指定,這允許 mock 通過 :func:`isinstance` 檢查,而不" "需要強制使用 spec:" -#: ../../library/unittest.mock.rst:759 +#: ../../library/unittest.mock.rst:782 msgid "" "A non-callable version of :class:`Mock`. The constructor parameters have the " "same meaning of :class:`Mock`, with the exception of *return_value* and " @@ -782,34 +844,34 @@ msgstr "" ":class:`Mock` 的一個不可呼叫版本。建構函式參數的意義與 :class:`Mock` 相同,其" "例外為 *return_value* 和 *side_effect* 在不可呼叫的 mock 上無意義。" -#: ../../library/unittest.mock.rst:763 +#: ../../library/unittest.mock.rst:786 msgid "" "Mock objects that use a class or an instance as a :attr:`!spec` or :attr:`!" "spec_set` are able to pass :func:`isinstance` tests:" msgstr "" -"使用類別或實例作為 :attr:`!spec` 或 :attr:`!spec_set` 的 mock 物件能夠通過 :" -"func:`isinstance` 測試:" +"使用類別或實例作為 :attr:`!spec` 或 :attr:`!spec_set` 的 mock 物件能夠通" +"過 :func:`isinstance` 測試:" -#: ../../library/unittest.mock.rst:773 +#: ../../library/unittest.mock.rst:796 msgid "" -"The :class:`Mock` classes have support for mocking magic methods. See :ref:" -"`magic methods ` for the full details." +"The :class:`Mock` classes have support for mocking magic methods. " +"See :ref:`magic methods ` for the full details." msgstr "" ":class:`Mock` 類別支援 mock 魔術方法。細節請參考\\ :ref:`魔術方法 `。" -#: ../../library/unittest.mock.rst:776 +#: ../../library/unittest.mock.rst:799 msgid "" "The mock classes and the :func:`patch` decorators all take arbitrary keyword " "arguments for configuration. For the :func:`patch` decorators the keywords " "are passed to the constructor of the mock being created. The keyword " "arguments are for configuring attributes of the mock:" msgstr "" -"Mock類別和 :func:`patch` 裝飾器於組態時接受任意的關鍵字引數。對於 :func:" -"`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵字引數用" -"於配置 mock 的屬性:" +"Mock類別和 :func:`patch` 裝飾器於組態時接受任意的關鍵字引數。對" +"於 :func:`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵" +"字引數用於配置 mock 的屬性:" -#: ../../library/unittest.mock.rst:787 +#: ../../library/unittest.mock.rst:810 msgid "" "The return value and side effect of child mocks can be set in the same way, " "using dotted notation. As you can't use dotted names directly in a call you " @@ -818,7 +880,7 @@ msgstr "" "Child mock 的回傳值和 side effect 可以使用使用點記法進行設置。由於你無法直接" "在呼叫中使用帶有點 (.) 的名稱,因此你必須建立一個字典並使用 ``**`` 解包:" -#: ../../library/unittest.mock.rst:802 +#: ../../library/unittest.mock.rst:825 msgid "" "A callable mock which was created with a *spec* (or a *spec_set*) will " "introspect the specification object's signature when matching calls to the " @@ -829,7 +891,7 @@ msgstr "" "將會內省 (introspect) 規格物件的簽名 (signature)。因此,它可以匹配實際呼叫的" "引數,無論它們是按位置傳遞還是按名稱傳遞: ::" -#: ../../library/unittest.mock.rst:807 +#: ../../library/unittest.mock.rst:830 msgid "" ">>> def f(a, b, c): pass\n" "...\n" @@ -847,36 +909,36 @@ msgstr "" ">>> mock.assert_called_with(1, 2, 3)\n" ">>> mock.assert_called_with(a=1, b=2, c=3)" -#: ../../library/unittest.mock.rst:815 +#: ../../library/unittest.mock.rst:838 msgid "" -"This applies to :meth:`~Mock.assert_called_with`, :meth:`~Mock." -"assert_called_once_with`, :meth:`~Mock.assert_has_calls` and :meth:`~Mock." -"assert_any_call`. When :ref:`auto-speccing`, it will also apply to method " -"calls on the mock object." +"This applies " +"to :meth:`~Mock.assert_called_with`, :meth:`~Mock.assert_called_once_with`, :meth:`~Mock.assert_has_calls` " +"and :meth:`~Mock.assert_any_call`. When :ref:`auto-speccing`, it will also " +"apply to method calls on the mock object." msgstr "" -"這適用於 :meth:`~Mock.assert_called_with`、:meth:`~Mock." -"assert_called_once_with`、:meth:`~Mock.assert_has_calls` 和 :meth:`~Mock." -"assert_any_call`。在使用 :ref:`auto-speccing` 時,它還適用於 mock 物件的方法" -"呼叫。" +"這適用" +"於 :meth:`~Mock.assert_called_with`、:meth:`~Mock.assert_called_once_with`、:meth:`~Mock.assert_has_calls` " +"和 :meth:`~Mock.assert_any_call`。在使用 :ref:`auto-speccing` 時,它還適用於 " +"mock 物件的方法呼叫。" -#: ../../library/unittest.mock.rst:820 +#: ../../library/unittest.mock.rst:843 msgid "Added signature introspection on specced and autospecced mock objects." msgstr "" "對於已經設置了規格(spec)和自動規格(autospec)的 mock 物件,新增簽名內省功" "能。" -#: ../../library/unittest.mock.rst:826 +#: ../../library/unittest.mock.rst:849 msgid "" -"A mock intended to be used as a :class:`property`, or other :term:" -"`descriptor`, on a class. :class:`PropertyMock` provides :meth:`~object." -"__get__` and :meth:`~object.__set__` methods so you can specify a return " -"value when it is fetched." +"A mock intended to be used as a :class:`property`, or " +"other :term:`descriptor`, on a class. :class:`PropertyMock` " +"provides :meth:`~object.__get__` and :meth:`~object.__set__` methods so you " +"can specify a return value when it is fetched." msgstr "" -"一個理應在類別上當成 :class:`property` 或其他 :term:`descriptor` 的 mock。:" -"class:`PropertyMock` 提供了 :meth:`~object.__get__` 和 :meth:`~object." -"__set__` 方法,因此你可以在它被提取時指定回傳值。" +"一個理應在類別上當成 :class:`property` 或其他 :term:`descriptor` 的 " +"mock。:class:`PropertyMock` 提供了 :meth:`~object.__get__` " +"和 :meth:`~object.__set__` 方法,因此你可以在它被提取時指定回傳值。" -#: ../../library/unittest.mock.rst:831 +#: ../../library/unittest.mock.rst:854 msgid "" "Fetching a :class:`PropertyMock` instance from an object calls the mock, " "with no args. Setting it calls the mock with the value being set. ::" @@ -884,7 +946,7 @@ msgstr "" "從物件中提取 :class:`PropertyMock` 實例會不帶任何引數呼叫 mock。設定它則會用" "設定的值來呼叫 mock: ::" -#: ../../library/unittest.mock.rst:834 +#: ../../library/unittest.mock.rst:857 msgid "" ">>> class Foo:\n" "... @property\n" @@ -922,16 +984,16 @@ msgstr "" ">>> mock_foo.mock_calls\n" "[call(), call(6)]" -#: ../../library/unittest.mock.rst:852 +#: ../../library/unittest.mock.rst:875 msgid "" -"Because of the way mock attributes are stored you can't directly attach a :" -"class:`PropertyMock` to a mock object. Instead you can attach it to the mock " -"type object::" +"Because of the way mock attributes are stored you can't directly attach " +"a :class:`PropertyMock` to a mock object. Instead you can attach it to the " +"mock type object::" msgstr "" "由於 mock 屬性的儲存方式,你無法直接將 :class:`PropertyMock` 附加到 mock 物" "件。但是你可以將其附加到 mock 型別的物件: ::" -#: ../../library/unittest.mock.rst:856 +#: ../../library/unittest.mock.rst:879 msgid "" ">>> m = MagicMock()\n" ">>> p = PropertyMock(return_value=3)\n" @@ -947,14 +1009,14 @@ msgstr "" "3\n" ">>> p.assert_called_once_with()" -#: ../../library/unittest.mock.rst:865 +#: ../../library/unittest.mock.rst:888 msgid "" "If an :exc:`AttributeError` is raised by :class:`PropertyMock`, it will be " "interpreted as a missing descriptor and :meth:`~object.__getattr__` will be " "called on the parent mock::" msgstr "" -#: ../../library/unittest.mock.rst:869 +#: ../../library/unittest.mock.rst:892 msgid "" ">>> m = MagicMock()\n" ">>> no_attribute = PropertyMock(side_effect=AttributeError)\n" @@ -968,11 +1030,11 @@ msgstr "" ">>> m.my_property\n" "" -#: ../../library/unittest.mock.rst:875 +#: ../../library/unittest.mock.rst:898 msgid "See :meth:`~object.__getattr__` for details." msgstr "詳情請見 :meth:`~object.__getattr__`。" -#: ../../library/unittest.mock.rst:880 +#: ../../library/unittest.mock.rst:903 msgid "" "An asynchronous version of :class:`MagicMock`. The :class:`AsyncMock` object " "will behave so the object is recognized as an async function, and the result " @@ -981,7 +1043,7 @@ msgstr "" ":class:`MagicMock` 的非同步版本。:class:`AsyncMock` 物件的表現將被視為非同步" "函式,並且呼叫的結果是一個可等待物件。" -#: ../../library/unittest.mock.rst:890 +#: ../../library/unittest.mock.rst:913 msgid "" "The result of ``mock()`` is an async function which will have the outcome of " "``side_effect`` or ``return_value`` after it has been awaited:" @@ -989,19 +1051,19 @@ msgstr "" "``mock()`` 的結果是一個非同步函式,在它被等待後將具有 ``side_effect`` 或 " "``return_value`` 的結果:" -#: ../../library/unittest.mock.rst:893 +#: ../../library/unittest.mock.rst:916 msgid "" "if ``side_effect`` is a function, the async function will return the result " "of that function," msgstr "如果 ``side_effect`` 是一個函式,非同步函式將回傳該函式的結果," -#: ../../library/unittest.mock.rst:895 +#: ../../library/unittest.mock.rst:918 msgid "" "if ``side_effect`` is an exception, the async function will raise the " "exception," msgstr "如果 ``side_effect`` 是一個例外,則非同步函式將引發該例外," -#: ../../library/unittest.mock.rst:897 +#: ../../library/unittest.mock.rst:920 msgid "" "if ``side_effect`` is an iterable, the async function will return the next " "value of the iterable, however, if the sequence of result is exhausted, " @@ -1010,7 +1072,7 @@ msgstr "" "如果 ``side_effect`` 是一個可疊代物件,非同步函式將回傳可疊代物件的下一個值," "但如果結果序列耗盡,將立即引發 ``StopAsyncIteration``," -#: ../../library/unittest.mock.rst:900 +#: ../../library/unittest.mock.rst:923 msgid "" "if ``side_effect`` is not defined, the async function will return the value " "defined by ``return_value``, hence, by default, the async function returns a " @@ -1019,7 +1081,7 @@ msgstr "" "如果 ``side_effect`` 沒有被定義,非同步函式將回傳由 ``return_value`` 定義的" "值,因此在預設情況下,非同步函式回傳一個新的 :class:`AsyncMock` 物件。" -#: ../../library/unittest.mock.rst:905 +#: ../../library/unittest.mock.rst:928 msgid "" "Setting the *spec* of a :class:`Mock` or :class:`MagicMock` to an async " "function will result in a coroutine object being returned after calling." @@ -1027,22 +1089,22 @@ msgstr "" "將 :class:`Mock` 或 :class:`MagicMock` 的 *spec* 設定為非同步函式將導致在呼叫" "後回傳一個協程物件。" -#: ../../library/unittest.mock.rst:917 +#: ../../library/unittest.mock.rst:940 msgid "" -"Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, or :class:" -"`AsyncMock` to a class with asynchronous and synchronous functions will " -"automatically detect the synchronous functions and set them as :class:" -"`MagicMock` (if the parent mock is :class:`AsyncMock` or :class:`MagicMock`) " -"or :class:`Mock` (if the parent mock is :class:`Mock`). All asynchronous " -"functions will be :class:`AsyncMock`." +"Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, " +"or :class:`AsyncMock` to a class with asynchronous and synchronous functions " +"will automatically detect the synchronous functions and set them " +"as :class:`MagicMock` (if the parent mock is :class:`AsyncMock` " +"or :class:`MagicMock`) or :class:`Mock` (if the parent mock " +"is :class:`Mock`). All asynchronous functions will be :class:`AsyncMock`." msgstr "" "將 :class:`Mock`、:class:`MagicMock` 或 :class:`AsyncMock` 的 *spec* 設定為具" -"有同步和非同步函式的類別,會自動檢測同步函式並將其設定為 :class:" -"`MagicMock`\\ (如果上代 mock 為 :class:`AsyncMock` 或 :class:" -"`MagicMock`\\ )或 :class:`Mock`\\ (如果上代 mock 為 :class:`Mock`\\ )。所" -"有非同步函式將被設定為 :class:`AsyncMock`。" +"有同步和非同步函式的類別,會自動檢測同步函式並將其設定" +"為 :class:`MagicMock`\\ (如果上代 mock 為 :class:`AsyncMock` " +"或 :class:`MagicMock`\\ )或 :class:`Mock`\\ (如果上代 mock " +"為 :class:`Mock`\\ )。所有非同步函式將被設定為 :class:`AsyncMock`。" -#: ../../library/unittest.mock.rst:945 +#: ../../library/unittest.mock.rst:968 msgid "" "Assert that the mock was awaited at least once. Note that this is separate " "from the object having been called, the ``await`` keyword must be used:" @@ -1050,33 +1112,33 @@ msgstr "" "斷言 mock 至少被等待過一次。請注意這與物件是否被呼叫是分開的,``await`` 關鍵" "字必須被使用:" -#: ../../library/unittest.mock.rst:964 +#: ../../library/unittest.mock.rst:987 msgid "Assert that the mock was awaited exactly once." msgstr "斷言 mock 正好被等待了一次。" -#: ../../library/unittest.mock.rst:980 +#: ../../library/unittest.mock.rst:1003 msgid "Assert that the last await was with the specified arguments." msgstr "斷言最後一次等待使用了指定的引數。" -#: ../../library/unittest.mock.rst:997 +#: ../../library/unittest.mock.rst:1020 msgid "" "Assert that the mock was awaited exactly once and with the specified " "arguments." msgstr "斷言 mock 只被等待了一次並使用了指定的引數。" -#: ../../library/unittest.mock.rst:1014 +#: ../../library/unittest.mock.rst:1037 msgid "Assert the mock has ever been awaited with the specified arguments." msgstr "斷言 mock 曾經被使用指定的引數等待過。" -#: ../../library/unittest.mock.rst:1030 +#: ../../library/unittest.mock.rst:1053 msgid "" -"Assert the mock has been awaited with the specified calls. The :attr:" -"`await_args_list` list is checked for the awaits." +"Assert the mock has been awaited with the specified calls. " +"The :attr:`await_args_list` list is checked for the awaits." msgstr "" "斷言 mock 已被使用指定的呼叫進行等待。:attr:`await_args_list` 串列將被檢查以" "確認等待的內容。" -#: ../../library/unittest.mock.rst:1033 +#: ../../library/unittest.mock.rst:1056 msgid "" "If *any_order* is false then the awaits must be sequential. There can be " "extra calls before or after the specified awaits." @@ -1084,41 +1146,41 @@ msgstr "" "如果 *any_order* 為 false,則等待必須按照順序。指定的等待之前或之後可以有額外" "的呼叫。" -#: ../../library/unittest.mock.rst:1037 +#: ../../library/unittest.mock.rst:1060 msgid "" "If *any_order* is true then the awaits can be in any order, but they must " "all appear in :attr:`await_args_list`." msgstr "" -"如果 *any_order* 為 true,則等待可以以任何順序出現,但它們必須全部出現在 :" -"attr:`await_args_list` 中。" +"如果 *any_order* 為 true,則等待可以以任何順序出現,但它們必須全部出現" +"在 :attr:`await_args_list` 中。" -#: ../../library/unittest.mock.rst:1057 +#: ../../library/unittest.mock.rst:1080 msgid "Assert that the mock was never awaited." msgstr "斷言 mock 從未被等待。" -#: ../../library/unittest.mock.rst:1064 +#: ../../library/unittest.mock.rst:1087 msgid "" -"See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to 0, :attr:" -"`await_args` to None, and clears the :attr:`await_args_list`." +"See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to " +"0, :attr:`await_args` to None, and clears the :attr:`await_args_list`." msgstr "" -"參見 :func:`Mock.reset_mock`。同時將 :attr:`await_count` 設定為 0,:attr:" -"`await_args` 設定為 None,並清除 :attr:`await_args_list`。" +"參見 :func:`Mock.reset_mock`。同時將 :attr:`await_count` 設定為 " +"0,:attr:`await_args` 設定為 None,並清除 :attr:`await_args_list`。" -#: ../../library/unittest.mock.rst:1069 +#: ../../library/unittest.mock.rst:1092 msgid "" "An integer keeping track of how many times the mock object has been awaited." msgstr "一個整數,用來記錄 mock 物件已被等待的次數。" -#: ../../library/unittest.mock.rst:1084 +#: ../../library/unittest.mock.rst:1107 msgid "" "This is either ``None`` (if the mock hasn’t been awaited), or the arguments " -"that the mock was last awaited with. Functions the same as :attr:`Mock." -"call_args`." +"that the mock was last awaited with. Functions the same " +"as :attr:`Mock.call_args`." msgstr "" "這可能是 ``None``\\ (如果 mock 尚未被等待),或者是上次等待 mock 時使用的引" "數。與 :attr:`Mock.call_args` 的功能相同。" -#: ../../library/unittest.mock.rst:1102 +#: ../../library/unittest.mock.rst:1125 msgid "" "This is a list of all the awaits made to the mock object in sequence (so the " "length of the list is the number of times it has been awaited). Before any " @@ -1127,78 +1189,78 @@ msgstr "" "這是一個按照順序記錄 mock 物件所有等待的串列(因此串列的長度表示該物件已被等" "待的次數)。在進行任何等待之前,此串列為空。" -#: ../../library/unittest.mock.rst:1122 +#: ../../library/unittest.mock.rst:1145 msgid "" -"A version of :class:`MagicMock` for multithreading tests. The :class:" -"`ThreadingMock` object provides extra methods to wait for a call to be " -"invoked, rather than assert on it immediately." +"A version of :class:`MagicMock` for multithreading tests. " +"The :class:`ThreadingMock` object provides extra methods to wait for a call " +"to be invoked, rather than assert on it immediately." msgstr "" -#: ../../library/unittest.mock.rst:1126 +#: ../../library/unittest.mock.rst:1149 msgid "" "The default timeout is specified by the ``timeout`` argument, or if unset by " "the :attr:`ThreadingMock.DEFAULT_TIMEOUT` attribute, which defaults to " "blocking (``None``)." msgstr "" -#: ../../library/unittest.mock.rst:1129 +#: ../../library/unittest.mock.rst:1152 msgid "" -"You can configure the global default timeout by setting :attr:`ThreadingMock." -"DEFAULT_TIMEOUT`." +"You can configure the global default timeout by " +"setting :attr:`ThreadingMock.DEFAULT_TIMEOUT`." msgstr "" -#: ../../library/unittest.mock.rst:1133 +#: ../../library/unittest.mock.rst:1156 msgid "Waits until the mock is called." msgstr "等待直到 mock 被呼叫。" -#: ../../library/unittest.mock.rst:1135 +#: ../../library/unittest.mock.rst:1158 msgid "" "If a timeout was passed at the creation of the mock or if a timeout argument " "is passed to this function, the function raises an :exc:`AssertionError` if " "the call is not performed in time." msgstr "" -#: ../../library/unittest.mock.rst:1147 +#: ../../library/unittest.mock.rst:1170 msgid "Waits until the mock is called with the specified arguments." msgstr "等到直到 mock 被以特定引數呼叫。" -#: ../../library/unittest.mock.rst:1149 +#: ../../library/unittest.mock.rst:1172 msgid "" -"If a timeout was passed at the creation of the mock the function raises an :" -"exc:`AssertionError` if the call is not performed in time." +"If a timeout was passed at the creation of the mock the function raises " +"an :exc:`AssertionError` if the call is not performed in time." msgstr "" -#: ../../library/unittest.mock.rst:1160 +#: ../../library/unittest.mock.rst:1183 msgid "" -"Global default timeout in seconds to create instances of :class:" -"`ThreadingMock`." +"Global default timeout in seconds to create instances " +"of :class:`ThreadingMock`." msgstr "" -#: ../../library/unittest.mock.rst:1166 +#: ../../library/unittest.mock.rst:1189 msgid "Calling" msgstr "呼叫" -#: ../../library/unittest.mock.rst:1168 +#: ../../library/unittest.mock.rst:1191 msgid "" -"Mock objects are callable. The call will return the value set as the :attr:" -"`~Mock.return_value` attribute. The default return value is a new Mock " -"object; it is created the first time the return value is accessed (either " -"explicitly or by calling the Mock) - but it is stored and the same one " -"returned each time." +"Mock objects are callable. The call will return the value set as " +"the :attr:`~Mock.return_value` attribute. The default return value is a new " +"Mock object; it is created the first time the return value is accessed " +"(either explicitly or by calling the Mock) - but it is stored and the same " +"one returned each time." msgstr "" "Mock 物件可被呼叫。呼叫將回傳設定為 :attr:`~Mock.return_value` 屬性的值。預設" "的回傳值是一個新的 Mock 物件;它會在第一次存取回傳值時(無論是顯式存取還是透" "過呼叫 Mock)被建立,但是這個回傳值會被儲存,之後每次都回傳同一個值。" -#: ../../library/unittest.mock.rst:1174 +#: ../../library/unittest.mock.rst:1197 msgid "" -"Calls made to the object will be recorded in the attributes like :attr:" -"`~Mock.call_args` and :attr:`~Mock.call_args_list`." +"Calls made to the object will be recorded in the attributes " +"like :attr:`~Mock.call_args` and :attr:`~Mock.call_args_list`." msgstr "" -"對物件的呼叫會被記錄在如 :attr:`~Mock.call_args` 和 :attr:`~Mock." -"call_args_list` 等屬性中。" +"對物件的呼叫會被記錄在如 :attr:`~Mock.call_args` " +"和 :attr:`~Mock.call_args_list` 等屬性中。" -#: ../../library/unittest.mock.rst:1177 +#: ../../library/unittest.mock.rst:1200 msgid "" "If :attr:`~Mock.side_effect` is set then it will be called after the call " "has been recorded, so if :attr:`!side_effect` raises an exception the call " @@ -1207,15 +1269,15 @@ msgstr "" "如果 :attr:`~Mock.side_effect` 被設定,那麼在呼叫被記錄後它才會被呼叫,所以如" "果 :attr:`!side_effect` 引發例外,呼叫仍然會被記錄。" -#: ../../library/unittest.mock.rst:1181 +#: ../../library/unittest.mock.rst:1204 msgid "" -"The simplest way to make a mock raise an exception when called is to make :" -"attr:`~Mock.side_effect` an exception class or instance:" +"The simplest way to make a mock raise an exception when called is to " +"make :attr:`~Mock.side_effect` an exception class or instance:" msgstr "" "呼叫 mock 時引發例外的最簡單方式是將 :attr:`~Mock.side_effect` 設定為例外類別" "或實例:" -#: ../../library/unittest.mock.rst:1199 +#: ../../library/unittest.mock.rst:1222 msgid "" "If :attr:`~Mock.side_effect` is a function then whatever that function " "returns is what calls to the mock return. The :attr:`!side_effect` function " @@ -1226,7 +1288,7 @@ msgstr "" "叫所回傳的值。:attr:`!side_effect` 函式會使用與 mock 相同的引數被呼叫。這讓你" "可以根據輸入動態地變更呼叫的回傳值:" -#: ../../library/unittest.mock.rst:1215 +#: ../../library/unittest.mock.rst:1238 msgid "" "If you want the mock to still return the default return value (a new mock), " "or any set return value, then there are two ways of doing this. Either " @@ -1234,10 +1296,10 @@ msgid "" "return :data:`DEFAULT`:" msgstr "" "如果你希望 mock 仍然回傳預設的回傳值(一個新的 mock),或者是任何已設定的回傳" -"值,有兩種方法可以實現。從 :attr:`~Mock.side_effect` 內部回傳 :attr:`~Mock." -"return_value`,或回傳 :data:`DEFAULT`:" +"值,有兩種方法可以實現。從 :attr:`~Mock.side_effect` 內部回" +"傳 :attr:`~Mock.return_value`,或回傳 :data:`DEFAULT`:" -#: ../../library/unittest.mock.rst:1234 +#: ../../library/unittest.mock.rst:1257 msgid "" "To remove a :attr:`~Mock.side_effect`, and return to the default behaviour, " "set the :attr:`!side_effect` to ``None``:" @@ -1245,7 +1307,7 @@ msgstr "" "要刪除 :attr:`~Mock.side_effect`,並恢復預設行為,將 :attr:`!side_effect` 設" "為 ``None``:" -#: ../../library/unittest.mock.rst:1248 +#: ../../library/unittest.mock.rst:1271 msgid "" "The :attr:`~Mock.side_effect` can also be any iterable object. Repeated " "calls to the mock will return values from the iterable (until the iterable " @@ -1254,13 +1316,13 @@ msgstr "" ":attr:`~Mock.side_effect` 也可以是任何可疊代的物件。對 mock 的重複呼叫將從可" "疊代物件中回傳值(直到疊代物件耗盡並引發 :exc:`StopIteration` 為止):" -#: ../../library/unittest.mock.rst:1264 +#: ../../library/unittest.mock.rst:1287 msgid "" "If any members of the iterable are exceptions they will be raised instead of " "returned::" msgstr "如果可疊代物件中的任何成員是例外,則它們將被引發而不是被回傳: ::" -#: ../../library/unittest.mock.rst:1267 +#: ../../library/unittest.mock.rst:1290 msgid "" ">>> iterable = (33, ValueError, 66)\n" ">>> m = MagicMock(side_effect=iterable)\n" @@ -1284,17 +1346,17 @@ msgstr "" ">>> m()\n" "66" -#: ../../library/unittest.mock.rst:1282 +#: ../../library/unittest.mock.rst:1305 msgid "Deleting Attributes" msgstr "刪除屬性" -#: ../../library/unittest.mock.rst:1284 +#: ../../library/unittest.mock.rst:1307 msgid "" "Mock objects create attributes on demand. This allows them to pretend to be " "objects of any type." msgstr "Mock 物件會在需要時建立屬性。這使得它們可以假裝成任何種類的物件。" -#: ../../library/unittest.mock.rst:1287 +#: ../../library/unittest.mock.rst:1310 msgid "" "You may want a mock object to return ``False`` to a :func:`hasattr` call, or " "raise an :exc:`AttributeError` when an attribute is fetched. You can do this " @@ -1305,30 +1367,30 @@ msgstr "" "提取時引發 :exc:`AttributeError`。你可以通過將物件提供為 mock 的 :attr:`!" "spec` 來實現這一點,但這並不總是那麼好用。" -#: ../../library/unittest.mock.rst:1291 +#: ../../library/unittest.mock.rst:1314 msgid "" "You \"block\" attributes by deleting them. Once deleted, accessing an " "attribute will raise an :exc:`AttributeError`." msgstr "" -"你可以通過刪除屬性來「阻擋」它們。一旦刪除,再次存取該屬性將會引發 :exc:" -"`AttributeError`。" +"你可以通過刪除屬性來「阻擋」它們。一旦刪除,再次存取該屬性將會引" +"發 :exc:`AttributeError`。" -#: ../../library/unittest.mock.rst:1308 +#: ../../library/unittest.mock.rst:1331 msgid "Mock names and the name attribute" msgstr "Mock 名稱與名稱屬性" -#: ../../library/unittest.mock.rst:1310 +#: ../../library/unittest.mock.rst:1333 msgid "" "Since \"name\" is an argument to the :class:`Mock` constructor, if you want " "your mock object to have a \"name\" attribute you can't just pass it in at " -"creation time. There are two alternatives. One option is to use :meth:`~Mock." -"configure_mock`::" +"creation time. There are two alternatives. One option is to " +"use :meth:`~Mock.configure_mock`::" msgstr "" "由於 \"name\" 是傳遞給 :class:`Mock` 建構函式的引數,如果你想讓你的 mock 物件" "擁有 \"name\" 屬性,你不能在建立時直接傳遞它。有兩種替代方法。其中一個選擇是" "使用 :meth:`~Mock.configure_mock`: ::" -#: ../../library/unittest.mock.rst:1315 +#: ../../library/unittest.mock.rst:1338 msgid "" ">>> mock = MagicMock()\n" ">>> mock.configure_mock(name='my_name')\n" @@ -1340,13 +1402,13 @@ msgstr "" ">>> mock.name\n" "'my_name'" -#: ../../library/unittest.mock.rst:1320 +#: ../../library/unittest.mock.rst:1343 msgid "" "A simpler option is to simply set the \"name\" attribute after mock " "creation::" msgstr "更簡單的方法是在 mock 建立後直接設定 \"name\" 屬性: ::" -#: ../../library/unittest.mock.rst:1322 +#: ../../library/unittest.mock.rst:1345 msgid "" ">>> mock = MagicMock()\n" ">>> mock.name = \"foo\"" @@ -1354,11 +1416,11 @@ msgstr "" ">>> mock = MagicMock()\n" ">>> mock.name = \"foo\"" -#: ../../library/unittest.mock.rst:1327 +#: ../../library/unittest.mock.rst:1350 msgid "Attaching Mocks as Attributes" msgstr "如同屬性一般附加 mock" -#: ../../library/unittest.mock.rst:1329 +#: ../../library/unittest.mock.rst:1352 msgid "" "When you attach a mock as an attribute of another mock (or as the return " "value) it becomes a \"child\" of that mock. Calls to the child are recorded " @@ -1374,7 +1436,7 @@ msgstr "" "mock 附加到記錄所有對子代的呼叫的上代並允許你對 mock 間的呼叫順序進行斷言非常" "有用:" -#: ../../library/unittest.mock.rst:1347 +#: ../../library/unittest.mock.rst:1370 msgid "" "The exception to this is if the mock has a name. This allows you to prevent " "the \"parenting\" if for some reason you don't want it to happen." @@ -1382,16 +1444,16 @@ msgstr "" "如果 mock 有 name 引數,則上述規則會有例外。這使你可以防止「親屬關係 " "(parenting)」的建立,假設因為某些原因你不希望這種狀況發生。" -#: ../../library/unittest.mock.rst:1358 +#: ../../library/unittest.mock.rst:1381 msgid "" "Mocks created for you by :func:`patch` are automatically given names. To " -"attach mocks that have names to a parent you use the :meth:`~Mock." -"attach_mock` method::" +"attach mocks that have names to a parent you use " +"the :meth:`~Mock.attach_mock` method::" msgstr "" "由 :func:`patch` 為你建立的 mock 會自動被賦予名稱。若要將具有名稱的 mock 附加" "到上代,你可以使用 :meth:`~Mock.attach_mock` 方法: ::" -#: ../../library/unittest.mock.rst:1362 +#: ../../library/unittest.mock.rst:1385 msgid "" ">>> thing1 = object()\n" ">>> thing2 = object()\n" @@ -1419,7 +1481,7 @@ msgstr "" ">>> parent.mock_calls\n" "[call.child1('one'), call.child2('two')]" -#: ../../library/unittest.mock.rst:1376 +#: ../../library/unittest.mock.rst:1399 msgid "" "The only exceptions are magic methods and attributes (those that have " "leading and trailing double underscores). Mock doesn't create these but " @@ -1428,16 +1490,16 @@ msgid "" "a new Mock object when it expects a magic method. If you need magic method " "support see :ref:`magic methods `." msgstr "" -"唯一的例外是魔術方法和屬性(具有前後雙底線)。Mock 不會建立這些,而是會引發 :" -"exc:`AttributeError`。這是因為直譯器通常會隱式地要求這些方法,在期望得到一個" -"魔術方法卻獲得一個新的 Mock 物件時,會讓直譯器\\ *非常*\\ 困惑。如果你需要魔" -"術方法的支援,請參閱\\ :ref:`魔術方法 `。" +"唯一的例外是魔術方法和屬性(具有前後雙底線)。Mock 不會建立這些,而是會引" +"發 :exc:`AttributeError`。這是因為直譯器通常會隱式地要求這些方法,在期望得到" +"一個魔術方法卻獲得一個新的 Mock 物件時,會讓直譯器\\ *非常*\\ 困惑。如果你需" +"要魔術方法的支援,請參閱\\ :ref:`魔術方法 `。" -#: ../../library/unittest.mock.rst:1385 +#: ../../library/unittest.mock.rst:1408 msgid "The patchers" msgstr "Patchers" -#: ../../library/unittest.mock.rst:1387 +#: ../../library/unittest.mock.rst:1410 msgid "" "The patch decorators are used for patching objects only within the scope of " "the function they decorate. They automatically handle the unpatching for " @@ -1448,17 +1510,17 @@ msgstr "" "patch 的中止,即使有異常被引發也是如此。所有這些函式也可以在 with 陳述式中使" "用,或者作為類別裝飾器使用。" -#: ../../library/unittest.mock.rst:1394 +#: ../../library/unittest.mock.rst:1417 msgid "patch" msgstr "patch" -#: ../../library/unittest.mock.rst:1398 +#: ../../library/unittest.mock.rst:1421 msgid "" "The key is to do the patching in the right namespace. See the section `where " "to patch`_." msgstr "關鍵是要在正確的命名空間進行 patch。請參閱 `where to patch`_ 一節。" -#: ../../library/unittest.mock.rst:1402 +#: ../../library/unittest.mock.rst:1425 msgid "" ":func:`patch` acts as a function decorator, class decorator or a context " "manager. Inside the body of the function or with statement, the *target* is " @@ -1469,7 +1531,7 @@ msgstr "" "內部,*目標*\\ 會被 patch 成一個\\ *新的*\\ 物件。當函式或 with 陳述式結束" "時,patch 就會被解除。" -#: ../../library/unittest.mock.rst:1407 +#: ../../library/unittest.mock.rst:1430 msgid "" "If *new* is omitted, then the target is replaced with an :class:`AsyncMock` " "if the patched object is an async function or a :class:`MagicMock` " @@ -1478,12 +1540,13 @@ msgid "" "If :func:`patch` is used as a context manager the created mock is returned " "by the context manager." msgstr "" -"如果 *new* 被省略,則如果被 patch 的物件是非同步函式,目標會被替換為 :class:" -"`AsyncMock`,反之則替換為 :class:`MagicMock`。如果 :func:`patch` 做為裝飾器使" -"用且省略了 *new*,則所建立的 mock 會作為額外的引數傳遞給被裝飾的函式。如果 :" -"func:`patch` 作為情境管理器使用,則所建立的 mock 將由情境管理器回傳。" +"如果 *new* 被省略,則如果被 patch 的物件是非同步函式,目標會被替換" +"為 :class:`AsyncMock`,反之則替換為 :class:`MagicMock`。如果 :func:`patch` 做" +"為裝飾器使用且省略了 *new*,則所建立的 mock 會作為額外的引數傳遞給被裝飾的函" +"式。如果 :func:`patch` 作為情境管理器使用,則所建立的 mock 將由情境管理器回" +"傳。" -#: ../../library/unittest.mock.rst:1415 +#: ../../library/unittest.mock.rst:1438 msgid "" "*target* should be a string in the form ``'package.module.ClassName'``. The " "*target* is imported and the specified object replaced with the *new* " @@ -1492,19 +1555,19 @@ msgid "" "function is executed, not at decoration time." msgstr "" "*target* 應該是以 ``'package.module.ClassName'`` 形式出現的字串。*target* 會" -"被引入並用 *new* 物件替換指定的物件,因此 *target* 必須可從你呼叫 :func:" -"`patch` 的環境中引入。target 在執行被裝飾的函式時被引入,而不是在裝飾器作用" -"時 (decoration time)。" +"被引入並用 *new* 物件替換指定的物件,因此 *target* 必須可從你呼" +"叫 :func:`patch` 的環境中引入。target 在執行被裝飾的函式時被引入,而不是在裝" +"飾器作用時 (decoration time)。" -#: ../../library/unittest.mock.rst:1421 +#: ../../library/unittest.mock.rst:1444 msgid "" -"The *spec* and *spec_set* keyword arguments are passed to the :class:" -"`MagicMock` if patch is creating one for you." +"The *spec* and *spec_set* keyword arguments are passed to " +"the :class:`MagicMock` if patch is creating one for you." msgstr "" "*spec* 和 *spec_set* 關鍵字引數會傳遞給 :class:`MagicMock`,如果 patch 正在為" "你建立一個。" -#: ../../library/unittest.mock.rst:1424 +#: ../../library/unittest.mock.rst:1447 msgid "" "In addition you can pass ``spec=True`` or ``spec_set=True``, which causes " "patch to pass in the object being mocked as the spec/spec_set object." @@ -1512,17 +1575,18 @@ msgstr "" "此外,你還可以傳遞 ``spec=True`` 或 ``spec_set=True``,這將導致 patch 將被 " "mock 的物件作為 spec/spec_set 物件傳遞。" -#: ../../library/unittest.mock.rst:1427 +#: ../../library/unittest.mock.rst:1450 msgid "" "*new_callable* allows you to specify a different class, or callable object, " -"that will be called to create the *new* object. By default :class:" -"`AsyncMock` is used for async functions and :class:`MagicMock` for the rest." +"that will be called to create the *new* object. By " +"default :class:`AsyncMock` is used for async functions " +"and :class:`MagicMock` for the rest." msgstr "" "*new_callable* 允許你指定一個不同的類別或可呼叫的物件,用於被呼叫並建立 " "*new* 物件。預設情況下,對於非同步函式使用 :class:`AsyncMock`,而對於其他情況" "則使用 :class:`MagicMock`。" -#: ../../library/unittest.mock.rst:1431 +#: ../../library/unittest.mock.rst:1454 msgid "" "A more powerful form of *spec* is *autospec*. If you set ``autospec=True`` " "then the mock will be created with a spec from the object being replaced. " @@ -1530,17 +1594,17 @@ msgid "" "attribute of the object being replaced. Methods and functions being mocked " "will have their arguments checked and will raise a :exc:`TypeError` if they " "are called with the wrong signature. For mocks replacing a class, their " -"return value (the 'instance') will have the same spec as the class. See the :" -"func:`create_autospec` function and :ref:`auto-speccing`." +"return value (the 'instance') will have the same spec as the class. See " +"the :func:`create_autospec` function and :ref:`auto-speccing`." msgstr "" "*spec* 的一種更強大的形式是 *autospec*。如果你設定 ``autospec=True``,則該 " "mock 將使用被替換物件的規格來建立。該 mock 的所有屬性也將具有被替換物件的對應" "屬性的規格。被 mock 的方法和函式將檢查其引數,如果呼叫時引數與規格不符(被使" "用錯誤的簽名 (signature) 呼叫),將引發 :exc:`TypeError`。對於替換類別的 " -"mock,它們的回傳值(即 'instance')將具有與類別相同的規格。請參閱 :func:" -"`create_autospec` 函式和 :ref:`auto-speccing`。" +"mock,它們的回傳值(即 'instance')將具有與類別相同的規格。請參" +"閱 :func:`create_autospec` 函式和 :ref:`auto-speccing`。" -#: ../../library/unittest.mock.rst:1441 +#: ../../library/unittest.mock.rst:1464 msgid "" "Instead of ``autospec=True`` you can pass ``autospec=some_object`` to use an " "arbitrary object as the spec instead of the one being replaced." @@ -1548,7 +1612,7 @@ msgstr "" "你可以用 ``autospec=some_object`` 替代 ``autospec=True``,以使用任意物件作為" "規格,而不是被替換的物件。" -#: ../../library/unittest.mock.rst:1444 +#: ../../library/unittest.mock.rst:1467 msgid "" "By default :func:`patch` will fail to replace attributes that don't exist. " "If you pass in ``create=True``, and the attribute doesn't exist, patch will " @@ -1564,7 +1628,7 @@ msgstr "" "行環境建立的屬性的測試時非常有用。此功能預設為關閉,因為這可能會相當危險。開" "啟這個功能後,你可以對於實際上不存在的 API 撰寫會通過的測試!" -#: ../../library/unittest.mock.rst:1454 +#: ../../library/unittest.mock.rst:1477 msgid "" "If you are patching builtins in a module then you don't need to pass " "``create=True``, it will be added by default." @@ -1572,15 +1636,15 @@ msgstr "" "如果你正在 patch 模組中的內建函式,那麼你不需要傳遞 ``create=True``,它預設會" "被加入。" -#: ../../library/unittest.mock.rst:1458 +#: ../../library/unittest.mock.rst:1481 msgid "" "Patch can be used as a :class:`~unittest.TestCase` class decorator. It works " "by decorating each test method in the class. This reduces the boilerplate " "code when your test methods share a common patchings set. :func:`patch` " -"finds tests by looking for method names that start with ``patch." -"TEST_PREFIX``. By default this is ``'test'``, which matches the way :mod:" -"`unittest` finds tests. You can specify an alternative prefix by setting " -"``patch.TEST_PREFIX``." +"finds tests by looking for method names that start with " +"``patch.TEST_PREFIX``. By default this is ``'test'``, which matches the " +"way :mod:`unittest` finds tests. You can specify an alternative prefix by " +"setting ``patch.TEST_PREFIX``." msgstr "" "patch 可以做為 :class:`~unittest.TestCase` 類別的裝飾器使用。它透過裝飾類別中" "的每個測試方法來運作。當你的測試方法共享一組常見的 patch 時,這會減少繁冗的代" @@ -1588,7 +1652,7 @@ msgstr "" "設情況下會是 ``'test'``,這與 :mod:`unittest` 尋找測試的方式相匹配。你可以通" "過設定 ``patch.TEST_PREFIX`` 來指定別的前綴。" -#: ../../library/unittest.mock.rst:1465 +#: ../../library/unittest.mock.rst:1488 msgid "" "Patch can be used as a context manager, with the with statement. Here the " "patching applies to the indented block after the with statement. If you use " @@ -1599,17 +1663,17 @@ msgstr "" "的縮排區塊。如果你使用 \"as\",則被 patch 的物件將被綁定到 \"as\" 後面的名" "稱;如果 :func:`patch` 正在為你建立一個 mock 物件,這會非常有用。" -#: ../../library/unittest.mock.rst:1470 +#: ../../library/unittest.mock.rst:1493 msgid "" -":func:`patch` takes arbitrary keyword arguments. These will be passed to :" -"class:`AsyncMock` if the patched object is asynchronous, to :class:" -"`MagicMock` otherwise or to *new_callable* if specified." +":func:`patch` takes arbitrary keyword arguments. These will be passed " +"to :class:`AsyncMock` if the patched object is asynchronous, " +"to :class:`MagicMock` otherwise or to *new_callable* if specified." msgstr "" ":func:`patch` 接受任意的關鍵字引數。如果被 patch 的物件是非同步的,這些將會被" "傳遞給 :class:`AsyncMock`,如果是同步的則會傳遞給 :class:`MagicMock`,或如果" "指定了 *new_callable*,則傳遞給它。" -#: ../../library/unittest.mock.rst:1474 +#: ../../library/unittest.mock.rst:1497 msgid "" "``patch.dict(...)``, ``patch.multiple(...)`` and ``patch.object(...)`` are " "available for alternate use-cases." @@ -1617,14 +1681,14 @@ msgstr "" "``patch.dict(...)``、``patch.multiple(...)`` 和 ``patch.object(...)`` 可用於" "其餘的使用情境。" -#: ../../library/unittest.mock.rst:1477 +#: ../../library/unittest.mock.rst:1500 msgid "" ":func:`patch` as function decorator, creating the mock for you and passing " "it into the decorated function::" msgstr "" ":func:`patch` 作為函式裝飾器,為你建立 mock 並將其傳遞給被裝飾的函式: ::" -#: ../../library/unittest.mock.rst:1480 +#: ../../library/unittest.mock.rst:1503 msgid "" ">>> @patch('__main__.SomeClass')\n" "... def function(normal_argument, mock_class):\n" @@ -1640,34 +1704,34 @@ msgstr "" ">>> function(None)\n" "True" -#: ../../library/unittest.mock.rst:1487 +#: ../../library/unittest.mock.rst:1510 msgid "" "Patching a class replaces the class with a :class:`MagicMock` *instance*. If " -"the class is instantiated in the code under test then it will be the :attr:" -"`~Mock.return_value` of the mock that will be used." +"the class is instantiated in the code under test then it will be " +"the :attr:`~Mock.return_value` of the mock that will be used." msgstr "" "Patch 一個類別會以 :class:`MagicMock`\\ *實例*\\ 取代該類別。如果該類別在被" -"測試的程式碼中實例化,那麼它將是會被使用的 mock 的 :attr:`~Mock." -"return_value`。" +"測試的程式碼中實例化,那麼它將是會被使用的 mock " +"的 :attr:`~Mock.return_value`。" -#: ../../library/unittest.mock.rst:1491 +#: ../../library/unittest.mock.rst:1514 msgid "" -"If the class is instantiated multiple times you could use :attr:`~Mock." -"side_effect` to return a new mock each time. Alternatively you can set the " -"*return_value* to be anything you want." +"If the class is instantiated multiple times you could " +"use :attr:`~Mock.side_effect` to return a new mock each time. Alternatively " +"you can set the *return_value* to be anything you want." msgstr "" "如果該類別被實例化多次,你可以使用 :attr:`~Mock.side_effect` 來每次回傳一個新" "的 mock。 或者你可以將 *return_value* 設定成你想要的任何值。" -#: ../../library/unittest.mock.rst:1495 +#: ../../library/unittest.mock.rst:1518 msgid "" "To configure return values on methods of *instances* on the patched class " "you must do this on the :attr:`~Mock.return_value`. For example::" msgstr "" -"若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須在 :attr:`~Mock." -"return_value` 上進行配置。例如: ::" +"若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須" +"在 :attr:`~Mock.return_value` 上進行配置。例如: ::" -#: ../../library/unittest.mock.rst:1498 +#: ../../library/unittest.mock.rst:1521 msgid "" ">>> class Class:\n" "... def method(self):\n" @@ -1691,7 +1755,7 @@ msgstr "" "... assert Class().method() == 'foo'\n" "..." -#: ../../library/unittest.mock.rst:1509 +#: ../../library/unittest.mock.rst:1532 msgid "" "If you use *spec* or *spec_set* and :func:`patch` is replacing a *class*, " "then the return value of the created mock will have the same spec. ::" @@ -1699,7 +1763,7 @@ msgstr "" "如果你使用 *spec* 或 *spec_set* 且 :func:`patch` 正在取代一個\\ *類別*,那麼" "被建立的 mock 的回傳值將具有相同的規格。: ::" -#: ../../library/unittest.mock.rst:1512 +#: ../../library/unittest.mock.rst:1535 msgid "" ">>> Original = Class\n" ">>> patcher = patch('__main__.Class', spec=True)\n" @@ -1715,7 +1779,7 @@ msgstr "" ">>> assert isinstance(instance, Original)\n" ">>> patcher.stop()" -#: ../../library/unittest.mock.rst:1519 +#: ../../library/unittest.mock.rst:1542 msgid "" "The *new_callable* argument is useful where you want to use an alternative " "class to the default :class:`MagicMock` for the created mock. For example, " @@ -1725,7 +1789,7 @@ msgstr "" "*new_callable* 引數非常有用。例如,如果你想要一個 :class:`NonCallableMock` 被" "使用: ::" -#: ../../library/unittest.mock.rst:1523 +#: ../../library/unittest.mock.rst:1546 msgid "" ">>> thing = object()\n" ">>> with patch('__main__.thing', new_callable=NonCallableMock) as " @@ -1747,13 +1811,13 @@ msgstr "" " ...\n" "TypeError: 'NonCallableMock' object is not callable" -#: ../../library/unittest.mock.rst:1532 +#: ../../library/unittest.mock.rst:1555 msgid "" "Another use case might be to replace an object with an :class:`io.StringIO` " "instance::" msgstr "另一個用法是用一個 :class:`io.StringIO` 實例替換一個物件: ::" -#: ../../library/unittest.mock.rst:1534 +#: ../../library/unittest.mock.rst:1557 msgid "" ">>> from io import StringIO\n" ">>> def foo():\n" @@ -1777,7 +1841,7 @@ msgstr "" "...\n" ">>> test()" -#: ../../library/unittest.mock.rst:1545 +#: ../../library/unittest.mock.rst:1568 msgid "" "When :func:`patch` is creating a mock for you, it is common that the first " "thing you need to do is to configure the mock. Some of that configuration " @@ -1788,7 +1852,7 @@ msgstr "" "一些配置可以在對 patch 的呼叫中完成。你傳遞到呼叫中的任何關鍵字都將用於在被建" "立的 mock 上設定屬性: ::" -#: ../../library/unittest.mock.rst:1550 +#: ../../library/unittest.mock.rst:1573 msgid "" ">>> patcher = patch('__main__.thing', first='one', second='two')\n" ">>> mock_thing = patcher.start()\n" @@ -1804,20 +1868,20 @@ msgstr "" ">>> mock_thing.second\n" "'two'" -#: ../../library/unittest.mock.rst:1557 +#: ../../library/unittest.mock.rst:1580 msgid "" -"As well as attributes on the created mock attributes, like the :attr:`~Mock." -"return_value` and :attr:`~Mock.side_effect`, of child mocks can also be " -"configured. These aren't syntactically valid to pass in directly as keyword " -"arguments, but a dictionary with these as keys can still be expanded into a :" -"func:`patch` call using ``**``::" +"As well as attributes on the created mock attributes, like " +"the :attr:`~Mock.return_value` and :attr:`~Mock.side_effect`, of child mocks " +"can also be configured. These aren't syntactically valid to pass in directly " +"as keyword arguments, but a dictionary with these as keys can still be " +"expanded into a :func:`patch` call using ``**``::" msgstr "" -"除了被建立的 mock 上的屬性外,還可以配置 child mock 的 :attr:`~Mock." -"return_value` 和 :attr:`~Mock.side_effect`。它們在語法上不能直接作為關鍵字引" -"數傳入,但是以它們作為鍵的字典仍然可以使用 ``**`` 擴充為一個 :func:`patch` 呼" -"叫: ::" +"除了被建立的 mock 上的屬性外,還可以配置 child mock " +"的 :attr:`~Mock.return_value` 和 :attr:`~Mock.side_effect`。它們在語法上不能" +"直接作為關鍵字引數傳入,但是以它們作為鍵的字典仍然可以使用 ``**`` 擴充為一" +"個 :func:`patch` 呼叫: ::" -#: ../../library/unittest.mock.rst:1563 +#: ../../library/unittest.mock.rst:1586 msgid "" ">>> config = {'method.return_value': 3, 'other.side_effect': KeyError}\n" ">>> patcher = patch('__main__.thing', **config)\n" @@ -1839,16 +1903,16 @@ msgstr "" " ...\n" "KeyError" -#: ../../library/unittest.mock.rst:1573 +#: ../../library/unittest.mock.rst:1596 msgid "" "By default, attempting to patch a function in a module (or a method or an " -"attribute in a class) that does not exist will fail with :exc:" -"`AttributeError`::" +"attribute in a class) that does not exist will fail " +"with :exc:`AttributeError`::" msgstr "" "預設情況下,嘗試 patch 模組中不存在的函式(或類別中的方法或屬性)將會失敗,並" "引發 :exc:`AttributeError`: ::" -#: ../../library/unittest.mock.rst:1576 +#: ../../library/unittest.mock.rst:1599 msgid "" ">>> @patch('sys.non_existing_attribute', 42)\n" "... def test():\n" @@ -1870,7 +1934,7 @@ msgstr "" "AttributeError: does not have the attribute " "'non_existing_attribute'" -#: ../../library/unittest.mock.rst:1585 +#: ../../library/unittest.mock.rst:1608 msgid "" "but adding ``create=True`` in the call to :func:`patch` will make the " "previous example work as expected::" @@ -1878,7 +1942,7 @@ msgstr "" "但是在對 :func:`patch` 的呼叫中增加 ``create=True`` 將使前面的範例按照預期運" "作: ::" -#: ../../library/unittest.mock.rst:1588 +#: ../../library/unittest.mock.rst:1611 msgid "" ">>> @patch('sys.non_existing_attribute', 42, create=True)\n" "... def test(mock_stdout):\n" @@ -1892,18 +1956,18 @@ msgstr "" "...\n" ">>> test()" -#: ../../library/unittest.mock.rst:1596 +#: ../../library/unittest.mock.rst:1619 msgid "" ":func:`patch` now returns an :class:`AsyncMock` if the target is an async " "function." msgstr "" "如果目標是一個非同步函式,:func:`patch` 現在會回傳一個 :class:`AsyncMock`。" -#: ../../library/unittest.mock.rst:1600 +#: ../../library/unittest.mock.rst:1623 msgid "patch.object" msgstr "patch.object" -#: ../../library/unittest.mock.rst:1604 +#: ../../library/unittest.mock.rst:1627 msgid "" "patch the named member (*attribute*) on an object (*target*) with a mock " "object." @@ -1911,28 +1975,28 @@ msgstr "" "使用一個 mock 物件 patch 一個物件(\\ *目標*\\ )上的命名成員(\\ *屬性" "*\\ )。" -#: ../../library/unittest.mock.rst:1607 +#: ../../library/unittest.mock.rst:1630 msgid "" ":func:`patch.object` can be used as a decorator, class decorator or a " "context manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* " -"and *new_callable* have the same meaning as for :func:`patch`. Like :func:" -"`patch`, :func:`patch.object` takes arbitrary keyword arguments for " -"configuring the mock object it creates." +"and *new_callable* have the same meaning as for :func:`patch`. " +"Like :func:`patch`, :func:`patch.object` takes arbitrary keyword arguments " +"for configuring the mock object it creates." msgstr "" ":func:`patch.object` 可以做為裝飾器、類別裝飾器或情境管理器使用。引數 *new*、" -"*spec*、*create*、*spec_set*、*autospec* 和 *new_callable* 與在 :func:" -"`patch` 中的引數具有相同的意義。與 :func:`patch` 一樣,:func:`patch.object` " -"接受任意關鍵字引數來配置它所建立的 mock 物件。" +"*spec*、*create*、*spec_set*、*autospec* 和 *new_callable* 與" +"在 :func:`patch` 中的引數具有相同的意義。與 :func:`patch` 一" +"樣,:func:`patch.object` 接受任意關鍵字引數來配置它所建立的 mock 物件。" -#: ../../library/unittest.mock.rst:1613 +#: ../../library/unittest.mock.rst:1636 msgid "" -"When used as a class decorator :func:`patch.object` honours ``patch." -"TEST_PREFIX`` for choosing which methods to wrap." +"When used as a class decorator :func:`patch.object` honours " +"``patch.TEST_PREFIX`` for choosing which methods to wrap." msgstr "" "當作為類別裝飾器使用時,:func:`patch.object` 會遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" -#: ../../library/unittest.mock.rst:1616 +#: ../../library/unittest.mock.rst:1639 msgid "" "You can either call :func:`patch.object` with three arguments or two " "arguments. The three argument form takes the object to be patched, the " @@ -1941,7 +2005,7 @@ msgstr "" "你可以使用三個引數或兩個引數來呼叫 :func:`patch.object`。三個引數的形式接受要" "被 patch 的物件、屬性名稱和要替換掉屬性的物件。" -#: ../../library/unittest.mock.rst:1620 +#: ../../library/unittest.mock.rst:1643 msgid "" "When calling with the two argument form you omit the replacement object, and " "a mock is created for you and passed in as an extra argument to the " @@ -1950,7 +2014,7 @@ msgstr "" "當使用兩個引數的形式呼叫時,你會省略要替換的物件,一個 mock 會為你建立並將其" "作為額外的引數傳遞給被裝飾的函式:" -#: ../../library/unittest.mock.rst:1631 +#: ../../library/unittest.mock.rst:1654 msgid "" "*spec*, *create* and the other arguments to :func:`patch.object` have the " "same meaning as they do for :func:`patch`." @@ -1958,17 +2022,17 @@ msgstr "" "*spec*、*create* 和 :func:`patch.object` 的其他引數與在 :func:`patch` 中的引" "數具有相同的意義。" -#: ../../library/unittest.mock.rst:1636 +#: ../../library/unittest.mock.rst:1659 msgid "patch.dict" msgstr "patch.dict" -#: ../../library/unittest.mock.rst:1640 +#: ../../library/unittest.mock.rst:1663 msgid "" "Patch a dictionary, or dictionary like object, and restore the dictionary to " "its original state after the test." msgstr "Patch 字典或類字典的物件,並在測試後將字典回復到其原本的狀態。" -#: ../../library/unittest.mock.rst:1643 +#: ../../library/unittest.mock.rst:1666 msgid "" "*in_dict* can be a dictionary or a mapping like container. If it is a " "mapping then it must at least support getting, setting and deleting items " @@ -1977,13 +2041,13 @@ msgstr "" "*in_dict* 可以是一個字典或一個類對映的容器。如果它是一個對映,那麼它至少必須" "支援取得、設定、刪除項目以及對鍵的疊代。" -#: ../../library/unittest.mock.rst:1647 +#: ../../library/unittest.mock.rst:1670 msgid "" "*in_dict* can also be a string specifying the name of the dictionary, which " "will then be fetched by importing it." msgstr "*in_dict* 也可以是指定字典名稱的字串,然後透過 import 來取得該字典。" -#: ../../library/unittest.mock.rst:1650 +#: ../../library/unittest.mock.rst:1673 msgid "" "*values* can be a dictionary of values to set in the dictionary. *values* " "can also be an iterable of ``(key, value)`` pairs." @@ -1991,39 +2055,40 @@ msgstr "" "*values* 可以是要設定的值的字典。*values* 也可以是 ``(key, value)`` 對 " "(pairs) 的可疊代物件。" -#: ../../library/unittest.mock.rst:1653 +#: ../../library/unittest.mock.rst:1676 msgid "" "If *clear* is true then the dictionary will be cleared before the new values " "are set." msgstr "如果 *clear* 為 true,則在設定新值之前字典將被清除。" -#: ../../library/unittest.mock.rst:1656 +#: ../../library/unittest.mock.rst:1679 msgid "" ":func:`patch.dict` can also be called with arbitrary keyword arguments to " "set values in the dictionary." msgstr "也可以使用任意關鍵字引數呼叫 :func:`patch.dict` 以在字典中設定值。" -#: ../../library/unittest.mock.rst:1661 +#: ../../library/unittest.mock.rst:1684 msgid "" ":func:`patch.dict` now returns the patched dictionary when used as a context " "manager." msgstr ":func:`patch.dict` 現在在做為情境管理器使用時回傳被 patch 的字典。" -#: ../../library/unittest.mock.rst:1664 +#: ../../library/unittest.mock.rst:1687 msgid "" ":func:`patch.dict` can be used as a context manager, decorator or class " "decorator:" msgstr ":func:`patch.dict` 可以做為情境管理器、裝飾器或類別裝飾器使用:" -#: ../../library/unittest.mock.rst:1675 +#: ../../library/unittest.mock.rst:1698 msgid "" -"When used as a class decorator :func:`patch.dict` honours ``patch." -"TEST_PREFIX`` (default to ``'test'``) for choosing which methods to wrap:" +"When used as a class decorator :func:`patch.dict` honours " +"``patch.TEST_PREFIX`` (default to ``'test'``) for choosing which methods to " +"wrap:" msgstr "" "當作為類別裝飾器使用時,:func:`patch.dict` 會遵循 ``patch.TEST_PREFIX``\\ " "(預設為 ``'test'``\\ )來選擇要包裝的方法:" -#: ../../library/unittest.mock.rst:1686 +#: ../../library/unittest.mock.rst:1709 msgid "" "If you want to use a different prefix for your test, you can inform the " "patchers of the different prefix by setting ``patch.TEST_PREFIX``. For more " @@ -2033,7 +2098,7 @@ msgstr "" "patcher 使用不同的前綴。請參閱 :ref:`test-prefix` 以得知如何修改前綴的更多內" "容。" -#: ../../library/unittest.mock.rst:1690 +#: ../../library/unittest.mock.rst:1713 msgid "" ":func:`patch.dict` can be used to add members to a dictionary, or simply let " "a test change a dictionary, and ensure the dictionary is restored when the " @@ -2042,32 +2107,31 @@ msgstr "" ":func:`patch.dict` 可用於在字典中新增成員,或單純地讓測試更改字典,並確保在測" "試結束時將字典回復原狀。" -#: ../../library/unittest.mock.rst:1711 +#: ../../library/unittest.mock.rst:1734 msgid "" "Keywords can be used in the :func:`patch.dict` call to set values in the " "dictionary:" msgstr "可以在 :func:`patch.dict` 呼叫中使用關鍵字來設定字典中的值:" -#: ../../library/unittest.mock.rst:1721 +#: ../../library/unittest.mock.rst:1744 msgid "" ":func:`patch.dict` can be used with dictionary like objects that aren't " "actually dictionaries. At the very minimum they must support item getting, " "setting, deleting and either iteration or membership test. This corresponds " -"to the magic methods :meth:`~object.__getitem__`, :meth:`~object." -"__setitem__`, :meth:`~object.__delitem__` and either :meth:`~container." -"__iter__` or :meth:`~object.__contains__`." +"to the magic " +"methods :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__` " +"and either :meth:`~container.__iter__` or :meth:`~object.__contains__`." msgstr "" ":func:`patch.dict` 可以與實際上不是字典的類字典物件一起使用。最低限度它們必須" -"支援項目的取得、設定、刪除以及疊代或隸屬資格檢測。這對應到魔術方法中的 :meth:" -"`~object.__getitem__`、:meth:`~object.__setitem__`、:meth:`~object." -"__delitem__` 以及 :meth:`~container.__iter__` 或 :meth:`~object." -"__contains__`。" +"支援項目的取得、設定、刪除以及疊代或隸屬資格檢測。這對應到魔術方法中" +"的 :meth:`~object.__getitem__`、:meth:`~object.__setitem__`、:meth:`~object.__delitem__` " +"以及 :meth:`~container.__iter__` 或 :meth:`~object.__contains__`。" -#: ../../library/unittest.mock.rst:1751 +#: ../../library/unittest.mock.rst:1774 msgid "patch.multiple" msgstr "patch.multiple" -#: ../../library/unittest.mock.rst:1755 +#: ../../library/unittest.mock.rst:1778 msgid "" "Perform multiple patches in a single call. It takes the object to be patched " "(either as an object or a string to fetch the object by importing) and " @@ -2076,7 +2140,7 @@ msgstr "" "在一次呼叫中執行多個 patch。它接受被 patch 的物件(作為物件或透過 import 取得" "物件的字串)和 patch 的關鍵字引數: ::" -#: ../../library/unittest.mock.rst:1759 +#: ../../library/unittest.mock.rst:1782 msgid "" "with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):\n" " ..." @@ -2084,18 +2148,18 @@ msgstr "" "with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):\n" " ..." -#: ../../library/unittest.mock.rst:1762 +#: ../../library/unittest.mock.rst:1785 msgid "" "Use :data:`DEFAULT` as the value if you want :func:`patch.multiple` to " "create mocks for you. In this case the created mocks are passed into a " -"decorated function by keyword, and a dictionary is returned when :func:" -"`patch.multiple` is used as a context manager." +"decorated function by keyword, and a dictionary is returned " +"when :func:`patch.multiple` is used as a context manager." msgstr "" "如果你想要 :func:`patch.multiple` 為你建立 mock,請使用 :data:`DEFAULT` 作為" -"值。在這種情況下,被建立的 mock 會透過關鍵字傳遞到被裝飾的函式中,並且當 :" -"func:`patch.multiple` 作為情境管理器時會回傳字典。" +"值。在這種情況下,被建立的 mock 會透過關鍵字傳遞到被裝飾的函式中,並且" +"當 :func:`patch.multiple` 作為情境管理器時會回傳字典。" -#: ../../library/unittest.mock.rst:1767 +#: ../../library/unittest.mock.rst:1790 msgid "" ":func:`patch.multiple` can be used as a decorator, class decorator or a " "context manager. The arguments *spec*, *spec_set*, *create*, *autospec* and " @@ -2103,30 +2167,30 @@ msgid "" "will be applied to *all* patches done by :func:`patch.multiple`." msgstr "" ":func:`patch.multiple` 可以做為裝飾器、類別裝飾器或情境管理器使用。引數 " -"*spec*、*spec_set*、*create*、*autospec* 和 *new_callable* 與在 :func:" -"`patch` 中的引數具有相同的意義。這些引數將應用於由 :func:`patch.multiple` 完" -"成的\\ *所有* patch。" +"*spec*、*spec_set*、*create*、*autospec* 和 *new_callable* 與" +"在 :func:`patch` 中的引數具有相同的意義。這些引數將應用於" +"由 :func:`patch.multiple` 完成的\\ *所有* patch。" -#: ../../library/unittest.mock.rst:1772 +#: ../../library/unittest.mock.rst:1795 msgid "" -"When used as a class decorator :func:`patch.multiple` honours ``patch." -"TEST_PREFIX`` for choosing which methods to wrap." +"When used as a class decorator :func:`patch.multiple` honours " +"``patch.TEST_PREFIX`` for choosing which methods to wrap." msgstr "" "當作為類別裝飾器使用時,:func:`patch.multiple` 遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" -#: ../../library/unittest.mock.rst:1775 +#: ../../library/unittest.mock.rst:1798 msgid "" "If you want :func:`patch.multiple` to create mocks for you, then you can " "use :data:`DEFAULT` as the value. If you use :func:`patch.multiple` as a " "decorator then the created mocks are passed into the decorated function by " "keyword. ::" msgstr "" -"如果你想要 :func:`patch.multiple` 為你建立 mock,那麼你可以使用 :data:" -"`DEFAULT` 作為值。如果你使用 :func:`patch.multiple` 作為裝飾器,那麼被建立的 " -"mock 將透過關鍵字傳遞到被裝飾的函式中。: ::" +"如果你想要 :func:`patch.multiple` 為你建立 mock,那麼你可以使" +"用 :data:`DEFAULT` 作為值。如果你使用 :func:`patch.multiple` 作為裝飾器,那麼" +"被建立的 mock 將透過關鍵字傳遞到被裝飾的函式中。: ::" -#: ../../library/unittest.mock.rst:1779 +#: ../../library/unittest.mock.rst:1802 msgid "" ">>> thing = object()\n" ">>> other = object()\n" @@ -2148,7 +2212,7 @@ msgstr "" "...\n" ">>> test_function()" -#: ../../library/unittest.mock.rst:1789 +#: ../../library/unittest.mock.rst:1812 msgid "" ":func:`patch.multiple` can be nested with other ``patch`` decorators, but " "put arguments passed by keyword *after* any of the standard arguments " @@ -2157,7 +2221,7 @@ msgstr "" ":func:`patch.multiple` 可以與其他 ``patch`` 裝飾器巢狀使用,但需要將透過關鍵" "字傳遞的引數放在 :func:`patch` 建立的任何標準引數\\ *之後*: ::" -#: ../../library/unittest.mock.rst:1792 +#: ../../library/unittest.mock.rst:1815 msgid "" ">>> @patch('sys.exit')\n" "... @patch.multiple('__main__', thing=DEFAULT, other=DEFAULT)\n" @@ -2177,7 +2241,7 @@ msgstr "" "...\n" ">>> test_function()" -#: ../../library/unittest.mock.rst:1801 +#: ../../library/unittest.mock.rst:1824 msgid "" "If :func:`patch.multiple` is used as a context manager, the value returned " "by the context manager is a dictionary where created mocks are keyed by " @@ -2186,7 +2250,7 @@ msgstr "" "如果 :func:`patch.multiple` 作為情境管理器使用,則情境管理器回傳的值是一個字" "典,其中被建立的 mock 會按名稱作為其鍵值: ::" -#: ../../library/unittest.mock.rst:1804 +#: ../../library/unittest.mock.rst:1827 msgid "" ">>> with patch.multiple('__main__', thing=DEFAULT, other=DEFAULT) as " "values:\n" @@ -2204,11 +2268,11 @@ msgstr "" "... assert values['other'] is other\n" "..." -#: ../../library/unittest.mock.rst:1815 +#: ../../library/unittest.mock.rst:1838 msgid "patch methods: start and stop" msgstr "patch 方法:啟動與停止" -#: ../../library/unittest.mock.rst:1817 +#: ../../library/unittest.mock.rst:1840 msgid "" "All the patchers have :meth:`!start` and :meth:`!stop` methods. These make " "it simpler to do patching in ``setUp`` methods or where you want to do " @@ -2218,18 +2282,18 @@ msgstr "" "方法中進行 patch 或在你想要在沒有巢狀使用裝飾器或 with 陳述式的情況下進行多" "個 patch 時變得更簡單。" -#: ../../library/unittest.mock.rst:1821 +#: ../../library/unittest.mock.rst:1844 msgid "" "To use them call :func:`patch`, :func:`patch.object` or :func:`patch.dict` " "as normal and keep a reference to the returned ``patcher`` object. You can " "then call :meth:`!start` to put the patch in place and :meth:`!stop` to undo " "it." msgstr "" -"要使用它們,請像平常一樣呼叫 :func:`patch`、:func:`patch.object` 或 :func:" -"`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼叫 :meth:" -"`!start` 將 patch 準備就緒,並呼叫 :meth:`!stop` 來取消 patch。" +"要使用它們,請像平常一樣呼叫 :func:`patch`、:func:`patch.object` " +"或 :func:`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼" +"叫 :meth:`!start` 將 patch 準備就緒,並呼叫 :meth:`!stop` 來取消 patch。" -#: ../../library/unittest.mock.rst:1825 +#: ../../library/unittest.mock.rst:1848 msgid "" "If you are using :func:`patch` to create a mock for you then it will be " "returned by the call to ``patcher.start``. ::" @@ -2237,7 +2301,7 @@ msgstr "" "如果你使用 :func:`patch` 為你建立 mock,那麼它將透過呼叫 ``patcher.start`` 回" "傳。: ::" -#: ../../library/unittest.mock.rst:1828 +#: ../../library/unittest.mock.rst:1851 msgid "" ">>> patcher = patch('package.module.ClassName')\n" ">>> from package import module\n" @@ -2259,7 +2323,7 @@ msgstr "" ">>> assert module.ClassName is original\n" ">>> assert module.ClassName is not new_mock" -#: ../../library/unittest.mock.rst:1839 +#: ../../library/unittest.mock.rst:1862 msgid "" "A typical use case for this might be for doing multiple patches in the " "``setUp`` method of a :class:`~unittest.TestCase`::" @@ -2267,7 +2331,7 @@ msgstr "" "一個典型的用法是在一個 :class:`~unittest.TestCase` 的 ``setUp`` 方法中執行多" "個 patch: ::" -#: ../../library/unittest.mock.rst:1842 +#: ../../library/unittest.mock.rst:1865 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -2303,18 +2367,18 @@ msgstr "" "...\n" ">>> MyTest('test_something').run()" -#: ../../library/unittest.mock.rst:1861 +#: ../../library/unittest.mock.rst:1884 msgid "" "If you use this technique you must ensure that the patching is \"undone\" by " "calling ``stop``. This can be fiddlier than you might think, because if an " -"exception is raised in the ``setUp`` then ``tearDown`` is not called. :meth:" -"`unittest.TestCase.addCleanup` makes this easier::" +"exception is raised in the ``setUp`` then ``tearDown`` is not " +"called. :meth:`unittest.TestCase.addCleanup` makes this easier::" msgstr "" "如果你使用這個技巧,你必須確保透過呼叫 ``stop`` 來 \"取消\" patch。這可能會比" "你想像的還要複雜一點,因為如果有例外在 ``setUp`` 中被引發,則 ``tearDown`` 就" "不會被呼叫。:meth:`unittest.TestCase.addCleanup` 會讓這稍微簡單一點: ::" -#: ../../library/unittest.mock.rst:1866 +#: ../../library/unittest.mock.rst:1889 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -2336,34 +2400,34 @@ msgstr "" "... assert package.module.Class is self.MockClass\n" "..." -#: ../../library/unittest.mock.rst:1876 +#: ../../library/unittest.mock.rst:1899 msgid "" "As an added bonus you no longer need to keep a reference to the ``patcher`` " "object." msgstr "作為額外的好處,你不再需要保留對 ``patcher`` 物件的參照。" -#: ../../library/unittest.mock.rst:1879 +#: ../../library/unittest.mock.rst:1902 msgid "" -"It is also possible to stop all patches which have been started by using :" -"func:`patch.stopall`." +"It is also possible to stop all patches which have been started by " +"using :func:`patch.stopall`." msgstr "也可以使用 :func:`patch.stopall` 來停止所有已啟動的 patch。" -#: ../../library/unittest.mock.rst:1884 +#: ../../library/unittest.mock.rst:1907 msgid "Stop all active patches. Only stops patches started with ``start``." msgstr "停止所有運作的 patch。只停止以 ``start`` 啟動的 patch。" -#: ../../library/unittest.mock.rst:1890 +#: ../../library/unittest.mock.rst:1913 msgid "patch builtins" msgstr "patch 內建函式" -#: ../../library/unittest.mock.rst:1891 +#: ../../library/unittest.mock.rst:1914 msgid "" "You can patch any builtins within a module. The following example patches " "builtin :func:`ord`::" msgstr "" "你可以 patch 模組內的任何內建函式。以下範例 patch 內建函式 :func:`ord`: ::" -#: ../../library/unittest.mock.rst:1894 +#: ../../library/unittest.mock.rst:1917 msgid "" ">>> @patch('__main__.ord')\n" "... def test(mock_ord):\n" @@ -2381,11 +2445,11 @@ msgstr "" ">>> test()\n" "101" -#: ../../library/unittest.mock.rst:1906 +#: ../../library/unittest.mock.rst:1929 msgid "TEST_PREFIX" msgstr "TEST_PREFIX" -#: ../../library/unittest.mock.rst:1908 +#: ../../library/unittest.mock.rst:1931 msgid "" "All of the patchers can be used as class decorators. When used in this way " "they wrap every test method on the class. The patchers recognise methods " @@ -2393,19 +2457,19 @@ msgid "" "the :class:`unittest.TestLoader` finds test methods by default." msgstr "" "所有 patcher 都可以作為類別裝飾器使用。以這種方式使用時,它們包裝了類別上的每" -"個測試方法。Patcher 將 ``'test'`` 開頭的方法認定為測試方法。這與 :class:" -"`unittest.TestLoader` 預設尋找測試方法的方式相同。" +"個測試方法。Patcher 將 ``'test'`` 開頭的方法認定為測試方法。這" +"與 :class:`unittest.TestLoader` 預設尋找測試方法的方式相同。" -#: ../../library/unittest.mock.rst:1913 +#: ../../library/unittest.mock.rst:1936 msgid "" "It is possible that you want to use a different prefix for your tests. You " -"can inform the patchers of the different prefix by setting ``patch." -"TEST_PREFIX``::" +"can inform the patchers of the different prefix by setting " +"``patch.TEST_PREFIX``::" msgstr "" "你可能會想為你的測試使用不同的前綴。你可以透過設定 ``patch.TEST_PREFIX`` 來告" "知 patcher 使用不同的前綴: ::" -#: ../../library/unittest.mock.rst:1916 +#: ../../library/unittest.mock.rst:1939 msgid "" ">>> patch.TEST_PREFIX = 'foo'\n" ">>> value = 3\n" @@ -2443,21 +2507,21 @@ msgstr "" ">>> value\n" "3" -#: ../../library/unittest.mock.rst:1936 +#: ../../library/unittest.mock.rst:1959 msgid "Nesting Patch Decorators" msgstr "巢狀使用 Patch 裝飾器" -#: ../../library/unittest.mock.rst:1938 +#: ../../library/unittest.mock.rst:1961 msgid "" "If you want to perform multiple patches then you can simply stack up the " "decorators." msgstr "如果你想執行多個 patch,那麼你可以簡單地堆疊裝飾器。" -#: ../../library/unittest.mock.rst:1941 +#: ../../library/unittest.mock.rst:1964 msgid "You can stack up multiple patch decorators using this pattern:" msgstr "你可以使用這個模式來堆疊多個 patch 裝飾器:" -#: ../../library/unittest.mock.rst:1957 +#: ../../library/unittest.mock.rst:1980 msgid "" "Note that the decorators are applied from the bottom upwards. This is the " "standard way that Python applies decorators. The order of the created mocks " @@ -2466,11 +2530,11 @@ msgstr "" "請注意,裝飾器是從底部向上應用的。這是 Python 應用裝飾器的標準方式。被建立的 " "mock 傳遞到測試函式中的順序與此順序相同。" -#: ../../library/unittest.mock.rst:1965 +#: ../../library/unittest.mock.rst:1988 msgid "Where to patch" msgstr "該 patch 何處" -#: ../../library/unittest.mock.rst:1967 +#: ../../library/unittest.mock.rst:1990 msgid "" ":func:`patch` works by (temporarily) changing the object that a *name* " "points to with another one. There can be many names pointing to any " @@ -2481,7 +2545,7 @@ msgstr "" "有許多 name 指向任何單一物件,因此為了使 patch 起作用,你必須確保你 patch 了" "被測試系統使用的 name。" -#: ../../library/unittest.mock.rst:1972 +#: ../../library/unittest.mock.rst:1995 msgid "" "The basic principle is that you patch where an object is *looked up*, which " "is not necessarily the same place as where it is defined. A couple of " @@ -2490,12 +2554,12 @@ msgstr "" "基本原則是在物件\\ *被查找*\\ 的位置進行 patch,該位置不一定與其被定義的位置" "相同。幾個範例將有助於闡明這一點。" -#: ../../library/unittest.mock.rst:1976 +#: ../../library/unittest.mock.rst:1999 msgid "" "Imagine we have a project that we want to test with the following structure::" msgstr "想像一下,我們想要測試一個專案,其結構如下: ::" -#: ../../library/unittest.mock.rst:1978 +#: ../../library/unittest.mock.rst:2001 msgid "" "a.py\n" " -> Defines SomeClass\n" @@ -2504,15 +2568,21 @@ msgid "" " -> from a import SomeClass\n" " -> some_function instantiates SomeClass" msgstr "" +"a.py\n" +" -> Defines SomeClass\n" +"\n" +"b.py\n" +" -> from a import SomeClass\n" +" -> some_function instantiates SomeClass" -#: ../../library/unittest.mock.rst:1985 +#: ../../library/unittest.mock.rst:2008 msgid "" "Now we want to test ``some_function`` but we want to mock out ``SomeClass`` " "using :func:`patch`. The problem is that when we import module b, which we " -"will have to do then it imports ``SomeClass`` from module a. If we use :func:" -"`patch` to mock out ``a.SomeClass`` then it will have no effect on our test; " -"module b already has a reference to the *real* ``SomeClass`` and it looks " -"like our patching had no effect." +"will have to do when it imports ``SomeClass`` from module a. If we " +"use :func:`patch` to mock out ``a.SomeClass`` then it will have no effect on " +"our test; module b already has a reference to the *real* ``SomeClass`` and " +"it looks like our patching had no effect." msgstr "" "現在我們想要測試 ``some_function``,但我們想使用 :func:`patch` mock " "``SomeClass``。問題是,當我們 import 模組 b 時(我們必須這樣做),它會從模組 " @@ -2520,7 +2590,7 @@ msgstr "" "那麼它對我們的測試就不會有任何影響;模組 b 已經有了一個\\ *真實的*\\ " "``SomeClass`` 的參照 ,看起來我們的 patch 並沒有任何效果。" -#: ../../library/unittest.mock.rst:1992 +#: ../../library/unittest.mock.rst:2015 msgid "" "The key is to patch out ``SomeClass`` where it is used (or where it is " "looked up). In this case ``some_function`` will actually look up " @@ -2531,64 +2601,64 @@ msgstr "" "``some_function`` 實際上會在我們 import 它的模組 b 中查找 ``SomeClass``。這裡" "的 patch 應該長得像這樣: ::" -#: ../../library/unittest.mock.rst:1996 +#: ../../library/unittest.mock.rst:2019 msgid "@patch('b.SomeClass')" msgstr "@patch('b.SomeClass')" -#: ../../library/unittest.mock.rst:1998 +#: ../../library/unittest.mock.rst:2021 msgid "" "However, consider the alternative scenario where instead of ``from a import " -"SomeClass`` module b does ``import a`` and ``some_function`` uses ``a." -"SomeClass``. Both of these import forms are common. In this case the class " -"we want to patch is being looked up in the module and so we have to patch " -"``a.SomeClass`` instead::" +"SomeClass`` module b does ``import a`` and ``some_function`` uses " +"``a.SomeClass``. Both of these import forms are common. In this case the " +"class we want to patch is being looked up in the module and so we have to " +"patch ``a.SomeClass`` instead::" msgstr "" "然而,考慮另一種情況,其中模組 b 並不是使用 ``from a import SomeClass``,而" "是 ``import a``,然後 ``some_function`` 使用 ``a.SomeClass``。這兩種 import " "形式都很常見。在這種情況下,我們想要 patch 的類別正在其模組中被查找,因此我們" "必須 patch ``a.SomeClass``: ::" -#: ../../library/unittest.mock.rst:2003 +#: ../../library/unittest.mock.rst:2026 msgid "@patch('a.SomeClass')" msgstr "@patch('a.SomeClass')" -#: ../../library/unittest.mock.rst:2007 +#: ../../library/unittest.mock.rst:2030 msgid "Patching Descriptors and Proxy Objects" msgstr "Patch 描述器與代理物件 (Proxy Objects)" -#: ../../library/unittest.mock.rst:2009 +#: ../../library/unittest.mock.rst:2032 msgid "" "Both patch_ and patch.object_ correctly patch and restore descriptors: class " "methods, static methods and properties. You should patch these on the " "*class* rather than an instance. They also work with *some* objects that " -"proxy attribute access, like the `django settings object `_." msgstr "" "patch_ 和 patch.object_ 都正確地 patch 和還原描述器:類別方法、靜態方法以及屬" "性。你應該在 *類別* 而不是實例上 patch 它們。它們還可以使用代理屬性存取的\\ *" -"一些*\\ 物件,例如 `django 設定物件 `_。" -#: ../../library/unittest.mock.rst:2017 +#: ../../library/unittest.mock.rst:2040 msgid "MagicMock and magic method support" msgstr "MagicMock 以及魔術方法支援" -#: ../../library/unittest.mock.rst:2022 +#: ../../library/unittest.mock.rst:2045 msgid "Mocking Magic Methods" msgstr "Mock 魔術方法" -#: ../../library/unittest.mock.rst:2024 +#: ../../library/unittest.mock.rst:2047 msgid "" -":class:`Mock` supports mocking the Python protocol methods, also known as :" -"term:`\"magic methods\" `. This allows mock objects to replace " -"containers or other objects that implement Python protocols." +":class:`Mock` supports mocking the Python protocol methods, also known " +"as :term:`\"magic methods\" `. This allows mock objects to " +"replace containers or other objects that implement Python protocols." msgstr "" ":class:`Mock` 支援 mock Python 協定方法,其也被稱作 :term:`\"魔術方法\" " "`。這允許 mock 物件替換容器或實作 Python 協定的其他物件。" -#: ../../library/unittest.mock.rst:2028 +#: ../../library/unittest.mock.rst:2051 msgid "" "Because magic methods are looked up differently from normal methods [#]_, " "this support has been specially implemented. This means that only specific " @@ -2599,7 +2669,7 @@ msgstr "" "代表著僅有特定的魔術方法被此方式支援。現在已支援清單中已經\\ *幾乎*\\ 包含了" "所有魔術方法。如果你需要 mock 任何魔術方法而其尚未被支援,請讓我們知道。" -#: ../../library/unittest.mock.rst:2033 +#: ../../library/unittest.mock.rst:2056 msgid "" "You mock magic methods by setting the method you are interested in to a " "function or a mock instance. If you are using a function then it *must* take " @@ -2608,46 +2678,46 @@ msgstr "" "你可以透過將你感興趣的方法設定為函式或 mock 實例來 mock 魔術方法。如果你使用" "函式,那麼它\\ *必須*\\ 將 ``self`` 作為第一個引數 [#]_。" -#: ../../library/unittest.mock.rst:2056 +#: ../../library/unittest.mock.rst:2079 msgid "" -"One use case for this is for mocking objects used as context managers in a :" -"keyword:`with` statement:" +"One use case for this is for mocking objects used as context managers in " +"a :keyword:`with` statement:" msgstr "一個用法是在 :keyword:`with` 陳述式中 mock 作為情境管理器使用的物件:" -#: ../../library/unittest.mock.rst:2068 +#: ../../library/unittest.mock.rst:2091 msgid "" "Calls to magic methods do not appear in :attr:`~Mock.method_calls`, but they " "are recorded in :attr:`~Mock.mock_calls`." msgstr "" -"對魔術方法的呼叫並不會出現在 :attr:`~Mock.method_calls` 中,它們會被記錄在 :" -"attr:`~Mock.mock_calls` 內。" +"對魔術方法的呼叫並不會出現在 :attr:`~Mock.method_calls` 中,它們會被記錄" +"在 :attr:`~Mock.mock_calls` 內。" -#: ../../library/unittest.mock.rst:2073 +#: ../../library/unittest.mock.rst:2096 msgid "" "If you use the *spec* keyword argument to create a mock then attempting to " -"set a magic method that isn't in the spec will raise an :exc:" -"`AttributeError`." +"set a magic method that isn't in the spec will raise " +"an :exc:`AttributeError`." msgstr "" "如果你使用\\ *spec*\\ 關鍵字引數來建立一個 mock,則嘗試設定規格中未包含的魔術" "方法將引發一個 :exc:`AttributeError`。" -#: ../../library/unittest.mock.rst:2076 +#: ../../library/unittest.mock.rst:2099 msgid "The full list of supported magic methods is:" msgstr "已支援的魔術方法的完整列表是:" -#: ../../library/unittest.mock.rst:2078 +#: ../../library/unittest.mock.rst:2101 msgid "``__hash__``, ``__sizeof__``, ``__repr__`` and ``__str__``" msgstr "``__hash__``、``__sizeof__``、 ``__repr__`` 和 ``__str__``" -#: ../../library/unittest.mock.rst:2079 +#: ../../library/unittest.mock.rst:2102 msgid "``__dir__``, ``__format__`` and ``__subclasses__``" msgstr "``__dir__``、 ``__format__`` 和 ``__subclasses__``" -#: ../../library/unittest.mock.rst:2080 +#: ../../library/unittest.mock.rst:2103 msgid "``__round__``, ``__floor__``, ``__trunc__`` and ``__ceil__``" msgstr "``__round__``、``__floor__``、``__trunc__`` 和 ``__ceil__``" -#: ../../library/unittest.mock.rst:2081 +#: ../../library/unittest.mock.rst:2104 msgid "" "Comparisons: ``__lt__``, ``__gt__``, ``__le__``, ``__ge__``, ``__eq__`` and " "``__ne__``" @@ -2655,7 +2725,7 @@ msgstr "" "比較方法:``__lt__``、``__gt__``、``__le__``、``__ge__``、``__eq__`` 和 " "``__ne__``" -#: ../../library/unittest.mock.rst:2083 +#: ../../library/unittest.mock.rst:2106 msgid "" "Container methods: ``__getitem__``, ``__setitem__``, ``__delitem__``, " "``__contains__``, ``__len__``, ``__iter__``, ``__reversed__`` and " @@ -2665,18 +2735,18 @@ msgstr "" "``__contains__``、``__len__``、``__iter__``、``__reversed__`` 和 " "``__missing__``" -#: ../../library/unittest.mock.rst:2086 +#: ../../library/unittest.mock.rst:2109 msgid "" "Context manager: ``__enter__``, ``__exit__``, ``__aenter__`` and " "``__aexit__``" msgstr "" "情境管理器:``__enter__``、``__exit__``、``__aenter__`` 和 ``__aexit__``" -#: ../../library/unittest.mock.rst:2087 +#: ../../library/unittest.mock.rst:2110 msgid "Unary numeric methods: ``__neg__``, ``__pos__`` and ``__invert__``" msgstr "一元數值方法:``__neg__``、``__pos__`` 和 ``__invert__``" -#: ../../library/unittest.mock.rst:2088 +#: ../../library/unittest.mock.rst:2111 msgid "" "The numeric methods (including right hand and in-place variants): " "``__add__``, ``__sub__``, ``__mul__``, ``__matmul__``, ``__truediv__``, " @@ -2688,18 +2758,18 @@ msgstr "" "``__mod__``、``__divmod__``、``__lshift__``、``__rshift__``、``__and__``、" "``__xor__``、``__or__`` 和 ``__pow__``" -#: ../../library/unittest.mock.rst:2092 +#: ../../library/unittest.mock.rst:2115 msgid "" "Numeric conversion methods: ``__complex__``, ``__int__``, ``__float__`` and " "``__index__``" msgstr "" "數值轉換方法:``__complex__``、``__int__``、``__float__`` 和 ``__index__``" -#: ../../library/unittest.mock.rst:2094 +#: ../../library/unittest.mock.rst:2117 msgid "Descriptor methods: ``__get__``, ``__set__`` and ``__delete__``" msgstr "描述器方法:``__get__``、``__set__`` 和 ``__delete__``" -#: ../../library/unittest.mock.rst:2095 +#: ../../library/unittest.mock.rst:2118 msgid "" "Pickling: ``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, " "``__getnewargs__``, ``__getstate__`` and ``__setstate__``" @@ -2707,19 +2777,19 @@ msgstr "" "Pickling:``__reduce__``、``__reduce_ex__``、``__getinitargs__``、" "``__getnewargs__``、``__getstate__`` 和 ``__setstate__``" -#: ../../library/unittest.mock.rst:2097 +#: ../../library/unittest.mock.rst:2120 msgid "File system path representation: ``__fspath__``" msgstr "檔案系統路徑表示法:``__fspath__``" -#: ../../library/unittest.mock.rst:2098 +#: ../../library/unittest.mock.rst:2121 msgid "Asynchronous iteration methods: ``__aiter__`` and ``__anext__``" msgstr "非同步疊代方法:``__aiter__`` 和 ``__anext__``" -#: ../../library/unittest.mock.rst:2100 +#: ../../library/unittest.mock.rst:2123 msgid "Added support for :func:`os.PathLike.__fspath__`." msgstr "新增對於 :func:`os.PathLike.__fspath__` 的支援。" -#: ../../library/unittest.mock.rst:2103 +#: ../../library/unittest.mock.rst:2126 msgid "" "Added support for ``__aenter__``, ``__aexit__``, ``__aiter__`` and " "``__anext__``." @@ -2727,7 +2797,7 @@ msgstr "" "新增對於 ``__aenter__``、``__aexit__``、``__aiter__`` 和 ``__anext__`` 的支" "援。" -#: ../../library/unittest.mock.rst:2107 +#: ../../library/unittest.mock.rst:2130 msgid "" "The following methods exist but are *not* supported as they are either in " "use by mock, can't be set dynamically, or can cause problems:" @@ -2735,29 +2805,29 @@ msgstr "" "以下方法存在,但「不」被支援,因為它們在被 mock 使用時,會無法動態設定,或可" "能導致問題:" -#: ../../library/unittest.mock.rst:2110 +#: ../../library/unittest.mock.rst:2133 msgid "``__getattr__``, ``__setattr__``, ``__init__`` and ``__new__``" msgstr "``__getattr__``、``__setattr__``、``__init__`` 和 ``__new__``" -#: ../../library/unittest.mock.rst:2111 +#: ../../library/unittest.mock.rst:2134 msgid "" "``__prepare__``, ``__instancecheck__``, ``__subclasscheck__``, ``__del__``" msgstr "" "``__prepare__``、``__instancecheck__``、``__subclasscheck__``、``__del__``" -#: ../../library/unittest.mock.rst:2116 +#: ../../library/unittest.mock.rst:2139 msgid "Magic Mock" msgstr "Magic Mock" -#: ../../library/unittest.mock.rst:2118 +#: ../../library/unittest.mock.rst:2141 msgid "" -"There are two ``MagicMock`` variants: :class:`MagicMock` and :class:" -"`NonCallableMagicMock`." +"There are two ``MagicMock`` variants: :class:`MagicMock` " +"and :class:`NonCallableMagicMock`." msgstr "" -"``MagicMock`` 有兩個變體::class:`MagicMock` 和 :class:" -"`NonCallableMagicMock`。" +"``MagicMock`` 有兩個變體::class:`MagicMock` " +"和 :class:`NonCallableMagicMock`。" -#: ../../library/unittest.mock.rst:2123 +#: ../../library/unittest.mock.rst:2146 msgid "" "``MagicMock`` is a subclass of :class:`Mock` with default implementations of " "most of the :term:`magic methods `. You can use ``MagicMock`` " @@ -2766,11 +2836,11 @@ msgstr "" "``MagicMock`` 是 :class:`Mock` 的子類別,其預設具有大多數\\ :term:`魔術方法 " "`\\ 的實作。你可以使用 ``MagicMock``,而無需自行配置魔術方法。" -#: ../../library/unittest.mock.rst:2127 +#: ../../library/unittest.mock.rst:2150 msgid "The constructor parameters have the same meaning as for :class:`Mock`." msgstr "建構函式參數的意義與 :class:`Mock` 中的參數相同。" -#: ../../library/unittest.mock.rst:2129 +#: ../../library/unittest.mock.rst:2152 msgid "" "If you use the *spec* or *spec_set* arguments then *only* magic methods that " "exist in the spec will be created." @@ -2778,11 +2848,11 @@ msgstr "" "如果你使用 *spec* 或 *spec_set* 引數,那麼\\ *只有*\\ 規格中存在的魔術方法會" "被建立。" -#: ../../library/unittest.mock.rst:2135 +#: ../../library/unittest.mock.rst:2158 msgid "A non-callable version of :class:`MagicMock`." msgstr ":class:`MagicMock` 的不可呼叫版本。" -#: ../../library/unittest.mock.rst:2137 +#: ../../library/unittest.mock.rst:2160 msgid "" "The constructor parameters have the same meaning as for :class:`MagicMock`, " "with the exception of *return_value* and *side_effect* which have no meaning " @@ -2791,7 +2861,7 @@ msgstr "" "建構函式參數的意義與 :class:`MagicMock` 中的參數相同,但 *return_value* 和 " "*side_effect* 除外,它們對不可呼叫的 mock 來說沒有任何意義。" -#: ../../library/unittest.mock.rst:2141 +#: ../../library/unittest.mock.rst:2164 msgid "" "The magic methods are setup with :class:`MagicMock` objects, so you can " "configure them and use them in the usual way:" @@ -2799,7 +2869,7 @@ msgstr "" "魔術方法是使用 :class:`MagicMock` 物件設定的,因此你可以配置它們並以一般的方" "法來使用它們:" -#: ../../library/unittest.mock.rst:2151 +#: ../../library/unittest.mock.rst:2174 msgid "" "By default many of the protocol methods are required to return objects of a " "specific type. These methods are preconfigured with a default return value, " @@ -2811,94 +2881,94 @@ msgstr "" "值,因此如果你對回傳值不感興趣,則無需執行任何操作即可使用它們。如果你想更改" "預設值,你仍然可以手動\\ *設定*\\ 回傳值。" -#: ../../library/unittest.mock.rst:2157 +#: ../../library/unittest.mock.rst:2180 msgid "Methods and their defaults:" msgstr "方法及其預設值:" -#: ../../library/unittest.mock.rst:2159 +#: ../../library/unittest.mock.rst:2182 msgid "``__lt__``: :data:`NotImplemented`" msgstr "``__lt__``::data:`NotImplemented`" -#: ../../library/unittest.mock.rst:2160 +#: ../../library/unittest.mock.rst:2183 msgid "``__gt__``: :data:`!NotImplemented`" msgstr "``__gt__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2161 +#: ../../library/unittest.mock.rst:2184 msgid "``__le__``: :data:`!NotImplemented`" msgstr "``__le__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2162 +#: ../../library/unittest.mock.rst:2185 msgid "``__ge__``: :data:`!NotImplemented`" msgstr "``__ge__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2163 +#: ../../library/unittest.mock.rst:2186 msgid "``__int__``: ``1``" msgstr "``__int__``:``1``" -#: ../../library/unittest.mock.rst:2164 +#: ../../library/unittest.mock.rst:2187 msgid "``__contains__``: ``False``" msgstr "``__contains__``:``False``" -#: ../../library/unittest.mock.rst:2165 +#: ../../library/unittest.mock.rst:2188 msgid "``__len__``: ``0``" msgstr "``__len__``:``0``" -#: ../../library/unittest.mock.rst:2166 +#: ../../library/unittest.mock.rst:2189 msgid "``__iter__``: ``iter([])``" msgstr "``__iter__``:``iter([])``" -#: ../../library/unittest.mock.rst:2167 +#: ../../library/unittest.mock.rst:2190 msgid "``__exit__``: ``False``" msgstr "``__exit__``:``False``" -#: ../../library/unittest.mock.rst:2168 +#: ../../library/unittest.mock.rst:2191 msgid "``__aexit__``: ``False``" msgstr "``__aexit__``:``False``" -#: ../../library/unittest.mock.rst:2169 +#: ../../library/unittest.mock.rst:2192 msgid "``__complex__``: ``1j``" msgstr "``__complex__``:``1j``" -#: ../../library/unittest.mock.rst:2170 +#: ../../library/unittest.mock.rst:2193 msgid "``__float__``: ``1.0``" msgstr "``__float__``:``1.0``" -#: ../../library/unittest.mock.rst:2171 +#: ../../library/unittest.mock.rst:2194 msgid "``__bool__``: ``True``" msgstr "``__bool__``:``True``" -#: ../../library/unittest.mock.rst:2172 +#: ../../library/unittest.mock.rst:2195 msgid "``__index__``: ``1``" msgstr "``__index__``:``1``" -#: ../../library/unittest.mock.rst:2173 +#: ../../library/unittest.mock.rst:2196 msgid "``__hash__``: default hash for the mock" msgstr "``__hash__``:mock 的預設雜湊" -#: ../../library/unittest.mock.rst:2174 +#: ../../library/unittest.mock.rst:2197 msgid "``__str__``: default str for the mock" msgstr "``__str__``:mock 的預設字串" -#: ../../library/unittest.mock.rst:2175 +#: ../../library/unittest.mock.rst:2198 msgid "``__sizeof__``: default sizeof for the mock" msgstr "``__sizeof__``:mock 的預設 sizeof" -#: ../../library/unittest.mock.rst:2177 +#: ../../library/unittest.mock.rst:2200 msgid "For example:" msgstr "舉例來說:" -#: ../../library/unittest.mock.rst:2189 +#: ../../library/unittest.mock.rst:2212 msgid "" "The two equality methods, :meth:`!__eq__` and :meth:`!__ne__`, are special. " -"They do the default equality comparison on identity, using the :attr:`~Mock." -"side_effect` attribute, unless you change their return value to return " -"something else::" +"They do the default equality comparison on identity, using " +"the :attr:`~Mock.side_effect` attribute, unless you change their return " +"value to return something else::" msgstr "" -":meth:`!__eq__` 和 :meth:`!__ne__` 這兩個相等的方法是特別的。它們使用 :attr:" -"`~Mock.side_effect` 屬性對識別性 (identity) 進行預設的相等比較,除非你變更它" -"們的回傳值以回傳其他內容: ::" +":meth:`!__eq__` 和 :meth:`!__ne__` 這兩個相等的方法是特別的。它們使" +"用 :attr:`~Mock.side_effect` 屬性對識別性 (identity) 進行預設的相等比較,除非" +"你變更它們的回傳值以回傳其他內容: ::" -#: ../../library/unittest.mock.rst:2194 +#: ../../library/unittest.mock.rst:2217 msgid "" ">>> MagicMock() == 3\n" "False\n" @@ -2918,14 +2988,14 @@ msgstr "" ">>> mock == 3\n" "True" -#: ../../library/unittest.mock.rst:2203 +#: ../../library/unittest.mock.rst:2226 msgid "" "The return value of :meth:`MagicMock.__iter__` can be any iterable object " "and isn't required to be an iterator:" msgstr "" ":meth:`MagicMock.__iter__` 的回傳值可以是任何可疊代物件,且不需是一個疊代器:" -#: ../../library/unittest.mock.rst:2213 +#: ../../library/unittest.mock.rst:2236 msgid "" "If the return value *is* an iterator, then iterating over it once will " "consume it and subsequent iterations will result in an empty list:" @@ -2933,7 +3003,7 @@ msgstr "" "如果回傳值\\ *是*\\ 一個疊代器,那麼對其進行一次疊代將消耗它,並且後續疊代將" "產生一個空串列:" -#: ../../library/unittest.mock.rst:2222 +#: ../../library/unittest.mock.rst:2245 msgid "" "``MagicMock`` has all of the supported magic methods configured except for " "some of the obscure and obsolete ones. You can still set these up if you " @@ -2942,33 +3012,33 @@ msgstr "" "``MagicMock`` 配置了所有支援的魔術方法,除了一些少見和過時的方法。如果你想" "要,你仍然可以設定這些魔術方法。" -#: ../../library/unittest.mock.rst:2225 +#: ../../library/unittest.mock.rst:2248 msgid "" "Magic methods that are supported but not setup by default in ``MagicMock`` " "are:" msgstr "``MagicMock`` 中支援但預設未設置的魔術方法包含:" -#: ../../library/unittest.mock.rst:2227 +#: ../../library/unittest.mock.rst:2250 msgid "``__subclasses__``" msgstr "``__subclasses__``" -#: ../../library/unittest.mock.rst:2228 +#: ../../library/unittest.mock.rst:2251 msgid "``__dir__``" msgstr "``__dir__``" -#: ../../library/unittest.mock.rst:2229 +#: ../../library/unittest.mock.rst:2252 msgid "``__format__``" msgstr "``__format__``" -#: ../../library/unittest.mock.rst:2230 +#: ../../library/unittest.mock.rst:2253 msgid "``__get__``, ``__set__`` and ``__delete__``" msgstr "``__get__``、``__set__`` 和 ``__delete__``" -#: ../../library/unittest.mock.rst:2231 +#: ../../library/unittest.mock.rst:2254 msgid "``__reversed__`` and ``__missing__``" msgstr "``__reversed__`` 和 ``__missing__``" -#: ../../library/unittest.mock.rst:2232 +#: ../../library/unittest.mock.rst:2255 msgid "" "``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, ``__getnewargs__``, " "``__getstate__`` and ``__setstate__``" @@ -2976,11 +3046,11 @@ msgstr "" "``__reduce__``、``__reduce_ex__``、``__getinitargs__``、``__getnewargs__``、" "``__getstate__`` 和 ``__setstate__``" -#: ../../library/unittest.mock.rst:2234 +#: ../../library/unittest.mock.rst:2257 msgid "``__getformat__``" msgstr "``__getformat__``" -#: ../../library/unittest.mock.rst:2238 +#: ../../library/unittest.mock.rst:2261 msgid "" "Magic methods *should* be looked up on the class rather than the instance. " "Different versions of Python are inconsistent about applying this rule. The " @@ -2989,27 +3059,27 @@ msgstr "" "魔術方法\\ *應該*\\ 在類別而不是實例上被查找。不同版本的 Python 對於這條規則" "的適用並不一致。支援的協定方法應適用於所有支援的 Python 版本。" -#: ../../library/unittest.mock.rst:2242 +#: ../../library/unittest.mock.rst:2265 msgid "" "The function is basically hooked up to the class, but each ``Mock`` instance " "is kept isolated from the others." msgstr "該函式基本上與類別掛鉤,但每個 ``Mock`` 實例都與其他實例保持隔離。" -#: ../../library/unittest.mock.rst:2247 +#: ../../library/unittest.mock.rst:2270 msgid "Helpers" msgstr "輔助函式" -#: ../../library/unittest.mock.rst:2250 +#: ../../library/unittest.mock.rst:2273 msgid "sentinel" msgstr "sentinel(哨兵)" -#: ../../library/unittest.mock.rst:2254 +#: ../../library/unittest.mock.rst:2277 msgid "" "The ``sentinel`` object provides a convenient way of providing unique " "objects for your tests." msgstr "``哨兵``\\ 物件提供了一種為你的測試提供獨特物件的便利方式。" -#: ../../library/unittest.mock.rst:2257 +#: ../../library/unittest.mock.rst:2280 msgid "" "Attributes are created on demand when you access them by name. Accessing the " "same attribute will always return the same object. The objects returned have " @@ -3018,15 +3088,15 @@ msgstr "" "當你使用名稱存取屬性時,屬性會根據需要被建立。存取相同的屬性將始終回傳相同的" "物件。回傳的物件會具有合適的 repr,讓測試失敗的訊息是可閱讀的。" -#: ../../library/unittest.mock.rst:2261 +#: ../../library/unittest.mock.rst:2284 msgid "" -"The ``sentinel`` attributes now preserve their identity when they are :mod:" -"`copied ` or :mod:`pickled `." +"The ``sentinel`` attributes now preserve their identity when they " +"are :mod:`copied ` or :mod:`pickled `." msgstr "" "``哨兵``\\ 屬性現在當被\\ :mod:`複製 `\\ 或\\ :mod:`序列化 `\\ " "時會保留其識別性。" -#: ../../library/unittest.mock.rst:2265 +#: ../../library/unittest.mock.rst:2288 msgid "" "Sometimes when testing you need to test that a specific object is passed as " "an argument to another method, or returned. It can be common to create named " @@ -3037,44 +3107,43 @@ msgstr "" "名的哨兵物件來測試這一點是常見的。:data:`sentinel` 提供了一種此類建立和測試物" "件識別性的便利方式。" -#: ../../library/unittest.mock.rst:2270 +#: ../../library/unittest.mock.rst:2293 msgid "" -"In this example we monkey patch ``method`` to return ``sentinel." -"some_object``:" +"In this example we monkey patch ``method`` to return " +"``sentinel.some_object``:" msgstr "" "在這個例子中,我們 monkey patch ``method`` 以回傳 ``sentinel.some_object``:" -#: ../../library/unittest.mock.rst:2282 +#: ../../library/unittest.mock.rst:2305 msgid "DEFAULT" msgstr "DEFAULT" -#: ../../library/unittest.mock.rst:2287 +#: ../../library/unittest.mock.rst:2310 msgid "" -"The :data:`DEFAULT` object is a pre-created sentinel (actually ``sentinel." -"DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions to " -"indicate that the normal return value should be used." +"The :data:`DEFAULT` object is a pre-created sentinel (actually " +"``sentinel.DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions " +"to indicate that the normal return value should be used." msgstr "" -":data:`DEFAULT` 物件是一個預先建立的哨兵(實際上是 ``sentinel." -"DEFAULT``\\ )。它可以被 :attr:`~Mock.side_effect` 函式使用來表示正常的回傳值" -"應該被使用。" +":data:`DEFAULT` 物件是一個預先建立的哨兵(實際上是 " +"``sentinel.DEFAULT``\\ )。它可以被 :attr:`~Mock.side_effect` 函式使用來表示" +"正常的回傳值應該被使用。" -#: ../../library/unittest.mock.rst:2293 +#: ../../library/unittest.mock.rst:2316 msgid "call" msgstr "call" -#: ../../library/unittest.mock.rst:2297 +#: ../../library/unittest.mock.rst:2320 msgid "" ":func:`call` is a helper object for making simpler assertions, for comparing " -"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock." -"mock_calls` and :attr:`~Mock.method_calls`. :func:`call` can also be used " +"with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock.mock_calls` " +"and :attr:`~Mock.method_calls`. :func:`call` can also be used " "with :meth:`~Mock.assert_has_calls`." msgstr "" -"與 :attr:`~Mock.call_args`、:attr:`~Mock.call_args_list`、:attr:`~Mock." -"mock_calls` 和 :attr:`~Mock.method_calls` 相比,:func:`call` 是一個用於進行更" -"簡單的斷言的輔助物件。:func:`call` 也可以與 :meth:`~Mock.assert_has_calls` 一" -"起使用。" +"與 :attr:`~Mock.call_args`、:attr:`~Mock.call_args_list`、:attr:`~Mock.mock_calls` " +"和 :attr:`~Mock.method_calls` 相比,:func:`call` 是一個用於進行更簡單的斷言的" +"輔助物件。:func:`call` 也可以與 :meth:`~Mock.assert_has_calls` 一起使用。" -#: ../../library/unittest.mock.rst:2310 +#: ../../library/unittest.mock.rst:2333 msgid "" "For a call object that represents multiple calls, :meth:`call_list` returns " "a list of all the intermediate calls as well as the final call." @@ -3082,7 +3151,7 @@ msgstr "" "對於表示多個呼叫的 call 物件,:meth:`call_list` 回傳所有中間呼叫以及最終呼叫" "的串列。" -#: ../../library/unittest.mock.rst:2314 +#: ../../library/unittest.mock.rst:2337 msgid "" "``call_list`` is particularly useful for making assertions on \"chained " "calls\". A chained call is multiple calls on a single line of code. This " @@ -3093,39 +3162,41 @@ msgstr "" "在單行程式碼進行的多次呼叫。這會導致 mock 上的 :attr:`~Mock.mock_calls` 中出" "現多個項目。手動建構呼叫序列會相當單調乏味。" -#: ../../library/unittest.mock.rst:2319 +#: ../../library/unittest.mock.rst:2342 msgid "" ":meth:`~call.call_list` can construct the sequence of calls from the same " "chained call:" msgstr ":meth:`~call.call_list` 可以從同一個鍊接呼叫建構呼叫序列:" -#: ../../library/unittest.mock.rst:2336 +#: ../../library/unittest.mock.rst:2359 msgid "" "A ``call`` object is either a tuple of (positional args, keyword args) or " "(name, positional args, keyword args) depending on how it was constructed. " "When you construct them yourself this isn't particularly interesting, but " -"the ``call`` objects that are in the :attr:`Mock.call_args`, :attr:`Mock." -"call_args_list` and :attr:`Mock.mock_calls` attributes can be introspected " -"to get at the individual arguments they contain." +"the ``call`` objects that are in " +"the :attr:`Mock.call_args`, :attr:`Mock.call_args_list` " +"and :attr:`Mock.mock_calls` attributes can be introspected to get at the " +"individual arguments they contain." msgstr "" "取決於它的建構方式,一個 ``call`` 物件會是(位置引數, 關鍵字引數)的元組,或" "是 (名稱, 位置引數, 關鍵字引數) 的元組。當你自己建構它們時,這並不是那麼有" -"趣,但是 :attr:`Mock.call_args`、:attr:`Mock.call_args_list` 和 :attr:`Mock." -"mock_calls` 屬性中的 ``call`` 物件可以被內省以取得它們包含的各個引數。" +"趣,但是 :attr:`Mock.call_args`、:attr:`Mock.call_args_list` " +"和 :attr:`Mock.mock_calls` 屬性中的 ``call`` 物件可以被內省以取得它們包含的各" +"個引數。" -#: ../../library/unittest.mock.rst:2343 +#: ../../library/unittest.mock.rst:2366 msgid "" -"The ``call`` objects in :attr:`Mock.call_args` and :attr:`Mock." -"call_args_list` are two-tuples of (positional args, keyword args) whereas " -"the ``call`` objects in :attr:`Mock.mock_calls`, along with ones you " -"construct yourself, are three-tuples of (name, positional args, keyword " -"args)." +"The ``call`` objects in :attr:`Mock.call_args` " +"and :attr:`Mock.call_args_list` are two-tuples of (positional args, keyword " +"args) whereas the ``call`` objects in :attr:`Mock.mock_calls`, along with " +"ones you construct yourself, are three-tuples of (name, positional args, " +"keyword args)." msgstr "" ":attr:`Mock.call_args` 和 :attr:`Mock.call_args_list` 中的 ``call`` 物件是" "(位置引數, 關鍵字引數)的二元組,而 :attr:`Mock.mock_calls` 中的 ``call`` 物" "件以及你自己建立的 ``call`` 物件是(名稱, 位置引數, 關鍵字引數)的三元組。" -#: ../../library/unittest.mock.rst:2348 +#: ../../library/unittest.mock.rst:2371 msgid "" "You can use their \"tupleness\" to pull out the individual arguments for " "more complex introspection and assertions. The positional arguments are a " @@ -3135,11 +3206,11 @@ msgstr "" "你可以利用它們作為元組的特性來提取單個引數,以進行更複雜的內省和斷言。位置引" "數是一個元組(如果沒有位置引數則為空元組),關鍵字引數是一個字典:" -#: ../../library/unittest.mock.rst:2381 +#: ../../library/unittest.mock.rst:2404 msgid "create_autospec" msgstr "create_autospec" -#: ../../library/unittest.mock.rst:2385 +#: ../../library/unittest.mock.rst:2408 msgid "" "Create a mock object using another object as a spec. Attributes on the mock " "will use the corresponding attribute on the *spec* object as their spec." @@ -3147,21 +3218,21 @@ msgstr "" "使用另一個物件作為規格建立一個 mock 物件。Mock 上的屬性將使用 *spec* 物件上的" "對應屬性作為其規格。" -#: ../../library/unittest.mock.rst:2389 +#: ../../library/unittest.mock.rst:2412 msgid "" "Functions or methods being mocked will have their arguments checked to " "ensure that they are called with the correct signature." msgstr "被 mock 的函式或方法將檢查其引數,以確保他們被使用正確的簽名來呼叫。" -#: ../../library/unittest.mock.rst:2392 +#: ../../library/unittest.mock.rst:2415 msgid "" "If *spec_set* is ``True`` then attempting to set attributes that don't exist " "on the spec object will raise an :exc:`AttributeError`." msgstr "" -"如果 *spec_set* 為 ``True``,則嘗試設定規格物件上不存在的屬性將引發 :exc:" -"`AttributeError`。" +"如果 *spec_set* 為 ``True``,則嘗試設定規格物件上不存在的屬性將引" +"發 :exc:`AttributeError`。" -#: ../../library/unittest.mock.rst:2395 +#: ../../library/unittest.mock.rst:2418 msgid "" "If a class is used as a spec then the return value of the mock (the instance " "of the class) will have the same spec. You can use a class as the spec for " @@ -3172,7 +3243,7 @@ msgstr "" "可以透過傳遞 ``instance=True`` 來使用一個類別作為一個實例物件的規格。只有當 " "mock 的實例是可呼叫物件時,回傳的 mock 才會是可呼叫物件。" -#: ../../library/unittest.mock.rst:2400 +#: ../../library/unittest.mock.rst:2423 msgid "" ":func:`create_autospec` also takes arbitrary keyword arguments that are " "passed to the constructor of the created mock." @@ -3180,27 +3251,27 @@ msgstr "" ":func:`create_autospec` 也接受任意的關鍵字引數,這些引數會傳遞給已建立的 " "mock 的建構函式。" -#: ../../library/unittest.mock.rst:2403 +#: ../../library/unittest.mock.rst:2426 msgid "" -"See :ref:`auto-speccing` for examples of how to use auto-speccing with :func:" -"`create_autospec` and the *autospec* argument to :func:`patch`." +"See :ref:`auto-speccing` for examples of how to use auto-speccing " +"with :func:`create_autospec` and the *autospec* argument to :func:`patch`." msgstr "" "請參閱 :ref:`auto-speccing` 以得知如何以 :func:`create_autospec` 使用自動規格" "以及如何在 :func:`patch` 中使用 *autospec* 引數的範例。" -#: ../../library/unittest.mock.rst:2409 +#: ../../library/unittest.mock.rst:2432 msgid "" ":func:`create_autospec` now returns an :class:`AsyncMock` if the target is " "an async function." msgstr "" -"如果目標是一個非同步函式,:func:`create_autospec` 現在會回傳一個 :class:" -"`AsyncMock`。" +"如果目標是一個非同步函式,:func:`create_autospec` 現在會回傳一" +"個 :class:`AsyncMock`。" -#: ../../library/unittest.mock.rst:2414 +#: ../../library/unittest.mock.rst:2437 msgid "ANY" msgstr "ANY" -#: ../../library/unittest.mock.rst:2418 +#: ../../library/unittest.mock.rst:2441 msgid "" "Sometimes you may need to make assertions about *some* of the arguments in a " "call to mock, but either not care about some of the arguments or want to " @@ -3210,30 +3281,31 @@ msgstr "" "有時你可能需要對 mock 的呼叫中的\\ *某些*\\ 引數進行斷言,但你不在意其他的某" "些引數,或想將它們單獨從 :attr:`~Mock.call_args` 中取出並進行更加複雜的斷言。" -#: ../../library/unittest.mock.rst:2423 +#: ../../library/unittest.mock.rst:2446 msgid "" "To ignore certain arguments you can pass in objects that compare equal to " -"*everything*. Calls to :meth:`~Mock.assert_called_with` and :meth:`~Mock." -"assert_called_once_with` will then succeed no matter what was passed in." +"*everything*. Calls to :meth:`~Mock.assert_called_with` " +"and :meth:`~Mock.assert_called_once_with` will then succeed no matter what " +"was passed in." msgstr "" "要忽略某些引數,你可以傳入對\\ *所有物件*\\ 來說都相等的物件。那麼無論傳入什" -"麼內容,對 :meth:`~Mock.assert_used_with` 和 :meth:`~Mock." -"assert_used_once_with` 的呼叫都會成功。" +"麼內容,對 :meth:`~Mock.assert_used_with` " +"和 :meth:`~Mock.assert_used_once_with` 的呼叫都會成功。" -#: ../../library/unittest.mock.rst:2432 +#: ../../library/unittest.mock.rst:2455 msgid "" -":data:`ANY` can also be used in comparisons with call lists like :attr:" -"`~Mock.mock_calls`:" +":data:`ANY` can also be used in comparisons with call lists " +"like :attr:`~Mock.mock_calls`:" msgstr "" ":data:`ANY` 也可以用來與呼叫串列進行比較,例如 :attr:`~Mock.mock_calls`:" -#: ../../library/unittest.mock.rst:2442 +#: ../../library/unittest.mock.rst:2465 msgid "" ":data:`ANY` is not limited to comparisons with call objects and so can also " "be used in test assertions::" msgstr ":data:`ANY` 不只能與呼叫物件比較,其也可以在測試斷言中使用: ::" -#: ../../library/unittest.mock.rst:2445 +#: ../../library/unittest.mock.rst:2468 msgid "" "class TestStringMethods(unittest.TestCase):\n" "\n" @@ -3247,24 +3319,24 @@ msgstr "" " s = 'hello world'\n" " self.assertEqual(s.split(), ['hello', ANY])" -#: ../../library/unittest.mock.rst:2453 +#: ../../library/unittest.mock.rst:2476 msgid "FILTER_DIR" msgstr "FILTER_DIR" -#: ../../library/unittest.mock.rst:2457 +#: ../../library/unittest.mock.rst:2480 msgid "" ":data:`FILTER_DIR` is a module level variable that controls the way mock " "objects respond to :func:`dir`. The default is ``True``, which uses the " "filtering described below, to only show useful members. If you dislike this " -"filtering, or need to switch it off for diagnostic purposes, then set ``mock." -"FILTER_DIR = False``." +"filtering, or need to switch it off for diagnostic purposes, then set " +"``mock.FILTER_DIR = False``." msgstr "" ":data:`FILTER_DIR` 是一個模組級別的變數,用於控制 mock 物件回應 :func:`dir` " "的方式。其預設值為 ``True``,它使用以下描述的過濾方式來只顯示有用的成員。如果" "你不喜歡這個過濾方式,或由於診斷意圖而需要將其關閉,請設定 ``mock.FILTER_DIR " "= False``。" -#: ../../library/unittest.mock.rst:2463 +#: ../../library/unittest.mock.rst:2486 msgid "" "With filtering on, ``dir(some_mock)`` shows only useful attributes and will " "include any dynamically created attributes that wouldn't normally be shown. " @@ -3276,7 +3348,7 @@ msgstr "" "的任何動態建立的屬性。如果 mock 是使用 *spec*\\ (或 *autospec*\\ )來建立" "的,那麼源頭的所有屬性都會顯示,即使它們尚未被存取:" -#: ../../library/unittest.mock.rst:2469 +#: ../../library/unittest.mock.rst:2492 msgid "" ">>> dir(Mock())\n" "['assert_any_call',\n" @@ -3314,7 +3386,7 @@ msgstr "" " 'BaseHandler',\n" " ..." -#: ../../library/unittest.mock.rst:2490 +#: ../../library/unittest.mock.rst:2513 msgid "" "Many of the not-very-useful (private to :class:`Mock` rather than the thing " "being mocked) underscore and double underscore prefixed attributes have been " @@ -3326,7 +3398,7 @@ msgstr "" "雙底線前綴屬性已從在 :class:`Mock` 上呼叫 :func:`dir` 的結果中濾除。如果你不" "喜歡這種特性,可以透過設定模組級別開關 :data:`FILTER_DIR` 來將其關閉:" -#: ../../library/unittest.mock.rst:2496 +#: ../../library/unittest.mock.rst:2519 msgid "" ">>> from unittest import mock\n" ">>> mock.FILTER_DIR = False\n" @@ -3352,21 +3424,21 @@ msgstr "" " '__class__',\n" " ..." -#: ../../library/unittest.mock.rst:2511 +#: ../../library/unittest.mock.rst:2534 msgid "" "Alternatively you can just use ``vars(my_mock)`` (instance members) and " "``dir(type(my_mock))`` (type members) to bypass the filtering irrespective " "of :const:`FILTER_DIR`." msgstr "" "或者,你可以只使用 ``vars(my_mock)``\\ (實例成員)和 " -"``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考慮 :const:" -"`FILTER_DIR`。" +"``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考" +"慮 :const:`FILTER_DIR`。" -#: ../../library/unittest.mock.rst:2517 +#: ../../library/unittest.mock.rst:2540 msgid "mock_open" msgstr "mock_open" -#: ../../library/unittest.mock.rst:2521 +#: ../../library/unittest.mock.rst:2544 msgid "" "A helper function to create a mock to replace the use of :func:`open`. It " "works for :func:`open` called directly or used as a context manager." @@ -3374,7 +3446,7 @@ msgstr "" "用於建立取代 :func:`open` 用途的 mock 的輔助函式。它適用於直接呼叫或用作情境" "管理器的 :func:`open`。" -#: ../../library/unittest.mock.rst:2524 +#: ../../library/unittest.mock.rst:2547 msgid "" "The *mock* argument is the mock object to configure. If ``None`` (the " "default) then a :class:`MagicMock` will be created for you, with the API " @@ -3383,41 +3455,43 @@ msgstr "" "*mock* 引數是要配置的 mock 物件。如果其為 ``None``\\ (預設值),那麼就會為你" "建立一個 :class:`MagicMock`,其 API 限制在標準檔案處理上可用的方法或屬性。" -#: ../../library/unittest.mock.rst:2528 -msgid "" -"*read_data* is a string for the :meth:`~io.RawIOBase.read`, :meth:`~io." -"IOBase.readline`, and :meth:`~io.IOBase.readlines` methods of the file " -"handle to return. Calls to those methods will take data from *read_data* " -"until it is depleted. The mock of these methods is pretty simplistic: every " -"time the *mock* is called, the *read_data* is rewound to the start. If you " -"need more control over the data that you are feeding to the tested code you " -"will need to customize this mock for yourself. When that is insufficient, " -"one of the in-memory filesystem packages on `PyPI `_ can " -"offer a realistic filesystem for testing." -msgstr "" -"*read_data* 是檔案處理方法 :meth:`~io.RawIOBase.read`、:meth:`~io.IOBase." -"readline` 和 :meth:`~io.IOBase.readlines` 的回傳字串。對這些方法的呼叫將從 " -"*read_data* 取得資料,直到資料耗盡。對這些方法的 mock 非常單純:每次呼叫 " -"*mock* 時,*read_data* 都會倒回到起點。如果你需要對提供給測試程式碼的資料進行" -"更多控制,你會需要自行客製化這個 mock。如果這樣還不夠,`PyPI `_ 上的其中一個記憶體內檔案系統 (in-memory filesystem) 套件可以提供用於測" -"試的真實檔案系統。" - -#: ../../library/unittest.mock.rst:2538 +#: ../../library/unittest.mock.rst:2551 +msgid "" +"*read_data* is a string for " +"the :meth:`~io.RawIOBase.read`, :meth:`~io.IOBase.readline`, " +"and :meth:`~io.IOBase.readlines` methods of the file handle to return. " +"Calls to those methods will take data from *read_data* until it is " +"depleted. The mock of these methods is pretty simplistic: every time the " +"*mock* is called, the *read_data* is rewound to the start. If you need more " +"control over the data that you are feeding to the tested code you will need " +"to customize this mock for yourself. When that is insufficient, one of the " +"in-memory filesystem packages on `PyPI `_ can offer a " +"realistic filesystem for testing." +msgstr "" +"*read_data* 是檔案處理方" +"法 :meth:`~io.RawIOBase.read`、:meth:`~io.IOBase.readline` " +"和 :meth:`~io.IOBase.readlines` 的回傳字串。對這些方法的呼叫將從 *read_data* " +"取得資料,直到資料耗盡。對這些方法的 mock 非常單純:每次呼叫 *mock* 時," +"*read_data* 都會倒回到起點。如果你需要對提供給測試程式碼的資料進行更多控制," +"你會需要自行客製化這個 mock。如果這樣還不夠,`PyPI `_ 上的" +"其中一個記憶體內檔案系統 (in-memory filesystem) 套件可以提供用於測試的真實檔" +"案系統。" + +#: ../../library/unittest.mock.rst:2561 msgid "" "Added :meth:`~io.IOBase.readline` and :meth:`~io.IOBase.readlines` support. " "The mock of :meth:`~io.RawIOBase.read` changed to consume *read_data* rather " "than returning it on each call." msgstr "" -"新增對 :meth:`~io.IOBase.readline` 和 :meth:`~io.IOBase.readlines` 的支援。:" -"meth:`~io.RawIOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼叫時回" -"傳它。" +"新增對 :meth:`~io.IOBase.readline` 和 :meth:`~io.IOBase.readlines` 的支" +"援。:meth:`~io.RawIOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼" +"叫時回傳它。" -#: ../../library/unittest.mock.rst:2543 +#: ../../library/unittest.mock.rst:2566 msgid "*read_data* is now reset on each call to the *mock*." msgstr "現在,每次呼叫 *mock* 時都會重置 *read_data*。" -#: ../../library/unittest.mock.rst:2546 +#: ../../library/unittest.mock.rst:2569 msgid "" "Added :meth:`~container.__iter__` to implementation so that iteration (such " "as in for loops) correctly consumes *read_data*." @@ -3425,7 +3499,7 @@ msgstr "" "新增 :meth:`~container.__iter__` 到實作中,以便使疊代(例如在 for 迴圈中)正" "確地消耗 *read_data*。" -#: ../../library/unittest.mock.rst:2550 +#: ../../library/unittest.mock.rst:2573 msgid "" "Using :func:`open` as a context manager is a great way to ensure your file " "handles are closed properly and is becoming common::" @@ -3433,7 +3507,7 @@ msgstr "" "使用 :func:`open` 作為情境管理器是確保檔案處理正確關閉的好方式,且這種方式正" "在變得普遍: ::" -#: ../../library/unittest.mock.rst:2553 +#: ../../library/unittest.mock.rst:2576 msgid "" "with open('/some/path', 'w') as f:\n" " f.write('something')" @@ -3441,17 +3515,17 @@ msgstr "" "with open('/some/path', 'w') as f:\n" " f.write('something')" -#: ../../library/unittest.mock.rst:2556 +#: ../../library/unittest.mock.rst:2579 msgid "" "The issue is that even if you mock out the call to :func:`open` it is the " -"*returned object* that is used as a context manager (and has :meth:`~object." -"__enter__` and :meth:`~object.__exit__` called)." +"*returned object* that is used as a context manager (and " +"has :meth:`~object.__enter__` and :meth:`~object.__exit__` called)." msgstr "" "問題是,即使你 mock 了對 :func:`open` 的呼叫,它也是作為情境管理器使用的\\ *" "回傳物件*\\ (且其 :meth:`~object.__enter__` 和 :meth:`~ object.__exit__` 已" "被呼叫)。" -#: ../../library/unittest.mock.rst:2560 +#: ../../library/unittest.mock.rst:2583 msgid "" "Mocking context managers with a :class:`MagicMock` is common enough and " "fiddly enough that a helper function is useful. ::" @@ -3459,7 +3533,7 @@ msgstr "" "使用 :class:`MagicMock` mock 情境管理器相當常見並且精細,因此輔助函式就非常有" "用: ::" -#: ../../library/unittest.mock.rst:2563 +#: ../../library/unittest.mock.rst:2586 msgid "" ">>> m = mock_open()\n" ">>> with patch('__main__.open', m):\n" @@ -3489,11 +3563,11 @@ msgstr "" ">>> handle = m()\n" ">>> handle.write.assert_called_once_with('some stuff')" -#: ../../library/unittest.mock.rst:2577 +#: ../../library/unittest.mock.rst:2600 msgid "And for reading files::" msgstr "以及讀取檔案: ::" -#: ../../library/unittest.mock.rst:2579 +#: ../../library/unittest.mock.rst:2602 msgid "" ">>> with patch('__main__.open', mock_open(read_data='bibble')) as m:\n" "... with open('foo') as h:\n" @@ -3509,29 +3583,29 @@ msgstr "" ">>> m.assert_called_once_with('foo')\n" ">>> assert result == 'bibble'" -#: ../../library/unittest.mock.rst:2590 +#: ../../library/unittest.mock.rst:2613 msgid "Autospeccing" msgstr "Autospeccing(自動規格)" -#: ../../library/unittest.mock.rst:2592 +#: ../../library/unittest.mock.rst:2615 msgid "" "Autospeccing is based on the existing :attr:`!spec` feature of mock. It " "limits the api of mocks to the api of an original object (the spec), but it " "is recursive (implemented lazily) so that attributes of mocks only have the " "same api as the attributes of the spec. In addition mocked functions / " -"methods have the same call signature as the original so they raise a :exc:" -"`TypeError` if they are called incorrectly." +"methods have the same call signature as the original so they raise " +"a :exc:`TypeError` if they are called incorrectly." msgstr "" "自動規格以 mock 現有的 :attr:`!spec` 功能作為基礎。它將 mock 的 api 限制為原" "始物件(規格)的 api,但它是遞迴的(惰性 (lazily) 實現),因此 mock 的屬性僅" "具有與規格的屬性相同的 api。此外,被 mock 的函式/方法具有與原始的函式/方法相" "同的呼叫簽名,因此如果它們被不正確地呼叫,就會引發 :exc:`TypeError`。" -#: ../../library/unittest.mock.rst:2599 +#: ../../library/unittest.mock.rst:2622 msgid "Before I explain how auto-speccing works, here's why it is needed." msgstr "在解釋自動規格如何運作之前,我們先解釋為什麼需要它。" -#: ../../library/unittest.mock.rst:2601 +#: ../../library/unittest.mock.rst:2624 msgid "" ":class:`Mock` is a very powerful and flexible object, but it suffers from a " "flaw which is general to mocking. If you refactor some of your code, rename " @@ -3544,7 +3618,7 @@ msgstr "" "實物件的程式碼測試仍然會通過。這意味著即使你的程式碼壞了,但測試仍可以全部通" "過。" -#: ../../library/unittest.mock.rst:2609 +#: ../../library/unittest.mock.rst:2632 msgid "" "Before 3.5, tests with a typo in the word assert would silently pass when " "they should raise an error. You can still achieve this behavior by passing " @@ -3553,7 +3627,7 @@ msgstr "" "在 3.5 之前,當測試應該引發錯誤時,斷言單字中存在拼字錯誤的測驗會默默地通過。" "你仍可以透過將 ``unsafe=True`` 傳遞給 Mock 來實作此行為。" -#: ../../library/unittest.mock.rst:2612 +#: ../../library/unittest.mock.rst:2635 msgid "" "Note that this is another reason why you need integration tests as well as " "unit tests. Testing everything in isolation is all fine and dandy, but if " @@ -3563,7 +3637,7 @@ msgstr "" "謹記這是你需要有整合測試和單元測試的另一個原因。單獨測試所有內容都很好,但如" "果你不測試你的單元是如何「連接在一起」的,那麼測試還是有機會發現很多錯誤。" -#: ../../library/unittest.mock.rst:2617 +#: ../../library/unittest.mock.rst:2640 msgid "" ":mod:`unittest.mock` already provides a feature to help with this, called " "speccing. If you use a class or instance as the :attr:`!spec` for a mock " @@ -3573,13 +3647,13 @@ msgstr "" "如果你使用類別或實例作為 mock 的 :attr:`!spec`,那麼你在 mock 上只能存取真實" "類別中存在的屬性:" -#: ../../library/unittest.mock.rst:2628 +#: ../../library/unittest.mock.rst:2651 msgid "" "The spec only applies to the mock itself, so we still have the same issue " "with any methods on the mock:" msgstr "該規格僅適用於 mock 本身,因此在 mock 上的任何方法仍然有相同的問題:" -#: ../../library/unittest.mock.rst:2631 +#: ../../library/unittest.mock.rst:2654 msgid "" ">>> mock.has_data()\n" "\n" @@ -3589,10 +3663,10 @@ msgstr "" "\n" ">>> mock.has_data.assret_called_with() # 故意的錯字!" -#: ../../library/unittest.mock.rst:2637 +#: ../../library/unittest.mock.rst:2660 msgid "" -"Auto-speccing solves this problem. You can either pass ``autospec=True`` to :" -"func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " +"Auto-speccing solves this problem. You can either pass ``autospec=True`` " +"to :func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " "function to create a mock with a spec. If you use the ``autospec=True`` " "argument to :func:`patch` then the object that is being replaced will be " "used as the spec object. Because the speccing is done \"lazily\" (the spec " @@ -3600,18 +3674,18 @@ msgid "" "complex or deeply nested objects (like modules that import modules that " "import modules) without a big performance hit." msgstr "" -"自動規格解決了這個問題。你可以將 ``autospec=True`` 傳遞給 :func:`patch` / :" -"func:`patch.object` 或使用 :func:`create_autospec` 函式建立帶有規格的 mock。" -"如果你對 :func:`patch` 使用 ``autospec=True`` 引數,則被取代的物件將作為規格" -"物件使用。因為規格是「惰性」完成的(規格是在 mock 被存取時作為屬性被建立" -"的),所以你可以將它與非常複雜或深度巢狀使用的物件(例如連續引用的模組)一起" -"使用,而不會過於影響性能。" +"自動規格解決了這個問題。你可以將 ``autospec=True`` 傳遞" +"給 :func:`patch` / :func:`patch.object` 或使用 :func:`create_autospec` 函式建" +"立帶有規格的 mock。如果你對 :func:`patch` 使用 ``autospec=True`` 引數,則被取" +"代的物件將作為規格物件使用。因為規格是「惰性」完成的(規格是在 mock 被存取時" +"作為屬性被建立的),所以你可以將它與非常複雜或深度巢狀使用的物件(例如連續引" +"用的模組)一起使用,而不會過於影響性能。" -#: ../../library/unittest.mock.rst:2646 +#: ../../library/unittest.mock.rst:2669 msgid "Here's an example of it in use::" msgstr "這是一個正在使用的例子: ::" -#: ../../library/unittest.mock.rst:2648 +#: ../../library/unittest.mock.rst:2671 msgid "" ">>> from urllib import request\n" ">>> patcher = patch('__main__.request', autospec=True)\n" @@ -3629,17 +3703,17 @@ msgstr "" ">>> mock_request.Request\n" "" -#: ../../library/unittest.mock.rst:2656 +#: ../../library/unittest.mock.rst:2679 msgid "" -"You can see that :class:`!request.Request` has a spec. :class:`!request." -"Request` takes two arguments in the constructor (one of which is *self*). " -"Here's what happens if we try to call it incorrectly::" +"You can see that :class:`!request.Request` has a spec. :class:`!" +"request.Request` takes two arguments in the constructor (one of which is " +"*self*). Here's what happens if we try to call it incorrectly::" msgstr "" "你可以看到 :class:`!request.Request` 有一個規格。:class:`!request.Request` 在" "建構函式中接受兩個引數(其中之一是 *self*\\ )。如果我們錯誤地呼叫它,會發生" "以下情況: ::" -#: ../../library/unittest.mock.rst:2660 +#: ../../library/unittest.mock.rst:2683 msgid "" ">>> req = request.Request()\n" "Traceback (most recent call last):\n" @@ -3651,13 +3725,13 @@ msgstr "" " ...\n" "TypeError: () takes at least 2 arguments (1 given)" -#: ../../library/unittest.mock.rst:2665 +#: ../../library/unittest.mock.rst:2688 msgid "" "The spec also applies to instantiated classes (i.e. the return value of " "specced mocks)::" msgstr "此規格也適用於實例化的類別(即有規格的 mock 的回傳值): ::" -#: ../../library/unittest.mock.rst:2668 +#: ../../library/unittest.mock.rst:2691 msgid "" ">>> req = request.Request('foo')\n" ">>> req\n" @@ -3667,7 +3741,7 @@ msgstr "" ">>> req\n" "" -#: ../../library/unittest.mock.rst:2672 +#: ../../library/unittest.mock.rst:2695 msgid "" ":class:`!Request` objects are not callable, so the return value of " "instantiating our mocked out :class:`!request.Request` is a non-callable " @@ -3678,7 +3752,7 @@ msgstr "" "request.Request` 的回傳值是不可呼叫的 mock。規格到位後,斷言中的任何拼字錯誤" "都會引發正確的錯誤: ::" -#: ../../library/unittest.mock.rst:2676 +#: ../../library/unittest.mock.rst:2699 msgid "" ">>> req.add_header('spam', 'eggs')\n" "\n" @@ -3696,7 +3770,7 @@ msgstr "" "AttributeError: Mock object has no attribute 'assret_called_with'\n" ">>> req.add_header.assert_called_with('spam', 'eggs')" -#: ../../library/unittest.mock.rst:2684 +#: ../../library/unittest.mock.rst:2707 msgid "" "In many cases you will just be able to add ``autospec=True`` to your " "existing :func:`patch` calls and then be protected against bugs due to typos " @@ -3705,15 +3779,15 @@ msgstr "" "在許多情況下,你只需要將 ``autospec=True`` 新增至現有的 :func:`patch` 呼叫" "中,然後就可以防止因拼字錯誤和 api 變更而導致的錯誤。" -#: ../../library/unittest.mock.rst:2688 +#: ../../library/unittest.mock.rst:2711 msgid "" -"As well as using *autospec* through :func:`patch` there is a :func:" -"`create_autospec` for creating autospecced mocks directly:" +"As well as using *autospec* through :func:`patch` there is " +"a :func:`create_autospec` for creating autospecced mocks directly:" msgstr "" -"除了透過 :func:`patch` 使用 *autospec* 之外,還有一個 :func:" -"`create_autospec` 用於直接建立有自動規格的 mock:" +"除了透過 :func:`patch` 使用 *autospec* 之外,還有一" +"個 :func:`create_autospec` 用於直接建立有自動規格的 mock:" -#: ../../library/unittest.mock.rst:2696 +#: ../../library/unittest.mock.rst:2719 msgid "" "This isn't without caveats and limitations however, which is why it is not " "the default behaviour. In order to know what attributes are available on the " @@ -3730,7 +3804,7 @@ msgstr "" "描述器,那麼你可能無法使用 autospec。換句話說,設計你的物件讓內省是安全的 " "[#]_ 會比較好。" -#: ../../library/unittest.mock.rst:2705 +#: ../../library/unittest.mock.rst:2728 msgid "" "A more serious problem is that it is common for instance attributes to be " "created in the :meth:`~object.__init__` method and not to exist on the class " @@ -3741,7 +3815,7 @@ msgstr "" "而其根本不存在於類別中。*autospec* 無法知道任何動態建立的屬性,並將 api 限制" "為可見的屬性。: ::" -#: ../../library/unittest.mock.rst:2710 +#: ../../library/unittest.mock.rst:2733 msgid "" ">>> class Something:\n" "... def __init__(self):\n" @@ -3767,7 +3841,7 @@ msgstr "" " ...\n" "AttributeError: Mock object has no attribute 'a'" -#: ../../library/unittest.mock.rst:2722 +#: ../../library/unittest.mock.rst:2745 msgid "" "There are a few different ways of resolving this problem. The easiest, but " "not necessarily the least annoying, way is to simply set the required " @@ -3779,7 +3853,7 @@ msgstr "" "在 mock 上設定所需的屬性。因為雖然 *autospec* 不允許你取得規格中不存在的屬" "性,但是它不會阻止你設定它們: ::" -#: ../../library/unittest.mock.rst:2728 +#: ../../library/unittest.mock.rst:2751 msgid "" ">>> with patch('__main__.Something', autospec=True):\n" "... thing = Something()\n" @@ -3791,7 +3865,7 @@ msgstr "" "... thing.a = 33\n" "..." -#: ../../library/unittest.mock.rst:2733 +#: ../../library/unittest.mock.rst:2756 msgid "" "There is a more aggressive version of both *spec* and *autospec* that *does* " "prevent you setting non-existent attributes. This is useful if you want to " @@ -3802,7 +3876,7 @@ msgstr "" "屬性。如果你想確保你的程式碼僅能\\ *設定*\\ 有效的屬性,那麼這會很有用,但顯" "然它也順便阻止了這個特殊情況:" -#: ../../library/unittest.mock.rst:2746 +#: ../../library/unittest.mock.rst:2769 msgid "" "Probably the best way of solving the problem is to add class attributes as " "default values for instance members initialised in :meth:`~object.__init__`. " @@ -3814,7 +3888,7 @@ msgstr "" "的實例成員的預設值。請注意,如果你僅在 :meth:`!__init__` 中設定預設屬性,那麼" "透過類別屬性(當然在實例之間共用)提供它們也會更快。例如:" -#: ../../library/unittest.mock.rst:2752 +#: ../../library/unittest.mock.rst:2775 msgid "" "class Something:\n" " a = 33" @@ -3822,7 +3896,7 @@ msgstr "" "class Something:\n" " a = 33" -#: ../../library/unittest.mock.rst:2757 +#: ../../library/unittest.mock.rst:2780 msgid "" "This brings up another issue. It is relatively common to provide a default " "value of ``None`` for members that will later be an object of a different " @@ -3838,7 +3912,7 @@ msgstr "" "他型別的成員,因此自動規格不會對設定為 ``None`` 的成員使用規格。這些會只是普" "通的 mock(通常是 MagicMocks):" -#: ../../library/unittest.mock.rst:2772 +#: ../../library/unittest.mock.rst:2795 msgid "" "If modifying your production classes to add defaults isn't to your liking " "then there are more options. One of these is simply to use an instance as " @@ -3854,7 +3928,7 @@ msgstr "" "你使用替代物件作為規格。值得慶幸的是 :func:`patch` 支援這一點 - 你可以簡單地" "將替代物件作為 *autospec* 引數傳遞: ::" -#: ../../library/unittest.mock.rst:2780 +#: ../../library/unittest.mock.rst:2803 msgid "" ">>> class Something:\n" "... def __init__(self):\n" @@ -3880,7 +3954,7 @@ msgstr "" ">>> mock.a\n" "" -#: ../../library/unittest.mock.rst:2793 +#: ../../library/unittest.mock.rst:2816 msgid "" "This only applies to classes or already instantiated objects. Calling a " "mocked class to create a mock instance *does not* create a real instance. It " @@ -3889,11 +3963,11 @@ msgstr "" "這只適用於類別或已經實例化的物件。呼叫一個被 mock 的類別來建立一個 mock 實例" "\\ *不會*\\ 建立真的實例。它僅查找屬性及對 :func:`dir` 的呼叫。" -#: ../../library/unittest.mock.rst:2798 +#: ../../library/unittest.mock.rst:2821 msgid "Sealing mocks" msgstr "密封 mock" -#: ../../library/unittest.mock.rst:2807 +#: ../../library/unittest.mock.rst:2830 msgid "" "Seal will disable the automatic creation of mocks when accessing an " "attribute of the mock being sealed or any of its attributes that are already " @@ -3902,7 +3976,7 @@ msgstr "" "當存取被密封的 mock 的屬性或其任何已經遞迴 mock 的屬性時,seal 將停用 mock 的" "自動建立。" -#: ../../library/unittest.mock.rst:2810 +#: ../../library/unittest.mock.rst:2833 msgid "" "If a mock instance with a name or a spec is assigned to an attribute it " "won't be considered in the sealing chain. This allows one to prevent seal " @@ -3911,7 +3985,7 @@ msgstr "" "如果將具有名稱或規格的 mock 實例指派給屬性,則不會出現在密封鏈中。這表示可藉" "由固定 mock 物件的一部分來防止密封。: ::" -#: ../../library/unittest.mock.rst:2814 +#: ../../library/unittest.mock.rst:2837 msgid "" ">>> mock = Mock()\n" ">>> mock.submock.attribute1 = 2\n" @@ -3929,52 +4003,52 @@ msgstr "" ">>> mock.submock.attribute2 # This will raise AttributeError.\n" ">>> mock.not_submock.attribute2 # This won't raise." -#: ../../library/unittest.mock.rst:2826 +#: ../../library/unittest.mock.rst:2849 msgid "" "Order of precedence of :attr:`!side_effect`, :attr:`!return_value` and " "*wraps*" msgstr ":attr:`!side_effect`、:attr:`!return_value` 和 *wraps* 的優先順序" -#: ../../library/unittest.mock.rst:2828 +#: ../../library/unittest.mock.rst:2851 msgid "The order of their precedence is:" msgstr "它們的優先順序是:" -#: ../../library/unittest.mock.rst:2830 +#: ../../library/unittest.mock.rst:2853 msgid ":attr:`~Mock.side_effect`" msgstr ":attr:`~Mock.side_effect`" -#: ../../library/unittest.mock.rst:2831 +#: ../../library/unittest.mock.rst:2854 msgid ":attr:`~Mock.return_value`" msgstr ":attr:`~Mock.return_value`" -#: ../../library/unittest.mock.rst:2832 +#: ../../library/unittest.mock.rst:2855 msgid "*wraps*" msgstr "*wraps*" -#: ../../library/unittest.mock.rst:2834 +#: ../../library/unittest.mock.rst:2857 msgid "" -"If all three are set, mock will return the value from :attr:`~Mock." -"side_effect`, ignoring :attr:`~Mock.return_value` and the wrapped object " -"altogether. If any two are set, the one with the higher precedence will " -"return the value. Regardless of the order of which was set first, the order " -"of precedence remains unchanged." +"If all three are set, mock will return the value " +"from :attr:`~Mock.side_effect`, ignoring :attr:`~Mock.return_value` and the " +"wrapped object altogether. If any two are set, the one with the higher " +"precedence will return the value. Regardless of the order of which was set " +"first, the order of precedence remains unchanged." msgstr "" "如果這三個都有設定,mock 將會回傳來自 :attr:`~Mock.side_effect` 的值,並忽" "略 :attr:`~Mock.return_value` 和被包裝物件。如果設定了任兩項,則優先順序較高" "的一項將回傳該值。無論先設定哪個順序,優先順序都保持不變。" -#: ../../library/unittest.mock.rst:2852 +#: ../../library/unittest.mock.rst:2875 msgid "" "As ``None`` is the default value of :attr:`~Mock.side_effect`, if you " "reassign its value back to ``None``, the order of precedence will be checked " -"between :attr:`~Mock.return_value` and the wrapped object, ignoring :attr:" -"`~Mock.side_effect`." +"between :attr:`~Mock.return_value` and the wrapped object, " +"ignoring :attr:`~Mock.side_effect`." msgstr "" "由於 ``None`` 是 :attr:`~Mock.side_effect` 的預設值,如果將其值重新賦值回為 " "``None``,則會檢查 :attr:`~Mock.return_value` 和被包裝物件之間的優先順序,忽" "略 :attr:`~Mock.side_effect`。" -#: ../../library/unittest.mock.rst:2861 +#: ../../library/unittest.mock.rst:2884 msgid "" "If the value being returned by :attr:`~Mock.side_effect` is :data:`DEFAULT`, " "it is ignored and the order of precedence moves to the successor to obtain " @@ -3983,21 +4057,21 @@ msgstr "" "如果 :attr:`~Mock.side_effect` 回傳的值是 :data:`DEFAULT`,它將被忽略,並且優" "先順序被移動到後面一個以獲得要回傳的值。" -#: ../../library/unittest.mock.rst:2870 +#: ../../library/unittest.mock.rst:2893 msgid "" -"When :class:`Mock` wraps an object, the default value of :attr:`~Mock." -"return_value` will be :data:`DEFAULT`." +"When :class:`Mock` wraps an object, the default value " +"of :attr:`~Mock.return_value` will be :data:`DEFAULT`." msgstr "" -"當 :class:`Mock` 包裝一個物件時,:attr:`~Mock.return_value` 的預設值將為 :" -"data:`DEFAULT`。" +"當 :class:`Mock` 包裝一個物件時,:attr:`~Mock.return_value` 的預設值將" +"為 :data:`DEFAULT`。" -#: ../../library/unittest.mock.rst:2879 +#: ../../library/unittest.mock.rst:2902 msgid "" "The order of precedence will ignore this value and it will move to the last " "successor which is the wrapped object." msgstr "優先順序將忽略該值,並將移動到最後一個,即被包裝物件。" -#: ../../library/unittest.mock.rst:2882 +#: ../../library/unittest.mock.rst:2905 msgid "" "As the real call is being made to the wrapped object, creating an instance " "of this mock will return the real instance of the class. The positional " @@ -4006,7 +4080,7 @@ msgstr "" "當對被包裝物件進行真正的呼叫時,建立此 mock 的實例將回傳該類別的真實實例。必" "須傳遞被包裝物件所需的位置引數(如果存在)。" -#: ../../library/unittest.mock.rst:2900 +#: ../../library/unittest.mock.rst:2923 msgid "" "But if you assign ``None`` to it, this will not be ignored as it is an " "explicit assignment. So, the order of precedence will not move to the " @@ -4015,13 +4089,13 @@ msgstr "" "但如果你為其賦予 ``None`` 則不會被忽略,因為它是明確賦值。因此,優先順序不會" "移至被包裝物件。" -#: ../../library/unittest.mock.rst:2908 +#: ../../library/unittest.mock.rst:2931 msgid "" "Even if you set all three at once when initializing the mock, the order of " "precedence remains the same:" msgstr "即使你在初始化 mock 時同時設定所有三個,優先順序也保持不變:" -#: ../../library/unittest.mock.rst:2925 +#: ../../library/unittest.mock.rst:2948 msgid "" "If :attr:`~Mock.side_effect` is exhausted, the order of precedence will not " "cause a value to be obtained from the successors. Instead, ``StopIteration`` " @@ -4029,3 +4103,21 @@ msgid "" msgstr "" "如果 :attr:`~Mock.side_effect` 已耗盡,則優先順序將不會使值由後面取得。相反地" "這會引發 ``StopIteration`` 例外。" + +#~ msgid "" +#~ "This can be useful where you want to make a series of assertions that " +#~ "reuse the same object. Note that :meth:`reset_mock` *doesn't* clear " +#~ "the :attr:`return_value`, :attr:`side_effect` or any child attributes you " +#~ "have set using normal assignment by default. In case you want to " +#~ "reset :attr:`return_value` or :attr:`side_effect`, then pass the " +#~ "corresponding parameter as ``True``. Child mocks and the return value " +#~ "mock (if any) are reset as well." +#~ msgstr "" +#~ "這在你想要進行一系列重複使用同一物件的斷言時非常有用。請注意,預設情況" +#~ "下,:meth:`reset_mock` *不會*\\ 清" +#~ "除 :attr:`return_value`、:attr:`side_effect` 或使用普通賦值設定的任何子屬" +#~ "性。如果你想要重置 :attr:`return_value` 或 :attr:`side_effect`,則將相應的" +#~ "參數設置為 ``True``。Child mock 和回傳值 mock(如果有的話)也會被重置。" + +#~ msgid "*return_value*, and *side_effect* are keyword-only arguments." +#~ msgstr "*return_value* 和 *side_effect* 是僅限關鍵字引數。" diff --git a/library/unittest.po b/library/unittest.po index 9b00ef635a..80fe6553c4 100644 --- a/library/unittest.po +++ b/library/unittest.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-02-23 00:15+0000\n" "PO-Revision-Date: 2022-10-16 06:03+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2425,7 +2425,7 @@ msgid "" "with :class:`asyncio.EventLoop` to avoid using the asyncio policy system." msgstr "" -#: ../../library/unittest.rst:1584 +#: ../../library/unittest.rst:1585 msgid "" "Method called to prepare the test fixture. This is called after :meth:" "`setUp`. This is called immediately before calling the test method; other " @@ -2434,7 +2434,7 @@ msgid "" "implementation does nothing." msgstr "" -#: ../../library/unittest.rst:1592 +#: ../../library/unittest.rst:1594 msgid "" "Method called immediately after the test method has been called and the " "result recorded. This is called before :meth:`tearDown`. This is called " @@ -2447,11 +2447,11 @@ msgid "" "the outcome of the test method. The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:1604 +#: ../../library/unittest.rst:1606 msgid "This method accepts a coroutine that can be used as a cleanup function." msgstr "" -#: ../../library/unittest.rst:1608 +#: ../../library/unittest.rst:1611 msgid "" "Enter the supplied :term:`asynchronous context manager`. If successful, " "also add its :meth:`~object.__aexit__` method as a cleanup function by :meth:" @@ -2459,7 +2459,7 @@ msgid "" "method." msgstr "" -#: ../../library/unittest.rst:1618 +#: ../../library/unittest.rst:1621 msgid "" "Sets up a new event loop to run the test, collecting the result into the :" "class:`TestResult` object passed as *result*. If *result* is omitted or " @@ -2469,11 +2469,11 @@ msgid "" "cancelled." msgstr "" -#: ../../library/unittest.rst:1626 +#: ../../library/unittest.rst:1629 msgid "An example illustrating the order::" msgstr "" -#: ../../library/unittest.rst:1628 +#: ../../library/unittest.rst:1631 msgid "" "from unittest import IsolatedAsyncioTestCase\n" "\n" @@ -2545,14 +2545,14 @@ msgstr "" "if __name__ == \"__main__\":\n" " unittest.main()" -#: ../../library/unittest.rst:1662 +#: ../../library/unittest.rst:1665 msgid "" "After running the test, ``events`` would contain ``[\"setUp\", " "\"asyncSetUp\", \"test_response\", \"asyncTearDown\", \"tearDown\", " "\"cleanup\"]``." msgstr "" -#: ../../library/unittest.rst:1667 +#: ../../library/unittest.rst:1670 msgid "" "This class implements the portion of the :class:`TestCase` interface which " "allows the test runner to drive the test, but does not provide the methods " @@ -2561,11 +2561,11 @@ msgid "" "`unittest`-based test framework." msgstr "" -#: ../../library/unittest.rst:1677 +#: ../../library/unittest.rst:1680 msgid "Grouping tests" msgstr "" -#: ../../library/unittest.rst:1681 +#: ../../library/unittest.rst:1684 msgid "" "This class represents an aggregation of individual test cases and test " "suites. The class presents the interface needed by the test runner to allow " @@ -2573,14 +2573,14 @@ msgid "" "is the same as iterating over the suite, running each test individually." msgstr "" -#: ../../library/unittest.rst:1686 +#: ../../library/unittest.rst:1689 msgid "" "If *tests* is given, it must be an iterable of individual test cases or " "other test suites that will be used to build the suite initially. Additional " "methods are provided to add test cases and suites to the collection later on." msgstr "" -#: ../../library/unittest.rst:1690 +#: ../../library/unittest.rst:1693 msgid "" ":class:`TestSuite` objects behave much like :class:`TestCase` objects, " "except they do not actually implement a test. Instead, they are used to " @@ -2589,47 +2589,47 @@ msgid "" "instances:" msgstr "" -#: ../../library/unittest.rst:1698 +#: ../../library/unittest.rst:1701 msgid "Add a :class:`TestCase` or :class:`TestSuite` to the suite." msgstr "" -#: ../../library/unittest.rst:1703 +#: ../../library/unittest.rst:1706 msgid "" "Add all the tests from an iterable of :class:`TestCase` and :class:" "`TestSuite` instances to this test suite." msgstr "" -#: ../../library/unittest.rst:1706 +#: ../../library/unittest.rst:1709 msgid "" "This is equivalent to iterating over *tests*, calling :meth:`addTest` for " "each element." msgstr "" -#: ../../library/unittest.rst:1709 +#: ../../library/unittest.rst:1712 msgid ":class:`TestSuite` shares the following methods with :class:`TestCase`:" msgstr "" -#: ../../library/unittest.rst:1714 +#: ../../library/unittest.rst:1717 msgid "" "Run the tests associated with this suite, collecting the result into the " "test result object passed as *result*. Note that unlike :meth:`TestCase." "run`, :meth:`TestSuite.run` requires the result object to be passed in." msgstr "" -#: ../../library/unittest.rst:1722 +#: ../../library/unittest.rst:1725 msgid "" "Run the tests associated with this suite without collecting the result. This " "allows exceptions raised by the test to be propagated to the caller and can " "be used to support running tests under a debugger." msgstr "" -#: ../../library/unittest.rst:1729 +#: ../../library/unittest.rst:1732 msgid "" "Return the number of tests represented by this test object, including all " "individual tests and sub-suites." msgstr "" -#: ../../library/unittest.rst:1735 +#: ../../library/unittest.rst:1738 msgid "" "Tests grouped by a :class:`TestSuite` are always accessed by iteration. " "Subclasses can lazily provide tests by overriding :meth:`!__iter__`. Note " @@ -2641,31 +2641,31 @@ msgid "" "overrides :meth:`TestSuite._removeTestAtIndex` to preserve test references." msgstr "" -#: ../../library/unittest.rst:1745 +#: ../../library/unittest.rst:1748 msgid "" "In earlier versions the :class:`TestSuite` accessed tests directly rather " "than through iteration, so overriding :meth:`!__iter__` wasn't sufficient " "for providing tests." msgstr "" -#: ../../library/unittest.rst:1750 +#: ../../library/unittest.rst:1753 msgid "" "In earlier versions the :class:`TestSuite` held references to each :class:" "`TestCase` after :meth:`TestSuite.run`. Subclasses can restore that behavior " "by overriding :meth:`TestSuite._removeTestAtIndex`." msgstr "" -#: ../../library/unittest.rst:1755 +#: ../../library/unittest.rst:1758 msgid "" "In the typical usage of a :class:`TestSuite` object, the :meth:`run` method " "is invoked by a :class:`TestRunner` rather than by the end-user test harness." msgstr "" -#: ../../library/unittest.rst:1760 +#: ../../library/unittest.rst:1763 msgid "Loading and running tests" msgstr "" -#: ../../library/unittest.rst:1764 +#: ../../library/unittest.rst:1767 msgid "" "The :class:`TestLoader` class is used to create test suites from classes and " "modules. Normally, there is no need to create an instance of this class; " @@ -2674,11 +2674,11 @@ msgid "" "customization of some configurable properties." msgstr "" -#: ../../library/unittest.rst:1770 +#: ../../library/unittest.rst:1773 msgid ":class:`TestLoader` objects have the following attributes:" msgstr "" -#: ../../library/unittest.rst:1775 +#: ../../library/unittest.rst:1778 msgid "" "A list of the non-fatal errors encountered while loading tests. Not reset by " "the loader at any point. Fatal errors are signalled by the relevant method " @@ -2686,17 +2686,17 @@ msgid "" "synthetic test that will raise the original error when run." msgstr "" -#: ../../library/unittest.rst:1784 +#: ../../library/unittest.rst:1787 msgid ":class:`TestLoader` objects have the following methods:" msgstr "" -#: ../../library/unittest.rst:1789 +#: ../../library/unittest.rst:1792 msgid "" "Return a suite of all test cases contained in the :class:`TestCase`\\ -" "derived :class:`testCaseClass`." msgstr "" -#: ../../library/unittest.rst:1792 +#: ../../library/unittest.rst:1795 msgid "" "A test case instance is created for each method named by :meth:" "`getTestCaseNames`. By default these are the method names beginning with " @@ -2705,14 +2705,14 @@ msgid "" "method instead." msgstr "" -#: ../../library/unittest.rst:1801 +#: ../../library/unittest.rst:1804 msgid "" "Return a suite of all test cases contained in the given module. This method " "searches *module* for classes derived from :class:`TestCase` and creates an " "instance of the class for each test method defined for the class." msgstr "" -#: ../../library/unittest.rst:1808 +#: ../../library/unittest.rst:1811 msgid "" "While using a hierarchy of :class:`TestCase`\\ -derived classes can be " "convenient in sharing fixtures and helper functions, defining test methods " @@ -2721,7 +2721,7 @@ msgid "" "fixtures are different and defined in subclasses." msgstr "" -#: ../../library/unittest.rst:1814 +#: ../../library/unittest.rst:1817 msgid "" "If a module provides a ``load_tests`` function it will be called to load the " "tests. This allows modules to customize test loading. This is the " @@ -2729,24 +2729,24 @@ msgid "" "argument to ``load_tests``." msgstr "" -#: ../../library/unittest.rst:1819 +#: ../../library/unittest.rst:1822 msgid "Support for ``load_tests`` added." msgstr "" -#: ../../library/unittest.rst:1822 +#: ../../library/unittest.rst:1825 msgid "Support for a keyword-only argument *pattern* has been added." msgstr "" -#: ../../library/unittest.rst:1825 +#: ../../library/unittest.rst:1828 msgid "" "The undocumented and unofficial *use_load_tests* parameter has been removed." msgstr "" -#: ../../library/unittest.rst:1832 +#: ../../library/unittest.rst:1835 msgid "Return a suite of all test cases given a string specifier." msgstr "" -#: ../../library/unittest.rst:1834 +#: ../../library/unittest.rst:1837 msgid "" "The specifier *name* is a \"dotted name\" that may resolve either to a " "module, a test case class, a test method within a test case class, a :class:" @@ -2757,7 +2757,7 @@ msgid "" "object\"." msgstr "" -#: ../../library/unittest.rst:1842 +#: ../../library/unittest.rst:1845 msgid "" "For example, if you have a module :mod:`SampleTests` containing a :class:" "`TestCase`\\ -derived class :class:`SampleTestCase` with three test methods " @@ -2770,31 +2770,31 @@ msgid "" "a side-effect." msgstr "" -#: ../../library/unittest.rst:1852 +#: ../../library/unittest.rst:1855 msgid "The method optionally resolves *name* relative to the given *module*." msgstr "" -#: ../../library/unittest.rst:1854 +#: ../../library/unittest.rst:1857 msgid "" "If an :exc:`ImportError` or :exc:`AttributeError` occurs while traversing " "*name* then a synthetic test that raises that error when run will be " "returned. These errors are included in the errors accumulated by self.errors." msgstr "" -#: ../../library/unittest.rst:1863 +#: ../../library/unittest.rst:1866 msgid "" "Similar to :meth:`loadTestsFromName`, but takes a sequence of names rather " "than a single name. The return value is a test suite which supports all the " "tests defined for each name." msgstr "" -#: ../../library/unittest.rst:1870 +#: ../../library/unittest.rst:1873 msgid "" "Return a sorted sequence of method names found within *testCaseClass*; this " "should be a subclass of :class:`TestCase`." msgstr "" -#: ../../library/unittest.rst:1876 +#: ../../library/unittest.rst:1879 msgid "" "Find all the test modules by recursing into subdirectories from the " "specified start directory, and return a TestSuite object containing them. " @@ -2803,14 +2803,14 @@ msgid "" "Python identifiers) will be loaded." msgstr "" -#: ../../library/unittest.rst:1882 +#: ../../library/unittest.rst:1885 msgid "" "All test modules must be importable from the top level of the project. If " "the start directory is not the top level directory then *top_level_dir* must " "be specified separately." msgstr "" -#: ../../library/unittest.rst:1886 +#: ../../library/unittest.rst:1889 msgid "" "If importing a module fails, for example due to a syntax error, then this " "will be recorded as a single error and discovery will continue. If the " @@ -2818,7 +2818,7 @@ msgid "" "as a skip instead of an error." msgstr "" -#: ../../library/unittest.rst:1891 +#: ../../library/unittest.rst:1894 msgid "" "If a package (a directory containing a file named :file:`__init__.py`) is " "found, the package will be checked for a ``load_tests`` function. If this " @@ -2828,103 +2828,103 @@ msgid "" "itself calls ``loader.discover``." msgstr "" -#: ../../library/unittest.rst:1899 +#: ../../library/unittest.rst:1902 msgid "" "If ``load_tests`` exists then discovery does *not* recurse into the package, " "``load_tests`` is responsible for loading all tests in the package." msgstr "" -#: ../../library/unittest.rst:1903 +#: ../../library/unittest.rst:1906 msgid "" "The pattern is deliberately not stored as a loader attribute so that " "packages can continue discovery themselves." msgstr "" -#: ../../library/unittest.rst:1906 +#: ../../library/unittest.rst:1909 msgid "" "*top_level_dir* is stored internally, and used as a default to any nested " "calls to ``discover()``. That is, if a package's ``load_tests`` calls " "``loader.discover()``, it does not need to pass this argument." msgstr "" -#: ../../library/unittest.rst:1910 +#: ../../library/unittest.rst:1913 msgid "*start_dir* can be a dotted module name as well as a directory." msgstr "" -#: ../../library/unittest.rst:1914 +#: ../../library/unittest.rst:1917 msgid "" "Modules that raise :exc:`SkipTest` on import are recorded as skips, not " "errors." msgstr "" -#: ../../library/unittest.rst:1918 +#: ../../library/unittest.rst:1921 msgid "*start_dir* can be a :term:`namespace packages `." msgstr "" -#: ../../library/unittest.rst:1921 +#: ../../library/unittest.rst:1924 msgid "" "Paths are sorted before being imported so that execution order is the same " "even if the underlying file system's ordering is not dependent on file name." msgstr "" -#: ../../library/unittest.rst:1926 +#: ../../library/unittest.rst:1929 msgid "" "Found packages are now checked for ``load_tests`` regardless of whether " "their path matches *pattern*, because it is impossible for a package name to " "match the default pattern." msgstr "" -#: ../../library/unittest.rst:1931 +#: ../../library/unittest.rst:1934 msgid "" "*start_dir* can not be a :term:`namespace packages `. It " "has been broken since Python 3.7 and Python 3.11 officially remove it." msgstr "" -#: ../../library/unittest.rst:1935 +#: ../../library/unittest.rst:1938 msgid "*top_level_dir* is only stored for the duration of *discover* call." msgstr "" -#: ../../library/unittest.rst:1939 +#: ../../library/unittest.rst:1942 msgid "" "The following attributes of a :class:`TestLoader` can be configured either " "by subclassing or assignment on an instance:" msgstr "" -#: ../../library/unittest.rst:1945 +#: ../../library/unittest.rst:1948 msgid "" "String giving the prefix of method names which will be interpreted as test " "methods. The default value is ``'test'``." msgstr "" -#: ../../library/unittest.rst:1948 +#: ../../library/unittest.rst:1951 msgid "" "This affects :meth:`getTestCaseNames` and all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1954 +#: ../../library/unittest.rst:1957 msgid "" "Function to be used to compare method names when sorting them in :meth:" "`getTestCaseNames` and all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1960 +#: ../../library/unittest.rst:1963 msgid "" "Callable object that constructs a test suite from a list of tests. No " "methods on the resulting object are needed. The default value is the :class:" "`TestSuite` class." msgstr "" -#: ../../library/unittest.rst:1964 ../../library/unittest.rst:1977 +#: ../../library/unittest.rst:1967 ../../library/unittest.rst:1980 msgid "This affects all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1968 +#: ../../library/unittest.rst:1971 msgid "" "List of Unix shell-style wildcard test name patterns that test methods have " "to match to be included in test suites (see ``-k`` option)." msgstr "" -#: ../../library/unittest.rst:1971 +#: ../../library/unittest.rst:1974 msgid "" "If this attribute is not ``None`` (the default), all test methods to be " "included in test suites must match one of the patterns in this list. Note " @@ -2933,13 +2933,13 @@ msgid "" "have to be converted using ``*`` wildcards." msgstr "" -#: ../../library/unittest.rst:1984 +#: ../../library/unittest.rst:1987 msgid "" "This class is used to compile information about which tests have succeeded " "and which have failed." msgstr "" -#: ../../library/unittest.rst:1987 +#: ../../library/unittest.rst:1990 msgid "" "A :class:`TestResult` object stores the results of a set of tests. The :" "class:`TestCase` and :class:`TestSuite` classes ensure that results are " @@ -2947,7 +2947,7 @@ msgid "" "outcome of tests." msgstr "" -#: ../../library/unittest.rst:1992 +#: ../../library/unittest.rst:1995 msgid "" "Testing frameworks built on top of :mod:`unittest` may want access to the :" "class:`TestResult` object generated by running a set of tests for reporting " @@ -2955,61 +2955,61 @@ msgid "" "`TestRunner.run` method for this purpose." msgstr "" -#: ../../library/unittest.rst:1997 +#: ../../library/unittest.rst:2000 msgid "" ":class:`TestResult` instances have the following attributes that will be of " "interest when inspecting the results of running a set of tests:" msgstr "" -#: ../../library/unittest.rst:2003 +#: ../../library/unittest.rst:2006 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents a test which raised an " "unexpected exception." msgstr "" -#: ../../library/unittest.rst:2009 +#: ../../library/unittest.rst:2012 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents a test where a failure " "was explicitly signalled using the :ref:`assert\\* methods `." msgstr "" -#: ../../library/unittest.rst:2015 +#: ../../library/unittest.rst:2018 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding the reason for skipping the test." msgstr "" -#: ../../library/unittest.rst:2022 +#: ../../library/unittest.rst:2025 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents an expected failure or " "error of the test case." msgstr "" -#: ../../library/unittest.rst:2028 +#: ../../library/unittest.rst:2031 msgid "" "A list containing :class:`TestCase` instances that were marked as expected " "failures, but succeeded." msgstr "" -#: ../../library/unittest.rst:2033 +#: ../../library/unittest.rst:2036 msgid "" "A list containing 2-tuples of test case names and floats representing the " "elapsed time of each test which was run." msgstr "" -#: ../../library/unittest.rst:2040 +#: ../../library/unittest.rst:2043 msgid "" "Set to ``True`` when the execution of tests should stop by :meth:`stop`." msgstr "" -#: ../../library/unittest.rst:2044 +#: ../../library/unittest.rst:2047 msgid "The total number of tests run so far." msgstr "" -#: ../../library/unittest.rst:2048 +#: ../../library/unittest.rst:2051 msgid "" "If set to true, ``sys.stdout`` and ``sys.stderr`` will be buffered in " "between :meth:`startTest` and :meth:`stopTest` being called. Collected " @@ -3018,29 +3018,29 @@ msgid "" "error message." msgstr "" -#: ../../library/unittest.rst:2057 +#: ../../library/unittest.rst:2060 msgid "" "If set to true :meth:`stop` will be called on the first failure or error, " "halting the test run." msgstr "" -#: ../../library/unittest.rst:2064 +#: ../../library/unittest.rst:2067 msgid "If set to true then local variables will be shown in tracebacks." msgstr "" -#: ../../library/unittest.rst:2070 +#: ../../library/unittest.rst:2073 msgid "" "Return ``True`` if all tests run so far have passed, otherwise returns " "``False``." msgstr "" -#: ../../library/unittest.rst:2073 +#: ../../library/unittest.rst:2076 msgid "" "Returns ``False`` if there were any :attr:`unexpectedSuccesses` from tests " "marked with the :func:`expectedFailure` decorator." msgstr "" -#: ../../library/unittest.rst:2079 +#: ../../library/unittest.rst:2082 msgid "" "This method can be called to signal that the set of tests being run should " "be aborted by setting the :attr:`shouldStop` attribute to ``True``. :class:" @@ -3048,7 +3048,7 @@ msgid "" "additional tests." msgstr "" -#: ../../library/unittest.rst:2084 +#: ../../library/unittest.rst:2087 msgid "" "For example, this feature is used by the :class:`TextTestRunner` class to " "stop the test framework when the user signals an interrupt from the " @@ -3056,7 +3056,7 @@ msgid "" "implementations can use this in a similar manner." msgstr "" -#: ../../library/unittest.rst:2089 +#: ../../library/unittest.rst:2092 msgid "" "The following methods of the :class:`TestResult` class are used to maintain " "the internal data structures, and may be extended in subclasses to support " @@ -3064,141 +3064,141 @@ msgid "" "tools which support interactive reporting while tests are being run." msgstr "" -#: ../../library/unittest.rst:2097 +#: ../../library/unittest.rst:2100 msgid "Called when the test case *test* is about to be run." msgstr "" -#: ../../library/unittest.rst:2101 +#: ../../library/unittest.rst:2104 msgid "" "Called after the test case *test* has been executed, regardless of the " "outcome." msgstr "" -#: ../../library/unittest.rst:2106 +#: ../../library/unittest.rst:2109 msgid "Called once before any tests are executed." msgstr "" -#: ../../library/unittest.rst:2113 +#: ../../library/unittest.rst:2116 msgid "Called once after all tests are executed." msgstr "" -#: ../../library/unittest.rst:2120 +#: ../../library/unittest.rst:2123 msgid "" "Called when the test case *test* raises an unexpected exception. *err* is a " "tuple of the form returned by :func:`sys.exc_info`: ``(type, value, " "traceback)``." msgstr "" -#: ../../library/unittest.rst:2124 +#: ../../library/unittest.rst:2127 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`errors` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2131 +#: ../../library/unittest.rst:2134 msgid "" "Called when the test case *test* signals a failure. *err* is a tuple of the " "form returned by :func:`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -#: ../../library/unittest.rst:2134 +#: ../../library/unittest.rst:2137 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`failures` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2141 +#: ../../library/unittest.rst:2144 msgid "Called when the test case *test* succeeds." msgstr "" -#: ../../library/unittest.rst:2143 +#: ../../library/unittest.rst:2146 msgid "The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:2148 +#: ../../library/unittest.rst:2151 msgid "" "Called when the test case *test* is skipped. *reason* is the reason the " "test gave for skipping." msgstr "" -#: ../../library/unittest.rst:2151 +#: ../../library/unittest.rst:2154 msgid "" "The default implementation appends a tuple ``(test, reason)`` to the " "instance's :attr:`skipped` attribute." msgstr "" -#: ../../library/unittest.rst:2157 +#: ../../library/unittest.rst:2160 msgid "" "Called when the test case *test* fails or errors, but was marked with the :" "func:`expectedFailure` decorator." msgstr "" -#: ../../library/unittest.rst:2160 +#: ../../library/unittest.rst:2163 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`expectedFailures` attribute, where *formatted_err* is a " "formatted traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2167 +#: ../../library/unittest.rst:2170 msgid "" "Called when the test case *test* was marked with the :func:`expectedFailure` " "decorator, but succeeded." msgstr "" -#: ../../library/unittest.rst:2170 +#: ../../library/unittest.rst:2173 msgid "" "The default implementation appends the test to the instance's :attr:" "`unexpectedSuccesses` attribute." msgstr "" -#: ../../library/unittest.rst:2176 +#: ../../library/unittest.rst:2179 msgid "" "Called when a subtest finishes. *test* is the test case corresponding to " "the test method. *subtest* is a custom :class:`TestCase` instance " "describing the subtest." msgstr "" -#: ../../library/unittest.rst:2180 +#: ../../library/unittest.rst:2183 msgid "" "If *outcome* is :const:`None`, the subtest succeeded. Otherwise, it failed " "with an exception where *outcome* is a tuple of the form returned by :func:" "`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -#: ../../library/unittest.rst:2184 +#: ../../library/unittest.rst:2187 msgid "" "The default implementation does nothing when the outcome is a success, and " "records subtest failures as normal failures." msgstr "" -#: ../../library/unittest.rst:2191 +#: ../../library/unittest.rst:2194 msgid "" "Called when the test case finishes. *elapsed* is the time represented in " "seconds, and it includes the execution of cleanup functions." msgstr "" -#: ../../library/unittest.rst:2198 +#: ../../library/unittest.rst:2201 msgid "" "A concrete implementation of :class:`TestResult` used by the :class:" "`TextTestRunner`. Subclasses should accept ``**kwargs`` to ensure " "compatibility as the interface changes." msgstr "" -#: ../../library/unittest.rst:2204 +#: ../../library/unittest.rst:2207 msgid "Added the *durations* keyword parameter." msgstr "新增 *durations* 關鍵字參數。" -#: ../../library/unittest.rst:2209 +#: ../../library/unittest.rst:2212 msgid "" "Instance of the :class:`TestLoader` class intended to be shared. If no " "customization of the :class:`TestLoader` is needed, this instance can be " "used instead of repeatedly creating new instances." msgstr "" -#: ../../library/unittest.rst:2218 +#: ../../library/unittest.rst:2221 msgid "" "A basic test runner implementation that outputs results to a stream. If " "*stream* is ``None``, the default, :data:`sys.stderr` is used as the output " @@ -3209,7 +3209,7 @@ msgid "" "unittest." msgstr "" -#: ../../library/unittest.rst:2225 +#: ../../library/unittest.rst:2228 msgid "" "By default this runner shows :exc:`DeprecationWarning`, :exc:" "`PendingDeprecationWarning`, :exc:`ResourceWarning` and :exc:`ImportWarning` " @@ -3219,32 +3219,32 @@ msgid "" "``None``." msgstr "" -#: ../../library/unittest.rst:2233 +#: ../../library/unittest.rst:2236 msgid "Added the *warnings* parameter." msgstr "新增 *warnings* 參數。" -#: ../../library/unittest.rst:2236 +#: ../../library/unittest.rst:2239 msgid "" "The default stream is set to :data:`sys.stderr` at instantiation time rather " "than import time." msgstr "" -#: ../../library/unittest.rst:2240 +#: ../../library/unittest.rst:2243 msgid "Added the *tb_locals* parameter." msgstr "新增 *tb_locals* 參數。" -#: ../../library/unittest.rst:2243 +#: ../../library/unittest.rst:2246 msgid "Added the *durations* parameter." msgstr "新增 *durations* 參數。" -#: ../../library/unittest.rst:2248 +#: ../../library/unittest.rst:2251 msgid "" "This method returns the instance of ``TestResult`` used by :meth:`run`. It " "is not intended to be called directly, but can be overridden in subclasses " "to provide a custom ``TestResult``." msgstr "" -#: ../../library/unittest.rst:2252 +#: ../../library/unittest.rst:2255 msgid "" "``_makeResult()`` instantiates the class or callable passed in the " "``TextTestRunner`` constructor as the ``resultclass`` argument. It defaults " @@ -3252,11 +3252,11 @@ msgid "" "class is instantiated with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2257 +#: ../../library/unittest.rst:2260 msgid "stream, descriptions, verbosity" msgstr "" -#: ../../library/unittest.rst:2261 +#: ../../library/unittest.rst:2264 msgid "" "This method is the main public interface to the ``TextTestRunner``. This " "method takes a :class:`TestSuite` or :class:`TestCase` instance. A :class:" @@ -3264,7 +3264,7 @@ msgid "" "run and the results printed to stdout." msgstr "" -#: ../../library/unittest.rst:2272 +#: ../../library/unittest.rst:2275 msgid "" "A command-line program that loads a set of tests from *module* and runs " "them; this is primarily for making test modules conveniently executable. The " @@ -3272,7 +3272,7 @@ msgid "" "of a test script::" msgstr "" -#: ../../library/unittest.rst:2277 +#: ../../library/unittest.rst:2280 msgid "" "if __name__ == '__main__':\n" " unittest.main()" @@ -3280,13 +3280,13 @@ msgstr "" "if __name__ == '__main__':\n" " unittest.main()" -#: ../../library/unittest.rst:2280 +#: ../../library/unittest.rst:2283 msgid "" "You can run tests with more detailed information by passing in the verbosity " "argument::" msgstr "" -#: ../../library/unittest.rst:2283 +#: ../../library/unittest.rst:2286 msgid "" "if __name__ == '__main__':\n" " unittest.main(verbosity=2)" @@ -3294,7 +3294,7 @@ msgstr "" "if __name__ == '__main__':\n" " unittest.main(verbosity=2)" -#: ../../library/unittest.rst:2286 +#: ../../library/unittest.rst:2289 msgid "" "The *defaultTest* argument is either the name of a single test or an " "iterable of test names to run if no test names are specified via *argv*. If " @@ -3302,14 +3302,14 @@ msgid "" "tests found in *module* are run." msgstr "" -#: ../../library/unittest.rst:2291 +#: ../../library/unittest.rst:2294 msgid "" "The *argv* argument can be a list of options passed to the program, with the " "first element being the program name. If not specified or ``None``, the " "values of :data:`sys.argv` are used." msgstr "" -#: ../../library/unittest.rst:2295 +#: ../../library/unittest.rst:2298 msgid "" "The *testRunner* argument can either be a test runner class or an already " "created instance of it. By default ``main`` calls :func:`sys.exit` with an " @@ -3317,20 +3317,20 @@ msgid "" "code of 5 indicates that no tests were run or skipped." msgstr "" -#: ../../library/unittest.rst:2300 +#: ../../library/unittest.rst:2303 msgid "" "The *testLoader* argument has to be a :class:`TestLoader` instance, and " "defaults to :data:`defaultTestLoader`." msgstr "" -#: ../../library/unittest.rst:2303 +#: ../../library/unittest.rst:2306 msgid "" "``main`` supports being used from the interactive interpreter by passing in " "the argument ``exit=False``. This displays the result on standard output " "without calling :func:`sys.exit`::" msgstr "" -#: ../../library/unittest.rst:2307 +#: ../../library/unittest.rst:2310 msgid "" ">>> from unittest import main\n" ">>> main(module='test_module', exit=False)" @@ -3338,13 +3338,13 @@ msgstr "" ">>> from unittest import main\n" ">>> main(module='test_module', exit=False)" -#: ../../library/unittest.rst:2310 +#: ../../library/unittest.rst:2313 msgid "" "The *failfast*, *catchbreak* and *buffer* parameters have the same effect as " "the same-name `command-line options`_." msgstr "" -#: ../../library/unittest.rst:2313 +#: ../../library/unittest.rst:2316 msgid "" "The *warnings* argument specifies the :ref:`warning filter ` " "that should be used while running the tests. If it's not specified, it will " @@ -3353,60 +3353,60 @@ msgid "" "to ``'default'``." msgstr "" -#: ../../library/unittest.rst:2319 +#: ../../library/unittest.rst:2322 msgid "" "Calling ``main`` returns an object with the ``result`` attribute that " "contains the result of the tests run as a :class:`unittest.TestResult`." msgstr "" -#: ../../library/unittest.rst:2322 +#: ../../library/unittest.rst:2325 msgid "The *exit* parameter was added." msgstr "新增 *exit* 參數。" -#: ../../library/unittest.rst:2325 +#: ../../library/unittest.rst:2328 msgid "" "The *verbosity*, *failfast*, *catchbreak*, *buffer* and *warnings* " "parameters were added." msgstr "" -#: ../../library/unittest.rst:2329 +#: ../../library/unittest.rst:2332 msgid "" "The *defaultTest* parameter was changed to also accept an iterable of test " "names." msgstr "" -#: ../../library/unittest.rst:2337 +#: ../../library/unittest.rst:2340 msgid "load_tests Protocol" msgstr "load_tests 協定" -#: ../../library/unittest.rst:2341 +#: ../../library/unittest.rst:2344 msgid "" "Modules or packages can customize how tests are loaded from them during " "normal test runs or test discovery by implementing a function called " "``load_tests``." msgstr "" -#: ../../library/unittest.rst:2344 +#: ../../library/unittest.rst:2347 msgid "" "If a test module defines ``load_tests`` it will be called by :meth:" "`TestLoader.loadTestsFromModule` with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2347 ../../library/unittest.rst:2379 +#: ../../library/unittest.rst:2350 ../../library/unittest.rst:2382 msgid "load_tests(loader, standard_tests, pattern)" msgstr "load_tests(loader, standard_tests, pattern)" -#: ../../library/unittest.rst:2349 +#: ../../library/unittest.rst:2352 msgid "" "where *pattern* is passed straight through from ``loadTestsFromModule``. It " "defaults to ``None``." msgstr "" -#: ../../library/unittest.rst:2352 +#: ../../library/unittest.rst:2355 msgid "It should return a :class:`TestSuite`." msgstr "它應該回傳一個 :class:`TestSuite`。" -#: ../../library/unittest.rst:2354 +#: ../../library/unittest.rst:2357 msgid "" "*loader* is the instance of :class:`TestLoader` doing the loading. " "*standard_tests* are the tests that would be loaded by default from the " @@ -3415,13 +3415,13 @@ msgid "" "packages as part of test discovery." msgstr "" -#: ../../library/unittest.rst:2360 +#: ../../library/unittest.rst:2363 msgid "" "A typical ``load_tests`` function that loads tests from a specific set of :" "class:`TestCase` classes may look like::" msgstr "" -#: ../../library/unittest.rst:2363 +#: ../../library/unittest.rst:2366 msgid "" "test_cases = (TestCase1, TestCase2, TestCase3)\n" "\n" @@ -3441,7 +3441,7 @@ msgstr "" " suite.addTests(tests)\n" " return suite" -#: ../../library/unittest.rst:2372 +#: ../../library/unittest.rst:2375 msgid "" "If discovery is started in a directory containing a package, either from the " "command line or by calling :meth:`TestLoader.discover`, then the package :" @@ -3451,21 +3451,21 @@ msgid "" "left up to ``load_tests`` which is called with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2381 +#: ../../library/unittest.rst:2384 msgid "" "This should return a :class:`TestSuite` representing all the tests from the " "package. (``standard_tests`` will only contain tests collected from :file:" "`__init__.py`.)" msgstr "" -#: ../../library/unittest.rst:2385 +#: ../../library/unittest.rst:2388 msgid "" "Because the pattern is passed into ``load_tests`` the package is free to " "continue (and potentially modify) test discovery. A 'do nothing' " "``load_tests`` function for a test package would look like::" msgstr "" -#: ../../library/unittest.rst:2389 +#: ../../library/unittest.rst:2392 msgid "" "def load_tests(loader, standard_tests, pattern):\n" " # top level directory cached on loader instance\n" @@ -3475,17 +3475,17 @@ msgid "" " return standard_tests" msgstr "" -#: ../../library/unittest.rst:2396 +#: ../../library/unittest.rst:2399 msgid "" "Discovery no longer checks package names for matching *pattern* due to the " "impossibility of package names matching the default pattern." msgstr "" -#: ../../library/unittest.rst:2403 +#: ../../library/unittest.rst:2406 msgid "Class and Module Fixtures" msgstr "" -#: ../../library/unittest.rst:2405 +#: ../../library/unittest.rst:2408 msgid "" "Class and module level fixtures are implemented in :class:`TestSuite`. When " "the test suite encounters a test from a new class then :meth:`tearDownClass` " @@ -3493,27 +3493,27 @@ msgid "" "`setUpClass` from the new class." msgstr "" -#: ../../library/unittest.rst:2410 +#: ../../library/unittest.rst:2413 msgid "" "Similarly if a test is from a different module from the previous test then " "``tearDownModule`` from the previous module is run, followed by " "``setUpModule`` from the new module." msgstr "" -#: ../../library/unittest.rst:2414 +#: ../../library/unittest.rst:2417 msgid "" "After all the tests have run the final ``tearDownClass`` and " "``tearDownModule`` are run." msgstr "" -#: ../../library/unittest.rst:2417 +#: ../../library/unittest.rst:2420 msgid "" "Note that shared fixtures do not play well with [potential] features like " "test parallelization and they break test isolation. They should be used with " "care." msgstr "" -#: ../../library/unittest.rst:2420 +#: ../../library/unittest.rst:2423 msgid "" "The default ordering of tests created by the unittest test loaders is to " "group all tests from the same modules and classes together. This will lead " @@ -3523,14 +3523,14 @@ msgid "" "functions may be called multiple times in a single test run." msgstr "" -#: ../../library/unittest.rst:2427 +#: ../../library/unittest.rst:2430 msgid "" "Shared fixtures are not intended to work with suites with non-standard " "ordering. A ``BaseTestSuite`` still exists for frameworks that don't want to " "support shared fixtures." msgstr "" -#: ../../library/unittest.rst:2431 +#: ../../library/unittest.rst:2434 msgid "" "If there are any exceptions raised during one of the shared fixture " "functions the test is reported as an error. Because there is no " @@ -3540,15 +3540,15 @@ msgid "" "matter, but if you are a framework author it may be relevant." msgstr "" -#: ../../library/unittest.rst:2440 +#: ../../library/unittest.rst:2443 msgid "setUpClass and tearDownClass" msgstr "setUpClass 和 tearDownClass" -#: ../../library/unittest.rst:2442 +#: ../../library/unittest.rst:2445 msgid "These must be implemented as class methods::" msgstr "" -#: ../../library/unittest.rst:2444 +#: ../../library/unittest.rst:2447 msgid "" "import unittest\n" "\n" @@ -3572,14 +3572,14 @@ msgstr "" " def tearDownClass(cls):\n" " cls._connection.destroy()" -#: ../../library/unittest.rst:2455 +#: ../../library/unittest.rst:2458 msgid "" "If you want the ``setUpClass`` and ``tearDownClass`` on base classes called " "then you must call up to them yourself. The implementations in :class:" "`TestCase` are empty." msgstr "" -#: ../../library/unittest.rst:2459 +#: ../../library/unittest.rst:2462 msgid "" "If an exception is raised during a ``setUpClass`` then the tests in the " "class are not run and the ``tearDownClass`` is not run. Skipped classes will " @@ -3588,15 +3588,15 @@ msgid "" "instead of as an error." msgstr "" -#: ../../library/unittest.rst:2467 +#: ../../library/unittest.rst:2470 msgid "setUpModule and tearDownModule" msgstr "setUpModule 和 tearDownModule" -#: ../../library/unittest.rst:2469 +#: ../../library/unittest.rst:2472 msgid "These should be implemented as functions::" msgstr "" -#: ../../library/unittest.rst:2471 +#: ../../library/unittest.rst:2474 msgid "" "def setUpModule():\n" " createConnection()\n" @@ -3610,7 +3610,7 @@ msgstr "" "def tearDownModule():\n" " closeConnection()" -#: ../../library/unittest.rst:2477 +#: ../../library/unittest.rst:2480 msgid "" "If an exception is raised in a ``setUpModule`` then none of the tests in the " "module will be run and the ``tearDownModule`` will not be run. If the " @@ -3618,13 +3618,13 @@ msgid "" "having been skipped instead of as an error." msgstr "" -#: ../../library/unittest.rst:2482 +#: ../../library/unittest.rst:2485 msgid "" "To add cleanup code that must be run even in the case of an exception, use " "``addModuleCleanup``:" msgstr "" -#: ../../library/unittest.rst:2488 +#: ../../library/unittest.rst:2491 msgid "" "Add a function to be called after :func:`tearDownModule` to cleanup " "resources used during the test class. Functions will be called in reverse " @@ -3633,13 +3633,13 @@ msgid "" "`addModuleCleanup` when they are added." msgstr "" -#: ../../library/unittest.rst:2494 +#: ../../library/unittest.rst:2497 msgid "" "If :meth:`setUpModule` fails, meaning that :func:`tearDownModule` is not " "called, then any cleanup functions added will still be called." msgstr "" -#: ../../library/unittest.rst:2502 +#: ../../library/unittest.rst:2505 msgid "" "Enter the supplied :term:`context manager`. If successful, also add its :" "meth:`~object.__exit__` method as a cleanup function by :func:" @@ -3647,30 +3647,30 @@ msgid "" "method." msgstr "" -#: ../../library/unittest.rst:2512 +#: ../../library/unittest.rst:2515 msgid "" "This function is called unconditionally after :func:`tearDownModule`, or " "after :func:`setUpModule` if :func:`setUpModule` raises an exception." msgstr "" -#: ../../library/unittest.rst:2515 +#: ../../library/unittest.rst:2518 msgid "" "It is responsible for calling all the cleanup functions added by :func:" "`addModuleCleanup`. If you need cleanup functions to be called *prior* to :" "func:`tearDownModule` then you can call :func:`doModuleCleanups` yourself." msgstr "" -#: ../../library/unittest.rst:2520 +#: ../../library/unittest.rst:2523 msgid "" ":func:`doModuleCleanups` pops methods off the stack of cleanup functions one " "at a time, so it can be called at any time." msgstr "" -#: ../../library/unittest.rst:2527 +#: ../../library/unittest.rst:2530 msgid "Signal Handling" msgstr "" -#: ../../library/unittest.rst:2531 +#: ../../library/unittest.rst:2534 msgid "" "The :option:`-c/--catch ` command-line option to unittest, " "along with the ``catchbreak`` parameter to :func:`unittest.main`, provide " @@ -3680,7 +3680,7 @@ msgid "" "A second control-c will raise a :exc:`KeyboardInterrupt` in the usual way." msgstr "" -#: ../../library/unittest.rst:2538 +#: ../../library/unittest.rst:2541 msgid "" "The control-c handling signal handler attempts to remain compatible with " "code or tests that install their own :const:`signal.SIGINT` handler. If the " @@ -3692,48 +3692,48 @@ msgid "" "disabled the :func:`removeHandler` decorator can be used." msgstr "" -#: ../../library/unittest.rst:2547 +#: ../../library/unittest.rst:2550 msgid "" "There are a few utility functions for framework authors to enable control-c " "handling functionality within test frameworks." msgstr "" -#: ../../library/unittest.rst:2552 +#: ../../library/unittest.rst:2555 msgid "" "Install the control-c handler. When a :const:`signal.SIGINT` is received " "(usually in response to the user pressing control-c) all registered results " "have :meth:`~TestResult.stop` called." msgstr "" -#: ../../library/unittest.rst:2559 +#: ../../library/unittest.rst:2562 msgid "" "Register a :class:`TestResult` object for control-c handling. Registering a " "result stores a weak reference to it, so it doesn't prevent the result from " "being garbage collected." msgstr "" -#: ../../library/unittest.rst:2563 +#: ../../library/unittest.rst:2566 msgid "" "Registering a :class:`TestResult` object has no side-effects if control-c " "handling is not enabled, so test frameworks can unconditionally register all " "results they create independently of whether or not handling is enabled." msgstr "" -#: ../../library/unittest.rst:2570 +#: ../../library/unittest.rst:2573 msgid "" "Remove a registered result. Once a result has been removed then :meth:" "`~TestResult.stop` will no longer be called on that result object in " "response to a control-c." msgstr "" -#: ../../library/unittest.rst:2577 +#: ../../library/unittest.rst:2580 msgid "" "When called without arguments this function removes the control-c handler if " "it has been installed. This function can also be used as a test decorator to " "temporarily remove the handler while the test is being executed::" msgstr "" -#: ../../library/unittest.rst:2581 +#: ../../library/unittest.rst:2584 msgid "" "@unittest.removeHandler\n" "def test_signal_handling(self):\n" diff --git a/library/urllib.parse.po b/library/urllib.parse.po index d8aa51ce60..b5476ab963 100644 --- a/library/urllib.parse.po +++ b/library/urllib.parse.po @@ -80,9 +80,9 @@ msgstr "" #: ../../library/urllib.parse.rst:55 msgid "" "Parse a URL into six components, returning a 6-item :term:`named tuple`. " -"This corresponds to the general structure of a URL: ``scheme://netloc/path;" -"parameters?query#fragment``. Each tuple item is a string, possibly empty. " -"The components are not broken up into smaller parts (for example, the " +"This corresponds to the general structure of a URL: ``scheme://netloc/" +"path;parameters?query#fragment``. Each tuple item is a string, possibly " +"empty. The components are not broken up into smaller parts (for example, the " "network location is a single string), and % escapes are not expanded. The " "delimiters as shown above are not part of the result, except for a leading " "slash in the *path* component, which is retained if present. For example:" @@ -145,8 +145,8 @@ msgstr "" msgid "" ">>> from urllib.parse import urlparse\n" ">>> urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')\n" ">>> urlparse('www.cwi.nl/%7Eguido/Python.html')\n" "ParseResult(scheme='', netloc='', path='www.cwi.nl/%7Eguido/Python.html',\n" @@ -157,8 +157,8 @@ msgid "" msgstr "" ">>> from urllib.parse import urlparse\n" ">>> urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')\n" ">>> urlparse('www.cwi.nl/%7Eguido/Python.html')\n" "ParseResult(scheme='', netloc='', path='www.cwi.nl/%7Eguido/Python.html',\n" @@ -346,8 +346,8 @@ msgstr "" #: ../../library/urllib.parse.rst:150 ../../library/urllib.parse.rst:336 msgid "" -"Unmatched square brackets in the :attr:`netloc` attribute will raise a :exc:" -"`ValueError`." +"Unmatched square brackets in the :attr:`netloc` attribute will raise " +"a :exc:`ValueError`." msgstr "" #: ../../library/urllib.parse.rst:153 ../../library/urllib.parse.rst:339 @@ -361,9 +361,9 @@ msgstr "" #: ../../library/urllib.parse.rst:158 msgid "" "As is the case with all named tuples, the subclass has a few additional " -"methods and attributes that are particularly useful. One such method is :" -"meth:`_replace`. The :meth:`_replace` method will return a new ParseResult " -"object replacing specified fields with new values." +"methods and attributes that are particularly useful. One such method " +"is :meth:`_replace`. The :meth:`_replace` method will return a new " +"ParseResult object replacing specified fields with new values." msgstr "" #: ../../library/urllib.parse.rst:163 @@ -371,23 +371,23 @@ msgid "" ">>> from urllib.parse import urlparse\n" ">>> u = urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" ">>> u\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')\n" ">>> u._replace(scheme='http')\n" -"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')" msgstr "" ">>> from urllib.parse import urlparse\n" ">>> u = urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" ">>> u\n" -"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')\n" ">>> u._replace(scheme='http')\n" -"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/Python." -"html',\n" +"ParseResult(scheme='http', netloc='www.cwi.nl:80', path='/%7Eguido/" +"Python.html',\n" " params='', query='', fragment='')" #: ../../library/urllib.parse.rst:177 @@ -409,8 +409,8 @@ msgstr "" #: ../../library/urllib.parse.rst:188 ../../library/urllib.parse.rst:353 msgid "" -"Out-of-range port numbers now raise :exc:`ValueError`, instead of returning :" -"const:`None`." +"Out-of-range port numbers now raise :exc:`ValueError`, instead of " +"returning :const:`None`." msgstr "" #: ../../library/urllib.parse.rst:192 ../../library/urllib.parse.rst:357 @@ -421,10 +421,10 @@ msgstr "" #: ../../library/urllib.parse.rst:199 msgid "" -"Parse a query string given as a string argument (data of type :mimetype:" -"`application/x-www-form-urlencoded`). Data are returned as a dictionary. " -"The dictionary keys are the unique query variable names and the values are " -"lists of values for each name." +"Parse a query string given as a string argument (data of " +"type :mimetype:`application/x-www-form-urlencoded`). Data are returned as a " +"dictionary. The dictionary keys are the unique query variable names and the " +"values are lists of values for each name." msgstr "" #: ../../library/urllib.parse.rst:204 ../../library/urllib.parse.rst:249 @@ -446,8 +446,8 @@ msgstr "" #: ../../library/urllib.parse.rst:214 ../../library/urllib.parse.rst:259 msgid "" "The optional *encoding* and *errors* parameters specify how to decode " -"percent-encoded sequences into Unicode characters, as accepted by the :meth:" -"`bytes.decode` method." +"percent-encoded sequences into Unicode characters, as accepted by " +"the :meth:`bytes.decode` method." msgstr "" #: ../../library/urllib.parse.rst:218 ../../library/urllib.parse.rst:263 @@ -471,7 +471,7 @@ msgstr "" #: ../../library/urllib.parse.rst:230 ../../library/urllib.parse.rst:273 msgid "Add *encoding* and *errors* parameters." -msgstr "" +msgstr "新增 *encoding* 和 *errors* 參數。" #: ../../library/urllib.parse.rst:233 ../../library/urllib.parse.rst:276 msgid "Added *max_num_fields* parameter." @@ -487,9 +487,9 @@ msgstr "" #: ../../library/urllib.parse.rst:245 msgid "" -"Parse a query string given as a string argument (data of type :mimetype:" -"`application/x-www-form-urlencoded`). Data are returned as a list of name, " -"value pairs." +"Parse a query string given as a string argument (data of " +"type :mimetype:`application/x-www-form-urlencoded`). Data are returned as a " +"list of name, value pairs." msgstr "" #: ../../library/urllib.parse.rst:270 @@ -570,8 +570,8 @@ msgstr "" #: ../../library/urllib.parse.rst:389 msgid "" -"The *allow_fragments* argument has the same meaning and default as for :func:" -"`urlparse`." +"The *allow_fragments* argument has the same meaning and default as " +"for :func:`urlparse`." msgstr "" #: ../../library/urllib.parse.rst:394 @@ -638,10 +638,10 @@ msgstr "" #: ../../library/urllib.parse.rst:447 msgid "" -"Extract the url from a wrapped URL (that is, a string formatted as ````, ````, ``URL:scheme://host/path`` " -"or ``scheme://host/path``). If *url* is not a wrapped URL, it is returned " -"without changes." +"Extract the url from a wrapped URL (that is, a string formatted as " +"````, ````, ``URL:scheme://host/" +"path`` or ``scheme://host/path``). If *url* is not a wrapped URL, it is " +"returned without changes." msgstr "" #: ../../library/urllib.parse.rst:455 @@ -694,36 +694,37 @@ msgid "" "The URL parsing functions were originally designed to operate on character " "strings only. In practice, it is useful to be able to manipulate properly " "quoted and encoded URLs as sequences of ASCII bytes. Accordingly, the URL " -"parsing functions in this module all operate on :class:`bytes` and :class:" -"`bytearray` objects in addition to :class:`str` objects." +"parsing functions in this module all operate on :class:`bytes` " +"and :class:`bytearray` objects in addition to :class:`str` objects." msgstr "" #: ../../library/urllib.parse.rst:492 msgid "" -"If :class:`str` data is passed in, the result will also contain only :class:" -"`str` data. If :class:`bytes` or :class:`bytearray` data is passed in, the " -"result will contain only :class:`bytes` data." +"If :class:`str` data is passed in, the result will also contain " +"only :class:`str` data. If :class:`bytes` or :class:`bytearray` data is " +"passed in, the result will contain only :class:`bytes` data." msgstr "" #: ../../library/urllib.parse.rst:496 msgid "" -"Attempting to mix :class:`str` data with :class:`bytes` or :class:" -"`bytearray` in a single function call will result in a :exc:`TypeError` " -"being raised, while attempting to pass in non-ASCII byte values will " -"trigger :exc:`UnicodeDecodeError`." +"Attempting to mix :class:`str` data with :class:`bytes` " +"or :class:`bytearray` in a single function call will result in " +"a :exc:`TypeError` being raised, while attempting to pass in non-ASCII byte " +"values will trigger :exc:`UnicodeDecodeError`." msgstr "" #: ../../library/urllib.parse.rst:501 msgid "" -"To support easier conversion of result objects between :class:`str` and :" -"class:`bytes`, all return values from URL parsing functions provide either " -"an :meth:`encode` method (when the result contains :class:`str` data) or a :" -"meth:`decode` method (when the result contains :class:`bytes` data). The " -"signatures of these methods match those of the corresponding :class:`str` " -"and :class:`bytes` methods (except that the default encoding is ``'ascii'`` " -"rather than ``'utf-8'``). Each produces a value of a corresponding type that " -"contains either :class:`bytes` data (for :meth:`encode` methods) or :class:" -"`str` data (for :meth:`decode` methods)." +"To support easier conversion of result objects between :class:`str` " +"and :class:`bytes`, all return values from URL parsing functions provide " +"either an :meth:`encode` method (when the result contains :class:`str` data) " +"or a :meth:`decode` method (when the result contains :class:`bytes` data). " +"The signatures of these methods match those of the " +"corresponding :class:`str` and :class:`bytes` methods (except that the " +"default encoding is ``'ascii'`` rather than ``'utf-8'``). Each produces a " +"value of a corresponding type that contains either :class:`bytes` data " +"(for :meth:`encode` methods) or :class:`str` data (for :meth:`decode` " +"methods)." msgstr "" #: ../../library/urllib.parse.rst:512 @@ -751,9 +752,9 @@ msgstr "" #: ../../library/urllib.parse.rst:530 msgid "" -"The result objects from the :func:`urlparse`, :func:`urlsplit` and :func:" -"`urldefrag` functions are subclasses of the :class:`tuple` type. These " -"subclasses add the attributes listed in the documentation for those " +"The result objects from the :func:`urlparse`, :func:`urlsplit` " +"and :func:`urldefrag` functions are subclasses of the :class:`tuple` type. " +"These subclasses add the attributes listed in the documentation for those " "functions, the encoding and decoding support described in the previous " "section, as well as an additional method:" msgstr "" @@ -866,8 +867,8 @@ msgid "" "ASCII characters, as accepted by the :meth:`str.encode` method. *encoding* " "defaults to ``'utf-8'``. *errors* defaults to ``'strict'``, meaning " "unsupported characters raise a :class:`UnicodeEncodeError`. *encoding* and " -"*errors* must not be supplied if *string* is a :class:`bytes`, or a :class:" -"`TypeError` is raised." +"*errors* must not be supplied if *string* is a :class:`bytes`, or " +"a :class:`TypeError` is raised." msgstr "" #: ../../library/urllib.parse.rst:643 @@ -894,8 +895,8 @@ msgstr "" #: ../../library/urllib.parse.rst:661 msgid "" -"Like :func:`quote`, but accepts a :class:`bytes` object rather than a :class:" -"`str`, and does not perform string-to-bytes encoding." +"Like :func:`quote`, but accepts a :class:`bytes` object rather than " +"a :class:`str`, and does not perform string-to-bytes encoding." msgstr "" #: ../../library/urllib.parse.rst:664 @@ -906,8 +907,8 @@ msgstr "" msgid "" "Replace :samp:`%{xx}` escapes with their single-character equivalent. The " "optional *encoding* and *errors* parameters specify how to decode percent-" -"encoded sequences into Unicode characters, as accepted by the :meth:`bytes." -"decode` method." +"encoded sequences into Unicode characters, as accepted by " +"the :meth:`bytes.decode` method." msgstr "" #: ../../library/urllib.parse.rst:677 @@ -1003,9 +1004,9 @@ msgstr "" #: ../../library/urllib.parse.rst:747 msgid "" -"Refer to :ref:`urllib examples ` to find out how the :func:" -"`urllib.parse.urlencode` method can be used for generating the query string " -"of a URL or data for a POST request." +"Refer to :ref:`urllib examples ` to find out how " +"the :func:`urllib.parse.urlencode` method can be used for generating the " +"query string of a URL or data for a POST request." msgstr "" #: ../../library/urllib.parse.rst:751 diff --git a/library/urllib.request.po b/library/urllib.request.po index e18223387e..0e3384e9e9 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-25 00:14+0000\n" +"POT-Creation-Date: 2025-03-24 00:15+0000\n" "PO-Revision-Date: 2022-04-21 17:59+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,8 +42,8 @@ msgid "" "The `Requests package `_ is " "recommended for a higher-level HTTP client interface." msgstr "" -"有關於更高階的 HTTP 用戶端介面,推薦使用 `Requests 套件 `_。" +"有關於更高階的 HTTP 用戶端介面,推薦使用 `Requests 套件 `_。" #: ../../library/urllib.request.rst:26 msgid "" @@ -74,8 +74,8 @@ msgid "" "Open *url*, which can be either a string containing a valid, properly " "encoded URL, or a :class:`Request` object." msgstr "" -"打開 *url*,其值可以是一個包含有效且適當編碼 URL 的字串或是一個 :class:" -"`Request` 物件。" +"打開 *url*,其值可以是一個包含有效且適當編碼 URL 的字串或是一" +"個 :class:`Request` 物件。" #: ../../library/urllib.request.rst:42 msgid "" @@ -108,8 +108,8 @@ msgstr "" #: ../../library/urllib.request.rst:54 msgid "" "If *context* is specified, it must be a :class:`ssl.SSLContext` instance " -"describing the various SSL options. See :class:`~http.client." -"HTTPSConnection` for more details." +"describing the various SSL options. " +"See :class:`~http.client.HTTPSConnection` for more details." msgstr "" "若 *context* 有被指定時,它必須是一個 :class:`ssl.SSLContext` 的實例並描述著" "各種 SSL 選項。更多細節請見 :class:`~http.client.HTTPSConnection`。" @@ -117,37 +117,37 @@ msgstr "" #: ../../library/urllib.request.rst:58 msgid "" "This function always returns an object which can work as a :term:`context " -"manager` and has the properties *url*, *headers*, and *status*. See :class:" -"`urllib.response.addinfourl` for more detail on these properties." +"manager` and has the properties *url*, *headers*, and *status*. " +"See :class:`urllib.response.addinfourl` for more detail on these properties." msgstr "" "這個函式總是回傳一個可作為 :term:`context manager` 使用的物件,並有著特性 " -"(property) *url*、*headers* 與 *status*。欲知更多這些特性細節請參見 :class:" -"`urllib.response.addinfourl`。" +"(property) *url*、*headers* 與 *status*。欲知更多這些特性細節請參" +"見 :class:`urllib.response.addinfourl`。" #: ../../library/urllib.request.rst:62 msgid "" -"For HTTP and HTTPS URLs, this function returns a :class:`http.client." -"HTTPResponse` object slightly modified. In addition to the three new methods " -"above, the msg attribute contains the same information as the :attr:`~http." -"client.HTTPResponse.reason` attribute --- the reason phrase returned by " -"server --- instead of the response headers as it is specified in the " -"documentation for :class:`~http.client.HTTPResponse`." +"For HTTP and HTTPS URLs, this function returns " +"a :class:`http.client.HTTPResponse` object slightly modified. In addition to " +"the three new methods above, the msg attribute contains the same information " +"as the :attr:`~http.client.HTTPResponse.reason` attribute --- the reason " +"phrase returned by server --- instead of the response headers as it is " +"specified in the documentation for :class:`~http.client.HTTPResponse`." msgstr "" -"對於 HTTP 與 HTTPS 的 URLs,這個函式回傳一個稍有不同的 :class:`http.client." -"HTTPResponse` 物件。除了上述提到的三個方法外,另有 msg 屬性並有著與 :attr:" -"`~http.client.HTTPResponse.reason` 相同的資訊 --- 由伺服器回傳的原因敘述 " -"(reason phrase),而不是在 :class:`~http.client.HTTPResponse` 文件中提到的回" -"應 headers。" +"對於 HTTP 與 HTTPS 的 URLs,這個函式回傳一個稍有不同" +"的 :class:`http.client.HTTPResponse` 物件。除了上述提到的三個方法外,另有 " +"msg 屬性並有著與 :attr:`~http.client.HTTPResponse.reason` 相同的資訊 --- 由伺" +"服器回傳的原因敘述 (reason phrase),而不是" +"在 :class:`~http.client.HTTPResponse` 文件中提到的回應 headers。" #: ../../library/urllib.request.rst:70 msgid "" -"For FTP, file, and data URLs and requests explicitly handled by legacy :" -"class:`URLopener` and :class:`FancyURLopener` classes, this function returns " -"a :class:`urllib.response.addinfourl` object." +"For FTP, file, and data URLs and requests explicitly handled by " +"legacy :class:`URLopener` and :class:`FancyURLopener` classes, this function " +"returns a :class:`urllib.response.addinfourl` object." msgstr "" -"對於 FTP、檔案、資料的 URLs、以及那些由傳統 classes :class:`URLopener` 與 :" -"class:`FancyURLopener` 所處理的請求,這個函式會回傳一個 :class:`urllib." -"response.addinfourl` 物件。" +"對於 FTP、檔案、資料的 URLs、以及那些由傳統 classes :class:`URLopener` " +"與 :class:`FancyURLopener` 所處理的請求,這個函式會回傳一" +"個 :class:`urllib.response.addinfourl` 物件。" #: ../../library/urllib.request.rst:74 msgid "Raises :exc:`~urllib.error.URLError` on protocol errors." @@ -156,8 +156,8 @@ msgstr "當遇到協定上的錯誤時會引發 :exc:`~urllib.error.URLError`。 #: ../../library/urllib.request.rst:76 msgid "" "Note that ``None`` may be returned if no handler handles the request (though " -"the default installed global :class:`OpenerDirector` uses :class:" -"`UnknownHandler` to ensure this never happens)." +"the default installed global :class:`OpenerDirector` " +"uses :class:`UnknownHandler` to ensure this never happens)." msgstr "" "請注意若沒有 handler 處理請求時,``None`` 值將會被回傳。(即使有預設的全域類" "別 :class:`OpenerDirector` 使用 :class:`UnknownHandler` 來確保這種情況不會發" @@ -166,9 +166,9 @@ msgstr "" #: ../../library/urllib.request.rst:80 msgid "" "In addition, if proxy settings are detected (for example, when a ``*_proxy`` " -"environment variable like :envvar:`!http_proxy` is set), :class:" -"`ProxyHandler` is default installed and makes sure the requests are handled " -"through the proxy." +"environment variable like :envvar:`!http_proxy` is " +"set), :class:`ProxyHandler` is default installed and makes sure the requests " +"are handled through the proxy." msgstr "" "另外,若有偵測到代理服務的設定(例如當 ``*_proxy`` 環境變數像是::envvar:!" "http_proxy` 有被設置時),:class:`ProxyHandler` 會被預設使用以確保請求有透過" @@ -179,19 +179,19 @@ msgid "" "The legacy ``urllib.urlopen`` function from Python 2.6 and earlier has been " "discontinued; :func:`urllib.request.urlopen` corresponds to the old " "``urllib2.urlopen``. Proxy handling, which was done by passing a dictionary " -"parameter to ``urllib.urlopen``, can be obtained by using :class:" -"`ProxyHandler` objects." +"parameter to ``urllib.urlopen``, can be obtained by " +"using :class:`ProxyHandler` objects." msgstr "" -"Python 2.6 或更早版本的遺留函式 ``urllib.urlopen`` 已經不再被維護;新函式 :" -"func:`urllib.request.urlopen` 對應到舊函式 ``urllib2.urlopen``。有關代理服務" -"的處理,以往是透過傳遞 dictionary(字典)參數給 ``urllib.urlopen`` 來取得的," -"現在則可以透過 :class:`ProxyHandler` 物件來取得。" +"Python 2.6 或更早版本的遺留函式 ``urllib.urlopen`` 已經不再被維護;新函" +"式 :func:`urllib.request.urlopen` 對應到舊函式 ``urllib2.urlopen``。有關代理" +"服務的處理,以往是透過傳遞 dictionary(字典)參數給 ``urllib.urlopen`` 來取得" +"的,現在則可以透過 :class:`ProxyHandler` 物件來取得。" #: ../../library/urllib.request.rst:91 ../../library/urllib.request.rst:93 msgid "" -"The default opener raises an :ref:`auditing event ` ``urllib." -"Request`` with arguments ``fullurl``, ``data``, ``headers``, ``method`` " -"taken from the request object." +"The default opener raises an :ref:`auditing event ` " +"``urllib.Request`` with arguments ``fullurl``, ``data``, ``headers``, " +"``method`` taken from the request object." msgstr "" "預設的 opener 會觸發一個 :ref:`auditing event ` ``urllib.Request`` " "與其從請求物件中所獲得的引數 ``fullurl``、``data``、``headers``、``method``。" @@ -202,8 +202,8 @@ msgstr "新增 *cafile* 與 *capath*。" #: ../../library/urllib.request.rst:100 msgid "" -"HTTPS virtual hosts are now supported if possible (that is, if :const:`ssl." -"HAS_SNI` is true)." +"HTTPS virtual hosts are now supported if possible (that is, " +"if :const:`ssl.HAS_SNI` is true)." msgstr "" "HTTPS 虛擬主機 (virtual hosts) 現已支援,只要 :const:`ssl.HAS_SNI` 的值為 " "true。" @@ -222,13 +222,13 @@ msgstr "*context* 被新增。" #: ../../library/urllib.request.rst:111 msgid "" -"HTTPS connection now send an ALPN extension with protocol indicator " -"``http/1.1`` when no *context* is given. Custom *context* should set ALPN " -"protocols with :meth:`~ssl.SSLContext.set_alpn_protocols`." +"HTTPS connection now send an ALPN extension with protocol indicator ``http/" +"1.1`` when no *context* is given. Custom *context* should set ALPN protocols " +"with :meth:`~ssl.SSLContext.set_alpn_protocols`." msgstr "" -"當 *context* 沒有被指定時,HTTPS 連線現在會傳送一個帶有協定指示器 " -"``http/1.1`` 的 ALPN 擴充 (extension)。自訂的 *context* 應該利用 :meth:`~ssl." -"SSLContext.set_alpn_protocols` 來自行設定 ALPN 協定。" +"當 *context* 沒有被指定時,HTTPS 連線現在會傳送一個帶有協定指示器 ``http/" +"1.1`` 的 ALPN 擴充 (extension)。自訂的 *context* 應該利" +"用 :meth:`~ssl.SSLContext.set_alpn_protocols` 來自行設定 ALPN 協定。" #: ../../library/urllib.request.rst:116 msgid "" @@ -240,15 +240,16 @@ msgstr "" msgid "" "Install an :class:`OpenerDirector` instance as the default global opener. " "Installing an opener is only necessary if you want urlopen to use that " -"opener; otherwise, simply call :meth:`OpenerDirector.open` instead of :func:" -"`~urllib.request.urlopen`. The code does not check for a real :class:" -"`OpenerDirector`, and any class with the appropriate interface will work." +"opener; otherwise, simply call :meth:`OpenerDirector.open` instead " +"of :func:`~urllib.request.urlopen`. The code does not check for a " +"real :class:`OpenerDirector`, and any class with the appropriate interface " +"will work." msgstr "" "安裝一個 :class:`OpenerDirector` 實例作為預設的全域 opener。僅在當你想要讓 " -"urlopen 使用該 opener 時安裝一個 opener,否則的話應直接呼叫 :meth:" -"`OpenerDirector.open` 而非 :func:`~urllib.request.urlopen`。程式碼不會檢查 " -"class 是否真的為 :class:`OpenerDirector`,而是任何具有正確介面的 class 都能適" -"用。" +"urlopen 使用該 opener 時安裝一個 opener,否則的話應直接呼" +"叫 :meth:`OpenerDirector.open` 而非 :func:`~urllib.request.urlopen`。程式碼不" +"會檢查 class 是否真的為 :class:`OpenerDirector`,而是任何具有正確介面的 " +"class 都能適用。" #: ../../library/urllib.request.rst:133 msgid "" @@ -258,19 +259,15 @@ msgid "" "call the constructor without any parameters). Instances of the following " "classes will be in front of the *handler*\\s, unless the *handler*\\s " "contain them, instances of them or subclasses of them: :class:`ProxyHandler` " -"(if proxy settings are detected), :class:`UnknownHandler`, :class:" -"`HTTPHandler`, :class:`HTTPDefaultErrorHandler`, :class:" -"`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`, :class:" -"`HTTPErrorProcessor`." +"(if proxy settings are " +"detected), :class:`UnknownHandler`, :class:`HTTPHandler`, :class:`HTTPDefaultErrorHandler`, :class:`HTTPRedirectHandler`, :class:`FTPHandler`, :class:`FileHandler`, :class:`HTTPErrorProcessor`." msgstr "" "回傳一個 :class:`OpenerDirector` 實例,以給定的順序把 handlers 串接起來。" "*handler*\\s 可以是 :class:`BaseHandler` 的實例,亦或是 :class:`BaseHandler` " "的 subclasses(這個情況下必須有不帶參數的建構函式能夠被呼叫)。以下 classes " "的實例順位會在 *handler*\\s 之前,除非 *handler*\\s 已經包含它們,是它們的實" "例,或是它們的 subclasses::class:`ProxyHandler`\\ (如果代理服務設定被偵測" -"到)、:class:`UnknownHandler`、:class:`HTTPHandler`、:class:" -"`HTTPDefaultErrorHandler`、:class:`HTTPRedirectHandler`、:class:" -"`FTPHandler`、:class:`FileHandler`、:class:`HTTPErrorProcessor`。" +"到)、:class:`UnknownHandler`、:class:`HTTPHandler`、:class:`HTTPDefaultErrorHandler`、:class:`HTTPRedirectHandler`、:class:`FTPHandler`、:class:`FileHandler`、:class:`HTTPErrorProcessor`。" #: ../../library/urllib.request.rst:143 msgid "" @@ -290,10 +287,10 @@ msgstr "" #: ../../library/urllib.request.rst:152 msgid "" -"Convert the given local path to a ``file:`` URL. This function uses :func:" -"`~urllib.parse.quote` function to encode the path. For historical reasons, " -"the return value omits the ``file:`` scheme prefix. This example shows the " -"function being used on Windows::" +"Convert the given local path to a ``file:`` URL. This function " +"uses :func:`~urllib.parse.quote` function to encode the path. For historical " +"reasons, the return value omits the ``file:`` scheme prefix. This example " +"shows the function being used on Windows::" msgstr "" #: ../../library/urllib.request.rst:157 @@ -310,10 +307,10 @@ msgstr "" #: ../../library/urllib.request.rst:165 msgid "" -"Convert the given ``file:`` URL to a local path. This function uses :func:" -"`~urllib.parse.unquote` to decode the URL. For historical reasons, the given " -"value *must* omit the ``file:`` scheme prefix. This example shows the " -"function being used on Windows::" +"Convert the given ``file:`` URL to a local path. This function " +"uses :func:`~urllib.parse.unquote` to decode the URL. For historical " +"reasons, the given value *must* omit the ``file:`` scheme prefix. This " +"example shows the function being used on Windows::" msgstr "" #: ../../library/urllib.request.rst:170 @@ -395,11 +392,11 @@ msgstr "" #: ../../library/urllib.request.rst:214 msgid "" -"For an HTTP POST request method, *data* should be a buffer in the standard :" -"mimetype:`application/x-www-form-urlencoded` format. The :func:`urllib." -"parse.urlencode` function takes a mapping or sequence of 2-tuples and " -"returns an ASCII string in this format. It should be encoded to bytes before " -"being used as the *data* parameter." +"For an HTTP POST request method, *data* should be a buffer in the " +"standard :mimetype:`application/x-www-form-urlencoded` format. " +"The :func:`urllib.parse.urlencode` function takes a mapping or sequence of 2-" +"tuples and returns an ASCII string in this format. It should be encoded to " +"bytes before being used as the *data* parameter." msgstr "" "對於一個 HTTP POST 請求方法,*data* 應為一個標準 :mimetype:`application/x-" "www-form-urlencoded` 格式的 buffer。:func:`urllib.parse.urlencode` 方法接受一" @@ -408,10 +405,10 @@ msgstr "" #: ../../library/urllib.request.rst:220 msgid "" -"*headers* should be a dictionary, and will be treated as if :meth:" -"`add_header` was called with each key and value as arguments. This is often " -"used to \"spoof\" the ``User-Agent`` header value, which is used by a " -"browser to identify itself -- some HTTP servers only allow requests coming " +"*headers* should be a dictionary, and will be treated as " +"if :meth:`add_header` was called with each key and value as arguments. This " +"is often used to \"spoof\" the ``User-Agent`` header value, which is used by " +"a browser to identify itself -- some HTTP servers only allow requests coming " "from common browsers as opposed to scripts. For example, Mozilla Firefox may " "identify itself as ``\"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 " "Firefox/2.0.0.11\"``, while :mod:`urllib`'s default user agent string is " @@ -422,10 +419,9 @@ msgstr "" "叫 :meth:`add_header`。經常用於「偽裝」 ``User-Agent`` header 的值,這個 " "header 是用來讓一個瀏覽器向伺服器表明自己的身分 --- 有些 HTTP 伺服器僅允許來" "自普通瀏覽器的請求,而不接受來自程式腳本的請求。例如,Mozilla Firefox 會將 " -"header 的值設為 ``\"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 " -"Firefox/2.0.0.11\"``,而 :mod:`urllib` 的值則是 ``\"Python-urllib/2.6\"``\\ " -"(在 Python 2.6 上)。所有 header 的鍵都會以 camel case(駝峰式大小寫)來傳" -"送。" +"header 的值設為 ``\"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/" +"2.0.0.11\"``,而 :mod:`urllib` 的值則是 ``\"Python-urllib/2.6\"``\\ (在 " +"Python 2.6 上)。所有 header 的鍵都會以 camel case(駝峰式大小寫)來傳送。" #: ../../library/urllib.request.rst:231 msgid "" @@ -448,16 +444,16 @@ msgstr "" #: ../../library/urllib.request.rst:239 msgid "" "*origin_req_host* should be the request-host of the origin transaction, as " -"defined by :rfc:`2965`. It defaults to ``http.cookiejar." -"request_host(self)``. This is the host name or IP address of the original " -"request that was initiated by the user. For example, if the request is for " -"an image in an HTML document, this should be the request-host of the request " -"for the page containing the image." +"defined by :rfc:`2965`. It defaults to " +"``http.cookiejar.request_host(self)``. This is the host name or IP address " +"of the original request that was initiated by the user. For example, if the " +"request is for an image in an HTML document, this should be the request-host " +"of the request for the page containing the image." msgstr "" -"*origin_req_host* 應為原始傳輸互動的請求主機 (request-host),如同在 :rfc:" -"`2965` 中的定義。預設值為 ``http.cookiejar.request_host(self)``。這是使用者發" -"起的原始請求的主機名稱或是 IP 位址。例如當請求是要求一個 HTML 文件中的一個影" -"像,則這個屬性應為請求包含影像頁面的請求主機。" +"*origin_req_host* 應為原始傳輸互動的請求主機 (request-host),如同" +"在 :rfc:`2965` 中的定義。預設值為 ``http.cookiejar.request_host(self)``。這是" +"使用者發起的原始請求的主機名稱或是 IP 位址。例如當請求是要求一個 HTML 文件中" +"的一個影像,則這個屬性應為請求包含影像頁面的請求主機。" #: ../../library/urllib.request.rst:247 msgid "" @@ -475,11 +471,11 @@ msgstr "" #: ../../library/urllib.request.rst:254 msgid "" "*method* should be a string that indicates the HTTP request method that will " -"be used (e.g. ``'HEAD'``). If provided, its value is stored in the :attr:" -"`~Request.method` attribute and is used by :meth:`get_method`. The default " -"is ``'GET'`` if *data* is ``None`` or ``'POST'`` otherwise. Subclasses may " -"indicate a different default method by setting the :attr:`~Request.method` " -"attribute in the class itself." +"be used (e.g. ``'HEAD'``). If provided, its value is stored in " +"the :attr:`~Request.method` attribute and is used by :meth:`get_method`. The " +"default is ``'GET'`` if *data* is ``None`` or ``'POST'`` otherwise. " +"Subclasses may indicate a different default method by setting " +"the :attr:`~Request.method` attribute in the class itself." msgstr "" "*method* 應為一個標示 HTTP 請求方法的字串(例如:``'HEAD'``)。如果有提供值," "則會被存在 :attr:`~Request.method` 屬性中且被 :meth:`get_method` 所使用。當 " @@ -598,9 +594,9 @@ msgstr "" msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " -"that is compatible with :class:`HTTPPasswordMgr`; refer to section :ref:" -"`http-password-mgr` for information on the interface that must be " -"supported. If *passwd_mgr* also provides ``is_authenticated`` and " +"that is compatible with :class:`HTTPPasswordMgr`; refer to " +"section :ref:`http-password-mgr` for information on the interface that must " +"be supported. If *passwd_mgr* also provides ``is_authenticated`` and " "``update_authenticated`` methods (see :ref:`http-password-mgr-with-prior-" "auth`), then the handler will use the ``is_authenticated`` result for a " "given URI to determine whether or not to send authentication credentials " @@ -638,8 +634,9 @@ msgstr "" msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " -"that is compatible with :class:`HTTPPasswordMgr`; refer to section :ref:" -"`http-password-mgr` for information on the interface that must be supported." +"that is compatible with :class:`HTTPPasswordMgr`; refer to " +"section :ref:`http-password-mgr` for information on the interface that must " +"be supported." msgstr "" #: ../../library/urllib.request.rst:404 @@ -715,9 +712,9 @@ msgstr "" #: ../../library/urllib.request.rst:487 msgid "" -"Request.full_url is a property with setter, getter and a deleter. Getting :" -"attr:`~Request.full_url` returns the original request URL with the fragment, " -"if it was present." +"Request.full_url is a property with setter, getter and a deleter. " +"Getting :attr:`~Request.full_url` returns the original request URL with the " +"fragment, if it was present." msgstr "" #: ../../library/urllib.request.rst:493 @@ -752,8 +749,8 @@ msgstr "" #: ../../library/urllib.request.rst:519 msgid "" -"boolean, indicates whether the request is unverifiable as defined by :rfc:" -"`2965`." +"boolean, indicates whether the request is unverifiable as defined " +"by :rfc:`2965`." msgstr "" #: ../../library/urllib.request.rst:524 @@ -775,10 +772,10 @@ msgstr "" #: ../../library/urllib.request.rst:541 msgid "" -"Return a string indicating the HTTP request method. If :attr:`Request." -"method` is not ``None``, return its value, otherwise return ``'GET'`` if :" -"attr:`Request.data` is ``None``, or ``'POST'`` if it's not. This is only " -"meaningful for HTTP requests." +"Return a string indicating the HTTP request method. " +"If :attr:`Request.method` is not ``None``, return its value, otherwise " +"return ``'GET'`` if :attr:`Request.data` is ``None``, or ``'POST'`` if it's " +"not. This is only meaningful for HTTP requests." msgstr "" #: ../../library/urllib.request.rst:546 @@ -859,10 +856,10 @@ msgid "" "*handler* should be an instance of :class:`BaseHandler`. The following " "methods are searched, and added to the possible chains (note that HTTP " "errors are a special case). Note that, in the following, *protocol* should " -"be replaced with the actual protocol to handle, for example :meth:" -"`http_response` would be the HTTP protocol response handler. Also *type* " -"should be replaced with the actual HTTP code, for example :meth:" -"`http_error_404` would handle HTTP 404 errors." +"be replaced with the actual protocol to handle, for " +"example :meth:`http_response` would be the HTTP protocol response handler. " +"Also *type* should be replaced with the actual HTTP code, for " +"example :meth:`http_error_404` would handle HTTP 404 errors." msgstr "" #: ../../library/urllib.request.rst:631 @@ -956,25 +953,27 @@ msgstr "" #: ../../library/urllib.request.rst:689 msgid "" "Handlers with a method named like :meth:`!_open` are called to " -"handle the request. This stage ends when a handler either returns a non-\\ :" -"const:`None` value (ie. a response), or raises an exception (usually :exc:" -"`~urllib.error.URLError`). Exceptions are allowed to propagate." +"handle the request. This stage ends when a handler either returns a non-" +"\\ :const:`None` value (ie. a response), or raises an exception " +"(usually :exc:`~urllib.error.URLError`). Exceptions are allowed to " +"propagate." msgstr "" #: ../../library/urllib.request.rst:694 msgid "" -"In fact, the above algorithm is first tried for methods named :meth:" -"`~BaseHandler.default_open`. If all such methods return :const:`None`, the " -"algorithm is repeated for methods named like :meth:`!_open`. If " -"all such methods return :const:`None`, the algorithm is repeated for methods " +"In fact, the above algorithm is first tried for methods " +"named :meth:`~BaseHandler.default_open`. If all such methods " +"return :const:`None`, the algorithm is repeated for methods named " +"like :meth:`!_open`. If all such methods return :const:`None`, " +"the algorithm is repeated for methods " "named :meth:`~BaseHandler.unknown_open`." msgstr "" #: ../../library/urllib.request.rst:700 msgid "" "Note that the implementation of these methods may involve calls of the " -"parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` and :" -"meth:`~OpenerDirector.error` methods." +"parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` " +"and :meth:`~OpenerDirector.error` methods." msgstr "" #: ../../library/urllib.request.rst:704 @@ -1011,8 +1010,8 @@ msgstr "" #: ../../library/urllib.request.rst:732 msgid "" "The convention has been adopted that subclasses defining :meth:`!" -"_request` or :meth:`!_response` methods are named :class:" -"`!\\*Processor`; all others are named :class:`!\\*Handler`." +"_request` or :meth:`!_response` methods are " +"named :class:`!\\*Processor`; all others are named :class:`!\\*Handler`." msgstr "" #: ../../library/urllib.request.rst:739 @@ -1029,12 +1028,13 @@ msgstr "" #: ../../library/urllib.request.rst:748 msgid "" -"This method, if implemented, will be called by the parent :class:" -"`OpenerDirector`. It should return a file-like object as described in the " -"return value of the :meth:`~OpenerDirector.open` method of :class:" -"`OpenerDirector`, or ``None``. It should raise :exc:`~urllib.error." -"URLError`, unless a truly exceptional thing happens (for example, :exc:" -"`MemoryError` should not be mapped to :exc:`~urllib.error.URLError`)." +"This method, if implemented, will be called by the " +"parent :class:`OpenerDirector`. It should return a file-like object as " +"described in the return value of the :meth:`~OpenerDirector.open` method " +"of :class:`OpenerDirector`, or ``None``. It should " +"raise :exc:`~urllib.error.URLError`, unless a truly exceptional thing " +"happens (for example, :exc:`MemoryError` should not be mapped " +"to :exc:`~urllib.error.URLError`)." msgstr "" #: ../../library/urllib.request.rst:755 @@ -1049,9 +1049,9 @@ msgstr "" #: ../../library/urllib.request.rst:765 msgid "" -"This method, if defined, will be called by the parent :class:" -"`OpenerDirector`. Return values should be the same as for :meth:" -"`~BaseHandler.default_open`." +"This method, if defined, will be called by the " +"parent :class:`OpenerDirector`. Return values should be the same as " +"for :meth:`~BaseHandler.default_open`." msgstr "" #: ../../library/urllib.request.rst:771 @@ -1063,18 +1063,18 @@ msgstr "" #: ../../library/urllib.request.rst:775 msgid "" -"This method, if implemented, will be called by the :attr:`parent` :class:" -"`OpenerDirector`. Return values should be the same as for :meth:" -"`default_open`." +"This method, if implemented, will be called by " +"the :attr:`parent` :class:`OpenerDirector`. Return values should be the " +"same as for :meth:`default_open`." msgstr "" #: ../../library/urllib.request.rst:782 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "override it if they intend to provide a catch-all for otherwise unhandled " -"HTTP errors. It will be called automatically by the :class:" -"`OpenerDirector` getting the error, and should not normally be called in " -"other circumstances." +"HTTP errors. It will be called automatically by " +"the :class:`OpenerDirector` getting the error, and should not normally be " +"called in other circumstances." msgstr "" #: ../../library/urllib.request.rst:787 @@ -1087,8 +1087,8 @@ msgstr "" #: ../../library/urllib.request.rst:792 msgid "" -"Return values and exceptions raised should be the same as those of :func:" -"`urlopen`." +"Return values and exceptions raised should be the same as those " +"of :func:`urlopen`." msgstr "" #: ../../library/urllib.request.rst:799 @@ -1104,8 +1104,8 @@ msgstr "" #: ../../library/urllib.request.rst:805 msgid "" -"Arguments, return values and exceptions raised should be the same as for :" -"meth:`~BaseHandler.http_error_default`." +"Arguments, return values and exceptions raised should be the same as " +"for :meth:`~BaseHandler.http_error_default`." msgstr "" #: ../../library/urllib.request.rst:813 @@ -1116,9 +1116,9 @@ msgstr "" #: ../../library/urllib.request.rst:816 msgid "" -"This method, if defined, will be called by the parent :class:" -"`OpenerDirector`. *req* will be a :class:`Request` object. The return value " -"should be a :class:`Request` object." +"This method, if defined, will be called by the " +"parent :class:`OpenerDirector`. *req* will be a :class:`Request` object. The " +"return value should be a :class:`Request` object." msgstr "" #: ../../library/urllib.request.rst:825 @@ -1129,11 +1129,11 @@ msgstr "" #: ../../library/urllib.request.rst:828 msgid "" -"This method, if defined, will be called by the parent :class:" -"`OpenerDirector`. *req* will be a :class:`Request` object. *response* will " -"be an object implementing the same interface as the return value of :func:" -"`urlopen`. The return value should implement the same interface as the " -"return value of :func:`urlopen`." +"This method, if defined, will be called by the " +"parent :class:`OpenerDirector`. *req* will be a :class:`Request` object. " +"*response* will be an object implementing the same interface as the return " +"value of :func:`urlopen`. The return value should implement the same " +"interface as the return value of :func:`urlopen`." msgstr "" #: ../../library/urllib.request.rst:838 @@ -1160,18 +1160,19 @@ msgid "" "called by the default implementations of the :meth:`!http_error_30\\*` " "methods when a redirection is received from the server. If a redirection " "should take place, return a new :class:`Request` to allow :meth:`!" -"http_error_30\\*` to perform the redirect to *newurl*. Otherwise, raise :" -"exc:`~urllib.error.HTTPError` if no other handler should try to handle this " -"URL, or return ``None`` if you can't but another handler might." +"http_error_30\\*` to perform the redirect to *newurl*. Otherwise, " +"raise :exc:`~urllib.error.HTTPError` if no other handler should try to " +"handle this URL, or return ``None`` if you can't but another handler might." msgstr "" #: ../../library/urllib.request.rst:863 msgid "" -"The default implementation of this method does not strictly follow :rfc:" -"`2616`, which says that 301 and 302 responses to ``POST`` requests must not " -"be automatically redirected without confirmation by the user. In reality, " -"browsers do allow automatic redirection of these responses, changing the " -"POST to a ``GET``, and the default implementation reproduces this behavior." +"The default implementation of this method does not strictly " +"follow :rfc:`2616`, which says that 301 and 302 responses to ``POST`` " +"requests must not be automatically redirected without confirmation by the " +"user. In reality, browsers do allow automatic redirection of these " +"responses, changing the POST to a ``GET``, and the default implementation " +"reproduces this behavior." msgstr "" #: ../../library/urllib.request.rst:872 @@ -1236,8 +1237,8 @@ msgstr "HTTPPasswordMgr 物件" #: ../../library/urllib.request.rst:935 msgid "" -"These methods are available on :class:`HTTPPasswordMgr` and :class:" -"`HTTPPasswordMgrWithDefaultRealm` objects." +"These methods are available on :class:`HTTPPasswordMgr` " +"and :class:`HTTPPasswordMgrWithDefaultRealm` objects." msgstr "" #: ../../library/urllib.request.rst:941 @@ -1273,10 +1274,10 @@ msgstr "" #: ../../library/urllib.request.rst:968 msgid "" -"*realm*, *uri*, *user*, *passwd* are as for :meth:`HTTPPasswordMgr." -"add_password`. *is_authenticated* sets the initial value of the " -"``is_authenticated`` flag for the given URI or list of URIs. If " -"*is_authenticated* is specified as ``True``, *realm* is ignored." +"*realm*, *uri*, *user*, *passwd* are as " +"for :meth:`HTTPPasswordMgr.add_password`. *is_authenticated* sets the " +"initial value of the ``is_authenticated`` flag for the given URI or list of " +"URIs. If *is_authenticated* is specified as ``True``, *realm* is ignored." msgstr "" #: ../../library/urllib.request.rst:976 @@ -1302,8 +1303,8 @@ msgid "" "Handle an authentication request by getting a user/password pair, and re-" "trying the request. *authreq* should be the name of the header where the " "information about the realm is included in the request, *host* specifies the " -"URL and path to authenticate for, *req* should be the (failed) :class:" -"`Request` object, and *headers* should be the error headers." +"URL and path to authenticate for, *req* should be the " +"(failed) :class:`Request` object, and *headers* should be the error headers." msgstr "" #: ../../library/urllib.request.rst:1006 @@ -1353,8 +1354,8 @@ msgstr "HTTPHandler 物件" #: ../../library/urllib.request.rst:1078 msgid "" -"Send an HTTP request, which can be either GET or POST, depending on ``req." -"has_data()``." +"Send an HTTP request, which can be either GET or POST, depending on " +"``req.has_data()``." msgstr "" #: ../../library/urllib.request.rst:1085 @@ -1363,8 +1364,8 @@ msgstr "HTTPSHandler 物件" #: ../../library/urllib.request.rst:1090 msgid "" -"Send an HTTPS request, which can be either GET or POST, depending on ``req." -"has_data()``." +"Send an HTTPS request, which can be either GET or POST, depending on " +"``req.has_data()``." msgstr "" #: ../../library/urllib.request.rst:1097 @@ -1445,8 +1446,8 @@ msgstr "" msgid "" "For non-200 error codes, this simply passes the job on to the :meth:`!" "http_error_\\` handler methods, via :meth:`OpenerDirector.error`. " -"Eventually, :class:`HTTPDefaultErrorHandler` will raise an :exc:`~urllib." -"error.HTTPError` if no other handler handles the error." +"Eventually, :class:`HTTPDefaultErrorHandler` will raise " +"an :exc:`~urllib.error.HTTPError` if no other handler handles the error." msgstr "" #: ../../library/urllib.request.rst:1186 @@ -1470,7 +1471,7 @@ msgstr "" #: ../../library/urllib.request.rst:1199 msgid "" "This example gets the python.org main page and displays the first 300 bytes " -"of it. ::" +"of it::" msgstr "" #: ../../library/urllib.request.rst:1202 @@ -1479,27 +1480,13 @@ msgid "" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" "... print(f.read(300))\n" "...\n" -"b'\\n\\n\\n\\n\\n\\n\n" -"\\n\n" -"Python Programming '" +"b'<!doctype html>\\n<!--[if lt IE 7]> <html class=\"no-js ie6 lt-ie7 lt-" +"ie8 lt-ie9\"> <![endif]-->\\n<!--[if IE 7]> <html class=\"no-js ie7 " +"lt-ie8 lt-ie9\"> <![endif]-->\\n<!--[if IE 8]> <html " +"class=\"no-js ie8 lt-ie9\">" msgstr "" -">>> import urllib.request\n" -">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" -"... print(f.read(300))\n" -"...\n" -"b'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" -"\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd/">\\n\\n\\n<html\n" -"xmlns=\"http://www.w3.org/1999/xhtml/" xml:lang=\"en\" " -"lang=\"en\">\\n\\n<head>\\n\n" -"<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /" -">\\n\n" -"<title>Python Programming '" -#: ../../library/urllib.request.rst:1212 +#: ../../library/urllib.request.rst:1208 msgid "" "Note that urlopen returns a bytes object. This is because there is no way " "for urlopen to automatically determine the encoding of the byte stream it " @@ -1508,61 +1495,83 @@ msgid "" "appropriate encoding." msgstr "" -#: ../../library/urllib.request.rst:1218 +#: ../../library/urllib.request.rst:1214 msgid "" -"The following W3C document, https://www.w3.org/International/O-charset\\ , " -"lists the various ways in which an (X)HTML or an XML document could have " +"The following HTML spec document, https://html.spec.whatwg.org/#charset, " +"lists the various ways in which an HTML or an XML document could have " "specified its encoding information." msgstr "" -#: ../../library/urllib.request.rst:1222 +#: ../../library/urllib.request.rst:1218 +msgid "" +"For additional information, see the W3C document: https://www.w3.org/" +"International/questions/qa-html-encoding-declarations." +msgstr "" + +#: ../../library/urllib.request.rst:1220 msgid "" "As the python.org website uses *utf-8* encoding as specified in its meta " -"tag, we will use the same for decoding the bytes object. ::" +"tag, we will use the same for decoding the bytes object::" msgstr "" -#: ../../library/urllib.request.rst:1225 +#: ../../library/urllib.request.rst:1223 msgid "" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" "... print(f.read(100).decode('utf-8'))\n" "...\n" -"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" -"\"http://www.w3.org/TR/xhtml1/DTD/xhtm" +"<!doctype html>\n" +"<!--[if lt IE 7]> <html class=\"no-js ie6 lt-ie7 lt-ie8 lt-ie9\"> <!" +"[endif]-->\n" +"<!-" msgstr "" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" "... print(f.read(100).decode('utf-8'))\n" "...\n" -"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" -"\"http://www.w3.org/TR/xhtml1/DTD/xhtm" +"<!doctype html>\n" +"<!--[if lt IE 7]> <html class=\"no-js ie6 lt-ie7 lt-ie8 lt-ie9\"> <!" +"[endif]-->\n" +"<!-" -#: ../../library/urllib.request.rst:1231 +#: ../../library/urllib.request.rst:1230 msgid "" -"It is also possible to achieve the same result without using the :term:" -"`context manager` approach. ::" +"It is also possible to achieve the same result without using " +"the :term:`context manager` approach::" msgstr "" -#: ../../library/urllib.request.rst:1234 +#: ../../library/urllib.request.rst:1233 msgid "" ">>> import urllib.request\n" ">>> f = urllib.request.urlopen('http://www.python.org/')\n" -">>> print(f.read(100).decode('utf-8'))\n" -"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" -"\"http://www.w3.org/TR/xhtml1/DTD/xhtm" +">>> try:\n" +"... print(f.read(100).decode('utf-8'))\n" +"... finally:\n" +"... f.close()\n" +"...\n" +"<!doctype html>\n" +"<!--[if lt IE 7]> <html class=\"no-js ie6 lt-ie7 lt-ie8 lt-ie9\"> <!" +"[endif]-->\n" +"<!--" msgstr "" ">>> import urllib.request\n" ">>> f = urllib.request.urlopen('http://www.python.org/')\n" -">>> print(f.read(100).decode('utf-8'))\n" -"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" -"\"http://www.w3.org/TR/xhtml1/DTD/xhtm" +">>> try:\n" +"... print(f.read(100).decode('utf-8'))\n" +"... finally:\n" +"... f.close()\n" +"...\n" +"<!doctype html>\n" +"<!--[if lt IE 7]> <html class=\"no-js ie6 lt-ie7 lt-ie8 lt-ie9\"> <!" +"[endif]-->\n" +"<!--" -#: ../../library/urllib.request.rst:1240 +#: ../../library/urllib.request.rst:1244 msgid "" "In the following example, we are sending a data-stream to the stdin of a CGI " "and reading the data it returns to us. Note that this example will only work " "when the Python installation supports SSL. ::" msgstr "" -#: ../../library/urllib.request.rst:1244 +#: ../../library/urllib.request.rst:1248 msgid "" ">>> import urllib.request\n" ">>> req = urllib.request.Request(url='https://localhost/cgi-bin/test.cgi',\n" @@ -1573,11 +1582,11 @@ msgid "" "Got Data: \"This data is passed to stdin of the CGI\"" msgstr "" -#: ../../library/urllib.request.rst:1252 +#: ../../library/urllib.request.rst:1256 msgid "The code for the sample CGI used in the above example is::" msgstr "" -#: ../../library/urllib.request.rst:1254 +#: ../../library/urllib.request.rst:1258 msgid "" "#!/usr/bin/env python\n" "import sys\n" @@ -1589,11 +1598,11 @@ msgstr "" "data = sys.stdin.read()\n" "print('Content-type: text/plain\\n\\nGot Data: \"%s\"' % data)" -#: ../../library/urllib.request.rst:1259 +#: ../../library/urllib.request.rst:1263 msgid "Here is an example of doing a ``PUT`` request using :class:`Request`::" msgstr "" -#: ../../library/urllib.request.rst:1261 +#: ../../library/urllib.request.rst:1265 msgid "" "import urllib.request\n" "DATA = b'some data'\n" @@ -1613,11 +1622,11 @@ msgstr "" "print(f.status)\n" "print(f.reason)" -#: ../../library/urllib.request.rst:1269 +#: ../../library/urllib.request.rst:1273 msgid "Use of Basic HTTP Authentication::" msgstr "" -#: ../../library/urllib.request.rst:1271 +#: ../../library/urllib.request.rst:1275 msgid "" "import urllib.request\n" "# Create an OpenerDirector with support for Basic HTTP Authentication...\n" @@ -1629,101 +1638,109 @@ msgid "" "opener = urllib.request.build_opener(auth_handler)\n" "# ...and install it globally so it can be used with urlopen.\n" "urllib.request.install_opener(opener)\n" -"urllib.request.urlopen('http://www.example.com/login.html')" +"with urllib.request.urlopen('http://www.example.com/login.html') as f:\n" +" print(f.read().decode('utf-8'))" msgstr "" -#: ../../library/urllib.request.rst:1283 +#: ../../library/urllib.request.rst:1288 msgid "" -":func:`build_opener` provides many handlers by default, including a :class:" -"`ProxyHandler`. By default, :class:`ProxyHandler` uses the environment " -"variables named ``<scheme>_proxy``, where ``<scheme>`` is the URL scheme " -"involved. For example, the :envvar:`!http_proxy` environment variable is " -"read to obtain the HTTP proxy's URL." +":func:`build_opener` provides many handlers by default, including " +"a :class:`ProxyHandler`. By default, :class:`ProxyHandler` uses the " +"environment variables named ``<scheme>_proxy``, where ``<scheme>`` is the " +"URL scheme involved. For example, the :envvar:`!http_proxy` environment " +"variable is read to obtain the HTTP proxy's URL." msgstr "" -#: ../../library/urllib.request.rst:1289 +#: ../../library/urllib.request.rst:1294 msgid "" "This example replaces the default :class:`ProxyHandler` with one that uses " "programmatically supplied proxy URLs, and adds proxy authorization support " "with :class:`ProxyBasicAuthHandler`. ::" msgstr "" -#: ../../library/urllib.request.rst:1293 +#: ../../library/urllib.request.rst:1298 msgid "" -"proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example./" -"com:3128/'})\n" +"proxy_handler = urllib.request.ProxyHandler({'http': 'http://" +"www.example.com:3128/'})\n" "proxy_auth_handler = urllib.request.ProxyBasicAuthHandler()\n" "proxy_auth_handler.add_password('realm', 'host', 'username', 'password')\n" "\n" "opener = urllib.request.build_opener(proxy_handler, proxy_auth_handler)\n" "# This time, rather than install the OpenerDirector, we use it directly:\n" -"opener.open('http://www.example.com/login.html')" +"with opener.open('http://www.example.com/login.html') as f:\n" +" print(f.read().decode('utf-8'))" msgstr "" -"proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example./" -"com:3128/'})\n" +"proxy_handler = urllib.request.ProxyHandler({'http': 'http://" +"www.example.com:3128/'})\n" "proxy_auth_handler = urllib.request.ProxyBasicAuthHandler()\n" "proxy_auth_handler.add_password('realm', 'host', 'username', 'password')\n" "\n" "opener = urllib.request.build_opener(proxy_handler, proxy_auth_handler)\n" "# 這次我們直接使用它而不安裝 OpenerDirector:\n" -"opener.open('http://www.example.com/login.html')" +"with opener.open('http://www.example.com/login.html') as f:\n" +" print(f.read().decode('utf-8'))" -#: ../../library/urllib.request.rst:1301 +#: ../../library/urllib.request.rst:1307 msgid "Adding HTTP headers:" msgstr "" -#: ../../library/urllib.request.rst:1303 +#: ../../library/urllib.request.rst:1309 msgid "Use the *headers* argument to the :class:`Request` constructor, or::" msgstr "" -#: ../../library/urllib.request.rst:1305 +#: ../../library/urllib.request.rst:1311 msgid "" "import urllib.request\n" "req = urllib.request.Request('http://www.example.com/')\n" "req.add_header('Referer', 'http://www.python.org/')\n" "# Customize the default User-Agent header value:\n" "req.add_header('User-Agent', 'urllib-example/0.1 (Contact: . . .)')\n" -"r = urllib.request.urlopen(req)" +"with urllib.request.urlopen(req) as f:\n" +" print(f.read().decode('utf-8'))" msgstr "" "import urllib.request\n" "req = urllib.request.Request('http://www.example.com/')\n" "req.add_header('Referer', 'http://www.python.org/')\n" -"# Customize the default User-Agent header value:\n" +"# 自訂預設的使用者代理標頭值:\n" "req.add_header('User-Agent', 'urllib-example/0.1 (Contact: . . .)')\n" -"r = urllib.request.urlopen(req)" +"with urllib.request.urlopen(req) as f:\n" +" print(f.read().decode('utf-8'))" -#: ../../library/urllib.request.rst:1312 +#: ../../library/urllib.request.rst:1320 msgid "" ":class:`OpenerDirector` automatically adds a :mailheader:`User-Agent` header " "to every :class:`Request`. To change this::" msgstr "" -#: ../../library/urllib.request.rst:1315 +#: ../../library/urllib.request.rst:1323 msgid "" "import urllib.request\n" "opener = urllib.request.build_opener()\n" "opener.addheaders = [('User-agent', 'Mozilla/5.0')]\n" -"opener.open('http://www.example.com/')" +"with opener.open('http://www.example.com/') as f:\n" +" print(f.read().decode('utf-8'))" msgstr "" "import urllib.request\n" "opener = urllib.request.build_opener()\n" "opener.addheaders = [('User-agent', 'Mozilla/5.0')]\n" -"opener.open('http://www.example.com/')" +"with opener.open('http://www.example.com/') as f:\n" +" print(f.read().decode('utf-8'))" -#: ../../library/urllib.request.rst:1320 +#: ../../library/urllib.request.rst:1329 msgid "" -"Also, remember that a few standard headers (:mailheader:`Content-Length`, :" -"mailheader:`Content-Type` and :mailheader:`Host`) are added when the :class:" -"`Request` is passed to :func:`urlopen` (or :meth:`OpenerDirector.open`)." +"Also, remember that a few standard headers (:mailheader:`Content-" +"Length`, :mailheader:`Content-Type` and :mailheader:`Host`) are added when " +"the :class:`Request` is passed to :func:`urlopen` " +"(or :meth:`OpenerDirector.open`)." msgstr "" -#: ../../library/urllib.request.rst:1327 +#: ../../library/urllib.request.rst:1336 msgid "" "Here is an example session that uses the ``GET`` method to retrieve a URL " "containing parameters::" msgstr "" -#: ../../library/urllib.request.rst:1330 +#: ../../library/urllib.request.rst:1339 msgid "" ">>> import urllib.request\n" ">>> import urllib.parse\n" @@ -1741,14 +1758,14 @@ msgstr "" "... print(f.read().decode('utf-8'))\n" "..." -#: ../../library/urllib.request.rst:1338 +#: ../../library/urllib.request.rst:1347 msgid "" "The following example uses the ``POST`` method instead. Note that params " "output from urlencode is encoded to bytes before it is sent to urlopen as " "data::" msgstr "" -#: ../../library/urllib.request.rst:1341 +#: ../../library/urllib.request.rst:1350 msgid "" ">>> import urllib.request\n" ">>> import urllib.parse\n" @@ -1768,13 +1785,13 @@ msgstr "" "... print(f.read().decode('utf-8'))\n" "..." -#: ../../library/urllib.request.rst:1349 +#: ../../library/urllib.request.rst:1358 msgid "" "The following example uses an explicitly specified HTTP proxy, overriding " "environment settings::" msgstr "" -#: ../../library/urllib.request.rst:1352 +#: ../../library/urllib.request.rst:1361 msgid "" ">>> import urllib.request\n" ">>> proxies = {'http': 'http://proxy.example.com:8080/'}\n" @@ -1790,13 +1807,13 @@ msgstr "" "... f.read().decode('utf-8')\n" "..." -#: ../../library/urllib.request.rst:1359 +#: ../../library/urllib.request.rst:1368 msgid "" "The following example uses no proxies at all, overriding environment " "settings::" msgstr "" -#: ../../library/urllib.request.rst:1361 +#: ../../library/urllib.request.rst:1370 msgid "" ">>> import urllib.request\n" ">>> opener = urllib.request.FancyURLopener({})\n" @@ -1810,28 +1827,28 @@ msgstr "" "... f.read().decode('utf-8')\n" "..." -#: ../../library/urllib.request.rst:1369 +#: ../../library/urllib.request.rst:1378 msgid "Legacy interface" msgstr "" -#: ../../library/urllib.request.rst:1371 +#: ../../library/urllib.request.rst:1380 msgid "" "The following functions and classes are ported from the Python 2 module " "``urllib`` (as opposed to ``urllib2``). They might become deprecated at " "some point in the future." msgstr "" -#: ../../library/urllib.request.rst:1377 +#: ../../library/urllib.request.rst:1386 msgid "" "Copy a network object denoted by a URL to a local file. If the URL points to " "a local file, the object will not be copied unless filename is supplied. " "Return a tuple ``(filename, headers)`` where *filename* is the local file " -"name under which the object can be found, and *headers* is whatever the :" -"meth:`!info` method of the object returned by :func:`urlopen` returned (for " -"a remote object). Exceptions are the same as for :func:`urlopen`." +"name under which the object can be found, and *headers* is whatever " +"the :meth:`!info` method of the object returned by :func:`urlopen` returned " +"(for a remote object). Exceptions are the same as for :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:1384 +#: ../../library/urllib.request.rst:1393 msgid "" "The second argument, if present, specifies the file location to copy to (if " "absent, the location will be a tempfile with a generated name). The third " @@ -1843,34 +1860,34 @@ msgid "" "file size in response to a retrieval request." msgstr "" -#: ../../library/urllib.request.rst:1393 +#: ../../library/urllib.request.rst:1402 msgid "The following example illustrates the most common usage scenario::" msgstr "" -#: ../../library/urllib.request.rst:1395 +#: ../../library/urllib.request.rst:1404 msgid "" ">>> import urllib.request\n" -">>> local_filename, headers = urllib.request.urlretrieve('http://python./" -"org/')\n" +">>> local_filename, headers = urllib.request.urlretrieve('http://" +"python.org/')\n" ">>> html = open(local_filename)\n" ">>> html.close()" msgstr "" ">>> import urllib.request\n" -">>> local_filename, headers = urllib.request.urlretrieve('http://python./" -"org/')\n" +">>> local_filename, headers = urllib.request.urlretrieve('http://" +"python.org/')\n" ">>> html = open(local_filename)\n" ">>> html.close()" -#: ../../library/urllib.request.rst:1400 +#: ../../library/urllib.request.rst:1409 msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " -"type is ``GET``). The *data* argument must be a bytes object in standard :" -"mimetype:`application/x-www-form-urlencoded` format; see the :func:`urllib." -"parse.urlencode` function." +"type is ``GET``). The *data* argument must be a bytes object in " +"standard :mimetype:`application/x-www-form-urlencoded` format; see " +"the :func:`urllib.parse.urlencode` function." msgstr "" -#: ../../library/urllib.request.rst:1406 +#: ../../library/urllib.request.rst:1415 msgid "" ":func:`urlretrieve` will raise :exc:`~urllib.error.ContentTooShortError` " "when it detects that the amount of data available was less than the " @@ -1878,40 +1895,40 @@ msgid "" "This can occur, for example, when the download is interrupted." msgstr "" -#: ../../library/urllib.request.rst:1411 +#: ../../library/urllib.request.rst:1420 msgid "" "The *Content-Length* is treated as a lower bound: if there's more data to " "read, urlretrieve reads more data, but if less data is available, it raises " "the exception." msgstr "" -#: ../../library/urllib.request.rst:1415 +#: ../../library/urllib.request.rst:1424 msgid "" "You can still retrieve the downloaded data in this case, it is stored in " "the :attr:`!content` attribute of the exception instance." msgstr "" -#: ../../library/urllib.request.rst:1418 +#: ../../library/urllib.request.rst:1427 msgid "" "If no *Content-Length* header was supplied, urlretrieve can not check the " "size of the data it has downloaded, and just returns it. In this case you " "just have to assume that the download was successful." msgstr "" -#: ../../library/urllib.request.rst:1424 +#: ../../library/urllib.request.rst:1433 msgid "" "Cleans up temporary files that may have been left behind by previous calls " "to :func:`urlretrieve`." msgstr "" -#: ../../library/urllib.request.rst:1431 +#: ../../library/urllib.request.rst:1440 msgid "" "Base class for opening and reading URLs. Unless you need to support opening " -"objects using schemes other than :file:`http:`, :file:`ftp:`, or :file:`file:" -"`, you probably want to use :class:`FancyURLopener`." +"objects using schemes other than :file:`http:`, :file:`ftp:`, " +"or :file:`file:`, you probably want to use :class:`FancyURLopener`." msgstr "" -#: ../../library/urllib.request.rst:1435 +#: ../../library/urllib.request.rst:1444 msgid "" "By default, the :class:`URLopener` class sends a :mailheader:`User-Agent` " "header of ``urllib/VVV``, where *VVV* is the :mod:`urllib` version number. " @@ -1921,7 +1938,7 @@ msgid "" "subclass definition." msgstr "" -#: ../../library/urllib.request.rst:1441 +#: ../../library/urllib.request.rst:1450 msgid "" "The optional *proxies* parameter should be a dictionary mapping scheme names " "to proxy URLs, where an empty dictionary turns proxies off completely. Its " @@ -1929,7 +1946,7 @@ msgid "" "be used if present, as discussed in the definition of :func:`urlopen`, above." msgstr "" -#: ../../library/urllib.request.rst:1446 +#: ../../library/urllib.request.rst:1455 msgid "" "Additional keyword parameters, collected in *x509*, may be used for " "authentication of the client when using the :file:`https:` scheme. The " @@ -1937,64 +1954,64 @@ msgid "" "certificate; both are needed to support client authentication." msgstr "" -#: ../../library/urllib.request.rst:1451 +#: ../../library/urllib.request.rst:1460 msgid "" ":class:`URLopener` objects will raise an :exc:`OSError` exception if the " "server returns an error code." msgstr "" -#: ../../library/urllib.request.rst:1456 +#: ../../library/urllib.request.rst:1465 msgid "" "Open *fullurl* using the appropriate protocol. This method sets up cache " "and proxy information, then calls the appropriate open method with its input " "arguments. If the scheme is not recognized, :meth:`open_unknown` is called. " -"The *data* argument has the same meaning as the *data* argument of :func:" -"`urlopen`." +"The *data* argument has the same meaning as the *data* argument " +"of :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:1462 +#: ../../library/urllib.request.rst:1471 msgid "This method always quotes *fullurl* using :func:`~urllib.parse.quote`." msgstr "" -#: ../../library/urllib.request.rst:1466 +#: ../../library/urllib.request.rst:1475 msgid "Overridable interface to open unknown URL types." msgstr "" -#: ../../library/urllib.request.rst:1471 +#: ../../library/urllib.request.rst:1480 msgid "" "Retrieves the contents of *url* and places it in *filename*. The return " -"value is a tuple consisting of a local filename and either an :class:`email." -"message.Message` object containing the response headers (for remote URLs) or " -"``None`` (for local URLs). The caller must then open and read the contents " -"of *filename*. If *filename* is not given and the URL refers to a local " -"file, the input filename is returned. If the URL is non-local and " -"*filename* is not given, the filename is the output of :func:`tempfile." -"mktemp` with a suffix that matches the suffix of the last path component of " -"the input URL. If *reporthook* is given, it must be a function accepting " -"three numeric parameters: A chunk number, the maximum size chunks are read " -"in and the total size of the download (-1 if unknown). It will be called " -"once at the start and after each chunk of data is read from the network. " -"*reporthook* is ignored for local URLs." -msgstr "" - -#: ../../library/urllib.request.rst:1484 +"value is a tuple consisting of a local filename and either " +"an :class:`email.message.Message` object containing the response headers " +"(for remote URLs) or ``None`` (for local URLs). The caller must then open " +"and read the contents of *filename*. If *filename* is not given and the URL " +"refers to a local file, the input filename is returned. If the URL is non-" +"local and *filename* is not given, the filename is the output " +"of :func:`tempfile.mktemp` with a suffix that matches the suffix of the last " +"path component of the input URL. If *reporthook* is given, it must be a " +"function accepting three numeric parameters: A chunk number, the maximum " +"size chunks are read in and the total size of the download (-1 if unknown). " +"It will be called once at the start and after each chunk of data is read " +"from the network. *reporthook* is ignored for local URLs." +msgstr "" + +#: ../../library/urllib.request.rst:1493 msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " -"type is ``GET``). The *data* argument must in standard :mimetype:" -"`application/x-www-form-urlencoded` format; see the :func:`urllib.parse." -"urlencode` function." +"type is ``GET``). The *data* argument must in " +"standard :mimetype:`application/x-www-form-urlencoded` format; see " +"the :func:`urllib.parse.urlencode` function." msgstr "" -#: ../../library/urllib.request.rst:1493 +#: ../../library/urllib.request.rst:1502 msgid "" -"Variable that specifies the user agent of the opener object. To get :mod:" -"`urllib` to tell servers that it is a particular user agent, set this in a " -"subclass as a class variable or in the constructor before calling the base " -"constructor." +"Variable that specifies the user agent of the opener object. To " +"get :mod:`urllib` to tell servers that it is a particular user agent, set " +"this in a subclass as a class variable or in the constructor before calling " +"the base constructor." msgstr "" -#: ../../library/urllib.request.rst:1503 +#: ../../library/urllib.request.rst:1512 msgid "" ":class:`FancyURLopener` subclasses :class:`URLopener` providing default " "handling for the following HTTP response codes: 301, 302, 303, 307 and 401. " @@ -2005,14 +2022,14 @@ msgid "" "defaults to 10." msgstr "" -#: ../../library/urllib.request.rst:1510 +#: ../../library/urllib.request.rst:1519 msgid "" -"For all other response codes, the method :meth:`~BaseHandler." -"http_error_default` is called which you can override in subclasses to handle " -"the error appropriately." +"For all other response codes, the " +"method :meth:`~BaseHandler.http_error_default` is called which you can " +"override in subclasses to handle the error appropriately." msgstr "" -#: ../../library/urllib.request.rst:1515 +#: ../../library/urllib.request.rst:1524 msgid "" "According to the letter of :rfc:`2616`, 301 and 302 responses to POST " "requests must not be automatically redirected without confirmation by the " @@ -2021,13 +2038,13 @@ msgid "" "behaviour." msgstr "" -#: ../../library/urllib.request.rst:1520 +#: ../../library/urllib.request.rst:1529 msgid "" -"The parameters to the constructor are the same as those for :class:" -"`URLopener`." +"The parameters to the constructor are the same as those " +"for :class:`URLopener`." msgstr "" -#: ../../library/urllib.request.rst:1524 +#: ../../library/urllib.request.rst:1533 msgid "" "When performing basic authentication, a :class:`FancyURLopener` instance " "calls its :meth:`prompt_user_passwd` method. The default implementation " @@ -2036,59 +2053,59 @@ msgid "" "needed." msgstr "" -#: ../../library/urllib.request.rst:1529 +#: ../../library/urllib.request.rst:1538 msgid "" "The :class:`FancyURLopener` class offers one additional method that should " "be overloaded to provide the appropriate behavior:" msgstr "" -#: ../../library/urllib.request.rst:1534 +#: ../../library/urllib.request.rst:1543 msgid "" "Return information needed to authenticate the user at the given host in the " "specified security realm. The return value should be a tuple, ``(user, " "password)``, which can be used for basic authentication." msgstr "" -#: ../../library/urllib.request.rst:1538 +#: ../../library/urllib.request.rst:1547 msgid "" "The implementation prompts for this information on the terminal; an " "application should override this method to use an appropriate interaction " "model in the local environment." msgstr "" -#: ../../library/urllib.request.rst:1544 +#: ../../library/urllib.request.rst:1553 msgid ":mod:`urllib.request` Restrictions" msgstr "" -#: ../../library/urllib.request.rst:1550 +#: ../../library/urllib.request.rst:1559 msgid "" "Currently, only the following protocols are supported: HTTP (versions 0.9 " "and 1.0), FTP, local files, and data URLs." msgstr "" -#: ../../library/urllib.request.rst:1553 +#: ../../library/urllib.request.rst:1562 msgid "Added support for data URLs." msgstr "" -#: ../../library/urllib.request.rst:1555 +#: ../../library/urllib.request.rst:1564 msgid "" "The caching feature of :func:`urlretrieve` has been disabled until someone " "finds the time to hack proper processing of Expiration time headers." msgstr "" -#: ../../library/urllib.request.rst:1558 +#: ../../library/urllib.request.rst:1567 msgid "" "There should be a function to query whether a particular URL is in the cache." msgstr "" -#: ../../library/urllib.request.rst:1560 +#: ../../library/urllib.request.rst:1569 msgid "" "For backward compatibility, if a URL appears to point to a local file but " "the file can't be opened, the URL is re-interpreted using the FTP protocol. " "This can sometimes cause confusing error messages." msgstr "" -#: ../../library/urllib.request.rst:1564 +#: ../../library/urllib.request.rst:1573 msgid "" "The :func:`urlopen` and :func:`urlretrieve` functions can cause arbitrarily " "long delays while waiting for a network connection to be set up. This means " @@ -2096,17 +2113,17 @@ msgid "" "functions without using threads." msgstr "" -#: ../../library/urllib.request.rst:1573 +#: ../../library/urllib.request.rst:1582 msgid "" "The data returned by :func:`urlopen` or :func:`urlretrieve` is the raw data " "returned by the server. This may be binary data (such as an image), plain " "text or (for example) HTML. The HTTP protocol provides type information in " -"the reply header, which can be inspected by looking at the :mailheader:" -"`Content-Type` header. If the returned data is HTML, you can use the " -"module :mod:`html.parser` to parse it." +"the reply header, which can be inspected by looking at " +"the :mailheader:`Content-Type` header. If the returned data is HTML, you " +"can use the module :mod:`html.parser` to parse it." msgstr "" -#: ../../library/urllib.request.rst:1582 +#: ../../library/urllib.request.rst:1591 msgid "" "The code handling the FTP protocol cannot differentiate between a file and a " "directory. This can lead to unexpected behavior when attempting to read a " @@ -2124,59 +2141,86 @@ msgid "" "meet your needs." msgstr "" -#: ../../library/urllib.request.rst:1599 +#: ../../library/urllib.request.rst:1608 msgid ":mod:`urllib.response` --- Response classes used by urllib" msgstr "" -#: ../../library/urllib.request.rst:1604 +#: ../../library/urllib.request.rst:1613 msgid "" "The :mod:`urllib.response` module defines functions and classes which define " "a minimal file-like interface, including ``read()`` and ``readline()``. " -"Functions defined by this module are used internally by the :mod:`urllib." -"request` module. The typical response object is a :class:`urllib.response." -"addinfourl` instance:" +"Functions defined by this module are used internally by " +"the :mod:`urllib.request` module. The typical response object is " +"a :class:`urllib.response.addinfourl` instance:" msgstr "" -#: ../../library/urllib.request.rst:1613 +#: ../../library/urllib.request.rst:1622 msgid "" "URL of the resource retrieved, commonly used to determine if a redirect was " "followed." msgstr "" -#: ../../library/urllib.request.rst:1617 +#: ../../library/urllib.request.rst:1626 msgid "" -"Returns the headers of the response in the form of an :class:`~email.message." -"EmailMessage` instance." +"Returns the headers of the response in the form of " +"an :class:`~email.message.EmailMessage` instance." msgstr "" -#: ../../library/urllib.request.rst:1623 +#: ../../library/urllib.request.rst:1632 msgid "Status code returned by server." msgstr "" -#: ../../library/urllib.request.rst:1627 +#: ../../library/urllib.request.rst:1636 msgid "Deprecated in favor of :attr:`~addinfourl.url`." msgstr "" -#: ../../library/urllib.request.rst:1632 +#: ../../library/urllib.request.rst:1641 msgid "Deprecated in favor of :attr:`~addinfourl.headers`." msgstr "" -#: ../../library/urllib.request.rst:1637 ../../library/urllib.request.rst:1642 +#: ../../library/urllib.request.rst:1646 ../../library/urllib.request.rst:1651 msgid "Deprecated in favor of :attr:`~addinfourl.status`." msgstr "" -#: ../../library/urllib.request.rst:1546 ../../library/urllib.request.rst:1569 +#: ../../library/urllib.request.rst:1555 ../../library/urllib.request.rst:1578 msgid "HTTP" msgstr "HTTP" -#: ../../library/urllib.request.rst:1546 ../../library/urllib.request.rst:1569 +#: ../../library/urllib.request.rst:1555 ../../library/urllib.request.rst:1578 msgid "protocol" msgstr "protocol(協定)" -#: ../../library/urllib.request.rst:1546 ../../library/urllib.request.rst:1580 +#: ../../library/urllib.request.rst:1555 ../../library/urllib.request.rst:1589 msgid "FTP" msgstr "FTP" -#: ../../library/urllib.request.rst:1569 +#: ../../library/urllib.request.rst:1578 msgid "HTML" msgstr "HTML" + +#~ msgid "" +#~ ">>> import urllib.request\n" +#~ ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" +#~ "... print(f.read(300))\n" +#~ "...\n" +#~ "b'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" +#~ "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-" +#~ "transitional.dtd\">\\n\\n\\n<html\n" +#~ "xmlns=\"http://www.w3.org/1999/xhtml/" xml:lang=\"en\" " +#~ "lang=\"en\">\\n\\n<head>\\n\n" +#~ "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /" +#~ ">\\n\n" +#~ "<title>Python Programming '" +#~ msgstr "" +#~ ">>> import urllib.request\n" +#~ ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" +#~ "... print(f.read(300))\n" +#~ "...\n" +#~ "b'<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" +#~ "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-" +#~ "transitional.dtd\">\\n\\n\\n<html\n" +#~ "xmlns=\"http://www.w3.org/1999/xhtml/" xml:lang=\"en\" " +#~ "lang=\"en\">\\n\\n<head>\\n\n" +#~ "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /" +#~ ">\\n\n" +#~ "<title>Python Programming '" diff --git a/library/uuid.po b/library/uuid.po index b8dc932c93..6f5ae1103d 100644 --- a/library/uuid.po +++ b/library/uuid.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2025-02-26 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,18 +29,18 @@ msgstr "**原始碼:**\\ :source:`Lib/uuid.py`" #: ../../library/uuid.rst:13 msgid "" "This module provides immutable :class:`UUID` objects (the :class:`UUID` " -"class) and the functions :func:`uuid1`, :func:`uuid3`, :func:`uuid4`, :func:" -"`uuid5` for generating version 1, 3, 4, and 5 UUIDs as specified in :rfc:" -"`4122`." +"class) and the " +"functions :func:`uuid1`, :func:`uuid3`, :func:`uuid4`, :func:`uuid5` for " +"generating version 1, 3, 4, and 5 UUIDs as specified in :rfc:`4122`." msgstr "" -"這個模組提供了不可變的 :class:`UUID` 物件(:class:`UUID` 類別)和 :func:" -"`uuid1`、:func:`uuid3`、:func:`uuid4`、:func:`uuid5` 等函式,用於生成 :rfc:" -"`4122` 定義的第 1、3、4、5 版本的 UUID。" +"這個模組提供了不可變的 :class:`UUID` 物件(:class:`UUID` 類別)" +"和 :func:`uuid1`、:func:`uuid3`、:func:`uuid4`、:func:`uuid5` 等函式,用於生" +"成 :rfc:`4122` 定義的第 1、3、4、5 版本的 UUID。" #: ../../library/uuid.rst:17 msgid "" -"If all you want is a unique ID, you should probably call :func:`uuid1` or :" -"func:`uuid4`. Note that :func:`uuid1` may compromise privacy since it " +"If all you want is a unique ID, you should probably call :func:`uuid1` " +"or :func:`uuid4`. Note that :func:`uuid1` may compromise privacy since it " "creates a UUID containing the computer's network address. :func:`uuid4` " "creates a random UUID." msgstr "" @@ -130,9 +130,9 @@ msgstr "" #: ../../library/uuid.rst:71 msgid "" -"Comparison of UUID objects are made by way of comparing their :attr:`UUID." -"int` attributes. Comparison with a non-UUID object raises a :exc:" -"`TypeError`." +"Comparison of UUID objects are made by way of comparing " +"their :attr:`UUID.int` attributes. Comparison with a non-UUID object raises " +"a :exc:`TypeError`." msgstr "" "UUID 物件之間的比較是透過比較它們的 :attr:`UUID.int` 屬性。與非 UUID 的物件進" "行比較會引發 :exc:`TypeError`。" @@ -220,17 +220,18 @@ msgstr "UUID 以 :rfc:`4122` 中指定的 URN 形式表示。" #: ../../library/uuid.rst:145 msgid "" "The UUID variant, which determines the internal layout of the UUID. This " -"will be one of the constants :const:`RESERVED_NCS`, :const:`RFC_4122`, :" -"const:`RESERVED_MICROSOFT`, or :const:`RESERVED_FUTURE`." +"will be one of the " +"constants :const:`RESERVED_NCS`, :const:`RFC_4122`, :const:`RESERVED_MICROSOFT`, " +"or :const:`RESERVED_FUTURE`." msgstr "" -"UUID 的變體,決定 UUID 內部的佈局 (layout),是 :const:`RESERVED_NCS`、:const:" -"`RFC_4122`、:const:`RESERVED_MICROSOFT` 或 :const:`RESERVED_FUTURE` 其中一個" -"常數。" +"UUID 的變體,決定 UUID 內部的佈局 (layout)," +"是 :const:`RESERVED_NCS`、:const:`RFC_4122`、:const:`RESERVED_MICROSOFT` " +"或 :const:`RESERVED_FUTURE` 其中一個常數。" #: ../../library/uuid.rst:152 msgid "" -"The UUID version number (1 through 5, meaningful only when the variant is :" -"const:`RFC_4122`)." +"The UUID version number (1 through 5, meaningful only when the variant " +"is :const:`RFC_4122`)." msgstr "UUID 的版本號(1 到 5,只有當變體是 :const:`RFC_4122` 時才有意義)。" #: ../../library/uuid.rst:157 @@ -273,31 +274,31 @@ msgstr "" "通用管理的 MAC 位址優於本地管理的 MAC 位址,因為前者保證是全球唯一的,而後者" "不是。" -#: ../../library/uuid.rst:187 +#: ../../library/uuid.rst:185 msgid "" "Generate a UUID from a host ID, sequence number, and the current time. If " "*node* is not given, :func:`getnode` is used to obtain the hardware address. " "If *clock_seq* is given, it is used as the sequence number; otherwise a " "random 14-bit sequence number is chosen." msgstr "" -"從主機 ID、序列號和目前時間生成 UUID。如果未給定 *node*,將使用 :func:" -"`getnode` 取得硬體位址。如果給定 *clock_seq*,會將其用作序列號;否則將使用一" -"個隨機 14 位元的序列號。" +"從主機 ID、序列號和目前時間生成 UUID。如果未給定 *node*,將使" +"用 :func:`getnode` 取得硬體位址。如果給定 *clock_seq*,會將其用作序列號;否則" +"將使用一個隨機 14 位元的序列號。" -#: ../../library/uuid.rst:197 +#: ../../library/uuid.rst:193 msgid "" "Generate a UUID based on the MD5 hash of a namespace identifier (which is a " "UUID) and a name (which is a :class:`bytes` object or a string that will be " "encoded using UTF-8)." msgstr "" -"基於命名空間識別碼 (namespace identifier)(一個 UUID)和名稱(一個 :class:" -"`bytes` 物件或使用 UTF-8 編碼的字串)的 MD5 hash 來生成 UUID。" +"基於命名空間識別碼 (namespace identifier)(一個 UUID)和名稱(一" +"個 :class:`bytes` 物件或使用 UTF-8 編碼的字串)的 MD5 hash 來生成 UUID。" -#: ../../library/uuid.rst:206 +#: ../../library/uuid.rst:200 msgid "Generate a random UUID." msgstr "生成一個隨機的 UUID。" -#: ../../library/uuid.rst:213 +#: ../../library/uuid.rst:205 msgid "" "Generate a UUID based on the SHA-1 hash of a namespace identifier (which is " "a UUID) and a name (which is a :class:`bytes` object or a string that will " @@ -306,7 +307,7 @@ msgstr "" "基於命名空間識別碼(一個 UUID)和名稱(一個 :class:`bytes` 物件或使用 UTF-8 " "編碼的字串)的 SHA-1 hash 來生成 UUID。" -#: ../../library/uuid.rst:219 +#: ../../library/uuid.rst:210 msgid "" "The :mod:`uuid` module defines the following namespace identifiers for use " "with :func:`uuid3` or :func:`uuid5`." @@ -314,7 +315,7 @@ msgstr "" ":mod:`uuid` 模組為 :func:`uuid3` 或 :func:`uuid5` 定義了以下的命名空間識別" "碼。" -#: ../../library/uuid.rst:225 +#: ../../library/uuid.rst:216 msgid "" "When this namespace is specified, the *name* string is a fully qualified " "domain name." @@ -322,50 +323,50 @@ msgstr "" "當指定這個命名空間時,*name* 字串是一個完整網域名稱 (fully qualified domain " "name)。" -#: ../../library/uuid.rst:231 +#: ../../library/uuid.rst:222 msgid "When this namespace is specified, the *name* string is a URL." msgstr "當指定這個命名空間時,*name* 字串是一個 URL。" -#: ../../library/uuid.rst:236 +#: ../../library/uuid.rst:227 msgid "When this namespace is specified, the *name* string is an ISO OID." msgstr "當指定這個命名空間時,*name* 字串是一個 ISO OID。" -#: ../../library/uuid.rst:241 +#: ../../library/uuid.rst:232 msgid "" "When this namespace is specified, the *name* string is an X.500 DN in DER or " "a text output format." msgstr "" "當指定這個命名空間時,*name* 字串是以 DER 或文字輸出格式表示的 X.500 DN。" -#: ../../library/uuid.rst:244 +#: ../../library/uuid.rst:235 msgid "" "The :mod:`uuid` module defines the following constants for the possible " "values of the :attr:`~UUID.variant` attribute:" msgstr ":mod:`uuid` 模組為 :attr:`~UUID.variant` 屬性的可能值定義了以下常數:" -#: ../../library/uuid.rst:250 +#: ../../library/uuid.rst:241 msgid "Reserved for NCS compatibility." msgstr "保留供 NCS 相容性使用。" -#: ../../library/uuid.rst:255 +#: ../../library/uuid.rst:246 msgid "Specifies the UUID layout given in :rfc:`4122`." msgstr "使用在 :rfc:`4122` 中給定的 UUID 佈局。" -#: ../../library/uuid.rst:260 +#: ../../library/uuid.rst:251 msgid "Reserved for Microsoft compatibility." msgstr "保留供 Microsoft 相容性使用。" -#: ../../library/uuid.rst:265 +#: ../../library/uuid.rst:256 msgid "Reserved for future definition." msgstr "保留供未來定義使用。" -#: ../../library/uuid.rst:270 +#: ../../library/uuid.rst:261 msgid ":rfc:`4122` - A Universally Unique IDentifier (UUID) URN Namespace" msgstr "" ":rfc:`4122` - 通用唯一辨識碼 (UUID, Universally Unique IDentifier) 的 URN 命" "名空間" -#: ../../library/uuid.rst:271 +#: ../../library/uuid.rst:262 msgid "" "This specification defines a Uniform Resource Name namespace for UUIDs, the " "internal format of UUIDs, and methods of generating UUIDs." @@ -373,36 +374,36 @@ msgstr "" "這個規範定義了 UUID 的統一資源名稱 (Uniform Resource Name) 命名空間、UUID 的" "內部格式和生成 UUID 的方法。" -#: ../../library/uuid.rst:278 +#: ../../library/uuid.rst:269 msgid "Command-Line Usage" msgstr "命令列的用法" -#: ../../library/uuid.rst:282 +#: ../../library/uuid.rst:273 msgid "" "The :mod:`uuid` module can be executed as a script from the command line." msgstr ":mod:`uuid` 模組可以在命令列下作為腳本來執行。" -#: ../../library/uuid.rst:284 +#: ../../library/uuid.rst:275 msgid "" "python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5}] [-n NAMESPACE] [-N NAME]" msgstr "" "python -m uuid [-h] [-u {uuid1,uuid3,uuid4,uuid5}] [-n NAMESPACE] [-N NAME]" -#: ../../library/uuid.rst:288 +#: ../../library/uuid.rst:279 msgid "The following options are accepted:" msgstr "可以接受以下選項:" -#: ../../library/uuid.rst:294 +#: ../../library/uuid.rst:285 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/uuid.rst:299 +#: ../../library/uuid.rst:290 msgid "" -"Specify the function name to use to generate the uuid. By default :func:" -"`uuid4` is used." +"Specify the function name to use to generate the uuid. By " +"default :func:`uuid4` is used." msgstr "指定要用來生成 UUID 的函式名稱。預設使用 :func:`uuid4`。" -#: ../../library/uuid.rst:305 +#: ../../library/uuid.rst:296 msgid "" "The namespace is a ``UUID``, or ``@ns`` where ``ns`` is a well-known " "predefined UUID addressed by namespace name. Such as ``@dns``, ``@url``, " @@ -410,24 +411,24 @@ msgid "" "functions." msgstr "" "該命名空間是一個 ``UUID`` 或 ``@ns``,其中 ``ns`` 是指知名預定義 UUID 的命名" -"空間名稱,例如 ``@dns``、``@url``、``@oid`` 和 ``@x500``。 只有 :func:" -"`uuid3` / :func:`uuid5` 函式會需要。" +"空間名稱,例如 ``@dns``、``@url``、``@oid`` 和 ``@x500``。 只" +"有 :func:`uuid3` / :func:`uuid5` 函式會需要。" -#: ../../library/uuid.rst:312 +#: ../../library/uuid.rst:303 msgid "" -"The name used as part of generating the uuid. Only required for :func:" -"`uuid3` / :func:`uuid5` functions." +"The name used as part of generating the uuid. Only required " +"for :func:`uuid3` / :func:`uuid5` functions." msgstr "用於生成 uuid 的名稱。只有 :func:`uuid3` / :func:`uuid5` 函式會需要。" -#: ../../library/uuid.rst:319 +#: ../../library/uuid.rst:310 msgid "Example" msgstr "範例" -#: ../../library/uuid.rst:321 +#: ../../library/uuid.rst:312 msgid "Here are some examples of typical usage of the :mod:`uuid` module::" msgstr "以下是一些 :mod:`uuid` 模組的典型使用範例: ::" -#: ../../library/uuid.rst:323 +#: ../../library/uuid.rst:314 msgid "" ">>> import uuid\n" "\n" @@ -462,18 +463,50 @@ msgid "" ">>> uuid.UUID(bytes=x.bytes)\n" "UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')" msgstr "" +">>> import uuid\n" +"\n" +">>> # 基於主機 ID 和目前時間生成 UUID\n" +">>> uuid.uuid1()\n" +"UUID('a8098c1a-f86e-11da-bd1a-00112444be1e')\n" +"\n" +">>> # 使用命名空間 UUID 的 MD5 雜湊和一個名稱生成 UUID\n" +">>> uuid.uuid3(uuid.NAMESPACE_DNS, 'python.org')\n" +"UUID('6fa459ea-ee8a-3ca4-894e-db77e160355e')\n" +"\n" +">>> # 生成一個隨機的 UUID\n" +">>> uuid.uuid4()\n" +"UUID('16fd2706-8baf-433b-82eb-8c7fada847da')\n" +"\n" +">>> # 使用命名空間 UUID 的 SHA-1 雜湊和一個名稱生成 UUID\n" +">>> uuid.uuid5(uuid.NAMESPACE_DNS, 'python.org')\n" +"UUID('886313e1-3b8a-5372-9b90-0c9aee199e5d')\n" +"\n" +">>> # 從十六進位數字組成的字串生成 UUID(大括號和連字符號會被忽略)\n" +">>> x = uuid.UUID('{00010203-0405-0607-0809-0a0b0c0d0e0f}')\n" +"\n" +">>> # 將 UUID 轉換為標準形式的十六進位數字字串\n" +">>> str(x)\n" +"'00010203-0405-0607-0809-0a0b0c0d0e0f'\n" +"\n" +">>> # 取得 UUID 的原始 16 位元組\n" +">>> x.bytes\n" +"b'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\t\\n\\x0b\\x0c\\r\\x0e\\x0f'\n" +"\n" +">>> # 從 16 位元組的字串生成 UUID\n" +">>> uuid.UUID(bytes=x.bytes)\n" +"UUID('00010203-0405-0607-0809-0a0b0c0d0e0f')" -#: ../../library/uuid.rst:360 +#: ../../library/uuid.rst:351 msgid "Command-Line Example" msgstr "命令列的範例" -#: ../../library/uuid.rst:362 +#: ../../library/uuid.rst:353 msgid "" "Here are some examples of typical usage of the :mod:`uuid` command line " "interface:" msgstr "以下是一些 :mod:`uuid` 命令列介面的典型使用範例:" -#: ../../library/uuid.rst:364 +#: ../../library/uuid.rst:355 msgid "" "# generate a random uuid - by default uuid4() is used\n" "$ python -m uuid\n" @@ -484,23 +517,11 @@ msgid "" "# generate a uuid using uuid5\n" "$ python -m uuid -u uuid5 -n @url -N example.com" msgstr "" - -#: ../../library/uuid.rst:182 -msgid "getnode" -msgstr "getnode" - -#: ../../library/uuid.rst:192 -msgid "uuid1" -msgstr "uuid1" - -#: ../../library/uuid.rst:201 -msgid "uuid3" -msgstr "uuid3" - -#: ../../library/uuid.rst:208 -msgid "uuid4" -msgstr "uuid4" - -#: ../../library/uuid.rst:217 -msgid "uuid5" -msgstr "uuid5" +"# 生成一個隨機的 uuid - 預設使用 uuid4()\n" +"$ python -m uuid\n" +"\n" +"# 使用 uuid1() 生成一組 uuid\n" +"$ python -m uuid -u uuid1\n" +"\n" +"# 使用 uuid5 生成一組 uuid\n" +"$ python -m uuid -u uuid5 -n @url -N example.com" diff --git a/library/warnings.po b/library/warnings.po index 914b791ce7..35a798ed78 100644 --- a/library/warnings.po +++ b/library/warnings.po @@ -38,16 +38,16 @@ msgstr "" #: ../../library/warnings.rst:18 msgid "" "Python programmers issue warnings by calling the :func:`warn` function " -"defined in this module. (C programmers use :c:func:`PyErr_WarnEx`; see :ref:" -"`exceptionhandling` for details)." +"defined in this module. (C programmers use :c:func:`PyErr_WarnEx`; " +"see :ref:`exceptionhandling` for details)." msgstr "" #: ../../library/warnings.rst:22 msgid "" "Warning messages are normally written to :data:`sys.stderr`, but their " "disposition can be changed flexibly, from ignoring all warnings to turning " -"them into exceptions. The disposition of warnings can vary based on the :" -"ref:`warning category <warning-categories>`, the text of the warning " +"them into exceptions. The disposition of warnings can vary based on " +"the :ref:`warning category <warning-categories>`, the text of the warning " "message, and the source location where it is issued. Repetitions of a " "particular warning for the same source location are typically suppressed." msgstr "" @@ -62,11 +62,11 @@ msgstr "" #: ../../library/warnings.rst:33 msgid "" -"The determination whether to issue a warning message is controlled by the :" -"ref:`warning filter <warning-filter>`, which is a sequence of matching rules " -"and actions. Rules can be added to the filter by calling :func:" -"`filterwarnings` and reset to its default state by calling :func:" -"`resetwarnings`." +"The determination whether to issue a warning message is controlled by " +"the :ref:`warning filter <warning-filter>`, which is a sequence of matching " +"rules and actions. Rules can be added to the filter by " +"calling :func:`filterwarnings` and reset to its default state by " +"calling :func:`resetwarnings`." msgstr "" #: ../../library/warnings.rst:38 @@ -113,7 +113,7 @@ msgstr "" #: ../../library/warnings.rst:69 msgid "Class" -msgstr "" +msgstr "類別" #: ../../library/warnings.rst:69 msgid "Description" @@ -315,10 +315,10 @@ msgstr "" #: ../../library/warnings.rst:156 msgid "" "*message* is a string containing a regular expression that the start of the " -"warning message must match, case-insensitively. In :option:`-W` and :envvar:" -"`PYTHONWARNINGS`, *message* is a literal string that the start of the " -"warning message must contain (case-insensitively), ignoring any whitespace " -"at the start or end of *message*." +"warning message must match, case-insensitively. In :option:`-W` " +"and :envvar:`PYTHONWARNINGS`, *message* is a literal string that the start " +"of the warning message must contain (case-insensitively), ignoring any " +"whitespace at the start or end of *message*." msgstr "" #: ../../library/warnings.rst:162 @@ -409,11 +409,11 @@ msgstr "action:message:category:module:line" #: ../../library/warnings.rst:211 msgid "" "The meaning of each of these fields is as described in :ref:`warning-" -"filter`. When listing multiple filters on a single line (as for :envvar:" -"`PYTHONWARNINGS`), the individual filters are separated by commas and the " -"filters listed later take precedence over those listed before them (as " -"they're applied left-to-right, and the most recently applied filters take " -"precedence over earlier ones)." +"filter`. When listing multiple filters on a single line (as " +"for :envvar:`PYTHONWARNINGS`), the individual filters are separated by " +"commas and the filters listed later take precedence over those listed before " +"them (as they're applied left-to-right, and the most recently applied " +"filters take precedence over earlier ones)." msgstr "" #: ../../library/warnings.rst:218 @@ -475,8 +475,8 @@ msgstr "" #: ../../library/warnings.rst:251 msgid "" -":exc:`DeprecationWarning` is now ignored by default in addition to :exc:" -"`PendingDeprecationWarning`." +":exc:`DeprecationWarning` is now ignored by default in addition " +"to :exc:`PendingDeprecationWarning`." msgstr "" #: ../../library/warnings.rst:255 @@ -500,10 +500,10 @@ msgstr "" msgid "" "Developers of applications written in Python may wish to hide *all* Python " "level warnings from their users by default, and only display them when " -"running tests or otherwise working on the application. The :data:`sys." -"warnoptions` attribute used to pass filter configurations to the interpreter " -"can be used as a marker to indicate whether or not warnings should be " -"disabled::" +"running tests or otherwise working on the application. " +"The :data:`sys.warnoptions` attribute used to pass filter configurations to " +"the interpreter can be used as a marker to indicate whether or not warnings " +"should be disabled::" msgstr "" #: ../../library/warnings.rst:276 @@ -599,7 +599,7 @@ msgstr "" #: ../../library/warnings.rst:334 msgid "Testing Warnings" -msgstr "" +msgstr "測試警告" #: ../../library/warnings.rst:336 msgid "" @@ -766,8 +766,8 @@ msgstr "" #: ../../library/warnings.rst:457 ../../library/warnings.rst:483 msgid "" -"*source*, if supplied, is the destroyed object which emitted a :exc:" -"`ResourceWarning`." +"*source*, if supplied, is the destroyed object which emitted " +"a :exc:`ResourceWarning`." msgstr "" #: ../../library/warnings.rst:460 @@ -800,26 +800,26 @@ msgstr "" #: ../../library/warnings.rst:486 msgid "Add the *source* parameter." -msgstr "" +msgstr "新增 *source* 參數。" #: ../../library/warnings.rst:492 msgid "" "Write a warning to a file. The default implementation calls " "``formatwarning(message, category, filename, lineno, line)`` and writes the " "resulting string to *file*, which defaults to :data:`sys.stderr`. You may " -"replace this function with any callable by assigning to ``warnings." -"showwarning``. *line* is a line of source code to be included in the warning " -"message; if *line* is not supplied, :func:`showwarning` will try to read the " -"line specified by *filename* and *lineno*." +"replace this function with any callable by assigning to " +"``warnings.showwarning``. *line* is a line of source code to be included in " +"the warning message; if *line* is not supplied, :func:`showwarning` will try " +"to read the line specified by *filename* and *lineno*." msgstr "" #: ../../library/warnings.rst:503 msgid "" "Format a warning the standard way. This returns a string which may contain " "embedded newlines and ends in a newline. *line* is a line of source code to " -"be included in the warning message; if *line* is not supplied, :func:" -"`formatwarning` will try to read the line specified by *filename* and " -"*lineno*." +"be included in the warning message; if *line* is not " +"supplied, :func:`formatwarning` will try to read the line specified by " +"*filename* and *lineno*." msgstr "" #: ../../library/warnings.rst:512 @@ -837,10 +837,10 @@ msgstr "" #: ../../library/warnings.rst:524 msgid "" "Insert a simple entry into the list of :ref:`warnings filter specifications " -"<warning-filter>`. The meaning of the function parameters is as for :func:" -"`filterwarnings`, but regular expressions are not needed as the filter " -"inserted always matches any message in any module as long as the category " -"and line number match." +"<warning-filter>`. The meaning of the function parameters is as " +"for :func:`filterwarnings`, but regular expressions are not needed as the " +"filter inserted always matches any message in any module as long as the " +"category and line number match." msgstr "" #: ../../library/warnings.rst:533 @@ -902,9 +902,9 @@ msgstr "" msgid "" "The deprecation message passed to the decorator is saved in the " "``__deprecated__`` attribute on the decorated object. If applied to an " -"overload, the decorator must be after the :func:`@overload <typing." -"overload>` decorator for the attribute to exist on the overload as returned " -"by :func:`typing.get_overloads`." +"overload, the decorator must be after the :func:`@overload " +"<typing.overload>` decorator for the attribute to exist on the overload as " +"returned by :func:`typing.get_overloads`." msgstr "" #: ../../library/warnings.rst:584 @@ -918,12 +918,13 @@ msgstr "" #: ../../library/warnings.rst:593 msgid "" "A context manager that copies and, upon exit, restores the warnings filter " -"and the :func:`showwarning` function. If the *record* argument is :const:" -"`False` (the default) the context manager returns :class:`None` on entry. If " -"*record* is :const:`True`, a list is returned that is progressively " -"populated with objects as seen by a custom :func:`showwarning` function " -"(which also suppresses output to ``sys.stdout``). Each object in the list " -"has attributes with the same names as the arguments to :func:`showwarning`." +"and the :func:`showwarning` function. If the *record* argument " +"is :const:`False` (the default) the context manager returns :class:`None` on " +"entry. If *record* is :const:`True`, a list is returned that is " +"progressively populated with objects as seen by a custom :func:`showwarning` " +"function (which also suppresses output to ``sys.stdout``). Each object in " +"the list has attributes with the same names as the arguments " +"to :func:`showwarning`." msgstr "" #: ../../library/warnings.rst:602 diff --git a/library/wave.po b/library/wave.po index d2fee008a9..f397aec31b 100644 --- a/library/wave.po +++ b/library/wave.po @@ -99,8 +99,8 @@ msgstr "" #: ../../library/wave.rst:48 msgid "" "The :func:`.open` function may be used in a :keyword:`with` statement. When " -"the :keyword:`!with` block completes, the :meth:`Wave_read.close` or :meth:" -"`Wave_write.close` method is called." +"the :keyword:`!with` block completes, the :meth:`Wave_read.close` " +"or :meth:`Wave_write.close` method is called." msgstr "" ":func:`.open` 函式可以在 :keyword:`with` 陳述式中使用。當 :keyword:`!with` 區" "塊完成時,會呼叫 :meth:`Wave_read.close` 或是 :meth:`Wave_write.close` 方法。" @@ -181,22 +181,23 @@ msgid "Rewind the file pointer to the beginning of the audio stream." msgstr "重置檔案指標至音訊流的開頭。" #: ../../library/wave.rst:126 -#, fuzzy msgid "" "The following two methods are defined for compatibility with the old :mod:`!" "aifc` module, and don't do anything interesting." -msgstr "以下兩個方法是為了與 :mod:`aifc` 模組的保持相容性,並不執行任何操作。" +msgstr "" +"以下兩個方法是為了與舊的 :mod:`!aifc` 模組保持相容性,並不執行任何操作。" #: ../../library/wave.rst:132 msgid "Returns ``None``." msgstr "回傳 ``None``。" #: ../../library/wave.rst:134 ../../library/wave.rst:143 -#, fuzzy msgid "" "The method only existed for compatibility with the :mod:`!aifc` module which " "has been removed in Python 3.13." -msgstr "以下兩個方法是為了與 :mod:`aifc` 模組的保持相容性,並不執行任何操作。" +msgstr "" +"該方法是為了保持與 :mod:`!aifc` 模組相容性而留存,此模組已於 Python 3.13 中刪" +"除。" #: ../../library/wave.rst:141 msgid "Raise an error." @@ -235,21 +236,22 @@ msgid "" "For seekable output streams, the ``wave`` header will automatically be " "updated to reflect the number of frames actually written. For unseekable " "streams, the *nframes* value must be accurate when the first frame data is " -"written. An accurate *nframes* value can be achieved either by calling :" -"meth:`setnframes` or :meth:`setparams` with the number of frames that will " -"be written before :meth:`close` is called and then using :meth:" -"`writeframesraw` to write the frame data, or by calling :meth:`writeframes` " -"with all of the frame data to be written. In the latter case :meth:" -"`writeframes` will calculate the number of frames in the data and set " -"*nframes* accordingly before writing the frame data." +"written. An accurate *nframes* value can be achieved either by " +"calling :meth:`setnframes` or :meth:`setparams` with the number of frames " +"that will be written before :meth:`close` is called and then " +"using :meth:`writeframesraw` to write the frame data, or by " +"calling :meth:`writeframes` with all of the frame data to be written. In " +"the latter case :meth:`writeframes` will calculate the number of frames in " +"the data and set *nframes* accordingly before writing the frame data." msgstr "" "對於可搜尋 (seekable) 的輸出串流,``wave`` 標頭將自動更新,以反映實際寫入的幀" "數。對於不可搜尋的串流,當寫入第一個幀資料時,*nframes* 的值必須是準確的。要" -"取得準確的 *nframes* 值,可以通過呼叫 :meth:`setnframes` 或 :meth:" -"`setparams` 方法,並在呼叫 :meth:`close` 之前設定將寫入的幀數量,然後使用 :" -"meth:`writeframesraw` 方法寫入幀資料;或者通過呼叫 :meth:`writeframes` 方法一" -"次性寫入所有的幀資料。在後一種情況下,:meth:`writeframes` 方法將計算資料中的" -"幀數量,並在寫入幀資料之前相應地設定 *nframes* 的值。" +"取得準確的 *nframes* 值,可以通過呼叫 :meth:`setnframes` " +"或 :meth:`setparams` 方法,並在呼叫 :meth:`close` 之前設定將寫入的幀數量,然" +"後使用 :meth:`writeframesraw` 方法寫入幀資料;或者通過呼" +"叫 :meth:`writeframes` 方法一次性寫入所有的幀資料。在後一種情況" +"下,:meth:`writeframes` 方法將計算資料中的幀數量,並在寫入幀資料之前相應地設" +"定 *nframes* 的值。" #: ../../library/wave.rst:187 msgid "Wave_write objects have the following methods:" @@ -257,10 +259,10 @@ msgstr "Wave_write 物件具有以下方法:" #: ../../library/wave.rst:191 msgid "" -"Make sure *nframes* is correct, and close the file if it was opened by :mod:" -"`wave`. This method is called upon object collection. It will raise an " -"exception if the output stream is not seekable and *nframes* does not match " -"the number of frames actually written." +"Make sure *nframes* is correct, and close the file if it was opened " +"by :mod:`wave`. This method is called upon object collection. It will " +"raise an exception if the output stream is not seekable and *nframes* does " +"not match the number of frames actually written." msgstr "" "確保 *nframes* 正確,如果該檔案是由 :mod:`wave` 開啟的,則關閉該檔案。此方法" "在物件回收時被呼叫。如果輸出串流不可搜尋且 *nframes* 不符合實際寫入的幀數,則" @@ -308,11 +310,11 @@ msgstr "" #: ../../library/wave.rst:238 msgid "" -"Return current position in the file, with the same disclaimer for the :meth:" -"`Wave_read.tell` and :meth:`Wave_read.setpos` methods." +"Return current position in the file, with the same disclaimer for " +"the :meth:`Wave_read.tell` and :meth:`Wave_read.setpos` methods." msgstr "" -"回傳檔案中的指標位置,其指標位置含意與 :meth:`Wave_read.tell` 和 :meth:" -"`Wave_read.setpos` 是一致的。" +"回傳檔案中的指標位置,其指標位置含意與 :meth:`Wave_read.tell` " +"和 :meth:`Wave_read.setpos` 是一致的。" #: ../../library/wave.rst:244 msgid "Write audio frames, without correcting *nframes*." @@ -334,9 +336,9 @@ msgstr "" #: ../../library/wave.rst:260 msgid "" -"Note that it is invalid to set any parameters after calling :meth:" -"`writeframes` or :meth:`writeframesraw`, and any attempt to do so will " -"raise :exc:`wave.Error`." +"Note that it is invalid to set any parameters after " +"calling :meth:`writeframes` or :meth:`writeframesraw`, and any attempt to do " +"so will raise :exc:`wave.Error`." msgstr "" "注意在呼叫 :meth:`writeframes` 或 :meth:`writeframesraw` 之後設置任何參數都是" "無效的,任何嘗試這樣做的操作都會引發 :exc:`wave.Error`。" diff --git a/library/webbrowser.po b/library/webbrowser.po index d65090b5fb..8e2062bdf8 100644 --- a/library/webbrowser.po +++ b/library/webbrowser.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-04-25 00:15+0000\n" "PO-Revision-Date: 2024-09-24 18:27+0000\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -88,7 +88,7 @@ msgstr "" "要 :mod:`ctypes` 模組。如果 :mod:`ctypes` 不可用,則呼叫 :func:`.open` 將會失" "敗。" -#: ../../library/webbrowser.rst:43 +#: ../../library/webbrowser.rst:45 msgid "" "The script :program:`webbrowser` can be used as a command-line interface for " "the module. It accepts a URL as the argument. It accepts the following " @@ -97,40 +97,39 @@ msgstr "" "腳本 :program:`webbrowser` 可以用作模組的命令列介面。它接受 URL 作為引數。它" "接受以下可選參數:" -#: ../../library/webbrowser.rst:47 -msgid "" -"``-n``/``--new-window`` opens the URL in a new browser window, if possible." -msgstr "如果可能的話,``-n``/``--new-window`` 會在新的瀏覽器視窗中開啟 URL。" +#: ../../library/webbrowser.rst:51 +msgid "Opens the URL in a new browser window, if possible." +msgstr "如果可能的話會在新的瀏覽器視窗中開啟 URL。" -#: ../../library/webbrowser.rst:48 -msgid "``-t``/``--new-tab`` opens the URL in a new browser page (\"tab\")." -msgstr "``-t``/``--new-tab`` 會在新的瀏覽器分頁 (\"tab\") 中開啟 URL。" +#: ../../library/webbrowser.rst:55 +msgid "Opens the URL in a new browser tab." +msgstr "會在新的瀏覽器分頁 (\"tab\") 中開啟 URL。" -#: ../../library/webbrowser.rst:50 -msgid "The options are, naturally, mutually exclusive. Usage example::" -msgstr "這些選項自然是相互排斥的。用法範例: ::" +#: ../../library/webbrowser.rst:57 +msgid "The options are, naturally, mutually exclusive. Usage example:" +msgstr "這些選項自然是相互排斥的。用法範例如下:" -#: ../../library/webbrowser.rst:52 +#: ../../library/webbrowser.rst:59 msgid "python -m webbrowser -t \"https://www.python.org/"" msgstr "python -m webbrowser -t \"https://www.python.org/"" -#: ../../library/webbrowser.rst:54 +#: ../../library/webbrowser.rst:63 msgid "Availability" msgstr "" -#: ../../library/webbrowser.rst:56 +#: ../../library/webbrowser.rst:65 msgid "The following exception is defined:" msgstr "以下例外有被定義於該模組:" -#: ../../library/webbrowser.rst:61 +#: ../../library/webbrowser.rst:70 msgid "Exception raised when a browser control error occurs." msgstr "當瀏覽器控制項發生錯誤時引發例外。" -#: ../../library/webbrowser.rst:63 +#: ../../library/webbrowser.rst:72 msgid "The following functions are defined:" msgstr "以下函式有被定義於該模組:" -#: ../../library/webbrowser.rst:68 +#: ../../library/webbrowser.rst:77 msgid "" "Display *url* using the default browser. If *new* is 0, the *url* is opened " "in the same browser window if possible. If *new* is 1, a new browser window " @@ -144,13 +143,13 @@ msgstr "" "可能開啟一個新的瀏覽器分頁 (\"tab\")。如果 *autoraise* 為 ``True``,則盡可能" "提升視窗(請注意,無論此變數的設定如何,許多視窗管理器下都會發生這種情況)。" -#: ../../library/webbrowser.rst:75 ../../library/webbrowser.rst:89 -#: ../../library/webbrowser.rst:97 +#: ../../library/webbrowser.rst:84 ../../library/webbrowser.rst:98 +#: ../../library/webbrowser.rst:106 msgid "" "Returns ``True`` if a browser was successfully launched, ``False`` otherwise." msgstr "如果瀏覽器成功啟動則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/webbrowser.rst:77 +#: ../../library/webbrowser.rst:86 msgid "" "Note that on some platforms, trying to open a filename using this function, " "may work and start the operating system's associated program. However, this " @@ -159,30 +158,30 @@ msgstr "" "請注意,在某些平台上,嘗試使用此函式開啟檔案名稱可能能夠運作並啟動作業系統的" "關聯程式。然而這既不支援也不可移植。" -#: ../../library/webbrowser.rst:81 +#: ../../library/webbrowser.rst:90 msgid "" "Raises an :ref:`auditing event <auditing>` ``webbrowser.open`` with argument " "``url``." msgstr "" -"引發一個附帶引數 ``url`` 的\\ :ref:`稽核事件 <auditing>` ``webbrowser." -"open``。" +"引發一個附帶引數 ``url`` 的\\ :ref:`稽核事件 <auditing>` " +"``webbrowser.open``。" -#: ../../library/webbrowser.rst:86 +#: ../../library/webbrowser.rst:95 msgid "" "Open *url* in a new window of the default browser, if possible, otherwise, " "open *url* in the only browser window." msgstr "" "盡可能在預設瀏覽器的新視窗中開啟 *url*,否則在唯一的瀏覽器視窗中開啟 *url*。" -#: ../../library/webbrowser.rst:94 +#: ../../library/webbrowser.rst:103 msgid "" "Open *url* in a new page (\"tab\") of the default browser, if possible, " "otherwise equivalent to :func:`open_new`." msgstr "" -"盡可能在預設瀏覽器的新分頁 (\"tab\") 中開啟 *url*,否則相當於 :func:" -"`open_new`。" +"盡可能在預設瀏覽器的新分頁 (\"tab\") 中開啟 *url*,否則相當" +"於 :func:`open_new`。" -#: ../../library/webbrowser.rst:102 +#: ../../library/webbrowser.rst:111 msgid "" "Return a controller object for the browser type *using*. If *using* is " "``None``, return a controller for a default browser appropriate to the " @@ -191,36 +190,36 @@ msgstr "" "回傳瀏覽器類型\\ *使用*(以引數 *using* 給定)的控制器物件。如果 *using* 為 " "``None``,則回傳適合呼叫者環境的預設瀏覽器控制器。" -#: ../../library/webbrowser.rst:109 +#: ../../library/webbrowser.rst:118 msgid "" -"Register the browser type *name*. Once a browser type is registered, the :" -"func:`get` function can return a controller for that browser type. If " +"Register the browser type *name*. Once a browser type is registered, " +"the :func:`get` function can return a controller for that browser type. If " "*instance* is not provided, or is ``None``, *constructor* will be called " "without parameters to create an instance when needed. If *instance* is " "provided, *constructor* will never be called, and may be ``None``." msgstr "" -"註冊瀏覽器類型\\ *名稱*(以引數 *name* 給定)。一旦註冊了瀏覽器類型,:func:" -"`get` 函式就可以回傳該瀏覽器類型的控制器。如果沒有提供 *instance* 或為 " -"``None``,則會在需要時不帶參數地呼叫 *constructor* 來建立實例。如果提供了 " -"*instance*,*constructor* 將永遠不會被呼叫,並且可能為 ``None``。" +"註冊瀏覽器類型\\ *名稱*(以引數 *name* 給定)。一旦註冊了瀏覽器類" +"型,:func:`get` 函式就可以回傳該瀏覽器類型的控制器。如果沒有提供 *instance* " +"或為 ``None``,則會在需要時不帶參數地呼叫 *constructor* 來建立實例。如果提供" +"了 *instance*,*constructor* 將永遠不會被呼叫,並且可能為 ``None``。" -#: ../../library/webbrowser.rst:115 +#: ../../library/webbrowser.rst:124 msgid "" -"Setting *preferred* to ``True`` makes this browser a preferred result for a :" -"func:`get` call with no argument. Otherwise, this entry point is only " -"useful if you plan to either set the :envvar:`BROWSER` variable or call :" -"func:`get` with a nonempty argument matching the name of a handler you " +"Setting *preferred* to ``True`` makes this browser a preferred result for " +"a :func:`get` call with no argument. Otherwise, this entry point is only " +"useful if you plan to either set the :envvar:`BROWSER` variable or " +"call :func:`get` with a nonempty argument matching the name of a handler you " "declare." msgstr "" "將 *preferred* 設為 ``True`` 會使該瀏覽器成為不帶引數的 :func:`get` 呼叫的偏" "好結果。否則只有當你計劃設定 :envvar:`BROWSER` 變數或使用與你宣告的處理程序名" "稱相符的非空引數呼叫 :func:`get` 時,此入口點才會有用。" -#: ../../library/webbrowser.rst:121 +#: ../../library/webbrowser.rst:130 msgid "*preferred* keyword-only parameter was added." msgstr "新增了 *preferred* 僅限關鍵字參數。" -#: ../../library/webbrowser.rst:124 +#: ../../library/webbrowser.rst:133 msgid "" "A number of browser types are predefined. This table gives the type names " "that may be passed to the :func:`get` function and the corresponding " @@ -229,220 +228,221 @@ msgstr "" "預先定義了多種瀏覽器類型。此表給出了可以傳遞給 :func:`get` 函式的類型名稱以及" "控制器類別的相應實例化方式,這些都定義於此模組中。" -#: ../../library/webbrowser.rst:129 +#: ../../library/webbrowser.rst:138 msgid "Type Name" msgstr "類型名稱" -#: ../../library/webbrowser.rst:129 +#: ../../library/webbrowser.rst:138 msgid "Class Name" msgstr "類別名稱" -#: ../../library/webbrowser.rst:129 +#: ../../library/webbrowser.rst:138 msgid "Notes" msgstr "註解" -#: ../../library/webbrowser.rst:131 +#: ../../library/webbrowser.rst:140 msgid "``'mozilla'``" msgstr "``'mozilla'``" -#: ../../library/webbrowser.rst:131 ../../library/webbrowser.rst:133 +#: ../../library/webbrowser.rst:140 ../../library/webbrowser.rst:142 msgid "``Mozilla('mozilla')``" msgstr "``Mozilla('mozilla')``" -#: ../../library/webbrowser.rst:133 +#: ../../library/webbrowser.rst:142 msgid "``'firefox'``" msgstr "``'firefox'``" -#: ../../library/webbrowser.rst:135 +#: ../../library/webbrowser.rst:144 msgid "``'epiphany'``" msgstr "``'epiphany'``" -#: ../../library/webbrowser.rst:135 +#: ../../library/webbrowser.rst:144 msgid "``Epiphany('epiphany')``" msgstr "``Epiphany('epiphany')``" -#: ../../library/webbrowser.rst:137 +#: ../../library/webbrowser.rst:146 msgid "``'kfmclient'``" msgstr "``'kfmclient'``" -#: ../../library/webbrowser.rst:137 ../../library/webbrowser.rst:139 -#: ../../library/webbrowser.rst:141 +#: ../../library/webbrowser.rst:146 ../../library/webbrowser.rst:148 +#: ../../library/webbrowser.rst:150 msgid "``Konqueror()``" msgstr "``Konqueror()``" -#: ../../library/webbrowser.rst:137 ../../library/webbrowser.rst:139 -#: ../../library/webbrowser.rst:141 +#: ../../library/webbrowser.rst:146 ../../library/webbrowser.rst:148 +#: ../../library/webbrowser.rst:150 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/webbrowser.rst:139 +#: ../../library/webbrowser.rst:148 msgid "``'konqueror'``" msgstr "``'konqueror'``" -#: ../../library/webbrowser.rst:141 +#: ../../library/webbrowser.rst:150 msgid "``'kfm'``" msgstr "``'kfm'``" -#: ../../library/webbrowser.rst:143 +#: ../../library/webbrowser.rst:152 msgid "``'opera'``" msgstr "``'opera'``" -#: ../../library/webbrowser.rst:143 +#: ../../library/webbrowser.rst:152 msgid "``Opera()``" msgstr "``Opera()``" -#: ../../library/webbrowser.rst:145 +#: ../../library/webbrowser.rst:154 msgid "``'links'``" msgstr "``'links'``" -#: ../../library/webbrowser.rst:145 +#: ../../library/webbrowser.rst:154 msgid "``GenericBrowser('links')``" msgstr "``GenericBrowser('links')``" -#: ../../library/webbrowser.rst:147 +#: ../../library/webbrowser.rst:156 msgid "``'elinks'``" msgstr "``'elinks'``" -#: ../../library/webbrowser.rst:147 +#: ../../library/webbrowser.rst:156 msgid "``Elinks('elinks')``" msgstr "``Elinks('elinks')``" -#: ../../library/webbrowser.rst:149 +#: ../../library/webbrowser.rst:158 msgid "``'lynx'``" msgstr "``'lynx'``" -#: ../../library/webbrowser.rst:149 +#: ../../library/webbrowser.rst:158 msgid "``GenericBrowser('lynx')``" msgstr "``GenericBrowser('lynx')``" -#: ../../library/webbrowser.rst:151 +#: ../../library/webbrowser.rst:160 msgid "``'w3m'``" msgstr "``'w3m'``" -#: ../../library/webbrowser.rst:151 +#: ../../library/webbrowser.rst:160 msgid "``GenericBrowser('w3m')``" msgstr "``GenericBrowser('w3m')``" -#: ../../library/webbrowser.rst:153 +#: ../../library/webbrowser.rst:162 msgid "``'windows-default'``" msgstr "``'windows-default'``" -#: ../../library/webbrowser.rst:153 +#: ../../library/webbrowser.rst:162 msgid "``WindowsDefault``" msgstr "``WindowsDefault``" -#: ../../library/webbrowser.rst:153 +#: ../../library/webbrowser.rst:162 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/webbrowser.rst:155 +#: ../../library/webbrowser.rst:164 msgid "``'macosx'``" msgstr "``'macosx'``" -#: ../../library/webbrowser.rst:155 +#: ../../library/webbrowser.rst:164 msgid "``MacOSXOSAScript('default')``" msgstr "``MacOSXOSAScript('default')``" -#: ../../library/webbrowser.rst:155 ../../library/webbrowser.rst:157 +#: ../../library/webbrowser.rst:164 ../../library/webbrowser.rst:166 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/webbrowser.rst:157 +#: ../../library/webbrowser.rst:166 msgid "``'safari'``" msgstr "``'safari'``" -#: ../../library/webbrowser.rst:157 +#: ../../library/webbrowser.rst:166 msgid "``MacOSXOSAScript('safari')``" msgstr "``MacOSXOSAScript('safari')``" -#: ../../library/webbrowser.rst:159 +#: ../../library/webbrowser.rst:168 msgid "``'google-chrome'``" msgstr "``'google-chrome'``" -#: ../../library/webbrowser.rst:159 +#: ../../library/webbrowser.rst:168 msgid "``Chrome('google-chrome')``" msgstr "``Chrome('google-chrome')``" -#: ../../library/webbrowser.rst:161 +#: ../../library/webbrowser.rst:170 msgid "``'chrome'``" msgstr "``'chrome'``" -#: ../../library/webbrowser.rst:161 +#: ../../library/webbrowser.rst:170 msgid "``Chrome('chrome')``" msgstr "``Chrome('chrome')``" -#: ../../library/webbrowser.rst:163 +#: ../../library/webbrowser.rst:172 msgid "``'chromium'``" msgstr "``'chromium'``" -#: ../../library/webbrowser.rst:163 +#: ../../library/webbrowser.rst:172 msgid "``Chromium('chromium')``" msgstr "``Chromium('chromium')``" -#: ../../library/webbrowser.rst:165 +#: ../../library/webbrowser.rst:174 msgid "``'chromium-browser'``" msgstr "``'chromium-browser'``" -#: ../../library/webbrowser.rst:165 +#: ../../library/webbrowser.rst:174 msgid "``Chromium('chromium-browser')``" msgstr "``Chromium('chromium-browser')``" -#: ../../library/webbrowser.rst:167 +#: ../../library/webbrowser.rst:176 msgid "``'iosbrowser'``" msgstr "``'iosbrowser'``" -#: ../../library/webbrowser.rst:167 +#: ../../library/webbrowser.rst:176 msgid "``IOSBrowser``" msgstr "``IOSBrowser``" -#: ../../library/webbrowser.rst:167 +#: ../../library/webbrowser.rst:176 msgid "\\(4)" msgstr "\\(4)" -#: ../../library/webbrowser.rst:170 +#: ../../library/webbrowser.rst:179 msgid "Notes:" msgstr "註解:" -#: ../../library/webbrowser.rst:173 +#: ../../library/webbrowser.rst:182 msgid "" "\"Konqueror\" is the file manager for the KDE desktop environment for Unix, " "and only makes sense to use if KDE is running. Some way of reliably " "detecting KDE would be nice; the :envvar:`!KDEDIR` variable is not " -"sufficient. Note also that the name \"kfm\" is used even when using the :" -"program:`konqueror` command with KDE 2 --- the implementation selects the " -"best strategy for running Konqueror." +"sufficient. Note also that the name \"kfm\" is used even when using " +"the :program:`konqueror` command with KDE 2 --- the implementation selects " +"the best strategy for running Konqueror." msgstr "" "\"Konqueror\" 是 Unix 的 KDE 桌面環境的檔案管理器,只有在 KDE 運作時才有意" "義。最好能有某種可靠的 KDE 檢測方法;僅有 :envvar:`!KDEDIR` 變數是不夠的。另" "請注意,即使在 KDE 2 中使用 :program:`konqueror` 命令時,也會使用 \"kfm\" 名" "稱 --- 該實作會選擇執行 Konqueror 的最佳策略。" -#: ../../library/webbrowser.rst:180 +#: ../../library/webbrowser.rst:189 msgid "Only on Windows platforms." msgstr "僅在 Windows 平台上。" -#: ../../library/webbrowser.rst:183 +#: ../../library/webbrowser.rst:192 msgid "Only on macOS." msgstr "僅在 macOS 上。" -#: ../../library/webbrowser.rst:186 +#: ../../library/webbrowser.rst:195 msgid "Only on iOS." msgstr "僅在 iOS 上。" -#: ../../library/webbrowser.rst:188 +#: ../../library/webbrowser.rst:197 msgid "" "A new :class:`!MacOSXOSAScript` class has been added and is used on Mac " "instead of the previous :class:`!MacOSX` class. This adds support for " "opening browsers not currently set as the OS default." msgstr "" -"新增了 :class:`!MacOSXOSAScript` 類別並於 Mac 上使用,而非使用先前的 :class:" -"`!MacOSX` 類別。這增加了對開啟目前未設定為作業系統預設之瀏覽器的支援。" +"新增了 :class:`!MacOSXOSAScript` 類別並於 Mac 上使用,而非使用先前" +"的 :class:`!MacOSX` 類別。這增加了對開啟目前未設定為作業系統預設之瀏覽器的支" +"援。" -#: ../../library/webbrowser.rst:193 +#: ../../library/webbrowser.rst:202 msgid "Support for Chrome/Chromium has been added." msgstr "新增了對 Chrome/Chromium 的支援。" -#: ../../library/webbrowser.rst:196 +#: ../../library/webbrowser.rst:205 msgid "" "Support for several obsolete browsers has been removed. Removed browsers " "include Grail, Mosaic, Netscape, Galeon, Skipstone, Iceape, and Firefox " @@ -451,15 +451,15 @@ msgstr "" "對多個過時瀏覽器的支援已被刪除。已刪除的瀏覽器包括 Grail、Mosaic、Netscape、" "Galeon、Skipstone、Iceape 和 Firefox 35 及以下版本。" -#: ../../library/webbrowser.rst:201 +#: ../../library/webbrowser.rst:210 msgid "Support for iOS has been added." msgstr "新增了對 iOS 的支援。" -#: ../../library/webbrowser.rst:204 +#: ../../library/webbrowser.rst:213 msgid "Here are some simple examples::" msgstr "以下是一些簡單範例: ::" -#: ../../library/webbrowser.rst:206 +#: ../../library/webbrowser.rst:215 msgid "" "url = 'https://docs.python.org/'\n" "\n" @@ -477,21 +477,23 @@ msgstr "" "# 在新視窗中開啟 URL,如果可能的話提升視窗。\n" "webbrowser.open_new(url)" -#: ../../library/webbrowser.rst:218 +#: ../../library/webbrowser.rst:227 msgid "Browser Controller Objects" msgstr "瀏覽器控制器物件" -#: ../../library/webbrowser.rst:220 +#: ../../library/webbrowser.rst:229 msgid "" -"Browser controllers provide these methods which parallel three of the module-" -"level convenience functions:" -msgstr "瀏覽器控制器提供了這些與三個模組層級便利函式相同的方法:" +"Browser controllers provide the :attr:`~controller.name` attribute, and the " +"following three methods which parallel module-level convenience functions:" +msgstr "" +"瀏覽器控制器提供了 :attr:`~controller.name` 屬性和以下三個與模組層級便利函式" +"相同的方法:" -#: ../../library/webbrowser.rst:226 +#: ../../library/webbrowser.rst:235 msgid "System-dependent name for the browser." msgstr "瀏覽器的系統相依名稱 (system-dependent name)。" -#: ../../library/webbrowser.rst:231 +#: ../../library/webbrowser.rst:240 msgid "" "Display *url* using the browser handled by this controller. If *new* is 1, a " "new browser window is opened if possible. If *new* is 2, a new browser page " @@ -500,28 +502,28 @@ msgstr "" "使用此控制器處理的瀏覽器顯示 *url*。如果 *new* 為 1,則盡可能開啟一個新的瀏覽" "器視窗。如果 *new* 為 2,則盡可能開啟一個新的瀏覽器分頁 (\"tab\")。" -#: ../../library/webbrowser.rst:238 +#: ../../library/webbrowser.rst:247 msgid "" "Open *url* in a new window of the browser handled by this controller, if " -"possible, otherwise, open *url* in the only browser window. Alias :func:" -"`open_new`." +"possible, otherwise, open *url* in the only browser window. " +"Alias :func:`open_new`." msgstr "" "盡可能在此控制器處理的瀏覽器的新視窗中開啟 *url*,否則在唯一的瀏覽器視窗中開" "啟 *url*。別名為 :func:`open_new`。" -#: ../../library/webbrowser.rst:245 +#: ../../library/webbrowser.rst:254 msgid "" "Open *url* in a new page (\"tab\") of the browser handled by this " "controller, if possible, otherwise equivalent to :func:`open_new`." msgstr "" -"盡可能在此控制器處理的瀏覽器的新分頁 (\"tab\") 中開啟 *url*,否則相當於 :" -"func:`open_new`。" +"盡可能在此控制器處理的瀏覽器的新分頁 (\"tab\") 中開啟 *url*,否則相當" +"於 :func:`open_new`。" -#: ../../library/webbrowser.rst:250 +#: ../../library/webbrowser.rst:259 msgid "Footnotes" msgstr "註腳" -#: ../../library/webbrowser.rst:251 +#: ../../library/webbrowser.rst:260 msgid "" "Executables named here without a full path will be searched in the " "directories given in the :envvar:`PATH` environment variable." diff --git a/library/winsound.po b/library/winsound.po index f51aa90496..0113d36816 100644 --- a/library/winsound.po +++ b/library/winsound.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2025-03-17 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -188,18 +188,25 @@ msgstr "" msgid "Return immediately if the sound driver is busy." msgstr "" -#: ../../library/winsound.rst:140 ../../library/winsound.rst:160 +#: ../../library/winsound.rst:140 +msgid "" +"The *sound* parameter is an application-specific alias in the registry. This " +"flag can be combined with the :const:`SND_ALIAS` flag to specify an " +"application-defined sound alias." +msgstr "" + +#: ../../library/winsound.rst:147 ../../library/winsound.rst:167 msgid "Play the ``SystemDefault`` sound." msgstr "播放 ``SystemDefault`` 聲音。" -#: ../../library/winsound.rst:145 +#: ../../library/winsound.rst:152 msgid "Play the ``SystemExclamation`` sound." msgstr "播放 ``SystemExclamation`` 聲音。" -#: ../../library/winsound.rst:150 +#: ../../library/winsound.rst:157 msgid "Play the ``SystemHand`` sound." msgstr "播放 ``SystemHand`` 聲音。" -#: ../../library/winsound.rst:155 +#: ../../library/winsound.rst:162 msgid "Play the ``SystemQuestion`` sound." msgstr "播放 ``SystemQuestion`` 聲音。" diff --git a/library/wsgiref.po b/library/wsgiref.po index 209ca691ff..f85700c54f 100644 --- a/library/wsgiref.po +++ b/library/wsgiref.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-02-25 00:14+0000\n" "PO-Revision-Date: 2023-12-09 21:29+0800\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -81,13 +81,14 @@ msgid "" "environments. A WSGI environment is a dictionary containing HTTP request " "variables as described in :pep:`3333`. All of the functions taking an " "*environ* parameter expect a WSGI-compliant dictionary to be supplied; " -"please see :pep:`3333` for a detailed specification and :data:`~wsgiref." -"types.WSGIEnvironment` for a type alias that can be used in type annotations." +"please see :pep:`3333` for a detailed specification " +"and :data:`~wsgiref.types.WSGIEnvironment` for a type alias that can be used " +"in type annotations." msgstr "" "這個模組提供許多用於處理 WSGI 環境運作的功能。WSGI 環境是一個包含 HTTP 請求變" "數的字典,如 :pep:`3333` 所述。所有接受 *environ* 的參數的函式都需要提供符合 " -"WSGI 標準的字典;請參閱 :pep:`3333` 取得詳細規格,以及 :data:`~wsgiref.types." -"WSGIEnvironment` 取得可用於使用型別註釋的型別別名。" +"WSGI 標準的字典;請參閱 :pep:`3333` 取得詳細規格,以" +"及 :data:`~wsgiref.types.WSGIEnvironment` 取得可用於使用型別註釋的型別別名。" #: ../../library/wsgiref.rst:56 msgid "" @@ -107,9 +108,9 @@ msgid "" "a value is found, and \"http\" otherwise." msgstr "" "當建立一個包裝 CGI 或類似 FastCGI 的 CGI-like 協議閘道時,此函式非常有用。例" -"如 FastCGI,通常提供這類協議的伺服器在通過 SSL 接收到請求時會包含 " -"\"1\",\"yes\",或 \"on\" 的 ``HTTPS`` 變數,因此,如果找到這樣的值,此函式回" -"傳 \"https\",否則回傳 \"http\"。" +"如 FastCGI,通常提供這類協議的伺服器在通過 SSL 接收到請求時會包含 \"1\"," +"\"yes\",或 \"on\" 的 ``HTTPS`` 變數,因此,如果找到這樣的值,此函式回傳 " +"\"https\",否則回傳 \"http\"。" #: ../../library/wsgiref.rst:69 msgid "" @@ -154,11 +155,11 @@ msgid "" "routine modifies the passed-in environment to make it suitable for invoking " "another WSGI application that is located at the target URI. For example, if " "there is a WSGI application at ``/foo``, and the request URI path is ``/foo/" -"bar/baz``, and the WSGI application at ``/foo`` calls :func:" -"`shift_path_info`, it will receive the string \"bar\", and the environment " -"will be updated to be suitable for passing to a WSGI application at ``/foo/" -"bar``. That is, ``SCRIPT_NAME`` will change from ``/foo`` to ``/foo/bar``, " -"and ``PATH_INFO`` will change from ``/bar/baz`` to ``/baz``." +"bar/baz``, and the WSGI application at ``/foo`` " +"calls :func:`shift_path_info`, it will receive the string \"bar\", and the " +"environment will be updated to be suitable for passing to a WSGI application " +"at ``/foo/bar``. That is, ``SCRIPT_NAME`` will change from ``/foo`` to ``/" +"foo/bar``, and ``PATH_INFO`` will change from ``/bar/baz`` to ``/baz``." msgstr "" "通常,此程式用於處理請求 URI 的每一部分路徑,例如將路徑視為一系列的字典鍵此程" "式會修改傳入的環境,使其適用於呼叫位於目標 URI 的 WSGI 應用程式。例如,如果" @@ -190,9 +191,9 @@ msgstr "為測試目的,以簡單的預設值更新 *environ* 。" msgid "" "This routine adds various parameters required for WSGI, including " "``HTTP_HOST``, ``SERVER_NAME``, ``SERVER_PORT``, ``REQUEST_METHOD``, " -"``SCRIPT_NAME``, ``PATH_INFO``, and all of the :pep:`3333`\\ -defined ``wsgi." -"*`` variables. It only supplies default values, and does not replace any " -"existing settings for these variables." +"``SCRIPT_NAME``, ``PATH_INFO``, and all of the :pep:`3333`\\ -defined " +"``wsgi.*`` variables. It only supplies default values, and does not replace " +"any existing settings for these variables." msgstr "" "這個程式新增 WSGI 所需的各種參數,包括 ``HTTP_HOST``、``SERVER_NAME``、" "``SERVER_PORT``、``REQUEST_METHOD``、``SCRIPT_NAME``、``PATH_INFO``,以及所" @@ -208,12 +209,13 @@ msgstr "" "這個程式目的為了讓 WSGI 伺服器和應用程式的單元測試更容易建置虛擬環境。實際的 " "WSGI 伺服器或應用程式不應該使用它,因為所產生的數據是假的!" -#: ../../library/wsgiref.rst:122 ../../library/wsgiref.rst:170 -#: ../../library/wsgiref.rst:293 ../../library/wsgiref.rst:426 -msgid "Example usage::" -msgstr "用法範例: ::" +#: ../../library/wsgiref.rst:122 +msgid "" +"Example usage (see also :func:`~wsgiref.simple_server.demo_app` for another " +"example)::" +msgstr "" -#: ../../library/wsgiref.rst:124 +#: ../../library/wsgiref.rst:125 msgid "" "from wsgiref.util import setup_testing_defaults\n" "from wsgiref.simple_server import make_server\n" @@ -237,13 +239,13 @@ msgid "" " httpd.serve_forever()" msgstr "" -#: ../../library/wsgiref.rst:146 +#: ../../library/wsgiref.rst:147 msgid "" "In addition to the environment functions above, the :mod:`wsgiref.util` " "module also provides these miscellaneous utilities:" msgstr "除了上述的環境功能外,:mod:`wsgiref.util` 模組還提供以下各類工具:" -#: ../../library/wsgiref.rst:152 +#: ../../library/wsgiref.rst:153 msgid "" "Return ``True`` if 'header_name' is an HTTP/1.1 \"Hop-by-Hop\" header, as " "defined by :rfc:`2616`." @@ -251,31 +253,37 @@ msgstr "" "如果 'header_name' 是根據 :rfc:`2616` 所定義的 HTTP/1.1 \"Hop-by-Hop\" 標頭," "則回傳 ``True``。" -#: ../../library/wsgiref.rst:158 +#: ../../library/wsgiref.rst:159 msgid "" "A concrete implementation of the :class:`wsgiref.types.FileWrapper` protocol " "used to convert a file-like object to an :term:`iterator`. The resulting " "objects are :term:`iterable`\\ s. As the object is iterated over, the " "optional *blksize* parameter will be repeatedly passed to the *filelike* " -"object's :meth:`read` method to obtain bytestrings to yield. When :meth:" -"`read` returns an empty bytestring, iteration is ended and is not resumable." +"object's :meth:`read` method to obtain bytestrings to yield. " +"When :meth:`read` returns an empty bytestring, iteration is ended and is not " +"resumable." msgstr "" -":class:`wsgiref.types.FileWrapper` 協議的具體實作,用於將類檔案物件轉換為 :" -"term:`iterator`。產生的物件是 :term:`iterable`。當物件進行疊代時,將可選的 " -"*blksize* 引數重複傳遞給 *filelike* 物件的 :meth:`read` 方法來獲得將產生" +":class:`wsgiref.types.FileWrapper` 協議的具體實作,用於將類檔案物件轉換" +"為 :term:`iterator`。產生的物件是 :term:`iterable`。當物件進行疊代時,將可選" +"的 *blksize* 引數重複傳遞給 *filelike* 物件的 :meth:`read` 方法來獲得將產生" "(yield)的位元組字串。當 :meth:`read` 回傳一個空位元組字串,代表疊代已結束且" "無法回復。" -#: ../../library/wsgiref.rst:166 +#: ../../library/wsgiref.rst:167 msgid "" "If *filelike* has a :meth:`close` method, the returned object will also have " -"a :meth:`close` method, and it will invoke the *filelike* object's :meth:" -"`close` method when called." +"a :meth:`close` method, and it will invoke the *filelike* " +"object's :meth:`close` method when called." msgstr "" "如果 *filelike* 有 :meth:`close` 方法,則回傳的物件也會具有 :meth:`close` 方" "法,並在呼叫時叫用 *filelike* 物件的 :meth:`close` 方法。" -#: ../../library/wsgiref.rst:172 +#: ../../library/wsgiref.rst:171 ../../library/wsgiref.rst:294 +#: ../../library/wsgiref.rst:429 +msgid "Example usage::" +msgstr "用法範例: ::" + +#: ../../library/wsgiref.rst:173 msgid "" "from io import StringIO\n" "from wsgiref.util import FileWrapper\n" @@ -288,15 +296,15 @@ msgid "" " print(chunk)" msgstr "" -#: ../../library/wsgiref.rst:182 +#: ../../library/wsgiref.rst:183 msgid "Support for :meth:`~object.__getitem__` method has been removed." msgstr "已移除對 :meth:`~object.__getitem__` 方法的支援。" -#: ../../library/wsgiref.rst:187 +#: ../../library/wsgiref.rst:188 msgid ":mod:`wsgiref.headers` -- WSGI response header tools" msgstr ":mod:`wsgiref.headers` -- WSGI 回應標頭工具" -#: ../../library/wsgiref.rst:193 +#: ../../library/wsgiref.rst:194 msgid "" "This module provides a single class, :class:`Headers`, for convenient " "manipulation of WSGI response headers using a mapping-like interface." @@ -304,7 +312,7 @@ msgstr "" "這個模組提供單一類別 :class:`Headers`,用於使用類似對映的介面方便地操作 WSGI " "回應標頭。" -#: ../../library/wsgiref.rst:199 +#: ../../library/wsgiref.rst:200 msgid "" "Create a mapping-like object wrapping *headers*, which must be a list of " "header name/value tuples as described in :pep:`3333`. The default value of " @@ -313,26 +321,25 @@ msgstr "" "建立一個類似對映物件並包裝 *headers*,並且必須是符合 :pep:`3333` 描述的 name/" "value 元組的標頭串列。*headers* 的預設值是一個空串列。" -#: ../../library/wsgiref.rst:203 +#: ../../library/wsgiref.rst:204 msgid "" -":class:`Headers` objects support typical mapping operations including :meth:" -"`~object.__getitem__`, :meth:`~dict.get`, :meth:`~object.__setitem__`, :meth:" -"`~dict.setdefault`, :meth:`~object.__delitem__` and :meth:`~object." -"__contains__`. For each of these methods, the key is the header name " -"(treated case-insensitively), and the value is the first value associated " -"with that header name. Setting a header deletes any existing values for " -"that header, then adds a new value at the end of the wrapped header list. " -"Headers' existing order is generally maintained, with new headers added to " -"the end of the wrapped list." +":class:`Headers` objects support typical mapping operations " +"including :meth:`~object.__getitem__`, :meth:`~dict.get`, :meth:`~object.__setitem__`, :meth:`~dict.setdefault`, :meth:`~object.__delitem__` " +"and :meth:`~object.__contains__`. For each of these methods, the key is the " +"header name (treated case-insensitively), and the value is the first value " +"associated with that header name. Setting a header deletes any existing " +"values for that header, then adds a new value at the end of the wrapped " +"header list. Headers' existing order is generally maintained, with new " +"headers added to the end of the wrapped list." msgstr "" -":class:`Headers` 物件支援典型對映操作包括 :meth:`__getitem__`、:meth:`~dict." -"get`、:meth:`~object.__setitem__`、:meth:`~dict.setdefault`、:meth:`~object." -"__delitem__` 以及 :meth:`~object.__contains__`。對於這些方法中的每一個,鍵是" -"標頭名稱(以不區分大小寫方式處理),而值則是與該標頭名稱關聯的第一個值。設定" -"標頭會刪除該標頭的所有現有值,然後將新值添加到包裝的標頭串列末尾。標頭的現有" -"順序通常保持不變,新標頭會添加到包裝串列的末尾。" +":class:`Headers` 物件支援典型對映操作包" +"括 :meth:`__getitem__`、:meth:`~dict.get`、:meth:`~object.__setitem__`、:meth:`~dict.setdefault`、:meth:`~object.__delitem__` " +"以及 :meth:`~object.__contains__`。對於這些方法中的每一個,鍵是標頭名稱(以不" +"區分大小寫方式處理),而值則是與該標頭名稱關聯的第一個值。設定標頭會刪除該標" +"頭的所有現有值,然後將新值添加到包裝的標頭串列末尾。標頭的現有順序通常保持不" +"變,新標頭會添加到包裝串列的末尾。" -#: ../../library/wsgiref.rst:213 +#: ../../library/wsgiref.rst:214 msgid "" "Unlike a dictionary, :class:`Headers` objects do not raise an error when you " "try to get or delete a key that isn't in the wrapped header list. Getting a " @@ -343,22 +350,22 @@ msgstr "" "不會引發例外錯誤。取得不存在的標頭只會回傳 ``None``,而刪除不存在的標頭則不會" "有任何效果。" -#: ../../library/wsgiref.rst:218 +#: ../../library/wsgiref.rst:219 msgid "" -":class:`Headers` objects also support :meth:`keys`, :meth:`values`, and :" -"meth:`items` methods. The lists returned by :meth:`keys` and :meth:`items` " -"can include the same key more than once if there is a multi-valued header. " -"The ``len()`` of a :class:`Headers` object is the same as the length of its :" -"meth:`items`, which is the same as the length of the wrapped header list. " -"In fact, the :meth:`items` method just returns a copy of the wrapped header " -"list." +":class:`Headers` objects also support :meth:`keys`, :meth:`values`, " +"and :meth:`items` methods. The lists returned by :meth:`keys` " +"and :meth:`items` can include the same key more than once if there is a " +"multi-valued header. The ``len()`` of a :class:`Headers` object is the same " +"as the length of its :meth:`items`, which is the same as the length of the " +"wrapped header list. In fact, the :meth:`items` method just returns a copy " +"of the wrapped header list." msgstr "" ":class:`Headers` 物件還支援 :meth:`keys`、:meth:`value`、和 :meth:`items` 方" "法。由 :meth:`keys` 和 :meth:`items` 回傳的串列在存在多值標頭時可能會包含相同" "的鍵。:class:`Headers` 物件的 ``len()`` 與 :meth:`items` 的長度相同,也與包裝" "標頭串列的長度相同。實際上,:meth:`items` 方法只是回傳包裝的標頭串列的副本。" -#: ../../library/wsgiref.rst:225 +#: ../../library/wsgiref.rst:226 msgid "" "Calling ``bytes()`` on a :class:`Headers` object returns a formatted " "bytestring suitable for transmission as HTTP response headers. Each header " @@ -370,20 +377,21 @@ msgstr "" "式化的位元組字串。每個標頭都與其值一起置於一行上,由冒號與空格分隔。每行以回" "車(carriage return)和換行(line feed)結束,而該位元組字串則以空行結束。" -#: ../../library/wsgiref.rst:231 +#: ../../library/wsgiref.rst:232 msgid "" -"In addition to their mapping interface and formatting features, :class:" -"`Headers` objects also have the following methods for querying and adding " -"multi-valued headers, and for adding headers with MIME parameters:" +"In addition to their mapping interface and formatting " +"features, :class:`Headers` objects also have the following methods for " +"querying and adding multi-valued headers, and for adding headers with MIME " +"parameters:" msgstr "" "除了對映介面和格式化功能外,:class:`Headers` 物件還具有以下查詢及附加多值標頭" "的以及附加 MIME 參數標頭的方法:" -#: ../../library/wsgiref.rst:238 +#: ../../library/wsgiref.rst:239 msgid "Return a list of all the values for the named header." msgstr "回傳指定標頭的所有值的串列。" -#: ../../library/wsgiref.rst:240 +#: ../../library/wsgiref.rst:241 msgid "" "The returned list will be sorted in the order they appeared in the original " "header list or were added to this instance, and may contain duplicates. Any " @@ -394,14 +402,14 @@ msgstr "" "序,並且可能包含重複的內容。任何被刪除並重新插入的欄位都會被添加到標頭串列的" "末尾。如果不存在指定名稱的欄位,則回傳空串列。" -#: ../../library/wsgiref.rst:248 +#: ../../library/wsgiref.rst:249 msgid "" "Add a (possibly multi-valued) header, with optional MIME parameters " "specified via keyword arguments." msgstr "" "添加一個(可能是多值的)標頭,可通過關鍵字引數來指定選擇性的 MIME 參數。" -#: ../../library/wsgiref.rst:251 +#: ../../library/wsgiref.rst:252 msgid "" "*name* is the header field to add. Keyword arguments can be used to set " "MIME parameters for the header field. Each parameter must be a string or " @@ -418,55 +426,55 @@ msgstr "" "則以 ``name=\"value\"`` 的形式添加到標頭值參數中。如果它是 ``None``,則僅添加" "參數名稱。(這使用於沒有值的 MIME 參數)使用範例: ::" -#: ../../library/wsgiref.rst:259 +#: ../../library/wsgiref.rst:260 msgid "h.add_header('content-disposition', 'attachment', filename='bud.gif')" msgstr "h.add_header('content-disposition', 'attachment', filename='bud.gif')" -#: ../../library/wsgiref.rst:261 +#: ../../library/wsgiref.rst:262 msgid "The above will add a header that looks like this::" msgstr "上述操作將添加看起來像這樣的標頭: ::" -#: ../../library/wsgiref.rst:263 +#: ../../library/wsgiref.rst:264 msgid "Content-Disposition: attachment; filename=\"bud.gif\"" msgstr "Content-Disposition: attachment; filename=\"bud.gif\"" -#: ../../library/wsgiref.rst:266 +#: ../../library/wsgiref.rst:267 msgid "*headers* parameter is optional." msgstr "*headers* 參數是可選的。" -#: ../../library/wsgiref.rst:271 +#: ../../library/wsgiref.rst:272 msgid ":mod:`wsgiref.simple_server` -- a simple WSGI HTTP server" msgstr ":mod:`wsgiref.simple_server` -- 一個簡單的 WSGI HTTP 伺服器" -#: ../../library/wsgiref.rst:277 +#: ../../library/wsgiref.rst:278 msgid "" "This module implements a simple HTTP server (based on :mod:`http.server`) " "that serves WSGI applications. Each server instance serves a single WSGI " "application on a given host and port. If you want to serve multiple " "applications on a single host and port, you should create a WSGI application " "that parses ``PATH_INFO`` to select which application to invoke for each " -"request. (E.g., using the :func:`shift_path_info` function from :mod:" -"`wsgiref.util`.)" +"request. (E.g., using the :func:`shift_path_info` function " +"from :mod:`wsgiref.util`.)" msgstr "" "這個模組實作一個簡單的的 HTTP 伺服器(基於 :mod:`http.server`)用於提供 WSGI " "應用程式。每個伺服器執行個體在特定的主機與埠提供單一的 WSGI 應用程式。如果你" "想要在單一主機與埠上提供多個應用程式,你應該建立一個 WSGI 應用程式以剖析 " -"``PATH_INFO`` 去選擇為每個請求叫用哪個應用程式。(例如,使用來自 :mod:" -"`wsgiref.util` 的 :func:`shift_path_info` 函式。)" +"``PATH_INFO`` 去選擇為每個請求叫用哪個應用程式。(例如,使用來" +"自 :mod:`wsgiref.util` 的 :func:`shift_path_info` 函式。)" -#: ../../library/wsgiref.rst:288 +#: ../../library/wsgiref.rst:289 msgid "" "Create a new WSGI server listening on *host* and *port*, accepting " "connections for *app*. The return value is an instance of the supplied " "*server_class*, and will process requests using the specified " -"*handler_class*. *app* must be a WSGI application object, as defined by :" -"pep:`3333`." +"*handler_class*. *app* must be a WSGI application object, as defined " +"by :pep:`3333`." msgstr "" "建立一個新的 WSGI 伺服器監聽 *host* 和 *port*,接受 *app* 的連線。回傳值是提" "供 *server_class* 的實例,並將使用指定的 *handler_class* 處理請求。*app* 必須" "是一個 WSGI 應用程式物件,如 :pep:`3333` 所定義。" -#: ../../library/wsgiref.rst:295 +#: ../../library/wsgiref.rst:296 msgid "" "from wsgiref.simple_server import make_server, demo_app\n" "\n" @@ -480,7 +488,7 @@ msgid "" " httpd.handle_request()" msgstr "" -#: ../../library/wsgiref.rst:309 +#: ../../library/wsgiref.rst:310 msgid "" "This function is a small but complete WSGI application that returns a text " "page containing the message \"Hello world!\" and a list of the key/value " @@ -493,77 +501,85 @@ msgstr "" "(例如 :mod:`wsgiref.simple_server`)是否能正確執行簡單的 WSGI 應用程式非常有" "用。" -#: ../../library/wsgiref.rst:318 +#: ../../library/wsgiref.rst:316 msgid "" -"Create a :class:`WSGIServer` instance. *server_address* should be a ``(host," -"port)`` tuple, and *RequestHandlerClass* should be the subclass of :class:" -"`http.server.BaseHTTPRequestHandler` that will be used to process requests." +"The *start_response* callable should follow the :class:`.StartResponse` " +"protocol." +msgstr "" + +#: ../../library/wsgiref.rst:321 +msgid "" +"Create a :class:`WSGIServer` instance. *server_address* should be a " +"``(host,port)`` tuple, and *RequestHandlerClass* should be the subclass " +"of :class:`http.server.BaseHTTPRequestHandler` that will be used to process " +"requests." msgstr "" "建立一個 :class:`WSGIServer` 實例。*server_address* 應該是一個 ``(host, " -"port)`` 元組,而 *RequestHandlerClass* 應該是 :class:`http.server." -"BaseHTTPRequestHandler` 的子類別,將用於處理請求。" +"port)`` 元組,而 *RequestHandlerClass* 應該" +"是 :class:`http.server.BaseHTTPRequestHandler` 的子類別,將用於處理請求。" -#: ../../library/wsgiref.rst:323 +#: ../../library/wsgiref.rst:326 msgid "" -"You do not normally need to call this constructor, as the :func:" -"`make_server` function can handle all the details for you." +"You do not normally need to call this constructor, as " +"the :func:`make_server` function can handle all the details for you." msgstr "" "通常你不需要呼叫這個建構函式(constructor),因為 :func:`make_server` 函式可" "以為你處理所有細節。" -#: ../../library/wsgiref.rst:326 +#: ../../library/wsgiref.rst:329 msgid "" ":class:`WSGIServer` is a subclass of :class:`http.server.HTTPServer`, so all " "of its methods (such as :meth:`serve_forever` and :meth:`handle_request`) " "are available. :class:`WSGIServer` also provides these WSGI-specific methods:" msgstr "" ":class:`WSGIServer` 是 :class:`http.server.HTTPServer` 的子類別,因此它的所有" -"方法(例如 :meth:`serve_forever` 和 :meth:`handle_request`)都可用。:class:" -"`WSGIServer` 也提供這些特定於 WSGI 的方法:" +"方法(例如 :meth:`serve_forever` 和 :meth:`handle_request`)都可" +"用。:class:`WSGIServer` 也提供這些特定於 WSGI 的方法:" -#: ../../library/wsgiref.rst:333 +#: ../../library/wsgiref.rst:336 msgid "" "Sets the callable *application* as the WSGI application that will receive " "requests." msgstr "將可呼叫的 *application* 設定為接收請求的 WSGI 應用程式。" -#: ../../library/wsgiref.rst:339 +#: ../../library/wsgiref.rst:342 msgid "Returns the currently set application callable." msgstr "回傳目前設定應用程式的可呼叫物件。" -#: ../../library/wsgiref.rst:341 +#: ../../library/wsgiref.rst:344 msgid "" -"Normally, however, you do not need to use these additional methods, as :meth:" -"`set_app` is normally called by :func:`make_server`, and the :meth:`get_app` " -"exists mainly for the benefit of request handler instances." +"Normally, however, you do not need to use these additional methods, " +"as :meth:`set_app` is normally called by :func:`make_server`, and " +"the :meth:`get_app` exists mainly for the benefit of request handler " +"instances." msgstr "" -"然而,通常情況下你不需要去使用這些額外方法,因為 :meth:`set_app` 通常會被 :" -"func:`make_server` 呼叫而 :meth:`get_app` 主要存在於請求處理程式(handler)實" -"例的好處上。" +"然而,通常情況下你不需要去使用這些額外方法,因為 :meth:`set_app` 通常會" +"被 :func:`make_server` 呼叫而 :meth:`get_app` 主要存在於請求處理程式" +"(handler)實例的好處上。" -#: ../../library/wsgiref.rst:348 +#: ../../library/wsgiref.rst:351 msgid "" "Create an HTTP handler for the given *request* (i.e. a socket), " -"*client_address* (a ``(host,port)`` tuple), and *server* (:class:" -"`WSGIServer` instance)." +"*client_address* (a ``(host,port)`` tuple), and *server* " +"(:class:`WSGIServer` instance)." msgstr "" "為給定的 *request*(即一個 socket)、*client_address*(一個 ``(host,port)`` " "位元組)、*server* (:class:`WSGIServer` 實例) 建立一個 HTTP 處理程式" "(handler)。" -#: ../../library/wsgiref.rst:351 +#: ../../library/wsgiref.rst:354 msgid "" "You do not need to create instances of this class directly; they are " "automatically created as needed by :class:`WSGIServer` objects. You can, " -"however, subclass this class and supply it as a *handler_class* to the :func:" -"`make_server` function. Some possibly relevant methods for overriding in " -"subclasses:" +"however, subclass this class and supply it as a *handler_class* to " +"the :func:`make_server` function. Some possibly relevant methods for " +"overriding in subclasses:" msgstr "" "你不需要直接建立這個類別的實例;它們會在需要時由 :class:`WSGIServer` 物件自動" -"建立。不過,你可以建立這個類別的子類別並將其作為 *handler_class* 提供給 :" -"func:`make_server` 函式。一些可能相關的方法可以在子類別中進行覆寫:" +"建立。不過,你可以建立這個類別的子類別並將其作為 *handler_class* 提供" +"給 :func:`make_server` 函式。一些可能相關的方法可以在子類別中進行覆寫:" -#: ../../library/wsgiref.rst:360 +#: ../../library/wsgiref.rst:363 msgid "" "Return a :data:`~wsgiref.types.WSGIEnvironment` dictionary for a request. " "The default implementation copies the contents of the :class:`WSGIServer` " @@ -574,17 +590,17 @@ msgid "" msgstr "" "唯一個請求回傳一個 :data:`~wsgiref.types.WSGIEnvironment` 字典。預設的實作會" "複製 :class:`WSGIServer` 物件的 :attr:`base_environ` 字典屬性的內容以及添加" -"從 HTTP 請求中衍生的各種標頭。每次呼叫這個方法都應該回傳一個包含所有如 :pep:" -"`3333` 所指定的相關 CGI 環境變數的新字典。" +"從 HTTP 請求中衍生的各種標頭。每次呼叫這個方法都應該回傳一個包含所有" +"如 :pep:`3333` 所指定的相關 CGI 環境變數的新字典。" -#: ../../library/wsgiref.rst:371 +#: ../../library/wsgiref.rst:374 msgid "" "Return the object that should be used as the ``wsgi.errors`` stream. The " "default implementation just returns ``sys.stderr``." msgstr "" "回傳的物件應該被用作 ``wsgi.errors`` 串流。預設實作只會回傳 ``sys.stderr``。" -#: ../../library/wsgiref.rst:377 +#: ../../library/wsgiref.rst:380 msgid "" "Process the HTTP request. The default implementation creates a handler " "instance using a :mod:`wsgiref.handlers` class to implement the actual WSGI " @@ -593,17 +609,17 @@ msgstr "" "處理 HTTP 請求。預設實作會使用 :mod:`wsgiref.handler` 類別來建立處置程式" "(handler)實例來實作實際 WSGI 應用程式介面。" -#: ../../library/wsgiref.rst:383 +#: ../../library/wsgiref.rst:386 msgid ":mod:`wsgiref.validate` --- WSGI conformance checker" msgstr ":mod:`wsgiref.validate` --- WSGI 符合性檢查" -#: ../../library/wsgiref.rst:389 +#: ../../library/wsgiref.rst:392 msgid "" "When creating new WSGI application objects, frameworks, servers, or " -"middleware, it can be useful to validate the new code's conformance using :" -"mod:`wsgiref.validate`. This module provides a function that creates WSGI " -"application objects that validate communications between a WSGI server or " -"gateway and a WSGI application object, to check both sides for protocol " +"middleware, it can be useful to validate the new code's conformance " +"using :mod:`wsgiref.validate`. This module provides a function that creates " +"WSGI application objects that validate communications between a WSGI server " +"or gateway and a WSGI application object, to check both sides for protocol " "conformance." msgstr "" "當建立新的 WSGI 應用程式物件、框架、伺服器、或是中介軟體(middleware)時,使" @@ -611,7 +627,7 @@ msgstr "" "個函式用於建立 WSGI 應用程式物件,並用於驗證 WSGI 伺服器或是閘道與 WSGI 應用" "程式物件之間的通訊,以檢查雙方協議的符合性。" -#: ../../library/wsgiref.rst:396 +#: ../../library/wsgiref.rst:399 msgid "" "Note that this utility does not guarantee complete :pep:`3333` compliance; " "an absence of errors from this module does not necessarily mean that errors " @@ -623,7 +639,7 @@ msgstr "" "錯誤。但是,如果如果這個模組產生錯誤,那麼幾乎可以確定伺服器或應用程式不是 " "100% 符合標準。" -#: ../../library/wsgiref.rst:401 +#: ../../library/wsgiref.rst:404 msgid "" "This module is based on the :mod:`paste.lint` module from Ian Bicking's " "\"Python Paste\" library." @@ -631,7 +647,7 @@ msgstr "" "這個模組基於 Ian Bicking 的 \"Python Paste\" 函式庫的 :mod:`paste.lint` 模" "組。" -#: ../../library/wsgiref.rst:407 +#: ../../library/wsgiref.rst:410 msgid "" "Wrap *application* and return a new WSGI application object. The returned " "application will forward all requests to the original *application*, and " @@ -642,7 +658,7 @@ msgstr "" "請求給原始的 *application*,並檢查 *application* 和呼叫它的伺服器是否符合 " "WSGI 規範和 :rfc:`2616`。" -#: ../../library/wsgiref.rst:412 +#: ../../library/wsgiref.rst:415 msgid "" "Any detected nonconformance results in an :exc:`AssertionError` being " "raised; note, however, that how these errors are handled is server-" @@ -653,12 +669,12 @@ msgid "" "stream." msgstr "" "任何在 :exc:`AssertionError` 中偵測不符合結果都會發起例外;但請注意,如何處理" -"這些錯誤取決於伺服器。例如,基於 :mod:`wsgiref.handlers` 的 :mod:`wsgiref." -"simple_server` 以及其他伺服器(未覆蓋錯誤處理方法以執行其他操作的伺服器)將僅" -"輸出一條錯誤訊息,指示發生錯誤,並將回溯訊息輸出到 ``sys.stderr`` 或是其他錯" -"誤串流。" +"這些錯誤取決於伺服器。例如,基於 :mod:`wsgiref.handlers` " +"的 :mod:`wsgiref.simple_server` 以及其他伺服器(未覆蓋錯誤處理方法以執行其他" +"操作的伺服器)將僅輸出一條錯誤訊息,指示發生錯誤,並將回溯訊息輸出到 " +"``sys.stderr`` 或是其他錯誤串流。" -#: ../../library/wsgiref.rst:419 +#: ../../library/wsgiref.rst:422 msgid "" "This wrapper may also generate output using the :mod:`warnings` module to " "indicate behaviors that are questionable but which may not actually be " @@ -668,11 +684,11 @@ msgid "" "object)." msgstr "" "這個包裝器也可以使用 :mod:`warnings` 模組生成輸出去指示一些可能有疑慮但實際上" -"可能不會被 :pep:`3333` 禁止的行為。除非使用 Python 命令列選項或 :mod:" -"`warnings` API,抑制了這些警告,否則這類警告將被寫入到 ``sys.stderr``\\ " -"(*not* ``wsgi.errors``,除非它們碰巧是相同的物件)。" +"可能不會被 :pep:`3333` 禁止的行為。除非使用 Python 命令列選項" +"或 :mod:`warnings` API,抑制了這些警告,否則這類警告將被寫入到 " +"``sys.stderr``\\ (*not* ``wsgi.errors``,除非它們碰巧是相同的物件)。" -#: ../../library/wsgiref.rst:428 +#: ../../library/wsgiref.rst:431 msgid "" "from wsgiref.validate import validator\n" "from wsgiref.simple_server import make_server\n" @@ -696,11 +712,11 @@ msgid "" " httpd.serve_forever()" msgstr "" -#: ../../library/wsgiref.rst:451 +#: ../../library/wsgiref.rst:454 msgid ":mod:`wsgiref.handlers` -- server/gateway base classes" msgstr ":mod:`wsgiref.handlers` -- 伺服器 / 閘道基本類別" -#: ../../library/wsgiref.rst:457 +#: ../../library/wsgiref.rst:460 msgid "" "This module provides base handler classes for implementing WSGI servers and " "gateways. These base classes handle most of the work of communicating with " @@ -711,7 +727,7 @@ msgstr "" "處理程式大部分與 WSGI 應用程式通訊的工作,只要它們被提供 CGI-like 環境,以及" "輸入、輸出和錯誤串流。" -#: ../../library/wsgiref.rst:465 +#: ../../library/wsgiref.rst:468 msgid "" "CGI-based invocation via ``sys.stdin``, ``sys.stdout``, ``sys.stderr`` and " "``os.environ``. This is useful when you have a WSGI application and want to " @@ -723,18 +739,18 @@ msgstr "" "很有用的。只需叫用 ``CGIHandler().run(app)``,其中 ``app`` 是你希望叫用的 " "WSGI 應用程式物件。" -#: ../../library/wsgiref.rst:470 +#: ../../library/wsgiref.rst:473 msgid "" -"This class is a subclass of :class:`BaseCGIHandler` that sets ``wsgi." -"run_once`` to true, ``wsgi.multithread`` to false, and ``wsgi.multiprocess`` " -"to true, and always uses :mod:`sys` and :mod:`os` to obtain the necessary " -"CGI streams and environment." +"This class is a subclass of :class:`BaseCGIHandler` that sets " +"``wsgi.run_once`` to true, ``wsgi.multithread`` to false, and " +"``wsgi.multiprocess`` to true, and always uses :mod:`sys` and :mod:`os` to " +"obtain the necessary CGI streams and environment." msgstr "" "這個類別是 :class:`BaseCGIHandler` 的子類別將 ``wsgi.run_once`` 設置為 true," "``wsgi.multithread`` 設置為 false,並將 ``wsgi.multiprocess`` 設置為 true,並" "且始終使用 :mod:`sys` 和 :mod:`os` 來取得所需的 CGI 串流以及環境。" -#: ../../library/wsgiref.rst:478 +#: ../../library/wsgiref.rst:481 msgid "" "A specialized alternative to :class:`CGIHandler`, for use when deploying on " "Microsoft's IIS web server, without having set the config allowPathInfo " @@ -744,7 +760,7 @@ msgstr "" "個專門替代選擇,無需設置 config 的 allowPathInfo 選項(IIS>=7),或 metabase " "的 allowPathInfoForScriptMappings 選項(IIS<7)。" -#: ../../library/wsgiref.rst:482 +#: ../../library/wsgiref.rst:485 msgid "" "By default, IIS gives a ``PATH_INFO`` that duplicates the ``SCRIPT_NAME`` at " "the front, causing problems for WSGI applications that wish to implement " @@ -754,7 +770,7 @@ msgstr "" "作路由的 WSGI 應用程式造成問題。這個處理程式(handler)會移除任何這樣的重複路" "徑。" -#: ../../library/wsgiref.rst:486 +#: ../../library/wsgiref.rst:489 msgid "" "IIS can be configured to pass the correct ``PATH_INFO``, but this causes " "another bug where ``PATH_TRANSLATED`` is wrong. Luckily this variable is " @@ -770,30 +786,31 @@ msgstr "" "``PATH_TRANSLATED`` 問題時會中斷。由於這個原因幾乎從不會使用修復的 IIS<7(即" "使是 IIS7 也很少使用它,因為它仍然沒有相應的 UI)。" -#: ../../library/wsgiref.rst:494 +#: ../../library/wsgiref.rst:497 msgid "" "There is no way for CGI code to tell whether the option was set, so a " -"separate handler class is provided. It is used in the same way as :class:" -"`CGIHandler`, i.e., by calling ``IISCGIHandler().run(app)``, where ``app`` " -"is the WSGI application object you wish to invoke." +"separate handler class is provided. It is used in the same way " +"as :class:`CGIHandler`, i.e., by calling ``IISCGIHandler().run(app)``, where " +"``app`` is the WSGI application object you wish to invoke." msgstr "" "CGI 程式碼無法知道是否已設置該選項,因此提供了一個獨立的處理程式(handler)類" -"別。它的使用方式與 :class:`CGIHandler` 相同,即透過呼叫 ``IISCGIHandler()." -"run(app)`` 來使用,其中 ``app`` 是你希望叫用的 WSGI 應用程式物件。" +"別。它的使用方式與 :class:`CGIHandler` 相同,即透過呼叫 " +"``IISCGIHandler().run(app)`` 來使用,其中 ``app`` 是你希望叫用的 WSGI 應用程" +"式物件。" -#: ../../library/wsgiref.rst:504 +#: ../../library/wsgiref.rst:507 msgid "" -"Similar to :class:`CGIHandler`, but instead of using the :mod:`sys` and :mod:" -"`os` modules, the CGI environment and I/O streams are specified explicitly. " -"The *multithread* and *multiprocess* values are used to set the ``wsgi." -"multithread`` and ``wsgi.multiprocess`` flags for any applications run by " -"the handler instance." +"Similar to :class:`CGIHandler`, but instead of using the :mod:`sys` " +"and :mod:`os` modules, the CGI environment and I/O streams are specified " +"explicitly. The *multithread* and *multiprocess* values are used to set the " +"``wsgi.multithread`` and ``wsgi.multiprocess`` flags for any applications " +"run by the handler instance." msgstr "" "類似於 :class:`CGIHandler`,但不是使用 :mod:`sys` 和 :mod:`os` 模組,而是明確" "指定 CGI 環境與 I/O 串流。*multithread* 和 *multiprocess* 值用於設置由處理程" "式(handler)實例運行的任何應用程式的旗標。" -#: ../../library/wsgiref.rst:510 +#: ../../library/wsgiref.rst:513 msgid "" "This class is a subclass of :class:`SimpleHandler` intended for use with " "software other than HTTP \"origin servers\". If you are writing a gateway " @@ -801,38 +818,37 @@ msgid "" "``Status:`` header to send an HTTP status, you probably want to subclass " "this instead of :class:`SimpleHandler`." msgstr "" -"這個類別是專門為除了 HTTP \"origin servers\" 以外的軟體一起使用的 :class:" -"`SimpleHandler` 的子類別。如果你正在撰寫一個使用 ``Status:`` 標頭來發送 HTTP " -"狀態的閘道協議實作(例如 CGI、FastCGI、SCGI 等),你可能會想要子類化這個類別" -"來替代 :class:`SimpleHandler`。" +"這個類別是專門為除了 HTTP \"origin servers\" 以外的軟體一起使用" +"的 :class:`SimpleHandler` 的子類別。如果你正在撰寫一個使用 ``Status:`` 標頭來" +"發送 HTTP 狀態的閘道協議實作(例如 CGI、FastCGI、SCGI 等),你可能會想要子類" +"化這個類別來替代 :class:`SimpleHandler`。" -#: ../../library/wsgiref.rst:519 +#: ../../library/wsgiref.rst:522 msgid "" "Similar to :class:`BaseCGIHandler`, but designed for use with HTTP origin " "servers. If you are writing an HTTP server implementation, you will " "probably want to subclass this instead of :class:`BaseCGIHandler`." msgstr "" "類似於 :class:`BaseCGIHandler`,但是被設計使用在 HTTP origin 伺服器。如果你正" -"在撰寫 HTTP 伺服器的實作,你可能會想要子類別化這個類別來替代 :class:" -"`BaseCGIHandler`。" +"在撰寫 HTTP 伺服器的實作,你可能會想要子類別化這個類別來替" +"代 :class:`BaseCGIHandler`。" -#: ../../library/wsgiref.rst:523 +#: ../../library/wsgiref.rst:526 msgid "" "This class is a subclass of :class:`BaseHandler`. It overrides the :meth:`!" -"__init__`, :meth:`~BaseHandler.get_stdin`, :meth:`~BaseHandler.get_stderr`, :" -"meth:`~BaseHandler.add_cgi_vars`, :meth:`~BaseHandler._write`, and :meth:" -"`~BaseHandler._flush` methods to support explicitly setting the environment " -"and streams via the constructor. The supplied environment and streams are " -"stored in the :attr:`stdin`, :attr:`stdout`, :attr:`stderr`, and :attr:" -"`environ` attributes." +"__init__`, :meth:`~BaseHandler.get_stdin`, :meth:`~BaseHandler.get_stderr`, :meth:`~BaseHandler.add_cgi_vars`, :meth:`~BaseHandler._write`, " +"and :meth:`~BaseHandler._flush` methods to support explicitly setting the " +"environment and streams via the constructor. The supplied environment and " +"streams are stored in the :attr:`stdin`, :attr:`stdout`, :attr:`stderr`, " +"and :attr:`environ` attributes." msgstr "" "這個類別是 :class:`BaseHandler` 的子類別。它透過建構器去覆寫 :meth:`!" -"__init__`、:meth:`~BaseHandler.get_stdin`、:meth:`~BaseHandler.get_stderr`、:" -"meth:`~BaseHandler.add_cgi_vars`、:meth:`~BaseHandler._write`、和 :meth:" -"`~BaseHandler._flush` 方法來明確提供設置環境與串流。提供的環境與串流被儲存" -"在 :attr:`stdin`、:attr:`stdout`、:attr:`stderr`、和 :attr:`environ` 環境中。" +"__init__`、:meth:`~BaseHandler.get_stdin`、:meth:`~BaseHandler.get_stderr`、:meth:`~BaseHandler.add_cgi_vars`、:meth:`~BaseHandler._write`、" +"和 :meth:`~BaseHandler._flush` 方法來明確提供設置環境與串流。提供的環境與串流" +"被儲存在 :attr:`stdin`、:attr:`stdout`、:attr:`stderr`、和 :attr:`environ` 環" +"境中。" -#: ../../library/wsgiref.rst:532 +#: ../../library/wsgiref.rst:535 msgid "" "The :meth:`~io.BufferedIOBase.write` method of *stdout* should write each " "chunk in full, like :class:`io.BufferedIOBase`." @@ -840,7 +856,7 @@ msgstr "" "*stdout* 的 :meth:`~io.BufferedIOBase.write` 方法應該完整地寫入每個塊" "(chunk),像是 :class:`io.BufferedIOBase`。" -#: ../../library/wsgiref.rst:538 +#: ../../library/wsgiref.rst:541 msgid "" "This is an abstract base class for running WSGI applications. Each instance " "will handle a single HTTP request, although in principle you could create a " @@ -849,17 +865,17 @@ msgstr "" "這是一個運行 WSGI 應用程式的抽象基底類別。每個實例將處理單個 HTTP 請求,儘管" "原則上你可以建立一個可重用於多個請求的子類別。" -#: ../../library/wsgiref.rst:542 +#: ../../library/wsgiref.rst:545 msgid "" ":class:`BaseHandler` instances have only one method intended for external " "use:" msgstr ":class:`BaseHandler` 實例只有一個供外部使用的方法:" -#: ../../library/wsgiref.rst:547 +#: ../../library/wsgiref.rst:550 msgid "Run the specified WSGI application, *app*." msgstr "運行指定 WSGI 應用程式,*app*。" -#: ../../library/wsgiref.rst:549 +#: ../../library/wsgiref.rst:552 msgid "" "All of the other :class:`BaseHandler` methods are invoked by this method in " "the process of running the application, and thus exist primarily to allow " @@ -868,11 +884,11 @@ msgstr "" "此方法在運行應用程式的過程中叫用了所有其他 :class:`BaseHandler` 的方法,因此" "這些方法主要存在是為了允許自定義整個過程。" -#: ../../library/wsgiref.rst:553 +#: ../../library/wsgiref.rst:556 msgid "The following methods MUST be overridden in a subclass:" msgstr "以下方法必須在子類別中覆寫:" -#: ../../library/wsgiref.rst:558 +#: ../../library/wsgiref.rst:561 msgid "" "Buffer the bytes *data* for transmission to the client. It's okay if this " "method actually transmits the data; :class:`BaseHandler` just separates " @@ -883,15 +899,15 @@ msgstr "" "底層系統實際具有這種區分時,:class:`BaseHandler` 為了更好的效能進而分離寫入和" "刷新操作。" -#: ../../library/wsgiref.rst:566 +#: ../../library/wsgiref.rst:569 msgid "" "Force buffered data to be transmitted to the client. It's okay if this " "method is a no-op (i.e., if :meth:`_write` actually sends the data)." msgstr "" -"強制將緩衝數據傳送到用戶端。如果這是一個無操作(no-op)的方法(即,如果 :" -"meth:`_write` 實際上發送了數據),那麼是可以的。" +"強制將緩衝數據傳送到用戶端。如果這是一個無操作(no-op)的方法(即,如" +"果 :meth:`_write` 實際上發送了數據),那麼是可以的。" -#: ../../library/wsgiref.rst:572 +#: ../../library/wsgiref.rst:575 msgid "" "Return an object compatible with :class:`~wsgiref.types.InputStream` " "suitable for use as the ``wsgi.input`` of the request currently being " @@ -900,7 +916,7 @@ msgstr "" "回傳一個與 :class:`~wsgiref.types.InputStream` 相容的物件並適用於用作目前正在" "處理請求的 ``wsgi.input``。" -#: ../../library/wsgiref.rst:579 +#: ../../library/wsgiref.rst:582 msgid "" "Return an object compatible with :class:`~wsgiref.types.ErrorStream` " "suitable for use as the ``wsgi.errors`` of the request currently being " @@ -909,29 +925,29 @@ msgstr "" "回傳一個與 :class:`~wsgiref.types.ErrorStream` 相容的物件並適用於用作目前正在" "處理請求的 ``wsgi.errors``。" -#: ../../library/wsgiref.rst:586 +#: ../../library/wsgiref.rst:589 msgid "" "Insert CGI variables for the current request into the :attr:`environ` " "attribute." msgstr "將目前請求的 CGI 變數插入到 :attr:`environ` 屬性中。" -#: ../../library/wsgiref.rst:588 +#: ../../library/wsgiref.rst:591 msgid "" "Here are some other methods and attributes you may wish to override. This " "list is only a summary, however, and does not include every method that can " "be overridden. You should consult the docstrings and source code for " -"additional information before attempting to create a customized :class:" -"`BaseHandler` subclass." +"additional information before attempting to create a " +"customized :class:`BaseHandler` subclass." msgstr "" "以下是你可能希望覆寫的其他方法和屬性。這個列表只是一個摘要,然而,不包括可以" "被覆寫的每個方法。在嘗試建立自定義的 :class:`BaseHandler` 子類別之前,你應該" "參考文件說明和原始碼以獲得更多資訊。" -#: ../../library/wsgiref.rst:594 +#: ../../library/wsgiref.rst:597 msgid "Attributes and methods for customizing the WSGI environment:" msgstr "用於自定義 WSGI 環境的屬性和方法:" -#: ../../library/wsgiref.rst:599 +#: ../../library/wsgiref.rst:602 msgid "" "The value to be used for the ``wsgi.multithread`` environment variable. It " "defaults to true in :class:`BaseHandler`, but may have a different default " @@ -940,7 +956,7 @@ msgstr "" "用於 ``wsgi.multithread`` 環境變數的值。在 :class:`BaseHandler` 中預設為 " "true,但在其他子類別中可能有不同的預設值(或由建構函式設置)。" -#: ../../library/wsgiref.rst:606 +#: ../../library/wsgiref.rst:609 msgid "" "The value to be used for the ``wsgi.multiprocess`` environment variable. It " "defaults to true in :class:`BaseHandler`, but may have a different default " @@ -949,7 +965,7 @@ msgstr "" "用於 ``wsgi.multiprocess`` 環境變數的值。在 :class:`BaseHandler` 中預設為 " "true,但在其他子類別中可能有不同的預設值(或由建構函式設置)。" -#: ../../library/wsgiref.rst:613 +#: ../../library/wsgiref.rst:616 msgid "" "The value to be used for the ``wsgi.run_once`` environment variable. It " "defaults to false in :class:`BaseHandler`, but :class:`CGIHandler` sets it " @@ -958,20 +974,21 @@ msgstr "" "用於 ``wsgi.run_once`` 環境變數的值。在 :class:`BaseHandler` 中預設為 false," "但 :class:`CGIHandler` 預設將其設置為 true。" -#: ../../library/wsgiref.rst:620 +#: ../../library/wsgiref.rst:623 msgid "" "The default environment variables to be included in every request's WSGI " -"environment. By default, this is a copy of ``os.environ`` at the time that :" -"mod:`wsgiref.handlers` was imported, but subclasses can either create their " -"own at the class or instance level. Note that the dictionary should be " -"considered read-only, since the default value is shared between multiple " +"environment. By default, this is a copy of ``os.environ`` at the time " +"that :mod:`wsgiref.handlers` was imported, but subclasses can either create " +"their own at the class or instance level. Note that the dictionary should " +"be considered read-only, since the default value is shared between multiple " "classes and instances." msgstr "" -"預設環境變數包含在每一個請求的 WSGI 環境中。預設情況下,這是在載入 :mod:" -"`wsgiref.handlers` 時的 ``os.environ`` 副本,但子類別可以在類別或實例層級建立" -"自己的副本。注意字典應該被視為唯讀,因為預設值在多個類別與實例中共享。" +"預設環境變數包含在每一個請求的 WSGI 環境中。預設情況下,這是在載" +"入 :mod:`wsgiref.handlers` 時的 ``os.environ`` 副本,但子類別可以在類別或實例" +"層級建立自己的副本。注意字典應該被視為唯讀,因為預設值在多個類別與實例中共" +"享。" -#: ../../library/wsgiref.rst:630 +#: ../../library/wsgiref.rst:633 msgid "" "If the :attr:`origin_server` attribute is set, this attribute's value is " "used to set the default ``SERVER_SOFTWARE`` WSGI environment variable, and " @@ -981,28 +998,28 @@ msgid "" msgstr "" "如果設置 :attr:`origin_server` 屬性,則此屬性的值將用於設置預設的 " "``SERVER_SOFTWARE`` WSGI 環境變數,並且還將用於設置 HTTP 回應中的預設 " -"``Server:`` 標頭。對於不是 HTTP origin 伺服器的處置程式(例如 :class:" -"`BaseCGIHandler` 和 :class:`CGIHandler`),此屬性將被忽略。" +"``Server:`` 標頭。對於不是 HTTP origin 伺服器的處置程式(例" +"如 :class:`BaseCGIHandler` 和 :class:`CGIHandler`),此屬性將被忽略。" -#: ../../library/wsgiref.rst:636 +#: ../../library/wsgiref.rst:639 msgid "" "The term \"Python\" is replaced with implementation specific term like " "\"CPython\", \"Jython\" etc." msgstr "" "將術語 \"Python\" 替換為特定實作的術語,如 \"CPython\"、\"Jython\" 等。" -#: ../../library/wsgiref.rst:642 +#: ../../library/wsgiref.rst:645 msgid "" "Return the URL scheme being used for the current request. The default " -"implementation uses the :func:`guess_scheme` function from :mod:`wsgiref." -"util` to guess whether the scheme should be \"http\" or \"https\", based on " -"the current request's :attr:`environ` variables." +"implementation uses the :func:`guess_scheme` function " +"from :mod:`wsgiref.util` to guess whether the scheme should be \"http\" or " +"\"https\", based on the current request's :attr:`environ` variables." msgstr "" -"回傳用於目前請求的 URL scheme。預設的實作使用 :mod:`wsgiref.util` 中的 :func:" -"`guess_scheme` 函式去猜測 scheme 是 \"http\" 或是 \"https\",基於目前請求的 :" -"attr:`environ` 變數。" +"回傳用於目前請求的 URL scheme。預設的實作使用 :mod:`wsgiref.util` 中" +"的 :func:`guess_scheme` 函式去猜測 scheme 是 \"http\" 或是 \"https\",基於目" +"前請求的 :attr:`environ` 變數。" -#: ../../library/wsgiref.rst:650 +#: ../../library/wsgiref.rst:653 msgid "" "Set the :attr:`environ` attribute to a fully populated WSGI environment. " "The default implementation uses all of the above methods and attributes, " @@ -1017,11 +1034,11 @@ msgstr "" "``SERVER_SOFTWARE`` 關鍵字,只要 :attr:`origin_server` 屬性是一個 true 值並" "且 :attr:`server_software` 屬性被設置。" -#: ../../library/wsgiref.rst:657 +#: ../../library/wsgiref.rst:660 msgid "Methods and attributes for customizing exception handling:" msgstr "用於自定義例外處理的屬性和方法:" -#: ../../library/wsgiref.rst:662 +#: ../../library/wsgiref.rst:665 msgid "" "Log the *exc_info* tuple in the server log. *exc_info* is a ``(type, value, " "traceback)`` tuple. The default implementation simply writes the traceback " @@ -1035,15 +1052,15 @@ msgstr "" "並刷新它。子類別可以覆蓋此方法以更改格式或重新定向輸出,將追蹤資訊發送給管理" "員,或執行其他被認為合適的操作。" -#: ../../library/wsgiref.rst:671 +#: ../../library/wsgiref.rst:674 msgid "" -"The maximum number of frames to include in tracebacks output by the default :" -"meth:`log_exception` method. If ``None``, all frames are included." +"The maximum number of frames to include in tracebacks output by the " +"default :meth:`log_exception` method. If ``None``, all frames are included." msgstr "" "預設的 :meth:`log_exception` 方法追蹤輸出中包含的最大幀數 。如果為 ``None``," "則包含所有幀。" -#: ../../library/wsgiref.rst:677 +#: ../../library/wsgiref.rst:680 msgid "" "This method is a WSGI application to generate an error page for the user. " "It is only invoked if an error occurs before headers are sent to the client." @@ -1051,25 +1068,30 @@ msgstr "" "這個方法是一個為使用者去產生錯誤頁面的 WSGI 應用程式。只有在標頭傳送給用戶端" "前如果發生錯誤才會被叫用。" -#: ../../library/wsgiref.rst:680 +#: ../../library/wsgiref.rst:683 msgid "" "This method can access the current error using ``sys.exception()``, and " "should pass that information to *start_response* when calling it (as " -"described in the \"Error Handling\" section of :pep:`3333`)." +"described in the \"Error Handling\" section of :pep:`3333`). In particular, " +"the *start_response* callable should follow the :class:`.StartResponse` " +"protocol." msgstr "" "此方法使用 ``sys.exception()`` 存取目前的錯誤,當呼叫它(如 :pep:`3333` 的 " -"\"Error Handling\" 部分所描述)時應該傳遞資訊給 *start_response*。" +"\"Error Handling\" 部分所描述)時應該傳遞資訊給 *start_response*。特別是 " +"*start_response* 可呼叫物件應該遵循 :class:`.StartResponse` 協定。" -#: ../../library/wsgiref.rst:684 +#: ../../library/wsgiref.rst:689 msgid "" -"The default implementation just uses the :attr:`error_status`, :attr:" -"`error_headers`, and :attr:`error_body` attributes to generate an output " -"page. Subclasses can override this to produce more dynamic error output." +"The default implementation just uses " +"the :attr:`error_status`, :attr:`error_headers`, and :attr:`error_body` " +"attributes to generate an output page. Subclasses can override this to " +"produce more dynamic error output." msgstr "" -"預設的實作只是使用 :attr:`error_status`、:attr:`error_headers` 和 :attr:" -"`error_body` 屬性產生輸出頁面。子類別可以覆蓋此方法以生成更動態的錯誤輸出。" +"預設的實作只是使用 :attr:`error_status`、:attr:`error_headers` " +"和 :attr:`error_body` 屬性產生輸出頁面。子類別可以覆蓋此方法以生成更動態的錯" +"誤輸出。" -#: ../../library/wsgiref.rst:688 +#: ../../library/wsgiref.rst:693 msgid "" "Note, however, that it's not recommended from a security perspective to spit " "out diagnostics to any old user; ideally, you should have to do something " @@ -1079,7 +1101,7 @@ msgstr "" "然而,從安全的角度並不建議向任何普通使用者顯示診斷資訊;理想情況下,你應該需" "要採取特殊措施才能啟用診斷輸出,這就是預設實作不包括任何診斷資訊的原因。" -#: ../../library/wsgiref.rst:696 +#: ../../library/wsgiref.rst:701 msgid "" "The HTTP status used for error responses. This should be a status string as " "defined in :pep:`3333`; it defaults to a 500 code and message." @@ -1087,7 +1109,7 @@ msgstr "" "用於錯誤回應的 HTTP 狀態。這應該是一個按照 :pep:`3333` 定義的狀態字串;預設" "為 500 狀態碼和訊息。" -#: ../../library/wsgiref.rst:702 +#: ../../library/wsgiref.rst:707 msgid "" "The HTTP headers used for error responses. This should be a list of WSGI " "response headers (``(name, value)`` tuples), as described in :pep:`3333`. " @@ -1097,7 +1119,7 @@ msgstr "" "value)`` 元組),如 :pep:`3333` 中所描述。預設串列只設置內容種類為 ``text/" "plain``。" -#: ../../library/wsgiref.rst:709 +#: ../../library/wsgiref.rst:714 msgid "" "The error response body. This should be an HTTP response body bytestring. " "It defaults to the plain text, \"A server error occurred. Please contact " @@ -1106,7 +1128,7 @@ msgstr "" "錯誤回應的主體。這應該是一個 HTTP 回應內容的位元組字串。預設為純文字 \"A " "server error occurred. Please contact the administrator.\"" -#: ../../library/wsgiref.rst:713 +#: ../../library/wsgiref.rst:718 msgid "" "Methods and attributes for :pep:`3333`'s \"Optional Platform-Specific File " "Handling\" feature:" @@ -1114,17 +1136,17 @@ msgstr "" "用於 :pep:`3333` 中的 \"Optional Platform-Specific File Handling\" 功能的方法" "和屬性:" -#: ../../library/wsgiref.rst:719 +#: ../../library/wsgiref.rst:724 msgid "" -"A ``wsgi.file_wrapper`` factory, compatible with :class:`wsgiref.types." -"FileWrapper`, or ``None``. The default value of this attribute is the :" -"class:`wsgiref.util.FileWrapper` class." +"A ``wsgi.file_wrapper`` factory, compatible " +"with :class:`wsgiref.types.FileWrapper`, or ``None``. The default value of " +"this attribute is the :class:`wsgiref.util.FileWrapper` class." msgstr "" -"一個 ``wsgi.file_wrapper`` 工廠函式(factory),與 :class:`wsgiref.types." -"FileWrapper` 相容,或者為 ``None``。這個屬性的預設值是 :class:`wsgiref.util." -"FileWrapper` 類別。" +"一個 ``wsgi.file_wrapper`` 工廠函式(factory)," +"與 :class:`wsgiref.types.FileWrapper` 相容,或者為 ``None``。這個屬性的預設值" +"是 :class:`wsgiref.util.FileWrapper` 類別。" -#: ../../library/wsgiref.rst:726 +#: ../../library/wsgiref.rst:731 msgid "" "Override to implement platform-specific file transmission. This method is " "called only if the application's return value is an instance of the class " @@ -1133,35 +1155,35 @@ msgid "" "default transmission code will not be executed. The default implementation " "of this method just returns a false value." msgstr "" -"覆蓋以實作特定平台的檔案傳輸。只有當應用程式的回傳值是由 :attr:" -"`wsgi_file_wrapper` 屬性指定的類別實例時才會呼叫此方法。如果它能夠成功傳輸檔" -"案應該回傳一個 true 值,以便不執行預設的傳輸程式碼。該方法的預設實作只回傳一" -"個 false 值。" +"覆蓋以實作特定平台的檔案傳輸。只有當應用程式的回傳值是" +"由 :attr:`wsgi_file_wrapper` 屬性指定的類別實例時才會呼叫此方法。如果它能夠成" +"功傳輸檔案應該回傳一個 true 值,以便不執行預設的傳輸程式碼。該方法的預設實作" +"只回傳一個 false 值。" -#: ../../library/wsgiref.rst:733 +#: ../../library/wsgiref.rst:738 msgid "Miscellaneous methods and attributes:" msgstr "其他方法和屬性:" -#: ../../library/wsgiref.rst:738 +#: ../../library/wsgiref.rst:743 msgid "" "This attribute should be set to a true value if the handler's :meth:`_write` " "and :meth:`_flush` are being used to communicate directly to the client, " "rather than via a CGI-like gateway protocol that wants the HTTP status in a " "special ``Status:`` header." msgstr "" -"這個屬性應該被設置為 true 值,如果處理程式(handler)的 :meth:`_write` 和 :" -"meth:`_flush` 被用於直接與用戶端通訊,而不是透過 CGI-like 的閘道協議希望 " +"這個屬性應該被設置為 true 值,如果處理程式(handler)的 :meth:`_write` " +"和 :meth:`_flush` 被用於直接與用戶端通訊,而不是透過 CGI-like 的閘道協議希望 " "HTTP 狀態在特殊的 ``Status:`` 標頭中。" -#: ../../library/wsgiref.rst:743 +#: ../../library/wsgiref.rst:748 msgid "" "This attribute's default value is true in :class:`BaseHandler`, but false " "in :class:`BaseCGIHandler` and :class:`CGIHandler`." msgstr "" -"這個屬性在 :class:`BaseCGIHandler` 預設值為 true,但是在 :class:" -"`BaseCGIHandler` 和 :class:`CGIHandler` 為 false。" +"這個屬性在 :class:`BaseCGIHandler` 預設值為 true,但是" +"在 :class:`BaseCGIHandler` 和 :class:`CGIHandler` 為 false。" -#: ../../library/wsgiref.rst:749 +#: ../../library/wsgiref.rst:754 msgid "" "If :attr:`origin_server` is true, this string attribute is used to set the " "HTTP version of the response set to the client. It defaults to ``\"1.0\"``." @@ -1169,11 +1191,11 @@ msgstr "" "如果 :attr:`origin_server` 為 true,則此字串屬性用於設定傳送給用戶端的回應的 " "HTTP 版本。預設為 ``\"1.0\"``。" -#: ../../library/wsgiref.rst:755 +#: ../../library/wsgiref.rst:760 msgid "" "Transcode CGI variables from ``os.environ`` to :pep:`3333` \"bytes in " -"unicode\" strings, returning a new dictionary. This function is used by :" -"class:`CGIHandler` and :class:`IISCGIHandler` in place of directly using " +"unicode\" strings, returning a new dictionary. This function is used " +"by :class:`CGIHandler` and :class:`IISCGIHandler` in place of directly using " "``os.environ``, which is not necessarily WSGI-compliant on all platforms and " "web servers using Python 3 -- specifically, ones where the OS's actual " "environment is Unicode (i.e. Windows), or ones where the environment is " @@ -1181,13 +1203,13 @@ msgid "" "than ISO-8859-1 (e.g. Unix systems using UTF-8)." msgstr "" "從 ``os.environ`` 轉碼 CGI 變數到 :pep:`3333` 中的 \"bytes in unicode\" 字" -"串,並回傳一個新字典。這個函式被 :class:`CGIHandler` 和 :class:" -"`IISCGIHandler` 使用來直接替代 ``os.environ``,在所有平台和使用 Python 3 的網" -"頁伺服器上不一定符合 WSGI 標準,具體來說,在 OS 的實際環境是 Unicode(例如 " -"Windows)的情況下,或者在環境是位元組的情況下,但 Python 用於解碼它的系統編碼" -"不是 ISO-8859-1 (例如使用 UTF-8 的 Unix 系統)。" +"串,並回傳一個新字典。這個函式被 :class:`CGIHandler` " +"和 :class:`IISCGIHandler` 使用來直接替代 ``os.environ``,在所有平台和使用 " +"Python 3 的網頁伺服器上不一定符合 WSGI 標準,具體來說,在 OS 的實際環境是 " +"Unicode(例如 Windows)的情況下,或者在環境是位元組的情況下,但 Python 用於解" +"碼它的系統編碼不是 ISO-8859-1 (例如使用 UTF-8 的 Unix 系統)。" -#: ../../library/wsgiref.rst:764 +#: ../../library/wsgiref.rst:769 msgid "" "If you are implementing a CGI-based handler of your own, you probably want " "to use this routine instead of just copying values out of ``os.environ`` " @@ -1196,17 +1218,17 @@ msgstr "" "如果你自己正在實作 CGI-based 處理程式(handler),你可能想要使用這個函式來替" "換單純直接從 ``os.environ`` 中複製值。" -#: ../../library/wsgiref.rst:772 +#: ../../library/wsgiref.rst:777 msgid ":mod:`wsgiref.types` -- WSGI types for static type checking" msgstr ":mod:`wsgiref.types` -- 用於靜態型別檢查的 WSGI 型別" -#: ../../library/wsgiref.rst:778 +#: ../../library/wsgiref.rst:783 msgid "" -"This module provides various types for static type checking as described in :" -"pep:`3333`." +"This module provides various types for static type checking as described " +"in :pep:`3333`." msgstr "這個模組提供在 :pep:`3333` 中所描述的各種用於靜態型別檢查的型別。" -#: ../../library/wsgiref.rst:786 +#: ../../library/wsgiref.rst:791 msgid "" "A :class:`typing.Protocol` describing :pep:`start_response() <3333#the-start-" "response-callable>` callables (:pep:`3333`)." @@ -1214,49 +1236,52 @@ msgstr "" "一個描述 :pep:`start_response() <3333#the-start-response-callable>` 可呼叫物" "件的 :class:`typing.Protocol` (:pep:`3333`)。" -#: ../../library/wsgiref.rst:792 +#: ../../library/wsgiref.rst:797 msgid "A type alias describing a WSGI environment dictionary." msgstr "一個描述 WSGI 環境字典的型別別名。" -#: ../../library/wsgiref.rst:796 +#: ../../library/wsgiref.rst:801 msgid "A type alias describing a WSGI application callable." msgstr "一個描述 WSGI 應用程式可呼叫物件的型別別名。" -#: ../../library/wsgiref.rst:800 +#: ../../library/wsgiref.rst:805 msgid "" "A :class:`typing.Protocol` describing a :pep:`WSGI Input Stream <3333#input-" "and-error-streams>`." msgstr "" -"一個描述 :pep:`WSGI 輸入串流 <3333#input-and-error-streams>`\\ 的 :class:" -"`typing.Protocol`。" +"一個描述 :pep:`WSGI 輸入串流 <3333#input-and-error-streams>`\\ " +"的 :class:`typing.Protocol`。" -#: ../../library/wsgiref.rst:805 +#: ../../library/wsgiref.rst:810 msgid "" "A :class:`typing.Protocol` describing a :pep:`WSGI Error Stream <3333#input-" "and-error-streams>`." msgstr "" -"一個描述 :pep:`WSGI 錯誤串流 <3333#input-and-error-streams>`\\ 的 :class:" -"`typing.Protocol`。" +"一個描述 :pep:`WSGI 錯誤串流 <3333#input-and-error-streams>`\\ " +"的 :class:`typing.Protocol`。" -#: ../../library/wsgiref.rst:810 +#: ../../library/wsgiref.rst:815 msgid "" "A :class:`typing.Protocol` describing a :pep:`file wrapper <3333#optional-" "platform-specific-file-handling>`. See :class:`wsgiref.util.FileWrapper` for " "a concrete implementation of this protocol." msgstr "" "一個描述\\ :pep:`檔案包裝器 <3333#optional-platform-specific-file-" -"handling>`\\ 的 :class:`typing.Protocol`。請參閱 :class:`wsgiref.util." -"FileWrapper` 來瞭解此協議的具體實作。" +"handling>`\\ 的 :class:`typing.Protocol`。請參" +"閱 :class:`wsgiref.util.FileWrapper` 來瞭解此協議的具體實作。" -#: ../../library/wsgiref.rst:817 +#: ../../library/wsgiref.rst:822 msgid "Examples" msgstr "範例" -#: ../../library/wsgiref.rst:819 -msgid "This is a working \"Hello World\" WSGI application::" -msgstr "這個一個運作中的 \"Hello World\" WSGI 應用程式: ::" +#: ../../library/wsgiref.rst:824 +msgid "" +"This is a working \"Hello World\" WSGI application, where the " +"*start_response* callable should follow the :class:`.StartResponse` " +"protocol::" +msgstr "" -#: ../../library/wsgiref.rst:821 +#: ../../library/wsgiref.rst:827 msgid "" "\"\"\"\n" "Every WSGI application must have an application object - a callable\n" @@ -1285,7 +1310,7 @@ msgid "" " httpd.serve_forever()" msgstr "" -#: ../../library/wsgiref.rst:848 +#: ../../library/wsgiref.rst:854 msgid "" "Example of a WSGI application serving the current directory, accept optional " "directory and port number (default: 8000) on the command line::" @@ -1293,7 +1318,7 @@ msgstr "" "提供目前目錄的 WSGI 應用程式範例,並接受命令列上的可選目錄和埠號(預設:" "8000): ::" -#: ../../library/wsgiref.rst:851 +#: ../../library/wsgiref.rst:857 msgid "" "\"\"\"\n" "Small wsgiref based web server. Takes a path to serve from and an\n" @@ -1337,3 +1362,6 @@ msgid "" " print(\"Shutting down.\")\n" " httpd.server_close()" msgstr "" + +#~ msgid "This is a working \"Hello World\" WSGI application::" +#~ msgstr "這個一個運作中的 \"Hello World\" WSGI 應用程式: ::" diff --git a/library/xmlrpc.client.po b/library/xmlrpc.client.po index 4ea29b3a93..9835d74f1c 100644 --- a/library/xmlrpc.client.po +++ b/library/xmlrpc.client.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-11 00:13+0000\n" +"POT-Creation-Date: 2025-03-04 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -86,29 +86,29 @@ msgid "" "class:`bytes` and :class:`bytearray` objects may be passed to calls. The " "*headers* parameter is an optional sequence of HTTP headers to send with " "each request, expressed as a sequence of 2-tuples representing the header " -"name and value. (e.g. ``[('Header-Name', 'value')]``). The obsolete " -"*use_datetime* flag is similar to *use_builtin_types* but it applies only to " -"date/time values." +"name and value. (e.g. ``[('Header-Name', 'value')]``). If an HTTPS URL is " +"provided, *context* may be :class:`ssl.SSLContext` and configures the SSL " +"settings of the underlying HTTPS connection. The obsolete *use_datetime* " +"flag is similar to *use_builtin_types* but it applies only to date/time " +"values." msgstr "" -#: ../../library/xmlrpc.client.rst:67 ../../library/xmlrpc.client.rst:549 +#: ../../library/xmlrpc.client.rst:69 ../../library/xmlrpc.client.rst:549 msgid "The *use_builtin_types* flag was added." msgstr "新增 *use_builtin_types* 旗標。" -#: ../../library/xmlrpc.client.rst:70 +#: ../../library/xmlrpc.client.rst:72 msgid "The *headers* parameter was added." msgstr "新增 *headers* 參數。" -#: ../../library/xmlrpc.client.rst:73 +#: ../../library/xmlrpc.client.rst:75 msgid "" "Both the HTTP and HTTPS transports support the URL syntax extension for HTTP " "Basic Authentication: ``http://user:pass@host:port/path``. The ``user:" "pass`` portion will be base64-encoded as an HTTP 'Authorization' header, and " "sent to the remote server as part of the connection process when invoking an " "XML-RPC method. You only need to use this if the remote server requires a " -"Basic Authentication user and password. If an HTTPS URL is provided, " -"*context* may be :class:`ssl.SSLContext` and configures the SSL settings of " -"the underlying HTTPS connection." +"Basic Authentication user and password." msgstr "" #: ../../library/xmlrpc.client.rst:82 diff --git a/library/zipfile.po b/library/zipfile.po index acfa9acf15..1d66416bb3 100644 --- a/library/zipfile.po +++ b/library/zipfile.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-09 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -213,7 +213,7 @@ msgid "" "accepted (see :class:`bz2 <bz2.BZ2File>` for more information)." msgstr "" -#: ../../library/zipfile.rst:187 ../../library/zipfile.rst:760 +#: ../../library/zipfile.rst:187 ../../library/zipfile.rst:768 msgid "" "The *strict_timestamps* argument, when set to ``False``, allows to zip files " "older than 1980-01-01 at the cost of setting the timestamp to 1980-01-01. " @@ -274,7 +274,7 @@ msgstr "新增 :class:`ZipFile` 作為情境管理器使用的能力。" msgid "Added support for :mod:`bzip2 <bz2>` and :mod:`lzma` compression." msgstr "新增對於 :mod:`bzip2 <bz2>` 和 :mod:`lzma` 壓縮的支援。" -#: ../../library/zipfile.rst:227 ../../library/zipfile.rst:673 +#: ../../library/zipfile.rst:227 ../../library/zipfile.rst:681 msgid "ZIP64 extensions are enabled by default." msgstr "" @@ -292,15 +292,15 @@ msgstr "" #: ../../library/zipfile.rst:238 msgid "The *file* parameter accepts a :term:`path-like object`." -msgstr "" +msgstr "*file* 參數接受一個 :term:`path-like object`。" #: ../../library/zipfile.rst:241 msgid "Add the *compresslevel* parameter." -msgstr "" +msgstr "新增 *compresslevel* 參數。" #: ../../library/zipfile.rst:244 msgid "The *strict_timestamps* keyword-only parameter." -msgstr "" +msgstr "*strict_timestamps* 僅限關鍵字參數。" #: ../../library/zipfile.rst:247 msgid "" @@ -656,20 +656,31 @@ msgid "" "file.txt', 'dir/', or ''. Defaults to the empty string, indicating the root." msgstr "" -#: ../../library/zipfile.rst:546 +#: ../../library/zipfile.rst:547 +msgid "" +"The :class:`Path` class does not sanitize filenames within the ZIP archive. " +"Unlike the :meth:`ZipFile.extract` and :meth:`ZipFile.extractall` methods, " +"it is the caller's responsibility to validate or sanitize filenames to " +"prevent path traversal vulnerabilities (e.g., filenames containing \"..\" or " +"absolute paths). When handling untrusted archives, consider resolving " +"filenames using :func:`os.path.abspath` and checking against the target " +"directory with :func:`os.path.commonpath`." +msgstr "" + +#: ../../library/zipfile.rst:554 msgid "" "Path objects expose the following features of :mod:`pathlib.Path` objects:" msgstr "" -#: ../../library/zipfile.rst:549 +#: ../../library/zipfile.rst:557 msgid "Path objects are traversable using the ``/`` operator or ``joinpath``." msgstr "" -#: ../../library/zipfile.rst:553 +#: ../../library/zipfile.rst:561 msgid "The final path component." msgstr "" -#: ../../library/zipfile.rst:557 +#: ../../library/zipfile.rst:565 msgid "" "Invoke :meth:`ZipFile.open` on the current path. Allows opening for read or " "write, text or binary through supported modes: 'r', 'w', 'rb', 'wb'. " @@ -678,12 +689,12 @@ msgid "" "``pwd`` parameter to :meth:`ZipFile.open`." msgstr "" -#: ../../library/zipfile.rst:566 +#: ../../library/zipfile.rst:574 msgid "" "Added support for text and binary modes for open. Default mode is now text." msgstr "" -#: ../../library/zipfile.rst:570 ../../library/zipfile.rst:631 +#: ../../library/zipfile.rst:578 ../../library/zipfile.rst:639 msgid "" "The ``encoding`` parameter can be supplied as a positional argument without " "causing a :exc:`TypeError`. As it could in 3.9. Code needing to be " @@ -691,134 +702,134 @@ msgid "" "TextIOWrapper` arguments, ``encoding`` included, as keywords." msgstr "" -#: ../../library/zipfile.rst:578 +#: ../../library/zipfile.rst:586 msgid "Enumerate the children of the current directory." msgstr "" -#: ../../library/zipfile.rst:582 +#: ../../library/zipfile.rst:590 msgid "Return ``True`` if the current context references a directory." msgstr "" -#: ../../library/zipfile.rst:586 +#: ../../library/zipfile.rst:594 msgid "Return ``True`` if the current context references a file." msgstr "" -#: ../../library/zipfile.rst:590 +#: ../../library/zipfile.rst:598 msgid "Return ``True`` if the current context references a symbolic link." msgstr "" -#: ../../library/zipfile.rst:594 +#: ../../library/zipfile.rst:602 msgid "Previously, ``is_symlink`` would unconditionally return ``False``." msgstr "" -#: ../../library/zipfile.rst:599 +#: ../../library/zipfile.rst:607 msgid "" "Return ``True`` if the current context references a file or directory in the " "zip file." msgstr "" -#: ../../library/zipfile.rst:604 +#: ../../library/zipfile.rst:612 msgid "" "The last dot-separated portion of the final component, if any. This is " "commonly called the file extension." msgstr "" -#: ../../library/zipfile.rst:607 +#: ../../library/zipfile.rst:615 msgid "Added :data:`Path.suffix` property." msgstr "新增 :data:`Path.suffix` 特性。" -#: ../../library/zipfile.rst:612 +#: ../../library/zipfile.rst:620 msgid "The final path component, without its suffix." msgstr "" -#: ../../library/zipfile.rst:614 +#: ../../library/zipfile.rst:622 msgid "Added :data:`Path.stem` property." msgstr "新增 :data:`Path.stem` 特性。" -#: ../../library/zipfile.rst:619 +#: ../../library/zipfile.rst:627 msgid "A list of the path’s suffixes, commonly called file extensions." msgstr "" -#: ../../library/zipfile.rst:621 +#: ../../library/zipfile.rst:629 msgid "Added :data:`Path.suffixes` property." msgstr "新增 :data:`Path.suffixes` 特性。" -#: ../../library/zipfile.rst:626 +#: ../../library/zipfile.rst:634 msgid "" "Read the current file as unicode text. Positional and keyword arguments are " "passed through to :class:`io.TextIOWrapper` (except ``buffer``, which is " "implied by the context)." msgstr "" -#: ../../library/zipfile.rst:639 +#: ../../library/zipfile.rst:647 msgid "Read the current file as bytes." msgstr "" -#: ../../library/zipfile.rst:643 +#: ../../library/zipfile.rst:651 msgid "" "Return a new Path object with each of the *other* arguments joined. The " "following are equivalent::" msgstr "" -#: ../../library/zipfile.rst:646 +#: ../../library/zipfile.rst:654 msgid "" ">>> Path(...).joinpath('child').joinpath('grandchild')\n" ">>> Path(...).joinpath('child', 'grandchild')\n" ">>> Path(...) / 'child' / 'grandchild'" msgstr "" -#: ../../library/zipfile.rst:650 +#: ../../library/zipfile.rst:658 msgid "" "Prior to 3.10, ``joinpath`` was undocumented and accepted exactly one " "parameter." msgstr "" -#: ../../library/zipfile.rst:654 +#: ../../library/zipfile.rst:662 msgid "" "The :pypi:`zipp` project provides backports of the latest path object " "functionality to older Pythons. Use ``zipp.Path`` in place of ``zipfile." "Path`` for early access to changes." msgstr "" -#: ../../library/zipfile.rst:662 +#: ../../library/zipfile.rst:670 msgid "PyZipFile Objects" msgstr "PyZipFile 物件" -#: ../../library/zipfile.rst:664 +#: ../../library/zipfile.rst:672 msgid "" "The :class:`PyZipFile` constructor takes the same parameters as the :class:" "`ZipFile` constructor, and one additional parameter, *optimize*." msgstr "" -#: ../../library/zipfile.rst:670 +#: ../../library/zipfile.rst:678 msgid "Added the *optimize* parameter." msgstr "新增 *optimize* 參數。" -#: ../../library/zipfile.rst:676 +#: ../../library/zipfile.rst:684 msgid "" "Instances have one method in addition to those of :class:`ZipFile` objects:" msgstr "" -#: ../../library/zipfile.rst:680 +#: ../../library/zipfile.rst:688 msgid "" "Search for files :file:`\\*.py` and add the corresponding file to the " "archive." msgstr "" -#: ../../library/zipfile.rst:683 +#: ../../library/zipfile.rst:691 msgid "" "If the *optimize* parameter to :class:`PyZipFile` was not given or ``-1``, " "the corresponding file is a :file:`\\*.pyc` file, compiling if necessary." msgstr "" -#: ../../library/zipfile.rst:686 +#: ../../library/zipfile.rst:694 msgid "" "If the *optimize* parameter to :class:`PyZipFile` was ``0``, ``1`` or ``2``, " "only files with that optimization level (see :func:`compile`) are added to " "the archive, compiling if necessary." msgstr "" -#: ../../library/zipfile.rst:690 +#: ../../library/zipfile.rst:698 msgid "" "If *pathname* is a file, the filename must end with :file:`.py`, and just " "the (corresponding :file:`\\*.pyc`) file is added at the top level (no path " @@ -831,11 +842,11 @@ msgid "" "in sorted order." msgstr "" -#: ../../library/zipfile.rst:700 +#: ../../library/zipfile.rst:708 msgid "*basename* is intended for internal use only." msgstr "" -#: ../../library/zipfile.rst:702 +#: ../../library/zipfile.rst:710 msgid "" "*filterfunc*, if given, must be a function taking a single string argument. " "It will be passed each path (including each individual full file path) " @@ -846,7 +857,7 @@ msgid "" "exclude them::" msgstr "" -#: ../../library/zipfile.rst:710 +#: ../../library/zipfile.rst:718 msgid "" ">>> zf = PyZipFile('myprog.zip')\n" ">>> def notests(s):\n" @@ -862,11 +873,11 @@ msgstr "" "...\n" ">>> zf.writepy('myprog', filterfunc=notests)" -#: ../../library/zipfile.rst:717 +#: ../../library/zipfile.rst:725 msgid "The :meth:`writepy` method makes archives with file names like this::" msgstr "" -#: ../../library/zipfile.rst:720 +#: ../../library/zipfile.rst:728 msgid "" "string.pyc # Top level name\n" "test/__init__.pyc # Package directory\n" @@ -875,302 +886,302 @@ msgid "" "test/bogus/myfile.pyc # Submodule test.bogus.myfile" msgstr "" -#: ../../library/zipfile.rst:726 +#: ../../library/zipfile.rst:734 msgid "Added the *filterfunc* parameter." msgstr "新增 *filterfunc* 參數。" -#: ../../library/zipfile.rst:729 +#: ../../library/zipfile.rst:737 msgid "The *pathname* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:732 +#: ../../library/zipfile.rst:740 msgid "Recursion sorts directory entries." msgstr "" -#: ../../library/zipfile.rst:739 +#: ../../library/zipfile.rst:747 msgid "ZipInfo Objects" msgstr "ZipInfo 物件" -#: ../../library/zipfile.rst:741 +#: ../../library/zipfile.rst:749 msgid "" "Instances of the :class:`ZipInfo` class are returned by the :meth:`.getinfo` " "and :meth:`.infolist` methods of :class:`ZipFile` objects. Each object " "stores information about a single member of the ZIP archive." msgstr "" -#: ../../library/zipfile.rst:745 +#: ../../library/zipfile.rst:753 msgid "" "There is one classmethod to make a :class:`ZipInfo` instance for a " "filesystem file:" msgstr "" -#: ../../library/zipfile.rst:751 +#: ../../library/zipfile.rst:759 msgid "" "Construct a :class:`ZipInfo` instance for a file on the filesystem, in " "preparation for adding it to a zip file." msgstr "" -#: ../../library/zipfile.rst:754 +#: ../../library/zipfile.rst:762 msgid "*filename* should be the path to a file or directory on the filesystem." msgstr "" -#: ../../library/zipfile.rst:756 +#: ../../library/zipfile.rst:764 msgid "" "If *arcname* is specified, it is used as the name within the archive. If " "*arcname* is not specified, the name will be the same as *filename*, but " "with any drive letter and leading path separators removed." msgstr "" -#: ../../library/zipfile.rst:768 +#: ../../library/zipfile.rst:776 msgid "The *filename* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:771 +#: ../../library/zipfile.rst:779 msgid "Added the *strict_timestamps* keyword-only parameter." msgstr "新增 *strict_timestamps* 僅限關鍵字參數。" -#: ../../library/zipfile.rst:775 +#: ../../library/zipfile.rst:783 msgid "Instances have the following methods and attributes:" msgstr "" -#: ../../library/zipfile.rst:779 +#: ../../library/zipfile.rst:787 msgid "Return ``True`` if this archive member is a directory." msgstr "" -#: ../../library/zipfile.rst:781 +#: ../../library/zipfile.rst:789 msgid "This uses the entry's name: directories should always end with ``/``." msgstr "" -#: ../../library/zipfile.rst:788 +#: ../../library/zipfile.rst:796 msgid "Name of the file in the archive." msgstr "" -#: ../../library/zipfile.rst:793 +#: ../../library/zipfile.rst:801 msgid "" "The time and date of the last modification to the archive member. This is a " "tuple of six values:" msgstr "" -#: ../../library/zipfile.rst:797 +#: ../../library/zipfile.rst:805 msgid "Index" msgstr "" -#: ../../library/zipfile.rst:797 +#: ../../library/zipfile.rst:805 msgid "Value" msgstr "" -#: ../../library/zipfile.rst:799 +#: ../../library/zipfile.rst:807 msgid "``0``" msgstr "``0``" -#: ../../library/zipfile.rst:799 +#: ../../library/zipfile.rst:807 msgid "Year (>= 1980)" msgstr "" -#: ../../library/zipfile.rst:801 +#: ../../library/zipfile.rst:809 msgid "``1``" msgstr "``1``" -#: ../../library/zipfile.rst:801 +#: ../../library/zipfile.rst:809 msgid "Month (one-based)" msgstr "" -#: ../../library/zipfile.rst:803 +#: ../../library/zipfile.rst:811 msgid "``2``" msgstr "``2``" -#: ../../library/zipfile.rst:803 +#: ../../library/zipfile.rst:811 msgid "Day of month (one-based)" msgstr "" -#: ../../library/zipfile.rst:805 +#: ../../library/zipfile.rst:813 msgid "``3``" msgstr "``3``" -#: ../../library/zipfile.rst:805 +#: ../../library/zipfile.rst:813 msgid "Hours (zero-based)" msgstr "" -#: ../../library/zipfile.rst:807 +#: ../../library/zipfile.rst:815 msgid "``4``" msgstr "``4``" -#: ../../library/zipfile.rst:807 +#: ../../library/zipfile.rst:815 msgid "Minutes (zero-based)" msgstr "" -#: ../../library/zipfile.rst:809 +#: ../../library/zipfile.rst:817 msgid "``5``" msgstr "``5``" -#: ../../library/zipfile.rst:809 +#: ../../library/zipfile.rst:817 msgid "Seconds (zero-based)" msgstr "" -#: ../../library/zipfile.rst:814 +#: ../../library/zipfile.rst:822 msgid "The ZIP file format does not support timestamps before 1980." msgstr "" -#: ../../library/zipfile.rst:819 +#: ../../library/zipfile.rst:827 msgid "Type of compression for the archive member." msgstr "" -#: ../../library/zipfile.rst:824 +#: ../../library/zipfile.rst:832 msgid "Comment for the individual archive member as a :class:`bytes` object." msgstr "" -#: ../../library/zipfile.rst:829 +#: ../../library/zipfile.rst:837 msgid "" "Expansion field data. The `PKZIP Application Note`_ contains some comments " "on the internal structure of the data contained in this :class:`bytes` " "object." msgstr "" -#: ../../library/zipfile.rst:836 +#: ../../library/zipfile.rst:844 msgid "System which created ZIP archive." msgstr "" -#: ../../library/zipfile.rst:841 +#: ../../library/zipfile.rst:849 msgid "PKZIP version which created ZIP archive." msgstr "" -#: ../../library/zipfile.rst:846 +#: ../../library/zipfile.rst:854 msgid "PKZIP version needed to extract archive." msgstr "" -#: ../../library/zipfile.rst:851 +#: ../../library/zipfile.rst:859 msgid "Must be zero." msgstr "" -#: ../../library/zipfile.rst:856 +#: ../../library/zipfile.rst:864 msgid "ZIP flag bits." msgstr "" -#: ../../library/zipfile.rst:861 +#: ../../library/zipfile.rst:869 msgid "Volume number of file header." msgstr "" -#: ../../library/zipfile.rst:866 +#: ../../library/zipfile.rst:874 msgid "Internal attributes." msgstr "" -#: ../../library/zipfile.rst:871 +#: ../../library/zipfile.rst:879 msgid "External file attributes." msgstr "" -#: ../../library/zipfile.rst:876 +#: ../../library/zipfile.rst:884 msgid "Byte offset to the file header." msgstr "" -#: ../../library/zipfile.rst:881 +#: ../../library/zipfile.rst:889 msgid "CRC-32 of the uncompressed file." msgstr "" -#: ../../library/zipfile.rst:886 +#: ../../library/zipfile.rst:894 msgid "Size of the compressed data." msgstr "" -#: ../../library/zipfile.rst:891 +#: ../../library/zipfile.rst:899 msgid "Size of the uncompressed file." msgstr "" -#: ../../library/zipfile.rst:898 +#: ../../library/zipfile.rst:906 msgid "Command-Line Interface" msgstr "" -#: ../../library/zipfile.rst:900 +#: ../../library/zipfile.rst:908 msgid "" "The :mod:`zipfile` module provides a simple command-line interface to " "interact with ZIP archives." msgstr "" -#: ../../library/zipfile.rst:903 +#: ../../library/zipfile.rst:911 msgid "" "If you want to create a new ZIP archive, specify its name after the :option:" "`-c` option and then list the filename(s) that should be included:" msgstr "" -#: ../../library/zipfile.rst:906 +#: ../../library/zipfile.rst:914 msgid "$ python -m zipfile -c monty.zip spam.txt eggs.txt" msgstr "$ python -m zipfile -c monty.zip spam.txt eggs.txt" -#: ../../library/zipfile.rst:910 +#: ../../library/zipfile.rst:918 msgid "Passing a directory is also acceptable:" msgstr "" -#: ../../library/zipfile.rst:912 +#: ../../library/zipfile.rst:920 msgid "$ python -m zipfile -c monty.zip life-of-brian_1979/" msgstr "$ python -m zipfile -c monty.zip life-of-brian_1979/" -#: ../../library/zipfile.rst:916 +#: ../../library/zipfile.rst:924 msgid "" "If you want to extract a ZIP archive into the specified directory, use the :" "option:`-e` option:" msgstr "" -#: ../../library/zipfile.rst:919 +#: ../../library/zipfile.rst:927 msgid "$ python -m zipfile -e monty.zip target-dir/" msgstr "$ python -m zipfile -e monty.zip target-dir/" -#: ../../library/zipfile.rst:923 +#: ../../library/zipfile.rst:931 msgid "For a list of the files in a ZIP archive, use the :option:`-l` option:" msgstr "" -#: ../../library/zipfile.rst:925 +#: ../../library/zipfile.rst:933 msgid "$ python -m zipfile -l monty.zip" msgstr "$ python -m zipfile -l monty.zip" -#: ../../library/zipfile.rst:931 +#: ../../library/zipfile.rst:939 msgid "Command-line options" msgstr "" -#: ../../library/zipfile.rst:936 +#: ../../library/zipfile.rst:944 msgid "List files in a zipfile." msgstr "" -#: ../../library/zipfile.rst:941 +#: ../../library/zipfile.rst:949 msgid "Create zipfile from source files." msgstr "" -#: ../../library/zipfile.rst:946 +#: ../../library/zipfile.rst:954 msgid "Extract zipfile into target directory." msgstr "" -#: ../../library/zipfile.rst:951 +#: ../../library/zipfile.rst:959 msgid "Test whether the zipfile is valid or not." msgstr "" -#: ../../library/zipfile.rst:955 +#: ../../library/zipfile.rst:963 msgid "" "Specify encoding of member names for :option:`-l`, :option:`-e` and :option:" "`-t`." msgstr "" -#: ../../library/zipfile.rst:962 +#: ../../library/zipfile.rst:970 msgid "Decompression pitfalls" msgstr "" -#: ../../library/zipfile.rst:964 +#: ../../library/zipfile.rst:972 msgid "" "The extraction in zipfile module might fail due to some pitfalls listed " "below." msgstr "" -#: ../../library/zipfile.rst:967 +#: ../../library/zipfile.rst:975 msgid "From file itself" msgstr "" -#: ../../library/zipfile.rst:969 +#: ../../library/zipfile.rst:977 msgid "" "Decompression may fail due to incorrect password / CRC checksum / ZIP format " "or unsupported compression method / decryption." msgstr "" -#: ../../library/zipfile.rst:973 +#: ../../library/zipfile.rst:981 msgid "File System limitations" msgstr "" -#: ../../library/zipfile.rst:975 +#: ../../library/zipfile.rst:983 msgid "" "Exceeding limitations on different file systems can cause decompression " "failed. Such as allowable characters in the directory entries, length of the " @@ -1178,33 +1189,33 @@ msgid "" "files, etc." msgstr "" -#: ../../library/zipfile.rst:982 +#: ../../library/zipfile.rst:990 msgid "Resources limitations" msgstr "" -#: ../../library/zipfile.rst:984 +#: ../../library/zipfile.rst:992 msgid "" "The lack of memory or disk volume would lead to decompression failed. For " "example, decompression bombs (aka `ZIP bomb`_) apply to zipfile library that " "can cause disk volume exhaustion." msgstr "" -#: ../../library/zipfile.rst:989 +#: ../../library/zipfile.rst:997 msgid "Interruption" msgstr "" -#: ../../library/zipfile.rst:991 +#: ../../library/zipfile.rst:999 msgid "" "Interruption during the decompression, such as pressing control-C or killing " "the decompression process may result in incomplete decompression of the " "archive." msgstr "" -#: ../../library/zipfile.rst:995 +#: ../../library/zipfile.rst:1003 msgid "Default behaviors of extraction" msgstr "" -#: ../../library/zipfile.rst:997 +#: ../../library/zipfile.rst:1005 msgid "" "Not knowing the default extraction behaviors can cause unexpected " "decompression results. For example, when extracting the same archive twice, " diff --git a/library/zlib.po b/library/zlib.po index e560901d86..ab476e6640 100644 --- a/library/zlib.po +++ b/library/zlib.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2025-04-26 00:14+0000\n" "PO-Revision-Date: 2022-12-28 20:58+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -562,6 +562,12 @@ msgid "" "functions." msgstr "zlib 手冊解釋了函式庫中許多函式的語義和用法。" +#: ../../library/zlib.rst:345 +msgid "" +"In case gzip (de)compression is a bottleneck, the `python-isal`_ package " +"speeds up (de)compression with a mostly compatible API." +msgstr "" + #: ../../library/zlib.rst:123 msgid "Cyclic Redundancy Check" msgstr "Cyclic Redundancy Check(循環冗餘核對)" diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index d887991a95..9930b44306 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -33,10 +33,10 @@ msgstr "" msgid "" "The :keyword:`if`, :keyword:`while` and :keyword:`for` statements implement " "traditional control flow constructs. :keyword:`try` specifies exception " -"handlers and/or cleanup code for a group of statements, while the :keyword:" -"`with` statement allows the execution of initialization and finalization " -"code around a block of code. Function and class definitions are also " -"syntactically compound statements." +"handlers and/or cleanup code for a group of statements, while " +"the :keyword:`with` statement allows the execution of initialization and " +"finalization code around a block of code. Function and class definitions " +"are also syntactically compound statements." msgstr "" #: ../../reference/compound_stmts.rst:26 @@ -78,8 +78,8 @@ msgid "" "Note that statements always end in a ``NEWLINE`` possibly followed by a " "``DEDENT``. Also note that optional continuation clauses always begin with " "a keyword that cannot start a statement, thus there are no ambiguities (the " -"'dangling :keyword:`else`' problem is solved in Python by requiring nested :" -"keyword:`if` statements to be indented)." +"'dangling :keyword:`else`' problem is solved in Python by requiring " +"nested :keyword:`if` statements to be indented)." msgstr "" #: ../../reference/compound_stmts.rst:75 @@ -127,9 +127,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:133 msgid "" "A :keyword:`break` statement executed in the first suite terminates the loop " -"without executing the :keyword:`!else` clause's suite. A :keyword:" -"`continue` statement executed in the first suite skips the rest of the suite " -"and goes back to testing the expression." +"without executing the :keyword:`!else` clause's suite. " +"A :keyword:`continue` statement executed in the first suite skips the rest " +"of the suite and goes back to testing the expression." msgstr "" #: ../../reference/compound_stmts.rst:142 @@ -144,22 +144,23 @@ msgstr "" #: ../../reference/compound_stmts.rst:160 msgid "" -"The ``starred_list`` expression is evaluated once; it should yield an :term:" -"`iterable` object. An :term:`iterator` is created for that iterable. The " -"first item provided by the iterator is then assigned to the target list " -"using the standard rules for assignments (see :ref:`assignment`), and the " -"suite is executed. This repeats for each item provided by the iterator. " -"When the iterator is exhausted, the suite in the :keyword:`!else` clause, if " -"present, is executed, and the loop terminates." +"The ``starred_list`` expression is evaluated once; it should yield " +"an :term:`iterable` object. An :term:`iterator` is created for that " +"iterable. The first item provided by the iterator is then assigned to the " +"target list using the standard rules for assignments " +"(see :ref:`assignment`), and the suite is executed. This repeats for each " +"item provided by the iterator. When the iterator is exhausted, the suite in " +"the :keyword:`!else` clause, if present, is executed, and the loop " +"terminates." msgstr "" #: ../../reference/compound_stmts.rst:173 msgid "" "A :keyword:`break` statement executed in the first suite terminates the loop " -"without executing the :keyword:`!else` clause's suite. A :keyword:" -"`continue` statement executed in the first suite skips the rest of the suite " -"and continues with the next item, or with the :keyword:`!else` clause if " -"there is no next item." +"without executing the :keyword:`!else` clause's suite. " +"A :keyword:`continue` statement executed in the first suite skips the rest " +"of the suite and continues with the next item, or with the :keyword:`!else` " +"clause if there is no next item." msgstr "" #: ../../reference/compound_stmts.rst:179 @@ -203,9 +204,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:231 msgid "" -"Additional information on exceptions can be found in section :ref:" -"`exceptions`, and information on using the :keyword:`raise` statement to " -"generate exceptions may be found in section :ref:`raise`." +"Additional information on exceptions can be found in " +"section :ref:`exceptions`, and information on using the :keyword:`raise` " +"statement to generate exceptions may be found in section :ref:`raise`." msgstr "" #: ../../reference/compound_stmts.rst:239 @@ -251,13 +252,13 @@ msgstr "" #: ../../reference/compound_stmts.rst:267 msgid "" "When a matching :keyword:`!except` clause is found, the exception is " -"assigned to the target specified after the :keyword:`!as` keyword in that :" -"keyword:`!except` clause, if present, and the :keyword:`!except` clause's " -"suite is executed. All :keyword:`!except` clauses must have an executable " -"block. When the end of this block is reached, execution continues normally " -"after the entire :keyword:`try` statement. (This means that if two nested " -"handlers exist for the same exception, and the exception occurs in the :" -"keyword:`!try` clause of the inner handler, the outer handler will not " +"assigned to the target specified after the :keyword:`!as` keyword in " +"that :keyword:`!except` clause, if present, and the :keyword:`!except` " +"clause's suite is executed. All :keyword:`!except` clauses must have an " +"executable block. When the end of this block is reached, execution continues " +"normally after the entire :keyword:`try` statement. (This means that if two " +"nested handlers exist for the same exception, and the exception occurs in " +"the :keyword:`!try` clause of the inner handler, the outer handler will not " "handle the exception.)" msgstr "" @@ -355,15 +356,15 @@ msgstr ":keyword:`!except*` 子句" #: ../../reference/compound_stmts.rst:335 msgid "" -"The :keyword:`!except*` clause(s) are used for handling :exc:" -"`ExceptionGroup`\\s. The exception type for matching is interpreted as in " -"the case of :keyword:`except`, but in the case of exception groups we can " -"have partial matches when the type matches some of the exceptions in the " -"group. This means that multiple :keyword:`!except*` clauses can execute, " -"each handling part of the exception group. Each clause executes at most once " -"and handles an exception group of all matching exceptions. Each exception " -"in the group is handled by at most one :keyword:`!except*` clause, the first " -"that matches it. ::" +"The :keyword:`!except*` clause(s) are used for " +"handling :exc:`ExceptionGroup`\\s. The exception type for matching is " +"interpreted as in the case of :keyword:`except`, but in the case of " +"exception groups we can have partial matches when the type matches some of " +"the exceptions in the group. This means that multiple :keyword:`!except*` " +"clauses can execute, each handling part of the exception group. Each clause " +"executes at most once and handles an exception group of all matching " +"exceptions. Each exception in the group is handled by at most " +"one :keyword:`!except*` clause, the first that matches it. ::" msgstr "" #: ../../reference/compound_stmts.rst:345 @@ -427,8 +428,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:384 msgid "" "It is not possible to mix :keyword:`except` and :keyword:`!except*` in the " -"same :keyword:`try`. :keyword:`break`, :keyword:`continue` and :keyword:" -"`return` cannot appear in an :keyword:`!except*` clause." +"same :keyword:`try`. :keyword:`break`, :keyword:`continue` " +"and :keyword:`return` cannot appear in an :keyword:`!except*` clause." msgstr "" #: ../../reference/compound_stmts.rst:399 @@ -438,10 +439,10 @@ msgstr ":keyword:`!else` 子句" #: ../../reference/compound_stmts.rst:401 msgid "" "The optional :keyword:`!else` clause is executed if the control flow leaves " -"the :keyword:`try` suite, no exception was raised, and no :keyword:" -"`return`, :keyword:`continue`, or :keyword:`break` statement was executed. " -"Exceptions in the :keyword:`!else` clause are not handled by the preceding :" -"keyword:`except` clauses." +"the :keyword:`try` suite, no exception was raised, and " +"no :keyword:`return`, :keyword:`continue`, or :keyword:`break` statement was " +"executed. Exceptions in the :keyword:`!else` clause are not handled by the " +"preceding :keyword:`except` clauses." msgstr "" #: ../../reference/compound_stmts.rst:413 @@ -450,16 +451,16 @@ msgstr ":keyword:`!finally` 子句" #: ../../reference/compound_stmts.rst:415 msgid "" -"If :keyword:`!finally` is present, it specifies a 'cleanup' handler. The :" -"keyword:`try` clause is executed, including any :keyword:`except` and :" -"keyword:`else` clauses. If an exception occurs in any of the clauses and is " -"not handled, the exception is temporarily saved. The :keyword:`!finally` " -"clause is executed. If there is a saved exception it is re-raised at the " -"end of the :keyword:`!finally` clause. If the :keyword:`!finally` clause " -"raises another exception, the saved exception is set as the context of the " -"new exception. If the :keyword:`!finally` clause executes a :keyword:" -"`return`, :keyword:`break` or :keyword:`continue` statement, the saved " -"exception is discarded::" +"If :keyword:`!finally` is present, it specifies a 'cleanup' handler. " +"The :keyword:`try` clause is executed, including any :keyword:`except` " +"and :keyword:`else` clauses. If an exception occurs in any of the clauses " +"and is not handled, the exception is temporarily saved. The :keyword:`!" +"finally` clause is executed. If there is a saved exception it is re-raised " +"at the end of the :keyword:`!finally` clause. If the :keyword:`!finally` " +"clause raises another exception, the saved exception is set as the context " +"of the new exception. If the :keyword:`!finally` clause executes " +"a :keyword:`return`, :keyword:`break` or :keyword:`continue` statement, the " +"saved exception is discarded::" msgstr "" #: ../../reference/compound_stmts.rst:425 @@ -526,8 +527,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:460 msgid "" -"Prior to Python 3.8, a :keyword:`continue` statement was illegal in the :" -"keyword:`!finally` clause due to a problem with the implementation." +"Prior to Python 3.8, a :keyword:`continue` statement was illegal in " +"the :keyword:`!finally` clause due to a problem with the implementation." msgstr "" #: ../../reference/compound_stmts.rst:469 @@ -538,8 +539,8 @@ msgstr ":keyword:`!with` 陳述式" msgid "" "The :keyword:`with` statement is used to wrap the execution of a block with " "methods defined by a context manager (see section :ref:`context-managers`). " -"This allows common :keyword:`try`...\\ :keyword:`except`...\\ :keyword:" -"`finally` usage patterns to be encapsulated for convenient reuse." +"This allows common :keyword:`try`...\\ :keyword:`except`..." +"\\ :keyword:`finally` usage patterns to be encapsulated for convenient reuse." msgstr "" #: ../../reference/compound_stmts.rst:488 @@ -550,8 +551,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:490 msgid "" -"The context expression (the expression given in the :token:`~python-grammar:" -"with_item`) is evaluated to obtain a context manager." +"The context expression (the expression given in the :token:`~python-" +"grammar:with_item`) is evaluated to obtain a context manager." msgstr "" #: ../../reference/compound_stmts.rst:493 @@ -575,11 +576,11 @@ msgstr "" #: ../../reference/compound_stmts.rst:504 msgid "" -"The :keyword:`with` statement guarantees that if the :meth:`~object." -"__enter__` method returns without an error, then :meth:`~object.__exit__` " -"will always be called. Thus, if an error occurs during the assignment to the " -"target list, it will be treated the same as an error occurring within the " -"suite would be. See step 7 below." +"The :keyword:`with` statement guarantees that if " +"the :meth:`~object.__enter__` method returns without an error, " +"then :meth:`~object.__exit__` will always be called. Thus, if an error " +"occurs during the assignment to the target list, it will be treated the same " +"as an error occurring within the suite would be. See step 7 below." msgstr "" #: ../../reference/compound_stmts.rst:510 @@ -590,16 +591,16 @@ msgstr "" msgid "" "The context manager's :meth:`~object.__exit__` method is invoked. If an " "exception caused the suite to be exited, its type, value, and traceback are " -"passed as arguments to :meth:`~object.__exit__`. Otherwise, three :const:" -"`None` arguments are supplied." +"passed as arguments to :meth:`~object.__exit__`. Otherwise, " +"three :const:`None` arguments are supplied." msgstr "" #: ../../reference/compound_stmts.rst:517 msgid "" -"If the suite was exited due to an exception, and the return value from the :" -"meth:`~object.__exit__` method was false, the exception is reraised. If the " -"return value was true, the exception is suppressed, and execution continues " -"with the statement following the :keyword:`with` statement." +"If the suite was exited due to an exception, and the return value from " +"the :meth:`~object.__exit__` method was false, the exception is reraised. " +"If the return value was true, the exception is suppressed, and execution " +"continues with the statement following the :keyword:`with` statement." msgstr "" #: ../../reference/compound_stmts.rst:522 @@ -667,8 +668,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:550 msgid "" -"With more than one item, the context managers are processed as if multiple :" -"keyword:`with` statements were nested::" +"With more than one item, the context managers are processed as if " +"multiple :keyword:`with` statements were nested::" msgstr "" #: ../../reference/compound_stmts.rst:553 @@ -1047,8 +1048,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:846 msgid "" -"The rule ``strings`` and the token ``NUMBER`` are defined in the :doc:" -"`standard Python grammar <./grammar>`. Triple-quoted strings are " +"The rule ``strings`` and the token ``NUMBER`` are defined in " +"the :doc:`standard Python grammar <./grammar>`. Triple-quoted strings are " "supported. Raw strings and byte strings are supported. :ref:`f-strings` " "are not supported." msgstr "" @@ -1078,8 +1079,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:869 msgid "" "A single underscore ``_`` is not a capture pattern (this is what ``!'_'`` " -"expresses). It is instead treated as a :token:`~python-grammar:" -"wildcard_pattern`." +"expresses). It is instead treated as a :token:`~python-" +"grammar:wildcard_pattern`." msgstr "" #: ../../reference/compound_stmts.rst:873 @@ -1140,8 +1141,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:918 msgid "" -"In simple terms ``NAME1.NAME2`` will succeed only if ``<subject> == NAME1." -"NAME2``" +"In simple terms ``NAME1.NAME2`` will succeed only if ``<subject> == " +"NAME1.NAME2``" msgstr "" #: ../../reference/compound_stmts.rst:922 @@ -1353,8 +1354,8 @@ msgstr "" msgid "" "Key-value pairs are matched using the two-argument form of the mapping " "subject's ``get()`` method. Matched key-value pairs must already be present " -"in the mapping, and not created on-the-fly via :meth:`__missing__` or :meth:" -"`~object.__getitem__`." +"in the mapping, and not created on-the-fly via :meth:`__missing__` " +"or :meth:`~object.__getitem__`." msgstr "" #: ../../reference/compound_stmts.rst:1064 @@ -1401,14 +1402,14 @@ msgstr "" #: ../../reference/compound_stmts.rst:1094 msgid "" -"If ``name_or_attr`` is not an instance of the builtin :class:`type` , raise :" -"exc:`TypeError`." +"If ``name_or_attr`` is not an instance of the builtin :class:`type` , " +"raise :exc:`TypeError`." msgstr "" #: ../../reference/compound_stmts.rst:1097 msgid "" -"If the subject value is not an instance of ``name_or_attr`` (tested via :" -"func:`isinstance`), the class pattern fails." +"If the subject value is not an instance of ``name_or_attr`` (tested " +"via :func:`isinstance`), the class pattern fails." msgstr "" #: ../../reference/compound_stmts.rst:1100 @@ -1474,14 +1475,14 @@ msgstr "" #: ../../reference/compound_stmts.rst:1133 msgid "" -"If the returned value is not a tuple, the conversion fails and :exc:" -"`TypeError` is raised." +"If the returned value is not a tuple, the conversion fails " +"and :exc:`TypeError` is raised." msgstr "" #: ../../reference/compound_stmts.rst:1136 msgid "" -"If there are more positional patterns than ``len(cls.__match_args__)``, :exc:" -"`TypeError` is raised." +"If there are more positional patterns than " +"``len(cls.__match_args__)``, :exc:`TypeError` is raised." msgstr "" #: ../../reference/compound_stmts.rst:1139 @@ -1602,8 +1603,8 @@ msgstr "函式定義" #: ../../reference/compound_stmts.rst:1208 msgid "" -"A function definition defines a user-defined function object (see section :" -"ref:`types`):" +"A function definition defines a user-defined function object (see " +"section :ref:`types`):" msgstr "" #: ../../reference/compound_stmts.rst:1230 @@ -1663,9 +1664,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:1260 msgid "" -"Functions may be decorated with any valid :token:`~python-grammar:" -"assignment_expression`. Previously, the grammar was much more restrictive; " -"see :pep:`614` for details." +"Functions may be decorated with any valid :token:`~python-" +"grammar:assignment_expression`. Previously, the grammar was much more " +"restrictive; see :pep:`614` for details." msgstr "" #: ../../reference/compound_stmts.rst:1265 @@ -1718,18 +1719,18 @@ msgstr "" #: ../../reference/compound_stmts.rst:1309 msgid "" -"Function call semantics are described in more detail in section :ref:" -"`calls`. A function call always assigns values to all parameters mentioned " -"in the parameter list, either from positional arguments, from keyword " -"arguments, or from default values. If the form \"``*identifier``\" is " -"present, it is initialized to a tuple receiving any excess positional " -"parameters, defaulting to the empty tuple. If the form \"``**identifier``\" " -"is present, it is initialized to a new ordered mapping receiving any excess " -"keyword arguments, defaulting to a new empty mapping of the same type. " -"Parameters after \"``*``\" or \"``*identifier``\" are keyword-only " -"parameters and may only be passed by keyword arguments. Parameters before " -"\"``/``\" are positional-only parameters and may only be passed by " -"positional arguments." +"Function call semantics are described in more detail in " +"section :ref:`calls`. A function call always assigns values to all " +"parameters mentioned in the parameter list, either from positional " +"arguments, from keyword arguments, or from default values. If the form " +"\"``*identifier``\" is present, it is initialized to a tuple receiving any " +"excess positional parameters, defaulting to the empty tuple. If the form " +"\"``**identifier``\" is present, it is initialized to a new ordered mapping " +"receiving any excess keyword arguments, defaulting to a new empty mapping of " +"the same type. Parameters after \"``*``\" or \"``*identifier``\" are " +"keyword-only parameters and may only be passed by keyword arguments. " +"Parameters before \"``/``\" are positional-only parameters and may only be " +"passed by positional arguments." msgstr "" #: ../../reference/compound_stmts.rst:1321 @@ -1748,8 +1749,8 @@ msgid "" "of the form \"``-> expression``\" after the parameter list. These " "annotations can be any valid Python expression. The presence of annotations " "does not change the semantics of a function. The annotation values are " -"available as values of a dictionary keyed by the parameters' names in the :" -"attr:`__annotations__` attribute of the function object. If the " +"available as values of a dictionary keyed by the parameters' names in " +"the :attr:`__annotations__` attribute of the function object. If the " "``annotations`` import from :mod:`__future__` is used, annotations are " "preserved as strings at runtime which enables postponed evaluation. " "Otherwise, they are evaluated when the function definition is executed. In " @@ -1770,8 +1771,8 @@ msgid "" "described in section :ref:`lambda`. Note that the lambda expression is " "merely a shorthand for a simplified function definition; a function defined " "in a \":keyword:`def`\" statement can be passed around or assigned to " -"another name just like a function defined by a lambda expression. The \":" -"keyword:`!def`\" form is actually more powerful since it allows the " +"another name just like a function defined by a lambda expression. The " +"\":keyword:`!def`\" form is actually more powerful since it allows the " "execution of multiple statements and annotations." msgstr "" @@ -1794,15 +1795,15 @@ msgstr "" #: ../../reference/compound_stmts.rst:1369 msgid ":pep:`484` - Type Hints" -msgstr "" +msgstr ":pep:`484` - 型別提示" #: ../../reference/compound_stmts.rst:1370 msgid "Definition of a standard meaning for annotations: type hints." -msgstr "" +msgstr "定義註釋的標準意義:型別提示。" #: ../../reference/compound_stmts.rst:1372 msgid ":pep:`526` - Syntax for Variable Annotations" -msgstr "" +msgstr ":pep:`526` - 變數註釋的語法" #: ../../reference/compound_stmts.rst:1373 msgid "" @@ -1869,14 +1870,14 @@ msgstr "" #: ../../reference/compound_stmts.rst:1423 msgid "" -"The class's suite is then executed in a new execution frame (see :ref:" -"`naming`), using a newly created local namespace and the original global " -"namespace. (Usually, the suite contains mostly function definitions.) When " -"the class's suite finishes execution, its execution frame is discarded but " -"its local namespace is saved. [#]_ A class object is then created using the " -"inheritance list for the base classes and the saved local namespace for the " -"attribute dictionary. The class name is bound to this class object in the " -"original local namespace." +"The class's suite is then executed in a new execution frame " +"(see :ref:`naming`), using a newly created local namespace and the original " +"global namespace. (Usually, the suite contains mostly function " +"definitions.) When the class's suite finishes execution, its execution " +"frame is discarded but its local namespace is saved. [#]_ A class object is " +"then created using the inheritance list for the base classes and the saved " +"local namespace for the attribute dictionary. The class name is bound to " +"this class object in the original local namespace." msgstr "" #: ../../reference/compound_stmts.rst:1432 @@ -1923,9 +1924,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:1456 msgid "" -"Classes may be decorated with any valid :token:`~python-grammar:" -"assignment_expression`. Previously, the grammar was much more restrictive; " -"see :pep:`614` for details." +"Classes may be decorated with any valid :token:`~python-" +"grammar:assignment_expression`. Previously, the grammar was much more " +"restrictive; see :pep:`614` for details." msgstr "" #: ../../reference/compound_stmts.rst:1461 @@ -1933,8 +1934,8 @@ msgid "" "A list of :ref:`type parameters <type-params>` may be given in square " "brackets immediately after the class's name. This indicates to static type " "checkers that the class is generic. At runtime, the type parameters can be " -"retrieved from the class's :attr:`~type.__type_params__` attribute. See :ref:" -"`generic-classes` for more." +"retrieved from the class's :attr:`~type.__type_params__` attribute. " +"See :ref:`generic-classes` for more." msgstr "" #: ../../reference/compound_stmts.rst:1470 @@ -2178,9 +2179,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:1645 msgid "" -":ref:`Functions <def>` (including :ref:`coroutines <async def>`), :ref:" -"`classes <class>` and :ref:`type aliases <type>` may contain a type " -"parameter list::" +":ref:`Functions <def>` (including :ref:`coroutines <async " +"def>`), :ref:`classes <class>` and :ref:`type aliases <type>` may contain a " +"type parameter list::" msgstr "" #: ../../reference/compound_stmts.rst:1649 @@ -2237,8 +2238,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:1678 msgid "" -"Generic functions, classes, and type aliases have a :attr:`~definition." -"__type_params__` attribute listing their type parameters." +"Generic functions, classes, and type aliases have " +"a :attr:`~definition.__type_params__` attribute listing their type " +"parameters." msgstr "" #: ../../reference/compound_stmts.rst:1681 @@ -2381,8 +2383,8 @@ msgid "" "Here ``annotation-def`` indicates an :ref:`annotation scope <annotation-" "scopes>`, which is not actually bound to any name at runtime. (One other " "liberty is taken in the translation: the syntax does not go through " -"attribute access on the :mod:`typing` module, but creates an instance of :" -"data:`typing.TypeVar` directly.)" +"attribute access on the :mod:`typing` module, but creates an instance " +"of :data:`typing.TypeVar` directly.)" msgstr "" #: ../../reference/compound_stmts.rst:1760 @@ -2410,8 +2412,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:1771 msgid "" -"Except for the :ref:`lazy evaluation <lazy-evaluation>` of the :class:" -"`~typing.TypeVar` bound, this is equivalent to::" +"Except for the :ref:`lazy evaluation <lazy-evaluation>` of " +"the :class:`~typing.TypeVar` bound, this is equivalent to::" msgstr "" #: ../../reference/compound_stmts.rst:1774 @@ -2474,9 +2476,9 @@ msgstr "" #: ../../reference/compound_stmts.rst:1815 msgid "" -"Here again ``annotation-def`` (not a real keyword) indicates an :ref:" -"`annotation scope <annotation-scopes>`, and the name ``TYPE_PARAMS_OF_Bag`` " -"is not actually bound at runtime." +"Here again ``annotation-def`` (not a real keyword) indicates " +"an :ref:`annotation scope <annotation-scopes>`, and the name " +"``TYPE_PARAMS_OF_Bag`` is not actually bound at runtime." msgstr "" #: ../../reference/compound_stmts.rst:1819 @@ -2563,9 +2565,9 @@ msgstr "註解" #: ../../reference/compound_stmts.rst:1865 msgid "" -"The exception is propagated to the invocation stack unless there is a :" -"keyword:`finally` clause which happens to raise another exception. That new " -"exception causes the old one to be lost." +"The exception is propagated to the invocation stack unless there is " +"a :keyword:`finally` clause which happens to raise another exception. That " +"new exception causes the old one to be lost." msgstr "" #: ../../reference/compound_stmts.rst:1869 @@ -2637,8 +2639,8 @@ msgstr "" #: ../../reference/compound_stmts.rst:1895 msgid "" -"The standard library classes :class:`dict` and :class:`types." -"MappingProxyType` are mappings." +"The standard library classes :class:`dict` " +"and :class:`types.MappingProxyType` are mappings." msgstr "" #: ../../reference/compound_stmts.rst:1898 @@ -2972,7 +2974,7 @@ msgstr "argument(引數)" #: ../../reference/compound_stmts.rst:1275 msgid "= (equals)" -msgstr "= (等於)" +msgstr "= (等號)" #: ../../reference/compound_stmts.rst:1304 msgid "/ (slash)" diff --git a/reference/datamodel.po b/reference/datamodel.po index 0e961eb661..116f7e7b84 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-10 17:21+0000\n" +"POT-Creation-Date: 2025-04-27 00:16+0000\n" "PO-Revision-Date: 2024-09-24 19:03+0900\n" "Last-Translator: Kisaragi Hiu <mail@kisaragi-hiu.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -66,8 +66,8 @@ msgid "" msgstr "" "一個物件的型別決定了該物件所支援的操作(例如「它有長度嗎?」),也同時定義該" "型別的物件能夠擁有的數值。:func:`type` 函式會回傳一個物件的型別(而該型別本身" -"也是一個物件)。如同它的識別性,一個物件的型別 (:dfn:`type`) 也是不可變" -"的。\\ [#]_" +"也是一個物件)。如同它的識別性,一個物件的型別 (:dfn:`type`) 也是不可變的。" +"\\ [#]_" #: ../../reference/datamodel.rst:50 msgid "" @@ -137,9 +137,9 @@ msgid "" "is garbage-collected, but since garbage collection is not guaranteed to " "happen, such objects also provide an explicit way to release the external " "resource, usually a :meth:`!close` method. Programs are strongly recommended " -"to explicitly close such objects. The :keyword:`try`...\\ :keyword:" -"`finally` statement and the :keyword:`with` statement provide convenient " -"ways to do this." +"to explicitly close such objects. The :keyword:`try`..." +"\\ :keyword:`finally` statement and the :keyword:`with` statement provide " +"convenient ways to do this." msgstr "" "某些物件包含對於「外部」資源的參照,像是開啟的檔案或是視窗。基本上這些資源會" "在物件被回收時釋放,但因為垃圾回收不保證會發生,這種物件也會提供明確釋放外部" @@ -241,10 +241,10 @@ msgid "" "will then try the reflected operation, or some other fallback, depending on " "the operator.) It should not be evaluated in a boolean context." msgstr "" -"這個型別只有一個數值。只有一個物件有這個數值。這個物件由內建名稱 :data:" -"`NotImplemented` 存取。數字方法和 rich comparison 方法應該在沒有為所提供的運" -"算元實作該操作的時候回傳這個數值。(直譯器接下來則會依運算子嘗試反轉的操作或" -"是其他的後備方案。)它不應該在預期布林值的情境中被計算。" +"這個型別只有一個數值。只有一個物件有這個數值。這個物件由內建名" +"稱 :data:`NotImplemented` 存取。數字方法和 rich comparison 方法應該在沒有為所" +"提供的運算元實作該操作的時候回傳這個數值。(直譯器接下來則會依運算子嘗試反轉" +"的操作或是其他的後備方案。)它不應該在預期布林值的情境中被計算。" #: ../../reference/datamodel.rst:172 msgid "See :ref:`implementing-the-arithmetic-operations` for more details." @@ -288,8 +288,8 @@ msgstr "" #: ../../reference/datamodel.rst:204 msgid "" -"The string representations of the numeric classes, computed by :meth:" -"`~object.__repr__` and :meth:`~object.__str__`, have the following " +"The string representations of the numeric classes, computed " +"by :meth:`~object.__repr__` and :meth:`~object.__str__`, have the following " "properties:" msgstr "" @@ -463,9 +463,9 @@ msgid "" "The built-in function :func:`ord` converts a code point from its string form " "to an integer in the range ``0 - 10FFFF``; :func:`chr` converts an integer " "in the range ``0 - 10FFFF`` to the corresponding length ``1`` string " -"object. :meth:`str.encode` can be used to convert a :class:`str` to :class:" -"`bytes` using the given text encoding, and :meth:`bytes.decode` can be used " -"to achieve the opposite." +"object. :meth:`str.encode` can be used to convert a :class:`str` " +"to :class:`bytes` using the given text encoding, and :meth:`bytes.decode` " +"can be used to achieve the opposite." msgstr "" #: ../../reference/datamodel.rst:362 @@ -491,8 +491,8 @@ msgid "" "A bytes object is an immutable array. The items are 8-bit bytes, " "represented by integers in the range 0 <= x < 256. Bytes literals (like " "``b'abc'``) and the built-in :func:`bytes` constructor can be used to create " -"bytes objects. Also, bytes objects can be decoded to strings via the :meth:" -"`~bytes.decode` method." +"bytes objects. Also, bytes objects can be decoded to strings via " +"the :meth:`~bytes.decode` method." msgstr "" #: ../../reference/datamodel.rst:386 @@ -502,8 +502,8 @@ msgstr "可變序列" #: ../../reference/datamodel.rst:395 msgid "" "Mutable sequences can be changed after they are created. The subscription " -"and slicing notations can be used as the target of assignment and :keyword:" -"`del` (delete) statements." +"and slicing notations can be used as the target of assignment " +"and :keyword:`del` (delete) statements." msgstr "" #: ../../reference/datamodel.rst:403 @@ -533,8 +533,8 @@ msgstr "位元組陣列" #: ../../reference/datamodel.rst:418 msgid "" -"A bytearray object is a mutable array. They are created by the built-in :" -"func:`bytearray` constructor. Aside from being mutable (and hence " +"A bytearray object is a mutable array. They are created by the built-" +"in :func:`bytearray` constructor. Aside from being mutable (and hence " "unhashable), byte arrays otherwise provide the same interface and " "functionality as immutable :class:`bytes` objects." msgstr "" @@ -572,8 +572,8 @@ msgstr "Set(集合)" #: ../../reference/datamodel.rst:449 msgid "" "These represent a mutable set. They are created by the built-in :func:`set` " -"constructor and can be modified afterwards by several methods, such as :meth:" -"`~set.add`." +"constructor and can be modified afterwards by several methods, such " +"as :meth:`~set.add`." msgstr "" #: ../../reference/datamodel.rst:454 @@ -582,9 +582,10 @@ msgstr "Frozen set(凍結集合)" #: ../../reference/datamodel.rst:457 msgid "" -"These represent an immutable set. They are created by the built-in :func:" -"`frozenset` constructor. As a frozenset is immutable and :term:`hashable`, " -"it can be used again as an element of another set, or as a dictionary key." +"These represent an immutable set. They are created by the built-" +"in :func:`frozenset` constructor. As a frozenset is immutable " +"and :term:`hashable`, it can be used again as an element of another set, or " +"as a dictionary key." msgstr "" #: ../../reference/datamodel.rst:464 @@ -653,8 +654,8 @@ msgstr "可呼叫型別" #: ../../reference/datamodel.rst:525 msgid "" -"These are the types to which the function call operation (see section :ref:" -"`calls`) can be applied:" +"These are the types to which the function call operation (see " +"section :ref:`calls`) can be applied:" msgstr "" #: ../../reference/datamodel.rst:532 @@ -669,7 +670,7 @@ msgid "" msgstr "" #: ../../reference/datamodel.rst:545 ../../reference/datamodel.rst:1395 -#: ../../reference/datamodel.rst:1596 +#: ../../reference/datamodel.rst:1594 msgid "Special read-only attributes" msgstr "特殊唯讀屬性" @@ -685,9 +686,9 @@ msgstr "含義" #: ../../reference/datamodel.rst:559 msgid "" -"A reference to the :class:`dictionary <dict>` that holds the function's :ref:" -"`global variables <naming>` -- the global namespace of the module in which " -"the function was defined." +"A reference to the :class:`dictionary <dict>` that holds the " +"function's :ref:`global variables <naming>` -- the global namespace of the " +"module in which the function was defined." msgstr "" #: ../../reference/datamodel.rst:564 @@ -703,7 +704,7 @@ msgid "" "the value of the cell, as well as set the value." msgstr "" -#: ../../reference/datamodel.rst:572 ../../reference/datamodel.rst:1638 +#: ../../reference/datamodel.rst:572 ../../reference/datamodel.rst:1636 msgid "Special writable attributes" msgstr "特殊可寫屬性" @@ -717,8 +718,8 @@ msgstr "函式的文件字串,若不可用則為 ``None``。" #: ../../reference/datamodel.rst:597 msgid "" -"The function's name. See also: :attr:`__name__ attributes <definition." -"__name__>`." +"The function's name. See also: :attr:`__name__ attributes " +"<definition.__name__>`." msgstr "" #: ../../reference/datamodel.rst:601 @@ -748,28 +749,28 @@ msgstr "代表編譯函式主體的\\ :ref:`程式碼物件 <code-objects>`。" #: ../../reference/datamodel.rst:620 msgid "" -"The namespace supporting arbitrary function attributes. See also: :attr:" -"`__dict__ attributes <object.__dict__>`." +"The namespace supporting arbitrary function attributes. See " +"also: :attr:`__dict__ attributes <object.__dict__>`." msgstr "" #: ../../reference/datamodel.rst:624 msgid "" "A :class:`dictionary <dict>` containing annotations of :term:`parameters " "<parameter>`. The keys of the dictionary are the parameter names, and " -"``'return'`` for the return annotation, if provided. See also: :ref:" -"`annotations-howto`." +"``'return'`` for the return annotation, if provided. See " +"also: :ref:`annotations-howto`." msgstr "" #: ../../reference/datamodel.rst:631 msgid "" -"A :class:`dictionary <dict>` containing defaults for keyword-only :term:" -"`parameters <parameter>`." +"A :class:`dictionary <dict>` containing defaults for keyword-" +"only :term:`parameters <parameter>`." msgstr "" #: ../../reference/datamodel.rst:635 msgid "" -"A :class:`tuple` containing the :ref:`type parameters <type-params>` of a :" -"ref:`generic function <generic-functions>`." +"A :class:`tuple` containing the :ref:`type parameters <type-params>` of " +"a :ref:`generic function <generic-functions>`." msgstr "" #: ../../reference/datamodel.rst:640 @@ -789,8 +790,8 @@ msgstr "" #: ../../reference/datamodel.rst:651 msgid "" "Additional information about a function's definition can be retrieved from " -"its :ref:`code object <code-objects>` (accessible via the :attr:`~function." -"__code__` attribute)." +"its :ref:`code object <code-objects>` (accessible via " +"the :attr:`~function.__code__` attribute)." msgstr "" #: ../../reference/datamodel.rst:659 @@ -803,7 +804,7 @@ msgid "" "callable object (normally a user-defined function)." msgstr "" -#: ../../reference/datamodel.rst:676 ../../reference/datamodel.rst:1734 +#: ../../reference/datamodel.rst:676 ../../reference/datamodel.rst:1732 msgid "Special read-only attributes:" msgstr "特殊唯讀屬性:" @@ -819,15 +820,15 @@ msgstr "" #: ../../reference/datamodel.rst:688 msgid "" -"The method's documentation (same as :attr:`method.__func__.__doc__ <function." -"__doc__>`). A :class:`string <str>` if the original function had a " +"The method's documentation (same as :attr:`method.__func__.__doc__ " +"<function.__doc__>`). A :class:`string <str>` if the original function had a " "docstring, else ``None``." msgstr "" #: ../../reference/datamodel.rst:694 msgid "" -"The name of the method (same as :attr:`method.__func__.__name__ <function." -"__name__>`)" +"The name of the method (same as :attr:`method.__func__.__name__ " +"<function.__name__>`)" msgstr "" #: ../../reference/datamodel.rst:698 @@ -845,43 +846,44 @@ msgstr "" msgid "" "User-defined method objects may be created when getting an attribute of a " "class (perhaps via an instance of that class), if that attribute is a user-" -"defined :ref:`function object <user-defined-funcs>` or a :class:" -"`classmethod` object." +"defined :ref:`function object <user-defined-funcs>` or " +"a :class:`classmethod` object." msgstr "" #: ../../reference/datamodel.rst:711 msgid "" -"When an instance method object is created by retrieving a user-defined :ref:" -"`function object <user-defined-funcs>` from a class via one of its " -"instances, its :attr:`~method.__self__` attribute is the instance, and the " -"method object is said to be *bound*. The new method's :attr:`~method." -"__func__` attribute is the original function object." +"When an instance method object is created by retrieving a user-" +"defined :ref:`function object <user-defined-funcs>` from a class via one of " +"its instances, its :attr:`~method.__self__` attribute is the instance, and " +"the method object is said to be *bound*. The new " +"method's :attr:`~method.__func__` attribute is the original function object." msgstr "" #: ../../reference/datamodel.rst:717 msgid "" -"When an instance method object is created by retrieving a :class:" -"`classmethod` object from a class or instance, its :attr:`~method.__self__` " -"attribute is the class itself, and its :attr:`~method.__func__` attribute is " -"the function object underlying the class method." +"When an instance method object is created by retrieving " +"a :class:`classmethod` object from a class or instance, " +"its :attr:`~method.__self__` attribute is the class itself, and " +"its :attr:`~method.__func__` attribute is the function object underlying the " +"class method." msgstr "" #: ../../reference/datamodel.rst:722 msgid "" -"When an instance method object is called, the underlying function (:attr:" -"`~method.__func__`) is called, inserting the class instance (:attr:`~method." -"__self__`) in front of the argument list. For instance, when :class:`!C` is " -"a class which contains a definition for a function :meth:`!f`, and ``x`` is " -"an instance of :class:`!C`, calling ``x.f(1)`` is equivalent to calling ``C." -"f(x, 1)``." +"When an instance method object is called, the underlying function " +"(:attr:`~method.__func__`) is called, inserting the class instance " +"(:attr:`~method.__self__`) in front of the argument list. For instance, " +"when :class:`!C` is a class which contains a definition for a " +"function :meth:`!f`, and ``x`` is an instance of :class:`!C`, calling " +"``x.f(1)`` is equivalent to calling ``C.f(x, 1)``." msgstr "" #: ../../reference/datamodel.rst:729 msgid "" "When an instance method object is derived from a :class:`classmethod` " "object, the \"class instance\" stored in :attr:`~method.__self__` will " -"actually be the class itself, so that calling either ``x.f(1)`` or ``C." -"f(1)`` is equivalent to calling ``f(C,1)`` where ``f`` is the underlying " +"actually be the class itself, so that calling either ``x.f(1)`` or " +"``C.f(1)`` is equivalent to calling ``f(C,1)`` where ``f`` is the underlying " "function." msgstr "" @@ -898,15 +900,15 @@ msgstr "產生器函式" #: ../../reference/datamodel.rst:747 msgid "" -"A function or method which uses the :keyword:`yield` statement (see section :" -"ref:`yield`) is called a :dfn:`generator function`. Such a function, when " -"called, always returns an :term:`iterator` object which can be used to " -"execute the body of the function: calling the iterator's :meth:`iterator." -"__next__` method will cause the function to execute until it provides a " -"value using the :keyword:`!yield` statement. When the function executes a :" -"keyword:`return` statement or falls off the end, a :exc:`StopIteration` " -"exception is raised and the iterator will have reached the end of the set of " -"values to be returned." +"A function or method which uses the :keyword:`yield` statement (see " +"section :ref:`yield`) is called a :dfn:`generator function`. Such a " +"function, when called, always returns an :term:`iterator` object which can " +"be used to execute the body of the function: calling the " +"iterator's :meth:`iterator.__next__` method will cause the function to " +"execute until it provides a value using the :keyword:`!yield` statement. " +"When the function executes a :keyword:`return` statement or falls off the " +"end, a :exc:`StopIteration` exception is raised and the iterator will have " +"reached the end of the set of values to be returned." msgstr "" #: ../../reference/datamodel.rst:759 @@ -916,10 +918,10 @@ msgstr "Coroutine(協程)函式" #: ../../reference/datamodel.rst:764 msgid "" "A function or method which is defined using :keyword:`async def` is called " -"a :dfn:`coroutine function`. Such a function, when called, returns a :term:" -"`coroutine` object. It may contain :keyword:`await` expressions, as well " -"as :keyword:`async with` and :keyword:`async for` statements. See also the :" -"ref:`coroutine-objects` section." +"a :dfn:`coroutine function`. Such a function, when called, returns " +"a :term:`coroutine` object. It may contain :keyword:`await` expressions, as " +"well as :keyword:`async with` and :keyword:`async for` statements. See also " +"the :ref:`coroutine-objects` section." msgstr "" #: ../../reference/datamodel.rst:772 @@ -937,13 +939,13 @@ msgstr "" #: ../../reference/datamodel.rst:784 msgid "" -"Calling the asynchronous iterator's :meth:`aiterator.__anext__ <object." -"__anext__>` method will return an :term:`awaitable` which when awaited will " -"execute until it provides a value using the :keyword:`yield` expression. " -"When the function executes an empty :keyword:`return` statement or falls off " -"the end, a :exc:`StopAsyncIteration` exception is raised and the " -"asynchronous iterator will have reached the end of the set of values to be " -"yielded." +"Calling the asynchronous iterator's :meth:`aiterator.__anext__ " +"<object.__anext__>` method will return an :term:`awaitable` which when " +"awaited will execute until it provides a value using the :keyword:`yield` " +"expression. When the function executes an empty :keyword:`return` statement " +"or falls off the end, a :exc:`StopAsyncIteration` exception is raised and " +"the asynchronous iterator will have reached the end of the set of values to " +"be yielded." msgstr "" #: ../../reference/datamodel.rst:797 @@ -957,17 +959,17 @@ msgid "" "standard built-in module). The number and type of the arguments are " "determined by the C function. Special read-only attributes:" msgstr "" -"一個內建函式物件是一個 C 函式的 wrapper。內建函式的範例有 :func:`len` 和 :" -"func:`math.sin`\\ (\\ :mod:`math` 是一個標準的內建模組)。內建函式的引數數量" -"與其型別由其包裝的 C 函式所決定。特殊唯讀屬性:" +"一個內建函式物件是一個 C 函式的 wrapper。內建函式的範例有 :func:`len` " +"和 :func:`math.sin`\\ (\\ :mod:`math` 是一個標準的內建模組)。內建函式的引數" +"數量與其型別由其包裝的 C 函式所決定。特殊唯讀屬性:" #: ../../reference/datamodel.rst:809 msgid "" ":attr:`!__doc__` is the function's documentation string, or ``None`` if " "unavailable. See :attr:`function.__doc__`." msgstr "" -":attr:`!__doc__` 是函式的文件字串,若不可用則為 ``None``。請見 :attr:" -"`function.__doc__`。" +":attr:`!__doc__` 是函式的文件字串,若不可用則為 ``None``。請" +"見 :attr:`function.__doc__`。" #: ../../reference/datamodel.rst:811 msgid "" @@ -993,10 +995,10 @@ msgid "" "This is really a different disguise of a built-in function, this time " "containing an object passed to the C function as an implicit extra " "argument. An example of a built-in method is ``alist.append()``, assuming " -"*alist* is a list object. In this case, the special read-only attribute :" -"attr:`!__self__` is set to the object denoted by *alist*. (The attribute has " -"the same semantics as it does with :attr:`other instance methods <method." -"__self__>`.)" +"*alist* is a list object. In this case, the special read-only " +"attribute :attr:`!__self__` is set to the object denoted by *alist*. (The " +"attribute has the same semantics as it does with :attr:`other instance " +"methods <method.__self__>`.)" msgstr "" #: ../../reference/datamodel.rst:838 @@ -1007,8 +1009,8 @@ msgstr "" msgid "" "Classes are callable. These objects normally act as factories for new " "instances of themselves, but variations are possible for class types that " -"override :meth:`~object.__new__`. The arguments of the call are passed to :" -"meth:`!__new__` and, in the typical case, to :meth:`~object.__init__` to " +"override :meth:`~object.__new__`. The arguments of the call are passed " +"to :meth:`!__new__` and, in the typical case, to :meth:`~object.__init__` to " "initialize the new instance." msgstr "" @@ -1018,8 +1020,8 @@ msgstr "類別實例" #: ../../reference/datamodel.rst:850 msgid "" -"Instances of arbitrary classes can be made callable by defining a :meth:" -"`~object.__call__` method in their class." +"Instances of arbitrary classes can be made callable by defining " +"a :meth:`~object.__call__` method in their class." msgstr "" #: ../../reference/datamodel.rst:857 @@ -1029,16 +1031,16 @@ msgstr "模組" #: ../../reference/datamodel.rst:863 msgid "" "Modules are a basic organizational unit of Python code, and are created by " -"the :ref:`import system <importsystem>` as invoked either by the :keyword:" -"`import` statement, or by calling functions such as :func:`importlib." -"import_module` and built-in :func:`__import__`. A module object has a " -"namespace implemented by a :class:`dictionary <dict>` object (this is the " -"dictionary referenced by the :attr:`~function.__globals__` attribute of " -"functions defined in the module). Attribute references are translated to " -"lookups in this dictionary, e.g., ``m.x`` is equivalent to ``m." -"__dict__[\"x\"]``. A module object does not contain the code object used to " -"initialize the module (since it isn't needed once the initialization is " -"done)." +"the :ref:`import system <importsystem>` as invoked either by " +"the :keyword:`import` statement, or by calling functions such " +"as :func:`importlib.import_module` and built-in :func:`__import__`. A " +"module object has a namespace implemented by a :class:`dictionary <dict>` " +"object (this is the dictionary referenced by " +"the :attr:`~function.__globals__` attribute of functions defined in the " +"module). Attribute references are translated to lookups in this dictionary, " +"e.g., ``m.x`` is equivalent to ``m.__dict__[\"x\"]``. A module object does " +"not contain the code object used to initialize the module (since it isn't " +"needed once the initialization is done)." msgstr "" #: ../../reference/datamodel.rst:876 @@ -1102,8 +1104,8 @@ msgstr "" #: ../../reference/datamodel.rst:935 msgid "" "This attribute must be set to the fully qualified name of the module. It is " -"expected to match the value of :attr:`module.__spec__.name <importlib." -"machinery.ModuleSpec.name>`." +"expected to match the value of :attr:`module.__spec__.name " +"<importlib.machinery.ModuleSpec.name>`." msgstr "" #: ../../reference/datamodel.rst:941 @@ -1124,9 +1126,9 @@ msgstr "" msgid "" "If the module is top-level (that is, not a part of any specific package) " "then the attribute should be set to ``''`` (the empty string). Otherwise, it " -"should be set to the name of the module's package (which can be equal to :" -"attr:`module.__name__` if the module itself is a package). See :pep:`366` " -"for further details." +"should be set to the name of the module's package (which can be equal " +"to :attr:`module.__name__` if the module itself is a package). " +"See :pep:`366` for further details." msgstr "" #: ../../reference/datamodel.rst:958 @@ -1141,9 +1143,9 @@ msgstr "" #: ../../reference/datamodel.rst:964 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.parent " -"<importlib.machinery.ModuleSpec.parent>` instead of :attr:`!module." -"__package__`. :attr:`__package__` is now only used as a fallback if :attr:`!" -"__spec__.parent` is not set, and this fallback path is deprecated." +"<importlib.machinery.ModuleSpec.parent>` instead of :attr:`!" +"module.__package__`. :attr:`__package__` is now only used as a fallback " +"if :attr:`!__spec__.parent` is not set, and this fallback path is deprecated." msgstr "" #: ../../reference/datamodel.rst:970 ../../reference/datamodel.rst:1011 @@ -1155,17 +1157,18 @@ msgstr "" #: ../../reference/datamodel.rst:975 msgid "" -"The value of :attr:`!__package__` is expected to be the same as :attr:" -"`__spec__.parent <importlib.machinery.ModuleSpec.parent>`. :attr:" -"`__package__` is now only used as a fallback during import resolution if :" -"attr:`!__spec__.parent` is not defined." +"The value of :attr:`!__package__` is expected to be the same " +"as :attr:`__spec__.parent " +"<importlib.machinery.ModuleSpec.parent>`. :attr:`__package__` is now only " +"used as a fallback during import resolution if :attr:`!__spec__.parent` is " +"not defined." msgstr "" #: ../../reference/datamodel.rst:981 msgid "" ":exc:`ImportWarning` is raised if an import resolution falls back to :attr:`!" -"__package__` instead of :attr:`__spec__.parent <importlib.machinery." -"ModuleSpec.parent>`." +"__package__` instead of :attr:`__spec__.parent " +"<importlib.machinery.ModuleSpec.parent>`." msgstr "" #: ../../reference/datamodel.rst:986 @@ -1195,16 +1198,16 @@ msgstr "" #: ../../reference/datamodel.rst:1002 msgid "" ":attr:`!__loader__` defaults to ``None`` for modules created dynamically " -"using the :class:`types.ModuleType` constructor; use :func:`importlib.util." -"module_from_spec` instead to ensure the attribute is set to a :term:`loader` " -"object." +"using the :class:`types.ModuleType` constructor; " +"use :func:`importlib.util.module_from_spec` instead to ensure the attribute " +"is set to a :term:`loader` object." msgstr "" #: ../../reference/datamodel.rst:1007 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.loader " -"<importlib.machinery.ModuleSpec.loader>` instead of :attr:`!module." -"__loader__`." +"<importlib.machinery.ModuleSpec.loader>` instead of :attr:`!" +"module.__loader__`." msgstr "" #: ../../reference/datamodel.rst:1016 @@ -1228,9 +1231,10 @@ msgstr "" #: ../../reference/datamodel.rst:1029 msgid "" -"It is **strongly** recommended that you use :attr:`module.__spec__." -"submodule_search_locations <importlib.machinery.ModuleSpec." -"submodule_search_locations>` instead of :attr:`!module.__path__`." +"It is **strongly** recommended that you " +"use :attr:`module.__spec__.submodule_search_locations " +"<importlib.machinery.ModuleSpec.submodule_search_locations>` instead " +"of :attr:`!module.__path__`." msgstr "" #: ../../reference/datamodel.rst:1036 @@ -1263,18 +1267,18 @@ msgstr "" #: ../../reference/datamodel.rst:1054 msgid "" "Note that :attr:`!__cached__` may be set even if :attr:`!__file__` is not " -"set. However, that scenario is quite atypical. Ultimately, the :term:" -"`loader` is what makes use of the module spec provided by the :term:`finder` " -"(from which :attr:`!__file__` and :attr:`!__cached__` are derived). So if a " -"loader can load from a cached module but otherwise does not load from a " -"file, that atypical scenario may be appropriate." +"set. However, that scenario is quite atypical. Ultimately, " +"the :term:`loader` is what makes use of the module spec provided by " +"the :term:`finder` (from which :attr:`!__file__` and :attr:`!__cached__` are " +"derived). So if a loader can load from a cached module but otherwise does " +"not load from a file, that atypical scenario may be appropriate." msgstr "" #: ../../reference/datamodel.rst:1061 msgid "" "It is **strongly** recommended that you use :attr:`module.__spec__.cached " -"<importlib.machinery.ModuleSpec.cached>` instead of :attr:`!module." -"__cached__`." +"<importlib.machinery.ModuleSpec.cached>` instead of :attr:`!" +"module.__cached__`." msgstr "" #: ../../reference/datamodel.rst:1065 @@ -1297,8 +1301,8 @@ msgstr "" #: ../../reference/datamodel.rst:1079 msgid "" -"The module's documentation string, or ``None`` if unavailable. See also: :" -"attr:`__doc__ attributes <definition.__doc__>`." +"The module's documentation string, or ``None`` if unavailable. See " +"also: :attr:`__doc__ attributes <definition.__doc__>`." msgstr "" "模組的文件字串,若不可用則為 ``None``。請見 :attr:`__doc__ attributes " "<definition.__doc__>`。" @@ -1306,8 +1310,8 @@ msgstr "" #: ../../reference/datamodel.rst:1084 msgid "" "A dictionary containing :term:`variable annotations <variable annotation>` " -"collected during module body execution. For best practices on working with :" -"attr:`__annotations__`, please see :ref:`annotations-howto`." +"collected during module body execution. For best practices on working " +"with :attr:`__annotations__`, please see :ref:`annotations-howto`." msgstr "" #: ../../reference/datamodel.rst:1090 @@ -1339,25 +1343,25 @@ msgstr "" #: ../../reference/datamodel.rst:1114 msgid "" -"Custom class types are typically created by class definitions (see section :" -"ref:`class`). A class has a namespace implemented by a dictionary object. " -"Class attribute references are translated to lookups in this dictionary, e." -"g., ``C.x`` is translated to ``C.__dict__[\"x\"]`` (although there are a " -"number of hooks which allow for other means of locating attributes). When " -"the attribute name is not found there, the attribute search continues in the " -"base classes. This search of the base classes uses the C3 method resolution " -"order which behaves correctly even in the presence of 'diamond' inheritance " -"structures where there are multiple inheritance paths leading back to a " -"common ancestor. Additional details on the C3 MRO used by Python can be " -"found at :ref:`python_2.3_mro`." +"Custom class types are typically created by class definitions (see " +"section :ref:`class`). A class has a namespace implemented by a dictionary " +"object. Class attribute references are translated to lookups in this " +"dictionary, e.g., ``C.x`` is translated to ``C.__dict__[\"x\"]`` (although " +"there are a number of hooks which allow for other means of locating " +"attributes). When the attribute name is not found there, the attribute " +"search continues in the base classes. This search of the base classes uses " +"the C3 method resolution order which behaves correctly even in the presence " +"of 'diamond' inheritance structures where there are multiple inheritance " +"paths leading back to a common ancestor. Additional details on the C3 MRO " +"used by Python can be found at :ref:`python_2.3_mro`." msgstr "" #: ../../reference/datamodel.rst:1135 msgid "" "When a class attribute reference (for class :class:`!C`, say) would yield a " -"class method object, it is transformed into an instance method object whose :" -"attr:`~method.__self__` attribute is :class:`!C`. When it would yield a :" -"class:`staticmethod` object, it is transformed into the object wrapped by " +"class method object, it is transformed into an instance method object " +"whose :attr:`~method.__self__` attribute is :class:`!C`. When it would yield " +"a :class:`staticmethod` object, it is transformed into the object wrapped by " "the static method object. See section :ref:`descriptors` for another way in " "which attributes retrieved from a class may differ from those actually " "contained in its :attr:`~object.__dict__`." @@ -1381,8 +1385,8 @@ msgstr "特殊屬性" #: ../../reference/datamodel.rst:1174 msgid "" -"The class's name. See also: :attr:`__name__ attributes <definition." -"__name__>`." +"The class's name. See also: :attr:`__name__ attributes " +"<definition.__name__>`." msgstr "" #: ../../reference/datamodel.rst:1178 @@ -1398,8 +1402,8 @@ msgstr "" #: ../../reference/datamodel.rst:1185 msgid "" "A :class:`mapping proxy <types.MappingProxyType>` providing a read-only view " -"of the class's namespace. See also: :attr:`__dict__ attributes <object." -"__dict__>`." +"of the class's namespace. See also: :attr:`__dict__ attributes " +"<object.__dict__>`." msgstr "" #: ../../reference/datamodel.rst:1190 @@ -1418,22 +1422,22 @@ msgstr "" #: ../../reference/datamodel.rst:1199 msgid "" "A dictionary containing :term:`variable annotations <variable annotation>` " -"collected during class body execution. For best practices on working with :" -"attr:`!__annotations__`, please see :ref:`annotations-howto`." +"collected during class body execution. For best practices on working " +"with :attr:`!__annotations__`, please see :ref:`annotations-howto`." msgstr "" #: ../../reference/datamodel.rst:1206 msgid "" "Accessing the :attr:`!__annotations__` attribute of a class object directly " "may yield incorrect results in the presence of metaclasses. In addition, the " -"attribute may not exist for some classes. Use :func:`inspect." -"get_annotations` to retrieve class annotations safely." +"attribute may not exist for some classes. " +"Use :func:`inspect.get_annotations` to retrieve class annotations safely." msgstr "" #: ../../reference/datamodel.rst:1213 msgid "" -"A :class:`tuple` containing the :ref:`type parameters <type-params>` of a :" -"ref:`generic class <generic-classes>`." +"A :class:`tuple` containing the :ref:`type parameters <type-params>` of " +"a :ref:`generic class <generic-classes>`." msgstr "" #: ../../reference/datamodel.rst:1219 @@ -1508,16 +1512,16 @@ msgid "" "\"Classes\". See section :ref:`descriptors` for another way in which " "attributes of a class retrieved via its instances may differ from the " "objects actually stored in the class's :attr:`~object.__dict__`. If no " -"class attribute is found, and the object's class has a :meth:`~object." -"__getattr__` method, that is called to satisfy the lookup." +"class attribute is found, and the object's class has " +"a :meth:`~object.__getattr__` method, that is called to satisfy the lookup." msgstr "" #: ../../reference/datamodel.rst:1287 msgid "" "Attribute assignments and deletions update the instance's dictionary, never " -"a class's dictionary. If the class has a :meth:`~object.__setattr__` or :" -"meth:`~object.__delattr__` method, this is called instead of updating the " -"instance dictionary directly." +"a class's dictionary. If the class has a :meth:`~object.__setattr__` " +"or :meth:`~object.__delattr__` method, this is called instead of updating " +"the instance dictionary directly." msgstr "" #: ../../reference/datamodel.rst:1297 @@ -1545,9 +1549,9 @@ msgstr "" msgid "" "A :term:`file object` represents an open file. Various shortcuts are " "available to create file objects: the :func:`open` built-in function, and " -"also :func:`os.popen`, :func:`os.fdopen`, and the :meth:`~socket.socket." -"makefile` method of socket objects (and perhaps by other functions or " -"methods provided by extension modules)." +"also :func:`os.popen`, :func:`os.fdopen`, and " +"the :meth:`~socket.socket.makefile` method of socket objects (and perhaps by " +"other functions or methods provided by extension modules)." msgstr "" #: ../../reference/datamodel.rst:1340 @@ -1575,14 +1579,15 @@ msgstr "程式碼物件" #: ../../reference/datamodel.rst:1366 msgid "" -"Code objects represent *byte-compiled* executable Python code, or :term:" -"`bytecode`. The difference between a code object and a function object is " -"that the function object contains an explicit reference to the function's " -"globals (the module in which it was defined), while a code object contains " -"no context; also the default argument values are stored in the function " -"object, not in the code object (because they represent values calculated at " -"run-time). Unlike function objects, code objects are immutable and contain " -"no references (directly or indirectly) to mutable objects." +"Code objects represent *byte-compiled* executable Python code, " +"or :term:`bytecode`. The difference between a code object and a function " +"object is that the function object contains an explicit reference to the " +"function's globals (the module in which it was defined), while a code object " +"contains no context; also the default argument values are stored in the " +"function object, not in the code object (because they represent values " +"calculated at run-time). Unlike function objects, code objects are " +"immutable and contain no references (directly or indirectly) to mutable " +"objects." msgstr "" #: ../../reference/datamodel.rst:1400 @@ -1695,43 +1700,42 @@ msgid "" "``0x04`` is set if the function uses the ``*arguments`` syntax to accept an " "arbitrary number of positional arguments; bit ``0x08`` is set if the " "function uses the ``**keywords`` syntax to accept arbitrary keyword " -"arguments; bit ``0x20`` is set if the function is a generator. See :ref:" -"`inspect-module-co-flags` for details on the semantics of each flags that " -"might be present." +"arguments; bit ``0x20`` is set if the function is a generator. " +"See :ref:`inspect-module-co-flags` for details on the semantics of each " +"flags that might be present." msgstr "" #: ../../reference/datamodel.rst:1482 msgid "" -"Future feature declarations (``from __future__ import division``) also use " -"bits in :attr:`~codeobject.co_flags` to indicate whether a code object was " -"compiled with a particular feature enabled: bit ``0x2000`` is set if the " -"function was compiled with future division enabled; bits ``0x10`` and " -"``0x1000`` were used in earlier versions of Python." +"Future feature declarations (for example, ``from __future__ import " +"division``) also use bits in :attr:`~codeobject.co_flags` to indicate " +"whether a code object was compiled with a particular feature enabled. " +"See :attr:`~__future__._Feature.compiler_flag`." msgstr "" -#: ../../reference/datamodel.rst:1488 +#: ../../reference/datamodel.rst:1486 msgid "" "Other bits in :attr:`~codeobject.co_flags` are reserved for internal use." msgstr "" -#: ../../reference/datamodel.rst:1492 +#: ../../reference/datamodel.rst:1490 msgid "" -"If a code object represents a function, the first item in :attr:`~codeobject." -"co_consts` is the documentation string of the function, or ``None`` if " -"undefined." +"If a code object represents a function, the first item " +"in :attr:`~codeobject.co_consts` is the documentation string of the " +"function, or ``None`` if undefined." msgstr "" -#: ../../reference/datamodel.rst:1497 +#: ../../reference/datamodel.rst:1495 msgid "Methods on code objects" msgstr "用於程式碼物件的方法" -#: ../../reference/datamodel.rst:1501 +#: ../../reference/datamodel.rst:1499 msgid "" "Returns an iterable over the source code positions of each :term:`bytecode` " "instruction in the code object." msgstr "" -#: ../../reference/datamodel.rst:1504 +#: ../../reference/datamodel.rst:1502 msgid "" "The iterator returns :class:`tuple`\\s containing the ``(start_line, " "end_line, start_column, end_column)``. The *i-th* tuple corresponds to the " @@ -1739,37 +1743,37 @@ msgid "" "information is 0-indexed utf-8 byte offsets on the given source line." msgstr "" -#: ../../reference/datamodel.rst:1510 +#: ../../reference/datamodel.rst:1508 msgid "" "This positional information can be missing. A non-exhaustive lists of cases " "where this may happen:" msgstr "" -#: ../../reference/datamodel.rst:1513 +#: ../../reference/datamodel.rst:1511 msgid "Running the interpreter with :option:`-X` ``no_debug_ranges``." msgstr "" -#: ../../reference/datamodel.rst:1514 +#: ../../reference/datamodel.rst:1512 msgid "" "Loading a pyc file compiled while using :option:`-X` ``no_debug_ranges``." msgstr "" -#: ../../reference/datamodel.rst:1515 +#: ../../reference/datamodel.rst:1513 msgid "Position tuples corresponding to artificial instructions." msgstr "" -#: ../../reference/datamodel.rst:1516 +#: ../../reference/datamodel.rst:1514 msgid "" "Line and column numbers that can't be represented due to implementation " "specific limitations." msgstr "" -#: ../../reference/datamodel.rst:1519 +#: ../../reference/datamodel.rst:1517 msgid "" "When this occurs, some or all of the tuple elements can be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:1525 +#: ../../reference/datamodel.rst:1523 msgid "" "This feature requires storing column positions in code objects which may " "result in a small increase of disk usage of compiled Python files or " @@ -1779,158 +1783,158 @@ msgid "" "environment variable can be used." msgstr "" -#: ../../reference/datamodel.rst:1534 +#: ../../reference/datamodel.rst:1532 msgid "" -"Returns an iterator that yields information about successive ranges of :term:" -"`bytecode`\\s. Each item yielded is a ``(start, end, lineno)`` :class:" -"`tuple`:" +"Returns an iterator that yields information about successive ranges " +"of :term:`bytecode`\\s. Each item yielded is a ``(start, end, " +"lineno)`` :class:`tuple`:" msgstr "" -#: ../../reference/datamodel.rst:1538 +#: ../../reference/datamodel.rst:1536 msgid "" "``start`` (an :class:`int`) represents the offset (inclusive) of the start " "of the :term:`bytecode` range" msgstr "" -#: ../../reference/datamodel.rst:1540 +#: ../../reference/datamodel.rst:1538 msgid "" "``end`` (an :class:`int`) represents the offset (exclusive) of the end of " "the :term:`bytecode` range" msgstr "" -#: ../../reference/datamodel.rst:1542 +#: ../../reference/datamodel.rst:1540 msgid "" -"``lineno`` is an :class:`int` representing the line number of the :term:" -"`bytecode` range, or ``None`` if the bytecodes in the given range have no " -"line number" +"``lineno`` is an :class:`int` representing the line number of " +"the :term:`bytecode` range, or ``None`` if the bytecodes in the given range " +"have no line number" msgstr "" -#: ../../reference/datamodel.rst:1546 +#: ../../reference/datamodel.rst:1544 msgid "The items yielded will have the following properties:" msgstr "" -#: ../../reference/datamodel.rst:1548 +#: ../../reference/datamodel.rst:1546 msgid "The first range yielded will have a ``start`` of 0." msgstr "" -#: ../../reference/datamodel.rst:1549 +#: ../../reference/datamodel.rst:1547 msgid "" "The ``(start, end)`` ranges will be non-decreasing and consecutive. That is, " "for any pair of :class:`tuple`\\s, the ``start`` of the second will be equal " "to the ``end`` of the first." msgstr "" -#: ../../reference/datamodel.rst:1552 +#: ../../reference/datamodel.rst:1550 msgid "No range will be backwards: ``end >= start`` for all triples." msgstr "" -#: ../../reference/datamodel.rst:1553 +#: ../../reference/datamodel.rst:1551 msgid "" -"The last :class:`tuple` yielded will have ``end`` equal to the size of the :" -"term:`bytecode`." +"The last :class:`tuple` yielded will have ``end`` equal to the size of " +"the :term:`bytecode`." msgstr "" -#: ../../reference/datamodel.rst:1556 +#: ../../reference/datamodel.rst:1554 msgid "" "Zero-width ranges, where ``start == end``, are allowed. Zero-width ranges " "are used for lines that are present in the source code, but have been " "eliminated by the :term:`bytecode` compiler." msgstr "" -#: ../../reference/datamodel.rst:1564 +#: ../../reference/datamodel.rst:1562 msgid ":pep:`626` - Precise line numbers for debugging and other tools." msgstr "" -#: ../../reference/datamodel.rst:1565 +#: ../../reference/datamodel.rst:1563 msgid "The PEP that introduced the :meth:`!co_lines` method." msgstr "" -#: ../../reference/datamodel.rst:1569 +#: ../../reference/datamodel.rst:1567 msgid "" "Return a copy of the code object with new values for the specified fields." msgstr "" -#: ../../reference/datamodel.rst:1571 +#: ../../reference/datamodel.rst:1569 msgid "" "Code objects are also supported by the generic function :func:`copy.replace`." msgstr "" -#: ../../reference/datamodel.rst:1579 +#: ../../reference/datamodel.rst:1577 msgid "Frame objects" msgstr "" -#: ../../reference/datamodel.rst:1583 +#: ../../reference/datamodel.rst:1581 msgid "" "Frame objects represent execution frames. They may occur in :ref:`traceback " "objects <traceback-objects>`, and are also passed to registered trace " "functions." msgstr "" -#: ../../reference/datamodel.rst:1601 +#: ../../reference/datamodel.rst:1599 msgid "" "Points to the previous stack frame (towards the caller), or ``None`` if this " "is the bottom stack frame" msgstr "" -#: ../../reference/datamodel.rst:1605 +#: ../../reference/datamodel.rst:1603 msgid "" "The :ref:`code object <code-objects>` being executed in this frame. " -"Accessing this attribute raises an :ref:`auditing event <auditing>` ``object." -"__getattr__`` with arguments ``obj`` and ``\"f_code\"``." +"Accessing this attribute raises an :ref:`auditing event <auditing>` " +"``object.__getattr__`` with arguments ``obj`` and ``\"f_code\"``." msgstr "" "在這個 frame 中執行的\\ :ref:`程式碼物件 (code object) <code-objects>`。存取" "這個屬性會引發一個附帶引數 ``obj`` 與 ``\"f_code\"`` 的\\ :ref:`稽核事件 " "<auditing>` ``object.__getattr__``。" -#: ../../reference/datamodel.rst:1610 +#: ../../reference/datamodel.rst:1608 msgid "" "The mapping used by the frame to look up :ref:`local variables <naming>`. If " "the frame refers to an :term:`optimized scope`, this may return a write-" "through proxy object." msgstr "" -#: ../../reference/datamodel.rst:1615 +#: ../../reference/datamodel.rst:1613 msgid "Return a proxy for optimized scopes." msgstr "" -#: ../../reference/datamodel.rst:1619 +#: ../../reference/datamodel.rst:1617 msgid "" "The dictionary used by the frame to look up :ref:`global variables <naming>`" msgstr "" -#: ../../reference/datamodel.rst:1623 +#: ../../reference/datamodel.rst:1621 msgid "" "The dictionary used by the frame to look up :ref:`built-in (intrinsic) names " "<naming>`" msgstr "" -#: ../../reference/datamodel.rst:1627 +#: ../../reference/datamodel.rst:1625 msgid "" -"The \"precise instruction\" of the frame object (this is an index into the :" -"term:`bytecode` string of the :ref:`code object <code-objects>`)" +"The \"precise instruction\" of the frame object (this is an index into " +"the :term:`bytecode` string of the :ref:`code object <code-objects>`)" msgstr "" -#: ../../reference/datamodel.rst:1643 +#: ../../reference/datamodel.rst:1641 msgid "" "If not ``None``, this is a function called for various events during code " "execution (this is used by debuggers). Normally an event is triggered for " "each new source line (see :attr:`~frame.f_trace_lines`)." msgstr "" -#: ../../reference/datamodel.rst:1648 +#: ../../reference/datamodel.rst:1646 msgid "" "Set this attribute to :const:`False` to disable triggering a tracing event " "for each source line." msgstr "" -#: ../../reference/datamodel.rst:1652 +#: ../../reference/datamodel.rst:1650 msgid "" "Set this attribute to :const:`True` to allow per-opcode events to be " "requested. Note that this may lead to undefined interpreter behaviour if " "exceptions raised by the trace function escape to the function being traced." msgstr "" -#: ../../reference/datamodel.rst:1658 +#: ../../reference/datamodel.rst:1656 msgid "" "The current line number of the frame -- writing to this from within a trace " "function jumps to the given line (only for the bottom-most frame). A " @@ -1938,15 +1942,15 @@ msgid "" "this attribute." msgstr "" -#: ../../reference/datamodel.rst:1664 +#: ../../reference/datamodel.rst:1662 msgid "Frame object methods" msgstr "" -#: ../../reference/datamodel.rst:1666 +#: ../../reference/datamodel.rst:1664 msgid "Frame objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1670 +#: ../../reference/datamodel.rst:1668 msgid "" "This method clears all references to :ref:`local variables <naming>` held by " "the frame. Also, if the frame belonged to a :term:`generator`, the " @@ -1955,81 +1959,81 @@ msgid "" "and storing its :ref:`traceback <traceback-objects>` for later use)." msgstr "" -#: ../../reference/datamodel.rst:1676 +#: ../../reference/datamodel.rst:1674 msgid "" ":exc:`RuntimeError` is raised if the frame is currently executing or " "suspended." msgstr "" -#: ../../reference/datamodel.rst:1681 +#: ../../reference/datamodel.rst:1679 msgid "" "Attempting to clear a suspended frame raises :exc:`RuntimeError` (as has " "always been the case for executing frames)." msgstr "" -#: ../../reference/datamodel.rst:1689 +#: ../../reference/datamodel.rst:1687 msgid "Traceback objects" msgstr "" -#: ../../reference/datamodel.rst:1702 +#: ../../reference/datamodel.rst:1700 msgid "" "Traceback objects represent the stack trace of an :ref:`exception <tut-" "errors>`. A traceback object is implicitly created when an exception occurs, " "and may also be explicitly created by calling :class:`types.TracebackType`." msgstr "" -#: ../../reference/datamodel.rst:1707 +#: ../../reference/datamodel.rst:1705 msgid "Traceback objects can now be explicitly instantiated from Python code." msgstr "" -#: ../../reference/datamodel.rst:1710 +#: ../../reference/datamodel.rst:1708 msgid "" "For implicitly created tracebacks, when the search for an exception handler " "unwinds the execution stack, at each unwound level a traceback object is " "inserted in front of the current traceback. When an exception handler is " -"entered, the stack trace is made available to the program. (See section :ref:" -"`try`.) It is accessible as the third item of the tuple returned by :func:" -"`sys.exc_info`, and as the :attr:`~BaseException.__traceback__` attribute of " -"the caught exception." +"entered, the stack trace is made available to the program. (See " +"section :ref:`try`.) It is accessible as the third item of the tuple " +"returned by :func:`sys.exc_info`, and as " +"the :attr:`~BaseException.__traceback__` attribute of the caught exception." msgstr "" -#: ../../reference/datamodel.rst:1719 +#: ../../reference/datamodel.rst:1717 msgid "" "When the program contains no suitable handler, the stack trace is written " "(nicely formatted) to the standard error stream; if the interpreter is " -"interactive, it is also made available to the user as :data:`sys." -"last_traceback`." +"interactive, it is also made available to the user " +"as :data:`sys.last_traceback`." msgstr "" -#: ../../reference/datamodel.rst:1724 +#: ../../reference/datamodel.rst:1722 msgid "" "For explicitly created tracebacks, it is up to the creator of the traceback " "to determine how the :attr:`~traceback.tb_next` attributes should be linked " "to form a full stack trace." msgstr "" -#: ../../reference/datamodel.rst:1739 +#: ../../reference/datamodel.rst:1737 msgid "" "Points to the execution :ref:`frame <frame-objects>` of the current level." msgstr "" -#: ../../reference/datamodel.rst:1742 +#: ../../reference/datamodel.rst:1740 msgid "" -"Accessing this attribute raises an :ref:`auditing event <auditing>` ``object." -"__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." +"Accessing this attribute raises an :ref:`auditing event <auditing>` " +"``object.__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." msgstr "" "存取此屬性會引發一個附帶引數 ``obj`` 與 ``\"tb_frame\"`` 的\\ :ref:`稽核事件 " "<auditing>` ``object.__getattr__``。" -#: ../../reference/datamodel.rst:1747 +#: ../../reference/datamodel.rst:1745 msgid "Gives the line number where the exception occurred" msgstr "" -#: ../../reference/datamodel.rst:1750 +#: ../../reference/datamodel.rst:1748 msgid "Indicates the \"precise instruction\"." msgstr "" -#: ../../reference/datamodel.rst:1752 +#: ../../reference/datamodel.rst:1750 msgid "" "The line number and last instruction in the traceback may differ from the " "line number of its :ref:`frame object <frame-objects>` if the exception " @@ -2037,39 +2041,39 @@ msgid "" "with a :keyword:`finally` clause." msgstr "" -#: ../../reference/datamodel.rst:1763 +#: ../../reference/datamodel.rst:1761 msgid "" "The special writable attribute :attr:`!tb_next` is the next level in the " "stack trace (towards the frame where the exception occurred), or ``None`` if " "there is no next level." msgstr "" -#: ../../reference/datamodel.rst:1767 +#: ../../reference/datamodel.rst:1765 msgid "This attribute is now writable" msgstr "" -#: ../../reference/datamodel.rst:1772 +#: ../../reference/datamodel.rst:1770 msgid "Slice objects" msgstr "" -#: ../../reference/datamodel.rst:1776 +#: ../../reference/datamodel.rst:1774 msgid "" "Slice objects are used to represent slices for :meth:`~object.__getitem__` " "methods. They are also created by the built-in :func:`slice` function." msgstr "" -#: ../../reference/datamodel.rst:1785 +#: ../../reference/datamodel.rst:1783 msgid "" -"Special read-only attributes: :attr:`~slice.start` is the lower bound; :attr:" -"`~slice.stop` is the upper bound; :attr:`~slice.step` is the step value; " -"each is ``None`` if omitted. These attributes can have any type." +"Special read-only attributes: :attr:`~slice.start` is the lower " +"bound; :attr:`~slice.stop` is the upper bound; :attr:`~slice.step` is the " +"step value; each is ``None`` if omitted. These attributes can have any type." msgstr "" -#: ../../reference/datamodel.rst:1789 +#: ../../reference/datamodel.rst:1787 msgid "Slice objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1793 +#: ../../reference/datamodel.rst:1791 msgid "" "This method takes a single integer argument *length* and computes " "information about the slice that the slice object would describe if applied " @@ -2079,11 +2083,11 @@ msgid "" "a manner consistent with regular slices." msgstr "" -#: ../../reference/datamodel.rst:1802 +#: ../../reference/datamodel.rst:1800 msgid "Static method objects" msgstr "" -#: ../../reference/datamodel.rst:1804 +#: ../../reference/datamodel.rst:1802 msgid "" "Static method objects provide a way of defeating the transformation of " "function objects to method objects described above. A static method object " @@ -2094,48 +2098,48 @@ msgid "" "method objects are created by the built-in :func:`staticmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1814 +#: ../../reference/datamodel.rst:1812 msgid "Class method objects" msgstr "" -#: ../../reference/datamodel.rst:1816 +#: ../../reference/datamodel.rst:1814 msgid "" "A class method object, like a static method object, is a wrapper around " "another object that alters the way in which that object is retrieved from " "classes and class instances. The behaviour of class method objects upon such " "retrieval is described above, under :ref:`\"instance methods\" <instance-" -"methods>`. Class method objects are created by the built-in :func:" -"`classmethod` constructor." +"methods>`. Class method objects are created by the built-" +"in :func:`classmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1826 +#: ../../reference/datamodel.rst:1824 msgid "Special method names" msgstr "" -#: ../../reference/datamodel.rst:1832 +#: ../../reference/datamodel.rst:1830 msgid "" "A class can implement certain operations that are invoked by special syntax " "(such as arithmetic operations or subscripting and slicing) by defining " "methods with special names. This is Python's approach to :dfn:`operator " "overloading`, allowing classes to define their own behavior with respect to " -"language operators. For instance, if a class defines a method named :meth:" -"`~object.__getitem__`, and ``x`` is an instance of this class, then ``x[i]`` " -"is roughly equivalent to ``type(x).__getitem__(x, i)``. Except where " -"mentioned, attempts to execute an operation raise an exception when no " -"appropriate method is defined (typically :exc:`AttributeError` or :exc:" -"`TypeError`)." +"language operators. For instance, if a class defines a method " +"named :meth:`~object.__getitem__`, and ``x`` is an instance of this class, " +"then ``x[i]`` is roughly equivalent to ``type(x).__getitem__(x, i)``. " +"Except where mentioned, attempts to execute an operation raise an exception " +"when no appropriate method is defined (typically :exc:`AttributeError` " +"or :exc:`TypeError`)." msgstr "" -#: ../../reference/datamodel.rst:1843 +#: ../../reference/datamodel.rst:1841 msgid "" "Setting a special method to ``None`` indicates that the corresponding " -"operation is not available. For example, if a class sets :meth:`~object." -"__iter__` to ``None``, the class is not iterable, so calling :func:`iter` on " -"its instances will raise a :exc:`TypeError` (without falling back to :meth:" -"`~object.__getitem__`). [#]_" +"operation is not available. For example, if a class " +"sets :meth:`~object.__iter__` to ``None``, the class is not iterable, so " +"calling :func:`iter` on its instances will raise a :exc:`TypeError` (without " +"falling back to :meth:`~object.__getitem__`). [#]_" msgstr "" -#: ../../reference/datamodel.rst:1849 +#: ../../reference/datamodel.rst:1847 msgid "" "When implementing a class that emulates any built-in type, it is important " "that the emulation only be implemented to the degree that it makes sense for " @@ -2145,11 +2149,11 @@ msgid "" "the W3C's Document Object Model.)" msgstr "" -#: ../../reference/datamodel.rst:1860 +#: ../../reference/datamodel.rst:1858 msgid "Basic customization" msgstr "" -#: ../../reference/datamodel.rst:1866 +#: ../../reference/datamodel.rst:1864 msgid "" "Called to create a new instance of class *cls*. :meth:`__new__` is a static " "method (special-cased so you need not declare it as such) that takes the " @@ -2159,7 +2163,7 @@ msgid "" "new object instance (usually an instance of *cls*)." msgstr "" -#: ../../reference/datamodel.rst:1873 +#: ../../reference/datamodel.rst:1871 msgid "" "Typical implementations create a new instance of the class by invoking the " "superclass's :meth:`__new__` method using ``super().__new__(cls[, ...])`` " @@ -2167,7 +2171,7 @@ msgid "" "necessary before returning it." msgstr "" -#: ../../reference/datamodel.rst:1878 +#: ../../reference/datamodel.rst:1876 msgid "" "If :meth:`__new__` is invoked during object construction and it returns an " "instance of *cls*, then the new instance’s :meth:`__init__` method will be " @@ -2176,13 +2180,13 @@ msgid "" "constructor." msgstr "" -#: ../../reference/datamodel.rst:1883 +#: ../../reference/datamodel.rst:1881 msgid "" "If :meth:`__new__` does not return an instance of *cls*, then the new " "instance's :meth:`__init__` method will not be invoked." msgstr "" -#: ../../reference/datamodel.rst:1886 +#: ../../reference/datamodel.rst:1884 msgid "" ":meth:`__new__` is intended mainly to allow subclasses of immutable types " "(like int, str, or tuple) to customize instance creation. It is also " @@ -2190,7 +2194,7 @@ msgid "" "creation." msgstr "" -#: ../../reference/datamodel.rst:1895 +#: ../../reference/datamodel.rst:1893 msgid "" "Called after the instance has been created (by :meth:`__new__`), but before " "it is returned to the caller. The arguments are those passed to the class " @@ -2200,7 +2204,7 @@ msgid "" "example: ``super().__init__([args...])``." msgstr "" -#: ../../reference/datamodel.rst:1902 +#: ../../reference/datamodel.rst:1900 msgid "" "Because :meth:`__new__` and :meth:`__init__` work together in constructing " "objects (:meth:`__new__` to create it, and :meth:`__init__` to customize " @@ -2208,16 +2212,16 @@ msgid "" "will cause a :exc:`TypeError` to be raised at runtime." msgstr "" -#: ../../reference/datamodel.rst:1915 +#: ../../reference/datamodel.rst:1913 msgid "" "Called when the instance is about to be destroyed. This is also called a " -"finalizer or (improperly) a destructor. If a base class has a :meth:" -"`__del__` method, the derived class's :meth:`__del__` method, if any, must " -"explicitly call it to ensure proper deletion of the base class part of the " -"instance." +"finalizer or (improperly) a destructor. If a base class has " +"a :meth:`__del__` method, the derived class's :meth:`__del__` method, if " +"any, must explicitly call it to ensure proper deletion of the base class " +"part of the instance." msgstr "" -#: ../../reference/datamodel.rst:1921 +#: ../../reference/datamodel.rst:1919 msgid "" "It is possible (though not recommended!) for the :meth:`__del__` method to " "postpone destruction of the instance by creating a new reference to it. " @@ -2227,7 +2231,7 @@ msgid "" "it once." msgstr "" -#: ../../reference/datamodel.rst:1928 +#: ../../reference/datamodel.rst:1926 msgid "" "It is not guaranteed that :meth:`__del__` methods are called for objects " "that still exist when the interpreter exits. :class:`weakref.finalize` " @@ -2235,14 +2239,14 @@ msgid "" "when an object is garbage collected." msgstr "" -#: ../../reference/datamodel.rst:1935 +#: ../../reference/datamodel.rst:1933 msgid "" "``del x`` doesn't directly call ``x.__del__()`` --- the former decrements " "the reference count for ``x`` by one, and the latter is only called when " "``x``'s reference count reaches zero." msgstr "" -#: ../../reference/datamodel.rst:1940 +#: ../../reference/datamodel.rst:1938 msgid "" "It is possible for a reference cycle to prevent the reference count of an " "object from going to zero. In this case, the cycle will be later detected " @@ -2253,27 +2257,27 @@ msgid "" "caught in the traceback." msgstr "" -#: ../../reference/datamodel.rst:1950 +#: ../../reference/datamodel.rst:1948 msgid "Documentation for the :mod:`gc` module." msgstr "" -#: ../../reference/datamodel.rst:1954 +#: ../../reference/datamodel.rst:1952 msgid "" "Due to the precarious circumstances under which :meth:`__del__` methods are " "invoked, exceptions that occur during their execution are ignored, and a " "warning is printed to ``sys.stderr`` instead. In particular:" msgstr "" -#: ../../reference/datamodel.rst:1958 +#: ../../reference/datamodel.rst:1956 msgid "" ":meth:`__del__` can be invoked when arbitrary code is being executed, " "including from any arbitrary thread. If :meth:`__del__` needs to take a " "lock or invoke any other blocking resource, it may deadlock as the resource " -"may already be taken by the code that gets interrupted to execute :meth:" -"`__del__`." +"may already be taken by the code that gets interrupted to " +"execute :meth:`__del__`." msgstr "" -#: ../../reference/datamodel.rst:1964 +#: ../../reference/datamodel.rst:1962 msgid "" ":meth:`__del__` can be executed during interpreter shutdown. As a " "consequence, the global variables it needs to access (including other " @@ -2284,26 +2288,27 @@ msgid "" "still available at the time when the :meth:`__del__` method is called." msgstr "" -#: ../../reference/datamodel.rst:1979 +#: ../../reference/datamodel.rst:1977 msgid "" "Called by the :func:`repr` built-in function to compute the \"official\" " "string representation of an object. If at all possible, this should look " "like a valid Python expression that could be used to recreate an object with " "the same value (given an appropriate environment). If this is not possible, " "a string of the form ``<...some useful description...>`` should be returned. " -"The return value must be a string object. If a class defines :meth:" -"`__repr__` but not :meth:`__str__`, then :meth:`__repr__` is also used when " -"an \"informal\" string representation of instances of that class is required." +"The return value must be a string object. If a class " +"defines :meth:`__repr__` but not :meth:`__str__`, then :meth:`__repr__` is " +"also used when an \"informal\" string representation of instances of that " +"class is required." msgstr "" -#: ../../reference/datamodel.rst:1988 +#: ../../reference/datamodel.rst:1986 msgid "" "This is typically used for debugging, so it is important that the " "representation is information-rich and unambiguous. A default implementation " "is provided by the :class:`object` class itself." msgstr "" -#: ../../reference/datamodel.rst:2000 +#: ../../reference/datamodel.rst:1998 msgid "" "Called by :func:`str(object) <str>`, the default :meth:`__format__` " "implementation, and the built-in function :func:`print`, to compute the " @@ -2311,27 +2316,27 @@ msgid "" "return value must be a :ref:`str <textseq>` object." msgstr "" -#: ../../reference/datamodel.rst:2005 +#: ../../reference/datamodel.rst:2003 msgid "" "This method differs from :meth:`object.__repr__` in that there is no " "expectation that :meth:`__str__` return a valid Python expression: a more " "convenient or concise representation can be used." msgstr "" -#: ../../reference/datamodel.rst:2009 +#: ../../reference/datamodel.rst:2007 msgid "" "The default implementation defined by the built-in type :class:`object` " "calls :meth:`object.__repr__`." msgstr "" -#: ../../reference/datamodel.rst:2019 +#: ../../reference/datamodel.rst:2017 msgid "" "Called by :ref:`bytes <func-bytes>` to compute a byte-string representation " -"of an object. This should return a :class:`bytes` object. The :class:" -"`object` class itself does not provide this method." +"of an object. This should return a :class:`bytes` object. " +"The :class:`object` class itself does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:2031 +#: ../../reference/datamodel.rst:2029 msgid "" "Called by the :func:`format` built-in function, and by extension, evaluation " "of :ref:`formatted string literals <f-strings>` and the :meth:`str.format` " @@ -2343,43 +2348,43 @@ msgid "" "formatting option syntax." msgstr "" -#: ../../reference/datamodel.rst:2041 +#: ../../reference/datamodel.rst:2039 msgid "" "See :ref:`formatspec` for a description of the standard formatting syntax." msgstr "" -#: ../../reference/datamodel.rst:2043 +#: ../../reference/datamodel.rst:2041 msgid "The return value must be a string object." msgstr "回傳值必須是個字串物件。" -#: ../../reference/datamodel.rst:2045 +#: ../../reference/datamodel.rst:2043 msgid "" "The default implementation by the :class:`object` class should be given an " "empty *format_spec* string. It delegates to :meth:`__str__`." msgstr "" -#: ../../reference/datamodel.rst:2048 +#: ../../reference/datamodel.rst:2046 msgid "" "The __format__ method of ``object`` itself raises a :exc:`TypeError` if " "passed any non-empty string." msgstr "" -#: ../../reference/datamodel.rst:2052 +#: ../../reference/datamodel.rst:2050 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " "``format(str(x), '')``." msgstr "" -#: ../../reference/datamodel.rst:2068 +#: ../../reference/datamodel.rst:2066 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " -"between operator symbols and method names is as follows: ``x<y`` calls ``x." -"__lt__(y)``, ``x<=y`` calls ``x.__le__(y)``, ``x==y`` calls ``x.__eq__(y)``, " -"``x!=y`` calls ``x.__ne__(y)``, ``x>y`` calls ``x.__gt__(y)``, and ``x>=y`` " -"calls ``x.__ge__(y)``." +"between operator symbols and method names is as follows: ``x<y`` calls " +"``x.__lt__(y)``, ``x<=y`` calls ``x.__le__(y)``, ``x==y`` calls " +"``x.__eq__(y)``, ``x!=y`` calls ``x.__ne__(y)``, ``x>y`` calls " +"``x.__gt__(y)``, and ``x>=y`` calls ``x.__ge__(y)``." msgstr "" -#: ../../reference/datamodel.rst:2074 +#: ../../reference/datamodel.rst:2072 msgid "" "A rich comparison method may return the singleton :data:`NotImplemented` if " "it does not implement the operation for a given pair of arguments. By " @@ -2390,66 +2395,67 @@ msgid "" "result is true or false." msgstr "" -#: ../../reference/datamodel.rst:2081 +#: ../../reference/datamodel.rst:2079 msgid "" -"By default, ``object`` implements :meth:`__eq__` by using ``is``, returning :" -"data:`NotImplemented` in the case of a false comparison: ``True if x is y " -"else NotImplemented``. For :meth:`__ne__`, by default it delegates to :meth:" -"`__eq__` and inverts the result unless it is :data:`!NotImplemented`. There " -"are no other implied relationships among the comparison operators or default " -"implementations; for example, the truth of ``(x<y or x==y)`` does not imply " -"``x<=y``. To automatically generate ordering operations from a single root " -"operation, see :func:`functools.total_ordering`." +"By default, ``object`` implements :meth:`__eq__` by using ``is``, " +"returning :data:`NotImplemented` in the case of a false comparison: ``True " +"if x is y else NotImplemented``. For :meth:`__ne__`, by default it delegates " +"to :meth:`__eq__` and inverts the result unless it is :data:`!" +"NotImplemented`. There are no other implied relationships among the " +"comparison operators or default implementations; for example, the truth of " +"``(x<y or x==y)`` does not imply ``x<=y``. To automatically generate " +"ordering operations from a single root operation, " +"see :func:`functools.total_ordering`." msgstr "" -#: ../../reference/datamodel.rst:2090 +#: ../../reference/datamodel.rst:2088 msgid "" "By default, the :class:`object` class provides implementations consistent " "with :ref:`expressions-value-comparisons`: equality compares according to " "object identity, and order comparisons raise :exc:`TypeError`. Each default " -"method may generate these results directly, but may also return :data:" -"`NotImplemented`." +"method may generate these results directly, but may also " +"return :data:`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:2096 +#: ../../reference/datamodel.rst:2094 msgid "" -"See the paragraph on :meth:`__hash__` for some important notes on creating :" -"term:`hashable` objects which support custom comparison operations and are " -"usable as dictionary keys." +"See the paragraph on :meth:`__hash__` for some important notes on " +"creating :term:`hashable` objects which support custom comparison operations " +"and are usable as dictionary keys." msgstr "" -#: ../../reference/datamodel.rst:2100 +#: ../../reference/datamodel.rst:2098 msgid "" "There are no swapped-argument versions of these methods (to be used when the " "left argument does not support the operation but the right argument does); " -"rather, :meth:`__lt__` and :meth:`__gt__` are each other's reflection, :meth:" -"`__le__` and :meth:`__ge__` are each other's reflection, and :meth:`__eq__` " -"and :meth:`__ne__` are their own reflection. If the operands are of " -"different types, and the right operand's type is a direct or indirect " -"subclass of the left operand's type, the reflected method of the right " -"operand has priority, otherwise the left operand's method has priority. " -"Virtual subclassing is not considered." +"rather, :meth:`__lt__` and :meth:`__gt__` are each other's " +"reflection, :meth:`__le__` and :meth:`__ge__` are each other's reflection, " +"and :meth:`__eq__` and :meth:`__ne__` are their own reflection. If the " +"operands are of different types, and the right operand's type is a direct or " +"indirect subclass of the left operand's type, the reflected method of the " +"right operand has priority, otherwise the left operand's method has " +"priority. Virtual subclassing is not considered." msgstr "" -#: ../../reference/datamodel.rst:2111 +#: ../../reference/datamodel.rst:2109 msgid "" -"When no appropriate method returns any value other than :data:" -"`NotImplemented`, the ``==`` and ``!=`` operators will fall back to ``is`` " -"and ``is not``, respectively." +"When no appropriate method returns any value other " +"than :data:`NotImplemented`, the ``==`` and ``!=`` operators will fall back " +"to ``is`` and ``is not``, respectively." msgstr "" -#: ../../reference/datamodel.rst:2120 +#: ../../reference/datamodel.rst:2118 msgid "" "Called by built-in function :func:`hash` and for operations on members of " -"hashed collections including :class:`set`, :class:`frozenset`, and :class:" -"`dict`. The ``__hash__()`` method should return an integer. The only " -"required property is that objects which compare equal have the same hash " -"value; it is advised to mix together the hash values of the components of " -"the object that also play a part in comparison of objects by packing them " +"hashed collections including :class:`set`, :class:`frozenset`, " +"and :class:`dict`. The ``__hash__()`` method should return an integer. The " +"only required property is that objects which compare equal have the same " +"hash value; it is advised to mix together the hash values of the components " +"of the object that also play a part in comparison of objects by packing them " "into a tuple and hashing the tuple. Example::" msgstr "" -#: ../../reference/datamodel.rst:2128 +#: ../../reference/datamodel.rst:2126 msgid "" "def __hash__(self):\n" " return hash((self.name, self.nick, self.color))" @@ -2457,29 +2463,29 @@ msgstr "" "def __hash__(self):\n" " return hash((self.name, self.nick, self.color))" -#: ../../reference/datamodel.rst:2133 +#: ../../reference/datamodel.rst:2131 msgid "" -":func:`hash` truncates the value returned from an object's custom :meth:" -"`__hash__` method to the size of a :c:type:`Py_ssize_t`. This is typically " -"8 bytes on 64-bit builds and 4 bytes on 32-bit builds. If an object's :" -"meth:`__hash__` must interoperate on builds of different bit sizes, be sure " -"to check the width on all supported builds. An easy way to do this is with " -"``python -c \"import sys; print(sys.hash_info.width)\"``." +":func:`hash` truncates the value returned from an object's " +"custom :meth:`__hash__` method to the size of a :c:type:`Py_ssize_t`. This " +"is typically 8 bytes on 64-bit builds and 4 bytes on 32-bit builds. If an " +"object's :meth:`__hash__` must interoperate on builds of different bit " +"sizes, be sure to check the width on all supported builds. An easy way to " +"do this is with ``python -c \"import sys; print(sys.hash_info.width)\"``." msgstr "" -#: ../../reference/datamodel.rst:2141 +#: ../../reference/datamodel.rst:2139 msgid "" -"If a class does not define an :meth:`__eq__` method it should not define a :" -"meth:`__hash__` operation either; if it defines :meth:`__eq__` but not :meth:" -"`__hash__`, its instances will not be usable as items in hashable " -"collections. If a class defines mutable objects and implements an :meth:" -"`__eq__` method, it should not implement :meth:`__hash__`, since the " -"implementation of :term:`hashable` collections requires that a key's hash " -"value is immutable (if the object's hash value changes, it will be in the " -"wrong hash bucket)." +"If a class does not define an :meth:`__eq__` method it should not define " +"a :meth:`__hash__` operation either; if it defines :meth:`__eq__` but " +"not :meth:`__hash__`, its instances will not be usable as items in hashable " +"collections. If a class defines mutable objects and implements " +"an :meth:`__eq__` method, it should not implement :meth:`__hash__`, since " +"the implementation of :term:`hashable` collections requires that a key's " +"hash value is immutable (if the object's hash value changes, it will be in " +"the wrong hash bucket)." msgstr "" -#: ../../reference/datamodel.rst:2150 +#: ../../reference/datamodel.rst:2148 msgid "" "User-defined classes have :meth:`__eq__` and :meth:`__hash__` methods by " "default (inherited from the :class:`object` class); with them, all objects " @@ -2488,33 +2494,33 @@ msgid "" "``hash(x) == hash(y)``." msgstr "" -#: ../../reference/datamodel.rst:2155 +#: ../../reference/datamodel.rst:2153 msgid "" "A class that overrides :meth:`__eq__` and does not define :meth:`__hash__` " -"will have its :meth:`__hash__` implicitly set to ``None``. When the :meth:" -"`__hash__` method of a class is ``None``, instances of the class will raise " -"an appropriate :exc:`TypeError` when a program attempts to retrieve their " -"hash value, and will also be correctly identified as unhashable when " -"checking ``isinstance(obj, collections.abc.Hashable)``." +"will have its :meth:`__hash__` implicitly set to ``None``. When " +"the :meth:`__hash__` method of a class is ``None``, instances of the class " +"will raise an appropriate :exc:`TypeError` when a program attempts to " +"retrieve their hash value, and will also be correctly identified as " +"unhashable when checking ``isinstance(obj, collections.abc.Hashable)``." msgstr "" -#: ../../reference/datamodel.rst:2162 +#: ../../reference/datamodel.rst:2160 msgid "" "If a class that overrides :meth:`__eq__` needs to retain the implementation " "of :meth:`__hash__` from a parent class, the interpreter must be told this " "explicitly by setting ``__hash__ = <ParentClass>.__hash__``." msgstr "" -#: ../../reference/datamodel.rst:2166 +#: ../../reference/datamodel.rst:2164 msgid "" "If a class that does not override :meth:`__eq__` wishes to suppress hash " "support, it should include ``__hash__ = None`` in the class definition. A " -"class which defines its own :meth:`__hash__` that explicitly raises a :exc:" -"`TypeError` would be incorrectly identified as hashable by an " +"class which defines its own :meth:`__hash__` that explicitly raises " +"a :exc:`TypeError` would be incorrectly identified as hashable by an " "``isinstance(obj, collections.abc.Hashable)`` call." msgstr "" -#: ../../reference/datamodel.rst:2175 +#: ../../reference/datamodel.rst:2173 msgid "" "By default, the :meth:`__hash__` values of str and bytes objects are " "\"salted\" with an unpredictable random value. Although they remain " @@ -2522,7 +2528,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: ../../reference/datamodel.rst:2180 +#: ../../reference/datamodel.rst:2178 msgid "" "This is intended to provide protection against a denial-of-service caused by " "carefully chosen inputs that exploit the worst case performance of a dict " @@ -2530,67 +2536,67 @@ msgid "" "advisories/ocert-2011-003.html for details." msgstr "" -#: ../../reference/datamodel.rst:2185 +#: ../../reference/datamodel.rst:2183 msgid "" "Changing hash values affects the iteration order of sets. Python has never " "made guarantees about this ordering (and it typically varies between 32-bit " "and 64-bit builds)." msgstr "" -#: ../../reference/datamodel.rst:2189 +#: ../../reference/datamodel.rst:2187 msgid "See also :envvar:`PYTHONHASHSEED`." msgstr "另請參閱 :envvar:`PYTHONHASHSEED`。" -#: ../../reference/datamodel.rst:2191 +#: ../../reference/datamodel.rst:2189 msgid "Hash randomization is enabled by default." msgstr "" -#: ../../reference/datamodel.rst:2199 +#: ../../reference/datamodel.rst:2197 msgid "" "Called to implement truth value testing and the built-in operation " "``bool()``; should return ``False`` or ``True``. When this method is not " "defined, :meth:`~object.__len__` is called, if it is defined, and the object " -"is considered true if its result is nonzero. If a class defines neither :" -"meth:`!__len__` nor :meth:`!__bool__` (which is true of the :class:`object` " -"class itself), all its instances are considered true." +"is considered true if its result is nonzero. If a class defines " +"neither :meth:`!__len__` nor :meth:`!__bool__` (which is true of " +"the :class:`object` class itself), all its instances are considered true." msgstr "" -#: ../../reference/datamodel.rst:2210 +#: ../../reference/datamodel.rst:2208 msgid "Customizing attribute access" msgstr "" -#: ../../reference/datamodel.rst:2212 +#: ../../reference/datamodel.rst:2210 msgid "" "The following methods can be defined to customize the meaning of attribute " "access (use of, assignment to, or deletion of ``x.name``) for class " "instances." msgstr "" -#: ../../reference/datamodel.rst:2220 +#: ../../reference/datamodel.rst:2218 msgid "" "Called when the default attribute access fails with an :exc:`AttributeError` " "(either :meth:`__getattribute__` raises an :exc:`AttributeError` because " "*name* is not an instance attribute or an attribute in the class tree for " -"``self``; or :meth:`__get__` of a *name* property raises :exc:" -"`AttributeError`). This method should either return the (computed) " -"attribute value or raise an :exc:`AttributeError` exception. The :class:" -"`object` class itself does not provide this method." -msgstr "" - -#: ../../reference/datamodel.rst:2228 -msgid "" -"Note that if the attribute is found through the normal mechanism, :meth:" -"`__getattr__` is not called. (This is an intentional asymmetry between :" -"meth:`__getattr__` and :meth:`__setattr__`.) This is done both for " -"efficiency reasons and because otherwise :meth:`__getattr__` would have no " -"way to access other attributes of the instance. Note that at least for " -"instance variables, you can take total control by not inserting any values " -"in the instance attribute dictionary (but instead inserting them in another " -"object). See the :meth:`__getattribute__` method below for a way to " +"``self``; or :meth:`__get__` of a *name* property " +"raises :exc:`AttributeError`). This method should either return the " +"(computed) attribute value or raise an :exc:`AttributeError` exception. " +"The :class:`object` class itself does not provide this method." +msgstr "" + +#: ../../reference/datamodel.rst:2226 +msgid "" +"Note that if the attribute is found through the normal " +"mechanism, :meth:`__getattr__` is not called. (This is an intentional " +"asymmetry between :meth:`__getattr__` and :meth:`__setattr__`.) This is done " +"both for efficiency reasons and because otherwise :meth:`__getattr__` would " +"have no way to access other attributes of the instance. Note that at least " +"for instance variables, you can take total control by not inserting any " +"values in the instance attribute dictionary (but instead inserting them in " +"another object). See the :meth:`__getattribute__` method below for a way to " "actually get total control over attribute access." msgstr "" -#: ../../reference/datamodel.rst:2241 +#: ../../reference/datamodel.rst:2239 msgid "" "Called unconditionally to implement attribute accesses for instances of the " "class. If the class also defines :meth:`__getattr__`, the latter will not be " @@ -2602,90 +2608,90 @@ msgid "" "example, ``object.__getattribute__(self, name)``." msgstr "" -#: ../../reference/datamodel.rst:2252 +#: ../../reference/datamodel.rst:2250 msgid "" "This method may still be bypassed when looking up special methods as the " "result of implicit invocation via language syntax or :ref:`built-in " "functions <builtin-functions>`. See :ref:`special-lookup`." msgstr "" -#: ../../reference/datamodel.rst:2257 ../../reference/datamodel.rst:2259 +#: ../../reference/datamodel.rst:2255 ../../reference/datamodel.rst:2257 msgid "" "For certain sensitive attribute accesses, raises an :ref:`auditing event " "<auditing>` ``object.__getattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:2266 +#: ../../reference/datamodel.rst:2264 msgid "" "Called when an attribute assignment is attempted. This is called instead of " "the normal mechanism (i.e. store the value in the instance dictionary). " "*name* is the attribute name, *value* is the value to be assigned to it." msgstr "" -#: ../../reference/datamodel.rst:2270 +#: ../../reference/datamodel.rst:2268 msgid "" "If :meth:`__setattr__` wants to assign to an instance attribute, it should " -"call the base class method with the same name, for example, ``object." -"__setattr__(self, name, value)``." +"call the base class method with the same name, for example, " +"``object.__setattr__(self, name, value)``." msgstr "" -#: ../../reference/datamodel.rst:2274 ../../reference/datamodel.rst:2276 +#: ../../reference/datamodel.rst:2272 ../../reference/datamodel.rst:2274 msgid "" "For certain sensitive attribute assignments, raises an :ref:`auditing event " "<auditing>` ``object.__setattr__`` with arguments ``obj``, ``name``, " "``value``." msgstr "" -#: ../../reference/datamodel.rst:2283 +#: ../../reference/datamodel.rst:2281 msgid "" "Like :meth:`__setattr__` but for attribute deletion instead of assignment. " "This should only be implemented if ``del obj.name`` is meaningful for the " "object." msgstr "" -#: ../../reference/datamodel.rst:2286 ../../reference/datamodel.rst:2288 +#: ../../reference/datamodel.rst:2284 ../../reference/datamodel.rst:2286 msgid "" "For certain sensitive attribute deletions, raises an :ref:`auditing event " "<auditing>` ``object.__delattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:2295 +#: ../../reference/datamodel.rst:2293 msgid "" "Called when :func:`dir` is called on the object. An iterable must be " "returned. :func:`dir` converts the returned iterable to a list and sorts it." msgstr "" -#: ../../reference/datamodel.rst:2300 +#: ../../reference/datamodel.rst:2298 msgid "Customizing module attribute access" msgstr "" -#: ../../reference/datamodel.rst:2307 +#: ../../reference/datamodel.rst:2305 msgid "" "Special names ``__getattr__`` and ``__dir__`` can be also used to customize " "access to module attributes. The ``__getattr__`` function at the module " "level should accept one argument which is the name of an attribute and " "return the computed value or raise an :exc:`AttributeError`. If an attribute " -"is not found on a module object through the normal lookup, i.e. :meth:" -"`object.__getattribute__`, then ``__getattr__`` is searched in the module " -"``__dict__`` before raising an :exc:`AttributeError`. If found, it is called " -"with the attribute name and the result is returned." +"is not found on a module object through the normal lookup, " +"i.e. :meth:`object.__getattribute__`, then ``__getattr__`` is searched in " +"the module ``__dict__`` before raising an :exc:`AttributeError`. If found, " +"it is called with the attribute name and the result is returned." msgstr "" -#: ../../reference/datamodel.rst:2316 +#: ../../reference/datamodel.rst:2314 msgid "" "The ``__dir__`` function should accept no arguments, and return an iterable " "of strings that represents the names accessible on module. If present, this " "function overrides the standard :func:`dir` search on a module." msgstr "" -#: ../../reference/datamodel.rst:2320 +#: ../../reference/datamodel.rst:2318 msgid "" "For a more fine grained customization of the module behavior (setting " "attributes, properties, etc.), one can set the ``__class__`` attribute of a " "module object to a subclass of :class:`types.ModuleType`. For example::" msgstr "" -#: ../../reference/datamodel.rst:2324 +#: ../../reference/datamodel.rst:2322 msgid "" "import sys\n" "from types import ModuleType\n" @@ -2713,7 +2719,7 @@ msgstr "" "\n" "sys.modules[__name__].__class__ = VerboseModule" -#: ../../reference/datamodel.rst:2338 +#: ../../reference/datamodel.rst:2336 msgid "" "Defining module ``__getattr__`` and setting module ``__class__`` only affect " "lookups made using the attribute access syntax -- directly accessing the " @@ -2721,27 +2727,27 @@ msgid "" "module's globals dictionary) is unaffected." msgstr "" -#: ../../reference/datamodel.rst:2343 +#: ../../reference/datamodel.rst:2341 msgid "``__class__`` module attribute is now writable." msgstr "``__class__`` 模組屬性現在是可寫入的。" -#: ../../reference/datamodel.rst:2346 +#: ../../reference/datamodel.rst:2344 msgid "``__getattr__`` and ``__dir__`` module attributes." msgstr "``__getattr__`` 和 ``__dir__`` 模組屬性。" -#: ../../reference/datamodel.rst:2351 +#: ../../reference/datamodel.rst:2349 msgid ":pep:`562` - Module __getattr__ and __dir__" msgstr ":pep:`562` - 模組 __getattr__ 和 __dir__" -#: ../../reference/datamodel.rst:2352 +#: ../../reference/datamodel.rst:2350 msgid "Describes the ``__getattr__`` and ``__dir__`` functions on modules." msgstr "" -#: ../../reference/datamodel.rst:2358 +#: ../../reference/datamodel.rst:2356 msgid "Implementing Descriptors" msgstr "實作描述器" -#: ../../reference/datamodel.rst:2360 +#: ../../reference/datamodel.rst:2358 msgid "" "The following methods only apply when an instance of the class containing " "the method (a so-called *descriptor* class) appears in an *owner* class (the " @@ -2752,7 +2758,7 @@ msgid "" "does not implement any of these protocols." msgstr "" -#: ../../reference/datamodel.rst:2370 +#: ../../reference/datamodel.rst:2368 msgid "" "Called to get the attribute of the owner class (class attribute access) or " "of an instance of that class (instance attribute access). The optional " @@ -2761,13 +2767,13 @@ msgid "" "accessed through the *owner*." msgstr "" -#: ../../reference/datamodel.rst:2376 +#: ../../reference/datamodel.rst:2374 msgid "" -"This method should return the computed attribute value or raise an :exc:" -"`AttributeError` exception." +"This method should return the computed attribute value or raise " +"an :exc:`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:2379 +#: ../../reference/datamodel.rst:2377 msgid "" ":PEP:`252` specifies that :meth:`__get__` is callable with one or two " "arguments. Python's own built-in descriptors support this specification; " @@ -2777,31 +2783,31 @@ msgid "" "not." msgstr "" -#: ../../reference/datamodel.rst:2388 +#: ../../reference/datamodel.rst:2386 msgid "" "Called to set the attribute on an instance *instance* of the owner class to " "a new value, *value*." msgstr "" -#: ../../reference/datamodel.rst:2391 +#: ../../reference/datamodel.rst:2389 msgid "" "Note, adding :meth:`__set__` or :meth:`__delete__` changes the kind of " "descriptor to a \"data descriptor\". See :ref:`descriptor-invocation` for " "more details." msgstr "" -#: ../../reference/datamodel.rst:2397 +#: ../../reference/datamodel.rst:2395 msgid "" "Called to delete the attribute on an instance *instance* of the owner class." msgstr "" -#: ../../reference/datamodel.rst:2399 +#: ../../reference/datamodel.rst:2397 msgid "" "Instances of descriptors may also have the :attr:`!__objclass__` attribute " "present:" msgstr "" -#: ../../reference/datamodel.rst:2404 +#: ../../reference/datamodel.rst:2402 msgid "" "The attribute :attr:`!__objclass__` is interpreted by the :mod:`inspect` " "module as specifying the class where this object was defined (setting this " @@ -2812,20 +2818,20 @@ msgid "" "are implemented in C)." msgstr "" -#: ../../reference/datamodel.rst:2415 +#: ../../reference/datamodel.rst:2413 msgid "Invoking Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2417 +#: ../../reference/datamodel.rst:2415 msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " -"protocol: :meth:`~object.__get__`, :meth:`~object.__set__`, and :meth:" -"`~object.__delete__`. If any of those methods are defined for an object, it " -"is said to be a descriptor." +"protocol: :meth:`~object.__get__`, :meth:`~object.__set__`, " +"and :meth:`~object.__delete__`. If any of those methods are defined for an " +"object, it is said to be a descriptor." msgstr "" -#: ../../reference/datamodel.rst:2423 +#: ../../reference/datamodel.rst:2421 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " @@ -2833,7 +2839,7 @@ msgid "" "continuing through the base classes of ``type(a)`` excluding metaclasses." msgstr "" -#: ../../reference/datamodel.rst:2428 +#: ../../reference/datamodel.rst:2426 msgid "" "However, if the looked-up value is an object defining one of the descriptor " "methods, then Python may override the default behavior and invoke the " @@ -2841,60 +2847,61 @@ msgid "" "depends on which descriptor methods were defined and how they were called." msgstr "" -#: ../../reference/datamodel.rst:2433 +#: ../../reference/datamodel.rst:2431 msgid "" "The starting point for descriptor invocation is a binding, ``a.x``. How the " "arguments are assembled depends on ``a``:" msgstr "" -#: ../../reference/datamodel.rst:2436 +#: ../../reference/datamodel.rst:2434 msgid "Direct Call" msgstr "直接呼叫" -#: ../../reference/datamodel.rst:2437 +#: ../../reference/datamodel.rst:2435 msgid "" "The simplest and least common call is when user code directly invokes a " "descriptor method: ``x.__get__(a)``." msgstr "" -#: ../../reference/datamodel.rst:2440 +#: ../../reference/datamodel.rst:2438 msgid "Instance Binding" msgstr "" -#: ../../reference/datamodel.rst:2441 +#: ../../reference/datamodel.rst:2439 msgid "" "If binding to an object instance, ``a.x`` is transformed into the call: " "``type(a).__dict__['x'].__get__(a, type(a))``." msgstr "" -#: ../../reference/datamodel.rst:2444 +#: ../../reference/datamodel.rst:2442 msgid "Class Binding" msgstr "" -#: ../../reference/datamodel.rst:2445 +#: ../../reference/datamodel.rst:2443 msgid "" -"If binding to a class, ``A.x`` is transformed into the call: ``A." -"__dict__['x'].__get__(None, A)``." +"If binding to a class, ``A.x`` is transformed into the call: " +"``A.__dict__['x'].__get__(None, A)``." msgstr "" -#: ../../reference/datamodel.rst:2448 +#: ../../reference/datamodel.rst:2446 msgid "Super Binding" msgstr "" -#: ../../reference/datamodel.rst:2449 +#: ../../reference/datamodel.rst:2447 msgid "" "A dotted lookup such as ``super(A, a).x`` searches ``a.__class__.__mro__`` " -"for a base class ``B`` following ``A`` and then returns ``B.__dict__['x']." -"__get__(a, A)``. If not a descriptor, ``x`` is returned unchanged." +"for a base class ``B`` following ``A`` and then returns " +"``B.__dict__['x'].__get__(a, A)``. If not a descriptor, ``x`` is returned " +"unchanged." msgstr "" -#: ../../reference/datamodel.rst:2486 +#: ../../reference/datamodel.rst:2484 msgid "" "For instance bindings, the precedence of descriptor invocation depends on " "which descriptor methods are defined. A descriptor can define any " -"combination of :meth:`~object.__get__`, :meth:`~object.__set__` and :meth:" -"`~object.__delete__`. If it does not define :meth:`!__get__`, then " -"accessing the attribute will return the descriptor object itself unless " +"combination of :meth:`~object.__get__`, :meth:`~object.__set__` " +"and :meth:`~object.__delete__`. If it does not define :meth:`!__get__`, " +"then accessing the attribute will return the descriptor object itself unless " "there is a value in the object's instance dictionary. If the descriptor " "defines :meth:`!__set__` and/or :meth:`!__delete__`, it is a data " "descriptor; if it defines neither, it is a non-data descriptor. Normally, " @@ -2906,7 +2913,7 @@ msgid "" "instances." msgstr "" -#: ../../reference/datamodel.rst:2501 +#: ../../reference/datamodel.rst:2499 msgid "" "Python methods (including those decorated with :func:`@staticmethod " "<staticmethod>` and :func:`@classmethod <classmethod>`) are implemented as " @@ -2915,49 +2922,49 @@ msgid "" "from other instances of the same class." msgstr "" -#: ../../reference/datamodel.rst:2507 +#: ../../reference/datamodel.rst:2505 msgid "" "The :func:`property` function is implemented as a data descriptor. " "Accordingly, instances cannot override the behavior of a property." msgstr "" -#: ../../reference/datamodel.rst:2514 +#: ../../reference/datamodel.rst:2512 msgid "__slots__" msgstr "__slots__" -#: ../../reference/datamodel.rst:2516 +#: ../../reference/datamodel.rst:2514 msgid "" "*__slots__* allow us to explicitly declare data members (like properties) " "and deny the creation of :attr:`~object.__dict__` and *__weakref__* (unless " "explicitly declared in *__slots__* or available in a parent.)" msgstr "" -#: ../../reference/datamodel.rst:2520 +#: ../../reference/datamodel.rst:2518 msgid "" "The space saved over using :attr:`~object.__dict__` can be significant. " "Attribute lookup speed can be significantly improved as well." msgstr "" -#: ../../reference/datamodel.rst:2525 +#: ../../reference/datamodel.rst:2523 msgid "" "This class variable can be assigned a string, iterable, or sequence of " "strings with variable names used by instances. *__slots__* reserves space " -"for the declared variables and prevents the automatic creation of :attr:" -"`~object.__dict__` and *__weakref__* for each instance." +"for the declared variables and prevents the automatic creation " +"of :attr:`~object.__dict__` and *__weakref__* for each instance." msgstr "" -#: ../../reference/datamodel.rst:2534 +#: ../../reference/datamodel.rst:2532 msgid "Notes on using *__slots__*:" msgstr "" -#: ../../reference/datamodel.rst:2536 +#: ../../reference/datamodel.rst:2534 msgid "" -"When inheriting from a class without *__slots__*, the :attr:`~object." -"__dict__` and *__weakref__* attribute of the instances will always be " -"accessible." +"When inheriting from a class without *__slots__*, " +"the :attr:`~object.__dict__` and *__weakref__* attribute of the instances " +"will always be accessible." msgstr "" -#: ../../reference/datamodel.rst:2540 +#: ../../reference/datamodel.rst:2538 msgid "" "Without a :attr:`~object.__dict__` variable, instances cannot be assigned " "new variables not listed in the *__slots__* definition. Attempts to assign " @@ -2966,7 +2973,7 @@ msgid "" "sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2547 +#: ../../reference/datamodel.rst:2545 msgid "" "Without a *__weakref__* variable for each instance, classes defining " "*__slots__* do not support :mod:`weak references <weakref>` to its " @@ -2974,7 +2981,7 @@ msgid "" "to the sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2553 +#: ../../reference/datamodel.rst:2551 msgid "" "*__slots__* are implemented at the class level by creating :ref:`descriptors " "<descriptors>` for each variable name. As a result, class attributes cannot " @@ -2982,7 +2989,7 @@ msgid "" "otherwise, the class attribute would overwrite the descriptor assignment." msgstr "" -#: ../../reference/datamodel.rst:2559 +#: ../../reference/datamodel.rst:2557 msgid "" "The action of a *__slots__* declaration is not limited to the class where it " "is defined. *__slots__* declared in parents are available in child classes. " @@ -2991,7 +2998,7 @@ msgid "" "only contain names of any *additional* slots)." msgstr "" -#: ../../reference/datamodel.rst:2565 +#: ../../reference/datamodel.rst:2563 msgid "" "If a class defines a slot also defined in a base class, the instance " "variable defined by the base class slot is inaccessible (except by " @@ -3000,33 +3007,33 @@ msgid "" "prevent this." msgstr "" -#: ../../reference/datamodel.rst:2570 +#: ../../reference/datamodel.rst:2568 msgid "" ":exc:`TypeError` will be raised if nonempty *__slots__* are defined for a " "class derived from a :c:member:`\"variable-length\" built-in type " -"<PyTypeObject.tp_itemsize>` such as :class:`int`, :class:`bytes`, and :class:" -"`tuple`." +"<PyTypeObject.tp_itemsize>` such as :class:`int`, :class:`bytes`, " +"and :class:`tuple`." msgstr "" -#: ../../reference/datamodel.rst:2575 +#: ../../reference/datamodel.rst:2573 msgid "Any non-string :term:`iterable` may be assigned to *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2577 +#: ../../reference/datamodel.rst:2575 msgid "" "If a :class:`dictionary <dict>` is used to assign *__slots__*, the " "dictionary keys will be used as the slot names. The values of the dictionary " -"can be used to provide per-attribute docstrings that will be recognised by :" -"func:`inspect.getdoc` and displayed in the output of :func:`help`." +"can be used to provide per-attribute docstrings that will be recognised " +"by :func:`inspect.getdoc` and displayed in the output of :func:`help`." msgstr "" -#: ../../reference/datamodel.rst:2582 +#: ../../reference/datamodel.rst:2580 msgid "" ":attr:`~object.__class__` assignment works only if both classes have the " "same *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2585 +#: ../../reference/datamodel.rst:2583 msgid "" ":ref:`Multiple inheritance <tut-multiple>` with multiple slotted parent " "classes can be used, but only one parent is allowed to have attributes " @@ -3034,35 +3041,36 @@ msgid "" "raise :exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:2591 +#: ../../reference/datamodel.rst:2589 msgid "" "If an :term:`iterator` is used for *__slots__* then a :term:`descriptor` is " "created for each of the iterator's values. However, the *__slots__* " "attribute will be an empty iterator." msgstr "" -#: ../../reference/datamodel.rst:2599 +#: ../../reference/datamodel.rst:2597 msgid "Customizing class creation" msgstr "" -#: ../../reference/datamodel.rst:2601 +#: ../../reference/datamodel.rst:2599 msgid "" -"Whenever a class inherits from another class, :meth:`~object." -"__init_subclass__` is called on the parent class. This way, it is possible " -"to write classes which change the behavior of subclasses. This is closely " -"related to class decorators, but where class decorators only affect the " -"specific class they're applied to, ``__init_subclass__`` solely applies to " -"future subclasses of the class defining the method." +"Whenever a class inherits from another " +"class, :meth:`~object.__init_subclass__` is called on the parent class. This " +"way, it is possible to write classes which change the behavior of " +"subclasses. This is closely related to class decorators, but where class " +"decorators only affect the specific class they're applied to, " +"``__init_subclass__`` solely applies to future subclasses of the class " +"defining the method." msgstr "" -#: ../../reference/datamodel.rst:2610 +#: ../../reference/datamodel.rst:2608 msgid "" "This method is called whenever the containing class is subclassed. *cls* is " "then the new subclass. If defined as a normal instance method, this method " "is implicitly converted to a class method." msgstr "" -#: ../../reference/datamodel.rst:2614 +#: ../../reference/datamodel.rst:2612 msgid "" "Keyword arguments which are given to a new class are passed to the parent " "class's ``__init_subclass__``. For compatibility with other classes using " @@ -3070,7 +3078,7 @@ msgid "" "pass the others over to the base class, as in::" msgstr "" -#: ../../reference/datamodel.rst:2620 +#: ../../reference/datamodel.rst:2618 msgid "" "class Philosopher:\n" " def __init_subclass__(cls, /, default_name, **kwargs):\n" @@ -3088,13 +3096,13 @@ msgstr "" "class AustralianPhilosopher(Philosopher, default_name=\"Bruce\"):\n" " pass" -#: ../../reference/datamodel.rst:2628 +#: ../../reference/datamodel.rst:2626 msgid "" "The default implementation ``object.__init_subclass__`` does nothing, but " "raises an error if it is called with any arguments." msgstr "" -#: ../../reference/datamodel.rst:2633 +#: ../../reference/datamodel.rst:2631 msgid "" "The metaclass hint ``metaclass`` is consumed by the rest of the type " "machinery, and is never passed to ``__init_subclass__`` implementations. The " @@ -3102,19 +3110,19 @@ msgid "" "``type(cls)``." msgstr "" -#: ../../reference/datamodel.rst:2641 +#: ../../reference/datamodel.rst:2639 msgid "" "When a class is created, :meth:`type.__new__` scans the class variables and " "makes callbacks to those with a :meth:`~object.__set_name__` hook." msgstr "" -#: ../../reference/datamodel.rst:2646 +#: ../../reference/datamodel.rst:2644 msgid "" "Automatically called at the time the owning class *owner* is created. The " "object has been assigned to *name* in that class::" msgstr "" -#: ../../reference/datamodel.rst:2649 +#: ../../reference/datamodel.rst:2647 msgid "" "class A:\n" " x = C() # Automatically calls: x.__set_name__(A, 'x')" @@ -3122,14 +3130,14 @@ msgstr "" "class A:\n" " x = C() # 自動呼叫:x.__set_name__(A, 'x')" -#: ../../reference/datamodel.rst:2652 +#: ../../reference/datamodel.rst:2650 msgid "" -"If the class variable is assigned after the class is created, :meth:" -"`__set_name__` will not be called automatically. If needed, :meth:" -"`__set_name__` can be called directly::" +"If the class variable is assigned after the class is " +"created, :meth:`__set_name__` will not be called automatically. If " +"needed, :meth:`__set_name__` can be called directly::" msgstr "" -#: ../../reference/datamodel.rst:2656 +#: ../../reference/datamodel.rst:2654 msgid "" "class A:\n" " pass\n" @@ -3139,22 +3147,22 @@ msgid "" "c.__set_name__(A, 'x') # Manually invoke the hook" msgstr "" -#: ../../reference/datamodel.rst:2663 +#: ../../reference/datamodel.rst:2661 msgid "See :ref:`class-object-creation` for more details." msgstr "更多細節請見 :ref:`class-object-creation`。" -#: ../../reference/datamodel.rst:2671 +#: ../../reference/datamodel.rst:2669 msgid "Metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2678 +#: ../../reference/datamodel.rst:2676 msgid "" "By default, classes are constructed using :func:`type`. The class body is " "executed in a new namespace and the class name is bound locally to the " "result of ``type(name, bases, namespace)``." msgstr "" -#: ../../reference/datamodel.rst:2682 +#: ../../reference/datamodel.rst:2680 msgid "" "The class creation process can be customized by passing the ``metaclass`` " "keyword argument in the class definition line, or by inheriting from an " @@ -3162,7 +3170,7 @@ msgid "" "both ``MyClass`` and ``MySubclass`` are instances of ``Meta``::" msgstr "" -#: ../../reference/datamodel.rst:2687 +#: ../../reference/datamodel.rst:2685 msgid "" "class Meta(type):\n" " pass\n" @@ -3182,105 +3190,105 @@ msgstr "" "class MySubclass(MyClass):\n" " pass" -#: ../../reference/datamodel.rst:2696 +#: ../../reference/datamodel.rst:2694 msgid "" "Any other keyword arguments that are specified in the class definition are " "passed through to all metaclass operations described below." msgstr "" -#: ../../reference/datamodel.rst:2699 +#: ../../reference/datamodel.rst:2697 msgid "When a class definition is executed, the following steps occur:" msgstr "" -#: ../../reference/datamodel.rst:2701 +#: ../../reference/datamodel.rst:2699 msgid "MRO entries are resolved;" msgstr "" -#: ../../reference/datamodel.rst:2702 +#: ../../reference/datamodel.rst:2700 msgid "the appropriate metaclass is determined;" msgstr "" -#: ../../reference/datamodel.rst:2703 +#: ../../reference/datamodel.rst:2701 msgid "the class namespace is prepared;" msgstr "" -#: ../../reference/datamodel.rst:2704 +#: ../../reference/datamodel.rst:2702 msgid "the class body is executed;" msgstr "" -#: ../../reference/datamodel.rst:2705 +#: ../../reference/datamodel.rst:2703 msgid "the class object is created." msgstr "" -#: ../../reference/datamodel.rst:2709 +#: ../../reference/datamodel.rst:2707 msgid "Resolving MRO entries" msgstr "" -#: ../../reference/datamodel.rst:2713 +#: ../../reference/datamodel.rst:2711 msgid "" -"If a base that appears in a class definition is not an instance of :class:" -"`type`, then an :meth:`!__mro_entries__` method is searched on the base. If " -"an :meth:`!__mro_entries__` method is found, the base is substituted with " -"the result of a call to :meth:`!__mro_entries__` when creating the class. " -"The method is called with the original bases tuple passed to the *bases* " -"parameter, and must return a tuple of classes that will be used instead of " -"the base. The returned tuple may be empty: in these cases, the original base " -"is ignored." +"If a base that appears in a class definition is not an instance " +"of :class:`type`, then an :meth:`!__mro_entries__` method is searched on the " +"base. If an :meth:`!__mro_entries__` method is found, the base is " +"substituted with the result of a call to :meth:`!__mro_entries__` when " +"creating the class. The method is called with the original bases tuple " +"passed to the *bases* parameter, and must return a tuple of classes that " +"will be used instead of the base. The returned tuple may be empty: in these " +"cases, the original base is ignored." msgstr "" -#: ../../reference/datamodel.rst:2724 +#: ../../reference/datamodel.rst:2722 msgid ":func:`types.resolve_bases`" msgstr ":func:`types.resolve_bases`" -#: ../../reference/datamodel.rst:2725 +#: ../../reference/datamodel.rst:2723 msgid "Dynamically resolve bases that are not instances of :class:`type`." msgstr "" -#: ../../reference/datamodel.rst:2727 +#: ../../reference/datamodel.rst:2725 msgid ":func:`types.get_original_bases`" msgstr ":func:`types.get_original_bases`" -#: ../../reference/datamodel.rst:2728 +#: ../../reference/datamodel.rst:2726 msgid "" -"Retrieve a class's \"original bases\" prior to modifications by :meth:" -"`~object.__mro_entries__`." +"Retrieve a class's \"original bases\" prior to modifications " +"by :meth:`~object.__mro_entries__`." msgstr "" -#: ../../reference/datamodel.rst:2731 +#: ../../reference/datamodel.rst:2729 msgid ":pep:`560`" msgstr ":pep:`560`" -#: ../../reference/datamodel.rst:2732 +#: ../../reference/datamodel.rst:2730 msgid "Core support for typing module and generic types." msgstr "" -#: ../../reference/datamodel.rst:2736 +#: ../../reference/datamodel.rst:2734 msgid "Determining the appropriate metaclass" msgstr "" -#: ../../reference/datamodel.rst:2740 +#: ../../reference/datamodel.rst:2738 msgid "" "The appropriate metaclass for a class definition is determined as follows:" msgstr "" -#: ../../reference/datamodel.rst:2742 +#: ../../reference/datamodel.rst:2740 msgid "" "if no bases and no explicit metaclass are given, then :func:`type` is used;" msgstr "" -#: ../../reference/datamodel.rst:2743 +#: ../../reference/datamodel.rst:2741 msgid "" -"if an explicit metaclass is given and it is *not* an instance of :func:" -"`type`, then it is used directly as the metaclass;" +"if an explicit metaclass is given and it is *not* an instance " +"of :func:`type`, then it is used directly as the metaclass;" msgstr "" -#: ../../reference/datamodel.rst:2745 +#: ../../reference/datamodel.rst:2743 msgid "" "if an instance of :func:`type` is given as the explicit metaclass, or bases " "are defined, then the most derived metaclass is used." msgstr "" -#: ../../reference/datamodel.rst:2748 +#: ../../reference/datamodel.rst:2746 msgid "" "The most derived metaclass is selected from the explicitly specified " "metaclass (if any) and the metaclasses (i.e. ``type(cls)``) of all specified " @@ -3289,11 +3297,11 @@ msgid "" "that criterion, then the class definition will fail with ``TypeError``." msgstr "" -#: ../../reference/datamodel.rst:2758 +#: ../../reference/datamodel.rst:2756 msgid "Preparing the class namespace" msgstr "" -#: ../../reference/datamodel.rst:2763 +#: ../../reference/datamodel.rst:2761 msgid "" "Once the appropriate metaclass has been identified, then the class namespace " "is prepared. If the metaclass has a ``__prepare__`` attribute, it is called " @@ -3305,25 +3313,25 @@ msgid "" "copied into a new ``dict``." msgstr "" -#: ../../reference/datamodel.rst:2772 +#: ../../reference/datamodel.rst:2770 msgid "" "If the metaclass has no ``__prepare__`` attribute, then the class namespace " "is initialised as an empty ordered mapping." msgstr "" -#: ../../reference/datamodel.rst:2777 +#: ../../reference/datamodel.rst:2775 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/datamodel.rst:2778 +#: ../../reference/datamodel.rst:2776 msgid "Introduced the ``__prepare__`` namespace hook" msgstr "" -#: ../../reference/datamodel.rst:2782 +#: ../../reference/datamodel.rst:2780 msgid "Executing the class body" msgstr "" -#: ../../reference/datamodel.rst:2787 +#: ../../reference/datamodel.rst:2785 msgid "" "The class body is executed (approximately) as ``exec(body, globals(), " "namespace)``. The key difference from a normal call to :func:`exec` is that " @@ -3332,7 +3340,7 @@ msgid "" "inside a function." msgstr "" -#: ../../reference/datamodel.rst:2793 +#: ../../reference/datamodel.rst:2791 msgid "" "However, even when the class definition occurs inside the function, methods " "defined inside the class still cannot see names defined at the class scope. " @@ -3341,11 +3349,11 @@ msgid "" "reference described in the next section." msgstr "" -#: ../../reference/datamodel.rst:2802 +#: ../../reference/datamodel.rst:2800 msgid "Creating the class object" msgstr "" -#: ../../reference/datamodel.rst:2809 +#: ../../reference/datamodel.rst:2807 msgid "" "Once the class namespace has been populated by executing the class body, the " "class object is created by calling ``metaclass(name, bases, namespace, " @@ -3353,18 +3361,18 @@ msgid "" "to ``__prepare__``)." msgstr "" -#: ../../reference/datamodel.rst:2814 +#: ../../reference/datamodel.rst:2812 msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " "created by the compiler if any methods in a class body refer to either " -"``__class__`` or ``super``. This allows the zero argument form of :func:" -"`super` to correctly identify the class being defined based on lexical " -"scoping, while the class or instance that was used to make the current call " -"is identified based on the first argument passed to the method." +"``__class__`` or ``super``. This allows the zero argument form " +"of :func:`super` to correctly identify the class being defined based on " +"lexical scoping, while the class or instance that was used to make the " +"current call is identified based on the first argument passed to the method." msgstr "" -#: ../../reference/datamodel.rst:2824 +#: ../../reference/datamodel.rst:2822 msgid "" "In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass " "as a ``__classcell__`` entry in the class namespace. If present, this must " @@ -3373,39 +3381,39 @@ msgid "" "in Python 3.8." msgstr "" -#: ../../reference/datamodel.rst:2830 +#: ../../reference/datamodel.rst:2828 msgid "" "When using the default metaclass :class:`type`, or any metaclass that " "ultimately calls ``type.__new__``, the following additional customization " "steps are invoked after creating the class object:" msgstr "" -#: ../../reference/datamodel.rst:2834 +#: ../../reference/datamodel.rst:2832 msgid "" "The ``type.__new__`` method collects all of the attributes in the class " "namespace that define a :meth:`~object.__set_name__` method;" msgstr "" -#: ../../reference/datamodel.rst:2836 +#: ../../reference/datamodel.rst:2834 msgid "" "Those ``__set_name__`` methods are called with the class being defined and " "the assigned name of that particular attribute;" msgstr "" -#: ../../reference/datamodel.rst:2838 +#: ../../reference/datamodel.rst:2836 msgid "" "The :meth:`~object.__init_subclass__` hook is called on the immediate parent " "of the new class in its method resolution order." msgstr "" -#: ../../reference/datamodel.rst:2841 +#: ../../reference/datamodel.rst:2839 msgid "" "After the class object is created, it is passed to the class decorators " "included in the class definition (if any) and the resulting object is bound " "in the local namespace as the defined class." msgstr "" -#: ../../reference/datamodel.rst:2845 +#: ../../reference/datamodel.rst:2843 msgid "" "When a new class is created by ``type.__new__``, the object provided as the " "namespace parameter is copied to a new ordered mapping and the original " @@ -3413,19 +3421,19 @@ msgid "" "becomes the :attr:`~type.__dict__` attribute of the class object." msgstr "" -#: ../../reference/datamodel.rst:2852 +#: ../../reference/datamodel.rst:2850 msgid ":pep:`3135` - New super" msgstr "" -#: ../../reference/datamodel.rst:2853 +#: ../../reference/datamodel.rst:2851 msgid "Describes the implicit ``__class__`` closure reference" msgstr "" -#: ../../reference/datamodel.rst:2857 +#: ../../reference/datamodel.rst:2855 msgid "Uses for metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2859 +#: ../../reference/datamodel.rst:2857 msgid "" "The potential uses for metaclasses are boundless. Some ideas that have been " "explored include enum, logging, interface checking, automatic delegation, " @@ -3433,17 +3441,17 @@ msgid "" "locking/synchronization." msgstr "" -#: ../../reference/datamodel.rst:2866 +#: ../../reference/datamodel.rst:2864 msgid "Customizing instance and subclass checks" msgstr "" -#: ../../reference/datamodel.rst:2868 +#: ../../reference/datamodel.rst:2866 msgid "" -"The following methods are used to override the default behavior of the :func:" -"`isinstance` and :func:`issubclass` built-in functions." +"The following methods are used to override the default behavior of " +"the :func:`isinstance` and :func:`issubclass` built-in functions." msgstr "" -#: ../../reference/datamodel.rst:2871 +#: ../../reference/datamodel.rst:2869 msgid "" "In particular, the metaclass :class:`abc.ABCMeta` implements these methods " "in order to allow the addition of Abstract Base Classes (ABCs) as \"virtual " @@ -3451,21 +3459,21 @@ msgid "" "other ABCs." msgstr "" -#: ../../reference/datamodel.rst:2878 +#: ../../reference/datamodel.rst:2876 msgid "" "Return true if *instance* should be considered a (direct or indirect) " "instance of *class*. If defined, called to implement ``isinstance(instance, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2885 +#: ../../reference/datamodel.rst:2883 msgid "" "Return true if *subclass* should be considered a (direct or indirect) " "subclass of *class*. If defined, called to implement ``issubclass(subclass, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2890 +#: ../../reference/datamodel.rst:2888 msgid "" "Note that these methods are looked up on the type (metaclass) of a class. " "They cannot be defined as class methods in the actual class. This is " @@ -3473,24 +3481,24 @@ msgid "" "only in this case the instance is itself a class." msgstr "" -#: ../../reference/datamodel.rst:2897 +#: ../../reference/datamodel.rst:2895 msgid ":pep:`3119` - Introducing Abstract Base Classes" msgstr "" -#: ../../reference/datamodel.rst:2898 +#: ../../reference/datamodel.rst:2896 msgid "" -"Includes the specification for customizing :func:`isinstance` and :func:" -"`issubclass` behavior through :meth:`~type.__instancecheck__` and :meth:" -"`~type.__subclasscheck__`, with motivation for this functionality in the " -"context of adding Abstract Base Classes (see the :mod:`abc` module) to the " -"language." +"Includes the specification for customizing :func:`isinstance` " +"and :func:`issubclass` behavior through :meth:`~type.__instancecheck__` " +"and :meth:`~type.__subclasscheck__`, with motivation for this functionality " +"in the context of adding Abstract Base Classes (see the :mod:`abc` module) " +"to the language." msgstr "" -#: ../../reference/datamodel.rst:2906 +#: ../../reference/datamodel.rst:2904 msgid "Emulating generic types" msgstr "" -#: ../../reference/datamodel.rst:2908 +#: ../../reference/datamodel.rst:2906 msgid "" "When using :term:`type annotations<annotation>`, it is often useful to " "*parameterize* a :term:`generic type` using Python's square-brackets " @@ -3498,74 +3506,75 @@ msgid "" "a :class:`list` in which all the elements are of type :class:`int`." msgstr "" -#: ../../reference/datamodel.rst:2915 +#: ../../reference/datamodel.rst:2913 msgid ":pep:`484` - Type Hints" -msgstr "" +msgstr ":pep:`484` - 型別提示" -#: ../../reference/datamodel.rst:2916 +#: ../../reference/datamodel.rst:2914 msgid "Introducing Python's framework for type annotations" -msgstr "" +msgstr "引入 Python 的型別註釋框架" -#: ../../reference/datamodel.rst:2918 +#: ../../reference/datamodel.rst:2916 msgid ":ref:`Generic Alias Types<types-genericalias>`" msgstr ":ref:`泛型別名型別 <types-genericalias>`" -#: ../../reference/datamodel.rst:2919 +#: ../../reference/datamodel.rst:2917 msgid "Documentation for objects representing parameterized generic classes" msgstr "" -#: ../../reference/datamodel.rst:2921 +#: ../../reference/datamodel.rst:2919 msgid "" -":ref:`Generics`, :ref:`user-defined generics<user-defined-generics>` and :" -"class:`typing.Generic`" +":ref:`Generics`, :ref:`user-defined generics<user-defined-generics>` " +"and :class:`typing.Generic`" msgstr "" -#: ../../reference/datamodel.rst:2922 +#: ../../reference/datamodel.rst:2920 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" -#: ../../reference/datamodel.rst:2925 +#: ../../reference/datamodel.rst:2923 msgid "" "A class can *generally* only be parameterized if it defines the special " "class method ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2930 +#: ../../reference/datamodel.rst:2928 msgid "" "Return an object representing the specialization of a generic class by type " "arguments found in *key*." msgstr "" -#: ../../reference/datamodel.rst:2933 +#: ../../reference/datamodel.rst:2931 msgid "" "When defined on a class, ``__class_getitem__()`` is automatically a class " -"method. As such, there is no need for it to be decorated with :func:" -"`@classmethod<classmethod>` when it is defined." +"method. As such, there is no need for it to be decorated " +"with :func:`@classmethod<classmethod>` when it is defined." msgstr "" -#: ../../reference/datamodel.rst:2939 +#: ../../reference/datamodel.rst:2937 msgid "The purpose of *__class_getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2941 +#: ../../reference/datamodel.rst:2939 msgid "" "The purpose of :meth:`~object.__class_getitem__` is to allow runtime " "parameterization of standard-library generic classes in order to more easily " "apply :term:`type hints<type hint>` to these classes." msgstr "" -#: ../../reference/datamodel.rst:2945 +#: ../../reference/datamodel.rst:2943 msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " -"standard library class that already implements :meth:`~object." -"__class_getitem__`, or inherit from :class:`typing.Generic`, which has its " -"own implementation of ``__class_getitem__()``." +"standard library class that already " +"implements :meth:`~object.__class_getitem__`, or inherit " +"from :class:`typing.Generic`, which has its own implementation of " +"``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2951 +#: ../../reference/datamodel.rst:2949 msgid "" "Custom implementations of :meth:`~object.__class_getitem__` on classes " "defined outside of the standard library may not be understood by third-party " @@ -3573,11 +3582,11 @@ msgid "" "purposes other than type hinting is discouraged." msgstr "" -#: ../../reference/datamodel.rst:2961 +#: ../../reference/datamodel.rst:2959 msgid "*__class_getitem__* versus *__getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2963 +#: ../../reference/datamodel.rst:2961 msgid "" "Usually, the :ref:`subscription<subscriptions>` of an object using square " "brackets will call the :meth:`~object.__getitem__` instance method defined " @@ -3587,14 +3596,15 @@ msgid "" "genericalias>` object if it is properly defined." msgstr "" -#: ../../reference/datamodel.rst:2970 +#: ../../reference/datamodel.rst:2968 msgid "" "Presented with the :term:`expression` ``obj[x]``, the Python interpreter " -"follows something like the following process to decide whether :meth:" -"`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" +"follows something like the following process to decide " +"whether :meth:`~object.__getitem__` or :meth:`~object.__class_getitem__` " +"should be called::" msgstr "" -#: ../../reference/datamodel.rst:2975 +#: ../../reference/datamodel.rst:2973 msgid "" "from inspect import isclass\n" "\n" @@ -3620,17 +3630,17 @@ msgid "" " )" msgstr "" -#: ../../reference/datamodel.rst:2998 +#: ../../reference/datamodel.rst:2996 msgid "" "In Python, all classes are themselves instances of other classes. The class " "of a class is known as that class's :term:`metaclass`, and most classes have " -"the :class:`type` class as their metaclass. :class:`type` does not define :" -"meth:`~object.__getitem__`, meaning that expressions such as ``list[int]``, " -"``dict[str, float]`` and ``tuple[str, bytes]`` all result in :meth:`~object." -"__class_getitem__` being called::" +"the :class:`type` class as their metaclass. :class:`type` does not " +"define :meth:`~object.__getitem__`, meaning that expressions such as " +"``list[int]``, ``dict[str, float]`` and ``tuple[str, bytes]`` all result " +"in :meth:`~object.__class_getitem__` being called::" msgstr "" -#: ../../reference/datamodel.rst:3005 +#: ../../reference/datamodel.rst:3003 msgid "" ">>> # list has class \"type\" as its metaclass, like most classes:\n" ">>> type(list)\n" @@ -3645,14 +3655,15 @@ msgid "" "<class 'types.GenericAlias'>" msgstr "" -#: ../../reference/datamodel.rst:3017 +#: ../../reference/datamodel.rst:3015 msgid "" -"However, if a class has a custom metaclass that defines :meth:`~object." -"__getitem__`, subscribing the class may result in different behaviour. An " -"example of this can be found in the :mod:`enum` module::" +"However, if a class has a custom metaclass that " +"defines :meth:`~object.__getitem__`, subscribing the class may result in " +"different behaviour. An example of this can be found in the :mod:`enum` " +"module::" msgstr "" -#: ../../reference/datamodel.rst:3021 +#: ../../reference/datamodel.rst:3019 msgid "" ">>> from enum import Enum\n" ">>> class Menu(Enum):\n" @@ -3672,70 +3683,70 @@ msgid "" "<enum 'Menu'>" msgstr "" -#: ../../reference/datamodel.rst:3040 +#: ../../reference/datamodel.rst:3038 msgid ":pep:`560` - Core Support for typing module and generic types" msgstr "" -#: ../../reference/datamodel.rst:3041 +#: ../../reference/datamodel.rst:3039 msgid "" -"Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" -"`subscription<subscriptions>` results in ``__class_getitem__()`` being " -"called instead of :meth:`~object.__getitem__`" +"Introducing :meth:`~object.__class_getitem__`, and outlining when " +"a :ref:`subscription<subscriptions>` results in ``__class_getitem__()`` " +"being called instead of :meth:`~object.__getitem__`" msgstr "" -#: ../../reference/datamodel.rst:3049 +#: ../../reference/datamodel.rst:3047 msgid "Emulating callable objects" msgstr "" -#: ../../reference/datamodel.rst:3056 +#: ../../reference/datamodel.rst:3054 msgid "" "Called when the instance is \"called\" as a function; if this method is " "defined, ``x(arg1, arg2, ...)`` roughly translates to ``type(x).__call__(x, " "arg1, ...)``. The :class:`object` class itself does not provide this method." msgstr "" -#: ../../reference/datamodel.rst:3064 +#: ../../reference/datamodel.rst:3062 msgid "Emulating container types" msgstr "" -#: ../../reference/datamodel.rst:3066 +#: ../../reference/datamodel.rst:3064 msgid "" "The following methods can be defined to implement container objects. None of " "them are provided by the :class:`object` class itself. Containers usually " -"are :term:`sequences <sequence>` (such as :class:`lists <list>` or :class:" -"`tuples <tuple>`) or :term:`mappings <mapping>` (like :term:`dictionaries " -"<dictionary>`), but can represent other containers as well. The first set " -"of methods is used either to emulate a sequence or to emulate a mapping; the " -"difference is that for a sequence, the allowable keys should be the integers " -"*k* for which ``0 <= k < N`` where *N* is the length of the sequence, or :" -"class:`slice` objects, which define a range of items. It is also " -"recommended that mappings provide the methods :meth:`!keys`, :meth:`!" -"values`, :meth:`!items`, :meth:`!get`, :meth:`!clear`, :meth:`!setdefault`, :" -"meth:`!pop`, :meth:`!popitem`, :meth:`!copy`, and :meth:`!update` behaving " -"similar to those for Python's standard :class:`dictionary <dict>` objects. " -"The :mod:`collections.abc` module provides a :class:`~collections.abc." -"MutableMapping` :term:`abstract base class` to help create those methods " -"from a base set of :meth:`~object.__getitem__`, :meth:`~object." -"__setitem__`, :meth:`~object.__delitem__`, and :meth:`!keys`. Mutable " -"sequences should provide methods :meth:`!append`, :meth:`!count`, :meth:`!" -"index`, :meth:`!extend`, :meth:`!insert`, :meth:`!pop`, :meth:`!remove`, :" -"meth:`!reverse` and :meth:`!sort`, like Python standard :class:`list` " -"objects. Finally, sequence types should implement addition (meaning " -"concatenation) and multiplication (meaning repetition) by defining the " -"methods :meth:`~object.__add__`, :meth:`~object.__radd__`, :meth:`~object." -"__iadd__`, :meth:`~object.__mul__`, :meth:`~object.__rmul__` and :meth:" -"`~object.__imul__` described below; they should not define other numerical " -"operators. It is recommended that both mappings and sequences implement " -"the :meth:`~object.__contains__` method to allow efficient use of the ``in`` " -"operator; for mappings, ``in`` should search the mapping's keys; for " -"sequences, it should search through the values. It is further recommended " -"that both mappings and sequences implement the :meth:`~object.__iter__` " -"method to allow efficient iteration through the container; for mappings, :" -"meth:`!__iter__` should iterate through the object's keys; for sequences, it " -"should iterate through the values." -msgstr "" - -#: ../../reference/datamodel.rst:3108 +"are :term:`sequences <sequence>` (such as :class:`lists <list>` " +"or :class:`tuples <tuple>`) or :term:`mappings <mapping>` " +"(like :term:`dictionaries <dictionary>`), but can represent other containers " +"as well. The first set of methods is used either to emulate a sequence or " +"to emulate a mapping; the difference is that for a sequence, the allowable " +"keys should be the integers *k* for which ``0 <= k < N`` where *N* is the " +"length of the sequence, or :class:`slice` objects, which define a range of " +"items. It is also recommended that mappings provide the methods :meth:`!" +"keys`, :meth:`!values`, :meth:`!items`, :meth:`!get`, :meth:`!" +"clear`, :meth:`!setdefault`, :meth:`!pop`, :meth:`!popitem`, :meth:`!copy`, " +"and :meth:`!update` behaving similar to those for Python's " +"standard :class:`dictionary <dict>` objects. The :mod:`collections.abc` " +"module provides a :class:`~collections.abc.MutableMapping` :term:`abstract " +"base class` to help create those methods from a base set " +"of :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__`, " +"and :meth:`!keys`. Mutable sequences should provide methods :meth:`!" +"append`, :meth:`!count`, :meth:`!index`, :meth:`!extend`, :meth:`!" +"insert`, :meth:`!pop`, :meth:`!remove`, :meth:`!reverse` and :meth:`!sort`, " +"like Python standard :class:`list` objects. Finally, sequence types should " +"implement addition (meaning concatenation) and multiplication (meaning " +"repetition) by defining the " +"methods :meth:`~object.__add__`, :meth:`~object.__radd__`, :meth:`~object.__iadd__`, :meth:`~object.__mul__`, :meth:`~object.__rmul__` " +"and :meth:`~object.__imul__` described below; they should not define other " +"numerical operators. It is recommended that both mappings and sequences " +"implement the :meth:`~object.__contains__` method to allow efficient use of " +"the ``in`` operator; for mappings, ``in`` should search the mapping's keys; " +"for sequences, it should search through the values. It is further " +"recommended that both mappings and sequences implement " +"the :meth:`~object.__iter__` method to allow efficient iteration through the " +"container; for mappings, :meth:`!__iter__` should iterate through the " +"object's keys; for sequences, it should iterate through the values." +msgstr "" + +#: ../../reference/datamodel.rst:3106 msgid "" "Called to implement the built-in function :func:`len`. Should return the " "length of the object, an integer ``>=`` 0. Also, an object that doesn't " @@ -3743,96 +3754,97 @@ msgid "" "returns zero is considered to be false in a Boolean context." msgstr "" -#: ../../reference/datamodel.rst:3115 +#: ../../reference/datamodel.rst:3113 msgid "" "In CPython, the length is required to be at most :data:`sys.maxsize`. If the " -"length is larger than :data:`!sys.maxsize` some features (such as :func:" -"`len`) may raise :exc:`OverflowError`. To prevent raising :exc:`!" -"OverflowError` by truth value testing, an object must define a :meth:" -"`~object.__bool__` method." +"length is larger than :data:`!sys.maxsize` some features (such " +"as :func:`len`) may raise :exc:`OverflowError`. To prevent raising :exc:`!" +"OverflowError` by truth value testing, an object must define " +"a :meth:`~object.__bool__` method." msgstr "" -#: ../../reference/datamodel.rst:3124 +#: ../../reference/datamodel.rst:3122 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " -"The length must be an integer ``>=`` 0. The return value may also be :data:" -"`NotImplemented`, which is treated the same as if the ``__length_hint__`` " -"method didn't exist at all. This method is purely an optimization and is " -"never required for correctness." +"The length must be an integer ``>=`` 0. The return value may also " +"be :data:`NotImplemented`, which is treated the same as if the " +"``__length_hint__`` method didn't exist at all. This method is purely an " +"optimization and is never required for correctness." msgstr "" -#: ../../reference/datamodel.rst:3138 +#: ../../reference/datamodel.rst:3136 msgid "" "Slicing is done exclusively with the following three methods. A call like ::" msgstr "" -#: ../../reference/datamodel.rst:3140 +#: ../../reference/datamodel.rst:3138 msgid "a[1:2] = b" msgstr "a[1:2] = b" -#: ../../reference/datamodel.rst:3142 +#: ../../reference/datamodel.rst:3140 msgid "is translated to ::" msgstr "" -#: ../../reference/datamodel.rst:3144 +#: ../../reference/datamodel.rst:3142 msgid "a[slice(1, 2, None)] = b" msgstr "a[slice(1, 2, None)] = b" -#: ../../reference/datamodel.rst:3146 +#: ../../reference/datamodel.rst:3144 msgid "and so forth. Missing slice items are always filled in with ``None``." msgstr "" -#: ../../reference/datamodel.rst:3151 +#: ../../reference/datamodel.rst:3149 msgid "" "Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " -"the accepted keys should be integers. Optionally, they may support :class:" -"`slice` objects as well. Negative index support is also optional. If *key* " -"is of an inappropriate type, :exc:`TypeError` may be raised; if *key* is a " -"value outside the set of indexes for the sequence (after any special " -"interpretation of negative values), :exc:`IndexError` should be raised. For :" -"term:`mapping` types, if *key* is missing (not in the container), :exc:" -"`KeyError` should be raised." +"the accepted keys should be integers. Optionally, they may " +"support :class:`slice` objects as well. Negative index support is also " +"optional. If *key* is of an inappropriate type, :exc:`TypeError` may be " +"raised; if *key* is a value outside the set of indexes for the sequence " +"(after any special interpretation of negative values), :exc:`IndexError` " +"should be raised. For :term:`mapping` types, if *key* is missing (not in the " +"container), :exc:`KeyError` should be raised." msgstr "" -#: ../../reference/datamodel.rst:3163 +#: ../../reference/datamodel.rst:3161 msgid "" ":keyword:`for` loops expect that an :exc:`IndexError` will be raised for " "illegal indexes to allow proper detection of the end of the sequence." msgstr "" -#: ../../reference/datamodel.rst:3168 +#: ../../reference/datamodel.rst:3166 msgid "" -"When :ref:`subscripting<subscriptions>` a *class*, the special class method :" -"meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " -"See :ref:`classgetitem-versus-getitem` for more details." +"When :ref:`subscripting<subscriptions>` a *class*, the special class " +"method :meth:`~object.__class_getitem__` may be called instead of " +"``__getitem__()``. See :ref:`classgetitem-versus-getitem` for more details." msgstr "" -#: ../../reference/datamodel.rst:3176 +#: ../../reference/datamodel.rst:3174 msgid "" -"Called to implement assignment to ``self[key]``. Same note as for :meth:" -"`__getitem__`. This should only be implemented for mappings if the objects " -"support changes to the values for keys, or if new keys can be added, or for " -"sequences if elements can be replaced. The same exceptions should be raised " -"for improper *key* values as for the :meth:`__getitem__` method." +"Called to implement assignment to ``self[key]``. Same note as " +"for :meth:`__getitem__`. This should only be implemented for mappings if " +"the objects support changes to the values for keys, or if new keys can be " +"added, or for sequences if elements can be replaced. The same exceptions " +"should be raised for improper *key* values as for the :meth:`__getitem__` " +"method." msgstr "" -#: ../../reference/datamodel.rst:3185 +#: ../../reference/datamodel.rst:3183 msgid "" -"Called to implement deletion of ``self[key]``. Same note as for :meth:" -"`__getitem__`. This should only be implemented for mappings if the objects " -"support removal of keys, or for sequences if elements can be removed from " -"the sequence. The same exceptions should be raised for improper *key* " -"values as for the :meth:`__getitem__` method." +"Called to implement deletion of ``self[key]``. Same note as " +"for :meth:`__getitem__`. This should only be implemented for mappings if " +"the objects support removal of keys, or for sequences if elements can be " +"removed from the sequence. The same exceptions should be raised for " +"improper *key* values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:3194 +#: ../../reference/datamodel.rst:3192 msgid "" "Called by :class:`dict`\\ .\\ :meth:`__getitem__` to implement ``self[key]`` " "for dict subclasses when key is not in the dictionary." msgstr "" -#: ../../reference/datamodel.rst:3200 +#: ../../reference/datamodel.rst:3198 msgid "" "This method is called when an :term:`iterator` is required for a container. " "This method should return a new iterator object that can iterate over all " @@ -3840,23 +3852,23 @@ msgid "" "of the container." msgstr "" -#: ../../reference/datamodel.rst:3208 +#: ../../reference/datamodel.rst:3206 msgid "" "Called (if present) by the :func:`reversed` built-in to implement reverse " "iteration. It should return a new iterator object that iterates over all " "the objects in the container in reverse order." msgstr "" -#: ../../reference/datamodel.rst:3212 +#: ../../reference/datamodel.rst:3210 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " -"built-in will fall back to using the sequence protocol (:meth:`__len__` and :" -"meth:`__getitem__`). Objects that support the sequence protocol should only " -"provide :meth:`__reversed__` if they can provide an implementation that is " -"more efficient than the one provided by :func:`reversed`." +"built-in will fall back to using the sequence protocol (:meth:`__len__` " +"and :meth:`__getitem__`). Objects that support the sequence protocol should " +"only provide :meth:`__reversed__` if they can provide an implementation that " +"is more efficient than the one provided by :func:`reversed`." msgstr "" -#: ../../reference/datamodel.rst:3219 +#: ../../reference/datamodel.rst:3217 msgid "" "The membership test operators (:keyword:`in` and :keyword:`not in`) are " "normally implemented as an iteration through a container. However, container " @@ -3864,14 +3876,14 @@ msgid "" "implementation, which also does not require the object be iterable." msgstr "" -#: ../../reference/datamodel.rst:3226 +#: ../../reference/datamodel.rst:3224 msgid "" "Called to implement membership test operators. Should return true if *item* " "is in *self*, false otherwise. For mapping objects, this should consider " "the keys of the mapping rather than the values or the key-item pairs." msgstr "" -#: ../../reference/datamodel.rst:3230 +#: ../../reference/datamodel.rst:3228 msgid "" "For objects that don't define :meth:`__contains__`, the membership test " "first tries iteration via :meth:`__iter__`, then the old sequence iteration " @@ -3879,11 +3891,11 @@ msgid "" "reference <membership-test-details>`." msgstr "" -#: ../../reference/datamodel.rst:3239 +#: ../../reference/datamodel.rst:3237 msgid "Emulating numeric types" msgstr "" -#: ../../reference/datamodel.rst:3241 +#: ../../reference/datamodel.rst:3239 msgid "" "The following methods can be defined to emulate numeric objects. Methods " "corresponding to operations that are not supported by the particular kind of " @@ -3891,46 +3903,46 @@ msgid "" "should be left undefined." msgstr "" -#: ../../reference/datamodel.rst:3267 +#: ../../reference/datamodel.rst:3265 msgid "" "These methods are called to implement the binary arithmetic operations " -"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" -"`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``). For instance, to " -"evaluate the expression ``x + y``, where *x* is an instance of a class that " -"has an :meth:`__add__` method, ``type(x).__add__(x, y)`` is called. The :" -"meth:`__divmod__` method should be the equivalent to using :meth:" -"`__floordiv__` and :meth:`__mod__`; it should not be related to :meth:" -"`__truediv__`. Note that :meth:`__pow__` should be defined to accept an " -"optional third argument if the ternary version of the built-in :func:`pow` " -"function is to be supported." +"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, " +"``%``, :func:`divmod`, :func:`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|" +"``). For instance, to evaluate the expression ``x + y``, where *x* is an " +"instance of a class that has an :meth:`__add__` method, ``type(x).__add__(x, " +"y)`` is called. The :meth:`__divmod__` method should be the equivalent to " +"using :meth:`__floordiv__` and :meth:`__mod__`; it should not be related " +"to :meth:`__truediv__`. Note that :meth:`__pow__` should be defined to " +"accept an optional third argument if the ternary version of the built-" +"in :func:`pow` function is to be supported." msgstr "" -#: ../../reference/datamodel.rst:3278 +#: ../../reference/datamodel.rst:3276 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return :data:`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3301 +#: ../../reference/datamodel.rst:3299 msgid "" "These methods are called to implement the binary arithmetic operations " -"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" -"`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|``) with reflected (swapped) " -"operands. These functions are only called if the left operand does not " -"support the corresponding operation [#]_ and the operands are of different " -"types. [#]_ For instance, to evaluate the expression ``x - y``, where *y* is " -"an instance of a class that has an :meth:`__rsub__` method, ``type(y)." -"__rsub__(y, x)`` is called if ``type(x).__sub__(x, y)`` returns :data:" -"`NotImplemented`." +"(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, " +"``%``, :func:`divmod`, :func:`pow`, ``**``, ``<<``, ``>>``, ``&``, ``^``, ``|" +"``) with reflected (swapped) operands. These functions are only called if " +"the left operand does not support the corresponding operation [#]_ and the " +"operands are of different types. [#]_ For instance, to evaluate the " +"expression ``x - y``, where *y* is an instance of a class that has " +"an :meth:`__rsub__` method, ``type(y).__rsub__(y, x)`` is called if " +"``type(x).__sub__(x, y)`` returns :data:`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3313 +#: ../../reference/datamodel.rst:3311 msgid "" "Note that ternary :func:`pow` will not try calling :meth:`__rpow__` (the " "coercion rules would become too complicated)." msgstr "" -#: ../../reference/datamodel.rst:3318 +#: ../../reference/datamodel.rst:3316 msgid "" "If the right operand's type is a subclass of the left operand's type and " "that subclass provides a different implementation of the reflected method " @@ -3939,7 +3951,7 @@ msgid "" "ancestors' operations." msgstr "" -#: ../../reference/datamodel.rst:3339 +#: ../../reference/datamodel.rst:3337 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -3948,28 +3960,28 @@ msgid "" "but does not have to be, *self*). If a specific method is not defined, or " "if that method returns :data:`NotImplemented`, the augmented assignment " "falls back to the normal methods. For instance, if *x* is an instance of a " -"class with an :meth:`__iadd__` method, ``x += y`` is equivalent to ``x = x." -"__iadd__(y)`` . If :meth:`__iadd__` does not exist, or if ``x.__iadd__(y)`` " -"returns :data:`!NotImplemented`, ``x.__add__(y)`` and ``y.__radd__(x)`` are " -"considered, as with the evaluation of ``x + y``. In certain situations, " -"augmented assignment can result in unexpected errors (see :ref:`faq-" -"augmented-assignment-tuple-error`), but this behavior is in fact part of the " -"data model." +"class with an :meth:`__iadd__` method, ``x += y`` is equivalent to ``x = " +"x.__iadd__(y)`` . If :meth:`__iadd__` does not exist, or if " +"``x.__iadd__(y)`` returns :data:`!NotImplemented`, ``x.__add__(y)`` and " +"``y.__radd__(x)`` are considered, as with the evaluation of ``x + y``. In " +"certain situations, augmented assignment can result in unexpected errors " +"(see :ref:`faq-augmented-assignment-tuple-error`), but this behavior is in " +"fact part of the data model." msgstr "" -#: ../../reference/datamodel.rst:3362 +#: ../../reference/datamodel.rst:3360 msgid "" -"Called to implement the unary arithmetic operations (``-``, ``+``, :func:" -"`abs` and ``~``)." +"Called to implement the unary arithmetic operations (``-``, " +"``+``, :func:`abs` and ``~``)." msgstr "" -#: ../../reference/datamodel.rst:3375 +#: ../../reference/datamodel.rst:3373 msgid "" -"Called to implement the built-in functions :func:`complex`, :func:`int` and :" -"func:`float`. Should return a value of the appropriate type." +"Called to implement the built-in functions :func:`complex`, :func:`int` " +"and :func:`float`. Should return a value of the appropriate type." msgstr "" -#: ../../reference/datamodel.rst:3382 +#: ../../reference/datamodel.rst:3380 msgid "" "Called to implement :func:`operator.index`, and whenever Python needs to " "losslessly convert the numeric object to an integer object (such as in " @@ -3978,14 +3990,14 @@ msgid "" "integer type. Must return an integer." msgstr "" -#: ../../reference/datamodel.rst:3388 +#: ../../reference/datamodel.rst:3386 msgid "" "If :meth:`__int__`, :meth:`__float__` and :meth:`__complex__` are not " "defined then corresponding built-in functions :func:`int`, :func:`float` " "and :func:`complex` fall back to :meth:`__index__`." msgstr "" -#: ../../reference/datamodel.rst:3400 +#: ../../reference/datamodel.rst:3398 msgid "" "Called to implement the built-in function :func:`round` and :mod:`math` " "functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`. " @@ -3994,21 +4006,21 @@ msgid "" "(typically an :class:`int`)." msgstr "" -#: ../../reference/datamodel.rst:3406 +#: ../../reference/datamodel.rst:3404 msgid "" "The built-in function :func:`int` falls back to :meth:`__trunc__` if " "neither :meth:`__int__` nor :meth:`__index__` is defined." msgstr "" -#: ../../reference/datamodel.rst:3409 +#: ../../reference/datamodel.rst:3407 msgid "The delegation of :func:`int` to :meth:`__trunc__` is deprecated." msgstr "" -#: ../../reference/datamodel.rst:3416 +#: ../../reference/datamodel.rst:3414 msgid "With Statement Context Managers" msgstr "With 陳述式的情境管理器" -#: ../../reference/datamodel.rst:3418 +#: ../../reference/datamodel.rst:3416 msgid "" "A :dfn:`context manager` is an object that defines the runtime context to be " "established when executing a :keyword:`with` statement. The context manager " @@ -4018,34 +4030,34 @@ msgid "" "can also be used by directly invoking their methods." msgstr "" -#: ../../reference/datamodel.rst:3429 +#: ../../reference/datamodel.rst:3427 msgid "" "Typical uses of context managers include saving and restoring various kinds " "of global state, locking and unlocking resources, closing opened files, etc." msgstr "" -#: ../../reference/datamodel.rst:3432 +#: ../../reference/datamodel.rst:3430 msgid "" "For more information on context managers, see :ref:`typecontextmanager`. " "The :class:`object` class itself does not provide the context manager " "methods." msgstr "" -#: ../../reference/datamodel.rst:3438 +#: ../../reference/datamodel.rst:3436 msgid "" "Enter the runtime context related to this object. The :keyword:`with` " "statement will bind this method's return value to the target(s) specified in " "the :keyword:`!as` clause of the statement, if any." msgstr "" -#: ../../reference/datamodel.rst:3445 +#: ../../reference/datamodel.rst:3443 msgid "" "Exit the runtime context related to this object. The parameters describe the " "exception that caused the context to be exited. If the context was exited " "without an exception, all three arguments will be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:3449 +#: ../../reference/datamodel.rst:3447 msgid "" "If an exception is supplied, and the method wishes to suppress the exception " "(i.e., prevent it from being propagated), it should return a true value. " @@ -4053,27 +4065,27 @@ msgid "" "method." msgstr "" -#: ../../reference/datamodel.rst:3453 +#: ../../reference/datamodel.rst:3451 msgid "" "Note that :meth:`~object.__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" -#: ../../reference/datamodel.rst:3459 +#: ../../reference/datamodel.rst:3457 msgid ":pep:`343` - The \"with\" statement" msgstr ":pep:`343` - \"with\" 陳述式" -#: ../../reference/datamodel.rst:3460 +#: ../../reference/datamodel.rst:3458 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3467 +#: ../../reference/datamodel.rst:3465 msgid "Customizing positional arguments in class pattern matching" msgstr "" -#: ../../reference/datamodel.rst:3469 +#: ../../reference/datamodel.rst:3467 msgid "" "When using a class name in a pattern, positional arguments in the pattern " "are not allowed by default, i.e. ``case MyClass(x, y)`` is typically invalid " @@ -4081,7 +4093,7 @@ msgid "" "pattern, the class needs to define a *__match_args__* attribute." msgstr "" -#: ../../reference/datamodel.rst:3476 +#: ../../reference/datamodel.rst:3474 msgid "" "This class variable can be assigned a tuple of strings. When this class is " "used in a class pattern with positional arguments, each positional argument " @@ -4090,29 +4102,29 @@ msgid "" "to setting it to ``()``." msgstr "" -#: ../../reference/datamodel.rst:3482 +#: ../../reference/datamodel.rst:3480 msgid "" "For example, if ``MyClass.__match_args__`` is ``(\"left\", \"center\", " "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " "MyClass(left=x, center=y)``. Note that the number of arguments in the " "pattern must be smaller than or equal to the number of elements in " -"*__match_args__*; if it is larger, the pattern match attempt will raise a :" -"exc:`TypeError`." +"*__match_args__*; if it is larger, the pattern match attempt will raise " +"a :exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:3492 +#: ../../reference/datamodel.rst:3490 msgid ":pep:`634` - Structural Pattern Matching" msgstr "" -#: ../../reference/datamodel.rst:3493 +#: ../../reference/datamodel.rst:3491 msgid "The specification for the Python ``match`` statement." msgstr "" -#: ../../reference/datamodel.rst:3499 +#: ../../reference/datamodel.rst:3497 msgid "Emulating buffer types" msgstr "" -#: ../../reference/datamodel.rst:3501 +#: ../../reference/datamodel.rst:3499 msgid "" "The :ref:`buffer protocol <bufferobjects>` provides a way for Python objects " "to expose efficient access to a low-level memory array. This protocol is " @@ -4120,53 +4132,54 @@ msgid "" "and third-party libraries may define additional buffer types." msgstr "" -#: ../../reference/datamodel.rst:3506 +#: ../../reference/datamodel.rst:3504 msgid "" "While buffer types are usually implemented in C, it is also possible to " "implement the protocol in Python." msgstr "" -#: ../../reference/datamodel.rst:3511 +#: ../../reference/datamodel.rst:3509 msgid "" -"Called when a buffer is requested from *self* (for example, by the :class:" -"`memoryview` constructor). The *flags* argument is an integer representing " -"the kind of buffer requested, affecting for example whether the returned " -"buffer is read-only or writable. :class:`inspect.BufferFlags` provides a " -"convenient way to interpret the flags. The method must return a :class:" -"`memoryview` object." +"Called when a buffer is requested from *self* (for example, by " +"the :class:`memoryview` constructor). The *flags* argument is an integer " +"representing the kind of buffer requested, affecting for example whether the " +"returned buffer is read-only or writable. :class:`inspect.BufferFlags` " +"provides a convenient way to interpret the flags. The method must return " +"a :class:`memoryview` object." msgstr "" -#: ../../reference/datamodel.rst:3520 +#: ../../reference/datamodel.rst:3518 msgid "" -"Called when a buffer is no longer needed. The *buffer* argument is a :class:" -"`memoryview` object that was previously returned by :meth:`~object." -"__buffer__`. The method must release any resources associated with the " -"buffer. This method should return ``None``. Buffer objects that do not need " -"to perform any cleanup are not required to implement this method." +"Called when a buffer is no longer needed. The *buffer* argument is " +"a :class:`memoryview` object that was previously returned " +"by :meth:`~object.__buffer__`. The method must release any resources " +"associated with the buffer. This method should return ``None``. Buffer " +"objects that do not need to perform any cleanup are not required to " +"implement this method." msgstr "" -#: ../../reference/datamodel.rst:3531 +#: ../../reference/datamodel.rst:3529 msgid ":pep:`688` - Making the buffer protocol accessible in Python" msgstr "" -#: ../../reference/datamodel.rst:3532 +#: ../../reference/datamodel.rst:3530 msgid "" "Introduces the Python ``__buffer__`` and ``__release_buffer__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3534 +#: ../../reference/datamodel.rst:3532 msgid ":class:`collections.abc.Buffer`" msgstr ":class:`collections.abc.Buffer`" -#: ../../reference/datamodel.rst:3535 +#: ../../reference/datamodel.rst:3533 msgid "ABC for buffer types." msgstr "" -#: ../../reference/datamodel.rst:3540 +#: ../../reference/datamodel.rst:3538 msgid "Special method lookup" msgstr "" -#: ../../reference/datamodel.rst:3542 +#: ../../reference/datamodel.rst:3540 msgid "" "For custom classes, implicit invocations of special methods are only " "guaranteed to work correctly if defined on an object's type, not in the " @@ -4174,7 +4187,7 @@ msgid "" "following code raises an exception::" msgstr "" -#: ../../reference/datamodel.rst:3547 +#: ../../reference/datamodel.rst:3545 msgid "" ">>> class C:\n" "... pass\n" @@ -4196,7 +4209,7 @@ msgstr "" " File \"<stdin>\", line 1, in <module>\n" "TypeError: object of type 'C' has no len()" -#: ../../reference/datamodel.rst:3557 +#: ../../reference/datamodel.rst:3555 msgid "" "The rationale behind this behaviour lies with a number of special methods " "such as :meth:`~object.__hash__` and :meth:`~object.__repr__` that are " @@ -4205,7 +4218,7 @@ msgid "" "invoked on the type object itself::" msgstr "" -#: ../../reference/datamodel.rst:3564 +#: ../../reference/datamodel.rst:3562 msgid "" ">>> 1 .__hash__() == hash(1)\n" "True\n" @@ -4221,14 +4234,14 @@ msgstr "" " File \"<stdin>\", line 1, in <module>\n" "TypeError: descriptor '__hash__' of 'int' object needs an argument" -#: ../../reference/datamodel.rst:3571 +#: ../../reference/datamodel.rst:3569 msgid "" "Incorrectly attempting to invoke an unbound method of a class in this way is " "sometimes referred to as 'metaclass confusion', and is avoided by bypassing " "the instance when looking up special methods::" msgstr "" -#: ../../reference/datamodel.rst:3575 +#: ../../reference/datamodel.rst:3573 msgid "" ">>> type(1).__hash__(1) == hash(1)\n" "True\n" @@ -4240,14 +4253,14 @@ msgstr "" ">>> type(int).__hash__(int) == hash(int)\n" "True" -#: ../../reference/datamodel.rst:3580 +#: ../../reference/datamodel.rst:3578 msgid "" "In addition to bypassing any instance attributes in the interest of " -"correctness, implicit special method lookup generally also bypasses the :" -"meth:`~object.__getattribute__` method even of the object's metaclass::" +"correctness, implicit special method lookup generally also bypasses " +"the :meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" -#: ../../reference/datamodel.rst:3584 +#: ../../reference/datamodel.rst:3582 msgid "" ">>> class Meta(type):\n" "... def __getattribute__(*args):\n" @@ -4272,7 +4285,7 @@ msgid "" "10" msgstr "" -#: ../../reference/datamodel.rst:3606 +#: ../../reference/datamodel.rst:3604 msgid "" "Bypassing the :meth:`~object.__getattribute__` machinery in this fashion " "provides significant scope for speed optimisations within the interpreter, " @@ -4281,103 +4294,106 @@ msgid "" "consistently invoked by the interpreter)." msgstr "" -#: ../../reference/datamodel.rst:3617 +#: ../../reference/datamodel.rst:3615 msgid "Coroutines" msgstr "協程" -#: ../../reference/datamodel.rst:3621 +#: ../../reference/datamodel.rst:3619 msgid "Awaitable Objects" msgstr "" -#: ../../reference/datamodel.rst:3623 +#: ../../reference/datamodel.rst:3621 msgid "" -"An :term:`awaitable` object generally implements an :meth:`~object." -"__await__` method. :term:`Coroutine objects <coroutine>` returned from :" -"keyword:`async def` functions are awaitable." +"An :term:`awaitable` object generally implements " +"an :meth:`~object.__await__` method. :term:`Coroutine objects <coroutine>` " +"returned from :keyword:`async def` functions are awaitable." msgstr "" -#: ../../reference/datamodel.rst:3629 +#: ../../reference/datamodel.rst:3627 msgid "" "The :term:`generator iterator` objects returned from generators decorated " -"with :func:`types.coroutine` are also awaitable, but they do not implement :" -"meth:`~object.__await__`." +"with :func:`types.coroutine` are also awaitable, but they do not " +"implement :meth:`~object.__await__`." msgstr "" -#: ../../reference/datamodel.rst:3635 +#: ../../reference/datamodel.rst:3633 msgid "" -"Must return an :term:`iterator`. Should be used to implement :term:" -"`awaitable` objects. For instance, :class:`asyncio.Future` implements this " -"method to be compatible with the :keyword:`await` expression. The :class:" -"`object` class itself is not awaitable and does not provide this method." +"Must return an :term:`iterator`. Should be used to " +"implement :term:`awaitable` objects. For instance, :class:`asyncio.Future` " +"implements this method to be compatible with the :keyword:`await` " +"expression. The :class:`object` class itself is not awaitable and does not " +"provide this method." msgstr "" -#: ../../reference/datamodel.rst:3643 +#: ../../reference/datamodel.rst:3641 msgid "" "The language doesn't place any restriction on the type or value of the " "objects yielded by the iterator returned by ``__await__``, as this is " -"specific to the implementation of the asynchronous execution framework (e." -"g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." +"specific to the implementation of the asynchronous execution framework " +"(e.g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." msgstr "" -#: ../../reference/datamodel.rst:3651 +#: ../../reference/datamodel.rst:3649 msgid ":pep:`492` for additional information about awaitable objects." msgstr "" -#: ../../reference/datamodel.rst:3657 +#: ../../reference/datamodel.rst:3655 msgid "Coroutine Objects" msgstr "協程物件" -#: ../../reference/datamodel.rst:3659 +#: ../../reference/datamodel.rst:3657 msgid "" ":term:`Coroutine objects <coroutine>` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`~object.__await__` " "and iterating over the result. When the coroutine has finished executing " -"and returns, the iterator raises :exc:`StopIteration`, and the exception's :" -"attr:`~StopIteration.value` attribute holds the return value. If the " -"coroutine raises an exception, it is propagated by the iterator. Coroutines " -"should not directly raise unhandled :exc:`StopIteration` exceptions." +"and returns, the iterator raises :exc:`StopIteration`, and the " +"exception's :attr:`~StopIteration.value` attribute holds the return value. " +"If the coroutine raises an exception, it is propagated by the iterator. " +"Coroutines should not directly raise unhandled :exc:`StopIteration` " +"exceptions." msgstr "" -#: ../../reference/datamodel.rst:3667 +#: ../../reference/datamodel.rst:3665 msgid "" "Coroutines also have the methods listed below, which are analogous to those " "of generators (see :ref:`generator-methods`). However, unlike generators, " "coroutines do not directly support iteration." msgstr "" -#: ../../reference/datamodel.rst:3671 +#: ../../reference/datamodel.rst:3669 msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" -#: ../../reference/datamodel.rst:3677 +#: ../../reference/datamodel.rst:3675 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " -"is equivalent to advancing the iterator returned by :meth:`~object." -"__await__`. If *value* is not ``None``, this method delegates to the :meth:" -"`~generator.send` method of the iterator that caused the coroutine to " -"suspend. The result (return value, :exc:`StopIteration`, or other " -"exception) is the same as when iterating over the :meth:`!__await__` return " -"value, described above." +"is equivalent to advancing the iterator returned " +"by :meth:`~object.__await__`. If *value* is not ``None``, this method " +"delegates to the :meth:`~generator.send` method of the iterator that caused " +"the coroutine to suspend. The result (return value, :exc:`StopIteration`, " +"or other exception) is the same as when iterating over the :meth:`!" +"__await__` return value, described above." msgstr "" -#: ../../reference/datamodel.rst:3688 +#: ../../reference/datamodel.rst:3686 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " "coroutine to suspend, if it has such a method. Otherwise, the exception is " -"raised at the suspension point. The result (return value, :exc:" -"`StopIteration`, or other exception) is the same as when iterating over the :" -"meth:`~object.__await__` return value, described above. If the exception is " -"not caught in the coroutine, it propagates back to the caller." +"raised at the suspension point. The result (return " +"value, :exc:`StopIteration`, or other exception) is the same as when " +"iterating over the :meth:`~object.__await__` return value, described above. " +"If the exception is not caught in the coroutine, it propagates back to the " +"caller." msgstr "" -#: ../../reference/datamodel.rst:3699 +#: ../../reference/datamodel.rst:3697 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" -#: ../../reference/datamodel.rst:3704 +#: ../../reference/datamodel.rst:3702 msgid "" "Causes the coroutine to clean itself up and exit. If the coroutine is " "suspended, this method first delegates to the :meth:`~generator.close` " @@ -4387,46 +4403,46 @@ msgid "" "is marked as having finished executing, even if it was never started." msgstr "" -#: ../../reference/datamodel.rst:3712 +#: ../../reference/datamodel.rst:3710 msgid "" "Coroutine objects are automatically closed using the above process when they " "are about to be destroyed." msgstr "" -#: ../../reference/datamodel.rst:3718 +#: ../../reference/datamodel.rst:3716 msgid "Asynchronous Iterators" msgstr "" -#: ../../reference/datamodel.rst:3720 +#: ../../reference/datamodel.rst:3718 msgid "" "An *asynchronous iterator* can call asynchronous code in its ``__anext__`` " "method." msgstr "" -#: ../../reference/datamodel.rst:3723 +#: ../../reference/datamodel.rst:3721 msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "" -#: ../../reference/datamodel.rst:3725 ../../reference/datamodel.rst:3774 +#: ../../reference/datamodel.rst:3723 ../../reference/datamodel.rst:3772 msgid "The :class:`object` class itself does not provide these methods." msgstr "" -#: ../../reference/datamodel.rst:3730 +#: ../../reference/datamodel.rst:3728 msgid "Must return an *asynchronous iterator* object." msgstr "" -#: ../../reference/datamodel.rst:3734 +#: ../../reference/datamodel.rst:3732 msgid "" "Must return an *awaitable* resulting in a next value of the iterator. " "Should raise a :exc:`StopAsyncIteration` error when the iteration is over." msgstr "" -#: ../../reference/datamodel.rst:3737 +#: ../../reference/datamodel.rst:3735 msgid "An example of an asynchronous iterable object::" msgstr "" -#: ../../reference/datamodel.rst:3739 +#: ../../reference/datamodel.rst:3737 msgid "" "class Reader:\n" " async def readline(self):\n" @@ -4454,53 +4470,53 @@ msgstr "" " raise StopAsyncIteration\n" " return val" -#: ../../reference/datamodel.rst:3754 +#: ../../reference/datamodel.rst:3752 msgid "" "Prior to Python 3.7, :meth:`~object.__aiter__` could return an *awaitable* " "that would resolve to an :term:`asynchronous iterator <asynchronous " "iterator>`." msgstr "" -#: ../../reference/datamodel.rst:3759 +#: ../../reference/datamodel.rst:3757 msgid "" "Starting with Python 3.7, :meth:`~object.__aiter__` must return an " -"asynchronous iterator object. Returning anything else will result in a :exc:" -"`TypeError` error." +"asynchronous iterator object. Returning anything else will result in " +"a :exc:`TypeError` error." msgstr "" -#: ../../reference/datamodel.rst:3767 +#: ../../reference/datamodel.rst:3765 msgid "Asynchronous Context Managers" msgstr "" -#: ../../reference/datamodel.rst:3769 +#: ../../reference/datamodel.rst:3767 msgid "" "An *asynchronous context manager* is a *context manager* that is able to " "suspend execution in its ``__aenter__`` and ``__aexit__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3772 +#: ../../reference/datamodel.rst:3770 msgid "" "Asynchronous context managers can be used in an :keyword:`async with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3778 +#: ../../reference/datamodel.rst:3776 msgid "" "Semantically similar to :meth:`~object.__enter__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3783 +#: ../../reference/datamodel.rst:3781 msgid "" "Semantically similar to :meth:`~object.__exit__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3786 +#: ../../reference/datamodel.rst:3784 msgid "An example of an asynchronous context manager class::" msgstr "" -#: ../../reference/datamodel.rst:3788 +#: ../../reference/datamodel.rst:3786 msgid "" "class AsyncContextManager:\n" " async def __aenter__(self):\n" @@ -4516,27 +4532,26 @@ msgstr "" " async def __aexit__(self, exc_type, exc, tb):\n" " await log('exiting context')" -#: ../../reference/datamodel.rst:3799 +#: ../../reference/datamodel.rst:3797 msgid "Footnotes" msgstr "註解" -#: ../../reference/datamodel.rst:3800 +#: ../../reference/datamodel.rst:3798 msgid "" "It *is* possible in some cases to change an object's type, under certain " "controlled conditions. It generally isn't a good idea though, since it can " "lead to some very strange behaviour if it is handled incorrectly." msgstr "" -#: ../../reference/datamodel.rst:3804 +#: ../../reference/datamodel.rst:3802 msgid "" -"The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." -"__reversed__`, :meth:`~object.__contains__`, :meth:`~object." -"__class_getitem__` and :meth:`~os.PathLike.__fspath__` methods have special " -"handling for this. Others will still raise a :exc:`TypeError`, but may do so " -"by relying on the behavior that ``None`` is not callable." +"The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object.__reversed__`, :meth:`~object.__contains__`, :meth:`~object.__class_getitem__` " +"and :meth:`~os.PathLike.__fspath__` methods have special handling for this. " +"Others will still raise a :exc:`TypeError`, but may do so by relying on the " +"behavior that ``None`` is not callable." msgstr "" -#: ../../reference/datamodel.rst:3811 +#: ../../reference/datamodel.rst:3809 msgid "" "\"Does not support\" here means that the class has no such method, or the " "method returns :data:`NotImplemented`. Do not set the method to ``None`` if " @@ -4544,7 +4559,7 @@ msgid "" "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" -#: ../../reference/datamodel.rst:3817 +#: ../../reference/datamodel.rst:3815 msgid "" "For operands of the same type, it is assumed that if the non-reflected " "method -- such as :meth:`~object.__add__` -- fails then the overall " @@ -4566,8 +4581,8 @@ msgstr "" #: ../../reference/datamodel.rst:859 ../../reference/datamodel.rst:1126 #: ../../reference/datamodel.rst:1265 ../../reference/datamodel.rst:1292 #: ../../reference/datamodel.rst:1364 ../../reference/datamodel.rst:1472 -#: ../../reference/datamodel.rst:1581 ../../reference/datamodel.rst:1691 -#: ../../reference/datamodel.rst:2116 ../../reference/datamodel.rst:3134 +#: ../../reference/datamodel.rst:1579 ../../reference/datamodel.rst:1689 +#: ../../reference/datamodel.rst:2114 ../../reference/datamodel.rst:3132 msgid "object" msgstr "object(物件)" @@ -4578,13 +4593,13 @@ msgstr "data(資料)" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:296 #: ../../reference/datamodel.rst:343 ../../reference/datamodel.rst:427 #: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:799 -#: ../../reference/datamodel.rst:1321 ../../reference/datamodel.rst:1774 -#: ../../reference/datamodel.rst:2017 ../../reference/datamodel.rst:2023 -#: ../../reference/datamodel.rst:2116 ../../reference/datamodel.rst:2673 -#: ../../reference/datamodel.rst:3104 ../../reference/datamodel.rst:3262 -#: ../../reference/datamodel.rst:3297 ../../reference/datamodel.rst:3311 -#: ../../reference/datamodel.rst:3360 ../../reference/datamodel.rst:3370 -#: ../../reference/datamodel.rst:3398 +#: ../../reference/datamodel.rst:1321 ../../reference/datamodel.rst:1772 +#: ../../reference/datamodel.rst:2015 ../../reference/datamodel.rst:2021 +#: ../../reference/datamodel.rst:2114 ../../reference/datamodel.rst:2671 +#: ../../reference/datamodel.rst:3102 ../../reference/datamodel.rst:3260 +#: ../../reference/datamodel.rst:3295 ../../reference/datamodel.rst:3309 +#: ../../reference/datamodel.rst:3358 ../../reference/datamodel.rst:3368 +#: ../../reference/datamodel.rst:3396 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -4593,7 +4608,7 @@ msgid "id" msgstr "id" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:126 -#: ../../reference/datamodel.rst:2673 +#: ../../reference/datamodel.rst:2671 msgid "type" msgstr "type(型別)" @@ -4717,12 +4732,12 @@ msgstr "number(數字)" msgid "Java" msgstr "Java" -#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3370 +#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3368 msgid "complex" msgstr "complex(複數)" #: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:427 -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:3104 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:3102 msgid "len" msgstr "len" @@ -4755,8 +4770,8 @@ msgstr "immutable sequence(不可變序列)" msgid "immutable" msgstr "immutable(不可變)" -#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1992 -#: ../../reference/datamodel.rst:2023 +#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1990 +#: ../../reference/datamodel.rst:2021 msgid "string" msgstr "string(字串)" @@ -4792,7 +4807,7 @@ msgstr "singleton(單例)" msgid "empty" msgstr "empty(空的)" -#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:2017 +#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:2015 msgid "bytes" msgstr "bytes(位元組)" @@ -4814,8 +4829,8 @@ msgid "assignment" msgstr "assignment(賦值)" #: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:859 -#: ../../reference/datamodel.rst:1728 ../../reference/datamodel.rst:1910 -#: ../../reference/datamodel.rst:3425 +#: ../../reference/datamodel.rst:1726 ../../reference/datamodel.rst:1908 +#: ../../reference/datamodel.rst:3423 msgid "statement" msgstr "statement(陳述式)" @@ -4852,7 +4867,7 @@ msgid "mapping" msgstr "mapping(對映)" #: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:1126 -#: ../../reference/datamodel.rst:2116 +#: ../../reference/datamodel.rst:2114 msgid "dictionary" msgstr "dictionary(字典)" @@ -4875,7 +4890,7 @@ msgid "function" msgstr "function (函式)" #: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:1126 -#: ../../reference/datamodel.rst:1149 ../../reference/datamodel.rst:3054 +#: ../../reference/datamodel.rst:1149 ../../reference/datamodel.rst:3052 msgid "call" msgstr "call(呼叫)" @@ -4983,7 +4998,7 @@ msgstr "generator(產生器)" msgid "iterator" msgstr "itorator(疊代器)" -#: ../../reference/datamodel.rst:761 ../../reference/datamodel.rst:3613 +#: ../../reference/datamodel.rst:761 ../../reference/datamodel.rst:3611 msgid "coroutine" msgstr "coroutine(協程)" @@ -5048,8 +5063,8 @@ msgid "__dict__ (module attribute)" msgstr "__dict__ (模組屬性)" #: ../../reference/datamodel.rst:1126 ../../reference/datamodel.rst:1144 -#: ../../reference/datamodel.rst:1265 ../../reference/datamodel.rst:1893 -#: ../../reference/datamodel.rst:2784 +#: ../../reference/datamodel.rst:1265 ../../reference/datamodel.rst:1891 +#: ../../reference/datamodel.rst:2782 msgid "class" msgstr "class(類別)" @@ -5059,7 +5074,7 @@ msgid "class instance" msgstr "class instance(類別實例)" #: ../../reference/datamodel.rst:1126 ../../reference/datamodel.rst:1265 -#: ../../reference/datamodel.rst:3054 +#: ../../reference/datamodel.rst:3052 msgid "instance" msgstr "instance(實例)" @@ -5243,291 +5258,291 @@ msgstr "co_freevars (程式碼物件屬性)" msgid "co_qualname (code object attribute)" msgstr "co_qualname (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1490 +#: ../../reference/datamodel.rst:1488 msgid "documentation string" msgstr "documentation string(文件字串)" -#: ../../reference/datamodel.rst:1581 +#: ../../reference/datamodel.rst:1579 msgid "frame" msgstr "frame" -#: ../../reference/datamodel.rst:1587 +#: ../../reference/datamodel.rst:1585 msgid "f_back (frame attribute)" msgstr "f_back (frame 屬性)" -#: ../../reference/datamodel.rst:1587 +#: ../../reference/datamodel.rst:1585 msgid "f_code (frame attribute)" msgstr "f_code (frame 屬性)" -#: ../../reference/datamodel.rst:1587 +#: ../../reference/datamodel.rst:1585 msgid "f_globals (frame attribute)" msgstr "f_globals (frame 屬性)" -#: ../../reference/datamodel.rst:1587 +#: ../../reference/datamodel.rst:1585 msgid "f_locals (frame attribute)" msgstr "f_locals (frame 屬性)" -#: ../../reference/datamodel.rst:1587 +#: ../../reference/datamodel.rst:1585 msgid "f_lasti (frame attribute)" msgstr "f_lasti (frame 屬性)" -#: ../../reference/datamodel.rst:1587 +#: ../../reference/datamodel.rst:1585 msgid "f_builtins (frame attribute)" msgstr "f_builtins (frame 屬性)" -#: ../../reference/datamodel.rst:1631 +#: ../../reference/datamodel.rst:1629 msgid "f_trace (frame attribute)" msgstr "f_trace (frame 屬性)" -#: ../../reference/datamodel.rst:1631 +#: ../../reference/datamodel.rst:1629 msgid "f_trace_lines (frame attribute)" msgstr "f_trace_lines (frame 屬性)" -#: ../../reference/datamodel.rst:1631 +#: ../../reference/datamodel.rst:1629 msgid "f_trace_opcodes (frame attribute)" msgstr "f_trace_opcodes (frame 屬性)" -#: ../../reference/datamodel.rst:1631 +#: ../../reference/datamodel.rst:1629 msgid "f_lineno (frame attribute)" msgstr "f_lineno (frame 屬性)" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "traceback" msgstr "traceback" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "stack" msgstr "stack(堆疊)" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "trace" msgstr "trace(追蹤)" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "exception" msgstr "exception(例外)" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "handler" msgstr "handler(處理器)" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "execution" msgstr "execution(執行)" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "exc_info (in module sys)" msgstr "exc_info (sys 模組中)" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "last_traceback (in module sys)" msgstr "last_traceback (sys 模組中)" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "sys.exc_info" msgstr "sys.exc_info" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "sys.exception" msgstr "sys.exception" -#: ../../reference/datamodel.rst:1691 +#: ../../reference/datamodel.rst:1689 msgid "sys.last_traceback" msgstr "sys.last_traceback" -#: ../../reference/datamodel.rst:1728 +#: ../../reference/datamodel.rst:1726 msgid "tb_frame (traceback attribute)" msgstr "tb_frame (traceback 屬性)" -#: ../../reference/datamodel.rst:1728 +#: ../../reference/datamodel.rst:1726 msgid "tb_lineno (traceback attribute)" msgstr "tb_lineno (traceback 屬性)" -#: ../../reference/datamodel.rst:1728 +#: ../../reference/datamodel.rst:1726 msgid "tb_lasti (traceback attribute)" msgstr "tb_lasti (traceback 屬性)" -#: ../../reference/datamodel.rst:1728 +#: ../../reference/datamodel.rst:1726 msgid "try" msgstr "try" -#: ../../reference/datamodel.rst:1758 +#: ../../reference/datamodel.rst:1756 msgid "tb_next (traceback attribute)" msgstr "tb_next (traceback 屬性)" -#: ../../reference/datamodel.rst:1774 ../../reference/datamodel.rst:3134 +#: ../../reference/datamodel.rst:1772 ../../reference/datamodel.rst:3132 msgid "slice" msgstr "slice(切片)" -#: ../../reference/datamodel.rst:1780 +#: ../../reference/datamodel.rst:1778 msgid "start (slice object attribute)" msgstr "start (slice 物件屬性)" -#: ../../reference/datamodel.rst:1780 +#: ../../reference/datamodel.rst:1778 msgid "stop (slice object attribute)" msgstr "stop (slice 物件屬性)" -#: ../../reference/datamodel.rst:1780 +#: ../../reference/datamodel.rst:1778 msgid "step (slice object attribute)" msgstr "step (slice 物件屬性)" -#: ../../reference/datamodel.rst:1828 +#: ../../reference/datamodel.rst:1826 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/datamodel.rst:1828 +#: ../../reference/datamodel.rst:1826 msgid "overloading" msgstr "overloading(多載)" -#: ../../reference/datamodel.rst:1828 +#: ../../reference/datamodel.rst:1826 msgid "__getitem__() (mapping object method)" msgstr "__getitem__() (對映物件方法)" -#: ../../reference/datamodel.rst:1864 +#: ../../reference/datamodel.rst:1862 msgid "subclassing" msgstr "subclassing(子類別化)" -#: ../../reference/datamodel.rst:1864 +#: ../../reference/datamodel.rst:1862 msgid "immutable types" msgstr "immutable types(不可變型別)" -#: ../../reference/datamodel.rst:1893 +#: ../../reference/datamodel.rst:1891 msgid "constructor" msgstr "constructor(建構函式)" -#: ../../reference/datamodel.rst:1910 +#: ../../reference/datamodel.rst:1908 msgid "destructor" msgstr "destructor(解構函式)" -#: ../../reference/datamodel.rst:1910 +#: ../../reference/datamodel.rst:1908 msgid "finalizer" msgstr "finalizer(終結函式)" -#: ../../reference/datamodel.rst:1910 +#: ../../reference/datamodel.rst:1908 msgid "del" msgstr "del" -#: ../../reference/datamodel.rst:1974 +#: ../../reference/datamodel.rst:1972 msgid "repr() (built-in function)" msgstr "repr() (內建函式)" -#: ../../reference/datamodel.rst:1974 +#: ../../reference/datamodel.rst:1972 msgid "__repr__() (object method)" msgstr "__repr__() (物件方法)" -#: ../../reference/datamodel.rst:1992 +#: ../../reference/datamodel.rst:1990 msgid "__str__() (object method)" msgstr "__str__() (物件方法)" -#: ../../reference/datamodel.rst:1992 +#: ../../reference/datamodel.rst:1990 msgid "format() (built-in function)" msgstr "format() (內建函式)" -#: ../../reference/datamodel.rst:1992 +#: ../../reference/datamodel.rst:1990 msgid "print() (built-in function)" msgstr "print() (內建函式)" -#: ../../reference/datamodel.rst:2023 +#: ../../reference/datamodel.rst:2021 msgid "__format__() (object method)" msgstr "__format__() (物件方法)" -#: ../../reference/datamodel.rst:2023 +#: ../../reference/datamodel.rst:2021 msgid "conversion" msgstr "conversion" -#: ../../reference/datamodel.rst:2023 +#: ../../reference/datamodel.rst:2021 msgid "print" msgstr "print" -#: ../../reference/datamodel.rst:2065 +#: ../../reference/datamodel.rst:2063 msgid "comparisons" msgstr "comparison(比較)" -#: ../../reference/datamodel.rst:2116 +#: ../../reference/datamodel.rst:2114 msgid "hash" msgstr "hash(雜湊)" -#: ../../reference/datamodel.rst:2197 +#: ../../reference/datamodel.rst:2195 msgid "__len__() (mapping object method)" msgstr "__len__() (對映物件方法)" -#: ../../reference/datamodel.rst:2302 +#: ../../reference/datamodel.rst:2300 msgid "__getattr__ (module attribute)" msgstr "__getattr__ (模組屬性)" -#: ../../reference/datamodel.rst:2302 +#: ../../reference/datamodel.rst:2300 msgid "__dir__ (module attribute)" msgstr "__dir__ (模組屬性)" -#: ../../reference/datamodel.rst:2302 +#: ../../reference/datamodel.rst:2300 msgid "__class__ (module attribute)" msgstr "__class__ (模組屬性)" -#: ../../reference/datamodel.rst:2673 +#: ../../reference/datamodel.rst:2671 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../reference/datamodel.rst:2673 +#: ../../reference/datamodel.rst:2671 msgid "= (equals)" -msgstr "= (等於)" +msgstr "= (等號)" -#: ../../reference/datamodel.rst:2673 +#: ../../reference/datamodel.rst:2671 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/datamodel.rst:2737 +#: ../../reference/datamodel.rst:2735 msgid "metaclass hint" msgstr "metaclass hint(元類別提示)" -#: ../../reference/datamodel.rst:2760 +#: ../../reference/datamodel.rst:2758 msgid "__prepare__ (metaclass method)" msgstr "__prepare__ (元類別方法)" -#: ../../reference/datamodel.rst:2784 +#: ../../reference/datamodel.rst:2782 msgid "body" msgstr "body" -#: ../../reference/datamodel.rst:2804 +#: ../../reference/datamodel.rst:2802 msgid "__class__ (method cell)" msgstr "__class__ (方法 cell)" -#: ../../reference/datamodel.rst:2804 +#: ../../reference/datamodel.rst:2802 msgid "__classcell__ (class namespace entry)" msgstr "__classcell__ (類別命名空間項目)" -#: ../../reference/datamodel.rst:3104 +#: ../../reference/datamodel.rst:3102 msgid "__bool__() (object method)" msgstr "__bool__() (物件方法)" -#: ../../reference/datamodel.rst:3262 ../../reference/datamodel.rst:3297 +#: ../../reference/datamodel.rst:3260 ../../reference/datamodel.rst:3295 msgid "divmod" msgstr "divmod" -#: ../../reference/datamodel.rst:3262 ../../reference/datamodel.rst:3297 -#: ../../reference/datamodel.rst:3311 +#: ../../reference/datamodel.rst:3260 ../../reference/datamodel.rst:3295 +#: ../../reference/datamodel.rst:3309 msgid "pow" msgstr "pow" -#: ../../reference/datamodel.rst:3360 +#: ../../reference/datamodel.rst:3358 msgid "abs" msgstr "abs" -#: ../../reference/datamodel.rst:3370 +#: ../../reference/datamodel.rst:3368 msgid "int" msgstr "int" -#: ../../reference/datamodel.rst:3370 +#: ../../reference/datamodel.rst:3368 msgid "float" msgstr "float" -#: ../../reference/datamodel.rst:3398 +#: ../../reference/datamodel.rst:3396 msgid "round" msgstr "round" -#: ../../reference/datamodel.rst:3425 +#: ../../reference/datamodel.rst:3423 msgid "with" msgstr "with" -#: ../../reference/datamodel.rst:3425 +#: ../../reference/datamodel.rst:3423 msgid "context manager" msgstr "context manager(情境管理器)" diff --git a/reference/expressions.po b/reference/expressions.po index 32ca7edb29..5a0217870b 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-15 00:14+0000\n" +"POT-Creation-Date: 2025-02-23 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -90,16 +90,16 @@ msgstr "" #: ../../reference/expressions.rst:70 msgid "" -"An identifier occurring as an atom is a name. See section :ref:" -"`identifiers` for lexical definition and section :ref:`naming` for " -"documentation of naming and binding." +"An identifier occurring as an atom is a name. See " +"section :ref:`identifiers` for lexical definition and section :ref:`naming` " +"for documentation of naming and binding." msgstr "" #: ../../reference/expressions.rst:76 msgid "" "When the name is bound to an object, evaluation of the atom yields that " -"object. When a name is not bound, an attempt to evaluate it raises a :exc:" -"`NameError` exception." +"object. When a name is not bound, an attempt to evaluate it raises " +"a :exc:`NameError` exception." msgstr "" #: ../../reference/expressions.rst:87 @@ -245,8 +245,8 @@ msgstr "" #: ../../reference/expressions.rst:203 msgid "" -"they are computed via a set of looping and filtering instructions, called a :" -"dfn:`comprehension`." +"they are computed via a set of looping and filtering instructions, called " +"a :dfn:`comprehension`." msgstr "" #: ../../reference/expressions.rst:211 @@ -255,9 +255,9 @@ msgstr "" #: ../../reference/expressions.rst:219 msgid "" -"The comprehension consists of a single expression followed by at least one :" -"keyword:`!for` clause and zero or more :keyword:`!for` or :keyword:`!if` " -"clauses. In this case, the elements of the new container are those that " +"The comprehension consists of a single expression followed by at least " +"one :keyword:`!for` clause and zero or more :keyword:`!for` or :keyword:`!" +"if` clauses. In this case, the elements of the new container are those that " "would be produced by considering each of the :keyword:`!for` or :keyword:`!" "if` clauses a block, nesting from left to right, and evaluating the " "expression to produce an element each time the innermost block is reached." @@ -292,8 +292,8 @@ msgstr "" msgid "" "Since Python 3.6, in an :keyword:`async def` function, an :keyword:`!async " "for` clause may be used to iterate over a :term:`asynchronous iterator`. A " -"comprehension in an :keyword:`!async def` function may consist of either a :" -"keyword:`!for` or :keyword:`!async for` clause following the leading " +"comprehension in an :keyword:`!async def` function may consist of either " +"a :keyword:`!for` or :keyword:`!async for` clause following the leading " "expression, may contain additional :keyword:`!for` or :keyword:`!async for` " "clauses, and may also use :keyword:`await` expressions." msgstr "" @@ -414,11 +414,11 @@ msgstr "" #: ../../reference/expressions.rst:375 msgid "" -"Restrictions on the types of the key values are listed earlier in section :" -"ref:`types`. (To summarize, the key type should be :term:`hashable`, which " -"excludes all mutable objects.) Clashes between duplicate keys are not " -"detected; the last value (textually rightmost in the display) stored for a " -"given key value prevails." +"Restrictions on the types of the key values are listed earlier in " +"section :ref:`types`. (To summarize, the key type should " +"be :term:`hashable`, which excludes all mutable objects.) Clashes between " +"duplicate keys are not detected; the last value (textually rightmost in the " +"display) stored for a given key value prevails." msgstr "" #: ../../reference/expressions.rst:381 @@ -446,16 +446,16 @@ msgstr "" #: ../../reference/expressions.rst:407 msgid "" -"Variables used in the generator expression are evaluated lazily when the :" -"meth:`~generator.__next__` method is called for the generator object (in the " -"same fashion as normal generators). However, the iterable expression in the " -"leftmost :keyword:`!for` clause is immediately evaluated, so that an error " -"produced by it will be emitted at the point where the generator expression " -"is defined, rather than at the point where the first value is retrieved. " -"Subsequent :keyword:`!for` clauses and any filter condition in the leftmost :" -"keyword:`!for` clause cannot be evaluated in the enclosing scope as they may " -"depend on the values obtained from the leftmost iterable. For example: " -"``(x*y for x in range(10) for y in range(x, x+10))``." +"Variables used in the generator expression are evaluated lazily when " +"the :meth:`~generator.__next__` method is called for the generator object " +"(in the same fashion as normal generators). However, the iterable " +"expression in the leftmost :keyword:`!for` clause is immediately evaluated, " +"so that an error produced by it will be emitted at the point where the " +"generator expression is defined, rather than at the point where the first " +"value is retrieved. Subsequent :keyword:`!for` clauses and any filter " +"condition in the leftmost :keyword:`!for` clause cannot be evaluated in the " +"enclosing scope as they may depend on the values obtained from the leftmost " +"iterable. For example: ``(x*y for x in range(10) for y in range(x, x+10))``." msgstr "" #: ../../reference/expressions.rst:418 @@ -473,11 +473,11 @@ msgstr "" #: ../../reference/expressions.rst:425 msgid "" -"If a generator expression contains either :keyword:`!async for` clauses or :" -"keyword:`await` expressions it is called an :dfn:`asynchronous generator " +"If a generator expression contains either :keyword:`!async for` clauses " +"or :keyword:`await` expressions it is called an :dfn:`asynchronous generator " "expression`. An asynchronous generator expression returns a new " -"asynchronous generator object, which is an asynchronous iterator (see :ref:" -"`async-iterators`)." +"asynchronous generator object, which is an asynchronous iterator " +"(see :ref:`async-iterators`)." msgstr "" #: ../../reference/expressions.rst:431 @@ -500,9 +500,9 @@ msgid "" "The yield expression is used when defining a :term:`generator` function or " "an :term:`asynchronous generator` function and thus can only be used in the " "body of a function definition. Using a yield expression in a function's " -"body causes that function to be a generator function, and using it in an :" -"keyword:`async def` function's body causes that coroutine function to be an " -"asynchronous generator function. For example::" +"body causes that function to be a generator function, and using it in " +"an :keyword:`async def` function's body causes that coroutine function to be " +"an asynchronous generator function. For example::" msgstr "" #: ../../reference/expressions.rst:466 @@ -540,19 +540,19 @@ msgid "" "generator. That generator then controls the execution of the generator " "function. The execution starts when one of the generator's methods is " "called. At that time, the execution proceeds to the first yield expression, " -"where it is suspended again, returning the value of :token:`~python-grammar:" -"yield_list` to the generator's caller, or ``None`` if :token:`~python-" -"grammar:yield_list` is omitted. By suspended, we mean that all local state " -"is retained, including the current bindings of local variables, the " -"instruction pointer, the internal evaluation stack, and the state of any " -"exception handling. When the execution is resumed by calling one of the " -"generator's methods, the function can proceed exactly as if the yield " -"expression were just another external call. The value of the yield " +"where it is suspended again, returning the value of :token:`~python-" +"grammar:yield_list` to the generator's caller, or ``None`` " +"if :token:`~python-grammar:yield_list` is omitted. By suspended, we mean " +"that all local state is retained, including the current bindings of local " +"variables, the instruction pointer, the internal evaluation stack, and the " +"state of any exception handling. When the execution is resumed by calling " +"one of the generator's methods, the function can proceed exactly as if the " +"yield expression were just another external call. The value of the yield " "expression after resuming depends on the method which resumed the " -"execution. If :meth:`~generator.__next__` is used (typically via either a :" -"keyword:`for` or the :func:`next` builtin) then the result is :const:" -"`None`. Otherwise, if :meth:`~generator.send` is used, then the result will " -"be the value passed in to that method." +"execution. If :meth:`~generator.__next__` is used (typically via either " +"a :keyword:`for` or the :func:`next` builtin) then the result " +"is :const:`None`. Otherwise, if :meth:`~generator.send` is used, then the " +"result will be the value passed in to that method." msgstr "" #: ../../reference/expressions.rst:504 @@ -568,30 +568,31 @@ msgstr "" msgid "" "Yield expressions are allowed anywhere in a :keyword:`try` construct. If " "the generator is not resumed before it is finalized (by reaching a zero " -"reference count or by being garbage collected), the generator-iterator's :" -"meth:`~generator.close` method will be called, allowing any pending :keyword:" -"`finally` clauses to execute." +"reference count or by being garbage collected), the generator-" +"iterator's :meth:`~generator.close` method will be called, allowing any " +"pending :keyword:`finally` clauses to execute." msgstr "" #: ../../reference/expressions.rst:519 msgid "" "When ``yield from <expr>`` is used, the supplied expression must be an " "iterable. The values produced by iterating that iterable are passed directly " -"to the caller of the current generator's methods. Any values passed in with :" -"meth:`~generator.send` and any exceptions passed in with :meth:`~generator." -"throw` are passed to the underlying iterator if it has the appropriate " -"methods. If this is not the case, then :meth:`~generator.send` will raise :" -"exc:`AttributeError` or :exc:`TypeError`, while :meth:`~generator.throw` " -"will just raise the passed in exception immediately." +"to the caller of the current generator's methods. Any values passed in " +"with :meth:`~generator.send` and any exceptions passed in " +"with :meth:`~generator.throw` are passed to the underlying iterator if it " +"has the appropriate methods. If this is not the case, " +"then :meth:`~generator.send` will raise :exc:`AttributeError` " +"or :exc:`TypeError`, while :meth:`~generator.throw` will just raise the " +"passed in exception immediately." msgstr "" #: ../../reference/expressions.rst:528 msgid "" "When the underlying iterator is complete, the :attr:`~StopIteration.value` " "attribute of the raised :exc:`StopIteration` instance becomes the value of " -"the yield expression. It can be either set explicitly when raising :exc:" -"`StopIteration`, or automatically when the subiterator is a generator (by " -"returning a value from the subgenerator)." +"the yield expression. It can be either set explicitly when " +"raising :exc:`StopIteration`, or automatically when the subiterator is a " +"generator (by returning a value from the subgenerator)." msgstr "" #: ../../reference/expressions.rst:534 @@ -663,13 +664,13 @@ msgstr "" #: ../../reference/expressions.rst:574 msgid "" "Starts the execution of a generator function or resumes it at the last " -"executed yield expression. When a generator function is resumed with a :" -"meth:`~generator.__next__` method, the current yield expression always " +"executed yield expression. When a generator function is resumed with " +"a :meth:`~generator.__next__` method, the current yield expression always " "evaluates to :const:`None`. The execution then continues to the next yield " -"expression, where the generator is suspended again, and the value of the :" -"token:`~python-grammar:yield_list` is returned to :meth:`__next__`'s " -"caller. If the generator exits without yielding another value, a :exc:" -"`StopIteration` exception is raised." +"expression, where the generator is suspended again, and the value of " +"the :token:`~python-grammar:yield_list` is returned to :meth:`__next__`'s " +"caller. If the generator exits without yielding another value, " +"a :exc:`StopIteration` exception is raised." msgstr "" #: ../../reference/expressions.rst:583 @@ -715,7 +716,7 @@ msgid "" "*value* may be cleared." msgstr "" -#: ../../reference/expressions.rst:621 ../../reference/expressions.rst:802 +#: ../../reference/expressions.rst:621 ../../reference/expressions.rst:805 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." @@ -730,14 +731,14 @@ msgid "" "exception), :meth:`close` returns :const:`None`. If the generator yields a " "value, a :exc:`RuntimeError` is raised. If the generator raises any other " "exception, it is propagated to the caller. If the generator has already " -"exited due to an exception or normal exit, :meth:`close` returns :const:" -"`None` and has no other effect." +"exited due to an exception or normal exit, :meth:`close` " +"returns :const:`None` and has no other effect." msgstr "" #: ../../reference/expressions.rst:641 msgid "" -"If a generator returns a value upon being closed, the value is returned by :" -"meth:`close`." +"If a generator returns a value upon being closed, the value is returned " +"by :meth:`close`." msgstr "" #: ../../reference/expressions.rst:647 @@ -790,9 +791,9 @@ msgstr "非同步產生器函式" #: ../../reference/expressions.rst:684 msgid "" -"The presence of a yield expression in a function or method defined using :" -"keyword:`async def` further defines the function as an :term:`asynchronous " -"generator` function." +"The presence of a yield expression in a function or method defined " +"using :keyword:`async def` further defines the function as " +"an :term:`asynchronous generator` function." msgstr "" #: ../../reference/expressions.rst:688 @@ -801,26 +802,27 @@ msgid "" "asynchronous iterator known as an asynchronous generator object. That object " "then controls the execution of the generator function. An asynchronous " "generator object is typically used in an :keyword:`async for` statement in a " -"coroutine function analogously to how a generator object would be used in a :" -"keyword:`for` statement." +"coroutine function analogously to how a generator object would be used in " +"a :keyword:`for` statement." msgstr "" #: ../../reference/expressions.rst:695 msgid "" -"Calling one of the asynchronous generator's methods returns an :term:" -"`awaitable` object, and the execution starts when this object is awaited on. " -"At that time, the execution proceeds to the first yield expression, where it " -"is suspended again, returning the value of :token:`~python-grammar:" -"yield_list` to the awaiting coroutine. As with a generator, suspension means " -"that all local state is retained, including the current bindings of local " -"variables, the instruction pointer, the internal evaluation stack, and the " -"state of any exception handling. When the execution is resumed by awaiting " -"on the next object returned by the asynchronous generator's methods, the " -"function can proceed exactly as if the yield expression were just another " -"external call. The value of the yield expression after resuming depends on " -"the method which resumed the execution. If :meth:`~agen.__anext__` is used " -"then the result is :const:`None`. Otherwise, if :meth:`~agen.asend` is used, " -"then the result will be the value passed in to that method." +"Calling one of the asynchronous generator's methods returns " +"an :term:`awaitable` object, and the execution starts when this object is " +"awaited on. At that time, the execution proceeds to the first yield " +"expression, where it is suspended again, returning the value " +"of :token:`~python-grammar:yield_list` to the awaiting coroutine. As with a " +"generator, suspension means that all local state is retained, including the " +"current bindings of local variables, the instruction pointer, the internal " +"evaluation stack, and the state of any exception handling. When the " +"execution is resumed by awaiting on the next object returned by the " +"asynchronous generator's methods, the function can proceed exactly as if the " +"yield expression were just another external call. The value of the yield " +"expression after resuming depends on the method which resumed the " +"execution. If :meth:`~agen.__anext__` is used then the result " +"is :const:`None`. Otherwise, if :meth:`~agen.asend` is used, then the result " +"will be the value passed in to that method." msgstr "" #: ../../reference/expressions.rst:710 @@ -854,12 +856,12 @@ msgid "" "To take care of finalization upon event loop termination, an event loop " "should define a *finalizer* function which takes an asynchronous generator-" "iterator and presumably calls :meth:`~agen.aclose` and executes the " -"coroutine. This *finalizer* may be registered by calling :func:`sys." -"set_asyncgen_hooks`. When first iterated over, an asynchronous generator-" -"iterator will store the registered *finalizer* to be called upon " -"finalization. For a reference example of a *finalizer* method see the " -"implementation of ``asyncio.Loop.shutdown_asyncgens`` in :source:`Lib/" -"asyncio/base_events.py`." +"coroutine. This *finalizer* may be registered by " +"calling :func:`sys.set_asyncgen_hooks`. When first iterated over, an " +"asynchronous generator-iterator will store the registered *finalizer* to be " +"called upon finalization. For a reference example of a *finalizer* method " +"see the implementation of ``asyncio.Loop.shutdown_asyncgens`` " +"in :source:`Lib/asyncio/base_events.py`." msgstr "" #: ../../reference/expressions.rst:740 @@ -878,7 +880,7 @@ msgid "" "which are used to control the execution of a generator function." msgstr "" -#: ../../reference/expressions.rst:757 +#: ../../reference/expressions.rst:758 msgid "" "Returns an awaitable which when run starts to execute the asynchronous " "generator or resumes it at the last executed yield expression. When an " @@ -888,44 +890,44 @@ msgid "" "expression. The value of the :token:`~python-grammar:yield_list` of the " "yield expression is the value of the :exc:`StopIteration` exception raised " "by the completing coroutine. If the asynchronous generator exits without " -"yielding another value, the awaitable instead raises a :exc:" -"`StopAsyncIteration` exception, signalling that the asynchronous iteration " -"has completed." +"yielding another value, the awaitable instead raises " +"a :exc:`StopAsyncIteration` exception, signalling that the asynchronous " +"iteration has completed." msgstr "" -#: ../../reference/expressions.rst:769 +#: ../../reference/expressions.rst:770 msgid "" "This method is normally called implicitly by a :keyword:`async for` loop." msgstr "" -#: ../../reference/expressions.rst:774 +#: ../../reference/expressions.rst:776 msgid "" "Returns an awaitable which when run resumes the execution of the " "asynchronous generator. As with the :meth:`~generator.send` method for a " "generator, this \"sends\" a value into the asynchronous generator function, " "and the *value* argument becomes the result of the current yield expression. " "The awaitable returned by the :meth:`asend` method will return the next " -"value yielded by the generator as the value of the raised :exc:" -"`StopIteration`, or raises :exc:`StopAsyncIteration` if the asynchronous " -"generator exits without yielding another value. When :meth:`asend` is " -"called to start the asynchronous generator, it must be called with :const:" -"`None` as the argument, because there is no yield expression that could " -"receive the value." +"value yielded by the generator as the value of the " +"raised :exc:`StopIteration`, or raises :exc:`StopAsyncIteration` if the " +"asynchronous generator exits without yielding another value. " +"When :meth:`asend` is called to start the asynchronous generator, it must be " +"called with :const:`None` as the argument, because there is no yield " +"expression that could receive the value." msgstr "" -#: ../../reference/expressions.rst:790 +#: ../../reference/expressions.rst:793 msgid "" "Returns an awaitable that raises an exception of type ``type`` at the point " "where the asynchronous generator was paused, and returns the next value " -"yielded by the generator function as the value of the raised :exc:" -"`StopIteration` exception. If the asynchronous generator exits without " -"yielding another value, a :exc:`StopAsyncIteration` exception is raised by " -"the awaitable. If the generator function does not catch the passed-in " -"exception, or raises a different exception, then when the awaitable is run " -"that exception propagates to the caller of the awaitable." +"yielded by the generator function as the value of the " +"raised :exc:`StopIteration` exception. If the asynchronous generator exits " +"without yielding another value, a :exc:`StopAsyncIteration` exception is " +"raised by the awaitable. If the generator function does not catch the passed-" +"in exception, or raises a different exception, then when the awaitable is " +"run that exception propagates to the caller of the awaitable." msgstr "" -#: ../../reference/expressions.rst:810 +#: ../../reference/expressions.rst:814 msgid "" "Returns an awaitable that when run will throw a :exc:`GeneratorExit` into " "the asynchronous generator function at the point where it was paused. If the " @@ -941,25 +943,25 @@ msgid "" "will return an awaitable that does nothing." msgstr "" -#: ../../reference/expressions.rst:826 +#: ../../reference/expressions.rst:830 msgid "Primaries" msgstr "" -#: ../../reference/expressions.rst:830 +#: ../../reference/expressions.rst:834 msgid "" "Primaries represent the most tightly bound operations of the language. Their " "syntax is:" msgstr "" -#: ../../reference/expressions.rst:840 +#: ../../reference/expressions.rst:844 msgid "Attribute references" msgstr "" -#: ../../reference/expressions.rst:846 +#: ../../reference/expressions.rst:850 msgid "An attribute reference is a primary followed by a period and a name:" msgstr "" -#: ../../reference/expressions.rst:856 +#: ../../reference/expressions.rst:860 msgid "" "The primary must evaluate to an object of a type that supports attribute " "references, which most objects do. This object is then asked to produce the " @@ -968,67 +970,69 @@ msgid "" "reference may yield different objects." msgstr "" -#: ../../reference/expressions.rst:862 +#: ../../reference/expressions.rst:866 msgid "" -"This production can be customized by overriding the :meth:`~object." -"__getattribute__` method or the :meth:`~object.__getattr__` method. The :" -"meth:`!__getattribute__` method is called first and either returns a value " -"or raises :exc:`AttributeError` if the attribute is not available." +"This production can be customized by overriding " +"the :meth:`~object.__getattribute__` method or " +"the :meth:`~object.__getattr__` method. The :meth:`!__getattribute__` " +"method is called first and either returns a value or " +"raises :exc:`AttributeError` if the attribute is not available." msgstr "" -#: ../../reference/expressions.rst:868 +#: ../../reference/expressions.rst:872 msgid "" "If an :exc:`AttributeError` is raised and the object has a :meth:`!" "__getattr__` method, that method is called as a fallback." msgstr "" -#: ../../reference/expressions.rst:874 +#: ../../reference/expressions.rst:878 msgid "Subscriptions" msgstr "" -#: ../../reference/expressions.rst:889 +#: ../../reference/expressions.rst:893 msgid "" "The subscription of an instance of a :ref:`container class <sequence-types>` " -"will generally select an element from the container. The subscription of a :" -"term:`generic class <generic type>` will generally return a :ref:" -"`GenericAlias <types-genericalias>` object." +"will generally select an element from the container. The subscription of " +"a :term:`generic class <generic type>` will generally return " +"a :ref:`GenericAlias <types-genericalias>` object." msgstr "" -#: ../../reference/expressions.rst:897 +#: ../../reference/expressions.rst:901 msgid "" "When an object is subscripted, the interpreter will evaluate the primary and " "the expression list." msgstr "" -#: ../../reference/expressions.rst:900 +#: ../../reference/expressions.rst:904 msgid "" "The primary must evaluate to an object that supports subscription. An object " -"may support subscription through defining one or both of :meth:`~object." -"__getitem__` and :meth:`~object.__class_getitem__`. When the primary is " -"subscripted, the evaluated result of the expression list will be passed to " -"one of these methods. For more details on when ``__class_getitem__`` is " -"called instead of ``__getitem__``, see :ref:`classgetitem-versus-getitem`." +"may support subscription through defining one or both " +"of :meth:`~object.__getitem__` and :meth:`~object.__class_getitem__`. When " +"the primary is subscripted, the evaluated result of the expression list will " +"be passed to one of these methods. For more details on when " +"``__class_getitem__`` is called instead of ``__getitem__``, " +"see :ref:`classgetitem-versus-getitem`." msgstr "" -#: ../../reference/expressions.rst:907 +#: ../../reference/expressions.rst:911 msgid "" "If the expression list contains at least one comma, or if any of the " -"expressions are starred, the expression list will evaluate to a :class:" -"`tuple` containing the items of the expression list. Otherwise, the " +"expressions are starred, the expression list will evaluate to " +"a :class:`tuple` containing the items of the expression list. Otherwise, the " "expression list will evaluate to the value of the list's sole member." msgstr "" -#: ../../reference/expressions.rst:912 +#: ../../reference/expressions.rst:916 msgid "Expressions in an expression list may be starred. See :pep:`646`." msgstr "" -#: ../../reference/expressions.rst:915 +#: ../../reference/expressions.rst:919 msgid "" "For built-in objects, there are two types of objects that support " "subscription via :meth:`~object.__getitem__`:" msgstr "" -#: ../../reference/expressions.rst:918 +#: ../../reference/expressions.rst:922 msgid "" "Mappings. If the primary is a :term:`mapping`, the expression list must " "evaluate to an object whose value is one of the keys of the mapping, and the " @@ -1036,47 +1040,47 @@ msgid "" "An example of a builtin mapping class is the :class:`dict` class." msgstr "" -#: ../../reference/expressions.rst:922 +#: ../../reference/expressions.rst:926 msgid "" "Sequences. If the primary is a :term:`sequence`, the expression list must " "evaluate to an :class:`int` or a :class:`slice` (as discussed in the " -"following section). Examples of builtin sequence classes include the :class:" -"`str`, :class:`list` and :class:`tuple` classes." +"following section). Examples of builtin sequence classes include " +"the :class:`str`, :class:`list` and :class:`tuple` classes." msgstr "" -#: ../../reference/expressions.rst:927 +#: ../../reference/expressions.rst:931 msgid "" -"The formal syntax makes no special provision for negative indices in :term:" -"`sequences <sequence>`. However, built-in sequences all provide a :meth:" -"`~object.__getitem__` method that interprets negative indices by adding the " -"length of the sequence to the index so that, for example, ``x[-1]`` selects " -"the last item of ``x``. The resulting value must be a nonnegative integer " -"less than the number of items in the sequence, and the subscription selects " -"the item whose index is that value (counting from zero). Since the support " -"for negative indices and slicing occurs in the object's :meth:`~object." -"__getitem__` method, subclasses overriding this method will need to " -"explicitly add that support." +"The formal syntax makes no special provision for negative indices " +"in :term:`sequences <sequence>`. However, built-in sequences all provide " +"a :meth:`~object.__getitem__` method that interprets negative indices by " +"adding the length of the sequence to the index so that, for example, " +"``x[-1]`` selects the last item of ``x``. The resulting value must be a " +"nonnegative integer less than the number of items in the sequence, and the " +"subscription selects the item whose index is that value (counting from " +"zero). Since the support for negative indices and slicing occurs in the " +"object's :meth:`~object.__getitem__` method, subclasses overriding this " +"method will need to explicitly add that support." msgstr "" -#: ../../reference/expressions.rst:941 +#: ../../reference/expressions.rst:945 msgid "" "A :class:`string <str>` is a special kind of sequence whose items are " "*characters*. A character is not a separate data type but a string of " "exactly one character." msgstr "" -#: ../../reference/expressions.rst:949 +#: ../../reference/expressions.rst:953 msgid "Slicings" msgstr "" -#: ../../reference/expressions.rst:963 +#: ../../reference/expressions.rst:967 msgid "" "A slicing selects a range of items in a sequence object (e.g., a string, " "tuple or list). Slicings may be used as expressions or as targets in " "assignment or :keyword:`del` statements. The syntax for a slicing:" msgstr "" -#: ../../reference/expressions.rst:976 +#: ../../reference/expressions.rst:980 msgid "" "There is ambiguity in the formal syntax here: anything that looks like an " "expression list also looks like a slice list, so any subscription can be " @@ -1086,7 +1090,7 @@ msgid "" "the case if the slice list contains no proper slice)." msgstr "" -#: ../../reference/expressions.rst:988 +#: ../../reference/expressions.rst:992 msgid "" "The semantics for a slicing are as follows. The primary is indexed (using " "the same :meth:`~object.__getitem__` method as normal subscription) with a " @@ -1095,29 +1099,29 @@ msgid "" "the slice items; otherwise, the conversion of the lone slice item is the " "key. The conversion of a slice item that is an expression is that " "expression. The conversion of a proper slice is a slice object (see " -"section :ref:`types`) whose :attr:`~slice.start`, :attr:`~slice.stop` and :" -"attr:`~slice.step` attributes are the values of the expressions given as " -"lower bound, upper bound and stride, respectively, substituting ``None`` for " -"missing expressions." +"section :ref:`types`) whose :attr:`~slice.start`, :attr:`~slice.stop` " +"and :attr:`~slice.step` attributes are the values of the expressions given " +"as lower bound, upper bound and stride, respectively, substituting ``None`` " +"for missing expressions." msgstr "" -#: ../../reference/expressions.rst:1012 +#: ../../reference/expressions.rst:1016 msgid "Calls" msgstr "" -#: ../../reference/expressions.rst:1014 +#: ../../reference/expressions.rst:1018 msgid "" "A call calls a callable object (e.g., a :term:`function`) with a possibly " "empty series of :term:`arguments <argument>`:" msgstr "" -#: ../../reference/expressions.rst:1031 +#: ../../reference/expressions.rst:1035 msgid "" "An optional trailing comma may be present after the positional and keyword " "arguments but does not affect the semantics." msgstr "" -#: ../../reference/expressions.rst:1037 +#: ../../reference/expressions.rst:1041 msgid "" "The primary must evaluate to a callable object (user-defined functions, " "built-in functions, methods of built-in objects, class objects, methods of " @@ -1127,7 +1131,7 @@ msgid "" "formal :term:`parameter` lists." msgstr "" -#: ../../reference/expressions.rst:1045 +#: ../../reference/expressions.rst:1049 msgid "" "If keyword arguments are present, they are first converted to positional " "arguments, as follows. First, a list of unfilled slots is created for the " @@ -1148,16 +1152,16 @@ msgid "" "filled slots is used as the argument list for the call." msgstr "" -#: ../../reference/expressions.rst:1065 +#: ../../reference/expressions.rst:1069 msgid "" "An implementation may provide built-in functions whose positional parameters " "do not have names, even if they are 'named' for the purpose of " "documentation, and which therefore cannot be supplied by keyword. In " -"CPython, this is the case for functions implemented in C that use :c:func:" -"`PyArg_ParseTuple` to parse their arguments." +"CPython, this is the case for functions implemented in C that " +"use :c:func:`PyArg_ParseTuple` to parse their arguments." msgstr "" -#: ../../reference/expressions.rst:1071 +#: ../../reference/expressions.rst:1075 msgid "" "If there are more positional arguments than there are formal parameter " "slots, a :exc:`TypeError` exception is raised, unless a formal parameter " @@ -1166,17 +1170,17 @@ msgid "" "empty tuple if there were no excess positional arguments)." msgstr "" -#: ../../reference/expressions.rst:1077 +#: ../../reference/expressions.rst:1081 msgid "" -"If any keyword argument does not correspond to a formal parameter name, a :" -"exc:`TypeError` exception is raised, unless a formal parameter using the " +"If any keyword argument does not correspond to a formal parameter name, " +"a :exc:`TypeError` exception is raised, unless a formal parameter using the " "syntax ``**identifier`` is present; in this case, that formal parameter " "receives a dictionary containing the excess keyword arguments (using the " "keywords as keys and the argument values as corresponding values), or a " "(new) empty dictionary if there were no excess keyword arguments." msgstr "" -#: ../../reference/expressions.rst:1088 +#: ../../reference/expressions.rst:1092 msgid "" "If the syntax ``*expression`` appears in the function call, ``expression`` " "must evaluate to an :term:`iterable`. Elements from these iterables are " @@ -1186,14 +1190,14 @@ msgid "" "*y1*, ..., *yM*, *x3*, *x4*." msgstr "" -#: ../../reference/expressions.rst:1095 +#: ../../reference/expressions.rst:1099 msgid "" "A consequence of this is that although the ``*expression`` syntax may appear " "*after* explicit keyword arguments, it is processed *before* the keyword " "arguments (and any ``**expression`` arguments -- see below). So::" msgstr "" -#: ../../reference/expressions.rst:1099 +#: ../../reference/expressions.rst:1103 msgid "" ">>> def f(a, b):\n" "... print(a, b)\n" @@ -1219,13 +1223,13 @@ msgstr "" ">>> f(1, *(2,))\n" "1 2" -#: ../../reference/expressions.rst:1111 +#: ../../reference/expressions.rst:1115 msgid "" "It is unusual for both keyword arguments and the ``*expression`` syntax to " "be used in the same call, so in practice this confusion does not often arise." msgstr "" -#: ../../reference/expressions.rst:1117 +#: ../../reference/expressions.rst:1121 msgid "" "If the syntax ``**expression`` appears in the function call, ``expression`` " "must evaluate to a :term:`mapping`, the contents of which are treated as " @@ -1234,7 +1238,7 @@ msgid "" "a :exc:`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1123 +#: ../../reference/expressions.rst:1127 msgid "" "When ``**expression`` is used, each key in this mapping must be a string. " "Each value from the mapping is assigned to the first formal parameter " @@ -1246,35 +1250,35 @@ msgid "" "is raised." msgstr "" -#: ../../reference/expressions.rst:1133 +#: ../../reference/expressions.rst:1137 msgid "" "Formal parameters using the syntax ``*identifier`` or ``**identifier`` " "cannot be used as positional argument slots or as keyword argument names." msgstr "" -#: ../../reference/expressions.rst:1136 +#: ../../reference/expressions.rst:1140 msgid "" "Function calls accept any number of ``*`` and ``**`` unpackings, positional " "arguments may follow iterable unpackings (``*``), and keyword arguments may " "follow dictionary unpackings (``**``). Originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1142 +#: ../../reference/expressions.rst:1146 msgid "" "A call always returns some value, possibly ``None``, unless it raises an " "exception. How this value is computed depends on the type of the callable " "object." msgstr "" -#: ../../reference/expressions.rst:1146 +#: ../../reference/expressions.rst:1150 msgid "If it is---" msgstr "" -#: ../../reference/expressions.rst:1148 +#: ../../reference/expressions.rst:1152 msgid "a user-defined function:" msgstr "" -#: ../../reference/expressions.rst:1155 +#: ../../reference/expressions.rst:1159 msgid "" "The code block for the function is executed, passing it the argument list. " "The first thing the code block will do is bind the formal parameters to the " @@ -1285,73 +1289,73 @@ msgid "" "``None``." msgstr "" -#: ../../reference/expressions.rst:1162 +#: ../../reference/expressions.rst:1166 msgid "a built-in function or method:" msgstr "" -#: ../../reference/expressions.rst:1173 +#: ../../reference/expressions.rst:1177 msgid "" "The result is up to the interpreter; see :ref:`built-in-funcs` for the " "descriptions of built-in functions and methods." msgstr "" -#: ../../reference/expressions.rst:1176 +#: ../../reference/expressions.rst:1180 msgid "a class object:" msgstr "" -#: ../../reference/expressions.rst:1181 +#: ../../reference/expressions.rst:1185 msgid "A new instance of that class is returned." msgstr "" -#: ../../reference/expressions.rst:1183 +#: ../../reference/expressions.rst:1187 msgid "a class instance method:" msgstr "" -#: ../../reference/expressions.rst:1189 +#: ../../reference/expressions.rst:1193 msgid "" "The corresponding user-defined function is called, with an argument list " "that is one longer than the argument list of the call: the instance becomes " "the first argument." msgstr "" -#: ../../reference/expressions.rst:1193 +#: ../../reference/expressions.rst:1197 msgid "a class instance:" msgstr "" -#: ../../reference/expressions.rst:1198 +#: ../../reference/expressions.rst:1202 msgid "" "The class must define a :meth:`~object.__call__` method; the effect is then " "the same as if that method was called." msgstr "" -#: ../../reference/expressions.rst:1206 ../../reference/expressions.rst:2007 +#: ../../reference/expressions.rst:1210 ../../reference/expressions.rst:2011 msgid "Await expression" msgstr "" -#: ../../reference/expressions.rst:1208 +#: ../../reference/expressions.rst:1212 msgid "" "Suspend the execution of :term:`coroutine` on an :term:`awaitable` object. " "Can only be used inside a :term:`coroutine function`." msgstr "" -#: ../../reference/expressions.rst:1220 +#: ../../reference/expressions.rst:1224 msgid "The power operator" msgstr "" -#: ../../reference/expressions.rst:1226 +#: ../../reference/expressions.rst:1230 msgid "" "The power operator binds more tightly than unary operators on its left; it " "binds less tightly than unary operators on its right. The syntax is:" msgstr "" -#: ../../reference/expressions.rst:1232 +#: ../../reference/expressions.rst:1236 msgid "" "Thus, in an unparenthesized sequence of power and unary operators, the " "operators are evaluated from right to left (this does not constrain the " "evaluation order for the operands): ``-1**2`` results in ``-1``." msgstr "" -#: ../../reference/expressions.rst:1236 +#: ../../reference/expressions.rst:1240 msgid "" "The power operator has the same semantics as the built-in :func:`pow` " "function, when called with two arguments: it yields its left argument raised " @@ -1359,7 +1363,7 @@ msgid "" "converted to a common type, and the result is of that type." msgstr "" -#: ../../reference/expressions.rst:1241 +#: ../../reference/expressions.rst:1245 msgid "" "For int operands, the result has the same type as the operands unless the " "second argument is negative; in that case, all arguments are converted to " @@ -1367,59 +1371,60 @@ msgid "" "``100``, but ``10**-2`` returns ``0.01``." msgstr "" -#: ../../reference/expressions.rst:1246 +#: ../../reference/expressions.rst:1250 msgid "" "Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`. " -"Raising a negative number to a fractional power results in a :class:" -"`complex` number. (In earlier versions it raised a :exc:`ValueError`.)" +"Raising a negative number to a fractional power results in " +"a :class:`complex` number. (In earlier versions it raised " +"a :exc:`ValueError`.)" msgstr "" -#: ../../reference/expressions.rst:1250 +#: ../../reference/expressions.rst:1254 msgid "" "This operation can be customized using the special :meth:`~object.__pow__` " "and :meth:`~object.__rpow__` methods." msgstr "" -#: ../../reference/expressions.rst:1256 +#: ../../reference/expressions.rst:1260 msgid "Unary arithmetic and bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1262 +#: ../../reference/expressions.rst:1266 msgid "All unary arithmetic and bitwise operations have the same priority:" msgstr "" -#: ../../reference/expressions.rst:1273 +#: ../../reference/expressions.rst:1277 msgid "" "The unary ``-`` (minus) operator yields the negation of its numeric " "argument; the operation can be overridden with the :meth:`~object.__neg__` " "special method." msgstr "" -#: ../../reference/expressions.rst:1281 +#: ../../reference/expressions.rst:1285 msgid "" "The unary ``+`` (plus) operator yields its numeric argument unchanged; the " "operation can be overridden with the :meth:`~object.__pos__` special method." msgstr "" -#: ../../reference/expressions.rst:1288 +#: ../../reference/expressions.rst:1292 msgid "" "The unary ``~`` (invert) operator yields the bitwise inversion of its " "integer argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. " -"It only applies to integral numbers or to custom objects that override the :" -"meth:`~object.__invert__` special method." +"It only applies to integral numbers or to custom objects that override " +"the :meth:`~object.__invert__` special method." msgstr "" -#: ../../reference/expressions.rst:1297 +#: ../../reference/expressions.rst:1301 msgid "" -"In all three cases, if the argument does not have the proper type, a :exc:" -"`TypeError` exception is raised." +"In all three cases, if the argument does not have the proper type, " +"a :exc:`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1304 +#: ../../reference/expressions.rst:1308 msgid "Binary arithmetic operations" msgstr "" -#: ../../reference/expressions.rst:1308 +#: ../../reference/expressions.rst:1312 msgid "" "The binary arithmetic operations have the conventional priority levels. " "Note that some of these operations also apply to certain non-numeric types. " @@ -1427,7 +1432,7 @@ msgid "" "multiplicative operators and one for additive operators:" msgstr "" -#: ../../reference/expressions.rst:1323 +#: ../../reference/expressions.rst:1327 msgid "" "The ``*`` (multiplication) operator yields the product of its arguments. " "The arguments must either both be numbers, or one argument must be an " @@ -1437,25 +1442,25 @@ msgid "" "an empty sequence." msgstr "" -#: ../../reference/expressions.rst:1329 +#: ../../reference/expressions.rst:1333 msgid "" "This operation can be customized using the special :meth:`~object.__mul__` " "and :meth:`~object.__rmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1336 +#: ../../reference/expressions.rst:1340 msgid "" "The ``@`` (at) operator is intended to be used for matrix multiplication. " "No builtin Python types implement this operator." msgstr "" -#: ../../reference/expressions.rst:1339 +#: ../../reference/expressions.rst:1343 msgid "" -"This operation can be customized using the special :meth:`~object." -"__matmul__` and :meth:`~object.__rmatmul__` methods." +"This operation can be customized using the " +"special :meth:`~object.__matmul__` and :meth:`~object.__rmatmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1350 +#: ../../reference/expressions.rst:1354 msgid "" "The ``/`` (division) and ``//`` (floor division) operators yield the " "quotient of their arguments. The numeric arguments are first converted to a " @@ -1465,15 +1470,16 @@ msgid "" "the :exc:`ZeroDivisionError` exception." msgstr "" -#: ../../reference/expressions.rst:1357 +#: ../../reference/expressions.rst:1361 msgid "" -"The division operation can be customized using the special :meth:`~object." -"__truediv__` and :meth:`~object.__rtruediv__` methods. The floor division " -"operation can be customized using the special :meth:`~object.__floordiv__` " -"and :meth:`~object.__rfloordiv__` methods." +"The division operation can be customized using the " +"special :meth:`~object.__truediv__` and :meth:`~object.__rtruediv__` " +"methods. The floor division operation can be customized using the " +"special :meth:`~object.__floordiv__` and :meth:`~object.__rfloordiv__` " +"methods." msgstr "" -#: ../../reference/expressions.rst:1366 +#: ../../reference/expressions.rst:1370 msgid "" "The ``%`` (modulo) operator yields the remainder from the division of the " "first argument by the second. The numeric arguments are first converted to " @@ -1485,7 +1491,7 @@ msgid "" "absolute value of the second operand [#]_." msgstr "" -#: ../../reference/expressions.rst:1375 +#: ../../reference/expressions.rst:1379 msgid "" "The floor division and modulo operators are connected by the following " "identity: ``x == (x//y)*y + (x%y)``. Floor division and modulo are also " @@ -1493,7 +1499,7 @@ msgid "" "y, x%y)``. [#]_." msgstr "" -#: ../../reference/expressions.rst:1380 +#: ../../reference/expressions.rst:1384 msgid "" "In addition to performing the modulo operation on numbers, the ``%`` " "operator is also overloaded by string objects to perform old-style string " @@ -1502,20 +1508,20 @@ msgid "" "formatting`." msgstr "" -#: ../../reference/expressions.rst:1385 +#: ../../reference/expressions.rst:1389 msgid "" -"The *modulo* operation can be customized using the special :meth:`~object." -"__mod__` and :meth:`~object.__rmod__` methods." +"The *modulo* operation can be customized using the " +"special :meth:`~object.__mod__` and :meth:`~object.__rmod__` methods." msgstr "" -#: ../../reference/expressions.rst:1388 +#: ../../reference/expressions.rst:1392 msgid "" "The floor division operator, the modulo operator, and the :func:`divmod` " "function are not defined for complex numbers. Instead, convert to a " "floating-point number using the :func:`abs` function if appropriate." msgstr "" -#: ../../reference/expressions.rst:1397 +#: ../../reference/expressions.rst:1401 msgid "" "The ``+`` (addition) operator yields the sum of its arguments. The " "arguments must either both be numbers or both be sequences of the same " @@ -1523,87 +1529,89 @@ msgid "" "then added together. In the latter case, the sequences are concatenated." msgstr "" -#: ../../reference/expressions.rst:1402 +#: ../../reference/expressions.rst:1406 msgid "" "This operation can be customized using the special :meth:`~object.__add__` " "and :meth:`~object.__radd__` methods." msgstr "" -#: ../../reference/expressions.rst:1410 +#: ../../reference/expressions.rst:1414 msgid "" "The ``-`` (subtraction) operator yields the difference of its arguments. " "The numeric arguments are first converted to a common type." msgstr "" -#: ../../reference/expressions.rst:1413 +#: ../../reference/expressions.rst:1417 msgid "" "This operation can be customized using the special :meth:`~object.__sub__` " "and :meth:`~object.__rsub__` methods." msgstr "" -#: ../../reference/expressions.rst:1420 +#: ../../reference/expressions.rst:1424 msgid "Shifting operations" msgstr "" -#: ../../reference/expressions.rst:1427 +#: ../../reference/expressions.rst:1431 msgid "" "The shifting operations have lower priority than the arithmetic operations:" msgstr "" -#: ../../reference/expressions.rst:1432 +#: ../../reference/expressions.rst:1436 msgid "" "These operators accept integers as arguments. They shift the first argument " "to the left or right by the number of bits given by the second argument." msgstr "" -#: ../../reference/expressions.rst:1435 +#: ../../reference/expressions.rst:1439 msgid "" -"The left shift operation can be customized using the special :meth:`~object." -"__lshift__` and :meth:`~object.__rlshift__` methods. The right shift " -"operation can be customized using the special :meth:`~object.__rshift__` " -"and :meth:`~object.__rrshift__` methods." +"The left shift operation can be customized using the " +"special :meth:`~object.__lshift__` and :meth:`~object.__rlshift__` methods. " +"The right shift operation can be customized using the " +"special :meth:`~object.__rshift__` and :meth:`~object.__rrshift__` methods." msgstr "" -#: ../../reference/expressions.rst:1442 +#: ../../reference/expressions.rst:1446 msgid "" "A right shift by *n* bits is defined as floor division by ``pow(2,n)``. A " "left shift by *n* bits is defined as multiplication with ``pow(2,n)``." msgstr "" -#: ../../reference/expressions.rst:1449 +#: ../../reference/expressions.rst:1453 msgid "Binary bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1453 +#: ../../reference/expressions.rst:1457 msgid "Each of the three bitwise operations has a different priority level:" msgstr "" -#: ../../reference/expressions.rst:1464 +#: ../../reference/expressions.rst:1468 msgid "" "The ``&`` operator yields the bitwise AND of its arguments, which must be " -"integers or one of them must be a custom object overriding :meth:`~object." -"__and__` or :meth:`~object.__rand__` special methods." +"integers or one of them must be a custom object " +"overriding :meth:`~object.__and__` or :meth:`~object.__rand__` special " +"methods." msgstr "" -#: ../../reference/expressions.rst:1473 +#: ../../reference/expressions.rst:1477 msgid "" "The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, " -"which must be integers or one of them must be a custom object overriding :" -"meth:`~object.__xor__` or :meth:`~object.__rxor__` special methods." +"which must be integers or one of them must be a custom object " +"overriding :meth:`~object.__xor__` or :meth:`~object.__rxor__` special " +"methods." msgstr "" -#: ../../reference/expressions.rst:1482 +#: ../../reference/expressions.rst:1486 msgid "" "The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which " -"must be integers or one of them must be a custom object overriding :meth:" -"`~object.__or__` or :meth:`~object.__ror__` special methods." +"must be integers or one of them must be a custom object " +"overriding :meth:`~object.__or__` or :meth:`~object.__ror__` special methods." msgstr "" -#: ../../reference/expressions.rst:1490 +#: ../../reference/expressions.rst:1494 msgid "Comparisons" msgstr "" -#: ../../reference/expressions.rst:1502 +#: ../../reference/expressions.rst:1506 msgid "" "Unlike C, all comparison operations in Python have the same priority, which " "is lower than that of any arithmetic, shifting or bitwise operation. Also " @@ -1611,14 +1619,14 @@ msgid "" "conventional in mathematics:" msgstr "" -#: ../../reference/expressions.rst:1512 +#: ../../reference/expressions.rst:1516 msgid "" "Comparisons yield boolean values: ``True`` or ``False``. Custom :dfn:`rich " "comparison methods` may return non-boolean values. In this case Python will " "call :func:`bool` on such value in boolean contexts." msgstr "" -#: ../../reference/expressions.rst:1518 +#: ../../reference/expressions.rst:1522 msgid "" "Comparisons can be chained arbitrarily, e.g., ``x < y <= z`` is equivalent " "to ``x < y and y <= z``, except that ``y`` is evaluated only once (but in " @@ -1626,7 +1634,7 @@ msgid "" "false)." msgstr "" -#: ../../reference/expressions.rst:1522 +#: ../../reference/expressions.rst:1526 msgid "" "Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*, " "*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y opN " @@ -1634,24 +1642,24 @@ msgid "" "each expression is evaluated at most once." msgstr "" -#: ../../reference/expressions.rst:1527 +#: ../../reference/expressions.rst:1531 msgid "" "Note that ``a op1 b op2 c`` doesn't imply any kind of comparison between *a* " "and *c*, so that, e.g., ``x < y > z`` is perfectly legal (though perhaps not " "pretty)." msgstr "" -#: ../../reference/expressions.rst:1534 +#: ../../reference/expressions.rst:1538 msgid "Value comparisons" msgstr "" -#: ../../reference/expressions.rst:1536 +#: ../../reference/expressions.rst:1540 msgid "" "The operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare the " "values of two objects. The objects do not need to have the same type." msgstr "" -#: ../../reference/expressions.rst:1539 +#: ../../reference/expressions.rst:1543 msgid "" "Chapter :ref:`objects` states that objects have a value (in addition to type " "and identity). The value of an object is a rather abstract notion in " @@ -1663,7 +1671,7 @@ msgid "" "indirectly, by means of their comparison implementation." msgstr "" -#: ../../reference/expressions.rst:1548 +#: ../../reference/expressions.rst:1552 msgid "" "Because all types are (direct or indirect) subtypes of :class:`object`, they " "inherit the default comparison behavior from :class:`object`. Types can " @@ -1671,7 +1679,7 @@ msgid "" "methods` like :meth:`~object.__lt__`, described in :ref:`customization`." msgstr "" -#: ../../reference/expressions.rst:1554 +#: ../../reference/expressions.rst:1558 msgid "" "The default behavior for equality comparison (``==`` and ``!=``) is based on " "the identity of the objects. Hence, equality comparison of instances with " @@ -1681,14 +1689,14 @@ msgid "" "``x is y`` implies ``x == y``)." msgstr "" -#: ../../reference/expressions.rst:1561 +#: ../../reference/expressions.rst:1565 msgid "" "A default order comparison (``<``, ``>``, ``<=``, and ``>=``) is not " "provided; an attempt raises :exc:`TypeError`. A motivation for this default " "behavior is the lack of a similar invariant as for equality." msgstr "" -#: ../../reference/expressions.rst:1565 +#: ../../reference/expressions.rst:1569 msgid "" "The behavior of the default equality comparison, that instances with " "different identities are always unequal, may be in contrast to what types " @@ -1697,13 +1705,13 @@ msgid "" "in fact, a number of built-in types have done that." msgstr "" -#: ../../reference/expressions.rst:1571 +#: ../../reference/expressions.rst:1575 msgid "" "The following list describes the comparison behavior of the most important " "built-in types." msgstr "" -#: ../../reference/expressions.rst:1574 +#: ../../reference/expressions.rst:1578 msgid "" "Numbers of built-in numeric types (:ref:`typesnumeric`) and of the standard " "library types :class:`fractions.Fraction` and :class:`decimal.Decimal` can " @@ -1713,7 +1721,7 @@ msgid "" "of precision." msgstr "" -#: ../../reference/expressions.rst:1581 +#: ../../reference/expressions.rst:1585 msgid "" "The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are " "special. Any ordered comparison of a number to a not-a-number value is " @@ -1723,32 +1731,32 @@ msgid "" "is compliant with IEEE 754." msgstr "" -#: ../../reference/expressions.rst:1588 +#: ../../reference/expressions.rst:1592 msgid "" "``None`` and :data:`NotImplemented` are singletons. :PEP:`8` advises that " "comparisons for singletons should always be done with ``is`` or ``is not``, " "never the equality operators." msgstr "" -#: ../../reference/expressions.rst:1592 +#: ../../reference/expressions.rst:1596 msgid "" "Binary sequences (instances of :class:`bytes` or :class:`bytearray`) can be " "compared within and across their types. They compare lexicographically " "using the numeric values of their elements." msgstr "" -#: ../../reference/expressions.rst:1596 +#: ../../reference/expressions.rst:1600 msgid "" "Strings (instances of :class:`str`) compare lexicographically using the " -"numerical Unicode code points (the result of the built-in function :func:" -"`ord`) of their characters. [#]_" +"numerical Unicode code points (the result of the built-in " +"function :func:`ord`) of their characters. [#]_" msgstr "" -#: ../../reference/expressions.rst:1600 +#: ../../reference/expressions.rst:1604 msgid "Strings and binary sequences cannot be directly compared." msgstr "" -#: ../../reference/expressions.rst:1602 +#: ../../reference/expressions.rst:1606 msgid "" "Sequences (instances of :class:`tuple`, :class:`list`, or :class:`range`) " "can be compared only within each of their types, with the restriction that " @@ -1757,7 +1765,7 @@ msgid "" "raises :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1608 +#: ../../reference/expressions.rst:1612 msgid "" "Sequences compare lexicographically using comparison of corresponding " "elements. The built-in containers typically assume identical objects are " @@ -1765,19 +1773,19 @@ msgid "" "objects to improve performance and to maintain their internal invariants." msgstr "" -#: ../../reference/expressions.rst:1613 +#: ../../reference/expressions.rst:1617 msgid "" "Lexicographical comparison between built-in collections works as follows:" msgstr "" -#: ../../reference/expressions.rst:1615 +#: ../../reference/expressions.rst:1619 msgid "" "For two collections to compare equal, they must be of the same type, have " "the same length, and each pair of corresponding elements must compare equal " "(for example, ``[1,2] == (1,2)`` is false because the type is not the same)." msgstr "" -#: ../../reference/expressions.rst:1620 +#: ../../reference/expressions.rst:1624 msgid "" "Collections that support order comparison are ordered the same as their " "first unequal elements (for example, ``[1,2,x] <= [1,2,y]`` has the same " @@ -1786,150 +1794,151 @@ msgid "" "true)." msgstr "" -#: ../../reference/expressions.rst:1626 +#: ../../reference/expressions.rst:1630 msgid "" "Mappings (instances of :class:`dict`) compare equal if and only if they have " "equal ``(key, value)`` pairs. Equality comparison of the keys and values " "enforces reflexivity." msgstr "" -#: ../../reference/expressions.rst:1630 +#: ../../reference/expressions.rst:1634 msgid "" "Order comparisons (``<``, ``>``, ``<=``, and ``>=``) raise :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1632 +#: ../../reference/expressions.rst:1636 msgid "" "Sets (instances of :class:`set` or :class:`frozenset`) can be compared " "within and across their types." msgstr "" -#: ../../reference/expressions.rst:1635 +#: ../../reference/expressions.rst:1639 msgid "" "They define order comparison operators to mean subset and superset tests. " "Those relations do not define total orderings (for example, the two sets " "``{1,2}`` and ``{2,3}`` are not equal, nor subsets of one another, nor " "supersets of one another). Accordingly, sets are not appropriate arguments " -"for functions which depend on total ordering (for example, :func:`min`, :" -"func:`max`, and :func:`sorted` produce undefined results given a list of " -"sets as inputs)." +"for functions which depend on total ordering (for " +"example, :func:`min`, :func:`max`, and :func:`sorted` produce undefined " +"results given a list of sets as inputs)." msgstr "" -#: ../../reference/expressions.rst:1643 +#: ../../reference/expressions.rst:1647 msgid "Comparison of sets enforces reflexivity of its elements." msgstr "" -#: ../../reference/expressions.rst:1645 +#: ../../reference/expressions.rst:1649 msgid "" "Most other built-in types have no comparison methods implemented, so they " "inherit the default comparison behavior." msgstr "" -#: ../../reference/expressions.rst:1648 +#: ../../reference/expressions.rst:1652 msgid "" "User-defined classes that customize their comparison behavior should follow " "some consistency rules, if possible:" msgstr "" -#: ../../reference/expressions.rst:1651 +#: ../../reference/expressions.rst:1655 msgid "" "Equality comparison should be reflexive. In other words, identical objects " "should compare equal:" msgstr "" -#: ../../reference/expressions.rst:1654 +#: ../../reference/expressions.rst:1658 msgid "``x is y`` implies ``x == y``" msgstr "" -#: ../../reference/expressions.rst:1656 +#: ../../reference/expressions.rst:1660 msgid "" "Comparison should be symmetric. In other words, the following expressions " "should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1659 +#: ../../reference/expressions.rst:1663 msgid "``x == y`` and ``y == x``" msgstr "``x == y`` 和 ``y == x``" -#: ../../reference/expressions.rst:1661 +#: ../../reference/expressions.rst:1665 msgid "``x != y`` and ``y != x``" msgstr "``x != y`` 和 ``y != x``" -#: ../../reference/expressions.rst:1663 +#: ../../reference/expressions.rst:1667 msgid "``x < y`` and ``y > x``" msgstr "``x < y`` 和 ``y > x``" -#: ../../reference/expressions.rst:1665 +#: ../../reference/expressions.rst:1669 msgid "``x <= y`` and ``y >= x``" msgstr "``x <= y`` 和 ``y >= x``" -#: ../../reference/expressions.rst:1667 +#: ../../reference/expressions.rst:1671 msgid "" "Comparison should be transitive. The following (non-exhaustive) examples " "illustrate that:" msgstr "" -#: ../../reference/expressions.rst:1670 +#: ../../reference/expressions.rst:1674 msgid "``x > y and y > z`` implies ``x > z``" msgstr "``x > y and y > z`` 暗示了 ``x > z``" -#: ../../reference/expressions.rst:1672 +#: ../../reference/expressions.rst:1676 msgid "``x < y and y <= z`` implies ``x < z``" msgstr "``x < y and y <= z`` 暗示了 ``x < z``" -#: ../../reference/expressions.rst:1674 +#: ../../reference/expressions.rst:1678 msgid "" "Inverse comparison should result in the boolean negation. In other words, " "the following expressions should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1677 +#: ../../reference/expressions.rst:1681 msgid "``x == y`` and ``not x != y``" msgstr "``x == y`` 和 ``not x != y``" -#: ../../reference/expressions.rst:1679 +#: ../../reference/expressions.rst:1683 msgid "``x < y`` and ``not x >= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1681 +#: ../../reference/expressions.rst:1685 msgid "``x > y`` and ``not x <= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1683 +#: ../../reference/expressions.rst:1687 msgid "" "The last two expressions apply to totally ordered collections (e.g. to " -"sequences, but not to sets or mappings). See also the :func:`~functools." -"total_ordering` decorator." +"sequences, but not to sets or mappings). See also " +"the :func:`~functools.total_ordering` decorator." msgstr "" -#: ../../reference/expressions.rst:1687 +#: ../../reference/expressions.rst:1691 msgid "" "The :func:`hash` result should be consistent with equality. Objects that are " "equal should either have the same hash value, or be marked as unhashable." msgstr "" -#: ../../reference/expressions.rst:1691 +#: ../../reference/expressions.rst:1695 msgid "" "Python does not enforce these consistency rules. In fact, the not-a-number " "values are an example for not following these rules." msgstr "" -#: ../../reference/expressions.rst:1700 +#: ../../reference/expressions.rst:1704 msgid "Membership test operations" msgstr "" -#: ../../reference/expressions.rst:1702 +#: ../../reference/expressions.rst:1706 msgid "" "The operators :keyword:`in` and :keyword:`not in` test for membership. ``x " "in s`` evaluates to ``True`` if *x* is a member of *s*, and ``False`` " "otherwise. ``x not in s`` returns the negation of ``x in s``. All built-in " -"sequences and set types support this as well as dictionary, for which :" -"keyword:`!in` tests whether the dictionary has a given key. For container " -"types such as list, tuple, set, frozenset, dict, or collections.deque, the " -"expression ``x in y`` is equivalent to ``any(x is e or x == e for e in y)``." +"sequences and set types support this as well as dictionary, for " +"which :keyword:`!in` tests whether the dictionary has a given key. For " +"container types such as list, tuple, set, frozenset, dict, or " +"collections.deque, the expression ``x in y`` is equivalent to ``any(x is e " +"or x == e for e in y)``." msgstr "" -#: ../../reference/expressions.rst:1710 +#: ../../reference/expressions.rst:1714 msgid "" "For the string and bytes types, ``x in y`` is ``True`` if and only if *x* is " "a substring of *y*. An equivalent test is ``y.find(x) != -1``. Empty " @@ -1937,14 +1946,14 @@ msgid "" "``\"\" in \"abc\"`` will return ``True``." msgstr "" -#: ../../reference/expressions.rst:1715 +#: ../../reference/expressions.rst:1719 msgid "" "For user-defined classes which define the :meth:`~object.__contains__` " "method, ``x in y`` returns ``True`` if ``y.__contains__(x)`` returns a true " "value, and ``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1719 +#: ../../reference/expressions.rst:1723 msgid "" "For user-defined classes which do not define :meth:`~object.__contains__` " "but do define :meth:`~object.__iter__`, ``x in y`` is ``True`` if some value " @@ -1953,26 +1962,27 @@ msgid "" "it is as if :keyword:`in` raised that exception." msgstr "" -#: ../../reference/expressions.rst:1725 +#: ../../reference/expressions.rst:1729 msgid "" -"Lastly, the old-style iteration protocol is tried: if a class defines :meth:" -"`~object.__getitem__`, ``x in y`` is ``True`` if and only if there is a non-" -"negative integer index *i* such that ``x is y[i] or x == y[i]``, and no " -"lower integer index raises the :exc:`IndexError` exception. (If any other " -"exception is raised, it is as if :keyword:`in` raised that exception)." +"Lastly, the old-style iteration protocol is tried: if a class " +"defines :meth:`~object.__getitem__`, ``x in y`` is ``True`` if and only if " +"there is a non-negative integer index *i* such that ``x is y[i] or x == " +"y[i]``, and no lower integer index raises the :exc:`IndexError` exception. " +"(If any other exception is raised, it is as if :keyword:`in` raised that " +"exception)." msgstr "" -#: ../../reference/expressions.rst:1737 +#: ../../reference/expressions.rst:1741 msgid "" "The operator :keyword:`not in` is defined to have the inverse truth value " "of :keyword:`in`." msgstr "" -#: ../../reference/expressions.rst:1750 +#: ../../reference/expressions.rst:1754 msgid "Identity comparisons" msgstr "" -#: ../../reference/expressions.rst:1752 +#: ../../reference/expressions.rst:1756 msgid "" "The operators :keyword:`is` and :keyword:`is not` test for an object's " "identity: ``x is y`` is true if and only if *x* and *y* are the same " @@ -1980,40 +1990,40 @@ msgid "" "``x is not y`` yields the inverse truth value. [#]_" msgstr "" -#: ../../reference/expressions.rst:1764 +#: ../../reference/expressions.rst:1768 msgid "Boolean operations" msgstr "" -#: ../../reference/expressions.rst:1775 +#: ../../reference/expressions.rst:1779 msgid "" "In the context of Boolean operations, and also when expressions are used by " "control flow statements, the following values are interpreted as false: " "``False``, ``None``, numeric zero of all types, and empty strings and " "containers (including strings, tuples, lists, dictionaries, sets and " "frozensets). All other values are interpreted as true. User-defined " -"objects can customize their truth value by providing a :meth:`~object." -"__bool__` method." +"objects can customize their truth value by providing " +"a :meth:`~object.__bool__` method." msgstr "" -#: ../../reference/expressions.rst:1784 +#: ../../reference/expressions.rst:1788 msgid "" "The operator :keyword:`not` yields ``True`` if its argument is false, " "``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1789 +#: ../../reference/expressions.rst:1793 msgid "" "The expression ``x and y`` first evaluates *x*; if *x* is false, its value " "is returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1794 +#: ../../reference/expressions.rst:1798 msgid "" "The expression ``x or y`` first evaluates *x*; if *x* is true, its value is " "returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1797 +#: ../../reference/expressions.rst:1801 msgid "" "Note that neither :keyword:`and` nor :keyword:`or` restrict the value and " "type they return to ``False`` and ``True``, but rather return the last " @@ -2024,23 +2034,23 @@ msgid "" "argument (for example, ``not 'foo'`` produces ``False`` rather than ``''``.)" msgstr "" -#: ../../reference/expressions.rst:1816 +#: ../../reference/expressions.rst:1820 msgid "Assignment expressions" msgstr "" -#: ../../reference/expressions.rst:1821 +#: ../../reference/expressions.rst:1825 msgid "" "An assignment expression (sometimes also called a \"named expression\" or " -"\"walrus\") assigns an :token:`~python-grammar:expression` to an :token:" -"`~python-grammar:identifier`, while also returning the value of the :token:" -"`~python-grammar:expression`." +"\"walrus\") assigns an :token:`~python-grammar:expression` to " +"an :token:`~python-grammar:identifier`, while also returning the value of " +"the :token:`~python-grammar:expression`." msgstr "" -#: ../../reference/expressions.rst:1826 +#: ../../reference/expressions.rst:1830 msgid "One common use case is when handling matched regular expressions:" msgstr "" -#: ../../reference/expressions.rst:1828 +#: ../../reference/expressions.rst:1832 msgid "" "if matching := pattern.search(data):\n" " do_something(matching)" @@ -2048,11 +2058,11 @@ msgstr "" "if matching := pattern.search(data):\n" " do_something(matching)" -#: ../../reference/expressions.rst:1833 +#: ../../reference/expressions.rst:1837 msgid "Or, when processing a file stream in chunks:" msgstr "" -#: ../../reference/expressions.rst:1835 +#: ../../reference/expressions.rst:1839 msgid "" "while chunk := file.read(9000):\n" " process(chunk)" @@ -2060,7 +2070,7 @@ msgstr "" "while chunk := file.read(9000):\n" " process(chunk)" -#: ../../reference/expressions.rst:1840 +#: ../../reference/expressions.rst:1844 msgid "" "Assignment expressions must be surrounded by parentheses when used as " "expression statements and when used as sub-expressions in slicing, " @@ -2070,36 +2080,36 @@ msgid "" "and ``while`` statements." msgstr "" -#: ../../reference/expressions.rst:1848 +#: ../../reference/expressions.rst:1852 msgid "See :pep:`572` for more details about assignment expressions." msgstr "" -#: ../../reference/expressions.rst:1855 +#: ../../reference/expressions.rst:1859 msgid "Conditional expressions" msgstr "" -#: ../../reference/expressions.rst:1867 +#: ../../reference/expressions.rst:1871 msgid "" "Conditional expressions (sometimes called a \"ternary operator\") have the " "lowest priority of all Python operations." msgstr "" -#: ../../reference/expressions.rst:1870 +#: ../../reference/expressions.rst:1874 msgid "" "The expression ``x if C else y`` first evaluates the condition, *C* rather " "than *x*. If *C* is true, *x* is evaluated and its value is returned; " "otherwise, *y* is evaluated and its value is returned." msgstr "" -#: ../../reference/expressions.rst:1874 +#: ../../reference/expressions.rst:1878 msgid "See :pep:`308` for more details about conditional expressions." msgstr "" -#: ../../reference/expressions.rst:1881 +#: ../../reference/expressions.rst:1885 msgid "Lambdas" msgstr "" -#: ../../reference/expressions.rst:1892 +#: ../../reference/expressions.rst:1896 msgid "" "Lambda expressions (sometimes called lambda forms) are used to create " "anonymous functions. The expression ``lambda parameters: expression`` yields " @@ -2107,7 +2117,7 @@ msgid "" "defined with:" msgstr "" -#: ../../reference/expressions.rst:1896 +#: ../../reference/expressions.rst:1900 msgid "" "def <lambda>(parameters):\n" " return expression" @@ -2115,25 +2125,25 @@ msgstr "" "def <lambda>(parameters):\n" " return expression" -#: ../../reference/expressions.rst:1901 +#: ../../reference/expressions.rst:1905 msgid "" "See section :ref:`function` for the syntax of parameter lists. Note that " "functions created with lambda expressions cannot contain statements or " "annotations." msgstr "" -#: ../../reference/expressions.rst:1909 +#: ../../reference/expressions.rst:1913 msgid "Expression lists" msgstr "" -#: ../../reference/expressions.rst:1925 +#: ../../reference/expressions.rst:1929 msgid "" "Except when part of a list or set display, an expression list containing at " "least one comma yields a tuple. The length of the tuple is the number of " "expressions in the list. The expressions are evaluated from left to right." msgstr "" -#: ../../reference/expressions.rst:1934 +#: ../../reference/expressions.rst:1938 msgid "" "An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be " "an :term:`iterable`. The iterable is expanded into a sequence of items, " @@ -2141,42 +2151,42 @@ msgid "" "unpacking." msgstr "" -#: ../../reference/expressions.rst:1939 +#: ../../reference/expressions.rst:1943 msgid "" "Iterable unpacking in expression lists, originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1942 +#: ../../reference/expressions.rst:1946 msgid "Any item in an expression list may be starred. See :pep:`646`." msgstr "" -#: ../../reference/expressions.rst:1947 +#: ../../reference/expressions.rst:1951 msgid "" -"A trailing comma is required only to create a one-item tuple, such as ``1," -"``; it is optional in all other cases. A single expression without a " +"A trailing comma is required only to create a one-item tuple, such as " +"``1,``; it is optional in all other cases. A single expression without a " "trailing comma doesn't create a tuple, but rather yields the value of that " "expression. (To create an empty tuple, use an empty pair of parentheses: " "``()``.)" msgstr "" -#: ../../reference/expressions.rst:1958 +#: ../../reference/expressions.rst:1962 msgid "Evaluation order" msgstr "" -#: ../../reference/expressions.rst:1962 +#: ../../reference/expressions.rst:1966 msgid "" "Python evaluates expressions from left to right. Notice that while " "evaluating an assignment, the right-hand side is evaluated before the left-" "hand side." msgstr "" -#: ../../reference/expressions.rst:1965 +#: ../../reference/expressions.rst:1969 msgid "" "In the following lines, expressions will be evaluated in the arithmetic " "order of their suffixes::" msgstr "" -#: ../../reference/expressions.rst:1968 +#: ../../reference/expressions.rst:1972 msgid "" "expr1, expr2, expr3, expr4\n" "(expr1, expr2, expr3, expr4)\n" @@ -2192,11 +2202,11 @@ msgstr "" "expr1(expr2, expr3, *expr4, **expr5)\n" "expr3, expr4 = expr1, expr2" -#: ../../reference/expressions.rst:1979 +#: ../../reference/expressions.rst:1983 msgid "Operator precedence" msgstr "" -#: ../../reference/expressions.rst:1984 +#: ../../reference/expressions.rst:1988 msgid "" "The following table summarizes the operator precedence in Python, from " "highest precedence (most binding) to lowest precedence (least binding). " @@ -2206,176 +2216,176 @@ msgid "" "group from right to left)." msgstr "" -#: ../../reference/expressions.rst:1990 +#: ../../reference/expressions.rst:1994 msgid "" "Note that comparisons, membership tests, and identity tests, all have the " "same precedence and have a left-to-right chaining feature as described in " "the :ref:`comparisons` section." msgstr "" -#: ../../reference/expressions.rst:1996 +#: ../../reference/expressions.rst:2000 msgid "Operator" msgstr "運算子" -#: ../../reference/expressions.rst:1996 +#: ../../reference/expressions.rst:2000 msgid "Description" msgstr "描述" -#: ../../reference/expressions.rst:1998 +#: ../../reference/expressions.rst:2002 msgid "``(expressions...)``," msgstr "``(expressions...)``," -#: ../../reference/expressions.rst:2000 +#: ../../reference/expressions.rst:2004 msgid "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" msgstr "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" -#: ../../reference/expressions.rst:1998 +#: ../../reference/expressions.rst:2002 msgid "" "Binding or parenthesized expression, list display, dictionary display, set " "display" msgstr "" -#: ../../reference/expressions.rst:2004 +#: ../../reference/expressions.rst:2008 msgid "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" msgstr "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" -#: ../../reference/expressions.rst:2004 +#: ../../reference/expressions.rst:2008 msgid "Subscription, slicing, call, attribute reference" msgstr "" -#: ../../reference/expressions.rst:2007 +#: ../../reference/expressions.rst:2011 msgid ":keyword:`await x <await>`" msgstr ":keyword:`await x <await>`" -#: ../../reference/expressions.rst:2009 +#: ../../reference/expressions.rst:2013 msgid "``**``" msgstr "``**``" -#: ../../reference/expressions.rst:2009 +#: ../../reference/expressions.rst:2013 msgid "Exponentiation [#]_" msgstr "" -#: ../../reference/expressions.rst:2011 +#: ../../reference/expressions.rst:2015 msgid "``+x``, ``-x``, ``~x``" msgstr "``+x``, ``-x``, ``~x``" -#: ../../reference/expressions.rst:2011 +#: ../../reference/expressions.rst:2015 msgid "Positive, negative, bitwise NOT" msgstr "" -#: ../../reference/expressions.rst:2013 +#: ../../reference/expressions.rst:2017 msgid "``*``, ``@``, ``/``, ``//``, ``%``" msgstr "``*``, ``@``, ``/``, ``//``, ``%``" -#: ../../reference/expressions.rst:2013 +#: ../../reference/expressions.rst:2017 msgid "" "Multiplication, matrix multiplication, division, floor division, remainder " "[#]_" msgstr "" -#: ../../reference/expressions.rst:2017 +#: ../../reference/expressions.rst:2021 msgid "``+``, ``-``" msgstr "``+``, ``-``" -#: ../../reference/expressions.rst:2017 +#: ../../reference/expressions.rst:2021 msgid "Addition and subtraction" msgstr "" -#: ../../reference/expressions.rst:2019 +#: ../../reference/expressions.rst:2023 msgid "``<<``, ``>>``" msgstr "``<<``, ``>>``" -#: ../../reference/expressions.rst:2019 +#: ../../reference/expressions.rst:2023 msgid "Shifts" msgstr "" -#: ../../reference/expressions.rst:2021 +#: ../../reference/expressions.rst:2025 msgid "``&``" msgstr "``&``" -#: ../../reference/expressions.rst:2021 +#: ../../reference/expressions.rst:2025 msgid "Bitwise AND" msgstr "" -#: ../../reference/expressions.rst:2023 +#: ../../reference/expressions.rst:2027 msgid "``^``" msgstr "``^``" -#: ../../reference/expressions.rst:2023 +#: ../../reference/expressions.rst:2027 msgid "Bitwise XOR" msgstr "" -#: ../../reference/expressions.rst:2025 +#: ../../reference/expressions.rst:2029 msgid "``|``" msgstr "``|``" -#: ../../reference/expressions.rst:2025 +#: ../../reference/expressions.rst:2029 msgid "Bitwise OR" msgstr "" -#: ../../reference/expressions.rst:2027 +#: ../../reference/expressions.rst:2031 msgid "" ":keyword:`in`, :keyword:`not in`, :keyword:`is`, :keyword:`is not`, ``<``, " "``<=``, ``>``, ``>=``, ``!=``, ``==``" msgstr "" -#: ../../reference/expressions.rst:2027 +#: ../../reference/expressions.rst:2031 msgid "Comparisons, including membership tests and identity tests" msgstr "" -#: ../../reference/expressions.rst:2031 +#: ../../reference/expressions.rst:2035 msgid ":keyword:`not x <not>`" msgstr ":keyword:`not x <not>`" -#: ../../reference/expressions.rst:2031 +#: ../../reference/expressions.rst:2035 msgid "Boolean NOT" msgstr "" -#: ../../reference/expressions.rst:2033 +#: ../../reference/expressions.rst:2037 msgid ":keyword:`and`" msgstr ":keyword:`and`" -#: ../../reference/expressions.rst:2033 +#: ../../reference/expressions.rst:2037 msgid "Boolean AND" msgstr "" -#: ../../reference/expressions.rst:2035 +#: ../../reference/expressions.rst:2039 msgid ":keyword:`or`" msgstr ":keyword:`or`" -#: ../../reference/expressions.rst:2035 +#: ../../reference/expressions.rst:2039 msgid "Boolean OR" msgstr "" -#: ../../reference/expressions.rst:2037 +#: ../../reference/expressions.rst:2041 msgid ":keyword:`if <if_expr>` -- :keyword:`!else`" msgstr ":keyword:`if <if_expr>` -- :keyword:`!else`" -#: ../../reference/expressions.rst:2037 +#: ../../reference/expressions.rst:2041 msgid "Conditional expression" msgstr "" -#: ../../reference/expressions.rst:2039 +#: ../../reference/expressions.rst:2043 msgid ":keyword:`lambda`" msgstr ":keyword:`lambda`" -#: ../../reference/expressions.rst:2039 +#: ../../reference/expressions.rst:2043 msgid "Lambda expression" msgstr "" -#: ../../reference/expressions.rst:2041 +#: ../../reference/expressions.rst:2045 msgid "``:=``" msgstr "``:=``" -#: ../../reference/expressions.rst:2041 +#: ../../reference/expressions.rst:2045 msgid "Assignment expression" msgstr "" -#: ../../reference/expressions.rst:2046 +#: ../../reference/expressions.rst:2050 msgid "Footnotes" msgstr "註解" -#: ../../reference/expressions.rst:2047 +#: ../../reference/expressions.rst:2051 msgid "" "While ``abs(x%y) < abs(y)`` is true mathematically, for floats it may not be " "true numerically due to roundoff. For example, and assuming a platform on " @@ -2387,7 +2397,7 @@ msgid "" "approach is more appropriate depends on the application." msgstr "" -#: ../../reference/expressions.rst:2056 +#: ../../reference/expressions.rst:2060 msgid "" "If x is very close to an exact integer multiple of y, it's possible for ``x//" "y`` to be one larger than ``(x-x%y)//y`` due to rounding. In such cases, " @@ -2395,7 +2405,7 @@ msgid "" "* y + x % y`` be very close to ``x``." msgstr "" -#: ../../reference/expressions.rst:2061 +#: ../../reference/expressions.rst:2065 msgid "" "The Unicode standard distinguishes between :dfn:`code points` (e.g. U+0041) " "and :dfn:`abstract characters` (e.g. \"LATIN CAPITAL LETTER A\"). While most " @@ -2409,7 +2419,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: ../../reference/expressions.rst:2072 +#: ../../reference/expressions.rst:2076 msgid "" "The comparison operators on strings compare at the level of Unicode code " "points. This may be counter-intuitive to humans. For example, ``\"\\u00C7\" " @@ -2417,13 +2427,13 @@ msgid "" "same abstract character \"LATIN CAPITAL LETTER C WITH CEDILLA\"." msgstr "" -#: ../../reference/expressions.rst:2077 +#: ../../reference/expressions.rst:2081 msgid "" "To compare strings at the level of abstract characters (that is, in a way " "intuitive to humans), use :func:`unicodedata.normalize`." msgstr "" -#: ../../reference/expressions.rst:2080 +#: ../../reference/expressions.rst:2084 msgid "" "Due to automatic garbage-collection, free lists, and the dynamic nature of " "descriptors, you may notice seemingly unusual behaviour in certain uses of " @@ -2431,22 +2441,22 @@ msgid "" "instance methods, or constants. Check their documentation for more info." msgstr "" -#: ../../reference/expressions.rst:2085 +#: ../../reference/expressions.rst:2089 msgid "" "The power operator ``**`` binds less tightly than an arithmetic or bitwise " "unary operator on its right, that is, ``2**-1`` is ``0.5``." msgstr "" -#: ../../reference/expressions.rst:2088 +#: ../../reference/expressions.rst:2092 msgid "" "The ``%`` operator is also used for string formatting; the same precedence " "applies." msgstr "" #: ../../reference/expressions.rst:8 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1766 -#: ../../reference/expressions.rst:1806 ../../reference/expressions.rst:1857 -#: ../../reference/expressions.rst:1883 ../../reference/expressions.rst:1911 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1770 +#: ../../reference/expressions.rst:1810 ../../reference/expressions.rst:1861 +#: ../../reference/expressions.rst:1887 ../../reference/expressions.rst:1915 msgid "expression" msgstr "" @@ -2454,8 +2464,8 @@ msgstr "" msgid "BNF" msgstr "BNF" -#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1258 -#: ../../reference/expressions.rst:1306 +#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1262 +#: ../../reference/expressions.rst:1310 msgid "arithmetic" msgstr "" @@ -2477,9 +2487,9 @@ msgstr "" #: ../../reference/expressions.rst:74 ../../reference/expressions.rst:569 #: ../../reference/expressions.rst:624 ../../reference/expressions.rst:753 -#: ../../reference/expressions.rst:805 ../../reference/expressions.rst:851 -#: ../../reference/expressions.rst:1295 ../../reference/expressions.rst:1344 -#: ../../reference/expressions.rst:1440 +#: ../../reference/expressions.rst:808 ../../reference/expressions.rst:855 +#: ../../reference/expressions.rst:1299 ../../reference/expressions.rst:1348 +#: ../../reference/expressions.rst:1444 msgid "exception" msgstr "" @@ -2519,11 +2529,11 @@ msgstr "type(型別)" #: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 #: ../../reference/expressions.rst:372 ../../reference/expressions.rst:393 #: ../../reference/expressions.rst:557 ../../reference/expressions.rst:743 -#: ../../reference/expressions.rst:851 ../../reference/expressions.rst:880 -#: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1001 -#: ../../reference/expressions.rst:1149 ../../reference/expressions.rst:1163 -#: ../../reference/expressions.rst:1177 ../../reference/expressions.rst:1184 -#: ../../reference/expressions.rst:1731 ../../reference/expressions.rst:1923 +#: ../../reference/expressions.rst:855 ../../reference/expressions.rst:884 +#: ../../reference/expressions.rst:961 ../../reference/expressions.rst:1005 +#: ../../reference/expressions.rst:1153 ../../reference/expressions.rst:1167 +#: ../../reference/expressions.rst:1181 ../../reference/expressions.rst:1188 +#: ../../reference/expressions.rst:1735 ../../reference/expressions.rst:1927 msgid "object" msgstr "object(物件)" @@ -2532,7 +2542,7 @@ msgid "parenthesized form" msgstr "" #: ../../reference/expressions.rst:162 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1005 msgid "() (parentheses)" msgstr "() (圓括號)" @@ -2544,19 +2554,19 @@ msgstr "" msgid "empty" msgstr "" -#: ../../reference/expressions.rst:175 ../../reference/expressions.rst:880 -#: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1923 +#: ../../reference/expressions.rst:175 ../../reference/expressions.rst:884 +#: ../../reference/expressions.rst:961 ../../reference/expressions.rst:1927 msgid "tuple" msgstr "" -#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1945 +#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1949 msgid "comma" msgstr "" #: ../../reference/expressions.rst:181 ../../reference/expressions.rst:275 #: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 -#: ../../reference/expressions.rst:951 ../../reference/expressions.rst:1001 -#: ../../reference/expressions.rst:1911 +#: ../../reference/expressions.rst:955 ../../reference/expressions.rst:1005 +#: ../../reference/expressions.rst:1915 msgid ", (comma)" msgstr ", (逗號)" @@ -2573,7 +2583,7 @@ msgstr "for" msgid "in comprehensions" msgstr "於 comprehensions(綜合運算)" -#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1857 +#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1861 msgid "if" msgstr "if" @@ -2581,13 +2591,13 @@ msgstr "if" msgid "async for" msgstr "async for" -#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1202 +#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1206 msgid "await" msgstr "await" -#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:851 -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:957 -#: ../../reference/expressions.rst:1911 +#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:855 +#: ../../reference/expressions.rst:884 ../../reference/expressions.rst:961 +#: ../../reference/expressions.rst:1915 msgid "list" msgstr "list(串列)" @@ -2596,7 +2606,7 @@ msgstr "list(串列)" msgid "display" msgstr "" -#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:876 +#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:880 msgid "[] (square brackets)" msgstr "[] (方括號)" @@ -2605,7 +2615,7 @@ msgid "list expression" msgstr "list expression(串列運算式)" #: ../../reference/expressions.rst:275 ../../reference/expressions.rst:301 -#: ../../reference/expressions.rst:1911 +#: ../../reference/expressions.rst:1915 msgid "expression list" msgstr "expression list(運算式串列)" @@ -2622,7 +2632,7 @@ msgid "set expression" msgstr "set expression(集合運算式)" #: ../../reference/expressions.rst:329 ../../reference/expressions.rst:355 -#: ../../reference/expressions.rst:880 +#: ../../reference/expressions.rst:884 msgid "dictionary" msgstr "dictionary(字典)" @@ -2642,8 +2652,8 @@ msgstr "key/value pair(鍵/值對)" msgid "dictionary expression" msgstr "dictionary expression(字典運算式)" -#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:951 -#: ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:955 +#: ../../reference/expressions.rst:1887 msgid ": (colon)" msgstr ": (冒號)" @@ -2655,13 +2665,13 @@ msgstr "於字典運算式" msgid "in dictionary displays" msgstr "於字典顯示" -#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1084 -#: ../../reference/expressions.rst:1930 +#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1088 +#: ../../reference/expressions.rst:1934 msgid "unpacking" msgstr "unpacking(解包)" -#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1114 -#: ../../reference/expressions.rst:1222 +#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1118 +#: ../../reference/expressions.rst:1226 msgid "**" msgstr "**" @@ -2678,7 +2688,7 @@ msgstr "generator(產生器)" msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1202 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1206 msgid "keyword" msgstr "keyword(關鍵字)" @@ -2690,8 +2700,8 @@ msgstr "yield" msgid "from" msgstr "from" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1149 -#: ../../reference/expressions.rst:1163 ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1153 +#: ../../reference/expressions.rst:1167 ../../reference/expressions.rst:1887 msgid "function" msgstr "function (函式)" @@ -2707,7 +2717,7 @@ msgstr "yield from expression(yield from 運算式)" msgid "StopIteration" msgstr "StopIteration" -#: ../../reference/expressions.rst:624 ../../reference/expressions.rst:805 +#: ../../reference/expressions.rst:624 ../../reference/expressions.rst:808 msgid "GeneratorExit" msgstr "GeneratorExit" @@ -2723,488 +2733,488 @@ msgstr "asynchronous-generator(非同步產生器)" msgid "StopAsyncIteration" msgstr "StopAsyncIteration" -#: ../../reference/expressions.rst:828 +#: ../../reference/expressions.rst:832 msgid "primary" msgstr "primary(主要)" -#: ../../reference/expressions.rst:842 +#: ../../reference/expressions.rst:846 msgid "attribute" msgstr "attribute(屬性)" -#: ../../reference/expressions.rst:842 +#: ../../reference/expressions.rst:846 msgid "reference" msgstr "reference(參照)" -#: ../../reference/expressions.rst:842 +#: ../../reference/expressions.rst:846 msgid ". (dot)" msgstr ". (點)" -#: ../../reference/expressions.rst:842 +#: ../../reference/expressions.rst:846 msgid "attribute reference" msgstr "attribute reference(屬性參照)" -#: ../../reference/expressions.rst:851 +#: ../../reference/expressions.rst:855 msgid "AttributeError" msgstr "AttributeError" -#: ../../reference/expressions.rst:851 +#: ../../reference/expressions.rst:855 msgid "module" msgstr "module(模組)" -#: ../../reference/expressions.rst:876 +#: ../../reference/expressions.rst:880 msgid "subscription" msgstr "subscription(下標)" -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:957 -#: ../../reference/expressions.rst:1731 +#: ../../reference/expressions.rst:884 ../../reference/expressions.rst:961 +#: ../../reference/expressions.rst:1735 msgid "sequence" msgstr "sequence(序列)" -#: ../../reference/expressions.rst:880 +#: ../../reference/expressions.rst:884 msgid "mapping" msgstr "mapping(對映)" -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:937 -#: ../../reference/expressions.rst:957 +#: ../../reference/expressions.rst:884 ../../reference/expressions.rst:941 +#: ../../reference/expressions.rst:961 msgid "string" msgstr "string(字串)" -#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:937 +#: ../../reference/expressions.rst:884 ../../reference/expressions.rst:941 msgid "item" msgstr "item(項目)" -#: ../../reference/expressions.rst:937 +#: ../../reference/expressions.rst:941 msgid "character" msgstr "character(字元)" -#: ../../reference/expressions.rst:951 +#: ../../reference/expressions.rst:955 msgid "slicing" msgstr "slicing(切片)" -#: ../../reference/expressions.rst:951 +#: ../../reference/expressions.rst:955 msgid "slice" msgstr "slice(切片)" -#: ../../reference/expressions.rst:983 +#: ../../reference/expressions.rst:987 msgid "start (slice object attribute)" msgstr "start(切片物件屬性)" -#: ../../reference/expressions.rst:983 +#: ../../reference/expressions.rst:987 msgid "stop (slice object attribute)" msgstr "stop(切片物件屬性)" -#: ../../reference/expressions.rst:983 +#: ../../reference/expressions.rst:987 msgid "step (slice object attribute)" msgstr "step(切片物件屬性)" -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1005 msgid "callable" msgstr "callable(可呼叫物件)" -#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1149 -#: ../../reference/expressions.rst:1163 ../../reference/expressions.rst:1177 -#: ../../reference/expressions.rst:1184 ../../reference/expressions.rst:1194 +#: ../../reference/expressions.rst:1005 ../../reference/expressions.rst:1153 +#: ../../reference/expressions.rst:1167 ../../reference/expressions.rst:1181 +#: ../../reference/expressions.rst:1188 ../../reference/expressions.rst:1198 msgid "call" msgstr "call(呼叫)" -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1005 msgid "argument" msgstr "argument(引數)" -#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1034 +#: ../../reference/expressions.rst:1005 ../../reference/expressions.rst:1038 msgid "call semantics" msgstr "call semantics(呼叫語意)" -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1005 msgid "argument list" msgstr "argument list(引數列表)" -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1005 msgid "= (equals)" -msgstr "= (等於)" +msgstr "= (等號)" -#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1084 -#: ../../reference/expressions.rst:1114 +#: ../../reference/expressions.rst:1005 ../../reference/expressions.rst:1088 +#: ../../reference/expressions.rst:1118 msgid "in function calls" msgstr "於函式呼叫中" -#: ../../reference/expressions.rst:1034 +#: ../../reference/expressions.rst:1038 msgid "parameter" msgstr "parameter(參數)" -#: ../../reference/expressions.rst:1084 ../../reference/expressions.rst:1319 -#: ../../reference/expressions.rst:1930 +#: ../../reference/expressions.rst:1088 ../../reference/expressions.rst:1323 +#: ../../reference/expressions.rst:1934 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/expressions.rst:1149 +#: ../../reference/expressions.rst:1153 msgid "user-defined" msgstr "user-defined(使用者定義)" -#: ../../reference/expressions.rst:1149 +#: ../../reference/expressions.rst:1153 msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" -#: ../../reference/expressions.rst:1163 +#: ../../reference/expressions.rst:1167 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../reference/expressions.rst:1163 +#: ../../reference/expressions.rst:1167 msgid "method" msgstr "method(方法)" -#: ../../reference/expressions.rst:1163 +#: ../../reference/expressions.rst:1167 msgid "built-in method" msgstr "built-in method(內建方法)" -#: ../../reference/expressions.rst:1177 +#: ../../reference/expressions.rst:1181 msgid "class" msgstr "class(類別)" -#: ../../reference/expressions.rst:1177 +#: ../../reference/expressions.rst:1181 msgid "class object" msgstr "class object(類別物件)" -#: ../../reference/expressions.rst:1184 +#: ../../reference/expressions.rst:1188 msgid "class instance" msgstr "class instance(類別實例)" -#: ../../reference/expressions.rst:1184 ../../reference/expressions.rst:1194 +#: ../../reference/expressions.rst:1188 ../../reference/expressions.rst:1198 msgid "instance" msgstr "instance(實例)" -#: ../../reference/expressions.rst:1194 +#: ../../reference/expressions.rst:1198 msgid "__call__() (object method)" msgstr "__call__() (物件方法)" -#: ../../reference/expressions.rst:1222 +#: ../../reference/expressions.rst:1226 msgid "power" msgstr "power(次方)" -#: ../../reference/expressions.rst:1222 ../../reference/expressions.rst:1258 -#: ../../reference/expressions.rst:1306 ../../reference/expressions.rst:1422 -#: ../../reference/expressions.rst:1451 ../../reference/expressions.rst:1766 +#: ../../reference/expressions.rst:1226 ../../reference/expressions.rst:1262 +#: ../../reference/expressions.rst:1310 ../../reference/expressions.rst:1426 +#: ../../reference/expressions.rst:1455 ../../reference/expressions.rst:1770 msgid "operation" msgstr "operation(操作)" -#: ../../reference/expressions.rst:1222 ../../reference/expressions.rst:1267 -#: ../../reference/expressions.rst:1276 ../../reference/expressions.rst:1284 -#: ../../reference/expressions.rst:1319 ../../reference/expressions.rst:1332 -#: ../../reference/expressions.rst:1344 ../../reference/expressions.rst:1362 -#: ../../reference/expressions.rst:1392 ../../reference/expressions.rst:1405 -#: ../../reference/expressions.rst:1422 ../../reference/expressions.rst:1460 -#: ../../reference/expressions.rst:1468 ../../reference/expressions.rst:1477 -#: ../../reference/expressions.rst:1492 ../../reference/expressions.rst:1731 -#: ../../reference/expressions.rst:1740 ../../reference/expressions.rst:1782 -#: ../../reference/expressions.rst:1787 ../../reference/expressions.rst:1792 -#: ../../reference/expressions.rst:1857 ../../reference/expressions.rst:1981 +#: ../../reference/expressions.rst:1226 ../../reference/expressions.rst:1271 +#: ../../reference/expressions.rst:1280 ../../reference/expressions.rst:1288 +#: ../../reference/expressions.rst:1323 ../../reference/expressions.rst:1336 +#: ../../reference/expressions.rst:1348 ../../reference/expressions.rst:1366 +#: ../../reference/expressions.rst:1396 ../../reference/expressions.rst:1409 +#: ../../reference/expressions.rst:1426 ../../reference/expressions.rst:1464 +#: ../../reference/expressions.rst:1472 ../../reference/expressions.rst:1481 +#: ../../reference/expressions.rst:1496 ../../reference/expressions.rst:1735 +#: ../../reference/expressions.rst:1744 ../../reference/expressions.rst:1786 +#: ../../reference/expressions.rst:1791 ../../reference/expressions.rst:1796 +#: ../../reference/expressions.rst:1861 ../../reference/expressions.rst:1985 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/expressions.rst:1258 +#: ../../reference/expressions.rst:1262 msgid "unary" msgstr "unary(一元)" -#: ../../reference/expressions.rst:1258 ../../reference/expressions.rst:1451 -#: ../../reference/expressions.rst:1460 ../../reference/expressions.rst:1468 -#: ../../reference/expressions.rst:1477 +#: ../../reference/expressions.rst:1262 ../../reference/expressions.rst:1455 +#: ../../reference/expressions.rst:1464 ../../reference/expressions.rst:1472 +#: ../../reference/expressions.rst:1481 msgid "bitwise" msgstr "bitwise(位元)" -#: ../../reference/expressions.rst:1267 +#: ../../reference/expressions.rst:1271 msgid "negation" msgstr "negation(否定)" -#: ../../reference/expressions.rst:1267 +#: ../../reference/expressions.rst:1271 msgid "minus" msgstr "minus(減)" -#: ../../reference/expressions.rst:1267 ../../reference/expressions.rst:1405 +#: ../../reference/expressions.rst:1271 ../../reference/expressions.rst:1409 msgid "- (minus)" msgstr "- (減號)" -#: ../../reference/expressions.rst:1267 ../../reference/expressions.rst:1276 +#: ../../reference/expressions.rst:1271 ../../reference/expressions.rst:1280 msgid "unary operator" msgstr "unary operator(一元運算子)" -#: ../../reference/expressions.rst:1276 +#: ../../reference/expressions.rst:1280 msgid "plus" msgstr "plus(加)" -#: ../../reference/expressions.rst:1276 ../../reference/expressions.rst:1392 +#: ../../reference/expressions.rst:1280 ../../reference/expressions.rst:1396 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../reference/expressions.rst:1284 +#: ../../reference/expressions.rst:1288 msgid "inversion" msgstr "inversion(反轉)" -#: ../../reference/expressions.rst:1284 +#: ../../reference/expressions.rst:1288 msgid "~ (tilde)" msgstr "~ (波浪號)" -#: ../../reference/expressions.rst:1295 +#: ../../reference/expressions.rst:1299 msgid "TypeError" msgstr "TypeError" -#: ../../reference/expressions.rst:1306 ../../reference/expressions.rst:1451 +#: ../../reference/expressions.rst:1310 ../../reference/expressions.rst:1455 msgid "binary" msgstr "binary(二進位)" -#: ../../reference/expressions.rst:1319 +#: ../../reference/expressions.rst:1323 msgid "multiplication" msgstr "multiplication(乘)" -#: ../../reference/expressions.rst:1332 +#: ../../reference/expressions.rst:1336 msgid "matrix multiplication" msgstr "matrix multiplication(矩陣乘法)" -#: ../../reference/expressions.rst:1332 +#: ../../reference/expressions.rst:1336 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/expressions.rst:1344 +#: ../../reference/expressions.rst:1348 msgid "ZeroDivisionError" msgstr "ZeroDivisionError" -#: ../../reference/expressions.rst:1344 +#: ../../reference/expressions.rst:1348 msgid "division" msgstr "division(除)" -#: ../../reference/expressions.rst:1344 +#: ../../reference/expressions.rst:1348 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/expressions.rst:1344 +#: ../../reference/expressions.rst:1348 msgid "//" msgstr "//" -#: ../../reference/expressions.rst:1362 +#: ../../reference/expressions.rst:1366 msgid "modulo" msgstr "modulo(餘數)" -#: ../../reference/expressions.rst:1362 +#: ../../reference/expressions.rst:1366 msgid "% (percent)" msgstr "% (百分號)" -#: ../../reference/expressions.rst:1392 +#: ../../reference/expressions.rst:1396 msgid "addition" msgstr "addition(加)" -#: ../../reference/expressions.rst:1392 ../../reference/expressions.rst:1405 +#: ../../reference/expressions.rst:1396 ../../reference/expressions.rst:1409 msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../reference/expressions.rst:1405 +#: ../../reference/expressions.rst:1409 msgid "subtraction" msgstr "subtraction(減)" -#: ../../reference/expressions.rst:1422 +#: ../../reference/expressions.rst:1426 msgid "shifting" msgstr "shifting(移動)" -#: ../../reference/expressions.rst:1422 +#: ../../reference/expressions.rst:1426 msgid "<<" msgstr "<<" -#: ../../reference/expressions.rst:1422 +#: ../../reference/expressions.rst:1426 msgid ">>" msgstr ">>" -#: ../../reference/expressions.rst:1440 +#: ../../reference/expressions.rst:1444 msgid "ValueError" msgstr "ValueError" -#: ../../reference/expressions.rst:1460 ../../reference/expressions.rst:1787 +#: ../../reference/expressions.rst:1464 ../../reference/expressions.rst:1791 msgid "and" msgstr "and" -#: ../../reference/expressions.rst:1460 +#: ../../reference/expressions.rst:1464 msgid "& (ampersand)" msgstr "& (和號)" -#: ../../reference/expressions.rst:1468 +#: ../../reference/expressions.rst:1472 msgid "xor" msgstr "xor" -#: ../../reference/expressions.rst:1468 +#: ../../reference/expressions.rst:1472 msgid "exclusive" msgstr "exclusive(排外)" -#: ../../reference/expressions.rst:1468 ../../reference/expressions.rst:1477 -#: ../../reference/expressions.rst:1792 +#: ../../reference/expressions.rst:1472 ../../reference/expressions.rst:1481 +#: ../../reference/expressions.rst:1796 msgid "or" msgstr "or" -#: ../../reference/expressions.rst:1468 +#: ../../reference/expressions.rst:1472 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../reference/expressions.rst:1477 +#: ../../reference/expressions.rst:1481 msgid "inclusive" msgstr "inclusive(包含)" -#: ../../reference/expressions.rst:1477 +#: ../../reference/expressions.rst:1481 msgid "| (vertical bar)" msgstr "| (垂直線)" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "comparison" msgstr "comparison(比較)" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "C" msgstr "C" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "language" msgstr "language(語言)" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "< (less)" msgstr "< (小於)" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "> (greater)" msgstr "> (大於)" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "<=" msgstr "<=" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid ">=" msgstr ">=" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "==" msgstr "==" -#: ../../reference/expressions.rst:1492 +#: ../../reference/expressions.rst:1496 msgid "!=" msgstr "!=" -#: ../../reference/expressions.rst:1516 +#: ../../reference/expressions.rst:1520 msgid "chaining" msgstr "chaining(鏈接)" -#: ../../reference/expressions.rst:1516 +#: ../../reference/expressions.rst:1520 msgid "comparisons" msgstr "comparisons(比較)" -#: ../../reference/expressions.rst:1731 +#: ../../reference/expressions.rst:1735 msgid "in" msgstr "in" -#: ../../reference/expressions.rst:1731 +#: ../../reference/expressions.rst:1735 msgid "not in" msgstr "not in" -#: ../../reference/expressions.rst:1731 +#: ../../reference/expressions.rst:1735 msgid "membership" msgstr "membership(成員)" -#: ../../reference/expressions.rst:1731 ../../reference/expressions.rst:1740 +#: ../../reference/expressions.rst:1735 ../../reference/expressions.rst:1744 msgid "test" msgstr "test(測試)" -#: ../../reference/expressions.rst:1740 +#: ../../reference/expressions.rst:1744 msgid "is" msgstr "is" -#: ../../reference/expressions.rst:1740 +#: ../../reference/expressions.rst:1744 msgid "is not" msgstr "is not" -#: ../../reference/expressions.rst:1740 +#: ../../reference/expressions.rst:1744 msgid "identity" msgstr "identity" -#: ../../reference/expressions.rst:1766 +#: ../../reference/expressions.rst:1770 msgid "Conditional" msgstr "Conditional(條件式)" -#: ../../reference/expressions.rst:1766 +#: ../../reference/expressions.rst:1770 msgid "Boolean" msgstr "Boolean(布林)" -#: ../../reference/expressions.rst:1782 +#: ../../reference/expressions.rst:1786 msgid "not" msgstr "not" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1810 msgid ":= (colon equals)" msgstr ":= (冒號等於)" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1810 msgid "assignment expression" msgstr "assignment expression(賦值運算式)" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1810 msgid "walrus operator" msgstr "walrus operator(海象運算子)" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1810 msgid "named expression" msgstr "named expression(附名運算式)" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1810 msgid "assignment" msgstr "assignment(賦值)" -#: ../../reference/expressions.rst:1857 +#: ../../reference/expressions.rst:1861 msgid "conditional" msgstr "conditional(條件式)" -#: ../../reference/expressions.rst:1857 +#: ../../reference/expressions.rst:1861 msgid "ternary" msgstr "ternary(三元)" -#: ../../reference/expressions.rst:1857 +#: ../../reference/expressions.rst:1861 msgid "conditional expression" msgstr "conditional expression(條件運算式)" -#: ../../reference/expressions.rst:1857 +#: ../../reference/expressions.rst:1861 msgid "else" msgstr "else" -#: ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:1887 msgid "lambda" msgstr "lambda" -#: ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:1887 msgid "form" msgstr "form" -#: ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:1887 msgid "anonymous" msgstr "anonymous(匿名)" -#: ../../reference/expressions.rst:1883 +#: ../../reference/expressions.rst:1887 msgid "lambda expression" msgstr "lambda expression(lambda 運算式)" -#: ../../reference/expressions.rst:1930 +#: ../../reference/expressions.rst:1934 msgid "iterable" msgstr "iterable(可疊代)" -#: ../../reference/expressions.rst:1930 +#: ../../reference/expressions.rst:1934 msgid "in expression lists" msgstr "於 expression list(運算式串列)" -#: ../../reference/expressions.rst:1945 +#: ../../reference/expressions.rst:1949 msgid "trailing" msgstr "trailing" -#: ../../reference/expressions.rst:1960 +#: ../../reference/expressions.rst:1964 msgid "evaluation" msgstr "evaluation" -#: ../../reference/expressions.rst:1960 +#: ../../reference/expressions.rst:1964 msgid "order" msgstr "order(順序)" -#: ../../reference/expressions.rst:1981 +#: ../../reference/expressions.rst:1985 msgid "precedence" msgstr "precedence(優先順序)" diff --git a/reference/grammar.po b/reference/grammar.po index 14222d9038..24d3eb9b2c 100644 --- a/reference/grammar.po +++ b/reference/grammar.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"POT-Creation-Date: 2025-03-11 00:14+0000\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -285,8 +285,8 @@ msgid "" "import_from[stmt_ty]:\n" " | 'from' a=('.' | '...')* b=dotted_name 'import' c=import_from_targets " "{\n" -" _PyAST_ImportFrom(b->v.Name.id, c, _PyPegen_seq_count_dots(a), " -"EXTRA) }\n" +" _PyPegen_checked_future_import(p, b->v.Name.id, c, " +"_PyPegen_seq_count_dots(a), EXTRA) }\n" " | 'from' a=('.' | '...')+ 'import' b=import_from_targets {\n" " _PyAST_ImportFrom(NULL, b, _PyPegen_seq_count_dots(a), EXTRA) }\n" "import_from_targets[asdl_alias_seq*]:\n" @@ -401,10 +401,10 @@ msgid "" " | a[asdl_arg_seq*]=param_no_default+ '/' ',' { a }\n" " | a[asdl_arg_seq*]=param_no_default+ '/' &')' { a }\n" "slash_with_default[SlashWithDefault*]:\n" -" | a=param_no_default* b=param_with_default+ '/' ',' " -"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" -" | a=param_no_default* b=param_with_default+ '/' &')' " -"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=param_no_default* b=param_with_default+ '/' " +"',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=param_no_default* b=param_with_default+ '/' " +"&')' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" "\n" "star_etc[StarEtc*]:\n" " | invalid_star_etc\n" @@ -442,18 +442,18 @@ msgid "" "param_no_default_star_annotation[arg_ty]:\n" " | a=param_star_annotation ',' tc=TYPE_COMMENT? " "{ _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" -" | a=param_star_annotation tc=TYPE_COMMENT? &')' " -"{ _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" +" | a=param_star_annotation tc=TYPE_COMMENT? " +"&')' { _PyPegen_add_type_comment_to_arg(p, a, tc) }\n" "param_with_default[NameDefaultPair*]:\n" " | a=param c=default ',' tc=TYPE_COMMENT? { _PyPegen_name_default_pair(p, " "a, c, tc) }\n" -" | a=param c=default tc=TYPE_COMMENT? &')' " -"{ _PyPegen_name_default_pair(p, a, c, tc) }\n" +" | a=param c=default tc=TYPE_COMMENT? " +"&')' { _PyPegen_name_default_pair(p, a, c, tc) }\n" "param_maybe_default[NameDefaultPair*]:\n" " | a=param c=default? ',' tc=TYPE_COMMENT? " "{ _PyPegen_name_default_pair(p, a, c, tc) }\n" -" | a=param c=default? tc=TYPE_COMMENT? &')' " -"{ _PyPegen_name_default_pair(p, a, c, tc) }\n" +" | a=param c=default? tc=TYPE_COMMENT? " +"&')' { _PyPegen_name_default_pair(p, a, c, tc) }\n" "param[arg_ty]: a=NAME b=annotation? { _PyAST_arg(a->v.Name.id, b, NULL, " "EXTRA) }\n" "param_star_annotation[arg_ty]: a=NAME b=star_annotation { _PyAST_arg(a->v." @@ -683,10 +683,10 @@ msgid "" " | '(' pattern=pattern ')' { pattern }\n" "\n" "sequence_pattern[pattern_ty]:\n" -" | '[' patterns=maybe_sequence_pattern? ']' " -"{ _PyAST_MatchSequence(patterns, EXTRA) }\n" -" | '(' patterns=open_sequence_pattern? ')' " -"{ _PyAST_MatchSequence(patterns, EXTRA) }\n" +" | '[' patterns=maybe_sequence_pattern? " +"']' { _PyAST_MatchSequence(patterns, EXTRA) }\n" +" | '(' patterns=open_sequence_pattern? " +"')' { _PyAST_MatchSequence(patterns, EXTRA) }\n" "\n" "open_sequence_pattern[asdl_seq*]:\n" " | pattern=maybe_star_pattern ',' patterns=maybe_sequence_pattern? {\n" @@ -1067,10 +1067,10 @@ msgid "" " | a[asdl_arg_seq*]=lambda_param_no_default+ '/' &':' { a }\n" "\n" "lambda_slash_with_default[SlashWithDefault*]:\n" -" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' ',' " -"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" -" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' &':' " -"{ _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' " +"',' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" +" | a=lambda_param_no_default* b=lambda_param_with_default+ '/' " +"&':' { _PyPegen_slash_with_default(p, (asdl_arg_seq *)a, b) }\n" "\n" "lambda_star_etc[StarEtc*]:\n" " | invalid_lambda_star_etc\n" @@ -1190,8 +1190,8 @@ msgid "" " | invalid_comprehension\n" "\n" "genexp[expr_ty]:\n" -" | '(' a=( assignment_expression | expression !':=') b=for_if_clauses ')' " -"{ _PyAST_GeneratorExp(a, b, EXTRA) }\n" +" | '(' a=( assignment_expression | expression !':=') b=for_if_clauses " +"')' { _PyAST_GeneratorExp(a, b, EXTRA) }\n" " | invalid_comprehension\n" "\n" "dictcomp[expr_ty]:\n" @@ -1465,9 +1465,9 @@ msgid "" "annotation\") }\n" " | (star_targets '=')* a=star_expressions '=' {\n" " RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }\n" -" | (star_targets '=')* a=yield_expr '=' " -"{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"assignment to yield expression not " -"possible\") }\n" +" | (star_targets '=')* a=yield_expr " +"'=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"assignment to yield expression " +"not possible\") }\n" " | a=star_expressions augassign annotated_rhs {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" " a,\n" @@ -1528,8 +1528,8 @@ msgid "" "comment\") }\n" " | '*' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" "positional argument cannot have default value\") }\n" -" | '*' (param_no_default | ',') param_maybe_default* a='*' " -"(param_no_default | ',') {\n" +" | '*' (param_no_default | ',') param_maybe_default* " +"a='*' (param_no_default | ',') {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"* argument may appear only " "once\") }\n" "invalid_kwds:\n" @@ -1572,8 +1572,8 @@ msgid "" "must follow bare *\") }\n" " | '*' lambda_param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"var-" "positional argument cannot have default value\") }\n" -" | '*' (lambda_param_no_default | ',') lambda_param_maybe_default* a='*' " -"(lambda_param_no_default | ',') {\n" +" | '*' (lambda_param_no_default | ',') lambda_param_maybe_default* " +"a='*' (lambda_param_no_default | ',') {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"* argument may appear only " "once\") }\n" "invalid_lambda_kwds:\n" diff --git a/reference/import.po b/reference/import.po index 488f09805c..eeb49abbab 100644 --- a/reference/import.po +++ b/reference/import.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2025-02-15 16:37+0000\n" "PO-Revision-Date: 2024-11-06 14:55+0800\n" "Last-Translator: Ken Cheng <ken71301@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -232,11 +232,11 @@ msgstr "" "__init__.py``。隨後引入 ``parent.two`` 或 ``parent.three`` 將分別執行 " "``parent/two/__init__.py`` 和 ``parent/three/__init__.py``。" -#: ../../reference/import.rst:127 +#: ../../reference/import.rst:129 msgid "Namespace packages" msgstr "命名空間套件" -#: ../../reference/import.rst:133 +#: ../../reference/import.rst:135 msgid "" "A namespace package is a composite of various :term:`portions <portion>`, " "where each portion contributes a subpackage to the parent package. Portions " @@ -251,7 +251,7 @@ msgstr "" "中、網路上,或 Python 在引入時搜尋的任何其他地方。命名空間套件不一定直接對應" "於檔案系統中的對象;它們可能是沒有具體表示的虛擬模組。" -#: ../../reference/import.rst:141 +#: ../../reference/import.rst:143 msgid "" "Namespace packages do not use an ordinary list for their ``__path__`` " "attribute. They instead use a custom iterable type which will automatically " @@ -263,7 +263,7 @@ msgstr "" "別,當父套件的路徑(或頂層套件的 :data:`sys.path`)發生變化時,會在下一次引入" "嘗試時自動執行新一輪的套件部分搜尋。" -#: ../../reference/import.rst:147 +#: ../../reference/import.rst:149 msgid "" "With namespace packages, there is no ``parent/__init__.py`` file. In fact, " "there may be multiple ``parent`` directories found during import search, " @@ -278,15 +278,15 @@ msgstr "" "``parent`` 套件或其子套件之一時,Python 會為頂層 ``parent`` 套件建立一個命名" "空間套件。" -#: ../../reference/import.rst:154 +#: ../../reference/import.rst:156 msgid "See also :pep:`420` for the namespace package specification." msgstr "有關命名空間套件的規範,請參見 :pep:`420`。" -#: ../../reference/import.rst:158 +#: ../../reference/import.rst:160 msgid "Searching" msgstr "搜尋" -#: ../../reference/import.rst:160 +#: ../../reference/import.rst:162 msgid "" "To begin the search, Python needs the :term:`fully qualified <qualified " "name>` name of the module (or package, but for the purposes of this " @@ -300,7 +300,7 @@ msgstr "" "自 :keyword:`import` 陳述式的各種引數,或來自 :func:`importlib." "import_module` 或 :func:`__import__` 函式的參數。" -#: ../../reference/import.rst:166 +#: ../../reference/import.rst:168 msgid "" "This name will be used in various phases of the import search, and it may be " "the dotted path to a submodule, e.g. ``foo.bar.baz``. In this case, Python " @@ -313,11 +313,11 @@ msgstr "" "bar``,最後是 ``foo.bar.baz``。如果任何中間引入失敗,則會引發 :exc:" "`ModuleNotFoundError`。" -#: ../../reference/import.rst:173 +#: ../../reference/import.rst:175 msgid "The module cache" msgstr "模組快取" -#: ../../reference/import.rst:178 +#: ../../reference/import.rst:180 msgid "" "The first place checked during import search is :data:`sys.modules`. This " "mapping serves as a cache of all modules that have been previously imported, " @@ -331,7 +331,7 @@ msgstr "" "`sys.modules` 將包含 ``foo``、``foo.bar`` 和 ``foo.bar.baz`` 的條目。每個鍵的" "值都是相應的模組物件。" -#: ../../reference/import.rst:185 +#: ../../reference/import.rst:187 msgid "" "During import, the module name is looked up in :data:`sys.modules` and if " "present, the associated value is the module satisfying the import, and the " @@ -343,7 +343,7 @@ msgstr "" "滿足此引入的模組,此引入過程即完成。然而,如果值是 ``None``,則會引發 :exc:" "`ModuleNotFoundError`。如果模組名稱不存在,Python 會繼續搜尋該模組。" -#: ../../reference/import.rst:191 +#: ../../reference/import.rst:193 msgid "" ":data:`sys.modules` is writable. Deleting a key may not destroy the " "associated module (as other modules may hold references to it), but it will " @@ -357,7 +357,7 @@ msgstr "" "次引入該模組時重新搜尋。也可以將鍵賦值為 ``None``,這會強制下一次引入該模組時" "引發 :exc:`ModuleNotFoundError`。" -#: ../../reference/import.rst:198 +#: ../../reference/import.rst:200 msgid "" "Beware though, as if you keep a reference to the module object, invalidate " "its cache entry in :data:`sys.modules`, and then re-import the named module, " @@ -370,11 +370,11 @@ msgstr "" "func:`importlib.reload` 會重用\\ *相同的*\\ 模組物件,並透過重新執行模組的程" "式碼來簡單地重新初始化模組內容。" -#: ../../reference/import.rst:208 +#: ../../reference/import.rst:210 msgid "Finders and loaders" msgstr "尋檢器 (Finder) 與載入器 (Loader)" -#: ../../reference/import.rst:215 +#: ../../reference/import.rst:217 msgid "" "If the named module is not found in :data:`sys.modules`, then Python's " "import protocol is invoked to find and load the module. This protocol " @@ -391,7 +391,7 @@ msgstr "" "組。實作這兩個介面的物件稱為\\ :term:`引入器 (importer) <importer>` ——當它們" "發現可以載入所請求的模組時,會回傳它們自己。" -#: ../../reference/import.rst:223 +#: ../../reference/import.rst:225 msgid "" "Python includes a number of default finders and importers. The first one " "knows how to locate built-in modules, and the second knows how to locate " @@ -405,14 +405,14 @@ msgstr "" "組。:term:`import path` 是一個位置的列表,這些位置可能是檔案系統路徑或壓縮檔" "案,也可以擴展以搜尋任何可定位的資源,例如由 URL 識別的資源。" -#: ../../reference/import.rst:230 +#: ../../reference/import.rst:232 msgid "" "The import machinery is extensible, so new finders can be added to extend " "the range and scope of module searching." msgstr "" "引入機制是可擴展的,因此可以增加新的尋檢器來擴展模組搜尋的範圍和作用域。" -#: ../../reference/import.rst:233 +#: ../../reference/import.rst:235 msgid "" "Finders do not actually load modules. If they can find the named module, " "they return a :dfn:`module spec`, an encapsulation of the module's import-" @@ -423,7 +423,7 @@ msgstr "" "組規格`,這是一個模組的引入相關資訊的封裝,引入機制會在載入模組時使用這些資" "訊。" -#: ../../reference/import.rst:237 +#: ../../reference/import.rst:239 msgid "" "The following sections describe the protocol for finders and loaders in more " "detail, including how you can create and register new ones to extend the " @@ -432,7 +432,7 @@ msgstr "" "以下各節將更詳細地描述尋檢器和載入器的協定,包括如何建立和註冊新的尋檢器和載" "入器來擴展引入機制。" -#: ../../reference/import.rst:241 +#: ../../reference/import.rst:243 msgid "" "In previous versions of Python, finders returned :term:`loaders <loader>` " "directly, whereas now they return module specs which *contain* loaders. " @@ -442,11 +442,11 @@ msgstr "" "回傳的是\\ *包含*\\ 載入器的模組規格。載入器仍在引入過程中使用,但其責任減少" "了。" -#: ../../reference/import.rst:247 +#: ../../reference/import.rst:249 msgid "Import hooks" msgstr "引入掛鉤 (Import hooks)" -#: ../../reference/import.rst:257 +#: ../../reference/import.rst:259 msgid "" "The import machinery is designed to be extensible; the primary mechanism for " "this are the *import hooks*. There are two types of import hooks: *meta " @@ -455,7 +455,7 @@ msgstr "" "引入機制的設計是可擴展的;其主要機制是\\ *引入掛鉤*。引入掛鉤有兩種類型:*元" "掛鉤 (meta hooks)* 和\\ *引入路徑掛鉤*。" -#: ../../reference/import.rst:261 +#: ../../reference/import.rst:263 msgid "" "Meta hooks are called at the start of import processing, before any other " "import processing has occurred, other than :data:`sys.modules` cache look " @@ -468,7 +468,7 @@ msgstr "" "組,甚至是內建模組。元掛鉤透過將新的尋檢器物件添加到 :data:`sys.meta_path` 中" "來註冊,具體描述請參閱以下段落。" -#: ../../reference/import.rst:267 +#: ../../reference/import.rst:269 msgid "" "Import path hooks are called as part of :data:`sys.path` (or ``package." "__path__``) processing, at the point where their associated path item is " @@ -479,11 +479,11 @@ msgstr "" "部分來呼叫,當遇到與其相關聯的路徑項目時就會被觸發。引入路徑掛鉤透過將新的可" "呼叫對象增加到 :data:`sys.path_hooks` 中來註冊,具體描述請參閱以下段落。" -#: ../../reference/import.rst:274 +#: ../../reference/import.rst:276 msgid "The meta path" msgstr "元路徑" -#: ../../reference/import.rst:280 +#: ../../reference/import.rst:282 msgid "" "When the named module is not found in :data:`sys.modules`, Python next " "searches :data:`sys.meta_path`, which contains a list of meta path finder " @@ -500,7 +500,7 @@ msgstr "" "MetaPathFinder.find_spec` 的方法,該方法接收三個引數:名稱、引入路徑和(可選" "的)目標模組。元路徑尋檢器可以使用任何策略來確定它是否能處理命名模組。" -#: ../../reference/import.rst:289 +#: ../../reference/import.rst:291 msgid "" "If the meta path finder knows how to handle the named module, it returns a " "spec object. If it cannot handle the named module, it returns ``None``. " @@ -513,7 +513,7 @@ msgstr "" "回傳規格,則會引發 :exc:`ModuleNotFoundError`。任何其他引發的例外將直接向上傳" "播,並中止引入過程。" -#: ../../reference/import.rst:295 +#: ../../reference/import.rst:297 msgid "" "The :meth:`~importlib.abc.MetaPathFinder.find_spec` method of meta path " "finders is called with two or three arguments. The first is the fully " @@ -533,7 +533,7 @@ msgstr "" "``__path__`` 屬性,將引發 :exc:`ModuleNotFoundError`。第三個引數是一個現有的" "模組物件,該物件將成為後續載入的目標。引入系統只會在重新載入時傳入目標模組。" -#: ../../reference/import.rst:306 +#: ../../reference/import.rst:308 msgid "" "The meta path may be traversed multiple times for a single import request. " "For example, assuming none of the modules involved has already been cached, " @@ -551,7 +551,7 @@ msgstr "" "None)``。當 ``foo.bar`` 被引入後,最後一次遍歷會呼叫 ``mpf.find_spec(\"foo." "bar.baz\", foo.bar.__path__, None)``。" -#: ../../reference/import.rst:316 +#: ../../reference/import.rst:318 msgid "" "Some meta path finders only support top level imports. These importers will " "always return ``None`` when anything other than ``None`` is passed as the " @@ -560,7 +560,7 @@ msgstr "" "一些元路徑尋檢器僅支援頂層引入。當第二個引數傳入 ``None`` 以外的值時,這些引" "入器將始終回傳 ``None``。" -#: ../../reference/import.rst:320 +#: ../../reference/import.rst:322 msgid "" "Python's default :data:`sys.meta_path` has three meta path finders, one that " "knows how to import built-in modules, one that knows how to import frozen " @@ -571,7 +571,7 @@ msgstr "" "模組,一個知道如何引入凍結模組,還有一個知道如何從 :term:`import path` 引入模" "組(即 :term:`path based finder`)。" -#: ../../reference/import.rst:325 +#: ../../reference/import.rst:327 msgid "" "The :meth:`~importlib.abc.MetaPathFinder.find_spec` method of meta path " "finders replaced :meth:`!find_module`, which is now deprecated. While it " @@ -583,13 +583,13 @@ msgstr "" "meth:`!find_module`,後者現在已被棄用。雖然它將繼續正常工作,但引入機制僅在尋" "檢器未實作 :meth:`~importlib.abc.MetaPathFinder.find_spec` 時才會嘗試使用它。" -#: ../../reference/import.rst:332 +#: ../../reference/import.rst:334 msgid "" "Use of :meth:`!find_module` by the import system now raises :exc:" "`ImportWarning`." msgstr "引入系統現在使用 :meth:`!find_module` 時將引發 :exc:`ImportWarning`。" -#: ../../reference/import.rst:336 +#: ../../reference/import.rst:338 msgid "" ":meth:`!find_module` has been removed. Use :meth:`~importlib.abc." "MetaPathFinder.find_spec` instead." @@ -597,11 +597,11 @@ msgstr "" ":meth:`!find_module` 已被移除。請改用 :meth:`~importlib.abc.MetaPathFinder." "find_spec`。" -#: ../../reference/import.rst:342 +#: ../../reference/import.rst:344 msgid "Loading" msgstr "載入" -#: ../../reference/import.rst:344 +#: ../../reference/import.rst:346 msgid "" "If and when a module spec is found, the import machinery will use it (and " "the loader it contains) when loading the module. Here is an approximation " @@ -610,7 +610,7 @@ msgstr "" "如果找到模組規格,引入機制會在載入模組時使用該規格(以及它包含的載入器)。以" "下是引入過程中載入部分的大致情況: ::" -#: ../../reference/import.rst:348 +#: ../../reference/import.rst:350 msgid "" "module = None\n" "if spec.loader is not None and hasattr(spec.loader, 'create_module'):\n" @@ -670,18 +670,18 @@ msgstr "" " raise\n" "return sys.modules[spec.name]" -#: ../../reference/import.rst:377 +#: ../../reference/import.rst:379 msgid "Note the following details:" msgstr "請注意下列細節:" -#: ../../reference/import.rst:379 +#: ../../reference/import.rst:381 msgid "" "If there is an existing module object with the given name in :data:`sys." "modules`, import will have already returned it." msgstr "" "如果 :data:`sys.modules` 中已存在具有給定名稱的模組物件,引入會已回傳該物件。" -#: ../../reference/import.rst:382 +#: ../../reference/import.rst:384 msgid "" "The module will exist in :data:`sys.modules` before the loader executes the " "module code. This is crucial because the module code may (directly or " @@ -693,7 +693,7 @@ msgstr "" "重要,因為模組程式碼可能會(直接或間接)引入自己;事先將其增加到 :data:`sys." "modules` 可以預防類似無限遞迴以及多次重覆載入等情形。" -#: ../../reference/import.rst:388 +#: ../../reference/import.rst:390 msgid "" "If loading fails, the failing module -- and only the failing module -- gets " "removed from :data:`sys.modules`. Any module already in the :data:`sys." @@ -706,7 +706,7 @@ msgstr "" "須保留在快取中。此情形與重新載入不同,在重新載入時,即使載入失敗的模組也會保" "留在 :data:`sys.modules` 中。" -#: ../../reference/import.rst:394 +#: ../../reference/import.rst:396 msgid "" "After the module is created but before execution, the import machinery sets " "the import-related module attributes (\"_init_module_attrs\" in the pseudo-" @@ -717,7 +717,7 @@ msgstr "" "範例中為 \"_init_module_attrs\"),具體內容在\\ :ref:`之後的段落<import-mod-" "attrs>`\\ 會總結。" -#: ../../reference/import.rst:399 +#: ../../reference/import.rst:401 msgid "" "Module execution is the key moment of loading in which the module's " "namespace gets populated. Execution is entirely delegated to the loader, " @@ -726,7 +726,7 @@ msgstr "" "模組執行是載入過程中的關鍵時刻,此時模組的命名空間會被新增名稱。執行過程完全" "交由載入器處理,由其決定如何新增以及新增什麼。" -#: ../../reference/import.rst:403 +#: ../../reference/import.rst:405 msgid "" "The module created during loading and passed to exec_module() may not be the " "one returned at the end of import [#fnlo]_." @@ -734,7 +734,7 @@ msgstr "" "在載入過程中建立並傳遞給 exec_module() 的模組,可能不會是引入結束時回傳的模" "組 [#fnlo]_。" -#: ../../reference/import.rst:406 +#: ../../reference/import.rst:408 msgid "" "The import system has taken over the boilerplate responsibilities of " "loaders. These were previously performed by the :meth:`importlib.abc.Loader." @@ -743,11 +743,11 @@ msgstr "" "引入系統已接管載入器的模板 (boilerplate) 責任。之前是由 :meth:`importlib.abc." "Loader.load_module` 方法執行的。" -#: ../../reference/import.rst:412 +#: ../../reference/import.rst:414 msgid "Loaders" msgstr "載入器" -#: ../../reference/import.rst:414 +#: ../../reference/import.rst:416 msgid "" "Module loaders provide the critical function of loading: module execution. " "The import machinery calls the :meth:`importlib.abc.Loader.exec_module` " @@ -758,11 +758,11 @@ msgstr "" "組物件)呼叫 :meth:`importlib.abc.Loader.exec_module` 方法。任何從 :meth:" "`~importlib.abc.Loader.exec_module` 回傳的值都會被忽略。" -#: ../../reference/import.rst:419 +#: ../../reference/import.rst:421 msgid "Loaders must satisfy the following requirements:" msgstr "載入器必須滿足以下要求:" -#: ../../reference/import.rst:421 +#: ../../reference/import.rst:423 msgid "" "If the module is a Python module (as opposed to a built-in module or a " "dynamically loaded extension), the loader should execute the module's code " @@ -771,7 +771,7 @@ msgstr "" "如果模組是 Python 模組(而非內建模組或動態載入的擴充),載入器應在模組的全域" "命名空間 (``module.__dict__``\\ ) 中執行該模組的程式碼。" -#: ../../reference/import.rst:425 +#: ../../reference/import.rst:427 msgid "" "If the loader cannot execute the module, it should raise an :exc:" "`ImportError`, although any other exception raised during :meth:`~importlib." @@ -780,7 +780,7 @@ msgstr "" "如果載入器無法執行該模組,應引發 :exc:`ImportError`。不過,在 :meth:" "`~importlib.abc.Loader.exec_module` 中引發的任何其他例外也會被傳播。" -#: ../../reference/import.rst:429 +#: ../../reference/import.rst:431 msgid "" "In many cases, the finder and loader can be the same object; in such cases " "the :meth:`~importlib.abc.MetaPathFinder.find_spec` method would just return " @@ -790,7 +790,7 @@ msgstr "" "`~importlib.abc.MetaPathFinder.find_spec` 方法只需回傳一個載入器設為 " "``self`` 的規格即可。" -#: ../../reference/import.rst:433 +#: ../../reference/import.rst:435 msgid "" "Module loaders may opt in to creating the module object during loading by " "implementing a :meth:`~importlib.abc.Loader.create_module` method. It takes " @@ -804,11 +804,11 @@ msgstr "" "要使用的新的模組物件。``create_module()`` 不需要在模組物件上設定任何屬性。如" "果該方法回傳 ``None``,引入機制將自行建立新的模組。" -#: ../../reference/import.rst:440 +#: ../../reference/import.rst:442 msgid "The :meth:`~importlib.abc.Loader.create_module` method of loaders." msgstr "載入器的 :meth:`~importlib.abc.Loader.create_module` 方法。" -#: ../../reference/import.rst:443 +#: ../../reference/import.rst:445 msgid "" "The :meth:`~importlib.abc.Loader.load_module` method was replaced by :meth:" "`~importlib.abc.Loader.exec_module` and the import machinery assumed all the " @@ -817,7 +817,7 @@ msgstr "" ":meth:`~importlib.abc.Loader.load_module` 方法已被 :meth:`~importlib.abc." "Loader.exec_module` 取代,引入機制已承擔所有載入的模板責任。" -#: ../../reference/import.rst:448 +#: ../../reference/import.rst:450 msgid "" "For compatibility with existing loaders, the import machinery will use the " "``load_module()`` method of loaders if it exists and the loader does not " @@ -828,7 +828,7 @@ msgstr "" "``load_module()`` 方法時使用該方法。然而,``load_module()`` 已被棄用,載入器" "應改為實作 ``exec_module()``。" -#: ../../reference/import.rst:453 +#: ../../reference/import.rst:455 msgid "" "The ``load_module()`` method must implement all the boilerplate loading " "functionality described above in addition to executing the module. All the " @@ -837,7 +837,7 @@ msgstr "" "``load_module()`` 方法除了執行模組外,還必須實作上述全部的模板載入功能。所有" "相同的限制依然適用,並且還有一些額外的說明:" -#: ../../reference/import.rst:457 +#: ../../reference/import.rst:459 msgid "" "If there is an existing module object with the given name in :data:`sys." "modules`, the loader must use that existing module. (Otherwise, :func:" @@ -850,7 +850,7 @@ msgstr "" "`sys.modules` 中,載入器必須建立一個新的模組物件並將其新增至 :data:`sys." "modules`。" -#: ../../reference/import.rst:463 +#: ../../reference/import.rst:465 msgid "" "The module *must* exist in :data:`sys.modules` before the loader executes " "the module code, to prevent unbounded recursion or multiple loading." @@ -858,7 +858,7 @@ msgstr "" "在載入器執行模組程式碼之前,該模組\\ *必須*\\ 已存在於 :data:`sys.modules` " "中,以防止無限遞迴或多次載入。" -#: ../../reference/import.rst:467 +#: ../../reference/import.rst:469 msgid "" "If loading fails, the loader must remove any modules it has inserted into :" "data:`sys.modules`, but it must remove **only** the failing module(s), and " @@ -868,7 +868,7 @@ msgstr "" "\\ **只能**\\ 移除失敗的模組(們),且僅在載入器本身明確載入這些模組時才需移" "除。" -#: ../../reference/import.rst:472 +#: ../../reference/import.rst:474 msgid "" "A :exc:`DeprecationWarning` is raised when ``exec_module()`` is defined but " "``create_module()`` is not." @@ -876,7 +876,7 @@ msgstr "" "當 ``exec_module()`` 已定義但未定義 ``create_module()`` 時,將引發 :exc:" "`DeprecationWarning`。" -#: ../../reference/import.rst:476 +#: ../../reference/import.rst:478 msgid "" "An :exc:`ImportError` is raised when ``exec_module()`` is defined but " "``create_module()`` is not." @@ -884,15 +884,15 @@ msgstr "" "當 ``exec_module()`` 已定義但未定義 ``create_module()`` 時,將引發 :exc:" "`ImportError`。" -#: ../../reference/import.rst:480 +#: ../../reference/import.rst:482 msgid "Use of ``load_module()`` will raise :exc:`ImportWarning`." msgstr "使用 ``load_module()`` 將引發 :exc:`ImportWarning`。" -#: ../../reference/import.rst:484 +#: ../../reference/import.rst:486 msgid "Submodules" msgstr "子模組" -#: ../../reference/import.rst:486 +#: ../../reference/import.rst:488 msgid "" "When a submodule is loaded using any mechanism (e.g. ``importlib`` APIs, the " "``import`` or ``import-from`` statements, or built-in ``__import__()``) a " @@ -907,7 +907,7 @@ msgstr "" "foo`` 之後,``spam`` 將擁有一個名為 ``foo`` 的屬性,該屬性繫結到子模組。我們" "假設你有以下的目錄結構: ::" -#: ../../reference/import.rst:493 +#: ../../reference/import.rst:495 msgid "" "spam/\n" " __init__.py\n" @@ -917,22 +917,22 @@ msgstr "" " __init__.py\n" " foo.py" -#: ../../reference/import.rst:497 +#: ../../reference/import.rst:499 msgid "and ``spam/__init__.py`` has the following line in it::" msgstr "並且 ``spam/__init__.py`` 中包含以下程式碼: ::" -#: ../../reference/import.rst:499 +#: ../../reference/import.rst:501 msgid "from .foo import Foo" msgstr "from .foo import Foo" -#: ../../reference/import.rst:501 +#: ../../reference/import.rst:503 msgid "" "then executing the following puts name bindings for ``foo`` and ``Foo`` in " "the ``spam`` module::" msgstr "" "那麼執行以下程式碼會將 ``foo`` 和 ``Foo`` 的名稱繫結到 ``spam`` 模組中: ::" -#: ../../reference/import.rst:504 +#: ../../reference/import.rst:506 msgid "" ">>> import spam\n" ">>> spam.foo\n" @@ -946,7 +946,7 @@ msgstr "" ">>> spam.Foo\n" "<class 'spam.foo.Foo'>" -#: ../../reference/import.rst:510 +#: ../../reference/import.rst:512 msgid "" "Given Python's familiar name binding rules this might seem surprising, but " "it's actually a fundamental feature of the import system. The invariant " @@ -959,11 +959,11 @@ msgstr "" "modules['spam.foo']``\\ (就像上述引入後那樣),那麼後者必須作為前者的 " "``foo`` 屬性出現。" -#: ../../reference/import.rst:519 +#: ../../reference/import.rst:521 msgid "Module specs" msgstr "模組規格" -#: ../../reference/import.rst:521 +#: ../../reference/import.rst:523 msgid "" "The import machinery uses a variety of information about each module during " "import, especially before loading. Most of the information is common to all " @@ -974,7 +974,7 @@ msgstr "" "對所有模組來說都是通用的。模組規格的目的是以每個模組為基礎封裝這些與引入相關" "的資訊。" -#: ../../reference/import.rst:526 +#: ../../reference/import.rst:528 msgid "" "Using a spec during import allows state to be transferred between import " "system components, e.g. between the finder that creates the module spec and " @@ -986,7 +986,7 @@ msgstr "" "的尋檢器和執行該規格的載入器之間傳遞。最重要的是,這允許引入機制執行載入的模" "板操作,而在沒有模組規格的情況下,這些操作則是載入器的責任。" -#: ../../reference/import.rst:532 +#: ../../reference/import.rst:534 msgid "" "The module's spec is exposed as :attr:`module.__spec__`. Setting :attr:`!" "__spec__` appropriately applies equally to :ref:`modules initialized during " @@ -998,18 +998,18 @@ msgstr "" "例外是 ``__main__``,其中 :attr:`!__spec__` 會\\ :ref:`在某些情況下被設定成 " "None <main_spec>`。" -#: ../../reference/import.rst:538 +#: ../../reference/import.rst:540 msgid "" "See :class:`~importlib.machinery.ModuleSpec` for details on the contents of " "the module spec." msgstr "" "有關模組規格內容的詳細資訊,請參閱 :class:`~importlib.machinery.ModuleSpec`。" -#: ../../reference/import.rst:546 +#: ../../reference/import.rst:548 msgid "__path__ attributes on modules" msgstr "" -#: ../../reference/import.rst:548 +#: ../../reference/import.rst:550 msgid "" "The :attr:`~module.__path__` attribute should be a (possibly empty) :term:" "`sequence` of strings enumerating the locations where the package's " @@ -1017,7 +1017,7 @@ msgid "" "attribute, it is a :term:`package`." msgstr "" -#: ../../reference/import.rst:553 +#: ../../reference/import.rst:555 msgid "" "A package's :attr:`~module.__path__` attribute is used during imports of its " "subpackages. Within the import machinery, it functions much the same as :" @@ -1026,14 +1026,14 @@ msgid "" "than :data:`!sys.path`." msgstr "" -#: ../../reference/import.rst:560 +#: ../../reference/import.rst:562 msgid "" "The same rules used for :data:`sys.path` also apply to a package's :attr:`!" "__path__`. :data:`sys.path_hooks` (described below) are consulted when " "traversing a package's :attr:`!__path__`." msgstr "" -#: ../../reference/import.rst:564 +#: ../../reference/import.rst:566 msgid "" "A package's ``__init__.py`` file may set or alter the package's :attr:" "`~module.__path__` attribute, and this was typically the way namespace " @@ -1043,18 +1043,18 @@ msgid "" "automatically sets :attr:`!__path__` correctly for the namespace package." msgstr "" -#: ../../reference/import.rst:573 +#: ../../reference/import.rst:575 msgid "Module reprs" msgstr "" -#: ../../reference/import.rst:575 +#: ../../reference/import.rst:577 msgid "" "By default, all modules have a usable repr, however depending on the " "attributes set above, and in the module's spec, you can more explicitly " "control the repr of module objects." msgstr "" -#: ../../reference/import.rst:579 +#: ../../reference/import.rst:581 msgid "" "If the module has a spec (``__spec__``), the import machinery will try to " "generate a repr from it. If that fails or there is no spec, the import " @@ -1064,45 +1064,45 @@ msgid "" "for whatever information is missing." msgstr "" -#: ../../reference/import.rst:586 +#: ../../reference/import.rst:588 msgid "Here are the exact rules used:" msgstr "" -#: ../../reference/import.rst:588 +#: ../../reference/import.rst:590 msgid "" "If the module has a ``__spec__`` attribute, the information in the spec is " "used to generate the repr. The \"name\", \"loader\", \"origin\", and " "\"has_location\" attributes are consulted." msgstr "" -#: ../../reference/import.rst:592 +#: ../../reference/import.rst:594 msgid "" "If the module has a ``__file__`` attribute, this is used as part of the " "module's repr." msgstr "" -#: ../../reference/import.rst:595 +#: ../../reference/import.rst:597 msgid "" "If the module has no ``__file__`` but does have a ``__loader__`` that is not " "``None``, then the loader's repr is used as part of the module's repr." msgstr "" -#: ../../reference/import.rst:598 +#: ../../reference/import.rst:600 msgid "Otherwise, just use the module's ``__name__`` in the repr." msgstr "" -#: ../../reference/import.rst:600 +#: ../../reference/import.rst:602 msgid "" "Use of :meth:`!module_repr`, having been deprecated since Python 3.4, was " "removed in Python 3.12 and is no longer called during the resolution of a " "module's repr." msgstr "" -#: ../../reference/import.rst:608 +#: ../../reference/import.rst:610 msgid "Cached bytecode invalidation" msgstr "" -#: ../../reference/import.rst:610 +#: ../../reference/import.rst:612 msgid "" "Before Python loads cached bytecode from a ``.pyc`` file, it checks whether " "the cache is up-to-date with the source ``.py`` file. By default, Python " @@ -1112,7 +1112,7 @@ msgid "" "source's metadata." msgstr "" -#: ../../reference/import.rst:617 +#: ../../reference/import.rst:619 msgid "" "Python also supports \"hash-based\" cache files, which store a hash of the " "source file's contents rather than its metadata. There are two variants of " @@ -1126,17 +1126,17 @@ msgid "" "option:`--check-hash-based-pycs` flag." msgstr "" -#: ../../reference/import.rst:628 +#: ../../reference/import.rst:630 msgid "" "Added hash-based ``.pyc`` files. Previously, Python only supported timestamp-" "based invalidation of bytecode caches." msgstr "" -#: ../../reference/import.rst:634 +#: ../../reference/import.rst:636 msgid "The Path Based Finder" msgstr "" -#: ../../reference/import.rst:639 +#: ../../reference/import.rst:641 msgid "" "As mentioned previously, Python comes with several default meta path " "finders. One of these, called the :term:`path based finder` (:class:" @@ -1145,14 +1145,14 @@ msgid "" "a location to search for modules." msgstr "" -#: ../../reference/import.rst:645 +#: ../../reference/import.rst:647 msgid "" "The path based finder itself doesn't know how to import anything. Instead, " "it traverses the individual path entries, associating each of them with a " "path entry finder that knows how to handle that particular kind of path." msgstr "" -#: ../../reference/import.rst:649 +#: ../../reference/import.rst:651 msgid "" "The default set of path entry finders implement all the semantics for " "finding modules on the file system, handling special file types such as " @@ -1163,14 +1163,14 @@ msgid "" "from zipfiles." msgstr "" -#: ../../reference/import.rst:656 +#: ../../reference/import.rst:658 msgid "" "Path entries need not be limited to file system locations. They can refer " "to URLs, database queries, or any other location that can be specified as a " "string." msgstr "" -#: ../../reference/import.rst:660 +#: ../../reference/import.rst:662 msgid "" "The path based finder provides additional hooks and protocols so that you " "can extend and customize the types of searchable path entries. For example, " @@ -1181,7 +1181,7 @@ msgid "" "from the web." msgstr "" -#: ../../reference/import.rst:668 +#: ../../reference/import.rst:670 msgid "" "A word of warning: this section and the previous both use the term *finder*, " "distinguishing between them by using the terms :term:`meta path finder` and :" @@ -1192,7 +1192,7 @@ msgid "" "process, as keyed off the :data:`sys.meta_path` traversal." msgstr "" -#: ../../reference/import.rst:676 +#: ../../reference/import.rst:678 msgid "" "By contrast, path entry finders are in a sense an implementation detail of " "the path based finder, and in fact, if the path based finder were to be " @@ -1200,11 +1200,11 @@ msgid "" "would be invoked." msgstr "" -#: ../../reference/import.rst:683 +#: ../../reference/import.rst:685 msgid "Path entry finders" msgstr "" -#: ../../reference/import.rst:691 +#: ../../reference/import.rst:693 msgid "" "The :term:`path based finder` is responsible for finding and loading Python " "modules and packages whose location is specified with a string :term:`path " @@ -1212,7 +1212,7 @@ msgid "" "not be limited to this." msgstr "" -#: ../../reference/import.rst:696 +#: ../../reference/import.rst:698 msgid "" "As a meta path finder, the :term:`path based finder` implements the :meth:" "`~importlib.abc.MetaPathFinder.find_spec` protocol previously described, " @@ -1220,7 +1220,7 @@ msgid "" "modules are found and loaded from the :term:`import path`." msgstr "" -#: ../../reference/import.rst:701 +#: ../../reference/import.rst:703 msgid "" "Three variables are used by the :term:`path based finder`, :data:`sys." "path`, :data:`sys.path_hooks` and :data:`sys.path_importer_cache`. The " @@ -1228,7 +1228,7 @@ msgid "" "additional ways that the import machinery can be customized." msgstr "" -#: ../../reference/import.rst:706 +#: ../../reference/import.rst:708 msgid "" ":data:`sys.path` contains a list of strings providing search locations for " "modules and packages. It is initialized from the :envvar:`PYTHONPATH` " @@ -1240,7 +1240,7 @@ msgid "" "other data types are ignored." msgstr "" -#: ../../reference/import.rst:715 +#: ../../reference/import.rst:717 msgid "" "The :term:`path based finder` is a :term:`meta path finder`, so the import " "machinery begins the :term:`import path` search by calling the path based " @@ -1252,7 +1252,7 @@ msgid "" "top level import and :data:`sys.path` is used." msgstr "" -#: ../../reference/import.rst:724 +#: ../../reference/import.rst:726 msgid "" "The path based finder iterates over every entry in the search path, and for " "each of these, looks for an appropriate :term:`path entry finder` (:class:" @@ -1268,7 +1268,7 @@ msgid "" "finder to perform the path entry search again." msgstr "" -#: ../../reference/import.rst:737 +#: ../../reference/import.rst:739 msgid "" "If the path entry is not present in the cache, the path based finder " "iterates over every callable in :data:`sys.path_hooks`. Each of the :term:" @@ -1284,7 +1284,7 @@ msgid "" "decode the argument, it should raise :exc:`ImportError`." msgstr "" -#: ../../reference/import.rst:751 +#: ../../reference/import.rst:753 msgid "" "If :data:`sys.path_hooks` iteration ends with no :term:`path entry finder` " "being returned, then the path based finder's :meth:`~importlib.machinery." @@ -1294,7 +1294,7 @@ msgid "" "could not find the module." msgstr "" -#: ../../reference/import.rst:758 +#: ../../reference/import.rst:760 msgid "" "If a :term:`path entry finder` *is* returned by one of the :term:`path entry " "hook` callables on :data:`sys.path_hooks`, then the following protocol is " @@ -1302,7 +1302,7 @@ msgid "" "the module." msgstr "" -#: ../../reference/import.rst:763 +#: ../../reference/import.rst:765 msgid "" "The current working directory -- denoted by an empty string -- is handled " "slightly differently from other entries on :data:`sys.path`. First, if the " @@ -1314,18 +1314,18 @@ msgid "" "and not the empty string." msgstr "" -#: ../../reference/import.rst:773 +#: ../../reference/import.rst:775 msgid "Path entry finder protocol" msgstr "" -#: ../../reference/import.rst:775 +#: ../../reference/import.rst:777 msgid "" "In order to support imports of modules and initialized packages and also to " "contribute portions to namespace packages, path entry finders must implement " "the :meth:`~importlib.abc.PathEntryFinder.find_spec` method." msgstr "" -#: ../../reference/import.rst:779 +#: ../../reference/import.rst:781 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` takes two arguments: the " "fully qualified name of the module being imported, and the (optional) target " @@ -1333,21 +1333,21 @@ msgid "" "spec will always have \"loader\" set (with one exception)." msgstr "" -#: ../../reference/import.rst:784 +#: ../../reference/import.rst:786 msgid "" "To indicate to the import machinery that the spec represents a namespace :" "term:`portion`, the path entry finder sets ``submodule_search_locations`` to " "a list containing the portion." msgstr "" -#: ../../reference/import.rst:788 +#: ../../reference/import.rst:790 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` replaced :meth:`!" "find_loader` and :meth:`!find_module`, both of which are now deprecated, but " "will be used if ``find_spec()`` is not defined." msgstr "" -#: ../../reference/import.rst:794 +#: ../../reference/import.rst:796 msgid "" "Older path entry finders may implement one of these two deprecated methods " "instead of ``find_spec()``. The methods are still respected for the sake of " @@ -1355,14 +1355,14 @@ msgid "" "path entry finder, the legacy methods are ignored." msgstr "" -#: ../../reference/import.rst:799 +#: ../../reference/import.rst:801 msgid "" ":meth:`!find_loader` takes one argument, the fully qualified name of the " "module being imported. ``find_loader()`` returns a 2-tuple where the first " "item is the loader and the second item is a namespace :term:`portion`." msgstr "" -#: ../../reference/import.rst:804 +#: ../../reference/import.rst:806 msgid "" "For backwards compatibility with other implementations of the import " "protocol, many path entry finders also support the same, traditional " @@ -1372,7 +1372,7 @@ msgid "" "initial call to the path hook)." msgstr "" -#: ../../reference/import.rst:811 +#: ../../reference/import.rst:813 msgid "" "The ``find_module()`` method on path entry finders is deprecated, as it does " "not allow the path entry finder to contribute portions to namespace " @@ -1381,28 +1381,28 @@ msgid "" "preference to ``find_module()``." msgstr "" -#: ../../reference/import.rst:817 +#: ../../reference/import.rst:819 msgid "" "Calls to :meth:`!find_module` and :meth:`!find_loader` by the import system " "will raise :exc:`ImportWarning`." msgstr "" -#: ../../reference/import.rst:822 +#: ../../reference/import.rst:824 msgid "``find_module()`` and ``find_loader()`` have been removed." msgstr "" -#: ../../reference/import.rst:827 +#: ../../reference/import.rst:829 msgid "Replacing the standard import system" msgstr "" -#: ../../reference/import.rst:829 +#: ../../reference/import.rst:831 msgid "" "The most reliable mechanism for replacing the entire import system is to " "delete the default contents of :data:`sys.meta_path`, replacing them " "entirely with a custom meta path hook." msgstr "" -#: ../../reference/import.rst:833 +#: ../../reference/import.rst:835 msgid "" "If it is acceptable to only alter the behaviour of import statements without " "affecting other APIs that access the import system, then replacing the " @@ -1411,7 +1411,7 @@ msgid "" "statements within that module." msgstr "" -#: ../../reference/import.rst:839 +#: ../../reference/import.rst:841 msgid "" "To selectively prevent the import of some modules from a hook early on the " "meta path (rather than disabling the standard import system entirely), it is " @@ -1421,11 +1421,11 @@ msgid "" "exception terminates it immediately." msgstr "" -#: ../../reference/import.rst:849 +#: ../../reference/import.rst:851 msgid "Package Relative Imports" msgstr "" -#: ../../reference/import.rst:851 +#: ../../reference/import.rst:853 msgid "" "Relative imports use leading dots. A single leading dot indicates a relative " "import, starting with the current package. Two or more leading dots indicate " @@ -1433,7 +1433,7 @@ msgid "" "after the first. For example, given the following package layout::" msgstr "" -#: ../../reference/import.rst:856 +#: ../../reference/import.rst:858 msgid "" "package/\n" " __init__.py\n" @@ -1457,13 +1457,13 @@ msgstr "" " moduleZ.py\n" " moduleA.py" -#: ../../reference/import.rst:867 +#: ../../reference/import.rst:869 msgid "" "In either ``subpackage1/moduleX.py`` or ``subpackage1/__init__.py``, the " "following are valid relative imports::" msgstr "" -#: ../../reference/import.rst:870 +#: ../../reference/import.rst:872 msgid "" "from .moduleY import spam\n" "from .moduleY import spam as ham\n" @@ -1479,28 +1479,28 @@ msgstr "" "from ..subpackage2.moduleZ import eggs\n" "from ..moduleA import foo" -#: ../../reference/import.rst:877 +#: ../../reference/import.rst:879 msgid "" "Absolute imports may use either the ``import <>`` or ``from <> import <>`` " "syntax, but relative imports may only use the second form; the reason for " "this is that::" msgstr "" -#: ../../reference/import.rst:881 +#: ../../reference/import.rst:883 msgid "import XXX.YYY.ZZZ" msgstr "import XXX.YYY.ZZZ" -#: ../../reference/import.rst:883 +#: ../../reference/import.rst:885 msgid "" "should expose ``XXX.YYY.ZZZ`` as a usable expression, but .moduleY is not a " "valid expression." msgstr "" -#: ../../reference/import.rst:890 +#: ../../reference/import.rst:892 msgid "Special considerations for __main__" msgstr "" -#: ../../reference/import.rst:892 +#: ../../reference/import.rst:894 msgid "" "The :mod:`__main__` module is a special case relative to Python's import " "system. As noted :ref:`elsewhere <programs>`, the ``__main__`` module is " @@ -1511,17 +1511,17 @@ msgid "" "interpreter is invoked." msgstr "" -#: ../../reference/import.rst:903 +#: ../../reference/import.rst:905 msgid "__main__.__spec__" msgstr "__main__.__spec__" -#: ../../reference/import.rst:905 +#: ../../reference/import.rst:907 msgid "" "Depending on how :mod:`__main__` is initialized, ``__main__.__spec__`` gets " "set appropriately or to ``None``." msgstr "" -#: ../../reference/import.rst:908 +#: ../../reference/import.rst:910 msgid "" "When Python is started with the :option:`-m` option, ``__spec__`` is set to " "the module spec of the corresponding module or package. ``__spec__`` is also " @@ -1529,30 +1529,30 @@ msgid "" "directory, zipfile or other :data:`sys.path` entry." msgstr "" -#: ../../reference/import.rst:913 +#: ../../reference/import.rst:915 msgid "" "In :ref:`the remaining cases <using-on-interface-options>` ``__main__." "__spec__`` is set to ``None``, as the code used to populate the :mod:" "`__main__` does not correspond directly with an importable module:" msgstr "" -#: ../../reference/import.rst:917 +#: ../../reference/import.rst:919 msgid "interactive prompt" msgstr "" -#: ../../reference/import.rst:918 +#: ../../reference/import.rst:920 msgid ":option:`-c` option" msgstr ":option:`-c` 選項" -#: ../../reference/import.rst:919 +#: ../../reference/import.rst:921 msgid "running from stdin" msgstr "" -#: ../../reference/import.rst:920 +#: ../../reference/import.rst:922 msgid "running directly from a source or bytecode file" msgstr "" -#: ../../reference/import.rst:922 +#: ../../reference/import.rst:924 msgid "" "Note that ``__main__.__spec__`` is always ``None`` in the last case, *even " "if* the file could technically be imported directly as a module instead. Use " @@ -1560,7 +1560,7 @@ msgid "" "`__main__`." msgstr "" -#: ../../reference/import.rst:927 +#: ../../reference/import.rst:929 msgid "" "Note also that even when ``__main__`` corresponds with an importable module " "and ``__main__.__spec__`` is set accordingly, they're still considered " @@ -1569,11 +1569,11 @@ msgid "" "populate the ``__main__`` namespace, and not during normal import." msgstr "" -#: ../../reference/import.rst:935 +#: ../../reference/import.rst:937 msgid "References" msgstr "" -#: ../../reference/import.rst:937 +#: ../../reference/import.rst:939 msgid "" "The import machinery has evolved considerably since Python's early days. " "The original `specification for packages <https://www.python.org/doc/essays/" @@ -1581,37 +1581,37 @@ msgid "" "since the writing of that document." msgstr "" -#: ../../reference/import.rst:942 +#: ../../reference/import.rst:944 msgid "" "The original specification for :data:`sys.meta_path` was :pep:`302`, with " "subsequent extension in :pep:`420`." msgstr "" -#: ../../reference/import.rst:945 +#: ../../reference/import.rst:947 msgid "" ":pep:`420` introduced :term:`namespace packages <namespace package>` for " "Python 3.3. :pep:`420` also introduced the :meth:`!find_loader` protocol as " "an alternative to :meth:`!find_module`." msgstr "" -#: ../../reference/import.rst:949 +#: ../../reference/import.rst:951 msgid "" ":pep:`366` describes the addition of the ``__package__`` attribute for " "explicit relative imports in main modules." msgstr "" -#: ../../reference/import.rst:952 +#: ../../reference/import.rst:954 msgid "" ":pep:`328` introduced absolute and explicit relative imports and initially " "proposed ``__name__`` for semantics :pep:`366` would eventually specify for " "``__package__``." msgstr "" -#: ../../reference/import.rst:956 +#: ../../reference/import.rst:958 msgid ":pep:`338` defines executing modules as scripts." msgstr "" -#: ../../reference/import.rst:958 +#: ../../reference/import.rst:960 msgid "" ":pep:`451` adds the encapsulation of per-module import state in spec " "objects. It also off-loads most of the boilerplate responsibilities of " @@ -1620,15 +1620,15 @@ msgid "" "finders and loaders." msgstr "" -#: ../../reference/import.rst:965 +#: ../../reference/import.rst:967 msgid "Footnotes" msgstr "註解" -#: ../../reference/import.rst:966 +#: ../../reference/import.rst:968 msgid "See :class:`types.ModuleType`." msgstr "參閱 :class:`types.ModuleType`。" -#: ../../reference/import.rst:968 +#: ../../reference/import.rst:970 msgid "" "The importlib implementation avoids using the return value directly. " "Instead, it gets the module object by looking the module name up in :data:" @@ -1642,7 +1642,7 @@ msgid "import machinery" msgstr "import machinery(引入機制)" #: ../../reference/import.rst:64 ../../reference/import.rst:95 -#: ../../reference/import.rst:129 +#: ../../reference/import.rst:131 msgid "package" msgstr "package(套件)" @@ -1650,83 +1650,83 @@ msgstr "package(套件)" msgid "regular" msgstr "regular(一般)" -#: ../../reference/import.rst:129 +#: ../../reference/import.rst:131 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../reference/import.rst:129 +#: ../../reference/import.rst:131 msgid "portion" msgstr "portion(部分)" -#: ../../reference/import.rst:175 +#: ../../reference/import.rst:177 msgid "sys.modules" msgstr "sys.modules" -#: ../../reference/import.rst:210 ../../reference/import.rst:276 +#: ../../reference/import.rst:212 ../../reference/import.rst:278 msgid "finder" msgstr "finder(搜尋器)" -#: ../../reference/import.rst:210 +#: ../../reference/import.rst:212 msgid "loader" msgstr "loader(載入器)" -#: ../../reference/import.rst:210 +#: ../../reference/import.rst:212 msgid "module spec" msgstr "module spec" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "import hooks" msgstr "import hooks" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "meta hooks" msgstr "meta hooks" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "path hooks" msgstr "path hooks" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "hooks" msgstr "hooks" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "import" msgstr "import(引入)" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "meta" msgstr "meta" -#: ../../reference/import.rst:249 +#: ../../reference/import.rst:251 msgid "path" msgstr "path(路徑)" -#: ../../reference/import.rst:276 +#: ../../reference/import.rst:278 msgid "sys.meta_path" msgstr "sys.meta_path" -#: ../../reference/import.rst:276 +#: ../../reference/import.rst:278 msgid "find_spec" msgstr "find_spec" -#: ../../reference/import.rst:636 +#: ../../reference/import.rst:638 msgid "path based finder" msgstr "path based finder(基於路徑的搜尋器)" -#: ../../reference/import.rst:685 +#: ../../reference/import.rst:687 msgid "sys.path" msgstr "sys.path" -#: ../../reference/import.rst:685 +#: ../../reference/import.rst:687 msgid "sys.path_hooks" msgstr "sys.path_hooks" -#: ../../reference/import.rst:685 +#: ../../reference/import.rst:687 msgid "sys.path_importer_cache" msgstr "sys.path_importer_cache" -#: ../../reference/import.rst:685 +#: ../../reference/import.rst:687 msgid "PYTHONPATH" msgstr "PYTHONPATH" diff --git a/reference/lexical_analysis.po b/reference/lexical_analysis.po index fd5a4fbd89..e7bd8b4e04 100644 --- a/reference/lexical_analysis.po +++ b/reference/lexical_analysis.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-15 00:14+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,32 +23,33 @@ msgstr "詞法分析" #: ../../reference/lexical_analysis.rst:10 msgid "" -"A Python program is read by a *parser*. Input to the parser is a stream of " -"*tokens*, generated by the *lexical analyzer*. This chapter describes how " -"the lexical analyzer breaks a file into tokens." +"A Python program is read by a *parser*. Input to the parser is a stream " +"of :term:`tokens <token>`, generated by the *lexical analyzer* (also known " +"as the *tokenizer*). This chapter describes how the lexical analyzer breaks " +"a file into tokens." msgstr "" -#: ../../reference/lexical_analysis.rst:14 +#: ../../reference/lexical_analysis.rst:15 msgid "" "Python reads program text as Unicode code points; the encoding of a source " -"file can be given by an encoding declaration and defaults to UTF-8, see :pep:" -"`3120` for details. If the source file cannot be decoded, a :exc:" -"`SyntaxError` is raised." +"file can be given by an encoding declaration and defaults to UTF-8, " +"see :pep:`3120` for details. If the source file cannot be decoded, " +"a :exc:`SyntaxError` is raised." msgstr "" -#: ../../reference/lexical_analysis.rst:23 +#: ../../reference/lexical_analysis.rst:24 msgid "Line structure" msgstr "" -#: ../../reference/lexical_analysis.rst:27 +#: ../../reference/lexical_analysis.rst:28 msgid "A Python program is divided into a number of *logical lines*." msgstr "" -#: ../../reference/lexical_analysis.rst:33 +#: ../../reference/lexical_analysis.rst:34 msgid "Logical lines" msgstr "" -#: ../../reference/lexical_analysis.rst:37 +#: ../../reference/lexical_analysis.rst:38 msgid "" "The end of a logical line is represented by the token NEWLINE. Statements " "cannot cross logical line boundaries except where NEWLINE is allowed by the " @@ -57,11 +58,11 @@ msgid "" "implicit *line joining* rules." msgstr "" -#: ../../reference/lexical_analysis.rst:47 +#: ../../reference/lexical_analysis.rst:48 msgid "Physical lines" msgstr "" -#: ../../reference/lexical_analysis.rst:49 +#: ../../reference/lexical_analysis.rst:50 msgid "" "A physical line is a sequence of characters terminated by an end-of-line " "sequence. In source files and strings, any of the standard platform line " @@ -72,18 +73,18 @@ msgid "" "input also serves as an implicit terminator for the final physical line." msgstr "" -#: ../../reference/lexical_analysis.rst:57 +#: ../../reference/lexical_analysis.rst:58 msgid "" "When embedding Python, source code strings should be passed to Python APIs " "using the standard C conventions for newline characters (the ``\\n`` " "character, representing ASCII LF, is the line terminator)." msgstr "" -#: ../../reference/lexical_analysis.rst:65 +#: ../../reference/lexical_analysis.rst:66 msgid "Comments" msgstr "" -#: ../../reference/lexical_analysis.rst:70 +#: ../../reference/lexical_analysis.rst:71 msgid "" "A comment starts with a hash character (``#``) that is not part of a string " "literal, and ends at the end of the physical line. A comment signifies the " @@ -91,11 +92,11 @@ msgid "" "Comments are ignored by the syntax." msgstr "" -#: ../../reference/lexical_analysis.rst:79 +#: ../../reference/lexical_analysis.rst:80 msgid "Encoding declarations" msgstr "" -#: ../../reference/lexical_analysis.rst:84 +#: ../../reference/lexical_analysis.rst:85 msgid "" "If a comment in the first or second line of the Python script matches the " "regular expression ``coding[=:]\\s*([-\\w.]+)``, this comment is processed " @@ -105,41 +106,41 @@ msgid "" "comment-only line. The recommended forms of an encoding expression are ::" msgstr "" -#: ../../reference/lexical_analysis.rst:91 +#: ../../reference/lexical_analysis.rst:92 msgid "# -*- coding: <encoding-name> -*-" msgstr "# -*- coding: <encoding-name> -*-" -#: ../../reference/lexical_analysis.rst:93 +#: ../../reference/lexical_analysis.rst:94 msgid "which is recognized also by GNU Emacs, and ::" msgstr "" -#: ../../reference/lexical_analysis.rst:95 +#: ../../reference/lexical_analysis.rst:96 msgid "# vim:fileencoding=<encoding-name>" msgstr "# vim:fileencoding=<encoding-name>" -#: ../../reference/lexical_analysis.rst:97 +#: ../../reference/lexical_analysis.rst:98 msgid "which is recognized by Bram Moolenaar's VIM." msgstr "" -#: ../../reference/lexical_analysis.rst:99 +#: ../../reference/lexical_analysis.rst:100 msgid "" "If no encoding declaration is found, the default encoding is UTF-8. If the " "implicit or explicit encoding of a file is UTF-8, an initial UTF-8 byte-" "order mark (b'\\xef\\xbb\\xbf') is ignored rather than being a syntax error." msgstr "" -#: ../../reference/lexical_analysis.rst:103 +#: ../../reference/lexical_analysis.rst:104 msgid "" "If an encoding is declared, the encoding name must be recognized by Python " "(see :ref:`standard-encodings`). The encoding is used for all lexical " "analysis, including string literals, comments and identifiers." msgstr "" -#: ../../reference/lexical_analysis.rst:112 +#: ../../reference/lexical_analysis.rst:113 msgid "Explicit line joining" msgstr "" -#: ../../reference/lexical_analysis.rst:116 +#: ../../reference/lexical_analysis.rst:117 msgid "" "Two or more physical lines may be joined into logical lines using backslash " "characters (``\\``), as follows: when a physical line ends in a backslash " @@ -148,7 +149,7 @@ msgid "" "following end-of-line character. For example::" msgstr "" -#: ../../reference/lexical_analysis.rst:122 +#: ../../reference/lexical_analysis.rst:123 msgid "" "if 1900 < year < 2100 and 1 <= month <= 12 \\\n" " and 1 <= day <= 31 and 0 <= hour < 24 \\\n" @@ -160,7 +161,7 @@ msgstr "" " and 0 <= minute < 60 and 0 <= second < 60: # 看起來像個有效日期\n" " return 1" -#: ../../reference/lexical_analysis.rst:127 +#: ../../reference/lexical_analysis.rst:128 msgid "" "A line ending in a backslash cannot carry a comment. A backslash does not " "continue a comment. A backslash does not continue a token except for string " @@ -169,17 +170,17 @@ msgid "" "line outside a string literal." msgstr "" -#: ../../reference/lexical_analysis.rst:137 +#: ../../reference/lexical_analysis.rst:138 msgid "Implicit line joining" msgstr "" -#: ../../reference/lexical_analysis.rst:139 +#: ../../reference/lexical_analysis.rst:140 msgid "" "Expressions in parentheses, square brackets or curly braces can be split " "over more than one physical line without using backslashes. For example::" msgstr "" -#: ../../reference/lexical_analysis.rst:142 +#: ../../reference/lexical_analysis.rst:143 msgid "" "month_names = ['Januari', 'Februari', 'Maart', # These are the\n" " 'April', 'Mei', 'Juni', # Dutch names\n" @@ -187,7 +188,7 @@ msgid "" " 'Oktober', 'November', 'December'] # of the year" msgstr "" -#: ../../reference/lexical_analysis.rst:147 +#: ../../reference/lexical_analysis.rst:148 msgid "" "Implicitly continued lines can carry comments. The indentation of the " "continuation lines is not important. Blank continuation lines are allowed. " @@ -196,11 +197,11 @@ msgid "" "that case they cannot carry comments." msgstr "" -#: ../../reference/lexical_analysis.rst:157 +#: ../../reference/lexical_analysis.rst:158 msgid "Blank lines" msgstr "" -#: ../../reference/lexical_analysis.rst:161 +#: ../../reference/lexical_analysis.rst:162 msgid "" "A logical line that contains only spaces, tabs, formfeeds and possibly a " "comment, is ignored (i.e., no NEWLINE token is generated). During " @@ -211,18 +212,18 @@ msgid "" "statement." msgstr "" -#: ../../reference/lexical_analysis.rst:172 +#: ../../reference/lexical_analysis.rst:173 msgid "Indentation" msgstr "" -#: ../../reference/lexical_analysis.rst:176 +#: ../../reference/lexical_analysis.rst:177 msgid "" "Leading whitespace (spaces and tabs) at the beginning of a logical line is " "used to compute the indentation level of the line, which in turn is used to " "determine the grouping of statements." msgstr "" -#: ../../reference/lexical_analysis.rst:180 +#: ../../reference/lexical_analysis.rst:181 msgid "" "Tabs are replaced (from left to right) by one to eight spaces such that the " "total number of characters up to and including the replacement is a multiple " @@ -233,14 +234,14 @@ msgid "" "the indentation." msgstr "" -#: ../../reference/lexical_analysis.rst:188 +#: ../../reference/lexical_analysis.rst:189 msgid "" "Indentation is rejected as inconsistent if a source file mixes tabs and " "spaces in a way that makes the meaning dependent on the worth of a tab in " "spaces; a :exc:`TabError` is raised in that case." msgstr "" -#: ../../reference/lexical_analysis.rst:192 +#: ../../reference/lexical_analysis.rst:193 msgid "" "**Cross-platform compatibility note:** because of the nature of text editors " "on non-UNIX platforms, it is unwise to use a mixture of spaces and tabs for " @@ -248,7 +249,7 @@ msgid "" "different platforms may explicitly limit the maximum indentation level." msgstr "" -#: ../../reference/lexical_analysis.rst:197 +#: ../../reference/lexical_analysis.rst:198 msgid "" "A formfeed character may be present at the start of the line; it will be " "ignored for the indentation calculations above. Formfeed characters " @@ -256,13 +257,13 @@ msgid "" "instance, they may reset the space count to zero)." msgstr "" -#: ../../reference/lexical_analysis.rst:204 +#: ../../reference/lexical_analysis.rst:205 msgid "" "The indentation levels of consecutive lines are used to generate INDENT and " "DEDENT tokens, using a stack, as follows." msgstr "" -#: ../../reference/lexical_analysis.rst:207 +#: ../../reference/lexical_analysis.rst:208 msgid "" "Before the first line of the file is read, a single zero is pushed on the " "stack; this will never be popped off again. The numbers pushed on the stack " @@ -276,13 +277,13 @@ msgid "" "number remaining on the stack that is larger than zero." msgstr "" -#: ../../reference/lexical_analysis.rst:218 +#: ../../reference/lexical_analysis.rst:219 msgid "" "Here is an example of a correctly (though confusingly) indented piece of " "Python code::" msgstr "" -#: ../../reference/lexical_analysis.rst:221 +#: ../../reference/lexical_analysis.rst:222 msgid "" "def perm(l):\n" " # Compute the list of all permutations of l\n" @@ -297,11 +298,11 @@ msgid "" " return r" msgstr "" -#: ../../reference/lexical_analysis.rst:233 +#: ../../reference/lexical_analysis.rst:234 msgid "The following example shows various indentation errors::" msgstr "" -#: ../../reference/lexical_analysis.rst:235 +#: ../../reference/lexical_analysis.rst:236 msgid "" " def perm(l): # error: first line indented\n" "for i in range(len(l)): # error: not indented\n" @@ -312,18 +313,18 @@ msgid "" " return r # error: inconsistent dedent" msgstr "" -#: ../../reference/lexical_analysis.rst:243 +#: ../../reference/lexical_analysis.rst:244 msgid "" "(Actually, the first three errors are detected by the parser; only the last " "error is found by the lexical analyzer --- the indentation of ``return r`` " "does not match a level popped off the stack.)" msgstr "" -#: ../../reference/lexical_analysis.rst:251 +#: ../../reference/lexical_analysis.rst:252 msgid "Whitespace between tokens" msgstr "" -#: ../../reference/lexical_analysis.rst:253 +#: ../../reference/lexical_analysis.rst:254 msgid "" "Except at the beginning of a logical line or in string literals, the " "whitespace characters space, tab and formfeed can be used interchangeably to " @@ -332,11 +333,11 @@ msgid "" "is one token, but a b is two tokens)." msgstr "" -#: ../../reference/lexical_analysis.rst:263 +#: ../../reference/lexical_analysis.rst:264 msgid "Other tokens" msgstr "" -#: ../../reference/lexical_analysis.rst:265 +#: ../../reference/lexical_analysis.rst:266 msgid "" "Besides NEWLINE, INDENT and DEDENT, the following categories of tokens " "exist: *identifiers*, *keywords*, *literals*, *operators*, and *delimiters*. " @@ -346,118 +347,118 @@ msgid "" "from left to right." msgstr "" -#: ../../reference/lexical_analysis.rst:275 +#: ../../reference/lexical_analysis.rst:276 msgid "Identifiers and keywords" msgstr "" -#: ../../reference/lexical_analysis.rst:279 +#: ../../reference/lexical_analysis.rst:280 msgid "" "Identifiers (also referred to as *names*) are described by the following " "lexical definitions." msgstr "" -#: ../../reference/lexical_analysis.rst:282 +#: ../../reference/lexical_analysis.rst:283 msgid "" "The syntax of identifiers in Python is based on the Unicode standard annex " "UAX-31, with elaboration and changes as defined below; see also :pep:`3131` " "for further details." msgstr "" -#: ../../reference/lexical_analysis.rst:286 +#: ../../reference/lexical_analysis.rst:287 msgid "" "Within the ASCII range (U+0001..U+007F), the valid characters for " "identifiers include the uppercase and lowercase letters ``A`` through ``Z``, " "the underscore ``_`` and, except for the first character, the digits ``0`` " "through ``9``. Python 3.0 introduced additional characters from outside the " "ASCII range (see :pep:`3131`). For these characters, the classification " -"uses the version of the Unicode Character Database as included in the :mod:" -"`unicodedata` module." +"uses the version of the Unicode Character Database as included in " +"the :mod:`unicodedata` module." msgstr "" -#: ../../reference/lexical_analysis.rst:294 +#: ../../reference/lexical_analysis.rst:295 msgid "Identifiers are unlimited in length. Case is significant." msgstr "" -#: ../../reference/lexical_analysis.rst:303 +#: ../../reference/lexical_analysis.rst:304 msgid "The Unicode category codes mentioned above stand for:" msgstr "" -#: ../../reference/lexical_analysis.rst:305 +#: ../../reference/lexical_analysis.rst:306 msgid "*Lu* - uppercase letters" msgstr "*Lu* - 大寫字母" -#: ../../reference/lexical_analysis.rst:306 +#: ../../reference/lexical_analysis.rst:307 msgid "*Ll* - lowercase letters" msgstr "*Ll* - 小寫字母" -#: ../../reference/lexical_analysis.rst:307 +#: ../../reference/lexical_analysis.rst:308 msgid "*Lt* - titlecase letters" msgstr "" -#: ../../reference/lexical_analysis.rst:308 +#: ../../reference/lexical_analysis.rst:309 msgid "*Lm* - modifier letters" msgstr "" -#: ../../reference/lexical_analysis.rst:309 +#: ../../reference/lexical_analysis.rst:310 msgid "*Lo* - other letters" msgstr "*Lo* - 其他字母" -#: ../../reference/lexical_analysis.rst:310 +#: ../../reference/lexical_analysis.rst:311 msgid "*Nl* - letter numbers" msgstr "" -#: ../../reference/lexical_analysis.rst:311 +#: ../../reference/lexical_analysis.rst:312 msgid "*Mn* - nonspacing marks" msgstr "" -#: ../../reference/lexical_analysis.rst:312 +#: ../../reference/lexical_analysis.rst:313 msgid "*Mc* - spacing combining marks" msgstr "" -#: ../../reference/lexical_analysis.rst:313 +#: ../../reference/lexical_analysis.rst:314 msgid "*Nd* - decimal numbers" msgstr "*Nd* - 十進位數字" -#: ../../reference/lexical_analysis.rst:314 +#: ../../reference/lexical_analysis.rst:315 msgid "*Pc* - connector punctuations" msgstr "" -#: ../../reference/lexical_analysis.rst:315 +#: ../../reference/lexical_analysis.rst:316 msgid "" -"*Other_ID_Start* - explicit list of characters in `PropList.txt <https://www." -"unicode.org/Public/15.1.0/ucd/PropList.txt>`_ to support backwards " +"*Other_ID_Start* - explicit list of characters in `PropList.txt <https://" +"www.unicode.org/Public/15.1.0/ucd/PropList.txt>`_ to support backwards " "compatibility" msgstr "" -#: ../../reference/lexical_analysis.rst:318 +#: ../../reference/lexical_analysis.rst:319 msgid "*Other_ID_Continue* - likewise" msgstr "" -#: ../../reference/lexical_analysis.rst:320 +#: ../../reference/lexical_analysis.rst:321 msgid "" "All identifiers are converted into the normal form NFKC while parsing; " "comparison of identifiers is based on NFKC." msgstr "" -#: ../../reference/lexical_analysis.rst:323 +#: ../../reference/lexical_analysis.rst:324 msgid "" "A non-normative HTML file listing all valid identifier characters for " "Unicode 15.1.0 can be found at https://www.unicode.org/Public/15.1.0/ucd/" "DerivedCoreProperties.txt" msgstr "" -#: ../../reference/lexical_analysis.rst:331 +#: ../../reference/lexical_analysis.rst:332 msgid "Keywords" msgstr "關鍵字" -#: ../../reference/lexical_analysis.rst:337 +#: ../../reference/lexical_analysis.rst:338 msgid "" "The following identifiers are used as reserved words, or *keywords* of the " "language, and cannot be used as ordinary identifiers. They must be spelled " "exactly as written here:" msgstr "" -#: ../../reference/lexical_analysis.rst:341 +#: ../../reference/lexical_analysis.rst:342 msgid "" "False await else import pass\n" "None break except in raise\n" @@ -475,11 +476,11 @@ msgstr "" "assert del global not with\n" "async elif if or yield" -#: ../../reference/lexical_analysis.rst:355 +#: ../../reference/lexical_analysis.rst:356 msgid "Soft Keywords" msgstr "軟關鍵字" -#: ../../reference/lexical_analysis.rst:361 +#: ../../reference/lexical_analysis.rst:362 msgid "" "Some identifiers are only reserved under specific contexts. These are known " "as *soft keywords*. The identifiers ``match``, ``case``, ``type`` and ``_`` " @@ -487,82 +488,82 @@ msgid "" "is done at the parser level, not when tokenizing." msgstr "" -#: ../../reference/lexical_analysis.rst:366 +#: ../../reference/lexical_analysis.rst:367 msgid "" "As soft keywords, their use in the grammar is possible while still " "preserving compatibility with existing code that uses these names as " "identifier names." msgstr "" -#: ../../reference/lexical_analysis.rst:370 +#: ../../reference/lexical_analysis.rst:371 msgid "" "``match``, ``case``, and ``_`` are used in the :keyword:`match` statement. " "``type`` is used in the :keyword:`type` statement." msgstr "" -#: ../../reference/lexical_analysis.rst:373 +#: ../../reference/lexical_analysis.rst:374 msgid "``type`` is now a soft keyword." msgstr "``type`` 現在是軟關鍵字。" -#: ../../reference/lexical_analysis.rst:382 +#: ../../reference/lexical_analysis.rst:383 msgid "Reserved classes of identifiers" msgstr "" -#: ../../reference/lexical_analysis.rst:384 +#: ../../reference/lexical_analysis.rst:385 msgid "" "Certain classes of identifiers (besides keywords) have special meanings. " "These classes are identified by the patterns of leading and trailing " "underscore characters:" msgstr "" -#: ../../reference/lexical_analysis.rst:388 +#: ../../reference/lexical_analysis.rst:389 msgid "``_*``" msgstr "``_*``" -#: ../../reference/lexical_analysis.rst:389 +#: ../../reference/lexical_analysis.rst:390 msgid "Not imported by ``from module import *``." msgstr "" -#: ../../reference/lexical_analysis.rst:391 +#: ../../reference/lexical_analysis.rst:392 msgid "``_``" msgstr "``_``" -#: ../../reference/lexical_analysis.rst:392 +#: ../../reference/lexical_analysis.rst:393 msgid "" -"In a ``case`` pattern within a :keyword:`match` statement, ``_`` is a :ref:" -"`soft keyword <soft-keywords>` that denotes a :ref:`wildcard <wildcard-" -"patterns>`." +"In a ``case`` pattern within a :keyword:`match` statement, ``_`` is " +"a :ref:`soft keyword <soft-keywords>` that denotes a :ref:`wildcard " +"<wildcard-patterns>`." msgstr "" -#: ../../reference/lexical_analysis.rst:396 +#: ../../reference/lexical_analysis.rst:397 msgid "" "Separately, the interactive interpreter makes the result of the last " -"evaluation available in the variable ``_``. (It is stored in the :mod:" -"`builtins` module, alongside built-in functions like ``print``.)" +"evaluation available in the variable ``_``. (It is stored in " +"the :mod:`builtins` module, alongside built-in functions like ``print``.)" msgstr "" -#: ../../reference/lexical_analysis.rst:401 +#: ../../reference/lexical_analysis.rst:402 msgid "" "Elsewhere, ``_`` is a regular identifier. It is often used to name " "\"special\" items, but it is not special to Python itself." msgstr "" -#: ../../reference/lexical_analysis.rst:406 +#: ../../reference/lexical_analysis.rst:407 msgid "" "The name ``_`` is often used in conjunction with internationalization; refer " "to the documentation for the :mod:`gettext` module for more information on " "this convention." msgstr "" -#: ../../reference/lexical_analysis.rst:410 +#: ../../reference/lexical_analysis.rst:411 msgid "It is also commonly used for unused variables." msgstr "" -#: ../../reference/lexical_analysis.rst:412 +#: ../../reference/lexical_analysis.rst:413 msgid "``__*__``" msgstr "``__*__``" -#: ../../reference/lexical_analysis.rst:413 +#: ../../reference/lexical_analysis.rst:414 msgid "" "System-defined names, informally known as \"dunder\" names. These names are " "defined by the interpreter and its implementation (including the standard " @@ -572,11 +573,11 @@ msgid "" "explicitly documented use, is subject to breakage without warning." msgstr "" -#: ../../reference/lexical_analysis.rst:420 +#: ../../reference/lexical_analysis.rst:421 msgid "``__*``" msgstr "``__*``" -#: ../../reference/lexical_analysis.rst:421 +#: ../../reference/lexical_analysis.rst:422 msgid "" "Class-private names. Names in this category, when used within the context " "of a class definition, are re-written to use a mangled form to help avoid " @@ -584,33 +585,33 @@ msgid "" "section :ref:`atom-identifiers`." msgstr "" -#: ../../reference/lexical_analysis.rst:430 +#: ../../reference/lexical_analysis.rst:431 msgid "Literals" msgstr "" -#: ../../reference/lexical_analysis.rst:434 +#: ../../reference/lexical_analysis.rst:435 msgid "Literals are notations for constant values of some built-in types." msgstr "" -#: ../../reference/lexical_analysis.rst:445 +#: ../../reference/lexical_analysis.rst:446 msgid "String and Bytes literals" msgstr "" -#: ../../reference/lexical_analysis.rst:447 +#: ../../reference/lexical_analysis.rst:448 msgid "String literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:472 +#: ../../reference/lexical_analysis.rst:473 msgid "" "One syntactic restriction not indicated by these productions is that " "whitespace is not allowed between the :token:`~python-grammar:stringprefix` " "or :token:`~python-grammar:bytesprefix` and the rest of the literal. The " "source character set is defined by the encoding declaration; it is UTF-8 if " -"no encoding declaration is given in the source file; see section :ref:" -"`encodings`." +"no encoding declaration is given in the source file; see " +"section :ref:`encodings`." msgstr "" -#: ../../reference/lexical_analysis.rst:482 +#: ../../reference/lexical_analysis.rst:483 msgid "" "In plain English: Both types of literals can be enclosed in matching single " "quotes (``'``) or double quotes (``\"``). They can also be enclosed in " @@ -623,7 +624,7 @@ msgid "" "sequences>` below for examples." msgstr "" -#: ../../reference/lexical_analysis.rst:495 +#: ../../reference/lexical_analysis.rst:496 msgid "" "Bytes literals are always prefixed with ``'b'`` or ``'B'``; they produce an " "instance of the :class:`bytes` type instead of the :class:`str` type. They " @@ -631,7 +632,7 @@ msgid "" "greater must be expressed with escapes." msgstr "" -#: ../../reference/lexical_analysis.rst:504 +#: ../../reference/lexical_analysis.rst:505 msgid "" "Both string and bytes literals may optionally be prefixed with a letter " "``'r'`` or ``'R'``; such constructs are called :dfn:`raw string literals` " @@ -640,20 +641,20 @@ msgid "" "escapes are not treated specially." msgstr "" -#: ../../reference/lexical_analysis.rst:510 +#: ../../reference/lexical_analysis.rst:511 msgid "" "The ``'rb'`` prefix of raw bytes literals has been added as a synonym of " "``'br'``." msgstr "" -#: ../../reference/lexical_analysis.rst:514 +#: ../../reference/lexical_analysis.rst:515 msgid "" "Support for the unicode legacy literal (``u'value'``) was reintroduced to " -"simplify the maintenance of dual Python 2.x and 3.x codebases. See :pep:" -"`414` for more information." +"simplify the maintenance of dual Python 2.x and 3.x codebases. " +"See :pep:`414` for more information." msgstr "" -#: ../../reference/lexical_analysis.rst:522 +#: ../../reference/lexical_analysis.rst:523 msgid "" "A string literal with ``'f'`` or ``'F'`` in its prefix is a :dfn:`formatted " "string literal`; see :ref:`f-strings`. The ``'f'`` may be combined with " @@ -661,7 +662,7 @@ msgid "" "are possible, but formatted bytes literals are not." msgstr "" -#: ../../reference/lexical_analysis.rst:527 +#: ../../reference/lexical_analysis.rst:528 msgid "" "In triple-quoted literals, unescaped newlines and quotes are allowed (and " "are retained), except that three unescaped quotes in a row terminate the " @@ -669,253 +670,253 @@ msgid "" "either ``'`` or ``\"``.)" msgstr "" -#: ../../reference/lexical_analysis.rst:550 +#: ../../reference/lexical_analysis.rst:551 msgid "Escape sequences" msgstr "跳脫序列" -#: ../../reference/lexical_analysis.rst:552 +#: ../../reference/lexical_analysis.rst:553 msgid "" "Unless an ``'r'`` or ``'R'`` prefix is present, escape sequences in string " "and bytes literals are interpreted according to rules similar to those used " "by Standard C. The recognized escape sequences are:" msgstr "" -#: ../../reference/lexical_analysis.rst:557 -#: ../../reference/lexical_analysis.rst:590 +#: ../../reference/lexical_analysis.rst:558 +#: ../../reference/lexical_analysis.rst:591 msgid "Escape Sequence" msgstr "" -#: ../../reference/lexical_analysis.rst:557 -#: ../../reference/lexical_analysis.rst:590 +#: ../../reference/lexical_analysis.rst:558 +#: ../../reference/lexical_analysis.rst:591 msgid "Meaning" msgstr "含義" -#: ../../reference/lexical_analysis.rst:557 -#: ../../reference/lexical_analysis.rst:590 +#: ../../reference/lexical_analysis.rst:558 +#: ../../reference/lexical_analysis.rst:591 msgid "Notes" msgstr "註解" -#: ../../reference/lexical_analysis.rst:559 +#: ../../reference/lexical_analysis.rst:560 msgid "``\\``\\ <newline>" msgstr "``\\``\\ <newline>" -#: ../../reference/lexical_analysis.rst:559 +#: ../../reference/lexical_analysis.rst:560 msgid "Backslash and newline ignored" msgstr "" -#: ../../reference/lexical_analysis.rst:559 +#: ../../reference/lexical_analysis.rst:560 msgid "\\(1)" msgstr "\\(1)" -#: ../../reference/lexical_analysis.rst:561 +#: ../../reference/lexical_analysis.rst:562 msgid "``\\\\``" msgstr "``\\\\``" -#: ../../reference/lexical_analysis.rst:561 +#: ../../reference/lexical_analysis.rst:562 msgid "Backslash (``\\``)" msgstr "" -#: ../../reference/lexical_analysis.rst:563 +#: ../../reference/lexical_analysis.rst:564 msgid "``\\'``" msgstr "``\\'``" -#: ../../reference/lexical_analysis.rst:563 +#: ../../reference/lexical_analysis.rst:564 msgid "Single quote (``'``)" msgstr "單引號 (``'``)" -#: ../../reference/lexical_analysis.rst:565 +#: ../../reference/lexical_analysis.rst:566 msgid "``\\\"``" msgstr "``\\\"``" -#: ../../reference/lexical_analysis.rst:565 +#: ../../reference/lexical_analysis.rst:566 msgid "Double quote (``\"``)" msgstr "雙引號 (``\"``)" -#: ../../reference/lexical_analysis.rst:567 +#: ../../reference/lexical_analysis.rst:568 msgid "``\\a``" msgstr "``\\a``" -#: ../../reference/lexical_analysis.rst:567 +#: ../../reference/lexical_analysis.rst:568 msgid "ASCII Bell (BEL)" msgstr "" -#: ../../reference/lexical_analysis.rst:569 +#: ../../reference/lexical_analysis.rst:570 msgid "``\\b``" msgstr "``\\b``" -#: ../../reference/lexical_analysis.rst:569 +#: ../../reference/lexical_analysis.rst:570 msgid "ASCII Backspace (BS)" msgstr "" -#: ../../reference/lexical_analysis.rst:571 +#: ../../reference/lexical_analysis.rst:572 msgid "``\\f``" msgstr "``\\f``" -#: ../../reference/lexical_analysis.rst:571 +#: ../../reference/lexical_analysis.rst:572 msgid "ASCII Formfeed (FF)" msgstr "" -#: ../../reference/lexical_analysis.rst:573 +#: ../../reference/lexical_analysis.rst:574 msgid "``\\n``" msgstr "``\\n``" -#: ../../reference/lexical_analysis.rst:573 +#: ../../reference/lexical_analysis.rst:574 msgid "ASCII Linefeed (LF)" msgstr "" -#: ../../reference/lexical_analysis.rst:575 +#: ../../reference/lexical_analysis.rst:576 msgid "``\\r``" msgstr "``\\r``" -#: ../../reference/lexical_analysis.rst:575 +#: ../../reference/lexical_analysis.rst:576 msgid "ASCII Carriage Return (CR)" msgstr "" -#: ../../reference/lexical_analysis.rst:577 +#: ../../reference/lexical_analysis.rst:578 msgid "``\\t``" msgstr "``\\t``" -#: ../../reference/lexical_analysis.rst:577 +#: ../../reference/lexical_analysis.rst:578 msgid "ASCII Horizontal Tab (TAB)" msgstr "" -#: ../../reference/lexical_analysis.rst:579 +#: ../../reference/lexical_analysis.rst:580 msgid "``\\v``" msgstr "``\\v``" -#: ../../reference/lexical_analysis.rst:579 +#: ../../reference/lexical_analysis.rst:580 msgid "ASCII Vertical Tab (VT)" msgstr "" -#: ../../reference/lexical_analysis.rst:581 +#: ../../reference/lexical_analysis.rst:582 msgid ":samp:`\\\\\\\\{ooo}`" msgstr ":samp:`\\\\\\\\{ooo}`" -#: ../../reference/lexical_analysis.rst:581 +#: ../../reference/lexical_analysis.rst:582 msgid "Character with octal value *ooo*" msgstr "" -#: ../../reference/lexical_analysis.rst:581 +#: ../../reference/lexical_analysis.rst:582 msgid "(2,4)" msgstr "(2,4)" -#: ../../reference/lexical_analysis.rst:584 +#: ../../reference/lexical_analysis.rst:585 msgid ":samp:`\\\\x{hh}`" msgstr ":samp:`\\\\x{hh}`" -#: ../../reference/lexical_analysis.rst:584 +#: ../../reference/lexical_analysis.rst:585 msgid "Character with hex value *hh*" msgstr "" -#: ../../reference/lexical_analysis.rst:584 +#: ../../reference/lexical_analysis.rst:585 msgid "(3,4)" msgstr "(3,4)" -#: ../../reference/lexical_analysis.rst:587 +#: ../../reference/lexical_analysis.rst:588 msgid "Escape sequences only recognized in string literals are:" msgstr "" -#: ../../reference/lexical_analysis.rst:592 +#: ../../reference/lexical_analysis.rst:593 msgid ":samp:`\\\\N\\\\{{name}\\\\}`" msgstr ":samp:`\\\\N\\\\{{name}\\\\}`" -#: ../../reference/lexical_analysis.rst:592 +#: ../../reference/lexical_analysis.rst:593 msgid "Character named *name* in the Unicode database" msgstr "" -#: ../../reference/lexical_analysis.rst:592 +#: ../../reference/lexical_analysis.rst:593 msgid "\\(5)" msgstr "\\(5)" -#: ../../reference/lexical_analysis.rst:595 +#: ../../reference/lexical_analysis.rst:596 msgid ":samp:`\\\\u{xxxx}`" msgstr ":samp:`\\\\u{xxxx}`" -#: ../../reference/lexical_analysis.rst:595 +#: ../../reference/lexical_analysis.rst:596 msgid "Character with 16-bit hex value *xxxx*" msgstr "" -#: ../../reference/lexical_analysis.rst:595 +#: ../../reference/lexical_analysis.rst:596 msgid "\\(6)" msgstr "\\(6)" -#: ../../reference/lexical_analysis.rst:598 +#: ../../reference/lexical_analysis.rst:599 msgid ":samp:`\\\\U{xxxxxxxx}`" msgstr ":samp:`\\\\U{xxxxxxxx}`" -#: ../../reference/lexical_analysis.rst:598 +#: ../../reference/lexical_analysis.rst:599 msgid "Character with 32-bit hex value *xxxxxxxx*" msgstr "" -#: ../../reference/lexical_analysis.rst:598 +#: ../../reference/lexical_analysis.rst:599 msgid "\\(7)" msgstr "\\(7)" -#: ../../reference/lexical_analysis.rst:602 +#: ../../reference/lexical_analysis.rst:603 msgid "Notes:" msgstr "註解:" -#: ../../reference/lexical_analysis.rst:605 +#: ../../reference/lexical_analysis.rst:606 msgid "A backslash can be added at the end of a line to ignore the newline::" msgstr "" -#: ../../reference/lexical_analysis.rst:607 +#: ../../reference/lexical_analysis.rst:608 msgid "" ">>> 'This string will not include \\\n" "... backslashes or newline characters.'\n" "'This string will not include backslashes or newline characters.'" msgstr "" -#: ../../reference/lexical_analysis.rst:611 +#: ../../reference/lexical_analysis.rst:612 msgid "" "The same result can be achieved using :ref:`triple-quoted strings " "<strings>`, or parentheses and :ref:`string literal concatenation <string-" "concatenation>`." msgstr "" -#: ../../reference/lexical_analysis.rst:616 +#: ../../reference/lexical_analysis.rst:617 msgid "As in Standard C, up to three octal digits are accepted." msgstr "" -#: ../../reference/lexical_analysis.rst:618 +#: ../../reference/lexical_analysis.rst:619 msgid "" -"Octal escapes with value larger than ``0o377`` produce a :exc:" -"`DeprecationWarning`." +"Octal escapes with value larger than ``0o377`` produce " +"a :exc:`DeprecationWarning`." msgstr "" -#: ../../reference/lexical_analysis.rst:622 +#: ../../reference/lexical_analysis.rst:623 msgid "" -"Octal escapes with value larger than ``0o377`` produce a :exc:" -"`SyntaxWarning`. In a future Python version they will be eventually a :exc:" -"`SyntaxError`." +"Octal escapes with value larger than ``0o377`` produce " +"a :exc:`SyntaxWarning`. In a future Python version they will be eventually " +"a :exc:`SyntaxError`." msgstr "" -#: ../../reference/lexical_analysis.rst:628 +#: ../../reference/lexical_analysis.rst:629 msgid "Unlike in Standard C, exactly two hex digits are required." msgstr "" -#: ../../reference/lexical_analysis.rst:631 +#: ../../reference/lexical_analysis.rst:632 msgid "" "In a bytes literal, hexadecimal and octal escapes denote the byte with the " "given value. In a string literal, these escapes denote a Unicode character " "with the given value." msgstr "" -#: ../../reference/lexical_analysis.rst:636 +#: ../../reference/lexical_analysis.rst:637 msgid "Support for name aliases [#]_ has been added." msgstr "" -#: ../../reference/lexical_analysis.rst:640 +#: ../../reference/lexical_analysis.rst:641 msgid "Exactly four hex digits are required." msgstr "" -#: ../../reference/lexical_analysis.rst:643 +#: ../../reference/lexical_analysis.rst:644 msgid "" "Any Unicode character can be encoded this way. Exactly eight hex digits are " "required." msgstr "" -#: ../../reference/lexical_analysis.rst:649 +#: ../../reference/lexical_analysis.rst:650 msgid "" "Unlike Standard C, all unrecognized escape sequences are left in the string " "unchanged, i.e., *the backslash is left in the result*. (This behavior is " @@ -925,17 +926,17 @@ msgid "" "category of unrecognized escapes for bytes literals." msgstr "" -#: ../../reference/lexical_analysis.rst:656 +#: ../../reference/lexical_analysis.rst:657 msgid "Unrecognized escape sequences produce a :exc:`DeprecationWarning`." msgstr "" -#: ../../reference/lexical_analysis.rst:659 +#: ../../reference/lexical_analysis.rst:660 msgid "" "Unrecognized escape sequences produce a :exc:`SyntaxWarning`. In a future " "Python version they will be eventually a :exc:`SyntaxError`." msgstr "" -#: ../../reference/lexical_analysis.rst:663 +#: ../../reference/lexical_analysis.rst:664 msgid "" "Even in a raw literal, quotes can be escaped with a backslash, but the " "backslash remains in the result; for example, ``r\"\\\"\"`` is a valid " @@ -948,11 +949,11 @@ msgid "" "continuation." msgstr "" -#: ../../reference/lexical_analysis.rst:676 +#: ../../reference/lexical_analysis.rst:677 msgid "String literal concatenation" msgstr "" -#: ../../reference/lexical_analysis.rst:678 +#: ../../reference/lexical_analysis.rst:679 msgid "" "Multiple adjacent string or bytes literals (delimited by whitespace), " "possibly using different quoting conventions, are allowed, and their meaning " @@ -962,14 +963,14 @@ msgid "" "lines, or even to add comments to parts of strings, for example::" msgstr "" -#: ../../reference/lexical_analysis.rst:685 +#: ../../reference/lexical_analysis.rst:686 msgid "" "re.compile(\"[A-Za-z_]\" # letter or underscore\n" " \"[A-Za-z0-9_]*\" # letter, digit or underscore\n" " )" msgstr "" -#: ../../reference/lexical_analysis.rst:689 +#: ../../reference/lexical_analysis.rst:690 msgid "" "Note that this feature is defined at the syntactical level, but implemented " "at compile time. The '+' operator must be used to concatenate string " @@ -979,11 +980,11 @@ msgid "" "with plain string literals." msgstr "" -#: ../../reference/lexical_analysis.rst:712 +#: ../../reference/lexical_analysis.rst:713 msgid "f-strings" msgstr "f-string(f 字串)" -#: ../../reference/lexical_analysis.rst:716 +#: ../../reference/lexical_analysis.rst:717 msgid "" "A :dfn:`formatted string literal` or :dfn:`f-string` is a string literal " "that is prefixed with ``'f'`` or ``'F'``. These strings may contain " @@ -992,14 +993,14 @@ msgid "" "are really expressions evaluated at run time." msgstr "" -#: ../../reference/lexical_analysis.rst:722 +#: ../../reference/lexical_analysis.rst:723 msgid "" "Escape sequences are decoded like in ordinary string literals (except when a " "literal is also marked as a raw string). After decoding, the grammar for " "the contents of the string is:" msgstr "" -#: ../../reference/lexical_analysis.rst:736 +#: ../../reference/lexical_analysis.rst:737 msgid "" "The parts of the string outside curly braces are treated literally, except " "that any doubled curly braces ``'{{'`` or ``'}}'`` are replaced with the " @@ -1012,7 +1013,7 @@ msgid "" "replacement field ends with a closing curly bracket ``'}'``." msgstr "" -#: ../../reference/lexical_analysis.rst:746 +#: ../../reference/lexical_analysis.rst:747 msgid "" "Expressions in formatted string literals are treated like regular Python " "expressions surrounded by parentheses, with a few exceptions. An empty " @@ -1026,27 +1027,27 @@ msgid "" "replacement fields must be closed in a different line." msgstr "" -#: ../../reference/lexical_analysis.rst:757 +#: ../../reference/lexical_analysis.rst:758 msgid "" ">>> f\"abc{a # This is a comment }\"\n" "... + 3}\"\n" "'abc5'" msgstr "" -#: ../../reference/lexical_analysis.rst:763 +#: ../../reference/lexical_analysis.rst:764 msgid "" "Prior to Python 3.7, an :keyword:`await` expression and comprehensions " "containing an :keyword:`async for` clause were illegal in the expressions in " "formatted string literals due to a problem with the implementation." msgstr "" -#: ../../reference/lexical_analysis.rst:768 +#: ../../reference/lexical_analysis.rst:769 msgid "" "Prior to Python 3.12, comments were not allowed inside f-string replacement " "fields." msgstr "" -#: ../../reference/lexical_analysis.rst:772 +#: ../../reference/lexical_analysis.rst:773 msgid "" "When the equal sign ``'='`` is provided, the output will have the expression " "text, the ``'='`` and the evaluated value. Spaces after the opening brace " @@ -1057,18 +1058,18 @@ msgid "" "r'`` is declared." msgstr "" -#: ../../reference/lexical_analysis.rst:780 +#: ../../reference/lexical_analysis.rst:781 msgid "The equal sign ``'='``." msgstr "等號 ``'='``。" -#: ../../reference/lexical_analysis.rst:783 +#: ../../reference/lexical_analysis.rst:784 msgid "" "If a conversion is specified, the result of evaluating the expression is " "converted before formatting. Conversion ``'!s'`` calls :func:`str` on the " "result, ``'!r'`` calls :func:`repr`, and ``'!a'`` calls :func:`ascii`." msgstr "" -#: ../../reference/lexical_analysis.rst:787 +#: ../../reference/lexical_analysis.rst:788 msgid "" "The result is then formatted using the :func:`format` protocol. The format " "specifier is passed to the :meth:`~object.__format__` method of the " @@ -1077,7 +1078,7 @@ msgid "" "value of the whole string." msgstr "" -#: ../../reference/lexical_analysis.rst:793 +#: ../../reference/lexical_analysis.rst:794 msgid "" "Top-level format specifiers may include nested replacement fields. These " "nested fields may include their own conversion fields and :ref:`format " @@ -1086,17 +1087,17 @@ msgid "" "as that used by the :meth:`str.format` method." msgstr "" -#: ../../reference/lexical_analysis.rst:799 +#: ../../reference/lexical_analysis.rst:800 msgid "" "Formatted string literals may be concatenated, but replacement fields cannot " "be split across literals." msgstr "" -#: ../../reference/lexical_analysis.rst:802 +#: ../../reference/lexical_analysis.rst:803 msgid "Some examples of formatted string literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:804 +#: ../../reference/lexical_analysis.rst:805 msgid "" ">>> name = \"Fred\"\n" ">>> f\"He said his name is {name!r}.\"\n" @@ -1128,13 +1129,13 @@ msgid "" "'line = \"The mill\\'s closed\" '" msgstr "" -#: ../../reference/lexical_analysis.rst:834 +#: ../../reference/lexical_analysis.rst:835 msgid "" "Reusing the outer f-string quoting type inside a replacement field is " "permitted::" msgstr "" -#: ../../reference/lexical_analysis.rst:837 +#: ../../reference/lexical_analysis.rst:838 msgid "" ">>> a = dict(x=2)\n" ">>> f\"abc {a[\"x\"]} def\"\n" @@ -1144,19 +1145,19 @@ msgstr "" ">>> f\"abc {a[\"x\"]} def\"\n" "'abc 2 def'" -#: ../../reference/lexical_analysis.rst:841 +#: ../../reference/lexical_analysis.rst:842 msgid "" "Prior to Python 3.12, reuse of the same quoting type of the outer f-string " "inside a replacement field was not possible." msgstr "" -#: ../../reference/lexical_analysis.rst:845 +#: ../../reference/lexical_analysis.rst:846 msgid "" "Backslashes are also allowed in replacement fields and are evaluated the " "same way as in any other context::" msgstr "" -#: ../../reference/lexical_analysis.rst:848 +#: ../../reference/lexical_analysis.rst:849 msgid "" ">>> a = [\"a\", \"b\", \"c\"]\n" ">>> print(f\"List a contains:\\n{\"\\n\".join(a)}\")\n" @@ -1172,19 +1173,19 @@ msgstr "" "b\n" "c" -#: ../../reference/lexical_analysis.rst:855 +#: ../../reference/lexical_analysis.rst:856 msgid "" "Prior to Python 3.12, backslashes were not permitted inside an f-string " "replacement field." msgstr "" -#: ../../reference/lexical_analysis.rst:859 +#: ../../reference/lexical_analysis.rst:860 msgid "" "Formatted string literals cannot be used as docstrings, even if they do not " "include expressions." msgstr "" -#: ../../reference/lexical_analysis.rst:864 +#: ../../reference/lexical_analysis.rst:865 msgid "" ">>> def foo():\n" "... f\"Not a docstring\"\n" @@ -1193,63 +1194,63 @@ msgid "" "True" msgstr "" -#: ../../reference/lexical_analysis.rst:870 +#: ../../reference/lexical_analysis.rst:871 msgid "" "See also :pep:`498` for the proposal that added formatted string literals, " "and :meth:`str.format`, which uses a related format string mechanism." msgstr "" -#: ../../reference/lexical_analysis.rst:877 +#: ../../reference/lexical_analysis.rst:878 msgid "Numeric literals" msgstr "" -#: ../../reference/lexical_analysis.rst:883 +#: ../../reference/lexical_analysis.rst:884 msgid "" "There are three types of numeric literals: integers, floating-point numbers, " "and imaginary numbers. There are no complex literals (complex numbers can " "be formed by adding a real number and an imaginary number)." msgstr "" -#: ../../reference/lexical_analysis.rst:887 +#: ../../reference/lexical_analysis.rst:888 msgid "" "Note that numeric literals do not include a sign; a phrase like ``-1`` is " "actually an expression composed of the unary operator '``-``' and the " "literal ``1``." msgstr "" -#: ../../reference/lexical_analysis.rst:901 +#: ../../reference/lexical_analysis.rst:902 msgid "Integer literals" msgstr "" -#: ../../reference/lexical_analysis.rst:903 +#: ../../reference/lexical_analysis.rst:904 msgid "Integer literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:917 +#: ../../reference/lexical_analysis.rst:918 msgid "" "There is no limit for the length of integer literals apart from what can be " "stored in available memory." msgstr "" -#: ../../reference/lexical_analysis.rst:920 +#: ../../reference/lexical_analysis.rst:921 msgid "" "Underscores are ignored for determining the numeric value of the literal. " "They can be used to group digits for enhanced readability. One underscore " "can occur between digits, and after base specifiers like ``0x``." msgstr "" -#: ../../reference/lexical_analysis.rst:924 +#: ../../reference/lexical_analysis.rst:925 msgid "" "Note that leading zeros in a non-zero decimal number are not allowed. This " "is for disambiguation with C-style octal literals, which Python used before " "version 3.0." msgstr "" -#: ../../reference/lexical_analysis.rst:928 +#: ../../reference/lexical_analysis.rst:929 msgid "Some examples of integer literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:930 +#: ../../reference/lexical_analysis.rst:931 msgid "" "7 2147483647 0o177 0b100110111\n" "3 79228162514264337593543950336 0o377 0xdeadbeef\n" @@ -1259,21 +1260,21 @@ msgstr "" "3 79228162514264337593543950336 0o377 0xdeadbeef\n" " 100_000_000_000 0b_1110_0101" -#: ../../reference/lexical_analysis.rst:934 -#: ../../reference/lexical_analysis.rst:966 +#: ../../reference/lexical_analysis.rst:935 +#: ../../reference/lexical_analysis.rst:967 msgid "Underscores are now allowed for grouping purposes in literals." msgstr "" -#: ../../reference/lexical_analysis.rst:945 +#: ../../reference/lexical_analysis.rst:946 msgid "Floating-point literals" msgstr "浮點數常數 (Floating-point literals)" -#: ../../reference/lexical_analysis.rst:947 +#: ../../reference/lexical_analysis.rst:948 msgid "" "Floating-point literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:957 +#: ../../reference/lexical_analysis.rst:958 msgid "" "Note that the integer and exponent parts are always interpreted using radix " "10. For example, ``077e010`` is legal, and denotes the same number as " @@ -1282,23 +1283,23 @@ msgid "" "grouping." msgstr "" -#: ../../reference/lexical_analysis.rst:962 +#: ../../reference/lexical_analysis.rst:963 msgid "Some examples of floating-point literals::" msgstr "一些浮點數常數的範例: ::" -#: ../../reference/lexical_analysis.rst:964 +#: ../../reference/lexical_analysis.rst:965 msgid "3.14 10. .001 1e100 3.14e-10 0e0 3.14_15_93" msgstr "3.14 10. .001 1e100 3.14e-10 0e0 3.14_15_93" -#: ../../reference/lexical_analysis.rst:975 +#: ../../reference/lexical_analysis.rst:976 msgid "Imaginary literals" msgstr "" -#: ../../reference/lexical_analysis.rst:977 +#: ../../reference/lexical_analysis.rst:978 msgid "Imaginary literals are described by the following lexical definitions:" msgstr "" -#: ../../reference/lexical_analysis.rst:982 +#: ../../reference/lexical_analysis.rst:983 msgid "" "An imaginary literal yields a complex number with a real part of 0.0. " "Complex numbers are represented as a pair of floating-point numbers and have " @@ -1307,19 +1308,19 @@ msgid "" "Some examples of imaginary literals::" msgstr "" -#: ../../reference/lexical_analysis.rst:988 +#: ../../reference/lexical_analysis.rst:989 msgid "3.14j 10.j 10j .001j 1e100j 3.14e-10j 3.14_15_93j" msgstr "3.14j 10.j 10j .001j 1e100j 3.14e-10j 3.14_15_93j" -#: ../../reference/lexical_analysis.rst:994 +#: ../../reference/lexical_analysis.rst:995 msgid "Operators" msgstr "" -#: ../../reference/lexical_analysis.rst:998 +#: ../../reference/lexical_analysis.rst:999 msgid "The following tokens are operators:" msgstr "" -#: ../../reference/lexical_analysis.rst:1000 +#: ../../reference/lexical_analysis.rst:1001 msgid "" "+ - * ** / // % @\n" "<< >> & | ^ ~ :=\n" @@ -1329,15 +1330,15 @@ msgstr "" "<< >> & | ^ ~ :=\n" "< > <= >= == !=" -#: ../../reference/lexical_analysis.rst:1011 +#: ../../reference/lexical_analysis.rst:1012 msgid "Delimiters" msgstr "" -#: ../../reference/lexical_analysis.rst:1015 +#: ../../reference/lexical_analysis.rst:1016 msgid "The following tokens serve as delimiters in the grammar:" msgstr "" -#: ../../reference/lexical_analysis.rst:1017 +#: ../../reference/lexical_analysis.rst:1018 msgid "" "( ) [ ] { }\n" ", : ! . ; @ =\n" @@ -1349,7 +1350,7 @@ msgstr "" "-> += -= *= /= //= %=\n" "@= &= |= ^= >>= <<= **=" -#: ../../reference/lexical_analysis.rst:1024 +#: ../../reference/lexical_analysis.rst:1025 msgid "" "The period can also occur in floating-point and imaginary literals. A " "sequence of three periods has a special meaning as an ellipsis literal. The " @@ -1357,31 +1358,31 @@ msgid "" "as delimiters, but also perform an operation." msgstr "" -#: ../../reference/lexical_analysis.rst:1029 +#: ../../reference/lexical_analysis.rst:1030 msgid "" "The following printing ASCII characters have special meaning as part of " "other tokens or are otherwise significant to the lexical analyzer:" msgstr "" -#: ../../reference/lexical_analysis.rst:1032 +#: ../../reference/lexical_analysis.rst:1033 msgid "' \" # \\" msgstr "' \" # \\" -#: ../../reference/lexical_analysis.rst:1036 +#: ../../reference/lexical_analysis.rst:1037 msgid "" "The following printing ASCII characters are not used in Python. Their " "occurrence outside string literals and comments is an unconditional error:" msgstr "" -#: ../../reference/lexical_analysis.rst:1039 +#: ../../reference/lexical_analysis.rst:1040 msgid "$ ? `" msgstr "$ ? `" -#: ../../reference/lexical_analysis.rst:1045 +#: ../../reference/lexical_analysis.rst:1046 msgid "Footnotes" msgstr "註解" -#: ../../reference/lexical_analysis.rst:1046 +#: ../../reference/lexical_analysis.rst:1047 msgid "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" msgstr "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" @@ -1397,415 +1398,415 @@ msgstr "parser(剖析器)" msgid "token" msgstr "token" -#: ../../reference/lexical_analysis.rst:25 +#: ../../reference/lexical_analysis.rst:26 msgid "line structure" msgstr "line structure(列結構)" -#: ../../reference/lexical_analysis.rst:35 +#: ../../reference/lexical_analysis.rst:36 msgid "logical line" msgstr "logical line(邏輯列)" -#: ../../reference/lexical_analysis.rst:35 -#: ../../reference/lexical_analysis.rst:114 -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:36 +#: ../../reference/lexical_analysis.rst:115 +#: ../../reference/lexical_analysis.rst:532 msgid "physical line" msgstr "physical line(物理列)" -#: ../../reference/lexical_analysis.rst:35 -#: ../../reference/lexical_analysis.rst:114 +#: ../../reference/lexical_analysis.rst:36 +#: ../../reference/lexical_analysis.rst:115 msgid "line joining" msgstr "line joining(列連接)" -#: ../../reference/lexical_analysis.rst:35 +#: ../../reference/lexical_analysis.rst:36 msgid "NEWLINE token" msgstr "NEWLINE token(換行標誌)" -#: ../../reference/lexical_analysis.rst:67 +#: ../../reference/lexical_analysis.rst:68 msgid "comment" msgstr "comment(註解)" -#: ../../reference/lexical_analysis.rst:67 +#: ../../reference/lexical_analysis.rst:68 msgid "hash character" msgstr "hash character(井字號)" -#: ../../reference/lexical_analysis.rst:67 -#: ../../reference/lexical_analysis.rst:81 +#: ../../reference/lexical_analysis.rst:68 +#: ../../reference/lexical_analysis.rst:82 msgid "# (hash)" msgstr "# (井字號)" -#: ../../reference/lexical_analysis.rst:81 +#: ../../reference/lexical_analysis.rst:82 msgid "source character set" msgstr "source character set(原始字元集合)" -#: ../../reference/lexical_analysis.rst:81 +#: ../../reference/lexical_analysis.rst:82 msgid "encoding declarations (source file)" msgstr "encoding declarations (source file)(編碼宣告(原始檔案))" -#: ../../reference/lexical_analysis.rst:81 +#: ../../reference/lexical_analysis.rst:82 msgid "source encoding declaration" msgstr "source encoding declaration(原始編碼宣告)" -#: ../../reference/lexical_analysis.rst:114 +#: ../../reference/lexical_analysis.rst:115 msgid "line continuation" msgstr "line continuation(列延續)" -#: ../../reference/lexical_analysis.rst:114 +#: ../../reference/lexical_analysis.rst:115 msgid "backslash character" msgstr "backslash character(反斜線字元)" -#: ../../reference/lexical_analysis.rst:159 +#: ../../reference/lexical_analysis.rst:160 msgid "blank line" msgstr "blank line(空白列)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "indentation" msgstr "indentation(縮排)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "leading whitespace" msgstr "leading whitespace(前置空白)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "space" msgstr "space(空白)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "tab" msgstr "tab(定位字元)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "grouping" msgstr "grouping(群組)" -#: ../../reference/lexical_analysis.rst:174 +#: ../../reference/lexical_analysis.rst:175 msgid "statement grouping" msgstr "statement grouping(陳述式群組)" -#: ../../reference/lexical_analysis.rst:202 +#: ../../reference/lexical_analysis.rst:203 msgid "INDENT token" msgstr "INDENT token(縮排標誌)" -#: ../../reference/lexical_analysis.rst:202 +#: ../../reference/lexical_analysis.rst:203 msgid "DEDENT token" msgstr "DEDENT token(縮排標誌)" -#: ../../reference/lexical_analysis.rst:277 +#: ../../reference/lexical_analysis.rst:278 msgid "identifier" msgstr "identifier(識別器)" -#: ../../reference/lexical_analysis.rst:277 +#: ../../reference/lexical_analysis.rst:278 msgid "name" msgstr "name(名稱)" -#: ../../reference/lexical_analysis.rst:333 -#: ../../reference/lexical_analysis.rst:357 +#: ../../reference/lexical_analysis.rst:334 +#: ../../reference/lexical_analysis.rst:358 msgid "keyword" msgstr "keyword(關鍵字)" -#: ../../reference/lexical_analysis.rst:333 +#: ../../reference/lexical_analysis.rst:334 msgid "reserved word" msgstr "reserved word(保留字)" -#: ../../reference/lexical_analysis.rst:357 +#: ../../reference/lexical_analysis.rst:358 msgid "soft keyword" msgstr "soft keyword(軟關鍵字)" -#: ../../reference/lexical_analysis.rst:376 +#: ../../reference/lexical_analysis.rst:377 msgid "_, identifiers" msgstr "_, identifiers(識別器)" -#: ../../reference/lexical_analysis.rst:376 +#: ../../reference/lexical_analysis.rst:377 msgid "__, identifiers" msgstr "__, identifiers(識別器)" -#: ../../reference/lexical_analysis.rst:432 +#: ../../reference/lexical_analysis.rst:433 msgid "literal" msgstr "literal(常數)" -#: ../../reference/lexical_analysis.rst:432 +#: ../../reference/lexical_analysis.rst:433 msgid "constant" msgstr "constant(常數)" -#: ../../reference/lexical_analysis.rst:437 -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:438 +#: ../../reference/lexical_analysis.rst:479 msgid "string literal" msgstr "string literal(字串常數)" -#: ../../reference/lexical_analysis.rst:437 -#: ../../reference/lexical_analysis.rst:491 +#: ../../reference/lexical_analysis.rst:438 +#: ../../reference/lexical_analysis.rst:492 msgid "bytes literal" msgstr "bytes literal(位元組常數)" -#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:438 msgid "ASCII" msgstr "ASCII" -#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:438 msgid "' (single quote)" msgstr "' (單引號)" -#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:438 msgid "\" (double quote)" msgstr "\" (雙引號)" -#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:438 msgid "u'" msgstr "u'" -#: ../../reference/lexical_analysis.rst:437 +#: ../../reference/lexical_analysis.rst:438 msgid "u\"" msgstr "u\"" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:479 msgid "triple-quoted string" msgstr "triple-quoted string(三引號字串)" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:479 msgid "Unicode Consortium" msgstr "Unicode Consortium" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:479 msgid "raw string" msgstr "raw string(原始字串)" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:479 msgid "\"\"\"" msgstr "\"\"\"" -#: ../../reference/lexical_analysis.rst:478 +#: ../../reference/lexical_analysis.rst:479 msgid "'''" msgstr "'''" -#: ../../reference/lexical_analysis.rst:491 +#: ../../reference/lexical_analysis.rst:492 msgid "b'" msgstr "b'" -#: ../../reference/lexical_analysis.rst:491 +#: ../../reference/lexical_analysis.rst:492 msgid "b\"" msgstr "b\"" -#: ../../reference/lexical_analysis.rst:500 +#: ../../reference/lexical_analysis.rst:501 msgid "r'" msgstr "r'" -#: ../../reference/lexical_analysis.rst:500 +#: ../../reference/lexical_analysis.rst:501 msgid "raw string literal" msgstr "raw string literal(原始字串常數)" -#: ../../reference/lexical_analysis.rst:500 +#: ../../reference/lexical_analysis.rst:501 msgid "r\"" msgstr "r\"" -#: ../../reference/lexical_analysis.rst:518 +#: ../../reference/lexical_analysis.rst:519 msgid "f'" msgstr "f'" -#: ../../reference/lexical_analysis.rst:518 -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:519 +#: ../../reference/lexical_analysis.rst:697 msgid "formatted string literal" msgstr "formatted string literal(格式化字串常數)" -#: ../../reference/lexical_analysis.rst:518 +#: ../../reference/lexical_analysis.rst:519 msgid "f\"" msgstr "f\"" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "escape sequence" msgstr "escape sequence(跳脫序列)" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "Standard C" msgstr "Standard C(標準 C)" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "C" msgstr "C" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\ (backslash)" msgstr "\\ (反斜線)" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\\\" msgstr "\\\\" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\a" msgstr "\\a" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\b" msgstr "\\b" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\f" msgstr "\\f" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\n" msgstr "\\n" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\r" msgstr "\\r" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\t" msgstr "\\t" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\v" msgstr "\\v" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\x" msgstr "\\x" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\N" msgstr "\\N" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\u" msgstr "\\u" -#: ../../reference/lexical_analysis.rst:531 +#: ../../reference/lexical_analysis.rst:532 msgid "\\U" msgstr "\\U" -#: ../../reference/lexical_analysis.rst:647 +#: ../../reference/lexical_analysis.rst:648 msgid "unrecognized escape sequence" msgstr "unrecognized escape sequence(無法辨識的跳脫序列)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "interpolated string literal" msgstr "interpolated string literal(插值字串常數)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "string" msgstr "string(字串)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "formatted literal" msgstr "formatted literal(格式化常數)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "interpolated literal" msgstr "interpolated literal(插值常數)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "f-string" msgstr "f-string(f 字串)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "fstring" msgstr "fstring(f 字串)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "{} (curly brackets)" msgstr "{} (花括號)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "in formatted string literal" msgstr "於格式化字串常數中" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "! (exclamation)" msgstr "! (驚嘆號)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid ": (colon)" msgstr ": (冒號)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "= (equals)" -msgstr "= (等於)" +msgstr "= (等號)" -#: ../../reference/lexical_analysis.rst:696 +#: ../../reference/lexical_analysis.rst:697 msgid "for help in debugging using string literals" msgstr "for help in debugging using string literals(使用字串常數進行除錯)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "number" msgstr "number(數字)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "numeric literal" msgstr "numeric literal(數值常數)" -#: ../../reference/lexical_analysis.rst:879 -#: ../../reference/lexical_analysis.rst:892 +#: ../../reference/lexical_analysis.rst:880 +#: ../../reference/lexical_analysis.rst:893 msgid "integer literal" msgstr "integer literal(整數常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "floating-point literal" msgstr "floating-point literal(浮點數常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "hexadecimal literal" msgstr "hexadecimal literal(十六進位常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "octal literal" msgstr "octal literal(八進位常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "binary literal" msgstr "binary literal(二進位常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "decimal literal" msgstr "decimal literal(十進位常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "imaginary literal" msgstr "imaginary literal(虛數常數)" -#: ../../reference/lexical_analysis.rst:879 +#: ../../reference/lexical_analysis.rst:880 msgid "complex literal" msgstr "complex literal(複數常數)" -#: ../../reference/lexical_analysis.rst:892 +#: ../../reference/lexical_analysis.rst:893 msgid "0b" msgstr "0b" -#: ../../reference/lexical_analysis.rst:892 +#: ../../reference/lexical_analysis.rst:893 msgid "0o" msgstr "0o" -#: ../../reference/lexical_analysis.rst:892 +#: ../../reference/lexical_analysis.rst:893 msgid "0x" msgstr "0x" -#: ../../reference/lexical_analysis.rst:892 -#: ../../reference/lexical_analysis.rst:938 +#: ../../reference/lexical_analysis.rst:893 +#: ../../reference/lexical_analysis.rst:939 msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../reference/lexical_analysis.rst:892 -#: ../../reference/lexical_analysis.rst:938 -#: ../../reference/lexical_analysis.rst:970 +#: ../../reference/lexical_analysis.rst:893 +#: ../../reference/lexical_analysis.rst:939 +#: ../../reference/lexical_analysis.rst:971 msgid "in numeric literal" msgstr "於數值常數中" -#: ../../reference/lexical_analysis.rst:938 +#: ../../reference/lexical_analysis.rst:939 msgid ". (dot)" msgstr ". (點)" -#: ../../reference/lexical_analysis.rst:938 +#: ../../reference/lexical_analysis.rst:939 msgid "e" msgstr "e" -#: ../../reference/lexical_analysis.rst:970 +#: ../../reference/lexical_analysis.rst:971 msgid "j" msgstr "j" -#: ../../reference/lexical_analysis.rst:996 +#: ../../reference/lexical_analysis.rst:997 msgid "operators" msgstr "operators(運算子)" -#: ../../reference/lexical_analysis.rst:1013 +#: ../../reference/lexical_analysis.rst:1014 msgid "delimiters" msgstr "delimiters(分隔符號)" diff --git a/reference/simple_stmts.po b/reference/simple_stmts.po index 8ad51dca40..d54049a3af 100644 --- a/reference/simple_stmts.po +++ b/reference/simple_stmts.po @@ -203,9 +203,9 @@ msgid "" "must yield an integer. If it is negative, the sequence's length is added to " "it. The resulting value must be a nonnegative integer less than the " "sequence's length, and the sequence is asked to assign the assigned object " -"to its item with that index. If the index is out of range, :exc:" -"`IndexError` is raised (assignment to a subscripted sequence cannot add new " -"items to a list)." +"to its item with that index. If the index is out of " +"range, :exc:`IndexError` is raised (assignment to a subscripted sequence " +"cannot add new items to a list)." msgstr "" #: ../../reference/simple_stmts.rst:211 @@ -262,6 +262,10 @@ msgid "" "i, x[i] = 1, 2 # i is updated, then x[i] is updated\n" "print(x)" msgstr "" +"x = [0, 1]\n" +"i = 0\n" +"i, x[i] = 1, 2 # i 先被更新,然後 x[i] 再被更新\n" +"print(x)" #: ../../reference/simple_stmts.rst:254 msgid ":pep:`3132` - Extended Iterable Unpacking" @@ -273,7 +277,7 @@ msgstr "" #: ../../reference/simple_stmts.rst:261 msgid "Augmented assignment statements" -msgstr "" +msgstr "擴增賦值陳述式" #: ../../reference/simple_stmts.rst:279 msgid "" @@ -331,7 +335,7 @@ msgstr "" #: ../../reference/simple_stmts.rst:320 msgid "Annotated assignment statements" -msgstr "" +msgstr "註釋賦值陳述式" #: ../../reference/simple_stmts.rst:327 msgid "" @@ -339,6 +343,8 @@ msgid "" "single statement, of a variable or attribute annotation and an optional " "assignment statement:" msgstr "" +":term:`註釋 <variable annotation>` 賦值是將變數或屬性註釋與可選的賦值陳述式結" +"合在一個陳述式中:" #: ../../reference/simple_stmts.rst:334 msgid "" @@ -375,8 +381,8 @@ msgid "" "If the right hand side is present, an annotated assignment performs the " "actual assignment before evaluating annotations (where applicable). If the " "right hand side is not present for an expression target, then the " -"interpreter evaluates the target except for the last :meth:`~object." -"__setitem__` or :meth:`~object.__setattr__` call." +"interpreter evaluates the target except for the " +"last :meth:`~object.__setitem__` or :meth:`~object.__setattr__` call." msgstr "" #: ../../reference/simple_stmts.rst:361 @@ -392,7 +398,7 @@ msgstr "" #: ../../reference/simple_stmts.rst:366 msgid ":pep:`484` - Type hints" -msgstr "" +msgstr ":pep:`484` - 型別提示" #: ../../reference/simple_stmts.rst:367 msgid "" @@ -449,11 +455,11 @@ msgid "" "refer to the built-in variables with those names. In the current " "implementation, the built-in variable ``__debug__`` is ``True`` under normal " "circumstances, ``False`` when optimization is requested (command line " -"option :option:`-O`). The current code generator emits no code for an :" -"keyword:`assert` statement when optimization is requested at compile time. " -"Note that it is unnecessary to include the source code for the expression " -"that failed in the error message; it will be displayed as part of the stack " -"trace." +"option :option:`-O`). The current code generator emits no code for " +"an :keyword:`assert` statement when optimization is requested at compile " +"time. Note that it is unnecessary to include the source code for the " +"expression that failed in the error message; it will be displayed as part of " +"the stack trace." msgstr "" #: ../../reference/simple_stmts.rst:416 @@ -500,8 +506,8 @@ msgstr "" msgid "" "Deletion of a name removes the binding of that name from the local or global " "namespace, depending on whether the name occurs in a :keyword:`global` " -"statement in the same code block. If the name is unbound, a :exc:" -"`NameError` exception will be raised." +"statement in the same code block. If the name is unbound, " +"a :exc:`NameError` exception will be raised." msgstr "" #: ../../reference/simple_stmts.rst:471 @@ -551,16 +557,17 @@ msgstr "" msgid "" "In a generator function, the :keyword:`return` statement indicates that the " "generator is done and will cause :exc:`StopIteration` to be raised. The " -"returned value (if any) is used as an argument to construct :exc:" -"`StopIteration` and becomes the :attr:`StopIteration.value` attribute." +"returned value (if any) is used as an argument to " +"construct :exc:`StopIteration` and becomes the :attr:`StopIteration.value` " +"attribute." msgstr "" #: ../../reference/simple_stmts.rst:513 msgid "" "In an asynchronous generator function, an empty :keyword:`return` statement " -"indicates that the asynchronous generator is done and will cause :exc:" -"`StopAsyncIteration` to be raised. A non-empty :keyword:`!return` statement " -"is a syntax error in an asynchronous generator function." +"indicates that the asynchronous generator is done and will " +"cause :exc:`StopAsyncIteration` to be raised. A non-empty :keyword:`!" +"return` statement is a syntax error in an asynchronous generator function." msgstr "" #: ../../reference/simple_stmts.rst:521 @@ -597,8 +604,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:546 msgid "" -"Yield expressions and statements are only used when defining a :term:" -"`generator` function, and are only used in the body of the generator " +"Yield expressions and statements are only used when defining " +"a :term:`generator` function, and are only used in the body of the generator " "function. Using :keyword:`yield` in a function definition is sufficient to " "cause that definition to create a generator function instead of a normal " "function." @@ -606,8 +613,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:551 msgid "" -"For full details of :keyword:`yield` semantics, refer to the :ref:" -"`yieldexpr` section." +"For full details of :keyword:`yield` semantics, refer to " +"the :ref:`yieldexpr` section." msgstr "" #: ../../reference/simple_stmts.rst:557 @@ -625,15 +632,15 @@ msgstr "" #: ../../reference/simple_stmts.rst:573 msgid "" "Otherwise, :keyword:`raise` evaluates the first expression as the exception " -"object. It must be either a subclass or an instance of :class:" -"`BaseException`. If it is a class, the exception instance will be obtained " -"when needed by instantiating the class with no arguments." +"object. It must be either a subclass or an instance " +"of :class:`BaseException`. If it is a class, the exception instance will be " +"obtained when needed by instantiating the class with no arguments." msgstr "" #: ../../reference/simple_stmts.rst:578 msgid "" -"The :dfn:`type` of the exception is the exception instance's class, the :dfn:" -"`value` is the instance itself." +"The :dfn:`type` of the exception is the exception instance's class, " +"the :dfn:`value` is the instance itself." msgstr "" #: ../../reference/simple_stmts.rst:583 @@ -703,8 +710,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:624 msgid "" "A similar mechanism works implicitly if a new exception is raised when an " -"exception is already being handled. An exception may be handled when an :" -"keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` " +"exception is already being handled. An exception may be handled when " +"an :keyword:`except` or :keyword:`finally` clause, or a :keyword:`with` " "statement, is used. The previous exception is then attached as the new " "exception's :attr:`~BaseException.__context__` attribute:" msgstr "" @@ -775,9 +782,9 @@ msgstr "" #: ../../reference/simple_stmts.rst:664 msgid "" -"Additional information on exceptions can be found in section :ref:" -"`exceptions`, and information about handling exceptions is in section :ref:" -"`try`." +"Additional information on exceptions can be found in " +"section :ref:`exceptions`, and information about handling exceptions is in " +"section :ref:`try`." msgstr "" #: ../../reference/simple_stmts.rst:667 @@ -804,8 +811,8 @@ msgstr ":keyword:`!break` 陳述式" #: ../../reference/simple_stmts.rst:693 msgid "" -":keyword:`break` may only occur syntactically nested in a :keyword:`for` or :" -"keyword:`while` loop, but not nested in a function or class definition " +":keyword:`break` may only occur syntactically nested in a :keyword:`for` " +"or :keyword:`while` loop, but not nested in a function or class definition " "within that loop." msgstr "" @@ -863,8 +870,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:766 msgid "" -"define a name or names in the local namespace for the scope where the :" -"keyword:`import` statement occurs." +"define a name or names in the local namespace for the scope where " +"the :keyword:`import` statement occurs." msgstr "" #: ../../reference/simple_stmts.rst:769 @@ -893,8 +900,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:787 msgid "" -"If the module name is followed by :keyword:`!as`, then the name following :" -"keyword:`!as` is bound directly to the imported module." +"If the module name is followed by :keyword:`!as`, then the name " +"following :keyword:`!as` is bound directly to the imported module." msgstr "" #: ../../reference/simple_stmts.rst:789 @@ -956,10 +963,10 @@ msgid "" "import foo # foo imported and bound locally\n" "import foo.bar.baz # foo, foo.bar, and foo.bar.baz imported, foo " "bound locally\n" -"import foo.bar.baz as fbb # foo, foo.bar, and foo.bar.baz imported, foo.bar." -"baz bound as fbb\n" -"from foo.bar import baz # foo, foo.bar, and foo.bar.baz imported, foo.bar." -"baz bound as baz\n" +"import foo.bar.baz as fbb # foo, foo.bar, and foo.bar.baz imported, " +"foo.bar.baz bound as fbb\n" +"from foo.bar import baz # foo, foo.bar, and foo.bar.baz imported, " +"foo.bar.baz bound as baz\n" "from foo import attr # foo imported and foo.attr bound as attr" msgstr "" @@ -1016,8 +1023,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:866 msgid "" "Raises an :ref:`auditing event <auditing>` ``import`` with arguments " -"``module``, ``filename``, ``sys.path``, ``sys.meta_path``, ``sys." -"path_hooks``." +"``module``, ``filename``, ``sys.path``, ``sys.meta_path``, " +"``sys.path_hooks``." msgstr "" "引發一個附帶引數 ``module``、``filename``、``sys.path``、``sys.meta_path``、" "``sys.path_hooks`` 的\\ :ref:`稽核事件 <auditing>` ``import``。" @@ -1125,11 +1132,11 @@ msgstr "" #: ../../reference/simple_stmts.rst:936 msgid "" -"Code compiled by calls to the built-in functions :func:`exec` and :func:" -"`compile` that occur in a module :mod:`!M` containing a future statement " -"will, by default, use the new syntax or semantics associated with the future " -"statement. This can be controlled by optional arguments to :func:`compile` " -"--- see the documentation of that function for details." +"Code compiled by calls to the built-in functions :func:`exec` " +"and :func:`compile` that occur in a module :mod:`!M` containing a future " +"statement will, by default, use the new syntax or semantics associated with " +"the future statement. This can be controlled by optional arguments " +"to :func:`compile` --- see the documentation of that function for details." msgstr "" #: ../../reference/simple_stmts.rst:942 @@ -1176,8 +1183,8 @@ msgid "" "string or code object supplied to the built-in :func:`exec` function does " "not affect the code block *containing* the function call, and code contained " "in such a string is unaffected by :keyword:`!global` statements in the code " -"containing the function call. The same applies to the :func:`eval` and :" -"func:`compile` functions." +"containing the function call. The same applies to the :func:`eval` " +"and :func:`compile` functions." msgstr "" #: ../../reference/simple_stmts.rst:993 @@ -1192,8 +1199,8 @@ msgid "" "identifiers to refer to names previously bound in nonlocal scopes. It allows " "encapsulated code to rebind such nonlocal identifiers. If a name is bound " "in more than one nonlocal scope, the nearest binding is used. If a name is " -"not bound in any nonlocal scope, or if there is no nonlocal scope, a :exc:" -"`SyntaxError` is raised." +"not bound in any nonlocal scope, or if there is no nonlocal scope, " +"a :exc:`SyntaxError` is raised." msgstr "" #: ../../reference/simple_stmts.rst:1010 @@ -1214,8 +1221,8 @@ msgstr "" #: ../../reference/simple_stmts.rst:1019 msgid "" "**Programmer's note:** :keyword:`nonlocal` is a directive to the parser and " -"applies only to code parsed along with it. See the note for the :keyword:" -"`global` statement." +"applies only to code parsed along with it. See the note for " +"the :keyword:`global` statement." msgstr "" #: ../../reference/simple_stmts.rst:1027 @@ -1257,9 +1264,9 @@ msgstr "" msgid "" "The value of the type alias is evaluated in the annotation scope. It is not " "evaluated when the type alias is created, but only when the value is " -"accessed through the type alias's :attr:`!__value__` attribute (see :ref:" -"`lazy-evaluation`). This allows the type alias to refer to names that are " -"not yet defined." +"accessed through the type alias's :attr:`!__value__` attribute " +"(see :ref:`lazy-evaluation`). This allows the type alias to refer to names " +"that are not yet defined." msgstr "" #: ../../reference/simple_stmts.rst:1056 @@ -1361,7 +1368,7 @@ msgstr "" #: ../../reference/simple_stmts.rst:75 msgid "= (equals)" -msgstr "= (等於)" +msgstr "= (等號)" #: ../../reference/simple_stmts.rst:75 msgid "assignment statement" diff --git a/sphinx.po b/sphinx.po index 8faa0df8d2..5303cc5cfd 100644 --- a/sphinx.po +++ b/sphinx.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-07 15:02+0800\n" +"POT-Creation-Date: 2025-04-16 00:15+0000\n" "PO-Revision-Date: 2023-03-15 10:19+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -20,6 +20,14 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Poedit 3.2.2\n" +#: ../../tools/templates/_docs_by_version.html:10 +msgid "Stable" +msgstr "穩定版本" + +#: ../../tools/templates/_docs_by_version.html:11 +msgid "In development" +msgstr "開發中" + #: ../../tools/templates/customsourcelink.html:3 msgid "This Page" msgstr "此頁面" @@ -37,15 +45,15 @@ msgstr "顯示原始碼" msgid "Download" msgstr "下載" -#: ../../tools/templates/download.html:16 +#: ../../tools/templates/download.html:30 msgid "Download Python %(dl_version)s Documentation" msgstr "下載 Python %(dl_version)s 說明文件" -#: ../../tools/templates/download.html:18 +#: ../../tools/templates/download.html:32 msgid "Last updated on: %(last_updated)s." msgstr "最後更新時間:%(last_updated)s。" -#: ../../tools/templates/download.html:20 +#: ../../tools/templates/download.html:34 msgid "" "To download an archive containing all the documents for this version of\n" "Python in one of various formats, follow one of links in this table." @@ -53,31 +61,31 @@ msgstr "" "要下載包含這個 Python 版本所有文件的歸檔,可以遵循這個表格中的其中一個連結," "以取得各種格式的文件。" -#: ../../tools/templates/download.html:25 +#: ../../tools/templates/download.html:39 msgid "Format" msgstr "格式" -#: ../../tools/templates/download.html:26 +#: ../../tools/templates/download.html:40 msgid "Packed as .zip" msgstr "打包成 .zip" -#: ../../tools/templates/download.html:27 +#: ../../tools/templates/download.html:41 msgid "Packed as .tar.bz2" msgstr "打包成 .tar.bz2" -#: ../../tools/templates/download.html:30 +#: ../../tools/templates/download.html:44 msgid "PDF" msgstr "PDF" -#: ../../tools/templates/download.html:31 +#: ../../tools/templates/download.html:45 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.zip\">Download</a> " "(ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.zip\">下載</a> (ca. %" -"(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.zip\">下載</a> (ca. " +"%(download_size)s MiB)" -#: ../../tools/templates/download.html:32 +#: ../../tools/templates/download.html:46 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.tar.bz2\">Download</" "a> (ca. %(download_size)s MiB)" @@ -85,19 +93,19 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.tar.bz2\">下載</a> " "(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:35 +#: ../../tools/templates/download.html:49 msgid "HTML" msgstr "HTML" -#: ../../tools/templates/download.html:36 +#: ../../tools/templates/download.html:50 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.zip\">Download</a> " "(ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.zip\">下載</a> (ca. %" -"(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.zip\">下載</a> (ca. " +"%(download_size)s MiB)" -#: ../../tools/templates/download.html:37 +#: ../../tools/templates/download.html:51 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.tar.bz2\">Download</a> " "(ca. %(download_size)s MiB)" @@ -105,19 +113,19 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.tar.bz2\">下載</a> " "(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:40 +#: ../../tools/templates/download.html:54 msgid "Plain text" msgstr "純文字" -#: ../../tools/templates/download.html:41 +#: ../../tools/templates/download.html:55 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.zip\">Download</a> " "(ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.zip\">下載</a> (ca. %" -"(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.zip\">下載</a> (ca. " +"%(download_size)s MiB)" -#: ../../tools/templates/download.html:42 +#: ../../tools/templates/download.html:56 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.tar.bz2\">Download</a> " "(ca. %(download_size)s MiB)" @@ -125,11 +133,11 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.tar.bz2\">下載</a> " "(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:45 +#: ../../tools/templates/download.html:59 msgid "Texinfo" msgstr "Texinfo" -#: ../../tools/templates/download.html:46 +#: ../../tools/templates/download.html:60 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-texinfo.zip\">Download</a> " "(ca. %(download_size)s MiB)" @@ -137,7 +145,7 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-texinfo.zip\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:47 +#: ../../tools/templates/download.html:61 msgid "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-texinfo.tar.bz2\">Download</" "a> (ca. %(download_size)s MiB)" @@ -145,27 +153,27 @@ msgstr "" "<a href=\"%(dl_base)s/python-%(dl_version)s-docs-texinfo.tar.bz2\">下載</a> " "(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:50 +#: ../../tools/templates/download.html:64 msgid "EPUB" msgstr "EPUB" -#: ../../tools/templates/download.html:51 +#: ../../tools/templates/download.html:65 msgid "" -"<a href=\"%(dl_base)s/python-%(dl_version)s-docs.epub\">Download</a> (ca. %" -"(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs.epub\">Download</a> (ca. " +"%(download_size)s MiB)" msgstr "" -"<a href=\"%(dl_base)s/python-%(dl_version)s-docs.epub\">下載</a> (ca. %" -"(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs.epub\">下載</a> (ca. " +"%(download_size)s MiB)" -#: ../../tools/templates/download.html:56 +#: ../../tools/templates/download.html:70 msgid "These archives contain all the content in the documentation." msgstr "這些歸檔包含了說明文件中的所有內容。" -#: ../../tools/templates/download.html:59 +#: ../../tools/templates/download.html:73 msgid "Unpacking" msgstr "解壓縮" -#: ../../tools/templates/download.html:61 +#: ../../tools/templates/download.html:75 msgid "" "Unix users should download the .tar.bz2 archives; these are bzipped tar\n" "archives and can be handled in the usual way using tar and the bzip2\n" @@ -176,11 +184,11 @@ msgid "" "best compression and fastest download times." msgstr "" "Unix 使用者應該下載 .tar.bz2 歸檔;這些是 bzipped tar 歸檔,可以使用 tar 和 " -"bzip2 來處理。如果需要的話,可以使用 <a href=\"https://" -"infozip.sourceforge.net\">Info-ZIP</a> 解壓縮程式來處理 ZIP 歸檔。.tar.bz2 歸" -"檔提供最佳壓縮率和最快的下載時間。" +"bzip2 來處理。如果需要的話,可以使用 <a href=\"https://infozip.sourceforge./" +"net\">Info-ZIP</a> 解壓縮程式來處理 ZIP 歸檔。.tar.bz2 歸檔提供最佳壓縮率和最" +"快的下載時間。" -#: ../../tools/templates/download.html:67 +#: ../../tools/templates/download.html:81 msgid "" "Windows users can use the ZIP archives since those are customary on that\n" "platform. These are created on Unix using the Info-ZIP zip program." @@ -188,18 +196,18 @@ msgstr "" "Windows 使用者可以使用 ZIP 歸檔,因為這在該平台上是常見的。這些是在 Unix 上使" "用 Info-ZIP zip 程式建立的。" -#: ../../tools/templates/download.html:71 +#: ../../tools/templates/download.html:85 msgid "Problems" msgstr "問題" -#: ../../tools/templates/download.html:73 +#: ../../tools/templates/download.html:87 msgid "" "If you have comments or suggestions for the Python documentation, please " "send\n" "email to <a href=\"mailto:docs@python.org\">docs@python.org</a>." msgstr "" -"如果你對 Python 說明文件有任何意見或建議,請寄電子郵件至 <a " -"href=\"mailto:docs@python.org\">docs@python.org</a>。" +"如果你對 Python 說明文件有任何意見或建議,請寄電子郵件至 <a href=\"mailto:" +"docs@python.org\">docs@python.org</a>。" #: ../../tools/templates/dummy.html:6 msgid "Availability" @@ -290,182 +298,182 @@ msgstr "安全性修護" msgid "EOL" msgstr "停止維護" -#: ../../tools/templates/indexcontent.html:8 +#: ../../tools/templates/indexcontent.html:21 msgid "Welcome! This is the official documentation for Python %(release)s." msgstr "歡迎!這是 Python %(release)s 的官方說明文件。" -#: ../../tools/templates/indexcontent.html:10 +#: ../../tools/templates/indexcontent.html:23 msgid "Documentation sections:" msgstr "文件章節:" -#: ../../tools/templates/indexcontent.html:13 +#: ../../tools/templates/indexcontent.html:26 msgid "What's new in Python %(version)s?" msgstr "Python %(version)s 有什麼新功能?" -#: ../../tools/templates/indexcontent.html:14 +#: ../../tools/templates/indexcontent.html:27 msgid "" "Or <a href=\"%(whatsnew_index)s\">all \"What's new\" documents since Python " "2.0</a>" msgstr "" "或<a href=\"%(whatsnew_index)s\">自 2.0 起的所有「有什麼新功能?」文件</a>" -#: ../../tools/templates/indexcontent.html:15 +#: ../../tools/templates/indexcontent.html:28 msgid "Tutorial" msgstr "Python 教學" -#: ../../tools/templates/indexcontent.html:16 +#: ../../tools/templates/indexcontent.html:29 msgid "Start here: a tour of Python's syntax and features" msgstr "從這裡開始:Python 的語法與特性導覽" -#: ../../tools/templates/indexcontent.html:17 +#: ../../tools/templates/indexcontent.html:30 msgid "Library reference" msgstr "函式庫參考手冊" -#: ../../tools/templates/indexcontent.html:18 +#: ../../tools/templates/indexcontent.html:31 msgid "Standard library and builtins" msgstr "標準函式庫與內建函式" -#: ../../tools/templates/indexcontent.html:19 +#: ../../tools/templates/indexcontent.html:32 msgid "Language reference" msgstr "語言參考手冊" -#: ../../tools/templates/indexcontent.html:20 +#: ../../tools/templates/indexcontent.html:33 msgid "Syntax and language elements" msgstr "語法及語言要素" -#: ../../tools/templates/indexcontent.html:21 +#: ../../tools/templates/indexcontent.html:34 msgid "Python setup and usage" msgstr "Python 的設置與使用" -#: ../../tools/templates/indexcontent.html:22 +#: ../../tools/templates/indexcontent.html:35 msgid "How to install, configure, and use Python" msgstr "如何安裝、設定與使用 Python" -#: ../../tools/templates/indexcontent.html:23 +#: ../../tools/templates/indexcontent.html:36 msgid "Python HOWTOs" msgstr "Python 如何達成任務" -#: ../../tools/templates/indexcontent.html:24 +#: ../../tools/templates/indexcontent.html:37 msgid "In-depth topic manuals" msgstr "深度主題說明手冊" -#: ../../tools/templates/indexcontent.html:26 +#: ../../tools/templates/indexcontent.html:39 msgid "Installing Python modules" msgstr "安裝 Python 模組" -#: ../../tools/templates/indexcontent.html:27 +#: ../../tools/templates/indexcontent.html:40 msgid "Third-party modules and PyPI.org" msgstr "第三方模組與 PyPI.org" -#: ../../tools/templates/indexcontent.html:28 +#: ../../tools/templates/indexcontent.html:41 msgid "Distributing Python modules" msgstr "發布 Python 模組" -#: ../../tools/templates/indexcontent.html:29 +#: ../../tools/templates/indexcontent.html:42 msgid "Publishing modules for use by other people" msgstr "發佈模組讓其他人可以使用" -#: ../../tools/templates/indexcontent.html:30 +#: ../../tools/templates/indexcontent.html:43 msgid "Extending and embedding" msgstr "擴充和嵌入" -#: ../../tools/templates/indexcontent.html:31 +#: ../../tools/templates/indexcontent.html:44 msgid "For C/C++ programmers" msgstr "給 C/C++ 程式設計師" -#: ../../tools/templates/indexcontent.html:32 +#: ../../tools/templates/indexcontent.html:45 msgid "Python's C API" msgstr "Python 的 C 應用程式介面 (API)" -#: ../../tools/templates/indexcontent.html:33 +#: ../../tools/templates/indexcontent.html:46 msgid "C API reference" msgstr "C API 參考手冊" -#: ../../tools/templates/indexcontent.html:34 +#: ../../tools/templates/indexcontent.html:47 msgid "FAQs" msgstr "常見問答集" -#: ../../tools/templates/indexcontent.html:35 +#: ../../tools/templates/indexcontent.html:48 msgid "Frequently asked questions (with answers!)" msgstr "常被提出的問題(還有答案!)" -#: ../../tools/templates/indexcontent.html:36 +#: ../../tools/templates/indexcontent.html:49 msgid "Deprecations" msgstr "棄用功能" -#: ../../tools/templates/indexcontent.html:37 +#: ../../tools/templates/indexcontent.html:50 msgid "Deprecated functionality" msgstr "已棄用的功能" -#: ../../tools/templates/indexcontent.html:41 +#: ../../tools/templates/indexcontent.html:54 msgid "Indices, glossary, and search:" msgstr "索引、術語表與搜尋:" -#: ../../tools/templates/indexcontent.html:44 +#: ../../tools/templates/indexcontent.html:57 msgid "Global module index" msgstr "全域模組索引" -#: ../../tools/templates/indexcontent.html:45 +#: ../../tools/templates/indexcontent.html:58 msgid "All modules and libraries" msgstr "所有模組與函式庫" -#: ../../tools/templates/indexcontent.html:46 +#: ../../tools/templates/indexcontent.html:59 msgid "General index" msgstr "總索引" -#: ../../tools/templates/indexcontent.html:47 +#: ../../tools/templates/indexcontent.html:60 msgid "All functions, classes, and terms" msgstr "全部函式、類別和術語" -#: ../../tools/templates/indexcontent.html:48 +#: ../../tools/templates/indexcontent.html:61 msgid "Glossary" msgstr "術語表" -#: ../../tools/templates/indexcontent.html:49 +#: ../../tools/templates/indexcontent.html:62 msgid "Terms explained" msgstr "術語解釋" -#: ../../tools/templates/indexcontent.html:51 +#: ../../tools/templates/indexcontent.html:64 msgid "Search page" msgstr "搜尋頁" -#: ../../tools/templates/indexcontent.html:52 +#: ../../tools/templates/indexcontent.html:65 msgid "Search this documentation" msgstr "搜尋這份說明文件" -#: ../../tools/templates/indexcontent.html:53 +#: ../../tools/templates/indexcontent.html:66 msgid "Complete table of contents" msgstr "完整內容列表" -#: ../../tools/templates/indexcontent.html:54 +#: ../../tools/templates/indexcontent.html:67 msgid "Lists all sections and subsections" msgstr "列出所有章節與小節" -#: ../../tools/templates/indexcontent.html:58 +#: ../../tools/templates/indexcontent.html:71 msgid "Project information:" msgstr "專案資訊:" -#: ../../tools/templates/indexcontent.html:61 +#: ../../tools/templates/indexcontent.html:74 msgid "Reporting issues" msgstr "回報問題" -#: ../../tools/templates/indexcontent.html:62 +#: ../../tools/templates/indexcontent.html:75 msgid "Contributing to Docs" msgstr "貢獻說明文件" -#: ../../tools/templates/indexcontent.html:63 +#: ../../tools/templates/indexcontent.html:76 msgid "Download the documentation" msgstr "下載說明文件" -#: ../../tools/templates/indexcontent.html:65 +#: ../../tools/templates/indexcontent.html:78 msgid "History and license of Python" msgstr "Python 的沿革與授權" -#: ../../tools/templates/indexcontent.html:66 +#: ../../tools/templates/indexcontent.html:79 msgid "Copyright" msgstr "版權" -#: ../../tools/templates/indexcontent.html:67 +#: ../../tools/templates/indexcontent.html:80 msgid "About the documentation" msgstr "關於說明文件" @@ -477,39 +485,31 @@ msgstr "下載這些說明文件" msgid "Docs by version" msgstr "各版本說明文件" -#: ../../tools/templates/indexsidebar.html:5 -msgid "Stable" -msgstr "穩定版本" - -#: ../../tools/templates/indexsidebar.html:6 -msgid "In development" -msgstr "開發中" - #: ../../tools/templates/indexsidebar.html:7 msgid "All versions" msgstr "所有版本" -#: ../../tools/templates/indexsidebar.html:10 +#: ../../tools/templates/indexsidebar.html:9 msgid "Other resources" msgstr "其他資源" -#: ../../tools/templates/indexsidebar.html:13 +#: ../../tools/templates/indexsidebar.html:12 msgid "PEP Index" msgstr "PEP 索引" -#: ../../tools/templates/indexsidebar.html:14 +#: ../../tools/templates/indexsidebar.html:13 msgid "Beginner's Guide" msgstr "初學者指南" -#: ../../tools/templates/indexsidebar.html:15 +#: ../../tools/templates/indexsidebar.html:14 msgid "Book List" msgstr "推薦書單" -#: ../../tools/templates/indexsidebar.html:16 +#: ../../tools/templates/indexsidebar.html:15 msgid "Audio/Visual Talks" msgstr "音訊/視訊演講" -#: ../../tools/templates/indexsidebar.html:17 +#: ../../tools/templates/indexsidebar.html:16 msgid "Python Developer’s Guide" msgstr "Python 開發者指南" @@ -525,8 +525,8 @@ msgstr "目前穩定發行的 Python 版本說明文件" #: ../../tools/templates/layout.html:14 msgid "" -"This is a deploy preview created from a <a href=\"%(repository_url)s/pull/%" -"(pr_id)s\">pull request</a>.\n" +"This is a deploy preview created from a <a href=\"%(repository_url)s/pull/" +"%(pr_id)s\">pull request</a>.\n" " For authoritative documentation, see" msgstr "" "這是從 <a href=\"%(repository_url)s/pull/%(pr_id)s\">pull request(拉取請求)" diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index c7f1d387e4..a33b54fa3a 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -64,9 +64,9 @@ msgstr "" msgid "" "There can be zero or more :keyword:`elif` parts, and the :keyword:`else` " "part is optional. The keyword ':keyword:`!elif`' is short for 'else if', " -"and is useful to avoid excessive indentation. An :keyword:`!if` ... :" -"keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute for the " -"``switch`` or ``case`` statements found in other languages." +"and is useful to avoid excessive indentation. An :keyword:`!" +"if` ... :keyword:`!elif` ... :keyword:`!elif` ... sequence is a substitute " +"for the ``switch`` or ``case`` statements found in other languages." msgstr "" "在陳述式中,可以沒有或有許多個 :keyword:`elif` 敘述,且 :keyword:`else` 敘述" "並不是必要的。關鍵字 :keyword:`!elif` 是「else if」的縮寫,用來避免過多的縮" @@ -91,10 +91,10 @@ msgid "" "The :keyword:`for` statement in Python differs a bit from what you may be " "used to in C or Pascal. Rather than always iterating over an arithmetic " "progression of numbers (like in Pascal), or giving the user the ability to " -"define both the iteration step and halting condition (as C), Python's :" -"keyword:`!for` statement iterates over the items of any sequence (a list or " -"a string), in the order that they appear in the sequence. For example (no " -"pun intended):" +"define both the iteration step and halting condition (as C), " +"Python's :keyword:`!for` statement iterates over the items of any sequence " +"(a list or a string), in the order that they appear in the sequence. For " +"example (no pun intended):" msgstr "" "在 Python 中的 :keyword:`for` 陳述式有點不同於在 C 或 Pascal 中的慣用方式。相" "較於只能疊代 (iterate) 一個等差數列(如 Pascal),或給予使用者定義疊代步驟與" @@ -145,8 +145,9 @@ msgstr ":func:`range` 函式" #: ../../tutorial/controlflow.rst:96 msgid "" -"If you do need to iterate over a sequence of numbers, the built-in function :" -"func:`range` comes in handy. It generates arithmetic progressions::" +"If you do need to iterate over a sequence of numbers, the built-in " +"function :func:`range` comes in handy. It generates arithmetic " +"progressions::" msgstr "" "如果你需要疊代一個數列的話,使用內建 :func:`range` 函式就很方便。它可以生成一" "等差數列: ::" @@ -266,9 +267,9 @@ msgstr "" msgid "" "We say such an object is :term:`iterable`, that is, suitable as a target for " "functions and constructs that expect something from which they can obtain " -"successive items until the supply is exhausted. We have seen that the :" -"keyword:`for` statement is such a construct, while an example of a function " -"that takes an iterable is :func:`sum`::" +"successive items until the supply is exhausted. We have seen that " +"the :keyword:`for` statement is such a construct, while an example of a " +"function that takes an iterable is :func:`sum`::" msgstr "" "我們稱這樣的物件為 :term:`iterable`\\ (可疊代物件),意即能作為函式及架構中" "可以一直取得項目直到取盡的對象。我們已經了解 :keyword:`for` 陳述式就是如此的" @@ -288,8 +289,8 @@ msgid "" "arguments. In chapter :ref:`tut-structures`, we will discuss in more detail " "about :func:`list`." msgstr "" -"待會我們可以看到更多回傳 iterable 和使用 iterable 為引數的函式。在\\ :ref:" -"`tut-structures`\\ 章節中,我們會討論更多關於 :func:`list` 的細節。" +"待會我們可以看到更多回傳 iterable 和使用 iterable 為引數的函式。在" +"\\ :ref:`tut-structures`\\ 章節中,我們會討論更多關於 :func:`list` 的細節。" #: ../../tutorial/controlflow.rst:164 msgid ":keyword:`!break` and :keyword:`!continue` Statements" @@ -297,11 +298,11 @@ msgstr ":keyword:`!break` 和 :keyword:`!continue` 陳述式" #: ../../tutorial/controlflow.rst:166 msgid "" -"The :keyword:`break` statement breaks out of the innermost enclosing :" -"keyword:`for` or :keyword:`while` loop::" +"The :keyword:`break` statement breaks out of the innermost " +"enclosing :keyword:`for` or :keyword:`while` loop::" msgstr "" -":keyword:`break` 陳述式,終止包含它的最內部 :keyword:`for` 或 :keyword:" -"`while` 迴圈: ::" +":keyword:`break` 陳述式,終止包含它的最內部 :keyword:`for` " +"或 :keyword:`while` 迴圈: ::" #: ../../tutorial/controlflow.rst:169 msgid "" @@ -454,11 +455,11 @@ msgid "" "occurs. For more on the ``try`` statement and exceptions, see :ref:`tut-" "handling`." msgstr "" -"當 ``else`` 子句用於迴圈時,相較於搭配 ``if`` 陳述式使用,它的行為與 :" -"keyword:`try` 陳述式中的 ``else`` 子句更為相似:``try`` 陳述式的 ``else`` 子" -"句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有任何 " -"``break`` 發生時執行。更多有關 ``try`` 陳述式和例外的介紹,見\\ :ref:`tut-" -"handling`。" +"當 ``else`` 子句用於迴圈時,相較於搭配 ``if`` 陳述式使用,它的行為" +"與 :keyword:`try` 陳述式中的 ``else`` 子句更為相似:``try`` 陳述式的 " +"``else`` 子句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有" +"任何 ``break`` 發生時執行。更多有關 ``try`` 陳述式和例外的介紹,見" +"\\ :ref:`tut-handling`。" #: ../../tutorial/controlflow.rst:257 msgid ":keyword:`!pass` Statements" @@ -697,8 +698,8 @@ msgid "" "A recommended way to read patterns is to look at them as an extended form of " "what you would put on the left of an assignment, to understand which " "variables would be set to what. Only the standalone names (like ``var`` " -"above) are assigned to by a match statement. Dotted names (like ``foo." -"bar``), attribute names (the ``x=`` and ``y=`` above) or class names " +"above) are assigned to by a match statement. Dotted names (like " +"``foo.bar``), attribute names (the ``x=`` and ``y=`` above) or class names " "(recognized by the \"(...)\" next to them like ``Point`` above) are never " "assigned to." msgstr "" @@ -883,8 +884,8 @@ msgstr "" #: ../../tutorial/controlflow.rst:454 msgid "" -"For a more detailed explanation and additional examples, you can look into :" -"pep:`636` which is written in a tutorial format." +"For a more detailed explanation and additional examples, you can look " +"into :pep:`636` which is written in a tutorial format." msgstr "" "關於更詳細的解釋和其他範例,你可以閱讀 :pep:`636`,它是以教學的格式編寫而成。" @@ -926,12 +927,12 @@ msgstr "" #: ../../tutorial/controlflow.rst:487 msgid "" "The first statement of the function body can optionally be a string literal; " -"this string literal is the function's documentation string, or :dfn:" -"`docstring`. (More about docstrings can be found in the section :ref:`tut-" -"docstrings`.) There are tools which use docstrings to automatically produce " -"online or printed documentation, or to let the user interactively browse " -"through code; it's good practice to include docstrings in code that you " -"write, so make a habit of it." +"this string literal is the function's documentation string, " +"or :dfn:`docstring`. (More about docstrings can be found in the " +"section :ref:`tut-docstrings`.) There are tools which use docstrings to " +"automatically produce online or printed documentation, or to let the user " +"interactively browse through code; it's good practice to include docstrings " +"in code that you write, so make a habit of it." msgstr "" "一個函式的第一個陳述式可以是一個字串文本;該字串文本被視為該函式的說明文件字" "串,即 :dfn:`docstring`。(關於 docstring 的細節請參見\\ :ref:`tut-" @@ -957,8 +958,8 @@ msgstr "" "域符號表。然而,在引用一個變數時,會先從區域符號表開始搜尋,其次為外層函式的" "區域符號表,其次為全域符號表 (global symbol table),最後為所有內建的名稱。因" "此,在函式中,全域變數及外層函式變數雖然可以被引用,但無法被直接賦值(除非全" -"域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數在 :keyword:" -"`nonlocal` 陳述式中被定義)。" +"域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數" +"在 :keyword:`nonlocal` 陳述式中被定義)。" #: ../../tutorial/controlflow.rst:505 msgid "" @@ -1006,8 +1007,8 @@ msgid "" "without a :keyword:`return` statement do return a value, albeit a rather " "boring one. This value is called ``None`` (it's a built-in name). Writing " "the value ``None`` is normally suppressed by the interpreter if it would be " -"the only value written. You can see it if you really want to using :func:" -"`print`::" +"the only value written. You can see it if you really want to " +"using :func:`print`::" msgstr "" "如果你是來自別的語言,你可能不同意 ``fib`` 是個函式,而是個程序 (procedure)," "因為它並沒有回傳值。實際上,即使一個函式缺少一個 :keyword:`return` 陳述式,它" @@ -1052,9 +1053,9 @@ msgstr "這個例子一樣示範了一些新的 Python 特性:" #: ../../tutorial/controlflow.rst:552 msgid "" -"The :keyword:`return` statement returns with a value from a function. :" -"keyword:`!return` without an expression argument returns ``None``. Falling " -"off the end of a function also returns ``None``." +"The :keyword:`return` statement returns with a value from a " +"function. :keyword:`!return` without an expression argument returns " +"``None``. Falling off the end of a function also returns ``None``." msgstr "" ":keyword:`return` 陳述式會讓一個函式回傳一個值。單獨使用 :keyword:`!return` " "不外加一個運算式作為引數時會回傳 ``None``。一個函式執行到結束也會回傳 " @@ -1068,8 +1069,8 @@ msgid "" "expression), and ``methodname`` is the name of a method that is defined by " "the object's type. Different types define different methods. Methods of " "different types may have the same name without causing ambiguity. (It is " -"possible to define your own object types and methods, using *classes*, see :" -"ref:`tut-classes`) The method :meth:`!append` shown in the example is " +"possible to define your own object types and methods, using *classes*, " +"see :ref:`tut-classes`) The method :meth:`!append` shown in the example is " "defined for list objects; it adds a new element at the end of the list. In " "this example it is equivalent to ``result = result + [a]``, but more " "efficient." @@ -1359,8 +1360,8 @@ msgid "" "positional arguments beyond the formal parameter list. (``*name`` must " "occur before ``**name``.) For example, if we define a function like this::" msgstr "" -"當最後一個參數為 ``**name`` 形式時,它接收一個 dictionary(字典,詳見 :ref:" -"`typesmapping`\\ ),該字典包含所有可對應形式參數以外的關鍵字引數。" +"當最後一個參數為 ``**name`` 形式時,它接收一個 dictionary(字典,詳" +"見 :ref:`typesmapping`\\ ),該字典包含所有可對應形式參數以外的關鍵字引數。" "``**name`` 可以與 ``*name`` 參數(下一小節介紹)組合使用,``*name`` 接收一" "個 :ref:`tuple <tut-tuples>`,該 tuple 包含一般參數以外的位置引數(\\ " "``*name`` 必須出現在 ``**name`` 前面)。例如,若我們定義這樣的函式: ::" @@ -1830,9 +1831,7 @@ msgid "" msgstr "" "通常,這些 *variadic*\\ (可變的)引數會出現在參數列表的最末端,這樣它們就可" "以把所有傳遞給函式的剩餘輸入引數都撈起來。出現在 ``*args`` 參數後面的任何參數" -"必須是「僅限關鍵字」引數,意即它們只能作為關鍵字引數,而不能用作位置引數。\n" -"\n" -"::" +"必須是「僅限關鍵字」引數,意即它們只能作為關鍵字引數,而不能用作位置引數。 ::" #: ../../tutorial/controlflow.rst:936 msgid "" diff --git a/tutorial/errors.po b/tutorial/errors.po index bd14d08027..73c5b19dc8 100644 --- a/tutorial/errors.po +++ b/tutorial/errors.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-11-26 00:14+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2022-10-24 14:54+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -64,22 +64,27 @@ msgstr "" #: ../../tutorial/errors.rst:26 msgid "" "The parser repeats the offending line and displays little arrows pointing at " -"the token in the line where the error was detected. The error may be caused " -"by the absence of a token *before* the indicated token. In the example, the " -"error is detected at the function :func:`print`, since a colon (``':'``) is " -"missing before it. File name and line number are printed so you know where " -"to look in case the input came from a script." -msgstr "" -"剖析器 (parser) 會重複犯錯的那一行,並用一個小箭頭指向該行檢測到的第一個錯誤" -"點。錯誤是由箭頭\\ *之前*\\ 的標記 (token) 導致的。此例中,錯誤是在 :func:" -"`print` 函式中被檢測到,因為在它前面少了一個冒號 (``':'``)。檔案名稱和列號會" -"被印出來,所以如果訊息是來自腳本時,就可以知道去哪裡找問題。" - -#: ../../tutorial/errors.rst:37 +"the place where the error was detected. Note that this is not always the " +"place that needs to be fixed. In the example, the error is detected at the " +"function :func:`print`, since a colon (``':'``) is missing just before it." +msgstr "" +"剖析器 (parser) 會重複犯錯的那一行,並用一個小箭頭指向該行檢測到錯誤的地方," +"但請注意這並非都會是應該去修改的地方。此例中,錯誤是在 :func:`print` 函式中被" +"檢測到,因為在它前面少了一個冒號 (``':'``)。" + +#: ../../tutorial/errors.rst:31 +msgid "" +"The file name (``<stdin>`` in our example) and line number are printed so " +"you know where to look in case the input came from a file." +msgstr "" +"檔案名稱(此例中為 ``<stdin>``)和列號會被印出來,所以如果訊息是來自一個檔案" +"時,就可以知道去哪裡找問題。" + +#: ../../tutorial/errors.rst:38 msgid "Exceptions" msgstr "例外 (Exception)" -#: ../../tutorial/errors.rst:39 +#: ../../tutorial/errors.rst:40 msgid "" "Even if a statement or expression is syntactically correct, it may cause an " "error when an attempt is made to execute it. Errors detected during " @@ -92,7 +97,7 @@ msgstr "" "到的錯誤稱為\\ *例外*,例外不一定都很嚴重:你很快就能學會在 Python 程式中如何" "處理它們。不過大多數的例外不會被程式處理,並且會顯示如下的錯誤訊息: ::" -#: ../../tutorial/errors.rst:45 +#: ../../tutorial/errors.rst:46 msgid "" ">>> 10 * (1/0)\n" "Traceback (most recent call last):\n" @@ -132,16 +137,16 @@ msgstr "" " ~~~~^~~\n" "TypeError: can only concatenate str (not \"int\") to str" -#: ../../tutorial/errors.rst:64 +#: ../../tutorial/errors.rst:65 msgid "" "The last line of the error message indicates what happened. Exceptions come " "in different types, and the type is printed as part of the message: the " -"types in the example are :exc:`ZeroDivisionError`, :exc:`NameError` and :exc:" -"`TypeError`. The string printed as the exception type is the name of the " -"built-in exception that occurred. This is true for all built-in exceptions, " -"but need not be true for user-defined exceptions (although it is a useful " -"convention). Standard exception names are built-in identifiers (not reserved " -"keywords)." +"types in the example are :exc:`ZeroDivisionError`, :exc:`NameError` " +"and :exc:`TypeError`. The string printed as the exception type is the name " +"of the built-in exception that occurred. This is true for all built-in " +"exceptions, but need not be true for user-defined exceptions (although it is " +"a useful convention). Standard exception names are built-in identifiers (not " +"reserved keywords)." msgstr "" "錯誤訊息的最後一行指示發生了什麼事。例外有不同的類型,而類型名稱會作為訊息的" "一部份被印出。範例中的例外類型為::exc:`ZeroDivisionError`、:exc:`NameError` " @@ -150,13 +155,13 @@ msgstr "" "需要遵守(雖然這是一個有用的慣例)。標準例外名稱是內建的識別字 (identifier)," "不是保留關鍵字 (reserved keyword)。" -#: ../../tutorial/errors.rst:72 +#: ../../tutorial/errors.rst:73 msgid "" "The rest of the line provides detail based on the type of exception and what " "caused it." msgstr "此行其餘部分,根據例外的類型及導致例外的原因,說明例外的細節。" -#: ../../tutorial/errors.rst:75 +#: ../../tutorial/errors.rst:76 msgid "" "The preceding part of the error message shows the context where the " "exception occurred, in the form of a stack traceback. In general it contains " @@ -167,30 +172,30 @@ msgstr "" "說,它含有一個列出源程式碼行 (source line) 的堆疊回溯;但它不會顯示從標準輸入" "中讀取的程式碼。" -#: ../../tutorial/errors.rst:80 +#: ../../tutorial/errors.rst:81 msgid "" ":ref:`bltin-exceptions` lists the built-in exceptions and their meanings." msgstr ":ref:`bltin-exceptions`\\ 章節列出內建的例外及它們的意義。" -#: ../../tutorial/errors.rst:86 +#: ../../tutorial/errors.rst:87 msgid "Handling Exceptions" msgstr "處理例外" -#: ../../tutorial/errors.rst:88 +#: ../../tutorial/errors.rst:89 msgid "" "It is possible to write programs that handle selected exceptions. Look at " "the following example, which asks the user for input until a valid integer " -"has been entered, but allows the user to interrupt the program (using :kbd:" -"`Control-C` or whatever the operating system supports); note that a user-" -"generated interruption is signalled by raising the :exc:`KeyboardInterrupt` " -"exception. ::" +"has been entered, but allows the user to interrupt the program " +"(using :kbd:`Control-C` or whatever the operating system supports); note " +"that a user-generated interruption is signalled by raising " +"the :exc:`KeyboardInterrupt` exception. ::" msgstr "" "編寫程式處理選定的例外是可行的。以下範例會要求使用者輸入內容,直到有效的整數" "被輸入為止,但它允許使用者中斷程式(使用 :kbd:`Control-C` 或作業系統支援的指" "令);請注意,由使用者產生的程式中斷會引發 :exc:`KeyboardInterrupt` 例外信" "號。 ::" -#: ../../tutorial/errors.rst:94 +#: ../../tutorial/errors.rst:95 msgid "" ">>> while True:\n" "... try:\n" @@ -208,27 +213,27 @@ msgstr "" "... print(\"Oops! That was no valid number. Try again...\")\n" "..." -#: ../../tutorial/errors.rst:102 +#: ../../tutorial/errors.rst:103 msgid "The :keyword:`try` statement works as follows." msgstr ":keyword:`try` 陳述式運作方式如下。" -#: ../../tutorial/errors.rst:104 +#: ../../tutorial/errors.rst:105 msgid "" -"First, the *try clause* (the statement(s) between the :keyword:`try` and :" -"keyword:`except` keywords) is executed." +"First, the *try clause* (the statement(s) between the :keyword:`try` " +"and :keyword:`except` keywords) is executed." msgstr "" "首先,執行 *try 子句*\\ (:keyword:`try` 和 :keyword:`except` 關鍵字之間的陳" "述式)。" -#: ../../tutorial/errors.rst:107 +#: ../../tutorial/errors.rst:108 msgid "" -"If no exception occurs, the *except clause* is skipped and execution of the :" -"keyword:`try` statement is finished." +"If no exception occurs, the *except clause* is skipped and execution of " +"the :keyword:`try` statement is finished." msgstr "" "如果沒有發生例外,則 *except 子句*\\ 會被跳過,:keyword:`try` 陳述式執行完" "畢。" -#: ../../tutorial/errors.rst:110 +#: ../../tutorial/errors.rst:111 msgid "" "If an exception occurs during execution of the :keyword:`try` clause, the " "rest of the clause is skipped. Then, if its type matches the exception " @@ -239,18 +244,18 @@ msgstr "" "例外的類型與 :keyword:`except` 關鍵字後面的例外名稱相符,則 *except 子句*\\ " "被執行,然後,繼續執行 try/except 區塊之後的程式碼。" -#: ../../tutorial/errors.rst:115 +#: ../../tutorial/errors.rst:116 msgid "" "If an exception occurs which does not match the exception named in the " "*except clause*, it is passed on to outer :keyword:`try` statements; if no " "handler is found, it is an *unhandled exception* and execution stops with an " "error message." msgstr "" -"如果發生的例外未符合 *except 子句* 中的例外名稱,則將其傳遞到外層的 :keyword:" -"`try` 陳述式;如果仍無法找到處理者,則它是一個\\ *未處理例外 (unhandled " -"exception)*,執行將停止,並顯示錯誤訊息。" +"如果發生的例外未符合 *except 子句* 中的例外名稱,則將其傳遞到外層" +"的 :keyword:`try` 陳述式;如果仍無法找到處理者,則它是一個\\ *未處理例外 " +"(unhandled exception)*,執行將停止,並顯示錯誤訊息。" -#: ../../tutorial/errors.rst:119 +#: ../../tutorial/errors.rst:120 msgid "" "A :keyword:`try` statement may have more than one *except clause*, to " "specify handlers for different exceptions. At most one handler will be " @@ -264,7 +269,7 @@ msgstr "" "理同一 :keyword:`!try` 陳述式裡其他處理者內的例外。一個 *except 子句*\\ 可以" "用一組括號內的 tuple 列舉多個例外,例如: ::" -#: ../../tutorial/errors.rst:125 +#: ../../tutorial/errors.rst:126 msgid "" "... except (RuntimeError, TypeError, NameError):\n" "... pass" @@ -272,7 +277,7 @@ msgstr "" "... except (RuntimeError, TypeError, NameError):\n" "... pass" -#: ../../tutorial/errors.rst:128 +#: ../../tutorial/errors.rst:129 msgid "" "A class in an :keyword:`except` clause matches exceptions which are " "instances of the class itself or one of its derived classes (but not the " @@ -284,7 +289,7 @@ msgstr "" "反過來 -- 列出一個衍生類別的 *except 子句*\\ 不會符合它的基底類別的例外)。例" "如,以下程式碼會按照 B、C、D 的順序印出: ::" -#: ../../tutorial/errors.rst:133 +#: ../../tutorial/errors.rst:134 msgid "" "class B(Exception):\n" " pass\n" @@ -324,7 +329,7 @@ msgstr "" " except B:\n" " print(\"B\")" -#: ../../tutorial/errors.rst:152 +#: ../../tutorial/errors.rst:153 msgid "" "Note that if the *except clauses* were reversed (with ``except B`` first), " "it would have printed B, B, B --- the first matching *except clause* is " @@ -333,7 +338,7 @@ msgstr "" "請注意,如果 *except 子句*\\ 的順序被反轉(把 ``except B`` 放到第一個),則會" "印出 B、B、B ­­——第一個符合的 *except 子句*\\ 會被觸發。" -#: ../../tutorial/errors.rst:155 +#: ../../tutorial/errors.rst:156 msgid "" "When an exception occurs, it may have associated values, also known as the " "exception's *arguments*. The presence and types of the arguments depend on " @@ -342,7 +347,7 @@ msgstr "" "當例外發生時,它可能有相關聯的值,也就是例外的\\ *引數*。引數的存在與否及它的" "類型,是取決於例外的類型。" -#: ../../tutorial/errors.rst:159 +#: ../../tutorial/errors.rst:160 msgid "" "The *except clause* may specify a variable after the exception name. The " "variable is bound to the exception instance which typically has an ``args`` " @@ -351,10 +356,10 @@ msgid "" "explicitly accessing ``.args``. ::" msgstr "" "*except 子句*\\ 可以在例外名稱後面指定一個變數。這個變數被綁定到一個例外實例 " -"(instance),其引數通常儲存在 ``args`` 屬性中。為了方便,內建例外型別定義了 :" -"meth:`~object.__str__` 以印出所有引數而不需顯式地取用 ``.args``: ::" +"(instance),其引數通常儲存在 ``args`` 屬性中。為了方便,內建例外型別定義" +"了 :meth:`~object.__str__` 以印出所有引數而不需顯式地取用 ``.args``: ::" -#: ../../tutorial/errors.rst:165 +#: ../../tutorial/errors.rst:166 msgid "" ">>> try:\n" "... raise Exception('spam', 'eggs')\n" @@ -374,8 +379,24 @@ msgid "" "x = spam\n" "y = eggs" msgstr "" +">>> try:\n" +"... raise Exception('spam', 'eggs')\n" +"... except Exception as inst:\n" +"... print(type(inst)) # 例外的型別\n" +"... print(inst.args) # 儲存在 .args 中的引數\n" +"... print(inst) # __str__ 使得引數可以直接被印出,\n" +"... # 但可能在例外的子類別中被覆蓋\n" +"... x, y = inst.args # 解包引數\n" +"... print('x =', x)\n" +"... print('y =', y)\n" +"...\n" +"<class 'Exception'>\n" +"('spam', 'eggs')\n" +"('spam', 'eggs')\n" +"x = spam\n" +"y = eggs" -#: ../../tutorial/errors.rst:182 +#: ../../tutorial/errors.rst:183 msgid "" "The exception's :meth:`~object.__str__` output is printed as the last part " "('detail') of the message for unhandled exceptions." @@ -383,23 +404,24 @@ msgstr "" "例外的 :meth:`~object.__str__` 輸出會被印在未處理例外訊息的最後一部分(「細" "節」)。" -#: ../../tutorial/errors.rst:185 +#: ../../tutorial/errors.rst:186 msgid "" ":exc:`BaseException` is the common base class of all exceptions. One of its " "subclasses, :exc:`Exception`, is the base class of all the non-fatal " "exceptions. Exceptions which are not subclasses of :exc:`Exception` are not " "typically handled, because they are used to indicate that the program should " -"terminate. They include :exc:`SystemExit` which is raised by :meth:`sys." -"exit` and :exc:`KeyboardInterrupt` which is raised when a user wishes to " -"interrupt the program." +"terminate. They include :exc:`SystemExit` which is raised " +"by :meth:`sys.exit` and :exc:`KeyboardInterrupt` which is raised when a user " +"wishes to interrupt the program." msgstr "" ":exc:`BaseException` 是由全部的例外所共用的 base class。它的 subclass(子類" "別)之一,:exc:`Exception`,則是所有非嚴重例外 (non-fatal exception) 的 base " "class。有些例外不是 :exc:`Exception` 的 subclass,而它們通常不會被處理,因為" -"它們是用來指示程式應該終止。這些例外包括了由 :meth:`sys.exit` 所引發的 :exc:" -"`SystemExit`,以及當使用者想要中斷程式時所引發的 :exc:`KeyboardInterrupt`。" +"它們是用來指示程式應該終止。這些例外包括了由 :meth:`sys.exit` 所引發" +"的 :exc:`SystemExit`,以及當使用者想要中斷程式時所引發" +"的 :exc:`KeyboardInterrupt`。" -#: ../../tutorial/errors.rst:193 +#: ../../tutorial/errors.rst:194 msgid "" ":exc:`Exception` can be used as a wildcard that catches (almost) everything. " "However, it is good practice to be as specific as possible with the types of " @@ -410,7 +432,7 @@ msgstr "" "較好的做法是盡可能具體地說明我們打算處理的例外類型,並容許任何非預期例外的傳" "遞 (propagate)。" -#: ../../tutorial/errors.rst:198 +#: ../../tutorial/errors.rst:199 msgid "" "The most common pattern for handling :exc:`Exception` is to print or log the " "exception and then re-raise it (allowing a caller to handle the exception as " @@ -419,7 +441,7 @@ msgstr "" "處理 :exc:`Exception` 的最常見模式,是先將該例外印出或記錄,然後再重新引發它" "(也允許一個呼叫函式 (caller) 來處理該例外): ::" -#: ../../tutorial/errors.rst:202 +#: ../../tutorial/errors.rst:203 msgid "" "import sys\n" "\n" @@ -449,7 +471,7 @@ msgstr "" " print(f\"Unexpected {err=}, {type(err)=}\")\n" " raise" -#: ../../tutorial/errors.rst:216 +#: ../../tutorial/errors.rst:217 msgid "" "The :keyword:`try` ... :keyword:`except` statement has an optional *else " "clause*, which, when present, must follow all *except clauses*. It is " @@ -460,7 +482,7 @@ msgstr "" "時,該子句必須放在所有 *except 子句*\\ 之後。如果一段程式碼必須被執行,但 " "*try 子句*\\ 又沒有引發例外時,這個子句很有用。例如: ::" -#: ../../tutorial/errors.rst:221 +#: ../../tutorial/errors.rst:222 msgid "" "for arg in sys.argv[1:]:\n" " try:\n" @@ -480,7 +502,7 @@ msgstr "" " print(arg, 'has', len(f.readlines()), 'lines')\n" " f.close()" -#: ../../tutorial/errors.rst:230 +#: ../../tutorial/errors.rst:231 msgid "" "The use of the :keyword:`!else` clause is better than adding additional code " "to the :keyword:`try` clause because it avoids accidentally catching an " @@ -491,7 +513,7 @@ msgstr "" "這可以避免意外地捕獲不是由 :keyword:`!try` ... :keyword:`!except` 陳述式保護" "的程式碼所引發的例外。" -#: ../../tutorial/errors.rst:235 +#: ../../tutorial/errors.rst:236 msgid "" "Exception handlers do not handle only exceptions that occur immediately in " "the *try clause*, but also those that occur inside functions that are called " @@ -500,7 +522,7 @@ msgstr "" "例外的處理者不僅處理 *try 子句*\\ 內立即發生的例外,還處理 *try 子句*\\ 內" "(即使是間接地)呼叫的函式內部發生的例外。例如: ::" -#: ../../tutorial/errors.rst:239 +#: ../../tutorial/errors.rst:240 msgid "" ">>> def this_fails():\n" "... x = 1/0\n" @@ -522,17 +544,17 @@ msgstr "" "...\n" "Handling run-time error: division by zero" -#: ../../tutorial/errors.rst:253 +#: ../../tutorial/errors.rst:254 msgid "Raising Exceptions" msgstr "引發例外" -#: ../../tutorial/errors.rst:255 +#: ../../tutorial/errors.rst:256 msgid "" "The :keyword:`raise` statement allows the programmer to force a specified " "exception to occur. For example::" msgstr ":keyword:`raise` 陳述式可讓程式設計師強制引發指定的例外。例如: ::" -#: ../../tutorial/errors.rst:258 +#: ../../tutorial/errors.rst:259 msgid "" ">>> raise NameError('HiThere')\n" "Traceback (most recent call last):\n" @@ -546,7 +568,7 @@ msgstr "" " raise NameError('HiThere')\n" "NameError: HiThere" -#: ../../tutorial/errors.rst:264 +#: ../../tutorial/errors.rst:265 msgid "" "The sole argument to :keyword:`raise` indicates the exception to be raised. " "This must be either an exception instance or an exception class (a class " @@ -559,20 +581,20 @@ msgstr "" "的 subclass)。如果一個例外 class 被傳遞,它會不含引數地呼叫它的建構函式 " "(constructor) ,使它被自動建立實例 (implicitly instantiated): ::" -#: ../../tutorial/errors.rst:270 +#: ../../tutorial/errors.rst:271 msgid "raise ValueError # shorthand for 'raise ValueError()'" msgstr "raise ValueError # 'raise ValueError()' 的簡寫" -#: ../../tutorial/errors.rst:272 +#: ../../tutorial/errors.rst:273 msgid "" "If you need to determine whether an exception was raised but don't intend to " "handle it, a simpler form of the :keyword:`raise` statement allows you to re-" "raise the exception::" msgstr "" -"如果你只想判斷是否引發了例外,但並不打算處理它,則可以使用簡單的 :keyword:" -"`raise` 陳述式來重新引發該例外: ::" +"如果你只想判斷是否引發了例外,但並不打算處理它,則可以使用簡單" +"的 :keyword:`raise` 陳述式來重新引發該例外: ::" -#: ../../tutorial/errors.rst:276 +#: ../../tutorial/errors.rst:277 msgid "" ">>> try:\n" "... raise NameError('HiThere')\n" @@ -598,11 +620,11 @@ msgstr "" " raise NameError('HiThere')\n" "NameError: HiThere" -#: ../../tutorial/errors.rst:292 +#: ../../tutorial/errors.rst:293 msgid "Exception Chaining" msgstr "例外鏈接 (Exception Chaining)" -#: ../../tutorial/errors.rst:294 +#: ../../tutorial/errors.rst:295 msgid "" "If an unhandled exception occurs inside an :keyword:`except` section, it " "will have the exception being handled attached to it and included in the " @@ -611,7 +633,7 @@ msgstr "" "如果在 :keyword:`except` 段落內部發生了一個未處理的例外,則它會讓這個將要被處" "理的例外附加在後,並將其包含在錯誤訊息中: ::" -#: ../../tutorial/errors.rst:298 +#: ../../tutorial/errors.rst:299 msgid "" ">>> try:\n" "... open(\"database.sqlite\")\n" @@ -649,15 +671,16 @@ msgstr "" " raise RuntimeError(\"unable to handle error\")\n" "RuntimeError: unable to handle error" -#: ../../tutorial/errors.rst:316 +#: ../../tutorial/errors.rst:317 msgid "" -"To indicate that an exception is a direct consequence of another, the :" -"keyword:`raise` statement allows an optional :keyword:`from<raise>` clause::" +"To indicate that an exception is a direct consequence of another, " +"the :keyword:`raise` statement allows an optional :keyword:`from<raise>` " +"clause::" msgstr "" "為了表明一個例外是另一個例外直接造成的結果,:keyword:`raise` 陳述式容許一個選" "擇性的 :keyword:`from<raise>` 子句: ::" -#: ../../tutorial/errors.rst:319 +#: ../../tutorial/errors.rst:320 msgid "" "# exc must be exception instance or None.\n" "raise RuntimeError from exc" @@ -665,11 +688,11 @@ msgstr "" "# exc 必須是例外實例或 None。\n" "raise RuntimeError from exc" -#: ../../tutorial/errors.rst:322 +#: ../../tutorial/errors.rst:323 msgid "This can be useful when you are transforming exceptions. For example::" msgstr "要變換例外時,這種方式很有用。例如: ::" -#: ../../tutorial/errors.rst:324 +#: ../../tutorial/errors.rst:325 msgid "" ">>> def func():\n" "... raise ConnectionError\n" @@ -715,13 +738,13 @@ msgstr "" " raise RuntimeError('Failed to open database') from exc\n" "RuntimeError: Failed to open database" -#: ../../tutorial/errors.rst:346 +#: ../../tutorial/errors.rst:347 msgid "" "It also allows disabling automatic exception chaining using the ``from " "None`` idiom::" msgstr "它也容許使用慣用語 ``from None`` 來停用自動例外鏈接: ::" -#: ../../tutorial/errors.rst:349 +#: ../../tutorial/errors.rst:350 msgid "" ">>> try:\n" "... open('database.sqlite')\n" @@ -743,16 +766,16 @@ msgstr "" " raise RuntimeError from None\n" "RuntimeError" -#: ../../tutorial/errors.rst:359 +#: ../../tutorial/errors.rst:360 msgid "" "For more information about chaining mechanics, see :ref:`bltin-exceptions`." msgstr "更多關於鏈接機制的資訊,詳見\\ :ref:`bltin-exceptions`。" -#: ../../tutorial/errors.rst:365 +#: ../../tutorial/errors.rst:366 msgid "User-defined Exceptions" msgstr "使用者自定的例外" -#: ../../tutorial/errors.rst:367 +#: ../../tutorial/errors.rst:368 msgid "" "Programs may name their own exceptions by creating a new exception class " "(see :ref:`tut-classes` for more about Python classes). Exceptions should " @@ -760,10 +783,10 @@ msgid "" "indirectly." msgstr "" "程式可以通過建立新的例外 class 來命名自己的例外(深入了解 Python class,詳見" -"\\ :ref:`tut-classes`\\ )。不論是直接還是間接地,例外通常應該從 :exc:" -"`Exception` class 衍生出來。" +"\\ :ref:`tut-classes`\\ )。不論是直接還是間接地,例外通常應該" +"從 :exc:`Exception` class 衍生出來。" -#: ../../tutorial/errors.rst:371 +#: ../../tutorial/errors.rst:372 msgid "" "Exception classes can be defined which do anything any other class can do, " "but are usually kept simple, often only offering a number of attributes that " @@ -773,23 +796,23 @@ msgstr "" "例外 class 可被定義來做任何其他 class 能夠做的事,但通常會讓它維持簡單,只提" "供一些屬性,讓關於錯誤的資訊可被例外的處理者抽取出來。" -#: ../../tutorial/errors.rst:375 +#: ../../tutorial/errors.rst:376 msgid "" "Most exceptions are defined with names that end in \"Error\", similar to the " "naming of the standard exceptions." msgstr "大多數的例外定義,都會以「Error」作為名稱結尾,類似於標準例外的命名。" -#: ../../tutorial/errors.rst:378 +#: ../../tutorial/errors.rst:379 msgid "" "Many standard modules define their own exceptions to report errors that may " "occur in functions they define." msgstr "許多標準模組會定義它們自己的例外,以報告在其定義的函式中發生的錯誤。" -#: ../../tutorial/errors.rst:385 +#: ../../tutorial/errors.rst:386 msgid "Defining Clean-up Actions" msgstr "定義清理動作" -#: ../../tutorial/errors.rst:387 +#: ../../tutorial/errors.rst:388 msgid "" "The :keyword:`try` statement has another optional clause which is intended " "to define clean-up actions that must be executed under all circumstances. " @@ -798,7 +821,7 @@ msgstr "" ":keyword:`try` 陳述式有另一個選擇性子句,用於定義在所有情況下都必須被執行的清" "理動作。例如: ::" -#: ../../tutorial/errors.rst:391 +#: ../../tutorial/errors.rst:392 msgid "" ">>> try:\n" "... raise KeyboardInterrupt\n" @@ -822,7 +845,7 @@ msgstr "" " raise KeyboardInterrupt\n" "KeyboardInterrupt" -#: ../../tutorial/errors.rst:402 +#: ../../tutorial/errors.rst:403 msgid "" "If a :keyword:`finally` clause is present, the :keyword:`!finally` clause " "will execute as the last task before the :keyword:`try` statement completes. " @@ -830,66 +853,67 @@ msgid "" "statement produces an exception. The following points discuss more complex " "cases when an exception occurs:" msgstr "" -"如果 :keyword:`finally` 子句存在,則 :keyword:`!finally` 子句會是 :keyword:" -"`try` 陳述式結束前執行的最後一項任務。不論 :keyword:`!try` 陳述式是否產生例" -"外,都會執行 :keyword:`!finally` 子句。以下幾點將探討例外發生時,比較複雜的情" -"況:" +"如果 :keyword:`finally` 子句存在,則 :keyword:`!finally` 子句會" +"是 :keyword:`try` 陳述式結束前執行的最後一項任務。不論 :keyword:`!try` 陳述式" +"是否產生例外,都會執行 :keyword:`!finally` 子句。以下幾點將探討例外發生時,比" +"較複雜的情況:" -#: ../../tutorial/errors.rst:408 +#: ../../tutorial/errors.rst:409 msgid "" "If an exception occurs during execution of the :keyword:`!try` clause, the " "exception may be handled by an :keyword:`except` clause. If the exception is " "not handled by an :keyword:`!except` clause, the exception is re-raised " "after the :keyword:`!finally` clause has been executed." msgstr "" -"若一個例外發生於 :keyword:`!try` 子句的執行過程,則該例外會被某個 :keyword:" -"`except` 子句處理。如果該例外沒有被 :keyword:`!except` 子句處理,它會在 :" -"keyword:`!finally` 子句執行後被重新引發。" +"若一個例外發生於 :keyword:`!try` 子句的執行過程,則該例外會被某" +"個 :keyword:`except` 子句處理。如果該例外沒有被 :keyword:`!except` 子句處理," +"它會在 :keyword:`!finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:414 +#: ../../tutorial/errors.rst:415 msgid "" -"An exception could occur during execution of an :keyword:`!except` or :" -"keyword:`!else` clause. Again, the exception is re-raised after the :keyword:" -"`!finally` clause has been executed." +"An exception could occur during execution of an :keyword:`!except` " +"or :keyword:`!else` clause. Again, the exception is re-raised after " +"the :keyword:`!finally` clause has been executed." msgstr "" "一個例外可能發生於 :keyword:`!except` 或 :keyword:`!else` 子句的執行過程。同" "樣地,該例外會在 :keyword:`!finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:418 +#: ../../tutorial/errors.rst:419 msgid "" -"If the :keyword:`!finally` clause executes a :keyword:`break`, :keyword:" -"`continue` or :keyword:`return` statement, exceptions are not re-raised." +"If the :keyword:`!finally` clause executes " +"a :keyword:`break`, :keyword:`continue` or :keyword:`return` statement, " +"exceptions are not re-raised." msgstr "" -"如果 :keyword:`!finally` 子句執行 :keyword:`break`、:keyword:`continue` 或 :" -"keyword:`return` 陳述式,則例外不會被重新引發。" +"如果 :keyword:`!finally` 子句執行 :keyword:`break`、:keyword:`continue` " +"或 :keyword:`return` 陳述式,則例外不會被重新引發。" -#: ../../tutorial/errors.rst:422 +#: ../../tutorial/errors.rst:423 msgid "" -"If the :keyword:`!try` statement reaches a :keyword:`break`, :keyword:" -"`continue` or :keyword:`return` statement, the :keyword:`!finally` clause " -"will execute just prior to the :keyword:`!break`, :keyword:`!continue` or :" -"keyword:`!return` statement's execution." +"If the :keyword:`!try` statement reaches " +"a :keyword:`break`, :keyword:`continue` or :keyword:`return` statement, " +"the :keyword:`!finally` clause will execute just prior to the :keyword:`!" +"break`, :keyword:`!continue` or :keyword:`!return` statement's execution." msgstr "" -"如果 :keyword:`!try` 陳述式遇到 :keyword:`break`、:keyword:`continue` 或 :" -"keyword:`return` 陳述式,則 :keyword:`!finally` 子句會在執行 :keyword:`!" +"如果 :keyword:`!try` 陳述式遇到 :keyword:`break`、:keyword:`continue` " +"或 :keyword:`return` 陳述式,則 :keyword:`!finally` 子句會在執行 :keyword:`!" "break`、:keyword:`!continue` 或 :keyword:`!return` 陳述式之前先執行。" -#: ../../tutorial/errors.rst:428 +#: ../../tutorial/errors.rst:429 msgid "" "If a :keyword:`!finally` clause includes a :keyword:`!return` statement, the " -"returned value will be the one from the :keyword:`!finally` clause's :" -"keyword:`!return` statement, not the value from the :keyword:`!try` " -"clause's :keyword:`!return` statement." +"returned value will be the one from the :keyword:`!finally` " +"clause's :keyword:`!return` statement, not the value from the :keyword:`!" +"try` clause's :keyword:`!return` statement." msgstr "" "如果 :keyword:`!finally` 子句中包含 :keyword:`!return` 陳述式,則回傳值會是來" -"自 :keyword:`!finally` 子句的 :keyword:`!return` 陳述式的回傳值,而不是來自 :" -"keyword:`!try` 子句的 :keyword:`!return` 陳述式的回傳值。" +"自 :keyword:`!finally` 子句的 :keyword:`!return` 陳述式的回傳值,而不是來" +"自 :keyword:`!try` 子句的 :keyword:`!return` 陳述式的回傳值。" -#: ../../tutorial/errors.rst:434 +#: ../../tutorial/errors.rst:435 msgid "For example::" msgstr "例如: ::" -#: ../../tutorial/errors.rst:436 +#: ../../tutorial/errors.rst:437 msgid "" ">>> def bool_return():\n" "... try:\n" @@ -909,11 +933,11 @@ msgstr "" ">>> bool_return()\n" "False" -#: ../../tutorial/errors.rst:445 +#: ../../tutorial/errors.rst:446 msgid "A more complicated example::" msgstr "另一個比較複雜的範例: ::" -#: ../../tutorial/errors.rst:447 +#: ../../tutorial/errors.rst:448 msgid "" ">>> def divide(x, y):\n" "... try:\n" @@ -969,18 +993,18 @@ msgstr "" " ~~^~~\n" "TypeError: unsupported operand type(s) for /: 'str' and 'str'" -#: ../../tutorial/errors.rst:474 +#: ../../tutorial/errors.rst:475 msgid "" "As you can see, the :keyword:`finally` clause is executed in any event. " -"The :exc:`TypeError` raised by dividing two strings is not handled by the :" -"keyword:`except` clause and therefore re-raised after the :keyword:`!" +"The :exc:`TypeError` raised by dividing two strings is not handled by " +"the :keyword:`except` clause and therefore re-raised after the :keyword:`!" "finally` clause has been executed." msgstr "" "如你所見,:keyword:`finally` 子句在任何情況下都會被執行。兩個字串相除所引發" "的 :exc:`TypeError` 沒有被 :keyword:`except` 子句處理,因此會在 :keyword:`!" "finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:479 +#: ../../tutorial/errors.rst:480 msgid "" "In real world applications, the :keyword:`finally` clause is useful for " "releasing external resources (such as files or network connections), " @@ -989,11 +1013,11 @@ msgstr "" "在真實應用程式中,:keyword:`finally` 子句對於釋放外部資源(例如檔案或網路連" "線)很有用,無論該資源的使用是否成功。" -#: ../../tutorial/errors.rst:487 +#: ../../tutorial/errors.rst:488 msgid "Predefined Clean-up Actions" msgstr "預定義的清理動作" -#: ../../tutorial/errors.rst:489 +#: ../../tutorial/errors.rst:490 msgid "" "Some objects define standard clean-up actions to be undertaken when the " "object is no longer needed, regardless of whether or not the operation using " @@ -1003,7 +1027,7 @@ msgstr "" "某些物件定義了在物件不再被需要時的標準清理動作,無論使用該物件的作業是成功或" "失敗。請看以下範例,它嘗試開啟一個檔案,並印出檔案內容至螢幕。 ::" -#: ../../tutorial/errors.rst:494 +#: ../../tutorial/errors.rst:495 msgid "" "for line in open(\"myfile.txt\"):\n" " print(line, end=\"\")" @@ -1011,7 +1035,7 @@ msgstr "" "for line in open(\"myfile.txt\"):\n" " print(line, end=\"\")" -#: ../../tutorial/errors.rst:497 +#: ../../tutorial/errors.rst:498 msgid "" "The problem with this code is that it leaves the file open for an " "indeterminate amount of time after this part of the code has finished " @@ -1021,11 +1045,11 @@ msgid "" "correctly. ::" msgstr "" "這段程式碼的問題在於,執行完該程式碼後,它讓檔案在一段不確定的時間內處於開啟" -"狀態。在簡單腳本中這不是問題,但對於較大的應用程式來說可能會是個問題。:" -"keyword:`with` 陳述式讓物件(例如檔案)在被使用時,能保證它們總是及時、正確地" -"被清理。 ::" +"狀態。在簡單腳本中這不是問題,但對於較大的應用程式來說可能會是個問" +"題。:keyword:`with` 陳述式讓物件(例如檔案)在被使用時,能保證它們總是及時、" +"正確地被清理。 ::" -#: ../../tutorial/errors.rst:503 +#: ../../tutorial/errors.rst:504 msgid "" "with open(\"myfile.txt\") as f:\n" " for line in f:\n" @@ -1035,7 +1059,7 @@ msgstr "" " for line in f:\n" " print(line, end=\"\")" -#: ../../tutorial/errors.rst:507 +#: ../../tutorial/errors.rst:508 msgid "" "After the statement is executed, the file *f* is always closed, even if a " "problem was encountered while processing the lines. Objects which, like " @@ -1045,11 +1069,11 @@ msgstr "" "陳述式執行完畢後,就算是在處理內容時遇到問題,檔案 *f* 總是會被關閉。和檔案一" "樣,提供預定義清理動作的物件會在說明文件中表明這一點。" -#: ../../tutorial/errors.rst:515 +#: ../../tutorial/errors.rst:516 msgid "Raising and Handling Multiple Unrelated Exceptions" msgstr "引發及處理多個無關的例外" -#: ../../tutorial/errors.rst:517 +#: ../../tutorial/errors.rst:518 msgid "" "There are situations where it is necessary to report several exceptions that " "have occurred. This is often the case in concurrency frameworks, when " @@ -1061,7 +1085,7 @@ msgstr "" "中經常會出現這種情況,當平行的 (parallel) 某些任務可能已經失效,但還有其他用" "例 (use case) 希望能繼續執行並收集多個例外,而不是只有引發第一個例外時。" -#: ../../tutorial/errors.rst:523 +#: ../../tutorial/errors.rst:524 msgid "" "The builtin :exc:`ExceptionGroup` wraps a list of exception instances so " "that they can be raised together. It is an exception itself, so it can be " @@ -1071,7 +1095,7 @@ msgstr "" "(串列),使得它們可以一起被引發。由於它本身就是一個例外,因此它也可以像任何" "其他例外一樣被捕獲。 ::" -#: ../../tutorial/errors.rst:527 +#: ../../tutorial/errors.rst:528 msgid "" ">>> def f():\n" "... excs = [OSError('error 1'), SystemError('error 2')]\n" @@ -1123,7 +1147,7 @@ msgstr "" "caught <class 'ExceptionGroup'>: e\n" ">>>" -#: ../../tutorial/errors.rst:552 +#: ../../tutorial/errors.rst:553 msgid "" "By using ``except*`` instead of ``except``, we can selectively handle only " "the exceptions in the group that match a certain type. In the following " @@ -1136,7 +1160,7 @@ msgstr "" "``except*`` 子句分別從該群組中提取一個特定類型的例外,同時讓所有其他的例外都" "傳遞到其他子句,最後再被重新引發。 ::" -#: ../../tutorial/errors.rst:559 +#: ../../tutorial/errors.rst:560 msgid "" ">>> def f():\n" "... raise ExceptionGroup(\n" @@ -1220,7 +1244,7 @@ msgstr "" " +------------------------------------\n" ">>>" -#: ../../tutorial/errors.rst:600 +#: ../../tutorial/errors.rst:601 msgid "" "Note that the exceptions nested in an exception group must be instances, not " "types. This is because in practice the exceptions would typically be ones " @@ -1230,7 +1254,7 @@ msgstr "" "請注意,被巢套在例外群組中的例外必須是實例,而不是類型。這是因為在實務上,這" "些例外通常是已經被程式引發並捕獲的例外,類似以下的模式: ::" -#: ../../tutorial/errors.rst:605 +#: ../../tutorial/errors.rst:606 msgid "" ">>> excs = []\n" "... for test in tests:\n" @@ -1254,11 +1278,11 @@ msgstr "" "... raise ExceptionGroup(\"Test Failures\", excs)\n" "..." -#: ../../tutorial/errors.rst:620 +#: ../../tutorial/errors.rst:621 msgid "Enriching Exceptions with Notes" msgstr "用註解使例外更詳細" -#: ../../tutorial/errors.rst:622 +#: ../../tutorial/errors.rst:623 msgid "" "When an exception is created in order to be raised, it is usually " "initialized with information that describes the error that has occurred. " @@ -1274,7 +1298,7 @@ msgstr "" "的註解清單中。標準的回溯呈現會在例外之後列出所有的註解,並按照其被添加的順序" "來排列。 ::" -#: ../../tutorial/errors.rst:629 +#: ../../tutorial/errors.rst:630 msgid "" ">>> try:\n" "... raise TypeError('bad type')\n" @@ -1306,7 +1330,7 @@ msgstr "" "Add some more information\n" ">>>" -#: ../../tutorial/errors.rst:644 +#: ../../tutorial/errors.rst:645 msgid "" "For example, when collecting exceptions into an exception group, we may want " "to add context information for the individual errors. In the following each " @@ -1315,7 +1339,7 @@ msgstr "" "例如,在將例外收集到例外群組中時,我們可能希望為各個錯誤添加一些上下文的資" "訊。在以下範例中,群組中的每個例外都有一條註解,指示此錯誤是在何時發生。 ::" -#: ../../tutorial/errors.rst:648 +#: ../../tutorial/errors.rst:649 msgid "" ">>> def f():\n" "... raise OSError('operation failed')\n" diff --git a/tutorial/inputoutput.po b/tutorial/inputoutput.po index 229b4c9c4b..cf215d9b34 100644 --- a/tutorial/inputoutput.po +++ b/tutorial/inputoutput.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -41,15 +40,15 @@ msgstr "更華麗的輸出格式" #: ../../tutorial/inputoutput.rst:17 msgid "" "So far we've encountered two ways of writing values: *expression statements* " -"and the :func:`print` function. (A third way is using the :meth:`~io." -"TextIOBase.write` method of file objects; the standard output file can be " -"referenced as ``sys.stdout``. See the Library Reference for more information " -"on this.)" +"and the :func:`print` function. (A third way is using " +"the :meth:`~io.TextIOBase.write` method of file objects; the standard output " +"file can be referenced as ``sys.stdout``. See the Library Reference for more " +"information on this.)" msgstr "" -"目前為止我們已經學過兩種寫值的方式:*運算式陳述 (expression statements)* 與 :" -"func:`print` 函式。(第三種方法是使用檔案物件的 :meth:`~io.TextIOBase.write` " -"方法;標準輸出的檔案是使用 ``sys.stdout`` 來達成的。詳細的資訊請參考對應的函" -"式庫說明。)" +"目前為止我們已經學過兩種寫值的方式:*運算式陳述 (expression statements)* " +"與 :func:`print` 函式。(第三種方法是使用檔案物件" +"的 :meth:`~io.TextIOBase.write` 方法;標準輸出的檔案是使用 ``sys.stdout`` 來" +"達成的。詳細的資訊請參考對應的函式庫說明。)" #: ../../tutorial/inputoutput.rst:22 msgid "" @@ -114,8 +113,8 @@ msgstr "" msgid "" "Notice how the ``yes_votes`` are padded with spaces and a negative sign only " "for negative numbers. The example also prints ``percentage`` multiplied by " -"100, with 2 decimal places and followed by a percent sign (see :ref:" -"`formatspec` for details)." +"100, with 2 decimal places and followed by a percent sign " +"(see :ref:`formatspec` for details)." msgstr "" "請注意 ``yes_votes`` 如何對於負數用空格和負號填補。該範例還會列出 " "``percentage`` 乘以 100,並保留 2 位小數且後面跟著一個百分號(有關詳細資訊," @@ -138,17 +137,17 @@ msgid "" "variables for debugging purposes, you can convert any value to a string with " "the :func:`repr` or :func:`str` functions." msgstr "" -"如果你不需要華麗的輸出,只想快速顯示變數以進行除錯,可以用 :func:`repr` 或 :" -"func:`str` 函式把任何的值轉換為字串。" +"如果你不需要華麗的輸出,只想快速顯示變數以進行除錯,可以用 :func:`repr` " +"或 :func:`str` 函式把任何的值轉換為字串。" #: ../../tutorial/inputoutput.rst:66 msgid "" "The :func:`str` function is meant to return representations of values which " "are fairly human-readable, while :func:`repr` is meant to generate " -"representations which can be read by the interpreter (or will force a :exc:" -"`SyntaxError` if there is no equivalent syntax). For objects which don't " -"have a particular representation for human consumption, :func:`str` will " -"return the same value as :func:`repr`. Many values, such as numbers or " +"representations which can be read by the interpreter (or will force " +"a :exc:`SyntaxError` if there is no equivalent syntax). For objects which " +"don't have a particular representation for human consumption, :func:`str` " +"will return the same value as :func:`repr`. Many values, such as numbers or " "structures like lists and dictionaries, have the same representation using " "either function. Strings, in particular, have two distinct representations." msgstr "" @@ -185,6 +184,26 @@ msgid "" ">>> repr((x, y, ('spam', 'eggs')))\n" "\"(32.5, 40000, ('spam', 'eggs'))\"" msgstr "" +">>> s = 'Hello, world.'\n" +">>> str(s)\n" +"'Hello, world.'\n" +">>> repr(s)\n" +"\"'Hello, world.'\"\n" +">>> str(1/7)\n" +"'0.14285714285714285'\n" +">>> x = 10 * 3.25\n" +">>> y = 200 * 200\n" +">>> s = 'The value of x is ' + repr(x) + ', and y is ' + repr(y) + '...'\n" +">>> print(s)\n" +"The value of x is 32.5, and y is 40000...\n" +">>> # 字串的 repr() 會加上字串引號和反斜線:\n" +">>> hello = 'hello, world\\n'\n" +">>> hellos = repr(hello)\n" +">>> print(hellos)\n" +"'hello, world\\n'\n" +">>> # repr() 的引數可以是任何 Python 物件:\n" +">>> repr((x, y, ('spam', 'eggs')))\n" +"\"(32.5, 40000, ('spam', 'eggs'))\"" #: ../../tutorial/inputoutput.rst:98 msgid "" @@ -296,8 +315,8 @@ msgid "" "specifications, see the reference guide for the :ref:`formatspec`." msgstr "" "更多關於 ``=`` 說明符的資訊請見\\ :ref:`自文件性運算式 (self-documenting " -"expressions) <bpo-36817-whatsnew>`。若要參考這些格式化字串的規格,詳見 :ref:" -"`formatspec` 參考指南。" +"expressions) <bpo-36817-whatsnew>`。若要參考這些格式化字串的規格,詳" +"見 :ref:`formatspec` 參考指南。" #: ../../tutorial/inputoutput.rst:166 msgid "The String format() Method" @@ -319,8 +338,8 @@ msgstr "" msgid "" "The brackets and characters within them (called format fields) are replaced " "with the objects passed into the :meth:`str.format` method. A number in the " -"brackets can be used to refer to the position of the object passed into the :" -"meth:`str.format` method. ::" +"brackets can be used to refer to the position of the object passed into " +"the :meth:`str.format` method. ::" msgstr "" "大括號及其內的字元(稱為格式欄位)會被取代為傳遞給 :meth:`str.format` method " "的物件。大括號中的數字表示該物件在傳遞給 :meth:`str.format` method 時所在的位" @@ -403,19 +422,20 @@ msgstr "" #: ../../tutorial/inputoutput.rst:209 msgid "" ">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" -">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: {Dcab:d}'." -"format(**table))\n" +">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: " +"{Dcab:d}'.format(**table))\n" "Jack: 4098; Sjoerd: 4127; Dcab: 8637678" msgstr "" ">>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}\n" -">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: {Dcab:d}'." -"format(**table))\n" +">>> print('Jack: {Jack:d}; Sjoerd: {Sjoerd:d}; Dcab: " +"{Dcab:d}'.format(**table))\n" "Jack: 4098; Sjoerd: 4127; Dcab: 8637678" #: ../../tutorial/inputoutput.rst:213 msgid "" -"This is particularly useful in combination with the built-in function :func:" -"`vars`, which returns a dictionary containing all local variables::" +"This is particularly useful in combination with the built-in " +"function :func:`vars`, which returns a dictionary containing all local " +"variables::" msgstr "" "與內建函式 :func:`vars` 組合使用時,這種方式特別實用。該函式可以回傳一個包含" "所有區域變數的 dictionary: ::" @@ -470,11 +490,11 @@ msgstr "" #: ../../tutorial/inputoutput.rst:238 msgid "" -"For a complete overview of string formatting with :meth:`str.format`, see :" -"ref:`formatstrings`." +"For a complete overview of string formatting with :meth:`str.format`, " +"see :ref:`formatstrings`." msgstr "" -"關於使用 :meth:`str.format` 進行字串格式化的完整概述,請見\\ :ref:" -"`formatstrings`。" +"關於使用 :meth:`str.format` 進行字串格式化的完整概述,請見" +"\\ :ref:`formatstrings`。" #: ../../tutorial/inputoutput.rst:243 msgid "Manual String Formatting" @@ -520,8 +540,8 @@ msgstr "" #: ../../tutorial/inputoutput.rst:263 msgid "" -"(Note that the one space between each column was added by the way :func:" -"`print` works: it always adds spaces between its arguments.)" +"(Note that the one space between each column was added by the " +"way :func:`print` works: it always adds spaces between its arguments.)" msgstr "" "(請注意,使用 :func:`print` 讓每欄之間加入一個空格的方法:這種方法總是在其引" "數間加入空格。)" @@ -640,9 +660,10 @@ msgid "" "*encoding*. If *encoding* is not specified, the default is platform " "dependent (see :func:`open`). Because UTF-8 is the modern de-facto standard, " "``encoding=\"utf-8\"`` is recommended unless you know that you need to use a " -"different encoding. Appending a ``'b'`` to the mode opens the file in :dfn:" -"`binary mode`. Binary mode data is read and written as :class:`bytes` " -"objects. You can not specify *encoding* when opening file in binary mode." +"different encoding. Appending a ``'b'`` to the mode opens the file " +"in :dfn:`binary mode`. Binary mode data is read and written " +"as :class:`bytes` objects. You can not specify *encoding* when opening file " +"in binary mode." msgstr "" "通常,檔案以 :dfn:`text mode` 開啟,意即,從檔案中讀取或寫入字串時,都以特定" "編碼方式 *encoding* 進行編碼。如未指定 *encoding*,則預設值會取決於系統平台" @@ -657,9 +678,9 @@ msgid "" "endings (``\\n`` on Unix, ``\\r\\n`` on Windows) to just ``\\n``. When " "writing in text mode, the default is to convert occurrences of ``\\n`` back " "to platform-specific line endings. This behind-the-scenes modification to " -"file data is fine for text files, but will corrupt binary data like that in :" -"file:`JPEG` or :file:`EXE` files. Be very careful to use binary mode when " -"reading and writing such files." +"file data is fine for text files, but will corrupt binary data like that " +"in :file:`JPEG` or :file:`EXE` files. Be very careful to use binary mode " +"when reading and writing such files." msgstr "" "在文字模式 (text mode) 下,讀取時會預設把平台特定的行尾符號(Unix 上為 " "``\\n``,Windows 上為 ``\\r\\n``)轉換為 ``\\n``。在文字模式下寫入時,預設會" @@ -671,9 +692,9 @@ msgstr "" msgid "" "It is good practice to use the :keyword:`with` keyword when dealing with " "file objects. The advantage is that the file is properly closed after its " -"suite finishes, even if an exception is raised at some point. Using :" -"keyword:`!with` is also much shorter than writing equivalent :keyword:" -"`try`\\ -\\ :keyword:`finally` blocks::" +"suite finishes, even if an exception is raised at some point. " +"Using :keyword:`!with` is also much shorter than writing " +"equivalent :keyword:`try`\\ -\\ :keyword:`finally` blocks::" msgstr "" "在處理檔案物件時,使用 :keyword:`with` 關鍵字是個好習慣。優點是,當它的套件結" "束後,即使在某個時刻引發了例外,檔案仍會正確地被關閉。使用 :keyword:`!with` " @@ -697,8 +718,8 @@ msgstr "" #: ../../tutorial/inputoutput.rst:365 msgid "" -"If you're not using the :keyword:`with` keyword, then you should call ``f." -"close()`` to close the file and immediately free up any system resources " +"If you're not using the :keyword:`with` keyword, then you should call " +"``f.close()`` to close the file and immediately free up any system resources " "used by it." msgstr "" "如果你沒有使用 :keyword:`with` 關鍵字,則應呼叫 ``f.close()`` 關閉檔案,可以" @@ -834,8 +855,8 @@ msgid "" "If you want to read all the lines of a file in a list you can also use " "``list(f)`` or ``f.readlines()``." msgstr "" -"如果你想把一個檔案的所有行讀進一個 list 裡,可以用 ``list(f)`` 或 ``f." -"readlines()``。" +"如果你想把一個檔案的所有行讀進一個 list 裡,可以用 ``list(f)`` 或 " +"``f.readlines()``。" #: ../../tutorial/inputoutput.rst:437 msgid "" @@ -957,18 +978,18 @@ msgid "" "want to save more complex data types like nested lists and dictionaries, " "parsing and serializing by hand becomes complicated." msgstr "" -"字串可以簡單地從檔案中被寫入和讀取。數字則稍嫌麻煩,因為 :meth:`~io." -"TextIOBase.read` method 只回傳字串,這些字串必須傳遞給像 :func:`int` 這樣的函" -"式,它接受 ``'123'`` 這樣的字串,並回傳數值 123。當你想儲存像是巢狀 list 和 " -"dictionary(字典)等複雜的資料類型時,手動剖析 (parsing) 和序列化 " -"(serializing) 就變得複雜。" +"字串可以簡單地從檔案中被寫入和讀取。數字則稍嫌麻煩,因" +"為 :meth:`~io.TextIOBase.read` method 只回傳字串,這些字串必須傳遞給" +"像 :func:`int` 這樣的函式,它接受 ``'123'`` 這樣的字串,並回傳數值 123。當你" +"想儲存像是巢狀 list 和 dictionary(字典)等複雜的資料類型時,手動剖析 " +"(parsing) 和序列化 (serializing) 就變得複雜。" #: ../../tutorial/inputoutput.rst:499 msgid "" "Rather than having users constantly writing and debugging code to save " "complicated data types to files, Python allows you to use the popular data " -"interchange format called `JSON (JavaScript Object Notation) <https://json." -"org>`_. The standard module called :mod:`json` can take Python data " +"interchange format called `JSON (JavaScript Object Notation) <https://" +"json.org>`_. The standard module called :mod:`json` can take Python data " "hierarchies, and convert them to string representations; this process is " "called :dfn:`serializing`. Reconstructing the data from the string " "representation is called :dfn:`deserializing`. Between serializing and " @@ -1012,13 +1033,14 @@ msgstr "" #: ../../tutorial/inputoutput.rst:522 msgid "" -"Another variant of the :func:`~json.dumps` function, called :func:`~json." -"dump`, simply serializes the object to a :term:`text file`. So if ``f`` is " -"a :term:`text file` object opened for writing, we can do this::" +"Another variant of the :func:`~json.dumps` function, " +"called :func:`~json.dump`, simply serializes the object to a :term:`text " +"file`. So if ``f`` is a :term:`text file` object opened for writing, we can " +"do this::" msgstr "" ":func:`~json.dumps` 函式有一個變體,稱為 :func:`~json.dump`,它單純地將物件序" -"列化為 :term:`text file`。因此,如果 ``f`` 是一個為了寫入而開啟的 :term:" -"`text file` 物件,我們可以這樣做: ::" +"列化為 :term:`text file`。因此,如果 ``f`` 是一個為了寫入而開啟" +"的 :term:`text file` 物件,我們可以這樣做: ::" #: ../../tutorial/inputoutput.rst:526 msgid "json.dump(x, f)" @@ -1041,8 +1063,8 @@ msgid "" "JSON files must be encoded in UTF-8. Use ``encoding=\"utf-8\"`` when opening " "JSON file as a :term:`text file` for both of reading and writing." msgstr "" -"JSON 檔案必須以 UTF-8 格式編碼。在開啟 JSON 檔案以作為一個可讀取與寫入的 :" -"term:`text file` 時,要用 ``encoding=\"utf-8\"``。" +"JSON 檔案必須以 UTF-8 格式編碼。在開啟 JSON 檔案以作為一個可讀取與寫入" +"的 :term:`text file` 時,要用 ``encoding=\"utf-8\"``。" #: ../../tutorial/inputoutput.rst:537 msgid "" diff --git a/tutorial/interactive.po b/tutorial/interactive.po index 87c287b2c8..fc1e052dc3 100644 --- a/tutorial/interactive.po +++ b/tutorial/interactive.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-29 10:36+0000\n" +"POT-Creation-Date: 2025-03-19 00:14+0000\n" "PO-Revision-Date: 2021-06-28 20:45+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,19 +50,19 @@ msgid "" "final ``'.'`` and then suggest completions from the attributes of the " "resulting object. Note that this may execute application-defined code if an " "object with a :meth:`~object.__getattr__` method is part of the expression. " -"The default configuration also saves your history into a file named :file:`." -"python_history` in your user directory. The history will be available again " -"during the next interactive interpreter session." +"The default configuration also saves your history into a file " +"named :file:`.python_history` in your user directory. The history will be " +"available again during the next interactive interpreter session." msgstr "" "在直譯器啟動的時候,變數和模組名稱的自動完成功能會被\\ :ref:`自動啟用 " "<rlcompleter-config>`,所以可以用 :kbd:`Tab` 鍵來叫用自動完成函式;它會查看 " "Python 的陳述式名稱、目前區域變數名稱和可用模組名稱。對於像是 ``string.a`` 的" "點分隔運算式 (dotted expression),它會對最後一個 ``'.'`` 之前的運算式求值,然" -"後根據求值結果物件的屬性,給予自動完成的建議。請注意,如果一個物件有 :meth:" -"`~object.__getattr__` method(方法),同時又是該運算式的一部份,這樣可能會執" -"行應用程式自定義的程式碼。預設設定也會把你的指令歷史記錄儲存在你的使用者資料" -"夾內,一個名為 :file:`.python_history` 的檔案中。在下一次啟動互動式直譯器時," -"這些歷史記錄依然可以被使用。" +"後根據求值結果物件的屬性,給予自動完成的建議。請注意,如果一個物件" +"有 :meth:`~object.__getattr__` method(方法),同時又是該運算式的一部份,這樣" +"可能會執行應用程式自定義的程式碼。預設設定也會把你的指令歷史記錄儲存在你的使" +"用者資料夾內,一個名為 :file:`.python_history` 的檔案中。在下一次啟動互動式直" +"譯器時,這些歷史記錄依然可以被使用。" #: ../../tutorial/interactive.rst:36 msgid "Alternatives to the Interactive Interpreter" @@ -74,15 +73,15 @@ msgid "" "This facility is an enormous step forward compared to earlier versions of " "the interpreter; however, some wishes are left: It would be nice if the " "proper indentation were suggested on continuation lines (the parser knows if " -"an indent token is required next). The completion mechanism might use the " -"interpreter's symbol table. A command to check (or even suggest) matching " -"parentheses, quotes, etc., would also be useful." +"an :data:`~token.INDENT` token is required next). The completion mechanism " +"might use the interpreter's symbol table. A command to check (or even " +"suggest) matching parentheses, quotes, etc., would also be useful." msgstr "" "與早期版本的直譯器相比,上述功能的出現的確是一個巨大的進步;但還是有一些願望" "沒有被實現:如果能在每次換行時給予適當的縮排建議(剖析器 (parser) 知道下一行" -"是否需要縮排標記 (indent token)),那就更棒了。自動完成機制可能會使用直譯器的" -"符號表。若有一個命令能夠檢查(或甚至建議)括號、引號和其他符號的匹配,那也會" -"很有用。" +"是否需要縮排標記 (:data:`~token.INDENT` token)),那就更棒了。自動完成機制可" +"能會使用直譯器的符號表。若有一個命令能夠檢查(或甚至建議)括號、引號和其他符" +"號的匹配,那也會很有用。" #: ../../tutorial/interactive.rst:45 msgid "" diff --git a/tutorial/interpreter.po b/tutorial/interpreter.po index 6d744513bd..5f3f9461b1 100644 --- a/tutorial/interpreter.po +++ b/tutorial/interpreter.po @@ -29,20 +29,19 @@ msgid "Invoking the Interpreter" msgstr "啟動直譯器" #: ../../tutorial/interpreter.rst:13 -#, fuzzy msgid "" "The Python interpreter is usually installed as |" "usr_local_bin_python_x_dot_y_literal| on those machines where it is " "available; putting :file:`/usr/local/bin` in your Unix shell's search path " "makes it possible to start it by typing the command:" msgstr "" -"Python 直譯器一般安裝在 :file:`/usr/local/bin/python3.12` 路徑下;將 :file:`/" -"usr/local/bin` 加入Unix shell 的搜尋路徑,輸入以下指令就可以啟動 Python:" +"在有安裝的機器上 Python 直譯器通常是被安裝在 |" +"usr_local_bin_python_x_dot_y_literal|;把 :file:`/usr/local/bin` 放在 Unix " +"shell 的搜尋路徑中就可以透過輸入指令來啟動它:" #: ../../tutorial/interpreter.rst:17 -#, fuzzy msgid "python3.13" -msgstr "python3.12" +msgstr "python3.13" #: ../../tutorial/interpreter.rst:21 msgid "" @@ -113,10 +112,10 @@ msgstr "" #: ../../tutorial/interpreter.rst:51 msgid "" "A second way of starting the interpreter is ``python -c command [arg] ...``, " -"which executes the statement(s) in *command*, analogous to the shell's :" -"option:`-c` option. Since Python statements often contain spaces or other " -"characters that are special to the shell, it is usually advised to quote " -"*command* in its entirety." +"which executes the statement(s) in *command*, analogous to the " +"shell's :option:`-c` option. Since Python statements often contain spaces " +"or other characters that are special to the shell, it is usually advised to " +"quote *command* in its entirety." msgstr "" "另一個啟動直譯器的方式為 ``python -c command [arg] ...``,它會執行在 " "*command* 裡的指令(們),行為如同 shell 的 :option:`-c` 選項。因為 Python 的" @@ -134,8 +133,8 @@ msgstr "" #: ../../tutorial/interpreter.rst:61 msgid "" "When a script file is used, it is sometimes useful to be able to run the " -"script and enter interactive mode afterwards. This can be done by passing :" -"option:`-i` before the script." +"script and enter interactive mode afterwards. This can be done by " +"passing :option:`-i` before the script." msgstr "" "當要執行一個腳本檔時,有時候會希望在腳本結束時進入互動模式。此時可在執行腳本" "的指令加入 :option:`-i`。" @@ -167,10 +166,10 @@ msgstr "" "並指派給 ``sys`` 模組的 ``argv`` 變數。你可以執行 ``import sys`` 取得這個串" "列。這個串列的長度至少為一;當沒有給任何腳本名稱和引數時, ``sys.argv[0]`` 為" "空字串。當腳本名為 ``'-'``\\ (指標準輸入)時, ``sys.argv[0]`` 為 ``'-'``。" -"當使用 :option:`-c` *command* 時, ``sys.argv[0]`` 為 ``'-c'``。當使用 :" -"option:`-m` *module* 時, ``sys.argv[0]`` 為該模組存在的完整路徑。其餘非 :" -"option:`-c` *command* 或 :option:`-m` *module* 的選項不會被 Python 直譯器吸收" -"掉,而是留在 ``sys.argv`` 變數中給後續的 command 或 module 使用。" +"當使用 :option:`-c` *command* 時, ``sys.argv[0]`` 為 ``'-c'``。當使" +"用 :option:`-m` *module* 時, ``sys.argv[0]`` 為該模組存在的完整路徑。其餘" +"非 :option:`-c` *command* 或 :option:`-m` *module* 的選項不會被 Python 直譯器" +"吸收掉,而是留在 ``sys.argv`` 變數中給後續的 command 或 module 使用。" #: ../../tutorial/interpreter.rst:89 msgid "Interactive Mode" @@ -192,7 +191,6 @@ msgstr "" "符: ::" #: ../../tutorial/interpreter.rst:98 -#, fuzzy msgid "" "$ python3.13\n" "Python 3.13 (default, April 4 2023, 09:25:04)\n" @@ -201,8 +199,8 @@ msgid "" "information.\n" ">>>" msgstr "" -"$ python3.12\n" -"Python 3.12 (default, April 4 2022, 09:25:04)\n" +"$ python3.13\n" +"Python 3.13 (default, April 4 2023, 09:25:04)\n" "[GCC 10.2.0] on linux\n" "Type \"help\", \"copyright\", \"credits\" or \"license\" for more " "information.\n" diff --git a/tutorial/introduction.po b/tutorial/introduction.po index 4db1924d3e..f55a511ab3 100644 --- a/tutorial/introduction.po +++ b/tutorial/introduction.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-08 03:35+0000\n" +"POT-Creation-Date: 2025-02-20 00:13+0000\n" "PO-Revision-Date: 2022-10-16 03:20+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,10 +34,11 @@ msgid "" "that a secondary prompt on a line by itself in an example means you must " "type a blank line; this is used to end a multi-line command." msgstr "" -"在下面的例子中,輸入與輸出的區別在於有無提示字元(prompt,:term:`>>>` 和 :" -"term:`...`\\ ):如果要重做範例,你必須在提示字元出現的時候,輸入提示字元後方" -"的所有內容;那些非提示字元開始的文字行是直譯器的輸出。注意到在範例中,若出現" -"單行只有次提示字元時,代表該行你必須直接換行;這被使用在多行指令結束輸入時。" +"在下面的例子中,輸入與輸出的區別在於有無提示字元(prompt,:term:`>>>` " +"和 :term:`...`\\ ):如果要重做範例,你必須在提示字元出現的時候,輸入提示字元" +"後方的所有內容;那些非提示字元開始的文字行是直譯器的輸出。注意到在範例中,若" +"出現單行只有次提示字元時,代表該行你必須直接換行;這被使用在多行指令結束輸入" +"時。" #: ../../tutorial/introduction.rst:16 msgid "" @@ -120,8 +121,9 @@ msgstr "" #: ../../tutorial/introduction.rst:68 msgid "" "The integer numbers (e.g. ``2``, ``4``, ``20``) have type :class:`int`, the " -"ones with a fractional part (e.g. ``5.0``, ``1.6``) have type :class:" -"`float`. We will see more about numeric types later in the tutorial." +"ones with a fractional part (e.g. ``5.0``, ``1.6``) have " +"type :class:`float`. We will see more about numeric types later in the " +"tutorial." msgstr "" "整數數字(即 ``2``、``4``、``20``)為 :class:`int` 型態,數字有小數點部份的" "(即 ``5.0``、``1.6``)為 :class:`float` 型態。我們將在之後的教學中看到更多數" @@ -256,15 +258,15 @@ msgstr "" #: ../../tutorial/introduction.rst:132 msgid "" "In addition to :class:`int` and :class:`float`, Python supports other types " -"of numbers, such as :class:`~decimal.Decimal` and :class:`~fractions." -"Fraction`. Python also has built-in support for :ref:`complex numbers " -"<typesnumeric>`, and uses the ``j`` or ``J`` suffix to indicate the " -"imaginary part (e.g. ``3+5j``)." +"of numbers, such as :class:`~decimal.Decimal` " +"and :class:`~fractions.Fraction`. Python also has built-in support " +"for :ref:`complex numbers <typesnumeric>`, and uses the ``j`` or ``J`` " +"suffix to indicate the imaginary part (e.g. ``3+5j``)." msgstr "" -"除了 :class:`int` 和 :class:`float`,Python 還支援了其他的數字型態,包含 :" -"class:`~decimal.Decimal` 和 :class:`~fractions.Fraction`。Python 亦內建支援" -"\\ :ref:`複數 (complex numbers) <typesnumeric>`,並使用 ``j`` 和 ``J`` 後綴來" -"指定虛數的部份(即 ``3+5j``)。" +"除了 :class:`int` 和 :class:`float`,Python 還支援了其他的數字型態,包" +"含 :class:`~decimal.Decimal` 和 :class:`~fractions.Fraction`。Python 亦內建支" +"援\\ :ref:`複數 (complex numbers) <typesnumeric>`,並使用 ``j`` 和 ``J`` 後綴" +"來指定虛數的部份(即 ``3+5j``)。" #: ../../tutorial/introduction.rst:142 msgid "Text" @@ -357,14 +359,14 @@ msgstr "" #: ../../tutorial/introduction.rst:197 msgid "" "String literals can span multiple lines. One way is using triple-quotes: " -"``\"\"\"...\"\"\"`` or ``'''...'''``. End of lines are automatically " -"included in the string, but it's possible to prevent this by adding a ``\\`` " -"at the end of the line. In the following example, the initial newline is " -"not included::" +"``\"\"\"...\"\"\"`` or ``'''...'''``. End-of-line characters are " +"automatically included in the string, but it's possible to prevent this by " +"adding a ``\\`` at the end of the line. In the following example, the " +"initial newline is not included::" msgstr "" "字串文本可以跨越數行。其中一方式是使用三個重覆引號:``\"\"\"...\"\"\"`` 或 " -"``'''...'''``。此時換行會被自動加入字串值中,但也可以在換行前加入 ``\\`` 來取" -"消這個行為。在以下的例子中,最初的換行符不會被包含: ::" +"``'''...'''``。此時換行字元會被自動加入字串值中,但也可以在換行前加入 ``\\`` " +"來取消這個行為。在以下的例子中,最初的換行符不會被包含: ::" #: ../../tutorial/introduction.rst:203 msgid "" @@ -796,8 +798,8 @@ msgstr "" #: ../../tutorial/introduction.rst:421 msgid "" -"You can also add new items at the end of the list, by using the :meth:`!list." -"append` *method* (we will see more about methods later)::" +"You can also add new items at the end of the list, by using the :meth:`!" +"list.append` *method* (we will see more about methods later)::" msgstr "" "你也可以在 list 的最後加入新元素,透過使用 :meth:`!list.append` *方法* " "(method)(我們稍後會看到更多方法的說明): ::" diff --git a/tutorial/modules.po b/tutorial/modules.po index 840d18de5a..ba0132e688 100644 --- a/tutorial/modules.po +++ b/tutorial/modules.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-10 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2022-10-23 20:30+0800\n" "Last-Translator: Phil Lin <linooohon@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -184,8 +184,8 @@ msgstr "" "每個模組都有它自己的私有命名空間 (namespace),模組內定義的函式會把該模組的私" "有符號表當成全域命名空間使用。因此,模組的作者可以在模組中使用全域變數,而不" "必擔心和使用者的全域變數發生意外的名稱衝突。另一方面,如果你知道自己在做什" -"麼,你可以用這個方式取用模組的全域變數,以和引用函式一樣的寫法,``modname." -"itemname``。" +"麼,你可以用這個方式取用模組的全域變數,以和引用函式一樣的寫法," +"``modname.itemname``。" #: ../../tutorial/modules.rst:86 msgid "" @@ -262,8 +262,8 @@ msgstr "" #: ../../tutorial/modules.rst:116 msgid "" -"If the module name is followed by :keyword:`!as`, then the name following :" -"keyword:`!as` is bound directly to the imported module." +"If the module name is followed by :keyword:`!as`, then the name " +"following :keyword:`!as` is bound directly to the imported module." msgstr "" "如果模組名稱後面出現 :keyword:`!as`,則 :keyword:`!as` 之後的名稱將直接和被 " "import 模組綁定在一起。" @@ -306,13 +306,13 @@ msgid "" "For efficiency reasons, each module is only imported once per interpreter " "session. Therefore, if you change your modules, you must restart the " "interpreter -- or, if it's just one module you want to test interactively, " -"use :func:`importlib.reload`, e.g. ``import importlib; importlib." -"reload(modulename)``." +"use :func:`importlib.reload`, e.g. ``import importlib; " +"importlib.reload(modulename)``." msgstr "" "出於效率原因,每個模組在每個直譯器 session 中僅會被 import 一次。因此,如果你" "更改了模組,則必須重啟直譯器——或者,如果只是一個想要在互動模式下測試的模組," -"可以使用 :func:`importlib.reload`。例如:``import importlib; importlib." -"reload(modulename)``。" +"可以使用 :func:`importlib.reload`。例如:``import importlib; " +"importlib.reload(modulename)``。" #: ../../tutorial/modules.rst:147 msgid "Executing modules as scripts" @@ -390,10 +390,11 @@ msgstr "模組的搜尋路徑" #: ../../tutorial/modules.rst:186 msgid "" "When a module named :mod:`!spam` is imported, the interpreter first searches " -"for a built-in module with that name. These module names are listed in :data:" -"`sys.builtin_module_names`. If not found, it then searches for a file named :" -"file:`spam.py` in a list of directories given by the variable :data:`sys." -"path`. :data:`sys.path` is initialized from these locations:" +"for a built-in module with that name. These module names are listed " +"in :data:`sys.builtin_module_names`. If not found, it then searches for a " +"file named :file:`spam.py` in a list of directories given by the " +"variable :data:`sys.path`. :data:`sys.path` is initialized from these " +"locations:" msgstr "" "Import 一個名為 :mod:`!spam` 的模組時,直譯器首先會搜尋具有該名稱的內建模組。" "模組名稱列在 :data:`sys.builtin_module_names` 當中。如果找不到,接下來會在變" @@ -419,8 +420,8 @@ msgid "" "The installation-dependent default (by convention including a ``site-" "packages`` directory, handled by the :mod:`site` module)." msgstr "" -"與安裝相關的預設值(按慣例會包含一個 ``site-packages`` 資料夾,它是由 :mod:" -"`site` 模組所處理)。" +"與安裝相關的預設值(按慣例會包含一個 ``site-packages`` 資料夾,它是" +"由 :mod:`site` 模組所處理)。" #: ../../tutorial/modules.rst:199 msgid "More details are at :ref:`sys-path-init`." @@ -518,8 +519,8 @@ msgstr "" #: ../../tutorial/modules.rst:251 msgid "" "A program doesn't run any faster when it is read from a ``.pyc`` file than " -"when it is read from a ``.py`` file; the only thing that's faster about ``." -"pyc`` files is the speed with which they are loaded." +"when it is read from a ``.py`` file; the only thing that's faster about " +"``.pyc`` files is the speed with which they are loaded." msgstr "" "讀取 ``.pyc`` 檔案時,程式的執行速度並不會比讀取 ``.py`` 檔案快。唯一比較快的" "地方是載入的速度。" @@ -627,7 +628,7 @@ msgid "" ">>> import fibo, sys\n" ">>> dir(fibo)\n" "['__name__', 'fib', 'fib2']\n" -">>> dir(sys) \n" +">>> dir(sys)\n" "['__breakpointhook__', '__displayhook__', '__doc__', '__excepthook__',\n" " '__interactivehook__', '__loader__', '__name__', '__package__', " "'__spec__',\n" @@ -660,7 +661,7 @@ msgstr "" ">>> import fibo, sys\n" ">>> dir(fibo)\n" "['__name__', 'fib', 'fib2']\n" -">>> dir(sys) \n" +">>> dir(sys)\n" "['__breakpointhook__', '__displayhook__', '__doc__', '__excepthook__',\n" " '__interactivehook__', '__loader__', '__name__', '__package__', " "'__spec__',\n" @@ -717,8 +718,8 @@ msgstr "請注意,它列出所有類型的名稱:變數、模組、函式等 #: ../../tutorial/modules.rst:350 msgid "" ":func:`dir` does not list the names of built-in functions and variables. If " -"you want a list of those, they are defined in the standard module :mod:" -"`builtins`::" +"you want a list of those, they are defined in the standard " +"module :mod:`builtins`::" msgstr "" ":func:`dir` 不會列出內建函式和變數的名稱。如果你想要列出它們,它們被定義在標" "準模組 :mod:`builtins` 內: ::" @@ -726,7 +727,7 @@ msgstr "" #: ../../tutorial/modules.rst:354 msgid "" ">>> import builtins\n" -">>> dir(builtins) \n" +">>> dir(builtins)\n" "['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException',\n" " 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning',\n" " 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError',\n" @@ -759,7 +760,7 @@ msgid "" " 'zip']" msgstr "" ">>> import builtins\n" -">>> dir(builtins) \n" +">>> dir(builtins)\n" "['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException',\n" " 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning',\n" " 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError',\n" @@ -814,22 +815,23 @@ msgstr "" msgid "" "Suppose you want to design a collection of modules (a \"package\") for the " "uniform handling of sound files and sound data. There are many different " -"sound file formats (usually recognized by their extension, for example: :" -"file:`.wav`, :file:`.aiff`, :file:`.au`), so you may need to create and " -"maintain a growing collection of modules for the conversion between the " -"various file formats. There are also many different operations you might " -"want to perform on sound data (such as mixing, adding echo, applying an " -"equalizer function, creating an artificial stereo effect), so in addition " -"you will be writing a never-ending stream of modules to perform these " -"operations. Here's a possible structure for your package (expressed in " -"terms of a hierarchical filesystem):" +"sound file formats (usually recognized by their extension, for " +"example: :file:`.wav`, :file:`.aiff`, :file:`.au`), so you may need to " +"create and maintain a growing collection of modules for the conversion " +"between the various file formats. There are also many different operations " +"you might want to perform on sound data (such as mixing, adding echo, " +"applying an equalizer function, creating an artificial stereo effect), so in " +"addition you will be writing a never-ending stream of modules to perform " +"these operations. Here's a possible structure for your package (expressed " +"in terms of a hierarchical filesystem):" msgstr "" "假設你想設計一個能統一處理音訊檔案及音訊數據的模組集(「套件」)。因為音訊檔" -"案有很多的不同的格式(通常以它們的副檔名來辨識,例如::file:`.wav`、:file:`." -"aiff`、:file:`.au`\\ ),因此,為了不同檔案格式之間的轉換,你會需要建立和維護" -"一個不斷增長的模組集合。為了要達成對音訊數據的許多不同作業(例如,音訊混合、" -"增加回聲、套用等化器功能、創造人工立體音效),你將編寫一系列無止盡的模組來執" -"行這些作業。以下是你的套件可能的架構(以階層式檔案系統的方式表示):" +"案有很多的不同的格式(通常以它們的副檔名來辨識,例" +"如::file:`.wav`、:file:`.aiff`、:file:`.au`\\ ),因此,為了不同檔案格式之間" +"的轉換,你會需要建立和維護一個不斷增長的模組集合。為了要達成對音訊數據的許多" +"不同作業(例如,音訊混合、增加回聲、套用等化器功能、創造人工立體音效),你將" +"編寫一系列無止盡的模組來執行這些作業。以下是你的套件可能的架構(以階層式檔案" +"系統的方式表示):" #: ../../tutorial/modules.rst:410 msgid "" @@ -860,8 +862,8 @@ msgstr "" #: ../../tutorial/modules.rst:436 msgid "" -"When importing the package, Python searches through the directories on ``sys." -"path`` looking for the package subdirectory." +"When importing the package, Python searches through the directories on " +"``sys.path`` looking for the package subdirectory." msgstr "Import 套件時,Python 會搜尋 ``sys.path`` 裡的目錄,尋找套件的子目錄。" #: ../../tutorial/modules.rst:439 @@ -874,11 +876,11 @@ msgid "" "can just be an empty file, but it can also execute initialization code for " "the package or set the ``__all__`` variable, described later." msgstr "" -"目錄中必須含有 :file:`__init__.py` 檔案,才會被 Pyhon 當成套件(除非有使用 :" -"term:`namespace package`,為一個相對進階的功能);這樣可以避免一些以常用名稱" -"命名(例如 ``string``\\ )的目錄,無意中隱藏了較晚出現在模組搜尋路徑中的有效" -"模組。在最簡單的情況,:file:`__init__.py` 可以只是一個空白檔案;但它也可以執" -"行套件的初始化程式碼,或設置 ``__all__`` 變數,之後會詳述。" +"目錄中必須含有 :file:`__init__.py` 檔案,才會被 Pyhon 當成套件(除非有使" +"用 :term:`namespace package`,為一個相對進階的功能);這樣可以避免一些以常用" +"名稱命名(例如 ``string``\\ )的目錄,無意中隱藏了較晚出現在模組搜尋路徑中的" +"有效模組。在最簡單的情況,:file:`__init__.py` 可以只是一個空白檔案;但它也可" +"以執行套件的初始化程式碼,或設置 ``__all__`` 變數,之後會詳述。" #: ../../tutorial/modules.rst:447 msgid "" @@ -933,8 +935,8 @@ msgstr "from sound.effects.echo import echofilter" #: ../../tutorial/modules.rst:470 msgid "" -"Again, this loads the submodule :mod:`!echo`, but this makes its function :" -"func:`!echofilter` directly available::" +"Again, this loads the submodule :mod:`!echo`, but this makes its " +"function :func:`!echofilter` directly available::" msgstr "" "同樣地,這樣也會載入子模組 :mod:`!echo`,但它的函式 :func:`!echofilter` 就可" "以直接使用: ::" @@ -949,8 +951,8 @@ msgid "" "submodule (or subpackage) of the package, or some other name defined in the " "package, like a function, class or variable. The ``import`` statement first " "tests whether the item is defined in the package; if not, it assumes it is a " -"module and attempts to load it. If it fails to find it, an :exc:" -"`ImportError` exception is raised." +"module and attempts to load it. If it fails to find it, " +"an :exc:`ImportError` exception is raised." msgstr "" "請注意,使用 ``from package import item`` 時,item 可以是套件的子模組(或子套" "件),也可以是套件中被定義的名稱,像是函式、class (類別)或變數。``import`` " @@ -1001,8 +1003,8 @@ msgstr "" "慣例:如果套件的 :file:`__init__.py` 程式碼有定義一個名為 ``__all__`` 的 " "list,若遇到 ``from package import *`` 的時候,它就會是要被 import 的模組名" "稱。發布套件的新版本時,套件作者可自行決定是否更新此 list。如果套件作者認為沒" -"有人會從他的套件中 import \\*,他也可能會決定不支援這個 list。舉例來說,:" -"file:`sound/effects/__init__.py` 檔案可包含以下程式碼: ::" +"有人會從他的套件中 import \\*,他也可能會決定不支援這個 list。舉例來" +"說,:file:`sound/effects/__init__.py` 檔案可包含以下程式碼: ::" #: ../../tutorial/modules.rst:511 msgid "__all__ = [\"echo\", \"surround\", \"reverse\"]" @@ -1025,8 +1027,8 @@ msgid "" "submodule, because it is shadowed by the locally defined ``reverse`` " "function::" msgstr "" -"請注意,子模組可能會被區域定義 (locally defined) 的名稱遮蔽。例如,如果你在 :" -"file:`sound/effects/__init__.py` 檔案中新增了一個 ``reverse`` 函式,則 " +"請注意,子模組可能會被區域定義 (locally defined) 的名稱遮蔽。例如,如果你" +"在 :file:`sound/effects/__init__.py` 檔案中新增了一個 ``reverse`` 函式,則 " "``from sound.effects import *`` 只會引入兩個子模組 ``echo`` 和 ``surround``," "但\\ *不是* ``reverse`` 子模組,因為它被區域定義的 ``reverse`` 函式遮蔽" "了: ::" @@ -1047,9 +1049,9 @@ msgstr "" msgid "" "If ``__all__`` is not defined, the statement ``from sound.effects import *`` " "does *not* import all submodules from the package :mod:`!sound.effects` into " -"the current namespace; it only ensures that the package :mod:`!sound." -"effects` has been imported (possibly running any initialization code in :" -"file:`__init__.py`) and then imports whatever names are defined in the " +"the current namespace; it only ensures that the package :mod:`!" +"sound.effects` has been imported (possibly running any initialization code " +"in :file:`__init__.py`) and then imports whatever names are defined in the " "package. This includes any names defined (and submodules explicitly loaded) " "by :file:`__init__.py`. It also includes any submodules of the package that " "were explicitly loaded by previous :keyword:`import` statements. Consider " @@ -1058,9 +1060,9 @@ msgstr "" "如果 ``__all__`` 沒有被定義,``from sound.effects import *`` 陳述式\\ *並不會" "*\\ 把 :mod:`!sound.effects` 套件中所有子模組都 import 到目前的命名空間;它只" "保證 :mod:`!sound.effects` 套件有被 import(可能會運行 :file:`__init__.py` 中" -"的初始化程式碼),然後 import 套件中被定義的全部名稱。這包含 :file:`__init__." -"py` 定義(以及被明確載入的子模組)的任何名稱。它也包括任何之前被 :keyword:" -"`import` 陳述式明確載入的套件子模組。請看以下程式碼: ::" +"的初始化程式碼),然後 import 套件中被定義的全部名稱。這包" +"含 :file:`__init__.py` 定義(以及被明確載入的子模組)的任何名稱。它也包括任何" +"之前被 :keyword:`import` 陳述式明確載入的套件子模組。請看以下程式碼: ::" #: ../../tutorial/modules.rst:541 msgid "" @@ -1075,9 +1077,9 @@ msgstr "" #: ../../tutorial/modules.rst:545 msgid "" "In this example, the :mod:`!echo` and :mod:`!surround` modules are imported " -"in the current namespace because they are defined in the :mod:`!sound." -"effects` package when the ``from...import`` statement is executed. (This " -"also works when ``__all__`` is defined.)" +"in the current namespace because they are defined in the :mod:`!" +"sound.effects` package when the ``from...import`` statement is executed. " +"(This also works when ``__all__`` is defined.)" msgstr "" "此例中,當 ``from...import`` 陳述式被執行時,:mod:`!echo` 和 :mod:`!" "surround` 模組被 import 進目前的命名空間,因為它們是在 :mod:`!sound.effects` " @@ -1110,21 +1112,21 @@ msgstr "套件內引用" msgid "" "When packages are structured into subpackages (as with the :mod:`!sound` " "package in the example), you can use absolute imports to refer to submodules " -"of siblings packages. For example, if the module :mod:`!sound.filters." -"vocoder` needs to use the :mod:`!echo` module in the :mod:`!sound.effects` " -"package, it can use ``from sound.effects import echo``." +"of siblings packages. For example, if the module :mod:`!" +"sound.filters.vocoder` needs to use the :mod:`!echo` module in the :mod:`!" +"sound.effects` package, it can use ``from sound.effects import echo``." msgstr "" "當套件的結構為多個子套件的組合時(如同範例中的 :mod:`!sound` 套件),可以使用" -"「絕對 (absolute) import」,引用同層套件中的子模組。例如,要在 :mod:`!sound." -"filters.vocoder` 模組中使用 :mod:`!sound.effects` 中的 :mod:`!echo` 模組時," -"可以用 ``from sound.effects import echo``。" +"「絕對 (absolute) import」,引用同層套件中的子模組。例如,要在 :mod:`!" +"sound.filters.vocoder` 模組中使用 :mod:`!sound.effects` 中的 :mod:`!echo` 模" +"組時,可以用 ``from sound.effects import echo``。" #: ../../tutorial/modules.rst:571 msgid "" "You can also write relative imports, with the ``from module import name`` " "form of import statement. These imports use leading dots to indicate the " -"current and parent packages involved in the relative import. From the :mod:" -"`!surround` module for example, you might use::" +"current and parent packages involved in the relative import. From " +"the :mod:`!surround` module for example, you might use::" msgstr "" "你也可以用 ``from module import name`` 的 import 陳述式,編寫「相對 " "(relative) import」。這些 import 使用前導句號指示相對 import 中的目前套件和母" @@ -1163,10 +1165,10 @@ msgid "" "that file is executed. This variable can be modified; doing so affects " "future searches for modules and subpackages contained in the package." msgstr "" -"套件也支援一個特殊屬性 :attr:`~module.__path__`。它在初始化時是一個字串的\\ :" -"term:`序列 <sequence>`\\ 的 :file:`__init__.py` 檔案所在的目錄名稱,初始化時" -"機是在這個檔案的程式碼被執行之前。這個變數可以被修改,但這樣做會影響將來對套" -"件內的模組和子套件的搜尋。" +"套件也支援一個特殊屬性 :attr:`~module.__path__`。它在初始化時是一個字串的" +"\\ :term:`序列 <sequence>`\\ 的 :file:`__init__.py` 檔案所在的目錄名稱,初始" +"化時機是在這個檔案的程式碼被執行之前。這個變數可以被修改,但這樣做會影響將來" +"對套件內的模組和子套件的搜尋。" #: ../../tutorial/modules.rst:595 msgid "" diff --git a/tutorial/stdlib.po b/tutorial/stdlib.po index ed03a48a61..854ddf9677 100644 --- a/tutorial/stdlib.po +++ b/tutorial/stdlib.po @@ -1,5 +1,4 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -49,6 +48,12 @@ msgid "" ">>> os.system('mkdir today') # Run the command mkdir in the system shell\n" "0" msgstr "" +">>> import os\n" +">>> os.getcwd() # 回傳目前的工作目錄\n" +"'C:\\\\Python313'\n" +">>> os.chdir('/server/accesslogs') # 改變目前的工作目錄\n" +">>> os.system('mkdir today') # 在系統 shell 中執行 mkdir 指令\n" +"0" #: ../../tutorial/stdlib.rst:23 msgid "" @@ -133,8 +138,8 @@ msgid "" "arguments are stored in the :mod:`sys` module's *argv* attribute as a list. " "For instance, let's take the following :file:`demo.py` file::" msgstr "" -"通用工具腳本常需要處理命令列引數。這些引數會以 list(串列)形式存放在 :mod:" -"`sys` 模組的 *argv* 屬性中。例如以下 :file:`demo.py` 檔案: ::" +"通用工具腳本常需要處理命令列引數。這些引數會以 list(串列)形式存放" +"在 :mod:`sys` 模組的 *argv* 屬性中。例如以下 :file:`demo.py` 檔案: ::" #: ../../tutorial/stdlib.rst:70 msgid "" @@ -189,9 +194,9 @@ msgstr "" #: ../../tutorial/stdlib.rst:93 msgid "" -"When run at the command line with ``python top.py --lines=5 alpha.txt beta." -"txt``, the script sets ``args.lines`` to ``5`` and ``args.filenames`` to " -"``['alpha.txt', 'beta.txt']``." +"When run at the command line with ``python top.py --lines=5 alpha.txt " +"beta.txt``, the script sets ``args.lines`` to ``5`` and ``args.filenames`` " +"to ``['alpha.txt', 'beta.txt']``." msgstr "" "當 ``python top.py --lines=5 alpha.txt beta.txt`` 在命令列執行時,該腳本會將 " "``args.lines`` 設為 ``5``,並將 ``args.filenames`` 設為 ``['alpha.txt', " @@ -215,6 +220,8 @@ msgid "" ">>> sys.stderr.write('Warning, log file not found starting a new one\\n')\n" "Warning, log file not found starting a new one" msgstr "" +">>> sys.stderr.write('Warning, log file not found starting a new one\\n')\n" +"Warning, log file not found starting a new one" #: ../../tutorial/stdlib.rst:110 msgid "The most direct way to terminate a script is to use ``sys.exit()``." @@ -303,6 +310,15 @@ msgid "" ">>> random.randrange(6) # random integer chosen from range(6)\n" "4" msgstr "" +">>> import random\n" +">>> random.choice(['apple', 'pear', 'banana'])\n" +"'apple'\n" +">>> random.sample(range(100), 10) # 不重複抽樣\n" +"[30, 83, 16, 4, 8, 81, 41, 50, 18, 33]\n" +">>> random.random() # 區間 [0.0, 1.0) 中的隨機浮點數\n" +"0.17970987693706186\n" +">>> random.randrange(6) # 從 range(6) 中隨機選擇整數\n" +"4" #: ../../tutorial/stdlib.rst:161 msgid "" @@ -348,8 +364,9 @@ msgid "" "internet protocols. Two of the simplest are :mod:`urllib.request` for " "retrieving data from URLs and :mod:`smtplib` for sending mail::" msgstr "" -"Python 中有許多存取網路以及處理網路協定。最簡單的兩個例子包括 :mod:`urllib." -"request` 模組可以從網址抓取資料以及 :mod:`smtplib` 可以用來寄郵件: ::" +"Python 中有許多存取網路以及處理網路協定。最簡單的兩個例子包" +"括 :mod:`urllib.request` 模組可以從網址抓取資料以及 :mod:`smtplib` 可以用來寄" +"郵件: ::" #: ../../tutorial/stdlib.rst:185 msgid "" @@ -373,6 +390,25 @@ msgid "" "... \"\"\")\n" ">>> server.quit()" msgstr "" +">>> from urllib.request import urlopen\n" +">>> with urlopen('http://worldtimeapi.org/api/timezone/etc/UTC.txt') as " +"response:\n" +"... for line in response:\n" +"... line = line.decode() # 將 bytes 轉換為 str\n" +"... if line.startswith('datetime'):\n" +"... print(line.rstrip()) # 移除最後面的換行符號\n" +"...\n" +"datetime: 2022-01-01T01:36:47.689215+00:00\n" +"\n" +">>> import smtplib\n" +">>> server = smtplib.SMTP('localhost')\n" +">>> server.sendmail('soothsayer@example.org', 'jcaesar@example.org',\n" +"... \"\"\"To: jcaesar@example.org\n" +"... From: soothsayer@example.org\n" +"...\n" +"... Beware the Ides of March.\n" +"... \"\"\")\n" +">>> server.quit()" #: ../../tutorial/stdlib.rst:204 msgid "(Note that the second example needs a mailserver running on localhost.)" @@ -392,9 +428,7 @@ msgid "" msgstr "" ":mod:`datetime` 模組提供許多 class 可以操作日期以及時間,從簡單從複雜都有。模" "組支援日期與時間的運算,而實作的重點是有效率的成員擷取以達到輸出格式化以及操" -"作。模組也提供支援時區換算的類別。\n" -"\n" -"::" +"作。模組也提供支援時區換算的類別。 ::" #: ../../tutorial/stdlib.rst:218 msgid "" @@ -412,6 +446,19 @@ msgid "" ">>> age.days\n" "14368" msgstr "" +">>> # 能夠輕易建立與格式化\n" +">>> from datetime import date\n" +">>> now = date.today()\n" +">>> now\n" +"datetime.date(2003, 12, 2)\n" +">>> now.strftime(\"%m-%d-%y. %d %b %Y is a %A on the %d day of %B.\")\n" +"'12-02-03. 02 Dec 2003 is a Tuesday on the 02 day of December.'\n" +"\n" +">>> # 支援運算\n" +">>> birthday = date(1964, 7, 31)\n" +">>> age = now - birthday\n" +">>> age.days\n" +"14368" #: ../../tutorial/stdlib.rst:236 msgid "Data Compression" @@ -420,13 +467,13 @@ msgstr "資料壓縮" #: ../../tutorial/stdlib.rst:238 msgid "" "Common data archiving and compression formats are directly supported by " -"modules including: :mod:`zlib`, :mod:`gzip`, :mod:`bz2`, :mod:`lzma`, :mod:" -"`zipfile` and :mod:`tarfile`. ::" +"modules " +"including: :mod:`zlib`, :mod:`gzip`, :mod:`bz2`, :mod:`lzma`, :mod:`zipfile` " +"and :mod:`tarfile`. ::" msgstr "" -"常見的解壓縮以及壓縮格式都有直接支援的模組。包括::mod:`zlib`、:mod:`gzip`、:" -"mod:`bz2`、:mod:`lzma`、:mod:`zipfile` 以及 :mod:`tarfile`。\n" -"\n" -"::" +"常見的解壓縮以及壓縮格式都有直接支援的模組。包" +"括::mod:`zlib`、:mod:`gzip`、:mod:`bz2`、:mod:`lzma`、:mod:`zipfile` 以" +"及 :mod:`tarfile`。 ::" #: ../../tutorial/stdlib.rst:242 msgid "" @@ -442,6 +489,17 @@ msgid "" ">>> zlib.crc32(s)\n" "226805979" msgstr "" +">>> import zlib\n" +">>> s = b'witch which has which witches wrist watch'\n" +">>> len(s)\n" +"41\n" +">>> t = zlib.compress(s)\n" +">>> len(t)\n" +"37\n" +">>> zlib.decompress(t)\n" +"b'witch which has which witches wrist watch'\n" +">>> zlib.crc32(s)\n" +"226805979" #: ../../tutorial/stdlib.rst:258 msgid "Performance Measurement" @@ -459,11 +517,12 @@ msgstr "" #: ../../tutorial/stdlib.rst:264 msgid "" "For example, it may be tempting to use the tuple packing and unpacking " -"feature instead of the traditional approach to swapping arguments. The :mod:" -"`timeit` module quickly demonstrates a modest performance advantage::" +"feature instead of the traditional approach to swapping arguments. " +"The :mod:`timeit` module quickly demonstrates a modest performance " +"advantage::" msgstr "" -"舉例來說,有人可能會試著用 tuple 的打包機制來交換引數代替傳統的方式。:mod:" -"`timeit` 模組可以迅速地展示效能的進步: ::" +"舉例來說,有人可能會試著用 tuple 的打包機制來交換引數代替傳統的方" +"式。:mod:`timeit` 模組可以迅速地展示效能的進步: ::" #: ../../tutorial/stdlib.rst:268 msgid "" @@ -485,9 +544,9 @@ msgid "" "and :mod:`pstats` modules provide tools for identifying time critical " "sections in larger blocks of code." msgstr "" -"相對於 :mod:`timeit` 模組提供這麼細的粒度,:mod:`profile` 模組以及 :mod:" -"`pstats` 模組則提供了一些在大型的程式碼識別時間使用上關鍵的區塊 (time " -"critical section) 的工具。" +"相對於 :mod:`timeit` 模組提供這麼細的粒度,:mod:`profile` 模組以" +"及 :mod:`pstats` 模組則提供了一些在大型的程式碼識別時間使用上關鍵的區塊 " +"(time critical section) 的工具。" #: ../../tutorial/stdlib.rst:282 msgid "Quality Control" @@ -529,6 +588,16 @@ msgid "" "import doctest\n" "doctest.testmod() # automatically validate the embedded tests" msgstr "" +"def average(values):\n" +" \"\"\"計算數字串列的算術平均數。\n" +"\n" +" >>> print(average([20, 30, 70]))\n" +" 40.0\n" +" \"\"\"\n" +" return sum(values) / len(values)\n" +"\n" +"import doctest\n" +"doctest.testmod() # 自動驗證內嵌的測試" #: ../../tutorial/stdlib.rst:306 msgid "" @@ -555,6 +624,19 @@ msgid "" "\n" "unittest.main() # Calling from the command line invokes all tests" msgstr "" +"import unittest\n" +"\n" +"class TestStatisticalFunctions(unittest.TestCase):\n" +"\n" +" def test_average(self):\n" +" self.assertEqual(average([20, 30, 70]), 40.0)\n" +" self.assertEqual(round(average([1, 5, 7]), 1), 4.3)\n" +" with self.assertRaises(ZeroDivisionError):\n" +" average([])\n" +" with self.assertRaises(TypeError):\n" +" average(20, 30, 70)\n" +"\n" +"unittest.main() # 從命令列呼叫會執行所有測試" #: ../../tutorial/stdlib.rst:328 msgid "Batteries Included" @@ -598,16 +680,16 @@ msgid "" "The :mod:`json` package provides robust support for parsing this popular " "data interchange format. The :mod:`csv` module supports direct reading and " "writing of files in Comma-Separated Value format, commonly supported by " -"databases and spreadsheets. XML processing is supported by the :mod:`xml." -"etree.ElementTree`, :mod:`xml.dom` and :mod:`xml.sax` packages. Together, " -"these modules and packages greatly simplify data interchange between Python " -"applications and other tools." +"databases and spreadsheets. XML processing is supported by " +"the :mod:`xml.etree.ElementTree`, :mod:`xml.dom` and :mod:`xml.sax` " +"packages. Together, these modules and packages greatly simplify data " +"interchange between Python applications and other tools." msgstr "" ":mod:`json` 套件對 JSON 資料交換格式的剖析,提供強大的支援。:mod:`csv` 模組則" -"提供直接讀寫 CSV(以逗號分隔值的檔案格式,通常資料庫和電子表格都有支援)。:" -"mod:`xml.etree.ElementTree`、:mod:`xml.dom` 與 :mod:`xml.sax` 套件則支援 XML " -"的處理。綜觀所有,這些模組和套件都簡化了 Python 應用程式與其他工具之間的資料" -"交換。" +"提供直接讀寫 CSV(以逗號分隔值的檔案格式,通常資料庫和電子表格都有支" +"援)。:mod:`xml.etree.ElementTree`、:mod:`xml.dom` 與 :mod:`xml.sax` 套件則支" +"援 XML 的處理。綜觀所有,這些模組和套件都簡化了 Python 應用程式與其他工具之間" +"的資料交換。" #: ../../tutorial/stdlib.rst:353 msgid "" @@ -620,8 +702,8 @@ msgstr "" #: ../../tutorial/stdlib.rst:357 msgid "" -"Internationalization is supported by a number of modules including :mod:" -"`gettext`, :mod:`locale`, and the :mod:`codecs` package." +"Internationalization is supported by a number of modules " +"including :mod:`gettext`, :mod:`locale`, and the :mod:`codecs` package." msgstr "" "有數種支援國際化的模組,包括 :mod:`gettext`、:mod:`locale` 和 :mod:`codecs` " "等套件。" diff --git a/tutorial/stdlib2.po b/tutorial/stdlib2.po index 1b2f36d17e..deded95c48 100644 --- a/tutorial/stdlib2.po +++ b/tutorial/stdlib2.po @@ -189,15 +189,15 @@ msgstr "" msgid "" "The :meth:`~string.Template.substitute` method raises a :exc:`KeyError` when " "a placeholder is not supplied in a dictionary or a keyword argument. For " -"mail-merge style applications, user supplied data may be incomplete and the :" -"meth:`~string.Template.safe_substitute` method may be more appropriate --- " -"it will leave placeholders unchanged if data is missing::" +"mail-merge style applications, user supplied data may be incomplete and " +"the :meth:`~string.Template.safe_substitute` method may be more appropriate " +"--- it will leave placeholders unchanged if data is missing::" msgstr "" -"如果在 dictionary 或關鍵字引數中未提供某個佔位符號的值,那麼 :meth:`~string." -"Template.substitute` method 將引發 :exc:`KeyError`。對於郵件合併 (mail-" -"merge) 類型的應用程式,使用者提供的資料有可能是不完整的,此時使用 :meth:" -"`~string.Template.safe_substitute` method 會更適當——如果資料有缺少,它會保持" -"佔位符號不變: ::" +"如果在 dictionary 或關鍵字引數中未提供某個佔位符號的值,那" +"麼 :meth:`~string.Template.substitute` method 將引發 :exc:`KeyError`。對於郵" +"件合併 (mail-merge) 類型的應用程式,使用者提供的資料有可能是不完整的,此時使" +"用 :meth:`~string.Template.safe_substitute` method 會更適當——如果資料有缺少," +"它會保持佔位符號不變: ::" #: ../../tutorial/stdlib2.rst:94 msgid "" @@ -285,20 +285,20 @@ msgstr "二進制資料記錄編排 (Binary Data Record Layouts)" #: ../../tutorial/stdlib2.rst:136 msgid "" -"The :mod:`struct` module provides :func:`~struct.pack` and :func:`~struct." -"unpack` functions for working with variable length binary record formats. " -"The following example shows how to loop through header information in a ZIP " -"file without using the :mod:`zipfile` module. Pack codes ``\"H\"`` and " -"``\"I\"`` represent two and four byte unsigned numbers respectively. The " -"``\"<\"`` indicates that they are standard size and in little-endian byte " -"order::" +"The :mod:`struct` module provides :func:`~struct.pack` " +"and :func:`~struct.unpack` functions for working with variable length binary " +"record formats. The following example shows how to loop through header " +"information in a ZIP file without using the :mod:`zipfile` module. Pack " +"codes ``\"H\"`` and ``\"I\"`` represent two and four byte unsigned numbers " +"respectively. The ``\"<\"`` indicates that they are standard size and in " +"little-endian byte order::" msgstr "" ":mod:`struct` 模組提供了 :func:`~struct.pack` 和 :func:`~struct.unpack` 函" -"式,用於處理可變動長度的二進制記錄格式。以下範例說明,如何在不使用 :mod:" -"`zipfile` 模組的情況下,使用迴圈瀏覽一個 ZIP 檔案中的標頭資訊 (header " -"information)。壓縮程式碼 ``\"H\"`` 和 ``\"I\"`` 分別代表兩個和四個位元組的無" -"符號數 (unsigned number)。``\"<\"`` 表示它們是標準大小,並使用小端 (little-" -"endian) 位元組順序: ::" +"式,用於處理可變動長度的二進制記錄格式。以下範例說明,如何在不使" +"用 :mod:`zipfile` 模組的情況下,使用迴圈瀏覽一個 ZIP 檔案中的標頭資訊 " +"(header information)。壓縮程式碼 ``\"H\"`` 和 ``\"I\"`` 分別代表兩個和四個位" +"元組的無符號數 (unsigned number)。``\"<\"`` 表示它們是標準大小,並使用小端 " +"(little-endian) 位元組順序: ::" #: ../../tutorial/stdlib2.rst:144 msgid "" @@ -413,9 +413,10 @@ msgid "" "and more reliable." msgstr "" "儘管這些工具很強大,但很小的設計錯誤也可能導致一些難以重現的問題。所以,任務" -"協調的首選方法是,把所有對資源的存取集中到單一的執行緒中,然後使用 :mod:" -"`queue` 模組向該執行緒饋送來自其他執行緒的請求。應用程式若使用 :class:" -"`~queue.Queue` 物件進行執行緒間的通信和協調,會更易於設計、更易讀、更可靠。" +"協調的首選方法是,把所有對資源的存取集中到單一的執行緒中,然後使" +"用 :mod:`queue` 模組向該執行緒饋送來自其他執行緒的請求。應用程式若使" +"用 :class:`~queue.Queue` 物件進行執行緒間的通信和協調,會更易於設計、更易讀、" +"更可靠。" #: ../../tutorial/stdlib2.rst:214 msgid "Logging" @@ -424,8 +425,8 @@ msgstr "日誌記錄 (Logging)" #: ../../tutorial/stdlib2.rst:216 msgid "" "The :mod:`logging` module offers a full featured and flexible logging " -"system. At its simplest, log messages are sent to a file or to ``sys." -"stderr``::" +"system. At its simplest, log messages are sent to a file or to " +"``sys.stderr``::" msgstr "" ":mod:`logging` 模組提供功能齊全且富彈性的日誌記錄系統。在最簡單的情況下,日誌" "訊息會被發送到檔案或 ``sys.stderr``: ::" @@ -465,15 +466,16 @@ msgid "" "By default, informational and debugging messages are suppressed and the " "output is sent to standard error. Other output options include routing " "messages through email, datagrams, sockets, or to an HTTP Server. New " -"filters can select different routing based on message priority: :const:" -"`~logging.DEBUG`, :const:`~logging.INFO`, :const:`~logging.WARNING`, :const:" -"`~logging.ERROR`, and :const:`~logging.CRITICAL`." +"filters can select different routing based on message " +"priority: :const:`~logging.DEBUG`, :const:`~logging.INFO`, :const:`~logging.WARNING`, :const:`~logging.ERROR`, " +"and :const:`~logging.CRITICAL`." msgstr "" "在預設情況,資訊和除錯訊息不會被顯示,其輸出會被發送到標準錯誤 (standard " "error)。其他輸出選項包括,將訊息轉發到電子郵件、資料報 (datagram)、網路插座 " "(socket) 或 HTTP 伺服器。新的過濾器可以根據訊息的優先順序,選擇不同的路由 " -"(routing) 方式::const:`~logging.DEBUG`、:const:`~logging.INFO`、:const:" -"`~logging.WARNING`、:const:`~logging.ERROR` 及 :const:`~logging.CRITICAL`。" +"(routing) 方" +"式::const:`~logging.DEBUG`、:const:`~logging.INFO`、:const:`~logging.WARNING`、:const:`~logging.ERROR` " +"及 :const:`~logging.CRITICAL`。" #: ../../tutorial/stdlib2.rst:241 msgid "" @@ -716,7 +718,7 @@ msgid "" "results in decimal floating point and binary floating point. The difference " "becomes significant if the results are rounded to the nearest cent::" msgstr "" -"例如,要計算 70 美分的手機充電加上 5% 稅金的總價,使用十進制浮點數和二進制浮" +"例如,要計算 70 美分的手機充電加上 5% 稅金的總價,使用十進制浮點數和二進制浮" "點數,會算出不同的答案。如果把計算結果四捨五入到最接近的美分,兩者的差異會更" "顯著: ::" diff --git a/using/android.po b/using/android.po index 24f937b566..868d2e3659 100644 --- a/using/android.po +++ b/using/android.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"POT-Creation-Date: 2025-04-02 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -60,51 +60,51 @@ msgstr "將 Python 加入 Android 應用程式" #: ../../using/android.rst:30 msgid "" -"These instructions are only needed if you're planning to compile Python for " -"Android yourself. Most users should *not* need to do this. Instead, use one " -"of the following tools, which will provide a much easier experience:" +"Most app developers should use one of the following tools, which will " +"provide a much easier experience:" msgstr "" -#: ../../using/android.rst:34 +#: ../../using/android.rst:33 msgid "" "`Briefcase <https://briefcase.readthedocs.io>`__, from the BeeWare project" msgstr "`Briefcase <https://briefcase.readthedocs.io>`__,由 BeeWare 專案提供" -#: ../../using/android.rst:35 +#: ../../using/android.rst:34 msgid "`Buildozer <https://buildozer.readthedocs.io>`__, from the Kivy project" msgstr "`Buildozer <https://buildozer.readthedocs.io>`__,由 Kivy 專案提供" -#: ../../using/android.rst:36 +#: ../../using/android.rst:35 msgid "`Chaquopy <https://chaquo.com/chaquopy>`__" msgstr "`Chaquopy <https://chaquo.com/chaquopy>`__" -#: ../../using/android.rst:37 +#: ../../using/android.rst:36 msgid "" "`pyqtdeploy <https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/>`__" msgstr "" "`pyqtdeploy <https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/>`__" -#: ../../using/android.rst:38 +#: ../../using/android.rst:37 msgid "`Termux <https://termux.dev/en/>`__" msgstr "`Termux <https://termux.dev/en/>`__" -#: ../../using/android.rst:40 +#: ../../using/android.rst:39 msgid "" "If you're sure you want to do all of this manually, read on. You can use " "the :source:`testbed app <Android/testbed>` as a guide; each step below " "contains a link to the relevant file." msgstr "" -#: ../../using/android.rst:44 +#: ../../using/android.rst:43 msgid "" -"Build Python by following the instructions in :source:`Android/README.md`." +"Build Python by following the instructions in :source:`Android/README.md`. " +"This will create the directory ``cross-build/HOST/prefix``." msgstr "" #: ../../using/android.rst:46 msgid "" "Add code to your :source:`build.gradle <Android/testbed/app/build.gradle." "kts>` file to copy the following items into your project. All except your " -"own Python code can be copied from ``cross-build/HOST/prefix/lib``:" +"own Python code can be copied from ``prefix/lib``:" msgstr "" #: ../../using/android.rst:50 diff --git a/using/cmdline.po b/using/cmdline.po index ee77384f74..670d24139c 100644 --- a/using/cmdline.po +++ b/using/cmdline.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-24 00:14+0000\n" +"POT-Creation-Date: 2025-04-09 00:15+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,8 +29,8 @@ msgstr "" #: ../../using/cmdline.rst:16 msgid "" -"Other implementations' command line schemes may differ. See :ref:" -"`implementations` for further resources." +"Other implementations' command line schemes may differ. " +"See :ref:`implementations` for further resources." msgstr "" #: ../../using/cmdline.rst:23 @@ -124,9 +124,9 @@ msgstr "" #: ../../using/cmdline.rst:69 msgid "" "If this option is given, the first element of :data:`sys.argv` will be ``\"-" -"c\"`` and the current directory will be added to the start of :data:`sys." -"path` (allowing modules in that directory to be imported as top level " -"modules)." +"c\"`` and the current directory will be added to the start " +"of :data:`sys.path` (allowing modules in that directory to be imported as " +"top level modules)." msgstr "" #: ../../using/cmdline.rst:74 @@ -134,8 +134,8 @@ msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_command`` with " "argument ``command``." msgstr "" -"引發一個附帶引數 ``command`` 的\\ :ref:`稽核事件 <auditing>` ``cpython." -"run_command``。" +"引發一個附帶引數 ``command`` 的\\ :ref:`稽核事件 <auditing>` " +"``cpython.run_command``。" #: ../../using/cmdline.rst:78 msgid "" @@ -178,9 +178,10 @@ msgstr "" #: ../../using/cmdline.rst:105 msgid "" -":option:`-I` option can be used to run the script in isolated mode where :" -"data:`sys.path` contains neither the current directory nor the user's site-" -"packages directory. All ``PYTHON*`` environment variables are ignored, too." +":option:`-I` option can be used to run the script in isolated mode " +"where :data:`sys.path` contains neither the current directory nor the user's " +"site-packages directory. All ``PYTHON*`` environment variables are ignored, " +"too." msgstr "" #: ../../using/cmdline.rst:110 @@ -200,8 +201,8 @@ msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_module`` with " "argument ``module-name``." msgstr "" -"引發一個附帶引數 ``module-name`` 的\\ :ref:`稽核事件 <auditing>` ``cpython." -"run_module``。" +"引發一個附帶引數 ``module-name`` 的\\ :ref:`稽核事件 <auditing>` " +"``cpython.run_module``。" #: ../../using/cmdline.rst:119 msgid ":func:`runpy.run_module`" @@ -232,11 +233,11 @@ msgstr "" #: ../../using/cmdline.rst:137 msgid "" "If this option is given, the first element of :data:`sys.argv` will be ``\"-" -"\"`` and the current directory will be added to the start of :data:`sys." -"path`." +"\"`` and the current directory will be added to the start " +"of :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:141 ../../using/cmdline.rst:790 +#: ../../using/cmdline.rst:141 ../../using/cmdline.rst:796 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_stdin`` with no " "arguments." @@ -273,9 +274,10 @@ msgstr "" #: ../../using/cmdline.rst:163 msgid "" -":option:`-I` option can be used to run the script in isolated mode where :" -"data:`sys.path` contains neither the script's directory nor the user's site-" -"packages directory. All ``PYTHON*`` environment variables are ignored, too." +":option:`-I` option can be used to run the script in isolated mode " +"where :data:`sys.path` contains neither the script's directory nor the " +"user's site-packages directory. All ``PYTHON*`` environment variables are " +"ignored, too." msgstr "" #: ../../using/cmdline.rst:168 @@ -283,8 +285,8 @@ msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_file`` with " "argument ``filename``." msgstr "" -"引發一個附帶引數 ``filename`` 的\\ :ref:`稽核事件 <auditing>` ``cpython." -"run_file``。" +"引發一個附帶引數 ``filename`` 的\\ :ref:`稽核事件 <auditing>` " +"``cpython.run_file``。" #: ../../using/cmdline.rst:171 msgid ":func:`runpy.run_path`" @@ -361,10 +363,11 @@ msgstr "" #: ../../using/cmdline.rst:246 msgid "" -"Issue a warning when converting :class:`bytes` or :class:`bytearray` to :" -"class:`str` without specifying encoding or comparing :class:`!bytes` or :" -"class:`!bytearray` with :class:`!str` or :class:`!bytes` with :class:`int`. " -"Issue an error when the option is given twice (:option:`!-bb`)." +"Issue a warning when converting :class:`bytes` or :class:`bytearray` " +"to :class:`str` without specifying encoding or comparing :class:`!bytes` " +"or :class:`!bytearray` with :class:`!str` or :class:`!bytes` " +"with :class:`int`. Issue an error when the option is given twice (:option:`!-" +"bb`)." msgstr "" #: ../../using/cmdline.rst:251 @@ -396,8 +399,8 @@ msgstr "" #: ../../using/cmdline.rst:276 msgid "" -"Turn on parser debugging output (for expert only). See also the :envvar:" -"`PYTHONDEBUG` environment variable." +"Turn on parser debugging output (for expert only). See also " +"the :envvar:`PYTHONDEBUG` environment variable." msgstr "" #: ../../using/cmdline.rst:279 @@ -408,8 +411,8 @@ msgstr "" #: ../../using/cmdline.rst:285 msgid "" -"Ignore all ``PYTHON*`` environment variables, e.g. :envvar:`PYTHONPATH` and :" -"envvar:`PYTHONHOME`, that might be set." +"Ignore all ``PYTHON*`` environment variables, e.g. :envvar:`PYTHONPATH` " +"and :envvar:`PYTHONHOME`, that might be set." msgstr "" #: ../../using/cmdline.rst:288 @@ -417,26 +420,46 @@ msgid "See also the :option:`-P` and :option:`-I` (isolated) options." msgstr "另請參閱 :option:`-P` 和 :option:`-I` (isolated) 選項。" #: ../../using/cmdline.rst:293 +msgid "Enter interactive mode after execution." +msgstr "" + +#: ../../using/cmdline.rst:295 msgid "" -"When a script is passed as first argument or the :option:`-c` option is " -"used, enter interactive mode after executing the script or the command, even " -"when :data:`sys.stdin` does not appear to be a terminal. The :envvar:" -"`PYTHONSTARTUP` file is not read." +"Using the :option:`-i` option will enter interactive mode in any of the " +"following circumstances\\:" +msgstr "" + +#: ../../using/cmdline.rst:297 +msgid "When a script is passed as first argument" msgstr "" #: ../../using/cmdline.rst:298 +msgid "When the :option:`-c` option is used" +msgstr "" + +#: ../../using/cmdline.rst:299 +msgid "When the :option:`-m` option is used" +msgstr "" + +#: ../../using/cmdline.rst:301 +msgid "" +"Interactive mode will start even when :data:`sys.stdin` does not appear to " +"be a terminal. The :envvar:`PYTHONSTARTUP` file is not read." +msgstr "" + +#: ../../using/cmdline.rst:304 msgid "" "This can be useful to inspect global variables or a stack trace when a " "script raises an exception. See also :envvar:`PYTHONINSPECT`." msgstr "" -#: ../../using/cmdline.rst:304 +#: ../../using/cmdline.rst:310 msgid "" "Run Python in isolated mode. This also implies :option:`-E`, :option:`-P` " "and :option:`-s` options." msgstr "" -#: ../../using/cmdline.rst:307 +#: ../../using/cmdline.rst:313 msgid "" "In isolated mode :data:`sys.path` contains neither the script's directory " "nor the user's site-packages directory. All ``PYTHON*`` environment " @@ -444,66 +467,66 @@ msgid "" "the user from injecting malicious code." msgstr "" -#: ../../using/cmdline.rst:317 +#: ../../using/cmdline.rst:323 msgid "" -"Remove assert statements and any code conditional on the value of :const:" -"`__debug__`. Augment the filename for compiled (:term:`bytecode`) files by " -"adding ``.opt-1`` before the ``.pyc`` extension (see :pep:`488`). See also :" -"envvar:`PYTHONOPTIMIZE`." +"Remove assert statements and any code conditional on the value " +"of :const:`__debug__`. Augment the filename for compiled (:term:`bytecode`) " +"files by adding ``.opt-1`` before the ``.pyc`` extension (see :pep:`488`). " +"See also :envvar:`PYTHONOPTIMIZE`." msgstr "" -#: ../../using/cmdline.rst:322 ../../using/cmdline.rst:332 +#: ../../using/cmdline.rst:328 ../../using/cmdline.rst:338 msgid "Modify ``.pyc`` filenames according to :pep:`488`." msgstr "根據 :pep:`488` 修改 ``.pyc`` 檔案名稱。" -#: ../../using/cmdline.rst:328 +#: ../../using/cmdline.rst:334 msgid "" "Do :option:`-O` and also discard docstrings. Augment the filename for " "compiled (:term:`bytecode`) files by adding ``.opt-2`` before the ``.pyc`` " "extension (see :pep:`488`)." msgstr "" -#: ../../using/cmdline.rst:338 +#: ../../using/cmdline.rst:344 msgid "Don't prepend a potentially unsafe path to :data:`sys.path`:" msgstr "" -#: ../../using/cmdline.rst:340 +#: ../../using/cmdline.rst:346 msgid "" "``python -m module`` command line: Don't prepend the current working " "directory." msgstr "" -#: ../../using/cmdline.rst:342 +#: ../../using/cmdline.rst:348 msgid "" "``python script.py`` command line: Don't prepend the script's directory. If " "it's a symbolic link, resolve symbolic links." msgstr "" -#: ../../using/cmdline.rst:344 +#: ../../using/cmdline.rst:350 msgid "" "``python -c code`` and ``python`` (REPL) command lines: Don't prepend an " "empty string, which means the current working directory." msgstr "" -#: ../../using/cmdline.rst:347 +#: ../../using/cmdline.rst:353 msgid "" "See also the :envvar:`PYTHONSAFEPATH` environment variable, and :option:`-E` " "and :option:`-I` (isolated) options." msgstr "" -#: ../../using/cmdline.rst:355 +#: ../../using/cmdline.rst:361 msgid "" "Don't display the copyright and version messages even in interactive mode." msgstr "" -#: ../../using/cmdline.rst:362 +#: ../../using/cmdline.rst:368 msgid "" -"Turn on hash randomization. This option only has an effect if the :envvar:" -"`PYTHONHASHSEED` environment variable is set to ``0``, since hash " -"randomization is enabled by default." +"Turn on hash randomization. This option only has an effect if " +"the :envvar:`PYTHONHASHSEED` environment variable is set to ``0``, since " +"hash randomization is enabled by default." msgstr "" -#: ../../using/cmdline.rst:366 +#: ../../using/cmdline.rst:372 msgid "" "On previous versions of Python, this option turns on hash randomization, so " "that the :meth:`~object.__hash__` values of str and bytes objects are " @@ -512,7 +535,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: ../../using/cmdline.rst:372 +#: ../../using/cmdline.rst:378 msgid "" "Hash randomization is intended to provide protection against a denial-of-" "service caused by carefully chosen inputs that exploit the worst case " @@ -520,85 +543,85 @@ msgid "" "http://ocert.org/advisories/ocert-2011-003.html%20for%20details." msgstr "" -#: ../../using/cmdline.rst:377 +#: ../../using/cmdline.rst:383 msgid "" ":envvar:`PYTHONHASHSEED` allows you to set a fixed value for the hash seed " "secret." msgstr "" -#: ../../using/cmdline.rst:382 +#: ../../using/cmdline.rst:388 msgid "The option is no longer ignored." msgstr "" -#: ../../using/cmdline.rst:388 +#: ../../using/cmdline.rst:394 msgid "" -"Don't add the :data:`user site-packages directory <site.USER_SITE>` to :data:" -"`sys.path`." +"Don't add the :data:`user site-packages directory <site.USER_SITE>` " +"to :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:391 +#: ../../using/cmdline.rst:397 msgid "See also :envvar:`PYTHONNOUSERSITE`." msgstr "另請參閱 :envvar:`PYTHONNOUSERSITE`。" -#: ../../using/cmdline.rst:395 ../../using/cmdline.rst:887 -#: ../../using/cmdline.rst:899 +#: ../../using/cmdline.rst:401 ../../using/cmdline.rst:893 +#: ../../using/cmdline.rst:905 msgid ":pep:`370` -- Per user site-packages directory" msgstr "" -#: ../../using/cmdline.rst:400 +#: ../../using/cmdline.rst:406 msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " -"manipulations if :mod:`site` is explicitly imported later (call :func:`site." -"main` if you want them to be triggered)." +"manipulations if :mod:`site` is explicitly imported later " +"(call :func:`site.main` if you want them to be triggered)." msgstr "" -#: ../../using/cmdline.rst:408 +#: ../../using/cmdline.rst:414 msgid "" "Force the stdout and stderr streams to be unbuffered. This option has no " "effect on the stdin stream." msgstr "" -#: ../../using/cmdline.rst:411 +#: ../../using/cmdline.rst:417 msgid "See also :envvar:`PYTHONUNBUFFERED`." msgstr "另請參閱 :envvar:`PYTHONUNBUFFERED`。" -#: ../../using/cmdline.rst:413 +#: ../../using/cmdline.rst:419 msgid "The text layer of the stdout and stderr streams now is unbuffered." msgstr "" -#: ../../using/cmdline.rst:419 +#: ../../using/cmdline.rst:425 msgid "" "Print a message each time a module is initialized, showing the place " -"(filename or built-in module) from which it is loaded. When given twice (:" -"option:`!-vv`), print a message for each file that is checked for when " +"(filename or built-in module) from which it is loaded. When given twice " +"(:option:`!-vv`), print a message for each file that is checked for when " "searching for a module. Also provides information on module cleanup at exit." msgstr "" -#: ../../using/cmdline.rst:424 +#: ../../using/cmdline.rst:430 msgid "" "The :mod:`site` module reports the site-specific paths and :file:`.pth` " "files being processed." msgstr "" -#: ../../using/cmdline.rst:428 +#: ../../using/cmdline.rst:434 msgid "See also :envvar:`PYTHONVERBOSE`." msgstr "另請參閱 :envvar:`PYTHONVERBOSE`。" -#: ../../using/cmdline.rst:434 +#: ../../using/cmdline.rst:440 msgid "" "Warning control. Python's warning machinery by default prints warning " "messages to :data:`sys.stderr`." msgstr "" -#: ../../using/cmdline.rst:437 ../../using/cmdline.rst:915 +#: ../../using/cmdline.rst:443 ../../using/cmdline.rst:921 msgid "" "The simplest settings apply a particular action unconditionally to all " "warnings emitted by a process (even those that are otherwise ignored by " "default)::" msgstr "" -#: ../../using/cmdline.rst:441 +#: ../../using/cmdline.rst:447 msgid "" "-Wdefault # Warn once per call location\n" "-Werror # Convert to exceptions\n" @@ -609,41 +632,41 @@ msgid "" "-Wignore # Never warn" msgstr "" -#: ../../using/cmdline.rst:449 +#: ../../using/cmdline.rst:455 msgid "" "The action names can be abbreviated as desired and the interpreter will " "resolve them to the appropriate action name. For example, ``-Wi`` is the " "same as ``-Wignore``." msgstr "" -#: ../../using/cmdline.rst:453 +#: ../../using/cmdline.rst:459 msgid "The full form of argument is::" msgstr "完整的引數形式為: ::" -#: ../../using/cmdline.rst:455 +#: ../../using/cmdline.rst:461 msgid "action:message:category:module:lineno" msgstr "action:message:category:module:lineno" -#: ../../using/cmdline.rst:457 +#: ../../using/cmdline.rst:463 msgid "" "Empty fields match all values; trailing empty fields may be omitted. For " "example ``-W ignore::DeprecationWarning`` ignores all DeprecationWarning " "warnings." msgstr "" -#: ../../using/cmdline.rst:461 +#: ../../using/cmdline.rst:467 msgid "" "The *action* field is as explained above but only applies to warnings that " "match the remaining fields." msgstr "" -#: ../../using/cmdline.rst:464 +#: ../../using/cmdline.rst:470 msgid "" "The *message* field must match the whole warning message; this match is case-" "insensitive." msgstr "" -#: ../../using/cmdline.rst:467 +#: ../../using/cmdline.rst:473 msgid "" "The *category* field matches the warning category (ex: " "``DeprecationWarning``). This must be a class name; the match test whether " @@ -651,59 +674,59 @@ msgid "" "warning category." msgstr "" -#: ../../using/cmdline.rst:472 +#: ../../using/cmdline.rst:478 msgid "" "The *module* field matches the (fully qualified) module name; this match is " "case-sensitive." msgstr "" -#: ../../using/cmdline.rst:475 +#: ../../using/cmdline.rst:481 msgid "" "The *lineno* field matches the line number, where zero matches all line " "numbers and is thus equivalent to an omitted line number." msgstr "" -#: ../../using/cmdline.rst:478 +#: ../../using/cmdline.rst:484 msgid "" "Multiple :option:`-W` options can be given; when a warning matches more than " -"one option, the action for the last matching option is performed. Invalid :" -"option:`-W` options are ignored (though, a warning message is printed about " -"invalid options when the first warning is issued)." +"one option, the action for the last matching option is performed. " +"Invalid :option:`-W` options are ignored (though, a warning message is " +"printed about invalid options when the first warning is issued)." msgstr "" -#: ../../using/cmdline.rst:483 +#: ../../using/cmdline.rst:489 msgid "" "Warnings can also be controlled using the :envvar:`PYTHONWARNINGS` " -"environment variable and from within a Python program using the :mod:" -"`warnings` module. For example, the :func:`warnings.filterwarnings` function " -"can be used to use a regular expression on the warning message." +"environment variable and from within a Python program using " +"the :mod:`warnings` module. For example, the :func:`warnings.filterwarnings` " +"function can be used to use a regular expression on the warning message." msgstr "" -#: ../../using/cmdline.rst:488 ../../using/cmdline.rst:927 +#: ../../using/cmdline.rst:494 ../../using/cmdline.rst:933 msgid "" "See :ref:`warning-filter` and :ref:`describing-warning-filters` for more " "details." msgstr "" -#: ../../using/cmdline.rst:494 +#: ../../using/cmdline.rst:500 msgid "" "Skip the first line of the source, allowing use of non-Unix forms of ``#!" "cmd``. This is intended for a DOS specific hack only." msgstr "" -#: ../../using/cmdline.rst:500 +#: ../../using/cmdline.rst:506 msgid "" "Reserved for various implementation-specific options. CPython currently " "defines the following possible values:" msgstr "" -#: ../../using/cmdline.rst:503 +#: ../../using/cmdline.rst:509 msgid "" -"``-X faulthandler`` to enable :mod:`faulthandler`. See also :envvar:" -"`PYTHONFAULTHANDLER`." +"``-X faulthandler`` to enable :mod:`faulthandler`. See " +"also :envvar:`PYTHONFAULTHANDLER`." msgstr "" -#: ../../using/cmdline.rst:508 +#: ../../using/cmdline.rst:514 msgid "" "``-X showrefcount`` to output the total reference count and number of used " "memory blocks when the program finishes or after each statement in the " @@ -711,23 +734,24 @@ msgid "" "build>`." msgstr "" -#: ../../using/cmdline.rst:515 +#: ../../using/cmdline.rst:521 msgid "" -"``-X tracemalloc`` to start tracing Python memory allocations using the :mod:" -"`tracemalloc` module. By default, only the most recent frame is stored in a " -"traceback of a trace. Use ``-X tracemalloc=NFRAME`` to start tracing with a " -"traceback limit of *NFRAME* frames. See :func:`tracemalloc.start` and :" -"envvar:`PYTHONTRACEMALLOC` for more information." +"``-X tracemalloc`` to start tracing Python memory allocations using " +"the :mod:`tracemalloc` module. By default, only the most recent frame is " +"stored in a traceback of a trace. Use ``-X tracemalloc=NFRAME`` to start " +"tracing with a traceback limit of *NFRAME* frames. " +"See :func:`tracemalloc.start` and :envvar:`PYTHONTRACEMALLOC` for more " +"information." msgstr "" -#: ../../using/cmdline.rst:524 +#: ../../using/cmdline.rst:530 msgid "" "``-X int_max_str_digits`` configures the :ref:`integer string conversion " -"length limitation <int_max_str_digits>`. See also :envvar:" -"`PYTHONINTMAXSTRDIGITS`." +"length limitation <int_max_str_digits>`. See " +"also :envvar:`PYTHONINTMAXSTRDIGITS`." msgstr "" -#: ../../using/cmdline.rst:530 +#: ../../using/cmdline.rst:536 msgid "" "``-X importtime`` to show how long each import takes. It shows module name, " "cumulative time (including nested imports) and self time (excluding nested " @@ -736,45 +760,45 @@ msgid "" "asyncio'``. See also :envvar:`PYTHONPROFILEIMPORTTIME`." msgstr "" -#: ../../using/cmdline.rst:538 +#: ../../using/cmdline.rst:544 msgid "" "``-X dev``: enable :ref:`Python Development Mode <devmode>`, introducing " "additional runtime checks that are too expensive to be enabled by default. " "See also :envvar:`PYTHONDEVMODE`." msgstr "" -#: ../../using/cmdline.rst:544 +#: ../../using/cmdline.rst:550 msgid "" "``-X utf8`` enables the :ref:`Python UTF-8 Mode <utf8-mode>`. ``-X utf8=0`` " "explicitly disables :ref:`Python UTF-8 Mode <utf8-mode>` (even when it would " "otherwise activate automatically). See also :envvar:`PYTHONUTF8`." msgstr "" -#: ../../using/cmdline.rst:551 +#: ../../using/cmdline.rst:557 msgid "" "``-X pycache_prefix=PATH`` enables writing ``.pyc`` files to a parallel tree " -"rooted at the given directory instead of to the code tree. See also :envvar:" -"`PYTHONPYCACHEPREFIX`." +"rooted at the given directory instead of to the code tree. See " +"also :envvar:`PYTHONPYCACHEPREFIX`." msgstr "" -#: ../../using/cmdline.rst:557 +#: ../../using/cmdline.rst:563 msgid "" "``-X warn_default_encoding`` issues a :class:`EncodingWarning` when the " -"locale-specific default encoding is used for opening files. See also :envvar:" -"`PYTHONWARNDEFAULTENCODING`." +"locale-specific default encoding is used for opening files. See " +"also :envvar:`PYTHONWARNDEFAULTENCODING`." msgstr "" -#: ../../using/cmdline.rst:563 +#: ../../using/cmdline.rst:569 msgid "" "``-X no_debug_ranges`` disables the inclusion of the tables mapping extra " "location information (end line, start column offset and end column offset) " "to every instruction in code objects. This is useful when smaller code " "objects and pyc files are desired as well as suppressing the extra visual " -"location indicators when the interpreter displays tracebacks. See also :" -"envvar:`PYTHONNODEBUGRANGES`." +"location indicators when the interpreter displays tracebacks. See " +"also :envvar:`PYTHONNODEBUGRANGES`." msgstr "" -#: ../../using/cmdline.rst:572 +#: ../../using/cmdline.rst:578 msgid "" "``-X frozen_modules`` determines whether or not frozen modules are ignored " "by the import machinery. A value of ``on`` means they get imported and " @@ -782,11 +806,11 @@ msgid "" "installed Python (the normal case). If it's under development (running from " "the source tree) then the default is ``off``. Note that the :mod:`!" "importlib_bootstrap` and :mod:`!importlib_bootstrap_external` frozen modules " -"are always used, even if this flag is set to ``off``. See also :envvar:" -"`PYTHON_FROZEN_MODULES`." +"are always used, even if this flag is set to ``off``. See " +"also :envvar:`PYTHON_FROZEN_MODULES`." msgstr "" -#: ../../using/cmdline.rst:583 +#: ../../using/cmdline.rst:589 msgid "" "``-X perf`` enables support for the Linux ``perf`` profiler. When this " "option is provided, the ``perf`` profiler will be able to report Python " @@ -795,36 +819,37 @@ msgid "" "also :envvar:`PYTHONPERFSUPPORT` and :ref:`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:591 +#: ../../using/cmdline.rst:597 msgid "" "``-X perf_jit`` enables support for the Linux ``perf`` profiler with DWARF " "support. When this option is provided, the ``perf`` profiler will be able to " "report Python calls using DWARF information. This option is only available " "on some platforms and will do nothing if is not supported on the current " -"system. The default value is \"off\". See also :envvar:" -"`PYTHON_PERF_JIT_SUPPORT` and :ref:`perf_profiling`." +"system. The default value is \"off\". See " +"also :envvar:`PYTHON_PERF_JIT_SUPPORT` and :ref:`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:600 +#: ../../using/cmdline.rst:606 msgid "" -":samp:`-X cpu_count={n}` overrides :func:`os.cpu_count`, :func:`os." -"process_cpu_count`, and :func:`multiprocessing.cpu_count`. *n* must be " -"greater than or equal to 1. This option may be useful for users who need to " -"limit CPU resources of a container system. See also :envvar:" -"`PYTHON_CPU_COUNT`. If *n* is ``default``, nothing is overridden." +":samp:`-X cpu_count={n}` " +"overrides :func:`os.cpu_count`, :func:`os.process_cpu_count`, " +"and :func:`multiprocessing.cpu_count`. *n* must be greater than or equal to " +"1. This option may be useful for users who need to limit CPU resources of a " +"container system. See also :envvar:`PYTHON_CPU_COUNT`. If *n* is " +"``default``, nothing is overridden." msgstr "" -#: ../../using/cmdline.rst:609 +#: ../../using/cmdline.rst:615 msgid "" ":samp:`-X presite={package.module}` specifies a module that should be " -"imported before the :mod:`site` module is executed and before the :mod:" -"`__main__` module exists. Therefore, the imported module isn't :mod:" -"`__main__`. This can be used to execute code early during Python " +"imported before the :mod:`site` module is executed and before " +"the :mod:`__main__` module exists. Therefore, the imported module " +"isn't :mod:`__main__`. This can be used to execute code early during Python " "initialization. Python needs to be :ref:`built in debug mode <debug-build>` " "for this option to exist. See also :envvar:`PYTHON_PRESITE`." msgstr "" -#: ../../using/cmdline.rst:618 +#: ../../using/cmdline.rst:624 msgid "" ":samp:`-X gil={0,1}` forces the GIL to be disabled or enabled, respectively. " "Setting to ``0`` is only available in builds configured with :option:`--" @@ -832,50 +857,50 @@ msgid "" "threaded-cpython`." msgstr "" -#: ../../using/cmdline.rst:625 +#: ../../using/cmdline.rst:631 msgid "" -"It also allows passing arbitrary values and retrieving them through the :" -"data:`sys._xoptions` dictionary." +"It also allows passing arbitrary values and retrieving them through " +"the :data:`sys._xoptions` dictionary." msgstr "" -#: ../../using/cmdline.rst:630 +#: ../../using/cmdline.rst:636 msgid "Removed the ``-X showalloccount`` option." msgstr "移除 ``-X showalloccount`` 選項。" -#: ../../using/cmdline.rst:633 +#: ../../using/cmdline.rst:639 msgid "Removed the ``-X oldparser`` option." msgstr "移除 ``-X oldparser`` 選項。" -#: ../../using/cmdline.rst:639 +#: ../../using/cmdline.rst:645 msgid "Controlling color" msgstr "" -#: ../../using/cmdline.rst:641 +#: ../../using/cmdline.rst:647 msgid "" "The Python interpreter is configured by default to use colors to highlight " "output in certain situations such as when displaying tracebacks. This " "behavior can be controlled by setting different environment variables." msgstr "" -#: ../../using/cmdline.rst:645 +#: ../../using/cmdline.rst:651 msgid "" "Setting the environment variable ``TERM`` to ``dumb`` will disable color." msgstr "" -#: ../../using/cmdline.rst:647 +#: ../../using/cmdline.rst:653 msgid "" "If the |FORCE_COLOR|_ environment variable is set, then color will be " "enabled regardless of the value of TERM. This is useful on CI systems which " "aren’t terminals but can still display ANSI escape sequences." msgstr "" -#: ../../using/cmdline.rst:651 +#: ../../using/cmdline.rst:657 msgid "" "If the |NO_COLOR|_ environment variable is set, Python will disable all " "color in the output. This takes precedence over ``FORCE_COLOR``." msgstr "" -#: ../../using/cmdline.rst:654 +#: ../../using/cmdline.rst:660 msgid "" "All these environment variables are used also by other tools to control " "color output. To control the color output only in the Python interpreter, " @@ -884,19 +909,19 @@ msgid "" "``FORCE_COLOR``." msgstr "" -#: ../../using/cmdline.rst:669 +#: ../../using/cmdline.rst:675 msgid "Options you shouldn't use" msgstr "你不該使用的選項" -#: ../../using/cmdline.rst:673 +#: ../../using/cmdline.rst:679 msgid "Reserved for use by Jython_." msgstr "" -#: ../../using/cmdline.rst:681 +#: ../../using/cmdline.rst:687 msgid "Environment variables" msgstr "環境變數" -#: ../../using/cmdline.rst:683 +#: ../../using/cmdline.rst:689 msgid "" "These environment variables influence Python's behavior, they are processed " "before the command-line switches other than -E or -I. It is customary that " @@ -904,65 +929,65 @@ msgid "" "conflict." msgstr "" -#: ../../using/cmdline.rst:690 +#: ../../using/cmdline.rst:696 msgid "" "Change the location of the standard Python libraries. By default, the " -"libraries are searched in :file:`{prefix}/lib/python{version}` and :file:" -"`{exec_prefix}/lib/python{version}`, where :file:`{prefix}` and :file:" -"`{exec_prefix}` are installation-dependent directories, both defaulting to :" -"file:`/usr/local`." +"libraries are searched in :file:`{prefix}/lib/python{version}` " +"and :file:`{exec_prefix}/lib/python{version}`, where :file:`{prefix}` " +"and :file:`{exec_prefix}` are installation-dependent directories, both " +"defaulting to :file:`/usr/local`." msgstr "" -#: ../../using/cmdline.rst:696 +#: ../../using/cmdline.rst:702 msgid "" "When :envvar:`PYTHONHOME` is set to a single directory, its value replaces " "both :file:`{prefix}` and :file:`{exec_prefix}`. To specify different " "values for these, set :envvar:`PYTHONHOME` to :file:`{prefix}:{exec_prefix}`." msgstr "" -#: ../../using/cmdline.rst:703 +#: ../../using/cmdline.rst:709 msgid "" "Augment the default search path for module files. The format is the same as " -"the shell's :envvar:`PATH`: one or more directory pathnames separated by :" -"data:`os.pathsep` (e.g. colons on Unix or semicolons on Windows). Non-" +"the shell's :envvar:`PATH`: one or more directory pathnames separated " +"by :data:`os.pathsep` (e.g. colons on Unix or semicolons on Windows). Non-" "existent directories are silently ignored." msgstr "" -#: ../../using/cmdline.rst:708 +#: ../../using/cmdline.rst:714 msgid "" "In addition to normal directories, individual :envvar:`PYTHONPATH` entries " "may refer to zipfiles containing pure Python modules (in either source or " "compiled form). Extension modules cannot be imported from zipfiles." msgstr "" -#: ../../using/cmdline.rst:712 +#: ../../using/cmdline.rst:718 msgid "" "The default search path is installation dependent, but generally begins " "with :file:`{prefix}/lib/python{version}` (see :envvar:`PYTHONHOME` above). " "It is *always* appended to :envvar:`PYTHONPATH`." msgstr "" -#: ../../using/cmdline.rst:716 +#: ../../using/cmdline.rst:722 msgid "" -"An additional directory will be inserted in the search path in front of :" -"envvar:`PYTHONPATH` as described above under :ref:`using-on-interface-" +"An additional directory will be inserted in the search path in front " +"of :envvar:`PYTHONPATH` as described above under :ref:`using-on-interface-" "options`. The search path can be manipulated from within a Python program as " "the variable :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:724 +#: ../../using/cmdline.rst:730 msgid "" "If this is set to a non-empty string, don't prepend a potentially unsafe " "path to :data:`sys.path`: see the :option:`-P` option for details." msgstr "" -#: ../../using/cmdline.rst:732 +#: ../../using/cmdline.rst:738 msgid "" -"If this is set to a non-empty string, it overrides the :data:`sys." -"platlibdir` value." +"If this is set to a non-empty string, it overrides " +"the :data:`sys.platlibdir` value." msgstr "" -#: ../../using/cmdline.rst:740 +#: ../../using/cmdline.rst:746 msgid "" "If this is the name of a readable file, the Python commands in that file are " "executed before the first prompt is displayed in interactive mode. The file " @@ -973,7 +998,7 @@ msgid "" "file." msgstr "" -#: ../../using/cmdline.rst:747 ../../using/cmdline.rst:749 +#: ../../using/cmdline.rst:753 ../../using/cmdline.rst:755 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_startup`` with the " "filename as the argument when called on startup." @@ -981,86 +1006,86 @@ msgstr "" "引發一個附帶呼叫啟動時的檔案名稱為引數的\\ :ref:`稽核事件 <auditing>` " "``cpython.run_startup``。" -#: ../../using/cmdline.rst:755 +#: ../../using/cmdline.rst:761 msgid "" -"If this is set to a non-empty string it is equivalent to specifying the :" -"option:`-O` option. If set to an integer, it is equivalent to specifying :" -"option:`-O` multiple times." +"If this is set to a non-empty string it is equivalent to specifying " +"the :option:`-O` option. If set to an integer, it is equivalent to " +"specifying :option:`-O` multiple times." msgstr "" -#: ../../using/cmdline.rst:762 +#: ../../using/cmdline.rst:768 msgid "" "If this is set, it names a callable using dotted-path notation. The module " "containing the callable will be imported and then the callable will be run " "by the default implementation of :func:`sys.breakpointhook` which itself is " "called by built-in :func:`breakpoint`. If not set, or set to the empty " "string, it is equivalent to the value \"pdb.set_trace\". Setting this to " -"the string \"0\" causes the default implementation of :func:`sys." -"breakpointhook` to do nothing but return immediately." +"the string \"0\" causes the default implementation " +"of :func:`sys.breakpointhook` to do nothing but return immediately." msgstr "" -#: ../../using/cmdline.rst:774 +#: ../../using/cmdline.rst:780 msgid "" -"If this is set to a non-empty string it is equivalent to specifying the :" -"option:`-d` option. If set to an integer, it is equivalent to specifying :" -"option:`-d` multiple times." +"If this is set to a non-empty string it is equivalent to specifying " +"the :option:`-d` option. If set to an integer, it is equivalent to " +"specifying :option:`-d` multiple times." msgstr "" -#: ../../using/cmdline.rst:778 +#: ../../using/cmdline.rst:784 msgid "" "This environment variable requires a :ref:`debug build of Python <debug-" "build>`, otherwise it's ignored." msgstr "" -#: ../../using/cmdline.rst:784 +#: ../../using/cmdline.rst:790 msgid "" -"If this is set to a non-empty string it is equivalent to specifying the :" -"option:`-i` option." +"If this is set to a non-empty string it is equivalent to specifying " +"the :option:`-i` option." msgstr "" -#: ../../using/cmdline.rst:787 +#: ../../using/cmdline.rst:793 msgid "" "This variable can also be modified by Python code using :data:`os.environ` " "to force inspect mode on program termination." msgstr "" -#: ../../using/cmdline.rst:792 +#: ../../using/cmdline.rst:798 msgid "(also 3.11.10, 3.10.15, 3.9.20, and 3.8.20) Emits audit events." msgstr "" -#: ../../using/cmdline.rst:795 +#: ../../using/cmdline.rst:801 msgid "" "Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also " "executed. Emits audit events." msgstr "" -#: ../../using/cmdline.rst:802 +#: ../../using/cmdline.rst:808 msgid "" -"If this is set to a non-empty string it is equivalent to specifying the :" -"option:`-u` option." +"If this is set to a non-empty string it is equivalent to specifying " +"the :option:`-u` option." msgstr "" -#: ../../using/cmdline.rst:808 +#: ../../using/cmdline.rst:814 msgid "" -"If this is set to a non-empty string it is equivalent to specifying the :" -"option:`-v` option. If set to an integer, it is equivalent to specifying :" -"option:`-v` multiple times." +"If this is set to a non-empty string it is equivalent to specifying " +"the :option:`-v` option. If set to an integer, it is equivalent to " +"specifying :option:`-v` multiple times." msgstr "" -#: ../../using/cmdline.rst:815 +#: ../../using/cmdline.rst:821 msgid "" "If this is set, Python ignores case in :keyword:`import` statements. This " "only works on Windows and macOS." msgstr "" -#: ../../using/cmdline.rst:821 +#: ../../using/cmdline.rst:827 msgid "" "If this is set to a non-empty string, Python won't try to write ``.pyc`` " "files on the import of source modules. This is equivalent to specifying " "the :option:`-B` option." msgstr "" -#: ../../using/cmdline.rst:828 +#: ../../using/cmdline.rst:834 msgid "" "If this is set, Python will write ``.pyc`` files in a mirror directory tree " "at this path, instead of in ``__pycache__`` directories within the source " @@ -1068,40 +1093,40 @@ msgid "" "``pycache_prefix=PATH`` option." msgstr "" -#: ../../using/cmdline.rst:838 +#: ../../using/cmdline.rst:844 msgid "" "If this variable is not set or set to ``random``, a random value is used to " "seed the hashes of str and bytes objects." msgstr "" -#: ../../using/cmdline.rst:841 +#: ../../using/cmdline.rst:847 msgid "" "If :envvar:`PYTHONHASHSEED` is set to an integer value, it is used as a " "fixed seed for generating the hash() of the types covered by the hash " "randomization." msgstr "" -#: ../../using/cmdline.rst:845 +#: ../../using/cmdline.rst:851 msgid "" "Its purpose is to allow repeatable hashing, such as for selftests for the " "interpreter itself, or to allow a cluster of python processes to share hash " "values." msgstr "" -#: ../../using/cmdline.rst:849 +#: ../../using/cmdline.rst:855 msgid "" "The integer must be a decimal number in the range [0,4294967295]. " "Specifying the value 0 will disable hash randomization." msgstr "" -#: ../../using/cmdline.rst:856 +#: ../../using/cmdline.rst:862 msgid "" "If this variable is set to an integer, it is used to configure the " "interpreter's global :ref:`integer string conversion length limitation " "<int_max_str_digits>`." msgstr "" -#: ../../using/cmdline.rst:864 +#: ../../using/cmdline.rst:870 msgid "" "If this is set before running the interpreter, it overrides the encoding " "used for stdin/stdout/stderr, in the syntax ``encodingname:errorhandler``. " @@ -1109,17 +1134,17 @@ msgid "" "have the same meaning as in :func:`str.encode`." msgstr "" -#: ../../using/cmdline.rst:869 +#: ../../using/cmdline.rst:875 msgid "" "For stderr, the ``:errorhandler`` part is ignored; the handler will always " "be ``'backslashreplace'``." msgstr "" -#: ../../using/cmdline.rst:872 +#: ../../using/cmdline.rst:878 msgid "The ``encodingname`` part is now optional." msgstr "" -#: ../../using/cmdline.rst:875 +#: ../../using/cmdline.rst:881 msgid "" "On Windows, the encoding specified by this variable is ignored for " "interactive console buffers unless :envvar:`PYTHONLEGACYWINDOWSSTDIO` is " @@ -1127,34 +1152,34 @@ msgid "" "not affected." msgstr "" -#: ../../using/cmdline.rst:882 +#: ../../using/cmdline.rst:888 msgid "" "If this is set, Python won't add the :data:`user site-packages directory " "<site.USER_SITE>` to :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:892 +#: ../../using/cmdline.rst:898 msgid "" "Defines the :data:`user base directory <site.USER_BASE>`, which is used to " -"compute the path of the :data:`user site-packages directory <site." -"USER_SITE>` and :ref:`installation paths <sysconfig-user-scheme>` for " +"compute the path of the :data:`user site-packages directory " +"<site.USER_SITE>` and :ref:`installation paths <sysconfig-user-scheme>` for " "``python -m pip install --user``." msgstr "" -#: ../../using/cmdline.rst:904 +#: ../../using/cmdline.rst:910 msgid "" "If this environment variable is set, ``sys.argv[0]`` will be set to its " "value instead of the value got through the C runtime. Only works on macOS." msgstr "" -#: ../../using/cmdline.rst:910 +#: ../../using/cmdline.rst:916 msgid "" "This is equivalent to the :option:`-W` option. If set to a comma separated " "string, it is equivalent to specifying :option:`-W` multiple times, with " "filters later in the list taking precedence over those earlier in the list." msgstr "" -#: ../../using/cmdline.rst:919 +#: ../../using/cmdline.rst:925 msgid "" "PYTHONWARNINGS=default # Warn once per call location\n" "PYTHONWARNINGS=error # Convert to exceptions\n" @@ -1165,16 +1190,16 @@ msgid "" "PYTHONWARNINGS=ignore # Never warn" msgstr "" -#: ../../using/cmdline.rst:933 +#: ../../using/cmdline.rst:939 msgid "" -"If this environment variable is set to a non-empty string, :func:" -"`faulthandler.enable` is called at startup: install a handler for :const:" -"`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:" -"`~signal.SIGBUS` and :const:`~signal.SIGILL` signals to dump the Python " -"traceback. This is equivalent to :option:`-X` ``faulthandler`` option." +"If this environment variable is set to a non-empty " +"string, :func:`faulthandler.enable` is called at startup: install a handler " +"for :const:`~signal.SIGSEGV`, :const:`~signal.SIGFPE`, :const:`~signal.SIGABRT`, :const:`~signal.SIGBUS` " +"and :const:`~signal.SIGILL` signals to dump the Python traceback. This is " +"equivalent to :option:`-X` ``faulthandler`` option." msgstr "" -#: ../../using/cmdline.rst:945 +#: ../../using/cmdline.rst:951 msgid "" "If this environment variable is set to a non-empty string, start tracing " "Python memory allocations using the :mod:`tracemalloc` module. The value of " @@ -1184,101 +1209,101 @@ msgid "" "is equivalent to setting the :option:`-X` ``tracemalloc`` option." msgstr "" -#: ../../using/cmdline.rst:958 +#: ../../using/cmdline.rst:964 msgid "" "If this environment variable is set to a non-empty string, Python will show " "how long each import takes. This is equivalent to setting the :option:`-X` " "``importtime`` option." msgstr "" -#: ../../using/cmdline.rst:967 +#: ../../using/cmdline.rst:973 msgid "" -"If this environment variable is set to a non-empty string, enable the :ref:" -"`debug mode <asyncio-debug-mode>` of the :mod:`asyncio` module." +"If this environment variable is set to a non-empty string, enable " +"the :ref:`debug mode <asyncio-debug-mode>` of the :mod:`asyncio` module." msgstr "" -#: ../../using/cmdline.rst:975 +#: ../../using/cmdline.rst:981 msgid "Set the Python memory allocators and/or install debug hooks." msgstr "" -#: ../../using/cmdline.rst:977 +#: ../../using/cmdline.rst:983 msgid "Set the family of memory allocators used by Python:" msgstr "" -#: ../../using/cmdline.rst:979 +#: ../../using/cmdline.rst:985 msgid "" "``default``: use the :ref:`default memory allocators <default-memory-" "allocators>`." msgstr "" -#: ../../using/cmdline.rst:981 +#: ../../using/cmdline.rst:987 msgid "" "``malloc``: use the :c:func:`malloc` function of the C library for all " -"domains (:c:macro:`PYMEM_DOMAIN_RAW`, :c:macro:`PYMEM_DOMAIN_MEM`, :c:macro:" -"`PYMEM_DOMAIN_OBJ`)." +"domains " +"(:c:macro:`PYMEM_DOMAIN_RAW`, :c:macro:`PYMEM_DOMAIN_MEM`, :c:macro:`PYMEM_DOMAIN_OBJ`)." msgstr "" -#: ../../using/cmdline.rst:984 +#: ../../using/cmdline.rst:990 msgid "" -"``pymalloc``: use the :ref:`pymalloc allocator <pymalloc>` for :c:macro:" -"`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and use the :c:" -"func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." +"``pymalloc``: use the :ref:`pymalloc allocator <pymalloc>` " +"for :c:macro:`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and " +"use the :c:func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." msgstr "" -#: ../../using/cmdline.rst:987 +#: ../../using/cmdline.rst:993 msgid "" -"``mimalloc``: use the :ref:`mimalloc allocator <mimalloc>` for :c:macro:" -"`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and use the :c:" -"func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." +"``mimalloc``: use the :ref:`mimalloc allocator <mimalloc>` " +"for :c:macro:`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and " +"use the :c:func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." msgstr "" -#: ../../using/cmdline.rst:991 +#: ../../using/cmdline.rst:997 msgid "Install :ref:`debug hooks <pymem-debug-hooks>`:" msgstr "" -#: ../../using/cmdline.rst:993 +#: ../../using/cmdline.rst:999 msgid "" "``debug``: install debug hooks on top of the :ref:`default memory allocators " "<default-memory-allocators>`." msgstr "" -#: ../../using/cmdline.rst:995 +#: ../../using/cmdline.rst:1001 msgid "``malloc_debug``: same as ``malloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:996 +#: ../../using/cmdline.rst:1002 msgid "``pymalloc_debug``: same as ``pymalloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:997 +#: ../../using/cmdline.rst:1003 msgid "``mimalloc_debug``: same as ``mimalloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:1001 +#: ../../using/cmdline.rst:1007 msgid "Added the ``\"default\"`` allocator." msgstr "" -#: ../../using/cmdline.rst:1007 +#: ../../using/cmdline.rst:1013 msgid "" -"If set to a non-empty string, Python will print statistics of the :ref:" -"`pymalloc memory allocator <pymalloc>` every time a new pymalloc object " -"arena is created, and on shutdown." +"If set to a non-empty string, Python will print statistics of " +"the :ref:`pymalloc memory allocator <pymalloc>` every time a new pymalloc " +"object arena is created, and on shutdown." msgstr "" -#: ../../using/cmdline.rst:1011 +#: ../../using/cmdline.rst:1017 msgid "" "This variable is ignored if the :envvar:`PYTHONMALLOC` environment variable " "is used to force the :c:func:`malloc` allocator of the C library, or if " "Python is configured without ``pymalloc`` support." msgstr "" -#: ../../using/cmdline.rst:1015 +#: ../../using/cmdline.rst:1021 msgid "" "This variable can now also be used on Python compiled in release mode. It " "now has no effect if set to an empty string." msgstr "" -#: ../../using/cmdline.rst:1022 +#: ../../using/cmdline.rst:1028 msgid "" "If set to a non-empty string, the default :term:`filesystem encoding and " "error handler` mode will revert to their pre-3.6 values of 'mbcs' and " @@ -1286,42 +1311,42 @@ msgid "" "'surrogatepass' are used." msgstr "" -#: ../../using/cmdline.rst:1027 +#: ../../using/cmdline.rst:1033 msgid "" -"This may also be enabled at runtime with :func:`sys." -"_enablelegacywindowsfsencoding`." +"This may also be enabled at runtime " +"with :func:`sys._enablelegacywindowsfsencoding`." msgstr "" -#: ../../using/cmdline.rst:1030 ../../using/cmdline.rst:1044 -#: ../../using/cmdline.rst:1095 +#: ../../using/cmdline.rst:1036 ../../using/cmdline.rst:1050 +#: ../../using/cmdline.rst:1101 msgid "Availability" msgstr "" -#: ../../using/cmdline.rst:1032 +#: ../../using/cmdline.rst:1038 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`。" -#: ../../using/cmdline.rst:1037 +#: ../../using/cmdline.rst:1043 msgid "" "If set to a non-empty string, does not use the new console reader and " "writer. This means that Unicode characters will be encoded according to the " "active console code page, rather than using utf-8." msgstr "" -#: ../../using/cmdline.rst:1041 +#: ../../using/cmdline.rst:1047 msgid "" "This variable is ignored if the standard streams are redirected (to files or " "pipes) rather than referring to console buffers." msgstr "" -#: ../../using/cmdline.rst:1051 +#: ../../using/cmdline.rst:1057 msgid "" "If set to the value ``0``, causes the main Python command line application " "to skip coercing the legacy ASCII-based C and POSIX locales to a more " "capable UTF-8 based alternative." msgstr "" -#: ../../using/cmdline.rst:1055 +#: ../../using/cmdline.rst:1061 msgid "" "If this variable is *not* set (or is set to a value other than ``0``), the " "``LC_ALL`` locale override environment variable is also not set, and the " @@ -1332,19 +1357,19 @@ msgid "" "runtime:" msgstr "" -#: ../../using/cmdline.rst:1063 +#: ../../using/cmdline.rst:1069 msgid "``C.UTF-8``" msgstr "``C.UTF-8``" -#: ../../using/cmdline.rst:1064 +#: ../../using/cmdline.rst:1070 msgid "``C.utf8``" msgstr "``C.utf8``" -#: ../../using/cmdline.rst:1065 +#: ../../using/cmdline.rst:1071 msgid "``UTF-8``" msgstr "``UTF-8``" -#: ../../using/cmdline.rst:1067 +#: ../../using/cmdline.rst:1073 msgid "" "If setting one of these locale categories succeeds, then the ``LC_CTYPE`` " "environment variable will also be set accordingly in the current process " @@ -1357,17 +1382,18 @@ msgid "" "(such as Python's own :func:`locale.getdefaultlocale`)." msgstr "" -#: ../../using/cmdline.rst:1077 +#: ../../using/cmdline.rst:1083 msgid "" "Configuring one of these locales (either explicitly or via the above " -"implicit locale coercion) automatically enables the ``surrogateescape`` :ref:" -"`error handler <error-handlers>` for :data:`sys.stdin` and :data:`sys." -"stdout` (:data:`sys.stderr` continues to use ``backslashreplace`` as it does " -"in any other locale). This stream handling behavior can be overridden using :" -"envvar:`PYTHONIOENCODING` as usual." +"implicit locale coercion) automatically enables the " +"``surrogateescape`` :ref:`error handler <error-handlers>` " +"for :data:`sys.stdin` and :data:`sys.stdout` (:data:`sys.stderr` continues " +"to use ``backslashreplace`` as it does in any other locale). This stream " +"handling behavior can be overridden using :envvar:`PYTHONIOENCODING` as " +"usual." msgstr "" -#: ../../using/cmdline.rst:1084 +#: ../../using/cmdline.rst:1090 msgid "" "For debugging purposes, setting ``PYTHONCOERCECLOCALE=warn`` will cause " "Python to emit warning messages on ``stderr`` if either the locale coercion " @@ -1375,7 +1401,7 @@ msgid "" "active when the Python runtime is initialized." msgstr "" -#: ../../using/cmdline.rst:1089 +#: ../../using/cmdline.rst:1095 msgid "" "Also note that even when locale coercion is disabled, or when it fails to " "find a suitable target locale, :envvar:`PYTHONUTF8` will still activate by " @@ -1384,43 +1410,43 @@ msgid "" "system interfaces." msgstr "" -#: ../../using/cmdline.rst:1097 +#: ../../using/cmdline.rst:1103 msgid "See :pep:`538` for more details." msgstr "更多細節請見 :pep:`538`。" -#: ../../using/cmdline.rst:1103 +#: ../../using/cmdline.rst:1109 msgid "" -"If this environment variable is set to a non-empty string, enable :ref:" -"`Python Development Mode <devmode>`, introducing additional runtime checks " -"that are too expensive to be enabled by default. This is equivalent to " -"setting the :option:`-X` ``dev`` option." +"If this environment variable is set to a non-empty string, " +"enable :ref:`Python Development Mode <devmode>`, introducing additional " +"runtime checks that are too expensive to be enabled by default. This is " +"equivalent to setting the :option:`-X` ``dev`` option." msgstr "" -#: ../../using/cmdline.rst:1112 +#: ../../using/cmdline.rst:1118 msgid "If set to ``1``, enable the :ref:`Python UTF-8 Mode <utf8-mode>`." msgstr "如果設為 ``1``,則啟用 :ref:`Python UTF-8 Mode <utf8-mode>`。" -#: ../../using/cmdline.rst:1114 +#: ../../using/cmdline.rst:1120 msgid "If set to ``0``, disable the :ref:`Python UTF-8 Mode <utf8-mode>`." msgstr "如果設為 ``0``,則停用 :ref:`Python UTF-8 Mode <utf8-mode>`。" -#: ../../using/cmdline.rst:1116 +#: ../../using/cmdline.rst:1122 msgid "" "Setting any other non-empty string causes an error during interpreter " "initialisation." msgstr "" -#: ../../using/cmdline.rst:1123 +#: ../../using/cmdline.rst:1129 msgid "" -"If this environment variable is set to a non-empty string, issue a :class:" -"`EncodingWarning` when the locale-specific default encoding is used." +"If this environment variable is set to a non-empty string, issue " +"a :class:`EncodingWarning` when the locale-specific default encoding is used." msgstr "" -#: ../../using/cmdline.rst:1126 +#: ../../using/cmdline.rst:1132 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節請見 :ref:`io-encoding-warning`。" -#: ../../using/cmdline.rst:1132 +#: ../../using/cmdline.rst:1138 msgid "" "If this variable is set, it disables the inclusion of the tables mapping " "extra location information (end line, start column offset and end column " @@ -1429,47 +1455,46 @@ msgid "" "visual location indicators when the interpreter displays tracebacks." msgstr "" -#: ../../using/cmdline.rst:1142 +#: ../../using/cmdline.rst:1148 msgid "" "If this variable is set to a nonzero value, it enables support for the Linux " "``perf`` profiler so Python calls can be detected by it." msgstr "" -#: ../../using/cmdline.rst:1145 ../../using/cmdline.rst:1158 +#: ../../using/cmdline.rst:1151 ../../using/cmdline.rst:1164 msgid "If set to ``0``, disable Linux ``perf`` profiler support." msgstr "" -#: ../../using/cmdline.rst:1147 +#: ../../using/cmdline.rst:1153 msgid "" -"See also the :option:`-X perf <-X>` command-line option and :ref:" -"`perf_profiling`." +"See also the :option:`-X perf <-X>` command-line option " +"and :ref:`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:1154 +#: ../../using/cmdline.rst:1160 msgid "" "If this variable is set to a nonzero value, it enables support for the Linux " "``perf`` profiler so Python calls can be detected by it using DWARF " "information." msgstr "" -#: ../../using/cmdline.rst:1160 +#: ../../using/cmdline.rst:1166 msgid "" -"See also the :option:`-X perf_jit <-X>` command-line option and :ref:" -"`perf_profiling`." +"See also the :option:`-X perf_jit <-X>` command-line option " +"and :ref:`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:1169 +#: ../../using/cmdline.rst:1175 msgid "" "If this variable is set to a positive integer, it overrides the return " "values of :func:`os.cpu_count` and :func:`os.process_cpu_count`." msgstr "" -#: ../../using/cmdline.rst:1172 -#, fuzzy +#: ../../using/cmdline.rst:1178 msgid "See also the :option:`-X cpu_count <-X>` command-line option." -msgstr "另請參閱 :option:`-P` 和 :option:`-I` (isolated) 選項。" +msgstr "另請參閱 :option:`-X cpu_count <-X>` 命令列選項。" -#: ../../using/cmdline.rst:1178 +#: ../../using/cmdline.rst:1184 msgid "" "If this variable is set to ``on`` or ``off``, it determines whether or not " "frozen modules are ignored by the import machinery. A value of ``on`` means " @@ -1480,68 +1505,68 @@ msgid "" "flag is set to ``off``." msgstr "" -#: ../../using/cmdline.rst:1186 -#, fuzzy +#: ../../using/cmdline.rst:1192 msgid "See also the :option:`-X frozen_modules <-X>` command-line option." -msgstr "另請參閱 :option:`-P` 和 :option:`-I` (isolated) 選項。" +msgstr "另請參閱 :option:`-X frozen_modules <-X>` 命令列選項。" -#: ../../using/cmdline.rst:1192 +#: ../../using/cmdline.rst:1198 msgid "" "If this variable is set to ``1``, the interpreter will colorize various " -"kinds of output. Setting it to ``0`` deactivates this behavior. See also :" -"ref:`using-on-controlling-color`." +"kinds of output. Setting it to ``0`` deactivates this behavior. See " +"also :ref:`using-on-controlling-color`." msgstr "" -#: ../../using/cmdline.rst:1200 +#: ../../using/cmdline.rst:1206 msgid "" "If this variable is set to any value, the interpreter will not attempt to " -"load the Python-based :term:`REPL` that requires :mod:`curses` and :mod:" -"`readline`, and will instead use the traditional parser-based :term:`REPL`." +"load the Python-based :term:`REPL` that requires :mod:`curses` " +"and :mod:`readline`, and will instead use the traditional parser-" +"based :term:`REPL`." msgstr "" -#: ../../using/cmdline.rst:1209 +#: ../../using/cmdline.rst:1215 msgid "" -"This environment variable can be used to set the location of a ``." -"python_history`` file (by default, it is ``.python_history`` in the user's " -"home directory)." +"This environment variable can be used to set the location of a " +"``.python_history`` file (by default, it is ``.python_history`` in the " +"user's home directory)." msgstr "" -#: ../../using/cmdline.rst:1217 +#: ../../using/cmdline.rst:1223 msgid "" "If this variable is set to ``1``, the global interpreter lock (GIL) will be " "forced on. Setting it to ``0`` forces the GIL off (needs Python configured " "with the :option:`--disable-gil` build option)." msgstr "" -#: ../../using/cmdline.rst:1221 +#: ../../using/cmdline.rst:1227 msgid "" "See also the :option:`-X gil <-X>` command-line option, which takes " "precedence over this variable, and :ref:`whatsnew313-free-threaded-cpython`." msgstr "" -#: ../../using/cmdline.rst:1227 +#: ../../using/cmdline.rst:1233 msgid "Debug-mode variables" msgstr "除錯模式變數" -#: ../../using/cmdline.rst:1231 +#: ../../using/cmdline.rst:1237 msgid "" "If set, Python will dump objects and reference counts still alive after " "shutting down the interpreter." msgstr "" -#: ../../using/cmdline.rst:1234 ../../using/cmdline.rst:1242 +#: ../../using/cmdline.rst:1240 ../../using/cmdline.rst:1248 msgid "" "Needs Python configured with the :option:`--with-trace-refs` build option." msgstr "" -#: ../../using/cmdline.rst:1238 +#: ../../using/cmdline.rst:1244 msgid "" "If set, Python will dump objects and reference counts still alive after " "shutting down the interpreter into a file under the path given as the value " "to this environment variable." msgstr "" -#: ../../using/cmdline.rst:1248 +#: ../../using/cmdline.rst:1254 msgid "" "If this variable is set to a module, that module will be imported early in " "the interpreter lifecycle, before the :mod:`site` module is executed, and " @@ -1549,22 +1574,22 @@ msgid "" "is not treated as :mod:`__main__`." msgstr "" -#: ../../using/cmdline.rst:1253 +#: ../../using/cmdline.rst:1259 msgid "This can be used to execute code early during Python initialization." msgstr "" -#: ../../using/cmdline.rst:1255 +#: ../../using/cmdline.rst:1261 msgid "" "To import a submodule, use ``package.module`` as the value, like in an " "import statement." msgstr "" -#: ../../using/cmdline.rst:1258 +#: ../../using/cmdline.rst:1264 msgid "" "See also the :option:`-X presite <-X>` command-line option, which takes " "precedence over this variable." msgstr "" -#: ../../using/cmdline.rst:1261 +#: ../../using/cmdline.rst:1267 msgid "Needs Python configured with the :option:`--with-pydebug` build option." msgstr "" diff --git a/using/configure.po b/using/configure.po index edacd303ff..b23391790f 100644 --- a/using/configure.po +++ b/using/configure.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-31 00:13+0000\n" +"POT-Creation-Date: 2025-02-22 08:51+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,6 +35,9 @@ msgid "" "features <https://en.wikipedia.org/wiki/" "C11_(C_standard_revision)#Optional_features>`_ are not required." msgstr "" +"一個 `C11 <https://en.cppreference.com/w/c/11>`_ 編譯器。`選擇性 C11 功能 " +"<https://en.wikipedia.org/wiki/" +"C11_(C_standard_revision)#Optional_features>`_\\ 並非必要。" #: ../../using/configure.rst:17 msgid "On Windows, Microsoft Visual Studio 2017 or later is required." @@ -46,6 +49,8 @@ msgid "" "point numbers and `floating-point Not-a-Number (NaN) <https://" "en.wikipedia.org/wiki/NaN#Floating_point>`_." msgstr "" +"支援 `IEEE 754 <https://en.wikipedia.org/wiki/IEEE_754>`_ 浮點數與\\ `浮點數" +"非數值 (NaN) <https://en.wikipedia.org/wiki/NaN#Floating_point>`_。" #: ../../using/configure.rst:23 msgid "Support for threads." @@ -56,6 +61,8 @@ msgid "" "OpenSSL 1.1.1 is the minimum version and OpenSSL 3.0.9 is the recommended " "minimum version for the :mod:`ssl` and :mod:`hashlib` extension modules." msgstr "" +"OpenSSL 1.1.1 是最低版本,OpenSSL 3.0.9 是 :mod:`ssl` 與 :mod:`hashlib` 擴充" +"模組的建議最低版本。" #: ../../using/configure.rst:28 msgid "SQLite 3.15.2 for the :mod:`sqlite3` extension module." @@ -595,11 +602,11 @@ msgstr "``pkg-config`` 選項。" msgid "C compiler options" msgstr "C 編譯器選項。" -#: ../../using/configure.rst:338 ../../using/configure.rst:1245 +#: ../../using/configure.rst:338 ../../using/configure.rst:1251 msgid "C compiler command." msgstr "C 編譯器指令。" -#: ../../using/configure.rst:342 ../../using/configure.rst:1257 +#: ../../using/configure.rst:342 ../../using/configure.rst:1263 msgid "C compiler flags." msgstr "C 編譯器旗標。" @@ -809,7 +816,7 @@ msgstr "``no``:不要執行 ensurepip;" #: ../../using/configure.rst:531 msgid "Performance options" -msgstr "" +msgstr "效能選項" #: ../../using/configure.rst:533 msgid "" @@ -1080,17 +1087,19 @@ msgstr "" #: ../../using/configure.rst:714 msgid "Debug options" -msgstr "" +msgstr "偵錯選項" #: ../../using/configure.rst:718 msgid "" ":ref:`Build Python in debug mode <debug-build>`: define the ``Py_DEBUG`` " "macro (disabled by default)." msgstr "" +":ref:`以偵錯模式建置 Python <debug-build>`:定義 ``Py_DEBUG`` 巨集(預設不啟" +"用)。" #: ../../using/configure.rst:723 msgid "Enable tracing references for debugging purpose (disabled by default)." -msgstr "" +msgstr "以偵錯為目的啟用參照追蹤(預設不啟用)。" #: ../../using/configure.rst:727 msgid "Define the ``Py_TRACE_REFS`` macro." @@ -1109,34 +1118,42 @@ msgid "" "The :envvar:`PYTHONDUMPREFS` environment variable can be used to dump " "objects and reference counts still alive at Python exit." msgstr "" +":envvar:`PYTHONDUMPREFS` 環境變數可以用來在 Python 結束時轉儲仍然有效的物件和" +"參照計數。" #: ../../using/configure.rst:734 msgid ":ref:`Statically allocated objects <static-types>` are not traced." -msgstr "" +msgstr "不追蹤\\ :ref:`靜態配置的物件 <static-types>`。" #: ../../using/configure.rst:738 msgid "" "This build is now ABI compatible with release build and :ref:`debug build " "<debug-build>`." msgstr "" +"這個建置現在與發佈版本建置和\\ :ref:`偵錯建置 <debug-build>`\\ 具有 ABI 相容" +"性。" #: ../../using/configure.rst:744 msgid "" "Build with C assertions enabled (default is no): ``assert(...);`` and " "``_PyObject_ASSERT(...);``." msgstr "" +"啟用 C 斷言建置(預設不啟用):``assert(...);`` 和 " +"``_PyObject_ASSERT(...);``。" #: ../../using/configure.rst:747 msgid "" "If set, the ``NDEBUG`` macro is not defined in the :envvar:`OPT` compiler " "variable." -msgstr "" +msgstr "如果設定,``NDEBUG`` 巨集不會在 :envvar:`OPT` 編譯器變數中定義。" #: ../../using/configure.rst:750 msgid "" "See also the :option:`--with-pydebug` option (:ref:`debug build <debug-" "build>`) which also enables assertions." msgstr "" +"另請參閱 :option:`--with-pydebug` 選項(:ref:`debug build <debug-build>`)," +"它也啟用了斷言。" #: ../../using/configure.rst:757 msgid "Enable Valgrind support (default is no)." @@ -1150,22 +1167,24 @@ msgstr "啟用 DTrace 支援(預設不啟用)。" msgid "" "See :ref:`Instrumenting CPython with DTrace and SystemTap <instrumentation>`." msgstr "" +"請參閱\\ :ref:`使用 DTrace 和 SystemTap 檢測 CPython <instrumentation>`。" #: ../../using/configure.rst:770 msgid "" "Enable AddressSanitizer memory error detector, ``asan`` (default is no)." -msgstr "" +msgstr "啟用 AddressSanitizer 記憶體錯誤偵測器 ``asan``\\ (預設不啟用)。" #: ../../using/configure.rst:776 msgid "" "Enable MemorySanitizer allocation error detector, ``msan`` (default is no)." -msgstr "" +msgstr "啟用 MemorySanitizer 分配錯誤偵測器 ``msan``\\ (預設不啟用)。" #: ../../using/configure.rst:782 msgid "" "Enable UndefinedBehaviorSanitizer undefined behaviour detector, ``ubsan`` " "(default is no)." msgstr "" +"啟用 UndefinedBehaviorSanitizer 未定義行為偵測器 ``ubsan``\\ (預設不啟用)。" #: ../../using/configure.rst:789 msgid "Enable ThreadSanitizer data race detector, ``tsan`` (default is no)." @@ -1173,13 +1192,15 @@ msgstr "啟用 ThreadSanitizer 資料競爭偵測器 ``tsan``\\ (預設不啟 #: ../../using/configure.rst:800 msgid "Enable building a shared Python library: ``libpython`` (default is no)." -msgstr "" +msgstr "啟用建置共享 Python 函式庫:``libpython``\\ (預設不啟用)。" #: ../../using/configure.rst:804 msgid "" "Do not build ``libpythonMAJOR.MINOR.a`` and do not install ``python.o`` " "(built and enabled by default)." msgstr "" +"不要建置 ``libpythonMAJOR.MINOR.a`` 並且不要安裝 ``python.o``\\ (預設會建置" +"並啟用)。" #: ../../using/configure.rst:811 msgid "Libraries options" @@ -1193,23 +1214,25 @@ msgstr "" msgid "" "Build the :mod:`!pyexpat` module using an installed ``expat`` library " "(default is no)." -msgstr "" +msgstr "使用已安裝的 ``expat`` 函式庫建置 :mod:`!pyexpat` 模組(預設不建置)。" #: ../../using/configure.rst:824 msgid "" "Build the ``_decimal`` extension module using an installed ``mpdecimal`` " "library, see the :mod:`decimal` module (default is yes)." msgstr "" +"使用已安裝的 ``mpdecimal`` 函式庫建置 ``_decimal`` 擴充模組,請參" +"閱 :mod:`decimal` 模組(預設建置)。" #: ../../using/configure.rst:829 msgid "Default to using the installed ``mpdecimal`` library." -msgstr "" +msgstr "預設使用已安裝的 ``mpdecimal`` 函式庫。" #: ../../using/configure.rst:832 msgid "" "A copy of the ``mpdecimal`` library sources will no longer be distributed " "with Python 3.15." -msgstr "" +msgstr "Python 3.15 不再隨附 ``mpdecimal`` 函式庫的原始碼副本。" #: ../../using/configure.rst:836 msgid ":option:`LIBMPDEC_CFLAGS` and :option:`LIBMPDEC_LIBS`." @@ -1374,44 +1397,53 @@ msgid "Options:" msgstr "選項:" #: ../../using/configure.rst:951 -msgid "``universal2``;" -msgstr "``universal2``;" +msgid "``universal2`` (x86-64 and arm64);" +msgstr "``universal2``\\ (x86-64 與 arm64);" #: ../../using/configure.rst:952 -msgid "``32-bit``;" -msgstr "``32-bit``;" +msgid "``32-bit`` (PPC and i386);" +msgstr "``32-bit``\\ (PPC 與 i386);" #: ../../using/configure.rst:953 -msgid "``64-bit``;" -msgstr "``64-bit``;" +msgid "``64-bit`` (PPC64 and x86-64);" +msgstr "``64-bit``\\ (PPC64 與 x86-64);" #: ../../using/configure.rst:954 -msgid "``3-way``;" -msgstr "``3-way``;" +msgid "``3-way`` (i386, PPC and x86-64);" +msgstr "``3-way``\\ (i386、PPC 與 x86-64);" #: ../../using/configure.rst:955 -msgid "``intel``;" -msgstr "``intel``;" +msgid "``intel`` (i386 and x86-64);" +msgstr "``intel``\\ (i386 與 x86-64);" #: ../../using/configure.rst:956 -msgid "``intel-32``;" -msgstr "``intel-32``;" +msgid "``intel-32`` (i386);" +msgstr "``intel-32``\\ (i386);" #: ../../using/configure.rst:957 -msgid "``intel-64``;" -msgstr "``intel-64``;" +msgid "``intel-64`` (x86-64);" +msgstr "``intel-64``\\ (x86-64);" #: ../../using/configure.rst:958 -msgid "``all``." -msgstr "``all``。" +msgid "``all`` (PPC, i386, PPC64 and x86-64)." +msgstr "``all``\\ (PPC、i386、PPC64 與 x86-64)。" -#: ../../using/configure.rst:962 +#: ../../using/configure.rst:960 +msgid "" +"Note that values for this configuration item are *not* the same as the " +"identifiers used for universal binary wheels on macOS. See the Python " +"Packaging User Guide for details on the `packaging platform compatibility " +"tags used on macOS <https://packaging.python.org/en/latest/specifications/" +"platform-compatibility-tags/#macos>`_" +msgstr "" + +#: ../../using/configure.rst:968 msgid "" "Specify the name for the python framework on macOS only valid " "when :option:`--enable-framework` is set (default: ``Python``)." msgstr "" -#: ../../using/configure.rst:968 +#: ../../using/configure.rst:974 msgid "" "The Python standard library contains strings that are known to trigger " "automated inspection tool errors when submitted for distribution by the " @@ -1420,29 +1452,29 @@ msgid "" "can also be specified. This option is disabled by default." msgstr "" -#: ../../using/configure.rst:977 +#: ../../using/configure.rst:983 msgid "iOS Options" msgstr "iOS 選項" -#: ../../using/configure.rst:979 +#: ../../using/configure.rst:985 msgid "See :source:`iOS/README.rst`." msgstr "參閱 :source:`iOS/README.rst`。" -#: ../../using/configure.rst:983 +#: ../../using/configure.rst:989 msgid "" "Create a Python.framework. Unlike macOS, the *INSTALLDIR* argument " "specifying the installation path is mandatory." msgstr "" -#: ../../using/configure.rst:988 +#: ../../using/configure.rst:994 msgid "Specify the name for the framework (default: ``Python``)." msgstr "指定框架的名稱(預設值:``Python``)。" -#: ../../using/configure.rst:992 +#: ../../using/configure.rst:998 msgid "Cross Compiling Options" msgstr "" -#: ../../using/configure.rst:994 +#: ../../using/configure.rst:1000 msgid "" "Cross compiling, also known as cross building, can be used to build Python " "for another CPU architecture or platform. Cross compiling requires a Python " @@ -1450,28 +1482,28 @@ msgid "" "match the version of the cross compiled host Python." msgstr "" -#: ../../using/configure.rst:1001 +#: ../../using/configure.rst:1007 msgid "" "configure for building on BUILD, usually guessed by :program:`config.guess`." msgstr "" -#: ../../using/configure.rst:1005 +#: ../../using/configure.rst:1011 msgid "cross-compile to build programs to run on HOST (target platform)" msgstr "" -#: ../../using/configure.rst:1009 +#: ../../using/configure.rst:1015 msgid "path to build ``python`` binary for cross compiling" msgstr "" -#: ../../using/configure.rst:1015 +#: ../../using/configure.rst:1021 msgid "An environment variable that points to a file with configure overrides." msgstr "" -#: ../../using/configure.rst:1017 +#: ../../using/configure.rst:1023 msgid "Example *config.site* file:" -msgstr "" +msgstr "範例 *config.site* 檔案:" -#: ../../using/configure.rst:1019 +#: ../../using/configure.rst:1025 msgid "" "# config.site-aarch64\n" "ac_cv_buggy_getaddrinfo=no\n" @@ -1483,15 +1515,15 @@ msgstr "" "ac_cv_file__dev_ptmx=yes\n" "ac_cv_file__dev_ptc=no" -#: ../../using/configure.rst:1028 +#: ../../using/configure.rst:1034 msgid "Program to run CPython for the host platform for cross-compilation." msgstr "" -#: ../../using/configure.rst:1033 +#: ../../using/configure.rst:1039 msgid "Cross compiling example::" msgstr "" -#: ../../using/configure.rst:1035 +#: ../../using/configure.rst:1041 msgid "" "CONFIG_SITE=config.site-aarch64 ../configure \\\n" " --build=x86_64-pc-linux-gnu \\\n" @@ -1503,65 +1535,65 @@ msgstr "" " --host=aarch64-unknown-linux-gnu \\\n" " --with-build-python=../x86_64/python" -#: ../../using/configure.rst:1042 +#: ../../using/configure.rst:1048 msgid "Python Build System" msgstr "Python 建置系統" -#: ../../using/configure.rst:1045 +#: ../../using/configure.rst:1051 msgid "Main files of the build system" msgstr "建置系統的主要檔案" -#: ../../using/configure.rst:1047 +#: ../../using/configure.rst:1053 msgid ":file:`configure.ac` => :file:`configure`;" msgstr ":file:`configure.ac` => :file:`configure`;" -#: ../../using/configure.rst:1048 +#: ../../using/configure.rst:1054 msgid "" ":file:`Makefile.pre.in` => :file:`Makefile` (created by :file:`configure`);" msgstr "" ":file:`Makefile.pre.in` => :file:`Makefile`\\ (由 :file:`configure` 建立);" -#: ../../using/configure.rst:1049 +#: ../../using/configure.rst:1055 msgid ":file:`pyconfig.h` (created by :file:`configure`);" msgstr ":file:`pyconfig.h`\\ (由 :file:`configure` 建立);" -#: ../../using/configure.rst:1050 +#: ../../using/configure.rst:1056 msgid "" ":file:`Modules/Setup`: C extensions built by the Makefile " "using :file:`Module/makesetup` shell script;" msgstr "" -#: ../../using/configure.rst:1054 +#: ../../using/configure.rst:1060 msgid "Main build steps" msgstr "主要建置步驟" -#: ../../using/configure.rst:1056 +#: ../../using/configure.rst:1062 msgid "C files (``.c``) are built as object files (``.o``)." -msgstr "" +msgstr "C 檔案(``.c``)被建置為目的檔(``.o``)。" -#: ../../using/configure.rst:1057 +#: ../../using/configure.rst:1063 msgid "A static ``libpython`` library (``.a``) is created from objects files." msgstr "" -#: ../../using/configure.rst:1058 +#: ../../using/configure.rst:1064 msgid "" "``python.o`` and the static ``libpython`` library are linked into the final " "``python`` program." msgstr "" -#: ../../using/configure.rst:1060 +#: ../../using/configure.rst:1066 msgid "C extensions are built by the Makefile (see :file:`Modules/Setup`)." msgstr "" -#: ../../using/configure.rst:1063 +#: ../../using/configure.rst:1069 msgid "Main Makefile targets" msgstr "主要 Makefile 目標" -#: ../../using/configure.rst:1066 +#: ../../using/configure.rst:1072 msgid "make" msgstr "make" -#: ../../using/configure.rst:1068 +#: ../../using/configure.rst:1074 msgid "" "For the most part, when rebuilding after editing some code or refreshing " "your checkout from upstream, all you need to do is execute ``make``, which " @@ -1572,20 +1604,20 @@ msgid "" "all`` will build. The three choices are:" msgstr "" -#: ../../using/configure.rst:1077 +#: ../../using/configure.rst:1083 msgid "``profile-opt`` (configured with ``--enable-optimizations``)" -msgstr "" +msgstr "``profile-opt``\\ (使用 ``--enable-optimizations`` 配置)" -#: ../../using/configure.rst:1078 +#: ../../using/configure.rst:1084 msgid "``build_wasm`` (configured with ``--with-emscripten-target``)" -msgstr "" +msgstr "``build_wasm``\\ (使用 ``--with-emscripten-target`` 配置)" -#: ../../using/configure.rst:1079 +#: ../../using/configure.rst:1085 msgid "" "``build_all`` (configured without explicitly using either of the others)" -msgstr "" +msgstr "``build_all``\\ (未明確使用其他選項進行配置)" -#: ../../using/configure.rst:1081 +#: ../../using/configure.rst:1087 msgid "" "Depending on the most recent source file changes, Make will rebuild any " "targets (object files and executables) deemed out-of-date, including running " @@ -1598,11 +1630,11 @@ msgid "" "problems, at the expense of longer build times." msgstr "" -#: ../../using/configure.rst:1094 +#: ../../using/configure.rst:1100 msgid "make platform" msgstr "make platform" -#: ../../using/configure.rst:1096 +#: ../../using/configure.rst:1102 msgid "" "Build the ``python`` program, but don't build the standard library extension " "modules. This generates a file named ``platform`` which contains a single " @@ -1610,81 +1642,81 @@ msgid "" "arm64-3.12`` or ``linux-x86_64-3.13``." msgstr "" -#: ../../using/configure.rst:1103 +#: ../../using/configure.rst:1109 msgid "make profile-opt" msgstr "make profile-opt" -#: ../../using/configure.rst:1105 +#: ../../using/configure.rst:1111 msgid "" "Build Python using profile-guided optimization (PGO). You can use the " "configure :option:`--enable-optimizations` option to make this the default " "target of the ``make`` command (``make all`` or just ``make``)." msgstr "" -#: ../../using/configure.rst:1113 +#: ../../using/configure.rst:1119 msgid "make clean" msgstr "make clean" -#: ../../using/configure.rst:1115 +#: ../../using/configure.rst:1121 msgid "Remove built files." msgstr "移除建置的檔案。" -#: ../../using/configure.rst:1119 +#: ../../using/configure.rst:1125 msgid "make distclean" msgstr "make distclean" -#: ../../using/configure.rst:1121 +#: ../../using/configure.rst:1127 msgid "" "In addition to the work done by ``make clean``, remove files created by the " "configure script. ``configure`` will have to be run before building again. " "[#]_" msgstr "" -#: ../../using/configure.rst:1127 +#: ../../using/configure.rst:1133 msgid "make install" msgstr "make install" -#: ../../using/configure.rst:1129 +#: ../../using/configure.rst:1135 msgid "Build the ``all`` target and install Python." msgstr "建置 ``all`` 目標並安裝 Python。" -#: ../../using/configure.rst:1133 +#: ../../using/configure.rst:1139 msgid "make test" msgstr "make test" -#: ../../using/configure.rst:1135 +#: ../../using/configure.rst:1141 msgid "" "Build the ``all`` target and run the Python test suite with the ``--fast-" "ci`` option. Variables:" msgstr "" -#: ../../using/configure.rst:1138 +#: ../../using/configure.rst:1144 msgid "``TESTOPTS``: additional regrtest command-line options." -msgstr "" +msgstr "``TESTOPTS``:額外的 regrtest 命令列選項。" -#: ../../using/configure.rst:1139 +#: ../../using/configure.rst:1145 msgid "``TESTPYTHONOPTS``: additional Python command-line options." -msgstr "" +msgstr "``TESTPYTHONOPTS``:額外的 Python 命令列選項。" -#: ../../using/configure.rst:1140 +#: ../../using/configure.rst:1146 msgid "``TESTTIMEOUT``: timeout in seconds (default: 10 minutes)." -msgstr "" +msgstr "``TESTTIMEOUT``:秒數表示的超時設定(預設值:10 分鐘)。" -#: ../../using/configure.rst:1144 +#: ../../using/configure.rst:1150 msgid "make buildbottest" msgstr "make buildbottest" -#: ../../using/configure.rst:1146 +#: ../../using/configure.rst:1152 msgid "" "This is similar to ``make test``, but uses the ``--slow-ci`` option and " "default timeout of 20 minutes, instead of ``--fast-ci`` option." msgstr "" -#: ../../using/configure.rst:1151 +#: ../../using/configure.rst:1157 msgid "make regen-all" msgstr "make regen-all" -#: ../../using/configure.rst:1153 +#: ../../using/configure.rst:1159 msgid "" "Regenerate (almost) all generated files. These include (but are not limited " "to) bytecode cases, and parser generator file. ``make regen-stdlib-module-" @@ -1692,18 +1724,18 @@ msgid "" "files <#generated-files>`_." msgstr "" -#: ../../using/configure.rst:1160 +#: ../../using/configure.rst:1166 msgid "C extensions" msgstr "C 擴充模組" -#: ../../using/configure.rst:1162 +#: ../../using/configure.rst:1168 msgid "" "Some C extensions are built as built-in modules, like the ``sys`` module. " "They are built with the ``Py_BUILD_CORE_BUILTIN`` macro defined. Built-in " "modules have no ``__file__`` attribute:" msgstr "" -#: ../../using/configure.rst:1166 +#: ../../using/configure.rst:1172 msgid "" ">>> import sys\n" ">>> sys\n" @@ -1721,14 +1753,14 @@ msgstr "" " File \"<stdin>\", line 1, in <module>\n" "AttributeError: module 'sys' has no attribute '__file__'" -#: ../../using/configure.rst:1176 +#: ../../using/configure.rst:1182 msgid "" "Other C extensions are built as dynamic libraries, like the ``_asyncio`` " "module. They are built with the ``Py_BUILD_CORE_MODULE`` macro defined. " "Example on Linux x86-64:" msgstr "" -#: ../../using/configure.rst:1180 +#: ../../using/configure.rst:1186 msgid "" ">>> import _asyncio\n" ">>> _asyncio\n" @@ -1744,7 +1776,7 @@ msgstr "" ">>> _asyncio.__file__\n" "'/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'" -#: ../../using/configure.rst:1188 +#: ../../using/configure.rst:1194 msgid "" ":file:`Modules/Setup` is used to generate Makefile targets to build C " "extensions. At the beginning of the files, C extensions are built as built-" @@ -1752,7 +1784,7 @@ msgid "" "dynamic libraries." msgstr "" -#: ../../using/configure.rst:1192 +#: ../../using/configure.rst:1198 msgid "" "The :c:macro:`!PyAPI_FUNC()`, :c:macro:`!PyAPI_DATA()` " "and :c:macro:`PyMODINIT_FUNC` macros of :file:`Include/exports.h` are " @@ -1760,92 +1792,92 @@ msgid "" "defined:" msgstr "" -#: ../../using/configure.rst:1196 +#: ../../using/configure.rst:1202 msgid "Use ``Py_EXPORTED_SYMBOL`` if the ``Py_BUILD_CORE_MODULE`` is defined" msgstr "如果定義了 ``Py_BUILD_CORE_MODULE``,則使用 ``Py_EXPORTED_SYMBOL``" -#: ../../using/configure.rst:1197 +#: ../../using/configure.rst:1203 msgid "Use ``Py_IMPORTED_SYMBOL`` otherwise." msgstr "否則使用 ``Py_IMPORTED_SYMBOL``。" -#: ../../using/configure.rst:1199 +#: ../../using/configure.rst:1205 msgid "" "If the ``Py_BUILD_CORE_BUILTIN`` macro is used by mistake on a C extension " "built as a shared library, its :samp:`PyInit_{xxx}()` function is not " "exported, causing an :exc:`ImportError` on import." msgstr "" -#: ../../using/configure.rst:1205 +#: ../../using/configure.rst:1211 msgid "Compiler and linker flags" msgstr "" -#: ../../using/configure.rst:1207 +#: ../../using/configure.rst:1213 msgid "" "Options set by the ``./configure`` script and environment variables and used " "by ``Makefile``." msgstr "" -#: ../../using/configure.rst:1211 +#: ../../using/configure.rst:1217 msgid "Preprocessor flags" msgstr "預處理器旗標" -#: ../../using/configure.rst:1215 +#: ../../using/configure.rst:1221 msgid "" "Value of :envvar:`CPPFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:1221 +#: ../../using/configure.rst:1227 msgid "" "(Objective) C/C++ preprocessor flags, e.g. :samp:`-I{include_dir}` if you " "have headers in a nonstandard directory *include_dir*." msgstr "" -#: ../../using/configure.rst:1224 ../../using/configure.rst:1414 +#: ../../using/configure.rst:1230 ../../using/configure.rst:1420 msgid "" "Both :envvar:`CPPFLAGS` and :envvar:`LDFLAGS` need to contain the shell's " "value to be able to build extension modules using the directories specified " "in the environment variables." msgstr "" -#: ../../using/configure.rst:1234 +#: ../../using/configure.rst:1240 msgid "" "Extra preprocessor flags added for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:1236 +#: ../../using/configure.rst:1242 msgid "" "Default: ``$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) $" "(CPPFLAGS)``." msgstr "" -#: ../../using/configure.rst:1241 +#: ../../using/configure.rst:1247 msgid "Compiler flags" msgstr "編譯器旗標" -#: ../../using/configure.rst:1247 +#: ../../using/configure.rst:1253 msgid "Example: ``gcc -pthread``." msgstr "範例:``gcc -pthread``。" -#: ../../using/configure.rst:1251 +#: ../../using/configure.rst:1257 msgid "C++ compiler command." msgstr "C++ 編譯器指令。" -#: ../../using/configure.rst:1253 +#: ../../using/configure.rst:1259 msgid "Example: ``g++ -pthread``." msgstr "範例:``g++ -pthread``。" -#: ../../using/configure.rst:1261 +#: ../../using/configure.rst:1267 msgid "" ":envvar:`CFLAGS_NODIST` is used for building the interpreter and stdlib C " "extensions. Use it when a compiler flag should *not* be part " "of :envvar:`CFLAGS` once Python is installed (:gh:`65320`)." msgstr "" -#: ../../using/configure.rst:1265 +#: ../../using/configure.rst:1271 msgid "In particular, :envvar:`CFLAGS` should not contain:" msgstr "" -#: ../../using/configure.rst:1267 +#: ../../using/configure.rst:1273 msgid "" "the compiler flag ``-I`` (for setting the search path for include files). " "The ``-I`` flags are processed from left to right, and any flags " @@ -1853,144 +1885,151 @@ msgid "" "I`` flags." msgstr "" -#: ../../using/configure.rst:1272 +#: ../../using/configure.rst:1278 msgid "" "hardening flags such as ``-Werror`` because distributions cannot control " "whether packages installed by users conform to such heightened standards." msgstr "" -#: ../../using/configure.rst:1280 +#: ../../using/configure.rst:1286 msgid "" "Options passed to the :mod:`compileall` command line when building PYC files " "in ``make install``. Default: ``-j0``." msgstr "" -#: ../../using/configure.rst:1287 +#: ../../using/configure.rst:1293 msgid "Extra C compiler flags." msgstr "額外的 C 編譯器旗標。" -#: ../../using/configure.rst:1291 +#: ../../using/configure.rst:1297 msgid "" "Value of :envvar:`CFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:1298 +#: ../../using/configure.rst:1304 msgid "" "Value of :envvar:`CFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: ../../using/configure.rst:1305 +#: ../../using/configure.rst:1311 msgid "Base compiler flags." msgstr "基本編譯器旗標。" -#: ../../using/configure.rst:1309 +#: ../../using/configure.rst:1315 msgid "Optimization flags." msgstr "最佳化旗標。" -#: ../../using/configure.rst:1313 +#: ../../using/configure.rst:1319 msgid "Strict or non-strict aliasing flags used to compile ``Python/dtoa.c``." msgstr "" -#: ../../using/configure.rst:1319 +#: ../../using/configure.rst:1325 msgid "Compiler flags used to build a shared library." -msgstr "" +msgstr "用於建置共享函式庫的編譯器旗標。" -#: ../../using/configure.rst:1321 +#: ../../using/configure.rst:1327 msgid "For example, ``-fPIC`` is used on Linux and on BSD." msgstr "例如說 ``-fPIC`` 被使用於 Linux 與 BSD 上。" -#: ../../using/configure.rst:1325 +#: ../../using/configure.rst:1331 msgid "Extra C flags added for building the interpreter object files." -msgstr "" +msgstr "用於建置直譯器目的檔的額外 C 旗標。" -#: ../../using/configure.rst:1327 +#: ../../using/configure.rst:1333 msgid "" "Default: ``$(CCSHARED)`` when :option:`--enable-shared` is used, or an empty " "string otherwise." msgstr "" +"預設值:當使用 :option:`--enable-shared` 時為 ``$(CCSHARED)``,否則為空字串。" -#: ../../using/configure.rst:1332 +#: ../../using/configure.rst:1338 msgid "" "Default: ``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $" "(EXTRA_CFLAGS)``." msgstr "" +"預設值:``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $" +"(EXTRA_CFLAGS)``。" -#: ../../using/configure.rst:1336 +#: ../../using/configure.rst:1342 msgid "" "Default: ``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/" "internal``." msgstr "" +"預設值:``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/" +"internal``。" -#: ../../using/configure.rst:1342 +#: ../../using/configure.rst:1348 msgid "C flags used for building the interpreter object files." -msgstr "" +msgstr "用於建置直譯器目的檔的 C 旗標。" -#: ../../using/configure.rst:1344 +#: ../../using/configure.rst:1350 msgid "" "Default: ``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $" "(CFLAGSFORSHARED)``." msgstr "" +"預設值:``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $" +"(CFLAGSFORSHARED)``。" -#: ../../using/configure.rst:1350 +#: ../../using/configure.rst:1356 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``." -msgstr "" +msgstr "預設值:``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``。" -#: ../../using/configure.rst:1356 +#: ../../using/configure.rst:1362 msgid "" "Compiler flags to build a standard library extension module as a built-in " "module, like the :mod:`posix` module." msgstr "" -#: ../../using/configure.rst:1359 +#: ../../using/configure.rst:1365 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``." -msgstr "" +msgstr "預設值:``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``。" -#: ../../using/configure.rst:1365 +#: ../../using/configure.rst:1371 msgid "Purify command. Purify is a memory debugger program." msgstr "" -#: ../../using/configure.rst:1367 +#: ../../using/configure.rst:1373 msgid "Default: empty string (not used)." -msgstr "" +msgstr "預設值:空字串(未使用)。" -#: ../../using/configure.rst:1371 +#: ../../using/configure.rst:1377 msgid "Linker flags" msgstr "" -#: ../../using/configure.rst:1375 +#: ../../using/configure.rst:1381 msgid "" "Linker command used to build programs like ``python`` and ``_testembed``." msgstr "" -#: ../../using/configure.rst:1377 +#: ../../using/configure.rst:1383 msgid "Default: ``$(PURIFY) $(CC)``." -msgstr "" +msgstr "預設值:``$(PURIFY) $(CC)``。" -#: ../../using/configure.rst:1381 +#: ../../using/configure.rst:1387 msgid "" "Value of :envvar:`LDFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:1383 +#: ../../using/configure.rst:1389 msgid "" "Avoid assigning :envvar:`CFLAGS`, :envvar:`LDFLAGS`, etc. so users can use " "them on the command line to append to these values without stomping the pre-" "set values." msgstr "" -#: ../../using/configure.rst:1391 +#: ../../using/configure.rst:1397 msgid "" ":envvar:`LDFLAGS_NODIST` is used in the same manner " "as :envvar:`CFLAGS_NODIST`. Use it when a linker flag should *not* be part " "of :envvar:`LDFLAGS` once Python is installed (:gh:`65320`)." msgstr "" -#: ../../using/configure.rst:1395 +#: ../../using/configure.rst:1401 msgid "In particular, :envvar:`LDFLAGS` should not contain:" msgstr "" -#: ../../using/configure.rst:1397 +#: ../../using/configure.rst:1403 msgid "" "the compiler flag ``-L`` (for setting the search path for libraries). The ``-" "L`` flags are processed from left to right, and any flags " @@ -1998,61 +2037,61 @@ msgid "" "``-L`` flags." msgstr "" -#: ../../using/configure.rst:1404 +#: ../../using/configure.rst:1410 msgid "" "Value of :envvar:`LDFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: ../../using/configure.rst:1411 +#: ../../using/configure.rst:1417 msgid "" "Linker flags, e.g. :samp:`-L{lib_dir}` if you have libraries in a " "nonstandard directory *lib_dir*." msgstr "" -#: ../../using/configure.rst:1420 +#: ../../using/configure.rst:1426 msgid "" "Linker flags to pass libraries to the linker when linking the Python " "executable." msgstr "" -#: ../../using/configure.rst:1423 +#: ../../using/configure.rst:1429 msgid "Example: ``-lrt``." msgstr "範例:``-lrt``。" -#: ../../using/configure.rst:1427 +#: ../../using/configure.rst:1433 msgid "Command to build a shared library." -msgstr "" +msgstr "建置共享函式庫的指令。" -#: ../../using/configure.rst:1429 +#: ../../using/configure.rst:1435 msgid "Default: ``@LDSHARED@ $(PY_LDFLAGS)``." msgstr "預設值:``@LDSHARED@ $(PY_LDFLAGS)``。" -#: ../../using/configure.rst:1433 +#: ../../using/configure.rst:1439 msgid "Command to build ``libpython`` shared library." -msgstr "" +msgstr "建置 ``libpython`` 共享函式庫的指令。" -#: ../../using/configure.rst:1435 +#: ../../using/configure.rst:1441 msgid "Default: ``@BLDSHARED@ $(PY_CORE_LDFLAGS)``." msgstr "預設值:``@BLDSHARED@ $(PY_CORE_LDFLAGS)``。" -#: ../../using/configure.rst:1439 +#: ../../using/configure.rst:1445 msgid "Default: ``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``." msgstr "預設值:``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``。" -#: ../../using/configure.rst:1443 +#: ../../using/configure.rst:1449 msgid "Default: ``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``." msgstr "預設值:``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``。" -#: ../../using/configure.rst:1449 +#: ../../using/configure.rst:1455 msgid "Linker flags used for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:1455 +#: ../../using/configure.rst:1461 msgid "Footnotes" msgstr "註腳" -#: ../../using/configure.rst:1456 +#: ../../using/configure.rst:1462 msgid "" "``git clean -fdx`` is an even more extreme way to \"clean\" your checkout. " "It removes all files not known to Git. When bug hunting using ``git " @@ -2061,6 +2100,3 @@ msgid "" "clean build. **Use with care**, as it will delete all files not checked into " "Git, including your new, uncommitted work." msgstr "" - -#~ msgid "Define the ``WITH_EDITLINE`` macro." -#~ msgstr "定義 ``WITH_EDITLINE`` 巨集。" diff --git a/using/editors.po b/using/editors.po index d066d58ae3..7aca16ba10 100644 --- a/using/editors.po +++ b/using/editors.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-09-13 00:11+0000\n" +"POT-Creation-Date: 2025-02-13 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,9 +29,28 @@ msgid "" "checks." msgstr "" -#: ../../using/editors.rst:12 +#: ../../using/editors.rst:14 +msgid "IDLE --- Python editor and shell" +msgstr "IDLE --- Python 編輯器與 shell" + +#: ../../using/editors.rst:16 +msgid "" +"IDLE is Python’s Integrated Development and Learning Environment and is " +"generally bundled with Python installs. If you are on Linux and do not have " +"IDLE installed see :ref:`Installing IDLE on Linux " +"<installing_idle_on_linux>`. For more information see the :ref:`IDLE docs " +"<idle>`." +msgstr "" + +#: ../../using/editors.rst:22 +msgid "Other Editors and IDEs" +msgstr "其他編輯器與 IDE" + +#: ../../using/editors.rst:24 msgid "" -"Please go to `Python Editors <https://wiki.python.org/moin/PythonEditors>`_ " -"and `Integrated Development Environments <https://wiki.python.org/moin/" -"IntegratedDevelopmentEnvironments>`_ for a comprehensive list." +"Python's community wiki has information submitted by the community on " +"Editors and IDEs. Please go to `Python Editors <https://wiki.python.org/moin/" +"PythonEditors>`_ and `Integrated Development Environments <https://" +"wiki.python.org/moin/IntegratedDevelopmentEnvironments>`_ for a " +"comprehensive list." msgstr "" diff --git a/using/ios.po b/using/ios.po index 1f08607933..504db08ea5 100644 --- a/using/ios.po +++ b/using/ios.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-10 00:15+0000\n" +"POT-Creation-Date: 2025-03-14 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -491,47 +491,41 @@ msgstr "" #: ../../using/ios.rst:299 msgid "" -"System logging (:c:member:`PyConfig.use_system_logger`) is *enabled* " -"(optional, but strongly recommended);" -msgstr "" - -#: ../../using/ios.rst:301 -msgid "" "``PYTHONHOME`` for the interpreter is configured to point at the ``python`` " "subfolder of your app's bundle; and" msgstr "" -#: ../../using/ios.rst:303 +#: ../../using/ios.rst:301 msgid "The ``PYTHONPATH`` for the interpreter includes:" msgstr "" -#: ../../using/ios.rst:305 +#: ../../using/ios.rst:303 msgid "the ``python/lib/python3.X`` subfolder of your app's bundle," msgstr "" -#: ../../using/ios.rst:306 +#: ../../using/ios.rst:304 msgid "" "the ``python/lib/python3.X/lib-dynload`` subfolder of your app's bundle, and" msgstr "" -#: ../../using/ios.rst:307 +#: ../../using/ios.rst:305 msgid "the ``app`` subfolder of your app's bundle" msgstr "" -#: ../../using/ios.rst:309 +#: ../../using/ios.rst:307 msgid "" "Your app's bundle location can be determined using ``[[NSBundle mainBundle] " "resourcePath]``." msgstr "" -#: ../../using/ios.rst:312 +#: ../../using/ios.rst:310 msgid "" "Steps 8, 9 and 10 of these instructions assume that you have a single folder " "of pure Python application code, named ``app``. If you have third-party " "binary modules in your app, some additional steps will be required:" msgstr "" -#: ../../using/ios.rst:316 +#: ../../using/ios.rst:314 msgid "" "You need to ensure that any folders containing third-party binaries are " "either associated with the app target, or copied in as part of step 8. Step " @@ -540,24 +534,24 @@ msgid "" "building an app targeting the simulator)." msgstr "" -#: ../../using/ios.rst:322 +#: ../../using/ios.rst:320 msgid "" "Any folders that contain third-party binaries must be processed into " "framework form by step 9. The invocation of ``install_dylib`` that processes " "the ``lib-dynload`` folder can be copied and adapted for this purpose." msgstr "" -#: ../../using/ios.rst:326 +#: ../../using/ios.rst:324 msgid "" "If you're using a separate folder for third-party packages, ensure that " "folder is included as part of the ``PYTHONPATH`` configuration in step 10." msgstr "" -#: ../../using/ios.rst:330 +#: ../../using/ios.rst:328 msgid "Testing a Python package" msgstr "" -#: ../../using/ios.rst:332 +#: ../../using/ios.rst:330 msgid "" "The CPython source tree contains :source:`a testbed project <iOS/testbed>` " "that is used to run the CPython test suite on the iOS simulator. This " @@ -565,19 +559,19 @@ msgid "" "library's test suite on iOS." msgstr "" -#: ../../using/ios.rst:336 +#: ../../using/ios.rst:334 msgid "" "After building or obtaining an iOS XCFramework (See :source:`iOS/README.rst` " "for details), create a clone of the Python iOS testbed project by running:" msgstr "" -#: ../../using/ios.rst:339 +#: ../../using/ios.rst:337 msgid "" "$ python iOS/testbed clone --framework <path/to/Python.xcframework> --app " "<path/to/module1> --app <path/to/module2> app-testbed" msgstr "" -#: ../../using/ios.rst:343 +#: ../../using/ios.rst:341 msgid "" "You will need to modify the ``iOS/testbed`` reference to point to that " "directory in the CPython source tree; any folders specified with the ``--" @@ -589,41 +583,41 @@ msgid "" "testbed/iOSTestbed/app_packages`` or similar)." msgstr "" -#: ../../using/ios.rst:352 +#: ../../using/ios.rst:350 msgid "" "You can then use the ``app-testbed`` folder to run the test suite for your " "app, For example, if ``module1.tests`` was the entry point to your test " "suite, you could run:" msgstr "" -#: ../../using/ios.rst:356 +#: ../../using/ios.rst:354 msgid "$ python app-testbed run -- module1.tests" msgstr "" -#: ../../using/ios.rst:360 +#: ../../using/ios.rst:358 msgid "" "This is the equivalent of running ``python -m module1.tests`` on a desktop " "Python build. Any arguments after the ``--`` will be passed to the testbed " "as if they were arguments to ``python -m`` on a desktop machine." msgstr "" -#: ../../using/ios.rst:364 +#: ../../using/ios.rst:362 msgid "You can also open the testbed project in Xcode by running:" msgstr "" -#: ../../using/ios.rst:366 +#: ../../using/ios.rst:364 msgid "$ open app-testbed/iOSTestbed.xcodeproj" msgstr "" -#: ../../using/ios.rst:370 +#: ../../using/ios.rst:368 msgid "This will allow you to use the full Xcode suite of tools for debugging." msgstr "" -#: ../../using/ios.rst:373 +#: ../../using/ios.rst:371 msgid "App Store Compliance" msgstr "" -#: ../../using/ios.rst:375 +#: ../../using/ios.rst:373 msgid "" "The only mechanism for distributing apps to third-party iOS devices is to " "submit the app to the iOS App Store; apps submitted for distribution must " @@ -632,7 +626,7 @@ msgid "" "problematic code." msgstr "" -#: ../../using/ios.rst:380 +#: ../../using/ios.rst:378 msgid "" "The Python standard library contains some code that is known to violate " "these automated rules. While these violations appear to be false positives, " @@ -640,7 +634,7 @@ msgid "" "Python standard library for an app to pass App Store review." msgstr "" -#: ../../using/ios.rst:385 +#: ../../using/ios.rst:383 msgid "" "The Python source tree contains :source:`a patch file <Mac/Resources/app-" "store-compliance.patch>` that will remove all code that is known to cause " diff --git a/using/unix.po b/using/unix.po index b27a082f0f..e33e46374a 100644 --- a/using/unix.po +++ b/using/unix.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-22 00:13+0000\n" +"POT-Creation-Date: 2025-03-20 00:14+0000\n" "PO-Revision-Date: 2023-03-27 12:40+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -57,7 +57,7 @@ msgstr "https://www.debian.org/doc/manuals/maint-guide/first.en.html" #: ../../using/unix.rst:30 msgid "for Debian users" -msgstr "對於 Debian 用戶" +msgstr "對於 Debian 使用者" #: ../../using/unix.rst:31 msgid "https://en.opensuse.org/Portal:Packaging" @@ -65,7 +65,7 @@ msgstr "https://en.opensuse.org/Portal:Packaging" #: ../../using/unix.rst:32 msgid "for OpenSuse users" -msgstr "對於 OpenSuse 用戶" +msgstr "對於 OpenSuse 使用者" #: ../../using/unix.rst:33 msgid "" @@ -77,7 +77,7 @@ msgstr "" #: ../../using/unix.rst:34 msgid "for Fedora users" -msgstr "對於 Fedora 用戶" +msgstr "對於 Fedora 使用者" #: ../../using/unix.rst:35 msgid "https://slackbook.org/html/package-management-making-packages.html" @@ -85,25 +85,69 @@ msgstr "https://slackbook.org/html/package-management-making-packages.html" #: ../../using/unix.rst:36 msgid "for Slackware users" -msgstr "對於 Slackware 用戶" +msgstr "對於 Slackware 使用者" -#: ../../using/unix.rst:40 +#: ../../using/unix.rst:41 +msgid "Installing IDLE" +msgstr "安裝 IDLE" + +#: ../../using/unix.rst:43 +msgid "In some cases, IDLE might not be included in your Python installation." +msgstr "在某些情況下,IDLE 可能不會包含在你的 Python 安裝中。" + +#: ../../using/unix.rst:45 +msgid "For Debian and Ubuntu users::" +msgstr "對於 Debian 和 Ubuntu 使用者: ::" + +#: ../../using/unix.rst:47 +msgid "" +"sudo apt update\n" +"sudo apt install idle" +msgstr "" +"sudo apt update\n" +"sudo apt install idle" + +#: ../../using/unix.rst:50 +msgid "For Fedora, RHEL, and CentOS users::" +msgstr "對於 Fedora、RHEL 和 CentOS 使用者: ::" + +#: ../../using/unix.rst:52 +msgid "sudo dnf install python3-idle" +msgstr "sudo dnf install python3-idle" + +#: ../../using/unix.rst:54 +msgid "For SUSE and OpenSUSE users::" +msgstr "對於 SUSE 和 OpenSUSE 使用者: ::" + +#: ../../using/unix.rst:56 +msgid "sudo zypper install python3-idle" +msgstr "sudo zypper install python3-idle" + +#: ../../using/unix.rst:58 +msgid "For Alpine Linux users::" +msgstr "對於 Alpine Linux 使用者: ::" + +#: ../../using/unix.rst:60 +msgid "sudo apk add python3-idle" +msgstr "sudo apk add python3-idle" + +#: ../../using/unix.rst:65 msgid "On FreeBSD and OpenBSD" msgstr "在 FreeBSD 和 OpenBSD 上" -#: ../../using/unix.rst:42 +#: ../../using/unix.rst:67 msgid "FreeBSD users, to add the package use::" -msgstr "FreeBSD 用戶應使用以下命令增加套件: ::" +msgstr "FreeBSD 使用者應使用以下命令增加套件: ::" -#: ../../using/unix.rst:44 +#: ../../using/unix.rst:69 msgid "pkg install python3" msgstr "pkg install python3" -#: ../../using/unix.rst:46 +#: ../../using/unix.rst:71 msgid "OpenBSD users, to add the package use::" -msgstr "OpenBSD 用戶應使用以下命令增加套件: ::" +msgstr "OpenBSD 使用者應使用以下命令增加套件: ::" -#: ../../using/unix.rst:48 +#: ../../using/unix.rst:73 msgid "" "pkg_add -r python\n" "\n" @@ -115,23 +159,23 @@ msgstr "" "pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/<insert your " "architecture here>/python-<version>.tgz" -#: ../../using/unix.rst:52 +#: ../../using/unix.rst:77 msgid "For example i386 users get the 2.5.1 version of Python using::" msgstr "例如 i386 使用者要取得 Python 2.5.1 的可用版本: ::" -#: ../../using/unix.rst:54 +#: ../../using/unix.rst:79 msgid "" -"pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/python-2.5.1p2." -"tgz" +"pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/" +"python-2.5.1p2.tgz" msgstr "" -"pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/python-2.5.1p2." -"tgz" +"pkg_add ftp://ftp.openbsd.org/pub/OpenBSD/4.2/packages/i386/" +"python-2.5.1p2.tgz" -#: ../../using/unix.rst:60 +#: ../../using/unix.rst:85 msgid "Building Python" msgstr "建置 Python" -#: ../../using/unix.rst:62 +#: ../../using/unix.rst:87 msgid "" "If you want to compile CPython yourself, first thing you should do is get " "the `source <https://www.python.org/downloads/source/>`_. You can download " @@ -144,11 +188,11 @@ msgstr "" "(克隆) <https://devguide.python.org/setup/#getting-the-source-code>`_。(如" "果你想要貢獻修補程式碼,也會需要一份 clone。)" -#: ../../using/unix.rst:68 +#: ../../using/unix.rst:93 msgid "The build process consists of the usual commands::" msgstr "建置過程由幾個常用命令組成: ::" -#: ../../using/unix.rst:70 +#: ../../using/unix.rst:95 msgid "" "./configure\n" "make\n" @@ -158,7 +202,7 @@ msgstr "" "make\n" "make install" -#: ../../using/unix.rst:74 +#: ../../using/unix.rst:99 msgid "" ":ref:`Configuration options <configure-options>` and caveats for specific " "Unix platforms are extensively documented in the :source:`README.rst` file " @@ -168,21 +212,21 @@ msgstr "" "地記錄在 Python 原始碼樹 (source tree) 根目錄下的 :source:`README.rst` 檔案" "中。" -#: ../../using/unix.rst:80 +#: ../../using/unix.rst:105 msgid "" "``make install`` can overwrite or masquerade the :file:`python3` binary. " "``make altinstall`` is therefore recommended instead of ``make install`` " "since it only installs :file:`{exec_prefix}/bin/python{version}`." msgstr "" "``make install`` 可以覆蓋或偽裝 :file:`python3` 二進位制檔案。因此,建議使用 " -"``make altinstall`` 而不是 ``make install``,因為它只安裝 :file:" -"`{exec_prefix}/bin/python{version}`。" +"``make altinstall`` 而不是 ``make install``,因為它只安" +"裝 :file:`{exec_prefix}/bin/python{version}`。" -#: ../../using/unix.rst:86 +#: ../../using/unix.rst:111 msgid "Python-related paths and files" msgstr "與 Python 相關的路徑和檔案" -#: ../../using/unix.rst:88 +#: ../../using/unix.rst:113 msgid "" "These are subject to difference depending on local installation " "conventions; :option:`prefix <--prefix>` and :option:`exec_prefix <--exec-" @@ -192,28 +236,28 @@ msgstr "" "這取決於本地安裝慣例;:option:`prefix <--prefix>` 和 :option:`exec_prefix <--" "exec-prefix>` 相依於安裝方式,應被直譯來讓 GNU 軟體使用;它們也可能相同。" -#: ../../using/unix.rst:93 +#: ../../using/unix.rst:118 msgid "" "For example, on most Linux systems, the default for both is :file:`/usr`." msgstr "例如,在大多數 Linux 系統上,兩者的預設值皆是 :file:`/usr`。" -#: ../../using/unix.rst:96 +#: ../../using/unix.rst:121 msgid "File/directory" msgstr "檔案/目錄" -#: ../../using/unix.rst:96 +#: ../../using/unix.rst:121 msgid "Meaning" msgstr "含意" -#: ../../using/unix.rst:98 +#: ../../using/unix.rst:123 msgid ":file:`{exec_prefix}/bin/python3`" msgstr ":file:`{exec_prefix}/bin/python3`" -#: ../../using/unix.rst:98 +#: ../../using/unix.rst:123 msgid "Recommended location of the interpreter." msgstr "直譯器的推薦位置。" -#: ../../using/unix.rst:100 +#: ../../using/unix.rst:125 msgid "" ":file:`{prefix}/lib/python{version}`, :file:`{exec_prefix}/lib/" "python{version}`" @@ -221,12 +265,12 @@ msgstr "" ":file:`{prefix}/lib/python{version}`、:file:`{exec_prefix}/lib/" "python{version}`" -#: ../../using/unix.rst:100 +#: ../../using/unix.rst:125 msgid "" "Recommended locations of the directories containing the standard modules." msgstr "包含標準模組目錄的推薦位置。" -#: ../../using/unix.rst:103 +#: ../../using/unix.rst:128 msgid "" ":file:`{prefix}/include/python{version}`, :file:`{exec_prefix}/include/" "python{version}`" @@ -234,59 +278,59 @@ msgstr "" ":file:`{prefix}/include/python{version}`、:file:`{exec_prefix}/include/" "python{version}`" -#: ../../using/unix.rst:103 +#: ../../using/unix.rst:128 msgid "" "Recommended locations of the directories containing the include files needed " "for developing Python extensions and embedding the interpreter." msgstr "" "包含開發 Python 擴充套件和嵌入直譯器所需 include 檔案之目錄的推薦位置。" -#: ../../using/unix.rst:111 +#: ../../using/unix.rst:136 msgid "Miscellaneous" msgstr "雜項" -#: ../../using/unix.rst:113 +#: ../../using/unix.rst:138 msgid "" "To easily use Python scripts on Unix, you need to make them executable, e.g. " "with" msgstr "" "要在 Unix 上使用 Python 腳本,你需要讓他們是可執行的 (executable),例如用" -#: ../../using/unix.rst:116 +#: ../../using/unix.rst:141 msgid "$ chmod +x script" msgstr "$ chmod +x script" -#: ../../using/unix.rst:120 +#: ../../using/unix.rst:145 msgid "" "and put an appropriate Shebang line at the top of the script. A good choice " "is usually ::" msgstr "並在腳本的頂部放一個合適的 Shebang。以下通常是個好選擇: ::" -#: ../../using/unix.rst:123 +#: ../../using/unix.rst:148 msgid "#!/usr/bin/env python3" msgstr "#!/usr/bin/env python3" -#: ../../using/unix.rst:125 +#: ../../using/unix.rst:150 msgid "" "which searches for the Python interpreter in the whole :envvar:`PATH`. " "However, some Unices may not have the :program:`env` command, so you may " "need to hardcode ``/usr/bin/python3`` as the interpreter path." msgstr "" -"將在整個 :envvar:`PATH` 中搜尋 Python 直譯器。然而某些 Unix 系統可能沒有 :" -"program:`env` 命令,因此你可能需要將 ``/usr/bin/python3`` 寫死 (hardcode) 成" -"直譯器路徑。" +"將在整個 :envvar:`PATH` 中搜尋 Python 直譯器。然而某些 Unix 系統可能沒" +"有 :program:`env` 命令,因此你可能需要將 ``/usr/bin/python3`` 寫死 " +"(hardcode) 成直譯器路徑。" -#: ../../using/unix.rst:129 +#: ../../using/unix.rst:154 msgid "" "To use shell commands in your Python scripts, look at the :mod:`subprocess` " "module." msgstr "要在 Python 腳本中使用 shell 命令,請見 :mod:`subprocess` 模組。" -#: ../../using/unix.rst:134 +#: ../../using/unix.rst:159 msgid "Custom OpenSSL" msgstr "客製化 OpenSSL" -#: ../../using/unix.rst:136 +#: ../../using/unix.rst:161 msgid "" "To use your vendor's OpenSSL configuration and system trust store, locate " "the directory with ``openssl.cnf`` file or symlink in ``/etc``. On most " @@ -299,7 +343,7 @@ msgstr "" "(symlink)。在大多數發行版上,該檔案會是在 ``/etc/ssl`` 或者 ``/etc/pki/tls`` " "中。該目錄亦應包含一個 ``cert.pem`` 檔案和/或一個 ``certs`` 目錄。" -#: ../../using/unix.rst:142 +#: ../../using/unix.rst:167 msgid "" "$ find /etc/ -name openssl.cnf -printf \"%h\\n\"\n" "/etc/ssl" @@ -307,7 +351,7 @@ msgstr "" "$ find /etc/ -name openssl.cnf -printf \"%h\\n\"\n" "/etc/ssl" -#: ../../using/unix.rst:147 +#: ../../using/unix.rst:172 msgid "" "Download, build, and install OpenSSL. Make sure you use ``install_sw`` and " "not ``install``. The ``install_sw`` target does not override ``openssl.cnf``." @@ -315,7 +359,7 @@ msgstr "" "下載、建置並安裝 OpenSSL。請確保你使用 ``install_sw`` 而不是 ``install``。" "``install_sw`` 的目標不會覆蓋 ``openssl.cnf``。" -#: ../../using/unix.rst:151 +#: ../../using/unix.rst:176 msgid "" "$ curl -O https://www.openssl.org/source/openssl-VERSION.tar.gz\n" "$ tar xzf openssl-VERSION\n" @@ -341,7 +385,7 @@ msgstr "" "$ make install_sw\n" "$ popd" -#: ../../using/unix.rst:165 +#: ../../using/unix.rst:190 msgid "" "Build Python with custom OpenSSL (see the configure ``--with-openssl`` and " "``--with-openssl-rpath`` options)" @@ -349,7 +393,7 @@ msgstr "" "使用客製化 OpenSSL 建置 Python(參見配置 ``--with-openssl`` 和 ``--with-" "openssl-rpath`` 選項)" -#: ../../using/unix.rst:168 +#: ../../using/unix.rst:193 msgid "" "$ pushd python-3.x.x\n" "$ ./configure -C \\\n" @@ -367,7 +411,7 @@ msgstr "" "$ make -j8\n" "$ make altinstall" -#: ../../using/unix.rst:180 +#: ../../using/unix.rst:205 msgid "" "Patch releases of OpenSSL have a backwards compatible ABI. You don't need to " "recompile Python to update OpenSSL. It's sufficient to replace the custom " diff --git a/whatsnew/2.0.po b/whatsnew/2.0.po index a8df302c59..b5f4fa59a4 100644 --- a/whatsnew/2.0.po +++ b/whatsnew/2.0.po @@ -156,8 +156,8 @@ msgid "" "up to write Python Enhancement Proposals (PEPs), modelled on the internet " "RFC process. PEPs are draft documents that describe a proposed new feature, " "and are continually revised until the community reaches a consensus, either " -"accepting or rejecting the proposal. Quoting from the introduction to :pep:" -"`1`, \"PEP Purpose and Guidelines\":" +"accepting or rejecting the proposal. Quoting from the introduction " +"to :pep:`1`, \"PEP Purpose and Guidelines\":" msgstr "" #: ../../whatsnew/2.0.rst:120 @@ -211,10 +211,10 @@ msgstr "" #: ../../whatsnew/2.0.rst:155 msgid "" "In Python source code, Unicode strings are written as ``u\"string\"``. " -"Arbitrary Unicode characters can be written using a new escape sequence, :" -"samp:`\\\\u{HHHH}`, where *HHHH* is a 4-digit hexadecimal number from 0000 " -"to FFFF. The existing :samp:`\\\\x{HH}` escape sequence can also be used, " -"and octal escapes can be used for characters up to U+01FF, which is " +"Arbitrary Unicode characters can be written using a new escape " +"sequence, :samp:`\\\\u{HHHH}`, where *HHHH* is a 4-digit hexadecimal number " +"from 0000 to FFFF. The existing :samp:`\\\\x{HH}` escape sequence can also " +"be used, and octal escapes can be used for characters up to U+01FF, which is " "represented by ``\\777``." msgstr "" @@ -321,9 +321,9 @@ msgstr "" #: ../../whatsnew/2.0.rst:224 msgid "" "*stream_writer*, similarly, is a class that supports encoding output to a " -"stream. *stream_writer(file_obj)* returns an object that supports the :meth:" -"`!write` and :meth:`!writelines` methods. These methods expect Unicode " -"strings, translating them to the given encoding on output." +"stream. *stream_writer(file_obj)* returns an object that supports " +"the :meth:`!write` and :meth:`!writelines` methods. These methods expect " +"Unicode strings, translating them to the given encoding on output." msgstr "" #: ../../whatsnew/2.0.rst:229 @@ -454,9 +454,9 @@ msgid "" "iterated over. The sequences do not have to be the same length, because " "they are *not* iterated over in parallel, but from left to right; this is " "explained more clearly in the following paragraphs. The elements of the " -"generated list will be the successive values of *expression*. The final :" -"keyword:`!if` clause is optional; if present, *expression* is only evaluated " -"and added to the result if *condition* is true." +"generated list will be the successive values of *expression*. The " +"final :keyword:`!if` clause is optional; if present, *expression* is only " +"evaluated and added to the result if *condition* is true." msgstr "" #: ../../whatsnew/2.0.rst:307 @@ -589,8 +589,8 @@ msgid "" "which was usually a front-end for the :mod:`!strop` module written in C. " "The addition of Unicode posed a difficulty for the :mod:`!strop` module, " "because the functions would all need to be rewritten in order to accept " -"either 8-bit or Unicode strings. For functions such as :func:`!string." -"replace`, which takes 3 string arguments, that means eight possible " +"either 8-bit or Unicode strings. For functions such as :func:`!" +"string.replace`, which takes 3 string arguments, that means eight possible " "permutations, and correspondingly complicated code." msgstr "" @@ -635,11 +635,11 @@ msgstr "" #: ../../whatsnew/2.0.rst:423 msgid "" -"One other method which deserves special mention is :meth:`!join`. The :meth:" -"`!join` method of a string receives one parameter, a sequence of strings, " -"and is equivalent to the :func:`!string.join` function from the old :mod:" -"`string` module, with the arguments reversed. In other words, ``s." -"join(seq)`` is equivalent to the old ``string.join(seq, s)``." +"One other method which deserves special mention is :meth:`!join`. " +"The :meth:`!join` method of a string receives one parameter, a sequence of " +"strings, and is equivalent to the :func:`!string.join` function from the " +"old :mod:`string` module, with the arguments reversed. In other words, " +"``s.join(seq)`` is equivalent to the old ``string.join(seq, s)``." msgstr "" #: ../../whatsnew/2.0.rst:433 @@ -843,11 +843,11 @@ msgstr "" #: ../../whatsnew/2.0.rst:571 msgid "" "Work has been done on porting Python to 64-bit Windows on the Itanium " -"processor, mostly by Trent Mick of ActiveState. (Confusingly, ``sys." -"platform`` is still ``'win32'`` on Win64 because it seems that for ease of " -"porting, MS Visual C++ treats code as 32 bit on Itanium.) PythonWin also " -"supports Windows CE; see the Python CE page at https://pythonce.sourceforge." -"net/ for more information." +"processor, mostly by Trent Mick of ActiveState. (Confusingly, " +"``sys.platform`` is still ``'win32'`` on Win64 because it seems that for " +"ease of porting, MS Visual C++ treats code as 32 bit on Itanium.) PythonWin " +"also supports Windows CE; see the Python CE page at https://" +"pythonce.sourceforge.net/ for more information." msgstr "" #: ../../whatsnew/2.0.rst:577 @@ -864,10 +864,10 @@ msgid "" "confusing :exc:`NameError` exception when code refers to a local variable " "before the variable has been assigned a value. For example, the following " "code raises an exception on the ``print`` statement in both 1.5.2 and 2.0; " -"in 1.5.2 a :exc:`NameError` exception is raised, while 2.0 raises a new :exc:" -"`UnboundLocalError` exception. :exc:`UnboundLocalError` is a subclass of :" -"exc:`NameError`, so any existing code that expects :exc:`NameError` to be " -"raised should still work. ::" +"in 1.5.2 a :exc:`NameError` exception is raised, while 2.0 raises a " +"new :exc:`UnboundLocalError` exception. :exc:`UnboundLocalError` is a " +"subclass of :exc:`NameError`, so any existing code that " +"expects :exc:`NameError` to be raised should still work. ::" msgstr "" #: ../../whatsnew/2.0.rst:590 @@ -877,6 +877,10 @@ msgid "" " i = i + 1\n" "f()" msgstr "" +"def f():\n" +" print \"i=\",i\n" +" i = i + 1\n" +"f()" #: ../../whatsnew/2.0.rst:595 msgid "" @@ -903,27 +907,27 @@ msgstr "" msgid "" "The :func:`int` and :func:`!long` functions now accept an optional \"base\" " "parameter when the first argument is a string. ``int('123', 10)`` returns " -"123, while ``int('123', 16)`` returns 291. ``int(123, 16)`` raises a :exc:" -"`TypeError` exception with the message \"can't convert non-string with " -"explicit base\"." +"123, while ``int('123', 16)`` returns 291. ``int(123, 16)`` raises " +"a :exc:`TypeError` exception with the message \"can't convert non-string " +"with explicit base\"." msgstr "" #: ../../whatsnew/2.0.rst:616 msgid "" "A new variable holding more detailed version information has been added to " "the :mod:`sys` module. ``sys.version_info`` is a tuple ``(major, minor, " -"micro, level, serial)`` For example, in a hypothetical 2.0.1beta1, ``sys." -"version_info`` would be ``(2, 0, 1, 'beta', 1)``. *level* is a string such " -"as ``\"alpha\"``, ``\"beta\"``, or ``\"final\"`` for a final release." +"micro, level, serial)`` For example, in a hypothetical 2.0.1beta1, " +"``sys.version_info`` would be ``(2, 0, 1, 'beta', 1)``. *level* is a string " +"such as ``\"alpha\"``, ``\"beta\"``, or ``\"final\"`` for a final release." msgstr "" #: ../../whatsnew/2.0.rst:622 msgid "" "Dictionaries have an odd new method, ``setdefault(key, default)``, which " "behaves similarly to the existing :meth:`!get` method. However, if the key " -"is missing, :meth:`!setdefault` both returns the value of *default* as :meth:" -"`!get` would do, and also inserts it into the dictionary as the value for " -"*key*. Thus, the following lines of code::" +"is missing, :meth:`!setdefault` both returns the value of *default* " +"as :meth:`!get` would do, and also inserts it into the dictionary as the " +"value for *key*. Thus, the following lines of code::" msgstr "" #: ../../whatsnew/2.0.rst:628 @@ -933,6 +937,10 @@ msgid "" " dict[key] = []\n" " return dict[key]" msgstr "" +"if dict.has_key( key ): return dict[key]\n" +"else:\n" +" dict[key] = []\n" +" return dict[key]" #: ../../whatsnew/2.0.rst:633 msgid "" @@ -944,10 +952,10 @@ msgid "" "The interpreter sets a maximum recursion depth in order to catch runaway " "recursion before filling the C stack and causing a core dump or GPF.. " "Previously this limit was fixed when you compiled Python, but in 2.0 the " -"maximum recursion depth can be read and modified using :func:`sys." -"getrecursionlimit` and :func:`sys.setrecursionlimit`. The default value is " -"1000, and a rough maximum value for a given platform can be found by running " -"a new script, :file:`Misc/find_recursionlimit.py`." +"maximum recursion depth can be read and modified " +"using :func:`sys.getrecursionlimit` and :func:`sys.setrecursionlimit`. The " +"default value is 1000, and a rough maximum value for a given platform can be " +"found by running a new script, :file:`Misc/find_recursionlimit.py`." msgstr "" #: ../../whatsnew/2.0.rst:647 @@ -993,9 +1001,9 @@ msgstr "" msgid "" "Some of the functions in the :mod:`socket` module are still forgiving in " "this way. For example, ``socket.connect( ('hostname', 25) )`` is the " -"correct form, passing a tuple representing an IP address, but ``socket." -"connect('hostname', 25)`` also works. :meth:`socket.connect_ex <socket." -"socket.connect_ex>` and :meth:`socket.bind <socket.socket.bind>` are " +"correct form, passing a tuple representing an IP address, but " +"``socket.connect('hostname', 25)`` also works. :meth:`socket.connect_ex " +"<socket.socket.connect_ex>` and :meth:`socket.bind <socket.socket.bind>` are " "similarly easy-going. 2.0alpha1 tightened these functions up, but because " "the documentation actually used the erroneous multiple argument form, many " "people wrote code which would break with the stricter checking. GvR backed " @@ -1054,11 +1062,11 @@ msgstr "" msgid "" "Taking the :func:`repr` of a float now uses a different formatting precision " "than :func:`str`. :func:`repr` uses ``%.17g`` format string for C's :func:`!" -"sprintf`, while :func:`str` uses ``%.12g`` as before. The effect is that :" -"func:`repr` may occasionally show more decimal places than :func:`str`, for " -"certain numbers. For example, the number 8.1 can't be represented exactly " -"in binary, so ``repr(8.1)`` is ``'8.0999999999999996'``, while str(8.1) is " -"``'8.1'``." +"sprintf`, while :func:`str` uses ``%.12g`` as before. The effect is " +"that :func:`repr` may occasionally show more decimal places " +"than :func:`str`, for certain numbers. For example, the number 8.1 can't " +"be represented exactly in binary, so ``repr(8.1)`` is " +"``'8.0999999999999996'``, while str(8.1) is ``'8.1'``." msgstr "" #: ../../whatsnew/2.0.rst:724 @@ -1094,10 +1102,10 @@ msgstr "" #: ../../whatsnew/2.0.rst:753 msgid "" "Users of Jim Fulton's ExtensionClass module will be pleased to find out that " -"hooks have been added so that ExtensionClasses are now supported by :func:" -"`isinstance` and :func:`issubclass`. This means you no longer have to " -"remember to write code such as ``if type(obj) == myExtensionClass``, but can " -"use the more natural ``if isinstance(obj, myExtensionClass)``." +"hooks have been added so that ExtensionClasses are now supported " +"by :func:`isinstance` and :func:`issubclass`. This means you no longer have " +"to remember to write code such as ``if type(obj) == myExtensionClass``, but " +"can use the more natural ``if isinstance(obj, myExtensionClass)``." msgstr "" #: ../../whatsnew/2.0.rst:759 @@ -1115,8 +1123,8 @@ msgstr "" msgid "" "Vladimir Marangozov's long-awaited malloc restructuring was completed, to " "make it easy to have the Python interpreter use a custom allocator instead " -"of C's standard :c:func:`malloc`. For documentation, read the comments in :" -"file:`Include/pymem.h` and :file:`Include/objimpl.h`. For the lengthy " +"of C's standard :c:func:`malloc`. For documentation, read the comments " +"in :file:`Include/pymem.h` and :file:`Include/objimpl.h`. For the lengthy " "discussions during which the interface was hammered out, see the web " "archives of the 'patches' and 'python-dev' lists at python.org." msgstr "" @@ -1158,19 +1166,19 @@ msgstr "" #: ../../whatsnew/2.0.rst:796 msgid "" "Three new convenience functions intended for adding constants to a module's " -"dictionary at module initialization time were added: :c:func:" -"`PyModule_AddObject`, :c:func:`PyModule_AddIntConstant`, and :c:func:" -"`PyModule_AddStringConstant`. Each of these functions takes a module " -"object, a null-terminated C string containing the name to be added, and a " -"third argument for the value to be assigned to the name. This third " +"dictionary at module initialization time were " +"added: :c:func:`PyModule_AddObject`, :c:func:`PyModule_AddIntConstant`, " +"and :c:func:`PyModule_AddStringConstant`. Each of these functions takes a " +"module object, a null-terminated C string containing the name to be added, " +"and a third argument for the value to be assigned to the name. This third " "argument is, respectively, a Python object, a C long, or a C string." msgstr "" #: ../../whatsnew/2.0.rst:804 msgid "" -"A wrapper API was added for Unix-style signal handlers. :c:func:" -"`PyOS_getsig` gets a signal handler and :c:func:`PyOS_setsig` will set a new " -"handler." +"A wrapper API was added for Unix-style signal " +"handlers. :c:func:`PyOS_getsig` gets a signal handler " +"and :c:func:`PyOS_setsig` will set a new handler." msgstr "" #: ../../whatsnew/2.0.rst:811 @@ -1208,8 +1216,8 @@ msgstr "" #: ../../whatsnew/2.0.rst:833 msgid "" "In order to use the Distutils, you need to write a :file:`setup.py` script. " -"For the simple case, when the software contains only .py files, a minimal :" -"file:`setup.py` can be just a few lines long::" +"For the simple case, when the software contains only .py files, a " +"minimal :file:`setup.py` can be just a few lines long::" msgstr "" #: ../../whatsnew/2.0.rst:837 @@ -1218,6 +1226,9 @@ msgid "" "setup (name = \"foo\", version = \"1.0\",\n" " py_modules = [\"module1\", \"module2\"])" msgstr "" +"from distutils.core import setup\n" +"setup (name = \"foo\", version = \"1.0\",\n" +" py_modules = [\"module1\", \"module2\"])" #: ../../whatsnew/2.0.rst:841 msgid "" @@ -1231,6 +1242,9 @@ msgid "" "setup (name = \"foo\", version = \"1.0\",\n" " packages = [\"package\", \"package.subpackage\"])" msgstr "" +"from distutils.core import setup\n" +"setup (name = \"foo\", version = \"1.0\",\n" +" packages = [\"package\", \"package.subpackage\"])" #: ../../whatsnew/2.0.rst:848 msgid "" @@ -1253,6 +1267,18 @@ msgid "" "setup (name = \"PyXML\", version = \"0.5.4\",\n" " ext_modules =[ expat_extension ] )" msgstr "" +"from distutils.core import setup, Extension\n" +"\n" +"expat_extension = Extension('xml.parsers.pyexpat',\n" +" define_macros = [('XML_NS', None)],\n" +" include_dirs = [ 'extensions/expat/xmltok',\n" +" 'extensions/expat/xmlparse' ],\n" +" sources = [ 'extensions/pyexpat.c',\n" +" 'extensions/expat/xmltok/xmltok.c',\n" +" 'extensions/expat/xmltok/xmlrole.c', ]\n" +" )\n" +"setup (name = \"PyXML\", version = \"0.5.4\",\n" +" ext_modules =[ expat_extension ] )" #: ../../whatsnew/2.0.rst:864 msgid "" @@ -1300,11 +1326,12 @@ msgid "" "SAX defines an event-driven interface for parsing XML. To use SAX, you must " "write a SAX handler class. Handler classes inherit from various classes " "provided by SAX, and override various methods that will then be called by " -"the XML parser. For example, the :meth:`~xml.sax.handler.ContentHandler." -"startElement` and :meth:`~xml.sax.handler.ContentHandler.endElement` methods " -"are called for every starting and end tag encountered by the parser, the :" -"meth:`~xml.sax.handler.ContentHandler.characters` method is called for every " -"chunk of character data, and so forth." +"the XML parser. For example, " +"the :meth:`~xml.sax.handler.ContentHandler.startElement` " +"and :meth:`~xml.sax.handler.ContentHandler.endElement` methods are called " +"for every starting and end tag encountered by the parser, " +"the :meth:`~xml.sax.handler.ContentHandler.characters` method is called for " +"every chunk of character data, and so forth." msgstr "" #: ../../whatsnew/2.0.rst:906 @@ -1319,8 +1346,8 @@ msgstr "" #: ../../whatsnew/2.0.rst:912 msgid "" "For example, this little example program defines a handler that prints a " -"message for every starting and ending tag, and then parses the file :file:" -"`hamlet.xml` using it::" +"message for every starting and ending tag, and then parses the " +"file :file:`hamlet.xml` using it::" msgstr "" #: ../../whatsnew/2.0.rst:916 @@ -1379,10 +1406,11 @@ msgstr "" #: ../../whatsnew/2.0.rst:956 msgid "" -"The DOM implementation included with Python lives in the :mod:`xml.dom." -"minidom` module. It's a lightweight implementation of the Level 1 DOM with " -"support for XML namespaces. The :func:`!parse` and :func:`!parseString` " -"convenience functions are provided for generating a DOM tree::" +"The DOM implementation included with Python lives in " +"the :mod:`xml.dom.minidom` module. It's a lightweight implementation of the " +"Level 1 DOM with support for XML namespaces. The :func:`!parse` " +"and :func:`!parseString` convenience functions are provided for generating a " +"DOM tree::" msgstr "" #: ../../whatsnew/2.0.rst:961 @@ -1390,6 +1418,8 @@ msgid "" "from xml.dom import minidom\n" "doc = minidom.parse('hamlet.xml')" msgstr "" +"from xml.dom import minidom\n" +"doc = minidom.parse('hamlet.xml')" #: ../../whatsnew/2.0.rst:964 msgid "" @@ -1409,6 +1439,9 @@ msgid "" "print perslist[0].toxml()\n" "print perslist[1].toxml()" msgstr "" +"perslist = doc.getElementsByTagName( 'PERSONA' )\n" +"print perslist[0].toxml()\n" +"print perslist[1].toxml()" #: ../../whatsnew/2.0.rst:977 msgid "For the *Hamlet* XML file, the above few lines output::" @@ -1419,6 +1452,8 @@ msgid "" "<PERSONA>CLAUDIUS, king of Denmark. </PERSONA>\n" "<PERSONA>HAMLET, son to the late, and nephew to the present king.</PERSONA>" msgstr "" +"<PERSONA>CLAUDIUS, king of Denmark. </PERSONA>\n" +"<PERSONA>HAMLET, son to the late, and nephew to the present king.</PERSONA>" #: ../../whatsnew/2.0.rst:982 msgid "" @@ -1493,23 +1528,24 @@ msgstr "模組變更" #: ../../whatsnew/2.0.rst:1031 msgid "" "Lots of improvements and bugfixes were made to Python's extensive standard " -"library; some of the affected modules include :mod:`readline`, :mod:" -"`ConfigParser <configparser>`, :mod:`!cgi`, :mod:`calendar`, :mod:`posix`, :" -"mod:`readline`, :mod:`!xmllib`, :mod:`!aifc`, :mod:`!chunk`, :mod:`wave`, :" -"mod:`random`, :mod:`shelve`, and :mod:`!nntplib`. Consult the CVS logs for " -"the exact patch-by-patch details." +"library; some of the affected modules " +"include :mod:`readline`, :mod:`ConfigParser <configparser>`, :mod:`!" +"cgi`, :mod:`calendar`, :mod:`posix`, :mod:`readline`, :mod:`!xmllib`, :mod:`!" +"aifc`, :mod:`!chunk`, :mod:`wave`, :mod:`random`, :mod:`shelve`, and :mod:`!" +"nntplib`. Consult the CVS logs for the exact patch-by-patch details." msgstr "" #: ../../whatsnew/2.0.rst:1037 msgid "" "Brian Gallew contributed OpenSSL support for the :mod:`socket` module. " "OpenSSL is an implementation of the Secure Socket Layer, which encrypts the " -"data being sent over a socket. When compiling Python, you can edit :file:" -"`Modules/Setup` to include SSL support, which adds an additional function to " -"the :mod:`socket` module: ``socket.ssl(socket, keyfile, certfile)``, which " -"takes a socket object and returns an SSL socket. The :mod:`httplib <http>` " -"and :mod:`urllib` modules were also changed to support ``https://`` URLs, " -"though no one has implemented FTP or SMTP over SSL." +"data being sent over a socket. When compiling Python, you can " +"edit :file:`Modules/Setup` to include SSL support, which adds an additional " +"function to the :mod:`socket` module: ``socket.ssl(socket, keyfile, " +"certfile)``, which takes a socket object and returns an SSL socket. " +"The :mod:`httplib <http>` and :mod:`urllib` modules were also changed to " +"support ``https://`` URLs, though no one has implemented FTP or SMTP over " +"SSL." msgstr "" #: ../../whatsnew/2.0.rst:1046 @@ -1547,10 +1583,10 @@ msgstr "" #: ../../whatsnew/2.0.rst:1065 msgid "" "As mentioned in the earlier discussion of 2.0's Unicode support, the " -"underlying implementation of the regular expressions provided by the :mod:" -"`re` module has been changed. SRE, a new regular expression engine written " -"by Fredrik Lundh and partially funded by Hewlett Packard, supports matching " -"against both 8-bit strings and Unicode strings." +"underlying implementation of the regular expressions provided by " +"the :mod:`re` module has been changed. SRE, a new regular expression engine " +"written by Fredrik Lundh and partially funded by Hewlett Packard, supports " +"matching against both 8-bit strings and Unicode strings." msgstr "" #: ../../whatsnew/2.0.rst:1075 @@ -1608,8 +1644,8 @@ msgid "" "A file's contents can be mapped directly into memory, at which point it " "behaves like a mutable string, so its contents can be read and modified. " "They can even be passed to functions that expect ordinary strings, such as " -"the :mod:`re` module. (Contributed by Sam Rushing, with some extensions by A." -"M. Kuchling.)" +"the :mod:`re` module. (Contributed by Sam Rushing, with some extensions by " +"A.M. Kuchling.)" msgstr "" #: ../../whatsnew/2.0.rst:1109 @@ -1646,9 +1682,9 @@ msgid "" "are tried in a specific order. The user can alter which browser is launched " "by setting the *BROWSER* environment variable. (Originally inspired by Eric " "S. Raymond's patch to :mod:`urllib` which added similar functionality, but " -"the final module comes from code originally implemented by Fred Drake as :" -"file:`Tools/idle/BrowserControl.py`, and adapted for the standard library by " -"Fred.)" +"the final module comes from code originally implemented by Fred Drake " +"as :file:`Tools/idle/BrowserControl.py`, and adapted for the standard " +"library by Fred.)" msgstr "" #: ../../whatsnew/2.0.rst:1133 @@ -1731,8 +1767,8 @@ msgstr "" #: ../../whatsnew/2.0.rst:1178 msgid "" -"Three new keystroke commands: Check module (:kbd:`Alt-F5`), Import module (:" -"kbd:`F5`) and Run script (:kbd:`Ctrl-F5`)." +"Three new keystroke commands: Check module (:kbd:`Alt-F5`), Import module " +"(:kbd:`F5`) and Run script (:kbd:`Ctrl-F5`)." msgstr "" #: ../../whatsnew/2.0.rst:1185 @@ -1749,13 +1785,13 @@ msgstr "" #: ../../whatsnew/2.0.rst:1191 msgid "" -"A number of modules have been moved to the :file:`lib-old` subdirectory: :" -"mod:`!cmp`, :mod:`!cmpcache`, :mod:`!dircmp`, :mod:`!dump`, :mod:`!find`, :" -"mod:`!grep`, :mod:`!packmail`, :mod:`!poly`, :mod:`!util`, :mod:`!" -"whatsound`, :mod:`!zmod`. If you have code which relies on a module that's " -"been moved to :file:`lib-old`, you can simply add that directory to ``sys." -"path`` to get them back, but you're encouraged to update any code that " -"uses these modules." +"A number of modules have been moved to the :file:`lib-old` " +"subdirectory: :mod:`!cmp`, :mod:`!cmpcache`, :mod:`!dircmp`, :mod:`!" +"dump`, :mod:`!find`, :mod:`!grep`, :mod:`!packmail`, :mod:`!poly`, :mod:`!" +"util`, :mod:`!whatsound`, :mod:`!zmod`. If you have code which relies on a " +"module that's been moved to :file:`lib-old`, you can simply add that " +"directory to ``sys.path`` to get them back, but you're encouraged to " +"update any code that uses these modules." msgstr "" #: ../../whatsnew/2.0.rst:1200 diff --git a/whatsnew/2.1.po b/whatsnew/2.1.po index 72d4b9a90d..abd0fcd069 100644 --- a/whatsnew/2.1.po +++ b/whatsnew/2.1.po @@ -121,10 +121,11 @@ msgid "" "added to the language to fix this problem. As a first effect, the " "``name=name`` default argument is now unnecessary in the above example. Put " "simply, when a given variable name is not assigned a value within a function " -"(by an assignment, or the :keyword:`def`, :keyword:`class`, or :keyword:" -"`import` statements), references to the variable will be looked up in the " -"local namespace of the enclosing scope. A more detailed explanation of the " -"rules, and a dissection of the implementation, can be found in the PEP." +"(by an assignment, or the :keyword:`def`, :keyword:`class`, " +"or :keyword:`import` statements), references to the variable will be looked " +"up in the local namespace of the enclosing scope. A more detailed " +"explanation of the rules, and a dissection of the implementation, can be " +"found in the PEP." msgstr "" #: ../../whatsnew/2.1.rst:77 @@ -227,10 +228,11 @@ msgstr "" msgid "" "While it looks like a normal :keyword:`import` statement, it's not; there " "are strict rules on where such a future statement can be put. They can only " -"be at the top of a module, and must precede any Python code or regular :" -"keyword:`!import` statements. This is because such statements can affect " -"how the Python bytecode compiler parses code and generates bytecode, so they " -"must precede any statement that will result in bytecodes being produced." +"be at the top of a module, and must precede any Python code or " +"regular :keyword:`!import` statements. This is because such statements can " +"affect how the Python bytecode compiler parses code and generates bytecode, " +"so they must precede any statement that will result in bytecodes being " +"produced." msgstr "" #: ../../whatsnew/2.1.rst:153 @@ -327,9 +329,9 @@ msgstr ":meth:`~object.__ne__`" #: ../../whatsnew/2.1.rst:194 msgid "" -"(The magic methods are named after the corresponding Fortran operators ``.LT." -"``. ``.LE.``, &c. Numeric programmers are almost certainly quite familiar " -"with these names and will find them easy to remember.)" +"(The magic methods are named after the corresponding Fortran operators " +"``.LT.``. ``.LE.``, &c. Numeric programmers are almost certainly quite " +"familiar with these names and will find them easy to remember.)" msgstr "" #: ../../whatsnew/2.1.rst:198 @@ -363,8 +365,8 @@ msgstr "" msgid "" "There are also corresponding changes of interest to C programmers; there's a " "new slot ``tp_richcmp`` in type objects and an API for performing a given " -"rich comparison. I won't cover the C API here, but will refer you to :pep:" -"`207`, or to 2.1's C API documentation, for the full list of related " +"rich comparison. I won't cover the C API here, but will refer you " +"to :pep:`207`, or to 2.1's C API documentation, for the full list of related " "functions." msgstr "" @@ -397,8 +399,8 @@ msgstr "" #: ../../whatsnew/2.1.rst:242 msgid "" -"Python 2.1 adds the warning framework to be used in this scheme. It adds a :" -"mod:`warnings` module that provide functions to issue warnings, and to " +"Python 2.1 adds the warning framework to be used in this scheme. It adds " +"a :mod:`warnings` module that provide functions to issue warnings, and to " "filter out warnings that you don't want to be displayed. Third-party modules " "can also use this framework to deprecate old features that they no longer " "wish to support." @@ -440,9 +442,9 @@ msgstr "" msgid "" "Filters can be added to disable certain warnings; a regular expression " "pattern can be applied to the message or to the module name in order to " -"suppress a warning. For example, you may have a program that uses the :mod:" -"`!regex` module and not want to spare the time to convert it to use the :mod:" -"`re` module right now. The warning can be suppressed by calling ::" +"suppress a warning. For example, you may have a program that uses " +"the :mod:`!regex` module and not want to spare the time to convert it to use " +"the :mod:`re` module right now. The warning can be suppressed by calling ::" msgstr "" #: ../../whatsnew/2.1.rst:269 @@ -461,13 +463,13 @@ msgstr "" #: ../../whatsnew/2.1.rst:275 msgid "" -"This adds a filter that will apply only to warnings of the class :class:" -"`DeprecationWarning` triggered in the :mod:`__main__` module, and applies a " -"regular expression to only match the message about the :mod:`!regex` module " -"being deprecated, and will cause such warnings to be ignored. Warnings can " -"also be printed only once, printed every time the offending code is " -"executed, or turned into exceptions that will cause the program to stop " -"(unless the exceptions are caught in the usual way, of course)." +"This adds a filter that will apply only to warnings of the " +"class :class:`DeprecationWarning` triggered in the :mod:`__main__` module, " +"and applies a regular expression to only match the message about the :mod:`!" +"regex` module being deprecated, and will cause such warnings to be ignored. " +"Warnings can also be printed only once, printed every time the offending " +"code is executed, or turned into exceptions that will cause the program to " +"stop (unless the exceptions are caught in the usual way, of course)." msgstr "" #: ../../whatsnew/2.1.rst:283 @@ -535,8 +537,8 @@ msgstr "" msgid "" "In another far-reaching change to the build mechanism, Neil Schemenauer " "restructured things so Python now uses a single makefile that isn't " -"recursive, instead of makefiles in the top directory and in each of the :" -"file:`Python/`, :file:`Parser/`, :file:`Objects/`, and :file:`Modules/` " +"recursive, instead of makefiles in the top directory and in each of " +"the :file:`Python/`, :file:`Parser/`, :file:`Objects/`, and :file:`Modules/` " "subdirectories. This makes building Python faster and also makes hacking " "the Makefiles clearer and simpler." msgstr "" @@ -704,12 +706,13 @@ msgstr "" #: ../../whatsnew/2.1.rst:445 msgid "" -"The dictionary containing attributes can be accessed as the function's :attr:" -"`~function.__dict__`. Unlike the :attr:`~type.__dict__` attribute of class " -"instances, in functions you can actually assign a new dictionary to :attr:" -"`~function.__dict__`, though the new value is restricted to a regular Python " -"dictionary; you *can't* be tricky and set it to a :class:`!UserDict` " -"instance, or any other random object that behaves like a mapping." +"The dictionary containing attributes can be accessed as the " +"function's :attr:`~function.__dict__`. Unlike the :attr:`~type.__dict__` " +"attribute of class instances, in functions you can actually assign a new " +"dictionary to :attr:`~function.__dict__`, though the new value is restricted " +"to a regular Python dictionary; you *can't* be tricky and set it to " +"a :class:`!UserDict` instance, or any other random object that behaves like " +"a mapping." msgstr "" #: ../../whatsnew/2.1.rst:455 @@ -737,9 +740,10 @@ msgid "" "In Python 2.1, the :keyword:`import` statement will work to simulate case-" "sensitivity on case-insensitive platforms. Python will now search for the " "first case-sensitive match by default, raising an :exc:`ImportError` if no " -"such file is found, so ``import file`` will not import a module named ``FILE." -"PY``. Case-insensitive matching can be requested by setting the :envvar:" -"`PYTHONCASEOK` environment variable before starting the Python interpreter." +"such file is found, so ``import file`` will not import a module named " +"``FILE.PY``. Case-insensitive matching can be requested by setting " +"the :envvar:`PYTHONCASEOK` environment variable before starting the Python " +"interpreter." msgstr "" #: ../../whatsnew/2.1.rst:480 @@ -836,17 +840,18 @@ msgstr "" #: ../../whatsnew/2.1.rst:552 msgid "" "As a first small step toward fixing the problem, Python software packaged " -"using the Distutils :command:`sdist` command will include a file named :file:" -"`PKG-INFO` containing information about the package such as its name, " -"version, and author (metadata, in cataloguing terminology). :pep:`241` " -"contains the full list of fields that can be present in the :file:`PKG-INFO` " -"file. As people began to package their software using Python 2.1, more and " -"more packages will include metadata, making it possible to build automated " -"cataloguing systems and experiment with them. With the result experience, " -"perhaps it'll be possible to design a really good catalog and then build " -"support for it into Python 2.2. For example, the Distutils :command:`sdist` " -"and :command:`bdist_\\*` commands could support an ``upload`` option that " -"would automatically upload your package to a catalog server." +"using the Distutils :command:`sdist` command will include a file " +"named :file:`PKG-INFO` containing information about the package such as its " +"name, version, and author (metadata, in cataloguing " +"terminology). :pep:`241` contains the full list of fields that can be " +"present in the :file:`PKG-INFO` file. As people began to package their " +"software using Python 2.1, more and more packages will include metadata, " +"making it possible to build automated cataloguing systems and experiment " +"with them. With the result experience, perhaps it'll be possible to design " +"a really good catalog and then build support for it into Python 2.2. For " +"example, the Distutils :command:`sdist` and :command:`bdist_\\*` commands " +"could support an ``upload`` option that would automatically upload your " +"package to a catalog server." msgstr "" #: ../../whatsnew/2.1.rst:565 @@ -855,8 +860,8 @@ msgid "" "not using Python 2.1, since a new release of the Distutils will be made for " "users of earlier Python versions. Version 1.0.2 of the Distutils includes " "the changes described in :pep:`241`, as well as various bugfixes and " -"enhancements. It will be available from the Distutils SIG at https://www." -"python.org/community/sigs/current/distutils-sig/." +"enhancements. It will be available from the Distutils SIG at https://" +"www.python.org/community/sigs/current/distutils-sig/." msgstr "" #: ../../whatsnew/2.1.rst:574 @@ -881,10 +886,11 @@ msgstr "" msgid "" "Ka-Ping Yee contributed two new modules: :mod:`!inspect.py`, a module for " "getting information about live Python code, and :mod:`!pydoc.py`, a module " -"for interactively converting docstrings to HTML or text. As a bonus, :file:" -"`Tools/scripts/pydoc`, which is now automatically installed, uses :mod:`!" -"pydoc.py` to display documentation given a Python module, package, or class " -"name. For example, ``pydoc xml.dom`` displays the following::" +"for interactively converting docstrings to HTML or text. As a " +"bonus, :file:`Tools/scripts/pydoc`, which is now automatically installed, " +"uses :mod:`!pydoc.py` to display documentation given a Python module, " +"package, or class name. For example, ``pydoc xml.dom`` displays the " +"following::" msgstr "" #: ../../whatsnew/2.1.rst:594 @@ -907,8 +913,8 @@ msgstr "" #: ../../whatsnew/2.1.rst:609 msgid "" -":file:`pydoc` also includes a Tk-based interactive help browser. :file:" -"`pydoc` quickly becomes addictive; try it out!" +":file:`pydoc` also includes a Tk-based interactive help " +"browser. :file:`pydoc` quickly becomes addictive; try it out!" msgstr "" #: ../../whatsnew/2.1.rst:612 @@ -918,18 +924,18 @@ msgid "" "framework based on running embedded examples in docstrings and comparing the " "results against the expected output. PyUnit, contributed by Steve Purcell, " "is a unit testing framework inspired by JUnit, which was in turn an " -"adaptation of Kent Beck's Smalltalk testing framework. See https://pyunit." -"sourceforge.net/ for more information about PyUnit." +"adaptation of Kent Beck's Smalltalk testing framework. See https://" +"pyunit.sourceforge.net/ for more information about PyUnit." msgstr "" #: ../../whatsnew/2.1.rst:620 msgid "" -"The :mod:`difflib` module contains a class, :class:`~difflib." -"SequenceMatcher`, which compares two sequences and computes the changes " -"required to transform one sequence into the other. For example, this module " -"can be used to write a tool similar to the Unix :program:`diff` program, and " -"in fact the sample program :file:`Tools/scripts/ndiff.py` demonstrates how " -"to write such a script." +"The :mod:`difflib` module contains a " +"class, :class:`~difflib.SequenceMatcher`, which compares two sequences and " +"computes the changes required to transform one sequence into the other. For " +"example, this module can be used to write a tool similar to the " +"Unix :program:`diff` program, and in fact the sample program :file:`Tools/" +"scripts/ndiff.py` demonstrates how to write such a script." msgstr "" #: ../../whatsnew/2.1.rst:626 @@ -952,14 +958,14 @@ msgstr "" #: ../../whatsnew/2.1.rst:638 msgid "" -"Ping also contributed another hook for handling uncaught exceptions. :func:" -"`sys.excepthook` can be set to a callable object. When an exception isn't " -"caught by any :keyword:`try`...\\ :keyword:`except` blocks, the exception " -"will be passed to :func:`sys.excepthook`, which can then do whatever it " -"likes. At the Ninth Python Conference, Ping demonstrated an application for " -"this hook: printing an extended traceback that not only lists the stack " -"frames, but also lists the function arguments and the local variables for " -"each frame." +"Ping also contributed another hook for handling uncaught " +"exceptions. :func:`sys.excepthook` can be set to a callable object. When an " +"exception isn't caught by any :keyword:`try`...\\ :keyword:`except` blocks, " +"the exception will be passed to :func:`sys.excepthook`, which can then do " +"whatever it likes. At the Ninth Python Conference, Ping demonstrated an " +"application for this hook: printing an extended traceback that not only " +"lists the stack frames, but also lists the function arguments and the local " +"variables for each frame." msgstr "" #: ../../whatsnew/2.1.rst:646 @@ -1007,11 +1013,11 @@ msgstr "" #: ../../whatsnew/2.1.rst:673 msgid "" "A new implementation-dependent function, ``sys._getframe([depth])``, has " -"been added to return a given frame object from the current call stack. :func:" -"`sys._getframe` returns the frame at the top of the call stack; if the " -"optional integer argument *depth* is supplied, the function returns the " -"frame that is *depth* calls below the top of the stack. For example, ``sys." -"_getframe(1)`` returns the caller's frame object." +"been added to return a given frame object from the current call " +"stack. :func:`sys._getframe` returns the frame at the top of the call " +"stack; if the optional integer argument *depth* is supplied, the function " +"returns the frame that is *depth* calls below the top of the stack. For " +"example, ``sys._getframe(1)`` returns the caller's frame object." msgstr "" #: ../../whatsnew/2.1.rst:680 @@ -1039,9 +1045,9 @@ msgid "" "faster than the system :c:func:`malloc` and have less memory overhead. The " "allocator uses C's :c:func:`!malloc` function to get large pools of memory, " "and then fulfills smaller memory requests from these pools. It can be " -"enabled by providing the :option:`!--with-pymalloc` option to the :program:" -"`configure` script; see :file:`Objects/obmalloc.c` for the implementation " -"details." +"enabled by providing the :option:`!--with-pymalloc` option to " +"the :program:`configure` script; see :file:`Objects/obmalloc.c` for the " +"implementation details." msgstr "" #: ../../whatsnew/2.1.rst:702 @@ -1049,16 +1055,16 @@ msgid "" "Authors of C extension modules should test their code with the object " "allocator enabled, because some incorrect code may break, causing core dumps " "at runtime. There are a bunch of memory allocation functions in Python's C " -"API that have previously been just aliases for the C library's :c:func:" -"`malloc` and :c:func:`free`, meaning that if you accidentally called " -"mismatched functions, the error wouldn't be noticeable. When the object " -"allocator is enabled, these functions aren't aliases of :c:func:`!malloc` " -"and :c:func:`!free` any more, and calling the wrong function to free memory " -"will get you a core dump. For example, if memory was allocated using :c:" -"macro:`PyMem_New`, it has to be freed using :c:func:`PyMem_Del`, not :c:func:" -"`!free`. A few modules included with Python fell afoul of this and had to " -"be fixed; doubtless there are more third-party modules that will have the " -"same problem." +"API that have previously been just aliases for the C " +"library's :c:func:`malloc` and :c:func:`free`, meaning that if you " +"accidentally called mismatched functions, the error wouldn't be noticeable. " +"When the object allocator is enabled, these functions aren't aliases " +"of :c:func:`!malloc` and :c:func:`!free` any more, and calling the wrong " +"function to free memory will get you a core dump. For example, if memory " +"was allocated using :c:macro:`PyMem_New`, it has to be freed " +"using :c:func:`PyMem_Del`, not :c:func:`!free`. A few modules included with " +"Python fell afoul of this and had to be fixed; doubtless there are more " +"third-party modules that will have the same problem." msgstr "" #: ../../whatsnew/2.1.rst:715 @@ -1080,11 +1086,11 @@ msgstr "" #: ../../whatsnew/2.1.rst:726 msgid "" "A new module and method for file objects was also added, contributed by Jeff " -"Epler. The new method, :meth:`!xreadlines`, is similar to the existing :func:" -"`!xrange` built-in. :func:`!xreadlines` returns an opaque sequence object " -"that only supports being iterated over, reading a line on every iteration " -"but not reading the entire file into memory as the existing :meth:`!" -"readlines` method does. You'd use it like this::" +"Epler. The new method, :meth:`!xreadlines`, is similar to the " +"existing :func:`!xrange` built-in. :func:`!xreadlines` returns an opaque " +"sequence object that only supports being iterated over, reading a line on " +"every iteration but not reading the entire file into memory as the " +"existing :meth:`!readlines` method does. You'd use it like this::" msgstr "" #: ../../whatsnew/2.1.rst:733 @@ -1154,10 +1160,10 @@ msgstr "" #: ../../whatsnew/2.1.rst:773 msgid "" -"C extensions which import other modules have been changed to use :c:func:" -"`PyImport_ImportModule`, which means that they will use any import hooks " -"that have been installed. This is also encouraged for third-party " -"extensions that need to import some other module from C code." +"C extensions which import other modules have been changed to " +"use :c:func:`PyImport_ImportModule`, which means that they will use any " +"import hooks that have been installed. This is also encouraged for third-" +"party extensions that need to import some other module from C code." msgstr "" #: ../../whatsnew/2.1.rst:778 diff --git a/whatsnew/2.2.po b/whatsnew/2.2.po index a20f58263f..0dd37108b2 100644 --- a/whatsnew/2.2.po +++ b/whatsnew/2.2.po @@ -190,16 +190,16 @@ msgid "" "This means that :keyword:`class` statements that don't have any base classes " "are always classic classes in Python 2.2. (Actually you can also change " "this by setting a module-level variable named :attr:`!__metaclass__` --- " -"see :pep:`253` for the details --- but it's easier to just subclass :class:" -"`object`.)" +"see :pep:`253` for the details --- but it's easier to just " +"subclass :class:`object`.)" msgstr "" #: ../../whatsnew/2.2.rst:126 msgid "" "The type objects for the built-in types are available as built-ins, named " -"using a clever trick. Python has always had built-in functions named :func:" -"`int`, :func:`float`, and :func:`str`. In 2.2, they aren't functions any " -"more, but type objects that behave as factories when called. ::" +"using a clever trick. Python has always had built-in functions " +"named :func:`int`, :func:`float`, and :func:`str`. In 2.2, they aren't " +"functions any more, but type objects that behave as factories when called. ::" msgstr "" #: ../../whatsnew/2.2.rst:131 @@ -434,12 +434,12 @@ msgstr "" #: ../../whatsnew/2.2.rst:265 msgid "" "The lookup rule for classic classes is simple but not very smart; the base " -"classes are searched depth-first, going from left to right. A reference to :" -"meth:`!D.save` will search the classes :class:`!D`, :class:`!B`, and then :" -"class:`!A`, where :meth:`!save` would be found and returned. :meth:`!C." -"save` would never be found at all. This is bad, because if :class:`!C`'s :" -"meth:`!save` method is saving some internal state specific to :class:`!C`, " -"not calling it will result in that state never getting saved." +"classes are searched depth-first, going from left to right. A reference " +"to :meth:`!D.save` will search the classes :class:`!D`, :class:`!B`, and " +"then :class:`!A`, where :meth:`!save` would be found and returned. :meth:`!" +"C.save` would never be found at all. This is bad, because if :class:`!" +"C`'s :meth:`!save` method is saving some internal state specific to :class:`!" +"C`, not calling it will result in that state never getting saved." msgstr "" #: ../../whatsnew/2.2.rst:273 @@ -469,9 +469,9 @@ msgstr "" #: ../../whatsnew/2.2.rst:288 msgid "" -"Following this rule, referring to :meth:`!D.save` will return :meth:`!C." -"save`, which is the behaviour we're after. This lookup rule is the same as " -"the one followed by Common Lisp. A new built-in function, :func:`super`, " +"Following this rule, referring to :meth:`!D.save` will return :meth:`!" +"C.save`, which is the behaviour we're after. This lookup rule is the same " +"as the one followed by Common Lisp. A new built-in function, :func:`super`, " "provides a way to get at a class's superclasses without having to " "reimplement Python's algorithm. The most commonly used form will be " "``super(class, obj)``, which returns a bound superclass object (not the " @@ -506,8 +506,9 @@ msgid "" "A fair number of sophisticated Python classes define hooks for attribute " "access using :meth:`~object.__getattr__`; most commonly this is done for " "convenience, to make code more readable by automatically mapping an " -"attribute access such as ``obj.parent`` into a method call such as ``obj." -"get_parent``. Python 2.2 adds some new ways of controlling attribute access." +"attribute access such as ``obj.parent`` into a method call such as " +"``obj.get_parent``. Python 2.2 adds some new ways of controlling attribute " +"access." msgstr "" #: ../../whatsnew/2.2.rst:318 @@ -532,12 +533,12 @@ msgid "" "However, Python 2.2's support for :dfn:`properties` will often be a simpler " "way to trap attribute references. Writing a :meth:`!__getattr__` method is " "complicated because to avoid recursion you can't use regular attribute " -"accesses inside them, and instead have to mess around with the contents of :" -"attr:`~object.__dict__`. :meth:`~object.__getattr__` methods also end up " -"being called by Python when it checks for other methods such as :meth:" -"`~object.__repr__` or :meth:`!__coerce__`, and so have to be written with " -"this in mind. Finally, calling a function on every attribute access results " -"in a sizable performance loss." +"accesses inside them, and instead have to mess around with the contents " +"of :attr:`~object.__dict__`. :meth:`~object.__getattr__` methods also end up " +"being called by Python when it checks for other methods such " +"as :meth:`~object.__repr__` or :meth:`!__coerce__`, and so have to be " +"written with this in mind. Finally, calling a function on every attribute " +"access results in a sizable performance loss." msgstr "" #: ../../whatsnew/2.2.rst:338 @@ -581,10 +582,10 @@ msgid "" "Finally, it's possible to constrain the list of attributes that can be " "referenced on an object using the new :attr:`~object.__slots__` class " "attribute. Python objects are usually very dynamic; at any time it's " -"possible to define a new attribute on an instance by just doing ``obj." -"new_attr=1``. A new-style class can define a class attribute named :attr:" -"`~object.__slots__` to limit the legal attributes to a particular set of " -"names. An example will make this clear::" +"possible to define a new attribute on an instance by just doing " +"``obj.new_attr=1``. A new-style class can define a class attribute " +"named :attr:`~object.__slots__` to limit the legal attributes to a " +"particular set of names. An example will make this clear::" msgstr "" #: ../../whatsnew/2.2.rst:372 @@ -635,11 +636,11 @@ msgid "" "Next, there are two relevant PEPs, :pep:`252` and :pep:`253`. :pep:`252` is " "titled \"Making Types Look More Like Classes\", and covers the descriptor " "API. :pep:`253` is titled \"Subtyping Built-in Types\", and describes the " -"changes to type objects that make it possible to subtype built-in objects. :" -"pep:`253` is the more complicated PEP of the two, and at a few points the " -"necessary explanations of types and meta-types may cause your head to " -"explode. Both PEPs were written and implemented by Guido van Rossum, with " -"substantial assistance from the rest of the Zope Corp. team." +"changes to type objects that make it possible to subtype built-in " +"objects. :pep:`253` is the more complicated PEP of the two, and at a few " +"points the necessary explanations of types and meta-types may cause your " +"head to explode. Both PEPs were written and implemented by Guido van " +"Rossum, with substantial assistance from the rest of the Zope Corp. team." msgstr "" #: ../../whatsnew/2.2.rst:413 @@ -692,13 +693,14 @@ msgstr "" #: ../../whatsnew/2.2.rst:443 msgid "" -"In Python 2.2, iteration can be implemented separately, and :meth:`~object." -"__getitem__` methods can be limited to classes that really do support random " -"access. The basic idea of iterators is simple. A new built-in function, " -"``iter(obj)`` or ``iter(C, sentinel)``, is used to get an iterator. " -"``iter(obj)`` returns an iterator for the object *obj*, while ``iter(C, " -"sentinel)`` returns an iterator that will invoke the callable object *C* " -"until it returns *sentinel* to signal that the iterator is done." +"In Python 2.2, iteration can be implemented separately, " +"and :meth:`~object.__getitem__` methods can be limited to classes that " +"really do support random access. The basic idea of iterators is simple. A " +"new built-in function, ``iter(obj)`` or ``iter(C, sentinel)``, is used to " +"get an iterator. ``iter(obj)`` returns an iterator for the object *obj*, " +"while ``iter(C, sentinel)`` returns an iterator that will invoke the " +"callable object *C* until it returns *sentinel* to signal that the iterator " +"is done." msgstr "" #: ../../whatsnew/2.2.rst:451 @@ -706,10 +708,10 @@ msgid "" "Python classes can define an :meth:`!__iter__` method, which should create " "and return a new iterator for the object; if the object is its own iterator, " "this method can just return ``self``. In particular, iterators will usually " -"be their own iterators. Extension types implemented in C can implement a :c:" -"member:`~PyTypeObject.tp_iter` function in order to return an iterator, and " -"extension types that want to behave as iterators can define a :c:member:" -"`~PyTypeObject.tp_iternext` function." +"be their own iterators. Extension types implemented in C can implement " +"a :c:member:`~PyTypeObject.tp_iter` function in order to return an iterator, " +"and extension types that want to behave as iterators can define " +"a :c:member:`~PyTypeObject.tp_iternext` function." msgstr "" #: ../../whatsnew/2.2.rst:458 @@ -759,8 +761,8 @@ msgid "" "In 2.2, Python's :keyword:`for` statement no longer expects a sequence; it " "expects something for which :func:`iter` will return an iterator. For " "backward compatibility and convenience, an iterator is automatically " -"constructed for sequences that don't implement :meth:`!__iter__` or a :c:" -"member:`~PyTypeObject.tp_iter` slot, so ``for i in [1,2,3]`` will still " +"constructed for sequences that don't implement :meth:`!__iter__` or " +"a :c:member:`~PyTypeObject.tp_iter` slot, so ``for i in [1,2,3]`` will still " "work. Wherever the Python interpreter loops over a sequence, it's been " "changed to use the iterator protocol. This means you can do things like " "this::" @@ -782,9 +784,9 @@ msgstr "" #: ../../whatsnew/2.2.rst:493 msgid "" -"Iterator support has been added to some of Python's basic types. Calling :" -"func:`iter` on a dictionary will return an iterator which loops over its " -"keys::" +"Iterator support has been added to some of Python's basic types. " +"Calling :func:`iter` on a dictionary will return an iterator which loops " +"over its keys::" msgstr "" #: ../../whatsnew/2.2.rst:496 @@ -826,10 +828,11 @@ msgstr "" #: ../../whatsnew/2.2.rst:513 msgid "" "That's just the default behaviour. If you want to iterate over keys, " -"values, or key/value pairs, you can explicitly call the :meth:`!iterkeys`, :" -"meth:`!itervalues`, or :meth:`!iteritems` methods to get an appropriate " -"iterator. In a minor related change, the :keyword:`in` operator now works on " -"dictionaries, so ``key in dict`` is now equivalent to ``dict.has_key(key)``." +"values, or key/value pairs, you can explicitly call the :meth:`!" +"iterkeys`, :meth:`!itervalues`, or :meth:`!iteritems` methods to get an " +"appropriate iterator. In a minor related change, the :keyword:`in` operator " +"now works on dictionaries, so ``key in dict`` is now equivalent to " +"``dict.has_key(key)``." msgstr "" #: ../../whatsnew/2.2.rst:519 @@ -923,11 +926,12 @@ msgid "" "between :keyword:`!yield` and a :keyword:`!return` statement is that on " "reaching a :keyword:`!yield` the generator's state of execution is suspended " "and local variables are preserved. On the next call to the generator's " -"``next()`` method, the function will resume executing immediately after the :" -"keyword:`!yield` statement. (For complicated reasons, the :keyword:`!yield` " -"statement isn't allowed inside the :keyword:`!try` block of a :keyword:" -"`try`...\\ :keyword:`finally` statement; read :pep:`255` for a full " -"explanation of the interaction between :keyword:`!yield` and exceptions.)" +"``next()`` method, the function will resume executing immediately after " +"the :keyword:`!yield` statement. (For complicated reasons, the :keyword:`!" +"yield` statement isn't allowed inside the :keyword:`!try` block of " +"a :keyword:`try`...\\ :keyword:`finally` statement; read :pep:`255` for a " +"full explanation of the interaction between :keyword:`!yield` and " +"exceptions.)" msgstr "" #: ../../whatsnew/2.2.rst:584 @@ -1198,20 +1202,21 @@ msgstr "" #: ../../whatsnew/2.2.rst:756 msgid "" -"Classes can define methods called :meth:`~object.__truediv__` and :meth:" -"`~object.__floordiv__` to overload the two division operators. At the C " -"level, there are also slots in the :c:type:`PyNumberMethods` structure so " -"extension types can define the two operators." +"Classes can define methods called :meth:`~object.__truediv__` " +"and :meth:`~object.__floordiv__` to overload the two division operators. At " +"the C level, there are also slots in the :c:type:`PyNumberMethods` structure " +"so extension types can define the two operators." msgstr "" #: ../../whatsnew/2.2.rst:761 msgid "" "Python 2.2 supports some command-line arguments for testing whether code " -"will work with the changed division semantics. Running python with :option:" -"`!-Q warn` will cause a warning to be issued whenever division is applied to " -"two integers. You can use this to find code that's affected by the change " -"and fix it. By default, Python 2.2 will simply perform classic division " -"without a warning; the warning will be turned on by default in Python 2.3." +"will work with the changed division semantics. Running python " +"with :option:`!-Q warn` will cause a warning to be issued whenever division " +"is applied to two integers. You can use this to find code that's affected " +"by the change and fix it. By default, Python 2.2 will simply perform " +"classic division without a warning; the warning will be turned on by default " +"in Python 2.3." msgstr "" #: ../../whatsnew/2.2.rst:771 @@ -1382,10 +1387,11 @@ msgid "" "added to the language to fix this problem. As a first effect, the " "``name=name`` default argument is now unnecessary in the above example. Put " "simply, when a given variable name is not assigned a value within a function " -"(by an assignment, or the :keyword:`def`, :keyword:`class`, or :keyword:" -"`import` statements), references to the variable will be looked up in the " -"local namespace of the enclosing scope. A more detailed explanation of the " -"rules, and a dissection of the implementation, can be found in the PEP." +"(by an assignment, or the :keyword:`def`, :keyword:`class`, " +"or :keyword:`import` statements), references to the variable will be looked " +"up in the local namespace of the enclosing scope. A more detailed " +"explanation of the rules, and a dissection of the implementation, can be " +"found in the PEP." msgstr "" #: ../../whatsnew/2.2.rst:889 @@ -1498,8 +1504,8 @@ msgstr "" #: ../../whatsnew/2.2.rst:963 msgid "" -"The new :mod:`hmac` module implements the HMAC algorithm described by :rfc:" -"`2104`. (Contributed by Gerhard Häring.)" +"The new :mod:`hmac` module implements the HMAC algorithm described " +"by :rfc:`2104`. (Contributed by Gerhard Häring.)" msgstr "" #: ../../whatsnew/2.2.rst:966 @@ -1507,18 +1513,19 @@ msgid "" "Several functions that originally returned lengthy tuples now return pseudo-" "sequences that still behave like tuples but also have mnemonic attributes " "such as :attr:`!memberst_mtime` or :attr:`~time.struct_time.tm_year`. The " -"enhanced functions include :func:`~os.stat`, :func:`~os.fstat`, :func:`~os." -"statvfs`, and :func:`~os.fstatvfs` in the :mod:`os` module, and :func:`~time." -"localtime`, :func:`~time.gmtime`, and :func:`~time.strptime` in the :mod:" -"`time` module." +"enhanced functions " +"include :func:`~os.stat`, :func:`~os.fstat`, :func:`~os.statvfs`, " +"and :func:`~os.fstatvfs` in the :mod:`os` module, " +"and :func:`~time.localtime`, :func:`~time.gmtime`, " +"and :func:`~time.strptime` in the :mod:`time` module." msgstr "" #: ../../whatsnew/2.2.rst:973 msgid "" "For example, to obtain a file's size using the old tuples, you'd end up " "writing something like ``file_size = os.stat(filename)[stat.ST_SIZE]``, but " -"now this can be written more clearly as ``file_size = os.stat(filename)." -"st_size``." +"now this can be written more clearly as ``file_size = " +"os.stat(filename).st_size``." msgstr "" #: ../../whatsnew/2.2.rst:977 @@ -1534,9 +1541,9 @@ msgstr "" #: ../../whatsnew/2.2.rst:982 msgid "" -"The :mod:`socket` module can be compiled to support IPv6; specify the :" -"option:`!--enable-ipv6` option to Python's configure script. (Contributed " -"by Jun-ichiro \"itojun\" Hagino.)" +"The :mod:`socket` module can be compiled to support IPv6; specify " +"the :option:`!--enable-ipv6` option to Python's configure script. " +"(Contributed by Jun-ichiro \"itojun\" Hagino.)" msgstr "" #: ../../whatsnew/2.2.rst:986 @@ -1549,13 +1556,13 @@ msgstr "" #: ../../whatsnew/2.2.rst:991 msgid "" -"In the interpreter's interactive mode, there's a new built-in function :func:" -"`help` that uses the :mod:`pydoc` module introduced in Python 2.1 to provide " -"interactive help. ``help(object)`` displays any available help text about " -"*object*. :func:`help` with no argument puts you in an online help utility, " -"where you can enter the names of functions, classes, or modules to read " -"their help text. (Contributed by Guido van Rossum, using Ka-Ping Yee's :mod:" -"`pydoc` module.)" +"In the interpreter's interactive mode, there's a new built-in " +"function :func:`help` that uses the :mod:`pydoc` module introduced in Python " +"2.1 to provide interactive help. ``help(object)`` displays any available " +"help text about *object*. :func:`help` with no argument puts you in an " +"online help utility, where you can enter the names of functions, classes, or " +"modules to read their help text. (Contributed by Guido van Rossum, using Ka-" +"Ping Yee's :mod:`pydoc` module.)" msgstr "" #: ../../whatsnew/2.2.rst:999 @@ -1607,14 +1614,14 @@ msgstr "" #: ../../whatsnew/2.2.rst:1029 msgid "" -"New constants :const:`!ascii_letters`, :const:`!ascii_lowercase`, and :const:" -"`!ascii_uppercase` were added to the :mod:`string` module. There were " -"several modules in the standard library that used :const:`!string.letters` " -"to mean the ranges A-Za-z, but that assumption is incorrect when locales are " -"in use, because :const:`!string.letters` varies depending on the set of " -"legal characters defined by the current locale. The buggy modules have all " -"been fixed to use :const:`!ascii_letters` instead. (Reported by an unknown " -"person; fixed by Fred L. Drake, Jr.)" +"New constants :const:`!ascii_letters`, :const:`!ascii_lowercase`, " +"and :const:`!ascii_uppercase` were added to the :mod:`string` module. There " +"were several modules in the standard library that used :const:`!" +"string.letters` to mean the ranges A-Za-z, but that assumption is incorrect " +"when locales are in use, because :const:`!string.letters` varies depending " +"on the set of legal characters defined by the current locale. The buggy " +"modules have all been fixed to use :const:`!ascii_letters` instead. " +"(Reported by an unknown person; fixed by Fred L. Drake, Jr.)" msgstr "" #: ../../whatsnew/2.2.rst:1038 @@ -1659,12 +1666,12 @@ msgstr "" #: ../../whatsnew/2.2.rst:1066 msgid "" "Another low-level API, primarily of interest to implementers of Python " -"debuggers and development tools, was added. :c:func:" -"`PyInterpreterState_Head` and :c:func:`PyInterpreterState_Next` let a caller " -"walk through all the existing interpreter objects; :c:func:" -"`PyInterpreterState_ThreadHead` and :c:func:`PyThreadState_Next` allow " -"looping over all the thread states for a given interpreter. (Contributed by " -"David Beazley.)" +"debuggers and development tools, was " +"added. :c:func:`PyInterpreterState_Head` " +"and :c:func:`PyInterpreterState_Next` let a caller walk through all the " +"existing interpreter objects; :c:func:`PyInterpreterState_ThreadHead` " +"and :c:func:`PyThreadState_Next` allow looping over all the thread states " +"for a given interpreter. (Contributed by David Beazley.)" msgstr "" #: ../../whatsnew/2.2.rst:1073 @@ -1699,8 +1706,8 @@ msgstr "" #: ../../whatsnew/2.2.rst:1087 msgid "" -"Rename :c:func:`!PyObject_GC_Init` to :c:func:`PyObject_GC_Track` and :c:" -"func:`!PyObject_GC_Fini` to :c:func:`PyObject_GC_UnTrack`." +"Rename :c:func:`!PyObject_GC_Init` to :c:func:`PyObject_GC_Track` " +"and :c:func:`!PyObject_GC_Fini` to :c:func:`PyObject_GC_UnTrack`." msgstr "" #: ../../whatsnew/2.2.rst:1090 @@ -1738,19 +1745,20 @@ msgid "" "Two new flags :c:macro:`METH_NOARGS` and :c:macro:`METH_O` are available in " "method definition tables to simplify implementation of methods with no " "arguments or a single untyped argument. Calling such methods is more " -"efficient than calling a corresponding method that uses :c:macro:" -"`METH_VARARGS`. Also, the old :c:macro:`!METH_OLDARGS` style of writing C " -"methods is now officially deprecated." +"efficient than calling a corresponding method that " +"uses :c:macro:`METH_VARARGS`. Also, the old :c:macro:`!METH_OLDARGS` style " +"of writing C methods is now officially deprecated." msgstr "" #: ../../whatsnew/2.2.rst:1115 msgid "" -"Two new wrapper functions, :c:func:`PyOS_snprintf` and :c:func:" -"`PyOS_vsnprintf` were added to provide cross-platform implementations for " -"the relatively new :c:func:`snprintf` and :c:func:`vsnprintf` C lib APIs. In " -"contrast to the standard :c:func:`sprintf` and :c:func:`!vsprintf` " -"functions, the Python versions check the bounds of the buffer used to " -"protect against buffer overruns. (Contributed by M.-A. Lemburg.)" +"Two new wrapper functions, :c:func:`PyOS_snprintf` " +"and :c:func:`PyOS_vsnprintf` were added to provide cross-platform " +"implementations for the relatively new :c:func:`snprintf` " +"and :c:func:`vsnprintf` C lib APIs. In contrast to the " +"standard :c:func:`sprintf` and :c:func:`!vsprintf` functions, the Python " +"versions check the bounds of the buffer used to protect against buffer " +"overruns. (Contributed by M.-A. Lemburg.)" msgstr "" #: ../../whatsnew/2.2.rst:1122 @@ -1818,8 +1826,8 @@ msgstr "" msgid "" "Weak references, added in Python 2.1 as an extension module, are now part of " "the core because they're used in the implementation of new-style classes. " -"The :exc:`ReferenceError` exception has therefore moved from the :mod:" -"`weakref` module to become a built-in exception." +"The :exc:`ReferenceError` exception has therefore moved from " +"the :mod:`weakref` module to become a built-in exception." msgstr "" #: ../../whatsnew/2.2.rst:1186 @@ -1831,10 +1839,10 @@ msgstr "" #: ../../whatsnew/2.2.rst:1190 msgid "" -"An additional *flags* argument has been added to the built-in function :func:" -"`compile`, so the behaviour of ``__future__`` statements can now be " -"correctly observed in simulated shells, such as those presented by IDLE and " -"other development environments. This is described in :pep:`264`. " +"An additional *flags* argument has been added to the built-in " +"function :func:`compile`, so the behaviour of ``__future__`` statements can " +"now be correctly observed in simulated shells, such as those presented by " +"IDLE and other development environments. This is described in :pep:`264`. " "(Contributed by Michael Hudson.)" msgstr "" @@ -1875,12 +1883,12 @@ msgid "" "Some features of the object returned by the :func:`!xrange` function are now " "deprecated, and trigger warnings when they're accessed; they'll disappear in " "Python 2.3. :class:`!xrange` objects tried to pretend they were full " -"sequence types by supporting slicing, sequence multiplication, and the :" -"keyword:`in` operator, but these features were rarely used and therefore " -"buggy. The :meth:`!tolist` method and the :attr:`!start`, :attr:`!stop`, " -"and :attr:`!step` attributes are also being deprecated. At the C level, the " -"fourth argument to the :c:func:`!PyRange_New` function, ``repeat``, has also " -"been deprecated." +"sequence types by supporting slicing, sequence multiplication, and " +"the :keyword:`in` operator, but these features were rarely used and " +"therefore buggy. The :meth:`!tolist` method and the :attr:`!start`, :attr:`!" +"stop`, and :attr:`!step` attributes are also being deprecated. At the C " +"level, the fourth argument to the :c:func:`!PyRange_New` function, " +"``repeat``, has also been deprecated." msgstr "" #: ../../whatsnew/2.2.rst:1225 @@ -1921,9 +1929,9 @@ msgstr "" #: ../../whatsnew/2.2.rst:1246 msgid "" "On platforms where Python uses the C :c:func:`dlopen` function to load " -"extension modules, it's now possible to set the flags used by :c:func:" -"`dlopen` using the :func:`sys.getdlopenflags` and :func:`sys.setdlopenflags` " -"functions. (Contributed by Bram Stolk.)" +"extension modules, it's now possible to set the flags used " +"by :c:func:`dlopen` using the :func:`sys.getdlopenflags` " +"and :func:`sys.setdlopenflags` functions. (Contributed by Bram Stolk.)" msgstr "" #: ../../whatsnew/2.2.rst:1251 diff --git a/whatsnew/2.3.po b/whatsnew/2.3.po index d2be7edf2d..48d3561118 100644 --- a/whatsnew/2.3.po +++ b/whatsnew/2.3.po @@ -104,8 +104,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:66 msgid "" -"The union and intersection of sets can be computed with the :meth:" -"`~frozenset.union` and :meth:`~frozenset.intersection` methods; an " +"The union and intersection of sets can be computed with " +"the :meth:`~frozenset.union` and :meth:`~frozenset.intersection` methods; an " "alternative notation uses the bitwise operators ``&`` and ``|``. Mutable " "sets also have in-place versions of these methods, :meth:`!union_update` " "and :meth:`~frozenset.intersection_update`. ::" @@ -135,8 +135,8 @@ msgid "" "the set of all elements in the union that aren't in the intersection. " "Another way of putting it is that the symmetric difference contains all " "elements that are in exactly one set. Again, there's an alternative " -"notation (``^``), and an in-place version with the ungainly name :meth:" -"`~frozenset.symmetric_difference_update`. ::" +"notation (``^``), and an in-place version with the ungainly " +"name :meth:`~frozenset.symmetric_difference_update`. ::" msgstr "" #: ../../whatsnew/2.3.rst:92 @@ -181,7 +181,7 @@ msgstr "" #: ../../whatsnew/2.3.rst:126 msgid "PEP 255: Simple Generators" -msgstr "" +msgstr "PEP 255:簡單產生器" #: ../../whatsnew/2.3.rst:128 msgid "" @@ -209,7 +209,7 @@ msgstr "" #: ../../whatsnew/2.3.rst:145 msgid "Here's the simplest example of a generator function::" -msgstr "" +msgstr "以下是產生器函式最簡單的範例:" #: ../../whatsnew/2.3.rst:147 msgid "" @@ -217,6 +217,9 @@ msgid "" " for i in range(N):\n" " yield i" msgstr "" +"def generate_ints(N):\n" +" for i in range(N):\n" +" yield i" #: ../../whatsnew/2.3.rst:151 msgid "" @@ -234,12 +237,13 @@ msgid "" "of ``i``, similar to a :keyword:`return` statement. The big difference " "between :keyword:`!yield` and a :keyword:`!return` statement is that on " "reaching a :keyword:`!yield` the generator's state of execution is suspended " -"and local variables are preserved. On the next call to the generator's ``." -"next()`` method, the function will resume executing immediately after the :" -"keyword:`!yield` statement. (For complicated reasons, the :keyword:`!yield` " -"statement isn't allowed inside the :keyword:`try` block of a :keyword:`!" -"try`...\\ :keyword:`!finally` statement; read :pep:`255` for a full " -"explanation of the interaction between :keyword:`!yield` and exceptions.)" +"and local variables are preserved. On the next call to the generator's " +"``.next()`` method, the function will resume executing immediately after " +"the :keyword:`!yield` statement. (For complicated reasons, the :keyword:`!" +"yield` statement isn't allowed inside the :keyword:`try` block of " +"a :keyword:`!try`...\\ :keyword:`!finally` statement; read :pep:`255` for a " +"full explanation of the interaction between :keyword:`!yield` and " +"exceptions.)" msgstr "" #: ../../whatsnew/2.3.rst:169 @@ -263,6 +267,20 @@ msgid "" " File \"stdin\", line 2, in generate_ints\n" "StopIteration" msgstr "" +">>> gen = generate_ints(3)\n" +">>> gen\n" +"<generator object at 0x8117f90>\n" +">>> gen.next()\n" +"0\n" +">>> gen.next()\n" +"1\n" +">>> gen.next()\n" +"2\n" +">>> gen.next()\n" +"Traceback (most recent call last):\n" +" File \"stdin\", line 1, in ?\n" +" File \"stdin\", line 2, in generate_ints\n" +"StopIteration" #: ../../whatsnew/2.3.rst:186 msgid "" @@ -354,7 +372,7 @@ msgstr "" #: ../../whatsnew/2.3.rst:247 msgid ":pep:`255` - Simple Generators" -msgstr "" +msgstr ":pep:`255` - 簡單產生器" #: ../../whatsnew/2.3.rst:248 msgid "" @@ -380,14 +398,16 @@ msgid "" "#!/usr/bin/env python\n" "# -*- coding: UTF-8 -*-" msgstr "" +"#!/usr/bin/env python\n" +"# -*- coding: UTF-8 -*-" #: ../../whatsnew/2.3.rst:267 msgid "" "Without such an encoding declaration, the default encoding used is 7-bit " "ASCII. Executing or importing modules that contain string literals with 8-" -"bit characters and have no encoding declaration will result in a :exc:" -"`DeprecationWarning` being signalled by Python 2.3; in 2.4 this will be a " -"syntax error." +"bit characters and have no encoding declaration will result in " +"a :exc:`DeprecationWarning` being signalled by Python 2.3; in 2.4 this will " +"be a syntax error." msgstr "" #: ../../whatsnew/2.3.rst:273 @@ -416,8 +436,8 @@ msgstr "" msgid "" "The new :mod:`zipimport` module adds support for importing modules from a " "ZIP-format archive. You don't need to import the module explicitly; it will " -"be automatically imported if a ZIP archive's filename is added to ``sys." -"path``. For example:" +"be automatically imported if a ZIP archive's filename is added to " +"``sys.path``. For example:" msgstr "" #: ../../whatsnew/2.3.rst:296 @@ -443,11 +463,12 @@ msgstr "" #: ../../whatsnew/2.3.rst:314 msgid "" "An entry in ``sys.path`` can now be the filename of a ZIP archive. The ZIP " -"archive can contain any kind of files, but only files named :file:`\\*.py`, :" -"file:`\\*.pyc`, or :file:`\\*.pyo` can be imported. If an archive only " -"contains :file:`\\*.py` files, Python will not attempt to modify the archive " -"by adding the corresponding :file:`\\*.pyc` file, meaning that if a ZIP " -"archive doesn't contain :file:`\\*.pyc` files, importing may be rather slow." +"archive can contain any kind of files, but only files " +"named :file:`\\*.py`, :file:`\\*.pyc`, or :file:`\\*.pyo` can be imported. " +"If an archive only contains :file:`\\*.py` files, Python will not attempt to " +"modify the archive by adding the corresponding :file:`\\*.pyc` file, meaning " +"that if a ZIP archive doesn't contain :file:`\\*.pyc` files, importing may " +"be rather slow." msgstr "" #: ../../whatsnew/2.3.rst:321 @@ -465,9 +486,9 @@ msgstr "" msgid "" "Written by James C. Ahlstrom, who also provided an implementation. Python " "2.3 follows the specification in :pep:`273`, but uses an implementation " -"written by Just van Rossum that uses the import hooks described in :pep:" -"`302`. See section :ref:`section-pep302` for a description of the new import " -"hooks." +"written by Just van Rossum that uses the import hooks described " +"in :pep:`302`. See section :ref:`section-pep302` for a description of the " +"new import hooks." msgstr "" #: ../../whatsnew/2.3.rst:338 @@ -484,10 +505,11 @@ msgstr "" #: ../../whatsnew/2.3.rst:344 msgid "" "Python now allows using arbitrary Unicode strings (within the limitations of " -"the file system) for all functions that expect file names, most notably the :" -"func:`open` built-in function. If a Unicode string is passed to :func:`os." -"listdir`, Python now returns a list of Unicode strings. A new function, :" -"func:`!os.getcwdu`, returns the current directory as a Unicode string." +"the file system) for all functions that expect file names, most notably " +"the :func:`open` built-in function. If a Unicode string is passed " +"to :func:`os.listdir`, Python now returns a list of Unicode strings. A new " +"function, :func:`!os.getcwdu`, returns the current directory as a Unicode " +"string." msgstr "" #: ../../whatsnew/2.3.rst:350 @@ -499,10 +521,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:353 msgid "" "Other systems also allow Unicode strings as file names but convert them to " -"byte strings before passing them to the system, which can cause a :exc:" -"`UnicodeError` to be raised. Applications can test whether arbitrary Unicode " -"strings are supported as file names by checking :const:`os.path." -"supports_unicode_filenames`, a Boolean value." +"byte strings before passing them to the system, which can cause " +"a :exc:`UnicodeError` to be raised. Applications can test whether arbitrary " +"Unicode strings are supported as file names by " +"checking :const:`os.path.supports_unicode_filenames`, a Boolean value." msgstr "" #: ../../whatsnew/2.3.rst:359 @@ -537,9 +559,9 @@ msgstr "" msgid "" "Python's file objects can now support end of line conventions other than the " "one followed by the platform on which Python is running. Opening a file with " -"the mode ``'U'`` or ``'rU'`` will open a file for reading in :term:" -"`universal newlines` mode. All three line ending conventions will be " -"translated to a ``'\\n'`` in the strings returned by the various file " +"the mode ``'U'`` or ``'rU'`` will open a file for reading " +"in :term:`universal newlines` mode. All three line ending conventions will " +"be translated to a ``'\\n'`` in the strings returned by the various file " "methods such as :meth:`!read` and :meth:`!readline`." msgstr "" @@ -553,9 +575,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:396 msgid "" -"This feature can be disabled when compiling Python by specifying the :option:" -"`!--without-universal-newlines` switch when running Python's :program:" -"`configure` script." +"This feature can be disabled when compiling Python by specifying " +"the :option:`!--without-universal-newlines` switch when running " +"Python's :program:`configure` script." msgstr "" #: ../../whatsnew/2.3.rst:403 @@ -629,15 +651,16 @@ msgstr "" msgid "" "The :class:`~logging.Logger` class is the primary class. Most application " "code will deal with one or more :class:`~logging.Logger` objects, each one " -"used by a particular subsystem of the application. Each :class:`~logging." -"Logger` is identified by a name, and names are organized into a hierarchy " -"using ``.`` as the component separator. For example, you might have :class:" -"`~logging.Logger` instances named ``server``, ``server.auth`` and ``server." -"network``. The latter two instances are below ``server`` in the hierarchy. " -"This means that if you turn up the verbosity for ``server`` or direct " -"``server`` messages to a different handler, the changes will also apply to " -"records logged to ``server.auth`` and ``server.network``. There's also a " -"root :class:`~logging.Logger` that's the parent of all other loggers." +"used by a particular subsystem of the application. " +"Each :class:`~logging.Logger` is identified by a name, and names are " +"organized into a hierarchy using ``.`` as the component separator. For " +"example, you might have :class:`~logging.Logger` instances named ``server``, " +"``server.auth`` and ``server.network``. The latter two instances are below " +"``server`` in the hierarchy. This means that if you turn up the verbosity " +"for ``server`` or direct ``server`` messages to a different handler, the " +"changes will also apply to records logged to ``server.auth`` and " +"``server.network``. There's also a root :class:`~logging.Logger` that's the " +"parent of all other loggers." msgstr "" #: ../../whatsnew/2.3.rst:464 @@ -672,8 +695,8 @@ msgstr "" msgid "" "In the default configuration, informational and debugging messages are " "suppressed and the output is sent to standard error. You can enable the " -"display of informational and debugging messages by calling the :meth:" -"`~logging.Logger.setLevel` method on the root logger." +"display of informational and debugging messages by calling " +"the :meth:`~logging.Logger.setLevel` method on the root logger." msgstr "" #: ../../whatsnew/2.3.rst:486 @@ -730,9 +753,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:519 msgid "" "Log records are usually propagated up the hierarchy, so a message logged to " -"``server.auth`` is also seen by ``server`` and ``root``, but a :class:" -"`~logging.Logger` can prevent this by setting its :attr:`~logging.Logger." -"propagate` attribute to :const:`False`." +"``server.auth`` is also seen by ``server`` and ``root``, but " +"a :class:`~logging.Logger` can prevent this by setting " +"its :attr:`~logging.Logger.propagate` attribute to :const:`False`." msgstr "" #: ../../whatsnew/2.3.rst:523 @@ -743,10 +766,10 @@ msgid "" "any number of different :class:`~logging.Handler` instances. Loggers and " "handlers can also have an attached list of filters, and each filter can " "cause the :class:`~logging.LogRecord` to be ignored or can modify the record " -"before passing it along. When they're finally output, :class:`~logging." -"LogRecord` instances are converted to text by a :class:`~logging.Formatter` " -"class. All of these classes can be replaced by your own specially written " -"classes." +"before passing it along. When they're finally " +"output, :class:`~logging.LogRecord` instances are converted to text by " +"a :class:`~logging.Formatter` class. All of these classes can be replaced " +"by your own specially written classes." msgstr "" #: ../../whatsnew/2.3.rst:533 @@ -773,17 +796,17 @@ msgstr "" #: ../../whatsnew/2.3.rst:552 msgid "" "A Boolean type was added to Python 2.3. Two new constants were added to " -"the :mod:`!__builtin__` module, :const:`True` and :const:`False`. (:const:" -"`True` and :const:`False` constants were added to the built-ins in Python " -"2.2.1, but the 2.2.1 versions are simply set to integer values of 1 and 0 " -"and aren't a different type.)" +"the :mod:`!__builtin__` module, :const:`True` and :const:`False`. " +"(:const:`True` and :const:`False` constants were added to the built-ins in " +"Python 2.2.1, but the 2.2.1 versions are simply set to integer values of 1 " +"and 0 and aren't a different type.)" msgstr "" #: ../../whatsnew/2.3.rst:558 msgid "" "The type object for this new type is named :class:`bool`; the constructor " -"for it takes any Python value and converts it to :const:`True` or :const:" -"`False`. ::" +"for it takes any Python value and converts it to :const:`True` " +"or :const:`False`. ::" msgstr "" #: ../../whatsnew/2.3.rst:561 @@ -829,13 +852,13 @@ msgstr "" msgid "" "Python's Booleans were *not* added for the sake of strict type-checking. A " "very strict language such as Pascal would also prevent you performing " -"arithmetic with Booleans, and would require that the expression in an :" -"keyword:`if` statement always evaluate to a Boolean result. Python is not " -"this strict and never will be, as :pep:`285` explicitly says. This means " -"you can still use any expression in an :keyword:`!if` statement, even ones " -"that evaluate to a list or tuple or some random object. The Boolean type is " -"a subclass of the :class:`int` class so that arithmetic using a Boolean " -"still works. ::" +"arithmetic with Booleans, and would require that the expression in " +"an :keyword:`if` statement always evaluate to a Boolean result. Python is " +"not this strict and never will be, as :pep:`285` explicitly says. This " +"means you can still use any expression in an :keyword:`!if` statement, even " +"ones that evaluate to a list or tuple or some random object. The Boolean " +"type is a subclass of the :class:`int` class so that arithmetic using a " +"Boolean still works. ::" msgstr "" #: ../../whatsnew/2.3.rst:596 @@ -874,9 +897,9 @@ msgstr "" msgid "" "When encoding a Unicode string into a byte string, unencodable characters " "may be encountered. So far, Python has allowed specifying the error " -"processing as either \"strict\" (raising :exc:`UnicodeError`), " -"\"ignore\" (skipping the character), or \"replace\" (using a question mark " -"in the output string), with \"strict\" being the default behavior. It may be " +"processing as either \"strict\" (raising :exc:`UnicodeError`), \"ignore\" " +"(skipping the character), or \"replace\" (using a question mark in the " +"output string), with \"strict\" being the default behavior. It may be " "desirable to specify alternative processing of such errors, such as " "inserting an XML character reference or HTML entity reference into the " "converted string." @@ -1000,14 +1023,14 @@ msgstr "" msgid "" "``sys.path_hooks`` is a list of callable objects; most often they'll be " "classes. Each callable takes a string containing a path and either returns " -"an importer object that will handle imports from this path or raises an :exc:" -"`ImportError` exception if it can't handle this path." +"an importer object that will handle imports from this path or raises " +"an :exc:`ImportError` exception if it can't handle this path." msgstr "" #: ../../whatsnew/2.3.rst:721 msgid "" -"``sys.path_importer_cache`` caches importer objects for each path, so ``sys." -"path_hooks`` will only need to be traversed once for each path." +"``sys.path_importer_cache`` caches importer objects for each path, so " +"``sys.path_hooks`` will only need to be traversed once for each path." msgstr "" #: ../../whatsnew/2.3.rst:724 @@ -1125,9 +1148,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:797 msgid "" "Different dialects of comma-separated files can be defined and registered; " -"currently there are two dialects, both used by Microsoft Excel. A separate :" -"class:`csv.writer` class will generate comma-separated files from a " -"succession of tuples or lists, quoting strings that contain the delimiter." +"currently there are two dialects, both used by Microsoft Excel. A " +"separate :class:`csv.writer` class will generate comma-separated files from " +"a succession of tuples or lists, quoting strings that contain the delimiter." msgstr "" #: ../../whatsnew/2.3.rst:805 @@ -1175,10 +1198,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:836 msgid "" "To reduce the pickling overhead for new-style classes, a new interface for " -"customizing pickling was added using three special methods: :meth:`~object." -"__getstate__`, :meth:`~object.__setstate__`, and :meth:`~object." -"__getnewargs__`. Consult :pep:`307` for the full semantics of these " -"methods." +"customizing pickling was added using three special " +"methods: :meth:`~object.__getstate__`, :meth:`~object.__setstate__`, " +"and :meth:`~object.__getnewargs__`. Consult :pep:`307` for the full " +"semantics of these methods." msgstr "" #: ../../whatsnew/2.3.rst:841 @@ -1552,10 +1575,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:1044 msgid "" "Most type objects are now callable, so you can use them to create new " -"objects such as functions, classes, and modules. (This means that the :mod:" -"`!new` module can be deprecated in a future Python version, because you can " -"now use the type objects available in the :mod:`types` module.) For example, " -"you can create a new module object with the following code:" +"objects such as functions, classes, and modules. (This means that " +"the :mod:`!new` module can be deprecated in a future Python version, because " +"you can now use the type objects available in the :mod:`types` module.) For " +"example, you can create a new module object with the following code:" msgstr "" #: ../../whatsnew/2.3.rst:1052 @@ -1579,16 +1602,16 @@ msgid "" "A new warning, :exc:`PendingDeprecationWarning` was added to indicate " "features which are in the process of being deprecated. The warning will " "*not* be printed by default. To check for use of features that will be " -"deprecated in the future, supply :option:`-Walways::" -"PendingDeprecationWarning:: <-W>` on the command line or use :func:`warnings." -"filterwarnings`." +"deprecated in the future, supply :option:`-" +"Walways::PendingDeprecationWarning:: <-W>` on the command line or " +"use :func:`warnings.filterwarnings`." msgstr "" #: ../../whatsnew/2.3.rst:1065 msgid "" "The process of deprecating string-based exceptions, as in ``raise \"Error " -"occurred\"``, has begun. Raising a string will now trigger :exc:" -"`PendingDeprecationWarning`." +"occurred\"``, has begun. Raising a string will now " +"trigger :exc:`PendingDeprecationWarning`." msgstr "" #: ../../whatsnew/2.3.rst:1069 @@ -1663,8 +1686,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1115 msgid "" "One of the noted incompatibilities between old- and new-style classes has " -"been removed: you can now assign to the :attr:`~type.__name__` and :attr:" -"`~type.__bases__` attributes of new-style classes. There are some " +"been removed: you can now assign to the :attr:`~type.__name__` " +"and :attr:`~type.__bases__` attributes of new-style classes. There are some " "restrictions on what can be assigned to :attr:`!__bases__` along the lines " "of those relating to assigning to an instance's :attr:`~object.__class__` " "attribute." @@ -1794,8 +1817,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1202 msgid "" "The ``SET_LINENO`` opcode is now gone. This may provide a small speed " -"increase, depending on your compiler's idiosyncrasies. See section :ref:" -"`23section-other` for a longer explanation. (Removed by Michael Hudson.)" +"increase, depending on your compiler's idiosyncrasies. See " +"section :ref:`23section-other` for a longer explanation. (Removed by Michael " +"Hudson.)" msgstr "" #: ../../whatsnew/2.3.rst:1206 @@ -1856,18 +1880,19 @@ msgid "" "incompatibilities. When upgrading to Python 2.3, if the new interpreter is " "compiled with a new version of the underlying BerkeleyDB library, you will " "almost certainly have to convert your database files to the new version. " -"You can do this fairly easily with the new scripts :file:`db2pickle.py` and :" -"file:`pickle2db.py` which you will find in the distribution's :file:`Tools/" -"scripts` directory. If you've already been using the PyBSDDB package and " -"importing it as :mod:`!bsddb3`, you will have to change your ``import`` " -"statements to import it as :mod:`!bsddb`." +"You can do this fairly easily with the new scripts :file:`db2pickle.py` " +"and :file:`pickle2db.py` which you will find in the " +"distribution's :file:`Tools/scripts` directory. If you've already been " +"using the PyBSDDB package and importing it as :mod:`!bsddb3`, you will have " +"to change your ``import`` statements to import it as :mod:`!bsddb`." msgstr "" #: ../../whatsnew/2.3.rst:1249 msgid "" "The new :mod:`bz2` module is an interface to the bz2 data compression " -"library. bz2-compressed data is usually smaller than corresponding :mod:" -"`zlib`\\ -compressed data. (Contributed by Gustavo Niemeyer.)" +"library. bz2-compressed data is usually smaller than " +"corresponding :mod:`zlib`\\ -compressed data. (Contributed by Gustavo " +"Niemeyer.)" msgstr "" #: ../../whatsnew/2.3.rst:1253 @@ -1901,18 +1926,18 @@ msgstr "" #: ../../whatsnew/2.3.rst:1270 msgid "" -"Other minor changes to Distutils: it now checks for the :envvar:`CC`, :" -"envvar:`CFLAGS`, :envvar:`!CPP`, :envvar:`LDFLAGS`, and :envvar:`CPPFLAGS` " -"environment variables, using them to override the settings in Python's " -"configuration (contributed by Robert Weber)." +"Other minor changes to Distutils: it now checks for " +"the :envvar:`CC`, :envvar:`CFLAGS`, :envvar:`!CPP`, :envvar:`LDFLAGS`, " +"and :envvar:`CPPFLAGS` environment variables, using them to override the " +"settings in Python's configuration (contributed by Robert Weber)." msgstr "" #: ../../whatsnew/2.3.rst:1275 msgid "" "Previously the :mod:`doctest` module would only search the docstrings of " "public methods and functions for test cases, but it now also examines " -"private ones as well. The :func:`~doctest.DocTestSuite` function creates a :" -"class:`unittest.TestSuite` object from a set of :mod:`doctest` tests." +"private ones as well. The :func:`~doctest.DocTestSuite` function creates " +"a :class:`unittest.TestSuite` object from a set of :mod:`doctest` tests." msgstr "" #: ../../whatsnew/2.3.rst:1280 @@ -1925,10 +1950,10 @@ msgstr "" msgid "" "The :mod:`getopt` module gained a new function, :func:`~getopt.gnu_getopt`, " "that supports the same arguments as the existing :func:`~getopt.getopt` " -"function but uses GNU-style scanning mode. The existing :func:`~getopt." -"getopt` stops processing options as soon as a non-option argument is " -"encountered, but in GNU-style mode processing continues, meaning that " -"options and arguments can be mixed. For example::" +"function but uses GNU-style scanning mode. The " +"existing :func:`~getopt.getopt` stops processing options as soon as a non-" +"option argument is encountered, but in GNU-style mode processing continues, " +"meaning that options and arguments can be mixed. For example::" msgstr "" #: ../../whatsnew/2.3.rst:1289 @@ -1975,10 +2000,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:1314 msgid "" -"The :mod:`heapq` module provides :func:`~heapq.heappush` and :func:`~heapq." -"heappop` functions for adding and removing items while maintaining the heap " -"property on top of some other mutable Python sequence type. Here's an " -"example that uses a Python list::" +"The :mod:`heapq` module provides :func:`~heapq.heappush` " +"and :func:`~heapq.heappop` functions for adding and removing items while " +"maintaining the heap property on top of some other mutable Python sequence " +"type. Here's an example that uses a Python list::" msgstr "" #: ../../whatsnew/2.3.rst:1318 @@ -2063,8 +2088,8 @@ msgid "" "stamps are floats. For compatibility, when using the tuple interface of " "the :class:`~os.stat_result` time stamps will be represented as integers. " "When using named fields (a feature first introduced in Python 2.2), time " -"stamps are still represented as integers, unless :func:`!os." -"stat_float_times` is invoked to enable float return values::" +"stamps are still represented as integers, unless :func:`!" +"os.stat_float_times` is invoked to enable float return values::" msgstr "" #: ../../whatsnew/2.3.rst:1376 @@ -2118,8 +2143,8 @@ msgid "" "The parser objects provided by the :mod:`pyexpat <xml.parsers.expat>` module " "can now optionally buffer character data, resulting in fewer calls to your " "character data handler and therefore faster performance. Setting the parser " -"object's :attr:`~xml.parsers.expat.xmlparser.buffer_text` attribute to :" -"const:`True` will enable buffering." +"object's :attr:`~xml.parsers.expat.xmlparser.buffer_text` attribute " +"to :const:`True` will enable buffering." msgstr "" #: ../../whatsnew/2.3.rst:1410 @@ -2164,8 +2189,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1438 msgid "" -"The :mod:`readline` module also gained a number of new functions: :func:" -"`~readline.get_history_item`, :func:`~readline.get_current_history_length`, " +"The :mod:`readline` module also gained a number of new " +"functions: :func:`~readline.get_history_item`, :func:`~readline.get_current_history_length`, " "and :func:`~readline.redisplay`." msgstr "" @@ -2201,9 +2226,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1459 msgid "" -"Support for more advanced POSIX signal handling was added to the :mod:" -"`signal` but then removed again as it proved impossible to make it work " -"reliably across platforms." +"Support for more advanced POSIX signal handling was added to " +"the :mod:`signal` but then removed again as it proved impossible to make it " +"work reliably across platforms." msgstr "" #: ../../whatsnew/2.3.rst:1463 @@ -2238,8 +2263,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1481 msgid "" -"The new :mod:`tarfile` module allows reading from and writing to :program:" -"`tar`\\ -format archive files. (Contributed by Lars Gustäbel.)" +"The new :mod:`tarfile` module allows reading from and writing " +"to :program:`tar`\\ -format archive files. (Contributed by Lars Gustäbel.)" msgstr "" #: ../../whatsnew/2.3.rst:1484 @@ -2249,8 +2274,8 @@ msgid "" "string and returns a list containing the text split into lines of no more " "than the chosen width. The ``fill(text, width)`` function returns a single " "string, reformatted to fit into lines no longer than the chosen width. (As " -"you can guess, :func:`~textwrap.fill` is built on top of :func:`~textwrap." -"wrap`. For example::" +"you can guess, :func:`~textwrap.fill` is built on top " +"of :func:`~textwrap.wrap`. For example::" msgstr "" #: ../../whatsnew/2.3.rst:1491 @@ -2274,21 +2299,21 @@ msgstr "" #: ../../whatsnew/2.3.rst:1506 msgid "" "The module also contains a :class:`~textwrap.TextWrapper` class that " -"actually implements the text wrapping strategy. Both the :class:`~textwrap." -"TextWrapper` class and the :func:`~textwrap.wrap` and :func:`~textwrap.fill` " -"functions support a number of additional keyword arguments for fine-tuning " -"the formatting; consult the module's documentation for details. (Contributed " -"by Greg Ward.)" +"actually implements the text wrapping strategy. Both " +"the :class:`~textwrap.TextWrapper` class and the :func:`~textwrap.wrap` " +"and :func:`~textwrap.fill` functions support a number of additional keyword " +"arguments for fine-tuning the formatting; consult the module's documentation " +"for details. (Contributed by Greg Ward.)" msgstr "" #: ../../whatsnew/2.3.rst:1512 msgid "" -"The :mod:`!thread` and :mod:`threading` modules now have companion modules, :" -"mod:`!dummy_thread` and :mod:`!dummy_threading`, that provide a do-nothing " -"implementation of the :mod:`!thread` module's interface for platforms where " -"threads are not supported. The intention is to simplify thread-aware " -"modules (ones that *don't* rely on threads to run) by putting the following " -"code at the top::" +"The :mod:`!thread` and :mod:`threading` modules now have companion " +"modules, :mod:`!dummy_thread` and :mod:`!dummy_threading`, that provide a do-" +"nothing implementation of the :mod:`!thread` module's interface for " +"platforms where threads are not supported. The intention is to simplify " +"thread-aware modules (ones that *don't* rely on threads to run) by putting " +"the following code at the top::" msgstr "" #: ../../whatsnew/2.3.rst:1519 @@ -2302,12 +2327,13 @@ msgstr "" #: ../../whatsnew/2.3.rst:1524 msgid "" "In this example, :mod:`!_threading` is used as the module name to make it " -"clear that the module being used is not necessarily the actual :mod:" -"`threading` module. Code can call functions and use classes in :mod:`!" -"_threading` whether or not threads are supported, avoiding an :keyword:`if` " -"statement and making the code slightly clearer. This module will not " -"magically make multithreaded code run without threads; code that waits for " -"another thread to return or to do something will simply hang forever." +"clear that the module being used is not necessarily the " +"actual :mod:`threading` module. Code can call functions and use classes " +"in :mod:`!_threading` whether or not threads are supported, avoiding " +"an :keyword:`if` statement and making the code slightly clearer. This " +"module will not magically make multithreaded code run without threads; code " +"that waits for another thread to return or to do something will simply hang " +"forever." msgstr "" #: ../../whatsnew/2.3.rst:1532 @@ -2361,9 +2387,9 @@ msgid "" "a command, passing it to the correct thread, and waiting for the results. " "Other interfaces can't be handled automatically but :mod:`!Tkinter` will now " "raise an exception on such an access so that you can at least find out about " -"the problem. See https://mail.python.org/pipermail/python-dev/2002-" -"December/031107.html for a more detailed explanation of this change. " -"(Implemented by Martin von Löwis.)" +"the problem. See https://mail.python.org/pipermail/python-dev/2002-December/" +"031107.html for a more detailed explanation of this change. (Implemented by " +"Martin von Löwis.)" msgstr "" #: ../../whatsnew/2.3.rst:1572 @@ -2413,8 +2439,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1598 msgid "" "Adding the mix-in as a superclass provides the full dictionary interface " -"whenever the class defines :meth:`~object.__getitem__`, :meth:`~object." -"__setitem__`, :meth:`~object.__delitem__`, and :meth:`!keys`. For example::" +"whenever the class " +"defines :meth:`~object.__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__delitem__`, " +"and :meth:`!keys`. For example::" msgstr "" #: ../../whatsnew/2.3.rst:1602 @@ -2464,9 +2491,9 @@ msgstr "(由 Raymond Hettinger 所貢獻。)" #: ../../whatsnew/2.3.rst:1641 msgid "" "The DOM implementation in :mod:`xml.dom.minidom` can now generate XML output " -"in a particular encoding by providing an optional encoding argument to the :" -"meth:`~xml.dom.minidom.Node.toxml` and :meth:`~xml.dom.minidom.Node." -"toprettyxml` methods of DOM nodes." +"in a particular encoding by providing an optional encoding argument to " +"the :meth:`~xml.dom.minidom.Node.toxml` " +"and :meth:`~xml.dom.minidom.Node.toprettyxml` methods of DOM nodes." msgstr "" #: ../../whatsnew/2.3.rst:1645 @@ -2523,9 +2550,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1681 msgid "" -"Date and time types suitable for expressing timestamps were added as the :" -"mod:`datetime` module. The types don't support different calendars or many " -"fancy features, and just stick to the basics of representing time." +"Date and time types suitable for expressing timestamps were added as " +"the :mod:`datetime` module. The types don't support different calendars or " +"many fancy features, and just stick to the basics of representing time." msgstr "" #: ../../whatsnew/2.3.rst:1685 @@ -2533,19 +2560,19 @@ msgid "" "The three primary types are: :class:`~datetime.date`, representing a day, " "month, and year; :class:`~datetime.time`, consisting of hour, minute, and " "second; and :class:`~datetime.datetime`, which contains all the attributes " -"of both :class:`~datetime.date` and :class:`~datetime.time`. There's also a :" -"class:`~datetime.timedelta` class representing differences between two " +"of both :class:`~datetime.date` and :class:`~datetime.time`. There's also " +"a :class:`~datetime.timedelta` class representing differences between two " "points in time, and time zone logic is implemented by classes inheriting " "from the abstract :class:`~datetime.tzinfo` class." msgstr "" #: ../../whatsnew/2.3.rst:1692 msgid "" -"You can create instances of :class:`~datetime.date` and :class:`~datetime." -"time` by either supplying keyword arguments to the appropriate constructor, " -"e.g. ``datetime.date(year=1972, month=10, day=15)``, or by using one of a " -"number of class methods. For example, the :meth:`~datetime.date.today` " -"class method returns the current local date." +"You can create instances of :class:`~datetime.date` " +"and :class:`~datetime.time` by either supplying keyword arguments to the " +"appropriate constructor, e.g. ``datetime.date(year=1972, month=10, " +"day=15)``, or by using one of a number of class methods. For example, " +"the :meth:`~datetime.date.today` class method returns the current local date." msgstr "" #: ../../whatsnew/2.3.rst:1698 @@ -2586,12 +2613,12 @@ msgstr "" #: ../../whatsnew/2.3.rst:1720 msgid "" "Instances can be compared, hashed, and converted to strings (the result is " -"the same as that of :meth:`~datetime.datetime.isoformat`). :class:" -"`~datetime.date` and :class:`~datetime.datetime` instances can be subtracted " -"from each other, and added to :class:`~datetime.timedelta` instances. The " -"largest missing feature is that there's no standard library support for " -"parsing strings and getting back a :class:`~datetime.date` or :class:" -"`~datetime.datetime`." +"the same as that " +"of :meth:`~datetime.datetime.isoformat`). :class:`~datetime.date` " +"and :class:`~datetime.datetime` instances can be subtracted from each other, " +"and added to :class:`~datetime.timedelta` instances. The largest missing " +"feature is that there's no standard library support for parsing strings and " +"getting back a :class:`~datetime.date` or :class:`~datetime.datetime`." msgstr "" #: ../../whatsnew/2.3.rst:1727 @@ -2635,8 +2662,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1756 msgid "" -"Parsing a command line is then done by calling the :meth:`~optparse." -"OptionParser.parse_args` method. ::" +"Parsing a command line is then done by calling " +"the :meth:`~optparse.OptionParser.parse_args` method. ::" msgstr "" #: ../../whatsnew/2.3.rst:1758 @@ -2755,22 +2782,23 @@ msgstr "" #: ../../whatsnew/2.3.rst:1842 msgid "" "To allocate and free an undistinguished chunk of memory use the \"raw " -"memory\" family: :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, and :c:" -"func:`PyMem_Free`." +"memory\" family: :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, " +"and :c:func:`PyMem_Free`." msgstr "" #: ../../whatsnew/2.3.rst:1845 msgid "" "The \"object memory\" family is the interface to the pymalloc facility " "described above and is biased towards a large number of \"small\" " -"allocations: :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, and :c:" -"func:`PyObject_Free`." +"allocations: :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, " +"and :c:func:`PyObject_Free`." msgstr "" #: ../../whatsnew/2.3.rst:1849 msgid "" -"To allocate and free Python objects, use the \"object\" family :c:macro:" -"`PyObject_New`, :c:macro:`PyObject_NewVar`, and :c:func:`PyObject_Del`." +"To allocate and free Python objects, use the \"object\" " +"family :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, " +"and :c:func:`PyObject_Del`." msgstr "" #: ../../whatsnew/2.3.rst:1852 @@ -2778,8 +2806,8 @@ msgid "" "Thanks to lots of work by Tim Peters, pymalloc in 2.3 also provides " "debugging features to catch memory overwrites and doubled frees in both " "extension modules and in the interpreter itself. To enable this support, " -"compile a debugging version of the Python interpreter by running :program:" -"`configure` with :option:`!--with-pydebug`." +"compile a debugging version of the Python interpreter by " +"running :program:`configure` with :option:`!--with-pydebug`." msgstr "" #: ../../whatsnew/2.3.rst:1858 @@ -2804,25 +2832,26 @@ msgstr "" #: ../../whatsnew/2.3.rst:1876 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/2.3.rst:1878 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/2.3.rst:1880 msgid "" "The cycle detection implementation used by the garbage collection has proven " "to be stable, so it's now been made mandatory. You can no longer compile " -"Python without it, and the :option:`!--with-cycle-gc` switch to :program:" -"`configure` has been removed." +"Python without it, and the :option:`!--with-cycle-gc` switch " +"to :program:`configure` has been removed." msgstr "" #: ../../whatsnew/2.3.rst:1885 msgid "" -"Python can now optionally be built as a shared library (:file:`libpython2.3." -"so`) by supplying :option:`!--enable-shared` when running Python's :program:" -"`configure` script. (Contributed by Ondrej Palkovsky.)" +"Python can now optionally be built as a shared library " +"(:file:`libpython2.3.so`) by supplying :option:`!--enable-shared` when " +"running Python's :program:`configure` script. (Contributed by Ondrej " +"Palkovsky.)" msgstr "" #: ../../whatsnew/2.3.rst:1889 @@ -2837,8 +2866,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1894 msgid "" "The interpreter can be compiled without any docstrings for the built-in " -"functions and modules by supplying :option:`!--without-doc-strings` to the :" -"program:`configure` script. This makes the Python executable about 10% " +"functions and modules by supplying :option:`!--without-doc-strings` to " +"the :program:`configure` script. This makes the Python executable about 10% " "smaller, but will also mean that you can't get help for Python's built-ins. " "(Contributed by Gustavo Niemeyer.)" msgstr "" @@ -2857,9 +2886,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1907 msgid "" ":c:func:`PyArg_ParseTuple` accepts new format characters for various sizes " -"of unsigned integers: ``B`` for :c:expr:`unsigned char`, ``H`` for :c:expr:" -"`unsigned short int`, ``I`` for :c:expr:`unsigned int`, and ``K`` for :c:" -"expr:`unsigned long long`." +"of unsigned integers: ``B`` for :c:expr:`unsigned char`, ``H`` " +"for :c:expr:`unsigned short int`, ``I`` for :c:expr:`unsigned int`, and " +"``K`` for :c:expr:`unsigned long long`." msgstr "" #: ../../whatsnew/2.3.rst:1912 @@ -2871,9 +2900,9 @@ msgstr "" #: ../../whatsnew/2.3.rst:1915 msgid "" "File objects now manage their internal string buffer differently, increasing " -"it exponentially when needed. This results in the benchmark tests in :file:" -"`Lib/test/test_bufio.py` speeding up considerably (from 57 seconds to 1.7 " -"seconds, according to one measurement)." +"it exponentially when needed. This results in the benchmark tests " +"in :file:`Lib/test/test_bufio.py` speeding up considerably (from 57 seconds " +"to 1.7 seconds, according to one measurement)." msgstr "" #: ../../whatsnew/2.3.rst:1920 @@ -2892,12 +2921,12 @@ msgstr "" #: ../../whatsnew/2.3.rst:1927 msgid "" "If you dynamically allocate type objects in your extension, you should be " -"aware of a change in the rules relating to the :attr:`~type.__module__` and :" -"attr:`~type.__name__` attributes. In summary, you will want to ensure the " -"type's dictionary contains a ``'__module__'`` key; making the module name " -"the part of the type name leading up to the final period will no longer have " -"the desired effect. For more detail, read the API reference documentation " -"or the source." +"aware of a change in the rules relating to the :attr:`~type.__module__` " +"and :attr:`~type.__name__` attributes. In summary, you will want to ensure " +"the type's dictionary contains a ``'__module__'`` key; making the module " +"name the part of the type name leading up to the final period will no longer " +"have the desired effect. For more detail, read the API reference " +"documentation or the source." msgstr "" #: ../../whatsnew/2.3.rst:1938 @@ -2909,11 +2938,11 @@ msgid "" "Support for a port to IBM's OS/2 using the EMX runtime environment was " "merged into the main Python source tree. EMX is a POSIX emulation layer " "over the OS/2 system APIs. The Python port for EMX tries to support all the " -"POSIX-like capability exposed by the EMX runtime, and mostly succeeds; :func:" -"`!fork` and :func:`fcntl` are restricted by the limitations of the " -"underlying emulation layer. The standard OS/2 port, which uses IBM's Visual " -"Age compiler, also gained support for case-sensitive import semantics as " -"part of the integration of the EMX port into CVS. (Contributed by Andrew " +"POSIX-like capability exposed by the EMX runtime, and mostly " +"succeeds; :func:`!fork` and :func:`fcntl` are restricted by the limitations " +"of the underlying emulation layer. The standard OS/2 port, which uses IBM's " +"Visual Age compiler, also gained support for case-sensitive import semantics " +"as part of the integration of the EMX port into CVS. (Contributed by Andrew " "MacIntyre.)" msgstr "" @@ -2934,8 +2963,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1957 msgid "" -"Other new platforms now supported by Python include AtheOS (http://www." -"atheos.cx/), GNU/Hurd, and OpenVMS." +"Other new platforms now supported by Python include AtheOS (http://" +"www.atheos.cx/), GNU/Hurd, and OpenVMS." msgstr "" #: ../../whatsnew/2.3.rst:1966 @@ -3005,10 +3034,11 @@ msgstr "" #: ../../whatsnew/2.3.rst:2006 msgid "" -"A nifty new feature is that trace functions can now assign to the :attr:" -"`~frame.f_lineno` attribute of frame objects, changing the line that will be " -"executed next. A ``jump`` command has been added to the :mod:`pdb` debugger " -"taking advantage of this new feature. (Implemented by Richie Hindle.)" +"A nifty new feature is that trace functions can now assign to " +"the :attr:`~frame.f_lineno` attribute of frame objects, changing the line " +"that will be executed next. A ``jump`` command has been added to " +"the :mod:`pdb` debugger taking advantage of this new feature. (Implemented " +"by Richie Hindle.)" msgstr "" #: ../../whatsnew/2.3.rst:2015 @@ -3057,9 +3087,10 @@ msgstr "" #: ../../whatsnew/2.3.rst:2039 msgid "" -"Large octal and hex literals such as ``0xffffffff`` now trigger a :exc:" -"`FutureWarning`. Currently they're stored as 32-bit numbers and result in a " -"negative value, but in Python 2.4 they'll become positive long integers." +"Large octal and hex literals such as ``0xffffffff`` now trigger " +"a :exc:`FutureWarning`. Currently they're stored as 32-bit numbers and " +"result in a negative value, but in Python 2.4 they'll become positive long " +"integers." msgstr "" #: ../../whatsnew/2.3.rst:2043 diff --git a/whatsnew/2.4.po b/whatsnew/2.4.po index 7c50822863..0d58bc66af 100644 --- a/whatsnew/2.4.po +++ b/whatsnew/2.4.po @@ -136,10 +136,11 @@ msgstr "" msgid "" "The lengthy transition process for this PEP, begun in Python 2.2, takes " "another step forward in Python 2.4. In 2.3, certain integer operations that " -"would behave differently after int/long unification triggered :exc:" -"`FutureWarning` warnings and returned values limited to 32 or 64 bits " -"(depending on your platform). In 2.4, these expressions no longer produce a " -"warning and instead produce a different result that's usually a long integer." +"would behave differently after int/long unification " +"triggered :exc:`FutureWarning` warnings and returned values limited to 32 or " +"64 bits (depending on your platform). In 2.4, these expressions no longer " +"produce a warning and instead produce a different result that's usually a " +"long integer." msgstr "" #: ../../whatsnew/2.4.rst:99 @@ -182,6 +183,9 @@ msgid "" "for link in links:\n" " ..." msgstr "" +"links = [link for link in get_all_links() if not link.followed]\n" +"for link in links:\n" +" ..." #: ../../whatsnew/2.4.rst:129 msgid "instead of ::" @@ -194,6 +198,10 @@ msgid "" " continue\n" " ..." msgstr "" +"for link in get_all_links():\n" +" if link.followed:\n" +" continue\n" +" ..." #: ../../whatsnew/2.4.rst:136 msgid "" @@ -215,6 +223,9 @@ msgid "" "for link in links:\n" " ..." msgstr "" +"links = (link for link in get_all_links() if not link.followed)\n" +"for link in links:\n" +" ..." #: ../../whatsnew/2.4.rst:148 msgid "" @@ -268,6 +279,8 @@ msgid "" ">>> '%(page)i: %(title)s' % {'page':2, 'title': 'The Best of Times'}\n" "'2: The Best of Times'" msgstr "" +">>> '%(page)i: %(title)s' % {'page':2, 'title': 'The Best of Times'}\n" +"'2: The Best of Times'" #: ../../whatsnew/2.4.rst:183 msgid "" @@ -295,6 +308,10 @@ msgid "" ">>> t.substitute({'page':2, 'title': 'The Best of Times'})\n" "'2: The Best of Times'" msgstr "" +">>> import string\n" +">>> t = string.Template('$page: $title')\n" +">>> t.substitute({'page':2, 'title': 'The Best of Times'})\n" +"'2: The Best of Times'" #: ../../whatsnew/2.4.rst:200 msgid "" @@ -309,6 +326,9 @@ msgid "" ">>> t.safe_substitute({'page':3})\n" "'3: $title'" msgstr "" +">>> t = string.Template('$page: $title')\n" +">>> t.safe_substitute({'page':3})\n" +"'3: $title'" #: ../../whatsnew/2.4.rst:211 msgid ":pep:`292` - Simpler String Substitutions" @@ -326,10 +346,10 @@ msgstr "" msgid "" "Python 2.2 extended Python's object model by adding static methods and class " "methods, but it didn't extend Python's syntax to provide any new way of " -"defining static or class methods. Instead, you had to write a :keyword:" -"`def` statement in the usual way, and pass the resulting method to a :func:" -"`staticmethod` or :func:`classmethod` function that would wrap up the " -"function as a method of the new type. Your code would look like this::" +"defining static or class methods. Instead, you had to write " +"a :keyword:`def` statement in the usual way, and pass the resulting method " +"to a :func:`staticmethod` or :func:`classmethod` function that would wrap up " +"the function as a method of the new type. Your code would look like this::" msgstr "" #: ../../whatsnew/2.4.rst:227 @@ -343,8 +363,8 @@ msgstr "" #: ../../whatsnew/2.4.rst:233 msgid "" -"If the method was very long, it would be easy to miss or forget the :func:" -"`classmethod` invocation after the function body." +"If the method was very long, it would be easy to miss or forget " +"the :func:`classmethod` invocation after the function body." msgstr "" #: ../../whatsnew/2.4.rst:236 @@ -378,6 +398,11 @@ msgid "" " def meth (cls):\n" " ..." msgstr "" +"class C:\n" +"\n" +" @classmethod\n" +" def meth (cls):\n" +" ..." #: ../../whatsnew/2.4.rst:256 msgid "" @@ -393,6 +418,11 @@ msgid "" "def f ():\n" " ..." msgstr "" +"@A\n" +"@B\n" +"@C\n" +"def f ():\n" +" ..." #: ../../whatsnew/2.4.rst:265 msgid "It's equivalent to the following pre-decorator code::" @@ -403,6 +433,8 @@ msgid "" "def f(): ...\n" "f = A(B(C(f)))" msgstr "" +"def f(): ...\n" +"f = A(B(C(f)))" #: ../../whatsnew/2.4.rst:270 msgid "" @@ -438,6 +470,18 @@ msgid "" "'decorated'\n" ">>>" msgstr "" +">>> def deco(func):\n" +"... func.attr = 'decorated'\n" +"... return func\n" +"...\n" +">>> @deco\n" +"... def f(): pass\n" +"...\n" +">>> f\n" +"<function f at 0x402ef0d4>\n" +">>> f.attr\n" +"'decorated'\n" +">>>" #: ../../whatsnew/2.4.rst:295 msgid "" @@ -462,6 +506,20 @@ msgid "" "def p2(arg):\n" " print arg*2" msgstr "" +"def require_int (func):\n" +" def wrapper (arg):\n" +" assert isinstance(arg, int)\n" +" return func(arg)\n" +"\n" +" return wrapper\n" +"\n" +"@require_int\n" +"def p1 (arg):\n" +" print arg\n" +"\n" +"@require_int\n" +"def p2(arg):\n" +" print arg*2" #: ../../whatsnew/2.4.rst:313 msgid "" @@ -484,6 +542,9 @@ msgid "" "_deco = C(args)\n" "f = A(B(_deco(f)))" msgstr "" +"def f(): ...\n" +"_deco = C(args)\n" +"f = A(B(_deco(f)))" #: ../../whatsnew/2.4.rst:325 msgid "" @@ -536,6 +597,12 @@ msgid "" "2\n" "1" msgstr "" +">>> for i in reversed(xrange(1,4)):\n" +"... print i\n" +"...\n" +"3\n" +"2\n" +"1" #: ../../whatsnew/2.4.rst:360 msgid "" @@ -546,8 +613,8 @@ msgstr "" #: ../../whatsnew/2.4.rst:363 msgid "" "Note that :func:`reversed` only accepts sequences, not arbitrary iterators. " -"If you want to reverse an iterator, first convert it to a list with :func:" -"`list`. ::" +"If you want to reverse an iterator, first convert it to a list " +"with :func:`list`. ::" msgstr "" #: ../../whatsnew/2.4.rst:367 @@ -581,13 +648,14 @@ msgstr "" #: ../../whatsnew/2.4.rst:386 msgid "" "The standard library provides a number of ways to execute a subprocess, " -"offering different features and different levels of complexity. ``os." -"system(command)`` is easy to use, but slow (it runs a shell process which " -"executes the command) and dangerous (you have to be careful about escaping " -"the shell's metacharacters). The :mod:`!popen2` module offers classes that " -"can capture standard output and standard error from the subprocess, but the " -"naming is confusing. The :mod:`subprocess` module cleans this up, " -"providing a unified interface that offers all the features you might need." +"offering different features and different levels of complexity. " +"``os.system(command)`` is easy to use, but slow (it runs a shell process " +"which executes the command) and dangerous (you have to be careful about " +"escaping the shell's metacharacters). The :mod:`!popen2` module offers " +"classes that can capture standard output and standard error from the " +"subprocess, but the naming is confusing. The :mod:`subprocess` module " +"cleans this up, providing a unified interface that offers all the features " +"you might need." msgstr "" #: ../../whatsnew/2.4.rst:395 @@ -605,6 +673,11 @@ msgid "" " cwd=None, env=None, universal_newlines=False,\n" " startupinfo=None, creationflags=0):" msgstr "" +"class Popen(args, bufsize=0, executable=None,\n" +" stdin=None, stdout=None, stderr=None,\n" +" preexec_fn=None, close_fds=False, shell=False,\n" +" cwd=None, env=None, universal_newlines=False,\n" +" startupinfo=None, creationflags=0):" #: ../../whatsnew/2.4.rst:405 msgid "" @@ -649,26 +722,27 @@ msgstr "" #: ../../whatsnew/2.4.rst:430 msgid "" -"*universal_newlines* opens the child's input and output using Python's :term:" -"`universal newlines` feature." +"*universal_newlines* opens the child's input and output using " +"Python's :term:`universal newlines` feature." msgstr "" #: ../../whatsnew/2.4.rst:433 msgid "" -"Once you've created the :class:`Popen` instance, you can call its :meth:" -"`wait` method to pause until the subprocess has exited, :meth:`poll` to " -"check if it's exited without pausing, or ``communicate(data)`` to send the " -"string *data* to the subprocess's standard input. ``communicate(data)`` " -"then reads any data that the subprocess has sent to its standard output or " -"standard error, returning a tuple ``(stdout_data, stderr_data)``." +"Once you've created the :class:`Popen` instance, you can call " +"its :meth:`wait` method to pause until the subprocess has " +"exited, :meth:`poll` to check if it's exited without pausing, or " +"``communicate(data)`` to send the string *data* to the subprocess's standard " +"input. ``communicate(data)`` then reads any data that the subprocess has " +"sent to its standard output or standard error, returning a tuple " +"``(stdout_data, stderr_data)``." msgstr "" #: ../../whatsnew/2.4.rst:440 msgid "" -":func:`call` is a shortcut that passes its arguments along to the :class:" -"`Popen` constructor, waits for the command to complete, and returns the " -"status code of the subprocess. It can serve as a safer analog to :func:`os." -"system`::" +":func:`call` is a shortcut that passes its arguments along to " +"the :class:`Popen` constructor, waits for the command to complete, and " +"returns the status code of the subprocess. It can serve as a safer analog " +"to :func:`os.system`::" msgstr "" #: ../../whatsnew/2.4.rst:444 @@ -681,6 +755,13 @@ msgid "" " # dpkg returned an error\n" " ..." msgstr "" +"sts = subprocess.call(['dpkg', '-i', '/tmp/new-package.deb'])\n" +"if sts == 0:\n" +" # 成功\n" +" ...\n" +"else:\n" +" # dpkg 回傳一個錯誤\n" +" ..." #: ../../whatsnew/2.4.rst:452 msgid "" @@ -784,6 +865,8 @@ msgid "" ">>> 1.1\n" "1.1000000000000001" msgstr "" +">>> 1.1\n" +"1.1000000000000001" #: ../../whatsnew/2.4.rst:521 msgid "" @@ -816,10 +899,10 @@ msgstr ":class:`Decimal` 型別" #: ../../whatsnew/2.4.rst:540 msgid "" "A new module, :mod:`decimal`, was added to Python's standard library. It " -"contains two classes, :class:`Decimal` and :class:`Context`. :class:" -"`Decimal` instances represent numbers, and :class:`Context` instances are " -"used to wrap up various settings such as the precision and default rounding " -"mode." +"contains two classes, :class:`Decimal` " +"and :class:`Context`. :class:`Decimal` instances represent numbers, " +"and :class:`Context` instances are used to wrap up various settings such as " +"the precision and default rounding mode." msgstr "" #: ../../whatsnew/2.4.rst:545 @@ -838,6 +921,11 @@ msgid "" ">>> decimal.Decimal(\"1.1\")\n" "Decimal(\"1.1\")" msgstr "" +">>> import decimal\n" +">>> decimal.Decimal(1972)\n" +"Decimal(\"1972\")\n" +">>> decimal.Decimal(\"1.1\")\n" +"Decimal(\"1.1\")" #: ../../whatsnew/2.4.rst:556 msgid "" @@ -850,6 +938,8 @@ msgid "" ">>> decimal.Decimal((1, (1, 4, 7, 5), -2))\n" "Decimal(\"-14.75\")" msgstr "" +">>> decimal.Decimal((1, (1, 4, 7, 5), -2))\n" +"Decimal(\"-14.75\")" #: ../../whatsnew/2.4.rst:562 msgid "" @@ -875,6 +965,11 @@ msgid "" ">>> decimal.Decimal('%.12f' % f)\n" "Decimal(\"1.100000000000\")" msgstr "" +">>> f = 1.1\n" +">>> decimal.Decimal(str(f))\n" +"Decimal(\"1.1\")\n" +">>> decimal.Decimal('%.12f' % f)\n" +"Decimal(\"1.100000000000\")" #: ../../whatsnew/2.4.rst:578 msgid "" @@ -902,6 +997,22 @@ msgid "" " ...\n" "decimal.InvalidOperation: x ** (non-integer)" msgstr "" +">>> a = decimal.Decimal('35.72')\n" +">>> b = decimal.Decimal('1.73')\n" +">>> a+b\n" +"Decimal(\"37.45\")\n" +">>> a-b\n" +"Decimal(\"33.99\")\n" +">>> a*b\n" +"Decimal(\"61.7956\")\n" +">>> a/b\n" +"Decimal(\"20.64739884393063583815028902\")\n" +">>> a ** 2\n" +"Decimal(\"1275.9184\")\n" +">>> a**b\n" +"Traceback (most recent call last):\n" +" ...\n" +"decimal.InvalidOperation: x ** (non-integer)" #: ../../whatsnew/2.4.rst:599 msgid "" @@ -920,6 +1031,14 @@ msgid "" "types.\n" ">>>" msgstr "" +">>> a + 4\n" +"Decimal(\"39.72\")\n" +">>> a + 4.5\n" +"Traceback (most recent call last):\n" +" ...\n" +"TypeError: You can interact Decimal only with int, long or Decimal data " +"types.\n" +">>>" #: ../../whatsnew/2.4.rst:610 msgid "" @@ -939,12 +1058,18 @@ msgid "" ">>> cmath.sqrt(-d)\n" "351364.18288201344j" msgstr "" +">>> import math, cmath\n" +">>> d = decimal.Decimal('123456789012.345')\n" +">>> math.sqrt(d)\n" +"351364.18288201344\n" +">>> cmath.sqrt(-d)\n" +"351364.18288201344j" #: ../../whatsnew/2.4.rst:623 msgid "" -":class:`Decimal` instances have a :meth:`sqrt` method that returns a :class:" -"`Decimal`, but if you need other things such as trigonometric functions " -"you'll have to implement them. ::" +":class:`Decimal` instances have a :meth:`sqrt` method that returns " +"a :class:`Decimal`, but if you need other things such as trigonometric " +"functions you'll have to implement them. ::" msgstr "" #: ../../whatsnew/2.4.rst:627 @@ -952,6 +1077,8 @@ msgid "" ">>> d.sqrt()\n" "Decimal(\"351364.1828820134592177245001\")" msgstr "" +">>> d.sqrt()\n" +"Decimal(\"351364.1828820134592177245001\")" #: ../../whatsnew/2.4.rst:632 msgid "The :class:`Context` type" @@ -970,8 +1097,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:639 msgid "" ":attr:`rounding` specifies the rounding mode. The :mod:`decimal` module has " -"constants for the various possibilities: :const:`ROUND_DOWN`, :const:" -"`ROUND_CEILING`, :const:`ROUND_HALF_EVEN`, and various others." +"constants for the various " +"possibilities: :const:`ROUND_DOWN`, :const:`ROUND_CEILING`, :const:`ROUND_HALF_EVEN`, " +"and various others." msgstr "" #: ../../whatsnew/2.4.rst:643 @@ -984,10 +1112,10 @@ msgstr "" #: ../../whatsnew/2.4.rst:648 msgid "" -"There's a thread-local default context available by calling :func:" -"`getcontext`; you can change the properties of this context to alter the " -"default precision, rounding, or trap handling. The following example shows " -"the effect of changing the precision of the default context::" +"There's a thread-local default context available by " +"calling :func:`getcontext`; you can change the properties of this context to " +"alter the default precision, rounding, or trap handling. The following " +"example shows the effect of changing the precision of the default context::" msgstr "" #: ../../whatsnew/2.4.rst:653 @@ -1000,6 +1128,13 @@ msgid "" ">>> decimal.Decimal(1) / decimal.Decimal(7)\n" "Decimal(\"0.142857143\")" msgstr "" +">>> decimal.getcontext().prec\n" +"28\n" +">>> decimal.Decimal(1) / decimal.Decimal(7)\n" +"Decimal(\"0.1428571428571428571428571429\")\n" +">>> decimal.getcontext().prec = 9\n" +">>> decimal.Decimal(1) / decimal.Decimal(7)\n" +"Decimal(\"0.142857143\")" #: ../../whatsnew/2.4.rst:661 msgid "" @@ -1019,6 +1154,14 @@ msgid "" "Decimal(\"Infinity\")\n" ">>>" msgstr "" +">>> decimal.Decimal(1) / decimal.Decimal(0)\n" +"Traceback (most recent call last):\n" +" ...\n" +"decimal.DivisionByZero: x / 0\n" +">>> decimal.getcontext().traps[decimal.DivisionByZero] = False\n" +">>> decimal.Decimal(1) / decimal.Decimal(0)\n" +"Decimal(\"Infinity\")\n" +">>>" #: ../../whatsnew/2.4.rst:674 msgid "" @@ -1088,6 +1231,10 @@ msgid "" " CGIXMLRPCRequestHandler,\\\n" " resolve_dotted_attribute" msgstr "" +"from SimpleXMLRPCServer import SimpleXMLRPCServer,\\\n" +" SimpleXMLRPCRequestHandler,\\\n" +" CGIXMLRPCRequestHandler,\\\n" +" resolve_dotted_attribute" #: ../../whatsnew/2.4.rst:713 msgid "" @@ -1103,6 +1250,10 @@ msgid "" " CGIXMLRPCRequestHandler,\n" " resolve_dotted_attribute)" msgstr "" +"from SimpleXMLRPCServer import (SimpleXMLRPCServer,\n" +" SimpleXMLRPCRequestHandler,\n" +" CGIXMLRPCRequestHandler,\n" +" resolve_dotted_attribute)" #: ../../whatsnew/2.4.rst:722 msgid "" @@ -1156,8 +1307,8 @@ msgstr "" #: ../../whatsnew/2.4.rst:756 msgid "" -"``PyOS_ascii_formatd(buffer, buf_len, format, d)`` converts a :c:expr:" -"`double` to an ASCII string." +"``PyOS_ascii_formatd(buffer, buf_len, format, d)`` converts " +"a :c:expr:`double` to an ASCII string." msgstr "" #: ../../whatsnew/2.4.rst:759 @@ -1165,9 +1316,9 @@ msgid "" "The code for these functions came from the GLib library (`https://developer-" "old.gnome.org/glib/2.26/ <http://web.archive.org/web/20210306104320/https://" "developer.gnome.org/glib/2.26/>`__), whose developers kindly relicensed the " -"relevant functions and donated them to the Python Software Foundation. The :" -"mod:`locale` module can now change the numeric locale, letting extensions " -"such as GTK+ produce the correct results." +"relevant functions and donated them to the Python Software Foundation. " +"The :mod:`locale` module can now change the numeric locale, letting " +"extensions such as GTK+ produce the correct results." msgstr "" #: ../../whatsnew/2.4.rst:768 @@ -1216,9 +1367,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:792 msgid "" -"The :meth:`dict.update` method now accepts the same argument forms as the :" -"class:`dict` constructor. This includes any mapping, any iterable of key/" -"value pairs, and keyword arguments. (Contributed by Raymond Hettinger.)" +"The :meth:`dict.update` method now accepts the same argument forms as " +"the :class:`dict` constructor. This includes any mapping, any iterable of " +"key/value pairs, and keyword arguments. (Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:796 @@ -1230,9 +1381,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:800 msgid "" -"Strings also gained an :meth:`rsplit` method that works like the :meth:" -"`split` method but splits from the end of the string. (Contributed by Sean " -"Reifschneider.) ::" +"Strings also gained an :meth:`rsplit` method that works like " +"the :meth:`split` method but splits from the end of the string. " +"(Contributed by Sean Reifschneider.) ::" msgstr "" #: ../../whatsnew/2.4.rst:804 @@ -1242,12 +1393,16 @@ msgid "" "'www.python.org'.rsplit('.', 1)\n" "['www.python', 'org']" msgstr "" +">>> 'www.python.org'.split('.', 1)\n" +"['www', 'python.org']\n" +"'www.python.org'.rsplit('.', 1)\n" +"['www.python', 'org']" #: ../../whatsnew/2.4.rst:809 msgid "" -"Three keyword parameters, *cmp*, *key*, and *reverse*, were added to the :" -"meth:`sort` method of lists. These parameters make some common usages of :" -"meth:`sort` simpler. All of these parameters are optional." +"Three keyword parameters, *cmp*, *key*, and *reverse*, were added to " +"the :meth:`sort` method of lists. These parameters make some common usages " +"of :meth:`sort` simpler. All of these parameters are optional." msgstr "" #: ../../whatsnew/2.4.rst:813 @@ -1255,8 +1410,8 @@ msgid "" "For the *cmp* parameter, the value should be a comparison function that " "takes two parameters and returns -1, 0, or +1 depending on how the " "parameters compare. This function will then be used to sort the list. " -"Previously this was the only parameter that could be provided to :meth:" -"`sort`." +"Previously this was the only parameter that could be provided " +"to :meth:`sort`." msgstr "" #: ../../whatsnew/2.4.rst:818 @@ -1308,8 +1463,8 @@ msgstr "" #: ../../whatsnew/2.4.rst:849 msgid "" "Finally, the *reverse* parameter takes a Boolean value. If the value is " -"true, the list will be sorted into reverse order. Instead of ``L.sort(); L." -"reverse()``, you can now write ``L.sort(reverse=True)``." +"true, the list will be sorted into reverse order. Instead of ``L.sort(); " +"L.reverse()``, you can now write ``L.sort(reverse=True)``." msgstr "" #: ../../whatsnew/2.4.rst:853 @@ -1373,8 +1528,8 @@ msgstr "(由 Raymond Hettinger 所貢獻。)" #: ../../whatsnew/2.4.rst:894 ../../whatsnew/2.4.rst:1520 msgid "" -"Integer operations will no longer trigger an :exc:`OverflowWarning`. The :" -"exc:`OverflowWarning` warning will disappear in Python 2.5." +"Integer operations will no longer trigger an :exc:`OverflowWarning`. " +"The :exc:`OverflowWarning` warning will disappear in Python 2.5." msgstr "" #: ../../whatsnew/2.4.rst:897 @@ -1396,9 +1551,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:907 msgid "" "The :func:`zip` built-in function and :func:`itertools.izip` now return an " -"empty list if called with no arguments. Previously they raised a :exc:" -"`TypeError` exception. This makes them more suitable for use with variable " -"length argument lists::" +"empty list if called with no arguments. Previously they raised " +"a :exc:`TypeError` exception. This makes them more suitable for use with " +"variable length argument lists::" msgstr "" #: ../../whatsnew/2.4.rst:912 @@ -1434,36 +1589,38 @@ msgstr "最佳化" msgid "" "The inner loops for list and tuple slicing were optimized and now run about " "one-third faster. The inner loops for dictionaries were also optimized, " -"resulting in performance boosts for :meth:`keys`, :meth:`values`, :meth:" -"`items`, :meth:`iterkeys`, :meth:`itervalues`, and :meth:`iteritems`. " -"(Contributed by Raymond Hettinger.)" +"resulting in performance boosts " +"for :meth:`keys`, :meth:`values`, :meth:`items`, :meth:`iterkeys`, :meth:`itervalues`, " +"and :meth:`iteritems`. (Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:942 msgid "" "The machinery for growing and shrinking lists was optimized for speed and " "for space efficiency. Appending and popping from lists now runs faster due " -"to more efficient code paths and less frequent use of the underlying system :" -"c:func:`realloc`. List comprehensions also benefit. :meth:`list.extend` " -"was also optimized and no longer converts its argument into a temporary list " -"before extending the base list. (Contributed by Raymond Hettinger.)" +"to more efficient code paths and less frequent use of the underlying " +"system :c:func:`realloc`. List comprehensions also " +"benefit. :meth:`list.extend` was also optimized and no longer converts its " +"argument into a temporary list before extending the base list. (Contributed " +"by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:949 msgid "" ":func:`list`, :func:`tuple`, :func:`map`, :func:`filter`, and :func:`zip` " -"now run several times faster with non-sequence arguments that supply a :meth:" -"`__len__` method. (Contributed by Raymond Hettinger.)" +"now run several times faster with non-sequence arguments that supply " +"a :meth:`__len__` method. (Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:953 msgid "" -"The methods :meth:`list.__getitem__`, :meth:`dict.__getitem__`, and :meth:" -"`dict.__contains__` are now implemented as :class:`method_descriptor` " -"objects rather than :class:`wrapper_descriptor` objects. This form of " -"access doubles their performance and makes them more suitable for use as " -"arguments to functionals: ``map(mydict.__getitem__, keylist)``. (Contributed " -"by Raymond Hettinger.)" +"The methods :meth:`list.__getitem__`, :meth:`dict.__getitem__`, " +"and :meth:`dict.__contains__` are now implemented " +"as :class:`method_descriptor` objects rather " +"than :class:`wrapper_descriptor` objects. This form of access doubles " +"their performance and makes them more suitable for use as arguments to " +"functionals: ``map(mydict.__getitem__, keylist)``. (Contributed by Raymond " +"Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:960 @@ -1612,18 +1769,18 @@ msgstr "" msgid "" "The :mod:`ConfigParser <configparser>` classes have been enhanced slightly. " "The :meth:`~configparser.ConfigParser.read` method now returns a list of the " -"files that were successfully parsed, and the :meth:`~configparser." -"ConfigParser.set` method raises :exc:`TypeError` if passed a *value* " -"argument that isn't a string. (Contributed by John Belmonte and David " -"Goodger.)" +"files that were successfully parsed, and " +"the :meth:`~configparser.ConfigParser.set` method raises :exc:`TypeError` if " +"passed a *value* argument that isn't a string. (Contributed by John " +"Belmonte and David Goodger.)" msgstr "" #: ../../whatsnew/2.4.rst:1060 msgid "" -"The :mod:`curses` module now supports the ncurses extension :func:" -"`use_default_colors`. On platforms where the terminal supports " -"transparency, this makes it possible to use a transparent background. " -"(Contributed by Jörg Lehmann.)" +"The :mod:`curses` module now supports the ncurses " +"extension :func:`use_default_colors`. On platforms where the terminal " +"supports transparency, this makes it possible to use a transparent " +"background. (Contributed by Jörg Lehmann.)" msgstr "" #: ../../whatsnew/2.4.rst:1065 @@ -1649,19 +1806,19 @@ msgstr "" msgid "" "The :mod:`heapq` module has been converted to C. The resulting tenfold " "improvement in speed makes the module suitable for handling high volumes of " -"data. In addition, the module has two new functions :func:`nlargest` and :" -"func:`nsmallest` that use heaps to find the N largest or smallest values in " -"a dataset without the expense of a full sort. (Contributed by Raymond " -"Hettinger.)" +"data. In addition, the module has two new functions :func:`nlargest` " +"and :func:`nsmallest` that use heaps to find the N largest or smallest " +"values in a dataset without the expense of a full sort. (Contributed by " +"Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.4.rst:1084 msgid "" "The :mod:`httplib <http>` module now contains constants for HTTP status " "codes defined in various HTTP-related RFC documents. Constants have names " -"such as :const:`OK`, :const:`CREATED`, :const:`CONTINUE`, and :const:" -"`MOVED_PERMANENTLY`; use pydoc to get a full list. (Contributed by Andrew " -"Eland.)" +"such as :const:`OK`, :const:`CREATED`, :const:`CONTINUE`, " +"and :const:`MOVED_PERMANENTLY`; use pydoc to get a full list. (Contributed " +"by Andrew Eland.)" msgstr "" #: ../../whatsnew/2.4.rst:1090 @@ -1703,12 +1860,23 @@ msgid "" "0 [12, 14]\n" ">>>" msgstr "" +">>> import itertools\n" +">>> L = [2, 4, 6, 7, 8, 9, 11, 12, 14]\n" +">>> for key_val, it in itertools.groupby(L, lambda x: x % 2):\n" +"... print key_val, list(it)\n" +"...\n" +"0 [2, 4, 6]\n" +"1 [7]\n" +"0 [8]\n" +"1 [9, 11]\n" +"0 [12, 14]\n" +">>>" #: ../../whatsnew/2.4.rst:1118 msgid "" -":func:`groupby` is typically used with sorted input. The logic for :func:" -"`groupby` is similar to the Unix ``uniq`` filter which makes it handy for " -"eliminating, counting, or identifying duplicate elements::" +":func:`groupby` is typically used with sorted input. The logic " +"for :func:`groupby` is similar to the Unix ``uniq`` filter which makes it " +"handy for eliminating, counting, or identifying duplicate elements::" msgstr "" #: ../../whatsnew/2.4.rst:1122 @@ -1771,19 +1939,19 @@ msgstr "" #: ../../whatsnew/2.4.rst:1165 msgid "" -"A number of functions were added to the :mod:`locale` module, such as :func:" -"`bind_textdomain_codeset` to specify a particular encoding and a family of :" -"func:`!l\\*gettext` functions that return messages in the chosen encoding. " -"(Contributed by Gustavo Niemeyer.)" +"A number of functions were added to the :mod:`locale` module, such " +"as :func:`bind_textdomain_codeset` to specify a particular encoding and a " +"family of :func:`!l\\*gettext` functions that return messages in the chosen " +"encoding. (Contributed by Gustavo Niemeyer.)" msgstr "" #: ../../whatsnew/2.4.rst:1170 msgid "" -"Some keyword arguments were added to the :mod:`logging` package's :func:" -"`basicConfig` function to simplify log configuration. The default behavior " -"is to log messages to standard error, but various keyword arguments can be " -"specified to log to a particular file, change the logging format, or set the " -"logging level. For example::" +"Some keyword arguments were added to the :mod:`logging` " +"package's :func:`basicConfig` function to simplify log configuration. The " +"default behavior is to log messages to standard error, but various keyword " +"arguments can be specified to log to a particular file, change the logging " +"format, or set the logging level. For example::" msgstr "" #: ../../whatsnew/2.4.rst:1176 @@ -1798,15 +1966,15 @@ msgstr "" msgid "" "Other additions to the :mod:`logging` package include a ``log(level, msg)`` " "convenience method, as well as a :class:`TimedRotatingFileHandler` class " -"that rotates its log files at a timed interval. The module already had :" -"class:`RotatingFileHandler`, which rotated logs once the file exceeded a " -"certain size. Both classes derive from a new :class:`BaseRotatingHandler` " +"that rotates its log files at a timed interval. The module already " +"had :class:`RotatingFileHandler`, which rotated logs once the file exceeded " +"a certain size. Both classes derive from a new :class:`BaseRotatingHandler` " "class that can be used to implement other rotating handlers." msgstr "" #: ../../whatsnew/2.4.rst:1188 msgid "(Changes implemented by Vinay Sajip.)" -msgstr "" +msgstr "(由 Vinay Sajip 所實作。)" #: ../../whatsnew/2.4.rst:1190 msgid "" @@ -1828,8 +1996,8 @@ msgid "" "Two new functions were added to the :mod:`operator` module, " "``attrgetter(attr)`` and ``itemgetter(index)``. Both functions return " "callables that take a single argument and return the corresponding attribute " -"or item; these callables make excellent data extractors when used with :func:" -"`map` or :func:`sorted`. For example::" +"or item; these callables make excellent data extractors when used " +"with :func:`map` or :func:`sorted`. For example::" msgstr "" #: ../../whatsnew/2.4.rst:1205 @@ -1855,11 +2023,11 @@ msgstr "" #: ../../whatsnew/2.4.rst:1221 msgid "" "The long-term plan is to deprecate the :mod:`!rfc822` module in some future " -"Python release in favor of the :mod:`email` package. To this end, the :func:" -"`email.Utils.formatdate <email.utils.formatdate>` function has been changed " -"to make it usable as a replacement for :func:`!rfc822.formatdate`. You may " -"want to write new e-mail processing code with this in mind. (Change " -"implemented by Anthony Baxter.)" +"Python release in favor of the :mod:`email` package. To this end, " +"the :func:`email.Utils.formatdate <email.utils.formatdate>` function has " +"been changed to make it usable as a replacement for :func:`!" +"rfc822.formatdate`. You may want to write new e-mail processing code with " +"this in mind. (Change implemented by Anthony Baxter.)" msgstr "" #: ../../whatsnew/2.4.rst:1227 @@ -1977,12 +2145,18 @@ msgid "" "data.number = 42\n" "data.url = ('www.python.org', 80)" msgstr "" +"import threading\n" +"\n" +"data = threading.local()\n" +"data.number = 42\n" +"data.url = ('www.python.org', 80)" #: ../../whatsnew/2.4.rst:1298 msgid "" -"Other threads can assign and retrieve their own values for the :attr:" -"`number` and :attr:`url` attributes. You can subclass :class:`local` to " -"initialize attributes or to add methods. (Contributed by Jim Fulton.)" +"Other threads can assign and retrieve their own values for " +"the :attr:`number` and :attr:`url` attributes. You can " +"subclass :class:`local` to initialize attributes or to add methods. " +"(Contributed by Jim Fulton.)" msgstr "" #: ../../whatsnew/2.4.rst:1302 @@ -2037,9 +2211,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:1338 msgid "" -":mod:`urllib2 <urllib.request>` has been changed to interact with :mod:" -"`cookielib <http.cookiejar>`: :class:`HTTPCookieProcessor` manages a cookie " -"jar that is used when accessing URLs." +":mod:`urllib2 <urllib.request>` has been changed to interact " +"with :mod:`cookielib <http.cookiejar>`: :class:`HTTPCookieProcessor` manages " +"a cookie jar that is used when accessing URLs." msgstr "" #: ../../whatsnew/2.4.rst:1342 @@ -2053,9 +2227,9 @@ msgstr "doctest" #: ../../whatsnew/2.4.rst:1350 msgid "" "The :mod:`doctest` module underwent considerable refactoring thanks to " -"Edward Loper and Tim Peters. Testing can still be as simple as running :" -"func:`doctest.testmod`, but the refactorings allow customizing the module's " -"operation in various ways" +"Edward Loper and Tim Peters. Testing can still be as simple as " +"running :func:`doctest.testmod`, but the refactorings allow customizing the " +"module's operation in various ways" msgstr "" #: ../../whatsnew/2.4.rst:1355 @@ -2094,6 +2268,11 @@ msgid "" "\n" "runner.summarize(verbose=1)" msgstr "" +"runner = doctest.DocTestRunner()\n" +"for t in tests:\n" +" tried, failed = runner.run(t)\n" +"\n" +"runner.summarize(verbose=1)" #: ../../whatsnew/2.4.rst:1380 msgid "The above example produces the following output::" @@ -2107,6 +2286,11 @@ msgid "" "2 passed and 0 failed.\n" "Test passed." msgstr "" +"1 items passed all tests:\n" +" 2 tests in f\n" +"2 tests in 1 items.\n" +"2 passed and 0 failed.\n" +"Test passed." #: ../../whatsnew/2.4.rst:1388 msgid "" @@ -2132,6 +2316,11 @@ msgid "" ">>>\n" "\"\"\"" msgstr "" +"def o (n):\n" +" \"\"\">>> o(1)\n" +"<__main__.C instance at 0x...>\n" +">>>\n" +"\"\"\"" #: ../../whatsnew/2.4.rst:1404 msgid "Another special string, ``<BLANKLINE>``, matches a blank line::" @@ -2145,13 +2334,18 @@ msgid "" ">>>\n" "\"\"\"" msgstr "" +"def p (n):\n" +" \"\"\">>> p(1)\n" +"<BLANKLINE>\n" +">>>\n" +"\"\"\"" #: ../../whatsnew/2.4.rst:1412 msgid "" "Another new capability is producing a diff-style display of the output by " -"specifying the :const:`doctest.REPORT_UDIFF` (unified diffs), :const:" -"`doctest.REPORT_CDIFF` (context diffs), or :const:`doctest.REPORT_NDIFF` " -"(delta-style) option flags. For example::" +"specifying the :const:`doctest.REPORT_UDIFF` (unified " +"diffs), :const:`doctest.REPORT_CDIFF` (context diffs), " +"or :const:`doctest.REPORT_NDIFF` (delta-style) option flags. For example::" msgstr "" #: ../../whatsnew/2.4.rst:1417 @@ -2188,10 +2382,21 @@ msgid "" " +rather\n" "**********************************************************************" msgstr "" +"**********************************************************************\n" +"File \"t.py\", line 15, in g\n" +"Failed example:\n" +" g(4)\n" +"Differences (unified diff with -expected +actual):\n" +" @@ -2,3 +2,3 @@\n" +" is\n" +" a\n" +" -lengthy\n" +" +rather\n" +"**********************************************************************" #: ../../whatsnew/2.4.rst:1449 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/2.4.rst:1451 msgid "Some of the changes to Python's build process and to the C API are:" @@ -2240,9 +2445,9 @@ msgstr "" #: ../../whatsnew/2.4.rst:1476 msgid "" -"A new function, :c:func:`PyArg_VaParseTupleAndKeywords`, is the same as :c:" -"func:`PyArg_ParseTupleAndKeywords` but takes a :c:type:`va_list` instead of " -"a number of arguments. (Contributed by Greg Chapman.)" +"A new function, :c:func:`PyArg_VaParseTupleAndKeywords`, is the same " +"as :c:func:`PyArg_ParseTupleAndKeywords` but takes a :c:type:`va_list` " +"instead of a number of arguments. (Contributed by Greg Chapman.)" msgstr "" #: ../../whatsnew/2.4.rst:1480 @@ -2256,20 +2461,20 @@ msgstr "" #: ../../whatsnew/2.4.rst:1485 msgid "" "Python can now be built with additional profiling for the interpreter " -"itself, intended as an aid to people developing the Python core. Providing :" -"option:`!--enable-profiling` to the :program:`configure` script will let you " -"profile the interpreter with :program:`gprof`, and providing the :option:`!--" -"with-tsc` switch enables profiling using the Pentium's Time-Stamp-Counter " -"register. Note that the :option:`!--with-tsc` switch is slightly misnamed, " -"because the profiling feature also works on the PowerPC platform, though " -"that processor architecture doesn't call that register \"the TSC " -"register\". (Contributed by Jeremy Hylton.)" +"itself, intended as an aid to people developing the Python core. " +"Providing :option:`!--enable-profiling` to the :program:`configure` script " +"will let you profile the interpreter with :program:`gprof`, and providing " +"the :option:`!--with-tsc` switch enables profiling using the Pentium's Time-" +"Stamp-Counter register. Note that the :option:`!--with-tsc` switch is " +"slightly misnamed, because the profiling feature also works on the PowerPC " +"platform, though that processor architecture doesn't call that register " +"\"the TSC register\". (Contributed by Jeremy Hylton.)" msgstr "" #: ../../whatsnew/2.4.rst:1495 msgid "" -"The :c:type:`!tracebackobject` type has been renamed to :c:type:" -"`PyTracebackObject`." +"The :c:type:`!tracebackobject` type has been renamed " +"to :c:type:`PyTracebackObject`." msgstr "" #: ../../whatsnew/2.4.rst:1502 @@ -2354,8 +2559,8 @@ msgstr "" msgid "" "The :func:`signals.signal` function now raises a :exc:`RuntimeError` " "exception for certain illegal values; previously these errors would pass " -"silently. For example, you can no longer set a handler on the :const:" -"`SIGKILL` signal." +"silently. For example, you can no longer set a handler on " +"the :const:`SIGKILL` signal." msgstr "" #: ../../whatsnew/2.4.rst:1560 diff --git a/whatsnew/2.5.po b/whatsnew/2.5.po index e426c7db93..dc93ea0d80 100644 --- a/whatsnew/2.5.po +++ b/whatsnew/2.5.po @@ -55,10 +55,10 @@ msgid "" "statement will make writing cleanup code easier (section :ref:`pep-343`). " "Values can now be passed into generators (section :ref:`pep-342`). Imports " "are now visible as either absolute or relative (section :ref:`pep-328`). " -"Some corner cases of exception handling are handled better (section :ref:" -"`pep-341`). All these improvements are worthwhile, but they're improvements " -"to one specific language feature or another; none of them are broad " -"modifications to Python's semantics." +"Some corner cases of exception handling are handled better " +"(section :ref:`pep-341`). All these improvements are worthwhile, but " +"they're improvements to one specific language feature or another; none of " +"them are broad modifications to Python's semantics." msgstr "" #: ../../whatsnew/2.5.rst:34 @@ -252,8 +252,8 @@ msgstr "" msgid "" "Here's another example, from a program that uses PyGTK. Here a context-" "sensitive pop-up menu is being constructed dynamically. The callback " -"provided for the menu option is a partially applied version of the :meth:" -"`open_item` method, where the first argument has been provided. ::" +"provided for the menu option is a partially applied version of " +"the :meth:`open_item` method, where the first argument has been provided. ::" msgstr "" #: ../../whatsnew/2.5.rst:165 @@ -442,8 +442,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:274 msgid "" -"This defines a package named :mod:`pkg` containing the :mod:`pkg.main` and :" -"mod:`pkg.string` submodules." +"This defines a package named :mod:`pkg` containing the :mod:`pkg.main` " +"and :mod:`pkg.string` submodules." msgstr "" #: ../../whatsnew/2.5.rst:277 @@ -451,9 +451,9 @@ msgid "" "Consider the code in the :file:`main.py` module. What happens if it " "executes the statement ``import string``? In Python 2.4 and earlier, it " "will first look in the package's directory to perform a relative import, " -"finds :file:`pkg/string.py`, imports the contents of that file as the :mod:" -"`pkg.string` module, and that module is bound to the name ``string`` in the :" -"mod:`pkg.main` module's namespace." +"finds :file:`pkg/string.py`, imports the contents of that file as " +"the :mod:`pkg.string` module, and that module is bound to the name " +"``string`` in the :mod:`pkg.main` module's namespace." msgstr "" #: ../../whatsnew/2.5.rst:284 @@ -470,11 +470,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:292 msgid "" "Reading code which relies on relative imports is also less clear, because a " -"reader may be confused about which module, :mod:`string` or :mod:`pkg." -"string`, is intended to be used. Python users soon learned not to duplicate " -"the names of standard library modules in the names of their packages' " -"submodules, but you can't protect against having your submodule's name being " -"used for a new module added in a future version of Python." +"reader may be confused about which module, :mod:`string` " +"or :mod:`pkg.string`, is intended to be used. Python users soon learned not " +"to duplicate the names of standard library modules in the names of their " +"packages' submodules, but you can't protect against having your submodule's " +"name being used for a new module added in a future version of Python." msgstr "" #: ../../whatsnew/2.5.rst:299 @@ -505,10 +505,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:315 msgid "" "This imports the :mod:`string` module relative to the current package, so " -"in :mod:`pkg.main` this will import *name1* and *name2* from :mod:`pkg." -"string`. Additional leading periods perform the relative import starting " -"from the parent of the current package. For example, code in the :mod:`A.B." -"C` module can do::" +"in :mod:`pkg.main` this will import *name1* and *name2* " +"from :mod:`pkg.string`. Additional leading periods perform the relative " +"import starting from the parent of the current package. For example, code " +"in the :mod:`A.B.C` module can do::" msgstr "" #: ../../whatsnew/2.5.rst:320 @@ -559,11 +559,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:349 msgid "" "The :mod:`runpy` module implements a more sophisticated import mechanism so " -"that it's now possible to run modules in a package such as :mod:`pychecker." -"checker`. The module also supports alternative import mechanisms such as " -"the :mod:`zipimport` module. This means you can add a .zip archive's path " -"to ``sys.path`` and then use the :option:`-m` switch to execute code from " -"the archive." +"that it's now possible to run modules in a package such " +"as :mod:`pychecker.checker`. The module also supports alternative import " +"mechanisms such as the :mod:`zipimport` module. This means you can add " +"a .zip archive's path to ``sys.path`` and then use the :option:`-m` switch " +"to execute code from the archive." msgstr "" #: ../../whatsnew/2.5.rst:359 @@ -624,10 +624,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:393 msgid "" "The code in *block-1* is executed. If the code raises an exception, the " -"various :keyword:`except` blocks are tested: if the exception is of class :" -"class:`Exception1`, *handler-1* is executed; otherwise if it's of class :" -"class:`Exception2`, *handler-2* is executed, and so forth. If no exception " -"is raised, the *else-block* is executed." +"various :keyword:`except` blocks are tested: if the exception is of " +"class :class:`Exception1`, *handler-1* is executed; otherwise if it's of " +"class :class:`Exception2`, *handler-2* is executed, and so forth. If no " +"exception is raised, the *else-block* is executed." msgstr "" #: ../../whatsnew/2.5.rst:399 @@ -711,8 +711,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:451 msgid "" -"(:pep:`342` explains the exact rules, which are that a :keyword:`yield`\\ -" -"expression must always be parenthesized except when it occurs at the top-" +"(:pep:`342` explains the exact rules, which are that a :keyword:`yield`\\ " +"-expression must always be parenthesized except when it occurs at the top-" "level expression on the right-hand side of an assignment. This means you " "can write ``val = yield i`` but have to use parentheses when there's an " "operation, as in ``val = (yield i) + 12``.)" @@ -722,8 +722,8 @@ msgstr "" msgid "" "Values are sent into a generator by calling its ``send(value)`` method. The " "generator's code is then resumed and the :keyword:`yield` expression returns " -"the specified *value*. If the regular :meth:`next` method is called, the :" -"keyword:`!yield` returns :const:`None`." +"the specified *value*. If the regular :meth:`next` method is called, " +"the :keyword:`!yield` returns :const:`None`." msgstr "" #: ../../whatsnew/2.5.rst:463 @@ -805,19 +805,19 @@ msgstr "" msgid "" ":meth:`close` raises a new :exc:`GeneratorExit` exception inside the " "generator to terminate the iteration. On receiving this exception, the " -"generator's code must either raise :exc:`GeneratorExit` or :exc:" -"`StopIteration`. Catching the :exc:`GeneratorExit` exception and returning " -"a value is illegal and will trigger a :exc:`RuntimeError`; if the function " -"raises some other exception, that exception is propagated to the caller. :" -"meth:`close` will also be called by Python's garbage collector when the " -"generator is garbage-collected." +"generator's code must either raise :exc:`GeneratorExit` " +"or :exc:`StopIteration`. Catching the :exc:`GeneratorExit` exception and " +"returning a value is illegal and will trigger a :exc:`RuntimeError`; if the " +"function raises some other exception, that exception is propagated to the " +"caller. :meth:`close` will also be called by Python's garbage collector " +"when the generator is garbage-collected." msgstr "" #: ../../whatsnew/2.5.rst:512 msgid "" "If you need to run cleanup code when a :exc:`GeneratorExit` occurs, I " -"suggest using a ``try: ... finally:`` suite instead of catching :exc:" -"`GeneratorExit`." +"suggest using a ``try: ... finally:`` suite instead of " +"catching :exc:`GeneratorExit`." msgstr "" #: ../../whatsnew/2.5.rst:515 @@ -842,21 +842,22 @@ msgid "" "obvious. :meth:`close` is called when a generator is garbage-collected, so " "this means the generator's code gets one last chance to run before the " "generator is destroyed. This last chance means that ``try...finally`` " -"statements in generators can now be guaranteed to work; the :keyword:" -"`finally` clause will now always get a chance to run. The syntactic " -"restriction that you couldn't mix :keyword:`yield` statements with a ``try..." -"finally`` suite has therefore been removed. This seems like a minor bit of " -"language trivia, but using generators and ``try...finally`` is actually " -"necessary in order to implement the :keyword:`with` statement described by :" -"pep:`343`. I'll look at this new statement in the following section." +"statements in generators can now be guaranteed to work; " +"the :keyword:`finally` clause will now always get a chance to run. The " +"syntactic restriction that you couldn't mix :keyword:`yield` statements with " +"a ``try...finally`` suite has therefore been removed. This seems like a " +"minor bit of language trivia, but using generators and ``try...finally`` is " +"actually necessary in order to implement the :keyword:`with` statement " +"described by :pep:`343`. I'll look at this new statement in the following " +"section." msgstr "" #: ../../whatsnew/2.5.rst:536 msgid "" -"Another even more esoteric effect of this change: previously, the :attr:" -"`gi_frame` attribute of a generator was always a frame object. It's now " -"possible for :attr:`gi_frame` to be ``None`` once the generator has been " -"exhausted." +"Another even more esoteric effect of this change: previously, " +"the :attr:`gi_frame` attribute of a generator was always a frame object. " +"It's now possible for :attr:`gi_frame` to be ``None`` once the generator has " +"been exhausted." msgstr "" #: ../../whatsnew/2.5.rst:544 @@ -925,8 +926,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:577 msgid "" "The expression is evaluated, and it should result in an object that supports " -"the context management protocol (that is, has :meth:`~object.__enter__` and :" -"meth:`~object.__exit__` methods." +"the context management protocol (that is, has :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` methods." msgstr "" #: ../../whatsnew/2.5.rst:581 @@ -939,9 +940,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:586 msgid "" -"After execution of the *with-block* is finished, the object's :meth:`~object." -"__exit__` method is called, even if the block raised an exception, and can " -"therefore run clean-up code." +"After execution of the *with-block* is finished, the " +"object's :meth:`~object.__exit__` method is called, even if the block raised " +"an exception, and can therefore run clean-up code." msgstr "" #: ../../whatsnew/2.5.rst:590 @@ -982,8 +983,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:611 msgid "" -"In this case, *f* is the same object created by :func:`open`, because :meth:" -"`~object.__enter__` returns *self*." +"In this case, *f* is the same object created by :func:`open`, " +"because :meth:`~object.__enter__` returns *self*." msgstr "" #: ../../whatsnew/2.5.rst:614 @@ -1047,8 +1048,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:654 msgid "" "The expression is evaluated and should result in an object called a " -"\"context manager\". The context manager must have :meth:`~object." -"__enter__` and :meth:`~object.__exit__` methods." +"\"context manager\". The context manager must " +"have :meth:`~object.__enter__` and :meth:`~object.__exit__` methods." msgstr "" #: ../../whatsnew/2.5.rst:658 @@ -1065,12 +1066,12 @@ msgstr "" #: ../../whatsnew/2.5.rst:664 msgid "" "If *BLOCK* raises an exception, the ``__exit__(type, value, traceback)`` is " -"called with the exception details, the same values returned by :func:`sys." -"exc_info`. The method's return value controls whether the exception is re-" -"raised: any false value re-raises the exception, and ``True`` will result in " -"suppressing it. You'll only rarely want to suppress the exception, because " -"if you do the author of the code containing the ':keyword:`with`' statement " -"will never realize anything went wrong." +"called with the exception details, the same values returned " +"by :func:`sys.exc_info`. The method's return value controls whether the " +"exception is re-raised: any false value re-raises the exception, and " +"``True`` will result in suppressing it. You'll only rarely want to suppress " +"the exception, because if you do the author of the code containing the " +"':keyword:`with`' statement will never realize anything went wrong." msgstr "" #: ../../whatsnew/2.5.rst:672 @@ -1112,8 +1113,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:693 msgid "" "The transaction should be committed if the code in the block runs flawlessly " -"or rolled back if there's an exception. Here's the basic interface for :" -"class:`DatabaseConnection` that I'll assume::" +"or rolled back if there's an exception. Here's the basic interface " +"for :class:`DatabaseConnection` that I'll assume::" msgstr "" #: ../../whatsnew/2.5.rst:697 @@ -1194,8 +1195,8 @@ msgid "" "generator function instead of defining a new class. The generator should " "yield exactly one value. The code up to the :keyword:`yield` will be " "executed as the :meth:`~object.__enter__` method, and the value yielded will " -"be the method's return value that will get bound to the variable in the ':" -"keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " +"be the method's return value that will get bound to the variable in the " +"':keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " "the :keyword:`yield` will be executed in the :meth:`~object.__exit__` " "method. Any exception raised in the block will be raised by the :keyword:`!" "yield` statement." @@ -1327,12 +1328,12 @@ msgstr "" #: ../../whatsnew/2.5.rst:828 msgid "" "This rearrangement was done because people often want to catch all " -"exceptions that indicate program errors. :exc:`KeyboardInterrupt` and :exc:" -"`SystemExit` aren't errors, though, and usually represent an explicit action " -"such as the user hitting :kbd:`Control-C` or code calling :func:`sys.exit`. " -"A bare ``except:`` will catch all exceptions, so you commonly need to list :" -"exc:`KeyboardInterrupt` and :exc:`SystemExit` in order to re-raise them. " -"The usual pattern is::" +"exceptions that indicate program errors. :exc:`KeyboardInterrupt` " +"and :exc:`SystemExit` aren't errors, though, and usually represent an " +"explicit action such as the user hitting :kbd:`Control-C` or code " +"calling :func:`sys.exit`. A bare ``except:`` will catch all exceptions, so " +"you commonly need to list :exc:`KeyboardInterrupt` and :exc:`SystemExit` in " +"order to re-raise them. The usual pattern is::" msgstr "" #: ../../whatsnew/2.5.rst:835 @@ -1410,9 +1411,9 @@ msgstr "" msgid "" "A limit of 2147483647 items doesn't really matter on a 32-bit platform " "because you'll run out of memory before hitting the length limit. Each list " -"item requires space for a pointer, which is 4 bytes, plus space for a :c:" -"type:`PyObject` representing the item. 2147483647\\*4 is already more bytes " -"than a 32-bit address space can contain." +"item requires space for a pointer, which is 4 bytes, plus space for " +"a :c:type:`PyObject` representing the item. 2147483647\\*4 is already more " +"bytes than a 32-bit address space can contain." msgstr "" #: ../../whatsnew/2.5.rst:894 @@ -1431,19 +1432,21 @@ msgstr "" #: ../../whatsnew/2.5.rst:904 msgid "" "This change most strongly affects authors of C extension modules. Python " -"strings and container types such as lists and tuples now use :c:type:" -"`Py_ssize_t` to store their size. Functions such as :c:func:`PyList_Size` " -"now return :c:type:`Py_ssize_t`. Code in extension modules may therefore " -"need to have some variables changed to :c:type:`Py_ssize_t`." +"strings and container types such as lists and tuples now " +"use :c:type:`Py_ssize_t` to store their size. Functions such " +"as :c:func:`PyList_Size` now return :c:type:`Py_ssize_t`. Code in " +"extension modules may therefore need to have some variables changed " +"to :c:type:`Py_ssize_t`." msgstr "" #: ../../whatsnew/2.5.rst:910 msgid "" "The :c:func:`PyArg_ParseTuple` and :c:func:`Py_BuildValue` functions have a " -"new conversion code, ``n``, for :c:type:`Py_ssize_t`. :c:func:" -"`PyArg_ParseTuple`'s ``s#`` and ``t#`` still output :c:expr:`int` by " -"default, but you can define the macro :c:macro:`PY_SSIZE_T_CLEAN` before " -"including :file:`Python.h` to make them return :c:type:`Py_ssize_t`." +"new conversion code, ``n``, " +"for :c:type:`Py_ssize_t`. :c:func:`PyArg_ParseTuple`'s ``s#`` and ``t#`` " +"still output :c:expr:`int` by default, but you can define the " +"macro :c:macro:`PY_SSIZE_T_CLEAN` before including :file:`Python.h` to " +"make them return :c:type:`Py_ssize_t`." msgstr "" #: ../../whatsnew/2.5.rst:916 @@ -1478,9 +1481,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:941 msgid "" "Slicing can't just use the existing :meth:`__int__` method because that " -"method is also used to implement coercion to integers. If slicing used :" -"meth:`__int__`, floating-point numbers would also become legal slice indexes " -"and that's clearly an undesirable behaviour." +"method is also used to implement coercion to integers. If slicing " +"used :meth:`__int__`, floating-point numbers would also become legal slice " +"indexes and that's clearly an undesirable behaviour." msgstr "" #: ../../whatsnew/2.5.rst:946 @@ -1503,8 +1506,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:953 msgid "" "The return value must be either a Python integer or long integer. The " -"interpreter will check that the type returned is correct, and raises a :exc:" -"`TypeError` if this requirement isn't met." +"interpreter will check that the type returned is correct, and raises " +"a :exc:`TypeError` if this requirement isn't met." msgstr "" #: ../../whatsnew/2.5.rst:957 @@ -1538,9 +1541,9 @@ msgid "" "The :class:`dict` type has a new hook for letting subclasses provide a " "default value when a key isn't contained in the dictionary. When a key isn't " "found, the dictionary's ``__missing__(key)`` method will be called. This " -"hook is used to implement the new :class:`defaultdict` class in the :mod:" -"`collections` module. The following example defines a dictionary that " -"returns zero for any missing key::" +"hook is used to implement the new :class:`defaultdict` class in " +"the :mod:`collections` module. The following example defines a dictionary " +"that returns zero for any missing key::" msgstr "" #: ../../whatsnew/2.5.rst:985 @@ -1657,11 +1660,11 @@ msgstr "(由 Steven Bethard 和 Raymond Hettinger 所貢獻。)" #: ../../whatsnew/2.5.rst:1045 msgid "" "Two new built-in functions, :func:`any` and :func:`all`, evaluate whether an " -"iterator contains any true or false values. :func:`any` returns :const:" -"`True` if any value returned by the iterator is true; otherwise it will " -"return :const:`False`. :func:`all` returns :const:`True` only if all of the " -"values returned by the iterator evaluate as true. (Suggested by Guido van " -"Rossum, and implemented by Raymond Hettinger.)" +"iterator contains any true or false values. :func:`any` " +"returns :const:`True` if any value returned by the iterator is true; " +"otherwise it will return :const:`False`. :func:`all` returns :const:`True` " +"only if all of the values returned by the iterator evaluate as true. " +"(Suggested by Guido van Rossum, and implemented by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.5.rst:1052 @@ -1670,8 +1673,8 @@ msgid "" "integer or a regular integer. If a long integer is returned, the hash of " "that value is taken. In earlier versions the hash value was required to be " "a regular integer, but in 2.5 the :func:`id` built-in was changed to always " -"return non-negative numbers, and users often seem to use ``id(self)`` in :" -"meth:`__hash__` methods (though this is discouraged)." +"return non-negative numbers, and users often seem to use ``id(self)`` " +"in :meth:`__hash__` methods (though this is discouraged)." msgstr "" #: ../../whatsnew/2.5.rst:1061 @@ -1732,12 +1735,12 @@ msgid "" "One error that Python programmers sometimes make is forgetting to include " "an :file:`__init__.py` module in a package directory. Debugging this mistake " "can be confusing, and usually requires running Python with the :option:`-v` " -"switch to log all the paths searched. In Python 2.5, a new :exc:" -"`ImportWarning` warning is triggered when an import would have picked up a " -"directory as a package but no :file:`__init__.py` was found. This warning " -"is silently ignored by default; provide the :option:`-Wd <-W>` option when " -"running the Python executable to display the warning message. (Implemented " -"by Thomas Wouters.)" +"switch to log all the paths searched. In Python 2.5, a " +"new :exc:`ImportWarning` warning is triggered when an import would have " +"picked up a directory as a package but no :file:`__init__.py` was found. " +"This warning is silently ignored by default; provide the :option:`-Wd <-W>` " +"option when running the Python executable to display the warning message. " +"(Implemented by Thomas Wouters.)" msgstr "" #: ../../whatsnew/2.5.rst:1102 @@ -1807,11 +1810,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:1147 msgid "" -"When they were introduced in Python 2.4, the built-in :class:`set` and :" -"class:`frozenset` types were built on top of Python's dictionary type. In " -"2.5 the internal data structure has been customized for implementing sets, " -"and as a result sets will use a third less memory and are somewhat faster. " -"(Implemented by Raymond Hettinger.)" +"When they were introduced in Python 2.4, the built-in :class:`set` " +"and :class:`frozenset` types were built on top of Python's dictionary " +"type. In 2.5 the internal data structure has been customized for " +"implementing sets, and as a result sets will use a third less memory and are " +"somewhat faster. (Implemented by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.5.rst:1153 @@ -1838,8 +1841,8 @@ msgid "" "methods. Iteration uses an internal buffer and the :meth:`!read\\*` " "methods don't use that buffer. Instead they would return the data " "following the buffer, causing the data to appear out of order. Mixing " -"iteration and these methods will now trigger a :exc:`ValueError` from the :" -"meth:`!read\\*` method. (Implemented by Thomas Wouters.)" +"iteration and these methods will now trigger a :exc:`ValueError` from " +"the :meth:`!read\\*` method. (Implemented by Thomas Wouters.)" msgstr "" #: ../../whatsnew/2.5.rst:1178 @@ -1852,8 +1855,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1182 msgid "" "The :mod:`re` module got a 1 or 2% speedup by switching to Python's " -"allocator functions instead of the system's :c:func:`malloc` and :c:func:" -"`free`. (Contributed by Jack Diederich at the NeedForSpeed sprint.)" +"allocator functions instead of the system's :c:func:`malloc` " +"and :c:func:`free`. (Contributed by Jack Diederich at the NeedForSpeed " +"sprint.)" msgstr "" #: ../../whatsnew/2.5.rst:1186 @@ -1911,16 +1915,15 @@ msgstr "" #: ../../whatsnew/2.5.rst:1228 msgid "" -"The :mod:`codecs` module gained support for incremental codecs. The :func:" -"`codec.lookup` function now returns a :class:`CodecInfo` instance instead of " -"a tuple. :class:`CodecInfo` instances behave like a 4-tuple to preserve " -"backward compatibility but also have the attributes :attr:`encode`, :attr:" -"`decode`, :attr:`incrementalencoder`, :attr:`incrementaldecoder`, :attr:" -"`streamwriter`, and :attr:`streamreader`. Incremental codecs can receive " -"input and produce output in multiple chunks; the output is the same as if " -"the entire input was fed to the non-incremental codec. See the :mod:`codecs` " -"module documentation for details. (Designed and implemented by Walter " -"Dörwald.)" +"The :mod:`codecs` module gained support for incremental codecs. " +"The :func:`codec.lookup` function now returns a :class:`CodecInfo` instance " +"instead of a tuple. :class:`CodecInfo` instances behave like a 4-tuple to " +"preserve backward compatibility but also have the " +"attributes :attr:`encode`, :attr:`decode`, :attr:`incrementalencoder`, :attr:`incrementaldecoder`, :attr:`streamwriter`, " +"and :attr:`streamreader`. Incremental codecs can receive input and produce " +"output in multiple chunks; the output is the same as if the entire input was " +"fed to the non-incremental codec. See the :mod:`codecs` module documentation " +"for details. (Designed and implemented by Walter Dörwald.)" msgstr "" #: ../../whatsnew/2.5.rst:1240 @@ -1986,10 +1989,11 @@ msgstr "(由 Guido van Rossum 所貢獻。)" #: ../../whatsnew/2.5.rst:1271 msgid "" -"The :class:`deque` double-ended queue type supplied by the :mod:" -"`collections` module now has a ``remove(value)`` method that removes the " -"first occurrence of *value* in the queue, raising :exc:`ValueError` if the " -"value isn't found. (Contributed by Raymond Hettinger.)" +"The :class:`deque` double-ended queue type supplied by " +"the :mod:`collections` module now has a ``remove(value)`` method that " +"removes the first occurrence of *value* in the queue, " +"raising :exc:`ValueError` if the value isn't found. (Contributed by Raymond " +"Hettinger.)" msgstr "" #: ../../whatsnew/2.5.rst:1276 @@ -2022,12 +2026,12 @@ msgstr "" msgid "" "The :mod:`csv` module, which parses files in comma-separated value format, " "received several enhancements and a number of bugfixes. You can now set the " -"maximum size in bytes of a field by calling the ``csv." -"field_size_limit(new_limit)`` function; omitting the *new_limit* argument " -"will return the currently set limit. The :class:`reader` class now has a :" -"attr:`line_num` attribute that counts the number of physical lines read from " -"the source; records can span multiple physical lines, so :attr:`line_num` is " -"not the same as the number of records read." +"maximum size in bytes of a field by calling the " +"``csv.field_size_limit(new_limit)`` function; omitting the *new_limit* " +"argument will return the currently set limit. The :class:`reader` class now " +"has a :attr:`line_num` attribute that counts the number of physical lines " +"read from the source; records can span multiple physical lines, " +"so :attr:`line_num` is not the same as the number of records read." msgstr "" #: ../../whatsnew/2.5.rst:1301 @@ -2083,10 +2087,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1330 msgid "" -"An *encoding* parameter was added to the :func:`testfile` function and the :" -"class:`DocFileSuite` class to specify the file's encoding. This makes it " -"easier to use non-ASCII characters in tests contained within a docstring. " -"(Contributed by Bjorn Tillenius.)" +"An *encoding* parameter was added to the :func:`testfile` function and " +"the :class:`DocFileSuite` class to specify the file's encoding. This makes " +"it easier to use non-ASCII characters in tests contained within a " +"docstring. (Contributed by Bjorn Tillenius.)" msgstr "" #: ../../whatsnew/2.5.rst:1337 @@ -2099,12 +2103,12 @@ msgstr "" msgid "" "The :mod:`fileinput` module was made more flexible. Unicode filenames are " "now supported, and a *mode* parameter that defaults to ``\"r\"`` was added " -"to the :func:`input` function to allow opening files in binary or :term:" -"`universal newlines` mode. Another new parameter, *openhook*, lets you use " -"a function other than :func:`open` to open the input files. Once you're " -"iterating over the set of files, the :class:`FileInput` object's new :meth:" -"`~fileinput.fileno` returns the file descriptor for the currently opened " -"file. (Contributed by Georg Brandl.)" +"to the :func:`input` function to allow opening files in binary " +"or :term:`universal newlines` mode. Another new parameter, *openhook*, lets " +"you use a function other than :func:`open` to open the input files. Once " +"you're iterating over the set of files, the :class:`FileInput` object's " +"new :meth:`~fileinput.fileno` returns the file descriptor for the currently " +"opened file. (Contributed by Georg Brandl.)" msgstr "" #: ../../whatsnew/2.5.rst:1354 @@ -2171,9 +2175,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1393 msgid "" -"To format strings with multiple %char specifiers, use the new :func:" -"`format_string` function that works like :func:`format` but also supports " -"mixing %char specifiers with arbitrary text." +"To format strings with multiple %char specifiers, use the " +"new :func:`format_string` function that works like :func:`format` but also " +"supports mixing %char specifiers with arbitrary text." msgstr "" #: ../../whatsnew/2.5.rst:1397 @@ -2218,9 +2222,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1425 msgid "" -"New module: the :mod:`!msilib` module allows creating Microsoft Installer :" -"file:`.msi` files and CAB files. Some support for reading the :file:`.msi` " -"database is also included. (Contributed by Martin von Löwis.)" +"New module: the :mod:`!msilib` module allows creating Microsoft " +"Installer :file:`.msi` files and CAB files. Some support for reading " +"the :file:`.msi` database is also included. (Contributed by Martin von " +"Löwis.)" msgstr "" #: ../../whatsnew/2.5.rst:1429 @@ -2233,11 +2238,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:1433 msgid "" "The :mod:`operator` module's :func:`itemgetter` and :func:`attrgetter` " -"functions now support multiple fields. A call such as ``operator." -"attrgetter('a', 'b')`` will return a function that retrieves the :attr:`a` " -"and :attr:`b` attributes. Combining this new feature with the :meth:`sort` " -"method's ``key`` parameter lets you easily sort lists using multiple " -"fields. (Contributed by Raymond Hettinger.)" +"functions now support multiple fields. A call such as " +"``operator.attrgetter('a', 'b')`` will return a function that retrieves " +"the :attr:`a` and :attr:`b` attributes. Combining this new feature with " +"the :meth:`sort` method's ``key`` parameter lets you easily sort lists " +"using multiple fields. (Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.5.rst:1440 @@ -2251,19 +2256,19 @@ msgstr "" #: ../../whatsnew/2.5.rst:1445 msgid "" -"The :mod:`os` module underwent several changes. The :attr:" -"`stat_float_times` variable now defaults to true, meaning that :func:`os." -"stat` will now return time values as floats. (This doesn't necessarily mean " -"that :func:`os.stat` will return times that are precise to fractions of a " -"second; not all systems support such precision.)" +"The :mod:`os` module underwent several changes. " +"The :attr:`stat_float_times` variable now defaults to true, meaning " +"that :func:`os.stat` will now return time values as floats. (This doesn't " +"necessarily mean that :func:`os.stat` will return times that are precise to " +"fractions of a second; not all systems support such precision.)" msgstr "" #: ../../whatsnew/2.5.rst:1451 msgid "" -"Constants named :const:`os.SEEK_SET`, :const:`os.SEEK_CUR`, and :const:`os." -"SEEK_END` have been added; these are the parameters to the :func:`os.lseek` " -"function. Two new constants for locking are :const:`os.O_SHLOCK` and :const:" -"`os.O_EXLOCK`." +"Constants named :const:`os.SEEK_SET`, :const:`os.SEEK_CUR`, " +"and :const:`os.SEEK_END` have been added; these are the parameters to " +"the :func:`os.lseek` function. Two new constants for locking " +"are :const:`os.O_SHLOCK` and :const:`os.O_EXLOCK`." msgstr "" #: ../../whatsnew/2.5.rst:1456 @@ -2281,9 +2286,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1465 msgid "" "On FreeBSD, the :func:`os.stat` function now returns times with nanosecond " -"resolution, and the returned object now has :attr:`st_gen` and :attr:" -"`st_birthtime`. The :attr:`st_flags` attribute is also available, if the " -"platform supports it. (Contributed by Antti Louko and Diego Pettenò.)" +"resolution, and the returned object now has :attr:`st_gen` " +"and :attr:`st_birthtime`. The :attr:`st_flags` attribute is also available, " +"if the platform supports it. (Contributed by Antti Louko and Diego Pettenò.)" msgstr "" #: ../../whatsnew/2.5.rst:1472 @@ -2314,9 +2319,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1490 msgid "" -"The pybench benchmark suite by Marc-André Lemburg is now included in the :" -"file:`Tools/pybench` directory. The pybench suite is an improvement on the " -"commonly used :file:`pystone.py` program because pybench provides a more " +"The pybench benchmark suite by Marc-André Lemburg is now included in " +"the :file:`Tools/pybench` directory. The pybench suite is an improvement on " +"the commonly used :file:`pystone.py` program because pybench provides a more " "detailed measurement of the interpreter's speed. It times particular " "operations such as function calls, tuple slicing, method lookups, and " "numeric operations, instead of performing many different operations and " @@ -2342,8 +2347,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:1507 msgid "" "The old :mod:`regex` and :mod:`regsub` modules, which have been deprecated " -"ever since Python 2.0, have finally been deleted. Other deleted modules: :" -"mod:`statcache`, :mod:`tzparse`, :mod:`whrandom`." +"ever since Python 2.0, have finally been deleted. Other deleted " +"modules: :mod:`statcache`, :mod:`tzparse`, :mod:`whrandom`." msgstr "" #: ../../whatsnew/2.5.rst:1511 @@ -2356,9 +2361,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1516 msgid "" -"The :mod:`rlcompleter` module is no longer dependent on importing the :mod:" -"`readline` module and therefore now works on non-Unix platforms. (Patch from " -"Robert Kiendl.)" +"The :mod:`rlcompleter` module is no longer dependent on importing " +"the :mod:`readline` module and therefore now works on non-Unix platforms. " +"(Patch from Robert Kiendl.)" msgstr "" #: ../../whatsnew/2.5.rst:1522 @@ -2375,8 +2380,8 @@ msgid "" "The :mod:`socket` module now supports :const:`AF_NETLINK` sockets on Linux, " "thanks to a patch from Philippe Biondi. Netlink sockets are a Linux-" "specific mechanism for communications between a user-space process and " -"kernel code; an introductory article about them is at https://www." -"linuxjournal.com/article/7356. In Python code, netlink addresses are " +"kernel code; an introductory article about them is at https://" +"www.linuxjournal.com/article/7356. In Python code, netlink addresses are " "represented as a tuple of 2 integers, ``(pid, group_mask)``." msgstr "" @@ -2391,9 +2396,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:1541 msgid "" -"Socket objects also gained :meth:`getfamily`, :meth:`gettype`, and :meth:" -"`getproto` accessor methods to retrieve the family, type, and protocol " -"values for the socket." +"Socket objects also gained :meth:`getfamily`, :meth:`gettype`, " +"and :meth:`getproto` accessor methods to retrieve the family, type, and " +"protocol values for the socket." msgstr "" #: ../../whatsnew/2.5.rst:1545 @@ -2404,12 +2409,12 @@ msgstr "" #: ../../whatsnew/2.5.rst:1548 msgid "" -"The :mod:`struct` is now faster because it compiles format strings into :" -"class:`Struct` objects with :meth:`pack` and :meth:`unpack` methods. This " -"is similar to how the :mod:`re` module lets you create compiled regular " -"expression objects. You can still use the module-level :func:`pack` and :" -"func:`unpack` functions; they'll create :class:`Struct` objects and cache " -"them. Or you can use :class:`Struct` instances directly::" +"The :mod:`struct` is now faster because it compiles format strings " +"into :class:`Struct` objects with :meth:`pack` and :meth:`unpack` methods. " +"This is similar to how the :mod:`re` module lets you create compiled regular " +"expression objects. You can still use the module-level :func:`pack` " +"and :func:`unpack` functions; they'll create :class:`Struct` objects and " +"cache them. Or you can use :class:`Struct` instances directly::" msgstr "" #: ../../whatsnew/2.5.rst:1555 @@ -2450,10 +2455,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1575 msgid "" -"This information is also available to C extensions via the :c:func:" -"`Py_GetBuildInfo` function that returns a string of build information like " -"this: ``\"trunk:45355:45356M, Apr 13 2006, 07:42:19\"``. (Contributed by " -"Barry Warsaw.)" +"This information is also available to C extensions via " +"the :c:func:`Py_GetBuildInfo` function that returns a string of build " +"information like this: ``\"trunk:45355:45356M, Apr 13 2006, 07:42:19\"``. " +"(Contributed by Barry Warsaw.)" msgstr "" #: ../../whatsnew/2.5.rst:1580 @@ -2466,11 +2471,11 @@ msgstr "" #: ../../whatsnew/2.5.rst:1585 msgid "" -"The :class:`TarFile` class in the :mod:`tarfile` module now has an :meth:" -"`extractall` method that extracts all members from the archive into the " -"current working directory. It's also possible to set a different directory " -"as the extraction target, and to unpack only a subset of the archive's " -"members." +"The :class:`TarFile` class in the :mod:`tarfile` module now has " +"an :meth:`extractall` method that extracts all members from the archive into " +"the current working directory. It's also possible to set a different " +"directory as the extraction target, and to unpack only a subset of the " +"archive's members." msgstr "" #: ../../whatsnew/2.5.rst:1590 @@ -2533,35 +2538,35 @@ msgstr "(由 Ka-Ping Yee 所貢獻。)" #: ../../whatsnew/2.5.rst:1634 msgid "" -"The :mod:`weakref` module's :class:`WeakKeyDictionary` and :class:" -"`WeakValueDictionary` types gained new methods for iterating over the weak " -"references contained in the dictionary. :meth:`iterkeyrefs` and :meth:" -"`keyrefs` methods were added to :class:`WeakKeyDictionary`, and :meth:" -"`itervaluerefs` and :meth:`valuerefs` were added to :class:" -"`WeakValueDictionary`. (Contributed by Fred L. Drake, Jr.)" +"The :mod:`weakref` module's :class:`WeakKeyDictionary` " +"and :class:`WeakValueDictionary` types gained new methods for iterating over " +"the weak references contained in the dictionary. :meth:`iterkeyrefs` " +"and :meth:`keyrefs` methods were added to :class:`WeakKeyDictionary`, " +"and :meth:`itervaluerefs` and :meth:`valuerefs` were added " +"to :class:`WeakValueDictionary`. (Contributed by Fred L. Drake, Jr.)" msgstr "" #: ../../whatsnew/2.5.rst:1641 msgid "" "The :mod:`webbrowser` module received a number of enhancements. It's now " "usable as a script with ``python -m webbrowser``, taking a URL as the " -"argument; there are a number of switches to control the behaviour (:option:" -"`!-n` for a new browser window, :option:`!-t` for a new tab). New module-" -"level functions, :func:`open_new` and :func:`open_new_tab`, were added to " -"support this. The module's :func:`open` function supports an additional " -"feature, an *autoraise* parameter that signals whether to raise the open " -"window when possible. A number of additional browsers were added to the " -"supported list such as Firefox, Opera, Konqueror, and elinks. (Contributed " -"by Oleg Broytmann and Georg Brandl.)" +"argument; there are a number of switches to control the behaviour " +"(:option:`!-n` for a new browser window, :option:`!-t` for a new tab). New " +"module-level functions, :func:`open_new` and :func:`open_new_tab`, were " +"added to support this. The module's :func:`open` function supports an " +"additional feature, an *autoraise* parameter that signals whether to raise " +"the open window when possible. A number of additional browsers were added to " +"the supported list such as Firefox, Opera, Konqueror, and elinks. " +"(Contributed by Oleg Broytmann and Georg Brandl.)" msgstr "" #: ../../whatsnew/2.5.rst:1653 msgid "" -"The :mod:`xmlrpclib <xmlrpc.client>` module now supports returning :class:" -"`~datetime.datetime` objects for the XML-RPC date type. Supply " -"``use_datetime=True`` to the :func:`~xmlrpc.client.loads` function or the :" -"class:`!Unmarshaller` class to enable this feature. (Contributed by Skip " -"Montanaro.)" +"The :mod:`xmlrpclib <xmlrpc.client>` module now supports " +"returning :class:`~datetime.datetime` objects for the XML-RPC date type. " +"Supply ``use_datetime=True`` to the :func:`~xmlrpc.client.loads` function " +"or the :class:`!Unmarshaller` class to enable this feature. (Contributed by " +"Skip Montanaro.)" msgstr "" #: ../../whatsnew/2.5.rst:1660 @@ -2594,10 +2599,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1687 msgid "" -"To load a shared library or DLL, you must create an instance of the :class:" -"`CDLL` class and provide the name or path of the shared library or DLL. Once " -"that's done, you can call arbitrary functions by accessing them as " -"attributes of the :class:`CDLL` object. ::" +"To load a shared library or DLL, you must create an instance of " +"the :class:`CDLL` class and provide the name or path of the shared library " +"or DLL. Once that's done, you can call arbitrary functions by accessing them " +"as attributes of the :class:`CDLL` object. ::" msgstr "" #: ../../whatsnew/2.5.rst:1692 @@ -2614,14 +2619,15 @@ msgstr "" #: ../../whatsnew/2.5.rst:1697 msgid "" -"Type constructors for the various C types are provided: :func:`c_int`, :func:" -"`c_float`, :func:`c_double`, :func:`c_char_p` (equivalent to :c:expr:`char " -"\\*`), and so forth. Unlike Python's types, the C versions are all mutable; " -"you can assign to their :attr:`value` attribute to change the wrapped " -"value. Python integers and strings will be automatically converted to the " -"corresponding C types, but for other types you must call the correct type " -"constructor. (And I mean *must*; getting it wrong will often result in the " -"interpreter crashing with a segmentation fault.)" +"Type constructors for the various C types are " +"provided: :func:`c_int`, :func:`c_float`, :func:`c_double`, :func:`c_char_p` " +"(equivalent to :c:expr:`char \\*`), and so forth. Unlike Python's types, " +"the C versions are all mutable; you can assign to their :attr:`value` " +"attribute to change the wrapped value. Python integers and strings will be " +"automatically converted to the corresponding C types, but for other types " +"you must call the correct type constructor. (And I mean *must*; getting " +"it wrong will often result in the interpreter crashing with a segmentation " +"fault.)" msgstr "" #: ../../whatsnew/2.5.rst:1706 @@ -2644,8 +2650,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:1715 msgid "" -"C functions are assumed to return integers, but you can set the :attr:" -"`restype` attribute of the function object to change this::" +"C functions are assumed to return integers, but you can set " +"the :attr:`restype` attribute of the function object to change this::" msgstr "" #: ../../whatsnew/2.5.rst:1718 @@ -2664,12 +2670,12 @@ msgstr "" #: ../../whatsnew/2.5.rst:1724 msgid "" -":mod:`ctypes` also provides a wrapper for Python's C API as the ``ctypes." -"pythonapi`` object. This object does *not* release the global interpreter " -"lock before calling a function, because the lock must be held when calling " -"into the interpreter's code. There's a :class:`~ctypes.py_object` type " -"constructor that will create a :c:expr:`PyObject *` pointer. A simple " -"usage::" +":mod:`ctypes` also provides a wrapper for Python's C API as the " +"``ctypes.pythonapi`` object. This object does *not* release the global " +"interpreter lock before calling a function, because the lock must be held " +"when calling into the interpreter's code. There's " +"a :class:`~ctypes.py_object` type constructor that will create " +"a :c:expr:`PyObject *` pointer. A simple usage::" msgstr "" #: ../../whatsnew/2.5.rst:1730 @@ -2697,10 +2703,10 @@ msgstr "" #: ../../whatsnew/2.5.rst:1740 msgid "" ":mod:`ctypes` has been around for a while, but people still write and " -"distribution hand-coded extension modules because you can't rely on :mod:" -"`ctypes` being present. Perhaps developers will begin to write Python " -"wrappers atop a library accessed through :mod:`ctypes` instead of extension " -"modules, now that :mod:`ctypes` is included with core Python." +"distribution hand-coded extension modules because you can't rely " +"on :mod:`ctypes` being present. Perhaps developers will begin to write " +"Python wrappers atop a library accessed through :mod:`ctypes` instead of " +"extension modules, now that :mod:`ctypes` is included with core Python." msgstr "" #: ../../whatsnew/2.5.rst:1749 @@ -2775,8 +2781,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:1790 msgid "" -"Once you have an :class:`ElementTree` instance, you can call its :meth:" -"`getroot` method to get the root :class:`Element` node." +"Once you have an :class:`ElementTree` instance, you can call " +"its :meth:`getroot` method to get the root :class:`Element` node." msgstr "" #: ../../whatsnew/2.5.rst:1793 @@ -2912,8 +2918,8 @@ msgstr "" #: ../../whatsnew/2.5.rst:1837 msgid "" -"Comments and processing instructions are also represented as :class:" -"`Element` nodes. To check if a node is a comment or processing " +"Comments and processing instructions are also represented " +"as :class:`Element` nodes. To check if a node is a comment or processing " "instructions::" msgstr "" @@ -3222,9 +3228,9 @@ msgstr "wsgiref 套件" #: ../../whatsnew/2.5.rst:2042 msgid "" "The Web Server Gateway Interface (WSGI) v1.0 defines a standard interface " -"between web servers and Python web applications and is described in :pep:" -"`333`. The :mod:`wsgiref` package is a reference implementation of the WSGI " -"specification." +"between web servers and Python web applications and is described " +"in :pep:`333`. The :mod:`wsgiref` package is a reference implementation of " +"the WSGI specification." msgstr "" #: ../../whatsnew/2.5.rst:2049 @@ -3276,11 +3282,11 @@ msgstr "由 Phillip J. Eby 撰寫 PEP。" #: ../../whatsnew/2.5.rst:2080 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/2.5.rst:2082 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/2.5.rst:2084 msgid "" @@ -3301,9 +3307,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:2094 msgid "" "The largest change to the C API came from :pep:`353`, which modifies the " -"interpreter to use a :c:type:`Py_ssize_t` type definition instead of :c:expr:" -"`int`. See the earlier section :ref:`pep-353` for a discussion of this " -"change." +"interpreter to use a :c:type:`Py_ssize_t` type definition instead " +"of :c:expr:`int`. See the earlier section :ref:`pep-353` for a discussion " +"of this change." msgstr "" #: ../../whatsnew/2.5.rst:2099 @@ -3316,9 +3322,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:2104 msgid "" -"It's possible for Python code to obtain AST objects by using the :func:" -"`compile` built-in and specifying ``_ast.PyCF_ONLY_AST`` as the value of " -"the *flags* parameter::" +"It's possible for Python code to obtain AST objects by using " +"the :func:`compile` built-in and specifying ``_ast.PyCF_ONLY_AST`` as the " +"value of the *flags* parameter::" msgstr "" #: ../../whatsnew/2.5.rst:2108 @@ -3343,13 +3349,13 @@ msgstr "" #: ../../whatsnew/2.5.rst:2117 msgid "" -"No official documentation has been written for the AST code yet, but :pep:" -"`339` discusses the design. To start learning about the code, read the " -"definition of the various AST nodes in :file:`Parser/Python.asdl`. A Python " -"script reads this file and generates a set of C structure definitions in :" -"file:`Include/Python-ast.h`. The :c:func:`PyParser_ASTFromString` and :c:" -"func:`!PyParser_ASTFromFile`, defined in :file:`Include/pythonrun.h`, take " -"Python source as input and return the root of an AST representing the " +"No official documentation has been written for the AST code yet, " +"but :pep:`339` discusses the design. To start learning about the code, read " +"the definition of the various AST nodes in :file:`Parser/Python.asdl`. A " +"Python script reads this file and generates a set of C structure definitions " +"in :file:`Include/Python-ast.h`. The :c:func:`PyParser_ASTFromString` " +"and :c:func:`!PyParser_ASTFromFile`, defined in :file:`Include/pythonrun.h`, " +"take Python source as input and return the root of an AST representing the " "contents. This AST can then be turned into a code object by :c:func:`!" "PyAST_Compile`. For more information, read the source code, and then ask " "questions on python-dev." @@ -3379,31 +3385,32 @@ msgstr "" msgid "" "Note that this change means extension modules must be more careful when " "allocating memory. Python's API has many different functions for allocating " -"memory that are grouped into families. For example, :c:func:" -"`PyMem_Malloc`, :c:func:`PyMem_Realloc`, and :c:func:`PyMem_Free` are one " -"family that allocates raw memory, while :c:func:`PyObject_Malloc`, :c:func:" -"`PyObject_Realloc`, and :c:func:`PyObject_Free` are another family that's " -"supposed to be used for creating Python objects." +"memory that are grouped into families. For " +"example, :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc`, " +"and :c:func:`PyMem_Free` are one family that allocates raw memory, " +"while :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc`, " +"and :c:func:`PyObject_Free` are another family that's supposed to be used " +"for creating Python objects." msgstr "" #: ../../whatsnew/2.5.rst:2152 msgid "" -"Previously these different families all reduced to the platform's :c:func:" -"`malloc` and :c:func:`free` functions. This meant it didn't matter if you " -"got things wrong and allocated memory with the ``PyMem`` function but freed " -"it with the ``PyObject`` function. With 2.5's changes to obmalloc, these " -"families now do different things and mismatches will probably result in a " -"segfault. You should carefully test your C extension modules with Python " -"2.5." +"Previously these different families all reduced to the " +"platform's :c:func:`malloc` and :c:func:`free` functions. This meant it " +"didn't matter if you got things wrong and allocated memory with the " +"``PyMem`` function but freed it with the ``PyObject`` function. With 2.5's " +"changes to obmalloc, these families now do different things and mismatches " +"will probably result in a segfault. You should carefully test your C " +"extension modules with Python 2.5." msgstr "" #: ../../whatsnew/2.5.rst:2159 msgid "" "The built-in set types now have an official C API. Call :c:func:`PySet_New` " -"and :c:func:`PyFrozenSet_New` to create a new set, :c:func:`PySet_Add` and :" -"c:func:`PySet_Discard` to add and remove elements, and :c:func:" -"`PySet_Contains` and :c:func:`PySet_Size` to examine the set's state. " -"(Contributed by Raymond Hettinger.)" +"and :c:func:`PyFrozenSet_New` to create a new set, :c:func:`PySet_Add` " +"and :c:func:`PySet_Discard` to add and remove elements, " +"and :c:func:`PySet_Contains` and :c:func:`PySet_Size` to examine the set's " +"state. (Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.5.rst:2165 @@ -3421,9 +3428,9 @@ msgid "" "``Py_LOCAL(type)`` declares the function as returning a value of the " "specified *type* and uses a fast-calling qualifier. " "``Py_LOCAL_INLINE(type)`` does the same thing and also requests the function " -"be inlined. If macro :c:macro:`!PY_LOCAL_AGGRESSIVE` is defined before :" -"file:`python.h` is included, a set of more aggressive optimizations are " -"enabled for the module; you should benchmark the results to find out if " +"be inlined. If macro :c:macro:`!PY_LOCAL_AGGRESSIVE` is defined " +"before :file:`python.h` is included, a set of more aggressive optimizations " +"are enabled for the module; you should benchmark the results to find out if " "these optimizations actually make the code faster. (Contributed by Fredrik " "Lundh at the NeedForSpeed sprint.)" msgstr "" @@ -3472,14 +3479,14 @@ msgstr "" #: ../../whatsnew/2.5.rst:2210 msgid "" -"MacOS X (10.3 and higher): dynamic loading of modules now uses the :c:func:" -"`dlopen` function instead of MacOS-specific functions." +"MacOS X (10.3 and higher): dynamic loading of modules now uses " +"the :c:func:`dlopen` function instead of MacOS-specific functions." msgstr "" #: ../../whatsnew/2.5.rst:2213 msgid "" -"MacOS X: an :option:`!--enable-universalsdk` switch was added to the :" -"program:`configure` script that compiles the interpreter as a universal " +"MacOS X: an :option:`!--enable-universalsdk` switch was added to " +"the :program:`configure` script that compiles the interpreter as a universal " "binary able to run on both PowerPC and Intel processors. (Contributed by " "Ronald Oussoren; :issue:`2573`.)" msgstr "" @@ -3512,8 +3519,9 @@ msgstr "" #: ../../whatsnew/2.5.rst:2238 msgid "" "Previously, the :attr:`gi_frame` attribute of a generator was always a frame " -"object. Because of the :pep:`342` changes described in section :ref:" -"`pep-342`, it's now possible for :attr:`gi_frame` to be ``None``." +"object. Because of the :pep:`342` changes described in " +"section :ref:`pep-342`, it's now possible for :attr:`gi_frame` to be " +"``None``." msgstr "" #: ../../whatsnew/2.5.rst:2242 @@ -3550,11 +3558,12 @@ msgstr "" #: ../../whatsnew/2.5.rst:2261 msgid "" -"Library: The :mod:`SimpleXMLRPCServer <xmlrpc.server>` and :mod:" -"`DocXMLRPCServer <xmlrpc.server>` classes now have a :attr:`rpc_paths` " -"attribute that constrains XML-RPC operations to a limited set of URL paths; " -"the default is to allow only ``'/'`` and ``'/RPC2'``. Setting :attr:" -"`rpc_paths` to ``None`` or an empty tuple disables this path checking." +"Library: The :mod:`SimpleXMLRPCServer <xmlrpc.server>` " +"and :mod:`DocXMLRPCServer <xmlrpc.server>` classes now have " +"a :attr:`rpc_paths` attribute that constrains XML-RPC operations to a " +"limited set of URL paths; the default is to allow only ``'/'`` and ``'/" +"RPC2'``. Setting :attr:`rpc_paths` to ``None`` or an empty tuple disables " +"this path checking." msgstr "" #: ../../whatsnew/2.5.rst:2267 diff --git a/whatsnew/2.6.po b/whatsnew/2.6.po index a7e0c2a770..029e00fe3a 100644 --- a/whatsnew/2.6.po +++ b/whatsnew/2.6.po @@ -44,8 +44,9 @@ msgid "" "incorporates new features and syntax from 3.0 while remaining compatible " "with existing code by not removing older features or syntax. When it's not " "possible to do that, Python 2.6 tries to do what it can, adding " -"compatibility functions in a :mod:`future_builtins` module and a :option:" -"`!-3` switch to warn about usages that will become unsupported in 3.0." +"compatibility functions in a :mod:`future_builtins` module and " +"a :option:`!-3` switch to warn about usages that will become unsupported in " +"3.0." msgstr "" #: ../../whatsnew/2.6.rst:62 @@ -106,8 +107,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:106 msgid "" -"The addition of :func:`functools.reduce` as a synonym for the built-in :func:" -"`reduce` function." +"The addition of :func:`functools.reduce` as a synonym for the built-" +"in :func:`reduce` function." msgstr "" #: ../../whatsnew/2.6.rst:109 @@ -125,16 +126,17 @@ msgid "" "A new command-line switch, :option:`!-3`, enables warnings about features " "that will be removed in Python 3.0. You can run code with this switch to " "see how much work will be necessary to port code to 3.0. The value of this " -"switch is available to Python code as the boolean variable :data:`sys." -"py3kwarning`, and to C extension code as :c:data:`!Py_Py3kWarningFlag`." +"switch is available to Python code as the boolean " +"variable :data:`sys.py3kwarning`, and to C extension code as :c:data:`!" +"Py_Py3kWarningFlag`." msgstr "" #: ../../whatsnew/2.6.rst:126 msgid "" -"The 3\\ *xxx* series of PEPs, which contains proposals for Python 3.0. :pep:" -"`3000` describes the development process for Python 3.0. Start with :pep:" -"`3100` that describes the general goals for Python 3.0, and then explore the " -"higher-numbered PEPs that propose specific features." +"The 3\\ *xxx* series of PEPs, which contains proposals for Python " +"3.0. :pep:`3000` describes the development process for Python 3.0. Start " +"with :pep:`3100` that describes the general goals for Python 3.0, and then " +"explore the higher-numbered PEPs that propose specific features." msgstr "" #: ../../whatsnew/2.6.rst:134 @@ -167,8 +169,8 @@ msgid "" "posted a call for issue trackers, asking volunteers to set up different " "products and import some of the bugs and patches from SourceForge. Four " "different trackers were examined: `Jira <https://www.atlassian.com/software/" -"jira/>`__, `Launchpad <https://launchpad.net/>`__, `Roundup <https://roundup." -"sourceforge.io/>`__, and `Trac <https://trac.edgewall.org/>`__. The " +"jira/>`__, `Launchpad <https://launchpad.net/>`__, `Roundup <https://" +"roundup.sourceforge.io/>`__, and `Trac <https://trac.edgewall.org/>`__. The " "committee eventually settled on Jira and Roundup as the two candidates. " "Jira is a commercial product that offers no-cost hosted instances to free-" "software projects; Roundup is an open-source project that requires " @@ -190,8 +192,8 @@ msgid "" "Hosting of the Python bug tracker is kindly provided by `Upfront Systems " "<https://upfrontsoftware.co.za>`__ of Stellenbosch, South Africa. Martin " "von Löwis put a lot of effort into importing existing bugs and patches from " -"SourceForge; his scripts for this import operation are at ``https://svn." -"python.org/view/tracker/importer/`` and may be useful to other projects " +"SourceForge; his scripts for this import operation are at ``https://" +"svn.python.org/view/tracker/importer/`` and may be useful to other projects " "wishing to move from SourceForge to Roundup." msgstr "" @@ -271,9 +273,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:226 msgid "" "Sphinx is a standalone package that can be used for writing, and almost two " -"dozen other projects (`listed on the Sphinx web site <https://www.sphinx-doc." -"org/en/master/examples.html>`__) have adopted Sphinx as their documentation " -"tool." +"dozen other projects (`listed on the Sphinx web site <https://www.sphinx-" +"doc.org/en/master/examples.html>`__) have adopted Sphinx as their " +"documentation tool." msgstr "" #: ../../whatsnew/2.6.rst:233 @@ -341,8 +343,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:269 msgid "" "The expression is evaluated, and it should result in an object that supports " -"the context management protocol (that is, has :meth:`~object.__enter__` and :" -"meth:`~object.__exit__` methods)." +"the context management protocol (that is, has :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` methods)." msgstr "" #: ../../whatsnew/2.6.rst:273 @@ -355,9 +357,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:278 msgid "" -"After execution of the *with-block* is finished, the object's :meth:`~object." -"__exit__` method is called, even if the block raised an exception, and can " -"therefore run clean-up code." +"After execution of the *with-block* is finished, the " +"object's :meth:`~object.__exit__` method is called, even if the block raised " +"an exception, and can therefore run clean-up code." msgstr "" #: ../../whatsnew/2.6.rst:282 @@ -388,8 +390,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:296 msgid "" -"In this case, *f* is the same object created by :func:`open`, because :meth:" -"`~object.__enter__` returns *self*." +"In this case, *f* is the same object created by :func:`open`, " +"because :meth:`~object.__enter__` returns *self*." msgstr "" #: ../../whatsnew/2.6.rst:299 @@ -453,8 +455,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:339 msgid "" "The expression is evaluated and should result in an object called a " -"\"context manager\". The context manager must have :meth:`~object." -"__enter__` and :meth:`~object.__exit__` methods." +"\"context manager\". The context manager must " +"have :meth:`~object.__enter__` and :meth:`~object.__exit__` methods." msgstr "" #: ../../whatsnew/2.6.rst:343 @@ -470,15 +472,15 @@ msgstr "*BLOCK* 中的程式碼會被執行。" #: ../../whatsnew/2.6.rst:349 msgid "" -"If *BLOCK* raises an exception, the context manager's :meth:`~object." -"__exit__` method is called with three arguments, the exception details " -"(``type, value, traceback``, the same values returned by :func:`sys." -"exc_info`, which can also be ``None`` if no exception occurred). The " -"method's return value controls whether an exception is re-raised: any false " -"value re-raises the exception, and ``True`` will result in suppressing it. " -"You'll only rarely want to suppress the exception, because if you do the " -"author of the code containing the ':keyword:`with`' statement will never " -"realize anything went wrong." +"If *BLOCK* raises an exception, the context " +"manager's :meth:`~object.__exit__` method is called with three arguments, " +"the exception details (``type, value, traceback``, the same values returned " +"by :func:`sys.exc_info`, which can also be ``None`` if no exception " +"occurred). The method's return value controls whether an exception is re-" +"raised: any false value re-raises the exception, and ``True`` will result in " +"suppressing it. You'll only rarely want to suppress the exception, because " +"if you do the author of the code containing the ':keyword:`with`' statement " +"will never realize anything went wrong." msgstr "" #: ../../whatsnew/2.6.rst:358 @@ -525,8 +527,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:379 msgid "" "The transaction should be committed if the code in the block runs flawlessly " -"or rolled back if there's an exception. Here's the basic interface for :" -"class:`DatabaseConnection` that I'll assume::" +"or rolled back if there's an exception. Here's the basic interface " +"for :class:`DatabaseConnection` that I'll assume::" msgstr "" #: ../../whatsnew/2.6.rst:383 @@ -606,8 +608,8 @@ msgid "" "generator function instead of defining a new class. The generator should " "yield exactly one value. The code up to the :keyword:`yield` will be " "executed as the :meth:`~object.__enter__` method, and the value yielded will " -"be the method's return value that will get bound to the variable in the ':" -"keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " +"be the method's return value that will get bound to the variable in the " +"':keyword:`with`' statement's :keyword:`!as` clause, if any. The code after " "the :keyword:`!yield` will be executed in the :meth:`~object.__exit__` " "method. Any exception raised in the block will be raised by the :keyword:`!" "yield` statement." @@ -777,9 +779,9 @@ msgid "" "If you don't like the default directory, it can be overridden by an " "environment variable. :envvar:`PYTHONUSERBASE` sets the root directory used " "for all Python versions supporting this feature. On Windows, the directory " -"for application-specific data can be changed by setting the :envvar:" -"`APPDATA` environment variable. You can also modify the :file:`site.py` " -"file for your Python installation." +"for application-specific data can be changed by setting " +"the :envvar:`APPDATA` environment variable. You can also modify " +"the :file:`site.py` file for your Python installation." msgstr "" #: ../../whatsnew/2.6.rst:544 @@ -811,14 +813,15 @@ msgstr "" #: ../../whatsnew/2.6.rst:567 msgid "" -"The :mod:`multiprocessing` module started out as an exact emulation of the :" -"mod:`threading` module using processes instead of threads. That goal was " -"discarded along the path to Python 2.6, but the general approach of the " +"The :mod:`multiprocessing` module started out as an exact emulation of " +"the :mod:`threading` module using processes instead of threads. That goal " +"was discarded along the path to Python 2.6, but the general approach of the " "module is still similar. The fundamental class is the :class:`Process`, " -"which is passed a callable object and a collection of arguments. The :meth:" -"`start` method sets the callable running in a subprocess, after which you " -"can call the :meth:`is_alive` method to check whether the subprocess is " -"still running and the :meth:`join` method to wait for the process to exit." +"which is passed a callable object and a collection of arguments. " +"The :meth:`start` method sets the callable running in a subprocess, after " +"which you can call the :meth:`is_alive` method to check whether the " +"subprocess is still running and the :meth:`join` method to wait for the " +"process to exit." msgstr "" #: ../../whatsnew/2.6.rst:577 @@ -905,10 +908,10 @@ msgid "" "Two other classes, :class:`Pool` and :class:`Manager`, provide higher-level " "interfaces. :class:`Pool` will create a fixed number of worker processes, " "and requests can then be distributed to the workers by calling :meth:`apply` " -"or :meth:`apply_async` to add a single request, and :meth:`map` or :meth:" -"`map_async` to add a number of requests. The following code uses a :class:" -"`Pool` to spread requests across 5 worker processes and retrieve a list of " -"results::" +"or :meth:`apply_async` to add a single request, and :meth:`map` " +"or :meth:`map_async` to add a number of requests. The following code uses " +"a :class:`Pool` to spread requests across 5 worker processes and retrieve a " +"list of results::" msgstr "" #: ../../whatsnew/2.6.rst:630 @@ -1086,8 +1089,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:744 msgid "" ">>> import sys\n" -">>> print 'Platform: {0.platform}\\nPython version: {0.version}'." -"format(sys)\n" +">>> print 'Platform: {0.platform}\\nPython version: " +"{0.version}'.format(sys)\n" "Platform: darwin\n" "Python version: 2.6a1+ (trunk:61261M, Mar 5 2008, 20:29:41)\n" "[GCC 4.0.1 (Apple Computer, Inc. build 5367)]'\n" @@ -1097,8 +1100,8 @@ msgid "" "'Content-type: video/mp4'" msgstr "" ">>> import sys\n" -">>> print 'Platform: {0.platform}\\nPython version: {0.version}'." -"format(sys)\n" +">>> print 'Platform: {0.platform}\\nPython version: " +"{0.version}'.format(sys)\n" "Platform: darwin\n" "Python version: 2.6a1+ (trunk:61261M, Mar 5 2008, 20:29:41)\n" "[GCC 4.0.1 (Apple Computer, Inc. build 5367)]'\n" @@ -1442,11 +1445,12 @@ msgstr "" #: ../../whatsnew/2.6.rst:902 msgid "" -"The author is probably trying to catch both :exc:`TypeError` and :exc:" -"`ValueError` exceptions, but this code actually does something different: it " -"will catch :exc:`TypeError` and bind the resulting exception object to the " -"local name ``\"ValueError\"``. The :exc:`ValueError` exception will not be " -"caught at all. The correct code specifies a tuple of exceptions::" +"The author is probably trying to catch both :exc:`TypeError` " +"and :exc:`ValueError` exceptions, but this code actually does something " +"different: it will catch :exc:`TypeError` and bind the resulting exception " +"object to the local name ``\"ValueError\"``. The :exc:`ValueError` " +"exception will not be caught at all. The correct code specifies a tuple of " +"exceptions::" msgstr "" #: ../../whatsnew/2.6.rst:909 @@ -1511,10 +1515,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:945 msgid "" "Python 3.0 adopts Unicode as the language's fundamental string type and " -"denotes 8-bit literals differently, either as ``b'string'`` or using a :" -"class:`bytes` constructor. For future compatibility, Python 2.6 adds :class:" -"`bytes` as a synonym for the :class:`str` type, and it also supports the " -"``b''`` notation." +"denotes 8-bit literals differently, either as ``b'string'`` or using " +"a :class:`bytes` constructor. For future compatibility, Python 2.6 " +"adds :class:`bytes` as a synonym for the :class:`str` type, and it also " +"supports the ``b''`` notation." msgstr "" #: ../../whatsnew/2.6.rst:952 @@ -1522,8 +1526,8 @@ msgid "" "The 2.6 :class:`str` differs from 3.0's :class:`bytes` type in various ways; " "most notably, the constructor is completely different. In 3.0, ``bytes([65, " "66, 67])`` is 3 elements long, containing the bytes representing ``ABC``; in " -"2.6, ``bytes([65, 66, 67])`` returns the 12-byte string representing the :" -"func:`str` of the list." +"2.6, ``bytes([65, 66, 67])`` returns the 12-byte string representing " +"the :func:`str` of the list." msgstr "" #: ../../whatsnew/2.6.rst:958 @@ -1531,9 +1535,9 @@ msgid "" "The primary use of :class:`bytes` in 2.6 will be to write tests of object " "type such as ``isinstance(x, bytes)``. This will help the 2to3 converter, " "which can't tell whether 2.x code intends strings to contain either " -"characters or 8-bit bytes; you can now use either :class:`bytes` or :class:" -"`str` to represent your intention exactly, and the resulting code will also " -"be correct in Python 3.0." +"characters or 8-bit bytes; you can now use either :class:`bytes` " +"or :class:`str` to represent your intention exactly, and the resulting code " +"will also be correct in Python 3.0." msgstr "" #: ../../whatsnew/2.6.rst:965 @@ -1563,10 +1567,9 @@ msgstr "" msgid "" "At the C level, Python 3.0 will rename the existing 8-bit string type, " "called :c:type:`!PyStringObject` in Python 2.x, to :c:type:`PyBytesObject`. " -"Python 2.6 uses ``#define`` to support using the names :c:func:" -"`PyBytesObject`, :c:func:`PyBytes_Check`, :c:func:" -"`PyBytes_FromStringAndSize`, and all the other functions and macros used " -"with strings." +"Python 2.6 uses ``#define`` to support using the " +"names :c:func:`PyBytesObject`, :c:func:`PyBytes_Check`, :c:func:`PyBytes_FromStringAndSize`, " +"and all the other functions and macros used with strings." msgstr "" #: ../../whatsnew/2.6.rst:984 @@ -1601,9 +1604,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:999 msgid "" -"Byte arrays support most of the methods of string types, such as :meth:" -"`startswith`/:meth:`endswith`, :meth:`find`/:meth:`rfind`, and some of the " -"methods of lists, such as :meth:`append`, :meth:`pop`, and :meth:`reverse`." +"Byte arrays support most of the methods of string types, such " +"as :meth:`startswith`/:meth:`endswith`, :meth:`find`/:meth:`rfind`, and some " +"of the methods of lists, such as :meth:`append`, :meth:`pop`, " +"and :meth:`reverse`." msgstr "" #: ../../whatsnew/2.6.rst:1006 @@ -1622,8 +1626,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:1012 msgid "" -"There's also a corresponding C API, with :c:func:`PyByteArray_FromObject`, :" -"c:func:`PyByteArray_FromStringAndSize`, and various other functions." +"There's also a corresponding C API, " +"with :c:func:`PyByteArray_FromObject`, :c:func:`PyByteArray_FromStringAndSize`, " +"and various other functions." msgstr "" #: ../../whatsnew/2.6.rst:1019 @@ -1642,10 +1647,10 @@ msgstr "PEP 3116:新 I/O 函式庫" msgid "" "Python's built-in file objects support a number of methods, but file-like " "objects don't necessarily support all of them. Objects that imitate files " -"usually support :meth:`read` and :meth:`write`, but they may not support :" -"meth:`readline`, for example. Python 3.0 introduces a layered I/O library " -"in the :mod:`io` module that separates buffering and text-handling features " -"from the fundamental read and write operations." +"usually support :meth:`read` and :meth:`write`, but they may not " +"support :meth:`readline`, for example. Python 3.0 introduces a layered I/O " +"library in the :mod:`io` module that separates buffering and text-handling " +"features from the fundamental read and write operations." msgstr "" #: ../../whatsnew/2.6.rst:1037 @@ -1656,12 +1661,12 @@ msgstr "" #: ../../whatsnew/2.6.rst:1040 msgid "" -":class:`RawIOBase` defines raw I/O operations: :meth:`read`, :meth:" -"`readinto`, :meth:`write`, :meth:`seek`, :meth:`tell`, :meth:`truncate`, " +":class:`RawIOBase` defines raw I/O " +"operations: :meth:`read`, :meth:`readinto`, :meth:`write`, :meth:`seek`, :meth:`tell`, :meth:`truncate`, " "and :meth:`close`. Most of the methods of this class will often map to a " -"single system call. There are also :meth:`readable`, :meth:`writable`, and :" -"meth:`seekable` methods for determining what operations a given object will " -"allow." +"single system call. There are also :meth:`readable`, :meth:`writable`, " +"and :meth:`seekable` methods for determining what operations a given object " +"will allow." msgstr "" #: ../../whatsnew/2.6.rst:1048 @@ -1674,37 +1679,37 @@ msgstr "" msgid "" ":class:`BufferedIOBase` is an abstract base class that buffers data in " "memory to reduce the number of system calls used, making I/O processing more " -"efficient. It supports all of the methods of :class:`RawIOBase`, and adds a :" -"attr:`raw` attribute holding the underlying raw object." +"efficient. It supports all of the methods of :class:`RawIOBase`, and adds " +"a :attr:`raw` attribute holding the underlying raw object." msgstr "" #: ../../whatsnew/2.6.rst:1058 msgid "" -"There are five concrete classes implementing this ABC. :class:" -"`BufferedWriter` and :class:`BufferedReader` are for objects that support " -"write-only or read-only usage that have a :meth:`seek` method for random " -"access. :class:`BufferedRandom` objects support read and write access upon " -"the same underlying stream, and :class:`BufferedRWPair` is for objects such " -"as TTYs that have both read and write operations acting upon unconnected " -"streams of data. The :class:`BytesIO` class supports reading, writing, and " -"seeking over an in-memory buffer." +"There are five concrete classes implementing this " +"ABC. :class:`BufferedWriter` and :class:`BufferedReader` are for objects " +"that support write-only or read-only usage that have a :meth:`seek` method " +"for random access. :class:`BufferedRandom` objects support read and write " +"access upon the same underlying stream, and :class:`BufferedRWPair` is for " +"objects such as TTYs that have both read and write operations acting upon " +"unconnected streams of data. The :class:`BytesIO` class supports reading, " +"writing, and seeking over an in-memory buffer." msgstr "" #: ../../whatsnew/2.6.rst:1071 msgid "" ":class:`TextIOBase`: Provides functions for reading and writing strings " -"(remember, strings will be Unicode in Python 3.0), and supporting :term:" -"`universal newlines`. :class:`TextIOBase` defines the :meth:`readline` " -"method and supports iteration upon objects." +"(remember, strings will be Unicode in Python 3.0), and " +"supporting :term:`universal newlines`. :class:`TextIOBase` defines " +"the :meth:`readline` method and supports iteration upon objects." msgstr "" #: ../../whatsnew/2.6.rst:1077 msgid "" "There are two concrete implementations. :class:`TextIOWrapper` wraps a " "buffered I/O object, supporting all of the methods for text I/O and adding " -"a :attr:`buffer` attribute for access to the underlying object. :class:" -"`StringIO` simply buffers everything in memory without ever writing anything " -"to disk." +"a :attr:`buffer` attribute for access to the underlying " +"object. :class:`StringIO` simply buffers everything in memory without ever " +"writing anything to disk." msgstr "" #: ../../whatsnew/2.6.rst:1083 @@ -1831,19 +1836,19 @@ msgid "" "It probably means that accessing items with ``obj[1]`` works. Does it imply " "that setting items with ``obj[2] = value`` works? Or that the object will " "have :meth:`keys`, :meth:`values`, and :meth:`items` methods? What about " -"the iterative variants such as :meth:`iterkeys`? :meth:`copy` and :meth:" -"`update`? Iterating over the object with :func:`iter`?" +"the iterative variants such as :meth:`iterkeys`? :meth:`copy` " +"and :meth:`update`? Iterating over the object with :func:`iter`?" msgstr "" #: ../../whatsnew/2.6.rst:1178 msgid "" "The Python 2.6 :mod:`collections` module includes a number of different ABCs " "that represent these distinctions. :class:`Iterable` indicates that a class " -"defines :meth:`__iter__`, and :class:`Container` means the class defines a :" -"meth:`__contains__` method and therefore supports ``x in y`` expressions. " -"The basic dictionary interface of getting items, setting items, and :meth:" -"`keys`, :meth:`values`, and :meth:`items`, is defined by the :class:" -"`MutableMapping` ABC." +"defines :meth:`__iter__`, and :class:`Container` means the class defines " +"a :meth:`__contains__` method and therefore supports ``x in y`` " +"expressions. The basic dictionary interface of getting items, setting " +"items, and :meth:`keys`, :meth:`values`, and :meth:`items`, is defined by " +"the :class:`MutableMapping` ABC." msgstr "" #: ../../whatsnew/2.6.rst:1187 @@ -1889,11 +1894,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:1207 msgid "" -"For classes that you write, deriving from the ABC is probably clearer. The :" -"meth:`register` method is useful when you've written a new ABC that can " -"describe an existing type or class, or if you want to declare that some " -"third-party class implements an ABC. For example, if you defined a :class:" -"`PrintableType` ABC, it's legal to do::" +"For classes that you write, deriving from the ABC is probably clearer. " +"The :meth:`register` method is useful when you've written a new ABC that " +"can describe an existing type or class, or if you want to declare that some " +"third-party class implements an ABC. For example, if you defined " +"a :class:`PrintableType` ABC, it's legal to do::" msgstr "" #: ../../whatsnew/2.6.rst:1214 @@ -1988,18 +1993,19 @@ msgid "" "In the :class:`Drawable` ABC above, the :meth:`draw_doubled` method renders " "the object at twice its size and can be implemented in terms of other " "methods described in :class:`Drawable`. Classes implementing this ABC " -"therefore don't need to provide their own implementation of :meth:" -"`draw_doubled`, though they can do so. An implementation of :meth:`draw` is " -"necessary, though; the ABC can't provide a useful generic implementation." +"therefore don't need to provide their own implementation " +"of :meth:`draw_doubled`, though they can do so. An implementation " +"of :meth:`draw` is necessary, though; the ABC can't provide a useful generic " +"implementation." msgstr "" #: ../../whatsnew/2.6.rst:1266 msgid "" -"You can apply the ``@abstractmethod`` decorator to methods such as :meth:" -"`draw` that must be implemented; Python will then raise an exception for " -"classes that don't define the method. Note that the exception is only raised " -"when you actually try to create an instance of a subclass lacking the " -"method::" +"You can apply the ``@abstractmethod`` decorator to methods such " +"as :meth:`draw` that must be implemented; Python will then raise an " +"exception for classes that don't define the method. Note that the exception " +"is only raised when you actually try to create an instance of a subclass " +"lacking the method::" msgstr "" #: ../../whatsnew/2.6.rst:1272 @@ -2201,8 +2207,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:1386 msgid "" "Python 3.0 adds several abstract base classes for numeric types inspired by " -"Scheme's numeric tower. These classes were backported to 2.6 as the :mod:" -"`numbers` module." +"Scheme's numeric tower. These classes were backported to 2.6 as " +"the :mod:`numbers` module." msgstr "" #: ../../whatsnew/2.6.rst:1390 @@ -2232,9 +2238,9 @@ msgstr "" msgid "" ":class:`Rational` numbers derive from :class:`Real`, have :attr:`numerator` " "and :attr:`denominator` properties, and can be converted to floats. Python " -"2.6 adds a simple rational-number class, :class:`Fraction`, in the :mod:" -"`fractions` module. (It's called :class:`Fraction` instead of :class:" -"`Rational` to avoid a name clash with :class:`numbers.Rational`.)" +"2.6 adds a simple rational-number class, :class:`Fraction`, in " +"the :mod:`fractions` module. (It's called :class:`Fraction` instead " +"of :class:`Rational` to avoid a name clash with :class:`numbers.Rational`.)" msgstr "" #: ../../whatsnew/2.6.rst:1412 @@ -2247,11 +2253,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:1417 msgid "" -"In Python 3.0, the PEP slightly redefines the existing builtins :func:" -"`round`, :func:`math.floor`, :func:`math.ceil`, and adds a new one, :func:" -"`math.trunc`, that's been backported to Python 2.6. :func:`math.trunc` " -"rounds toward zero, returning the closest :class:`Integral` that's between " -"the function's argument and zero." +"In Python 3.0, the PEP slightly redefines the existing " +"builtins :func:`round`, :func:`math.floor`, :func:`math.ceil`, and adds a " +"new one, :func:`math.trunc`, that's been backported to Python " +"2.6. :func:`math.trunc` rounds toward zero, returning the " +"closest :class:`Integral` that's between the function's argument and zero." msgstr "" #: ../../whatsnew/2.6.rst:1425 @@ -2374,10 +2380,10 @@ msgid "" "The :func:`hasattr` function was catching and ignoring all errors, under the " "assumption that they meant a :meth:`__getattr__` method was failing somehow " "and the return value of :func:`hasattr` would therefore be ``False``. This " -"logic shouldn't be applied to :exc:`KeyboardInterrupt` and :exc:" -"`SystemExit`, however; Python 2.6 will no longer discard such exceptions " -"when :func:`hasattr` encounters them. (Fixed by Benjamin Peterson; :issue:" -"`2196`.)" +"logic shouldn't be applied to :exc:`KeyboardInterrupt` " +"and :exc:`SystemExit`, however; Python 2.6 will no longer discard such " +"exceptions when :func:`hasattr` encounters them. (Fixed by Benjamin " +"Peterson; :issue:`2196`.)" msgstr "" #: ../../whatsnew/2.6.rst:1498 @@ -2441,8 +2447,9 @@ msgstr "" msgid "" "A new builtin, ``next(iterator, [default])`` returns the next item from the " "specified iterator. If the *default* argument is supplied, it will be " -"returned if *iterator* has been exhausted; otherwise, the :exc:" -"`StopIteration` exception will be raised. (Backported in :issue:`2719`.)" +"returned if *iterator* has been exhausted; otherwise, " +"the :exc:`StopIteration` exception will be raised. (Backported " +"in :issue:`2719`.)" msgstr "" #: ../../whatsnew/2.6.rst:1531 @@ -2474,10 +2481,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:1549 msgid "" -"Properties now have three attributes, :attr:`getter`, :attr:`setter` and :" -"attr:`deleter`, that are decorators providing useful shortcuts for adding a " -"getter, setter or deleter function to an existing property. You would use " -"them like this::" +"Properties now have three attributes, :attr:`getter`, :attr:`setter` " +"and :attr:`deleter`, that are decorators providing useful shortcuts for " +"adding a getter, setter or deleter function to an existing property. You " +"would use them like this::" msgstr "" #: ../../whatsnew/2.6.rst:1554 @@ -2528,9 +2535,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:1576 msgid "" -"Several methods of the built-in set types now accept multiple iterables: :" -"meth:`intersection`, :meth:`intersection_update`, :meth:`union`, :meth:" -"`update`, :meth:`difference` and :meth:`difference_update`." +"Several methods of the built-in set types now accept multiple " +"iterables: :meth:`intersection`, :meth:`intersection_update`, :meth:`union`, :meth:`update`, :meth:`difference` " +"and :meth:`difference_update`." msgstr "" #: ../../whatsnew/2.6.rst:1584 @@ -2552,15 +2559,15 @@ msgid "" "Many floating-point features were added. The :func:`float` function will " "now turn the string ``nan`` into an IEEE 754 Not A Number value, and " "``+inf`` and ``-inf`` into positive or negative infinity. This works on any " -"platform with IEEE 754 semantics. (Contributed by Christian Heimes; :issue:" -"`1635`.)" +"platform with IEEE 754 semantics. (Contributed by Christian " +"Heimes; :issue:`1635`.)" msgstr "" #: ../../whatsnew/2.6.rst:1598 msgid "" "Other functions in the :mod:`math` module, :func:`isinf` and :func:`isnan`, " -"return true if their floating-point argument is infinite or Not A Number. (:" -"issue:`1640`)" +"return true if their floating-point argument is infinite or Not A Number. " +"(:issue:`1640`)" msgstr "" #: ../../whatsnew/2.6.rst:1602 @@ -2616,9 +2623,9 @@ msgid "" "objects have a default hash method that uses ``id(obj)`` as the hash value. " "There's no tidy way to remove the :meth:`__hash__` method inherited from a " "parent class, so assigning ``None`` was implemented as an override. At the " -"C level, extensions can set ``tp_hash`` to :c:func:" -"`PyObject_HashNotImplemented`. (Fixed by Nick Coghlan and Amaury Forgeot " -"d'Arc; :issue:`2235`.)" +"C level, extensions can set ``tp_hash`` " +"to :c:func:`PyObject_HashNotImplemented`. (Fixed by Nick Coghlan and Amaury " +"Forgeot d'Arc; :issue:`2235`.)" msgstr "" #: ../../whatsnew/2.6.rst:1640 @@ -2632,8 +2639,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:1646 msgid "" "Generator objects now have a :attr:`gi_code` attribute that refers to the " -"original code object backing the generator. (Contributed by Collin Winter; :" -"issue:`1473257`.)" +"original code object backing the generator. (Contributed by Collin " +"Winter; :issue:`1473257`.)" msgstr "" #: ../../whatsnew/2.6.rst:1650 @@ -2646,8 +2653,8 @@ msgstr "" msgid "" "The :func:`complex` constructor now accepts strings containing parenthesized " "complex numbers, meaning that ``complex(repr(cplx))`` will now round-trip " -"values. For example, ``complex('(3+4j)')`` now returns the value (3+4j). (:" -"issue:`1491866`)" +"values. For example, ``complex('(3+4j)')`` now returns the value (3+4j). " +"(:issue:`1491866`)" msgstr "" #: ../../whatsnew/2.6.rst:1659 @@ -2655,8 +2662,8 @@ msgid "" "The string :meth:`translate` method now accepts ``None`` as the translation " "table parameter, which is treated as the identity transformation. This " "makes it easier to carry out operations that only delete characters. " -"(Contributed by Bengt Richter and implemented by Raymond Hettinger; :issue:" -"`1193128`.)" +"(Contributed by Bengt Richter and implemented by Raymond " +"Hettinger; :issue:`1193128`.)" msgstr "" #: ../../whatsnew/2.6.rst:1665 @@ -2664,26 +2671,26 @@ msgid "" "The built-in :func:`dir` function now checks for a :meth:`__dir__` method on " "the objects it receives. This method must return a list of strings " "containing the names of valid attributes for the object, and lets the object " -"control the value that :func:`dir` produces. Objects that have :meth:" -"`__getattr__` or :meth:`__getattribute__` methods can use this to advertise " -"pseudo-attributes they will honor. (:issue:`1591665`)" +"control the value that :func:`dir` produces. Objects that " +"have :meth:`__getattr__` or :meth:`__getattribute__` methods can use this to " +"advertise pseudo-attributes they will honor. (:issue:`1591665`)" msgstr "" #: ../../whatsnew/2.6.rst:1673 msgid "" "Instance method objects have new attributes for the object and function " -"comprising the method; the new synonym for :attr:`!im_self` is :attr:" -"`~method.__self__`, and :attr:`!im_func` is also available as :attr:`~method." -"__func__`. The old names are still supported in Python 2.6, but are gone in " -"3.0." +"comprising the method; the new synonym for :attr:`!im_self` " +"is :attr:`~method.__self__`, and :attr:`!im_func` is also available " +"as :attr:`~method.__func__`. The old names are still supported in Python " +"2.6, but are gone in 3.0." msgstr "" #: ../../whatsnew/2.6.rst:1679 msgid "" -"An obscure change: when you use the :func:`locals` function inside a :" -"keyword:`class` statement, the resulting dictionary no longer returns free " -"variables. (Free variables, in this case, are variables referenced in the :" -"keyword:`!class` statement that aren't attributes of the class.)" +"An obscure change: when you use the :func:`locals` function inside " +"a :keyword:`class` statement, the resulting dictionary no longer returns " +"free variables. (Free variables, in this case, are variables referenced in " +"the :keyword:`!class` statement that aren't attributes of the class.)" msgstr "" #: ../../whatsnew/2.6.rst:1688 @@ -2694,8 +2701,8 @@ msgstr "最佳化" msgid "" "The :mod:`warnings` module has been rewritten in C. This makes it possible " "to invoke warnings from the parser, and may also make the interpreter's " -"startup faster. (Contributed by Neal Norwitz and Brett Cannon; :issue:" -"`1631171`.)" +"startup faster. (Contributed by Neal Norwitz and Brett " +"Cannon; :issue:`1631171`.)" msgstr "" #: ../../whatsnew/2.6.rst:1695 @@ -2746,9 +2753,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:1729 msgid "" "Unicode strings now use faster code for detecting whitespace and line " -"breaks; this speeds up the :meth:`split` method by about 25% and :meth:" -"`splitlines` by 35%. (Contributed by Antoine Pitrou.) Memory usage is " -"reduced by using pymalloc for the Unicode string's data." +"breaks; this speeds up the :meth:`split` method by about 25% " +"and :meth:`splitlines` by 35%. (Contributed by Antoine Pitrou.) Memory " +"usage is reduced by using pymalloc for the Unicode string's data." msgstr "" #: ../../whatsnew/2.6.rst:1735 @@ -2851,8 +2858,8 @@ msgstr "" msgid "" "The :func:`parse_qs` and :func:`parse_qsl` functions have been relocated " "from the :mod:`!cgi` module to the :mod:`urlparse <urllib.parse>` module. " -"The versions still available in the :mod:`!cgi` module will trigger :exc:" -"`PendingDeprecationWarning` messages in 2.6 (:issue:`600362`)." +"The versions still available in the :mod:`!cgi` module will " +"trigger :exc:`PendingDeprecationWarning` messages in 2.6 (:issue:`600362`)." msgstr "" #: ../../whatsnew/2.6.rst:1815 @@ -2896,8 +2903,8 @@ msgid "" "The revisions also improved the numerical soundness of the :mod:`cmath` " "module. For all functions, the real and imaginary parts of the results are " "accurate to within a few units of least precision (ulps) whenever possible. " -"See :issue:`1381` for the details. The branch cuts for :func:`asinh`, :func:" -"`atanh`: and :func:`atan` have also been corrected." +"See :issue:`1381` for the details. The branch cuts " +"for :func:`asinh`, :func:`atanh`: and :func:`atan` have also been corrected." msgstr "" #: ../../whatsnew/2.6.rst:1841 @@ -2944,9 +2951,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:1870 msgid "" "Several places in the standard library that returned tuples have been " -"modified to return :func:`namedtuple` instances. For example, the :meth:" -"`Decimal.as_tuple` method now returns a named tuple with :attr:`sign`, :attr:" -"`digits`, and :attr:`exponent` fields." +"modified to return :func:`namedtuple` instances. For example, " +"the :meth:`Decimal.as_tuple` method now returns a named tuple " +"with :attr:`sign`, :attr:`digits`, and :attr:`exponent` fields." msgstr "" #: ../../whatsnew/2.6.rst:1877 @@ -2986,8 +2993,8 @@ msgid "" "The :mod:`Cookie <http.cookies>` module's :class:`~http.cookies.Morsel` " "objects now support an :attr:`~http.cookies.Morsel.httponly` attribute. In " "some browsers. cookies with this attribute set cannot be accessed or " -"manipulated by JavaScript code. (Contributed by Arvin Schnell; :issue:" -"`1638033`.)" +"manipulated by JavaScript code. (Contributed by Arvin " +"Schnell; :issue:`1638033`.)" msgstr "" #: ../../whatsnew/2.6.rst:1903 @@ -3008,16 +3015,16 @@ msgstr "" msgid "" "The :class:`Textbox` class in the :mod:`curses.textpad` module now supports " "editing in insert mode as well as overwrite mode. Insert mode is enabled by " -"supplying a true value for the *insert_mode* parameter when creating the :" -"class:`Textbox` instance." +"supplying a true value for the *insert_mode* parameter when creating " +"the :class:`Textbox` instance." msgstr "" #: ../../whatsnew/2.6.rst:1918 msgid "" "The :mod:`datetime` module's :meth:`strftime` methods now support a ``%f`` " "format code that expands to the number of microseconds in the object, zero-" -"padded on the left to six places. (Contributed by Skip Montanaro; :issue:" -"`1158`.)" +"padded on the left to six places. (Contributed by Skip " +"Montanaro; :issue:`1158`.)" msgstr "" #: ../../whatsnew/2.6.rst:1923 @@ -3066,20 +3073,21 @@ msgstr "" #: ../../whatsnew/2.6.rst:1946 msgid "" "An optional ``timeout`` parameter, specifying a timeout measured in seconds, " -"was added to the :class:`ftplib.FTP` class constructor as well as the :meth:" -"`connect` method. (Added by Facundo Batista.) Also, the :class:`FTP` " -"class's :meth:`storbinary` and :meth:`storlines` now take an optional " -"*callback* parameter that will be called with each block of data after the " -"data has been sent. (Contributed by Phil Schwartz; :issue:`1221598`.)" +"was added to the :class:`ftplib.FTP` class constructor as well as " +"the :meth:`connect` method. (Added by Facundo Batista.) Also, " +"the :class:`FTP` class's :meth:`storbinary` and :meth:`storlines` now take " +"an optional *callback* parameter that will be called with each block of data " +"after the data has been sent. (Contributed by Phil " +"Schwartz; :issue:`1221598`.)" msgstr "" #: ../../whatsnew/2.6.rst:1954 msgid "" -"The :func:`reduce` built-in function is also available in the :mod:" -"`functools` module. In Python 3.0, the builtin has been dropped and :func:" -"`reduce` is only available from :mod:`functools`; currently there are no " -"plans to drop the builtin in the 2.x series. (Patched by Christian Heimes; :" -"issue:`1739906`.)" +"The :func:`reduce` built-in function is also available in " +"the :mod:`functools` module. In Python 3.0, the builtin has been dropped " +"and :func:`reduce` is only available from :mod:`functools`; currently there " +"are no plans to drop the builtin in the 2.x series. (Patched by Christian " +"Heimes; :issue:`1739906`.)" msgstr "" #: ../../whatsnew/2.6.rst:1960 @@ -3094,8 +3102,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:1966 msgid "" "The :func:`glob.glob` function can now return Unicode filenames if a Unicode " -"path was used and Unicode filenames are matched within the directory. (:" -"issue:`1001604`)" +"path was used and Unicode filenames are matched within the directory. " +"(:issue:`1001604`)" msgstr "" #: ../../whatsnew/2.6.rst:1970 @@ -3124,17 +3132,18 @@ msgstr "" #: ../../whatsnew/2.6.rst:1983 msgid "" ":mod:`heapq` is now implemented to only use less-than comparison, instead of " -"the less-than-or-equal comparison it previously used. This makes :mod:" -"`heapq`'s usage of a type match the :meth:`list.sort` method. (Contributed " -"by Raymond Hettinger.)" +"the less-than-or-equal comparison it previously used. This " +"makes :mod:`heapq`'s usage of a type match the :meth:`list.sort` method. " +"(Contributed by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.6.rst:1989 msgid "" "An optional ``timeout`` parameter, specifying a timeout measured in seconds, " -"was added to the :class:`httplib.HTTPConnection <http.client." -"HTTPConnection>` and :class:`HTTPSConnection <http.client.HTTPSConnection>` " -"class constructors. (Added by Facundo Batista.)" +"was added to the :class:`httplib.HTTPConnection " +"<http.client.HTTPConnection>` and :class:`HTTPSConnection " +"<http.client.HTTPSConnection>` class constructors. (Added by Facundo " +"Batista.)" msgstr "" #: ../../whatsnew/2.6.rst:1994 @@ -3147,8 +3156,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:2000 msgid "" -"Some new functions in the module include :func:`isgenerator`, :func:" -"`isgeneratorfunction`, and :func:`isabstract`." +"Some new functions in the module " +"include :func:`isgenerator`, :func:`isgeneratorfunction`, " +"and :func:`isabstract`." msgstr "" #: ../../whatsnew/2.6.rst:2004 @@ -3272,10 +3282,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:2060 msgid "" "``itertools.chain(*iterables)`` is an existing function in :mod:`itertools` " -"that gained a new constructor in Python 2.6. ``itertools.chain." -"from_iterable(iterable)`` takes a single iterable that should return other " -"iterables. :func:`chain` will then return all the elements of the first " -"iterable, then all the elements of the second, and so on. ::" +"that gained a new constructor in Python 2.6. " +"``itertools.chain.from_iterable(iterable)`` takes a single iterable that " +"should return other iterables. :func:`chain` will then return all the " +"elements of the first iterable, then all the elements of the second, and so " +"on. ::" msgstr "" #: ../../whatsnew/2.6.rst:2067 @@ -3292,11 +3303,12 @@ msgstr "" #: ../../whatsnew/2.6.rst:2072 msgid "" -"The :mod:`logging` module's :class:`FileHandler` class and its subclasses :" -"class:`WatchedFileHandler`, :class:`RotatingFileHandler`, and :class:" -"`TimedRotatingFileHandler` now have an optional *delay* parameter to their " -"constructors. If *delay* is true, opening of the log file is deferred until " -"the first :meth:`emit` call is made. (Contributed by Vinay Sajip.)" +"The :mod:`logging` module's :class:`FileHandler` class and its " +"subclasses :class:`WatchedFileHandler`, :class:`RotatingFileHandler`, " +"and :class:`TimedRotatingFileHandler` now have an optional *delay* parameter " +"to their constructors. If *delay* is true, opening of the log file is " +"deferred until the first :meth:`emit` call is made. (Contributed by Vinay " +"Sajip.)" msgstr "" #: ../../whatsnew/2.6.rst:2079 @@ -3348,9 +3360,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:2108 msgid "" -":func:`trunc` rounds a number toward zero, returning the closest :class:" -"`Integral` that's between the function's argument and zero. Added as part of " -"the backport of `PEP 3141's type hierarchy for numbers <#pep-3141>`__." +":func:`trunc` rounds a number toward zero, returning the " +"closest :class:`Integral` that's between the function's argument and zero. " +"Added as part of the backport of `PEP 3141's type hierarchy for numbers " +"<#pep-3141>`__." msgstr "" #: ../../whatsnew/2.6.rst:2113 @@ -3368,8 +3381,8 @@ msgid "" "``sqrt(float('NaN'))`` should return a NaN on all IEEE 754 platforms. Where " "Annex 'F' of the C99 standard recommends signaling 'divide-by-zero' or " "'invalid', Python will raise :exc:`ValueError`. Where Annex 'F' of the C99 " -"standard recommends signaling 'overflow', Python will raise :exc:" -"`OverflowError`. (See :issue:`711019` and :issue:`1640`.)" +"standard recommends signaling 'overflow', Python will " +"raise :exc:`OverflowError`. (See :issue:`711019` and :issue:`1640`.)" msgstr "" #: ../../whatsnew/2.6.rst:2127 @@ -3476,16 +3489,16 @@ msgid "" "In the :mod:`os.path` module, the :func:`splitext` function has been changed " "to not split on leading period characters. This produces better results when " "operating on Unix's dot-files. For example, ``os.path.splitext('.ipython')`` " -"now returns ``('.ipython', '')`` instead of ``('', '.ipython')``. (:issue:" -"`1115886`)" +"now returns ``('.ipython', '')`` instead of ``('', '.ipython')``. " +"(:issue:`1115886`)" msgstr "" #: ../../whatsnew/2.6.rst:2196 msgid "" "A new function, ``os.path.relpath(path, start='.')``, returns a relative " "path from the ``start`` path, if it's supplied, or from the current working " -"directory to the destination ``path``. (Contributed by Richard Barran; :" -"issue:`1339796`.)" +"directory to the destination ``path``. (Contributed by Richard " +"Barran; :issue:`1339796`.)" msgstr "" #: ../../whatsnew/2.6.rst:2201 @@ -3555,9 +3568,9 @@ msgstr "(由 Paul Moore 貢獻;:issue:`2439`。)" #: ../../whatsnew/2.6.rst:2238 msgid "" -"The :mod:`pyexpat` module's :class:`Parser` objects now allow setting their :" -"attr:`buffer_size` attribute to change the size of the buffer used to hold " -"character data. (Contributed by Achim Gaedke; :issue:`1137`.)" +"The :mod:`pyexpat` module's :class:`Parser` objects now allow setting " +"their :attr:`buffer_size` attribute to change the size of the buffer used to " +"hold character data. (Contributed by Achim Gaedke; :issue:`1137`.)" msgstr "" #: ../../whatsnew/2.6.rst:2243 @@ -3612,10 +3625,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:2280 msgid "" -"The :mod:`sched` module's :class:`scheduler` instances now have a read-only :" -"attr:`queue` attribute that returns the contents of the scheduler's queue, " -"represented as a list of named tuples with the fields ``(time, priority, " -"action, argument)``. (Contributed by Raymond Hettinger; :issue:`1861`.)" +"The :mod:`sched` module's :class:`scheduler` instances now have a read-" +"only :attr:`queue` attribute that returns the contents of the scheduler's " +"queue, represented as a list of named tuples with the fields ``(time, " +"priority, action, argument)``. (Contributed by Raymond " +"Hettinger; :issue:`1861`.)" msgstr "" #: ../../whatsnew/2.6.rst:2286 @@ -3673,11 +3687,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:2322 msgid "" "Event loops will use this by opening a pipe to create two descriptors, one " -"for reading and one for writing. The writable descriptor will be passed to :" -"func:`set_wakeup_fd`, and the readable descriptor will be added to the list " -"of descriptors monitored by the event loop via :c:func:`!select` or :c:func:" -"`!poll`. On receiving a signal, a byte will be written and the main event " -"loop will be woken up, avoiding the need to poll." +"for reading and one for writing. The writable descriptor will be passed " +"to :func:`set_wakeup_fd`, and the readable descriptor will be added to the " +"list of descriptors monitored by the event loop via :c:func:`!select` " +"or :c:func:`!poll`. On receiving a signal, a byte will be written and the " +"main event loop will be woken up, avoiding the need to poll." msgstr "" #: ../../whatsnew/2.6.rst:2330 @@ -3714,8 +3728,8 @@ msgstr "" msgid "" "An implementation of the LMTP protocol (:rfc:`2033`) was also added to the " "module. LMTP is used in place of SMTP when transferring e-mail between " -"agents that don't manage a mail queue. (LMTP implemented by Leif Hedstrom; :" -"issue:`957003`.)" +"agents that don't manage a mail queue. (LMTP implemented by Leif " +"Hedstrom; :issue:`957003`.)" msgstr "" #: ../../whatsnew/2.6.rst:2356 @@ -3747,12 +3761,12 @@ msgstr "" msgid "" "The base classes in the :mod:`SocketServer <socketserver>` module now " "support calling a :meth:`~socketserver.BaseServer.handle_timeout` method " -"after a span of inactivity specified by the server's :attr:`~socketserver." -"BaseServer.timeout` attribute. (Contributed by Michael Pomraning.) The :" -"meth:`~socketserver.BaseServer.serve_forever` method now takes an optional " -"poll interval measured in seconds, controlling how often the server will " -"check for a shutdown request. (Contributed by Pedro Werneck and Jeffrey " -"Yasskin; :issue:`742598`, :issue:`1193577`.)" +"after a span of inactivity specified by the " +"server's :attr:`~socketserver.BaseServer.timeout` attribute. (Contributed " +"by Michael Pomraning.) The :meth:`~socketserver.BaseServer.serve_forever` " +"method now takes an optional poll interval measured in seconds, controlling " +"how often the server will check for a shutdown request. (Contributed by " +"Pedro Werneck and Jeffrey Yasskin; :issue:`742598`, :issue:`1193577`.)" msgstr "" #: ../../whatsnew/2.6.rst:2383 @@ -3770,10 +3784,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:2391 msgid "" "The :class:`~subprocess.Popen` objects provided by the :mod:`subprocess` " -"module now have :meth:`~subprocess.Popen.terminate`, :meth:`~subprocess." -"Popen.kill`, and :meth:`~subprocess.Popen.send_signal` methods. On Windows, :" -"meth:`!send_signal` only supports the :py:const:`~signal.SIGTERM` signal, " -"and all these methods are aliases for the Win32 API function :c:func:`!" +"module now " +"have :meth:`~subprocess.Popen.terminate`, :meth:`~subprocess.Popen.kill`, " +"and :meth:`~subprocess.Popen.send_signal` methods. On Windows, :meth:`!" +"send_signal` only supports the :py:const:`~signal.SIGTERM` signal, and all " +"these methods are aliases for the Win32 API function :c:func:`!" "TerminateProcess`. (Contributed by Christian Heimes.)" msgstr "" @@ -3781,10 +3796,10 @@ msgstr "" msgid "" "A new variable in the :mod:`sys` module, :attr:`float_info`, is an object " "containing information derived from the :file:`float.h` file about the " -"platform's floating-point support. Attributes of this object include :attr:" -"`mant_dig` (number of digits in the mantissa), :attr:`epsilon` (smallest " -"difference between 1.0 and the next largest value representable), and " -"several others. (Contributed by Christian Heimes; :issue:`1534`.)" +"platform's floating-point support. Attributes of this object " +"include :attr:`mant_dig` (number of digits in the mantissa), :attr:`epsilon` " +"(smallest difference between 1.0 and the next largest value representable), " +"and several others. (Contributed by Christian Heimes; :issue:`1534`.)" msgstr "" #: ../../whatsnew/2.6.rst:2406 @@ -3812,9 +3827,9 @@ msgstr "" msgid "" "A new function, :func:`getsizeof`, takes a Python object and returns the " "amount of memory used by the object, measured in bytes. Built-in objects " -"return correct results; third-party extensions may not, but can define a :" -"meth:`__sizeof__` method to return the object's size. (Contributed by Robert " -"Schuppenies; :issue:`2898`.)" +"return correct results; third-party extensions may not, but can define " +"a :meth:`__sizeof__` method to return the object's size. (Contributed by " +"Robert Schuppenies; :issue:`2898`.)" msgstr "" #: ../../whatsnew/2.6.rst:2432 @@ -3866,9 +3881,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:2462 msgid "" -"An optional ``timeout`` parameter was added to the :class:`!telnetlib." -"Telnet` class constructor, specifying a timeout measured in seconds. (Added " -"by Facundo Batista.)" +"An optional ``timeout`` parameter was added to the :class:`!" +"telnetlib.Telnet` class constructor, specifying a timeout measured in " +"seconds. (Added by Facundo Batista.)" msgstr "" #: ../../whatsnew/2.6.rst:2466 @@ -3890,17 +3905,18 @@ msgstr "" #: ../../whatsnew/2.6.rst:2476 msgid "" "The :class:`NamedTemporaryFile` and :class:`SpooledTemporaryFile` classes " -"both work as context managers, so you can write ``with tempfile." -"NamedTemporaryFile() as tmp: ...``. (Contributed by Alexander Belopolsky; :" -"issue:`2021`.)" +"both work as context managers, so you can write ``with " +"tempfile.NamedTemporaryFile() as tmp: ...``. (Contributed by Alexander " +"Belopolsky; :issue:`2021`.)" msgstr "" #: ../../whatsnew/2.6.rst:2481 msgid "" "The :mod:`test.test_support <test.support>` module gained a number of " -"context managers useful for writing tests. :func:`~test.support.os_helper." -"EnvironmentVarGuard` is a context manager that temporarily changes " -"environment variables and automatically restores them to their old values." +"context managers useful for writing " +"tests. :func:`~test.support.os_helper.EnvironmentVarGuard` is a context " +"manager that temporarily changes environment variables and automatically " +"restores them to their old values." msgstr "" #: ../../whatsnew/2.6.rst:2487 @@ -3973,22 +3989,22 @@ msgstr "(由 Dwayne Bailey 貢獻;:issue:`1581073`。)" #: ../../whatsnew/2.6.rst:2531 msgid "" -"The :mod:`threading` module API is being changed to use properties such as :" -"attr:`daemon` instead of :meth:`setDaemon` and :meth:`isDaemon` methods, and " -"some methods have been renamed to use underscores instead of camel-case; for " -"example, the :meth:`activeCount` method is renamed to :meth:`active_count`. " -"Both the 2.6 and 3.0 versions of the module support the same properties and " -"renamed methods, but don't remove the old methods. No date has been set for " -"the deprecation of the old APIs in Python 3.x; the old APIs won't be removed " -"in any 2.x version. (Carried out by several people, most notably Benjamin " -"Peterson.)" +"The :mod:`threading` module API is being changed to use properties such " +"as :attr:`daemon` instead of :meth:`setDaemon` and :meth:`isDaemon` methods, " +"and some methods have been renamed to use underscores instead of camel-case; " +"for example, the :meth:`activeCount` method is renamed " +"to :meth:`active_count`. Both the 2.6 and 3.0 versions of the module " +"support the same properties and renamed methods, but don't remove the old " +"methods. No date has been set for the deprecation of the old APIs in Python " +"3.x; the old APIs won't be removed in any 2.x version. (Carried out by " +"several people, most notably Benjamin Peterson.)" msgstr "" #: ../../whatsnew/2.6.rst:2542 msgid "" -"The :mod:`threading` module's :class:`Thread` objects gained an :attr:" -"`ident` property that returns the thread's identifier, a nonzero integer. " -"(Contributed by Gregory P. Smith; :issue:`2871`.)" +"The :mod:`threading` module's :class:`Thread` objects gained " +"an :attr:`ident` property that returns the thread's identifier, a nonzero " +"integer. (Contributed by Gregory P. Smith; :issue:`2871`.)" msgstr "" #: ../../whatsnew/2.6.rst:2547 @@ -3997,8 +4013,8 @@ msgid "" "statement being timed and for the setup code. Two convenience functions were " "added for creating :class:`Timer` instances: ``repeat(stmt, setup, time, " "repeat, number)`` and ``timeit(stmt, setup, time, number)`` create an " -"instance and call the corresponding method. (Contributed by Erik Demaine; :" -"issue:`1533909`.)" +"instance and call the corresponding method. (Contributed by Erik " +"Demaine; :issue:`1533909`.)" msgstr "" #: ../../whatsnew/2.6.rst:2556 @@ -4108,14 +4124,14 @@ msgstr "" #: ../../whatsnew/2.6.rst:2607 msgid "" -"The XML-RPC :class:`SimpleXMLRPCServer <xmlrpc.server>` and :class:" -"`DocXMLRPCServer <xmlrpc.server>` classes can now be prevented from " -"immediately opening and binding to their socket by passing ``False`` as the " -"*bind_and_activate* constructor parameter. This can be used to modify the " -"instance's :attr:`allow_reuse_address` attribute before calling the :meth:" -"`server_bind` and :meth:`server_activate` methods to open the socket and " -"begin listening for connections. (Contributed by Peter Parente; :issue:" -"`1599845`.)" +"The XML-RPC :class:`SimpleXMLRPCServer <xmlrpc.server>` " +"and :class:`DocXMLRPCServer <xmlrpc.server>` classes can now be prevented " +"from immediately opening and binding to their socket by passing ``False`` as " +"the *bind_and_activate* constructor parameter. This can be used to modify " +"the instance's :attr:`allow_reuse_address` attribute before calling " +"the :meth:`server_bind` and :meth:`server_activate` methods to open the " +"socket and begin listening for connections. (Contributed by Peter " +"Parente; :issue:`1599845`.)" msgstr "" #: ../../whatsnew/2.6.rst:2616 @@ -4132,14 +4148,14 @@ msgstr "" #: ../../whatsnew/2.6.rst:2624 msgid "" "The :mod:`xmlrpclib <xmlrpc.client>` module no longer automatically " -"converts :class:`datetime.date` and :class:`datetime.time` to the :class:" -"`xmlrpclib.DateTime <xmlrpc.client.DateTime>` type; the conversion semantics " -"were not necessarily correct for all applications. Code using :mod:`!" -"xmlrpclib` should convert :class:`date` and :class:`~datetime.time` " -"instances. (:issue:`1330538`) The code can also handle dates before 1900 " -"(contributed by Ralf Schmitt; :issue:`2014`) and 64-bit integers represented " -"by using ``<i8>`` in XML-RPC responses (contributed by Riku Lindblad; :issue:" -"`2985`)." +"converts :class:`datetime.date` and :class:`datetime.time` to " +"the :class:`xmlrpclib.DateTime <xmlrpc.client.DateTime>` type; the " +"conversion semantics were not necessarily correct for all applications. " +"Code using :mod:`!xmlrpclib` should convert :class:`date` " +"and :class:`~datetime.time` instances. (:issue:`1330538`) The code can also " +"handle dates before 1900 (contributed by Ralf Schmitt; :issue:`2014`) and 64-" +"bit integers represented by using ``<i8>`` in XML-RPC responses (contributed " +"by Riku Lindblad; :issue:`2985`)." msgstr "" #: ../../whatsnew/2.6.rst:2634 @@ -4193,8 +4209,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:2671 msgid "" -"The :func:`parse` function takes an expression and returns an AST. The :func:" -"`dump` function outputs a representation of a tree, suitable for debugging::" +"The :func:`parse` function takes an expression and returns an AST. " +"The :func:`dump` function outputs a representation of a tree, suitable for " +"debugging::" msgstr "" #: ../../whatsnew/2.6.rst:2675 @@ -4354,8 +4371,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:2761 msgid "" -"``hex(value)``, ``oct(value)``: instead of calling the :meth:`__hex__` or :" -"meth:`__oct__` methods, these versions will call the :meth:`__index__` " +"``hex(value)``, ``oct(value)``: instead of calling the :meth:`__hex__` " +"or :meth:`__oct__` methods, these versions will call the :meth:`__index__` " "method and convert the result to hexadecimal or octal. :func:`oct` will use " "the new ``0o`` notation for its result." msgstr "" @@ -4471,10 +4488,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:2853 msgid "" -"All :mod:`ctypes` data types now support :meth:`from_buffer` and :meth:" -"`from_buffer_copy` methods that create a ctypes instance based on a provided " -"buffer object. :meth:`from_buffer_copy` copies the contents of the object, " -"while :meth:`from_buffer` will share the same memory area." +"All :mod:`ctypes` data types now support :meth:`from_buffer` " +"and :meth:`from_buffer_copy` methods that create a ctypes instance based on " +"a provided buffer object. :meth:`from_buffer_copy` copies the contents of " +"the object, while :meth:`from_buffer` will share the same memory area." msgstr "" #: ../../whatsnew/2.6.rst:2860 @@ -4495,8 +4512,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:2870 msgid "" -"The Win32 LastError variable is similarly supported by the :func:`DLL`, :" -"func:`OleDLL`, and :func:`WinDLL` functions. You supply " +"The Win32 LastError variable is similarly supported by " +"the :func:`DLL`, :func:`OleDLL`, and :func:`WinDLL` functions. You supply " "``use_last_error=True`` as a keyword parameter and then call the module-" "level methods :meth:`set_last_error` and :meth:`get_last_error`." msgstr "" @@ -4541,8 +4558,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:2908 ../../whatsnew/2.6.rst:3262 msgid "" -"String exceptions have been removed. Attempting to use them raises a :exc:" -"`TypeError`." +"String exceptions have been removed. Attempting to use them raises " +"a :exc:`TypeError`." msgstr "" #: ../../whatsnew/2.6.rst:2911 @@ -4561,13 +4578,13 @@ msgstr "" #: ../../whatsnew/2.6.rst:2921 msgid "" -"The list of deprecated modules is: :mod:`!audiodev`, :mod:`!bgenlocations`, :" -"mod:`!buildtools`, :mod:`!bundlebuilder`, :mod:`!Canvas`, :mod:`!compiler`, :" -"mod:`!dircache`, :mod:`!dl`, :mod:`!fpformat`, :mod:`!gensuitemodule`, :mod:" -"`!ihooks`, :mod:`!imageop`, :mod:`!imgfile`, :mod:`!linuxaudiodev`, :mod:`!" -"mhlib`, :mod:`!mimetools`, :mod:`!multifile`, :mod:`!new`, :mod:`!pure`, :" -"mod:`!statvfs`, :mod:`!sunaudiodev`, :mod:`!test.testall`, and :mod:`!" -"toaiff`." +"The list of deprecated modules is: :mod:`!audiodev`, :mod:`!" +"bgenlocations`, :mod:`!buildtools`, :mod:`!bundlebuilder`, :mod:`!" +"Canvas`, :mod:`!compiler`, :mod:`!dircache`, :mod:`!dl`, :mod:`!" +"fpformat`, :mod:`!gensuitemodule`, :mod:`!ihooks`, :mod:`!imageop`, :mod:`!" +"imgfile`, :mod:`!linuxaudiodev`, :mod:`!mhlib`, :mod:`!mimetools`, :mod:`!" +"multifile`, :mod:`!new`, :mod:`!pure`, :mod:`!statvfs`, :mod:`!" +"sunaudiodev`, :mod:`!test.testall`, and :mod:`!toaiff`." msgstr "" #: ../../whatsnew/2.6.rst:2946 @@ -4616,17 +4633,17 @@ msgstr "" #: ../../whatsnew/2.6.rst:2974 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/2.6.rst:2976 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/2.6.rst:2978 msgid "" "Python now must be compiled with C89 compilers (after 19 years!). This " -"means that the Python source tree has dropped its own implementations of :c:" -"func:`!memmove` and :c:func:`!strerror`, which are in the C89 standard " +"means that the Python source tree has dropped its own implementations " +"of :c:func:`!memmove` and :c:func:`!strerror`, which are in the C89 standard " "library." msgstr "" @@ -4639,11 +4656,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:2988 msgid "" -"On Mac OS X, Python 2.6 can be compiled as a 4-way universal build. The :" -"program:`configure` script can take a :option:`!--with-universal-archs=[32-" -"bit|64-bit|all]` switch, controlling whether the binaries are built for 32-" -"bit architectures (x86, PowerPC), 64-bit (x86-64 and PPC-64), or both. " -"(Contributed by Ronald Oussoren.)" +"On Mac OS X, Python 2.6 can be compiled as a 4-way universal build. " +"The :program:`configure` script can take a :option:`!--with-universal-" +"archs=[32-bit|64-bit|all]` switch, controlling whether the binaries are " +"built for 32-bit architectures (x86, PowerPC), 64-bit (x86-64 and PPC-64), " +"or both. (Contributed by Ronald Oussoren.)" msgstr "" #: ../../whatsnew/2.6.rst:2995 @@ -4685,9 +4702,10 @@ msgstr "" #: ../../whatsnew/2.6.rst:3021 msgid "" -"The BerkeleyDB module now has a C API object, available as ``bsddb.db." -"api``. This object can be used by other C extensions that wish to use the :" -"mod:`bsddb` module for their own purposes. (Contributed by Duncan Grisby.)" +"The BerkeleyDB module now has a C API object, available as " +"``bsddb.db.api``. This object can be used by other C extensions that wish " +"to use the :mod:`bsddb` module for their own purposes. (Contributed by " +"Duncan Grisby.)" msgstr "" #: ../../whatsnew/2.6.rst:3026 @@ -4715,11 +4733,11 @@ msgstr "" #: ../../whatsnew/2.6.rst:3044 msgid "" "Importing modules simultaneously in two different threads no longer " -"deadlocks; it will now raise an :exc:`ImportError`. A new API function, :c:" -"func:`PyImport_ImportModuleNoBlock`, will look for a module in ``sys." -"modules`` first, then try to import it after acquiring an import lock. If " -"the import lock is held by another thread, an :exc:`ImportError` is raised. " -"(Contributed by Christian Heimes.)" +"deadlocks; it will now raise an :exc:`ImportError`. A new API " +"function, :c:func:`PyImport_ImportModuleNoBlock`, will look for a module in " +"``sys.modules`` first, then try to import it after acquiring an import " +"lock. If the import lock is held by another thread, an :exc:`ImportError` " +"is raised. (Contributed by Christian Heimes.)" msgstr "" #: ../../whatsnew/2.6.rst:3052 @@ -4754,25 +4772,26 @@ msgstr "" msgid "" "Many C extensions define their own little macro for adding integers and " "strings to the module's dictionary in the ``init*`` function. Python 2.6 " -"finally defines standard macros for adding values to a module, :c:macro:" -"`PyModule_AddStringMacro` and :c:macro:`PyModule_AddIntMacro()`. " -"(Contributed by Christian Heimes.)" +"finally defines standard macros for adding values to a " +"module, :c:macro:`PyModule_AddStringMacro` " +"and :c:macro:`PyModule_AddIntMacro()`. (Contributed by Christian Heimes.)" msgstr "" #: ../../whatsnew/2.6.rst:3082 msgid "" "Some macros were renamed in both 3.0 and 2.6 to make it clearer that they " -"are macros, not functions. :c:macro:`!Py_Size()` became :c:macro:" -"`Py_SIZE()`, :c:macro:`!Py_Type()` became :c:macro:`Py_TYPE()`, and :c:macro:" -"`!Py_Refcnt()` became :c:macro:`Py_REFCNT()`. The mixed-case macros are " -"still available in Python 2.6 for backward compatibility. (:issue:`1629`)" +"are macros, not functions. :c:macro:`!Py_Size()` " +"became :c:macro:`Py_SIZE()`, :c:macro:`!Py_Type()` " +"became :c:macro:`Py_TYPE()`, and :c:macro:`!Py_Refcnt()` " +"became :c:macro:`Py_REFCNT()`. The mixed-case macros are still available in " +"Python 2.6 for backward compatibility. (:issue:`1629`)" msgstr "" #: ../../whatsnew/2.6.rst:3091 msgid "" "Distutils now places C extensions it builds in a different directory when " -"running on a debug version of Python. (Contributed by Collin Winter; :issue:" -"`1530959`.)" +"running on a debug version of Python. (Contributed by Collin " +"Winter; :issue:`1530959`.)" msgstr "" #: ../../whatsnew/2.6.rst:3095 @@ -4841,27 +4860,27 @@ msgstr "" #: ../../whatsnew/2.6.rst:3142 msgid "" -"The :mod:`socket` module's socket objects now have an :meth:`~socket.socket." -"ioctl` method that provides a limited interface to the :c:func:`WSAIoctl` " -"system interface." +"The :mod:`socket` module's socket objects now have " +"an :meth:`~socket.socket.ioctl` method that provides a limited interface to " +"the :c:func:`WSAIoctl` system interface." msgstr "" #: ../../whatsnew/2.6.rst:3146 msgid "" -"The :mod:`_winreg <winreg>` module now has a function, :func:`~winreg." -"ExpandEnvironmentStrings`, that expands environment variable references such " -"as ``%NAME%`` in an input string. The handle objects provided by this " -"module now support the context protocol, so they can be used in :keyword:" -"`with` statements. (Contributed by Christian Heimes.)" +"The :mod:`_winreg <winreg>` module now has a " +"function, :func:`~winreg.ExpandEnvironmentStrings`, that expands environment " +"variable references such as ``%NAME%`` in an input string. The handle " +"objects provided by this module now support the context protocol, so they " +"can be used in :keyword:`with` statements. (Contributed by Christian Heimes.)" msgstr "" #: ../../whatsnew/2.6.rst:3153 msgid "" ":mod:`_winreg <winreg>` also has better support for x64 systems, exposing " -"the :func:`~winreg.DisableReflectionKey`, :func:`~winreg." -"EnableReflectionKey`, and :func:`~winreg.QueryReflectionKey` functions, " -"which enable and disable registry reflection for 32-bit processes running on " -"64-bit systems. (:issue:`1753245`)" +"the :func:`~winreg.DisableReflectionKey`, :func:`~winreg.EnableReflectionKey`, " +"and :func:`~winreg.QueryReflectionKey` functions, which enable and disable " +"registry reflection for 32-bit processes running on 64-bit systems. " +"(:issue:`1753245`)" msgstr "" #: ../../whatsnew/2.6.rst:3159 @@ -4884,24 +4903,25 @@ msgstr "" #: ../../whatsnew/2.6.rst:3174 msgid "" -"The :mod:`!macfs` module has been removed. This in turn required the :func:" -"`!macostools.touched` function to be removed because it depended on the :mod:" -"`!macfs` module. (:issue:`1490190`)" +"The :mod:`!macfs` module has been removed. This in turn required " +"the :func:`!macostools.touched` function to be removed because it depended " +"on the :mod:`!macfs` module. (:issue:`1490190`)" msgstr "" #: ../../whatsnew/2.6.rst:3178 msgid "" "Many other Mac OS modules have been deprecated and will be removed in Python " "3.0: :mod:`!_builtinSuites`, :mod:`!aepack`, :mod:`!aetools`, :mod:`!" -"aetypes`, :mod:`!applesingle`, :mod:`!appletrawmain`, :mod:`!appletrunner`, :" -"mod:`!argvemulator`, :mod:`!Audio_mac`, :mod:`!autoGIL`, :mod:`!Carbon`, :" -"mod:`!cfmfile`, :mod:`!CodeWarrior`, :mod:`!ColorPicker`, :mod:`!" -"EasyDialogs`, :mod:`!Explorer`, :mod:`!Finder`, :mod:`!FrameWork`, :mod:`!" -"findertools`, :mod:`!ic`, :mod:`!icglue`, :mod:`!icopen`, :mod:`!" -"macerrors`, :mod:`!MacOS`, :mod:`!macfs`, :mod:`!macostools`, :mod:`!" -"macresource`, :mod:`!MiniAEFrame`, :mod:`!Nav`, :mod:`!Netscape`, :mod:`!" -"OSATerminology`, :mod:`!pimp`, :mod:`!PixMapWrapper`, :mod:`!StdSuites`, :" -"mod:`!SystemEvents`, :mod:`!Terminal`, and :mod:`!terminalcommand`." +"aetypes`, :mod:`!applesingle`, :mod:`!appletrawmain`, :mod:`!" +"appletrunner`, :mod:`!argvemulator`, :mod:`!Audio_mac`, :mod:`!" +"autoGIL`, :mod:`!Carbon`, :mod:`!cfmfile`, :mod:`!CodeWarrior`, :mod:`!" +"ColorPicker`, :mod:`!EasyDialogs`, :mod:`!Explorer`, :mod:`!Finder`, :mod:`!" +"FrameWork`, :mod:`!findertools`, :mod:`!ic`, :mod:`!icglue`, :mod:`!" +"icopen`, :mod:`!macerrors`, :mod:`!MacOS`, :mod:`!macfs`, :mod:`!" +"macostools`, :mod:`!macresource`, :mod:`!MiniAEFrame`, :mod:`!Nav`, :mod:`!" +"Netscape`, :mod:`!OSATerminology`, :mod:`!pimp`, :mod:`!" +"PixMapWrapper`, :mod:`!StdSuites`, :mod:`!SystemEvents`, :mod:`!Terminal`, " +"and :mod:`!terminalcommand`." msgstr "" #: ../../whatsnew/2.6.rst:3221 @@ -4913,10 +4933,10 @@ msgid "" "A number of old IRIX-specific modules were deprecated and will be removed in " "Python 3.0: :mod:`!al` and :mod:`!AL`, :mod:`!cd`, :mod:`!cddb`, :mod:`!" "cdplayer`, :mod:`!CL` and :mod:`!cl`, :mod:`!DEVICE`, :mod:`!ERRNO`, :mod:`!" -"FILE`, :mod:`!FL` and :mod:`!fl`, :mod:`!flp`, :mod:`!fm`, :mod:`!GET`, :mod:" -"`!GLWS`, :mod:`!GL` and :mod:`!gl`, :mod:`!IN`, :mod:`!IOCTL`, :mod:`!" -"jpeg`, :mod:`!panelparser`, :mod:`!readcd`, :mod:`!SV` and :mod:`!sv`, :mod:" -"`!torgb`, :mod:`!videoreader`, and :mod:`!WAIT`." +"FILE`, :mod:`!FL` and :mod:`!fl`, :mod:`!flp`, :mod:`!fm`, :mod:`!" +"GET`, :mod:`!GLWS`, :mod:`!GL` and :mod:`!gl`, :mod:`!IN`, :mod:`!" +"IOCTL`, :mod:`!jpeg`, :mod:`!panelparser`, :mod:`!readcd`, :mod:`!SV` " +"and :mod:`!sv`, :mod:`!torgb`, :mod:`!videoreader`, and :mod:`!WAIT`." msgstr "" #: ../../whatsnew/2.6.rst:3253 @@ -4955,9 +4975,9 @@ msgstr "" msgid "" "The :class:`Decimal` constructor now accepts leading and trailing whitespace " "when passed a string. Previously it would raise an :exc:`InvalidOperation` " -"exception. On the other hand, the :meth:`create_decimal` method of :class:" -"`Context` objects now explicitly disallows extra whitespace, raising a :exc:" -"`ConversionSyntax` exception." +"exception. On the other hand, the :meth:`create_decimal` method " +"of :class:`Context` objects now explicitly disallows extra whitespace, " +"raising a :exc:`ConversionSyntax` exception." msgstr "" #: ../../whatsnew/2.6.rst:3284 @@ -4983,20 +5003,20 @@ msgstr "" #: ../../whatsnew/2.6.rst:3298 msgid "" -"The :mod:`socket` module exception :exc:`socket.error` now inherits from :" -"exc:`IOError`. Previously it wasn't a subclass of :exc:`StandardError` but " -"now it is, through :exc:`IOError`. (Implemented by Gregory P. Smith; :issue:" -"`1706815`.)" +"The :mod:`socket` module exception :exc:`socket.error` now inherits " +"from :exc:`IOError`. Previously it wasn't a subclass " +"of :exc:`StandardError` but now it is, through :exc:`IOError`. (Implemented " +"by Gregory P. Smith; :issue:`1706815`.)" msgstr "" #: ../../whatsnew/2.6.rst:3303 msgid "" "The :mod:`xmlrpclib <xmlrpc.client>` module no longer automatically " -"converts :class:`datetime.date` and :class:`datetime.time` to the :class:" -"`xmlrpclib.DateTime <xmlrpc.client.DateTime>` type; the conversion semantics " -"were not necessarily correct for all applications. Code using :mod:`!" -"xmlrpclib` should convert :class:`date` and :class:`~datetime.time` " -"instances. (:issue:`1330538`)" +"converts :class:`datetime.date` and :class:`datetime.time` to " +"the :class:`xmlrpclib.DateTime <xmlrpc.client.DateTime>` type; the " +"conversion semantics were not necessarily correct for all applications. " +"Code using :mod:`!xmlrpclib` should convert :class:`date` " +"and :class:`~datetime.time` instances. (:issue:`1330538`)" msgstr "" #: ../../whatsnew/2.6.rst:3310 diff --git a/whatsnew/2.7.po b/whatsnew/2.7.po index cc574ea59c..8e84e172e9 100644 --- a/whatsnew/2.7.po +++ b/whatsnew/2.7.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -39,11 +39,11 @@ msgstr "" msgid "" "Numeric handling has been improved in many ways, for both floating-point " "numbers and for the :class:`~decimal.Decimal` class. There are some useful " -"additions to the standard library, such as a greatly enhanced :mod:" -"`unittest` module, the :mod:`argparse` module for parsing command-line " -"options, convenient :class:`~collections.OrderedDict` and :class:" -"`~collections.Counter` classes in the :mod:`collections` module, and many " -"other improvements." +"additions to the standard library, such as a greatly " +"enhanced :mod:`unittest` module, the :mod:`argparse` module for parsing " +"command-line options, convenient :class:`~collections.OrderedDict` " +"and :class:`~collections.Counter` classes in the :mod:`collections` module, " +"and many other improvements." msgstr "" #: ../../whatsnew/2.7.rst:63 @@ -59,9 +59,9 @@ msgid "" "features, but instead provides a convenient overview. For full details, you " "should refer to the documentation for Python 2.7 at https://docs.python.org. " "If you want to understand the rationale for the design and implementation, " -"refer to the PEP for a particular new feature or the issue on https://bugs." -"python.org in which a change was discussed. Whenever possible, \"What's New " -"in Python\" links to the bug/patch item for each change." +"refer to the PEP for a particular new feature or the issue on https://" +"bugs.python.org in which a change was discussed. Whenever possible, " +"\"What's New in Python\" links to the bug/patch item for each change." msgstr "" #: ../../whatsnew/2.7.rst:80 @@ -168,10 +168,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:151 msgid "" "However, there are increasingly many users of Python-based applications who " -"are not directly involved in the development of those applications. :exc:" -"`DeprecationWarning` messages are irrelevant to such users, making them " -"worry about an application that's actually working correctly and burdening " -"application developers with responding to these concerns." +"are not directly involved in the development of those " +"applications. :exc:`DeprecationWarning` messages are irrelevant to such " +"users, making them worry about an application that's actually working " +"correctly and burdening application developers with responding to these " +"concerns." msgstr "" #: ../../whatsnew/2.7.rst:158 @@ -248,8 +249,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:192 msgid "" -"Float-to-string and string-to-float conversions are correctly rounded. The :" -"func:`round` function is also now correctly rounded." +"Float-to-string and string-to-float conversions are correctly rounded. " +"The :func:`round` function is also now correctly rounded." msgstr "" #: ../../whatsnew/2.7.rst:194 @@ -287,8 +288,8 @@ msgid "" "Regular Python dictionaries iterate over key/value pairs in arbitrary order. " "Over the years, a number of authors have written alternative implementations " "that remember the order that the keys were originally inserted. Based on " -"the experiences from those implementations, 2.7 introduces a new :class:" -"`~collections.OrderedDict` class in the :mod:`collections` module." +"the experiences from those implementations, 2.7 introduces a " +"new :class:`~collections.OrderedDict` class in the :mod:`collections` module." msgstr "" #: ../../whatsnew/2.7.rst:222 @@ -440,9 +441,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:294 msgid "" -"The :meth:`~collections.somenamedtuple._asdict` method for :func:" -"`collections.namedtuple` now returns an ordered dictionary with the values " -"appearing in the same order as the underlying tuple indices." +"The :meth:`~collections.somenamedtuple._asdict` method " +"for :func:`collections.namedtuple` now returns an ordered dictionary with " +"the values appearing in the same order as the underlying tuple indices." msgstr "" #: ../../whatsnew/2.7.rst:298 @@ -531,14 +532,14 @@ msgstr "" #: ../../whatsnew/2.7.rst:355 msgid "" "This means Python now supports three different modules for parsing command-" -"line arguments: :mod:`getopt`, :mod:`optparse`, and :mod:`argparse`. The :" -"mod:`getopt` module closely resembles the C library's :c:func:`!getopt` " +"line arguments: :mod:`getopt`, :mod:`optparse`, and :mod:`argparse`. " +"The :mod:`getopt` module closely resembles the C library's :c:func:`!getopt` " "function, so it remains useful if you're writing a Python prototype that " "will eventually be rewritten in C. :mod:`optparse` becomes redundant, but " "there are no plans to remove it because there are many scripts still using " -"it, and there's no automated way to update these scripts. (Making the :mod:" -"`argparse` API consistent with :mod:`optparse`'s interface was discussed but " -"rejected as too messy and difficult.)" +"it, and there's no automated way to update these scripts. (Making " +"the :mod:`argparse` API consistent with :mod:`optparse`'s interface was " +"discussed but rejected as too messy and difficult.)" msgstr "" #: ../../whatsnew/2.7.rst:366 @@ -653,9 +654,9 @@ msgid "" "passing ``'*'``, 1 or more by passing ``'+'``, or an optional argument with " "``'?'``. A top-level parser can contain sub-parsers to define subcommands " "that have different sets of switches, as in ``svn commit``, ``svn " -"checkout``, etc. You can specify an argument's type as :class:`~argparse." -"FileType`, which will automatically open files for you and understands that " -"``'-'`` means standard input or output." +"checkout``, etc. You can specify an argument's type " +"as :class:`~argparse.FileType`, which will automatically open files for you " +"and understands that ``'-'`` means standard input or output." msgstr "" #: ../../whatsnew/2.7.rst:437 @@ -672,8 +673,8 @@ msgstr ":ref:`upgrading-optparse-code`" #: ../../whatsnew/2.7.rst:441 msgid "" -"Part of the Python documentation, describing how to convert code that uses :" -"mod:`optparse`." +"Part of the Python documentation, describing how to convert code that " +"uses :mod:`optparse`." msgstr "" #: ../../whatsnew/2.7.rst:444 @@ -700,10 +701,10 @@ msgstr "" msgid "" "All this flexibility can require a lot of configuration. You can write " "Python statements to create objects and set their properties, but a complex " -"set-up requires verbose but boring code. :mod:`logging` also supports a :" -"func:`~logging.config.fileConfig` function that parses a file, but the file " -"format doesn't support configuring filters, and it's messier to generate " -"programmatically." +"set-up requires verbose but boring code. :mod:`logging` also supports " +"a :func:`~logging.config.fileConfig` function that parses a file, but the " +"file format doesn't support configuring filters, and it's messier to " +"generate programmatically." msgstr "" #: ../../whatsnew/2.7.rst:462 @@ -779,8 +780,8 @@ msgstr "" msgid "" "The :class:`~logging.handlers.SysLogHandler` class now supports syslogging " "over TCP. The constructor has a *socktype* parameter giving the type of " -"socket to use, either :const:`socket.SOCK_DGRAM` for UDP or :const:`socket." -"SOCK_STREAM` for TCP. The default protocol remains UDP." +"socket to use, either :const:`socket.SOCK_DGRAM` for UDP " +"or :const:`socket.SOCK_STREAM` for TCP. The default protocol remains UDP." msgstr "" #: ../../whatsnew/2.7.rst:529 @@ -788,15 +789,16 @@ msgid "" ":class:`~logging.Logger` instances gained a :meth:`~logging.Logger.getChild` " "method that retrieves a descendant logger using a relative path. For " "example, once you retrieve a logger by doing ``log = getLogger('app')``, " -"calling ``log.getChild('network.listen')`` is equivalent to ``getLogger('app." -"network.listen')``." +"calling ``log.getChild('network.listen')`` is equivalent to " +"``getLogger('app.network.listen')``." msgstr "" #: ../../whatsnew/2.7.rst:535 msgid "" -"The :class:`~logging.LoggerAdapter` class gained an :meth:`~logging.Logger." -"isEnabledFor` method that takes a *level* and returns whether the underlying " -"logger would process a message of that level of importance." +"The :class:`~logging.LoggerAdapter` class gained " +"an :meth:`~logging.Logger.isEnabledFor` method that takes a *level* and " +"returns whether the underlying logger would process a message of that level " +"of importance." msgstr "" #: ../../whatsnew/2.7.rst:544 @@ -813,17 +815,18 @@ msgstr "" #: ../../whatsnew/2.7.rst:550 msgid "" -"The dictionary methods :meth:`~dict.keys`, :meth:`~dict.values`, and :meth:" -"`~dict.items` are different in Python 3.x. They return an object called a :" -"dfn:`view` instead of a fully materialized list." +"The dictionary methods :meth:`~dict.keys`, :meth:`~dict.values`, " +"and :meth:`~dict.items` are different in Python 3.x. They return an object " +"called a :dfn:`view` instead of a fully materialized list." msgstr "" #: ../../whatsnew/2.7.rst:554 msgid "" -"It's not possible to change the return values of :meth:`~dict.keys`, :meth:" -"`~dict.values`, and :meth:`~dict.items` in Python 2.7 because too much code " -"would break. Instead the 3.x versions were added under the new names :meth:" -"`!viewkeys`, :meth:`!viewvalues`, and :meth:`!viewitems`." +"It's not possible to change the return values " +"of :meth:`~dict.keys`, :meth:`~dict.values`, and :meth:`~dict.items` in " +"Python 2.7 because too much code would break. Instead the 3.x versions were " +"added under the new names :meth:`!viewkeys`, :meth:`!viewvalues`, " +"and :meth:`!viewitems`." msgstr "" #: ../../whatsnew/2.7.rst:562 @@ -909,8 +912,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:599 msgid "" "You can use the view methods in Python 2.x code, and the 2to3 converter will " -"change them to the standard :meth:`~dict.keys`, :meth:`~dict.values`, and :" -"meth:`~dict.items` methods." +"change them to the standard :meth:`~dict.keys`, :meth:`~dict.values`, " +"and :meth:`~dict.items` methods." msgstr "" #: ../../whatsnew/2.7.rst:605 @@ -919,8 +922,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:606 msgid "" -"PEP written by Guido van Rossum. Backported to 2.7 by Alexandre Vassalotti; :" -"issue:`1967`." +"PEP written by Guido van Rossum. Backported to 2.7 by Alexandre " +"Vassalotti; :issue:`1967`." msgstr "" #: ../../whatsnew/2.7.rst:611 @@ -1095,11 +1098,12 @@ msgstr "" msgid "" "Conversions between floating-point numbers and strings are now correctly " "rounded on most platforms. These conversions occur in many different " -"places: :func:`str` on floats and complex numbers; the :class:`float` and :" -"class:`complex` constructors; numeric formatting; serializing and " -"deserializing floats and complex numbers using the :mod:`marshal`, :mod:" -"`pickle` and :mod:`json` modules; parsing of float and imaginary literals in " -"Python code; and :class:`~decimal.Decimal`-to-float conversion." +"places: :func:`str` on floats and complex numbers; the :class:`float` " +"and :class:`complex` constructors; numeric formatting; serializing and " +"deserializing floats and complex numbers using " +"the :mod:`marshal`, :mod:`pickle` and :mod:`json` modules; parsing of float " +"and imaginary literals in Python code; and :class:`~decimal.Decimal`-to-" +"float conversion." msgstr "" #: ../../whatsnew/2.7.rst:741 @@ -1122,8 +1126,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:757 msgid "" -"Implemented by Eric Smith and Mark Dickinson, using David Gay's :file:`dtoa." -"c` library; :issue:`7117`." +"Implemented by Eric Smith and Mark Dickinson, using David " +"Gay's :file:`dtoa.c` library; :issue:`7117`." msgstr "" #: ../../whatsnew/2.7.rst:760 @@ -1234,9 +1238,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:818 msgid "" -"A low-level change: the :meth:`object.__format__` method now triggers a :exc:" -"`PendingDeprecationWarning` if it's passed a format string, because the :" -"meth:`!__format__` method for :class:`object` converts the object to a " +"A low-level change: the :meth:`object.__format__` method now triggers " +"a :exc:`PendingDeprecationWarning` if it's passed a format string, because " +"the :meth:`!__format__` method for :class:`object` converts the object to a " "string representation and formats that. Previously the method silently " "applied the format string to the string representation, but that could hide " "mistakes in Python code. If you're supplying formatting information such as " @@ -1289,15 +1293,15 @@ msgstr "" #: ../../whatsnew/2.7.rst:851 msgid "" "It's now possible for a subclass of the built-in :class:`!unicode` type to " -"override the :meth:`!__unicode__` method. (Implemented by Victor Stinner; :" -"issue:`1583863`.)" +"override the :meth:`!__unicode__` method. (Implemented by Victor " +"Stinner; :issue:`1583863`.)" msgstr "" #: ../../whatsnew/2.7.rst:855 msgid "" "The :class:`bytearray` type's :meth:`~bytearray.translate` method now " -"accepts ``None`` as its first argument. (Fixed by Georg Brandl; :issue:" -"`4759`.)" +"accepts ``None`` as its first argument. (Fixed by Georg " +"Brandl; :issue:`4759`.)" msgstr "" #: ../../whatsnew/2.7.rst:861 @@ -1320,8 +1324,8 @@ msgstr "" msgid "" "Two new encodings are now supported: \"cp720\", used primarily for Arabic " "text; and \"cp858\", a variant of CP 850 that adds the euro symbol. (CP720 " -"contributed by Alexander Belchenko and Amaury Forgeot d'Arc in :issue:" -"`1616979`; CP858 contributed by Tim Hatch in :issue:`8016`.)" +"contributed by Alexander Belchenko and Amaury Forgeot d'Arc " +"in :issue:`1616979`; CP858 contributed by Tim Hatch in :issue:`8016`.)" msgstr "" #: ../../whatsnew/2.7.rst:879 @@ -1330,14 +1334,14 @@ msgid "" "the :exc:`IOError` exception when trying to open a directory on POSIX " "platforms (noted by Jan Kaliszewski; :issue:`4764`), and now explicitly " "checks for and forbids writing to read-only file objects instead of trusting " -"the C library to catch and report the error (fixed by Stefan Krah; :issue:" -"`5677`)." +"the C library to catch and report the error (fixed by Stefan " +"Krah; :issue:`5677`)." msgstr "" #: ../../whatsnew/2.7.rst:886 msgid "" -"The Python tokenizer now translates line endings itself, so the :func:" -"`compile` built-in function now accepts code using any line-ending " +"The Python tokenizer now translates line endings itself, so " +"the :func:`compile` built-in function now accepts code using any line-ending " "convention. Additionally, it no longer requires that the code end in a " "newline." msgstr "" @@ -1353,15 +1357,15 @@ msgstr "" #: ../../whatsnew/2.7.rst:896 msgid "" "It's now possible to create weak references to old-style class objects. New-" -"style classes were always weak-referenceable. (Fixed by Antoine Pitrou; :" -"issue:`8268`.)" +"style classes were always weak-referenceable. (Fixed by Antoine " +"Pitrou; :issue:`8268`.)" msgstr "" #: ../../whatsnew/2.7.rst:900 msgid "" "When a module object is garbage-collected, the module's dictionary is now " -"only cleared if no one else is holding a reference to the dictionary (:issue:" -"`7140`)." +"only cleared if no one else is holding a reference to the dictionary " +"(:issue:`7140`)." msgstr "" #: ../../whatsnew/2.7.rst:909 @@ -1399,8 +1403,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:934 msgid "" "A new opcode was added to perform the initial setup for :keyword:`with` " -"statements, looking up the :meth:`~object.__enter__` and :meth:`~object." -"__exit__` methods. (Contributed by Benjamin Peterson.)" +"statements, looking up the :meth:`~object.__enter__` " +"and :meth:`~object.__exit__` methods. (Contributed by Benjamin Peterson.)" msgstr "" #: ../../whatsnew/2.7.rst:938 @@ -1490,8 +1494,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:999 msgid "" "List comprehensions with an ``if`` condition are compiled into faster " -"bytecode. (Patch by Antoine Pitrou, back-ported to 2.7 by Jeffrey Yasskin; :" -"issue:`4715`.)" +"bytecode. (Patch by Antoine Pitrou, back-ported to 2.7 by Jeffrey " +"Yasskin; :issue:`4715`.)" msgstr "" #: ../../whatsnew/2.7.rst:1003 @@ -1520,8 +1524,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:1020 msgid "" "The :mod:`!cPickle` module now special-cases dictionaries, nearly halving " -"the time required to pickle them. (Contributed by Collin Winter; :issue:" -"`5670`.)" +"the time required to pickle them. (Contributed by Collin " +"Winter; :issue:`5670`.)" msgstr "" #: ../../whatsnew/2.7.rst:1027 @@ -1543,8 +1547,8 @@ msgid "" "feature for skipping modules. The constructor now takes an iterable " "containing glob-style patterns such as ``django.*``; the debugger will not " "step into stack frames from a module that matches one of these patterns. " -"(Contributed by Maru Newby after a suggestion by Senthil Kumaran; :issue:" -"`5142`.)" +"(Contributed by Maru Newby after a suggestion by Senthil " +"Kumaran; :issue:`5142`.)" msgstr "" #: ../../whatsnew/2.7.rst:1043 @@ -1586,7 +1590,7 @@ msgid "" ">>> for letter in 'here is a sample of english text':\n" "... c[letter] += 1\n" "...\n" -">>> c \n" +">>> c\n" "Counter({' ': 6, 'e': 5, 's': 3, 'a': 2, 'i': 2, 'h': 2,\n" "'l': 2, 't': 2, 'g': 1, 'f': 1, 'm': 1, 'o': 1, 'n': 1,\n" "'p': 1, 'r': 1, 'x': 1})\n" @@ -1600,7 +1604,7 @@ msgstr "" ">>> for letter in 'here is a sample of english text':\n" "... c[letter] += 1\n" "...\n" -">>> c \n" +">>> c\n" "Counter({' ': 6, 'e': 5, 's': 3, 'a': 2, 'i': 2, 'h': 2,\n" "'l': 2, 't': 2, 'g': 1, 'f': 1, 'm': 1, 'o': 1, 'n': 1,\n" "'p': 1, 'r': 1, 'x': 1})\n" @@ -1611,13 +1615,13 @@ msgstr "" #: ../../whatsnew/2.7.rst:1081 msgid "" -"There are three additional :class:`~collections.Counter` methods. :meth:" -"`~collections.Counter.most_common` returns the N most common elements and " -"their counts. :meth:`~collections.Counter.elements` returns an iterator " -"over the contained elements, repeating each element as many times as its " -"count. :meth:`~collections.Counter.subtract` takes an iterable and subtracts " -"one for each element instead of adding; if the argument is a dictionary or " -"another :class:`Counter`, the counts are subtracted. ::" +"There are three additional :class:`~collections.Counter` " +"methods. :meth:`~collections.Counter.most_common` returns the N most common " +"elements and their counts. :meth:`~collections.Counter.elements` returns an " +"iterator over the contained elements, repeating each element as many times " +"as its count. :meth:`~collections.Counter.subtract` takes an iterable and " +"subtracts one for each element instead of adding; if the argument is a " +"dictionary or another :class:`Counter`, the counts are subtracted. ::" msgstr "" #: ../../whatsnew/2.7.rst:1091 @@ -1648,13 +1652,13 @@ msgstr "" #: ../../whatsnew/2.7.rst:1111 msgid "" -"New method: The :class:`~collections.deque` data type now has a :meth:" -"`~collections.deque.count` method that returns the number of contained " -"elements equal to the supplied argument *x*, and a :meth:`~collections.deque." -"reverse` method that reverses the elements of the deque in-place. :class:" -"`~collections.deque` also exposes its maximum length as the read-only :attr:" -"`~collections.deque.maxlen` attribute. (Both features added by Raymond " -"Hettinger.)" +"New method: The :class:`~collections.deque` data type now has " +"a :meth:`~collections.deque.count` method that returns the number of " +"contained elements equal to the supplied argument *x*, and " +"a :meth:`~collections.deque.reverse` method that reverses the elements of " +"the deque in-place. :class:`~collections.deque` also exposes its maximum " +"length as the read-only :attr:`~collections.deque.maxlen` attribute. (Both " +"features added by Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.7.rst:1119 @@ -1732,28 +1736,30 @@ msgstr "" #: ../../whatsnew/2.7.rst:1174 msgid "" "The :mod:`ctypes` module now always converts ``None`` to a C ``NULL`` " -"pointer for arguments declared as pointers. (Changed by Thomas Heller; :" -"issue:`4606`.) The underlying `libffi library <https://sourceware.org/" -"libffi/>`__ has been updated to version 3.0.9, containing various fixes for " -"different platforms. (Updated by Matthias Klose; :issue:`8142`.)" +"pointer for arguments declared as pointers. (Changed by Thomas " +"Heller; :issue:`4606`.) The underlying `libffi library <https://" +"sourceware.org/libffi/>`__ has been updated to version 3.0.9, containing " +"various fixes for different platforms. (Updated by Matthias " +"Klose; :issue:`8142`.)" msgstr "" #: ../../whatsnew/2.7.rst:1181 msgid "" "New method: the :mod:`datetime` module's :class:`~datetime.timedelta` class " "gained a :meth:`~datetime.timedelta.total_seconds` method that returns the " -"number of seconds in the duration. (Contributed by Brian Quinlan; :issue:" -"`5788`.)" +"number of seconds in the duration. (Contributed by Brian " +"Quinlan; :issue:`5788`.)" msgstr "" #: ../../whatsnew/2.7.rst:1185 msgid "" -"New method: the :class:`~decimal.Decimal` class gained a :meth:`~decimal." -"Decimal.from_float` class method that performs an exact conversion of a " -"floating-point number to a :class:`!Decimal`. This exact conversion strives " -"for the closest decimal approximation to the floating-point representation's " -"value; the resulting decimal value will therefore still include the " -"inaccuracy, if any. For example, ``Decimal.from_float(0.1)`` returns " +"New method: the :class:`~decimal.Decimal` class gained " +"a :meth:`~decimal.Decimal.from_float` class method that performs an exact " +"conversion of a floating-point number to a :class:`!Decimal`. This exact " +"conversion strives for the closest decimal approximation to the floating-" +"point representation's value; the resulting decimal value will therefore " +"still include the inaccuracy, if any. For example, " +"``Decimal.from_float(0.1)`` returns " "``Decimal('0.1000000000000000055511151231257827021181583404541015625')``. " "(Implemented by Raymond Hettinger; :issue:`4796`.)" msgstr "" @@ -1774,32 +1780,33 @@ msgstr "" msgid "" "The constructor for :class:`~decimal.Decimal` now accepts floating-point " "numbers (added by Raymond Hettinger; :issue:`8257`) and non-European Unicode " -"characters such as Arabic-Indic digits (contributed by Mark Dickinson; :" -"issue:`6595`)." +"characters such as Arabic-Indic digits (contributed by Mark " +"Dickinson; :issue:`6595`)." msgstr "" #: ../../whatsnew/2.7.rst:1210 msgid "" "Most of the methods of the :class:`~decimal.Context` class now accept " "integers as well as :class:`~decimal.Decimal` instances; the only exceptions " -"are the :meth:`~decimal.Context.canonical` and :meth:`~decimal.Context." -"is_canonical` methods. (Patch by Juan José Conti; :issue:`7633`.)" +"are the :meth:`~decimal.Context.canonical` " +"and :meth:`~decimal.Context.is_canonical` methods. (Patch by Juan José " +"Conti; :issue:`7633`.)" msgstr "" #: ../../whatsnew/2.7.rst:1215 msgid "" -"When using :class:`~decimal.Decimal` instances with a string's :meth:`~str." -"format` method, the default alignment was previously left-alignment. This " -"has been changed to right-alignment, which is more sensible for numeric " -"types. (Changed by Mark Dickinson; :issue:`6857`.)" +"When using :class:`~decimal.Decimal` instances with a " +"string's :meth:`~str.format` method, the default alignment was previously " +"left-alignment. This has been changed to right-alignment, which is more " +"sensible for numeric types. (Changed by Mark Dickinson; :issue:`6857`.)" msgstr "" #: ../../whatsnew/2.7.rst:1220 ../../whatsnew/2.7.rst:2484 msgid "" -"Comparisons involving a signaling NaN value (or ``sNAN``) now signal :const:" -"`~decimal.InvalidOperation` instead of silently returning a true or false " -"value depending on the comparison operator. Quiet NaN values (or ``NaN``) " -"are now hashable. (Fixed by Mark Dickinson; :issue:`7279`.)" +"Comparisons involving a signaling NaN value (or ``sNAN``) now " +"signal :const:`~decimal.InvalidOperation` instead of silently returning a " +"true or false value depending on the comparison operator. Quiet NaN values " +"(or ``NaN``) are now hashable. (Fixed by Mark Dickinson; :issue:`7279`.)" msgstr "" #: ../../whatsnew/2.7.rst:1226 @@ -1829,16 +1836,16 @@ msgstr "" msgid "" "The :mod:`email` module's :class:`~email.message.Message` class will now " "accept a Unicode-valued payload, automatically converting the payload to the " -"encoding specified by :attr:`!output_charset`. (Added by R. David Murray; :" -"issue:`1368247`.)" +"encoding specified by :attr:`!output_charset`. (Added by R. David " +"Murray; :issue:`1368247`.)" msgstr "" #: ../../whatsnew/2.7.rst:1247 msgid "" -"The :class:`~fractions.Fraction` class now accepts a single float or :class:" -"`~decimal.Decimal` instance, or two rational numbers, as arguments to its " -"constructor. (Implemented by Mark Dickinson; rationals added in :issue:" -"`5812`, and float/decimal in :issue:`8294`.)" +"The :class:`~fractions.Fraction` class now accepts a single float " +"or :class:`~decimal.Decimal` instance, or two rational numbers, as arguments " +"to its constructor. (Implemented by Mark Dickinson; rationals added " +"in :issue:`5812`, and float/decimal in :issue:`8294`.)" msgstr "" #: ../../whatsnew/2.7.rst:1253 @@ -1852,36 +1859,37 @@ msgstr "" msgid "" "New class: :class:`~ftplib.FTP_TLS` in the :mod:`ftplib` module provides " "secure FTP connections using TLS encapsulation of authentication as well as " -"subsequent control and data transfers. (Contributed by Giampaolo Rodola; :" -"issue:`2054`.)" +"subsequent control and data transfers. (Contributed by Giampaolo " +"Rodola; :issue:`2054`.)" msgstr "" #: ../../whatsnew/2.7.rst:1266 msgid "" "The :meth:`~ftplib.FTP.storbinary` method for binary uploads can now restart " -"uploads thanks to an added *rest* parameter (patch by Pablo Mouzo; :issue:" -"`6845`.)" +"uploads thanks to an added *rest* parameter (patch by Pablo " +"Mouzo; :issue:`6845`.)" msgstr "" #: ../../whatsnew/2.7.rst:1270 msgid "" -"New class decorator: :func:`~functools.total_ordering` in the :mod:" -"`functools` module takes a class that defines an :meth:`~object.__eq__` " -"method and one of :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:" -"`~object.__gt__`, or :meth:`~object.__ge__`, and generates the missing " -"comparison methods. Since the :meth:`!__cmp__` method is being deprecated " -"in Python 3.x, this decorator makes it easier to define ordered classes. " -"(Added by Raymond Hettinger; :issue:`5479`.)" +"New class decorator: :func:`~functools.total_ordering` in " +"the :mod:`functools` module takes a class that defines " +"an :meth:`~object.__eq__` method and one " +"of :meth:`~object.__lt__`, :meth:`~object.__le__`, :meth:`~object.__gt__`, " +"or :meth:`~object.__ge__`, and generates the missing comparison methods. " +"Since the :meth:`!__cmp__` method is being deprecated in Python 3.x, this " +"decorator makes it easier to define ordered classes. (Added by Raymond " +"Hettinger; :issue:`5479`.)" msgstr "" #: ../../whatsnew/2.7.rst:1278 msgid "" "New function: :func:`~functools.cmp_to_key` will take an old-style " "comparison function that expects two arguments and return a new callable " -"that can be used as the *key* parameter to functions such as :func:" -"`sorted`, :func:`min` and :func:`max`, etc. The primary intended use is to " -"help with making code compatible with Python 3.x. (Added by Raymond " -"Hettinger.)" +"that can be used as the *key* parameter to functions such " +"as :func:`sorted`, :func:`min` and :func:`max`, etc. The primary intended " +"use is to help with making code compatible with Python 3.x. (Added by " +"Raymond Hettinger.)" msgstr "" #: ../../whatsnew/2.7.rst:1285 @@ -1895,12 +1903,12 @@ msgstr "" msgid "" "The :mod:`gzip` module's :class:`~gzip.GzipFile` now supports the context " "management protocol, so you can write ``with gzip.GzipFile(...) as f:`` " -"(contributed by Hagen Fürstenau; :issue:`3860`), and it now implements the :" -"class:`io.BufferedIOBase` ABC, so you can wrap it with :class:`io." -"BufferedReader` for faster processing (contributed by Nir Aides; :issue:" -"`7471`). It's also now possible to override the modification time recorded " -"in a gzipped file by providing an optional timestamp to the constructor. " -"(Contributed by Jacques Frechet; :issue:`4272`.)" +"(contributed by Hagen Fürstenau; :issue:`3860`), and it now implements " +"the :class:`io.BufferedIOBase` ABC, so you can wrap it " +"with :class:`io.BufferedReader` for faster processing (contributed by Nir " +"Aides; :issue:`7471`). It's also now possible to override the modification " +"time recorded in a gzipped file by providing an optional timestamp to the " +"constructor. (Contributed by Jacques Frechet; :issue:`4272`.)" msgstr "" #: ../../whatsnew/2.7.rst:1299 @@ -1920,18 +1928,19 @@ msgstr "" #: ../../whatsnew/2.7.rst:1309 msgid "" -"The default :class:`~http.client.HTTPResponse` class used by the :mod:" -"`httplib <http>` module now supports buffering, resulting in much faster " -"reading of HTTP responses. (Contributed by Kristján Valur Jónsson; :issue:" -"`4879`.)" +"The default :class:`~http.client.HTTPResponse` class used by " +"the :mod:`httplib <http>` module now supports buffering, resulting in much " +"faster reading of HTTP responses. (Contributed by Kristján Valur " +"Jónsson; :issue:`4879`.)" msgstr "" #: ../../whatsnew/2.7.rst:1313 msgid "" -"The :class:`~http.client.HTTPConnection` and :class:`~http.client." -"HTTPSConnection` classes now support a *source_address* parameter, a " -"``(host, port)`` 2-tuple giving the source address that will be used for the " -"connection. (Contributed by Eldon Ziegler; :issue:`3972`.)" +"The :class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` classes now support a " +"*source_address* parameter, a ``(host, port)`` 2-tuple giving the source " +"address that will be used for the connection. (Contributed by Eldon " +"Ziegler; :issue:`3972`.)" msgstr "" #: ../../whatsnew/2.7.rst:1318 @@ -1986,8 +1995,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:1353 msgid "" -"One minor resulting change: the :class:`io.TextIOBase` class now has an :" -"attr:`~io.TextIOBase.errors` attribute giving the error setting used for " +"One minor resulting change: the :class:`io.TextIOBase` class now has " +"an :attr:`~io.TextIOBase.errors` attribute giving the error setting used for " "encoding and decoding errors (one of ``'strict'``, ``'replace'``, " "``'ignore'``)." msgstr "" @@ -1995,10 +2004,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:1358 msgid "" "The :class:`io.FileIO` class now raises an :exc:`OSError` when passed an " -"invalid file descriptor. (Implemented by Benjamin Peterson; :issue:" -"`4991`.) The :meth:`~io.IOBase.truncate` method now preserves the file " -"position; previously it would change the file position to the end of the new " -"file. (Fixed by Pascal Chambon; :issue:`6939`.)" +"invalid file descriptor. (Implemented by Benjamin " +"Peterson; :issue:`4991`.) The :meth:`~io.IOBase.truncate` method now " +"preserves the file position; previously it would change the file position to " +"the end of the new file. (Fixed by Pascal Chambon; :issue:`6939`.)" msgstr "" #: ../../whatsnew/2.7.rst:1364 @@ -2039,9 +2048,9 @@ msgstr "" msgid "" "The :func:`itertools.count` function now has a *step* argument that allows " "incrementing by values other than 1. :func:`~itertools.count` also now " -"allows keyword arguments, and using non-integer values such as floats or :" -"class:`~decimal.Decimal` instances. (Implemented by Raymond Hettinger; :" -"issue:`5032`.)" +"allows keyword arguments, and using non-integer values such as floats " +"or :class:`~decimal.Decimal` instances. (Implemented by Raymond " +"Hettinger; :issue:`5032`.)" msgstr "" #: ../../whatsnew/2.7.rst:1391 @@ -2078,13 +2087,13 @@ msgstr "" #: ../../whatsnew/2.7.rst:1412 msgid "" -"New functions: the :mod:`math` module gained :func:`~math.erf` and :func:" -"`~math.erfc` for the error function and the complementary error function, :" -"func:`~math.expm1` which computes ``e**x - 1`` with more precision than " -"using :func:`~math.exp` and subtracting 1, :func:`~math.gamma` for the Gamma " -"function, and :func:`~math.lgamma` for the natural log of the Gamma " -"function. (Contributed by Mark Dickinson and nirinA raseliarison; :issue:" -"`3366`.)" +"New functions: the :mod:`math` module gained :func:`~math.erf` " +"and :func:`~math.erfc` for the error function and the complementary error " +"function, :func:`~math.expm1` which computes ``e**x - 1`` with more " +"precision than using :func:`~math.exp` and subtracting " +"1, :func:`~math.gamma` for the Gamma function, and :func:`~math.lgamma` for " +"the natural log of the Gamma function. (Contributed by Mark Dickinson and " +"nirinA raseliarison; :issue:`3366`.)" msgstr "" #: ../../whatsnew/2.7.rst:1420 @@ -2113,13 +2122,14 @@ msgstr "" #: ../../whatsnew/2.7.rst:1437 msgid "" -"New functions: the :mod:`os` module wraps the following POSIX system calls: :" -"func:`~os.getresgid` and :func:`~os.getresuid`, which return the real, " -"effective, and saved GIDs and UIDs; :func:`~os.setresgid` and :func:`~os." -"setresuid`, which set real, effective, and saved GIDs and UIDs to new " -"values; :func:`~os.initgroups`, which initialize the group access list for " -"the current process. (GID/UID functions contributed by Travis H.; :issue:" -"`6508`. Support for initgroups added by Jean-Paul Calderone; :issue:`7333`.)" +"New functions: the :mod:`os` module wraps the following POSIX system " +"calls: :func:`~os.getresgid` and :func:`~os.getresuid`, which return the " +"real, effective, and saved GIDs and UIDs; :func:`~os.setresgid` " +"and :func:`~os.setresuid`, which set real, effective, and saved GIDs and " +"UIDs to new values; :func:`~os.initgroups`, which initialize the group " +"access list for the current process. (GID/UID functions contributed by " +"Travis H.; :issue:`6508`. Support for initgroups added by Jean-Paul " +"Calderone; :issue:`7333`.)" msgstr "" #: ../../whatsnew/2.7.rst:1447 @@ -2131,11 +2141,12 @@ msgstr "" #: ../../whatsnew/2.7.rst:1451 msgid "" -"In the :mod:`os.path` module, the :func:`~os.path.normpath` and :func:`~os." -"path.abspath` functions now preserve Unicode; if their input path is a " -"Unicode string, the return value is also a Unicode string. (:meth:`~os.path." -"normpath` fixed by Matt Giuca in :issue:`5827`; :meth:`~os.path.abspath` " -"fixed by Ezio Melotti in :issue:`3426`.)" +"In the :mod:`os.path` module, the :func:`~os.path.normpath` " +"and :func:`~os.path.abspath` functions now preserve Unicode; if their input " +"path is a Unicode string, the return value is also a Unicode string. " +"(:meth:`~os.path.normpath` fixed by Matt Giuca " +"in :issue:`5827`; :meth:`~os.path.abspath` fixed by Ezio Melotti " +"in :issue:`3426`.)" msgstr "" #: ../../whatsnew/2.7.rst:1457 @@ -2147,24 +2158,26 @@ msgstr "" #: ../../whatsnew/2.7.rst:1461 msgid "" -"The :mod:`re` module's :func:`~re.split`, :func:`~re.sub`, and :func:`~re." -"subn` now accept an optional *flags* argument, for consistency with the " -"other functions in the module. (Added by Gregory P. Smith.)" +"The :mod:`re` module's :func:`~re.split`, :func:`~re.sub`, " +"and :func:`~re.subn` now accept an optional *flags* argument, for " +"consistency with the other functions in the module. (Added by Gregory P. " +"Smith.)" msgstr "" #: ../../whatsnew/2.7.rst:1465 msgid "" "New function: :func:`~runpy.run_path` in the :mod:`runpy` module will " "execute the code at a provided *path* argument. *path* can be the path of a " -"Python source file (:file:`example.py`), a compiled bytecode file (:file:" -"`example.pyc`), a directory (:file:`./package/`), or a zip archive (:file:" -"`example.zip`). If a directory or zip path is provided, it will be added to " -"the front of ``sys.path`` and the module :mod:`__main__` will be imported. " -"It's expected that the directory or zip contains a :file:`__main__.py`; if " -"it doesn't, some other :file:`__main__.py` might be imported from a location " -"later in ``sys.path``. This makes more of the machinery of :mod:`runpy` " -"available to scripts that want to mimic the way Python's command line " -"processes an explicit path name. (Added by Nick Coghlan; :issue:`6816`.)" +"Python source file (:file:`example.py`), a compiled bytecode file " +"(:file:`example.pyc`), a directory (:file:`./package/`), or a zip archive " +"(:file:`example.zip`). If a directory or zip path is provided, it will be " +"added to the front of ``sys.path`` and the module :mod:`__main__` will be " +"imported. It's expected that the directory or zip contains " +"a :file:`__main__.py`; if it doesn't, some other :file:`__main__.py` might " +"be imported from a location later in ``sys.path``. This makes more of the " +"machinery of :mod:`runpy` available to scripts that want to mimic the way " +"Python's command line processes an explicit path name. (Added by Nick " +"Coghlan; :issue:`6816`.)" msgstr "" #: ../../whatsnew/2.7.rst:1479 @@ -2188,27 +2201,28 @@ msgstr "" msgid "" "The :mod:`signal` module no longer re-installs the signal handler unless " "this is truly necessary, which fixes a bug that could make it impossible to " -"catch the EINTR signal robustly. (Fixed by Charles-Francois Natali; :issue:" -"`8354`.)" +"catch the EINTR signal robustly. (Fixed by Charles-Francois " +"Natali; :issue:`8354`.)" msgstr "" #: ../../whatsnew/2.7.rst:1495 msgid "" "New functions: in the :mod:`site` module, three new functions return various " "site- and user-specific paths. :func:`~site.getsitepackages` returns a list " -"containing all global site-packages directories, :func:`~site." -"getusersitepackages` returns the path of the user's site-packages directory, " -"and :func:`~site.getuserbase` returns the value of the :data:`~site." -"USER_BASE` environment variable, giving the path to a directory that can be " -"used to store data. (Contributed by Tarek Ziadé; :issue:`6693`.)" +"containing all global site-packages " +"directories, :func:`~site.getusersitepackages` returns the path of the " +"user's site-packages directory, and :func:`~site.getuserbase` returns the " +"value of the :data:`~site.USER_BASE` environment variable, giving the path " +"to a directory that can be used to store data. (Contributed by Tarek " +"Ziadé; :issue:`6693`.)" msgstr "" #: ../../whatsnew/2.7.rst:1506 msgid "" -"The :mod:`site` module now reports exceptions occurring when the :mod:" -"`sitecustomize` module is imported, and will no longer catch and swallow " -"the :exc:`KeyboardInterrupt` exception. (Fixed by Victor Stinner; :issue:" -"`3137`.)" +"The :mod:`site` module now reports exceptions occurring when " +"the :mod:`sitecustomize` module is imported, and will no longer catch and " +"swallow the :exc:`KeyboardInterrupt` exception. (Fixed by Victor " +"Stinner; :issue:`3137`.)" msgstr "" #: ../../whatsnew/2.7.rst:1511 @@ -2220,25 +2234,27 @@ msgstr "" #: ../../whatsnew/2.7.rst:1516 msgid "" -"The :meth:`~socket.socket.recv_into` and :meth:`~socket.socket." -"recvfrom_into` methods will now write into objects that support the buffer " -"API, most usefully the :class:`bytearray` and :class:`memoryview` objects. " -"(Implemented by Antoine Pitrou; :issue:`8104`.)" +"The :meth:`~socket.socket.recv_into` " +"and :meth:`~socket.socket.recvfrom_into` methods will now write into objects " +"that support the buffer API, most usefully the :class:`bytearray` " +"and :class:`memoryview` objects. (Implemented by Antoine " +"Pitrou; :issue:`8104`.)" msgstr "" #: ../../whatsnew/2.7.rst:1521 msgid "" -"The :mod:`SocketServer <socketserver>` module's :class:`~socketserver." -"TCPServer` class now supports socket timeouts and disabling the Nagle " -"algorithm. The :attr:`!disable_nagle_algorithm` class attribute defaults to " -"``False``; if overridden to be true, new request connections will have the " -"TCP_NODELAY option set to prevent buffering many small sends into a single " -"TCP packet. The :attr:`~socketserver.BaseServer.timeout` class attribute can " -"hold a timeout in seconds that will be applied to the request socket; if no " -"request is received within that time, :meth:`~socketserver.BaseServer." -"handle_timeout` will be called and :meth:`~socketserver.BaseServer." -"handle_request` will return. (Contributed by Kristján Valur Jónsson; :issue:" -"`6192` and :issue:`6267`.)" +"The :mod:`SocketServer <socketserver>` " +"module's :class:`~socketserver.TCPServer` class now supports socket timeouts " +"and disabling the Nagle algorithm. The :attr:`!disable_nagle_algorithm` " +"class attribute defaults to ``False``; if overridden to be true, new request " +"connections will have the TCP_NODELAY option set to prevent buffering many " +"small sends into a single TCP packet. " +"The :attr:`~socketserver.BaseServer.timeout` class attribute can hold a " +"timeout in seconds that will be applied to the request socket; if no request " +"is received within that " +"time, :meth:`~socketserver.BaseServer.handle_timeout` will be called " +"and :meth:`~socketserver.BaseServer.handle_request` will return. " +"(Contributed by Kristján Valur Jónsson; :issue:`6192` and :issue:`6267`.)" msgstr "" #: ../../whatsnew/2.7.rst:1533 @@ -2247,18 +2263,19 @@ msgid "" "of the `pysqlite package <https://github.com/ghaering/pysqlite>`__. Version " "2.6.0 includes a number of bugfixes, and adds the ability to load SQLite " "extensions from shared libraries. Call the ``enable_load_extension(True)`` " -"method to enable extensions, and then call :meth:`~sqlite3.Connection." -"load_extension` to load a particular shared library. (Updated by Gerhard " -"Häring.)" +"method to enable extensions, and then " +"call :meth:`~sqlite3.Connection.load_extension` to load a particular shared " +"library. (Updated by Gerhard Häring.)" msgstr "" #: ../../whatsnew/2.7.rst:1540 msgid "" "The :mod:`ssl` module's :class:`~ssl.SSLSocket` objects now support the " -"buffer API, which fixed a test suite failure (fix by Antoine Pitrou; :issue:" -"`7133`) and automatically set OpenSSL's :c:macro:`!SSL_MODE_AUTO_RETRY`, " -"which will prevent an error code being returned from :meth:`recv` operations " -"that trigger an SSL renegotiation (fix by Antoine Pitrou; :issue:`8222`)." +"buffer API, which fixed a test suite failure (fix by Antoine " +"Pitrou; :issue:`7133`) and automatically set OpenSSL's :c:macro:`!" +"SSL_MODE_AUTO_RETRY`, which will prevent an error code being returned " +"from :meth:`recv` operations that trigger an SSL renegotiation (fix by " +"Antoine Pitrou; :issue:`8222`)." msgstr "" #: ../../whatsnew/2.7.rst:1547 @@ -2280,10 +2297,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:1560 msgid "" -"The version of OpenSSL being used is now available as the module attributes :" -"const:`ssl.OPENSSL_VERSION` (a string), :const:`ssl.OPENSSL_VERSION_INFO` (a " -"5-tuple), and :const:`ssl.OPENSSL_VERSION_NUMBER` (an integer). (Added by " -"Antoine Pitrou; :issue:`8321`.)" +"The version of OpenSSL being used is now available as the module " +"attributes :const:`ssl.OPENSSL_VERSION` (a " +"string), :const:`ssl.OPENSSL_VERSION_INFO` (a 5-tuple), " +"and :const:`ssl.OPENSSL_VERSION_NUMBER` (an integer). (Added by Antoine " +"Pitrou; :issue:`8321`.)" msgstr "" #: ../../whatsnew/2.7.rst:1566 @@ -2299,10 +2317,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:1575 msgid "" -"New function: the :mod:`subprocess` module's :func:`~subprocess." -"check_output` runs a command with a specified set of arguments and returns " -"the command's output as a string when the command runs without error, or " -"raises a :exc:`~subprocess.CalledProcessError` exception otherwise." +"New function: the :mod:`subprocess` " +"module's :func:`~subprocess.check_output` runs a command with a specified " +"set of arguments and returns the command's output as a string when the " +"command runs without error, or raises " +"a :exc:`~subprocess.CalledProcessError` exception otherwise." msgstr "" #: ../../whatsnew/2.7.rst:1582 @@ -2330,10 +2349,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:1596 msgid "" -"New function: :func:`~symtable.Symbol.is_declared_global` in the :mod:" -"`symtable` module returns true for variables that are explicitly declared to " -"be global, false for ones that are implicitly global. (Contributed by Jeremy " -"Hylton.)" +"New function: :func:`~symtable.Symbol.is_declared_global` in " +"the :mod:`symtable` module returns true for variables that are explicitly " +"declared to be global, false for ones that are implicitly global. " +"(Contributed by Jeremy Hylton.)" msgstr "" #: ../../whatsnew/2.7.rst:1601 ../../whatsnew/2.7.rst:2500 @@ -2353,8 +2372,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:1610 msgid "" ":func:`sys.getwindowsversion` also returns a named tuple, with attributes " -"named :attr:`!major`, :attr:`!minor`, :attr:`!build`, :attr:`!platform`, :" -"attr:`!service_pack`, :attr:`!service_pack_major`, :attr:`!" +"named :attr:`!major`, :attr:`!minor`, :attr:`!build`, :attr:`!" +"platform`, :attr:`!service_pack`, :attr:`!service_pack_major`, :attr:`!" "service_pack_minor`, :attr:`!suite_mask`, and :attr:`!product_type`. " "(Contributed by Brian Curtin; :issue:`7766`.)" msgstr "" @@ -2379,8 +2398,8 @@ msgid "" "file will be excluded from the resulting archive. This is more powerful " "than the existing *exclude* argument, which has therefore been deprecated. " "(Added by Lars Gustäbel; :issue:`6856`.) The :class:`~tarfile.TarFile` class " -"also now supports the context management protocol. (Added by Lars Gustäbel; :" -"issue:`7232`.)" +"also now supports the context management protocol. (Added by Lars " +"Gustäbel; :issue:`7232`.)" msgstr "" #: ../../whatsnew/2.7.rst:1636 @@ -2397,10 +2416,10 @@ msgstr "" msgid "" "The Unicode database provided by the :mod:`unicodedata` module is now used " "internally to determine which characters are numeric, whitespace, or " -"represent line breaks. The database also includes information from the :" -"file:`Unihan.txt` data file (patch by Anders Chrigström and Amaury Forgeot " -"d'Arc; :issue:`1571184`) and has been updated to version 5.2.0 (updated by " -"Florent Xicluna; :issue:`8024`)." +"represent line breaks. The database also includes information from " +"the :file:`Unihan.txt` data file (patch by Anders Chrigström and Amaury " +"Forgeot d'Arc; :issue:`1571184`) and has been updated to version 5.2.0 " +"(updated by Florent Xicluna; :issue:`8024`)." msgstr "" #: ../../whatsnew/2.7.rst:1651 ../../whatsnew/2.7.rst:2512 @@ -2440,8 +2459,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:1678 msgid "" "The :mod:`urlparse <urllib.parse>` module also supports IPv6 literal " -"addresses as defined by :rfc:`2732` (contributed by Senthil Kumaran; :issue:" -"`2987`)." +"addresses as defined by :rfc:`2732` (contributed by Senthil " +"Kumaran; :issue:`2987`)." msgstr "" #: ../../whatsnew/2.7.rst:1681 @@ -2470,13 +2489,13 @@ msgstr "" #: ../../whatsnew/2.7.rst:1700 msgid "" -"The XML-RPC client and server, provided by the :mod:`xmlrpclib <xmlrpc." -"client>` and :mod:`SimpleXMLRPCServer <xmlrpc.server>` modules, have " +"The XML-RPC client and server, provided by the :mod:`xmlrpclib " +"<xmlrpc.client>` and :mod:`SimpleXMLRPCServer <xmlrpc.server>` modules, have " "improved performance by supporting HTTP/1.1 keep-alive and by optionally " "using gzip encoding to compress the XML being exchanged. The gzip " -"compression is controlled by the :attr:`!encode_threshold` attribute of :" -"class:`~xmlrpc.server.SimpleXMLRPCRequestHandler`, which contains a size in " -"bytes; responses larger than this will be compressed. (Contributed by " +"compression is controlled by the :attr:`!encode_threshold` attribute " +"of :class:`~xmlrpc.server.SimpleXMLRPCRequestHandler`, which contains a size " +"in bytes; responses larger than this will be compressed. (Contributed by " "Kristján Valur Jónsson; :issue:`6267`.)" msgstr "" @@ -2491,9 +2510,9 @@ msgstr "" msgid "" ":mod:`zipfile` now also supports archiving empty directories and extracts " "them correctly. (Fixed by Kuba Wieczorek; :issue:`4710`.) Reading files out " -"of an archive is faster, and interleaving :meth:`read() <io.BufferedIOBase." -"read>` and :meth:`readline() <io.IOBase.readline>` now works correctly. " -"(Contributed by Nir Aides; :issue:`7610`.)" +"of an archive is faster, and interleaving :meth:`read() " +"<io.BufferedIOBase.read>` and :meth:`readline() <io.IOBase.readline>` now " +"works correctly. (Contributed by Nir Aides; :issue:`7610`.)" msgstr "" #: ../../whatsnew/2.7.rst:1720 @@ -2522,8 +2541,8 @@ msgid "" "useful for implementers of Python interpreters and to users who wish to " "write new importers that can participate in the import process. Python 2.7 " "doesn't contain the complete :mod:`importlib` package, but instead has a " -"tiny subset that contains a single function, :func:`~importlib." -"import_module`." +"tiny subset that contains a single " +"function, :func:`~importlib.import_module`." msgstr "" #: ../../whatsnew/2.7.rst:1747 @@ -2639,10 +2658,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:1818 msgid "" -"The :mod:`tkinter.ttk` module was written by Guilherme Polo and added in :" -"issue:`2983`. An alternate version called ``Tile.py``, written by Martin " -"Franklin and maintained by Kevin Walzer, was proposed for inclusion in :" -"issue:`2618`, but the authors argued that Guilherme Polo's work was more " +"The :mod:`tkinter.ttk` module was written by Guilherme Polo and added " +"in :issue:`2983`. An alternate version called ``Tile.py``, written by " +"Martin Franklin and maintained by Kevin Walzer, was proposed for inclusion " +"in :issue:`2618`, but the authors argued that Guilherme Polo's work was more " "comprehensive." msgstr "" @@ -2714,8 +2733,8 @@ msgstr "" msgid "" ":option:`-f <unittest -f>` or :option:`!--failfast` makes test execution " "stop immediately when a test fails instead of continuing to execute further " -"tests. (Suggested by Cliff Dyer and implemented by Michael Foord; :issue:" -"`8074`.)" +"tests. (Suggested by Cliff Dyer and implemented by Michael " +"Foord; :issue:`8074`.)" msgstr "" #: ../../whatsnew/2.7.rst:1874 @@ -2733,13 +2752,13 @@ msgstr "" #: ../../whatsnew/2.7.rst:1881 msgid "" -"The error messages for :meth:`~unittest.TestCase.assertEqual`, :meth:" -"`~unittest.TestCase.assertTrue`, and :meth:`~unittest.TestCase.assertFalse` " -"failures now provide more information. If you set the :attr:`~unittest." -"TestCase.longMessage` attribute of your :class:`~unittest.TestCase` classes " -"to true, both the standard error message and any additional message you " -"provide will be printed for failures. (Added by Michael Foord; :issue:" -"`5663`.)" +"The error messages " +"for :meth:`~unittest.TestCase.assertEqual`, :meth:`~unittest.TestCase.assertTrue`, " +"and :meth:`~unittest.TestCase.assertFalse` failures now provide more " +"information. If you set the :attr:`~unittest.TestCase.longMessage` " +"attribute of your :class:`~unittest.TestCase` classes to true, both the " +"standard error message and any additional message you provide will be " +"printed for failures. (Added by Michael Foord; :issue:`5663`.)" msgstr "" #: ../../whatsnew/2.7.rst:1888 @@ -2762,22 +2781,24 @@ msgstr "(由 Antoine Pitrou 實作;:issue:`4444`。)" #: ../../whatsnew/2.7.rst:1899 msgid "" "Module- and class-level setup and teardown fixtures are now supported. " -"Modules can contain :func:`~unittest.setUpModule` and :func:`~unittest." -"tearDownModule` functions. Classes can have :meth:`~unittest.TestCase." -"setUpClass` and :meth:`~unittest.TestCase.tearDownClass` methods that must " -"be defined as class methods (using ``@classmethod`` or equivalent). These " -"functions and methods are invoked when the test runner switches to a test " -"case in a different module or class." +"Modules can contain :func:`~unittest.setUpModule` " +"and :func:`~unittest.tearDownModule` functions. Classes can " +"have :meth:`~unittest.TestCase.setUpClass` " +"and :meth:`~unittest.TestCase.tearDownClass` methods that must be defined as " +"class methods (using ``@classmethod`` or equivalent). These functions and " +"methods are invoked when the test runner switches to a test case in a " +"different module or class." msgstr "" #: ../../whatsnew/2.7.rst:1907 msgid "" -"The methods :meth:`~unittest.TestCase.addCleanup` and :meth:`~unittest." -"TestCase.doCleanups` were added. :meth:`~unittest.TestCase.addCleanup` lets " -"you add cleanup functions that will be called unconditionally (after :meth:" -"`~unittest.TestCase.setUp` if :meth:`~unittest.TestCase.setUp` fails, " -"otherwise after :meth:`~unittest.TestCase.tearDown`). This allows for much " -"simpler resource allocation and deallocation during tests (:issue:`5679`)." +"The methods :meth:`~unittest.TestCase.addCleanup` " +"and :meth:`~unittest.TestCase.doCleanups` were " +"added. :meth:`~unittest.TestCase.addCleanup` lets you add cleanup functions " +"that will be called unconditionally (after :meth:`~unittest.TestCase.setUp` " +"if :meth:`~unittest.TestCase.setUp` fails, otherwise " +"after :meth:`~unittest.TestCase.tearDown`). This allows for much simpler " +"resource allocation and deallocation during tests (:issue:`5679`)." msgstr "" #: ../../whatsnew/2.7.rst:1915 @@ -2790,31 +2811,31 @@ msgstr "" #: ../../whatsnew/2.7.rst:1920 msgid "" -":meth:`~unittest.TestCase.assertIsNone` and :meth:`~unittest.TestCase." -"assertIsNotNone` take one expression and verify that the result is or is not " -"``None``." +":meth:`~unittest.TestCase.assertIsNone` " +"and :meth:`~unittest.TestCase.assertIsNotNone` take one expression and " +"verify that the result is or is not ``None``." msgstr "" #: ../../whatsnew/2.7.rst:1923 msgid "" -":meth:`~unittest.TestCase.assertIs` and :meth:`~unittest.TestCase." -"assertIsNot` take two values and check whether the two values evaluate to " -"the same object or not. (Added by Michael Foord; :issue:`2578`.)" +":meth:`~unittest.TestCase.assertIs` " +"and :meth:`~unittest.TestCase.assertIsNot` take two values and check whether " +"the two values evaluate to the same object or not. (Added by Michael " +"Foord; :issue:`2578`.)" msgstr "" #: ../../whatsnew/2.7.rst:1927 msgid "" -":meth:`~unittest.TestCase.assertIsInstance` and :meth:`~unittest.TestCase." -"assertNotIsInstance` check whether the resulting object is an instance of a " -"particular class, or of one of a tuple of classes. (Added by Georg Brandl; :" -"issue:`7031`.)" +":meth:`~unittest.TestCase.assertIsInstance` " +"and :meth:`~unittest.TestCase.assertNotIsInstance` check whether the " +"resulting object is an instance of a particular class, or of one of a tuple " +"of classes. (Added by Georg Brandl; :issue:`7031`.)" msgstr "" #: ../../whatsnew/2.7.rst:1932 msgid "" -":meth:`~unittest.TestCase.assertGreater`, :meth:`~unittest.TestCase." -"assertGreaterEqual`, :meth:`~unittest.TestCase.assertLess`, and :meth:" -"`~unittest.TestCase.assertLessEqual` compare two quantities." +":meth:`~unittest.TestCase.assertGreater`, :meth:`~unittest.TestCase.assertGreaterEqual`, :meth:`~unittest.TestCase.assertLess`, " +"and :meth:`~unittest.TestCase.assertLessEqual` compare two quantities." msgstr "" #: ../../whatsnew/2.7.rst:1936 @@ -2827,10 +2848,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:1941 msgid "" -":meth:`assertRegexpMatches() <unittest.TestCase.assertRegex>` and :meth:" -"`assertNotRegexpMatches() <unittest.TestCase.assertNotRegex>` checks whether " -"the first argument is a string matching or not matching the regular " -"expression provided as the second argument (:issue:`8038`)." +":meth:`assertRegexpMatches() <unittest.TestCase.assertRegex>` " +"and :meth:`assertNotRegexpMatches() <unittest.TestCase.assertNotRegex>` " +"checks whether the first argument is a string matching or not matching the " +"regular expression provided as the second argument (:issue:`8038`)." msgstr "" #: ../../whatsnew/2.7.rst:1946 @@ -2843,8 +2864,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:1951 msgid "" -":meth:`~unittest.TestCase.assertIn` and :meth:`~unittest.TestCase." -"assertNotIn` tests whether *first* is or is not in *second*." +":meth:`~unittest.TestCase.assertIn` " +"and :meth:`~unittest.TestCase.assertNotIn` tests whether *first* is or is " +"not in *second*." msgstr "" #: ../../whatsnew/2.7.rst:1954 @@ -2861,13 +2883,14 @@ msgstr "" #: ../../whatsnew/2.7.rst:1960 msgid "" -"Similarly, :meth:`~unittest.TestCase.assertListEqual` and :meth:`~unittest." -"TestCase.assertTupleEqual` compare the specified types and explain any " -"differences without necessarily printing their full values; these methods " -"are now used by default when comparing lists and tuples using :meth:" -"`~unittest.TestCase.assertEqual`. More generally, :meth:`~unittest.TestCase." -"assertSequenceEqual` compares two sequences and can optionally check whether " -"both sequences are of a particular type." +"Similarly, :meth:`~unittest.TestCase.assertListEqual` " +"and :meth:`~unittest.TestCase.assertTupleEqual` compare the specified types " +"and explain any differences without necessarily printing their full values; " +"these methods are now used by default when comparing lists and tuples " +"using :meth:`~unittest.TestCase.assertEqual`. More " +"generally, :meth:`~unittest.TestCase.assertSequenceEqual` compares two " +"sequences and can optionally check whether both sequences are of a " +"particular type." msgstr "" #: ../../whatsnew/2.7.rst:1968 @@ -2881,45 +2904,47 @@ msgstr "" #: ../../whatsnew/2.7.rst:1973 msgid "" -":meth:`~unittest.TestCase.assertAlmostEqual` and :meth:`~unittest.TestCase." -"assertNotAlmostEqual` test whether *first* and *second* are approximately " -"equal. This method can either round their difference to an optionally " -"specified number of *places* (the default is 7) and compare it to zero, or " -"require the difference to be smaller than a supplied *delta* value." +":meth:`~unittest.TestCase.assertAlmostEqual` " +"and :meth:`~unittest.TestCase.assertNotAlmostEqual` test whether *first* and " +"*second* are approximately equal. This method can either round their " +"difference to an optionally specified number of *places* (the default is 7) " +"and compare it to zero, or require the difference to be smaller than a " +"supplied *delta* value." msgstr "" #: ../../whatsnew/2.7.rst:1979 msgid "" -":meth:`~unittest.TestLoader.loadTestsFromName` properly honors the :attr:" -"`~unittest.TestLoader.suiteClass` attribute of the :class:`~unittest." -"TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.)" +":meth:`~unittest.TestLoader.loadTestsFromName` properly honors " +"the :attr:`~unittest.TestLoader.suiteClass` attribute of " +"the :class:`~unittest.TestLoader`. (Fixed by Mark Roddy; :issue:`6866`.)" msgstr "" #: ../../whatsnew/2.7.rst:1983 msgid "" "A new hook lets you extend the :meth:`~unittest.TestCase.assertEqual` method " -"to handle new data types. The :meth:`~unittest.TestCase." -"addTypeEqualityFunc` method takes a type object and a function. The function " -"will be used when both of the objects being compared are of the specified " -"type. This function should compare the two objects and raise an exception " -"if they don't match; it's a good idea for the function to provide additional " -"information about why the two objects aren't matching, much as the new " -"sequence comparison methods do." +"to handle new data types. " +"The :meth:`~unittest.TestCase.addTypeEqualityFunc` method takes a type " +"object and a function. The function will be used when both of the objects " +"being compared are of the specified type. This function should compare the " +"two objects and raise an exception if they don't match; it's a good idea for " +"the function to provide additional information about why the two objects " +"aren't matching, much as the new sequence comparison methods do." msgstr "" #: ../../whatsnew/2.7.rst:1992 msgid "" -":func:`unittest.main` now takes an optional ``exit`` argument. If false, :" -"func:`~unittest.main` doesn't call :func:`sys.exit`, allowing :func:" -"`~unittest.main` to be used from the interactive interpreter. (Contributed " -"by J. Pablo Fernández; :issue:`3379`.)" +":func:`unittest.main` now takes an optional ``exit`` argument. If " +"false, :func:`~unittest.main` doesn't call :func:`sys.exit`, " +"allowing :func:`~unittest.main` to be used from the interactive interpreter. " +"(Contributed by J. Pablo Fernández; :issue:`3379`.)" msgstr "" #: ../../whatsnew/2.7.rst:1997 msgid "" -":class:`~unittest.TestResult` has new :meth:`~unittest.TestResult." -"startTestRun` and :meth:`~unittest.TestResult.stopTestRun` methods that are " -"called immediately before and after a test run. (Contributed by Robert " +":class:`~unittest.TestResult` has " +"new :meth:`~unittest.TestResult.startTestRun` " +"and :meth:`~unittest.TestResult.stopTestRun` methods that are called " +"immediately before and after a test run. (Contributed by Robert " "Collins; :issue:`5728`.)" msgstr "" @@ -2978,16 +3003,16 @@ msgstr "" #: ../../whatsnew/2.7.rst:2031 msgid "" "ElementTree's code for converting trees to a string has been significantly " -"reworked, making it roughly twice as fast in many cases. The :meth:" -"`ElementTree.write() <xml.etree.ElementTree.ElementTree.write>` and :meth:" -"`Element.write` methods now have a *method* parameter that can be " +"reworked, making it roughly twice as fast in many cases. " +"The :meth:`ElementTree.write() <xml.etree.ElementTree.ElementTree.write>` " +"and :meth:`Element.write` methods now have a *method* parameter that can be " "\"xml\" (the default), \"html\", or \"text\". HTML mode will output empty " "elements as ``<empty></empty>`` instead of ``<empty/>``, and text mode will " -"skip over elements and only output the text chunks. If you set the :attr:" -"`~xml.etree.ElementTree.Element.tag` attribute of an element to ``None`` but " -"leave its children in place, the element will be omitted when the tree is " -"written out, so you don't need to do more extensive rearrangement to remove " -"a single element." +"skip over elements and only output the text chunks. If you set " +"the :attr:`~xml.etree.ElementTree.Element.tag` attribute of an element to " +"``None`` but leave its children in place, the element will be omitted when " +"the tree is written out, so you don't need to do more extensive " +"rearrangement to remove a single element." msgstr "" #: ../../whatsnew/2.7.rst:2044 @@ -2995,17 +3020,18 @@ msgid "" "Namespace handling has also been improved. All ``xmlns:<whatever>`` " "declarations are now output on the root element, not scattered throughout " "the resulting XML. You can set the default namespace for a tree by setting " -"the :attr:`default_namespace` attribute and can register new prefixes with :" -"meth:`~xml.etree.ElementTree.register_namespace`. In XML mode, you can use " -"the true/false *xml_declaration* parameter to suppress the XML declaration." +"the :attr:`default_namespace` attribute and can register new prefixes " +"with :meth:`~xml.etree.ElementTree.register_namespace`. In XML mode, you " +"can use the true/false *xml_declaration* parameter to suppress the XML " +"declaration." msgstr "" #: ../../whatsnew/2.7.rst:2052 msgid "" -"New :class:`~xml.etree.ElementTree.Element` method: :meth:`~xml.etree." -"ElementTree.Element.extend` appends the items from a sequence to the " -"element's children. Elements themselves behave like sequences, so it's easy " -"to move children from one element to another::" +"New :class:`~xml.etree.ElementTree.Element` " +"method: :meth:`~xml.etree.ElementTree.Element.extend` appends the items from " +"a sequence to the element's children. Elements themselves behave like " +"sequences, so it's easy to move children from one element to another::" msgstr "" #: ../../whatsnew/2.7.rst:2058 @@ -3024,19 +3050,19 @@ msgstr "" #: ../../whatsnew/2.7.rst:2069 msgid "" -"New :class:`~xml.etree.ElementTree.Element` method: :meth:`~xml.etree." -"ElementTree.Element.iter` yields the children of the element as a " -"generator. It's also possible to write ``for child in elem:`` to loop over " -"an element's children. The existing method :meth:`!getiterator` is now " -"deprecated, as is :meth:`!getchildren` which constructs and returns a list " -"of children." +"New :class:`~xml.etree.ElementTree.Element` " +"method: :meth:`~xml.etree.ElementTree.Element.iter` yields the children of " +"the element as a generator. It's also possible to write ``for child in " +"elem:`` to loop over an element's children. The existing method :meth:`!" +"getiterator` is now deprecated, as is :meth:`!getchildren` which constructs " +"and returns a list of children." msgstr "" #: ../../whatsnew/2.7.rst:2076 msgid "" -"New :class:`~xml.etree.ElementTree.Element` method: :meth:`~xml.etree." -"ElementTree.Element.itertext` yields all chunks of text that are descendants " -"of the element. For example::" +"New :class:`~xml.etree.ElementTree.Element` " +"method: :meth:`~xml.etree.ElementTree.Element.itertext` yields all chunks of " +"text that are descendants of the element. For example::" msgstr "" #: ../../whatsnew/2.7.rst:2080 @@ -3062,19 +3088,19 @@ msgstr "" #: ../../whatsnew/2.7.rst:2095 msgid "" "Fredrik Lundh develops ElementTree and produced the 1.3 version; you can " -"read his article describing 1.3 at https://web.archive.org/" -"web/20200703234532/http://effbot.org/zone/elementtree-13-intro.htm. Florent " +"read his article describing 1.3 at https://web.archive.org/web/" +"20200703234532/http://effbot.org/zone/elementtree-13-intro.htm. Florent " "Xicluna updated the version included with Python, after discussions on " "python-dev and in :issue:`6472`.)" msgstr "" #: ../../whatsnew/2.7.rst:2105 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/2.7.rst:2107 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/2.7.rst:2109 msgid "" @@ -3102,8 +3128,8 @@ msgstr "" msgid "" ":c:func:`Py_AddPendingCall` is now thread-safe, letting any worker thread " "submit notifications to the main Python thread. This is particularly useful " -"for asynchronous IO operations. (Contributed by Kristján Valur Jónsson; :" -"issue:`4293`.)" +"for asynchronous IO operations. (Contributed by Kristján Valur " +"Jónsson; :issue:`4293`.)" msgstr "" #: ../../whatsnew/2.7.rst:2131 @@ -3134,11 +3160,12 @@ msgstr "" #: ../../whatsnew/2.7.rst:2150 msgid "" -"New functions: :c:func:`PyLong_AsLongAndOverflow` and :c:func:" -"`PyLong_AsLongLongAndOverflow` approximates a Python long integer as a C :c:" -"expr:`long` or :c:expr:`long long`. If the number is too large to fit into " -"the output type, an *overflow* flag is set and returned to the caller. " -"(Contributed by Case Van Horsen; :issue:`7528` and :issue:`7767`.)" +"New functions: :c:func:`PyLong_AsLongAndOverflow` " +"and :c:func:`PyLong_AsLongLongAndOverflow` approximates a Python long " +"integer as a C :c:expr:`long` or :c:expr:`long long`. If the number is too " +"large to fit into the output type, an *overflow* flag is set and returned to " +"the caller. (Contributed by Case Van Horsen; :issue:`7528` " +"and :issue:`7767`.)" msgstr "" #: ../../whatsnew/2.7.rst:2157 @@ -3184,14 +3211,12 @@ msgstr "" #: ../../whatsnew/2.7.rst:2183 msgid "" -"New macros: the Python header files now define the following macros: :c:" -"macro:`Py_ISALNUM`, :c:macro:`Py_ISALPHA`, :c:macro:`Py_ISDIGIT`, :c:macro:" -"`Py_ISLOWER`, :c:macro:`Py_ISSPACE`, :c:macro:`Py_ISUPPER`, :c:macro:" -"`Py_ISXDIGIT`, :c:macro:`Py_TOLOWER`, and :c:macro:`Py_TOUPPER`. All of " -"these functions are analogous to the C standard macros for classifying " -"characters, but ignore the current locale setting, because in several places " -"Python needs to analyze characters in a locale-independent way. (Added by " -"Eric Smith; :issue:`5793`.)" +"New macros: the Python header files now define the following " +"macros: :c:macro:`Py_ISALNUM`, :c:macro:`Py_ISALPHA`, :c:macro:`Py_ISDIGIT`, :c:macro:`Py_ISLOWER`, :c:macro:`Py_ISSPACE`, :c:macro:`Py_ISUPPER`, :c:macro:`Py_ISXDIGIT`, :c:macro:`Py_TOLOWER`, " +"and :c:macro:`Py_TOUPPER`. All of these functions are analogous to the C " +"standard macros for classifying characters, but ignore the current locale " +"setting, because in several places Python needs to analyze characters in a " +"locale-independent way. (Added by Eric Smith; :issue:`5793`.)" msgstr "" #: ../../whatsnew/2.7.rst:2201 @@ -3236,16 +3261,17 @@ msgstr "" #: ../../whatsnew/2.7.rst:2230 msgid "" -"The :c:func:`Py_Finalize` function now calls the internal :func:`!threading." -"_shutdown` function; this prevents some exceptions from being raised when an " -"interpreter shuts down. (Patch by Adam Olsen; :issue:`1722344`.)" +"The :c:func:`Py_Finalize` function now calls the internal :func:`!" +"threading._shutdown` function; this prevents some exceptions from being " +"raised when an interpreter shuts down. (Patch by Adam " +"Olsen; :issue:`1722344`.)" msgstr "" #: ../../whatsnew/2.7.rst:2235 msgid "" "When using the :c:type:`PyMemberDef` structure to define attributes of a " -"type, Python will no longer let you try to delete or set a :c:macro:" -"`T_STRING_INPLACE` attribute." +"type, Python will no longer let you try to delete or set " +"a :c:macro:`T_STRING_INPLACE` attribute." msgstr "" #: ../../whatsnew/2.7.rst:2241 @@ -3258,8 +3284,8 @@ msgstr "" msgid "" "New configure option: the :option:`!--with-system-expat` switch allows " "building the :mod:`pyexpat <xml.parsers.expat>` module to use the system " -"Expat library. (Contributed by Arfrever Frehtes Taifersar Arahesis; :issue:" -"`7609`.)" +"Expat library. (Contributed by Arfrever Frehtes Taifersar " +"Arahesis; :issue:`7609`.)" msgstr "" #: ../../whatsnew/2.7.rst:2249 @@ -3267,8 +3293,8 @@ msgid "" "New configure option: the :option:`!--with-valgrind` option will now disable " "the pymalloc allocator, which is difficult for the Valgrind memory-error " "detector to analyze correctly. Valgrind will therefore be better at " -"detecting memory leaks and overruns. (Contributed by James Henstridge; :" -"issue:`2422`.)" +"detecting memory leaks and overruns. (Contributed by James " +"Henstridge; :issue:`2422`.)" msgstr "" #: ../../whatsnew/2.7.rst:2256 @@ -3283,8 +3309,8 @@ msgid "" "The :program:`configure` script now checks for floating-point rounding bugs " "on certain 32-bit Intel chips and defines a :c:macro:`X87_DOUBLE_ROUNDING` " "preprocessor definition. No code currently uses this definition, but it's " -"available if anyone wishes to use it. (Added by Mark Dickinson; :issue:" -"`2937`.)" +"available if anyone wishes to use it. (Added by Mark " +"Dickinson; :issue:`2937`.)" msgstr "" #: ../../whatsnew/2.7.rst:2267 @@ -3314,12 +3340,12 @@ msgstr "" msgid "" "Python 3.1 adds a new C datatype, :c:type:`PyCapsule`, for providing a C API " "to an extension module. A capsule is essentially the holder of a C ``void " -"*`` pointer, and is made available as a module attribute; for example, the :" -"mod:`socket` module's API is exposed as ``socket.CAPI``, and :mod:" -"`unicodedata` exposes ``ucnhash_CAPI``. Other extensions can import the " -"module, access its dictionary to get the capsule object, and then get the " -"``void *`` pointer, which will usually point to an array of pointers to the " -"module's various API functions." +"*`` pointer, and is made available as a module attribute; for example, " +"the :mod:`socket` module's API is exposed as ``socket.CAPI``, " +"and :mod:`unicodedata` exposes ``ucnhash_CAPI``. Other extensions can " +"import the module, access its dictionary to get the capsule object, and then " +"get the ``void *`` pointer, which will usually point to an array of pointers " +"to the module's various API functions." msgstr "" #: ../../whatsnew/2.7.rst:2292 @@ -3357,8 +3383,8 @@ msgid "" "Python 2.7 now uses capsules internally to provide various extension-module " "APIs, but the :c:func:`!PyCObject_AsVoidPtr` was modified to handle " "capsules, preserving compile-time compatibility with the :c:type:`!" -"PyCObject` interface. Use of :c:func:`!PyCObject_AsVoidPtr` will signal a :" -"exc:`PendingDeprecationWarning`, which is silent by default." +"PyCObject` interface. Use of :c:func:`!PyCObject_AsVoidPtr` will signal " +"a :exc:`PendingDeprecationWarning`, which is silent by default." msgstr "" #: ../../whatsnew/2.7.rst:2322 @@ -3373,11 +3399,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:2331 msgid "" -"The :mod:`msvcrt` module now contains some constants from the :file:" -"`crtassem.h` header file: :data:`~msvcrt.CRT_ASSEMBLY_VERSION`, :data:" -"`~msvcrt.VC_ASSEMBLY_PUBLICKEYTOKEN`, and :data:`~msvcrt." -"LIBRARIES_ASSEMBLY_NAME_PREFIX`. (Contributed by David Cournapeau; :issue:" -"`4365`.)" +"The :mod:`msvcrt` module now contains some constants from " +"the :file:`crtassem.h` header " +"file: :data:`~msvcrt.CRT_ASSEMBLY_VERSION`, :data:`~msvcrt.VC_ASSEMBLY_PUBLICKEYTOKEN`, " +"and :data:`~msvcrt.LIBRARIES_ASSEMBLY_NAME_PREFIX`. (Contributed by David " +"Cournapeau; :issue:`4365`.)" msgstr "" #: ../../whatsnew/2.7.rst:2338 @@ -3385,9 +3411,10 @@ msgid "" "The :mod:`_winreg <winreg>` module for accessing the registry now implements " "the :func:`~winreg.CreateKeyEx` and :func:`~winreg.DeleteKeyEx` functions, " "extended versions of previously supported functions that take several extra " -"arguments. The :func:`~winreg.DisableReflectionKey`, :func:`~winreg." -"EnableReflectionKey`, and :func:`~winreg.QueryReflectionKey` were also " -"tested and documented. (Implemented by Brian Curtin: :issue:`7347`.)" +"arguments. " +"The :func:`~winreg.DisableReflectionKey`, :func:`~winreg.EnableReflectionKey`, " +"and :func:`~winreg.QueryReflectionKey` were also tested and documented. " +"(Implemented by Brian Curtin: :issue:`7347`.)" msgstr "" #: ../../whatsnew/2.7.rst:2346 @@ -3400,11 +3427,12 @@ msgstr "" #: ../../whatsnew/2.7.rst:2350 msgid "" "The :func:`os.kill` function now works on Windows. The signal value can be " -"the constants :const:`~signal.CTRL_C_EVENT`, :const:`~signal." -"CTRL_BREAK_EVENT`, or any integer. The first two constants will send :kbd:" -"`Control-C` and :kbd:`Control-Break` keystroke events to subprocesses; any " -"other value will use the :c:func:`!TerminateProcess` API. (Contributed by " -"Miki Tebeka; :issue:`1220212`.)" +"the " +"constants :const:`~signal.CTRL_C_EVENT`, :const:`~signal.CTRL_BREAK_EVENT`, " +"or any integer. The first two constants will send :kbd:`Control-C` " +"and :kbd:`Control-Break` keystroke events to subprocesses; any other value " +"will use the :c:func:`!TerminateProcess` API. (Contributed by Miki " +"Tebeka; :issue:`1220212`.)" msgstr "" #: ../../whatsnew/2.7.rst:2357 @@ -3425,10 +3453,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:2369 msgid "" -"The path ``/Library/Python/2.7/site-packages`` is now appended to ``sys." -"path``, in order to share added packages between the system installation and " -"a user-installed copy of the same version. (Changed by Ronald Oussoren; :" -"issue:`4865`.)" +"The path ``/Library/Python/2.7/site-packages`` is now appended to " +"``sys.path``, in order to share added packages between the system " +"installation and a user-installed copy of the same version. (Changed by " +"Ronald Oussoren; :issue:`4865`.)" msgstr "" #: ../../whatsnew/2.7.rst:2376 @@ -3449,10 +3477,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:2389 msgid "" -"FreeBSD 7.1's :const:`!SO_SETFIB` constant, used with the :func:`~socket." -"socket` methods :func:`~socket.socket.getsockopt`/:func:`~socket.socket." -"setsockopt` to select an alternate routing table, is now available in the :" -"mod:`socket` module. (Added by Kyle VanderBeek; :issue:`8235`.)" +"FreeBSD 7.1's :const:`!SO_SETFIB` constant, used with " +"the :func:`~socket.socket` " +"methods :func:`~socket.socket.getsockopt`/:func:`~socket.socket.setsockopt` " +"to select an alternate routing table, is now available in the :mod:`socket` " +"module. (Added by Kyle VanderBeek; :issue:`8235`.)" msgstr "" #: ../../whatsnew/2.7.rst:2395 @@ -3471,8 +3500,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2405 msgid "" -"The :file:`Tools/i18n/msgfmt.py` script now understands plural forms in :" -"file:`.po` files. (Fixed by Martin von Löwis; :issue:`5464`.)" +"The :file:`Tools/i18n/msgfmt.py` script now understands plural forms " +"in :file:`.po` files. (Fixed by Martin von Löwis; :issue:`5464`.)" msgstr "" #: ../../whatsnew/2.7.rst:2409 @@ -3488,9 +3517,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:2416 msgid "" "The :file:`regrtest.py` script now takes a :option:`!--randseed=` switch " -"that takes an integer that will be used as the random seed for the :option:" -"`!-r` option that executes tests in random order. The :option:`!-r` option " -"also reports the seed that was used (Added by Collin Winter.)" +"that takes an integer that will be used as the random seed for " +"the :option:`!-r` option that executes tests in random order. The :option:`!-" +"r` option also reports the seed that was used (Added by Collin Winter.)" msgstr "" #: ../../whatsnew/2.7.rst:2422 @@ -3532,8 +3561,8 @@ msgstr "" msgid "" "The string :meth:`format` method changed the default precision used for " "floating-point and complex numbers from 6 decimal places to 12, which " -"matches the precision used by :func:`str`. (Changed by Eric Smith; :issue:" -"`5920`.)" +"matches the precision used by :func:`str`. (Changed by Eric " +"Smith; :issue:`5920`.)" msgstr "" #: ../../whatsnew/2.7.rst:2454 @@ -3547,10 +3576,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:2460 msgid "" -"Due to a bug in Python 2.6, the *exc_value* parameter to :meth:`~object." -"__exit__` methods was often the string representation of the exception, not " -"an instance. This was fixed in 2.7, so *exc_value* will be an instance as " -"expected. (Fixed by Florent Xicluna; :issue:`7853`.)" +"Due to a bug in Python 2.6, the *exc_value* parameter " +"to :meth:`~object.__exit__` methods was often the string representation of " +"the exception, not an instance. This was fixed in 2.7, so *exc_value* will " +"be an instance as expected. (Fixed by Florent Xicluna; :issue:`7853`.)" msgstr "" #: ../../whatsnew/2.7.rst:2470 @@ -3560,18 +3589,18 @@ msgstr "" #: ../../whatsnew/2.7.rst:2472 msgid "" "Operations with :class:`~datetime.datetime` instances that resulted in a " -"year falling outside the supported range didn't always raise :exc:" -"`OverflowError`. Such errors are now checked more carefully and will now " -"raise the exception. (Reported by Mark Leander, patch by Anand B. Pillai and " -"Alexander Belopolsky; :issue:`7150`.)" +"year falling outside the supported range didn't always " +"raise :exc:`OverflowError`. Such errors are now checked more carefully and " +"will now raise the exception. (Reported by Mark Leander, patch by Anand B. " +"Pillai and Alexander Belopolsky; :issue:`7150`.)" msgstr "" #: ../../whatsnew/2.7.rst:2478 msgid "" -"When using :class:`~decimal.Decimal` instances with a string's :meth:" -"`format` method, the default alignment was previously left-alignment. This " -"has been changed to right-alignment, which might change the output of your " -"programs. (Changed by Mark Dickinson; :issue:`6857`.)" +"When using :class:`~decimal.Decimal` instances with a " +"string's :meth:`format` method, the default alignment was previously left-" +"alignment. This has been changed to right-alignment, which might change the " +"output of your programs. (Changed by Mark Dickinson; :issue:`6857`.)" msgstr "" #: ../../whatsnew/2.7.rst:2490 @@ -3602,9 +3631,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:2545 msgid "" -"Use the new :c:func:`PyOS_string_to_double` function instead of the old :c:" -"func:`!PyOS_ascii_strtod` and :c:func:`!PyOS_ascii_atof` functions, which " -"are now deprecated." +"Use the new :c:func:`PyOS_string_to_double` function instead of the " +"old :c:func:`!PyOS_ascii_strtod` and :c:func:`!PyOS_ascii_atof` functions, " +"which are now deprecated." msgstr "" #: ../../whatsnew/2.7.rst:2549 @@ -3646,8 +3675,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2580 msgid "" -"In debug mode, the ``[xxx refs]`` statistic is not written by default, the :" -"envvar:`!PYTHONSHOWREFCOUNT` environment variable now must also be set. " +"In debug mode, the ``[xxx refs]`` statistic is not written by default, " +"the :envvar:`!PYTHONSHOWREFCOUNT` environment variable now must also be set. " "(Contributed by Victor Stinner; :issue:`31733`.)" msgstr "" @@ -3656,8 +3685,8 @@ msgid "" "When Python is compiled with ``COUNT_ALLOC`` defined, allocation counts are " "no longer dumped by default anymore: the :envvar:`!PYTHONSHOWALLOCCOUNT` " "environment variable must now also be set. Moreover, allocation counts are " -"now dumped into stderr, rather than stdout. (Contributed by Victor Stinner; :" -"issue:`31692`.)" +"now dumped into stderr, rather than stdout. (Contributed by Victor " +"Stinner; :issue:`31692`.)" msgstr "" #: ../../whatsnew/2.7.rst:2593 @@ -3720,8 +3749,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2626 msgid "" "OpenSSL 1.0.1h was upgraded for the official Windows installers published on " -"python.org. (Contributed by Zachary Ware in :issue:`21671` for :cve:" -"`2014-0224`.)" +"python.org. (Contributed by Zachary Ware in :issue:`21671` " +"for :cve:`2014-0224`.)" msgstr "" #: ../../whatsnew/2.7.rst:2629 @@ -3751,10 +3780,10 @@ msgstr "" #: ../../whatsnew/2.7.rst:2643 msgid "" -":data:`hashlib.algorithms_guaranteed` and :data:`hashlib." -"algorithms_available` were backported from Python 3 to make it easier for " -"Python 2 applications to select the strongest available hash algorithm. " -"(Contributed by Alex Gaynor in :issue:`21307`)" +":data:`hashlib.algorithms_guaranteed` " +"and :data:`hashlib.algorithms_available` were backported from Python 3 to " +"make it easier for Python 2 applications to select the strongest available " +"hash algorithm. (Contributed by Alex Gaynor in :issue:`21307`)" msgstr "" #: ../../whatsnew/2.7.rst:2650 @@ -3818,7 +3847,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:2690 msgid "Documentation Changes" -msgstr "" +msgstr "文件更動" #: ../../whatsnew/2.7.rst:2692 msgid "" @@ -3833,8 +3862,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2700 msgid "" "However, as this migration is currently still incomplete, the legacy " -"versions of those guides remaining available as :ref:`install-index` and :" -"ref:`setuptools-index`." +"versions of those guides remaining available as :ref:`install-index` " +"and :ref:`setuptools-index`." msgstr "" #: ../../whatsnew/2.7.rst:2706 @@ -3854,9 +3883,9 @@ msgstr "" #: ../../whatsnew/2.7.rst:2713 msgid "" -":pep:`476` updated :mod:`httplib <http>` and modules which use it, such as :" -"mod:`urllib2 <urllib.request>` and :mod:`xmlrpclib <xmlrpc.client>`, to now " -"verify that the server presents a certificate which is signed by a " +":pep:`476` updated :mod:`httplib <http>` and modules which use it, such " +"as :mod:`urllib2 <urllib.request>` and :mod:`xmlrpclib <xmlrpc.client>`, to " +"now verify that the server presents a certificate which is signed by a " "Certificate Authority in the platform trust store and whose hostname matches " "the hostname being requested by default, significantly improving security " "for many applications. This change was made in the Python 2.7.9 release." @@ -3939,8 +3968,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2772 msgid "" -"More selective regeneration targets are also defined - see :source:`Makefile." -"pre.in` for details." +"More selective regeneration targets are also defined - " +"see :source:`Makefile.pre.in` for details." msgstr "" #: ../../whatsnew/2.7.rst:2775 ../../whatsnew/2.7.rst:2788 diff --git a/whatsnew/3.0.po b/whatsnew/3.0.po index 77d4d2f766..ed4c8da527 100644 --- a/whatsnew/3.0.po +++ b/whatsnew/3.0.po @@ -152,26 +152,26 @@ msgstr "一些眾所周知的 API 不再回傳串列:" #: ../../whatsnew/3.0.rst:147 msgid "" -":class:`dict` methods :meth:`dict.keys`, :meth:`dict.items` and :meth:`dict." -"values` return \"views\" instead of lists. For example, this no longer " -"works: ``k = d.keys(); k.sort()``. Use ``k = sorted(d)`` instead (this " -"works in Python 2.5 too and is just as efficient)." +":class:`dict` methods :meth:`dict.keys`, :meth:`dict.items` " +"and :meth:`dict.values` return \"views\" instead of lists. For example, " +"this no longer works: ``k = d.keys(); k.sort()``. Use ``k = sorted(d)`` " +"instead (this works in Python 2.5 too and is just as efficient)." msgstr "" #: ../../whatsnew/3.0.rst:153 msgid "" -"Also, the :meth:`!dict.iterkeys`, :meth:`!dict.iteritems` and :meth:`!dict." -"itervalues` methods are no longer supported." +"Also, the :meth:`!dict.iterkeys`, :meth:`!dict.iteritems` and :meth:`!" +"dict.itervalues` methods are no longer supported." msgstr "" #: ../../whatsnew/3.0.rst:156 msgid "" ":func:`map` and :func:`filter` return iterators. If you really need a list " -"and the input sequences are all of equal length, a quick fix is to wrap :" -"func:`map` in :func:`list`, e.g. ``list(map(...))``, but a better fix is " -"often to use a list comprehension (especially when the original code uses :" -"keyword:`lambda`), or rewriting the code so it doesn't need a list at all. " -"Particularly tricky is :func:`map` invoked for the side effects of the " +"and the input sequences are all of equal length, a quick fix is to " +"wrap :func:`map` in :func:`list`, e.g. ``list(map(...))``, but a better fix " +"is often to use a list comprehension (especially when the original code " +"uses :keyword:`lambda`), or rewriting the code so it doesn't need a list at " +"all. Particularly tricky is :func:`map` invoked for the side effects of the " "function; the correct transformation is to use a regular :keyword:`for` loop " "(since creating a list would just be wasteful)." msgstr "" @@ -179,10 +179,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:167 msgid "" "If the input sequences are not of equal length, :func:`map` will stop at the " -"termination of the shortest of the sequences. For full compatibility with :" -"func:`map` from Python 2.x, also wrap the sequences in :func:`itertools." -"zip_longest`, e.g. ``map(func, *sequences)`` becomes ``list(map(func, " -"itertools.zip_longest(*sequences)))``." +"termination of the shortest of the sequences. For full compatibility " +"with :func:`map` from Python 2.x, also wrap the sequences " +"in :func:`itertools.zip_longest`, e.g. ``map(func, *sequences)`` becomes " +"``list(map(func, itertools.zip_longest(*sequences)))``." msgstr "" #: ../../whatsnew/3.0.rst:173 @@ -255,9 +255,9 @@ msgid "" "The :data:`!sys.maxint` constant was removed, since there is no longer a " "limit to the value of integers. However, :data:`sys.maxsize` can be used as " "an integer larger than any practical list or string index. It conforms to " -"the implementation's \"natural\" integer size and is typically the same as :" -"data:`!sys.maxint` in previous releases on the same platform (assuming the " -"same build options)." +"the implementation's \"natural\" integer size and is typically the same " +"as :data:`!sys.maxint` in previous releases on the same platform (assuming " +"the same build options)." msgstr "" #: ../../whatsnew/3.0.rst:224 @@ -285,14 +285,14 @@ msgstr "" msgid "" "Python 3.0 uses the concepts of *text* and (binary) *data* instead of " "Unicode strings and 8-bit strings. All text is Unicode; however *encoded* " -"Unicode is represented as binary data. The type used to hold text is :class:" -"`str`, the type used to hold data is :class:`bytes`. The biggest difference " -"with the 2.x situation is that any attempt to mix text and data in Python " -"3.0 raises :exc:`TypeError`, whereas if you were to mix Unicode and 8-bit " -"strings in Python 2.x, it would work if the 8-bit string happened to contain " -"only 7-bit (ASCII) bytes, but you would get :exc:`UnicodeDecodeError` if it " -"contained non-ASCII values. This value-specific behavior has caused " -"numerous sad faces over the years." +"Unicode is represented as binary data. The type used to hold text " +"is :class:`str`, the type used to hold data is :class:`bytes`. The biggest " +"difference with the 2.x situation is that any attempt to mix text and data " +"in Python 3.0 raises :exc:`TypeError`, whereas if you were to mix Unicode " +"and 8-bit strings in Python 2.x, it would work if the 8-bit string happened " +"to contain only 7-bit (ASCII) bytes, but you would " +"get :exc:`UnicodeDecodeError` if it contained non-ASCII values. This value-" +"specific behavior has caused numerous sad faces over the years." msgstr "" #: ../../whatsnew/3.0.rst:250 @@ -301,9 +301,9 @@ msgid "" "uses Unicode, encodings or binary data most likely has to change. The " "change is for the better, as in the 2.x world there were numerous bugs " "having to do with mixing encoded and unencoded text. To be prepared in " -"Python 2.x, start using :class:`!unicode` for all unencoded text, and :class:" -"`str` for binary or encoded data only. Then the ``2to3`` tool will do most " -"of the work for you." +"Python 2.x, start using :class:`!unicode` for all unencoded text, " +"and :class:`str` for binary or encoded data only. Then the ``2to3`` tool " +"will do most of the work for you." msgstr "" #: ../../whatsnew/3.0.rst:258 @@ -315,10 +315,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:261 msgid "" "As the :class:`str` and :class:`bytes` types cannot be mixed, you must " -"always explicitly convert between them. Use :meth:`str.encode` to go from :" -"class:`str` to :class:`bytes`, and :meth:`bytes.decode` to go from :class:" -"`bytes` to :class:`str`. You can also use ``bytes(s, encoding=...)`` and " -"``str(b, encoding=...)``, respectively." +"always explicitly convert between them. Use :meth:`str.encode` to go " +"from :class:`str` to :class:`bytes`, and :meth:`bytes.decode` to go " +"from :class:`bytes` to :class:`str`. You can also use ``bytes(s, " +"encoding=...)`` and ``str(b, encoding=...)``, respectively." msgstr "" #: ../../whatsnew/3.0.rst:268 @@ -326,8 +326,8 @@ msgid "" "Like :class:`str`, the :class:`bytes` type is immutable. There is a " "separate *mutable* type to hold buffered binary data, :class:`bytearray`. " "Nearly all APIs that accept :class:`bytes` also accept :class:`bytearray`. " -"The mutable API is based on :class:`collections.MutableSequence <collections." -"abc.MutableSequence>`." +"The mutable API is based on :class:`collections.MutableSequence " +"<collections.abc.MutableSequence>`." msgstr "" #: ../../whatsnew/3.0.rst:274 @@ -342,11 +342,11 @@ msgstr "" #: ../../whatsnew/3.0.rst:281 msgid "" -"The built-in :class:`!basestring` abstract type was removed. Use :class:" -"`str` instead. The :class:`str` and :class:`bytes` types don't have " -"functionality enough in common to warrant a shared base class. The ``2to3`` " -"tool (see below) replaces every occurrence of :class:`!basestring` with :" -"class:`str`." +"The built-in :class:`!basestring` abstract type was removed. " +"Use :class:`str` instead. The :class:`str` and :class:`bytes` types don't " +"have functionality enough in common to warrant a shared base class. The " +"``2to3`` tool (see below) replaces every occurrence of :class:`!basestring` " +"with :class:`str`." msgstr "" #: ../../whatsnew/3.0.rst:287 @@ -369,10 +369,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:304 msgid "" -"The initial values of :data:`sys.stdin`, :data:`sys.stdout` and :data:`sys." -"stderr` are now unicode-only text files (i.e., they are instances of :class:" -"`io.TextIOBase`). To read and write bytes data with these streams, you need " -"to use their :data:`io.TextIOBase.buffer` attribute." +"The initial values of :data:`sys.stdin`, :data:`sys.stdout` " +"and :data:`sys.stderr` are now unicode-only text files (i.e., they are " +"instances of :class:`io.TextIOBase`). To read and write bytes data with " +"these streams, you need to use their :data:`io.TextIOBase.buffer` attribute." msgstr "" #: ../../whatsnew/3.0.rst:310 @@ -381,14 +381,14 @@ msgid "" "can present platform-specific problems because on some platforms filenames " "are arbitrary byte strings. (On the other hand, on Windows filenames are " "natively stored as Unicode.) As a work-around, most APIs (e.g. :func:`open` " -"and many functions in the :mod:`os` module) that take filenames accept :" -"class:`bytes` objects as well as strings, and a few APIs have a way to ask " -"for a :class:`bytes` return value. Thus, :func:`os.listdir` returns a list " -"of :class:`bytes` instances if the argument is a :class:`bytes` instance, " -"and :func:`os.getcwdb` returns the current working directory as a :class:" -"`bytes` instance. Note that when :func:`os.listdir` returns a list of " -"strings, filenames that cannot be decoded properly are omitted rather than " -"raising :exc:`UnicodeError`." +"and many functions in the :mod:`os` module) that take filenames " +"accept :class:`bytes` objects as well as strings, and a few APIs have a way " +"to ask for a :class:`bytes` return value. Thus, :func:`os.listdir` returns " +"a list of :class:`bytes` instances if the argument is a :class:`bytes` " +"instance, and :func:`os.getcwdb` returns the current working directory as " +"a :class:`bytes` instance. Note that when :func:`os.listdir` returns a list " +"of strings, filenames that cannot be decoded properly are omitted rather " +"than raising :exc:`UnicodeError`." msgstr "" #: ../../whatsnew/3.0.rst:325 @@ -420,8 +420,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:340 msgid "" "The :mod:`!StringIO` and :mod:`!cStringIO` modules are gone. Instead, " -"import the :mod:`io` module and use :class:`io.StringIO` or :class:`io." -"BytesIO` for text and data respectively." +"import the :mod:`io` module and use :class:`io.StringIO` " +"or :class:`io.BytesIO` for text and data respectively." msgstr "" #: ../../whatsnew/3.0.rst:344 @@ -472,8 +472,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:374 msgid "" ":pep:`3104`: :keyword:`nonlocal` statement. Using ``nonlocal x`` you can " -"now assign directly to a variable in an outer (but non-global) scope. :" -"keyword:`!nonlocal` is a new reserved word." +"now assign directly to a variable in an outer (but non-global) " +"scope. :keyword:`!nonlocal` is a new reserved word." msgstr "" #: ../../whatsnew/3.0.rst:378 @@ -531,8 +531,8 @@ msgstr "語法變更" #: ../../whatsnew/3.0.rst:408 msgid "" -":pep:`3109` and :pep:`3134`: new :keyword:`raise` statement syntax: :samp:" -"`raise [{expr} [from {expr}]]`. See below." +":pep:`3109` and :pep:`3134`: new :keyword:`raise` statement " +"syntax: :samp:`raise [{expr} [from {expr}]]`. See below." msgstr "" #: ../../whatsnew/3.0.rst:411 @@ -549,8 +549,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:417 msgid "" -"Change from :keyword:`except` *exc*, *var* to :keyword:`!except` *exc* :" -"keyword:`!as` *var*. See :pep:`3110`." +"Change from :keyword:`except` *exc*, *var* to :keyword:`!except` " +"*exc* :keyword:`!as` *var*. See :pep:`3110`." msgstr "" #: ../../whatsnew/3.0.rst:420 @@ -693,9 +693,10 @@ msgstr ":ref:`pep-0371`。" msgid "" ":ref:`pep-3101`. Note: the 2.6 description mentions the :meth:`format` " "method for both 8-bit and Unicode strings. In 3.0, only the :class:`str` " -"type (text strings with Unicode support) supports this method; the :class:" -"`bytes` type does not. The plan is to eventually make this the only API for " -"string formatting, and to start deprecating the ``%`` operator in Python 3.1." +"type (text strings with Unicode support) supports this method; " +"the :class:`bytes` type does not. The plan is to eventually make this the " +"only API for string formatting, and to start deprecating the ``%`` operator " +"in Python 3.1." msgstr "" #: ../../whatsnew/3.0.rst:507 @@ -723,11 +724,11 @@ msgid "" ":ref:`pep-3116`. The :mod:`io` module is now the standard way of doing file " "I/O. The built-in :func:`open` function is now an alias for :func:`io.open` " "and has additional keyword arguments *encoding*, *errors*, *newline* and " -"*closefd*. Also note that an invalid *mode* argument now raises :exc:" -"`ValueError`, not :exc:`IOError`. The binary file object underlying a text " -"file object can be accessed as :attr:`!f.buffer` (but beware that the text " -"object maintains a buffer of itself in order to speed up the encoding and " -"decoding operations)." +"*closefd*. Also note that an invalid *mode* argument now " +"raises :exc:`ValueError`, not :exc:`IOError`. The binary file object " +"underlying a text file object can be accessed as :attr:`!f.buffer` (but " +"beware that the text object maintains a buffer of itself in order to speed " +"up the encoding and decoding operations)." msgstr "" #: ../../whatsnew/3.0.rst:529 @@ -738,12 +739,12 @@ msgstr "" #: ../../whatsnew/3.0.rst:533 msgid "" -":ref:`pep-3119`. The :mod:`abc` module and the ABCs defined in the :mod:" -"`collections` module plays a somewhat more prominent role in the language " -"now, and built-in collection types like :class:`dict` and :class:`list` " -"conform to the :class:`collections.MutableMapping <collections.abc." -"MutableMapping>` and :class:`collections.MutableSequence <collections.abc." -"MutableSequence>` ABCs, respectively." +":ref:`pep-3119`. The :mod:`abc` module and the ABCs defined in " +"the :mod:`collections` module plays a somewhat more prominent role in the " +"language now, and built-in collection types like :class:`dict` " +"and :class:`list` conform to the :class:`collections.MutableMapping " +"<collections.abc.MutableMapping>` and :class:`collections.MutableSequence " +"<collections.abc.MutableSequence>` ABCs, respectively." msgstr "" #: ../../whatsnew/3.0.rst:539 @@ -789,8 +790,8 @@ msgid "" "The :mod:`!bsddb3` package was removed because its presence in the core " "standard library has proved over time to be a particular burden for the core " "developers due to testing instability and Berkeley DB's release schedule. " -"However, the package is alive and well, externally maintained at https://www." -"jcea.es/programacion/pybsddb.htm." +"However, the package is alive and well, externally maintained at https://" +"www.jcea.es/programacion/pybsddb.htm." msgstr "" #: ../../whatsnew/3.0.rst:572 @@ -895,8 +896,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:606 msgid "" -":mod:`dbm` (:mod:`!anydbm`, :mod:`!dbhash`, :mod:`!dbm`, :mod:`!dumbdbm`, :" -"mod:`!gdbm`, :mod:`!whichdb`)." +":mod:`dbm` (:mod:`!anydbm`, :mod:`!dbhash`, :mod:`!dbm`, :mod:`!" +"dumbdbm`, :mod:`!gdbm`, :mod:`!whichdb`)." msgstr "" ":mod:`dbm`\\ (:mod:`!anydbm`、:mod:`!dbhash`、:mod:`!dbm`、:mod:`!" "dumbdbm`、:mod:`!gdbm`、:mod:`!whichdb`\\ )。" @@ -949,17 +950,18 @@ msgstr "移除 :mod:`!sets`。請使用內建的 :func:`set` 類別。" #: ../../whatsnew/3.0.rst:631 msgid "" -"Cleanup of the :mod:`sys` module: removed :func:`!sys.exitfunc`, :func:`!sys." -"exc_clear`, :data:`!sys.exc_type`, :data:`!sys.exc_value`, :data:`!sys." -"exc_traceback`. (Note that :data:`sys.last_type` etc. remain.)" +"Cleanup of the :mod:`sys` module: removed :func:`!sys.exitfunc`, :func:`!" +"sys.exc_clear`, :data:`!sys.exc_type`, :data:`!sys.exc_value`, :data:`!" +"sys.exc_traceback`. (Note that :data:`sys.last_type` etc. remain.)" msgstr "" #: ../../whatsnew/3.0.rst:636 msgid "" "Cleanup of the :class:`array.array` type: the :meth:`!read` and :meth:`!" -"write` methods are gone; use :meth:`~array.array.fromfile` and :meth:`~array." -"array.tofile` instead. Also, the ``'c'`` typecode for array is gone -- use " -"either ``'b'`` for bytes or ``'u'`` for Unicode characters." +"write` methods are gone; use :meth:`~array.array.fromfile` " +"and :meth:`~array.array.tofile` instead. Also, the ``'c'`` typecode for " +"array is gone -- use either ``'b'`` for bytes or ``'u'`` for Unicode " +"characters." msgstr "" #: ../../whatsnew/3.0.rst:642 @@ -973,8 +975,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:645 msgid "" "Cleanup of the :mod:`!thread` module: :func:`!acquire_lock` and :func:`!" -"release_lock` are gone; use :meth:`~threading.Lock.acquire` and :meth:" -"`~threading.Lock.release` instead." +"release_lock` are gone; use :meth:`~threading.Lock.acquire` " +"and :meth:`~threading.Lock.release` instead." msgstr "" #: ../../whatsnew/3.0.rst:649 @@ -988,8 +990,8 @@ msgstr "移除 :mod:`!new` 模組。" #: ../../whatsnew/3.0.rst:653 msgid "" -"The functions :func:`!os.tmpnam`, :func:`!os.tempnam` and :func:`!os." -"tmpfile` have been removed in favor of the :mod:`tempfile` module." +"The functions :func:`!os.tmpnam`, :func:`!os.tempnam` and :func:`!" +"os.tmpfile` have been removed in favor of the :mod:`tempfile` module." msgstr "" #: ../../whatsnew/3.0.rst:657 @@ -1000,10 +1002,10 @@ msgstr "" #: ../../whatsnew/3.0.rst:661 msgid "" -":data:`!string.letters` and its friends (:data:`!string.lowercase` and :data:" -"`!string.uppercase`) are gone. Use :data:`string.ascii_letters` etc. " -"instead. (The reason for the removal is that :data:`!string.letters` and " -"friends had locale-specific behavior, which is a bad idea for such " +":data:`!string.letters` and its friends (:data:`!string.lowercase` " +"and :data:`!string.uppercase`) are gone. Use :data:`string.ascii_letters` " +"etc. instead. (The reason for the removal is that :data:`!string.letters` " +"and friends had locale-specific behavior, which is a bad idea for such " "attractively named global \"constants\".)" msgstr "" @@ -1011,8 +1013,8 @@ msgstr "" msgid "" "Renamed module :mod:`!__builtin__` to :mod:`builtins` (removing the " "underscores, adding an 's'). The :data:`!__builtins__` variable found in " -"most global namespaces is unchanged. To modify a builtin, you should use :" -"mod:`builtins`, not :data:`!__builtins__`!" +"most global namespaces is unchanged. To modify a builtin, you should " +"use :mod:`builtins`, not :data:`!__builtins__`!" msgstr "" #: ../../whatsnew/3.0.rst:675 @@ -1039,21 +1041,22 @@ msgstr "" #: ../../whatsnew/3.0.rst:690 msgid "" -":pep:`352`: All exceptions must be derived (directly or indirectly) from :" -"exc:`BaseException`. This is the root of the exception hierarchy. This is " -"not new as a recommendation, but the *requirement* to inherit from :exc:" -"`BaseException` is new. (Python 2.6 still allowed classic classes to be " -"raised, and placed no restriction on what you can catch.) As a consequence, " -"string exceptions are finally truly and utterly dead." +":pep:`352`: All exceptions must be derived (directly or indirectly) " +"from :exc:`BaseException`. This is the root of the exception hierarchy. " +"This is not new as a recommendation, but the *requirement* to inherit " +"from :exc:`BaseException` is new. (Python 2.6 still allowed classic classes " +"to be raised, and placed no restriction on what you can catch.) As a " +"consequence, string exceptions are finally truly and utterly dead." msgstr "" #: ../../whatsnew/3.0.rst:698 msgid "" -"Almost all exceptions should actually derive from :exc:`Exception`; :exc:" -"`BaseException` should only be used as a base class for exceptions that " -"should only be handled at the top level, such as :exc:`SystemExit` or :exc:" -"`KeyboardInterrupt`. The recommended idiom for handling all exceptions " -"except for this latter category is to use :keyword:`except` :exc:`Exception`." +"Almost all exceptions should actually derive " +"from :exc:`Exception`; :exc:`BaseException` should only be used as a base " +"class for exceptions that should only be handled at the top level, such " +"as :exc:`SystemExit` or :exc:`KeyboardInterrupt`. The recommended idiom for " +"handling all exceptions except for this latter category is to " +"use :keyword:`except` :exc:`Exception`." msgstr "" #: ../../whatsnew/3.0.rst:705 @@ -1062,8 +1065,8 @@ msgstr ":exc:`!StandardError` 已被移除。" #: ../../whatsnew/3.0.rst:707 msgid "" -"Exceptions no longer behave as sequences. Use the :attr:`~BaseException." -"args` attribute instead." +"Exceptions no longer behave as sequences. Use " +"the :attr:`~BaseException.args` attribute instead." msgstr "" #: ../../whatsnew/3.0.rst:710 @@ -1079,8 +1082,8 @@ msgstr "" msgid "" ":pep:`3110`: Catching exceptions. You must now use :samp:`except " "{SomeException} as {variable}` instead of :samp:`except {SomeException}, " -"{variable}`. Moreover, the *variable* is explicitly deleted when the :" -"keyword:`except` block is left." +"{variable}`. Moreover, the *variable* is explicitly deleted when " +"the :keyword:`except` block is left." msgstr "" #: ../../whatsnew/3.0.rst:722 @@ -1104,19 +1107,19 @@ msgid "" "object, probably an exception that was previously caught). In this case, the " "primary exception is stored on the :attr:`~BaseException.__cause__` " "attribute of the secondary exception. The traceback printed when an " -"unhandled exception occurs walks the chain of :attr:`!__cause__` and :attr:" -"`~BaseException.__context__` attributes and prints a separate traceback for " -"each component of the chain, with the primary exception at the top. (Java " -"users may recognize this behavior.)" +"unhandled exception occurs walks the chain of :attr:`!__cause__` " +"and :attr:`~BaseException.__context__` attributes and prints a separate " +"traceback for each component of the chain, with the primary exception at the " +"top. (Java users may recognize this behavior.)" msgstr "" #: ../../whatsnew/3.0.rst:743 msgid "" -":pep:`3134`: Exception objects now store their traceback as the :attr:" -"`~BaseException.__traceback__` attribute. This means that an exception " -"object now contains all the information pertaining to an exception, and " -"there are fewer reasons to use :func:`sys.exc_info` (though the latter is " -"not removed)." +":pep:`3134`: Exception objects now store their traceback as " +"the :attr:`~BaseException.__traceback__` attribute. This means that an " +"exception object now contains all the information pertaining to an " +"exception, and there are fewer reasons to use :func:`sys.exc_info` (though " +"the latter is not removed)." msgstr "" #: ../../whatsnew/3.0.rst:749 @@ -1136,8 +1139,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:761 msgid "" -"``!=`` now returns the opposite of ``==``, unless ``==`` returns :data:" -"`NotImplemented`." +"``!=`` now returns the opposite of ``==``, unless ``==`` " +"returns :data:`NotImplemented`." msgstr "" #: ../../whatsnew/3.0.rst:764 @@ -1157,15 +1160,15 @@ msgstr "" #: ../../whatsnew/3.0.rst:774 msgid "" -":pep:`3114`: the standard :meth:`next` method has been renamed to :meth:" -"`~iterator.__next__`." +":pep:`3114`: the standard :meth:`next` method has been renamed " +"to :meth:`~iterator.__next__`." msgstr "" #: ../../whatsnew/3.0.rst:777 msgid "" -"The :meth:`!__oct__` and :meth:`!__hex__` special methods are removed -- :" -"func:`oct` and :func:`hex` use :meth:`~object.__index__` now to convert the " -"argument to an integer." +"The :meth:`!__oct__` and :meth:`!__hex__` special methods are removed " +"-- :func:`oct` and :func:`hex` use :meth:`~object.__index__` now to convert " +"the argument to an integer." msgstr "" #: ../../whatsnew/3.0.rst:781 @@ -1174,14 +1177,14 @@ msgstr "移除對 :attr:`!__members__` 和 :attr:`!__methods__` 的支援。" #: ../../whatsnew/3.0.rst:783 msgid "" -"The function attributes named :attr:`!func_X` have been renamed to use the :" -"attr:`!__X__` form, freeing up these names in the function attribute " -"namespace for user-defined attributes. To wit, :attr:`!func_closure`, :attr:" -"`!func_code`, :attr:`!func_defaults`, :attr:`!func_dict`, :attr:`!" -"func_doc`, :attr:`!func_globals`, :attr:`!func_name` were renamed to :attr:" -"`~function.__closure__`, :attr:`~function.__code__`, :attr:`~function." -"__defaults__`, :attr:`~function.__dict__`, :attr:`~function.__doc__`, :attr:" -"`~function.__globals__`, :attr:`~function.__name__`, respectively." +"The function attributes named :attr:`!func_X` have been renamed to use " +"the :attr:`!__X__` form, freeing up these names in the function attribute " +"namespace for user-defined attributes. To wit, :attr:`!" +"func_closure`, :attr:`!func_code`, :attr:`!func_defaults`, :attr:`!" +"func_dict`, :attr:`!func_doc`, :attr:`!func_globals`, :attr:`!func_name` " +"were renamed " +"to :attr:`~function.__closure__`, :attr:`~function.__code__`, :attr:`~function.__defaults__`, :attr:`~function.__dict__`, :attr:`~function.__doc__`, :attr:`~function.__globals__`, :attr:`~function.__name__`, " +"respectively." msgstr "" #: ../../whatsnew/3.0.rst:794 @@ -1212,8 +1215,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:811 msgid "" -"A new built-in function :func:`next` was added to call the :meth:`~iterator." -"__next__` method on an object." +"A new built-in function :func:`next` was added to call " +"the :meth:`~iterator.__next__` method on an object." msgstr "" #: ../../whatsnew/3.0.rst:814 @@ -1251,8 +1254,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:835 msgid "" -"Removed :func:`!execfile`. Instead of ``execfile(fn)`` use ``exec(open(fn)." -"read())``." +"Removed :func:`!execfile`. Instead of ``execfile(fn)`` use " +"``exec(open(fn).read())``." msgstr "" "移除 :func:`!execfile`。請使用 ``exec(open(fn).read())`` 來替換 " "``execfile(fn)``。" @@ -1281,7 +1284,7 @@ msgstr "" #: ../../whatsnew/3.0.rst:854 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.0.rst:856 msgid "" @@ -1319,9 +1322,9 @@ msgstr "" #: ../../whatsnew/3.0.rst:873 msgid "" -"New C API :c:func:`PyImport_ImportModuleNoBlock`, works like :c:func:" -"`PyImport_ImportModule` but won't block on the import lock (returning an " -"error instead)." +"New C API :c:func:`PyImport_ImportModuleNoBlock`, works " +"like :c:func:`PyImport_ImportModule` but won't block on the import lock " +"(returning an error instead)." msgstr "" #: ../../whatsnew/3.0.rst:877 @@ -1339,7 +1342,7 @@ msgstr "" #: ../../whatsnew/3.0.rst:886 msgid "Performance" -msgstr "" +msgstr "效能" #: ../../whatsnew/3.0.rst:888 msgid "" @@ -1387,8 +1390,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:920 msgid "" "It is not recommended to try to write source code that runs unchanged under " -"both Python 2.6 and 3.0; you'd have to use a very contorted coding style, e." -"g. avoiding ``print`` statements, metaclasses, and much more. If you are " +"both Python 2.6 and 3.0; you'd have to use a very contorted coding style, " +"e.g. avoiding ``print`` statements, metaclasses, and much more. If you are " "maintaining a library that needs to support both Python 2.6 and Python 3.0, " "the best approach is to modify step 3 above by editing the 2.6 version of " "the source code and running the ``2to3`` translator again, rather than " diff --git a/whatsnew/3.1.po b/whatsnew/3.1.po index df59f43bf2..627d4d2ac6 100644 --- a/whatsnew/3.1.po +++ b/whatsnew/3.1.po @@ -46,8 +46,8 @@ msgid "" "Regular Python dictionaries iterate over key/value pairs in arbitrary order. " "Over the years, a number of authors have written alternative implementations " "that remember the order that the keys were originally inserted. Based on " -"the experiences from those implementations, a new :class:`collections." -"OrderedDict` class has been introduced." +"the experiences from those implementations, a " +"new :class:`collections.OrderedDict` class has been introduced." msgstr "" #: ../../whatsnew/3.1.rst:62 @@ -139,8 +139,8 @@ msgstr "" #: ../../whatsnew/3.1.rst:123 msgid "" -"The supported types are :class:`int`, :class:`float`, :class:`complex` and :" -"class:`decimal.Decimal`." +"The supported types are :class:`int`, :class:`float`, :class:`complex` " +"and :class:`decimal.Decimal`." msgstr "" #: ../../whatsnew/3.1.rst:126 @@ -243,10 +243,10 @@ msgstr "(由 Eric Smith 貢獻;:issue:`5237`。)" msgid "" "The :func:`!string.maketrans` function is deprecated and is replaced by new " "static methods, :meth:`bytes.maketrans` and :meth:`bytearray.maketrans`. " -"This change solves the confusion around which types were supported by the :" -"mod:`string` module. Now, :class:`str`, :class:`bytes`, and :class:" -"`bytearray` each have their own **maketrans** and **translate** methods with " -"intermediate translation tables of the appropriate type." +"This change solves the confusion around which types were supported by " +"the :mod:`string` module. Now, :class:`str`, :class:`bytes`, " +"and :class:`bytearray` each have their own **maketrans** and **translate** " +"methods with intermediate translation tables of the appropriate type." msgstr "" #: ../../whatsnew/3.1.rst:184 @@ -438,13 +438,13 @@ msgstr "(由 Raymond Hettinger 和 Mark Dickinso 貢獻。)" #: ../../whatsnew/3.1.rst:285 msgid "" -"The :mod:`itertools` module grew two new functions. The :func:`itertools." -"combinations_with_replacement` function is one of four for generating " -"combinatorics including permutations and Cartesian products. The :func:" -"`itertools.compress` function mimics its namesake from APL. Also, the " -"existing :func:`itertools.count` function now has an optional *step* " -"argument and can accept any type of counting sequence including :class:" -"`fractions.Fraction` and :class:`decimal.Decimal`::" +"The :mod:`itertools` module grew two new functions. " +"The :func:`itertools.combinations_with_replacement` function is one of four " +"for generating combinatorics including permutations and Cartesian products. " +"The :func:`itertools.compress` function mimics its namesake from APL. Also, " +"the existing :func:`itertools.count` function now has an optional *step* " +"argument and can accept any type of counting sequence " +"including :class:`fractions.Fraction` and :class:`decimal.Decimal`::" msgstr "" #: ../../whatsnew/3.1.rst:294 @@ -522,10 +522,11 @@ msgstr "(由 Gregory Smith 貢獻。)" #: ../../whatsnew/3.1.rst:330 msgid "" -"The :mod:`logging` module now implements a simple :class:`logging." -"NullHandler` class for applications that are not using logging but are " -"calling library code that does. Setting-up a null handler will suppress " -"spurious warnings such as \"No handlers could be found for logger foo\"::" +"The :mod:`logging` module now implements a " +"simple :class:`logging.NullHandler` class for applications that are not " +"using logging but are calling library code that does. Setting-up a null " +"handler will suppress spurious warnings such as \"No handlers could be found " +"for logger foo\"::" msgstr "" #: ../../whatsnew/3.1.rst:335 @@ -553,8 +554,8 @@ msgstr "(由 Andi Vajda 貢獻;:issue:`4195`。)" #: ../../whatsnew/3.1.rst:346 msgid "" -"The :mod:`pdb` module can now access and display source code loaded via :mod:" -"`zipimport` (or any other conformant :pep:`302` loader)." +"The :mod:`pdb` module can now access and display source code loaded " +"via :mod:`zipimport` (or any other conformant :pep:`302` loader)." msgstr "" #: ../../whatsnew/3.1.rst:349 @@ -631,13 +632,11 @@ msgstr "" #: ../../whatsnew/3.1.rst:383 msgid "" -"In addition, several new assertion methods were added including :meth:" -"`~unittest.TestCase.assertSetEqual`, :meth:`~unittest.TestCase." -"assertDictEqual`, :meth:`!assertDictContainsSubset`, :meth:`~unittest." -"TestCase.assertListEqual`, :meth:`~unittest.TestCase.assertTupleEqual`, :" -"meth:`~unittest.TestCase.assertSequenceEqual`, :meth:`assertRaisesRegexp() " -"<unittest.TestCase.assertRaisesRegex>`, :meth:`~unittest.TestCase." -"assertIsNone`, and :meth:`~unittest.TestCase.assertIsNotNone`." +"In addition, several new assertion methods were added " +"including :meth:`~unittest.TestCase.assertSetEqual`, :meth:`~unittest.TestCase.assertDictEqual`, :meth:`!" +"assertDictContainsSubset`, :meth:`~unittest.TestCase.assertListEqual`, :meth:`~unittest.TestCase.assertTupleEqual`, :meth:`~unittest.TestCase.assertSequenceEqual`, :meth:`assertRaisesRegexp() " +"<unittest.TestCase.assertRaisesRegex>`, :meth:`~unittest.TestCase.assertIsNone`, " +"and :meth:`~unittest.TestCase.assertIsNotNone`." msgstr "" #: ../../whatsnew/3.1.rst:394 @@ -771,8 +770,8 @@ msgstr "" #: ../../whatsnew/3.1.rst:469 msgid "" -"(Contributed by Antoine Pitrou along with a number of other participants, :" -"issue:`4753`)." +"(Contributed by Antoine Pitrou along with a number of other " +"participants, :issue:`4753`)." msgstr "(由 Antoine Pitrou 和其他一些參與者共同貢獻,:issue:`4753`)。" #: ../../whatsnew/3.1.rst:472 @@ -828,11 +827,11 @@ msgstr "(由 Roger D. Serwy 貢獻;:issue:`5150`。)" #: ../../whatsnew/3.1.rst:500 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.1.rst:502 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/3.1.rst:504 msgid "" @@ -882,7 +881,7 @@ msgstr "(由 Mark Dickinson 和 Lisandro Dalcrin 貢獻;:issue:`5175`。)" #: ../../whatsnew/3.1.rst:530 msgid "" "Deprecated :c:func:`!PyNumber_Int`. Use :c:func:`PyNumber_Long` instead." -msgstr "" +msgstr "已棄用 :c:func:`!PyNumber_Int`。請改用 :c:func:`PyNumber_Long`。" #: ../../whatsnew/3.1.rst:532 msgid "(Contributed by Mark Dickinson; :issue:`4910`.)" @@ -950,6 +949,25 @@ msgid "" " 2.718281828459045\n" "**********************************************************************" msgstr "" +"def e():\n" +" '''計算自然對數的底。\n" +"\n" +" >>> e()\n" +" 2.7182818284590451\n" +"\n" +" '''\n" +" return sum(1/math.factorial(x) for x in reversed(range(30)))\n" +"\n" +"doctest.testmod()\n" +"\n" +"**********************************************************************\n" +"Failed example:\n" +" e()\n" +"Expected:\n" +" 2.7182818284590451\n" +"Got:\n" +" 2.718281828459045\n" +"**********************************************************************" #: ../../whatsnew/3.1.rst:576 msgid "" diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index 544e4f9a1f..6413962e02 100644 --- a/whatsnew/3.10.po +++ b/whatsnew/3.10.po @@ -32,8 +32,8 @@ msgstr "Pablo Galindo Salgado" #: ../../whatsnew/3.10.rst:47 msgid "" "This article explains the new features in Python 3.10, compared to 3.9. " -"Python 3.10 was released on October 4, 2021. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.10 was released on October 4, 2021. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.10 與 3.9 相比多了哪些新功能。Python 3.10 已於 2021 年 " "10 月 4 日發布。有關完整詳細資訊,請參閱 :ref:`changelog <changelog>`。" @@ -216,15 +216,15 @@ msgstr "" #: ../../whatsnew/3.10.rst:142 msgid "" -"This new syntax uses the non LL(1) capacities of the new parser. Check :pep:" -"`617` for more details." +"This new syntax uses the non LL(1) capacities of the new parser. " +"Check :pep:`617` for more details." msgstr "" "此新語法使用新剖析器的非 LL(1) 功能。檢查 :pep:`617` 了解更多詳細資訊。" #: ../../whatsnew/3.10.rst:145 msgid "" -"(Contributed by Guido van Rossum, Pablo Galindo and Lysandros Nikolaou in :" -"issue:`12782` and :issue:`40334`.)" +"(Contributed by Guido van Rossum, Pablo Galindo and Lysandros Nikolaou " +"in :issue:`12782` and :issue:`40334`.)" msgstr "" "(由 Guido van Rossum、Pablo Galindo 和 Lysandros Nikolaou 在 :issue:`12782` " "和 :issue:`40334` 中貢獻。)" @@ -309,8 +309,8 @@ msgstr "這些改進是受到 PyPy 直譯器的啟發。" #: ../../whatsnew/3.10.rst:191 msgid "" -"(Contributed by Pablo Galindo in :issue:`42864` and Batuhan Taskaya in :" -"issue:`40176`.)" +"(Contributed by Pablo Galindo in :issue:`42864` and Batuhan Taskaya " +"in :issue:`40176`.)" msgstr "" "(由 Pablo Galindo 在 :issue:`42864` 和 Batuhan Taskaya 在 :issue:`40176` 中" "貢獻。)" @@ -718,12 +718,12 @@ msgstr "影格 (frame) 物件的 :attr:`~frame.f_lineno` 屬性總會包含預 msgid "" "The :attr:`~codeobject.co_lnotab` attribute of :ref:`code objects <code-" "objects>` is deprecated and will be removed in 3.12. Code that needs to " -"convert from offset to line number should use the new :meth:`~codeobject." -"co_lines` method instead." +"convert from offset to line number should use the " +"new :meth:`~codeobject.co_lines` method instead." msgstr "" ":ref:`程式碼物件 <code-objects>`\\ 的 :attr:`~codeobject.co_lnotab` 屬性已棄" -"用,並將在 3.12 中刪除。需要從偏移量轉換為列號的程式碼應使用新的 :meth:" -"`~codeobject.co_lines` 方法。" +"用,並將在 3.12 中刪除。需要從偏移量轉換為列號的程式碼應使用新" +"的 :meth:`~codeobject.co_lines` 方法。" #: ../../whatsnew/3.10.rst:412 msgid "PEP 634: Structural Pattern Matching" @@ -1220,8 +1220,8 @@ msgstr "" #: ../../whatsnew/3.10.rst:684 msgid "" -"For the full specification see :pep:`634`. Motivation and rationale are in :" -"pep:`635`, and a longer tutorial is in :pep:`636`." +"For the full specification see :pep:`634`. Motivation and rationale are " +"in :pep:`635`, and a longer tutorial is in :pep:`636`." msgstr "" "有關完整規範,請參閱 :pep:`634`。動機和基本原理位於 :pep:`635` 中,較完整的教" "學位於 :pep:`636` 中。" @@ -1254,9 +1254,9 @@ msgid "" "emitted when :data:`sys.flags.warn_default_encoding <sys.flags>` is true and " "locale-specific default encoding is used." msgstr "" -"為了發現這種錯誤,新增了一個可選的 ``EncodingWarning``。當 :data:`sys.flags." -"warn_default_encoding <sys.flags>` 為 true 且使用特定於語言環境的預設編碼時," -"會發出該信號。" +"為了發現這種錯誤,新增了一個可選的 ``EncodingWarning``。" +"當 :data:`sys.flags.warn_default_encoding <sys.flags>` 為 true 且使用特定於語" +"言環境的預設編碼時,會發出該信號。" #: ../../whatsnew/3.10.rst:706 msgid "" @@ -1276,8 +1276,8 @@ msgstr "與型別提示相關的新功能" #: ../../whatsnew/3.10.rst:716 msgid "" -"This section covers major changes affecting :pep:`484` type hints and the :" -"mod:`typing` module." +"This section covers major changes affecting :pep:`484` type hints and " +"the :mod:`typing` module." msgstr "本節介紹影響 :pep:`484` 型別提示和 :mod:`typing` 模組的主要更改。" #: ../../whatsnew/3.10.rst:721 @@ -1291,16 +1291,16 @@ msgid "" "of using :data:`typing.Union`, especially in type hints." msgstr "" "引入了一種新的聯集運算子,該運算子啟用像是 ``X | Y`` 的語法。這提供了一種在型" -"別提示中更清晰的方式來表達「型別 X 或型別 Y」,來取代使用 :data:`typing." -"Union`。" +"別提示中更清晰的方式來表達「型別 X 或型別 Y」,來取代使" +"用 :data:`typing.Union`。" #: ../../whatsnew/3.10.rst:727 msgid "" "In previous versions of Python, to apply a type hint for functions accepting " "arguments of multiple types, :data:`typing.Union` was used::" msgstr "" -"在以前版本的 Python 中,要使用接受多種型別參數之型別提示的函式,要使用 :data:" -"`typing.Union`: ::" +"在以前版本的 Python 中,要使用接受多種型別參數之型別提示的函式,要使" +"用 :data:`typing.Union`: ::" #: ../../whatsnew/3.10.rst:730 msgid "" @@ -1324,8 +1324,8 @@ msgstr "" #: ../../whatsnew/3.10.rst:740 msgid "" -"This new syntax is also accepted as the second argument to :func:" -"`isinstance` and :func:`issubclass`::" +"This new syntax is also accepted as the second argument " +"to :func:`isinstance` and :func:`issubclass`::" msgstr "" "這種新語法也接受作為 :func:`isinstance` 和 :func:`issubclass` 的第二個引" "數: ::" @@ -1388,12 +1388,11 @@ msgstr "" #: ../../whatsnew/3.10.rst:769 msgid "" -"See :class:`typing.Callable`, :class:`typing.ParamSpec`, :class:`typing." -"Concatenate`, :class:`typing.ParamSpecArgs`, :class:`typing." -"ParamSpecKwargs`, and :pep:`612` for more details." +"See :class:`typing.Callable`, :class:`typing.ParamSpec`, :class:`typing.Concatenate`, :class:`typing.ParamSpecArgs`, :class:`typing.ParamSpecKwargs`, " +"and :pep:`612` for more details." msgstr "" -"請參閱 :class:`typing.Callable`、:class:`typing.ParamSpec`、:class:`typing." -"Concatenate`、:class:`typing.ParamSpecArgs`、:class:`typing.ParamSpecKwargs` " +"請參" +"閱 :class:`typing.Callable`、:class:`typing.ParamSpec`、:class:`typing.Concatenate`、:class:`typing.ParamSpecArgs`、:class:`typing.ParamSpecKwargs` " "和 :pep:`612` 以了解更多詳情。" #: ../../whatsnew/3.10.rst:773 @@ -1457,8 +1456,8 @@ msgstr "PEP 647:使用者定義的型別防護" msgid "" ":data:`~typing.TypeGuard` has been added to the :mod:`typing` module to " "annotate type guard functions and improve information provided to static " -"type checkers during type narrowing. For more information, please see :data:" -"`~typing.TypeGuard`\\ 's documentation, and :pep:`647`." +"type checkers during type narrowing. For more information, please " +"see :data:`~typing.TypeGuard`\\ 's documentation, and :pep:`647`." msgstr "" ":data:`~typing.TypeGuard`\\ (型別防護)已新增到 :mod:`typing` 模組中,用以註" "釋型別防護函式並改進在型別窄縮 (type narrowing) 期間提供給靜態型別檢查器的資" @@ -1483,20 +1482,20 @@ msgid "" "population count. (Contributed by Niklas Fiekas in :issue:`29882`.)" msgstr "" ":class:`int` 型別有一個新方法 :meth:`int.bit_count`,回傳給定整數的二進位展開" -"式中 1 的數量,也稱為總體計數 (population count)。(由 Niklas Fiekas 在 :" -"issue:`29882` 中貢獻。)" +"式中 1 的數量,也稱為總體計數 (population count)。(由 Niklas Fiekas " +"在 :issue:`29882` 中貢獻。)" #: ../../whatsnew/3.10.rst:816 msgid "" -"The views returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:`dict." -"items` now all have a ``mapping`` attribute that gives a :class:`types." -"MappingProxyType` object wrapping the original dictionary. (Contributed by " -"Dennis Sweeney in :issue:`40890`.)" +"The views returned by :meth:`dict.keys`, :meth:`dict.values` " +"and :meth:`dict.items` now all have a ``mapping`` attribute that gives " +"a :class:`types.MappingProxyType` object wrapping the original dictionary. " +"(Contributed by Dennis Sweeney in :issue:`40890`.)" msgstr "" ":meth:`dict.keys`、:meth:`dict.values` 和 :meth:`dict.items` 回傳的視圖 " -"(view) 現在都有一個 ``mapping`` 屬性,該屬性提供 :class:`types." -"MappingProxyType` 包裝原始的字典物件。(由 Dennis Sweeney 在 :issue:`40890` " -"中貢獻。)" +"(view) 現在都有一個 ``mapping`` 屬性,該屬性提" +"供 :class:`types.MappingProxyType` 包裝原始的字典物件。(由 Dennis Sweeney " +"在 :issue:`40890` 中貢獻。)" #: ../../whatsnew/3.10.rst:821 msgid "" @@ -1511,13 +1510,15 @@ msgid "" "Builtin and extension functions that take integer arguments no longer " "accept :class:`~decimal.Decimal`\\ s, :class:`~fractions.Fraction`\\ s and " "other objects that can be converted to integers only with a loss (e.g. that " -"have the :meth:`~object.__int__` method but do not have the :meth:`~object." -"__index__` method). (Contributed by Serhiy Storchaka in :issue:`37999`.)" -msgstr "" -"採用整數引數的內建函式和擴充函式不再接受 :class:`~decimal.Decimal`、:class:" -"`~fractions.Fraction` 以及其他只能在有損失的情況下轉換為整數的物件(例如有 :" -"meth:`~object.__int__` 方法,但沒有 :meth:`~object.__index__` 方法)。(由 " -"Serhiy Storchaka 在 :issue:`37999` 中貢獻。)" +"have the :meth:`~object.__int__` method but do not have " +"the :meth:`~object.__index__` method). (Contributed by Serhiy Storchaka " +"in :issue:`37999`.)" +msgstr "" +"採用整數引數的內建函式和擴充函式不再接" +"受 :class:`~decimal.Decimal`、:class:`~fractions.Fraction` 以及其他只能在有損" +"失的情況下轉換為整數的物件(例如有 :meth:`~object.__int__` 方法,但沒" +"有 :meth:`~object.__index__` 方法)。(由 Serhiy Storchaka 在 :issue:`37999` " +"中貢獻。)" #: ../../whatsnew/3.10.rst:831 msgid "" @@ -1557,21 +1558,21 @@ msgid "" "respectively. (Contributed by Joshua Bronson, Daniel Pope, and Justin Wang " "in :issue:`31861`.)" msgstr "" -"新增兩個內建函式 -- :func:`aiter` 和 :func:`anext`,分別為 :func:`iter` 和 :" -"func:`next` 提供非同步的對應函式。(由 Joshua Bronson、Daniel Pope 和 Justin " -"Wang 在 :issue:`31861` 中貢獻。)" +"新增兩個內建函式 -- :func:`aiter` 和 :func:`anext`,分別為 :func:`iter` " +"和 :func:`next` 提供非同步的對應函式。(由 Joshua Bronson、Daniel Pope 和 " +"Justin Wang 在 :issue:`31861` 中貢獻。)" #: ../../whatsnew/3.10.rst:849 msgid "" -"Static methods (:func:`@staticmethod <staticmethod>`) and class methods (:" -"func:`@classmethod <classmethod>`) now inherit the method attributes " +"Static methods (:func:`@staticmethod <staticmethod>`) and class methods " +"(:func:`@classmethod <classmethod>`) now inherit the method attributes " "(``__module__``, ``__name__``, ``__qualname__``, ``__doc__``, " "``__annotations__``) and have a new ``__wrapped__`` attribute. Moreover, " "static methods are now callable as regular functions. (Contributed by Victor " "Stinner in :issue:`43682`.)" msgstr "" -"靜態方法 (:func:`@staticmethod <staticmethod>`) 和類別方法 (:func:" -"`@classmethod <classmethod>`) 現在繼承方法屬性 (``__module__``, " +"靜態方法 (:func:`@staticmethod <staticmethod>`) 和類別方法 " +"(:func:`@classmethod <classmethod>`) 現在繼承方法屬性 (``__module__``, " "``__name__``, ``__qualname__``, ``__doc__``, ``__annotations__``) 並有一個新" "的 ``__wrapped__`` 屬性。此外,靜態方法現在可以像是常規函式般呼叫。(由 " "Victor Stinner 在 :issue:`43682` 中貢獻。)" @@ -1580,8 +1581,8 @@ msgstr "" msgid "" "Annotations for complex targets (everything beside ``simple name`` targets " "defined by :pep:`526`) no longer cause any runtime effects with ``from " -"__future__ import annotations``. (Contributed by Batuhan Taskaya in :issue:" -"`42737`.)" +"__future__ import annotations``. (Contributed by Batuhan Taskaya " +"in :issue:`42737`.)" msgstr "" "複雜目標(除 :pep:`526` 定義的 ``simple name`` 目標之外的所有內容)的註釋不再" "使用 ``from __future__ import comments`` 造成任何執行環境 (runtime) 影響。" @@ -1597,15 +1598,15 @@ msgid "" msgstr "" "類別和模組物件現在會根據需求來延遲建立 (lazy-create) 空的註釋字典 " "(annotations dicts)。註釋字典存儲在物件的 ``__dict__`` 中以達成向後相容性。這" -"改進了 ``__annotations__`` 使用方式的最佳實踐方法;有關更多資訊,請參閱 :ref:" -"`annotations-howto`。(由 Larry Hastings 在 :issue:`43901` 中貢獻。)" +"改進了 ``__annotations__`` 使用方式的最佳實踐方法;有關更多資訊,請參" +"閱 :ref:`annotations-howto`。(由 Larry Hastings 在 :issue:`43901` 中貢獻。)" #: ../../whatsnew/3.10.rst:867 msgid "" "Annotations consist of ``yield``, ``yield from``, ``await`` or named " "expressions are now forbidden under ``from __future__ import annotations`` " -"due to their side effects. (Contributed by Batuhan Taskaya in :issue:" -"`42725`.)" +"due to their side effects. (Contributed by Batuhan Taskaya " +"in :issue:`42725`.)" msgstr "" "附名運算式或由 ``yield``、``yield from``、``await`` 組成的註釋現在在 ``from " "__future__ import comments`` 下被禁止,因為它們有些不預期的行為。(由 " @@ -1624,12 +1625,12 @@ msgstr "" #: ../../whatsnew/3.10.rst:877 msgid "" -"Hashes of NaN values of both :class:`float` type and :class:`decimal." -"Decimal` type now depend on object identity. Formerly, they always hashed to " -"``0`` even though NaN values are not equal to one another. This caused " -"potentially quadratic runtime behavior due to excessive hash collisions when " -"creating dictionaries and sets containing multiple NaNs. (Contributed by " -"Raymond Hettinger in :issue:`43475`.)" +"Hashes of NaN values of both :class:`float` type " +"and :class:`decimal.Decimal` type now depend on object identity. Formerly, " +"they always hashed to ``0`` even though NaN values are not equal to one " +"another. This caused potentially quadratic runtime behavior due to excessive " +"hash collisions when creating dictionaries and sets containing multiple " +"NaNs. (Contributed by Raymond Hettinger in :issue:`43475`.)" msgstr "" ":class:`float` 型別和 :class:`decimal.Decimal` 型別的 NaN 值的雜湊值現在取決" "於物件的標識值 (identity)。以前即使 NaN 值彼此不相等,它們也總是被雜湊為 " @@ -1640,11 +1641,11 @@ msgstr "" #: ../../whatsnew/3.10.rst:884 msgid "" "A :exc:`SyntaxError` (instead of a :exc:`NameError`) will be raised when " -"deleting the :const:`__debug__` constant. (Contributed by Donghee Na in :" -"issue:`45000`.)" +"deleting the :const:`__debug__` constant. (Contributed by Donghee Na " +"in :issue:`45000`.)" msgstr "" -"刪除 :const:`__debug__` 常數時將引發 :exc:`SyntaxError` (而不是 :exc:" -"`NameError`)。(由 Donghee Na 在 :issue:`45000` 中貢獻。)" +"刪除 :const:`__debug__` 常數時將引發 :exc:`SyntaxError` (而不" +"是 :exc:`NameError`)。(由 Donghee Na 在 :issue:`45000` 中貢獻。)" #: ../../whatsnew/3.10.rst:887 msgid "" @@ -1673,9 +1674,9 @@ msgstr "asyncio" #: ../../whatsnew/3.10.rst:903 msgid "" -"Add missing :meth:`~asyncio.events.AbstractEventLoop." -"connect_accepted_socket` method. (Contributed by Alex Grönholm in :issue:" -"`41332`.)" +"Add " +"missing :meth:`~asyncio.events.AbstractEventLoop.connect_accepted_socket` " +"method. (Contributed by Alex Grönholm in :issue:`41332`.)" msgstr "" "新增缺少的 :meth:`~asyncio.events.AbstractEventLoop.connect_accepted_socket` " "方法。(由 Alex Grönholm 在 :issue:`41332` 中貢獻。)" @@ -1705,8 +1706,8 @@ msgid "" "Zackery Spytz in :issue:`31956`.)" msgstr "" ":class:`array.array` 的 :meth:`~array.array.index` 方法現在具有可選的 " -"*start* 和 *stop* 參數。(由 Anders Lorentsen 和 Zackery Spytz 在 :issue:" -"`31956` 中貢獻。)" +"*start* 和 *stop* 參數。(由 Anders Lorentsen 和 Zackery Spytz " +"在 :issue:`31956` 中貢獻。)" #: ../../whatsnew/3.10.rst:921 msgid "asynchat, asyncore, smtpd" @@ -1718,8 +1719,8 @@ msgid "" "since Python 3.6. An import-time :class:`DeprecationWarning` has now been " "added to all three of these modules." msgstr "" -"自 Python 3.6 起,這些模組在其文件中被標記為已棄用。引入時的 :class:" -"`DeprecationWarning` 現已新增到這三個模組中。" +"自 Python 3.6 起,這些模組在其文件中被標記為已棄用。引入時" +"的 :class:`DeprecationWarning` 現已新增到這三個模組中。" #: ../../whatsnew/3.10.rst:927 msgid "base64" @@ -1751,8 +1752,9 @@ msgstr "bisect" #: ../../whatsnew/3.10.rst:941 msgid "" -"Added the possibility of providing a *key* function to the APIs in the :mod:" -"`bisect` module. (Contributed by Raymond Hettinger in :issue:`4356`.)" +"Added the possibility of providing a *key* function to the APIs in " +"the :mod:`bisect` module. (Contributed by Raymond Hettinger " +"in :issue:`4356`.)" msgstr "" "新增向 :mod:`bisect` 模組 API 提供 *key* 函式的可能性。(由 Raymond " "Hettinger 在 :issue:`4356` 中貢獻。)" @@ -1776,28 +1778,29 @@ msgstr "collections.abc" #: ../../whatsnew/3.10.rst:953 msgid "" "The ``__args__`` of the :ref:`parameterized generic <types-genericalias>` " -"for :class:`collections.abc.Callable` are now consistent with :data:`typing." -"Callable`. :class:`collections.abc.Callable` generic now flattens type " -"parameters, similar to what :data:`typing.Callable` currently does. This " -"means that ``collections.abc.Callable[[int, str], str]`` will have " -"``__args__`` of ``(int, str, str)``; previously this was ``([int, str], " +"for :class:`collections.abc.Callable` are now consistent " +"with :data:`typing.Callable`. :class:`collections.abc.Callable` generic now " +"flattens type parameters, similar to what :data:`typing.Callable` currently " +"does. This means that ``collections.abc.Callable[[int, str], str]`` will " +"have ``__args__`` of ``(int, str, str)``; previously this was ``([int, str], " "str)``. To allow this change, :class:`types.GenericAlias` can now be " -"subclassed, and a subclass will be returned when subscripting the :class:" -"`collections.abc.Callable` type. Note that a :exc:`TypeError` may be raised " -"for invalid forms of parameterizing :class:`collections.abc.Callable` which " -"may have passed silently in Python 3.9. (Contributed by Ken Jin in :issue:" -"`42195`.)" +"subclassed, and a subclass will be returned when subscripting " +"the :class:`collections.abc.Callable` type. Note that a :exc:`TypeError` " +"may be raised for invalid forms of " +"parameterizing :class:`collections.abc.Callable` which may have passed " +"silently in Python 3.9. (Contributed by Ken Jin in :issue:`42195`.)" msgstr "" ":class:`collections.abc.Callable` 的\\ :ref:`參數化泛型 (parameterized " -"generic) <types-genericalias>` 的 ``__args__`` 現在與 :data:`typing." -"Callable` 一致。:class:`collections.abc.Callable` 泛型現在會將型別參數攤平," -"類似於 :data:`typing.Callable` 目前的做法。這意味著 ``collections.abc." -"Callable[[int, str], str]`` 將具有 ``(int, str, str)`` 的 ``__args__``;在以" -"前這是 ``([int, str], str)``。為了允許此更改,現在可以對 :class:`types." -"GenericAlias` 進行子類別化,並且在下標 (subscript) :class:`collections.abc." -"Callable` 型別時將回傳子類別。請注意,對於無效形式的 :class:`collections.abc." -"Callable` 參數化可能會引發 :exc:`TypeError`,而在 Python 3.9 中該參數可能會無" -"引發例外地傳遞。(由 Ken Jin 在 :issue:`42195` 中貢獻。)" +"generic) <types-genericalias>` 的 ``__args__`` 現在" +"與 :data:`typing.Callable` 一致。:class:`collections.abc.Callable` 泛型現在會" +"將型別參數攤平,類似於 :data:`typing.Callable` 目前的做法。這意味著 " +"``collections.abc.Callable[[int, str], str]`` 將具有 ``(int, str, str)`` 的 " +"``__args__``;在以前這是 ``([int, str], str)``。為了允許此更改,現在可以" +"對 :class:`types.GenericAlias` 進行子類別化,並且在下標 " +"(subscript) :class:`collections.abc.Callable` 型別時將回傳子類別。請注意,對" +"於無效形式的 :class:`collections.abc.Callable` 參數化可能會引" +"發 :exc:`TypeError`,而在 Python 3.9 中該參數可能會無引發例外地傳遞。(由 " +"Ken Jin 在 :issue:`42195` 中貢獻。)" #: ../../whatsnew/3.10.rst:966 msgid "contextlib" @@ -1836,17 +1839,18 @@ msgstr "curses" #: ../../whatsnew/3.10.rst:981 msgid "" "The extended color functions added in ncurses 6.1 will be used transparently " -"by :func:`curses.color_content`, :func:`curses.init_color`, :func:`curses." -"init_pair`, and :func:`curses.pair_content`. A new function, :func:`curses." -"has_extended_color_support`, indicates whether extended color support is " -"provided by the underlying ncurses library. (Contributed by Jeffrey " -"Kintscher and Hans Petter Jansson in :issue:`36982`.)" -msgstr "" -"ncurses 6.1 中新增的擴充顏色函式將由 :func:`curses.color_content`、:func:" -"`curses.init_color`、:func:`curses.init_pair` 和 :func:`curses.pair_content` " -"透明地使用。新函式 :func:`curses.has_extended_color_support` 表示了底層的 " -"ncurses 函式庫是否支援擴充顏色。(由 Jeffrey Kintscher 和 Hans Petter " -"Jansson 在 :issue:`36982` 中貢獻。)" +"by :func:`curses.color_content`, :func:`curses.init_color`, :func:`curses.init_pair`, " +"and :func:`curses.pair_content`. A new " +"function, :func:`curses.has_extended_color_support`, indicates whether " +"extended color support is provided by the underlying ncurses library. " +"(Contributed by Jeffrey Kintscher and Hans Petter Jansson in :issue:`36982`.)" +msgstr "" +"ncurses 6.1 中新增的擴充顏色函式將" +"由 :func:`curses.color_content`、:func:`curses.init_color`、:func:`curses.init_pair` " +"和 :func:`curses.pair_content` 透明地使用。新函" +"式 :func:`curses.has_extended_color_support` 表示了底層的 ncurses 函式庫是否" +"支援擴充顏色。(由 Jeffrey Kintscher 和 Hans Petter Jansson " +"在 :issue:`36982` 中貢獻。)" #: ../../whatsnew/3.10.rst:988 msgid "" @@ -1991,18 +1995,18 @@ msgid "" "3.12. Its functionality for specifying package builds has already been " "completely replaced by third-party packages ``setuptools`` and " "``packaging``, and most other commonly used APIs are available elsewhere in " -"the standard library (such as :mod:`platform`, :mod:`shutil`, :mod:" -"`subprocess` or :mod:`sysconfig`). There are no plans to migrate any other " -"functionality from ``distutils``, and applications that are using other " -"functions should plan to make private copies of the code. Refer to :pep:" -"`632` for discussion." +"the standard library (such " +"as :mod:`platform`, :mod:`shutil`, :mod:`subprocess` or :mod:`sysconfig`). " +"There are no plans to migrate any other functionality from ``distutils``, " +"and applications that are using other functions should plan to make private " +"copies of the code. Refer to :pep:`632` for discussion." msgstr "" "整個 ``distutils`` 套件已被棄用,將在 Python 3.12 中刪除。它指定套件建置的功" "能已經完全被第三方套件 ``setuptools`` 和 ``packaging`` 所取代,並且大多數其他" -"常用的 API 都可以在標準函式庫的其他地方被找到(例如 :mod:`platform` 、:mod:" -"`shutil`、:mod:`subprocess` 或 :mod:`sysconfig`)。目前沒有將 ``distutils`` " -"遷移任何其他地方的計畫,且使用其他功能的應用程式應該開始規劃如何取得程式碼的" -"私有副本。請參閱 :pep:`632` 的討論。" +"常用的 API 都可以在標準函式庫的其他地方被找到(例" +"如 :mod:`platform` 、:mod:`shutil`、:mod:`subprocess` 或 :mod:`sysconfig`)。" +"目前沒有將 ``distutils`` 遷移任何其他地方的計畫,且使用其他功能的應用程式應該" +"開始規劃如何取得程式碼的私有副本。請參閱 :pep:`632` 的討論。" #: ../../whatsnew/3.10.rst:1072 msgid "" @@ -2011,8 +2015,8 @@ msgid "" "Windows. (Contributed by Victor Stinner in :issue:`42802`.)" msgstr "" "Python 3.8 中不推薦使用的 ``bdist_wininst`` 命令已被刪除。現在建議使用 " -"``bdist_wheel`` 命令來在 Windows 上發布二進位套件。(由 Victor Stinner 在 :" -"issue:`42802` 中貢獻。)" +"``bdist_wheel`` 命令來在 Windows 上發布二進位套件。(由 Victor Stinner " +"在 :issue:`42802` 中貢獻。)" #: ../../whatsnew/3.10.rst:1078 msgid "doctest" @@ -2021,8 +2025,8 @@ msgstr "doctest" #: ../../whatsnew/3.10.rst:1080 ../../whatsnew/3.10.rst:1215 #: ../../whatsnew/3.10.rst:1242 ../../whatsnew/3.10.rst:1341 msgid "" -"When a module does not define ``__loader__``, fall back to ``__spec__." -"loader``. (Contributed by Brett Cannon in :issue:`42133`.)" +"When a module does not define ``__loader__``, fall back to " +"``__spec__.loader``. (Contributed by Brett Cannon in :issue:`42133`.)" msgstr "" "當模組未定義 ``__loader__`` 時,回退到 ``__spec__.loader`` 。(由 Brett " "Cannon 在 :issue:`42133` 中貢獻。)" @@ -2036,8 +2040,8 @@ msgid "" ":func:`encodings.normalize_encoding` now ignores non-ASCII characters. " "(Contributed by Hai Shi in :issue:`39337`.)" msgstr "" -":func:`encodings.normalize_encoding` 現在會忽略非 ASCII 字元。(Hai Shi 在 :" -"issue:`39337` 中貢獻。)" +":func:`encodings.normalize_encoding` 現在會忽略非 ASCII 字元。(Hai Shi " +"在 :issue:`39337` 中貢獻。)" #: ../../whatsnew/3.10.rst:1090 msgid "enum" @@ -2045,23 +2049,25 @@ msgstr "enum" #: ../../whatsnew/3.10.rst:1092 msgid "" -":class:`~enum.Enum` :func:`~object.__repr__` now returns ``enum_name." -"member_name`` and :func:`~object.__str__` now returns ``member_name``. " -"Stdlib enums available as module constants have a :func:`repr` of " -"``module_name.member_name``. (Contributed by Ethan Furman in :issue:`40066`.)" +":class:`~enum.Enum` :func:`~object.__repr__` now returns " +"``enum_name.member_name`` and :func:`~object.__str__` now returns " +"``member_name``. Stdlib enums available as module constants have " +"a :func:`repr` of ``module_name.member_name``. (Contributed by Ethan Furman " +"in :issue:`40066`.)" msgstr "" -":class:`~enum.Enum` :func:`~object.__repr__` 現在會回傳 ``enum_name." -"member_name`` 、:func:`~object.__str__` 現在會回傳 ``member_name`` 。可用作模" -"組常數的標準函式庫列舉會有 ``module_name.member_name`` 的 :func:`repr`。(由 " -"Ethan Furman 在 :issue:`40066` 中貢獻。)" +":class:`~enum.Enum` :func:`~object.__repr__` 現在會回傳 " +"``enum_name.member_name`` 、:func:`~object.__str__` 現在會回傳 " +"``member_name`` 。可用作模組常數的標準函式庫列舉會有 " +"``module_name.member_name`` 的 :func:`repr`。(由 Ethan Furman " +"在 :issue:`40066` 中貢獻。)" #: ../../whatsnew/3.10.rst:1097 msgid "" "Add :class:`enum.StrEnum` for enums where all members are strings. " "(Contributed by Ethan Furman in :issue:`41816`.)" msgstr "" -"新增 :class:`enum.StrEnum`,為所有成員都是字串的列舉。(由 Ethan Furman 在 :" -"issue:`41816` 中貢獻。)" +"新增 :class:`enum.StrEnum`,為所有成員都是字串的列舉。(由 Ethan Furman " +"在 :issue:`41816` 中貢獻。)" #: ../../whatsnew/3.10.rst:1101 msgid "fileinput" @@ -2069,8 +2075,9 @@ msgstr "fileinput" #: ../../whatsnew/3.10.rst:1103 msgid "" -"Add *encoding* and *errors* parameters in :func:`fileinput.input` and :class:" -"`fileinput.FileInput`. (Contributed by Inada Naoki in :issue:`43712`.)" +"Add *encoding* and *errors* parameters in :func:`fileinput.input` " +"and :class:`fileinput.FileInput`. (Contributed by Inada Naoki " +"in :issue:`43712`.)" msgstr "" "在 :func:`fileinput.input` 和 :class:`fileinput.FileInput` 中新增 *encoding* " "和 *errors* 參數。(由 Inada Naoki 在 :issue:`43712` 中貢獻。)" @@ -2092,8 +2099,8 @@ msgstr "faulthandler" #: ../../whatsnew/3.10.rst:1114 msgid "" "The :mod:`faulthandler` module now detects if a fatal error occurs during a " -"garbage collector collection. (Contributed by Victor Stinner in :issue:" -"`44466`.)" +"garbage collector collection. (Contributed by Victor Stinner " +"in :issue:`44466`.)" msgstr "" ":mod:`faulthandler` 模組現在可以檢測垃圾收集器 (garbage collector) 在收集期間" "是否發生嚴重錯誤。(由 Victor Stinner 在 :issue:`44466` 中貢獻。)" @@ -2104,12 +2111,13 @@ msgstr "gc" #: ../../whatsnew/3.10.rst:1121 msgid "" -"Add audit hooks for :func:`gc.get_objects`, :func:`gc.get_referrers` and :" -"func:`gc.get_referents`. (Contributed by Pablo Galindo in :issue:`43439`.)" +"Add audit hooks for :func:`gc.get_objects`, :func:`gc.get_referrers` " +"and :func:`gc.get_referents`. (Contributed by Pablo Galindo " +"in :issue:`43439`.)" msgstr "" -"為 :func:`gc.get_objects`、:func:`gc.get_referrers` 和 :func:`gc." -"get_referents` 新增稽核掛鉤 (audit hooks)。(由 Pablo Galindo 在 :issue:" -"`43439` 中貢獻。)" +"為 :func:`gc.get_objects`、:func:`gc.get_referrers` " +"和 :func:`gc.get_referents` 新增稽核掛鉤 (audit hooks)。(由 Pablo Galindo " +"在 :issue:`43439` 中貢獻。)" #: ../../whatsnew/3.10.rst:1125 msgid "glob" @@ -2117,9 +2125,9 @@ msgstr "glob" #: ../../whatsnew/3.10.rst:1127 msgid "" -"Add the *root_dir* and *dir_fd* parameters in :func:`~glob.glob` and :func:" -"`~glob.iglob` which allow to specify the root directory for searching. " -"(Contributed by Serhiy Storchaka in :issue:`38144`.)" +"Add the *root_dir* and *dir_fd* parameters in :func:`~glob.glob` " +"and :func:`~glob.iglob` which allow to specify the root directory for " +"searching. (Contributed by Serhiy Storchaka in :issue:`38144`.)" msgstr "" "在 :func:`~glob.glob` 和 :func:`~glob.iglob` 中新增 *root_dir* 和 *dir_fd* 參" "數,允許指定搜尋的根目錄。(由 Serhiy Storchaka 在 :issue:`38144` 中貢獻。)" @@ -2133,8 +2141,8 @@ msgid "" "The hashlib module requires OpenSSL 1.1.1 or newer. (Contributed by " "Christian Heimes in :pep:`644` and :issue:`43669`.)" msgstr "" -"hashlib 模組需要 OpenSSL 1.1.1 或更高版本。(由 Christian Heimes 在 :pep:" -"`644` 和 :issue:`43669` 中貢獻。)" +"hashlib 模組需要 OpenSSL 1.1.1 或更高版本。(由 Christian Heimes " +"在 :pep:`644` 和 :issue:`43669` 中貢獻。)" #: ../../whatsnew/3.10.rst:1137 msgid "" @@ -2151,8 +2159,8 @@ msgid "" "with OpenSSL support. (Contributed by Christian Heimes in :issue:`43880`.)" msgstr "" "純 Python 的 :func:`~hashlib.pbkdf2_hmac` 回退已被棄用。將來只有在有 OpenSSL " -"支援的建置 Python 中才能夠使用 PBKDF2-HMAC。(由 Christian Heimes 在 :issue:" -"`43880` 中貢獻。)" +"支援的建置 Python 中才能夠使用 PBKDF2-HMAC。(由 Christian Heimes " +"在 :issue:`43880` 中貢獻。)" #: ../../whatsnew/3.10.rst:1146 msgid "hmac" @@ -2163,8 +2171,8 @@ msgid "" "The hmac module now uses OpenSSL's HMAC implementation internally. " "(Contributed by Christian Heimes in :issue:`40645`.)" msgstr "" -"hmac 模組現在在內部使用 OpenSSL 的 HMAC 實作。(由 Christian Heimes 在 :" -"issue:`40645` 中貢獻。)" +"hmac 模組現在在內部使用 OpenSSL 的 HMAC 實作。(由 Christian Heimes " +"在 :issue:`40645` 中貢獻。)" #: ../../whatsnew/3.10.rst:1152 msgid "IDLE and idlelib" @@ -2173,8 +2181,8 @@ msgstr "IDLE 和 idlelib" #: ../../whatsnew/3.10.rst:1154 msgid "" "Make IDLE invoke :func:`sys.excepthook` (when started without '-n'). User " -"hooks were previously ignored. (Contributed by Ken Hilton in :issue:" -"`43008`.)" +"hooks were previously ignored. (Contributed by Ken Hilton " +"in :issue:`43008`.)" msgstr "" "讓 IDLE 叫用 :func:`sys.excepthook` (在沒有 ``-n`` 的情況下啟動時)。使用者" "掛鉤 (user hooks) 在以前是被忽略的。(由 Ken Hilton 在 :issue:`43008` 中貢" @@ -2185,10 +2193,10 @@ msgid "" "Rearrange the settings dialog. Split the General tab into Windows and Shell/" "Ed tabs. Move help sources, which extend the Help menu, to the Extensions " "tab. Make space for new options and shorten the dialog. The latter makes " -"the dialog better fit small screens. (Contributed by Terry Jan Reedy in :" -"issue:`40468`.) Move the indent space setting from the Font tab to the new " -"Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy in :issue:" -"`33962`.)" +"the dialog better fit small screens. (Contributed by Terry Jan Reedy " +"in :issue:`40468`.) Move the indent space setting from the Font tab to the " +"new Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy " +"in :issue:`33962`.)" msgstr "" "重新排列設定對話框。將 General 分頁拆分為 Windows 和 Shell/Ed 分頁。將擴充 " "Help 選單的幫助來源移至 Extensions 分頁。為新選項騰出空間並縮短對話框,而後者" @@ -2210,9 +2218,9 @@ msgid "" "the selected text. This option also appears on the context menu for the " "text. (Contributed by Tal Einat in :issue:`37903`.)" msgstr "" -"新增 Shell 側邊欄。將主要提示字元 (``>>>``) 移至側邊欄。將輔助提示字元(``..." -"``)新增到側邊欄。點擊左鍵再拖動能夠選擇一行或多行文字,和編輯器列號側邊欄操" -"作一樣。選擇文字列後點擊右鍵會顯示帶有「一併複製提示字元 (copy with " +"新增 Shell 側邊欄。將主要提示字元 (``>>>``) 移至側邊欄。將輔助提示字元" +"(``...``)新增到側邊欄。點擊左鍵再拖動能夠選擇一行或多行文字,和編輯器列號側" +"邊欄操作一樣。選擇文字列後點擊右鍵會顯示帶有「一併複製提示字元 (copy with " "prompts)」的情境選單,這會將側邊欄中提示字元與所選文字並排,此選項也會出現在" "文字的情境選單上。(由 Tal Einat 在 :issue:`37903` 中貢獻。)" @@ -2229,11 +2237,12 @@ msgstr "" #: ../../whatsnew/3.10.rst:1182 msgid "" -"Highlight the new :ref:`soft keywords <soft-keywords>` :keyword:`match`, :" -"keyword:`case <match>`, and :keyword:`_ <wildcard-patterns>` in pattern-" -"matching statements. However, this highlighting is not perfect and will be " -"incorrect in some rare cases, including some ``_``-s in ``case`` patterns. " -"(Contributed by Tal Einat in :issue:`44010`.)" +"Highlight the new :ref:`soft keywords <soft-" +"keywords>` :keyword:`match`, :keyword:`case <match>`, and :keyword:`_ " +"<wildcard-patterns>` in pattern-matching statements. However, this " +"highlighting is not perfect and will be incorrect in some rare cases, " +"including some ``_``-s in ``case`` patterns. (Contributed by Tal Einat " +"in :issue:`44010`.)" msgstr "" "突顯 (highlight) 模式匹配陳述式中的新\\ :ref:`軟關鍵字 (soft keywords) <soft-" "keywords>` :keyword:`match`、:keyword:`case <match>` 和 :keyword:`_ " @@ -2257,8 +2266,8 @@ msgid "" "Include prompts when saving Shell with inputs and outputs. (Contributed by " "Terry Jan Reedy in :gh:`95191`.)" msgstr "" -"保存帶有輸入和輸出的 Shell 時,會包含提示字元。(由 Terry Jan Reedy 在 :gh:" -"`95191` 中貢獻。)" +"保存帶有輸入和輸出的 Shell 時,會包含提示字元。(由 Terry Jan Reedy " +"在 :gh:`95191` 中貢獻。)" #: ../../whatsnew/3.10.rst:1197 msgid "importlib.metadata" @@ -2269,19 +2278,19 @@ msgid "" "Feature parity with ``importlib_metadata`` 4.6 (`history <https://importlib-" "metadata.readthedocs.io/en/latest/history.html>`_)." msgstr "" -"與 ``importlib_metadata`` 4.6 功能相同(`歷史 <https://importlib-metadata." -"readthedocs.io/en/latest/history.html>`_)。" +"與 ``importlib_metadata`` 4.6 功能相同(`歷史 <https://importlib-" +"metadata.readthedocs.io/en/latest/history.html>`_)。" #: ../../whatsnew/3.10.rst:1202 msgid "" ":ref:`importlib.metadata entry points <entry-points>` now provide a nicer " -"experience for selecting entry points by group and name through a new :ref:" -"`importlib.metadata.EntryPoints <entry-points>` class. See the Compatibility " -"Note in the docs for more info on the deprecation and usage." +"experience for selecting entry points by group and name through a " +"new :ref:`importlib.metadata.EntryPoints <entry-points>` class. See the " +"Compatibility Note in the docs for more info on the deprecation and usage." msgstr "" -":ref:`importlib.metadata 入口點 <entry-points>`\\ 現在透過新的 :ref:" -"`importlib.metadata.EntryPoints <entry-points>` 類別提供了以群組和名稱選擇入" -"口點的更好體驗。有關棄用與用法的更多資訊,請參閱文件中的相容性說明。" +":ref:`importlib.metadata 入口點 <entry-points>`\\ 現在透過新" +"的 :ref:`importlib.metadata.EntryPoints <entry-points>` 類別提供了以群組和名" +"稱選擇入口點的更好體驗。有關棄用與用法的更多資訊,請參閱文件中的相容性說明。" #: ../../whatsnew/3.10.rst:1208 msgid "" @@ -2290,8 +2299,8 @@ msgid "" "their :ref:`importlib.metadata.Distribution <distributions>`." msgstr "" "新增了 :ref:`importlib.metadata.packages_distributions() <package-" -"distributions>` 用於將頂階 Python 模組和套件解析出 :ref:`importlib.metadata." -"Distribution <distributions>`。" +"distributions>` 用於將頂階 Python 模組和套件解析" +"出 :ref:`importlib.metadata.Distribution <distributions>`。" #: ../../whatsnew/3.10.rst:1213 msgid "inspect" @@ -2303,25 +2312,27 @@ msgid "" "defined on an object. It works around the quirks of accessing the " "annotations on various types of objects, and makes very few assumptions " "about the object it examines. :func:`inspect.get_annotations` can also " -"correctly un-stringize stringized annotations. :func:`inspect." -"get_annotations` is now considered best practice for accessing the " -"annotations dict defined on any Python object; for more information on best " -"practices for working with annotations, please see :ref:`annotations-howto`. " -"Relatedly, :func:`inspect.signature`, :func:`inspect.Signature." -"from_callable`, and :func:`!inspect.Signature.from_function` now call :func:" -"`inspect.get_annotations` to retrieve annotations. This means :func:`inspect." -"signature` and :func:`inspect.Signature.from_callable` can also now un-" -"stringize stringized annotations. (Contributed by Larry Hastings in :issue:" -"`43817`.)" +"correctly un-stringize stringized " +"annotations. :func:`inspect.get_annotations` is now considered best " +"practice for accessing the annotations dict defined on any Python object; " +"for more information on best practices for working with annotations, please " +"see :ref:`annotations-howto`. " +"Relatedly, :func:`inspect.signature`, :func:`inspect.Signature.from_callable`, " +"and :func:`!inspect.Signature.from_function` now " +"call :func:`inspect.get_annotations` to retrieve annotations. This " +"means :func:`inspect.signature` and :func:`inspect.Signature.from_callable` " +"can also now un-stringize stringized annotations. (Contributed by Larry " +"Hastings in :issue:`43817`.)" msgstr "" "新增 :func:`inspect.get_annotations`,它可以安全地計算物件上定義的註釋。它是" "存取各種型別物件註釋的怪作法 (quirks) 的變通解法 (work around),並且對其檢查" "的物件做出很少的假設。 :func:`inspect.get_annotations` 也可以正確地取消字串化" "註釋 (stringized annotations)。 :func:`inspect.get_annotations` 現在被認為是" "存取任何 Python 物件上定義的註釋字典的最佳實踐;有關使用註釋的最佳實踐的更多" -"資訊,請參閱 :ref:`annotations-howto`。相關地,:func:`inspect.signature`、:" -"func:`inspect.Signature.from_callable` 和 :func:`!inspect.Signature." -"from_function` 現在呼叫 :func:`inspect.get_annotations` 來檢索註釋。這意味" +"資訊,請參閱 :ref:`annotations-howto`。相關" +"地,:func:`inspect.signature`、:func:`inspect.Signature.from_callable` " +"和 :func:`!inspect.Signature.from_function` 現在呼" +"叫 :func:`inspect.get_annotations` 來檢索註釋。這意味" "著 :func:`inspect.signature` 和 :func:`inspect.Signature.from_callable` 現在" "也可以取消字串化註釋。(由 Larry Hastings 在 :issue:`43817` 中貢獻。)" @@ -2331,8 +2342,8 @@ msgstr "itertools" #: ../../whatsnew/3.10.rst:1236 msgid "" -"Add :func:`itertools.pairwise`. (Contributed by Raymond Hettinger in :issue:" -"`38200`.)" +"Add :func:`itertools.pairwise`. (Contributed by Raymond Hettinger " +"in :issue:`38200`.)" msgstr "" "新增 :func:`itertools.pairwise`。(由 Raymond Hettinger 在 :issue:`38200` 中" "貢獻。)" @@ -2350,14 +2361,14 @@ msgid "" "Add :func:`os.cpu_count` support for VxWorks RTOS. (Contributed by Peixing " "Xin in :issue:`41440`.)" msgstr "" -"為 VxWorks RTOS 新增 :func:`os.cpu_count` 支援。(由 Peixing Xin 在 :issue:" -"`41440` 中貢獻。)" +"為 VxWorks RTOS 新增 :func:`os.cpu_count` 支援。(由 Peixing Xin " +"在 :issue:`41440` 中貢獻。)" #: ../../whatsnew/3.10.rst:1251 msgid "" "Add a new function :func:`os.eventfd` and related helpers to wrap the " -"``eventfd2`` syscall on Linux. (Contributed by Christian Heimes in :issue:" -"`41001`.)" +"``eventfd2`` syscall on Linux. (Contributed by Christian Heimes " +"in :issue:`41001`.)" msgstr "" "新增函式 :func:`os.eventfd` 和相關幫助程式來包裝 Linux 上的 ``eventfd2`` 系統" "呼叫。(由 Christian Heimes 在 :issue:`41001` 中貢獻。)" @@ -2377,12 +2388,12 @@ msgstr "" #: ../../whatsnew/3.10.rst:1260 msgid "" "Add :const:`~os.O_EVTONLY`, :const:`~os.O_FSYNC`, :const:`~os.O_SYMLINK` " -"and :const:`~os.O_NOFOLLOW_ANY` for macOS. (Contributed by Donghee Na in :" -"issue:`43106`.)" +"and :const:`~os.O_NOFOLLOW_ANY` for macOS. (Contributed by Donghee Na " +"in :issue:`43106`.)" msgstr "" -"為 macOS 新增 :const:`~os.O_EVTONLY`、:const:`~os.O_FSYNC`、:const:`~os." -"O_SYMLINK` 和 :const:`~os.O_NOFOLLOW_ANY`。(由 Donghee Na 在 :issue:`43106` " -"中貢獻。)" +"為 macOS 新" +"增 :const:`~os.O_EVTONLY`、:const:`~os.O_FSYNC`、:const:`~os.O_SYMLINK` " +"和 :const:`~os.O_NOFOLLOW_ANY`。(由 Donghee Na 在 :issue:`43106` 中貢獻。)" #: ../../whatsnew/3.10.rst:1265 msgid "os.path" @@ -2395,8 +2406,8 @@ msgid "" "symlink loop is encountered. (Contributed by Barney Gale in :issue:`43757`.)" msgstr "" ":func:`os.path.realpath` 現在接受一個 *strict* 僅限關鍵字引數。當設定為 " -"``True`` 時,如果路徑不存在或遇到符號鏈接循環 (symlink loop),則會引發 :exc:" -"`OSError`。(由 Barney Gale 在 :issue:`43757` 中貢獻。)" +"``True`` 時,如果路徑不存在或遇到符號鏈接循環 (symlink loop),則會引" +"發 :exc:`OSError`。(由 Barney Gale 在 :issue:`43757` 中貢獻。)" #: ../../whatsnew/3.10.rst:1273 msgid "pathlib" @@ -2412,8 +2423,9 @@ msgstr "" #: ../../whatsnew/3.10.rst:1278 msgid "" -"Add negative indexing support to :attr:`PurePath.parents <pathlib.PurePath." -"parents>`. (Contributed by Yaroslav Pankovych in :issue:`21041`.)" +"Add negative indexing support to :attr:`PurePath.parents " +"<pathlib.PurePath.parents>`. (Contributed by Yaroslav Pankovych " +"in :issue:`21041`.)" msgstr "" "向 :attr:`PurePath.parents <pathlib.PurePath.parents>` 新增負索引支援。(由 " "Yaroslav Pankovych 在 :issue:`21041` 中貢獻。)" @@ -2421,20 +2433,20 @@ msgstr "" #: ../../whatsnew/3.10.rst:1282 msgid "" "Add :meth:`Path.hardlink_to <pathlib.Path.hardlink_to>` method that " -"supersedes :meth:`!link_to`. The new method has the same argument order as :" -"meth:`~pathlib.Path.symlink_to`. (Contributed by Barney Gale in :issue:" -"`39950`.)" +"supersedes :meth:`!link_to`. The new method has the same argument order " +"as :meth:`~pathlib.Path.symlink_to`. (Contributed by Barney Gale " +"in :issue:`39950`.)" msgstr "" -"新增替代 :meth:`!link_to` 的 :meth:`Path.hardlink_to <pathlib.Path." -"hardlink_to>` 方法。新方法與 :meth:`~pathlib.Path.symlink_to` 具有相同的引數" -"順序。(由 Barney Gale 在 :issue:`39950` 中貢獻。)" +"新增替代 :meth:`!link_to` 的 :meth:`Path.hardlink_to " +"<pathlib.Path.hardlink_to>` 方法。新方法與 :meth:`~pathlib.Path.symlink_to` " +"具有相同的引數順序。(由 Barney Gale 在 :issue:`39950` 中貢獻。)" #: ../../whatsnew/3.10.rst:1287 msgid "" ":meth:`pathlib.Path.stat` and :meth:`~pathlib.Path.chmod` now accept a " "*follow_symlinks* keyword-only argument for consistency with corresponding " -"functions in the :mod:`os` module. (Contributed by Barney Gale in :issue:" -"`39906`.)" +"functions in the :mod:`os` module. (Contributed by Barney Gale " +"in :issue:`39906`.)" msgstr "" ":meth:`pathlib.Path.stat` 和 :meth:`~pathlib.Path.chmod` 現在接受 " "*follow_symlinks* 僅限關鍵字引數,以與 :mod:`os` 模組中的相應函式保持一致。" @@ -2445,16 +2457,15 @@ msgid "platform" msgstr "platform" #: ../../whatsnew/3.10.rst:1295 -#, fuzzy msgid "" "Add :func:`platform.freedesktop_os_release` to retrieve operation system " "identification from `freedesktop.org os-release <https://www.freedesktop.org/" "software/systemd/man/os-release.html>`_ standard file. (Contributed by " "Christian Heimes in :issue:`28468`.)" msgstr "" -"新增 :func:`platform.freedesktop_os_release()` 以從 `freedesktop.org os-" +"新增 :func:`platform.freedesktop_os_release` 以從 `freedesktop.org os-" "release <https://www.freedesktop.org/software/systemd/man/os-release.html>`_ " -"標準檔案中檢索出作業系統標識。(由 Christian Heimes 在 :issue:`28468` 中貢" +"標準檔案中檢索出作業系統識別。(由 Christian Heimes 在 :issue:`28468` 中貢" "獻。)" #: ../../whatsnew/3.10.rst:1301 @@ -2496,13 +2507,14 @@ msgstr "pyclbr" #: ../../whatsnew/3.10.rst:1318 msgid "" "Add an ``end_lineno`` attribute to the ``Function`` and ``Class`` objects in " -"the tree returned by :func:`pyclbr.readmodule` and :func:`pyclbr." -"readmodule_ex`. It matches the existing (start) ``lineno``. (Contributed by " -"Aviral Srivastava in :issue:`38307`.)" +"the tree returned by :func:`pyclbr.readmodule` " +"and :func:`pyclbr.readmodule_ex`. It matches the existing (start) " +"``lineno``. (Contributed by Aviral Srivastava in :issue:`38307`.)" msgstr "" -"將 ``end_lineno`` 屬性新增到 :func:`pyclbr.readmodule` 和 :func:`pyclbr." -"readmodule_ex` 回傳的樹中的 ``Function`` 和 ``Class`` 物件。它與現有的(開" -"始) ``lineno`` 匹配。(由 Aviral Srivastava 在 :issue:`38307` 中貢獻。)" +"將 ``end_lineno`` 屬性新增到 :func:`pyclbr.readmodule` " +"和 :func:`pyclbr.readmodule_ex` 回傳的樹中的 ``Function`` 和 ``Class`` 物件。" +"它與現有的(開始) ``lineno`` 匹配。(由 Aviral Srivastava 在 :issue:`38307` " +"中貢獻。)" #: ../../whatsnew/3.10.rst:1324 msgid "shelve" @@ -2514,9 +2526,9 @@ msgid "" "default instead of :mod:`pickle` protocol ``3`` when creating shelves. " "(Contributed by Zackery Spytz in :issue:`34204`.)" msgstr "" -"現在,:mod:`shelve` 模組在建立 shelve 時預設使用 :const:`pickle." -"DEFAULT_PROTOCOL`,而不是 :mod:`pickle` 的協議 ``3``。(由 Zackery Spytz 在 :" -"issue:`34204` 中貢獻。)" +"現在,:mod:`shelve` 模組在建立 shelve 時預設使" +"用 :const:`pickle.DEFAULT_PROTOCOL`,而不是 :mod:`pickle` 的協議 ``3``。(由 " +"Zackery Spytz 在 :issue:`34204` 中貢獻。)" #: ../../whatsnew/3.10.rst:1331 msgid "statistics" @@ -2524,9 +2536,10 @@ msgstr "statistics" #: ../../whatsnew/3.10.rst:1333 msgid "" -"Add :func:`~statistics.covariance`, Pearson's :func:`~statistics." -"correlation`, and simple :func:`~statistics.linear_regression` functions. " -"(Contributed by Tymoteusz Wołodźko in :issue:`38490`.)" +"Add :func:`~statistics.covariance`, " +"Pearson's :func:`~statistics.correlation`, and " +"simple :func:`~statistics.linear_regression` functions. (Contributed by " +"Tymoteusz Wołodźko in :issue:`38490`.)" msgstr "" "新增 :func:`~statistics.covariance`、Pearson :func:`~statistics.correlation` " "和簡單 :func:`~statistics.linear_regression` 函式。(由 Tymoteusz Wołodźko " @@ -2553,8 +2566,8 @@ msgid "" "Add option to create MPTCP sockets with ``IPPROTO_MPTCP`` (Contributed by " "Rui Cunha in :issue:`43571`.)" msgstr "" -"新增使用 ``IPPROTO_MPTCP`` 建立 MPTCP socket 的選項(由 Rui Cunha 在 :issue:" -"`43571` 中貢獻。)" +"新增使用 ``IPPROTO_MPTCP`` 建立 MPTCP socket 的選項(由 Rui Cunha " +"在 :issue:`43571` 中貢獻。)" #: ../../whatsnew/3.10.rst:1353 msgid "" @@ -2578,44 +2591,45 @@ msgstr "" #: ../../whatsnew/3.10.rst:1362 msgid "" -"The ssl module has preliminary support for OpenSSL 3.0.0 and new option :" -"const:`~ssl.OP_IGNORE_UNEXPECTED_EOF`. (Contributed by Christian Heimes in :" -"issue:`38820`, :issue:`43794`, :issue:`43788`, :issue:`43791`, :issue:" -"`43799`, :issue:`43920`, :issue:`43789`, and :issue:`43811`.)" +"The ssl module has preliminary support for OpenSSL 3.0.0 and new " +"option :const:`~ssl.OP_IGNORE_UNEXPECTED_EOF`. (Contributed by Christian " +"Heimes " +"in :issue:`38820`, :issue:`43794`, :issue:`43788`, :issue:`43791`, :issue:`43799`, :issue:`43920`, :issue:`43789`, " +"and :issue:`43811`.)" msgstr "" -"ssl 模組初步支援 OpenSSL 3.0.0 和新選項 :const:`~ssl." -"OP_IGNORE_UNEXPECTED_EOF`。(由 Christian Heimes 於 :issue:`38820`、:issue:" -"`43794`、:issue:`43788`、:issue:`43791`、:issue:`43799`、:issue:`43920`、:" -"issue:`43789` 和 :issue:`43811` 貢獻。)" +"ssl 模組初步支援 OpenSSL 3.0.0 和新選" +"項 :const:`~ssl.OP_IGNORE_UNEXPECTED_EOF`。(由 Christian Heimes " +"於 :issue:`38820`、:issue:`43794`、:issue:`43788`、:issue:`43791`、:issue:`43799`、:issue:`43920`、:issue:`43789` " +"和 :issue:`43811` 貢獻。)" #: ../../whatsnew/3.10.rst:1368 msgid "" -"Deprecated function and use of deprecated constants now result in a :exc:" -"`DeprecationWarning`. :attr:`ssl.SSLContext.options` has :data:`~ssl." -"OP_NO_SSLv2` and :data:`~ssl.OP_NO_SSLv3` set by default and therefore " -"cannot warn about setting the flag again. The :ref:`deprecation section " -"<whatsnew310-deprecated>` has a list of deprecated features. (Contributed by " -"Christian Heimes in :issue:`43880`.)" -msgstr "" -"已棄用函式和使用已棄用常數現在會導致 :exc:`DeprecationWarning`。 :attr:`ssl." -"SSLContext.options` 預設設定有 :data:`~ssl.OP_NO_SSLv2` 和 :data:`~ssl." -"OP_NO_SSLv3`,因此無法再次發出設定該旗標的警告。:ref:`棄用部分 <whatsnew310-" -"deprecated>`\\ 包含已棄用功能的列表。(由 Christian Heimes 在 :issue:`43880` " -"中貢獻。)" +"Deprecated function and use of deprecated constants now result in " +"a :exc:`DeprecationWarning`. :attr:`ssl.SSLContext.options` " +"has :data:`~ssl.OP_NO_SSLv2` and :data:`~ssl.OP_NO_SSLv3` set by default and " +"therefore cannot warn about setting the flag again. The :ref:`deprecation " +"section <whatsnew310-deprecated>` has a list of deprecated features. " +"(Contributed by Christian Heimes in :issue:`43880`.)" +msgstr "" +"已棄用函式和使用已棄用常數現在會導" +"致 :exc:`DeprecationWarning`。 :attr:`ssl.SSLContext.options` 預設設定" +"有 :data:`~ssl.OP_NO_SSLv2` 和 :data:`~ssl.OP_NO_SSLv3`,因此無法再次發出設定" +"該旗標的警告。:ref:`棄用部分 <whatsnew310-deprecated>`\\ 包含已棄用功能的列" +"表。(由 Christian Heimes 在 :issue:`43880` 中貢獻。)" #: ../../whatsnew/3.10.rst:1376 msgid "" "The ssl module now has more secure default settings. Ciphers without forward " "secrecy or SHA-1 MAC are disabled by default. Security level 2 prohibits " -"weak RSA, DH, and ECC keys with less than 112 bits of security. :class:`~ssl." -"SSLContext` defaults to minimum protocol version TLS 1.2. Settings are based " -"on Hynek Schlawack's research. (Contributed by Christian Heimes in :issue:" -"`43998`.)" +"weak RSA, DH, and ECC keys with less than 112 bits of " +"security. :class:`~ssl.SSLContext` defaults to minimum protocol version TLS " +"1.2. Settings are based on Hynek Schlawack's research. (Contributed by " +"Christian Heimes in :issue:`43998`.)" msgstr "" "ssl 模組現在具有更安全的預設設定。預設情況下禁用沒有前向保密或 SHA-1 MAC 的密" -"碼。安全級別 2 禁止安全性低於 112 位元的弱 RSA、DH 和 ECC 密鑰。 :class:" -"`~ssl.SSLContext` 預設為最低協議版本 TLS 1.2。設定基於 Hynek Schlawack 的研" -"究。(由 Christian Heimes 在 :issue:`43998` 中貢獻。)" +"碼。安全級別 2 禁止安全性低於 112 位元的弱 RSA、DH 和 ECC 密" +"鑰。 :class:`~ssl.SSLContext` 預設為最低協議版本 TLS 1.2。設定基於 Hynek " +"Schlawack 的研究。(由 Christian Heimes 在 :issue:`43998` 中貢獻。)" #: ../../whatsnew/3.10.rst:1383 msgid "" @@ -2649,8 +2663,8 @@ msgid "" "A new verify flag :const:`~ssl.VERIFY_X509_PARTIAL_CHAIN` has been added. " "(Contributed by l0x in :issue:`40849`.)" msgstr "" -"新增驗證旗標 :const:`~ssl.VERIFY_X509_PARTIAL_CHAIN`。(由 l0x 在 :issue:" -"`40849` 中貢獻。)" +"新增驗證旗標 :const:`~ssl.VERIFY_X509_PARTIAL_CHAIN`。(由 l0x " +"在 :issue:`40849` 中貢獻。)" #: ../../whatsnew/3.10.rst:1398 msgid "sqlite3" @@ -2658,13 +2672,15 @@ msgstr "sqlite3" #: ../../whatsnew/3.10.rst:1400 msgid "" -"Add audit events for :func:`~sqlite3.connect/handle`, :meth:`~sqlite3." -"Connection.enable_load_extension`, and :meth:`~sqlite3.Connection." -"load_extension`. (Contributed by Erlend E. Aasland in :issue:`43762`.)" +"Add audit events for :func:`~sqlite3.connect/" +"handle`, :meth:`~sqlite3.Connection.enable_load_extension`, " +"and :meth:`~sqlite3.Connection.load_extension`. (Contributed by Erlend E. " +"Aasland in :issue:`43762`.)" msgstr "" -"新增 :func:`~sqlite3.connect/handle`、:meth:`~sqlite3.Connection." -"enable_load_extension` 和 :meth:`~sqlite3.Connection.load_extension` 的稽核事" -"件。(由 Erlend E. Aasland 在 :issue:`43762` 中貢獻。)" +"新增 :func:`~sqlite3.connect/" +"handle`、:meth:`~sqlite3.Connection.enable_load_extension` " +"和 :meth:`~sqlite3.Connection.load_extension` 的稽核事件。(由 Erlend E. " +"Aasland 在 :issue:`43762` 中貢獻。)" #: ../../whatsnew/3.10.rst:1406 msgid "sys" @@ -2708,12 +2724,13 @@ msgstr "threading" #: ../../whatsnew/3.10.rst:1426 msgid "" "Add :func:`threading.gettrace` and :func:`threading.getprofile` to retrieve " -"the functions set by :func:`threading.settrace` and :func:`threading." -"setprofile` respectively. (Contributed by Mario Corchero in :issue:`42251`.)" +"the functions set by :func:`threading.settrace` " +"and :func:`threading.setprofile` respectively. (Contributed by Mario " +"Corchero in :issue:`42251`.)" msgstr "" -"新增 :func:`threading.gettrace` 和 :func:`threading.getprofile` 分別取得 :" -"func:`threading.settrace` 和 :func:`threading.setprofile` 設定的函式。(由 " -"Mario Corchero 在 :issue:`42251` 中貢獻。)" +"新增 :func:`threading.gettrace` 和 :func:`threading.getprofile` 分別取" +"得 :func:`threading.settrace` 和 :func:`threading.setprofile` 設定的函式。" +"(由 Mario Corchero 在 :issue:`42251` 中貢獻。)" #: ../../whatsnew/3.10.rst:1431 msgid "" @@ -2721,9 +2738,9 @@ msgid "" "of :func:`threading.excepthook` in case it is set to a broken or a different " "value. (Contributed by Mario Corchero in :issue:`42308`.)" msgstr "" -"新增 :data:`threading.__excepthook__` 以允許取得 :func:`threading." -"excepthook` 的原始值,以防它被設定為損壞或不同的值。(由 Mario Corchero 在 :" -"issue:`42308` 中貢獻。)" +"新增 :data:`threading.__excepthook__` 以允許取" +"得 :func:`threading.excepthook` 的原始值,以防它被設定為損壞或不同的值。(由 " +"Mario Corchero 在 :issue:`42308` 中貢獻。)" #: ../../whatsnew/3.10.rst:1437 msgid "traceback" @@ -2731,15 +2748,14 @@ msgstr "traceback" #: ../../whatsnew/3.10.rst:1439 msgid "" -"The :func:`~traceback.format_exception`, :func:`~traceback." -"format_exception_only`, and :func:`~traceback.print_exception` functions can " -"now take an exception object as a positional-only argument. (Contributed by " -"Zackery Spytz and Matthias Bussonnier in :issue:`26389`.)" +"The :func:`~traceback.format_exception`, :func:`~traceback.format_exception_only`, " +"and :func:`~traceback.print_exception` functions can now take an exception " +"object as a positional-only argument. (Contributed by Zackery Spytz and " +"Matthias Bussonnier in :issue:`26389`.)" msgstr "" -":func:`~traceback.format_exception`、:func:`~traceback." -"format_exception_only` 和 :func:`~traceback.print_exception` 函式現在可以將例" -"外物件作為僅限位置引數。(由 Zackery Spytz 和 Matthias Bussonnier 在 :issue:" -"`26389` 中貢獻。)" +":func:`~traceback.format_exception`、:func:`~traceback.format_exception_only` " +"和 :func:`~traceback.print_exception` 函式現在可以將例外物件作為僅限位置引" +"數。(由 Zackery Spytz 和 Matthias Bussonnier 在 :issue:`26389` 中貢獻。)" #: ../../whatsnew/3.10.rst:1446 msgid "types" @@ -2747,14 +2763,14 @@ msgstr "types" #: ../../whatsnew/3.10.rst:1448 msgid "" -"Reintroduce the :data:`types.EllipsisType`, :data:`types.NoneType` and :data:" -"`types.NotImplementedType` classes, providing a new set of types readily " -"interpretable by type checkers. (Contributed by Bas van Beek in :issue:" -"`41810`.)" +"Reintroduce the :data:`types.EllipsisType`, :data:`types.NoneType` " +"and :data:`types.NotImplementedType` classes, providing a new set of types " +"readily interpretable by type checkers. (Contributed by Bas van Beek " +"in :issue:`41810`.)" msgstr "" -"重新引入 :data:`types.EllipsisType`、:data:`types.NoneType` 和 :data:`types." -"NotImplementedType` 類別,提供一組易於型別檢查器直譯的新型別。(由 Bas van " -"Beek 在 :issue:`41810` 中貢獻。)" +"重新引入 :data:`types.EllipsisType`、:data:`types.NoneType` " +"和 :data:`types.NotImplementedType` 類別,提供一組易於型別檢查器直譯的新型" +"別。(由 Bas van Beek 在 :issue:`41810` 中貢獻。)" #: ../../whatsnew/3.10.rst:1454 msgid "typing" @@ -2766,8 +2782,9 @@ msgstr "有關重大更改,請參閱\\ :ref:`new-feat-related-type-hints`。" #: ../../whatsnew/3.10.rst:1458 msgid "" -"The behavior of :class:`typing.Literal` was changed to conform with :pep:" -"`586` and to match the behavior of static type checkers specified in the PEP." +"The behavior of :class:`typing.Literal` was changed to conform " +"with :pep:`586` and to match the behavior of static type checkers specified " +"in the PEP." msgstr "" ":class:`typing.Literal` 的行為已更改為符合 :pep:`586` 並匹配 PEP 中指定的靜態" "型別檢查器的行為。" @@ -2799,7 +2816,7 @@ msgid "" "Note that declaring ``Literal`` with unhashable parameters will not throw an " "error::" msgstr "" -"如果 ``Literal`` 物件的任ㄧ參數不是\\ :term:`可雜湊的 <hashable>`,那麼它們現" +"如果 ``Literal`` 物件的任一參數不是\\ :term:`可雜湊的 <hashable>`,那麼它們現" "在將在相等性比較期間引發 :exc:`TypeError` 例外。請注意,使用不可雜湊的參數宣" "告 ``Literal`` 不會引發錯誤: ::" @@ -2826,19 +2843,20 @@ msgstr "(由 Yurii Karabas 在 :issue:`42345` 中貢獻。)" #: ../../whatsnew/3.10.rst:1481 msgid "" "Add new function :func:`typing.is_typeddict` to introspect if an annotation " -"is a :class:`typing.TypedDict`. (Contributed by Patrick Reader in :issue:" -"`41792`.)" +"is a :class:`typing.TypedDict`. (Contributed by Patrick Reader " +"in :issue:`41792`.)" msgstr "" -"新增函式 :func:`typing.is_typeddict` 來自我審查 (introspect) 註釋是否為 :" -"class:`typing.TypedDict`。(由 Patrick Reader 在 :issue:`41792` 中貢獻。)" +"新增函式 :func:`typing.is_typeddict` 來自我審查 (introspect) 註釋是否" +"為 :class:`typing.TypedDict`。(由 Patrick Reader 在 :issue:`41792` 中貢" +"獻。)" #: ../../whatsnew/3.10.rst:1485 msgid "" "Subclasses of ``typing.Protocol`` which only have data variables declared " "will now raise a ``TypeError`` when checked with ``isinstance`` unless they " "are decorated with :func:`~typing.runtime_checkable`. Previously, these " -"checks passed silently. Users should decorate their subclasses with the :" -"func:`!runtime_checkable` decorator if they want runtime protocols. " +"checks passed silently. Users should decorate their subclasses with " +"the :func:`!runtime_checkable` decorator if they want runtime protocols. " "(Contributed by Yurii Karabas in :issue:`38908`.)" msgstr "" "僅宣告了資料變數的 ``typing.Protocol`` 子類別現在在使用 ``isinstance`` 檢查時" @@ -2849,16 +2867,16 @@ msgstr "" #: ../../whatsnew/3.10.rst:1493 msgid "" -"Importing from the ``typing.io`` and ``typing.re`` submodules will now emit :" -"exc:`DeprecationWarning`. These submodules have been deprecated since " +"Importing from the ``typing.io`` and ``typing.re`` submodules will now " +"emit :exc:`DeprecationWarning`. These submodules have been deprecated since " "Python 3.8 and will be removed in a future version of Python. Anything " "belonging to those submodules should be imported directly from :mod:`typing` " "instead. (Contributed by Sebastian Rittau in :issue:`38291`.)" msgstr "" -"從 ``typing.io`` 和 ``typing.re`` 子模組引入現在將發出 :exc:" -"`DeprecationWarning`。這些子模組自 Python 3.8 起已被棄用,並將在未來版本的 " -"Python 中刪除。屬於這些子模組的任何內容都應該直接從 :mod:`typing` 引入。 " -"(由 Sebastian Rittau 在 :issue:`38291` 中貢獻。)" +"從 ``typing.io`` 和 ``typing.re`` 子模組引入現在將發" +"出 :exc:`DeprecationWarning`。這些子模組自 Python 3.8 起已被棄用,並將在未來" +"版本的 Python 中刪除。屬於這些子模組的任何內容都應該直接從 :mod:`typing` 引" +"入。 (由 Sebastian Rittau 在 :issue:`38291` 中貢獻。)" #: ../../whatsnew/3.10.rst:1501 msgid "unittest" @@ -2870,43 +2888,43 @@ msgid "" "existing :meth:`~unittest.TestCase.assertLogs`. (Contributed by Kit Yan Choi " "in :issue:`39385`.)" msgstr "" -"新增方法 :meth:`~unittest.TestCase.assertNoLogs` 以補足現有的 :meth:" -"`~unittest.TestCase.assertLogs`。(由 Kit Yan Choi 在 :issue:`39385` 中貢" -"獻。)" +"新增方法 :meth:`~unittest.TestCase.assertNoLogs` 以補足現有" +"的 :meth:`~unittest.TestCase.assertLogs`。(由 Kit Yan Choi " +"在 :issue:`39385` 中貢獻。)" #: ../../whatsnew/3.10.rst:1508 msgid "urllib.parse" msgstr "urllib.parse" #: ../../whatsnew/3.10.rst:1510 -#, fuzzy msgid "" "Python versions earlier than Python 3.10 allowed using both ``;`` and ``&`` " -"as query parameter separators in :func:`urllib.parse.parse_qs` and :func:" -"`urllib.parse.parse_qsl`. Due to security concerns, and to conform with " -"newer W3C recommendations, this has been changed to allow only a single " -"separator key, with ``&`` as the default. This change also affects :func:`!" -"cgi.parse` and :func:`!cgi.parse_multipart` as they use the affected " -"functions internally. For more details, please see their respective " -"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " -"in :issue:`42967`.)" -msgstr "" -"Python 3.10 之前的 Python 版本允許在 :func:`urllib.parse.parse_qs` 和 :func:" -"`urllib.parse.parse_qsl` 中使用 ``;`` 和 ``&`` 作為查詢參數 (query " +"as query parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their " +"respective documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran " +"and Ken Jin in :issue:`42967`.)" +msgstr "" +"Python 3.10 之前的 Python 版本允許在 :func:`urllib.parse.parse_qs` " +"和 :func:`urllib.parse.parse_qsl` 中使用 ``;`` 和 ``&`` 作為查詢參數 (query " "parameter) 的分隔符號。出於安全考慮,並且為了符合更新的 W3C 建議,已將其更改" -"為僅允許單個分隔符號鍵,預設為 ``&``。此更改還會影響 :func:`cgi.parse` 和 :" -"func:`cgi.parse_multipart`,因為它們在內部使用受影響的函式。有關更多詳細資" -"訊,請參閱各自的文件。(由 Adam Goldschmidt、Senthil Kumaran 和 Ken Jin 在 :" -"issue:`42967` 中貢獻。)" +"為僅允許單個分隔符號鍵,預設為 ``&``。此更改還會影響 :func:`!cgi.parse` " +"和 :func:`!cgi.parse_multipart`,因為它們在內部使用受影響的函式。有關更多詳細" +"資訊,請參閱各自的文件。(由 Adam Goldschmidt、Senthil Kumaran 和 Ken Jin " +"在 :issue:`42967` 中貢獻。)" #: ../../whatsnew/3.10.rst:1520 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " -"forms of attacks. Following the WHATWG specification that updates :rfc:" -"`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are " -"stripped from the URL by the parser in :mod:`urllib.parse` preventing such " -"attacks. The removal characters are controlled by a new module level " -"variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" +"forms of attacks. Following the WHATWG specification that " +"updates :rfc:`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` " +"characters are stripped from the URL by the parser in :mod:`urllib.parse` " +"preventing such attacks. The removal characters are controlled by a new " +"module level variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. " +"(See :gh:`88048`)" msgstr "" #: ../../whatsnew/3.10.rst:1528 @@ -2915,9 +2933,9 @@ msgstr "xml" #: ../../whatsnew/3.10.rst:1530 msgid "" -"Add a :class:`~xml.sax.handler.LexicalHandler` class to the :mod:`xml.sax." -"handler` module. (Contributed by Jonathan Gossage and Zackery Spytz in :" -"issue:`35018`.)" +"Add a :class:`~xml.sax.handler.LexicalHandler` class to " +"the :mod:`xml.sax.handler` module. (Contributed by Jonathan Gossage and " +"Zackery Spytz in :issue:`35018`.)" msgstr "" "新增 :class:`~xml.sax.handler.LexicalHandler` 類別到 :mod:`xml.sax.handler` " "模組。(由 Jonathan Gossage 和 Zackery Spytz 在 :issue:`35018` 中貢獻。)" @@ -2928,14 +2946,15 @@ msgstr "zipimport" #: ../../whatsnew/3.10.rst:1536 msgid "" -"Add methods related to :pep:`451`: :meth:`~zipimport.zipimporter." -"find_spec`, :meth:`zipimport.zipimporter.create_module`, and :meth:" -"`zipimport.zipimporter.exec_module`. (Contributed by Brett Cannon in :issue:" -"`42131`.)" +"Add methods related " +"to :pep:`451`: :meth:`~zipimport.zipimporter.find_spec`, :meth:`zipimport.zipimporter.create_module`, " +"and :meth:`zipimport.zipimporter.exec_module`. (Contributed by Brett Cannon " +"in :issue:`42131`.)" msgstr "" -"新增與 :pep:`451` 相關的方法::meth:`~zipimport.zipimporter.find_spec`、:" -"meth:`zipimport.zipimporter.create_module` 和 :meth:`zipimport.zipimporter." -"exec_module`。(由 Brett Cannon 在 :issue:`42131` 中貢獻。)" +"新增與 :pep:`451` 相關的方" +"法::meth:`~zipimport.zipimporter.find_spec`、:meth:`zipimport.zipimporter.create_module` " +"和 :meth:`zipimport.zipimporter.exec_module`。(由 Brett Cannon " +"在 :issue:`42131` 中貢獻。)" #: ../../whatsnew/3.10.rst:1541 msgid "" @@ -2952,8 +2971,8 @@ msgstr "最佳化" #: ../../whatsnew/3.10.rst:1548 msgid "" "Constructors :func:`str`, :func:`bytes` and :func:`bytearray` are now faster " -"(around 30--40% for small objects). (Contributed by Serhiy Storchaka in :" -"issue:`41334`.)" +"(around 30--40% for small objects). (Contributed by Serhiy Storchaka " +"in :issue:`41334`.)" msgstr "" "建構函式 :func:`str`、:func:`bytes` 和 :func:`bytearray` 現在更快了(對於小型" "物件大約快了 30--40%)。(由 Serhiy Storchaka 在 :issue:`41334` 中貢獻。)" @@ -2961,10 +2980,10 @@ msgstr "" #: ../../whatsnew/3.10.rst:1552 msgid "" "The :mod:`runpy` module now imports fewer modules. The ``python3 -m module-" -"name`` command startup time is 1.4x faster in average. On Linux, ``python3 -" -"I -m module-name`` imports 69 modules on Python 3.9, whereas it only imports " -"51 modules (-18) on Python 3.10. (Contributed by Victor Stinner in :issue:" -"`41006` and :issue:`41718`.)" +"name`` command startup time is 1.4x faster in average. On Linux, ``python3 " +"-I -m module-name`` imports 69 modules on Python 3.9, whereas it only " +"imports 51 modules (-18) on Python 3.10. (Contributed by Victor Stinner " +"in :issue:`41006` and :issue:`41718`.)" msgstr "" ":mod:`runpy` 模組現在引入更少的模組。``python3 -m module-name`` 指令啟動時間" "平均快了 1.4 倍。在 Linux 上,``python3 -I -m module-name`` 在 Python 3.9 上" @@ -2989,10 +3008,10 @@ msgid "" "When building Python with :option:`--enable-optimizations` now ``-fno-" "semantic-interposition`` is added to both the compile and link line. This " "speeds builds of the Python interpreter created with :option:`--enable-" -"shared` with ``gcc`` by up to 30%. See `this article <https://developers." -"redhat.com/blog/2020/06/25/red-hat-enterprise-linux-8-2-brings-faster-" -"python-3-8-run-speeds/>`_ for more details. (Contributed by Victor Stinner " -"and Pablo Galindo in :issue:`38980`.)" +"shared` with ``gcc`` by up to 30%. See `this article <https://" +"developers.redhat.com/blog/2020/06/25/red-hat-enterprise-linux-8-2-brings-" +"faster-python-3-8-run-speeds/>`_ for more details. (Contributed by Victor " +"Stinner and Pablo Galindo in :issue:`38980`.)" msgstr "" "當使用 :option:`--enable-optimizations` 建置 Python 時,現在 ``-fno-semantic-" "interposition`` 被新增到編譯和鏈接列 (link line) 中。這使得使用 :option:`--" @@ -3003,18 +3022,18 @@ msgstr "" #: ../../whatsnew/3.10.rst:1572 msgid "" -"Use a new output buffer management code for :mod:`bz2` / :mod:`lzma` / :mod:" -"`zlib` modules, and add ``.readall()`` function to ``_compression." -"DecompressReader`` class. bz2 decompression is now 1.09x ~ 1.17x faster, " -"lzma decompression 1.20x ~ 1.32x faster, ``GzipFile.read(-1)`` 1.11x ~ 1.18x " -"faster. (Contributed by Ma Lin, reviewed by Gregory P. Smith, in :issue:" -"`41486`)" +"Use a new output buffer management code " +"for :mod:`bz2` / :mod:`lzma` / :mod:`zlib` modules, and add ``.readall()`` " +"function to ``_compression.DecompressReader`` class. bz2 decompression is " +"now 1.09x ~ 1.17x faster, lzma decompression 1.20x ~ 1.32x faster, " +"``GzipFile.read(-1)`` 1.11x ~ 1.18x faster. (Contributed by Ma Lin, reviewed " +"by Gregory P. Smith, in :issue:`41486`)" msgstr "" "對 :mod:`bz2` / :mod:`lzma` / :mod:`zlib` 模組使用新的輸出緩衝區管理程式碼," "並將 ``.readall()`` 函式新增到 ``_compression.DecompressReader`` 類別。 bz2 " "解壓縮速度提高了 1.09x ~ 1.17x,lzma 解壓縮速度提高了 1.20x ~ 1.32x," -"``GzipFile.read(-1)`` 速度提高了 1.11x ~ 1.18x。(由 Ma Lin 於 :issue:" -"`41486` 貢獻、由 Gregory P. Smith 審閱)" +"``GzipFile.read(-1)`` 速度提高了 1.11x ~ 1.18x。(由 Ma Lin " +"於 :issue:`41486` 貢獻、由 Gregory P. Smith 審閱)" #: ../../whatsnew/3.10.rst:1578 msgid "" @@ -3045,25 +3064,27 @@ msgstr "" msgid "" "Add micro-optimizations to ``_PyType_Lookup()`` to improve type attribute " "cache lookup performance in the common case of cache hits. This makes the " -"interpreter 1.04 times faster on average. (Contributed by Dino Viehland in :" -"issue:`43452`.)" +"interpreter 1.04 times faster on average. (Contributed by Dino Viehland " +"in :issue:`43452`.)" msgstr "" "向 ``_PyType_Lookup()`` 新增微最佳化以提高快取命中的常見情況下的型別屬性快取" -"查找性能。這使得直譯器平均速度提高了 1.04 倍。(由 Dino Viehland 在 :issue:" -"`43452` 中貢獻。)" +"查找性能。這使得直譯器平均速度提高了 1.04 倍。(由 Dino Viehland " +"在 :issue:`43452` 中貢獻。)" #: ../../whatsnew/3.10.rst:1594 msgid "" "The following built-in functions now support the faster :pep:`590` " -"vectorcall calling convention: :func:`map`, :func:`filter`, :func:" -"`reversed`, :func:`bool` and :func:`float`. (Contributed by Donghee Na and " -"Jeroen Demeyer in :issue:`43575`, :issue:`43287`, :issue:`41922`, :issue:" -"`41873` and :issue:`41870`.)" -msgstr "" -"以下內建函式現在支援更快的 :pep:`590` vectorcall 呼叫慣例::func:`map`、:" -"func:`filter`、:func:`reversed`、:func:`bool` 和 :func:`float`。(由 Donghee " -"Na 和 Jeroen Demeyer 在 :issue:`43575`、:issue:`43287`、:issue:`41922`、:" -"issue:`41873` 和 :issue:`41870` 中貢獻。)" +"vectorcall calling " +"convention: :func:`map`, :func:`filter`, :func:`reversed`, :func:`bool` " +"and :func:`float`. (Contributed by Donghee Na and Jeroen Demeyer " +"in :issue:`43575`, :issue:`43287`, :issue:`41922`, :issue:`41873` " +"and :issue:`41870`.)" +msgstr "" +"以下內建函式現在支援更快的 :pep:`590` vectorcall 呼叫慣" +"例::func:`map`、:func:`filter`、:func:`reversed`、:func:`bool` " +"和 :func:`float`。(由 Donghee Na 和 Jeroen Demeyer " +"在 :issue:`43575`、:issue:`43287`、:issue:`41922`、:issue:`41873` " +"和 :issue:`41870` 中貢獻。)" #: ../../whatsnew/3.10.rst:1598 msgid "" @@ -3073,10 +3094,10 @@ msgid "" "in :mod:`gzip` and :mod:`lzma` have always been. (Contributed by Inada " "Naoki in :issue:`43785`.)" msgstr "" -"通過刪除內部 ``RLock``,:class:`~bz2.BZ2File` 的性能得到了改進。這使得 :" -"class:`!BZ2File` 在面對多個同時的讀取器或寫入器時執行緒不安全,就像 :mod:" -"`gzip` 和 :mod:`lzma` 中的等效類別一樣。(由 Inada Naoki 在 :issue:`43785` 中" -"貢獻。)" +"通過刪除內部 ``RLock``,:class:`~bz2.BZ2File` 的性能得到了改進。這使" +"得 :class:`!BZ2File` 在面對多個同時的讀取器或寫入器時執行緒不安全,就" +"像 :mod:`gzip` 和 :mod:`lzma` 中的等效類別一樣。(由 Inada Naoki " +"在 :issue:`43785` 中貢獻。)" #: ../../whatsnew/3.10.rst:1606 ../../whatsnew/3.10.rst:2212 msgid "Deprecated" @@ -3089,44 +3110,46 @@ msgid "" "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). Starting in this release, a " "deprecation warning is raised if the numeric literal is immediately followed " -"by one of keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:" -"`if`, :keyword:`in`, :keyword:`is` and :keyword:`or`. In future releases it " -"will be changed to syntax warning, and finally to syntax error. (Contributed " -"by Serhiy Storchaka in :issue:`43833`.)" +"by one of " +"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " +"and :keyword:`or`. In future releases it will be changed to syntax warning, " +"and finally to syntax error. (Contributed by Serhiy Storchaka " +"in :issue:`43833`.)" msgstr "" "目前 Python 接受緊跟關鍵字的數字字面值 (numeric literals),例如 ``0in x``、" "``1or x``、``0if 1else 2``。它允許了令人困惑和不明確的運算式,例如 ``[0x1for " "x in y]`` (可以直譯為 ``[0x1 for x in y]`` 或 ``[0x1f or x in y]`` )。從此" -"版本開始,如果數字字面值後緊跟關鍵字 :keyword:`and`、:keyword:`else`、:" -"keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` 與 :keyword:`or` " -"其中之一,則會引發棄用警告。在未來的版本中,它將被變更為語法警告,最後成為為" -"語法錯誤。(由 Serhiy Storchaka 在 :issue:`43833` 中貢獻。)" +"版本開始,如果數字字面值後緊跟關鍵" +"字 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " +"與 :keyword:`or` 其中之一,則會引發棄用警告。在未來的版本中,它將被變更為語法" +"警告,最後成為為語法錯誤。(由 Serhiy Storchaka 在 :issue:`43833` 中貢獻。)" #: ../../whatsnew/3.10.rst:1619 msgid "" "Starting in this release, there will be a concerted effort to begin cleaning " "up old import semantics that were kept for Python 2.7 compatibility. " -"Specifically, :meth:`!find_loader`/:meth:`!find_module` (superseded by :meth:" -"`~importlib.abc.MetaPathFinder.find_spec`), :meth:`~importlib.abc.Loader." -"load_module` (superseded by :meth:`~importlib.abc.Loader.exec_module`), :" -"meth:`!module_repr` (which the import system takes care of for you), the " +"Specifically, :meth:`!find_loader`/:meth:`!find_module` (superseded " +"by :meth:`~importlib.abc.MetaPathFinder.find_spec`), :meth:`~importlib.abc.Loader.load_module` " +"(superseded by :meth:`~importlib.abc.Loader.exec_module`), :meth:`!" +"module_repr` (which the import system takes care of for you), the " "``__package__`` attribute (superseded by ``__spec__.parent``), the " "``__loader__`` attribute (superseded by ``__spec__.loader``), and the " "``__cached__`` attribute (superseded by ``__spec__.cached``) will slowly be " -"removed (as well as other classes and methods in :mod:`importlib`). :exc:" -"`ImportWarning` and/or :exc:`DeprecationWarning` will be raised as " -"appropriate to help identify code which needs updating during this " -"transition." +"removed (as well as other classes and methods " +"in :mod:`importlib`). :exc:`ImportWarning` and/or :exc:`DeprecationWarning` " +"will be raised as appropriate to help identify code which needs updating " +"during this transition." msgstr "" "從這個版本開始,我們將齊心協力開始清理為相容 Python 2.7 而保留的舊引入語義。" -"具體來說, :meth:`!find_loader`/:meth:`!find_module` (被 :meth:`~importlib." -"abc.MetaPathFinder.find_spec` 取代)、:meth:`~importlib.abc.Loader." -"load_module` (被 :meth:`~importlib.abc.Loader.exec_module` 取代)、 :meth:`!" -"module_repr` (引入系統負責處理你)、``__package__`` 屬性(由 ``__spec__." -"parent`` 取代)、 ``__loader__`` 屬性(由 ``__spec__.loader`` 取代)和 " -"``__cached__`` 屬性(由 ``__spec__.cached`` 取代)將慢慢被刪除(以及 :mod:" -"`importlib` 中的其他類別和方法)。將酌情引發 :exc:`ImportWarning` 和/或 :exc:" -"`DeprecationWarning` 以幫助識別在此轉換期間需要更新的程式碼。" +"具體來說, :meth:`!find_loader`/:meth:`!find_module` " +"(被 :meth:`~importlib.abc.MetaPathFinder.find_spec` 取" +"代)、:meth:`~importlib.abc.Loader.load_module` " +"(被 :meth:`~importlib.abc.Loader.exec_module` 取代)、 :meth:`!module_repr` " +"(引入系統負責處理你)、``__package__`` 屬性(由 ``__spec__.parent`` 取" +"代)、 ``__loader__`` 屬性(由 ``__spec__.loader`` 取代)和 ``__cached__`` 屬" +"性(由 ``__spec__.cached`` 取代)將慢慢被刪除(以及 :mod:`importlib` 中的其他" +"類別和方法)。將酌情引發 :exc:`ImportWarning` 和/" +"或 :exc:`DeprecationWarning` 以幫助識別在此轉換期間需要更新的程式碼。" #: ../../whatsnew/3.10.rst:1636 msgid "" @@ -3139,24 +3162,25 @@ msgstr "" #: ../../whatsnew/3.10.rst:1640 msgid "" -"Non-integer arguments to :func:`random.randrange` are deprecated. The :exc:" -"`ValueError` is deprecated in favor of a :exc:`TypeError`. (Contributed by " -"Serhiy Storchaka and Raymond Hettinger in :issue:`37319`.)" +"Non-integer arguments to :func:`random.randrange` are deprecated. " +"The :exc:`ValueError` is deprecated in favor of a :exc:`TypeError`. " +"(Contributed by Serhiy Storchaka and Raymond Hettinger in :issue:`37319`.)" msgstr "" ":func:`random.randrange` 的非整數引數已棄用。:exc:`ValueError` 已被棄用,取而" -"代之的是 :exc:`TypeError`。(由 Serhiy Storchaka 和 Raymond Hettinger 在 :" -"issue:`37319` 中貢獻。)" +"代之的是 :exc:`TypeError`。(由 Serhiy Storchaka 和 Raymond Hettinger " +"在 :issue:`37319` 中貢獻。)" #: ../../whatsnew/3.10.rst:1644 msgid "" "The various ``load_module()`` methods of :mod:`importlib` have been " -"documented as deprecated since Python 3.6, but will now also trigger a :exc:" -"`DeprecationWarning`. Use :meth:`~importlib.abc.Loader.exec_module` instead. " -"(Contributed by Brett Cannon in :issue:`26131`.)" +"documented as deprecated since Python 3.6, but will now also trigger " +"a :exc:`DeprecationWarning`. Use :meth:`~importlib.abc.Loader.exec_module` " +"instead. (Contributed by Brett Cannon in :issue:`26131`.)" msgstr "" ":mod:`importlib` 的各種 ``load_module()`` 方法自 Python 3.6 起已被記錄為已棄" -"用,但現在也會觸發 :exc:`DeprecationWarning`。請改用 :meth:`~importlib.abc." -"Loader.exec_module`。(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" +"用,但現在也會觸發 :exc:`DeprecationWarning`。請改" +"用 :meth:`~importlib.abc.Loader.exec_module`。(由 Brett Cannon " +"在 :issue:`26131` 中貢獻。)" #: ../../whatsnew/3.10.rst:1650 msgid "" @@ -3164,18 +3188,20 @@ msgid "" "for :meth:`~zipimport.zipimporter.exec_module`. (Contributed by Brett Cannon " "in :issue:`26131`.)" msgstr "" -":meth:`!zimport.zipimporter.load_module` 已被棄用,請用 :meth:`~zipimport." -"zipimporter.exec_module`。(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" +":meth:`!zimport.zipimporter.load_module` 已被棄用,請" +"用 :meth:`~zipimport.zipimporter.exec_module`。(由 Brett Cannon " +"在 :issue:`26131` 中貢獻。)" #: ../../whatsnew/3.10.rst:1654 msgid "" "The use of :meth:`~importlib.abc.Loader.load_module` by the import system " -"now triggers an :exc:`ImportWarning` as :meth:`~importlib.abc.Loader." -"exec_module` is preferred. (Contributed by Brett Cannon in :issue:`26131`.)" +"now triggers an :exc:`ImportWarning` " +"as :meth:`~importlib.abc.Loader.exec_module` is preferred. (Contributed by " +"Brett Cannon in :issue:`26131`.)" msgstr "" -"引入系統使用 :meth:`~importlib.abc.Loader.load_module` 現在會觸發 :exc:" -"`ImportWarning`,因為 :meth:`~importlib.abc.Loader.exec_module` 是目前首選。" -"(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" +"引入系統使用 :meth:`~importlib.abc.Loader.load_module` 現在會觸" +"發 :exc:`ImportWarning`,因為 :meth:`~importlib.abc.Loader.exec_module` 是目" +"前首選。(由 Brett Cannon 在 :issue:`26131` 中貢獻。)" #: ../../whatsnew/3.10.rst:1659 msgid "" @@ -3188,78 +3214,86 @@ msgid "" msgstr "" "引入系統使用 :meth:`!importlib.abc.MetaPathFinder.find_module` 和 :meth:`!" "importlib.abc.PathEntryFinder.find_module` 現在會觸發 :exc:`ImportWarning`," -"因為 :meth:`importlib.abc.MetaPathFinder.find_spec` 和 :meth:`importlib.abc." -"PathEntryFinder.find_spec` 分別是替代方案的首選。你可以使用 :func:`importlib." -"util.spec_from_loader` 來幫助移植。(由 Brett Cannon 在 :issue:`42134` 中貢" -"獻。)" +"因為 :meth:`importlib.abc.MetaPathFinder.find_spec` " +"和 :meth:`importlib.abc.PathEntryFinder.find_spec` 分別是替代方案的首選。你可" +"以使用 :func:`importlib.util.spec_from_loader` 來幫助移植。(由 Brett Cannon " +"在 :issue:`42134` 中貢獻。)" #: ../../whatsnew/3.10.rst:1668 msgid "" "The use of :meth:`!importlib.abc.PathEntryFinder.find_loader` by the import " -"system now triggers an :exc:`ImportWarning` as :meth:`importlib.abc." -"PathEntryFinder.find_spec` is preferred. You can use :func:`importlib.util." -"spec_from_loader` to help in porting. (Contributed by Brett Cannon in :issue:" -"`43672`.)" +"system now triggers an :exc:`ImportWarning` " +"as :meth:`importlib.abc.PathEntryFinder.find_spec` is preferred. You can " +"use :func:`importlib.util.spec_from_loader` to help in porting. (Contributed " +"by Brett Cannon in :issue:`43672`.)" msgstr "" -"引入系統使用 :meth:`!importlib.abc.PathEntryFinder.find_loader` 現在會觸發 :" -"exc:`ImportWarning`,因為 :meth:`importlib.abc.PathEntryFinder.find_spec` 是" -"首選。你可以使用 :func:`importlib.util.spec_from_loader` 來幫助移植。(由 " -"Brett Cannon 在 :issue:`43672` 中貢獻。)" +"引入系統使用 :meth:`!importlib.abc.PathEntryFinder.find_loader` 現在會觸" +"發 :exc:`ImportWarning`,因" +"為 :meth:`importlib.abc.PathEntryFinder.find_spec` 是首選。你可以使" +"用 :func:`importlib.util.spec_from_loader` 來幫助移植。(由 Brett Cannon " +"在 :issue:`43672` 中貢獻。)" #: ../../whatsnew/3.10.rst:1674 msgid "" -"The various implementations of :meth:`!importlib.abc.MetaPathFinder." -"find_module` ( :meth:`!importlib.machinery.BuiltinImporter.find_module`, :" -"meth:`!importlib.machinery.FrozenImporter.find_module`, :meth:`!importlib." -"machinery.WindowsRegistryFinder.find_module`, :meth:`!importlib.machinery." -"PathFinder.find_module`, :meth:`!importlib.abc.MetaPathFinder." -"find_module` ), :meth:`!importlib.abc.PathEntryFinder.find_module` ( :meth:`!" -"importlib.machinery.FileFinder.find_module` ), and :meth:`!importlib.abc." -"PathEntryFinder.find_loader` ( :meth:`!importlib.machinery.FileFinder." -"find_loader` ) now raise :exc:`DeprecationWarning` and are slated for " -"removal in Python 3.12 (previously they were documented as deprecated in " -"Python 3.4). (Contributed by Brett Cannon in :issue:`42135`.)" +"The various implementations of :meth:`!" +"importlib.abc.MetaPathFinder.find_module` ( :meth:`!" +"importlib.machinery.BuiltinImporter.find_module`, :meth:`!" +"importlib.machinery.FrozenImporter.find_module`, :meth:`!" +"importlib.machinery.WindowsRegistryFinder.find_module`, :meth:`!" +"importlib.machinery.PathFinder.find_module`, :meth:`!" +"importlib.abc.MetaPathFinder.find_module` ), :meth:`!" +"importlib.abc.PathEntryFinder.find_module` ( :meth:`!" +"importlib.machinery.FileFinder.find_module` ), and :meth:`!" +"importlib.abc.PathEntryFinder.find_loader` ( :meth:`!" +"importlib.machinery.FileFinder.find_loader` ) now " +"raise :exc:`DeprecationWarning` and are slated for removal in Python 3.12 " +"(previously they were documented as deprecated in Python 3.4). (Contributed " +"by Brett Cannon in :issue:`42135`.)" msgstr "" ":meth:`!importlib.abc.MetaPathFinder.find_module` 的各種實作(:meth:`!" -"importlib.machinery.BuiltinImporter.find_module`、:meth:`!importlib." -"machinery.FrozenImporter.find_module`、:meth:`!importlib.machinery." -"WindowsRegistryFinder.find_module`、:meth:`!importlib.machinery.PathFinder." -"find_module`、:meth:`!importlib.abc.MetaPathFinder.find_module` )、:meth:`!" -"importlib.abc.PathEntryFinder.find_module` (:meth:`!importlib.machinery." -"FileFinder.find_module` ) 和 :meth:`!importlib.abc.PathEntryFinder." -"find_loader` (:meth:`!importlib.machinery.FileFinder.find_loader` ) 現在引" +"importlib.machinery.BuiltinImporter.find_module`、:meth:`!" +"importlib.machinery.FrozenImporter.find_module`、:meth:`!" +"importlib.machinery.WindowsRegistryFinder.find_module`、:meth:`!" +"importlib.machinery.PathFinder.find_module`、:meth:`!" +"importlib.abc.MetaPathFinder.find_module` )、:meth:`!" +"importlib.abc.PathEntryFinder.find_module` (:meth:`!" +"importlib.machinery.FileFinder.find_module` ) 和 :meth:`!" +"importlib.abc.PathEntryFinder.find_loader` (:meth:`!" +"importlib.machinery.FileFinder.find_loader` ) 現在引" "發 :exc:`DeprecationWarning` 並計劃在 Python 3.12 中刪除(之前它們已在 " "Python 3.4 中被記錄為已棄用)。(由 Brett Cannon 在 :issue:`42135` 中貢獻。)" #: ../../whatsnew/3.10.rst:1689 msgid "" -":class:`!importlib.abc.Finder` is deprecated (including its sole method, :" -"meth:`!find_module`). Both :class:`importlib.abc.MetaPathFinder` and :class:" -"`importlib.abc.PathEntryFinder` no longer inherit from the class. Users " -"should inherit from one of these two classes as appropriate instead. " +":class:`!importlib.abc.Finder` is deprecated (including its sole " +"method, :meth:`!find_module`). Both :class:`importlib.abc.MetaPathFinder` " +"and :class:`importlib.abc.PathEntryFinder` no longer inherit from the class. " +"Users should inherit from one of these two classes as appropriate instead. " "(Contributed by Brett Cannon in :issue:`42135`.)" msgstr "" ":class:`!importlib.abc.Finder` 已被棄用(包括其唯一方法 :meth:`!" -"find_module`)。:class:`importlib.abc.MetaPathFinder` 和 :class:`importlib." -"abc.PathEntryFinder` 都不再從該類別繼承。使用者應該根據需求來選擇其一以繼承。" -"(由 Brett Cannon 在 :issue:`42135` 中貢獻。)" +"find_module`)。:class:`importlib.abc.MetaPathFinder` " +"和 :class:`importlib.abc.PathEntryFinder` 都不再從該類別繼承。使用者應該根據" +"需求來選擇其一以繼承。(由 Brett Cannon 在 :issue:`42135` 中貢獻。)" #: ../../whatsnew/3.10.rst:1696 msgid "" "The deprecations of :mod:`!imp`, :func:`!importlib.find_loader`, :func:`!" -"importlib.util.set_package_wrapper`, :func:`!importlib.util." -"set_loader_wrapper`, :func:`!importlib.util.module_for_loader`, :class:`!" -"pkgutil.ImpImporter`, and :class:`!pkgutil.ImpLoader` have all been updated " -"to list Python 3.12 as the slated version of removal (they began raising :" -"exc:`DeprecationWarning` in previous versions of Python). (Contributed by " -"Brett Cannon in :issue:`43720`.)" -msgstr "" -"棄用 :mod:`!imp`、:func:`!importlib.find_loader`、:func:`!importlib.util." -"set_package_wrapper`、:func:`!importlib.util.set_loader_wrapper`、:func:`!" +"importlib.util.set_package_wrapper`, :func:`!" +"importlib.util.set_loader_wrapper`, :func:`!" +"importlib.util.module_for_loader`, :class:`!pkgutil.ImpImporter`, " +"and :class:`!pkgutil.ImpLoader` have all been updated to list Python 3.12 as " +"the slated version of removal (they began raising :exc:`DeprecationWarning` " +"in previous versions of Python). (Contributed by Brett Cannon " +"in :issue:`43720`.)" +msgstr "" +"棄用 :mod:`!imp`、:func:`!importlib.find_loader`、:func:`!" +"importlib.util.set_package_wrapper`、:func:`!" +"importlib.util.set_loader_wrapper`、:func:`!" "importlib.util.module_for_loader`、:class:`!pkgutil.ImpImporter` 和 :class:`!" "pkgutil.ImpLoader` 均已更新,將於 Python 3.12 列為預定的刪除版本(它們開始在" -"過去版本的 Python 中引發 :exc:`DeprecationWarning`) 。(由 Brett Cannon 在 :" -"issue:`43720` 中貢獻。)" +"過去版本的 Python 中引發 :exc:`DeprecationWarning`) 。(由 Brett Cannon " +"在 :issue:`43720` 中貢獻。)" #: ../../whatsnew/3.10.rst:1706 msgid "" @@ -3274,22 +3308,22 @@ msgstr "" #: ../../whatsnew/3.10.rst:1712 msgid "" -":meth:`!importlib.abc.Loader.module_repr`, :meth:`!importlib.machinery." -"FrozenLoader.module_repr`, and :meth:`!importlib.machinery.BuiltinLoader." -"module_repr` are deprecated and slated for removal in Python 3.12. " -"(Contributed by Brett Cannon in :issue:`42136`.)" +":meth:`!importlib.abc.Loader.module_repr`, :meth:`!" +"importlib.machinery.FrozenLoader.module_repr`, and :meth:`!" +"importlib.machinery.BuiltinLoader.module_repr` are deprecated and slated for " +"removal in Python 3.12. (Contributed by Brett Cannon in :issue:`42136`.)" msgstr "" -":meth:`!importlib.abc.Loader.module_repr`、:meth:`!importlib.machinery." -"FrozenLoader.module_repr` 和 :meth:`!importlib.machinery.BuiltinLoader." -"module_repr` 已棄用並計劃在 Python 3.12 中刪除。(由 Brett Cannon 在 :issue:" -"`42136` 中貢獻。)" +":meth:`!importlib.abc.Loader.module_repr`、:meth:`!" +"importlib.machinery.FrozenLoader.module_repr` 和 :meth:`!" +"importlib.machinery.BuiltinLoader.module_repr` 已棄用並計劃在 Python 3.12 中" +"刪除。(由 Brett Cannon 在 :issue:`42136` 中貢獻。)" #: ../../whatsnew/3.10.rst:1718 msgid "" "``sqlite3.OptimizedUnicode`` has been undocumented and obsolete since Python " "3.3, when it was made an alias to :class:`str`. It is now deprecated, " -"scheduled for removal in Python 3.12. (Contributed by Erlend E. Aasland in :" -"issue:`42264`.)" +"scheduled for removal in Python 3.12. (Contributed by Erlend E. Aasland " +"in :issue:`42264`.)" msgstr "" "自 Python 3.3 起,``sqlite3.OptimizedUnicode`` 就沒有文件記錄並且已過時,當時" "它被用作 :class:`str` 的別名。它現已被棄用,並計劃在 Python 3.12 中刪除。" @@ -3358,8 +3392,8 @@ msgid "" "3.12. Use :meth:`pathlib.Path.hardlink_to` instead. (Contributed by Barney " "Gale in :issue:`39950`.)" msgstr "" -":meth:`!pathlib.Path.link_to` 已棄用並計劃在 Python 3.12 中刪除。請改用 :" -"meth:`pathlib.Path.hardlink_to`。(由 Barney Gale 在 :issue:`39950` 中貢" +":meth:`!pathlib.Path.link_to` 已棄用並計劃在 Python 3.12 中刪除。請改" +"用 :meth:`pathlib.Path.hardlink_to`。(由 Barney Gale 在 :issue:`39950` 中貢" "獻。)" #: ../../whatsnew/3.10.rst:1756 @@ -3367,8 +3401,8 @@ msgid "" "``cgi.log()`` is deprecated and slated for removal in Python 3.12. " "(Contributed by Inada Naoki in :issue:`41139`.)" msgstr "" -"``cgi.log()`` 已棄用並計劃在 Python 3.12 中刪除。(由 Inada Naoki 在 :issue:" -"`41139` 中貢獻。)" +"``cgi.log()`` 已棄用並計劃在 Python 3.12 中刪除。(由 Inada Naoki " +"在 :issue:`41139` 中貢獻。)" #: ../../whatsnew/3.10.rst:1759 msgid "" @@ -3382,25 +3416,27 @@ msgstr "" msgid "" ":data:`!OP_NO_SSLv2`, :data:`!OP_NO_SSLv3`, :data:`!OP_NO_TLSv1`, :data:`!" "OP_NO_TLSv1_1`, :data:`!OP_NO_TLSv1_2`, and :data:`!OP_NO_TLSv1_3` are " -"replaced by :attr:`~ssl.SSLContext.minimum_version` and :attr:`~ssl." -"SSLContext.maximum_version`." +"replaced by :attr:`~ssl.SSLContext.minimum_version` " +"and :attr:`~ssl.SSLContext.maximum_version`." msgstr "" ":data:`!OP_NO_SSLv2`、:data:`!OP_NO_SSLv3`、:data:`!OP_NO_TLSv1`、:data:`!" "OP_NO_TLSv1_1`、:data:`!OP_NO_TLSv1_2`、和 :data:`!OP_NO_TLSv1_3` 已被替換" -"為 :attr:`~ssl.sslSSLContext.minimum_version` 和 :attr:`~ssl.sslSSLContext." -"maximum_version`。" +"為 :attr:`~ssl.sslSSLContext.minimum_version` " +"和 :attr:`~ssl.sslSSLContext.maximum_version`。" #: ../../whatsnew/3.10.rst:1768 msgid "" -":data:`!PROTOCOL_SSLv2`, :data:`!PROTOCOL_SSLv3`, :data:`!PROTOCOL_SSLv23`, :" -"data:`!PROTOCOL_TLSv1`, :data:`!PROTOCOL_TLSv1_1`, :data:`!" -"PROTOCOL_TLSv1_2`, and :const:`!PROTOCOL_TLS` are deprecated in favor of :" -"const:`~ssl.PROTOCOL_TLS_CLIENT` and :const:`~ssl.PROTOCOL_TLS_SERVER`" +":data:`!PROTOCOL_SSLv2`, :data:`!PROTOCOL_SSLv3`, :data:`!" +"PROTOCOL_SSLv23`, :data:`!PROTOCOL_TLSv1`, :data:`!" +"PROTOCOL_TLSv1_1`, :data:`!PROTOCOL_TLSv1_2`, and :const:`!PROTOCOL_TLS` are " +"deprecated in favor of :const:`~ssl.PROTOCOL_TLS_CLIENT` " +"and :const:`~ssl.PROTOCOL_TLS_SERVER`" msgstr "" -":data:`!PROTOCOL_SSLv2`、:data:`!PROTOCOL_SSLv3`、:data:`!PROTOCOL_SSLv23`、:" -"data:`!PROTOCOL_TLSv1`、:data:`!PROTOCOL_TLSv1_1`、:data:`!PROTOCOL_TLSv1_2` " -"和 :const:`!PROTOCOL_TLS` 已棄用,取而代之的是 :const:`~ssl." -"PROTOCOL_TLS_CLIENT` 和 :const:`~ssl.PROTOCOL_TLS_SERVER`" +":data:`!PROTOCOL_SSLv2`、:data:`!PROTOCOL_SSLv3`、:data:`!" +"PROTOCOL_SSLv23`、:data:`!PROTOCOL_TLSv1`、:data:`!" +"PROTOCOL_TLSv1_1`、:data:`!PROTOCOL_TLSv1_2` 和 :const:`!PROTOCOL_TLS` 已棄" +"用,取而代之的是 :const:`~ssl.PROTOCOL_TLS_CLIENT` " +"和 :const:`~ssl.PROTOCOL_TLS_SERVER`" #: ../../whatsnew/3.10.rst:1774 msgid ":func:`!wrap_socket` is replaced by :meth:`ssl.SSLContext.wrap_socket`" @@ -3416,11 +3452,11 @@ msgstr ":func:`!RAND_pseudo_bytes`, :func:`!RAND_egd`" #: ../../whatsnew/3.10.rst:1780 msgid "" -"NPN features like :meth:`ssl.SSLSocket.selected_npn_protocol` and :meth:`ssl." -"SSLContext.set_npn_protocols` are replaced by ALPN." +"NPN features like :meth:`ssl.SSLSocket.selected_npn_protocol` " +"and :meth:`ssl.SSLContext.set_npn_protocols` are replaced by ALPN." msgstr "" -"NPN 功能如 :meth:`ssl.SSLSocket.selected_npn_protocol` 和 :meth:`ssl." -"SSLContext.set_npn_protocols` 已被 ALPN 取代。" +"NPN 功能如 :meth:`ssl.SSLSocket.selected_npn_protocol` " +"和 :meth:`ssl.SSLContext.set_npn_protocols` 已被 ALPN 取代。" #: ../../whatsnew/3.10.rst:1783 msgid "" @@ -3435,16 +3471,16 @@ msgstr "" #: ../../whatsnew/3.10.rst:1788 msgid "" -"Importing from the ``typing.io`` and ``typing.re`` submodules will now emit :" -"exc:`DeprecationWarning`. These submodules will be removed in a future " -"version of Python. Anything belonging to these submodules should be " +"Importing from the ``typing.io`` and ``typing.re`` submodules will now " +"emit :exc:`DeprecationWarning`. These submodules will be removed in a " +"future version of Python. Anything belonging to these submodules should be " "imported directly from :mod:`typing` instead. (Contributed by Sebastian " "Rittau in :issue:`38291`.)" msgstr "" -"從 ``typing.io`` 和 ``typing.re`` 子模組引入現在將發出 :exc:" -"`DeprecationWarning`。這些子模組將在 Python 的未來版本中刪除。屬於這些子模組" -"的任何內容都應該直接從 :mod:`typing` 引入。(由 Sebastian Rittau 在 :issue:" -"`38291` 中貢獻。)" +"從 ``typing.io`` 和 ``typing.re`` 子模組引入現在將發" +"出 :exc:`DeprecationWarning`。這些子模組將在 Python 的未來版本中刪除。屬於這" +"些子模組的任何內容都應該直接從 :mod:`typing` 引入。(由 Sebastian Rittau " +"在 :issue:`38291` 中貢獻。)" #: ../../whatsnew/3.10.rst:1797 ../../whatsnew/3.10.rst:2220 msgid "Removed" @@ -3454,8 +3490,8 @@ msgstr "已刪除" msgid "" "Removed special methods ``__int__``, ``__float__``, ``__floordiv__``, " "``__mod__``, ``__divmod__``, ``__rfloordiv__``, ``__rmod__`` and " -"``__rdivmod__`` of the :class:`complex` class. They always raised a :exc:" -"`TypeError`. (Contributed by Serhiy Storchaka in :issue:`41974`.)" +"``__rdivmod__`` of the :class:`complex` class. They always raised " +"a :exc:`TypeError`. (Contributed by Serhiy Storchaka in :issue:`41974`.)" msgstr "" "刪除了 :class:`complex` 類別的特殊方法 ``__int__``、``__float__``、" "``__floordiv__``、``__mod__``、``__divmod__``、``__rfloordiv__``、" @@ -3467,8 +3503,8 @@ msgid "" "The ``ParserBase.error()`` method from the private and undocumented " "``_markupbase`` module has been removed. :class:`html.parser.HTMLParser` is " "the only subclass of ``ParserBase`` and its ``error()`` implementation was " -"already removed in Python 3.5. (Contributed by Berker Peksag in :issue:" -"`31844`.)" +"already removed in Python 3.5. (Contributed by Berker Peksag " +"in :issue:`31844`.)" msgstr "" "``_markupbase`` 模組中私有、未於文件記錄的 ``ParserBase.error()`` 方法已被刪" "除。:class:`html.parser.HTMLParser` 是 ``ParserBase`` 的唯一子類別,它的 " @@ -3479,12 +3515,12 @@ msgstr "" msgid "" "Removed the ``unicodedata.ucnhash_CAPI`` attribute which was an internal " "PyCapsule object. The related private ``_PyUnicode_Name_CAPI`` structure was " -"moved to the internal C API. (Contributed by Victor Stinner in :issue:" -"`42157`.)" +"moved to the internal C API. (Contributed by Victor Stinner " +"in :issue:`42157`.)" msgstr "" "刪除了 ``unicodedata.ucnhash_CAPI`` 屬性,該屬性是內部 PyCapsule 物件。相關的" -"私有 ``_PyUnicode_Name_CAPI`` 結構已移至內部 C API。(由 Victor Stinner 在 :" -"issue:`42157` 中貢獻。)" +"私有 ``_PyUnicode_Name_CAPI`` 結構已移至內部 C API。(由 Victor Stinner " +"在 :issue:`42157` 中貢獻。)" #: ../../whatsnew/3.10.rst:1816 msgid "" @@ -3528,24 +3564,24 @@ msgid "" "now due to the :mod:`!_warnings` module was converted to a builtin module in " "2.6. (Contributed by Hai Shi in :issue:`42599`.)" msgstr "" -"刪除了 :c:func:`!PyModule_GetWarningsModule` 函式,該函式現在無用,因為 :mod:" -"`!_warnings` 模組在 2.6 中已轉換為內建模組。(由 Hai Shi 在 :issue:`42599` 中" -"貢獻。)" +"刪除了 :c:func:`!PyModule_GetWarningsModule` 函式,該函式現在無用,因" +"為 :mod:`!_warnings` 模組在 2.6 中已轉換為內建模組。(由 Hai Shi " +"在 :issue:`42599` 中貢獻。)" #: ../../whatsnew/3.10.rst:1837 msgid "" "Remove deprecated aliases to :ref:`collections-abstract-base-classes` from " -"the :mod:`collections` module. (Contributed by Victor Stinner in :issue:" -"`37324`.)" +"the :mod:`collections` module. (Contributed by Victor Stinner " +"in :issue:`37324`.)" msgstr "" "從 :mod:`collections` 模組中刪除已棄用的、對 :ref:`collections-abstract-base-" "classes` 的別名。(由 Victor Stinner 在 :issue:`37324` 中貢獻。)" #: ../../whatsnew/3.10.rst:1841 msgid "" -"The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ 's :" -"doc:`high-level API <../library/asyncio-api-index>` following deprecation in " -"Python 3.8. The motivation behind this change is multifold:" +"The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ " +"'s :doc:`high-level API <../library/asyncio-api-index>` following " +"deprecation in Python 3.8. The motivation behind this change is multifold:" msgstr "" "在 Python 3.8 中棄用後,``loop`` 參數已從大多數 :mod:`asyncio` 的\\ :doc:`高" "階 API <../library/asyncio-api-index>` 中刪除。這一變化的背後動機是多方面的:" @@ -3574,16 +3610,16 @@ msgid "" "Note that the low-level API will still accept ``loop``. See :ref:`changes-" "python-api` for examples of how to replace existing code." msgstr "" -"請注意,低階 API 仍會接受 ``loop``。有關如何替換現有程式碼的範例,請參閱 :" -"ref:`changes-python-api`。" +"請注意,低階 API 仍會接受 ``loop``。有關如何替換現有程式碼的範例,請參" +"閱 :ref:`changes-python-api`。" #: ../../whatsnew/3.10.rst:1855 ../../whatsnew/3.10.rst:1927 msgid "" "(Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and Kyle " "Stanley in :issue:`42392`.)" msgstr "" -"(由 Yurii Karabas、Andrew Svetlov、Yury Selivanov 和 Kyle Stanley 在 :issue:" -"`42392` 中貢獻。)" +"(由 Yurii Karabas、Andrew Svetlov、Yury Selivanov 和 Kyle Stanley " +"在 :issue:`42392` 中貢獻。)" #: ../../whatsnew/3.10.rst:1860 ../../whatsnew/3.10.rst:2147 msgid "Porting to Python 3.10" @@ -3615,26 +3651,27 @@ msgstr "" #: ../../whatsnew/3.10.rst:1880 msgid "Changes in the Python API" -msgstr "Python API 的變化" +msgstr "Python API 的變更" #: ../../whatsnew/3.10.rst:1882 msgid "" -"The *etype* parameters of the :func:`~traceback.format_exception`, :func:" -"`~traceback.format_exception_only`, and :func:`~traceback.print_exception` " -"functions in the :mod:`traceback` module have been renamed to *exc*. " -"(Contributed by Zackery Spytz and Matthias Bussonnier in :issue:`26389`.)" +"The *etype* parameters of " +"the :func:`~traceback.format_exception`, :func:`~traceback.format_exception_only`, " +"and :func:`~traceback.print_exception` functions in the :mod:`traceback` " +"module have been renamed to *exc*. (Contributed by Zackery Spytz and " +"Matthias Bussonnier in :issue:`26389`.)" msgstr "" -":func:`~traceback.format_exception`、:func:`~traceback." -"format_exception_only` 和 :mod:`traceback` 模組中的 :func:`~traceback." -"print_exception` 函式的 *etype* 參數已重命名為 *exc*。(由 Zackery Spytz 和 " -"Matthias Bussonnier 在 :issue:`26389` 中貢獻。)" +":func:`~traceback.format_exception`、:func:`~traceback.format_exception_only` " +"和 :mod:`traceback` 模組中的 :func:`~traceback.print_exception` 函式的 " +"*etype* 參數已重命名為 *exc*。(由 Zackery Spytz 和 Matthias Bussonnier " +"在 :issue:`26389` 中貢獻。)" #: ../../whatsnew/3.10.rst:1888 msgid "" -":mod:`atexit`: At Python exit, if a callback registered with :func:`atexit." -"register` fails, its exception is now logged. Previously, only some " -"exceptions were logged, and the last exception was always silently ignored. " -"(Contributed by Victor Stinner in :issue:`42639`.)" +":mod:`atexit`: At Python exit, if a callback registered " +"with :func:`atexit.register` fails, its exception is now logged. Previously, " +"only some exceptions were logged, and the last exception was always silently " +"ignored. (Contributed by Victor Stinner in :issue:`42639`.)" msgstr "" ":mod:`atexit`:在 Python 退出時,如果一個使用 :func:`atexit.register` 註冊的" "回呼 (callback) 失敗,該例外現在會被記錄下來。在以前只記錄一些例外,並且最後" @@ -3649,34 +3686,35 @@ msgid "" "accesses the arguments via :func:`typing.get_args` or ``__args__`` need to " "account for this change. Furthermore, :exc:`TypeError` may be raised for " "invalid forms of parameterizing :class:`collections.abc.Callable` which may " -"have passed silently in Python 3.9. (Contributed by Ken Jin in :issue:" -"`42195`.)" -msgstr "" -":class:`collections.abc.Callable` 泛型現在會攤平型別參數,類似於 :data:" -"`typing.Callable` 目前的做法。這意味著 ``collections.abc.Callable[[int, " -"str], str]`` 將具有 ``(int, str, str)`` 的 ``__args__``;以前這是 ``([int, " -"str], str)``。透過 :func:`typing.get_args` 或 ``__args__`` 存取參數的程式碼需" -"要考慮此變更。此外,對於無效形式的參數化 :class:`collections.abc.Callable`," -"可能會引發 :exc:`TypeError`,而在 Python 3.9 中,該參數可能已被默默地傳遞。" -"(由 Ken Jin 在 :issue:`42195` 中貢獻。)" +"have passed silently in Python 3.9. (Contributed by Ken Jin " +"in :issue:`42195`.)" +msgstr "" +":class:`collections.abc.Callable` 泛型現在會攤平型別參數,類似" +"於 :data:`typing.Callable` 目前的做法。這意味著 " +"``collections.abc.Callable[[int, str], str]`` 將具有 ``(int, str, str)`` 的 " +"``__args__``;以前這是 ``([int, str], str)``。透過 :func:`typing.get_args` " +"或 ``__args__`` 存取參數的程式碼需要考慮此變更。此外,對於無效形式的參數" +"化 :class:`collections.abc.Callable`,可能會引發 :exc:`TypeError`,而在 " +"Python 3.9 中,該參數可能已被默默地傳遞。(由 Ken Jin 在 :issue:`42195` 中貢" +"獻。)" #: ../../whatsnew/3.10.rst:1904 msgid "" ":meth:`socket.htons` and :meth:`socket.ntohs` now raise :exc:`OverflowError` " "instead of :exc:`DeprecationWarning` if the given parameter will not fit in " -"a 16-bit unsigned integer. (Contributed by Erlend E. Aasland in :issue:" -"`42393`.)" +"a 16-bit unsigned integer. (Contributed by Erlend E. Aasland " +"in :issue:`42393`.)" msgstr "" -"如果給定參數不適合 16 位元無符號整數 (16-bit unsigned integer),:meth:" -"`socket.htons` 和 :meth:`socket.ntohs` 現在會引發 :exc:`OverflowError` 而不" -"是 :exc:`DeprecationWarning`。(由 Erlend E. Aasland 在 :issue:`42393` 中貢" -"獻。)" +"如果給定參數不適合 16 位元無符號整數 (16-bit unsigned " +"integer),:meth:`socket.htons` 和 :meth:`socket.ntohs` 現在會引" +"發 :exc:`OverflowError` 而不是 :exc:`DeprecationWarning`。(由 Erlend E. " +"Aasland 在 :issue:`42393` 中貢獻。)" #: ../../whatsnew/3.10.rst:1909 msgid "" -"The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ 's :" -"doc:`high-level API <../library/asyncio-api-index>` following deprecation in " -"Python 3.8." +"The ``loop`` parameter has been removed from most of :mod:`asyncio`\\ " +"'s :doc:`high-level API <../library/asyncio-api-index>` following " +"deprecation in Python 3.8." msgstr "" "在 Python 3.8 中棄用後,``loop`` 參數已從大多數 :mod:`asyncio` 的\\ :doc:`高" "階 API <../library/asyncio-api-index>` 中刪除。" @@ -3718,17 +3756,18 @@ msgstr "" msgid "" "The :data:`types.FunctionType` constructor now inherits the current builtins " "if the *globals* dictionary has no ``\"__builtins__\"`` key, rather than " -"using ``{\"None\": None}`` as builtins: same behavior as :func:`eval` and :" -"func:`exec` functions. Defining a function with ``def function(...): ...`` " -"in Python is not affected, globals cannot be overridden with this syntax: it " -"also inherits the current builtins. (Contributed by Victor Stinner in :issue:" -"`42990`.)" -msgstr "" -"如果 *globals* 字典沒有 ``\"__builtins__\"`` 鍵,則 :data:`types." -"FunctionType` 建構函式現在會繼承目前的內建物件,而不是使用 ``{\"None\": None}" -"``:相同行為如 :func:`eval` 和 :func:`exec` 函式。在 Python 中使用 ``def " -"function(...): ...`` 定義函式不受影響,全域變數不能用此語法覆蓋:它也繼承目前" -"的內建物件。(由 Victor Stinner 在 :issue:`42990` 中貢獻。)" +"using ``{\"None\": None}`` as builtins: same behavior as :func:`eval` " +"and :func:`exec` functions. Defining a function with ``def " +"function(...): ...`` in Python is not affected, globals cannot be overridden " +"with this syntax: it also inherits the current builtins. (Contributed by " +"Victor Stinner in :issue:`42990`.)" +msgstr "" +"如果 *globals* 字典沒有 ``\"__builtins__\"`` 鍵," +"則 :data:`types.FunctionType` 建構函式現在會繼承目前的內建物件,而不是使用 " +"``{\"None\": None}``:相同行為如 :func:`eval` 和 :func:`exec` 函式。在 " +"Python 中使用 ``def function(...): ...`` 定義函式不受影響,全域變數不能用此語" +"法覆蓋:它也繼承目前的內建物件。(由 Victor Stinner 在 :issue:`42990` 中貢" +"獻。)" #: ../../whatsnew/3.10.rst:1939 msgid "Changes in the C API" @@ -3782,14 +3821,15 @@ msgstr "" msgid "" "To compile a file given a ``char *`` filename, explicitly open the file, " "read it and compile the result. One way to do this is using the :py:mod:`io` " -"module with :c:func:`PyImport_ImportModule`, :c:func:`PyObject_CallMethod`, :" -"c:func:`PyBytes_AsString` and :c:func:`Py_CompileString`, as sketched below. " -"(Declarations and error handling are omitted.) ::" +"module " +"with :c:func:`PyImport_ImportModule`, :c:func:`PyObject_CallMethod`, :c:func:`PyBytes_AsString` " +"and :c:func:`Py_CompileString`, as sketched below. (Declarations and error " +"handling are omitted.) ::" msgstr "" "要編譯給定 ``char *`` 檔案名稱的檔案,請顯式打開該檔案,讀取它並編譯結果。一" -"種方法是使用 :py:mod:`io` 模組和 :c:func:`PyImport_ImportModule`、:c:func:" -"`PyObject_CallMethod`、:c:func:`PyBytes_AsString` 和 :c:func:" -"`Py_CompileString`,如下所示。(宣告和錯誤處理在此被省略。): ::" +"種方法是使用 :py:mod:`io` 模組" +"和 :c:func:`PyImport_ImportModule`、:c:func:`PyObject_CallMethod`、:c:func:`PyBytes_AsString` " +"和 :c:func:`Py_CompileString`,如下所示。(宣告和錯誤處理在此被省略。): ::" #: ../../whatsnew/3.10.rst:1966 msgid "" @@ -3816,8 +3856,8 @@ msgid "" "string. This means that this number needs to be multiplied by 2 to be used " "with APIs that expect a byte offset instead (like :c:func:`PyCode_Addr2Line` " "for example). Notice as well that the :attr:`!f_lasti` member of " -"``FrameObject`` objects is not considered stable: please use :c:func:" -"`PyFrame_GetLineNumber` instead." +"``FrameObject`` objects is not considered stable: please " +"use :c:func:`PyFrame_GetLineNumber` instead." msgstr "" "對於 ``FrameObject`` 物件,:attr:`~frame.f_lasti` 成員現在表示了字碼偏移量 " "(wordcode offset),而不是位元組碼字串的簡單偏移量。這意味著這個數字需要乘以 " @@ -3871,8 +3911,8 @@ msgid "" "The :mod:`atexit` module must now always be built as a built-in module. " "(Contributed by Victor Stinner in :issue:`42639`.)" msgstr "" -":mod:`atexit` 模組現在必須都被建置為內建模組。(由 Victor Stinner 在 :issue:" -"`42639` 中貢獻。)" +":mod:`atexit` 模組現在必須都被建置為內建模組。(由 Victor Stinner " +"在 :issue:`42639` 中貢獻。)" #: ../../whatsnew/3.10.rst:2004 msgid "" @@ -3881,8 +3921,8 @@ msgid "" "Petazzoni and Peixing Xin in :issue:`27640`.)" msgstr "" "將 :option:`--disable-test-modules` 選項新增到 ``configure`` 腳本中:不建置也" -"不安裝測試模組。(由 Xavier de Gaye、Thomas Petazzoni 和 Peixing Xin 在 :" -"issue:`27640` 中貢獻。)" +"不安裝測試模組。(由 Xavier de Gaye、Thomas Petazzoni 和 Peixing Xin " +"在 :issue:`27640` 中貢獻。)" #: ../../whatsnew/3.10.rst:2008 msgid "" @@ -3901,12 +3941,12 @@ msgstr "" msgid "" "Some Linux distribution packaging policies recommend against bundling " "dependencies. For example, Fedora installs wheel packages in the ``/usr/" -"share/python-wheels/`` directory and don't install the ``ensurepip." -"_bundled`` package." +"share/python-wheels/`` directory and don't install the " +"``ensurepip._bundled`` package." msgstr "" "一些 Linux 發行版的打包策略建議不要一併包入依賴項目。例如,Fedora 在 ``/usr/" -"share/python-wheels/`` 目錄中安裝 wheel 套件,並且不安裝 ``ensurepip." -"_bundled`` 套件。" +"share/python-wheels/`` 目錄中安裝 wheel 套件,並且不安裝 " +"``ensurepip._bundled`` 套件。" #: ../../whatsnew/3.10.rst:2019 msgid "(Contributed by Victor Stinner in :issue:`42856`.)" @@ -3919,8 +3959,8 @@ msgid "" "library and not install the ``python.o`` object file." msgstr "" "新增 :option:`configure --without-static-libpython 選項 <--without-static-" -"libpython>` 以不建置 ``libpythonMAJOR.MINOR.a`` 靜態函式庫且不安裝 ``python." -"o`` 目標檔案。" +"libpython>` 以不建置 ``libpythonMAJOR.MINOR.a`` 靜態函式庫且不安裝 " +"``python.o`` 目標檔案。" #: ../../whatsnew/3.10.rst:2025 msgid "(Contributed by Victor Stinner in :issue:`43103`.)" @@ -3966,8 +4006,9 @@ msgid "" "and ABI stability guarantees along with best practices for using the Stable " "ABI." msgstr "" -"用於擴充模組或嵌入 Python 的穩定 ABI(應用程式二進位介面)現已明確定義。 :" -"ref:`stable` 描述了 C API 和 ABI 穩定性保證以及使用穩定 ABI 的最佳實踐。" +"用於擴充模組或嵌入 Python 的穩定 ABI(應用程式二進位介面)現已明確定" +"義。 :ref:`stable` 描述了 C API 和 ABI 穩定性保證以及使用穩定 ABI 的最佳實" +"踐。" #: ../../whatsnew/3.10.rst:2050 msgid "(Contributed by Petr Viktorin in :pep:`652` and :issue:`43795`.)" @@ -3975,9 +4016,9 @@ msgstr "(由 Petr Viktorin 在 :pep:`652` 和 :issue:`43795` 中貢獻。)" #: ../../whatsnew/3.10.rst:2055 msgid "" -"The result of :c:func:`PyNumber_Index` now always has exact type :class:" -"`int`. Previously, the result could have been an instance of a subclass of " -"``int``. (Contributed by Serhiy Storchaka in :issue:`40792`.)" +"The result of :c:func:`PyNumber_Index` now always has exact " +"type :class:`int`. Previously, the result could have been an instance of a " +"subclass of ``int``. (Contributed by Serhiy Storchaka in :issue:`40792`.)" msgstr "" ":c:func:`PyNumber_Index` 的結果現在都具有精確的 :class:`int` 型別。在以前,結" "果可能是 ``int`` 子類別的實例。(由 Serhiy Storchaka 在 :issue:`40792` 中貢" @@ -3990,20 +4031,21 @@ msgid "" "Python executable. (Contributed by Victor Stinner in :issue:`23427`.)" msgstr "" "將新的 :c:member:`~PyConfig.orig_argv` 成員新增到 :c:type:`PyConfig` 結構:傳" -"遞給 Python 可執行檔案的原始命令列參數列表。(由 Victor Stinner 在 :issue:" -"`23427` 中貢獻。)" +"遞給 Python 可執行檔案的原始命令列參數列表。(由 Victor Stinner " +"在 :issue:`23427` 中貢獻。)" #: ../../whatsnew/3.10.rst:2064 msgid "" -"The :c:func:`PyDateTime_DATE_GET_TZINFO` and :c:func:" -"`PyDateTime_TIME_GET_TZINFO` macros have been added for accessing the " -"``tzinfo`` attributes of :class:`datetime.datetime` and :class:`datetime." -"time` objects. (Contributed by Zackery Spytz in :issue:`30155`.)" +"The :c:func:`PyDateTime_DATE_GET_TZINFO` " +"and :c:func:`PyDateTime_TIME_GET_TZINFO` macros have been added for " +"accessing the ``tzinfo`` attributes of :class:`datetime.datetime` " +"and :class:`datetime.time` objects. (Contributed by Zackery Spytz " +"in :issue:`30155`.)" msgstr "" -"新增了 :c:func:`PyDateTime_DATE_GET_TZINFO` 和 :c:func:" -"`PyDateTime_TIME_GET_TZINFO` 巨集,用於存取 :class:`datetime.datetime` 和 :" -"class:`datetime.time` 物件的 ``tzinfo`` 屬性。(由 Zackery Spytz 在 :issue:" -"`30155` 中貢獻。)" +"新增了 :c:func:`PyDateTime_DATE_GET_TZINFO` " +"和 :c:func:`PyDateTime_TIME_GET_TZINFO` 巨集,用於存" +"取 :class:`datetime.datetime` 和 :class:`datetime.time` 物件的 ``tzinfo`` 屬" +"性。(由 Zackery Spytz 在 :issue:`30155` 中貢獻。)" #: ../../whatsnew/3.10.rst:2070 msgid "" @@ -4032,13 +4074,13 @@ msgstr "" #: ../../whatsnew/3.10.rst:2081 msgid "" -"Add :c:func:`PyModule_AddObjectRef` function: similar to :c:func:" -"`PyModule_AddObject` but don't steal a reference to the value on success. " -"(Contributed by Victor Stinner in :issue:`1635741`.)" +"Add :c:func:`PyModule_AddObjectRef` function: similar " +"to :c:func:`PyModule_AddObject` but don't steal a reference to the value on " +"success. (Contributed by Victor Stinner in :issue:`1635741`.)" msgstr "" -"新增 :c:func:`PyModule_AddObjectRef` 函式:類似於 :c:func:" -"`PyModule_AddObject` 但成功時不竊取對值的參照。(由 Victor Stinner 在 :issue:" -"`1635741` 中貢獻。)" +"新增 :c:func:`PyModule_AddObjectRef` 函式:類似" +"於 :c:func:`PyModule_AddObject` 但成功時不竊取對值的參照。(由 Victor " +"Stinner 在 :issue:`1635741` 中貢獻。)" #: ../../whatsnew/3.10.rst:2086 msgid "" @@ -4051,9 +4093,9 @@ msgstr "" #: ../../whatsnew/3.10.rst:2090 msgid "" -"The :c:func:`PyType_FromSpecWithBases` and :c:func:" -"`PyType_FromModuleAndSpec` functions now accept a single class as the " -"*bases* argument. (Contributed by Serhiy Storchaka in :issue:`42423`.)" +"The :c:func:`PyType_FromSpecWithBases` " +"and :c:func:`PyType_FromModuleAndSpec` functions now accept a single class " +"as the *bases* argument. (Contributed by Serhiy Storchaka in :issue:`42423`.)" msgstr "" ":c:func:`PyType_FromSpecWithBases` 和 :c:func:`PyType_FromModuleAndSpec` 函式" "現在接受單個類別作為 *bases* 引數。(由 Serhiy Storchaka 在 :issue:`42423` 中" @@ -4097,12 +4139,12 @@ msgid "" "The limited C API is now supported if :ref:`Python is built in debug mode " "<debug-build>` (if the ``Py_DEBUG`` macro is defined). In the limited C API, " "the :c:func:`Py_INCREF` and :c:func:`Py_DECREF` functions are now " -"implemented as opaque function calls, rather than accessing directly the :c:" -"member:`PyObject.ob_refcnt` member, if Python is built in debug mode and the " -"``Py_LIMITED_API`` macro targets Python 3.10 or newer. It became possible to " -"support the limited C API in debug mode because the :c:type:`PyObject` " -"structure is the same in release and debug mode since Python 3.8 (see :issue:" -"`36465`)." +"implemented as opaque function calls, rather than accessing directly " +"the :c:member:`PyObject.ob_refcnt` member, if Python is built in debug mode " +"and the ``Py_LIMITED_API`` macro targets Python 3.10 or newer. It became " +"possible to support the limited C API in debug mode because " +"the :c:type:`PyObject` structure is the same in release and debug mode since " +"Python 3.8 (see :issue:`36465`)." msgstr "" "如 :ref:`Python 是在除錯模式 (debug mode) <debug-build>` 下建置的(如果有定" "義 ``Py_DEBUG`` 巨集),現在會支援受限 C API。在受限 C API 中,如果 Python 是" @@ -4115,8 +4157,8 @@ msgstr "" #: ../../whatsnew/3.10.rst:2120 msgid "" "The limited C API is still not supported in the :option:`--with-trace-refs` " -"special build (``Py_TRACE_REFS`` macro). (Contributed by Victor Stinner in :" -"issue:`43688`.)" +"special build (``Py_TRACE_REFS`` macro). (Contributed by Victor Stinner " +"in :issue:`43688`.)" msgstr "" ":option:`--with-trace-refs` 特殊建置(``Py_TRACE_REFS`` 巨集)仍不支援受限 C " "API。(由 Victor Stinner 在 :issue:`43688` 中貢獻。)" @@ -4124,28 +4166,29 @@ msgstr "" #: ../../whatsnew/3.10.rst:2124 msgid "" "Add the :c:func:`Py_Is(x, y) <Py_Is>` function to test if the *x* object is " -"the *y* object, the same as ``x is y`` in Python. Add also the :c:func:" -"`Py_IsNone`, :c:func:`Py_IsTrue`, :c:func:`Py_IsFalse` functions to test if " -"an object is, respectively, the ``None`` singleton, the ``True`` singleton " -"or the ``False`` singleton. (Contributed by Victor Stinner in :issue:" -"`43753`.)" +"the *y* object, the same as ``x is y`` in Python. Add also " +"the :c:func:`Py_IsNone`, :c:func:`Py_IsTrue`, :c:func:`Py_IsFalse` functions " +"to test if an object is, respectively, the ``None`` singleton, the ``True`` " +"singleton or the ``False`` singleton. (Contributed by Victor Stinner " +"in :issue:`43753`.)" msgstr "" "新增 :c:func:`Py_Is(x, y) <Py_Is>` 函式來測試 *x* 物件是否為 *y* 物件,與 " -"Python 中的 ``x is y`` 相同。還新增 :c:func:`Py_IsNone`、:c:func:" -"`Py_IsTrue`、:c:func:`Py_IsFalse` 函式來分別測試物件是否為 ``None`` 單例、 " -"``True`` 單例或 ``False`` 單例。(由 Victor Stinner 在 :issue:`43753` 中貢" -"獻。)" +"Python 中的 ``x is y`` 相同。還新" +"增 :c:func:`Py_IsNone`、:c:func:`Py_IsTrue`、:c:func:`Py_IsFalse` 函式來分別" +"測試物件是否為 ``None`` 單例、 ``True`` 單例或 ``False`` 單例。(由 Victor " +"Stinner 在 :issue:`43753` 中貢獻。)" #: ../../whatsnew/3.10.rst:2131 msgid "" -"Add new functions to control the garbage collector from C code: :c:func:" -"`PyGC_Enable()`, :c:func:`PyGC_Disable()`, :c:func:`PyGC_IsEnabled()`. These " -"functions allow to activate, deactivate and query the state of the garbage " -"collector from C code without having to import the :mod:`gc` module." +"Add new functions to control the garbage collector from C " +"code: :c:func:`PyGC_Enable()`, :c:func:`PyGC_Disable()`, :c:func:`PyGC_IsEnabled()`. " +"These functions allow to activate, deactivate and query the state of the " +"garbage collector from C code without having to import the :mod:`gc` module." msgstr "" -"新增函式以從 C 程式碼控制垃圾收集器::c:func:`PyGC_Enable()`、:c:func:" -"`PyGC_Disable()`、:c:func:`PyGC_IsEnabled()`。這些函式使得能夠從 C 程式碼啟" -"用、停用和查詢垃圾收集器的狀態,而無需引入 :mod:`gc` 模組。" +"新增函式以從 C 程式碼控制垃圾收集" +"器::c:func:`PyGC_Enable()`、:c:func:`PyGC_Disable()`、:c:func:`PyGC_IsEnabled()`。" +"這些函式使得能夠從 C 程式碼啟用、停用和查詢垃圾收集器的狀態,而無需引" +"入 :mod:`gc` 模組。" #: ../../whatsnew/3.10.rst:2138 msgid "" @@ -4162,21 +4205,21 @@ msgid "" "(Contributed by Victor Stinner and Erlend E. Aasland in :issue:`43908`.)" msgstr "" "新增 :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` 型別旗標用於建立不可變型別物件:無法" -"設定或刪除型別屬性。(由 Victor Stinner 和 Erlend E. Aasland 在 :issue:" -"`43908` 中貢獻。)" +"設定或刪除型別屬性。(由 Victor Stinner 和 Erlend E. Aasland " +"在 :issue:`43908` 中貢獻。)" #: ../../whatsnew/3.10.rst:2149 msgid "" -"The ``PY_SSIZE_T_CLEAN`` macro must now be defined to use :c:func:" -"`PyArg_ParseTuple` and :c:func:`Py_BuildValue` formats which use ``#``: " -"``es#``, ``et#``, ``s#``, ``u#``, ``y#``, ``z#``, ``U#`` and ``Z#``. See :" -"ref:`arg-parsing` and :pep:`353`. (Contributed by Victor Stinner in :issue:" -"`40943`.)" +"The ``PY_SSIZE_T_CLEAN`` macro must now be defined to " +"use :c:func:`PyArg_ParseTuple` and :c:func:`Py_BuildValue` formats which use " +"``#``: ``es#``, ``et#``, ``s#``, ``u#``, ``y#``, ``z#``, ``U#`` and ``Z#``. " +"See :ref:`arg-parsing` and :pep:`353`. (Contributed by Victor Stinner " +"in :issue:`40943`.)" msgstr "" -"現在必須定義 ``PY_SSIZE_T_CLEAN`` 巨集以使用 :c:func:`PyArg_ParseTuple` 和 :" -"c:func:`Py_BuildValue` 格式,這些格式使用 ``#``: ``es#``, ``et#``、``s#``、" -"``u#``、``y#``、``z#``、``U#`` 和 ``Z#``。請參閱 :ref:`arg-parsing` 和 :pep:" -"`353`。(由 Victor Stinner 在 :issue:`40943` 中貢獻。)" +"現在必須定義 ``PY_SSIZE_T_CLEAN`` 巨集以使用 :c:func:`PyArg_ParseTuple` " +"和 :c:func:`Py_BuildValue` 格式,這些格式使用 ``#``: ``es#``, ``et#``、" +"``s#``、``u#``、``y#``、``z#``、``U#`` 和 ``Z#``。請參閱 :ref:`arg-parsing` " +"和 :pep:`353`。(由 Victor Stinner 在 :issue:`40943` 中貢獻。)" #: ../../whatsnew/3.10.rst:2155 msgid "" @@ -4210,9 +4253,9 @@ msgid "" "for historical reason. It is no longer allowed. (Contributed by Victor " "Stinner in :issue:`40839`.)" msgstr "" -"由於過去的種種原因,過去在不持有 :term:`GIL` 的情況下呼叫 :c:func:" -"`PyDict_GetItem` 是被允許的。目前已被禁止。(由 Victor Stinner 在 :issue:" -"`40839` 中貢獻。)" +"由於過去的種種原因,過去在不持有 :term:`GIL` 的情況下呼" +"叫 :c:func:`PyDict_GetItem` 是被允許的。目前已被禁止。(由 Victor Stinner " +"在 :issue:`40839` 中貢獻。)" #: ../../whatsnew/3.10.rst:2170 msgid "" @@ -4237,57 +4280,58 @@ msgstr "" #: ../../whatsnew/3.10.rst:2179 msgid "" -":c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:" -"func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` and :c:func:" -"`Py_GetProgramName` functions now return ``NULL`` if called before :c:func:" -"`Py_Initialize` (before Python is initialized). Use the new :ref:`init-" -"config` API to get the :ref:`init-path-config`. (Contributed by Victor " -"Stinner in :issue:`42260`.)" +":c:func:`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, :c:func:`Py_GetProgramFullPath`, :c:func:`Py_GetPythonHome` " +"and :c:func:`Py_GetProgramName` functions now return ``NULL`` if called " +"before :c:func:`Py_Initialize` (before Python is initialized). Use the " +"new :ref:`init-config` API to get the :ref:`init-path-config`. (Contributed " +"by Victor Stinner in :issue:`42260`.)" msgstr "" -"如果在 :c:func:`Py_Initialize` 之前(Python 初始化之前)被呼叫,:c:func:" -"`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:func:`Py_GetExecPrefix`、:c:func:" -"`Py_GetProgramFullPath`、:c:func:`Py_GetPythonHome` 和 :c:func:" -"`Py_GetProgramName` 現在會回傳 ``NULL``。使用新的 :ref:`init-config` API 來獲" -"取 :ref:`init-path-config`。(由 Victor Stinner 在 :issue:`42260` 中貢獻。)" +"如果在 :c:func:`Py_Initialize` 之前(Python 初始化之前)被呼" +"叫,:c:func:`Py_GetPath`、:c:func:`Py_GetPrefix`、:c:func:`Py_GetExecPrefix`、:c:func:`Py_GetProgramFullPath`、:c:func:`Py_GetPythonHome` " +"和 :c:func:`Py_GetProgramName` 現在會回傳 ``NULL``。使用新的 :ref:`init-" +"config` API 來取得 :ref:`init-path-config`。(由 Victor Stinner " +"在 :issue:`42260` 中貢獻。)" #: ../../whatsnew/3.10.rst:2186 msgid "" -":c:func:`PyList_SET_ITEM`, :c:func:`PyTuple_SET_ITEM` and :c:func:" -"`PyCell_SET` macros can no longer be used as l-value or r-value. For " -"example, ``x = PyList_SET_ITEM(a, b, c)`` and ``PyList_SET_ITEM(a, b, c) = " -"x`` now fail with a compiler error. It prevents bugs like ``if " +":c:func:`PyList_SET_ITEM`, :c:func:`PyTuple_SET_ITEM` " +"and :c:func:`PyCell_SET` macros can no longer be used as l-value or r-value. " +"For example, ``x = PyList_SET_ITEM(a, b, c)`` and ``PyList_SET_ITEM(a, b, c) " +"= x`` now fail with a compiler error. It prevents bugs like ``if " "(PyList_SET_ITEM (a, b, c) < 0) ...`` test. (Contributed by Zackery Spytz " "and Victor Stinner in :issue:`30459`.)" msgstr "" -":c:func:`PyList_SET_ITEM`、:c:func:`PyTuple_SET_ITEM` 和 :c:func:" -"`PyCell_SET` 巨集不能再用作左值 (l-value) 或右值 (r-value)。例如,``x = " -"PyList_SET_ITEM(a, b, c)`` 和 ``PyList_SET_ITEM(a, b, c) = x`` 現在會失敗並出" -"現編譯器錯誤。它可以防止如 ``if (PyList_SET_ITEM (a, b, c) < 0) ...`` 測試之" -"類的錯誤。(由 Zackery Spytz 和 Victor Stinner 在 :issue:`30459` 中貢獻。)" +":c:func:`PyList_SET_ITEM`、:c:func:`PyTuple_SET_ITEM` " +"和 :c:func:`PyCell_SET` 巨集不能再用作左值 (l-value) 或右值 (r-value)。例如," +"``x = PyList_SET_ITEM(a, b, c)`` 和 ``PyList_SET_ITEM(a, b, c) = x`` 現在會失" +"敗並出現編譯器錯誤。它可以防止如 ``if (PyList_SET_ITEM (a, b, c) < 0) ...`` " +"測試之類的錯誤。(由 Zackery Spytz 和 Victor Stinner 在 :issue:`30459` 中貢" +"獻。)" #: ../../whatsnew/3.10.rst:2193 msgid "" "The non-limited API files ``odictobject.h``, ``parser_interface.h``, " -"``picklebufobject.h``, ``pyarena.h``, ``pyctype.h``, ``pydebug.h``, ``pyfpe." -"h``, and ``pytime.h`` have been moved to the ``Include/cpython`` directory. " -"These files must not be included directly, as they are already included in " -"``Python.h``; see :ref:`api-includes`. If they have been included directly, " -"consider including ``Python.h`` instead. (Contributed by Nicholas Sim in :" -"issue:`35134`.)" -msgstr "" -"非受限 API 檔案 ``odictobject.h``、``parser_interface.h``、``picklebufobject." -"h``、``pyarena.h``、``pyctype.h``、``pydebug.h``、``pyfpe.h`` 和 ``pytime." -"h`` 已移至 ``Include/cpython`` 目錄。這些檔案不得直接被引入,因為它們已於 " -"``Python.h`` 中引入;請參閱 :ref:`api-includes`。如果直接引入它們,請考慮改為" -"引入 ``Python.h``。(由 Nicholas Sim 在 :issue:`35134` 中貢獻。)" +"``picklebufobject.h``, ``pyarena.h``, ``pyctype.h``, ``pydebug.h``, " +"``pyfpe.h``, and ``pytime.h`` have been moved to the ``Include/cpython`` " +"directory. These files must not be included directly, as they are already " +"included in ``Python.h``; see :ref:`api-includes`. If they have been " +"included directly, consider including ``Python.h`` instead. (Contributed by " +"Nicholas Sim in :issue:`35134`.)" +msgstr "" +"非受限 API 檔案 ``odictobject.h``、``parser_interface.h``、" +"``picklebufobject.h``、``pyarena.h``、``pyctype.h``、``pydebug.h``、" +"``pyfpe.h`` 和 ``pytime.h`` 已移至 ``Include/cpython`` 目錄。這些檔案不得直接" +"被引入,因為它們已於 ``Python.h`` 中引入;請參閱 :ref:`api-includes`。如果直" +"接引入它們,請考慮改為引入 ``Python.h``。(由 Nicholas Sim 在 :issue:`35134` " +"中貢獻。)" #: ../../whatsnew/3.10.rst:2201 msgid "" "Use the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` type flag to create immutable " "type objects. Do not rely on :c:macro:`Py_TPFLAGS_HEAPTYPE` to decide if a " "type object is mutable or not; check if :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` " -"is set instead. (Contributed by Victor Stinner and Erlend E. Aasland in :" -"issue:`43908`.)" +"is set instead. (Contributed by Victor Stinner and Erlend E. Aasland " +"in :issue:`43908`.)" msgstr "" "使用 :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` 型別旗標來建立不可變型別物件。不要依" "賴 :c:macro:`Py_TPFLAGS_HEAPTYPE` 來決定型別物件是否可變;應改為檢查是否設定" @@ -4323,27 +4367,27 @@ msgstr "" #: ../../whatsnew/3.10.rst:2225 msgid "" -"``Py_UNICODE_strlen``: use :c:func:`PyUnicode_GetLength` or :c:macro:" -"`PyUnicode_GET_LENGTH`" +"``Py_UNICODE_strlen``: use :c:func:`PyUnicode_GetLength` " +"or :c:macro:`PyUnicode_GET_LENGTH`" msgstr "" -"``Py_UNICODE_strlen``:使用 :c:func:`PyUnicode_GetLength` 或 :c:macro:" -"`PyUnicode_GET_LENGTH`" +"``Py_UNICODE_strlen``:使用 :c:func:`PyUnicode_GetLength` " +"或 :c:macro:`PyUnicode_GET_LENGTH`" #: ../../whatsnew/3.10.rst:2227 msgid "" -"``Py_UNICODE_strcat``: use :c:func:`PyUnicode_CopyCharacters` or :c:func:" -"`PyUnicode_FromFormat`" +"``Py_UNICODE_strcat``: use :c:func:`PyUnicode_CopyCharacters` " +"or :c:func:`PyUnicode_FromFormat`" msgstr "" -"``Py_UNICODE_strcat``:使用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:" -"`PyUnicode_FromFormat`" +"``Py_UNICODE_strcat``:使用 :c:func:`PyUnicode_CopyCharacters` " +"或 :c:func:`PyUnicode_FromFormat`" #: ../../whatsnew/3.10.rst:2229 msgid "" -"``Py_UNICODE_strcpy``, ``Py_UNICODE_strncpy``: use :c:func:" -"`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`" +"``Py_UNICODE_strcpy``, ``Py_UNICODE_strncpy``: " +"use :c:func:`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`" msgstr "" -"``Py_UNICODE_strcpy``、``Py_UNICODE_strncpy``:使用 :c:func:" -"`PyUnicode_CopyCharacters` 或 :c:func:`PyUnicode_Substring`" +"``Py_UNICODE_strcpy``、``Py_UNICODE_strncpy``:使" +"用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:`PyUnicode_Substring`" #: ../../whatsnew/3.10.rst:2231 msgid "``Py_UNICODE_strcmp``: use :c:func:`PyUnicode_Compare`" @@ -4355,11 +4399,11 @@ msgstr "``Py_UNICODE_strncmp``:使用 :c:func:`PyUnicode_Tailmatch`" #: ../../whatsnew/3.10.rst:2233 msgid "" -"``Py_UNICODE_strchr``, ``Py_UNICODE_strrchr``: use :c:func:" -"`PyUnicode_FindChar`" +"``Py_UNICODE_strchr``, ``Py_UNICODE_strrchr``: " +"use :c:func:`PyUnicode_FindChar`" msgstr "" -"``Py_UNICODE_strchr``、``Py_UNICODE_strrchr``:使用 :c:func:" -"`PyUnicode_FindChar`" +"``Py_UNICODE_strchr``、``Py_UNICODE_strrchr``:使" +"用 :c:func:`PyUnicode_FindChar`" #: ../../whatsnew/3.10.rst:2236 msgid "" @@ -4371,17 +4415,18 @@ msgstr "" #: ../../whatsnew/3.10.rst:2239 msgid "" -"Removed ``PyLong_FromUnicode()``. Please migrate to :c:func:" -"`PyLong_FromUnicodeObject`. (Contributed by Inada Naoki in :issue:`41103`.)" +"Removed ``PyLong_FromUnicode()``. Please migrate " +"to :c:func:`PyLong_FromUnicodeObject`. (Contributed by Inada Naoki " +"in :issue:`41103`.)" msgstr "" "刪除了 ``PyLong_FromUnicode()``。請改用 :c:func:`PyLong_FromUnicodeObject`。" "(由 Inada Naoki 在 :issue:`41103` 中貢獻。)" #: ../../whatsnew/3.10.rst:2242 msgid "" -"Removed ``PyUnicode_AsUnicodeCopy()``. Please use :c:func:" -"`PyUnicode_AsUCS4Copy` or :c:func:`PyUnicode_AsWideCharString` (Contributed " -"by Inada Naoki in :issue:`41103`.)" +"Removed ``PyUnicode_AsUnicodeCopy()``. Please " +"use :c:func:`PyUnicode_AsUCS4Copy` or :c:func:`PyUnicode_AsWideCharString` " +"(Contributed by Inada Naoki in :issue:`41103`.)" msgstr "" "刪除了 ``PyUnicode_AsUnicodeCopy()``。請改用 :c:func:`PyUnicode_AsUCS4Copy` " "或 :c:func:`PyUnicode_AsWideCharString` (由 Inada Naoki 在 :issue:`41103` 中" @@ -4400,9 +4445,9 @@ msgstr "" #: ../../whatsnew/3.10.rst:2250 msgid "" "Removed undocumented macros ``Py_ALLOW_RECURSION`` and " -"``Py_END_ALLOW_RECURSION`` and the ``recursion_critical`` field of the :c:" -"type:`PyInterpreterState` structure. (Contributed by Serhiy Storchaka in :" -"issue:`41936`.)" +"``Py_END_ALLOW_RECURSION`` and the ``recursion_critical`` field of " +"the :c:type:`PyInterpreterState` structure. (Contributed by Serhiy Storchaka " +"in :issue:`41936`.)" msgstr "" "刪除了未被說明文件記錄的巨集 ``Py_ALLOW_RECURSION`` 和 " "``Py_END_ALLOW_RECURSION`` 以及 :c:type:`PyInterpreterState` 結構的 " @@ -4411,8 +4456,9 @@ msgstr "" #: ../../whatsnew/3.10.rst:2255 msgid "" "Removed the undocumented ``PyOS_InitInterrupts()`` function. Initializing " -"Python already implicitly installs signal handlers: see :c:member:`PyConfig." -"install_signal_handlers`. (Contributed by Victor Stinner in :issue:`41713`.)" +"Python already implicitly installs signal handlers: " +"see :c:member:`PyConfig.install_signal_handlers`. (Contributed by Victor " +"Stinner in :issue:`41713`.)" msgstr "" "刪除了未被說明文件記錄的 ``PyOS_InitInterrupts()`` 函式。初始化 Python 已經隱" "式安裝信號處理程式:請參閱 :c:member:`PyConfig.install_signal_handlers`。" @@ -4463,8 +4509,8 @@ msgid "" "it could not be used, because the ``symtable.h`` header file was excluded " "from the limited C API." msgstr "" -"``Py_SymtableString()`` 函式錯誤地成為穩定 ABI 的一部分,但它因為 ``symtable." -"h`` 標頭檔被排除在受限 C API 之外而無法使用。" +"``Py_SymtableString()`` 函式錯誤地成為穩定 ABI 的一部分,但它因為 " +"``symtable.h`` 標頭檔被排除在受限 C API 之外而無法使用。" #: ../../whatsnew/3.10.rst:2278 msgid "" @@ -4498,8 +4544,8 @@ msgstr "" "刪除 ``ast.h``、``asdl.h`` 和 ``Python-ast.h`` 標頭檔。這些函式沒有文件記錄," "並且被排除在受限 C API 之外。這些標頭檔定義的大多數名稱都沒有前綴 ``Py``,因" "此可能會產生名稱衝突。例如,``Python-ast.h`` 定義了一個 ``Yield`` 巨集,它與 " -"Windows ``<winbase.h>`` 標頭使用的 ``Yield`` 有名稱衝突。請改用 Python :mod:" -"`ast` 模組。(由 Victor Stinner 在 :issue:`43244` 中貢獻。)" +"Windows ``<winbase.h>`` 標頭使用的 ``Yield`` 有名稱衝突。請改用 " +"Python :mod:`ast` 模組。(由 Victor Stinner 在 :issue:`43244` 中貢獻。)" #: ../../whatsnew/3.10.rst:2295 msgid "" @@ -4553,8 +4599,8 @@ msgid "" "These functions were undocumented and excluded from the limited C API. " "(Contributed by Victor Stinner in :issue:`43244`.)" msgstr "" -"這些函式沒有文件記錄,並且被排除在受限 C API 之外。(由 Victor Stinner 在 :" -"issue:`43244` 中貢獻。)" +"這些函式沒有文件記錄,並且被排除在受限 C API 之外。(由 Victor Stinner " +"在 :issue:`43244` 中貢獻。)" #: ../../whatsnew/3.10.rst:2312 msgid "Remove the ``pyarena.h`` header file with functions:" @@ -4579,8 +4625,8 @@ msgstr "``PyArena_AddPyObject()``" #: ../../whatsnew/3.10.rst:2319 msgid "" "These functions were undocumented, excluded from the limited C API, and were " -"only used internally by the compiler. (Contributed by Victor Stinner in :" -"issue:`43244`.)" +"only used internally by the compiler. (Contributed by Victor Stinner " +"in :issue:`43244`.)" msgstr "" "這些函式沒有文件記錄、被排除在受限 C API 之外,並僅被編譯器於內部使用。(由 " "Victor Stinner 在 :issue:`43244` 中貢獻。)" @@ -4619,8 +4665,8 @@ msgid "" "The deprecated :mod:`!mailcap` module now refuses to inject unsafe text " "(filenames, MIME types, parameters) into shell commands. Instead of using " "such text, it will warn and act as if a match was not found (or for test " -"commands, as if the test failed). (Contributed by Petr Viktorin in :gh:" -"`98966`.)" +"commands, as if the test failed). (Contributed by Petr Viktorin " +"in :gh:`98966`.)" msgstr "" #: ../../whatsnew/3.10.rst:2350 diff --git a/whatsnew/3.11.po b/whatsnew/3.11.po index 7d0c8517c7..468df5d85e 100644 --- a/whatsnew/3.11.po +++ b/whatsnew/3.11.po @@ -33,8 +33,8 @@ msgstr "Pablo Galindo Salgado" #: ../../whatsnew/3.11.rst:47 msgid "" "This article explains the new features in Python 3.11, compared to 3.10. " -"Python 3.11 was released on October 24, 2022. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.11 was released on October 24, 2022. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "此文章解釋了 Python 3.11 和 3.10 相比多了哪些新功能。Python 3.11 於 2022 年 " "10 月 24 日發布。完整細節請見 :ref:`changelog`。" @@ -46,8 +46,8 @@ msgstr "發布重點摘要" #: ../../whatsnew/3.11.rst:60 msgid "" "Python 3.11 is between 10-60% faster than Python 3.10. On average, we " -"measured a 1.25x speedup on the standard benchmark suite. See :ref:" -"`whatsnew311-faster-cpython` for details." +"measured a 1.25x speedup on the standard benchmark suite. " +"See :ref:`whatsnew311-faster-cpython` for details." msgstr "" "Python 3.11 比 Python 3.10 快了 10-60%。我們使用了標準基準量測套裝軟體 " "(benchmark suite) 測得平均加速了 1.25x。細節請見\\ :ref:`whatsnew311-faster-" @@ -244,13 +244,13 @@ msgstr "" #: ../../whatsnew/3.11.rst:159 msgid "" "Additionally, the information used by the enhanced traceback feature is made " -"available via a general API, that can be used to correlate :term:`bytecode` :" -"ref:`instructions <bytecodes>` with source code location. This information " -"can be retrieved using:" +"available via a general API, that can be used to " +"correlate :term:`bytecode` :ref:`instructions <bytecodes>` with source code " +"location. This information can be retrieved using:" msgstr "" -"此外,強化回溯特性所使用的資訊可以透過一般的 API 來取得,以用來使 :term:" -"`bytecode` :ref:`指示 (instruction) <bytecodes>`\\ 與原始碼位置相互關聯。此項" -"資訊可以用以下方式取得:" +"此外,強化回溯特性所使用的資訊可以透過一般的 API 來取得,以用來" +"使 :term:`bytecode` :ref:`指示 (instruction) <bytecodes>`\\ 與原始碼位置相互" +"關聯。此項資訊可以用以下方式取得:" #: ../../whatsnew/3.11.rst:164 msgid "The :meth:`codeobject.co_positions` method in Python." @@ -265,8 +265,8 @@ msgid "" "See :pep:`657` for more details. (Contributed by Pablo Galindo, Batuhan " "Taskaya and Ammar Askar in :issue:`43950`.)" msgstr "" -"詳情請見 :pep:`657`。(由 Pablo Galindo、Batuhan Taskaya 與 Ammar Askar 於 :" -"issue:`43950` 中所貢獻。)" +"詳情請見 :pep:`657`。(由 Pablo Galindo、Batuhan Taskaya 與 Ammar Askar " +"於 :issue:`43950` 中所貢獻。)" #: ../../whatsnew/3.11.rst:171 msgid "" @@ -274,8 +274,8 @@ msgid "" "may result in a small increase in interpreter memory usage and disk usage " "for compiled Python files. To avoid storing the extra information and " "deactivate printing the extra traceback information, use the :option:`-X " -"no_debug_ranges <-X>` command line option or the :envvar:" -"`PYTHONNODEBUGRANGES` environment variable." +"no_debug_ranges <-X>` command line option or " +"the :envvar:`PYTHONNODEBUGRANGES` environment variable." msgstr "" "這個特性必須要將欄的位置 (column position) 儲存於 :ref:`codeobjects`,這可能" "會導致直譯器用於編譯 Python 檔案的記憶體使用量與硬碟使用量增加。為了避免儲存" @@ -289,16 +289,16 @@ msgstr "PEP 654:例外群組與 ``except*``" #: ../../whatsnew/3.11.rst:185 msgid "" ":pep:`654` introduces language features that enable a program to raise and " -"handle multiple unrelated exceptions simultaneously. The builtin types :exc:" -"`ExceptionGroup` and :exc:`BaseExceptionGroup` make it possible to group " -"exceptions and raise them together, and the new :keyword:`except* " +"handle multiple unrelated exceptions simultaneously. The builtin " +"types :exc:`ExceptionGroup` and :exc:`BaseExceptionGroup` make it possible " +"to group exceptions and raise them together, and the new :keyword:`except* " "<except_star>` syntax generalizes :keyword:`except` to match subgroups of " "exception groups." msgstr "" ":pep:`654` 引入了新的的語言特性,可讓程式同時引發並處理多個相互無關的例外。內" "建型別 :exc:`ExceptionGroup` 和 :exc:`BaseExceptionGroup` 使得程式可為多個例" -"外組成群組並同時引發,新的 :keyword:`except* <except_star>` 語法也將 :" -"keyword:`except` 泛用化、能夠比對例外群組的子群組。" +"外組成群組並同時引發,新的 :keyword:`except* <except_star>` 語法也" +"將 :keyword:`except` 泛用化、能夠比對例外群組的子群組。" #: ../../whatsnew/3.11.rst:192 msgid "See :pep:`654` for more details." @@ -346,33 +346,33 @@ msgstr "Windows ``py.exe`` 啟動程式 (launcher) 的改進" #: ../../whatsnew/3.11.rst:219 msgid "" "The copy of the :ref:`launcher` included with Python 3.11 has been " -"significantly updated. It now supports company/tag syntax as defined in :pep:" -"`514` using the :samp:`-V:{<company>}/{<tag>}` argument instead of the " -"limited :samp:`-{<major>}.{<minor>}`. This allows launching distributions " -"other than ``PythonCore``, the one hosted on `python.org <https://www.python." -"org>`_." +"significantly updated. It now supports company/tag syntax as defined " +"in :pep:`514` using the :samp:`-V:{<company>}/{<tag>}` argument instead of " +"the limited :samp:`-{<major>}.{<minor>}`. This allows launching " +"distributions other than ``PythonCore``, the one hosted on `python.org " +"<https://www.python.org>`_." msgstr "" -"Python 3.11 所包含的 :ref:`launcher` 複製品有了顯著的改善。它現在支援 :pep:" -"`514` 所定義的公司/標籤 (tag) 語法,可用 :samp:`-V:{<company>}/{<tag>}` 引數" -"來取代受限的 :samp:`-{<major>}.{<minor>}`。這允許了 `python.org <https://www." -"python.org>`_ 上的 ``PythonCore`` 以外的發行版本發布。" +"Python 3.11 所包含的 :ref:`launcher` 複製品有了顯著的改善。它現在支" +"援 :pep:`514` 所定義的公司/標籤 (tag) 語法,可用 :samp:`-V:{<company>}/" +"{<tag>}` 引數來取代受限的 :samp:`-{<major>}.{<minor>}`。這允許了 `python.org " +"<https://www.python.org>`_ 上的 ``PythonCore`` 以外的發行版本發布。" #: ../../whatsnew/3.11.rst:225 msgid "" "When using ``-V:`` selectors, either company or tag can be omitted, but all " "installs will be searched. For example, ``-V:OtherPython/`` will select the " -"\"best\" tag registered for ``OtherPython``, while ``-V:3.11`` or ``-" -"V:/3.11`` will select the \"best\" distribution with tag ``3.11``." +"\"best\" tag registered for ``OtherPython``, while ``-V:3.11`` or ``-V:/" +"3.11`` will select the \"best\" distribution with tag ``3.11``." msgstr "" -"使用 ``-V:`` 選擇器時,可以省略公司或標籤,但會搜尋所有安裝。例如,``-V:" -"OtherPython/`` 將選擇 ``OtherPython`` 註冊的「最佳」標籤,而 ``-V:3.11`` 或 " -"``-V:/3.11`` 將選擇帶有 ``3.11`` 標籤的「最佳」發行版。" +"使用 ``-V:`` 選擇器時,可以省略公司或標籤,但會搜尋所有安裝。例如,``-" +"V:OtherPython/`` 將選擇 ``OtherPython`` 註冊的「最佳」標籤,而 ``-V:3.11`` " +"或 ``-V:/3.11`` 將選擇帶有 ``3.11`` 標籤的「最佳」發行版。" #: ../../whatsnew/3.11.rst:230 msgid "" -"When using the legacy :samp:`-{<major>}`, :samp:`-{<major>}.{<minor>}`, :" -"samp:`-{<major>}-{<bitness>}` or :samp:`-{<major>}.{<minor>}-{<bitness>}` " -"arguments, all existing behaviour should be preserved from past versions, " +"When using the legacy :samp:`-{<major>}`, :samp:`-{<major>}.{<minor>}" +"`, :samp:`-{<major>}-{<bitness>}` or :samp:`-{<major>}.{<minor>}-{<bitness>}" +"` arguments, all existing behaviour should be preserved from past versions, " "and only releases from ``PythonCore`` will be selected. However, the ``-64`` " "suffix now implies \"not 32-bit\" (not necessarily x86-64), as there are " "multiple supported 64-bit platforms. 32-bit runtimes are detected by " @@ -393,8 +393,8 @@ msgstr "型別提示相關的新特性" #: ../../whatsnew/3.11.rst:246 msgid "" -"This section covers major changes affecting :pep:`484` type hints and the :" -"mod:`typing` module." +"This section covers major changes affecting :pep:`484` type hints and " +"the :mod:`typing` module." msgstr "" "這個部分涵蓋影響 :pep:`484` 型別提示 (type hints) 與 :mod:`typing` 模組的重大" "變更。" @@ -406,10 +406,10 @@ msgstr "PEP 646:可變參數泛型 (variadic generics)" #: ../../whatsnew/3.11.rst:255 msgid "" ":pep:`484` previously introduced :data:`~typing.TypeVar`, enabling creation " -"of generics parameterised with a single type. :pep:`646` adds :data:`~typing." -"TypeVarTuple`, enabling parameterisation with an *arbitrary* number of " -"types. In other words, a :data:`~typing.TypeVarTuple` is a *variadic* type " -"variable, enabling *variadic* generics." +"of generics parameterised with a single type. :pep:`646` " +"adds :data:`~typing.TypeVarTuple`, enabling parameterisation with an " +"*arbitrary* number of types. In other words, a :data:`~typing.TypeVarTuple` " +"is a *variadic* type variable, enabling *variadic* generics." msgstr "" ":pep:`484` 先前引入了 :data:`~typing.TypeVar`,開啟了帶有單一型別的泛型參數" "化。:pep:`646` 新增 :data:`~typing.TypeVarTuple`,開啟了帶有\\ *任意*\\ 數量" @@ -450,9 +450,9 @@ msgstr "PEP 655:標記獨立 ``TypedDict`` 項目為必要或不必要" #: ../../whatsnew/3.11.rst:280 msgid "" ":data:`~typing.Required` and :data:`~typing.NotRequired` provide a " -"straightforward way to mark whether individual items in a :class:`~typing." -"TypedDict` must be present. Previously, this was only possible using " -"inheritance." +"straightforward way to mark whether individual items in " +"a :class:`~typing.TypedDict` must be present. Previously, this was only " +"possible using inheritance." msgstr "" ":data:`~typing.Required` 與 :data:`~typing.NotRequired` 提供了標記一個獨立項" "目在 :class:`~typing.TypedDict` 中是否必須存在的直覺方法。在這之前,這只有透" @@ -524,9 +524,9 @@ msgstr "" #: ../../whatsnew/3.11.rst:322 msgid "" -"Common use cases include alternative constructors provided as :func:" -"`classmethod <classmethod>`\\s, and :meth:`~object.__enter__` methods that " -"return ``self``::" +"Common use cases include alternative constructors provided " +"as :func:`classmethod <classmethod>`\\s, and :meth:`~object.__enter__` " +"methods that return ``self``::" msgstr "" "常見用例包括作為 :func:`classmethod <classmethod>` 的替代建構函式和會回傳 " "``self`` 的 :meth:`~object.__enter__` 方法: ::" @@ -644,8 +644,8 @@ msgid "" ":data:`~typing.dataclass_transform` may be used to decorate a class, " "metaclass, or a function that is itself a decorator. The presence of " "``@dataclass_transform()`` tells a static type checker that the decorated " -"object performs runtime \"magic\" that transforms a class, giving it :func:" -"`dataclass <dataclasses.dataclass>`-like behaviors." +"object performs runtime \"magic\" that transforms a class, giving " +"it :func:`dataclass <dataclasses.dataclass>`-like behaviors." msgstr "" ":data:`~typing.dataclass_transform` 可以用來裝飾一個類別、元類別 " "(metaclass)、或是一個本身就是裝飾器的函式。``@dataclass_transform()`` 的存在" @@ -700,8 +700,8 @@ msgid "" "python-dev@python.org/message/VIZEBX5EYMSYIJNDBF6DMUMZOCWHARSO/>`__ for more " "information." msgstr "" -":pep:`563` 標註的推遲求值 (Postponed Evaluation of Annotations)(\\ ``from " -"__future__ import annotations`` :ref:`future 陳述式 <future>`\\ )最初計劃在 " +":pep:`563` 推遲對註釋的求值 (Postponed Evaluation of Annotations)(``from " +"__future__ import annotations`` :ref:`future 陳述式 <future>`)最初計劃在 " "Python 3.10 中發布,但已被無限期擱置。請參閱\\ `來自指導委員會 (Steering " "Counsil) 的訊息 <https://mail.python.org/archives/list/python-dev@python.org/" "message/VIZEBX5EYMSYIJNDBF6DMUMZOCWHARSO/>`__\\ 以獲得更多資訊。" @@ -732,51 +732,51 @@ msgstr "" #: ../../whatsnew/3.11.rst:447 msgid "" -"A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` in :" -"keyword:`with` statements and :meth:`contextlib.ExitStack.enter_context` for " -"objects that do not support the :term:`context manager` protocol, and in :" -"keyword:`async with` statements and :meth:`contextlib.AsyncExitStack." -"enter_async_context` for objects not supporting the :term:`asynchronous " -"context manager` protocol. (Contributed by Serhiy Storchaka in :issue:" -"`12022` and :issue:`44471`.)" +"A :exc:`TypeError` is now raised instead of an :exc:`AttributeError` " +"in :keyword:`with` statements and :meth:`contextlib.ExitStack.enter_context` " +"for objects that do not support the :term:`context manager` protocol, and " +"in :keyword:`async with` statements " +"and :meth:`contextlib.AsyncExitStack.enter_async_context` for objects not " +"supporting the :term:`asynchronous context manager` protocol. (Contributed " +"by Serhiy Storchaka in :issue:`12022` and :issue:`44471`.)" msgstr "" "現在在不支援 :term:`context manager` 協議的物件上使用 :keyword:`with` 陳述式" "和 :meth:`contextlib.ExitStack.enter_context` 或在不支援 :term:`asynchronous " -"context manager` 協議的物件上使用 :keyword:`async with` 陳述式和 :meth:" -"`contextlib.AsyncExitStack.enter_async_context`,會引發 :exc:`TypeError` 而不" -"是 :exc:`AttributeError`。(由 Serhiy Storchaka 在 :issue:`12022` 和 :issue:" -"`44471` 中貢獻。)" +"context manager` 協議的物件上使用 :keyword:`async with` 陳述式" +"和 :meth:`contextlib.AsyncExitStack.enter_async_context`,會引" +"發 :exc:`TypeError` 而不是 :exc:`AttributeError`。(由 Serhiy Storchaka " +"在 :issue:`12022` 和 :issue:`44471` 中貢獻。)" #: ../../whatsnew/3.11.rst:455 msgid "" "Added :meth:`object.__getstate__`, which provides the default implementation " "of the :meth:`!__getstate__` method. :mod:`copy`\\ing and :mod:`pickle`\\ing " -"instances of subclasses of builtin types :class:`bytearray`, :class:`set`, :" -"class:`frozenset`, :class:`collections.OrderedDict`, :class:`collections." -"deque`, :class:`weakref.WeakSet`, and :class:`datetime.tzinfo` now copies " -"and pickles instance attributes implemented as :term:`slots <__slots__>`. " -"This change has an unintended side effect: It trips up a small minority of " -"existing Python projects not expecting :meth:`object.__getstate__` to exist. " -"See the later comments on :gh:`70766` for discussions of what workarounds " -"such code may need. (Contributed by Serhiy Storchaka in :issue:`26579`.)" +"instances of subclasses of builtin " +"types :class:`bytearray`, :class:`set`, :class:`frozenset`, :class:`collections.OrderedDict`, :class:`collections.deque`, :class:`weakref.WeakSet`, " +"and :class:`datetime.tzinfo` now copies and pickles instance attributes " +"implemented as :term:`slots <__slots__>`. This change has an unintended side " +"effect: It trips up a small minority of existing Python projects not " +"expecting :meth:`object.__getstate__` to exist. See the later comments " +"on :gh:`70766` for discussions of what workarounds such code may need. " +"(Contributed by Serhiy Storchaka in :issue:`26579`.)" msgstr "" #: ../../whatsnew/3.11.rst:470 msgid "" "Added a :option:`-P` command line option and a :envvar:`PYTHONSAFEPATH` " -"environment variable, which disable the automatic prepending to :data:`sys." -"path` of the script's directory when running a script, or the current " -"directory when using :option:`-c` and :option:`-m`. This ensures only stdlib " -"and installed modules are picked up by :keyword:`import`, and avoids " -"unintentionally or maliciously shadowing modules with those in a local (and " -"typically user-writable) directory. (Contributed by Victor Stinner in :gh:" -"`57684`.)" +"environment variable, which disable the automatic prepending " +"to :data:`sys.path` of the script's directory when running a script, or the " +"current directory when using :option:`-c` and :option:`-m`. This ensures " +"only stdlib and installed modules are picked up by :keyword:`import`, and " +"avoids unintentionally or maliciously shadowing modules with those in a " +"local (and typically user-writable) directory. (Contributed by Victor " +"Stinner in :gh:`57684`.)" msgstr "" "新增了一個 :option:`-P` 命令列選項和一個 :envvar:`PYTHONSAFEPATH` 環境變數," "它們禁用了當使用 :option:`-c` 和 :option:`-m` 以在運行腳本或目前目錄時自動添" -"加到腳本目錄的 :data:`sys.path`。這確保只有 stdlib 和已安裝的模組會被 :" -"keyword:`import` 取用,以避免不小心或被惡意地將模組與本地(通常是使用者可寫入" -"的)目錄中的模組重疊。(由 Victor Stinner 在 :gh:`57684` 中貢獻。)" +"加到腳本目錄的 :data:`sys.path`。這確保只有 stdlib 和已安裝的模組會" +"被 :keyword:`import` 取用,以避免不小心或被惡意地將模組與本地(通常是使用者可" +"寫入的)目錄中的模組重疊。(由 Victor Stinner 在 :gh:`57684` 中貢獻。)" #: ../../whatsnew/3.11.rst:481 msgid "" @@ -797,10 +797,10 @@ msgid "" "Thomas Grainger in :gh:`91181`.)" msgstr "" ":data:`sys.path` 不再接受位元組。支援已在 Python 3.2 和 3.6 之間的某個時間停" -"止,直到 Python 3.10.0 發布後才引起人們的注意。此外,由於混合使用 :class:" -"`str` 和 :class:`bytes` 鍵時 :option:`-b` 和 :data:`sys.path_importer_cache` " -"會出現的交互作用,恢復這項支援會出現問題。(由 Thomas Grainger 在 :gh:" -"`91181` 中貢獻。)" +"止,直到 Python 3.10.0 發布後才引起人們的注意。此外,由於混合使" +"用 :class:`str` 和 :class:`bytes` 鍵時 :option:`-b` " +"和 :data:`sys.path_importer_cache` 會出現的交互作用,恢復這項支援會出現問題。" +"(由 Thomas Grainger 在 :gh:`91181` 中貢獻。)" #: ../../whatsnew/3.11.rst:497 msgid "Other CPython Implementation Changes" @@ -808,15 +808,15 @@ msgstr "其他 CPython 實作更動" #: ../../whatsnew/3.11.rst:499 msgid "" -"The special methods :meth:`~object.__complex__` for :class:`complex` and :" -"meth:`~object.__bytes__` for :class:`bytes` are implemented to support the :" -"class:`typing.SupportsComplex` and :class:`typing.SupportsBytes` protocols. " -"(Contributed by Mark Dickinson and Donghee Na in :issue:`24234`.)" +"The special methods :meth:`~object.__complex__` for :class:`complex` " +"and :meth:`~object.__bytes__` for :class:`bytes` are implemented to support " +"the :class:`typing.SupportsComplex` and :class:`typing.SupportsBytes` " +"protocols. (Contributed by Mark Dickinson and Donghee Na in :issue:`24234`.)" msgstr "" "為支援 :class:`typing.SupportsComplex` 與 :class:`typing.SupportsBytes` 協" -"定,實作了 :class:`complex` 與 :class:`bytes` 的特殊方法 :meth:`~object." -"__complex__` 與 :meth:`~object.__bytes__`。(由 Mark Dickinson 和 Donghee Na " -"於 :issue:`24234` 中所貢獻。)" +"定,實作了 :class:`complex` 與 :class:`bytes` 的特殊方" +"法 :meth:`~object.__complex__` 與 :meth:`~object.__bytes__`。(由 Mark " +"Dickinson 和 Donghee Na 於 :issue:`24234` 中所貢獻。)" #: ../../whatsnew/3.11.rst:504 msgid "" @@ -830,16 +830,16 @@ msgstr "" "新增 ``siphash13`` 以作為內部的雜湊演算法,它有與 ``siphash24`` 相似的安全特" "性,但是在處理較長的輸入時會更快一些。現在是 :class:`str`、:class:`bytes` 和" "一些其他型別的 :func:`hash` 預設演算法。:pep:`552` :ref:`基於雜湊的 .pyc 檔" -"案 <pyc-invalidation>` 現在也使用 ``siphash13``。(由 Inada Naoki 於 :issue:" -"`29410` 中貢獻。)" +"案 <pyc-invalidation>` 現在也使用 ``siphash13``。(由 Inada Naoki " +"於 :issue:`29410` 中貢獻。)" #: ../../whatsnew/3.11.rst:513 msgid "" "When an active exception is re-raised by a :keyword:`raise` statement with " -"no parameters, the traceback attached to this exception is now always ``sys." -"exc_info()[1].__traceback__``. This means that changes made to the traceback " -"in the current :keyword:`except` clause are reflected in the re-raised " -"exception. (Contributed by Irit Katriel in :issue:`45711`.)" +"no parameters, the traceback attached to this exception is now always " +"``sys.exc_info()[1].__traceback__``. This means that changes made to the " +"traceback in the current :keyword:`except` clause are reflected in the re-" +"raised exception. (Contributed by Irit Katriel in :issue:`45711`.)" msgstr "" "當一個仍有效的例外被 :keyword:`raise` 陳述式在沒有參數的情況下重新引發,被附" "於該例外的追蹤資訊現在都會是 ``sys.exc_info()[1].__traceback__``。這代表對於" @@ -876,9 +876,10 @@ msgid "" "initialize :data:`sys.path`. Otherwise, initialization will recalculate the " "path and replace any values added to ``module_search_paths``." msgstr "" -"初始化中若是要用 :c:member:`PyConfig.module_search_paths` 來初始化 :data:" -"`sys.path`,則現在 :c:member:`PyConfig.module_search_paths_set` 必須被設為 " -"1。否則,初始化會重新計算路徑並取代所有被加到 ``module_search_paths`` 的值。" +"初始化中若是要用 :c:member:`PyConfig.module_search_paths` 來初始" +"化 :data:`sys.path`,則現在 :c:member:`PyConfig.module_search_paths_set` 必須" +"被設為 1。否則,初始化會重新計算路徑並取代所有被加到 ``module_search_paths`` " +"的值。" #: ../../whatsnew/3.11.rst:536 msgid "" @@ -889,9 +890,9 @@ msgid "" "help-all`. (Contributed by Éric Araujo in :issue:`46142`.)" msgstr "" ":option:`--help` 選項的輸出現在會在 50 列、80 欄的大小之內,:ref:`Python 環境" -"變數 <using-on-envvars>`\\ 和 :option:`-X` 選項的資訊現在能夠分別透過 :" -"option:`--help-env` 和 :option:`--help-xoptions` 旗標與 :option:`--help-all` " -"一起使用來取得。(由 Éric Araujo 於 :issue:`46142` 中貢獻。)" +"變數 <using-on-envvars>`\\ 和 :option:`-X` 選項的資訊現在能夠分別透" +"過 :option:`--help-env` 和 :option:`--help-xoptions` 旗標與 :option:`--help-" +"all` 一起使用來取得。(由 Éric Araujo 於 :issue:`46142` 中貢獻。)" #: ../../whatsnew/3.11.rst:543 msgid "" @@ -907,11 +908,11 @@ msgid "" msgstr "" "在除 2(binary、二進制)、4、8(octal、八進制)、16(hexadecimal、十六進制)" "或 32 以外的基數中,例如以 10(decimal、十進制)為基數,進行 :class:`int` " -"和 :class:`str` 之間的轉換且字串形式的位數超過限制,現在會引發 :exc:" -"`ValueError`,以避免由於演算法複雜性而導致的潛在阻斷服務攻擊 (denial of " -"service attacks)。這是針對 :cve:`2020-10735` 的緩解措施,可以透過環境變數、命" -"令列旗標或 :mod:`sys` API 來設定或禁用此限制。請參閱\\ :ref:`整數字串轉換長度" -"限制 <int_max_str_digits>` 文件。預設限制為字串形式的 4300 位數字。" +"和 :class:`str` 之間的轉換且字串形式的位數超過限制,現在會引" +"發 :exc:`ValueError`,以避免由於演算法複雜性而導致的潛在阻斷服務攻擊 (denial " +"of service attacks)。這是針對 :cve:`2020-10735` 的緩解措施,可以透過環境變" +"數、命令列旗標或 :mod:`sys` API 來設定或禁用此限制。請參閱\\ :ref:`整數字串轉" +"換長度限制 <int_max_str_digits>` 文件。預設限制為字串形式的 4300 位數字。" #: ../../whatsnew/3.11.rst:557 msgid "New Modules" @@ -945,9 +946,9 @@ msgstr "asyncio" msgid "" "Added the :class:`~asyncio.TaskGroup` class, an :ref:`asynchronous context " "manager <async-context-managers>` holding a group of tasks that will wait " -"for all of them upon exit. For new code this is recommended over using :func:" -"`~asyncio.create_task` and :func:`~asyncio.gather` directly. (Contributed by " -"Yury Selivanov and others in :gh:`90908`.)" +"for all of them upon exit. For new code this is recommended over " +"using :func:`~asyncio.create_task` and :func:`~asyncio.gather` directly. " +"(Contributed by Yury Selivanov and others in :gh:`90908`.)" msgstr "" "添加了 :class:`~asyncio.TaskGroup` 類別,為一個會持有任務群組並在退出時等待全" "部完成的\\ :ref:`非同步情境管理器 (asynchronous context manager) <async-" @@ -959,8 +960,8 @@ msgstr "" msgid "" "Added :func:`~asyncio.timeout`, an asynchronous context manager for setting " "a timeout on asynchronous operations. For new code this is recommended over " -"using :func:`~asyncio.wait_for` directly. (Contributed by Andrew Svetlov in :" -"gh:`90927`.)" +"using :func:`~asyncio.wait_for` directly. (Contributed by Andrew Svetlov " +"in :gh:`90927`.)" msgstr "" "新增 :func:`~asyncio.timeout`,是一個用來為一個非同步操作設置超時的非同步情境" "管理器,新的程式建議直接使用它以取代 :func:`~asyncio.wait_for`。(由 Andrew " @@ -986,9 +987,9 @@ msgstr "" #: ../../whatsnew/3.11.rst:599 msgid "" -"Added keyword argument *all_errors* to :meth:`asyncio.loop." -"create_connection` so that multiple connection errors can be raised as an :" -"exc:`ExceptionGroup`." +"Added keyword argument *all_errors* " +"to :meth:`asyncio.loop.create_connection` so that multiple connection errors " +"can be raised as an :exc:`ExceptionGroup`." msgstr "" "在 :meth:`asyncio.loop.create_connection` 新增關鍵字引數 *all_errors*,這樣多" "個連接錯誤就可以一起用一個 :exc:`ExceptionGroup` 來引發。" @@ -996,25 +997,27 @@ msgstr "" #: ../../whatsnew/3.11.rst:602 msgid "" "Added the :meth:`asyncio.StreamWriter.start_tls` method for upgrading " -"existing stream-based connections to TLS. (Contributed by Ian Good in :issue:" -"`34975`.)" +"existing stream-based connections to TLS. (Contributed by Ian Good " +"in :issue:`34975`.)" msgstr "" "新增 :meth:`asyncio.StreamWriter.start_tls` 方法,用來將已存在的串流連線升級" "至 TLS。(由 Ian Good 於 :issue:`34975` 中貢獻。)" #: ../../whatsnew/3.11.rst:606 msgid "" -"Added raw datagram socket functions to the event loop: :meth:`~asyncio.loop." -"sock_sendto`, :meth:`~asyncio.loop.sock_recvfrom` and :meth:`~asyncio.loop." -"sock_recvfrom_into`. These have implementations in :class:`~asyncio." -"SelectorEventLoop` and :class:`~asyncio.ProactorEventLoop`. (Contributed by " -"Alex Grönholm in :issue:`46805`.)" +"Added raw datagram socket functions to the event " +"loop: :meth:`~asyncio.loop.sock_sendto`, :meth:`~asyncio.loop.sock_recvfrom` " +"and :meth:`~asyncio.loop.sock_recvfrom_into`. These have implementations " +"in :class:`~asyncio.SelectorEventLoop` " +"and :class:`~asyncio.ProactorEventLoop`. (Contributed by Alex Grönholm " +"in :issue:`46805`.)" msgstr "" -"在事件迴圈增加原始資料元 (raw datagram) socket 函式::meth:`~asyncio.loop." -"sock_sendto`、:meth:`~asyncio.loop.sock_recvfrom` 和 :meth:`~asyncio.loop." -"sock_recvfrom_into`。以上在 :class:`~asyncio.SelectorEventLoop` 和 :class:" -"`~asyncio.ProactorEventLoop` 中都有實作。(由 Alex Grönholm 在 :issue:" -"`46805` 中貢獻。)" +"在事件迴圈增加原始資料元 (raw datagram) socket 函" +"式::meth:`~asyncio.loop.sock_sendto`、:meth:`~asyncio.loop.sock_recvfrom` " +"和 :meth:`~asyncio.loop.sock_recvfrom_into`。以上" +"在 :class:`~asyncio.SelectorEventLoop` " +"和 :class:`~asyncio.ProactorEventLoop` 中都有實作。(由 Alex Grönholm " +"在 :issue:`46805` 中貢獻。)" #: ../../whatsnew/3.11.rst:614 msgid "" @@ -1022,9 +1025,9 @@ msgid "" "methods to :class:`~asyncio.Task`. These are primarily intended for internal " "use, notably by :class:`~asyncio.TaskGroup`." msgstr "" -"於 :class:`~asyncio.Task` 新增 :meth:`~asyncio.Task.cancelling` 和 :meth:" -"`~asyncio.Task.uncancel` 方法。這些預期是只用於內部,尤其是 :class:`~asyncio." -"TaskGroup`。" +"於 :class:`~asyncio.Task` 新增 :meth:`~asyncio.Task.cancelling` " +"和 :meth:`~asyncio.Task.uncancel` 方法。這些預期是只用於內部,尤其" +"是 :class:`~asyncio.TaskGroup`。" #: ../../whatsnew/3.11.rst:623 msgid "contextlib" @@ -1037,8 +1040,8 @@ msgid "" "around :func:`~os.chdir`. (Contributed by Filipe Laíns in :issue:`25625`)" msgstr "" "添加了非平行安全的 :func:`~contextlib.chdir` 情境管理器來更改目前工作目錄,然" -"後在退出時恢復它。:func:`~os.chdir` 的簡單包裝器。(由 Filipe Laíns 在 :" -"issue:`25625` 中貢獻)" +"後在退出時恢復它。:func:`~os.chdir` 的簡單包裝器。(由 Filipe Laíns " +"在 :issue:`25625` 中貢獻)" #: ../../whatsnew/3.11.rst:633 msgid "dataclasses" @@ -1046,10 +1049,10 @@ msgstr "dataclasses" #: ../../whatsnew/3.11.rst:635 msgid "" -"Change field default mutability check, allowing only defaults which are :" -"term:`hashable` instead of any object which is not an instance of :class:" -"`dict`, :class:`list` or :class:`set`. (Contributed by Eric V. Smith in :" -"issue:`44674`.)" +"Change field default mutability check, allowing only defaults which " +"are :term:`hashable` instead of any object which is not an instance " +"of :class:`dict`, :class:`list` or :class:`set`. (Contributed by Eric V. " +"Smith in :issue:`44674`.)" msgstr "" "更改欄位預設的可變性檢查 (mutability check),僅允許預設值是 :term:`hashable` " "而不是任何非 :class:`dict`、:class:`list` 或 :class:`set` 實例的物件。(由 " @@ -1061,8 +1064,9 @@ msgstr "datetime" #: ../../whatsnew/3.11.rst:646 msgid "" -"Add :const:`datetime.UTC`, a convenience alias for :attr:`datetime.timezone." -"utc`. (Contributed by Kabir Kwatra in :gh:`91973`.)" +"Add :const:`datetime.UTC`, a convenience alias " +"for :attr:`datetime.timezone.utc`. (Contributed by Kabir Kwatra " +"in :gh:`91973`.)" msgstr "" "新增 :const:`datetime.UTC`,一個 :attr:`datetime.timezone.utc` 的方便別名。" "(由 Kabir Kwatra 於 :gh:`91973` 所貢獻。)" @@ -1074,10 +1078,10 @@ msgid "" "ISO 8601 formats (barring only those that support fractional hours and " "minutes). (Contributed by Paul Ganssle in :gh:`80010`.)" msgstr "" -":meth:`datetime.date.fromisoformat`、:meth:`datetime.time.fromisoformat` 和 :" -"meth:`datetime.datetime.fromisoformat` 現在可以用來剖析大部分的 ISO 8601 格式" -"(除了那些支援分數形式的小時與分鐘)。(由 Paul Ganssle 於 :gh:`80010` 中所貢" -"獻。)" +":meth:`datetime.date.fromisoformat`、:meth:`datetime.time.fromisoformat` " +"和 :meth:`datetime.datetime.fromisoformat` 現在可以用來剖析大部分的 ISO 8601 " +"格式(除了那些支援分數形式的小時與分鐘)。(由 Paul Ganssle 於 :gh:`80010` 中" +"所貢獻。)" #: ../../whatsnew/3.11.rst:658 msgid "enum" @@ -1099,44 +1103,45 @@ msgstr "增加 :class:`~enum.StrEnum`,列舉 (enum) 內的成員必須是字 #: ../../whatsnew/3.11.rst:666 msgid "" -"Added :class:`~enum.ReprEnum`, which only modifies the :meth:`~object." -"__repr__` of members while returning their literal values (rather than " -"names) for :meth:`~object.__str__` and :meth:`~object.__format__` (used by :" -"func:`str`, :func:`format` and :term:`f-string`\\s)." +"Added :class:`~enum.ReprEnum`, which only modifies " +"the :meth:`~object.__repr__` of members while returning their literal values " +"(rather than names) for :meth:`~object.__str__` " +"and :meth:`~object.__format__` (used by :func:`str`, :func:`format` " +"and :term:`f-string`\\s)." msgstr "" "新增 :class:`~enum.ReprEnum`,它只修改成員的 :meth:`~object.__repr__`,同時回" -"傳成員的文本值 (literal value)(而不是名稱),以用於(為 :func:`str`、:func:" -"`format` 和 :term:`f-string` 所使用的)\\ :meth:`~object.__str__` 和 :meth:" -"`~object.__format__`。" +"傳成員的文本值 (literal value)(而不是名稱),以用於" +"(為 :func:`str`、:func:`format` 和 :term:`f-string` 所使用的)" +"\\ :meth:`~object.__str__` 和 :meth:`~object.__format__`。" #: ../../whatsnew/3.11.rst:672 msgid "" -"Changed :meth:`Enum.__format__() <enum.Enum.__format__>` (the default for :" -"func:`format`, :meth:`str.format` and :term:`f-string`\\s) to always produce " -"the same result as :meth:`Enum.__str__() <enum.Enum.__str__>`: for enums " -"inheriting from :class:`~enum.ReprEnum` it will be the member's value; for " -"all other enums it will be the enum and member name (e.g. ``Color.RED``)." +"Changed :meth:`Enum.__format__() <enum.Enum.__format__>` (the default " +"for :func:`format`, :meth:`str.format` and :term:`f-string`\\s) to always " +"produce the same result as :meth:`Enum.__str__() <enum.Enum.__str__>`: for " +"enums inheriting from :class:`~enum.ReprEnum` it will be the member's value; " +"for all other enums it will be the enum and member name (e.g. ``Color.RED``)." msgstr "" -"改變了 :meth:`Enum.__format__() <enum.Enum.__format__>` (被 :func:" -"`format`、:meth:`str.format` 和 :term:`f-string` 預設使用),以使其與 :meth:" -"`enum.Enum.__str__ <enum.Enum.__str__>` 產生相同結果:對於繼承自 :class:" -"`~enum.ReprEnum` 的列舉,這會是成員之值;而其他的列舉會是列舉與成員名稱(例" -"如 ``Color.RED``)。" +"改變了 :meth:`Enum.__format__() <enum.Enum.__format__>` " +"(被 :func:`format`、:meth:`str.format` 和 :term:`f-string` 預設使用),以使" +"其與 :meth:`enum.Enum.__str__ <enum.Enum.__str__>` 產生相同結果:對於繼承" +"自 :class:`~enum.ReprEnum` 的列舉,這會是成員之值;而其他的列舉會是列舉與成員" +"名稱(例如 ``Color.RED``)。" #: ../../whatsnew/3.11.rst:678 msgid "" -"Added a new *boundary* class parameter to :class:`~enum.Flag` enums and the :" -"class:`~enum.FlagBoundary` enum with its options, to control how to handle " -"out-of-range flag values." +"Added a new *boundary* class parameter to :class:`~enum.Flag` enums and " +"the :class:`~enum.FlagBoundary` enum with its options, to control how to " +"handle out-of-range flag values." msgstr "" -"新增 *boundary* 類別參數與其選項到 :class:`~enum.Flag` 列舉和 :class:`~enum." -"FlagBoundary` 列舉以控制處理超出範圍旗標數值的方法。" +"新增 *boundary* 類別參數與其選項到 :class:`~enum.Flag` 列舉" +"和 :class:`~enum.FlagBoundary` 列舉以控制處理超出範圍旗標數值的方法。" #: ../../whatsnew/3.11.rst:682 msgid "" -"Added the :func:`~enum.verify` enum decorator and the :class:`~enum." -"EnumCheck` enum with its options, to check enum classes against several " -"specific constraints." +"Added the :func:`~enum.verify` enum decorator and " +"the :class:`~enum.EnumCheck` enum with its options, to check enum classes " +"against several specific constraints." msgstr "" "新增了 :func:`~enum.verify` 列舉裝飾器和 :class:`~enum.EnumCheck` 列舉及其選" "項,以根據幾個特定限制檢查列舉類別。" @@ -1151,34 +1156,35 @@ msgstr "" #: ../../whatsnew/3.11.rst:689 msgid "" -"Added the :func:`~enum.property` decorator, which works like :func:" -"`property` except for enums. Use this instead of :func:`types." -"DynamicClassAttribute`." +"Added the :func:`~enum.property` decorator, which works " +"like :func:`property` except for enums. Use this instead " +"of :func:`types.DynamicClassAttribute`." msgstr "" "新增 :func:`~enum.property` 裝飾器,它的作用類似 :func:`property` 但是是用於" "列舉,用以替代 :func:`types.DynamicClassAttribute`。" #: ../../whatsnew/3.11.rst:693 msgid "" -"Added the :func:`~enum.global_enum` enum decorator, which adjusts :meth:" -"`~object.__repr__` and :meth:`~object.__str__` to show values as members of " -"their module rather than the enum class. For example, ``'re.ASCII'`` for " -"the :const:`~re.ASCII` member of :class:`re.RegexFlag` rather than " -"``'RegexFlag.ASCII'``." +"Added the :func:`~enum.global_enum` enum decorator, which " +"adjusts :meth:`~object.__repr__` and :meth:`~object.__str__` to show values " +"as members of their module rather than the enum class. For example, " +"``'re.ASCII'`` for the :const:`~re.ASCII` member of :class:`re.RegexFlag` " +"rather than ``'RegexFlag.ASCII'``." msgstr "" "新增 :func:`~enum.global_enum` 列舉裝飾器,用來調整 :meth:`~object.__repr__` " -"和 :meth:`~object.__str__` 以模組成員形式而非列舉類別來顯示值。例如,:class:" -"`re.RegexFlag` 的 :const:`~re.ASCII` 成員的 ``'re.ASCII'``,而非 " +"和 :meth:`~object.__str__` 以模組成員形式而非列舉類別來顯示值。例" +"如,:class:`re.RegexFlag` 的 :const:`~re.ASCII` 成員的 ``'re.ASCII'``,而非 " "``'RegexFlag.ASCII'``。" #: ../../whatsnew/3.11.rst:699 msgid "" -"Enhanced :class:`~enum.Flag` to support :func:`len`, iteration and :keyword:" -"`in`/:keyword:`not in` on its members. For example, the following now works: " -"``len(AFlag(3)) == 2 and list(AFlag(3)) == (AFlag.ONE, AFlag.TWO)``" +"Enhanced :class:`~enum.Flag` to support :func:`len`, iteration " +"and :keyword:`in`/:keyword:`not in` on its members. For example, the " +"following now works: ``len(AFlag(3)) == 2 and list(AFlag(3)) == (AFlag.ONE, " +"AFlag.TWO)``" msgstr "" -"強化 :class:`~enum.Flag` 以支援使用 :func:`len`、疊代 (iteration) 和 :" -"keyword:`in`/:keyword:`not in` 於其成員。例如,以下程式現在能夠作用了:" +"強化 :class:`~enum.Flag` 以支援使用 :func:`len`、疊代 (iteration) " +"和 :keyword:`in`/:keyword:`not in` 於其成員。例如,以下程式現在能夠作用了:" "``len(AFlag(3)) == 2 and list(AFlag(3)) == (AFlag.ONE, AFlag.TWO)``" #: ../../whatsnew/3.11.rst:704 @@ -1187,9 +1193,9 @@ msgid "" "defined before :meth:`~object.__init_subclass__` is called; :func:`dir` now " "includes methods, etc., from mixed-in data types." msgstr "" -"更改了 :class:`~enum.Enum` 和 :class:`~enum.Flag` 以在呼叫 :meth:`~object." -"__init_subclass__` 之前就定義成員;:func:`dir` 現在包括來自混合資料型別的方" -"法。" +"更改了 :class:`~enum.Enum` 和 :class:`~enum.Flag` 以在呼" +"叫 :meth:`~object.__init_subclass__` 之前就定義成員;:func:`dir` 現在包括來自" +"混合資料型別的方法。" #: ../../whatsnew/3.11.rst:709 msgid "" @@ -1242,11 +1248,11 @@ msgstr "functools" #: ../../whatsnew/3.11.rst:743 msgid "" -":func:`functools.singledispatch` now supports :data:`types.UnionType` and :" -"data:`typing.Union` as annotations to the dispatch argument.::" +":func:`functools.singledispatch` now supports :data:`types.UnionType` " +"and :data:`typing.Union` as annotations to the dispatch argument.::" msgstr "" -":func:`functools.singledispatch` 現在支援 :data:`types.UnionType` 和 :data:" -"`typing.Union` 作為調度 (dispatch) 引數的標註。 ::" +":func:`functools.singledispatch` 現在支援 :data:`types.UnionType` " +"和 :data:`typing.Union` 作為調度 (dispatch) 引數的標註。 ::" #: ../../whatsnew/3.11.rst:746 msgid "" @@ -1272,6 +1278,27 @@ msgid "" "... print(i, elem)\n" "..." msgstr "" +">>> from functools import singledispatch\n" +">>> @singledispatch\n" +"... def fun(arg, verbose=False):\n" +"... if verbose:\n" +"... print(\"Let me just say,\", end=\" \")\n" +"... print(arg)\n" +"...\n" +">>> @fun.register\n" +"... def _(arg: int | float, verbose=False):\n" +"... if verbose:\n" +"... print(\"Strength in numbers, eh?\", end=\" \")\n" +"... print(arg)\n" +"...\n" +">>> from typing import Union\n" +">>> @fun.register\n" +"... def _(arg: Union[list, set], verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)\n" +"..." #: ../../whatsnew/3.11.rst:768 msgid "(Contributed by Yurii Karabas in :issue:`46014`.)" @@ -1284,13 +1311,14 @@ msgstr "gzip" #: ../../whatsnew/3.11.rst:776 msgid "" "The :func:`gzip.compress` function is now faster when used with the " -"**mtime=0** argument as it delegates the compression entirely to a single :" -"func:`zlib.compress` operation. There is one side effect of this change: The " -"gzip file header contains an \"OS\" byte in its header. That was " -"traditionally always set to a value of 255 representing \"unknown\" by the :" -"mod:`gzip` module. Now, when using :func:`~gzip.compress` with **mtime=0**, " -"it may be set to a different value by the underlying zlib C library Python " -"was linked against. (See :gh:`112346` for details on the side effect.)" +"**mtime=0** argument as it delegates the compression entirely to a " +"single :func:`zlib.compress` operation. There is one side effect of this " +"change: The gzip file header contains an \"OS\" byte in its header. That was " +"traditionally always set to a value of 255 representing \"unknown\" by " +"the :mod:`gzip` module. Now, when using :func:`~gzip.compress` with " +"**mtime=0**, it may be set to a different value by the underlying zlib C " +"library Python was linked against. (See :gh:`112346` for details on the side " +"effect.)" msgstr "" #: ../../whatsnew/3.11.rst:789 @@ -1344,8 +1372,8 @@ msgid "" "Include prompts when saving Shell with inputs and outputs. (Contributed by " "Terry Jan Reedy in :gh:`95191`.)" msgstr "" -"當帶有輸入與輸出地儲存 Shell 時,也會包含提示字元。(由 Terry Jan Reedy 於 :" -"gh:`95191` 中所貢獻。)" +"當帶有輸入與輸出地儲存 Shell 時,也會包含提示字元。(由 Terry Jan Reedy " +"於 :gh:`95191` 中所貢獻。)" #: ../../whatsnew/3.11.rst:822 msgid "inspect" @@ -1364,11 +1392,12 @@ msgstr "" #: ../../whatsnew/3.11.rst:828 msgid "" "Add :func:`~inspect.ismethodwrapper` for checking if the type of an object " -"is a :class:`~types.MethodWrapperType`. (Contributed by Hakan Çelik in :" -"issue:`29418`.)" +"is a :class:`~types.MethodWrapperType`. (Contributed by Hakan Çelik " +"in :issue:`29418`.)" msgstr "" -"新增 :func:`inspect.ismethodwrapper`,用來檢查一個物件的型別是否為 :class:" -"`~types.MethodWrapperType`。(由 Hakan Çelik 於 :issue:`29418` 中所貢獻。)" +"新增 :func:`inspect.ismethodwrapper`,用來檢查一個物件的型別是否" +"為 :class:`~types.MethodWrapperType`。(由 Hakan Çelik 於 :issue:`29418` 中所" +"貢獻。)" #: ../../whatsnew/3.11.rst:832 msgid "" @@ -1378,10 +1407,10 @@ msgid "" "interfaces) that includes the extended :pep:`657` position information (end " "line number, column and end column). The affected functions are:" msgstr "" -"更改 :mod:`inspect` 模組中與幀相關的函式以回傳新的 :class:`~inspect." -"FrameInfo` 和 :class:`~inspect.Traceback` 類別實例(向後相容之前類似於 :term:" -"`named tuple` 的介面),包括擴充的 :pep:`657` 位置資訊(結束行號、欄和結束" -"欄)。受影響的功能是:" +"更改 :mod:`inspect` 模組中與幀相關的函式以回傳新" +"的 :class:`~inspect.FrameInfo` 和 :class:`~inspect.Traceback` 類別實例(向後" +"相容之前類似於 :term:`named tuple` 的介面),包括擴充的 :pep:`657` 位置資訊" +"(結束行號、欄和結束欄)。受影響的功能是:" #: ../../whatsnew/3.11.rst:838 msgid ":func:`inspect.getframeinfo`" @@ -1414,8 +1443,8 @@ msgstr "locale" #: ../../whatsnew/3.11.rst:852 msgid "" "Add :func:`locale.getencoding` to get the current locale encoding. It is " -"similar to ``locale.getpreferredencoding(False)`` but ignores the :ref:" -"`Python UTF-8 Mode <utf8-mode>`." +"similar to ``locale.getpreferredencoding(False)`` but ignores " +"the :ref:`Python UTF-8 Mode <utf8-mode>`." msgstr "" "新增 :func:`locale.getencoding` 以取得目前的區域編碼 (locale encoding)。和 " "``locale.getpreferredencoding(False)`` 類似但不考慮 :ref:`Python UTF-8 模式 " @@ -1428,9 +1457,9 @@ msgstr "logging" #: ../../whatsnew/3.11.rst:862 msgid "" "Added :func:`~logging.getLevelNamesMapping` to return a mapping from logging " -"level names (e.g. ``'CRITICAL'``) to the values of their corresponding :ref:" -"`levels` (e.g. ``50``, by default). (Contributed by Andrei Kulakovin in :gh:" -"`88024`.)" +"level names (e.g. ``'CRITICAL'``) to the values of their " +"corresponding :ref:`levels` (e.g. ``50``, by default). (Contributed by " +"Andrei Kulakovin in :gh:`88024`.)" msgstr "" "新增 :func:`~logging.getLevelNamesMapping` 以回傳一個日誌級別名稱(例如 " "``'CRITICAL'``)指到對應的 :ref:`levels` 數值(例如,預設為 ``50``)的對映。" @@ -1438,17 +1467,19 @@ msgstr "" #: ../../whatsnew/3.11.rst:867 msgid "" -"Added a :meth:`~logging.handlers.SysLogHandler.createSocket` method to :" -"class:`~logging.handlers.SysLogHandler`, to match :meth:`SocketHandler." -"createSocket() <logging.handlers.SocketHandler.createSocket>`. It is called " -"automatically during handler initialization and when emitting an event, if " -"there is no active socket. (Contributed by Kirill Pinchuk in :gh:`88457`.)" +"Added a :meth:`~logging.handlers.SysLogHandler.createSocket` method " +"to :class:`~logging.handlers.SysLogHandler`, to " +"match :meth:`SocketHandler.createSocket() " +"<logging.handlers.SocketHandler.createSocket>`. It is called automatically " +"during handler initialization and when emitting an event, if there is no " +"active socket. (Contributed by Kirill Pinchuk in :gh:`88457`.)" msgstr "" -"添加了一個 :meth:`~logging.handlers.SysLogHandler.createSocket` 方法到 :" -"class:`~logging.handlers.SysLogHandler`,以匹配 :meth:`SocketHandler." -"createSocket() <logging.handlers.SocketHandler.createSocket>` 。如果沒有已啟" -"用的 socket,它會在處理程式初始化期間和發出一個事件時自動呼叫。(由 Kirill " -"Pinchuk 在 :gh:`88457` 中貢獻。)" +"添加了一個 :meth:`~logging.handlers.SysLogHandler.createSocket` 方法" +"到 :class:`~logging.handlers.SysLogHandler`,以匹" +"配 :meth:`SocketHandler.createSocket() " +"<logging.handlers.SocketHandler.createSocket>` 。如果沒有已啟用的 socket,它" +"會在處理程式初始化期間和發出一個事件時自動呼叫。(由 Kirill Pinchuk " +"在 :gh:`88457` 中貢獻。)" #: ../../whatsnew/3.11.rst:879 msgid "math" @@ -1459,29 +1490,29 @@ msgid "" "Add :func:`math.exp2`: return 2 raised to the power of x. (Contributed by " "Gideon Mitchell in :issue:`45917`.)" msgstr "" -"新增 :func:`math.exp2`:回傳 2 的 x 次方。(由 Gideon Mitchell 於 :issue:" -"`45917` 中所貢獻。)" +"新增 :func:`math.exp2`:回傳 2 的 x 次方。(由 Gideon Mitchell " +"於 :issue:`45917` 中所貢獻。)" #: ../../whatsnew/3.11.rst:884 msgid "" "Add :func:`math.cbrt`: return the cube root of x. (Contributed by Ajith " "Ramachandran in :issue:`44357`.)" msgstr "" -"新增 :func:`math.cbrt`:回傳 x 的立方根。(由 Ajith Ramachandran 於 :issue:" -"`44357` 中所貢獻。)" +"新增 :func:`math.cbrt`:回傳 x 的立方根。(由 Ajith Ramachandran " +"於 :issue:`44357` 中所貢獻。)" #: ../../whatsnew/3.11.rst:887 msgid "" "The behaviour of two :func:`math.pow` corner cases was changed, for " -"consistency with the IEEE 754 specification. The operations ``math.pow(0.0, -" -"math.inf)`` and ``math.pow(-0.0, -math.inf)`` now return ``inf``. Previously " -"they raised :exc:`ValueError`. (Contributed by Mark Dickinson in :issue:" -"`44339`.)" +"consistency with the IEEE 754 specification. The operations ``math.pow(0.0, " +"-math.inf)`` and ``math.pow(-0.0, -math.inf)`` now return ``inf``. " +"Previously they raised :exc:`ValueError`. (Contributed by Mark Dickinson " +"in :issue:`44339`.)" msgstr "" "為了與 IEEE 754 規範保持一致,更改了兩個 :func:`math.pow` 邊角案例 (corner " "case) 的行為。``math.pow(0.0, -math.inf)`` 和 ``math.pow(-0.0, -math.inf)`` " -"現在回傳 ``inf``,之前它們會引發 :exc:`ValueError`。(由 Mark Dickinson 在 :" -"issue:`44339` 中貢獻。)" +"現在回傳 ``inf``,之前它們會引發 :exc:`ValueError`。(由 Mark Dickinson " +"在 :issue:`44339` 中貢獻。)" #: ../../whatsnew/3.11.rst:893 msgid "" @@ -1497,9 +1528,9 @@ msgstr "operator" #: ../../whatsnew/3.11.rst:902 msgid "" -"A new function ``operator.call`` has been added, such that ``operator." -"call(obj, *args, **kwargs) == obj(*args, **kwargs)``. (Contributed by Antony " -"Lee in :issue:`44019`.)" +"A new function ``operator.call`` has been added, such that " +"``operator.call(obj, *args, **kwargs) == obj(*args, **kwargs)``. " +"(Contributed by Antony Lee in :issue:`44019`.)" msgstr "" "新增 ``operator.call`` 函式,使得 ``operator.call(obj, *args, **kwargs) == " "obj(*args, **kwargs)``。(由 Antony Lee 於 :issue:`44019` 中所貢獻。)" @@ -1511,8 +1542,8 @@ msgstr "os" #: ../../whatsnew/3.11.rst:912 msgid "" "On Windows, :func:`os.urandom` now uses ``BCryptGenRandom()``, instead of " -"``CryptGenRandom()`` which is deprecated. (Contributed by Donghee Na in :" -"issue:`44611`.)" +"``CryptGenRandom()`` which is deprecated. (Contributed by Donghee Na " +"in :issue:`44611`.)" msgstr "" "在 Windows 上,:func:`os.urandom` 現在使用 ``BCryptGenRandom()`` 以取代被棄用" "的 ``CryptGenRandom()``。(由 Donghee Na 於 :issue:`44611` 中所貢獻。)" @@ -1524,9 +1555,9 @@ msgstr "pathlib" #: ../../whatsnew/3.11.rst:922 msgid "" ":meth:`~pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` return only " -"directories if *pattern* ends with a pathname components separator: :data:" -"`~os.sep` or :data:`~os.altsep`. (Contributed by Eisuke Kawasima in :issue:" -"`22276` and :issue:`33392`.)" +"directories if *pattern* ends with a pathname components " +"separator: :data:`~os.sep` or :data:`~os.altsep`. (Contributed by Eisuke " +"Kawasima in :issue:`22276` and :issue:`33392`.)" msgstr "" "如果 *pattern* 以路徑名稱元件分隔符號 :data:`~os.sep` 或 :data:`~os.altsep` " "結尾,:meth:`~pathlib.Path.glob` 和 :meth:`~pathlib.Path.rglob` 只回傳目錄。" @@ -1544,8 +1575,8 @@ msgid "" msgstr "" "現在規則運算式 (regular expression) 是有支援原子性群組 (atomic grouping) " "(``(?>...)``) 和佔有性量詞 (possessive quantifier) (``*+``, ``++``, ``?+``, " -"``{m,n}+``) 的。(由 Jeffrey C. Jacobs 和 Serhiy Storchaka 在 :issue:" -"`433030` 中貢獻。)" +"``{m,n}+``) 的。(由 Jeffrey C. Jacobs 和 Serhiy Storchaka " +"在 :issue:`433030` 中貢獻。)" #: ../../whatsnew/3.11.rst:941 msgid "shutil" @@ -1556,8 +1587,8 @@ msgid "" "Add optional parameter *dir_fd* in :func:`shutil.rmtree`. (Contributed by " "Serhiy Storchaka in :issue:`46245`.)" msgstr "" -"新增 :func:`shutil.rmtree` 的可選參數 *dir_fd*。(由 Serhiy Storchaka 於 :" -"issue:`46245` 中所貢獻。)" +"新增 :func:`shutil.rmtree` 的可選參數 *dir_fd*。(由 Serhiy Storchaka " +"於 :issue:`46245` 中所貢獻。)" #: ../../whatsnew/3.11.rst:950 msgid "socket" @@ -1565,8 +1596,8 @@ msgstr "socket" #: ../../whatsnew/3.11.rst:952 msgid "" -"Add CAN Socket support for NetBSD. (Contributed by Thomas Klausner in :issue:" -"`30512`.)" +"Add CAN Socket support for NetBSD. (Contributed by Thomas Klausner " +"in :issue:`30512`.)" msgstr "" "新增 NetBSD 對於 CAN Socket 的支援。(由 Thomas Klausner 於 :issue:`30512` 中" "所貢獻。)" @@ -1578,8 +1609,8 @@ msgid "" "raising the last error. (Contributed by Irit Katriel in :issue:`29980`.)" msgstr "" "當連接失敗時,:meth:`~socket.create_connection` 有個選項可以引發一個包含所有" -"錯誤的 :exc:`ExceptionGroup`,而非只引發最後一個錯誤。(由 Irit Katriel 於 :" -"issue:`29980` 中貢獻。)" +"錯誤的 :exc:`ExceptionGroup`,而非只引發最後一個錯誤。(由 Irit Katriel " +"於 :issue:`29980` 中貢獻。)" #: ../../whatsnew/3.11.rst:964 msgid "sqlite3" @@ -1587,48 +1618,49 @@ msgstr "sqlite3" #: ../../whatsnew/3.11.rst:966 msgid "" -"You can now disable the authorizer by passing :const:`None` to :meth:" -"`~sqlite3.Connection.set_authorizer`. (Contributed by Erlend E. Aasland in :" -"issue:`44491`.)" +"You can now disable the authorizer by passing :const:`None` " +"to :meth:`~sqlite3.Connection.set_authorizer`. (Contributed by Erlend E. " +"Aasland in :issue:`44491`.)" msgstr "" -"現在可以透過將 :const:`None` 傳遞給 :meth:`~sqlite3.Connection." -"set_authorizer` 來停用 authorizer。(由 Erlend E. Aasland 於 :issue:`44491` " -"中貢獻。)" +"現在可以透過將 :const:`None` 傳遞" +"給 :meth:`~sqlite3.Connection.set_authorizer` 來停用 authorizer。(由 " +"Erlend E. Aasland 於 :issue:`44491` 中貢獻。)" #: ../../whatsnew/3.11.rst:970 msgid "" "Collation name :meth:`~sqlite3.Connection.create_collation` can now contain " -"any Unicode character. Collation names with invalid characters now raise :" -"exc:`UnicodeEncodeError` instead of :exc:`sqlite3.ProgrammingError`. " +"any Unicode character. Collation names with invalid characters now " +"raise :exc:`UnicodeEncodeError` instead of :exc:`sqlite3.ProgrammingError`. " "(Contributed by Erlend E. Aasland in :issue:`44688`.)" msgstr "" "定序 (collation) 名稱 :meth:`~sqlite3.Connection.create_collation` 現在可以包" -"含任何 Unicode 字元。帶有無效字元的定序名稱現在會引發 :exc:" -"`UnicodeEncodeError` 而不是 :exc:`sqlite3.ProgrammingError`。(由 Erlend E. " -"Aasland 在 :issue:`44688` 中貢獻。)" +"含任何 Unicode 字元。帶有無效字元的定序名稱現在會引" +"發 :exc:`UnicodeEncodeError` 而不是 :exc:`sqlite3.ProgrammingError`。(由 " +"Erlend E. Aasland 在 :issue:`44688` 中貢獻。)" #: ../../whatsnew/3.11.rst:975 msgid "" -":mod:`sqlite3` exceptions now include the SQLite extended error code as :" -"attr:`~sqlite3.Error.sqlite_errorcode` and the SQLite error name as :attr:" -"`~sqlite3.Error.sqlite_errorname`. (Contributed by Aviv Palivoda, Daniel " -"Shahaf, and Erlend E. Aasland in :issue:`16379` and :issue:`24139`.)" +":mod:`sqlite3` exceptions now include the SQLite extended error code " +"as :attr:`~sqlite3.Error.sqlite_errorcode` and the SQLite error name " +"as :attr:`~sqlite3.Error.sqlite_errorname`. (Contributed by Aviv Palivoda, " +"Daniel Shahaf, and Erlend E. Aasland in :issue:`16379` and :issue:`24139`.)" msgstr "" -":mod:`sqlite3` 例外現在包含 SQLite 擴充錯誤碼和 SQLite 錯誤名稱(分別為 :" -"attr:`~sqlite3.Error.sqlite_errorcode` 和 :attr:`~sqlite3.Error." -"sqlite_errorname`)。(由 Aviv Palivoda、Daniel Shahaf 和 Erlend E. Aasland " -"在 :issue:`16379` 和 :issue:`24139` 中貢獻。)" +":mod:`sqlite3` 例外現在包含 SQLite 擴充錯誤碼和 SQLite 錯誤名稱(分別" +"為 :attr:`~sqlite3.Error.sqlite_errorcode` " +"和 :attr:`~sqlite3.Error.sqlite_errorname`)。(由 Aviv Palivoda、Daniel " +"Shahaf 和 Erlend E. Aasland 在 :issue:`16379` 和 :issue:`24139` 中貢獻。)" #: ../../whatsnew/3.11.rst:981 msgid "" -"Add :meth:`~sqlite3.Connection.setlimit` and :meth:`~sqlite3.Connection." -"getlimit` to :class:`sqlite3.Connection` for setting and getting SQLite " -"limits by connection basis. (Contributed by Erlend E. Aasland in :issue:" -"`45243`.)" +"Add :meth:`~sqlite3.Connection.setlimit` " +"and :meth:`~sqlite3.Connection.getlimit` to :class:`sqlite3.Connection` for " +"setting and getting SQLite limits by connection basis. (Contributed by " +"Erlend E. Aasland in :issue:`45243`.)" msgstr "" -"將 :meth:`~sqlite3.Connection.setlimit` 和 :meth:`~sqlite3.Connection." -"getlimit` 新增到 :class:`sqlite3.Connection` 以根據連線來設定和取得 SQLite 限" -"制。(由 Erlend E. Aasland 在 :issue:`45243` 中貢獻。)" +"將 :meth:`~sqlite3.Connection.setlimit` " +"和 :meth:`~sqlite3.Connection.getlimit` 新增到 :class:`sqlite3.Connection` 以" +"根據連線來設定和取得 SQLite 限制。(由 Erlend E. Aasland 在 :issue:`45243` 中" +"貢獻。)" #: ../../whatsnew/3.11.rst:986 msgid "" @@ -1659,40 +1691,43 @@ msgid "" "(Contributed by Erlend E. Aasland in :issue:`44092`.)" msgstr "" "跨越不同回滾 (rollback) 的拿取動作不再引發 :exc:`~sqlite3.InterfaceError`,我" -"們將其留給 SQLite 函式庫來處理這些情況。(由 Erlend E. Aasland 在 :issue:" -"`44092` 中貢獻。)" +"們將其留給 SQLite 函式庫來處理這些情況。(由 Erlend E. Aasland " +"在 :issue:`44092` 中貢獻。)" #: ../../whatsnew/3.11.rst:1000 msgid "" -"Add :meth:`~sqlite3.Connection.serialize` and :meth:`~sqlite3.Connection." -"deserialize` to :class:`sqlite3.Connection` for serializing and " -"deserializing databases. (Contributed by Erlend E. Aasland in :issue:" -"`41930`.)" +"Add :meth:`~sqlite3.Connection.serialize` " +"and :meth:`~sqlite3.Connection.deserialize` to :class:`sqlite3.Connection` " +"for serializing and deserializing databases. (Contributed by Erlend E. " +"Aasland in :issue:`41930`.)" msgstr "" -"將 :meth:`~sqlite3.Connection.serialize` 和 :meth:`~sqlite3.Connection." -"deserialize` 新增到 :class:`sqlite3.Connection` 以用於序列化和反序列化資料" -"庫。(由 Erlend E. Aasland 在 :issue:`41930` 中貢獻。)" +"將 :meth:`~sqlite3.Connection.serialize` " +"和 :meth:`~sqlite3.Connection.deserialize` 新增" +"到 :class:`sqlite3.Connection` 以用於序列化和反序列化資料庫。(由 Erlend E. " +"Aasland 在 :issue:`41930` 中貢獻。)" #: ../../whatsnew/3.11.rst:1005 msgid "" -"Add :meth:`~sqlite3.Connection.create_window_function` to :class:`sqlite3." -"Connection` for creating aggregate window functions. (Contributed by Erlend " -"E. Aasland in :issue:`34916`.)" +"Add :meth:`~sqlite3.Connection.create_window_function` " +"to :class:`sqlite3.Connection` for creating aggregate window functions. " +"(Contributed by Erlend E. Aasland in :issue:`34916`.)" msgstr "" -"於 :class:`sqlite3.Connection` 加入 :meth:`~sqlite3.Connection." -"create_window_function` 已建立聚合視窗函式 (aggregate window function)。(由 " -"Erlend E. Aasland 於 :issue:`34916` 中貢獻。)" +"於 :class:`sqlite3.Connection` 加" +"入 :meth:`~sqlite3.Connection.create_window_function` 已建立聚合視窗函式 " +"(aggregate window function)。(由 Erlend E. Aasland 於 :issue:`34916` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:1009 msgid "" -"Add :meth:`~sqlite3.Connection.blobopen` to :class:`sqlite3.Connection`. :" -"class:`sqlite3.Blob` allows incremental I/O operations on blobs. " -"(Contributed by Aviv Palivoda and Erlend E. Aasland in :issue:`24905`.)" +"Add :meth:`~sqlite3.Connection.blobopen` " +"to :class:`sqlite3.Connection`. :class:`sqlite3.Blob` allows incremental I/O " +"operations on blobs. (Contributed by Aviv Palivoda and Erlend E. Aasland " +"in :issue:`24905`.)" msgstr "" -"在 :class:`sqlite3.Connection` 新增 :meth:`~sqlite3.Connection.blobopen`。 :" -"class:`sqlite3.Blob` 允許對 blob 進行增量 I/O 操作 (incremental I/O " -"operations)。(由 Aviv Palivoda 和 Erlend E. Aasland 在 :issue:`24905` 中貢" -"獻。)" +"在 :class:`sqlite3.Connection` 新" +"增 :meth:`~sqlite3.Connection.blobopen`。 :class:`sqlite3.Blob` 允許對 blob " +"進行增量 I/O 操作 (incremental I/O operations)。(由 Aviv Palivoda 和 Erlend " +"E. Aasland 在 :issue:`24905` 中貢獻。)" #: ../../whatsnew/3.11.rst:1017 msgid "string" @@ -1700,15 +1735,15 @@ msgstr "string" #: ../../whatsnew/3.11.rst:1019 msgid "" -"Add :meth:`~string.Template.get_identifiers` and :meth:`~string.Template." -"is_valid` to :class:`string.Template`, which respectively return all valid " -"placeholders, and whether any invalid placeholders are present. (Contributed " -"by Ben Kehoe in :gh:`90465`.)" +"Add :meth:`~string.Template.get_identifiers` " +"and :meth:`~string.Template.is_valid` to :class:`string.Template`, which " +"respectively return all valid placeholders, and whether any invalid " +"placeholders are present. (Contributed by Ben Kehoe in :gh:`90465`.)" msgstr "" -"新增 :meth:`~string.Template.get_identifiers` 和 :meth:`~string.Template." -"is_valid` 於 :class:`string.Template`,分別能夠回傳所有合格的預留位置 " -"(placeholder) 與是否有任何不合格的預留位置存在。(由 Ben Kehoe 於 :gh:" -"`90465` 中貢獻。)" +"新增 :meth:`~string.Template.get_identifiers` " +"和 :meth:`~string.Template.is_valid` 於 :class:`string.Template`,分別能夠回" +"傳所有合格的預留位置 (placeholder) 與是否有任何不合格的預留位置存在。(由 " +"Ben Kehoe 於 :gh:`90465` 中貢獻。)" #: ../../whatsnew/3.11.rst:1029 msgid "sys" @@ -1719,8 +1754,8 @@ msgid "" ":func:`sys.exc_info` now derives the ``type`` and ``traceback`` fields from " "the ``value`` (the exception instance), so when an exception is modified " "while it is being handled, the changes are reflected in the results of " -"subsequent calls to :func:`!exc_info`. (Contributed by Irit Katriel in :" -"issue:`45711`.)" +"subsequent calls to :func:`!exc_info`. (Contributed by Irit Katriel " +"in :issue:`45711`.)" msgstr "" ":func:`sys.exc_info` 現在從 ``value``\\ (例外實例)衍生出 ``type`` 和 " "``traceback`` 欄位,因此當例外在處理過程中被修改時,變更會反映在 :func:`!" @@ -1729,20 +1764,20 @@ msgstr "" #: ../../whatsnew/3.11.rst:1037 msgid "" "Add :func:`sys.exception` which returns the active exception instance " -"(equivalent to ``sys.exc_info()[1]``). (Contributed by Irit Katriel in :" -"issue:`46328`.)" +"(equivalent to ``sys.exc_info()[1]``). (Contributed by Irit Katriel " +"in :issue:`46328`.)" msgstr "" -"新增會回傳活躍例外實例 (active exception instance) 的 :func:`sys." -"exception`\\ (等價於 ``sys.exc_info()[1]``\\ )。(由 Irit Katriel 於 :" -"issue:`46328` 中所貢獻。)" +"新增會回傳活躍例外實例 (active exception instance) " +"的 :func:`sys.exception`\\ (等價於 ``sys.exc_info()[1]``\\ )。(由 Irit " +"Katriel 於 :issue:`46328` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1041 msgid "" "Add the :data:`sys.flags.safe_path <sys.flags>` flag. (Contributed by Victor " "Stinner in :gh:`57684`.)" msgstr "" -"新增 :data:`sys.flags.safe_path <sys.flags>` 旗標。(由 Victor Stinner 於 :" -"gh:`57684` 中所貢獻。)" +"新增 :data:`sys.flags.safe_path <sys.flags>` 旗標。(由 Victor Stinner " +"於 :gh:`57684` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1048 msgid "sysconfig" @@ -1778,13 +1813,13 @@ msgid "" ":class:`~tempfile.SpooledTemporaryFile` objects now fully implement the " "methods of :class:`io.BufferedIOBase` or :class:`io.TextIOBase` (depending " "on file mode). This lets them work correctly with APIs that expect file-like " -"objects, such as compression modules. (Contributed by Carey Metcalfe in :gh:" -"`70363`.)" +"objects, such as compression modules. (Contributed by Carey Metcalfe " +"in :gh:`70363`.)" msgstr "" -":class:`~tempfile.SpooledTemporaryFile` 物件現在完整實作了 :class:`io." -"BufferedIOBase` 或 :class:`io.TextIOBase` 的方法(取決於檔案模式),這使它們" -"能夠正確地使用需要類檔案物件的 API,例如壓縮模組。(由 Carey Metcalfe 在 :gh:" -"`70363` 中貢獻。)" +":class:`~tempfile.SpooledTemporaryFile` 物件現在完整實作" +"了 :class:`io.BufferedIOBase` 或 :class:`io.TextIOBase` 的方法(取決於檔案模" +"式),這使它們能夠正確地使用需要類檔案物件的 API,例如壓縮模組。(由 Carey " +"Metcalfe 在 :gh:`70363` 中貢獻。)" #: ../../whatsnew/3.11.rst:1080 msgid "threading" @@ -1796,13 +1831,13 @@ msgid "" "(glibc 2.30 and newer), the :meth:`threading.Lock.acquire` method now uses " "the monotonic clock (:const:`time.CLOCK_MONOTONIC`) for the timeout, rather " "than using the system clock (:const:`time.CLOCK_REALTIME`), to not be " -"affected by system clock changes. (Contributed by Victor Stinner in :issue:" -"`41710`.)" +"affected by system clock changes. (Contributed by Victor Stinner " +"in :issue:`41710`.)" msgstr "" "在 Unix 上,如果 ``sem_clockwait()`` 函式在 C 函式庫(glibc 2.30 與其更新的版" -"本)中可被使用,則 :meth:`threading.Lock.acquire` 方法現在會使用單調時鐘 (:" -"const:`time. CLOCK_MONOTONIC`) 用於超時 (timeout),而不是使用系統時鐘 (:" -"const:`time.CLOCK_REALTIME`),以免受系統時鐘變化的影響。 由 Victor Stinner " +"本)中可被使用,則 :meth:`threading.Lock.acquire` 方法現在會使用單調時鐘 " +"(:const:`time. CLOCK_MONOTONIC`) 用於超時 (timeout),而不是使用系統時鐘 " +"(:const:`time.CLOCK_REALTIME`),以免受系統時鐘變化的影響。 由 Victor Stinner " "在 :issue:`41710` 中貢獻。)" #: ../../whatsnew/3.11.rst:1093 @@ -1818,9 +1853,10 @@ msgid "" "Benjamin Szőke and Victor Stinner in :issue:`21302`.)" msgstr "" "在 Unix 上,如果可用的話,:func:`time.sleep` 現在會使用 " -"``clock_nanosleep()`` 或 ``nanosleep()`` 函式,其解析度為 1 納秒(10\\ :sup:" -"`-9` 秒),而不是使用解析度為 1 微秒(10\\ :sup:`-6` 秒)的 ``select()``。" -"(由 Benjamin Szőke 和 Victor Stinner 在 :issue:`21302` 中貢獻。)" +"``clock_nanosleep()`` 或 ``nanosleep()`` 函式,其解析度為 1 納秒" +"(10\\ :sup:`-9` 秒),而不是使用解析度為 1 微秒(10\\ :sup:`-6` 秒)的 " +"``select()``。(由 Benjamin Szőke 和 Victor Stinner 在 :issue:`21302` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:1101 msgid "" @@ -1829,15 +1865,15 @@ msgid "" "hardware/drivers/kernel/high-resolution-timers>`_ which has a resolution of " "100 nanoseconds (10\\ :sup:`-7` seconds). Previously, it had a resolution of " "1 millisecond (10\\ :sup:`-3` seconds). (Contributed by Benjamin Szőke, " -"Donghee Na, Eryk Sun and Victor Stinner in :issue:`21302` and :issue:" -"`45429`.)" +"Donghee Na, Eryk Sun and Victor Stinner in :issue:`21302` " +"and :issue:`45429`.)" msgstr "" "在 Windows 8.1 或更新的平台上,:func:`time.sleep` 現在使用了一個基於\\ `高解" "析度計時器 <https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/" "high-resolution-timers>`_\\ 的可等待 (waitable) 計時器,解析度為 100 奈秒" "(即 10\\ :sup:`-7` 秒)。在這之前,它只有 1 微秒(10\\ :sup:`-3` 秒) 的解析" -"度。(由 Benjamin Szőke、Donghee Na、Eryk Sun 和 Victor Stinner 於 :issue:" -"`21302` 與 :issue:`45429` 中貢獻。)" +"度。(由 Benjamin Szőke、Donghee Na、Eryk Sun 和 Victor Stinner " +"於 :issue:`21302` 與 :issue:`45429` 中貢獻。)" #: ../../whatsnew/3.11.rst:1112 msgid "tkinter" @@ -1868,13 +1904,13 @@ msgstr "" #: ../../whatsnew/3.11.rst:1129 msgid "" -"Add :func:`traceback.TracebackException.print`, which prints the formatted :" -"exc:`~traceback.TracebackException` instance to a file. (Contributed by Irit " -"Katriel in :issue:`33809`.)" +"Add :func:`traceback.TracebackException.print`, which prints the " +"formatted :exc:`~traceback.TracebackException` instance to a file. " +"(Contributed by Irit Katriel in :issue:`33809`.)" msgstr "" -"新增 :func:`traceback.TracebackException.print`,它會印出格式化的 :exc:" -"`~traceback.TracebackException` 實例至一個檔案。(由 Irit Katriel 在 :issue:" -"`33809` 中貢獻。)" +"新增 :func:`traceback.TracebackException.print`,它會印出格式化" +"的 :exc:`~traceback.TracebackException` 實例至一個檔案。(由 Irit Katriel " +"在 :issue:`33809` 中貢獻。)" #: ../../whatsnew/3.11.rst:1137 msgid "typing" @@ -1886,14 +1922,16 @@ msgstr "重大變更請見 :ref:`new-feat-related-type-hints-311`。" #: ../../whatsnew/3.11.rst:1141 msgid "" -"Add :func:`typing.assert_never` and :class:`typing.Never`. :func:`typing." -"assert_never` is useful for asking a type checker to confirm that a line of " -"code is not reachable. At runtime, it raises an :exc:`AssertionError`. " -"(Contributed by Jelle Zijlstra in :gh:`90633`.)" +"Add :func:`typing.assert_never` " +"and :class:`typing.Never`. :func:`typing.assert_never` is useful for asking " +"a type checker to confirm that a line of code is not reachable. At runtime, " +"it raises an :exc:`AssertionError`. (Contributed by Jelle Zijlstra " +"in :gh:`90633`.)" msgstr "" -"新增 :func:`typing.assert_never` 和 :class:`typing.Never`。 :func:`typing." -"assert_never` 可用於要型別檢查器確認某行程式碼是否不可觸及。在執行環境,它會" -"引發 :exc:`AssertionError`。(由 Jelle Zijlstra 在 :gh:`90633` 中貢獻。)" +"新增 :func:`typing.assert_never` " +"和 :class:`typing.Never`。 :func:`typing.assert_never` 可用於要型別檢查器確認" +"某行程式碼是否不可觸及。在執行環境,它會引發 :exc:`AssertionError`。(由 " +"Jelle Zijlstra 在 :gh:`90633` 中貢獻。)" #: ../../whatsnew/3.11.rst:1147 msgid "" @@ -1921,16 +1959,16 @@ msgid "" ":data:`typing.TypedDict` types can now be generic. (Contributed by Samodya " "Abeysiriwardane in :gh:`89026`.)" msgstr "" -":data:`typing.TypedDict` 型別現可為泛型。(由 Samodya Abeysiriwardane 於 :gh:" -"`89026` 中所貢獻。)" +":data:`typing.TypedDict` 型別現可為泛型。(由 Samodya Abeysiriwardane " +"於 :gh:`89026` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1160 msgid "" ":class:`~typing.NamedTuple` types can now be generic. (Contributed by Serhiy " "Storchaka in :issue:`43923`.)" msgstr "" -":class:`~typing.NamedTuple` 型別現可為泛型。(由 Serhiy Storchaka 於 :issue:" -"`43923` 中所貢獻。)" +":class:`~typing.NamedTuple` 型別現可為泛型。(由 Serhiy Storchaka " +"於 :issue:`43923` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1163 msgid "" @@ -1953,8 +1991,8 @@ msgstr "" msgid "" "The :func:`typing.get_overloads` function can be used for introspecting the " "overloads of a function. :func:`typing.clear_overloads` can be used to clear " -"all registered overloads of a function. (Contributed by Jelle Zijlstra in :" -"gh:`89263`.)" +"all registered overloads of a function. (Contributed by Jelle Zijlstra " +"in :gh:`89263`.)" msgstr "" ":func:`typing.get_overloads` 函式可用於自我檢查 (introspect) 一個函式的過載 " "(overload)。:func:`typing.clear_overloads` 可用於清除一個函式的所有已註冊過" @@ -1993,28 +2031,28 @@ msgid "" "references in :ref:`PEP 585 generic aliases <types-genericalias>`. " "(Contributed by Niklas Rosenstein in :gh:`85542`.)" msgstr "" -"作為\\ :ref:`PEP 585 泛化別名 <types-genericalias>`\\ 中的前向參照,:func:" -"`typing.get_type_hints` 現支援了為字串求值 (evaluate)。(由 Niklas " +"作為\\ :ref:`PEP 585 泛化別名 <types-genericalias>`\\ 中的前向參" +"照,:func:`typing.get_type_hints` 現支援了為字串求值 (evaluate)。(由 Niklas " "Rosenstein 在 :gh:`85542` 中貢獻。)" #: ../../whatsnew/3.11.rst:1192 msgid "" ":func:`typing.get_type_hints` no longer adds :data:`~typing.Optional` to " -"parameters with ``None`` as a default. (Contributed by Nikita Sobolev in :gh:" -"`90353`.)" +"parameters with ``None`` as a default. (Contributed by Nikita Sobolev " +"in :gh:`90353`.)" msgstr "" ":func:`typing.get_type_hints` 不再將 :data:`~typing.Optional` 新增到預設為 " "``None`` 的參數中。(由 Nikita Sobolev 在 :gh:`90353` 中貢獻。)" #: ../../whatsnew/3.11.rst:1196 msgid "" -":func:`typing.get_type_hints` now supports evaluating bare stringified :data:" -"`~typing.ClassVar` annotations. (Contributed by Gregory Beauregard in :gh:" -"`90711`.)" +":func:`typing.get_type_hints` now supports evaluating bare " +"stringified :data:`~typing.ClassVar` annotations. (Contributed by Gregory " +"Beauregard in :gh:`90711`.)" msgstr "" ":func:`typing.get_type_hints` 現在支援為無修飾 (bare) 字串化 (stringified) " -"的 :data:`~typing.ClassVar` 標註來求值。(由 Gregory Beauregard 在 :gh:" -"`90711` 中貢獻。)" +"的 :data:`~typing.ClassVar` 標註來求值。(由 Gregory Beauregard " +"在 :gh:`90711` 中貢獻。)" #: ../../whatsnew/3.11.rst:1200 msgid "" @@ -2043,17 +2081,21 @@ msgstr "unittest" #: ../../whatsnew/3.11.rst:1219 msgid "" -"Added methods :meth:`~unittest.TestCase.enterContext` and :meth:`~unittest." -"TestCase.enterClassContext` of class :class:`~unittest.TestCase`, method :" -"meth:`~unittest.IsolatedAsyncioTestCase.enterAsyncContext` of class :class:" -"`~unittest.IsolatedAsyncioTestCase` and function :func:`unittest." -"enterModuleContext`. (Contributed by Serhiy Storchaka in :issue:`45046`.)" -msgstr "" -"新增 :class:`~unittest.TestCase` 類別的 :meth:`~unittest.TestCase." -"enterContext` 與 :meth:`~unittest.TestCase.enterClassContext` 方法、 :class:" -"`~unittest.IsolatedAsyncioTestCase` 類別 的 :meth:`~unittest." -"IsolatedAsyncioTestCase.enterAsyncContext` 方法、:func:`unittest." -"enterModuleContext` 函式。(由 Serhiy Storchaka 於 :issue:`45046` 貢獻。)" +"Added methods :meth:`~unittest.TestCase.enterContext` " +"and :meth:`~unittest.TestCase.enterClassContext` of " +"class :class:`~unittest.TestCase`, " +"method :meth:`~unittest.IsolatedAsyncioTestCase.enterAsyncContext` of " +"class :class:`~unittest.IsolatedAsyncioTestCase` and " +"function :func:`unittest.enterModuleContext`. (Contributed by Serhiy " +"Storchaka in :issue:`45046`.)" +msgstr "" +"新增 :class:`~unittest.TestCase` 類別" +"的 :meth:`~unittest.TestCase.enterContext` " +"與 :meth:`~unittest.TestCase.enterClassContext` 方" +"法、 :class:`~unittest.IsolatedAsyncioTestCase` 類別 " +"的 :meth:`~unittest.IsolatedAsyncioTestCase.enterAsyncContext` 方" +"法、:func:`unittest.enterModuleContext` 函式。(由 Serhiy Storchaka " +"於 :issue:`45046` 貢獻。)" #: ../../whatsnew/3.11.rst:1231 msgid "venv" @@ -2067,8 +2109,8 @@ msgid "" "installation scheme is the default. That means that downstream distributors " "can change the default sysconfig install scheme without changing behavior of " "virtual environments. Third party code that also creates new virtual " -"environments should do the same. (Contributed by Miro Hrončok in :issue:" -"`45413`.)" +"environments should do the same. (Contributed by Miro Hrončok " +"in :issue:`45413`.)" msgstr "" "建立新的 Python 虛擬環境時,*venv* :ref:`sysconfig 安裝方案 " "<installation_paths>`\\ 會被用於確定環境內的路徑。當 Python 在虛擬環境中運行" @@ -2082,10 +2124,10 @@ msgstr "warnings" #: ../../whatsnew/3.11.rst:1249 msgid "" -":func:`warnings.catch_warnings` now accepts arguments for :func:`warnings." -"simplefilter`, providing a more concise way to locally ignore warnings or " -"convert them to errors. (Contributed by Zac Hatfield-Dodds in :issue:" -"`47074`.)" +":func:`warnings.catch_warnings` now accepts arguments " +"for :func:`warnings.simplefilter`, providing a more concise way to locally " +"ignore warnings or convert them to errors. (Contributed by Zac Hatfield-" +"Dodds in :issue:`47074`.)" msgstr "" ":func:`warnings.catch_warnings` 現在接受 :func:`warnings.simplefilter` 的引" "數,提供了一種更簡潔的方法來在本地端忽略警告或將它們轉換為錯誤。(由 Zac " @@ -2097,8 +2139,8 @@ msgstr "zipfile" #: ../../whatsnew/3.11.rst:1259 msgid "" -"Added support for specifying member name encoding for reading metadata in a :" -"class:`~zipfile.ZipFile`'s directory and file headers. (Contributed by " +"Added support for specifying member name encoding for reading metadata in " +"a :class:`~zipfile.ZipFile`'s directory and file headers. (Contributed by " "Stephen J. Turnbull and Serhiy Storchaka in :issue:`28080`.)" msgstr "" "新增了對指定成員名稱編碼的支援,以便在 :class:`~zipfile.ZipFile` 的目錄和檔案" @@ -2115,13 +2157,13 @@ msgstr "" #: ../../whatsnew/3.11.rst:1267 msgid "" -"Added :attr:`~zipfile.Path.stem`, :attr:`~zipfile.Path.suffix` and :attr:" -"`~zipfile.Path.suffixes` to :class:`zipfile.Path`. (Contributed by Miguel " -"Brito in :gh:`88261`.)" +"Added :attr:`~zipfile.Path.stem`, :attr:`~zipfile.Path.suffix` " +"and :attr:`~zipfile.Path.suffixes` to :class:`zipfile.Path`. (Contributed by " +"Miguel Brito in :gh:`88261`.)" msgstr "" -"於 :class:`zipfile.Path` 新增 :attr:`~zipfile.Path.stem`、:attr:`~zipfile." -"Path.suffix` 和 :attr:`~zipfile.Path.suffixes`。(由 Miguel Brito 於 :gh:" -"`88261` 貢獻。)" +"於 :class:`zipfile.Path` 新" +"增 :attr:`~zipfile.Path.stem`、:attr:`~zipfile.Path.suffix` " +"和 :attr:`~zipfile.Path.suffixes`。(由 Miguel Brito 於 :gh:`88261` 貢獻。)" #: ../../whatsnew/3.11.rst:1275 msgid "Optimizations" @@ -2129,8 +2171,9 @@ msgstr "最佳化" #: ../../whatsnew/3.11.rst:1277 msgid "" -"This section covers specific optimizations independent of the :ref:" -"`whatsnew311-faster-cpython` project, which is covered in its own section." +"This section covers specific optimizations independent of " +"the :ref:`whatsnew311-faster-cpython` project, which is covered in its own " +"section." msgstr "" "這個部分會涵蓋到特定的最佳化,但獨立於擁有自己一個說明的\\ :ref:`whatsnew311-" "faster-cpython` 計畫。" @@ -2151,8 +2194,8 @@ msgstr "" msgid "" "Integer division (``//``) is better tuned for optimization by compilers. It " "is now around 20% faster on x86-64 when dividing an :class:`int` by a value " -"smaller than ``2**30``. (Contributed by Gregory P. Smith and Tim Peters in :" -"gh:`90564`.)" +"smaller than ``2**30``. (Contributed by Gregory P. Smith and Tim Peters " +"in :gh:`90564`.)" msgstr "" "整數除法 (``//``) 為了編譯器最佳化而被調校過。現在將 :class:`int` 除以小於 " "``2**30`` 的值時,在 x86-64 上快了大約 20%。(由 Gregory P. Smith 和 Tim " @@ -2168,20 +2211,21 @@ msgstr "" #: ../../whatsnew/3.11.rst:1294 msgid "" -"Resizing lists is streamlined for the common case, speeding up :meth:`list." -"append` by ≈15% and simple :term:`list comprehension`\\s by up to 20-30% " -"(Contributed by Dennis Sweeney in :gh:`91165`.)" +"Resizing lists is streamlined for the common case, speeding " +"up :meth:`list.append` by ≈15% and simple :term:`list comprehension`\\s by " +"up to 20-30% (Contributed by Dennis Sweeney in :gh:`91165`.)" msgstr "" "調整 list 大小在常見情況下增進了效能,為 :meth:`list.append` 加快了約 15% 並" -"為簡單的 :term:`list comprehension` 加快了高達 20-30%(由 Dennis Sweeney 在 :" -"gh:`91165` 中貢獻。)" +"為簡單的 :term:`list comprehension` 加快了高達 20-30%(由 Dennis Sweeney " +"在 :gh:`91165` 中貢獻。)" #: ../../whatsnew/3.11.rst:1299 msgid "" "Dictionaries don't store hash values when all keys are Unicode objects, " -"decreasing :class:`dict` size. For example, ``sys.getsizeof(dict." -"fromkeys(\"abcdefg\"))`` is reduced from 352 bytes to 272 bytes (23% " -"smaller) on 64-bit platforms. (Contributed by Inada Naoki in :issue:`46845`.)" +"decreasing :class:`dict` size. For example, " +"``sys.getsizeof(dict.fromkeys(\"abcdefg\"))`` is reduced from 352 bytes to " +"272 bytes (23% smaller) on 64-bit platforms. (Contributed by Inada Naoki " +"in :issue:`46845`.)" msgstr "" "當所有鍵都是 Unicode 物件時,字典不存儲雜湊值,減少了 :class:`dict` 的大小。" "例如,``sys.getsizeof(dict.fromkeys(\"abcdefg\"))`` 在 64-bit 平台上從 352 位" @@ -2195,8 +2239,8 @@ msgid "" "for a ≈60 MiB file. (Contributed by msoxzw in :gh:`91487`.)" msgstr "" "使用 :class:`asyncio.DatagramProtocol` 以透過 UDP 傳輸大文件時,現在速度提高" -"了幾個數量級,傳輸 ≈60 MiB 檔案的速度提高了 100 多倍。(由 msoxzw 在 :gh:" -"`91487` 中貢獻。)" +"了幾個數量級,傳輸 ≈60 MiB 檔案的速度提高了 100 多倍。(由 msoxzw " +"在 :gh:`91487` 中貢獻。)" #: ../../whatsnew/3.11.rst:1310 msgid "" @@ -2205,21 +2249,22 @@ msgid "" "(Contributed by Serhiy Storchaka in :issue:`37295`.)" msgstr "" ":mod:`math` 函式 :func:`~math.comb` 和 :func:`~math.perm` 針對較大引數現在快" -"了 ≈10 倍(對於更大的 *k* 有更大的加速)。(由 Serhiy Storchaka 在 :issue:" -"`37295` 中貢獻。)" +"了 ≈10 倍(對於更大的 *k* 有更大的加速)。(由 Serhiy Storchaka " +"在 :issue:`37295` 中貢獻。)" #: ../../whatsnew/3.11.rst:1314 msgid "" -"The :mod:`statistics` functions :func:`~statistics.mean`, :func:`~statistics." -"variance` and :func:`~statistics.stdev` now consume iterators in one pass " -"rather than converting them to a :class:`list` first. This is twice as fast " -"and can save substantial memory. (Contributed by Raymond Hettinger in :gh:" -"`90415`.)" +"The :mod:`statistics` " +"functions :func:`~statistics.mean`, :func:`~statistics.variance` " +"and :func:`~statistics.stdev` now consume iterators in one pass rather than " +"converting them to a :class:`list` first. This is twice as fast and can save " +"substantial memory. (Contributed by Raymond Hettinger in :gh:`90415`.)" msgstr "" -":mod:`statistics` 函式 :func:`~statistics.mean`、:func:`~statistics." -"variance` 和 :func:`~statistics.stdev` 現在會一次性的消耗疊代器,而不是先將它" -"們轉換為 :class:`list`,這讓速度提升為兩倍並可以節省大量記憶體空間。(由 " -"Raymond Hettinger 在 :gh:`90415` 中貢獻。)" +":mod:`statistics` 函" +"式 :func:`~statistics.mean`、:func:`~statistics.variance` " +"和 :func:`~statistics.stdev` 現在會一次性的消耗疊代器,而不是先將它們轉換" +"為 :class:`list`,這讓速度提升為兩倍並可以節省大量記憶體空間。(由 Raymond " +"Hettinger 在 :gh:`90415` 中貢獻。)" #: ../../whatsnew/3.11.rst:1320 msgid "" @@ -2252,9 +2297,9 @@ msgid "" "startup` and :ref:`whatsnew311-faster-runtime`. Optimizations not covered by " "this project are listed separately under :ref:`whatsnew311-optimizations`." msgstr "" -"此計畫專注在 Python 的 :ref:`whatsnew311-faster-startup` 和 :ref:" -"`whatsnew311-faster-runtime`。不在此專案內的最佳化被獨立列出在 :ref:" -"`whatsnew311-optimizations`。" +"此計畫專注在 Python 的 :ref:`whatsnew311-faster-startup` " +"和 :ref:`whatsnew311-faster-runtime`。不在此專案內的最佳化被獨立列出" +"在 :ref:`whatsnew311-optimizations`。" #: ../../whatsnew/3.11.rst:1346 msgid "Faster Startup" @@ -2287,9 +2332,9 @@ msgid "" "statically allocated by the interpreter. This reduces the steps in module " "execution process to:" msgstr "" -"在 Python 3.11 中,核心模組在 Python 啟動時必須被「凍結」,這意味著它們的\\ :" -"ref:`程式碼物件 <codeobjects>`\\ (和位元組碼)是由直譯器靜態分配的。這將模組" -"執行過程中的步驟減少為:" +"在 Python 3.11 中,核心模組在 Python 啟動時必須被「凍結」,這意味著它們的" +"\\ :ref:`程式碼物件 <codeobjects>`\\ (和位元組碼)是由直譯器靜態分配的。這將" +"模組執行過程中的步驟減少為:" #: ../../whatsnew/3.11.rst:1367 msgid "Statically allocated code object -> Evaluate" @@ -2345,10 +2390,10 @@ msgstr "" #: ../../whatsnew/3.11.rst:1396 msgid "" "Old-style :ref:`frame objects <frame-objects>` are now created only when " -"requested by debuggers or by Python introspection functions such as :func:" -"`sys._getframe` and :func:`inspect.currentframe`. For most user code, no " -"frame objects are created at all. As a result, nearly all Python functions " -"calls have sped up significantly. We measured a 3-7% speedup in " +"requested by debuggers or by Python introspection functions such " +"as :func:`sys._getframe` and :func:`inspect.currentframe`. For most user " +"code, no frame objects are created at all. As a result, nearly all Python " +"functions calls have sped up significantly. We measured a 3-7% speedup in " "pyperformance." msgstr "" "舊式\\ :ref:`幀物件 <frame-objects>`\\ 現在僅在除錯器或 Python 自我檢查函式" @@ -2388,13 +2433,14 @@ msgid "" "Most Python function calls now consume no C stack space, speeding them up. " "In simple recursive functions like fibonacci or factorial, we observed a " "1.7x speedup. This also means recursive functions can recurse significantly " -"deeper (if the user increases the recursion limit with :func:`sys." -"setrecursionlimit`). We measured a 1-3% improvement in pyperformance." +"deeper (if the user increases the recursion limit " +"with :func:`sys.setrecursionlimit`). We measured a 1-3% improvement in " +"pyperformance." msgstr "" "現在大多數 Python 函式的呼叫因為不會佔用 C 堆疊空間而被加速。在斐波那契 " "(fibonacci) 或階乘等簡單遞迴函式中,觀察到 1.7 倍的加速。這也意味著遞迴函式可" -"以遞迴得更深(如果使用者有增加\\ :func:`遞迴限制 <sys." -"setrecursionlimit>`\\ )。我們在 pyperformance 測得 1-3% 的改進。" +"以遞迴得更深(如果使用者有增加\\ :func:`遞迴限制 " +"<sys.setrecursionlimit>`\\ )。我們在 pyperformance 測得 1-3% 的改進。" #: ../../whatsnew/3.11.rst:1427 msgid "(Contributed by Pablo Galindo and Mark Shannon in :issue:`45256`.)" @@ -2422,8 +2468,8 @@ msgid "" "more specialized one. This specialized operation uses fast paths available " "only to those use cases/types, which generally outperform their generic " "counterparts. This also brings in another concept called *inline caching*, " -"where Python caches the results of expensive operations directly in the :" -"term:`bytecode`." +"where Python caches the results of expensive operations directly in " +"the :term:`bytecode`." msgstr "" "在執行環境,Python 將嘗試在執行中的程式碼內尋找常用模式和型別穩定,然後 " "Python 將用更特化的操作替換目前操作。這種特化操作運用了僅適用於那些用例/型別" @@ -2455,13 +2501,13 @@ msgstr "" #: ../../whatsnew/3.11.rst:1457 msgid "" -"(PEP written by Mark Shannon, with ideas inspired by Stefan Brunthaler. See :" -"pep:`659` for more information. Implementation by Mark Shannon and Brandt " -"Bucher, with additional help from Irit Katriel and Dennis Sweeney.)" +"(PEP written by Mark Shannon, with ideas inspired by Stefan Brunthaler. " +"See :pep:`659` for more information. Implementation by Mark Shannon and " +"Brandt Bucher, with additional help from Irit Katriel and Dennis Sweeney.)" msgstr "" -"(PEP 由 Mark Shannon 撰寫、概念啟發自 Stefan Brunthaler。詳情請見 :pep:" -"`659`。由 Mark Shannon 和 Brandt Bucher 實作,Irit Katriel 和 Dennis Sweeney " -"亦提供了額外的幫助。)" +"(PEP 由 Mark Shannon 撰寫、概念啟發自 Stefan Brunthaler。詳情請" +"見 :pep:`659`。由 Mark Shannon 和 Brandt Bucher 實作,Irit Katriel 和 Dennis " +"Sweeney 亦提供了額外的幫助。)" #: ../../whatsnew/3.11.rst:1465 msgid "Operation" @@ -2501,9 +2547,9 @@ msgstr "``x * x``" #: ../../whatsnew/3.11.rst:1468 msgid "" -"Binary add, multiply and subtract for common types such as :class:`int`, :" -"class:`float` and :class:`str` take custom fast paths for their underlying " -"types." +"Binary add, multiply and subtract for common types such " +"as :class:`int`, :class:`float` and :class:`str` take custom fast paths for " +"their underlying types." msgstr "" "常見型別如 :class:`int`、:class:`float` 與 :class:`str` 的二元加法、乘法與減" "法,為底層型別採取了特製的快速路徑。" @@ -2526,16 +2572,16 @@ msgstr "``a[i]``" #: ../../whatsnew/3.11.rst:1474 msgid "" -"Subscripting container types such as :class:`list`, :class:`tuple` and :" -"class:`dict` directly index the underlying data structures." +"Subscripting container types such as :class:`list`, :class:`tuple` " +"and :class:`dict` directly index the underlying data structures." msgstr "" "下標容器型別如 :class:`list`、:class:`tuple` 和 :class:`dict` 直接索引底層的" "資料結構。" #: ../../whatsnew/3.11.rst:1478 msgid "" -"Subscripting custom :meth:`~object.__getitem__` is also inlined similar to :" -"ref:`inline-calls`." +"Subscripting custom :meth:`~object.__getitem__` is also inlined similar " +"to :ref:`inline-calls`." msgstr "" "下標自定義 :meth:`~object.__getitem__` 也是行內的,類似於 :ref:`inline-" "calls`。" @@ -2578,8 +2624,8 @@ msgstr "``C(arg)``" #: ../../whatsnew/3.11.rst:1484 msgid "" -"Calls to common builtin (C) functions and types such as :func:`len` and :" -"class:`str` directly call their underlying C version. This avoids going " +"Calls to common builtin (C) functions and types such as :func:`len` " +"and :class:`str` directly call their underlying C version. This avoids going " "through the internal calling convention." msgstr "" "常見內建 (C) 函式和型別的呼叫,例如 :func:`len` 和 :class:`str`,會直接呼叫它" @@ -2717,8 +2763,8 @@ msgstr "" #: ../../whatsnew/3.11.rst:1513 msgid "" "A similar optimization already existed since Python 3.10. 3.11 specializes " -"for more forms. Furthermore, all attribute loads should be sped up by :issue:" -"`45947`." +"for more forms. Furthermore, all attribute loads should be sped up " +"by :issue:`45947`." msgstr "" "類似的最佳化自從 Python 3.10 就存在。3.11 特別處理了更多形式。此外,所有屬性" "載入也被 :issue:`45947` 所加速。" @@ -2734,17 +2780,17 @@ msgid "" "Mark Shannon in :issue:`45340` and :issue:`40116`.)" msgstr "" "物件現在因為使用了惰性建立的物件命名空間所以需要更少的記憶體。它們的命名空間" -"字典現在也更自由地共享鍵。(由 Mark Shannon 於 :issue:`45340` 和 :issue:" -"`40116` 貢獻。 )" +"字典現在也更自由地共享鍵。(由 Mark Shannon 於 :issue:`45340` " +"和 :issue:`40116` 貢獻。 )" #: ../../whatsnew/3.11.rst:1527 msgid "" -"\"Zero-cost\" exceptions are implemented, eliminating the cost of :keyword:" -"`try` statements when no exception is raised. (Contributed by Mark Shannon " -"in :issue:`40222`.)" +"\"Zero-cost\" exceptions are implemented, eliminating the cost " +"of :keyword:`try` statements when no exception is raised. (Contributed by " +"Mark Shannon in :issue:`40222`.)" msgstr "" -"實作了「無代價 (Zero-cost)」的例外,消除了在沒有例外被引發時的 :keyword:" -"`try` 陳述式開銷。(由 Mark Shannon 於 :issue:`40222` 貢獻。)" +"實作了「無代價 (Zero-cost)」的例外,消除了在沒有例外被引發時" +"的 :keyword:`try` 陳述式開銷。(由 Mark Shannon 於 :issue:`40222` 貢獻。)" #: ../../whatsnew/3.11.rst:1531 msgid "" @@ -2760,9 +2806,9 @@ msgid "" ":mod:`re`'s regular expression matching engine has been partially " "refactored, and now uses computed gotos (or \"threaded code\") on supported " "platforms. As a result, Python 3.11 executes the `pyperformance regular " -"expression benchmarks <https://pyperformance.readthedocs.io/benchmarks." -"html#regex-dna>`_ up to 10% faster than Python 3.10. (Contributed by Brandt " -"Bucher in :gh:`91404`.)" +"expression benchmarks <https://pyperformance.readthedocs.io/" +"benchmarks.html#regex-dna>`_ up to 10% faster than Python 3.10. (Contributed " +"by Brandt Bucher in :gh:`91404`.)" msgstr "" ":mod:`re` 的正規表示式比對引擎部分被重構,且現在會有支援的平台上使用 " "computed gotos(或者「執行緒程式碼 (threaded code)」),因此 Python 3.11 在執" @@ -2897,9 +2943,9 @@ msgstr ":opcode:`MAKE_CELL` 被用於建立 :ref:`cell-objects`。" #: ../../whatsnew/3.11.rst:1632 msgid "" -":opcode:`CHECK_EG_MATCH` and :opcode:`!PREP_RERAISE_STAR`, to handle the :" -"ref:`new exception groups and except* <whatsnew311-pep654>` added in :pep:" -"`654`." +":opcode:`CHECK_EG_MATCH` and :opcode:`!PREP_RERAISE_STAR`, to handle " +"the :ref:`new exception groups and except* <whatsnew311-pep654>` added " +"in :pep:`654`." msgstr "" ":opcode:`CHECK_EG_MATCH` 和 :opcode:`!PREP_RERAISE_STAR`,處理 :pep:`654` 所" "加入的\\ :ref:`新增例外群組和 except* <whatsnew311-pep654>`。" @@ -3140,11 +3186,12 @@ msgstr "語言/內建" #: ../../whatsnew/3.11.rst:1720 msgid "" "Chaining :class:`classmethod` descriptors (introduced in :issue:`19072`) is " -"now deprecated. It can no longer be used to wrap other descriptors such as :" -"class:`property`. The core design of this feature was flawed and caused a " -"number of downstream problems. To \"pass-through\" a :class:`classmethod`, " -"consider using the :attr:`!__wrapped__` attribute that was added in Python " -"3.10. (Contributed by Raymond Hettinger in :gh:`89519`.)" +"now deprecated. It can no longer be used to wrap other descriptors such " +"as :class:`property`. The core design of this feature was flawed and caused " +"a number of downstream problems. To \"pass-through\" " +"a :class:`classmethod`, consider using the :attr:`!__wrapped__` attribute " +"that was added in Python 3.10. (Contributed by Raymond Hettinger " +"in :gh:`89519`.)" msgstr "" "鏈接 :class:`classmethod` 描述器(在 :issue:`19072` 中引入)現已棄用。它不能" "再用於包裝其他描述器,例如 :class:`property`。此功能的核心設計存在缺陷,並導" @@ -3156,26 +3203,26 @@ msgstr "" msgid "" "Octal escapes in string and bytes literals with values larger than ``0o377`` " "(255 in decimal) now produce a :exc:`DeprecationWarning`. In a future Python " -"version, they will raise a :exc:`SyntaxWarning` and eventually a :exc:" -"`SyntaxError`. (Contributed by Serhiy Storchaka in :gh:`81548`.)" +"version, they will raise a :exc:`SyntaxWarning` and eventually " +"a :exc:`SyntaxError`. (Contributed by Serhiy Storchaka in :gh:`81548`.)" msgstr "" "值大於 ``0o377``\\(十進位為 255)的字串和位元組文本值 (bytes literal) 中的八" "進位跳脫 (octal escape) 現在會產生 :exc:`DeprecationWarning`。在未來的 " -"Python 版本中,他們將引發一個 :exc:`SyntaxWarning` 並最終引發一個 :exc:" -"`SyntaxError`。(由 Serhiy Storchaka 在 :gh:`81548` 中貢獻。)" +"Python 版本中,他們將引發一個 :exc:`SyntaxWarning` 並最終引發一" +"個 :exc:`SyntaxError`。(由 Serhiy Storchaka 在 :gh:`81548` 中貢獻。)" #: ../../whatsnew/3.11.rst:1734 msgid "" "The delegation of :func:`int` to :meth:`~object.__trunc__` is now " "deprecated. Calling ``int(a)`` when ``type(a)`` implements :meth:`!" "__trunc__` but not :meth:`~object.__int__` or :meth:`~object.__index__` now " -"raises a :exc:`DeprecationWarning`. (Contributed by Zackery Spytz in :issue:" -"`44977`.)" +"raises a :exc:`DeprecationWarning`. (Contributed by Zackery Spytz " +"in :issue:`44977`.)" msgstr "" ":func:`int` 到 :meth:`~object.__trunc__` 的授權 (delegation) 現已棄用。當 " -"``type(a)`` 有實作 :meth:`!__trunc__` 但沒有 :meth:`~object.__int__` 或 :" -"meth:`~object.__index__`,呼叫 ``int(a)`` 現在會引發一個 :exc:" -"`DeprecationWarning`。(由 Zackery Spytz 在 :issue:`44977` 中貢獻。)" +"``type(a)`` 有實作 :meth:`!__trunc__` 但沒有 :meth:`~object.__int__` " +"或 :meth:`~object.__index__`,呼叫 ``int(a)`` 現在會引發一" +"個 :exc:`DeprecationWarning`。(由 Zackery Spytz 在 :issue:`44977` 中貢獻。)" #: ../../whatsnew/3.11.rst:1744 msgid "Modules" @@ -3265,8 +3312,8 @@ msgstr ":mod:`!sunau`" #: ../../whatsnew/3.11.rst:1761 msgid "" -"(Contributed by Brett Cannon in :issue:`47061` and Victor Stinner in :gh:" -"`68966`.)" +"(Contributed by Brett Cannon in :issue:`47061` and Victor Stinner " +"in :gh:`68966`.)" msgstr "" "(由 Brett Cannon 和 Victor Stinner 分別於 :issue:`47061` 與 :gh:`68966` 中所" "貢獻。)" @@ -3283,21 +3330,20 @@ msgstr "" "除。(由 Hugo van Kemenade 於 :issue:`47022` 中貢獻。)" #: ../../whatsnew/3.11.rst:1769 -#, fuzzy msgid "" "The :mod:`!lib2to3` package and ``2to3`` tool are now deprecated and may not " "be able to parse Python 3.10 or newer. See :pep:`617`, introducing the new " "PEG parser, for details. (Contributed by Victor Stinner in :issue:`40360`.)" msgstr "" -":mod:`lib2to3` 套件和 :ref:`2to3 <2to3-reference>` 工具現已棄用,可能無法剖" -"析 Python 3.10 或更新版本。有關詳細資訊請參閱 :pep:`617`,它引入了新的 PEG 剖" -"析器。(由 Victor Stinner 在 :issue:`40360` 中貢獻。)" +":mod:!lib2to3` 套件和 ``2to3`` 工具現已棄用,可能無法剖析 Python 3.10 或更新" +"版本。有關詳細資訊請參閱 :pep:`617`,它引入了新的 PEG 剖析器。(由 Victor " +"Stinner 在 :issue:`40360` 中貢獻。)" #: ../../whatsnew/3.11.rst:1774 msgid "" "Undocumented modules :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!" -"sre_parse` are now deprecated. (Contributed by Serhiy Storchaka in :issue:" -"`47152`.)" +"sre_parse` are now deprecated. (Contributed by Serhiy Storchaka " +"in :issue:`47152`.)" msgstr "" "未被記錄於文件中的 :mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!" "sre_parse` 模組現在已被棄用。(由 Serhiy Storchaka 在 :issue:`47152` 中貢" @@ -3337,15 +3383,16 @@ msgid "" ":class:`!configparser.LegacyInterpolation` has been deprecated in the " "docstring since Python 3.2, and is not listed in the :mod:`configparser` " "documentation. It now emits a :exc:`DeprecationWarning` and will be removed " -"in Python 3.13. Use :class:`configparser.BasicInterpolation` or :class:" -"`configparser.ExtendedInterpolation` instead. (Contributed by Hugo van " -"Kemenade in :issue:`46607`.)" +"in Python 3.13. Use :class:`configparser.BasicInterpolation` " +"or :class:`configparser.ExtendedInterpolation` instead. (Contributed by Hugo " +"van Kemenade in :issue:`46607`.)" msgstr "" ":class:`!configparser.LegacyInterpolation` 自 Python 3.2 起已在文件字串中棄" -"用,並且未在 :mod:`configparser` 文件中列出。它現在會發出一個 :exc:" -"`DeprecationWarning` 並將在 Python 3.13 中刪除。請改用 :class:`configparser." -"BasicInterpolation` 或 :class:`configparser.ExtendedInterpolation`。(由 " -"Hugo van Kemenade 在 :issue:`46607` 中貢獻。)" +"用,並且未在 :mod:`configparser` 文件中列出。它現在會發出一" +"個 :exc:`DeprecationWarning` 並將在 Python 3.13 中刪除。請改" +"用 :class:`configparser.BasicInterpolation` " +"或 :class:`configparser.ExtendedInterpolation`。(由 Hugo van Kemenade " +"在 :issue:`46607` 中貢獻。)" #: ../../whatsnew/3.11.rst:1801 msgid "" @@ -3389,9 +3436,10 @@ msgstr ":func:`!importlib.resources.path`" #: ../../whatsnew/3.11.rst:1814 msgid "" "The :func:`locale.getdefaultlocale` function is deprecated and will be " -"removed in Python 3.15. Use :func:`locale.setlocale`, :func:`locale." -"getpreferredencoding(False) <locale.getpreferredencoding>` and :func:`locale." -"getlocale` functions instead. (Contributed by Victor Stinner in :gh:`90817`.)" +"removed in Python 3.15. " +"Use :func:`locale.setlocale`, :func:`locale.getpreferredencoding(False) " +"<locale.getpreferredencoding>` and :func:`locale.getlocale` functions " +"instead. (Contributed by Victor Stinner in :gh:`90817`.)" msgstr "" ":func:`locale.getdefaultlocale` 函式已被棄用且將於 Python 3.15 中移除。請改" "用 :func:`locale.setlocale`、:func:`locale.getpreferredencoding(False) " @@ -3399,25 +3447,24 @@ msgstr "" "於 :gh:`90817` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1820 -#, fuzzy msgid "" "The :func:`!locale.resetlocale` function is deprecated and will be removed " "in Python 3.13. Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. " "(Contributed by Victor Stinner in :gh:`90817`.)" msgstr "" -":func:`locale.resetlocale` 函式已棄用並將於 Python 3.13 中移除,請改用 " -"``locale.setlocale(locale.LC_ALL, \"\")``。(由 Victor Stinner 於 :gh:" -"`90817` 中所貢獻。)" +":func:`!locale.resetlocale` 函式已棄用並將於 Python 3.13 中移除,請改用 " +"``locale.setlocale(locale.LC_ALL, \"\")``。(由 Victor Stinner " +"於 :gh:`90817` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1824 msgid "" "Stricter rules will now be applied for numerical group references and group " "names in :ref:`regular expressions <re-syntax>`. Only sequences of ASCII " -"digits will now be accepted as a numerical reference, and the group name in :" -"class:`bytes` patterns and replacement strings can only contain ASCII " +"digits will now be accepted as a numerical reference, and the group name " +"in :class:`bytes` patterns and replacement strings can only contain ASCII " "letters, digits and underscores. For now, a deprecation warning is raised " -"for syntax violating these rules. (Contributed by Serhiy Storchaka in :gh:" -"`91760`.)" +"for syntax violating these rules. (Contributed by Serhiy Storchaka " +"in :gh:`91760`.)" msgstr "" "現在將對\\ :ref:`規則運算式 <re-syntax>`\\ 中的數值群組參照 (numerical group " "references) 和群組名稱套用更嚴格的規則。現在只接受 ASCII 數字序列作為數值參" @@ -3435,22 +3482,21 @@ msgid "" msgstr "" "在 :mod:`re` 模組中,:func:`!re.template` 函式和相應的 :const:`!re.TEMPLATE` " "和 :const:`!re.T` 旗標被棄用,因為它們沒被記錄於文件中並且缺乏明顯的目的。它" -"們將在 Python 3.13 中被刪除。(由 Serhiy Storchaka 和 Miro Hrončok 在 :gh:" -"`92728` 中貢獻。)" +"們將在 Python 3.13 中被刪除。(由 Serhiy Storchaka 和 Miro Hrončok " +"在 :gh:`92728` 中貢獻。)" #: ../../whatsnew/3.11.rst:1838 -#, fuzzy msgid "" ":func:`!turtle.settiltangle` has been deprecated since Python 3.1; it now " -"emits a deprecation warning and will be removed in Python 3.13. Use :func:" -"`turtle.tiltangle` instead (it was earlier incorrectly marked as deprecated, " -"and its docstring is now corrected). (Contributed by Hugo van Kemenade in :" -"issue:`45837`.)" +"emits a deprecation warning and will be removed in Python 3.13. " +"Use :func:`turtle.tiltangle` instead (it was earlier incorrectly marked as " +"deprecated, and its docstring is now corrected). (Contributed by Hugo van " +"Kemenade in :issue:`45837`.)" msgstr "" -":func:`turtle.settiltangle` 自 Python 3.1 以來已被棄用;它現在會發出棄用警" +":func:`!turtle.settiltangle` 自 Python 3.1 以來已被棄用;它現在會發出棄用警" "告,並將在 Python 3.13 中刪除。請改用 :func:`turtle.tiltangle`\\ (它之前被錯" -"誤地標記為已棄用,其文件字串現在已更正)。(由 Hugo van Kemenade 在 :issue:" -"`45837` 中貢獻。)" +"誤地標記為已棄用,其文件字串現在已更正)。(由 Hugo van Kemenade " +"在 :issue:`45837` 中貢獻。)" #: ../../whatsnew/3.11.rst:1844 msgid "" @@ -3479,18 +3525,18 @@ msgid "" "itself. (Contributed by Donghee Na in :issue:`42255`.)" msgstr "" ":class:`!webbrowser.MacOSX` 已被棄用且將於 Python 3.13 中移除。它並沒有被測試" -"過、沒紀錄於文件、也沒有被 :mod:`webbrowser` 本身使用。(由 Donghee Na 於 :" -"issue:`42255`。)" +"過、沒紀錄於文件、也沒有被 :mod:`webbrowser` 本身使用。(由 Donghee Na " +"於 :issue:`42255`。)" #: ../../whatsnew/3.11.rst:1858 msgid "" -"The behavior of returning a value from a :class:`~unittest.TestCase` and :" -"class:`~unittest.IsolatedAsyncioTestCase` test methods (other than the " +"The behavior of returning a value from a :class:`~unittest.TestCase` " +"and :class:`~unittest.IsolatedAsyncioTestCase` test methods (other than the " "default ``None`` value) is now deprecated." msgstr "" -"回傳從 :class:`~unittest.TestCase` 和 :class:`~unittest." -"IsolatedAsyncioTestCase` 測試方法(預設的 ``None`` 值除外)給定值的行為現已棄" -"用。" +"回傳從 :class:`~unittest.TestCase` " +"和 :class:`~unittest.IsolatedAsyncioTestCase` 測試方法(預設的 ``None`` 值除" +"外)給定值的行為現已棄用。" #: ../../whatsnew/3.11.rst:1862 msgid "" @@ -3824,15 +3870,16 @@ msgstr "被移除的 C API 被\\ :ref:`獨立列出 <whatsnew311-c-api-removed>` #: ../../whatsnew/3.11.rst:1955 msgid "" "Removed the :func:`!@asyncio.coroutine` :term:`decorator` enabling legacy " -"generator-based coroutines to be compatible with :keyword:`async` / :keyword:" -"`await` code. The function has been deprecated since Python 3.8 and the " -"removal was initially scheduled for Python 3.10. Use :keyword:`async def` " -"instead. (Contributed by Illia Volochii in :issue:`43216`.)" +"generator-based coroutines to be compatible " +"with :keyword:`async` / :keyword:`await` code. The function has been " +"deprecated since Python 3.8 and the removal was initially scheduled for " +"Python 3.10. Use :keyword:`async def` instead. (Contributed by Illia " +"Volochii in :issue:`43216`.)" msgstr "" "刪除了 :func:`!@asyncio.coroutine` :term:`decorator` 使遺留的基於生成器的協" "程 (generator-based coroutine) 與 :keyword:`async` / :keyword:`await` 程式碼" -"相容。該函式自 Python 3.8 起已被棄用,計劃於 Python 3.10 刪除。請改用 :" -"keyword:`async def`。(由 Illia Volochii 在 :issue:`43216` 中貢獻。)" +"相容。該函式自 Python 3.8 起已被棄用,計劃於 Python 3.10 刪除。請改" +"用 :keyword:`async def`。(由 Illia Volochii 在 :issue:`43216` 中貢獻。)" #: ../../whatsnew/3.11.rst:1962 msgid "" @@ -3840,29 +3887,30 @@ msgid "" "generator-based coroutine objects in the debug mode. (Contributed by Illia " "Volochii in :issue:`43216`.)" msgstr "" -"移除除錯模式中用於包裝遺留基於產生器之協程物件的 :class:`!asyncio.coroutines." -"CoroWrapper`。(由 Illia Volochii 於 :issue:`43216` 中貢獻。)" +"移除除錯模式中用於包裝遺留基於產生器之協程物件的 :class:`!" +"asyncio.coroutines.CoroWrapper`。(由 Illia Volochii 於 :issue:`43216` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:1966 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint`, disabled in Python 3.9, is now " -"entirely removed. This is because of the behavior of the socket option " -"``SO_REUSEADDR`` in UDP. (Contributed by Hugo van Kemenade in :issue:" -"`45129`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint`, disabled in Python 3.9, is " +"now entirely removed. This is because of the behavior of the socket option " +"``SO_REUSEADDR`` in UDP. (Contributed by Hugo van Kemenade " +"in :issue:`45129`.)" msgstr "" -"因為有重大的安全性考量,Python 3.9 中停用的 :meth:`asyncio.loop." -"create_datagram_endpoint` 之 *reuse_address* 參數目前已經移除。這是因為 UDP " -"socket 選項 ``SO_REUSEADDR`` 的行為所致。(由 Hugo van Kemenade 於 :issue:" -"`45129` 中貢獻。)" +"因為有重大的安全性考量,Python 3.9 中停用" +"的 :meth:`asyncio.loop.create_datagram_endpoint` 之 *reuse_address* 參數目前" +"已經移除。這是因為 UDP socket 選項 ``SO_REUSEADDR`` 的行為所致。(由 Hugo " +"van Kemenade 於 :issue:`45129` 中貢獻。)" #: ../../whatsnew/3.11.rst:1972 msgid "" "Removed the :mod:`!binhex` module, deprecated in Python 3.9. Also removed " "the related, similarly-deprecated :mod:`binascii` functions:" msgstr "" -"移除 Python 3.9 中棄用的 :mod:`!binhex` 模組,與其相關且相似的 :mod:" -"`binascii` 函式也一併被移除:" +"移除 Python 3.9 中棄用的 :mod:`!binhex` 模組,與其相關且相似" +"的 :mod:`binascii` 函式也一併被移除:" #: ../../whatsnew/3.11.rst:1975 msgid ":func:`!binascii.a2b_hqx`" @@ -3900,32 +3948,34 @@ msgstr "" #: ../../whatsnew/3.11.rst:1988 msgid "" -"Removed the :meth:`~object.__getitem__` methods of :class:`xml.dom.pulldom." -"DOMEventStream`, :class:`wsgiref.util.FileWrapper` and :class:`fileinput." -"FileInput`, deprecated since Python 3.9. (Contributed by Hugo van Kemenade " -"in :issue:`45132`.)" +"Removed the :meth:`~object.__getitem__` methods " +"of :class:`xml.dom.pulldom.DOMEventStream`, :class:`wsgiref.util.FileWrapper` " +"and :class:`fileinput.FileInput`, deprecated since Python 3.9. (Contributed " +"by Hugo van Kemenade in :issue:`45132`.)" msgstr "" -"將 :class:`xml.dom.pulldom.DOMEventStream`、:class:`wsgiref.util." -"FileWrapper` 和 :class:`fileinput.FileInput` 自 Python 3.9 中棄用的 :meth:" -"`~object.__getitem__` 方法移除。(由 Hugo van Kemenade 在 :issue:`45132` 中貢" -"獻。)" +"將 :class:`xml.dom.pulldom.DOMEventStream`、:class:`wsgiref.util.FileWrapper` " +"和 :class:`fileinput.FileInput` 自 Python 3.9 中棄用" +"的 :meth:`~object.__getitem__` 方法移除。(由 Hugo van Kemenade " +"在 :issue:`45132` 中貢獻。)" #: ../../whatsnew/3.11.rst:1993 msgid "" "Removed the deprecated :mod:`gettext` functions :func:`!lgettext`, :func:`!" -"ldgettext`, :func:`!lngettext` and :func:`!ldngettext`. Also removed the :" -"func:`!bind_textdomain_codeset` function, the :meth:`!NullTranslations." -"output_charset` and :meth:`!NullTranslations.set_output_charset` methods, " -"and the *codeset* parameter of :func:`!translation` and :func:`!install`, " -"since they are only used for the :func:`!l*gettext` functions. (Contributed " -"by Donghee Na and Serhiy Storchaka in :issue:`44235`.)" -msgstr "" -"刪除了已棄用的 :mod:`gettext` 函式 :func:`!lgettext`、:func:`!ldgettext`、:" -"func:`!lngettext` 和 :func:`!ldngettext`,也刪除了 :func:`!" -"bind_textdomain_codeset` 函式、:meth:`!NullTranslations.output_charset` 和 :" -"meth:`!NullTranslations.set_output_charset` 方法,以及 :func:`!translation` " -"和 :func:`!install` 的 *codeset* 參數,因為它們僅被用於 :func:`!l*gettext` 函" -"式。(由 Donghee Na 和 Serhiy Storchaka 在 :issue:`44235` 中貢獻。)" +"ldgettext`, :func:`!lngettext` and :func:`!ldngettext`. Also removed " +"the :func:`!bind_textdomain_codeset` function, the :meth:`!" +"NullTranslations.output_charset` and :meth:`!" +"NullTranslations.set_output_charset` methods, and the *codeset* parameter " +"of :func:`!translation` and :func:`!install`, since they are only used for " +"the :func:`!l*gettext` functions. (Contributed by Donghee Na and Serhiy " +"Storchaka in :issue:`44235`.)" +msgstr "" +"刪除了已棄用的 :mod:`gettext` 函式 :func:`!lgettext`、:func:`!" +"ldgettext`、:func:`!lngettext` 和 :func:`!ldngettext`,也刪除了 :func:`!" +"bind_textdomain_codeset` 函式、:meth:`!NullTranslations.output_charset` " +"和 :meth:`!NullTranslations.set_output_charset` 方法,以及 :func:`!" +"translation` 和 :func:`!install` 的 *codeset* 參數,因為它們僅被用於 :func:`!" +"l*gettext` 函式。(由 Donghee Na 和 Serhiy Storchaka 在 :issue:`44235` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:2003 msgid "Removed from the :mod:`inspect` module:" @@ -3933,30 +3983,31 @@ msgstr "於 :mod:`inspect` 模組中移除:" #: ../../whatsnew/3.11.rst:2005 msgid "" -"The :func:`!getargspec` function, deprecated since Python 3.0; use :func:" -"`inspect.signature` or :func:`inspect.getfullargspec` instead." +"The :func:`!getargspec` function, deprecated since Python 3.0; " +"use :func:`inspect.signature` or :func:`inspect.getfullargspec` instead." msgstr "" -"Python 3.0 中棄用的 :func:`!getargspec`;改用 :func:`inspect.signature` 或 :" -"func:`inspect.getfullargspec`。" +"Python 3.0 中棄用的 :func:`!getargspec`;改用 :func:`inspect.signature` " +"或 :func:`inspect.getfullargspec`。" #: ../../whatsnew/3.11.rst:2008 msgid "" -"The :func:`!formatargspec` function, deprecated since Python 3.5; use the :" -"func:`inspect.signature` function or the :class:`inspect.Signature` object " -"directly." +"The :func:`!formatargspec` function, deprecated since Python 3.5; use " +"the :func:`inspect.signature` function or the :class:`inspect.Signature` " +"object directly." msgstr "" -"Python 3.5 中棄用的 :func:`!formatargspec` 函式;請直接用 :func:`inspect." -"signature` 函式或 :class:`inspect.Signature` 物件。" +"Python 3.5 中棄用的 :func:`!formatargspec` 函式;請直接" +"用 :func:`inspect.signature` 函式或 :class:`inspect.Signature` 物件。" #: ../../whatsnew/3.11.rst:2012 msgid "" -"The undocumented :meth:`!Signature.from_builtin` and :meth:`!Signature." -"from_function` methods, deprecated since Python 3.5; use the :meth:" -"`Signature.from_callable() <inspect.Signature.from_callable>` method instead." +"The undocumented :meth:`!Signature.from_builtin` and :meth:`!" +"Signature.from_function` methods, deprecated since Python 3.5; use " +"the :meth:`Signature.from_callable() <inspect.Signature.from_callable>` " +"method instead." msgstr "" -"Python 3.5 中停用且沒有被紀錄於文件上的 :meth:`!Signature.from_builtin` 和 :" -"meth:`!Signature.from_function` 方法;改用 :meth:`Signature.from_callable() " -"<inspect.Signature.from_callable>` 方法。" +"Python 3.5 中停用且沒有被紀錄於文件上的 :meth:`!Signature.from_builtin` " +"和 :meth:`!Signature.from_function` 方法;改" +"用 :meth:`Signature.from_callable() <inspect.Signature.from_callable>` 方法。" #: ../../whatsnew/3.11.rst:2017 msgid "(Contributed by Hugo van Kemenade in :issue:`45320`.)" @@ -3964,9 +4015,9 @@ msgstr "(由 Hugo van Kemenade 於 :issue:`45320` 中所貢獻。)" #: ../../whatsnew/3.11.rst:2019 msgid "" -"Removed the :meth:`~object.__class_getitem__` method from :class:`pathlib." -"PurePath`, because it was not used and added by mistake in previous " -"versions. (Contributed by Nikita Sobolev in :issue:`46483`.)" +"Removed the :meth:`~object.__class_getitem__` method " +"from :class:`pathlib.PurePath`, because it was not used and added by mistake " +"in previous versions. (Contributed by Nikita Sobolev in :issue:`46483`.)" msgstr "" "自 :class:`pathlib.PurePath` 中移除 :meth:`~object.__class_getitem__` 方法," "因為它是前一版本中誤加且沒被使用。(由 Nikita Sobolev 於 :issue:`46483` 中所" @@ -3983,8 +4034,8 @@ msgstr "" #: ../../whatsnew/3.11.rst:2028 msgid "" -"Removed the deprecated :meth:`!split` method of :class:`!_tkinter." -"TkappType`. (Contributed by Erlend E. Aasland in :issue:`38371`.)" +"Removed the deprecated :meth:`!split` method of :class:`!" +"_tkinter.TkappType`. (Contributed by Erlend E. Aasland in :issue:`38371`.)" msgstr "" "移除 :class:`!_tkinter.TkappType` 已被棄用的 :meth:`!split` 方法。(由 " "Erlend E. Aasland 於 :issue:`38371` 貢獻。)" @@ -4017,8 +4068,8 @@ msgid "" "corresponding :c:macro:`!EXPERIMENTAL_ISOLATED_SUBINTERPRETERS` macro) have " "been removed." msgstr "" -"移除 :option:`!--experimental-isolated-subinterpreters` 配置旗標(與對應的 :" -"c:macro:`!EXPERIMENTAL_ISOLATED_SUBINTERPRETERS` 巨集)。" +"移除 :option:`!--experimental-isolated-subinterpreters` 配置旗標(與對應" +"的 :c:macro:`!EXPERIMENTAL_ISOLATED_SUBINTERPRETERS` 巨集)。" #: ../../whatsnew/3.11.rst:2045 msgid "" @@ -4050,31 +4101,31 @@ msgstr "C API 的移植被\\ :ref:`獨立列出 <whatsnew311-c-api-porting>`。" #: ../../whatsnew/3.11.rst:2063 msgid "" -":func:`open`, :func:`io.open`, :func:`codecs.open` and :class:`fileinput." -"FileInput` no longer accept ``'U'`` (\"universal newline\") in the file " -"mode. In Python 3, \"universal newline\" mode is used by default whenever a " -"file is opened in text mode, and the ``'U'`` flag has been deprecated since " -"Python 3.3. The :ref:`newline parameter <open-newline-parameter>` to these " -"functions controls how universal newlines work. (Contributed by Victor " -"Stinner in :issue:`37330`.)" -msgstr "" -":func:`open`、:func:`io.open`、:func:`codecs.open` 和 :class:`fileinput." -"FileInput` 不再接受 ``'U'``\\ (\"universal newline\",通用換行符)文件模式。" -"在 Python 3 中,每當以文本模式 (text mode) 打開檔案時,預設情況下會使用「通用" -"換行符」模式,並且自 Python 3.3 以來就不推薦使用 ``'U'`` 旗標。這些函式的 :" -"ref:`newline 參數 <open-newline-parameter>`\\ 控制了通用換行符的作用方式。" -"(由 Victor Stinner 在 :issue:`37330` 中貢獻。)" +":func:`open`, :func:`io.open`, :func:`codecs.open` " +"and :class:`fileinput.FileInput` no longer accept ``'U'`` (\"universal " +"newline\") in the file mode. In Python 3, \"universal newline\" mode is used " +"by default whenever a file is opened in text mode, and the ``'U'`` flag has " +"been deprecated since Python 3.3. The :ref:`newline parameter <open-newline-" +"parameter>` to these functions controls how universal newlines work. " +"(Contributed by Victor Stinner in :issue:`37330`.)" +msgstr "" +":func:`open`、:func:`io.open`、:func:`codecs.open` " +"和 :class:`fileinput.FileInput` 不再接受 ``'U'``\\ (\"universal newline\"," +"通用換行符)文件模式。在 Python 3 中,每當以文本模式 (text mode) 打開檔案時," +"預設情況下會使用「通用換行符」模式,並且自 Python 3.3 以來就不推薦使用 " +"``'U'`` 旗標。這些函式的 :ref:`newline 參數 <open-newline-parameter>`\\ 控制" +"了通用換行符的作用方式。(由 Victor Stinner 在 :issue:`37330` 中貢獻。)" #: ../../whatsnew/3.11.rst:2072 msgid "" -":class:`ast.AST` node positions are now validated when provided to :func:" -"`compile` and other related functions. If invalid positions are detected, a :" -"exc:`ValueError` will be raised. (Contributed by Pablo Galindo in :gh:" -"`93351`)" +":class:`ast.AST` node positions are now validated when provided " +"to :func:`compile` and other related functions. If invalid positions are " +"detected, a :exc:`ValueError` will be raised. (Contributed by Pablo Galindo " +"in :gh:`93351`)" msgstr "" ":class:`ast.AST` 節點位置現在會在提供給 :func:`compile` 和其他相關函式時被驗" -"證。如果檢測到無效位置,則會引發 :exc:`ValueError`。(由 Pablo Galindo 在 :" -"gh:`93351` 中貢獻)" +"證。如果檢測到無效位置,則會引發 :exc:`ValueError`。(由 Pablo Galindo " +"在 :gh:`93351` 中貢獻)" #: ../../whatsnew/3.11.rst:2076 msgid "" @@ -4082,21 +4133,23 @@ msgid "" "executors to :meth:`asyncio.loop.set_default_executor` following a " "deprecation in Python 3.8. (Contributed by Illia Volochii in :issue:`43234`.)" msgstr "" -"在 Python 3.8 中棄用後,禁止將非 :class:`concurrent.futures." -"ThreadPoolExecutor` 執行器傳遞給 :meth:`asyncio.loop.set_default_executor`。" -"(由 Illia Volochii 在 :issue:`43234` 中貢獻。)" +"在 Python 3.8 中棄用後,禁止將" +"非 :class:`concurrent.futures.ThreadPoolExecutor` 執行器傳遞" +"給 :meth:`asyncio.loop.set_default_executor`。(由 Illia Volochii " +"在 :issue:`43234` 中貢獻。)" #: ../../whatsnew/3.11.rst:2081 msgid "" -":mod:`calendar`: The :class:`calendar.LocaleTextCalendar` and :class:" -"`calendar.LocaleHTMLCalendar` classes now use :func:`locale.getlocale`, " -"instead of using :func:`locale.getdefaultlocale`, if no locale is specified. " +":mod:`calendar`: The :class:`calendar.LocaleTextCalendar` " +"and :class:`calendar.LocaleHTMLCalendar` classes now " +"use :func:`locale.getlocale`, instead of " +"using :func:`locale.getdefaultlocale`, if no locale is specified. " "(Contributed by Victor Stinner in :issue:`46659`.)" msgstr "" -":mod:`calendar`::class:`calendar.LocaleTextCalendar` 和 :class:`calendar." -"LocaleHTMLCalendar` 類別如果沒有指定語言環境,現在會使用 :func:`locale." -"getlocale` 而非 :func:`locale.getdefaultlocale`。(由 Victor Stinner 在 :" -"issue:`46659` 中貢獻。)" +":mod:`calendar`::class:`calendar.LocaleTextCalendar` " +"和 :class:`calendar.LocaleHTMLCalendar` 類別如果沒有指定語言環境,現在會使" +"用 :func:`locale.getlocale` 而非 :func:`locale.getdefaultlocale`。(由 " +"Victor Stinner 在 :issue:`46659` 中貢獻。)" #: ../../whatsnew/3.11.rst:2087 msgid "" @@ -4111,19 +4164,20 @@ msgstr "" msgid "" "The *population* parameter of :func:`random.sample` must be a sequence, and " "automatic conversion of :class:`set`\\s to :class:`list`\\s is no longer " -"supported. Also, if the sample size is larger than the population size, a :" -"exc:`ValueError` is raised. (Contributed by Raymond Hettinger in :issue:" -"`40465`.)" +"supported. Also, if the sample size is larger than the population size, " +"a :exc:`ValueError` is raised. (Contributed by Raymond Hettinger " +"in :issue:`40465`.)" msgstr "" -":func:`random.sample` 的 *population* 參數必須是一個序列,不再支援 :class:" -"`set` 到 :class:`list` 的自動轉換。此外,如果抽樣大小大於總體大小,則會引發 :" -"exc:`ValueError`。(由 Raymond Hettinger 在 :issue:`40465` 中貢獻。)" +":func:`random.sample` 的 *population* 參數必須是一個序列,不再支" +"援 :class:`set` 到 :class:`list` 的自動轉換。此外,如果抽樣大小大於總體大小," +"則會引發 :exc:`ValueError`。(由 Raymond Hettinger 在 :issue:`40465` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:2097 msgid "" "The *random* optional parameter of :func:`random.shuffle` was removed. It " -"was previously an arbitrary random function to use for the shuffle; now, :" -"func:`random.random` (its previous default) will always be used." +"was previously an arbitrary random function to use for the shuffle; " +"now, :func:`random.random` (its previous default) will always be used." msgstr "" "刪除了 :func:`random.shuffle` 的 *random* 可選參數。它以前是用於隨機排列 " "(shuffle) 的任意隨機函式;現在都會使用 :func:`random.random`\\ (這是它以前的" @@ -4133,8 +4187,8 @@ msgstr "" msgid "" "In :mod:`re` :ref:`re-syntax`, global inline flags (e.g. ``(?i)``) can now " "only be used at the start of regular expressions. Using them elsewhere has " -"been deprecated since Python 3.6. (Contributed by Serhiy Storchaka in :issue:" -"`47066`.)" +"been deprecated since Python 3.6. (Contributed by Serhiy Storchaka " +"in :issue:`47066`.)" msgstr "" "在 :mod:`re` :ref:`re-syntax` 中,全域行內旗標(例如 ``(?i)``)現在只能在規則" "運算式的開頭使用。自 Python 3.6 以來,在其他地方使用它們已被棄用。(由 " @@ -4166,8 +4220,8 @@ msgid "" "limited subset of POSIX APIs; Python standard libraries features and modules " "related to networking, processes, threading, signals, mmap, and users/groups " "are not available or don't work. (Emscripten contributed by Christian Heimes " -"and Ethan Smith in :gh:`84461` and WASI contributed by Christian Heimes in :" -"gh:`90473`; platforms promoted in :gh:`95085`)" +"and Ethan Smith in :gh:`84461` and WASI contributed by Christian Heimes " +"in :gh:`90473`; platforms promoted in :gh:`95085`)" msgstr "" "CPython 現在有 :pep:`11` :pep:`Tier 3 支援 <11#tier-3>` 以用於交叉編譯至 " "`WebAssembly <https://webassembly.org/>`_ 平台 `Emscripten <https://" @@ -4188,8 +4242,8 @@ msgid "" "A `C11 <https://en.cppreference.com/w/c/11>`_ compiler and standard library. " "`Optional C11 features <https://en.wikipedia.org/wiki/" "C11_(C_standard_revision)#Optional_features>`_ are not required. " -"(Contributed by Victor Stinner in :issue:`46656`, :issue:`45440` and :issue:" -"`46640`.)" +"(Contributed by Victor Stinner in :issue:`46656`, :issue:`45440` " +"and :issue:`46640`.)" msgstr "" "`C11 <https://en.cppreference.com/w/c/11>`_ 編譯器與標準函式庫。`可選的 C11 " "特性 <https://en.wikipedia.org/wiki/" @@ -4229,16 +4283,16 @@ msgid "" "detected by `pkg-config <https://www.freedesktop.org/wiki/Software/pkg-" "config/>`_ (when available). :mod:`tkinter` now requires a pkg-config " "command to detect development settings for `Tcl/Tk`_ headers and libraries. " -"(Contributed by Christian Heimes and Erlend Egeberg Aasland in :issue:" -"`45847`, :issue:`45747`, and :issue:`45763`.)" +"(Contributed by Christian Heimes and Erlend Egeberg Aasland " +"in :issue:`45847`, :issue:`45747`, and :issue:`45763`.)" msgstr "" "大多數 stdlib 擴充模組的依賴套件、編譯器旗標 (compiler flag) 和鏈接器旗標 " "(linker flags) 現在可以透過 :program:`configure` 檢測出來。(當可用時)\\ " "`pkg-config <https://www.freedesktop.org/wiki/Software/pkg-config/>`_ 會檢測" "出 libffi、libnsl、libsqlite3、zlib、bzip2、liblzma、libcrypt、Tcl/Tk 和 " "uuid 旗標。:mod:`tkinter` 現在需要一個 pkg-config 命令來檢測 `Tcl/Tk`_ 標頭檔" -"和函式庫的開發設定。(由 Christian Heimes 和 Erlend Egeberg Aasland 在 :" -"issue:`45847`、:issue:`45747` 和 :issue:`45763` 中貢獻。)" +"和函式庫的開發設定。(由 Christian Heimes 和 Erlend Egeberg Aasland " +"在 :issue:`45847`、:issue:`45747` 和 :issue:`45763` 中貢獻。)" #: ../../whatsnew/3.11.rst:2162 msgid "" @@ -4251,20 +4305,20 @@ msgstr "" msgid "" "CPython can now be built with the `ThinLTO <https://clang.llvm.org/docs/" "ThinLTO.html>`_ option via passing ``thin`` to :option:`--with-lto`, i.e. " -"``--with-lto=thin``. (Contributed by Donghee Na and Brett Holman in :issue:" -"`44340`.)" +"``--with-lto=thin``. (Contributed by Donghee Na and Brett Holman " +"in :issue:`44340`.)" msgstr "" "CPython 現在可以透過將 ``thin`` 傳遞給 :option:`--with-lto`\\ (也就是 ``--" -"with-lto=thin``\\ )來以 `ThinLTO <https://clang.llvm.org/docs/ThinLTO." -"html>`_ 選項建置。(由 Donghee Na 與 Brett Holman 於 :issue:`44340` 中所貢" -"獻。)" +"with-lto=thin``\\ )來以 `ThinLTO <https://clang.llvm.org/docs/" +"ThinLTO.html>`_ 選項建置。(由 Donghee Na 與 Brett Holman 於 :issue:`44340` " +"中所貢獻。)" #: ../../whatsnew/3.11.rst:2170 msgid "" "Freelists for object structs can now be disabled. A new :program:`configure` " "option :option:`--without-freelists` can be used to disable all freelists " -"except empty tuple singleton. (Contributed by Christian Heimes in :issue:" -"`45522`.)" +"except empty tuple singleton. (Contributed by Christian Heimes " +"in :issue:`45522`.)" msgstr "" #: ../../whatsnew/3.11.rst:2175 @@ -4272,13 +4326,14 @@ msgid "" "``Modules/Setup`` and ``Modules/makesetup`` have been improved and tied up. " "Extension modules can now be built through ``makesetup``. All except some " "test modules can be linked statically into a main binary or library. " -"(Contributed by Brett Cannon and Christian Heimes in :issue:`45548`, :issue:" -"`45570`, :issue:`45571`, and :issue:`43974`.)" +"(Contributed by Brett Cannon and Christian Heimes " +"in :issue:`45548`, :issue:`45570`, :issue:`45571`, and :issue:`43974`.)" msgstr "" "``Modules/Setup`` 和 ``Modules/makesetup`` 已得到改進和綁定。現在可以通過 " "``makesetup`` 建置擴充模組。除了一些測試模組外,所有模組都可以靜態鏈接到主要" -"的二進制文件或函式庫中。(由 Brett Cannon 和 Christian Heimes 在 :issue:" -"`45548`、:issue:`45570`、:issue:`45571` 和 :issue:`43974` 中貢獻。)" +"的二進制文件或函式庫中。(由 Brett Cannon 和 Christian Heimes " +"在 :issue:`45548`、:issue:`45570`、:issue:`45571` 和 :issue:`43974` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:2182 msgid "" @@ -4299,20 +4354,20 @@ msgid "" "build Python with RHEL 7's and CentOS 7's Tcl/Tk and OpenSSL." msgstr "" "RHEL 7 和 CentOS 7 上的開發套件並無提供 ``tcl.pc`` 和 ``tk.pc``;要使用 " -"``TCLTK_LIBS=\"-ltk8.5 -ltkstub8.5 -ltcl8.5\"``。目錄 ``Misc/rhel7`` 包含 ``." -"pc`` 檔案與如何使用 RHEL 7 和 CentOS 7 的 Tcl/Tk 與 OpenSSL 建置 Python 的指" -"示。" +"``TCLTK_LIBS=\"-ltk8.5 -ltkstub8.5 -ltcl8.5\"``。目錄 ``Misc/rhel7`` 包含 " +"``.pc`` 檔案與如何使用 RHEL 7 和 CentOS 7 的 Tcl/Tk 與 OpenSSL 建置 Python 的" +"指示。" #: ../../whatsnew/3.11.rst:2193 msgid "" "CPython will now use 30-bit digits by default for the Python :class:`int` " "implementation. Previously, the default was to use 30-bit digits on " "platforms with ``SIZEOF_VOID_P >= 8``, and 15-bit digits otherwise. It's " -"still possible to explicitly request use of 15-bit digits via either the :" -"option:`--enable-big-digits` option to the configure script or (for Windows) " -"the ``PYLONG_BITS_IN_DIGIT`` variable in ``PC/pyconfig.h``, but this option " -"may be removed at some point in the future. (Contributed by Mark Dickinson " -"in :issue:`45569`.)" +"still possible to explicitly request use of 15-bit digits via either " +"the :option:`--enable-big-digits` option to the configure script or (for " +"Windows) the ``PYLONG_BITS_IN_DIGIT`` variable in ``PC/pyconfig.h``, but " +"this option may be removed at some point in the future. (Contributed by Mark " +"Dickinson in :issue:`45569`.)" msgstr "" "CPython 現在預設使用 30-bit 數字來實作 Python :class:`int`。以前,在 " "``SIZEOF_VOID_P >= 8`` 的平台上預設使用 30-bit 數字,否則使用 15-bit 數字,但" @@ -4330,8 +4385,8 @@ msgid "" "Add a new :c:func:`PyType_GetName` function to get type's short name. " "(Contributed by Hai Shi in :issue:`42035`.)" msgstr "" -"新增 :c:func:`PyType_GetName` 函式來取得型別的短名。(由 Hai Shi 於 :issue:" -"`42035` 中所貢獻。)" +"新增 :c:func:`PyType_GetName` 函式來取得型別的短名。(由 Hai Shi " +"於 :issue:`42035` 中所貢獻。)" #: ../../whatsnew/3.11.rst:2216 msgid "" @@ -4343,20 +4398,20 @@ msgstr "" #: ../../whatsnew/3.11.rst:2219 msgid "" -"Add new :c:func:`PyThreadState_EnterTracing` and :c:func:" -"`PyThreadState_LeaveTracing` functions to the limited C API to suspend and " -"resume tracing and profiling. (Contributed by Victor Stinner in :issue:" -"`43760`.)" +"Add new :c:func:`PyThreadState_EnterTracing` " +"and :c:func:`PyThreadState_LeaveTracing` functions to the limited C API to " +"suspend and resume tracing and profiling. (Contributed by Victor Stinner " +"in :issue:`43760`.)" msgstr "" -"在受限 C API (limited C API) 中新增 :c:func:`PyThreadState_EnterTracing` 和 :" -"c:func:`PyThreadState_LeaveTracing` 函式來中止和繼續追蹤 (tracing) 和性能分" -"析 (profiling)。(由 Victor Stinner 於 :issue:`43760` 中貢獻。)" +"在受限 C API (limited C API) 中新增 :c:func:`PyThreadState_EnterTracing` " +"和 :c:func:`PyThreadState_LeaveTracing` 函式來中止和繼續追蹤 (tracing) 和性能" +"分析 (profiling)。(由 Victor Stinner 於 :issue:`43760` 中貢獻。)" #: ../../whatsnew/3.11.rst:2224 msgid "" -"Added the :c:data:`Py_Version` constant which bears the same value as :c:" -"macro:`PY_VERSION_HEX`. (Contributed by Gabriele N. Tornetta in :issue:" -"`43931`.)" +"Added the :c:data:`Py_Version` constant which bears the same value " +"as :c:macro:`PY_VERSION_HEX`. (Contributed by Gabriele N. Tornetta " +"in :issue:`43931`.)" msgstr "" "添加了 :c:data:`Py_Version` 常數,其值與 :c:macro:`PY_VERSION_HEX` 相同。" "(由 Gabriele N. Tornetta 在 :issue:`43931` 中貢獻。)" @@ -4417,11 +4472,11 @@ msgstr ":c:func:`PyMemoryView_FromBuffer`" #: ../../whatsnew/3.11.rst:2243 msgid "" -":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." -"bf_releasebuffer` type slots" +":c:member:`~PyBufferProcs.bf_getbuffer` " +"and :c:member:`~PyBufferProcs.bf_releasebuffer` type slots" msgstr "" -":c:member:`~PyBufferProcs.bf_getbuffer` 與 :c:member:`~PyBufferProcs." -"bf_releasebuffer` 型別插槽 (type slot)" +":c:member:`~PyBufferProcs.bf_getbuffer` " +"與 :c:member:`~PyBufferProcs.bf_releasebuffer` 型別插槽 (type slot)" #: ../../whatsnew/3.11.rst:2246 msgid "(Contributed by Christian Heimes in :issue:`45459`.)" @@ -4440,39 +4495,38 @@ msgstr "" #: ../../whatsnew/3.11.rst:2253 msgid "" -"Add new functions to pack and unpack C double (serialize and deserialize): :" -"c:func:`PyFloat_Pack2`, :c:func:`PyFloat_Pack4`, :c:func:`PyFloat_Pack8`, :c:" -"func:`PyFloat_Unpack2`, :c:func:`PyFloat_Unpack4` and :c:func:" -"`PyFloat_Unpack8`. (Contributed by Victor Stinner in :issue:`46906`.)" +"Add new functions to pack and unpack C double (serialize and " +"deserialize): :c:func:`PyFloat_Pack2`, :c:func:`PyFloat_Pack4`, :c:func:`PyFloat_Pack8`, :c:func:`PyFloat_Unpack2`, :c:func:`PyFloat_Unpack4` " +"and :c:func:`PyFloat_Unpack8`. (Contributed by Victor Stinner " +"in :issue:`46906`.)" msgstr "" -"新增函式以打包 (pack) 和取出 (unpack) C double(序列化和反序列化)::c:func:" -"`PyFloat_Pack2`、:c:func:`PyFloat_Pack4`、:c:func:`PyFloat_Pack8`、:c:func:" -"`PyFloat_Unpack2` , :c:func:`PyFloat_Unpack4` 和 :c:func:`PyFloat_Unpack8`。" -"(由 Victor Stinner 在 :issue:`46906` 中貢獻。)" +"新增函式以打包 (pack) 和取出 (unpack) C double(序列化和反序列" +"化)::c:func:`PyFloat_Pack2`、:c:func:`PyFloat_Pack4`、:c:func:`PyFloat_Pack8`、:c:func:`PyFloat_Unpack2` , :c:func:`PyFloat_Unpack4` " +"和 :c:func:`PyFloat_Unpack8`。(由 Victor Stinner 在 :issue:`46906` 中貢" +"獻。)" #: ../../whatsnew/3.11.rst:2259 msgid "" -"Add new functions to get frame object attributes: :c:func:" -"`PyFrame_GetBuiltins`, :c:func:`PyFrame_GetGenerator`, :c:func:" -"`PyFrame_GetGlobals`, :c:func:`PyFrame_GetLasti`." +"Add new functions to get frame object " +"attributes: :c:func:`PyFrame_GetBuiltins`, :c:func:`PyFrame_GetGenerator`, :c:func:`PyFrame_GetGlobals`, :c:func:`PyFrame_GetLasti`." msgstr "" -"新增取得幀物件屬性的函式::c:func:`PyFrame_GetBuiltins`、:c:func:" -"`PyFrame_GetGenerator`、:c:func:`PyFrame_GetGlobals`、:c:func:" -"`PyFrame_GetLasti`。" +"新增取得幀物件屬性的函" +"式::c:func:`PyFrame_GetBuiltins`、:c:func:`PyFrame_GetGenerator`、:c:func:`PyFrame_GetGlobals`、:c:func:`PyFrame_GetLasti`。" #: ../../whatsnew/3.11.rst:2263 msgid "" -"Added two new functions to get and set the active exception instance: :c:" -"func:`PyErr_GetHandledException` and :c:func:`PyErr_SetHandledException`. " -"These are alternatives to :c:func:`PyErr_SetExcInfo()` and :c:func:" -"`PyErr_GetExcInfo()` which work with the legacy 3-tuple representation of " -"exceptions. (Contributed by Irit Katriel in :issue:`46343`.)" +"Added two new functions to get and set the active exception " +"instance: :c:func:`PyErr_GetHandledException` " +"and :c:func:`PyErr_SetHandledException`. These are alternatives " +"to :c:func:`PyErr_SetExcInfo()` and :c:func:`PyErr_GetExcInfo()` which work " +"with the legacy 3-tuple representation of exceptions. (Contributed by Irit " +"Katriel in :issue:`46343`.)" msgstr "" -"添加了兩個新函式來獲得和設置仍在作用的例外實例::c:func:" -"`PyErr_GetHandledException` 和 :c:func:`PyErr_SetHandledException`。這些是 :" -"c:func:`PyErr_SetExcInfo()` 和 :c:func:`PyErr_GetExcInfo()` 的替代品,它們與" -"例外的遺留三元組表示法一起作用。(由 Irit Katriel 在 :issue:`46343` 中貢" -"獻。)" +"添加了兩個新函式來獲得和設置仍在作用的例外實" +"例::c:func:`PyErr_GetHandledException` " +"和 :c:func:`PyErr_SetHandledException`。這些是 :c:func:`PyErr_SetExcInfo()` " +"和 :c:func:`PyErr_GetExcInfo()` 的替代品,它們與例外的遺留三元組表示法一起作" +"用。(由 Irit Katriel 在 :issue:`46343` 中貢獻。)" #: ../../whatsnew/3.11.rst:2270 msgid "" @@ -4493,11 +4547,11 @@ msgid "" "expected types. See :pep:`670` for more details. (Contributed by Victor " "Stinner and Erlend E. Aasland in :gh:`89653`.)" msgstr "" -"一些巨集已轉換為行內靜態函式以避免\\ `巨集陷阱 (macro pitfalls) <https://gcc." -"gnu.org/onlinedocs/cpp/Macro-Pitfalls.html>`_。這種變化對用戶來說應該是透明" -"的,因為替換函式會將它們的引數轉換為預期的型別,以避免由於靜態型別檢查而產生" -"的編譯器警告。但是,當受限 C API 設置為 >=3.11 時,這些轉換不會完成,使用者需" -"要將引數轉換為他們期望的型別。有關更多詳細資訊,請參閱 :pep:`670`。(由 " +"一些巨集已轉換為行內靜態函式以避免\\ `巨集陷阱 (macro pitfalls) <https://" +"gcc.gnu.org/onlinedocs/cpp/Macro-Pitfalls.html>`_。這種變化對用戶來說應該是透" +"明的,因為替換函式會將它們的引數轉換為預期的型別,以避免由於靜態型別檢查而產" +"生的編譯器警告。但是,當受限 C API 設置為 >=3.11 時,這些轉換不會完成,使用者" +"需要將引數轉換為他們期望的型別。有關更多詳細資訊,請參閱 :pep:`670`。(由 " "Victor Stinner 和 Erlend E. Aasland 在 :gh:`89653` 中貢獻。)" #: ../../whatsnew/3.11.rst:2292 @@ -4558,17 +4612,17 @@ msgstr "" #: ../../whatsnew/3.11.rst:2318 msgid "" ":c:type:`PyCodeObject` no longer has the ``co_code``, ``co_varnames``, " -"``co_cellvars`` and ``co_freevars`` fields. Instead, use :c:func:" -"`PyCode_GetCode`, :c:func:`PyCode_GetVarnames`, :c:func:`PyCode_GetCellvars` " +"``co_cellvars`` and ``co_freevars`` fields. Instead, " +"use :c:func:`PyCode_GetCode`, :c:func:`PyCode_GetVarnames`, :c:func:`PyCode_GetCellvars` " "and :c:func:`PyCode_GetFreevars` respectively to access them via the C API. " "(Contributed by Brandt Bucher in :issue:`46841` and Ken Jin in :gh:`92154` " "and :gh:`94936`.)" msgstr "" ":c:type:`PyCodeObject` 不再會有 ``co_code``、``co_varnames``、" -"``co_cellvars`` 和 ``co_freevars`` 欄位。分別被改為透過 C API 的 :c:func:" -"`PyCode_GetCode`、:c:func:`PyCode_GetVarnames`、:c:func:`PyCode_GetCellvars` " -"和 :c:func:`PyCode_GetFreevars` 來存取。(由 Brandt Bucher 在 :issue:" -"`46841`、Ken Jin 在 :gh:`92154` 與 :gh:`94936` 中貢獻。)" +"``co_cellvars`` 和 ``co_freevars`` 欄位。分別被改為透過 C API " +"的 :c:func:`PyCode_GetCode`、:c:func:`PyCode_GetVarnames`、:c:func:`PyCode_GetCellvars` " +"和 :c:func:`PyCode_GetFreevars` 來存取。(由 Brandt Bucher " +"在 :issue:`46841`、Ken Jin 在 :gh:`92154` 與 :gh:`94936` 中貢獻。)" #: ../../whatsnew/3.11.rst:2326 msgid "" @@ -4667,24 +4721,25 @@ msgstr "" msgid "" "The :c:func:`PyType_Ready` function now raises an error if a type is defined " "with the :c:macro:`Py_TPFLAGS_HAVE_GC` flag set but has no traverse function " -"(:c:member:`PyTypeObject.tp_traverse`). (Contributed by Victor Stinner in :" -"issue:`44263`.)" +"(:c:member:`PyTypeObject.tp_traverse`). (Contributed by Victor Stinner " +"in :issue:`44263`.)" msgstr "" "如果一個型別是以 :c:macro:`Py_TPFLAGS_HAVE_GC` 旗標來定義,但卻沒有遍歷函式 " -"(traverse function) (:c:member:`PyTypeObject.tp_traverse`),那 :c:func:" -"`PyType_Ready` 函式現在會引發一個錯誤。(由 Victor Stinner 於 :issue:`44263` " -"中貢獻。)" +"(traverse function) (:c:member:`PyTypeObject.tp_traverse`)," +"那 :c:func:`PyType_Ready` 函式現在會引發一個錯誤。(由 Victor Stinner " +"於 :issue:`44263` 中貢獻。)" #: ../../whatsnew/3.11.rst:2372 msgid "" "Heap types with the :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` flag can now inherit " -"the :pep:`590` vectorcall protocol. Previously, this was only possible for :" -"ref:`static types <static-types>`. (Contributed by Erlend E. Aasland in :" -"issue:`43908`)" +"the :pep:`590` vectorcall protocol. Previously, this was only possible " +"for :ref:`static types <static-types>`. (Contributed by Erlend E. Aasland " +"in :issue:`43908`)" msgstr "" -"帶有 :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` 旗標的堆積型別現在可以繼承 :pep:" -"`590` 向量呼叫協定 (vectorcall protocol)。以前這僅適用於 :ref:`static types " -"<static-types>`。(由 Erlend E. Aasland 在 :issue:`43908` 中貢獻)。" +"帶有 :c:macro:`Py_TPFLAGS_IMMUTABLETYPE` 旗標的堆積型別現在可以繼" +"承 :pep:`590` 向量呼叫協定 (vectorcall protocol)。以前這僅適用" +"於 :ref:`static types <static-types>`。(由 Erlend E. Aasland " +"在 :issue:`43908` 中貢獻)。" #: ../../whatsnew/3.11.rst:2377 msgid "" @@ -4694,9 +4749,9 @@ msgid "" "Python 3.9). For backward compatibility, this macro can be used::" msgstr "" "由於 :c:func:`Py_TYPE()` 更改為行內靜態函式 (inline static function),因此 " -"``Py_TYPE(obj) = new_type`` 必須替換為 ``Py_SET_TYPE(obj, new_type)``:參見 :" -"c:func:`Py_SET_TYPE()` 函式(自 Python 3.9 起可用)。為了向後相容,可以使用這" -"個巨集:" +"``Py_TYPE(obj) = new_type`` 必須替換為 ``Py_SET_TYPE(obj, new_type)``:參" +"見 :c:func:`Py_SET_TYPE()` 函式(自 Python 3.9 起可用)。為了向後相容,可以使" +"用這個巨集:" #: ../../whatsnew/3.11.rst:2383 msgid "" @@ -4724,9 +4779,9 @@ msgid "" "Python 3.9). For backward compatibility, this macro can be used::" msgstr "" "由於 :c:func:`Py_SIZE()` 更改為行內靜態函式,因此 ``Py_SIZE(obj) = " -"new_size`` 必須替換為 ``Py_SET_SIZE(obj, new_size)``:參見 :c:func:" -"`Py_SET_SIZE()` 函式(自 Python 3.9 起可用)。為了向後相容,可以使用這個巨" -"集:" +"new_size`` 必須替換為 ``Py_SET_SIZE(obj, new_size)``:參" +"見 :c:func:`Py_SET_SIZE()` 函式(自 Python 3.9 起可用)。為了向後相容,可以使" +"用這個巨集:" #: ../../whatsnew/3.11.rst:2397 msgid "" @@ -4744,9 +4799,9 @@ msgstr "" #: ../../whatsnew/3.11.rst:2405 msgid "" -"``<Python.h>`` no longer includes the header files ``<stdlib.h>``, ``<stdio." -"h>``, ``<errno.h>`` and ``<string.h>`` when the ``Py_LIMITED_API`` macro is " -"set to ``0x030b0000`` (Python 3.11) or higher. C extensions should " +"``<Python.h>`` no longer includes the header files ``<stdlib.h>``, " +"``<stdio.h>``, ``<errno.h>`` and ``<string.h>`` when the ``Py_LIMITED_API`` " +"macro is set to ``0x030b0000`` (Python 3.11) or higher. C extensions should " "explicitly include the header files after ``#include <Python.h>``. " "(Contributed by Victor Stinner in :issue:`45434`.)" msgstr "" @@ -4780,8 +4835,8 @@ msgid "" "Victor Stinner in :issue:`46007`.)" msgstr "" ":c:func:`!PyUnicode_CHECK_INTERNED` 巨集已從受限 C API 中移出,它從來沒辦法被" -"使用,因為它使用了受限 C API 不提供的內部結構。(由 Victor Stinner 於 :issue:" -"`46007` 中所貢獻。)" +"使用,因為它使用了受限 C API 不提供的內部結構。(由 Victor Stinner " +"於 :issue:`46007` 中所貢獻。)" #: ../../whatsnew/3.11.rst:2424 msgid "" @@ -4891,8 +4946,8 @@ msgid "" "it may be faster." msgstr "" "``f_lasti``:使用 :c:func:`PyFrame_GetLasti`。程式碼中 ``f_lasti`` 有與 " -"``PyCode_Addr2Line()`` 同時使用的部分應該改用 :c:func:" -"`PyFrame_GetLineNumber`;它可能會更快。" +"``PyCode_Addr2Line()`` 同時使用的部分應該改" +"用 :c:func:`PyFrame_GetLineNumber`;它可能會更快。" #: ../../whatsnew/3.11.rst:2464 msgid "``f_lineno``: use :c:func:`PyFrame_GetLineNumber`" @@ -4940,25 +4995,25 @@ msgstr "``f_valuestack``:已移除。" #: ../../whatsnew/3.11.rst:2474 msgid "" -"The Python frame object is now created lazily. A side effect is that the :" -"attr:`~frame.f_back` member must not be accessed directly, since its value " -"is now also computed lazily. The :c:func:`PyFrame_GetBack` function must be " -"called instead." +"The Python frame object is now created lazily. A side effect is that " +"the :attr:`~frame.f_back` member must not be accessed directly, since its " +"value is now also computed lazily. The :c:func:`PyFrame_GetBack` function " +"must be called instead." msgstr "" "Python 幀物件的建立現為惰性的 (lazily),一個副作用是 :attr:`~frame.f_back` 成" -"員不能被直接存取,因為其職的計算也是惰性的,要改呼叫 :c:func:" -"`PyFrame_GetBack`。" +"員不能被直接存取,因為其職的計算也是惰性的,要改呼" +"叫 :c:func:`PyFrame_GetBack`。" #: ../../whatsnew/3.11.rst:2480 msgid "" -"Debuggers that accessed the :attr:`~frame.f_locals` directly *must* call :c:" -"func:`PyFrame_GetLocals` instead. They no longer need to call :c:func:`!" -"PyFrame_FastToLocalsWithError` or :c:func:`!PyFrame_LocalsToFast`, in fact " -"they should not call those functions. The necessary updating of the frame is " -"now managed by the virtual machine." +"Debuggers that accessed the :attr:`~frame.f_locals` directly *must* " +"call :c:func:`PyFrame_GetLocals` instead. They no longer need to " +"call :c:func:`!PyFrame_FastToLocalsWithError` or :c:func:`!" +"PyFrame_LocalsToFast`, in fact they should not call those functions. The " +"necessary updating of the frame is now managed by the virtual machine." msgstr "" -"直接存取 :attr:`~frame.f_locals` 的除錯器\\ *必須*\\ 改為呼叫 :c:func:" -"`PyFrame_GetLocals`。他們不再需要呼叫 :c:func:`!" +"直接存取 :attr:`~frame.f_locals` 的除錯器\\ *必須*\\ 改為呼" +"叫 :c:func:`PyFrame_GetLocals`。他們不再需要呼叫 :c:func:`!" "PyFrame_FastToLocalsWithError` 或 :c:func:`!PyFrame_LocalsToFast`,事實上他們" "不應該呼叫這些函式。框架的必要更新現在由虛擬機管理。" @@ -5030,13 +5085,13 @@ msgstr "" #: ../../whatsnew/3.11.rst:2516 msgid "" -"``tracing``: changed, use :c:func:`PyThreadState_EnterTracing` and :c:func:" -"`PyThreadState_LeaveTracing` (functions added to Python 3.11 by :issue:" -"`43760`)." +"``tracing``: changed, use :c:func:`PyThreadState_EnterTracing` " +"and :c:func:`PyThreadState_LeaveTracing` (functions added to Python 3.11 " +"by :issue:`43760`)." msgstr "" -"``tracing``:已變更,改用 :c:func:`PyThreadState_EnterTracing` 和 :c:func:" -"`PyThreadState_LeaveTracing`\\ (:issue:`43760` 於 Python 3.11 中新增的函" -"式)。" +"``tracing``:已變更,改用 :c:func:`PyThreadState_EnterTracing` " +"和 :c:func:`PyThreadState_LeaveTracing`\\ (:issue:`43760` 於 Python 3.11 中" +"新增的函式)。" #: ../../whatsnew/3.11.rst:2519 msgid "" @@ -5135,7 +5190,7 @@ msgid "" "Or use `the pythoncapi-compat project <https://github.com/python/pythoncapi-" "compat>`__ to get these functions on old Python functions." msgstr "" -"或是使用 `pythoncap-compat 計畫 <https://github.com/python/pythoncapi-" +"或是使用 `pythoncap-compat 專案 <https://github.com/python/pythoncapi-" "compat>`__\\ 來在舊版 Python 函式中取得它們。" #: ../../whatsnew/3.11.rst:2563 @@ -5151,22 +5206,23 @@ msgid "" "initialize :data:`sys.path`. Otherwise, initialization will recalculate the " "path and replace any values added to ``module_search_paths``." msgstr "" -"初始化中若是要用 :c:member:`PyConfig.module_search_paths` 來初始化 :data:" -"`sys.path`,則現在 :c:member:`PyConfig.module_search_paths_set` 必須被設為 " -"1。否則,初始化會重新計算路徑並取代所有被加到 ``module_search_paths`` 的值。" +"初始化中若是要用 :c:member:`PyConfig.module_search_paths` 來初始" +"化 :data:`sys.path`,則現在 :c:member:`PyConfig.module_search_paths_set` 必須" +"被設為 1。否則,初始化會重新計算路徑並取代所有被加到 ``module_search_paths`` " +"的值。" #: ../../whatsnew/3.11.rst:2571 msgid "" ":c:func:`PyConfig_Read` no longer calculates the initial search path, and " "will not fill any values into :c:member:`PyConfig.module_search_paths`. To " -"calculate default paths and then modify them, finish initialization and use :" -"c:func:`PySys_GetObject` to retrieve :data:`sys.path` as a Python list " +"calculate default paths and then modify them, finish initialization and " +"use :c:func:`PySys_GetObject` to retrieve :data:`sys.path` as a Python list " "object and modify it directly." msgstr "" -":c:func:`PyConfig_Read` 不再計算初始搜尋路徑,並且不會將任何值填充到 :c:" -"member:`PyConfig.module_search_paths` 中。若要計算預設路徑然後修改它們,完成" -"初始化並使用 :c:func:`PySys_GetObject` 以取得 :data:`sys.path` 作為 Python 列" -"表物件並直接修改它。" +":c:func:`PyConfig_Read` 不再計算初始搜尋路徑,並且不會將任何值填充" +"到 :c:member:`PyConfig.module_search_paths` 中。若要計算預設路徑然後修改它" +"們,完成初始化並使用 :c:func:`PySys_GetObject` 以取得 :data:`sys.path` 作為 " +"Python 列表物件並直接修改它。" #: ../../whatsnew/3.11.rst:2582 msgid "" @@ -5232,11 +5288,12 @@ msgstr "" #: ../../whatsnew/3.11.rst:2601 msgid "" -"Deprecate the ``ob_shash`` member of the :c:type:`PyBytesObject`. Use :c:" -"func:`PyObject_Hash` instead. (Contributed by Inada Naoki in :issue:`46864`.)" +"Deprecate the ``ob_shash`` member of the :c:type:`PyBytesObject`. " +"Use :c:func:`PyObject_Hash` instead. (Contributed by Inada Naoki " +"in :issue:`46864`.)" msgstr "" -"棄用 :c:type:`PyBytesObject` 中的 ``ob_shash`` 成員。請改用 :c:func:" -"`PyObject_Hash`。(由 Inada Naoki 於 :issue:`46864` 中所貢獻。)" +"棄用 :c:type:`PyBytesObject` 中的 ``ob_shash`` 成員。請改" +"用 :c:func:`PyObject_Hash`。(由 Inada Naoki 於 :issue:`46864` 中所貢獻。)" #: ../../whatsnew/3.11.rst:2610 msgid "" @@ -5366,8 +5423,8 @@ msgstr "" #: ../../whatsnew/3.11.rst:2659 msgid "" "Remove the ``Py_FORCE_DOUBLE()`` macro. It was used by the " -"``Py_IS_INFINITY()`` macro. (Contributed by Victor Stinner in :issue:" -"`45440`.)" +"``Py_IS_INFINITY()`` macro. (Contributed by Victor Stinner " +"in :issue:`45440`.)" msgstr "" "移除 ``Py_FORCE_DOUBLE()`` 巨集。它先前被用於 ``Py_IS_INFINITY()`` 巨集。" "(由 Victor Stinner 於 :issue:`45440` 中所貢獻。)" diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index a37bf789fd..fb08a83de7 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-04-30 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,8 +31,8 @@ msgstr "Adam Turner" #: ../../whatsnew/3.12.rst:48 msgid "" "This article explains the new features in Python 3.12, compared to 3.11. " -"Python 3.12 was released on October 2, 2023. For full details, see " -"the :ref:`changelog <changelog>`." +"Python 3.12 was released on October 2, 2023. For full details, see the :ref:" +"`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.12 與 3.11 相比多了哪些新功能。 Python 3.12 於 2023 年 " "10 月 2 日發布。完整詳情請見 :ref:`changelog <changelog>`。" @@ -54,16 +54,25 @@ msgid "" "Filesystem support in :mod:`os` and :mod:`pathlib` has seen a number of " "improvements, and several modules have better performance." msgstr "" +"Python 3.12 是 Python 程式語言的穩定版本,包含了語言和標準函式庫的綜合變更。" +"標準函式庫的變更主要集中在清理棄用的 API、可用性和正確性。值得注意的是,:mod:" +"`!distutils` 套件已從標準函式庫中移除。:mod:`os` 和 :mod:`pathlib` 中的檔案系" +"統支援進行了許多改進,並且有數個模組得到更好的效能。" #: ../../whatsnew/3.12.rst:69 msgid "" "The language changes focus on usability, as :term:`f-strings <f-string>` " "have had many limitations removed and 'Did you mean ...' suggestions " "continue to improve. The new :ref:`type parameter syntax <whatsnew312-" -"pep695>` and :keyword:`type` statement improve ergonomics for " -"using :term:`generic types <generic type>` and :term:`type aliases <type " -"alias>` with static type checkers." +"pep695>` and :keyword:`type` statement improve ergonomics for using :term:" +"`generic types <generic type>` and :term:`type aliases <type alias>` with " +"static type checkers." msgstr "" +"語言變更主要集中在可用性,因為 :term:`f-字串 <f-string>`\\ 已經移除了許多限" +"制,並且持續改進 'Did you mean ...' 建議。新的\\ :ref:`型別參數語法 " +"<whatsnew312-pep695>`\\ 和 :keyword:`type` 陳述式改進了\\ :term:`泛型型別 " +"<generic type>`\\ 和\\ :term:`型別別名 <type alias>`\\ 在與靜態型別檢查器一起" +"使用上的效率。" #: ../../whatsnew/3.12.rst:76 msgid "" @@ -75,6 +84,10 @@ msgid "" "change, refer to the PEP for a particular new feature; but note that PEPs " "usually are not kept up-to-date once a feature has been fully implemented." msgstr "" +"這篇文章並不試圖提供所有新功能的完整規格,而是提供一個方便的概覽。完整詳情應" +"參考文件,如\\ :ref:`標準函式庫參考 <library-index>`\\ 和\\ :ref:`語言參考 " +"<reference-index>`。如果你想了解某個新功能的完整實作和設計理念,請參考該功能" +"的 PEP;但請注意 PEP 通常在功能完全實作後就不再更新。" #: ../../whatsnew/3.12.rst:90 msgid "New syntax features:" @@ -82,8 +95,8 @@ msgstr "新增語法特性:" #: ../../whatsnew/3.12.rst:92 msgid "" -":ref:`PEP 695 <whatsnew312-pep695>`, type parameter syntax and " -"the :keyword:`type` statement" +":ref:`PEP 695 <whatsnew312-pep695>`, type parameter syntax and the :keyword:" +"`type` statement" msgstr "" ":ref:`PEP 695 <whatsnew312-pep695>`,型別參數語法和 :keyword:`type` 陳述式" @@ -96,6 +109,7 @@ msgid "" ":ref:`PEP 701 <whatsnew312-pep701>`, :term:`f-strings <f-string>` in the " "grammar" msgstr "" +":ref:`PEP 701 <whatsnew312-pep701>`,文法中的 :term:`f-字串 <f-string>`" #: ../../whatsnew/3.12.rst:98 msgid "Interpreter improvements:" @@ -106,15 +120,17 @@ msgid "" ":ref:`PEP 684 <whatsnew312-pep684>`, a unique per-interpreter :term:`GIL " "<global interpreter lock>`" msgstr "" +":ref:`PEP 684 <whatsnew312-pep684>`,直譯器各別持有的 :term:`GIL <global " +"interpreter lock>`" #: ../../whatsnew/3.12.rst:102 msgid ":ref:`PEP 669 <whatsnew312-pep669>`, low impact monitoring" -msgstr "" +msgstr ":ref:`PEP 669 <whatsnew312-pep669>`,低影響監控" #: ../../whatsnew/3.12.rst:103 msgid "" -"`Improved 'Did you mean ...' suggestions <improved error messages_>`_ " -"for :exc:`NameError`, :exc:`ImportError`, and :exc:`SyntaxError` exceptions" +"`Improved 'Did you mean ...' suggestions <improved error messages_>`_ for :" +"exc:`NameError`, :exc:`ImportError`, and :exc:`SyntaxError` exceptions" msgstr "" #: ../../whatsnew/3.12.rst:106 @@ -137,19 +153,19 @@ msgstr ":class:`pathlib.Path` 類別現在支援子類別化" #: ../../whatsnew/3.12.rst:114 msgid "The :mod:`os` module received several improvements for Windows support" -msgstr "" +msgstr ":mod:`os` 模組在 Windows 支援上有了數項改進" #: ../../whatsnew/3.12.rst:115 msgid "" -"A :ref:`command-line interface <sqlite3-cli>` has been added to " -"the :mod:`sqlite3` module" +"A :ref:`command-line interface <sqlite3-cli>` has been added to the :mod:" +"`sqlite3` module" msgstr "" "一個\\ :ref:`命令列介面 <sqlite3-cli>`\\ 已被加入 :mod:`sqlite3` 模組中" #: ../../whatsnew/3.12.rst:117 msgid "" -":func:`isinstance` checks against :func:`runtime-checkable protocols " -"<typing.runtime_checkable>` enjoy a speed up of between two and 20 times" +":func:`isinstance` checks against :func:`runtime-checkable protocols <typing." +"runtime_checkable>` enjoy a speed up of between two and 20 times" msgstr "" #: ../../whatsnew/3.12.rst:119 @@ -220,8 +236,8 @@ msgid "" ":ref:`PEP 692 <whatsnew312-pep692>`, using :class:`~typing.TypedDict` to " "annotate :term:`**kwargs <argument>`" msgstr "" -":ref:`PEP 692 <whatsnew312-pep692>`、使用 :class:`~typing.TypedDict` 來標" -"註 :term:`**kwargs <argument>`" +":ref:`PEP 692 <whatsnew312-pep692>`、使用 :class:`~typing.TypedDict` 來標註 :" +"term:`**kwargs <argument>`" #: ../../whatsnew/3.12.rst:149 msgid ":ref:`PEP 698 <whatsnew312-pep698>`, :func:`typing.override` decorator" @@ -261,11 +277,11 @@ msgid "" "removed, along with several :class:`unittest.TestCase` `method aliases " "<unittest-TestCase-removed-aliases_>`_." msgstr "" -":mod:`!asynchat`、:mod:`!asyncore` 和 :mod:`!imp` 模組以及幾" -"個 :class:`unittest.TestCase` 的\\ `方法別名 <unittest-TestCase-removed-" -"aliases_>`_\\ 已被刪除。" +":mod:`!asynchat`、:mod:`!asyncore` 和 :mod:`!imp` 模組以及幾個 :class:" +"`unittest.TestCase` 的\\ `方法別名 <unittest-TestCase-removed-aliases_>`_\\ " +"已被刪除。" -#: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1832 +#: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1840 msgid "New Features" msgstr "新增功能" @@ -282,8 +298,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:187 msgid "" -":pep:`695` introduces a new, more compact and explicit way to " -"create :ref:`generic classes <generic-classes>` and :ref:`functions <generic-" +":pep:`695` introduces a new, more compact and explicit way to create :ref:" +"`generic classes <generic-classes>` and :ref:`functions <generic-" "functions>`::" msgstr "" @@ -330,9 +346,9 @@ msgstr "type Point[T] = tuple[T, T]" #: ../../whatsnew/3.12.rst:210 msgid "" -"The new syntax allows declaring :class:`~typing.TypeVarTuple` " -"and :class:`~typing.ParamSpec` parameters, as well " -"as :class:`~typing.TypeVar` parameters with bounds or constraints::" +"The new syntax allows declaring :class:`~typing.TypeVarTuple` and :class:" +"`~typing.ParamSpec` parameters, as well as :class:`~typing.TypeVar` " +"parameters with bounds or constraints::" msgstr "" #: ../../whatsnew/3.12.rst:214 @@ -428,11 +444,10 @@ msgstr "" #: ../../whatsnew/3.12.rst:290 msgid "" "Backslashes and unicode characters: before Python 3.12 f-string expressions " -"couldn't contain any ``\\`` character. This also affected " -"unicode :ref:`escape sequences <escape-sequences>` (such as ``\\N{snowman}" -"``) as these contain the ``\\N`` part that previously could not be part of " -"expression components of f-strings. Now, you can define expressions like " -"this:" +"couldn't contain any ``\\`` character. This also affected unicode :ref:" +"`escape sequences <escape-sequences>` (such as ``\\N{snowman}``) as these " +"contain the ``\\N`` part that previously could not be part of expression " +"components of f-strings. Now, you can define expressions like this:" msgstr "" #: ../../whatsnew/3.12.rst:303 @@ -492,7 +507,7 @@ msgstr "" #: ../../whatsnew/3.12.rst:337 msgid "PEP 684: A Per-Interpreter GIL" -msgstr "" +msgstr "PEP 684:直譯器各別持有的 GIL" #: ../../whatsnew/3.12.rst:339 msgid "" @@ -502,6 +517,10 @@ msgid "" "CPU cores. This is currently only available through the C-API, though a " "Python API is :pep:`anticipated for 3.13 <554>`." msgstr "" +":pep:`684` 引入了直譯器各別持有的 :term:`GIL <global interpreter lock>`,因此" +"子直譯器現在可以使用各個直譯器特有的 GIL 來建立。這使得 Python 程式可以充分利" +"用多個 CPU 核心。目前這僅透過 C-API 使用,不過 Python API :pep:`預計在 3.13 " +"中釋出 <554>`。" #: ../../whatsnew/3.12.rst:345 msgid "" @@ -568,17 +587,16 @@ msgstr "" #: ../../whatsnew/3.12.rst:386 msgid "" ":pep:`688` introduces a way to use the :ref:`buffer protocol " -"<bufferobjects>` from Python code. Classes that implement " -"the :meth:`~object.__buffer__` method are now usable as buffer types." +"<bufferobjects>` from Python code. Classes that implement the :meth:`~object." +"__buffer__` method are now usable as buffer types." msgstr "" #: ../../whatsnew/3.12.rst:390 msgid "" "The new :class:`collections.abc.Buffer` ABC provides a standard way to " -"represent buffer objects, for example in type annotations. The " -"new :class:`inspect.BufferFlags` enum represents the flags that can be used " -"to customize buffer creation. (Contributed by Jelle Zijlstra " -"in :gh:`102500`.)" +"represent buffer objects, for example in type annotations. The new :class:" +"`inspect.BufferFlags` enum represents the flags that can be used to " +"customize buffer creation. (Contributed by Jelle Zijlstra in :gh:`102500`.)" msgstr "" #: ../../whatsnew/3.12.rst:399 @@ -657,8 +675,8 @@ msgstr "" #: ../../whatsnew/3.12.rst:459 msgid "" "Improve the :exc:`SyntaxError` error message when the user types ``import x " -"from y`` instead of ``from y import x``. (Contributed by Pablo Galindo " -"in :gh:`98931`.)" +"from y`` instead of ``from y import x``. (Contributed by Pablo Galindo in :" +"gh:`98931`.)" msgstr "" #: ../../whatsnew/3.12.rst:469 @@ -671,13 +689,14 @@ msgstr "" #: ../../whatsnew/3.12.rst:480 msgid "New Features Related to Type Hints" -msgstr "" +msgstr "型別提示相關的新特性" #: ../../whatsnew/3.12.rst:482 msgid "" -"This section covers major changes affecting :pep:`type hints <484>` and " -"the :mod:`typing` module." +"This section covers major changes affecting :pep:`type hints <484>` and the :" +"mod:`typing` module." msgstr "" +"本節涵蓋了影響\\ :pep:`型別提示 <484>`\\ 和 :mod:`typing` 模組的主要變更。" #: ../../whatsnew/3.12.rst:488 msgid "PEP 692: Using ``TypedDict`` for more precise ``**kwargs`` typing" @@ -782,18 +801,17 @@ msgid "" "a :exc:`SyntaxWarning`, instead of :exc:`DeprecationWarning`. For example, " "``re.compile(\"\\d+\\.\\d+\")`` now emits a :exc:`SyntaxWarning` " "(``\"\\d\"`` is an invalid escape sequence, use raw strings for regular " -"expression: ``re.compile(r\"\\d+\\.\\d+\")``). In a future Python " -"version, :exc:`SyntaxError` will eventually be raised, instead " -"of :exc:`SyntaxWarning`. (Contributed by Victor Stinner in :gh:`98401`.)" +"expression: ``re.compile(r\"\\d+\\.\\d+\")``). In a future Python version, :" +"exc:`SyntaxError` will eventually be raised, instead of :exc:" +"`SyntaxWarning`. (Contributed by Victor Stinner in :gh:`98401`.)" msgstr "" #: ../../whatsnew/3.12.rst:557 msgid "" "Octal escapes with value larger than ``0o377`` (ex: ``\"\\477\"``), " -"deprecated in Python 3.11, now produce a :exc:`SyntaxWarning`, instead " -"of :exc:`DeprecationWarning`. In a future Python version they will be " -"eventually a :exc:`SyntaxError`. (Contributed by Victor Stinner " -"in :gh:`98401`.)" +"deprecated in Python 3.11, now produce a :exc:`SyntaxWarning`, instead of :" +"exc:`DeprecationWarning`. In a future Python version they will be eventually " +"a :exc:`SyntaxError`. (Contributed by Victor Stinner in :gh:`98401`.)" msgstr "" #: ../../whatsnew/3.12.rst:563 @@ -816,9 +834,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:574 msgid "" "When a ``try-except*`` construct handles the entire :exc:`ExceptionGroup` " -"and raises one other exception, that exception is no longer wrapped in " -"an :exc:`ExceptionGroup`. Also changed in version 3.11.4. (Contributed by " -"Irit Katriel in :gh:`103590`.)" +"and raises one other exception, that exception is no longer wrapped in an :" +"exc:`ExceptionGroup`. Also changed in version 3.11.4. (Contributed by Irit " +"Katriel in :gh:`103590`.)" msgstr "" #: ../../whatsnew/3.12.rst:579 @@ -827,8 +845,8 @@ msgid "" "Python bytecode evaluation loop instead of object allocations. The GC can " "also run when :c:func:`PyErr_CheckSignals` is called so C extensions that " "need to run for a long time without executing any Python code also have a " -"chance to execute the GC periodically. (Contributed by Pablo Galindo " -"in :gh:`97922`.)" +"chance to execute the GC periodically. (Contributed by Pablo Galindo in :gh:" +"`97922`.)" msgstr "" #: ../../whatsnew/3.12.rst:586 @@ -884,13 +902,12 @@ msgstr "" #: ../../whatsnew/3.12.rst:616 msgid "" "Add :ref:`support for the perf profiler <perf_profiling>` through the new " -"environment variable :envvar:`PYTHONPERFSUPPORT` and command-line " -"option :option:`-X perf <-X>`, as well as the " -"new :func:`sys.activate_stack_trampoline`, :func:`sys.deactivate_stack_trampoline`, " -"and :func:`sys.is_stack_trampoline_active` functions. (Design by Pablo " -"Galindo. Contributed by Pablo Galindo and Christian Heimes with " -"contributions from Gregory P. Smith [Google] and Mark Shannon " -"in :gh:`96123`.)" +"environment variable :envvar:`PYTHONPERFSUPPORT` and command-line option :" +"option:`-X perf <-X>`, as well as the new :func:`sys." +"activate_stack_trampoline`, :func:`sys.deactivate_stack_trampoline`, and :" +"func:`sys.is_stack_trampoline_active` functions. (Design by Pablo Galindo. " +"Contributed by Pablo Galindo and Christian Heimes with contributions from " +"Gregory P. Smith [Google] and Mark Shannon in :gh:`96123`.)" msgstr "" #: ../../whatsnew/3.12.rst:628 @@ -911,8 +928,8 @@ msgstr "array" #: ../../whatsnew/3.12.rst:639 msgid "" -"The :class:`array.array` class now supports subscripting, making it " -"a :term:`generic type`. (Contributed by Jelle Zijlstra in :gh:`98658`.)" +"The :class:`array.array` class now supports subscripting, making it a :term:" +"`generic type`. (Contributed by Jelle Zijlstra in :gh:`98658`.)" msgstr "" #: ../../whatsnew/3.12.rst:643 @@ -929,28 +946,25 @@ msgstr "" #: ../../whatsnew/3.12.rst:650 msgid "" -"Add :func:`asyncio.eager_task_factory` " -"and :func:`asyncio.create_eager_task_factory` functions to allow opting an " -"event loop in to eager task execution, making some use-cases 2x to 5x " -"faster. (Contributed by Jacob Bower & Itamar Oren " -"in :gh:`102853`, :gh:`104140`, and :gh:`104138`)" +"Add :func:`asyncio.eager_task_factory` and :func:`asyncio." +"create_eager_task_factory` functions to allow opting an event loop in to " +"eager task execution, making some use-cases 2x to 5x faster. (Contributed by " +"Jacob Bower & Itamar Oren in :gh:`102853`, :gh:`104140`, and :gh:`104138`)" msgstr "" #: ../../whatsnew/3.12.rst:655 msgid "" "On Linux, :mod:`asyncio` uses :class:`asyncio.PidfdChildWatcher` by default " -"if :func:`os.pidfd_open` is available and functional instead " -"of :class:`asyncio.ThreadedChildWatcher`. (Contributed by Kumar Aditya " -"in :gh:`98024`.)" +"if :func:`os.pidfd_open` is available and functional instead of :class:" +"`asyncio.ThreadedChildWatcher`. (Contributed by Kumar Aditya in :gh:`98024`.)" msgstr "" #: ../../whatsnew/3.12.rst:660 msgid "" -"The event loop now uses the best available child watcher for each platform " -"(:class:`asyncio.PidfdChildWatcher` if supported " -"and :class:`asyncio.ThreadedChildWatcher` otherwise), so manually " -"configuring a child watcher is not recommended. (Contributed by Kumar Aditya " -"in :gh:`94597`.)" +"The event loop now uses the best available child watcher for each platform (:" +"class:`asyncio.PidfdChildWatcher` if supported and :class:`asyncio." +"ThreadedChildWatcher` otherwise), so manually configuring a child watcher is " +"not recommended. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" #: ../../whatsnew/3.12.rst:666 @@ -967,9 +981,9 @@ msgstr "" #: ../../whatsnew/3.12.rst:673 msgid "" -":func:`asyncio.iscoroutine` now returns ``False`` for generators " -"as :mod:`asyncio` does not support legacy generator-based coroutines. " -"(Contributed by Kumar Aditya in :gh:`102748`.)" +":func:`asyncio.iscoroutine` now returns ``False`` for generators as :mod:" +"`asyncio` does not support legacy generator-based coroutines. (Contributed " +"by Kumar Aditya in :gh:`102748`.)" msgstr "" #: ../../whatsnew/3.12.rst:677 @@ -985,8 +999,8 @@ msgstr "calendar" #: ../../whatsnew/3.12.rst:684 msgid "" "Add enums :data:`calendar.Month` and :data:`calendar.Day` defining months of " -"the year and days of the week. (Contributed by Prince Roshan " -"in :gh:`103636`.)" +"the year and days of the week. (Contributed by Prince Roshan in :gh:" +"`103636`.)" msgstr "" #: ../../whatsnew/3.12.rst:689 @@ -996,8 +1010,8 @@ msgstr "csv" #: ../../whatsnew/3.12.rst:691 msgid "" "Add :const:`csv.QUOTE_NOTNULL` and :const:`csv.QUOTE_STRINGS` flags to " -"provide finer grained control of ``None`` and empty strings " -"by :class:`~csv.reader` and :class:`~csv.writer` objects." +"provide finer grained control of ``None`` and empty strings by :class:`~csv." +"reader` and :class:`~csv.writer` objects." msgstr "" #: ../../whatsnew/3.12.rst:696 @@ -1007,10 +1021,10 @@ msgstr "dis" #: ../../whatsnew/3.12.rst:698 msgid "" "Pseudo instruction opcodes (which are used by the compiler but do not appear " -"in executable bytecode) are now exposed in the :mod:`dis` " -"module. :opcode:`HAVE_ARGUMENT` is still relevant to real opcodes, but it is " -"not useful for pseudo instructions. Use the new :data:`dis.hasarg` " -"collection instead. (Contributed by Irit Katriel in :gh:`94216`.)" +"in executable bytecode) are now exposed in the :mod:`dis` module. :opcode:" +"`HAVE_ARGUMENT` is still relevant to real opcodes, but it is not useful for " +"pseudo instructions. Use the new :data:`dis.hasarg` collection instead. " +"(Contributed by Irit Katriel in :gh:`94216`.)" msgstr "" #: ../../whatsnew/3.12.rst:706 @@ -1104,8 +1118,8 @@ msgid "" "Add :func:`math.sumprod` for computing a sum of products. (Contributed by " "Raymond Hettinger in :gh:`100485`.)" msgstr "" -"新增 :func:`math.sumprod` 以計算乘積總和。(由 Raymond Hettinger " -"於 :gh:`100485` 中貢獻。)" +"新增 :func:`math.sumprod` 以計算乘積總和。(由 Raymond Hettinger 於 :gh:" +"`100485` 中貢獻。)" #: ../../whatsnew/3.12.rst:752 msgid "" @@ -1120,16 +1134,16 @@ msgstr "os" #: ../../whatsnew/3.12.rst:759 msgid "" -"Add :const:`os.PIDFD_NONBLOCK` to open a file descriptor for a process " -"with :func:`os.pidfd_open` in non-blocking mode. (Contributed by Kumar " -"Aditya in :gh:`93312`.)" +"Add :const:`os.PIDFD_NONBLOCK` to open a file descriptor for a process with :" +"func:`os.pidfd_open` in non-blocking mode. (Contributed by Kumar Aditya in :" +"gh:`93312`.)" msgstr "" #: ../../whatsnew/3.12.rst:763 msgid "" ":class:`os.DirEntry` now includes an :meth:`os.DirEntry.is_junction` method " -"to check if the entry is a junction. (Contributed by Charles Machalow " -"in :gh:`99547`.)" +"to check if the entry is a junction. (Contributed by Charles Machalow in :gh:" +"`99547`.)" msgstr "" #: ../../whatsnew/3.12.rst:767 @@ -1148,8 +1162,8 @@ msgid "" "with other platforms). ``st_dev`` may be up to 64 bits and ``st_ino`` up to " "128 bits depending on your file system, and ``st_rdev`` is always set to " "zero rather than incorrect values. Both functions may be significantly " -"faster on newer releases of Windows. (Contributed by Steve Dower " -"in :gh:`99726`.)" +"faster on newer releases of Windows. (Contributed by Steve Dower in :gh:" +"`99726`.)" msgstr "" #: ../../whatsnew/3.12.rst:782 @@ -1178,10 +1192,10 @@ msgstr "pathlib" #: ../../whatsnew/3.12.rst:793 msgid "" -"Add support for subclassing :class:`pathlib.PurePath` " -"and :class:`pathlib.Path`, plus their Posix- and Windows-specific variants. " -"Subclasses may override the :meth:`pathlib.PurePath.with_segments` method to " -"pass information between path instances." +"Add support for subclassing :class:`pathlib.PurePath` and :class:`pathlib." +"Path`, plus their Posix- and Windows-specific variants. Subclasses may " +"override the :meth:`pathlib.PurePath.with_segments` method to pass " +"information between path instances." msgstr "" #: ../../whatsnew/3.12.rst:798 @@ -1195,49 +1209,60 @@ msgstr "" msgid "" "Add *walk_up* optional parameter to :meth:`pathlib.PurePath.relative_to` to " "allow the insertion of ``..`` entries in the result; this behavior is more " -"consistent with :func:`os.path.relpath`. (Contributed by Domenico Ragusa " -"in :gh:`84538`.)" +"consistent with :func:`os.path.relpath`. (Contributed by Domenico Ragusa in :" +"gh:`84538`.)" msgstr "" #: ../../whatsnew/3.12.rst:807 msgid "" -"Add :meth:`pathlib.Path.is_junction` as a proxy " -"to :func:`os.path.isjunction`. (Contributed by Charles Machalow " -"in :gh:`99547`.)" +"Add :meth:`pathlib.Path.is_junction` as a proxy to :func:`os.path." +"isjunction`. (Contributed by Charles Machalow in :gh:`99547`.)" msgstr "" #: ../../whatsnew/3.12.rst:810 msgid "" -"Add *case_sensitive* optional parameter " -"to :meth:`pathlib.Path.glob`, :meth:`pathlib.Path.rglob` " -"and :meth:`pathlib.PurePath.match` for matching the path's case sensitivity, " -"allowing for more precise control over the matching process." +"Add *case_sensitive* optional parameter to :meth:`pathlib.Path.glob`, :meth:" +"`pathlib.Path.rglob` and :meth:`pathlib.PurePath.match` for matching the " +"path's case sensitivity, allowing for more precise control over the matching " +"process." msgstr "" #: ../../whatsnew/3.12.rst:815 +msgid "platform" +msgstr "platform" + +#: ../../whatsnew/3.12.rst:817 +msgid "" +"Add support for detecting Windows 11 and Windows Server releases past 2012. " +"Previously, lookups on Windows Server platforms newer than Windows Server " +"2012 and on Windows 11 would return ``Windows-10``. (Contributed by Steve " +"Dower in :gh:`89545`.)" +msgstr "" + +#: ../../whatsnew/3.12.rst:823 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.12.rst:817 +#: ../../whatsnew/3.12.rst:825 msgid "" "Add convenience variables to hold values temporarily for debug session and " "provide quick access to values like the current frame or the return value. " "(Contributed by Tian Gao in :gh:`103693`.)" msgstr "" -#: ../../whatsnew/3.12.rst:823 +#: ../../whatsnew/3.12.rst:831 msgid "random" msgstr "random" -#: ../../whatsnew/3.12.rst:825 +#: ../../whatsnew/3.12.rst:833 msgid "" -"Add :func:`random.binomialvariate`. (Contributed by Raymond Hettinger " -"in :gh:`81620`.)" +"Add :func:`random.binomialvariate`. (Contributed by Raymond Hettinger in :gh:" +"`81620`.)" msgstr "" "新增 :func:`random.binomialvariate`。(由 Raymond Hettinger 於 :gh:`81620` 中" "貢獻。)" -#: ../../whatsnew/3.12.rst:828 +#: ../../whatsnew/3.12.rst:836 msgid "" "Add a default of ``lambd=1.0`` to :func:`random.expovariate`. (Contributed " "by Raymond Hettinger in :gh:`100234`.)" @@ -1245,11 +1270,11 @@ msgstr "" "將預設值 ``lambd=1.0`` 加入至 :func:`random.expovariate` 中。(由 Raymond " "Hettinger 在 :gh:`100234` 中貢獻。)" -#: ../../whatsnew/3.12.rst:832 +#: ../../whatsnew/3.12.rst:840 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.12.rst:834 +#: ../../whatsnew/3.12.rst:842 msgid "" ":func:`shutil.make_archive` now passes the *root_dir* argument to custom " "archivers which support it. In this case it no longer temporarily changes " @@ -1257,7 +1282,7 @@ msgid "" "archiving. (Contributed by Serhiy Storchaka in :gh:`74696`.)" msgstr "" -#: ../../whatsnew/3.12.rst:840 +#: ../../whatsnew/3.12.rst:848 msgid "" ":func:`shutil.rmtree` now accepts a new argument *onexc* which is an error " "handler like *onerror* but which expects an exception instance rather than a " @@ -1265,14 +1290,14 @@ msgid "" "Katriel in :gh:`102828`.)" msgstr "" -#: ../../whatsnew/3.12.rst:845 +#: ../../whatsnew/3.12.rst:853 msgid "" ":func:`shutil.which` now consults the *PATHEXT* environment variable to find " "matches within *PATH* on Windows even when the given *cmd* includes a " "directory component. (Contributed by Charles Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:850 +#: ../../whatsnew/3.12.rst:858 msgid "" ":func:`shutil.which` will call ``NeedCurrentDirectoryForExePathW`` when " "querying for executables on Windows to determine if the current working " @@ -1280,99 +1305,96 @@ msgid "" "Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:855 +#: ../../whatsnew/3.12.rst:863 msgid "" ":func:`shutil.which` will return a path matching the *cmd* with a component " "from ``PATHEXT`` prior to a direct match elsewhere in the search path on " "Windows. (Contributed by Charles Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:861 ../../whatsnew/3.12.rst:1536 +#: ../../whatsnew/3.12.rst:869 ../../whatsnew/3.12.rst:1544 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.12.rst:863 +#: ../../whatsnew/3.12.rst:871 msgid "" "Add a :ref:`command-line interface <sqlite3-cli>`. (Contributed by Erlend E. " "Aasland in :gh:`77617`.)" msgstr "" -"新增\\ :ref:`命令列介面 <sqlite3-cli>`。(由 Erlend E. Aasland " -"於 :gh:`77617` 中貢獻。)" +"新增\\ :ref:`命令列介面 <sqlite3-cli>`。(由 Erlend E. Aasland 於 :gh:" +"`77617` 中貢獻。)" -#: ../../whatsnew/3.12.rst:866 +#: ../../whatsnew/3.12.rst:874 msgid "" -"Add the :attr:`sqlite3.Connection.autocommit` attribute " -"to :class:`sqlite3.Connection` and the *autocommit* parameter " -"to :func:`sqlite3.connect` to control :pep:`249`-compliant :ref:`transaction " -"handling <sqlite3-transaction-control-autocommit>`. (Contributed by Erlend " -"E. Aasland in :gh:`83638`.)" +"Add the :attr:`sqlite3.Connection.autocommit` attribute to :class:`sqlite3." +"Connection` and the *autocommit* parameter to :func:`sqlite3.connect` to " +"control :pep:`249`-compliant :ref:`transaction handling <sqlite3-transaction-" +"control-autocommit>`. (Contributed by Erlend E. Aasland in :gh:`83638`.)" msgstr "" -#: ../../whatsnew/3.12.rst:873 +#: ../../whatsnew/3.12.rst:881 msgid "" -"Add *entrypoint* keyword-only parameter " -"to :meth:`sqlite3.Connection.load_extension`, for overriding the SQLite " -"extension entry point. (Contributed by Erlend E. Aasland in :gh:`103015`.)" +"Add *entrypoint* keyword-only parameter to :meth:`sqlite3.Connection." +"load_extension`, for overriding the SQLite extension entry point. " +"(Contributed by Erlend E. Aasland in :gh:`103015`.)" msgstr "" -#: ../../whatsnew/3.12.rst:878 +#: ../../whatsnew/3.12.rst:886 msgid "" -"Add :meth:`sqlite3.Connection.getconfig` " -"and :meth:`sqlite3.Connection.setconfig` to :class:`sqlite3.Connection` to " -"make configuration changes to a database connection. (Contributed by Erlend " -"E. Aasland in :gh:`103489`.)" +"Add :meth:`sqlite3.Connection.getconfig` and :meth:`sqlite3.Connection." +"setconfig` to :class:`sqlite3.Connection` to make configuration changes to a " +"database connection. (Contributed by Erlend E. Aasland in :gh:`103489`.)" msgstr "" -#: ../../whatsnew/3.12.rst:884 +#: ../../whatsnew/3.12.rst:892 msgid "statistics" msgstr "statistics" -#: ../../whatsnew/3.12.rst:886 +#: ../../whatsnew/3.12.rst:894 msgid "" "Extend :func:`statistics.correlation` to include as a ``ranked`` method for " "computing the Spearman correlation of ranked data. (Contributed by Raymond " "Hettinger in :gh:`95861`.)" msgstr "" -#: ../../whatsnew/3.12.rst:891 +#: ../../whatsnew/3.12.rst:899 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.12.rst:893 +#: ../../whatsnew/3.12.rst:901 msgid "" "Add the :mod:`sys.monitoring` namespace to expose the new :ref:`PEP 669 " -"<whatsnew312-pep669>` monitoring API. (Contributed by Mark Shannon " -"in :gh:`103082`.)" +"<whatsnew312-pep669>` monitoring API. (Contributed by Mark Shannon in :gh:" +"`103082`.)" msgstr "" -#: ../../whatsnew/3.12.rst:897 +#: ../../whatsnew/3.12.rst:905 msgid "" -"Add :func:`sys.activate_stack_trampoline` " -"and :func:`sys.deactivate_stack_trampoline` for activating and deactivating " -"stack profiler trampolines, and :func:`sys.is_stack_trampoline_active` for " -"querying if stack profiler trampolines are active. (Contributed by Pablo " -"Galindo and Christian Heimes with contributions from Gregory P. Smith " -"[Google] and Mark Shannon in :gh:`96123`.)" +"Add :func:`sys.activate_stack_trampoline` and :func:`sys." +"deactivate_stack_trampoline` for activating and deactivating stack profiler " +"trampolines, and :func:`sys.is_stack_trampoline_active` for querying if " +"stack profiler trampolines are active. (Contributed by Pablo Galindo and " +"Christian Heimes with contributions from Gregory P. Smith [Google] and Mark " +"Shannon in :gh:`96123`.)" msgstr "" -#: ../../whatsnew/3.12.rst:906 +#: ../../whatsnew/3.12.rst:914 msgid "" "Add :data:`sys.last_exc` which holds the last unhandled exception that was " "raised (for post-mortem debugging use cases). Deprecate the three fields " -"that have the same information in its legacy " -"form: :data:`sys.last_type`, :data:`sys.last_value` " -"and :data:`sys.last_traceback`. (Contributed by Irit Katriel " -"in :gh:`102778`.)" +"that have the same information in its legacy form: :data:`sys.last_type`, :" +"data:`sys.last_value` and :data:`sys.last_traceback`. (Contributed by Irit " +"Katriel in :gh:`102778`.)" msgstr "" -#: ../../whatsnew/3.12.rst:912 ../../whatsnew/3.12.rst:1731 +#: ../../whatsnew/3.12.rst:920 ../../whatsnew/3.12.rst:1739 msgid "" ":func:`sys._current_exceptions` now returns a mapping from thread-id to an " "exception instance, rather than to a ``(typ, exc, tb)`` tuple. (Contributed " "by Irit Katriel in :gh:`103176`.)" msgstr "" -#: ../../whatsnew/3.12.rst:916 +#: ../../whatsnew/3.12.rst:924 msgid "" ":func:`sys.setrecursionlimit` and :func:`sys.getrecursionlimit`. The " "recursion limit now applies only to Python code. Builtin functions do not " @@ -1380,11 +1402,11 @@ msgid "" "prevents recursion from causing a virtual machine crash." msgstr "" -#: ../../whatsnew/3.12.rst:922 +#: ../../whatsnew/3.12.rst:930 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.12.rst:924 +#: ../../whatsnew/3.12.rst:932 msgid "" "The :class:`tempfile.NamedTemporaryFile` function has a new optional " "parameter *delete_on_close* (Contributed by Evgeny Zorin in :gh:`58451`.)" @@ -1392,7 +1414,7 @@ msgstr "" ":class:`tempfile.NamedTemporaryFile` 函式新增了一個選擇性參數 " "*delete_on_close* (由 Evgeny Zorin 於 :gh:`58451` 中貢獻。)" -#: ../../whatsnew/3.12.rst:926 +#: ../../whatsnew/3.12.rst:934 msgid "" ":func:`tempfile.mkdtemp` now always returns an absolute path, even if the " "argument provided to the *dir* parameter is a relative path." @@ -1400,23 +1422,23 @@ msgstr "" ":func:`tempfile.mkdtemp` 現在總是會傳回絕對路徑,即使提供給 *dir* 參數的引數" "是相對路徑。" -#: ../../whatsnew/3.12.rst:930 +#: ../../whatsnew/3.12.rst:938 msgid "threading" msgstr "threading" -#: ../../whatsnew/3.12.rst:932 +#: ../../whatsnew/3.12.rst:940 msgid "" -"Add :func:`threading.settrace_all_threads` " -"and :func:`threading.setprofile_all_threads` that allow to set tracing and " -"profiling functions in all running threads in addition to the calling one. " -"(Contributed by Pablo Galindo in :gh:`93503`.)" +"Add :func:`threading.settrace_all_threads` and :func:`threading." +"setprofile_all_threads` that allow to set tracing and profiling functions in " +"all running threads in addition to the calling one. (Contributed by Pablo " +"Galindo in :gh:`93503`.)" msgstr "" -#: ../../whatsnew/3.12.rst:938 +#: ../../whatsnew/3.12.rst:946 msgid "tkinter" msgstr "tkinter" -#: ../../whatsnew/3.12.rst:940 +#: ../../whatsnew/3.12.rst:948 msgid "" "``tkinter.Canvas.coords()`` now flattens its arguments. It now accepts not " "only coordinates as separate arguments (``x1, y1, x2, y2, ...``) and a " @@ -1426,48 +1448,47 @@ msgid "" "in :gh:`94473`.)" msgstr "" -#: ../../whatsnew/3.12.rst:949 +#: ../../whatsnew/3.12.rst:957 msgid "tokenize" msgstr "tokenize" -#: ../../whatsnew/3.12.rst:951 +#: ../../whatsnew/3.12.rst:959 msgid "" "The :mod:`tokenize` module includes the changes introduced in :pep:`701`. " -"(Contributed by Marta Gómez Macías and Pablo Galindo in :gh:`102856`.) " -"See :ref:`whatsnew312-porting-to-python312` for more information on the " -"changes to the :mod:`tokenize` module." +"(Contributed by Marta Gómez Macías and Pablo Galindo in :gh:`102856`.) See :" +"ref:`whatsnew312-porting-to-python312` for more information on the changes " +"to the :mod:`tokenize` module." msgstr "" -#: ../../whatsnew/3.12.rst:957 +#: ../../whatsnew/3.12.rst:965 msgid "types" msgstr "types" -#: ../../whatsnew/3.12.rst:959 +#: ../../whatsnew/3.12.rst:967 msgid "" -"Add :func:`types.get_original_bases` to allow for further introspection " -"of :ref:`user-defined-generics` when subclassed. (Contributed by James " -"Hilton-Balfe and Alex Waygood in :gh:`101827`.)" +"Add :func:`types.get_original_bases` to allow for further introspection of :" +"ref:`user-defined-generics` when subclassed. (Contributed by James Hilton-" +"Balfe and Alex Waygood in :gh:`101827`.)" msgstr "" -#: ../../whatsnew/3.12.rst:966 +#: ../../whatsnew/3.12.rst:974 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.12.rst:968 +#: ../../whatsnew/3.12.rst:976 msgid "" -":func:`isinstance` checks against :func:`runtime-checkable protocols " -"<typing.runtime_checkable>` now use :func:`inspect.getattr_static` rather " -"than :func:`hasattr` to lookup whether attributes exist. This means that " -"descriptors and :meth:`~object.__getattr__` methods are no longer " -"unexpectedly evaluated during ``isinstance()`` checks against runtime-" -"checkable protocols. However, it may also mean that some objects which used " -"to be considered instances of a runtime-checkable protocol may no longer be " -"considered instances of that protocol on Python 3.12+, and vice versa. Most " -"users are unlikely to be affected by this change. (Contributed by Alex " -"Waygood in :gh:`102433`.)" +":func:`isinstance` checks against :func:`runtime-checkable protocols <typing." +"runtime_checkable>` now use :func:`inspect.getattr_static` rather than :func:" +"`hasattr` to lookup whether attributes exist. This means that descriptors " +"and :meth:`~object.__getattr__` methods are no longer unexpectedly evaluated " +"during ``isinstance()`` checks against runtime-checkable protocols. However, " +"it may also mean that some objects which used to be considered instances of " +"a runtime-checkable protocol may no longer be considered instances of that " +"protocol on Python 3.12+, and vice versa. Most users are unlikely to be " +"affected by this change. (Contributed by Alex Waygood in :gh:`102433`.)" msgstr "" -#: ../../whatsnew/3.12.rst:979 +#: ../../whatsnew/3.12.rst:987 msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " @@ -1475,7 +1496,7 @@ msgid "" "on :func:`isinstance` checks comparing objects to the protocol. For example::" msgstr "" -#: ../../whatsnew/3.12.rst:984 +#: ../../whatsnew/3.12.rst:992 msgid "" ">>> from typing import Protocol, runtime_checkable\n" ">>> @runtime_checkable\n" @@ -1512,31 +1533,31 @@ msgstr "" ">>> isinstance(f, HasX) # 沒有改變,即便 HasX 現在有 \"y\" 屬性\n" "True" -#: ../../whatsnew/3.12.rst:1001 +#: ../../whatsnew/3.12.rst:1009 msgid "" "This change was made in order to speed up ``isinstance()`` checks against " "runtime-checkable protocols." msgstr "" -#: ../../whatsnew/3.12.rst:1004 +#: ../../whatsnew/3.12.rst:1012 msgid "" "The performance profile of :func:`isinstance` checks against :func:`runtime-" "checkable protocols <typing.runtime_checkable>` has changed significantly. " "Most ``isinstance()`` checks against protocols with only a few members " "should be at least 2x faster than in 3.11, and some may be 20x faster or " "more. However, ``isinstance()`` checks against protocols with many members " -"may be slower than in Python 3.11. (Contributed by Alex Waygood " -"in :gh:`74690` and :gh:`103193`.)" +"may be slower than in Python 3.11. (Contributed by Alex Waygood in :gh:" +"`74690` and :gh:`103193`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1012 +#: ../../whatsnew/3.12.rst:1020 msgid "" "All :data:`typing.TypedDict` and :data:`typing.NamedTuple` classes now have " "the ``__orig_bases__`` attribute. (Contributed by Adrian Garcia Badaracco " "in :gh:`103699`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1016 +#: ../../whatsnew/3.12.rst:1024 msgid "" "Add ``frozen_default`` parameter to :func:`typing.dataclass_transform`. " "(Contributed by Erik De Bonte in :gh:`99957`.)" @@ -1544,26 +1565,26 @@ msgstr "" "新增 ``frozen_default`` 參數至 :func:`typing.dataclass_transform`。(由 Erik " "De Bonte 於 :gh:`99957` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1020 +#: ../../whatsnew/3.12.rst:1028 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.12.rst:1022 +#: ../../whatsnew/3.12.rst:1030 msgid "" "The Unicode database has been updated to version 15.0.0. (Contributed by " "Benjamin Peterson in :gh:`96734`)." msgstr "" -#: ../../whatsnew/3.12.rst:1026 ../../whatsnew/3.12.rst:1576 +#: ../../whatsnew/3.12.rst:1034 ../../whatsnew/3.12.rst:1584 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.12.rst:1028 +#: ../../whatsnew/3.12.rst:1036 msgid "" "Add a ``--durations`` command line option, showing the N slowest test cases::" msgstr "新增 ``--durations`` 命令列選項,顯示 N 個最慢的測試案例:" -#: ../../whatsnew/3.12.rst:1030 +#: ../../whatsnew/3.12.rst:1038 msgid "" "python3 -m unittest --durations=3 lib.tests.test_threading\n" ".....\n" @@ -1593,15 +1614,15 @@ msgstr "" "\n" "OK (skipped=3)" -#: ../../whatsnew/3.12.rst:1044 +#: ../../whatsnew/3.12.rst:1052 msgid "(Contributed by Giampaolo Rodola in :gh:`48330`)" msgstr "(由 Giampaolo Rodola 於 :gh:`48330` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1047 +#: ../../whatsnew/3.12.rst:1055 msgid "uuid" msgstr "uuid" -#: ../../whatsnew/3.12.rst:1049 +#: ../../whatsnew/3.12.rst:1057 msgid "" "Add a :ref:`command-line interface <uuid-cli>`. (Contributed by Adam Chhina " "in :gh:`88597`.)" @@ -1609,33 +1630,33 @@ msgstr "" "新增一個\\ :ref:`命令列介面 <uuid-cli>`。(由 Adam Chhina 於 :gh:`88597` 中貢" "獻。)" -#: ../../whatsnew/3.12.rst:1054 +#: ../../whatsnew/3.12.rst:1062 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.12.rst:1056 +#: ../../whatsnew/3.12.rst:1064 msgid "" "Remove ``wstr`` and ``wstr_length`` members from Unicode objects. It reduces " "object size by 8 or 16 bytes on 64bit platform. (:pep:`623`) (Contributed by " "Inada Naoki in :gh:`92536`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1060 +#: ../../whatsnew/3.12.rst:1068 msgid "" "Add experimental support for using the BOLT binary optimizer in the build " "process, which improves performance by 1-5%. (Contributed by Kevin " "Modzelewski in :gh:`90536` and tuned by Donghee Na in :gh:`101525`)" msgstr "" -#: ../../whatsnew/3.12.rst:1064 +#: ../../whatsnew/3.12.rst:1072 msgid "" -"Speed up the regular expression substitution (functions :func:`re.sub` " -"and :func:`re.subn` and corresponding :class:`!re.Pattern` methods) for " +"Speed up the regular expression substitution (functions :func:`re.sub` and :" +"func:`re.subn` and corresponding :class:`!re.Pattern` methods) for " "replacement strings containing group references by 2--3 times. (Contributed " "by Serhiy Storchaka in :gh:`91524`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1069 +#: ../../whatsnew/3.12.rst:1077 msgid "" "Speed up :class:`asyncio.Task` creation by deferring expensive string " "formatting. (Contributed by Itamar Oren in :gh:`103793`.)" @@ -1643,54 +1664,53 @@ msgstr "" "透過延遲運算較繁重的字串格式化來加速 :class:`asyncio.Task` 的建立。(由 " "Itamar Oren 於 :gh:`103793` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1072 +#: ../../whatsnew/3.12.rst:1080 msgid "" "The :func:`tokenize.tokenize` and :func:`tokenize.generate_tokens` functions " -"are up to 64% faster as a side effect of the changes required to " -"cover :pep:`701` in the :mod:`tokenize` module. (Contributed by Marta Gómez " -"Macías and Pablo Galindo in :gh:`102856`.)" +"are up to 64% faster as a side effect of the changes required to cover :pep:" +"`701` in the :mod:`tokenize` module. (Contributed by Marta Gómez Macías and " +"Pablo Galindo in :gh:`102856`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1077 +#: ../../whatsnew/3.12.rst:1085 msgid "" -"Speed up :func:`super` method calls and attribute loads via the " -"new :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and " -"Vladimir Matveev in :gh:`103497`.)" +"Speed up :func:`super` method calls and attribute loads via the new :opcode:" +"`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and Vladimir " +"Matveev in :gh:`103497`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1083 +#: ../../whatsnew/3.12.rst:1091 msgid "CPython bytecode changes" msgstr "CPython 位元組碼變更" -#: ../../whatsnew/3.12.rst:1085 +#: ../../whatsnew/3.12.rst:1093 msgid "" -"Remove the :opcode:`!LOAD_METHOD` instruction. It has been merged " -"into :opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the " -"old :opcode:`!LOAD_METHOD` instruction if the low bit of its oparg is set. " -"(Contributed by Ken Jin in :gh:`93429`.)" +"Remove the :opcode:`!LOAD_METHOD` instruction. It has been merged into :" +"opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the old :opcode:" +"`!LOAD_METHOD` instruction if the low bit of its oparg is set. (Contributed " +"by Ken Jin in :gh:`93429`.)" msgstr "" -"移除 :opcode:`!LOAD_METHOD` 指令。它已經合併" -"至 :opcode:`LOAD_ATTR`。:opcode:`LOAD_ATTR` 現在會像舊的 :opcode:`!" -"LOAD_METHOD` 指令一樣行為,如果其 oparg 的低位元 (low bit) 有被設定。(由 " -"Ken Jin 於 :gh:`93429` 中貢獻。)" +"移除 :opcode:`!LOAD_METHOD` 指令。它已經合併至 :opcode:`LOAD_ATTR`。:opcode:" +"`LOAD_ATTR` 現在會像舊的 :opcode:`!LOAD_METHOD` 指令一樣行為,如果其 oparg 的" +"低位元 (low bit) 有被設定。(由 Ken Jin 於 :gh:`93429` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1090 +#: ../../whatsnew/3.12.rst:1098 msgid "" "Remove the :opcode:`!JUMP_IF_FALSE_OR_POP` and :opcode:`!" -"JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel " -"in :gh:`102859`.)" +"JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel in :gh:" +"`102859`.)" msgstr "" "移除 :opcode:`!JUMP_IF_FALSE_OR_POP` 和 :opcode:`!JUMP_IF_TRUE_OR_POP` 指令。" "(由 Irit Katriel 於 :gh:`102859` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1093 +#: ../../whatsnew/3.12.rst:1101 msgid "" -"Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon " -"in :gh:`92925`.)" +"Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon in :" +"gh:`92925`.)" msgstr "" "移除 :opcode:`!PRECALL` 指令。(由 Mark Shannon 於 :gh:`92925` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1096 +#: ../../whatsnew/3.12.rst:1104 msgid "" "Add the :opcode:`BINARY_SLICE` and :opcode:`STORE_SLICE` instructions. " "(Contributed by Mark Shannon in :gh:`94163`.)" @@ -1698,7 +1718,7 @@ msgstr "" "新增 :opcode:`BINARY_SLICE` 和 :opcode:`STORE_SLICE` 指令。(由 Mark Shannon " "於 :gh:`94163` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1099 +#: ../../whatsnew/3.12.rst:1107 msgid "" "Add the :opcode:`CALL_INTRINSIC_1` instructions. (Contributed by Mark " "Shannon in :gh:`99005`.)" @@ -1706,7 +1726,7 @@ msgstr "" "新增 :opcode:`CALL_INTRINSIC_1` 指令。(由 Mark Shannon 於 :gh:`99005` 中貢" "獻。)" -#: ../../whatsnew/3.12.rst:1102 +#: ../../whatsnew/3.12.rst:1110 msgid "" "Add the :opcode:`CALL_INTRINSIC_2` instruction. (Contributed by Irit Katriel " "in :gh:`101799`.)" @@ -1714,7 +1734,7 @@ msgstr "" "新增 :opcode:`CALL_INTRINSIC_2` 指令。(由 Irit Katriel 於 :gh:`101799` 中貢" "獻。)" -#: ../../whatsnew/3.12.rst:1105 +#: ../../whatsnew/3.12.rst:1113 msgid "" "Add the :opcode:`CLEANUP_THROW` instruction. (Contributed by Brandt Bucher " "in :gh:`90997`.)" @@ -1722,14 +1742,14 @@ msgstr "" "新增 :opcode:`CLEANUP_THROW` 指令。(由 Brandt Bucher 於 :gh:`90997` 中貢" "獻。)" -#: ../../whatsnew/3.12.rst:1108 +#: ../../whatsnew/3.12.rst:1116 msgid "" -"Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon " -"in :gh:`103082`.)" +"Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon in :gh:" +"`103082`.)" msgstr "" "新增 :opcode:`!END_SEND` 指令。(由 Mark Shannon 於 :gh:`103082` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1111 +#: ../../whatsnew/3.12.rst:1119 msgid "" "Add the :opcode:`LOAD_FAST_AND_CLEAR` instruction as part of the " "implementation of :pep:`709`. (Contributed by Carl Meyer in :gh:`101441`.)" @@ -1737,7 +1757,7 @@ msgstr "" "新增 :opcode:`LOAD_FAST_AND_CLEAR` 指令作為 :pep:`709` 實作的一部分。(由 " "Carl Meyer 於 :gh:`101441` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1114 +#: ../../whatsnew/3.12.rst:1122 msgid "" "Add the :opcode:`LOAD_FAST_CHECK` instruction. (Contributed by Dennis " "Sweeney in :gh:`93143`.)" @@ -1745,60 +1765,59 @@ msgstr "" "新增 :opcode:`LOAD_FAST_CHECK` 指令。(由 Dennis Sweeney 於 :gh:`93143` 中貢" "獻。)" -#: ../../whatsnew/3.12.rst:1117 +#: ../../whatsnew/3.12.rst:1125 msgid "" -"Add " -"the :opcode:`LOAD_FROM_DICT_OR_DEREF`, :opcode:`LOAD_FROM_DICT_OR_GLOBALS`, " -"and :opcode:`LOAD_LOCALS` opcodes as part of the implementation " -"of :pep:`695`. Remove the :opcode:`!LOAD_CLASSDEREF` opcode, which can be " -"replaced with :opcode:`LOAD_LOCALS` plus :opcode:`LOAD_FROM_DICT_OR_DEREF`. " -"(Contributed by Jelle Zijlstra in :gh:`103764`.)" +"Add the :opcode:`LOAD_FROM_DICT_OR_DEREF`, :opcode:" +"`LOAD_FROM_DICT_OR_GLOBALS`, and :opcode:`LOAD_LOCALS` opcodes as part of " +"the implementation of :pep:`695`. Remove the :opcode:`!LOAD_CLASSDEREF` " +"opcode, which can be replaced with :opcode:`LOAD_LOCALS` plus :opcode:" +"`LOAD_FROM_DICT_OR_DEREF`. (Contributed by Jelle Zijlstra in :gh:`103764`.)" msgstr "" "新增 :opcode:`LOAD_FROM_DICT_OR_DEREF`、:opcode:`LOAD_FROM_DICT_OR_GLOBALS` " "和 :opcode:`LOAD_LOCALS` 操作碼作為 :pep:`695` 實作的一部分。移除 :opcode:`!" -"LOAD_CLASSDEREF` 操作碼,可以用 :opcode:`LOAD_LOCALS` 加" -"上 :opcode:`LOAD_FROM_DICT_OR_DEREF` 來取代。(由 Jelle Zijlstra " -"於 :gh:`103764` 中貢獻。)" +"LOAD_CLASSDEREF` 操作碼,可以用 :opcode:`LOAD_LOCALS` 加上 :opcode:" +"`LOAD_FROM_DICT_OR_DEREF` 來取代。(由 Jelle Zijlstra 於 :gh:`103764` 中貢" +"獻。)" -#: ../../whatsnew/3.12.rst:1123 +#: ../../whatsnew/3.12.rst:1131 msgid "" "Add the :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer " "and Vladimir Matveev in :gh:`103497`.)" msgstr "" -"新增 :opcode:`LOAD_SUPER_ATTR` 指令。(由 Carl Meyer 和 Vladimir Matveev " -"於 :gh:`103497` 中貢獻。)" +"新增 :opcode:`LOAD_SUPER_ATTR` 指令。(由 Carl Meyer 和 Vladimir Matveev 於 :" +"gh:`103497` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1126 +#: ../../whatsnew/3.12.rst:1134 msgid "" -"Add the :opcode:`RETURN_CONST` instruction. (Contributed by Wenyang Wang " -"in :gh:`101632`.)" +"Add the :opcode:`RETURN_CONST` instruction. (Contributed by Wenyang Wang in :" +"gh:`101632`.)" msgstr "" "新增 :opcode:`RETURN_CONST` 指令。(由 Wenyang Wang 於 :gh:`101632` 中貢" "獻。)" -#: ../../whatsnew/3.12.rst:1129 +#: ../../whatsnew/3.12.rst:1137 msgid "Demos and Tools" msgstr "" -#: ../../whatsnew/3.12.rst:1131 +#: ../../whatsnew/3.12.rst:1139 msgid "" "Remove the ``Tools/demo/`` directory which contained old demo scripts. A " "copy can be found in the `old-demos project <https://github.com/gvanrossum/" "old-demos>`_. (Contributed by Victor Stinner in :gh:`97681`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1136 +#: ../../whatsnew/3.12.rst:1144 msgid "" "Remove outdated example scripts of the ``Tools/scripts/`` directory. A copy " "can be found in the `old-demos project <https://github.com/gvanrossum/old-" "demos>`_. (Contributed by Victor Stinner in :gh:`97669`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1143 ../../whatsnew/3.12.rst:2134 +#: ../../whatsnew/3.12.rst:1151 ../../whatsnew/3.12.rst:2142 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.12.rst:1145 +#: ../../whatsnew/3.12.rst:1153 #: ../../deprecations/pending-removal-in-3.14.rst:4 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" @@ -1809,7 +1828,7 @@ msgstr "" "*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " "於 :gh:`92248` 貢獻。)" -#: ../../whatsnew/3.12.rst:1150 +#: ../../whatsnew/3.12.rst:1158 msgid "" ":mod:`ast`: The following :mod:`ast` features have been deprecated in " "documentation since Python 3.8, now cause a :exc:`DeprecationWarning` to be " @@ -1820,66 +1839,67 @@ msgstr "" "或使用時會在 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移" "除:" -#: ../../whatsnew/3.12.rst:1154 +#: ../../whatsnew/3.12.rst:1162 #: ../../deprecations/pending-removal-in-3.14.rst:13 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" -#: ../../whatsnew/3.12.rst:1155 +#: ../../whatsnew/3.12.rst:1163 #: ../../deprecations/pending-removal-in-3.14.rst:14 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" -#: ../../whatsnew/3.12.rst:1156 +#: ../../whatsnew/3.12.rst:1164 #: ../../deprecations/pending-removal-in-3.14.rst:15 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" -#: ../../whatsnew/3.12.rst:1157 +#: ../../whatsnew/3.12.rst:1165 #: ../../deprecations/pending-removal-in-3.14.rst:16 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" -#: ../../whatsnew/3.12.rst:1158 +#: ../../whatsnew/3.12.rst:1166 #: ../../deprecations/pending-removal-in-3.14.rst:17 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" -#: ../../whatsnew/3.12.rst:1160 +#: ../../whatsnew/3.12.rst:1168 #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" -"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka " -"in :gh:`90953`.)" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" +"`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" -#: ../../whatsnew/3.12.rst:1163 +#: ../../whatsnew/3.12.rst:1171 #: ../../deprecations/pending-removal-in-3.14.rst:22 #: ../../deprecations/pending-removal-in-3.16.rst:19 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" -#: ../../whatsnew/3.12.rst:1165 +#: ../../whatsnew/3.12.rst:1173 msgid "" -"The child watcher " -"classes :class:`asyncio.MultiLoopChildWatcher`, :class:`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher` " -"and :class:`asyncio.SafeChildWatcher` are deprecated and will be removed in " -"Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +"The child watcher classes :class:`asyncio.MultiLoopChildWatcher`, :class:" +"`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher` and :class:" +"`asyncio.SafeChildWatcher` are deprecated and will be removed in Python " +"3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1171 +#: ../../whatsnew/3.12.rst:1179 #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" -":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " -"and :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated " -"and will be removed in Python 3.14. (Contributed by Kumar Aditya " -"in :gh:`94597`.)" +":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" +"`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." +"AbstractEventLoopPolicy.get_child_watcher` are deprecated and will be " +"removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " -"和 :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 " -"Python 3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" +":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:" +"`asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`asyncio." +"AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" +"除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" -#: ../../whatsnew/3.12.rst:1177 +#: ../../whatsnew/3.12.rst:1185 #: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " @@ -1891,122 +1911,116 @@ msgstr "" "件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" -#: ../../whatsnew/3.12.rst:1182 -#: ../../deprecations/pending-removal-in-future.rst:41 +#: ../../whatsnew/3.12.rst:1190 +#: ../../deprecations/pending-removal-in-future.rst:39 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " -"are deprecated and replaced by :data:`calendar.JANUARY` " -"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " -"in :gh:`103636`.)" +"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." +"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" msgstr "" ":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " "Roshan 於 :gh:`103636` 貢獻。)" -#: ../../whatsnew/3.12.rst:1186 +#: ../../whatsnew/3.12.rst:1194 msgid "" ":mod:`collections.abc`: Deprecated :class:`collections.abc.ByteString`. " "Prefer :class:`Sequence` or :class:`collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, " -"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " -"in :gh:`91896`.)" +"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." +"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1191 +#: ../../whatsnew/3.12.rst:1199 msgid "" -":mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime.utcnow` " -"and :meth:`~datetime.datetime.utcfromtimestamp` are deprecated and will be " -"removed in a future version. Instead, use timezone-aware objects to " -"represent datetimes in UTC: respectively, " -"call :meth:`~datetime.datetime.now` " -"and :meth:`~datetime.datetime.fromtimestamp` with the *tz* parameter set " -"to :const:`datetime.UTC`. (Contributed by Paul Ganssle in :gh:`103857`.)" +":mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime." +"utcnow` and :meth:`~datetime.datetime.utcfromtimestamp` are deprecated and " +"will be removed in a future version. Instead, use timezone-aware objects to " +"represent datetimes in UTC: respectively, call :meth:`~datetime.datetime." +"now` and :meth:`~datetime.datetime.fromtimestamp` with the *tz* parameter " +"set to :const:`datetime.UTC`. (Contributed by Paul Ganssle in :gh:`103857`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1199 +#: ../../whatsnew/3.12.rst:1207 msgid "" -":mod:`email`: Deprecate the *isdst* parameter " -"in :func:`email.utils.localtime`. (Contributed by Alan Williams " -"in :gh:`72346`.)" +":mod:`email`: Deprecate the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" msgstr "" ":mod:`email`:棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1202 +#: ../../whatsnew/3.12.rst:1210 msgid "" ":mod:`importlib.abc`: Deprecated the following classes, scheduled for " "removal in Python 3.14:" msgstr ":mod:`importlib.abc`:棄用下列類別,預定於 Python 3.14 中移除:" -#: ../../whatsnew/3.12.rst:1205 +#: ../../whatsnew/3.12.rst:1213 #: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../whatsnew/3.12.rst:1206 +#: ../../whatsnew/3.12.rst:1214 #: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../whatsnew/3.12.rst:1207 +#: ../../whatsnew/3.12.rst:1215 #: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../whatsnew/3.12.rst:1209 +#: ../../whatsnew/3.12.rst:1217 #: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../whatsnew/3.12.rst:1211 +#: ../../whatsnew/3.12.rst:1219 #: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../whatsnew/3.12.rst:1212 +#: ../../whatsnew/3.12.rst:1220 #: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../whatsnew/3.12.rst:1214 +#: ../../whatsnew/3.12.rst:1222 #: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../whatsnew/3.12.rst:1216 +#: ../../whatsnew/3.12.rst:1224 msgid "" ":mod:`itertools`: Deprecate the support for copy, deepcopy, and pickle " "operations, which is undocumented, inefficient, historically buggy, and " "inconsistent. This will be removed in 3.14 for a significant reduction in " -"code volume and maintenance burden. (Contributed by Raymond Hettinger " -"in :gh:`101588`.)" +"code volume and maintenance burden. (Contributed by Raymond Hettinger in :gh:" +"`101588`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1222 +#: ../../whatsnew/3.12.rst:1230 msgid "" ":mod:`multiprocessing`: In Python 3.14, the default :mod:`multiprocessing` " "start method will change to a safer one on Linux, BSDs, and other non-macOS " "POSIX platforms where ``'fork'`` is currently the default (:gh:`84559`). " "Adding a runtime warning about this was deemed too disruptive as the " -"majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` " -"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " -"your code *requires* ``'fork'``. See :ref:`contexts and start methods " -"<multiprocessing-start-methods>`." +"majority of code is not expected to care. Use the :func:`~multiprocessing." +"get_context` or :func:`~multiprocessing.set_start_method` APIs to explicitly " +"specify when your code *requires* ``'fork'``. See :ref:`contexts and start " +"methods <multiprocessing-start-methods>`." msgstr "" -#: ../../whatsnew/3.12.rst:1232 +#: ../../whatsnew/3.12.rst:1240 msgid "" ":mod:`pkgutil`: :func:`pkgutil.find_loader` and :func:`pkgutil.get_loader` " -"are deprecated and will be removed in Python 3.14; " -"use :func:`importlib.util.find_spec` instead. (Contributed by Nikita Sobolev " -"in :gh:`97850`.)" +"are deprecated and will be removed in Python 3.14; use :func:`importlib.util." +"find_spec` instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`pkgutil.find_loader` 和 :func:`pkgutil.get_loader` 已" "被棄用並將在 Python 3.14 中移除;請改用 :func:`importlib.util.find_spec`。" "(由 Nikita Sobolev 於 :gh:`97850` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1237 +#: ../../whatsnew/3.12.rst:1245 msgid "" ":mod:`pty`: The module has two undocumented ``master_open()`` and " "``slave_open()`` functions that have been deprecated since Python 2 but only " @@ -2014,11 +2028,11 @@ msgid "" "(Contributed by Soumendra Ganguly and Gregory P. Smith in :gh:`85984`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1242 +#: ../../whatsnew/3.12.rst:1250 msgid ":mod:`os`:" msgstr ":mod:`os`:" -#: ../../whatsnew/3.12.rst:1244 +#: ../../whatsnew/3.12.rst:1252 msgid "" "The ``st_ctime`` fields return by :func:`os.stat` and :func:`os.lstat` on " "Windows are deprecated. In a future release, they will contain the last " @@ -2027,50 +2041,49 @@ msgid "" "``st_birthtime`` field. (Contributed by Steve Dower in :gh:`99726`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1250 +#: ../../whatsnew/3.12.rst:1258 msgid "" -"On POSIX platforms, :func:`os.fork` can now raise " -"a :exc:`DeprecationWarning` when it can detect being called from a " -"multithreaded process. There has always been a fundamental incompatibility " -"with the POSIX platform when doing so. Even if such code *appeared* to work. " -"We added the warning to raise awareness as issues encountered by code doing " -"this are becoming more frequent. See the :func:`os.fork` documentation for " -"more details along with `this discussion on fork being incompatible with " -"threads <https://discuss.python.org/t/concerns-regarding-deprecation-of-fork-" -"with-alive-threads/33555>`_ for *why* we're now surfacing this longstanding " +"On POSIX platforms, :func:`os.fork` can now raise a :exc:" +"`DeprecationWarning` when it can detect being called from a multithreaded " +"process. There has always been a fundamental incompatibility with the POSIX " +"platform when doing so. Even if such code *appeared* to work. We added the " +"warning to raise awareness as issues encountered by code doing this are " +"becoming more frequent. See the :func:`os.fork` documentation for more " +"details along with `this discussion on fork being incompatible with threads " +"<https://discuss.python.org/t/concerns-regarding-deprecation-of-fork-with-" +"alive-threads/33555>`_ for *why* we're now surfacing this longstanding " "platform compatibility problem to developers." msgstr "" -#: ../../whatsnew/3.12.rst:1260 +#: ../../whatsnew/3.12.rst:1268 msgid "" -"When this warning appears due to usage of :mod:`multiprocessing` " -"or :mod:`concurrent.futures` the fix is to use a " -"different :mod:`multiprocessing` start method such as ``\"spawn\"`` or " -"``\"forkserver\"``." +"When this warning appears due to usage of :mod:`multiprocessing` or :mod:" +"`concurrent.futures` the fix is to use a different :mod:`multiprocessing` " +"start method such as ``\"spawn\"`` or ``\"forkserver\"``." msgstr "" -#: ../../whatsnew/3.12.rst:1264 +#: ../../whatsnew/3.12.rst:1272 msgid "" ":mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree` is " -"deprecated; use *onexc* instead. (Contributed by Irit Katriel " -"in :gh:`102828`.)" +"deprecated; use *onexc* instead. (Contributed by Irit Katriel in :gh:" +"`102828`.)" msgstr "" ":mod:`shutil`::func:`shutil.rmtree` 的 *onerror* 引數已被棄用,請改用 " "*onexc*。(由 Irit Katriel 於 :gh:`102828` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1267 +#: ../../whatsnew/3.12.rst:1275 #: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../whatsnew/3.12.rst:1269 +#: ../../whatsnew/3.12.rst:1277 msgid "" ":ref:`default adapters and converters <sqlite3-default-converters>` are now " "deprecated. Instead, use the :ref:`sqlite3-adapter-converter-recipes` and " "tailor them to your needs. (Contributed by Erlend E. Aasland in :gh:`90016`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1275 +#: ../../whatsnew/3.12.rst:1283 msgid "" "In :meth:`~sqlite3.Cursor.execute`, :exc:`DeprecationWarning` is now emitted " "when :ref:`named placeholders <sqlite3-placeholders>` are used together with " @@ -2080,44 +2093,43 @@ msgid "" "Erlend E. Aasland in :gh:`101698`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1282 +#: ../../whatsnew/3.12.rst:1290 msgid "" -":mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` " -"and :data:`sys.last_traceback` fields are deprecated. " -"Use :data:`sys.last_exc` instead. (Contributed by Irit Katriel " -"in :gh:`102778`.)" +":mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` and :data:`sys." +"last_traceback` fields are deprecated. Use :data:`sys.last_exc` instead. " +"(Contributed by Irit Katriel in :gh:`102778`.)" msgstr "" -":mod:`sys`::data:`sys.last_type`、:data:`sys.last_value` " -"和 :data:`sys.last_traceback` 欄位已被棄用。請改用 :data:`sys.last_exc`。" -"(由 Irit Katriel 於 :gh:`102778` 中貢獻。)" +":mod:`sys`::data:`sys.last_type`、:data:`sys.last_value` 和 :data:`sys." +"last_traceback` 欄位已被棄用。請改用 :data:`sys.last_exc`。(由 Irit Katriel " +"於 :gh:`102778` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1286 +#: ../../whatsnew/3.12.rst:1294 msgid "" ":mod:`tarfile`: Extracting tar archives without specifying *filter* is " "deprecated until Python 3.14, when ``'data'`` filter will become the " "default. See :ref:`tarfile-extraction-filter` for details." msgstr "" -#: ../../whatsnew/3.12.rst:1290 -#: ../../deprecations/pending-removal-in-3.15.rst:71 +#: ../../whatsnew/3.12.rst:1298 +#: ../../deprecations/pending-removal-in-3.15.rst:80 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../whatsnew/3.12.rst:1292 +#: ../../whatsnew/3.12.rst:1300 msgid "" -":class:`typing.Hashable` and :class:`typing.Sized`, aliases " -"for :class:`collections.abc.Hashable` and :class:`collections.abc.Sized` " -"respectively, are deprecated. (:gh:`94309`.)" +":class:`typing.Hashable` and :class:`typing.Sized`, aliases for :class:" +"`collections.abc.Hashable` and :class:`collections.abc.Sized` respectively, " +"are deprecated. (:gh:`94309`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1296 +#: ../../whatsnew/3.12.rst:1304 msgid "" -":class:`typing.ByteString`, deprecated since Python 3.9, now causes " -"a :exc:`DeprecationWarning` to be emitted when it is used. (Contributed by " -"Alex Waygood in :gh:`91896`.)" +":class:`typing.ByteString`, deprecated since Python 3.9, now causes a :exc:" +"`DeprecationWarning` to be emitted when it is used. (Contributed by Alex " +"Waygood in :gh:`91896`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1300 +#: ../../whatsnew/3.12.rst:1308 msgid "" ":mod:`xml.etree.ElementTree`: The module now emits :exc:`DeprecationWarning` " "when testing the truth value of an :class:`xml.etree.ElementTree.Element`. " @@ -2125,32 +2137,32 @@ msgid "" "implementation emitted nothing. (Contributed by Jacob Walls in :gh:`83122`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1306 +#: ../../whatsnew/3.12.rst:1314 msgid "" "The 3-arg signatures (type, value, traceback) of :meth:`coroutine throw() " -"<coroutine.throw>`, :meth:`generator throw() <generator.throw>` " -"and :meth:`async generator throw() <agen.athrow>` are deprecated and may be " -"removed in a future version of Python. Use the single-arg versions of these " -"functions instead. (Contributed by Ofey Chan in :gh:`89874`.)" +"<coroutine.throw>`, :meth:`generator throw() <generator.throw>` and :meth:" +"`async generator throw() <agen.athrow>` are deprecated and may be removed in " +"a future version of Python. Use the single-arg versions of these functions " +"instead. (Contributed by Ofey Chan in :gh:`89874`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1312 +#: ../../whatsnew/3.12.rst:1320 msgid "" ":exc:`DeprecationWarning` is now raised when :attr:`~module.__package__` on " -"a module differs from :attr:`__spec__.parent " -"<importlib.machinery.ModuleSpec.parent>` (previously it " -"was :exc:`ImportWarning`). (Contributed by Brett Cannon in :gh:`65961`.)" +"a module differs from :attr:`__spec__.parent <importlib.machinery.ModuleSpec." +"parent>` (previously it was :exc:`ImportWarning`). (Contributed by Brett " +"Cannon in :gh:`65961`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1318 +#: ../../whatsnew/3.12.rst:1326 msgid "" "Setting :attr:`~module.__package__` or :attr:`~module.__cached__` on a " "module is deprecated, and will cease to be set or taken into consideration " -"by the import system in Python 3.14. (Contributed by Brett Cannon " -"in :gh:`65961`.)" +"by the import system in Python 3.14. (Contributed by Brett Cannon in :gh:" +"`65961`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1322 +#: ../../whatsnew/3.12.rst:1330 msgid "" "The bitwise inversion operator (``~``) on bool is deprecated. It will throw " "an error in Python 3.16. Use ``not`` for logical negation of bools instead. " @@ -2159,16 +2171,16 @@ msgid "" "Tim Hoffmann in :gh:`103487`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1328 +#: ../../whatsnew/3.12.rst:1336 msgid "" "Accessing :attr:`~codeobject.co_lnotab` on code objects was deprecated in " -"Python 3.10 via :pep:`626`, but it only got a " -"proper :exc:`DeprecationWarning` in 3.12. May be removed in 3.15. " -"(Contributed by Nikita Sobolev in :gh:`101866`.)" +"Python 3.10 via :pep:`626`, but it only got a proper :exc:" +"`DeprecationWarning` in 3.12. May be removed in 3.15. (Contributed by Nikita " +"Sobolev in :gh:`101866`.)" msgstr "" -"自 3.10 起,於程式碼物件存取 :attr:`~codeobject.co_lnotab` 的功能已" -"在 :pep:`626` 中被棄用,但只在 3.12 中於適時發出 :exc:`DeprecationWarning`。" -"可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:`101866` 貢獻。)" +"自 3.10 起,於程式碼物件存取 :attr:`~codeobject.co_lnotab` 的功能已在 :pep:" +"`626` 中被棄用,但只在 3.12 中於適時發出 :exc:`DeprecationWarning`。可能在 " +"3.15 中移除。(由 Nikita Sobolev 於 :gh:`101866` 貢獻。)" #: ../../deprecations/pending-removal-in-3.13.rst:2 msgid "Pending Removal in Python 3.13" @@ -2360,35 +2372,32 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" -"The child watcher " -"classes :class:`~asyncio.MultiLoopChildWatcher`, :class:`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` " -"and :class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " +"The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" +"`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" +"class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " "Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類" -"別::class:`~asyncio.MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio.AbstractChildWatcher` " -"和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar Aditya 於 :gh:`94597` 貢" -"獻。)" +"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`~asyncio." +"MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio." +"AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " +"Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:41 msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, " -"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " -"in :gh:`91896`.)" -msgstr "" -":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改" -"用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" -"時,請改用聯集,如 ``bytes | bytearray``," -"或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" -"獻。)" +"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." +"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" +msgstr "" +":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改用 :" +"class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用時,請" +"改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " +"Shantanu Jain 於 :gh:`91896` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" -":mod:`email`: Deprecated the *isdst* parameter " -"in :func:`email.utils.localtime`. (Contributed by Alan Williams " -"in :gh:`72346`.)" +":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" @@ -2414,25 +2423,24 @@ msgid "" "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " "currently the default (:gh:`84559`). Adding a runtime warning about this was " "deemed too disruptive as the majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` " -"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " -"your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`." +"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." +"set_start_method` APIs to explicitly specify when your code *requires* " +"``'fork'``. See :ref:`multiprocessing-start-methods`." msgstr "" ":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平" "台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。對此增加一" -"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使" -"用 :func:`~multiprocessing.get_context` " -"或 :func:`~multiprocessing.set_start_method` API 來明確指定你的程式碼何時\\ *" -"需要* ``'fork'``。請參閱 :ref:`multiprocessing-start-methods`。" +"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用 :func:" +"`~multiprocessing.get_context` 或 :func:`~multiprocessing.set_start_method` " +"API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" +"`multiprocessing-start-methods`。" #: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" -":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` " -"and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments is " -"deprecated." +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." +"PurePath.relative_to`: passing additional arguments is deprecated." msgstr "" -":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` " -"和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" +":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" +"`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" #: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" @@ -2441,9 +2449,8 @@ msgid "" "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`~pkgutil.find_loader` 和 :func:`~pkgutil.get_loader` " -"現在會引發 :exc:`DeprecationWarning`;請改" -"用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" -"獻。)" +"現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." +"find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" @@ -2463,9 +2470,9 @@ msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" #: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" -":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` " -"if :ref:`named placeholders <sqlite3-placeholders>` are used and " -"*parameters* is a sequence instead of a :class:`dict`." +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" +"ref:`named placeholders <sqlite3-placeholders>` are used and *parameters* is " +"a sequence instead of a :class:`dict`." msgstr "" ":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如果" "使用 :ref:`named placeholders <sqlite3-placeholders>` 且 *parameters* 是序列" @@ -2482,8 +2489,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " -"intended to be a public API. (Contributed by Gregory P. Smith " -"in :gh:`88168`.)" +"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" +"`88168`.)" msgstr "" ":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 API。" "(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" @@ -2500,10 +2507,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to " -"set :attr:`__spec__.cached <importlib.machinery.ModuleSpec.cached>` is " -"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " -"into consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached <importlib.machinery.ModuleSpec.cached>` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "<importlib.machinery.ModuleSpec.cached>` 的做法已被棄用。在 Python 3.15 中," @@ -2511,11 +2518,10 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to " -"set :attr:`__spec__.parent <importlib.machinery.ModuleSpec.parent>` is " -"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " -"take into consideration by the import system or standard library. " -"(:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent <importlib.machinery.ModuleSpec.parent>` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "<importlib.machinery.ModuleSpec.parent>` 的做法已被棄用。在 Python 3.15 中," @@ -2555,41 +2561,48 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:56 +msgid ":mod:`importlib`:" +msgstr ":mod:`importlib`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "``load_module()`` method:請改用 ``exec_module()``。" + +#: ../../deprecations/pending-removal-in-3.15.rst:36 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:34 +#: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 " -"(:gh:`90817`), but has been postponed to Python 3.15. " -"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " -"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " -"in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" -"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " -"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" -"獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " -"Use :func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" -"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:48 +#: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:54 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -2598,11 +2611,23 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:54 +#: ../../deprecations/pending-removal-in-3.15.rst:58 +msgid ":mod:`sysconfig`:" +msgstr ":mod:`sysconfig`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:60 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." +msgstr "" +":func:`sysconfig.is_python_build` 的 *check_home* 引數自 Python 3.12 起已被棄" +"用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:63 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:56 +#: ../../deprecations/pending-removal-in-3.15.rst:65 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -2613,11 +2638,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:62 +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`types`:" msgstr ":mod:`types`:" -#: ../../deprecations/pending-removal-in-3.15.rst:64 +#: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -2625,22 +2650,22 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" -"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " -"於 :gh:`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:73 +#: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" -"The undocumented keyword argument syntax for " -"creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " -"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " -"3.13. Use the class-based syntax or the functional syntax instead." +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " +"has been deprecated since Python 3.13. Use the class-based syntax or the " +"functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:79 +#: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -2650,20 +2675,19 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:84 +#: ../../deprecations/pending-removal-in-3.15.rst:93 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" -#: ../../deprecations/pending-removal-in-3.15.rst:86 +#: ../../deprecations/pending-removal-in-3.15.rst:95 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " -"and :meth:`~wave.Wave_read.getmarkers` methods of " -"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " -"deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" -"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " -"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending removal in Python 3.16" @@ -2671,10 +2695,10 @@ msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to " -"set :attr:`__spec__.loader <importlib.machinery.ModuleSpec.loader>` is " -"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " -"taken into consideration by the import system or the standard library." +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader <importlib.machinery.ModuleSpec.loader>` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." msgstr "" "在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " "<importlib.machinery.ModuleSpec.loader>` 的做法將於 Python 3.16 被棄用。在 " @@ -2701,11 +2725,11 @@ msgid "" "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" ":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" -"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " -"於 :gh:`122875` 貢獻。)" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" +"gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 -#: ../../deprecations/pending-removal-in-future.rst:12 +#: ../../deprecations/pending-removal-in-future.rst:10 msgid ":mod:`builtins`:" msgstr ":mod:`builtins`:" @@ -2789,15 +2813,11 @@ msgid "" "groups are deprecated." msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" -#: ../../deprecations/pending-removal-in-future.rst:10 -msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" -msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" - -#: ../../deprecations/pending-removal-in-future.rst:14 +#: ../../deprecations/pending-removal-in-future.rst:12 msgid "``bool(NotImplemented)``." msgstr "``bool(NotImplemented)``。" -#: ../../deprecations/pending-removal-in-future.rst:15 +#: ../../deprecations/pending-removal-in-future.rst:13 msgid "" "Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " "is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " @@ -2806,25 +2826,25 @@ msgstr "" "產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" "請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" -#: ../../deprecations/pending-removal-in-future.rst:18 +#: ../../deprecations/pending-removal-in-future.rst:16 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " -"if the numeric literal is immediately followed by one of " -"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " -"and :keyword:`or`. In a future release it will be changed to a syntax " -"error. (:gh:`87999`)" +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " "1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " -"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" -"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " -"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" -"法錯誤。(:gh:`87999`)" +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" +"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" +"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" +"本中,它將被更改為語法錯誤。(:gh:`87999`)" -#: ../../deprecations/pending-removal-in-future.rst:26 +#: ../../deprecations/pending-removal-in-future.rst:24 msgid "" "Support for ``__index__()`` and ``__int__()`` method returning non-int type: " "these methods will be required to return an instance of a strict subclass " @@ -2833,78 +2853,70 @@ msgstr "" "``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" "傳 :class:`int` 的嚴格子類別實例。" -#: ../../deprecations/pending-removal-in-future.rst:29 +#: ../../deprecations/pending-removal-in-future.rst:27 msgid "" -"Support for ``__float__()`` method returning a strict subclass " -"of :class:`float`: these methods will be required to return an instance " -"of :class:`float`." +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:30 msgid "" -"Support for ``__complex__()`` method returning a strict subclass " -"of :class:`complex`: these methods will be required to return an instance " -"of :class:`complex`." +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:35 +#: ../../deprecations/pending-removal-in-future.rst:33 msgid "Delegation of ``int()`` to ``__trunc__()`` method." msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:36 +#: ../../deprecations/pending-removal-in-future.rst:34 msgid "" -"Passing a complex number as the *real* or *imag* argument in " -"the :func:`complex` constructor is now deprecated; it should only be passed " -"as a single positional argument. (Contributed by Serhiy Storchaka " -"in :gh:`109218`.)" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:46 +#: ../../deprecations/pending-removal-in-future.rst:44 msgid "" ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " "instead." msgstr "" ":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:49 +#: ../../deprecations/pending-removal-in-future.rst:47 msgid ":mod:`datetime`:" msgstr ":mod:`datetime`:" -#: ../../deprecations/pending-removal-in-future.rst:51 +#: ../../deprecations/pending-removal-in-future.rst:49 msgid "" -":meth:`~datetime.datetime.utcnow`: use " -"``datetime.datetime.now(tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." msgstr "" -":meth:`~datetime.datetime.utcnow`:請改用 " -"``datetime.datetime.now(tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." +"now(tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:53 +#: ../../deprecations/pending-removal-in-future.rst:51 msgid "" -":meth:`~datetime.datetime.utcfromtimestamp`: use " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:56 +#: ../../deprecations/pending-removal-in-future.rst:54 msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" #: ../../deprecations/pending-removal-in-future.rst:58 -msgid ":mod:`importlib`:" -msgstr ":mod:`importlib`:" - -#: ../../deprecations/pending-removal-in-future.rst:60 -msgid "``load_module()`` method: use ``exec_module()`` instead." -msgstr "``load_module()`` method:請改用 ``exec_module()``。" - -#: ../../deprecations/pending-removal-in-future.rst:61 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -2912,39 +2924,39 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:61 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:63 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:67 +#: ../../deprecations/pending-removal-in-future.rst:64 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:66 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" -":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" -"用 :meth:`~logging.warning`。" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" +"`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:69 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:75 +#: ../../deprecations/pending-removal-in-future.rst:72 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:74 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -2952,7 +2964,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:80 +#: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -2964,12 +2976,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:87 +#: ../../deprecations/pending-removal-in-future.rst:84 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:86 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -2977,115 +2989,108 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:89 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:94 +#: ../../deprecations/pending-removal-in-future.rst:91 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:92 msgid "" -":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " -"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" -":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " -"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" +"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:95 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:96 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:97 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:105 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:107 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:109 -msgid "" -":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " -"ignored." -msgstr "" -":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" - -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid "" -":meth:`!threading.Condition.notifyAll`: " -"use :meth:`~threading.Condition.notify_all`." +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." msgstr "" -":meth:`!threading.Condition.notifyAll`:請" -"用 :meth:`~threading.Condition.notify_all`。" +":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." +"notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:116 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "" -":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " -"use :attr:`threading.Thread.daemon` attribute." +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid "" -":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " -"use :attr:`threading.Thread.name` attribute." +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." msgstr "" -":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" -"用 :attr:`threading.Thread.name` 屬性。" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" +"attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:121 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:123 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:119 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -3093,119 +3098,119 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:122 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:124 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:125 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:126 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:127 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:129 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:138 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:142 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "" -":mod:`urllib.request`: :class:`~urllib.request.URLopener` " -"and :class:`~urllib.request.FancyURLopener` style of invoking requests is " -"deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods." +":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" +"`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " +"Use newer :func:`~urllib.request.urlopen` functions and methods." msgstr "" -":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` " -"和 :class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新" -"的 :func:`~urllib.request.urlopen` 函式和方法。" +":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` 和 :" +"class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" +"`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:149 +#: ../../deprecations/pending-removal-in-future.rst:143 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of " -"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " -"release it will always return ``True``. Prefer explicit ``len(elem)`` or " -"``elem is not None`` tests instead." +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." msgstr "" -":mod:`xml.etree.ElementTree`:已棄用" -"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" -"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" +":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." +"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " +"``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:154 +#: ../../deprecations/pending-removal-in-future.rst:148 msgid "" -":meth:`zipimport.zipimporter.load_module` is deprecated: " -"use :meth:`~zipimport.zipimporter.exec_module` instead." +":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" +"`~zipimport.zipimporter.exec_module` instead." msgstr "" -":meth:`zipimport.zipimporter.load_module` 已被棄用:請改" -"用 :meth:`~zipimport.zipimporter.exec_module`。" +":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." +"zipimporter.exec_module`。" -#: ../../whatsnew/3.12.rst:1347 ../../whatsnew/3.12.rst:2229 +#: ../../whatsnew/3.12.rst:1355 ../../whatsnew/3.12.rst:2237 msgid "Removed" msgstr "已移除" -#: ../../whatsnew/3.12.rst:1350 +#: ../../whatsnew/3.12.rst:1358 msgid "asynchat and asyncore" msgstr "asynchat 和 asyncore" -#: ../../whatsnew/3.12.rst:1352 +#: ../../whatsnew/3.12.rst:1360 msgid "" "These two modules have been removed according to the schedule in :pep:`594`, " "having been deprecated in Python 3.6. Use :mod:`asyncio` instead. " "(Contributed by Nikita Sobolev in :gh:`96580`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1359 +#: ../../whatsnew/3.12.rst:1367 msgid "configparser" msgstr "configparser" -#: ../../whatsnew/3.12.rst:1361 +#: ../../whatsnew/3.12.rst:1369 msgid "" "Several names deprecated in the :mod:`configparser` way back in 3.2 have " "been removed per :gh:`89336`:" msgstr "" "根據 :gh:`89336`,已移除了在 3.2 中被 :mod:`configparser` 棄用的幾個名稱:" -#: ../../whatsnew/3.12.rst:1364 +#: ../../whatsnew/3.12.rst:1372 msgid "" ":class:`configparser.ParsingError` no longer has a ``filename`` attribute or " "argument. Use the ``source`` attribute and argument instead." @@ -3213,27 +3218,27 @@ msgstr "" ":class:`configparser.ParsingError` 不再具有 ``filename`` 屬性或引數。請改用 " "``source`` 屬性和引數。" -#: ../../whatsnew/3.12.rst:1366 +#: ../../whatsnew/3.12.rst:1374 msgid "" ":mod:`configparser` no longer has a ``SafeConfigParser`` class. Use the " "shorter :class:`~configparser.ConfigParser` name instead." msgstr "" -":mod:`configparser` 不再具有 ``SafeConfigParser`` 類別。請改用較短" -"的 :class:`~configparser.ConfigParser` 名稱。" +":mod:`configparser` 不再具有 ``SafeConfigParser`` 類別。請改用較短的 :class:" +"`~configparser.ConfigParser` 名稱。" -#: ../../whatsnew/3.12.rst:1368 +#: ../../whatsnew/3.12.rst:1376 msgid "" -":class:`configparser.ConfigParser` no longer has a ``readfp`` method. " -"Use :meth:`~configparser.ConfigParser.read_file` instead." +":class:`configparser.ConfigParser` no longer has a ``readfp`` method. Use :" +"meth:`~configparser.ConfigParser.read_file` instead." msgstr "" -":class:`configparser.ConfigParser` 不再具有 ``readfp`` 方法。請改" -"用 :meth:`~configparser.ConfigParser.read_file`。" +":class:`configparser.ConfigParser` 不再具有 ``readfp`` 方法。請改用 :meth:" +"`~configparser.ConfigParser.read_file`。" -#: ../../whatsnew/3.12.rst:1374 +#: ../../whatsnew/3.12.rst:1382 msgid "distutils" msgstr "distutils" -#: ../../whatsnew/3.12.rst:1376 +#: ../../whatsnew/3.12.rst:1384 msgid "" "Remove the :py:mod:`!distutils` package. It was deprecated in Python 3.10 " "by :pep:`632` \"Deprecate distutils module\". For projects still using " @@ -3242,17 +3247,17 @@ msgid "" "Victor Stinner in :gh:`92584`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1383 +#: ../../whatsnew/3.12.rst:1391 msgid "ensurepip" msgstr "ensurepip" -#: ../../whatsnew/3.12.rst:1385 +#: ../../whatsnew/3.12.rst:1393 msgid "" "Remove the bundled setuptools wheel from :mod:`ensurepip`, and stop " "installing setuptools in environments created by :mod:`venv`." msgstr "" -#: ../../whatsnew/3.12.rst:1388 +#: ../../whatsnew/3.12.rst:1396 msgid "" "``pip (>= 22.1)`` does not require setuptools to be installed in the " "environment. ``setuptools``-based (and ``distutils``-based) packages can " @@ -3260,7 +3265,7 @@ msgid "" "the build environment it uses for building a package." msgstr "" -#: ../../whatsnew/3.12.rst:1394 +#: ../../whatsnew/3.12.rst:1402 msgid "" "``easy_install``, ``pkg_resources``, ``setuptools`` and ``distutils`` are no " "longer provided by default in environments created with ``venv`` or " @@ -3270,15 +3275,15 @@ msgid "" "(typically, using pip)." msgstr "" -#: ../../whatsnew/3.12.rst:1401 +#: ../../whatsnew/3.12.rst:1409 msgid "(Contributed by Pradyun Gedam in :gh:`95299`.)" msgstr "(由 Pradyun Gedam 於 :gh:`95299` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1404 +#: ../../whatsnew/3.12.rst:1412 msgid "enum" msgstr "enum" -#: ../../whatsnew/3.12.rst:1406 +#: ../../whatsnew/3.12.rst:1414 msgid "" "Remove :mod:`enum`'s ``EnumMeta.__getattr__``, which is no longer needed for " "enum attribute access. (Contributed by Ethan Furman in :gh:`95083`.)" @@ -3286,11 +3291,11 @@ msgstr "" "移除 :mod:`enum` 的 ``EnumMeta.__getattr__``,對於列舉屬性的存取不再會需要" "它。" -#: ../../whatsnew/3.12.rst:1411 +#: ../../whatsnew/3.12.rst:1419 msgid "ftplib" msgstr "ftplib" -#: ../../whatsnew/3.12.rst:1413 +#: ../../whatsnew/3.12.rst:1421 msgid "" "Remove :mod:`ftplib`'s ``FTP_TLS.ssl_version`` class attribute: use the " "*context* parameter instead. (Contributed by Victor Stinner in :gh:`94172`.)" @@ -3298,43 +3303,43 @@ msgstr "" "移除 :mod:`ftplib` 的 ``FTP_TLS.ssl_version`` 類別屬性:請改用 *context* 參" "數。(由 Victor Stinner 於 :gh:`94172` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1418 +#: ../../whatsnew/3.12.rst:1426 msgid "gzip" msgstr "gzip" -#: ../../whatsnew/3.12.rst:1420 +#: ../../whatsnew/3.12.rst:1428 msgid "" "Remove the ``filename`` attribute of :mod:`gzip`'s :class:`gzip.GzipFile`, " "deprecated since Python 2.6, use the :attr:`~gzip.GzipFile.name` attribute " "instead. In write mode, the ``filename`` attribute added ``'.gz'`` file " -"extension if it was not present. (Contributed by Victor Stinner " -"in :gh:`94196`.)" +"extension if it was not present. (Contributed by Victor Stinner in :gh:" +"`94196`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1427 +#: ../../whatsnew/3.12.rst:1435 msgid "hashlib" msgstr "hashlib" -#: ../../whatsnew/3.12.rst:1429 +#: ../../whatsnew/3.12.rst:1437 msgid "" -"Remove the pure Python implementation " -"of :mod:`hashlib`'s :func:`hashlib.pbkdf2_hmac`, deprecated in Python 3.10. " -"Python 3.10 and newer requires OpenSSL 1.1.1 (:pep:`644`): this OpenSSL " -"version provides a C implementation of :func:`~hashlib.pbkdf2_hmac` which is " -"faster. (Contributed by Victor Stinner in :gh:`94199`.)" +"Remove the pure Python implementation of :mod:`hashlib`'s :func:`hashlib." +"pbkdf2_hmac`, deprecated in Python 3.10. Python 3.10 and newer requires " +"OpenSSL 1.1.1 (:pep:`644`): this OpenSSL version provides a C implementation " +"of :func:`~hashlib.pbkdf2_hmac` which is faster. (Contributed by Victor " +"Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1436 ../../whatsnew/3.12.rst:1465 +#: ../../whatsnew/3.12.rst:1444 ../../whatsnew/3.12.rst:1473 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.12.rst:1438 +#: ../../whatsnew/3.12.rst:1446 msgid "" "Many previously deprecated cleanups in :mod:`importlib` have now been " "completed:" msgstr "現已完成清理 :mod:`importlib` 中許多過去已經棄用的東西:" -#: ../../whatsnew/3.12.rst:1441 +#: ../../whatsnew/3.12.rst:1449 msgid "" "References to, and support for :meth:`!module_repr` has been removed. " "(Contributed by Barry Warsaw in :gh:`97850`.)" @@ -3342,136 +3347,136 @@ msgstr "" "對 :meth:`!module_repr` 的參照和支援已刪除。(由 Barry Warsaw 在 :gh:`97850` " "中貢獻。)" -#: ../../whatsnew/3.12.rst:1444 +#: ../../whatsnew/3.12.rst:1452 msgid "" "``importlib.util.set_package``, ``importlib.util.set_loader`` and " "``importlib.util.module_for_loader`` have all been removed. (Contributed by " "Brett Cannon and Nikita Sobolev in :gh:`65961` and :gh:`97850`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1448 +#: ../../whatsnew/3.12.rst:1456 msgid "" "Support for ``find_loader()`` and ``find_module()`` APIs have been removed. " "(Contributed by Barry Warsaw in :gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1451 +#: ../../whatsnew/3.12.rst:1459 msgid "" "``importlib.abc.Finder``, ``pkgutil.ImpImporter``, and ``pkgutil.ImpLoader`` " "have been removed. (Contributed by Barry Warsaw in :gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1457 ../../whatsnew/3.12.rst:1465 +#: ../../whatsnew/3.12.rst:1465 ../../whatsnew/3.12.rst:1473 msgid "imp" msgstr "imp" -#: ../../whatsnew/3.12.rst:1459 +#: ../../whatsnew/3.12.rst:1467 msgid "" -"The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw " -"in :gh:`98040`.)" +"The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in :" +"gh:`98040`.)" msgstr ":mod:`!imp` 模組已被移除。(由 Barry Warsaw 在 :gh:`98040` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1462 +#: ../../whatsnew/3.12.rst:1470 msgid "To migrate, consult the following correspondence table:" msgstr "要遷移的話請參考以下對應表:" -#: ../../whatsnew/3.12.rst:1467 +#: ../../whatsnew/3.12.rst:1475 msgid "``imp.NullImporter``" msgstr "``imp.NullImporter``" -#: ../../whatsnew/3.12.rst:1467 +#: ../../whatsnew/3.12.rst:1475 msgid "Insert ``None`` into ``sys.path_importer_cache``" msgstr "將 ``None`` 插入 ``sys.path_importer_cache``" -#: ../../whatsnew/3.12.rst:1468 +#: ../../whatsnew/3.12.rst:1476 msgid "``imp.cache_from_source()``" msgstr "``imp.cache_from_source()``" -#: ../../whatsnew/3.12.rst:1468 +#: ../../whatsnew/3.12.rst:1476 msgid ":func:`importlib.util.cache_from_source`" msgstr ":func:`importlib.util.cache_from_source`" -#: ../../whatsnew/3.12.rst:1469 +#: ../../whatsnew/3.12.rst:1477 msgid "``imp.find_module()``" msgstr "``imp.find_module()``" -#: ../../whatsnew/3.12.rst:1469 +#: ../../whatsnew/3.12.rst:1477 msgid ":func:`importlib.util.find_spec`" msgstr ":func:`importlib.util.find_spec`" -#: ../../whatsnew/3.12.rst:1470 +#: ../../whatsnew/3.12.rst:1478 msgid "``imp.get_magic()``" msgstr "``imp.get_magic()``" -#: ../../whatsnew/3.12.rst:1470 +#: ../../whatsnew/3.12.rst:1478 msgid ":const:`importlib.util.MAGIC_NUMBER`" msgstr ":const:`importlib.util.MAGIC_NUMBER`" -#: ../../whatsnew/3.12.rst:1471 +#: ../../whatsnew/3.12.rst:1479 msgid "``imp.get_suffixes()``" msgstr "``imp.get_suffixes()``" -#: ../../whatsnew/3.12.rst:1471 +#: ../../whatsnew/3.12.rst:1479 msgid "" -":const:`importlib.machinery.SOURCE_SUFFIXES`, :const:`importlib.machinery.EXTENSION_SUFFIXES`, " -"and :const:`importlib.machinery.BYTECODE_SUFFIXES`" +":const:`importlib.machinery.SOURCE_SUFFIXES`, :const:`importlib.machinery." +"EXTENSION_SUFFIXES`, and :const:`importlib.machinery.BYTECODE_SUFFIXES`" msgstr "" -":const:`importlib.machinery.SOURCE_SUFFIXES`、:const:`importlib.machinery.EXTENSION_SUFFIXES` " -"和 :const:`importlib.machinery.BYTECODE_SUFFIXES`" +":const:`importlib.machinery.SOURCE_SUFFIXES`、:const:`importlib.machinery." +"EXTENSION_SUFFIXES` 和 :const:`importlib.machinery.BYTECODE_SUFFIXES`" -#: ../../whatsnew/3.12.rst:1472 +#: ../../whatsnew/3.12.rst:1480 msgid "``imp.get_tag()``" msgstr "``imp.get_tag()``" -#: ../../whatsnew/3.12.rst:1472 +#: ../../whatsnew/3.12.rst:1480 msgid ":attr:`sys.implementation.cache_tag <sys.implementation>`" msgstr ":attr:`sys.implementation.cache_tag <sys.implementation>`" -#: ../../whatsnew/3.12.rst:1473 +#: ../../whatsnew/3.12.rst:1481 msgid "``imp.load_module()``" msgstr "``imp.load_module()``" -#: ../../whatsnew/3.12.rst:1473 +#: ../../whatsnew/3.12.rst:1481 msgid ":func:`importlib.import_module`" msgstr ":func:`importlib.import_module`" -#: ../../whatsnew/3.12.rst:1474 +#: ../../whatsnew/3.12.rst:1482 msgid "``imp.new_module(name)``" msgstr "``imp.new_module(name)``" -#: ../../whatsnew/3.12.rst:1474 +#: ../../whatsnew/3.12.rst:1482 msgid "``types.ModuleType(name)``" msgstr "``types.ModuleType(name)``" -#: ../../whatsnew/3.12.rst:1475 +#: ../../whatsnew/3.12.rst:1483 msgid "``imp.reload()``" msgstr "``imp.reload()``" -#: ../../whatsnew/3.12.rst:1475 +#: ../../whatsnew/3.12.rst:1483 msgid ":func:`importlib.reload`" msgstr ":func:`importlib.reload`" -#: ../../whatsnew/3.12.rst:1476 +#: ../../whatsnew/3.12.rst:1484 msgid "``imp.source_from_cache()``" msgstr "``imp.source_from_cache()``" -#: ../../whatsnew/3.12.rst:1476 +#: ../../whatsnew/3.12.rst:1484 msgid ":func:`importlib.util.source_from_cache`" msgstr ":func:`importlib.util.source_from_cache`" -#: ../../whatsnew/3.12.rst:1477 +#: ../../whatsnew/3.12.rst:1485 msgid "``imp.load_source()``" msgstr "``imp.load_source()``" -#: ../../whatsnew/3.12.rst:1477 +#: ../../whatsnew/3.12.rst:1485 msgid "*See below*" msgstr "*見下文*" -#: ../../whatsnew/3.12.rst:1480 +#: ../../whatsnew/3.12.rst:1488 msgid "Replace ``imp.load_source()`` with::" msgstr "用以下取代 ``imp.load_source()``: ::" -#: ../../whatsnew/3.12.rst:1482 +#: ../../whatsnew/3.12.rst:1490 msgid "" "import importlib.util\n" "import importlib.machinery\n" @@ -3501,37 +3506,37 @@ msgstr "" " loader.exec_module(module)\n" " return module" -#: ../../whatsnew/3.12.rst:1495 +#: ../../whatsnew/3.12.rst:1503 msgid "Remove :mod:`!imp` functions and attributes with no replacements:" msgstr "移除 :mod:`!imp` 函式和屬性、沒有替代方案:" -#: ../../whatsnew/3.12.rst:1497 +#: ../../whatsnew/3.12.rst:1505 msgid "Undocumented functions:" msgstr "未以文件記錄的函式:" -#: ../../whatsnew/3.12.rst:1499 +#: ../../whatsnew/3.12.rst:1507 msgid "``imp.init_builtin()``" msgstr "``imp.init_builtin()``" -#: ../../whatsnew/3.12.rst:1500 +#: ../../whatsnew/3.12.rst:1508 msgid "``imp.load_compiled()``" msgstr "``imp.load_compiled()``" -#: ../../whatsnew/3.12.rst:1501 +#: ../../whatsnew/3.12.rst:1509 msgid "``imp.load_dynamic()``" msgstr "``imp.load_dynamic()``" -#: ../../whatsnew/3.12.rst:1502 +#: ../../whatsnew/3.12.rst:1510 msgid "``imp.load_package()``" msgstr "``imp.load_package()``" -#: ../../whatsnew/3.12.rst:1504 +#: ../../whatsnew/3.12.rst:1512 msgid "" "``imp.lock_held()``, ``imp.acquire_lock()``, ``imp.release_lock()``: the " "locking scheme has changed in Python 3.3 to per-module locks." msgstr "" -#: ../../whatsnew/3.12.rst:1506 +#: ../../whatsnew/3.12.rst:1514 msgid "" "``imp.find_module()`` constants: ``SEARCH_ERROR``, ``PY_SOURCE``, " "``PY_COMPILED``, ``C_EXTENSION``, ``PY_RESOURCE``, ``PKG_DIRECTORY``, " @@ -3541,86 +3546,91 @@ msgstr "" "``PY_COMPILED``、``C_EXTENSION``、``PY_RESOURCE``、``PKG_DIRECTORY``、" "``C_BUILTIN``、``PY_FROZEN``、``PY_CODERESOURCE``、``IMP_HOOK``。" -#: ../../whatsnew/3.12.rst:1511 +#: ../../whatsnew/3.12.rst:1519 msgid "io" msgstr "io" -#: ../../whatsnew/3.12.rst:1513 +#: ../../whatsnew/3.12.rst:1521 msgid "" "Remove :mod:`io`'s ``io.OpenWrapper`` and ``_pyio.OpenWrapper``, deprecated " -"in Python 3.10: just use :func:`open` instead. The :func:`open` " -"(:func:`io.open`) function is a built-in function. Since Python " -"3.10, :func:`!_pyio.open` is also a static method. (Contributed by Victor " -"Stinner in :gh:`94169`.)" +"in Python 3.10: just use :func:`open` instead. The :func:`open` (:func:`io." +"open`) function is a built-in function. Since Python 3.10, :func:`!_pyio." +"open` is also a static method. (Contributed by Victor Stinner in :gh:" +"`94169`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1520 +#: ../../whatsnew/3.12.rst:1528 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.12.rst:1522 +#: ../../whatsnew/3.12.rst:1530 msgid "" "Remove :mod:`locale`'s :func:`!locale.format` function, deprecated in Python " "3.7: use :func:`locale.format_string` instead. (Contributed by Victor " "Stinner in :gh:`94226`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1527 +#: ../../whatsnew/3.12.rst:1535 msgid "smtpd" msgstr "smtpd" -#: ../../whatsnew/3.12.rst:1529 +#: ../../whatsnew/3.12.rst:1537 msgid "" -"The ``smtpd`` module has been removed according to the schedule " -"in :pep:`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use " -"the :pypi:`aiosmtpd` PyPI module or any other :mod:`asyncio`-based server " -"instead. (Contributed by Oleg Iarygin in :gh:`93243`.)" +"The ``smtpd`` module has been removed according to the schedule in :pep:" +"`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use the :pypi:" +"`aiosmtpd` PyPI module or any other :mod:`asyncio`-based server instead. " +"(Contributed by Oleg Iarygin in :gh:`93243`.)" msgstr "" +"根據 :pep:`594` 的時間表移除 ``smtpd`` 模組,它在 Python 3.4.7 和 3.5.4 中已" +"被棄用。請改用 PyPI 上的 :pypi:`aiosmtpd` 模組或任何其他基於 :mod:`asyncio` " +"的伺服器。" -#: ../../whatsnew/3.12.rst:1538 +#: ../../whatsnew/3.12.rst:1546 msgid "" "The following undocumented :mod:`sqlite3` features, deprecated in Python " "3.10, are now removed:" msgstr "" +"以下未以文件記錄的 :mod:`sqlite3` 功能已在 Python 3.10 中被棄用、現在已被移" +"除:" -#: ../../whatsnew/3.12.rst:1541 +#: ../../whatsnew/3.12.rst:1549 msgid "``sqlite3.enable_shared_cache()``" msgstr "``sqlite3.enable_shared_cache()``" -#: ../../whatsnew/3.12.rst:1542 +#: ../../whatsnew/3.12.rst:1550 msgid "``sqlite3.OptimizedUnicode``" msgstr "``sqlite3.OptimizedUnicode``" -#: ../../whatsnew/3.12.rst:1544 +#: ../../whatsnew/3.12.rst:1552 msgid "" "If a shared cache must be used, open the database in URI mode using the " "``cache=shared`` query parameter." msgstr "" -#: ../../whatsnew/3.12.rst:1547 +#: ../../whatsnew/3.12.rst:1555 msgid "" -"The ``sqlite3.OptimizedUnicode`` text factory has been an alias " -"for :class:`str` since Python 3.3. Code that previously set the text factory " -"to ``OptimizedUnicode`` can either use ``str`` explicitly, or rely on the " +"The ``sqlite3.OptimizedUnicode`` text factory has been an alias for :class:" +"`str` since Python 3.3. Code that previously set the text factory to " +"``OptimizedUnicode`` can either use ``str`` explicitly, or rely on the " "default value which is also ``str``." msgstr "" -#: ../../whatsnew/3.12.rst:1552 +#: ../../whatsnew/3.12.rst:1560 msgid "(Contributed by Erlend E. Aasland in :gh:`92548`.)" msgstr "(由 Erlend E. Aasland 於 :gh:`92548` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1555 +#: ../../whatsnew/3.12.rst:1563 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.12.rst:1557 +#: ../../whatsnew/3.12.rst:1565 msgid "" "Remove :mod:`ssl`'s :func:`!ssl.RAND_pseudo_bytes` function, deprecated in " "Python 3.6: use :func:`os.urandom` or :func:`ssl.RAND_bytes` instead. " "(Contributed by Victor Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1561 +#: ../../whatsnew/3.12.rst:1569 msgid "" "Remove the :func:`!ssl.match_hostname` function. It was deprecated in Python " "3.7. OpenSSL performs hostname matching since Python 3.7, Python no longer " @@ -3628,175 +3638,178 @@ msgid "" "Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1567 +#: ../../whatsnew/3.12.rst:1575 msgid "" "Remove the :func:`!ssl.wrap_socket` function, deprecated in Python 3.7: " -"instead, create a :class:`ssl.SSLContext` object and call " -"its :class:`ssl.SSLContext.wrap_socket` method. Any package that still " -"uses :func:`!ssl.wrap_socket` is broken and insecure. The function neither " -"sends a SNI TLS extension nor validates the server hostname. Code is subject " -"to :cwe:`295` (Improper Certificate Validation). (Contributed by Victor " -"Stinner in :gh:`94199`.)" +"instead, create a :class:`ssl.SSLContext` object and call its :class:`ssl." +"SSLContext.wrap_socket` method. Any package that still uses :func:`!ssl." +"wrap_socket` is broken and insecure. The function neither sends a SNI TLS " +"extension nor validates the server hostname. Code is subject to :cwe:`295` " +"(Improper Certificate Validation). (Contributed by Victor Stinner in :gh:" +"`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1578 +#: ../../whatsnew/3.12.rst:1586 msgid "Remove many long-deprecated :mod:`unittest` features:" msgstr "移除許多 :mod:`unittest` 中被棄用已久的功能:" -#: ../../whatsnew/3.12.rst:1582 +#: ../../whatsnew/3.12.rst:1590 msgid "A number of :class:`~unittest.TestCase` method aliases:" msgstr "許多 :class:`~unittest.TestCase` 方法別名:" -#: ../../whatsnew/3.12.rst:1585 +#: ../../whatsnew/3.12.rst:1593 msgid "Deprecated alias" msgstr "已棄用的別名" -#: ../../whatsnew/3.12.rst:1585 +#: ../../whatsnew/3.12.rst:1593 msgid "Method Name" msgstr "方法名稱" -#: ../../whatsnew/3.12.rst:1585 +#: ../../whatsnew/3.12.rst:1593 msgid "Deprecated in" msgstr "已棄用於" -#: ../../whatsnew/3.12.rst:1587 +#: ../../whatsnew/3.12.rst:1595 msgid "``failUnless``" msgstr "``failUnless``" -#: ../../whatsnew/3.12.rst:1587 ../../whatsnew/3.12.rst:1594 +#: ../../whatsnew/3.12.rst:1595 ../../whatsnew/3.12.rst:1602 msgid ":meth:`.assertTrue`" msgstr ":meth:`.assertTrue`" -#: ../../whatsnew/3.12.rst:1587 ../../whatsnew/3.12.rst:1588 -#: ../../whatsnew/3.12.rst:1589 ../../whatsnew/3.12.rst:1590 -#: ../../whatsnew/3.12.rst:1591 ../../whatsnew/3.12.rst:1592 -#: ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1595 ../../whatsnew/3.12.rst:1596 +#: ../../whatsnew/3.12.rst:1597 ../../whatsnew/3.12.rst:1598 +#: ../../whatsnew/3.12.rst:1599 ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1601 msgid "3.1" msgstr "3.1" -#: ../../whatsnew/3.12.rst:1588 +#: ../../whatsnew/3.12.rst:1596 msgid "``failIf``" msgstr "``failIf``" -#: ../../whatsnew/3.12.rst:1588 +#: ../../whatsnew/3.12.rst:1596 msgid ":meth:`.assertFalse`" msgstr ":meth:`.assertFalse`" -#: ../../whatsnew/3.12.rst:1589 +#: ../../whatsnew/3.12.rst:1597 msgid "``failUnlessEqual``" msgstr "``failUnlessEqual``" -#: ../../whatsnew/3.12.rst:1589 ../../whatsnew/3.12.rst:1595 +#: ../../whatsnew/3.12.rst:1597 ../../whatsnew/3.12.rst:1603 msgid ":meth:`.assertEqual`" msgstr ":meth:`.assertEqual`" -#: ../../whatsnew/3.12.rst:1590 +#: ../../whatsnew/3.12.rst:1598 msgid "``failIfEqual``" msgstr "``failIfEqual``" -#: ../../whatsnew/3.12.rst:1590 ../../whatsnew/3.12.rst:1596 +#: ../../whatsnew/3.12.rst:1598 ../../whatsnew/3.12.rst:1604 msgid ":meth:`.assertNotEqual`" msgstr ":meth:`.assertNotEqual`" -#: ../../whatsnew/3.12.rst:1591 +#: ../../whatsnew/3.12.rst:1599 msgid "``failUnlessAlmostEqual``" msgstr "``failUnlessAlmostEqual``" -#: ../../whatsnew/3.12.rst:1591 ../../whatsnew/3.12.rst:1597 +#: ../../whatsnew/3.12.rst:1599 ../../whatsnew/3.12.rst:1605 msgid ":meth:`.assertAlmostEqual`" msgstr ":meth:`.assertAlmostEqual`" -#: ../../whatsnew/3.12.rst:1592 +#: ../../whatsnew/3.12.rst:1600 msgid "``failIfAlmostEqual``" msgstr "``failIfAlmostEqual``" -#: ../../whatsnew/3.12.rst:1592 ../../whatsnew/3.12.rst:1598 +#: ../../whatsnew/3.12.rst:1600 ../../whatsnew/3.12.rst:1606 msgid ":meth:`.assertNotAlmostEqual`" msgstr ":meth:`.assertNotAlmostEqual`" -#: ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1601 msgid "``failUnlessRaises``" msgstr "``failUnlessRaises``" -#: ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1601 msgid ":meth:`.assertRaises`" msgstr ":meth:`.assertRaises`" -#: ../../whatsnew/3.12.rst:1594 +#: ../../whatsnew/3.12.rst:1602 msgid "``assert_``" msgstr "``assert_``" -#: ../../whatsnew/3.12.rst:1594 ../../whatsnew/3.12.rst:1595 -#: ../../whatsnew/3.12.rst:1596 ../../whatsnew/3.12.rst:1597 -#: ../../whatsnew/3.12.rst:1598 ../../whatsnew/3.12.rst:1599 -#: ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1602 ../../whatsnew/3.12.rst:1603 +#: ../../whatsnew/3.12.rst:1604 ../../whatsnew/3.12.rst:1605 +#: ../../whatsnew/3.12.rst:1606 ../../whatsnew/3.12.rst:1607 +#: ../../whatsnew/3.12.rst:1608 msgid "3.2" msgstr "3.2" -#: ../../whatsnew/3.12.rst:1595 +#: ../../whatsnew/3.12.rst:1603 msgid "``assertEquals``" msgstr "``assertEquals``" -#: ../../whatsnew/3.12.rst:1596 +#: ../../whatsnew/3.12.rst:1604 msgid "``assertNotEquals``" msgstr "``assertNotEquals``" -#: ../../whatsnew/3.12.rst:1597 +#: ../../whatsnew/3.12.rst:1605 msgid "``assertAlmostEquals``" msgstr "``assertAlmostEquals``" -#: ../../whatsnew/3.12.rst:1598 +#: ../../whatsnew/3.12.rst:1606 msgid "``assertNotAlmostEquals``" msgstr "``assertNotAlmostEquals``" -#: ../../whatsnew/3.12.rst:1599 +#: ../../whatsnew/3.12.rst:1607 msgid "``assertRegexpMatches``" msgstr "``assertRegexpMatches``" -#: ../../whatsnew/3.12.rst:1599 +#: ../../whatsnew/3.12.rst:1607 msgid ":meth:`.assertRegex`" msgstr ":meth:`.assertRegex`" -#: ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1608 msgid "``assertRaisesRegexp``" msgstr "``assertRaisesRegexp``" -#: ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1608 msgid ":meth:`.assertRaisesRegex`" msgstr ":meth:`.assertRaisesRegex`" -#: ../../whatsnew/3.12.rst:1601 +#: ../../whatsnew/3.12.rst:1609 msgid "``assertNotRegexpMatches``" msgstr "``assertNotRegexpMatches``" -#: ../../whatsnew/3.12.rst:1601 +#: ../../whatsnew/3.12.rst:1609 msgid ":meth:`.assertNotRegex`" msgstr ":meth:`.assertNotRegex`" -#: ../../whatsnew/3.12.rst:1601 +#: ../../whatsnew/3.12.rst:1609 msgid "3.5" msgstr "3.5" -#: ../../whatsnew/3.12.rst:1604 +#: ../../whatsnew/3.12.rst:1612 msgid "" "You can use https://github.com/isidentical/teyit to automatically modernise " "your unit tests." msgstr "" +"你可以使用 https://github.com/isidentical/teyit 來自動現代化你的單元測試。" -#: ../../whatsnew/3.12.rst:1607 +#: ../../whatsnew/3.12.rst:1615 msgid "" "Undocumented and broken :class:`~unittest.TestCase` method " "``assertDictContainsSubset`` (deprecated in Python 3.2)." msgstr "" +"未以文件記錄且已失效的 :class:`~unittest.TestCase` 方法 " +"``assertDictContainsSubset``\\ (自 Python 3.2 起已棄用)。" -#: ../../whatsnew/3.12.rst:1610 +#: ../../whatsnew/3.12.rst:1618 msgid "" -"Undocumented :meth:`TestLoader.loadTestsFromModule " -"<unittest.TestLoader.loadTestsFromModule>` parameter *use_load_tests* " -"(deprecated and ignored since Python 3.5)." +"Undocumented :meth:`TestLoader.loadTestsFromModule <unittest.TestLoader." +"loadTestsFromModule>` parameter *use_load_tests* (deprecated and ignored " +"since Python 3.5)." msgstr "" -#: ../../whatsnew/3.12.rst:1614 +#: ../../whatsnew/3.12.rst:1622 msgid "" "An alias of the :class:`~unittest.TextTestResult` class: ``_TextTestResult`` " "(deprecated in Python 3.2)." @@ -3804,26 +3817,26 @@ msgstr "" "對 :class:`~unittest.TextTestResult` 類別的別名:``_TextTestResult``\\ (自 " "Python 3.2 起已棄用)。" -#: ../../whatsnew/3.12.rst:1617 +#: ../../whatsnew/3.12.rst:1625 msgid "(Contributed by Serhiy Storchaka in :gh:`89325`.)" msgstr "(由 Serhiy Storchaka 於 :gh:`89325` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1620 +#: ../../whatsnew/3.12.rst:1628 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.12.rst:1622 +#: ../../whatsnew/3.12.rst:1630 msgid "" "Remove support for obsolete browsers from :mod:`webbrowser`. The removed " "browsers include: Grail, Mosaic, Netscape, Galeon, Skipstone, Iceape, " "Firebird, and Firefox versions 35 and below (:gh:`102871`)." msgstr "" -#: ../../whatsnew/3.12.rst:1627 +#: ../../whatsnew/3.12.rst:1635 msgid "xml.etree.ElementTree" msgstr "xml.etree.ElementTree" -#: ../../whatsnew/3.12.rst:1629 +#: ../../whatsnew/3.12.rst:1637 msgid "" "Remove the ``ElementTree.Element.copy()`` method of the pure Python " "implementation, deprecated in Python 3.10, use the :func:`copy.copy` " @@ -3832,41 +3845,40 @@ msgid "" "Stinner in :gh:`94383`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1636 +#: ../../whatsnew/3.12.rst:1644 msgid "zipimport" msgstr "zipimport" -#: ../../whatsnew/3.12.rst:1638 +#: ../../whatsnew/3.12.rst:1646 msgid "" "Remove :mod:`zipimport`'s ``find_loader()`` and ``find_module()`` methods, " -"deprecated in Python 3.10: use the ``find_spec()`` method instead. " -"See :pep:`451` for the rationale. (Contributed by Victor Stinner " -"in :gh:`94379`.)" +"deprecated in Python 3.10: use the ``find_spec()`` method instead. See :pep:" +"`451` for the rationale. (Contributed by Victor Stinner in :gh:`94379`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1644 +#: ../../whatsnew/3.12.rst:1652 msgid "Others" msgstr "其他" -#: ../../whatsnew/3.12.rst:1646 +#: ../../whatsnew/3.12.rst:1654 msgid "" -"Remove the ``suspicious`` rule from the documentation :file:`Makefile` " -"and :file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint <https://" -"github.com/sphinx-contrib/sphinx-lint>`_. (Contributed by Julien Palard " -"in :gh:`98179`.)" +"Remove the ``suspicious`` rule from the documentation :file:`Makefile` and :" +"file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint <https://github." +"com/sphinx-contrib/sphinx-lint>`_. (Contributed by Julien Palard in :gh:" +"`98179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1651 +#: ../../whatsnew/3.12.rst:1659 msgid "" -"Remove the *keyfile* and *certfile* parameters from " -"the :mod:`ftplib`, :mod:`imaplib`, :mod:`poplib` and :mod:`smtplib` modules, " -"and the *key_file*, *cert_file* and *check_hostname* parameters from " -"the :mod:`http.client` module, all deprecated since Python 3.6. Use the " -"*context* parameter (*ssl_context* in :mod:`imaplib`) instead. (Contributed " -"by Victor Stinner in :gh:`94172`.)" +"Remove the *keyfile* and *certfile* parameters from the :mod:`ftplib`, :mod:" +"`imaplib`, :mod:`poplib` and :mod:`smtplib` modules, and the *key_file*, " +"*cert_file* and *check_hostname* parameters from the :mod:`http.client` " +"module, all deprecated since Python 3.6. Use the *context* parameter " +"(*ssl_context* in :mod:`imaplib`) instead. (Contributed by Victor Stinner " +"in :gh:`94172`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1659 +#: ../../whatsnew/3.12.rst:1667 msgid "" "Remove ``Jython`` compatibility hacks from several stdlib modules and tests. " "(Contributed by Nikita Sobolev in :gh:`99482`.)" @@ -3874,29 +3886,29 @@ msgstr "" "移除數個標準函式庫模組與測試中的 ``Jython`` 相容性修補程式。(由 Nikita " "Sobolev 於 :gh:`99482` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1662 +#: ../../whatsnew/3.12.rst:1670 msgid "" -"Remove ``_use_broken_old_ctypes_structure_semantics_`` flag " -"from :mod:`ctypes` module. (Contributed by Nikita Sobolev in :gh:`99285`.)" +"Remove ``_use_broken_old_ctypes_structure_semantics_`` flag from :mod:" +"`ctypes` module. (Contributed by Nikita Sobolev in :gh:`99285`.)" msgstr "" "移除 :mod:`ctypes` 模組中的 ``_use_broken_old_ctypes_structure_semantics_`` " "旗標。(由 Nikita Sobolev 於 :gh:`99285` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1670 ../../whatsnew/3.12.rst:1994 +#: ../../whatsnew/3.12.rst:1678 ../../whatsnew/3.12.rst:2002 msgid "Porting to Python 3.12" msgstr "移植至 Python 3.12" -#: ../../whatsnew/3.12.rst:1672 +#: ../../whatsnew/3.12.rst:1680 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.12.rst:1676 +#: ../../whatsnew/3.12.rst:1684 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.12.rst:1678 +#: ../../whatsnew/3.12.rst:1686 msgid "" "More strict rules are now applied for numerical group references and group " "names in regular expressions. Only sequence of ASCII digits is now accepted " @@ -3905,7 +3917,7 @@ msgid "" "(Contributed by Serhiy Storchaka in :gh:`91760`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1685 +#: ../../whatsnew/3.12.rst:1693 msgid "" "Remove ``randrange()`` functionality deprecated since Python 3.10. " "Formerly, ``randrange(10.0)`` losslessly converted to ``randrange(10)``. " @@ -3913,11 +3925,11 @@ msgid "" "integer values such as ``randrange(10.5)`` or ``randrange('10')`` has been " "changed from :exc:`ValueError` to :exc:`TypeError`. This also prevents bugs " "where ``randrange(1e25)`` would silently select from a larger range than " -"``randrange(10**25)``. (Originally suggested by Serhiy " -"Storchaka :gh:`86388`.)" +"``randrange(10**25)``. (Originally suggested by Serhiy Storchaka :gh:" +"`86388`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1693 +#: ../../whatsnew/3.12.rst:1701 msgid "" ":class:`argparse.ArgumentParser` changed encoding and error handler for " "reading arguments from file (e.g. ``fromfile_prefix_chars`` option) from " @@ -3927,29 +3939,29 @@ msgid "" "on Windows." msgstr "" -#: ../../whatsnew/3.12.rst:1699 +#: ../../whatsnew/3.12.rst:1707 msgid "" "Remove the ``asyncore``-based ``smtpd`` module deprecated in Python 3.4.7 " -"and 3.5.4. A recommended replacement is the :mod:`asyncio`-" -"based :pypi:`aiosmtpd` PyPI module." +"and 3.5.4. A recommended replacement is the :mod:`asyncio`-based :pypi:" +"`aiosmtpd` PyPI module." msgstr "" -#: ../../whatsnew/3.12.rst:1703 +#: ../../whatsnew/3.12.rst:1711 msgid "" ":func:`shlex.split`: Passing ``None`` for *s* argument now raises an " "exception, rather than reading :data:`sys.stdin`. The feature was deprecated " "in Python 3.9. (Contributed by Victor Stinner in :gh:`94352`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1708 +#: ../../whatsnew/3.12.rst:1716 msgid "" -"The :mod:`os` module no longer accepts bytes-like paths, " -"like :class:`bytearray` and :class:`memoryview` types: only the " -"exact :class:`bytes` type is accepted for bytes strings. (Contributed by " -"Victor Stinner in :gh:`98393`.)" +"The :mod:`os` module no longer accepts bytes-like paths, like :class:" +"`bytearray` and :class:`memoryview` types: only the exact :class:`bytes` " +"type is accepted for bytes strings. (Contributed by Victor Stinner in :gh:" +"`98393`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1713 +#: ../../whatsnew/3.12.rst:1721 msgid "" ":func:`syslog.openlog` and :func:`syslog.closelog` now fail if used in " "subinterpreters. :func:`syslog.syslog` may still be used in subinterpreters, " @@ -3961,7 +3973,7 @@ msgid "" "(Contributed by Donghee Na in :gh:`99127`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1722 +#: ../../whatsnew/3.12.rst:1730 msgid "" "The undocumented locking behavior of :func:`~functools.cached_property` is " "removed, because it locked across all instances of the class, leading to " @@ -3973,36 +3985,34 @@ msgid "" "property getter function or around multi-threaded access points." msgstr "" -#: ../../whatsnew/3.12.rst:1735 +#: ../../whatsnew/3.12.rst:1743 msgid "" -"When extracting tar files using :mod:`tarfile` " -"or :func:`shutil.unpack_archive`, pass the *filter* argument to limit " -"features that may be surprising or dangerous. See :ref:`tarfile-extraction-" -"filter` for details." +"When extracting tar files using :mod:`tarfile` or :func:`shutil." +"unpack_archive`, pass the *filter* argument to limit features that may be " +"surprising or dangerous. See :ref:`tarfile-extraction-filter` for details." msgstr "" -#: ../../whatsnew/3.12.rst:1740 +#: ../../whatsnew/3.12.rst:1748 msgid "" -"The output of the :func:`tokenize.tokenize` " -"and :func:`tokenize.generate_tokens` functions is now changed due to the " -"changes introduced in :pep:`701`. This means that ``STRING`` tokens are not " -"emitted any more for f-strings and the tokens described in :pep:`701` are " -"now produced instead: ``FSTRING_START``, ``FSTRING_MIDDLE`` and " -"``FSTRING_END`` are now emitted for f-string \"string\" parts in addition to " -"the appropriate tokens for the tokenization in the expression components. " -"For example for the f-string ``f\"start {1+1} end\"`` the old version of the " -"tokenizer emitted::" +"The output of the :func:`tokenize.tokenize` and :func:`tokenize." +"generate_tokens` functions is now changed due to the changes introduced in :" +"pep:`701`. This means that ``STRING`` tokens are not emitted any more for f-" +"strings and the tokens described in :pep:`701` are now produced instead: " +"``FSTRING_START``, ``FSTRING_MIDDLE`` and ``FSTRING_END`` are now emitted " +"for f-string \"string\" parts in addition to the appropriate tokens for the " +"tokenization in the expression components. For example for the f-string " +"``f\"start {1+1} end\"`` the old version of the tokenizer emitted::" msgstr "" -#: ../../whatsnew/3.12.rst:1749 +#: ../../whatsnew/3.12.rst:1757 msgid "1,0-1,18: STRING 'f\"start {1+1} end\"'" msgstr "1,0-1,18: STRING 'f\"start {1+1} end\"'" -#: ../../whatsnew/3.12.rst:1751 +#: ../../whatsnew/3.12.rst:1759 msgid "while the new version emits::" msgstr "" -#: ../../whatsnew/3.12.rst:1753 +#: ../../whatsnew/3.12.rst:1761 msgid "" "1,0-1,2: FSTRING_START 'f\"'\n" "1,2-1,8: FSTRING_MIDDLE 'start '\n" @@ -4024,54 +4034,54 @@ msgstr "" "1,13-1,17: FSTRING_MIDDLE ' end'\n" "1,17-1,18: FSTRING_END '\"'" -#: ../../whatsnew/3.12.rst:1763 +#: ../../whatsnew/3.12.rst:1771 msgid "" "Additionally, there may be some minor behavioral changes as a consequence of " "the changes required to support :pep:`701`. Some of these changes include:" msgstr "" -#: ../../whatsnew/3.12.rst:1766 +#: ../../whatsnew/3.12.rst:1774 msgid "" "The ``type`` attribute of the tokens emitted when tokenizing some invalid " "Python characters such as ``!`` has changed from ``ERRORTOKEN`` to ``OP``." msgstr "" -#: ../../whatsnew/3.12.rst:1769 +#: ../../whatsnew/3.12.rst:1777 msgid "" "Incomplete single-line strings now also raise :exc:`tokenize.TokenError` as " "incomplete multiline strings do." msgstr "" -#: ../../whatsnew/3.12.rst:1772 +#: ../../whatsnew/3.12.rst:1780 msgid "" "Some incomplete or invalid Python code now raises :exc:`tokenize.TokenError` " "instead of returning arbitrary ``ERRORTOKEN`` tokens when tokenizing it." msgstr "" -#: ../../whatsnew/3.12.rst:1775 +#: ../../whatsnew/3.12.rst:1783 msgid "" "Mixing tabs and spaces as indentation in the same file is not supported " "anymore and will raise a :exc:`TabError`." msgstr "" -#: ../../whatsnew/3.12.rst:1778 +#: ../../whatsnew/3.12.rst:1786 msgid "" "The :mod:`threading` module now expects the :mod:`!_thread` module to have " "an ``_is_main_interpreter`` attribute. It is a function with no arguments " "that returns ``True`` if the current interpreter is the main interpreter." msgstr "" -#: ../../whatsnew/3.12.rst:1783 +#: ../../whatsnew/3.12.rst:1791 msgid "" "Any library or application that provides a custom ``_thread`` module should " "provide ``_is_main_interpreter()``. (See :gh:`112826`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1788 +#: ../../whatsnew/3.12.rst:1796 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.12.rst:1790 +#: ../../whatsnew/3.12.rst:1798 msgid "" "Python no longer uses :file:`setup.py` to build shared C extension modules. " "Build parameters like headers and libraries are detected in ``configure`` " @@ -4080,69 +4090,69 @@ msgid "" "in :gh:`93939`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1796 +#: ../../whatsnew/3.12.rst:1804 msgid "" "``va_start()`` with two parameters, like ``va_start(args, format),`` is now " "required to build Python. ``va_start()`` is no longer called with a single " "parameter. (Contributed by Kumar Aditya in :gh:`93207`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1801 +#: ../../whatsnew/3.12.rst:1809 msgid "" "CPython now uses the ThinLTO option as the default link time optimization " "policy if the Clang compiler accepts the flag. (Contributed by Donghee Na " "in :gh:`89536`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1805 +#: ../../whatsnew/3.12.rst:1813 msgid "" -"Add ``COMPILEALL_OPTS`` variable in :file:`Makefile` to " -"override :mod:`compileall` options (default: ``-j0``) in ``make install``. " -"Also merged the 3 ``compileall`` commands into a single command to " -"build .pyc files for all optimization levels (0, 1, 2) at once. (Contributed " -"by Victor Stinner in :gh:`99289`.)" +"Add ``COMPILEALL_OPTS`` variable in :file:`Makefile` to override :mod:" +"`compileall` options (default: ``-j0``) in ``make install``. Also merged the " +"3 ``compileall`` commands into a single command to build .pyc files for all " +"optimization levels (0, 1, 2) at once. (Contributed by Victor Stinner in :gh:" +"`99289`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1811 +#: ../../whatsnew/3.12.rst:1819 msgid "Add platform triplets for 64-bit LoongArch:" msgstr "" -#: ../../whatsnew/3.12.rst:1813 +#: ../../whatsnew/3.12.rst:1821 msgid "loongarch64-linux-gnusf" msgstr "loongarch64-linux-gnusf" -#: ../../whatsnew/3.12.rst:1814 +#: ../../whatsnew/3.12.rst:1822 msgid "loongarch64-linux-gnuf32" msgstr "loongarch64-linux-gnuf32" -#: ../../whatsnew/3.12.rst:1815 +#: ../../whatsnew/3.12.rst:1823 msgid "loongarch64-linux-gnu" msgstr "loongarch64-linux-gnu" -#: ../../whatsnew/3.12.rst:1817 +#: ../../whatsnew/3.12.rst:1825 msgid "(Contributed by Zhang Na in :gh:`90656`.)" msgstr "(由 Zhang Na 於 :gh:`90656` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1819 +#: ../../whatsnew/3.12.rst:1827 msgid "``PYTHON_FOR_REGEN`` now require Python 3.10 or newer." msgstr "``PYTHON_FOR_REGEN`` 現在需要 Python 3.10 或更新的版本。" -#: ../../whatsnew/3.12.rst:1821 +#: ../../whatsnew/3.12.rst:1829 msgid "" "Autoconf 2.71 and aclocal 1.16.4 is now required to regenerate :file:`!" "configure`. (Contributed by Christian Heimes in :gh:`89886`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1825 +#: ../../whatsnew/3.12.rst:1833 msgid "" "Windows builds and macOS installers from python.org now use OpenSSL 3.0." msgstr "" -#: ../../whatsnew/3.12.rst:1829 +#: ../../whatsnew/3.12.rst:1837 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.12.rst:1836 +#: ../../whatsnew/3.12.rst:1844 msgid "" ":pep:`697`: Introduce the :ref:`Unstable C API tier <unstable-c-api>`, " "intended for low-level tools like debuggers and JIT compilers. This API may " @@ -4150,15 +4160,15 @@ msgid "" "contents are marked by the ``PyUnstable_`` prefix in names." msgstr "" -#: ../../whatsnew/3.12.rst:1842 +#: ../../whatsnew/3.12.rst:1850 msgid "Code object constructors:" msgstr "程式碼物件建構函式:" -#: ../../whatsnew/3.12.rst:1844 +#: ../../whatsnew/3.12.rst:1852 msgid "``PyUnstable_Code_New()`` (renamed from ``PyCode_New``)" msgstr "``PyUnstable_Code_New()``\\ (自 ``PyCode_New`` 重新命名)" -#: ../../whatsnew/3.12.rst:1845 +#: ../../whatsnew/3.12.rst:1853 msgid "" "``PyUnstable_Code_NewWithPosOnlyArgs()`` (renamed from " "``PyCode_NewWithPosOnlyArgs``)" @@ -4166,11 +4176,11 @@ msgstr "" "``PyUnstable_Code_NewWithPosOnlyArgs()``\\ (自 " "``PyCode_NewWithPosOnlyArgs`` 重新命名)" -#: ../../whatsnew/3.12.rst:1847 +#: ../../whatsnew/3.12.rst:1855 msgid "Extra storage for code objects (:pep:`523`):" msgstr "程式碼物件的額外儲存 (:pep:`523`):" -#: ../../whatsnew/3.12.rst:1849 +#: ../../whatsnew/3.12.rst:1857 msgid "" "``PyUnstable_Eval_RequestCodeExtraIndex()`` (renamed from " "``_PyEval_RequestCodeExtraIndex``)" @@ -4178,31 +4188,31 @@ msgstr "" "``PyUnstable_Eval_RequestCodeExtraIndex()``\\ (自 " "``_PyEval_RequestCodeExtraIndex`` 重新命名)" -#: ../../whatsnew/3.12.rst:1850 +#: ../../whatsnew/3.12.rst:1858 msgid "``PyUnstable_Code_GetExtra()`` (renamed from ``_PyCode_GetExtra``)" msgstr "``PyUnstable_Code_GetExtra()``\\ (自 ``_PyCode_GetExtra`` 重新命名)" -#: ../../whatsnew/3.12.rst:1851 +#: ../../whatsnew/3.12.rst:1859 msgid "``PyUnstable_Code_SetExtra()`` (renamed from ``_PyCode_SetExtra``)" msgstr "``PyUnstable_Code_SetExtra()``\\ (自 ``_PyCode_SetExtra`` 重新命名)" -#: ../../whatsnew/3.12.rst:1853 +#: ../../whatsnew/3.12.rst:1861 msgid "" "The original names will continue to be available until the respective API " "changes." msgstr "原始名稱將可繼續使用,直到相應的 API 發生變更。" -#: ../../whatsnew/3.12.rst:1856 +#: ../../whatsnew/3.12.rst:1864 msgid "(Contributed by Petr Viktorin in :gh:`101101`.)" msgstr "(由 Petr Viktorin 於 :gh:`101101` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1858 +#: ../../whatsnew/3.12.rst:1866 msgid "" ":pep:`697`: Add an API for extending types whose instance memory layout is " "opaque:" msgstr "" -#: ../../whatsnew/3.12.rst:1861 +#: ../../whatsnew/3.12.rst:1869 msgid "" ":c:member:`PyType_Spec.basicsize` can be zero or negative to specify " "inheriting or extending the base class size." @@ -4210,267 +4220,266 @@ msgstr "" ":c:member:`PyType_Spec.basicsize` 可以為零或負數來指定繼承或擴充基底類別大" "小。" -#: ../../whatsnew/3.12.rst:1863 +#: ../../whatsnew/3.12.rst:1871 msgid "" ":c:func:`PyObject_GetTypeData` and :c:func:`PyType_GetTypeDataSize` added to " "allow access to subclass-specific instance data." msgstr "" -#: ../../whatsnew/3.12.rst:1865 +#: ../../whatsnew/3.12.rst:1873 msgid "" ":c:macro:`Py_TPFLAGS_ITEMS_AT_END` and :c:func:`PyObject_GetItemData` added " -"to allow safely extending certain variable-sized types, " -"including :c:var:`PyType_Type`." +"to allow safely extending certain variable-sized types, including :c:var:" +"`PyType_Type`." msgstr "" -#: ../../whatsnew/3.12.rst:1868 +#: ../../whatsnew/3.12.rst:1876 msgid "" ":c:macro:`Py_RELATIVE_OFFSET` added to allow defining :c:type:`members " "<PyMemberDef>` in terms of a subclass-specific struct." msgstr "" -#: ../../whatsnew/3.12.rst:1871 +#: ../../whatsnew/3.12.rst:1879 msgid "(Contributed by Petr Viktorin in :gh:`103509`.)" msgstr "(由 Petr Viktorin 於 :gh:`103509` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1873 +#: ../../whatsnew/3.12.rst:1881 msgid "" -"Add the new :ref:`limited C API <limited-c-api>` " -"function :c:func:`PyType_FromMetaclass`, which generalizes the " -"existing :c:func:`PyType_FromModuleAndSpec` using an additional metaclass " -"argument. (Contributed by Wenzel Jakob in :gh:`93012`.)" +"Add the new :ref:`limited C API <limited-c-api>` function :c:func:" +"`PyType_FromMetaclass`, which generalizes the existing :c:func:" +"`PyType_FromModuleAndSpec` using an additional metaclass argument. " +"(Contributed by Wenzel Jakob in :gh:`93012`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1878 +#: ../../whatsnew/3.12.rst:1886 msgid "" "API for creating objects that can be called using :ref:`the vectorcall " "protocol <vectorcall>` was added to the :ref:`Limited API <stable>`:" msgstr "" -#: ../../whatsnew/3.12.rst:1882 +#: ../../whatsnew/3.12.rst:1890 msgid ":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`" msgstr ":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`" -#: ../../whatsnew/3.12.rst:1883 +#: ../../whatsnew/3.12.rst:1891 msgid ":c:func:`PyVectorcall_NARGS`" msgstr ":c:func:`PyVectorcall_NARGS`" -#: ../../whatsnew/3.12.rst:1884 +#: ../../whatsnew/3.12.rst:1892 msgid ":c:func:`PyVectorcall_Call`" msgstr ":c:func:`PyVectorcall_Call`" -#: ../../whatsnew/3.12.rst:1885 +#: ../../whatsnew/3.12.rst:1893 msgid ":c:type:`vectorcallfunc`" msgstr ":c:type:`vectorcallfunc`" -#: ../../whatsnew/3.12.rst:1887 +#: ../../whatsnew/3.12.rst:1895 msgid "" "The :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class " "when the class's :py:meth:`~object.__call__` method is reassigned. This " "makes vectorcall safe to use with mutable types (i.e. heap types without the " "immutable flag, :c:macro:`Py_TPFLAGS_IMMUTABLETYPE`). Mutable types that do " "not override :c:member:`~PyTypeObject.tp_call` now inherit the " -"``Py_TPFLAGS_HAVE_VECTORCALL`` flag. (Contributed by Petr Viktorin " -"in :gh:`93274`.)" +"``Py_TPFLAGS_HAVE_VECTORCALL`` flag. (Contributed by Petr Viktorin in :gh:" +"`93274`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1895 +#: ../../whatsnew/3.12.rst:1903 msgid "" -"The :c:macro:`Py_TPFLAGS_MANAGED_DICT` " -"and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows " -"extensions classes to support object :attr:`~object.__dict__` and weakrefs " -"with less bookkeeping, using less memory and with faster access." +"The :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" +"`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows extensions " +"classes to support object :attr:`~object.__dict__` and weakrefs with less " +"bookkeeping, using less memory and with faster access." msgstr "" -#: ../../whatsnew/3.12.rst:1900 +#: ../../whatsnew/3.12.rst:1908 msgid "" "API for performing calls using :ref:`the vectorcall protocol <vectorcall>` " "was added to the :ref:`Limited API <stable>`:" msgstr "" -#: ../../whatsnew/3.12.rst:1904 +#: ../../whatsnew/3.12.rst:1912 msgid ":c:func:`PyObject_Vectorcall`" msgstr ":c:func:`PyObject_Vectorcall`" -#: ../../whatsnew/3.12.rst:1905 +#: ../../whatsnew/3.12.rst:1913 msgid ":c:func:`PyObject_VectorcallMethod`" msgstr ":c:func:`PyObject_VectorcallMethod`" -#: ../../whatsnew/3.12.rst:1906 +#: ../../whatsnew/3.12.rst:1914 msgid ":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`" msgstr ":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`" -#: ../../whatsnew/3.12.rst:1908 +#: ../../whatsnew/3.12.rst:1916 msgid "" "This means that both the incoming and outgoing ends of the vector call " "protocol are now available in the :ref:`Limited API <stable>`. (Contributed " "by Wenzel Jakob in :gh:`98586`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1912 +#: ../../whatsnew/3.12.rst:1920 msgid "" -"Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` " -"and :c:func:`PyEval_SetTraceAllThreads`, that allow to set tracing and " -"profiling functions in all running threads in addition to the calling one. " +"Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` and :c:" +"func:`PyEval_SetTraceAllThreads`, that allow to set tracing and profiling " +"functions in all running threads in addition to the calling one. " "(Contributed by Pablo Galindo in :gh:`93503`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1918 +#: ../../whatsnew/3.12.rst:1926 msgid "" "Add new function :c:func:`PyFunction_SetVectorcall` to the C API which sets " "the vectorcall field of a given :c:type:`PyFunctionObject`. (Contributed by " "Andrew Frost in :gh:`92257`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1922 +#: ../../whatsnew/3.12.rst:1930 msgid "" -"The C API now permits registering callbacks " -"via :c:func:`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to " -"be called whenever a dictionary is modified. This is intended for use by " -"optimizing interpreters, JIT compilers, or debuggers. (Contributed by Carl " -"Meyer in :gh:`91052`.)" +"The C API now permits registering callbacks via :c:func:" +"`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to be called " +"whenever a dictionary is modified. This is intended for use by optimizing " +"interpreters, JIT compilers, or debuggers. (Contributed by Carl Meyer in :gh:" +"`91052`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1928 +#: ../../whatsnew/3.12.rst:1936 msgid "" "Add :c:func:`PyType_AddWatcher` and :c:func:`PyType_Watch` API to register " "callbacks to receive notification on changes to a type. (Contributed by Carl " "Meyer in :gh:`91051`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1932 +#: ../../whatsnew/3.12.rst:1940 msgid "" "Add :c:func:`PyCode_AddWatcher` and :c:func:`PyCode_ClearWatcher` APIs to " "register callbacks to receive notification on creation and destruction of " "code objects. (Contributed by Itamar Oren in :gh:`91054`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1937 +#: ../../whatsnew/3.12.rst:1945 msgid "" "Add :c:func:`PyFrame_GetVar` and :c:func:`PyFrame_GetVarString` functions to " -"get a frame variable by its name. (Contributed by Victor Stinner " -"in :gh:`91248`.)" +"get a frame variable by its name. (Contributed by Victor Stinner in :gh:" +"`91248`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1941 +#: ../../whatsnew/3.12.rst:1949 msgid "" -"Add :c:func:`PyErr_GetRaisedException` " -"and :c:func:`PyErr_SetRaisedException` for saving and restoring the current " -"exception. These functions return and accept a single exception object, " -"rather than the triple arguments of the now-deprecated :c:func:`PyErr_Fetch` " -"and :c:func:`PyErr_Restore`. This is less error prone and a bit more " -"efficient. (Contributed by Mark Shannon in :gh:`101578`.)" +"Add :c:func:`PyErr_GetRaisedException` and :c:func:" +"`PyErr_SetRaisedException` for saving and restoring the current exception. " +"These functions return and accept a single exception object, rather than the " +"triple arguments of the now-deprecated :c:func:`PyErr_Fetch` and :c:func:" +"`PyErr_Restore`. This is less error prone and a bit more efficient. " +"(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1949 +#: ../../whatsnew/3.12.rst:1957 msgid "" "Add ``_PyErr_ChainExceptions1``, which takes an exception instance, to " "replace the legacy-API ``_PyErr_ChainExceptions``, which is now deprecated. " "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1953 +#: ../../whatsnew/3.12.rst:1961 msgid "" "Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs` as " -"convenience functions for retrieving and modifying " -"the :attr:`~BaseException.args` passed to the exception's constructor. " -"(Contributed by Mark Shannon in :gh:`101578`.)" +"convenience functions for retrieving and modifying the :attr:`~BaseException." +"args` passed to the exception's constructor. (Contributed by Mark Shannon " +"in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1958 +#: ../../whatsnew/3.12.rst:1966 msgid "" "Add :c:func:`PyErr_DisplayException`, which takes an exception instance, to " "replace the legacy-api :c:func:`!PyErr_Display`. (Contributed by Irit " "Katriel in :gh:`102755`)." msgstr "" -#: ../../whatsnew/3.12.rst:1964 +#: ../../whatsnew/3.12.rst:1972 msgid "" ":pep:`683`: Introduce *Immortal Objects*, which allows objects to bypass " "reference counts, and related changes to the C-API:" msgstr "" -#: ../../whatsnew/3.12.rst:1967 +#: ../../whatsnew/3.12.rst:1975 msgid "``_Py_IMMORTAL_REFCNT``: The reference count that defines an object" msgstr "``_Py_IMMORTAL_REFCNT``:定義物件的參照計數" -#: ../../whatsnew/3.12.rst:1968 +#: ../../whatsnew/3.12.rst:1976 msgid "as immortal." msgstr "" -#: ../../whatsnew/3.12.rst:1969 +#: ../../whatsnew/3.12.rst:1977 msgid "" "``_Py_IsImmortal`` Checks if an object has the immortal reference count." msgstr "" -#: ../../whatsnew/3.12.rst:1970 +#: ../../whatsnew/3.12.rst:1978 msgid "``PyObject_HEAD_INIT`` This will now initialize reference count to" msgstr "``PyObject_HEAD_INIT`` 這現在將初始化參照計數" -#: ../../whatsnew/3.12.rst:1971 +#: ../../whatsnew/3.12.rst:1979 msgid "``_Py_IMMORTAL_REFCNT`` when used with ``Py_BUILD_CORE``." msgstr "``_Py_IMMORTAL_REFCNT``\\ (與 ``Py_BUILD_CORE`` 一起使用時)。" -#: ../../whatsnew/3.12.rst:1972 +#: ../../whatsnew/3.12.rst:1980 msgid "``SSTATE_INTERNED_IMMORTAL`` An identifier for interned unicode objects" msgstr "" -#: ../../whatsnew/3.12.rst:1973 +#: ../../whatsnew/3.12.rst:1981 msgid "that are immortal." msgstr "" -#: ../../whatsnew/3.12.rst:1974 +#: ../../whatsnew/3.12.rst:1982 msgid "``SSTATE_INTERNED_IMMORTAL_STATIC`` An identifier for interned unicode" msgstr "" -#: ../../whatsnew/3.12.rst:1975 +#: ../../whatsnew/3.12.rst:1983 msgid "objects that are immortal and static" msgstr "" -#: ../../whatsnew/3.12.rst:1976 +#: ../../whatsnew/3.12.rst:1984 msgid "``sys.getunicodeinternedsize`` This returns the total number of unicode" msgstr "``sys.getunicodeinternedsize`` 這會回傳 unicode 的總數" -#: ../../whatsnew/3.12.rst:1977 +#: ../../whatsnew/3.12.rst:1985 msgid "" "objects that have been interned. This is now needed for :file:`refleak.py` " "to correctly track reference counts and allocated blocks" msgstr "" -#: ../../whatsnew/3.12.rst:1980 +#: ../../whatsnew/3.12.rst:1988 msgid "(Contributed by Eddie Elizondo in :gh:`84436`.)" msgstr "(由 Eddie Elizondo 於 :gh:`84436` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1982 +#: ../../whatsnew/3.12.rst:1990 msgid "" -":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function " -"and :c:type:`PyInterpreterConfig`, which may be used to create sub-" -"interpreters with their own GILs. (See :ref:`whatsnew312-pep684` for more " -"info.) (Contributed by Eric Snow in :gh:`104110`.)" +":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function and :" +"c:type:`PyInterpreterConfig`, which may be used to create sub-interpreters " +"with their own GILs. (See :ref:`whatsnew312-pep684` for more info.) " +"(Contributed by Eric Snow in :gh:`104110`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1988 +#: ../../whatsnew/3.12.rst:1996 msgid "" -"In the limited C API version 3.12, :c:func:`Py_INCREF` " -"and :c:func:`Py_DECREF` functions are now implemented as opaque function " -"calls to hide implementation details. (Contributed by Victor Stinner " -"in :gh:`105387`.)" +"In the limited C API version 3.12, :c:func:`Py_INCREF` and :c:func:" +"`Py_DECREF` functions are now implemented as opaque function calls to hide " +"implementation details. (Contributed by Victor Stinner in :gh:`105387`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1996 +#: ../../whatsnew/3.12.rst:2004 msgid "" "Legacy Unicode APIs based on ``Py_UNICODE*`` representation has been " "removed. Please migrate to APIs based on UTF-8 or ``wchar_t*``." msgstr "" -#: ../../whatsnew/3.12.rst:1999 +#: ../../whatsnew/3.12.rst:2007 msgid "" "Argument parsing functions like :c:func:`PyArg_ParseTuple` doesn't support " "``Py_UNICODE*`` based format (e.g. ``u``, ``Z``) anymore. Please migrate to " "other formats for Unicode like ``s``, ``z``, ``es``, and ``U``." msgstr "" -#: ../../whatsnew/3.12.rst:2003 +#: ../../whatsnew/3.12.rst:2011 msgid "" "``tp_weaklist`` for all static builtin types is always ``NULL``. This is an " "internal-only field on ``PyTypeObject`` but we're pointing out the change in " @@ -4479,7 +4488,7 @@ msgid "" "necessary, the (internal-only) ``_PyObject_GET_WEAKREFS_LISTPTR()`` macro." msgstr "" -#: ../../whatsnew/3.12.rst:2010 +#: ../../whatsnew/3.12.rst:2018 msgid "" "This internal-only :c:member:`PyTypeObject.tp_subclasses` may now not be a " "valid object pointer. Its type was changed to :c:expr:`void *` to reflect " @@ -4487,53 +4496,51 @@ msgid "" "only field directly." msgstr "" -#: ../../whatsnew/3.12.rst:2015 +#: ../../whatsnew/3.12.rst:2023 msgid "" -"To get a list of subclasses, call the Python " -"method :py:meth:`~type.__subclasses__` (using :c:func:`PyObject_CallMethod`, " -"for example)." +"To get a list of subclasses, call the Python method :py:meth:`~type." +"__subclasses__` (using :c:func:`PyObject_CallMethod`, for example)." msgstr "" -#: ../../whatsnew/3.12.rst:2019 +#: ../../whatsnew/3.12.rst:2027 msgid "" "Add support of more formatting options (left aligning, octals, uppercase " "hexadecimals, :c:type:`intmax_t`, :c:type:`ptrdiff_t`, :c:type:`wchar_t` C " "strings, variable width and precision) in :c:func:`PyUnicode_FromFormat` " -"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Serhiy Storchaka " -"in :gh:`98836`.)" +"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Serhiy Storchaka in :gh:" +"`98836`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2025 +#: ../../whatsnew/3.12.rst:2033 msgid "" -"An unrecognized format character in :c:func:`PyUnicode_FromFormat` " -"and :c:func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In " -"previous versions it caused all the rest of the format string to be copied " -"as-is to the result string, and any extra arguments discarded. (Contributed " -"by Serhiy Storchaka in :gh:`95781`.)" +"An unrecognized format character in :c:func:`PyUnicode_FromFormat` and :c:" +"func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In previous " +"versions it caused all the rest of the format string to be copied as-is to " +"the result string, and any extra arguments discarded. (Contributed by Serhiy " +"Storchaka in :gh:`95781`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2031 +#: ../../whatsnew/3.12.rst:2039 msgid "" -"Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` " -"and :c:func:`PyUnicode_FromFormatV`. (Contributed by Philip Georgi " -"in :gh:`95504`.)" +"Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` and :c:func:" +"`PyUnicode_FromFormatV`. (Contributed by Philip Georgi in :gh:`95504`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2035 +#: ../../whatsnew/3.12.rst:2043 msgid "" "Extension classes wanting to add a :attr:`~object.__dict__` or weak " -"reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` " -"and :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and " +"reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" +"`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and " "``tp_weaklistoffset``, respectively. The use of ``tp_dictoffset`` and " "``tp_weaklistoffset`` is still supported, but does not fully support " "multiple inheritance (:gh:`95589`), and performance may be worse. Classes " "declaring :c:macro:`Py_TPFLAGS_MANAGED_DICT` must call :c:func:`!" "_PyObject_VisitManagedDict` and :c:func:`!_PyObject_ClearManagedDict` to " -"traverse and clear their instance's dictionaries. To clear weakrefs, " -"call :c:func:`PyObject_ClearWeakRefs`, as before." +"traverse and clear their instance's dictionaries. To clear weakrefs, call :c:" +"func:`PyObject_ClearWeakRefs`, as before." msgstr "" -#: ../../whatsnew/3.12.rst:2047 +#: ../../whatsnew/3.12.rst:2055 msgid "" "The :c:func:`PyUnicode_FSDecoder` function no longer accepts bytes-like " "paths, like :class:`bytearray` and :class:`memoryview` types: only the " @@ -4541,7 +4548,7 @@ msgid "" "Victor Stinner in :gh:`98393`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2052 +#: ../../whatsnew/3.12.rst:2060 msgid "" "The :c:macro:`Py_CLEAR`, :c:macro:`Py_SETREF` and :c:macro:`Py_XSETREF` " "macros now only evaluate their arguments once. If an argument has side " @@ -4549,15 +4556,15 @@ msgid "" "Stinner in :gh:`98724`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2057 +#: ../../whatsnew/3.12.rst:2065 msgid "" -"The interpreter's error indicator is now always normalized. This means " -"that :c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other " -"functions that set the error indicator now normalize the exception before " -"storing it. (Contributed by Mark Shannon in :gh:`101578`.)" +"The interpreter's error indicator is now always normalized. This means that :" +"c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other functions " +"that set the error indicator now normalize the exception before storing it. " +"(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2062 +#: ../../whatsnew/3.12.rst:2070 msgid "" "``_Py_RefTotal`` is no longer authoritative and only kept around for ABI " "compatibility. Note that it is an internal global and only available on " @@ -4565,25 +4572,25 @@ msgid "" "``_Py_GetGlobalRefTotal()``." msgstr "" -#: ../../whatsnew/3.12.rst:2067 +#: ../../whatsnew/3.12.rst:2075 msgid "" "The following functions now select an appropriate metaclass for the newly " "created type:" msgstr "" -#: ../../whatsnew/3.12.rst:2070 +#: ../../whatsnew/3.12.rst:2078 msgid ":c:func:`PyType_FromSpec`" msgstr ":c:func:`PyType_FromSpec`" -#: ../../whatsnew/3.12.rst:2071 +#: ../../whatsnew/3.12.rst:2079 msgid ":c:func:`PyType_FromSpecWithBases`" msgstr ":c:func:`PyType_FromSpecWithBases`" -#: ../../whatsnew/3.12.rst:2072 +#: ../../whatsnew/3.12.rst:2080 msgid ":c:func:`PyType_FromModuleAndSpec`" msgstr ":c:func:`PyType_FromModuleAndSpec`" -#: ../../whatsnew/3.12.rst:2074 +#: ../../whatsnew/3.12.rst:2082 msgid "" "Creating classes whose metaclass overrides :c:member:`~PyTypeObject.tp_new` " "is deprecated, and in Python 3.14+ it will be disallowed. Note that these " @@ -4591,14 +4598,14 @@ msgid "" "initialization." msgstr "" -#: ../../whatsnew/3.12.rst:2079 +#: ../../whatsnew/3.12.rst:2087 msgid "" "Note that :c:func:`PyType_FromMetaclass` (added in Python 3.12) already " -"disallows creating classes whose metaclass overrides ``tp_new`` " -"(:meth:`~object.__new__` in Python)." +"disallows creating classes whose metaclass overrides ``tp_new`` (:meth:" +"`~object.__new__` in Python)." msgstr "" -#: ../../whatsnew/3.12.rst:2083 +#: ../../whatsnew/3.12.rst:2091 msgid "" "Since ``tp_new`` overrides almost everything ``PyType_From*`` functions do, " "the two are incompatible with each other. The existing behavior -- ignoring " @@ -4607,38 +4614,38 @@ msgid "" "general workaround. One of the following may work for you:" msgstr "" -#: ../../whatsnew/3.12.rst:2090 +#: ../../whatsnew/3.12.rst:2098 msgid "If you control the metaclass, avoid using ``tp_new`` in it:" msgstr "" -#: ../../whatsnew/3.12.rst:2092 +#: ../../whatsnew/3.12.rst:2100 msgid "" -"If initialization can be skipped, it can be done " -"in :c:member:`~PyTypeObject.tp_init` instead." +"If initialization can be skipped, it can be done in :c:member:`~PyTypeObject." +"tp_init` instead." msgstr "" -#: ../../whatsnew/3.12.rst:2094 +#: ../../whatsnew/3.12.rst:2102 msgid "" "If the metaclass doesn't need to be instantiated from Python, set its " -"``tp_new`` to ``NULL`` using " -"the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag. This makes it " -"acceptable for ``PyType_From*`` functions." +"``tp_new`` to ``NULL`` using the :c:macro:" +"`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag. This makes it acceptable for " +"``PyType_From*`` functions." msgstr "" -#: ../../whatsnew/3.12.rst:2099 +#: ../../whatsnew/3.12.rst:2107 msgid "" "Avoid ``PyType_From*`` functions: if you don't need C-specific features " "(slots or setting the instance size), create types by :ref:`calling <call>` " "the metaclass." msgstr "" -#: ../../whatsnew/3.12.rst:2103 +#: ../../whatsnew/3.12.rst:2111 msgid "" "If you *know* the ``tp_new`` can be skipped safely, filter the deprecation " "warning out using :func:`warnings.catch_warnings` from Python." msgstr "" -#: ../../whatsnew/3.12.rst:2106 +#: ../../whatsnew/3.12.rst:2114 msgid "" ":c:var:`PyOS_InputHook` and :c:var:`PyOS_ReadlineFunctionPointer` are no " "longer called in :ref:`subinterpreters <sub-interpreter-support>`. This is " @@ -4646,33 +4653,33 @@ msgid "" "callbacks have no way of recovering extension module state)." msgstr "" -#: ../../whatsnew/3.12.rst:2111 +#: ../../whatsnew/3.12.rst:2119 msgid "" "This also avoids situations where extensions may find themselves running in " "a subinterpreter that they don't support (or haven't yet been loaded in). " "See :gh:`104668` for more info." msgstr "" -#: ../../whatsnew/3.12.rst:2115 +#: ../../whatsnew/3.12.rst:2123 msgid "" ":c:struct:`PyLongObject` has had its internals changed for better " "performance. Although the internals of :c:struct:`PyLongObject` are private, " "they are used by some extension modules. The internal fields should no " -"longer be accessed directly, instead the API functions beginning " -"``PyLong_...`` should be used instead. Two new *unstable* API functions are " -"provided for efficient access to the value of :c:struct:`PyLongObject`\\s " -"which fit into a single machine word:" +"longer be accessed directly, instead the API functions beginning ``PyLong_..." +"`` should be used instead. Two new *unstable* API functions are provided for " +"efficient access to the value of :c:struct:`PyLongObject`\\s which fit into " +"a single machine word:" msgstr "" -#: ../../whatsnew/3.12.rst:2123 +#: ../../whatsnew/3.12.rst:2131 msgid ":c:func:`PyUnstable_Long_IsCompact`" msgstr ":c:func:`PyUnstable_Long_IsCompact`" -#: ../../whatsnew/3.12.rst:2124 +#: ../../whatsnew/3.12.rst:2132 msgid ":c:func:`PyUnstable_Long_CompactValue`" msgstr ":c:func:`PyUnstable_Long_CompactValue`" -#: ../../whatsnew/3.12.rst:2126 +#: ../../whatsnew/3.12.rst:2134 msgid "" "Custom allocators, set via :c:func:`PyMem_SetAllocator`, are now required to " "be thread-safe, regardless of memory domain. Allocators that don't have " @@ -4681,85 +4688,85 @@ msgid "" "create a new GitHub issue and CC ``@ericsnowcurrently``." msgstr "" -#: ../../whatsnew/3.12.rst:2136 +#: ../../whatsnew/3.12.rst:2144 msgid "" -"In accordance with :pep:`699`, the ``ma_version_tag`` field " -"in :c:type:`PyDictObject` is deprecated for extension modules. Accessing " -"this field will generate a compiler warning at compile time. This field will " -"be removed in Python 3.14. (Contributed by Ramvikrams and Kumar Aditya " -"in :gh:`101193`. PEP by Ken Jin.)" +"In accordance with :pep:`699`, the ``ma_version_tag`` field in :c:type:" +"`PyDictObject` is deprecated for extension modules. Accessing this field " +"will generate a compiler warning at compile time. This field will be removed " +"in Python 3.14. (Contributed by Ramvikrams and Kumar Aditya in :gh:`101193`. " +"PEP by Ken Jin.)" msgstr "" -#: ../../whatsnew/3.12.rst:2141 +#: ../../whatsnew/3.12.rst:2149 msgid "Deprecate global configuration variable:" msgstr "棄用全域配置變數:" -#: ../../whatsnew/3.12.rst:2143 +#: ../../whatsnew/3.12.rst:2151 msgid ":c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug`" msgstr ":c:var:`Py_DebugFlag`: 請改用 :c:member:`PyConfig.parser_debug`" -#: ../../whatsnew/3.12.rst:2144 +#: ../../whatsnew/3.12.rst:2152 msgid ":c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose`" msgstr ":c:var:`Py_VerboseFlag`: 請改用 :c:member:`PyConfig.verbose`" -#: ../../whatsnew/3.12.rst:2145 +#: ../../whatsnew/3.12.rst:2153 msgid ":c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet`" msgstr ":c:var:`Py_QuietFlag`: 請改用 :c:member:`PyConfig.quiet`" -#: ../../whatsnew/3.12.rst:2146 +#: ../../whatsnew/3.12.rst:2154 msgid ":c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive`" msgstr ":c:var:`Py_InteractiveFlag`: 請改用 :c:member:`PyConfig.interactive`" -#: ../../whatsnew/3.12.rst:2147 +#: ../../whatsnew/3.12.rst:2155 msgid ":c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect`" msgstr ":c:var:`Py_InspectFlag`: 請改用 :c:member:`PyConfig.inspect`" -#: ../../whatsnew/3.12.rst:2148 +#: ../../whatsnew/3.12.rst:2156 msgid ":c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level`" msgstr "" ":c:var:`Py_OptimizeFlag`: 請改用 :c:member:`PyConfig.optimization_level`" -#: ../../whatsnew/3.12.rst:2149 +#: ../../whatsnew/3.12.rst:2157 msgid ":c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import`" msgstr ":c:var:`Py_NoSiteFlag`: 請改用 :c:member:`PyConfig.site_import`" -#: ../../whatsnew/3.12.rst:2150 +#: ../../whatsnew/3.12.rst:2158 msgid ":c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning`" msgstr "" ":c:var:`Py_BytesWarningFlag`: 請改用 :c:member:`PyConfig.bytes_warning`" -#: ../../whatsnew/3.12.rst:2151 +#: ../../whatsnew/3.12.rst:2159 msgid ":c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings`" msgstr "" ":c:var:`Py_FrozenFlag`: 請改用 :c:member:`PyConfig.pathconfig_warnings`" -#: ../../whatsnew/3.12.rst:2152 +#: ../../whatsnew/3.12.rst:2160 msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment`" msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`: 請改" -"用 :c:member:`PyConfig.use_environment`" +":c:var:`Py_IgnoreEnvironmentFlag`: 請改用 :c:member:`PyConfig." +"use_environment`" -#: ../../whatsnew/3.12.rst:2153 +#: ../../whatsnew/3.12.rst:2161 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode`" msgstr "" ":c:var:`Py_DontWriteBytecodeFlag`: 請改用 :c:member:`PyConfig.write_bytecode`" -#: ../../whatsnew/3.12.rst:2154 +#: ../../whatsnew/3.12.rst:2162 msgid "" ":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig.user_site_directory`" msgstr "" -":c:var:`Py_NoUserSiteDirectory`: 請改" -"用 :c:member:`PyConfig.user_site_directory`" +":c:var:`Py_NoUserSiteDirectory`: 請改用 :c:member:`PyConfig." +"user_site_directory`" -#: ../../whatsnew/3.12.rst:2155 +#: ../../whatsnew/3.12.rst:2163 msgid "" ":c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio`" msgstr "" ":c:var:`Py_UnbufferedStdioFlag`: 請改用 :c:member:`PyConfig.buffered_stdio`" -#: ../../whatsnew/3.12.rst:2156 +#: ../../whatsnew/3.12.rst:2164 msgid "" ":c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed`" @@ -4767,160 +4774,157 @@ msgstr "" ":c:var:`Py_HashRandomizationFlag`: 請改用 :c:member:`PyConfig.use_hash_seed` " "和 :c:member:`PyConfig.hash_seed`" -#: ../../whatsnew/3.12.rst:2158 +#: ../../whatsnew/3.12.rst:2166 msgid ":c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated`" msgstr ":c:var:`Py_IsolatedFlag`: 請改用 :c:member:`PyConfig.isolated`" -#: ../../whatsnew/3.12.rst:2159 +#: ../../whatsnew/3.12.rst:2167 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: " -"use :c:member:`PyPreConfig.legacy_windows_fs_encoding`" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`" msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: 請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: 請改用 :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`" -#: ../../whatsnew/3.12.rst:2160 +#: ../../whatsnew/3.12.rst:2168 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: " -"use :c:member:`PyConfig.legacy_windows_stdio`" +":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." +"legacy_windows_stdio`" msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`: 請改" -"用 :c:member:`PyConfig.legacy_windows_stdio`" +":c:var:`Py_LegacyWindowsStdioFlag`: 請改用 :c:member:`PyConfig." +"legacy_windows_stdio`" -#: ../../whatsnew/3.12.rst:2161 +#: ../../whatsnew/3.12.rst:2169 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: " -"use :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." +"filesystem_encoding`" msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`: 請改" -"用 :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_FileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." +"filesystem_encoding`" -#: ../../whatsnew/3.12.rst:2162 +#: ../../whatsnew/3.12.rst:2170 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: " -"use :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." +"filesystem_encoding`" msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: 請改" -"用 :c:member:`PyConfig.filesystem_encoding`" +":c:var:`!Py_HasFileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." +"filesystem_encoding`" -#: ../../whatsnew/3.12.rst:2163 +#: ../../whatsnew/3.12.rst:2171 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: " -"use :c:member:`PyConfig.filesystem_errors`" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." +"filesystem_errors`" msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: 請改" -"用 :c:member:`PyConfig.filesystem_errors`" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: 請改用 :c:member:`PyConfig." +"filesystem_errors`" -#: ../../whatsnew/3.12.rst:2164 +#: ../../whatsnew/3.12.rst:2172 msgid "" -":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` " -"(see :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:" +"`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`: 請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參" -"見 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: 請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參見 :c:" +"func:`Py_PreInitialize`)" -#: ../../whatsnew/3.12.rst:2166 +#: ../../whatsnew/3.12.rst:2174 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` instead. (Contributed by Victor Stinner " -"in :gh:`77782`.)" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead. (Contributed by Victor Stinner in :gh:`77782`.)" msgstr "" ":c:func:`Py_InitializeFromConfig` API 應改為與 :c:type:`PyConfig` 一起使用。" "(由 Victor Stinner 於 :gh:`77782` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2170 +#: ../../whatsnew/3.12.rst:2178 msgid "" "Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable " "bases is deprecated and will be disabled in Python 3.14. (:gh:`95388`)" msgstr "" -#: ../../whatsnew/3.12.rst:2173 +#: ../../whatsnew/3.12.rst:2181 msgid "" "The :file:`structmember.h` header is deprecated, though it continues to be " "available and there are no plans to remove it." msgstr ":file:`structmember.h` 標頭已棄用,但仍可使用,且還沒有移除它的計畫。" -#: ../../whatsnew/3.12.rst:2176 +#: ../../whatsnew/3.12.rst:2184 msgid "" "Its contents are now available just by including :file:`Python.h`, with a " "``Py`` prefix added if it was missing:" msgstr "" -#: ../../whatsnew/3.12.rst:2179 +#: ../../whatsnew/3.12.rst:2187 msgid "" -":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` " -"and :c:func:`PyMember_SetOne`" +":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` and :c:func:" +"`PyMember_SetOne`" msgstr "" -":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` " -"和 :c:func:`PyMember_SetOne`" +":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` 和 :c:func:" +"`PyMember_SetOne`" -#: ../../whatsnew/3.12.rst:2181 +#: ../../whatsnew/3.12.rst:2189 msgid "" "Type macros like :c:macro:`Py_T_INT`, :c:macro:`Py_T_DOUBLE`, etc. " "(previously ``T_INT``, ``T_DOUBLE``, etc.)" msgstr "" -#: ../../whatsnew/3.12.rst:2183 +#: ../../whatsnew/3.12.rst:2191 msgid "" -"The flags :c:macro:`Py_READONLY` (previously ``READONLY``) " -"and :c:macro:`Py_AUDIT_READ` (previously all uppercase)" +"The flags :c:macro:`Py_READONLY` (previously ``READONLY``) and :c:macro:" +"`Py_AUDIT_READ` (previously all uppercase)" msgstr "" -":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)" -"和 :c:macro:`Py_AUDIT_READ`\\ (先前全大寫)旗標" +":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)和 :c:macro:" +"`Py_AUDIT_READ`\\ (先前全大寫)旗標" -#: ../../whatsnew/3.12.rst:2186 +#: ../../whatsnew/3.12.rst:2194 msgid "Several items are not exposed from :file:`Python.h`:" msgstr "數個項目不再從 :file:`Python.h` 中公開:" -#: ../../whatsnew/3.12.rst:2188 +#: ../../whatsnew/3.12.rst:2196 msgid ":c:macro:`T_OBJECT` (use :c:macro:`Py_T_OBJECT_EX`)" msgstr ":c:macro:`T_OBJECT`\\ (請改用 :c:macro:`Py_T_OBJECT_EX`)" -#: ../../whatsnew/3.12.rst:2189 +#: ../../whatsnew/3.12.rst:2197 msgid ":c:macro:`T_NONE` (previously undocumented, and pretty quirky)" msgstr ":c:macro:`T_NONE`\\ (先前未記錄於文件上,且相當古怪)" -#: ../../whatsnew/3.12.rst:2190 +#: ../../whatsnew/3.12.rst:2198 msgid "The macro ``WRITE_RESTRICTED`` which does nothing." msgstr "不做任何事的巨集 ``WRITE_RESTRICTED``。" -#: ../../whatsnew/3.12.rst:2191 +#: ../../whatsnew/3.12.rst:2199 msgid "" -"The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents " -"of :c:macro:`Py_AUDIT_READ`." +"The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of :c:macro:" +"`Py_AUDIT_READ`." msgstr "" -"``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當" -"於 :c:macro:`Py_AUDIT_READ`。" +"``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當於 :c:macro:" +"`Py_AUDIT_READ`。" -#: ../../whatsnew/3.12.rst:2193 +#: ../../whatsnew/3.12.rst:2201 msgid "" -"In some configurations, ``<stddef.h>`` is not included " -"from :file:`Python.h`. It should be included manually when using " -"``offsetof()``." +"In some configurations, ``<stddef.h>`` is not included from :file:`Python." +"h`. It should be included manually when using ``offsetof()``." msgstr "" -#: ../../whatsnew/3.12.rst:2196 +#: ../../whatsnew/3.12.rst:2204 msgid "" "The deprecated header continues to provide its original contents under the " "original names. Your old code can stay unchanged, unless the extra include " "and non-namespaced macros bother you greatly." msgstr "" -#: ../../whatsnew/3.12.rst:2201 +#: ../../whatsnew/3.12.rst:2209 msgid "" "(Contributed in :gh:`47146` by Petr Viktorin, based on earlier work by " "Alexander Belopolsky and Matthias Braun.)" msgstr "" -#: ../../whatsnew/3.12.rst:2204 +#: ../../whatsnew/3.12.rst:2212 msgid "" -":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. " -"Use :c:func:`PyErr_GetRaisedException` " -"and :c:func:`PyErr_SetRaisedException` instead. (Contributed by Mark Shannon " -"in :gh:`101578`.)" +":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. Use :c:" +"func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException` " +"instead. (Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2209 +#: ../../whatsnew/3.12.rst:2217 msgid "" ":c:func:`!PyErr_Display` is deprecated. Use :c:func:`PyErr_DisplayException` " "instead. (Contributed by Irit Katriel in :gh:`102755`)." @@ -4928,7 +4932,7 @@ msgstr "" ":c:func:`!PyErr_Display` 已棄用,請改用 :c:func:`PyErr_DisplayException`。" "(由 Irit Katriel 於 :gh:`102755` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2212 +#: ../../whatsnew/3.12.rst:2220 msgid "" "``_PyErr_ChainExceptions`` is deprecated. Use ``_PyErr_ChainExceptions1`` " "instead. (Contributed by Irit Katriel in :gh:`102192`.)" @@ -4936,32 +4940,31 @@ msgstr "" "``_PyErr_ChainExceptions`` 已棄用,請改用 ``_PyErr_ChainExceptions1``。(由 " "Irit Katriel 於 :gh:`102192` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2215 +#: ../../whatsnew/3.12.rst:2223 msgid "" -"Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` " -"or :c:func:`PyType_FromModuleAndSpec` to create a class whose metaclass " -"overrides :c:member:`~PyTypeObject.tp_new` is deprecated. Call the metaclass " -"instead." +"Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` or :c:" +"func:`PyType_FromModuleAndSpec` to create a class whose metaclass overrides :" +"c:member:`~PyTypeObject.tp_new` is deprecated. Call the metaclass instead." msgstr "" -"使用 :c:func:`PyType_FromSpec`、:c:func:`PyType_FromSpecWithBases` " -"或 :c:func:`PyType_FromModuleAndSpec` 建立一個其元類別覆" -"寫 :c:member:`~PyTypeObject.tp_new` 的類別已被棄用。請改為呼叫元類別。" +"使用 :c:func:`PyType_FromSpec`、:c:func:`PyType_FromSpecWithBases` 或 :c:" +"func:`PyType_FromModuleAndSpec` 建立一個其元類別覆寫 :c:member:" +"`~PyTypeObject.tp_new` 的類別已被棄用。請改為呼叫元類別。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 msgid "" "The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " "(:pep:`699`; :gh:`101193`)." msgstr "" -":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 " -"(:pep:`699`;:gh:`101193`)。" +":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 (:pep:" +"`699`;:gh:`101193`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 msgid "" "Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable " "bases (:gh:`95388`)." msgstr "" -"使用可變基底建立\\ :c:data:`不可變型別 <Py_TPFLAGS_IMMUTABLETYPE>` " -"(:gh:`95388`)。" +"使用可變基底建立\\ :c:data:`不可變型別 <Py_TPFLAGS_IMMUTABLETYPE>` (:gh:" +"`95388`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:10 msgid "" @@ -4991,8 +4994,8 @@ msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` instead." +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" @@ -5049,24 +5052,24 @@ msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "instead." msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改" -"用 :c:member:`PyConfig.use_environment`。" +":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." +"use_environment`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "instead." msgstr "" -":c:var:`Py_DontWriteBytecodeFlag`:請改" -"用 :c:member:`PyConfig.write_bytecode`。" +":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." +"write_bytecode`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 msgid "" -":c:var:`Py_NoUserSiteDirectory`: " -"Use :c:member:`PyConfig.user_site_directory` instead." +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." +"user_site_directory` instead." msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改" -"用 :c:member:`PyConfig.user_site_directory`。" +":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." +"user_site_directory`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 msgid "" @@ -5089,51 +5092,51 @@ msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: " -"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` instead." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` instead." msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: " -"Use :c:member:`PyConfig.legacy_windows_stdio` instead." +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." +"legacy_windows_stdio` instead." msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改" -"用 :c:member:`PyConfig.legacy_windows_stdio`。" +":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." +"legacy_windows_stdio`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: " -"Use :c:member:`PyConfig.filesystem_encoding` instead." +":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`。" +":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: " -"Use :c:member:`PyConfig.filesystem_encoding` instead." +":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` instead." msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`。" +":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: " -"Use :c:member:`PyConfig.filesystem_errors` instead." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." +"filesystem_errors` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" -"用 :c:member:`PyConfig.filesystem_errors`。" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." +"filesystem_errors`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. " -"(see :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" +"c:func:`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" -"見 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" +"func:`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 msgid "The bundled copy of ``libmpdecimal``." @@ -5141,27 +5144,27 @@ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -"The :c:func:`PyImport_ImportModuleNoBlock`: " -"Use :c:func:`PyImport_ImportModule` instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改" -"用 :c:func:`PyImport_ImportModule`。" +":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" +"`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 msgid "" -":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " -"Use :c:func:`PyWeakref_GetRef` instead." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead." msgstr "" -":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" -"用 :c:func:`PyWeakref_GetRef`。" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 msgid "" -":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " -"Use :c:type:`wchar_t` instead." +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." msgstr "" -":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" -"用 :c:type:`wchar_t`。" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 msgid "Python initialization functions:" @@ -5172,16 +5175,16 @@ msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" -":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " -"和 :data:`!warnings.filters`。" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" +"data:`!warnings.filters`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 msgid "" -":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` " -"and :data:`sys.exec_prefix` instead." +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." +"exec_prefix` instead." msgstr "" -":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` " -"與 :data:`sys.exec_prefix`。" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" +"`sys.exec_prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." @@ -5192,8 +5195,8 @@ msgid "" ":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " "instead." msgstr "" -":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` " -"與 :data:`sys.prefix`。" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." +"prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." @@ -5205,11 +5208,11 @@ msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or " -"the :envvar:`PYTHONHOME` environment variable instead." +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" +"`PYTHONHOME` environment variable instead." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " -"或 :envvar:`PYTHONHOME` 環境變數。" +":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" +"`PYTHONHOME` 環境變數。" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" @@ -5230,8 +5233,8 @@ msgid "" ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" -":c:func:`PyErr_NormalizeException`:請改" -"用 :c:func:`PyErr_GetRaisedException`。" +":c:func:`PyErr_NormalizeException`:請改用 :c:func:" +"`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" @@ -5251,11 +5254,11 @@ msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " -"and :c:func:`PySlice_AdjustIndices` instead." +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." msgstr "" -":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` " -"和 :c:func:`PySlice_AdjustIndices`。" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" +"`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid "" @@ -5301,8 +5304,8 @@ msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." msgstr "" -":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" -"叫 :c:func:`PyObject_Hash`。" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" +"`PyObject_Hash`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid ":c:member:`!PyDictObject.ma_version_tag` member." @@ -5342,57 +5345,69 @@ msgstr "" msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.12.rst:2231 +#: ../../whatsnew/3.12.rst:2239 msgid "" "Remove the :file:`token.h` header file. There was never any public tokenizer " "C API. The :file:`token.h` header file was only designed to be used by " "Python internals. (Contributed by Victor Stinner in :gh:`92651`.)" msgstr "" +"移除 :file:`token.h` 標頭檔案。從未有任何公開的 tokenizer C API。:file:" +"`token.h` 標頭檔案的設計是僅限用於 Python 內部。(由 Victor Stinner 於 :gh:" +"`92651` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2236 +#: ../../whatsnew/3.12.rst:2244 msgid "Legacy Unicode APIs have been removed. See :pep:`623` for detail." msgstr "" -#: ../../whatsnew/3.12.rst:2238 +#: ../../whatsnew/3.12.rst:2246 msgid ":c:macro:`!PyUnicode_WCHAR_KIND`" msgstr ":c:macro:`!PyUnicode_WCHAR_KIND`" -#: ../../whatsnew/3.12.rst:2239 +#: ../../whatsnew/3.12.rst:2247 msgid ":c:func:`!PyUnicode_AS_UNICODE`" msgstr ":c:func:`!PyUnicode_AS_UNICODE`" -#: ../../whatsnew/3.12.rst:2240 +#: ../../whatsnew/3.12.rst:2248 msgid ":c:func:`!PyUnicode_AsUnicode`" msgstr ":c:func:`!PyUnicode_AsUnicode`" -#: ../../whatsnew/3.12.rst:2241 +#: ../../whatsnew/3.12.rst:2249 msgid ":c:func:`!PyUnicode_AsUnicodeAndSize`" msgstr ":c:func:`!PyUnicode_AsUnicodeAndSize`" -#: ../../whatsnew/3.12.rst:2242 +#: ../../whatsnew/3.12.rst:2250 msgid ":c:func:`!PyUnicode_AS_DATA`" msgstr ":c:func:`!PyUnicode_AS_DATA`" -#: ../../whatsnew/3.12.rst:2243 +#: ../../whatsnew/3.12.rst:2251 msgid ":c:func:`!PyUnicode_FromUnicode`" msgstr ":c:func:`!PyUnicode_FromUnicode`" -#: ../../whatsnew/3.12.rst:2244 +#: ../../whatsnew/3.12.rst:2252 msgid ":c:func:`!PyUnicode_GET_SIZE`" msgstr ":c:func:`!PyUnicode_GET_SIZE`" -#: ../../whatsnew/3.12.rst:2245 +#: ../../whatsnew/3.12.rst:2253 msgid ":c:func:`!PyUnicode_GetSize`" msgstr ":c:func:`!PyUnicode_GetSize`" -#: ../../whatsnew/3.12.rst:2246 +#: ../../whatsnew/3.12.rst:2254 msgid ":c:func:`!PyUnicode_GET_DATA_SIZE`" msgstr ":c:func:`!PyUnicode_GET_DATA_SIZE`" -#: ../../whatsnew/3.12.rst:2248 +#: ../../whatsnew/3.12.rst:2256 msgid "" "Remove the ``PyUnicode_InternImmortal()`` function macro. (Contributed by " "Victor Stinner in :gh:`85858`.)" msgstr "" -"移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner " -"於 :gh:`85858` 中貢獻。)" +"移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner 於 :gh:" +"`85858` 中貢獻。)" + +#~ msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" +#~ msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" + +#~ msgid "" +#~ ":func:`sysconfig.is_python_build` *check_home* parameter is deprecated " +#~ "and ignored." +#~ msgstr "" +#~ ":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po index fe2d9f58d6..008d810fdb 100644 --- a/whatsnew/3.13.po +++ b/whatsnew/3.13.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-04-30 00:15+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,8 +31,8 @@ msgstr "Adam Turner 和 Thomas Wouters" #: ../../whatsnew/3.13.rst:48 msgid "" "This article explains the new features in Python 3.13, compared to 3.12. " -"Python 3.13 was released on October 7, 2024. For full details, see " -"the :ref:`changelog <changelog>`." +"Python 3.13 was released on October 7, 2024. For full details, see the :ref:" +"`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.13 與 3.12 相比多了哪些新功能。Python 3.13 已於 2024 年 " "10 月 7 日發布。完整詳情請見 :ref:`changelog <changelog>`。" @@ -51,9 +51,9 @@ msgid "" "with a mix of changes to the language, the implementation and the standard " "library. The biggest changes include a new `interactive interpreter " "<whatsnew313-better-interactive-interpreter_>`_, experimental support for " -"running in a `free-threaded mode <whatsnew313-free-threaded-cpython_>`_ " -"(:pep:`703`), and a `Just-In-Time compiler <whatsnew313-jit-compiler_>`_ " -"(:pep:`744`)." +"running in a `free-threaded mode <whatsnew313-free-threaded-cpython_>`_ (:" +"pep:`703`), and a `Just-In-Time compiler <whatsnew313-jit-compiler_>`_ (:pep:" +"`744`)." msgstr "" #: ../../whatsnew/3.13.rst:72 @@ -76,8 +76,8 @@ msgstr "" msgid "" "This article doesn't attempt to provide a complete specification of all new " "features, but instead gives a convenient overview. For full details refer to " -"the documentation, such as the :ref:`Library Reference <library-index>` " -"and :ref:`Language Reference <reference-index>`. To understand the complete " +"the documentation, such as the :ref:`Library Reference <library-index>` and :" +"ref:`Language Reference <reference-index>`. To understand the complete " "implementation and design rationale for a change, refer to the PEP for a " "particular new feature; but note that PEPs usually are not kept up-to-date " "once a feature has been fully implemented. See `Porting to Python 3.13`_ for " @@ -105,9 +105,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:108 msgid "" -":pep:`703`: CPython 3.13 has experimental support for running with " -"the :term:`global interpreter lock` disabled. See :ref:`Free-threaded " -"CPython <whatsnew313-free-threaded-cpython>` for more details." +":pep:`703`: CPython 3.13 has experimental support for running with the :term:" +"`global interpreter lock` disabled. See :ref:`Free-threaded CPython " +"<whatsnew313-free-threaded-cpython>` for more details." msgstr "" #: ../../whatsnew/3.13.rst:111 @@ -168,8 +168,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:137 msgid "" "The :mod:`copy` module now has a :func:`copy.replace` function, with support " -"for many builtin types and any class defining " -"the :func:`~object.__replace__` method." +"for many builtin types and any class defining the :func:`~object." +"__replace__` method." msgstr "" #: ../../whatsnew/3.13.rst:140 @@ -195,9 +195,9 @@ msgstr "安全性改進:" #: ../../whatsnew/3.13.rst:147 msgid "" -":func:`ssl.create_default_context` " -"sets :data:`ssl.VERIFY_X509_PARTIAL_CHAIN` " -"and :data:`ssl.VERIFY_X509_STRICT` as default flags." +":func:`ssl.create_default_context` sets :data:`ssl." +"VERIFY_X509_PARTIAL_CHAIN` and :data:`ssl.VERIFY_X509_STRICT` as default " +"flags." msgstr "" #: ../../whatsnew/3.13.rst:150 @@ -223,8 +223,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:157 msgid "" -"There is a new :ref:`suite of functions <c-api-monitoring>` for " -"generating :pep:`669` monitoring events in the C API." +"There is a new :ref:`suite of functions <c-api-monitoring>` for generating :" +"pep:`669` monitoring events in the C API." msgstr "" #: ../../whatsnew/3.13.rst:160 @@ -233,9 +233,8 @@ msgstr "新增型別特性:" #: ../../whatsnew/3.13.rst:162 msgid "" -":pep:`696`: Type parameters " -"(:data:`typing.TypeVar`, :data:`typing.ParamSpec`, " -"and :data:`typing.TypeVarTuple`) now support defaults." +":pep:`696`: Type parameters (:data:`typing.TypeVar`, :data:`typing." +"ParamSpec`, and :data:`typing.TypeVarTuple`) now support defaults." msgstr "" #: ../../whatsnew/3.13.rst:164 @@ -246,8 +245,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:166 msgid "" -":pep:`705`: :data:`typing.ReadOnly` can be used to mark an item of " -"a :class:`typing.TypedDict` as read-only for type checkers." +":pep:`705`: :data:`typing.ReadOnly` can be used to mark an item of a :class:" +"`typing.TypedDict` as read-only for type checkers." msgstr "" #: ../../whatsnew/3.13.rst:168 @@ -287,19 +286,20 @@ msgstr "重要的移除:" #: ../../whatsnew/3.13.rst:182 msgid "" -":ref:`PEP 594 <whatsnew313-pep594>`: The remaining 19 \"dead batteries\" " -"(legacy stdlib modules) have been removed from the standard library: :mod:`!" -"aifc`, :mod:`!audioop`, :mod:`!cgi`, :mod:`!cgitb`, :mod:`!chunk`, :mod:`!" -"crypt`, :mod:`!imghdr`, :mod:`!mailcap`, :mod:`!msilib`, :mod:`!nis`, :mod:`!" -"nntplib`, :mod:`!ossaudiodev`, :mod:`!pipes`, :mod:`!sndhdr`, :mod:`!" -"spwd`, :mod:`!sunau`, :mod:`!telnetlib`, :mod:`!uu` and :mod:`!xdrlib`." +":ref:`PEP 594 <whatsnew313-pep594>`: The remaining 19 \"dead " +"batteries\" (legacy stdlib modules) have been removed from the standard " +"library: :mod:`!aifc`, :mod:`!audioop`, :mod:`!cgi`, :mod:`!cgitb`, :mod:`!" +"chunk`, :mod:`!crypt`, :mod:`!imghdr`, :mod:`!mailcap`, :mod:`!msilib`, :mod:" +"`!nis`, :mod:`!nntplib`, :mod:`!ossaudiodev`, :mod:`!pipes`, :mod:`!" +"sndhdr`, :mod:`!spwd`, :mod:`!sunau`, :mod:`!telnetlib`, :mod:`!uu` and :mod:" +"`!xdrlib`." msgstr "" ":ref:`PEP 594 <whatsnew313-pep594>`: 剩下的 19 個 \"dead batteries\" (遺留標" "準函式庫模組)已自標準函式庫中移除::mod:`!aifc`、:mod:`!audioop`、:mod:`!" "cgi`、:mod:`!cgitb`、:mod:`!chunk`、:mod:`!crypt`、:mod:`!imghdr`、:mod:`!" "mailcap`、:mod:`!msilib`、:mod:`!nis`、:mod:`!nntplib`、:mod:`!" -"ossaudiodev`、:mod:`!pipes`、:mod:`!sndhdr`、:mod:`!spwd`、:mod:`!" -"sunau`、:mod:`!telnetlib`、:mod:`!uu` 和 :mod:`!xdrlib`." +"ossaudiodev`、:mod:`!pipes`、:mod:`!sndhdr`、:mod:`!spwd`、:mod:`!sunau`、:" +"mod:`!telnetlib`、:mod:`!uu` 和 :mod:`!xdrlib`." #: ../../whatsnew/3.13.rst:188 msgid "" @@ -384,8 +384,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:228 msgid "" -"History browsing using :kbd:`F2` that skips output as well as " -"the :term:`>>>` and :term:`...` prompts." +"History browsing using :kbd:`F2` that skips output as well as the :term:" +"`>>>` and :term:`...` prompts." msgstr "" #: ../../whatsnew/3.13.rst:230 @@ -482,6 +482,7 @@ msgstr "" " ^^^^^^^^\n" "AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/" "home/me/numpy.py' if it has the same name as a library you intended to " +"import)" #: ../../whatsnew/3.13.rst:294 msgid "(Contributed by Shantanu Jain in :gh:`95754`.)" @@ -700,35 +701,35 @@ msgstr "" #: ../../whatsnew/3.13.rst:432 msgid "" -"Historically, the expected result of mutating the return value " -"of :func:`locals` has been left to individual Python implementations to " -"define. Starting from Python 3.13, :pep:`667` standardises the historical " -"behavior of CPython for most code execution scopes, but " -"changes :term:`optimized scopes <optimized scope>` (functions, generators, " -"coroutines, comprehensions, and generator expressions) to explicitly return " -"independent snapshots of the currently assigned local variables, including " -"locally referenced nonlocal variables captured in closures." +"Historically, the expected result of mutating the return value of :func:" +"`locals` has been left to individual Python implementations to define. " +"Starting from Python 3.13, :pep:`667` standardises the historical behavior " +"of CPython for most code execution scopes, but changes :term:`optimized " +"scopes <optimized scope>` (functions, generators, coroutines, " +"comprehensions, and generator expressions) to explicitly return independent " +"snapshots of the currently assigned local variables, including locally " +"referenced nonlocal variables captured in closures." msgstr "" #: ../../whatsnew/3.13.rst:441 msgid "" "This change to the semantics of :func:`locals` in optimized scopes also " "affects the default behavior of code execution functions that implicitly " -"target :func:`!locals` if no explicit namespace is provided (such " -"as :func:`exec` and :func:`eval`). In previous versions, whether or not " -"changes could be accessed by calling :func:`!locals` after calling the code " -"execution function was implementation-dependent. In CPython specifically, " -"such code would typically appear to work as desired, but could sometimes " -"fail in optimized scopes based on other code (including debuggers and code " -"execution tracing tools) potentially resetting the shared snapshot in that " -"scope. Now, the code will always run against an independent snapshot of the " -"local variables in optimized scopes, and hence the changes will never be " -"visible in subsequent calls to :func:`!locals`. To access the changes made " -"in these cases, an explicit namespace reference must now be passed to the " -"relevant function. Alternatively, it may make sense to update affected code " -"to use a higher level code execution API that returns the resulting code " -"execution namespace (e.g. :func:`runpy.run_path` when executing Python files " -"from disk)." +"target :func:`!locals` if no explicit namespace is provided (such as :func:" +"`exec` and :func:`eval`). In previous versions, whether or not changes could " +"be accessed by calling :func:`!locals` after calling the code execution " +"function was implementation-dependent. In CPython specifically, such code " +"would typically appear to work as desired, but could sometimes fail in " +"optimized scopes based on other code (including debuggers and code execution " +"tracing tools) potentially resetting the shared snapshot in that scope. Now, " +"the code will always run against an independent snapshot of the local " +"variables in optimized scopes, and hence the changes will never be visible " +"in subsequent calls to :func:`!locals`. To access the changes made in these " +"cases, an explicit namespace reference must now be passed to the relevant " +"function. Alternatively, it may make sense to update affected code to use a " +"higher level code execution API that returns the resulting code execution " +"namespace (e.g. :func:`runpy.run_path` when executing Python files from " +"disk)." msgstr "" #: ../../whatsnew/3.13.rst:460 @@ -744,16 +745,16 @@ msgstr "" #: ../../whatsnew/3.13.rst:466 msgid "" "See :pep:`667` for more details, including related C API changes and " -"deprecations. Porting notes are also provided below for the " -"affected :ref:`Python APIs <pep667-porting-notes-py>` and :ref:`C APIs " -"<pep667-porting-notes-c>`." +"deprecations. Porting notes are also provided below for the affected :ref:" +"`Python APIs <pep667-porting-notes-py>` and :ref:`C APIs <pep667-porting-" +"notes-c>`." msgstr "" #: ../../whatsnew/3.13.rst:471 msgid "" -"(PEP and implementation contributed by Mark Shannon and Tian Gao " -"in :gh:`74929`. Documentation updates provided by Guido van Rossum and " -"Alyssa Coghlan.)" +"(PEP and implementation contributed by Mark Shannon and Tian Gao in :gh:" +"`74929`. Documentation updates provided by Guido van Rossum and Alyssa " +"Coghlan.)" msgstr "" #: ../../whatsnew/3.13.rst:479 @@ -848,8 +849,8 @@ msgstr "" msgid "" ":keyword:`global` declarations are now permitted in :keyword:`except` blocks " "when that global is used in the :keyword:`else` block. Previously this " -"raised an erroneous :exc:`SyntaxError`. (Contributed by Irit Katriel " -"in :gh:`111123`.)" +"raised an erroneous :exc:`SyntaxError`. (Contributed by Irit Katriel in :gh:" +"`111123`.)" msgstr "" #: ../../whatsnew/3.13.rst:549 @@ -865,15 +866,15 @@ msgid "" "Add :ref:`support for the perf profiler <perf_profiling>` working without " "`frame pointers <https://en.wikipedia.org/wiki/Call_stack>`_ through the new " "environment variable :envvar:`PYTHON_PERF_JIT_SUPPORT` and command-line " -"option :option:`-X perf_jit <-X>`. (Contributed by Pablo Galindo " -"in :gh:`118518`.)" +"option :option:`-X perf_jit <-X>`. (Contributed by Pablo Galindo in :gh:" +"`118518`.)" msgstr "" #: ../../whatsnew/3.13.rst:560 msgid "" -"The location of a :file:`.python_history` file can be changed via the " -"new :envvar:`PYTHON_HISTORY` environment variable. (Contributed by Levi " -"Sabah, Zackery Spytz and Hugo van Kemenade in :gh:`73965`.)" +"The location of a :file:`.python_history` file can be changed via the new :" +"envvar:`PYTHON_HISTORY` environment variable. (Contributed by Levi Sabah, " +"Zackery Spytz and Hugo van Kemenade in :gh:`73965`.)" msgstr "" #: ../../whatsnew/3.13.rst:565 @@ -894,15 +895,15 @@ msgstr "" #: ../../whatsnew/3.13.rst:574 msgid "" "The :func:`exec` and :func:`eval` builtins now accept the *globals* and " -"*locals* arguments as keywords. (Contributed by Raphael Gaschignard " -"in :gh:`105879`)" +"*locals* arguments as keywords. (Contributed by Raphael Gaschignard in :gh:" +"`105879`)" msgstr "" #: ../../whatsnew/3.13.rst:578 msgid "" -"The :func:`compile` builtin now accepts a new flag, " -"``ast.PyCF_OPTIMIZED_AST``, which is similar to ``ast.PyCF_ONLY_AST`` except " -"that the returned AST is optimized according to the value of the *optimize* " +"The :func:`compile` builtin now accepts a new flag, ``ast." +"PyCF_OPTIMIZED_AST``, which is similar to ``ast.PyCF_ONLY_AST`` except that " +"the returned AST is optimized according to the value of the *optimize* " "argument. (Contributed by Irit Katriel in :gh:`108113`)." msgstr "" @@ -914,10 +915,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:587 msgid "" -"Add :exc:`PythonFinalizationError`, a new exception derived " -"from :exc:`RuntimeError` and used to signal when operations are blocked " -"during :term:`finalization <interpreter shutdown>`. The following callables " -"now raise :exc:`!PythonFinalizationError`, instead of :exc:`RuntimeError`:" +"Add :exc:`PythonFinalizationError`, a new exception derived from :exc:" +"`RuntimeError` and used to signal when operations are blocked during :term:" +"`finalization <interpreter shutdown>`. The following callables now raise :" +"exc:`!PythonFinalizationError`, instead of :exc:`RuntimeError`:" msgstr "" #: ../../whatsnew/3.13.rst:593 @@ -945,8 +946,8 @@ msgid "" "Allow the *count* argument of :meth:`str.replace` to be a keyword. " "(Contributed by Hugo van Kemenade in :gh:`106487`.)" msgstr "" -"允許 :meth:`str.replace` 的 *count* 引數為關鍵字。(由 Hugo van Kemenade " -"在 :gh:`106487` 中貢獻。)" +"允許 :meth:`str.replace` 的 *count* 引數為關鍵字。(由 Hugo van Kemenade 在 :" +"gh:`106487` 中貢獻。)" #: ../../whatsnew/3.13.rst:603 msgid "" @@ -958,9 +959,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:608 msgid "" "Added :attr:`!name` and :attr:`!mode` attributes for compressed and archived " -"file-like objects in the :mod:`bz2`, :mod:`lzma`, :mod:`tarfile`, " -"and :mod:`zipfile` modules. (Contributed by Serhiy Storchaka " -"in :gh:`115961`.)" +"file-like objects in the :mod:`bz2`, :mod:`lzma`, :mod:`tarfile`, and :mod:" +"`zipfile` modules. (Contributed by Serhiy Storchaka in :gh:`115961`.)" msgstr "" #: ../../whatsnew/3.13.rst:615 @@ -983,10 +983,10 @@ msgstr "argparse" #: ../../whatsnew/3.13.rst:628 msgid "" -"Add the *deprecated* parameter to " -"the :meth:`~argparse.ArgumentParser.add_argument` and :meth:`!add_parser` " -"methods, to enable deprecating command-line options, positional arguments, " -"and subcommands. (Contributed by Serhiy Storchaka in :gh:`83648`.)" +"Add the *deprecated* parameter to the :meth:`~argparse.ArgumentParser." +"add_argument` and :meth:`!add_parser` methods, to enable deprecating command-" +"line options, positional arguments, and subcommands. (Contributed by Serhiy " +"Storchaka in :gh:`83648`.)" msgstr "" #: ../../whatsnew/3.13.rst:636 @@ -1040,14 +1040,14 @@ msgstr "" #: ../../whatsnew/3.13.rst:669 msgid "" "These changes do not apply to user-defined subclasses of :class:`ast.AST` " -"unless the class opts in to the new behavior by defining " -"the :attr:`.AST._field_types` mapping." +"unless the class opts in to the new behavior by defining the :attr:`.AST." +"_field_types` mapping." msgstr "" #: ../../whatsnew/3.13.rst:673 msgid "" -"(Contributed by Jelle Zijlstra in :gh:`105858`, :gh:`117486`, " -"and :gh:`118851`.)" +"(Contributed by Jelle Zijlstra in :gh:`105858`, :gh:`117486`, and :gh:" +"`118851`.)" msgstr "" #: ../../whatsnew/3.13.rst:675 @@ -1063,19 +1063,19 @@ msgstr "asyncio" #: ../../whatsnew/3.13.rst:684 msgid "" -":func:`asyncio.as_completed` now returns an object that is both " -"an :term:`asynchronous iterator` and a plain :term:`iterator` " -"of :term:`awaitables <awaitable>`. The awaitables yielded by asynchronous " -"iteration include original task or future objects that were passed in, " -"making it easier to associate results with the tasks being completed. " -"(Contributed by Justin Arthur in :gh:`77714`.)" +":func:`asyncio.as_completed` now returns an object that is both an :term:" +"`asynchronous iterator` and a plain :term:`iterator` of :term:`awaitables " +"<awaitable>`. The awaitables yielded by asynchronous iteration include " +"original task or future objects that were passed in, making it easier to " +"associate results with the tasks being completed. (Contributed by Justin " +"Arthur in :gh:`77714`.)" msgstr "" #: ../../whatsnew/3.13.rst:692 msgid "" ":meth:`asyncio.loop.create_unix_server` will now automatically remove the " -"Unix socket when the server is closed. (Contributed by Pierre Ossman " -"in :gh:`111246`.)" +"Unix socket when the server is closed. (Contributed by Pierre Ossman in :gh:" +"`111246`.)" msgstr "" #: ../../whatsnew/3.13.rst:696 @@ -1088,9 +1088,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:702 msgid "" -"Add :meth:`Queue.shutdown <asyncio.Queue.shutdown>` " -"and :exc:`~asyncio.QueueShutDown` to manage queue termination. (Contributed " -"by Laurie Opperman and Yves Duprat in :gh:`104228`.)" +"Add :meth:`Queue.shutdown <asyncio.Queue.shutdown>` and :exc:`~asyncio." +"QueueShutDown` to manage queue termination. (Contributed by Laurie Opperman " +"and Yves Duprat in :gh:`104228`.)" msgstr "" #: ../../whatsnew/3.13.rst:706 @@ -1103,8 +1103,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:710 msgid "" "Accept a tuple of separators in :meth:`.StreamReader.readuntil`, stopping " -"when any one of them is encountered. (Contributed by Bruce Merry " -"in :gh:`81322`.)" +"when any one of them is encountered. (Contributed by Bruce Merry in :gh:" +"`81322`.)" msgstr "" #: ../../whatsnew/3.13.rst:714 @@ -1119,10 +1119,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:721 msgid "" "In the case where a task group is cancelled externally and also must raise " -"an :exc:`ExceptionGroup`, it will now call the parent " -"task's :meth:`~asyncio.Task.cancel` method. This ensures that " -"a :exc:`~asyncio.CancelledError` will be raised at the " -"next :keyword:`await`, so the cancellation is not lost." +"an :exc:`ExceptionGroup`, it will now call the parent task's :meth:`~asyncio." +"Task.cancel` method. This ensures that a :exc:`~asyncio.CancelledError` will " +"be raised at the next :keyword:`await`, so the cancellation is not lost." msgstr "" #: ../../whatsnew/3.13.rst:727 @@ -1144,11 +1143,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:736 msgid "" -"When :meth:`.TaskGroup.create_task` is called on an " -"inactive :class:`~asyncio.TaskGroup`, the given coroutine will be closed " -"(which prevents a :exc:`RuntimeWarning` about the given coroutine being " -"never awaited). (Contributed by Arthur Tacca and Jason Zhang " -"in :gh:`115957`.)" +"When :meth:`.TaskGroup.create_task` is called on an inactive :class:" +"`~asyncio.TaskGroup`, the given coroutine will be closed (which prevents a :" +"exc:`RuntimeWarning` about the given coroutine being never awaited). " +"(Contributed by Arthur Tacca and Jason Zhang in :gh:`115957`.)" msgstr "" #: ../../whatsnew/3.13.rst:744 @@ -1158,8 +1156,8 @@ msgstr "base64" #: ../../whatsnew/3.13.rst:746 msgid "" "Add :func:`~base64.z85encode` and :func:`~base64.z85decode` functions for " -"encoding :class:`bytes` as `Z85 data`_ and decoding Z85-encoded data " -"to :class:`!bytes`. (Contributed by Matan Perelman in :gh:`75299`.)" +"encoding :class:`bytes` as `Z85 data`_ and decoding Z85-encoded data to :" +"class:`!bytes`. (Contributed by Matan Perelman in :gh:`75299`.)" msgstr "" #: ../../whatsnew/3.13.rst:755 @@ -1169,9 +1167,9 @@ msgstr "compileall" #: ../../whatsnew/3.13.rst:757 ../../whatsnew/3.13.rst:765 #: ../../whatsnew/3.13.rst:1024 msgid "" -"The default number of worker threads and processes is now selected " -"using :func:`os.process_cpu_count` instead of :func:`os.cpu_count`. " -"(Contributed by Victor Stinner in :gh:`109649`.)" +"The default number of worker threads and processes is now selected using :" +"func:`os.process_cpu_count` instead of :func:`os.cpu_count`. (Contributed by " +"Victor Stinner in :gh:`109649`.)" msgstr "" #: ../../whatsnew/3.13.rst:763 @@ -1186,8 +1184,8 @@ msgstr "configparser" msgid "" ":class:`~configparser.ConfigParser` now has support for unnamed sections, " "which allows for top-level key-value pairs. This can be enabled with the new " -"*allow_unnamed_section* parameter. (Contributed by Pedro Sousa Lacerda " -"in :gh:`66449`.)" +"*allow_unnamed_section* parameter. (Contributed by Pedro Sousa Lacerda in :" +"gh:`66449`.)" msgstr "" #: ../../whatsnew/3.13.rst:780 @@ -1212,8 +1210,10 @@ msgid ":class:`dataclasses.dataclass`" msgstr ":class:`dataclasses.dataclass`" #: ../../whatsnew/3.13.rst:790 -msgid ":class:`datetime.datetime`, :class:`datetime.date`, :class:`datetime.time`" -msgstr ":class:`datetime.datetime`、:class:`datetime.date`、:class:`datetime.time`" +msgid "" +":class:`datetime.datetime`, :class:`datetime.date`, :class:`datetime.time`" +msgstr "" +":class:`datetime.datetime`、:class:`datetime.date`、:class:`datetime.time`" #: ../../whatsnew/3.13.rst:791 msgid ":class:`inspect.Signature`, :class:`inspect.Parameter`" @@ -1230,8 +1230,8 @@ msgstr ":ref:`程式碼物件 <code-objects>`" #: ../../whatsnew/3.13.rst:795 msgid "" "Any user-defined class can also support :func:`copy.replace` by defining " -"the :meth:`~object.__replace__` method. (Contributed by Serhiy Storchaka " -"in :gh:`108751`.)" +"the :meth:`~object.__replace__` method. (Contributed by Serhiy Storchaka in :" +"gh:`108751`.)" msgstr "" #: ../../whatsnew/3.13.rst:801 @@ -1266,10 +1266,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:817 msgid "" -":class:`ctypes.Structure` objects have a " -"new :attr:`~ctypes.Structure._align_` attribute which allows the alignment " -"of the structure being packed to/from memory to be specified explicitly. " -"(Contributed by Matt Sanderson in :gh:`112433`)" +":class:`ctypes.Structure` objects have a new :attr:`~ctypes.Structure." +"_align_` attribute which allows the alignment of the structure being packed " +"to/from memory to be specified explicitly. (Contributed by Matt Sanderson " +"in :gh:`112433`)" msgstr "" #: ../../whatsnew/3.13.rst:823 @@ -1285,9 +1285,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:829 msgid "" -"Allow removing all items from the database through the " -"new :meth:`.gdbm.clear` and :meth:`.ndbm.clear` methods. (Contributed by " -"Donghee Na in :gh:`107122`.)" +"Allow removing all items from the database through the new :meth:`.gdbm." +"clear` and :meth:`.ndbm.clear` methods. (Contributed by Donghee Na in :gh:" +"`107122`.)" msgstr "" #: ../../whatsnew/3.13.rst:835 @@ -1305,10 +1305,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:844 msgid "" ":meth:`~dis.get_instructions` no longer represents cache entries as separate " -"instructions. Instead, it returns them as part of " -"the :class:`~dis.Instruction`, in the new *cache_info* field. The " -"*show_caches* argument to :meth:`~dis.get_instructions` is deprecated and no " -"longer has any effect. (Contributed by Irit Katriel in :gh:`112962`.)" +"instructions. Instead, it returns them as part of the :class:`~dis." +"Instruction`, in the new *cache_info* field. The *show_caches* argument to :" +"meth:`~dis.get_instructions` is deprecated and no longer has any effect. " +"(Contributed by Irit Katriel in :gh:`112962`.)" msgstr "" #: ../../whatsnew/3.13.rst:856 @@ -1319,9 +1319,9 @@ msgstr "doctest" msgid "" ":mod:`doctest` output is now colored by default. This can be controlled via " "the new :envvar:`PYTHON_COLORS` environment variable as well as the " -"canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment variables. See " -"also :ref:`using-on-controlling-color`. (Contributed by Hugo van Kemenade " -"in :gh:`117225`.)" +"canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment variables. See also :" +"ref:`using-on-controlling-color`. (Contributed by Hugo van Kemenade in :gh:" +"`117225`.)" msgstr "" #: ../../whatsnew/3.13.rst:865 @@ -1337,13 +1337,12 @@ msgstr "email" #: ../../whatsnew/3.13.rst:873 msgid "" -"Headers with embedded newlines are now quoted on output. " -"The :mod:`~email.generator` will now refuse to serialize (write) headers " -"that are improperly folded or delimited, such that they would be parsed as " -"multiple headers or joined with adjacent data. If you need to turn this " -"safety feature off, " -"set :attr:`~email.policy.Policy.verify_generated_headers`. (Contributed by " -"Bas Bloemsaat and Petr Viktorin in :gh:`121650`.)" +"Headers with embedded newlines are now quoted on output. The :mod:`~email." +"generator` will now refuse to serialize (write) headers that are improperly " +"folded or delimited, such that they would be parsed as multiple headers or " +"joined with adjacent data. If you need to turn this safety feature off, set :" +"attr:`~email.policy.Policy.verify_generated_headers`. (Contributed by Bas " +"Bloemsaat and Petr Viktorin in :gh:`121650`.)" msgstr "" #: ../../whatsnew/3.13.rst:881 @@ -1352,10 +1351,10 @@ msgid "" "return ``('', '')`` pairs in more situations where invalid email addresses " "are encountered instead of potentially inaccurate values. The two functions " "have a new optional *strict* parameter (default ``True``). To get the old " -"behavior (accepting malformed input), use ``strict=False``. " -"``getattr(email.utils, 'supports_strict_parsing', False)`` can be used to " -"check if the *strict* parameter is available. (Contributed by Thomas Dwyer " -"and Victor Stinner for :gh:`102988` to improve the :cve:`2023-27043` fix.)" +"behavior (accepting malformed input), use ``strict=False``. ``getattr(email." +"utils, 'supports_strict_parsing', False)`` can be used to check if the " +"*strict* parameter is available. (Contributed by Thomas Dwyer and Victor " +"Stinner for :gh:`102988` to improve the :cve:`2023-27043` fix.)" msgstr "" #: ../../whatsnew/3.13.rst:893 @@ -1364,8 +1363,8 @@ msgstr "enum" #: ../../whatsnew/3.13.rst:895 msgid "" -":class:`~enum.EnumDict` has been made public to better support " -"subclassing :class:`~enum.EnumType`." +":class:`~enum.EnumDict` has been made public to better support subclassing :" +"class:`~enum.EnumType`." msgstr "" "公開 :class:`~enum.EnumDict` 以更好地支援 :class:`~enum.EnumType` 的子類別。" @@ -1377,8 +1376,8 @@ msgstr "fractions" msgid "" ":class:`~fractions.Fraction` objects now support the standard :ref:`format " "specification mini-language <formatspec>` rules for fill, alignment, sign " -"handling, minimum width, and grouping. (Contributed by Mark Dickinson " -"in :gh:`111320`.)" +"handling, minimum width, and grouping. (Contributed by Mark Dickinson in :gh:" +"`111320`.)" msgstr "" #: ../../whatsnew/3.13.rst:909 @@ -1438,8 +1437,8 @@ msgstr "" msgid "" ":func:`~importlib.resources.contents` remains deprecated in favor of the " "fully-featured :class:`~importlib.resources.abc.Traversable` API. However, " -"there is now no plan to remove it. (Contributed by Petr Viktorin " -"in :gh:`116608`.)" +"there is now no plan to remove it. (Contributed by Petr Viktorin in :gh:" +"`116608`.)" msgstr "" #: ../../whatsnew/3.13.rst:941 @@ -1448,11 +1447,11 @@ msgstr "io" #: ../../whatsnew/3.13.rst:943 msgid "" -"The :class:`~io.IOBase` finalizer now logs any errors raised by " -"the :meth:`~io.IOBase.close` method with :data:`sys.unraisablehook`. " -"Previously, errors were ignored silently by default, and only logged " -"in :ref:`Python Development Mode <devmode>` or when using a :ref:`Python " -"debug build <debug-build>`. (Contributed by Victor Stinner in :gh:`62948`.)" +"The :class:`~io.IOBase` finalizer now logs any errors raised by the :meth:" +"`~io.IOBase.close` method with :data:`sys.unraisablehook`. Previously, " +"errors were ignored silently by default, and only logged in :ref:`Python " +"Development Mode <devmode>` or when using a :ref:`Python debug build <debug-" +"build>`. (Contributed by Victor Stinner in :gh:`62948`.)" msgstr "" #: ../../whatsnew/3.13.rst:952 @@ -1467,10 +1466,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:958 msgid "" -"Fix ``is_global`` and ``is_private`` behavior " -"in :class:`~ipaddress.IPv4Address`, :class:`~ipaddress.IPv6Address`, :class:`~ipaddress.IPv4Network`, " -"and :class:`~ipaddress.IPv6Network`. (Contributed by Jakub Stasiak " -"in :gh:`113171`.)" +"Fix ``is_global`` and ``is_private`` behavior in :class:`~ipaddress." +"IPv4Address`, :class:`~ipaddress.IPv6Address`, :class:`~ipaddress." +"IPv4Network`, and :class:`~ipaddress.IPv6Network`. (Contributed by Jakub " +"Stasiak in :gh:`113171`.)" msgstr "" #: ../../whatsnew/3.13.rst:965 @@ -1479,9 +1478,9 @@ msgstr "itertools" #: ../../whatsnew/3.13.rst:967 msgid "" -":func:`~itertools.batched` has a new *strict* parameter, which raises " -"a :exc:`ValueError` if the final batch is shorter than the specified batch " -"size. (Contributed by Raymond Hettinger in :gh:`113202`.)" +":func:`~itertools.batched` has a new *strict* parameter, which raises a :exc:" +"`ValueError` if the final batch is shorter than the specified batch size. " +"(Contributed by Raymond Hettinger in :gh:`113202`.)" msgstr "" #: ../../whatsnew/3.13.rst:974 @@ -1518,8 +1517,8 @@ msgstr "mimetypes" msgid "" "Add the :func:`~mimetypes.guess_file_type` function to guess a MIME type " "from a filesystem path. Using paths with :func:`~mimetypes.guess_type` is " -"now :term:`soft deprecated`. (Contributed by Serhiy Storchaka " -"in :gh:`66543`.)" +"now :term:`soft deprecated`. (Contributed by Serhiy Storchaka in :gh:" +"`66543`.)" msgstr "" #: ../../whatsnew/3.13.rst:1004 @@ -1536,17 +1535,17 @@ msgstr "" #: ../../whatsnew/3.13.rst:1010 msgid "" ":class:`~mmap.mmap` has a new :meth:`~mmap.mmap.seekable` method that can be " -"used when a seekable file-like object is required. " -"The :meth:`~mmap.mmap.seek` method now returns the new absolute position. " -"(Contributed by Donghee Na and Sylvie Liberman in :gh:`111835`.)" +"used when a seekable file-like object is required. The :meth:`~mmap.mmap." +"seek` method now returns the new absolute position. (Contributed by Donghee " +"Na and Sylvie Liberman in :gh:`111835`.)" msgstr "" #: ../../whatsnew/3.13.rst:1015 msgid "" "The new UNIX-only *trackfd* parameter for :class:`~mmap.mmap` controls file " "descriptor duplication; if false, the file descriptor specified by *fileno* " -"will not be duplicated. (Contributed by Zackery Spytz and Petr Viktorin " -"in :gh:`78502`.)" +"will not be duplicated. (Contributed by Zackery Spytz and Petr Viktorin in :" +"gh:`78502`.)" msgstr "" #: ../../whatsnew/3.13.rst:1022 @@ -1577,8 +1576,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:1044 msgid "" "Add a :ref:`low level interface <os-timerfd>` to Linux's :manpage:`timer " -"file descriptors <timerfd_create(2)>` " -"via :func:`~os.timerfd_create`, :func:`~os.timerfd_settime`, :func:`~os.timerfd_settime_ns`, :func:`~os.timerfd_gettime`, :func:`~os.timerfd_gettime_ns`, :const:`~os.TFD_NONBLOCK`, :const:`~os.TFD_CLOEXEC`, :const:`~os.TFD_TIMER_ABSTIME`, " +"file descriptors <timerfd_create(2)>` via :func:`~os.timerfd_create`, :func:" +"`~os.timerfd_settime`, :func:`~os.timerfd_settime_ns`, :func:`~os." +"timerfd_gettime`, :func:`~os.timerfd_gettime_ns`, :const:`~os." +"TFD_NONBLOCK`, :const:`~os.TFD_CLOEXEC`, :const:`~os.TFD_TIMER_ABSTIME`, " "and :const:`~os.TFD_TIMER_CANCEL_ON_SET` (Contributed by Masaru Tsuchiyama " "in :gh:`108277`.)" msgstr "" @@ -1594,17 +1595,17 @@ msgstr "" #: ../../whatsnew/3.13.rst:1059 msgid "" ":func:`~os.fchmod` and support for file descriptors in :func:`~os.chmod` are " -"both now available on Windows. (Contributed by Serhiy Storchaka " -"in :gh:`113191`.)" +"both now available on Windows. (Contributed by Serhiy Storchaka in :gh:" +"`113191`.)" msgstr "" #: ../../whatsnew/3.13.rst:1063 msgid "" "On Windows, :func:`~os.mkdir` and :func:`~os.makedirs` now support passing a " "*mode* value of ``0o700`` to apply access control to the new directory. This " -"implicitly affects :func:`tempfile.mkdtemp` and is a mitigation " -"for :cve:`2024-4030`. Other values for *mode* continue to be ignored. " -"(Contributed by Steve Dower in :gh:`118486`.)" +"implicitly affects :func:`tempfile.mkdtemp` and is a mitigation for :cve:" +"`2024-4030`. Other values for *mode* continue to be ignored. (Contributed by " +"Steve Dower in :gh:`118486`.)" msgstr "" #: ../../whatsnew/3.13.rst:1070 @@ -1617,9 +1618,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:1074 msgid "" ":func:`~os.posix_spawn` can now use the :const:`~os.POSIX_SPAWN_CLOSEFROM` " -"attribute in the *file_actions* parameter on platforms that " -"support :c:func:`!posix_spawn_file_actions_addclosefrom_np`. (Contributed by " -"Jakub Kulik in :gh:`113117`.)" +"attribute in the *file_actions* parameter on platforms that support :c:func:" +"`!posix_spawn_file_actions_addclosefrom_np`. (Contributed by Jakub Kulik in :" +"gh:`113117`.)" msgstr "" #: ../../whatsnew/3.13.rst:1081 @@ -1652,9 +1653,9 @@ msgstr "pathlib" #: ../../whatsnew/3.13.rst:1100 msgid "" -"Add :exc:`~pathlib.UnsupportedOperation`, which is raised instead " -"of :exc:`NotImplementedError` when a path operation isn't supported. " -"(Contributed by Barney Gale in :gh:`89812`.)" +"Add :exc:`~pathlib.UnsupportedOperation`, which is raised instead of :exc:" +"`NotImplementedError` when a path operation isn't supported. (Contributed by " +"Barney Gale in :gh:`89812`.)" msgstr "" #: ../../whatsnew/3.13.rst:1104 @@ -1680,8 +1681,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:1117 msgid "" -"Add *recurse_symlinks* keyword-only argument to :meth:`.Path.glob` " -"and :meth:`~pathlib.Path.rglob`. (Contributed by Barney Gale in :gh:`77609`.)" +"Add *recurse_symlinks* keyword-only argument to :meth:`.Path.glob` and :meth:" +"`~pathlib.Path.rglob`. (Contributed by Barney Gale in :gh:`77609`.)" msgstr "" #: ../../whatsnew/3.13.rst:1121 @@ -1694,9 +1695,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:1126 msgid "" "Add the *follow_symlinks* keyword-only argument to :meth:`Path.is_file " -"<pathlib.Path.is_file>`, :meth:`Path.is_dir " -"<pathlib.Path.is_dir>`, :meth:`.Path.owner`, and :meth:`.Path.group`. " -"(Contributed by Barney Gale in :gh:`105793` and Kamil Turek in :gh:`107962`.)" +"<pathlib.Path.is_file>`, :meth:`Path.is_dir <pathlib.Path.is_dir>`, :meth:`." +"Path.owner`, and :meth:`.Path.group`. (Contributed by Barney Gale in :gh:" +"`105793` and Kamil Turek in :gh:`107962`.)" msgstr "" #: ../../whatsnew/3.13.rst:1134 @@ -1729,8 +1730,8 @@ msgstr "" msgid "" "Add ability to move between chained exceptions during post-mortem debugging " "in :func:`~pdb.pm` using the new :pdbcmd:`exceptions [exc_number] " -"<exceptions>` command for Pdb. (Contributed by Matthias Bussonnier " -"in :gh:`106676`.)" +"<exceptions>` command for Pdb. (Contributed by Matthias Bussonnier in :gh:" +"`106676`.)" msgstr "" #: ../../whatsnew/3.13.rst:1154 @@ -1766,8 +1767,8 @@ msgstr "re" #: ../../whatsnew/3.13.rst:1177 msgid "" -"Rename :exc:`!re.error` to :exc:`~re.PatternError` for improved " -"clarity. :exc:`!re.error` is kept for backward compatibility." +"Rename :exc:`!re.error` to :exc:`~re.PatternError` for improved clarity. :" +"exc:`!re.error` is kept for backward compatibility." msgstr "" #: ../../whatsnew/3.13.rst:1182 @@ -1776,9 +1777,8 @@ msgstr "shutil" #: ../../whatsnew/3.13.rst:1184 msgid "" -"Support the *dir_fd* and *follow_symlinks* keyword arguments " -"in :func:`~shutil.chown`. (Contributed by Berker Peksag and Tahia K " -"in :gh:`62308`)" +"Support the *dir_fd* and *follow_symlinks* keyword arguments in :func:" +"`~shutil.chown`. (Contributed by Berker Peksag and Tahia K in :gh:`62308`)" msgstr "" #: ../../whatsnew/3.13.rst:1190 @@ -1787,9 +1787,9 @@ msgstr "site" #: ../../whatsnew/3.13.rst:1192 msgid "" -":file:`.pth` files are now decoded using UTF-8 first, and then with " -"the :term:`locale encoding` if UTF-8 decoding fails. (Contributed by Inada " -"Naoki in :gh:`117802`.)" +":file:`.pth` files are now decoded using UTF-8 first, and then with the :" +"term:`locale encoding` if UTF-8 decoding fails. (Contributed by Inada Naoki " +"in :gh:`117802`.)" msgstr "" #: ../../whatsnew/3.13.rst:1198 @@ -1806,8 +1806,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:1204 msgid "" "Add the *filter* keyword-only parameter to :meth:`.Connection.iterdump` for " -"filtering database objects to dump. (Contributed by Mariusz Felisiak " -"in :gh:`91602`.)" +"filtering database objects to dump. (Contributed by Mariusz Felisiak in :gh:" +"`91602`.)" msgstr "" #: ../../whatsnew/3.13.rst:1210 @@ -1816,9 +1816,9 @@ msgstr "ssl" #: ../../whatsnew/3.13.rst:1212 msgid "" -"The :func:`~ssl.create_default_context` API now " -"includes :data:`~ssl.VERIFY_X509_PARTIAL_CHAIN` " -"and :data:`~ssl.VERIFY_X509_STRICT` in its default flags." +"The :func:`~ssl.create_default_context` API now includes :data:`~ssl." +"VERIFY_X509_PARTIAL_CHAIN` and :data:`~ssl.VERIFY_X509_STRICT` in its " +"default flags." msgstr "" #: ../../whatsnew/3.13.rst:1218 @@ -1852,8 +1852,8 @@ msgstr "statistics" msgid "" "Add :func:`~statistics.kde` for kernel density estimation. This makes it " "possible to estimate a continuous probability density function from a fixed " -"number of discrete samples. (Contributed by Raymond Hettinger " -"in :gh:`115863`.)" +"number of discrete samples. (Contributed by Raymond Hettinger in :gh:" +"`115863`.)" msgstr "" #: ../../whatsnew/3.13.rst:1241 @@ -1885,11 +1885,11 @@ msgstr "" #: ../../whatsnew/3.13.rst:1261 msgid "" "A private control knob :attr:`!subprocess._USE_POSIX_SPAWN` can be set to " -"``False`` if you need to force :mod:`subprocess` to never " -"use :func:`~os.posix_spawn`. Please report your reason and platform details " -"in the :ref:`issue tracker <using-the-tracker>` if you set this so that we " -"can improve our API selection logic for everyone. (Contributed by Jakub " -"Kulik in :gh:`113117`.)" +"``False`` if you need to force :mod:`subprocess` to never use :func:`~os." +"posix_spawn`. Please report your reason and platform details in the :ref:" +"`issue tracker <using-the-tracker>` if you set this so that we can improve " +"our API selection logic for everyone. (Contributed by Jakub Kulik in :gh:" +"`113117`.)" msgstr "" #: ../../whatsnew/3.13.rst:1271 ../../whatsnew/3.13.rst:2811 @@ -1911,8 +1911,8 @@ msgstr "tempfile" msgid "" "On Windows, the default mode ``0o700`` used by :func:`tempfile.mkdtemp` now " "limits access to the new directory due to changes to :func:`os.mkdir`. This " -"is a mitigation for :cve:`2024-4030`. (Contributed by Steve Dower " -"in :gh:`118486`.)" +"is a mitigation for :cve:`2024-4030`. (Contributed by Steve Dower in :gh:" +"`118486`.)" msgstr "" #: ../../whatsnew/3.13.rst:1288 @@ -1932,8 +1932,8 @@ msgid "" "On Windows, :func:`~time.time` now uses the " "``GetSystemTimePreciseAsFileTime()`` clock for a resolution of 1 " "microsecond, instead of the ``GetSystemTimeAsFileTime()`` clock which has a " -"resolution of 15.6 milliseconds. (Contributed by Victor Stinner " -"in :gh:`63207`.)" +"resolution of 15.6 milliseconds. (Contributed by Victor Stinner in :gh:" +"`63207`.)" msgstr "" #: ../../whatsnew/3.13.rst:1304 @@ -1953,9 +1953,8 @@ msgid "" "The :mod:`tkinter` widget method :meth:`!wm_attributes` now accepts the " "attribute name without the minus prefix to get window attributes, for " "example ``w.wm_attributes('alpha')`` and allows specifying attributes and " -"values to set as keyword arguments, for example " -"``w.wm_attributes(alpha=0.5)``. (Contributed by Serhiy Storchaka " -"in :gh:`43457`.)" +"values to set as keyword arguments, for example ``w." +"wm_attributes(alpha=0.5)``. (Contributed by Serhiy Storchaka in :gh:`43457`.)" msgstr "" #: ../../whatsnew/3.13.rst:1319 @@ -1975,10 +1974,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:1328 msgid "" -"Support the \"vsapi\" element type in " -"the :meth:`~tkinter.ttk.Style.element_create` method " -"of :class:`tkinter.ttk.Style`. (Contributed by Serhiy Storchaka " -"in :gh:`68166`.)" +"Support the \"vsapi\" element type in the :meth:`~tkinter.ttk.Style." +"element_create` method of :class:`tkinter.ttk.Style`. (Contributed by Serhiy " +"Storchaka in :gh:`68166`.)" msgstr "" #: ../../whatsnew/3.13.rst:1333 @@ -2016,9 +2014,9 @@ msgstr "traceback" #: ../../whatsnew/3.13.rst:1357 msgid "" -"Add the :attr:`~traceback.TracebackException.exc_type_str` attribute " -"to :class:`~traceback.TracebackException`, which holds a string display of " -"the *exc_type*. Deprecate the :attr:`~traceback.TracebackException.exc_type` " +"Add the :attr:`~traceback.TracebackException.exc_type_str` attribute to :" +"class:`~traceback.TracebackException`, which holds a string display of the " +"*exc_type*. Deprecate the :attr:`~traceback.TracebackException.exc_type` " "attribute, which holds the type object itself. Add parameter *save_exc_type* " "(default ``True``) to indicate whether ``exc_type`` should be saved. " "(Contributed by Irit Katriel in :gh:`112332`.)" @@ -2026,10 +2024,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:1366 msgid "" -"Add a new *show_group* keyword-only parameter " -"to :meth:`.TracebackException.format_exception_only` to (recursively) format " -"the nested exceptions of a :exc:`BaseExceptionGroup` instance. (Contributed " -"by Irit Katriel in :gh:`105292`.)" +"Add a new *show_group* keyword-only parameter to :meth:`.TracebackException." +"format_exception_only` to (recursively) format the nested exceptions of a :" +"exc:`BaseExceptionGroup` instance. (Contributed by Irit Katriel in :gh:" +"`105292`.)" msgstr "" #: ../../whatsnew/3.13.rst:1373 @@ -2040,8 +2038,8 @@ msgstr "types" msgid "" ":class:`~types.SimpleNamespace` can now take a single positional argument to " "initialise the namespace's arguments. This argument must either be a mapping " -"or an iterable of key-value pairs. (Contributed by Serhiy Storchaka " -"in :gh:`108191`.)" +"or an iterable of key-value pairs. (Contributed by Serhiy Storchaka in :gh:" +"`108191`.)" msgstr "" #: ../../whatsnew/3.13.rst:1382 ../../whatsnew/3.13.rst:1762 @@ -2070,14 +2068,14 @@ msgstr "" #: ../../whatsnew/3.13.rst:1394 msgid "" "Add :func:`~typing.get_protocol_members` to return the set of members " -"defining a :class:`typing.Protocol`. (Contributed by Jelle Zijlstra " -"in :gh:`104873`.)" +"defining a :class:`typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:" +"`104873`.)" msgstr "" #: ../../whatsnew/3.13.rst:1398 msgid "" -"Add :func:`~typing.is_protocol` to check whether a class is " -"a :class:`~typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:`104873`.)" +"Add :func:`~typing.is_protocol` to check whether a class is a :class:" +"`~typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:`104873`.)" msgstr "" #: ../../whatsnew/3.13.rst:1402 @@ -2159,9 +2157,9 @@ msgstr "(由 Sebastian Pipping 在 :gh:`115623` 中貢獻。)" #: ../../whatsnew/3.13.rst:1454 msgid "" -"Add the :meth:`!close` method for the iterator returned " -"by :func:`~xml.etree.ElementTree.iterparse` for explicit cleanup. " -"(Contributed by Serhiy Storchaka in :gh:`69893`.)" +"Add the :meth:`!close` method for the iterator returned by :func:`~xml.etree." +"ElementTree.iterparse` for explicit cleanup. (Contributed by Serhiy " +"Storchaka in :gh:`69893`.)" msgstr "" #: ../../whatsnew/3.13.rst:1460 @@ -2182,9 +2180,9 @@ msgstr "最佳化" msgid "" "Several standard library modules have had their import times significantly " "improved. For example, the import time of the :mod:`typing` module has been " -"reduced by around a third by removing dependencies on :mod:`re` " -"and :mod:`contextlib`. Other modules to enjoy import-time speedups " -"include :mod:`email.utils`, :mod:`enum`, :mod:`functools`, :mod:`importlib.metadata`, " +"reduced by around a third by removing dependencies on :mod:`re` and :mod:" +"`contextlib`. Other modules to enjoy import-time speedups include :mod:" +"`email.utils`, :mod:`enum`, :mod:`functools`, :mod:`importlib.metadata`, " "and :mod:`threading`. (Contributed by Alex Waygood, Shantanu Jain, Adam " "Turner, Daniel Hollas, and others in :gh:`109653`.)" msgstr "" @@ -2257,31 +2255,31 @@ msgstr ":mod:`!cgi` 和 :mod:`!cgitb`" #: ../../whatsnew/3.13.rst:1527 msgid "" -":class:`!cgi.FieldStorage` can typically be replaced " -"with :func:`urllib.parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and " -"the :mod:`email.message` module or the :pypi:`multipart` library for " -"``POST`` and ``PUT`` requests." +":class:`!cgi.FieldStorage` can typically be replaced with :func:`urllib." +"parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." +"message` module or the :pypi:`multipart` library for ``POST`` and ``PUT`` " +"requests." msgstr "" -":class:`!cgi.FieldStorage`,在於``GET`` 和 ``HEAD`` 請求中通常可以" -"被 :func:`urllib.parse.parse_qsl` 取代,而在於 ``POST`` 和 ``PUT`` 請求中可以" -"被 :mod:`email.message` 模組或 :pypi:`multipart` 函式庫取代。" +":class:`!cgi.FieldStorage`,在於 ``GET`` 和 ``HEAD`` 請求中通常可以被 :func:" +"`urllib.parse.parse_qsl` 取代,而在於 ``POST`` 和 ``PUT`` 請求中可以被 :mod:" +"`email.message` 模組或 :pypi:`multipart` 函式庫取代。" #: ../../whatsnew/3.13.rst:1532 msgid "" ":func:`!cgi.parse` can be replaced by calling :func:`urllib.parse.parse_qs` " "directly on the desired query string, unless the input is ``multipart/form-" -"data``, which should be replaced as described below for :func:`!" -"cgi.parse_multipart`." +"data``, which should be replaced as described below for :func:`!cgi." +"parse_multipart`." msgstr "" -":func:`!cgi.parse` 能夠以在所需的查詢字串上直接呼" -"叫 :func:`urllib.parse.parse_qs` 來取代,除非輸入為 ``multipart/form-data``," -"而這種情況則應該如下所述地將 :func:`!cgi.parse_multipart` 給替換掉。" +":func:`!cgi.parse` 能夠以在所需的查詢字串上直接呼叫 :func:`urllib.parse." +"parse_qs` 來取代,除非輸入為 ``multipart/form-data``,而這種情況則應該如下所" +"述地將 :func:`!cgi.parse_multipart` 給替換掉。" #: ../../whatsnew/3.13.rst:1537 msgid "" -":func:`!cgi.parse_header` can be replaced with the functionality in " -"the :mod:`email` package, which implements the same MIME RFCs. For example, " -"with :class:`email.message.EmailMessage`:" +":func:`!cgi.parse_header` can be replaced with the functionality in the :mod:" +"`email` package, which implements the same MIME RFCs. For example, with :" +"class:`email.message.EmailMessage`:" msgstr "" #: ../../whatsnew/3.13.rst:1541 @@ -2300,16 +2298,14 @@ msgstr "" #: ../../whatsnew/3.13.rst:1549 msgid "" -":func:`!cgi.parse_multipart` can be replaced with the functionality in " -"the :mod:`email` package, which implements the same MIME RFCs, or with " -"the :pypi:`multipart` library. For example, " -"the :class:`email.message.EmailMessage` and :class:`email.message.Message` " -"classes." +":func:`!cgi.parse_multipart` can be replaced with the functionality in the :" +"mod:`email` package, which implements the same MIME RFCs, or with the :pypi:" +"`multipart` library. For example, the :class:`email.message.EmailMessage` " +"and :class:`email.message.Message` classes." msgstr "" ":func:`!cgi.parse_multipart` 可以被 :mod:`email` 函式庫中實作相同 MIME RFCs " -"的功能取代,或者可以被 :pypi:`multipart` 函式庫取代,例" -"如 :class:`email.message.EmailMessage` 和 :class:`email.message.Message` 類" -"別。" +"的功能取代,或者可以被 :pypi:`multipart` 函式庫取代,例如 :class:`email." +"message.EmailMessage` 和 :class:`email.message.Message` 類別。" #: ../../whatsnew/3.13.rst:1555 msgid "" @@ -2351,11 +2347,11 @@ msgstr "" #: ../../whatsnew/3.13.rst:1572 msgid "" -":pypi:`crypt_r`: Fork of the :mod:`!crypt` module, wrapper to " -"the :manpage:`crypt_r(3)` library call and associated functionality." +":pypi:`crypt_r`: Fork of the :mod:`!crypt` module, wrapper to the :manpage:" +"`crypt_r(3)` library call and associated functionality." msgstr "" -":pypi:`crypt_r`:對 :mod:`!crypt` 模組的分支 (fork)," -"對 :manpage:`crypt_r(3)` 函式庫呼叫及相關功能的包裝。" +":pypi:`crypt_r`:對 :mod:`!crypt` 模組的分支 (fork),對 :manpage:" +"`crypt_r(3)` 函式庫呼叫及相關功能的包裝。" #: ../../whatsnew/3.13.rst:1576 msgid "" @@ -2420,8 +2416,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:1605 msgid "" -":mod:`!pipes`: Use the :mod:`subprocess` module instead. " -"Use :func:`shlex.quote` to replace the undocumented ``pipes.quote`` function." +":mod:`!pipes`: Use the :mod:`subprocess` module instead. Use :func:`shlex." +"quote` to replace the undocumented ``pipes.quote`` function." msgstr "" ":mod:`!pipes`:請改用 :mod:`subprocess` 模組。使用 :func:`shlex.quote` 來取代" "未以文件紀錄的 ``pipes.quote`` 函式。" @@ -2496,8 +2492,8 @@ msgstr ":pypi:`standard-xdrlib`:PyPI 上的 ``xdrlib`` 函式庫重新發布 #: ../../whatsnew/3.13.rst:1644 msgid "" -"(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` " -"and :gh:`104780`.)" +"(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` and :gh:" +"`104780`.)" msgstr "" "(由 Victor Stinner 和 Zachary Ware 在 :gh:`104773` 和 :gh:`104780` 中貢" "獻。)" @@ -2509,8 +2505,8 @@ msgstr "2to3" #: ../../whatsnew/3.13.rst:1650 msgid "" "Remove the :program:`2to3` program and the :mod:`!lib2to3` module, " -"previously deprecated in Python 3.11. (Contributed by Victor Stinner " -"in :gh:`104780`.)" +"previously deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:" +"`104780`.)" msgstr "" #: ../../whatsnew/3.13.rst:1656 @@ -2519,9 +2515,9 @@ msgstr "builtins" #: ../../whatsnew/3.13.rst:1658 msgid "" -"Remove support for chained :class:`classmethod` descriptors (introduced " -"in :gh:`63272`). These can no longer be used to wrap other descriptors, such " -"as :class:`property`. The core design of this feature was flawed and led to " +"Remove support for chained :class:`classmethod` descriptors (introduced in :" +"gh:`63272`). These can no longer be used to wrap other descriptors, such as :" +"class:`property`. The core design of this feature was flawed and led to " "several problems. To \"pass-through\" a :class:`classmethod`, consider using " "the :attr:`!__wrapped__` attribute that was added in Python 3.10. " "(Contributed by Raymond Hettinger in :gh:`89519`.)" @@ -2547,9 +2543,9 @@ msgstr "importlib.metadata" #: ../../whatsnew/3.13.rst:1684 msgid "" -"Remove deprecated subscript (:meth:`~object.__getitem__`) access " -"for :ref:`EntryPoint <entry-points>` objects. (Contributed by Jason R. " -"Coombs in :gh:`113175`.)" +"Remove deprecated subscript (:meth:`~object.__getitem__`) access for :ref:" +"`EntryPoint <entry-points>` objects. (Contributed by Jason R. Coombs in :gh:" +"`113175`.)" msgstr "" #: ../../whatsnew/3.13.rst:1690 @@ -2569,19 +2565,18 @@ msgstr "opcode" #: ../../whatsnew/3.13.rst:1700 msgid "" -"Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!" -"_opcode.ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " +"Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!_opcode." +"ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " "documented, and is not intended for external use. (Contributed by Irit " "Katriel in :gh:`105481`.)" msgstr "" #: ../../whatsnew/3.13.rst:1705 msgid "" -"Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, " -"and :attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but " -"were neither documented nor exposed through :mod:`dis`, and were not " -"intended to be used externally. (Contributed by Irit Katriel " -"in :gh:`105481`.)" +"Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, and :" +"attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but were " +"neither documented nor exposed through :mod:`dis`, and were not intended to " +"be used externally. (Contributed by Irit Katriel in :gh:`105481`.)" msgstr "" #: ../../whatsnew/3.13.rst:1713 @@ -2590,12 +2585,12 @@ msgstr "optparse" #: ../../whatsnew/3.13.rst:1715 msgid "" -"This module is no longer considered :term:`soft deprecated`. " -"While :mod:`argparse` remains preferred for new projects that aren't using a " -"third party command line argument processing library, there are aspects of " -"the way ``argparse`` works that mean the lower level ``optparse`` module may " -"provide a better foundation for *writing* argument processing libraries, and " -"for implementing command line applications which adhere more strictly than " +"This module is no longer considered :term:`soft deprecated`. While :mod:" +"`argparse` remains preferred for new projects that aren't using a third " +"party command line argument processing library, there are aspects of the way " +"``argparse`` works that mean the lower level ``optparse`` module may provide " +"a better foundation for *writing* argument processing libraries, and for " +"implementing command line applications which adhere more strictly than " "``argparse`` does to various Unix command line processing conventions that " "originate in the behaviour of the C :c:func:`!getopt` function . " "(Contributed by Alyssa Coghlan and Serhiy Storchaka in :gh:`126180`.)" @@ -2641,15 +2636,15 @@ msgstr "" msgid "" "Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces, deprecated " "since Python 3.8. The items in those namespaces can be imported directly " -"from the :mod:`typing` module. (Contributed by Sebastian Rittau " -"in :gh:`92871`.)" +"from the :mod:`typing` module. (Contributed by Sebastian Rittau in :gh:" +"`92871`.)" msgstr "" #: ../../whatsnew/3.13.rst:1770 msgid "" "Remove the keyword-argument method of creating :class:`~typing.TypedDict` " -"types, deprecated in Python 3.11. (Contributed by Tomas Roun " -"in :gh:`104786`.)" +"types, deprecated in Python 3.11. (Contributed by Tomas Roun in :gh:" +"`104786`.)" msgstr "" #: ../../whatsnew/3.13.rst:1776 @@ -2696,8 +2691,8 @@ msgstr "(由 Hugo van Kemenade 在 :gh:`104835` 中貢獻。)" #: ../../whatsnew/3.13.rst:1792 msgid "" "Remove the untested and undocumented :meth:`!TestProgram.usageExit` method, " -"deprecated in Python 3.11. (Contributed by Hugo van Kemenade " -"in :gh:`104992`.)" +"deprecated in Python 3.11. (Contributed by Hugo van Kemenade in :gh:" +"`104992`.)" msgstr "" #: ../../whatsnew/3.13.rst:1798 @@ -2706,13 +2701,13 @@ msgstr "urllib" #: ../../whatsnew/3.13.rst:1800 msgid "" -"Remove the *cafile*, *capath*, and *cadefault* parameters of " -"the :func:`urllib.request.urlopen` function, deprecated in Python 3.6. Use " -"the *context* parameter instead with an :class:`~ssl.SSLContext` instance. " -"The :meth:`ssl.SSLContext.load_cert_chain` function can be used to load " -"specific certificates, or let :func:`ssl.create_default_context` select the " -"operating system's trusted certificate authority (CA) certificates. " -"(Contributed by Victor Stinner in :gh:`105382`.)" +"Remove the *cafile*, *capath*, and *cadefault* parameters of the :func:" +"`urllib.request.urlopen` function, deprecated in Python 3.6. Use the " +"*context* parameter instead with an :class:`~ssl.SSLContext` instance. The :" +"meth:`ssl.SSLContext.load_cert_chain` function can be used to load specific " +"certificates, or let :func:`ssl.create_default_context` select the operating " +"system's trusted certificate authority (CA) certificates. (Contributed by " +"Victor Stinner in :gh:`105382`.)" msgstr "" #: ../../whatsnew/3.13.rst:1811 @@ -2728,9 +2723,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:1818 msgid "" -"Remove the deprecated :attr:`!MacOSXOSAScript._name` attribute. Use " -"the :attr:`MacOSXOSAScript.name <webbrowser.controller.name>` attribute " -"instead. (Contributed by Nikita Sobolev in :gh:`105546`.)" +"Remove the deprecated :attr:`!MacOSXOSAScript._name` attribute. Use the :" +"attr:`MacOSXOSAScript.name <webbrowser.controller.name>` attribute instead. " +"(Contributed by Nikita Sobolev in :gh:`105546`.)" msgstr "" #: ../../whatsnew/3.13.rst:1825 @@ -2759,8 +2754,8 @@ msgid "" "Deprecate the ``'u'`` format code (:c:type:`wchar_t`) at runtime. This " "format code has been deprecated in documentation since Python 3.3, and will " "be removed in Python 3.16. Use the ``'w'`` format code (:c:type:`Py_UCS4`) " -"for Unicode characters instead. (Contributed by Hugo van Kemenade " -"in :gh:`80480`.)" +"for Unicode characters instead. (Contributed by Hugo van Kemenade in :gh:" +"`80480`.)" msgstr "" #: ../../whatsnew/3.13.rst:1844 @@ -2798,9 +2793,8 @@ msgstr ":mod:`dis`:" #: ../../whatsnew/3.13.rst:1863 msgid "" -"Deprecate the :attr:`!HAVE_ARGUMENT` separator. Check membership " -"in :data:`~dis.hasarg` instead. (Contributed by Irit Katriel " -"in :gh:`109319`.)" +"Deprecate the :attr:`!HAVE_ARGUMENT` separator. Check membership in :data:" +"`~dis.hasarg` instead. (Contributed by Irit Katriel in :gh:`109319`.)" msgstr "" #: ../../whatsnew/3.13.rst:1867 @@ -2820,10 +2814,10 @@ msgstr ":mod:`glob`:" #: ../../whatsnew/3.13.rst:1876 msgid "" -"Deprecate the undocumented :func:`!glob0` and :func:`!glob1` functions. " -"Use :func:`~glob.glob` and pass a :term:`path-like object` specifying the " -"root directory to the *root_dir* parameter instead. (Contributed by Barney " -"Gale in :gh:`117337`.)" +"Deprecate the undocumented :func:`!glob0` and :func:`!glob1` functions. Use :" +"func:`~glob.glob` and pass a :term:`path-like object` specifying the root " +"directory to the *root_dir* parameter instead. (Contributed by Barney Gale " +"in :gh:`117337`.)" msgstr "" #: ../../whatsnew/3.13.rst:1881 @@ -2853,9 +2847,9 @@ msgstr ":mod:`mimetypes`:" #: ../../whatsnew/3.13.rst:1897 msgid "" -":term:`Soft-deprecate <soft deprecated>` file path arguments " -"to :func:`~mimetypes.guess_type`, use :func:`~mimetypes.guess_file_type` " -"instead. (Contributed by Serhiy Storchaka in :gh:`66543`.)" +":term:`Soft-deprecate <soft deprecated>` file path arguments to :func:" +"`~mimetypes.guess_type`, use :func:`~mimetypes.guess_file_type` instead. " +"(Contributed by Serhiy Storchaka in :gh:`66543`.)" msgstr "" #: ../../whatsnew/3.13.rst:1902 @@ -2872,19 +2866,19 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:1911 -#: ../../deprecations/pending-removal-in-3.15.rst:42 +#: ../../deprecations/pending-removal-in-3.15.rst:46 msgid ":mod:`pathlib`:" msgstr ":mod:`pathlib`:" #: ../../whatsnew/3.13.rst:1913 msgid "" -"Deprecate :meth:`.PurePath.is_reserved`, to be removed in Python 3.15. " -"Use :func:`os.path.isreserved` to detect reserved paths on Windows. " -"(Contributed by Barney Gale in :gh:`88569`.)" +"Deprecate :meth:`.PurePath.is_reserved`, to be removed in Python 3.15. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows. (Contributed " +"by Barney Gale in :gh:`88569`.)" msgstr "" #: ../../whatsnew/3.13.rst:1918 -#: ../../deprecations/pending-removal-in-3.15.rst:48 +#: ../../deprecations/pending-removal-in-3.15.rst:52 msgid ":mod:`platform`:" msgstr ":mod:`platform`:" @@ -2912,28 +2906,28 @@ msgstr ":mod:`sqlite3`:" #: ../../whatsnew/3.13.rst:1933 msgid "" -"Deprecate passing more than one positional argument to " -"the :func:`~sqlite3.connect` function and the :class:`~sqlite3.Connection` " -"constructor. The remaining parameters will become keyword-only in Python " -"3.15. (Contributed by Erlend E. Aasland in :gh:`107948`.)" +"Deprecate passing more than one positional argument to the :func:`~sqlite3." +"connect` function and the :class:`~sqlite3.Connection` constructor. The " +"remaining parameters will become keyword-only in Python 3.15. (Contributed " +"by Erlend E. Aasland in :gh:`107948`.)" msgstr "" #: ../../whatsnew/3.13.rst:1939 msgid "" "Deprecate passing name, number of arguments, and the callable as keyword " -"arguments for :meth:`.Connection.create_function` " -"and :meth:`.Connection.create_aggregate` These parameters will become " -"positional-only in Python 3.15. (Contributed by Erlend E. Aasland " -"in :gh:`108278`.)" +"arguments for :meth:`.Connection.create_function` and :meth:`.Connection." +"create_aggregate` These parameters will become positional-only in Python " +"3.15. (Contributed by Erlend E. Aasland in :gh:`108278`.)" msgstr "" #: ../../whatsnew/3.13.rst:1945 msgid "" -"Deprecate passing the callback callable by keyword for " -"the :meth:`~sqlite3.Connection.set_authorizer`, :meth:`~sqlite3.Connection.set_progress_handler`, " -"and :meth:`~sqlite3.Connection.set_trace_callback` :class:`~sqlite3.Connection` " -"methods. The callback callables will become positional-only in Python 3.15. " -"(Contributed by Erlend E. Aasland in :gh:`108278`.)" +"Deprecate passing the callback callable by keyword for the :meth:`~sqlite3." +"Connection.set_authorizer`, :meth:`~sqlite3.Connection." +"set_progress_handler`, and :meth:`~sqlite3.Connection.set_trace_callback` :" +"class:`~sqlite3.Connection` methods. The callback callables will become " +"positional-only in Python 3.15. (Contributed by Erlend E. Aasland in :gh:" +"`108278`.)" msgstr "" #: ../../whatsnew/3.13.rst:1953 @@ -2965,35 +2959,34 @@ msgstr ":mod:`traceback`:" #: ../../whatsnew/3.13.rst:1968 msgid "" -"Deprecate the :attr:`.TracebackException.exc_type` attribute. " -"Use :attr:`.TracebackException.exc_type_str` instead. (Contributed by Irit " -"Katriel in :gh:`112332`.)" +"Deprecate the :attr:`.TracebackException.exc_type` attribute. Use :attr:`." +"TracebackException.exc_type_str` instead. (Contributed by Irit Katriel in :" +"gh:`112332`.)" msgstr "" #: ../../whatsnew/3.13.rst:1972 -#: ../../deprecations/pending-removal-in-3.15.rst:71 +#: ../../deprecations/pending-removal-in-3.15.rst:80 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" #: ../../whatsnew/3.13.rst:1974 msgid "" -"Deprecate the undocumented keyword argument syntax for " -"creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " -"NamedTuple(\"Point\", x=int, y=int)``), to be removed in Python 3.15. Use " -"the class-based syntax or the functional syntax instead. (Contributed by " -"Alex Waygood in :gh:`105566`.)" +"Deprecate the undocumented keyword argument syntax for creating :class:" +"`~typing.NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, " +"y=int)``), to be removed in Python 3.15. Use the class-based syntax or the " +"functional syntax instead. (Contributed by Alex Waygood in :gh:`105566`.)" msgstr "" #: ../../whatsnew/3.13.rst:1981 msgid "" -"Deprecate omitting the *fields* parameter when creating " -"a :class:`~typing.NamedTuple` or :class:`typing.TypedDict` class, and " -"deprecate passing ``None`` to the *fields* parameter of both types. Python " -"3.15 will require a valid sequence for the *fields* parameter. To create a " -"NamedTuple class with zero fields, use ``class NT(NamedTuple): pass`` or " -"``NT = NamedTuple(\"NT\", ())``. To create a TypedDict class with zero " -"fields, use ``class TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``. " -"(Contributed by Alex Waygood in :gh:`105566` and :gh:`105570`.)" +"Deprecate omitting the *fields* parameter when creating a :class:`~typing." +"NamedTuple` or :class:`typing.TypedDict` class, and deprecate passing " +"``None`` to the *fields* parameter of both types. Python 3.15 will require a " +"valid sequence for the *fields* parameter. To create a NamedTuple class with " +"zero fields, use ``class NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", " +"())``. To create a TypedDict class with zero fields, use ``class " +"TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``. (Contributed by " +"Alex Waygood in :gh:`105566` and :gh:`105570`.)" msgstr "" #: ../../whatsnew/3.13.rst:1991 @@ -3014,16 +3007,16 @@ msgid "" msgstr "" #: ../../whatsnew/3.13.rst:2005 -#: ../../deprecations/pending-removal-in-3.15.rst:84 +#: ../../deprecations/pending-removal-in-3.15.rst:93 msgid ":mod:`wave`:" msgstr ":mod:`wave`:" #: ../../whatsnew/3.13.rst:2007 msgid "" -"Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " -"and :meth:`~wave.Wave_read.getmarkers` methods of " -"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes, to be " -"removed in Python 3.15. (Contributed by Victor Stinner in :gh:`105096`.)" +"Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:" +"`~wave.Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :" +"class:`~wave.Wave_write` classes, to be removed in Python 3.15. (Contributed " +"by Victor Stinner in :gh:`105096`.)" msgstr "" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:2 @@ -3072,8 +3065,8 @@ msgstr ":class:`!ast.Ellipsis`" #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" -"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka " -"in :gh:`90953`.)" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" +"`90953`.)" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" @@ -3084,26 +3077,27 @@ msgstr ":mod:`asyncio`:" #: ../../deprecations/pending-removal-in-3.14.rst:24 msgid "" -"The child watcher " -"classes :class:`~asyncio.MultiLoopChildWatcher`, :class:`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` " -"and :class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " +"The child watcher classes :class:`~asyncio.MultiLoopChildWatcher`, :class:" +"`~asyncio.FastChildWatcher`, :class:`~asyncio.AbstractChildWatcher` and :" +"class:`~asyncio.SafeChildWatcher` are deprecated and will be removed in " "Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -"已棄用並將在 Python 3.14 中移除的 child watcher 類" -"別::class:`~asyncio.MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio.AbstractChildWatcher` " -"和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar Aditya 於 :gh:`94597` 貢" -"獻。)" +"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`~asyncio." +"MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio." +"AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " +"Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" -":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " -"and :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated " -"and will be removed in Python 3.14. (Contributed by Kumar Aditya " -"in :gh:`94597`.)" +":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" +"`asyncio.AbstractEventLoopPolicy.set_child_watcher` and :meth:`asyncio." +"AbstractEventLoopPolicy.get_child_watcher` are deprecated and will be " +"removed in Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` " -"和 :meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 " -"Python 3.14 中移除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" +":func:`asyncio.set_child_watcher`、:func:`asyncio.get_child_watcher`、:meth:" +"`asyncio.AbstractEventLoopPolicy.set_child_watcher` 和 :meth:`asyncio." +"AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" +"除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" @@ -3120,21 +3114,18 @@ msgstr "" msgid "" ":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " "Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " -"typing, prefer a union, like ``bytes | bytearray``, " -"or :class:`collections.abc.Buffer`. (Contributed by Shantanu Jain " -"in :gh:`91896`.)" -msgstr "" -":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改" -"用 :class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用" -"時,請改用聯集,如 ``bytes | bytearray``," -"或 :class:`collections.abc.Buffer`。(由 Shantanu Jain 於 :gh:`91896` 貢" -"獻。)" +"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." +"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" +msgstr "" +":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改用 :" +"class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用時,請" +"改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " +"Shantanu Jain 於 :gh:`91896` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:47 msgid "" -":mod:`email`: Deprecated the *isdst* parameter " -"in :func:`email.utils.localtime`. (Contributed by Alan Williams " -"in :gh:`72346`.)" +":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" msgstr "" ":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 貢獻。)" @@ -3188,25 +3179,24 @@ msgid "" "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " "currently the default (:gh:`84559`). Adding a runtime warning about this was " "deemed too disruptive as the majority of code is not expected to care. Use " -"the :func:`~multiprocessing.get_context` " -"or :func:`~multiprocessing.set_start_method` APIs to explicitly specify when " -"your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`." +"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." +"set_start_method` APIs to explicitly specify when your code *requires* " +"``'fork'``. See :ref:`multiprocessing-start-methods`." msgstr "" ":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平" "台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。對此增加一" -"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使" -"用 :func:`~multiprocessing.get_context` " -"或 :func:`~multiprocessing.set_start_method` API 來明確指定你的程式碼何時\\ *" -"需要* ``'fork'``。請參閱 :ref:`multiprocessing-start-methods`。" +"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用 :func:" +"`~multiprocessing.get_context` 或 :func:`~multiprocessing.set_start_method` " +"API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" +"`multiprocessing-start-methods`。" #: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" -":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` " -"and :meth:`~pathlib.PurePath.relative_to`: passing additional arguments is " -"deprecated." +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." +"PurePath.relative_to`: passing additional arguments is deprecated." msgstr "" -":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` " -"和 :meth:`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" +":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" +"`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" #: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" @@ -3215,9 +3205,8 @@ msgid "" "instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" ":mod:`pkgutil`::func:`~pkgutil.find_loader` 和 :func:`~pkgutil.get_loader` " -"現在會引發 :exc:`DeprecationWarning`;請改" -"用 :func:`importlib.util.find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢" -"獻。)" +"現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." +"find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" @@ -3237,9 +3226,9 @@ msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" #: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" -":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` " -"if :ref:`named placeholders <sqlite3-placeholders>` are used and " -"*parameters* is a sequence instead of a :class:`dict`." +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" +"ref:`named placeholders <sqlite3-placeholders>` are used and *parameters* is " +"a sequence instead of a :class:`dict`." msgstr "" ":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如果" "使用 :ref:`named placeholders <sqlite3-placeholders>` 且 *parameters* 是序列" @@ -3256,8 +3245,8 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " -"intended to be a public API. (Contributed by Gregory P. Smith " -"in :gh:`88168`.)" +"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" +"`88168`.)" msgstr "" ":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 API。" "(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" @@ -3274,10 +3263,10 @@ msgstr "引入系統 (import system):" #: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -"Setting :attr:`~module.__cached__` on a module while failing to " -"set :attr:`__spec__.cached <importlib.machinery.ModuleSpec.cached>` is " -"deprecated. In Python 3.15, :attr:`!__cached__` will cease to be set or take " -"into consideration by the import system or standard library. (:gh:`97879`)" +"Setting :attr:`~module.__cached__` on a module while failing to set :attr:" +"`__spec__.cached <importlib.machinery.ModuleSpec.cached>` is deprecated. In " +"Python 3.15, :attr:`!__cached__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__cached__` 而沒有設定 :attr:`__spec__.cached " "<importlib.machinery.ModuleSpec.cached>` 的做法已被棄用。在 Python 3.15 中," @@ -3285,11 +3274,10 @@ msgstr "" #: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -"Setting :attr:`~module.__package__` on a module while failing to " -"set :attr:`__spec__.parent <importlib.machinery.ModuleSpec.parent>` is " -"deprecated. In Python 3.15, :attr:`!__package__` will cease to be set or " -"take into consideration by the import system or standard library. " -"(:gh:`97879`)" +"Setting :attr:`~module.__package__` on a module while failing to set :attr:" +"`__spec__.parent <importlib.machinery.ModuleSpec.parent>` is deprecated. In " +"Python 3.15, :attr:`!__package__` will cease to be set or take into " +"consideration by the import system or standard library. (:gh:`97879`)" msgstr "" "在模組上設定 :attr:`~module.__package__` 而沒有設定 :attr:`__spec__.parent " "<importlib.machinery.ModuleSpec.parent>` 的做法已被棄用。在 Python 3.15 中," @@ -3321,33 +3309,40 @@ msgstr "" "cgi` 旗標已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:56 +msgid ":mod:`importlib`:" +msgstr ":mod:`importlib`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:34 +msgid "``load_module()`` method: use ``exec_module()`` instead." +msgstr "``load_module()`` method:請改用 ``exec_module()``。" + +#: ../../deprecations/pending-removal-in-3.15.rst:36 msgid ":class:`locale`:" msgstr ":class:`locale`:" -#: ../../deprecations/pending-removal-in-3.15.rst:34 +#: ../../deprecations/pending-removal-in-3.15.rst:38 msgid "" "The :func:`~locale.getdefaultlocale` function has been deprecated since " -"Python 3.11. Its removal was originally planned for Python 3.13 " -"(:gh:`90817`), but has been postponed to Python 3.15. " -"Use :func:`~locale.getlocale`, :func:`~locale.setlocale`, " -"and :func:`~locale.getencoding` instead. (Contributed by Hugo van Kemenade " -"in :gh:`111187`.)" +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" ":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " -"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改" -"用 :func:`~locale.getlocale`、:func:`~locale.setlocale` " -"和 :func:`~locale.getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢" -"獻。)" +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:44 +#: ../../deprecations/pending-removal-in-3.15.rst:48 msgid "" -":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. " -"Use :func:`os.path.isreserved` to detect reserved paths on Windows." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請" -"用 :func:`os.path.isreserved` 來偵測 Windows 上的保留路徑。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:50 +#: ../../deprecations/pending-removal-in-3.15.rst:54 msgid "" ":func:`~platform.java_ver` has been deprecated since Python 3.13. This " "function is only useful for Jython support, has a confusing API, and is " @@ -3356,11 +3351,23 @@ msgstr "" "自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" "援有用,具有令人困惑的 API,基本上未經測試。" -#: ../../deprecations/pending-removal-in-3.15.rst:54 +#: ../../deprecations/pending-removal-in-3.15.rst:58 +msgid ":mod:`sysconfig`:" +msgstr ":mod:`sysconfig`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:60 +msgid "" +"The *check_home* argument of :func:`sysconfig.is_python_build` has been " +"deprecated since Python 3.12." +msgstr "" +":func:`sysconfig.is_python_build` 的 *check_home* 引數自 Python 3.12 起已被棄" +"用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:63 msgid ":mod:`threading`:" msgstr ":mod:`threading`:" -#: ../../deprecations/pending-removal-in-3.15.rst:56 +#: ../../deprecations/pending-removal-in-3.15.rst:65 msgid "" ":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " "arguments has been deprecated since Python 3.14, as the Python version does " @@ -3371,11 +3378,11 @@ msgstr "" "起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" "任意數量的位置或關鍵字引數,並忽略每個引數。" -#: ../../deprecations/pending-removal-in-3.15.rst:62 +#: ../../deprecations/pending-removal-in-3.15.rst:71 msgid ":mod:`types`:" msgstr ":mod:`types`:" -#: ../../deprecations/pending-removal-in-3.15.rst:64 +#: ../../deprecations/pending-removal-in-3.15.rst:73 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -3383,22 +3390,22 @@ msgid "" "in 3.15. (Contributed by Nikita Sobolev in :gh:`101866`.)" msgstr "" ":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" -"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發" -"出 :exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev " -"於 :gh:`101866` 貢獻。)" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.15 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:73 +#: ../../deprecations/pending-removal-in-3.15.rst:82 msgid "" -"The undocumented keyword argument syntax for " -"creating :class:`~typing.NamedTuple` classes (e.g. ``Point = " -"NamedTuple(\"Point\", x=int, y=int)``) has been deprecated since Python " -"3.13. Use the class-based syntax or the functional syntax instead." +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " +"has been deprecated since Python 3.13. Use the class-based syntax or the " +"functional syntax instead." msgstr "" "用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " "(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" "用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:79 +#: ../../deprecations/pending-removal-in-3.15.rst:88 msgid "" "The :func:`typing.no_type_check_decorator` decorator function has been " "deprecated since Python 3.13. After eight years in the :mod:`typing` module, " @@ -3408,16 +3415,15 @@ msgstr "" "用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" "援。" -#: ../../deprecations/pending-removal-in-3.15.rst:86 +#: ../../deprecations/pending-removal-in-3.15.rst:95 msgid "" -"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, " -"and :meth:`~wave.Wave_read.getmarkers` methods of " -"the :class:`~wave.Wave_read` and :class:`~wave.Wave_write` classes have been " -"deprecated since Python 3.13." +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." msgstr "" -"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別" -"的 :meth:`~wave.Wave_read.getmark`、:meth:`!setmark` " -"和 :meth:`~wave.Wave_read.getmarkers` 方法自 Python 3.13 被棄用。" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending removal in Python 3.16" @@ -3425,10 +3431,10 @@ msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:6 msgid "" -"Setting :attr:`~module.__loader__` on a module while failing to " -"set :attr:`__spec__.loader <importlib.machinery.ModuleSpec.loader>` is " -"deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or " -"taken into consideration by the import system or the standard library." +"Setting :attr:`~module.__loader__` on a module while failing to set :attr:" +"`__spec__.loader <importlib.machinery.ModuleSpec.loader>` is deprecated. In " +"Python 3.16, :attr:`!__loader__` will cease to be set or taken into " +"consideration by the import system or the standard library." msgstr "" "在模組上設定 :attr:`~module.__loader__` 而沒有設定 :attr:`__spec__.loader " "<importlib.machinery.ModuleSpec.loader>` 的做法將於 Python 3.16 被棄用。在 " @@ -3451,11 +3457,11 @@ msgid "" "by Jiahao Li and Kumar Aditya in :gh:`122875`.)" msgstr "" ":func:`!asyncio.iscoroutinefunction` 已被棄用並將在 Python 3.16 中移除,請改" -"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya " -"於 :gh:`122875` 貢獻。)" +"用 :func:`inspect.iscoroutinefunction`。(由 Jiahao Li 和 Kumar Aditya 於 :" +"gh:`122875` 貢獻。)" #: ../../deprecations/pending-removal-in-3.16.rst:26 -#: ../../deprecations/pending-removal-in-future.rst:12 +#: ../../deprecations/pending-removal-in-future.rst:10 msgid ":mod:`builtins`:" msgstr ":mod:`builtins`:" @@ -3531,15 +3537,11 @@ msgid "" "groups are deprecated." msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" -#: ../../deprecations/pending-removal-in-future.rst:10 -msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" -msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" - -#: ../../deprecations/pending-removal-in-future.rst:14 +#: ../../deprecations/pending-removal-in-future.rst:12 msgid "``bool(NotImplemented)``." msgstr "``bool(NotImplemented)``。" -#: ../../deprecations/pending-removal-in-future.rst:15 +#: ../../deprecations/pending-removal-in-future.rst:13 msgid "" "Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " "is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " @@ -3548,25 +3550,25 @@ msgstr "" "產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" "請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" -#: ../../deprecations/pending-removal-in-future.rst:18 +#: ../../deprecations/pending-removal-in-future.rst:16 msgid "" "Currently Python accepts numeric literals immediately followed by keywords, " "for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " "ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " "``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " -"if the numeric literal is immediately followed by one of " -"keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` " -"and :keyword:`or`. In a future release it will be changed to a syntax " -"error. (:gh:`87999`)" +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" msgstr "" "目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " "1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " -"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即" -"接 :keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:`in`、:keyword:`is` " -"和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版本中,它將被更改為語" -"法錯誤。(:gh:`87999`)" +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" +"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" +"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" +"本中,它將被更改為語法錯誤。(:gh:`87999`)" -#: ../../deprecations/pending-removal-in-future.rst:26 +#: ../../deprecations/pending-removal-in-future.rst:24 msgid "" "Support for ``__index__()`` and ``__int__()`` method returning non-int type: " "these methods will be required to return an instance of a strict subclass " @@ -3575,89 +3577,80 @@ msgstr "" "``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" "傳 :class:`int` 的嚴格子類別實例。" -#: ../../deprecations/pending-removal-in-future.rst:29 +#: ../../deprecations/pending-removal-in-future.rst:27 msgid "" -"Support for ``__float__()`` method returning a strict subclass " -"of :class:`float`: these methods will be required to return an instance " -"of :class:`float`." +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." msgstr "" "回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" "傳 :class:`float` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:32 +#: ../../deprecations/pending-removal-in-future.rst:30 msgid "" -"Support for ``__complex__()`` method returning a strict subclass " -"of :class:`complex`: these methods will be required to return an instance " -"of :class:`complex`." +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." msgstr "" "回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" "回傳 :class:`complex` 的實例。" -#: ../../deprecations/pending-removal-in-future.rst:35 +#: ../../deprecations/pending-removal-in-future.rst:33 msgid "Delegation of ``int()`` to ``__trunc__()`` method." msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:36 +#: ../../deprecations/pending-removal-in-future.rst:34 msgid "" -"Passing a complex number as the *real* or *imag* argument in " -"the :func:`complex` constructor is now deprecated; it should only be passed " -"as a single positional argument. (Contributed by Serhiy Storchaka " -"in :gh:`109218`.)" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" msgstr "" "在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" "它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:41 +#: ../../deprecations/pending-removal-in-future.rst:39 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " -"are deprecated and replaced by :data:`calendar.JANUARY` " -"and :data:`calendar.FEBRUARY`. (Contributed by Prince Roshan " -"in :gh:`103636`.)" +"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." +"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" msgstr "" ":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " "Roshan 於 :gh:`103636` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:46 +#: ../../deprecations/pending-removal-in-future.rst:44 msgid "" ":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " "instead." msgstr "" ":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" -#: ../../deprecations/pending-removal-in-future.rst:49 +#: ../../deprecations/pending-removal-in-future.rst:47 msgid ":mod:`datetime`:" msgstr ":mod:`datetime`:" -#: ../../deprecations/pending-removal-in-future.rst:51 +#: ../../deprecations/pending-removal-in-future.rst:49 msgid "" -":meth:`~datetime.datetime.utcnow`: use " -"``datetime.datetime.now(tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." msgstr "" -":meth:`~datetime.datetime.utcnow`:請改用 " -"``datetime.datetime.now(tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." +"now(tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:53 +#: ../../deprecations/pending-removal-in-future.rst:51 msgid "" -":meth:`~datetime.datetime.utcfromtimestamp`: use " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``." +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." msgstr "" -":meth:`~datetime.datetime.utcfromtimestamp`:請改用 " -"``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``。" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``。" -#: ../../deprecations/pending-removal-in-future.rst:56 +#: ../../deprecations/pending-removal-in-future.rst:54 msgid ":mod:`gettext`: Plural value must be an integer." msgstr ":mod:`gettext`:複數值必須是整數。" #: ../../deprecations/pending-removal-in-future.rst:58 -msgid ":mod:`importlib`:" -msgstr ":mod:`importlib`:" - -#: ../../deprecations/pending-removal-in-future.rst:60 -msgid "``load_module()`` method: use ``exec_module()`` instead." -msgstr "``load_module()`` method:請改用 ``exec_module()``。" - -#: ../../deprecations/pending-removal-in-future.rst:61 msgid "" ":func:`~importlib.util.cache_from_source` *debug_override* parameter is " "deprecated: use the *optimization* parameter instead." @@ -3665,39 +3658,39 @@ msgstr "" ":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" "用 *optimization* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:64 +#: ../../deprecations/pending-removal-in-future.rst:61 msgid ":mod:`importlib.metadata`:" msgstr ":mod:`importlib.metadata`:" -#: ../../deprecations/pending-removal-in-future.rst:66 +#: ../../deprecations/pending-removal-in-future.rst:63 msgid "``EntryPoints`` tuple interface." msgstr "``EntryPoints`` 元組介面。" -#: ../../deprecations/pending-removal-in-future.rst:67 +#: ../../deprecations/pending-removal-in-future.rst:64 msgid "Implicit ``None`` on return values." msgstr "回傳值上的隱式 ``None``。" -#: ../../deprecations/pending-removal-in-future.rst:69 +#: ../../deprecations/pending-removal-in-future.rst:66 msgid "" ":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " "use :meth:`~logging.warning` instead." msgstr "" -":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改" -"用 :meth:`~logging.warning`。" +":mod:`logging`:自 Python 3.3 起,``warn()`` 方法已被棄用,請改用 :meth:" +"`~logging.warning`。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:69 msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:75 +#: ../../deprecations/pending-removal-in-future.rst:72 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:74 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -3705,7 +3698,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:80 +#: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -3717,12 +3710,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:87 +#: ../../deprecations/pending-removal-in-future.rst:84 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:86 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -3730,115 +3723,108 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:89 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:94 +#: ../../deprecations/pending-removal-in-future.rst:91 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:92 msgid "" -":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` " -"and :meth:`!selected_npn_protocol` are deprecated: use ALPN instead." +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." msgstr "" -":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` " -"和 :meth:`!selected_npn_protocol` 已被棄用:請改用 ALPN。" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" +"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:95 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:96 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:97 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:105 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:107 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:109 -msgid "" -":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " -"ignored." -msgstr "" -":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" - -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:114 +#: ../../deprecations/pending-removal-in-future.rst:108 msgid "" -":meth:`!threading.Condition.notifyAll`: " -"use :meth:`~threading.Condition.notify_all`." +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." msgstr "" -":meth:`!threading.Condition.notifyAll`:請" -"用 :meth:`~threading.Condition.notify_all`。" +":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." +"notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:116 +#: ../../deprecations/pending-removal-in-future.rst:110 msgid "" -":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: " -"use :attr:`threading.Thread.daemon` attribute." +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid "" -":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: " -"use :attr:`threading.Thread.name` attribute." +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." msgstr "" -":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請" -"用 :attr:`threading.Thread.name` 屬性。" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" +"attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:121 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:123 +#: ../../deprecations/pending-removal-in-future.rst:117 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:119 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -3846,91 +3832,91 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:122 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:124 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:125 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:126 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:127 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:129 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:138 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:140 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:142 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "" -":mod:`urllib.request`: :class:`~urllib.request.URLopener` " -"and :class:`~urllib.request.FancyURLopener` style of invoking requests is " -"deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods." +":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" +"`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " +"Use newer :func:`~urllib.request.urlopen` functions and methods." msgstr "" -":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` " -"和 :class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新" -"的 :func:`~urllib.request.urlopen` 函式和方法。" +":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` 和 :" +"class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" +"`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:149 +#: ../../deprecations/pending-removal-in-future.rst:143 msgid "" -":mod:`xml.etree.ElementTree`: Testing the truth value of " -"an :class:`~xml.etree.ElementTree.Element` is deprecated. In a future " -"release it will always return ``True``. Prefer explicit ``len(elem)`` or " -"``elem is not None`` tests instead." +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." msgstr "" -":mod:`xml.etree.ElementTree`:已棄用" -"對 :class:`~xml.etree.ElementTree.Element` 的真值測試。在未來版本中,它將始終" -"回傳 ``True``。請改用明確的 ``len(elem)`` 或 ``elem is not None`` 測試。" +":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." +"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " +"``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:154 +#: ../../deprecations/pending-removal-in-future.rst:148 msgid "" -":meth:`zipimport.zipimporter.load_module` is deprecated: " -"use :meth:`~zipimport.zipimporter.exec_module` instead." +":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" +"`~zipimport.zipimporter.exec_module` instead." msgstr "" -":meth:`zipimport.zipimporter.load_module` 已被棄用:請改" -"用 :meth:`~zipimport.zipimporter.exec_module`。" +":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." +"zipimporter.exec_module`。" #: ../../whatsnew/3.13.rst:2024 msgid "CPython Bytecode Changes" @@ -3941,8 +3927,8 @@ msgid "" "The oparg of :opcode:`YIELD_VALUE` is now ``1`` if the yield is part of a " "yield-from or await, and ``0`` otherwise. The oparg of :opcode:`RESUME` was " "changed to add a bit indicating if the except-depth is 1, which is needed to " -"optimize closing of generators. (Contributed by Irit Katriel " -"in :gh:`111354`.)" +"optimize closing of generators. (Contributed by Irit Katriel in :gh:" +"`111354`.)" msgstr "" #: ../../whatsnew/3.13.rst:2034 @@ -3951,8 +3937,8 @@ msgstr "C API 變更" #: ../../whatsnew/3.13.rst:2039 msgid "" -"Add the :ref:`PyMonitoring C API <c-api-monitoring>` for " -"generating :pep:`669` monitoring events:" +"Add the :ref:`PyMonitoring C API <c-api-monitoring>` for generating :pep:" +"`669` monitoring events:" msgstr "" #: ../../whatsnew/3.13.rst:2042 @@ -4038,10 +4024,9 @@ msgstr "(由 Irit Katriel 在 :gh:`111997` 中貢獻。)" #: ../../whatsnew/3.13.rst:2064 msgid "" "Add :c:type:`PyMutex`, a lightweight mutex that occupies a single byte, and " -"the new :c:func:`PyMutex_Lock` and :c:func:`PyMutex_Unlock` " -"functions. :c:func:`!PyMutex_Lock` will release the :term:`GIL` (if " -"currently held) if the operation needs to block. (Contributed by Sam Gross " -"in :gh:`108724`.)" +"the new :c:func:`PyMutex_Lock` and :c:func:`PyMutex_Unlock` functions. :c:" +"func:`!PyMutex_Lock` will release the :term:`GIL` (if currently held) if the " +"operation needs to block. (Contributed by Sam Gross in :gh:`108724`.)" msgstr "" #: ../../whatsnew/3.13.rst:2070 @@ -4091,10 +4076,10 @@ msgstr "(由 Victor Stinner 和 Petr Viktorin 在 :gh:`110850` 中貢獻。) #: ../../whatsnew/3.13.rst:2084 msgid "" -"Add the :c:func:`PyDict_ContainsString` function with the same behavior " -"as :c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const " -"char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`. " -"(Contributed by Victor Stinner in :gh:`108314`.)" +"Add the :c:func:`PyDict_ContainsString` function with the same behavior as :" +"c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const char*` " +"UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`. (Contributed " +"by Victor Stinner in :gh:`108314`.)" msgstr "" #: ../../whatsnew/3.13.rst:2090 @@ -4103,16 +4088,16 @@ msgid "" "functions, which behave similarly to :c:func:`PyDict_GetItemWithError`, but " "return a :term:`strong reference` instead of a :term:`borrowed reference`. " "Moreover, these functions return ``-1`` on error, removing the need to " -"check :c:func:`!PyErr_Occurred`. (Contributed by Victor Stinner " -"in :gh:`106004`.)" +"check :c:func:`!PyErr_Occurred`. (Contributed by Victor Stinner in :gh:" +"`106004`.)" msgstr "" #: ../../whatsnew/3.13.rst:2098 msgid "" -"Add the :c:func:`PyDict_SetDefaultRef` function, which behaves similarly " -"to :c:func:`PyDict_SetDefault`, but returns a :term:`strong reference` " -"instead of a :term:`borrowed reference`. This function returns ``-1`` on " -"error, ``0`` on insertion, and ``1`` if the key was already present in the " +"Add the :c:func:`PyDict_SetDefaultRef` function, which behaves similarly to :" +"c:func:`PyDict_SetDefault`, but returns a :term:`strong reference` instead " +"of a :term:`borrowed reference`. This function returns ``-1`` on error, " +"``0`` on insertion, and ``1`` if the key was already present in the " "dictionary. (Contributed by Sam Gross in :gh:`112066`.)" msgstr "" @@ -4120,45 +4105,45 @@ msgstr "" msgid "" "Add the :c:func:`PyDict_Pop` and :c:func:`PyDict_PopString` functions to " "remove a key from a dictionary and optionally return the removed value. This " -"is similar to :meth:`dict.pop`, though there is no default value, " -"and :exc:`KeyError` is not raised for missing keys. (Contributed by Stefan " -"Behnel and Victor Stinner in :gh:`111262`.)" +"is similar to :meth:`dict.pop`, though there is no default value, and :exc:" +"`KeyError` is not raised for missing keys. (Contributed by Stefan Behnel and " +"Victor Stinner in :gh:`111262`.)" msgstr "" #: ../../whatsnew/3.13.rst:2113 msgid "" -"Add the :c:func:`PyMapping_GetOptionalItem` " -"and :c:func:`PyMapping_GetOptionalItemString` functions as alternatives " -"to :c:func:`PyObject_GetItem` and :c:func:`PyMapping_GetItemString` " -"respectively. The new functions do not raise :exc:`KeyError` if the " -"requested key is missing from the mapping. These variants are more " -"convenient and faster if a missing key should not be treated as a failure. " -"(Contributed by Serhiy Storchaka in :gh:`106307`.)" +"Add the :c:func:`PyMapping_GetOptionalItem` and :c:func:" +"`PyMapping_GetOptionalItemString` functions as alternatives to :c:func:" +"`PyObject_GetItem` and :c:func:`PyMapping_GetItemString` respectively. The " +"new functions do not raise :exc:`KeyError` if the requested key is missing " +"from the mapping. These variants are more convenient and faster if a missing " +"key should not be treated as a failure. (Contributed by Serhiy Storchaka in :" +"gh:`106307`.)" msgstr "" #: ../../whatsnew/3.13.rst:2123 msgid "" -"Add the :c:func:`PyObject_GetOptionalAttr` " -"and :c:func:`PyObject_GetOptionalAttrString` functions as alternatives " -"to :c:func:`PyObject_GetAttr` and :c:func:`PyObject_GetAttrString` " -"respectively. The new functions do not raise :exc:`AttributeError` if the " -"requested attribute is not found on the object. These variants are more " -"convenient and faster if the missing attribute should not be treated as a " -"failure. (Contributed by Serhiy Storchaka in :gh:`106521`.)" +"Add the :c:func:`PyObject_GetOptionalAttr` and :c:func:" +"`PyObject_GetOptionalAttrString` functions as alternatives to :c:func:" +"`PyObject_GetAttr` and :c:func:`PyObject_GetAttrString` respectively. The " +"new functions do not raise :exc:`AttributeError` if the requested attribute " +"is not found on the object. These variants are more convenient and faster if " +"the missing attribute should not be treated as a failure. (Contributed by " +"Serhiy Storchaka in :gh:`106521`.)" msgstr "" #: ../../whatsnew/3.13.rst:2133 msgid "" -"Add the :c:func:`PyErr_FormatUnraisable` function as an extension " -"to :c:func:`PyErr_WriteUnraisable` that allows customizing the warning " -"message. (Contributed by Serhiy Storchaka in :gh:`108082`.)" +"Add the :c:func:`PyErr_FormatUnraisable` function as an extension to :c:func:" +"`PyErr_WriteUnraisable` that allows customizing the warning message. " +"(Contributed by Serhiy Storchaka in :gh:`108082`.)" msgstr "" #: ../../whatsnew/3.13.rst:2138 msgid "" -"Add new functions that return a :term:`strong reference` instead of " -"a :term:`borrowed reference` for frame locals, globals, and builtins, as " -"part of :ref:`PEP 667 <whatsnew313-locals-semantics>`:" +"Add new functions that return a :term:`strong reference` instead of a :term:" +"`borrowed reference` for frame locals, globals, and builtins, as part of :" +"ref:`PEP 667 <whatsnew313-locals-semantics>`:" msgstr "" #: ../../whatsnew/3.13.rst:2142 @@ -4188,10 +4173,10 @@ msgstr "" #: ../../whatsnew/3.13.rst:2155 msgid "" -"Add the :c:func:`PyImport_AddModuleRef` function as a replacement " -"for :c:func:`PyImport_AddModule` that returns a :term:`strong reference` " -"instead of a :term:`borrowed reference`. (Contributed by Victor Stinner " -"in :gh:`105922`.)" +"Add the :c:func:`PyImport_AddModuleRef` function as a replacement for :c:" +"func:`PyImport_AddModule` that returns a :term:`strong reference` instead of " +"a :term:`borrowed reference`. (Contributed by Victor Stinner in :gh:" +"`105922`.)" msgstr "" #: ../../whatsnew/3.13.rst:2160 @@ -4203,9 +4188,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:2165 msgid "" -"Add the :c:func:`PyList_GetItemRef` function as a replacement " -"for :c:func:`PyList_GetItem` that returns a :term:`strong reference` instead " -"of a :term:`borrowed reference`. (Contributed by Sam Gross in :gh:`114329`.)" +"Add the :c:func:`PyList_GetItemRef` function as a replacement for :c:func:" +"`PyList_GetItem` that returns a :term:`strong reference` instead of a :term:" +"`borrowed reference`. (Contributed by Sam Gross in :gh:`114329`.)" msgstr "" #: ../../whatsnew/3.13.rst:2170 @@ -4217,10 +4202,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:2174 msgid "" -"Add the :c:func:`PyLong_AsInt` function. It behaves similarly " -"to :c:func:`PyLong_AsLong`, but stores the result in a C :c:expr:`int` " -"instead of a C :c:expr:`long`. (Contributed by Victor Stinner " -"in :gh:`108014`.)" +"Add the :c:func:`PyLong_AsInt` function. It behaves similarly to :c:func:" +"`PyLong_AsLong`, but stores the result in a C :c:expr:`int` instead of a C :" +"c:expr:`long`. (Contributed by Victor Stinner in :gh:`108014`.)" msgstr "" #: ../../whatsnew/3.13.rst:2179 @@ -4233,17 +4217,16 @@ msgstr "" #: ../../whatsnew/3.13.rst:2185 msgid "" -"Add :c:func:`PyModule_Add` function, which is similar " -"to :c:func:`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but " -"always steals a reference to the value. (Contributed by Serhiy Storchaka " -"in :gh:`86493`.)" +"Add :c:func:`PyModule_Add` function, which is similar to :c:func:" +"`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but always steals " +"a reference to the value. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" #: ../../whatsnew/3.13.rst:2190 msgid "" "Add the :c:func:`PyObject_GenericHash` function that implements the default " -"hashing function of a Python object. (Contributed by Serhiy Storchaka " -"in :gh:`113024`.)" +"hashing function of a Python object. (Contributed by Serhiy Storchaka in :gh:" +"`113024`.)" msgstr "" #: ../../whatsnew/3.13.rst:2194 @@ -4254,12 +4237,11 @@ msgstr "" #: ../../whatsnew/3.13.rst:2197 msgid "" -"Add the :c:func:`PyObject_VisitManagedDict` " -"and :c:func:`PyObject_ClearManagedDict` functions. which must be called by " -"the traverse and clear functions of a type using " -"the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag. The `pythoncapi-compat " -"project`_ can be used to use these functions with Python 3.11 and 3.12. " -"(Contributed by Victor Stinner in :gh:`107073`.)" +"Add the :c:func:`PyObject_VisitManagedDict` and :c:func:" +"`PyObject_ClearManagedDict` functions. which must be called by the traverse " +"and clear functions of a type using the :c:macro:`Py_TPFLAGS_MANAGED_DICT` " +"flag. The `pythoncapi-compat project`_ can be used to use these functions " +"with Python 3.11 and 3.12. (Contributed by Victor Stinner in :gh:`107073`.)" msgstr "" #: ../../whatsnew/3.13.rst:2205 @@ -4272,9 +4254,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:2211 msgid "" -"Add the :c:func:`PySys_AuditTuple` function as an alternative " -"to :c:func:`PySys_Audit` that takes event arguments as a " -"Python :class:`tuple` object. (Contributed by Victor Stinner in :gh:`85283`.)" +"Add the :c:func:`PySys_AuditTuple` function as an alternative to :c:func:" +"`PySys_Audit` that takes event arguments as a Python :class:`tuple` object. " +"(Contributed by Victor Stinner in :gh:`85283`.)" msgstr "" #: ../../whatsnew/3.13.rst:2216 @@ -4288,10 +4270,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:2222 msgid "" "Add the :c:func:`PyType_GetFullyQualifiedName` function to get the type's " -"fully qualified name. The module name is prepended " -"if :attr:`type.__module__` is a string and is not equal to either " -"``'builtins'`` or ``'__main__'``. (Contributed by Victor Stinner " -"in :gh:`111696`.)" +"fully qualified name. The module name is prepended if :attr:`type." +"__module__` is a string and is not equal to either ``'builtins'`` or " +"``'__main__'``. (Contributed by Victor Stinner in :gh:`111696`.)" msgstr "" #: ../../whatsnew/3.13.rst:2228 @@ -4303,19 +4284,19 @@ msgstr "" #: ../../whatsnew/3.13.rst:2233 msgid "" -"Add the :c:func:`PyUnicode_EqualToUTF8AndSize` " -"and :c:func:`PyUnicode_EqualToUTF8` functions to compare a Unicode object " -"with a :c:expr:`const char*` UTF-8 encoded string and ``1`` if they are " -"equal or ``0`` otherwise. These functions do not raise exceptions. " -"(Contributed by Serhiy Storchaka in :gh:`110289`.)" +"Add the :c:func:`PyUnicode_EqualToUTF8AndSize` and :c:func:" +"`PyUnicode_EqualToUTF8` functions to compare a Unicode object with a :c:expr:" +"`const char*` UTF-8 encoded string and ``1`` if they are equal or ``0`` " +"otherwise. These functions do not raise exceptions. (Contributed by Serhiy " +"Storchaka in :gh:`110289`.)" msgstr "" #: ../../whatsnew/3.13.rst:2240 msgid "" -"Add the :c:func:`PyWeakref_GetRef` function as an alternative " -"to :c:func:`PyWeakref_GetObject` that returns a :term:`strong reference` or " -"``NULL`` if the referent is no longer live. (Contributed by Victor Stinner " -"in :gh:`105927`.)" +"Add the :c:func:`PyWeakref_GetRef` function as an alternative to :c:func:" +"`PyWeakref_GetObject` that returns a :term:`strong reference` or ``NULL`` if " +"the referent is no longer live. (Contributed by Victor Stinner in :gh:" +"`105927`.)" msgstr "" #: ../../whatsnew/3.13.rst:2246 @@ -4329,11 +4310,11 @@ msgstr ":c:func:`PyObject_HasAttrWithError` 取代 :c:func:`PyObject_HasAttr`。 #: ../../whatsnew/3.13.rst:2249 msgid "" -":c:func:`PyObject_HasAttrStringWithError` " -"replaces :c:func:`PyObject_HasAttrString`." +":c:func:`PyObject_HasAttrStringWithError` replaces :c:func:" +"`PyObject_HasAttrString`." msgstr "" -":c:func:`PyObject_HasAttrStringWithError` 取" -"代 :c:func:`PyObject_HasAttrString`。" +":c:func:`PyObject_HasAttrStringWithError` 取代 :c:func:" +"`PyObject_HasAttrString`。" #: ../../whatsnew/3.13.rst:2251 msgid "" @@ -4342,11 +4323,11 @@ msgstr ":c:func:`PyMapping_HasKeyWithError` 取代 :c:func:`PyMapping_HasKey`。 #: ../../whatsnew/3.13.rst:2252 msgid "" -":c:func:`PyMapping_HasKeyStringWithError` " -"replaces :c:func:`PyMapping_HasKeyString`." +":c:func:`PyMapping_HasKeyStringWithError` replaces :c:func:" +"`PyMapping_HasKeyString`." msgstr "" -":c:func:`PyMapping_HasKeyStringWithError` 取" -"代 :c:func:`PyMapping_HasKeyString`。" +":c:func:`PyMapping_HasKeyStringWithError` 取代 :c:func:" +"`PyMapping_HasKeyString`。" #: ../../whatsnew/3.13.rst:2255 msgid "" @@ -4364,15 +4345,15 @@ msgstr "" #: ../../whatsnew/3.13.rst:2264 msgid "" -"The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` " -"and :c:func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * " -"const *` in C and :c:expr:`const char * const *` in C++, instead " -"of :c:expr:`char **`. In C++, this makes these functions compatible with " -"arguments of type :c:expr:`const char * const *`, :c:expr:`const char **`, " -"or :c:expr:`char * const *` without an explicit type cast. In C, the " -"functions only support arguments of type :c:expr:`char * const *`. This can " -"be overridden with the :c:macro:`PY_CXX_CONST` macro. (Contributed by Serhiy " -"Storchaka in :gh:`65210`.)" +"The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and :c:" +"func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * const *` " +"in C and :c:expr:`const char * const *` in C++, instead of :c:expr:`char " +"**`. In C++, this makes these functions compatible with arguments of type :c:" +"expr:`const char * const *`, :c:expr:`const char **`, or :c:expr:`char * " +"const *` without an explicit type cast. In C, the functions only support " +"arguments of type :c:expr:`char * const *`. This can be overridden with the :" +"c:macro:`PY_CXX_CONST` macro. (Contributed by Serhiy Storchaka in :gh:" +"`65210`.)" msgstr "" #: ../../whatsnew/3.13.rst:2276 @@ -4390,18 +4371,19 @@ msgstr "" #: ../../whatsnew/3.13.rst:2284 msgid "" -"The :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:`PyObject_HasAttr`, :c:func:`PyObject_HasAttrString`, " -"and :c:func:`PySys_GetObject` functions, each of which clears all errors " -"which occurred when calling them now reports these errors " -"using :func:`sys.unraisablehook`. You may replace them with other functions " -"as recommended in the documentation. (Contributed by Serhiy Storchaka " -"in :gh:`106672`.)" +"The :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:" +"`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:" +"`PyObject_HasAttr`, :c:func:`PyObject_HasAttrString`, and :c:func:" +"`PySys_GetObject` functions, each of which clears all errors which occurred " +"when calling them now reports these errors using :func:`sys.unraisablehook`. " +"You may replace them with other functions as recommended in the " +"documentation. (Contributed by Serhiy Storchaka in :gh:`106672`.)" msgstr "" #: ../../whatsnew/3.13.rst:2293 msgid "" -"Add support for the ``%T``, ``%#T``, ``%N`` and ``%#N`` formats " -"to :c:func:`PyUnicode_FromFormat`:" +"Add support for the ``%T``, ``%#T``, ``%N`` and ``%#N`` formats to :c:func:" +"`PyUnicode_FromFormat`:" msgstr "" #: ../../whatsnew/3.13.rst:2296 @@ -4422,8 +4404,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:2301 msgid "" -"See :pep:`737` for more information. (Contributed by Victor Stinner " -"in :gh:`111696`.)" +"See :pep:`737` for more information. (Contributed by Victor Stinner in :gh:" +"`111696`.)" msgstr "" #: ../../whatsnew/3.13.rst:2304 @@ -4431,16 +4413,16 @@ msgid "" "You no longer have to define the ``PY_SSIZE_T_CLEAN`` macro before " "including :file:`Python.h` when using ``#`` formats in :ref:`format codes " "<arg-parsing-string-and-buffers>`. APIs accepting the format codes always " -"use ``Py_ssize_t`` for ``#`` formats. (Contributed by Inada Naoki " -"in :gh:`104922`.)" +"use ``Py_ssize_t`` for ``#`` formats. (Contributed by Inada Naoki in :gh:" +"`104922`.)" msgstr "" #: ../../whatsnew/3.13.rst:2310 msgid "" "If Python is built in :ref:`debug mode <debug-build>` or :option:`with " -"assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` " -"and :c:func:`PyList_SET_ITEM` now check the index argument with an " -"assertion. (Contributed by Victor Stinner in :gh:`106168`.)" +"assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and :c:func:" +"`PyList_SET_ITEM` now check the index argument with an assertion. " +"(Contributed by Victor Stinner in :gh:`106168`.)" msgstr "" #: ../../whatsnew/3.13.rst:2318 @@ -4481,8 +4463,8 @@ msgstr ":c:func:`PyType_GetModuleByDef`" #: ../../whatsnew/3.13.rst:2330 msgid "" -"(Contributed by Victor Stinner in :gh:`85283`, :gh:`85283`, " -"and :gh:`116936`.)" +"(Contributed by Victor Stinner in :gh:`85283`, :gh:`85283`, and :gh:" +"`116936`.)" msgstr "" "(由 Victor Stinner 貢獻於 :gh:`85283`、:gh:`85283` 和 :gh:`116936`。)" @@ -4509,26 +4491,26 @@ msgstr "" #: ../../whatsnew/3.13.rst:2348 msgid "" -"Remove old buffer protocols deprecated in Python 3.0. " -"Use :ref:`bufferobjects` instead." +"Remove old buffer protocols deprecated in Python 3.0. Use :ref:" +"`bufferobjects` instead." msgstr "" #: ../../whatsnew/3.13.rst:2351 msgid "" ":c:func:`!PyObject_CheckReadBuffer`: Use :c:func:`PyObject_CheckBuffer` to " -"test whether the object supports the buffer protocol. Note " -"that :c:func:`PyObject_CheckBuffer` doesn't guarantee " -"that :c:func:`PyObject_GetBuffer` will succeed. To test if the object is " -"actually readable, see the next example of :c:func:`PyObject_GetBuffer`." +"test whether the object supports the buffer protocol. Note that :c:func:" +"`PyObject_CheckBuffer` doesn't guarantee that :c:func:`PyObject_GetBuffer` " +"will succeed. To test if the object is actually readable, see the next " +"example of :c:func:`PyObject_GetBuffer`." msgstr "" #: ../../whatsnew/3.13.rst:2359 msgid "" -":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: " -"Use :c:func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" +":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: Use :c:" +"func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" msgstr "" -":c:func:`!PyObject_AsCharBuffer`、:c:func:`!PyObject_AsReadBuffer`:請改" -"用 :c:func:`PyObject_GetBuffer` 和 :c:func:`PyBuffer_Release`。" +":c:func:`!PyObject_AsCharBuffer`、:c:func:`!PyObject_AsReadBuffer`:請改用 :" +"c:func:`PyObject_GetBuffer` 和 :c:func:`PyBuffer_Release`。" #: ../../whatsnew/3.13.rst:2362 msgid "" @@ -4543,11 +4525,11 @@ msgstr "" #: ../../whatsnew/3.13.rst:2372 msgid "" -":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` " -"and :c:func:`PyBuffer_Release` instead:" +":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` and :c:" +"func:`PyBuffer_Release` instead:" msgstr "" -":c:func:`!PyObject_AsWriteBuffer`:請改用 :c:func:`PyObject_GetBuffer` " -"和 :c:func:`PyBuffer_Release`。" +":c:func:`!PyObject_AsWriteBuffer`:請改用 :c:func:`PyObject_GetBuffer` 和 :c:" +"func:`PyBuffer_Release`。" #: ../../whatsnew/3.13.rst:2375 msgid "" @@ -4569,8 +4551,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:2388 msgid "" -":c:func:`!PyEval_CallObject`, :c:func:`!PyEval_CallObjectWithKeywords`: " -"Use :c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead." +":c:func:`!PyEval_CallObject`, :c:func:`!PyEval_CallObjectWithKeywords`: Use :" +"c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead." msgstr "" ":c:func:`!PyEval_CallObject`、:c:func:`!PyEval_CallObjectWithKeywords`:請改" "用 :c:func:`PyObject_CallNoArgs` 或 :c:func:`PyObject_Call`。" @@ -4581,9 +4563,9 @@ msgid "" "and must not be ``NULL``, and keyword arguments must be a :class:`dict` or " "``NULL``, whereas the removed functions checked argument types and accepted " "``NULL`` positional and keyword arguments. To replace " -"``PyEval_CallObjectWithKeywords(func, NULL, kwargs)`` " -"with :c:func:`PyObject_Call`, pass an empty tuple as positional arguments " -"using :c:func:`PyTuple_New(0) <PyTuple_New>`." +"``PyEval_CallObjectWithKeywords(func, NULL, kwargs)`` with :c:func:" +"`PyObject_Call`, pass an empty tuple as positional arguments using :c:func:" +"`PyTuple_New(0) <PyTuple_New>`." msgstr "" #: ../../whatsnew/3.13.rst:2403 @@ -4610,14 +4592,15 @@ msgid "" "Remove the following old functions to configure the Python initialization, " "deprecated in Python 3.11:" msgstr "" +"移除以下設定 Python 初始化的舊函式,這些函式在 Python 3.11 中已被棄用:" #: ../../whatsnew/3.13.rst:2415 msgid "" ":c:func:`!PySys_AddWarnOptionUnicode`: Use :c:member:`PyConfig.warnoptions` " "instead." msgstr "" -":c:func:`!PySys_AddWarnOptionUnicode`:請改" -"用 :c:member:`PyConfig.warnoptions`。" +":c:func:`!PySys_AddWarnOptionUnicode`:請改用 :c:member:`PyConfig." +"warnoptions`。" #: ../../whatsnew/3.13.rst:2417 msgid "" @@ -4650,13 +4633,13 @@ msgstr "" #: ../../whatsnew/3.13.rst:2427 msgid "" -":c:func:`!Py_SetStandardStreamEncoding`: " -"Set :c:member:`PyConfig.stdio_encoding` instead, and set also " -"maybe :c:member:`PyConfig.legacy_windows_stdio` (on Windows)." +":c:func:`!Py_SetStandardStreamEncoding`: Set :c:member:`PyConfig." +"stdio_encoding` instead, and set also maybe :c:member:`PyConfig." +"legacy_windows_stdio` (on Windows)." msgstr "" -":c:func:`!Py_SetStandardStreamEncoding`:請改" -"用 :c:member:`PyConfig.stdio_encoding` 並設定可能" -"的 :c:member:`PyConfig.legacy_windows_stdio`\\ (在 Windows 上)。" +":c:func:`!Py_SetStandardStreamEncoding`:請改用 :c:member:`PyConfig." +"stdio_encoding` 並設定可能的 :c:member:`PyConfig.legacy_windows_stdio`\\ " +"(在 Windows 上)。" #: ../../whatsnew/3.13.rst:2430 msgid "" @@ -4672,8 +4655,8 @@ msgid "" "(Contributed by Victor Stinner in :gh:`105145`.)" msgstr "" "請改用 :ref:`Python 初始化設定 <init-config>`\\ 的新 :c:type:`PyConfig` API " -"(:pep:`587`),這是在 Python 3.8 中新增的。(由 Victor Stinner " -"於 :gh:`105145` 貢獻。)" +"(:pep:`587`),這是在 Python 3.8 中新增的。(由 Victor Stinner 於 :gh:" +"`105145` 貢獻。)" #: ../../whatsnew/3.13.rst:2437 msgid "" @@ -4711,15 +4694,24 @@ msgid "" "PyEval_ThreadsInitialized` always returns non-zero. (Contributed by Victor " "Stinner in :gh:`105182`.)" msgstr "" +"移除在 Python 3.9 中已被棄用的 :c:func:`!PyEval_ThreadsInitialized` 函式。自 " +"Python 3.7 起,:c:func:`!Py_Initialize` 總是會建立 GIL:呼叫 :c:func:`!" +"PyEval_InitThreads` 不會有任何作用,而 :c:func:`!PyEval_ThreadsInitialized` " +"總是會回傳非零值。(由 Victor Stinner 於 :gh:`105182` 貢獻。)" #: ../../whatsnew/3.13.rst:2455 msgid "" -"Remove the :c:func:`!_PyInterpreterState_Get` alias " -"to :c:func:`PyInterpreterState_Get()` which was kept for backward " -"compatibility with Python 3.8. The `pythoncapi-compat project`_ can be used " -"to get :c:func:`PyInterpreterState_Get()` on Python 3.8 and older. " -"(Contributed by Victor Stinner in :gh:`106320`.)" +"Remove the :c:func:`!_PyInterpreterState_Get` alias to :c:func:" +"`PyInterpreterState_Get()` which was kept for backward compatibility with " +"Python 3.8. The `pythoncapi-compat project`_ can be used to get :c:func:" +"`PyInterpreterState_Get()` on Python 3.8 and older. (Contributed by Victor " +"Stinner in :gh:`106320`.)" msgstr "" +"移除 :c:func:`!_PyInterpreterState_Get` 這個對 :c:func:" +"`PyInterpreterState_Get()` 的別名,這個別名是為了與 Python 3.8 的向後相容性而" +"保留的。`pythoncapi-compat 專案`_\\ 可以用於在 Python 3.8 和更舊的版本中取" +"得 :c:func:`PyInterpreterState_Get()`。(由 Victor Stinner 於 :gh:`106320` 貢" +"獻。)" #: ../../whatsnew/3.13.rst:2462 msgid "" @@ -4727,14 +4719,17 @@ msgid "" "PyObject_Vectorcall` which is available since Python 3.8 (:pep:`590`). " "(Contributed by Victor Stinner in :gh:`106023`.)" msgstr "" +"移除私有的 :c:func:`!_PyObject_FastCall` 函式:請改用自 Python 3.8 起可用的 :" +"c:func:`!PyObject_Vectorcall` 函式(:pep:`590`)。(由 Victor Stinner 於 :gh:" +"`106023` 貢獻。)" #: ../../whatsnew/3.13.rst:2467 msgid "" "Remove the ``cpython/pytime.h`` header file, which only contained private " "functions. (Contributed by Victor Stinner in :gh:`106316`.)" msgstr "" -"移除只包含私有函式的 ``cpython/pytime.h`` 標頭檔。(由 Victor Stinner " -"於 :gh:`106316` 貢獻。)" +"移除只包含私有函式的 ``cpython/pytime.h`` 標頭檔。(由 Victor Stinner 於 :gh:" +"`106316` 貢獻。)" #: ../../whatsnew/3.13.rst:2471 msgid "" @@ -4749,6 +4744,9 @@ msgid "" "``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``. (Contributed by Irit Katriel " "in :gh:`105111`.)" msgstr "" +"移除舊的垃圾桶巨集 ``Py_TRASHCAN_SAFE_BEGIN`` 和 ``Py_TRASHCAN_SAFE_END``。請" +"將兩者都替換為新的巨集 ``Py_TRASHCAN_BEGIN`` 和 ``Py_TRASHCAN_END``。(由 " +"Irit Katriel 在 :gh:`105111` 中貢獻。)" #: ../../whatsnew/3.13.rst:2481 msgid "Deprecated C APIs" @@ -4756,7 +4754,7 @@ msgstr "器用的 C API" #: ../../whatsnew/3.13.rst:2483 msgid "Deprecate old Python initialization functions:" -msgstr "" +msgstr "棄用舊的 Python 初始化函式:" #: ../../whatsnew/3.13.rst:2485 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 @@ -4764,8 +4762,8 @@ msgid "" ":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" -":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` " -"和 :data:`!warnings.filters`。" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" +"data:`!warnings.filters`。" #: ../../whatsnew/3.13.rst:2487 msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." @@ -4793,11 +4791,11 @@ msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" #: ../../whatsnew/3.13.rst:2497 #: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or " -"the :envvar:`PYTHONHOME` environment variable instead." +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" +"`PYTHONHOME` environment variable instead." msgstr "" -":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` " -"或 :envvar:`PYTHONHOME` 環境變數。" +":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" +"`PYTHONHOME` 環境變數。" #: ../../whatsnew/3.13.rst:2501 msgid "(Contributed by Victor Stinner in :gh:`105145`.)" @@ -4805,11 +4803,14 @@ msgstr "(由 Victor Stinner 在 :gh:`105145` 中貢獻。)" #: ../../whatsnew/3.13.rst:2503 msgid "" -":term:`Soft deprecate <soft deprecated>` " -"the :c:func:`PyEval_GetBuiltins`, :c:func:`PyEval_GetGlobals`, " -"and :c:func:`PyEval_GetLocals` functions, which return a :term:`borrowed " -"reference`. (Soft deprecated as part of :pep:`667`.)" +":term:`Soft deprecate <soft deprecated>` the :c:func:`PyEval_GetBuiltins`, :" +"c:func:`PyEval_GetGlobals`, and :c:func:`PyEval_GetLocals` functions, which " +"return a :term:`borrowed reference`. (Soft deprecated as part of :pep:`667`.)" msgstr "" +":term:`軟性棄用 <soft deprecated>` :c:func:`PyEval_GetBuiltins`、:c:func:" +"`PyEval_GetGlobals` 和 :c:func:`PyEval_GetLocals` 函式,這些函式會回傳一個" +"\\ :term:`借用參照 <borrowed reference>`。(作為 :pep:`667` 一部分的軟性棄" +"用。)" #: ../../whatsnew/3.13.rst:2509 msgid "" @@ -4817,49 +4818,64 @@ msgid "" "an alias to :c:func:`PyImport_ImportModule` since Python 3.3. (Contributed " "by Victor Stinner in :gh:`105396`.)" msgstr "" +"棄用 :c:func:`PyImport_ImportModuleNoBlock` 函式,這只是自 Python 3.3 起的 :" +"c:func:`PyImport_ImportModule` 的別名。(由 Victor Stinner 在 :gh:`105396` 中" +"貢獻。)" #: ../../whatsnew/3.13.rst:2513 msgid "" ":term:`Soft deprecate <soft deprecated>` the :c:func:`PyModule_AddObject` " -"function. It should be replaced with :c:func:`PyModule_Add` " -"or :c:func:`PyModule_AddObjectRef`. (Contributed by Serhiy Storchaka " -"in :gh:`86493`.)" +"function. It should be replaced with :c:func:`PyModule_Add` or :c:func:" +"`PyModule_AddObjectRef`. (Contributed by Serhiy Storchaka in :gh:`86493`.)" msgstr "" +":term:`軟性棄用 <soft deprecated>` :c:func:`PyModule_AddObject` 函式。應該改" +"用 :c:func:`PyModule_Add` 或 :c:func:`PyModule_AddObjectRef`。(由 Serhiy " +"Storchaka 在 :gh:`86493` 中貢獻。)" #: ../../whatsnew/3.13.rst:2519 msgid "" -"Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types and " -"the :c:macro:`!Py_UNICODE_WIDE` define. Use the :c:type:`wchar_t` type " -"directly instead. Since Python 3.3, ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` " -"are just aliases to :c:type:`!wchar_t`. (Contributed by Victor Stinner " -"in :gh:`105156`.)" +"Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types and the :c:" +"macro:`!Py_UNICODE_WIDE` define. Use the :c:type:`wchar_t` type directly " +"instead. Since Python 3.3, ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` are just " +"aliases to :c:type:`!wchar_t`. (Contributed by Victor Stinner in :gh:" +"`105156`.)" msgstr "" +"棄用舊的 ``Py_UNICODE`` 和 ``PY_UNICODE_TYPE`` 型別以及 :c:macro:`!" +"Py_UNICODE_WIDE` 定義。請直接使用 :c:type:`wchar_t` 型別。自 Python 3.3 起," +"``Py_UNICODE`` 和 ``PY_UNICODE_TYPE`` 只是 :c:type:`!wchar_t` 的別名。(由 " +"Victor Stinner 在 :gh:`105156` 中貢獻。)" #: ../../whatsnew/3.13.rst:2526 msgid "" -"Deprecate the :c:func:`PyWeakref_GetObject` " -"and :c:func:`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed " -"reference`. Replace them with the new :c:func:`PyWeakref_GetRef` function, " -"which returns a :term:`strong reference`. The `pythoncapi-compat project`_ " -"can be used to get :c:func:`PyWeakref_GetRef` on Python 3.12 and older. " -"(Contributed by Victor Stinner in :gh:`105927`.)" -msgstr "" +"Deprecate the :c:func:`PyWeakref_GetObject` and :c:func:" +"`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed reference`. " +"Replace them with the new :c:func:`PyWeakref_GetRef` function, which returns " +"a :term:`strong reference`. The `pythoncapi-compat project`_ can be used to " +"get :c:func:`PyWeakref_GetRef` on Python 3.12 and older. (Contributed by " +"Victor Stinner in :gh:`105927`.)" +msgstr "" +"棄用 :c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT` 函式,這" +"些函式會回傳一個\\ :term:`借用參照 <borrowed reference>`。請改用新的 :c:func:" +"`PyWeakref_GetRef` 函式,這個函式會回傳一個\\ :term:`強參照 <strong " +"reference>`。`pythoncapi-compat 專案`_\\ 可以用於在 Python 3.12 和更舊的版本" +"中取得 :c:func:`PyWeakref_GetRef`。(由 Victor Stinner 在 :gh:`105927` 中貢" +"獻。)" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 msgid "" "The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " "(:pep:`699`; :gh:`101193`)." msgstr "" -":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 " -"(:pep:`699`;:gh:`101193`)。" +":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 (:pep:" +"`699`;:gh:`101193`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 msgid "" "Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable " "bases (:gh:`95388`)." msgstr "" -"使用可變基底建立\\ :c:data:`不可變型別 <Py_TPFLAGS_IMMUTABLETYPE>` " -"(:gh:`95388`)。" +"使用可變基底建立\\ :c:data:`不可變型別 <Py_TPFLAGS_IMMUTABLETYPE>` (:gh:" +"`95388`)。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:10 msgid "" @@ -4889,8 +4905,8 @@ msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 #: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" -"The :c:func:`Py_InitializeFromConfig` API should be used " -"with :c:type:`PyConfig` instead." +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" @@ -4947,24 +4963,24 @@ msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "instead." msgstr "" -":c:var:`Py_IgnoreEnvironmentFlag`:請改" -"用 :c:member:`PyConfig.use_environment`。" +":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." +"use_environment`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "instead." msgstr "" -":c:var:`Py_DontWriteBytecodeFlag`:請改" -"用 :c:member:`PyConfig.write_bytecode`。" +":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." +"write_bytecode`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 msgid "" -":c:var:`Py_NoUserSiteDirectory`: " -"Use :c:member:`PyConfig.user_site_directory` instead." +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." +"user_site_directory` instead." msgstr "" -":c:var:`Py_NoUserSiteDirectory`:請改" -"用 :c:member:`PyConfig.user_site_directory`。" +":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." +"user_site_directory`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 msgid "" @@ -4987,51 +5003,51 @@ msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: " -"Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` instead." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` instead." msgstr "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改" -"用 :c:member:`PyPreConfig.legacy_windows_fs_encoding`。" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: " -"Use :c:member:`PyConfig.legacy_windows_stdio` instead." +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." +"legacy_windows_stdio` instead." msgstr "" -":c:var:`Py_LegacyWindowsStdioFlag`:請改" -"用 :c:member:`PyConfig.legacy_windows_stdio`。" +":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." +"legacy_windows_stdio`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: " -"Use :c:member:`PyConfig.filesystem_encoding` instead." +":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`。" +":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: " -"Use :c:member:`PyConfig.filesystem_encoding` instead." +":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` instead." msgstr "" -":c:var:`!Py_HasFileSystemDefaultEncoding`:請改" -"用 :c:member:`PyConfig.filesystem_encoding`。" +":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: " -"Use :c:member:`PyConfig.filesystem_errors` instead." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." +"filesystem_errors` instead." msgstr "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改" -"用 :c:member:`PyConfig.filesystem_errors`。" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." +"filesystem_errors`。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. " -"(see :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" +"c:func:`Py_PreInitialize`)" msgstr "" -":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請" -"見 :c:func:`Py_PreInitialize`)" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" +"func:`Py_PreInitialize`)" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 msgid "The bundled copy of ``libmpdecimal``." @@ -5039,27 +5055,27 @@ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -"The :c:func:`PyImport_ImportModuleNoBlock`: " -"Use :c:func:`PyImport_ImportModule` instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." msgstr "" -":c:func:`PyImport_ImportModuleNoBlock`:請改" -"用 :c:func:`PyImport_ImportModule`。" +":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" +"`PyImport_ImportModule`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 msgid "" -":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: " -"Use :c:func:`PyWeakref_GetRef` instead." +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead." msgstr "" -":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改" -"用 :c:func:`PyWeakref_GetRef`。" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 msgid "" -":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: " -"Use :c:type:`wchar_t` instead." +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." msgstr "" -":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改" -"用 :c:type:`wchar_t`。" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 msgid "Python initialization functions:" @@ -5067,19 +5083,19 @@ msgstr "Python 初始化函式:" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 msgid "" -":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` " -"and :data:`sys.exec_prefix` instead." +":c:func:`Py_GetExecPrefix`: Get :data:`sys.base_exec_prefix` and :data:`sys." +"exec_prefix` instead." msgstr "" -":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` " -"與 :data:`sys.exec_prefix`。" +":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.base_exec_prefix` 與 :data:" +"`sys.exec_prefix`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 msgid "" ":c:func:`Py_GetPrefix`: Get :data:`sys.base_prefix` and :data:`sys.prefix` " "instead." msgstr "" -":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` " -"與 :data:`sys.prefix`。" +":c:func:`Py_GetPrefix`:請改用 :data:`sys.base_prefix` 與 :data:`sys." +"prefix`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:4 msgid "" @@ -5100,8 +5116,8 @@ msgid "" ":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" -":c:func:`PyErr_NormalizeException`:請改" -"用 :c:func:`PyErr_GetRaisedException`。" +":c:func:`PyErr_NormalizeException`:請改用 :c:func:" +"`PyErr_GetRaisedException`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" @@ -5121,11 +5137,11 @@ msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` " -"and :c:func:`PySlice_AdjustIndices` instead." +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." msgstr "" -":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` " -"和 :c:func:`PySlice_AdjustIndices`。" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" +"`PySlice_AdjustIndices`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid "" @@ -5171,8 +5187,8 @@ msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." msgstr "" -":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼" -"叫 :c:func:`PyObject_Hash`。" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" +"`PyObject_Hash`。" #: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid ":c:member:`!PyDictObject.ma_version_tag` member." @@ -5225,10 +5241,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:2553 msgid "" -"``aarch64-linux-android`` and ``x86_64-linux-android`` are both " -"now :pep:`11` tier 3 platforms. (:ref:`PEP 738 <whatsnew313-platform-" -"support>` written and implementation contributed by Malcolm Smith " -"in :gh:`116622`.)" +"``aarch64-linux-android`` and ``x86_64-linux-android`` are both now :pep:" +"`11` tier 3 platforms. (:ref:`PEP 738 <whatsnew313-platform-support>` " +"written and implementation contributed by Malcolm Smith in :gh:`116622`.)" msgstr "" #: ../../whatsnew/3.13.rst:2558 @@ -5251,9 +5266,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:2567 msgid "" -"Autoconf 2.71 and aclocal 1.16.5 are now required to regenerate " -"the :file:`configure` script. (Contributed by Christian Heimes " -"in :gh:`89886` and by Victor Stinner in :gh:`112090`.)" +"Autoconf 2.71 and aclocal 1.16.5 are now required to regenerate the :file:" +"`configure` script. (Contributed by Christian Heimes in :gh:`89886` and by " +"Victor Stinner in :gh:`112090`.)" msgstr "" #: ../../whatsnew/3.13.rst:2571 @@ -5280,9 +5295,8 @@ msgstr "" #: ../../whatsnew/3.13.rst:2587 msgid "" "Python built with :file:`configure` :option:`--with-trace-refs` (tracing " -"references) is now ABI compatible with the Python release build " -"and :ref:`debug build <debug-build>`. (Contributed by Victor Stinner " -"in :gh:`108634`.)" +"references) is now ABI compatible with the Python release build and :ref:" +"`debug build <debug-build>`. (Contributed by Victor Stinner in :gh:`108634`.)" msgstr "" #: ../../whatsnew/3.13.rst:2592 @@ -5295,11 +5309,11 @@ msgstr "" #: ../../whatsnew/3.13.rst:2596 msgid "" "The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``, " -"``termios``, ``winsound``, ``_ctypes_test``, " -"``_multiprocessing.posixshmem``, ``_scproxy``, ``_stat``, ``_statistics``, " -"``_testconsole``, ``_testimportmultiple`` and ``_uuid`` C extensions are now " -"built with the :ref:`limited C API <limited-c-api>`. (Contributed by Victor " -"Stinner in :gh:`85283`.)" +"``termios``, ``winsound``, ``_ctypes_test``, ``_multiprocessing." +"posixshmem``, ``_scproxy``, ``_stat``, ``_statistics``, ``_testconsole``, " +"``_testimportmultiple`` and ``_uuid`` C extensions are now built with the :" +"ref:`limited C API <limited-c-api>`. (Contributed by Victor Stinner in :gh:" +"`85283`.)" msgstr "" #: ../../whatsnew/3.13.rst:2605 @@ -5356,9 +5370,9 @@ msgstr "" #: ../../whatsnew/3.13.rst:2640 msgid "" ":class:`functools.partial` now emits a :exc:`FutureWarning` when used as a " -"method. The behavior will change in future Python versions. Wrap it " -"in :func:`staticmethod` if you want to preserve the old behavior. " -"(Contributed by Serhiy Storchaka in :gh:`121027`.)" +"method. The behavior will change in future Python versions. Wrap it in :func:" +"`staticmethod` if you want to preserve the old behavior. (Contributed by " +"Serhiy Storchaka in :gh:`121027`.)" msgstr "" #: ../../whatsnew/3.13.rst:2646 @@ -5414,8 +5428,8 @@ msgid "" "``Python.h`` no longer includes the ``<ieeefp.h>`` standard header. It was " "included for the :c:func:`!finite` function which is now provided by the " "``<math.h>`` header. It should now be included explicitly if needed. Remove " -"also the ``HAVE_IEEEFP_H`` macro. (Contributed by Victor Stinner " -"in :gh:`108765`.)" +"also the ``HAVE_IEEEFP_H`` macro. (Contributed by Victor Stinner in :gh:" +"`108765`.)" msgstr "" #: ../../whatsnew/3.13.rst:2685 @@ -5424,9 +5438,9 @@ msgid "" "``<sys/select.h>`` and ``<sys/time.h>``. If needed, they should now be " "included explicitly. For example, ``<time.h>`` provides the :c:func:`!clock` " "and :c:func:`!gmtime` functions, ``<sys/select.h>`` provides the :c:func:`!" -"select` function, and ``<sys/time.h>`` provides the :c:func:`!" -"futimes`, :c:func:`!gettimeofday` and :c:func:`!setitimer` functions. " -"(Contributed by Victor Stinner in :gh:`108765`.)" +"select` function, and ``<sys/time.h>`` provides the :c:func:`!futimes`, :c:" +"func:`!gettimeofday` and :c:func:`!setitimer` functions. (Contributed by " +"Victor Stinner in :gh:`108765`.)" msgstr "" #: ../../whatsnew/3.13.rst:2693 @@ -5518,17 +5532,16 @@ msgstr "" #: ../../whatsnew/3.13.rst:2741 msgid "" -"The effects of mutating the dictionary returned " -"from :c:func:`PyEval_GetLocals` in an :term:`optimized scope` have changed. " -"New dict entries added this way will now *only* be visible to " -"subsequent :c:func:`PyEval_GetLocals` calls in that frame, " -"as :c:func:`PyFrame_GetLocals`, :func:`locals`, " -"and :attr:`FrameType.f_locals <frame.f_locals>` no longer access the same " -"underlying cached dictionary. Changes made to entries for actual variable " -"names and names added via the write-through proxy interfaces will be " -"overwritten on subsequent calls to :c:func:`PyEval_GetLocals` in that frame. " -"The recommended code update depends on how the function was being used, so " -"refer to the deprecation notice on the function for details." +"The effects of mutating the dictionary returned from :c:func:" +"`PyEval_GetLocals` in an :term:`optimized scope` have changed. New dict " +"entries added this way will now *only* be visible to subsequent :c:func:" +"`PyEval_GetLocals` calls in that frame, as :c:func:`PyFrame_GetLocals`, :" +"func:`locals`, and :attr:`FrameType.f_locals <frame.f_locals>` no longer " +"access the same underlying cached dictionary. Changes made to entries for " +"actual variable names and names added via the write-through proxy interfaces " +"will be overwritten on subsequent calls to :c:func:`PyEval_GetLocals` in " +"that frame. The recommended code update depends on how the function was " +"being used, so refer to the deprecation notice on the function for details." msgstr "" #: ../../whatsnew/3.13.rst:2754 @@ -5536,8 +5549,8 @@ msgid "" "Calling :c:func:`PyFrame_GetLocals` in an :term:`optimized scope` now " "returns a write-through proxy rather than a snapshot that gets updated at " "ill-specified times. If a snapshot is desired, it must be created explicitly " -"(e.g. with :c:func:`PyDict_Copy`), or by calling the " -"new :c:func:`PyEval_GetFrameLocals` API." +"(e.g. with :c:func:`PyDict_Copy`), or by calling the new :c:func:" +"`PyEval_GetFrameLocals` API." msgstr "" #: ../../whatsnew/3.13.rst:2761 @@ -5575,11 +5588,11 @@ msgstr "``_PyErr_WriteUnraisableMsg()``::c:func:`PyErr_FormatUnraisable`;" #: ../../whatsnew/3.13.rst:2776 msgid "" -"``_PyEval_SetTrace()``: :c:func:`PyEval_SetTrace` " -"or :c:func:`PyEval_SetTraceAllThreads`;" +"``_PyEval_SetTrace()``: :c:func:`PyEval_SetTrace` or :c:func:" +"`PyEval_SetTraceAllThreads`;" msgstr "" -"``_PyEval_SetTrace()``::c:func:`PyEval_SetTrace` " -"或 :c:func:`PyEval_SetTraceAllThreads`;" +"``_PyEval_SetTrace()``::c:func:`PyEval_SetTrace` 或 :c:func:" +"`PyEval_SetTraceAllThreads`;" #: ../../whatsnew/3.13.rst:2777 msgid "``_PyList_Extend()``: :c:func:`PyList_Extend`;" @@ -5599,15 +5612,19 @@ msgstr "``_PyMem_Strdup()``:``strdup()``;" #: ../../whatsnew/3.13.rst:2781 msgid "``_PyObject_ClearManagedDict()``: :c:func:`PyObject_ClearManagedDict`;" -msgstr "``_PyObject_ClearManagedDict()``::c:func:`PyObject_ClearManagedDict`;" +msgstr "" +"``_PyObject_ClearManagedDict()``::c:func:`PyObject_ClearManagedDict`;" #: ../../whatsnew/3.13.rst:2782 msgid "``_PyObject_VisitManagedDict()``: :c:func:`PyObject_VisitManagedDict`;" -msgstr "``_PyObject_VisitManagedDict()``::c:func:`PyObject_VisitManagedDict`;" +msgstr "" +"``_PyObject_VisitManagedDict()``::c:func:`PyObject_VisitManagedDict`;" #: ../../whatsnew/3.13.rst:2783 -msgid "``_PyThreadState_UncheckedGet()``: :c:func:`PyThreadState_GetUnchecked()`;" -msgstr "``_PyThreadState_UncheckedGet()``::c:func:`PyThreadState_GetUnchecked()`;" +msgid "" +"``_PyThreadState_UncheckedGet()``: :c:func:`PyThreadState_GetUnchecked()`;" +msgstr "" +"``_PyThreadState_UncheckedGet()``::c:func:`PyThreadState_GetUnchecked()`;" #: ../../whatsnew/3.13.rst:2784 msgid "``_PyTime_AsSecondsDouble()``: :c:func:`PyTime_AsSecondsDouble`;" @@ -5615,27 +5632,27 @@ msgstr "``_PyTime_AsSecondsDouble()``::c:func:`PyTime_AsSecondsDouble`;" #: ../../whatsnew/3.13.rst:2785 msgid "" -"``_PyTime_GetMonotonicClock()``: :c:func:`PyTime_Monotonic` " -"or :c:func:`PyTime_MonotonicRaw`;" +"``_PyTime_GetMonotonicClock()``: :c:func:`PyTime_Monotonic` or :c:func:" +"`PyTime_MonotonicRaw`;" msgstr "" -"``_PyTime_GetMonotonicClock()``::c:func:`PyTime_Monotonic` " -"或 :c:func:`PyTime_MonotonicRaw`;" +"``_PyTime_GetMonotonicClock()``::c:func:`PyTime_Monotonic` 或 :c:func:" +"`PyTime_MonotonicRaw`;" #: ../../whatsnew/3.13.rst:2786 msgid "" -"``_PyTime_GetPerfCounter()``: :c:func:`PyTime_PerfCounter` " -"or :c:func:`PyTime_PerfCounterRaw`;" +"``_PyTime_GetPerfCounter()``: :c:func:`PyTime_PerfCounter` or :c:func:" +"`PyTime_PerfCounterRaw`;" msgstr "" -"``_PyTime_GetPerfCounter()``::c:func:`PyTime_PerfCounter` " -"或 :c:func:`PyTime_PerfCounterRaw`;" +"``_PyTime_GetPerfCounter()``::c:func:`PyTime_PerfCounter` 或 :c:func:" +"`PyTime_PerfCounterRaw`;" #: ../../whatsnew/3.13.rst:2787 msgid "" -"``_PyTime_GetSystemClock()``: :c:func:`PyTime_Time` " -"or :c:func:`PyTime_TimeRaw`;" +"``_PyTime_GetSystemClock()``: :c:func:`PyTime_Time` or :c:func:" +"`PyTime_TimeRaw`;" msgstr "" -"``_PyTime_GetSystemClock()``::c:func:`PyTime_Time` " -"或 :c:func:`PyTime_TimeRaw`;" +"``_PyTime_GetSystemClock()``::c:func:`PyTime_Time` 或 :c:func:" +"`PyTime_TimeRaw`;" #: ../../whatsnew/3.13.rst:2788 msgid "``_PyTime_MAX``: :c:var:`PyTime_MAX`;" @@ -5662,19 +5679,25 @@ msgid "" "The `pythoncapi-compat project`_ can be used to get most of these new " "functions on Python 3.12 and older." msgstr "" +"可以使用 `pythoncapi-compat 專案`_\\ 來在 Python 3.12 及更舊的版本中取用大部" +"分的這些新函式。" #: ../../whatsnew/3.13.rst:2798 msgid "Regression Test Changes" -msgstr "" +msgstr "迴歸測試的變更" #: ../../whatsnew/3.13.rst:2800 msgid "" -"Python built with :file:`configure` :option:`--with-pydebug` now supports " -"a :option:`-X presite=package.module <-X>` command-line option. If used, it " +"Python built with :file:`configure` :option:`--with-pydebug` now supports a :" +"option:`-X presite=package.module <-X>` command-line option. If used, it " "specifies a module that should be imported early in the lifecycle of the " "interpreter, before ``site.py`` is executed. (Contributed by Łukasz Langa " "in :gh:`110769`.)" msgstr "" +"使用 :file:`configure` :option:`--with-pydebug` 建置的 Python 現在支援 :" +"option:`-X presite=package.module <-X>` 命令列選項。如果使用它就會指定一個應" +"該在解譯器生命週期的早期階段、在執行 ``site.py`` 之前被引入的模組。(由 " +"Łukasz Langa 在 :gh:`110769` 中貢獻。)" #: ../../whatsnew/3.13.rst:2808 msgid "Notable changes in 3.13.1" @@ -5686,3 +5709,14 @@ msgid "" "only exists in specialized builds of Python, may now return objects from " "other interpreters than the one it's called in." msgstr "" +"先前未以文件記錄的特殊函式 :func:`sys.getobjects`,只存在於 Python 的特殊建置" +"中,現在可能會回傳來自於呼叫它的直譯器之外的物件。" + +#~ msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" +#~ msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" + +#~ msgid "" +#~ ":func:`sysconfig.is_python_build` *check_home* parameter is deprecated " +#~ "and ignored." +#~ msgstr "" +#~ ":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" diff --git a/whatsnew/3.2.po b/whatsnew/3.2.po index 2ed7e65d36..eef8f7784e 100644 --- a/whatsnew/3.2.po +++ b/whatsnew/3.2.po @@ -90,10 +90,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:95 msgid "" "This module has already had widespread success in the community as a third-" -"party module. Being more fully featured than its predecessor, the :mod:" -"`argparse` module is now the preferred module for command-line processing. " -"The older module is still being kept available because of the substantial " -"amount of legacy code that depends on it." +"party module. Being more fully featured than its predecessor, " +"the :mod:`argparse` module is now the preferred module for command-line " +"processing. The older module is still being kept available because of the " +"substantial amount of legacy code that depends on it." msgstr "" #: ../../whatsnew/3.2.rst:101 @@ -234,8 +234,8 @@ msgstr "由 Steven Bethard 撰寫 PEP。" #: ../../whatsnew/3.2.rst:178 msgid "" -":ref:`upgrading-optparse-code` for details on the differences from :mod:" -"`optparse`." +":ref:`upgrading-optparse-code` for details on the differences " +"from :mod:`optparse`." msgstr "" #: ../../whatsnew/3.2.rst:182 @@ -254,20 +254,20 @@ msgstr "" #: ../../whatsnew/3.2.rst:191 msgid "" -"To support a more flexible style, the module now offers :func:`logging." -"config.dictConfig` for specifying logging configuration with plain Python " -"dictionaries. The configuration options include formatters, handlers, " -"filters, and loggers. Here's a working example of a configuration " -"dictionary::" +"To support a more flexible style, the module now " +"offers :func:`logging.config.dictConfig` for specifying logging " +"configuration with plain Python dictionaries. The configuration options " +"include formatters, handlers, filters, and loggers. Here's a working " +"example of a configuration dictionary::" msgstr "" #: ../../whatsnew/3.2.rst:197 msgid "" "{\"version\": 1,\n" -" \"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: " -"%(message)s\"},\n" -" \"full\": {\"format\": \"%(asctime)s %(name)-15s " -"%(levelname)-8s %(message)s\"}\n" +" \"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: %" +"(message)s\"},\n" +" \"full\": {\"format\": \"%(asctime)s %(name)-15s %" +"(levelname)-8s %(message)s\"}\n" " },\n" " \"handlers\": {\"console\": {\n" " \"class\": \"logging.StreamHandler\",\n" @@ -284,10 +284,10 @@ msgid "" "\"console_priority\"]}}" msgstr "" "{\"version\": 1,\n" -" \"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: " -"%(message)s\"},\n" -" \"full\": {\"format\": \"%(asctime)s %(name)-15s " -"%(levelname)-8s %(message)s\"}\n" +" \"formatters\": {\"brief\": {\"format\": \"%(levelname)-8s: %(name)-15s: %" +"(message)s\"},\n" +" \"full\": {\"format\": \"%(asctime)s %(name)-15s %" +"(levelname)-8s %(message)s\"}\n" " },\n" " \"handlers\": {\"console\": {\n" " \"class\": \"logging.StreamHandler\",\n" @@ -344,12 +344,12 @@ msgstr "" #: ../../whatsnew/3.2.rst:241 msgid "" -"The design for :mod:`concurrent.futures` was inspired by the *java.util." -"concurrent* package. In that model, a running call and its result are " -"represented by a :class:`~concurrent.futures.Future` object that abstracts " -"features common to threads, processes, and remote procedure calls. That " -"object supports status checks (running or done), timeouts, cancellations, " -"adding callbacks, and access to results or exceptions." +"The design for :mod:`concurrent.futures` was inspired by the " +"*java.util.concurrent* package. In that model, a running call and its " +"result are represented by a :class:`~concurrent.futures.Future` object that " +"abstracts features common to threads, processes, and remote procedure " +"calls. That object supports status checks (running or done), timeouts, " +"cancellations, adding callbacks, and access to results or exceptions." msgstr "" #: ../../whatsnew/3.2.rst:248 @@ -372,14 +372,15 @@ msgstr "" #: ../../whatsnew/3.2.rst:260 msgid "" -"Both classes share a common interface with three methods: :meth:`~concurrent." -"futures.Executor.submit` for scheduling a callable and returning a :class:" -"`~concurrent.futures.Future` object; :meth:`~concurrent.futures.Executor." -"map` for scheduling many asynchronous calls at a time, and :meth:" -"`~concurrent.futures.Executor.shutdown` for freeing resources. The class is " -"a :term:`context manager` and can be used in a :keyword:`with` statement to " -"assure that resources are automatically released when currently pending " -"futures are done executing." +"Both classes share a common interface with three " +"methods: :meth:`~concurrent.futures.Executor.submit` for scheduling a " +"callable and returning a :class:`~concurrent.futures.Future` " +"object; :meth:`~concurrent.futures.Executor.map` for scheduling many " +"asynchronous calls at a time, " +"and :meth:`~concurrent.futures.Executor.shutdown` for freeing resources. " +"The class is a :term:`context manager` and can be used in a :keyword:`with` " +"statement to assure that resources are automatically released when currently " +"pending futures are done executing." msgstr "" #: ../../whatsnew/3.2.rst:269 @@ -421,8 +422,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:287 msgid "" ":ref:`Code for computing prime numbers in parallel<processpoolexecutor-" -"example>`, an example demonstrating :class:`~concurrent.futures." -"ProcessPoolExecutor`." +"example>`, an example " +"demonstrating :class:`~concurrent.futures.ProcessPoolExecutor`." msgstr "" #: ../../whatsnew/3.2.rst:293 @@ -451,10 +452,11 @@ msgid "" "To solve this problem, Python's import machinery has been extended to use " "distinct filenames for each interpreter. Instead of Python 3.2 and Python " "3.3 and Unladen Swallow each competing for a file called \"mymodule.pyc\", " -"they will now look for \"mymodule.cpython-32.pyc\", \"mymodule.cpython-33." -"pyc\", and \"mymodule.unladen10.pyc\". And to prevent all of these new " -"files from cluttering source directories, the *pyc* files are now collected " -"in a \"__pycache__\" directory stored under the package directory." +"they will now look for \"mymodule.cpython-32.pyc\", " +"\"mymodule.cpython-33.pyc\", and \"mymodule.unladen10.pyc\". And to prevent " +"all of these new files from cluttering source directories, the *pyc* files " +"are now collected in a \"__pycache__\" directory stored under the package " +"directory." msgstr "" #: ../../whatsnew/3.2.rst:312 @@ -539,8 +541,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:373 msgid "" -"In Python itself, the tags are accessible from functions in the :mod:" -"`sysconfig` module::" +"In Python itself, the tags are accessible from functions in " +"the :mod:`sysconfig` module::" msgstr "" #: ../../whatsnew/3.2.rst:376 @@ -660,11 +662,11 @@ msgid "" "There is also a new :meth:`str.format_map` method that extends the " "capabilities of the existing :meth:`str.format` method by accepting " "arbitrary :term:`mapping` objects. This new method makes it possible to use " -"string formatting with any of Python's many dictionary-like objects such as :" -"class:`~collections.defaultdict`, :class:`~shelve.Shelf`, :class:" -"`~configparser.ConfigParser`, or :mod:`dbm`. It is also useful with custom :" -"class:`dict` subclasses that normalize keys before look-up or that supply a :" -"meth:`__missing__` method for unknown keys::" +"string formatting with any of Python's many dictionary-like objects such " +"as :class:`~collections.defaultdict`, :class:`~shelve.Shelf`, :class:`~configparser.ConfigParser`, " +"or :mod:`dbm`. It is also useful with custom :class:`dict` subclasses that " +"normalize keys before look-up or that supply a :meth:`__missing__` method " +"for unknown keys::" msgstr "" #: ../../whatsnew/3.2.rst:463 @@ -711,16 +713,16 @@ msgstr "" #: ../../whatsnew/3.2.rst:483 msgid "" -"(Suggested by Raymond Hettinger and implemented by Eric Smith in :issue:" -"`6081`.)" +"(Suggested by Raymond Hettinger and implemented by Eric Smith " +"in :issue:`6081`.)" msgstr "" #: ../../whatsnew/3.2.rst:486 msgid "" "The interpreter can now be started with a quiet option, ``-q``, to prevent " "the copyright and version information from being displayed in the " -"interactive mode. The option can be introspected using the :data:`sys." -"flags` attribute:" +"interactive mode. The option can be introspected using " +"the :data:`sys.flags` attribute:" msgstr "" #: ../../whatsnew/3.2.rst:490 @@ -745,11 +747,11 @@ msgstr "(由 Marcin Wojdyr 在 :issue:`1772833` 中貢獻)。" msgid "" "The :func:`hasattr` function works by calling :func:`getattr` and detecting " "whether an exception is raised. This technique allows it to detect methods " -"created dynamically by :meth:`~object.__getattr__` or :meth:`~object." -"__getattribute__` which would otherwise be absent from the class " -"dictionary. Formerly, *hasattr* would catch any exception, possibly masking " -"genuine errors. Now, *hasattr* has been tightened to only catch :exc:" -"`AttributeError` and let other exceptions pass through::" +"created dynamically by :meth:`~object.__getattr__` " +"or :meth:`~object.__getattribute__` which would otherwise be absent from the " +"class dictionary. Formerly, *hasattr* would catch any exception, possibly " +"masking genuine errors. Now, *hasattr* has been tightened to only " +"catch :exc:`AttributeError` and let other exceptions pass through::" msgstr "" #: ../../whatsnew/3.2.rst:508 @@ -783,10 +785,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:521 msgid "" -"The :func:`str` of a float or complex number is now the same as its :func:" -"`repr`. Previously, the :func:`str` form was shorter but that just caused " -"confusion and is no longer needed now that the shortest possible :func:" -"`repr` is displayed by default:" +"The :func:`str` of a float or complex number is now the same as " +"its :func:`repr`. Previously, the :func:`str` form was shorter but that just " +"caused confusion and is no longer needed now that the shortest " +"possible :func:`repr` is displayed by default:" msgstr "" #: ../../whatsnew/3.2.rst:532 @@ -851,11 +853,11 @@ msgstr "(請見 :issue:`4617`。)" #: ../../whatsnew/3.2.rst:569 msgid "" ":ref:`Struct sequence types <struct-sequence-objects>` are now subclasses of " -"tuple. This means that C structures like those returned by :func:`os.stat`, :" -"func:`time.gmtime`, and :data:`sys.version_info` now work like a :term:" -"`named tuple` and now work with functions and methods that expect a tuple as " -"an argument. This is a big step forward in making the C structures as " -"flexible as their pure Python counterparts:" +"tuple. This means that C structures like those returned " +"by :func:`os.stat`, :func:`time.gmtime`, and :data:`sys.version_info` now " +"work like a :term:`named tuple` and now work with functions and methods that " +"expect a tuple as an argument. This is a big step forward in making the C " +"structures as flexible as their pure Python counterparts:" msgstr "" #: ../../whatsnew/3.2.rst:582 @@ -878,8 +880,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:592 msgid "" -"(Suggested by Barry Warsaw and implemented by Philip Jenvey in :issue:" -"`7301`.)" +"(Suggested by Barry Warsaw and implemented by Philip Jenvey " +"in :issue:`7301`.)" msgstr "" #: ../../whatsnew/3.2.rst:594 @@ -893,10 +895,11 @@ msgstr "" #: ../../whatsnew/3.2.rst:600 msgid "" -"A :exc:`ResourceWarning` is issued at interpreter shutdown if the :data:`gc." -"garbage` list isn't empty, and if :const:`gc.DEBUG_UNCOLLECTABLE` is set, " -"all uncollectable objects are printed. This is meant to make the programmer " -"aware that their code contains object finalization issues." +"A :exc:`ResourceWarning` is issued at interpreter shutdown if " +"the :data:`gc.garbage` list isn't empty, and " +"if :const:`gc.DEBUG_UNCOLLECTABLE` is set, all uncollectable objects are " +"printed. This is meant to make the programmer aware that their code " +"contains object finalization issues." msgstr "" #: ../../whatsnew/3.2.rst:605 @@ -923,19 +926,19 @@ msgstr "" #: ../../whatsnew/3.2.rst:619 msgid "" -"(Added by Antoine Pitrou and Georg Brandl in :issue:`10093` and :issue:" -"`477863`.)" +"(Added by Antoine Pitrou and Georg Brandl in :issue:`10093` " +"and :issue:`477863`.)" msgstr "" #: ../../whatsnew/3.2.rst:621 msgid "" ":class:`range` objects now support *index* and *count* methods. This is part " -"of an effort to make more objects fully implement the :class:`collections." -"Sequence <collections.abc.Sequence>` :term:`abstract base class`. As a " -"result, the language will have a more uniform API. In addition, :class:" -"`range` objects now support slicing and negative indices, even with values " -"larger than :data:`sys.maxsize`. This makes *range* more interoperable with " -"lists::" +"of an effort to make more objects fully implement " +"the :class:`collections.Sequence <collections.abc.Sequence>` :term:`abstract " +"base class`. As a result, the language will have a more uniform API. In " +"addition, :class:`range` objects now support slicing and negative indices, " +"even with values larger than :data:`sys.maxsize`. This makes *range* more " +"interoperable with lists::" msgstr "" #: ../../whatsnew/3.2.rst:628 @@ -963,8 +966,8 @@ msgid "" "(Contributed by Daniel Stutzbach in :issue:`9213`, by Alexander Belopolsky " "in :issue:`2690`, and by Nick Coghlan in :issue:`10889`.)" msgstr "" -"(由 Daniel Stutzbach 在 :issue:`9213`、Alexander Belopolsky 在 :issue:" -"`2690`、Nick Coghlan 在 :issue:`10889` 中貢獻。)" +"(由 Daniel Stutzbach 在 :issue:`9213`、Alexander Belopolsky " +"在 :issue:`2690`、Nick Coghlan 在 :issue:`10889` 中貢獻。)" #: ../../whatsnew/3.2.rst:640 msgid "" @@ -1000,10 +1003,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:664 msgid "" -"The biggest news for Python 3.2 is that the :mod:`email` package, :mod:" -"`mailbox` module, and :mod:`!nntplib` modules now work correctly with the " -"bytes/text model in Python 3. For the first time, there is correct handling " -"of messages with mixed encodings." +"The biggest news for Python 3.2 is that the :mod:`email` " +"package, :mod:`mailbox` module, and :mod:`!nntplib` modules now work " +"correctly with the bytes/text model in Python 3. For the first time, there " +"is correct handling of messages with mixed encodings." msgstr "" #: ../../whatsnew/3.2.rst:669 @@ -1034,18 +1037,19 @@ msgstr "email" msgid "" "The usability of the :mod:`email` package in Python 3 has been mostly fixed " "by the extensive efforts of R. David Murray. The problem was that emails " -"are typically read and stored in the form of :class:`bytes` rather than :" -"class:`str` text, and they may contain multiple encodings within a single " -"email. So, the email package had to be extended to parse and generate email " -"messages in bytes format." +"are typically read and stored in the form of :class:`bytes` rather " +"than :class:`str` text, and they may contain multiple encodings within a " +"single email. So, the email package had to be extended to parse and " +"generate email messages in bytes format." msgstr "" #: ../../whatsnew/3.2.rst:690 msgid "" -"New functions :func:`~email.message_from_bytes` and :func:`~email." -"message_from_binary_file`, and new classes :class:`~email.parser." -"BytesFeedParser` and :class:`~email.parser.BytesParser` allow binary message " -"data to be parsed into model objects." +"New functions :func:`~email.message_from_bytes` " +"and :func:`~email.message_from_binary_file`, and new " +"classes :class:`~email.parser.BytesFeedParser` " +"and :class:`~email.parser.BytesParser` allow binary message data to be " +"parsed into model objects." msgstr "" #: ../../whatsnew/3.2.rst:695 @@ -1065,31 +1069,31 @@ msgstr "" #: ../../whatsnew/3.2.rst:704 msgid "" -"Headers with unencoded non-ASCII bytes are deemed to be :rfc:`2047`\\ -" -"encoded using the *unknown-8bit* character set." +"Headers with unencoded non-ASCII bytes are deemed to be :rfc:`2047`\\ " +"-encoded using the *unknown-8bit* character set." msgstr "" #: ../../whatsnew/3.2.rst:707 msgid "" "A new class :class:`~email.generator.BytesGenerator` produces bytes as " "output, preserving any unchanged non-ASCII data that was present in the " -"input used to build the model, including message bodies with a :mailheader:" -"`Content-Transfer-Encoding` of *8bit*." +"input used to build the model, including message bodies with " +"a :mailheader:`Content-Transfer-Encoding` of *8bit*." msgstr "" #: ../../whatsnew/3.2.rst:712 msgid "" "The :mod:`smtplib` :class:`~smtplib.SMTP` class now accepts a byte string " "for the *msg* argument to the :meth:`~smtplib.SMTP.sendmail` method, and a " -"new method, :meth:`~smtplib.SMTP.send_message` accepts a :class:`~email." -"message.Message` object and can optionally obtain the *from_addr* and " -"*to_addrs* addresses directly from the object." +"new method, :meth:`~smtplib.SMTP.send_message` accepts " +"a :class:`~email.message.Message` object and can optionally obtain the " +"*from_addr* and *to_addrs* addresses directly from the object." msgstr "" #: ../../whatsnew/3.2.rst:718 msgid "" -"(Proposed and implemented by R. David Murray, :issue:`4661` and :issue:" -"`10321`.)" +"(Proposed and implemented by R. David Murray, :issue:`4661` " +"and :issue:`10321`.)" msgstr "" #: ../../whatsnew/3.2.rst:721 @@ -1098,8 +1102,8 @@ msgstr "elementtree" #: ../../whatsnew/3.2.rst:723 msgid "" -"The :mod:`xml.etree.ElementTree` package and its :mod:`!xml.etree." -"cElementTree` counterpart have been updated to version 1.3." +"The :mod:`xml.etree.ElementTree` package and its :mod:`!" +"xml.etree.cElementTree` counterpart have been updated to version 1.3." msgstr "" #: ../../whatsnew/3.2.rst:726 @@ -1168,9 +1172,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:749 msgid "" -"For details of the update, see `Introducing ElementTree <https://web.archive." -"org/web/20200703234532/http://effbot.org/zone/elementtree-13-intro.htm>`_ on " -"Fredrik Lundh's website." +"For details of the update, see `Introducing ElementTree <https://" +"web.archive.org/web/20200703234532/http://effbot.org/zone/elementtree-13-" +"intro.htm>`_ on Fredrik Lundh's website." msgstr "" #: ../../whatsnew/3.2.rst:753 @@ -1209,20 +1213,20 @@ msgstr "" #: ../../whatsnew/3.2.rst:786 msgid "" "(Contributed by Raymond Hettinger and incorporating design ideas from Jim " -"Baker, Miki Tebeka, and Nick Coghlan; see `recipe 498245 <https://code." -"activestate.com/recipes/498245-lru-and-lfu-cache-decorators/>`_\\, `recipe " -"577479 <https://code.activestate.com/recipes/577479-simple-caching-decorator/" -">`_\\, :issue:`10586`, and :issue:`10593`.)" +"Baker, Miki Tebeka, and Nick Coghlan; see `recipe 498245 <https://" +"code.activestate.com/recipes/498245-lru-and-lfu-cache-decorators/>`_\\, " +"`recipe 577479 <https://code.activestate.com/recipes/577479-simple-caching-" +"decorator/>`_\\, :issue:`10586`, and :issue:`10593`.)" msgstr "" #: ../../whatsnew/3.2.rst:792 msgid "" "The :func:`functools.wraps` decorator now adds a :attr:`__wrapped__` " "attribute pointing to the original callable function. This allows wrapped " -"functions to be introspected. It also copies :attr:`~function." -"__annotations__` if defined. And now it also gracefully skips over missing " -"attributes such as :attr:`~function.__doc__` which might not be defined for " -"the wrapped callable." +"functions to be introspected. It also " +"copies :attr:`~function.__annotations__` if defined. And now it also " +"gracefully skips over missing attributes such as :attr:`~function.__doc__` " +"which might not be defined for the wrapped callable." msgstr "" #: ../../whatsnew/3.2.rst:799 @@ -1233,21 +1237,22 @@ msgstr "" #: ../../whatsnew/3.2.rst:804 msgid "" -"(By Nick Coghlan and Terrence Cole; :issue:`9567`, :issue:`3445`, and :issue:" -"`8814`.)" +"(By Nick Coghlan and Terrence Cole; :issue:`9567`, :issue:`3445`, " +"and :issue:`8814`.)" msgstr "" #: ../../whatsnew/3.2.rst:807 msgid "" -"To help write classes with rich comparison methods, a new decorator :func:" -"`functools.total_ordering` will use existing equality and inequality methods " -"to fill in the remaining methods." +"To help write classes with rich comparison methods, a new " +"decorator :func:`functools.total_ordering` will use existing equality and " +"inequality methods to fill in the remaining methods." msgstr "" #: ../../whatsnew/3.2.rst:811 msgid "" -"For example, supplying *__eq__* and *__lt__* will enable :func:`~functools." -"total_ordering` to fill-in *__le__*, *__gt__* and *__ge__*::" +"For example, supplying *__eq__* and *__lt__* will " +"enable :func:`~functools.total_ordering` to fill-in *__le__*, *__gt__* and " +"*__ge__*::" msgstr "" #: ../../whatsnew/3.2.rst:814 @@ -1328,18 +1333,19 @@ msgstr "collections" msgid "" "The :class:`collections.Counter` class now has two forms of in-place " "subtraction, the existing *-=* operator for `saturating subtraction <https://" -"en.wikipedia.org/wiki/Saturation_arithmetic>`_ and the new :meth:" -"`~collections.Counter.subtract` method for regular subtraction. The former " -"is suitable for `multisets <https://en.wikipedia.org/wiki/Multiset>`_ which " -"only have positive counts, and the latter is more suitable for use cases " -"that allow negative counts:" +"en.wikipedia.org/wiki/Saturation_arithmetic>`_ and the " +"new :meth:`~collections.Counter.subtract` method for regular subtraction. " +"The former is suitable for `multisets <https://en.wikipedia.org/wiki/" +"Multiset>`_ which only have positive counts, and the latter is more suitable " +"for use cases that allow negative counts:" msgstr "" #: ../../whatsnew/3.2.rst:885 msgid "" -"The :class:`collections.OrderedDict` class has a new method :meth:" -"`~collections.OrderedDict.move_to_end` which takes an existing key and moves " -"it to either the first or last position in the ordered sequence." +"The :class:`collections.OrderedDict` class has a new " +"method :meth:`~collections.OrderedDict.move_to_end` which takes an existing " +"key and moves it to either the first or last position in the ordered " +"sequence." msgstr "" #: ../../whatsnew/3.2.rst:889 @@ -1357,9 +1363,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:906 msgid "" -"The :class:`collections.deque` class grew two new methods :meth:" -"`~collections.deque.count` and :meth:`~collections.deque.reverse` that make " -"them more substitutable for :class:`list` objects:" +"The :class:`collections.deque` class grew two new " +"methods :meth:`~collections.deque.count` " +"and :meth:`~collections.deque.reverse` that make them more substitutable " +"for :class:`list` objects:" msgstr "" #: ../../whatsnew/3.2.rst:921 @@ -1495,8 +1502,8 @@ msgid "" ">>> from datetime import datetime, timezone\n" "\n" ">>> datetime.now(timezone.utc)\n" -"datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, tzinfo=datetime.timezone." -"utc)\n" +"datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, " +"tzinfo=datetime.timezone.utc)\n" "\n" ">>> datetime.strptime(\"01/01/2000 12:00 +0000\", \"%m/%d/%Y %H:%M %z\")\n" "datetime.datetime(2000, 1, 1, 12, 0, tzinfo=datetime.timezone.utc)" @@ -1504,17 +1511,17 @@ msgstr "" ">>> from datetime import datetime, timezone\n" "\n" ">>> datetime.now(timezone.utc)\n" -"datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, tzinfo=datetime.timezone." -"utc)\n" +"datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, " +"tzinfo=datetime.timezone.utc)\n" "\n" ">>> datetime.strptime(\"01/01/2000 12:00 +0000\", \"%m/%d/%Y %H:%M %z\")\n" "datetime.datetime(2000, 1, 1, 12, 0, tzinfo=datetime.timezone.utc)" #: ../../whatsnew/3.2.rst:1003 msgid "" -"Also, :class:`~datetime.timedelta` objects can now be multiplied by :class:" -"`float` and divided by :class:`float` and :class:`int` objects. And :class:" -"`~datetime.timedelta` objects can now divide one another." +"Also, :class:`~datetime.timedelta` objects can now be multiplied " +"by :class:`float` and divided by :class:`float` and :class:`int` objects. " +"And :class:`~datetime.timedelta` objects can now divide one another." msgstr "" #: ../../whatsnew/3.2.rst:1007 @@ -1533,9 +1540,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:1015 msgid "" -"Starting with Py3.2, use of the century guessing heuristic will emit a :exc:" -"`DeprecationWarning`. Instead, it is recommended that :data:`!time." -"accept2dyear` be set to ``False`` so that large date ranges can be used " +"Starting with Py3.2, use of the century guessing heuristic will emit " +"a :exc:`DeprecationWarning`. Instead, it is recommended that :data:`!" +"time.accept2dyear` be set to ``False`` so that large date ranges can be used " "without guesswork::" msgstr "" @@ -1560,20 +1567,20 @@ msgstr "" msgid "" "Several functions now have significantly expanded date ranges. When :data:`!" "time.accept2dyear` is false, the :func:`time.asctime` function will accept " -"any year that fits in a C int, while the :func:`time.mktime` and :func:`time." -"strftime` functions will accept the full range supported by the " -"corresponding operating system functions." +"any year that fits in a C int, while the :func:`time.mktime` " +"and :func:`time.strftime` functions will accept the full range supported by " +"the corresponding operating system functions." msgstr "" #: ../../whatsnew/3.2.rst:1040 msgid "" -"(Contributed by Alexander Belopolsky and Victor Stinner in :issue:" -"`1289118`, :issue:`5094`, :issue:`6641`, :issue:`2706`, :issue:`1777412`, :" -"issue:`8013`, and :issue:`10827`.)" +"(Contributed by Alexander Belopolsky and Victor Stinner " +"in :issue:`1289118`, :issue:`5094`, :issue:`6641`, :issue:`2706`, :issue:`1777412`, :issue:`8013`, " +"and :issue:`10827`.)" msgstr "" -"(由 Alexander Belopolsky 和 Victor Stinner 在 :issue:`1289118`、:issue:" -"`5094`、:issue:`6641`、:issue:`2706`、:issue:`1777412`、:issue:`8013` 和 :" -"issue:`10827` 中貢獻。)" +"(由 Alexander Belopolsky 和 Victor Stinner " +"在 :issue:`1289118`、:issue:`5094`、:issue:`6641`、:issue:`2706`、:issue:`1777412`、:issue:`8013` " +"和 :issue:`10827` 中貢獻。)" #: ../../whatsnew/3.2.rst:1047 msgid "math" @@ -1638,8 +1645,8 @@ msgstr "abc" #: ../../whatsnew/3.2.rst:1100 msgid "" -"The :mod:`abc` module now supports :func:`~abc.abstractclassmethod` and :" -"func:`~abc.abstractstaticmethod`." +"The :mod:`abc` module now supports :func:`~abc.abstractclassmethod` " +"and :func:`~abc.abstractstaticmethod`." msgstr "" #: ../../whatsnew/3.2.rst:1103 @@ -1739,9 +1746,9 @@ msgstr "reprlib" msgid "" "When writing a :meth:`~object.__repr__` method for a custom container, it is " "easy to forget to handle the case where a member refers back to the " -"container itself. Python's builtin objects such as :class:`list` and :class:" -"`set` handle self-reference by displaying \"...\" in the recursive part of " -"the representation string." +"container itself. Python's builtin objects such as :class:`list` " +"and :class:`set` handle self-reference by displaying \"...\" in the " +"recursive part of the representation string." msgstr "" #: ../../whatsnew/3.2.rst:1157 @@ -1786,8 +1793,8 @@ msgstr "logging" #: ../../whatsnew/3.2.rst:1177 msgid "" -"In addition to dictionary-based configuration described above, the :mod:" -"`logging` package has many other improvements." +"In addition to dictionary-based configuration described above, " +"the :mod:`logging` package has many other improvements." msgstr "" #: ../../whatsnew/3.2.rst:1180 @@ -1802,42 +1809,42 @@ msgstr "" msgid "" "The :func:`logging.basicConfig` set-up function gained a *style* argument to " "support three different types of string formatting. It defaults to \"%\" " -"for traditional %-formatting, can be set to \"{\" for the new :meth:`str." -"format` style, or can be set to \"$\" for the shell-style formatting " -"provided by :class:`string.Template`. The following three configurations " -"are equivalent::" +"for traditional %-formatting, can be set to \"{\" for the " +"new :meth:`str.format` style, or can be set to \"$\" for the shell-style " +"formatting provided by :class:`string.Template`. The following three " +"configurations are equivalent::" msgstr "" #: ../../whatsnew/3.2.rst:1191 msgid "" ">>> from logging import basicConfig\n" -">>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: " -"%(message)s\")\n" +">>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: %" +"(message)s\")\n" ">>> basicConfig(style='{', format=\"{name} -> {levelname} {message}\")\n" ">>> basicConfig(style='$', format=\"$name -> $levelname: $message\")" msgstr "" ">>> from logging import basicConfig\n" -">>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: " -"%(message)s\")\n" +">>> basicConfig(style='%', format=\"%(name)s -> %(levelname)s: %" +"(message)s\")\n" ">>> basicConfig(style='{', format=\"{name} -> {levelname} {message}\")\n" ">>> basicConfig(style='$', format=\"$name -> $levelname: $message\")" #: ../../whatsnew/3.2.rst:1196 msgid "" "If no configuration is set-up before a logging event occurs, there is now a " -"default configuration using a :class:`~logging.StreamHandler` directed to :" -"data:`sys.stderr` for events of ``WARNING`` level or higher. Formerly, an " -"event occurring before a configuration was set-up would either raise an " -"exception or silently drop the event depending on the value of :data:" -"`logging.raiseExceptions`. The new default handler is stored in :data:" -"`logging.lastResort`." +"default configuration using a :class:`~logging.StreamHandler` directed " +"to :data:`sys.stderr` for events of ``WARNING`` level or higher. Formerly, " +"an event occurring before a configuration was set-up would either raise an " +"exception or silently drop the event depending on the value " +"of :data:`logging.raiseExceptions`. The new default handler is stored " +"in :data:`logging.lastResort`." msgstr "" #: ../../whatsnew/3.2.rst:1204 msgid "" -"The use of filters has been simplified. Instead of creating a :class:" -"`~logging.Filter` object, the predicate can be any Python callable that " -"returns ``True`` or ``False``." +"The use of filters has been simplified. Instead of creating " +"a :class:`~logging.Filter` object, the predicate can be any Python callable " +"that returns ``True`` or ``False``." msgstr "" #: ../../whatsnew/3.2.rst:1208 @@ -1853,16 +1860,17 @@ msgstr "csv" #: ../../whatsnew/3.2.rst:1215 msgid "" -"The :mod:`csv` module now supports a new dialect, :class:`~csv." -"unix_dialect`, which applies quoting for all fields and a traditional Unix " -"style with ``'\\n'`` as the line terminator. The registered dialect name is " -"``unix``." +"The :mod:`csv` module now supports a new " +"dialect, :class:`~csv.unix_dialect`, which applies quoting for all fields " +"and a traditional Unix style with ``'\\n'`` as the line terminator. The " +"registered dialect name is ``unix``." msgstr "" #: ../../whatsnew/3.2.rst:1219 msgid "" -"The :class:`csv.DictWriter` has a new method, :meth:`~csv.DictWriter." -"writeheader` for writing-out an initial row to document the field names::" +"The :class:`csv.DictWriter` has a new " +"method, :meth:`~csv.DictWriter.writeheader` for writing-out an initial row " +"to document the field names::" msgstr "" #: ../../whatsnew/3.2.rst:1223 @@ -1899,15 +1907,16 @@ msgstr "contextlib" #: ../../whatsnew/3.2.rst:1239 msgid "" -"There is a new and slightly mind-blowing tool :class:`~contextlib." -"ContextDecorator` that is helpful for creating a :term:`context manager` " -"that does double duty as a function decorator." +"There is a new and slightly mind-blowing " +"tool :class:`~contextlib.ContextDecorator` that is helpful for creating " +"a :term:`context manager` that does double duty as a function decorator." msgstr "" #: ../../whatsnew/3.2.rst:1243 msgid "" -"As a convenience, this new functionality is used by :func:`~contextlib." -"contextmanager` so that no extra effort is needed to support both roles." +"As a convenience, this new functionality is used " +"by :func:`~contextlib.contextmanager` so that no extra effort is needed to " +"support both roles." msgstr "" #: ../../whatsnew/3.2.rst:1247 @@ -2016,10 +2025,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:1303 msgid "" -"Some of the hashing details are exposed through a new attribute, :data:`sys." -"hash_info`, which describes the bit width of the hash value, the prime " -"modulus, the hash values for *infinity* and *nan*, and the multiplier used " -"for the imaginary part of a number:" +"Some of the hashing details are exposed through a new " +"attribute, :data:`sys.hash_info`, which describes the bit width of the hash " +"value, the prime modulus, the hash values for *infinity* and *nan*, and the " +"multiplier used for the imaginary part of a number:" msgstr "" #: ../../whatsnew/3.2.rst:1311 @@ -2036,30 +2045,32 @@ msgstr "" #: ../../whatsnew/3.2.rst:1319 msgid "" "The :class:`decimal.Decimal` constructor now accepts :class:`float` objects " -"directly so there in no longer a need to use the :meth:`~decimal.Decimal." -"from_float` method (:issue:`8257`)." +"directly so there in no longer a need to use " +"the :meth:`~decimal.Decimal.from_float` method (:issue:`8257`)." msgstr "" #: ../../whatsnew/3.2.rst:1323 msgid "" -"Mixed type comparisons are now fully supported so that :class:`~decimal." -"Decimal` objects can be directly compared with :class:`float` and :class:" -"`fractions.Fraction` (:issue:`2531` and :issue:`8188`)." +"Mixed type comparisons are now fully supported so " +"that :class:`~decimal.Decimal` objects can be directly compared " +"with :class:`float` and :class:`fractions.Fraction` (:issue:`2531` " +"and :issue:`8188`)." msgstr "" #: ../../whatsnew/3.2.rst:1327 msgid "" -"Similar changes were made to :class:`fractions.Fraction` so that the :meth:" -"`~fractions.Fraction.from_float` and :meth:`~fractions.Fraction." -"from_decimal` methods are no longer needed (:issue:`8294`):" +"Similar changes were made to :class:`fractions.Fraction` so that " +"the :meth:`~fractions.Fraction.from_float` " +"and :meth:`~fractions.Fraction.from_decimal` methods are no longer needed " +"(:issue:`8294`):" msgstr "" #: ../../whatsnew/3.2.rst:1338 msgid "" -"Another useful change for the :mod:`decimal` module is that the :attr:" -"`Context.clamp <decimal.Context.clamp>` attribute is now public. This is " -"useful in creating contexts that correspond to the decimal interchange " -"formats specified in IEEE 754 (see :issue:`8540`)." +"Another useful change for the :mod:`decimal` module is that " +"the :attr:`Context.clamp <decimal.Context.clamp>` attribute is now public. " +"This is useful in creating contexts that correspond to the decimal " +"interchange formats specified in IEEE 754 (see :issue:`8540`)." msgstr "" #: ../../whatsnew/3.2.rst:1343 @@ -2103,8 +2114,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:1363 msgid "" -"Other file-like objects such as :class:`mmap.mmap` and :func:`fileinput." -"input` also grew auto-closing context managers::" +"Other file-like objects such as :class:`mmap.mmap` " +"and :func:`fileinput.input` also grew auto-closing context managers::" msgstr "" #: ../../whatsnew/3.2.rst:1366 @@ -2143,14 +2154,14 @@ msgstr "popen" #: ../../whatsnew/3.2.rst:1382 msgid "" -"The :func:`os.popen` and :func:`subprocess.Popen` functions now support :" -"keyword:`with` statements for auto-closing of the file descriptors." +"The :func:`os.popen` and :func:`subprocess.Popen` functions now " +"support :keyword:`with` statements for auto-closing of the file descriptors." msgstr "" #: ../../whatsnew/3.2.rst:1385 msgid "" -"(Contributed by Antoine Pitrou and Brian Curtin in :issue:`7461` and :issue:" -"`10554`.)" +"(Contributed by Antoine Pitrou and Brian Curtin in :issue:`7461` " +"and :issue:`10554`.)" msgstr "" "(由 Antoine Pitrou 和 Brian Curtin 在 :issue:`7461` 和 :issue:`10554` 中貢" "獻。)" @@ -2161,10 +2172,10 @@ msgstr "select" #: ../../whatsnew/3.2.rst:1391 msgid "" -"The :mod:`select` module now exposes a new, constant attribute, :const:" -"`~select.PIPE_BUF`, which gives the minimum number of bytes which are " -"guaranteed not to block when :func:`select.select` says a pipe is ready for " -"writing." +"The :mod:`select` module now exposes a new, constant " +"attribute, :const:`~select.PIPE_BUF`, which gives the minimum number of " +"bytes which are guaranteed not to block when :func:`select.select` says a " +"pipe is ready for writing." msgstr "" #: ../../whatsnew/3.2.rst:1400 @@ -2177,16 +2188,16 @@ msgstr "gzip 和 zipfile" #: ../../whatsnew/3.2.rst:1405 msgid "" -":class:`gzip.GzipFile` now implements the :class:`io.BufferedIOBase` :term:" -"`abstract base class` (except for ``truncate()``). It also has a :meth:" -"`~gzip.GzipFile.peek` method and supports unseekable as well as zero-padded " -"file objects." +":class:`gzip.GzipFile` now implements " +"the :class:`io.BufferedIOBase` :term:`abstract base class` (except for " +"``truncate()``). It also has a :meth:`~gzip.GzipFile.peek` method and " +"supports unseekable as well as zero-padded file objects." msgstr "" #: ../../whatsnew/3.2.rst:1410 msgid "" -"The :mod:`gzip` module also gains the :func:`~gzip.compress` and :func:" -"`~gzip.decompress` functions for easier in-memory compression and " +"The :mod:`gzip` module also gains the :func:`~gzip.compress` " +"and :func:`~gzip.decompress` functions for easier in-memory compression and " "decompression. Keep in mind that text needs to be encoded as :class:`bytes` " "before compressing and decompressing:" msgstr "" @@ -2198,16 +2209,17 @@ msgid "" "and :issue:`2846`.)" msgstr "" "(由 Anand B. Pillai 在 :issue:`3488` 中貢獻;由 Antoine Pitrou、Nir Aides " -"和 Brian Curtin 在 :issue:`9962`、:issue:`1675951`、:issue:`7471` 和 :issue:" -"`2846` 中貢獻。)" +"和 Brian Curtin 在 :issue:`9962`、:issue:`1675951`、:issue:`7471` " +"和 :issue:`2846` 中貢獻。)" #: ../../whatsnew/3.2.rst:1431 msgid "" "Also, the :class:`zipfile.ZipExtFile <zipfile.ZipFile.open>` class was " "reworked internally to represent files stored inside an archive. The new " -"implementation is significantly faster and can be wrapped in an :class:`io." -"BufferedReader` object for more speedups. It also solves an issue where " -"interleaved calls to *read* and *readline* gave the wrong results." +"implementation is significantly faster and can be wrapped in " +"an :class:`io.BufferedReader` object for more speedups. It also solves an " +"issue where interleaved calls to *read* and *readline* gave the wrong " +"results." msgstr "" #: ../../whatsnew/3.2.rst:1437 @@ -2231,9 +2243,9 @@ msgid "" "The new *filter* option replaces the older, less flexible *exclude* " "parameter which is now deprecated. If specified, the optional *filter* " "parameter needs to be a :term:`keyword argument`. The user-supplied filter " -"function accepts a :class:`~tarfile.TarInfo` object and returns an updated :" -"class:`~tarfile.TarInfo` object, or if it wants the file to be excluded, the " -"function can return ``None``::" +"function accepts a :class:`~tarfile.TarInfo` object and returns an " +"updated :class:`~tarfile.TarInfo` object, or if it wants the file to be " +"excluded, the function can return ``None``::" msgstr "" #: ../../whatsnew/3.2.rst:1454 @@ -2309,11 +2321,12 @@ msgstr "ast" #: ../../whatsnew/3.2.rst:1496 msgid "" "The :mod:`ast` module has a wonderful a general-purpose tool for safely " -"evaluating expression strings using the Python literal syntax. The :func:" -"`ast.literal_eval` function serves as a secure alternative to the builtin :" -"func:`eval` function which is easily abused. Python 3.2 adds :class:`bytes` " -"and :class:`set` literals to the list of supported types: strings, bytes, " -"numbers, tuples, lists, dicts, sets, booleans, and ``None``." +"evaluating expression strings using the Python literal syntax. " +"The :func:`ast.literal_eval` function serves as a secure alternative to the " +"builtin :func:`eval` function which is easily abused. Python 3.2 " +"adds :class:`bytes` and :class:`set` literals to the list of supported " +"types: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and " +"``None``." msgstr "" #: ../../whatsnew/3.2.rst:1505 @@ -2353,9 +2366,9 @@ msgstr "os" #: ../../whatsnew/3.2.rst:1522 msgid "" "Different operating systems use various encodings for filenames and " -"environment variables. The :mod:`os` module provides two new functions, :" -"func:`~os.fsencode` and :func:`~os.fsdecode`, for encoding and decoding " -"filenames:" +"environment variables. The :mod:`os` module provides two new " +"functions, :func:`~os.fsencode` and :func:`~os.fsdecode`, for encoding and " +"decoding filenames:" msgstr "" #: ../../whatsnew/3.2.rst:1532 @@ -2393,8 +2406,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:1551 msgid "" -"*copy_function*: is a callable that will be used to copy files. :func:" -"`shutil.copy2` is used by default." +"*copy_function*: is a callable that will be used to copy " +"files. :func:`shutil.copy2` is used by default." msgstr "" #: ../../whatsnew/3.2.rst:1554 ../../whatsnew/3.2.rst:1592 @@ -2412,11 +2425,11 @@ msgstr "" #: ../../whatsnew/3.2.rst:1561 msgid "" -"The principal functions are :func:`~shutil.make_archive` and :func:`~shutil." -"unpack_archive`. By default, both operate on the current directory (which " -"can be set by :func:`os.chdir`) and on any sub-directories. The archive " -"filename needs to be specified with a full pathname. The archiving step is " -"non-destructive (the original files are left unchanged)." +"The principal functions are :func:`~shutil.make_archive` " +"and :func:`~shutil.unpack_archive`. By default, both operate on the current " +"directory (which can be set by :func:`os.chdir`) and on any sub-directories. " +"The archive filename needs to be specified with a full pathname. The " +"archiving step is non-destructive (the original files are left unchanged)." msgstr "" #: ../../whatsnew/3.2.rst:1569 @@ -2463,10 +2476,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:1602 msgid "" -"The :meth:`sqlite3.Connection.enable_load_extension` and :meth:`sqlite3." -"Connection.load_extension` methods allows you to load SQLite extensions from " -"\".so\" files. One well-known extension is the fulltext-search extension " -"distributed with SQLite." +"The :meth:`sqlite3.Connection.enable_load_extension` " +"and :meth:`sqlite3.Connection.load_extension` methods allows you to load " +"SQLite extensions from \".so\" files. One well-known extension is the " +"fulltext-search extension distributed with SQLite." msgstr "" #: ../../whatsnew/3.2.rst:1607 @@ -2479,9 +2492,9 @@ msgstr "html" #: ../../whatsnew/3.2.rst:1612 msgid "" -"A new :mod:`html` module was introduced with only a single function, :func:" -"`~html.escape`, which is used for escaping reserved characters from HTML " -"markup:" +"A new :mod:`html` module was introduced with only a single " +"function, :func:`~html.escape`, which is used for escaping reserved " +"characters from HTML markup:" msgstr "" #: ../../whatsnew/3.2.rst:1621 @@ -2552,8 +2565,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:1661 msgid "" -"Various options have been added to the :mod:`ssl` module, such as :data:" -"`~ssl.OP_NO_SSLv2` which disables the insecure and obsolete SSLv2 protocol." +"Various options have been added to the :mod:`ssl` module, such " +"as :data:`~ssl.OP_NO_SSLv2` which disables the insecure and obsolete SSLv2 " +"protocol." msgstr "" #: ../../whatsnew/3.2.rst:1665 @@ -2566,18 +2580,20 @@ msgstr "" #: ../../whatsnew/3.2.rst:1669 msgid "" "The version of OpenSSL being used is now accessible using the module " -"attributes :const:`ssl.OPENSSL_VERSION` (a string), :const:`ssl." -"OPENSSL_VERSION_INFO` (a 5-tuple), and :const:`ssl.OPENSSL_VERSION_NUMBER` " -"(an integer)." +"attributes :const:`ssl.OPENSSL_VERSION` (a " +"string), :const:`ssl.OPENSSL_VERSION_INFO` (a 5-tuple), " +"and :const:`ssl.OPENSSL_VERSION_NUMBER` (an integer)." msgstr "" #: ../../whatsnew/3.2.rst:1674 msgid "" -"(Contributed by Antoine Pitrou in :issue:`8850`, :issue:`1589`, :issue:" -"`8322`, :issue:`5639`, :issue:`4870`, :issue:`8484`, and :issue:`8321`.)" +"(Contributed by Antoine Pitrou " +"in :issue:`8850`, :issue:`1589`, :issue:`8322`, :issue:`5639`, :issue:`4870`, :issue:`8484`, " +"and :issue:`8321`.)" msgstr "" -"(由 Antoine Pitrou 在 :issue:`8850`、:issue:`1589`、:issue:`8322`、:issue:" -"`5639`、:issue:`4870`、:issue:`8484` 和 :issue:`8321` 中貢獻。)" +"(由 Antoine Pitrou " +"在 :issue:`8850`、:issue:`1589`、:issue:`8322`、:issue:`5639`、:issue:`4870`、:issue:`8484` " +"和 :issue:`8321` 中貢獻。)" #: ../../whatsnew/3.2.rst:1678 msgid "nntp" @@ -2593,15 +2609,15 @@ msgstr "" #: ../../whatsnew/3.2.rst:1685 msgid "" -"Support for secure connections through both implicit (using :class:`!nntplib." -"NNTP_SSL`) and explicit (using :meth:`!nntplib.NNTP.starttls`) TLS has also " -"been added." +"Support for secure connections through both implicit (using :class:`!" +"nntplib.NNTP_SSL`) and explicit (using :meth:`!nntplib.NNTP.starttls`) TLS " +"has also been added." msgstr "" #: ../../whatsnew/3.2.rst:1689 msgid "" -"(Contributed by Antoine Pitrou in :issue:`9360` and Andrew Vant in :issue:" -"`1926`.)" +"(Contributed by Antoine Pitrou in :issue:`9360` and Andrew Vant " +"in :issue:`1926`.)" msgstr "" "(由 Antoine Pitrou 在 :issue:`9360` 中和 Andrew Vant 在 :issue:`1926` 中貢" "獻。)" @@ -2649,15 +2665,16 @@ msgstr "" #: ../../whatsnew/3.2.rst:1716 msgid "" -"The :class:`~http.client.HTTPConnection` and :class:`~http.client." -"HTTPSConnection` classes now have a *source_address* parameter for a (host, " -"port) tuple indicating where the HTTP connection is made from." +"The :class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` classes now have a " +"*source_address* parameter for a (host, port) tuple indicating where the " +"HTTP connection is made from." msgstr "" #: ../../whatsnew/3.2.rst:1721 msgid "" -"Support for certificate checking and HTTPS virtual hosts were added to :" -"class:`~http.client.HTTPSConnection`." +"Support for certificate checking and HTTPS virtual hosts were added " +"to :class:`~http.client.HTTPSConnection`." msgstr "" #: ../../whatsnew/3.2.rst:1724 @@ -2672,9 +2689,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:1731 msgid "" -"To establish an HTTPS connection through a proxy server, there is a new :" -"meth:`~http.client.HTTPConnection.set_tunnel` method that sets the host and " -"port for HTTP Connect tunneling." +"To establish an HTTPS connection through a proxy server, there is a " +"new :meth:`~http.client.HTTPConnection.set_tunnel` method that sets the host " +"and port for HTTP Connect tunneling." msgstr "" #: ../../whatsnew/3.2.rst:1735 @@ -2682,8 +2699,8 @@ msgid "" "To match the behavior of :mod:`http.server`, the HTTP client library now " "also encodes headers with ISO-8859-1 (Latin-1) encoding. It was already " "doing that for incoming headers, so now the behavior is consistent for both " -"incoming and outgoing traffic. (See work by Armin Ronacher in :issue:" -"`10980`.)" +"incoming and outgoing traffic. (See work by Armin Ronacher " +"in :issue:`10980`.)" msgstr "" #: ../../whatsnew/3.2.rst:1741 @@ -2719,15 +2736,17 @@ msgstr "(由 Michael Foord 貢獻。)" #: ../../whatsnew/3.2.rst:1761 msgid "" -"Experimentation at the interactive prompt is now easier because the :class:" -"`unittest.TestCase` class can now be instantiated without arguments:" +"Experimentation at the interactive prompt is now easier because " +"the :class:`unittest.TestCase` class can now be instantiated without " +"arguments:" msgstr "" #: ../../whatsnew/3.2.rst:1770 msgid "" -"The :mod:`unittest` module has two new methods, :meth:`~unittest.TestCase." -"assertWarns` and :meth:`~unittest.TestCase.assertWarnsRegex` to verify that " -"a given warning type is triggered by the code under test::" +"The :mod:`unittest` module has two new " +"methods, :meth:`~unittest.TestCase.assertWarns` " +"and :meth:`~unittest.TestCase.assertWarnsRegex` to verify that a given " +"warning type is triggered by the code under test::" msgstr "" #: ../../whatsnew/3.2.rst:1775 @@ -2776,12 +2795,13 @@ msgstr "" #: ../../whatsnew/3.2.rst:1799 msgid "" -"For example, :meth:`~unittest.TestCase.assertRegex` is the new name for :" -"meth:`!assertRegexpMatches` which was misnamed because the test uses :func:" -"`re.search`, not :func:`re.match`. Other methods using regular expressions " -"are now named using short form \"Regex\" in preference to \"Regexp\" -- this " -"matches the names used in other unittest implementations, matches Python's " -"old name for the :mod:`re` module, and it has unambiguous camel-casing." +"For example, :meth:`~unittest.TestCase.assertRegex` is the new name " +"for :meth:`!assertRegexpMatches` which was misnamed because the test " +"uses :func:`re.search`, not :func:`re.match`. Other methods using regular " +"expressions are now named using short form \"Regex\" in preference to " +"\"Regexp\" -- this matches the names used in other unittest implementations, " +"matches Python's old name for the :mod:`re` module, and it has unambiguous " +"camel-casing." msgstr "" #: ../../whatsnew/3.2.rst:1807 @@ -2856,8 +2876,8 @@ msgstr "(由 Ezio Melotti 貢獻;:issue:`9424`。)" msgid "" "The :meth:`!assertDictContainsSubset` method was deprecated because it was " "misimplemented with the arguments in the wrong order. This created hard-to-" -"debug optical illusions where tests like ``TestCase()." -"assertDictContainsSubset({'a':1, 'b':2}, {'a':1})`` would fail." +"debug optical illusions where tests like " +"``TestCase().assertDictContainsSubset({'a':1, 'b':2}, {'a':1})`` would fail." msgstr "" #: ../../whatsnew/3.2.rst:1835 @@ -2871,9 +2891,9 @@ msgid "" "``int(n*random())`` which had a slight bias whenever *n* was not a power of " "two. Now, multiple selections are made from a range up to the next power of " "two and a selection is kept only when it falls within the range ``0 <= x < " -"n``. The functions and methods affected are :func:`~random.randrange`, :" -"func:`~random.randint`, :func:`~random.choice`, :func:`~random.shuffle` and :" -"func:`~random.sample`." +"n``. The functions and methods affected " +"are :func:`~random.randrange`, :func:`~random.randint`, :func:`~random.choice`, :func:`~random.shuffle` " +"and :func:`~random.sample`." msgstr "" #: ../../whatsnew/3.2.rst:1846 @@ -2919,9 +2939,9 @@ msgstr "tempfile" #: ../../whatsnew/3.2.rst:1873 msgid "" -"The :mod:`tempfile` module has a new context manager, :class:`~tempfile." -"TemporaryDirectory` which provides easy deterministic cleanup of temporary " -"directories::" +"The :mod:`tempfile` module has a new context " +"manager, :class:`~tempfile.TemporaryDirectory` which provides easy " +"deterministic cleanup of temporary directories::" msgstr "" #: ../../whatsnew/3.2.rst:1877 @@ -2942,9 +2962,9 @@ msgstr "inspect" #: ../../whatsnew/3.2.rst:1885 msgid "" -"The :mod:`inspect` module has a new function :func:`~inspect." -"getgeneratorstate` to easily identify the current state of a generator-" -"iterator::" +"The :mod:`inspect` module has a new " +"function :func:`~inspect.getgeneratorstate` to easily identify the current " +"state of a generator-iterator::" msgstr "" #: ../../whatsnew/3.2.rst:1889 @@ -2986,9 +3006,9 @@ msgstr "(由 Rodolfo Eckhardt 和 Nick Coghlan 於 :issue:`10220` 貢獻。) #: ../../whatsnew/3.2.rst:1906 msgid "" "To support lookups without the possibility of activating a dynamic " -"attribute, the :mod:`inspect` module has a new function, :func:`~inspect." -"getattr_static`. Unlike :func:`hasattr`, this is a true read-only search, " -"guaranteed not to change state while it is searching::" +"attribute, the :mod:`inspect` module has a new " +"function, :func:`~inspect.getattr_static`. Unlike :func:`hasattr`, this is a " +"true read-only search, guaranteed not to change state while it is searching::" msgstr "" #: ../../whatsnew/3.2.rst:1911 @@ -3044,10 +3064,11 @@ msgstr "dis" #: ../../whatsnew/3.2.rst:1942 msgid "" -"The :mod:`dis` module gained two new functions for inspecting code, :func:" -"`~dis.code_info` and :func:`~dis.show_code`. Both provide detailed code " -"object information for the supplied function, method, source code string or " -"code object. The former returns a string and the latter prints it::" +"The :mod:`dis` module gained two new functions for inspecting " +"code, :func:`~dis.code_info` and :func:`~dis.show_code`. Both provide " +"detailed code object information for the supplied function, method, source " +"code string or code object. The former returns a string and the latter " +"prints it::" msgstr "" #: ../../whatsnew/3.2.rst:1947 @@ -3392,8 +3413,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:2117 msgid "" -":file:`pdb.py` now has a ``-c`` option that executes commands as given in a :" -"file:`.pdbrc` script file." +":file:`pdb.py` now has a ``-c`` option that executes commands as given in " +"a :file:`.pdbrc` script file." msgstr "" #: ../../whatsnew/3.2.rst:2119 @@ -3440,12 +3461,12 @@ msgstr "configparser" #: ../../whatsnew/3.2.rst:2135 msgid "" "The :mod:`configparser` module was modified to improve usability and " -"predictability of the default parser and its supported INI syntax. The old :" -"class:`!ConfigParser` class was removed in favor of :class:`!" -"SafeConfigParser` which has in turn been renamed to :class:`~configparser." -"ConfigParser`. Support for inline comments is now turned off by default and " -"section or option duplicates are not allowed in a single configuration " -"source." +"predictability of the default parser and its supported INI syntax. The " +"old :class:`!ConfigParser` class was removed in favor of :class:`!" +"SafeConfigParser` which has in turn been renamed " +"to :class:`~configparser.ConfigParser`. Support for inline comments is now " +"turned off by default and section or option duplicates are not allowed in a " +"single configuration source." msgstr "" #: ../../whatsnew/3.2.rst:2142 @@ -3610,8 +3631,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:2223 msgid "" -"The :func:`~urllib.parse.urlparse` function now supports `IPv6 <https://en." -"wikipedia.org/wiki/IPv6>`_ addresses as described in :rfc:`2732`:" +"The :func:`~urllib.parse.urlparse` function now supports `IPv6 <https://" +"en.wikipedia.org/wiki/IPv6>`_ addresses as described in :rfc:`2732`:" msgstr "" #: ../../whatsnew/3.2.rst:2235 @@ -3642,8 +3663,8 @@ msgstr "" msgid "" "And, the :func:`~urllib.parse.urlencode` function is now much more flexible, " "accepting either a string or bytes type for the *query* argument. If it is " -"a string, then the *safe*, *encoding*, and *error* parameters are sent to :" -"func:`~urllib.parse.quote_plus` for encoding::" +"a string, then the *safe*, *encoding*, and *error* parameters are sent " +"to :func:`~urllib.parse.quote_plus` for encoding::" msgstr "" #: ../../whatsnew/3.2.rst:2250 @@ -3662,17 +3683,17 @@ msgstr "" #: ../../whatsnew/3.2.rst:2256 msgid "" -"As detailed in :ref:`parsing-ascii-encoded-bytes`, all the :mod:`urllib." -"parse` functions now accept ASCII-encoded byte strings as input, so long as " -"they are not mixed with regular strings. If ASCII-encoded byte strings are " -"given as parameters, the return types will also be an ASCII-encoded byte " -"strings:" +"As detailed in :ref:`parsing-ascii-encoded-bytes`, all " +"the :mod:`urllib.parse` functions now accept ASCII-encoded byte strings as " +"input, so long as they are not mixed with regular strings. If ASCII-encoded " +"byte strings are given as parameters, the return types will also be an ASCII-" +"encoded byte strings:" msgstr "" #: ../../whatsnew/3.2.rst:2265 msgid "" -"(Work by Nick Coghlan, Dan Mahn, and Senthil Kumaran in :issue:`2987`, :" -"issue:`5468`, and :issue:`9873`.)" +"(Work by Nick Coghlan, Dan Mahn, and Senthil Kumaran " +"in :issue:`2987`, :issue:`5468`, and :issue:`9873`.)" msgstr "" #: ../../whatsnew/3.2.rst:2269 @@ -3697,8 +3718,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:2280 msgid "" -"As expected, the :meth:`~mailbox.Mailbox.add` method for :class:`mailbox." -"Mailbox` objects now accepts binary input." +"As expected, the :meth:`~mailbox.Mailbox.add` method " +"for :class:`mailbox.Mailbox` objects now accepts binary input." msgstr "" #: ../../whatsnew/3.2.rst:2283 @@ -3710,19 +3731,19 @@ msgstr "" #: ../../whatsnew/3.2.rst:2287 msgid "" -"There is also support for binary output. The :meth:`~mailbox.Mailbox." -"get_file` method now returns a file in the binary mode (where it used to " -"incorrectly set the file to text-mode). There is also a new :meth:`~mailbox." -"Mailbox.get_bytes` method that returns a :class:`bytes` representation of a " -"message corresponding to a given *key*." +"There is also support for binary output. " +"The :meth:`~mailbox.Mailbox.get_file` method now returns a file in the " +"binary mode (where it used to incorrectly set the file to text-mode). There " +"is also a new :meth:`~mailbox.Mailbox.get_bytes` method that returns " +"a :class:`bytes` representation of a message corresponding to a given *key*." msgstr "" #: ../../whatsnew/3.2.rst:2293 msgid "" -"It is still possible to get non-binary output using the old API's :meth:" -"`~mailbox.Mailbox.get_string` method, but that approach is not very useful. " -"Instead, it is best to extract messages from a :class:`~mailbox.Message` " -"object or to load them from binary input." +"It is still possible to get non-binary output using the old " +"API's :meth:`~mailbox.Mailbox.get_string` method, but that approach is not " +"very useful. Instead, it is best to extract messages from " +"a :class:`~mailbox.Message` object or to load them from binary input." msgstr "" #: ../../whatsnew/3.2.rst:2298 @@ -3764,8 +3785,9 @@ msgid "" "intervals and reduced overhead due to lock contention and the number of " "ensuing system calls. The notion of a \"check interval\" to allow thread " "switches has been abandoned and replaced by an absolute duration expressed " -"in seconds. This parameter is tunable through :func:`sys." -"setswitchinterval`. It currently defaults to 5 milliseconds." +"in seconds. This parameter is tunable " +"through :func:`sys.setswitchinterval`. It currently defaults to 5 " +"milliseconds." msgstr "" #: ../../whatsnew/3.2.rst:2327 @@ -3850,13 +3872,13 @@ msgid "" "(Contributed by Alexandre Vassalotti, Antoine Pitrou and the Unladen Swallow " "team in :issue:`9410` and :issue:`3873`.)" msgstr "" -"(由 Alexandre Vassalotti、Antoine Pitrou 和 Unladen Swallow 團隊在 :issue:" -"`9410` 和 :issue:`3873` 中貢獻。)" +"(由 Alexandre Vassalotti、Antoine Pitrou 和 Unladen Swallow 團隊" +"在 :issue:`9410` 和 :issue:`3873` 中貢獻。)" #: ../../whatsnew/3.2.rst:2374 msgid "" -"The `Timsort algorithm <https://en.wikipedia.org/wiki/Timsort>`_ used in :" -"meth:`list.sort` and :func:`sorted` now runs faster and uses less memory " +"The `Timsort algorithm <https://en.wikipedia.org/wiki/Timsort>`_ used " +"in :meth:`list.sort` and :func:`sorted` now runs faster and uses less memory " "when called with a :term:`key function`. Previously, every element of a " "list was wrapped with a temporary object that remembered the key value " "associated with each element. Now, two arrays of keys and values are sorted " @@ -3896,11 +3918,12 @@ msgstr "(由 Antoine Pitrou 貢獻;:issue:`3001`。)" #: ../../whatsnew/3.2.rst:2397 msgid "" -"The fast-search algorithm in stringlib is now used by the :meth:`~str." -"split`, :meth:`~str.rsplit`, :meth:`~str.splitlines` and :meth:`~str." -"replace` methods on :class:`bytes`, :class:`bytearray` and :class:`str` " -"objects. Likewise, the algorithm is also used by :meth:`~str.rfind`, :meth:" -"`~str.rindex`, :meth:`~str.rsplit` and :meth:`~str.rpartition`." +"The fast-search algorithm in stringlib is now used by " +"the :meth:`~str.split`, :meth:`~str.rsplit`, :meth:`~str.splitlines` " +"and :meth:`~str.replace` methods on :class:`bytes`, :class:`bytearray` " +"and :class:`str` objects. Likewise, the algorithm is also used " +"by :meth:`~str.rfind`, :meth:`~str.rindex`, :meth:`~str.rsplit` " +"and :meth:`~str.rpartition`." msgstr "" #: ../../whatsnew/3.2.rst:2403 @@ -3922,12 +3945,12 @@ msgid "" "There were several other minor optimizations. Set differencing now runs " "faster when one operand is much larger than the other (patch by Andress " "Bennetts in :issue:`8685`). The :meth:`!array.repeat` method has a faster " -"implementation (:issue:`1569291` by Alexander Belopolsky). The :class:`~http." -"server.BaseHTTPRequestHandler` has more efficient buffering (:issue:`3709` " -"by Andrew Schaaf). The :func:`operator.attrgetter` function has been sped-" -"up (:issue:`10160` by Christos Georgiou). And :class:`~configparser." -"ConfigParser` loads multi-line arguments a bit faster (:issue:`7113` by " -"Łukasz Langa)." +"implementation (:issue:`1569291` by Alexander Belopolsky). " +"The :class:`~http.server.BaseHTTPRequestHandler` has more efficient " +"buffering (:issue:`3709` by Andrew Schaaf). The :func:`operator.attrgetter` " +"function has been sped-up (:issue:`10160` by Christos Georgiou). " +"And :class:`~configparser.ConfigParser` loads multi-line arguments a bit " +"faster (:issue:`7113` by Łukasz Langa)." msgstr "" #: ../../whatsnew/3.2.rst:2422 @@ -4023,15 +4046,16 @@ msgstr "" #: ../../whatsnew/3.2.rst:2477 msgid "" -"(Contributed by Raymond Hettinger; see `rationale <https://rhettinger." -"wordpress.com/2011/01/28/open-your-source-more/>`_.)" +"(Contributed by Raymond Hettinger; see `rationale <https://" +"rhettinger.wordpress.com/2011/01/28/open-your-source-more/>`_.)" msgstr "" #: ../../whatsnew/3.2.rst:2480 msgid "" "The docs now contain more examples and recipes. In particular, :mod:`re` " -"module has an extensive section, :ref:`re-examples`. Likewise, the :mod:" -"`itertools` module continues to be updated with new :ref:`itertools-recipes`." +"module has an extensive section, :ref:`re-examples`. Likewise, " +"the :mod:`itertools` module continues to be updated with new :ref:`itertools-" +"recipes`." msgstr "" #: ../../whatsnew/3.2.rst:2485 @@ -4086,17 +4110,17 @@ msgstr "" #: ../../whatsnew/3.2.rst:2513 msgid "" -"In addition to the existing Subversion code repository at https://svn.python." -"org there is now a `Mercurial <https://www.mercurial-scm.org/>`_ repository " -"at https://hg.python.org/\\ ." +"In addition to the existing Subversion code repository at https://" +"svn.python.org there is now a `Mercurial <https://www.mercurial-scm.org/>`_ " +"repository at https://hg.python.org/\\ ." msgstr "" #: ../../whatsnew/3.2.rst:2517 msgid "" "After the 3.2 release, there are plans to switch to Mercurial as the primary " "repository. This distributed version control system should make it easier " -"for members of the community to create and share external changesets. See :" -"pep:`385` for details." +"for members of the community to create and share external changesets. " +"See :pep:`385` for details." msgstr "" #: ../../whatsnew/3.2.rst:2522 @@ -4108,11 +4132,11 @@ msgstr "" #: ../../whatsnew/3.2.rst:2528 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.2.rst:2530 msgid "Changes to Python's build process and to the C API include:" -msgstr "" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/3.2.rst:2532 msgid "" @@ -4168,8 +4192,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:2562 msgid "" -"(Suggested by Raymond Hettinger and implemented by Benjamin Peterson; :issue:" -"`9778`.)" +"(Suggested by Raymond Hettinger and implemented by Benjamin " +"Peterson; :issue:`9778`.)" msgstr "" "(由 Raymond Hettinger 建議並由 Benjamin Peterson 實作;:issue:`9778`。)" @@ -4210,10 +4234,10 @@ msgstr "" #: ../../whatsnew/3.2.rst:2585 msgid "" -"There is a new function :c:func:`PyErr_NewExceptionWithDoc` that is like :c:" -"func:`PyErr_NewException` but allows a docstring to be specified. This lets " -"C exceptions have the same self-documenting capabilities as their pure " -"Python counterparts (:issue:`7033`)." +"There is a new function :c:func:`PyErr_NewExceptionWithDoc` that is " +"like :c:func:`PyErr_NewException` but allows a docstring to be specified. " +"This lets C exceptions have the same self-documenting capabilities as their " +"pure Python counterparts (:issue:`7033`)." msgstr "" #: ../../whatsnew/3.2.rst:2590 @@ -4245,8 +4269,8 @@ msgid "" "there is a known problem with the default Tcl/Tk on Mac OS X 10.6. " "Accordingly, we recommend installing an updated alternative such as " "`ActiveState Tcl/Tk 8.5.9 <https://web.archive.org/web/20101208191259/" -"https://www.activestate.com/activetcl/downloads%3E%60_//.%20See%20https://www.python." -"org/download/mac/tcltk/ for additional details." +"https://www.activestate.com/activetcl/downloads%3E%60_//.%20See%20https://" +"www.python.org/download/mac/tcltk/ for additional details." msgstr "" #: ../../whatsnew/3.2.rst:2611 @@ -4269,25 +4293,27 @@ msgstr "" #: ../../whatsnew/3.2.rst:2621 msgid "" -"The interpolation syntax is now validated on :meth:`~configparser." -"ConfigParser.get` and :meth:`~configparser.ConfigParser.set` operations. In " -"the default interpolation scheme, only two tokens with percent signs are " -"valid: ``%(name)s`` and ``%%``, the latter being an escaped percent sign." +"The interpolation syntax is now validated " +"on :meth:`~configparser.ConfigParser.get` " +"and :meth:`~configparser.ConfigParser.set` operations. In the default " +"interpolation scheme, only two tokens with percent signs are valid: ``%" +"(name)s`` and ``%%``, the latter being an escaped percent sign." msgstr "" #: ../../whatsnew/3.2.rst:2627 msgid "" -"The :meth:`~configparser.ConfigParser.set` and :meth:`~configparser." -"ConfigParser.add_section` methods now verify that values are actual " -"strings. Formerly, unsupported types could be introduced unintentionally." +"The :meth:`~configparser.ConfigParser.set` " +"and :meth:`~configparser.ConfigParser.add_section` methods now verify that " +"values are actual strings. Formerly, unsupported types could be introduced " +"unintentionally." msgstr "" #: ../../whatsnew/3.2.rst:2632 msgid "" -"Duplicate sections or options from a single source now raise either :exc:" -"`~configparser.DuplicateSectionError` or :exc:`~configparser." -"DuplicateOptionError`. Formerly, duplicates would silently overwrite a " -"previous entry." +"Duplicate sections or options from a single source now raise " +"either :exc:`~configparser.DuplicateSectionError` " +"or :exc:`~configparser.DuplicateOptionError`. Formerly, duplicates would " +"silently overwrite a previous entry." msgstr "" #: ../../whatsnew/3.2.rst:2637 @@ -4324,9 +4350,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:2653 msgid "" "The :meth:`!array.tostring` and :meth:`!array.fromstring` have been renamed " -"to :meth:`array.tobytes() <array.array.tobytes>` and :meth:`array." -"frombytes() <array.array.frombytes>` for clarity. The old names have been " -"deprecated. (See :issue:`8990`.)" +"to :meth:`array.tobytes() <array.array.tobytes>` " +"and :meth:`array.frombytes() <array.array.frombytes>` for clarity. The old " +"names have been deprecated. (See :issue:`8990`.)" msgstr "" #: ../../whatsnew/3.2.rst:2658 @@ -4359,19 +4385,19 @@ msgstr "" msgid "" "The :func:`random.seed` function and method now salt string seeds with an " "sha512 hash function. To access the previous version of *seed* in order to " -"reproduce Python 3.1 sequences, set the *version* argument to *1*, ``random." -"seed(s, version=1)``." +"reproduce Python 3.1 sequences, set the *version* argument to *1*, " +"``random.seed(s, version=1)``." msgstr "" #: ../../whatsnew/3.2.rst:2676 msgid "" "The previously deprecated :func:`!string.maketrans` function has been " -"removed in favor of the static methods :meth:`bytes.maketrans` and :meth:" -"`bytearray.maketrans`. This change solves the confusion around which types " -"were supported by the :mod:`string` module. Now, :class:`str`, :class:" -"`bytes`, and :class:`bytearray` each have their own **maketrans** and " -"**translate** methods with intermediate translation tables of the " -"appropriate type." +"removed in favor of the static methods :meth:`bytes.maketrans` " +"and :meth:`bytearray.maketrans`. This change solves the confusion around " +"which types were supported by the :mod:`string` module. " +"Now, :class:`str`, :class:`bytes`, and :class:`bytearray` each have their " +"own **maketrans** and **translate** methods with intermediate translation " +"tables of the appropriate type." msgstr "" #: ../../whatsnew/3.2.rst:2684 @@ -4430,9 +4456,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:2711 msgid "" -"The :class:`xml.etree.ElementTree` class now raises an :exc:`xml.etree." -"ElementTree.ParseError` when a parse fails. Previously it raised an :exc:" -"`xml.parsers.expat.ExpatError`." +"The :class:`xml.etree.ElementTree` class now raises " +"an :exc:`xml.etree.ElementTree.ParseError` when a parse fails. Previously it " +"raised an :exc:`xml.parsers.expat.ExpatError`." msgstr "" #: ../../whatsnew/3.2.rst:2715 @@ -4452,9 +4478,9 @@ msgstr "" #: ../../whatsnew/3.2.rst:2725 msgid "" -"Support for legacy HTTP 0.9 has been removed from :mod:`urllib.request` and :" -"mod:`http.client`. Such support is still present on the server side (in :" -"mod:`http.server`)." +"Support for legacy HTTP 0.9 has been removed from :mod:`urllib.request` " +"and :mod:`http.client`. Such support is still present on the server side " +"(in :mod:`http.server`)." msgstr "" #: ../../whatsnew/3.2.rst:2729 @@ -4475,8 +4501,8 @@ msgstr "(由 Antoine Pitrou 於 :issue:`10272` 貢獻。)" msgid "" "The misleading functions :c:func:`!PyEval_AcquireLock` and :c:func:`!" "PyEval_ReleaseLock` have been officially deprecated. The thread-state aware " -"APIs (such as :c:func:`PyEval_SaveThread` and :c:func:" -"`PyEval_RestoreThread`) should be used instead." +"APIs (such as :c:func:`PyEval_SaveThread` " +"and :c:func:`PyEval_RestoreThread`) should be used instead." msgstr "" #: ../../whatsnew/3.2.rst:2741 diff --git a/whatsnew/3.3.po b/whatsnew/3.3.po index 0c9d3e31f7..88a9f991f4 100644 --- a/whatsnew/3.3.po +++ b/whatsnew/3.3.po @@ -108,7 +108,7 @@ msgstr "" #: ../../whatsnew/3.3.rst:84 msgid "Significantly Improved Library Modules:" -msgstr "" +msgstr "顯著改進的函式庫模組:" #: ../../whatsnew/3.3.rst:86 msgid "C Accelerator for the :ref:`decimal <new-decimal>` module." @@ -116,8 +116,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:87 msgid "" -"Better unicode handling in the :ref:`email <new-email>` module (:term:" -"`provisional <provisional package>`)." +"Better unicode handling in the :ref:`email <new-email>` module " +"(:term:`provisional <provisional package>`)." msgstr "" #: ../../whatsnew/3.3.rst:90 @@ -171,8 +171,8 @@ msgstr "" msgid "" "Native support for package directories that don't require ``__init__.py`` " "marker files and can automatically span multiple path segments (inspired by " -"various third party approaches to namespace packages, as described in :pep:" -"`420`)" +"various third party approaches to namespace packages, as described " +"in :pep:`420`)" msgstr "" #: ../../whatsnew/3.3.rst:132 @@ -498,18 +498,20 @@ msgstr "" #: ../../whatsnew/3.3.rst:332 msgid "" "You don't have to worry anymore about choosing the appropriate exception " -"type between :exc:`OSError`, :exc:`IOError`, :exc:`EnvironmentError`, :exc:" -"`WindowsError`, :exc:`mmap.error`, :exc:`socket.error` or :exc:`select." -"error`. All these exception types are now only one: :exc:`OSError`. The " -"other names are kept as aliases for compatibility reasons." +"type " +"between :exc:`OSError`, :exc:`IOError`, :exc:`EnvironmentError`, :exc:`WindowsError`, :exc:`mmap.error`, :exc:`socket.error` " +"or :exc:`select.error`. All these exception types are now only " +"one: :exc:`OSError`. The other names are kept as aliases for compatibility " +"reasons." msgstr "" #: ../../whatsnew/3.3.rst:339 msgid "" "Also, it is now easier to catch a specific error condition. Instead of " "inspecting the ``errno`` attribute (or ``args[0]``) for a particular " -"constant from the :mod:`errno` module, you can catch the adequate :exc:" -"`OSError` subclass. The available subclasses are the following:" +"constant from the :mod:`errno` module, you can catch the " +"adequate :exc:`OSError` subclass. The available subclasses are the " +"following:" msgstr "" #: ../../whatsnew/3.3.rst:344 @@ -877,10 +879,10 @@ msgstr "" msgid "" "Functions and class objects have a new :attr:`~definition.__qualname__` " "attribute representing the \"path\" from the module top-level to their " -"definition. For global functions and classes, this is the same as :attr:" -"`~definition.__name__`. For other functions and classes, it provides better " -"information about where they were actually defined, and how they might be " -"accessible from the global scope." +"definition. For global functions and classes, this is the same " +"as :attr:`~definition.__name__`. For other functions and classes, it " +"provides better information about where they were actually defined, and how " +"they might be accessible from the global scope." msgstr "" #: ../../whatsnew/3.3.rst:560 @@ -1021,10 +1023,11 @@ msgstr "PEP 362:函式簽名物件" msgid "" "A new function :func:`inspect.signature` makes introspection of python " "callables easy and straightforward. A broad range of callables is " -"supported: python functions, decorated or not, classes, and :func:`functools." -"partial` objects. New classes :class:`inspect.Signature`, :class:`inspect." -"Parameter` and :class:`inspect.BoundArguments` hold information about the " -"call signatures, such as, annotations, default values, parameters kinds, and " +"supported: python functions, decorated or not, classes, " +"and :func:`functools.partial` objects. New " +"classes :class:`inspect.Signature`, :class:`inspect.Parameter` " +"and :class:`inspect.BoundArguments` hold information about the call " +"signatures, such as, annotations, default values, parameters kinds, and " "bound arguments, which considerably simplifies writing decorators and any " "code that validates or amends calling signatures or arguments." msgstr "" @@ -1080,10 +1083,10 @@ msgstr "SimpleNamespace" msgid "" "The implementation of ``sys.implementation`` also introduces a new type to " "Python: :class:`types.SimpleNamespace`. In contrast to a mapping-based " -"namespace, like :class:`dict`, ``SimpleNamespace`` is attribute-based, like :" -"class:`object`. However, unlike ``object``, ``SimpleNamespace`` instances " -"are writable. This means that you can add, remove, and modify the namespace " -"through normal attribute access." +"namespace, like :class:`dict`, ``SimpleNamespace`` is attribute-based, " +"like :class:`object`. However, unlike ``object``, ``SimpleNamespace`` " +"instances are writable. This means that you can add, remove, and modify the " +"namespace through normal attribute access." msgstr "" #: ../../whatsnew/3.3.rst:681 @@ -1108,14 +1111,15 @@ msgstr "" #: ../../whatsnew/3.3.rst:694 msgid "" -"The :func:`__import__` function is now powered by :func:`importlib." -"__import__`. This work leads to the completion of \"phase 2\" of :pep:`302`. " -"There are multiple benefits to this change. First, it has allowed for more " -"of the machinery powering import to be exposed instead of being implicit and " -"hidden within the C code. It also provides a single implementation for all " -"Python VMs supporting Python 3.3 to use, helping to end any VM-specific " -"deviations in import semantics. And finally it eases the maintenance of " -"import, allowing for future growth to occur." +"The :func:`__import__` function is now powered " +"by :func:`importlib.__import__`. This work leads to the completion of " +"\"phase 2\" of :pep:`302`. There are multiple benefits to this change. " +"First, it has allowed for more of the machinery powering import to be " +"exposed instead of being implicit and hidden within the C code. It also " +"provides a single implementation for all Python VMs supporting Python 3.3 to " +"use, helping to end any VM-specific deviations in import semantics. And " +"finally it eases the maintenance of import, allowing for future growth to " +"occur." msgstr "" #: ../../whatsnew/3.3.rst:703 @@ -1141,11 +1145,11 @@ msgstr "" msgid "" "The abstract base classes defined in :mod:`importlib.abc` have been expanded " "to properly delineate between :term:`meta path finders <meta path finder>` " -"and :term:`path entry finders <path entry finder>` by introducing :class:" -"`importlib.abc.MetaPathFinder` and :class:`importlib.abc.PathEntryFinder`, " -"respectively. The old ABC of :class:`!importlib.abc.Finder` is now only " -"provided for backwards-compatibility and does not enforce any method " -"requirements." +"and :term:`path entry finders <path entry finder>` by " +"introducing :class:`importlib.abc.MetaPathFinder` " +"and :class:`importlib.abc.PathEntryFinder`, respectively. The old ABC " +"of :class:`!importlib.abc.Finder` is now only provided for backwards-" +"compatibility and does not enforce any method requirements." msgstr "" #: ../../whatsnew/3.3.rst:722 @@ -1159,10 +1163,11 @@ msgstr "" msgid "" "For loaders, the new abstract base class :class:`importlib.abc.FileLoader` " "helps write a loader that uses the file system as the storage mechanism for " -"a module's code. The loader for source files (:class:`importlib.machinery." -"SourceFileLoader`), sourceless bytecode files (:class:`importlib.machinery." -"SourcelessFileLoader`), and extension modules (:class:`importlib.machinery." -"ExtensionFileLoader`) are now available for direct use." +"a module's code. The loader for source files " +"(:class:`importlib.machinery.SourceFileLoader`), sourceless bytecode files " +"(:class:`importlib.machinery.SourcelessFileLoader`), and extension modules " +"(:class:`importlib.machinery.ExtensionFileLoader`) are now available for " +"direct use." msgstr "" #: ../../whatsnew/3.3.rst:734 @@ -1193,9 +1198,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:749 msgid "" "Beyond the expanse of what :mod:`importlib` now exposes, there are other " -"visible changes to import. The biggest is that :data:`sys.meta_path` and :" -"data:`sys.path_hooks` now store all of the meta path finders and path entry " -"hooks used by import. Previously the finders were implicit and hidden " +"visible changes to import. The biggest is that :data:`sys.meta_path` " +"and :data:`sys.path_hooks` now store all of the meta path finders and path " +"entry hooks used by import. Previously the finders were implicit and hidden " "within the C code of import instead of being directly exposed. This means " "that one can now easily remove or change the order of the various finders to " "fit one's needs." @@ -1213,9 +1218,10 @@ msgstr "" #: ../../whatsnew/3.3.rst:762 msgid "" -"Loaders are also now expected to set the ``__package__`` attribute from :pep:" -"`366`. Once again, import itself is already setting this on all loaders " -"from :mod:`importlib` and import itself is setting the attribute post-load." +"Loaders are also now expected to set the ``__package__`` attribute " +"from :pep:`366`. Once again, import itself is already setting this on all " +"loaders from :mod:`importlib` and import itself is setting the attribute " +"post-load." msgstr "" #: ../../whatsnew/3.3.rst:766 @@ -1247,9 +1253,9 @@ msgstr "對核心 Python 語言所做的一些較小的更改包括:" #: ../../whatsnew/3.3.rst:783 msgid "" -"Added support for Unicode name aliases and named sequences. Both :func:" -"`unicodedata.lookup` and ``'\\N{...}'`` now resolve name aliases, and :func:" -"`unicodedata.lookup` resolves named sequences too." +"Added support for Unicode name aliases and named sequences. " +"Both :func:`unicodedata.lookup` and ``'\\N{...}'`` now resolve name aliases, " +"and :func:`unicodedata.lookup` resolves named sequences too." msgstr "" #: ../../whatsnew/3.3.rst:787 @@ -1263,8 +1269,8 @@ msgstr "Unicode 資料庫更新至 UCD 版本 6.1.0" #: ../../whatsnew/3.3.rst:791 msgid "" "Equality comparisons on :func:`range` objects now return a result reflecting " -"the equality of the underlying sequences generated by those range objects. (:" -"issue:`13201`)" +"the equality of the underlying sequences generated by those range objects. " +"(:issue:`13201`)" msgstr "" #: ../../whatsnew/3.3.rst:795 @@ -1288,9 +1294,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:805 msgid "" "New methods have been added to :class:`list` and :class:`bytearray`: " -"``copy()`` and ``clear()`` (:issue:`10516`). Consequently, :class:" -"`~collections.abc.MutableSequence` now also defines a :meth:`~collections." -"abc.MutableSequence.clear` method (:issue:`11388`)." +"``copy()`` and ``clear()`` (:issue:`10516`). " +"Consequently, :class:`~collections.abc.MutableSequence` now also defines " +"a :meth:`~collections.abc.MutableSequence.clear` method (:issue:`11388`)." msgstr "" #: ../../whatsnew/3.3.rst:810 @@ -1331,8 +1337,8 @@ msgid "" "Previous versions of CPython have always relied on a global import lock. " "This led to unexpected annoyances, such as deadlocks when importing a module " "would trigger code execution in a different thread as a side-effect. Clumsy " -"workarounds were sometimes employed, such as the :c:func:" -"`PyImport_ImportModuleNoBlock` C API function." +"workarounds were sometimes employed, such as " +"the :c:func:`PyImport_ImportModuleNoBlock` C API function." msgstr "" #: ../../whatsnew/3.3.rst:834 @@ -1368,8 +1374,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:852 msgid "" -":func:`hash`: hash randomization is enabled by default, see :meth:`object." -"__hash__` and :envvar:`PYTHONHASHSEED`." +":func:`hash`: hash randomization is enabled by default, " +"see :meth:`object.__hash__` and :envvar:`PYTHONHASHSEED`." msgstr "" #: ../../whatsnew/3.3.rst:854 @@ -1383,8 +1389,8 @@ msgstr "" msgid "" "The sequence documentation has been substantially rewritten to better " "explain the binary/text sequence distinction and to provide specific " -"documentation sections for the individual builtin sequence types (:issue:" -"`4966`)." +"documentation sections for the individual builtin sequence types " +"(:issue:`4966`)." msgstr "" #: ../../whatsnew/3.3.rst:864 @@ -1400,10 +1406,11 @@ msgid "" "This new debug module :mod:`faulthandler` contains functions to dump Python " "tracebacks explicitly, on a fault (a crash like a segmentation fault), after " "a timeout, or on a user signal. Call :func:`faulthandler.enable` to install " -"fault handlers for the :const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :" -"const:`SIGBUS`, and :const:`SIGILL` signals. You can also enable them at " -"startup by setting the :envvar:`PYTHONFAULTHANDLER` environment variable or " -"by using :option:`-X` ``faulthandler`` command line option." +"fault handlers for " +"the :const:`SIGSEGV`, :const:`SIGFPE`, :const:`SIGABRT`, :const:`SIGBUS`, " +"and :const:`SIGILL` signals. You can also enable them at startup by setting " +"the :envvar:`PYTHONFAULTHANDLER` environment variable or by using :option:`-" +"X` ``faulthandler`` command line option." msgstr "" #: ../../whatsnew/3.3.rst:877 @@ -1485,24 +1492,24 @@ msgid "" ":class:`abc.abstractproperty` has been deprecated, use :class:`property` " "with :func:`abc.abstractmethod` instead." msgstr "" -":class:`abc.abstractproperty` 已被棄用,請改 :class:`property` 和 :func:`abc." -"abstractmethod`。" +":class:`abc.abstractproperty` 已被棄用,請改 :class:`property` " +"和 :func:`abc.abstractmethod`。" #: ../../whatsnew/3.3.rst:924 ../../whatsnew/3.3.rst:2250 msgid "" -":class:`abc.abstractclassmethod` has been deprecated, use :class:" -"`classmethod` with :func:`abc.abstractmethod` instead." +":class:`abc.abstractclassmethod` has been deprecated, " +"use :class:`classmethod` with :func:`abc.abstractmethod` instead." msgstr "" -":class:`abc.abstractclassmethod` 已被棄用,請改用 :class:`classmethod` 和 :" -"func:`abc.abstractmethod`。" +":class:`abc.abstractclassmethod` 已被棄用,請改用 :class:`classmethod` " +"和 :func:`abc.abstractmethod`。" #: ../../whatsnew/3.3.rst:926 ../../whatsnew/3.3.rst:2252 msgid "" -":class:`abc.abstractstaticmethod` has been deprecated, use :class:" -"`staticmethod` with :func:`abc.abstractmethod` instead." +":class:`abc.abstractstaticmethod` has been deprecated, " +"use :class:`staticmethod` with :func:`abc.abstractmethod` instead." msgstr "" -":class:`abc.abstractstaticmethod` 已被棄用,請改用 :class:`staticmethod` 和 :" -"func:`abc.abstractmethod`。" +":class:`abc.abstractstaticmethod` 已被棄用,請改用 :class:`staticmethod` " +"和 :func:`abc.abstractmethod`。" #: ../../whatsnew/3.3.rst:929 msgid "(Contributed by Darren Dale in :issue:`11610`.)" @@ -1535,9 +1542,9 @@ msgstr "base64" #: ../../whatsnew/3.3.rst:947 msgid "" "ASCII-only Unicode strings are now accepted by the decoding functions of " -"the :mod:`base64` modern interface. For example, ``base64." -"b64decode('YWJj')`` returns ``b'abc'``. (Contributed by Catalin Iacob in :" -"issue:`13641`.)" +"the :mod:`base64` modern interface. For example, " +"``base64.b64decode('YWJj')`` returns ``b'abc'``. (Contributed by Catalin " +"Iacob in :issue:`13641`.)" msgstr "" #: ../../whatsnew/3.3.rst:953 @@ -1580,9 +1587,9 @@ msgstr "(由 Nadeem Vawda 在 :issue:`5863` 中貢獻。)" #: ../../whatsnew/3.3.rst:974 msgid "" ":class:`bz2.BZ2File` and :func:`bz2.decompress` can now decompress multi-" -"stream inputs (such as those produced by the :program:`pbzip2` tool). :class:" -"`bz2.BZ2File` can now also be used to create this type of file, using the " -"``'a'`` (append) mode." +"stream inputs (such as those produced by the :program:`pbzip2` " +"tool). :class:`bz2.BZ2File` can now also be used to create this type of " +"file, using the ``'a'`` (append) mode." msgstr "" #: ../../whatsnew/3.3.rst:979 @@ -1602,9 +1609,9 @@ msgstr "codecs" #: ../../whatsnew/3.3.rst:988 msgid "" "The :mod:`~encodings.mbcs` codec has been rewritten to handle correctly " -"``replace`` and ``ignore`` error handlers on all Windows versions. The :mod:" -"`~encodings.mbcs` codec now supports all error handlers, instead of only " -"``replace`` to encode and ``ignore`` to decode." +"``replace`` and ``ignore`` error handlers on all Windows versions. " +"The :mod:`~encodings.mbcs` codec now supports all error handlers, instead of " +"only ``replace`` to encode and ``ignore`` to decode." msgstr "" #: ../../whatsnew/3.3.rst:993 @@ -1618,9 +1625,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:998 msgid "" "Multibyte CJK decoders now resynchronize faster. They only ignore the first " -"byte of an invalid byte sequence. For example, ``b'\\xff\\n'." -"decode('gb2312', 'replace')`` now returns a ``\\n`` after the replacement " -"character." +"byte of an invalid byte sequence. For example, " +"``b'\\xff\\n'.decode('gb2312', 'replace')`` now returns a ``\\n`` after the " +"replacement character." msgstr "" #: ../../whatsnew/3.3.rst:1002 @@ -1668,16 +1675,16 @@ msgstr "collections" #: ../../whatsnew/3.3.rst:1023 msgid "" "Addition of a new :class:`~collections.ChainMap` class to allow treating a " -"number of mappings as a single unit. (Written by Raymond Hettinger for :" -"issue:`11089`, made public in :issue:`11297`.)" +"number of mappings as a single unit. (Written by Raymond Hettinger " +"for :issue:`11089`, made public in :issue:`11297`.)" msgstr "" #: ../../whatsnew/3.3.rst:1027 msgid "" "The abstract base classes have been moved in a new :mod:`collections.abc` " "module, to better differentiate between the abstract and the concrete " -"collections classes. Aliases for ABCs are still present in the :mod:" -"`collections` module to preserve existing imports. (:issue:`11085`)" +"collections classes. Aliases for ABCs are still present in " +"the :mod:`collections` module to preserve existing imports. (:issue:`11085`)" msgstr "" #: ../../whatsnew/3.3.rst:1034 @@ -1728,8 +1735,9 @@ msgstr "curses" #: ../../whatsnew/3.3.rst:1065 msgid "" "If the :mod:`curses` module is linked to the ncursesw library, use Unicode " -"functions when Unicode strings or characters are passed (e.g. :c:func:" -"`waddwstr`), and bytes functions otherwise (e.g. :c:func:`waddstr`)." +"functions when Unicode strings or characters are passed " +"(e.g. :c:func:`waddwstr`), and bytes functions otherwise " +"(e.g. :c:func:`waddstr`)." msgstr "" #: ../../whatsnew/3.3.rst:1068 @@ -1768,8 +1776,8 @@ msgstr "datetime" #: ../../whatsnew/3.3.rst:1081 msgid "" "Equality comparisons between naive and aware :class:`~datetime.datetime` " -"instances now return :const:`False` instead of raising :exc:`TypeError` (:" -"issue:`15006`)." +"instances now return :const:`False` instead of raising :exc:`TypeError` " +"(:issue:`15006`)." msgstr "" #: ../../whatsnew/3.3.rst:1084 @@ -1894,8 +1902,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:1130 msgid "" "If Python is compiled without threads, the C version automatically disables " -"the expensive thread local context machinery. In this case, the variable :" -"const:`~decimal.HAVE_THREADS` is set to ``False``." +"the expensive thread local context machinery. In this case, the " +"variable :const:`~decimal.HAVE_THREADS` is set to ``False``." msgstr "" #: ../../whatsnew/3.3.rst:1137 @@ -1942,10 +1950,11 @@ msgstr "``-999999999999999999``" #: ../../whatsnew/3.3.rst:1150 msgid "" -"In the context templates (:const:`~decimal.DefaultContext`, :const:`~decimal." -"BasicContext` and :const:`~decimal.ExtendedContext`) the magnitude of :attr:" -"`~decimal.Context.Emax` and :attr:`~decimal.Context.Emin` has changed to " -"``999999``." +"In the context templates " +"(:const:`~decimal.DefaultContext`, :const:`~decimal.BasicContext` " +"and :const:`~decimal.ExtendedContext`) the magnitude " +"of :attr:`~decimal.Context.Emax` and :attr:`~decimal.Context.Emin` has " +"changed to ``999999``." msgstr "" #: ../../whatsnew/3.3.rst:1155 @@ -1953,29 +1962,31 @@ msgid "" "The :class:`~decimal.Decimal` constructor in decimal.py does not observe the " "context limits and converts values with arbitrary exponents or precision " "exactly. Since the C version has internal limits, the following scheme is " -"used: If possible, values are converted exactly, otherwise :exc:`~decimal." -"InvalidOperation` is raised and the result is NaN. In the latter case it is " -"always possible to use :meth:`~decimal.Context.create_decimal` in order to " -"obtain a rounded or inexact value." +"used: If possible, values are converted exactly, " +"otherwise :exc:`~decimal.InvalidOperation` is raised and the result is NaN. " +"In the latter case it is always possible to " +"use :meth:`~decimal.Context.create_decimal` in order to obtain a rounded or " +"inexact value." msgstr "" #: ../../whatsnew/3.3.rst:1164 msgid "" "The power function in decimal.py is always correctly rounded. In the C " -"version, it is defined in terms of the correctly rounded :meth:`~decimal." -"Decimal.exp` and :meth:`~decimal.Decimal.ln` functions, but the final result " -"is only \"almost always correctly rounded\"." +"version, it is defined in terms of the correctly " +"rounded :meth:`~decimal.Decimal.exp` and :meth:`~decimal.Decimal.ln` " +"functions, but the final result is only \"almost always correctly rounded\"." msgstr "" #: ../../whatsnew/3.3.rst:1170 msgid "" -"In the C version, the context dictionary containing the signals is a :class:" -"`~collections.abc.MutableMapping`. For speed reasons, :attr:`~decimal." -"Context.flags` and :attr:`~decimal.Context.traps` always refer to the same :" -"class:`~collections.abc.MutableMapping` that the context was initialized " -"with. If a new signal dictionary is assigned, :attr:`~decimal.Context.flags` " -"and :attr:`~decimal.Context.traps` are updated with the new values, but they " -"do not reference the RHS dictionary." +"In the C version, the context dictionary containing the signals is " +"a :class:`~collections.abc.MutableMapping`. For speed " +"reasons, :attr:`~decimal.Context.flags` and :attr:`~decimal.Context.traps` " +"always refer to the same :class:`~collections.abc.MutableMapping` that the " +"context was initialized with. If a new signal dictionary is " +"assigned, :attr:`~decimal.Context.flags` and :attr:`~decimal.Context.traps` " +"are updated with the new values, but they do not reference the RHS " +"dictionary." msgstr "" #: ../../whatsnew/3.3.rst:1180 @@ -2006,18 +2017,18 @@ msgstr "" #: ../../whatsnew/3.3.rst:1200 msgid "" -"The email package now has a :mod:`~email.policy` framework. A :class:" -"`~email.policy.Policy` is an object with several methods and properties that " -"control how the email package behaves. The primary policy for Python 3.3 is " -"the :class:`~email.policy.Compat32` policy, which provides backward " -"compatibility with the email package in Python 3.2. A ``policy`` can be " -"specified when an email message is parsed by a :mod:`~email.parser`, or when " -"a :class:`~email.message.Message` object is created, or when an email is " -"serialized using a :mod:`~email.generator`. Unless overridden, a policy " -"passed to a ``parser`` is inherited by all the ``Message`` object and sub-" -"objects created by the ``parser``. By default a ``generator`` will use the " -"policy of the ``Message`` object it is serializing. The default policy is :" -"data:`~email.policy.compat32`." +"The email package now has a :mod:`~email.policy` framework. " +"A :class:`~email.policy.Policy` is an object with several methods and " +"properties that control how the email package behaves. The primary policy " +"for Python 3.3 is the :class:`~email.policy.Compat32` policy, which provides " +"backward compatibility with the email package in Python 3.2. A ``policy`` " +"can be specified when an email message is parsed by a :mod:`~email.parser`, " +"or when a :class:`~email.message.Message` object is created, or when an " +"email is serialized using a :mod:`~email.generator`. Unless overridden, a " +"policy passed to a ``parser`` is inherited by all the ``Message`` object and " +"sub-objects created by the ``parser``. By default a ``generator`` will use " +"the policy of the ``Message`` object it is serializing. The default policy " +"is :data:`~email.policy.compat32`." msgstr "" #: ../../whatsnew/3.3.rst:1213 @@ -2067,11 +2078,11 @@ msgstr "" #: ../../whatsnew/3.3.rst:1235 msgid "" -"A new policy instance, with new settings, is created using the :meth:`~email." -"policy.Policy.clone` method of policy objects. ``clone`` takes any of the " -"above controls as keyword arguments. Any control not specified in the call " -"retains its default value. Thus you can create a policy that uses " -"``\\r\\n`` linesep characters like this::" +"A new policy instance, with new settings, is created using " +"the :meth:`~email.policy.Policy.clone` method of policy objects. ``clone`` " +"takes any of the above controls as keyword arguments. Any control not " +"specified in the call retains its default value. Thus you can create a " +"policy that uses ``\\r\\n`` linesep characters like this::" msgstr "" #: ../../whatsnew/3.3.rst:1241 @@ -2101,10 +2112,10 @@ msgid "" "for introducing it is to allow the creation of new policies that implement " "new features for the email package in a way that maintains backward " "compatibility for those who do not use the new policies. Because the new " -"policies introduce a new API, we are releasing them in Python 3.3 as a :term:" -"`provisional policy <provisional package>`. Backwards incompatible changes " -"(up to and including removal of the code) may occur if deemed necessary by " -"the core developers." +"policies introduce a new API, we are releasing them in Python 3.3 as " +"a :term:`provisional policy <provisional package>`. Backwards incompatible " +"changes (up to and including removal of the code) may occur if deemed " +"necessary by the core developers." msgstr "" #: ../../whatsnew/3.3.rst:1265 @@ -2162,8 +2173,8 @@ msgid "" "'Éric'\n" ">>> m['Date'] = email.utils.localtime()\n" ">>> m['Date'].datetime\n" -"datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, tzinfo=datetime." -"timezone(datetime.timedelta(-1, 72000), 'EDT'))\n" +"datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, " +"tzinfo=datetime.timezone(datetime.timedelta(-1, 72000), 'EDT'))\n" ">>> m['Date']\n" "'Fri, 25 May 2012 21:44:27 -0400'\n" ">>> print(m)\n" @@ -2182,8 +2193,8 @@ msgstr "" "'Éric'\n" ">>> m['Date'] = email.utils.localtime()\n" ">>> m['Date'].datetime\n" -"datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, tzinfo=datetime." -"timezone(datetime.timedelta(-1, 72000), 'EDT'))\n" +"datetime.datetime(2012, 5, 25, 21, 39, 24, 465484, " +"tzinfo=datetime.timezone(datetime.timedelta(-1, 72000), 'EDT'))\n" ">>> m['Date']\n" "'Fri, 25 May 2012 21:44:27 -0400'\n" ">>> print(m)\n" @@ -2195,8 +2206,8 @@ msgid "" "You will note that the unicode display name is automatically encoded as " "``utf-8`` when the message is serialized, but that when the header is " "accessed directly, you get the unicode version. This eliminates any need to " -"deal with the :mod:`email.header` :meth:`~email.header.decode_header` or :" -"meth:`~email.header.make_header` functions." +"deal with the :mod:`email.header` :meth:`~email.header.decode_header` " +"or :meth:`~email.header.make_header` functions." msgstr "" #: ../../whatsnew/3.3.rst:1318 @@ -2243,8 +2254,8 @@ msgid "" "(Group(display_name='pals', addresses=(Address(display_name='Bob', " "username='bob', domain='example.com'), Address(display_name='Sally', " "username='sally', domain='example.com')), Group(display_name=None, " -"addresses=(Address(display_name='Bonzo', username='bonz', domain='laugh." -"com'),))" +"addresses=(Address(display_name='Bonzo', username='bonz', " +"domain='laugh.com'),))" msgstr "" ">>> m2['cc'].addresses\n" "(Address(display_name='Bob', username='bob', domain='example.com'), " @@ -2254,8 +2265,8 @@ msgstr "" "(Group(display_name='pals', addresses=(Address(display_name='Bob', " "username='bob', domain='example.com'), Address(display_name='Sally', " "username='sally', domain='example.com')), Group(display_name=None, " -"addresses=(Address(display_name='Bonzo', username='bonz', domain='laugh." -"com'),))" +"addresses=(Address(display_name='Bonzo', username='bonz', " +"domain='laugh.com'),))" #: ../../whatsnew/3.3.rst:1343 msgid "" @@ -2271,9 +2282,9 @@ msgstr "其他 API 變更" #: ../../whatsnew/3.3.rst:1351 msgid "" -"New :class:`~email.parser.BytesHeaderParser`, added to the :mod:`~email." -"parser` module to complement :class:`~email.parser.HeaderParser` and " -"complete the Bytes API." +"New :class:`~email.parser.BytesHeaderParser`, added to " +"the :mod:`~email.parser` module to " +"complement :class:`~email.parser.HeaderParser` and complete the Bytes API." msgstr "" #: ../../whatsnew/3.3.rst:1355 @@ -2296,10 +2307,11 @@ msgstr "" #: ../../whatsnew/3.3.rst:1364 msgid "" ":func:`~email.utils.localtime`: With no argument, returns the current local " -"time as an aware :class:`~datetime.datetime` using the local :class:" -"`~datetime.timezone`. Given an aware :class:`~datetime.datetime`, converts " -"it into an aware :class:`~datetime.datetime` using the local :class:" -"`~datetime.timezone`." +"time as an aware :class:`~datetime.datetime` using the " +"local :class:`~datetime.timezone`. Given an " +"aware :class:`~datetime.datetime`, converts it into an " +"aware :class:`~datetime.datetime` using the " +"local :class:`~datetime.timezone`." msgstr "" #: ../../whatsnew/3.3.rst:1372 @@ -2310,24 +2322,25 @@ msgstr "ftplib" msgid "" ":class:`ftplib.FTP` now accepts a ``source_address`` keyword argument to " "specify the ``(host, port)`` to use as the source address in the bind call " -"when creating the outgoing socket. (Contributed by Giampaolo Rodolà in :" -"issue:`8594`.)" +"when creating the outgoing socket. (Contributed by Giampaolo Rodolà " +"in :issue:`8594`.)" msgstr "" #: ../../whatsnew/3.3.rst:1379 msgid "" -"The :class:`~ftplib.FTP_TLS` class now provides a new :func:`~ftplib.FTP_TLS." -"ccc` function to revert control channel back to plaintext. This can be " -"useful to take advantage of firewalls that know how to handle NAT with non-" -"secure FTP without opening fixed ports. (Contributed by Giampaolo Rodolà " -"in :issue:`12139`.)" +"The :class:`~ftplib.FTP_TLS` class now provides a " +"new :func:`~ftplib.FTP_TLS.ccc` function to revert control channel back to " +"plaintext. This can be useful to take advantage of firewalls that know how " +"to handle NAT with non-secure FTP without opening fixed ports. (Contributed " +"by Giampaolo Rodolà in :issue:`12139`.)" msgstr "" #: ../../whatsnew/3.3.rst:1385 msgid "" "Added :meth:`ftplib.FTP.mlsd` method which provides a parsable directory " -"listing format and deprecates :meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP." -"dir`. (Contributed by Giampaolo Rodolà in :issue:`11072`.)" +"listing format and deprecates :meth:`ftplib.FTP.nlst` " +"and :meth:`ftplib.FTP.dir`. (Contributed by Giampaolo Rodolà " +"in :issue:`11072`.)" msgstr "" #: ../../whatsnew/3.3.rst:1391 @@ -2370,11 +2383,11 @@ msgstr "http" #: ../../whatsnew/3.3.rst:1417 msgid "" ":class:`http.server.BaseHTTPRequestHandler` now buffers the headers and " -"writes them all at once when :meth:`~http.server.BaseHTTPRequestHandler." -"end_headers` is called. A new method :meth:`~http.server." -"BaseHTTPRequestHandler.flush_headers` can be used to directly manage when " -"the accumulated headers are sent. (Contributed by Andrew Schaaf in :issue:" -"`3709`.)" +"writes them all at once " +"when :meth:`~http.server.BaseHTTPRequestHandler.end_headers` is called. A " +"new method :meth:`~http.server.BaseHTTPRequestHandler.flush_headers` can be " +"used to directly manage when the accumulated headers are sent. (Contributed " +"by Andrew Schaaf in :issue:`3709`.)" msgstr "" #: ../../whatsnew/3.3.rst:1423 @@ -2385,9 +2398,10 @@ msgstr "" #: ../../whatsnew/3.3.rst:1426 msgid "" -":class:`http.client.HTTPResponse` now has a :meth:`~http.client.HTTPResponse." -"readinto` method, which means it can be used as an :class:`io.RawIOBase` " -"class. (Contributed by John Kuhn in :issue:`13464`.)" +":class:`http.client.HTTPResponse` now has " +"a :meth:`~http.client.HTTPResponse.readinto` method, which means it can be " +"used as an :class:`io.RawIOBase` class. (Contributed by John Kuhn " +"in :issue:`13464`.)" msgstr "" #: ../../whatsnew/3.3.rst:1433 @@ -2397,14 +2411,12 @@ msgstr "html" #: ../../whatsnew/3.3.rst:1435 msgid "" ":class:`html.parser.HTMLParser` is now able to parse broken markup without " -"raising errors, therefore the *strict* argument of the constructor and the :" -"exc:`~html.parser.HTMLParseError` exception are now deprecated. The ability " -"to parse broken markup is the result of a number of bug fixes that are also " -"available on the latest bug fix releases of Python 2.7/3.2. (Contributed by " -"Ezio Melotti in :issue:`15114`, and :issue:`14538`, :issue:`13993`, :issue:" -"`13960`, :issue:`13358`, :issue:`1745761`, :issue:`755670`, :issue:`13357`, :" -"issue:`12629`, :issue:`1200313`, :issue:`670664`, :issue:`13273`, :issue:" -"`12888`, :issue:`7311`.)" +"raising errors, therefore the *strict* argument of the constructor and " +"the :exc:`~html.parser.HTMLParseError` exception are now deprecated. The " +"ability to parse broken markup is the result of a number of bug fixes that " +"are also available on the latest bug fix releases of Python 2.7/3.2. " +"(Contributed by Ezio Melotti in :issue:`15114`, " +"and :issue:`14538`, :issue:`13993`, :issue:`13960`, :issue:`13358`, :issue:`1745761`, :issue:`755670`, :issue:`13357`, :issue:`12629`, :issue:`1200313`, :issue:`670664`, :issue:`13273`, :issue:`12888`, :issue:`7311`.)" msgstr "" #: ../../whatsnew/3.3.rst:1445 @@ -2476,10 +2488,10 @@ msgstr "(由 David Townshend 於 :issue:`12760` 中貢獻。)" #: ../../whatsnew/3.3.rst:1487 msgid "" "The constructor of the :class:`~io.TextIOWrapper` class has a new " -"*write_through* optional argument. If *write_through* is ``True``, calls to :" -"meth:`~io.TextIOWrapper.write` are guaranteed not to be buffered: any data " -"written on the :class:`~io.TextIOWrapper` object is immediately handled to " -"its underlying binary buffer." +"*write_through* optional argument. If *write_through* is ``True``, calls " +"to :meth:`~io.TextIOWrapper.write` are guaranteed not to be buffered: any " +"data written on the :class:`~io.TextIOWrapper` object is immediately handled " +"to its underlying binary buffer." msgstr "" #: ../../whatsnew/3.3.rst:1495 @@ -2552,8 +2564,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:1539 msgid "" ":class:`multiprocessing.Connection` objects can now be transferred over " -"multiprocessing connections. (Contributed by Richard Oudkerk in :issue:" -"`4892`.)" +"multiprocessing connections. (Contributed by Richard Oudkerk " +"in :issue:`4892`.)" msgstr "" #: ../../whatsnew/3.3.rst:1543 @@ -2572,11 +2584,12 @@ msgstr "" #: ../../whatsnew/3.3.rst:1552 msgid "" -"New methods :meth:`multiprocessing.pool.Pool.starmap` and :meth:" -"`~multiprocessing.pool.Pool.starmap_async` provide :func:`itertools.starmap` " -"equivalents to the existing :meth:`multiprocessing.pool.Pool.map` and :meth:" -"`~multiprocessing.pool.Pool.map_async` functions. (Contributed by Hynek " -"Schlawack in :issue:`12708`.)" +"New methods :meth:`multiprocessing.pool.Pool.starmap` " +"and :meth:`~multiprocessing.pool.Pool.starmap_async` " +"provide :func:`itertools.starmap` equivalents to the " +"existing :meth:`multiprocessing.pool.Pool.map` " +"and :meth:`~multiprocessing.pool.Pool.map_async` functions. (Contributed by " +"Hynek Schlawack in :issue:`12708`.)" msgstr "" #: ../../whatsnew/3.3.rst:1561 @@ -2596,16 +2609,16 @@ msgid "" ">>> with NNTP('news.gmane.org') as n:\n" "... n.group('gmane.comp.python.committers')\n" "...\n" -"('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, 'gmane.comp." -"python.committers')\n" +"('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, " +"'gmane.comp.python.committers')\n" ">>>" msgstr "" ">>> from nntplib import NNTP\n" ">>> with NNTP('news.gmane.org') as n:\n" "... n.group('gmane.comp.python.committers')\n" "...\n" -"('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, 'gmane.comp." -"python.committers')\n" +"('211 1755 1 1755 gmane.comp.python.committers', 1755, 1, 1755, " +"'gmane.comp.python.committers')\n" ">>>" #: ../../whatsnew/3.3.rst:1574 @@ -2619,9 +2632,9 @@ msgstr "os" #: ../../whatsnew/3.3.rst:1580 msgid "" "The :mod:`os` module has a new :func:`~os.pipe2` function that makes it " -"possible to create a pipe with :const:`~os.O_CLOEXEC` or :const:`~os." -"O_NONBLOCK` flags set atomically. This is especially useful to avoid race " -"conditions in multi-threaded programs." +"possible to create a pipe with :const:`~os.O_CLOEXEC` " +"or :const:`~os.O_NONBLOCK` flags set atomically. This is especially useful " +"to avoid race conditions in multi-threaded programs." msgstr "" #: ../../whatsnew/3.3.rst:1585 @@ -2645,52 +2658,46 @@ msgid "" "To avoid race conditions like symlink attacks and issues with temporary " "files and directories, it is more reliable (and also faster) to manipulate " "file descriptors instead of file names. Python 3.3 enhances existing " -"functions and introduces new functions to work on file descriptors (:issue:" -"`4761`, :issue:`10755` and :issue:`14626`)." +"functions and introduces new functions to work on file descriptors " +"(:issue:`4761`, :issue:`10755` and :issue:`14626`)." msgstr "" #: ../../whatsnew/3.3.rst:1601 msgid "" -"The :mod:`os` module has a new :func:`~os.fwalk` function similar to :func:" -"`~os.walk` except that it also yields file descriptors referring to the " -"directories visited. This is especially useful to avoid symlink races." +"The :mod:`os` module has a new :func:`~os.fwalk` function similar " +"to :func:`~os.walk` except that it also yields file descriptors referring to " +"the directories visited. This is especially useful to avoid symlink races." msgstr "" #: ../../whatsnew/3.3.rst:1605 msgid "" "The following functions get new optional *dir_fd* (:ref:`paths relative to " "directory descriptors <dir_fd>`) and/or *follow_symlinks* (:ref:`not " -"following symlinks <follow_symlinks>`): :func:`~os.access`, :func:`~os." -"chflags`, :func:`~os.chmod`, :func:`~os.chown`, :func:`~os.link`, :func:`~os." -"lstat`, :func:`~os.mkdir`, :func:`~os.mkfifo`, :func:`~os.mknod`, :func:`~os." -"open`, :func:`~os.readlink`, :func:`~os.remove`, :func:`~os.rename`, :func:" -"`~os.replace`, :func:`~os.rmdir`, :func:`~os.stat`, :func:`~os.symlink`, :" -"func:`~os.unlink`, :func:`~os.utime`. Platform support for using these " -"parameters can be checked via the sets :data:`os.supports_dir_fd` and :data:" -"`os.supports_follows_symlinks`." +"following symlinks " +"<follow_symlinks>`): :func:`~os.access`, :func:`~os.chflags`, :func:`~os.chmod`, :func:`~os.chown`, :func:`~os.link`, :func:`~os.lstat`, :func:`~os.mkdir`, :func:`~os.mkfifo`, :func:`~os.mknod`, :func:`~os.open`, :func:`~os.readlink`, :func:`~os.remove`, :func:`~os.rename`, :func:`~os.replace`, :func:`~os.rmdir`, :func:`~os.stat`, :func:`~os.symlink`, :func:`~os.unlink`, :func:`~os.utime`. " +"Platform support for using these parameters can be checked via the " +"sets :data:`os.supports_dir_fd` and :data:`os.supports_follows_symlinks`." msgstr "" #: ../../whatsnew/3.3.rst:1616 msgid "" "The following functions now support a file descriptor for their path " -"argument: :func:`~os.chdir`, :func:`~os.chmod`, :func:`~os.chown`, :func:" -"`~os.execve`, :func:`~os.listdir`, :func:`~os.pathconf`, :func:`~os.path." -"exists`, :func:`~os.stat`, :func:`~os.statvfs`, :func:`~os.utime`. Platform " -"support for this can be checked via the :data:`os.supports_fd` set." +"argument: :func:`~os.chdir`, :func:`~os.chmod`, :func:`~os.chown`, :func:`~os.execve`, :func:`~os.listdir`, :func:`~os.pathconf`, :func:`~os.path.exists`, :func:`~os.stat`, :func:`~os.statvfs`, :func:`~os.utime`. " +"Platform support for this can be checked via the :data:`os.supports_fd` set." msgstr "" #: ../../whatsnew/3.3.rst:1622 msgid "" ":func:`~os.access` accepts an ``effective_ids`` keyword argument to turn on " "using the effective uid/gid rather than the real uid/gid in the access " -"check. Platform support for this can be checked via the :data:`~os." -"supports_effective_ids` set." +"check. Platform support for this can be checked via " +"the :data:`~os.supports_effective_ids` set." msgstr "" #: ../../whatsnew/3.3.rst:1627 msgid "" -"The :mod:`os` module has two new functions: :func:`~os.getpriority` and :" -"func:`~os.setpriority`. They can be used to get or set process niceness/" +"The :mod:`os` module has two new functions: :func:`~os.getpriority` " +"and :func:`~os.setpriority`. They can be used to get or set process niceness/" "priority in a fashion similar to :func:`os.nice` but extended to all " "processes instead of just the current one." msgstr "" @@ -2709,37 +2716,32 @@ msgstr "" #: ../../whatsnew/3.3.rst:1640 msgid "" -"The stat family of functions (:func:`~os.stat`, :func:`~os.fstat`, and :func:" -"`~os.lstat`) now support reading a file's timestamps with nanosecond " -"precision. Symmetrically, :func:`~os.utime` can now write file timestamps " -"with nanosecond precision. (Contributed by Larry Hastings in :issue:" -"`14127`.)" +"The stat family of functions (:func:`~os.stat`, :func:`~os.fstat`, " +"and :func:`~os.lstat`) now support reading a file's timestamps with " +"nanosecond precision. Symmetrically, :func:`~os.utime` can now write file " +"timestamps with nanosecond precision. (Contributed by Larry Hastings " +"in :issue:`14127`.)" msgstr "" #: ../../whatsnew/3.3.rst:1646 msgid "" "The new :func:`os.get_terminal_size` function queries the size of the " -"terminal attached to a file descriptor. See also :func:`shutil." -"get_terminal_size`. (Contributed by Zbigniew Jędrzejewski-Szmek in :issue:" -"`13609`.)" +"terminal attached to a file descriptor. See " +"also :func:`shutil.get_terminal_size`. (Contributed by Zbigniew Jędrzejewski-" +"Szmek in :issue:`13609`.)" msgstr "" #: ../../whatsnew/3.3.rst:1653 msgid "" -"New functions to support Linux extended attributes (:issue:`12720`): :func:" -"`~os.getxattr`, :func:`~os.listxattr`, :func:`~os.removexattr`, :func:`~os." -"setxattr`." +"New functions to support Linux extended attributes " +"(:issue:`12720`): :func:`~os.getxattr`, :func:`~os.listxattr`, :func:`~os.removexattr`, :func:`~os.setxattr`." msgstr "" #: ../../whatsnew/3.3.rst:1657 msgid "" "New interface to the scheduler. These functions control how a process is " -"allocated CPU time by the operating system. New functions: :func:`~os." -"sched_get_priority_max`, :func:`~os.sched_get_priority_min`, :func:`~os." -"sched_getaffinity`, :func:`~os.sched_getparam`, :func:`~os." -"sched_getscheduler`, :func:`~os.sched_rr_get_interval`, :func:`~os." -"sched_setaffinity`, :func:`~os.sched_setparam`, :func:`~os." -"sched_setscheduler`, :func:`~os.sched_yield`," +"allocated CPU time by the operating system. New " +"functions: :func:`~os.sched_get_priority_max`, :func:`~os.sched_get_priority_min`, :func:`~os.sched_getaffinity`, :func:`~os.sched_getparam`, :func:`~os.sched_getscheduler`, :func:`~os.sched_rr_get_interval`, :func:`~os.sched_setaffinity`, :func:`~os.sched_setparam`, :func:`~os.sched_setscheduler`, :func:`~os.sched_yield`," msgstr "" #: ../../whatsnew/3.3.rst:1666 @@ -2827,12 +2829,12 @@ msgstr "" #: ../../whatsnew/3.3.rst:1696 msgid "" -"New constants :const:`~os.RTLD_LAZY`, :const:`~os.RTLD_NOW`, :const:`~os." -"RTLD_GLOBAL`, :const:`~os.RTLD_LOCAL`, :const:`~os.RTLD_NODELETE`, :const:" -"`~os.RTLD_NOLOAD`, and :const:`~os.RTLD_DEEPBIND` are available on platforms " -"that support them. These are for use with the :func:`sys.setdlopenflags` " -"function, and supersede the similar constants defined in :mod:`ctypes` and :" -"mod:`DLFCN`. (Contributed by Victor Stinner in :issue:`13226`.)" +"New " +"constants :const:`~os.RTLD_LAZY`, :const:`~os.RTLD_NOW`, :const:`~os.RTLD_GLOBAL`, :const:`~os.RTLD_LOCAL`, :const:`~os.RTLD_NODELETE`, :const:`~os.RTLD_NOLOAD`, " +"and :const:`~os.RTLD_DEEPBIND` are available on platforms that support " +"them. These are for use with the :func:`sys.setdlopenflags` function, and " +"supersede the similar constants defined in :mod:`ctypes` and :mod:`DLFCN`. " +"(Contributed by Victor Stinner in :issue:`13226`.)" msgstr "" #: ../../whatsnew/3.3.rst:1704 @@ -2862,8 +2864,9 @@ msgstr "pickle" #: ../../whatsnew/3.3.rst:1721 msgid "" -":class:`pickle.Pickler` objects now have an optional :attr:`~pickle.Pickler." -"dispatch_table` attribute allowing per-pickler reduction functions to be set." +":class:`pickle.Pickler` objects now have an " +"optional :attr:`~pickle.Pickler.dispatch_table` attribute allowing per-" +"pickler reduction functions to be set." msgstr "" #: ../../whatsnew/3.3.rst:1725 @@ -2876,8 +2879,8 @@ msgstr "pydoc" #: ../../whatsnew/3.3.rst:1731 msgid "" -"The Tk GUI and the :func:`~pydoc.serve` function have been removed from the :" -"mod:`pydoc` module: ``pydoc -g`` and :func:`~pydoc.serve` have been " +"The Tk GUI and the :func:`~pydoc.serve` function have been removed from " +"the :mod:`pydoc` module: ``pydoc -g`` and :func:`~pydoc.serve` have been " "deprecated in Python 3.2." msgstr "" @@ -2910,22 +2913,23 @@ msgstr "" #: ../../whatsnew/3.3.rst:1753 msgid "" ":class:`~sched.scheduler` class can now be safely used in multi-threaded " -"environments. (Contributed by Josiah Carlson and Giampaolo Rodolà in :issue:" -"`8684`.)" +"environments. (Contributed by Josiah Carlson and Giampaolo Rodolà " +"in :issue:`8684`.)" msgstr "" #: ../../whatsnew/3.3.rst:1757 msgid "" "*timefunc* and *delayfunct* parameters of :class:`~sched.scheduler` class " -"constructor are now optional and defaults to :func:`time.time` and :func:" -"`time.sleep` respectively. (Contributed by Chris Clark in :issue:`13245`.)" +"constructor are now optional and defaults to :func:`time.time` " +"and :func:`time.sleep` respectively. (Contributed by Chris Clark " +"in :issue:`13245`.)" msgstr "" #: ../../whatsnew/3.3.rst:1762 msgid "" ":meth:`~sched.scheduler.enter` and :meth:`~sched.scheduler.enterabs` " -"*argument* parameter is now optional. (Contributed by Chris Clark in :issue:" -"`13245`.)" +"*argument* parameter is now optional. (Contributed by Chris Clark " +"in :issue:`13245`.)" msgstr "" ":meth:`~sched.scheduler.enter` 和 :meth:`~sched.scheduler.enterabs` " "*argument* 參數現在是可選的。(由 Chris Clark 在 :issue:`13245` 中貢獻。)" @@ -2956,9 +2960,9 @@ msgstr "shlex" #: ../../whatsnew/3.3.rst:1782 msgid "" "The previously undocumented helper function ``quote`` from the :mod:`!pipes` " -"modules has been moved to the :mod:`shlex` module and documented. :func:" -"`~shlex.quote` properly escapes all characters in a string that might be " -"otherwise given special meaning by the shell." +"modules has been moved to the :mod:`shlex` module and " +"documented. :func:`~shlex.quote` properly escapes all characters in a " +"string that might be otherwise given special meaning by the shell." msgstr "" #: ../../whatsnew/3.3.rst:1789 @@ -3017,9 +3021,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:1818 msgid "" ":func:`~shutil.rmtree` is now resistant to symlink attacks on platforms " -"which support the new ``dir_fd`` parameter in :func:`os.open` and :func:`os." -"unlink`. (Contributed by Martin von Löwis and Hynek Schlawack in :issue:" -"`4489`.)" +"which support the new ``dir_fd`` parameter in :func:`os.open` " +"and :func:`os.unlink`. (Contributed by Martin von Löwis and Hynek Schlawack " +"in :issue:`4489`.)" msgstr "" #: ../../whatsnew/3.3.rst:1825 @@ -3082,9 +3086,10 @@ msgstr "smtpd" #: ../../whatsnew/3.3.rst:1850 msgid "" -"The :mod:`!smtpd` module now supports :rfc:`5321` (extended SMTP) and :rfc:" -"`1870` (size extension). Per the standard, these extensions are enabled if " -"and only if the client initiates the session with an ``EHLO`` command." +"The :mod:`!smtpd` module now supports :rfc:`5321` (extended SMTP) " +"and :rfc:`1870` (size extension). Per the standard, these extensions are " +"enabled if and only if the client initiates the session with an ``EHLO`` " +"command." msgstr "" #: ../../whatsnew/3.3.rst:1854 @@ -3100,11 +3105,11 @@ msgstr "smtplib" #: ../../whatsnew/3.3.rst:1862 msgid "" -"The :class:`~smtplib.SMTP`, :class:`~smtplib.SMTP_SSL`, and :class:`~smtplib." -"LMTP` classes now accept a ``source_address`` keyword argument to specify " -"the ``(host, port)`` to use as the source address in the bind call when " -"creating the outgoing socket. (Contributed by Paulo Scardine in :issue:" -"`11281`.)" +"The :class:`~smtplib.SMTP`, :class:`~smtplib.SMTP_SSL`, " +"and :class:`~smtplib.LMTP` classes now accept a ``source_address`` keyword " +"argument to specify the ``(host, port)`` to use as the source address in the " +"bind call when creating the outgoing socket. (Contributed by Paulo Scardine " +"in :issue:`11281`.)" msgstr "" #: ../../whatsnew/3.3.rst:1868 @@ -3118,9 +3123,10 @@ msgstr "" #: ../../whatsnew/3.3.rst:1872 msgid "" -"The :class:`~smtplib.SMTP_SSL` constructor and the :meth:`~smtplib.SMTP." -"starttls` method now accept an SSLContext parameter to control parameters of " -"the secure channel. (Contributed by Kasun Herath in :issue:`8809`.)" +"The :class:`~smtplib.SMTP_SSL` constructor and " +"the :meth:`~smtplib.SMTP.starttls` method now accept an SSLContext parameter " +"to control parameters of the secure channel. (Contributed by Kasun Herath " +"in :issue:`8809`.)" msgstr "" ":class:`~smtplib.SMTP_SSL` 構造函式和 :meth:`~smtplib.SMTP.starttls` 方法現在" "接受 SSLContext 參數來控制安全通道的參數。(由 Kasun Herath 在 :issue:`8809` " @@ -3168,22 +3174,22 @@ msgstr "" #: ../../whatsnew/3.3.rst:1894 msgid "" -"(Contributed by Matthias Fuchs, updated by Tiago Gonçalves in :issue:" -"`10141`.)" +"(Contributed by Matthias Fuchs, updated by Tiago Gonçalves " +"in :issue:`10141`.)" msgstr "" "(在 :issue:`10141` 中由 Matthias Fuchs 貢獻、並由 Tiago Gonçalves 更新。)" #: ../../whatsnew/3.3.rst:1896 msgid "" "The :class:`~socket.socket` class now supports the PF_RDS protocol family " -"(https://en.wikipedia.org/wiki/Reliable_Datagram_Sockets and `https://oss." -"oracle.com/projects/rds <https://web.archive.org/web/20130115155505/https://" -"oss.oracle.com/projects/rds/>`__)." +"(https://en.wikipedia.org/wiki/Reliable_Datagram_Sockets and `https://" +"oss.oracle.com/projects/rds <https://web.archive.org/web/20130115155505/" +"https://oss.oracle.com/projects/rds/%3E%60__)." msgstr "" -":class:`~socket.socket` 類別現在支援 PF_RDS 協議系列(https://en.wikipedia." -"org/wiki/Reliable_Datagram_Sockets 和 `https://oss.oracle.com/projects/rds " -"<https://web.archive.org/web/20130115155505/https://oss.oracle.com/projects/" -"rds/>`__\\ )。" +":class:`~socket.socket` 類別現在支援 PF_RDS 協議系列(https://" +"en.wikipedia.org/wiki/Reliable_Datagram_Sockets 和 `https://oss.oracle.com/" +"projects/rds <https://web.archive.org/web/20130115155505/https://" +"oss.oracle.com/projects/rds/>`__\\ )。" #: ../../whatsnew/3.3.rst:1900 msgid "" @@ -3206,11 +3212,11 @@ msgstr "socketserver" #: ../../whatsnew/3.3.rst:1911 msgid "" -":class:`~socketserver.BaseServer` now has an overridable method :meth:" -"`~socketserver.BaseServer.service_actions` that is called by the :meth:" -"`~socketserver.BaseServer.serve_forever` method in the service loop. :class:" -"`~socketserver.ForkingMixIn` now uses this to clean up zombie child " -"processes. (Contributed by Justin Warkentin in :issue:`11109`.)" +":class:`~socketserver.BaseServer` now has an overridable " +"method :meth:`~socketserver.BaseServer.service_actions` that is called by " +"the :meth:`~socketserver.BaseServer.serve_forever` method in the service " +"loop. :class:`~socketserver.ForkingMixIn` now uses this to clean up zombie " +"child processes. (Contributed by Justin Warkentin in :issue:`11109`.)" msgstr "" #: ../../whatsnew/3.3.rst:1919 @@ -3219,9 +3225,10 @@ msgstr "sqlite3" #: ../../whatsnew/3.3.rst:1921 msgid "" -"New :class:`sqlite3.Connection` method :meth:`~sqlite3.Connection." -"set_trace_callback` can be used to capture a trace of all sql commands " -"processed by sqlite. (Contributed by Torsten Landschoff in :issue:`11688`.)" +"New :class:`sqlite3.Connection` " +"method :meth:`~sqlite3.Connection.set_trace_callback` can be used to capture " +"a trace of all sql commands processed by sqlite. (Contributed by Torsten " +"Landschoff in :issue:`11688`.)" msgstr "" #: ../../whatsnew/3.3.rst:1928 @@ -3256,16 +3263,16 @@ msgstr "" #: ../../whatsnew/3.3.rst:1942 msgid "" ":meth:`~ssl.SSLContext.load_cert_chain` now accepts a *password* argument to " -"be used if the private key is encrypted. (Contributed by Adam Simpkins in :" -"issue:`12803`.)" +"be used if the private key is encrypted. (Contributed by Adam Simpkins " +"in :issue:`12803`.)" msgstr "" #: ../../whatsnew/3.3.rst:1946 msgid "" "Diffie-Hellman key exchange, both regular and Elliptic Curve-based, is now " -"supported through the :meth:`~ssl.SSLContext.load_dh_params` and :meth:`~ssl." -"SSLContext.set_ecdh_curve` methods. (Contributed by Antoine Pitrou in :issue:" -"`13626` and :issue:`13627`.)" +"supported through the :meth:`~ssl.SSLContext.load_dh_params` " +"and :meth:`~ssl.SSLContext.set_ecdh_curve` methods. (Contributed by Antoine " +"Pitrou in :issue:`13626` and :issue:`13627`.)" msgstr "" #: ../../whatsnew/3.3.rst:1951 @@ -3278,9 +3285,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:1955 msgid "" "You can query the SSL compression algorithm used by an SSL socket, thanks to " -"its new :meth:`~ssl.SSLSocket.compression` method. The new attribute :const:" -"`~ssl.OP_NO_COMPRESSION` can be used to disable compression. (Contributed by " -"Antoine Pitrou in :issue:`13634`.)" +"its new :meth:`~ssl.SSLSocket.compression` method. The new " +"attribute :const:`~ssl.OP_NO_COMPRESSION` can be used to disable " +"compression. (Contributed by Antoine Pitrou in :issue:`13634`.)" msgstr "" #: ../../whatsnew/3.3.rst:1960 @@ -3292,9 +3299,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:1964 msgid "" -"SSL errors can now be introspected more easily thanks to :attr:`~ssl." -"SSLError.library` and :attr:`~ssl.SSLError.reason` attributes. (Contributed " -"by Antoine Pitrou in :issue:`14837`.)" +"SSL errors can now be introspected more easily thanks " +"to :attr:`~ssl.SSLError.library` and :attr:`~ssl.SSLError.reason` " +"attributes. (Contributed by Antoine Pitrou in :issue:`14837`.)" msgstr "" #: ../../whatsnew/3.3.rst:1968 @@ -3316,9 +3323,9 @@ msgstr "stat" #: ../../whatsnew/3.3.rst:1979 msgid "" -"The undocumented tarfile.filemode function has been moved to :func:`stat." -"filemode`. It can be used to convert a file's mode to a string of the form '-" -"rwxrwxrwx'." +"The undocumented tarfile.filemode function has been moved " +"to :func:`stat.filemode`. It can be used to convert a file's mode to a " +"string of the form '-rwxrwxrwx'." msgstr "" #: ../../whatsnew/3.3.rst:1983 @@ -3349,8 +3356,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:2000 msgid "" "A new constant :const:`~subprocess.DEVNULL` allows suppressing output in a " -"platform-independent fashion. (Contributed by Ross Lagerwall in :issue:" -"`5870`.)" +"platform-independent fashion. (Contributed by Ross Lagerwall " +"in :issue:`5870`.)" msgstr "" #: ../../whatsnew/3.3.rst:2006 @@ -3381,9 +3388,9 @@ msgstr "tempfile" #: ../../whatsnew/3.3.rst:2023 msgid "" -":class:`tempfile.SpooledTemporaryFile`\\'s :meth:`~tempfile." -"SpooledTemporaryFile.truncate` method now accepts a ``size`` parameter. " -"(Contributed by Ryan Kelly in :issue:`9957`.)" +":class:`tempfile.SpooledTemporaryFile`\\'s :meth:`~tempfile.SpooledTemporaryFile.truncate` " +"method now accepts a ``size`` parameter. (Contributed by Ryan Kelly " +"in :issue:`9957`.)" msgstr "" #: ../../whatsnew/3.3.rst:2029 @@ -3403,11 +3410,10 @@ msgstr "threading" #: ../../whatsnew/3.3.rst:2039 msgid "" -":class:`threading.Condition`, :class:`threading.Semaphore`, :class:" -"`threading.BoundedSemaphore`, :class:`threading.Event`, and :class:" -"`threading.Timer`, all of which used to be factory functions returning a " -"class instance, are now classes and may be subclassed. (Contributed by Éric " -"Araujo in :issue:`10968`.)" +":class:`threading.Condition`, :class:`threading.Semaphore`, :class:`threading.BoundedSemaphore`, :class:`threading.Event`, " +"and :class:`threading.Timer`, all of which used to be factory functions " +"returning a class instance, are now classes and may be subclassed. " +"(Contributed by Éric Araujo in :issue:`10968`.)" msgstr "" #: ../../whatsnew/3.3.rst:2045 @@ -3463,19 +3469,19 @@ msgstr "其他新功能:" #: ../../whatsnew/3.3.rst:2071 msgid "" -":func:`~time.clock_getres`, :func:`~time.clock_gettime` and :func:`~time." -"clock_settime` functions with :samp:`CLOCK_{xxx}` constants. (Contributed by " -"Victor Stinner in :issue:`10278`.)" +":func:`~time.clock_getres`, :func:`~time.clock_gettime` " +"and :func:`~time.clock_settime` functions with :samp:`CLOCK_{xxx}` " +"constants. (Contributed by Victor Stinner in :issue:`10278`.)" msgstr "" -":func:`~time.clock_getres`、:func:`~time.clock_gettime` 和 :func:`~time." -"clock_settime` 函式帶有 :samp:`CLOCK_{xxx}` 常數。(由 Victor Stinner 在 :" -"issue:`10278` 中貢獻。)" +":func:`~time.clock_getres`、:func:`~time.clock_gettime` " +"和 :func:`~time.clock_settime` 函式帶有 :samp:`CLOCK_{xxx}` 常數。(由 " +"Victor Stinner 在 :issue:`10278` 中貢獻。)" #: ../../whatsnew/3.3.rst:2075 msgid "" -"To improve cross platform consistency, :func:`~time.sleep` now raises a :exc:" -"`ValueError` when passed a negative sleep value. Previously this was an " -"error on posix, but produced an infinite sleep on Windows." +"To improve cross platform consistency, :func:`~time.sleep` now raises " +"a :exc:`ValueError` when passed a negative sleep value. Previously this was " +"an error on posix, but produced an infinite sleep on Windows." msgstr "" #: ../../whatsnew/3.3.rst:2081 @@ -3491,8 +3497,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:2087 msgid "" "The new functions :func:`types.new_class` and :func:`types.prepare_class` " -"provide support for :pep:`3115` compliant dynamic type creation. (:issue:" -"`14588`)" +"provide support for :pep:`3115` compliant dynamic type creation. " +"(:issue:`14588`)" msgstr "" #: ../../whatsnew/3.3.rst:2092 @@ -3503,8 +3509,8 @@ msgstr "unittest" msgid "" ":meth:`.assertRaises`, :meth:`.assertRaisesRegex`, :meth:`.assertWarns`, " "and :meth:`.assertWarnsRegex` now accept a keyword argument *msg* when used " -"as context managers. (Contributed by Ezio Melotti and Winston Ewert in :" -"issue:`10775`.)" +"as context managers. (Contributed by Ezio Melotti and Winston Ewert " +"in :issue:`10775`.)" msgstr "" #: ../../whatsnew/3.3.rst:2099 @@ -3540,12 +3546,12 @@ msgstr "webbrowser" #: ../../whatsnew/3.3.rst:2118 msgid "" "The :mod:`webbrowser` module supports more \"browsers\": Google Chrome " -"(named :program:`chrome`, :program:`chromium`, :program:`chrome-browser` or :" -"program:`chromium-browser` depending on the version and operating system), " -"and the generic launchers :program:`xdg-open`, from the FreeDesktop.org " -"project, and :program:`gvfs-open`, which is the default URI handler for " -"GNOME 3. (The former contributed by Arnaud Calmettes in :issue:`13620`, the " -"latter by Matthias Klose in :issue:`14493`.)" +"(named :program:`chrome`, :program:`chromium`, :program:`chrome-browser` " +"or :program:`chromium-browser` depending on the version and operating " +"system), and the generic launchers :program:`xdg-open`, from the " +"FreeDesktop.org project, and :program:`gvfs-open`, which is the default URI " +"handler for GNOME 3. (The former contributed by Arnaud Calmettes " +"in :issue:`13620`, the latter by Matthias Klose in :issue:`14493`.)" msgstr "" #: ../../whatsnew/3.3.rst:2128 @@ -3555,12 +3561,12 @@ msgstr "xml.etree.ElementTree" #: ../../whatsnew/3.3.rst:2130 msgid "" "The :mod:`xml.etree.ElementTree` module now imports its C accelerator by " -"default; there is no longer a need to explicitly import :mod:`xml.etree." -"cElementTree` (this module stays for backwards compatibility, but is now " -"deprecated). In addition, the ``iter`` family of methods of :class:`~xml." -"etree.ElementTree.Element` has been optimized (rewritten in C). The module's " -"documentation has also been greatly improved with added examples and a more " -"detailed reference." +"default; there is no longer a need to explicitly " +"import :mod:`xml.etree.cElementTree` (this module stays for backwards " +"compatibility, but is now deprecated). In addition, the ``iter`` family of " +"methods of :class:`~xml.etree.ElementTree.Element` has been optimized " +"(rewritten in C). The module's documentation has also been greatly improved " +"with added examples and a more detailed reference." msgstr "" #: ../../whatsnew/3.3.rst:2140 @@ -3620,19 +3626,19 @@ msgstr "" #: ../../whatsnew/3.3.rst:2167 msgid "" -"(Contributed by Serhiy Storchaka, :issue:`14624`, :issue:`14738` and :issue:" -"`15026`.)" +"(Contributed by Serhiy Storchaka, :issue:`14624`, :issue:`14738` " +"and :issue:`15026`.)" msgstr "" "(由 Serhiy Storchaka 於 :issue:`14624`、:issue:`14738` 和 :issue:`15026` 貢" "獻。)" #: ../../whatsnew/3.3.rst:2172 msgid "Build and C API Changes" -msgstr "建置和 C API 更改" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.3.rst:2174 msgid "Changes to Python's build process and to the C API include:" -msgstr "Python 建置程序和 C API 的更改包括:" +msgstr "Python 建置程序和 C API 的變更包括:" #: ../../whatsnew/3.3.rst:2176 msgid "New :pep:`3118` related function:" @@ -3699,27 +3705,18 @@ msgid ":c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsUCS4Copy`" msgstr ":c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsUCS4Copy`" #: ../../whatsnew/3.3.rst:2198 -msgid "" -":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:" -"`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" -msgstr "" -":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:" -"`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" +msgid ":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" +msgstr ":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" #: ../../whatsnew/3.3.rst:2200 msgid "" ":c:macro:`PyUnicode_KIND` with :c:enum:`PyUnicode_Kind` enum: :c:data:`!" -"PyUnicode_WCHAR_KIND`, :c:data:`PyUnicode_1BYTE_KIND`, :c:data:" -"`PyUnicode_2BYTE_KIND`, :c:data:`PyUnicode_4BYTE_KIND`" +"PyUnicode_WCHAR_KIND`, :c:data:`PyUnicode_1BYTE_KIND`, :c:data:`PyUnicode_2BYTE_KIND`, :c:data:`PyUnicode_4BYTE_KIND`" msgstr "" #: ../../whatsnew/3.3.rst:2203 -msgid "" -":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:" -"`PyUnicode_WRITE`" -msgstr "" -":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:" -"`PyUnicode_WRITE`" +msgid ":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:`PyUnicode_WRITE`" +msgstr ":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:`PyUnicode_WRITE`" #: ../../whatsnew/3.3.rst:2204 msgid ":c:macro:`PyUnicode_MAX_CHAR_VALUE`" @@ -3730,8 +3727,8 @@ msgid "" ":c:macro:`PyArg_ParseTuple` now accepts a :class:`bytearray` for the ``c`` " "format (:issue:`12380`)." msgstr "" -":c:macro:`PyArg_ParseTuple` 現在接受 :class:`bytearray` 為 ``c`` 格式 (:" -"issue:`12380`)。" +":c:macro:`PyArg_ParseTuple` 現在接受 :class:`bytearray` 為 ``c`` 格式 " +"(:issue:`12380`)。" #: ../../whatsnew/3.3.rst:2212 msgid "Deprecated" @@ -3767,26 +3764,26 @@ msgstr "" #: ../../whatsnew/3.3.rst:2230 msgid "" -"The ``unicode_internal`` codec has been deprecated because of the :pep:" -"`393`, use UTF-8, UTF-16 (``utf-16-le`` or ``utf-16-be``), or UTF-32 " -"(``utf-32-le`` or ``utf-32-be``)" +"The ``unicode_internal`` codec has been deprecated because of " +"the :pep:`393`, use UTF-8, UTF-16 (``utf-16-le`` or ``utf-16-be``), or " +"UTF-32 (``utf-32-le`` or ``utf-32-be``)" msgstr "" #: ../../whatsnew/3.3.rst:2233 msgid "" -":meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP.dir`: use :meth:`ftplib.FTP." -"mlsd`" +":meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP.dir`: " +"use :meth:`ftplib.FTP.mlsd`" msgstr "" -":meth:`ftplib.FTP.nlst` 和 :meth:`ftplib.FTP.dir`:使用 :meth:`ftplib.FTP." -"mlsd`" +":meth:`ftplib.FTP.nlst` 和 :meth:`ftplib.FTP.dir`:使" +"用 :meth:`ftplib.FTP.mlsd`" #: ../../whatsnew/3.3.rst:2235 msgid "" ":func:`platform.popen`: use the :mod:`subprocess` module. Check especially " "the :ref:`subprocess-replacements` section (:issue:`11377`)." msgstr "" -":func:`platform.popen`:使用 :mod:`subprocess` 模組。請特別檢查 :ref:" -"`subprocess-replacements` 部分 (:issue:`11377`)。" +":func:`platform.popen`:使用 :mod:`subprocess` 模組。請特別檢" +"查 :ref:`subprocess-replacements` 部分 (:issue:`11377`)。" #: ../../whatsnew/3.3.rst:2237 msgid "" @@ -3803,8 +3800,8 @@ msgstr "" #: ../../whatsnew/3.3.rst:2242 msgid "" -"The behaviour of :func:`time.clock` depends on the platform: use the new :" -"func:`time.perf_counter` or :func:`time.process_time` function instead, " +"The behaviour of :func:`time.clock` depends on the platform: use the " +"new :func:`time.perf_counter` or :func:`time.process_time` function instead, " "depending on your requirements, to have a well defined behaviour." msgstr "" @@ -3842,17 +3839,17 @@ msgstr "" #: ../../whatsnew/3.3.rst:2272 msgid "" -"Unicode functions and methods using :c:type:`Py_UNICODE` and :c:expr:" -"`Py_UNICODE*` types:" +"Unicode functions and methods using :c:type:`Py_UNICODE` " +"and :c:expr:`Py_UNICODE*` types:" msgstr "" #: ../../whatsnew/3.3.rst:2275 msgid "" -":c:macro:`!PyUnicode_FromUnicode`: use :c:func:`PyUnicode_FromWideChar` or :" -"c:func:`PyUnicode_FromKindAndData`" +":c:macro:`!PyUnicode_FromUnicode`: use :c:func:`PyUnicode_FromWideChar` " +"or :c:func:`PyUnicode_FromKindAndData`" msgstr "" -":c:macro:`!PyUnicode_FromUnicode`:使用 :c:func:`PyUnicode_FromWideChar` 或 :" -"c:func:`PyUnicode_FromKindAndData`" +":c:macro:`!PyUnicode_FromUnicode`:使用 :c:func:`PyUnicode_FromWideChar` " +"或 :c:func:`PyUnicode_FromKindAndData`" #: ../../whatsnew/3.3.rst:2277 msgid "" @@ -3864,19 +3861,19 @@ msgstr "" #: ../../whatsnew/3.3.rst:2279 msgid "" -":c:macro:`!PyUnicode_AS_DATA`: use :c:macro:`PyUnicode_DATA` with :c:macro:" -"`PyUnicode_READ` and :c:macro:`PyUnicode_WRITE`" +":c:macro:`!PyUnicode_AS_DATA`: use :c:macro:`PyUnicode_DATA` " +"with :c:macro:`PyUnicode_READ` and :c:macro:`PyUnicode_WRITE`" msgstr "" -":c:macro:`!PyUnicode_AS_DATA`:將 :c:macro:`PyUnicode_DATA` 與 :c:macro:" -"`PyUnicode_READ` 和 :c:macro:`PyUnicode_WRITE` 一起使用" +":c:macro:`!PyUnicode_AS_DATA`:將 :c:macro:`PyUnicode_DATA` " +"與 :c:macro:`PyUnicode_READ` 和 :c:macro:`PyUnicode_WRITE` 一起使用" #: ../../whatsnew/3.3.rst:2281 msgid "" -":c:macro:`!PyUnicode_GET_SIZE`, :c:func:`!PyUnicode_GetSize`: use :c:macro:" -"`PyUnicode_GET_LENGTH` or :c:func:`PyUnicode_GetLength`" +":c:macro:`!PyUnicode_GET_SIZE`, :c:func:`!PyUnicode_GetSize`: " +"use :c:macro:`PyUnicode_GET_LENGTH` or :c:func:`PyUnicode_GetLength`" msgstr "" -":c:macro:`!PyUnicode_GET_SIZE`、:c:func:`!PyUnicode_GetSize`:使用 :c:macro:" -"`PyUnicode_GET_LENGTH` 或 :c:func:`PyUnicode_GetLength`" +":c:macro:`!PyUnicode_GET_SIZE`、:c:func:`!PyUnicode_GetSize`:使" +"用 :c:macro:`PyUnicode_GET_LENGTH` 或 :c:func:`PyUnicode_GetLength`" #: ../../whatsnew/3.3.rst:2283 msgid "" @@ -3888,11 +3885,11 @@ msgstr "" #: ../../whatsnew/3.3.rst:2286 msgid "" -":c:func:`!PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy` or :c:" -"func:`PyUnicode_AsWideCharString`" +":c:func:`!PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy` " +"or :c:func:`PyUnicode_AsWideCharString`" msgstr "" -":c:func:`!PyUnicode_AsUnicodeCopy`:使用 :c:func:`PyUnicode_AsUCS4Copy` 或 :" -"c:func:`PyUnicode_AsWideCharString`" +":c:func:`!PyUnicode_AsUnicodeCopy`:使用 :c:func:`PyUnicode_AsUCS4Copy` " +"或 :c:func:`PyUnicode_AsWideCharString`" #: ../../whatsnew/3.3.rst:2288 msgid ":c:func:`!PyUnicode_GetMax`" @@ -3904,29 +3901,29 @@ msgstr "操作 Py_UNICODE* 字串的函式和巨集:" #: ../../whatsnew/3.3.rst:2293 msgid "" -":c:macro:`!Py_UNICODE_strlen()`: use :c:func:`PyUnicode_GetLength` or :c:" -"macro:`PyUnicode_GET_LENGTH`" +":c:macro:`!Py_UNICODE_strlen()`: use :c:func:`PyUnicode_GetLength` " +"or :c:macro:`PyUnicode_GET_LENGTH`" msgstr "" -":c:macro:`!Py_UNICODE_strlen()`:使用 :c:func:`PyUnicode_GetLength` 或 :c:" -"macro:`PyUnicode_GET_LENGTH`" +":c:macro:`!Py_UNICODE_strlen()`:使用 :c:func:`PyUnicode_GetLength` " +"或 :c:macro:`PyUnicode_GET_LENGTH`" #: ../../whatsnew/3.3.rst:2295 msgid "" -":c:macro:`!Py_UNICODE_strcat()`: use :c:func:`PyUnicode_CopyCharacters` or :" -"c:func:`PyUnicode_FromFormat`" +":c:macro:`!Py_UNICODE_strcat()`: use :c:func:`PyUnicode_CopyCharacters` " +"or :c:func:`PyUnicode_FromFormat`" msgstr "" -":c:macro:`!Py_UNICODE_strcat()`:使用 :c:func:`PyUnicode_CopyCharacters` 或 :" -"c:func:`PyUnicode_FromFormat`" +":c:macro:`!Py_UNICODE_strcat()`:使用 :c:func:`PyUnicode_CopyCharacters` " +"或 :c:func:`PyUnicode_FromFormat`" #: ../../whatsnew/3.3.rst:2297 msgid "" -":c:macro:`!Py_UNICODE_strcpy()`, :c:macro:`!Py_UNICODE_strncpy()`, :c:macro:" -"`!Py_UNICODE_COPY()`: use :c:func:`PyUnicode_CopyCharacters` or :c:func:" -"`PyUnicode_Substring`" +":c:macro:`!Py_UNICODE_strcpy()`, :c:macro:`!" +"Py_UNICODE_strncpy()`, :c:macro:`!Py_UNICODE_COPY()`: " +"use :c:func:`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`" msgstr "" -":c:macro:`!Py_UNICODE_strcpy()`、:c:macro:`!Py_UNICODE_strncpy()`、:c:macro:" -"`!Py_UNICODE_COPY()`:使用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:" -"`PyUnicode_Substring`" +":c:macro:`!Py_UNICODE_strcpy()`、:c:macro:`!" +"Py_UNICODE_strncpy()`、:c:macro:`!Py_UNICODE_COPY()`:使" +"用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:`PyUnicode_Substring`" #: ../../whatsnew/3.3.rst:2300 msgid ":c:macro:`!Py_UNICODE_strcmp()`: use :c:func:`PyUnicode_Compare`" @@ -3938,11 +3935,11 @@ msgstr ":c:macro:`!Py_UNICODE_strncmp()`: 使用 :c:func:`PyUnicode_Tailmatch`" #: ../../whatsnew/3.3.rst:2302 msgid "" -":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: use :c:" -"func:`PyUnicode_FindChar`" +":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: " +"use :c:func:`PyUnicode_FindChar`" msgstr "" -":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: 使用 :c:" -"func:`PyUnicode_FindChar`" +":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: 使" +"用 :c:func:`PyUnicode_FindChar`" #: ../../whatsnew/3.3.rst:2304 msgid ":c:macro:`!Py_UNICODE_FILL()`: use :c:func:`PyUnicode_Fill`" @@ -3966,11 +3963,11 @@ msgstr ":c:func:`!PyUnicode_EncodeUTF7`" #: ../../whatsnew/3.3.rst:2311 msgid "" -":c:func:`!PyUnicode_EncodeUTF8`: use :c:func:`PyUnicode_AsUTF8` or :c:func:" -"`PyUnicode_AsUTF8String`" +":c:func:`!PyUnicode_EncodeUTF8`: use :c:func:`PyUnicode_AsUTF8` " +"or :c:func:`PyUnicode_AsUTF8String`" msgstr "" -":c:func:`!PyUnicode_EncodeUTF8`:使用 :c:func:`PyUnicode_AsUTF8` 或 :c:func:" -"`PyUnicode_AsUTF8String`" +":c:func:`!PyUnicode_EncodeUTF8`:使用 :c:func:`PyUnicode_AsUTF8` " +"或 :c:func:`PyUnicode_AsUTF8String`" #: ../../whatsnew/3.3.rst:2313 msgid ":c:func:`!PyUnicode_EncodeUTF32`" @@ -3982,19 +3979,19 @@ msgstr ":c:func:`!PyUnicode_EncodeUTF16`" #: ../../whatsnew/3.3.rst:2315 msgid "" -":c:func:`!PyUnicode_EncodeUnicodeEscape` use :c:func:" -"`PyUnicode_AsUnicodeEscapeString`" +":c:func:`!PyUnicode_EncodeUnicodeEscape` " +"use :c:func:`PyUnicode_AsUnicodeEscapeString`" msgstr "" -":c:func:`!PyUnicode_EncodeUnicodeEscape` 使用 :c:func:" -"`PyUnicode_AsUnicodeEscapeString`" +":c:func:`!PyUnicode_EncodeUnicodeEscape` 使" +"用 :c:func:`PyUnicode_AsUnicodeEscapeString`" #: ../../whatsnew/3.3.rst:2317 msgid "" -":c:func:`!PyUnicode_EncodeRawUnicodeEscape` use :c:func:" -"`PyUnicode_AsRawUnicodeEscapeString`" +":c:func:`!PyUnicode_EncodeRawUnicodeEscape` " +"use :c:func:`PyUnicode_AsRawUnicodeEscapeString`" msgstr "" -":c:func:`!PyUnicode_EncodeRawUnicodeEscape` 使用 :c:func:" -"`PyUnicode_AsRawUnicodeEscapeString`" +":c:func:`!PyUnicode_EncodeRawUnicodeEscape` 使" +"用 :c:func:`PyUnicode_AsRawUnicodeEscapeString`" #: ../../whatsnew/3.3.rst:2319 msgid "" @@ -4017,11 +4014,11 @@ msgstr ":c:func:`!PyUnicode_TranslateCharmap`" #: ../../whatsnew/3.3.rst:2323 msgid "" -":c:func:`!PyUnicode_EncodeMBCS`: use :c:func:`PyUnicode_AsMBCSString` or :c:" -"func:`PyUnicode_EncodeCodePage` (with ``CP_ACP`` code_page)" +":c:func:`!PyUnicode_EncodeMBCS`: use :c:func:`PyUnicode_AsMBCSString` " +"or :c:func:`PyUnicode_EncodeCodePage` (with ``CP_ACP`` code_page)" msgstr "" -":c:func:`!PyUnicode_EncodeMBCS`:使用 :c:func:`PyUnicode_AsMBCSString` 或 :c:" -"func:`PyUnicode_EncodeCodePage` (帶有 ``CP_ACP`` code_page)" +":c:func:`!PyUnicode_EncodeMBCS`:使用 :c:func:`PyUnicode_AsMBCSString` " +"或 :c:func:`PyUnicode_EncodeCodePage` (帶有 ``CP_ACP`` code_page)" #: ../../whatsnew/3.3.rst:2325 msgid "" @@ -4058,8 +4055,8 @@ msgstr "移植 Python 程式碼" #: ../../whatsnew/3.3.rst:2347 msgid "" "Hash randomization is enabled by default. Set the :envvar:`PYTHONHASHSEED` " -"environment variable to ``0`` to disable hash randomization. See also the :" -"meth:`object.__hash__` method." +"environment variable to ``0`` to disable hash randomization. See also " +"the :meth:`object.__hash__` method." msgstr "" #: ../../whatsnew/3.3.rst:2351 @@ -4073,19 +4070,19 @@ msgstr "" #: ../../whatsnew/3.3.rst:2357 msgid "" -":issue:`13847`, :issue:`14180`: :mod:`time` and :mod:`datetime`: :exc:" -"`OverflowError` is now raised instead of :exc:`ValueError` if a timestamp is " -"out of range. :exc:`OSError` is now raised if C functions :c:func:`gmtime` " -"or :c:func:`localtime` failed." +":issue:`13847`, :issue:`14180`: :mod:`time` " +"and :mod:`datetime`: :exc:`OverflowError` is now raised instead " +"of :exc:`ValueError` if a timestamp is out of range. :exc:`OSError` is now " +"raised if C functions :c:func:`gmtime` or :c:func:`localtime` failed." msgstr "" #: ../../whatsnew/3.3.rst:2362 msgid "" "The default finders used by import now utilize a cache of what is contained " "within a specific directory. If you create a Python source file or " -"sourceless bytecode file, make sure to call :func:`importlib." -"invalidate_caches` to clear out the cache for the finders to notice the new " -"file." +"sourceless bytecode file, make sure to " +"call :func:`importlib.invalidate_caches` to clear out the cache for the " +"finders to notice the new file." msgstr "" #: ../../whatsnew/3.3.rst:2367 @@ -4103,8 +4100,9 @@ msgid "" "was implemented that the default value remained -1. If you need to continue " "to perform a relative import followed by an absolute import, then perform " "the relative import using an index of 1, followed by another import using an " -"index of 0. It is preferred, though, that you use :func:`importlib." -"import_module` rather than call :func:`__import__` directly." +"index of 0. It is preferred, though, that you " +"use :func:`importlib.import_module` rather than call :func:`__import__` " +"directly." msgstr "" #: ../../whatsnew/3.3.rst:2380 @@ -4124,10 +4122,10 @@ msgstr "" msgid "" "Because ``None`` is now inserted into :data:`sys.path_importer_cache`, if " "you are clearing out entries in the dictionary of paths that do not have a " -"finder, you will need to remove keys paired with values of ``None`` **and** :" -"class:`!imp.NullImporter` to be backwards-compatible. This will lead to " -"extra overhead on older versions of Python that re-insert ``None`` into :" -"data:`sys.path_importer_cache` where it represents the use of implicit " +"finder, you will need to remove keys paired with values of ``None`` " +"**and** :class:`!imp.NullImporter` to be backwards-compatible. This will " +"lead to extra overhead on older versions of Python that re-insert ``None`` " +"into :data:`sys.path_importer_cache` where it represents the use of implicit " "finders, but semantically it should not change anything." msgstr "" @@ -4145,16 +4143,16 @@ msgid "" ":mod:`pkgutil` has been converted to use :mod:`importlib` internally. This " "eliminates many edge cases where the old behaviour of the :pep:`302` import " "emulation failed to match the behaviour of the real import system. The " -"import emulation itself is still present, but is now deprecated. The :func:" -"`pkgutil.iter_importers` and :func:`pkgutil.walk_packages` functions special " -"case the standard import hooks so they are still supported even though they " -"do not provide the non-standard ``iter_modules()`` method." +"import emulation itself is still present, but is now deprecated. " +"The :func:`pkgutil.iter_importers` and :func:`pkgutil.walk_packages` " +"functions special case the standard import hooks so they are still supported " +"even though they do not provide the non-standard ``iter_modules()`` method." msgstr "" #: ../../whatsnew/3.3.rst:2409 msgid "" -"A longstanding RFC-compliance bug (:issue:`1079`) in the parsing done by :" -"func:`email.header.decode_header` has been fixed. Code that uses the " +"A longstanding RFC-compliance bug (:issue:`1079`) in the parsing done " +"by :func:`email.header.decode_header` has been fixed. Code that uses the " "standard idiom to convert encoded headers into unicode " "(``str(make_header(decode_header(h))``) will see no change, but code that " "looks at the individual tuples returned by decode_header will see that " @@ -4176,9 +4174,9 @@ msgstr "" #: ../../whatsnew/3.3.rst:2425 msgid "" ":meth:`poplib.POP3.quit` may now raise protocol errors like all other " -"``poplib`` methods. Code that assumes ``quit`` does not raise :exc:`poplib." -"error_proto` errors may need to be changed if errors on ``quit`` are " -"encountered by a particular application (:issue:`11291`)." +"``poplib`` methods. Code that assumes ``quit`` does not " +"raise :exc:`poplib.error_proto` errors may need to be changed if errors on " +"``quit`` are encountered by a particular application (:issue:`11291`)." msgstr "" #: ../../whatsnew/3.3.rst:2430 @@ -4201,9 +4199,9 @@ msgstr "已棄用的變數 ``time.accept2dyear`` 已被刪除。" #: ../../whatsnew/3.3.rst:2438 msgid "" -"The deprecated ``Context._clamp`` attribute has been removed from the :mod:" -"`decimal` module. It was previously replaced by the public attribute :attr:" -"`~decimal.Context.clamp`. (See :issue:`8540`.)" +"The deprecated ``Context._clamp`` attribute has been removed from " +"the :mod:`decimal` module. It was previously replaced by the public " +"attribute :attr:`~decimal.Context.clamp`. (See :issue:`8540`.)" msgstr "" #: ../../whatsnew/3.3.rst:2442 @@ -4264,16 +4262,16 @@ msgid "" "functions using this type are deprecated (but will stay available for at " "least five years). If you were using low-level Unicode APIs to construct " "and access unicode objects and you want to benefit of the memory footprint " -"reduction provided by :pep:`393`, you have to convert your code to the new :" -"doc:`Unicode API <../c-api/unicode>`." +"reduction provided by :pep:`393`, you have to convert your code to the " +"new :doc:`Unicode API <../c-api/unicode>`." msgstr "" #: ../../whatsnew/3.3.rst:2481 msgid "" -"However, if you only have been using high-level functions such as :c:func:" -"`PyUnicode_Concat()`, :c:func:`PyUnicode_Join` or :c:func:" -"`PyUnicode_FromFormat()`, your code will automatically take advantage of the " -"new unicode representations." +"However, if you only have been using high-level functions such " +"as :c:func:`PyUnicode_Concat()`, :c:func:`PyUnicode_Join` " +"or :c:func:`PyUnicode_FromFormat()`, your code will automatically take " +"advantage of the new unicode representations." msgstr "" #: ../../whatsnew/3.3.rst:2486 @@ -4284,8 +4282,8 @@ msgstr ":c:func:`PyImport_GetMagicNumber` 現在在失敗時回傳 ``-1``。" msgid "" "As a negative value for the *level* argument to :func:`__import__` is no " "longer valid, the same now holds for :c:func:`PyImport_ImportModuleLevel`. " -"This also means that the value of *level* used by :c:func:" -"`PyImport_ImportModuleEx` is now ``0`` instead of ``-1``." +"This also means that the value of *level* used " +"by :c:func:`PyImport_ImportModuleEx` is now ``0`` instead of ``-1``." msgstr "" #: ../../whatsnew/3.3.rst:2495 diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index 2d40afa84d..7c5cc676f0 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-02-05 00:13+0000\n" +"POT-Creation-Date: 2025-02-19 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -53,11 +53,11 @@ msgstr "新增語法特性:" #: ../../whatsnew/3.4.rst:82 msgid "No new syntax features were added in Python 3.4." -msgstr "" +msgstr "Python 3.4 沒有新增任何新的語法特性。" #: ../../whatsnew/3.4.rst:84 msgid "Other new features:" -msgstr "" +msgstr "其他新特性:" #: ../../whatsnew/3.4.rst:86 msgid ":ref:`pip should always be available <whatsnew-pep-453>` (:pep:`453`)." @@ -71,8 +71,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:89 msgid "" -"command line option for :ref:`isolated mode <whatsnew-isolated-mode>` (:" -"issue:`16499`)." +"command line option for :ref:`isolated mode <whatsnew-isolated-mode>` " +"(:issue:`16499`)." msgstr "" #: ../../whatsnew/3.4.rst:91 @@ -83,8 +83,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:93 msgid "" -":ref:`A ModuleSpec Type <whatsnew-pep-451>` for the Import System (:pep:" -"`451`). (Affects importer authors.)" +":ref:`A ModuleSpec Type <whatsnew-pep-451>` for the Import System " +"(:pep:`451`). (Affects importer authors.)" msgstr "" #: ../../whatsnew/3.4.rst:95 @@ -102,30 +102,35 @@ msgid "" ":mod:`asyncio`: :ref:`New provisional API for asynchronous IO <whatsnew-" "asyncio>` (:pep:`3156`)." msgstr "" +":mod:`asyncio`: :ref:`新的用於非同步 IO 的臨時 API <whatsnew-asyncio>` " +"(:pep:`3156`)。" #: ../../whatsnew/3.4.rst:102 msgid "" ":mod:`ensurepip`: :ref:`Bootstrapping the pip installer <whatsnew-" "ensurepip>` (:pep:`453`)." msgstr "" +":mod:`ensurepip`: :ref:`初始建置 pip 安裝程式 <whatsnew-ensurepip>` " +"(:pep:`453`)。" #: ../../whatsnew/3.4.rst:104 msgid "" -":mod:`enum`: :ref:`Support for enumeration types <whatsnew-enum>` (:pep:" -"`435`)." -msgstr "" +":mod:`enum`: :ref:`Support for enumeration types <whatsnew-enum>` " +"(:pep:`435`)." +msgstr ":mod:`enum`: :ref:`支援列舉型別 <whatsnew-enum>` (:pep:`435`)。" #: ../../whatsnew/3.4.rst:106 msgid "" -":mod:`pathlib`: :ref:`Object-oriented filesystem paths <whatsnew-pathlib>` (:" -"pep:`428`)." +":mod:`pathlib`: :ref:`Object-oriented filesystem paths <whatsnew-pathlib>` " +"(:pep:`428`)." msgstr "" +":mod:`pathlib`: :ref:`物件導向檔案系統路徑 <whatsnew-pathlib>` (:pep:`428`)。" #: ../../whatsnew/3.4.rst:108 msgid "" ":mod:`selectors`: :ref:`High-level and efficient I/O multiplexing <whatsnew-" -"selectors>`, built upon the :mod:`select` module primitives (part of :pep:" -"`3156`)." +"selectors>`, built upon the :mod:`select` module primitives (part " +"of :pep:`3156`)." msgstr "" #: ../../whatsnew/3.4.rst:111 @@ -139,34 +144,38 @@ msgid "" ":mod:`tracemalloc`: :ref:`Trace Python memory allocations <whatsnew-" "tracemalloc>` (:pep:`454`)." msgstr "" +":mod:`tracemalloc`: :ref:`追蹤 Python 記憶體配置 <whatsnew-tracemalloc>` " +"(:pep:`454`)。" #: ../../whatsnew/3.4.rst:116 msgid "Significantly improved library modules:" -msgstr "" +msgstr "顯著改進的函式庫模組:" #: ../../whatsnew/3.4.rst:118 msgid "" -":ref:`Single-dispatch generic functions <whatsnew-singledispatch>` in :mod:" -"`functools` (:pep:`443`)." +":ref:`Single-dispatch generic functions <whatsnew-singledispatch>` " +"in :mod:`functools` (:pep:`443`)." msgstr "" #: ../../whatsnew/3.4.rst:120 msgid "" "New :mod:`pickle` :ref:`protocol 4 <whatsnew-protocol-4>` (:pep:`3154`)." -msgstr "" +msgstr "新的 :mod:`pickle` :ref:`協定 4 <whatsnew-protocol-4>` (:pep:`3154`)。" #: ../../whatsnew/3.4.rst:121 msgid "" ":mod:`multiprocessing` now has :ref:`an option to avoid using os.fork on " "Unix <whatsnew-multiprocessing-no-fork>` (:issue:`8713`)." msgstr "" +":mod:`multiprocessing` 現在有\\ :ref:`一個選項可以避免在 Unix 上使用 os.fork " +"<whatsnew-multiprocessing-no-fork>` (:issue:`8713`)。" #: ../../whatsnew/3.4.rst:123 msgid "" -":mod:`email` has a new submodule, :mod:`~email.contentmanager`, and a new :" -"mod:`~email.message.Message` subclass (:class:`~email.contentmanager." -"EmailMessage`) that :ref:`simplify MIME handling " -"<whatsnew_email_contentmanager>` (:issue:`18891`)." +":mod:`email` has a new submodule, :mod:`~email.contentmanager`, and a " +"new :mod:`~email.message.Message` subclass " +"(:class:`~email.contentmanager.EmailMessage`) that :ref:`simplify MIME " +"handling <whatsnew_email_contentmanager>` (:issue:`18891`)." msgstr "" #: ../../whatsnew/3.4.rst:127 @@ -178,7 +187,7 @@ msgstr "" #: ../../whatsnew/3.4.rst:130 msgid "The :mod:`ipaddress` module API has been declared stable" -msgstr "" +msgstr ":mod:`ipaddress` 模組 API 已宣告為穩定版本" #: ../../whatsnew/3.4.rst:132 msgid "Security improvements:" @@ -186,8 +195,8 @@ msgstr "安全性改進:" #: ../../whatsnew/3.4.rst:134 msgid "" -":ref:`Secure and interchangeable hash algorithm <whatsnew-pep-456>` (:pep:" -"`456`)." +":ref:`Secure and interchangeable hash algorithm <whatsnew-pep-456>` " +"(:pep:`456`)." msgstr "" #: ../../whatsnew/3.4.rst:136 @@ -198,9 +207,11 @@ msgstr "" #: ../../whatsnew/3.4.rst:138 msgid "" -"New command line option for :ref:`isolated mode <whatsnew-isolated-mode>`, (:" -"issue:`16499`)." +"New command line option for :ref:`isolated mode <whatsnew-isolated-mode>`, " +"(:issue:`16499`)." msgstr "" +"用於\\ :ref:`隔離模式 <whatsnew-isolated-mode>`\\ 的新命令列選項 " +"(:issue:`16499`)。" #: ../../whatsnew/3.4.rst:140 msgid "" @@ -220,10 +231,12 @@ msgid "" "A new :func:`hashlib.pbkdf2_hmac` function provides the `PKCS#5 password-" "based key derivation function 2 <https://en.wikipedia.org/wiki/PBKDF2>`_." msgstr "" +"新的 :func:`hashlib.pbkdf2_hmac` 函式提供了\\ `基於密碼的 PKCS#5 密鑰生成函" +"式 2 <https://en.wikipedia.org/wiki/PBKDF2>`_。" #: ../../whatsnew/3.4.rst:148 msgid ":ref:`TLSv1.1 and TLSv1.2 support <whatsnew-tls-11-12>` for :mod:`ssl`." -msgstr "" +msgstr ":mod:`ssl` :ref:`對 TLSv1.1 和 TLSv1.2 的支援 <whatsnew-tls-11-12>`。" #: ../../whatsnew/3.4.rst:149 msgid "" @@ -246,14 +259,14 @@ msgstr "" #: ../../whatsnew/3.4.rst:155 msgid "" "All modules in the standard library that support SSL now support server " -"certificate verification, including hostname matching (:func:`ssl." -"match_hostname`) and CRLs (Certificate Revocation lists, see :func:`ssl." -"SSLContext.load_verify_locations`)." +"certificate verification, including hostname matching " +"(:func:`ssl.match_hostname`) and CRLs (Certificate Revocation lists, " +"see :func:`ssl.SSLContext.load_verify_locations`)." msgstr "" #: ../../whatsnew/3.4.rst:160 msgid "CPython implementation improvements:" -msgstr "" +msgstr "CPython 實作改進:" #: ../../whatsnew/3.4.rst:162 msgid ":ref:`Safe object finalization <whatsnew-pep-442>` (:pep:`442`)." @@ -363,7 +376,7 @@ msgstr "" #: ../../whatsnew/3.4.rst:237 msgid "Documentation Changes" -msgstr "" +msgstr "文件更動" #: ../../whatsnew/3.4.rst:239 msgid "" @@ -378,8 +391,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:247 msgid "" "However, as this migration is currently still incomplete, the legacy " -"versions of those guides remaining available as :ref:`install-index` and :" -"ref:`setuptools-index`." +"versions of those guides remaining available as :ref:`install-index` " +"and :ref:`setuptools-index`." msgstr "" #: ../../whatsnew/3.4.rst:253 @@ -413,21 +426,19 @@ msgstr "" #: ../../whatsnew/3.4.rst:272 msgid ":func:`os.get_inheritable`, :func:`os.set_inheritable`" -msgstr ":func:`os.get_inheritable`, :func:`os.set_inheritable`" +msgstr ":func:`os.get_inheritable`、:func:`os.set_inheritable`" #: ../../whatsnew/3.4.rst:273 msgid ":func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`" -msgstr ":func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`" +msgstr ":func:`os.get_handle_inheritable`、:func:`os.set_handle_inheritable`" #: ../../whatsnew/3.4.rst:274 -msgid "" -":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" -msgstr "" -":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" +msgid ":meth:`socket.socket.get_inheritable`, :meth:`socket.socket.set_inheritable`" +msgstr ":meth:`socket.socket.get_inheritable`、:meth:`socket.socket.set_inheritable`" #: ../../whatsnew/3.4.rst:278 msgid ":pep:`446` -- Make newly created file descriptors non-inheritable" -msgstr "" +msgstr ":pep:`446` - 使新建立的檔案描述器不可繼承" #: ../../whatsnew/3.4.rst:279 ../../whatsnew/3.4.rst:1811 msgid "PEP written and implemented by Victor Stinner." @@ -435,7 +446,7 @@ msgstr "由 Victor Stinner 撰寫 PEP 與實作。" #: ../../whatsnew/3.4.rst:285 msgid "Improvements to Codec Handling" -msgstr "" +msgstr "編解碼器處理的改進" #: ../../whatsnew/3.4.rst:287 msgid "" @@ -448,19 +459,20 @@ msgstr "" #: ../../whatsnew/3.4.rst:294 msgid "" -"As a key step in clarifying the situation, the :meth:`codecs.encode` and :" -"meth:`codecs.decode` convenience functions are now properly documented in " -"Python 2.7, 3.3 and 3.4. These functions have existed in the :mod:`codecs` " -"module (and have been covered by the regression test suite) since Python " -"2.4, but were previously only discoverable through runtime introspection." +"As a key step in clarifying the situation, the :meth:`codecs.encode` " +"and :meth:`codecs.decode` convenience functions are now properly documented " +"in Python 2.7, 3.3 and 3.4. These functions have existed in " +"the :mod:`codecs` module (and have been covered by the regression test " +"suite) since Python 2.4, but were previously only discoverable through " +"runtime introspection." msgstr "" #: ../../whatsnew/3.4.rst:300 msgid "" -"Unlike the convenience methods on :class:`str`, :class:`bytes` and :class:" -"`bytearray`, the :mod:`codecs` convenience functions support arbitrary " -"codecs in both Python 2 and Python 3, rather than being limited to Unicode " -"text encodings (in Python 3) or ``basestring`` <-> ``basestring`` " +"Unlike the convenience methods on :class:`str`, :class:`bytes` " +"and :class:`bytearray`, the :mod:`codecs` convenience functions support " +"arbitrary codecs in both Python 2 and Python 3, rather than being limited to " +"Unicode text encodings (in Python 3) or ``basestring`` <-> ``basestring`` " "conversions (in Python 2)." msgstr "" @@ -568,6 +580,11 @@ msgid "" ">>> decode(b\"68656c6c6f\", \"hex\")\n" "b'hello'" msgstr "" +">>> from codecs import encode, decode\n" +">>> encode(b\"hello\", \"hex\")\n" +"b'68656c6c6f'\n" +">>> decode(b\"68656c6c6f\", \"hex\")\n" +"b'hello'" #: ../../whatsnew/3.4.rst:370 msgid "" @@ -577,15 +594,15 @@ msgstr "" #: ../../whatsnew/3.4.rst:373 msgid "" -"(Contributed by Nick Coghlan in :issue:`7475`, :issue:`17827`, :issue:" -"`17828` and :issue:`19619`.)" +"(Contributed by Nick Coghlan " +"in :issue:`7475`, :issue:`17827`, :issue:`17828` and :issue:`19619`.)" msgstr "" -"(由 Nick Coghlan 在 :issue:`7475`、:issue:`17827`、:issue:`17828` 和 :issue:" -"`19619` 中貢獻。)" +"(由 Nick Coghlan 在 :issue:`7475`、:issue:`17827`、:issue:`17828` " +"和 :issue:`19619` 中貢獻。)" #: ../../whatsnew/3.4.rst:380 msgid "PEP 451: A ModuleSpec Type for the Import System" -msgstr "" +msgstr "PEP 451:用於引入系統的 ModuleSpec 型別" #: ../../whatsnew/3.4.rst:382 msgid "" @@ -602,9 +619,9 @@ msgid "" "Furthermore, they should be transparent to everyone but importer authors. " "Key finder and loader methods have been deprecated, but they will continue " "working. New importers should use the new methods described in the PEP. " -"Existing importers should be updated to implement the new methods. See the :" -"ref:`deprecated-3.4` section for a list of methods that should be replaced " -"and their replacements." +"Existing importers should be updated to implement the new methods. See " +"the :ref:`deprecated-3.4` section for a list of methods that should be " +"replaced and their replacements." msgstr "" #: ../../whatsnew/3.4.rst:400 @@ -623,8 +640,8 @@ msgstr "" msgid "" ":func:`min` and :func:`max` now accept a *default* keyword-only argument " "that can be used to specify the value they return if the iterable they are " -"evaluating has no elements. (Contributed by Julian Berman in :issue:" -"`18111`.)" +"evaluating has no elements. (Contributed by Julian Berman " +"in :issue:`18111`.)" msgstr "" #: ../../whatsnew/3.4.rst:411 @@ -634,9 +651,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:413 msgid "" "Module ``__file__`` attributes (and related values) should now always " -"contain absolute paths by default, with the sole exception of ``__main__." -"__file__`` when a script has been executed directly using a relative path. " -"(Contributed by Brett Cannon in :issue:`18416`.)" +"contain absolute paths by default, with the sole exception of " +"``__main__.__file__`` when a script has been executed directly using a " +"relative path. (Contributed by Brett Cannon in :issue:`18416`.)" msgstr "" #: ../../whatsnew/3.4.rst:418 @@ -664,8 +681,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:431 msgid "" ":class:`bytes`.join() and :class:`bytearray`.join() now accept arbitrary " -"buffer objects as arguments. (Contributed by Antoine Pitrou in :issue:" -"`15958`.)" +"buffer objects as arguments. (Contributed by Antoine Pitrou " +"in :issue:`15958`.)" msgstr "" #: ../../whatsnew/3.4.rst:435 @@ -684,9 +701,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:443 msgid "" -":class:`memoryview` is now registered as a :class:`Sequence <collections." -"abc>`, and supports the :func:`reversed` builtin. (Contributed by Nick " -"Coghlan and Claudiu Popa in :issue:`18690` and :issue:`19078`.)" +":class:`memoryview` is now registered as a :class:`Sequence " +"<collections.abc>`, and supports the :func:`reversed` builtin. (Contributed " +"by Nick Coghlan and Claudiu Popa in :issue:`18690` and :issue:`19078`.)" msgstr "" #: ../../whatsnew/3.4.rst:447 @@ -699,8 +716,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:451 msgid "" ":meth:`~object.__length_hint__` is now part of the formal language " -"specification (see :pep:`424`). (Contributed by Armin Ronacher in :issue:" -"`16148`.)" +"specification (see :pep:`424`). (Contributed by Armin Ronacher " +"in :issue:`16148`.)" msgstr "" #: ../../whatsnew/3.4.rst:457 @@ -737,11 +754,11 @@ msgstr "ensurepip" #: ../../whatsnew/3.4.rst:483 msgid "" -"The new :mod:`ensurepip` module is the primary infrastructure for the :pep:" -"`453` implementation. In the normal course of events end users will not " -"need to interact with this module, but it can be used to manually bootstrap " -"``pip`` if the automated bootstrapping into an installation or virtual " -"environment was declined." +"The new :mod:`ensurepip` module is the primary infrastructure for " +"the :pep:`453` implementation. In the normal course of events end users " +"will not need to interact with this module, but it can be used to manually " +"bootstrap ``pip`` if the automated bootstrapping into an installation or " +"virtual environment was declined." msgstr "" #: ../../whatsnew/3.4.rst:489 @@ -771,10 +788,10 @@ msgstr "enum" #: ../../whatsnew/3.4.rst:509 msgid "" "The new :mod:`enum` module (defined in :pep:`435`) provides a standard " -"implementation of enumeration types, allowing other modules (such as :mod:" -"`socket`) to provide more informative error messages and better debugging " -"support by replacing opaque integer constants with backwards compatible " -"enumeration values." +"implementation of enumeration types, allowing other modules (such " +"as :mod:`socket`) to provide more informative error messages and better " +"debugging support by replacing opaque integer constants with backwards " +"compatible enumeration values." msgstr "" #: ../../whatsnew/3.4.rst:517 @@ -814,9 +831,9 @@ msgstr "selectors" #: ../../whatsnew/3.4.rst:546 msgid "" -"The new :mod:`selectors` module (created as part of implementing :pep:" -"`3156`) allows high-level and efficient I/O multiplexing, built upon the :" -"mod:`select` module primitives." +"The new :mod:`selectors` module (created as part of " +"implementing :pep:`3156`) allows high-level and efficient I/O multiplexing, " +"built upon the :mod:`select` module primitives." msgstr "" #: ../../whatsnew/3.4.rst:554 @@ -916,9 +933,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:615 ../../whatsnew/3.4.rst:1542 msgid "" -"The :meth:`!writeframesraw` and :meth:`!writeframes` methods now accept any :" -"term:`bytes-like object`. (Contributed by Serhiy Storchaka in :issue:" -"`8311`.)" +"The :meth:`!writeframesraw` and :meth:`!writeframes` methods now accept " +"any :term:`bytes-like object`. (Contributed by Serhiy Storchaka " +"in :issue:`8311`.)" msgstr "" #: ../../whatsnew/3.4.rst:621 @@ -961,21 +978,22 @@ msgstr "base64" #: ../../whatsnew/3.4.rst:646 msgid "" -"The encoding and decoding functions in :mod:`base64` now accept any :term:" -"`bytes-like object` in cases where it previously required a :class:`bytes` " -"or :class:`bytearray` instance. (Contributed by Nick Coghlan in :issue:" -"`17839`.)" +"The encoding and decoding functions in :mod:`base64` now accept " +"any :term:`bytes-like object` in cases where it previously required " +"a :class:`bytes` or :class:`bytearray` instance. (Contributed by Nick " +"Coghlan in :issue:`17839`.)" msgstr "" #: ../../whatsnew/3.4.rst:651 msgid "" -"New functions :func:`~base64.a85encode`, :func:`~base64.a85decode`, :func:" -"`~base64.b85encode`, and :func:`~base64.b85decode` provide the ability to " -"encode and decode binary data from and to ``Ascii85`` and the git/mercurial " -"``Base85`` formats, respectively. The ``a85`` functions have options that " -"can be used to make them compatible with the variants of the ``Ascii85`` " -"encoding, including the Adobe variant. (Contributed by Martin Morrison, the " -"Mercurial project, Serhiy Storchaka, and Antoine Pitrou in :issue:`17618`.)" +"New " +"functions :func:`~base64.a85encode`, :func:`~base64.a85decode`, :func:`~base64.b85encode`, " +"and :func:`~base64.b85decode` provide the ability to encode and decode " +"binary data from and to ``Ascii85`` and the git/mercurial ``Base85`` " +"formats, respectively. The ``a85`` functions have options that can be used " +"to make them compatible with the variants of the ``Ascii85`` encoding, " +"including the Adobe variant. (Contributed by Martin Morrison, the Mercurial " +"project, Serhiy Storchaka, and Antoine Pitrou in :issue:`17618`.)" msgstr "" #: ../../whatsnew/3.4.rst:661 @@ -1017,21 +1035,21 @@ msgstr "" #: ../../whatsnew/3.4.rst:686 msgid "" "The new :func:`contextlib.redirect_stdout` context manager makes it easier " -"for utility scripts to handle inflexible APIs that write their output to :" -"data:`sys.stdout` and don't provide any options to redirect it. Using the " -"context manager, the :data:`sys.stdout` output can be redirected to any " +"for utility scripts to handle inflexible APIs that write their output " +"to :data:`sys.stdout` and don't provide any options to redirect it. Using " +"the context manager, the :data:`sys.stdout` output can be redirected to any " "other stream or, in conjunction with :class:`io.StringIO`, to a string. The " "latter can be especially useful, for example, to capture output from a " "function that was written to implement a command line interface. It is " -"recommended only for utility scripts because it affects the global state of :" -"data:`sys.stdout`. (Contributed by Raymond Hettinger in :issue:`15805`.)" +"recommended only for utility scripts because it affects the global state " +"of :data:`sys.stdout`. (Contributed by Raymond Hettinger in :issue:`15805`.)" msgstr "" #: ../../whatsnew/3.4.rst:697 msgid "" -"The :mod:`contextlib` documentation has also been updated to include a :ref:" -"`discussion <single-use-reusable-and-reentrant-cms>` of the differences " -"between single use, reusable and reentrant context managers." +"The :mod:`contextlib` documentation has also been updated to include " +"a :ref:`discussion <single-use-reusable-and-reentrant-cms>` of the " +"differences between single use, reusable and reentrant context managers." msgstr "" #: ../../whatsnew/3.4.rst:703 @@ -1052,8 +1070,8 @@ msgstr "dis" #: ../../whatsnew/3.4.rst:714 msgid "" -"Functions :func:`~dis.show_code`, :func:`~dis.dis`, :func:`~dis.distb`, and :" -"func:`~dis.disassemble` now accept a keyword-only *file* argument that " +"Functions :func:`~dis.show_code`, :func:`~dis.dis`, :func:`~dis.distb`, " +"and :func:`~dis.disassemble` now accept a keyword-only *file* argument that " "controls where they write their output." msgstr "" @@ -1101,12 +1119,13 @@ msgstr "" msgid "" "In addition, a new application-friendly class :class:`~dis.Bytecode` " "provides an object-oriented API for inspecting bytecode in both in human-" -"readable form and for iterating over instructions. The :class:`~dis." -"Bytecode` constructor takes the same arguments that :func:`~dis." -"get_instruction` does (plus an optional *current_offset*), and the resulting " -"object can be iterated to produce :class:`~dis.Instruction` objects. But it " -"also has a :mod:`~dis.Bytecode.dis` method, equivalent to calling :mod:`~dis." -"dis` on the constructor argument, but returned as a multi-line string::" +"readable form and for iterating over instructions. " +"The :class:`~dis.Bytecode` constructor takes the same arguments " +"that :func:`~dis.get_instruction` does (plus an optional *current_offset*), " +"and the resulting object can be iterated to " +"produce :class:`~dis.Instruction` objects. But it also has " +"a :mod:`~dis.Bytecode.dis` method, equivalent to calling :mod:`~dis.dis` on " +"the constructor argument, but returned as a multi-line string::" msgstr "" #: ../../whatsnew/3.4.rst:748 @@ -1118,25 +1137,37 @@ msgid "" "LOAD_CONST (100)\n" "BINARY_ADD (23)\n" "RETURN_VALUE (83)\n" -">>> bytecode.dis().splitlines() \n" +">>> bytecode.dis().splitlines()\n" "[' 1 0 LOAD_FAST 0 (x)',\n" " ' --> 3 LOAD_CONST 1 (1)',\n" " ' 6 BINARY_ADD',\n" " ' 7 RETURN_VALUE']" msgstr "" +">>> bytecode = dis.Bytecode(lambda x: x + 1, current_offset=3)\n" +">>> for instr in bytecode:\n" +"... print('{} ({})'.format(instr.opname, instr.opcode))\n" +"LOAD_FAST (124)\n" +"LOAD_CONST (100)\n" +"BINARY_ADD (23)\n" +"RETURN_VALUE (83)\n" +">>> bytecode.dis().splitlines()\n" +"[' 1 0 LOAD_FAST 0 (x)',\n" +" ' --> 3 LOAD_CONST 1 (1)',\n" +" ' 6 BINARY_ADD',\n" +" ' 7 RETURN_VALUE']" #: ../../whatsnew/3.4.rst:761 msgid "" -":class:`~dis.Bytecode` also has a class method, :meth:`~dis.Bytecode." -"from_traceback`, that provides the ability to manipulate a traceback (that " -"is, ``print(Bytecode.from_traceback(tb).dis())`` is equivalent to " -"``distb(tb)``)." +":class:`~dis.Bytecode` also has a class " +"method, :meth:`~dis.Bytecode.from_traceback`, that provides the ability to " +"manipulate a traceback (that is, " +"``print(Bytecode.from_traceback(tb).dis())`` is equivalent to ``distb(tb)``)." msgstr "" #: ../../whatsnew/3.4.rst:766 msgid "" -"(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver in :issue:" -"`11816` and Claudiu Popa in :issue:`17916`.)" +"(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver " +"in :issue:`11816` and Claudiu Popa in :issue:`17916`.)" msgstr "" "(由 Nick Coghlan、Ryan Kelly 和 Thomas Kluyver 在 :issue:`11816` 中以及 " "Claudiu Popa 在 :issue:`17916` 中貢獻。)" @@ -1165,8 +1196,8 @@ msgid "" "two new options, ``-o`` and ``-f``. ``-o`` allows :ref:`doctest options " "<doctest-options>` to be specified on the command line, and ``-f`` is a " "shorthand for ``-o FAIL_FAST`` (to parallel the similar option supported by " -"the :mod:`unittest` CLI). (Contributed by R. David Murray in :issue:" -"`11390`.)" +"the :mod:`unittest` CLI). (Contributed by R. David Murray " +"in :issue:`11390`.)" msgstr "" #: ../../whatsnew/3.4.rst:787 @@ -1194,10 +1225,10 @@ msgid "" "New method :meth:`~email.message.Message.as_bytes` added to produce a bytes " "representation of the message in a fashion similar to how ``as_string`` " "produces a string representation. It does not accept the *maxheaderlen* " -"argument, but does accept the *unixfrom* and *policy* arguments. The :class:" -"`~email.message.Message` :meth:`~email.message.Message.__bytes__` method " -"calls it, meaning that ``bytes(mymsg)`` will now produce the intuitive " -"result: a bytes object containing the fully formatted message. " +"argument, but does accept the *unixfrom* and *policy* arguments. " +"The :class:`~email.message.Message` :meth:`~email.message.Message.__bytes__` " +"method calls it, meaning that ``bytes(mymsg)`` will now produce the " +"intuitive result: a bytes object containing the fully formatted message. " "(Contributed by R. David Murray in :issue:`18600`.)" msgstr "" @@ -1206,8 +1237,8 @@ msgid "" "The :meth:`.Message.set_param` message now accepts a *replace* keyword " "argument. When specified, the associated header will be updated without " "changing its location in the list of headers. For backward compatibility, " -"the default is ``False``. (Contributed by R. David Murray in :issue:" -"`18891`.)" +"the default is ``False``. (Contributed by R. David Murray " +"in :issue:`18891`.)" msgstr "" #: ../../whatsnew/3.4.rst:818 @@ -1219,12 +1250,13 @@ msgid "" "documentation is currently in the new module, which is being added as part " "of email's new :term:`provisional API`. These classes provide a number of " "new methods that make extracting content from and inserting content into " -"email messages much easier. For details, see the :mod:`~email." -"contentmanager` documentation and the :ref:`email-examples`. These API " -"additions complete the bulk of the work that was planned as part of the " -"email6 project. The currently provisional API is scheduled to become final " -"in Python 3.5 (possibly with a few minor additions in the area of error " -"handling). (Contributed by R. David Murray in :issue:`18891`.)" +"email messages much easier. For details, see " +"the :mod:`~email.contentmanager` documentation and the :ref:`email-" +"examples`. These API additions complete the bulk of the work that was " +"planned as part of the email6 project. The currently provisional API is " +"scheduled to become final in Python 3.5 (possibly with a few minor additions " +"in the area of error handling). (Contributed by R. David Murray " +"in :issue:`18891`.)" msgstr "" #: ../../whatsnew/3.4.rst:834 @@ -1245,8 +1277,8 @@ msgstr "" msgid "" "New module attribute :const:`~filecmp.DEFAULT_IGNORES` provides the list of " "directories that are used as the default value for the *ignore* parameter of " -"the :func:`~filecmp.dircmp` function. (Contributed by Eli Bendersky in :" -"issue:`15442`.)" +"the :func:`~filecmp.dircmp` function. (Contributed by Eli Bendersky " +"in :issue:`15442`.)" msgstr "" #: ../../whatsnew/3.4.rst:850 @@ -1283,9 +1315,9 @@ msgstr "由 Łukasz Langa 撰寫 PEP 與實作。" #: ../../whatsnew/3.4.rst:873 msgid "" -":func:`~functools.total_ordering` now supports a return value of :data:" -"`NotImplemented` from the underlying comparison function. (Contributed by " -"Katie Miller in :issue:`10042`.)" +":func:`~functools.total_ordering` now supports a return value " +"of :data:`NotImplemented` from the underlying comparison function. " +"(Contributed by Katie Miller in :issue:`10042`.)" msgstr "" #: ../../whatsnew/3.4.rst:877 @@ -1329,15 +1361,18 @@ msgid "" "based key derivation function 2 <https://en.wikipedia.org/wiki/PBKDF2>`_. " "(Contributed by Christian Heimes in :issue:`18582`.)" msgstr "" +"新的 :func:`hashlib.pbkdf2_hmac` 函式提供了\\ `基於密碼的 PKCS#5 密鑰生成函" +"式 2 <https://en.wikipedia.org/wiki/PBKDF2>`_。(由 Christian Heimes " +"在 :issue:`18582` 中貢獻。)" #: ../../whatsnew/3.4.rst:907 msgid "" "The :attr:`~hashlib.hash.name` attribute of :mod:`hashlib` hash objects is " -"now a formally supported interface. It has always existed in CPython's :mod:" -"`hashlib` (although it did not return lower case names for all supported " -"hashes), but it was not a public interface and so some other Python " -"implementations have not previously supported it. (Contributed by Jason R. " -"Coombs in :issue:`18532`.)" +"now a formally supported interface. It has always existed in " +"CPython's :mod:`hashlib` (although it did not return lower case names for " +"all supported hashes), but it was not a public interface and so some other " +"Python implementations have not previously supported it. (Contributed by " +"Jason R. Coombs in :issue:`18532`.)" msgstr "" #: ../../whatsnew/3.4.rst:916 @@ -1364,10 +1399,11 @@ msgstr "" #: ../../whatsnew/3.4.rst:930 msgid "" -"With the addition of :attr:`~hmac.HMAC.block_size` and :attr:`~hmac.HMAC." -"name` attributes (and the formal documentation of the :attr:`~hmac.HMAC." -"digest_size` attribute), the :mod:`hmac` module now conforms fully to the :" -"pep:`247` API. (Contributed by Christian Heimes in :issue:`18775`.)" +"With the addition of :attr:`~hmac.HMAC.block_size` " +"and :attr:`~hmac.HMAC.name` attributes (and the formal documentation of " +"the :attr:`~hmac.HMAC.digest_size` attribute), the :mod:`hmac` module now " +"conforms fully to the :pep:`247` API. (Contributed by Christian Heimes " +"in :issue:`18775`.)" msgstr "" #: ../../whatsnew/3.4.rst:937 @@ -1406,9 +1442,9 @@ msgid "" ":meth:`~http.server.BaseHTTPRequestHandler.send_error` now accepts an " "optional additional *explain* parameter which can be used to provide an " "extended error description, overriding the hardcoded default if there is " -"one. This extended error description will be formatted using the :attr:" -"`~http.server.HTTP.error_message_format` attribute and sent as the body of " -"the error response. (Contributed by Karl Cow in :issue:`12921`.)" +"one. This extended error description will be formatted using " +"the :attr:`~http.server.HTTP.error_message_format` attribute and sent as the " +"body of the error response. (Contributed by Karl Cow in :issue:`12921`.)" msgstr "" #: ../../whatsnew/3.4.rst:964 @@ -1425,10 +1461,10 @@ msgstr "idlelib 與 IDLE" #: ../../whatsnew/3.4.rst:972 msgid "" "Since idlelib implements the IDLE shell and editor and is not intended for " -"import by other programs, it gets improvements with every release. See :file:" -"`Lib/idlelib/NEWS.txt` for a cumulative list of changes since 3.3.0, as well " -"as changes made in future 3.4.x releases. This file is also available from " -"the IDLE :menuselection:`Help --> About IDLE` dialog." +"import by other programs, it gets improvements with every release. " +"See :file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since " +"3.3.0, as well as changes made in future 3.4.x releases. This file is also " +"available from the IDLE :menuselection:`Help --> About IDLE` dialog." msgstr "" #: ../../whatsnew/3.4.rst:980 @@ -1437,11 +1473,12 @@ msgstr "importlib" #: ../../whatsnew/3.4.rst:982 msgid "" -"The :class:`~importlib.abc.InspectLoader` ABC defines a new method, :meth:" -"`~importlib.abc.InspectLoader.source_to_code` that accepts source data and a " -"path and returns a code object. The default implementation is equivalent to " -"``compile(data, path, 'exec', dont_inherit=True)``. (Contributed by Eric " -"Snow and Brett Cannon in :issue:`15627`.)" +"The :class:`~importlib.abc.InspectLoader` ABC defines a new " +"method, :meth:`~importlib.abc.InspectLoader.source_to_code` that accepts " +"source data and a path and returns a code object. The default " +"implementation is equivalent to ``compile(data, path, 'exec', " +"dont_inherit=True)``. (Contributed by Eric Snow and Brett Cannon " +"in :issue:`15627`.)" msgstr "" #: ../../whatsnew/3.4.rst:988 @@ -1454,9 +1491,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:993 msgid "" -"The :func:`~importlib.reload` function has been moved from :mod:`!imp` to :" -"mod:`importlib` as part of the :mod:`!imp` module deprecation. (Contributed " -"by Berker Peksag in :issue:`18193`.)" +"The :func:`~importlib.reload` function has been moved from :mod:`!imp` " +"to :mod:`importlib` as part of the :mod:`!imp` module deprecation. " +"(Contributed by Berker Peksag in :issue:`18193`.)" msgstr "" #: ../../whatsnew/3.4.rst:997 @@ -1469,34 +1506,35 @@ msgstr "" #: ../../whatsnew/3.4.rst:1002 msgid "" -"New :mod:`importlib.util` functions :func:`~importlib.util." -"cache_from_source` and :func:`~importlib.util.source_from_cache` replace the " -"same-named functions in the deprecated :mod:`!imp` module. (Contributed by " -"Brett Cannon in :issue:`18194`.)" +"New :mod:`importlib.util` " +"functions :func:`~importlib.util.cache_from_source` " +"and :func:`~importlib.util.source_from_cache` replace the same-named " +"functions in the deprecated :mod:`!imp` module. (Contributed by Brett " +"Cannon in :issue:`18194`.)" msgstr "" #: ../../whatsnew/3.4.rst:1007 msgid "" "The :mod:`importlib` bootstrap :class:`.NamespaceLoader` now conforms to " -"the :class:`.InspectLoader` ABC, which means that ``runpy`` and ``python -" -"m`` can now be used with namespace packages. (Contributed by Brett Cannon " +"the :class:`.InspectLoader` ABC, which means that ``runpy`` and ``python " +"-m`` can now be used with namespace packages. (Contributed by Brett Cannon " "in :issue:`18058`.)" msgstr "" #: ../../whatsnew/3.4.rst:1012 msgid "" -":mod:`importlib.util` has a new function :func:`~importlib.util." -"decode_source` that decodes source from bytes using universal newline " -"processing. This is useful for implementing :meth:`.InspectLoader." -"get_source` methods." +":mod:`importlib.util` has a new " +"function :func:`~importlib.util.decode_source` that decodes source from " +"bytes using universal newline processing. This is useful for " +"implementing :meth:`.InspectLoader.get_source` methods." msgstr "" #: ../../whatsnew/3.4.rst:1016 msgid "" -":class:`importlib.machinery.ExtensionFileLoader` now has a :meth:`~importlib." -"machinery.ExtensionFileLoader.get_filename` method. This was inadvertently " -"omitted in the original implementation. (Contributed by Eric Snow in :issue:" -"`19152`.)" +":class:`importlib.machinery.ExtensionFileLoader` now has " +"a :meth:`~importlib.machinery.ExtensionFileLoader.get_filename` method. " +"This was inadvertently omitted in the original implementation. (Contributed " +"by Eric Snow in :issue:`19152`.)" msgstr "" #: ../../whatsnew/3.4.rst:1023 @@ -1521,21 +1559,23 @@ msgstr "" #: ../../whatsnew/3.4.rst:1035 msgid "" -"As part of the implementation of the new :mod:`enum` module, the :mod:" -"`inspect` module now has substantially better support for custom ``__dir__`` " -"methods and dynamic class attributes provided through metaclasses. " -"(Contributed by Ethan Furman in :issue:`18929` and :issue:`19030`.)" +"As part of the implementation of the new :mod:`enum` module, " +"the :mod:`inspect` module now has substantially better support for custom " +"``__dir__`` methods and dynamic class attributes provided through " +"metaclasses. (Contributed by Ethan Furman in :issue:`18929` " +"and :issue:`19030`.)" msgstr "" #: ../../whatsnew/3.4.rst:1041 msgid "" -":func:`~inspect.getfullargspec` and :func:`~inspect.getargspec` now use the :" -"func:`~inspect.signature` API. This allows them to support a much broader " -"range of callables, including those with ``__signature__`` attributes, those " -"with metadata provided by argument clinic, :func:`functools.partial` objects " -"and more. Note that, unlike :func:`~inspect.signature`, these functions " -"still ignore ``__wrapped__`` attributes, and report the already bound first " -"argument for bound methods, so it is still necessary to update your code to " +":func:`~inspect.getfullargspec` and :func:`~inspect.getargspec` now use " +"the :func:`~inspect.signature` API. This allows them to support a much " +"broader range of callables, including those with ``__signature__`` " +"attributes, those with metadata provided by argument " +"clinic, :func:`functools.partial` objects and more. Note that, " +"unlike :func:`~inspect.signature`, these functions still ignore " +"``__wrapped__`` attributes, and report the already bound first argument for " +"bound methods, so it is still necessary to update your code to " "use :func:`~inspect.signature` directly if those features are desired. " "(Contributed by Yury Selivanov in :issue:`17481`.)" msgstr "" @@ -1553,17 +1593,18 @@ msgstr "ipaddress" #: ../../whatsnew/3.4.rst:1060 msgid "" -":mod:`ipaddress` was added to the standard library in Python 3.3 as a :term:" -"`provisional API`. With the release of Python 3.4, this qualification has " -"been removed: :mod:`ipaddress` is now considered a stable API, covered by " -"the normal standard library requirements to maintain backwards compatibility." +":mod:`ipaddress` was added to the standard library in Python 3.3 as " +"a :term:`provisional API`. With the release of Python 3.4, this " +"qualification has been removed: :mod:`ipaddress` is now considered a stable " +"API, covered by the normal standard library requirements to maintain " +"backwards compatibility." msgstr "" #: ../../whatsnew/3.4.rst:1066 msgid "" "A new :attr:`~ipaddress.IPv4Address.is_global` property is ``True`` if an " -"address is globally routeable. (Contributed by Peter Moody in :issue:" -"`17400`.)" +"address is globally routeable. (Contributed by Peter Moody " +"in :issue:`17400`.)" msgstr "" #: ../../whatsnew/3.4.rst:1072 @@ -1579,27 +1620,29 @@ msgstr "" #: ../../whatsnew/3.4.rst:1078 msgid "" -":class:`~logging.handlers.SocketHandler` and :class:`~logging.handlers." -"DatagramHandler` now support Unix domain sockets (by setting *port* to " -"``None``). (Contributed by Vinay Sajip in commit ce46195b56a9.)" +":class:`~logging.handlers.SocketHandler` " +"and :class:`~logging.handlers.DatagramHandler` now support Unix domain " +"sockets (by setting *port* to ``None``). (Contributed by Vinay Sajip in " +"commit ce46195b56a9.)" msgstr "" #: ../../whatsnew/3.4.rst:1083 msgid "" -":func:`~logging.config.fileConfig` now accepts a :class:`configparser." -"RawConfigParser` subclass instance for the *fname* parameter. This " -"facilitates using a configuration file when logging configuration is just a " -"part of the overall application configuration, or where the application " -"modifies the configuration before passing it to :func:`~logging.config." -"fileConfig`. (Contributed by Vinay Sajip in :issue:`16110`.)" +":func:`~logging.config.fileConfig` now accepts " +"a :class:`configparser.RawConfigParser` subclass instance for the *fname* " +"parameter. This facilitates using a configuration file when logging " +"configuration is just a part of the overall application configuration, or " +"where the application modifies the configuration before passing it " +"to :func:`~logging.config.fileConfig`. (Contributed by Vinay Sajip " +"in :issue:`16110`.)" msgstr "" #: ../../whatsnew/3.4.rst:1091 msgid "" -"Logging configuration data received from a socket via the :func:`logging." -"config.listen` function can now be validated before being processed by " -"supplying a verification function as the argument to the new *verify* " -"keyword argument. (Contributed by Vinay Sajip in :issue:`15452`.)" +"Logging configuration data received from a socket via " +"the :func:`logging.config.listen` function can now be validated before being " +"processed by supplying a verification function as the argument to the new " +"*verify* keyword argument. (Contributed by Vinay Sajip in :issue:`15452`.)" msgstr "" #: ../../whatsnew/3.4.rst:1100 @@ -1612,11 +1655,11 @@ msgid "" "implementing the new version restores the Python2 behavior of recording only " "one copy of interned strings and preserving the interning on " "deserialization, and extends this \"one copy\" ability to any object type " -"(including handling recursive references). This reduces both the size of ``." -"pyc`` files and the amount of memory a module occupies in memory when it is " -"loaded from a ``.pyc`` (or ``.pyo``) file. (Contributed by Kristján Valur " -"Jónsson in :issue:`16475`, with additional speedups by Antoine Pitrou in :" -"issue:`19219`.)" +"(including handling recursive references). This reduces both the size of " +"``.pyc`` files and the amount of memory a module occupies in memory when it " +"is loaded from a ``.pyc`` (or ``.pyo``) file. (Contributed by Kristján " +"Valur Jónsson in :issue:`16475`, with additional speedups by Antoine Pitrou " +"in :issue:`19219`.)" msgstr "" #: ../../whatsnew/3.4.rst:1113 @@ -1636,12 +1679,13 @@ msgstr "multiprocessing" #: ../../whatsnew/3.4.rst:1124 msgid "" "On Unix two new :ref:`start methods <multiprocessing-start-methods>`, " -"``spawn`` and ``forkserver``, have been added for starting processes using :" -"mod:`multiprocessing`. These make the mixing of processes with threads more " -"robust, and the ``spawn`` method matches the semantics that multiprocessing " -"has always used on Windows. New function :func:`~multiprocessing." -"get_all_start_methods` reports all start methods available on the platform, :" -"func:`~multiprocessing.get_start_method` reports the current start method, " +"``spawn`` and ``forkserver``, have been added for starting processes " +"using :mod:`multiprocessing`. These make the mixing of processes with " +"threads more robust, and the ``spawn`` method matches the semantics that " +"multiprocessing has always used on Windows. New " +"function :func:`~multiprocessing.get_all_start_methods` reports all start " +"methods available on the platform, :func:`~multiprocessing.get_start_method` " +"reports the current start method, " "and :func:`~multiprocessing.set_start_method` sets the start method. " "(Contributed by Richard Oudkerk in :issue:`8713`.)" msgstr "" @@ -1649,21 +1693,22 @@ msgstr "" #: ../../whatsnew/3.4.rst:1134 msgid "" ":mod:`multiprocessing` also now has the concept of a ``context``, which " -"determines how child processes are created. New function :func:" -"`~multiprocessing.get_context` returns a context that uses a specified start " -"method. It has the same API as the :mod:`multiprocessing` module itself, so " -"you can use it to create :class:`~multiprocessing.pool.Pool`\\ s and other " -"objects that will operate within that context. This allows a framework and " -"an application or different parts of the same application to use " -"multiprocessing without interfering with each other. (Contributed by " -"Richard Oudkerk in :issue:`18999`.)" +"determines how child processes are created. New " +"function :func:`~multiprocessing.get_context` returns a context that uses a " +"specified start method. It has the same API as the :mod:`multiprocessing` " +"module itself, so you can use it to " +"create :class:`~multiprocessing.pool.Pool`\\ s and other objects that will " +"operate within that context. This allows a framework and an application or " +"different parts of the same application to use multiprocessing without " +"interfering with each other. (Contributed by Richard Oudkerk " +"in :issue:`18999`.)" msgstr "" #: ../../whatsnew/3.4.rst:1144 msgid "" "Except when using the old *fork* start method, child processes no longer " -"inherit unneeded handles/file descriptors from their parents (part of :issue:" -"`8713`)." +"inherit unneeded handles/file descriptors from their parents (part " +"of :issue:`8713`)." msgstr "" #: ../../whatsnew/3.4.rst:1148 @@ -1702,9 +1747,9 @@ msgstr "os" #: ../../whatsnew/3.4.rst:1172 msgid "" "There are new functions to get and set the :ref:`inheritable flag " -"<fd_inheritance>` of a file descriptor (:func:`os.get_inheritable`, :func:" -"`os.set_inheritable`) or a Windows handle (:func:`os." -"get_handle_inheritable`, :func:`os.set_handle_inheritable`)." +"<fd_inheritance>` of a file descriptor " +"(:func:`os.get_inheritable`, :func:`os.set_inheritable`) or a Windows handle " +"(:func:`os.get_handle_inheritable`, :func:`os.set_handle_inheritable`)." msgstr "" #: ../../whatsnew/3.4.rst:1177 @@ -1713,14 +1758,14 @@ msgid "" "the platform on which Python is running (or ``None`` if the count can't be " "determined). The :func:`multiprocessing.cpu_count` function is now " "implemented in terms of this function). (Contributed by Trent Nelson, " -"Yogesh Chaudhari, Victor Stinner, and Charles-François Natali in :issue:" -"`17914`.)" +"Yogesh Chaudhari, Victor Stinner, and Charles-François Natali " +"in :issue:`17914`.)" msgstr "" #: ../../whatsnew/3.4.rst:1183 msgid "" -":func:`os.path.samestat` is now available on the Windows platform (and the :" -"func:`os.path.samefile` implementation is now shared between Unix and " +":func:`os.path.samestat` is now available on the Windows platform (and " +"the :func:`os.path.samefile` implementation is now shared between Unix and " "Windows). (Contributed by Brian Curtin in :issue:`11939`.)" msgstr "" @@ -1732,12 +1777,12 @@ msgstr "" #: ../../whatsnew/3.4.rst:1190 msgid "" -":func:`os.open` supports two new flags on platforms that provide them, :" -"const:`~os.O_PATH` (un-opened file descriptor), and :const:`~os.O_TMPFILE` " -"(unnamed temporary file; as of 3.4.0 release available only on Linux systems " -"with a kernel version of 3.11 or newer that have uapi headers). " -"(Contributed by Christian Heimes in :issue:`18673` and Benjamin Peterson, " -"respectively.)" +":func:`os.open` supports two new flags on platforms that provide " +"them, :const:`~os.O_PATH` (un-opened file descriptor), " +"and :const:`~os.O_TMPFILE` (unnamed temporary file; as of 3.4.0 release " +"available only on Linux systems with a kernel version of 3.11 or newer that " +"have uapi headers). (Contributed by Christian Heimes in :issue:`18673` and " +"Benjamin Peterson, respectively.)" msgstr "" #: ../../whatsnew/3.4.rst:1198 @@ -1774,14 +1819,14 @@ msgid "" ":mod:`pickle` now supports (but does not use by default) a new pickle " "protocol, protocol 4. This new protocol addresses a number of issues that " "were present in previous protocols, such as the serialization of nested " -"classes, very large strings and containers, and classes whose :meth:" -"`__new__` method takes keyword-only arguments. It also provides some " -"efficiency improvements." +"classes, very large strings and containers, and classes " +"whose :meth:`__new__` method takes keyword-only arguments. It also provides " +"some efficiency improvements." msgstr "" #: ../../whatsnew/3.4.rst:1229 msgid ":pep:`3154` -- Pickle protocol 4" -msgstr "" +msgstr ":pep:`3154` -- Pickle 協定 4" #: ../../whatsnew/3.4.rst:1230 msgid "PEP written by Antoine Pitrou and implemented by Alexandre Vassalotti." @@ -1794,12 +1839,13 @@ msgstr "plistlib" #: ../../whatsnew/3.4.rst:1236 msgid "" ":mod:`plistlib` now has an API that is similar to the standard pattern for " -"stdlib serialization protocols, with new :func:`~plistlib.load`, :func:" -"`~plistlib.dump`, :func:`~plistlib.loads`, and :func:`~plistlib.dumps` " -"functions. (The older API is now deprecated.) In addition to the already " -"supported XML plist format (:const:`~plistlib.FMT_XML`), it also now " -"supports the binary plist format (:const:`~plistlib.FMT_BINARY`). " -"(Contributed by Ronald Oussoren and others in :issue:`14455`.)" +"stdlib serialization protocols, with " +"new :func:`~plistlib.load`, :func:`~plistlib.dump`, :func:`~plistlib.loads`, " +"and :func:`~plistlib.dumps` functions. (The older API is now deprecated.) " +"In addition to the already supported XML plist format " +"(:const:`~plistlib.FMT_XML`), it also now supports the binary plist format " +"(:const:`~plistlib.FMT_BINARY`). (Contributed by Ronald Oussoren and others " +"in :issue:`14455`.)" msgstr "" #: ../../whatsnew/3.4.rst:1246 @@ -1809,9 +1855,9 @@ msgstr "poplib" #: ../../whatsnew/3.4.rst:1248 msgid "" "Two new methods have been added to :mod:`poplib`: :meth:`~poplib.POP3.capa`, " -"which returns the list of capabilities advertised by the POP server, and :" -"meth:`~poplib.POP3.stls`, which switches a clear-text POP3 session into an " -"encrypted POP3 session if the POP server supports it. (Contributed by " +"which returns the list of capabilities advertised by the POP server, " +"and :meth:`~poplib.POP3.stls`, which switches a clear-text POP3 session into " +"an encrypted POP3 session if the POP server supports it. (Contributed by " "Lorenzo Catucci in :issue:`4473`.)" msgstr "" @@ -1821,8 +1867,8 @@ msgstr "pprint" #: ../../whatsnew/3.4.rst:1258 msgid "" -"The :mod:`pprint` module's :class:`~pprint.PrettyPrinter` class and its :" -"func:`~pprint.pformat`, and :func:`~pprint.pprint` functions have a new " +"The :mod:`pprint` module's :class:`~pprint.PrettyPrinter` class and " +"its :func:`~pprint.pformat`, and :func:`~pprint.pprint` functions have a new " "option, *compact*, that controls how the output is formatted. Currently " "setting *compact* to ``True`` means that sequences will be printed with as " "many sequence elements as will fit within *width* on each (indented) line. " @@ -1851,27 +1897,28 @@ msgstr "pydoc" #: ../../whatsnew/3.4.rst:1279 msgid "" -"The :mod:`pydoc` module is now based directly on the :func:`inspect." -"signature` introspection API, allowing it to provide signature information " -"for a wider variety of callable objects. This change also means that " -"``__wrapped__`` attributes are now taken into account when displaying help " -"information. (Contributed by Larry Hastings in :issue:`19674`.)" +"The :mod:`pydoc` module is now based directly on " +"the :func:`inspect.signature` introspection API, allowing it to provide " +"signature information for a wider variety of callable objects. This change " +"also means that ``__wrapped__`` attributes are now taken into account when " +"displaying help information. (Contributed by Larry Hastings " +"in :issue:`19674`.)" msgstr "" #: ../../whatsnew/3.4.rst:1285 msgid "" "The :mod:`pydoc` module no longer displays the ``self`` parameter for " "already bound methods. Instead, it aims to always display the exact current " -"signature of the supplied callable. (Contributed by Larry Hastings in :" -"issue:`20710`.)" +"signature of the supplied callable. (Contributed by Larry Hastings " +"in :issue:`20710`.)" msgstr "" #: ../../whatsnew/3.4.rst:1290 msgid "" "In addition to the changes that have been made to :mod:`pydoc` directly, its " "handling of custom ``__dir__`` methods and various descriptor behaviours has " -"also been improved substantially by the underlying changes in the :mod:" -"`inspect` module." +"also been improved substantially by the underlying changes in " +"the :mod:`inspect` module." msgstr "" #: ../../whatsnew/3.4.rst:1295 @@ -1917,17 +1964,18 @@ msgstr "" #: ../../whatsnew/3.4.rst:1324 msgid "" "On Linux kernel version 2.6.36 or later, there are also some new Linux " -"specific constants: :const:`~resource.RLIMIT_MSGQUEUE`, :const:`~resource." -"RLIMIT_NICE`, :const:`~resource.RLIMIT_RTPRIO`, :const:`~resource." -"RLIMIT_RTTIME`, and :const:`~resource.RLIMIT_SIGPENDING`. (Contributed by " -"Christian Heimes in :issue:`19324`.)" +"specific " +"constants: :const:`~resource.RLIMIT_MSGQUEUE`, :const:`~resource.RLIMIT_NICE`, :const:`~resource.RLIMIT_RTPRIO`, :const:`~resource.RLIMIT_RTTIME`, " +"and :const:`~resource.RLIMIT_SIGPENDING`. (Contributed by Christian Heimes " +"in :issue:`19324`.)" msgstr "" #: ../../whatsnew/3.4.rst:1330 msgid "" -"On FreeBSD version 9 and later, there some new FreeBSD specific constants: :" -"const:`~resource.RLIMIT_SBSIZE`, :const:`~resource.RLIMIT_SWAP`, and :const:" -"`~resource.RLIMIT_NPTS`. (Contributed by Claudiu Popa in :issue:`19343`.)" +"On FreeBSD version 9 and later, there some new FreeBSD specific " +"constants: :const:`~resource.RLIMIT_SBSIZE`, :const:`~resource.RLIMIT_SWAP`, " +"and :const:`~resource.RLIMIT_NPTS`. (Contributed by Claudiu Popa " +"in :issue:`19343`.)" msgstr "" #: ../../whatsnew/3.4.rst:1337 @@ -1945,8 +1993,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:1344 msgid "" ":class:`~select.devpoll` objects now have :meth:`~select.devpoll.fileno` " -"and :meth:`~select.devpoll.close` methods, as well as a new attribute :attr:" -"`~select.devpoll.closed`. (Contributed by Victor Stinner in :issue:`18794`.)" +"and :meth:`~select.devpoll.close` methods, as well as a new " +"attribute :attr:`~select.devpoll.closed`. (Contributed by Victor Stinner " +"in :issue:`18794`.)" msgstr "" #: ../../whatsnew/3.4.rst:1351 @@ -1969,8 +2018,8 @@ msgid "" ":func:`~shutil.copyfile` now raises a specific :exc:`~shutil.Error` " "subclass, :exc:`~shutil.SameFileError`, when the source and destination are " "the same file, which allows an application to take appropriate action on " -"this specific error. (Contributed by Atsuo Ishimoto and Hynek Schlawack in :" -"issue:`1492704`.)" +"this specific error. (Contributed by Atsuo Ishimoto and Hynek Schlawack " +"in :issue:`1492704`.)" msgstr "" #: ../../whatsnew/3.4.rst:1369 @@ -1982,8 +2031,8 @@ msgid "" "The :class:`!SMTPServer` and :class:`!SMTPChannel` classes now accept a " "*map* keyword argument which, if specified, is passed in to :class:`!" "asynchat.async_chat` as its *map* argument. This allows an application to " -"avoid affecting the global socket map. (Contributed by Vinay Sajip in :" -"issue:`11959`.)" +"avoid affecting the global socket map. (Contributed by Vinay Sajip " +"in :issue:`11959`.)" msgstr "" #: ../../whatsnew/3.4.rst:1379 @@ -2011,8 +2060,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:1393 msgid "" "Socket objects have new methods to get or set their :ref:`inheritable flag " -"<fd_inheritance>`, :meth:`~socket.socket.get_inheritable` and :meth:`~socket." -"socket.set_inheritable`." +"<fd_inheritance>`, :meth:`~socket.socket.get_inheritable` " +"and :meth:`~socket.socket.set_inheritable`." msgstr "" #: ../../whatsnew/3.4.rst:1397 @@ -2064,37 +2113,40 @@ msgid "" "more stringent than the defaults provided by the :class:`~ssl.SSLContext` " "constructor, and may be adjusted in the future, without prior deprecation, " "if best-practice security requirements change. The new recommended best " -"practice for using stdlib libraries that support SSL is to use :func:`~ssl." -"create_default_context` to obtain an :class:`~ssl.SSLContext` object, modify " -"it if needed, and then pass it as the *context* argument of the appropriate " -"stdlib API. (Contributed by Christian Heimes in :issue:`19689`.)" +"practice for using stdlib libraries that support SSL is to " +"use :func:`~ssl.create_default_context` to obtain " +"an :class:`~ssl.SSLContext` object, modify it if needed, and then pass it as " +"the *context* argument of the appropriate stdlib API. (Contributed by " +"Christian Heimes in :issue:`19689`.)" msgstr "" #: ../../whatsnew/3.4.rst:1440 msgid "" -":class:`~ssl.SSLContext` method :meth:`~ssl.SSLContext." -"load_verify_locations` accepts a new optional argument *cadata*, which can " -"be used to provide PEM or DER encoded certificates directly via strings or " -"bytes, respectively. (Contributed by Christian Heimes in :issue:`18138`.)" +":class:`~ssl.SSLContext` " +"method :meth:`~ssl.SSLContext.load_verify_locations` accepts a new optional " +"argument *cadata*, which can be used to provide PEM or DER encoded " +"certificates directly via strings or bytes, respectively. (Contributed by " +"Christian Heimes in :issue:`18138`.)" msgstr "" #: ../../whatsnew/3.4.rst:1445 msgid "" "New function :func:`~ssl.get_default_verify_paths` returns a named tuple of " -"the paths and environment variables that the :meth:`~ssl.SSLContext." -"set_default_verify_paths` method uses to set OpenSSL's default ``cafile`` " -"and ``capath``. This can be an aid in debugging default verification " -"issues. (Contributed by Christian Heimes in :issue:`18143`.)" +"the paths and environment variables that " +"the :meth:`~ssl.SSLContext.set_default_verify_paths` method uses to set " +"OpenSSL's default ``cafile`` and ``capath``. This can be an aid in " +"debugging default verification issues. (Contributed by Christian Heimes " +"in :issue:`18143`.)" msgstr "" #: ../../whatsnew/3.4.rst:1452 msgid "" -":class:`~ssl.SSLContext` has a new method, :meth:`~ssl.SSLContext." -"cert_store_stats`, that reports the number of loaded ``X.509`` certs, " -"``X.509 CA`` certs, and certificate revocation lists (``crl``\\ s), as well " -"as a :meth:`~ssl.SSLContext.get_ca_certs` method that returns a list of the " -"loaded ``CA`` certificates. (Contributed by Christian Heimes in :issue:" -"`18147`.)" +":class:`~ssl.SSLContext` has a new " +"method, :meth:`~ssl.SSLContext.cert_store_stats`, that reports the number of " +"loaded ``X.509`` certs, ``X.509 CA`` certs, and certificate revocation lists " +"(``crl``\\ s), as well as a :meth:`~ssl.SSLContext.get_ca_certs` method that " +"returns a list of the loaded ``CA`` certificates. (Contributed by Christian " +"Heimes in :issue:`18147`.)" msgstr "" #: ../../whatsnew/3.4.rst:1459 @@ -2102,45 +2154,46 @@ msgid "" "If OpenSSL 0.9.8 or later is available, :class:`~ssl.SSLContext` has a new " "attribute :attr:`~ssl.SSLContext.verify_flags` that can be used to control " "the certificate verification process by setting it to some combination of " -"the new constants :const:`~ssl.VERIFY_DEFAULT`, :const:`~ssl." -"VERIFY_CRL_CHECK_LEAF`, :const:`~ssl.VERIFY_CRL_CHECK_CHAIN`, or :const:" -"`~ssl.VERIFY_X509_STRICT`. OpenSSL does not do any CRL verification by " -"default. (Contributed by Christien Heimes in :issue:`8813`.)" +"the new " +"constants :const:`~ssl.VERIFY_DEFAULT`, :const:`~ssl.VERIFY_CRL_CHECK_LEAF`, :const:`~ssl.VERIFY_CRL_CHECK_CHAIN`, " +"or :const:`~ssl.VERIFY_X509_STRICT`. OpenSSL does not do any CRL " +"verification by default. (Contributed by Christien Heimes in :issue:`8813`.)" msgstr "" #: ../../whatsnew/3.4.rst:1467 msgid "" -"New :class:`~ssl.SSLContext` method :meth:`~ssl.SSLContext." -"load_default_certs` loads a set of default \"certificate authority\" (CA) " -"certificates from default locations, which vary according to the platform. " -"It can be used to load both TLS web server authentication certificates " -"(``purpose=``:data:`~ssl.Purpose.SERVER_AUTH`) for a client to use to verify " -"a server, and certificates for a server to use in verifying client " -"certificates (``purpose=``:data:`~ssl.Purpose.CLIENT_AUTH`). (Contributed " -"by Christian Heimes in :issue:`19292`.)" +"New :class:`~ssl.SSLContext` " +"method :meth:`~ssl.SSLContext.load_default_certs` loads a set of default " +"\"certificate authority\" (CA) certificates from default locations, which " +"vary according to the platform. It can be used to load both TLS web server " +"authentication certificates (``purpose=``:data:`~ssl.Purpose.SERVER_AUTH`) " +"for a client to use to verify a server, and certificates for a server to use " +"in verifying client certificates " +"(``purpose=``:data:`~ssl.Purpose.CLIENT_AUTH`). (Contributed by Christian " +"Heimes in :issue:`19292`.)" msgstr "" #: ../../whatsnew/3.4.rst:1478 msgid "" -"Two new windows-only functions, :func:`~ssl.enum_certificates` and :func:" -"`~ssl.enum_crls` provide the ability to retrieve certificates, certificate " -"information, and CRLs from the Windows cert store. (Contributed by " -"Christian Heimes in :issue:`17134`.)" +"Two new windows-only functions, :func:`~ssl.enum_certificates` " +"and :func:`~ssl.enum_crls` provide the ability to retrieve certificates, " +"certificate information, and CRLs from the Windows cert store. (Contributed " +"by Christian Heimes in :issue:`17134`.)" msgstr "" #: ../../whatsnew/3.4.rst:1485 msgid "" -"Support for server-side SNI (Server Name Indication) using the new :meth:" -"`ssl.SSLContext.set_servername_callback` method. (Contributed by Daniel " -"Black in :issue:`8109`.)" +"Support for server-side SNI (Server Name Indication) using the " +"new :meth:`ssl.SSLContext.set_servername_callback` method. (Contributed by " +"Daniel Black in :issue:`8109`.)" msgstr "" #: ../../whatsnew/3.4.rst:1489 msgid "" "The dictionary returned by :meth:`.SSLSocket.getpeercert` contains " "additional ``X509v3`` extension items: ``crlDistributionPoints``, " -"``calIssuers``, and ``OCSP`` URIs. (Contributed by Christian Heimes in :" -"issue:`18379`.)" +"``calIssuers``, and ``OCSP`` URIs. (Contributed by Christian Heimes " +"in :issue:`18379`.)" msgstr "" #: ../../whatsnew/3.4.rst:1495 @@ -2156,9 +2209,10 @@ msgstr "" #: ../../whatsnew/3.4.rst:1501 msgid "" -"The module supports new :mod:`~stat.ST_MODE` flags, :mod:`~stat.S_IFDOOR`, :" -"const:`~stat.S_IFPORT`, and :const:`~stat.S_IFWHT`. (Contributed by " -"Christian Hiemes in :issue:`11016`.)" +"The module supports new :mod:`~stat.ST_MODE` " +"flags, :mod:`~stat.S_IFDOOR`, :const:`~stat.S_IFPORT`, " +"and :const:`~stat.S_IFWHT`. (Contributed by Christian Hiemes " +"in :issue:`11016`.)" msgstr "" #: ../../whatsnew/3.4.rst:1507 @@ -2167,10 +2221,10 @@ msgstr "struct" #: ../../whatsnew/3.4.rst:1509 msgid "" -"New function :mod:`~struct.iter_unpack` and a new :meth:`struct.Struct." -"iter_unpack` method on compiled formats provide streamed unpacking of a " -"buffer containing repeated instances of a given format of data. (Contributed " -"by Antoine Pitrou in :issue:`17804`.)" +"New function :mod:`~struct.iter_unpack` and a " +"new :meth:`struct.Struct.iter_unpack` method on compiled formats provide " +"streamed unpacking of a buffer containing repeated instances of a given " +"format of data. (Contributed by Antoine Pitrou in :issue:`17804`.)" msgstr "" #: ../../whatsnew/3.4.rst:1516 @@ -2224,10 +2278,10 @@ msgstr "sys" msgid "" "New function :func:`sys.getallocatedblocks` returns the current number of " "blocks allocated by the interpreter. (In CPython with the default ``--with-" -"pymalloc`` setting, this is allocations made through the :c:func:" -"`PyObject_Malloc` API.) This can be useful for tracking memory leaks, " -"especially if automated via a test suite. (Contributed by Antoine Pitrou " -"in :issue:`13390`.)" +"pymalloc`` setting, this is allocations made through " +"the :c:func:`PyObject_Malloc` API.) This can be useful for tracking memory " +"leaks, especially if automated via a test suite. (Contributed by Antoine " +"Pitrou in :issue:`13390`.)" msgstr "" #: ../../whatsnew/3.4.rst:1557 @@ -2240,10 +2294,10 @@ msgid "" "The :mod:`site` module :ref:`sets it <rlcompleter-config>` to a function " "that enables tab completion and history saving (in :file:`~/.python-" "history`) if the platform supports :mod:`readline`. If you do not want this " -"(new) behavior, you can override it in :envvar:`PYTHONSTARTUP`, :mod:" -"`sitecustomize`, or :mod:`usercustomize` by deleting this attribute from :" -"mod:`sys` (or setting it to some other callable). (Contributed by Éric " -"Araujo and Antoine Pitrou in :issue:`5845`.)" +"(new) behavior, you can override it " +"in :envvar:`PYTHONSTARTUP`, :mod:`sitecustomize`, or :mod:`usercustomize` by " +"deleting this attribute from :mod:`sys` (or setting it to some other " +"callable). (Contributed by Éric Araujo and Antoine Pitrou in :issue:`5845`.)" msgstr "" #: ../../whatsnew/3.4.rst:1572 @@ -2254,8 +2308,8 @@ msgstr "tarfile" msgid "" "The :mod:`tarfile` module now supports a simple :ref:`tarfile-commandline` " "when called as a script directly or via ``-m``. This can be used to create " -"and extract tarfile archives. (Contributed by Berker Peksag in :issue:" -"`13477`.)" +"and extract tarfile archives. (Contributed by Berker Peksag " +"in :issue:`13477`.)" msgstr "" #: ../../whatsnew/3.4.rst:1580 @@ -2272,8 +2326,8 @@ msgid "" "convenience function :func:`~textwrap.shorten` collapses all of the " "whitespace in the input to single spaces and produces a single line of a " "given *width* that ends with the *placeholder* (by default, ``[...]``). " -"(Contributed by Antoine Pitrou and Serhiy Storchaka in :issue:`18585` and :" -"issue:`18725`.)" +"(Contributed by Antoine Pitrou and Serhiy Storchaka in :issue:`18585` " +"and :issue:`18725`.)" msgstr "" #: ../../whatsnew/3.4.rst:1594 @@ -2296,8 +2350,8 @@ msgstr "traceback" msgid "" "A new :func:`traceback.clear_frames` function takes a traceback object and " "clears the local variables in all of the frames it references, reducing the " -"amount of memory consumed. (Contributed by Andrew Kuchling in :issue:" -"`1565525`.)" +"amount of memory consumed. (Contributed by Andrew Kuchling " +"in :issue:`1565525`.)" msgstr "" #: ../../whatsnew/3.4.rst:1612 @@ -2320,40 +2374,41 @@ msgstr "urllib" #: ../../whatsnew/3.4.rst:1625 msgid "" -":mod:`urllib.request` now supports ``data:`` URLs via the :class:`~urllib." -"request.DataHandler` class. (Contributed by Mathias Panzenböck in :issue:" -"`16423`.)" +":mod:`urllib.request` now supports ``data:`` URLs via " +"the :class:`~urllib.request.DataHandler` class. (Contributed by Mathias " +"Panzenböck in :issue:`16423`.)" msgstr "" #: ../../whatsnew/3.4.rst:1629 msgid "" "The http method that will be used by a :class:`~urllib.request.Request` " -"class can now be specified by setting a :class:`~urllib.request.Request." -"method` class attribute on the subclass. (Contributed by Jason R Coombs in :" -"issue:`18978`.)" +"class can now be specified by setting " +"a :class:`~urllib.request.Request.method` class attribute on the subclass. " +"(Contributed by Jason R Coombs in :issue:`18978`.)" msgstr "" #: ../../whatsnew/3.4.rst:1634 msgid "" -":class:`~urllib.request.Request` objects are now reusable: if the :attr:" -"`~urllib.request.Request.full_url` or :attr:`~urllib.request.Request.data` " -"attributes are modified, all relevant internal properties are updated. This " -"means, for example, that it is now possible to use the same :class:`~urllib." -"request.Request` object in more than one :meth:`.OpenerDirector.open` call " -"with different *data* arguments, or to modify a :class:`~urllib.request." -"Request`\\ 's ``url`` rather than recomputing it from scratch. There is " -"also a new :meth:`~urllib.request.Request.remove_header` method that can be " -"used to remove headers from a :class:`~urllib.request.Request`. " -"(Contributed by Alexey Kachayev in :issue:`16464`, Daniel Wozniak in :issue:" -"`17485`, and Damien Brecht and Senthil Kumaran in :issue:`17272`.)" +":class:`~urllib.request.Request` objects are now reusable: if " +"the :attr:`~urllib.request.Request.full_url` " +"or :attr:`~urllib.request.Request.data` attributes are modified, all " +"relevant internal properties are updated. This means, for example, that it " +"is now possible to use the same :class:`~urllib.request.Request` object in " +"more than one :meth:`.OpenerDirector.open` call with different *data* " +"arguments, or to modify a :class:`~urllib.request.Request`\\ 's ``url`` " +"rather than recomputing it from scratch. There is also a " +"new :meth:`~urllib.request.Request.remove_header` method that can be used to " +"remove headers from a :class:`~urllib.request.Request`. (Contributed by " +"Alexey Kachayev in :issue:`16464`, Daniel Wozniak in :issue:`17485`, and " +"Damien Brecht and Senthil Kumaran in :issue:`17272`.)" msgstr "" #: ../../whatsnew/3.4.rst:1647 msgid "" -":class:`~urllib.error.HTTPError` objects now have a :attr:`~urllib.error." -"HTTPError.headers` attribute that provides access to the HTTP response " -"headers associated with the error. (Contributed by Berker Peksag in :issue:" -"`15701`.)" +":class:`~urllib.error.HTTPError` objects now have " +"a :attr:`~urllib.error.HTTPError.headers` attribute that provides access to " +"the HTTP response headers associated with the error. (Contributed by Berker " +"Peksag in :issue:`15701`.)" msgstr "" #: ../../whatsnew/3.4.rst:1654 @@ -2362,13 +2417,13 @@ msgstr "unittest" #: ../../whatsnew/3.4.rst:1656 msgid "" -"The :class:`~unittest.TestCase` class has a new method, :meth:`~unittest." -"TestCase.subTest`, that produces a context manager whose :keyword:`with` " -"block becomes a \"sub-test\". This context manager allows a test method to " -"dynamically generate subtests by, say, calling the ``subTest`` context " -"manager inside a loop. A single test method can thereby produce an " -"indefinite number of separately identified and separately counted tests, all " -"of which will run even if one or more of them fail. For example::" +"The :class:`~unittest.TestCase` class has a new " +"method, :meth:`~unittest.TestCase.subTest`, that produces a context manager " +"whose :keyword:`with` block becomes a \"sub-test\". This context manager " +"allows a test method to dynamically generate subtests by, say, calling the " +"``subTest`` context manager inside a loop. A single test method can thereby " +"produce an indefinite number of separately identified and separately counted " +"tests, all of which will run even if one or more of them fail. For example::" msgstr "" #: ../../whatsnew/3.4.rst:1664 @@ -2428,9 +2483,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:1695 msgid "" "A new test assertion context-manager, :meth:`~unittest.TestCase.assertLogs`, " -"will ensure that a given block of code emits a log message using the :mod:" -"`logging` module. By default the message can come from any logger and have " -"a priority of ``INFO`` or higher, but both the logger name and an " +"will ensure that a given block of code emits a log message using " +"the :mod:`logging` module. By default the message can come from any logger " +"and have a priority of ``INFO`` or higher, but both the logger name and an " "alternative minimum logging level may be specified. The object returned by " "the context manager can be queried for the :class:`~logging.LogRecord`\\ s " "and/or formatted messages that were logged. (Contributed by Antoine Pitrou " @@ -2472,8 +2527,8 @@ msgid "" ":class:`~venv.EnvBuilder` and the :func:`~venv.create` convenience function " "take a new keyword argument *with_pip*, which defaults to ``False``, that " "controls whether or not :class:`~venv.EnvBuilder` ensures that ``pip`` is " -"installed in the virtual environment. (Contributed by Nick Coghlan in :" -"issue:`19552` as part of the :pep:`453` implementation.)" +"installed in the virtual environment. (Contributed by Nick Coghlan " +"in :issue:`19552` as part of the :pep:`453` implementation.)" msgstr "" #: ../../whatsnew/3.4.rst:1730 @@ -2501,9 +2556,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:1742 msgid "" -"The :meth:`~wave.Wave_write.writeframesraw` and :meth:`~wave.Wave_write." -"writeframes` methods now accept any :term:`bytes-like object`. (Contributed " -"by Serhiy Storchaka in :issue:`8311`.)" +"The :meth:`~wave.Wave_write.writeframesraw` " +"and :meth:`~wave.Wave_write.writeframes` methods now accept any :term:`bytes-" +"like object`. (Contributed by Serhiy Storchaka in :issue:`8311`.)" msgstr "" #: ../../whatsnew/3.4.rst:1748 @@ -2538,21 +2593,21 @@ msgstr "xml.etree" #: ../../whatsnew/3.4.rst:1766 msgid "" "A new parser, :class:`~xml.etree.ElementTree.XMLPullParser`, allows a non-" -"blocking applications to parse XML documents. An example can be seen at :" -"ref:`elementtree-pull-parsing`. (Contributed by Antoine Pitrou in :issue:" -"`17741`.)" +"blocking applications to parse XML documents. An example can be seen " +"at :ref:`elementtree-pull-parsing`. (Contributed by Antoine Pitrou " +"in :issue:`17741`.)" msgstr "" #: ../../whatsnew/3.4.rst:1771 msgid "" "The :mod:`xml.etree.ElementTree` :func:`~xml.etree.ElementTree.tostring` " -"and :func:`~xml.etree.ElementTree.tostringlist` functions, and the :class:" -"`~xml.etree.ElementTree.ElementTree` :meth:`~xml.etree.ElementTree." -"ElementTree.write` method, now have a *short_empty_elements* :ref:`keyword-" -"only parameter <keyword-only_parameter>` providing control over whether " -"elements with no content are written in abbreviated (``<tag />``) or " -"expanded (``<tag></tag>``) form. (Contributed by Ariel Poliak and Serhiy " -"Storchaka in :issue:`14377`.)" +"and :func:`~xml.etree.ElementTree.tostringlist` functions, and " +"the :class:`~xml.etree.ElementTree.ElementTree` :meth:`~xml.etree.ElementTree.ElementTree.write` " +"method, now have a *short_empty_elements* :ref:`keyword-only parameter " +"<keyword-only_parameter>` providing control over whether elements with no " +"content are written in abbreviated (``<tag />``) or expanded (``<tag></" +"tag>``) form. (Contributed by Ariel Poliak and Serhiy Storchaka " +"in :issue:`14377`.)" msgstr "" #: ../../whatsnew/3.4.rst:1782 @@ -2561,18 +2616,18 @@ msgstr "zipfile" #: ../../whatsnew/3.4.rst:1784 msgid "" -"The :meth:`~zipfile.PyZipFile.writepy` method of the :class:`~zipfile." -"PyZipFile` class has a new *filterfunc* option that can be used to control " -"which directories and files are added to the archive. For example, this " -"could be used to exclude test files from the archive. (Contributed by " -"Christian Tismer in :issue:`19274`.)" +"The :meth:`~zipfile.PyZipFile.writepy` method of " +"the :class:`~zipfile.PyZipFile` class has a new *filterfunc* option that can " +"be used to control which directories and files are added to the archive. " +"For example, this could be used to exclude test files from the archive. " +"(Contributed by Christian Tismer in :issue:`19274`.)" msgstr "" #: ../../whatsnew/3.4.rst:1790 msgid "" -"The *allowZip64* parameter to :class:`~zipfile.ZipFile` and :class:`~zipfile." -"PyZipfile` is now ``True`` by default. (Contributed by William Mallard in :" -"issue:`17201`.)" +"The *allowZip64* parameter to :class:`~zipfile.ZipFile` " +"and :class:`~zipfile.PyZipfile` is now ``True`` by default. (Contributed by " +"William Mallard in :issue:`17201`.)" msgstr "" #: ../../whatsnew/3.4.rst:1797 @@ -2607,16 +2662,17 @@ msgstr "" #: ../../whatsnew/3.4.rst:1824 msgid "" -"As part of this change, module globals are no longer forcibly set to :const:" -"`None` during interpreter shutdown in most cases, instead relying on the " -"normal operation of the cyclic garbage collector. This avoids a whole class " -"of interpreter-shutdown-time errors, usually involving ``__del__`` methods, " -"that have plagued Python since the cyclic GC was first introduced." +"As part of this change, module globals are no longer forcibly set " +"to :const:`None` during interpreter shutdown in most cases, instead relying " +"on the normal operation of the cyclic garbage collector. This avoids a " +"whole class of interpreter-shutdown-time errors, usually involving " +"``__del__`` methods, that have plagued Python since the cyclic GC was first " +"introduced." msgstr "" #: ../../whatsnew/3.4.rst:1833 msgid ":pep:`442` -- Safe object finalization" -msgstr "" +msgstr ":pep:`442` -- 安全的物件最終化" #: ../../whatsnew/3.4.rst:1840 msgid "PEP 456: Secure and Interchangeable Hash Algorithm" @@ -2685,7 +2741,7 @@ msgstr "由 Larry Hastings 撰寫 PEP 與實作。" #: ../../whatsnew/3.4.rst:1887 msgid "Other Build and C API Changes" -msgstr "" +msgstr "其他建置和 C API 變更" #: ../../whatsnew/3.4.rst:1889 msgid "" @@ -2724,36 +2780,38 @@ msgstr "" #: ../../whatsnew/3.4.rst:1909 msgid "" -"New function :c:func:`PyStructSequence_InitType2` supplements the existing :" -"c:func:`PyStructSequence_InitType` function. The difference is that it " -"returns ``0`` on success and ``-1`` on failure." +"New function :c:func:`PyStructSequence_InitType2` supplements the " +"existing :c:func:`PyStructSequence_InitType` function. The difference is " +"that it returns ``0`` on success and ``-1`` on failure." msgstr "" #: ../../whatsnew/3.4.rst:1913 msgid "" "The CPython source can now be compiled using the address sanity checking " "features of recent versions of GCC and clang: the false alarms in the small " -"object allocator have been silenced. (Contributed by Dhiru Kholia in :issue:" -"`18596`.)" +"object allocator have been silenced. (Contributed by Dhiru Kholia " +"in :issue:`18596`.)" msgstr "" #: ../../whatsnew/3.4.rst:1918 msgid "" -"The Windows build now uses `Address Space Layout Randomization <https://en." -"wikipedia.org/wiki/Address_space_layout_randomization>`_ and `Data Execution " -"Prevention <https://en.wikipedia.org/wiki/Data_Execution_Prevention>`_. " -"(Contributed by Christian Heimes in :issue:`16632`.)" +"The Windows build now uses `Address Space Layout Randomization <https://" +"en.wikipedia.org/wiki/Address_space_layout_randomization>`_ and `Data " +"Execution Prevention <https://en.wikipedia.org/wiki/" +"Data_Execution_Prevention>`_. (Contributed by Christian Heimes " +"in :issue:`16632`.)" msgstr "" #: ../../whatsnew/3.4.rst:1923 msgid "" -"New function :c:func:`PyObject_LengthHint` is the C API equivalent of :func:" -"`operator.length_hint`. (Contributed by Armin Ronacher in :issue:`16148`.)" +"New function :c:func:`PyObject_LengthHint` is the C API equivalent " +"of :func:`operator.length_hint`. (Contributed by Armin Ronacher " +"in :issue:`16148`.)" msgstr "" #: ../../whatsnew/3.4.rst:1931 msgid "Other Improvements" -msgstr "" +msgstr "其他改進" #: ../../whatsnew/3.4.rst:1935 msgid "" @@ -2789,8 +2847,8 @@ msgstr "" msgid "" "The CPython Windows installer now adds ``.py`` to the :envvar:`PATHEXT` " "variable when extensions are registered, allowing users to run a python " -"script at the windows command prompt by just typing its name without the ``." -"py`` extension. (Contributed by Paul Moore in :issue:`18569`.)" +"script at the windows command prompt by just typing its name without the " +"``.py`` extension. (Contributed by Paul Moore in :issue:`18569`.)" msgstr "" #: ../../whatsnew/3.4.rst:1961 @@ -2804,13 +2862,17 @@ msgstr "" #: ../../whatsnew/3.4.rst:1967 msgid "" "The ``-R`` option to the :ref:`python regression test suite <regrtest>` now " -"also checks for memory allocation leaks, using :func:`sys." -"getallocatedblocks`. (Contributed by Antoine Pitrou in :issue:`13390`.)" +"also checks for memory allocation leaks, " +"using :func:`sys.getallocatedblocks`. (Contributed by Antoine Pitrou " +"in :issue:`13390`.)" msgstr "" +":ref:`python 迴歸測試套裝 <regrtest>` 的 ``-R`` 選項現在也可以透過使" +"用 :func:`sys.getallocatedblocks` 來檢查記憶體配置洩漏。(由 Antoine Pitrou " +"在 :issue:`13390` 貢獻。)" #: ../../whatsnew/3.4.rst:1972 msgid "``python -m`` now works with namespace packages." -msgstr "" +msgstr "``python -m`` 現在可以使用於命名空間套件。" #: ../../whatsnew/3.4.rst:1974 msgid "" @@ -2830,15 +2892,15 @@ msgstr "" msgid "" "A new opcode, :opcode:`!LOAD_CLASSDEREF`, has been added to fix a bug in the " "loading of free variables in class bodies that could be triggered by certain " -"uses of :ref:`__prepare__ <prepare>`. (Contributed by Benjamin Peterson in :" -"issue:`17853`.)" +"uses of :ref:`__prepare__ <prepare>`. (Contributed by Benjamin Peterson " +"in :issue:`17853`.)" msgstr "" #: ../../whatsnew/3.4.rst:1987 msgid "" "A number of MemoryError-related crashes were identified and fixed by Victor " -"Stinner using his :pep:`445`-based ``pyfailmalloc`` tool (:issue:`18408`, :" -"issue:`18520`)." +"Stinner using his :pep:`445`-based ``pyfailmalloc`` tool " +"(:issue:`18408`, :issue:`18520`)." msgstr "" #: ../../whatsnew/3.4.rst:1991 @@ -2858,10 +2920,10 @@ msgstr "" #: ../../whatsnew/3.4.rst:2000 msgid "" -"The encoding name is now optional in the value set for the :envvar:" -"`PYTHONIOENCODING` environment variable. This makes it possible to set just " -"the error handler, without changing the default encoding. (Contributed by " -"Serhiy Storchaka in :issue:`18818`.)" +"The encoding name is now optional in the value set for " +"the :envvar:`PYTHONIOENCODING` environment variable. This makes it possible " +"to set just the error handler, without changing the default encoding. " +"(Contributed by Serhiy Storchaka in :issue:`18818`.)" msgstr "" #: ../../whatsnew/3.4.rst:2005 @@ -2897,12 +2959,13 @@ msgstr "" #: ../../whatsnew/3.4.rst:2027 msgid "" "The interpreter starts about 30% faster. A couple of measures lead to the " -"speedup. The interpreter loads fewer modules on startup, e.g. the :mod:" -"`re`, :mod:`collections` and :mod:`locale` modules and their dependencies " -"are no longer imported by default. The marshal module has been improved to " -"load compiled Python code faster. (Contributed by Antoine Pitrou, Christian " -"Heimes and Victor Stinner in :issue:`19219`, :issue:`19218`, :issue:" -"`19209`, :issue:`19205` and :issue:`9548`.)" +"speedup. The interpreter loads fewer modules on startup, e.g. " +"the :mod:`re`, :mod:`collections` and :mod:`locale` modules and their " +"dependencies are no longer imported by default. The marshal module has been " +"improved to load compiled Python code faster. (Contributed by Antoine " +"Pitrou, Christian Heimes and Victor Stinner " +"in :issue:`19219`, :issue:`19218`, :issue:`19209`, :issue:`19205` " +"and :issue:`9548`.)" msgstr "" #: ../../whatsnew/3.4.rst:2035 @@ -2935,8 +2998,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2051 msgid "" -":func:`html.escape` is now 10x faster. (Contributed by Matt Bryant in :" -"issue:`18020`.)" +":func:`html.escape` is now 10x faster. (Contributed by Matt Bryant " +"in :issue:`18020`.)" msgstr "" #: ../../whatsnew/3.4.rst:2054 @@ -2961,36 +3024,38 @@ msgstr "已棄用" msgid "" "This section covers various APIs and other features that have been " "deprecated in Python 3.4, and will be removed in Python 3.5 or later. In " -"most (but not all) cases, using the deprecated APIs will produce a :exc:" -"`DeprecationWarning` when the interpreter is run with deprecation warnings " -"enabled (for example, by using ``-Wd``)." +"most (but not all) cases, using the deprecated APIs will produce " +"a :exc:`DeprecationWarning` when the interpreter is run with deprecation " +"warnings enabled (for example, by using ``-Wd``)." msgstr "" #: ../../whatsnew/3.4.rst:2076 msgid "Deprecations in the Python API" -msgstr "" +msgstr "已棄用的 Python API" #: ../../whatsnew/3.4.rst:2078 msgid "" "As mentioned in :ref:`whatsnew-pep-451`, a number of :mod:`importlib` " "methods and functions are deprecated: :meth:`!importlib.find_loader` is " -"replaced by :func:`importlib.util.find_spec`; :meth:`!importlib.machinery." -"PathFinder.find_module` is replaced by :meth:`importlib.machinery.PathFinder." -"find_spec`; :meth:`!importlib.abc.MetaPathFinder.find_module` is replaced " -"by :meth:`importlib.abc.MetaPathFinder.find_spec`; :meth:`!importlib.abc." -"PathEntryFinder.find_loader` and :meth:`!find_module` are replaced by :meth:" -"`importlib.abc.PathEntryFinder.find_spec`; all of the :samp:`{xxx}Loader` " -"ABC ``load_module`` methods (:meth:`!importlib.abc.Loader.load_module`, :" -"meth:`!importlib.abc.InspectLoader.load_module`, :meth:`!importlib.abc." -"FileLoader.load_module`, :meth:`!importlib.abc.SourceLoader.load_module`) " -"should no longer be implemented, instead loaders should implement an " -"``exec_module`` method (:meth:`importlib.abc.Loader.exec_module`, :meth:" -"`importlib.abc.InspectLoader.exec_module` :meth:`importlib.abc.SourceLoader." -"exec_module`) and let the import system take care of the rest; and :meth:`!" -"importlib.abc.Loader.module_repr`, :meth:`!importlib.util." -"module_for_loader`, :meth:`!importlib.util.set_loader`, and :meth:`!" -"importlib.util.set_package` are no longer needed because their functions are " -"now handled automatically by the import system." +"replaced by :func:`importlib.util.find_spec`; :meth:`!" +"importlib.machinery.PathFinder.find_module` is replaced " +"by :meth:`importlib.machinery.PathFinder.find_spec`; :meth:`!" +"importlib.abc.MetaPathFinder.find_module` is replaced " +"by :meth:`importlib.abc.MetaPathFinder.find_spec`; :meth:`!" +"importlib.abc.PathEntryFinder.find_loader` and :meth:`!find_module` are " +"replaced by :meth:`importlib.abc.PathEntryFinder.find_spec`; all of " +"the :samp:`{xxx}Loader` ABC ``load_module`` methods (:meth:`!" +"importlib.abc.Loader.load_module`, :meth:`!" +"importlib.abc.InspectLoader.load_module`, :meth:`!" +"importlib.abc.FileLoader.load_module`, :meth:`!" +"importlib.abc.SourceLoader.load_module`) should no longer be implemented, " +"instead loaders should implement an ``exec_module`` method " +"(:meth:`importlib.abc.Loader.exec_module`, :meth:`importlib.abc.InspectLoader.exec_module` :meth:`importlib.abc.SourceLoader.exec_module`) " +"and let the import system take care of the rest; and :meth:`!" +"importlib.abc.Loader.module_repr`, :meth:`!" +"importlib.util.module_for_loader`, :meth:`!importlib.util.set_loader`, " +"and :meth:`!importlib.util.set_package` are no longer needed because their " +"functions are now handled automatically by the import system." msgstr "" #: ../../whatsnew/3.4.rst:2103 @@ -3015,8 +3080,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2113 msgid "" "The internal ``Netrc`` class in the :mod:`ftplib` module has been documented " -"as deprecated in its docstring for quite some time. It now emits a :exc:" -"`DeprecationWarning` and will be removed completely in Python 3.5." +"as deprecated in its docstring for quite some time. It now emits " +"a :exc:`DeprecationWarning` and will be removed completely in Python 3.5." msgstr "" #: ../../whatsnew/3.4.rst:2117 @@ -3033,12 +3098,12 @@ msgstr "" #: ../../whatsnew/3.4.rst:2123 msgid "" -"The :mod:`plistlib` :func:`~plistlib.readPlist`, :func:`~plistlib." -"writePlist`, :func:`~plistlib.readPlistFromBytes`, and :func:`~plistlib." -"writePlistToBytes` functions are deprecated in favor of the corresponding " -"new functions :func:`~plistlib.load`, :func:`~plistlib.dump`, :func:" -"`~plistlib.loads`, and :func:`~plistlib.dumps`. :func:`~plistlib.Data` is " -"deprecated in favor of just using the :class:`bytes` constructor." +"The :mod:`plistlib` :func:`~plistlib.readPlist`, :func:`~plistlib.writePlist`, :func:`~plistlib.readPlistFromBytes`, " +"and :func:`~plistlib.writePlistToBytes` functions are deprecated in favor of " +"the corresponding new " +"functions :func:`~plistlib.load`, :func:`~plistlib.dump`, :func:`~plistlib.loads`, " +"and :func:`~plistlib.dumps`. :func:`~plistlib.Data` is deprecated in favor " +"of just using the :class:`bytes` constructor." msgstr "" #: ../../whatsnew/3.4.rst:2130 @@ -3058,9 +3123,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:2138 msgid "" "The *parser* argument of :func:`xml.etree.ElementTree.iterparse` has been " -"deprecated, as has the *html* argument of :func:`~xml.etree.ElementTree." -"XMLParser`. To prepare for the removal of the latter, all arguments to " -"``XMLParser`` should be passed by keyword." +"deprecated, as has the *html* argument " +"of :func:`~xml.etree.ElementTree.XMLParser`. To prepare for the removal of " +"the latter, all arguments to ``XMLParser`` should be passed by keyword." msgstr "" #: ../../whatsnew/3.4.rst:2145 @@ -3085,7 +3150,7 @@ msgstr "已移除" #: ../../whatsnew/3.4.rst:2160 msgid "Operating Systems No Longer Supported" -msgstr "" +msgstr "不再支援的作業系統" #: ../../whatsnew/3.4.rst:2162 msgid "" @@ -3136,8 +3201,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2184 msgid "" "The ``PyThreadState.tick_counter`` field has been removed; its value has " -"been meaningless since Python 3.2, when the \"new GIL\" was introduced (:" -"issue:`19199`)." +"been meaningless since Python 3.2, when the \"new GIL\" was introduced " +"(:issue:`19199`)." msgstr "" #: ../../whatsnew/3.4.rst:2188 @@ -3148,9 +3213,9 @@ msgstr "" #: ../../whatsnew/3.4.rst:2191 msgid "" -"The *strict* argument to :class:`~http.client.HTTPConnection` and :class:" -"`~http.client.HTTPSConnection` has been removed. HTTP 0.9-style \"Simple " -"Responses\" are no longer supported." +"The *strict* argument to :class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` has been removed. HTTP 0.9-style " +"\"Simple Responses\" are no longer supported." msgstr "" #: ../../whatsnew/3.4.rst:2195 @@ -3163,8 +3228,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:2200 msgid "" -"Support for loading the deprecated ``TYPE_INT64`` has been removed from :mod:" -"`marshal`. (Contributed by Dan Riti in :issue:`15480`.)" +"Support for loading the deprecated ``TYPE_INT64`` has been removed " +"from :mod:`marshal`. (Contributed by Dan Riti in :issue:`15480`.)" msgstr "" #: ../../whatsnew/3.4.rst:2203 @@ -3181,16 +3246,16 @@ msgid "" "situation where previously working (but incorrect) code would start failing " "if an object gained a __format__ method, which means that your code may now " "raise a :exc:`TypeError` if you are using an ``'s'`` format code with " -"objects that do not have a __format__ method that handles it. See :issue:" -"`7994` for background." +"objects that do not have a __format__ method that handles it. " +"See :issue:`7994` for background." msgstr "" #: ../../whatsnew/3.4.rst:2215 msgid "" -":meth:`difflib.SequenceMatcher.isbjunk` and :meth:`difflib.SequenceMatcher." -"isbpopular` were deprecated in 3.2, and have now been removed: use ``x in sm." -"bjunk`` and ``x in sm.bpopular``, where *sm* is a :class:`~difflib." -"SequenceMatcher` object (:issue:`13248`)." +":meth:`difflib.SequenceMatcher.isbjunk` " +"and :meth:`difflib.SequenceMatcher.isbpopular` were deprecated in 3.2, and " +"have now been removed: use ``x in sm.bjunk`` and ``x in sm.bpopular``, where " +"*sm* is a :class:`~difflib.SequenceMatcher` object (:issue:`13248`)." msgstr "" #: ../../whatsnew/3.4.rst:2223 @@ -3234,12 +3299,12 @@ msgstr "" #: ../../whatsnew/3.4.rst:2248 msgid "" "In a posix shell, setting the :envvar:`PATH` environment variable to an " -"empty value is equivalent to not setting it at all. However, setting :" -"envvar:`PYTHONPATH` to an empty value was *not* equivalent to not setting it " -"at all: setting :envvar:`PYTHONPATH` to an empty value was equivalent to " -"setting it to ``.``, which leads to confusion when reasoning by analogy to " -"how :envvar:`PATH` works. The behavior now conforms to the posix convention " -"for :envvar:`PATH`." +"empty value is equivalent to not setting it at all. However, " +"setting :envvar:`PYTHONPATH` to an empty value was *not* equivalent to not " +"setting it at all: setting :envvar:`PYTHONPATH` to an empty value was " +"equivalent to setting it to ``.``, which leads to confusion when reasoning " +"by analogy to how :envvar:`PATH` works. The behavior now conforms to the " +"posix convention for :envvar:`PATH`." msgstr "" #: ../../whatsnew/3.4.rst:2256 @@ -3263,18 +3328,20 @@ msgstr "Python API 的變更" #: ../../whatsnew/3.4.rst:2268 msgid "" "The ABCs defined in :mod:`importlib.abc` now either raise the appropriate " -"exception or return a default value instead of raising :exc:" -"`NotImplementedError` blindly. This will only affect code calling :func:" -"`super` and falling through all the way to the ABCs. For compatibility, " -"catch both :exc:`NotImplementedError` or the appropriate exception as needed." +"exception or return a default value instead of " +"raising :exc:`NotImplementedError` blindly. This will only affect code " +"calling :func:`super` and falling through all the way to the ABCs. For " +"compatibility, catch both :exc:`NotImplementedError` or the appropriate " +"exception as needed." msgstr "" #: ../../whatsnew/3.4.rst:2274 msgid "" -"The module type now initializes the :attr:`~module.__package__` and :attr:" -"`~module.__loader__` attributes to ``None`` by default. To determine if " -"these attributes were set in a backwards-compatible fashion, use e.g. " -"``getattr(module, '__loader__', None) is not None``. (:issue:`17115`.)" +"The module type now initializes the :attr:`~module.__package__` " +"and :attr:`~module.__loader__` attributes to ``None`` by default. To " +"determine if these attributes were set in a backwards-compatible fashion, " +"use e.g. ``getattr(module, '__loader__', None) is not None``. " +"(:issue:`17115`.)" msgstr "" #: ../../whatsnew/3.4.rst:2280 @@ -3309,9 +3376,9 @@ msgid "" "incorrect for frozen modules to set the attribute as they are not loaded " "from any explicit location. If you must know that a module comes from frozen " "code then you can see if the module's ``__spec__.location`` is set to " -"``'frozen'``, check if the loader is a subclass of :class:`importlib." -"machinery.FrozenImporter`, or if Python 2 compatibility is necessary you can " -"use :func:`!imp.is_frozen`." +"``'frozen'``, check if the loader is a subclass " +"of :class:`importlib.machinery.FrozenImporter`, or if Python 2 compatibility " +"is necessary you can use :func:`!imp.is_frozen`." msgstr "" #: ../../whatsnew/3.4.rst:2305 @@ -3324,14 +3391,14 @@ msgstr "" #: ../../whatsnew/3.4.rst:2310 msgid "" -":meth:`importlib.abc.SourceLoader.get_source` no longer raises :exc:" -"`ImportError` when the source code being loaded triggers a :exc:" -"`SyntaxError` or :exc:`UnicodeDecodeError`. As :exc:`ImportError` is meant " -"to be raised only when source code cannot be found but it should, it was " -"felt to be over-reaching/overloading of that meaning when the source code is " -"found but improperly structured. If you were catching ImportError before and " -"wish to continue to ignore syntax or decoding issues, catch all three " -"exceptions now." +":meth:`importlib.abc.SourceLoader.get_source` no longer " +"raises :exc:`ImportError` when the source code being loaded triggers " +"a :exc:`SyntaxError` or :exc:`UnicodeDecodeError`. As :exc:`ImportError` is " +"meant to be raised only when source code cannot be found but it should, it " +"was felt to be over-reaching/overloading of that meaning when the source " +"code is found but improperly structured. If you were catching ImportError " +"before and wish to continue to ignore syntax or decoding issues, catch all " +"three exceptions now." msgstr "" #: ../../whatsnew/3.4.rst:2319 @@ -3348,12 +3415,13 @@ msgstr "" #: ../../whatsnew/3.4.rst:2329 msgid "" -":func:`inspect.getfullargspec` has been reimplemented on top of :func:" -"`inspect.signature` and hence handles a much wider variety of callable " -"objects than it did in the past. It is expected that additional builtin and " -"extension module callables will gain signature metadata over the course of " -"the Python 3.4 series. Code that assumes that :func:`inspect.getfullargspec` " -"will fail on non-Python callables may need to be adjusted accordingly." +":func:`inspect.getfullargspec` has been reimplemented on top " +"of :func:`inspect.signature` and hence handles a much wider variety of " +"callable objects than it did in the past. It is expected that additional " +"builtin and extension module callables will gain signature metadata over the " +"course of the Python 3.4 series. Code that assumes " +"that :func:`inspect.getfullargspec` will fail on non-Python callables may " +"need to be adjusted accordingly." msgstr "" #: ../../whatsnew/3.4.rst:2337 @@ -3366,8 +3434,8 @@ msgid "" "working directory will also now have an absolute path, including when using " "``-m`` with the interpreter (except for ``__main__.__file__`` when a script " "has been executed directly using a relative path) (Contributed by Brett " -"Cannon in :issue:`18416`). is specified on the command-line) (:issue:" -"`18416`)." +"Cannon in :issue:`18416`). is specified on the command-line) " +"(:issue:`18416`)." msgstr "" #: ../../whatsnew/3.4.rst:2348 @@ -3384,66 +3452,69 @@ msgid "" "Strings between ``from __future__ import ...`` statements now *always* raise " "a :exc:`SyntaxError`. Previously if there was no leading docstring, an " "interstitial string would sometimes be ignored. This brings CPython into " -"compliance with the language spec; Jython and PyPy already were. (:issue:" -"`17434`)." +"compliance with the language spec; Jython and PyPy already were. " +"(:issue:`17434`)." msgstr "" #: ../../whatsnew/3.4.rst:2360 msgid "" ":meth:`ssl.SSLSocket.getpeercert` and :meth:`ssl.SSLSocket.do_handshake` now " "raise an :exc:`OSError` with ``ENOTCONN`` when the ``SSLSocket`` is not " -"connected, instead of the previous behavior of raising an :exc:" -"`AttributeError`. In addition, :meth:`~ssl.SSLSocket.getpeercert` will " -"raise a :exc:`ValueError` if the handshake has not yet been done." +"connected, instead of the previous behavior of raising " +"an :exc:`AttributeError`. In addition, :meth:`~ssl.SSLSocket.getpeercert` " +"will raise a :exc:`ValueError` if the handshake has not yet been done." msgstr "" #: ../../whatsnew/3.4.rst:2366 msgid "" ":func:`base64.b32decode` now raises a :exc:`binascii.Error` when the input " "string contains non-b32-alphabet characters, instead of a :exc:`TypeError`. " -"This particular :exc:`TypeError` was missed when the other :exc:" -"`TypeError`\\ s were converted. (Contributed by Serhiy Storchaka in :issue:" -"`18011`.) Note: this change was also inadvertently applied in Python 3.3.3." +"This particular :exc:`TypeError` was missed when the " +"other :exc:`TypeError`\\ s were converted. (Contributed by Serhiy Storchaka " +"in :issue:`18011`.) Note: this change was also inadvertently applied in " +"Python 3.3.3." msgstr "" #: ../../whatsnew/3.4.rst:2373 msgid "" -"The :attr:`!file` attribute is now automatically closed when the creating :" -"class:`!cgi.FieldStorage` instance is garbage collected. If you were pulling " -"the file object out separately from the :class:`!cgi.FieldStorage` instance " -"and not keeping the instance alive, then you should either store the entire :" -"class:`!cgi.FieldStorage` instance or read the contents of the file before " -"the :class:`!cgi.FieldStorage` instance is garbage collected." +"The :attr:`!file` attribute is now automatically closed when the " +"creating :class:`!cgi.FieldStorage` instance is garbage collected. If you " +"were pulling the file object out separately from the :class:`!" +"cgi.FieldStorage` instance and not keeping the instance alive, then you " +"should either store the entire :class:`!cgi.FieldStorage` instance or read " +"the contents of the file before the :class:`!cgi.FieldStorage` instance is " +"garbage collected." msgstr "" #: ../../whatsnew/3.4.rst:2380 msgid "" "Calling ``read`` or ``write`` on a closed SSL socket now raises an " -"informative :exc:`ValueError` rather than the previous more mysterious :exc:" -"`AttributeError` (:issue:`9177`)." +"informative :exc:`ValueError` rather than the previous more " +"mysterious :exc:`AttributeError` (:issue:`9177`)." msgstr "" #: ../../whatsnew/3.4.rst:2384 msgid "" ":meth:`slice.indices` no longer produces an :exc:`OverflowError` for huge " -"values. As a consequence of this fix, :meth:`slice.indices` now raises a :" -"exc:`ValueError` if given a negative length; previously it returned nonsense " -"values (:issue:`14794`)." +"values. As a consequence of this fix, :meth:`slice.indices` now raises " +"a :exc:`ValueError` if given a negative length; previously it returned " +"nonsense values (:issue:`14794`)." msgstr "" #: ../../whatsnew/3.4.rst:2389 msgid "" "The :class:`complex` constructor, unlike the :mod:`cmath` functions, was " "incorrectly accepting :class:`float` values if an object's ``__complex__`` " -"special method returned one. This now raises a :exc:`TypeError`. (:issue:" -"`16290`.)" +"special method returned one. This now raises a :exc:`TypeError`. " +"(:issue:`16290`.)" msgstr "" #: ../../whatsnew/3.4.rst:2394 msgid "" -"The :class:`int` constructor in 3.2 and 3.3 erroneously accepts :class:" -"`float` values for the *base* parameter. It is unlikely anyone was doing " -"this, but if so, it will now raise a :exc:`TypeError` (:issue:`16772`)." +"The :class:`int` constructor in 3.2 and 3.3 erroneously " +"accepts :class:`float` values for the *base* parameter. It is unlikely " +"anyone was doing this, but if so, it will now raise a :exc:`TypeError` " +"(:issue:`16772`)." msgstr "" #: ../../whatsnew/3.4.rst:2398 @@ -3484,8 +3555,8 @@ msgid "" "isolation that :mod:`unittest` is designed to provide. However, if the lack " "of isolation is considered acceptable, the old behavior can be restored by " "creating a :mod:`~unittest.TestSuite` subclass that defines a " -"``_removeTestAtIndex`` method that does nothing (see :meth:`.TestSuite." -"__iter__`) (:issue:`11798`)." +"``_removeTestAtIndex`` method that does nothing " +"(see :meth:`.TestSuite.__iter__`) (:issue:`11798`)." msgstr "" #: ../../whatsnew/3.4.rst:2425 @@ -3518,8 +3589,8 @@ msgid "" "The new *convert_charrefs* argument to :class:`~html.parser.HTMLParser` " "currently defaults to ``False`` for backward compatibility, but will " "eventually be changed to default to ``True``. It is recommended that you " -"add this keyword, with the appropriate value, to any :class:`~html.parser." -"HTMLParser` calls in your code (:issue:`13633`)." +"add this keyword, with the appropriate value, to " +"any :class:`~html.parser.HTMLParser` calls in your code (:issue:`13633`)." msgstr "" #: ../../whatsnew/3.4.rst:2446 @@ -3543,8 +3614,8 @@ msgid "" "is ineffective in Python3 and will eventually raise an error if used. " "Depending on the function, the equivalent of its old Python2 behavior can be " "achieved using either a *newline* argument, or if necessary by wrapping the " -"stream in :mod:`~io.TextIOWrapper` to use its *newline* argument (:issue:" -"`15204`)." +"stream in :mod:`~io.TextIOWrapper` to use its *newline* argument " +"(:issue:`15204`)." msgstr "" #: ../../whatsnew/3.4.rst:2462 @@ -3574,10 +3645,10 @@ msgstr "" msgid "" "The :mod:`collections.abc` module has been slightly refactored as part of " "the Python startup improvements. As a consequence of this, it is no longer " -"the case that importing :mod:`collections` automatically imports :mod:" -"`collections.abc`. If your program depended on the (undocumented) implicit " -"import, you will need to add an explicit ``import collections.abc`` (:issue:" -"`20784`)." +"the case that importing :mod:`collections` automatically " +"imports :mod:`collections.abc`. If your program depended on the " +"(undocumented) implicit import, you will need to add an explicit ``import " +"collections.abc`` (:issue:`20784`)." msgstr "" #: ../../whatsnew/3.4.rst:2486 @@ -3586,16 +3657,16 @@ msgstr "C API 中的改動" #: ../../whatsnew/3.4.rst:2488 msgid "" -":c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr`, and :c:func:" -"`PyObject_Str`, along with some other internal C APIs, now include a " -"debugging assertion that ensures they are not used in situations where they " -"may silently discard a currently active exception. In cases where discarding " -"the active exception is expected and desired (for example, because it has " -"already been saved locally with :c:func:`PyErr_Fetch` or is being " -"deliberately replaced with a different exception), an explicit :c:func:" -"`PyErr_Clear` call will be needed to avoid triggering the assertion when " -"invoking these operations (directly or indirectly) and running against a " -"version of Python that is compiled with assertions enabled." +":c:func:`PyEval_EvalFrameEx`, :c:func:`PyObject_Repr`, " +"and :c:func:`PyObject_Str`, along with some other internal C APIs, now " +"include a debugging assertion that ensures they are not used in situations " +"where they may silently discard a currently active exception. In cases where " +"discarding the active exception is expected and desired (for example, " +"because it has already been saved locally with :c:func:`PyErr_Fetch` or is " +"being deliberately replaced with a different exception), an " +"explicit :c:func:`PyErr_Clear` call will be needed to avoid triggering the " +"assertion when invoking these operations (directly or indirectly) and " +"running against a version of Python that is compiled with assertions enabled." msgstr "" #: ../../whatsnew/3.4.rst:2500 @@ -3608,10 +3679,10 @@ msgstr "" #: ../../whatsnew/3.4.rst:2504 msgid "" "The result of the :c:data:`PyOS_ReadlineFunctionPointer` callback must now " -"be a string allocated by :c:func:`PyMem_RawMalloc` or :c:func:" -"`PyMem_RawRealloc`, or ``NULL`` if an error occurred, instead of a string " -"allocated by :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc` (:issue:" -"`16742`)" +"be a string allocated by :c:func:`PyMem_RawMalloc` " +"or :c:func:`PyMem_RawRealloc`, or ``NULL`` if an error occurred, instead of " +"a string allocated by :c:func:`PyMem_Malloc` or :c:func:`PyMem_Realloc` " +"(:issue:`16742`)" msgstr "" #: ../../whatsnew/3.4.rst:2510 diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index 36ad7689e8..539167e103 100644 --- a/whatsnew/3.5.po +++ b/whatsnew/3.5.po @@ -75,7 +75,7 @@ msgstr "新的函式庫模組:" #: ../../whatsnew/3.5.rst:69 msgid ":mod:`typing`: :ref:`PEP 484 -- Type Hints <whatsnew-pep-484>`." -msgstr "" +msgstr ":mod:`typing`::ref:`PEP 484 -- 型別提示 <whatsnew-pep-484>`。" #: ../../whatsnew/3.5.rst:70 msgid "" @@ -124,10 +124,10 @@ msgstr "CPython 實作改進:" #: ../../whatsnew/3.5.rst:96 msgid "" -"When the ``LC_TYPE`` locale is the POSIX locale (``C`` locale), :py:data:" -"`sys.stdin` and :py:data:`sys.stdout` now use the ``surrogateescape`` error " -"handler, instead of the ``strict`` error handler. (Contributed by Victor " -"Stinner in :issue:`19977`.)" +"When the ``LC_TYPE`` locale is the POSIX locale (``C`` " +"locale), :py:data:`sys.stdin` and :py:data:`sys.stdout` now use the " +"``surrogateescape`` error handler, instead of the ``strict`` error handler. " +"(Contributed by Victor Stinner in :issue:`19977`.)" msgstr "" #: ../../whatsnew/3.5.rst:101 @@ -191,8 +191,9 @@ msgstr "安全性改進:" #: ../../whatsnew/3.5.rst:138 msgid "" "SSLv3 is now disabled throughout the standard library. It can still be " -"enabled by instantiating a :class:`ssl.SSLContext` manually. (See :issue:" -"`22638` for more details; this change was backported to CPython 3.4 and 2.7.)" +"enabled by instantiating a :class:`ssl.SSLContext` manually. " +"(See :issue:`22638` for more details; this change was backported to CPython " +"3.4 and 2.7.)" msgstr "" #: ../../whatsnew/3.5.rst:143 @@ -374,9 +375,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:253 msgid "" -"Starting with CPython 3.5.2, ``__aiter__`` can directly return :term:" -"`asynchronous iterators <asynchronous iterator>`. Returning an :term:" -"`awaitable` object will result in a :exc:`PendingDeprecationWarning`." +"Starting with CPython 3.5.2, ``__aiter__`` can directly " +"return :term:`asynchronous iterators <asynchronous iterator>`. Returning " +"an :term:`awaitable` object will result in " +"a :exc:`PendingDeprecationWarning`." msgstr "" #: ../../whatsnew/3.5.rst:259 @@ -399,8 +401,8 @@ msgstr "" msgid "" ":pep:`465` adds the ``@`` infix operator for matrix multiplication. " "Currently, no builtin Python types implement the new operator, however, it " -"can be implemented by defining :meth:`__matmul__`, :meth:`__rmatmul__`, and :" -"meth:`__imatmul__` for regular, reflected, and in-place matrix " +"can be implemented by defining :meth:`__matmul__`, :meth:`__rmatmul__`, " +"and :meth:`__imatmul__` for regular, reflected, and in-place matrix " "multiplication. The semantics of these methods is similar to that of " "methods defining other infix arithmetic operators." msgstr "" @@ -629,12 +631,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:405 msgid "PEP 484 - Type Hints" -msgstr "" +msgstr "PEP 484 - 型別提示" #: ../../whatsnew/3.5.rst:407 msgid "" -"Function annotation syntax has been a Python feature since version 3.0 (:pep:" -"`3107`), however the semantics of annotations has been left undefined." +"Function annotation syntax has been a Python feature since version 3.0 " +"(:pep:`3107`), however the semantics of annotations has been left undefined." msgstr "" #: ../../whatsnew/3.5.rst:410 @@ -668,18 +670,18 @@ msgstr "" #: ../../whatsnew/3.5.rst:425 msgid "" -"While these annotations are available at runtime through the usual :attr:" -"`~object.__annotations__` attribute, *no automatic type checking happens at " -"runtime*. Instead, it is assumed that a separate off-line type checker (e." -"g. `mypy <https://mypy-lang.org>`_) will be used for on-demand source code " -"analysis." +"While these annotations are available at runtime through the " +"usual :attr:`~object.__annotations__` attribute, *no automatic type checking " +"happens at runtime*. Instead, it is assumed that a separate off-line type " +"checker (e.g. `mypy <https://mypy-lang.org>`_) will be used for on-demand " +"source code analysis." msgstr "" #: ../../whatsnew/3.5.rst:431 msgid "" -"The type system supports unions, generic types, and a special type named :" -"class:`~typing.Any` which is consistent with (i.e. assignable to and from) " -"all types." +"The type system supports unions, generic types, and a special type " +"named :class:`~typing.Any` which is consistent with (i.e. assignable to and " +"from) all types." msgstr "" #: ../../whatsnew/3.5.rst:437 @@ -688,7 +690,7 @@ msgstr ":mod:`typing` 模組文件" #: ../../whatsnew/3.5.rst:438 msgid ":pep:`484` -- Type Hints" -msgstr "" +msgstr ":pep:`484` -- 型別提示" #: ../../whatsnew/3.5.rst:439 msgid "" @@ -698,7 +700,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:441 msgid ":pep:`483` -- The Theory of Type Hints" -msgstr "" +msgstr ":pep:`483` -- 型別提示理論" #: ../../whatsnew/3.5.rst:442 msgid "PEP written by Guido van Rossum" @@ -832,37 +834,32 @@ msgstr ":mod:`faulthandler` 模組的函式;" #: ../../whatsnew/3.5.rst:519 msgid "" -":mod:`os` functions: :func:`~os.fchdir`, :func:`~os.fchmod`, :func:`~os." -"fchown`, :func:`~os.fdatasync`, :func:`~os.fstat`, :func:`~os.fstatvfs`, :" -"func:`~os.fsync`, :func:`~os.ftruncate`, :func:`~os.mkfifo`, :func:`~os." -"mknod`, :func:`~os.open`, :func:`~os.posix_fadvise`, :func:`~os." -"posix_fallocate`, :func:`~os.pread`, :func:`~os.pwrite`, :func:`~os.read`, :" -"func:`~os.readv`, :func:`~os.sendfile`, :func:`~os.wait3`, :func:`~os." -"wait4`, :func:`~os.wait`, :func:`~os.waitid`, :func:`~os.waitpid`, :func:" -"`~os.write`, :func:`~os.writev`;" +":mod:`os` " +"functions: :func:`~os.fchdir`, :func:`~os.fchmod`, :func:`~os.fchown`, :func:`~os.fdatasync`, :func:`~os.fstat`, :func:`~os.fstatvfs`, :func:`~os.fsync`, :func:`~os.ftruncate`, :func:`~os.mkfifo`, :func:`~os.mknod`, :func:`~os.open`, :func:`~os.posix_fadvise`, :func:`~os.posix_fallocate`, :func:`~os.pread`, :func:`~os.pwrite`, :func:`~os.read`, :func:`~os.readv`, :func:`~os.sendfile`, :func:`~os.wait3`, :func:`~os.wait4`, :func:`~os.wait`, :func:`~os.waitid`, :func:`~os.waitpid`, :func:`~os.write`, :func:`~os.writev`;" msgstr "" #: ../../whatsnew/3.5.rst:529 msgid "" -"special cases: :func:`os.close` and :func:`os.dup2` now ignore :py:const:" -"`~errno.EINTR` errors; the syscall is not retried (see the PEP for the " -"rationale);" +"special cases: :func:`os.close` and :func:`os.dup2` now " +"ignore :py:const:`~errno.EINTR` errors; the syscall is not retried (see the " +"PEP for the rationale);" msgstr "" #: ../../whatsnew/3.5.rst:533 msgid "" -":mod:`select` functions: :func:`devpoll.poll() <select.devpoll.poll>`, :func:" -"`epoll.poll() <select.epoll.poll>`, :func:`kqueue.control() <select.kqueue." -"control>`, :func:`poll.poll() <select.poll.poll>`, :func:`~select.select`;" +":mod:`select` functions: :func:`devpoll.poll() " +"<select.devpoll.poll>`, :func:`epoll.poll() " +"<select.epoll.poll>`, :func:`kqueue.control() " +"<select.kqueue.control>`, :func:`poll.poll() " +"<select.poll.poll>`, :func:`~select.select`;" msgstr "" #: ../../whatsnew/3.5.rst:538 msgid "" -"methods of the :class:`~socket.socket` class: :meth:`~socket.socket." -"accept`, :meth:`~socket.socket.connect` (except for non-blocking sockets), :" -"meth:`~socket.socket.recv`, :meth:`~socket.socket.recvfrom`, :meth:`~socket." -"socket.recvmsg`, :meth:`~socket.socket.send`, :meth:`~socket.socket." -"sendall`, :meth:`~socket.socket.sendmsg`, :meth:`~socket.socket.sendto`;" +"methods of the :class:`~socket.socket` " +"class: :meth:`~socket.socket.accept`, :meth:`~socket.socket.connect` (except " +"for non-blocking " +"sockets), :meth:`~socket.socket.recv`, :meth:`~socket.socket.recvfrom`, :meth:`~socket.socket.recvmsg`, :meth:`~socket.socket.send`, :meth:`~socket.socket.sendall`, :meth:`~socket.socket.sendmsg`, :meth:`~socket.socket.sendto`;" msgstr "" #: ../../whatsnew/3.5.rst:545 @@ -899,18 +896,18 @@ msgstr "" #: ../../whatsnew/3.5.rst:567 msgid "" ":pep:`479` changes the behavior of generators: when a ``StopIteration`` " -"exception is raised inside a generator, it is replaced with a :exc:" -"`RuntimeError` before it exits the generator frame. The main goal of this " -"change is to ease debugging in the situation where an unguarded :func:`next` " -"call raises ``StopIteration`` and causes the iteration controlled by the " -"generator to terminate silently. This is particularly pernicious in " -"combination with the ``yield from`` construct." +"exception is raised inside a generator, it is replaced with " +"a :exc:`RuntimeError` before it exits the generator frame. The main goal of " +"this change is to ease debugging in the situation where an " +"unguarded :func:`next` call raises ``StopIteration`` and causes the " +"iteration controlled by the generator to terminate silently. This is " +"particularly pernicious in combination with the ``yield from`` construct." msgstr "" #: ../../whatsnew/3.5.rst:575 msgid "" -"This is a backwards incompatible change, so to enable the new behavior, a :" -"term:`__future__` import is necessary::" +"This is a backwards incompatible change, so to enable the new behavior, " +"a :term:`__future__` import is necessary::" msgstr "" #: ../../whatsnew/3.5.rst:578 @@ -1057,15 +1054,15 @@ msgstr "" #: ../../whatsnew/3.5.rst:664 msgid "" -":pep:`488` does away with the concept of ``.pyo`` files. This means that ``." -"pyc`` files represent both unoptimized and optimized bytecode. To prevent " +":pep:`488` does away with the concept of ``.pyo`` files. This means that " +"``.pyc`` files represent both unoptimized and optimized bytecode. To prevent " "the need to constantly regenerate bytecode files, ``.pyc`` files now have an " "optional ``opt-`` tag in their name when the bytecode is optimized. This has " "the side-effect of no more bytecode file name clashes when running under " "either :option:`-O` or :option:`-OO`. Consequently, bytecode files generated " -"from :option:`-O`, and :option:`-OO` may now exist simultaneously. :func:" -"`importlib.util.cache_from_source` has an updated API to help with this " -"change." +"from :option:`-O`, and :option:`-OO` may now exist " +"simultaneously. :func:`importlib.util.cache_from_source` has an updated API " +"to help with this change." msgstr "" #: ../../whatsnew/3.5.rst:676 @@ -1121,22 +1118,22 @@ msgstr "" #: ../../whatsnew/3.5.rst:709 msgid "" -"The :option:`-b` option now affects comparisons of :class:`bytes` with :" -"class:`int`. (Contributed by Serhiy Storchaka in :issue:`23681`.)" +"The :option:`-b` option now affects comparisons of :class:`bytes` " +"with :class:`int`. (Contributed by Serhiy Storchaka in :issue:`23681`.)" msgstr "" #: ../../whatsnew/3.5.rst:712 msgid "" "New Kazakh ``kz1048`` and Tajik ``koi8_t`` :ref:`codecs <standard-" -"encodings>`. (Contributed by Serhiy Storchaka in :issue:`22682` and :issue:" -"`22681`.)" +"encodings>`. (Contributed by Serhiy Storchaka in :issue:`22682` " +"and :issue:`22681`.)" msgstr "" #: ../../whatsnew/3.5.rst:715 msgid "" -"Property docstrings are now writable. This is especially useful for :func:" -"`collections.namedtuple` docstrings. (Contributed by Berker Peksag in :issue:" -"`24064`.)" +"Property docstrings are now writable. This is especially useful " +"for :func:`collections.namedtuple` docstrings. (Contributed by Berker Peksag " +"in :issue:`24064`.)" msgstr "" #: ../../whatsnew/3.5.rst:719 @@ -1189,8 +1186,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:752 msgid "" -"The module implementation has been contributed by Paul Moore in :issue:" -"`23491`." +"The module implementation has been contributed by Paul Moore " +"in :issue:`23491`." msgstr "" #: ../../whatsnew/3.5.rst:757 @@ -1207,10 +1204,10 @@ msgstr "argparse" #: ../../whatsnew/3.5.rst:766 msgid "" -"The :class:`~argparse.ArgumentParser` class now allows disabling :ref:" -"`abbreviated usage <prefix-matching>` of long options by setting :ref:" -"`allow_abbrev` to ``False``. (Contributed by Jonathan Paugh, Steven " -"Bethard, paul j3 and Daniel Eriksson in :issue:`14910`.)" +"The :class:`~argparse.ArgumentParser` class now allows " +"disabling :ref:`abbreviated usage <prefix-matching>` of long options by " +"setting :ref:`allow_abbrev` to ``False``. (Contributed by Jonathan Paugh, " +"Steven Bethard, paul j3 and Daniel Eriksson in :issue:`14910`.)" msgstr "" #: ../../whatsnew/3.5.rst:773 @@ -1220,8 +1217,8 @@ msgstr "asyncio" #: ../../whatsnew/3.5.rst:775 msgid "" "Since the :mod:`asyncio` module is :term:`provisional <provisional API>`, " -"all changes introduced in Python 3.5 have also been backported to Python 3.4." -"x." +"all changes introduced in Python 3.5 have also been backported to Python " +"3.4.x." msgstr "" #: ../../whatsnew/3.5.rst:778 @@ -1230,9 +1227,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:780 msgid "" -"New debugging APIs: :meth:`loop.set_debug() <asyncio.loop.set_debug>` and :" -"meth:`loop.get_debug() <asyncio.loop.get_debug>` methods. (Contributed by " -"Victor Stinner.)" +"New debugging APIs: :meth:`loop.set_debug() <asyncio.loop.set_debug>` " +"and :meth:`loop.get_debug() <asyncio.loop.get_debug>` methods. (Contributed " +"by Victor Stinner.)" msgstr "" #: ../../whatsnew/3.5.rst:784 @@ -1258,23 +1255,24 @@ msgstr "" #: ../../whatsnew/3.5.rst:798 msgid "" -"A new :meth:`transport.get_write_buffer_limits() <asyncio.WriteTransport." -"get_write_buffer_limits>` method to inquire for *high-* and *low-* water " -"limits of the flow control. (Contributed by Victor Stinner.)" +"A new :meth:`transport.get_write_buffer_limits() " +"<asyncio.WriteTransport.get_write_buffer_limits>` method to inquire for " +"*high-* and *low-* water limits of the flow control. (Contributed by Victor " +"Stinner.)" msgstr "" #: ../../whatsnew/3.5.rst:803 msgid "" -"The :func:`~asyncio.async` function is deprecated in favor of :func:" -"`~asyncio.ensure_future`. (Contributed by Yury Selivanov.)" +"The :func:`~asyncio.async` function is deprecated in favor " +"of :func:`~asyncio.ensure_future`. (Contributed by Yury Selivanov.)" msgstr "" #: ../../whatsnew/3.5.rst:807 msgid "" -"New :meth:`loop.set_task_factory() <asyncio.loop.set_task_factory>` and :" -"meth:`loop.get_task_factory() <asyncio.loop.get_task_factory>` methods to " -"customize the task factory that :meth:`loop.create_task() <asyncio.loop." -"create_task>` method uses. (Contributed by Yury Selivanov.)" +"New :meth:`loop.set_task_factory() <asyncio.loop.set_task_factory>` " +"and :meth:`loop.get_task_factory() <asyncio.loop.get_task_factory>` methods " +"to customize the task factory that :meth:`loop.create_task() " +"<asyncio.loop.create_task>` method uses. (Contributed by Yury Selivanov.)" msgstr "" #: ../../whatsnew/3.5.rst:814 @@ -1285,8 +1283,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:818 msgid "" -"The ``JoinableQueue`` class was removed, in favor of the :class:`asyncio." -"Queue` class. (Contributed by Victor Stinner.)" +"The ``JoinableQueue`` class was removed, in favor of " +"the :class:`asyncio.Queue` class. (Contributed by Victor Stinner.)" msgstr "" #: ../../whatsnew/3.5.rst:822 @@ -1335,9 +1333,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:850 msgid "" -"New :meth:`loop.get_exception_handler() <asyncio.loop." -"get_exception_handler>` method to get the current exception handler. " -"(Contributed by Yury Selivanov.)" +"New :meth:`loop.get_exception_handler() " +"<asyncio.loop.get_exception_handler>` method to get the current exception " +"handler. (Contributed by Yury Selivanov.)" msgstr "" #: ../../whatsnew/3.5.rst:854 @@ -1349,8 +1347,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:859 msgid "" -"The :meth:`loop.create_connection() <asyncio.loop.create_connection>` and :" -"meth:`loop.create_server() <asyncio.loop.create_server>` methods are " +"The :meth:`loop.create_connection() <asyncio.loop.create_connection>` " +"and :meth:`loop.create_server() <asyncio.loop.create_server>` methods are " "optimized to avoid calling the system ``getaddrinfo`` function if the " "address is already resolved. (Contributed by A. Jesse Jiryu Davis.)" msgstr "" @@ -1399,10 +1397,10 @@ msgstr "code" #: ../../whatsnew/3.5.rst:895 msgid "" -"The :func:`InteractiveInterpreter.showtraceback() <code." -"InteractiveInterpreter.showtraceback>` method now prints the full chained " -"traceback, just like the interactive interpreter. (Contributed by Claudiu " -"Popa in :issue:`17442`.)" +"The :func:`InteractiveInterpreter.showtraceback() " +"<code.InteractiveInterpreter.showtraceback>` method now prints the full " +"chained traceback, just like the interactive interpreter. (Contributed by " +"Claudiu Popa in :issue:`17442`.)" msgstr "" #: ../../whatsnew/3.5.rst:901 @@ -1412,26 +1410,28 @@ msgstr "collections" #: ../../whatsnew/3.5.rst:905 msgid "" "The :class:`~collections.OrderedDict` class is now implemented in C, which " -"makes it 4 to 100 times faster. (Contributed by Eric Snow in :issue:" -"`16991`.)" +"makes it 4 to 100 times faster. (Contributed by Eric Snow " +"in :issue:`16991`.)" msgstr "" #: ../../whatsnew/3.5.rst:908 msgid "" -":meth:`OrderedDict.items() <collections.OrderedDict.items>`, :meth:" -"`OrderedDict.keys() <collections.OrderedDict.keys>`, :meth:`OrderedDict." -"values() <collections.OrderedDict.values>` views now support :func:" -"`reversed` iteration. (Contributed by Serhiy Storchaka in :issue:`19505`.)" +":meth:`OrderedDict.items() " +"<collections.OrderedDict.items>`, :meth:`OrderedDict.keys() " +"<collections.OrderedDict.keys>`, :meth:`OrderedDict.values() " +"<collections.OrderedDict.values>` views now support :func:`reversed` " +"iteration. (Contributed by Serhiy Storchaka in :issue:`19505`.)" msgstr "" #: ../../whatsnew/3.5.rst:914 msgid "" -"The :class:`~collections.deque` class now defines :meth:`~collections.deque." -"index`, :meth:`~collections.deque.insert`, and :meth:`~collections.deque." -"copy`, and supports the ``+`` and ``*`` operators. This allows deques to be " -"recognized as a :class:`~collections.abc.MutableSequence` and improves their " -"substitutability for lists. (Contributed by Raymond Hettinger in :issue:" -"`23704`.)" +"The :class:`~collections.deque` class now " +"defines :meth:`~collections.deque.index`, :meth:`~collections.deque.insert`, " +"and :meth:`~collections.deque.copy`, and supports the ``+`` and ``*`` " +"operators. This allows deques to be recognized as " +"a :class:`~collections.abc.MutableSequence` and improves their " +"substitutability for lists. (Contributed by Raymond Hettinger " +"in :issue:`23704`.)" msgstr "" #: ../../whatsnew/3.5.rst:921 @@ -1457,11 +1457,10 @@ msgstr "(由 Berker Peksag 在 :issue:`24064` 中貢獻。)" #: ../../whatsnew/3.5.rst:930 msgid "" -"The :class:`~collections.UserString` class now implements the :meth:" -"`__getnewargs__`, :meth:`__rmod__`, :meth:`~str.casefold`, :meth:`~str." -"format_map`, :meth:`~str.isprintable`, and :meth:`~str.maketrans` methods to " -"match the corresponding methods of :class:`str`. (Contributed by Joe Jevnik " -"in :issue:`22189`.)" +"The :class:`~collections.UserString` class now implements " +"the :meth:`__getnewargs__`, :meth:`__rmod__`, :meth:`~str.casefold`, :meth:`~str.format_map`, :meth:`~str.isprintable`, " +"and :meth:`~str.maketrans` methods to match the corresponding methods " +"of :class:`str`. (Contributed by Joe Jevnik in :issue:`22189`.)" msgstr "" #: ../../whatsnew/3.5.rst:938 @@ -1471,9 +1470,9 @@ msgstr "collections.abc" #: ../../whatsnew/3.5.rst:940 msgid "" "The :meth:`Sequence.index() <collections.abc.Sequence.index>` method now " -"accepts *start* and *stop* arguments to match the corresponding methods of :" -"class:`tuple`, :class:`list`, etc. (Contributed by Devin Jeanpierre in :" -"issue:`23086`.)" +"accepts *start* and *stop* arguments to match the corresponding methods " +"of :class:`tuple`, :class:`list`, etc. (Contributed by Devin Jeanpierre " +"in :issue:`23086`.)" msgstr "" #: ../../whatsnew/3.5.rst:945 @@ -1484,10 +1483,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:948 msgid "" -"New :class:`~collections.abc.Awaitable`, :class:`~collections.abc." -"Coroutine`, :class:`~collections.abc.AsyncIterator`, and :class:" -"`~collections.abc.AsyncIterable` abstract base classes. (Contributed by Yury " -"Selivanov in :issue:`24184`.)" +"New :class:`~collections.abc.Awaitable`, :class:`~collections.abc.Coroutine`, :class:`~collections.abc.AsyncIterator`, " +"and :class:`~collections.abc.AsyncIterable` abstract base classes. " +"(Contributed by Yury Selivanov in :issue:`24184`.)" msgstr "" #: ../../whatsnew/3.5.rst:953 @@ -1503,8 +1501,8 @@ msgstr "compileall" #: ../../whatsnew/3.5.rst:960 msgid "" "A new :mod:`compileall` option, :samp:`-j {N}`, allows running *N* workers " -"simultaneously to perform parallel bytecode compilation. The :func:" -"`~compileall.compile_dir` function has a corresponding ``workers`` " +"simultaneously to perform parallel bytecode compilation. " +"The :func:`~compileall.compile_dir` function has a corresponding ``workers`` " "parameter. (Contributed by Claudiu Popa in :issue:`16104`.)" msgstr "" @@ -1518,10 +1516,11 @@ msgstr "" msgid "" "The ``-q`` command line option can now be specified more than once, in which " "case all output, including errors, will be suppressed. The corresponding " -"``quiet`` parameter in :func:`~compileall.compile_dir`, :func:`~compileall." -"compile_file`, and :func:`~compileall.compile_path` can now accept an " -"integer value indicating the level of output suppression. (Contributed by " -"Thomas Kluyver in :issue:`21338`.)" +"``quiet`` parameter " +"in :func:`~compileall.compile_dir`, :func:`~compileall.compile_file`, " +"and :func:`~compileall.compile_path` can now accept an integer value " +"indicating the level of output suppression. (Contributed by Thomas Kluyver " +"in :issue:`21338`.)" msgstr "" #: ../../whatsnew/3.5.rst:977 @@ -1550,10 +1549,10 @@ msgstr "configparser" #: ../../whatsnew/3.5.rst:992 msgid "" ":mod:`configparser` now provides a way to customize the conversion of values " -"by specifying a dictionary of converters in the :class:`~configparser." -"ConfigParser` constructor, or by defining them as methods in " -"``ConfigParser`` subclasses. Converters defined in a parser instance are " -"inherited by its section proxies." +"by specifying a dictionary of converters in " +"the :class:`~configparser.ConfigParser` constructor, or by defining them as " +"methods in ``ConfigParser`` subclasses. Converters defined in a parser " +"instance are inherited by its section proxies." msgstr "" #: ../../whatsnew/3.5.rst:998 @@ -1660,8 +1659,8 @@ msgstr "dbm" #: ../../whatsnew/3.5.rst:1056 msgid "" ":func:`dumb.open <dbm.dumb.open>` always creates a new database when the " -"flag has the value ``\"n\"``. (Contributed by Claudiu Popa in :issue:" -"`18039`.)" +"flag has the value ``\"n\"``. (Contributed by Claudiu Popa " +"in :issue:`18039`.)" msgstr "" #: ../../whatsnew/3.5.rst:1061 @@ -1673,8 +1672,8 @@ msgid "" "The charset of HTML documents generated by :meth:`HtmlDiff.make_file() " "<difflib.HtmlDiff.make_file>` can now be customized by using a new *charset* " "keyword-only argument. The default charset of HTML document changed from " -"``\"ISO-8859-1\"`` to ``\"utf-8\"``. (Contributed by Berker Peksag in :issue:" -"`2052`.)" +"``\"ISO-8859-1\"`` to ``\"utf-8\"``. (Contributed by Berker Peksag " +"in :issue:`2052`.)" msgstr "" #: ../../whatsnew/3.5.rst:1070 @@ -1708,9 +1707,10 @@ msgstr "doctest" #: ../../whatsnew/3.5.rst:1090 msgid "" -"The :func:`~doctest.DocTestSuite` function returns an empty :class:`unittest." -"TestSuite` if *module* contains no docstrings, instead of raising :exc:" -"`ValueError`. (Contributed by Glenn Jones in :issue:`15916`.)" +"The :func:`~doctest.DocTestSuite` function returns an " +"empty :class:`unittest.TestSuite` if *module* contains no docstrings, " +"instead of raising :exc:`ValueError`. (Contributed by Glenn Jones " +"in :issue:`15916`.)" msgstr "" #: ../../whatsnew/3.5.rst:1096 @@ -1719,19 +1719,20 @@ msgstr "email" #: ../../whatsnew/3.5.rst:1098 msgid "" -"A new policy option :attr:`Policy.mangle_from_ <email.policy.Policy." -"mangle_from_>` controls whether or not lines that start with ``\"From \"`` " -"in email bodies are prefixed with a ``\">\"`` character by generators. The " -"default is ``True`` for :attr:`~email.policy.compat32` and ``False`` for all " -"other policies. (Contributed by Milan Oberkirch in :issue:`20098`.)" +"A new policy option :attr:`Policy.mangle_from_ " +"<email.policy.Policy.mangle_from_>` controls whether or not lines that start " +"with ``\"From \"`` in email bodies are prefixed with a ``\">\"`` character " +"by generators. The default is ``True`` for :attr:`~email.policy.compat32` " +"and ``False`` for all other policies. (Contributed by Milan Oberkirch " +"in :issue:`20098`.)" msgstr "" #: ../../whatsnew/3.5.rst:1104 msgid "" -"A new :meth:`Message.get_content_disposition() <email.message.Message." -"get_content_disposition>` method provides easy access to a canonical value " -"for the :mailheader:`Content-Disposition` header. (Contributed by Abhilash " -"Raj in :issue:`21083`.)" +"A new :meth:`Message.get_content_disposition() " +"<email.message.Message.get_content_disposition>` method provides easy access " +"to a canonical value for the :mailheader:`Content-Disposition` header. " +"(Contributed by Abhilash Raj in :issue:`21083`.)" msgstr "" #: ../../whatsnew/3.5.rst:1110 @@ -1739,9 +1740,9 @@ msgid "" "A new policy option :attr:`EmailPolicy.utf8 <email.policy.EmailPolicy.utf8>` " "can be set to ``True`` to encode email headers using the UTF-8 charset " "instead of using encoded words. This allows ``Messages`` to be formatted " -"according to :rfc:`6532` and used with an SMTP server that supports the :rfc:" -"`6531` ``SMTPUTF8`` extension. (Contributed by R. David Murray in :issue:" -"`24211`.)" +"according to :rfc:`6532` and used with an SMTP server that supports " +"the :rfc:`6531` ``SMTPUTF8`` extension. (Contributed by R. David Murray " +"in :issue:`24211`.)" msgstr "" #: ../../whatsnew/3.5.rst:1117 @@ -1785,10 +1786,10 @@ msgstr "faulthandler" #: ../../whatsnew/3.5.rst:1140 msgid "" -"The :func:`~faulthandler.enable`, :func:`~faulthandler.register`, :func:" -"`~faulthandler.dump_traceback` and :func:`~faulthandler." -"dump_traceback_later` functions now accept file descriptors in addition to " -"file-like objects. (Contributed by Wei Wu in :issue:`23566`.)" +"The :func:`~faulthandler.enable`, :func:`~faulthandler.register`, :func:`~faulthandler.dump_traceback` " +"and :func:`~faulthandler.dump_traceback_later` functions now accept file " +"descriptors in addition to file-like objects. (Contributed by Wei Wu " +"in :issue:`23566`.)" msgstr "" #: ../../whatsnew/3.5.rst:1148 @@ -1820,8 +1821,8 @@ msgstr "gzip" #: ../../whatsnew/3.5.rst:1168 msgid "" "The *mode* argument of the :class:`~gzip.GzipFile` constructor now accepts " -"``\"x\"`` to request exclusive creation. (Contributed by Tim Heaney in :" -"issue:`19222`.)" +"``\"x\"`` to request exclusive creation. (Contributed by Tim Heaney " +"in :issue:`19222`.)" msgstr "" #: ../../whatsnew/3.5.rst:1174 @@ -1875,10 +1876,11 @@ msgstr "http.client" #: ../../whatsnew/3.5.rst:1203 msgid "" -":meth:`HTTPConnection.getresponse() <http.client.HTTPConnection." -"getresponse>` now raises a :exc:`~http.client.RemoteDisconnected` exception " -"when a remote server connection is closed unexpectedly. Additionally, if a :" -"exc:`ConnectionError` (of which ``RemoteDisconnected`` is a subclass) is " +":meth:`HTTPConnection.getresponse() " +"<http.client.HTTPConnection.getresponse>` now raises " +"a :exc:`~http.client.RemoteDisconnected` exception when a remote server " +"connection is closed unexpectedly. Additionally, if " +"a :exc:`ConnectionError` (of which ``RemoteDisconnected`` is a subclass) is " "raised, the client socket is now closed automatically, and will reconnect on " "the next request::" msgstr "" @@ -1914,10 +1916,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:1225 msgid "" "Since idlelib implements the IDLE shell and editor and is not intended for " -"import by other programs, it gets improvements with every release. See :" -"file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since 3.4.0, as " -"well as changes made in future 3.5.x releases. This file is also available " -"from the IDLE :menuselection:`Help --> About IDLE` dialog." +"import by other programs, it gets improvements with every release. " +"See :file:`Lib/idlelib/NEWS.txt` for a cumulative list of changes since " +"3.4.0, as well as changes made in future 3.5.x releases. This file is also " +"available from the IDLE :menuselection:`Help --> About IDLE` dialog." msgstr "" #: ../../whatsnew/3.5.rst:1233 @@ -1934,12 +1936,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:1240 msgid "" -"The :mod:`imaplib` module now supports :rfc:`5161` (ENABLE Extension) and :" -"rfc:`6855` (UTF-8 Support) via the :meth:`IMAP4.enable() <imaplib.IMAP4." -"enable>` method. A new :attr:`IMAP4.utf8_enabled <imaplib.IMAP4." -"utf8_enabled>` attribute tracks whether or not :rfc:`6855` support is " -"enabled. (Contributed by Milan Oberkirch, R. David Murray, and Maciej Szulik " -"in :issue:`21800`.)" +"The :mod:`imaplib` module now supports :rfc:`5161` (ENABLE Extension) " +"and :rfc:`6855` (UTF-8 Support) via the :meth:`IMAP4.enable() " +"<imaplib.IMAP4.enable>` method. A new :attr:`IMAP4.utf8_enabled " +"<imaplib.IMAP4.utf8_enabled>` attribute tracks whether or not :rfc:`6855` " +"support is enabled. (Contributed by Milan Oberkirch, R. David Murray, and " +"Maciej Szulik in :issue:`21800`.)" msgstr "" #: ../../whatsnew/3.5.rst:1247 @@ -1955,10 +1957,10 @@ msgstr "imghdr" #: ../../whatsnew/3.5.rst:1255 msgid "" -"The :func:`!what` function now recognizes the `OpenEXR <https://www.openexr." -"com>`_ format (contributed by Martin Vignali and Claudiu Popa in :issue:" -"`20295`), and the `WebP <https://en.wikipedia.org/wiki/WebP>`_ format " -"(contributed by Fabrice Aneche and Claudiu Popa in :issue:`20197`.)" +"The :func:`!what` function now recognizes the `OpenEXR <https://" +"www.openexr.com>`_ format (contributed by Martin Vignali and Claudiu Popa " +"in :issue:`20295`), and the `WebP <https://en.wikipedia.org/wiki/WebP>`_ " +"format (contributed by Fabrice Aneche and Claudiu Popa in :issue:`20197`.)" msgstr "" #: ../../whatsnew/3.5.rst:1263 @@ -1974,11 +1976,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:1269 msgid "" -"The :func:`abc.InspectLoader.source_to_code() <importlib.abc.InspectLoader." -"source_to_code>` method is now a static method. This makes it easier to " -"initialize a module object with code compiled from a string by running " -"``exec(code, module.__dict__)``. (Contributed by Brett Cannon in :issue:" -"`21156`.)" +"The :func:`abc.InspectLoader.source_to_code() " +"<importlib.abc.InspectLoader.source_to_code>` method is now a static " +"method. This makes it easier to initialize a module object with code " +"compiled from a string by running ``exec(code, module.__dict__)``. " +"(Contributed by Brett Cannon in :issue:`21156`.)" msgstr "" #: ../../whatsnew/3.5.rst:1275 @@ -1997,15 +1999,15 @@ msgstr "inspect" #: ../../whatsnew/3.5.rst:1285 msgid "" "Both the :class:`~inspect.Signature` and :class:`~inspect.Parameter` classes " -"are now picklable and hashable. (Contributed by Yury Selivanov in :issue:" -"`20726` and :issue:`20334`.)" +"are now picklable and hashable. (Contributed by Yury Selivanov " +"in :issue:`20726` and :issue:`20334`.)" msgstr "" #: ../../whatsnew/3.5.rst:1289 msgid "" -"A new :meth:`BoundArguments.apply_defaults() <inspect.BoundArguments." -"apply_defaults>` method provides a way to set default values for missing " -"arguments::" +"A new :meth:`BoundArguments.apply_defaults() " +"<inspect.BoundArguments.apply_defaults>` method provides a way to set " +"default values for missing arguments::" msgstr "" #: ../../whatsnew/3.5.rst:1293 @@ -2028,34 +2030,34 @@ msgstr "(由 Yury Selivanov 在 :issue:`24190` 中貢獻。)" #: ../../whatsnew/3.5.rst:1301 msgid "" -"A new class method :meth:`Signature.from_callable() <inspect.Signature." -"from_callable>` makes subclassing of :class:`~inspect.Signature` easier. " -"(Contributed by Yury Selivanov and Eric Snow in :issue:`17373`.)" +"A new class method :meth:`Signature.from_callable() " +"<inspect.Signature.from_callable>` makes subclassing " +"of :class:`~inspect.Signature` easier. (Contributed by Yury Selivanov and " +"Eric Snow in :issue:`17373`.)" msgstr "" #: ../../whatsnew/3.5.rst:1306 msgid "" "The :func:`~inspect.signature` function now accepts a *follow_wrapped* " "optional keyword argument, which, when set to ``False``, disables automatic " -"following of ``__wrapped__`` links. (Contributed by Yury Selivanov in :issue:" -"`20691`.)" +"following of ``__wrapped__`` links. (Contributed by Yury Selivanov " +"in :issue:`20691`.)" msgstr "" #: ../../whatsnew/3.5.rst:1311 msgid "" "A set of new functions to inspect :term:`coroutine functions <coroutine " -"function>` and :term:`coroutine objects <coroutine>` has been added: :func:" -"`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`, :func:" -"`~inspect.isawaitable`, :func:`~inspect.getcoroutinelocals`, and :func:" -"`~inspect.getcoroutinestate`. (Contributed by Yury Selivanov in :issue:" -"`24017` and :issue:`24400`.)" +"function>` and :term:`coroutine objects <coroutine>` has been " +"added: :func:`~inspect.iscoroutine`, :func:`~inspect.iscoroutinefunction`, :func:`~inspect.isawaitable`, :func:`~inspect.getcoroutinelocals`, " +"and :func:`~inspect.getcoroutinestate`. (Contributed by Yury Selivanov " +"in :issue:`24017` and :issue:`24400`.)" msgstr "" #: ../../whatsnew/3.5.rst:1319 msgid "" -"The :func:`~inspect.stack`, :func:`~inspect.trace`, :func:`~inspect." -"getouterframes`, and :func:`~inspect.getinnerframes` functions now return a " -"list of named tuples. (Contributed by Daniel Shahaf in :issue:`16808`.)" +"The :func:`~inspect.stack`, :func:`~inspect.trace`, :func:`~inspect.getouterframes`, " +"and :func:`~inspect.getinnerframes` functions now return a list of named " +"tuples. (Contributed by Daniel Shahaf in :issue:`16808`.)" msgstr "" #: ../../whatsnew/3.5.rst:1326 @@ -2065,10 +2067,10 @@ msgstr "io" #: ../../whatsnew/3.5.rst:1328 msgid "" "A new :meth:`BufferedIOBase.readinto1() <io.BufferedIOBase.readinto1>` " -"method, that uses at most one call to the underlying raw stream's :meth:" -"`RawIOBase.read() <io.RawIOBase.read>` or :meth:`RawIOBase.readinto() <io." -"RawIOBase.readinto>` methods. (Contributed by Nikolaus Rath in :issue:" -"`20578`.)" +"method, that uses at most one call to the underlying raw " +"stream's :meth:`RawIOBase.read() <io.RawIOBase.read>` " +"or :meth:`RawIOBase.readinto() <io.RawIOBase.readinto>` methods. " +"(Contributed by Nikolaus Rath in :issue:`20578`.)" msgstr "" #: ../../whatsnew/3.5.rst:1336 @@ -2102,9 +2104,9 @@ msgstr "(由 Peter Moody 和 Antoine Pitrou 在 :issue:`16531` 中貢獻。) #: ../../whatsnew/3.5.rst:1350 msgid "" -"A new :attr:`~ipaddress.IPv4Network.reverse_pointer` attribute for the :" -"class:`~ipaddress.IPv4Network` and :class:`~ipaddress.IPv6Network` classes " -"returns the name of the reverse DNS PTR record::" +"A new :attr:`~ipaddress.IPv4Network.reverse_pointer` attribute for " +"the :class:`~ipaddress.IPv4Network` and :class:`~ipaddress.IPv6Network` " +"classes returns the name of the reverse DNS PTR record::" msgstr "" #: ../../whatsnew/3.5.rst:1354 @@ -2137,14 +2139,14 @@ msgstr "json" msgid "" "The :mod:`json.tool` command line interface now preserves the order of keys " "in JSON objects passed in input. The new ``--sort-keys`` option can be used " -"to sort the keys alphabetically. (Contributed by Berker Peksag in :issue:" -"`21650`.)" +"to sort the keys alphabetically. (Contributed by Berker Peksag " +"in :issue:`21650`.)" msgstr "" #: ../../whatsnew/3.5.rst:1373 msgid "" -"JSON decoder now raises :exc:`~json.JSONDecodeError` instead of :exc:" -"`ValueError` to provide better context information about the error. " +"JSON decoder now raises :exc:`~json.JSONDecodeError` instead " +"of :exc:`ValueError` to provide better context information about the error. " "(Contributed by Serhiy Storchaka in :issue:`19361`.)" msgstr "" @@ -2204,10 +2206,10 @@ msgstr "logging" #: ../../whatsnew/3.5.rst:1410 msgid "" -"All logging methods (:class:`~logging.Logger` :meth:`~logging.Logger.log`, :" -"meth:`~logging.Logger.exception`, :meth:`~logging.Logger.critical`, :meth:" -"`~logging.Logger.debug`, etc.), now accept exception instances as an " -"*exc_info* argument, in addition to boolean values and exception tuples::" +"All logging methods " +"(:class:`~logging.Logger` :meth:`~logging.Logger.log`, :meth:`~logging.Logger.exception`, :meth:`~logging.Logger.critical`, :meth:`~logging.Logger.debug`, " +"etc.), now accept exception instances as an *exc_info* argument, in addition " +"to boolean values and exception tuples::" msgstr "" #: ../../whatsnew/3.5.rst:1416 @@ -2234,8 +2236,8 @@ msgstr "(由 Yury Selivanov 在 :issue:`20537` 中貢獻。)" msgid "" "The :class:`handlers.HTTPHandler <logging.handlers.HTTPHandler>` class now " "accepts an optional :class:`ssl.SSLContext` instance to configure SSL " -"settings used in an HTTP connection. (Contributed by Alex Gaynor in :issue:" -"`22788`.)" +"settings used in an HTTP connection. (Contributed by Alex Gaynor " +"in :issue:`22788`.)" msgstr "" #: ../../whatsnew/3.5.rst:1430 @@ -2263,9 +2265,9 @@ msgstr "math" #: ../../whatsnew/3.5.rst:1448 msgid "" -"Two new constants have been added to the :mod:`math` module: :data:`~math." -"inf` and :data:`~math.nan`. (Contributed by Mark Dickinson in :issue:" -"`23185`.)" +"Two new constants have been added to the :mod:`math` " +"module: :data:`~math.inf` and :data:`~math.nan`. (Contributed by Mark " +"Dickinson in :issue:`23185`.)" msgstr "" #: ../../whatsnew/3.5.rst:1451 @@ -2287,9 +2289,10 @@ msgstr "multiprocessing" #: ../../whatsnew/3.5.rst:1462 msgid "" -":func:`sharedctypes.synchronized() <multiprocessing.sharedctypes." -"synchronized>` objects now support the :term:`context manager` protocol. " -"(Contributed by Charles-François Natali in :issue:`21565`.)" +":func:`sharedctypes.synchronized() " +"<multiprocessing.sharedctypes.synchronized>` objects now support " +"the :term:`context manager` protocol. (Contributed by Charles-François " +"Natali in :issue:`21565`.)" msgstr "" #: ../../whatsnew/3.5.rst:1468 @@ -2298,16 +2301,16 @@ msgstr "operator" #: ../../whatsnew/3.5.rst:1470 msgid "" -":func:`~operator.attrgetter`, :func:`~operator.itemgetter`, and :func:" -"`~operator.methodcaller` objects now support pickling. (Contributed by Josh " -"Rosenberg and Serhiy Storchaka in :issue:`22955`.)" +":func:`~operator.attrgetter`, :func:`~operator.itemgetter`, " +"and :func:`~operator.methodcaller` objects now support pickling. " +"(Contributed by Josh Rosenberg and Serhiy Storchaka in :issue:`22955`.)" msgstr "" #: ../../whatsnew/3.5.rst:1474 msgid "" "New :func:`~operator.matmul` and :func:`~operator.imatmul` functions to " -"perform matrix multiplication. (Contributed by Benjamin Peterson in :issue:" -"`21176`.)" +"perform matrix multiplication. (Contributed by Benjamin Peterson " +"in :issue:`21176`.)" msgstr "" #: ../../whatsnew/3.5.rst:1480 @@ -2316,21 +2319,22 @@ msgstr "os" #: ../../whatsnew/3.5.rst:1482 msgid "" -"The new :func:`~os.scandir` function returning an iterator of :class:`~os." -"DirEntry` objects has been added. If possible, :func:`~os.scandir` extracts " -"file attributes while scanning a directory, removing the need to perform " -"subsequent system calls to determine file type or attributes, which may " -"significantly improve performance. (Contributed by Ben Hoyt with the help " -"of Victor Stinner in :issue:`22524`.)" +"The new :func:`~os.scandir` function returning an iterator " +"of :class:`~os.DirEntry` objects has been added. If " +"possible, :func:`~os.scandir` extracts file attributes while scanning a " +"directory, removing the need to perform subsequent system calls to determine " +"file type or attributes, which may significantly improve performance. " +"(Contributed by Ben Hoyt with the help of Victor Stinner in :issue:`22524`.)" msgstr "" #: ../../whatsnew/3.5.rst:1489 msgid "" -"On Windows, a new :attr:`stat_result.st_file_attributes <os.stat_result." -"st_file_attributes>` attribute is now available. It corresponds to the " -"``dwFileAttributes`` member of the ``BY_HANDLE_FILE_INFORMATION`` structure " -"returned by ``GetFileInformationByHandle()``. (Contributed by Ben Hoyt in :" -"issue:`21719`.)" +"On Windows, a new :attr:`stat_result.st_file_attributes " +"<os.stat_result.st_file_attributes>` attribute is now available. It " +"corresponds to the ``dwFileAttributes`` member of the " +"``BY_HANDLE_FILE_INFORMATION`` structure returned by " +"``GetFileInformationByHandle()``. (Contributed by Ben Hoyt " +"in :issue:`21719`.)" msgstr "" #: ../../whatsnew/3.5.rst:1495 @@ -2344,8 +2348,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:1500 msgid "" "New :func:`~os.get_blocking` and :func:`~os.set_blocking` functions allow " -"getting and setting a file descriptor's blocking mode (:const:`~os." -"O_NONBLOCK`.) (Contributed by Victor Stinner in :issue:`22054`.)" +"getting and setting a file descriptor's blocking mode " +"(:const:`~os.O_NONBLOCK`.) (Contributed by Victor Stinner in :issue:`22054`.)" msgstr "" #: ../../whatsnew/3.5.rst:1504 @@ -2357,8 +2361,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:1507 msgid "" "There is a new :func:`os.path.commonpath` function returning the longest " -"common sub-path of each passed pathname. Unlike the :func:`os.path." -"commonprefix` function, it always returns a valid path::" +"common sub-path of each passed pathname. Unlike " +"the :func:`os.path.commonprefix` function, it always returns a valid path::" msgstr "" #: ../../whatsnew/3.5.rst:1512 @@ -2426,16 +2430,18 @@ msgstr "" msgid "" "A new :meth:`Path.home() <pathlib.Path.home>` class method can be used to " "get a :class:`~pathlib.Path` instance representing the user’s home " -"directory. (Contributed by Victor Salgado and Mayank Tripathi in :issue:" -"`19777`.)" +"directory. (Contributed by Victor Salgado and Mayank Tripathi " +"in :issue:`19777`.)" msgstr "" #: ../../whatsnew/3.5.rst:1549 msgid "" -"New :meth:`Path.write_text() <pathlib.Path.write_text>`, :meth:`Path." -"read_text() <pathlib.Path.read_text>`, :meth:`Path.write_bytes() <pathlib." -"Path.write_bytes>`, :meth:`Path.read_bytes() <pathlib.Path.read_bytes>` " -"methods to simplify read/write operations on files." +"New :meth:`Path.write_text() " +"<pathlib.Path.write_text>`, :meth:`Path.read_text() " +"<pathlib.Path.read_text>`, :meth:`Path.write_bytes() " +"<pathlib.Path.write_bytes>`, :meth:`Path.read_bytes() " +"<pathlib.Path.read_bytes>` methods to simplify read/write operations on " +"files." msgstr "" #: ../../whatsnew/3.5.rst:1555 @@ -2528,10 +2534,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:1605 msgid "" -"The :class:`re.error` exceptions have new attributes, :attr:`~re.error." -"msg`, :attr:`~re.error.pattern`, :attr:`~re.error.pos`, :attr:`~re.error." -"lineno`, and :attr:`~re.error.colno`, that provide better context " -"information about the error::" +"The :class:`re.error` exceptions have new " +"attributes, :attr:`~re.error.msg`, :attr:`~re.error.pattern`, :attr:`~re.error.pos`, :attr:`~re.error.lineno`, " +"and :attr:`~re.error.colno`, that provide better context information about " +"the error::" msgstr "" #: ../../whatsnew/3.5.rst:1611 @@ -2631,9 +2637,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:1677 msgid "" -"The :class:`!SMTPServer` class now advertises the ``8BITMIME`` extension (:" -"rfc:`6152`) if *decode_data* has been set ``True``. If the client specifies " -"``BODY=8BITMIME`` on the ``MAIL`` command, it is passed to :meth:`!" +"The :class:`!SMTPServer` class now advertises the ``8BITMIME`` extension " +"(:rfc:`6152`) if *decode_data* has been set ``True``. If the client " +"specifies ``BODY=8BITMIME`` on the ``MAIL`` command, it is passed to :meth:`!" "SMTPServer.process_message` via the *mail_options* keyword. (Contributed by " "Milan Oberkirch and R. David Murray in :issue:`21795`.)" msgstr "" @@ -2670,16 +2676,16 @@ msgstr "" msgid "" "The :meth:`SMTP.set_debuglevel() <smtplib.SMTP.set_debuglevel>` method now " "accepts an additional debuglevel (2), which enables timestamps in debug " -"messages. (Contributed by Gavin Chappell and Maciej Szulik in :issue:" -"`16914`.)" +"messages. (Contributed by Gavin Chappell and Maciej Szulik " +"in :issue:`16914`.)" msgstr "" #: ../../whatsnew/3.5.rst:1708 msgid "" -"Both the :meth:`SMTP.sendmail() <smtplib.SMTP.sendmail>` and :meth:`SMTP." -"send_message() <smtplib.SMTP.send_message>` methods now support :rfc:`6531` " -"(SMTPUTF8). (Contributed by Milan Oberkirch and R. David Murray in :issue:" -"`22027`.)" +"Both the :meth:`SMTP.sendmail() <smtplib.SMTP.sendmail>` " +"and :meth:`SMTP.send_message() <smtplib.SMTP.send_message>` methods now " +"support :rfc:`6531` (SMTPUTF8). (Contributed by Milan Oberkirch and R. David " +"Murray in :issue:`22027`.)" msgstr "" #: ../../whatsnew/3.5.rst:1715 @@ -2688,8 +2694,9 @@ msgstr "sndhdr" #: ../../whatsnew/3.5.rst:1717 msgid "" -"The :func:`!what` and :func:`!whathdr` functions now return a :func:" -"`~collections.namedtuple`. (Contributed by Claudiu Popa in :issue:`18615`.)" +"The :func:`!what` and :func:`!whathdr` functions now return " +"a :func:`~collections.namedtuple`. (Contributed by Claudiu Popa " +"in :issue:`18615`.)" msgstr "" #: ../../whatsnew/3.5.rst:1723 @@ -2705,10 +2712,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:1728 msgid "" "A new :meth:`socket.sendfile() <socket.socket.sendfile>` method allows " -"sending a file over a socket by using the high-performance :func:`os." -"sendfile` function on UNIX, resulting in uploads being from 2 to 3 times " -"faster than when using plain :meth:`socket.send() <socket.socket.send>`. " -"(Contributed by Giampaolo Rodola' in :issue:`17552`.)" +"sending a file over a socket by using the high-" +"performance :func:`os.sendfile` function on UNIX, resulting in uploads being " +"from 2 to 3 times faster than when using plain :meth:`socket.send() " +"<socket.socket.send>`. (Contributed by Giampaolo Rodola' in :issue:`17552`.)" msgstr "" #: ../../whatsnew/3.5.rst:1734 @@ -2722,9 +2729,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:1739 msgid "" "The *backlog* argument of the :meth:`socket.listen() <socket.socket.listen>` " -"method is now optional. By default it is set to :data:`SOMAXCONN <socket." -"SOMAXCONN>` or to ``128``, whichever is less. (Contributed by Charles-" -"François Natali in :issue:`21455`.)" +"method is now optional. By default it is set to :data:`SOMAXCONN " +"<socket.SOMAXCONN>` or to ``128``, whichever is less. (Contributed by " +"Charles-François Natali in :issue:`21455`.)" msgstr "" #: ../../whatsnew/3.5.rst:1746 @@ -2742,11 +2749,12 @@ msgstr "(由 Geert Jansen 在 :issue:`21965` 中貢獻。)" #: ../../whatsnew/3.5.rst:1755 msgid "" "The new :class:`~ssl.SSLObject` class has been added to provide SSL protocol " -"support for cases when the network I/O capabilities of :class:`~ssl." -"SSLSocket` are not necessary or are suboptimal. ``SSLObject`` represents an " -"SSL protocol instance, but does not implement any network I/O methods, and " -"instead provides a memory buffer interface. The new :class:`~ssl.MemoryBIO` " -"class can be used to pass data between Python and an SSL protocol instance." +"support for cases when the network I/O capabilities " +"of :class:`~ssl.SSLSocket` are not necessary or are suboptimal. " +"``SSLObject`` represents an SSL protocol instance, but does not implement " +"any network I/O methods, and instead provides a memory buffer interface. " +"The new :class:`~ssl.MemoryBIO` class can be used to pass data between " +"Python and an SSL protocol instance." msgstr "" #: ../../whatsnew/3.5.rst:1762 @@ -2773,23 +2781,23 @@ msgstr "(由 Benjamin Peterson 在 :issue:`20188` 中貢獻。)" #: ../../whatsnew/3.5.rst:1775 msgid "" "Where OpenSSL support is present, the :mod:`ssl` module now implements the " -"*Application-Layer Protocol Negotiation* TLS extension as described in :rfc:" -"`7301`." +"*Application-Layer Protocol Negotiation* TLS extension as described " +"in :rfc:`7301`." msgstr "" #: ../../whatsnew/3.5.rst:1779 msgid "" -"The new :meth:`SSLContext.set_alpn_protocols() <ssl.SSLContext." -"set_alpn_protocols>` can be used to specify which protocols a socket should " -"advertise during the TLS handshake." +"The new :meth:`SSLContext.set_alpn_protocols() " +"<ssl.SSLContext.set_alpn_protocols>` can be used to specify which protocols " +"a socket should advertise during the TLS handshake." msgstr "" #: ../../whatsnew/3.5.rst:1783 msgid "" -"The new :meth:`SSLSocket.selected_alpn_protocol() <ssl.SSLSocket." -"selected_alpn_protocol>` returns the protocol that was selected during the " -"TLS handshake. The :const:`~ssl.HAS_ALPN` flag indicates whether ALPN " -"support is present." +"The new :meth:`SSLSocket.selected_alpn_protocol() " +"<ssl.SSLSocket.selected_alpn_protocol>` returns the protocol that was " +"selected during the TLS handshake. The :const:`~ssl.HAS_ALPN` flag indicates " +"whether ALPN support is present." msgstr "" #: ../../whatsnew/3.5.rst:1790 @@ -2799,15 +2807,15 @@ msgstr "" #: ../../whatsnew/3.5.rst:1792 msgid "" "There is a new :meth:`SSLSocket.version() <ssl.SSLSocket.version>` method to " -"query the actual protocol version in use. (Contributed by Antoine Pitrou in :" -"issue:`20421`.)" +"query the actual protocol version in use. (Contributed by Antoine Pitrou " +"in :issue:`20421`.)" msgstr "" #: ../../whatsnew/3.5.rst:1796 msgid "" -"The :class:`~ssl.SSLSocket` class now implements a :meth:`SSLSocket." -"sendfile() <ssl.SSLSocket.sendfile>` method. (Contributed by Giampaolo " -"Rodola' in :issue:`17552`.)" +"The :class:`~ssl.SSLSocket` class now implements " +"a :meth:`SSLSocket.sendfile() <ssl.SSLSocket.sendfile>` method. (Contributed " +"by Giampaolo Rodola' in :issue:`17552`.)" msgstr "" #: ../../whatsnew/3.5.rst:1800 @@ -2827,21 +2835,22 @@ msgstr "" #: ../../whatsnew/3.5.rst:1809 msgid "" -"New :meth:`SSLObject.shared_ciphers() <ssl.SSLObject.shared_ciphers>` and :" -"meth:`SSLSocket.shared_ciphers() <ssl.SSLSocket.shared_ciphers>` methods " -"return the list of ciphers sent by the client during the handshake. " +"New :meth:`SSLObject.shared_ciphers() <ssl.SSLObject.shared_ciphers>` " +"and :meth:`SSLSocket.shared_ciphers() <ssl.SSLSocket.shared_ciphers>` " +"methods return the list of ciphers sent by the client during the handshake. " "(Contributed by Benjamin Peterson in :issue:`23186`.)" msgstr "" #: ../../whatsnew/3.5.rst:1814 msgid "" -"The :meth:`SSLSocket.do_handshake() <ssl.SSLSocket.do_handshake>`, :meth:" -"`SSLSocket.read() <ssl.SSLSocket.read>`, :meth:`SSLSocket.shutdown() <ssl." -"SSLSocket.shutdown>`, and :meth:`SSLSocket.write() <ssl.SSLSocket.write>` " -"methods of the :class:`~ssl.SSLSocket` class no longer reset the socket " -"timeout every time bytes are received or sent. The socket timeout is now the " -"maximum total duration of the method. (Contributed by Victor Stinner in :" -"issue:`23853`.)" +"The :meth:`SSLSocket.do_handshake() " +"<ssl.SSLSocket.do_handshake>`, :meth:`SSLSocket.read() " +"<ssl.SSLSocket.read>`, :meth:`SSLSocket.shutdown() " +"<ssl.SSLSocket.shutdown>`, and :meth:`SSLSocket.write() " +"<ssl.SSLSocket.write>` methods of the :class:`~ssl.SSLSocket` class no " +"longer reset the socket timeout every time bytes are received or sent. The " +"socket timeout is now the maximum total duration of the method. (Contributed " +"by Victor Stinner in :issue:`23853`.)" msgstr "" #: ../../whatsnew/3.5.rst:1822 @@ -2912,10 +2921,11 @@ msgstr "sys" msgid "" "A new :func:`~sys.set_coroutine_wrapper` function allows setting a global " "hook that will be called whenever a :term:`coroutine object <coroutine>` is " -"created by an :keyword:`async def` function. A corresponding :func:`~sys." -"get_coroutine_wrapper` can be used to obtain a currently set wrapper. Both " -"functions are :term:`provisional <provisional API>`, and are intended for " -"debugging purposes only. (Contributed by Yury Selivanov in :issue:`24017`.)" +"created by an :keyword:`async def` function. A " +"corresponding :func:`~sys.get_coroutine_wrapper` can be used to obtain a " +"currently set wrapper. Both functions are :term:`provisional <provisional " +"API>`, and are intended for debugging purposes only. (Contributed by Yury " +"Selivanov in :issue:`24017`.)" msgstr "" #: ../../whatsnew/3.5.rst:1874 @@ -2932,8 +2942,8 @@ msgstr "sysconfig" #: ../../whatsnew/3.5.rst:1882 msgid "" "The name of the user scripts directory on Windows now includes the first two " -"components of the Python version. (Contributed by Paul Moore in :issue:" -"`23437`.)" +"components of the Python version. (Contributed by Paul Moore " +"in :issue:`23437`.)" msgstr "" #: ../../whatsnew/3.5.rst:1888 @@ -2943,16 +2953,16 @@ msgstr "tarfile" #: ../../whatsnew/3.5.rst:1890 msgid "" "The *mode* argument of the :func:`~tarfile.open` function now accepts " -"``\"x\"`` to request exclusive creation. (Contributed by Berker Peksag in :" -"issue:`21717`.)" +"``\"x\"`` to request exclusive creation. (Contributed by Berker Peksag " +"in :issue:`21717`.)" msgstr "" #: ../../whatsnew/3.5.rst:1893 msgid "" -"The :meth:`TarFile.extractall() <tarfile.TarFile.extractall>` and :meth:" -"`TarFile.extract() <tarfile.TarFile.extract>` methods now take a keyword " -"argument *numeric_owner*. If set to ``True``, the extracted files and " -"directories will be owned by the numeric ``uid`` and ``gid`` from the " +"The :meth:`TarFile.extractall() <tarfile.TarFile.extractall>` " +"and :meth:`TarFile.extract() <tarfile.TarFile.extract>` methods now take a " +"keyword argument *numeric_owner*. If set to ``True``, the extracted files " +"and directories will be owned by the numeric ``uid`` and ``gid`` from the " "tarfile. If set to ``False`` (the default, and the behavior in versions " "prior to 3.5), they will be owned by the named user and group in the " "tarfile. (Contributed by Michael Vogt and Eric Smith in :issue:`23193`.)" @@ -2972,9 +2982,10 @@ msgstr "threading" #: ../../whatsnew/3.5.rst:1910 msgid "" -"Both the :meth:`Lock.acquire() <threading.Lock.acquire>` and :meth:`RLock." -"acquire() <threading.RLock.acquire>` methods now use a monotonic clock for " -"timeout management. (Contributed by Victor Stinner in :issue:`22043`.)" +"Both the :meth:`Lock.acquire() <threading.Lock.acquire>` " +"and :meth:`RLock.acquire() <threading.RLock.acquire>` methods now use a " +"monotonic clock for timeout management. (Contributed by Victor Stinner " +"in :issue:`22043`.)" msgstr "" #: ../../whatsnew/3.5.rst:1917 @@ -3030,9 +3041,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:1954 msgid "" -"New lightweight classes: :class:`~traceback.TracebackException`, :class:" -"`~traceback.StackSummary`, and :class:`~traceback.FrameSummary`. " -"(Contributed by Robert Collins in :issue:`17911`.)" +"New lightweight " +"classes: :class:`~traceback.TracebackException`, :class:`~traceback.StackSummary`, " +"and :class:`~traceback.FrameSummary`. (Contributed by Robert Collins " +"in :issue:`17911`.)" msgstr "" #: ../../whatsnew/3.5.rst:1958 @@ -3049,16 +3061,16 @@ msgstr "types" #: ../../whatsnew/3.5.rst:1966 msgid "" "A new :func:`~types.coroutine` function to transform :term:`generator " -"<generator iterator>` and :class:`generator-like <collections.abc." -"Generator>` objects into :term:`awaitables <awaitable>`. (Contributed by " -"Yury Selivanov in :issue:`24017`.)" +"<generator iterator>` and :class:`generator-like " +"<collections.abc.Generator>` objects into :term:`awaitables <awaitable>`. " +"(Contributed by Yury Selivanov in :issue:`24017`.)" msgstr "" #: ../../whatsnew/3.5.rst:1972 msgid "" -"A new type called :class:`~types.CoroutineType`, which is used for :term:" -"`coroutine` objects created by :keyword:`async def` functions. (Contributed " -"by Yury Selivanov in :issue:`24400`.)" +"A new type called :class:`~types.CoroutineType`, which is used " +"for :term:`coroutine` objects created by :keyword:`async def` functions. " +"(Contributed by Yury Selivanov in :issue:`24400`.)" msgstr "" #: ../../whatsnew/3.5.rst:1978 @@ -3077,13 +3089,13 @@ msgstr "unittest" #: ../../whatsnew/3.5.rst:1987 msgid "" -"The :meth:`TestLoader.loadTestsFromModule() <unittest.TestLoader." -"loadTestsFromModule>` method now accepts a keyword-only argument *pattern* " -"which is passed to ``load_tests`` as the third argument. Found packages are " -"now checked for ``load_tests`` regardless of whether their path matches " -"*pattern*, because it is impossible for a package name to match the default " -"pattern. (Contributed by Robert Collins and Barry A. Warsaw in :issue:" -"`16662`.)" +"The :meth:`TestLoader.loadTestsFromModule() " +"<unittest.TestLoader.loadTestsFromModule>` method now accepts a keyword-only " +"argument *pattern* which is passed to ``load_tests`` as the third argument. " +"Found packages are now checked for ``load_tests`` regardless of whether " +"their path matches *pattern*, because it is impossible for a package name to " +"match the default pattern. (Contributed by Robert Collins and Barry A. " +"Warsaw in :issue:`16662`.)" msgstr "" #: ../../whatsnew/3.5.rst:1994 @@ -3116,24 +3128,24 @@ msgstr "" #: ../../whatsnew/3.5.rst:2013 msgid "" -"A new :meth:`Mock.assert_not_called() <unittest.mock.Mock." -"assert_not_called>` method to check if the mock object was called. " -"(Contributed by Kushal Das in :issue:`21262`.)" +"A new :meth:`Mock.assert_not_called() " +"<unittest.mock.Mock.assert_not_called>` method to check if the mock object " +"was called. (Contributed by Kushal Das in :issue:`21262`.)" msgstr "" #: ../../whatsnew/3.5.rst:2017 msgid "" -"The :class:`~unittest.mock.MagicMock` class now supports :meth:" -"`__truediv__`, :meth:`__divmod__` and :meth:`__matmul__` operators. " -"(Contributed by Johannes Baiter in :issue:`20968`, and Håkan Lövdahl in :" -"issue:`23581` and :issue:`23568`.)" +"The :class:`~unittest.mock.MagicMock` class now " +"supports :meth:`__truediv__`, :meth:`__divmod__` and :meth:`__matmul__` " +"operators. (Contributed by Johannes Baiter in :issue:`20968`, and Håkan " +"Lövdahl in :issue:`23581` and :issue:`23568`.)" msgstr "" #: ../../whatsnew/3.5.rst:2022 msgid "" -"It is no longer necessary to explicitly pass ``create=True`` to the :func:" -"`~unittest.mock.patch` function when patching builtin names. (Contributed by " -"Kushal Das in :issue:`17660`.)" +"It is no longer necessary to explicitly pass ``create=True`` to " +"the :func:`~unittest.mock.patch` function when patching builtin names. " +"(Contributed by Kushal Das in :issue:`17660`.)" msgstr "" #: ../../whatsnew/3.5.rst:2028 @@ -3142,35 +3154,38 @@ msgstr "urllib" #: ../../whatsnew/3.5.rst:2030 msgid "" -"A new :class:`request.HTTPPasswordMgrWithPriorAuth <urllib.request." -"HTTPPasswordMgrWithPriorAuth>` class allows HTTP Basic Authentication " -"credentials to be managed so as to eliminate unnecessary ``401`` response " -"handling, or to unconditionally send credentials on the first request in " -"order to communicate with servers that return a ``404`` response instead of " -"a ``401`` if the ``Authorization`` header is not sent. (Contributed by Matej " -"Cepl in :issue:`19494` and Akshit Khurana in :issue:`7159`.)" +"A new :class:`request.HTTPPasswordMgrWithPriorAuth " +"<urllib.request.HTTPPasswordMgrWithPriorAuth>` class allows HTTP Basic " +"Authentication credentials to be managed so as to eliminate unnecessary " +"``401`` response handling, or to unconditionally send credentials on the " +"first request in order to communicate with servers that return a ``404`` " +"response instead of a ``401`` if the ``Authorization`` header is not sent. " +"(Contributed by Matej Cepl in :issue:`19494` and Akshit Khurana " +"in :issue:`7159`.)" msgstr "" #: ../../whatsnew/3.5.rst:2039 msgid "" -"A new *quote_via* argument for the :func:`parse.urlencode() <urllib.parse." -"urlencode>` function provides a way to control the encoding of query parts " -"if needed. (Contributed by Samwyse and Arnon Yaari in :issue:`13866`.)" +"A new *quote_via* argument for the :func:`parse.urlencode() " +"<urllib.parse.urlencode>` function provides a way to control the encoding of " +"query parts if needed. (Contributed by Samwyse and Arnon Yaari " +"in :issue:`13866`.)" msgstr "" #: ../../whatsnew/3.5.rst:2044 msgid "" -"The :func:`request.urlopen() <urllib.request.urlopen>` function accepts an :" -"class:`ssl.SSLContext` object as a *context* argument, which will be used " -"for the HTTPS connection. (Contributed by Alex Gaynor in :issue:`22366`.)" +"The :func:`request.urlopen() <urllib.request.urlopen>` function accepts " +"an :class:`ssl.SSLContext` object as a *context* argument, which will be " +"used for the HTTPS connection. (Contributed by Alex Gaynor " +"in :issue:`22366`.)" msgstr "" #: ../../whatsnew/3.5.rst:2048 msgid "" -"The :func:`parse.urljoin() <urllib.parse.urljoin>` was updated to use the :" -"rfc:`3986` semantics for the resolution of relative URLs, rather than :rfc:" -"`1808` and :rfc:`2396`. (Contributed by Demian Brecht and Senthil Kumaran " -"in :issue:`22118`.)" +"The :func:`parse.urljoin() <urllib.parse.urljoin>` was updated to use " +"the :rfc:`3986` semantics for the resolution of relative URLs, rather " +"than :rfc:`1808` and :rfc:`2396`. (Contributed by Demian Brecht and Senthil " +"Kumaran in :issue:`22118`.)" msgstr "" #: ../../whatsnew/3.5.rst:2055 @@ -3179,9 +3194,9 @@ msgstr "wsgiref" #: ../../whatsnew/3.5.rst:2057 msgid "" -"The *headers* argument of the :class:`headers.Headers <wsgiref.headers." -"Headers>` class constructor is now optional. (Contributed by Pablo Torres " -"Navarrete and SilentGhost in :issue:`5800`.)" +"The *headers* argument of the :class:`headers.Headers " +"<wsgiref.headers.Headers>` class constructor is now optional. (Contributed " +"by Pablo Torres Navarrete and SilentGhost in :issue:`5800`.)" msgstr "" #: ../../whatsnew/3.5.rst:2063 @@ -3208,9 +3223,9 @@ msgstr "xml.sax" #: ../../whatsnew/3.5.rst:2077 msgid "" -"SAX parsers now support a character stream of the :class:`xmlreader." -"InputSource <xml.sax.xmlreader.InputSource>` object. (Contributed by Serhiy " -"Storchaka in :issue:`2175`.)" +"SAX parsers now support a character stream of " +"the :class:`xmlreader.InputSource <xml.sax.xmlreader.InputSource>` object. " +"(Contributed by Serhiy Storchaka in :issue:`2175`.)" msgstr "" #: ../../whatsnew/3.5.rst:2081 @@ -3242,10 +3257,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:2099 msgid "" -"Many functions in the :mod:`mmap`, :mod:`!ossaudiodev`, :mod:`socket`, :mod:" -"`ssl`, and :mod:`codecs` modules now accept writable :term:`bytes-like " -"objects <bytes-like object>`. (Contributed by Serhiy Storchaka in :issue:" -"`23001`.)" +"Many functions in the :mod:`mmap`, :mod:`!" +"ossaudiodev`, :mod:`socket`, :mod:`ssl`, and :mod:`codecs` modules now " +"accept writable :term:`bytes-like objects <bytes-like object>`. (Contributed " +"by Serhiy Storchaka in :issue:`23001`.)" msgstr "" #: ../../whatsnew/3.5.rst:2106 @@ -3255,9 +3270,9 @@ msgstr "最佳化" #: ../../whatsnew/3.5.rst:2108 msgid "" "The :func:`os.walk` function has been sped up by 3 to 5 times on POSIX " -"systems, and by 7 to 20 times on Windows. This was done using the new :func:" -"`os.scandir` function, which exposes file information from the underlying " -"``readdir`` or ``FindFirstFile``/``FindNextFile`` system calls. " +"systems, and by 7 to 20 times on Windows. This was done using the " +"new :func:`os.scandir` function, which exposes file information from the " +"underlying ``readdir`` or ``FindFirstFile``/``FindNextFile`` system calls. " "(Contributed by Ben Hoyt with help from Victor Stinner in :issue:`23605`.)" msgstr "" @@ -3265,19 +3280,18 @@ msgstr "" msgid "" "Construction of ``bytes(int)`` (filled by zero bytes) is faster and uses " "less memory for large objects. ``calloc()`` is used instead of ``malloc()`` " -"to allocate memory for these objects. (Contributed by Victor Stinner in :" -"issue:`21233`.)" +"to allocate memory for these objects. (Contributed by Victor Stinner " +"in :issue:`21233`.)" msgstr "" #: ../../whatsnew/3.5.rst:2119 msgid "" -"Some operations on :mod:`ipaddress` :class:`~ipaddress.IPv4Network` and :" -"class:`~ipaddress.IPv6Network` have been massively sped up, such as :meth:" -"`~ipaddress.IPv4Network.subnets`, :meth:`~ipaddress.IPv4Network.supernet`, :" -"func:`~ipaddress.summarize_address_range`, :func:`~ipaddress." -"collapse_addresses`. The speed up can range from 3 to 15 times. (Contributed " -"by Antoine Pitrou, Michel Albert, and Markus in :issue:`21486`, :issue:" -"`21487`, :issue:`20826`, :issue:`23266`.)" +"Some operations on :mod:`ipaddress` :class:`~ipaddress.IPv4Network` " +"and :class:`~ipaddress.IPv6Network` have been massively sped up, such " +"as :meth:`~ipaddress.IPv4Network.subnets`, :meth:`~ipaddress.IPv4Network.supernet`, :func:`~ipaddress.summarize_address_range`, :func:`~ipaddress.collapse_addresses`. " +"The speed up can range from 3 to 15 times. (Contributed by Antoine Pitrou, " +"Michel Albert, and Markus " +"in :issue:`21486`, :issue:`21487`, :issue:`20826`, :issue:`23266`.)" msgstr "" #: ../../whatsnew/3.5.rst:2127 @@ -3289,16 +3303,16 @@ msgstr "" #: ../../whatsnew/3.5.rst:2130 msgid "" "Many operations on :class:`io.BytesIO` are now 50% to 100% faster. " -"(Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson in :" -"issue:`22003`.)" +"(Contributed by Serhiy Storchaka in :issue:`15381` and David Wilson " +"in :issue:`22003`.)" msgstr "" #: ../../whatsnew/3.5.rst:2134 msgid "" "The :func:`marshal.dumps` function is now faster: 65--85% with versions 3 " "and 4, 20--25% with versions 0 to 2 on typical data, and up to 5 times in " -"best cases. (Contributed by Serhiy Storchaka in :issue:`20416` and :issue:" -"`23344`.)" +"best cases. (Contributed by Serhiy Storchaka in :issue:`20416` " +"and :issue:`23344`.)" msgstr "" #: ../../whatsnew/3.5.rst:2139 @@ -3323,16 +3337,16 @@ msgstr "" #: ../../whatsnew/3.5.rst:2149 msgid "" "The :c:func:`PyObject_IsInstance` and :c:func:`PyObject_IsSubclass` " -"functions have been sped up in the common case that the second argument has :" -"class:`type` as its metaclass. (Contributed Georg Brandl by in :issue:" -"`22540`.)" +"functions have been sped up in the common case that the second argument " +"has :class:`type` as its metaclass. (Contributed Georg Brandl by " +"in :issue:`22540`.)" msgstr "" #: ../../whatsnew/3.5.rst:2154 msgid "" "Method caching was slightly improved, yielding up to 5% performance " -"improvement in some benchmarks. (Contributed by Antoine Pitrou in :issue:" -"`22847`.)" +"improvement in some benchmarks. (Contributed by Antoine Pitrou " +"in :issue:`22847`.)" msgstr "" #: ../../whatsnew/3.5.rst:2158 @@ -3355,15 +3369,16 @@ msgstr "" #: ../../whatsnew/3.5.rst:2167 msgid "" -"String methods :meth:`~str.find`, :meth:`~str.rfind`, :meth:`~str.split`, :" -"meth:`~str.partition` and the :keyword:`in` string operator are now " -"significantly faster for searching 1-character substrings. (Contributed by " -"Serhiy Storchaka in :issue:`23573`.)" +"String " +"methods :meth:`~str.find`, :meth:`~str.rfind`, :meth:`~str.split`, :meth:`~str.partition` " +"and the :keyword:`in` string operator are now significantly faster for " +"searching 1-character substrings. (Contributed by Serhiy Storchaka " +"in :issue:`23573`.)" msgstr "" #: ../../whatsnew/3.5.rst:2174 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.5.rst:2176 msgid "New ``calloc`` functions were added:" @@ -3391,11 +3406,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:2186 msgid ":c:func:`Py_DecodeLocale` (replaced ``_Py_char2wchar()``)," -msgstr "" +msgstr ":c:func:`Py_DecodeLocale`\\ (取代 ``_Py_char2wchar()``)," #: ../../whatsnew/3.5.rst:2187 msgid ":c:func:`Py_EncodeLocale` (replaced ``_Py_wchar2char()``)." -msgstr "" +msgstr ":c:func:`Py_EncodeLocale`\\ (取代 ``_Py_wchar2char()``)。" #: ../../whatsnew/3.5.rst:2189 msgid "(Contributed by Victor Stinner in :issue:`18395`.)" @@ -3404,15 +3419,15 @@ msgstr "(由 Victor Stinner 在 :issue:`18395` 中貢獻。)" #: ../../whatsnew/3.5.rst:2191 msgid "" "A new :c:func:`PyCodec_NameReplaceErrors` function to replace the unicode " -"encode error with ``\\N{...}`` escapes. (Contributed by Serhiy Storchaka in :" -"issue:`19676`.)" +"encode error with ``\\N{...}`` escapes. (Contributed by Serhiy Storchaka " +"in :issue:`19676`.)" msgstr "" #: ../../whatsnew/3.5.rst:2195 msgid "" "A new :c:func:`PyErr_FormatV` function similar to :c:func:`PyErr_Format`, " -"but accepts a :c:type:`va_list` argument. (Contributed by Antoine Pitrou in :" -"issue:`18711`.)" +"but accepts a :c:type:`va_list` argument. (Contributed by Antoine Pitrou " +"in :issue:`18711`.)" msgstr "" #: ../../whatsnew/3.5.rst:2199 @@ -3425,16 +3440,16 @@ msgstr "" msgid "" "New :c:func:`PyModule_FromDefAndSpec`, :c:func:`PyModule_FromDefAndSpec2`, " "and :c:func:`PyModule_ExecDef` functions introduced by :pep:`489` -- multi-" -"phase extension module initialization. (Contributed by Petr Viktorin in :" -"issue:`24268`.)" +"phase extension module initialization. (Contributed by Petr Viktorin " +"in :issue:`24268`.)" msgstr "" #: ../../whatsnew/3.5.rst:2207 msgid "" -"New :c:func:`PyNumber_MatrixMultiply` and :c:func:" -"`PyNumber_InPlaceMatrixMultiply` functions to perform matrix multiplication. " -"(Contributed by Benjamin Peterson in :issue:`21176`. See also :pep:`465` " -"for details.)" +"New :c:func:`PyNumber_MatrixMultiply` " +"and :c:func:`PyNumber_InPlaceMatrixMultiply` functions to perform matrix " +"multiplication. (Contributed by Benjamin Peterson in :issue:`21176`. See " +"also :pep:`465` for details.)" msgstr "" #: ../../whatsnew/3.5.rst:2213 @@ -3542,8 +3557,8 @@ msgstr "" msgid "" "Raising the :exc:`StopIteration` exception inside a generator will now " "generate a silent :exc:`PendingDeprecationWarning`, which will become a non-" -"silent deprecation warning in Python 3.6 and will trigger a :exc:" -"`RuntimeError` in Python 3.7. See :ref:`PEP 479: Change StopIteration " +"silent deprecation warning in Python 3.6 and will trigger " +"a :exc:`RuntimeError` in Python 3.7. See :ref:`PEP 479: Change StopIteration " "handling inside generators <whatsnew-pep-479>` for details." msgstr "" @@ -3569,8 +3584,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:2296 msgid "" -"The :func:`asyncio.async` function is deprecated in favor of :func:`~asyncio." -"ensure_future`." +"The :func:`asyncio.async` function is deprecated in favor " +"of :func:`~asyncio.ensure_future`." msgstr "" #: ../../whatsnew/3.5.rst:2299 @@ -3584,19 +3599,20 @@ msgstr "" #: ../../whatsnew/3.5.rst:2305 msgid "" -"Directly assigning values to the :attr:`~http.cookies.Morsel.key`, :attr:" -"`~http.cookies.Morsel.value` and :attr:`~http.cookies.Morsel.coded_value` " -"of :class:`http.cookies.Morsel` objects is deprecated. Use the :meth:`~http." -"cookies.Morsel.set` method instead. In addition, the undocumented " -"*LegalChars* parameter of :meth:`~http.cookies.Morsel.set` is deprecated, " -"and is now ignored." +"Directly assigning values to " +"the :attr:`~http.cookies.Morsel.key`, :attr:`~http.cookies.Morsel.value` " +"and :attr:`~http.cookies.Morsel.coded_value` of :class:`http.cookies.Morsel` " +"objects is deprecated. Use the :meth:`~http.cookies.Morsel.set` method " +"instead. In addition, the undocumented *LegalChars* parameter " +"of :meth:`~http.cookies.Morsel.set` is deprecated, and is now ignored." msgstr "" #: ../../whatsnew/3.5.rst:2312 msgid "" -"Passing a format string as keyword argument *format_string* to the :meth:" -"`~string.Formatter.format` method of the :class:`string.Formatter` class has " -"been deprecated. (Contributed by Serhiy Storchaka in :issue:`23671`.)" +"Passing a format string as keyword argument *format_string* to " +"the :meth:`~string.Formatter.format` method of the :class:`string.Formatter` " +"class has been deprecated. (Contributed by Serhiy Storchaka " +"in :issue:`23671`.)" msgstr "" #: ../../whatsnew/3.5.rst:2317 @@ -3610,9 +3626,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:2322 msgid "" "The previously undocumented ``from_function`` and ``from_builtin`` methods " -"of :class:`inspect.Signature` are deprecated. Use the new :meth:`Signature." -"from_callable() <inspect.Signature.from_callable>` method instead. " -"(Contributed by Yury Selivanov in :issue:`24248`.)" +"of :class:`inspect.Signature` are deprecated. Use the " +"new :meth:`Signature.from_callable() <inspect.Signature.from_callable>` " +"method instead. (Contributed by Yury Selivanov in :issue:`24248`.)" msgstr "" #: ../../whatsnew/3.5.rst:2327 @@ -3623,9 +3639,9 @@ msgstr "" #: ../../whatsnew/3.5.rst:2330 msgid "" -"The :mod:`inspect` :func:`~inspect.getfullargspec`, :func:`~inspect." -"getcallargs`, and :func:`~inspect.formatargspec` functions are deprecated in " -"favor of the :func:`inspect.signature` API. (Contributed by Yury Selivanov " +"The :mod:`inspect` :func:`~inspect.getfullargspec`, :func:`~inspect.getcallargs`, " +"and :func:`~inspect.formatargspec` functions are deprecated in favor of " +"the :func:`inspect.signature` API. (Contributed by Yury Selivanov " "in :issue:`20438`.)" msgstr "" @@ -3651,10 +3667,10 @@ msgstr "" #: ../../whatsnew/3.5.rst:2346 msgid "" -"The undocumented and unofficial *use_load_tests* default argument of the :" -"meth:`unittest.TestLoader.loadTestsFromModule` method now is deprecated and " -"ignored. (Contributed by Robert Collins and Barry A. Warsaw in :issue:" -"`16662`.)" +"The undocumented and unofficial *use_load_tests* default argument of " +"the :meth:`unittest.TestLoader.loadTestsFromModule` method now is deprecated " +"and ignored. (Contributed by Robert Collins and Barry A. Warsaw " +"in :issue:`16662`.)" msgstr "" #: ../../whatsnew/3.5.rst:2353 @@ -3663,7 +3679,7 @@ msgstr "已移除" #: ../../whatsnew/3.5.rst:2356 msgid "API and Feature Removals" -msgstr "" +msgstr "API 與功能的移除" #: ../../whatsnew/3.5.rst:2358 msgid "" @@ -3707,7 +3723,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:2384 msgid "Changes in Python behavior" -msgstr "" +msgstr "Python 行為的改變" #: ../../whatsnew/3.5.rst:2386 msgid "" @@ -3731,7 +3747,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:2397 msgid "Changes in the Python API" -msgstr "" +msgstr "Python API 的變更" #: ../../whatsnew/3.5.rst:2399 msgid "" @@ -3744,16 +3760,16 @@ msgstr "" msgid "" "Before Python 3.5, a :class:`datetime.time` object was considered to be " "false if it represented midnight in UTC. This behavior was considered " -"obscure and error-prone and has been removed in Python 3.5. See :issue:" -"`13936` for full details." +"obscure and error-prone and has been removed in Python 3.5. " +"See :issue:`13936` for full details." msgstr "" #: ../../whatsnew/3.5.rst:2408 msgid "" -"The :meth:`ssl.SSLSocket.send` method now raises either :exc:`ssl." -"SSLWantReadError` or :exc:`ssl.SSLWantWriteError` on a non-blocking socket " -"if the operation would block. Previously, it would return ``0``. " -"(Contributed by Nikolaus Rath in :issue:`20951`.)" +"The :meth:`ssl.SSLSocket.send` method now raises " +"either :exc:`ssl.SSLWantReadError` or :exc:`ssl.SSLWantWriteError` on a non-" +"blocking socket if the operation would block. Previously, it would return " +"``0``. (Contributed by Nikolaus Rath in :issue:`20951`.)" msgstr "" #: ../../whatsnew/3.5.rst:2413 @@ -3767,12 +3783,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:2420 msgid "" -"The deprecated \"strict\" mode and argument of :class:`~html.parser." -"HTMLParser`, :meth:`!HTMLParser.error`, and the :exc:`!HTMLParserError` " -"exception have been removed. (Contributed by Ezio Melotti in :issue:" -"`15114`.) The *convert_charrefs* argument of :class:`~html.parser." -"HTMLParser` is now ``True`` by default. (Contributed by Berker Peksag in :" -"issue:`21047`.)" +"The deprecated \"strict\" mode and argument " +"of :class:`~html.parser.HTMLParser`, :meth:`!HTMLParser.error`, and " +"the :exc:`!HTMLParserError` exception have been removed. (Contributed by " +"Ezio Melotti in :issue:`15114`.) The *convert_charrefs* argument " +"of :class:`~html.parser.HTMLParser` is now ``True`` by default. " +"(Contributed by Berker Peksag in :issue:`21047`.)" msgstr "" #: ../../whatsnew/3.5.rst:2426 @@ -3786,11 +3802,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:2432 msgid "" -"If the current directory is set to a directory that no longer exists then :" -"exc:`FileNotFoundError` will no longer be raised and instead :meth:" -"`~importlib.machinery.FileFinder.find_spec` will return ``None`` **without** " -"caching ``None`` in :data:`sys.path_importer_cache`, which is different than " -"the typical case (:issue:`22834`)." +"If the current directory is set to a directory that no longer exists " +"then :exc:`FileNotFoundError` will no longer be raised and " +"instead :meth:`~importlib.machinery.FileFinder.find_spec` will return " +"``None`` **without** caching ``None`` in :data:`sys.path_importer_cache`, " +"which is different than the typical case (:issue:`22834`)." msgstr "" #: ../../whatsnew/3.5.rst:2438 @@ -3804,12 +3820,12 @@ msgstr "" #: ../../whatsnew/3.5.rst:2443 msgid "" "When an import loader defines :meth:`importlib.machinery.Loader.exec_module` " -"it is now expected to also define :meth:`~importlib.machinery.Loader." -"create_module` (raises a :exc:`DeprecationWarning` now, will be an error in " -"Python 3.6). If the loader inherits from :class:`importlib.abc.Loader` then " -"there is nothing to do, else simply define :meth:`~importlib.machinery." -"Loader.create_module` to return ``None``. (Contributed by Brett Cannon in :" -"issue:`23014`.)" +"it is now expected to also " +"define :meth:`~importlib.machinery.Loader.create_module` (raises " +"a :exc:`DeprecationWarning` now, will be an error in Python 3.6). If the " +"loader inherits from :class:`importlib.abc.Loader` then there is nothing to " +"do, else simply define :meth:`~importlib.machinery.Loader.create_module` to " +"return ``None``. (Contributed by Brett Cannon in :issue:`23014`.)" msgstr "" #: ../../whatsnew/3.5.rst:2451 @@ -3826,28 +3842,29 @@ msgstr "" #: ../../whatsnew/3.5.rst:2459 msgid "" "The :class:`http.cookies.Morsel` dict-like interface has been made self " -"consistent: morsel comparison now takes the :attr:`~http.cookies.Morsel." -"key` and :attr:`~http.cookies.Morsel.value` into account, :meth:`~http." -"cookies.Morsel.copy` now results in a :class:`~http.cookies.Morsel` instance " -"rather than a :class:`dict`, and :meth:`~http.cookies.Morsel.update` will " -"now raise an exception if any of the keys in the update dictionary are " -"invalid. In addition, the undocumented *LegalChars* parameter of :func:" -"`~http.cookies.Morsel.set` is deprecated and is now ignored. (Contributed " -"by Demian Brecht in :issue:`2211`.)" +"consistent: morsel comparison now takes " +"the :attr:`~http.cookies.Morsel.key` and :attr:`~http.cookies.Morsel.value` " +"into account, :meth:`~http.cookies.Morsel.copy` now results in " +"a :class:`~http.cookies.Morsel` instance rather than a :class:`dict`, " +"and :meth:`~http.cookies.Morsel.update` will now raise an exception if any " +"of the keys in the update dictionary are invalid. In addition, the " +"undocumented *LegalChars* parameter of :func:`~http.cookies.Morsel.set` is " +"deprecated and is now ignored. (Contributed by Demian Brecht " +"in :issue:`2211`.)" msgstr "" #: ../../whatsnew/3.5.rst:2469 msgid "" ":pep:`488` has removed ``.pyo`` files from Python and introduced the " -"optional ``opt-`` tag in ``.pyc`` file names. The :func:`importlib.util." -"cache_from_source` has gained an *optimization* parameter to help control " -"the ``opt-`` tag. Because of this, the *debug_override* parameter of the " -"function is now deprecated. ``.pyo`` files are also no longer supported as a " -"file argument to the Python interpreter and thus serve no purpose when " -"distributed on their own (i.e. sourceless code distribution). Due to the " -"fact that the magic number for bytecode has changed in Python 3.5, all old " -"``.pyo`` files from previous versions of Python are invalid regardless of " -"this PEP." +"optional ``opt-`` tag in ``.pyc`` file names. " +"The :func:`importlib.util.cache_from_source` has gained an *optimization* " +"parameter to help control the ``opt-`` tag. Because of this, the " +"*debug_override* parameter of the function is now deprecated. ``.pyo`` files " +"are also no longer supported as a file argument to the Python interpreter " +"and thus serve no purpose when distributed on their own (i.e. sourceless " +"code distribution). Due to the fact that the magic number for bytecode has " +"changed in Python 3.5, all old ``.pyo`` files from previous versions of " +"Python are invalid regardless of this PEP." msgstr "" #: ../../whatsnew/3.5.rst:2480 @@ -3891,16 +3908,17 @@ msgid "" "duplicated if the inherited documentation is appropriate. To suppress an " "inherited string, an empty string must be specified (or the documentation " "may be filled in). This change affects the output of the :mod:`pydoc` " -"module and the :func:`help` function. (Contributed by Serhiy Storchaka in :" -"issue:`15582`.)" +"module and the :func:`help` function. (Contributed by Serhiy Storchaka " +"in :issue:`15582`.)" msgstr "" #: ../../whatsnew/3.5.rst:2507 msgid "" "Nested :func:`functools.partial` calls are now flattened. If you were " -"relying on the previous behavior, you can now either add an attribute to a :" -"func:`functools.partial` object or you can create a subclass of :func:" -"`functools.partial`. (Contributed by Alexander Belopolsky in :issue:`7830`.)" +"relying on the previous behavior, you can now either add an attribute to " +"a :func:`functools.partial` object or you can create a subclass " +"of :func:`functools.partial`. (Contributed by Alexander Belopolsky " +"in :issue:`7830`.)" msgstr "" #: ../../whatsnew/3.5.rst:2514 @@ -3909,15 +3927,16 @@ msgstr "C API 中的改動" #: ../../whatsnew/3.5.rst:2516 msgid "" -"The undocumented :c:member:`!format` member of the (non-public) :c:type:" -"`PyMemoryViewObject` structure has been removed. All extensions relying on " -"the relevant parts in ``memoryobject.h`` must be rebuilt." +"The undocumented :c:member:`!format` member of the (non-" +"public) :c:type:`PyMemoryViewObject` structure has been removed. All " +"extensions relying on the relevant parts in ``memoryobject.h`` must be " +"rebuilt." msgstr "" #: ../../whatsnew/3.5.rst:2521 msgid "" -"The :c:type:`PyMemAllocator` structure was renamed to :c:type:" -"`PyMemAllocatorEx` and a new ``calloc`` field was added." +"The :c:type:`PyMemAllocator` structure was renamed " +"to :c:type:`PyMemAllocatorEx` and a new ``calloc`` field was added." msgstr "" #: ../../whatsnew/3.5.rst:2524 @@ -3932,17 +3951,17 @@ msgstr "" msgid "" "Because the lack of the :attr:`~type.__module__` attribute breaks pickling " "and introspection, a deprecation warning is now raised for builtin types " -"without the :attr:`~type.__module__` attribute. This will be an :exc:" -"`AttributeError` in the future. (Contributed by Serhiy Storchaka in :issue:" -"`20204`.)" +"without the :attr:`~type.__module__` attribute. This will be " +"an :exc:`AttributeError` in the future. (Contributed by Serhiy Storchaka " +"in :issue:`20204`.)" msgstr "" #: ../../whatsnew/3.5.rst:2535 msgid "" -"As part of the :pep:`492` implementation, the ``tp_reserved`` slot of :c:" -"type:`PyTypeObject` was replaced with a :c:member:`~PyTypeObject." -"tp_as_async` slot. Refer to :ref:`coro-objects` for new types, structures " -"and functions." +"As part of the :pep:`492` implementation, the ``tp_reserved`` slot " +"of :c:type:`PyTypeObject` was replaced with " +"a :c:member:`~PyTypeObject.tp_as_async` slot. Refer to :ref:`coro-objects` " +"for new types, structures and functions." msgstr "" #: ../../whatsnew/3.5.rst:2542 @@ -3970,8 +3989,8 @@ msgstr "" #: ../../whatsnew/3.5.rst:2556 msgid "" -"More selective regeneration targets are also defined - see :source:`Makefile." -"pre.in` for details." +"More selective regeneration targets are also defined - " +"see :source:`Makefile.pre.in` for details." msgstr "" #: ../../whatsnew/3.5.rst:2559 ../../whatsnew/3.5.rst:2572 diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index 2b7dfedd6b..1597fc5373 100644 --- a/whatsnew/3.6.po +++ b/whatsnew/3.6.po @@ -80,16 +80,16 @@ msgstr "" #: ../../whatsnew/3.6.rst:78 msgid "CPython implementation improvements:" -msgstr "" +msgstr "CPython 實作改進:" #: ../../whatsnew/3.6.rst:80 msgid "" -"The :ref:`dict <typesmapping>` type has been reimplemented to use a :ref:" -"`more compact representation <whatsnew36-compactdict>` based on `a proposal " -"by Raymond Hettinger <https://mail.python.org/pipermail/python-dev/2012-" -"December/123028.html>`_ and similar to the `PyPy dict implementation`_. " -"This resulted in dictionaries using 20% to 25% less memory when compared to " -"Python 3.5." +"The :ref:`dict <typesmapping>` type has been reimplemented to use " +"a :ref:`more compact representation <whatsnew36-compactdict>` based on `a " +"proposal by Raymond Hettinger <https://mail.python.org/pipermail/python-dev/" +"2012-December/123028.html>`_ and similar to the `PyPy dict " +"implementation`_. This resulted in dictionaries using 20% to 25% less " +"memory when compared to Python 3.5." msgstr "" #: ../../whatsnew/3.6.rst:87 @@ -217,8 +217,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:159 msgid "" "``python.exe`` and ``pythonw.exe`` have been marked as long-path aware, " -"which means that the 260 character path limit may no longer apply. See :ref:" -"`removing the MAX_PATH limitation <max-path>` for details." +"which means that the 260 character path limit may no longer apply. " +"See :ref:`removing the MAX_PATH limitation <max-path>` for details." msgstr "" #: ../../whatsnew/3.6.rst:163 @@ -230,9 +230,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:167 msgid "" -"A ``python36.zip`` file now works as a landmark to infer :envvar:" -"`PYTHONHOME`. See :ref:`the documentation <windows_finding_modules>` for " -"more information." +"A ``python36.zip`` file now works as a landmark to " +"infer :envvar:`PYTHONHOME`. See :ref:`the documentation " +"<windows_finding_modules>` for more information." msgstr "" #: ../../whatsnew/3.6.rst:176 @@ -245,8 +245,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:183 msgid "" -":pep:`498` introduces a new kind of string literals: *f-strings*, or :ref:" -"`formatted string literals <f-strings>`." +":pep:`498` introduces a new kind of string literals: *f-strings*, " +"or :ref:`formatted string literals <f-strings>`." msgstr "" #: ../../whatsnew/3.6.rst:186 @@ -494,9 +494,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:348 msgid "" -"In order to allow zero-argument :func:`super` calls to work correctly from :" -"meth:`~object.__init_subclass__` implementations, custom metaclasses must " -"ensure that the new ``__classcell__`` namespace entry is propagated to " +"In order to allow zero-argument :func:`super` calls to work correctly " +"from :meth:`~object.__init_subclass__` implementations, custom metaclasses " +"must ensure that the new ``__classcell__`` namespace entry is propagated to " "``type.__new__`` (as described in :ref:`class-object-creation`)." msgstr "" @@ -518,13 +518,13 @@ msgstr "" #: ../../whatsnew/3.6.rst:366 msgid "" -":pep:`487` extends the descriptor protocol to include the new optional :meth:" -"`~object.__set_name__` method. Whenever a new class is defined, the new " -"method will be called on all descriptors included in the definition, " -"providing them with a reference to the class being defined and the name " -"given to the descriptor within the class namespace. In other words, " -"instances of descriptors can now know the attribute name of the descriptor " -"in the owner class::" +":pep:`487` extends the descriptor protocol to include the new " +"optional :meth:`~object.__set_name__` method. Whenever a new class is " +"defined, the new method will be called on all descriptors included in the " +"definition, providing them with a reference to the class being defined and " +"the name given to the descriptor within the class namespace. In other " +"words, instances of descriptors can now know the attribute name of the " +"descriptor in the owner class::" msgstr "" #: ../../whatsnew/3.6.rst:374 @@ -556,13 +556,13 @@ msgstr "" #: ../../whatsnew/3.6.rst:404 msgid "" -"File system paths have historically been represented as :class:`str` or :" -"class:`bytes` objects. This has led to people who write code which operate " -"on file system paths to assume that such objects are only one of those two " -"types (an :class:`int` representing a file descriptor does not count as that " -"is not a file path). Unfortunately that assumption prevents alternative " -"object representations of file system paths like :mod:`pathlib` from working " -"with pre-existing code, including Python's standard library." +"File system paths have historically been represented as :class:`str` " +"or :class:`bytes` objects. This has led to people who write code which " +"operate on file system paths to assume that such objects are only one of " +"those two types (an :class:`int` representing a file descriptor does not " +"count as that is not a file path). Unfortunately that assumption prevents " +"alternative object representations of file system paths like :mod:`pathlib` " +"from working with pre-existing code, including Python's standard library." msgstr "" #: ../../whatsnew/3.6.rst:413 @@ -572,8 +572,8 @@ msgid "" "method, an object signals that it represents a path. An object can then " "provide a low-level representation of a file system path as a :class:`str` " "or :class:`bytes` object. This means an object is considered :term:`path-" -"like <path-like object>` if it implements :class:`os.PathLike` or is a :" -"class:`str` or :class:`bytes` object which represents a file system path. " +"like <path-like object>` if it implements :class:`os.PathLike` or is " +"a :class:`str` or :class:`bytes` object which represents a file system path. " "Code can use :func:`os.fspath`, :func:`os.fsdecode`, or :func:`os.fsencode` " "to explicitly get a :class:`str` and/or :class:`bytes` representation of a " "path-like object." @@ -581,26 +581,28 @@ msgstr "" #: ../../whatsnew/3.6.rst:426 msgid "" -"The built-in :func:`open` function has been updated to accept :class:`os." -"PathLike` objects, as have all relevant functions in the :mod:`os` and :mod:" -"`os.path` modules, and most other functions and classes in the standard " -"library. The :class:`os.DirEntry` class and relevant classes in :mod:" -"`pathlib` have also been updated to implement :class:`os.PathLike`." +"The built-in :func:`open` function has been updated to " +"accept :class:`os.PathLike` objects, as have all relevant functions in " +"the :mod:`os` and :mod:`os.path` modules, and most other functions and " +"classes in the standard library. The :class:`os.DirEntry` class and " +"relevant classes in :mod:`pathlib` have also been updated to " +"implement :class:`os.PathLike`." msgstr "" #: ../../whatsnew/3.6.rst:433 msgid "" "The hope is that updating the fundamental functions for operating on file " -"system paths will lead to third-party code to implicitly support all :term:" -"`path-like objects <path-like object>` without any code changes, or at least " -"very minimal ones (e.g. calling :func:`os.fspath` at the beginning of code " -"before operating on a path-like object)." +"system paths will lead to third-party code to implicitly support " +"all :term:`path-like objects <path-like object>` without any code changes, " +"or at least very minimal ones (e.g. calling :func:`os.fspath` at the " +"beginning of code before operating on a path-like object)." msgstr "" #: ../../whatsnew/3.6.rst:440 msgid "" -"Here are some examples of how the new interface allows for :class:`pathlib." -"Path` to be used more easily and transparently with pre-existing code::" +"Here are some examples of how the new interface allows " +"for :class:`pathlib.Path` to be used more easily and transparently with pre-" +"existing code::" msgstr "" #: ../../whatsnew/3.6.rst:444 @@ -660,9 +662,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:476 msgid "" -":pep:`495` adds the new *fold* attribute to instances of :class:`datetime." -"datetime` and :class:`datetime.time` classes to differentiate between two " -"moments in time for which local times are the same::" +":pep:`495` adds the new *fold* attribute to instances " +"of :class:`datetime.datetime` and :class:`datetime.time` classes to " +"differentiate between two moments in time for which local times are the " +"same::" msgstr "" #: ../../whatsnew/3.6.rst:480 @@ -721,17 +724,17 @@ msgstr "" msgid "" "Prior to Python 3.6, data loss could result when using bytes paths on " "Windows. With this change, using bytes to represent paths is now supported " -"on Windows, provided those bytes are encoded with the encoding returned by :" -"func:`sys.getfilesystemencoding`, which now defaults to ``'utf-8'``." +"on Windows, provided those bytes are encoded with the encoding returned " +"by :func:`sys.getfilesystemencoding`, which now defaults to ``'utf-8'``." msgstr "" #: ../../whatsnew/3.6.rst:516 msgid "" -"Applications that do not use str to represent paths should use :func:`os." -"fsencode` and :func:`os.fsdecode` to ensure their bytes are correctly " -"encoded. To revert to the previous behaviour, set :envvar:" -"`PYTHONLEGACYWINDOWSFSENCODING` or call :func:`sys." -"_enablelegacywindowsfsencoding`." +"Applications that do not use str to represent paths should " +"use :func:`os.fsencode` and :func:`os.fsdecode` to ensure their bytes are " +"correctly encoded. To revert to the previous behaviour, " +"set :envvar:`PYTHONLEGACYWINDOWSFSENCODING` or " +"call :func:`sys._enablelegacywindowsfsencoding`." msgstr "" #: ../../whatsnew/3.6.rst:522 @@ -747,8 +750,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:531 msgid "" "The default console on Windows will now accept all Unicode characters and " -"provide correctly read str objects to Python code. ``sys.stdin``, ``sys." -"stdout`` and ``sys.stderr`` now default to utf-8 encoding." +"provide correctly read str objects to Python code. ``sys.stdin``, " +"``sys.stdout`` and ``sys.stderr`` now default to utf-8 encoding." msgstr "" #: ../../whatsnew/3.6.rst:535 @@ -779,8 +782,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:554 msgid "" -"Also, the effective default class *execution* namespace (returned from :ref:" -"`type.__prepare__() <prepare>`) is now an insertion-order-preserving mapping." +"Also, the effective default class *execution* namespace (returned " +"from :ref:`type.__prepare__() <prepare>`) is now an insertion-order-" +"preserving mapping." msgstr "" #: ../../whatsnew/3.6.rst:560 @@ -814,9 +818,9 @@ msgid "" "The :ref:`dict <typesmapping>` type now uses a \"compact\" representation " "based on `a proposal by Raymond Hettinger <https://mail.python.org/pipermail/" "python-dev/2012-December/123028.html>`_ which was `first implemented by PyPy " -"<https://morepypy.blogspot.com/2015/01/faster-more-memory-efficient-and-more." -"html>`_. The memory usage of the new :func:`dict` is between 20% and 25% " -"smaller compared to Python 3.5." +"<https://morepypy.blogspot.com/2015/01/faster-more-memory-efficient-and-" +"more.html>`_. The memory usage of the new :func:`dict` is between 20% and " +"25% smaller compared to Python 3.5." msgstr "" #: ../../whatsnew/3.6.rst:591 @@ -827,8 +831,8 @@ msgid "" "language for a few releases before changing the language spec to mandate " "order-preserving semantics for all current and future Python " "implementations; this also helps preserve backwards-compatibility with older " -"versions of the language where random iteration order is still in effect, e." -"g. Python 3.5)." +"versions of the language where random iteration order is still in effect, " +"e.g. Python 3.5)." msgstr "" #: ../../whatsnew/3.6.rst:600 @@ -903,8 +907,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:647 msgid "" -"Detect violations of the Python memory allocator API. For example, :c:func:" -"`PyObject_Free` called on a memory block allocated by :c:func:`PyMem_Malloc`." +"Detect violations of the Python memory allocator API. For " +"example, :c:func:`PyObject_Free` called on a memory block allocated " +"by :c:func:`PyMem_Malloc`." msgstr "" #: ../../whatsnew/3.6.rst:650 @@ -943,8 +948,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:666 msgid "" -"On error, the debug hooks on Python memory allocators now use the :mod:" -"`tracemalloc` module to get the traceback where a memory block was allocated." +"On error, the debug hooks on Python memory allocators now use " +"the :mod:`tracemalloc` module to get the traceback where a memory block was " +"allocated." msgstr "" #: ../../whatsnew/3.6.rst:670 @@ -1085,8 +1091,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:742 msgid "" "A ``global`` or ``nonlocal`` statement must now textually appear before the " -"first use of the affected name in the same scope. Previously this was a :exc:" -"`SyntaxWarning`." +"first use of the affected name in the same scope. Previously this was " +"a :exc:`SyntaxWarning`." msgstr "" #: ../../whatsnew/3.6.rst:746 @@ -1106,10 +1112,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:757 msgid "" -"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass of :" -"exc:`ImportError`) when it cannot find a module. Code that currently checks " -"for ImportError (in try-except) will still work. (Contributed by Eric Snow " -"in :issue:`15767`.)" +"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass " +"of :exc:`ImportError`) when it cannot find a module. Code that currently " +"checks for ImportError (in try-except) will still work. (Contributed by Eric " +"Snow in :issue:`15767`.)" msgstr "" #: ../../whatsnew/3.6.rst:762 @@ -1138,8 +1144,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:781 msgid "" "Note that the pseudo-random generators in the :mod:`random` module should " -"*NOT* be used for security purposes. Use :mod:`secrets` on Python 3.6+ and :" -"func:`os.urandom` on Python 3.5 and earlier." +"*NOT* be used for security purposes. Use :mod:`secrets` on Python 3.6+ " +"and :func:`os.urandom` on Python 3.5 and earlier." msgstr "" #: ../../whatsnew/3.6.rst:787 @@ -1244,9 +1250,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:850 msgid "" -"New :meth:`loop.get_exception_handler() <asyncio.loop." -"get_exception_handler>` method to get the current exception handler. " -"(Contributed by Yury Selivanov in :issue:`27040`.)" +"New :meth:`loop.get_exception_handler() " +"<asyncio.loop.get_exception_handler>` method to get the current exception " +"handler. (Contributed by Yury Selivanov in :issue:`27040`.)" msgstr "" #: ../../whatsnew/3.6.rst:854 @@ -1258,9 +1264,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:859 msgid "" -"The performance of :meth:`StreamReader.readexactly() <asyncio.StreamReader." -"readexactly>` has been improved. (Contributed by Mark Korenberg in :issue:" -"`28370`.)" +"The performance of :meth:`StreamReader.readexactly() " +"<asyncio.StreamReader.readexactly>` has been improved. (Contributed by Mark " +"Korenberg in :issue:`28370`.)" msgstr "" #: ../../whatsnew/3.6.rst:863 @@ -1287,9 +1293,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:879 msgid "" -"New :meth:`loop.connect_accepted_socket() <asyncio.loop." -"connect_accepted_socket>` method to be used by servers that accept " -"connections outside of asyncio, but that use asyncio to handle them. " +"New :meth:`loop.connect_accepted_socket() " +"<asyncio.loop.connect_accepted_socket>` method to be used by servers that " +"accept connections outside of asyncio, but that use asyncio to handle them. " "(Contributed by Jim Fulton in :issue:`27392`.)" msgstr "" @@ -1337,10 +1343,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:914 msgid "" -"New constants: :const:`cmath.inf` and :const:`cmath.nan` to match :const:" -"`math.inf` and :const:`math.nan`, and also :const:`cmath.infj` and :const:" -"`cmath.nanj` to match the format used by complex repr. (Contributed by Mark " -"Dickinson in :issue:`23229`.)" +"New constants: :const:`cmath.inf` and :const:`cmath.nan` to " +"match :const:`math.inf` and :const:`math.nan`, and also :const:`cmath.infj` " +"and :const:`cmath.nanj` to match the format used by complex repr. " +"(Contributed by Mark Dickinson in :issue:`23229`.)" msgstr "" #: ../../whatsnew/3.6.rst:921 @@ -1364,16 +1370,16 @@ msgstr "" #: ../../whatsnew/3.6.rst:931 msgid "" "The new :class:`~collections.abc.AsyncGenerator` abstract base class " -"represents asynchronous generators. (Contributed by Yury Selivanov in :issue:" -"`28720`.)" +"represents asynchronous generators. (Contributed by Yury Selivanov " +"in :issue:`28720`.)" msgstr "" #: ../../whatsnew/3.6.rst:935 msgid "" "The :func:`~collections.namedtuple` function now accepts an optional keyword " -"argument *module*, which, when specified, is used for the :attr:`~type." -"__module__` attribute of the returned named tuple class. (Contributed by " -"Raymond Hettinger in :issue:`17941`.)" +"argument *module*, which, when specified, is used for " +"the :attr:`~type.__module__` attribute of the returned named tuple class. " +"(Contributed by Raymond Hettinger in :issue:`17941`.)" msgstr "" #: ../../whatsnew/3.6.rst:940 ../../whatsnew/3.6.rst:2295 @@ -1409,9 +1415,9 @@ msgid "" "The :class:`contextlib.AbstractContextManager` class has been added to " "provide an abstract base class for context managers. It provides a sensible " "default implementation for ``__enter__()`` which returns ``self`` and leaves " -"``__exit__()`` an abstract method. A matching class has been added to the :" -"mod:`typing` module as :class:`typing.ContextManager`. (Contributed by Brett " -"Cannon in :issue:`25609`.)" +"``__exit__()`` an abstract method. A matching class has been added to " +"the :mod:`typing` module as :class:`typing.ContextManager`. (Contributed by " +"Brett Cannon in :issue:`25609`.)" msgstr "" #: ../../whatsnew/3.6.rst:971 @@ -1430,10 +1436,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:981 msgid "" -"The :meth:`datetime.strftime() <datetime.datetime.strftime>` and :meth:`date." -"strftime() <datetime.date.strftime>` methods now support ISO 8601 date " -"directives ``%G``, ``%u`` and ``%V``. (Contributed by Ashley Anderson in :" -"issue:`12006`.)" +"The :meth:`datetime.strftime() <datetime.datetime.strftime>` " +"and :meth:`date.strftime() <datetime.date.strftime>` methods now support ISO " +"8601 date directives ``%G``, ``%u`` and ``%V``. (Contributed by Ashley " +"Anderson in :issue:`12006`.)" msgstr "" #: ../../whatsnew/3.6.rst:986 @@ -1447,8 +1453,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:991 msgid "" "The :meth:`datetime.combine() <datetime.datetime.combine>` now accepts an " -"optional *tzinfo* argument. (Contributed by Alexander Belopolsky in :issue:" -"`27661`.)" +"optional *tzinfo* argument. (Contributed by Alexander Belopolsky " +"in :issue:`27661`.)" msgstr "" #: ../../whatsnew/3.6.rst:997 @@ -1458,9 +1464,9 @@ msgstr "decimal" #: ../../whatsnew/3.6.rst:999 msgid "" "New :meth:`Decimal.as_integer_ratio() <decimal.Decimal.as_integer_ratio>` " -"method that returns a pair ``(n, d)`` of integers that represent the given :" -"class:`~decimal.Decimal` instance as a fraction, in lowest terms and with a " -"positive denominator::" +"method that returns a pair ``(n, d)`` of integers that represent the " +"given :class:`~decimal.Decimal` instance as a fraction, in lowest terms and " +"with a positive denominator::" msgstr "" #: ../../whatsnew/3.6.rst:1004 @@ -1481,9 +1487,9 @@ msgstr "distutils" #: ../../whatsnew/3.6.rst:1014 msgid "" -"The ``default_format`` attribute has been removed from ``distutils.command." -"sdist.sdist`` and the ``formats`` attribute defaults to ``['gztar']``. " -"Although not anticipated, any code relying on the presence of " +"The ``default_format`` attribute has been removed from " +"``distutils.command.sdist.sdist`` and the ``formats`` attribute defaults to " +"``['gztar']``. Although not anticipated, any code relying on the presence of " "``default_format`` may need to be adapted. See :issue:`27819` for more " "details." msgstr "" @@ -1497,8 +1503,8 @@ msgid "" "The new email API, enabled via the *policy* keyword to various constructors, " "is no longer provisional. The :mod:`email` documentation has been " "reorganized and rewritten to focus on the new API, while retaining the old " -"documentation for the legacy API. (Contributed by R. David Murray in :issue:" -"`24277`.)" +"documentation for the legacy API. (Contributed by R. David Murray " +"in :issue:`24277`.)" msgstr "" #: ../../whatsnew/3.6.rst:1029 @@ -1515,12 +1521,13 @@ msgstr "" #: ../../whatsnew/3.6.rst:1035 msgid "" -"There is a new :mod:`~email.policy` attribute, :attr:`~email.policy.Policy." -"message_factory`, that controls what class is used by default when the " -"parser creates new message objects. For the :attr:`email.policy.compat32` " -"policy this is :class:`~email.message.Message`, for the new policies it is :" -"class:`~email.message.EmailMessage`. (Contributed by R. David Murray in :" -"issue:`20476`.)" +"There is a new :mod:`~email.policy` " +"attribute, :attr:`~email.policy.Policy.message_factory`, that controls what " +"class is used by default when the parser creates new message objects. For " +"the :attr:`email.policy.compat32` policy this " +"is :class:`~email.message.Message`, for the new policies it " +"is :class:`~email.message.EmailMessage`. (Contributed by R. David Murray " +"in :issue:`20476`.)" msgstr "" #: ../../whatsnew/3.6.rst:1044 @@ -1540,16 +1547,16 @@ msgstr "enum" #: ../../whatsnew/3.6.rst:1054 msgid "" -"Two new enumeration base classes have been added to the :mod:`enum` module: :" -"class:`~enum.Flag` and :class:`~enum.IntFlags`. Both are used to define " -"constants that can be combined using the bitwise operators. (Contributed by " -"Ethan Furman in :issue:`23591`.)" +"Two new enumeration base classes have been added to the :mod:`enum` " +"module: :class:`~enum.Flag` and :class:`~enum.IntFlags`. Both are used to " +"define constants that can be combined using the bitwise operators. " +"(Contributed by Ethan Furman in :issue:`23591`.)" msgstr "" #: ../../whatsnew/3.6.rst:1059 msgid "" -"Many standard library modules have been updated to use the :class:`~enum." -"IntFlags` class for their constants." +"Many standard library modules have been updated to use " +"the :class:`~enum.IntFlags` class for their constants." msgstr "" #: ../../whatsnew/3.6.rst:1062 @@ -1620,19 +1627,19 @@ msgstr "" #: ../../whatsnew/3.6.rst:1102 msgid "" -"The SHA-3 hash functions :func:`~hashlib.sha3_224`, :func:`~hashlib." -"sha3_256`, :func:`~hashlib.sha3_384`, :func:`~hashlib.sha3_512`, and SHAKE " -"hash functions :func:`~hashlib.shake_128` and :func:`~hashlib.shake_256` " -"were added. (Contributed by Christian Heimes in :issue:`16113`. Keccak Code " -"Package by Guido Bertoni, Joan Daemen, Michaël Peeters, Gilles Van Assche, " -"and Ronny Van Keer.)" +"The SHA-3 hash " +"functions :func:`~hashlib.sha3_224`, :func:`~hashlib.sha3_256`, :func:`~hashlib.sha3_384`, :func:`~hashlib.sha3_512`, " +"and SHAKE hash functions :func:`~hashlib.shake_128` " +"and :func:`~hashlib.shake_256` were added. (Contributed by Christian Heimes " +"in :issue:`16113`. Keccak Code Package by Guido Bertoni, Joan Daemen, " +"Michaël Peeters, Gilles Van Assche, and Ronny Van Keer.)" msgstr "" #: ../../whatsnew/3.6.rst:1109 msgid "" "The password-based key derivation function :func:`~hashlib.scrypt` is now " -"available with OpenSSL 1.1.0 and newer. (Contributed by Christian Heimes in :" -"issue:`27928`.)" +"available with OpenSSL 1.1.0 and newer. (Contributed by Christian Heimes " +"in :issue:`27928`.)" msgstr "" #: ../../whatsnew/3.6.rst:1114 @@ -1641,10 +1648,10 @@ msgstr "http.client" #: ../../whatsnew/3.6.rst:1116 msgid "" -":meth:`HTTPConnection.request() <http.client.HTTPConnection.request>` and :" -"meth:`~http.client.HTTPConnection.endheaders` both now support chunked " -"encoding request bodies. (Contributed by Demian Brecht and Rolf Krahl in :" -"issue:`12319`.)" +":meth:`HTTPConnection.request() <http.client.HTTPConnection.request>` " +"and :meth:`~http.client.HTTPConnection.endheaders` both now support chunked " +"encoding request bodies. (Contributed by Demian Brecht and Rolf Krahl " +"in :issue:`12319`.)" msgstr "" #: ../../whatsnew/3.6.rst:1123 @@ -1667,10 +1674,10 @@ msgid "" "renaming of files with partial uppercase names is similar to the renaming " "of, for instance, Tkinter and TkFont to tkinter and tkinter.font in 3.0. As " "a result, imports of idlelib files that worked in 3.5 will usually not work " -"in 3.6. At least a module name change will be needed (see idlelib/README." -"txt), sometimes more. (Name changes contributed by Al Swiegart and Terry " -"Reedy in :issue:`24225`. Most idlelib patches since have been and will be " -"part of the process.)" +"in 3.6. At least a module name change will be needed (see idlelib/" +"README.txt), sometimes more. (Name changes contributed by Al Swiegart and " +"Terry Reedy in :issue:`24225`. Most idlelib patches since have been and " +"will be part of the process.)" msgstr "" #: ../../whatsnew/3.6.rst:1141 @@ -1686,8 +1693,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1147 msgid "" -"Multiple fixes for autocompletion. (Contributed by Louie Lu in :issue:" -"`15786`.)" +"Multiple fixes for autocompletion. (Contributed by Louie Lu " +"in :issue:`15786`.)" msgstr "" #: ../../whatsnew/3.6.rst:1149 @@ -1738,8 +1745,8 @@ msgid "" "Editor code context option revised. Box displays all context lines up to " "maxlines. Clicking on a context line jumps the editor to that line. " "Context colors for custom themes is added to Highlights tab of Settings " -"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy in :issue:" -"`33642`, :issue:`33768`, and :issue:`33679`.)" +"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy " +"in :issue:`33642`, :issue:`33768`, and :issue:`33679`.)" msgstr "" #: ../../whatsnew/3.6.rst:1182 @@ -1771,26 +1778,26 @@ msgstr "importlib" #: ../../whatsnew/3.6.rst:1201 msgid "" -"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass of :" -"exc:`ImportError`) when it cannot find a module. Code that current checks " -"for ``ImportError`` (in try-except) will still work. (Contributed by Eric " -"Snow in :issue:`15767`.)" +"Import now raises the new exception :exc:`ModuleNotFoundError` (subclass " +"of :exc:`ImportError`) when it cannot find a module. Code that current " +"checks for ``ImportError`` (in try-except) will still work. (Contributed by " +"Eric Snow in :issue:`15767`.)" msgstr "" #: ../../whatsnew/3.6.rst:1206 msgid "" -":class:`importlib.util.LazyLoader` now calls :meth:`~importlib.abc.Loader." -"create_module` on the wrapped loader, removing the restriction that :class:" -"`importlib.machinery.BuiltinImporter` and :class:`importlib.machinery." -"ExtensionFileLoader` couldn't be used with :class:`importlib.util." -"LazyLoader`." +":class:`importlib.util.LazyLoader` now " +"calls :meth:`~importlib.abc.Loader.create_module` on the wrapped loader, " +"removing the restriction that :class:`importlib.machinery.BuiltinImporter` " +"and :class:`importlib.machinery.ExtensionFileLoader` couldn't be used " +"with :class:`importlib.util.LazyLoader`." msgstr "" #: ../../whatsnew/3.6.rst:1212 msgid "" -":func:`importlib.util.cache_from_source`, :func:`importlib.util." -"source_from_cache`, and :func:`importlib.util.spec_from_file_location` now " -"accept a :term:`path-like object`." +":func:`importlib.util.cache_from_source`, :func:`importlib.util.source_from_cache`, " +"and :func:`importlib.util.spec_from_file_location` now accept a :term:`path-" +"like object`." msgstr "" #: ../../whatsnew/3.6.rst:1219 @@ -1807,12 +1814,12 @@ msgstr "" #: ../../whatsnew/3.6.rst:1226 msgid "" -"To reduce code churn when upgrading from Python 2.7 and the legacy :func:" -"`inspect.getargspec` API, the previously documented deprecation of :func:" -"`inspect.getfullargspec` has been reversed. While this function is " -"convenient for single/source Python 2/3 code bases, the richer :func:" -"`inspect.signature` interface remains the recommended approach for new code. " -"(Contributed by Nick Coghlan in :issue:`27172`)" +"To reduce code churn when upgrading from Python 2.7 and the " +"legacy :func:`inspect.getargspec` API, the previously documented deprecation " +"of :func:`inspect.getfullargspec` has been reversed. While this function is " +"convenient for single/source Python 2/3 code bases, the " +"richer :func:`inspect.signature` interface remains the recommended approach " +"for new code. (Contributed by Nick Coghlan in :issue:`27172`)" msgstr "" #: ../../whatsnew/3.6.rst:1235 @@ -1832,10 +1839,10 @@ msgstr "logging" #: ../../whatsnew/3.6.rst:1245 msgid "" -"The new :meth:`WatchedFileHandler.reopenIfNeeded() <logging.handlers." -"WatchedFileHandler.reopenIfNeeded>` method has been added to add the ability " -"to check if the log file needs to be reopened. (Contributed by Marian Horban " -"in :issue:`24884`.)" +"The new :meth:`WatchedFileHandler.reopenIfNeeded() " +"<logging.handlers.WatchedFileHandler.reopenIfNeeded>` method has been added " +"to add the ability to check if the log file needs to be reopened. " +"(Contributed by Marian Horban in :issue:`24884`.)" msgstr "" #: ../../whatsnew/3.6.rst:1252 @@ -1855,9 +1862,9 @@ msgstr "multiprocessing" #: ../../whatsnew/3.6.rst:1262 msgid "" -":ref:`Proxy Objects <multiprocessing-proxy_objects>` returned by :func:" -"`multiprocessing.Manager` can now be nested. (Contributed by Davin Potts in :" -"issue:`6766`.)" +":ref:`Proxy Objects <multiprocessing-proxy_objects>` returned " +"by :func:`multiprocessing.Manager` can now be nested. (Contributed by Davin " +"Potts in :issue:`6766`.)" msgstr "" #: ../../whatsnew/3.6.rst:1268 ../../whatsnew/3.6.rst:2021 @@ -1877,11 +1884,12 @@ msgstr "" #: ../../whatsnew/3.6.rst:1276 msgid "" -"A new :meth:`~os.scandir.close` method allows explicitly closing a :func:" -"`~os.scandir` iterator. The :func:`~os.scandir` iterator now supports the :" -"term:`context manager` protocol. If a :func:`scandir` iterator is neither " -"exhausted nor explicitly closed a :exc:`ResourceWarning` will be emitted in " -"its destructor. (Contributed by Serhiy Storchaka in :issue:`25994`.)" +"A new :meth:`~os.scandir.close` method allows explicitly closing " +"a :func:`~os.scandir` iterator. The :func:`~os.scandir` iterator now " +"supports the :term:`context manager` protocol. If a :func:`scandir` " +"iterator is neither exhausted nor explicitly closed a :exc:`ResourceWarning` " +"will be emitted in its destructor. (Contributed by Serhiy Storchaka " +"in :issue:`25994`.)" msgstr "" #: ../../whatsnew/3.6.rst:1286 @@ -1971,24 +1979,24 @@ msgstr "re" #: ../../whatsnew/3.6.rst:1347 msgid "" -"Added support of modifier spans in regular expressions. Examples: ``'(?i:" -"p)ython'`` matches ``'python'`` and ``'Python'``, but not ``'PYTHON'``; ``'(?" -"i)g(?-i:v)r'`` matches ``'GvR'`` and ``'gvr'``, but not ``'GVR'``. " +"Added support of modifier spans in regular expressions. Examples: ``'(?" +"i:p)ython'`` matches ``'python'`` and ``'Python'``, but not ``'PYTHON'``; " +"``'(?i)g(?-i:v)r'`` matches ``'GvR'`` and ``'gvr'``, but not ``'GVR'``. " "(Contributed by Serhiy Storchaka in :issue:`433028`.)" msgstr "" #: ../../whatsnew/3.6.rst:1352 msgid "" "Match object groups can be accessed by ``__getitem__``, which is equivalent " -"to ``group()``. So ``mo['name']`` is now equivalent to ``mo." -"group('name')``. (Contributed by Eric Smith in :issue:`24454`.)" +"to ``group()``. So ``mo['name']`` is now equivalent to " +"``mo.group('name')``. (Contributed by Eric Smith in :issue:`24454`.)" msgstr "" #: ../../whatsnew/3.6.rst:1356 msgid "" -":class:`~re.Match` objects now support :meth:`index-like objects <object." -"__index__>` as group indices. (Contributed by Jeroen Demeyer and Xiang Zhang " -"in :issue:`27177`.)" +":class:`~re.Match` objects now support :meth:`index-like objects " +"<object.__index__>` as group indices. (Contributed by Jeroen Demeyer and " +"Xiang Zhang in :issue:`27177`.)" msgstr "" #: ../../whatsnew/3.6.rst:1363 @@ -1998,8 +2006,8 @@ msgstr "readline" #: ../../whatsnew/3.6.rst:1365 msgid "" "Added :func:`~readline.set_auto_history` to enable or disable automatic " -"addition of input to the history list. (Contributed by Tyler Crompton in :" -"issue:`26870`.)" +"addition of input to the history list. (Contributed by Tyler Crompton " +"in :issue:`26870`.)" msgstr "" #: ../../whatsnew/3.6.rst:1371 @@ -2010,8 +2018,8 @@ msgstr "rlcompleter" msgid "" "Private and special attribute names now are omitted unless the prefix starts " "with underscores. A space or a colon is added after some completed " -"keywords. (Contributed by Serhiy Storchaka in :issue:`25011` and :issue:" -"`25209`.)" +"keywords. (Contributed by Serhiy Storchaka in :issue:`25011` " +"and :issue:`25209`.)" msgstr "" #: ../../whatsnew/3.6.rst:1379 @@ -2053,9 +2061,9 @@ msgstr "socket" #: ../../whatsnew/3.6.rst:1406 msgid "" -"The :func:`~socket.socket.ioctl` function now supports the :const:`~socket." -"SIO_LOOPBACK_FAST_PATH` control code. (Contributed by Daniel Stokes in :" -"issue:`26536`.)" +"The :func:`~socket.socket.ioctl` function now supports " +"the :const:`~socket.SIO_LOOPBACK_FAST_PATH` control code. (Contributed by " +"Daniel Stokes in :issue:`26536`.)" msgstr "" #: ../../whatsnew/3.6.rst:1410 @@ -2068,16 +2076,16 @@ msgstr "" #: ../../whatsnew/3.6.rst:1414 msgid "" "The :meth:`~socket.socket.setsockopt` now supports the ``setsockopt(level, " -"optname, None, optlen: int)`` form. (Contributed by Christian Heimes in :" -"issue:`27744`.)" +"optname, None, optlen: int)`` form. (Contributed by Christian Heimes " +"in :issue:`27744`.)" msgstr "" #: ../../whatsnew/3.6.rst:1418 msgid "" "The socket module now supports the address family :const:`~socket.AF_ALG` to " -"interface with Linux Kernel crypto API. ``ALG_*``, ``SOL_ALG`` and :meth:" -"`~socket.socket.sendmsg_afalg` were added. (Contributed by Christian Heimes " -"in :issue:`27744` with support from Victor Stinner.)" +"interface with Linux Kernel crypto API. ``ALG_*``, ``SOL_ALG`` " +"and :meth:`~socket.socket.sendmsg_afalg` were added. (Contributed by " +"Christian Heimes in :issue:`27744` with support from Victor Stinner.)" msgstr "" #: ../../whatsnew/3.6.rst:1424 @@ -2092,19 +2100,19 @@ msgstr "socketserver" #: ../../whatsnew/3.6.rst:1431 msgid "" -"Servers based on the :mod:`socketserver` module, including those defined in :" -"mod:`http.server`, :mod:`xmlrpc.server` and :mod:`wsgiref.simple_server`, " -"now support the :term:`context manager` protocol. (Contributed by Aviv " -"Palivoda in :issue:`26404`.)" +"Servers based on the :mod:`socketserver` module, including those defined " +"in :mod:`http.server`, :mod:`xmlrpc.server` " +"and :mod:`wsgiref.simple_server`, now support the :term:`context manager` " +"protocol. (Contributed by Aviv Palivoda in :issue:`26404`.)" msgstr "" #: ../../whatsnew/3.6.rst:1437 msgid "" -"The :attr:`~socketserver.StreamRequestHandler.wfile` attribute of :class:" -"`~socketserver.StreamRequestHandler` classes now implements the :class:`io." -"BufferedIOBase` writable interface. In particular, calling :meth:`~io." -"BufferedIOBase.write` is now guaranteed to send the data in full. " -"(Contributed by Martin Panter in :issue:`26721`.)" +"The :attr:`~socketserver.StreamRequestHandler.wfile` attribute " +"of :class:`~socketserver.StreamRequestHandler` classes now implements " +"the :class:`io.BufferedIOBase` writable interface. In particular, " +"calling :meth:`~io.BufferedIOBase.write` is now guaranteed to send the data " +"in full. (Contributed by Martin Panter in :issue:`26721`.)" msgstr "" #: ../../whatsnew/3.6.rst:1445 ../../whatsnew/3.6.rst:2037 @@ -2120,8 +2128,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1450 msgid "" "3DES has been removed from the default cipher suites and ChaCha20 Poly1305 " -"cipher suites have been added. (Contributed by Christian Heimes in :issue:" -"`27850` and :issue:`27766`.)" +"cipher suites have been added. (Contributed by Christian Heimes " +"in :issue:`27850` and :issue:`27766`.)" msgstr "" #: ../../whatsnew/3.6.rst:1454 @@ -2146,8 +2154,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:1467 msgid "" -"All constants and flags have been converted to :class:`~enum.IntEnum` and :" -"class:`~enum.IntFlags`. (Contributed by Christian Heimes in :issue:`28025`.)" +"All constants and flags have been converted to :class:`~enum.IntEnum` " +"and :class:`~enum.IntFlags`. (Contributed by Christian Heimes " +"in :issue:`28025`.)" msgstr "" #: ../../whatsnew/3.6.rst:1471 @@ -2158,9 +2167,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:1475 msgid "" -"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable and :meth:`ssl." -"SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 post-handshake " -"authentication. (Contributed by Christian Heimes in :gh:`78851`.)" +"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable " +"and :meth:`ssl.SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 " +"post-handshake authentication. (Contributed by Christian Heimes " +"in :gh:`78851`.)" msgstr "" #: ../../whatsnew/3.6.rst:1481 @@ -2180,8 +2190,8 @@ msgstr "struct" #: ../../whatsnew/3.6.rst:1490 msgid "" ":mod:`struct` now supports IEEE 754 half-precision floats via the ``'e'`` " -"format specifier. (Contributed by Eli Stevens, Mark Dickinson in :issue:" -"`11734`.)" +"format specifier. (Contributed by Eli Stevens, Mark Dickinson " +"in :issue:`11734`.)" msgstr "" #: ../../whatsnew/3.6.rst:1496 @@ -2192,9 +2202,9 @@ msgstr "subprocess" msgid "" ":class:`subprocess.Popen` destructor now emits a :exc:`ResourceWarning` " "warning if the child process is still running. Use the context manager " -"protocol (``with proc: ...``) or explicitly call the :meth:`~subprocess." -"Popen.wait` method to read the exit status of the child process. " -"(Contributed by Victor Stinner in :issue:`26741`.)" +"protocol (``with proc: ...``) or explicitly call " +"the :meth:`~subprocess.Popen.wait` method to read the exit status of the " +"child process. (Contributed by Victor Stinner in :issue:`26741`.)" msgstr "" #: ../../whatsnew/3.6.rst:1504 @@ -2241,8 +2251,8 @@ msgstr "time" #: ../../whatsnew/3.6.rst:1534 msgid "" -"The :class:`~time.struct_time` attributes :attr:`tm_gmtoff` and :attr:" -"`tm_zone` are now available on all platforms." +"The :class:`~time.struct_time` attributes :attr:`tm_gmtoff` " +"and :attr:`tm_zone` are now available on all platforms." msgstr "" #: ../../whatsnew/3.6.rst:1539 @@ -2269,13 +2279,14 @@ msgstr "tkinter" #: ../../whatsnew/3.6.rst:1554 msgid "" -"Added methods :meth:`~tkinter.Variable.trace_add`, :meth:`~tkinter.Variable." -"trace_remove` and :meth:`~tkinter.Variable.trace_info` in the :class:" -"`tkinter.Variable` class. They replace old methods :meth:`~tkinter.Variable." -"trace_variable`, :meth:`~tkinter.Variable.trace`, :meth:`~tkinter.Variable." -"trace_vdelete` and :meth:`~tkinter.Variable.trace_vinfo` that use obsolete " -"Tcl commands and might not work in future versions of Tcl. (Contributed by " -"Serhiy Storchaka in :issue:`22115`)." +"Added " +"methods :meth:`~tkinter.Variable.trace_add`, :meth:`~tkinter.Variable.trace_remove` " +"and :meth:`~tkinter.Variable.trace_info` in the :class:`tkinter.Variable` " +"class. They replace old " +"methods :meth:`~tkinter.Variable.trace_variable`, :meth:`~tkinter.Variable.trace`, :meth:`~tkinter.Variable.trace_vdelete` " +"and :meth:`~tkinter.Variable.trace_vinfo` that use obsolete Tcl commands and " +"might not work in future versions of Tcl. (Contributed by Serhiy Storchaka " +"in :issue:`22115`)." msgstr "" #: ../../whatsnew/3.6.rst:1567 @@ -2351,22 +2362,22 @@ msgstr "" msgid "" "The :mod:`typing` module has a much improved support for generic type " "aliases. For example ``Dict[str, Tuple[S, T]]`` is now a valid type " -"annotation. (Contributed by Guido van Rossum in `Github #195 <https://github." -"com/python/typing/pull/195>`_.)" +"annotation. (Contributed by Guido van Rossum in `Github #195 <https://" +"github.com/python/typing/pull/195>`_.)" msgstr "" #: ../../whatsnew/3.6.rst:1614 msgid "" -"The :class:`typing.ContextManager` class has been added for representing :" -"class:`contextlib.AbstractContextManager`. (Contributed by Brett Cannon in :" -"issue:`25609`.)" +"The :class:`typing.ContextManager` class has been added for " +"representing :class:`contextlib.AbstractContextManager`. (Contributed by " +"Brett Cannon in :issue:`25609`.)" msgstr "" #: ../../whatsnew/3.6.rst:1618 msgid "" -"The :class:`typing.Collection` class has been added for representing :class:" -"`collections.abc.Collection`. (Contributed by Ivan Levkivskyi in :issue:" -"`27598`.)" +"The :class:`typing.Collection` class has been added for " +"representing :class:`collections.abc.Collection`. (Contributed by Ivan " +"Levkivskyi in :issue:`27598`.)" msgstr "" #: ../../whatsnew/3.6.rst:1622 @@ -2375,16 +2386,16 @@ msgid "" "variables. As introduced in :pep:`526`, a variable annotation wrapped in " "ClassVar indicates that a given attribute is intended to be used as a class " "variable and should not be set on instances of that class. (Contributed by " -"Ivan Levkivskyi in `Github #280 <https://github.com/python/typing/" -"pull/280>`_.)" +"Ivan Levkivskyi in `Github #280 <https://github.com/python/typing/pull/" +"280>`_.)" msgstr "" #: ../../whatsnew/3.6.rst:1629 msgid "" "A new :const:`~typing.TYPE_CHECKING` constant that is assumed to be ``True`` " "by the static type checkers, but is ``False`` at runtime. (Contributed by " -"Guido van Rossum in `Github #230 <https://github.com/python/typing/" -"issues/230>`_.)" +"Guido van Rossum in `Github #230 <https://github.com/python/typing/issues/" +"230>`_.)" msgstr "" #: ../../whatsnew/3.6.rst:1634 @@ -2432,10 +2443,10 @@ msgstr "" #: ../../whatsnew/3.6.rst:1660 msgid "" -"Two new methods, :meth:`Mock.assert_called() <unittest.mock.Mock." -"assert_called>` and :meth:`Mock.assert_called_once() <unittest.mock.Mock." -"assert_called_once>` to check if the mock object was called. (Contributed by " -"Amit Saha in :issue:`26323`.)" +"Two new methods, :meth:`Mock.assert_called() " +"<unittest.mock.Mock.assert_called>` and :meth:`Mock.assert_called_once() " +"<unittest.mock.Mock.assert_called_once>` to check if the mock object was " +"called. (Contributed by Amit Saha in :issue:`26323`.)" msgstr "" #: ../../whatsnew/3.6.rst:1666 @@ -2452,9 +2463,10 @@ msgstr "urllib.request" #: ../../whatsnew/3.6.rst:1675 msgid "" "If a HTTP request has a file or iterable body (other than a bytes object) " -"but no ``Content-Length`` header, rather than throwing an error, :class:" -"`~urllib.request.AbstractHTTPHandler` now falls back to use chunked transfer " -"encoding. (Contributed by Demian Brecht and Rolf Krahl in :issue:`12319`.)" +"but no ``Content-Length`` header, rather than throwing an " +"error, :class:`~urllib.request.AbstractHTTPHandler` now falls back to use " +"chunked transfer encoding. (Contributed by Demian Brecht and Rolf Krahl " +"in :issue:`12319`.)" msgstr "" #: ../../whatsnew/3.6.rst:1683 @@ -2485,11 +2497,11 @@ msgstr "warnings" #: ../../whatsnew/3.6.rst:1701 msgid "" -"A new optional *source* parameter has been added to the :func:`warnings." -"warn_explicit` function: the destroyed object which emitted a :exc:" -"`ResourceWarning`. A *source* attribute has also been added to :class:" -"`warnings.WarningMessage` (contributed by Victor Stinner in :issue:`26568` " -"and :issue:`26567`)." +"A new optional *source* parameter has been added to " +"the :func:`warnings.warn_explicit` function: the destroyed object which " +"emitted a :exc:`ResourceWarning`. A *source* attribute has also been added " +"to :class:`warnings.WarningMessage` (contributed by Victor Stinner " +"in :issue:`26568` and :issue:`26567`)." msgstr "" #: ../../whatsnew/3.6.rst:1707 @@ -2547,9 +2559,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:1730 msgid "" -"The \"Object allocated at\" traceback is new and is only displayed if :mod:" -"`tracemalloc` is tracing Python memory allocations and if the :mod:" -"`warnings` module was already imported." +"The \"Object allocated at\" traceback is new and is only displayed " +"if :mod:`tracemalloc` is tracing Python memory allocations and if " +"the :mod:`warnings` module was already imported." msgstr "" #: ../../whatsnew/3.6.rst:1736 @@ -2568,9 +2580,9 @@ msgstr "winsound" #: ../../whatsnew/3.6.rst:1745 msgid "" -"Allowed keyword arguments to be passed to :func:`Beep <winsound.Beep>`, :" -"func:`MessageBeep <winsound.MessageBeep>`, and :func:`PlaySound <winsound." -"PlaySound>` (:issue:`27982`)." +"Allowed keyword arguments to be passed to :func:`Beep " +"<winsound.Beep>`, :func:`MessageBeep <winsound.MessageBeep>`, " +"and :func:`PlaySound <winsound.PlaySound>` (:issue:`27982`)." msgstr "" #: ../../whatsnew/3.6.rst:1751 @@ -2623,8 +2635,8 @@ msgstr "最佳化" msgid "" "The Python interpreter now uses a 16-bit wordcode instead of bytecode which " "made a number of opcode optimizations possible. (Contributed by Demur Rumed " -"with input and reviews from Serhiy Storchaka and Victor Stinner in :issue:" -"`26647` and :issue:`28050`.)" +"with input and reviews from Serhiy Storchaka and Victor Stinner " +"in :issue:`26647` and :issue:`28050`.)" msgstr "" #: ../../whatsnew/3.6.rst:1790 @@ -2656,8 +2668,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1804 msgid "" "The ASCII and the Latin1 encoders are now up to 3 times as fast for the " -"error handler ``surrogateescape`` (Contributed by Victor Stinner in :issue:" -"`25227`)." +"error handler ``surrogateescape`` (Contributed by Victor Stinner " +"in :issue:`25227`)." msgstr "" #: ../../whatsnew/3.6.rst:1808 @@ -2689,8 +2701,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1822 msgid "" "Optimize :meth:`bytes.fromhex` and :meth:`bytearray.fromhex`: they are now " -"between 2x and 3.5x faster. (Contributed by Victor Stinner in :issue:" -"`25401`)." +"between 2x and 3.5x faster. (Contributed by Victor Stinner " +"in :issue:`25401`)." msgstr "" #: ../../whatsnew/3.6.rst:1825 @@ -2701,19 +2713,19 @@ msgstr "" #: ../../whatsnew/3.6.rst:1828 msgid "" -"Allocator functions of the :c:func:`PyMem_Malloc` domain (:c:macro:" -"`PYMEM_DOMAIN_MEM`) now use the :ref:`pymalloc memory allocator <pymalloc>` " -"instead of :c:func:`malloc` function of the C library. The pymalloc " -"allocator is optimized for objects smaller or equal to 512 bytes with a " -"short lifetime, and use :c:func:`malloc` for larger memory blocks. " +"Allocator functions of the :c:func:`PyMem_Malloc` domain " +"(:c:macro:`PYMEM_DOMAIN_MEM`) now use the :ref:`pymalloc memory allocator " +"<pymalloc>` instead of :c:func:`malloc` function of the C library. The " +"pymalloc allocator is optimized for objects smaller or equal to 512 bytes " +"with a short lifetime, and use :c:func:`malloc` for larger memory blocks. " "(Contributed by Victor Stinner in :issue:`26249`)." msgstr "" #: ../../whatsnew/3.6.rst:1835 msgid "" ":func:`pickle.load` and :func:`pickle.loads` are now up to 10% faster when " -"deserializing many small objects (Contributed by Victor Stinner in :issue:" -"`27056`)." +"deserializing many small objects (Contributed by Victor Stinner " +"in :issue:`27056`)." msgstr "" #: ../../whatsnew/3.6.rst:1839 @@ -2727,42 +2739,42 @@ msgstr "" #: ../../whatsnew/3.6.rst:1845 msgid "" -"Optimized :func:`~glob.glob` and :func:`~glob.iglob` functions in the :mod:" -"`glob` module; they are now about 3--6 times faster. (Contributed by Serhiy " -"Storchaka in :issue:`25596`)." +"Optimized :func:`~glob.glob` and :func:`~glob.iglob` functions in " +"the :mod:`glob` module; they are now about 3--6 times faster. (Contributed " +"by Serhiy Storchaka in :issue:`25596`)." msgstr "" #: ../../whatsnew/3.6.rst:1849 msgid "" "Optimized globbing in :mod:`pathlib` by using :func:`os.scandir`; it is now " -"about 1.5--4 times faster. (Contributed by Serhiy Storchaka in :issue:" -"`26032`)." +"about 1.5--4 times faster. (Contributed by Serhiy Storchaka " +"in :issue:`26032`)." msgstr "" #: ../../whatsnew/3.6.rst:1853 msgid "" ":class:`xml.etree.ElementTree` parsing, iteration and deepcopy performance " -"has been significantly improved. (Contributed by Serhiy Storchaka in :issue:" -"`25638`, :issue:`25873`, and :issue:`25869`.)" +"has been significantly improved. (Contributed by Serhiy Storchaka " +"in :issue:`25638`, :issue:`25873`, and :issue:`25869`.)" msgstr "" #: ../../whatsnew/3.6.rst:1858 msgid "" "Creation of :class:`fractions.Fraction` instances from floats and decimals " -"is now 2 to 3 times faster. (Contributed by Serhiy Storchaka in :issue:" -"`25971`.)" +"is now 2 to 3 times faster. (Contributed by Serhiy Storchaka " +"in :issue:`25971`.)" msgstr "" #: ../../whatsnew/3.6.rst:1864 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.6.rst:1866 msgid "" "Python now requires some C99 support in the toolchain to build. Most " "notably, Python now uses standard integer types and macros in place of " -"custom macros like ``PY_LONG_LONG``. For more information, see :pep:`7` and :" -"issue:`17884`." +"custom macros like ``PY_LONG_LONG``. For more information, see :pep:`7` " +"and :issue:`17884`." msgstr "" #: ../../whatsnew/3.6.rst:1871 @@ -2770,8 +2782,8 @@ msgid "" "Cross-compiling CPython with the Android NDK and the Android API level set " "to 21 (Android 5.0 Lollipop) or greater runs successfully. While Android is " "not yet a supported platform, the Python test suite runs on the Android " -"emulator with only about 16 tests failures. See the Android meta-issue :" -"issue:`26865`." +"emulator with only about 16 tests failures. See the Android meta-" +"issue :issue:`26865`." msgstr "" #: ../../whatsnew/3.6.rst:1876 @@ -2818,8 +2830,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:1901 msgid "" -"The new :c:func:`PyErr_ResourceWarning` function can be used to generate a :" -"exc:`ResourceWarning` providing the source of the resource allocation. " +"The new :c:func:`PyErr_ResourceWarning` function can be used to generate " +"a :exc:`ResourceWarning` providing the source of the resource allocation. " "(Contributed by Victor Stinner in :issue:`26567`.)" msgstr "" @@ -2838,7 +2850,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:1914 msgid "Other Improvements" -msgstr "" +msgstr "其他改進" #: ../../whatsnew/3.6.rst:1916 msgid "" @@ -2888,16 +2900,16 @@ msgid "" "The :meth:`__aiter__` method is now expected to return an asynchronous " "iterator directly instead of returning an awaitable as previously. Doing the " "former will trigger a :exc:`DeprecationWarning`. Backward compatibility " -"will be removed in Python 3.7. (Contributed by Yury Selivanov in :issue:" -"`27243`.)" +"will be removed in Python 3.7. (Contributed by Yury Selivanov " +"in :issue:`27243`.)" msgstr "" #: ../../whatsnew/3.6.rst:1951 msgid "" "A backslash-character pair that is not a valid escape sequence now generates " -"a :exc:`DeprecationWarning`. Although this will eventually become a :exc:" -"`SyntaxError`, that will not be for several Python releases. (Contributed by " -"Emanuel Barry in :issue:`27364`.)" +"a :exc:`DeprecationWarning`. Although this will eventually become " +"a :exc:`SyntaxError`, that will not be for several Python releases. " +"(Contributed by Emanuel Barry in :issue:`27364`.)" msgstr "" #: ../../whatsnew/3.6.rst:1956 @@ -2948,8 +2960,8 @@ msgstr "" msgid "" "The undocumented ``extra_path`` argument to the ``distutils.Distribution`` " "constructor is now considered deprecated and will raise a warning if set. " -"Support for this parameter will be removed in a future Python release. See :" -"issue:`27919` for details." +"Support for this parameter will be removed in a future Python release. " +"See :issue:`27919` for details." msgstr "" #: ../../whatsnew/3.6.rst:1999 @@ -2964,12 +2976,12 @@ msgstr "" #: ../../whatsnew/3.6.rst:2009 msgid "" -"The :meth:`importlib.machinery.SourceFileLoader.load_module` and :meth:" -"`importlib.machinery.SourcelessFileLoader.load_module` methods are now " -"deprecated. They were the only remaining implementations of :meth:`importlib." -"abc.Loader.load_module` in :mod:`importlib` that had not been deprecated in " -"previous versions of Python in favour of :meth:`importlib.abc.Loader." -"exec_module`." +"The :meth:`importlib.machinery.SourceFileLoader.load_module` " +"and :meth:`importlib.machinery.SourcelessFileLoader.load_module` methods are " +"now deprecated. They were the only remaining implementations " +"of :meth:`importlib.abc.Loader.load_module` in :mod:`importlib` that had not " +"been deprecated in previous versions of Python in favour " +"of :meth:`importlib.abc.Loader.exec_module`." msgstr "" #: ../../whatsnew/3.6.rst:2016 @@ -2983,8 +2995,8 @@ msgstr "" msgid "" "Undocumented support of general :term:`bytes-like objects <bytes-like " "object>` as paths in :mod:`os` functions, :func:`compile` and similar " -"functions is now deprecated. (Contributed by Serhiy Storchaka in :issue:" -"`25791` and :issue:`26754`.)" +"functions is now deprecated. (Contributed by Serhiy Storchaka " +"in :issue:`25791` and :issue:`26754`.)" msgstr "" #: ../../whatsnew/3.6.rst:2031 @@ -3005,9 +3017,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:2043 msgid "" "SSL-related arguments like ``certfile``, ``keyfile`` and ``check_hostname`` " -"in :mod:`ftplib`, :mod:`http.client`, :mod:`imaplib`, :mod:`poplib`, and :" -"mod:`smtplib` have been deprecated in favor of ``context``. (Contributed by " -"Christian Heimes in :issue:`28022`.)" +"in :mod:`ftplib`, :mod:`http.client`, :mod:`imaplib`, :mod:`poplib`, " +"and :mod:`smtplib` have been deprecated in favor of ``context``. " +"(Contributed by Christian Heimes in :issue:`28022`.)" msgstr "" #: ../../whatsnew/3.6.rst:2048 @@ -3038,9 +3050,10 @@ msgstr "xml" #: ../../whatsnew/3.6.rst:2073 msgid "" -"As mitigation against DTD and external entity retrieval, the :mod:`xml.dom." -"minidom` and :mod:`xml.sax` modules no longer process external entities by " -"default. (Contributed by Christian Heimes in :gh:`61441`.)" +"As mitigation against DTD and external entity retrieval, " +"the :mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process " +"external entities by default. (Contributed by Christian Heimes " +"in :gh:`61441`.)" msgstr "" #: ../../whatsnew/3.6.rst:2080 @@ -3050,9 +3063,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:2082 msgid "" "Undocumented functions :c:func:`!PyUnicode_AsEncodedObject`, :c:func:`!" -"PyUnicode_AsDecodedObject`, :c:func:`!PyUnicode_AsEncodedUnicode` and :c:" -"func:`!PyUnicode_AsDecodedUnicode` are deprecated now. Use the :ref:`generic " -"codec based API <codec-registry>` instead." +"PyUnicode_AsDecodedObject`, :c:func:`!PyUnicode_AsEncodedUnicode` " +"and :c:func:`!PyUnicode_AsDecodedUnicode` are deprecated now. Use " +"the :ref:`generic codec based API <codec-registry>` instead." msgstr "" #: ../../whatsnew/3.6.rst:2089 @@ -3074,46 +3087,46 @@ msgstr "已移除" #: ../../whatsnew/3.6.rst:2102 msgid "API and Feature Removals" -msgstr "" +msgstr "API 與功能的移除" #: ../../whatsnew/3.6.rst:2104 msgid "" "Unknown escapes consisting of ``'\\'`` and an ASCII letter in regular " -"expressions will now cause an error. In replacement templates for :func:`re." -"sub` they are still allowed, but deprecated. The :const:`re.LOCALE` flag can " -"now only be used with binary patterns." +"expressions will now cause an error. In replacement templates " +"for :func:`re.sub` they are still allowed, but deprecated. " +"The :const:`re.LOCALE` flag can now only be used with binary patterns." msgstr "" #: ../../whatsnew/3.6.rst:2109 msgid "" -"``inspect.getmoduleinfo()`` was removed (was deprecated since CPython 3.3). :" -"func:`inspect.getmodulename` should be used for obtaining the module name " -"for a given path. (Contributed by Yury Selivanov in :issue:`13248`.)" +"``inspect.getmoduleinfo()`` was removed (was deprecated since CPython " +"3.3). :func:`inspect.getmodulename` should be used for obtaining the module " +"name for a given path. (Contributed by Yury Selivanov in :issue:`13248`.)" msgstr "" #: ../../whatsnew/3.6.rst:2114 msgid "" "``traceback.Ignore`` class and ``traceback.usage``, ``traceback.modname``, " -"``traceback.fullmodname``, ``traceback.find_lines_from_code``, ``traceback." -"find_lines``, ``traceback.find_strings``, ``traceback." -"find_executable_lines`` methods were removed from the :mod:`traceback` " -"module. They were undocumented methods deprecated since Python 3.2 and " -"equivalent functionality is available from private methods." +"``traceback.fullmodname``, ``traceback.find_lines_from_code``, " +"``traceback.find_lines``, ``traceback.find_strings``, " +"``traceback.find_executable_lines`` methods were removed from " +"the :mod:`traceback` module. They were undocumented methods deprecated since " +"Python 3.2 and equivalent functionality is available from private methods." msgstr "" #: ../../whatsnew/3.6.rst:2121 msgid "" -"The ``tk_menuBar()`` and ``tk_bindForTraversal()`` dummy methods in :mod:" -"`tkinter` widget classes were removed (corresponding Tk commands were " -"obsolete since Tk 4.0)." +"The ``tk_menuBar()`` and ``tk_bindForTraversal()`` dummy methods " +"in :mod:`tkinter` widget classes were removed (corresponding Tk commands " +"were obsolete since Tk 4.0)." msgstr "" #: ../../whatsnew/3.6.rst:2125 msgid "" "The :meth:`~zipfile.ZipFile.open` method of the :class:`zipfile.ZipFile` " "class no longer supports the ``'U'`` mode (was deprecated since Python 3.4). " -"Use :class:`io.TextIOWrapper` for reading compressed text files in :term:" -"`universal newlines` mode." +"Use :class:`io.TextIOWrapper` for reading compressed text files " +"in :term:`universal newlines` mode." msgstr "" #: ../../whatsnew/3.6.rst:2130 @@ -3150,19 +3163,19 @@ msgid "" "The output of a special Python build with defined ``COUNT_ALLOCS``, " "``SHOW_ALLOC_COUNT`` or ``SHOW_TRACK_COUNT`` macros is now off by default. " "It can be re-enabled using the ``-X showalloccount`` option. It now outputs " -"to ``stderr`` instead of ``stdout``. (Contributed by Serhiy Storchaka in :" -"issue:`23034`.)" +"to ``stderr`` instead of ``stdout``. (Contributed by Serhiy Storchaka " +"in :issue:`23034`.)" msgstr "" #: ../../whatsnew/3.6.rst:2158 msgid "Changes in the Python API" -msgstr "" +msgstr "Python API 的變更" #: ../../whatsnew/3.6.rst:2160 msgid "" ":func:`open() <open>` will no longer allow combining the ``'U'`` mode flag " -"with ``'+'``. (Contributed by Jeff Balogh and John O'Connor in :issue:" -"`2091`.)" +"with ``'+'``. (Contributed by Jeff Balogh and John O'Connor " +"in :issue:`2091`.)" msgstr "" #: ../../whatsnew/3.6.rst:2164 @@ -3179,8 +3192,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:2170 msgid "" -"When :meth:`importlib.abc.Loader.exec_module` is defined, :meth:`importlib." -"abc.Loader.create_module` must also be defined." +"When :meth:`importlib.abc.Loader.exec_module` is " +"defined, :meth:`importlib.abc.Loader.create_module` must also be defined." msgstr "" #: ../../whatsnew/3.6.rst:2173 @@ -3193,13 +3206,14 @@ msgstr "" msgid "" "The format of the :attr:`~codeobject.co_lnotab` attribute of code objects " "changed to support a negative line number delta. By default, Python does not " -"emit bytecode with a negative line number delta. Functions using :attr:" -"`frame.f_lineno`, ``PyFrame_GetLineNumber()`` or ``PyCode_Addr2Line()`` are " -"not affected. Functions directly decoding :attr:`!co_lnotab` should be " -"updated to use a signed 8-bit integer type for the line number delta, but " -"this is only required to support applications using a negative line number " -"delta. See ``Objects/lnotab_notes.txt`` for the :attr:`!co_lnotab` format " -"and how to decode it, and see the :pep:`511` for the rationale." +"emit bytecode with a negative line number delta. Functions " +"using :attr:`frame.f_lineno`, ``PyFrame_GetLineNumber()`` or " +"``PyCode_Addr2Line()`` are not affected. Functions directly decoding :attr:`!" +"co_lnotab` should be updated to use a signed 8-bit integer type for the line " +"number delta, but this is only required to support applications using a " +"negative line number delta. See ``Objects/lnotab_notes.txt`` for the :attr:`!" +"co_lnotab` format and how to decode it, and see the :pep:`511` for the " +"rationale." msgstr "" #: ../../whatsnew/3.6.rst:2187 @@ -3212,28 +3226,26 @@ msgstr "" #: ../../whatsnew/3.6.rst:2192 msgid "" -"Reading the :attr:`~urllib.parse.SplitResult.port` attribute of :func:" -"`urllib.parse.urlsplit` and :func:`~urllib.parse.urlparse` results now " -"raises :exc:`ValueError` for out-of-range values, rather than returning :" -"const:`None`. See :issue:`20059`." +"Reading the :attr:`~urllib.parse.SplitResult.port` attribute " +"of :func:`urllib.parse.urlsplit` and :func:`~urllib.parse.urlparse` results " +"now raises :exc:`ValueError` for out-of-range values, rather than " +"returning :const:`None`. See :issue:`20059`." msgstr "" #: ../../whatsnew/3.6.rst:2197 msgid "" -"The :mod:`!imp` module now raises a :exc:`DeprecationWarning` instead of :" -"exc:`PendingDeprecationWarning`." +"The :mod:`!imp` module now raises a :exc:`DeprecationWarning` instead " +"of :exc:`PendingDeprecationWarning`." msgstr "" #: ../../whatsnew/3.6.rst:2200 msgid "" "The following modules have had missing APIs added to their :attr:`__all__` " -"attributes to match the documented APIs: :mod:`calendar`, :mod:`!cgi`, :mod:" -"`csv`, :mod:`~xml.etree.ElementTree`, :mod:`enum`, :mod:`fileinput`, :mod:" -"`ftplib`, :mod:`logging`, :mod:`mailbox`, :mod:`mimetypes`, :mod:" -"`optparse`, :mod:`plistlib`, :mod:`!smtpd`, :mod:`subprocess`, :mod:" -"`tarfile`, :mod:`threading` and :mod:`wave`. This means they will export " -"new symbols when ``import *`` is used. (Contributed by Joel Taddei and Jacek " -"Kołodziej in :issue:`23883`.)" +"attributes to match the documented APIs: :mod:`calendar`, :mod:`!" +"cgi`, :mod:`csv`, :mod:`~xml.etree.ElementTree`, :mod:`enum`, :mod:`fileinput`, :mod:`ftplib`, :mod:`logging`, :mod:`mailbox`, :mod:`mimetypes`, :mod:`optparse`, :mod:`plistlib`, :mod:`!" +"smtpd`, :mod:`subprocess`, :mod:`tarfile`, :mod:`threading` " +"and :mod:`wave`. This means they will export new symbols when ``import *`` " +"is used. (Contributed by Joel Taddei and Jacek Kołodziej in :issue:`23883`.)" msgstr "" #: ../../whatsnew/3.6.rst:2211 @@ -3245,26 +3257,27 @@ msgstr "" #: ../../whatsnew/3.6.rst:2215 msgid "" -"When a relative import is performed and no parent package is known, then :" -"exc:`ImportError` will be raised. Previously, :exc:`SystemError` could be " -"raised. (Contributed by Brett Cannon in :issue:`18018`.)" +"When a relative import is performed and no parent package is known, " +"then :exc:`ImportError` will be raised. Previously, :exc:`SystemError` could " +"be raised. (Contributed by Brett Cannon in :issue:`18018`.)" msgstr "" #: ../../whatsnew/3.6.rst:2219 msgid "" -"Servers based on the :mod:`socketserver` module, including those defined in :" -"mod:`http.server`, :mod:`xmlrpc.server` and :mod:`wsgiref.simple_server`, " -"now only catch exceptions derived from :exc:`Exception`. Therefore if a " -"request handler raises an exception like :exc:`SystemExit` or :exc:" -"`KeyboardInterrupt`, :meth:`~socketserver.BaseServer.handle_error` is no " -"longer called, and the exception will stop a single-threaded server. " +"Servers based on the :mod:`socketserver` module, including those defined " +"in :mod:`http.server`, :mod:`xmlrpc.server` " +"and :mod:`wsgiref.simple_server`, now only catch exceptions derived " +"from :exc:`Exception`. Therefore if a request handler raises an exception " +"like :exc:`SystemExit` " +"or :exc:`KeyboardInterrupt`, :meth:`~socketserver.BaseServer.handle_error` " +"is no longer called, and the exception will stop a single-threaded server. " "(Contributed by Martin Panter in :issue:`23430`.)" msgstr "" #: ../../whatsnew/3.6.rst:2228 msgid "" -":func:`!spwd.getspnam` now raises a :exc:`PermissionError` instead of :exc:" -"`KeyError` if the user doesn't have privileges." +":func:`!spwd.getspnam` now raises a :exc:`PermissionError` instead " +"of :exc:`KeyError` if the user doesn't have privileges." msgstr "" #: ../../whatsnew/3.6.rst:2231 @@ -3286,11 +3299,12 @@ msgstr "" #: ../../whatsnew/3.6.rst:2243 msgid "" -"All optional arguments of the :func:`~json.dump`, :func:`~json.dumps`, :func:" -"`~json.load` and :func:`~json.loads` functions and :class:`~json." -"JSONEncoder` and :class:`~json.JSONDecoder` class constructors in the :mod:" -"`json` module are now :ref:`keyword-only <keyword-only_parameter>`. " -"(Contributed by Serhiy Storchaka in :issue:`18726`.)" +"All optional arguments of " +"the :func:`~json.dump`, :func:`~json.dumps`, :func:`~json.load` " +"and :func:`~json.loads` functions and :class:`~json.JSONEncoder` " +"and :class:`~json.JSONDecoder` class constructors in the :mod:`json` module " +"are now :ref:`keyword-only <keyword-only_parameter>`. (Contributed by Serhiy " +"Storchaka in :issue:`18726`.)" msgstr "" #: ../../whatsnew/3.6.rst:2250 @@ -3301,14 +3315,15 @@ msgstr "" #: ../../whatsnew/3.6.rst:2253 msgid "" -"As part of :pep:`487`, the handling of keyword arguments passed to :class:" -"`type` (other than the metaclass hint, ``metaclass``) is now consistently " -"delegated to :meth:`object.__init_subclass__`. This means that :meth:`type." -"__new__` and :meth:`type.__init__` both now accept arbitrary keyword " -"arguments, but :meth:`object.__init_subclass__` (which is called from :meth:" -"`type.__new__`) will reject them by default. Custom metaclasses accepting " -"additional keyword arguments will need to adjust their calls to :meth:`type." -"__new__` (whether direct or via :class:`super`) accordingly." +"As part of :pep:`487`, the handling of keyword arguments passed " +"to :class:`type` (other than the metaclass hint, ``metaclass``) is now " +"consistently delegated to :meth:`object.__init_subclass__`. This means " +"that :meth:`type.__new__` and :meth:`type.__init__` both now accept " +"arbitrary keyword arguments, but :meth:`object.__init_subclass__` (which is " +"called from :meth:`type.__new__`) will reject them by default. Custom " +"metaclasses accepting additional keyword arguments will need to adjust their " +"calls to :meth:`type.__new__` (whether direct or via :class:`super`) " +"accordingly." msgstr "" #: ../../whatsnew/3.6.rst:2262 @@ -3337,26 +3352,27 @@ msgstr "" #: ../../whatsnew/3.6.rst:2278 msgid "" -"In the :mod:`urllib.request` module and the :meth:`http.client." -"HTTPConnection.request` method, if no Content-Length header field has been " -"specified and the request body is a file object, it is now sent with HTTP " -"1.1 chunked encoding. If a file object has to be sent to a HTTP 1.0 server, " -"the Content-Length value now has to be specified by the caller. (Contributed " -"by Demian Brecht and Rolf Krahl with tweaks from Martin Panter in :issue:" -"`12319`.)" +"In the :mod:`urllib.request` module and " +"the :meth:`http.client.HTTPConnection.request` method, if no Content-Length " +"header field has been specified and the request body is a file object, it is " +"now sent with HTTP 1.1 chunked encoding. If a file object has to be sent to " +"a HTTP 1.0 server, the Content-Length value now has to be specified by the " +"caller. (Contributed by Demian Brecht and Rolf Krahl with tweaks from Martin " +"Panter in :issue:`12319`.)" msgstr "" #: ../../whatsnew/3.6.rst:2287 msgid "" -"The :class:`~csv.DictReader` now returns rows of type :class:`~collections." -"OrderedDict`. (Contributed by Steve Holden in :issue:`27842`.)" +"The :class:`~csv.DictReader` now returns rows of " +"type :class:`~collections.OrderedDict`. (Contributed by Steve Holden " +"in :issue:`27842`.)" msgstr "" #: ../../whatsnew/3.6.rst:2291 msgid "" -"The :const:`!crypt.METHOD_CRYPT` will no longer be added to ``crypt." -"methods`` if unsupported by the platform. (Contributed by Victor Stinner in :" -"issue:`25287`.)" +"The :const:`!crypt.METHOD_CRYPT` will no longer be added to " +"``crypt.methods`` if unsupported by the platform. (Contributed by Victor " +"Stinner in :issue:`25287`.)" msgstr "" #: ../../whatsnew/3.6.rst:2299 @@ -3375,8 +3391,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:2308 msgid "" "The :func:`mmap.write() <mmap.write>` function now returns the number of " -"bytes written like other write methods. (Contributed by Jakub Stasiak in :" -"issue:`26335`.)" +"bytes written like other write methods. (Contributed by Jakub Stasiak " +"in :issue:`26335`.)" msgstr "" #: ../../whatsnew/3.6.rst:2312 @@ -3401,8 +3417,8 @@ msgid "" "unrecognized compression values. Previously a plain :exc:`RuntimeError` was " "raised. Additionally, calling :class:`~zipfile.ZipFile` methods on a closed " "ZipFile or calling the :meth:`~zipfile.ZipFile.write` method on a ZipFile " -"created with mode ``'r'`` will raise a :exc:`ValueError`. Previously, a :exc:" -"`RuntimeError` was raised in those scenarios." +"created with mode ``'r'`` will raise a :exc:`ValueError`. Previously, " +"a :exc:`RuntimeError` was raised in those scenarios." msgstr "" #: ../../whatsnew/3.6.rst:2329 @@ -3419,13 +3435,14 @@ msgstr "" msgid "" "With the introduction of :exc:`ModuleNotFoundError`, import system consumers " "may start expecting import system replacements to raise that more specific " -"exception when appropriate, rather than the less-specific :exc:" -"`ImportError`. To provide future compatibility with such consumers, " -"implementers of alternative import systems that completely replace :func:" -"`__import__` will need to update their implementations to raise the new " -"subclass when a module can't be found at all. Implementers of compliant " -"plugins to the default import system shouldn't need to make any changes, as " -"the default import system will raise the new subclass when appropriate." +"exception when appropriate, rather than the less-" +"specific :exc:`ImportError`. To provide future compatibility with such " +"consumers, implementers of alternative import systems that completely " +"replace :func:`__import__` will need to update their implementations to " +"raise the new subclass when a module can't be found at all. Implementers of " +"compliant plugins to the default import system shouldn't need to make any " +"changes, as the default import system will raise the new subclass when " +"appropriate." msgstr "" #: ../../whatsnew/3.6.rst:2348 @@ -3467,15 +3484,15 @@ msgstr "" msgid "" "The new :opcode:`!FORMAT_VALUE` and :opcode:`BUILD_STRING` opcodes as part " "of the :ref:`formatted string literal <whatsnew36-pep498>` implementation. " -"(Contributed by Eric Smith in :issue:`25483` and Serhiy Storchaka in :issue:" -"`27078`.)" +"(Contributed by Eric Smith in :issue:`25483` and Serhiy Storchaka " +"in :issue:`27078`.)" msgstr "" #: ../../whatsnew/3.6.rst:2374 msgid "" "The new :opcode:`BUILD_CONST_KEY_MAP` opcode to optimize the creation of " -"dictionaries with constant keys. (Contributed by Serhiy Storchaka in :issue:" -"`27140`.)" +"dictionaries with constant keys. (Contributed by Serhiy Storchaka " +"in :issue:`27140`.)" msgstr "" #: ../../whatsnew/3.6.rst:2378 @@ -3483,11 +3500,11 @@ msgid "" "The function call opcodes have been heavily reworked for better performance " "and simpler implementation. The :opcode:`MAKE_FUNCTION`, :opcode:`!" "CALL_FUNCTION`, :opcode:`!CALL_FUNCTION_KW` and :opcode:`!" -"BUILD_MAP_UNPACK_WITH_CALL` opcodes have been modified, the new :opcode:" -"`CALL_FUNCTION_EX` and :opcode:`!BUILD_TUPLE_UNPACK_WITH_CALL` have been " -"added, and ``CALL_FUNCTION_VAR``, ``CALL_FUNCTION_VAR_KW`` and " -"``MAKE_CLOSURE`` opcodes have been removed. (Contributed by Demur Rumed in :" -"issue:`27095`, and Serhiy Storchaka in :issue:`27213`, :issue:`28257`.)" +"BUILD_MAP_UNPACK_WITH_CALL` opcodes have been modified, the " +"new :opcode:`CALL_FUNCTION_EX` and :opcode:`!BUILD_TUPLE_UNPACK_WITH_CALL` " +"have been added, and ``CALL_FUNCTION_VAR``, ``CALL_FUNCTION_VAR_KW`` and " +"``MAKE_CLOSURE`` opcodes have been removed. (Contributed by Demur Rumed " +"in :issue:`27095`, and Serhiy Storchaka in :issue:`27213`, :issue:`28257`.)" msgstr "" #: ../../whatsnew/3.6.rst:2389 @@ -3522,8 +3539,8 @@ msgstr "" #: ../../whatsnew/3.6.rst:2409 msgid "" -"More selective regeneration targets are also defined - see :source:`Makefile." -"pre.in` for details." +"More selective regeneration targets are also defined - " +"see :source:`Makefile.pre.in` for details." msgstr "" #: ../../whatsnew/3.6.rst:2412 ../../whatsnew/3.6.rst:2425 @@ -3553,8 +3570,8 @@ msgstr "Python 3.6.4 中顯著的變更" msgid "" "The ``PyExc_RecursionErrorInst`` singleton that was part of the public API " "has been removed as its members being never cleared may cause a segfault " -"during finalization of the interpreter. (Contributed by Xavier de Gaye in :" -"issue:`22898` and :issue:`30697`.)" +"during finalization of the interpreter. (Contributed by Xavier de Gaye " +"in :issue:`22898` and :issue:`30697`.)" msgstr "" #: ../../whatsnew/3.6.rst:2440 @@ -3592,12 +3609,12 @@ msgstr "Python 3.6.10 中顯著的變更" #: ../../whatsnew/3.6.rst:2461 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" #: ../../whatsnew/3.6.rst:2469 @@ -3607,13 +3624,14 @@ msgstr "Python 3.6.13 中顯著的變更" #: ../../whatsnew/3.6.rst:2471 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" msgstr "" #: ../../whatsnew/3.6.rst:2482 @@ -3635,6 +3653,6 @@ msgid "" "forms of attacks. Following the WHATWG specification that updates RFC 3986, " "ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are stripped from " "the URL by the parser :func:`urllib.parse` preventing such attacks. The " -"removal characters are controlled by a new module level variable ``urllib." -"parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" +"removal characters are controlled by a new module level variable " +"``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index 9416588394..25a4bd766c 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -29,8 +29,8 @@ msgstr "Elvis Pranskevichus <elvis@magic.io>" #: ../../whatsnew/3.7.rst:47 msgid "" "This article explains the new features in Python 3.7, compared to 3.6. " -"Python 3.7 was released on June 27, 2018. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.7 was released on June 27, 2018. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.7 與 3.6 相比多了哪些新功能。Python 3.7 已於 2018 年 6 " "月 27 日發布。有關完整詳細資訊,請參閱 :ref:`changelog <changelog>`。" @@ -111,8 +111,9 @@ msgstr "標準函式庫中的顯著改進" #: ../../whatsnew/3.7.rst:92 msgid "" -"The :mod:`asyncio` module has received new features, significant :ref:" -"`usability and performance improvements <whatsnew37_asyncio>`." +"The :mod:`asyncio` module has received new features, " +"significant :ref:`usability and performance improvements " +"<whatsnew37_asyncio>`." msgstr "" #: ../../whatsnew/3.7.rst:95 @@ -123,7 +124,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:98 msgid "CPython implementation improvements:" -msgstr "" +msgstr "CPython 實作改進:" #: ../../whatsnew/3.7.rst:100 msgid "Avoiding the use of ASCII as a default text encoding:" @@ -170,14 +171,14 @@ msgstr "" #: ../../whatsnew/3.7.rst:116 msgid "" "New documentation translations: `Japanese <https://docs.python.org/ja/>`_, " -"`French <https://docs.python.org/fr/>`_, and `Korean <https://docs.python." -"org/ko/>`_." +"`French <https://docs.python.org/fr/>`_, and `Korean <https://" +"docs.python.org/ko/>`_." msgstr "" #: ../../whatsnew/3.7.rst:120 msgid "" -"This release features notable performance improvements in many areas. The :" -"ref:`whatsnew37-perf` section lists them in detail." +"This release features notable performance improvements in many areas. " +"The :ref:`whatsnew37-perf` section lists them in detail." msgstr "" #: ../../whatsnew/3.7.rst:123 @@ -192,7 +193,7 @@ msgstr "新增功能" #: ../../whatsnew/3.7.rst:133 msgid "PEP 563: Postponed Evaluation of Annotations" -msgstr "" +msgstr "PEP 563:延後評估註釋" #: ../../whatsnew/3.7.rst:135 msgid "" @@ -295,9 +296,9 @@ msgid "" "automatically coerce that locale to an available UTF-8 based locale as " "described in the documentation of the new :envvar:`PYTHONCOERCECLOCALE` " "environment variable. Automatically setting ``LC_CTYPE`` this way means that " -"both the core interpreter and locale-aware C extensions (such as :mod:" -"`readline`) will assume the use of UTF-8 as the default text encoding, " -"rather than ASCII." +"both the core interpreter and locale-aware C extensions (such " +"as :mod:`readline`) will assume the use of UTF-8 as the default text " +"encoding, rather than ASCII." msgstr "" #: ../../whatsnew/3.7.rst:200 @@ -310,16 +311,17 @@ msgstr "" msgid "" "As part of this change, the default error handler for :data:`~sys.stdin` " "and :data:`~sys.stdout` is now ``surrogateescape`` (rather than ``strict``) " -"when using any of the defined coercion target locales (currently ``C." -"UTF-8``, ``C.utf8``, and ``UTF-8``). The default error handler for :data:" -"`~sys.stderr` continues to be ``backslashreplace``, regardless of locale." +"when using any of the defined coercion target locales (currently " +"``C.UTF-8``, ``C.utf8``, and ``UTF-8``). The default error handler " +"for :data:`~sys.stderr` continues to be ``backslashreplace``, regardless of " +"locale." msgstr "" #: ../../whatsnew/3.7.rst:209 msgid "" "Locale coercion is silent by default, but to assist in debugging potentially " -"locale related integration problems, explicit warnings (emitted directly on :" -"data:`~sys.stderr`) can be requested by setting " +"locale related integration problems, explicit warnings (emitted directly " +"on :data:`~sys.stderr`) can be requested by setting " "``PYTHONCOERCECLOCALE=warn``. This setting will also cause the Python " "runtime to emit a warning if the legacy C locale remains active when the " "core interpreter is initialized." @@ -358,8 +360,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:238 msgid "" "When in UTF-8 mode, CPython ignores the locale settings, and uses the UTF-8 " -"encoding by default. The error handlers for :data:`sys.stdin` and :data:" -"`sys.stdout` streams are set to ``surrogateescape``." +"encoding by default. The error handlers for :data:`sys.stdin` " +"and :data:`sys.stdout` streams are set to ``surrogateescape``." msgstr "" #: ../../whatsnew/3.7.rst:242 @@ -410,9 +412,10 @@ msgid "" "Built-in ``breakpoint()`` calls :func:`sys.breakpointhook`. By default, the " "latter imports :mod:`pdb` and then calls ``pdb.set_trace()``, but by binding " "``sys.breakpointhook()`` to the function of your choosing, ``breakpoint()`` " -"can enter any debugger. Additionally, the environment variable :envvar:" -"`PYTHONBREAKPOINT` can be set to the callable of your debugger of choice. " -"Set ``PYTHONBREAKPOINT=0`` to completely disable built-in ``breakpoint()``." +"can enter any debugger. Additionally, the environment " +"variable :envvar:`PYTHONBREAKPOINT` can be set to the callable of your " +"debugger of choice. Set ``PYTHONBREAKPOINT=0`` to completely disable built-" +"in ``breakpoint()``." msgstr "" #: ../../whatsnew/3.7.rst:282 @@ -441,11 +444,11 @@ msgid "" ":pep:`539` changes this by providing a new :ref:`Thread Specific Storage " "(TSS) API <thread-specific-storage-api>` to CPython which supersedes use of " "the existing TLS API within the CPython interpreter, while deprecating the " -"existing API. The TSS API uses a new type :c:type:`Py_tss_t` instead of :c:" -"expr:`int` to represent TSS keys--an opaque type the definition of which may " -"depend on the underlying TLS implementation. Therefore, this will allow to " -"build CPython on platforms where the native TLS key is defined in a way that " -"cannot be safely cast to :c:expr:`int`." +"existing API. The TSS API uses a new type :c:type:`Py_tss_t` instead " +"of :c:expr:`int` to represent TSS keys--an opaque type the definition of " +"which may depend on the underlying TLS implementation. Therefore, this will " +"allow to build CPython on platforms where the native TLS key is defined in a " +"way that cannot be safely cast to :c:expr:`int`." msgstr "" #: ../../whatsnew/3.7.rst:306 @@ -472,8 +475,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:323 msgid "" "Python 3.7 allows defining :meth:`__getattr__` on modules and will call it " -"whenever a module attribute is otherwise not found. Defining :meth:" -"`__dir__` on modules is now also allowed." +"whenever a module attribute is otherwise not found. " +"Defining :meth:`__dir__` on modules is now also allowed." msgstr "" #: ../../whatsnew/3.7.rst:327 @@ -587,10 +590,11 @@ msgstr "" #: ../../whatsnew/3.7.rst:393 msgid "" -"Previously both :exc:`DeprecationWarning` and :exc:" -"`PendingDeprecationWarning` were only visible when running tests, which " -"meant that developers primarily writing single file scripts or using Python " -"interactively could be surprised by breaking changes in the APIs they used." +"Previously both :exc:`DeprecationWarning` " +"and :exc:`PendingDeprecationWarning` were only visible when running tests, " +"which meant that developers primarily writing single file scripts or using " +"Python interactively could be surprised by breaking changes in the APIs they " +"used." msgstr "" #: ../../whatsnew/3.7.rst:400 @@ -608,14 +612,14 @@ msgstr "" #: ../../whatsnew/3.7.rst:409 msgid "" "Initially :pep:`484` was designed in such way that it would not introduce " -"*any* changes to the core CPython interpreter. Now type hints and the :mod:" -"`typing` module are extensively used by the community, so this restriction " -"is removed. The PEP introduces two special methods :meth:`__class_getitem__` " -"and ``__mro_entries__``, these methods are now used by most classes and " -"special constructs in :mod:`typing`. As a result, the speed of various " -"operations with types increased up to 7 times, the generic types can be used " -"without metaclass conflicts, and several long standing bugs in :mod:`typing` " -"module are fixed." +"*any* changes to the core CPython interpreter. Now type hints and " +"the :mod:`typing` module are extensively used by the community, so this " +"restriction is removed. The PEP introduces two special " +"methods :meth:`__class_getitem__` and ``__mro_entries__``, these methods are " +"now used by most classes and special constructs in :mod:`typing`. As a " +"result, the speed of various operations with types increased up to 7 times, " +"the generic types can be used without metaclass conflicts, and several long " +"standing bugs in :mod:`typing` module are fixed." msgstr "" #: ../../whatsnew/3.7.rst:421 @@ -644,8 +648,8 @@ msgid "" "used for invalidation instead of the source timestamp. Such ``.pyc`` files " "are called \"hash-based\". By default, Python still uses timestamp-based " "invalidation and does not generate hash-based ``.pyc`` files at runtime. " -"Hash-based ``.pyc`` files may be generated with :mod:`py_compile` or :mod:" -"`compileall`." +"Hash-based ``.pyc`` files may be generated with :mod:`py_compile` " +"or :mod:`compileall`." msgstr "" #: ../../whatsnew/3.7.rst:445 @@ -712,12 +716,12 @@ msgstr "" #: ../../whatsnew/3.7.rst:486 msgid "" -"The new :option:`-X` ``dev`` command line option or the new :envvar:" -"`PYTHONDEVMODE` environment variable can be used to enable :ref:`Python " -"Development Mode <devmode>`. When in development mode, Python performs " -"additional runtime checks that are too expensive to be enabled by default. " -"See :ref:`Python Development Mode <devmode>` documentation for the full " -"description." +"The new :option:`-X` ``dev`` command line option or the " +"new :envvar:`PYTHONDEVMODE` environment variable can be used to " +"enable :ref:`Python Development Mode <devmode>`. When in development mode, " +"Python performs additional runtime checks that are too expensive to be " +"enabled by default. See :ref:`Python Development Mode <devmode>` " +"documentation for the full description." msgstr "" #: ../../whatsnew/3.7.rst:495 @@ -726,17 +730,17 @@ msgstr "其他語言更動" #: ../../whatsnew/3.7.rst:497 msgid "" -"An :keyword:`await` expression and comprehensions containing an :keyword:" -"`async for` clause were illegal in the expressions in :ref:`formatted string " -"literals <f-strings>` due to a problem with the implementation. In Python " -"3.7 this restriction was lifted." +"An :keyword:`await` expression and comprehensions containing " +"an :keyword:`async for` clause were illegal in the expressions " +"in :ref:`formatted string literals <f-strings>` due to a problem with the " +"implementation. In Python 3.7 this restriction was lifted." msgstr "" #: ../../whatsnew/3.7.rst:502 msgid "" "More than 255 arguments can now be passed to a function, and a function can " -"now have more than 255 parameters. (Contributed by Serhiy Storchaka in :" -"issue:`12844` and :issue:`18896`.)" +"now have more than 255 parameters. (Contributed by Serhiy Storchaka " +"in :issue:`12844` and :issue:`18896`.)" msgstr "" #: ../../whatsnew/3.7.rst:506 @@ -756,8 +760,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:514 msgid "" ":exc:`ImportError` now displays module name and module ``__file__`` path " -"when ``from ... import ...`` fails. (Contributed by Matthias Bussonnier in :" -"issue:`29546`.)" +"when ``from ... import ...`` fails. (Contributed by Matthias Bussonnier " +"in :issue:`29546`.)" msgstr "" #: ../../whatsnew/3.7.rst:518 @@ -769,16 +773,17 @@ msgstr "" #: ../../whatsnew/3.7.rst:522 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " -"``format(str(self), '')``. (Contributed by Serhiy Storchaka in :issue:" -"`28974`.)" +"``format(str(self), '')``. (Contributed by Serhiy Storchaka " +"in :issue:`28974`.)" msgstr "" #: ../../whatsnew/3.7.rst:526 msgid "" -"In order to better support dynamic creation of stack traces, :class:`types." -"TracebackType` can now be instantiated from Python code, and the :attr:" -"`~traceback.tb_next` attribute on :ref:`tracebacks <traceback-objects>` is " -"now writable. (Contributed by Nathaniel J. Smith in :issue:`30579`.)" +"In order to better support dynamic creation of stack " +"traces, :class:`types.TracebackType` can now be instantiated from Python " +"code, and the :attr:`~traceback.tb_next` attribute on :ref:`tracebacks " +"<traceback-objects>` is now writable. (Contributed by Nathaniel J. Smith " +"in :issue:`30579`.)" msgstr "" #: ../../whatsnew/3.7.rst:532 @@ -791,9 +796,10 @@ msgstr "" #: ../../whatsnew/3.7.rst:538 msgid "" -"The new :option:`-X` ``importtime`` option or the :envvar:" -"`PYTHONPROFILEIMPORTTIME` environment variable can be used to show the " -"timing of each module import. (Contributed by Inada Naoki in :issue:`31415`.)" +"The new :option:`-X` ``importtime`` option or " +"the :envvar:`PYTHONPROFILEIMPORTTIME` environment variable can be used to " +"show the timing of each module import. (Contributed by Inada Naoki " +"in :issue:`31415`.)" msgstr "" #: ../../whatsnew/3.7.rst:545 @@ -836,9 +842,9 @@ msgstr "dataclasses" msgid "" "The new :func:`~dataclasses.dataclass` decorator provides a way to declare " "*data classes*. A data class describes its attributes using class variable " -"annotations. Its constructor and other magic methods, such as :meth:" -"`~object.__repr__`, :meth:`~object.__eq__`, and :meth:`~object.__hash__` are " -"generated automatically." +"annotations. Its constructor and other magic methods, such " +"as :meth:`~object.__repr__`, :meth:`~object.__eq__`, " +"and :meth:`~object.__hash__` are generated automatically." msgstr "" #: ../../whatsnew/3.7.rst:580 @@ -874,10 +880,10 @@ msgid "" "The new :mod:`importlib.resources` module provides several new APIs and one " "new ABC for access to, opening, and reading *resources* inside packages. " "Resources are roughly similar to files inside packages, but they needn't be " -"actual files on the physical file system. Module loaders can provide a :" -"meth:`get_resource_reader` function which returns a :class:`importlib.abc." -"ResourceReader` instance to support this new API. Built-in file path " -"loaders and zip file loaders both support this." +"actual files on the physical file system. Module loaders can provide " +"a :meth:`get_resource_reader` function which returns " +"a :class:`importlib.abc.ResourceReader` instance to support this new API. " +"Built-in file path loaders and zip file loaders both support this." msgstr "" #: ../../whatsnew/3.7.rst:610 @@ -900,9 +906,9 @@ msgstr "argparse" #: ../../whatsnew/3.7.rst:625 msgid "" -"The new :meth:`ArgumentParser.parse_intermixed_args() <argparse." -"ArgumentParser.parse_intermixed_args>` method allows intermixing options and " -"positional arguments. (Contributed by paul.j3 in :issue:`14191`.)" +"The new :meth:`ArgumentParser.parse_intermixed_args() " +"<argparse.ArgumentParser.parse_intermixed_args>` method allows intermixing " +"options and positional arguments. (Contributed by paul.j3 in :issue:`14191`.)" msgstr "" #: ../../whatsnew/3.7.rst:634 ../../whatsnew/3.7.rst:1964 @@ -911,29 +917,29 @@ msgstr "asyncio" #: ../../whatsnew/3.7.rst:636 msgid "" -"The :mod:`asyncio` module has received many new features, usability and :ref:" -"`performance improvements <whatsnew37-asyncio-perf>`. Notable changes " -"include:" +"The :mod:`asyncio` module has received many new features, usability " +"and :ref:`performance improvements <whatsnew37-asyncio-perf>`. Notable " +"changes include:" msgstr "" #: ../../whatsnew/3.7.rst:640 msgid "" "The new :term:`provisional <provisional API>` :func:`asyncio.run` function " "can be used to run a coroutine from synchronous code by automatically " -"creating and destroying the event loop. (Contributed by Yury Selivanov in :" -"issue:`32314`.)" +"creating and destroying the event loop. (Contributed by Yury Selivanov " +"in :issue:`32314`.)" msgstr "" #: ../../whatsnew/3.7.rst:645 msgid "" "asyncio gained support for :mod:`contextvars`. :meth:`loop.call_soon() " -"<asyncio.loop.call_soon>`, :meth:`loop.call_soon_threadsafe() <asyncio.loop." -"call_soon_threadsafe>`, :meth:`loop.call_later() <asyncio.loop." -"call_later>`, :meth:`loop.call_at() <asyncio.loop.call_at>`, and :meth:" -"`Future.add_done_callback() <asyncio.Future.add_done_callback>` have a new " -"optional keyword-only *context* parameter. :class:`Tasks <asyncio.Task>` now " -"track their context automatically. See :pep:`567` for more details. " -"(Contributed by Yury Selivanov in :issue:`32436`.)" +"<asyncio.loop.call_soon>`, :meth:`loop.call_soon_threadsafe() " +"<asyncio.loop.call_soon_threadsafe>`, :meth:`loop.call_later() " +"<asyncio.loop.call_later>`, :meth:`loop.call_at() <asyncio.loop.call_at>`, " +"and :meth:`Future.add_done_callback() <asyncio.Future.add_done_callback>` " +"have a new optional keyword-only *context* parameter. :class:`Tasks " +"<asyncio.Task>` now track their context automatically. See :pep:`567` for " +"more details. (Contributed by Yury Selivanov in :issue:`32436`.)" msgstr "" #: ../../whatsnew/3.7.rst:656 @@ -946,25 +952,26 @@ msgstr "" #: ../../whatsnew/3.7.rst:660 msgid "" "The new :meth:`loop.start_tls() <asyncio.loop.start_tls>` method can be used " -"to upgrade an existing connection to TLS. (Contributed by Yury Selivanov in :" -"issue:`23749`.)" +"to upgrade an existing connection to TLS. (Contributed by Yury Selivanov " +"in :issue:`23749`.)" msgstr "" #: ../../whatsnew/3.7.rst:664 msgid "" "The new :meth:`loop.sock_recv_into() <asyncio.loop.sock_recv_into>` method " "allows reading data from a socket directly into a provided buffer making it " -"possible to reduce data copies. (Contributed by Antoine Pitrou in :issue:" -"`31819`.)" +"possible to reduce data copies. (Contributed by Antoine Pitrou " +"in :issue:`31819`.)" msgstr "" #: ../../whatsnew/3.7.rst:669 msgid "" -"The new :func:`asyncio.current_task` function returns the currently running :" -"class:`~asyncio.Task` instance, and the new :func:`asyncio.all_tasks` " -"function returns a set of all existing ``Task`` instances in a given loop. " -"The :meth:`!Task.current_task` and :meth:`!Task.all_tasks` methods have been " -"deprecated. (Contributed by Andrew Svetlov in :issue:`32250`.)" +"The new :func:`asyncio.current_task` function returns the currently " +"running :class:`~asyncio.Task` instance, and the " +"new :func:`asyncio.all_tasks` function returns a set of all existing " +"``Task`` instances in a given loop. The :meth:`!Task.current_task` " +"and :meth:`!Task.all_tasks` methods have been deprecated. (Contributed by " +"Andrew Svetlov in :issue:`32250`.)" msgstr "" #: ../../whatsnew/3.7.rst:676 @@ -979,17 +986,17 @@ msgid "" "The new :func:`asyncio.get_running_loop` function returns the currently " "running loop, and raises a :exc:`RuntimeError` if no loop is running. This " "is in contrast with :func:`asyncio.get_event_loop`, which will *create* a " -"new event loop if none is running. (Contributed by Yury Selivanov in :issue:" -"`32269`.)" +"new event loop if none is running. (Contributed by Yury Selivanov " +"in :issue:`32269`.)" msgstr "" #: ../../whatsnew/3.7.rst:686 msgid "" -"The new :meth:`StreamWriter.wait_closed() <asyncio.StreamWriter." -"wait_closed>` coroutine method allows waiting until the stream writer is " -"closed. The new :meth:`StreamWriter.is_closing() <asyncio.StreamWriter." -"is_closing>` method can be used to determine if the writer is closing. " -"(Contributed by Andrew Svetlov in :issue:`32391`.)" +"The new :meth:`StreamWriter.wait_closed() " +"<asyncio.StreamWriter.wait_closed>` coroutine method allows waiting until " +"the stream writer is closed. The new :meth:`StreamWriter.is_closing() " +"<asyncio.StreamWriter.is_closing>` method can be used to determine if the " +"writer is closing. (Contributed by Andrew Svetlov in :issue:`32391`.)" msgstr "" #: ../../whatsnew/3.7.rst:692 @@ -1001,27 +1008,27 @@ msgstr "" #: ../../whatsnew/3.7.rst:696 msgid "" -"The new :meth:`Future.get_loop() <asyncio.Future.get_loop>` and ``Task." -"get_loop()`` methods return the instance of the loop on which a task or a " -"future were created. :meth:`Server.get_loop() <asyncio.Server.get_loop>` " -"allows doing the same for :class:`asyncio.Server` objects. (Contributed by " -"Yury Selivanov in :issue:`32415` and Srinivas Reddy Thatiparthy in :issue:" -"`32418`.)" +"The new :meth:`Future.get_loop() <asyncio.Future.get_loop>` and " +"``Task.get_loop()`` methods return the instance of the loop on which a task " +"or a future were created. :meth:`Server.get_loop() " +"<asyncio.Server.get_loop>` allows doing the same for :class:`asyncio.Server` " +"objects. (Contributed by Yury Selivanov in :issue:`32415` and Srinivas Reddy " +"Thatiparthy in :issue:`32418`.)" msgstr "" #: ../../whatsnew/3.7.rst:704 msgid "" "It is now possible to control how instances of :class:`asyncio.Server` begin " "serving. Previously, the server would start serving immediately when " -"created. The new *start_serving* keyword argument to :meth:`loop." -"create_server() <asyncio.loop.create_server>` and :meth:`loop." -"create_unix_server() <asyncio.loop.create_unix_server>`, as well as :meth:" -"`Server.start_serving() <asyncio.Server.start_serving>`, and :meth:`Server." -"serve_forever() <asyncio.Server.serve_forever>` can be used to decouple " -"server instantiation and serving. The new :meth:`Server.is_serving() " -"<asyncio.Server.is_serving>` method returns ``True`` if the server is " -"serving. :class:`~asyncio.Server` objects are now asynchronous context " -"managers::" +"created. The new *start_serving* keyword argument " +"to :meth:`loop.create_server() <asyncio.loop.create_server>` " +"and :meth:`loop.create_unix_server() <asyncio.loop.create_unix_server>`, as " +"well as :meth:`Server.start_serving() <asyncio.Server.start_serving>`, " +"and :meth:`Server.serve_forever() <asyncio.Server.serve_forever>` can be " +"used to decouple server instantiation and serving. The " +"new :meth:`Server.is_serving() <asyncio.Server.is_serving>` method returns " +"``True`` if the server is serving. :class:`~asyncio.Server` objects are now " +"asynchronous context managers::" msgstr "" #: ../../whatsnew/3.7.rst:716 @@ -1040,27 +1047,27 @@ msgstr "(由 Yury Selivanov 在 :issue:`32662` 中貢獻。)" #: ../../whatsnew/3.7.rst:725 msgid "" -"Callback objects returned by :func:`loop.call_later() <asyncio.loop." -"call_later>` gained the new :meth:`when() <asyncio.TimerHandle.when>` method " -"which returns an absolute scheduled callback timestamp. (Contributed by " -"Andrew Svetlov in :issue:`32741`.)" +"Callback objects returned by :func:`loop.call_later() " +"<asyncio.loop.call_later>` gained the new :meth:`when() " +"<asyncio.TimerHandle.when>` method which returns an absolute scheduled " +"callback timestamp. (Contributed by Andrew Svetlov in :issue:`32741`.)" msgstr "" #: ../../whatsnew/3.7.rst:731 msgid "" -"The :meth:`loop.create_datagram_endpoint() \\ <asyncio.loop." -"create_datagram_endpoint>` method gained support for Unix sockets. " -"(Contributed by Quentin Dawans in :issue:`31245`.)" +"The :meth:`loop.create_datagram_endpoint() \\ " +"<asyncio.loop.create_datagram_endpoint>` method gained support for Unix " +"sockets. (Contributed by Quentin Dawans in :issue:`31245`.)" msgstr "" #: ../../whatsnew/3.7.rst:736 msgid "" "The :func:`asyncio.open_connection`, :func:`asyncio.start_server` " -"functions, :meth:`loop.create_connection() <asyncio.loop." -"create_connection>`, :meth:`loop.create_server() <asyncio.loop." -"create_server>`, :meth:`loop.create_accepted_socket() <asyncio.loop." -"connect_accepted_socket>` methods and their corresponding UNIX socket " -"variants now accept the *ssl_handshake_timeout* keyword argument. " +"functions, :meth:`loop.create_connection() " +"<asyncio.loop.create_connection>`, :meth:`loop.create_server() " +"<asyncio.loop.create_server>`, :meth:`loop.create_accepted_socket() " +"<asyncio.loop.connect_accepted_socket>` methods and their corresponding UNIX " +"socket variants now accept the *ssl_handshake_timeout* keyword argument. " "(Contributed by Neil Aspinall in :issue:`29970`.)" msgstr "" @@ -1073,32 +1080,35 @@ msgstr "" #: ../../whatsnew/3.7.rst:748 msgid "" -"The asyncio source has been converted to use the :keyword:`async`/:keyword:" -"`await` syntax. (Contributed by Andrew Svetlov in :issue:`32193`.)" +"The asyncio source has been converted to use " +"the :keyword:`async`/:keyword:`await` syntax. (Contributed by Andrew Svetlov " +"in :issue:`32193`.)" msgstr "" #: ../../whatsnew/3.7.rst:752 msgid "" -"The new :meth:`ReadTransport.is_reading() <asyncio.ReadTransport." -"is_reading>` method can be used to determine the reading state of the " -"transport. Additionally, calls to :meth:`ReadTransport.resume_reading() " -"<asyncio.ReadTransport.resume_reading>` and :meth:`ReadTransport." -"pause_reading() <asyncio.ReadTransport.pause_reading>` are now idempotent. " -"(Contributed by Yury Selivanov in :issue:`32356`.)" +"The new :meth:`ReadTransport.is_reading() " +"<asyncio.ReadTransport.is_reading>` method can be used to determine the " +"reading state of the transport. Additionally, calls " +"to :meth:`ReadTransport.resume_reading() " +"<asyncio.ReadTransport.resume_reading>` " +"and :meth:`ReadTransport.pause_reading() " +"<asyncio.ReadTransport.pause_reading>` are now idempotent. (Contributed by " +"Yury Selivanov in :issue:`32356`.)" msgstr "" #: ../../whatsnew/3.7.rst:760 msgid "" "Loop methods which accept socket paths now support passing :term:`path-like " -"objects <path-like object>`. (Contributed by Yury Selivanov in :issue:" -"`32066`.)" +"objects <path-like object>`. (Contributed by Yury Selivanov " +"in :issue:`32066`.)" msgstr "" #: ../../whatsnew/3.7.rst:764 msgid "" "In :mod:`asyncio` TCP sockets on Linux are now created with ``TCP_NODELAY`` " -"flag set by default. (Contributed by Yury Selivanov and Victor Stinner in :" -"issue:`27456`.)" +"flag set by default. (Contributed by Yury Selivanov and Victor Stinner " +"in :issue:`27456`.)" msgstr "" #: ../../whatsnew/3.7.rst:768 @@ -1171,8 +1181,8 @@ msgstr "concurrent.futures" #: ../../whatsnew/3.7.rst:816 msgid "" -":class:`ProcessPoolExecutor <concurrent.futures.ProcessPoolExecutor>` and :" -"class:`ThreadPoolExecutor <concurrent.futures.ThreadPoolExecutor>` now " +":class:`ProcessPoolExecutor <concurrent.futures.ProcessPoolExecutor>` " +"and :class:`ThreadPoolExecutor <concurrent.futures.ThreadPoolExecutor>` now " "support the new *initializer* and *initargs* constructor arguments. " "(Contributed by Antoine Pitrou in :issue:`21423`.)" msgstr "" @@ -1197,11 +1207,12 @@ msgstr "" #: ../../whatsnew/3.7.rst:833 msgid "" -"The new :func:`~contextlib.asynccontextmanager`, :class:`~contextlib." -"AbstractAsyncContextManager`, and :class:`~contextlib.AsyncExitStack` have " -"been added to complement their synchronous counterparts. (Contributed by " -"Jelle Zijlstra in :issue:`29679` and :issue:`30241`, and by Alexander Mohr " -"and Ilya Kulakov in :issue:`29302`.)" +"The " +"new :func:`~contextlib.asynccontextmanager`, :class:`~contextlib.AbstractAsyncContextManager`, " +"and :class:`~contextlib.AsyncExitStack` have been added to complement their " +"synchronous counterparts. (Contributed by Jelle Zijlstra in :issue:`29679` " +"and :issue:`30241`, and by Alexander Mohr and Ilya Kulakov " +"in :issue:`29302`.)" msgstr "" #: ../../whatsnew/3.7.rst:842 @@ -1211,8 +1222,8 @@ msgstr "cProfile" #: ../../whatsnew/3.7.rst:844 msgid "" "The :mod:`cProfile` command line now accepts ``-m module_name`` as an " -"alternative to script path. (Contributed by Sanyam Khurana in :issue:" -"`21862`.)" +"alternative to script path. (Contributed by Sanyam Khurana " +"in :issue:`21862`.)" msgstr "" #: ../../whatsnew/3.7.rst:849 @@ -1239,8 +1250,9 @@ msgstr "datetime" msgid "" "The new :meth:`datetime.fromisoformat() <datetime.datetime.fromisoformat>` " "method constructs a :class:`~datetime.datetime` object from a string in one " -"of the formats output by :meth:`datetime.isoformat() <datetime.datetime." -"isoformat>`. (Contributed by Paul Ganssle in :issue:`15873`.)" +"of the formats output by :meth:`datetime.isoformat() " +"<datetime.datetime.isoformat>`. (Contributed by Paul Ganssle " +"in :issue:`15873`.)" msgstr "" #: ../../whatsnew/3.7.rst:867 @@ -1266,8 +1278,8 @@ msgstr "decimal" #: ../../whatsnew/3.7.rst:881 msgid "" "The :mod:`decimal` module now uses :ref:`context variables <whatsnew37-" -"pep567>` to store the decimal context. (Contributed by Yury Selivanov in :" -"issue:`32630`.)" +"pep567>` to store the decimal context. (Contributed by Yury Selivanov " +"in :issue:`32630`.)" msgstr "" #: ../../whatsnew/3.7.rst:887 @@ -1336,8 +1348,8 @@ msgid "" "be used before a POSIX ``fork()`` call to make the GC copy-on-write friendly " "or to speed up collection. The new :func:`gc.unfreeze` functions reverses " "this operation. Additionally, :func:`gc.get_freeze_count` can be used to " -"obtain the number of frozen objects. (Contributed by Li Zekun in :issue:" -"`31558`.)" +"obtain the number of frozen objects. (Contributed by Li Zekun " +"in :issue:`31558`.)" msgstr "" #: ../../whatsnew/3.7.rst:942 @@ -1357,9 +1369,10 @@ msgstr "http.client" #: ../../whatsnew/3.7.rst:952 msgid "" -":class:`~http.client.HTTPConnection` and :class:`~http.client." -"HTTPSConnection` now support the new *blocksize* argument for improved " -"upload throughput. (Contributed by Nir Soffer in :issue:`31945`.)" +":class:`~http.client.HTTPConnection` " +"and :class:`~http.client.HTTPSConnection` now support the new *blocksize* " +"argument for improved upload throughput. (Contributed by Nir Soffer " +"in :issue:`31945`.)" msgstr "" #: ../../whatsnew/3.7.rst:958 @@ -1397,8 +1410,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:980 msgid "" -"Multiple fixes for autocompletion. (Contributed by Louie Lu in :issue:" -"`15786`.)" +"Multiple fixes for autocompletion. (Contributed by Louie Lu " +"in :issue:`15786`.)" msgstr "" #: ../../whatsnew/3.7.rst:982 @@ -1437,8 +1450,8 @@ msgid "" "Editor code context option revised. Box displays all context lines up to " "maxlines. Clicking on a context line jumps the editor to that line. " "Context colors for custom themes is added to Highlights tab of Settings " -"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy in :issue:" -"`33642`, :issue:`33768`, and :issue:`33679`.)" +"dialog. (Contributed by Cheryl Sabella and Terry Jan Reedy " +"in :issue:`33642`, :issue:`33768`, and :issue:`33679`.)" msgstr "" #: ../../whatsnew/3.7.rst:1009 @@ -1490,8 +1503,8 @@ msgid "" "Add optional line numbers for IDLE editor windows. Windows open without line " "numbers unless set otherwise in the General tab of the configuration " "dialog. Line numbers for an existing window are shown and hidden in the " -"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar in :issue:" -"`17535`.)" +"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar " +"in :issue:`17535`.)" msgstr "" #: ../../whatsnew/3.7.rst:1044 ../../whatsnew/3.7.rst:2017 @@ -1501,9 +1514,9 @@ msgstr "importlib" #: ../../whatsnew/3.7.rst:1046 msgid "" "The :class:`importlib.abc.ResourceReader` ABC was introduced to support the " -"loading of resources from packages. See also :ref:" -"`whatsnew37_importlib_resources`. (Contributed by Barry Warsaw, Brett Cannon " -"in :issue:`32248`.)" +"loading of resources from packages. See " +"also :ref:`whatsnew37_importlib_resources`. (Contributed by Barry Warsaw, " +"Brett Cannon in :issue:`32248`.)" msgstr "" #: ../../whatsnew/3.7.rst:1051 @@ -1515,9 +1528,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1055 msgid "" ":func:`importlib.find_spec` now raises :exc:`ModuleNotFoundError` instead " -"of :exc:`AttributeError` if the specified parent module is not a package (i." -"e. lacks a ``__path__`` attribute). (Contributed by Milan Oberkirch in :" -"issue:`30436`.)" +"of :exc:`AttributeError` if the specified parent module is not a package " +"(i.e. lacks a ``__path__`` attribute). (Contributed by Milan Oberkirch " +"in :issue:`30436`.)" msgstr "" #: ../../whatsnew/3.7.rst:1060 @@ -1535,8 +1548,8 @@ msgstr "io" msgid "" "The new :meth:`TextIOWrapper.reconfigure() <io.TextIOWrapper.reconfigure>` " "method can be used to reconfigure the text stream with the new settings. " -"(Contributed by Antoine Pitrou in :issue:`30526` and INADA Naoki in :issue:" -"`15216`.)" +"(Contributed by Antoine Pitrou in :issue:`30526` and INADA Naoki " +"in :issue:`15216`.)" msgstr "" #: ../../whatsnew/3.7.rst:1075 @@ -1545,10 +1558,10 @@ msgstr "ipaddress" #: ../../whatsnew/3.7.rst:1077 msgid "" -"The new ``subnet_of()`` and ``supernet_of()`` methods of :class:`ipaddress." -"IPv6Network` and :class:`ipaddress.IPv4Network` can be used for network " -"containment tests. (Contributed by Michel Albert and Cheryl Sabella in :" -"issue:`20825`.)" +"The new ``subnet_of()`` and ``supernet_of()`` methods " +"of :class:`ipaddress.IPv6Network` and :class:`ipaddress.IPv4Network` can be " +"used for network containment tests. (Contributed by Michel Albert and Cheryl " +"Sabella in :issue:`20825`.)" msgstr "" #: ../../whatsnew/3.7.rst:1084 @@ -1557,9 +1570,9 @@ msgstr "itertools" #: ../../whatsnew/3.7.rst:1086 msgid "" -":func:`itertools.islice` now accepts :meth:`integer-like objects <object." -"__index__>` as start, stop, and slice arguments. (Contributed by Will " -"Roberts in :issue:`30537`.)" +":func:`itertools.islice` now accepts :meth:`integer-like objects " +"<object.__index__>` as start, stop, and slice arguments. (Contributed by " +"Will Roberts in :issue:`30537`.)" msgstr "" #: ../../whatsnew/3.7.rst:1093 ../../whatsnew/3.7.rst:2035 @@ -1678,16 +1691,16 @@ msgstr "" #: ../../whatsnew/3.7.rst:1168 msgid "" "The new :func:`~os.register_at_fork` function allows registering Python " -"callbacks to be executed at process fork. (Contributed by Antoine Pitrou in :" -"issue:`16500`.)" +"callbacks to be executed at process fork. (Contributed by Antoine Pitrou " +"in :issue:`16500`.)" msgstr "" #: ../../whatsnew/3.7.rst:1172 msgid "" -"Added :func:`os.preadv` (combine the functionality of :func:`os.readv` and :" -"func:`os.pread`) and :func:`os.pwritev` functions (combine the functionality " -"of :func:`os.writev` and :func:`os.pwrite`). (Contributed by Pablo Galindo " -"in :issue:`31368`.)" +"Added :func:`os.preadv` (combine the functionality of :func:`os.readv` " +"and :func:`os.pread`) and :func:`os.pwritev` functions (combine the " +"functionality of :func:`os.writev` and :func:`os.pwrite`). (Contributed by " +"Pablo Galindo in :issue:`31368`.)" msgstr "" #: ../../whatsnew/3.7.rst:1177 @@ -1705,9 +1718,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1185 msgid "" -"The structure returned by :func:`os.stat` now contains the :attr:`~os." -"stat_result.st_fstype` attribute on Solaris and its derivatives. " -"(Contributed by Jesús Cea Avión in :issue:`32659`.)" +"The structure returned by :func:`os.stat` now contains " +"the :attr:`~os.stat_result.st_fstype` attribute on Solaris and its " +"derivatives. (Contributed by Jesús Cea Avión in :issue:`32659`.)" msgstr "" #: ../../whatsnew/3.7.rst:1191 @@ -1747,9 +1760,9 @@ msgid "" ":func:`py_compile.compile` -- and by extension, :mod:`compileall` -- now " "respects the :envvar:`SOURCE_DATE_EPOCH` environment variable by " "unconditionally creating ``.pyc`` files for hash-based validation. This " -"allows for guaranteeing `reproducible builds <https://reproducible-builds." -"org/>`_ of ``.pyc`` files when they are created eagerly. (Contributed by " -"Bernhard M. Wiedemann in :issue:`29708`.)" +"allows for guaranteeing `reproducible builds <https://reproducible-" +"builds.org/>`_ of ``.pyc`` files when they are created eagerly. (Contributed " +"by Bernhard M. Wiedemann in :issue:`29708`.)" msgstr "" #: ../../whatsnew/3.7.rst:1222 @@ -1759,8 +1772,8 @@ msgstr "pydoc" #: ../../whatsnew/3.7.rst:1224 msgid "" "The pydoc server can now bind to an arbitrary hostname specified by the new " -"``-n`` command-line argument. (Contributed by Feanil Patel in :issue:" -"`31128`.)" +"``-n`` command-line argument. (Contributed by Feanil Patel " +"in :issue:`31128`.)" msgstr "" #: ../../whatsnew/3.7.rst:1230 @@ -1780,8 +1793,8 @@ msgstr "re" #: ../../whatsnew/3.7.rst:1239 msgid "" "The flags :const:`re.ASCII`, :const:`re.LOCALE` and :const:`re.UNICODE` can " -"be set within the scope of a group. (Contributed by Serhiy Storchaka in :" -"issue:`31690`.)" +"be set within the scope of a group. (Contributed by Serhiy Storchaka " +"in :issue:`31690`.)" msgstr "" #: ../../whatsnew/3.7.rst:1243 @@ -1803,15 +1816,15 @@ msgstr "" msgid "" ":exc:`FutureWarning` is now emitted if a regular expression contains " "character set constructs that will change semantically in the future, such " -"as nested sets and set operations. (Contributed by Serhiy Storchaka in :" -"issue:`30349`.)" +"as nested sets and set operations. (Contributed by Serhiy Storchaka " +"in :issue:`30349`.)" msgstr "" #: ../../whatsnew/3.7.rst:1257 msgid "" -"Compiled regular expression and match objects can now be copied using :func:" -"`copy.copy` and :func:`copy.deepcopy`. (Contributed by Serhiy Storchaka in :" -"issue:`10076`.)" +"Compiled regular expression and match objects can now be copied " +"using :func:`copy.copy` and :func:`copy.deepcopy`. (Contributed by Serhiy " +"Storchaka in :issue:`10076`.)" msgstr "" #: ../../whatsnew/3.7.rst:1263 @@ -1841,16 +1854,16 @@ msgstr "" msgid "" "The new :func:`socket.close` function closes the passed socket file " "descriptor. This function should be used instead of :func:`os.close` for " -"better compatibility across platforms. (Contributed by Christian Heimes in :" -"issue:`32454`.)" +"better compatibility across platforms. (Contributed by Christian Heimes " +"in :issue:`32454`.)" msgstr "" #: ../../whatsnew/3.7.rst:1283 msgid "" "The :mod:`socket` module now exposes the :const:`socket.TCP_CONGESTION` " -"(Linux 2.6.13), :const:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37), and :const:" -"`socket.TCP_NOTSENT_LOWAT` (Linux 3.12) constants. (Contributed by Omar " -"Sandoval in :issue:`26273` and Nathaniel J. Smith in :issue:`29728`.)" +"(Linux 2.6.13), :const:`socket.TCP_USER_TIMEOUT` (Linux 2.6.37), " +"and :const:`socket.TCP_NOTSENT_LOWAT` (Linux 3.12) constants. (Contributed " +"by Omar Sandoval in :issue:`26273` and Nathaniel J. Smith in :issue:`29728`.)" msgstr "" #: ../../whatsnew/3.7.rst:1289 @@ -1880,9 +1893,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1305 msgid "" "Add a new :attr:`socketserver.ForkingMixIn.block_on_close` class attribute " -"to :class:`socketserver.ForkingMixIn` and :class:`socketserver." -"ThreadingMixIn` classes. Set the class attribute to ``False`` to get the " -"pre-3.7 behaviour." +"to :class:`socketserver.ForkingMixIn` " +"and :class:`socketserver.ThreadingMixIn` classes. Set the class attribute to " +"``False`` to get the pre-3.7 behaviour." msgstr "" #: ../../whatsnew/3.7.rst:1311 @@ -1891,16 +1904,17 @@ msgstr "sqlite3" #: ../../whatsnew/3.7.rst:1313 msgid "" -":class:`sqlite3.Connection` now exposes the :meth:`~sqlite3.Connection." -"backup` method when the underlying SQLite library is at version 3.6.11 or " -"higher. (Contributed by Lele Gaifax in :issue:`27645`.)" +":class:`sqlite3.Connection` now exposes " +"the :meth:`~sqlite3.Connection.backup` method when the underlying SQLite " +"library is at version 3.6.11 or higher. (Contributed by Lele Gaifax " +"in :issue:`27645`.)" msgstr "" #: ../../whatsnew/3.7.rst:1317 msgid "" -"The *database* argument of :func:`sqlite3.connect` now accepts any :term:" -"`path-like object`, instead of just a string. (Contributed by Anders " -"Lorentsen in :issue:`31843`.)" +"The *database* argument of :func:`sqlite3.connect` now accepts " +"any :term:`path-like object`, instead of just a string. (Contributed by " +"Anders Lorentsen in :issue:`31843`.)" msgstr "" #: ../../whatsnew/3.7.rst:1323 ../../whatsnew/3.7.rst:2067 @@ -1909,15 +1923,16 @@ msgstr "ssl" #: ../../whatsnew/3.7.rst:1325 msgid "" -"The :mod:`ssl` module now uses OpenSSL's builtin API instead of :func:`~ssl." -"match_hostname` to check a host name or an IP address. Values are validated " -"during TLS handshake. Any certificate validation error including failing " -"the host name check now raises :exc:`~ssl.SSLCertVerificationError` and " -"aborts the handshake with a proper TLS Alert message. The new exception " -"contains additional information. Host name validation can be customized " -"with :attr:`SSLContext.hostname_checks_common_name <ssl.SSLContext." -"hostname_checks_common_name>`. (Contributed by Christian Heimes in :issue:" -"`31399`.)" +"The :mod:`ssl` module now uses OpenSSL's builtin API instead " +"of :func:`~ssl.match_hostname` to check a host name or an IP address. " +"Values are validated during TLS handshake. Any certificate validation error " +"including failing the host name check now " +"raises :exc:`~ssl.SSLCertVerificationError` and aborts the handshake with a " +"proper TLS Alert message. The new exception contains additional " +"information. Host name validation can be customized " +"with :attr:`SSLContext.hostname_checks_common_name " +"<ssl.SSLContext.hostname_checks_common_name>`. (Contributed by Christian " +"Heimes in :issue:`31399`.)" msgstr "" #: ../../whatsnew/3.7.rst:1336 @@ -1936,9 +1951,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1344 msgid "" -":func:`~ssl.match_hostname` no longer supports partial wildcards like ``www*." -"example.org``. (Contributed by Mandeep Singh in :issue:`23033` and Christian " -"Heimes in :issue:`31399`.)" +":func:`~ssl.match_hostname` no longer supports partial wildcards like " +"``www*.example.org``. (Contributed by Mandeep Singh in :issue:`23033` and " +"Christian Heimes in :issue:`31399`.)" msgstr "" #: ../../whatsnew/3.7.rst:1349 @@ -1953,11 +1968,11 @@ msgstr "" #: ../../whatsnew/3.7.rst:1355 msgid "" "Validation of server certificates containing internationalized domain names " -"(IDNs) is now supported. As part of this change, the :attr:`SSLSocket." -"server_hostname <ssl.SSLSocket.server_hostname>` attribute now stores the " -"expected hostname in A-label form (``\"xn--pythn-mua.org\"``), rather than " -"the U-label form (``\"pythön.org\"``). (Contributed by Nathaniel J. Smith " -"and Christian Heimes in :issue:`28414`.)" +"(IDNs) is now supported. As part of this change, " +"the :attr:`SSLSocket.server_hostname <ssl.SSLSocket.server_hostname>` " +"attribute now stores the expected hostname in A-label form (``\"xn--pythn-" +"mua.org\"``), rather than the U-label form (``\"pythön.org\"``). " +"(Contributed by Nathaniel J. Smith and Christian Heimes in :issue:`28414`.)" msgstr "" #: ../../whatsnew/3.7.rst:1362 @@ -1966,34 +1981,37 @@ msgid "" "OpenSSL 1.1.1. At the time of Python 3.7.0 release, OpenSSL 1.1.1 is still " "under development and TLS 1.3 hasn't been finalized yet. The TLS 1.3 " "handshake and protocol behaves slightly differently than TLS 1.2 and " -"earlier, see :ref:`ssl-tlsv1_3`. (Contributed by Christian Heimes in :issue:" -"`32947`, :issue:`20995`, :issue:`29136`, :issue:`30622` and :issue:`33618`)" +"earlier, see :ref:`ssl-tlsv1_3`. (Contributed by Christian Heimes " +"in :issue:`32947`, :issue:`20995`, :issue:`29136`, :issue:`30622` " +"and :issue:`33618`)" msgstr "" #: ../../whatsnew/3.7.rst:1370 msgid "" ":class:`~ssl.SSLSocket` and :class:`~ssl.SSLObject` no longer have a public " "constructor. Direct instantiation was never a documented and supported " -"feature. Instances must be created with :class:`~ssl.SSLContext` methods :" -"meth:`~ssl.SSLContext.wrap_socket` and :meth:`~ssl.SSLContext.wrap_bio`. " -"(Contributed by Christian Heimes in :issue:`32951`)" +"feature. Instances must be created with :class:`~ssl.SSLContext` " +"methods :meth:`~ssl.SSLContext.wrap_socket` " +"and :meth:`~ssl.SSLContext.wrap_bio`. (Contributed by Christian Heimes " +"in :issue:`32951`)" msgstr "" #: ../../whatsnew/3.7.rst:1376 msgid "" "OpenSSL 1.1 APIs for setting the minimum and maximum TLS protocol version " -"are available as :attr:`SSLContext.minimum_version <ssl.SSLContext." -"minimum_version>` and :attr:`SSLContext.maximum_version <ssl.SSLContext." -"maximum_version>`. Supported protocols are indicated by several new flags, " -"such as :data:`~ssl.HAS_TLSv1_1`. (Contributed by Christian Heimes in :issue:" -"`32609`.)" +"are available as :attr:`SSLContext.minimum_version " +"<ssl.SSLContext.minimum_version>` and :attr:`SSLContext.maximum_version " +"<ssl.SSLContext.maximum_version>`. Supported protocols are indicated by " +"several new flags, such as :data:`~ssl.HAS_TLSv1_1`. (Contributed by " +"Christian Heimes in :issue:`32609`.)" msgstr "" #: ../../whatsnew/3.7.rst:1383 msgid "" -"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable and :meth:`ssl." -"SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 post-handshake " -"authentication. (Contributed by Christian Heimes in :gh:`78851`.)" +"Added :attr:`ssl.SSLContext.post_handshake_auth` to enable " +"and :meth:`ssl.SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 " +"post-handshake authentication. (Contributed by Christian Heimes " +"in :gh:`78851`.)" msgstr "" #: ../../whatsnew/3.7.rst:1389 @@ -2030,19 +2048,21 @@ msgstr "" msgid "" "On Windows the default for *close_fds* was changed from ``False`` to " "``True`` when redirecting the standard handles. It's now possible to set " -"*close_fds* to true when redirecting the standard handles. See :class:" -"`subprocess.Popen`. This means that *close_fds* now defaults to ``True`` on " -"all supported platforms. (Contributed by Segev Finer in :issue:`19764`.)" +"*close_fds* to true when redirecting the standard handles. " +"See :class:`subprocess.Popen`. This means that *close_fds* now defaults to " +"``True`` on all supported platforms. (Contributed by Segev Finer " +"in :issue:`19764`.)" msgstr "" #: ../../whatsnew/3.7.rst:1417 msgid "" -"The subprocess module is now more graceful when handling :exc:" -"`KeyboardInterrupt` during :func:`subprocess.call`, :func:`subprocess.run`, " -"or in a :class:`~subprocess.Popen` context manager. It now waits a short " -"amount of time for the child to exit, before continuing the handling of the " -"``KeyboardInterrupt`` exception. (Contributed by Gregory P. Smith in :issue:" -"`25942`.)" +"The subprocess module is now more graceful when " +"handling :exc:`KeyboardInterrupt` " +"during :func:`subprocess.call`, :func:`subprocess.run`, or in " +"a :class:`~subprocess.Popen` context manager. It now waits a short amount " +"of time for the child to exit, before continuing the handling of the " +"``KeyboardInterrupt`` exception. (Contributed by Gregory P. Smith " +"in :issue:`25942`.)" msgstr "" #: ../../whatsnew/3.7.rst:1427 ../../whatsnew/3.7.rst:2083 @@ -2051,8 +2071,8 @@ msgstr "sys" #: ../../whatsnew/3.7.rst:1429 msgid "" -"The new :func:`sys.breakpointhook` hook function is called by the built-in :" -"func:`breakpoint`. (Contributed by Barry Warsaw in :issue:`31353`.)" +"The new :func:`sys.breakpointhook` hook function is called by the built-" +"in :func:`breakpoint`. (Contributed by Barry Warsaw in :issue:`31353`.)" msgstr "" #: ../../whatsnew/3.7.rst:1433 @@ -2064,11 +2084,11 @@ msgstr "" #: ../../whatsnew/3.7.rst:1437 msgid "" "The new :func:`sys.get_coroutine_origin_tracking_depth` function returns the " -"current coroutine origin tracking depth, as set by the new :func:`sys." -"set_coroutine_origin_tracking_depth`. :mod:`asyncio` has been converted to " -"use this new API instead of the deprecated :func:`sys." -"set_coroutine_wrapper`. (Contributed by Nathaniel J. Smith in :issue:" -"`32591`.)" +"current coroutine origin tracking depth, as set by the " +"new :func:`sys.set_coroutine_origin_tracking_depth`. :mod:`asyncio` has " +"been converted to use this new API instead of the " +"deprecated :func:`sys.set_coroutine_wrapper`. (Contributed by Nathaniel J. " +"Smith in :issue:`32591`.)" msgstr "" #: ../../whatsnew/3.7.rst:1446 @@ -2077,8 +2097,8 @@ msgstr "time" #: ../../whatsnew/3.7.rst:1448 msgid "" -":pep:`564` adds six new functions with nanosecond resolution to the :mod:" -"`time` module:" +":pep:`564` adds six new functions with nanosecond resolution to " +"the :mod:`time` module:" msgstr "" #: ../../whatsnew/3.7.rst:1458 @@ -2087,9 +2107,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1460 msgid "" -":const:`time.CLOCK_BOOTTIME` (Linux): Identical to :const:`time." -"CLOCK_MONOTONIC`, except it also includes any time that the system is " -"suspended." +":const:`time.CLOCK_BOOTTIME` (Linux): Identical " +"to :const:`time.CLOCK_MONOTONIC`, except it also includes any time that the " +"system is suspended." msgstr "" #: ../../whatsnew/3.7.rst:1463 @@ -2148,18 +2168,18 @@ msgstr "types" #: ../../whatsnew/3.7.rst:1499 msgid "" -"The new :class:`~types.WrapperDescriptorType`, :class:`~types." -"MethodWrapperType`, :class:`~types.MethodDescriptorType`, and :class:`~types." -"ClassMethodDescriptorType` classes are now available. (Contributed by Manuel " -"Krebber and Guido van Rossum in :issue:`29377`, and Serhiy Storchaka in :" -"issue:`32265`.)" +"The " +"new :class:`~types.WrapperDescriptorType`, :class:`~types.MethodWrapperType`, :class:`~types.MethodDescriptorType`, " +"and :class:`~types.ClassMethodDescriptorType` classes are now available. " +"(Contributed by Manuel Krebber and Guido van Rossum in :issue:`29377`, and " +"Serhiy Storchaka in :issue:`32265`.)" msgstr "" #: ../../whatsnew/3.7.rst:1505 msgid "" "The new :func:`types.resolve_bases` function resolves MRO entries " -"dynamically as specified by :pep:`560`. (Contributed by Ivan Levkivskyi in :" -"issue:`32717`.)" +"dynamically as specified by :pep:`560`. (Contributed by Ivan Levkivskyi " +"in :issue:`32717`.)" msgstr "" #: ../../whatsnew/3.7.rst:1511 @@ -2181,9 +2201,10 @@ msgstr "unittest" msgid "" "The new ``-k`` command-line option allows filtering tests by a name " "substring or a Unix shell-like pattern. For example, ``python -m unittest -k " -"foo`` runs ``foo_tests.SomeTest.test_something``, ``bar_tests.SomeTest." -"test_foo``, but not ``bar_tests.FooTest.test_something``. (Contributed by " -"Jonas Haag in :issue:`32071`.)" +"foo`` runs ``foo_tests.SomeTest.test_something``, " +"``bar_tests.SomeTest.test_foo``, but not " +"``bar_tests.FooTest.test_something``. (Contributed by Jonas Haag " +"in :issue:`32071`.)" msgstr "" #: ../../whatsnew/3.7.rst:1530 @@ -2199,10 +2220,11 @@ msgstr "" #: ../../whatsnew/3.7.rst:1536 msgid "" -"The new :func:`~unittest.mock.seal` function allows sealing :class:" -"`~unittest.mock.Mock` instances, which will disallow further creation of " -"attribute mocks. The seal is applied recursively to all attributes that are " -"themselves mocks. (Contributed by Mario Corchero in :issue:`30541`.)" +"The new :func:`~unittest.mock.seal` function allows " +"sealing :class:`~unittest.mock.Mock` instances, which will disallow further " +"creation of attribute mocks. The seal is applied recursively to all " +"attributes that are themselves mocks. (Contributed by Mario Corchero " +"in :issue:`30541`.)" msgstr "" #: ../../whatsnew/3.7.rst:1544 @@ -2235,8 +2257,8 @@ msgstr "uuid" msgid "" "The new :attr:`UUID.is_safe <uuid.UUID.is_safe>` attribute relays " "information from the platform about whether generated UUIDs are generated " -"with a multiprocessing-safe method. (Contributed by Barry Warsaw in :issue:" -"`22807`.)" +"with a multiprocessing-safe method. (Contributed by Barry Warsaw " +"in :issue:`22807`.)" msgstr "" #: ../../whatsnew/3.7.rst:1567 @@ -2301,11 +2323,11 @@ msgstr "" #: ../../whatsnew/3.7.rst:1598 msgid "" -"(Contributed by Nick Coghlan and Victor Stinner in :issue:`20361`, :issue:" -"`32043`, and :issue:`32230`.)" +"(Contributed by Nick Coghlan and Victor Stinner " +"in :issue:`20361`, :issue:`32043`, and :issue:`32230`.)" msgstr "" -"(由 Nick Coghlan 和 Victor Stinner 在 :issue:`20361`、:issue:`32043` 和 :" -"issue:`32230` 中貢獻。)" +"(由 Nick Coghlan 和 Victor Stinner 在 :issue:`20361`、:issue:`32043` " +"和 :issue:`32230` 中貢獻。)" #: ../../whatsnew/3.7.rst:1601 msgid "" @@ -2320,9 +2342,10 @@ msgstr "xml" #: ../../whatsnew/3.7.rst:1609 msgid "" -"As mitigation against DTD and external entity retrieval, the :mod:`xml.dom." -"minidom` and :mod:`xml.sax` modules no longer process external entities by " -"default. (Contributed by Christian Heimes in :gh:`61441`.)" +"As mitigation against DTD and external entity retrieval, " +"the :mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process " +"external entities by default. (Contributed by Christian Heimes " +"in :gh:`61441`.)" msgstr "" #: ../../whatsnew/3.7.rst:1616 @@ -2343,9 +2366,9 @@ msgstr "xmlrpc.server" #: ../../whatsnew/3.7.rst:1627 msgid "" -":meth:`SimpleXMLRPCDispatcher.register_function <xmlrpc.server." -"SimpleXMLRPCDispatcher>` can now be used as a decorator. (Contributed by " -"Xiang Zhang in :issue:`7769`.)" +":meth:`SimpleXMLRPCDispatcher.register_function " +"<xmlrpc.server.SimpleXMLRPCDispatcher>` can now be used as a decorator. " +"(Contributed by Xiang Zhang in :issue:`7769`.)" msgstr "" #: ../../whatsnew/3.7.rst:1633 @@ -2389,10 +2412,10 @@ msgstr "C API 變更" #: ../../whatsnew/3.7.rst:1660 msgid "" -"A new API for thread-local storage has been implemented. See :ref:" -"`whatsnew37-pep539` for an overview and :ref:`thread-specific-storage-api` " -"for a complete reference. (Contributed by Masayuki Yamamoto in :issue:" -"`25658`.)" +"A new API for thread-local storage has been implemented. " +"See :ref:`whatsnew37-pep539` for an overview and :ref:`thread-specific-" +"storage-api` for a complete reference. (Contributed by Masayuki Yamamoto " +"in :issue:`25658`.)" msgstr "" #: ../../whatsnew/3.7.rst:1665 @@ -2404,8 +2427,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:1668 msgid "" "The new :c:func:`PyImport_GetModule` function returns the previously " -"imported module with the given name. (Contributed by Eric Snow in :issue:" -"`28411`.)" +"imported module with the given name. (Contributed by Eric Snow " +"in :issue:`28411`.)" msgstr "" #: ../../whatsnew/3.7.rst:1672 @@ -2422,76 +2445,79 @@ msgstr "" #: ../../whatsnew/3.7.rst:1680 msgid "" -"The :mod:`tracemalloc` now exposes a C API through the new :c:func:" -"`PyTraceMalloc_Track` and :c:func:`PyTraceMalloc_Untrack` functions. " -"(Contributed by Victor Stinner in :issue:`30054`.)" +"The :mod:`tracemalloc` now exposes a C API through the " +"new :c:func:`PyTraceMalloc_Track` and :c:func:`PyTraceMalloc_Untrack` " +"functions. (Contributed by Victor Stinner in :issue:`30054`.)" msgstr "" #: ../../whatsnew/3.7.rst:1685 msgid "" -"The new :c:func:`import__find__load__start` and :c:func:" -"`import__find__load__done` static markers can be used to trace module " -"imports. (Contributed by Christian Heimes in :issue:`31574`.)" +"The new :c:func:`import__find__load__start` " +"and :c:func:`import__find__load__done` static markers can be used to trace " +"module imports. (Contributed by Christian Heimes in :issue:`31574`.)" msgstr "" #: ../../whatsnew/3.7.rst:1690 msgid "" -"The fields :c:member:`!name` and :c:member:`!doc` of structures :c:type:" -"`PyMemberDef`, :c:type:`PyGetSetDef`, :c:type:`PyStructSequence_Field`, :c:" -"type:`PyStructSequence_Desc`, and :c:struct:`wrapperbase` are now of type " -"``const char *`` rather of ``char *``. (Contributed by Serhiy Storchaka in :" -"issue:`28761`.)" +"The fields :c:member:`!name` and :c:member:`!doc` of " +"structures :c:type:`PyMemberDef`, :c:type:`PyGetSetDef`, :c:type:`PyStructSequence_Field`, :c:type:`PyStructSequence_Desc`, " +"and :c:struct:`wrapperbase` are now of type ``const char *`` rather of " +"``char *``. (Contributed by Serhiy Storchaka in :issue:`28761`.)" msgstr "" #: ../../whatsnew/3.7.rst:1696 msgid "" -"The result of :c:func:`PyUnicode_AsUTF8AndSize` and :c:func:" -"`PyUnicode_AsUTF8` is now of type ``const char *`` rather of ``char *``. " -"(Contributed by Serhiy Storchaka in :issue:`28769`.)" +"The result of :c:func:`PyUnicode_AsUTF8AndSize` " +"and :c:func:`PyUnicode_AsUTF8` is now of type ``const char *`` rather of " +"``char *``. (Contributed by Serhiy Storchaka in :issue:`28769`.)" msgstr "" #: ../../whatsnew/3.7.rst:1700 msgid "" -"The result of :c:func:`PyMapping_Keys`, :c:func:`PyMapping_Values` and :c:" -"func:`PyMapping_Items` is now always a list, rather than a list or a tuple. " -"(Contributed by Oren Milman in :issue:`28280`.)" +"The result of :c:func:`PyMapping_Keys`, :c:func:`PyMapping_Values` " +"and :c:func:`PyMapping_Items` is now always a list, rather than a list or a " +"tuple. (Contributed by Oren Milman in :issue:`28280`.)" msgstr "" #: ../../whatsnew/3.7.rst:1704 msgid "" -"Added functions :c:func:`PySlice_Unpack` and :c:func:" -"`PySlice_AdjustIndices`. (Contributed by Serhiy Storchaka in :issue:`27867`.)" +"Added functions :c:func:`PySlice_Unpack` " +"and :c:func:`PySlice_AdjustIndices`. (Contributed by Serhiy Storchaka " +"in :issue:`27867`.)" msgstr "" #: ../../whatsnew/3.7.rst:1707 msgid "" -":c:func:`PyOS_AfterFork` is deprecated in favour of the new functions :c:" -"func:`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` and :c:func:" -"`PyOS_AfterFork_Child`. (Contributed by Antoine Pitrou in :issue:`16500`.)" +":c:func:`PyOS_AfterFork` is deprecated in favour of the new " +"functions :c:func:`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` " +"and :c:func:`PyOS_AfterFork_Child`. (Contributed by Antoine Pitrou " +"in :issue:`16500`.)" msgstr "" #: ../../whatsnew/3.7.rst:1712 msgid "" "The ``PyExc_RecursionErrorInst`` singleton that was part of the public API " "has been removed as its members being never cleared may cause a segfault " -"during finalization of the interpreter. Contributed by Xavier de Gaye in :" -"issue:`22898` and :issue:`30697`." +"during finalization of the interpreter. Contributed by Xavier de Gaye " +"in :issue:`22898` and :issue:`30697`." msgstr "" #: ../../whatsnew/3.7.rst:1717 msgid "" -"Added C API support for timezones with timezone constructors :c:func:" -"`PyTimeZone_FromOffset` and :c:func:`PyTimeZone_FromOffsetAndName`, and " -"access to the UTC singleton with :c:data:`PyDateTime_TimeZone_UTC`. " -"Contributed by Paul Ganssle in :issue:`10381`." +"Added C API support for timezones with timezone " +"constructors :c:func:`PyTimeZone_FromOffset` " +"and :c:func:`PyTimeZone_FromOffsetAndName`, and access to the UTC singleton " +"with :c:data:`PyDateTime_TimeZone_UTC`. Contributed by Paul Ganssle " +"in :issue:`10381`." msgstr "" #: ../../whatsnew/3.7.rst:1722 msgid "" -"The type of results of :c:func:`PyThread_start_new_thread` and :c:func:" -"`PyThread_get_thread_ident`, and the *id* parameter of :c:func:" -"`PyThreadState_SetAsyncExc` changed from :c:expr:`long` to :c:expr:`unsigned " -"long`. (Contributed by Serhiy Storchaka in :issue:`6532`.)" +"The type of results of :c:func:`PyThread_start_new_thread` " +"and :c:func:`PyThread_get_thread_ident`, and the *id* parameter " +"of :c:func:`PyThreadState_SetAsyncExc` changed from :c:expr:`long` " +"to :c:expr:`unsigned long`. (Contributed by Serhiy Storchaka " +"in :issue:`6532`.)" msgstr "" #: ../../whatsnew/3.7.rst:1728 @@ -2504,12 +2530,12 @@ msgstr "" #: ../../whatsnew/3.7.rst:1732 msgid "" "Changes to the startup sequence and the management of dynamic memory " -"allocators mean that the long documented requirement to call :c:func:" -"`Py_Initialize` before calling most C API functions is now relied on more " -"heavily, and failing to abide by it may lead to segfaults in embedding " -"applications. See the :ref:`porting-to-python-37` section in this document " -"and the :ref:`pre-init-safe` section in the C API documentation for more " -"details." +"allocators mean that the long documented requirement to " +"call :c:func:`Py_Initialize` before calling most C API functions is now " +"relied on more heavily, and failing to abide by it may lead to segfaults in " +"embedding applications. See the :ref:`porting-to-python-37` section in this " +"document and the :ref:`pre-init-safe` section in the C API documentation for " +"more details." msgstr "" #: ../../whatsnew/3.7.rst:1740 @@ -2535,8 +2561,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:1752 msgid "" "The *start* and *end* parameters of :c:func:`PyUnicode_FindChar` are now " -"adjusted to behave like string slices. (Contributed by Xiang Zhang in :issue:" -"`28822`.)" +"adjusted to behave like string slices. (Contributed by Xiang Zhang " +"in :issue:`28822`.)" msgstr "" #: ../../whatsnew/3.7.rst:1758 @@ -2545,16 +2571,16 @@ msgstr "建置變更" #: ../../whatsnew/3.7.rst:1760 msgid "" -"Support for building ``--without-threads`` has been removed. The :mod:" -"`threading` module is now always available. (Contributed by Antoine Pitrou " -"in :issue:`31370`.)." +"Support for building ``--without-threads`` has been removed. " +"The :mod:`threading` module is now always available. (Contributed by Antoine " +"Pitrou in :issue:`31370`.)." msgstr "" #: ../../whatsnew/3.7.rst:1764 msgid "" -"A full copy of libffi is no longer bundled for use when building the :mod:" -"`_ctypes <ctypes>` module on non-OSX UNIX platforms. An installed copy of " -"libffi is now required when building ``_ctypes`` on such platforms. " +"A full copy of libffi is no longer bundled for use when building " +"the :mod:`_ctypes <ctypes>` module on non-OSX UNIX platforms. An installed " +"copy of libffi is now required when building ``_ctypes`` on such platforms. " "(Contributed by Zachary Ware in :issue:`27979`.)" msgstr "" @@ -2583,15 +2609,15 @@ msgstr "最佳化" msgid "" "The overhead of calling many methods of various standard library classes " "implemented in C has been significantly reduced by porting more code to use " -"the ``METH_FASTCALL`` convention. (Contributed by Victor Stinner in :issue:" -"`29300`, :issue:`29507`, :issue:`29452`, and :issue:`29286`.)" +"the ``METH_FASTCALL`` convention. (Contributed by Victor Stinner " +"in :issue:`29300`, :issue:`29507`, :issue:`29452`, and :issue:`29286`.)" msgstr "" #: ../../whatsnew/3.7.rst:1792 msgid "" "Various optimizations have reduced Python startup time by 10% on Linux and " -"up to 30% on macOS. (Contributed by Victor Stinner, INADA Naoki in :issue:" -"`29585`, and Ivan Levkivskyi in :issue:`31333`.)" +"up to 30% on macOS. (Contributed by Victor Stinner, INADA Naoki " +"in :issue:`29585`, and Ivan Levkivskyi in :issue:`31333`.)" msgstr "" #: ../../whatsnew/3.7.rst:1797 @@ -2610,8 +2636,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:1806 msgid "" "The :func:`asyncio.get_event_loop` function has been reimplemented in C to " -"make it up to 15 times faster. (Contributed by Yury Selivanov in :issue:" -"`32296`.)" +"make it up to 15 times faster. (Contributed by Yury Selivanov " +"in :issue:`32296`.)" msgstr "" #: ../../whatsnew/3.7.rst:1810 @@ -2640,16 +2666,17 @@ msgstr "" #: ../../whatsnew/3.7.rst:1823 msgid "" -"As a result of :ref:`PEP 560 work <whatsnew37-pep560>`, the import time of :" -"mod:`typing` has been reduced by a factor of 7, and many typing operations " -"are now faster. (Contributed by Ivan Levkivskyi in :issue:`32226`.)" +"As a result of :ref:`PEP 560 work <whatsnew37-pep560>`, the import time " +"of :mod:`typing` has been reduced by a factor of 7, and many typing " +"operations are now faster. (Contributed by Ivan Levkivskyi " +"in :issue:`32226`.)" msgstr "" #: ../../whatsnew/3.7.rst:1828 msgid "" ":func:`sorted` and :meth:`list.sort` have been optimized for common cases to " -"be up to 40-75% faster. (Contributed by Elliot Gorokhovsky in :issue:" -"`28685`.)" +"be up to 40-75% faster. (Contributed by Elliot Gorokhovsky " +"in :issue:`28685`.)" msgstr "" #: ../../whatsnew/3.7.rst:1832 @@ -2661,8 +2688,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:1835 msgid "" ":func:`hasattr` and :func:`getattr` are now about 4 times faster when *name* " -"is not found and *obj* does not override :meth:`object.__getattr__` or :meth:" -"`object.__getattribute__`. (Contributed by INADA Naoki in :issue:`32544`.)" +"is not found and *obj* does not override :meth:`object.__getattr__` " +"or :meth:`object.__getattribute__`. (Contributed by INADA Naoki " +"in :issue:`32544`.)" msgstr "" #: ../../whatsnew/3.7.rst:1840 @@ -2711,39 +2739,39 @@ msgstr "" msgid "" ":func:`re.compile` now converts ``flags`` parameter to int object if it is " "``RegexFlag``. It is now as fast as Python 3.5, and faster than Python 3.6 " -"by about 10% depending on the pattern. (Contributed by INADA Naoki in :issue:" -"`31671`.)" +"by about 10% depending on the pattern. (Contributed by INADA Naoki " +"in :issue:`31671`.)" msgstr "" #: ../../whatsnew/3.7.rst:1871 msgid "" -"The :meth:`~selectors.BaseSelector.modify` methods of classes :class:" -"`selectors.EpollSelector`, :class:`selectors.PollSelector` and :class:" -"`selectors.DevpollSelector` may be around 10% faster under heavy loads. " -"(Contributed by Giampaolo Rodola' in :issue:`30014`)" +"The :meth:`~selectors.BaseSelector.modify` methods of " +"classes :class:`selectors.EpollSelector`, :class:`selectors.PollSelector` " +"and :class:`selectors.DevpollSelector` may be around 10% faster under heavy " +"loads. (Contributed by Giampaolo Rodola' in :issue:`30014`)" msgstr "" #: ../../whatsnew/3.7.rst:1876 msgid "" "Constant folding has been moved from the peephole optimizer to the new AST " "optimizer, which is able perform optimizations more consistently. " -"(Contributed by Eugene Toder and INADA Naoki in :issue:`29469` and :issue:" -"`11549`.)" +"(Contributed by Eugene Toder and INADA Naoki in :issue:`29469` " +"and :issue:`11549`.)" msgstr "" #: ../../whatsnew/3.7.rst:1881 msgid "" "Most functions and methods in :mod:`abc` have been rewritten in C. This " -"makes creation of abstract base classes, and calling :func:`isinstance` and :" -"func:`issubclass` on them 1.5x faster. This also reduces Python start-up " -"time by up to 10%. (Contributed by Ivan Levkivskyi and INADA Naoki in :issue:" -"`31333`)" +"makes creation of abstract base classes, and calling :func:`isinstance` " +"and :func:`issubclass` on them 1.5x faster. This also reduces Python start-" +"up time by up to 10%. (Contributed by Ivan Levkivskyi and INADA Naoki " +"in :issue:`31333`)" msgstr "" #: ../../whatsnew/3.7.rst:1887 msgid "" -"Significant speed improvements to alternate constructors for :class:" -"`datetime.date` and :class:`datetime.datetime` by using fast-path " +"Significant speed improvements to alternate constructors " +"for :class:`datetime.date` and :class:`datetime.datetime` by using fast-path " "constructors when not constructing subclasses. (Contributed by Paul Ganssle " "in :issue:`32403`)" msgstr "" @@ -2770,9 +2798,10 @@ msgstr "" #: ../../whatsnew/3.7.rst:1905 msgid "" "Trace hooks may now opt out of receiving the ``line`` and opt into receiving " -"the ``opcode`` events from the interpreter by setting the corresponding new :" -"attr:`~frame.f_trace_lines` and :attr:`~frame.f_trace_opcodes` attributes on " -"the frame being traced. (Contributed by Nick Coghlan in :issue:`31344`.)" +"the ``opcode`` events from the interpreter by setting the corresponding " +"new :attr:`~frame.f_trace_lines` and :attr:`~frame.f_trace_opcodes` " +"attributes on the frame being traced. (Contributed by Nick Coghlan " +"in :issue:`31344`.)" msgstr "" #: ../../whatsnew/3.7.rst:1910 @@ -2782,8 +2811,8 @@ msgid "" "(previously unset), and their ``__spec__.origin`` is also set to ``None`` " "(previously the string ``\"namespace\"``). See :issue:`32305`. Also, the " "namespace module object's ``__spec__.loader`` is set to the same value as " -"``__loader__`` (previously, the former was set to ``None``). See :issue:" -"`32303`." +"``__loader__`` (previously, the former was set to ``None``). " +"See :issue:`32303`." msgstr "" #: ../../whatsnew/3.7.rst:1918 @@ -2797,8 +2826,8 @@ msgstr "" msgid "" "The ``distutils`` ``upload`` command no longer tries to change CR end-of-" "line characters to CRLF. This fixes a corruption issue with sdists that " -"ended with a byte equivalent to CR. (Contributed by Bo Bayles in :issue:" -"`32304`.)" +"ended with a byte equivalent to CR. (Contributed by Bo Bayles " +"in :issue:`32304`.)" msgstr "" #: ../../whatsnew/3.7.rst:1929 @@ -2823,8 +2852,9 @@ msgstr "" msgid "" "Returning a subclass of :class:`complex` from :meth:`object.__complex__` is " "deprecated and will be an error in future Python versions. This makes " -"``__complex__()`` consistent with :meth:`object.__int__` and :meth:`object." -"__float__`. (Contributed by Serhiy Storchaka in :issue:`28894`.)" +"``__complex__()`` consistent with :meth:`object.__int__` " +"and :meth:`object.__float__`. (Contributed by Serhiy Storchaka " +"in :issue:`28894`.)" msgstr "" #: ../../whatsnew/3.7.rst:1951 @@ -2838,8 +2868,8 @@ msgstr "aifc" #: ../../whatsnew/3.7.rst:1956 msgid "" ":func:`!aifc.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`!aifc.open` instead. (Contributed by Brian Curtin in :issue:" -"`31985`.)" +"Use :func:`!aifc.open` instead. (Contributed by Brian Curtin " +"in :issue:`31985`.)" msgstr "" #: ../../whatsnew/3.7.rst:1966 @@ -2847,15 +2877,15 @@ msgid "" "Support for directly ``await``-ing instances of :class:`asyncio.Lock` and " "other asyncio synchronization primitives has been deprecated. An " "asynchronous context manager must be used in order to acquire and release " -"the synchronization resource. (Contributed by Andrew Svetlov in :issue:" -"`32253`.)" +"the synchronization resource. (Contributed by Andrew Svetlov " +"in :issue:`32253`.)" msgstr "" #: ../../whatsnew/3.7.rst:1972 msgid "" "The :meth:`!asyncio.Task.current_task` and :meth:`!asyncio.Task.all_tasks` " -"methods have been deprecated. (Contributed by Andrew Svetlov in :issue:" -"`32250`.)" +"methods have been deprecated. (Contributed by Andrew Svetlov " +"in :issue:`32250`.)" msgstr "" #: ../../whatsnew/3.7.rst:1980 @@ -2881,8 +2911,8 @@ msgid "" "classes will raise a :exc:`TypeError` (e.g. ``1 in Color``); similarly, " "attempting to check for non-Flag objects in a :class:`Flag` member will " "raise :exc:`TypeError` (e.g. ``1 in Perm.RW``); currently, both operations " -"return :const:`False` instead. (Contributed by Ethan Furman in :issue:" -"`33217`.)" +"return :const:`False` instead. (Contributed by Ethan Furman " +"in :issue:`33217`.)" msgstr "" #: ../../whatsnew/3.7.rst:2009 @@ -2892,18 +2922,19 @@ msgstr "gettext" #: ../../whatsnew/3.7.rst:2011 msgid "" "Using non-integer value for selecting a plural form in :mod:`gettext` is now " -"deprecated. It never correctly worked. (Contributed by Serhiy Storchaka in :" -"issue:`28692`.)" +"deprecated. It never correctly worked. (Contributed by Serhiy Storchaka " +"in :issue:`28692`.)" msgstr "" #: ../../whatsnew/3.7.rst:2019 msgid "" -"Methods :meth:`!MetaPathFinder.find_module` (replaced by :meth:" -"`MetaPathFinder.find_spec() <importlib.abc.MetaPathFinder.find_spec>`) and :" -"meth:`!PathEntryFinder.find_loader` (replaced by :meth:`PathEntryFinder." -"find_spec() <importlib.abc.PathEntryFinder.find_spec>`) both deprecated in " -"Python 3.4 now emit :exc:`DeprecationWarning`. (Contributed by Matthias " -"Bussonnier in :issue:`29576`.)" +"Methods :meth:`!MetaPathFinder.find_module` (replaced " +"by :meth:`MetaPathFinder.find_spec() " +"<importlib.abc.MetaPathFinder.find_spec>`) and :meth:`!" +"PathEntryFinder.find_loader` (replaced by :meth:`PathEntryFinder.find_spec() " +"<importlib.abc.PathEntryFinder.find_spec>`) both deprecated in Python 3.4 " +"now emit :exc:`DeprecationWarning`. (Contributed by Matthias Bussonnier " +"in :issue:`29576`.)" msgstr "" #: ../../whatsnew/3.7.rst:2030 @@ -2935,22 +2966,24 @@ msgstr "threading" #: ../../whatsnew/3.7.rst:2051 msgid "" ":mod:`!dummy_threading` and :mod:`!_dummy_thread` have been deprecated. It " -"is no longer possible to build Python with threading disabled. Use :mod:" -"`threading` instead. (Contributed by Antoine Pitrou in :issue:`31370`.)" +"is no longer possible to build Python with threading disabled. " +"Use :mod:`threading` instead. (Contributed by Antoine Pitrou " +"in :issue:`31370`.)" msgstr "" #: ../../whatsnew/3.7.rst:2060 msgid "" -"The silent argument value truncation in :func:`socket.htons` and :func:" -"`socket.ntohs` has been deprecated. In future versions of Python, if the " -"passed argument is larger than 16 bits, an exception will be raised. " +"The silent argument value truncation in :func:`socket.htons` " +"and :func:`socket.ntohs` has been deprecated. In future versions of Python, " +"if the passed argument is larger than 16 bits, an exception will be raised. " "(Contributed by Oren Milman in :issue:`28332`.)" msgstr "" #: ../../whatsnew/3.7.rst:2069 msgid "" -":func:`ssl.wrap_socket` is deprecated. Use :meth:`ssl.SSLContext." -"wrap_socket` instead. (Contributed by Christian Heimes in :issue:`28124`.)" +":func:`ssl.wrap_socket` is deprecated. " +"Use :meth:`ssl.SSLContext.wrap_socket` instead. (Contributed by Christian " +"Heimes in :issue:`28124`.)" msgstr "" #: ../../whatsnew/3.7.rst:2075 @@ -2960,21 +2993,21 @@ msgstr "sunau" #: ../../whatsnew/3.7.rst:2077 msgid "" ":func:`!sunau.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`!sunau.open` instead. (Contributed by Brian Curtin in :issue:" -"`31985`.)" +"Use :func:`!sunau.open` instead. (Contributed by Brian Curtin " +"in :issue:`31985`.)" msgstr "" #: ../../whatsnew/3.7.rst:2085 msgid "" -"Deprecated :func:`sys.set_coroutine_wrapper` and :func:`sys." -"get_coroutine_wrapper`." +"Deprecated :func:`sys.set_coroutine_wrapper` " +"and :func:`sys.get_coroutine_wrapper`." msgstr "" #: ../../whatsnew/3.7.rst:2088 msgid "" "The undocumented ``sys.callstats()`` function has been deprecated and will " -"be removed in a future Python version. (Contributed by Victor Stinner in :" -"issue:`28799`.)" +"be removed in a future Python version. (Contributed by Victor Stinner " +"in :issue:`28799`.)" msgstr "" #: ../../whatsnew/3.7.rst:2094 @@ -2984,8 +3017,8 @@ msgstr "wave" #: ../../whatsnew/3.7.rst:2096 msgid "" ":func:`wave.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`wave.open` instead. (Contributed by Brian Curtin in :issue:" -"`31985`.)" +"Use :func:`wave.open` instead. (Contributed by Brian Curtin " +"in :issue:`31985`.)" msgstr "" #: ../../whatsnew/3.7.rst:2102 @@ -2997,16 +3030,16 @@ msgid "" "Function :c:func:`PySlice_GetIndicesEx` is deprecated and replaced with a " "macro if ``Py_LIMITED_API`` is not set or set to a value in the range " "between ``0x03050400`` and ``0x03060000`` (not inclusive), or is " -"``0x03060100`` or higher. (Contributed by Serhiy Storchaka in :issue:" -"`27867`.)" +"``0x03060100`` or higher. (Contributed by Serhiy Storchaka " +"in :issue:`27867`.)" msgstr "" #: ../../whatsnew/3.7.rst:2109 msgid "" -":c:func:`PyOS_AfterFork` has been deprecated. Use :c:func:" -"`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` or :c:func:" -"`PyOS_AfterFork_Child()` instead. (Contributed by Antoine Pitrou in :issue:" -"`16500`.)" +":c:func:`PyOS_AfterFork` has been deprecated. " +"Use :c:func:`PyOS_BeforeFork`, :c:func:`PyOS_AfterFork_Parent` " +"or :c:func:`PyOS_AfterFork_Child()` instead. (Contributed by Antoine Pitrou " +"in :issue:`16500`.)" msgstr "" #: ../../whatsnew/3.7.rst:2117 @@ -3051,15 +3084,15 @@ msgstr "" #: ../../whatsnew/3.7.rst:2136 msgid "" "CPython's own `CI configuration file <https://github.com/python/cpython/blob/" -"v3.7.13/.travis.yml>`_ provides an example of using the SSL :source:" -"`compatibility testing infrastructure <Tools/ssl/multissltests.py>` in " -"CPython's test suite to build and link against OpenSSL 1.1.0 rather than an " -"outdated system provided OpenSSL." +"v3.7.13/.travis.yml>`_ provides an example of using the " +"SSL :source:`compatibility testing infrastructure <Tools/ssl/" +"multissltests.py>` in CPython's test suite to build and link against OpenSSL " +"1.1.0 rather than an outdated system provided OpenSSL." msgstr "" #: ../../whatsnew/3.7.rst:2145 msgid "API and Feature Removals" -msgstr "" +msgstr "API 與功能的移除" #: ../../whatsnew/3.7.rst:2147 msgid "The following features and APIs have been removed from Python 3.7:" @@ -3111,9 +3144,9 @@ msgstr "" msgid "" "Removed previously deprecated in Python 2.4 classes ``Plist``, ``Dict`` and " "``_InternalDict`` in the :mod:`plistlib` module. Dict values in the result " -"of functions :func:`~plistlib.readPlist` and :func:`~plistlib." -"readPlistFromBytes` are now normal dicts. You no longer can use attribute " -"access to access items of these dictionaries." +"of functions :func:`~plistlib.readPlist` " +"and :func:`~plistlib.readPlistFromBytes` are now normal dicts. You no " +"longer can use attribute access to access items of these dictionaries." msgstr "" #: ../../whatsnew/3.7.rst:2180 @@ -3135,9 +3168,9 @@ msgstr "" msgid "" "Direct instantiation of :class:`ssl.SSLSocket` and :class:`ssl.SSLObject` " "objects is now prohibited. The constructors were never documented, tested, " -"or designed as public constructors. Users were supposed to use :func:`ssl." -"wrap_socket` or :class:`ssl.SSLContext`. (Contributed by Christian Heimes " -"in :issue:`32951`.)" +"or designed as public constructors. Users were supposed to " +"use :func:`ssl.wrap_socket` or :class:`ssl.SSLContext`. (Contributed by " +"Christian Heimes in :issue:`32951`.)" msgstr "" #: ../../whatsnew/3.7.rst:2197 @@ -3193,7 +3226,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:2237 msgid "Changes in Python Behavior" -msgstr "" +msgstr "Python 行為的改變" #: ../../whatsnew/3.7.rst:2239 msgid "" @@ -3204,10 +3237,10 @@ msgstr "" #: ../../whatsnew/3.7.rst:2243 msgid "" -":pep:`479` is enabled for all code in Python 3.7, meaning that :exc:" -"`StopIteration` exceptions raised directly or indirectly in coroutines and " -"generators are transformed into :exc:`RuntimeError` exceptions. (Contributed " -"by Yury Selivanov in :issue:`32670`.)" +":pep:`479` is enabled for all code in Python 3.7, meaning " +"that :exc:`StopIteration` exceptions raised directly or indirectly in " +"coroutines and generators are transformed into :exc:`RuntimeError` " +"exceptions. (Contributed by Yury Selivanov in :issue:`32670`.)" msgstr "" #: ../../whatsnew/3.7.rst:2249 @@ -3239,8 +3272,8 @@ msgid "" "Python 3.7 now correctly raises a :exc:`SyntaxError`, as a generator " "expression always needs to be directly inside a set of parentheses and " "cannot have a comma on either side, and the duplication of the parentheses " -"can be omitted only on calls. (Contributed by Serhiy Storchaka in :issue:" -"`32012` and :issue:`32023`.)" +"can be omitted only on calls. (Contributed by Serhiy Storchaka " +"in :issue:`32012` and :issue:`32023`.)" msgstr "" #: ../../whatsnew/3.7.rst:2266 @@ -3257,22 +3290,24 @@ msgstr "" #: ../../whatsnew/3.7.rst:2276 msgid "Changes in the Python API" -msgstr "" +msgstr "Python API 的變更" #: ../../whatsnew/3.7.rst:2278 msgid "" ":meth:`socketserver.ThreadingMixIn.server_close` now waits until all non-" -"daemon threads complete. Set the new :attr:`socketserver.ThreadingMixIn." -"block_on_close` class attribute to ``False`` to get the pre-3.7 behaviour. " -"(Contributed by Victor Stinner in :issue:`31233` and :issue:`33540`.)" +"daemon threads complete. Set the " +"new :attr:`socketserver.ThreadingMixIn.block_on_close` class attribute to " +"``False`` to get the pre-3.7 behaviour. (Contributed by Victor Stinner " +"in :issue:`31233` and :issue:`33540`.)" msgstr "" #: ../../whatsnew/3.7.rst:2284 msgid "" ":meth:`socketserver.ForkingMixIn.server_close` now waits until all child " -"processes complete. Set the new :attr:`socketserver.ForkingMixIn." -"block_on_close` class attribute to ``False`` to get the pre-3.7 behaviour. " -"(Contributed by Victor Stinner in :issue:`31151` and :issue:`33540`.)" +"processes complete. Set the " +"new :attr:`socketserver.ForkingMixIn.block_on_close` class attribute to " +"``False`` to get the pre-3.7 behaviour. (Contributed by Victor Stinner " +"in :issue:`31151` and :issue:`33540`.)" msgstr "" #: ../../whatsnew/3.7.rst:2290 @@ -3291,19 +3326,19 @@ msgstr "" #: ../../whatsnew/3.7.rst:2298 msgid "" -"A format string argument for :meth:`string.Formatter.format` is now :ref:" -"`positional-only <positional-only_parameter>`. Passing it as a keyword " -"argument was deprecated in Python 3.5. (Contributed by Serhiy Storchaka in :" -"issue:`29193`.)" +"A format string argument for :meth:`string.Formatter.format` is " +"now :ref:`positional-only <positional-only_parameter>`. Passing it as a " +"keyword argument was deprecated in Python 3.5. (Contributed by Serhiy " +"Storchaka in :issue:`29193`.)" msgstr "" #: ../../whatsnew/3.7.rst:2303 msgid "" -"Attributes :attr:`~http.cookies.Morsel.key`, :attr:`~http.cookies.Morsel." -"value` and :attr:`~http.cookies.Morsel.coded_value` of class :class:`http." -"cookies.Morsel` are now read-only. Assigning to them was deprecated in " -"Python 3.5. Use the :meth:`~http.cookies.Morsel.set` method for setting " -"them. (Contributed by Serhiy Storchaka in :issue:`29192`.)" +"Attributes :attr:`~http.cookies.Morsel.key`, :attr:`~http.cookies.Morsel.value` " +"and :attr:`~http.cookies.Morsel.coded_value` of " +"class :class:`http.cookies.Morsel` are now read-only. Assigning to them was " +"deprecated in Python 3.5. Use the :meth:`~http.cookies.Morsel.set` method " +"for setting them. (Contributed by Serhiy Storchaka in :issue:`29192`.)" msgstr "" #: ../../whatsnew/3.7.rst:2311 @@ -3316,8 +3351,8 @@ msgstr "" #: ../../whatsnew/3.7.rst:2317 msgid "" -"The :attr:`struct.Struct.format` type is now :class:`str` instead of :class:" -"`bytes`. (Contributed by Victor Stinner in :issue:`21071`.)" +"The :attr:`struct.Struct.format` type is now :class:`str` instead " +"of :class:`bytes`. (Contributed by Victor Stinner in :issue:`21071`.)" msgstr "" #: ../../whatsnew/3.7.rst:2320 @@ -3350,10 +3385,10 @@ msgstr "" #: ../../whatsnew/3.7.rst:2337 msgid "" -"Because :func:`shutil.rmtree` is now implemented using the :func:`os." -"scandir` function, the user specified handler *onerror* is now called with " -"the first argument ``os.scandir`` instead of ``os.listdir`` when listing the " -"directory is failed." +"Because :func:`shutil.rmtree` is now implemented using " +"the :func:`os.scandir` function, the user specified handler *onerror* is now " +"called with the first argument ``os.scandir`` instead of ``os.listdir`` when " +"listing the directory is failed." msgstr "" #: ../../whatsnew/3.7.rst:2342 @@ -3416,40 +3451,43 @@ msgstr "" #: ../../whatsnew/3.7.rst:2385 msgid "" -"On OSes that support :const:`socket.SOCK_NONBLOCK` or :const:`socket." -"SOCK_CLOEXEC` bit flags, the :attr:`socket.type <socket.socket.type>` no " -"longer has them applied. Therefore, checks like ``if sock.type == socket." -"SOCK_STREAM`` work as expected on all platforms. (Contributed by Yury " -"Selivanov in :issue:`32331`.)" +"On OSes that support :const:`socket.SOCK_NONBLOCK` " +"or :const:`socket.SOCK_CLOEXEC` bit flags, the :attr:`socket.type " +"<socket.socket.type>` no longer has them applied. Therefore, checks like " +"``if sock.type == socket.SOCK_STREAM`` work as expected on all platforms. " +"(Contributed by Yury Selivanov in :issue:`32331`.)" msgstr "" #: ../../whatsnew/3.7.rst:2392 msgid "" -"On Windows the default for the *close_fds* argument of :class:`subprocess." -"Popen` was changed from :const:`False` to :const:`True` when redirecting the " -"standard handles. If you previously depended on handles being inherited when " -"using :class:`subprocess.Popen` with standard io redirection, you will have " -"to pass ``close_fds=False`` to preserve the previous behaviour, or use :attr:" -"`STARTUPINFO.lpAttributeList <subprocess.STARTUPINFO.lpAttributeList>`." +"On Windows the default for the *close_fds* argument " +"of :class:`subprocess.Popen` was changed from :const:`False` " +"to :const:`True` when redirecting the standard handles. If you previously " +"depended on handles being inherited when using :class:`subprocess.Popen` " +"with standard io redirection, you will have to pass ``close_fds=False`` to " +"preserve the previous behaviour, or use :attr:`STARTUPINFO.lpAttributeList " +"<subprocess.STARTUPINFO.lpAttributeList>`." msgstr "" #: ../../whatsnew/3.7.rst:2400 msgid "" ":meth:`importlib.machinery.PathFinder.invalidate_caches` -- which implicitly " -"affects :func:`importlib.invalidate_caches` -- now deletes entries in :data:" -"`sys.path_importer_cache` which are set to ``None``. (Contributed by Brett " -"Cannon in :issue:`33169`.)" +"affects :func:`importlib.invalidate_caches` -- now deletes entries " +"in :data:`sys.path_importer_cache` which are set to ``None``. (Contributed " +"by Brett Cannon in :issue:`33169`.)" msgstr "" #: ../../whatsnew/3.7.rst:2405 msgid "" -"In :mod:`asyncio`, :meth:`loop.sock_recv() <asyncio.loop.sock_recv>`, :meth:" -"`loop.sock_sendall() <asyncio.loop.sock_sendall>`, :meth:`loop.sock_accept() " -"<asyncio.loop.sock_accept>`, :meth:`loop.getaddrinfo() <asyncio.loop." -"getaddrinfo>`, :meth:`loop.getnameinfo() <asyncio.loop.getnameinfo>` have " -"been changed to be proper coroutine methods to match their documentation. " -"Previously, these methods returned :class:`asyncio.Future` instances. " -"(Contributed by Yury Selivanov in :issue:`32327`.)" +"In :mod:`asyncio`, :meth:`loop.sock_recv() " +"<asyncio.loop.sock_recv>`, :meth:`loop.sock_sendall() " +"<asyncio.loop.sock_sendall>`, :meth:`loop.sock_accept() " +"<asyncio.loop.sock_accept>`, :meth:`loop.getaddrinfo() " +"<asyncio.loop.getaddrinfo>`, :meth:`loop.getnameinfo() " +"<asyncio.loop.getnameinfo>` have been changed to be proper coroutine methods " +"to match their documentation. Previously, these methods " +"returned :class:`asyncio.Future` instances. (Contributed by Yury Selivanov " +"in :issue:`32327`.)" msgstr "" #: ../../whatsnew/3.7.rst:2416 @@ -3462,16 +3500,16 @@ msgstr "" #: ../../whatsnew/3.7.rst:2420 msgid "" ":attr:`Struct.format <struct.Struct.format>` is now a :class:`str` instance " -"instead of a :class:`bytes` instance. (Contributed by Victor Stinner in :" -"issue:`21071`.)" +"instead of a :class:`bytes` instance. (Contributed by Victor Stinner " +"in :issue:`21071`.)" msgstr "" #: ../../whatsnew/3.7.rst:2424 msgid "" ":mod:`argparse` subparsers can now be made mandatory by passing " -"``required=True`` to :meth:`ArgumentParser.add_subparsers() <argparse." -"ArgumentParser.add_subparsers>`. (Contributed by Anthony Sottile in :issue:" -"`26510`.)" +"``required=True`` to :meth:`ArgumentParser.add_subparsers() " +"<argparse.ArgumentParser.add_subparsers>`. (Contributed by Anthony Sottile " +"in :issue:`26510`.)" msgstr "" #: ../../whatsnew/3.7.rst:2428 @@ -3489,8 +3527,9 @@ msgid "" "cannot tolerate such exceptions, the new :meth:`Calendar.itermonthdays3 " "<calendar.Calendar.itermonthdays3>` and :meth:`Calendar.itermonthdays4 " "<calendar.Calendar.itermonthdays4>` can be used. The new methods return " -"tuples and are not restricted by the range supported by :class:`datetime." -"date`. (Contributed by Alexander Belopolsky in :issue:`28292`.)" +"tuples and are not restricted by the range supported " +"by :class:`datetime.date`. (Contributed by Alexander Belopolsky " +"in :issue:`28292`.)" msgstr "" #: ../../whatsnew/3.7.rst:2442 @@ -3502,9 +3541,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:2445 msgid "" "The ``submit()`` method of :class:`concurrent.futures.ThreadPoolExecutor` " -"and :class:`concurrent.futures.ProcessPoolExecutor` now raises a :exc:" -"`RuntimeError` if called during interpreter shutdown. (Contributed by Mark " -"Nemec in :issue:`33097`.)" +"and :class:`concurrent.futures.ProcessPoolExecutor` now raises " +"a :exc:`RuntimeError` if called during interpreter shutdown. (Contributed by " +"Mark Nemec in :issue:`33097`.)" msgstr "" #: ../../whatsnew/3.7.rst:2450 @@ -3518,9 +3557,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:2456 msgid "" -"Several undocumented internal imports were removed. One example is that ``os." -"errno`` is no longer available; use ``import errno`` directly instead. Note " -"that such undocumented internal imports may be removed any time without " +"Several undocumented internal imports were removed. One example is that " +"``os.errno`` is no longer available; use ``import errno`` directly instead. " +"Note that such undocumented internal imports may be removed any time without " "notice, even in micro version releases." msgstr "" @@ -3531,13 +3570,13 @@ msgstr "C API 中的改動" #: ../../whatsnew/3.7.rst:2466 msgid "" "The function :c:func:`PySlice_GetIndicesEx` is considered unsafe for " -"resizable sequences. If the slice indices are not instances of :class:" -"`int`, but objects that implement the :meth:`!__index__` method, the " -"sequence can be resized after passing its length to :c:func:`!" +"resizable sequences. If the slice indices are not instances " +"of :class:`int`, but objects that implement the :meth:`!__index__` method, " +"the sequence can be resized after passing its length to :c:func:`!" "PySlice_GetIndicesEx`. This can lead to returning indices out of the length " -"of the sequence. For avoiding possible problems use new functions :c:func:" -"`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices`. (Contributed by Serhiy " -"Storchaka in :issue:`27867`.)" +"of the sequence. For avoiding possible problems use new " +"functions :c:func:`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices`. " +"(Contributed by Serhiy Storchaka in :issue:`27867`.)" msgstr "" #: ../../whatsnew/3.7.rst:2477 @@ -3559,9 +3598,9 @@ msgstr "" #: ../../whatsnew/3.7.rst:2489 msgid "" "The file used to override :data:`sys.path` is now called ``<python-" -"executable>._pth`` instead of ``'sys.path'``. See :ref:" -"`windows_finding_modules` for more information. (Contributed by Steve Dower " -"in :issue:`28137`.)" +"executable>._pth`` instead of ``'sys.path'``. " +"See :ref:`windows_finding_modules` for more information. (Contributed by " +"Steve Dower in :issue:`28137`.)" msgstr "" #: ../../whatsnew/3.7.rst:2496 @@ -3603,8 +3642,8 @@ msgid "" "setting :c:data:`Py_BytesWarningFlag` to a value greater than one is no " "longer sufficient to both emit :exc:`BytesWarning` messages and have them " "converted to exceptions. Instead, the flag must be set (to cause the " -"warnings to be emitted in the first place), and an explicit ``error::" -"BytesWarning`` warnings filter added to convert them to exceptions." +"warnings to be emitted in the first place), and an explicit " +"``error::BytesWarning`` warnings filter added to convert them to exceptions." msgstr "" #: ../../whatsnew/3.7.rst:2526 @@ -3633,8 +3672,9 @@ msgid "" "respects all of the same environment settings as :c:func:`Py_Main` (in " "earlier Python versions, it respected an ill-defined subset of those " "environment variables, while in Python 3.7.0 it didn't read any of them due " -"to :issue:`34247`). If this behavior is unwanted, set :c:data:" -"`Py_IgnoreEnvironmentFlag` to 1 before calling :c:func:`Py_Initialize`." +"to :issue:`34247`). If this behavior is unwanted, " +"set :c:data:`Py_IgnoreEnvironmentFlag` to 1 before " +"calling :c:func:`Py_Initialize`." msgstr "" #: ../../whatsnew/3.7.rst:2546 @@ -3672,12 +3712,12 @@ msgstr "Python 3.7.6 中顯著的變更" #: ../../whatsnew/3.7.rst:2568 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" #: ../../whatsnew/3.7.rst:2576 @@ -3687,13 +3727,14 @@ msgstr "Python 3.7.10 中顯著的變更" #: ../../whatsnew/3.7.rst:2578 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" msgstr "" #: ../../whatsnew/3.7.rst:2589 @@ -3715,8 +3756,8 @@ msgid "" "forms of attacks. Following the WHATWG specification that updates RFC 3986, " "ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are stripped from " "the URL by the parser :func:`urllib.parse` preventing such attacks. The " -"removal characters are controlled by a new module level variable ``urllib." -"parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" +"removal characters are controlled by a new module level variable " +"``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" #: ../../whatsnew/3.7.rst:2606 diff --git a/whatsnew/3.8.po b/whatsnew/3.8.po index a537637276..d736d9a29a 100644 --- a/whatsnew/3.8.po +++ b/whatsnew/3.8.po @@ -32,8 +32,8 @@ msgstr "Raymond Hettinger" #: ../../whatsnew/3.8.rst:47 msgid "" "This article explains the new features in Python 3.8, compared to 3.7. " -"Python 3.8 was released on October 14, 2019. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.8 was released on October 14, 2019. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.8 與 3.7 相比多了哪些新功能。Python 3.8 已於 2019 年 10 " "月 14 日發布。有關完整詳細資訊,請參閱 :ref:`changelog <changelog>`。" @@ -54,8 +54,9 @@ msgstr "" msgid "" "There is new syntax ``:=`` that assigns values to variables as part of a " "larger expression. It is affectionately known as \"the walrus operator\" due " -"to its resemblance to `the eyes and tusks of a walrus <https://en.wikipedia." -"org/wiki/Walrus#/media/File:Pacific_Walrus_-_Bull_(8247646168).jpg>`_." +"to its resemblance to `the eyes and tusks of a walrus <https://" +"en.wikipedia.org/wiki/Walrus#/media/File:Pacific_Walrus_-" +"_Bull_(8247646168).jpg>`_." msgstr "" #: ../../whatsnew/3.8.rst:82 @@ -138,8 +139,8 @@ msgid "" "There is a new function parameter syntax ``/`` to indicate that some " "function parameters must be specified positionally and cannot be used as " "keyword arguments. This is the same notation shown by ``help()`` for C " -"functions annotated with Larry Hastings' `Argument Clinic <https://devguide." -"python.org/development-tools/clinic/>`__ tool." +"functions annotated with Larry Hastings' `Argument Clinic <https://" +"devguide.python.org/development-tools/clinic/>`__ tool." msgstr "" #: ../../whatsnew/3.8.rst:128 @@ -272,8 +273,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:201 msgid "" -"The location of the cache is reported in :data:`sys.pycache_prefix` (:const:" -"`None` indicates the default location in ``__pycache__`` subdirectories)." +"The location of the cache is reported in :data:`sys.pycache_prefix` " +"(:const:`None` indicates the default location in ``__pycache__`` " +"subdirectories)." msgstr "" #: ../../whatsnew/3.8.rst:205 @@ -296,10 +298,10 @@ msgid "" "Release builds and :ref:`debug builds <debug-build>` are now ABI compatible: " "defining the ``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` " "macro, which introduces the only ABI incompatibility. The ``Py_TRACE_REFS`` " -"macro, which adds the :func:`sys.getobjects` function and the :envvar:" -"`PYTHONDUMPREFS` environment variable, can be set using the new :option:`./" -"configure --with-trace-refs <--with-trace-refs>` build option. (Contributed " -"by Victor Stinner in :issue:`36465`.)" +"macro, which adds the :func:`sys.getobjects` function and " +"the :envvar:`PYTHONDUMPREFS` environment variable, can be set using the " +"new :option:`./configure --with-trace-refs <--with-trace-refs>` build " +"option. (Contributed by Victor Stinner in :issue:`36465`.)" msgstr "" #: ../../whatsnew/3.8.rst:223 @@ -341,8 +343,8 @@ msgid "" "On the other hand, ``pkg-config python3.8 --libs`` no longer contains ``-" "lpython3.8``. C extensions must not be linked to libpython (except on " "Android and Cygwin, whose cases are handled by the script); this change is " -"backward incompatible on purpose. (Contributed by Victor Stinner in :issue:" -"`36721`.)" +"backward incompatible on purpose. (Contributed by Victor Stinner " +"in :issue:`36721`.)" msgstr "" #: ../../whatsnew/3.8.rst:256 @@ -576,8 +578,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:354 msgid "" ":ref:`vectorcall` is added to the Python/C API. It is meant to formalize " -"existing optimizations which were already done for various classes. Any :ref:" -"`static type <static-types>` implementing a callable can use this protocol." +"existing optimizations which were already done for various classes. " +"Any :ref:`static type <static-types>` implementing a callable can use this " +"protocol." msgstr "" #: ../../whatsnew/3.8.rst:360 @@ -592,8 +595,8 @@ msgstr "完整敘述請見 :pep:`590`。" #: ../../whatsnew/3.8.rst:365 msgid "" -"(Contributed by Jeroen Demeyer, Mark Shannon and Petr Viktorin in :issue:" -"`36974`.)" +"(Contributed by Jeroen Demeyer, Mark Shannon and Petr Viktorin " +"in :issue:`36974`.)" msgstr "" "(由 Jeroen Demeyer、Mark Shannon 和 Petr Viktorin 在 :issue:`36974` 中貢" "獻。)" @@ -639,19 +642,19 @@ msgstr "" #: ../../whatsnew/3.8.rst:393 msgid "" "The :class:`bool`, :class:`int`, and :class:`fractions.Fraction` types now " -"have an :meth:`~int.as_integer_ratio` method like that found in :class:" -"`float` and :class:`decimal.Decimal`. This minor API extension makes it " -"possible to write ``numerator, denominator = x.as_integer_ratio()`` and have " -"it work across multiple numeric types. (Contributed by Lisa Roach in :issue:" -"`33073` and Raymond Hettinger in :issue:`37819`.)" +"have an :meth:`~int.as_integer_ratio` method like that found " +"in :class:`float` and :class:`decimal.Decimal`. This minor API extension " +"makes it possible to write ``numerator, denominator = x.as_integer_ratio()`` " +"and have it work across multiple numeric types. (Contributed by Lisa Roach " +"in :issue:`33073` and Raymond Hettinger in :issue:`37819`.)" msgstr "" #: ../../whatsnew/3.8.rst:401 msgid "" "Constructors of :class:`int`, :class:`float` and :class:`complex` will now " "use the :meth:`~object.__index__` special method, if available and the " -"corresponding method :meth:`~object.__int__`, :meth:`~object.__float__` or :" -"meth:`~object.__complex__` is not available. (Contributed by Serhiy " +"corresponding method :meth:`~object.__int__`, :meth:`~object.__float__` " +"or :meth:`~object.__complex__` is not available. (Contributed by Serhiy " "Storchaka in :issue:`20092`.)" msgstr "" @@ -680,8 +683,8 @@ msgstr "(由 Jonathan Eunice 和 Serhiy Storchaka 在 :issue:`30688` 中貢獻 #: ../../whatsnew/3.8.rst:416 msgid "" -"Dict and dictviews are now iterable in reversed insertion order using :func:" -"`reversed`. (Contributed by Rémi Lapeyre in :issue:`33462`.)" +"Dict and dictviews are now iterable in reversed insertion order " +"using :func:`reversed`. (Contributed by Rémi Lapeyre in :issue:`33462`.)" msgstr "" #: ../../whatsnew/3.8.rst:419 @@ -689,8 +692,8 @@ msgid "" "The syntax allowed for keyword names in function calls was further " "restricted. In particular, ``f((keyword)=arg)`` is no longer allowed. It was " "never intended to permit more than a bare name on the left-hand side of a " -"keyword argument assignment term. (Contributed by Benjamin Peterson in :" -"issue:`34641`.)" +"keyword argument assignment term. (Contributed by Benjamin Peterson " +"in :issue:`34641`.)" msgstr "" #: ../../whatsnew/3.8.rst:425 @@ -730,12 +733,13 @@ msgstr "" #: ../../whatsnew/3.8.rst:445 msgid "" -"Arithmetic operations between subclasses of :class:`datetime.date` or :class:" -"`datetime.datetime` and :class:`datetime.timedelta` objects now return an " -"instance of the subclass, rather than the base class. This also affects the " -"return type of operations whose implementation (directly or indirectly) " -"uses :class:`datetime.timedelta` arithmetic, such as :meth:`~datetime." -"datetime.astimezone`. (Contributed by Paul Ganssle in :issue:`32417`.)" +"Arithmetic operations between subclasses of :class:`datetime.date` " +"or :class:`datetime.datetime` and :class:`datetime.timedelta` objects now " +"return an instance of the subclass, rather than the base class. This also " +"affects the return type of operations whose implementation (directly or " +"indirectly) uses :class:`datetime.timedelta` arithmetic, such " +"as :meth:`~datetime.datetime.astimezone`. (Contributed by Paul Ganssle " +"in :issue:`32417`.)" msgstr "" #: ../../whatsnew/3.8.rst:453 @@ -750,12 +754,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:460 msgid "" -"Some advanced styles of programming require updating the :class:`types." -"CodeType` object for an existing function. Since code objects are " -"immutable, a new code object needs to be created, one that is modeled on the " -"existing code object. With 19 parameters, this was somewhat tedious. Now, " -"the new ``replace()`` method makes it possible to create a clone with a few " -"altered parameters." +"Some advanced styles of programming require updating " +"the :class:`types.CodeType` object for an existing function. Since code " +"objects are immutable, a new code object needs to be created, one that is " +"modeled on the existing code object. With 19 parameters, this was somewhat " +"tedious. Now, the new ``replace()`` method makes it possible to create a " +"clone with a few altered parameters." msgstr "" #: ../../whatsnew/3.8.rst:467 @@ -877,9 +881,9 @@ msgid "" "elements long. Formerly, five was the limit. The new, optional sixth " "element is a callable with a ``(obj, state)`` signature. This allows the " "direct control over the state-updating behavior of a specific object. If " -"not *None*, this callable will have priority over the object's :meth:" -"`~__setstate__` method. (Contributed by Pierre Glaser and Olivier Grisel in :" -"issue:`35900`.)" +"not *None*, this callable will have priority over the " +"object's :meth:`~__setstate__` method. (Contributed by Pierre Glaser and " +"Olivier Grisel in :issue:`35900`.)" msgstr "" #: ../../whatsnew/3.8.rst:543 @@ -946,8 +950,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:584 msgid "" -"``type_comments=True`` causes it to return the text of :pep:`484` and :pep:" -"`526` type comments associated with certain AST nodes;" +"``type_comments=True`` causes it to return the text of :pep:`484` " +"and :pep:`526` type comments associated with certain AST nodes;" msgstr "" #: ../../whatsnew/3.8.rst:587 @@ -959,8 +963,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:590 msgid "" "``feature_version=(3, N)`` allows specifying an earlier Python 3 version. " -"For example, ``feature_version=(3, 4)`` will treat :keyword:`async` and :" -"keyword:`await` as non-reserved words." +"For example, ``feature_version=(3, 4)`` will treat :keyword:`async` " +"and :keyword:`await` as non-reserved words." msgstr "" #: ../../whatsnew/3.8.rst:594 @@ -1032,8 +1036,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:629 msgid "" -"The actual implementation is significantly more complex. Thus, :func:" -"`asyncio.run` should be the preferred way of running asyncio programs." +"The actual implementation is significantly more complex. " +"Thus, :func:`asyncio.run` should be the preferred way of running asyncio " +"programs." msgstr "" #: ../../whatsnew/3.8.rst:632 @@ -1074,16 +1079,17 @@ msgstr "(由 Yury Selivanov 在 :issue:`37028` 中貢獻。)" #: ../../whatsnew/3.8.rst:651 ../../whatsnew/3.8.rst:1970 msgid "" -"The exception :class:`asyncio.CancelledError` now inherits from :class:" -"`BaseException` rather than :class:`Exception` and no longer inherits from :" -"class:`concurrent.futures.CancelledError`. (Contributed by Yury Selivanov " -"in :issue:`32528`.)" +"The exception :class:`asyncio.CancelledError` now inherits " +"from :class:`BaseException` rather than :class:`Exception` and no longer " +"inherits from :class:`concurrent.futures.CancelledError`. (Contributed by " +"Yury Selivanov in :issue:`32528`.)" msgstr "" #: ../../whatsnew/3.8.rst:656 msgid "" -"On Windows, the default event loop is now :class:`~asyncio." -"ProactorEventLoop`. (Contributed by Victor Stinner in :issue:`34687`.)" +"On Windows, the default event loop is " +"now :class:`~asyncio.ProactorEventLoop`. (Contributed by Victor Stinner " +"in :issue:`34687`.)" msgstr "" #: ../../whatsnew/3.8.rst:659 @@ -1094,9 +1100,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:662 msgid "" -":class:`~asyncio.ProactorEventLoop` can now be interrupted by :exc:" -"`KeyboardInterrupt` (\"CTRL+C\"). (Contributed by Vladimir Matveev in :issue:" -"`23057`.)" +":class:`~asyncio.ProactorEventLoop` can now be interrupted " +"by :exc:`KeyboardInterrupt` (\"CTRL+C\"). (Contributed by Vladimir Matveev " +"in :issue:`23057`.)" msgstr "" #: ../../whatsnew/3.8.rst:666 @@ -1108,12 +1114,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:670 msgid "" "Asyncio tasks can now be named, either by passing the ``name`` keyword " -"argument to :func:`asyncio.create_task` or the :meth:`~asyncio.loop." -"create_task` event loop method, or by calling the :meth:`~asyncio.Task." -"set_name` method on the task object. The task name is visible in the " -"``repr()`` output of :class:`asyncio.Task` and can also be retrieved using " -"the :meth:`~asyncio.Task.get_name` method. (Contributed by Alex Grönholm in :" -"issue:`34270`.)" +"argument to :func:`asyncio.create_task` or " +"the :meth:`~asyncio.loop.create_task` event loop method, or by calling " +"the :meth:`~asyncio.Task.set_name` method on the task object. The task name " +"is visible in the ``repr()`` output of :class:`asyncio.Task` and can also be " +"retrieved using the :meth:`~asyncio.Task.get_name` method. (Contributed by " +"Alex Grönholm in :issue:`34270`.)" msgstr "" #: ../../whatsnew/3.8.rst:678 @@ -1132,12 +1138,12 @@ msgstr "builtins(內建)" #: ../../whatsnew/3.8.rst:690 msgid "" -"The :func:`compile` built-in has been improved to accept the ``ast." -"PyCF_ALLOW_TOP_LEVEL_AWAIT`` flag. With this new flag passed, :func:" -"`compile` will allow top-level ``await``, ``async for`` and ``async with`` " -"constructs that are usually considered invalid syntax. Asynchronous code " -"object marked with the ``CO_COROUTINE`` flag may then be returned. " -"(Contributed by Matthias Bussonnier in :issue:`34616`)" +"The :func:`compile` built-in has been improved to accept the " +"``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` flag. With this new flag " +"passed, :func:`compile` will allow top-level ``await``, ``async for`` and " +"``async with`` constructs that are usually considered invalid syntax. " +"Asynchronous code object marked with the ``CO_COROUTINE`` flag may then be " +"returned. (Contributed by Matthias Bussonnier in :issue:`34616`)" msgstr "" #: ../../whatsnew/3.8.rst:699 @@ -1146,13 +1152,13 @@ msgstr "collections" #: ../../whatsnew/3.8.rst:701 msgid "" -"The :meth:`~collections.somenamedtuple._asdict` method for :func:" -"`collections.namedtuple` now returns a :class:`dict` instead of a :class:" -"`collections.OrderedDict`. This works because regular dicts have guaranteed " -"ordering since Python 3.7. If the extra features of :class:`OrderedDict` are " -"required, the suggested remediation is to cast the result to the desired " -"type: ``OrderedDict(nt._asdict())``. (Contributed by Raymond Hettinger in :" -"issue:`35864`.)" +"The :meth:`~collections.somenamedtuple._asdict` method " +"for :func:`collections.namedtuple` now returns a :class:`dict` instead of " +"a :class:`collections.OrderedDict`. This works because regular dicts have " +"guaranteed ordering since Python 3.7. If the extra features " +"of :class:`OrderedDict` are required, the suggested remediation is to cast " +"the result to the desired type: ``OrderedDict(nt._asdict())``. (Contributed " +"by Raymond Hettinger in :issue:`35864`.)" msgstr "" #: ../../whatsnew/3.8.rst:711 @@ -1211,8 +1217,9 @@ msgid "" "parameter to specify flags for the underlying ``LoadLibraryEx`` call. The " "default flags are set to only load DLL dependencies from trusted locations, " "including the path where the DLL is stored (if a full or partial path is " -"used to load the initial DLL) and paths added by :func:`~os." -"add_dll_directory`. (Contributed by Steve Dower in :issue:`36085`.)" +"used to load the initial DLL) and paths added " +"by :func:`~os.add_dll_directory`. (Contributed by Steve Dower " +"in :issue:`36085`.)" msgstr "" #: ../../whatsnew/3.8.rst:754 @@ -1221,11 +1228,12 @@ msgstr "datetime" #: ../../whatsnew/3.8.rst:756 msgid "" -"Added new alternate constructors :meth:`datetime.date.fromisocalendar` and :" -"meth:`datetime.datetime.fromisocalendar`, which construct :class:`~datetime." -"date` and :class:`~datetime.datetime` objects respectively from ISO year, " -"week number, and weekday; these are the inverse of each class's " -"``isocalendar`` method. (Contributed by Paul Ganssle in :issue:`36004`.)" +"Added new alternate constructors :meth:`datetime.date.fromisocalendar` " +"and :meth:`datetime.datetime.fromisocalendar`, which " +"construct :class:`~datetime.date` and :class:`~datetime.datetime` objects " +"respectively from ISO year, week number, and weekday; these are the inverse " +"of each class's ``isocalendar`` method. (Contributed by Paul Ganssle " +"in :issue:`36004`.)" msgstr "" #: ../../whatsnew/3.8.rst:764 @@ -1298,8 +1306,8 @@ msgstr "(由 Carl Meyer 在 :issue:`21145` 中貢獻)" #: ../../whatsnew/3.8.rst:796 msgid "" "Added a new :func:`functools.singledispatchmethod` decorator that converts " -"methods into :term:`generic functions <generic function>` using :term:" -"`single dispatch`::" +"methods into :term:`generic functions <generic function>` " +"using :term:`single dispatch`::" msgstr "" #: ../../whatsnew/3.8.rst:800 @@ -1410,8 +1418,8 @@ msgid "" "Added optional line numbers for IDLE editor windows. Windows open without " "line numbers unless set otherwise in the General tab of the configuration " "dialog. Line numbers for an existing window are shown and hidden in the " -"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar in :issue:" -"`17535`.)" +"Options menu. (Contributed by Tal Einat and Saimadhav Heblikar " +"in :issue:`17535`.)" msgstr "" #: ../../whatsnew/3.8.rst:869 @@ -1430,8 +1438,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:878 msgid "" -"Add option to toggle cursor blink off. (Contributed by Zackery Spytz in :" -"issue:`4603`.)" +"Add option to toggle cursor blink off. (Contributed by Zackery Spytz " +"in :issue:`4603`.)" msgstr "" #: ../../whatsnew/3.8.rst:881 @@ -1590,8 +1598,8 @@ msgstr "(由 Pablo Galindo 在 :issue:`35606` 中貢獻。)" #: ../../whatsnew/3.8.rst:975 msgid "" -"Added two new combinatoric functions :func:`math.perm` and :func:`math." -"comb`::" +"Added two new combinatoric functions :func:`math.perm` " +"and :func:`math.comb`::" msgstr "" #: ../../whatsnew/3.8.rst:977 @@ -1607,8 +1615,8 @@ msgid "" "(Contributed by Yash Aggarwal, Keller Fuchs, Serhiy Storchaka, and Raymond " "Hettinger in :issue:`37128`, :issue:`37178`, and :issue:`35431`.)" msgstr "" -"(由 Yash Aggarwal、Keller Fuchs、Serhiy Storchaka 和 Raymond Hettinger 在 :" -"issue:`37128`、:issue:`37178` 和 :issue:`35431` 中貢獻。)" +"(由 Yash Aggarwal、Keller Fuchs、Serhiy Storchaka 和 Raymond Hettinger " +"在 :issue:`37128`、:issue:`37178` 和 :issue:`35431` 中貢獻。)" #: ../../whatsnew/3.8.rst:985 msgid "" @@ -1627,6 +1635,12 @@ msgid "" ">>> floor(sqrt(s - 1)) # incorrect\n" "650320427" msgstr "" +">>> r = 650320427\n" +">>> s = r ** 2\n" +">>> isqrt(s - 1) # 正確\n" +"650320426\n" +">>> floor(sqrt(s - 1)) # 錯誤\n" +"650320427" #: ../../whatsnew/3.8.rst:997 msgid "(Contributed by Mark Dickinson in :issue:`36887`.)" @@ -1645,8 +1659,8 @@ msgstr "mmap" #: ../../whatsnew/3.8.rst:1006 msgid "" "The :class:`mmap.mmap` class now has an :meth:`~mmap.mmap.madvise` method to " -"access the ``madvise()`` system call. (Contributed by Zackery Spytz in :" -"issue:`32941`.)" +"access the ``madvise()`` system call. (Contributed by Zackery Spytz " +"in :issue:`32941`.)" msgstr "" #: ../../whatsnew/3.8.rst:1012 @@ -1673,8 +1687,8 @@ msgstr "os" msgid "" "Added new function :func:`~os.add_dll_directory` on Windows for providing " "additional search paths for native dependencies when importing extension " -"modules or loading DLLs using :mod:`ctypes`. (Contributed by Steve Dower in :" -"issue:`36085`.)" +"modules or loading DLLs using :mod:`ctypes`. (Contributed by Steve Dower " +"in :issue:`36085`.)" msgstr "" #: ../../whatsnew/3.8.rst:1029 @@ -1690,11 +1704,11 @@ msgid "" "symlinks and directory junctions) has been delegated to the operating " "system. Specifically, :func:`os.stat` will now traverse anything supported " "by the operating system, while :func:`os.lstat` will only open reparse " -"points that identify as \"name surrogates\" while others are opened as for :" -"func:`os.stat`. In all cases, :attr:`stat_result.st_mode` will only have " -"``S_IFLNK`` set for symbolic links and not other kinds of reparse points. To " -"identify other kinds of reparse point, check the new :attr:`stat_result." -"st_reparse_tag` attribute." +"points that identify as \"name surrogates\" while others are opened as " +"for :func:`os.stat`. In all cases, :attr:`stat_result.st_mode` will only " +"have ``S_IFLNK`` set for symbolic links and not other kinds of reparse " +"points. To identify other kinds of reparse point, check the " +"new :attr:`stat_result.st_reparse_tag` attribute." msgstr "" #: ../../whatsnew/3.8.rst:1042 @@ -1702,8 +1716,8 @@ msgid "" "On Windows, :func:`os.readlink` is now able to read directory junctions. " "Note that :func:`~os.path.islink` will return ``False`` for directory " "junctions, and so code that checks ``islink`` first will continue to treat " -"junctions as directories, while code that handles errors from :func:`os." -"readlink` may now treat junctions as links." +"junctions as directories, while code that handles errors " +"from :func:`os.readlink` may now treat junctions as links." msgstr "" #: ../../whatsnew/3.8.rst:1048 ../../whatsnew/3.8.rst:1073 @@ -1716,21 +1730,21 @@ msgstr "os.path" #: ../../whatsnew/3.8.rst:1054 msgid "" -":mod:`os.path` functions that return a boolean result like :func:`~os.path." -"exists`, :func:`~os.path.lexists`, :func:`~os.path.isdir`, :func:`~os.path." -"isfile`, :func:`~os.path.islink`, and :func:`~os.path.ismount` now return " -"``False`` instead of raising :exc:`ValueError` or its subclasses :exc:" -"`UnicodeEncodeError` and :exc:`UnicodeDecodeError` for paths that contain " -"characters or bytes unrepresentable at the OS level. (Contributed by Serhiy " -"Storchaka in :issue:`33721`.)" +":mod:`os.path` functions that return a boolean result " +"like :func:`~os.path.exists`, :func:`~os.path.lexists`, :func:`~os.path.isdir`, :func:`~os.path.isfile`, :func:`~os.path.islink`, " +"and :func:`~os.path.ismount` now return ``False`` instead of " +"raising :exc:`ValueError` or its subclasses :exc:`UnicodeEncodeError` " +"and :exc:`UnicodeDecodeError` for paths that contain characters or bytes " +"unrepresentable at the OS level. (Contributed by Serhiy Storchaka " +"in :issue:`33721`.)" msgstr "" #: ../../whatsnew/3.8.rst:1062 ../../whatsnew/3.8.rst:1965 msgid "" ":func:`~os.path.expanduser` on Windows now prefers the :envvar:`USERPROFILE` " "environment variable and does not use :envvar:`HOME`, which is not normally " -"set for regular user accounts. (Contributed by Anthony Sottile in :issue:" -"`36264`.)" +"set for regular user accounts. (Contributed by Anthony Sottile " +"in :issue:`36264`.)" msgstr "" #: ../../whatsnew/3.8.rst:1067 @@ -1751,14 +1765,12 @@ msgstr "pathlib" #: ../../whatsnew/3.8.rst:1079 msgid "" -":mod:`pathlib.Path` methods that return a boolean result like :meth:" -"`~pathlib.Path.exists`, :meth:`~pathlib.Path.is_dir`, :meth:`~pathlib.Path." -"is_file`, :meth:`~pathlib.Path.is_mount`, :meth:`~pathlib.Path.is_symlink`, :" -"meth:`~pathlib.Path.is_block_device`, :meth:`~pathlib.Path.is_char_device`, :" -"meth:`~pathlib.Path.is_fifo`, :meth:`~pathlib.Path.is_socket` now return " -"``False`` instead of raising :exc:`ValueError` or its subclass :exc:" -"`UnicodeEncodeError` for paths that contain characters unrepresentable at " -"the OS level. (Contributed by Serhiy Storchaka in :issue:`33721`.)" +":mod:`pathlib.Path` methods that return a boolean result " +"like :meth:`~pathlib.Path.exists`, :meth:`~pathlib.Path.is_dir`, :meth:`~pathlib.Path.is_file`, :meth:`~pathlib.Path.is_mount`, :meth:`~pathlib.Path.is_symlink`, :meth:`~pathlib.Path.is_block_device`, :meth:`~pathlib.Path.is_char_device`, :meth:`~pathlib.Path.is_fifo`, :meth:`~pathlib.Path.is_socket` " +"now return ``False`` instead of raising :exc:`ValueError` or its " +"subclass :exc:`UnicodeEncodeError` for paths that contain characters " +"unrepresentable at the OS level. (Contributed by Serhiy Storchaka " +"in :issue:`33721`.)" msgstr "" #: ../../whatsnew/3.8.rst:1089 @@ -1776,10 +1788,11 @@ msgstr "pickle" #: ../../whatsnew/3.8.rst:1100 msgid "" -":mod:`pickle` extensions subclassing the C-optimized :class:`~pickle." -"Pickler` can now override the pickling logic of functions and classes by " -"defining the special :meth:`~pickle.Pickler.reducer_override` method. " -"(Contributed by Pierre Glaser and Olivier Grisel in :issue:`35900`.)" +":mod:`pickle` extensions subclassing the C-" +"optimized :class:`~pickle.Pickler` can now override the pickling logic of " +"functions and classes by defining the " +"special :meth:`~pickle.Pickler.reducer_override` method. (Contributed by " +"Pierre Glaser and Olivier Grisel in :issue:`35900`.)" msgstr "" #: ../../whatsnew/3.8.rst:1107 @@ -1789,8 +1802,8 @@ msgstr "plistlib" #: ../../whatsnew/3.8.rst:1109 msgid "" "Added new :class:`plistlib.UID` and enabled support for reading and writing " -"NSKeyedArchiver-encoded binary plists. (Contributed by Jon Janzen in :issue:" -"`26707`.)" +"NSKeyedArchiver-encoded binary plists. (Contributed by Jon Janzen " +"in :issue:`26707`.)" msgstr "" #: ../../whatsnew/3.8.rst:1115 @@ -1815,8 +1828,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:1126 msgid "" ">>> from pprint import pprint, pp\n" -">>> d = dict(source='input.txt', operation='filter', destination='output." -"txt')\n" +">>> d = dict(source='input.txt', operation='filter', " +"destination='output.txt')\n" ">>> pp(d, width=40) # Original order\n" "{'source': 'input.txt',\n" " 'operation': 'filter',\n" @@ -1847,8 +1860,8 @@ msgstr "shlex" #: ../../whatsnew/3.8.rst:1150 msgid "" -"The new :func:`shlex.join` function acts as the inverse of :func:`shlex." -"split`. (Contributed by Bo Bayles in :issue:`32102`.)" +"The new :func:`shlex.join` function acts as the inverse " +"of :func:`shlex.split`. (Contributed by Bo Bayles in :issue:`32102`.)" msgstr "" #: ../../whatsnew/3.8.rst:1155 @@ -1872,8 +1885,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:1165 msgid "" ":func:`shutil.rmtree` on Windows now removes directory junctions without " -"recursively removing their contents first. (Contributed by Steve Dower in :" -"issue:`37834`.)" +"recursively removing their contents first. (Contributed by Steve Dower " +"in :issue:`37834`.)" msgstr "" #: ../../whatsnew/3.8.rst:1171 @@ -1890,9 +1903,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:1178 msgid "" -"The :func:`socket.if_nameindex`, :func:`socket.if_nametoindex`, and :func:" -"`socket.if_indextoname` functions have been implemented on Windows. " -"(Contributed by Zackery Spytz in :issue:`37007`.)" +"The :func:`socket.if_nameindex`, :func:`socket.if_nametoindex`, " +"and :func:`socket.if_indextoname` functions have been implemented on " +"Windows. (Contributed by Zackery Spytz in :issue:`37007`.)" msgstr "" #: ../../whatsnew/3.8.rst:1184 @@ -1901,9 +1914,10 @@ msgstr "ssl" #: ../../whatsnew/3.8.rst:1186 msgid "" -"Added :attr:`~ssl.SSLContext.post_handshake_auth` to enable and :meth:`~ssl." -"SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 post-handshake " -"authentication. (Contributed by Christian Heimes in :issue:`34670`.)" +"Added :attr:`~ssl.SSLContext.post_handshake_auth` to enable " +"and :meth:`~ssl.SSLSocket.verify_client_post_handshake` to initiate TLS 1.3 " +"post-handshake authentication. (Contributed by Christian Heimes " +"in :issue:`34670`.)" msgstr "" #: ../../whatsnew/3.8.rst:1193 @@ -1912,9 +1926,9 @@ msgstr "statistics" #: ../../whatsnew/3.8.rst:1195 msgid "" -"Added :func:`statistics.fmean` as a faster, floating-point variant of :func:" -"`statistics.mean`. (Contributed by Raymond Hettinger and Steven D'Aprano " -"in :issue:`35904`.)" +"Added :func:`statistics.fmean` as a faster, floating-point variant " +"of :func:`statistics.mean`. (Contributed by Raymond Hettinger and Steven " +"D'Aprano in :issue:`35904`.)" msgstr "" #: ../../whatsnew/3.8.rst:1199 @@ -1922,8 +1936,8 @@ msgid "" "Added :func:`statistics.geometric_mean` (Contributed by Raymond Hettinger " "in :issue:`27181`.)" msgstr "" -"新增 :func:`statistics.geometric_mean`\\ (由 Raymond Hettinger 在 :issue:" -"`27181` 中貢獻。)" +"新增 :func:`statistics.geometric_mean`\\ (由 Raymond Hettinger " +"在 :issue:`27181` 中貢獻。)" #: ../../whatsnew/3.8.rst:1202 msgid "" @@ -2002,20 +2016,21 @@ msgstr "threading" #: ../../whatsnew/3.8.rst:1262 msgid "" -"Add a new :func:`threading.excepthook` function which handles uncaught :meth:" -"`threading.Thread.run` exception. It can be overridden to control how " -"uncaught :meth:`threading.Thread.run` exceptions are handled. (Contributed " -"by Victor Stinner in :issue:`1230540`.)" +"Add a new :func:`threading.excepthook` function which handles " +"uncaught :meth:`threading.Thread.run` exception. It can be overridden to " +"control how uncaught :meth:`threading.Thread.run` exceptions are handled. " +"(Contributed by Victor Stinner in :issue:`1230540`.)" msgstr "" #: ../../whatsnew/3.8.rst:1267 msgid "" -"Add a new :func:`threading.get_native_id` function and a :data:`~threading." -"Thread.native_id` attribute to the :class:`threading.Thread` class. These " -"return the native integral Thread ID of the current thread assigned by the " -"kernel. This feature is only available on certain platforms, see :func:" -"`get_native_id <threading.get_native_id>` for more information. (Contributed " -"by Jake Tesler in :issue:`36084`.)" +"Add a new :func:`threading.get_native_id` function and " +"a :data:`~threading.Thread.native_id` attribute to " +"the :class:`threading.Thread` class. These return the native integral Thread " +"ID of the current thread assigned by the kernel. This feature is only " +"available on certain platforms, see :func:`get_native_id " +"<threading.get_native_id>` for more information. (Contributed by Jake Tesler " +"in :issue:`36084`.)" msgstr "" #: ../../whatsnew/3.8.rst:1277 @@ -2036,10 +2051,10 @@ msgstr "tkinter" #: ../../whatsnew/3.8.rst:1288 msgid "" -"Added methods :meth:`~tkinter.Spinbox.selection_from`, :meth:`~tkinter." -"Spinbox.selection_present`, :meth:`~tkinter.Spinbox.selection_range` and :" -"meth:`~tkinter.Spinbox.selection_to` in the :class:`tkinter.Spinbox` class. " -"(Contributed by Juliette Monsel in :issue:`34829`.)" +"Added " +"methods :meth:`~tkinter.Spinbox.selection_from`, :meth:`~tkinter.Spinbox.selection_present`, :meth:`~tkinter.Spinbox.selection_range` " +"and :meth:`~tkinter.Spinbox.selection_to` in the :class:`tkinter.Spinbox` " +"class. (Contributed by Juliette Monsel in :issue:`34829`.)" msgstr "" #: ../../whatsnew/3.8.rst:1295 @@ -2050,9 +2065,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:1299 msgid "" -"The :class:`tkinter.PhotoImage` class now has :meth:`~tkinter.PhotoImage." -"transparency_get` and :meth:`~tkinter.PhotoImage.transparency_set` methods. " -"(Contributed by Zackery Spytz in :issue:`25451`.)" +"The :class:`tkinter.PhotoImage` class now " +"has :meth:`~tkinter.PhotoImage.transparency_get` " +"and :meth:`~tkinter.PhotoImage.transparency_set` methods. (Contributed by " +"Zackery Spytz in :issue:`25451`.)" msgstr "" #: ../../whatsnew/3.8.rst:1306 @@ -2075,10 +2091,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:1317 msgid "" -"A dictionary type with per-key types. See :pep:`589` and :class:`typing." -"TypedDict`. TypedDict uses only string keys. By default, every key is " -"required to be present. Specify \"total=False\" to allow keys to be " -"optional::" +"A dictionary type with per-key types. See :pep:`589` " +"and :class:`typing.TypedDict`. TypedDict uses only string keys. By default, " +"every key is required to be present. Specify \"total=False\" to allow keys " +"to be optional::" msgstr "" #: ../../whatsnew/3.8.rst:1322 @@ -2110,9 +2126,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:1334 msgid "" -"\"Final\" variables, functions, methods and classes. See :pep:`591`, :class:" -"`typing.Final` and :func:`typing.final`. The final qualifier instructs a " -"static type checker to restrict subclassing, overriding, or reassignment::" +"\"Final\" variables, functions, methods and classes. " +"See :pep:`591`, :class:`typing.Final` and :func:`typing.final`. The final " +"qualifier instructs a static type checker to restrict subclassing, " +"overriding, or reassignment::" msgstr "" #: ../../whatsnew/3.8.rst:1339 @@ -2121,9 +2138,9 @@ msgstr "pi: Final[float] = 3.1415926536" #: ../../whatsnew/3.8.rst:1341 msgid "" -"Protocol definitions. See :pep:`544`, :class:`typing.Protocol` and :func:" -"`typing.runtime_checkable`. Simple ABCs like :class:`typing.SupportsInt` " -"are now ``Protocol`` subclasses." +"Protocol definitions. See :pep:`544`, :class:`typing.Protocol` " +"and :func:`typing.runtime_checkable`. Simple ABCs " +"like :class:`typing.SupportsInt` are now ``Protocol`` subclasses." msgstr "" #: ../../whatsnew/3.8.rst:1345 @@ -2160,16 +2177,17 @@ msgstr "unittest" msgid "" "Added :class:`~unittest.mock.AsyncMock` to support an asynchronous version " "of :class:`~unittest.mock.Mock`. Appropriate new assert functions for " -"testing have been added as well. (Contributed by Lisa Roach in :issue:" -"`26467`)." +"testing have been added as well. (Contributed by Lisa Roach " +"in :issue:`26467`)." msgstr "" #: ../../whatsnew/3.8.rst:1370 msgid "" -"Added :func:`~unittest.addModuleCleanup` and :meth:`~unittest.TestCase." -"addClassCleanup` to unittest to support cleanups for :func:`~unittest." -"setUpModule` and :meth:`~unittest.TestCase.setUpClass`. (Contributed by Lisa " -"Roach in :issue:`24412`.)" +"Added :func:`~unittest.addModuleCleanup` " +"and :meth:`~unittest.TestCase.addClassCleanup` to unittest to support " +"cleanups for :func:`~unittest.setUpModule` " +"and :meth:`~unittest.TestCase.setUpClass`. (Contributed by Lisa Roach " +"in :issue:`24412`.)" msgstr "" #: ../../whatsnew/3.8.rst:1376 @@ -2257,9 +2275,10 @@ msgstr "xml" #: ../../whatsnew/3.8.rst:1424 msgid "" -"As mitigation against DTD and external entity retrieval, the :mod:`xml.dom." -"minidom` and :mod:`xml.sax` modules no longer process external entities by " -"default. (Contributed by Christian Heimes in :issue:`17239`.)" +"As mitigation against DTD and external entity retrieval, " +"the :mod:`xml.dom.minidom` and :mod:`xml.sax` modules no longer process " +"external entities by default. (Contributed by Christian Heimes " +"in :issue:`17239`.)" msgstr "" #: ../../whatsnew/3.8.rst:1429 @@ -2272,19 +2291,20 @@ msgstr "" #: ../../whatsnew/3.8.rst:1434 msgid "" -"The :mod:`xml.etree.ElementTree` module provides a new function :func:`–xml." -"etree.ElementTree.canonicalize` that implements C14N 2.0. (Contributed by " -"Stefan Behnel in :issue:`13611`.)" +"The :mod:`xml.etree.ElementTree` module provides a new function :func:`–" +"xml.etree.ElementTree.canonicalize` that implements C14N 2.0. (Contributed " +"by Stefan Behnel in :issue:`13611`.)" msgstr "" #: ../../whatsnew/3.8.rst:1438 msgid "" "The target object of :class:`xml.etree.ElementTree.XMLParser` can receive " "namespace declaration events through the new callback methods ``start_ns()`` " -"and ``end_ns()``. Additionally, the :class:`xml.etree.ElementTree." -"TreeBuilder` target can be configured to process events about comments and " -"processing instructions to include them in the generated tree. (Contributed " -"by Stefan Behnel in :issue:`36676` and :issue:`36673`.)" +"and ``end_ns()``. Additionally, " +"the :class:`xml.etree.ElementTree.TreeBuilder` target can be configured to " +"process events about comments and processing instructions to include them in " +"the generated tree. (Contributed by Stefan Behnel in :issue:`36676` " +"and :issue:`36673`.)" msgstr "" #: ../../whatsnew/3.8.rst:1448 @@ -2331,15 +2351,15 @@ msgstr "(由 Joannah Nanjekye 和 Victor Stinner 在 :issue:`35537` 中貢獻 #: ../../whatsnew/3.8.rst:1471 msgid "" -":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:" -"`shutil.copytree` and :func:`shutil.move` use platform-specific \"fast-" -"copy\" syscalls on Linux and macOS in order to copy the file more " -"efficiently. \"fast-copy\" means that the copying operation occurs within " -"the kernel, avoiding the use of userspace buffers in Python as in \"``outfd." -"write(infd.read())``\". On Windows :func:`shutil.copyfile` uses a bigger " -"default buffer size (1 MiB instead of 16 KiB) and a :func:`memoryview`-based " -"variant of :func:`shutil.copyfileobj` is used. The speedup for copying a 512 " -"MiB file within the same partition is about +26% on Linux, +50% on macOS and " +":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:`shutil.copytree` " +"and :func:`shutil.move` use platform-specific \"fast-copy\" syscalls on " +"Linux and macOS in order to copy the file more efficiently. \"fast-copy\" " +"means that the copying operation occurs within the kernel, avoiding the use " +"of userspace buffers in Python as in \"``outfd.write(infd.read())``\". On " +"Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " +"instead of 16 KiB) and a :func:`memoryview`-based variant " +"of :func:`shutil.copyfileobj` is used. The speedup for copying a 512 MiB " +"file within the same partition is about +26% on Linux, +50% on macOS and " "+40% on Windows. Also, much less CPU cycles are consumed. See :ref:`shutil-" "platform-dependent-efficient-copy-operations` section. (Contributed by " "Giampaolo Rodolà in :issue:`33671`.)" @@ -2411,27 +2431,27 @@ msgstr "" msgid "" "Reduced an overhead of converting arguments passed to many builtin functions " "and methods. This sped up calling some simple builtin functions and methods " -"up to 20--50%. (Contributed by Serhiy Storchaka in :issue:`23867`, :issue:" -"`35582` and :issue:`36127`.)" +"up to 20--50%. (Contributed by Serhiy Storchaka " +"in :issue:`23867`, :issue:`35582` and :issue:`36127`.)" msgstr "" #: ../../whatsnew/3.8.rst:1531 msgid "" "``LOAD_GLOBAL`` instruction now uses new \"per opcode cache\" mechanism. It " -"is about 40% faster now. (Contributed by Yury Selivanov and Inada Naoki in :" -"issue:`26219`.)" +"is about 40% faster now. (Contributed by Yury Selivanov and Inada Naoki " +"in :issue:`26219`.)" msgstr "" #: ../../whatsnew/3.8.rst:1537 msgid "Build and C API Changes" -msgstr "" +msgstr "建置和 C API 變更" #: ../../whatsnew/3.8.rst:1539 msgid "" "Default :data:`sys.abiflags` became an empty string: the ``m`` flag for " "pymalloc became useless (builds with and without pymalloc are ABI " -"compatible) and so has been removed. (Contributed by Victor Stinner in :" -"issue:`36707`.)" +"compatible) and so has been removed. (Contributed by Victor Stinner " +"in :issue:`36707`.)" msgstr "" #: ../../whatsnew/3.8.rst:1543 @@ -2531,8 +2551,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:1587 msgid "" "The result of :c:func:`PyExceptionClass_Name` is now of type ``const char " -"*`` rather of ``char *``. (Contributed by Serhiy Storchaka in :issue:" -"`33818`.)" +"*`` rather of ``char *``. (Contributed by Serhiy Storchaka " +"in :issue:`33818`.)" msgstr "" #: ../../whatsnew/3.8.rst:1591 @@ -2560,27 +2580,28 @@ msgstr "(由 Antoine Pitrou 在 :issue:`32430` 中貢獻。)" #: ../../whatsnew/3.8.rst:1606 msgid "" -"Functions that convert Python number to C integer like :c:func:" -"`PyLong_AsLong` and argument parsing functions like :c:func:" -"`PyArg_ParseTuple` with integer converting format units like ``'i'`` will " -"now use the :meth:`~object.__index__` special method instead of :meth:" -"`~object.__int__`, if available. The deprecation warning will be emitted " -"for objects with the ``__int__()`` method but without the ``__index__()`` " -"method (like :class:`~decimal.Decimal` and :class:`~fractions.Fraction`). :" -"c:func:`PyNumber_Check` will now return ``1`` for objects implementing " -"``__index__()``. :c:func:`PyNumber_Long`, :c:func:`PyNumber_Float` and :c:" -"func:`PyFloat_AsDouble` also now use the ``__index__()`` method if " -"available. (Contributed by Serhiy Storchaka in :issue:`36048` and :issue:" -"`20092`.)" +"Functions that convert Python number to C integer " +"like :c:func:`PyLong_AsLong` and argument parsing functions " +"like :c:func:`PyArg_ParseTuple` with integer converting format units like " +"``'i'`` will now use the :meth:`~object.__index__` special method instead " +"of :meth:`~object.__int__`, if available. The deprecation warning will be " +"emitted for objects with the ``__int__()`` method but without the " +"``__index__()`` method (like :class:`~decimal.Decimal` " +"and :class:`~fractions.Fraction`). :c:func:`PyNumber_Check` will now return " +"``1`` for objects implementing " +"``__index__()``. :c:func:`PyNumber_Long`, :c:func:`PyNumber_Float` " +"and :c:func:`PyFloat_AsDouble` also now use the ``__index__()`` method if " +"available. (Contributed by Serhiy Storchaka in :issue:`36048` " +"and :issue:`20092`.)" msgstr "" #: ../../whatsnew/3.8.rst:1620 msgid "" -"Heap-allocated type objects will now increase their reference count in :c:" -"func:`PyObject_Init` (and its parallel macro ``PyObject_INIT``) instead of " -"in :c:func:`PyType_GenericAlloc`. Types that modify instance allocation or " -"deallocation may need to be adjusted. (Contributed by Eddie Elizondo in :" -"issue:`35810`.)" +"Heap-allocated type objects will now increase their reference count " +"in :c:func:`PyObject_Init` (and its parallel macro ``PyObject_INIT``) " +"instead of in :c:func:`PyType_GenericAlloc`. Types that modify instance " +"allocation or deallocation may need to be adjusted. (Contributed by Eddie " +"Elizondo in :issue:`35810`.)" msgstr "" #: ../../whatsnew/3.8.rst:1626 @@ -2594,8 +2615,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:1631 msgid "" ":c:func:`!Py_SetPath` now sets :data:`sys.executable` to the program full " -"path (:c:func:`Py_GetProgramFullPath`) rather than to the program name (:c:" -"func:`Py_GetProgramName`). (Contributed by Victor Stinner in :issue:`38234`.)" +"path (:c:func:`Py_GetProgramFullPath`) rather than to the program name " +"(:c:func:`Py_GetProgramName`). (Contributed by Victor Stinner " +"in :issue:`38234`.)" msgstr "" #: ../../whatsnew/3.8.rst:1638 @@ -2605,38 +2627,40 @@ msgstr "已棄用" #: ../../whatsnew/3.8.rst:1640 msgid "" "The distutils ``bdist_wininst`` command is now deprecated, use " -"``bdist_wheel`` (wheel packages) instead. (Contributed by Victor Stinner in :" -"issue:`37481`.)" +"``bdist_wheel`` (wheel packages) instead. (Contributed by Victor Stinner " +"in :issue:`37481`.)" msgstr "" #: ../../whatsnew/3.8.rst:1644 msgid "" -"Deprecated methods ``getchildren()`` and ``getiterator()`` in the :mod:`~xml." -"etree.ElementTree` module now emit a :exc:`DeprecationWarning` instead of :" -"exc:`PendingDeprecationWarning`. They will be removed in Python 3.9. " -"(Contributed by Serhiy Storchaka in :issue:`29209`.)" +"Deprecated methods ``getchildren()`` and ``getiterator()`` in " +"the :mod:`~xml.etree.ElementTree` module now emit " +"a :exc:`DeprecationWarning` instead of :exc:`PendingDeprecationWarning`. " +"They will be removed in Python 3.9. (Contributed by Serhiy Storchaka " +"in :issue:`29209`.)" msgstr "" #: ../../whatsnew/3.8.rst:1650 msgid "" -"Passing an object that is not an instance of :class:`concurrent.futures." -"ThreadPoolExecutor` to :meth:`loop.set_default_executor() <asyncio.loop." -"set_default_executor>` is deprecated and will be prohibited in Python 3.9. " -"(Contributed by Elvis Pranskevichus in :issue:`34075`.)" +"Passing an object that is not an instance " +"of :class:`concurrent.futures.ThreadPoolExecutor` " +"to :meth:`loop.set_default_executor() <asyncio.loop.set_default_executor>` " +"is deprecated and will be prohibited in Python 3.9. (Contributed by Elvis " +"Pranskevichus in :issue:`34075`.)" msgstr "" #: ../../whatsnew/3.8.rst:1656 msgid "" -"The :meth:`~object.__getitem__` methods of :class:`xml.dom.pulldom." -"DOMEventStream`, :class:`wsgiref.util.FileWrapper` and :class:`fileinput." -"FileInput` have been deprecated." +"The :meth:`~object.__getitem__` methods " +"of :class:`xml.dom.pulldom.DOMEventStream`, :class:`wsgiref.util.FileWrapper` " +"and :class:`fileinput.FileInput` have been deprecated." msgstr "" #: ../../whatsnew/3.8.rst:1660 msgid "" "Implementations of these methods have been ignoring their *index* parameter, " -"and returning the next item instead. (Contributed by Berker Peksag in :issue:" -"`9372`.)" +"and returning the next item instead. (Contributed by Berker Peksag " +"in :issue:`9372`.)" msgstr "" #: ../../whatsnew/3.8.rst:1664 @@ -2658,28 +2682,25 @@ msgstr "" msgid "" ":class:`ast.NodeVisitor` methods ``visit_Num()``, ``visit_Str()``, " "``visit_Bytes()``, ``visit_NameConstant()`` and ``visit_Ellipsis()`` are " -"deprecated now and will not be called in future Python versions. Add the :" -"meth:`~ast.NodeVisitor.visit_Constant` method to handle all constant nodes. " -"(Contributed by Serhiy Storchaka in :issue:`36917`.)" +"deprecated now and will not be called in future Python versions. Add " +"the :meth:`~ast.NodeVisitor.visit_Constant` method to handle all constant " +"nodes. (Contributed by Serhiy Storchaka in :issue:`36917`.)" msgstr "" #: ../../whatsnew/3.8.rst:1680 msgid "" "The :func:`asyncio.coroutine` :term:`decorator` is deprecated and will be " -"removed in version 3.10. Instead of ``@asyncio.coroutine``, use :keyword:" -"`async def` instead. (Contributed by Andrew Svetlov in :issue:`36921`.)" +"removed in version 3.10. Instead of ``@asyncio.coroutine``, " +"use :keyword:`async def` instead. (Contributed by Andrew Svetlov " +"in :issue:`36921`.)" msgstr "" #: ../../whatsnew/3.8.rst:1685 msgid "" "In :mod:`asyncio`, the explicit passing of a *loop* argument has been " -"deprecated and will be removed in version 3.10 for the following: :func:" -"`asyncio.sleep`, :func:`asyncio.gather`, :func:`asyncio.shield`, :func:" -"`asyncio.wait_for`, :func:`asyncio.wait`, :func:`asyncio.as_completed`, :" -"class:`asyncio.Task`, :class:`asyncio.Lock`, :class:`asyncio.Event`, :class:" -"`asyncio.Condition`, :class:`asyncio.Semaphore`, :class:`asyncio." -"BoundedSemaphore`, :class:`asyncio.Queue`, :func:`asyncio." -"create_subprocess_exec`, and :func:`asyncio.create_subprocess_shell`." +"deprecated and will be removed in version 3.10 for the " +"following: :func:`asyncio.sleep`, :func:`asyncio.gather`, :func:`asyncio.shield`, :func:`asyncio.wait_for`, :func:`asyncio.wait`, :func:`asyncio.as_completed`, :class:`asyncio.Task`, :class:`asyncio.Lock`, :class:`asyncio.Event`, :class:`asyncio.Condition`, :class:`asyncio.Semaphore`, :class:`asyncio.BoundedSemaphore`, :class:`asyncio.Queue`, :func:`asyncio.create_subprocess_exec`, " +"and :func:`asyncio.create_subprocess_shell`." msgstr "" #: ../../whatsnew/3.8.rst:1695 @@ -2692,22 +2713,23 @@ msgstr "" #: ../../whatsnew/3.8.rst:1699 msgid "" "The following functions and methods are deprecated in the :mod:`gettext` " -"module: :func:`~gettext.lgettext`, :func:`~gettext.ldgettext`, :func:" -"`~gettext.lngettext` and :func:`~gettext.ldngettext`. They return encoded " -"bytes, and it's possible that you will get unexpected Unicode-related " -"exceptions if there are encoding problems with the translated strings. It's " -"much better to use alternatives which return Unicode strings in Python 3. " -"These functions have been broken for a long time." +"module: :func:`~gettext.lgettext`, :func:`~gettext.ldgettext`, :func:`~gettext.lngettext` " +"and :func:`~gettext.ldngettext`. They return encoded bytes, and it's " +"possible that you will get unexpected Unicode-related exceptions if there " +"are encoding problems with the translated strings. It's much better to use " +"alternatives which return Unicode strings in Python 3. These functions have " +"been broken for a long time." msgstr "" #: ../../whatsnew/3.8.rst:1707 msgid "" -"Function :func:`~gettext.bind_textdomain_codeset`, methods :meth:`~gettext." -"NullTranslations.output_charset` and :meth:`~gettext.NullTranslations." -"set_output_charset`, and the *codeset* parameter of functions :func:" -"`~gettext.translation` and :func:`~gettext.install` are also deprecated, " -"since they are only used for the ``l*gettext()`` functions. (Contributed by " -"Serhiy Storchaka in :issue:`33710`.)" +"Function :func:`~gettext.bind_textdomain_codeset`, " +"methods :meth:`~gettext.NullTranslations.output_charset` " +"and :meth:`~gettext.NullTranslations.set_output_charset`, and the *codeset* " +"parameter of functions :func:`~gettext.translation` " +"and :func:`~gettext.install` are also deprecated, since they are only used " +"for the ``l*gettext()`` functions. (Contributed by Serhiy Storchaka " +"in :issue:`33710`.)" msgstr "" #: ../../whatsnew/3.8.rst:1715 @@ -2719,11 +2741,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:1719 msgid "" "Many builtin and extension functions that take integer arguments will now " -"emit a deprecation warning for :class:`~decimal.Decimal`\\ s, :class:" -"`~fractions.Fraction`\\ s and any other objects that can be converted to " -"integers only with a loss (e.g. that have the :meth:`~object.__int__` method " -"but do not have the :meth:`~object.__index__` method). In future version " -"they will be errors. (Contributed by Serhiy Storchaka in :issue:`36048`.)" +"emit a deprecation warning for :class:`~decimal.Decimal`\\ " +"s, :class:`~fractions.Fraction`\\ s and any other objects that can be " +"converted to integers only with a loss (e.g. that have " +"the :meth:`~object.__int__` method but do not have " +"the :meth:`~object.__index__` method). In future version they will be " +"errors. (Contributed by Serhiy Storchaka in :issue:`36048`.)" msgstr "" #: ../../whatsnew/3.8.rst:1727 @@ -2732,9 +2755,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:1729 msgid "" -"*func* in :func:`functools.partialmethod`, :func:`weakref.finalize`, :meth:" -"`profile.Profile.runcall`, :meth:`cProfile.Profile.runcall`, :meth:`bdb.Bdb." -"runcall`, :meth:`trace.Trace.runfunc` and :func:`curses.wrapper`." +"*func* " +"in :func:`functools.partialmethod`, :func:`weakref.finalize`, :meth:`profile.Profile.runcall`, :meth:`cProfile.Profile.runcall`, :meth:`bdb.Bdb.runcall`, :meth:`trace.Trace.runfunc` " +"and :func:`curses.wrapper`." msgstr "" #: ../../whatsnew/3.8.rst:1733 @@ -2743,23 +2766,23 @@ msgstr "" #: ../../whatsnew/3.8.rst:1734 msgid "" -"*fn* in the :meth:`~concurrent.futures.Executor.submit` method of :class:" -"`concurrent.futures.ThreadPoolExecutor` and :class:`concurrent.futures." -"ProcessPoolExecutor`." +"*fn* in the :meth:`~concurrent.futures.Executor.submit` method " +"of :class:`concurrent.futures.ThreadPoolExecutor` " +"and :class:`concurrent.futures.ProcessPoolExecutor`." msgstr "" #: ../../whatsnew/3.8.rst:1737 msgid "" -"*callback* in :meth:`contextlib.ExitStack.callback`, :meth:`contextlib." -"AsyncExitStack.callback` and :meth:`contextlib.AsyncExitStack." -"push_async_callback`." +"*callback* " +"in :meth:`contextlib.ExitStack.callback`, :meth:`contextlib.AsyncExitStack.callback` " +"and :meth:`contextlib.AsyncExitStack.push_async_callback`." msgstr "" #: ../../whatsnew/3.8.rst:1740 msgid "" "*c* and *typeid* in the :meth:`~multiprocessing.managers.Server.create` " -"method of :class:`multiprocessing.managers.Server` and :class:" -"`multiprocessing.managers.SharedMemoryServer`." +"method of :class:`multiprocessing.managers.Server` " +"and :class:`multiprocessing.managers.SharedMemoryServer`." msgstr "" #: ../../whatsnew/3.8.rst:1743 @@ -2774,7 +2797,7 @@ msgstr "" #: ../../whatsnew/3.8.rst:1751 msgid "API and Feature Removals" -msgstr "" +msgstr "API 與功能的移除" #: ../../whatsnew/3.8.rst:1753 msgid "The following features and APIs have been removed from Python 3.8:" @@ -2804,9 +2827,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:1767 msgid "" "The function :func:`time.clock` has been removed, after having been " -"deprecated since Python 3.3: use :func:`time.perf_counter` or :func:`time." -"process_time` instead, depending on your requirements, to have well-defined " -"behavior. (Contributed by Matthias Bussonnier in :issue:`36895`.)" +"deprecated since Python 3.3: use :func:`time.perf_counter` " +"or :func:`time.process_time` instead, depending on your requirements, to " +"have well-defined behavior. (Contributed by Matthias Bussonnier " +"in :issue:`36895`.)" msgstr "" #: ../../whatsnew/3.8.rst:1773 @@ -2839,14 +2863,15 @@ msgstr "" #: ../../whatsnew/3.8.rst:1789 msgid "" -"Removed the ``doctype()`` method of :class:`~xml.etree.ElementTree." -"XMLParser`. (Contributed by Serhiy Storchaka in :issue:`29209`.)" +"Removed the ``doctype()`` method " +"of :class:`~xml.etree.ElementTree.XMLParser`. (Contributed by Serhiy " +"Storchaka in :issue:`29209`.)" msgstr "" #: ../../whatsnew/3.8.rst:1792 msgid "" -"\"unicode_internal\" codec is removed. (Contributed by Inada Naoki in :issue:" -"`36297`.)" +"\"unicode_internal\" codec is removed. (Contributed by Inada Naoki " +"in :issue:`36297`.)" msgstr "" #: ../../whatsnew/3.8.rst:1795 @@ -2857,16 +2882,17 @@ msgstr "" #: ../../whatsnew/3.8.rst:1799 msgid "" -"The ``bufsize`` keyword argument of :func:`fileinput.input` and :func:" -"`fileinput.FileInput` which was ignored and deprecated since Python 3.6 has " -"been removed. :issue:`36952` (Contributed by Matthias Bussonnier.)" +"The ``bufsize`` keyword argument of :func:`fileinput.input` " +"and :func:`fileinput.FileInput` which was ignored and deprecated since " +"Python 3.6 has been removed. :issue:`36952` (Contributed by Matthias " +"Bussonnier.)" msgstr "" #: ../../whatsnew/3.8.rst:1803 msgid "" -"The functions :func:`sys.set_coroutine_wrapper` and :func:`sys." -"get_coroutine_wrapper` deprecated in Python 3.7 have been removed; :issue:" -"`36933` (Contributed by Matthias Bussonnier.)" +"The functions :func:`sys.set_coroutine_wrapper` " +"and :func:`sys.get_coroutine_wrapper` deprecated in Python 3.7 have been " +"removed; :issue:`36933` (Contributed by Matthias Bussonnier.)" msgstr "" #: ../../whatsnew/3.8.rst:1809 @@ -2881,7 +2907,7 @@ msgstr "" #: ../../whatsnew/3.8.rst:1816 msgid "Changes in Python behavior" -msgstr "" +msgstr "Python 行為的改變" #: ../../whatsnew/3.8.rst:1818 msgid "" @@ -2897,8 +2923,8 @@ msgid "" "(``is`` and ``is not``) are used with certain types of literals (e.g. " "strings, numbers). These can often work by accident in CPython, but are not " "guaranteed by the language spec. The warning advises users to use equality " -"tests (``==`` and ``!=``) instead. (Contributed by Serhiy Storchaka in :" -"issue:`34850`.)" +"tests (``==`` and ``!=``) instead. (Contributed by Serhiy Storchaka " +"in :issue:`34850`.)" msgstr "" #: ../../whatsnew/3.8.rst:1830 @@ -2911,12 +2937,12 @@ msgstr "" #: ../../whatsnew/3.8.rst:1835 msgid "" -"Removed ``__str__`` implementations from builtin types :class:`bool`, :class:" -"`int`, :class:`float`, :class:`complex` and few classes from the standard " -"library. They now inherit ``__str__()`` from :class:`object`. As result, " -"defining the ``__repr__()`` method in the subclass of these classes will " -"affect their string representation. (Contributed by Serhiy Storchaka in :" -"issue:`36793`.)" +"Removed ``__str__`` implementations from builtin " +"types :class:`bool`, :class:`int`, :class:`float`, :class:`complex` and few " +"classes from the standard library. They now inherit ``__str__()`` " +"from :class:`object`. As result, defining the ``__repr__()`` method in the " +"subclass of these classes will affect their string representation. " +"(Contributed by Serhiy Storchaka in :issue:`36793`.)" msgstr "" #: ../../whatsnew/3.8.rst:1842 @@ -2924,23 +2950,24 @@ msgid "" "On AIX, :data:`sys.platform` doesn't contain the major version anymore. It " "is always ``'aix'``, instead of ``'aix3'`` .. ``'aix7'``. Since older " "Python versions include the version number, so it is recommended to always " -"use ``sys.platform.startswith('aix')``. (Contributed by M. Felt in :issue:" -"`36588`.)" +"use ``sys.platform.startswith('aix')``. (Contributed by M. Felt " +"in :issue:`36588`.)" msgstr "" #: ../../whatsnew/3.8.rst:1848 msgid "" ":c:func:`!PyEval_AcquireLock` and :c:func:`!PyEval_AcquireThread` now " "terminate the current thread if called while the interpreter is finalizing, " -"making them consistent with :c:func:`PyEval_RestoreThread`, :c:func:" -"`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`. If this behavior is " -"not desired, guard the call by checking :c:func:`!_Py_IsFinalizing` or :func:" -"`sys.is_finalizing`. (Contributed by Joannah Nanjekye in :issue:`36475`.)" +"making them consistent " +"with :c:func:`PyEval_RestoreThread`, :c:func:`Py_END_ALLOW_THREADS`, " +"and :c:func:`PyGILState_Ensure`. If this behavior is not desired, guard the " +"call by checking :c:func:`!_Py_IsFinalizing` or :func:`sys.is_finalizing`. " +"(Contributed by Joannah Nanjekye in :issue:`36475`.)" msgstr "" #: ../../whatsnew/3.8.rst:1858 ../../whatsnew/3.8.rst:2321 msgid "Changes in the Python API" -msgstr "" +msgstr "Python API 的變更" #: ../../whatsnew/3.8.rst:1860 msgid "" @@ -2964,8 +2991,8 @@ msgstr "" msgid "" "The *preexec_fn* argument of * :class:`subprocess.Popen` is no longer " "compatible with subinterpreters. The use of the parameter in a " -"subinterpreter now raises :exc:`RuntimeError`. (Contributed by Eric Snow in :" -"issue:`34651`, modified by Christian Heimes in :issue:`37951`.)" +"subinterpreter now raises :exc:`RuntimeError`. (Contributed by Eric Snow " +"in :issue:`34651`, modified by Christian Heimes in :issue:`37951`.)" msgstr "" #: ../../whatsnew/3.8.rst:1878 @@ -2983,44 +3010,45 @@ msgstr "" #: ../../whatsnew/3.8.rst:1891 msgid "" -"The :meth:`~tkinter.ttk.Treeview.selection` method of the :class:`tkinter." -"ttk.Treeview` class no longer takes arguments. Using it with arguments for " -"changing the selection was deprecated in Python 3.6. Use specialized " -"methods like :meth:`~tkinter.ttk.Treeview.selection_set` for changing the " -"selection. (Contributed by Serhiy Storchaka in :issue:`31508`.)" +"The :meth:`~tkinter.ttk.Treeview.selection` method of " +"the :class:`tkinter.ttk.Treeview` class no longer takes arguments. Using it " +"with arguments for changing the selection was deprecated in Python 3.6. Use " +"specialized methods like :meth:`~tkinter.ttk.Treeview.selection_set` for " +"changing the selection. (Contributed by Serhiy Storchaka in :issue:`31508`.)" msgstr "" #: ../../whatsnew/3.8.rst:1897 msgid "" -"The :meth:`writexml`, :meth:`toxml` and :meth:`toprettyxml` methods of :mod:" -"`xml.dom.minidom`, and the :meth:`write` method of :mod:`xml.etree`, now " -"preserve the attribute order specified by the user. (Contributed by Diego " -"Rojas and Raymond Hettinger in :issue:`34160`.)" +"The :meth:`writexml`, :meth:`toxml` and :meth:`toprettyxml` methods " +"of :mod:`xml.dom.minidom`, and the :meth:`write` method of :mod:`xml.etree`, " +"now preserve the attribute order specified by the user. (Contributed by " +"Diego Rojas and Raymond Hettinger in :issue:`34160`.)" msgstr "" #: ../../whatsnew/3.8.rst:1902 msgid "" -"A :mod:`dbm.dumb` database opened with flags ``'r'`` is now read-only. :func:" -"`dbm.dumb.open` with flags ``'r'`` and ``'w'`` no longer creates a database " -"if it does not exist. (Contributed by Serhiy Storchaka in :issue:`32749`.)" +"A :mod:`dbm.dumb` database opened with flags ``'r'`` is now read-" +"only. :func:`dbm.dumb.open` with flags ``'r'`` and ``'w'`` no longer creates " +"a database if it does not exist. (Contributed by Serhiy Storchaka " +"in :issue:`32749`.)" msgstr "" #: ../../whatsnew/3.8.rst:1907 msgid "" -"The ``doctype()`` method defined in a subclass of :class:`~xml.etree." -"ElementTree.XMLParser` will no longer be called and will emit a :exc:" -"`RuntimeWarning` instead of a :exc:`DeprecationWarning`. Define the :meth:" -"`doctype() <xml.etree.ElementTree.TreeBuilder.doctype>` method on a target " -"for handling an XML doctype declaration. (Contributed by Serhiy Storchaka " -"in :issue:`29209`.)" +"The ``doctype()`` method defined in a subclass " +"of :class:`~xml.etree.ElementTree.XMLParser` will no longer be called and " +"will emit a :exc:`RuntimeWarning` instead of a :exc:`DeprecationWarning`. " +"Define the :meth:`doctype() <xml.etree.ElementTree.TreeBuilder.doctype>` " +"method on a target for handling an XML doctype declaration. (Contributed by " +"Serhiy Storchaka in :issue:`29209`.)" msgstr "" #: ../../whatsnew/3.8.rst:1914 msgid "" "A :exc:`RuntimeError` is now raised when the custom metaclass doesn't " -"provide the ``__classcell__`` entry in the namespace passed to ``type." -"__new__``. A :exc:`DeprecationWarning` was emitted in Python 3.6--3.7. " -"(Contributed by Serhiy Storchaka in :issue:`23722`.)" +"provide the ``__classcell__`` entry in the namespace passed to " +"``type.__new__``. A :exc:`DeprecationWarning` was emitted in Python " +"3.6--3.7. (Contributed by Serhiy Storchaka in :issue:`23722`.)" msgstr "" #: ../../whatsnew/3.8.rst:1919 @@ -3031,10 +3059,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:1922 msgid "" -":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:" -"`shutil.copytree` and :func:`shutil.move` use platform-specific \"fast-" -"copy\" syscalls (see :ref:`shutil-platform-dependent-efficient-copy-" -"operations` section)." +":func:`shutil.copyfile`, :func:`shutil.copy`, :func:`shutil.copy2`, :func:`shutil.copytree` " +"and :func:`shutil.move` use platform-specific \"fast-copy\" syscalls " +"(see :ref:`shutil-platform-dependent-efficient-copy-operations` section)." msgstr "" #: ../../whatsnew/3.8.rst:1927 @@ -3079,18 +3106,19 @@ msgstr "" #: ../../whatsnew/3.8.rst:1954 msgid "" -"Deleting a key from a read-only :mod:`dbm` database (:mod:`dbm.dumb`, :mod:" -"`dbm.gnu` or :mod:`dbm.ndbm`) raises :attr:`error` (:exc:`dbm.dumb.error`, :" -"exc:`dbm.gnu.error` or :exc:`dbm.ndbm.error`) instead of :exc:`KeyError`. " -"(Contributed by Xiang Zhang in :issue:`33106`.)" +"Deleting a key from a read-only :mod:`dbm` database " +"(:mod:`dbm.dumb`, :mod:`dbm.gnu` or :mod:`dbm.ndbm`) raises :attr:`error` " +"(:exc:`dbm.dumb.error`, :exc:`dbm.gnu.error` or :exc:`dbm.ndbm.error`) " +"instead of :exc:`KeyError`. (Contributed by Xiang Zhang in :issue:`33106`.)" msgstr "" #: ../../whatsnew/3.8.rst:1959 msgid "" -"Simplified AST for literals. All constants will be represented as :class:" -"`ast.Constant` instances. Instantiating old classes ``Num``, ``Str``, " -"``Bytes``, ``NameConstant`` and ``Ellipsis`` will return an instance of " -"``Constant``. (Contributed by Serhiy Storchaka in :issue:`32892`.)" +"Simplified AST for literals. All constants will be represented " +"as :class:`ast.Constant` instances. Instantiating old classes ``Num``, " +"``Str``, ``Bytes``, ``NameConstant`` and ``Ellipsis`` will return an " +"instance of ``Constant``. (Contributed by Serhiy Storchaka " +"in :issue:`32892`.)" msgstr "" #: ../../whatsnew/3.8.rst:1975 @@ -3116,15 +3144,16 @@ msgstr "" msgid "" "DLL dependencies for extension modules and DLLs loaded with :mod:`ctypes` on " "Windows are now resolved more securely. Only the system paths, the directory " -"containing the DLL or PYD file, and directories added with :func:`~os." -"add_dll_directory` are searched for load-time dependencies. Specifically, :" -"envvar:`PATH` and the current working directory are no longer used, and " -"modifications to these will no longer have any effect on normal DLL " -"resolution. If your application relies on these mechanisms, you should check " -"for :func:`~os.add_dll_directory` and if it exists, use it to add your DLLs " -"directory while loading your library. Note that Windows 7 users will need to " -"ensure that Windows Update KB2533623 has been installed (this is also " -"verified by the installer). (Contributed by Steve Dower in :issue:`36085`.)" +"containing the DLL or PYD file, and directories added " +"with :func:`~os.add_dll_directory` are searched for load-time dependencies. " +"Specifically, :envvar:`PATH` and the current working directory are no longer " +"used, and modifications to these will no longer have any effect on normal " +"DLL resolution. If your application relies on these mechanisms, you should " +"check for :func:`~os.add_dll_directory` and if it exists, use it to add your " +"DLLs directory while loading your library. Note that Windows 7 users will " +"need to ensure that Windows Update KB2533623 has been installed (this is " +"also verified by the installer). (Contributed by Steve Dower " +"in :issue:`36085`.)" msgstr "" #: ../../whatsnew/3.8.rst:2001 @@ -3182,21 +3211,22 @@ msgstr "" #: ../../whatsnew/3.8.rst:2037 msgid "" -"Use of ``#`` variants of formats in parsing or building value (e.g. :c:func:" -"`PyArg_ParseTuple`, :c:func:`Py_BuildValue`, :c:func:" -"`PyObject_CallFunction`, etc.) without ``PY_SSIZE_T_CLEAN`` defined raises " -"``DeprecationWarning`` now. It will be removed in 3.10 or 4.0. Read :ref:" -"`arg-parsing` for detail. (Contributed by Inada Naoki in :issue:`36381`.)" +"Use of ``#`` variants of formats in parsing or building value " +"(e.g. :c:func:`PyArg_ParseTuple`, :c:func:`Py_BuildValue`, :c:func:`PyObject_CallFunction`, " +"etc.) without ``PY_SSIZE_T_CLEAN`` defined raises ``DeprecationWarning`` " +"now. It will be removed in 3.10 or 4.0. Read :ref:`arg-parsing` for detail. " +"(Contributed by Inada Naoki in :issue:`36381`.)" msgstr "" #: ../../whatsnew/3.8.rst:2043 msgid "" -"Instances of heap-allocated types (such as those created with :c:func:" -"`PyType_FromSpec`) hold a reference to their type object. Increasing the " -"reference count of these type objects has been moved from :c:func:" -"`PyType_GenericAlloc` to the more low-level functions, :c:func:" -"`PyObject_Init` and :c:func:`PyObject_INIT`. This makes types created " -"through :c:func:`PyType_FromSpec` behave like other classes in managed code." +"Instances of heap-allocated types (such as those created " +"with :c:func:`PyType_FromSpec`) hold a reference to their type object. " +"Increasing the reference count of these type objects has been moved " +"from :c:func:`PyType_GenericAlloc` to the more low-level " +"functions, :c:func:`PyObject_Init` and :c:func:`PyObject_INIT`. This makes " +"types created through :c:func:`PyType_FromSpec` behave like other classes in " +"managed code." msgstr "" #: ../../whatsnew/3.8.rst:2051 @@ -3220,10 +3250,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:2062 msgid "" "Remove :c:macro:`Py_INCREF` on the type object after allocating an instance " -"- if any. This may happen after calling :c:macro:`PyObject_New`, :c:macro:" -"`PyObject_NewVar`, :c:func:`PyObject_GC_New`, :c:func:`PyObject_GC_NewVar`, " -"or any other custom allocator that uses :c:func:`PyObject_Init` or :c:func:" -"`PyObject_INIT`." +"- if any. This may happen after " +"calling :c:macro:`PyObject_New`, :c:macro:`PyObject_NewVar`, :c:func:`PyObject_GC_New`, :c:func:`PyObject_GC_NewVar`, " +"or any other custom allocator that uses :c:func:`PyObject_Init` " +"or :c:func:`PyObject_INIT`." msgstr "" #: ../../whatsnew/3.8.rst:2069 ../../whatsnew/3.8.rst:2088 @@ -3288,9 +3318,10 @@ msgid "" "The interpreter does not pretend to support binary compatibility of " "extension types across feature releases, anymore. A :c:type:`PyTypeObject` " "exported by a third-party extension module is supposed to have all the slots " -"expected in the current Python version, including :c:member:`~PyTypeObject." -"tp_finalize` (:c:macro:`Py_TPFLAGS_HAVE_FINALIZE` is not checked anymore " -"before reading :c:member:`~PyTypeObject.tp_finalize`)." +"expected in the current Python version, " +"including :c:member:`~PyTypeObject.tp_finalize` " +"(:c:macro:`Py_TPFLAGS_HAVE_FINALIZE` is not checked anymore before " +"reading :c:member:`~PyTypeObject.tp_finalize`)." msgstr "" #: ../../whatsnew/3.8.rst:2122 @@ -3324,10 +3355,10 @@ msgstr "" #: ../../whatsnew/3.8.rst:2137 msgid "" "The location of an installed :file:`pythonXY.dll` will depend on the " -"installation options and the version and language of Windows. See :ref:" -"`using-on-windows` for more information. The resulting library should be " -"placed in the same directory as :file:`pythonXY.lib`, which is generally " -"the :file:`libs` directory under your Python installation." +"installation options and the version and language of Windows. " +"See :ref:`using-on-windows` for more information. The resulting library " +"should be placed in the same directory as :file:`pythonXY.lib`, which is " +"generally the :file:`libs` directory under your Python installation." msgstr "" #: ../../whatsnew/3.8.rst:2143 @@ -3357,8 +3388,8 @@ msgstr "" #: ../../whatsnew/3.8.rst:2161 msgid "" -"(Contributed by Mark Shannon, Antoine Pitrou and Serhiy Storchaka in :issue:" -"`17611`.)" +"(Contributed by Mark Shannon, Antoine Pitrou and Serhiy Storchaka " +"in :issue:`17611`.)" msgstr "" "(由 Mark Shannon、Antoine Pitrou 和 Serhiy Storchaka 在 :issue:`17611` 中貢" "獻。)" @@ -3556,12 +3587,12 @@ msgstr "Python 3.8.1 中顯著的變更" #: ../../whatsnew/3.8.rst:2239 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" #: ../../whatsnew/3.8.rst:2247 @@ -3594,13 +3625,14 @@ msgstr "Python 3.8.8 中顯著的變更" #: ../../whatsnew/3.8.rst:2264 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" msgstr "" #: ../../whatsnew/3.8.rst:2275 @@ -3639,9 +3671,9 @@ msgstr "" #: ../../whatsnew/3.8.rst:2299 msgid "" -"(Originally contributed by Ronald Oussoren and Lawrence D'Anna in :gh:" -"`85272`, with fixes by FX Coudert and Eli Rykoff, and backported to 3.8 by " -"Maxime Bélanger and Ned Deily)" +"(Originally contributed by Ronald Oussoren and Lawrence D'Anna " +"in :gh:`85272`, with fixes by FX Coudert and Eli Rykoff, and backported to " +"3.8 by Maxime Bélanger and Ned Deily)" msgstr "" #: ../../whatsnew/3.8.rst:2307 @@ -3651,11 +3683,12 @@ msgstr "urllib.parse" #: ../../whatsnew/3.8.rst:2309 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " -"forms of attacks. Following the WHATWG specification that updates :rfc:" -"`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are " -"stripped from the URL by the parser in :mod:`urllib.parse` preventing such " -"attacks. The removal characters are controlled by a new module level " -"variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :issue:`43882`)" +"forms of attacks. Following the WHATWG specification that " +"updates :rfc:`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` " +"characters are stripped from the URL by the parser in :mod:`urllib.parse` " +"preventing such attacks. The removal characters are controlled by a new " +"module level variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. " +"(See :issue:`43882`)" msgstr "" #: ../../whatsnew/3.8.rst:2318 diff --git a/whatsnew/3.9.po b/whatsnew/3.9.po index c85271fcb3..0d12d8d64e 100644 --- a/whatsnew/3.9.po +++ b/whatsnew/3.9.po @@ -32,8 +32,8 @@ msgstr "Łukasz Langa" #: ../../whatsnew/3.9.rst:45 msgid "" "This article explains the new features in Python 3.9, compared to 3.8. " -"Python 3.9 was released on October 5, 2020. For full details, see the :ref:" -"`changelog <changelog>`." +"Python 3.9 was released on October 5, 2020. For full details, see " +"the :ref:`changelog <changelog>`." msgstr "" "本文介紹了 Python 3.9 與 3.8 相比多了哪些新功能。Python 3.9 已於 2020 年 10 " "月 5 日發布。有關完整詳細資訊,請參閱 :ref:`changelog <changelog>`。" @@ -109,19 +109,19 @@ msgstr "" #: ../../whatsnew/3.9.rst:84 msgid "" -"a number of Python modules (:mod:`!_abc`, :mod:`!audioop`, :mod:`!_bz2`, :" -"mod:`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!_functools`, :" -"mod:`!_json`, :mod:`!_locale`, :mod:`math`, :mod:`operator`, :mod:" -"`resource`, :mod:`time`, :mod:`!_weakref`) now use multiphase initialization " -"as defined by PEP 489;" +"a number of Python modules (:mod:`!_abc`, :mod:`!audioop`, :mod:`!" +"_bz2`, :mod:`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!" +"_functools`, :mod:`!_json`, :mod:`!" +"_locale`, :mod:`math`, :mod:`operator`, :mod:`resource`, :mod:`time`, :mod:`!" +"_weakref`) now use multiphase initialization as defined by PEP 489;" msgstr "" #: ../../whatsnew/3.9.rst:89 msgid "" -"a number of standard library modules (:mod:`!audioop`, :mod:`ast`, :mod:" -"`grp`, :mod:`!_hashlib`, :mod:`pwd`, :mod:`!_posixsubprocess`, :mod:" -"`random`, :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) are now " -"using the stable ABI defined by PEP 384." +"a number of standard library modules (:mod:`!" +"audioop`, :mod:`ast`, :mod:`grp`, :mod:`!_hashlib`, :mod:`pwd`, :mod:`!" +"_posixsubprocess`, :mod:`random`, :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) " +"are now using the stable ABI defined by PEP 384." msgstr "" #: ../../whatsnew/3.9.rst:94 @@ -182,9 +182,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:126 msgid "" "Aliases to :ref:`Abstract Base Classes <collections-abstract-base-classes>` " -"in the :mod:`collections` module, like ``collections.Mapping`` alias to :" -"class:`collections.abc.Mapping`, are kept for one last release for backward " -"compatibility. They will be removed from Python 3.10." +"in the :mod:`collections` module, like ``collections.Mapping`` alias " +"to :class:`collections.abc.Mapping`, are kept for one last release for " +"backward compatibility. They will be removed from Python 3.10." msgstr "" #: ../../whatsnew/3.9.rst:131 @@ -210,8 +210,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:145 msgid "" -"Merge (``|``) and update (``|=``) operators have been added to the built-in :" -"class:`dict` class. Those complement the existing ``dict.update`` and " +"Merge (``|``) and update (``|=``) operators have been added to the built-" +"in :class:`dict` class. Those complement the existing ``dict.update`` and " "``{**d1, **d2}`` methods of merging dictionaries." msgstr "" @@ -237,8 +237,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:158 msgid "" -"See :pep:`584` for a full description. (Contributed by Brandt Bucher in :" -"issue:`36144`.)" +"See :pep:`584` for a full description. (Contributed by Brandt Bucher " +"in :issue:`36144`.)" msgstr "" #: ../../whatsnew/3.9.rst:162 @@ -247,12 +247,12 @@ msgstr "" #: ../../whatsnew/3.9.rst:164 msgid "" -":meth:`str.removeprefix(prefix)<str.removeprefix>` and :meth:`str." -"removesuffix(suffix)<str.removesuffix>` have been added to easily remove an " -"unneeded prefix or a suffix from a string. Corresponding ``bytes``, " -"``bytearray``, and ``collections.UserString`` methods have also been added. " -"See :pep:`616` for a full description. (Contributed by Dennis Sweeney in :" -"issue:`39939`.)" +":meth:`str.removeprefix(prefix)<str.removeprefix>` " +"and :meth:`str.removesuffix(suffix)<str.removesuffix>` have been added to " +"easily remove an unneeded prefix or a suffix from a string. Corresponding " +"``bytes``, ``bytearray``, and ``collections.UserString`` methods have also " +"been added. See :pep:`616` for a full description. (Contributed by Dennis " +"Sweeney in :issue:`39939`.)" msgstr "" #: ../../whatsnew/3.9.rst:172 @@ -329,28 +329,28 @@ msgstr "其他語言更動" #: ../../whatsnew/3.9.rst:218 msgid "" -":func:`__import__` now raises :exc:`ImportError` instead of :exc:" -"`ValueError`, which used to occur when a relative import went past its top-" -"level package. (Contributed by Ngalim Siregar in :issue:`37444`.)" +":func:`__import__` now raises :exc:`ImportError` instead " +"of :exc:`ValueError`, which used to occur when a relative import went past " +"its top-level package. (Contributed by Ngalim Siregar in :issue:`37444`.)" msgstr "" #: ../../whatsnew/3.9.rst:223 msgid "" "Python now gets the absolute path of the script filename specified on the " -"command line (ex: ``python3 script.py``): the ``__file__`` attribute of the :" -"mod:`__main__` module became an absolute path, rather than a relative path. " -"These paths now remain valid after the current directory is changed by :func:" -"`os.chdir`. As a side effect, the traceback also displays the absolute path " -"for :mod:`__main__` module frames in this case. (Contributed by Victor " -"Stinner in :issue:`20443`.)" +"command line (ex: ``python3 script.py``): the ``__file__`` attribute of " +"the :mod:`__main__` module became an absolute path, rather than a relative " +"path. These paths now remain valid after the current directory is changed " +"by :func:`os.chdir`. As a side effect, the traceback also displays the " +"absolute path for :mod:`__main__` module frames in this case. (Contributed " +"by Victor Stinner in :issue:`20443`.)" msgstr "" #: ../../whatsnew/3.9.rst:231 msgid "" "In the :ref:`Python Development Mode <devmode>` and in :ref:`debug build " "<debug-build>`, the *encoding* and *errors* arguments are now checked for " -"string encoding and decoding operations. Examples: :func:`open`, :meth:`str." -"encode` and :meth:`bytes.decode`." +"string encoding and decoding operations. " +"Examples: :func:`open`, :meth:`str.encode` and :meth:`bytes.decode`." msgstr "" #: ../../whatsnew/3.9.rst:236 @@ -386,25 +386,26 @@ msgstr "" #: ../../whatsnew/3.9.rst:256 msgid "" -"Parallel running of :meth:`~agen.aclose` / :meth:`~agen.asend` / :meth:" -"`~agen.athrow` is now prohibited, and ``ag_running`` now reflects the actual " -"running status of the async generator. (Contributed by Yury Selivanov in :" -"issue:`30773`.)" +"Parallel running " +"of :meth:`~agen.aclose` / :meth:`~agen.asend` / :meth:`~agen.athrow` is now " +"prohibited, and ``ag_running`` now reflects the actual running status of the " +"async generator. (Contributed by Yury Selivanov in :issue:`30773`.)" msgstr "" #: ../../whatsnew/3.9.rst:261 msgid "" "Unexpected errors in calling the ``__iter__`` method are no longer masked by " -"``TypeError`` in the :keyword:`in` operator and functions :func:`~operator." -"contains`, :func:`~operator.indexOf` and :func:`~operator.countOf` of the :" -"mod:`operator` module. (Contributed by Serhiy Storchaka in :issue:`40824`.)" +"``TypeError`` in the :keyword:`in` operator and " +"functions :func:`~operator.contains`, :func:`~operator.indexOf` " +"and :func:`~operator.countOf` of the :mod:`operator` module. (Contributed by " +"Serhiy Storchaka in :issue:`40824`.)" msgstr "" #: ../../whatsnew/3.9.rst:267 msgid "" "Unparenthesized lambda expressions can no longer be the expression part in " -"an ``if`` clause in comprehensions and generator expressions. See :issue:" -"`41848` and :issue:`43755` for details." +"an ``if`` clause in comprehensions and generator expressions. " +"See :issue:`41848` and :issue:`43755` for details." msgstr "" #: ../../whatsnew/3.9.rst:273 @@ -418,8 +419,9 @@ msgstr "zoneinfo" #: ../../whatsnew/3.9.rst:278 msgid "" "The :mod:`zoneinfo` module brings support for the IANA time zone database to " -"the standard library. It adds :class:`zoneinfo.ZoneInfo`, a concrete :class:" -"`datetime.tzinfo` implementation backed by the system's time zone data." +"the standard library. It adds :class:`zoneinfo.ZoneInfo`, a " +"concrete :class:`datetime.tzinfo` implementation backed by the system's time " +"zone data." msgstr "" #: ../../whatsnew/3.9.rst:284 @@ -465,10 +467,10 @@ msgstr "graphlib" #: ../../whatsnew/3.9.rst:315 msgid "" -"A new module, :mod:`graphlib`, was added that contains the :class:`graphlib." -"TopologicalSorter` class to offer functionality to perform topological " -"sorting of graphs. (Contributed by Pablo Galindo, Tim Peters and Larry " -"Hastings in :issue:`17005`.)" +"A new module, :mod:`graphlib`, was added that contains " +"the :class:`graphlib.TopologicalSorter` class to offer functionality to " +"perform topological sorting of graphs. (Contributed by Pablo Galindo, Tim " +"Peters and Larry Hastings in :issue:`17005`.)" msgstr "" #: ../../whatsnew/3.9.rst:322 @@ -482,8 +484,8 @@ msgstr "ast" #: ../../whatsnew/3.9.rst:327 msgid "" "Added the *indent* option to :func:`~ast.dump` which allows it to produce a " -"multiline indented output. (Contributed by Serhiy Storchaka in :issue:" -"`37995`.)" +"multiline indented output. (Contributed by Serhiy Storchaka " +"in :issue:`37995`.)" msgstr "" #: ../../whatsnew/3.9.rst:331 @@ -506,21 +508,22 @@ msgstr "asyncio" #: ../../whatsnew/3.9.rst:342 msgid "" -"Due to significant security concerns, the *reuse_address* parameter of :meth:" -"`asyncio.loop.create_datagram_endpoint` is no longer supported. This is " -"because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For " -"more details, see the documentation for ``loop.create_datagram_endpoint()``. " -"(Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in :issue:" -"`37228`.)" +"Due to significant security concerns, the *reuse_address* parameter " +"of :meth:`asyncio.loop.create_datagram_endpoint` is no longer supported. " +"This is because of the behavior of the socket option ``SO_REUSEADDR`` in " +"UDP. For more details, see the documentation for " +"``loop.create_datagram_endpoint()``. (Contributed by Kyle Stanley, Antoine " +"Pitrou, and Yury Selivanov in :issue:`37228`.)" msgstr "" #: ../../whatsnew/3.9.rst:349 msgid "" -"Added a new :term:`coroutine` :meth:`~asyncio.loop." -"shutdown_default_executor` that schedules a shutdown for the default " -"executor that waits on the :class:`~concurrent.futures.ThreadPoolExecutor` " -"to finish closing. Also, :func:`asyncio.run` has been updated to use the " -"new :term:`coroutine`. (Contributed by Kyle Stanley in :issue:`34037`.)" +"Added a " +"new :term:`coroutine` :meth:`~asyncio.loop.shutdown_default_executor` that " +"schedules a shutdown for the default executor that waits on " +"the :class:`~concurrent.futures.ThreadPoolExecutor` to finish closing. " +"Also, :func:`asyncio.run` has been updated to use the new :term:`coroutine`. " +"(Contributed by Kyle Stanley in :issue:`34037`.)" msgstr "" #: ../../whatsnew/3.9.rst:355 @@ -533,9 +536,10 @@ msgstr "" msgid "" "Added a new :term:`coroutine` :func:`asyncio.to_thread`. It is mainly used " "for running IO-bound functions in a separate thread to avoid blocking the " -"event loop, and essentially works as a high-level version of :meth:`~asyncio." -"loop.run_in_executor` that can directly take keyword arguments. (Contributed " -"by Kyle Stanley and Yury Selivanov in :issue:`32309`.)" +"event loop, and essentially works as a high-level version " +"of :meth:`~asyncio.loop.run_in_executor` that can directly take keyword " +"arguments. (Contributed by Kyle Stanley and Yury Selivanov " +"in :issue:`32309`.)" msgstr "" #: ../../whatsnew/3.9.rst:364 @@ -549,8 +553,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:369 msgid "" ":mod:`asyncio` now raises :exc:`TypeError` when calling incompatible methods " -"with an :class:`ssl.SSLSocket` socket. (Contributed by Ido Michael in :issue:" -"`37404`.)" +"with an :class:`ssl.SSLSocket` socket. (Contributed by Ido Michael " +"in :issue:`37404`.)" msgstr "" #: ../../whatsnew/3.9.rst:374 @@ -569,8 +573,8 @@ msgid "" "Added new options for path manipulation in resulting ``.pyc`` files: " "*stripdir*, *prependdir*, *limit_sl_dest* parameters and -s, -p, -e command " "line options. Added the possibility to specify the option for an " -"optimization level multiple times. (Contributed by Lumír 'Frenzy' Balhar in :" -"issue:`38112`.)" +"optimization level multiple times. (Contributed by Lumír 'Frenzy' Balhar " +"in :issue:`38112`.)" msgstr "" #: ../../whatsnew/3.9.rst:384 @@ -579,10 +583,11 @@ msgstr "concurrent.futures" #: ../../whatsnew/3.9.rst:386 msgid "" -"Added a new *cancel_futures* parameter to :meth:`concurrent.futures.Executor." -"shutdown` that cancels all pending futures which have not started running, " -"instead of waiting for them to complete before shutting down the executor. " -"(Contributed by Kyle Stanley in :issue:`39349`.)" +"Added a new *cancel_futures* parameter " +"to :meth:`concurrent.futures.Executor.shutdown` that cancels all pending " +"futures which have not started running, instead of waiting for them to " +"complete before shutting down the executor. (Contributed by Kyle Stanley " +"in :issue:`39349`.)" msgstr "" #: ../../whatsnew/3.9.rst:392 @@ -607,9 +612,9 @@ msgstr "curses" #: ../../whatsnew/3.9.rst:405 msgid "" -"Added :func:`curses.get_escdelay`, :func:`curses.set_escdelay`, :func:" -"`curses.get_tabsize`, and :func:`curses.set_tabsize` functions. (Contributed " -"by Anthony Sottile in :issue:`38312`.)" +"Added :func:`curses.get_escdelay`, :func:`curses.set_escdelay`, :func:`curses.get_tabsize`, " +"and :func:`curses.set_tabsize` functions. (Contributed by Anthony Sottile " +"in :issue:`38312`.)" msgstr "" #: ../../whatsnew/3.9.rst:410 @@ -618,10 +623,10 @@ msgstr "datetime" #: ../../whatsnew/3.9.rst:411 msgid "" -"The :meth:`~datetime.date.isocalendar` of :class:`datetime.date` and :meth:" -"`~datetime.datetime.isocalendar` of :class:`datetime.datetime` methods now " -"returns a :func:`~collections.namedtuple` instead of a :class:`tuple`. " -"(Contributed by Donghee Na in :issue:`24416`.)" +"The :meth:`~datetime.date.isocalendar` of :class:`datetime.date` " +"and :meth:`~datetime.datetime.isocalendar` of :class:`datetime.datetime` " +"methods now returns a :func:`~collections.namedtuple` instead of " +"a :class:`tuple`. (Contributed by Donghee Na in :issue:`24416`.)" msgstr "" #: ../../whatsnew/3.9.rst:417 @@ -642,8 +647,8 @@ msgstr "fcntl" #: ../../whatsnew/3.9.rst:426 msgid "" "Added constants :const:`~fcntl.F_OFD_GETLK`, :const:`~fcntl.F_OFD_SETLK` " -"and :const:`~fcntl.F_OFD_SETLKW`. (Contributed by Donghee Na in :issue:" -"`38602`.)" +"and :const:`~fcntl.F_OFD_SETLKW`. (Contributed by Donghee Na " +"in :issue:`38602`.)" msgstr "" #: ../../whatsnew/3.9.rst:431 @@ -652,10 +657,10 @@ msgstr "ftplib" #: ../../whatsnew/3.9.rst:433 msgid "" -":class:`~ftplib.FTP` and :class:`~ftplib.FTP_TLS` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`~ftplib.FTP` and :class:`~ftplib.FTP_TLS` now raise " +"a :class:`ValueError` if the given timeout for their constructor is zero to " +"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " +"in :issue:`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:438 @@ -667,15 +672,15 @@ msgid "" "When the garbage collector makes a collection in which some objects " "resurrect (they are reachable from outside the isolated cycles after the " "finalizers have been executed), do not block the collection of all objects " -"that are still unreachable. (Contributed by Pablo Galindo and Tim Peters in :" -"issue:`38379`.)" +"that are still unreachable. (Contributed by Pablo Galindo and Tim Peters " +"in :issue:`38379`.)" msgstr "" #: ../../whatsnew/3.9.rst:445 msgid "" "Added a new function :func:`gc.is_finalized` to check if an object has been " -"finalized by the garbage collector. (Contributed by Pablo Galindo in :issue:" -"`39322`.)" +"finalized by the garbage collector. (Contributed by Pablo Galindo " +"in :issue:`39322`.)" msgstr "" #: ../../whatsnew/3.9.rst:450 @@ -713,8 +718,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:472 msgid "" -"Added option to toggle cursor blink off. (Contributed by Zackery Spytz in :" -"issue:`4603`.)" +"Added option to toggle cursor blink off. (Contributed by Zackery Spytz " +"in :issue:`4603`.)" msgstr "" #: ../../whatsnew/3.9.rst:475 @@ -736,8 +741,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:483 msgid "" "Make IDLE invoke :func:`sys.excepthook` (when started without '-n'). User " -"hooks were previously ignored. (Contributed by Ken Hilton in :issue:" -"`43008`.)" +"hooks were previously ignored. (Contributed by Ken Hilton " +"in :issue:`43008`.)" msgstr "" #: ../../whatsnew/3.9.rst:487 @@ -749,10 +754,10 @@ msgid "" "Rearrange the settings dialog. Split the General tab into Windows and Shell/" "Ed tabs. Move help sources, which extend the Help menu, to the Extensions " "tab. Make space for new options and shorten the dialog. The latter makes " -"the dialog better fit small screens. (Contributed by Terry Jan Reedy in :" -"issue:`40468`.) Move the indent space setting from the Font tab to the new " -"Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy in :issue:" -"`33962`.)" +"the dialog better fit small screens. (Contributed by Terry Jan Reedy " +"in :issue:`40468`.) Move the indent space setting from the Font tab to the " +"new Windows tab. (Contributed by Mark Roseman and Terry Jan Reedy " +"in :issue:`33962`.)" msgstr "" #: ../../whatsnew/3.9.rst:497 @@ -768,11 +773,11 @@ msgstr "imaplib" #: ../../whatsnew/3.9.rst:503 msgid "" ":class:`~imaplib.IMAP4` and :class:`~imaplib.IMAP4_SSL` now have an optional " -"*timeout* parameter for their constructors. Also, the :meth:`~imaplib.IMAP4." -"open` method now has an optional *timeout* parameter with this change. The " -"overridden methods of :class:`~imaplib.IMAP4_SSL` and :class:`~imaplib." -"IMAP4_stream` were applied to this change. (Contributed by Donghee Na in :" -"issue:`38615`.)" +"*timeout* parameter for their constructors. Also, " +"the :meth:`~imaplib.IMAP4.open` method now has an optional *timeout* " +"parameter with this change. The overridden methods " +"of :class:`~imaplib.IMAP4_SSL` and :class:`~imaplib.IMAP4_stream` were " +"applied to this change. (Contributed by Donghee Na in :issue:`38615`.)" msgstr "" #: ../../whatsnew/3.9.rst:510 @@ -791,10 +796,10 @@ msgstr "importlib" #: ../../whatsnew/3.9.rst:520 msgid "" -"To improve consistency with import statements, :func:`importlib.util." -"resolve_name` now raises :exc:`ImportError` instead of :exc:`ValueError` for " -"invalid relative import attempts. (Contributed by Ngalim Siregar in :issue:" -"`37444`.)" +"To improve consistency with import " +"statements, :func:`importlib.util.resolve_name` now " +"raises :exc:`ImportError` instead of :exc:`ValueError` for invalid relative " +"import attempts. (Contributed by Ngalim Siregar in :issue:`37444`.)" msgstr "" #: ../../whatsnew/3.9.rst:525 @@ -823,8 +828,8 @@ msgstr "inspect" #: ../../whatsnew/3.9.rst:539 msgid "" ":attr:`inspect.BoundArguments.arguments` is changed from ``OrderedDict`` to " -"regular dict. (Contributed by Inada Naoki in :issue:`36350` and :issue:" -"`39775`.)" +"regular dict. (Contributed by Inada Naoki in :issue:`36350` " +"and :issue:`39775`.)" msgstr "" #: ../../whatsnew/3.9.rst:543 @@ -840,16 +845,16 @@ msgstr "" #: ../../whatsnew/3.9.rst:547 msgid "" "Scoped IPv6 addresses can be parsed using :class:`ipaddress.IPv6Address`. If " -"present, scope zone ID is available through the :attr:`~ipaddress." -"IPv6Address.scope_id` attribute. (Contributed by Oleksandr Pavliuk in :issue:" -"`34788`.)" +"present, scope zone ID is available through " +"the :attr:`~ipaddress.IPv6Address.scope_id` attribute. (Contributed by " +"Oleksandr Pavliuk in :issue:`34788`.)" msgstr "" #: ../../whatsnew/3.9.rst:551 msgid "" "Starting with Python 3.9.5 the :mod:`ipaddress` module no longer accepts any " -"leading zeros in IPv4 address strings. (Contributed by Christian Heimes in :" -"issue:`36384`)." +"leading zeros in IPv4 address strings. (Contributed by Christian Heimes " +"in :issue:`36384`)." msgstr "" #: ../../whatsnew/3.9.rst:556 @@ -888,9 +893,9 @@ msgstr "multiprocessing" #: ../../whatsnew/3.9.rst:577 msgid "" -"The :class:`multiprocessing.SimpleQueue` class has a new :meth:" -"`~multiprocessing.SimpleQueue.close` method to explicitly close the queue. " -"(Contributed by Victor Stinner in :issue:`30966`.)" +"The :class:`multiprocessing.SimpleQueue` class has a " +"new :meth:`~multiprocessing.SimpleQueue.close` method to explicitly close " +"the queue. (Contributed by Victor Stinner in :issue:`30966`.)" msgstr "" #: ../../whatsnew/3.9.rst:583 @@ -916,8 +921,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:595 msgid "" -"Exposed the Linux-specific :func:`os.pidfd_open` (:issue:`38692`) and :const:" -"`os.P_PIDFD` (:issue:`38713`) for process management with file descriptors." +"Exposed the Linux-specific :func:`os.pidfd_open` (:issue:`38692`) " +"and :const:`os.P_PIDFD` (:issue:`38713`) for process management with file " +"descriptors." msgstr "" #: ../../whatsnew/3.9.rst:599 @@ -944,8 +950,8 @@ msgstr "pathlib" #: ../../whatsnew/3.9.rst:613 msgid "" -"Added :meth:`pathlib.Path.readlink` which acts similarly to :func:`os." -"readlink`. (Contributed by Girts Folkmanis in :issue:`30618`)" +"Added :meth:`pathlib.Path.readlink` which acts similarly " +"to :func:`os.readlink`. (Contributed by Girts Folkmanis in :issue:`30618`)" msgstr "" #: ../../whatsnew/3.9.rst:618 @@ -964,10 +970,10 @@ msgstr "poplib" #: ../../whatsnew/3.9.rst:626 msgid "" -":class:`~poplib.POP3` and :class:`~poplib.POP3_SSL` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`~poplib.POP3` and :class:`~poplib.POP3_SSL` now raise " +"a :class:`ValueError` if the given timeout for their constructor is zero to " +"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " +"in :issue:`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:631 @@ -1008,8 +1014,8 @@ msgstr "signal" #: ../../whatsnew/3.9.rst:653 msgid "" "Exposed the Linux-specific :func:`signal.pidfd_send_signal` for sending to " -"signals to a process using a file descriptor instead of a pid. (:issue:" -"`38712`)" +"signals to a process using a file descriptor instead of a pid. " +"(:issue:`38712`)" msgstr "" #: ../../whatsnew/3.9.rst:657 @@ -1018,10 +1024,10 @@ msgstr "smtplib" #: ../../whatsnew/3.9.rst:659 msgid "" -":class:`~smtplib.SMTP` and :class:`~smtplib.SMTP_SSL` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`~smtplib.SMTP` and :class:`~smtplib.SMTP_SSL` now raise " +"a :class:`ValueError` if the given timeout for their constructor is zero to " +"prevent the creation of a non-blocking socket. (Contributed by Donghee Na " +"in :issue:`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:663 @@ -1036,9 +1042,9 @@ msgstr "socket" #: ../../whatsnew/3.9.rst:669 msgid "" -"The :mod:`socket` module now exports the :const:`~socket." -"CAN_RAW_JOIN_FILTERS` constant on Linux 4.1 and greater. (Contributed by " -"Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" +"The :mod:`socket` module now exports " +"the :const:`~socket.CAN_RAW_JOIN_FILTERS` constant on Linux 4.1 and greater. " +"(Contributed by Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" msgstr "" #: ../../whatsnew/3.9.rst:673 @@ -1049,9 +1055,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:676 msgid "" -"The socket module now has the :func:`socket.send_fds` and :func:`socket." -"recv_fds` functions. (Contributed by Joannah Nanjekye, Shinya Okano and " -"Victor Stinner in :issue:`28724`.)" +"The socket module now has the :func:`socket.send_fds` " +"and :func:`socket.recv_fds` functions. (Contributed by Joannah Nanjekye, " +"Shinya Okano and Victor Stinner in :issue:`28724`.)" msgstr "" #: ../../whatsnew/3.9.rst:682 @@ -1139,10 +1145,11 @@ msgstr "xml" #: ../../whatsnew/3.9.rst:735 msgid "" -"White space characters within attributes are now preserved when serializing :" -"mod:`xml.etree.ElementTree` to XML file. EOLNs are no longer normalized to " -"\"\\n\". This is the result of discussion about how to interpret section " -"2.11 of XML spec. (Contributed by Mefistotelis in :issue:`39011`.)" +"White space characters within attributes are now preserved when " +"serializing :mod:`xml.etree.ElementTree` to XML file. EOLNs are no longer " +"normalized to \"\\n\". This is the result of discussion about how to " +"interpret section 2.11 of XML spec. (Contributed by Mefistotelis " +"in :issue:`39011`.)" msgstr "" #: ../../whatsnew/3.9.rst:743 @@ -1182,8 +1189,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:762 msgid "" "Previously, the bytecode evaluation loop was interrupted at each instruction " -"until the main thread handles signals. (Contributed by Victor Stinner in :" -"issue:`40010`.)" +"until the main thread handles signals. (Contributed by Victor Stinner " +"in :issue:`40010`.)" msgstr "" #: ../../whatsnew/3.9.rst:766 @@ -1201,10 +1208,11 @@ msgstr "" #: ../../whatsnew/3.9.rst:774 msgid "" -"A number of Python builtins (:class:`range`, :class:`tuple`, :class:`set`, :" -"class:`frozenset`, :class:`list`, :class:`dict`) are now sped up by using :" -"pep:`590` vectorcall protocol. (Contributed by Donghee Na, Mark Shannon, " -"Jeroen Demeyer and Petr Viktorin in :issue:`37207`.)" +"A number of Python builtins " +"(:class:`range`, :class:`tuple`, :class:`set`, :class:`frozenset`, :class:`list`, :class:`dict`) " +"are now sped up by using :pep:`590` vectorcall protocol. (Contributed by " +"Donghee Na, Mark Shannon, Jeroen Demeyer and Petr Viktorin " +"in :issue:`37207`.)" msgstr "" #: ../../whatsnew/3.9.rst:779 @@ -1395,10 +1403,10 @@ msgid "" "These results were generated from the variable access benchmark script at: " "``Tools/scripts/var_access_benchmark.py``. The benchmark script displays " "timings in nanoseconds. The benchmarks were measured on an `Intel® Core™ " -"i7-4960HQ processor <https://ark.intel.com/content/www/us/en/ark/" -"products/76088/intel-core-i7-4960hq-processor-6m-cache-up-to-3-80-ghz." -"html>`_ running the macOS 64-bit builds found at `python.org <https://www." -"python.org/downloads/macos/>`_." +"i7-4960HQ processor <https://ark.intel.com/content/www/us/en/ark/products/" +"76088/intel-core-i7-4960hq-processor-6m-cache-up-to-3-80-ghz.html>`_ running " +"the macOS 64-bit builds found at `python.org <https://www.python.org/" +"downloads/macos/>`_." msgstr "" #: ../../whatsnew/3.9.rst:853 @@ -1408,8 +1416,8 @@ msgstr "已棄用" #: ../../whatsnew/3.9.rst:855 msgid "" "The distutils ``bdist_msi`` command is now deprecated, use ``bdist_wheel`` " -"(wheel packages) instead. (Contributed by Hugo van Kemenade in :issue:" -"`39586`.)" +"(wheel packages) instead. (Contributed by Hugo van Kemenade " +"in :issue:`39586`.)" msgstr "" #: ../../whatsnew/3.9.rst:859 @@ -1431,8 +1439,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:870 msgid "" -"The Public C API functions :c:func:`!PyParser_SimpleParseStringFlags`, :c:" -"func:`!PyParser_SimpleParseStringFlagsFilename`, :c:func:`!" +"The Public C API functions :c:func:`!" +"PyParser_SimpleParseStringFlags`, :c:func:`!" +"PyParser_SimpleParseStringFlagsFilename`, :c:func:`!" "PyParser_SimpleParseFileFlags` and :c:func:`!PyNode_Compile` are deprecated " "and will be removed in Python 3.10 together with the old parser." msgstr "" @@ -1450,8 +1459,9 @@ msgid "" "The :mod:`random` module currently accepts any hashable type as a possible " "seed value. Unfortunately, some of those types are not guaranteed to have a " "deterministic hash value. After Python 3.9, the module will restrict its " -"seeds to :const:`None`, :class:`int`, :class:`float`, :class:`str`, :class:" -"`bytes`, and :class:`bytearray`." +"seeds " +"to :const:`None`, :class:`int`, :class:`float`, :class:`str`, :class:`bytes`, " +"and :class:`bytearray`." msgstr "" #: ../../whatsnew/3.9.rst:887 @@ -1459,8 +1469,8 @@ msgid "" "Opening the :class:`~gzip.GzipFile` file for writing without specifying the " "*mode* argument is deprecated. In future Python versions it will always be " "opened for reading by default. Specify the *mode* argument for opening it " -"for writing and silencing a warning. (Contributed by Serhiy Storchaka in :" -"issue:`28286`.)" +"for writing and silencing a warning. (Contributed by Serhiy Storchaka " +"in :issue:`28286`.)" msgstr "" #: ../../whatsnew/3.9.rst:893 @@ -1509,17 +1519,17 @@ msgid "" ":mod:`ast` classes ``Suite``, ``Param``, ``AugLoad`` and ``AugStore`` are " "considered deprecated and will be removed in future Python versions. They " "were not generated by the parser and not accepted by the code generator in " -"Python 3. (Contributed by Batuhan Taskaya in :issue:`39639` and :issue:" -"`39969` and Serhiy Storchaka in :issue:`39988`.)" +"Python 3. (Contributed by Batuhan Taskaya in :issue:`39639` " +"and :issue:`39969` and Serhiy Storchaka in :issue:`39988`.)" msgstr "" #: ../../whatsnew/3.9.rst:923 msgid "" "The :c:func:`!PyEval_InitThreads` and :c:func:`!PyEval_ThreadsInitialized` " -"functions are now deprecated and will be removed in Python 3.11. Calling :c:" -"func:`!PyEval_InitThreads` now does nothing. The :term:`GIL` is initialized " -"by :c:func:`Py_Initialize` since Python 3.7. (Contributed by Victor Stinner " -"in :issue:`39877`.)" +"functions are now deprecated and will be removed in Python 3.11. " +"Calling :c:func:`!PyEval_InitThreads` now does nothing. The :term:`GIL` is " +"initialized by :c:func:`Py_Initialize` since Python 3.7. (Contributed by " +"Victor Stinner in :issue:`39877`.)" msgstr "" #: ../../whatsnew/3.9.rst:929 @@ -1531,8 +1541,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:932 msgid "" ":func:`!smtpd.MailmanProxy` is now deprecated as it is unusable without an " -"external module, ``mailman``. (Contributed by Samuel Colvin in :issue:" -"`35800`.)" +"external module, ``mailman``. (Contributed by Samuel Colvin " +"in :issue:`35800`.)" msgstr "" #: ../../whatsnew/3.9.rst:935 @@ -1566,8 +1576,8 @@ msgid "" "removed. These methods are deprecated since Python 3.3. Generally, these " "extensions are not supported or not enabled by NNTP server administrators. " "For ``xgtitle()``, please use :meth:`!nntplib.NNTP.descriptions` or :meth:`!" -"nntplib.NNTP.description` instead. (Contributed by Donghee Na in :issue:" -"`39366`.)" +"nntplib.NNTP.description` instead. (Contributed by Donghee Na " +"in :issue:`39366`.)" msgstr "" #: ../../whatsnew/3.9.rst:963 @@ -1588,9 +1598,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:973 msgid "" "The ``sys.getcheckinterval()`` and ``sys.setcheckinterval()`` functions have " -"been removed. They were deprecated since Python 3.2. Use :func:`sys." -"getswitchinterval` and :func:`sys.setswitchinterval` instead. (Contributed " -"by Victor Stinner in :issue:`37392`.)" +"been removed. They were deprecated since Python 3.2. " +"Use :func:`sys.getswitchinterval` and :func:`sys.setswitchinterval` instead. " +"(Contributed by Victor Stinner in :issue:`37392`.)" msgstr "" #: ../../whatsnew/3.9.rst:978 @@ -1624,21 +1634,23 @@ msgstr "" #: ../../whatsnew/3.9.rst:996 msgid "" -"Methods ``getchildren()`` and ``getiterator()`` of classes :class:`~xml." -"etree.ElementTree.ElementTree` and :class:`~xml.etree.ElementTree.Element` " -"in the :mod:`~xml.etree.ElementTree` module have been removed. They were " -"deprecated in Python 3.2. Use ``iter(x)`` or ``list(x)`` instead of ``x." -"getchildren()`` and ``x.iter()`` or ``list(x.iter())`` instead of ``x." -"getiterator()``. (Contributed by Serhiy Storchaka in :issue:`36543`.)" +"Methods ``getchildren()`` and ``getiterator()`` of " +"classes :class:`~xml.etree.ElementTree.ElementTree` " +"and :class:`~xml.etree.ElementTree.Element` in " +"the :mod:`~xml.etree.ElementTree` module have been removed. They were " +"deprecated in Python 3.2. Use ``iter(x)`` or ``list(x)`` instead of " +"``x.getchildren()`` and ``x.iter()`` or ``list(x.iter())`` instead of " +"``x.getiterator()``. (Contributed by Serhiy Storchaka in :issue:`36543`.)" msgstr "" #: ../../whatsnew/3.9.rst:1004 msgid "" "The old :mod:`plistlib` API has been removed, it was deprecated since Python " -"3.4. Use the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:" -"`~plistlib.dump`, and :func:`~plistlib.dumps` functions. Additionally, the " -"*use_builtin_types* parameter was removed, standard :class:`bytes` objects " -"are always used instead. (Contributed by Jon Janzen in :issue:`36409`.)" +"3.4. Use " +"the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:`~plistlib.dump`, " +"and :func:`~plistlib.dumps` functions. Additionally, the *use_builtin_types* " +"parameter was removed, standard :class:`bytes` objects are always used " +"instead. (Contributed by Jon Janzen in :issue:`36409`.)" msgstr "" #: ../../whatsnew/3.9.rst:1010 @@ -1652,9 +1664,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:1015 msgid "" "``base64.encodestring()`` and ``base64.decodestring()``, aliases deprecated " -"since Python 3.1, have been removed: use :func:`base64.encodebytes` and :" -"func:`base64.decodebytes` instead. (Contributed by Victor Stinner in :issue:" -"`39351`.)" +"since Python 3.1, have been removed: use :func:`base64.encodebytes` " +"and :func:`base64.decodebytes` instead. (Contributed by Victor Stinner " +"in :issue:`39351`.)" msgstr "" #: ../../whatsnew/3.9.rst:1020 @@ -1675,9 +1687,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:1029 msgid "" "The *encoding* parameter of :func:`json.loads` has been removed. As of " -"Python 3.1, it was deprecated and ignored; using it has emitted a :exc:" -"`DeprecationWarning` since Python 3.8. (Contributed by Inada Naoki in :issue:" -"`39377`)" +"Python 3.1, it was deprecated and ignored; using it has emitted " +"a :exc:`DeprecationWarning` since Python 3.8. (Contributed by Inada Naoki " +"in :issue:`39377`)" msgstr "" #: ../../whatsnew/3.9.rst:1034 @@ -1691,18 +1703,18 @@ msgstr "" #: ../../whatsnew/3.9.rst:1039 msgid "" "The :func:`!sys.getcounts` function, the ``-X showalloccount`` command line " -"option and the ``show_alloc_count`` field of the C structure :c:type:" -"`PyConfig` have been removed. They required a special Python build by " -"defining ``COUNT_ALLOCS`` macro. (Contributed by Victor Stinner in :issue:" -"`39489`.)" +"option and the ``show_alloc_count`` field of the C " +"structure :c:type:`PyConfig` have been removed. They required a special " +"Python build by defining ``COUNT_ALLOCS`` macro. (Contributed by Victor " +"Stinner in :issue:`39489`.)" msgstr "" #: ../../whatsnew/3.9.rst:1045 msgid "" "The ``_field_types`` attribute of the :class:`typing.NamedTuple` class has " "been removed. It was deprecated since Python 3.8. Use the " -"``__annotations__`` attribute instead. (Contributed by Serhiy Storchaka in :" -"issue:`40182`.)" +"``__annotations__`` attribute instead. (Contributed by Serhiy Storchaka " +"in :issue:`40182`.)" msgstr "" #: ../../whatsnew/3.9.rst:1050 @@ -1715,8 +1727,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:1054 msgid "" "The :meth:`!asyncio.Task.current_task` and :meth:`!asyncio.Task.all_tasks` " -"have been removed. They were deprecated since Python 3.7 and you can use :" -"func:`asyncio.current_task` and :func:`asyncio.all_tasks` instead. " +"have been removed. They were deprecated since Python 3.7 and you can " +"use :func:`asyncio.current_task` and :func:`asyncio.all_tasks` instead. " "(Contributed by Rémi Lapeyre in :issue:`40967`)" msgstr "" @@ -1740,14 +1752,15 @@ msgstr "" #: ../../whatsnew/3.9.rst:1073 msgid "Changes in the Python API" -msgstr "" +msgstr "Python API 的變更" #: ../../whatsnew/3.9.rst:1075 msgid "" -":func:`__import__` and :func:`importlib.util.resolve_name` now raise :exc:" -"`ImportError` where it previously raised :exc:`ValueError`. Callers catching " -"the specific exception type and supporting both Python 3.9 and earlier " -"versions will need to catch both using ``except (ImportError, ValueError):``." +":func:`__import__` and :func:`importlib.util.resolve_name` now " +"raise :exc:`ImportError` where it previously raised :exc:`ValueError`. " +"Callers catching the specific exception type and supporting both Python 3.9 " +"and earlier versions will need to catch both using ``except (ImportError, " +"ValueError):``." msgstr "" #: ../../whatsnew/3.9.rst:1080 @@ -1758,8 +1771,9 @@ msgstr "" #: ../../whatsnew/3.9.rst:1083 msgid "" -"The :meth:`select.epoll.unregister` method no longer ignores the :const:" -"`~errno.EBADF` error. (Contributed by Victor Stinner in :issue:`39239`.)" +"The :meth:`select.epoll.unregister` method no longer ignores " +"the :const:`~errno.EBADF` error. (Contributed by Victor Stinner " +"in :issue:`39239`.)" msgstr "" #: ../../whatsnew/3.9.rst:1087 @@ -1793,10 +1807,10 @@ msgstr "" #: ../../whatsnew/3.9.rst:1105 msgid "" -":meth:`asyncio.loop.shutdown_default_executor` has been added to :class:" -"`~asyncio.AbstractEventLoop`, meaning alternative event loops that inherit " -"from it should have this method defined. (Contributed by Kyle Stanley in :" -"issue:`34037`.)" +":meth:`asyncio.loop.shutdown_default_executor` has been added " +"to :class:`~asyncio.AbstractEventLoop`, meaning alternative event loops that " +"inherit from it should have this method defined. (Contributed by Kyle " +"Stanley in :issue:`34037`.)" msgstr "" #: ../../whatsnew/3.9.rst:1110 @@ -1820,18 +1834,19 @@ msgid "" "The :func:`logging.getLogger` API now returns the root logger when passed " "the name ``'root'``, whereas previously it returned a non-root logger named " "``'root'``. This could affect cases where user code explicitly wants a non-" -"root logger named ``'root'``, or instantiates a logger using ``logging." -"getLogger(__name__)`` in some top-level module called ``'root.py'``. " -"(Contributed by Vinay Sajip in :issue:`37742`.)" +"root logger named ``'root'``, or instantiates a logger using " +"``logging.getLogger(__name__)`` in some top-level module called " +"``'root.py'``. (Contributed by Vinay Sajip in :issue:`37742`.)" msgstr "" #: ../../whatsnew/3.9.rst:1127 msgid "" -"Division handling of :class:`~pathlib.PurePath` now returns :data:" -"`NotImplemented` instead of raising a :exc:`TypeError` when passed something " -"other than an instance of ``str`` or :class:`~pathlib.PurePath`. This " -"allows creating compatible classes that don't inherit from those mentioned " -"types. (Contributed by Roger Aiudi in :issue:`34775`)." +"Division handling of :class:`~pathlib.PurePath` now " +"returns :data:`NotImplemented` instead of raising a :exc:`TypeError` when " +"passed something other than an instance of ``str`` " +"or :class:`~pathlib.PurePath`. This allows creating compatible classes that " +"don't inherit from those mentioned types. (Contributed by Roger Aiudi " +"in :issue:`34775`)." msgstr "" #: ../../whatsnew/3.9.rst:1133 @@ -1846,11 +1861,11 @@ msgstr "" #: ../../whatsnew/3.9.rst:1141 msgid "" -":func:`codecs.lookup` now normalizes the encoding name the same way as :func:" -"`encodings.normalize_encoding`, except that :func:`codecs.lookup` also " -"converts the name to lower case. For example, ``\"latex+latin1\"`` encoding " -"name is now normalized to ``\"latex_latin1\"``. (Contributed by Jordon Xu " -"in :issue:`37751`.)" +":func:`codecs.lookup` now normalizes the encoding name the same way " +"as :func:`encodings.normalize_encoding`, except that :func:`codecs.lookup` " +"also converts the name to lower case. For example, ``\"latex+latin1\"`` " +"encoding name is now normalized to ``\"latex_latin1\"``. (Contributed by " +"Jordon Xu in :issue:`37751`.)" msgstr "" #: ../../whatsnew/3.9.rst:1149 @@ -1863,9 +1878,10 @@ msgid "" "with :c:func:`PyType_FromSpec` and similar APIs) hold a reference to their " "type object since Python 3.8. As indicated in the \"Changes in the C API\" " "of Python 3.8, for the vast majority of cases, there should be no side " -"effect but for types that have a custom :c:member:`~PyTypeObject." -"tp_traverse` function, ensure that all custom ``tp_traverse`` functions of " -"heap-allocated types visit the object's type." +"effect but for types that have a " +"custom :c:member:`~PyTypeObject.tp_traverse` function, ensure that all " +"custom ``tp_traverse`` functions of heap-allocated types visit the object's " +"type." msgstr "" #: ../../whatsnew/3.9.rst:1161 @@ -1920,8 +1936,8 @@ msgstr "(更多資訊請見 :issue:`35810` 與 :issue:`40217`。)" msgid "" "The functions ``PyEval_CallObject``, ``PyEval_CallFunction``, " "``PyEval_CallMethod`` and ``PyEval_CallObjectWithKeywords`` are deprecated. " -"Use :c:func:`PyObject_Call` and its variants instead. (See more details in :" -"issue:`29548`.)" +"Use :c:func:`PyObject_Call` and its variants instead. (See more details " +"in :issue:`29548`.)" msgstr "" #: ../../whatsnew/3.9.rst:1204 @@ -1930,9 +1946,9 @@ msgstr "CPython 位元組碼變更" #: ../../whatsnew/3.9.rst:1206 msgid "" -"The :opcode:`LOAD_ASSERTION_ERROR` opcode was added for handling the :" -"keyword:`assert` statement. Previously, the assert statement would not work " -"correctly if the :exc:`AssertionError` exception was being shadowed. " +"The :opcode:`LOAD_ASSERTION_ERROR` opcode was added for handling " +"the :keyword:`assert` statement. Previously, the assert statement would not " +"work correctly if the :exc:`AssertionError` exception was being shadowed. " "(Contributed by Zackery Spytz in :issue:`34880`.)" msgstr "" @@ -1969,10 +1985,10 @@ msgstr "建置變更" #: ../../whatsnew/3.9.rst:1225 msgid "" "Added ``--with-platlibdir`` option to the ``configure`` script: name of the " -"platform-specific library directory, stored in the new :data:`sys." -"platlibdir` attribute. See :data:`sys.platlibdir` attribute for more " -"information. (Contributed by Jan Matějek, Matěj Cepl, Charalampos Stratakis " -"and Victor Stinner in :issue:`1294959`.)" +"platform-specific library directory, stored in the " +"new :data:`sys.platlibdir` attribute. See :data:`sys.platlibdir` attribute " +"for more information. (Contributed by Jan Matějek, Matěj Cepl, Charalampos " +"Stratakis and Victor Stinner in :issue:`1294959`.)" msgstr "" #: ../../whatsnew/3.9.rst:1231 @@ -2035,16 +2051,16 @@ msgstr "C API 變更" msgid "" ":pep:`573`: Added :c:func:`PyType_FromModuleAndSpec` to associate a module " "with a class; :c:func:`PyType_GetModule` and :c:func:`PyType_GetModuleState` " -"to retrieve the module and its state; and :c:type:`PyCMethod` and :c:macro:" -"`METH_METHOD` to allow a method to access the class it was defined in. " -"(Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)" +"to retrieve the module and its state; and :c:type:`PyCMethod` " +"and :c:macro:`METH_METHOD` to allow a method to access the class it was " +"defined in. (Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)" msgstr "" #: ../../whatsnew/3.9.rst:1280 msgid "" -"Added :c:func:`PyFrame_GetCode` function: get a frame code. Added :c:func:" -"`PyFrame_GetBack` function: get the frame next outer frame. (Contributed by " -"Victor Stinner in :issue:`40421`.)" +"Added :c:func:`PyFrame_GetCode` function: get a frame code. " +"Added :c:func:`PyFrame_GetBack` function: get the frame next outer frame. " +"(Contributed by Victor Stinner in :issue:`40421`.)" msgstr "" #: ../../whatsnew/3.9.rst:1284 @@ -2055,12 +2071,12 @@ msgstr "" #: ../../whatsnew/3.9.rst:1287 msgid "" -"Added :c:func:`PyThreadState_GetInterpreter` and :c:func:" -"`PyInterpreterState_Get` functions to get the interpreter. Added :c:func:" -"`PyThreadState_GetFrame` function to get the current frame of a Python " -"thread state. Added :c:func:`PyThreadState_GetID` function: get the unique " -"identifier of a Python thread state. (Contributed by Victor Stinner in :" -"issue:`39947`.)" +"Added :c:func:`PyThreadState_GetInterpreter` " +"and :c:func:`PyInterpreterState_Get` functions to get the interpreter. " +"Added :c:func:`PyThreadState_GetFrame` function to get the current frame of " +"a Python thread state. Added :c:func:`PyThreadState_GetID` function: get the " +"unique identifier of a Python thread state. (Contributed by Victor Stinner " +"in :issue:`39947`.)" msgstr "" #: ../../whatsnew/3.9.rst:1295 @@ -2102,18 +2118,18 @@ msgstr "" #: ../../whatsnew/3.9.rst:1317 msgid "" -"Added the functions :c:func:`PyObject_GC_IsTracked` and :c:func:" -"`PyObject_GC_IsFinalized` to the public API to allow to query if Python " -"objects are being currently tracked or have been already finalized by the " -"garbage collector respectively. (Contributed by Pablo Galindo Salgado in :" -"issue:`40241`.)" +"Added the functions :c:func:`PyObject_GC_IsTracked` " +"and :c:func:`PyObject_GC_IsFinalized` to the public API to allow to query if " +"Python objects are being currently tracked or have been already finalized by " +"the garbage collector respectively. (Contributed by Pablo Galindo Salgado " +"in :issue:`40241`.)" msgstr "" #: ../../whatsnew/3.9.rst:1323 msgid "" "Added :c:func:`!_PyObject_FunctionStr` to get a user-friendly string " -"representation of a function-like object. (Patch by Jeroen Demeyer in :issue:" -"`37645`.)" +"representation of a function-like object. (Patch by Jeroen Demeyer " +"in :issue:`37645`.)" msgstr "" #: ../../whatsnew/3.9.rst:1327 @@ -2125,20 +2141,21 @@ msgstr "" #: ../../whatsnew/3.9.rst:1335 msgid "" "``PyInterpreterState.eval_frame`` (:pep:`523`) now requires a new mandatory " -"*tstate* parameter (``PyThreadState*``). (Contributed by Victor Stinner in :" -"issue:`38500`.)" +"*tstate* parameter (``PyThreadState*``). (Contributed by Victor Stinner " +"in :issue:`38500`.)" msgstr "" #: ../../whatsnew/3.9.rst:1339 msgid "" -"Extension modules: :c:member:`~PyModuleDef.m_traverse`, :c:member:" -"`~PyModuleDef.m_clear` and :c:member:`~PyModuleDef.m_free` functions of :c:" -"type:`PyModuleDef` are no longer called if the module state was requested " -"but is not allocated yet. This is the case immediately after the module is " -"created and before the module is executed (:c:data:`Py_mod_exec` function). " -"More precisely, these functions are not called if :c:member:`~PyModuleDef." -"m_size` is greater than 0 and the module state (as returned by :c:func:" -"`PyModule_GetState`) is ``NULL``." +"Extension " +"modules: :c:member:`~PyModuleDef.m_traverse`, :c:member:`~PyModuleDef.m_clear` " +"and :c:member:`~PyModuleDef.m_free` functions of :c:type:`PyModuleDef` are " +"no longer called if the module state was requested but is not allocated yet. " +"This is the case immediately after the module is created and before the " +"module is executed (:c:data:`Py_mod_exec` function). More precisely, these " +"functions are not called if :c:member:`~PyModuleDef.m_size` is greater than " +"0 and the module state (as returned by :c:func:`PyModule_GetState`) is " +"``NULL``." msgstr "" #: ../../whatsnew/3.9.rst:1348 @@ -2172,25 +2189,26 @@ msgstr "" #: ../../whatsnew/3.9.rst:1365 msgid "" "The :c:type:`!PyGC_Head` structure is now opaque. It is only defined in the " -"internal C API (``pycore_gc.h``). (Contributed by Victor Stinner in :issue:" -"`40241`.)" +"internal C API (``pycore_gc.h``). (Contributed by Victor Stinner " +"in :issue:`40241`.)" msgstr "" #: ../../whatsnew/3.9.rst:1369 msgid "" -"The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, ``PyUnicode_WSTR_LENGTH``, :c:" -"func:`!PyUnicode_FromUnicode`, :c:func:`!PyUnicode_AsUnicode`, " -"``_PyUnicode_AsUnicode``, and :c:func:`!PyUnicode_AsUnicodeAndSize` are " -"marked as deprecated in C. They have been deprecated by :pep:`393` since " -"Python 3.3. (Contributed by Inada Naoki in :issue:`36346`.)" +"The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, " +"``PyUnicode_WSTR_LENGTH``, :c:func:`!PyUnicode_FromUnicode`, :c:func:`!" +"PyUnicode_AsUnicode`, ``_PyUnicode_AsUnicode``, and :c:func:`!" +"PyUnicode_AsUnicodeAndSize` are marked as deprecated in C. They have been " +"deprecated by :pep:`393` since Python 3.3. (Contributed by Inada Naoki " +"in :issue:`36346`.)" msgstr "" #: ../../whatsnew/3.9.rst:1376 msgid "" "The :c:func:`Py_FatalError` function is replaced with a macro which logs " "automatically the name of the current function, unless the " -"``Py_LIMITED_API`` macro is defined. (Contributed by Victor Stinner in :" -"issue:`39882`.)" +"``Py_LIMITED_API`` macro is defined. (Contributed by Victor Stinner " +"in :issue:`39882`.)" msgstr "" #: ../../whatsnew/3.9.rst:1381 @@ -2210,10 +2228,10 @@ msgstr "" #: ../../whatsnew/3.9.rst:1388 msgid "" -"The :c:func:`!PyObject_NEW` macro becomes an alias to the :c:macro:" -"`PyObject_New` macro, and the :c:func:`!PyObject_NEW_VAR` macro becomes an " -"alias to the :c:macro:`PyObject_NewVar` macro. They no longer access " -"directly the :c:member:`PyTypeObject.tp_basicsize` member." +"The :c:func:`!PyObject_NEW` macro becomes an alias to " +"the :c:macro:`PyObject_New` macro, and the :c:func:`!PyObject_NEW_VAR` macro " +"becomes an alias to the :c:macro:`PyObject_NewVar` macro. They no longer " +"access directly the :c:member:`PyTypeObject.tp_basicsize` member." msgstr "" #: ../../whatsnew/3.9.rst:1393 @@ -2243,8 +2261,8 @@ msgstr "(更多資訊請見 :issue:`40170`。)" #: ../../whatsnew/3.9.rst:1409 msgid "" "Excluded ``PyFPE_START_PROTECT()`` and ``PyFPE_END_PROTECT()`` macros of " -"``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner in :issue:" -"`38835`.)" +"``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner " +"in :issue:`38835`.)" msgstr "" #: ../../whatsnew/3.9.rst:1413 @@ -2261,8 +2279,8 @@ msgstr "" #: ../../whatsnew/3.9.rst:1422 msgid "" -"``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye in :issue:" -"`37878`.)" +"``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye " +"in :issue:`37878`.)" msgstr "" #: ../../whatsnew/3.9.rst:1424 @@ -2419,8 +2437,8 @@ msgid "" "``_Py_InitializeFromWideArgs``, ``_PyFloat_Repr``, ``_PyFloat_Digits``, " "``_PyFloat_DigitsInit``, ``PyFrame_ExtendStack``, ``_PyAIterWrapper_Type``, " "``PyNullImporter_Type``, ``PyCmpWrapper_Type``, ``PySortWrapper_Type``, " -"``PyNoArgsFunction``. (Contributed by Pablo Galindo Salgado in :issue:" -"`39372`.)" +"``PyNoArgsFunction``. (Contributed by Pablo Galindo Salgado " +"in :issue:`39372`.)" msgstr "" #: ../../whatsnew/3.9.rst:1490 @@ -2429,8 +2447,9 @@ msgstr "Python 3.9.1 中顯著的變更" #: ../../whatsnew/3.9.rst:1495 msgid "" -"The behavior of :class:`typing.Literal` was changed to conform with :pep:" -"`586` and to match the behavior of static type checkers specified in the PEP." +"The behavior of :class:`typing.Literal` was changed to conform " +"with :pep:`586` and to match the behavior of static type checkers specified " +"in the PEP." msgstr "" #: ../../whatsnew/3.9.rst:1498 @@ -2513,13 +2532,14 @@ msgid "" "``collections.abc.Callable[[int, str], str]`` will have ``__args__`` of " "``(int, str, str)``; previously this was ``([int, str], str)``. To allow " "this change, :class:`types.GenericAlias` can now be subclassed, and a " -"subclass will be returned when subscripting the :class:`collections.abc." -"Callable` type. Code which accesses the arguments via :func:`typing." -"get_args` or ``__args__`` need to account for this change. A :exc:" -"`DeprecationWarning` may be emitted for invalid forms of parameterizing :" -"class:`collections.abc.Callable` which may have passed silently in Python " -"3.9.1. This :exc:`DeprecationWarning` will become a :exc:`TypeError` in " -"Python 3.10. (Contributed by Ken Jin in :issue:`42195`.)" +"subclass will be returned when subscripting " +"the :class:`collections.abc.Callable` type. Code which accesses the " +"arguments via :func:`typing.get_args` or ``__args__`` need to account for " +"this change. A :exc:`DeprecationWarning` may be emitted for invalid forms " +"of parameterizing :class:`collections.abc.Callable` which may have passed " +"silently in Python 3.9.1. This :exc:`DeprecationWarning` will become " +"a :exc:`TypeError` in Python 3.10. (Contributed by Ken Jin " +"in :issue:`42195`.)" msgstr "" #: ../../whatsnew/3.9.rst:1552 ../../whatsnew/3.9.rst:1577 @@ -2529,13 +2549,14 @@ msgstr "urllib.parse" #: ../../whatsnew/3.9.rst:1554 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " -"parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." -"parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " -"recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" -"func:`!cgi.parse_multipart` as they use the affected functions internally. " -"For more details, please see their respective documentation. (Contributed by " -"Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" +"parameter separators in :func:`urllib.parse.parse_qs` " +"and :func:`urllib.parse.parse_qsl`. Due to security concerns, and to " +"conform with newer W3C recommendations, this has been changed to allow only " +"a single separator key, with ``&`` as the default. This change also " +"affects :func:`!cgi.parse` and :func:`!cgi.parse_multipart` as they use the " +"affected functions internally. For more details, please see their respective " +"documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " +"in :issue:`42967`.)" msgstr "" #: ../../whatsnew/3.9.rst:1565 @@ -2558,11 +2579,12 @@ msgstr "Python 3.9.5 中顯著的變更" #: ../../whatsnew/3.9.rst:1579 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " -"forms of attacks. Following the WHATWG specification that updates :rfc:" -"`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` characters are " -"stripped from the URL by the parser in :mod:`urllib.parse` preventing such " -"attacks. The removal characters are controlled by a new module level " -"variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" +"forms of attacks. Following the WHATWG specification that " +"updates :rfc:`3986`, ASCII newline ``\\n``, ``\\r`` and tab ``\\t`` " +"characters are stripped from the URL by the parser in :mod:`urllib.parse` " +"preventing such attacks. The removal characters are controlled by a new " +"module level variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. " +"(See :gh:`88048`)" msgstr "" #: ../../whatsnew/3.9.rst:1587